From a0a29598b3e77118bb785f8d49b2450f266a7de4 Mon Sep 17 00:00:00 2001 From: SONOLET Aymeric Date: Fri, 15 Dec 2023 17:03:58 +0100 Subject: [PATCH] format: format all using clang-format --- .gitignore | 1 - .salomeport | 2 +- CMakeCommon/CodeCoverage.cmake | 18 +- CMakeCommon/FindPlaneGCS.cmake | 2 +- CMakeCommon/FindPython.cmake | 2 +- CMakeCommon/FindSUIT.cmake | 2 +- CMakeCommon/FindSalomeOpenCASCADE.cmake | 2 +- CMakeCommon/FindSolveSpace.cmake | 2 +- CMakeCommon/Logger.cmake | 72 +- CMakeCommon/UseQtExt.cmake | 6 +- CMakeCommon/cmake_uninstall.cmake.in | 2 +- README | 5 +- build_Salome_deb.bat | 2 +- build_Salome_rel.bat | 2 +- doc/gui/General/TUI_tutorial.rst | 2 +- doc/swig/doxyfile.in | 4 +- doc/tui/CADBuilder/general_architecture.doc | 2 +- doc/tui/Modules.doc | 44 +- doc/tui/Shaper/general_architecture.doc | 2 +- doc/tui/doxyfile.in | 4 +- doc/tui/first_feature_help.doc | 14 +- doc/tui/index.doc | 2 +- env_lcov.sh | 2 +- findDOSfiles.sh | 6 +- findEndLines.sh | 2 +- find_duplicated_images.sh | 2 +- fixDOSfiles.sh | 2 +- lcov-reset.sh | 1 - salome_run.sh | 3 +- solver.sh | 3 +- squishserver_run.sh | 2 +- src/BuildAPI/BuildAPI.h | 7 +- src/BuildAPI/BuildAPI_CompSolid.cpp | 42 +- src/BuildAPI/BuildAPI_CompSolid.h | 30 +- src/BuildAPI/BuildAPI_Compound.cpp | 42 +- src/BuildAPI/BuildAPI_Compound.h | 30 +- src/BuildAPI/BuildAPI_Edge.cpp | 77 +- src/BuildAPI/BuildAPI_Edge.h | 49 +- src/BuildAPI/BuildAPI_Face.cpp | 42 +- src/BuildAPI/BuildAPI_Face.h | 28 +- src/BuildAPI/BuildAPI_Filling.cpp | 123 +- src/BuildAPI/BuildAPI_Filling.h | 102 +- src/BuildAPI/BuildAPI_Interpolation.cpp | 172 +- src/BuildAPI/BuildAPI_Interpolation.h | 135 +- src/BuildAPI/BuildAPI_Polyline.cpp | 54 +- src/BuildAPI/BuildAPI_Polyline.h | 37 +- src/BuildAPI/BuildAPI_Shell.cpp | 42 +- src/BuildAPI/BuildAPI_Shell.h | 28 +- src/BuildAPI/BuildAPI_Solid.cpp | 41 +- src/BuildAPI/BuildAPI_Solid.h | 28 +- src/BuildAPI/BuildAPI_SubShapes.cpp | 54 +- src/BuildAPI/BuildAPI_SubShapes.h | 40 +- src/BuildAPI/BuildAPI_Vertex.cpp | 69 +- src/BuildAPI/BuildAPI_Vertex.h | 42 +- src/BuildAPI/BuildAPI_Wire.cpp | 52 +- src/BuildAPI/BuildAPI_Wire.h | 30 +- src/BuildAPI/BuildAPI_swig.h | 29 +- src/BuildPlugin/BuildPlugin.h | 23 +- src/BuildPlugin/BuildPlugin_CompSolid.cpp | 13 +- src/BuildPlugin/BuildPlugin_CompSolid.h | 18 +- src/BuildPlugin/BuildPlugin_Compound.cpp | 32 +- src/BuildPlugin/BuildPlugin_Compound.h | 18 +- src/BuildPlugin/BuildPlugin_Edge.cpp | 65 +- src/BuildPlugin/BuildPlugin_Edge.h | 36 +- src/BuildPlugin/BuildPlugin_Face.cpp | 135 +- src/BuildPlugin/BuildPlugin_Face.h | 33 +- src/BuildPlugin/BuildPlugin_Filling.cpp | 138 +- src/BuildPlugin/BuildPlugin_Filling.h | 62 +- src/BuildPlugin/BuildPlugin_Interpolation.cpp | 219 +- src/BuildPlugin/BuildPlugin_Interpolation.h | 79 +- src/BuildPlugin/BuildPlugin_Plugin.cpp | 50 +- src/BuildPlugin/BuildPlugin_Plugin.h | 8 +- src/BuildPlugin/BuildPlugin_Polyline.cpp | 42 +- src/BuildPlugin/BuildPlugin_Polyline.h | 55 +- src/BuildPlugin/BuildPlugin_Shape.cpp | 32 +- src/BuildPlugin/BuildPlugin_Shape.h | 20 +- src/BuildPlugin/BuildPlugin_Shell.cpp | 27 +- src/BuildPlugin/BuildPlugin_Shell.h | 18 +- src/BuildPlugin/BuildPlugin_Solid.cpp | 28 +- src/BuildPlugin/BuildPlugin_Solid.h | 20 +- src/BuildPlugin/BuildPlugin_SubShapes.cpp | 73 +- src/BuildPlugin/BuildPlugin_SubShapes.h | 23 +- src/BuildPlugin/BuildPlugin_Validators.cpp | 331 +-- src/BuildPlugin/BuildPlugin_Validators.h | 106 +- src/BuildPlugin/BuildPlugin_Vertex.cpp | 52 +- src/BuildPlugin/BuildPlugin_Vertex.h | 28 +- src/BuildPlugin/BuildPlugin_Wire.cpp | 231 +- src/BuildPlugin/BuildPlugin_Wire.h | 32 +- src/BuildPlugin/CMakeLists.txt | 6 +- src/BuildPlugin/doc/TUI_compoundFeature.rst | 3 +- src/BuildPlugin/doc/TUI_compsolidFeature.rst | 3 +- src/BuildPlugin/doc/TUI_edgeFeature.rst | 3 +- .../doc/TUI_edgeSegmentFeature.rst | 3 +- src/BuildPlugin/doc/TUI_faceFeatures.rst | 3 +- src/BuildPlugin/doc/TUI_fillingFeature.rst | 3 +- .../doc/TUI_interpolationAnalytical.rst | 5 +- .../doc/TUI_interpolationBySelection.rst | 3 +- src/BuildPlugin/doc/TUI_polylineFeature.rst | 3 +- src/BuildPlugin/doc/TUI_shellFeature.rst | 3 +- src/BuildPlugin/doc/TUI_solidFeature.rst | 3 +- src/BuildPlugin/doc/TUI_subshapeFeature.rst | 2 +- src/BuildPlugin/doc/TUI_vertexFeature.rst | 3 +- src/BuildPlugin/doc/TUI_wireFeature.rst | 3 +- src/BuildPlugin/doc/compoundFeature.rst | 2 +- src/BuildPlugin/doc/compsolidFeature.rst | 2 +- src/BuildPlugin/doc/edgeFeature.rst | 4 +- src/BuildPlugin/doc/faceFeature.rst | 6 +- src/BuildPlugin/doc/interpolationFeature.rst | 10 +- src/BuildPlugin/doc/polylineFeature.rst | 2 +- src/BuildPlugin/doc/shellFeature.rst | 4 +- src/BuildPlugin/doc/solidFeature.rst | 4 +- src/BuildPlugin/doc/subShapesFeature.rst | 4 - src/BuildPlugin/doc/vertexFeature.rst | 2 +- src/BuildPlugin/doc/wireFeature.rst | 4 +- src/BuildPlugin/interpolation_widget.xml | 2 +- src/CollectionAPI/CollectionAPI.h | 7 +- src/CollectionAPI/CollectionAPI_Field.cpp | 150 +- src/CollectionAPI/CollectionAPI_Field.h | 71 +- src/CollectionAPI/CollectionAPI_Group.cpp | 74 +- src/CollectionAPI/CollectionAPI_Group.h | 39 +- .../CollectionAPI_GroupAddition.cpp | 38 +- .../CollectionAPI_GroupAddition.h | 30 +- .../CollectionAPI_GroupIntersection.cpp | 39 +- .../CollectionAPI_GroupIntersection.h | 30 +- .../CollectionAPI_GroupShape.cpp | 35 +- src/CollectionAPI/CollectionAPI_GroupShape.h | 30 +- .../CollectionAPI_GroupSubstraction.cpp | 43 +- .../CollectionAPI_GroupSubstraction.h | 40 +- src/CollectionPlugin/CMakeLists.txt | 6 +- src/CollectionPlugin/CollectionPlugin.h | 7 +- .../CollectionPlugin_Field.cpp | 33 +- src/CollectionPlugin/CollectionPlugin_Field.h | 53 +- .../CollectionPlugin_Group.cpp | 119 +- src/CollectionPlugin/CollectionPlugin_Group.h | 31 +- .../CollectionPlugin_GroupAddition.cpp | 7 +- .../CollectionPlugin_GroupAddition.h | 15 +- .../CollectionPlugin_GroupIntersection.cpp | 40 +- .../CollectionPlugin_GroupIntersection.h | 20 +- .../CollectionPlugin_GroupMerge.cpp | 31 +- .../CollectionPlugin_GroupMerge.h | 16 +- .../CollectionPlugin_GroupOperation.cpp | 12 +- .../CollectionPlugin_GroupOperation.h | 10 +- .../CollectionPlugin_GroupShape.cpp | 16 +- .../CollectionPlugin_GroupShape.h | 15 +- .../CollectionPlugin_GroupSubstraction.cpp | 41 +- .../CollectionPlugin_GroupSubstraction.h | 26 +- .../CollectionPlugin_Plugin.cpp | 39 +- .../CollectionPlugin_Plugin.h | 12 +- .../CollectionPlugin_Validators.cpp | 59 +- .../CollectionPlugin_Validators.h | 40 +- .../CollectionPlugin_WidgetCreator.cpp | 26 +- .../CollectionPlugin_WidgetCreator.h | 30 +- .../CollectionPlugin_WidgetField.cpp | 516 +++-- .../CollectionPlugin_WidgetField.h | 103 +- src/CollectionPlugin/doc/fieldFeature.rst | 20 +- .../doc/groupAdditionFeature.rst | 2 +- src/CollectionPlugin/doc/groupFeature.rst | 6 +- .../doc/groupIntersectionFeature.rst | 2 +- .../doc/groupShapeFeature.rst | 2 +- .../doc/groupSubstractionFeature.rst | 2 +- src/CollectionPlugin/group_widget.xml | 2 +- src/CollectionPlugin/tests.set | 2 +- src/Config/CMakeLists.txt | 6 +- src/Config/Config_AttributeMessage.cpp | 66 +- src/Config/Config_AttributeMessage.h | 49 +- src/Config/Config_Common.cpp | 160 +- src/Config/Config_Common.h | 41 +- src/Config/Config_DataModelReader.cpp | 69 +- src/Config/Config_DataModelReader.h | 73 +- src/Config/Config_FeatureMessage.cpp | 170 +- src/Config/Config_FeatureMessage.h | 170 +- src/Config/Config_FeatureReader.cpp | 176 +- src/Config/Config_FeatureReader.h | 34 +- src/Config/Config_Keywords.h | 219 +- src/Config/Config_ModuleReader.cpp | 388 ++-- src/Config/Config_ModuleReader.h | 84 +- src/Config/Config_PluginMessage.cpp | 27 +- src/Config/Config_PluginMessage.h | 26 +- src/Config/Config_PointerMessage.cpp | 27 +- src/Config/Config_PointerMessage.h | 18 +- src/Config/Config_Prop.cpp | 14 +- src/Config/Config_Prop.h | 108 +- src/Config/Config_PropManager.cpp | 115 +- src/Config/Config_PropManager.h | 67 +- src/Config/Config_Translator.cpp | 68 +- src/Config/Config_Translator.h | 70 +- src/Config/Config_ValidatorMessage.cpp | 43 +- src/Config/Config_ValidatorMessage.h | 32 +- src/Config/Config_ValidatorReader.cpp | 40 +- src/Config/Config_ValidatorReader.h | 27 +- src/Config/Config_WidgetAPI.cpp | 72 +- src/Config/Config_WidgetAPI.h | 41 +- src/Config/Config_WidgetReader.cpp | 60 +- src/Config/Config_WidgetReader.h | 28 +- src/Config/Config_XMLReader.cpp | 172 +- src/Config/Config_XMLReader.h | 62 +- src/Config/Config_def.h | 9 +- src/Config/Config_swig.h | 30 +- src/Config/dataModel.xml | 2 +- src/ConnectorAPI/ConnectorAPI.h | 7 +- src/ConnectorAPI/ConnectorAPI_Connector.cpp | 9 +- src/ConnectorAPI/ConnectorAPI_Connector.h | 5 +- src/ConnectorAPI/ConnectorAPI_swig.h | 7 +- src/ConnectorAPI/Test/TestImportSTEP.py | 2 +- src/ConnectorAPI/Test/data/cube_ascii.stl | 2 +- src/ConnectorPlugin/doc/ConnectorPlugin.rst | 2 +- src/ConnectorPlugin/plugin-Connector.xml | 2 +- src/ConstructionAPI/CMakeLists.txt | 6 +- src/ConstructionAPI/ConstructionAPI.h | 7 +- src/ConstructionAPI/ConstructionAPI_Axis.cpp | 420 ++-- src/ConstructionAPI/ConstructionAPI_Axis.h | 247 +-- src/ConstructionAPI/ConstructionAPI_Plane.cpp | 375 ++-- src/ConstructionAPI/ConstructionAPI_Plane.h | 239 +- src/ConstructionAPI/ConstructionAPI_Point.cpp | 343 +-- src/ConstructionAPI/ConstructionAPI_Point.h | 236 +- src/ConstructionAPI/ConstructionAPI_swig.h | 13 +- src/ConstructionPlugin/CMakeLists.txt | 6 +- src/ConstructionPlugin/ConstructionPlugin.h | 7 +- .../ConstructionPlugin_Axis.cpp | 190 +- .../ConstructionPlugin_Axis.h | 107 +- .../ConstructionPlugin_Plane.cpp | 262 +-- .../ConstructionPlugin_Plane.h | 133 +- .../ConstructionPlugin_Plugin.cpp | 94 +- .../ConstructionPlugin_Plugin.h | 9 +- .../ConstructionPlugin_Point.cpp | 209 +- .../ConstructionPlugin_Point.h | 158 +- .../ConstructionPlugin_Validators.cpp | 234 +- .../ConstructionPlugin_Validators.h | 85 +- .../doc/TUI_axis1Feature.rst | 3 +- .../doc/TUI_axis2Feature.rst | 3 +- .../doc/TUI_axis3Feature.rst | 3 +- .../doc/TUI_axis4Feature.rst | 3 +- .../doc/TUI_axis5Feature.rst | 3 +- .../doc/TUI_axis6Feature.rst | 3 +- .../doc/TUI_plane1Feature.rst | 3 +- .../doc/TUI_plane2Feature.rst | 3 +- .../doc/TUI_plane3Feature.rst | 3 +- .../doc/TUI_plane4Feature.rst | 3 +- .../doc/TUI_point1Feature.rst | 3 +- .../doc/TUI_point2Feature.rst | 3 +- .../doc/TUI_point3Feature.rst | 2 +- .../doc/TUI_point4Feature.rst | 2 +- .../doc/TUI_point5Feature.rst | 2 +- src/ConstructionPlugin/doc/planeFeature.rst | 4 +- src/ConstructionPlugin/doc/pointFeature.rst | 2 +- src/Events/Events.h | 7 +- src/Events/Events_InfoMessage.cpp | 15 +- src/Events/Events_InfoMessage.h | 62 +- src/Events/Events_Listener.cpp | 27 +- src/Events/Events_Listener.h | 28 +- src/Events/Events_LongOp.cpp | 35 +- src/Events/Events_LongOp.h | 12 +- src/Events/Events_Loop.cpp | 190 +- src/Events/Events_Loop.h | 87 +- src/Events/Events_Message.cpp | 3 +- src/Events/Events_Message.h | 62 +- src/Events/Events_MessageBool.cpp | 6 +- src/Events/Events_MessageBool.h | 18 +- src/Events/Events_MessageGroup.cpp | 13 +- src/Events/Events_MessageGroup.h | 20 +- src/ExchangeAPI/CMakeLists.txt | 6 +- src/ExchangeAPI/ExchangeAPI.h | 7 +- src/ExchangeAPI/ExchangeAPI_Export.cpp | 436 ++-- src/ExchangeAPI/ExchangeAPI_Export.h | 204 +- src/ExchangeAPI/ExchangeAPI_Import.cpp | 223 +- src/ExchangeAPI/ExchangeAPI_Import.h | 110 +- src/ExchangeAPI/ExchangeAPI_swig.h | 11 +- src/ExchangePlugin/ExchangePlugin.h | 23 +- src/ExchangePlugin/ExchangePlugin_Dump.cpp | 91 +- src/ExchangePlugin/ExchangePlugin_Dump.h | 41 +- .../ExchangePlugin_ExportFeature.cpp | 705 +++--- .../ExchangePlugin_ExportFeature.h | 92 +- .../ExchangePlugin_ExportPart.cpp | 131 +- .../ExchangePlugin_ExportPart.h | 32 +- src/ExchangePlugin/ExchangePlugin_Import.cpp | 131 +- src/ExchangePlugin/ExchangePlugin_Import.h | 111 +- .../ExchangePlugin_ImportFeature.cpp | 651 +++--- .../ExchangePlugin_ImportFeature.h | 104 +- .../ExchangePlugin_ImportPart.cpp | 106 +- .../ExchangePlugin_ImportPart.h | 29 +- src/ExchangePlugin/ExchangePlugin_Plugin.cpp | 45 +- src/ExchangePlugin/ExchangePlugin_Plugin.h | 12 +- src/ExchangePlugin/ExchangePlugin_Tools.cpp | 25 +- src/ExchangePlugin/ExchangePlugin_Tools.h | 16 +- .../ExchangePlugin_Validators.cpp | 64 +- .../ExchangePlugin_Validators.h | 41 +- src/ExchangePlugin/ExchangePlugin_msg_fr.ts | 4 +- src/ExchangePlugin/Test/CMakeLists.txt | 6 +- src/ExchangePlugin/Test/tests_gui.set | 2 +- src/ExchangePlugin/doc/TUI_exportFeature.rst | 6 +- src/ExchangePlugin/doc/TUI_exportPart.rst | 3 +- src/ExchangePlugin/doc/TUI_importFeature.rst | 4 +- src/ExchangePlugin/doc/dumpFeature.rst | 4 +- src/ExchangePlugin/doc/exportFeature.rst | 12 +- src/ExchangePlugin/doc/importFeature.rst | 8 +- src/FeaturesAPI/FeaturesAPI.h | 7 +- src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp | 111 +- src/FeaturesAPI/FeaturesAPI_BooleanCommon.h | 73 +- src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp | 76 +- src/FeaturesAPI/FeaturesAPI_BooleanCut.h | 58 +- src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp | 73 +- src/FeaturesAPI/FeaturesAPI_BooleanFill.h | 58 +- src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp | 122 +- src/FeaturesAPI/FeaturesAPI_BooleanFuse.h | 86 +- src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp | 73 +- src/FeaturesAPI/FeaturesAPI_BooleanSmash.h | 58 +- src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp | 37 +- src/FeaturesAPI/FeaturesAPI_BoundingBox.h | 28 +- src/FeaturesAPI/FeaturesAPI_Chamfer.cpp | 96 +- src/FeaturesAPI/FeaturesAPI_Chamfer.h | 71 +- src/FeaturesAPI/FeaturesAPI_Copy.cpp | 49 +- src/FeaturesAPI/FeaturesAPI_Copy.h | 35 +- src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp | 43 +- src/FeaturesAPI/FeaturesAPI_Defeaturing.h | 30 +- src/FeaturesAPI/FeaturesAPI_Extrusion.cpp | 334 +-- src/FeaturesAPI/FeaturesAPI_Extrusion.h | 207 +- .../FeaturesAPI_ExtrusionBoolean.cpp | 732 +++--- .../FeaturesAPI_ExtrusionBoolean.h | 468 ++-- src/FeaturesAPI/FeaturesAPI_Fillet.cpp | 190 +- src/FeaturesAPI/FeaturesAPI_Fillet.h | 132 +- src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp | 43 +- src/FeaturesAPI/FeaturesAPI_FusionFaces.h | 31 +- .../FeaturesAPI_GeometryCalculation.cpp | 23 +- .../FeaturesAPI_GeometryCalculation.h | 10 +- src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp | 67 +- src/FeaturesAPI/FeaturesAPI_GlueFaces.h | 47 +- src/FeaturesAPI/FeaturesAPI_ImportResult.cpp | 41 +- src/FeaturesAPI/FeaturesAPI_ImportResult.h | 31 +- src/FeaturesAPI/FeaturesAPI_Intersection.cpp | 69 +- src/FeaturesAPI/FeaturesAPI_Intersection.h | 48 +- .../FeaturesAPI_LimitTolerance.cpp | 62 +- src/FeaturesAPI/FeaturesAPI_LimitTolerance.h | 40 +- src/FeaturesAPI/FeaturesAPI_Loft.cpp | 49 +- src/FeaturesAPI/FeaturesAPI_Loft.h | 34 +- src/FeaturesAPI/FeaturesAPI_Measurement.cpp | 111 +- src/FeaturesAPI/FeaturesAPI_Measurement.h | 38 +- src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp | 109 +- src/FeaturesAPI/FeaturesAPI_MultiRotation.h | 71 +- .../FeaturesAPI_MultiTranslation.cpp | 138 +- .../FeaturesAPI_MultiTranslation.h | 103 +- src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp | 69 +- src/FeaturesAPI/FeaturesAPI_NormalToFace.h | 50 +- src/FeaturesAPI/FeaturesAPI_Partition.cpp | 68 +- src/FeaturesAPI/FeaturesAPI_Partition.h | 48 +- src/FeaturesAPI/FeaturesAPI_Pipe.cpp | 160 +- src/FeaturesAPI/FeaturesAPI_Pipe.h | 102 +- src/FeaturesAPI/FeaturesAPI_Placement.cpp | 95 +- src/FeaturesAPI/FeaturesAPI_Placement.h | 56 +- .../FeaturesAPI_PointCloudOnFace.cpp | 55 +- .../FeaturesAPI_PointCloudOnFace.h | 42 +- .../FeaturesAPI_PointCoordinates.cpp | 27 +- .../FeaturesAPI_PointCoordinates.h | 8 +- src/FeaturesAPI/FeaturesAPI_Recover.cpp | 66 +- src/FeaturesAPI/FeaturesAPI_Recover.h | 35 +- src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp | 43 +- src/FeaturesAPI/FeaturesAPI_RemoveResults.h | 30 +- .../FeaturesAPI_RemoveSubShapes.cpp | 77 +- src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h | 47 +- src/FeaturesAPI/FeaturesAPI_Revolution.cpp | 231 +- src/FeaturesAPI/FeaturesAPI_Revolution.h | 149 +- .../FeaturesAPI_RevolutionBoolean.cpp | 455 ++-- .../FeaturesAPI_RevolutionBoolean.h | 293 +-- src/FeaturesAPI/FeaturesAPI_Rotation.cpp | 133 +- src/FeaturesAPI/FeaturesAPI_Rotation.h | 86 +- src/FeaturesAPI/FeaturesAPI_Scale.cpp | 118 +- src/FeaturesAPI/FeaturesAPI_Scale.h | 99 +- src/FeaturesAPI/FeaturesAPI_Sewing.cpp | 74 +- src/FeaturesAPI/FeaturesAPI_Sewing.h | 54 +- src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp | 47 +- src/FeaturesAPI/FeaturesAPI_SharedFaces.h | 34 +- src/FeaturesAPI/FeaturesAPI_Symmetry.cpp | 96 +- src/FeaturesAPI/FeaturesAPI_Symmetry.h | 60 +- src/FeaturesAPI/FeaturesAPI_Translation.cpp | 185 +- src/FeaturesAPI/FeaturesAPI_Translation.h | 118 +- src/FeaturesAPI/FeaturesAPI_Union.cpp | 66 +- src/FeaturesAPI/FeaturesAPI_Union.h | 47 +- src/FeaturesAPI/FeaturesAPI_swig.h | 87 +- src/FeaturesPlugin/FeaturesPlugin.h | 7 +- src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp | 113 +- src/FeaturesPlugin/FeaturesPlugin_Boolean.h | 37 +- .../FeaturesPlugin_BooleanCommon.cpp | 128 +- .../FeaturesPlugin_BooleanCommon.h | 26 +- .../FeaturesPlugin_BooleanCut.cpp | 82 +- .../FeaturesPlugin_BooleanCut.h | 18 +- .../FeaturesPlugin_BooleanFill.cpp | 63 +- .../FeaturesPlugin_BooleanFill.h | 20 +- .../FeaturesPlugin_BooleanFuse.cpp | 179 +- .../FeaturesPlugin_BooleanFuse.h | 35 +- .../FeaturesPlugin_BooleanSmash.cpp | 104 +- .../FeaturesPlugin_BooleanSmash.h | 23 +- .../FeaturesPlugin_BoundingBox.cpp | 78 +- .../FeaturesPlugin_BoundingBox.h | 47 +- .../FeaturesPlugin_BoundingBoxBase.cpp | 54 +- .../FeaturesPlugin_BoundingBoxBase.h | 6 +- src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp | 74 +- src/FeaturesPlugin/FeaturesPlugin_Chamfer.h | 46 +- .../FeaturesPlugin_CommonSharedFaces.cpp | 39 +- .../FeaturesPlugin_CommonSharedFaces.h | 14 +- .../FeaturesPlugin_CompositeBoolean.cpp | 620 +++--- .../FeaturesPlugin_CompositeBoolean.h | 63 +- .../FeaturesPlugin_CompositeSketch.cpp | 275 +-- .../FeaturesPlugin_CompositeSketch.h | 58 +- src/FeaturesPlugin/FeaturesPlugin_Copy.cpp | 84 +- src/FeaturesPlugin/FeaturesPlugin_Copy.h | 44 +- .../FeaturesPlugin_Defeaturing.cpp | 53 +- .../FeaturesPlugin_Defeaturing.h | 23 +- .../FeaturesPlugin_Extrusion.cpp | 103 +- src/FeaturesPlugin/FeaturesPlugin_Extrusion.h | 73 +- .../FeaturesPlugin_ExtrusionBoolean.cpp | 37 +- .../FeaturesPlugin_ExtrusionBoolean.h | 25 +- .../FeaturesPlugin_ExtrusionCut.cpp | 11 +- .../FeaturesPlugin_ExtrusionCut.h | 17 +- .../FeaturesPlugin_ExtrusionFuse.cpp | 75 +- .../FeaturesPlugin_ExtrusionFuse.h | 21 +- src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp | 53 +- src/FeaturesPlugin/FeaturesPlugin_Fillet.h | 45 +- .../FeaturesPlugin_Fillet1D.cpp | 68 +- src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h | 45 +- .../FeaturesPlugin_FusionFaces.cpp | 28 +- .../FeaturesPlugin_FusionFaces.h | 18 +- .../FeaturesPlugin_GeometryCalculation.cpp | 31 +- .../FeaturesPlugin_GeometryCalculation.h | 35 +- .../FeaturesPlugin_GlueFaces.cpp | 84 +- src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h | 36 +- .../FeaturesPlugin_GroupSharedFaces.cpp | 74 +- .../FeaturesPlugin_GroupSharedFaces.h | 38 +- .../FeaturesPlugin_ImportResult.cpp | 188 +- .../FeaturesPlugin_ImportResult.h | 56 +- .../FeaturesPlugin_InspectBoundingBox.cpp | 112 +- .../FeaturesPlugin_InspectBoundingBox.h | 48 +- .../FeaturesPlugin_InspectNormalToFace.cpp | 62 +- .../FeaturesPlugin_InspectNormalToFace.h | 36 +- .../FeaturesPlugin_Intersection.cpp | 68 +- .../FeaturesPlugin_Intersection.h | 34 +- .../FeaturesPlugin_LimitTolerance.cpp | 30 +- .../FeaturesPlugin_LimitTolerance.h | 26 +- src/FeaturesPlugin/FeaturesPlugin_Loft.cpp | 35 +- src/FeaturesPlugin/FeaturesPlugin_Loft.h | 21 +- .../FeaturesPlugin_Measurement.cpp | 243 +- .../FeaturesPlugin_Measurement.h | 92 +- .../FeaturesPlugin_MultiRotation.cpp | 205 +- .../FeaturesPlugin_MultiRotation.h | 62 +- .../FeaturesPlugin_MultiTranslation.cpp | 110 +- .../FeaturesPlugin_MultiTranslation.h | 52 +- .../FeaturesPlugin_NormalToFace.cpp | 56 +- .../FeaturesPlugin_NormalToFace.h | 29 +- .../FeaturesPlugin_Partition.cpp | 140 +- src/FeaturesPlugin/FeaturesPlugin_Partition.h | 49 +- src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp | 404 ++-- src/FeaturesPlugin/FeaturesPlugin_Pipe.h | 44 +- .../FeaturesPlugin_Placement.cpp | 118 +- src/FeaturesPlugin/FeaturesPlugin_Placement.h | 49 +- src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp | 71 +- src/FeaturesPlugin/FeaturesPlugin_Plugin.h | 12 +- .../FeaturesPlugin_PointCloudOnFace.cpp | 35 +- .../FeaturesPlugin_PointCloudOnFace.h | 26 +- .../FeaturesPlugin_PointCoordinates.cpp | 36 +- .../FeaturesPlugin_PointCoordinates.h | 35 +- src/FeaturesPlugin/FeaturesPlugin_Recover.cpp | 45 +- src/FeaturesPlugin/FeaturesPlugin_Recover.h | 49 +- .../FeaturesPlugin_RemoveResults.cpp | 10 +- .../FeaturesPlugin_RemoveResults.h | 20 +- .../FeaturesPlugin_RemoveSubShapes.cpp | 166 +- .../FeaturesPlugin_RemoveSubShapes.h | 39 +- .../FeaturesPlugin_Revolution.cpp | 88 +- .../FeaturesPlugin_Revolution.h | 54 +- .../FeaturesPlugin_RevolutionBoolean.cpp | 21 +- .../FeaturesPlugin_RevolutionBoolean.h | 24 +- .../FeaturesPlugin_RevolutionCut.cpp | 11 +- .../FeaturesPlugin_RevolutionCut.h | 15 +- .../FeaturesPlugin_RevolutionFuse.cpp | 11 +- .../FeaturesPlugin_RevolutionFuse.h | 19 +- .../FeaturesPlugin_Rotation.cpp | 94 +- src/FeaturesPlugin/FeaturesPlugin_Rotation.h | 46 +- src/FeaturesPlugin/FeaturesPlugin_Scale.cpp | 88 +- src/FeaturesPlugin/FeaturesPlugin_Scale.h | 46 +- src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp | 86 +- src/FeaturesPlugin/FeaturesPlugin_Sewing.h | 39 +- .../FeaturesPlugin_SharedFaces.cpp | 105 +- .../FeaturesPlugin_SharedFaces.h | 40 +- .../FeaturesPlugin_Symmetry.cpp | 148 +- src/FeaturesPlugin/FeaturesPlugin_Symmetry.h | 60 +- src/FeaturesPlugin/FeaturesPlugin_Tools.cpp | 91 +- src/FeaturesPlugin/FeaturesPlugin_Tools.h | 22 +- .../FeaturesPlugin_Translation.cpp | 97 +- .../FeaturesPlugin_Translation.h | 55 +- src/FeaturesPlugin/FeaturesPlugin_Union.cpp | 81 +- src/FeaturesPlugin/FeaturesPlugin_Union.h | 27 +- .../FeaturesPlugin_ValidatorTransform.cpp | 35 +- .../FeaturesPlugin_ValidatorTransform.h | 14 +- .../FeaturesPlugin_Validators.cpp | 1035 ++++----- .../FeaturesPlugin_Validators.h | 420 ++-- .../FeaturesPlugin_VersionedBoolean.cpp | 244 +- .../FeaturesPlugin_VersionedBoolean.h | 91 +- .../FeaturesPlugin_VersionedChFi.cpp | 68 +- .../FeaturesPlugin_VersionedChFi.h | 20 +- src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts | 6 +- src/FeaturesPlugin/data/PLANFISS_bug1868.brep | 56 +- .../data/face_peau_bug1868.brep | 60 +- .../doc/TUI_angularcopyFeature.rst | 3 +- .../doc/TUI_boundingBoxFeature.rst | 2 +- .../doc/TUI_chamferDistAngle.rst | 2 +- .../doc/TUI_chamferDistances.rst | 2 +- src/FeaturesPlugin/doc/TUI_commonFeature.rst | 3 +- src/FeaturesPlugin/doc/TUI_copyFeature.rst | 3 +- src/FeaturesPlugin/doc/TUI_cutFeature.rst | 3 +- .../doc/TUI_defeaturingFeature.rst | 5 +- .../doc/TUI_extrusionByBoundingPlanes.rst | 3 +- .../doc/TUI_extrusionBySizes.rst | 3 +- .../doc/TUI_extrusionCutByBoundingPlanes.rst | 3 +- .../doc/TUI_extrusionCutBySizes.rst | 3 +- .../doc/TUI_extrusionCutThroughAll.rst | 3 +- .../doc/TUI_extrusionFuseByBoundingPlanes.rst | 3 +- .../doc/TUI_extrusionFuseBySizes.rst | 3 +- .../doc/TUI_extrusionFuseThroughAll.rst | 3 +- .../doc/TUI_fillet1DVertices.rst | 3 +- src/FeaturesPlugin/doc/TUI_fillet1DWire.rst | 3 +- .../doc/TUI_filletfixedFeature.rst | 2 +- .../doc/TUI_filletvariableFeature.rst | 2 +- src/FeaturesPlugin/doc/TUI_fuseFeature.rst | 3 +- .../doc/TUI_fusefacesFeature.rst | 2 +- .../doc/TUI_geometryCalculation.rst | 3 +- .../doc/TUI_glueFeatureFaces.rst | 2 +- .../doc/TUI_importResultFeature.rst | 3 +- .../doc/TUI_intersectionFeature.rst | 3 +- .../doc/TUI_limitToleranceFeature.rst | 3 +- .../doc/TUI_linearcopyFeature.rst | 2 +- src/FeaturesPlugin/doc/TUI_loftFeature.rst | 2 +- .../doc/TUI_partitionFeature.rst | 3 +- .../doc/TUI_pipebinormalFeature.rst | 2 +- .../doc/TUI_pipelocationsFeature.rst | 2 +- .../doc/TUI_pipesimpleFeature.rst | 2 +- .../doc/TUI_placementFeature.rst | 3 +- .../doc/TUI_pointCoordinates.rst | 3 +- .../doc/TUI_recoverCompoundFeature.rst | 3 +- .../doc/TUI_recoverDefaultFeature.rst | 3 +- .../doc/TUI_removeSubShapesFeature.rst | 3 +- .../doc/TUI_revolutionByAngles.rst | 3 +- .../doc/TUI_revolutionByBoundingPlanes.rst | 3 +- .../doc/TUI_revolutionCutByAngles.rst | 3 +- .../doc/TUI_revolutionCutByBoundingPlanes.rst | 3 +- .../doc/TUI_revolutionCutThroughAll.rst | 3 +- .../doc/TUI_revolutionFuseByAngles.rst | 3 +- .../TUI_revolutionFuseByBoundingPlanes.rst | 3 +- .../doc/TUI_revolutionFuseThroughAll.rst | 3 +- .../doc/TUI_rotation3pointsFeature.rst | 2 +- .../doc/TUI_rotationaxisFeature.rst | 2 +- .../doc/TUI_scaleXYZFeature.rst | 2 +- .../doc/TUI_scalefactorFeature.rst | 2 +- src/FeaturesPlugin/doc/TUI_sewingFeature.rst | 3 +- .../doc/TUI_sharedFacesFeature.rst | 2 +- src/FeaturesPlugin/doc/TUI_smashFeature.rst | 3 +- src/FeaturesPlugin/doc/TUI_splitFeature.rst | 3 +- .../doc/TUI_symmetryaxisFeature.rst | 2 +- .../doc/TUI_symmetryplaneFeature.rst | 2 +- .../doc/TUI_symmetrypointFeature.rst | 2 +- .../doc/TUI_translation2pointsFeature.rst | 2 +- .../doc/TUI_translationdxdydzFeature.rst | 2 +- .../doc/TUI_translationvectorFeature.rst | 2 +- src/FeaturesPlugin/doc/TUI_unionFeature.rst | 3 +- src/FeaturesPlugin/doc/angularCopyFeature.rst | 4 +- src/FeaturesPlugin/doc/booleanArguments.rst | 2 +- src/FeaturesPlugin/doc/boundingBoxFeature.rst | 12 +- src/FeaturesPlugin/doc/chamferFeature.rst | 10 +- src/FeaturesPlugin/doc/copyFeature.rst | 2 +- src/FeaturesPlugin/doc/defeaturingFeature.rst | 2 +- .../doc/extrusionCutFeature.rst | 4 +- src/FeaturesPlugin/doc/fillet1dFeature.rst | 8 +- src/FeaturesPlugin/doc/filletFeature.rst | 8 +- src/FeaturesPlugin/doc/fuseFeatureFaces.rst | 4 +- .../doc/geometryCalculationFeature.rst | 8 +- src/FeaturesPlugin/doc/glueFeatureFaces.rst | 4 +- .../doc/importResultFeature.rst | 2 +- .../doc/intersectionFeature.rst | 6 +- src/FeaturesPlugin/doc/linearCopyFeature.rst | 2 +- src/FeaturesPlugin/doc/measurementFeature.rst | 43 +- .../doc/normalToFaceFeature.rst | 16 +- src/FeaturesPlugin/doc/partitionFeature.rst | 2 +- src/FeaturesPlugin/doc/pipeFeature.rst | 24 +- src/FeaturesPlugin/doc/placementFeature.rst | 2 +- .../doc/pointCoordinatesFeature.rst | 8 +- .../doc/revolutionFuseFeature.rst | 2 +- src/FeaturesPlugin/doc/rotationFeature.rst | 10 +- src/FeaturesPlugin/doc/symmetryFeature.rst | 16 +- .../doc/transformationFeature.rst | 16 +- src/FeaturesPlugin/doc/translationFeature.rst | 10 +- src/FeaturesPlugin/doc/unionFeature.rst | 2 +- .../multitranslation_widget.xml | 2 +- src/FeaturesPlugin/scale_widget.xml | 2 +- src/FiltersAPI/FiltersAPI.h | 7 +- src/FiltersAPI/FiltersAPI_Argument.cpp | 59 +- src/FiltersAPI/FiltersAPI_Argument.h | 24 +- src/FiltersAPI/FiltersAPI_Feature.cpp | 57 +- src/FiltersAPI/FiltersAPI_Feature.h | 13 +- src/FiltersAPI/FiltersAPI_Filter.cpp | 45 +- src/FiltersAPI/FiltersAPI_Filter.h | 33 +- src/FiltersAPI/FiltersAPI_Selection.cpp | 43 +- src/FiltersAPI/FiltersAPI_Selection.h | 19 +- src/FiltersAPI/FiltersAPI_swig.h | 15 +- src/FiltersPlugin/FiltersPlugin.h | 7 +- src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp | 25 +- src/FiltersPlugin/FiltersPlugin_BelongsTo.h | 29 +- .../FiltersPlugin_ContinuousFaces.cpp | 105 +- .../FiltersPlugin_ContinuousFaces.h | 45 +- src/FiltersPlugin/FiltersPlugin_EdgeSize.cpp | 47 +- src/FiltersPlugin/FiltersPlugin_EdgeSize.h | 28 +- .../FiltersPlugin_ExternalFaces.cpp | 16 +- .../FiltersPlugin_ExternalFaces.h | 30 +- src/FiltersPlugin/FiltersPlugin_FaceSize.cpp | 49 +- src/FiltersPlugin/FiltersPlugin_FaceSize.h | 29 +- .../FiltersPlugin_FeatureEdges.cpp | 67 +- .../FiltersPlugin_FeatureEdges.h | 45 +- .../FiltersPlugin_HorizontalFace.cpp | 15 +- .../FiltersPlugin_HorizontalFace.h | 27 +- .../FiltersPlugin_OnGeometry.cpp | 25 +- src/FiltersPlugin/FiltersPlugin_OnGeometry.h | 26 +- src/FiltersPlugin/FiltersPlugin_OnLine.cpp | 38 +- src/FiltersPlugin/FiltersPlugin_OnLine.h | 29 +- src/FiltersPlugin/FiltersPlugin_OnPlane.cpp | 56 +- src/FiltersPlugin/FiltersPlugin_OnPlane.h | 29 +- .../FiltersPlugin_OnPlaneSide.cpp | 27 +- src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h | 29 +- .../FiltersPlugin_OnShapeName.cpp | 36 +- src/FiltersPlugin/FiltersPlugin_OnShapeName.h | 46 +- .../FiltersPlugin_OppositeToEdge.cpp | 60 +- .../FiltersPlugin_OppositeToEdge.h | 29 +- src/FiltersPlugin/FiltersPlugin_Plugin.cpp | 28 +- src/FiltersPlugin/FiltersPlugin_Plugin.h | 11 +- .../FiltersPlugin_RelativeToSolid.cpp | 30 +- .../FiltersPlugin_RelativeToSolid.h | 29 +- src/FiltersPlugin/FiltersPlugin_Selection.cpp | 76 +- src/FiltersPlugin/FiltersPlugin_Selection.h | 53 +- .../FiltersPlugin_Validators.cpp | 14 +- src/FiltersPlugin/FiltersPlugin_Validators.h | 15 +- .../FiltersPlugin_VerticalFace.cpp | 20 +- .../FiltersPlugin_VerticalFace.h | 27 +- .../FiltersPlugin_VolumeSize.cpp | 49 +- src/FiltersPlugin/FiltersPlugin_VolumeSize.h | 29 +- src/FiltersPlugin/doc/FiltersPlugin.rst | 23 +- src/FiltersPlugin/filter-OnShapeName.xml | 2 +- src/GDMLAPI/GDMLAPI.h | 7 +- src/GDMLAPI/GDMLAPI_ConeSegment.cpp | 97 +- src/GDMLAPI/GDMLAPI_ConeSegment.h | 85 +- src/GDMLAPI/GDMLAPI_Ellipsoid.cpp | 111 +- src/GDMLAPI/GDMLAPI_Ellipsoid.h | 97 +- src/GDMLAPI/GDMLAPI_swig.h | 12 +- src/GDMLPlugin/GDMLPlugin.h | 7 +- src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp | 66 +- src/GDMLPlugin/GDMLPlugin_ConeSegment.h | 43 +- src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp | 72 +- src/GDMLPlugin/GDMLPlugin_Ellipsoid.h | 43 +- src/GDMLPlugin/GDMLPlugin_Plugin.cpp | 12 +- src/GDMLPlugin/GDMLPlugin_Plugin.h | 12 +- src/GDMLPlugin/doc/TUI_coneFeature.rst | 3 +- src/GDMLPlugin/doc/TUI_ellipsoidFeature.rst | 3 +- src/GDMLPlugin/doc/coneFeature.rst | 8 +- src/GDMLPlugin/doc/ellipsoidFeature.rst | 8 +- src/GDMLPlugin/ellipsoid_widget.xml | 14 +- src/GeomAPI/CMakeLists.txt | 6 +- src/GeomAPI/GeomAPI.h | 7 +- src/GeomAPI/GeomAPI_AISObject.cpp | 227 +- src/GeomAPI/GeomAPI_AISObject.h | 31 +- src/GeomAPI/GeomAPI_Angle.cpp | 44 +- src/GeomAPI/GeomAPI_Angle.h | 21 +- src/GeomAPI/GeomAPI_Angle2d.cpp | 109 +- src/GeomAPI/GeomAPI_Angle2d.h | 30 +- src/GeomAPI/GeomAPI_Ax1.cpp | 48 +- src/GeomAPI/GeomAPI_Ax1.h | 12 +- src/GeomAPI/GeomAPI_Ax2.cpp | 40 +- src/GeomAPI/GeomAPI_Ax2.h | 12 +- src/GeomAPI/GeomAPI_Ax3.cpp | 83 +- src/GeomAPI/GeomAPI_Ax3.h | 29 +- src/GeomAPI/GeomAPI_BSpline.cpp | 57 +- src/GeomAPI/GeomAPI_BSpline.h | 15 +- src/GeomAPI/GeomAPI_BSpline2d.cpp | 147 +- src/GeomAPI/GeomAPI_BSpline2d.h | 52 +- src/GeomAPI/GeomAPI_Box.cpp | 54 +- src/GeomAPI/GeomAPI_Box.h | 14 +- src/GeomAPI/GeomAPI_Circ.cpp | 73 +- src/GeomAPI/GeomAPI_Circ.h | 52 +- src/GeomAPI/GeomAPI_Circ2d.cpp | 90 +- src/GeomAPI/GeomAPI_Circ2d.h | 55 +- src/GeomAPI/GeomAPI_Cone.cpp | 110 +- src/GeomAPI/GeomAPI_Cone.h | 30 +- src/GeomAPI/GeomAPI_Curve.cpp | 95 +- src/GeomAPI/GeomAPI_Curve.h | 26 +- src/GeomAPI/GeomAPI_Cylinder.cpp | 74 +- src/GeomAPI/GeomAPI_Cylinder.h | 29 +- .../GeomAPI_DataMapOfShapeMapOfShapes.cpp | 170 +- .../GeomAPI_DataMapOfShapeMapOfShapes.h | 33 +- src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp | 70 +- src/GeomAPI/GeomAPI_DataMapOfShapeShape.h | 28 +- src/GeomAPI/GeomAPI_Dir.cpp | 63 +- src/GeomAPI/GeomAPI_Dir.h | 20 +- src/GeomAPI/GeomAPI_Dir2d.cpp | 42 +- src/GeomAPI/GeomAPI_Dir2d.h | 17 +- src/GeomAPI/GeomAPI_Edge.cpp | 309 +-- src/GeomAPI/GeomAPI_Edge.h | 37 +- src/GeomAPI/GeomAPI_Ellipse.cpp | 84 +- src/GeomAPI/GeomAPI_Ellipse.h | 46 +- src/GeomAPI/GeomAPI_Ellipse2d.cpp | 180 +- src/GeomAPI/GeomAPI_Ellipse2d.h | 69 +- src/GeomAPI/GeomAPI_Face.cpp | 262 +-- src/GeomAPI/GeomAPI_Face.h | 17 +- src/GeomAPI/GeomAPI_ICustomPrs.cpp | 8 +- src/GeomAPI/GeomAPI_ICustomPrs.h | 7 +- src/GeomAPI/GeomAPI_IPresentable.cpp | 10 +- src/GeomAPI/GeomAPI_IPresentable.h | 11 +- src/GeomAPI/GeomAPI_IScreenParams.h | 26 +- src/GeomAPI/GeomAPI_Interface.cpp | 18 +- src/GeomAPI/GeomAPI_Interface.h | 44 +- src/GeomAPI/GeomAPI_Lin.cpp | 118 +- src/GeomAPI/GeomAPI_Lin.h | 34 +- src/GeomAPI/GeomAPI_Lin2d.cpp | 93 +- src/GeomAPI/GeomAPI_Lin2d.h | 34 +- src/GeomAPI/GeomAPI_PlanarEdges.cpp | 75 +- src/GeomAPI/GeomAPI_PlanarEdges.h | 22 +- src/GeomAPI/GeomAPI_Pln.cpp | 116 +- src/GeomAPI/GeomAPI_Pln.h | 37 +- src/GeomAPI/GeomAPI_Pnt.cpp | 107 +- src/GeomAPI/GeomAPI_Pnt.h | 40 +- src/GeomAPI/GeomAPI_Pnt2d.cpp | 73 +- src/GeomAPI/GeomAPI_Pnt2d.h | 25 +- src/GeomAPI/GeomAPI_Shape.cpp | 540 ++--- src/GeomAPI/GeomAPI_Shape.h | 115 +- src/GeomAPI/GeomAPI_ShapeExplorer.cpp | 68 +- src/GeomAPI/GeomAPI_ShapeExplorer.h | 48 +- src/GeomAPI/GeomAPI_ShapeHierarchy.cpp | 172 +- src/GeomAPI/GeomAPI_ShapeHierarchy.h | 101 +- src/GeomAPI/GeomAPI_ShapeIterator.cpp | 30 +- src/GeomAPI/GeomAPI_ShapeIterator.h | 31 +- src/GeomAPI/GeomAPI_Shell.cpp | 117 +- src/GeomAPI/GeomAPI_Shell.h | 8 +- src/GeomAPI/GeomAPI_Solid.cpp | 114 +- src/GeomAPI/GeomAPI_Solid.h | 16 +- src/GeomAPI/GeomAPI_Sphere.cpp | 28 +- src/GeomAPI/GeomAPI_Sphere.h | 10 +- src/GeomAPI/GeomAPI_Tools.cpp | 8 +- src/GeomAPI/GeomAPI_Tools.h | 11 +- src/GeomAPI/GeomAPI_Torus.cpp | 51 +- src/GeomAPI/GeomAPI_Torus.h | 13 +- src/GeomAPI/GeomAPI_Trsf.cpp | 63 +- src/GeomAPI/GeomAPI_Trsf.h | 28 +- src/GeomAPI/GeomAPI_Vertex.cpp | 65 +- src/GeomAPI/GeomAPI_Vertex.h | 28 +- src/GeomAPI/GeomAPI_Wire.cpp | 55 +- src/GeomAPI/GeomAPI_Wire.h | 14 +- src/GeomAPI/GeomAPI_WireExplorer.cpp | 40 +- src/GeomAPI/GeomAPI_WireExplorer.h | 19 +- src/GeomAPI/GeomAPI_XY.cpp | 64 +- src/GeomAPI/GeomAPI_XY.h | 21 +- src/GeomAPI/GeomAPI_XYZ.cpp | 92 +- src/GeomAPI/GeomAPI_XYZ.h | 22 +- src/GeomAPI/GeomAPI_swig.h | 123 +- src/GeomAlgoAPI/CMakeLists.txt | 1 - src/GeomAlgoAPI/GeomAlgoAPI.h | 7 +- src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp | 15 +- src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h | 11 +- src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h | 9 +- src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp | 162 +- src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h | 47 +- src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.cpp | 360 +-- src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.h | 32 +- src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp | 70 +- src/GeomAlgoAPI/GeomAlgoAPI_Box.h | 46 +- .../GeomAlgoAPI_CanonicalRecognition.cpp | 172 +- .../GeomAlgoAPI_CanonicalRecognition.h | 61 +- src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp | 53 +- src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h | 39 +- src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp | 313 ++- src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.h | 41 +- .../GeomAlgoAPI_CompoundBuilder.cpp | 44 +- src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h | 28 +- src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp | 24 +- src/GeomAlgoAPI/GeomAlgoAPI_Cone.h | 16 +- src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp | 82 +- src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h | 33 +- src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_Copy.h | 17 +- src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp | 72 +- src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.h | 57 +- src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp | 27 +- src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp | 24 +- src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.h | 12 +- src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.h | 15 +- src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp | 186 +- src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h | 97 +- src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp | 62 +- src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h | 17 +- src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_Exception.h | 11 +- src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp | 65 +- src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h | 41 +- src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp | 37 +- src/GeomAlgoAPI/GeomAlgoAPI_Fillet.h | 27 +- src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp | 94 +- src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h | 38 +- src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp | 66 +- src/GeomAlgoAPI/GeomAlgoAPI_Filling.h | 11 +- src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp | 94 +- src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.h | 13 +- src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp | 99 +- src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h | 11 +- src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp | 64 +- src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h | 9 +- src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.cpp | 58 +- src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.h | 10 +- src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp | 44 +- src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h | 20 +- .../GeomAlgoAPI_LimitTolerance.cpp | 25 +- src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.h | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp | 40 +- src/GeomAlgoAPI/GeomAlgoAPI_Loft.h | 27 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp | 288 +-- src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h | 88 +- .../GeomAlgoAPI_MakeShapeCustom.cpp | 41 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp | 104 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h | 25 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp | 28 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h | 13 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.cpp | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h | 22 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp | 43 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h | 20 +- .../GeomAlgoAPI_MapShapesAndAncestors.cpp | 9 +- .../GeomAlgoAPI_MapShapesAndAncestors.h | 18 +- src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp | 180 +- src/GeomAlgoAPI/GeomAlgoAPI_NExplode.h | 43 +- src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp | 207 +- src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.h | 22 +- src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.cpp | 97 +- src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.h | 18 +- src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp | 42 +- src/GeomAlgoAPI/GeomAlgoAPI_Offset.h | 32 +- src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp | 147 +- src/GeomAlgoAPI/GeomAlgoAPI_Partition.h | 18 +- src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp | 46 +- src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h | 25 +- src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp | 190 +- src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h | 34 +- src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp | 120 +- src/GeomAlgoAPI/GeomAlgoAPI_Placement.h | 51 +- src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp | 72 +- src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h | 41 +- .../GeomAlgoAPI_PointCloudOnFace.cpp | 633 +++--- .../GeomAlgoAPI_PointCloudOnFace.h | 18 +- src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp | 516 +++-- src/GeomAlgoAPI/GeomAlgoAPI_Prism.h | 52 +- src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_Projection.h | 15 +- src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp | 551 ++--- src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h | 46 +- src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp | 37 +- src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h | 27 +- src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp | 101 +- src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h | 17 +- src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp | 90 +- src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h | 29 +- .../GeomAlgoAPI_STEPImportXCAF.cpp | 258 ++- src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h | 13 +- src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp | 58 +- src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h | 13 +- src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp | 28 +- src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h | 9 +- src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp | 55 +- src/GeomAlgoAPI/GeomAlgoAPI_Scale.h | 41 +- src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp | 56 +- src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h | 25 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp | 777 ++++--- src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h | 238 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp | 119 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.h | 60 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp | 175 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h | 93 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 961 ++++---- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h | 227 +- src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp | 171 +- src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h | 41 +- .../GeomAlgoAPI_SolidClassifier.cpp | 113 +- src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h | 21 +- .../GeomAlgoAPI_SortListOfShapes.cpp | 76 +- .../GeomAlgoAPI_SortListOfShapes.h | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp | 98 +- src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h | 22 +- src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h | 33 +- src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.cpp | 43 +- src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp | 40 +- src/GeomAlgoAPI/GeomAlgoAPI_Tools.h | 23 +- src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp | 16 +- src/GeomAlgoAPI/GeomAlgoAPI_Torus.h | 14 +- src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp | 22 +- src/GeomAlgoAPI/GeomAlgoAPI_Transform.h | 17 +- src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp | 26 +- src/GeomAlgoAPI/GeomAlgoAPI_Translation.h | 37 +- src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp | 41 +- src/GeomAlgoAPI/GeomAlgoAPI_Tube.h | 16 +- .../GeomAlgoAPI_UnifySameDomain.cpp | 79 +- src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h | 22 +- src/GeomAlgoAPI/GeomAlgoAPI_Utils.cpp | 27 +- src/GeomAlgoAPI/GeomAlgoAPI_Utils.h | 99 +- src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp | 164 +- src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h | 45 +- src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp | 47 +- src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.h | 16 +- src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp | 43 +- src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.h | 15 +- src/GeomAlgoAPI/GeomAlgoAPI_swig.h | 116 +- src/GeomAlgoImpl/GEOMAlgo_Algo.cxx | 39 +- src/GeomAlgoImpl/GEOMAlgo_Algo.hxx | 25 +- src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx | 1449 ++++++------ src/GeomAlgoImpl/GEOMAlgo_AlgoTools.hxx | 185 +- src/GeomAlgoImpl/GEOMAlgo_AlgoTools_1.cxx | 82 +- src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx | 40 +- src/GeomAlgoImpl/GEOMAlgo_BndSphere.hxx | 58 +- src/GeomAlgoImpl/GEOMAlgo_BndSphere.lxx | 18 +- src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx | 66 +- src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx | 29 +- src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx | 102 +- src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx | 50 +- src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx | 72 +- src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.hxx | 27 +- src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx | 369 ++-- src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx | 39 +- src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx | 400 ++-- src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx | 91 +- src/GeomAlgoImpl/GEOMAlgo_Gluer2_1.cxx | 197 +- src/GeomAlgoImpl/GEOMAlgo_Gluer2_2.cxx | 85 +- src/GeomAlgoImpl/GEOMAlgo_Gluer2_3.cxx | 222 +- src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx | 121 +- src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.hxx | 43 +- .../GEOMAlgo_IndexedDataMapOfIntegerShape.hxx | 15 +- ...ndexedDataMapOfPassKeyShapeListOfShape.hxx | 14 +- ...EOMAlgo_IndexedDataMapOfShapeBndSphere.hxx | 19 +- ...IndexedDataMapOfShapeIndexedMapOfShape.hxx | 16 +- ...lgo_ListIteratorOfListOfCoupleOfShapes.hxx | 3 +- .../GEOMAlgo_ListOfCoupleOfShapes.hxx | 8 +- src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx | 191 +- src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.hxx | 56 +- .../GEOMAlgo_PassKeyShapeMapHasher.cxx | 23 +- .../GEOMAlgo_PassKeyShapeMapHasher.hxx | 26 +- src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx | 225 +- src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx | 46 +- src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx | 652 +++--- src/GeomAlgoImpl/GEOMImpl_Fillet1d.hxx | 110 +- src/GeomAlgoImpl/GeomAlgoImpl.h | 7 +- src/GeomData/GeomData.h | 7 +- src/GeomData/GeomData_Dir.cpp | 80 +- src/GeomData/GeomData_Dir.h | 26 +- src/GeomData/GeomData_Point.cpp | 134 +- src/GeomData/GeomData_Point.h | 47 +- src/GeomData/GeomData_Point2D.cpp | 83 +- src/GeomData/GeomData_Point2D.h | 37 +- src/GeomData/GeomData_Point2DArray.cpp | 70 +- src/GeomData/GeomData_Point2DArray.h | 30 +- src/GeomDataAPI/CMakeLists.txt | 6 +- src/GeomDataAPI/GeomDataAPI.h | 7 +- src/GeomDataAPI/GeomDataAPI_Dir.cpp | 17 +- src/GeomDataAPI/GeomDataAPI_Dir.h | 22 +- src/GeomDataAPI/GeomDataAPI_Point.cpp | 16 +- src/GeomDataAPI/GeomDataAPI_Point.h | 63 +- src/GeomDataAPI/GeomDataAPI_Point2D.cpp | 31 +- src/GeomDataAPI/GeomDataAPI_Point2D.h | 52 +- src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp | 16 +- src/GeomDataAPI/GeomDataAPI_Point2DArray.h | 26 +- src/GeomDataAPI/GeomDataAPI_swig.h | 33 +- src/GeomValidators/GeomValidators.h | 7 +- .../GeomValidators_BodyShapes.cpp | 39 +- .../GeomValidators_BodyShapes.h | 15 +- .../GeomValidators_ConstructionComposite.cpp | 64 +- .../GeomValidators_ConstructionComposite.h | 24 +- .../GeomValidators_Different.cpp | 50 +- src/GeomValidators/GeomValidators_Different.h | 23 +- .../GeomValidators_DifferentShapes.cpp | 68 +- .../GeomValidators_DifferentShapes.h | 34 +- src/GeomValidators/GeomValidators_Face.cpp | 84 +- src/GeomValidators/GeomValidators_Face.h | 23 +- .../GeomValidators_FeatureKind.cpp | 37 +- .../GeomValidators_FeatureKind.h | 15 +- src/GeomValidators/GeomValidators_Finite.cpp | 28 +- src/GeomValidators/GeomValidators_Finite.h | 20 +- .../GeomValidators_GlobalSelection.cpp | 34 +- .../GeomValidators_GlobalSelection.h | 15 +- .../GeomValidators_Intersected.cpp | 19 +- .../GeomValidators_Intersected.h | 15 +- .../GeomValidators_IntersectionSelection.cpp | 47 +- .../GeomValidators_MinObjectsSelected.cpp | 37 +- .../GeomValidators_MinObjectsSelected.h | 19 +- .../GeomValidators_NotSelfIntersected.cpp | 54 +- .../GeomValidators_NotSelfIntersected.h | 16 +- src/GeomValidators/GeomValidators_Plugin.cpp | 48 +- src/GeomValidators/GeomValidators_Plugin.h | 11 +- .../GeomValidators_Positive.cpp | 16 +- src/GeomValidators/GeomValidators_Positive.h | 17 +- .../GeomValidators_ShapeType.cpp | 188 +- src/GeomValidators/GeomValidators_ShapeType.h | 50 +- src/GeomValidators/GeomValidators_Tools.cpp | 46 +- src/GeomValidators/GeomValidators_Tools.h | 16 +- .../GeomValidators_ValueOrder.cpp | 64 +- .../GeomValidators_ValueOrder.h | 37 +- .../GeomValidators_ZeroOffset.cpp | 133 +- .../GeomValidators_ZeroOffset.h | 26 +- src/InitializationPlugin/CMakeLists.txt | 1 - .../InitializationPlugin.h | 8 +- .../InitializationPlugin_EvalListener.cpp | 303 ++- .../InitializationPlugin_EvalListener.h | 45 +- .../InitializationPlugin_Plugin.cpp | 137 +- .../InitializationPlugin_Plugin.h | 26 +- .../InitializationPlugin_PyInterp.cpp | 155 +- .../InitializationPlugin_PyInterp.h | 29 +- src/Locale/CMakeLists.txt | 6 +- src/Locale/Locale_Convert.cpp | 36 +- src/Locale/Locale_Convert.h | 47 +- src/Locale/Locale_def.h | 15 +- src/Model/Model.h | 7 +- src/Model/Model_Application.cpp | 113 +- src/Model/Model_Application.h | 28 +- src/Model/Model_AttributeBoolean.cpp | 23 +- src/Model/Model_AttributeBoolean.h | 19 +- src/Model/Model_AttributeDocRef.cpp | 29 +- src/Model/Model_AttributeDocRef.h | 17 +- src/Model/Model_AttributeDouble.cpp | 52 +- src/Model/Model_AttributeDouble.h | 22 +- src/Model/Model_AttributeDoubleArray.cpp | 43 +- src/Model/Model_AttributeDoubleArray.h | 20 +- src/Model/Model_AttributeImage.cpp | 81 +- src/Model/Model_AttributeImage.h | 31 +- src/Model/Model_AttributeIntArray.cpp | 49 +- src/Model/Model_AttributeIntArray.h | 32 +- src/Model/Model_AttributeInteger.cpp | 52 +- src/Model/Model_AttributeInteger.h | 24 +- src/Model/Model_AttributeRefAttr.cpp | 79 +- src/Model/Model_AttributeRefAttr.h | 31 +- src/Model/Model_AttributeRefAttrList.cpp | 217 +- src/Model/Model_AttributeRefAttrList.h | 41 +- src/Model/Model_AttributeRefList.cpp | 170 +- src/Model/Model_AttributeRefList.h | 58 +- src/Model/Model_AttributeReference.cpp | 86 +- src/Model/Model_AttributeReference.h | 24 +- src/Model/Model_AttributeSelection.cpp | 1285 ++++++----- src/Model/Model_AttributeSelection.h | 183 +- src/Model/Model_AttributeSelectionList.cpp | 311 +-- src/Model/Model_AttributeSelectionList.h | 103 +- src/Model/Model_AttributeString.cpp | 44 +- src/Model/Model_AttributeString.h | 21 +- src/Model/Model_AttributeStringArray.cpp | 37 +- src/Model/Model_AttributeStringArray.h | 16 +- src/Model/Model_AttributeTables.cpp | 198 +- src/Model/Model_AttributeTables.h | 62 +- src/Model/Model_AttributeValidator.cpp | 106 +- src/Model/Model_AttributeValidator.h | 21 +- src/Model/Model_BodyBuilder.cpp | 784 ++++--- src/Model/Model_BodyBuilder.h | 133 +- src/Model/Model_Data.cpp | 614 ++--- src/Model/Model_Data.h | 272 +-- src/Model/Model_Document.cpp | 1488 +++++++------ src/Model/Model_Document.h | 384 ++-- src/Model/Model_Events.cpp | 110 +- src/Model/Model_Events.h | 86 +- src/Model/Model_Expression.cpp | 71 +- src/Model/Model_Expression.h | 84 +- src/Model/Model_FeatureValidator.cpp | 40 +- src/Model/Model_FeatureValidator.h | 39 +- src/Model/Model_FiltersFactory.cpp | 128 +- src/Model/Model_FiltersFactory.h | 43 +- src/Model/Model_Objects.cpp | 1221 +++++----- src/Model/Model_Objects.h | 257 ++- src/Model/Model_ResultBody.cpp | 387 ++-- src/Model/Model_ResultBody.h | 133 +- src/Model/Model_ResultConstruction.cpp | 394 ++-- src/Model/Model_ResultConstruction.h | 41 +- src/Model/Model_ResultField.cpp | 72 +- src/Model/Model_ResultField.h | 42 +- src/Model/Model_ResultGroup.cpp | 48 +- src/Model/Model_ResultGroup.h | 16 +- src/Model/Model_ResultParameter.cpp | 15 +- src/Model/Model_ResultParameter.h | 13 +- src/Model/Model_ResultPart.cpp | 259 ++- src/Model/Model_ResultPart.h | 58 +- src/Model/Model_Session.cpp | 518 +++-- src/Model/Model_Session.h | 102 +- src/Model/Model_Tools.cpp | 82 +- src/Model/Model_Tools.h | 20 +- src/Model/Model_Update.cpp | 839 ++++--- src/Model/Model_Update.h | 104 +- src/Model/Model_Validator.cpp | 272 +-- src/Model/Model_Validator.h | 120 +- src/ModelAPI/CMakeLists.txt | 6 +- src/ModelAPI/ModelAPI.h | 7 +- src/ModelAPI/ModelAPI_Attribute.cpp | 67 +- src/ModelAPI/ModelAPI_Attribute.h | 41 +- src/ModelAPI/ModelAPI_AttributeBoolean.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeBoolean.h | 15 +- src/ModelAPI/ModelAPI_AttributeDocRef.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeDocRef.h | 18 +- src/ModelAPI/ModelAPI_AttributeDouble.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeDouble.h | 24 +- .../ModelAPI_AttributeDoubleArray.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeDoubleArray.h | 14 +- src/ModelAPI/ModelAPI_AttributeImage.cpp | 17 +- src/ModelAPI/ModelAPI_AttributeImage.h | 37 +- src/ModelAPI/ModelAPI_AttributeIntArray.cpp | 17 +- src/ModelAPI/ModelAPI_AttributeIntArray.h | 25 +- src/ModelAPI/ModelAPI_AttributeInteger.cpp | 17 +- src/ModelAPI/ModelAPI_AttributeInteger.h | 24 +- src/ModelAPI/ModelAPI_AttributeRefAttr.cpp | 17 +- src/ModelAPI/ModelAPI_AttributeRefAttr.h | 22 +- .../ModelAPI_AttributeRefAttrList.cpp | 18 +- src/ModelAPI/ModelAPI_AttributeRefAttrList.h | 33 +- src/ModelAPI/ModelAPI_AttributeRefList.cpp | 18 +- src/ModelAPI/ModelAPI_AttributeRefList.h | 39 +- src/ModelAPI/ModelAPI_AttributeReference.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeReference.h | 18 +- src/ModelAPI/ModelAPI_AttributeSelection.cpp | 17 +- src/ModelAPI/ModelAPI_AttributeSelection.h | 85 +- .../ModelAPI_AttributeSelectionList.cpp | 10 +- .../ModelAPI_AttributeSelectionList.h | 106 +- src/ModelAPI/ModelAPI_AttributeString.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeString.h | 21 +- .../ModelAPI_AttributeStringArray.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeStringArray.h | 14 +- src/ModelAPI/ModelAPI_AttributeTables.cpp | 16 +- src/ModelAPI/ModelAPI_AttributeTables.h | 63 +- src/ModelAPI/ModelAPI_AttributeValidator.cpp | 8 +- src/ModelAPI/ModelAPI_AttributeValidator.h | 12 +- src/ModelAPI/ModelAPI_BodyBuilder.cpp | 15 +- src/ModelAPI/ModelAPI_BodyBuilder.h | 108 +- src/ModelAPI/ModelAPI_CompositeFeature.cpp | 16 +- src/ModelAPI/ModelAPI_CompositeFeature.h | 18 +- src/ModelAPI/ModelAPI_Data.cpp | 11 +- src/ModelAPI/ModelAPI_Data.h | 190 +- src/ModelAPI/ModelAPI_Document.cpp | 11 +- src/ModelAPI/ModelAPI_Document.h | 258 ++- src/ModelAPI/ModelAPI_Entity.h | 9 +- .../ModelAPI_EventReentrantMessage.cpp | 10 +- src/ModelAPI/ModelAPI_EventReentrantMessage.h | 69 +- src/ModelAPI/ModelAPI_Events.cpp | 395 ++-- src/ModelAPI/ModelAPI_Events.h | 567 ++--- src/ModelAPI/ModelAPI_Expression.cpp | 47 +- src/ModelAPI/ModelAPI_Expression.h | 52 +- src/ModelAPI/ModelAPI_Feature.cpp | 205 +- src/ModelAPI/ModelAPI_Feature.h | 208 +- src/ModelAPI/ModelAPI_FeatureValidator.cpp | 19 +- src/ModelAPI/ModelAPI_FeatureValidator.h | 32 +- src/ModelAPI/ModelAPI_Filter.cpp | 7 +- src/ModelAPI/ModelAPI_Filter.h | 40 +- src/ModelAPI/ModelAPI_FiltersArgs.h | 22 +- src/ModelAPI/ModelAPI_FiltersFactory.h | 42 +- src/ModelAPI/ModelAPI_FiltersFeature.h | 35 +- src/ModelAPI/ModelAPI_Folder.cpp | 34 +- src/ModelAPI/ModelAPI_Folder.h | 42 +- src/ModelAPI/ModelAPI_IReentrant.cpp | 7 +- src/ModelAPI/ModelAPI_IReentrant.h | 11 +- src/ModelAPI/ModelAPI_Object.cpp | 52 +- src/ModelAPI/ModelAPI_Object.h | 66 +- src/ModelAPI/ModelAPI_Plugin.cpp | 8 +- src/ModelAPI/ModelAPI_Plugin.h | 16 +- src/ModelAPI/ModelAPI_Result.cpp | 119 +- src/ModelAPI/ModelAPI_Result.h | 81 +- src/ModelAPI/ModelAPI_ResultBody.cpp | 105 +- src/ModelAPI/ModelAPI_ResultBody.h | 183 +- src/ModelAPI/ModelAPI_ResultConstruction.cpp | 8 +- src/ModelAPI/ModelAPI_ResultConstruction.h | 39 +- src/ModelAPI/ModelAPI_ResultField.cpp | 31 +- src/ModelAPI/ModelAPI_ResultField.h | 45 +- src/ModelAPI/ModelAPI_ResultGroup.cpp | 14 +- src/ModelAPI/ModelAPI_ResultGroup.h | 15 +- src/ModelAPI/ModelAPI_ResultParameter.cpp | 7 +- src/ModelAPI/ModelAPI_ResultParameter.h | 23 +- src/ModelAPI/ModelAPI_ResultPart.cpp | 6 +- src/ModelAPI/ModelAPI_ResultPart.h | 38 +- src/ModelAPI/ModelAPI_Session.cpp | 56 +- src/ModelAPI/ModelAPI_Session.h | 73 +- src/ModelAPI/ModelAPI_Tools.cpp | 1102 ++++----- src/ModelAPI/ModelAPI_Tools.h | 458 ++-- src/ModelAPI/ModelAPI_Validator.h | 117 +- src/ModelAPI/ModelAPI_swig.h | 93 +- src/ModelGeomAlgo/CMakeLists.txt | 6 +- src/ModelGeomAlgo/ModelGeomAlgo.h | 7 +- src/ModelGeomAlgo/ModelGeomAlgo.i | 1 - src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp | 353 +-- src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h | 177 +- src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp | 496 +++-- src/ModelGeomAlgo/ModelGeomAlgo_Shape.h | 62 +- src/ModelGeomAlgo/ModelGeomAlgo_swig.h | 17 +- src/ModelHighAPI/CMakeLists.txt | 6 +- src/ModelHighAPI/ModelHighAPI.h | 7 +- src/ModelHighAPI/ModelHighAPI_Double.cpp | 76 +- src/ModelHighAPI/ModelHighAPI_Double.h | 23 +- src/ModelHighAPI/ModelHighAPI_Dumper.cpp | 789 ++++--- src/ModelHighAPI/ModelHighAPI_Dumper.h | 317 +-- .../ModelHighAPI_FeatureStore.cpp | 289 +-- src/ModelHighAPI/ModelHighAPI_FeatureStore.h | 24 +- src/ModelHighAPI/ModelHighAPI_Folder.cpp | 54 +- src/ModelHighAPI/ModelHighAPI_Folder.h | 44 +- src/ModelHighAPI/ModelHighAPI_Integer.cpp | 45 +- src/ModelHighAPI/ModelHighAPI_Integer.h | 13 +- src/ModelHighAPI/ModelHighAPI_Interface.cpp | 77 +- src/ModelHighAPI/ModelHighAPI_Interface.h | 29 +- src/ModelHighAPI/ModelHighAPI_Macro.h | 1905 ++++++++-------- src/ModelHighAPI/ModelHighAPI_RefAttr.cpp | 76 +- src/ModelHighAPI/ModelHighAPI_RefAttr.h | 23 +- src/ModelHighAPI/ModelHighAPI_Reference.cpp | 33 +- src/ModelHighAPI/ModelHighAPI_Reference.h | 18 +- src/ModelHighAPI/ModelHighAPI_Selection.cpp | 261 ++- src/ModelHighAPI/ModelHighAPI_Selection.h | 59 +- src/ModelHighAPI/ModelHighAPI_Services.cpp | 115 +- src/ModelHighAPI/ModelHighAPI_Services.h | 26 +- src/ModelHighAPI/ModelHighAPI_Tools.cpp | 436 ++-- src/ModelHighAPI/ModelHighAPI_Tools.h | 149 +- src/ModelHighAPI/ModelHighAPI_swig.h | 50 +- src/ModuleBase/ModuleBase.h | 9 +- src/ModuleBase/ModuleBase_ActionInfo.cpp | 38 +- src/ModuleBase/ModuleBase_ActionInfo.h | 38 +- .../ModuleBase_ActionIntParameter.h | 11 +- src/ModuleBase/ModuleBase_ActionParameter.h | 8 +- src/ModuleBase/ModuleBase_ActionType.h | 6 +- src/ModuleBase/ModuleBase_ArrowPrs.cpp | 37 +- src/ModuleBase/ModuleBase_ArrowPrs.h | 40 +- src/ModuleBase/ModuleBase_BRepOwner.cpp | 3 +- src/ModuleBase/ModuleBase_BRepOwner.h | 32 +- src/ModuleBase/ModuleBase_ChoiceCtrl.cpp | 154 +- src/ModuleBase/ModuleBase_ChoiceCtrl.h | 68 +- src/ModuleBase/ModuleBase_Definitions.h | 13 +- src/ModuleBase/ModuleBase_Dialog.cpp | 79 +- src/ModuleBase/ModuleBase_Dialog.h | 23 +- src/ModuleBase/ModuleBase_DoubleSpinBox.cpp | 95 +- src/ModuleBase/ModuleBase_DoubleSpinBox.h | 47 +- src/ModuleBase/ModuleBase_Events.h | 6 +- src/ModuleBase/ModuleBase_Filter.cpp | 6 +- src/ModuleBase/ModuleBase_Filter.h | 26 +- src/ModuleBase/ModuleBase_FilterValidated.cpp | 40 +- src/ModuleBase/ModuleBase_FilterValidated.h | 36 +- src/ModuleBase/ModuleBase_IErrorMgr.cpp | 32 +- src/ModuleBase/ModuleBase_IErrorMgr.h | 22 +- src/ModuleBase/ModuleBase_IModule.cpp | 279 ++- src/ModuleBase/ModuleBase_IModule.h | 355 +-- src/ModuleBase/ModuleBase_IPrefMgr.cpp | 13 +- src/ModuleBase/ModuleBase_IPrefMgr.h | 57 +- src/ModuleBase/ModuleBase_IPropertyPanel.cpp | 67 +- src/ModuleBase/ModuleBase_IPropertyPanel.h | 83 +- src/ModuleBase/ModuleBase_ISelection.cpp | 103 +- src/ModuleBase/ModuleBase_ISelection.h | 67 +- .../ModuleBase_ISelectionActivate.h | 28 +- src/ModuleBase/ModuleBase_IStepPrs.cpp | 7 +- src/ModuleBase/ModuleBase_IStepPrs.h | 10 +- src/ModuleBase/ModuleBase_ITreeNode.h | 98 +- src/ModuleBase/ModuleBase_IViewWindow.cpp | 13 +- src/ModuleBase/ModuleBase_IViewWindow.h | 19 +- src/ModuleBase/ModuleBase_IViewer.cpp | 10 +- src/ModuleBase/ModuleBase_IViewer.h | 119 +- src/ModuleBase/ModuleBase_IWidgetCreator.cpp | 35 +- src/ModuleBase/ModuleBase_IWidgetCreator.h | 53 +- src/ModuleBase/ModuleBase_IWorkshop.cpp | 11 +- src/ModuleBase/ModuleBase_IWorkshop.h | 85 +- src/ModuleBase/ModuleBase_IconFactory.cpp | 37 +- src/ModuleBase/ModuleBase_IconFactory.h | 40 +- src/ModuleBase/ModuleBase_IntSpinBox.cpp | 26 +- src/ModuleBase/ModuleBase_IntSpinBox.h | 22 +- src/ModuleBase/ModuleBase_LabelValue.cpp | 26 +- src/ModuleBase/ModuleBase_LabelValue.h | 25 +- src/ModuleBase/ModuleBase_ListView.cpp | 84 +- src/ModuleBase/ModuleBase_ListView.h | 79 +- src/ModuleBase/ModuleBase_ModelDialogWidget.h | 27 +- src/ModuleBase/ModuleBase_ModelWidget.cpp | 375 ++-- src/ModuleBase/ModuleBase_ModelWidget.h | 272 +-- src/ModuleBase/ModuleBase_Operation.cpp | 124 +- src/ModuleBase/ModuleBase_Operation.h | 125 +- .../ModuleBase_OperationDescription.cpp | 48 +- .../ModuleBase_OperationDescription.h | 30 +- .../ModuleBase_OperationFeature.cpp | 277 ++- src/ModuleBase/ModuleBase_OperationFeature.h | 118 +- src/ModuleBase/ModuleBase_PageBase.cpp | 73 +- src/ModuleBase/ModuleBase_PageBase.h | 37 +- src/ModuleBase/ModuleBase_PageGroupBox.cpp | 47 +- src/ModuleBase/ModuleBase_PageGroupBox.h | 24 +- src/ModuleBase/ModuleBase_PageWidget.cpp | 38 +- src/ModuleBase/ModuleBase_PageWidget.h | 23 +- src/ModuleBase/ModuleBase_PagedContainer.cpp | 90 +- src/ModuleBase/ModuleBase_PagedContainer.h | 52 +- src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp | 93 +- src/ModuleBase/ModuleBase_ParamIntSpinBox.h | 48 +- src/ModuleBase/ModuleBase_ParamSpinBox.cpp | 123 +- src/ModuleBase/ModuleBase_ParamSpinBox.h | 109 +- src/ModuleBase/ModuleBase_Preferences.cpp | 369 ++-- src/ModuleBase/ModuleBase_Preferences.h | 125 +- src/ModuleBase/ModuleBase_ResultPrs.cpp | 364 +-- src/ModuleBase/ModuleBase_ResultPrs.h | 124 +- .../ModuleBase_SelectionFilterType.h | 12 +- .../ModuleBase_SelectionValidator.cpp | 10 +- .../ModuleBase_SelectionValidator.h | 23 +- src/ModuleBase/ModuleBase_ToolBox.cpp | 68 +- src/ModuleBase/ModuleBase_ToolBox.h | 27 +- src/ModuleBase/ModuleBase_Tools.cpp | 836 ++++--- src/ModuleBase/ModuleBase_Tools.h | 411 ++-- src/ModuleBase/ModuleBase_ViewerFilters.cpp | 98 +- src/ModuleBase/ModuleBase_ViewerFilters.h | 65 +- src/ModuleBase/ModuleBase_ViewerPrs.cpp | 102 +- src/ModuleBase/ModuleBase_ViewerPrs.h | 76 +- src/ModuleBase/ModuleBase_WidgetAction.cpp | 54 +- src/ModuleBase/ModuleBase_WidgetAction.h | 31 +- src/ModuleBase/ModuleBase_WidgetBoolValue.cpp | 47 +- src/ModuleBase/ModuleBase_WidgetBoolValue.h | 31 +- src/ModuleBase/ModuleBase_WidgetChoice.cpp | 87 +- src/ModuleBase/ModuleBase_WidgetChoice.h | 59 +- .../ModuleBase_WidgetConcealedObjects.cpp | 93 +- .../ModuleBase_WidgetConcealedObjects.h | 38 +- .../ModuleBase_WidgetCreatorFactory.cpp | 92 +- .../ModuleBase_WidgetCreatorFactory.h | 45 +- .../ModuleBase_WidgetDoubleValue.cpp | 94 +- src/ModuleBase/ModuleBase_WidgetDoubleValue.h | 49 +- src/ModuleBase/ModuleBase_WidgetEditor.cpp | 101 +- src/ModuleBase/ModuleBase_WidgetEditor.h | 45 +- .../ModuleBase_WidgetExprEditor.cpp | 240 +- src/ModuleBase/ModuleBase_WidgetExprEditor.h | 85 +- src/ModuleBase/ModuleBase_WidgetFactory.cpp | 289 +-- src/ModuleBase/ModuleBase_WidgetFactory.h | 91 +- .../ModuleBase_WidgetFeatureSelector.cpp | 137 +- .../ModuleBase_WidgetFeatureSelector.h | 78 +- .../ModuleBase_WidgetFileSelector.cpp | 121 +- .../ModuleBase_WidgetFileSelector.h | 72 +- src/ModuleBase/ModuleBase_WidgetIntValue.cpp | 93 +- src/ModuleBase/ModuleBase_WidgetIntValue.h | 40 +- src/ModuleBase/ModuleBase_WidgetLabel.cpp | 47 +- src/ModuleBase/ModuleBase_WidgetLabel.h | 30 +- .../ModuleBase_WidgetLabelValue.cpp | 31 +- src/ModuleBase/ModuleBase_WidgetLabelValue.h | 27 +- src/ModuleBase/ModuleBase_WidgetLineEdit.cpp | 97 +- src/ModuleBase/ModuleBase_WidgetLineEdit.h | 28 +- .../ModuleBase_WidgetMultiSelector.cpp | 709 +++--- .../ModuleBase_WidgetMultiSelector.h | 153 +- src/ModuleBase/ModuleBase_WidgetNameEdit.cpp | 16 +- src/ModuleBase/ModuleBase_WidgetNameEdit.h | 15 +- .../ModuleBase_WidgetOptionalBox.cpp | 164 +- src/ModuleBase/ModuleBase_WidgetOptionalBox.h | 79 +- .../ModuleBase_WidgetPointInput.cpp | 101 +- src/ModuleBase/ModuleBase_WidgetPointInput.h | 37 +- src/ModuleBase/ModuleBase_WidgetRadiobox.cpp | 53 +- src/ModuleBase/ModuleBase_WidgetRadiobox.h | 28 +- .../ModuleBase_WidgetSelectionFilter.cpp | 396 ++-- .../ModuleBase_WidgetSelectionFilter.h | 127 +- src/ModuleBase/ModuleBase_WidgetSelector.cpp | 144 +- src/ModuleBase/ModuleBase_WidgetSelector.h | 80 +- .../ModuleBase_WidgetSelectorStore.cpp | 67 +- .../ModuleBase_WidgetSelectorStore.h | 37 +- .../ModuleBase_WidgetShapeSelector.cpp | 120 +- .../ModuleBase_WidgetShapeSelector.h | 110 +- src/ModuleBase/ModuleBase_WidgetSwitch.cpp | 49 +- src/ModuleBase/ModuleBase_WidgetSwitch.h | 42 +- src/ModuleBase/ModuleBase_WidgetToolbox.cpp | 69 +- src/ModuleBase/ModuleBase_WidgetToolbox.h | 35 +- src/ModuleBase/ModuleBase_WidgetUndoLabel.cpp | 27 +- src/ModuleBase/ModuleBase_WidgetUndoLabel.h | 27 +- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 363 +-- src/ModuleBase/ModuleBase_WidgetValidated.h | 159 +- src/ModuleBase/ModuleBase_WidgetValidator.cpp | 85 +- src/ModuleBase/ModuleBase_WidgetValidator.h | 69 +- src/ParametersAPI/ParametersAPI.h | 7 +- src/ParametersAPI/ParametersAPI_Parameter.cpp | 74 +- src/ParametersAPI/ParametersAPI_Parameter.h | 50 +- src/ParametersAPI/ParametersAPI_swig.h | 7 +- src/ParametersPlugin/CMakeLists.txt | 6 +- src/ParametersPlugin/ParametersPlugin.h | 8 +- .../ParametersPlugin_EvalListener.cpp | 197 +- .../ParametersPlugin_EvalListener.h | 54 +- .../ParametersPlugin_Parameter.cpp | 121 +- .../ParametersPlugin_Parameter.h | 39 +- .../ParametersPlugin_ParametersMgr.cpp | 20 +- .../ParametersPlugin_ParametersMgr.h | 32 +- .../ParametersPlugin_Plugin.cpp | 27 +- .../ParametersPlugin_Plugin.h | 21 +- .../ParametersPlugin_Validators.cpp | 62 +- .../ParametersPlugin_Validators.h | 38 +- .../ParametersPlugin_WidgetCreator.cpp | 28 +- .../ParametersPlugin_WidgetCreator.h | 30 +- .../ParametersPlugin_WidgetParamsMgr.cpp | 511 +++-- .../ParametersPlugin_WidgetParamsMgr.h | 87 +- src/ParametersPlugin/Test/data/parameters.txt | 2 +- src/ParametersPlugin/doc/ParametersPlugin.rst | 1 - .../doc/TUI_parameterFeature.rst | 3 +- src/ParametersPlugin/doc/examples/File.txt | 2 +- src/ParametersPlugin/doc/managerFeature.rst | 10 +- src/ParametersPlugin/doc/parameterFeature.rst | 4 +- src/PartSet/PartSet.h | 9 +- src/PartSet/PartSet_BSplineWidget.cpp | 102 +- src/PartSet/PartSet_BSplineWidget.h | 53 +- src/PartSet/PartSet_CenterPrs.cpp | 56 +- src/PartSet/PartSet_CenterPrs.h | 45 +- src/PartSet/PartSet_Constants.h | 6 +- src/PartSet/PartSet_CustomPrs.cpp | 226 +- src/PartSet/PartSet_CustomPrs.h | 143 +- src/PartSet/PartSet_DataModel.cpp | 30 +- src/PartSet/PartSet_DataModel.h | 15 +- src/PartSet/PartSet_ExternalObjectsMgr.cpp | 116 +- src/PartSet/PartSet_ExternalObjectsMgr.h | 100 +- src/PartSet/PartSet_ExternalPointsMgr.cpp | 127 +- src/PartSet/PartSet_ExternalPointsMgr.h | 64 +- src/PartSet/PartSet_FieldStepPrs.cpp | 146 +- src/PartSet/PartSet_FieldStepPrs.h | 31 +- src/PartSet/PartSet_FilterInfinite.cpp | 33 +- src/PartSet/PartSet_FilterInfinite.h | 22 +- src/PartSet/PartSet_Filters.cpp | 108 +- src/PartSet/PartSet_Filters.h | 47 +- src/PartSet/PartSet_IconFactory.cpp | 120 +- src/PartSet/PartSet_IconFactory.h | 18 +- src/PartSet/PartSet_MenuMgr.cpp | 363 +-- src/PartSet/PartSet_MenuMgr.h | 62 +- src/PartSet/PartSet_Module.cpp | 1463 ++++++------ src/PartSet/PartSet_Module.h | 420 ++-- src/PartSet/PartSet_MouseProcessor.h | 36 +- src/PartSet/PartSet_OperationPrs.cpp | 275 +-- src/PartSet/PartSet_OperationPrs.h | 141 +- .../PartSet_OverconstraintListener.cpp | 238 +- src/PartSet/PartSet_OverconstraintListener.h | 73 +- src/PartSet/PartSet_PreviewPlanes.cpp | 61 +- src/PartSet/PartSet_PreviewPlanes.h | 38 +- src/PartSet/PartSet_PreviewSketchPlane.cpp | 138 +- src/PartSet/PartSet_PreviewSketchPlane.h | 66 +- src/PartSet/PartSet_ResultSketchPrs.cpp | 191 +- src/PartSet/PartSet_ResultSketchPrs.h | 54 +- src/PartSet/PartSet_SketcherMgr.cpp | 1669 +++++++------- src/PartSet/PartSet_SketcherMgr.h | 436 ++-- src/PartSet/PartSet_SketcherReentrantMgr.cpp | 709 +++--- src/PartSet/PartSet_SketcherReentrantMgr.h | 201 +- src/PartSet/PartSet_Tools.cpp | 657 +++--- src/PartSet/PartSet_Tools.h | 324 +-- src/PartSet/PartSet_TreeNodes.cpp | 473 ++-- src/PartSet/PartSet_TreeNodes.h | 199 +- src/PartSet/PartSet_Validators.cpp | 532 ++--- src/PartSet/PartSet_Validators.h | 217 +- src/PartSet/PartSet_WidgetBSplinePoints.cpp | 327 +-- src/PartSet/PartSet_WidgetBSplinePoints.h | 125 +- src/PartSet/PartSet_WidgetEditor.cpp | 18 +- src/PartSet/PartSet_WidgetEditor.h | 33 +- .../PartSet_WidgetFeaturePointSelector.cpp | 175 +- .../PartSet_WidgetFeaturePointSelector.h | 87 +- src/PartSet/PartSet_WidgetFileSelector.cpp | 37 +- src/PartSet/PartSet_WidgetFileSelector.h | 28 +- src/PartSet/PartSet_WidgetMultiSelector.cpp | 61 +- src/PartSet/PartSet_WidgetMultiSelector.h | 43 +- src/PartSet/PartSet_WidgetPoint2DFlyout.cpp | 47 +- src/PartSet/PartSet_WidgetPoint2DFlyout.h | 43 +- src/PartSet/PartSet_WidgetPoint2d.cpp | 671 +++--- src/PartSet/PartSet_WidgetPoint2d.h | 271 +-- src/PartSet/PartSet_WidgetShapeSelector.cpp | 54 +- src/PartSet/PartSet_WidgetShapeSelector.h | 54 +- src/PartSet/PartSet_WidgetSketchCreator.cpp | 383 ++-- src/PartSet/PartSet_WidgetSketchCreator.h | 114 +- src/PartSet/PartSet_WidgetSketchLabel.cpp | 505 +++-- src/PartSet/PartSet_WidgetSketchLabel.h | 176 +- src/PartSetAPI/CMakeLists.txt | 6 +- src/PartSetAPI/PartSetAPI.h | 7 +- src/PartSetAPI/PartSetAPI_Part.cpp | 57 +- src/PartSetAPI/PartSetAPI_Part.h | 16 +- src/PartSetAPI/PartSetAPI_swig.h | 7 +- src/PartSetPlugin/PartSetPlugin.h | 7 +- src/PartSetPlugin/PartSetPlugin_Duplicate.cpp | 26 +- src/PartSetPlugin/PartSetPlugin_Duplicate.h | 35 +- src/PartSetPlugin/PartSetPlugin_Part.cpp | 90 +- src/PartSetPlugin/PartSetPlugin_Part.h | 40 +- src/PartSetPlugin/PartSetPlugin_Plugin.cpp | 39 +- src/PartSetPlugin/PartSetPlugin_Plugin.h | 24 +- src/PartSetPlugin/PartSetPlugin_Remove.cpp | 27 +- src/PartSetPlugin/PartSetPlugin_Remove.h | 37 +- src/PartSetPlugin/doc/TUI_new_partFeature.rst | 2 +- src/PrimitivesAPI/PrimitivesAPI.h | 9 +- src/PrimitivesAPI/PrimitivesAPI_Box.cpp | 165 +- src/PrimitivesAPI/PrimitivesAPI_Box.h | 136 +- src/PrimitivesAPI/PrimitivesAPI_Cone.cpp | 90 +- src/PrimitivesAPI/PrimitivesAPI_Cone.h | 71 +- src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp | 136 +- src/PrimitivesAPI/PrimitivesAPI_Cylinder.h | 102 +- src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp | 148 +- src/PrimitivesAPI/PrimitivesAPI_Sphere.h | 106 +- src/PrimitivesAPI/PrimitivesAPI_Torus.cpp | 69 +- src/PrimitivesAPI/PrimitivesAPI_Torus.h | 60 +- src/PrimitivesAPI/PrimitivesAPI_Tube.cpp | 52 +- src/PrimitivesAPI/PrimitivesAPI_Tube.h | 47 +- src/PrimitivesAPI/PrimitivesAPI_swig.h | 19 +- src/PrimitivesPlugin/CMakeLists.txt | 2 - src/PrimitivesPlugin/PrimitivesPlugin.h | 7 +- src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp | 130 +- src/PrimitivesPlugin/PrimitivesPlugin_Box.h | 84 +- .../PrimitivesPlugin_Cone.cpp | 94 +- src/PrimitivesPlugin/PrimitivesPlugin_Cone.h | 41 +- .../PrimitivesPlugin_Cylinder.cpp | 100 +- .../PrimitivesPlugin_Cylinder.h | 54 +- .../PrimitivesPlugin_Plugin.cpp | 16 +- .../PrimitivesPlugin_Plugin.h | 12 +- .../PrimitivesPlugin_Sphere.cpp | 133 +- .../PrimitivesPlugin_Sphere.h | 66 +- .../PrimitivesPlugin_Torus.cpp | 95 +- src/PrimitivesPlugin/PrimitivesPlugin_Torus.h | 38 +- .../PrimitivesPlugin_Tube.cpp | 44 +- src/PrimitivesPlugin/PrimitivesPlugin_Tube.h | 34 +- src/PrimitivesPlugin/cone_widget.xml | 2 +- src/PrimitivesPlugin/doc/TUI_boxByPoints.rst | 2 +- src/PrimitivesPlugin/doc/TUI_boxByPtDims.rst | 3 +- .../doc/TUI_boxDimensions.rst | 3 +- src/PrimitivesPlugin/doc/TUI_coneFeature.rst | 3 +- .../doc/TUI_cylinderFeature.rst | 3 +- .../doc/TUI_cylinderPortion.rst | 3 +- .../doc/TUI_sphereFeature.rst | 2 +- src/PrimitivesPlugin/doc/TUI_spherePart.rst | 2 +- src/PrimitivesPlugin/doc/TUI_torusFeature.rst | 3 +- src/PrimitivesPlugin/doc/TUI_tubeFeature.rst | 3 +- src/PrimitivesPlugin/doc/boxFeature.rst | 18 +- src/PrimitivesPlugin/doc/coneFeature.rst | 12 +- src/PrimitivesPlugin/doc/cylinderFeature.rst | 22 +- src/PrimitivesPlugin/doc/sphereFeature.rst | 13 +- src/PrimitivesPlugin/doc/torusFeature.rst | 11 +- src/PrimitivesPlugin/doc/tubeFeature.rst | 8 +- src/PrimitivesPlugin/torus_widget.xml | 2 +- src/PythonAPI/CMakeLists.txt | 4 +- src/PythonAPI/doc/source/index.rst | 2 +- src/PythonAPI/doc/source/model/extrusion.rst | 6 +- src/PythonAPI/doc/source/model/revolution.rst | 2 +- .../doc/TUI_pyFile_rectangleFeature.rst | 6 +- .../doc/TUI_xmlFile_rectangleFeature.rst | 6 +- .../doc/compoundVerticesFeature.rst | 4 +- src/PythonAddons/doc/midSurfaceFeature.rst | 3 - src/PythonAddons/doc/pipeNetworkFeature.rst | 2 - src/PythonAddons/doc/rectangleFeature.rst | 2 +- .../macros/midSurface/midSurface_1.stp | 174 +- .../macros/midSurface/midSurface_2.stp | 698 +++--- src/SHAPERGUI/SHAPERGUI.cpp | 957 ++++---- src/SHAPERGUI/SHAPERGUI.h | 198 +- src/SHAPERGUI/SHAPERGUI_DataModel.cpp | 139 +- src/SHAPERGUI/SHAPERGUI_DataModel.h | 52 +- src/SHAPERGUI/SHAPERGUI_NestedButton.cpp | 48 +- src/SHAPERGUI/SHAPERGUI_NestedButton.h | 36 +- src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp | 27 +- src/SHAPERGUI/SHAPERGUI_OCCSelector.h | 32 +- src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp | 459 ++-- src/SHAPERGUI/SHAPERGUI_SalomeViewer.h | 123 +- src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp | 258 +-- src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h | 60 +- src/SHAPERGUI/SHAPER_SHAPERGUI.h | 8 +- src/SHAPERGUI/shapergui_app.cpp | 58 +- src/SamplePanelPlugin/SamplePanelPlugin.h | 7 +- .../SamplePanelPlugin_Feature.cpp | 11 +- .../SamplePanelPlugin_Feature.h | 19 +- .../SamplePanelPlugin_ModelWidget.cpp | 48 +- .../SamplePanelPlugin_ModelWidget.h | 22 +- .../SamplePanelPlugin_ModelWidgetCreator.cpp | 22 +- .../SamplePanelPlugin_ModelWidgetCreator.h | 31 +- .../SamplePanelPlugin_Panel.cpp | 45 +- .../SamplePanelPlugin_Panel.h | 21 +- .../SamplePanelPlugin_Plugin.cpp | 31 +- .../SamplePanelPlugin_Plugin.h | 17 +- .../SamplePanelPlugin_WidgetCreator.cpp | 21 +- .../SamplePanelPlugin_WidgetCreator.h | 25 +- src/Selector/Selector.h | 7 +- src/Selector/Selector_Algo.cpp | 257 ++- src/Selector/Selector_Algo.h | 170 +- src/Selector/Selector_AlgoWithSubs.cpp | 28 +- src/Selector/Selector_AlgoWithSubs.h | 17 +- src/Selector/Selector_Container.cpp | 89 +- src/Selector/Selector_Container.h | 28 +- src/Selector/Selector_FilterByNeighbors.cpp | 228 +- src/Selector/Selector_FilterByNeighbors.h | 38 +- src/Selector/Selector_Intersect.cpp | 162 +- src/Selector/Selector_Intersect.h | 30 +- src/Selector/Selector_Modify.cpp | 202 +- src/Selector/Selector_Modify.h | 47 +- src/Selector/Selector_NExplode.cpp | 34 +- src/Selector/Selector_NExplode.h | 47 +- src/Selector/Selector_NameGenerator.cpp | 3 +- src/Selector/Selector_NameGenerator.h | 28 +- src/Selector/Selector_Primitive.cpp | 38 +- src/Selector/Selector_Primitive.h | 24 +- src/Selector/Selector_Selector.cpp | 61 +- src/Selector/Selector_Selector.h | 47 +- src/Selector/Selector_WeakName.cpp | 56 +- src/Selector/Selector_WeakName.h | 33 +- src/SketchAPI/CMakeLists.txt | 6 +- src/SketchAPI/SketchAPI.h | 7 +- src/SketchAPI/SketchAPI_Arc.cpp | 95 +- src/SketchAPI/SketchAPI_Arc.h | 76 +- src/SketchAPI/SketchAPI_BSpline.cpp | 310 +-- src/SketchAPI/SketchAPI_BSpline.h | 118 +- src/SketchAPI/SketchAPI_Circle.cpp | 95 +- src/SketchAPI/SketchAPI_Circle.h | 54 +- src/SketchAPI/SketchAPI_Constraint.cpp | 109 +- src/SketchAPI/SketchAPI_Constraint.h | 26 +- src/SketchAPI/SketchAPI_ConstraintAngle.cpp | 86 +- src/SketchAPI/SketchAPI_ConstraintAngle.h | 14 +- src/SketchAPI/SketchAPI_Ellipse.cpp | 348 +-- src/SketchAPI/SketchAPI_Ellipse.h | 151 +- src/SketchAPI/SketchAPI_EllipticArc.cpp | 203 +- src/SketchAPI/SketchAPI_EllipticArc.h | 133 +- src/SketchAPI/SketchAPI_IntersectionPoint.cpp | 72 +- src/SketchAPI/SketchAPI_IntersectionPoint.h | 39 +- src/SketchAPI/SketchAPI_Line.cpp | 88 +- src/SketchAPI/SketchAPI_Line.h | 49 +- src/SketchAPI/SketchAPI_MacroArc.cpp | 168 +- src/SketchAPI/SketchAPI_MacroArc.h | 153 +- src/SketchAPI/SketchAPI_MacroCircle.cpp | 97 +- src/SketchAPI/SketchAPI_MacroCircle.h | 74 +- src/SketchAPI/SketchAPI_MacroEllipse.cpp | 216 +- src/SketchAPI/SketchAPI_MacroEllipse.h | 80 +- src/SketchAPI/SketchAPI_MacroEllipticArc.cpp | 84 +- src/SketchAPI/SketchAPI_MacroEllipticArc.h | 44 +- src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp | 54 +- src/SketchAPI/SketchAPI_MacroMiddlePoint.h | 22 +- src/SketchAPI/SketchAPI_Mirror.cpp | 81 +- src/SketchAPI/SketchAPI_Mirror.h | 35 +- src/SketchAPI/SketchAPI_Offset.cpp | 59 +- src/SketchAPI/SketchAPI_Offset.h | 37 +- src/SketchAPI/SketchAPI_Point.cpp | 68 +- src/SketchAPI/SketchAPI_Point.h | 40 +- src/SketchAPI/SketchAPI_Projection.cpp | 66 +- src/SketchAPI/SketchAPI_Projection.h | 29 +- src/SketchAPI/SketchAPI_Rectangle.cpp | 47 +- src/SketchAPI/SketchAPI_Rectangle.h | 51 +- src/SketchAPI/SketchAPI_Rotation.cpp | 96 +- src/SketchAPI/SketchAPI_Rotation.h | 63 +- src/SketchAPI/SketchAPI_Sketch.cpp | 1368 ++++++------ src/SketchAPI/SketchAPI_Sketch.h | 548 +++-- src/SketchAPI/SketchAPI_SketchEntity.cpp | 83 +- src/SketchAPI/SketchAPI_SketchEntity.h | 15 +- src/SketchAPI/SketchAPI_Translation.cpp | 100 +- src/SketchAPI/SketchAPI_Translation.h | 55 +- src/SketchAPI/SketchAPI_swig.h | 53 +- src/SketchPlugin/CMakeLists.txt | 6 +- src/SketchPlugin/SketchPlugin.h | 7 +- src/SketchPlugin/SketchPlugin_Arc.cpp | 189 +- src/SketchPlugin/SketchPlugin_Arc.h | 43 +- src/SketchPlugin/SketchPlugin_BSpline.cpp | 28 +- src/SketchPlugin/SketchPlugin_BSpline.h | 20 +- src/SketchPlugin/SketchPlugin_BSplineBase.cpp | 111 +- src/SketchPlugin/SketchPlugin_BSplineBase.h | 28 +- .../SketchPlugin_BSplinePeriodic.cpp | 7 +- .../SketchPlugin_BSplinePeriodic.h | 12 +- src/SketchPlugin/SketchPlugin_Circle.cpp | 71 +- src/SketchPlugin/SketchPlugin_Circle.h | 24 +- src/SketchPlugin/SketchPlugin_Constraint.cpp | 8 +- src/SketchPlugin/SketchPlugin_Constraint.h | 51 +- .../SketchPlugin_ConstraintAngle.cpp | 305 +-- .../SketchPlugin_ConstraintAngle.h | 79 +- .../SketchPlugin_ConstraintBase.h | 27 +- .../SketchPlugin_ConstraintCoincidence.cpp | 70 +- .../SketchPlugin_ConstraintCoincidence.h | 39 +- ...chPlugin_ConstraintCoincidenceInternal.cpp | 25 +- ...etchPlugin_ConstraintCoincidenceInternal.h | 33 +- .../SketchPlugin_ConstraintCollinear.cpp | 30 +- .../SketchPlugin_ConstraintCollinear.h | 25 +- .../SketchPlugin_ConstraintDistance.cpp | 167 +- .../SketchPlugin_ConstraintDistance.h | 47 +- ...ketchPlugin_ConstraintDistanceAlongDir.cpp | 79 +- .../SketchPlugin_ConstraintDistanceAlongDir.h | 33 +- ...tchPlugin_ConstraintDistanceHorizontal.cpp | 33 +- ...ketchPlugin_ConstraintDistanceHorizontal.h | 25 +- ...ketchPlugin_ConstraintDistanceVertical.cpp | 35 +- .../SketchPlugin_ConstraintDistanceVertical.h | 22 +- .../SketchPlugin_ConstraintEqual.cpp | 30 +- .../SketchPlugin_ConstraintEqual.h | 26 +- .../SketchPlugin_ConstraintHorizontal.cpp | 26 +- .../SketchPlugin_ConstraintHorizontal.h | 25 +- .../SketchPlugin_ConstraintLength.cpp | 146 +- .../SketchPlugin_ConstraintLength.h | 62 +- .../SketchPlugin_ConstraintMiddle.cpp | 135 +- .../SketchPlugin_ConstraintMiddle.h | 41 +- .../SketchPlugin_ConstraintMirror.cpp | 167 +- .../SketchPlugin_ConstraintMirror.h | 30 +- .../SketchPlugin_ConstraintParallel.cpp | 34 +- .../SketchPlugin_ConstraintParallel.h | 25 +- .../SketchPlugin_ConstraintPerpendicular.cpp | 33 +- .../SketchPlugin_ConstraintPerpendicular.h | 29 +- .../SketchPlugin_ConstraintRadius.cpp | 132 +- .../SketchPlugin_ConstraintRadius.h | 52 +- .../SketchPlugin_ConstraintRigid.cpp | 27 +- .../SketchPlugin_ConstraintRigid.h | 26 +- .../SketchPlugin_ConstraintTangent.cpp | 30 +- .../SketchPlugin_ConstraintTangent.h | 29 +- .../SketchPlugin_ConstraintVertical.cpp | 27 +- .../SketchPlugin_ConstraintVertical.h | 25 +- .../SketchPlugin_CurveFitting.cpp | 234 +- src/SketchPlugin/SketchPlugin_CurveFitting.h | 48 +- src/SketchPlugin/SketchPlugin_Ellipse.cpp | 113 +- src/SketchPlugin/SketchPlugin_Ellipse.h | 45 +- src/SketchPlugin/SketchPlugin_EllipticArc.cpp | 180 +- src/SketchPlugin/SketchPlugin_EllipticArc.h | 54 +- .../SketchPlugin_ExternalValidator.cpp | 41 +- .../SketchPlugin_ExternalValidator.h | 17 +- src/SketchPlugin/SketchPlugin_Feature.cpp | 38 +- src/SketchPlugin/SketchPlugin_Feature.h | 66 +- src/SketchPlugin/SketchPlugin_Fillet.cpp | 354 +-- src/SketchPlugin/SketchPlugin_Fillet.h | 64 +- .../SketchPlugin_IntersectionPoint.cpp | 60 +- .../SketchPlugin_IntersectionPoint.h | 34 +- src/SketchPlugin/SketchPlugin_Line.cpp | 106 +- src/SketchPlugin/SketchPlugin_Line.h | 41 +- src/SketchPlugin/SketchPlugin_MacroArc.cpp | 402 ++-- src/SketchPlugin/SketchPlugin_MacroArc.h | 123 +- .../SketchPlugin_MacroArcReentrantMessage.h | 35 +- .../SketchPlugin_MacroBSpline.cpp | 173 +- src/SketchPlugin/SketchPlugin_MacroBSpline.h | 77 +- src/SketchPlugin/SketchPlugin_MacroCircle.cpp | 225 +- src/SketchPlugin/SketchPlugin_MacroCircle.h | 81 +- .../SketchPlugin_MacroEllipse.cpp | 196 +- src/SketchPlugin/SketchPlugin_MacroEllipse.h | 96 +- .../SketchPlugin_MacroEllipticArc.cpp | 221 +- .../SketchPlugin_MacroEllipticArc.h | 75 +- .../SketchPlugin_MultiRotation.cpp | 198 +- src/SketchPlugin/SketchPlugin_MultiRotation.h | 56 +- .../SketchPlugin_MultiTranslation.cpp | 185 +- .../SketchPlugin_MultiTranslation.h | 53 +- src/SketchPlugin/SketchPlugin_Offset.cpp | 480 ++-- src/SketchPlugin/SketchPlugin_Offset.h | 119 +- .../SketchPlugin_OverConstraintsResolver.cpp | 129 +- .../SketchPlugin_OverConstraintsResolver.h | 10 +- src/SketchPlugin/SketchPlugin_Plugin.cpp | 145 +- src/SketchPlugin/SketchPlugin_Plugin.h | 28 +- src/SketchPlugin/SketchPlugin_Point.cpp | 44 +- src/SketchPlugin/SketchPlugin_Point.h | 24 +- src/SketchPlugin/SketchPlugin_Projection.cpp | 313 +-- src/SketchPlugin/SketchPlugin_Projection.h | 111 +- src/SketchPlugin/SketchPlugin_Sketch.cpp | 488 ++-- src/SketchPlugin/SketchPlugin_Sketch.h | 249 ++- src/SketchPlugin/SketchPlugin_SketchCopy.cpp | 174 +- src/SketchPlugin/SketchPlugin_SketchCopy.h | 25 +- .../SketchPlugin_SketchDrawer.cpp | 168 +- src/SketchPlugin/SketchPlugin_SketchDrawer.h | 41 +- .../SketchPlugin_SketchEntity.cpp | 25 +- src/SketchPlugin/SketchPlugin_SketchEntity.h | 183 +- src/SketchPlugin/SketchPlugin_Split.cpp | 1142 +++++----- src/SketchPlugin/SketchPlugin_Split.h | 318 +-- src/SketchPlugin/SketchPlugin_Tools.cpp | 717 +++--- src/SketchPlugin/SketchPlugin_Tools.h | 282 +-- src/SketchPlugin/SketchPlugin_Trim.cpp | 883 ++++---- src/SketchPlugin/SketchPlugin_Trim.h | 220 +- src/SketchPlugin/SketchPlugin_Validators.cpp | 1116 +++++----- src/SketchPlugin/SketchPlugin_Validators.h | 397 ++-- src/SketchPlugin/SketchPlugin_msg_en.ts | 14 +- src/SketchPlugin/doc/SketchPlugin.rst | 2 +- src/SketchPlugin/doc/arcEllipseFeature.rst | 2 +- src/SketchPlugin/doc/bsplineFeature.rst | 2 +- src/SketchPlugin/doc/coincedentFeature.rst | 2 +- src/SketchPlugin/doc/fixedFeature.rst | 2 +- src/SketchPlugin/doc/horizontalFeature.rst | 2 +- src/SketchPlugin/doc/radiusFeature.rst | 2 +- src/SketchPlugin/doc/sketchCopy.rst | 2 +- src/SketchPlugin/doc/splitFeature.rst | 2 +- src/SketchPlugin/tests.set | 1 - .../PlaneGCSSolver_AngleWrapper.cpp | 24 +- .../PlaneGCSSolver_AngleWrapper.h | 6 +- .../PlaneGCSSolver_AttributeBuilder.cpp | 118 +- .../PlaneGCSSolver_AttributeBuilder.h | 21 +- .../PlaneGCSSolver_BooleanWrapper.cpp | 10 +- .../PlaneGCSSolver_BooleanWrapper.h | 18 +- .../PlaneGCSSolver_ConstraintWrapper.cpp | 32 +- .../PlaneGCSSolver_ConstraintWrapper.h | 44 +- .../PlaneGCSSolver/PlaneGCSSolver_Defs.h | 22 +- .../PlaneGCSSolver_EdgeWrapper.cpp | 61 +- .../PlaneGCSSolver_EdgeWrapper.h | 26 +- .../PlaneGCSSolver_EntityBuilder.h | 16 +- .../PlaneGCSSolver_EntityDestroyer.cpp | 8 +- .../PlaneGCSSolver_EntityDestroyer.h | 17 +- .../PlaneGCSSolver_EntityWrapper.h | 25 +- .../PlaneGCSSolver_FeatureBuilder.cpp | 146 +- .../PlaneGCSSolver_FeatureBuilder.h | 16 +- .../PlaneGCSSolver_GeoExtensions.cpp | 99 +- .../PlaneGCSSolver_GeoExtensions.h | 66 +- .../PlaneGCSSolver_PointArrayWrapper.cpp | 22 +- .../PlaneGCSSolver_PointArrayWrapper.h | 26 +- .../PlaneGCSSolver_PointWrapper.cpp | 21 +- .../PlaneGCSSolver_PointWrapper.h | 18 +- .../PlaneGCSSolver_ScalarArrayWrapper.cpp | 18 +- .../PlaneGCSSolver_ScalarArrayWrapper.h | 21 +- .../PlaneGCSSolver_ScalarWrapper.cpp | 28 +- .../PlaneGCSSolver_ScalarWrapper.h | 17 +- .../PlaneGCSSolver/PlaneGCSSolver_Solver.cpp | 152 +- .../PlaneGCSSolver/PlaneGCSSolver_Solver.h | 59 +- .../PlaneGCSSolver/PlaneGCSSolver_Storage.cpp | 396 ++-- .../PlaneGCSSolver/PlaneGCSSolver_Storage.h | 76 +- .../PlaneGCSSolver/PlaneGCSSolver_Tools.cpp | 749 ++++--- .../PlaneGCSSolver/PlaneGCSSolver_Tools.h | 185 +- .../PlaneGCSSolver/PlaneGCSSolver_Update.h | 24 +- .../PlaneGCSSolver_UpdateCoincidence.cpp | 119 +- .../PlaneGCSSolver_UpdateCoincidence.h | 51 +- .../PlaneGCSSolver_UpdateFeature.cpp | 13 +- .../PlaneGCSSolver_UpdateFeature.h | 17 +- src/SketchSolver/SketchSolver_Constraint.cpp | 70 +- src/SketchSolver/SketchSolver_Constraint.h | 59 +- .../SketchSolver_ConstraintAngle.cpp | 16 +- .../SketchSolver_ConstraintAngle.h | 25 +- .../SketchSolver_ConstraintCoincidence.cpp | 198 +- .../SketchSolver_ConstraintCoincidence.h | 35 +- .../SketchSolver_ConstraintCollinear.cpp | 73 +- .../SketchSolver_ConstraintCollinear.h | 19 +- .../SketchSolver_ConstraintDistance.cpp | 194 +- .../SketchSolver_ConstraintDistance.h | 36 +- .../SketchSolver_ConstraintEqual.cpp | 26 +- .../SketchSolver_ConstraintEqual.h | 29 +- .../SketchSolver_ConstraintFixed.cpp | 52 +- .../SketchSolver_ConstraintFixed.h | 20 +- .../SketchSolver_ConstraintLength.cpp | 18 +- .../SketchSolver_ConstraintLength.h | 22 +- .../SketchSolver_ConstraintMiddle.cpp | 64 +- .../SketchSolver_ConstraintMiddle.h | 28 +- .../SketchSolver_ConstraintMirror.cpp | 99 +- .../SketchSolver_ConstraintMirror.h | 28 +- .../SketchSolver_ConstraintMovement.cpp | 141 +- .../SketchSolver_ConstraintMovement.h | 44 +- .../SketchSolver_ConstraintMulti.cpp | 67 +- .../SketchSolver_ConstraintMulti.h | 64 +- .../SketchSolver_ConstraintMultiRotation.cpp | 77 +- .../SketchSolver_ConstraintMultiRotation.h | 49 +- ...ketchSolver_ConstraintMultiTranslation.cpp | 81 +- .../SketchSolver_ConstraintMultiTranslation.h | 42 +- .../SketchSolver_ConstraintOffset.cpp | 18 +- .../SketchSolver_ConstraintOffset.h | 17 +- .../SketchSolver_ConstraintPerpendicular.cpp | 211 +- .../SketchSolver_ConstraintPerpendicular.h | 16 +- .../SketchSolver_ConstraintTangent.cpp | 362 +-- .../SketchSolver_ConstraintTangent.h | 25 +- src/SketchSolver/SketchSolver_Error.h | 89 +- src/SketchSolver/SketchSolver_Group.cpp | 214 +- src/SketchSolver/SketchSolver_Group.h | 65 +- src/SketchSolver/SketchSolver_Manager.cpp | 224 +- src/SketchSolver/SketchSolver_Manager.h | 76 +- src/SketchSolver/SketchSolver_Storage.cpp | 185 +- src/SketchSolver/SketchSolver_Storage.h | 106 +- src/SketchSolver/SketchSolver_msg_en.ts | 1 - .../SolveSpaceSolver_Builder.cpp | 502 +++-- .../SolveSpaceSolver_Builder.h | 103 +- .../SolveSpaceSolver_ConstraintType.h | 161 +- .../SolveSpaceSolver_ConstraintWrapper.cpp | 57 +- .../SolveSpaceSolver_ConstraintWrapper.h | 32 +- .../SolveSpaceSolver_EntityWrapper.cpp | 87 +- .../SolveSpaceSolver_EntityWrapper.h | 36 +- .../SolveSpaceSolver_ParameterWrapper.cpp | 27 +- .../SolveSpaceSolver_ParameterWrapper.h | 28 +- .../SolveSpaceSolver_Solver.cpp | 101 +- .../SolveSpaceSolver_Solver.h | 27 +- .../SolveSpaceSolver_Storage.cpp | 499 +++-- .../SolveSpaceSolver_Storage.h | 121 +- src/SketcherPrs/SketcherPrs.h | 7 +- src/SketcherPrs/SketcherPrs_Angle.cpp | 206 +- src/SketcherPrs/SketcherPrs_Angle.h | 74 +- src/SketcherPrs/SketcherPrs_Coincident.cpp | 93 +- src/SketcherPrs/SketcherPrs_Coincident.h | 57 +- src/SketcherPrs/SketcherPrs_Collinear.cpp | 50 +- src/SketcherPrs/SketcherPrs_Collinear.h | 39 +- .../SketcherPrs_DimensionStyle.cpp | 77 +- src/SketcherPrs/SketcherPrs_DimensionStyle.h | 52 +- src/SketcherPrs/SketcherPrs_Equal.cpp | 54 +- src/SketcherPrs/SketcherPrs_Equal.h | 39 +- src/SketcherPrs/SketcherPrs_Factory.cpp | 104 +- src/SketcherPrs/SketcherPrs_Factory.h | 20 +- src/SketcherPrs/SketcherPrs_HVDirection.cpp | 45 +- src/SketcherPrs/SketcherPrs_HVDirection.h | 40 +- .../SketcherPrs_LengthDimension.cpp | 207 +- src/SketcherPrs/SketcherPrs_LengthDimension.h | 67 +- src/SketcherPrs/SketcherPrs_Middle.cpp | 82 +- src/SketcherPrs/SketcherPrs_Middle.h | 43 +- src/SketcherPrs/SketcherPrs_Mirror.cpp | 59 +- src/SketcherPrs/SketcherPrs_Mirror.h | 38 +- src/SketcherPrs/SketcherPrs_Offset.cpp | 54 +- src/SketcherPrs/SketcherPrs_Offset.h | 42 +- src/SketcherPrs/SketcherPrs_Parallel.cpp | 51 +- src/SketcherPrs/SketcherPrs_Parallel.h | 37 +- src/SketcherPrs/SketcherPrs_Perpendicular.cpp | 55 +- src/SketcherPrs/SketcherPrs_Perpendicular.h | 38 +- src/SketcherPrs/SketcherPrs_PositionMgr.cpp | 160 +- src/SketcherPrs/SketcherPrs_PositionMgr.h | 58 +- src/SketcherPrs/SketcherPrs_Radius.cpp | 134 +- src/SketcherPrs/SketcherPrs_Radius.h | 58 +- src/SketcherPrs/SketcherPrs_Rigid.cpp | 69 +- src/SketcherPrs/SketcherPrs_Rigid.h | 42 +- .../SketcherPrs_SensitivePoint.cpp | 84 +- src/SketcherPrs/SketcherPrs_SensitivePoint.h | 37 +- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 243 +- src/SketcherPrs/SketcherPrs_SymbolPrs.h | 110 +- src/SketcherPrs/SketcherPrs_Tangent.cpp | 66 +- src/SketcherPrs/SketcherPrs_Tangent.h | 39 +- src/SketcherPrs/SketcherPrs_Tools.cpp | 269 ++- src/SketcherPrs/SketcherPrs_Tools.h | 281 +-- .../SketcherPrs_Transformation.cpp | 114 +- src/SketcherPrs/SketcherPrs_Transformation.h | 41 +- src/XAO/XAO.hxx | 25 +- src/XAO/XAO_BooleanField.cxx | 43 +- src/XAO/XAO_BooleanField.hxx | 89 +- src/XAO/XAO_BooleanStep.cxx | 152 +- src/XAO/XAO_BooleanStep.hxx | 176 +- src/XAO/XAO_BrepGeometry.cxx | 478 ++-- src/XAO/XAO_BrepGeometry.hxx | 581 ++--- src/XAO/XAO_DoubleField.cxx | 37 +- src/XAO/XAO_DoubleField.hxx | 89 +- src/XAO/XAO_DoubleStep.cxx | 136 +- src/XAO/XAO_DoubleStep.hxx | 174 +- src/XAO/XAO_Exception.hxx | 54 +- src/XAO/XAO_Field.cxx | 136 +- src/XAO/XAO_Field.hxx | 350 ++- src/XAO/XAO_GeometricElement.cxx | 122 +- src/XAO/XAO_GeometricElement.hxx | 365 ++- src/XAO/XAO_Geometry.cxx | 262 ++- src/XAO/XAO_Geometry.hxx | 305 +-- src/XAO/XAO_Group.cxx | 45 +- src/XAO/XAO_Group.hxx | 241 +- src/XAO/XAO_IntegerField.cxx | 40 +- src/XAO/XAO_IntegerField.hxx | 87 +- src/XAO/XAO_IntegerStep.cxx | 137 +- src/XAO/XAO_IntegerStep.hxx | 176 +- src/XAO/XAO_Step.cxx | 67 +- src/XAO/XAO_Step.hxx | 254 ++- src/XAO/XAO_StringField.cxx | 37 +- src/XAO/XAO_StringField.hxx | 86 +- src/XAO/XAO_StringStep.cxx | 139 +- src/XAO/XAO_StringStep.hxx | 175 +- src/XAO/XAO_Xao.cxx | 333 ++- src/XAO/XAO_Xao.hxx | 441 ++-- src/XAO/XAO_XaoExporter.cxx | 1101 +++++---- src/XAO/XAO_XaoExporter.hxx | 91 +- src/XAO/XAO_XaoUtils.cxx | 194 +- src/XAO/XAO_XaoUtils.hxx | 320 ++- src/XAO/tests/BrepGeometryTest.cxx | 494 ++--- src/XAO/tests/BrepGeometryTest.hxx | 77 +- src/XAO/tests/FieldTest.cxx | 820 ++++--- src/XAO/tests/FieldTest.hxx | 83 +- src/XAO/tests/GeometryTest.cxx | 214 +- src/XAO/tests/GeometryTest.hxx | 43 +- src/XAO/tests/GroupTest.cxx | 75 +- src/XAO/tests/GroupTest.hxx | 33 +- src/XAO/tests/ImportExportTest.cxx | 352 ++- src/XAO/tests/ImportExportTest.hxx | 53 +- src/XAO/tests/MainTest.hxx | 168 +- src/XAO/tests/TestUtils.hxx | 57 +- src/XAO/tests/XAOTests.cxx | 9 +- src/XAO/tests/XaoTest.cxx | 163 +- src/XAO/tests/XaoTest.hxx | 37 +- src/XAO/tests/XaoUtilsTest.cxx | 129 +- src/XAO/tests/XaoUtilsTest.hxx | 49 +- src/XAO/tests/coverage_report.sh | 2 +- src/XGUI/XGUI.h | 7 +- src/XGUI/XGUI_ActionsMgr.cpp | 290 ++- src/XGUI/XGUI_ActionsMgr.h | 69 +- src/XGUI/XGUI_ActiveControlMgr.cpp | 68 +- src/XGUI/XGUI_ActiveControlMgr.h | 37 +- src/XGUI/XGUI_ActiveControlSelector.h | 38 +- src/XGUI/XGUI_ColorDialog.cpp | 101 +- src/XGUI/XGUI_ColorDialog.h | 31 +- src/XGUI/XGUI_CompressFiles.cpp | 31 +- src/XGUI/XGUI_CompressFiles.h | 20 +- src/XGUI/XGUI_ContextMenuMgr.cpp | 600 ++--- src/XGUI/XGUI_ContextMenuMgr.h | 68 +- src/XGUI/XGUI_DataModel.cpp | 360 +-- src/XGUI/XGUI_DataModel.h | 143 +- src/XGUI/XGUI_DeflectionDialog.cpp | 25 +- src/XGUI/XGUI_DeflectionDialog.h | 24 +- src/XGUI/XGUI_Displayer.cpp | 671 +++--- src/XGUI/XGUI_Displayer.h | 286 +-- src/XGUI/XGUI_ErrorDialog.cpp | 43 +- src/XGUI/XGUI_ErrorDialog.h | 38 +- src/XGUI/XGUI_ErrorMgr.cpp | 159 +- src/XGUI/XGUI_ErrorMgr.h | 55 +- src/XGUI/XGUI_FacesPanel.cpp | 377 ++-- src/XGUI/XGUI_FacesPanel.h | 133 +- src/XGUI/XGUI_FacesPanelSelector.cpp | 19 +- src/XGUI/XGUI_FacesPanelSelector.h | 25 +- src/XGUI/XGUI_HistoryMenu.cpp | 67 +- src/XGUI/XGUI_HistoryMenu.h | 31 +- src/XGUI/XGUI_InspectionPanel.cpp | 136 +- src/XGUI/XGUI_InspectionPanel.h | 57 +- src/XGUI/XGUI_MenuGroup.cpp | 16 +- src/XGUI/XGUI_MenuGroup.h | 30 +- src/XGUI/XGUI_MenuMgr.cpp | 184 +- src/XGUI/XGUI_MenuMgr.h | 44 +- src/XGUI/XGUI_MenuWorkbench.cpp | 25 +- src/XGUI/XGUI_MenuWorkbench.h | 31 +- src/XGUI/XGUI_ModuleConnector.cpp | 182 +- src/XGUI/XGUI_ModuleConnector.h | 102 +- src/XGUI/XGUI_ObjectsBrowser.cpp | 363 ++- src/XGUI/XGUI_ObjectsBrowser.h | 189 +- src/XGUI/XGUI_OperationMgr.cpp | 813 ++++--- src/XGUI/XGUI_OperationMgr.h | 206 +- src/XGUI/XGUI_PropertyDialog.cpp | 20 +- src/XGUI/XGUI_PropertyDialog.h | 23 +- src/XGUI/XGUI_PropertyPanel.cpp | 441 ++-- src/XGUI/XGUI_PropertyPanel.h | 165 +- src/XGUI/XGUI_PropertyPanelSelector.cpp | 35 +- src/XGUI/XGUI_PropertyPanelSelector.h | 33 +- src/XGUI/XGUI_QtEvents.cpp | 10 +- src/XGUI/XGUI_QtEvents.h | 34 +- src/XGUI/XGUI_SalomeConnector.cpp | 13 +- src/XGUI/XGUI_SalomeConnector.h | 77 +- src/XGUI/XGUI_Selection.cpp | 222 +- src/XGUI/XGUI_Selection.h | 65 +- src/XGUI/XGUI_SelectionActivate.cpp | 401 ++-- src/XGUI/XGUI_SelectionActivate.h | 74 +- src/XGUI/XGUI_SelectionMgr.cpp | 139 +- src/XGUI/XGUI_SelectionMgr.h | 69 +- src/XGUI/XGUI_Tools.cpp | 159 +- src/XGUI/XGUI_Tools.h | 45 +- src/XGUI/XGUI_TransparencyWidget.cpp | 30 +- src/XGUI/XGUI_TransparencyWidget.h | 27 +- src/XGUI/XGUI_ViewerProxy.cpp | 472 ++-- src/XGUI/XGUI_ViewerProxy.h | 105 +- src/XGUI/XGUI_Workshop.cpp | 1967 +++++++++-------- src/XGUI/XGUI_Workshop.h | 333 +-- src/XGUI/XGUI_WorkshopListener.cpp | 461 ++-- src/XGUI/XGUI_WorkshopListener.h | 56 +- test.API/SHAPER/CMakeLists.txt | 2 +- test.squish/shared/testdata/SalomeApp.xml | 1 - .../stl-examples/cubeCylinder_ASCII.stl | 2 +- .../exchange/xao-examples/Box-export.xao | 192 +- .../tst_903/verificationPoints/VP_APPLY_RED | 2 +- .../tst_sketch_002/verificationPoints/VP1 | 2 +- .../tst_sketch_003/verificationPoints/VP1 | 2 +- .../tst_sketch_003/verificationPoints/VP2 | 2 +- .../tst_sketch_004/verificationPoints/VP3 | 2 +- .../tst_sketch_005/verificationPoints/VP2 | 2 +- .../tst_sketch_006/verificationPoints/VP2 | 2 +- .../tst_sketch_007/verificationPoints/VP2 | 2 +- .../tst_sketch_009/verificationPoints/VP2 | 2 +- .../tst_sketch_010/verificationPoints/VP2 | 2 +- .../tst_sketch_012/verificationPoints/VP2 | 2 +- .../tst_sketch_016/verificationPoints/VP1 | 2 +- .../tst_sketch_017/verificationPoints/VP1 | 2 +- .../tst_sketch_017/verificationPoints/VP2 | 2 +- .../tst_sketch_018/verificationPoints/VP1 | 2 +- .../tst_532/verificationPoints/VP_EXTRUSION | 2 +- .../tst_532/verificationPoints/VP_PARTITION | 2 +- .../verificationPoints/VP_PARALLEL_1 | 2 +- .../verificationPoints/VP_PARALLEL_2 | 2 +- .../verificationPoints/VP_SKETCH | 2 +- .../tst_common_1/verificationPoints/VP1 | 2 +- .../tst_common_1/verificationPoints/VP2 | 2 +- .../tst_common_1/verificationPoints/VP3 | 2 +- test_squish-vnc.sh | 1 - vnc-run | 1 - 2037 files changed, 90143 insertions(+), 89223 deletions(-) diff --git a/.gitignore b/.gitignore index 99d4196da..210693c17 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,3 @@ test.*results/* err_* log_* env_config.sh - diff --git a/.salomeport b/.salomeport index 145d7e23c..f08784950 100644 --- a/.salomeport +++ b/.salomeport @@ -1 +1 @@ -2810 \ No newline at end of file +2810 diff --git a/CMakeCommon/CodeCoverage.cmake b/CMakeCommon/CodeCoverage.cmake index 6a2b98933..d60e1af9b 100644 --- a/CMakeCommon/CodeCoverage.cmake +++ b/CMakeCommon/CodeCoverage.cmake @@ -45,10 +45,10 @@ # 2. Add the following line to your CMakeLists.txt: # INCLUDE(CodeCoverage) # -# 3. Set compiler flags to turn off optimization and enable coverage: +# 3. Set compiler flags to turn off optimization and enable coverage: # SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") # SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") -# +# # 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target # which runs your test executable and produces a lcov code coverage report: # Example: @@ -80,7 +80,7 @@ ENDIF() # NOT GCOV_PATH IF(NOT CMAKE_COMPILER_IS_GNUCXX) # Clang version 3.0.0 and greater now supports gcov as well. MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") - + IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") ENDIF() @@ -115,7 +115,7 @@ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" # Param _targetname The name of new the custom make target # Param _testrunner The name of the target which runs the tests. -# MUST return ZERO always, even on errors. +# MUST return ZERO always, even on errors. # If not, no coverage report will be created! # Param _outputname lcov output is generated as _outputname.info # HTML report is generated in _outputname/index.html @@ -133,23 +133,23 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) # Setup target ADD_CUSTOM_TARGET(${_targetname} - + # Cleanup lcov ${LCOV_PATH} --directory . --zerocounters - + # Run tests COMMAND ${_testrunner} ${ARGV3} - + # Capturing lcov counters and generating report COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned - + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." ) - + # Show info where to find the report ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD COMMAND ; diff --git a/CMakeCommon/FindPlaneGCS.cmake b/CMakeCommon/FindPlaneGCS.cmake index d31603ab5..d89508c5c 100644 --- a/CMakeCommon/FindPlaneGCS.cmake +++ b/CMakeCommon/FindPlaneGCS.cmake @@ -61,4 +61,4 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PlaneGCS REQUIRED_VARS PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR) -MARK_AS_ADVANCED(PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR) \ No newline at end of file +MARK_AS_ADVANCED(PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR) diff --git a/CMakeCommon/FindPython.cmake b/CMakeCommon/FindPython.cmake index deff86971..b085cbee1 100644 --- a/CMakeCommon/FindPython.cmake +++ b/CMakeCommon/FindPython.cmake @@ -54,4 +54,4 @@ ENDIF() FIND_PACKAGE(PythonInterp REQUIRED) FIND_PACKAGE(PythonLibs REQUIRED) -INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR}) \ No newline at end of file +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR}) diff --git a/CMakeCommon/FindSUIT.cmake b/CMakeCommon/FindSUIT.cmake index 9b8ba0513..303ba5495 100644 --- a/CMakeCommon/FindSUIT.cmake +++ b/CMakeCommon/FindSUIT.cmake @@ -20,7 +20,7 @@ IF(HAVE_SALOME) SET(SUIT_INCLUDE "${GUI_ROOT_DIR}/include/salome") SET(SUIT_LIB_DIR "${GUI_ROOT_DIR}/lib/salome") -ELSE(HAVE_SALOME) +ELSE(HAVE_SALOME) SET(SUIT_DIR $ENV{SUIT_DIR}) IF(EXISTS ${SUIT_DIR}) MESSAGE(STATUS "SUIT found at ${SUIT_DIR}") diff --git a/CMakeCommon/FindSalomeOpenCASCADE.cmake b/CMakeCommon/FindSalomeOpenCASCADE.cmake index 653225a43..54b890ff9 100644 --- a/CMakeCommon/FindSalomeOpenCASCADE.cmake +++ b/CMakeCommon/FindSalomeOpenCASCADE.cmake @@ -45,4 +45,4 @@ ELSE() IF(NOT CAS_FIND_QUIETLY) MESSAGE(STATUS "Could not find OpenCASCADE ...") ENDIF() -ENDIF() \ No newline at end of file +ENDIF() diff --git a/CMakeCommon/FindSolveSpace.cmake b/CMakeCommon/FindSolveSpace.cmake index c37510398..43bfd0bdd 100644 --- a/CMakeCommon/FindSolveSpace.cmake +++ b/CMakeCommon/FindSolveSpace.cmake @@ -47,4 +47,4 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SolveSpace REQUIRED_VARS SOLVESPACE_LIBRARY SOLVESPACE_INCLUDE_DIR) -MARK_AS_ADVANCED(SOLVESPACE_LIBRARY SOLVESPACE_INCLUDE_DIR) \ No newline at end of file +MARK_AS_ADVANCED(SOLVESPACE_LIBRARY SOLVESPACE_INCLUDE_DIR) diff --git a/CMakeCommon/Logger.cmake b/CMakeCommon/Logger.cmake index 56aaea540..6ef2b9b3a 100644 --- a/CMakeCommon/Logger.cmake +++ b/CMakeCommon/Logger.cmake @@ -20,32 +20,32 @@ # /* C++ comment style not allowed */ -# if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise -# this is the top level directory of your build tree +# if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise +# this is the top level directory of your build tree MESSAGE( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} ) -# if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this -# is the directory where the compiled or generated files from the current CMakeLists.txt will go to +# if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this +# is the directory where the compiled or generated files from the current CMakeLists.txt will go to MESSAGE( STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR} ) -# this is the directory, from which cmake was started, i.e. the top level source directory +# this is the directory, from which cmake was started, i.e. the top level source directory MESSAGE( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} ) -# this is the directory where the currently processed CMakeLists.txt is located in +# this is the directory where the currently processed CMakeLists.txt is located in MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} ) -# contains the full path to the top level directory of your build tree +# contains the full path to the top level directory of your build tree MESSAGE( STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR} ) # contains the full path to the root of your project source directory, -# i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command +# i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} ) # set this variable to specify a common place where CMake should put all executable files # (instead of CMAKE_CURRENT_BINARY_DIR) MESSAGE( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} ) -# set this variable to specify a common place where CMake should put all libraries +# set this variable to specify a common place where CMake should put all libraries # (instead of CMAKE_CURRENT_BINARY_DIR) MESSAGE( STATUS "LIBRARY_OUTPUT_PATH: " ${LIBRARY_OUTPUT_PATH} ) @@ -53,13 +53,13 @@ MESSAGE( STATUS "LIBRARY_OUTPUT_PATH: " ${LIBRARY_OUTPUT_PATH} ) # when you use FIND_PACKAGE() or INCLUDE() MESSAGE( STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH} ) -# this is the complete path of the cmake which runs currently (e.g. /usr/local/bin/cmake) +# this is the complete path of the cmake which runs currently (e.g. /usr/local/bin/cmake) MESSAGE( STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND} ) -# this is the CMake installation directory +# this is the CMake installation directory MESSAGE( STATUS "CMAKE_ROOT: " ${CMAKE_ROOT} ) -# this is the filename including the complete path of the file where this variable is used. +# this is the filename including the complete path of the file where this variable is used. MESSAGE( STATUS "CMAKE_CURRENT_LIST_FILE: " ${CMAKE_CURRENT_LIST_FILE} ) # this is linenumber where the variable is used @@ -71,22 +71,22 @@ MESSAGE( STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} ) # this is used when searching for libraries e.g. using the FIND_LIBRARY() command. MESSAGE( STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH} ) -# the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1" +# the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1" MESSAGE( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} ) # the short system name, e.g. "Linux", "FreeBSD" or "Windows" MESSAGE( STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME} ) -# only the version part of CMAKE_SYSTEM +# only the version part of CMAKE_SYSTEM MESSAGE( STATUS "CMAKE_SYSTEM_VERSION: " ${CMAKE_SYSTEM_VERSION} ) -# the processor name (e.g. "Intel(R) Pentium(R) M processor 2.00GHz") +# the processor name (e.g. "Intel(R) Pentium(R) M processor 2.00GHz") MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} ) # is TRUE on all UNIX-like OS's, including Apple OS X and CygWin MESSAGE( STATUS "UNIX: " ${UNIX} ) -# is TRUE on Windows, including CygWin +# is TRUE on Windows, including CygWin MESSAGE( STATUS "WIN32: " ${WIN32} ) # is TRUE on Apple OS X @@ -98,10 +98,10 @@ MESSAGE( STATUS "MINGW: " ${MINGW} ) # is TRUE on Windows when using the CygWin version of cmake MESSAGE( STATUS "CYGWIN: " ${CYGWIN} ) -# is TRUE on Windows when using a Borland compiler +# is TRUE on Windows when using a Borland compiler MESSAGE( STATUS "BORLAND: " ${BORLAND} ) -# Microsoft compiler +# Microsoft compiler MESSAGE( STATUS "MSVC: " ${MSVC} ) MESSAGE( STATUS "MSVC_IDE: " ${MSVC_IDE} ) MESSAGE( STATUS "MSVC60: " ${MSVC60} ) @@ -111,59 +111,59 @@ MESSAGE( STATUS "MSVC80: " ${MSVC80} ) MESSAGE( STATUS "CMAKE_COMPILER_2005: " ${CMAKE_COMPILER_2005} ) -# set this to true if you don't want to rebuild the object files if the rules have changed, -# but not the actual source files or headers (e.g. if you changed the some compiler switches) +# set this to true if you don't want to rebuild the object files if the rules have changed, +# but not the actual source files or headers (e.g. if you changed the some compiler switches) MESSAGE( STATUS "CMAKE_SKIP_RULE_DEPENDENCY: " ${CMAKE_SKIP_RULE_DEPENDENCY} ) -# since CMake 2.1 the install rule depends on all, i.e. everything will be built before installing. +# since CMake 2.1 the install rule depends on all, i.e. everything will be built before installing. # If you don't like this, set this one to true. MESSAGE( STATUS "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY: " ${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY} ) # If set, runtime paths are not added when using shared libraries. Default it is set to OFF MESSAGE( STATUS "CMAKE_SKIP_RPATH: " ${CMAKE_SKIP_RPATH} ) -# set this to true if you are using makefiles and want to see the full compile and link -# commands instead of only the shortened ones +# set this to true if you are using makefiles and want to see the full compile and link +# commands instead of only the shortened ones MESSAGE( STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE} ) -# this will cause CMake to not put in the rules that re-run CMake. This might be useful if -# you want to use the generated build files on another machine. +# this will cause CMake to not put in the rules that re-run CMake. This might be useful if +# you want to use the generated build files on another machine. MESSAGE( STATUS "CMAKE_SUPPRESS_REGENERATION: " ${CMAKE_SUPPRESS_REGENERATION} ) -# A simple way to get switches to the compiler is to use ADD_DEFINITIONS(). -# But there are also two variables exactly for this purpose: +# A simple way to get switches to the compiler is to use ADD_DEFINITIONS(). +# But there are also two variables exactly for this purpose: -# the compiler flags for compiling C sources +# the compiler flags for compiling C sources MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} ) -# the compiler flags for compiling C++ sources +# the compiler flags for compiling C++ sources MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) -# Choose the type of build. Example: SET(CMAKE_BUILD_TYPE Debug) +# Choose the type of build. Example: SET(CMAKE_BUILD_TYPE Debug) MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} ) # if this is set to ON, then all libraries are built as shared libraries by default. MESSAGE( STATUS "BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS} ) -# the compiler used for C files +# the compiler used for C files MESSAGE( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} ) -# the compiler used for C++ files +# the compiler used for C++ files MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} ) -# if the compiler is a variant of gcc, this should be set to 1 +# if the compiler is a variant of gcc, this should be set to 1 MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCC: " ${CMAKE_COMPILER_IS_GNUCC} ) -# if the compiler is a variant of g++, this should be set to 1 +# if the compiler is a variant of g++, this should be set to 1 MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX} ) -# the tools for creating libraries +# the tools for creating libraries MESSAGE( STATUS "CMAKE_AR: " ${CMAKE_AR} ) MESSAGE( STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB} ) # #MESSAGE( STATUS ": " ${} ) -# ------------------------- End of Generic CMake Variable Logging ------------------ \ No newline at end of file +# ------------------------- End of Generic CMake Variable Logging ------------------ diff --git a/CMakeCommon/UseQtExt.cmake b/CMakeCommon/UseQtExt.cmake index af8a6e18d..02543974e 100644 --- a/CMakeCommon/UseQtExt.cmake +++ b/CMakeCommon/UseQtExt.cmake @@ -40,7 +40,7 @@ MACRO(QT_WRAP_MOC) IF (QT_VERSION VERSION_LESS "5.0") QT4_WRAP_CPP(${ARGN}) ELSE() - QT5_WRAP_CPP(${ARGN}) + QT5_WRAP_CPP(${ARGN}) # Workaround to avoid problem with bug in moc preprocessor: # The problem is reproduced on Linux in case if native system Qt is installed # and "-I/usr/include" parameter is presented in the moc command line before @@ -52,7 +52,7 @@ ELSE() GET_FILENAME_COMPONENT(IT ${IT} ABSOLUTE) GET_FILENAME_COMPONENT(PFILE ${IT} NAME_WE) SET(OUTFILE ${CMAKE_CURRENT_BINARY_DIR}/moc_${PFILE}.cpp_parameters) - IF(EXISTS ${OUTFILE}) + IF(EXISTS ${OUTFILE}) SET(NEW_CONTENT) SET(IS_INCLUDE_SECTION TRUE) SET(HAS_SYSTEM_INC FALSE) @@ -77,7 +77,7 @@ ELSE() SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n") ENDIF() ENDFOREACH() - FILE(WRITE ${OUTFILE} ${NEW_CONTENT}) + FILE(WRITE ${OUTFILE} ${NEW_CONTENT}) ENDIF() ENDFOREACH() ENDIF() diff --git a/CMakeCommon/cmake_uninstall.cmake.in b/CMakeCommon/cmake_uninstall.cmake.in index 0c80c5643..44dca5347 100644 --- a/CMakeCommon/cmake_uninstall.cmake.in +++ b/CMakeCommon/cmake_uninstall.cmake.in @@ -37,4 +37,4 @@ foreach(file ${files}) else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") message(STATUS "File $ENV{DESTDIR}${file} does not exist.") endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) \ No newline at end of file +endforeach(file) diff --git a/README b/README index 629455b99..71b8709ca 100644 --- a/README +++ b/README @@ -14,8 +14,8 @@ or simply (only for not-SALOME prerequisites): make.sh -Note that it is possible to use SALOME installed environment for compilation. -For this just import it (PDIR variable will be set automatically) or update +Note that it is possible to use SALOME installed environment for compilation. +For this just import it (PDIR variable will be set automatically) or update salome_env.sh first "export" and import this script. @@ -45,4 +45,3 @@ msvc9_env_Salome.bat SALOME_ROOT_DIR is needed to be correctly set or located in "SALOME" folder of parent to SHAPER folder. For the current moment SALOME 7.3.0 compiled on Visual Studio 2008 compiler is supported. - diff --git a/build_Salome_deb.bat b/build_Salome_deb.bat index 985249431..7c7ccf712 100644 --- a/build_Salome_deb.bat +++ b/build_Salome_deb.bat @@ -1,6 +1,6 @@ @ECHO OFF -REM Find absolute path to ROOT_DIR +REM Find absolute path to ROOT_DIR @SET PARENT_DIR=%~dp0.. @SET ROOT_DIR= pushd %PARENT_DIR% diff --git a/build_Salome_rel.bat b/build_Salome_rel.bat index e3e2149c1..eecf7da07 100644 --- a/build_Salome_rel.bat +++ b/build_Salome_rel.bat @@ -1,6 +1,6 @@ @ECHO OFF -REM Find absolute path to ROOT_DIR +REM Find absolute path to ROOT_DIR @SET PARENT_DIR=%~dp0.. @SET ROOT_DIR= pushd %PARENT_DIR% diff --git a/doc/gui/General/TUI_tutorial.rst b/doc/gui/General/TUI_tutorial.rst index 949201bb8..8330c33e1 100644 --- a/doc/gui/General/TUI_tutorial.rst +++ b/doc/gui/General/TUI_tutorial.rst @@ -8,4 +8,4 @@ Tutorial TUI Script :linenos: :language: python -:download:`Download this script ` \ No newline at end of file +:download:`Download this script ` diff --git a/doc/swig/doxyfile.in b/doc/swig/doxyfile.in index 0d4795380..584bb6558 100644 --- a/doc/swig/doxyfile.in +++ b/doc/swig/doxyfile.in @@ -96,7 +96,7 @@ WARN_LOGFILE = log.txt #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = @CMAKE_CURRENT_SOURCE_DIR@ +INPUT = @CMAKE_CURRENT_SOURCE_DIR@ INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.h \ *.cpp \ @@ -142,7 +142,7 @@ GENERATE_HTML = NO HTML_OUTPUT = . HTML_FILE_EXTENSION = .html HTML_HEADER = -HTML_FOOTER = +HTML_FOOTER = HTML_STYLESHEET = HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = diff --git a/doc/tui/CADBuilder/general_architecture.doc b/doc/tui/CADBuilder/general_architecture.doc index 940f920aa..ca4406d3e 100644 --- a/doc/tui/CADBuilder/general_architecture.doc +++ b/doc/tui/CADBuilder/general_architecture.doc @@ -5,7 +5,7 @@ CAD Builder is made of Workshop (see XGUI_Workshop) which loads a Module (see Mo \n Workshop interacts with a Module with help of specific interface defined in ModuleBase package. Each module for CAD Builder application has to implement ModuleBase_IModile interface. \n -A Module manages a one document (ModelAPI_Document). This document consists of a one root document and several, loaded by request, sub-documents. Each sub-document can be stored in a single file. +A Module manages a one document (ModelAPI_Document). This document consists of a one root document and several, loaded by request, sub-documents. Each sub-document can be stored in a single file. \n Main features of the general architecture of CAD Builder: diff --git a/doc/tui/Modules.doc b/doc/tui/Modules.doc index 451a13f4c..187422fa7 100644 --- a/doc/tui/Modules.doc +++ b/doc/tui/Modules.doc @@ -4,10 +4,10 @@ * \defgroup DataModel Data model * * \brief Structures for storage and management the application data. - * + * * Data structures are unified and splitted in universal ModelAPI package. * The OCCT specialized implementation of ModelAPI interfaces is located in the Model. - * The geometrical primitives interfaces in GeomAPI package are supported by geometrical + * The geometrical primitives interfaces in GeomAPI package are supported by geometrical * persistence elements in GeomDatAPI interface and has OCCT-specific implementation in GeomData package. * */ @@ -16,17 +16,17 @@ * \defgroup DataAlgo Algorithms * * \brief Different algorithm used in the application - * + * * The geometrical algorithms implementation (basing on OCCT libraries) are located in GeomAlgoAPI. * */ - + /** * \defgroup Plugins Plugins * * \brief Implementation of specific features of the application is concentrated in plugins. - * + * * The C++ and Python features implementations are located in plugins: specially organized libraries * and configuration files that allows to define the user interface and specific algorithms. * There are many plugins that should be extended with the development of the application. The names @@ -34,7 +34,7 @@ * PartSetPlugin, ConstructionPlugin, SketchPlugin, FeaturesPlugins, etc. * */ - + /** * \defgroup CPPHighAPI C++ High API * @@ -45,11 +45,11 @@ */ /** - * \defgroup Config Config + * \defgroup Config Config * * \brief XML processing tools used in the application - * - * The tools for reading definitions of plugins, features and widgets. + * + * The tools for reading definitions of plugins, features and widgets. * */ @@ -57,8 +57,8 @@ * \defgroup GUI GUI of the application * * \brief Classes for graphic user interface definition - * - * Classes of application windows definition, operations launching, + * + * Classes of application windows definition, operations launching, * and objects presentations. It consists of two packages: * - ModuleBase - level for modules definition * - XGUI - implementation of Application GUI. @@ -66,21 +66,21 @@ /** * \defgroup Salome A Salome connector - * - * \brief A set of classes which provide wrapping of + * + * \brief A set of classes which provide wrapping of * CAD Builder application as SALOME module */ -/** +/** * \defgroup Desktop Classes for standalone application - * - * \brief This group contains classes for launching the application + * + * \brief This group contains classes for launching the application * in standalone desktop (without SALOME) */ -/** +/** * \defgroup Modules Modules - * + * * \brief Definition of a module as a set of classes for plugins management */ @@ -88,11 +88,11 @@ * \defgroup Validators Validators * * \brief Implementation of internal logic of the feature - * - * Validators are used for checking validity of the feature: each argument, - * dependencies between the arguments. Validators are defined in the + * + * Validators are used for checking validity of the feature: each argument, + * dependencies between the arguments. Validators are defined in the * configuration files and may be also used for selection filters (ModuleBase_SelectionValidator), - * passing configurable parameters from XML file to the feature implementation + * passing configurable parameters from XML file to the feature implementation * (like in ExchangePlugin_ImportFormatValidator). * */ diff --git a/doc/tui/Shaper/general_architecture.doc b/doc/tui/Shaper/general_architecture.doc index 3041bfed3..df8fb4850 100644 --- a/doc/tui/Shaper/general_architecture.doc +++ b/doc/tui/Shaper/general_architecture.doc @@ -5,7 +5,7 @@ A Shaper module is made of Workshop (see XGUI_Workshop) which loads a Module (se \n Workshop interacts with a Module with help of specific interface defined in ModuleBase package. Each module for SHAPER application has to implement ModuleBase_IModile interface. \n -A Module manages a one document (ModelAPI_Document). This document consists of a one root document and several, loaded by request, sub-documents. Each sub-document can be stored in a single file. +A Module manages a one document (ModelAPI_Document). This document consists of a one root document and several, loaded by request, sub-documents. Each sub-document can be stored in a single file. \n Main features of the general architecture of Shaper: diff --git a/doc/tui/doxyfile.in b/doc/tui/doxyfile.in index 4d4d34857..df9d37c37 100644 --- a/doc/tui/doxyfile.in +++ b/doc/tui/doxyfile.in @@ -670,7 +670,7 @@ WARN_LOGFILE = log.txt # with spaces. INPUT = @PROJECT_SOURCE_DIR@/src \ - @CMAKE_CURRENT_SOURCE_DIR@ + @CMAKE_CURRENT_SOURCE_DIR@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -919,7 +919,7 @@ HTML_HEADER = # each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = +HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to diff --git a/doc/tui/first_feature_help.doc b/doc/tui/first_feature_help.doc index 66c1ab157..e5e9ad367 100644 --- a/doc/tui/first_feature_help.doc +++ b/doc/tui/first_feature_help.doc @@ -1,9 +1,9 @@ /*! \page first_feature_help How to create custom features or plugins -A SHAPER module consists of one or several plug-ins which provide implementation of Module features. To extend the application functionality, developers are able to add their own features into existent plugins. Also, it is possible to create a custom plugin, if necessary. +A SHAPER module consists of one or several plug-ins which provide implementation of Module features. To extend the application functionality, developers are able to add their own features into existent plugins. Also, it is possible to create a custom plugin, if necessary. \n -This document describes the basic principles of plugin/feature system and shows how to use the API for writing a feature or plugin. Currently, the API is available for C++ and Python languages. Plugin, written in C++ is a shared object (dll); For Python, it is regular python module, with *.py extension. +This document describes the basic principles of plugin/feature system and shows how to use the API for writing a feature or plugin. Currently, the API is available for C++ and Python languages. Plugin, written in C++ is a shared object (dll); For Python, it is regular python module, with *.py extension. \n

XML configuration of the module

By default, all application's plugins are stored in the `/plugins` folder. However, it is possible to change this path in preferences: "Preferences >> Module|Plugins >> Default Path". @@ -19,7 +19,7 @@ or, for python plugin: First example declares FooPlugin, which is library (`FooPlugin.dll` or `FooPlugin.so`) with "plugin-Foo.xml" configuration file. The second - a Python module, `PythonicPlugin.py`. All the declared libraries, scripts and configuration files should be placed in the same directory as the `plugins.xml`. Note also, that `library` and `script` attributes should not contain any extensions (*.py, *.dll); However, the `configuration` attribute doesn't have any pattern and just have to match name of the plugin configuration file. \n

XML configuration of a plugin

-The plugin configuration files contains description of features: +The plugin configuration files contains description of features:
  1. Position in the main menu: workbench and group.
  2. Visual representation of feature's button: text, icon, tooltip
  3. @@ -47,7 +47,7 @@ Secondly, you should create a subclass of ModelAPI_Plugin. Constructor on the su #include //... class FooPlugin : public ModelAPI_Plugin { - + FooPlugin() // Constructor { ModelAPI_Session::get()->registerPlugin(this); @@ -59,7 +59,7 @@ And in Python: import ModelAPI #... class PythonicPlugin(ModelAPI.ModelAPI_Plugin) - + def __init__(self): #constructor ModelAPI.ModelAPI_Plugin.__init__(self) # call ancestor's constructor aSession = ModelAPI.ModelAPI_Session.get() @@ -99,7 +99,7 @@ plugin.__disown__() Plugin is created, lets pass over to the feature's implementation. \n

    Creating a feature

    -Like a plugin, feature has its own base class - ModelAPI_Feature. +Like a plugin, feature has its own base class - ModelAPI_Feature. \code #include //... @@ -230,4 +230,4 @@ If you writing a C++ plugin you should compile and link all sources in a dynamic -*/ \ No newline at end of file +*/ diff --git a/doc/tui/index.doc b/doc/tui/index.doc index e0806cab0..89224d9f9 100644 --- a/doc/tui/index.doc +++ b/doc/tui/index.doc @@ -8,7 +8,7 @@ To browse the New GEOM module Developer Documentation, follow the links below or
  4. Files - list of all files with brief descriptions.
  5. -Also you may see \subpage general_architecture document that describes +Also you may see \subpage general_architecture document that describes the main principles and terms of the development. The creation of new feature in C++ or python can be done with help of \subpage first_feature_help . diff --git a/env_lcov.sh b/env_lcov.sh index e12a0db92..35c43a7ec 100644 --- a/env_lcov.sh +++ b/env_lcov.sh @@ -3,4 +3,4 @@ LCOV_DIR=/dn48/newgeom/common/products/lcov-1.11 export PATH=${LCOV_DIR}/bin:${PATH} -echo "Use LCOV in ${LCOV_DIR}..." \ No newline at end of file +echo "Use LCOV in ${LCOV_DIR}..." diff --git a/findDOSfiles.sh b/findDOSfiles.sh index dca626b70..c85ea0068 100755 --- a/findDOSfiles.sh +++ b/findDOSfiles.sh @@ -2,8 +2,8 @@ function isDOSFile { - local FILENAME="$1" - file "$FILENAME" | grep -q "CRLF line terminators" + local FILENAME="$1" + file "$FILENAME" | grep -q "CRLF line terminators" } if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then @@ -16,7 +16,7 @@ fi # Find files with DOS line endings FOUND=0 for FILE in $(exec git diff-index --check --cached $against -- | sed '/^[+-]/d' | sed -r 's/:[0-9]+:.*//' | uniq) ; do - isDOSFile "$FILE" + isDOSFile "$FILE" if (( $? == 0 )) then echo "\"$FILE\" has DOS line endings" >&2 diff --git a/findEndLines.sh b/findEndLines.sh index eb3c0cc70..10e8377f4 100755 --- a/findEndLines.sh +++ b/findEndLines.sh @@ -3,7 +3,7 @@ FIX_LINE_ENDINGS=0 while [[ $# > 0 ]]; do key="$1" - + case $key in fix) FIX_LINE_ENDINGS=1 diff --git a/find_duplicated_images.sh b/find_duplicated_images.sh index ddb60cb00..0c9ea4136 100755 --- a/find_duplicated_images.sh +++ b/find_duplicated_images.sh @@ -42,7 +42,7 @@ find_duplicated_images_main() fi done shift $((OPTIND - 1)) - + local result=0 if [ "${verbose}" = "1" ] diff --git a/fixDOSfiles.sh b/fixDOSfiles.sh index d6ac8843d..dcd9d8656 100755 --- a/fixDOSfiles.sh +++ b/fixDOSfiles.sh @@ -2,4 +2,4 @@ find src -type f -name "*.cpp" | xargs dos2unix $1 >/dev/null find src -type f -name "*.h" | xargs dos2unix $1 >/dev/null -find src -type f -name "*.py" | xargs dos2unix $1 >/dev/null \ No newline at end of file +find src -type f -name "*.py" | xargs dos2unix $1 >/dev/null diff --git a/lcov-reset.sh b/lcov-reset.sh index bb4847ada..6817ea6e5 100755 --- a/lcov-reset.sh +++ b/lcov-reset.sh @@ -7,4 +7,3 @@ export GCOV_DIR=${GCOV_DIR:-${BUILD_DIR}} echo "Reset coverage data..." lcov --zerocounters --directory ${GCOV_DIR} - diff --git a/salome_run.sh b/salome_run.sh index dcbb707ce..07e15e479 100755 --- a/salome_run.sh +++ b/salome_run.sh @@ -10,7 +10,7 @@ if [ -f .salomeport ]; then ${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py ${SALOME_PORT} pkill -f "omniNames -start ${SALOME_PORT}" rm .salomeport -fi +fi SALOME_ARGS="" if [[ "${SALOME_SQUISH_PREFS:-FALSE}" == "TRUE" ]]; then @@ -24,4 +24,3 @@ ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py ${SALOME_ARGS} >log_runSalome 2>err_r #echo "Kill SALOME on port ${SALOME_PORT}" #${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py ${SALOME_PORT} #pkill -f "omniNames -start ${SALOME_PORT}" - diff --git a/solver.sh b/solver.sh index 98482e8dd..39fdda42d 100755 --- a/solver.sh +++ b/solver.sh @@ -16,7 +16,7 @@ while [[ $# > 0 ]]; do shift ;; -p) - export PLUGINS_PATH="$2" + export PLUGINS_PATH="$2" shift shift ;; @@ -48,4 +48,3 @@ cat ${PLUGINS_PATH} \ > ${PLUGINS_PATH}_out mv -f ${PLUGINS_PATH}_out ${PLUGINS_PATH} cat ${PLUGINS_PATH} - diff --git a/squishserver_run.sh b/squishserver_run.sh index 6256176ec..c1c3ab383 100755 --- a/squishserver_run.sh +++ b/squishserver_run.sh @@ -3,4 +3,4 @@ SQUISHSERVER_PORT=4320 source env_squish.sh -squishserver --verbose --port=${SQUISHSERVER_PORT} $@ +squishserver --verbose --port=${SQUISHSERVER_PORT} $@ diff --git a/src/BuildAPI/BuildAPI.h b/src/BuildAPI/BuildAPI.h index ec8f19408..6fc986aa6 100644 --- a/src/BuildAPI/BuildAPI.h +++ b/src/BuildAPI/BuildAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BUILDAPI_H @@ -22,13 +23,13 @@ #if defined BUILDAPI_EXPORTS #if defined WIN32 -#define BUILDAPI_EXPORT __declspec( dllexport ) +#define BUILDAPI_EXPORT __declspec(dllexport) #else #define BUILDAPI_EXPORT #endif #else #if defined WIN32 -#define BUILDAPI_EXPORT __declspec( dllimport ) +#define BUILDAPI_EXPORT __declspec(dllimport) #else #define BUILDAPI_EXPORT #endif diff --git a/src/BuildAPI/BuildAPI_CompSolid.cpp b/src/BuildAPI/BuildAPI_CompSolid.cpp index 60536549d..d9932fc42 100644 --- a/src/BuildAPI/BuildAPI_CompSolid.cpp +++ b/src/BuildAPI/BuildAPI_CompSolid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_CompSolid.h" @@ -23,48 +24,47 @@ #include //================================================================================================== -BuildAPI_CompSolid::BuildAPI_CompSolid(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_CompSolid::BuildAPI_CompSolid( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_CompSolid::BuildAPI_CompSolid(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_CompSolid::BuildAPI_CompSolid( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_CompSolid::~BuildAPI_CompSolid() -{ -} +BuildAPI_CompSolid::~BuildAPI_CompSolid() {} //================================================================================================== -void BuildAPI_CompSolid::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_CompSolid::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_CompSolid::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_CompSolid::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addCompSolid(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_CompSolid::BASE_OBJECTS_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_CompSolid::BASE_OBJECTS_ID()) + << ")" << std::endl; } //================================================================================================== -CompSolidPtr addCompSolid(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_CompSolid::ID()); +CompSolidPtr +addCompSolid(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_CompSolid::ID()); return CompSolidPtr(new BuildAPI_CompSolid(aFeature, theBaseObjects)); } diff --git a/src/BuildAPI/BuildAPI_CompSolid.h b/src/BuildAPI/BuildAPI_CompSolid.h index b634b650d..966bb3c19 100644 --- a/src/BuildAPI/BuildAPI_CompSolid.h +++ b/src/BuildAPI/BuildAPI_CompSolid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_CompSolid_H_ @@ -32,33 +33,35 @@ class ModelHighAPI_Selection; /// \class BuildAPI_CompSolid /// \ingroup CPPHighAPI /// \brief Interface for CompSolid feature. -class BuildAPI_CompSolid: public ModelHighAPI_Interface -{ +class BuildAPI_CompSolid : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_CompSolid(const std::shared_ptr& theFeature); + explicit BuildAPI_CompSolid( + const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_CompSolid(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_CompSolid( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_CompSolid(); - INTERFACE_1(BuildPlugin_CompSolid::ID(), - baseObjects, BuildPlugin_CompSolid::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */) + INTERFACE_1(BuildPlugin_CompSolid::ID(), baseObjects, + BuildPlugin_CompSolid::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on CompSolid object. @@ -67,7 +70,8 @@ typedef std::shared_ptr CompSolidPtr; /// \ingroup CPPHighAPI /// \brief Create CompSolid feature. BUILDAPI_EXPORT -CompSolidPtr addCompSolid(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +CompSolidPtr +addCompSolid(const std::shared_ptr &thePart, + const std::list &theBaseObjects); #endif // BuildAPI_CompSolid_H_ diff --git a/src/BuildAPI/BuildAPI_Compound.cpp b/src/BuildAPI/BuildAPI_Compound.cpp index 14e91a29a..8ea0560b5 100644 --- a/src/BuildAPI/BuildAPI_Compound.cpp +++ b/src/BuildAPI/BuildAPI_Compound.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Compound.h" @@ -23,48 +24,47 @@ #include //================================================================================================== -BuildAPI_Compound::BuildAPI_Compound(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Compound::BuildAPI_Compound( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Compound::BuildAPI_Compound(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Compound::BuildAPI_Compound( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Compound::~BuildAPI_Compound() -{ -} +BuildAPI_Compound::~BuildAPI_Compound() {} //================================================================================================== -void BuildAPI_Compound::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Compound::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Compound::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Compound::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addCompound(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_Compound::BASE_OBJECTS_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_Compound::BASE_OBJECTS_ID()) + << ")" << std::endl; } //================================================================================================== -CompoundPtr addCompound(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Compound::ID()); +CompoundPtr +addCompound(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Compound::ID()); return CompoundPtr(new BuildAPI_Compound(aFeature, theBaseObjects)); } diff --git a/src/BuildAPI/BuildAPI_Compound.h b/src/BuildAPI/BuildAPI_Compound.h index b4928f8dc..515ad1f96 100644 --- a/src/BuildAPI/BuildAPI_Compound.h +++ b/src/BuildAPI/BuildAPI_Compound.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Compound_H_ @@ -32,33 +33,35 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Compound /// \ingroup CPPHighAPI /// \brief Interface for Compound feature. -class BuildAPI_Compound: public ModelHighAPI_Interface -{ +class BuildAPI_Compound : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Compound(const std::shared_ptr& theFeature); + explicit BuildAPI_Compound( + const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Compound(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_Compound( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Compound(); - INTERFACE_1(BuildPlugin_Compound::ID(), - baseObjects, BuildPlugin_Compound::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */) + INTERFACE_1(BuildPlugin_Compound::ID(), baseObjects, + BuildPlugin_Compound::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Compound object. @@ -67,7 +70,8 @@ typedef std::shared_ptr CompoundPtr; /// \ingroup CPPHighAPI /// \brief Create Compound feature. BUILDAPI_EXPORT -CompoundPtr addCompound(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +CompoundPtr +addCompound(const std::shared_ptr &thePart, + const std::list &theBaseObjects); #endif // BuildAPI_Compound_H_ diff --git a/src/BuildAPI/BuildAPI_Edge.cpp b/src/BuildAPI/BuildAPI_Edge.cpp index 5e4e5ce3a..fa9272d67 100644 --- a/src/BuildAPI/BuildAPI_Edge.cpp +++ b/src/BuildAPI/BuildAPI_Edge.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Edge.h" @@ -23,19 +24,19 @@ #include //================================================================================================== -BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Edge::BuildAPI_Edge( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theComputeIntersections) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Edge::BuildAPI_Edge( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theComputeIntersections) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(BuildPlugin_Edge::CREATION_BY_SEGMENTS(), mycreationMethod); fillAttribute(theComputeIntersections, mycomputeIntersections); setBase(theBaseObjects); @@ -43,12 +44,12 @@ BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature } //================================================================================================== -BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Edge::BuildAPI_Edge( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(BuildPlugin_Edge::CREATION_BY_POINTS(), mycreationMethod); fillAttribute(theFirstPoint, myfirstPoint); fillAttribute(theSecondPoint, mysecondPoint); @@ -58,37 +59,34 @@ BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature } //================================================================================================== -BuildAPI_Edge::~BuildAPI_Edge() -{ - -} +BuildAPI_Edge::~BuildAPI_Edge() {} //================================================================================================== -void BuildAPI_Edge::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Edge::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Edge::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Edge::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addEdge(" << aPartName << ", "; - AttributeStringPtr aCreationMethod = aBase->string(BuildPlugin_Edge::CREATION_METHOD()); + AttributeStringPtr aCreationMethod = + aBase->string(BuildPlugin_Edge::CREATION_METHOD()); if (aCreationMethod && aCreationMethod->isInitialized() && aCreationMethod->value() == BuildPlugin_Edge::CREATION_BY_POINTS()) { theDumper << aBase->selection(BuildPlugin_Edge::FIRST_POINT()) << ", " << aBase->selection(BuildPlugin_Edge::SECOND_POINT()); - } - else { + } else { theDumper << aBase->selectionList(BuildPlugin_Edge::BASE_OBJECTS_ID()); - AttributeBooleanPtr isIntersect = aBase->boolean(BuildPlugin_Edge::INTERSECT_ID()); + AttributeBooleanPtr isIntersect = + aBase->boolean(BuildPlugin_Edge::INTERSECT_ID()); if (isIntersect->isInitialized()) theDumper << ", " << isIntersect; } @@ -96,18 +94,19 @@ void BuildAPI_Edge::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -EdgePtr addEdge(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const bool theComputeIntersections) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Edge::ID()); - return EdgePtr(new BuildAPI_Edge(aFeature, theBaseObjects, theComputeIntersections)); +EdgePtr addEdge(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theComputeIntersections) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Edge::ID()); + return EdgePtr( + new BuildAPI_Edge(aFeature, theBaseObjects, theComputeIntersections)); } -EdgePtr addEdge(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Edge::ID()); +EdgePtr addEdge(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Edge::ID()); return EdgePtr(new BuildAPI_Edge(aFeature, theFirstPoint, theSecondPoint)); } diff --git a/src/BuildAPI/BuildAPI_Edge.h b/src/BuildAPI/BuildAPI_Edge.h index b36b76956..e59a0e074 100644 --- a/src/BuildAPI/BuildAPI_Edge.h +++ b/src/BuildAPI/BuildAPI_Edge.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Edge_H_ @@ -32,48 +33,48 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Edge /// \ingroup CPPHighAPI /// \brief Interface for Edge feature. -class BuildAPI_Edge: public ModelHighAPI_Interface -{ +class BuildAPI_Edge : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Edge(const std::shared_ptr& theFeature); + explicit BuildAPI_Edge(const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Edge(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theComputeIntersections = false); + explicit BuildAPI_Edge( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theComputeIntersections = false); /// Constructor by points. BUILDAPI_EXPORT - explicit BuildAPI_Edge(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint); + explicit BuildAPI_Edge(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Edge(); - INTERFACE_5(BuildPlugin_Edge::ID(), - baseObjects, BuildPlugin_Edge::BASE_OBJECTS_ID(), + INTERFACE_5(BuildPlugin_Edge::ID(), baseObjects, + BuildPlugin_Edge::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */, creationMethod, BuildPlugin_Edge::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - firstPoint, BuildPlugin_Edge::FIRST_POINT(), - ModelAPI_AttributeSelection, /** First point */, - secondPoint, BuildPlugin_Edge::SECOND_POINT(), + ModelAPI_AttributeString, /** Creation method */, firstPoint, + BuildPlugin_Edge::FIRST_POINT(), ModelAPI_AttributeSelection, + /** First point */, secondPoint, BuildPlugin_Edge::SECOND_POINT(), ModelAPI_AttributeSelection, /** Second point */, computeIntersections, BuildPlugin_Edge::INTERSECT_ID(), - ModelAPI_AttributeBoolean, /** Intersect edges */) + ModelAPI_AttributeBoolean, + /** Intersect edges */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Edge object. @@ -82,14 +83,14 @@ typedef std::shared_ptr EdgePtr; /// \ingroup CPPHighAPI /// \brief Create Edge feature. BUILDAPI_EXPORT -EdgePtr addEdge(const std::shared_ptr& thePart, - const std::list& theBaseObjects, +EdgePtr addEdge(const std::shared_ptr &thePart, + const std::list &theBaseObjects, const bool theComputeIntersection = false); /// \ingroup CPPHighAPI /// \brief Create Edge feature. BUILDAPI_EXPORT -EdgePtr addEdge(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint); +EdgePtr addEdge(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint); #endif // BuildAPI_Edge_H_ diff --git a/src/BuildAPI/BuildAPI_Face.cpp b/src/BuildAPI/BuildAPI_Face.cpp index 035e6943e..63f6fdfa1 100644 --- a/src/BuildAPI/BuildAPI_Face.cpp +++ b/src/BuildAPI/BuildAPI_Face.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Face.h" @@ -23,50 +24,47 @@ #include //================================================================================================== -BuildAPI_Face::BuildAPI_Face(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Face::BuildAPI_Face( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Face::BuildAPI_Face(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Face::BuildAPI_Face( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Face::~BuildAPI_Face() -{ - -} +BuildAPI_Face::~BuildAPI_Face() {} //================================================================================================== -void BuildAPI_Face::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Face::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Face::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Face::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addFace(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_Face::BASE_OBJECTS_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_Face::BASE_OBJECTS_ID()) << ")" + << std::endl; } //================================================================================================== -FacePtr addFace(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Face::ID()); +FacePtr addFace(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Face::ID()); return FacePtr(new BuildAPI_Face(aFeature, theBaseObjects)); } diff --git a/src/BuildAPI/BuildAPI_Face.h b/src/BuildAPI/BuildAPI_Face.h index 9867f91ef..5c3c8050b 100644 --- a/src/BuildAPI/BuildAPI_Face.h +++ b/src/BuildAPI/BuildAPI_Face.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Face_H_ @@ -32,33 +33,34 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Face /// \ingroup CPPHighAPI /// \brief Interface for Face feature. -class BuildAPI_Face: public ModelHighAPI_Interface -{ +class BuildAPI_Face : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Face(const std::shared_ptr& theFeature); + explicit BuildAPI_Face(const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Face(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_Face( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Face(); - INTERFACE_1(BuildPlugin_Face::ID(), - baseObjects, BuildPlugin_Face::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */) + INTERFACE_1(BuildPlugin_Face::ID(), baseObjects, + BuildPlugin_Face::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Face object. @@ -67,7 +69,7 @@ typedef std::shared_ptr FacePtr; /// \ingroup CPPHighAPI /// \brief Create Face feature. BUILDAPI_EXPORT -FacePtr addFace(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +FacePtr addFace(const std::shared_ptr &thePart, + const std::list &theBaseObjects); #endif // BuildAPI_Face_H_ diff --git a/src/BuildAPI/BuildAPI_Filling.cpp b/src/BuildAPI/BuildAPI_Filling.cpp index af7748943..58514cea1 100644 --- a/src/BuildAPI/BuildAPI_Filling.cpp +++ b/src/BuildAPI/BuildAPI_Filling.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Filling.h" @@ -22,33 +23,29 @@ #include #include -BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Filling::BuildAPI_Filling( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } -BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) - : ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Filling::BuildAPI_Filling( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setAdvancedOptions(false); setBase(theBaseObjects); } } -BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const std::string& theOrientCorrection, - const int theMinDegree, - const int theMaxDegree, - const int theNbIter, - const double theTolerance2D, - const double theTolerance3D, - const bool theApproximate) - : ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Filling::BuildAPI_Filling( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const std::string &theOrientCorrection, const int theMinDegree, + const int theMaxDegree, const int theNbIter, const double theTolerance2D, + const double theTolerance3D, const bool theApproximate) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setOrientationMethod(theOrientCorrection); setMinDegree(theMinDegree); @@ -62,120 +59,110 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theF } } -BuildAPI_Filling::~BuildAPI_Filling() -{ -} +BuildAPI_Filling::~BuildAPI_Filling() {} -void BuildAPI_Filling::execIfBaseNotEmpty() -{ +void BuildAPI_Filling::execIfBaseNotEmpty() { if (baseObjects()->size() > 0) execute(); } -void BuildAPI_Filling::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Filling::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setOrientationMethod(const std::string& theMethod) -{ +void BuildAPI_Filling::setOrientationMethod(const std::string &theMethod) { fillAttribute(theMethod, myorientationMethod); if (theMethod != BuildPlugin_Filling::METHOD_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setMinDegree(const int theMinDegree) -{ +void BuildAPI_Filling::setMinDegree(const int theMinDegree) { fillAttribute(theMinDegree, myminDegree); if (theMinDegree != BuildPlugin_Filling::MINIMAL_DEGREE_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setMaxDegree(const int theMaxDegree) -{ +void BuildAPI_Filling::setMaxDegree(const int theMaxDegree) { fillAttribute(theMaxDegree, mymaxDegree); if (theMaxDegree != BuildPlugin_Filling::MAXIMAL_DEGREE_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setNbIterations(const int theNbIter) -{ +void BuildAPI_Filling::setNbIterations(const int theNbIter) { fillAttribute(theNbIter, mynbIterations); if (theNbIter != BuildPlugin_Filling::NUMBER_OF_ITERATIONS_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setTolerance2d(const double theTol2d) -{ +void BuildAPI_Filling::setTolerance2d(const double theTol2d) { fillAttribute(theTol2d, mytolerance2d); if (theTol2d != BuildPlugin_Filling::TOLERANCE_2D_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setTolerance3d(const double theTol3d) -{ +void BuildAPI_Filling::setTolerance3d(const double theTol3d) { fillAttribute(theTol3d, mytolerance3d); if (theTol3d != BuildPlugin_Filling::TOLERANCE_3D_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setApproximation(const bool theApproximate) -{ +void BuildAPI_Filling::setApproximation(const bool theApproximate) { fillAttribute(theApproximate, myapproximate); if (theApproximate != BuildPlugin_Filling::APPROXIMATION_DEFAULT()) setAdvancedOptions(); execIfBaseNotEmpty(); } -void BuildAPI_Filling::setAdvancedOptions(bool isEnabled) -{ - feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue(isEnabled ? "true" : ""); +void BuildAPI_Filling::setAdvancedOptions(bool isEnabled) { + feature() + ->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID()) + ->setValue(isEnabled ? "true" : ""); } -void BuildAPI_Filling::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Filling::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); - theDumper << aBase << " = model.addFilling(" << aPartName << ", " << baseObjects(); + theDumper << aBase << " = model.addFilling(" << aPartName << ", " + << baseObjects(); - if (!aBase->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->value().empty()) { + if (!aBase->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID()) + ->value() + .empty()) { // dump options too, - theDumper << ", " << orientationMethod() - << ", " << minDegree() << ", " << maxDegree() << ", " << nbIterations() - << ", " << tolerance2d() << ", " << tolerance3d() - << ", " << approximate(); + theDumper << ", " << orientationMethod() << ", " << minDegree() << ", " + << maxDegree() << ", " << nbIterations() << ", " << tolerance2d() + << ", " << tolerance3d() << ", " << approximate(); } theDumper << ")" << std::endl; } //================================================================================================== -FillingPtr addFilling(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Filling::ID()); +FillingPtr addFilling(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Filling::ID()); return FillingPtr(new BuildAPI_Filling(aFeature, theBaseObjects)); } -FillingPtr addFilling(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const std::string& theOrientCorrection, - const int theMinDegree, - const int theMaxDegree, - const int theNbIter, - const double theTolerance2D, - const double theTolerance3D, - const bool theApproximate) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Filling::ID()); - return FillingPtr(new BuildAPI_Filling(aFeature, theBaseObjects, theOrientCorrection, - theMinDegree, theMaxDegree, theNbIter, theTolerance2D, theTolerance3D, theApproximate)); +FillingPtr addFilling(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const std::string &theOrientCorrection, + const int theMinDegree, const int theMaxDegree, + const int theNbIter, const double theTolerance2D, + const double theTolerance3D, const bool theApproximate) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Filling::ID()); + return FillingPtr(new BuildAPI_Filling( + aFeature, theBaseObjects, theOrientCorrection, theMinDegree, theMaxDegree, + theNbIter, theTolerance2D, theTolerance3D, theApproximate)); } diff --git a/src/BuildAPI/BuildAPI_Filling.h b/src/BuildAPI/BuildAPI_Filling.h index 221facbfe..95b608c8e 100644 --- a/src/BuildAPI/BuildAPI_Filling.h +++ b/src/BuildAPI/BuildAPI_Filling.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Filling_H_ @@ -32,63 +33,55 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Filling /// \ingroup CPPHighAPI /// \brief Interface for Filling feature. -class BuildAPI_Filling : public ModelHighAPI_Interface -{ +class BuildAPI_Filling : public ModelHighAPI_Interface { public: /// Constructor without values. - BUILDAPI_EXPORT explicit BuildAPI_Filling(const std::shared_ptr& theFeature); + BUILDAPI_EXPORT explicit BuildAPI_Filling( + const std::shared_ptr &theFeature); /// Constructor with base objects. BUILDAPI_EXPORT - explicit BuildAPI_Filling(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_Filling( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Filling(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const std::string& theOrientCorrection, - const int theMinDegree, - const int theMaxDegree, - const int theNbIter, - const double theTolerance2D, - const double theTolerance3D, - const bool theApproximate); + explicit BuildAPI_Filling( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const std::string &theOrientCorrection, const int theMinDegree, + const int theMaxDegree, const int theNbIter, const double theTolerance2D, + const double theTolerance3D, const bool theApproximate); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Filling(); - INTERFACE_8(BuildPlugin_Filling::ID(), - baseObjects, BuildPlugin_Filling::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, - /** Base objects */, - orientationMethod, BuildPlugin_Filling::METHOD_ID(), - ModelAPI_AttributeString, - /** Method to keep edge orientaion */, - minDegree, BuildPlugin_Filling::MINIMAL_DEGREE_ID(), - ModelAPI_AttributeInteger, - /** Minimal degree */, - maxDegree, BuildPlugin_Filling::MAXIMAL_DEGREE_ID(), - ModelAPI_AttributeInteger, - /** Maximal degree */, - nbIterations, BuildPlugin_Filling::NUMBER_OF_ITERATIONS_ID(), - ModelAPI_AttributeInteger, - /** Number of iterations */, - tolerance2d, BuildPlugin_Filling::TOLERANCE_2D_ID(), - ModelAPI_AttributeDouble, - /** 2D tolerance */, - tolerance3d, BuildPlugin_Filling::TOLERANCE_3D_ID(), - ModelAPI_AttributeDouble, - /** 3D tolerance */, - approximate, BuildPlugin_Filling::APPROXIMATION_ID(), - ModelAPI_AttributeBoolean, - /** Approximate original edges */) + INTERFACE_8( + BuildPlugin_Filling::ID(), baseObjects, + BuildPlugin_Filling::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, + /** Base objects */, orientationMethod, BuildPlugin_Filling::METHOD_ID(), + ModelAPI_AttributeString, + /** Method to keep edge orientaion */, minDegree, + BuildPlugin_Filling::MINIMAL_DEGREE_ID(), ModelAPI_AttributeInteger, + /** Minimal degree */, maxDegree, + BuildPlugin_Filling::MAXIMAL_DEGREE_ID(), ModelAPI_AttributeInteger, + /** Maximal degree */, nbIterations, + BuildPlugin_Filling::NUMBER_OF_ITERATIONS_ID(), ModelAPI_AttributeInteger, + /** Number of iterations */, tolerance2d, + BuildPlugin_Filling::TOLERANCE_2D_ID(), ModelAPI_AttributeDouble, + /** 2D tolerance */, tolerance3d, BuildPlugin_Filling::TOLERANCE_3D_ID(), + ModelAPI_AttributeDouble, + /** 3D tolerance */, approximate, BuildPlugin_Filling::APPROXIMATION_ID(), + ModelAPI_AttributeBoolean, + /** Approximate original edges */) /// Modify base attribute of the feature. - BUILDAPI_EXPORT void setBase(const std::list& theBaseObjects); + BUILDAPI_EXPORT void + setBase(const std::list &theBaseObjects); /// Modify orientation method - BUILDAPI_EXPORT void setOrientationMethod(const std::string& theMethod); + BUILDAPI_EXPORT void setOrientationMethod(const std::string &theMethod); /// Modify minimal degree of result B-spline BUILDAPI_EXPORT void setMinDegree(const int theMinDegree); @@ -109,7 +102,7 @@ public: BUILDAPI_EXPORT void setApproximation(const bool theApproximate); /// Dump wrapped feature - BUILDAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; + BUILDAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); @@ -121,20 +114,21 @@ typedef std::shared_ptr FillingPtr; /// \ingroup CPPHighAPI /// \brief Create Filling feature. -BUILDAPI_EXPORT FillingPtr addFilling(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +BUILDAPI_EXPORT FillingPtr +addFilling(const std::shared_ptr &thePart, + const std::list &theBaseObjects); /// \ingroup CPPHighAPI /// \brief Create Filling feature. BUILDAPI_EXPORT FillingPtr addFilling( - const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const std::string& theOrientCorrection, - const int theMinDegree = BuildPlugin_Filling::MINIMAL_DEGREE_DEFAULT(), - const int theMaxDegree = BuildPlugin_Filling::MAXIMAL_DEGREE_DEFAULT(), - const int theNbIter = BuildPlugin_Filling::NUMBER_OF_ITERATIONS_DEFAULT(), - const double theTolerance2D = BuildPlugin_Filling::TOLERANCE_2D_DEFAULT(), - const double theTolerance3D = BuildPlugin_Filling::TOLERANCE_3D_DEFAULT(), - const bool theApproximate = BuildPlugin_Filling::APPROXIMATION_DEFAULT()); + const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const std::string &theOrientCorrection, + const int theMinDegree = BuildPlugin_Filling::MINIMAL_DEGREE_DEFAULT(), + const int theMaxDegree = BuildPlugin_Filling::MAXIMAL_DEGREE_DEFAULT(), + const int theNbIter = BuildPlugin_Filling::NUMBER_OF_ITERATIONS_DEFAULT(), + const double theTolerance2D = BuildPlugin_Filling::TOLERANCE_2D_DEFAULT(), + const double theTolerance3D = BuildPlugin_Filling::TOLERANCE_3D_DEFAULT(), + const bool theApproximate = BuildPlugin_Filling::APPROXIMATION_DEFAULT()); #endif // BuildAPI_Filling_H_ diff --git a/src/BuildAPI/BuildAPI_Interpolation.cpp b/src/BuildAPI/BuildAPI_Interpolation.cpp index 82391f486..7f3a0be0f 100644 --- a/src/BuildAPI/BuildAPI_Interpolation.cpp +++ b/src/BuildAPI/BuildAPI_Interpolation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Interpolation.h" @@ -23,23 +24,23 @@ #include //================================================================================================== -BuildAPI_Interpolation::BuildAPI_Interpolation(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Interpolation::BuildAPI_Interpolation( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theStartTangent, - const ModelHighAPI_Selection& theEndTangent, - const bool theIsClosed, - const bool theIsToReorder) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Interpolation::BuildAPI_Interpolation( + const FeaturePtr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theStartTangent, + const ModelHighAPI_Selection &theEndTangent, const bool theIsClosed, + const bool theIsToReorder) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(BuildPlugin_Interpolation::CREATION_METHOD_BY_SELECTION_ID(),mycreationmethod); + fillAttribute(BuildPlugin_Interpolation::CREATION_METHOD_BY_SELECTION_ID(), + mycreationmethod); setUseTangents(true); setTangents(theStartTangent, theEndTangent); setClosed(theIsClosed); @@ -49,14 +50,14 @@ BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature, } //================================================================================================== -BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature, - const std::list& theBaseObjects, - const bool theIsClosed, - const bool theIsToReorder) - : ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Interpolation::BuildAPI_Interpolation( + const FeaturePtr &theFeature, + const std::list &theBaseObjects, + const bool theIsClosed, const bool theIsToReorder) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(BuildPlugin_Interpolation::CREATION_METHOD_BY_SELECTION_ID(),mycreationmethod); + fillAttribute(BuildPlugin_Interpolation::CREATION_METHOD_BY_SELECTION_ID(), + mycreationmethod); setClosed(theIsClosed); setReorder(theIsToReorder); setUseTangents(false); @@ -65,17 +66,15 @@ BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature, } //================================================================================================== -BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature, - const std::string & theXTexpression, - const std::string & theYTexpression, - const std::string & theZTexpression, - const ModelHighAPI_Double& theMinT, - const ModelHighAPI_Double& theMaxT, - const ModelHighAPI_Integer& theNbStep) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Interpolation::BuildAPI_Interpolation( + const FeaturePtr &theFeature, const std::string &theXTexpression, + const std::string &theYTexpression, const std::string &theZTexpression, + const ModelHighAPI_Double &theMinT, const ModelHighAPI_Double &theMaxT, + const ModelHighAPI_Integer &theNbStep) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(BuildPlugin_Interpolation::CREATION_METHOD_ANALYTICAL_ID(),mycreationmethod); + fillAttribute(BuildPlugin_Interpolation::CREATION_METHOD_ANALYTICAL_ID(), + mycreationmethod); fillAttribute(theXTexpression, myxt); fillAttribute(theYTexpression, myyt); fillAttribute(theZTexpression, myzt); @@ -88,43 +87,38 @@ BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature, } //================================================================================================== -BuildAPI_Interpolation::~BuildAPI_Interpolation() -{ -} +BuildAPI_Interpolation::~BuildAPI_Interpolation() {} //================================================================================================== -void BuildAPI_Interpolation::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Interpolation::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Interpolation::setClosed(const bool theIsClosed) -{ +void BuildAPI_Interpolation::setClosed(const bool theIsClosed) { fillAttribute(theIsClosed, myclosed); execIfBaseNotEmpty(); } -void BuildAPI_Interpolation::setReorder(const bool theIsToReorder) -{ +void BuildAPI_Interpolation::setReorder(const bool theIsToReorder) { fillAttribute(theIsToReorder, myreorder); execIfBaseNotEmpty(); } -void BuildAPI_Interpolation::setUseTangents(const bool theIsToUseTangents) -{ +void BuildAPI_Interpolation::setUseTangents(const bool theIsToUseTangents) { fillAttribute(theIsToUseTangents ? "true" : "", myuseTangents); execIfBaseNotEmpty(); } -void BuildAPI_Interpolation::setTangents(const ModelHighAPI_Selection& theStartTangent, - const ModelHighAPI_Selection& theEndTangent) -{ +void BuildAPI_Interpolation::setTangents( + const ModelHighAPI_Selection &theStartTangent, + const ModelHighAPI_Selection &theEndTangent) { fillAttribute(theStartTangent, mystartTangent); fillAttribute(theEndTangent, myendTangent); @@ -132,16 +126,14 @@ void BuildAPI_Interpolation::setTangents(const ModelHighAPI_Selection& theStartT } //================================================================================================== -void BuildAPI_Interpolation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Interpolation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); if (aBase->string(BuildPlugin_Interpolation::CREATION_METHOD_ID())->value() == - BuildPlugin_Interpolation::CREATION_METHOD_BY_SELECTION_ID()) - { + BuildPlugin_Interpolation::CREATION_METHOD_BY_SELECTION_ID()) { AttributeSelectionListPtr anAttrBaseObjects = - aBase->selectionList(BuildPlugin_Interpolation::BASE_OBJECTS_ID()); + aBase->selectionList(BuildPlugin_Interpolation::BASE_OBJECTS_ID()); theDumper << aBase << " = model.addInterpolation(" << aPartName << ", " << anAttrBaseObjects << ", "; @@ -150,16 +142,16 @@ void BuildAPI_Interpolation::dump(ModelHighAPI_Dumper& theDumper) const std::string useTangents = useTangentsAttr->value(); if (!useTangents.empty()) { AttributeSelectionPtr anAttrStartTangent = - aBase->selection(BuildPlugin_Interpolation::TANGENT_START_ID()); + aBase->selection(BuildPlugin_Interpolation::TANGENT_START_ID()); AttributeSelectionPtr anAttrEndTangent = - aBase->selection(BuildPlugin_Interpolation::TANGENT_END_ID()); + aBase->selection(BuildPlugin_Interpolation::TANGENT_END_ID()); theDumper << anAttrStartTangent << ", " << anAttrEndTangent << ", "; } theDumper << closed() << ", " << reorder() << ")" << std::endl; } else { - theDumper << aBase << " = model.addInterpolation(" << aPartName ; + theDumper << aBase << " = model.addInterpolation(" << aPartName; AttributeStringPtr XtAttr = xt(); std::string xt = XtAttr->value(); AttributeStringPtr YtAttr = yt(); @@ -173,62 +165,50 @@ void BuildAPI_Interpolation::dump(ModelHighAPI_Dumper& theDumper) const AttributeIntegerPtr nbStepAttr = numstep(); int nbStep = nbStepAttr->value(); - theDumper<< ", \"" << xt << "\", \"" << yt << "\", \""<< zt<< "\", " ; - theDumper << mint << ", " << maxt << ", "<< nbStep<< ")"<& thePart, - const std::list& theBaseObjects, - const bool theIsClosed, - const bool theIsToReorder) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Interpolation::ID()); - return InterpolationPtr(new BuildAPI_Interpolation(aFeature, - theBaseObjects, - theIsClosed, - theIsToReorder)); +InterpolationPtr +addInterpolation(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theIsClosed, const bool theIsToReorder) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Interpolation::ID()); + return InterpolationPtr(new BuildAPI_Interpolation( + aFeature, theBaseObjects, theIsClosed, theIsToReorder)); } //================================================================================================== -InterpolationPtr addInterpolation(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theStartTangent, - const ModelHighAPI_Selection& theEndTangent, - const bool theIsClosed, - const bool theIsToReorder) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Interpolation::ID()); - return InterpolationPtr(new BuildAPI_Interpolation(aFeature, - theBaseObjects, - theStartTangent, - theEndTangent, - theIsClosed, - theIsToReorder)); +InterpolationPtr +addInterpolation(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theStartTangent, + const ModelHighAPI_Selection &theEndTangent, + const bool theIsClosed, const bool theIsToReorder) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Interpolation::ID()); + return InterpolationPtr( + new BuildAPI_Interpolation(aFeature, theBaseObjects, theStartTangent, + theEndTangent, theIsClosed, theIsToReorder)); } -InterpolationPtr addInterpolation(const std::shared_ptr& thePart, - const std::string & theXTexpression, - const std::string & theYTexpression, - const std::string & theZTexpression, - const ModelHighAPI_Double& theMinT, - const ModelHighAPI_Double& theMaxT, - const ModelHighAPI_Integer& theNbStep) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Interpolation::ID()); - return InterpolationPtr(new BuildAPI_Interpolation(aFeature, - theXTexpression, - theYTexpression, - theZTexpression, - theMinT, - theMaxT, - theNbStep)); +InterpolationPtr addInterpolation( + const std::shared_ptr &thePart, + const std::string &theXTexpression, const std::string &theYTexpression, + const std::string &theZTexpression, const ModelHighAPI_Double &theMinT, + const ModelHighAPI_Double &theMaxT, const ModelHighAPI_Integer &theNbStep) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Interpolation::ID()); + return InterpolationPtr( + new BuildAPI_Interpolation(aFeature, theXTexpression, theYTexpression, + theZTexpression, theMinT, theMaxT, theNbStep)); } //================================================================================================== -void BuildAPI_Interpolation::execIfBaseNotEmpty() -{ +void BuildAPI_Interpolation::execIfBaseNotEmpty() { if (baseObjects()->size() > 0) execute(); } diff --git a/src/BuildAPI/BuildAPI_Interpolation.h b/src/BuildAPI/BuildAPI_Interpolation.h index 3a131810f..b35d89a0b 100644 --- a/src/BuildAPI/BuildAPI_Interpolation.h +++ b/src/BuildAPI/BuildAPI_Interpolation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Interpolation_H_ @@ -35,72 +36,71 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Interpolation /// \ingroup CPPHighAPI /// \brief Interface for Interpolation feature. -class BuildAPI_Interpolation : public ModelHighAPI_Interface -{ +class BuildAPI_Interpolation : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Interpolation(const FeaturePtr& theFeature); + explicit BuildAPI_Interpolation(const FeaturePtr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Interpolation(const FeaturePtr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theStartTangent, - const ModelHighAPI_Selection& theEndTangent, - const bool theIsClosed, const bool theIsToReorder); + explicit BuildAPI_Interpolation( + const FeaturePtr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theStartTangent, + const ModelHighAPI_Selection &theEndTangent, const bool theIsClosed, + const bool theIsToReorder); /// Constructor with base objects, closed and reorder parameters. BUILDAPI_EXPORT - explicit BuildAPI_Interpolation(const FeaturePtr& theFeature, - const std::list& theBaseObjects, - const bool theIsClosed, const bool theIsToReorder); + explicit BuildAPI_Interpolation( + const FeaturePtr &theFeature, + const std::list &theBaseObjects, + const bool theIsClosed, const bool theIsToReorder); /// Constructor with expression analytical of X,Y andZ BUILDAPI_EXPORT - explicit BuildAPI_Interpolation(const FeaturePtr& theFeature, - const std::string & theXTexpression, - const std::string & theYTexpression, - const std::string & theZTexpression, - const ModelHighAPI_Double& theMinT, - const ModelHighAPI_Double& theMaxT, - const ModelHighAPI_Integer& theNbStep); + explicit BuildAPI_Interpolation(const FeaturePtr &theFeature, + const std::string &theXTexpression, + const std::string &theYTexpression, + const std::string &theZTexpression, + const ModelHighAPI_Double &theMinT, + const ModelHighAPI_Double &theMaxT, + const ModelHighAPI_Integer &theNbStep); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Interpolation(); - INTERFACE_13(BuildPlugin_Interpolation::ID(), - baseObjects, BuildPlugin_Interpolation::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - closed, BuildPlugin_Interpolation::CLOSED_ID(), - ModelAPI_AttributeBoolean, /** Closed flag */, - reorder, BuildPlugin_Interpolation::REORDER_ID(), - ModelAPI_AttributeBoolean, /** Reorder flag */, - useTangents, BuildPlugin_Interpolation::USE_TANGENTS_ID(), - ModelAPI_AttributeString, /** Use tangents flag */, - startTangent, BuildPlugin_Interpolation::TANGENT_START_ID(), - ModelAPI_AttributeSelection, /** Start point tangent */, - endTangent, BuildPlugin_Interpolation::TANGENT_END_ID(), - ModelAPI_AttributeSelection, /** End point tangent */, - xt, BuildPlugin_Interpolation::XT_ID(), - ModelAPI_AttributeString, /** xt expression*/, - yt, BuildPlugin_Interpolation::YT_ID(), - ModelAPI_AttributeString, /** yt expression*/, - zt, BuildPlugin_Interpolation::ZT_ID(), - ModelAPI_AttributeString, /** zt expression*/, - mint, BuildPlugin_Interpolation::MINT_ID(), - ModelAPI_AttributeDouble, /** Min*/, - maxt, BuildPlugin_Interpolation::MAXT_ID(), - ModelAPI_AttributeDouble, /** Max*/, - numstep, BuildPlugin_Interpolation::NUMSTEP_ID(), - ModelAPI_AttributeInteger, /** Number of steps*/, - creationmethod, BuildPlugin_Interpolation::CREATION_METHOD_ID(), - ModelAPI_AttributeString, /** Creation method*/) + INTERFACE_13(BuildPlugin_Interpolation::ID(), baseObjects, + BuildPlugin_Interpolation::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, closed, + BuildPlugin_Interpolation::CLOSED_ID(), + ModelAPI_AttributeBoolean, /** Closed flag */, reorder, + BuildPlugin_Interpolation::REORDER_ID(), + ModelAPI_AttributeBoolean, /** Reorder flag */, useTangents, + BuildPlugin_Interpolation::USE_TANGENTS_ID(), + ModelAPI_AttributeString, /** Use tangents flag */, startTangent, + BuildPlugin_Interpolation::TANGENT_START_ID(), + ModelAPI_AttributeSelection, /** Start point tangent */, + endTangent, BuildPlugin_Interpolation::TANGENT_END_ID(), + ModelAPI_AttributeSelection, /** End point tangent */, xt, + BuildPlugin_Interpolation::XT_ID(), ModelAPI_AttributeString, + /** xt expression*/, yt, BuildPlugin_Interpolation::YT_ID(), + ModelAPI_AttributeString, /** yt expression*/, zt, + BuildPlugin_Interpolation::ZT_ID(), ModelAPI_AttributeString, + /** zt expression*/, mint, BuildPlugin_Interpolation::MINT_ID(), + ModelAPI_AttributeDouble, /** Min*/, maxt, + BuildPlugin_Interpolation::MAXT_ID(), ModelAPI_AttributeDouble, + /** Max*/, numstep, BuildPlugin_Interpolation::NUMSTEP_ID(), + ModelAPI_AttributeInteger, /** Number of steps*/, creationmethod, + BuildPlugin_Interpolation::CREATION_METHOD_ID(), + ModelAPI_AttributeString, + /** Creation method*/) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Set closed flag BUILDAPI_EXPORT void setClosed(const bool theIsClosed); @@ -112,12 +112,13 @@ public: BUILDAPI_EXPORT void setUseTangents(const bool theIsToUseTangents); /// Set start and end tangents - BUILDAPI_EXPORT void setTangents(const ModelHighAPI_Selection& theStartTangent, - const ModelHighAPI_Selection& theEndTangent); + BUILDAPI_EXPORT void + setTangents(const ModelHighAPI_Selection &theStartTangent, + const ModelHighAPI_Selection &theEndTangent); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); @@ -129,30 +130,30 @@ typedef std::shared_ptr InterpolationPtr; /// \ingroup CPPHighAPI /// \brief Create Interpolation feature. BUILDAPI_EXPORT -InterpolationPtr addInterpolation(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const bool theIsClosed = false, - const bool theIsToReorder = false); +InterpolationPtr +addInterpolation(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theIsClosed = false, + const bool theIsToReorder = false); /// \ingroup CPPHighAPI /// \brief Create Interpolation feature using tangents. BUILDAPI_EXPORT -InterpolationPtr addInterpolation(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theStartTangent, - const ModelHighAPI_Selection& theEndTangent, - const bool theIsClosed = false, - const bool theIsToReorder = false); +InterpolationPtr +addInterpolation(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theStartTangent, + const ModelHighAPI_Selection &theEndTangent, + const bool theIsClosed = false, + const bool theIsToReorder = false); /// \ingroup CPPHighAPI /// \brief Create Interpolation feature using tangents. BUILDAPI_EXPORT -InterpolationPtr addInterpolation(const std::shared_ptr& thePart, - const std::string & theXTexpression, - const std::string & theYTexpression, - const std::string & theZTexpression, - const ModelHighAPI_Double& theMinT, - const ModelHighAPI_Double& theMaxT, - const ModelHighAPI_Integer& theNbStep); +InterpolationPtr addInterpolation( + const std::shared_ptr &thePart, + const std::string &theXTexpression, const std::string &theYTexpression, + const std::string &theZTexpression, const ModelHighAPI_Double &theMinT, + const ModelHighAPI_Double &theMaxT, const ModelHighAPI_Integer &theNbStep); #endif // BuildAPI_Interpolation_H_ diff --git a/src/BuildAPI/BuildAPI_Polyline.cpp b/src/BuildAPI/BuildAPI_Polyline.cpp index 6559f0bd9..94a2f71b1 100644 --- a/src/BuildAPI/BuildAPI_Polyline.cpp +++ b/src/BuildAPI/BuildAPI_Polyline.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Polyline.h" @@ -23,60 +24,57 @@ #include //================================================================================================== -BuildAPI_Polyline::BuildAPI_Polyline(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Polyline::BuildAPI_Polyline( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Polyline::BuildAPI_Polyline(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theIsClosed) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Polyline::BuildAPI_Polyline( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theIsClosed) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setClosed(theIsClosed); setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Polyline::~BuildAPI_Polyline() -{ - -} +BuildAPI_Polyline::~BuildAPI_Polyline() {} //================================================================================================== -void BuildAPI_Polyline::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Polyline::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Polyline::setClosed(const bool theIsClosed) -{ +void BuildAPI_Polyline::setClosed(const bool theIsClosed) { fillAttribute(theIsClosed, myclosed); } //================================================================================================== -void BuildAPI_Polyline::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Polyline::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addPolyline3D(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_Polyline::BASE_OBJECTS_ID()) << ", " - << closed() << ")" << std::endl; + << aBase->selectionList(BuildPlugin_Polyline::BASE_OBJECTS_ID()) + << ", " << closed() << ")" << std::endl; } //================================================================================================== -PolylinePtr addPolyline3D(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const bool theIsClosed) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Polyline::ID()); - return PolylinePtr(new BuildAPI_Polyline(aFeature, theBaseObjects, theIsClosed)); +PolylinePtr +addPolyline3D(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theIsClosed) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Polyline::ID()); + return PolylinePtr( + new BuildAPI_Polyline(aFeature, theBaseObjects, theIsClosed)); } diff --git a/src/BuildAPI/BuildAPI_Polyline.h b/src/BuildAPI/BuildAPI_Polyline.h index 94869d0c5..fbcc7f543 100644 --- a/src/BuildAPI/BuildAPI_Polyline.h +++ b/src/BuildAPI/BuildAPI_Polyline.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Polyline_H_ @@ -32,39 +33,40 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Polyline /// \ingroup CPPHighAPI /// \brief Interface for Polyline feature. -class BuildAPI_Polyline: public ModelHighAPI_Interface -{ +class BuildAPI_Polyline : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Polyline(const std::shared_ptr& theFeature); + explicit BuildAPI_Polyline( + const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Polyline(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theIsClosed); + explicit BuildAPI_Polyline( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theIsClosed); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Polyline(); - INTERFACE_2(BuildPlugin_Polyline::ID(), - baseObjects, BuildPlugin_Polyline::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - closed, BuildPlugin_Polyline::CLOSED_ID(), - ModelAPI_AttributeBoolean, /** Closed flag */) + INTERFACE_2(BuildPlugin_Polyline::ID(), baseObjects, + BuildPlugin_Polyline::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, closed, + BuildPlugin_Polyline::CLOSED_ID(), ModelAPI_AttributeBoolean, + /** Closed flag */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Set closed flag BUILDAPI_EXPORT void setClosed(const bool theIsClosed); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Polyline object. @@ -73,8 +75,9 @@ typedef std::shared_ptr PolylinePtr; /// \ingroup CPPHighAPI /// \brief Create Polyline feature. BUILDAPI_EXPORT -PolylinePtr addPolyline3D(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const bool theIsClosed = false); +PolylinePtr +addPolyline3D(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theIsClosed = false); #endif // BuildAPI_Polyline_H_ diff --git a/src/BuildAPI/BuildAPI_Shell.cpp b/src/BuildAPI/BuildAPI_Shell.cpp index eaa9d7852..293850685 100644 --- a/src/BuildAPI/BuildAPI_Shell.cpp +++ b/src/BuildAPI/BuildAPI_Shell.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Shell.h" @@ -23,50 +24,47 @@ #include //================================================================================================== -BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Shell::BuildAPI_Shell( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Shell::BuildAPI_Shell( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Shell::~BuildAPI_Shell() -{ - -} +BuildAPI_Shell::~BuildAPI_Shell() {} //================================================================================================== -void BuildAPI_Shell::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Shell::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Shell::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Shell::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addShell(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_Shell::BASE_OBJECTS_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_Shell::BASE_OBJECTS_ID()) << ")" + << std::endl; } //================================================================================================== -ShellPtr addShell(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Shell::ID()); +ShellPtr addShell(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Shell::ID()); return ShellPtr(new BuildAPI_Shell(aFeature, theBaseObjects)); } diff --git a/src/BuildAPI/BuildAPI_Shell.h b/src/BuildAPI/BuildAPI_Shell.h index 90a6343d4..74d16f089 100644 --- a/src/BuildAPI/BuildAPI_Shell.h +++ b/src/BuildAPI/BuildAPI_Shell.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Shell_H_ @@ -32,33 +33,34 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Shell /// \ingroup CPPHighAPI /// \brief Interface for Shell feature. -class BuildAPI_Shell: public ModelHighAPI_Interface -{ +class BuildAPI_Shell : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Shell(const std::shared_ptr& theFeature); + explicit BuildAPI_Shell(const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Shell(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_Shell( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Shell(); - INTERFACE_1(BuildPlugin_Shell::ID(), - baseObjects, BuildPlugin_Shell::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */) + INTERFACE_1(BuildPlugin_Shell::ID(), baseObjects, + BuildPlugin_Shell::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Shell object. @@ -67,7 +69,7 @@ typedef std::shared_ptr ShellPtr; /// \ingroup CPPHighAPI /// \brief Create Shell feature. BUILDAPI_EXPORT -ShellPtr addShell(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +ShellPtr addShell(const std::shared_ptr &thePart, + const std::list &theBaseObjects); #endif // BuildAPI_Shell_H_ diff --git a/src/BuildAPI/BuildAPI_Solid.cpp b/src/BuildAPI/BuildAPI_Solid.cpp index 4f3644e3f..0f7e59958 100644 --- a/src/BuildAPI/BuildAPI_Solid.cpp +++ b/src/BuildAPI/BuildAPI_Solid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Solid.h" @@ -23,48 +24,46 @@ #include //================================================================================================== -BuildAPI_Solid::BuildAPI_Solid(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Solid::BuildAPI_Solid( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Solid::BuildAPI_Solid(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Solid::BuildAPI_Solid( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Solid::~BuildAPI_Solid() -{ -} +BuildAPI_Solid::~BuildAPI_Solid() {} //================================================================================================== -void BuildAPI_Solid::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Solid::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Solid::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Solid::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addSolid(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_Solid::BASE_OBJECTS_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_Solid::BASE_OBJECTS_ID()) << ")" + << std::endl; } //================================================================================================== -SolidPtr addSolid(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Solid::ID()); +SolidPtr addSolid(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Solid::ID()); return SolidPtr(new BuildAPI_Solid(aFeature, theBaseObjects)); } diff --git a/src/BuildAPI/BuildAPI_Solid.h b/src/BuildAPI/BuildAPI_Solid.h index 3020699a7..deb753de8 100644 --- a/src/BuildAPI/BuildAPI_Solid.h +++ b/src/BuildAPI/BuildAPI_Solid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Solid_H_ @@ -32,33 +33,34 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Solid /// \ingroup CPPHighAPI /// \brief Interface for Solid feature. -class BuildAPI_Solid: public ModelHighAPI_Interface -{ +class BuildAPI_Solid : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Solid(const std::shared_ptr& theFeature); + explicit BuildAPI_Solid(const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Solid(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_Solid( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Solid(); - INTERFACE_1(BuildPlugin_Solid::ID(), - baseObjects, BuildPlugin_Solid::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */) + INTERFACE_1(BuildPlugin_Solid::ID(), baseObjects, + BuildPlugin_Solid::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Solid object. @@ -67,7 +69,7 @@ typedef std::shared_ptr SolidPtr; /// \ingroup CPPHighAPI /// \brief Create Solid feature. BUILDAPI_EXPORT -SolidPtr addSolid(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +SolidPtr addSolid(const std::shared_ptr &thePart, + const std::list &theBaseObjects); #endif // BuildAPI_Solid_H_ diff --git a/src/BuildAPI/BuildAPI_SubShapes.cpp b/src/BuildAPI/BuildAPI_SubShapes.cpp index 06f2d3e8d..cb2ca933c 100644 --- a/src/BuildAPI/BuildAPI_SubShapes.cpp +++ b/src/BuildAPI/BuildAPI_SubShapes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_SubShapes.h" @@ -23,62 +24,61 @@ #include //================================================================================================== -BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_SubShapes::BuildAPI_SubShapes( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBaseShape, - const std::list& theSubShapes) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_SubShapes::BuildAPI_SubShapes( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBaseShape, + const std::list &theSubShapes) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseShape, mybaseShape); setSubShapes(theSubShapes); } } //================================================================================================== -BuildAPI_SubShapes::~BuildAPI_SubShapes() -{ - -} +BuildAPI_SubShapes::~BuildAPI_SubShapes() {} //================================================================================================== -void BuildAPI_SubShapes::setBaseShape(const ModelHighAPI_Selection& theBaseShape) -{ +void BuildAPI_SubShapes::setBaseShape( + const ModelHighAPI_Selection &theBaseShape) { fillAttribute(theBaseShape, mybaseShape); execute(); } //================================================================================================== -void BuildAPI_SubShapes::setSubShapes(const std::list& theSubShapes) -{ +void BuildAPI_SubShapes::setSubShapes( + const std::list &theSubShapes) { fillAttribute(theSubShapes, mysubShapes); execute(); } //================================================================================================== -void BuildAPI_SubShapes::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_SubShapes::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addSubShapes(" << aPartName << ", " << aBase->selection(BuildPlugin_SubShapes::BASE_SHAPE_ID()) << ", " - << aBase->selectionList(BuildPlugin_SubShapes::SUBSHAPES_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_SubShapes::SUBSHAPES_ID()) + << ")" << std::endl; } //================================================================================================== -SubShapesPtr addSubShapes(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseShape, - const std::list& theSubShapes) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_SubShapes::ID()); - return SubShapesPtr(new BuildAPI_SubShapes(aFeature, theBaseShape, theSubShapes)); +SubShapesPtr +addSubShapes(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBaseShape, + const std::list &theSubShapes) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_SubShapes::ID()); + return SubShapesPtr( + new BuildAPI_SubShapes(aFeature, theBaseShape, theSubShapes)); } diff --git a/src/BuildAPI/BuildAPI_SubShapes.h b/src/BuildAPI/BuildAPI_SubShapes.h index 1c40045e7..ef81591bd 100644 --- a/src/BuildAPI/BuildAPI_SubShapes.h +++ b/src/BuildAPI/BuildAPI_SubShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_SubShapes_H_ @@ -32,40 +33,42 @@ class ModelHighAPI_Selection; /// \class BuildAPI_SubShapes /// \ingroup CPPHighAPI /// \brief Interface for SubShapes feature. -class BuildAPI_SubShapes: public ModelHighAPI_Interface -{ +class BuildAPI_SubShapes : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_SubShapes(const std::shared_ptr& theFeature); + explicit BuildAPI_SubShapes( + const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_SubShapes(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBaseShape, - const std::list& theSubShapes); + explicit BuildAPI_SubShapes( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBaseShape, + const std::list &theSubShapes); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_SubShapes(); - INTERFACE_2(BuildPlugin_SubShapes::ID(), - baseShape, BuildPlugin_SubShapes::BASE_SHAPE_ID(), - ModelAPI_AttributeSelection, /** Base shape */, - subShapes, BuildPlugin_SubShapes::SUBSHAPES_ID(), - ModelAPI_AttributeSelectionList, /** Sub-shapes */) + INTERFACE_2(BuildPlugin_SubShapes::ID(), baseShape, + BuildPlugin_SubShapes::BASE_SHAPE_ID(), + ModelAPI_AttributeSelection, /** Base shape */, subShapes, + BuildPlugin_SubShapes::SUBSHAPES_ID(), + ModelAPI_AttributeSelectionList, + /** Sub-shapes */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBaseShape(const ModelHighAPI_Selection& theBaseShape); + void setBaseShape(const ModelHighAPI_Selection &theBaseShape); /// Modify sub-shapes attribute of the feature. BUILDAPI_EXPORT - void setSubShapes(const std::list& theSubShapes); + void setSubShapes(const std::list &theSubShapes); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on SubShapes object. @@ -74,8 +77,9 @@ typedef std::shared_ptr SubShapesPtr; /// \ingroup CPPHighAPI /// \brief Create SubShapes feature. BUILDAPI_EXPORT -SubShapesPtr addSubShapes(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseShape, - const std::list& theSubShapes); +SubShapesPtr +addSubShapes(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBaseShape, + const std::list &theSubShapes); #endif // BuildAPI_SubShapes_H_ diff --git a/src/BuildAPI/BuildAPI_Vertex.cpp b/src/BuildAPI/BuildAPI_Vertex.cpp index 2c1b3a5b6..3367f0f48 100644 --- a/src/BuildAPI/BuildAPI_Vertex.cpp +++ b/src/BuildAPI/BuildAPI_Vertex.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Vertex.h" @@ -23,73 +24,71 @@ #include //================================================================================================== -BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Vertex::BuildAPI_Vertex( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr& theFeature, - const std::list& theBaseObjects) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Vertex::BuildAPI_Vertex( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(false, mydoIntersect); setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theDoIntersect) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Vertex::BuildAPI_Vertex( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theDoIntersect) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theDoIntersect, mydoIntersect); setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Vertex::~BuildAPI_Vertex() -{ - -} +BuildAPI_Vertex::~BuildAPI_Vertex() {} //================================================================================================== -void BuildAPI_Vertex::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Vertex::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -VertexPtr addVertex(const std::shared_ptr& thePart, - const std::list& theBaseObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Vertex::ID()); +VertexPtr addVertex(const std::shared_ptr &thePart, + const std::list &theBaseObjects) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Vertex::ID()); return VertexPtr(new BuildAPI_Vertex(aFeature, theBaseObjects)); } //================================================================================================== -VertexPtr addVertex(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const bool theDoIntersect) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Vertex::ID()); - return VertexPtr(new BuildAPI_Vertex(aFeature, theBaseObjects, theDoIntersect)); +VertexPtr addVertex(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theDoIntersect) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Vertex::ID()); + return VertexPtr( + new BuildAPI_Vertex(aFeature, theBaseObjects, theDoIntersect)); } //================================================================================================== -void BuildAPI_Vertex::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Vertex::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addVertex(" << aPartName << ", " - << aBase->selectionList(BuildPlugin_Vertex::BASE_OBJECTS_ID()) << ", " - << aBase->boolean(BuildPlugin_Vertex::INTERSECT_ID()) << ")" << std::endl; + << aBase->selectionList(BuildPlugin_Vertex::BASE_OBJECTS_ID()) + << ", " << aBase->boolean(BuildPlugin_Vertex::INTERSECT_ID()) << ")" + << std::endl; } diff --git a/src/BuildAPI/BuildAPI_Vertex.h b/src/BuildAPI/BuildAPI_Vertex.h index b73d3ee3b..9e8096ad3 100644 --- a/src/BuildAPI/BuildAPI_Vertex.h +++ b/src/BuildAPI/BuildAPI_Vertex.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Vertex_H_ @@ -32,41 +33,42 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Vertex /// \ingroup CPPHighAPI /// \brief Interface for Vertex feature. -class BuildAPI_Vertex: public ModelHighAPI_Interface -{ +class BuildAPI_Vertex : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Vertex(const std::shared_ptr& theFeature); + explicit BuildAPI_Vertex(const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Vertex(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit BuildAPI_Vertex( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Vertex(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theDoIntersect); + explicit BuildAPI_Vertex( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theDoIntersect); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Vertex(); - INTERFACE_2(BuildPlugin_Vertex::ID(), - baseObjects, BuildPlugin_Vertex::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - doIntersect, BuildPlugin_Vertex::INTERSECT_ID(), - ModelAPI_AttributeBoolean, /** Compute intersections */) + INTERFACE_2(BuildPlugin_Vertex::ID(), baseObjects, + BuildPlugin_Vertex::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, doIntersect, + BuildPlugin_Vertex::INTERSECT_ID(), ModelAPI_AttributeBoolean, + /** Compute intersections */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Vertex object. @@ -75,14 +77,14 @@ typedef std::shared_ptr VertexPtr; /// \ingroup CPPHighAPI /// \brief Create Vertex feature. BUILDAPI_EXPORT -VertexPtr addVertex(const std::shared_ptr& thePart, - const std::list& theBaseObjects); +VertexPtr addVertex(const std::shared_ptr &thePart, + const std::list &theBaseObjects); /// \ingroup CPPHighAPI /// \brief Create Vertex feature. BUILDAPI_EXPORT -VertexPtr addVertex(const std::shared_ptr& thePart, - const std::list& theBaseObjects, +VertexPtr addVertex(const std::shared_ptr &thePart, + const std::list &theBaseObjects, const bool theDoIntersect); #endif // BuildAPI_Vertex_H_ diff --git a/src/BuildAPI/BuildAPI_Wire.cpp b/src/BuildAPI/BuildAPI_Wire.cpp index 043a08ec5..e8c0f6052 100644 --- a/src/BuildAPI/BuildAPI_Wire.cpp +++ b/src/BuildAPI/BuildAPI_Wire.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildAPI_Wire.h" @@ -23,48 +24,45 @@ #include //================================================================================================== -BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +BuildAPI_Wire::BuildAPI_Wire( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theComputeIntersections) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +BuildAPI_Wire::BuildAPI_Wire( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theComputeIntersections) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theComputeIntersections, mycomputeIntersections); setBase(theBaseObjects); } } //================================================================================================== -BuildAPI_Wire::~BuildAPI_Wire() -{ - -} +BuildAPI_Wire::~BuildAPI_Wire() {} //================================================================================================== -void BuildAPI_Wire::setBase(const std::list& theBaseObjects) -{ +void BuildAPI_Wire::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void BuildAPI_Wire::dump(ModelHighAPI_Dumper& theDumper) const -{ +void BuildAPI_Wire::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addWire(" << aPartName << ", " << aBase->selectionList(BuildPlugin_Wire::BASE_OBJECTS_ID()); - AttributeBooleanPtr isIntersect = aBase->boolean(BuildPlugin_Wire::INTERSECT_ID()); + AttributeBooleanPtr isIntersect = + aBase->boolean(BuildPlugin_Wire::INTERSECT_ID()); if (isIntersect->isInitialized()) theDumper << ", " << isIntersect; @@ -72,16 +70,16 @@ void BuildAPI_Wire::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -void BuildAPI_Wire::addContour() -{ +void BuildAPI_Wire::addContour() { feature()->customAction(BuildPlugin_Wire::ADD_CONTOUR_ACTION_ID()); } //================================================================================================== -WirePtr addWire(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const bool theComputeIntersections) -{ - std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Wire::ID()); - return WirePtr(new BuildAPI_Wire(aFeature, theBaseObjects, theComputeIntersections)); +WirePtr addWire(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const bool theComputeIntersections) { + std::shared_ptr aFeature = + thePart->addFeature(BuildAPI_Wire::ID()); + return WirePtr( + new BuildAPI_Wire(aFeature, theBaseObjects, theComputeIntersections)); } diff --git a/src/BuildAPI/BuildAPI_Wire.h b/src/BuildAPI/BuildAPI_Wire.h index 9d416d1ea..d992ba8ce 100644 --- a/src/BuildAPI/BuildAPI_Wire.h +++ b/src/BuildAPI/BuildAPI_Wire.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildAPI_Wire_H_ @@ -32,32 +33,33 @@ class ModelHighAPI_Selection; /// \class BuildAPI_Wire /// \ingroup CPPHighAPI /// \brief Interface for Wire feature. -class BuildAPI_Wire: public ModelHighAPI_Interface -{ +class BuildAPI_Wire : public ModelHighAPI_Interface { public: /// Constructor without values. BUILDAPI_EXPORT - explicit BuildAPI_Wire(const std::shared_ptr& theFeature); + explicit BuildAPI_Wire(const std::shared_ptr &theFeature); /// Constructor with values. BUILDAPI_EXPORT - explicit BuildAPI_Wire(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool theComputeIntersections = false); + explicit BuildAPI_Wire( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool theComputeIntersections = false); /// Destructor. BUILDAPI_EXPORT virtual ~BuildAPI_Wire(); - INTERFACE_2(BuildPlugin_Wire::ID(), - baseObjects, BuildPlugin_Wire::BASE_OBJECTS_ID(), + INTERFACE_2(BuildPlugin_Wire::ID(), baseObjects, + BuildPlugin_Wire::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */, computeIntersections, BuildPlugin_Wire::INTERSECT_ID(), - ModelAPI_AttributeBoolean, /** Intersect edges */) + ModelAPI_AttributeBoolean, + /** Intersect edges */) /// Modify base attribute of the feature. BUILDAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Adds closed contour. BUILDAPI_EXPORT @@ -65,7 +67,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Wire object. @@ -74,8 +76,8 @@ typedef std::shared_ptr WirePtr; /// \ingroup CPPHighAPI /// \brief Create Wire feature. BUILDAPI_EXPORT -WirePtr addWire(const std::shared_ptr& thePart, - const std::list& theBaseObjects, +WirePtr addWire(const std::shared_ptr &thePart, + const std::list &theBaseObjects, const bool theComputeIntersections = false); #endif // BuildAPI_Wire_H_ diff --git a/src/BuildAPI/BuildAPI_swig.h b/src/BuildAPI/BuildAPI_swig.h index b5171b537..517a71cd1 100644 --- a/src/BuildAPI/BuildAPI_swig.h +++ b/src/BuildAPI/BuildAPI_swig.h @@ -14,25 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_swig_H_ #define FeaturesAPI_swig_H_ - #include +#include - #include "BuildAPI_Compound.h" - #include "BuildAPI_CompSolid.h" - #include "BuildAPI_Edge.h" - #include "BuildAPI_Face.h" - #include "BuildAPI_Filling.h" - #include "BuildAPI_Shell.h" - #include "BuildAPI_Solid.h" - #include "BuildAPI_SubShapes.h" - #include "BuildAPI_Vertex.h" - #include "BuildAPI_Wire.h" - #include "BuildAPI_Polyline.h" - #include "BuildAPI_Interpolation.h" +#include "BuildAPI_CompSolid.h" +#include "BuildAPI_Compound.h" +#include "BuildAPI_Edge.h" +#include "BuildAPI_Face.h" +#include "BuildAPI_Filling.h" +#include "BuildAPI_Interpolation.h" +#include "BuildAPI_Polyline.h" +#include "BuildAPI_Shell.h" +#include "BuildAPI_Solid.h" +#include "BuildAPI_SubShapes.h" +#include "BuildAPI_Vertex.h" +#include "BuildAPI_Wire.h" #endif // FeaturesAPI_swig_H_ diff --git a/src/BuildPlugin/BuildPlugin.h b/src/BuildPlugin/BuildPlugin.h index 044c7004c..60f7ee7ce 100644 --- a/src/BuildPlugin/BuildPlugin.h +++ b/src/BuildPlugin/BuildPlugin.h @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_H_ #define BuildPlugin_H_ #if defined BUILDPLUGIN_EXPORTS -# if defined WIN32 -# define BUILDPLUGIN_EXPORT __declspec( dllexport ) -# else -# define BUILDPLUGIN_EXPORT -# endif +#if defined WIN32 +#define BUILDPLUGIN_EXPORT __declspec(dllexport) #else -# if defined WIN32 -# define BUILDPLUGIN_EXPORT __declspec( dllimport ) -# else -# define BUILDPLUGIN_EXPORT -# endif +#define BUILDPLUGIN_EXPORT +#endif +#else +#if defined WIN32 +#define BUILDPLUGIN_EXPORT __declspec(dllimport) +#else +#define BUILDPLUGIN_EXPORT +#endif #endif #endif diff --git a/src/BuildPlugin/BuildPlugin_CompSolid.cpp b/src/BuildPlugin/BuildPlugin_CompSolid.cpp index 55c4bba13..7fa437b7c 100644 --- a/src/BuildPlugin/BuildPlugin_CompSolid.cpp +++ b/src/BuildPlugin/BuildPlugin_CompSolid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_CompSolid.h" @@ -23,12 +24,10 @@ #include //================================================================================================= -BuildPlugin_CompSolid::BuildPlugin_CompSolid() -{ -} +BuildPlugin_CompSolid::BuildPlugin_CompSolid() {} //================================================================================================= -void BuildPlugin_CompSolid::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_CompSolid::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/BuildPlugin/BuildPlugin_CompSolid.h b/src/BuildPlugin/BuildPlugin_CompSolid.h index cfd26b04d..8102355c7 100644 --- a/src/BuildPlugin/BuildPlugin_CompSolid.h +++ b/src/BuildPlugin/BuildPlugin_CompSolid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_CompSolid_H_ @@ -26,34 +27,31 @@ /// \class BuildPlugin_CompSolid /// \ingroup Plugins /// \brief Feature for creation of compsolid from solids or compsolids. -class BuildPlugin_CompSolid: public BuildPlugin_Solid -{ +class BuildPlugin_CompSolid : public BuildPlugin_Solid { public: /// Use plugin manager for features creation BuildPlugin_CompSolid(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("CompSolid"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_CompSolid::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); }; diff --git a/src/BuildPlugin/BuildPlugin_Compound.cpp b/src/BuildPlugin/BuildPlugin_Compound.cpp index dfded94ad..a2afd9361 100644 --- a/src/BuildPlugin/BuildPlugin_Compound.cpp +++ b/src/BuildPlugin/BuildPlugin_Compound.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Compound.h" @@ -22,31 +23,27 @@ #include #include -#include #include - +#include //================================================================================================= -BuildPlugin_Compound::BuildPlugin_Compound() -{ -} +BuildPlugin_Compound::BuildPlugin_Compound() {} //================================================================================================= -void BuildPlugin_Compound::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Compound::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); } //================================================================================================= -void BuildPlugin_Compound::execute() -{ +void BuildPlugin_Compound::execute() { // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); - if(!aSelectionList.get()) { + if (!aSelectionList.get()) { setError("Error: Could not get selection list."); return; } - if(aSelectionList->size() == 0) { + if (aSelectionList->size() == 0) { setError("Error: Empty selection list."); return; } @@ -67,16 +64,19 @@ void BuildPlugin_Compound::execute() } // Build compound. - GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(anOriginalShapes); + GeomShapePtr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(anOriginalShapes); // Copy shape. GeomMakeShapePtr aCopyAlgo(new GeomAlgoAPI_Copy(aCompound)); GeomShapePtr aCopyCompound = aCopyAlgo->shape(); int anIndexToRemove = 0; if (aCopyCompound) { - ResultBodyPtr aResultBody = document()->createBody(data(), anIndexToRemove++); + ResultBodyPtr aResultBody = + document()->createBody(data(), anIndexToRemove++); aResultBody->storeModified(anOriginalShapes, aCopyCompound, aCopyAlgo); - aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX); + aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, + GeomAPI_Shape::VERTEX); aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::EDGE); aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::FACE); setResult(aResultBody); diff --git a/src/BuildPlugin/BuildPlugin_Compound.h b/src/BuildPlugin/BuildPlugin_Compound.h index 7b59c69ce..6ebee72d1 100644 --- a/src/BuildPlugin/BuildPlugin_Compound.h +++ b/src/BuildPlugin/BuildPlugin_Compound.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Compound_H_ @@ -27,34 +28,31 @@ /// \class BuildPlugin_Compound /// \ingroup Plugins /// \brief Feature for creation of compound from different kinds of shapes. -class BuildPlugin_Compound: public ModelAPI_Feature -{ +class BuildPlugin_Compound : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_Compound(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Compound"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Compound::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. diff --git a/src/BuildPlugin/BuildPlugin_Edge.cpp b/src/BuildPlugin/BuildPlugin_Edge.cpp index 23a73626f..2468abe0e 100644 --- a/src/BuildPlugin/BuildPlugin_Edge.cpp +++ b/src/BuildPlugin/BuildPlugin_Edge.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Edge.h" @@ -38,9 +39,7 @@ #include static bool getShape(const AttributeSelectionPtr theAttribute, - GeomShapePtr& theShape, - std::string& theError) -{ + GeomShapePtr &theShape, std::string &theError) { theShape = theAttribute->value(); if (!theShape.get()) { ResultPtr aContext = theAttribute->context(); @@ -54,28 +53,27 @@ static bool getShape(const AttributeSelectionPtr theAttribute, } //================================================================================================= -BuildPlugin_Edge::BuildPlugin_Edge() -{ -} +BuildPlugin_Edge::BuildPlugin_Edge() {} //================================================================================================= -void BuildPlugin_Edge::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Edge::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_METHOD()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), CREATION_METHOD()); data()->addAttribute(FIRST_POINT(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(SECOND_POINT(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(INTERSECT_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), INTERSECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + INTERSECT_ID()); } //================================================================================================= -void BuildPlugin_Edge::execute() -{ +void BuildPlugin_Edge::execute() { AttributeStringPtr aCreationMethod = string(CREATION_METHOD()); if (aCreationMethod && aCreationMethod->isInitialized() && aCreationMethod->value() == CREATION_BY_POINTS()) @@ -85,17 +83,16 @@ void BuildPlugin_Edge::execute() } //================================================================================================= -void BuildPlugin_Edge::edgesBySegments() -{ +void BuildPlugin_Edge::edgesBySegments() { string(CREATION_METHOD())->setValue(CREATION_BY_SEGMENTS()); // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); - if(!aSelectionList.get()) { + if (!aSelectionList.get()) { setError("Error: Could not get selection list."); return; } - if(aSelectionList->size() == 0) { + if (aSelectionList->size() == 0) { setError("Error: Empty selection list."); return; } @@ -103,14 +100,14 @@ void BuildPlugin_Edge::edgesBySegments() // Collect base shapes. ListOfShape aListOfShapes; std::string aError; - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape; if (!getShape(aSelection, aShape, aError)) { setError(aError); return; } - if(!aShape.get()) { + if (!aShape.get()) { setError("Error: Empty shape selected."); return; } @@ -122,24 +119,26 @@ void BuildPlugin_Edge::edgesBySegments() GeomShapePtr aResult; std::shared_ptr aPartitionAlgo; if (isIntersect->isInitialized() && isIntersect->value()) { - aPartitionAlgo.reset(new GeomAlgoAPI_Partition(aListOfShapes, ListOfShape())); + aPartitionAlgo.reset( + new GeomAlgoAPI_Partition(aListOfShapes, ListOfShape())); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, + getKind(), anError)) { setError(anError); return; } aResult = aPartitionAlgo->shape(); - } - else + } else aResult = GeomAlgoAPI_CompoundBuilder::compound(aListOfShapes); int aResultIndex = 0; // Explode on edges std::set aProcessed; - for (GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { GeomShapePtr anEdge = anExp.current(); if (aProcessed.find(anEdge) != aProcessed.end()) continue; // vertex is already processed @@ -147,15 +146,18 @@ void BuildPlugin_Edge::edgesBySegments() std::shared_ptr aCopyAlgo(new GeomAlgoAPI_Copy(anEdge)); - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); if (aPartitionAlgo) aMakeShapeList->appendAlgo(aPartitionAlgo); aMakeShapeList->appendAlgo(aCopyAlgo); // Store result. ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - aResultBody->storeModified(aListOfShapes, aCopyAlgo->shape(), aMakeShapeList); - aResultBody->loadModifiedShapes(aMakeShapeList, anEdge, GeomAPI_Shape::VERTEX); + aResultBody->storeModified(aListOfShapes, aCopyAlgo->shape(), + aMakeShapeList); + aResultBody->loadModifiedShapes(aMakeShapeList, anEdge, + GeomAPI_Shape::VERTEX); setResult(aResultBody, aResultIndex); ++aResultIndex; } @@ -163,8 +165,7 @@ void BuildPlugin_Edge::edgesBySegments() removeResults(aResultIndex); } -void BuildPlugin_Edge::edgeByPoints() -{ +void BuildPlugin_Edge::edgeByPoints() { // Get base points. AttributeSelectionPtr aFirstPointAttr = selection(FIRST_POINT()); AttributeSelectionPtr aSecondPointAttr = selection(SECOND_POINT()); @@ -192,8 +193,8 @@ void BuildPlugin_Edge::edgeByPoints() int aResultIndex = 0; - GeomEdgePtr anEdge = GeomAlgoAPI_EdgeBuilder::line(aFirstShape->vertex()->point(), - aSecondShape->vertex()->point()); + GeomEdgePtr anEdge = GeomAlgoAPI_EdgeBuilder::line( + aFirstShape->vertex()->point(), aSecondShape->vertex()->point()); if (!anEdge.get()) { setError("Error: Algorithm failed."); return; diff --git a/src/BuildPlugin/BuildPlugin_Edge.h b/src/BuildPlugin/BuildPlugin_Edge.h index 8ef561792..a7827a18d 100644 --- a/src/BuildPlugin/BuildPlugin_Edge.h +++ b/src/BuildPlugin/BuildPlugin_Edge.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Edge_H_ @@ -27,76 +28,67 @@ /// \class BuildPlugin_Edge /// \ingroup Plugins /// \brief Feature for creation of edge from sketch edge or existing edges. -class BuildPlugin_Edge: public ModelAPI_Feature -{ +class BuildPlugin_Edge : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_Edge(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Edge"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Edge::ID(); return MY_KIND; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("creation_method"); return MY_CREATION_METHOD_ID; } /// Value for creation method. - inline static const std::string& CREATION_BY_SEGMENTS() - { + inline static const std::string &CREATION_BY_SEGMENTS() { static const std::string MY_CREATION_METHOD_ID("by_segments"); return MY_CREATION_METHOD_ID; } /// Value for creation method. - inline static const std::string& CREATION_BY_POINTS() - { + inline static const std::string &CREATION_BY_POINTS() { static const std::string MY_CREATION_METHOD_ID("by_points"); return MY_CREATION_METHOD_ID; } /// Attribute name for the first point. - inline static const std::string& FIRST_POINT() - { + inline static const std::string &FIRST_POINT() { static const std::string MY_FIRST_POINT_ID("first_point"); return MY_FIRST_POINT_ID; } /// Attribute name for the second point. - inline static const std::string& SECOND_POINT() - { + inline static const std::string &SECOND_POINT() { static const std::string MY_SECOND_POINT_ID("second_point"); return MY_SECOND_POINT_ID; } /// Attribute name of "Compute intersections" checkbox. - inline static const std::string& INTERSECT_ID() - { + inline static const std::string &INTERSECT_ID() { static const std::string MY_INTERSECT_ID("intersect"); return MY_INTERSECT_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. diff --git a/src/BuildPlugin/BuildPlugin_Face.cpp b/src/BuildPlugin/BuildPlugin_Face.cpp index bdad80062..74bd2d37d 100644 --- a/src/BuildPlugin/BuildPlugin_Face.cpp +++ b/src/BuildPlugin/BuildPlugin_Face.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Face.h" @@ -28,33 +29,30 @@ #include #include +#include #include +#include #include #include -#include -#include //================================================================================================= -BuildPlugin_Face::BuildPlugin_Face() -{ -} +BuildPlugin_Face::BuildPlugin_Face() {} //================================================================================================= -void BuildPlugin_Face::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Face::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); } //================================================================================================= -void BuildPlugin_Face::execute() -{ +void BuildPlugin_Face::execute() { // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); - if(!aSelectionList.get()) { + if (!aSelectionList.get()) { setError("Error: Could not get selection list."); return; } - if(aSelectionList->size() == 0) { + if (aSelectionList->size() == 0) { setError("Error: Empty selection list."); return; } @@ -68,23 +66,24 @@ void BuildPlugin_Face::execute() getOriginalShapesAndContexts(BASE_OBJECTS_ID(), anOriginalFaces, aContexts); anOriginalFaces.clear(); - std::list< std::shared_ptr > aListOfNormals; - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + std::list> aListOfNormals; + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); GeomShapePtr aContext = aSelection->context()->shape(); - if(!aShape.get()) { + if (!aShape.get()) { aShape = aContext; } if (aShape->shapeType() == GeomAPI_Shape::FACE) { // keep selected faces "as is" anOriginalFaces.push_back(aShape); continue; - } - else if (!aSelection->value() && aShape->shapeType() == GeomAPI_Shape::COMPOUND) { + } else if (!aSelection->value() && + aShape->shapeType() == GeomAPI_Shape::COMPOUND) { // collect faces from the sketch ResultConstructionPtr aSketch = - std::dynamic_pointer_cast(aSelection->context()); + std::dynamic_pointer_cast( + aSelection->context()); if (aSketch && aSketch->facesNum() > 0) { for (int i = 0; i < aSketch->facesNum(); ++i) anOriginalFaces.push_back(aSketch->face(i)); @@ -92,7 +91,8 @@ void BuildPlugin_Face::execute() } } - // check whether the context is a sketch, in this case store its normal for further needs + // check whether the context is a sketch, in this case store its normal for + // further needs std::shared_ptr aSketch = std::dynamic_pointer_cast(aContext); if (aSketch) @@ -100,33 +100,35 @@ void BuildPlugin_Face::execute() bool isPlanar(aShape->isPlanar() || aSketch); - for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { GeomShapePtr anEdge = anExp.current(); anAllEdges.push_back(anEdge); - isPlanar? aPlanarEdges.push_back(anEdge) : aNonPlanarEdges.push_back(anEdge); + isPlanar ? aPlanarEdges.push_back(anEdge) + : aNonPlanarEdges.push_back(anEdge); } } bool isAllPlanar(false); - if(!anAllEdges.empty()) - { - //check if all the object actually belong to one plane. - std::shared_ptr aPln = GeomAlgoAPI_ShapeTools::findPlane(anAllEdges); - if(aPln.get() && !aNonPlanarEdges.empty()) - { - aPlanarEdges.insert(aPlanarEdges.end(), aNonPlanarEdges.begin(), aNonPlanarEdges.end()); + if (!anAllEdges.empty()) { + // check if all the object actually belong to one plane. + std::shared_ptr aPln = + GeomAlgoAPI_ShapeTools::findPlane(anAllEdges); + if (aPln.get() && !aNonPlanarEdges.empty()) { + aPlanarEdges.insert(aPlanarEdges.end(), aNonPlanarEdges.begin(), + aNonPlanarEdges.end()); aNonPlanarEdges.clear(); isAllPlanar = true; } } - if (!isAllPlanar && !aPlanarEdges.empty()) - { - //check is planar objects belong to one plane - std::shared_ptr aPln = GeomAlgoAPI_ShapeTools::findPlane(aPlanarEdges); - if(!aPln.get()) - { - aNonPlanarEdges.insert(aNonPlanarEdges.end(), aPlanarEdges.begin(), aPlanarEdges.end()); + if (!isAllPlanar && !aPlanarEdges.empty()) { + // check is planar objects belong to one plane + std::shared_ptr aPln = + GeomAlgoAPI_ShapeTools::findPlane(aPlanarEdges); + if (!aPln.get()) { + aNonPlanarEdges.insert(aNonPlanarEdges.end(), aPlanarEdges.begin(), + aPlanarEdges.end()); aPlanarEdges.clear(); } } @@ -141,10 +143,10 @@ void BuildPlugin_Face::execute() // Build non-planar faces by edges. GeomMakeShapePtr aNonPlanarFaceBuilder; int aNbNonPlanarFaces = (int)aFaces.size(); - if(!aNonPlanarEdges.empty()) - { + if (!aNonPlanarEdges.empty()) { ListOfShape aNonPlanarFaces; - buildNonPlanarFacesByEdges(aNonPlanarEdges, aNonPlanarFaces, aNonPlanarFaceBuilder); + buildNonPlanarFacesByEdges(aNonPlanarEdges, aNonPlanarFaces, + aNonPlanarFaceBuilder); // Add non-planar faces to common faces list. aFaces.insert(aFaces.end(), aNonPlanarFaces.begin(), aNonPlanarFaces.end()); aNbNonPlanarFaces += (int)aNonPlanarFaces.size(); @@ -155,11 +157,13 @@ void BuildPlugin_Face::execute() // Store result. int anIndex = 0; - for(ListOfShape::const_iterator anIt = aFaces.cbegin(); anIt != aFaces.cend(); ++anIt) { - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + for (ListOfShape::const_iterator anIt = aFaces.cbegin(); + anIt != aFaces.cend(); ++anIt) { + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); if (anIndex < aNbFacesFromEdges) aMakeShapeList->appendAlgo(aFaceBuilder); - else if(anIndex < aNbNonPlanarFaces) + else if (anIndex < aNbNonPlanarFaces) aMakeShapeList->appendAlgo(aNonPlanarFaceBuilder); GeomShapePtr aShape = *anIt; @@ -169,11 +173,12 @@ void BuildPlugin_Face::execute() ListOfShape aBaseShapes; if (anIndex < aNbFacesFromEdges) aBaseShapes = aPlanarEdges; - else if(anIndex < aNbNonPlanarFaces) + else if (anIndex < aNbNonPlanarFaces) aBaseShapes = aNonPlanarEdges; else aBaseShapes.push_back(aShape); - storeResult(aMakeShapeList, aBaseShapes, aContexts, aCopy->shape(), anIndex++); + storeResult(aMakeShapeList, aBaseShapes, aContexts, aCopy->shape(), + anIndex++); } removeResults(anIndex); @@ -181,22 +186,24 @@ void BuildPlugin_Face::execute() //================================================================================================== void BuildPlugin_Face::buildFacesByEdges( - const ListOfShape& theEdges, - const std::list< std::shared_ptr >& theNormals, - ListOfShape& theFaces, - std::shared_ptr& theBuilderAlgo) const -{ + const ListOfShape &theEdges, + const std::list> &theNormals, + ListOfShape &theFaces, + std::shared_ptr &theBuilderAlgo) const { // Get plane. - std::shared_ptr aPln = GeomAlgoAPI_ShapeTools::findPlane(theEdges); + std::shared_ptr aPln = + GeomAlgoAPI_ShapeTools::findPlane(theEdges); std::shared_ptr aNormal = aPln->direction(); bool isReverse = !theNormals.empty(); - std::list< std::shared_ptr >::const_iterator aNormIt = theNormals.begin(); + std::list>::const_iterator aNormIt = + theNormals.begin(); for (; aNormIt != theNormals.end() && isReverse; ++aNormIt) if ((*aNormIt)->dot(aNormal) > 1.e-7) isReverse = false; if (isReverse) { aNormal->reverse(); - aPln = std::shared_ptr(new GeomAPI_Pln(aPln->location(), aNormal)); + aPln = std::shared_ptr( + new GeomAPI_Pln(aPln->location(), aNormal)); } // Get faces. @@ -207,26 +214,24 @@ void BuildPlugin_Face::buildFacesByEdges( // Get wires from faces. ListOfShape aWires; - for(ListOfShape::const_iterator anIt = theFaces.cbegin(); anIt != theFaces.cend(); ++anIt) + for (ListOfShape::const_iterator anIt = theFaces.cbegin(); + anIt != theFaces.cend(); ++anIt) aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(*anIt)); // Make faces with holes. theFaces.clear(); - GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aPln->location(), aPln->direction(), - aWires, theFaces); + GeomAlgoAPI_ShapeTools::makeFacesWithHoles( + aPln->location(), aPln->direction(), aWires, theFaces); } //================================================================================================== void BuildPlugin_Face::buildNonPlanarFacesByEdges( - const ListOfShape& theShapes, - ListOfShape& theFaces, - std::shared_ptr& theBuilderAlgo) const -{ - - // Get faces. - std::shared_ptr aNonPlanarFaceBuilder - (new GeomAlgoAPI_NonPlanarFace(theShapes)); - theFaces = aNonPlanarFaceBuilder->faces(); - theBuilderAlgo = aNonPlanarFaceBuilder; + const ListOfShape &theShapes, ListOfShape &theFaces, + std::shared_ptr &theBuilderAlgo) const { + // Get faces. + std::shared_ptr aNonPlanarFaceBuilder( + new GeomAlgoAPI_NonPlanarFace(theShapes)); + theFaces = aNonPlanarFaceBuilder->faces(); + theBuilderAlgo = aNonPlanarFaceBuilder; } diff --git a/src/BuildPlugin/BuildPlugin_Face.h b/src/BuildPlugin/BuildPlugin_Face.h index 4653845f7..ff7f70411 100644 --- a/src/BuildPlugin/BuildPlugin_Face.h +++ b/src/BuildPlugin/BuildPlugin_Face.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Face_H_ @@ -30,34 +31,31 @@ class GeomAlgoAPI_MakeShape; /// \class BuildPlugin_Face /// \ingroup Plugins /// \brief Feature for creation of face from sketch edges or existing wires. -class BuildPlugin_Face: public BuildPlugin_Shape -{ +class BuildPlugin_Face : public BuildPlugin_Shape { public: /// Use plugin manager for features creation BuildPlugin_Face(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Face"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Face::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. @@ -65,14 +63,15 @@ public: private: /// Create faces basing on the list of edges - void buildFacesByEdges(const std::list< std::shared_ptr >& theEdges, - const std::list< std::shared_ptr >& theNormals, - std::list< std::shared_ptr >& theFaces, - std::shared_ptr& theBuilderAlgo) const; + void buildFacesByEdges( + const std::list> &theEdges, + const std::list> &theNormals, + std::list> &theFaces, + std::shared_ptr &theBuilderAlgo) const; - void buildNonPlanarFacesByEdges(const ListOfShape& theShapes, - ListOfShape& theFaces, - std::shared_ptr& theBuilderAlgo) const; + void buildNonPlanarFacesByEdges( + const ListOfShape &theShapes, ListOfShape &theFaces, + std::shared_ptr &theBuilderAlgo) const; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Filling.cpp b/src/BuildPlugin/BuildPlugin_Filling.cpp index 40a7f495c..b34546670 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.cpp +++ b/src/BuildPlugin/BuildPlugin_Filling.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Filling.h" @@ -40,8 +41,7 @@ #include -struct FillingParameters -{ +struct FillingParameters { std::string method; int minDegree; int maxDegree; @@ -51,30 +51,30 @@ struct FillingParameters bool isApprox; }; -static bool isReverseClosedCurve(const GeomEdgePtr& theEdge1, - const GeomEdgePtr& theEdge2); -static bool isReverseOpenedCurve(const GeomEdgePtr& theEdge1, - const GeomEdgePtr& theEdge2, +static bool isReverseClosedCurve(const GeomEdgePtr &theEdge1, + const GeomEdgePtr &theEdge2); +static bool isReverseOpenedCurve(const GeomEdgePtr &theEdge1, + const GeomEdgePtr &theEdge2, const double theTolerance); -static void shiftStartPoint(GeomWirePtr& theWire, - const GeomEdgePtr& theRefEdge, +static void shiftStartPoint(GeomWirePtr &theWire, const GeomEdgePtr &theRefEdge, const double theTolerance); - //================================================================================================= -BuildPlugin_Filling::BuildPlugin_Filling() -{ -} +BuildPlugin_Filling::BuildPlugin_Filling() {} //================================================================================================= -void BuildPlugin_Filling::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(ADVANCED_OPTIONS_ID(), ModelAPI_AttributeString::typeId()); +void BuildPlugin_Filling::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(ADVANCED_OPTIONS_ID(), + ModelAPI_AttributeString::typeId()); data()->addAttribute(METHOD_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(MINIMAL_DEGREE_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(MAXIMAL_DEGREE_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(NUMBER_OF_ITERATIONS_ID(), ModelAPI_AttributeInteger::typeId()); + data()->addAttribute(MINIMAL_DEGREE_ID(), + ModelAPI_AttributeInteger::typeId()); + data()->addAttribute(MAXIMAL_DEGREE_ID(), + ModelAPI_AttributeInteger::typeId()); + data()->addAttribute(NUMBER_OF_ITERATIONS_ID(), + ModelAPI_AttributeInteger::typeId()); data()->addAttribute(TOLERANCE_2D_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(TOLERANCE_3D_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(APPROXIMATION_ID(), ModelAPI_AttributeBoolean::typeId()); @@ -84,8 +84,7 @@ void BuildPlugin_Filling::initAttributes() } //================================================================================================= -void BuildPlugin_Filling::execute() -{ +void BuildPlugin_Filling::execute() { // get parameters of algorithm FillingParameters aParameters; aParameters.method = string(METHOD_ID())->value(); @@ -101,9 +100,9 @@ void BuildPlugin_Filling::execute() return; } - std::shared_ptr aFilling( - new GeomAlgoAPI_Filling(aParameters.minDegree, aParameters.maxDegree, aParameters.nbIter, - aParameters.tol2D, aParameters.tol3D)); + std::shared_ptr aFilling(new GeomAlgoAPI_Filling( + aParameters.minDegree, aParameters.maxDegree, aParameters.nbIter, + aParameters.tol2D, aParameters.tol3D)); // get base objects list AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); @@ -113,7 +112,7 @@ void BuildPlugin_Filling::execute() } // collect base shapes - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomEdgePtr anEdge = toEdge(aSelection->value(), aParameters.method); if (!anEdge) @@ -125,7 +124,8 @@ void BuildPlugin_Filling::execute() // build result aFilling->build(aParameters.isApprox); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilling, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilling, getKind(), + anError)) { setError(anError); removeResults(0); return; @@ -137,25 +137,28 @@ void BuildPlugin_Filling::execute() aResultBody->store(aCreatedFace); // store edges int anEdgeInd = 0; - for(GeomAPI_ShapeExplorer anExp(aCreatedFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aCreatedFace, GeomAPI_Shape::EDGE); + anExp.more(); anExp.next()) { GeomShapePtr anEdge = anExp.current(); - aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd)); + aResultBody->generated(anEdge, + "Edge_" + std::to_string((long long)anEdgeInd)); } setResult(aResultBody, 0); } //================================================================================================= -void BuildPlugin_Filling::attributeChanged(const std::string& theID) -{ - if (theID == ADVANCED_OPTIONS_ID() && string(ADVANCED_OPTIONS_ID())->value().empty()) { - // Advanced options flag just unchecked => restore default state of all parameters +void BuildPlugin_Filling::attributeChanged(const std::string &theID) { + if (theID == ADVANCED_OPTIONS_ID() && + string(ADVANCED_OPTIONS_ID())->value().empty()) { + // Advanced options flag just unchecked => restore default state of all + // parameters restoreDefaultParameters(); } } //================================================================================================= -GeomEdgePtr BuildPlugin_Filling::toEdge(const GeomShapePtr& theShape, const std::string& theMethod) -{ +GeomEdgePtr BuildPlugin_Filling::toEdge(const GeomShapePtr &theShape, + const std::string &theMethod) { static const double TOLERANCE = 1.e-7; GeomEdgePtr anEdge; @@ -176,7 +179,8 @@ GeomEdgePtr BuildPlugin_Filling::toEdge(const GeomShapePtr& theShape, const std: if (!anEdge || anEdge->empty()) { static const std::string aFeatureError = - "Error: incorrect type of input feature (edges/wire are supported only)."; + "Error: incorrect type of input feature (edges/wire are supported " + "only)."; setError(aFeatureError); return anEdge; } @@ -186,7 +190,8 @@ GeomEdgePtr BuildPlugin_Filling::toEdge(const GeomShapePtr& theShape, const std: // check the distance to previous edge boundaries, reverse edge if necessary bool isReverse = false; if (myLastEdge) { - if (myLastEdge->firstPoint()->distance(myLastEdge->lastPoint()) < TOLERANCE && + if (myLastEdge->firstPoint()->distance(myLastEdge->lastPoint()) < + TOLERANCE && anEdge->firstPoint()->distance(anEdge->lastPoint()) < TOLERANCE) isReverse = isReverseClosedCurve(myLastEdge, anEdge); else @@ -196,17 +201,16 @@ GeomEdgePtr BuildPlugin_Filling::toEdge(const GeomShapePtr& theShape, const std: myLastEdge = anEdge; if (isReverse) anEdge->reverse(); - } - else if (theMethod == Method::USE_CURVE_INFORMATION()) { - // make all edges FORWARD to avoid reversing the curves by GeomAlgoAPI_Filling algorithm + } else if (theMethod == Method::USE_CURVE_INFORMATION()) { + // make all edges FORWARD to avoid reversing the curves by + // GeomAlgoAPI_Filling algorithm anEdge->setOrientation(GeomAPI_Shape::FORWARD); } return anEdge; } //================================================================================================= -void BuildPlugin_Filling::restoreDefaultParameters() -{ +void BuildPlugin_Filling::restoreDefaultParameters() { string(METHOD_ID())->setValue(METHOD_DEFAULT()); integer(MINIMAL_DEGREE_ID())->setValue(MINIMAL_DEGREE_DEFAULT()); integer(MAXIMAL_DEGREE_ID())->setValue(MAXIMAL_DEGREE_DEFAULT()); @@ -216,11 +220,11 @@ void BuildPlugin_Filling::restoreDefaultParameters() boolean(APPROXIMATION_ID())->setValue(APPROXIMATION_DEFAULT()); } +//============ Auxiliary functions +//======================================================== -//============ Auxiliary functions ======================================================== - -static std::pair edgeBoundaries(const GeomEdgePtr& theEdge) -{ +static std::pair +edgeBoundaries(const GeomEdgePtr &theEdge) { GeomPointPtr aStart = theEdge->firstPoint(); GeomPointPtr anEnd = theEdge->lastPoint(); if (theEdge->orientation() == GeomAPI_Shape::REVERSED) @@ -228,22 +232,22 @@ static std::pair edgeBoundaries(const GeomEdgePtr& t return std::pair(aStart, anEnd); } -static void edgePoints(const GeomEdgePtr& theEdge, std::list& thePoints) -{ +static void edgePoints(const GeomEdgePtr &theEdge, + std::list &thePoints) { GeomAPI_Curve aCurve(theEdge); static const int aNbSegments = 10; double aStart = aCurve.startParam(); double aEnd = aCurve.endParam(); for (int i = 0; i <= aNbSegments; ++i) - thePoints.push_back(aCurve.getPoint(aStart * (1.0 - (double)i / aNbSegments) + - aEnd * (double)i / aNbSegments )); + thePoints.push_back( + aCurve.getPoint(aStart * (1.0 - (double)i / aNbSegments) + + aEnd * (double)i / aNbSegments)); if (theEdge->orientation() == GeomAPI_Shape::REVERSED) thePoints.reverse(); } -bool isReverseClosedCurve(const GeomEdgePtr& theEdge1, - const GeomEdgePtr& theEdge2) -{ +bool isReverseClosedCurve(const GeomEdgePtr &theEdge1, + const GeomEdgePtr &theEdge2) { std::list anEdge1Points, anEdge2Points; edgePoints(theEdge1, anEdge1Points); edgePoints(theEdge2, anEdge2Points); @@ -252,7 +256,8 @@ bool isReverseClosedCurve(const GeomEdgePtr& theEdge1, double d2 = 0.0; std::list::const_iterator anIt1 = anEdge1Points.begin(); std::list::const_iterator anIt2 = anEdge2Points.begin(); - std::list::const_reverse_iterator anIt2Rev = anEdge2Points.rbegin(); + std::list::const_reverse_iterator anIt2Rev = + anEdge2Points.rbegin(); for (; anIt1 != anEdge1Points.end(); ++anIt1, ++anIt2, ++anIt2Rev) { d1 += (*anIt1)->distance(*anIt2); d2 += (*anIt1)->distance(*anIt2Rev); @@ -260,16 +265,17 @@ bool isReverseClosedCurve(const GeomEdgePtr& theEdge1, return d2 < d1; } -bool isReverseOpenedCurve(const GeomEdgePtr& theEdge1, - const GeomEdgePtr& theEdge2, - const double theTolerance) -{ - std::pair anEdge1Points = edgeBoundaries(theEdge1); - std::pair anEdge2Points = edgeBoundaries(theEdge2); - double d1 = anEdge1Points.first->distance(anEdge2Points.first) - + anEdge1Points.second->distance(anEdge2Points.second); - double d2 = anEdge1Points.first->distance(anEdge2Points.second) - + anEdge1Points.second->distance(anEdge2Points.first); +bool isReverseOpenedCurve(const GeomEdgePtr &theEdge1, + const GeomEdgePtr &theEdge2, + const double theTolerance) { + std::pair anEdge1Points = + edgeBoundaries(theEdge1); + std::pair anEdge2Points = + edgeBoundaries(theEdge2); + double d1 = anEdge1Points.first->distance(anEdge2Points.first) + + anEdge1Points.second->distance(anEdge2Points.second); + double d2 = anEdge1Points.first->distance(anEdge2Points.second) + + anEdge1Points.second->distance(anEdge2Points.first); if (fabs(d1 - d2) < theTolerance) { // undefined case => check distance to start point only d1 = anEdge1Points.first->distance(anEdge2Points.first); @@ -278,8 +284,8 @@ bool isReverseOpenedCurve(const GeomEdgePtr& theEdge1, return d2 < d1; } -void shiftStartPoint(GeomWirePtr& theWire, const GeomEdgePtr& theRefEdge, const double theTolerance) -{ +void shiftStartPoint(GeomWirePtr &theWire, const GeomEdgePtr &theRefEdge, + const double theTolerance) { if (!theWire->isClosed()) { GeomVertexPtr aV1, aV2; GeomAlgoAPI_ShapeTools::findBounds(theWire, aV1, aV2); diff --git a/src/BuildPlugin/BuildPlugin_Filling.h b/src/BuildPlugin/BuildPlugin_Filling.h index 69ff9eabb..7764f0cc8 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.h +++ b/src/BuildPlugin/BuildPlugin_Filling.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Filling_H_ @@ -35,110 +36,97 @@ class GeomAPI_Shape; /// \class BuildPlugin_Filling /// \ingroup Plugins /// \brief Feature for creation of face from list of edges (1D objects). -class BuildPlugin_Filling: public ModelAPI_Feature -{ +class BuildPlugin_Filling : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_Filling(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Filling"); return MY_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Filling::ID(); return MY_KIND; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of advanced options. - inline static const std::string& ADVANCED_OPTIONS_ID() - { + inline static const std::string &ADVANCED_OPTIONS_ID() { static const std::string MY_ADVANCED_OPTIONS_ID("advanced_options"); return MY_ADVANCED_OPTIONS_ID; } /// Attribute name of method of edge orientation. - inline static const std::string& METHOD_ID() - { + inline static const std::string &METHOD_ID() { static const std::string MY_METHOD_ID("orientation"); return MY_METHOD_ID; } /// Supported methods for edge orientation correction struct Method { - inline static const std::string& AUTO_CORRECT_ORIENTATION() - { + inline static const std::string &AUTO_CORRECT_ORIENTATION() { static const std::string MY_AUTO_CORRECT_ORIENTATION("auto_correct"); return MY_AUTO_CORRECT_ORIENTATION; } - inline static const std::string& USE_CURVE_INFORMATION() - { + inline static const std::string &USE_CURVE_INFORMATION() { static const std::string MY_USE_CURVE_INFORMATION("curve_info"); return MY_USE_CURVE_INFORMATION; } - inline static const std::string& USE_EDGES_ORIENTATION() - { + inline static const std::string &USE_EDGES_ORIENTATION() { static const std::string MY_USE_EDGES_ORIENTATION("edge_orient"); return MY_USE_EDGES_ORIENTATION; } }; /// Attribute name of minimal degree. - inline static const std::string& MINIMAL_DEGREE_ID() - { + inline static const std::string &MINIMAL_DEGREE_ID() { static const std::string MY_MINIMAL_DEGREE_ID("min_degree"); return MY_MINIMAL_DEGREE_ID; } /// Attribute name of maximal degree. - inline static const std::string& MAXIMAL_DEGREE_ID() - { + inline static const std::string &MAXIMAL_DEGREE_ID() { static const std::string MY_MAXIMAL_DEGREE_ID("max_degree"); return MY_MAXIMAL_DEGREE_ID; } /// Attribute name of number of iterations. - inline static const std::string& NUMBER_OF_ITERATIONS_ID() - { + inline static const std::string &NUMBER_OF_ITERATIONS_ID() { static const std::string MY_NUMBER_OF_ITERATIONS_ID("nb_iter"); return MY_NUMBER_OF_ITERATIONS_ID; } /// Attribute name of 2D tolerance. - inline static const std::string& TOLERANCE_2D_ID() - { + inline static const std::string &TOLERANCE_2D_ID() { static const std::string MY_TOLERANCE_2D_ID("tol_2d"); return MY_TOLERANCE_2D_ID; } /// Attribute name of 3D tolerance. - inline static const std::string& TOLERANCE_3D_ID() - { + inline static const std::string &TOLERANCE_3D_ID() { static const std::string MY_TOLERANCE_3D_ID("tol_3d"); return MY_TOLERANCE_3D_ID; } /// Attribute name of approximation. - inline static const std::string& APPROXIMATION_ID() - { + inline static const std::string &APPROXIMATION_ID() { static const std::string MY_APPROXIMATION_ID("approximation"); return MY_APPROXIMATION_ID; } /// Default value of the orientation - inline static const std::string& METHOD_DEFAULT() { return Method::AUTO_CORRECT_ORIENTATION(); } + inline static const std::string &METHOD_DEFAULT() { + return Method::AUTO_CORRECT_ORIENTATION(); + } /// Default value of minimal degree inline static int MINIMAL_DEGREE_DEFAULT() { return 2; } /// Default value of maximal degree @@ -152,7 +140,8 @@ public: /// Default value of the approximation attribute inline static bool APPROXIMATION_DEFAULT() { return false; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. @@ -160,12 +149,13 @@ public: /// Called on change of any argument-attribute of this object. /// \param[in] theID identifier of changed attribute. - BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); private: /// Convert shape to edge according to construction method - std::shared_ptr toEdge(const std::shared_ptr& theShape, - const std::string& theMethod); + std::shared_ptr + toEdge(const std::shared_ptr &theShape, + const std::string &theMethod); /// Update values of attributes by their default values void restoreDefaultParameters(); diff --git a/src/BuildPlugin/BuildPlugin_Interpolation.cpp b/src/BuildPlugin/BuildPlugin_Interpolation.cpp index e6d6a7545..4bcdb5a64 100644 --- a/src/BuildPlugin/BuildPlugin_Interpolation.cpp +++ b/src/BuildPlugin/BuildPlugin_Interpolation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Interpolation.h" @@ -36,9 +37,9 @@ #include -#include #include #include +#include #include #include @@ -48,28 +49,32 @@ #include //================================================================================================= -BuildPlugin_Interpolation::BuildPlugin_Interpolation() -{ -} +BuildPlugin_Interpolation::BuildPlugin_Interpolation() {} //================================================================================================= -void BuildPlugin_Interpolation::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Interpolation::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(CLOSED_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(REORDER_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(USE_TANGENTS_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(TANGENT_START_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(TANGENT_START_ID(), + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(TANGENT_END_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(CREATION_METHOD_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(CREATION_METHOD_BY_SELECTION_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(CREATION_METHOD_ANALYTICAL_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(EXPRESSION_ERROR_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(CREATION_METHOD_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(CREATION_METHOD_BY_SELECTION_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(CREATION_METHOD_ANALYTICAL_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(EXPRESSION_ERROR_ID(), + ModelAPI_AttributeString::typeId()); data()->addAttribute(VARIABLE_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(VALUE_ID(), ModelAPI_AttributeTables::typeId()); data()->string(EXPRESSION_ERROR_ID())->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXPRESSION_ERROR_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), EXPRESSION_ERROR_ID()); data()->addAttribute(XT_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(YT_ID(), ModelAPI_AttributeString::typeId()); @@ -78,79 +83,75 @@ void BuildPlugin_Interpolation::initAttributes() data()->addAttribute(MAXT_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(NUMSTEP_ID(), ModelAPI_AttributeInteger::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), CREATION_METHOD_ANALYTICAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), CREATION_METHOD_BY_SELECTION_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - CREATION_METHOD_ANALYTICAL_ID()); + VARIABLE_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - CREATION_METHOD_BY_SELECTION_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VARIABLE_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VALUE_ID()); + VALUE_ID()); data()->addAttribute(ARGUMENTS_ID(), ModelAPI_AttributeRefList::typeId()); data()->reflist(ARGUMENTS_ID())->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ARGUMENTS_ID()); - - if (string(XT_ID())->value() == "" - && string(YT_ID())->value() == "" - && string(ZT_ID())->value() == "") { - string(XT_ID())->setValue("t"); - string(YT_ID())->setValue("t"); - string(ZT_ID())->setValue("t"); - real(MINT_ID())->setValue(0); - real(MAXT_ID())->setValue(100); - integer(NUMSTEP_ID())->setValue(10); - updateCoordinates(); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + ARGUMENTS_ID()); + + if (string(XT_ID())->value() == "" && string(YT_ID())->value() == "" && + string(ZT_ID())->value() == "") { + string(XT_ID())->setValue("t"); + string(YT_ID())->setValue("t"); + string(ZT_ID())->setValue("t"); + real(MINT_ID())->setValue(0); + real(MAXT_ID())->setValue(100); + integer(NUMSTEP_ID())->setValue(10); + updateCoordinates(); } } //================================================================================================= -void BuildPlugin_Interpolation::attributeChanged(const std::string& theID) -{ - if ((theID == XT_ID() - || theID == YT_ID() - || theID == ZT_ID() - || theID == MINT_ID() - || theID == MAXT_ID() - || theID == NUMSTEP_ID()) - && string(XT_ID())->value() !="" - && string(YT_ID())->value() !="" - && string(ZT_ID())->value() !="" - && string(CREATION_METHOD_ID())->value() == CREATION_METHOD_ANALYTICAL_ID()) { +void BuildPlugin_Interpolation::attributeChanged(const std::string &theID) { + if ((theID == XT_ID() || theID == YT_ID() || theID == ZT_ID() || + theID == MINT_ID() || theID == MAXT_ID() || theID == NUMSTEP_ID()) && + string(XT_ID())->value() != "" && string(YT_ID())->value() != "" && + string(ZT_ID())->value() != "" && + string(CREATION_METHOD_ID())->value() == + CREATION_METHOD_ANALYTICAL_ID()) { updateCoordinates(); } } //================================================================================================= -void BuildPlugin_Interpolation::updateCoordinates() -{ - double aMint = real(MINT_ID())->value(); - double aMaxt = real(MAXT_ID())->value(); - int aNbrStep = integer(NUMSTEP_ID())->value(); - - if (aMaxt < aMint) { - setError("The minimum value of the parameter must be less than maximum value !!!"); - } +void BuildPlugin_Interpolation::updateCoordinates() { + double aMint = real(MINT_ID())->value(); + double aMaxt = real(MAXT_ID())->value(); + int aNbrStep = integer(NUMSTEP_ID())->value(); + + if (aMaxt < aMint) { + setError("The minimum value of the parameter must be less than maximum " + "value !!!"); + } - double aScale = (aMaxt - aMint)/aNbrStep; - string(VARIABLE_ID())->setValue("t"); + double aScale = (aMaxt - aMint) / aNbrStep; + string(VARIABLE_ID())->setValue("t"); - tables(VALUE_ID())->setSize(aNbrStep+1,4); - for (int step = 0; step <= aNbrStep; step++) { - ModelAPI_AttributeTables::Value aVal; - aVal.myDouble = step * aScale + aMint; - tables(VALUE_ID())->setValue(aVal,step,0); - } + tables(VALUE_ID())->setSize(aNbrStep + 1, 4); + for (int step = 0; step <= aNbrStep; step++) { + ModelAPI_AttributeTables::Value aVal; + aVal.myDouble = step * aScale + aMint; + tables(VALUE_ID())->setValue(aVal, step, 0); + } - outErrorMessage=""; - evaluate(outErrorMessage); - data()->string(EXPRESSION_ERROR_ID())->setValue(outErrorMessage); - if (!outErrorMessage.empty()) { - setError("Error: Python interpreter "); - return; - } + outErrorMessage = ""; + evaluate(outErrorMessage); + data()->string(EXPRESSION_ERROR_ID())->setValue(outErrorMessage); + if (!outErrorMessage.empty()) { + setError("Error: Python interpreter "); + return; + } } //================================================================================================= -static GeomDirPtr selectionToDir(const AttributeSelectionPtr& theSelection) -{ +static GeomDirPtr selectionToDir(const AttributeSelectionPtr &theSelection) { GeomDirPtr aDir; GeomEdgePtr anEdge; @@ -171,9 +172,9 @@ static GeomDirPtr selectionToDir(const AttributeSelectionPtr& theSelection) } //================================================================================================= -void BuildPlugin_Interpolation::execute() -{ - if (string(CREATION_METHOD_ID())->value() == CREATION_METHOD_BY_SELECTION_ID()) { +void BuildPlugin_Interpolation::execute() { + if (string(CREATION_METHOD_ID())->value() == + CREATION_METHOD_BY_SELECTION_ID()) { // Get closed flag value bool isClosed = boolean(CLOSED_ID())->value(); @@ -181,7 +182,8 @@ void BuildPlugin_Interpolation::execute() bool isToReorder = boolean(REORDER_ID())->value(); // Get use tangents flag value - bool isToUseTangents = isClosed? false : (!string(USE_TANGENTS_ID())->value().empty()); + bool isToUseTangents = + isClosed ? false : (!string(USE_TANGENTS_ID())->value().empty()); // Get tangent for start and end points GeomDirPtr aDirStart, aDirEnd; @@ -212,8 +214,8 @@ void BuildPlugin_Interpolation::execute() } // Create curve from points - GeomEdgePtr anEdge = - GeomAlgoAPI_CurveBuilder::edge(aPoints, isClosed, isToReorder, aDirStart, aDirEnd); + GeomEdgePtr anEdge = GeomAlgoAPI_CurveBuilder::edge( + aPoints, isClosed, isToReorder, aDirStart, aDirEnd); if (!anEdge.get()) { setError("Error: Result curve is empty."); return; @@ -223,21 +225,22 @@ void BuildPlugin_Interpolation::execute() ResultBodyPtr aResultBody = document()->createBody(data()); std::set::const_iterator aContextIt = aContexts.begin(); for (; aContextIt != aContexts.end(); aContextIt++) { - aResultBody->storeModified(*aContextIt, anEdge, aContextIt == aContexts.begin()); + aResultBody->storeModified(*aContextIt, anEdge, + aContextIt == aContexts.begin()); } int aVertexIndex = 1; - for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); anExp.more(); anExp.next()) { - std::string aVertexName = "Vertex_" + std::to_string((long long)aVertexIndex); + for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); + anExp.more(); anExp.next()) { + std::string aVertexName = + "Vertex_" + std::to_string((long long)aVertexIndex); aResultBody->generated(anExp.current(), aVertexName); } setResult(aResultBody); } else { - if (string(XT_ID())->value() == "" - ||string(YT_ID())->value() == "" - ||string(ZT_ID())->value() == "" - ||tables(VALUE_ID())->rows()== 0) + if (string(XT_ID())->value() == "" || string(YT_ID())->value() == "" || + string(ZT_ID())->value() == "" || tables(VALUE_ID())->rows() == 0) return; bool aWasBlocked = data()->blockSendAttributeUpdated(true); @@ -249,10 +252,10 @@ void BuildPlugin_Interpolation::execute() for (int step = 0; step < aTable->rows(); step++) { std::vector aCoordPoint; ModelAPI_AttributeTables::Value aValue; - //x + // x aValue = aTable->value(step, 1); aCoordPoint.push_back(aValue.myDouble); - //y + // y aValue = aTable->value(step, 2); aCoordPoint.push_back(aValue.myDouble); // @@ -263,32 +266,32 @@ void BuildPlugin_Interpolation::execute() } std::list aPoints; - std::list>::const_iterator anItCoordPoints = aCoordPoints.begin(); + std::list>::const_iterator anItCoordPoints = + aCoordPoints.begin(); - for (; anItCoordPoints!=aCoordPoints.end(); ++anItCoordPoints) { + for (; anItCoordPoints != aCoordPoints.end(); ++anItCoordPoints) { - GeomVertexPtr aVertex = GeomAlgoAPI_PointBuilder::vertex((*anItCoordPoints)[0], - (*anItCoordPoints)[1], - (*anItCoordPoints)[2]); + GeomVertexPtr aVertex = GeomAlgoAPI_PointBuilder::vertex( + (*anItCoordPoints)[0], (*anItCoordPoints)[1], (*anItCoordPoints)[2]); aPoints.push_back(aVertex->point()); } // test if some points are identical std::list::const_iterator anItPoint1 = aPoints.begin(); std::list::const_iterator anItPoint2; - for(; anItPoint1 != aPoints.end(); ++ anItPoint1) { + for (; anItPoint1 != aPoints.end(); ++anItPoint1) { anItPoint2 = anItPoint1; ++anItPoint2; - for(; anItPoint2 != aPoints.end(); ++ anItPoint2) - if ((*anItPoint2)->isEqual(*anItPoint1)) { - setError("Error: Several points are identical"); - return; - } + for (; anItPoint2 != aPoints.end(); ++anItPoint2) + if ((*anItPoint2)->isEqual(*anItPoint1)) { + setError("Error: Several points are identical"); + return; + } } // Create curve from points - GeomEdgePtr anEdge = - GeomAlgoAPI_CurveBuilder::edge(aPoints, false, false,GeomDirPtr(),GeomDirPtr()); + GeomEdgePtr anEdge = GeomAlgoAPI_CurveBuilder::edge( + aPoints, false, false, GeomDirPtr(), GeomDirPtr()); if (!anEdge.get()) { setError("Error: Result curve is empty."); return; @@ -298,8 +301,10 @@ void BuildPlugin_Interpolation::execute() // Load the result aResultBody->store(anEdge); int aVertexIndex = 1; - for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); anExp.more(); anExp.next()) { - std::string aVertexName = "Vertex_" + std::to_string((long long)aVertexIndex); + for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); + anExp.more(); anExp.next()) { + std::string aVertexName = + "Vertex_" + std::to_string((long long)aVertexIndex); aResultBody->generated(anExp.current(), aVertexName); aVertexIndex++; } @@ -308,24 +313,26 @@ void BuildPlugin_Interpolation::execute() } //================================================================================================= -void BuildPlugin_Interpolation::evaluate(std::string& theError) -{ - FeaturePtr aMyPtr = std::dynamic_pointer_cast(data()->owner()); +void BuildPlugin_Interpolation::evaluate(std::string &theError) { + FeaturePtr aMyPtr = + std::dynamic_pointer_cast(data()->owner()); std::shared_ptr aProcessMessage = - ModelAPI_BuildEvalMessage::send(aMyPtr, this); + ModelAPI_BuildEvalMessage::send(aMyPtr, this); if (aProcessMessage->isProcessed()) { theError = aProcessMessage->error(); - const std::list& aParamsList = aProcessMessage->params(); - //store the list of parameters to store if changed + const std::list &aParamsList = + aProcessMessage->params(); + // store the list of parameters to store if changed AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); aParams->clear(); - std::list::const_iterator aNewIter = aParamsList.begin(); + std::list::const_iterator aNewIter = + aParamsList.begin(); for (; aNewIter != aParamsList.end(); aNewIter++) { aParams->append(*aNewIter); } } else { // error: python interpreter is not active theError = "Python interpreter is not available"; } -} \ No newline at end of file +} diff --git a/src/BuildPlugin/BuildPlugin_Interpolation.h b/src/BuildPlugin/BuildPlugin_Interpolation.h index 91d5c9b10..638458b8f 100644 --- a/src/BuildPlugin/BuildPlugin_Interpolation.h +++ b/src/BuildPlugin/BuildPlugin_Interpolation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Interpolation_H_ @@ -27,141 +28,121 @@ /// \class BuildPlugin_Interpolation /// \ingroup Plugins /// \brief Feature for creation of interpolation curve from set of points. -class BuildPlugin_Interpolation : public ModelAPI_Feature -{ +class BuildPlugin_Interpolation : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_Interpolation(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Interpolation"); return MY_ID; } /// Attribute name of creation method. - inline static const std::string& CREATION_METHOD_ID() - { + inline static const std::string &CREATION_METHOD_ID() { static const std::string MY_CREATION_METHOD_ID("interpolation_method"); return MY_CREATION_METHOD_ID; } /// Attribute name of creation method by selection - inline static const std::string& CREATION_METHOD_BY_SELECTION_ID() - { + inline static const std::string &CREATION_METHOD_BY_SELECTION_ID() { static const std::string MY_CREATION_METHOD_BY_SELECTION_ID("by_selection"); return MY_CREATION_METHOD_BY_SELECTION_ID; } /// Attribute name of creation method analytical - inline static const std::string& CREATION_METHOD_ANALYTICAL_ID() - { + inline static const std::string &CREATION_METHOD_ANALYTICAL_ID() { static const std::string MY_CREATION_METHOD_ANALYTICAL_ID("analytical"); return MY_CREATION_METHOD_ANALYTICAL_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of closed flag. - inline static const std::string& CLOSED_ID() - { + inline static const std::string &CLOSED_ID() { static const std::string MY_CLOSED_ID("closed"); return MY_CLOSED_ID; } /// Attribute name of reorder flag. - inline static const std::string& REORDER_ID() - { + inline static const std::string &REORDER_ID() { static const std::string MY_REORDER_ID("reorder"); return MY_REORDER_ID; } /// Attribute name of use tangents flag. - inline static const std::string& USE_TANGENTS_ID() - { + inline static const std::string &USE_TANGENTS_ID() { static const std::string MY_USE_TANGENTS_ID("use_tangents"); return MY_USE_TANGENTS_ID; } /// Attribute name of tangent for start point. - inline static const std::string& TANGENT_START_ID() - { + inline static const std::string &TANGENT_START_ID() { static const std::string MY_TANGENT_START_ID("tangent_start"); return MY_TANGENT_START_ID; } /// Attribute name of tangent for end point. - inline static const std::string& TANGENT_END_ID() - { + inline static const std::string &TANGENT_END_ID() { static const std::string MY_TANGENT_END_ID("tangent_end"); return MY_TANGENT_END_ID; } /// Attribute name of x(t) equation. - inline static const std::string& XT_ID() - { + inline static const std::string &XT_ID() { static const std::string MY_XT_ID("xt"); return MY_XT_ID; } /// Attribute name of y(t) equation. - inline static const std::string& YT_ID() - { + inline static const std::string &YT_ID() { static const std::string MY_YT_ID("yt"); return MY_YT_ID; } /// Attribute name of z(t) equation. - inline static const std::string& ZT_ID() - { + inline static const std::string &ZT_ID() { static const std::string MY_ZT_ID("zt"); return MY_ZT_ID; } /// Attribute name of min t. - inline static const std::string& MINT_ID() - { + inline static const std::string &MINT_ID() { static const std::string MY_MINT_ID("mint"); return MY_MINT_ID; } /// Attribute name of max t. - inline static const std::string& MAXT_ID() - { + inline static const std::string &MAXT_ID() { static const std::string MY_MAXT_ID("maxt"); return MY_MAXT_ID; } /// Attribute of parameter name of variable - inline static const std::string& VARIABLE_ID() - { + inline static const std::string &VARIABLE_ID() { static const std::string MY_VARIABLE_ID("variable"); return MY_VARIABLE_ID; } /// Attribute of parameter name of value - inline static const std::string& VALUE_ID() - { + inline static const std::string &VALUE_ID() { static const std::string MY_VALUE_ID("value"); return MY_VALUE_ID; } /// Attribute of parameter expression error - inline static const std::string& EXPRESSION_ERROR_ID() - { + inline static const std::string &EXPRESSION_ERROR_ID() { static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError"); return MY_EXPRESSION_ERROR_ID; } /// Attribute name of number of steps - inline static const std::string& NUMSTEP_ID() - { + inline static const std::string &NUMSTEP_ID() { static const std::string MY_NUMSTEP_ID("numstep"); return MY_NUMSTEP_ID; } @@ -170,20 +151,19 @@ public: inline static bool CLOSED_DEFAULT() { return false; } /// List of references to the arguments of this expression - inline static const std::string& ARGUMENTS_ID() - { + inline static const std::string &ARGUMENTS_ID() { static const std::string MY_ARGUMENTS_ID("arguments"); return MY_ARGUMENTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Interpolation::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. @@ -191,18 +171,17 @@ public: /// Called on change of any argument-attribute of this object. /// \param[in] theID identifier of changed attribute. - BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); - protected: +protected: /// Evaluates the expression x(t), y(t),z(t) in value table. - void evaluate(std::string& theError); + void evaluate(std::string &theError); /// Update coordinates x,y,z void updateCoordinates(); /// Output error for python interpreter std::string outErrorMessage; - }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Plugin.cpp b/src/BuildPlugin/BuildPlugin_Plugin.cpp index a23205ef8..e93918f46 100644 --- a/src/BuildPlugin/BuildPlugin_Plugin.cpp +++ b/src/BuildPlugin/BuildPlugin_Plugin.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Plugin.h" @@ -22,29 +23,28 @@ #include #include -#include +#include +#include #include -#include -#include -#include #include +#include +#include +#include #include #include -#include -#include #include -#include #include +#include +#include // the only created instance of this plugin -static BuildPlugin_Plugin* MY_INSTANCE = new BuildPlugin_Plugin(); +static BuildPlugin_Plugin *MY_INSTANCE = new BuildPlugin_Plugin(); //================================================================================================= -BuildPlugin_Plugin::BuildPlugin_Plugin() -{ +BuildPlugin_Plugin::BuildPlugin_Plugin() { // Register validators. SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("BuildPlugin_ValidatorBaseForBuild", new BuildPlugin_ValidatorBaseForBuild()); aFactory->registerValidator("BuildPlugin_ValidatorBaseForWire", @@ -59,21 +59,21 @@ BuildPlugin_Plugin::BuildPlugin_Plugin() new BuildPlugin_ValidatorFillingSelection()); aFactory->registerValidator("BuildPlugin_ValidatorBaseForVertex", new BuildPlugin_ValidatorBaseForVertex()); - aFactory->registerValidator("BuildPlugin_ValidatorExpressionInterpolation", - new BuildPlugin_ValidatorExpressionInterpolation()); + aFactory->registerValidator( + "BuildPlugin_ValidatorExpressionInterpolation", + new BuildPlugin_ValidatorExpressionInterpolation()); // Register this plugin. ModelAPI_Session::get()->registerPlugin(this); } //================================================================================================= -FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID) -{ - if(theFeatureID == BuildPlugin_Vertex::ID()) { +FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID) { + if (theFeatureID == BuildPlugin_Vertex::ID()) { return FeaturePtr(new BuildPlugin_Vertex()); - } else if(theFeatureID == BuildPlugin_Edge::ID()) { + } else if (theFeatureID == BuildPlugin_Edge::ID()) { return FeaturePtr(new BuildPlugin_Edge()); - } else if(theFeatureID == BuildPlugin_Wire::ID()) { + } else if (theFeatureID == BuildPlugin_Wire::ID()) { return FeaturePtr(new BuildPlugin_Wire()); } else if (theFeatureID == BuildPlugin_Polyline::ID()) { return FeaturePtr(new BuildPlugin_Polyline()); @@ -81,17 +81,17 @@ FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new BuildPlugin_Interpolation()); } else if (theFeatureID == BuildPlugin_Face::ID()) { return FeaturePtr(new BuildPlugin_Face()); - } else if(theFeatureID == BuildPlugin_Shell::ID()) { + } else if (theFeatureID == BuildPlugin_Shell::ID()) { return FeaturePtr(new BuildPlugin_Shell()); - } else if(theFeatureID == BuildPlugin_Solid::ID()) { + } else if (theFeatureID == BuildPlugin_Solid::ID()) { return FeaturePtr(new BuildPlugin_Solid()); - } else if(theFeatureID == BuildPlugin_CompSolid::ID()) { + } else if (theFeatureID == BuildPlugin_CompSolid::ID()) { return FeaturePtr(new BuildPlugin_CompSolid()); - } else if(theFeatureID == BuildPlugin_Compound::ID()) { + } else if (theFeatureID == BuildPlugin_Compound::ID()) { return FeaturePtr(new BuildPlugin_Compound()); - } else if(theFeatureID == BuildPlugin_SubShapes::ID()) { + } else if (theFeatureID == BuildPlugin_SubShapes::ID()) { return FeaturePtr(new BuildPlugin_SubShapes()); - } else if(theFeatureID == BuildPlugin_Filling::ID()) { + } else if (theFeatureID == BuildPlugin_Filling::ID()) { return FeaturePtr(new BuildPlugin_Filling()); } diff --git a/src/BuildPlugin/BuildPlugin_Plugin.h b/src/BuildPlugin/BuildPlugin_Plugin.h index f30d196d3..4870b488d 100644 --- a/src/BuildPlugin/BuildPlugin_Plugin.h +++ b/src/BuildPlugin/BuildPlugin_Plugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Plugin_H_ @@ -22,14 +23,13 @@ #include "BuildPlugin.h" -#include #include +#include /// \class BuildPlugin_Plugin /// \ingroup Plugins /// \brief The main class for management the build features as plugin. -class BUILDPLUGIN_EXPORT BuildPlugin_Plugin: public ModelAPI_Plugin -{ +class BUILDPLUGIN_EXPORT BuildPlugin_Plugin : public ModelAPI_Plugin { public: /// Default constructor BuildPlugin_Plugin(); diff --git a/src/BuildPlugin/BuildPlugin_Polyline.cpp b/src/BuildPlugin/BuildPlugin_Polyline.cpp index 3d9a32608..5c9b37a19 100644 --- a/src/BuildPlugin/BuildPlugin_Polyline.cpp +++ b/src/BuildPlugin/BuildPlugin_Polyline.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Polyline.h" @@ -28,28 +29,25 @@ #include -#include #include #include +#include #include #include //================================================================================================= -BuildPlugin_Polyline::BuildPlugin_Polyline() -{ -} +BuildPlugin_Polyline::BuildPlugin_Polyline() {} //================================================================================================= -void BuildPlugin_Polyline::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Polyline::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(CLOSED_ID(), ModelAPI_AttributeBoolean::typeId()); } //================================================================================================= -void BuildPlugin_Polyline::execute() -{ +void BuildPlugin_Polyline::execute() { // Get closed flag value bool isClosed = boolean(CLOSED_ID())->value(); @@ -61,31 +59,35 @@ void BuildPlugin_Polyline::execute() std::set aContexts; for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); - GeomShapePtr aShape = aSelection->value(); + GeomShapePtr aShape = aSelection->value(); ResultPtr aContext = aSelection->context(); aContexts.insert(aContext->shape()); if (!aShape.get()) { aShape = aContext->shape(); - } + } aPoints.push_back(aShape); - } + } // Prepare a list of edges ListOfShape anEdges; ListOfShape::const_iterator aPointsIt = aPoints.begin(); for (; aPointsIt != std::prev(aPoints.end()); ++aPointsIt) { - std::shared_ptr aPnt = GeomAlgoAPI_PointBuilder::point(*aPointsIt); - std::shared_ptr aPntNext = GeomAlgoAPI_PointBuilder::point(*std::next(aPointsIt)); + std::shared_ptr aPnt = + GeomAlgoAPI_PointBuilder::point(*aPointsIt); + std::shared_ptr aPntNext = + GeomAlgoAPI_PointBuilder::point(*std::next(aPointsIt)); anEdges.push_back(GeomAlgoAPI_EdgeBuilder::line(aPnt, aPntNext)); } if (isClosed) { - std::shared_ptr aLastPnt = GeomAlgoAPI_PointBuilder::point(aPoints.back()); - std::shared_ptr aFirstPnt = GeomAlgoAPI_PointBuilder::point(aPoints.front()); + std::shared_ptr aLastPnt = + GeomAlgoAPI_PointBuilder::point(aPoints.back()); + std::shared_ptr aFirstPnt = + GeomAlgoAPI_PointBuilder::point(aPoints.front()); anEdges.push_back(GeomAlgoAPI_EdgeBuilder::line(aLastPnt, aFirstPnt)); } @@ -106,12 +108,14 @@ void BuildPlugin_Polyline::execute() ResultBodyPtr aResultBody = document()->createBody(data()); std::set::const_iterator aContextIt = aContexts.begin(); for (; aContextIt != aContexts.end(); aContextIt++) { - aResultBody->storeModified(*aContextIt, aWire, aContextIt == aContexts.begin()); + aResultBody->storeModified(*aContextIt, aWire, + aContextIt == aContexts.begin()); } aPointsIt = aPoints.cbegin(); GeomAPI_ShapeExplorer anExp(aWire, GeomAPI_Shape::EDGE); - for (; anExp.more() && aPointsIt != aPoints.cend(); anExp.next(), ++aPointsIt) { + for (; anExp.more() && aPointsIt != aPoints.cend(); + anExp.next(), ++aPointsIt) { GeomShapePtr aPoint = *aPointsIt; GeomShapePtr anEdge = anExp.current(); aResultBody->generated(aPoint, anEdge); diff --git a/src/BuildPlugin/BuildPlugin_Polyline.h b/src/BuildPlugin/BuildPlugin_Polyline.h index 090bb1f68..3e72079e1 100644 --- a/src/BuildPlugin/BuildPlugin_Polyline.h +++ b/src/BuildPlugin/BuildPlugin_Polyline.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Polyline_H_ @@ -27,29 +28,25 @@ /// \class BuildPlugin_Polyline /// \ingroup Plugins /// \brief Feature for creation of polyline from set of points. -class BuildPlugin_Polyline : public ModelAPI_Feature -{ +class BuildPlugin_Polyline : public ModelAPI_Feature { public: - /// Use plugin manager for features creation - BuildPlugin_Polyline(); + /// Use plugin manager for features creation + BuildPlugin_Polyline(); - /// Feature kind. - inline static const std::string& ID() - { - static const std::string MY_ID("Polyline"); - return MY_ID; - } + /// Feature kind. + inline static const std::string &ID() { + static const std::string MY_ID("Polyline"); + return MY_ID; + } - /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { - static const std::string MY_BASE_OBJECTS_ID("base_objects"); - return MY_BASE_OBJECTS_ID; - } + /// Attribute name of base objects. + inline static const std::string &BASE_OBJECTS_ID() { + static const std::string MY_BASE_OBJECTS_ID("base_objects"); + return MY_BASE_OBJECTS_ID; + } /// Attribute name of closed flag. - inline static const std::string& CLOSED_ID() - { + inline static const std::string &CLOSED_ID() { static const std::string MY_CLOSED_ID("closed"); return MY_CLOSED_ID; } @@ -57,18 +54,18 @@ public: /// Default value of the closed attribute inline static bool CLOSED_DEFAULT() { return false; } - /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { - static std::string MY_KIND = BuildPlugin_Polyline::ID(); - return MY_KIND; - } + /// \return the kind of a feature. + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + static std::string MY_KIND = BuildPlugin_Polyline::ID(); + return MY_KIND; + } - /// Request for initialization of data model of the feature: adding all attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + /// Request for initialization of data model of the feature: adding all + /// attributes. + BUILDPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + /// Creates a new part document if needed. + BUILDPLUGIN_EXPORT virtual void execute(); }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Shape.cpp b/src/BuildPlugin/BuildPlugin_Shape.cpp index 3cbc52acf..ac0f8b8a5 100644 --- a/src/BuildPlugin/BuildPlugin_Shape.cpp +++ b/src/BuildPlugin/BuildPlugin_Shape.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Shape.h" @@ -26,23 +27,20 @@ #include - //================================================================================================= -void BuildPlugin_Shape::storeResult(const GeomMakeShapePtr& theAlgorithm, - const ListOfShape& theOriginalShapes, - const ListOfShape& theOriginalSolids, - const GeomShapePtr& theResultShape, - const int theResultIndex) -{ +void BuildPlugin_Shape::storeResult(const GeomMakeShapePtr &theAlgorithm, + const ListOfShape &theOriginalShapes, + const ListOfShape &theOriginalSolids, + const GeomShapePtr &theResultShape, + const int theResultIndex) { ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); aResultBody->storeModified(theOriginalSolids, theResultShape, theAlgorithm); for (ListOfShape::const_iterator anIt = theOriginalShapes.cbegin(); - anIt != theOriginalShapes.cend(); - ++anIt) - { + anIt != theOriginalShapes.cend(); ++anIt) { GeomShapePtr aShape = *anIt; - aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::VERTEX); + aResultBody->loadModifiedShapes(theAlgorithm, aShape, + GeomAPI_Shape::VERTEX); aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::EDGE); aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::FACE); } @@ -50,10 +48,9 @@ void BuildPlugin_Shape::storeResult(const GeomMakeShapePtr& theAlgorithm, } //================================================================================================= -void BuildPlugin_Shape::getOriginalShapesAndContexts(const std::string& theSelectionListID, - ListOfShape& theShapes, - ListOfShape& theContexts) -{ +void BuildPlugin_Shape::getOriginalShapesAndContexts( + const std::string &theSelectionListID, ListOfShape &theShapes, + ListOfShape &theContexts) { std::set aContexts; AttributeSelectionListPtr aSelectionList = selectionList(theSelectionListID); @@ -71,7 +68,8 @@ void BuildPlugin_Shape::getOriginalShapesAndContexts(const std::string& theSelec aContexts.insert(aContext); } - std::set::const_iterator anIt = aContexts.begin(); + std::set::const_iterator anIt = + aContexts.begin(); for (; anIt != aContexts.end(); ++anIt) theContexts.push_back(*anIt); } diff --git a/src/BuildPlugin/BuildPlugin_Shape.h b/src/BuildPlugin/BuildPlugin_Shape.h index 053c81855..428731eb1 100644 --- a/src/BuildPlugin/BuildPlugin_Shape.h +++ b/src/BuildPlugin/BuildPlugin_Shape.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Shape_H_ @@ -31,19 +32,18 @@ class GeomAlgoAPI_MakeShape; /// \class BuildPlugin_Shape /// \ingroup Plugins /// \brief Base class containing common methods for shape creating operations. -class BuildPlugin_Shape: public ModelAPI_Feature -{ +class BuildPlugin_Shape : public ModelAPI_Feature { protected: /// Obtain list of selected shapes and their contexts - void getOriginalShapesAndContexts(const std::string& theSelectionListID, - ListOfShape& theShapes, - ListOfShape& theContexts); + void getOriginalShapesAndContexts(const std::string &theSelectionListID, + ListOfShape &theShapes, + ListOfShape &theContexts); /// Store result of algorithm - void storeResult(const std::shared_ptr& theAlgorithm, - const ListOfShape& theOriginalShapes, - const ListOfShape& theOriginalContexts, - const GeomShapePtr& theResultShape, + void storeResult(const std::shared_ptr &theAlgorithm, + const ListOfShape &theOriginalShapes, + const ListOfShape &theOriginalContexts, + const GeomShapePtr &theResultShape, const int theResultIndex = 0); }; diff --git a/src/BuildPlugin/BuildPlugin_Shell.cpp b/src/BuildPlugin/BuildPlugin_Shell.cpp index a4950823a..fd2a40ff1 100644 --- a/src/BuildPlugin/BuildPlugin_Shell.cpp +++ b/src/BuildPlugin/BuildPlugin_Shell.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Shell.h" @@ -23,24 +24,21 @@ #include #include +#include #include #include -#include //================================================================================================= -BuildPlugin_Shell::BuildPlugin_Shell() -{ -} +BuildPlugin_Shell::BuildPlugin_Shell() {} //================================================================================================= -void BuildPlugin_Shell::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Shell::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); } //================================================================================================= -void BuildPlugin_Shell::execute() -{ +void BuildPlugin_Shell::execute() { // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); @@ -53,7 +51,8 @@ void BuildPlugin_Shell::execute() AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); ResultConstructionPtr aContext = - std::dynamic_pointer_cast(aSelection->context()); + std::dynamic_pointer_cast( + aSelection->context()); if (!aShape && aContext) { for (int i = 0; i < aContext->facesNum(); ++i) aShapes.push_back(aContext->face(i)); @@ -64,7 +63,8 @@ void BuildPlugin_Shell::execute() GeomMakeShapePtr aSewingAlgo(new GeomAlgoAPI_Sewing(aShapes)); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSewingAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSewingAlgo, getKind(), + anError)) { setError(anError); return; } @@ -73,7 +73,8 @@ void BuildPlugin_Shell::execute() GeomShapePtr aResult = aSewingAlgo->shape(); int anIndex = 0; - for(GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::SHELL); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::SHELL); anExp.more(); + anExp.next()) { GeomShapePtr aShell = anExp.current(); storeResult(aSewingAlgo, aShapes, aContexts, aShell, anIndex++); } diff --git a/src/BuildPlugin/BuildPlugin_Shell.h b/src/BuildPlugin/BuildPlugin_Shell.h index f9de45deb..e52a8d509 100644 --- a/src/BuildPlugin/BuildPlugin_Shell.h +++ b/src/BuildPlugin/BuildPlugin_Shell.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Shell_H_ @@ -26,34 +27,31 @@ /// \class BuildPlugin_Shell /// \ingroup Plugins /// \brief Feature for creation of shell from faces and shells. -class BuildPlugin_Shell: public BuildPlugin_Shape -{ +class BuildPlugin_Shell : public BuildPlugin_Shape { public: /// Use plugin manager for features creation BuildPlugin_Shell(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Shell"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Shell::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. diff --git a/src/BuildPlugin/BuildPlugin_Solid.cpp b/src/BuildPlugin/BuildPlugin_Solid.cpp index c737a08ea..02de79148 100644 --- a/src/BuildPlugin/BuildPlugin_Solid.cpp +++ b/src/BuildPlugin/BuildPlugin_Solid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Solid.h" @@ -28,33 +29,32 @@ #include //================================================================================================= -BuildPlugin_Solid::BuildPlugin_Solid() -{ -} +BuildPlugin_Solid::BuildPlugin_Solid() {} //================================================================================================= -void BuildPlugin_Solid::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Solid::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); } //================================================================================================= -void BuildPlugin_Solid::execute() -{ - // all the needed checkings are in validator, so, here just make and store result +void BuildPlugin_Solid::execute() { + // all the needed checkings are in validator, so, here just make and store + // result ListOfShape anOriginalFaces; ListOfShape anOriginalSolids; - getOriginalShapesAndContexts(BASE_OBJECTS_ID(), anOriginalFaces, anOriginalSolids); + getOriginalShapesAndContexts(BASE_OBJECTS_ID(), anOriginalFaces, + anOriginalSolids); std::shared_ptr anAlgo( - new GeomAlgoAPI_MakeVolume(anOriginalFaces, false)); + new GeomAlgoAPI_MakeVolume(anOriginalFaces, false)); // check and process result of volume maker GeomShapePtr aResShape = getSingleSubshape(anAlgo->shape()); storeResult(anAlgo, anOriginalFaces, anOriginalSolids, aResShape); } -GeomShapePtr BuildPlugin_Solid::getSingleSubshape(const GeomShapePtr& theCompound) -{ +GeomShapePtr +BuildPlugin_Solid::getSingleSubshape(const GeomShapePtr &theCompound) { if (theCompound->shapeType() == GeomAPI_Shape::COMPOUND) { GeomAPI_ShapeIterator anIt(theCompound); return anIt.current(); diff --git a/src/BuildPlugin/BuildPlugin_Solid.h b/src/BuildPlugin/BuildPlugin_Solid.h index 2620bbbf5..beef610bc 100644 --- a/src/BuildPlugin/BuildPlugin_Solid.h +++ b/src/BuildPlugin/BuildPlugin_Solid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Solid_H_ @@ -26,34 +27,31 @@ /// \class BuildPlugin_Solid /// \ingroup Plugins /// \brief Feature for creation of solid from faces or shells. -class BuildPlugin_Solid: public BuildPlugin_Shape -{ +class BuildPlugin_Solid : public BuildPlugin_Shape { public: /// Use plugin manager for features creation BuildPlugin_Solid(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Solid"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Solid::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. @@ -61,7 +59,7 @@ public: protected: /// Explode compound to get single shape - GeomShapePtr getSingleSubshape(const GeomShapePtr& theCompound); + GeomShapePtr getSingleSubshape(const GeomShapePtr &theCompound); }; #endif diff --git a/src/BuildPlugin/BuildPlugin_SubShapes.cpp b/src/BuildPlugin/BuildPlugin_SubShapes.cpp index db3c7727f..00e374d46 100644 --- a/src/BuildPlugin/BuildPlugin_SubShapes.cpp +++ b/src/BuildPlugin/BuildPlugin_SubShapes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_SubShapes.h" @@ -32,27 +33,26 @@ #include //================================================================================================== -BuildPlugin_SubShapes::BuildPlugin_SubShapes() -{ -} +BuildPlugin_SubShapes::BuildPlugin_SubShapes() {} //================================================================================================== -void BuildPlugin_SubShapes::initAttributes() -{ +void BuildPlugin_SubShapes::initAttributes() { data()->addAttribute(BASE_SHAPE_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(SUBSHAPES_ID(), ModelAPI_AttributeSelectionList::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SUBSHAPES_ID()); + data()->addAttribute(SUBSHAPES_ID(), + ModelAPI_AttributeSelectionList::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + SUBSHAPES_ID()); } -void BuildPlugin_SubShapes::attributeChanged(const std::string& theID) -{ +void BuildPlugin_SubShapes::attributeChanged(const std::string &theID) { ModelAPI_Feature::attributeChanged(theID); - if(theID == BASE_SHAPE_ID()) { + if (theID == BASE_SHAPE_ID()) { AttributeSelectionPtr aShapeAttrSelection = selection(BASE_SHAPE_ID()); - AttributeSelectionListPtr aSubShapesAttrList = selectionList(SUBSHAPES_ID()); - if(!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) { + AttributeSelectionListPtr aSubShapesAttrList = + selectionList(SUBSHAPES_ID()); + if (!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) { return; } @@ -61,25 +61,27 @@ void BuildPlugin_SubShapes::attributeChanged(const std::string& theID) ResultPtr aContext = aShapeAttrSelection->context(); GeomShapePtr aBaseShape = aShapeAttrSelection->value(); - if(!aBaseShape.get()) { + if (!aBaseShape.get()) { return; } GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType(); - for(GeomAPI_ShapeIterator anIt(aBaseShape); anIt.more(); anIt.next()) { + for (GeomAPI_ShapeIterator anIt(aBaseShape); anIt.more(); anIt.next()) { GeomShapePtr aSubShape = anIt.current(); - if(aBaseShapeType == GeomAPI_Shape::WIRE) { - for(GeomAPI_ShapeIterator aSubIt(aSubShape); aSubIt.more(); aSubIt.next()) { + if (aBaseShapeType == GeomAPI_Shape::WIRE) { + for (GeomAPI_ShapeIterator aSubIt(aSubShape); aSubIt.more(); + aSubIt.next()) { GeomShapePtr aSubOfSubShape = aSubIt.current(); - if(aSubOfSubShape->orientation() == GeomAPI_Shape::INTERNAL) { + if (aSubOfSubShape->orientation() == GeomAPI_Shape::INTERNAL) { aSubShapesAttrList->append(aContext, aSubOfSubShape); } } - } else if(aBaseShapeType == GeomAPI_Shape::FACE) { - if(aSubShape->shapeType() != GeomAPI_Shape::WIRE) { + } else if (aBaseShapeType == GeomAPI_Shape::FACE) { + if (aSubShape->shapeType() != GeomAPI_Shape::WIRE) { aSubShapesAttrList->append(aContext, aSubShape); - } else if(aSubShape->orientation() == GeomAPI_Shape::INTERNAL) { - if(aSubShape->shapeType() == GeomAPI_Shape::WIRE) { - for(GeomAPI_ShapeIterator aWireIt(aSubShape); aWireIt.more(); aWireIt.next()) { + } else if (aSubShape->orientation() == GeomAPI_Shape::INTERNAL) { + if (aSubShape->shapeType() == GeomAPI_Shape::WIRE) { + for (GeomAPI_ShapeIterator aWireIt(aSubShape); aWireIt.more(); + aWireIt.next()) { aSubShapesAttrList->append(aContext, aWireIt.current()); } } @@ -90,33 +92,34 @@ void BuildPlugin_SubShapes::attributeChanged(const std::string& theID) } //================================================================================================== -void BuildPlugin_SubShapes::execute() -{ +void BuildPlugin_SubShapes::execute() { // Get base shape and sub-shapes list. AttributeSelectionPtr aShapeAttrSelection = selection(BASE_SHAPE_ID()); AttributeSelectionListPtr aSubShapesAttrList = selectionList(SUBSHAPES_ID()); - if(!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) { + if (!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) { return; } // Get base shape without internal shapes. GeomShapePtr aBaseShape = aShapeAttrSelection->value(); - if(!aBaseShape.get()) { + if (!aBaseShape.get()) { return; } - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder()); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder()); aBuilder->removeInternal(aBaseShape); GeomShapePtr aResultShape = aBuilder->shape(); // Get list of shapes. ListOfShape aShapesToAdd; - for(int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); + for (int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesAttrList->value(anIndex); aShapesToAdd.push_back(anAttrSelectionInList->value()); } // Copy sub-shapes from list to new shape. - if(!aShapesToAdd.empty()) { + if (!aShapesToAdd.empty()) { aBuilder->addInternal(aResultShape, aShapesToAdd); aResultShape = aBuilder->shape(); } @@ -126,13 +129,9 @@ void BuildPlugin_SubShapes::execute() aResultBody->storeModified(aBaseShape, aResultShape); aResultBody->loadModifiedShapes(aBuilder, aBaseShape, GeomAPI_Shape::EDGE); for (ListOfShape::const_iterator anIt = aShapesToAdd.cbegin(); - anIt != aShapesToAdd.cend(); - ++anIt) - { + anIt != aShapesToAdd.cend(); ++anIt) { GeomAPI_Shape::ShapeType aShType = (*anIt)->shapeType(); - aResultBody->loadModifiedShapes(aBuilder, - *anIt, - aShType); + aResultBody->loadModifiedShapes(aBuilder, *anIt, aShType); } setResult(aResultBody); } diff --git a/src/BuildPlugin/BuildPlugin_SubShapes.h b/src/BuildPlugin/BuildPlugin_SubShapes.h index 77dfe1b39..a06f9b868 100644 --- a/src/BuildPlugin/BuildPlugin_SubShapes.h +++ b/src/BuildPlugin/BuildPlugin_SubShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_SubShapes_H_ @@ -27,46 +28,42 @@ /// \class BuildPlugin_SubShapes /// \ingroup Plugins /// \brief Feature for adding or removing sub-shapes from shape. -class BuildPlugin_SubShapes: public ModelAPI_Feature -{ +class BuildPlugin_SubShapes : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_SubShapes(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("SubShapes"); return MY_ID; } /// Attribute name of base shape. - inline static const std::string& BASE_SHAPE_ID() - { + inline static const std::string &BASE_SHAPE_ID() { static const std::string MY_BASE_SHAPE_ID("base_shape"); return MY_BASE_SHAPE_ID; } /// Attribute name of sub-shapes. - inline static const std::string& SUBSHAPES_ID() - { + inline static const std::string &SUBSHAPES_ID() { static const std::string MY_SUBSHAPES_ID("subshapes"); return MY_SUBSHAPES_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_SubShapes::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object. /// \param[in] theID identifier of changed attribute. - BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates a new part document if needed. BUILDPLUGIN_EXPORT virtual void execute(); diff --git a/src/BuildPlugin/BuildPlugin_Validators.cpp b/src/BuildPlugin/BuildPlugin_Validators.cpp index 8d12b7cad..3af8695d3 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.cpp +++ b/src/BuildPlugin/BuildPlugin_Validators.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Validators.h" -#include "BuildPlugin_Solid.h" #include "BuildPlugin_Face.h" +#include "BuildPlugin_Solid.h" #include "BuildPlugin_Wire.h" #include @@ -32,14 +33,14 @@ #include #include +#include +#include #include #include #include #include -#include -#include #include -#include +#include #include #include @@ -51,63 +52,67 @@ #include //================================================================================================= -bool BuildPlugin_ValidatorBaseForBuild::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool BuildPlugin_ValidatorBaseForBuild::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { // Get base objects list. - if(theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) { - std::string aMsg = "Error: BuildPlugin_ValidatorBaseForBuild does " - "not support attribute type '%1'\nOnly '%2' is supported."; - Events_InfoMessage("BuildPlugin_Validators", aMsg). - arg(theAttribute->attributeType()).arg(ModelAPI_AttributeSelectionList::typeId()).send(); + if (theAttribute->attributeType() != + ModelAPI_AttributeSelectionList::typeId()) { + std::string aMsg = + "Error: BuildPlugin_ValidatorBaseForBuild does " + "not support attribute type '%1'\nOnly '%2' is supported."; + Events_InfoMessage("BuildPlugin_Validators", aMsg) + .arg(theAttribute->attributeType()) + .arg(ModelAPI_AttributeSelectionList::typeId()) + .send(); return false; } AttributeSelectionListPtr aSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!aSelectionList.get()) { + std::dynamic_pointer_cast(theAttribute); + if (!aSelectionList.get()) { theError = "Could not get selection list."; return false; } - if(aSelectionList->size() == 0) { + if (aSelectionList->size() == 0) { theError = "Empty selection list."; return false; } // Collect base shapes. - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); - if(!aSelection.get()) { + if (!aSelection.get()) { theError = "Could not get selection."; return false; } ResultPtr aContext = aSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { theError = "Attribute have empty context."; return false; } GeomShapePtr aShape = aSelection->value(); GeomShapePtr aContextShape = aContext->shape(); - if(!aShape.get()) { + if (!aShape.get()) { aShape = aContextShape; } - if(!aShape.get()) { + if (!aShape.get()) { theError = "Empty shape selected."; return false; } // Check that shapes has acceptable type. GeomValidators_ShapeType aValidatorShapeType; - if(!aValidatorShapeType.isValid(aSelection, theArguments, theError)) { + if (!aValidatorShapeType.isValid(aSelection, theArguments, theError)) { return false; } // Check that it is shape on sketch. ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aContext); - if(aConstruction.get()) { - if(aConstruction->isInfinite()) { + std::dynamic_pointer_cast(aContext); + if (aConstruction.get()) { + if (aConstruction->isInfinite()) { theError = "Infinite objects not acceptable."; return false; } @@ -118,21 +123,22 @@ bool BuildPlugin_ValidatorBaseForBuild::isValid(const AttributePtr& theAttribute } //================================================================================================= -bool BuildPlugin_ValidatorBaseForWire::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool BuildPlugin_ValidatorBaseForWire::isValid( + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { // Get attribute. - AttributeSelectionListPtr aSelectionList = theFeature->selectionList(theArguments.front()); - if(!aSelectionList.get()) { + AttributeSelectionListPtr aSelectionList = + theFeature->selectionList(theArguments.front()); + if (!aSelectionList.get()) { theError = "Empty attribute \"%1\"."; theError.arg(theArguments.front()); return false; } if (theFeature->getKind() == BuildPlugin_Wire::ID()) { - /// remove objects of sub-type if ojects of correct type is in List, in some cases : - /// Wire builder: wires and edges selected + /// remove objects of sub-type if ojects of correct type is in List, in + /// some cases : Wire builder: wires and edges selected std::set aRemove; for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); @@ -152,8 +158,7 @@ bool BuildPlugin_ValidatorBaseForWire::isValid(const std::shared_ptrisEqual(aEdge) || aShp->isSameGeometry(aEdge)) aRemove.insert(i); } - } - else { + } else { aRemove.insert(anIndex); } } @@ -165,18 +170,20 @@ bool BuildPlugin_ValidatorBaseForWire::isValid(const std::shared_ptrremove(aRemove); } - GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::shapeTypeByStr(theArguments.back()); + GeomAPI_Shape::ShapeType aShapeType = + GeomAPI_Shape::shapeTypeByStr(theArguments.back()); // Collect base shapes. ListOfShape aListOfShapes; - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); ResultPtr aContext = aSelection->context(); if (!aShape.get() && aContext.get()) aShape = aContext->shape(); - bool isProper = aShape.get() && - (aShape->shapeType() == GeomAPI_Shape::EDGE || aShape->shapeType() == aShapeType); + bool isProper = + aShape.get() && (aShape->shapeType() == GeomAPI_Shape::EDGE || + aShape->shapeType() == aShapeType); if (isProper) aListOfShapes.push_back(aShape); @@ -208,7 +215,8 @@ bool BuildPlugin_ValidatorBaseForWire::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool BuildPlugin_ValidatorBaseForFace::isValid( + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { // Get attribute. - if(theArguments.size() != 1) { - std::string aMsg = "Error: BuildPlugin_ValidatorBaseForFace should be used only with " - "1 parameter (ID of base objects list)."; + if (theArguments.size() != 1) { + std::string aMsg = + "Error: BuildPlugin_ValidatorBaseForFace should be used only with " + "1 parameter (ID of base objects list)."; Events_InfoMessage("BuildPlugin_Validators", aMsg).send(); return false; } - AttributeSelectionListPtr aSelectionList = theFeature->selectionList(theArguments.front()); - if(!aSelectionList.get()) { + AttributeSelectionListPtr aSelectionList = + theFeature->selectionList(theArguments.front()); + if (!aSelectionList.get()) { theError = "Empty attribute \"%1\"."; theError.arg(theArguments.front()); return false; } if (theFeature->getKind() == BuildPlugin_Face::ID()) { - /// remove objects of sub-type if ojects of correct type is in List, in some cases : + /// remove objects of sub-type if ojects of correct type is in List, in + /// some cases : /// - Face builder: edges, faces and wires selected /// --> remove edges and wires std::set aRemove; @@ -258,8 +269,7 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrisEqual(aWire) || aShp->isSameGeometry(aWire)) aRemove.insert(i); } - } - else { + } else { aRemove.insert(anIndex); } } @@ -277,8 +287,7 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrisEqual(aEdge) || aShp->isSameGeometry(aEdge)) aRemove.insert(i); } - } - else { + } else { aRemove.insert(anIndex); } } @@ -296,10 +305,10 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrsize(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); - if(!aShape.get()) { + if (!aShape.get()) { if (!aSelection->context()) { theError = "Objects are not selected."; return false; @@ -307,7 +316,8 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrcontext()->shape(); } ResultConstructionPtr aSketchRes = - std::dynamic_pointer_cast(aSelection->context()); + std::dynamic_pointer_cast( + aSelection->context()); if (aShape->shapeType() == GeomAPI_Shape::FACE || (!aSelection->value() && aSketchRes && aSketchRes->facesNum() > 0)) { @@ -317,11 +327,13 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrisPlanar()); - for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { hasEdgesOrWires = true; GeomShapePtr anEdge = anExp.current(); anAllEdges.push_back(anEdge); - isPlanar? aPlanarEdges.push_back(anEdge): aNonPlanarEdges.push_back(anEdge); + isPlanar ? aPlanarEdges.push_back(anEdge) + : aNonPlanarEdges.push_back(anEdge); } } @@ -334,20 +346,20 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptr 1) { + if (anAllEdges.size() > 1) { GeomAlgoAPI_PaveFiller aPaveFiller(anAllEdges, false); - if(!aPaveFiller.isDone()) { + if (!aPaveFiller.isDone()) { theError = "Error while checking if edges intersects."; return false; } GeomShapePtr aSectedEdges = aPaveFiller.shape(); size_t anEdgesNum = 0; - for(GeomAPI_ShapeExplorer - anExp(aSectedEdges, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aSectedEdges, GeomAPI_Shape::EDGE); + anExp.more(); anExp.next()) { anEdgesNum++; } - if(anEdgesNum != anAllEdges.size()) { + if (anEdgesNum != anAllEdges.size()) { theError = "Selected objects have intersections."; return false; } @@ -355,41 +367,43 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptr aPln = GeomAlgoAPI_ShapeTools::findPlane(anAllEdges); - if(aPln.get()) { - // Check that selected objects have closed contours. + std::shared_ptr aPln = + GeomAlgoAPI_ShapeTools::findPlane(anAllEdges); + if (aPln.get()) { + // Check that selected objects have closed contours. GeomAlgoAPI_SketchBuilder aBuilder(aPln, anAllEdges); - const ListOfShape& aFaces = aBuilder.faces(); - if(!aFaces.empty()) { + const ListOfShape &aFaces = aBuilder.faces(); + if (!aFaces.empty()) { return true; } } } - - //check only planar onjects + // check only planar onjects bool isPlanarBelongToOnePlane(false); if (!aPlanarEdges.empty()) { // Check that they are planar. - std::shared_ptr aPln = GeomAlgoAPI_ShapeTools::findPlane(aPlanarEdges); - if(aPln.get()) { + std::shared_ptr aPln = + GeomAlgoAPI_ShapeTools::findPlane(aPlanarEdges); + if (aPln.get()) { // Check that selected objects have closed contours. isPlanarBelongToOnePlane = true; GeomAlgoAPI_SketchBuilder aBuilder(aPln, aPlanarEdges); - const ListOfShape& aFaces = aBuilder.faces(); - if(aFaces.empty()) { + const ListOfShape &aFaces = aBuilder.faces(); + if (aFaces.empty()) { theError = "Selected planar objects do not generate closed contour."; return false; } } } - //check non planar objects - if(!aNonPlanarEdges.empty() || (!aPlanarEdges.empty() && !isPlanarBelongToOnePlane)) - { - GeomAlgoAPI_NonPlanarFace aNonPlanarFaceBuilder(isPlanarBelongToOnePlane? aNonPlanarEdges : anAllEdges); - const ListOfShape& aFaces = aNonPlanarFaceBuilder.faces(); - if(aFaces.empty()) { + // check non planar objects + if (!aNonPlanarEdges.empty() || + (!aPlanarEdges.empty() && !isPlanarBelongToOnePlane)) { + GeomAlgoAPI_NonPlanarFace aNonPlanarFaceBuilder( + isPlanarBelongToOnePlane ? aNonPlanarEdges : anAllEdges); + const ListOfShape &aFaces = aNonPlanarFaceBuilder.faces(); + if (aFaces.empty()) { theError = "Selected non-planar objects do not generate closed contour."; return false; } @@ -400,11 +414,12 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptr& theFeature, const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { // Get base objects list. - AttributeSelectionListPtr aSelectionList = theFeature->selectionList(theArguments.front()); + AttributeSelectionListPtr aSelectionList = + theFeature->selectionList(theArguments.front()); if (!aSelectionList.get()) { theError = "Could not get selection list."; return false; @@ -415,8 +430,8 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( } if (theFeature->getKind() == BuildPlugin_Solid::ID()) { - /// remove objects of sub-type if ojects of correct type is in List, in some cases : - /// Solid builder: faces and shapes shells or solids seleted + /// remove objects of sub-type if ojects of correct type is in List, in + /// some cases : Solid builder: faces and shapes shells or solids seleted /// --> remove faces std::set aRemove; @@ -426,8 +441,8 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( if (aShape.get()) { GeomAPI_Shape::ShapeType aType = aShape->shapeType(); if ((aType == GeomAPI_Shape::SHAPE) || - (aType == GeomAPI_Shape::SOLID) || - (aType == GeomAPI_Shape::SHELL)) { + (aType == GeomAPI_Shape::SOLID) || + (aType == GeomAPI_Shape::SHELL)) { GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::FACE); for (; anExp.more(); anExp.next()) { @@ -440,8 +455,7 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( if (aShp->isEqual(aFace)) aRemove.insert(i); } - } - else { + } else { aRemove.insert(anIndex); } } @@ -468,10 +482,11 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( } std::shared_ptr anAlgorithm( - new GeomAlgoAPI_MakeVolume(anOriginalShapes, false)); + new GeomAlgoAPI_MakeVolume(anOriginalShapes, false)); std::string anErr; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgorithm, "MakeVolume", anErr)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgorithm, "MakeVolume", + anErr)) { theError = anErr; return false; } @@ -506,7 +521,8 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( return false; } // check the internal faces presence - for(GeomAPI_ShapeExplorer aFaces(aCompound, GeomAPI_Shape::FACE); aFaces.more(); aFaces.next()) { + for (GeomAPI_ShapeExplorer aFaces(aCompound, GeomAPI_Shape::FACE); + aFaces.more(); aFaces.next()) { if (aFaces.current()->orientation() == GeomAPI_Shape::INTERNAL) { theError = "Internal faces are not allowed in the resulting solid"; return false; @@ -516,35 +532,38 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( return true; } - //================================================================================================= -bool BuildPlugin_ValidatorSubShapesSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - if(theArguments.size() != 1) { +bool BuildPlugin_ValidatorSubShapesSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + if (theArguments.size() != 1) { // LCOV_EXCL_START - std::string aMsg = "Error: BuildPlugin_ValidatorSubShapesSelection should be used only with " - "1 parameter(Sketch feature id)."; + std::string aMsg = "Error: BuildPlugin_ValidatorSubShapesSelection should " + "be used only with " + "1 parameter(Sketch feature id)."; Events_InfoMessage("BuildPlugin_Validators", aMsg).send(); return false; // LCOV_EXCL_STOP } // Get base objects list. - if(theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) { + if (theAttribute->attributeType() != + ModelAPI_AttributeSelectionList::typeId()) { // LCOV_EXCL_START - std::string aMsg = - "Error: BuildPlugin_ValidatorSubShapesSelection does not support attribute type \"" - "%1\"\n Only \"%2\" supported."; - Events_InfoMessage("BuildPlugin_Validators", aMsg). - arg(theAttribute->attributeType()).arg(ModelAPI_AttributeSelectionList::typeId()).send(); + std::string aMsg = "Error: BuildPlugin_ValidatorSubShapesSelection does " + "not support attribute type \"" + "%1\"\n Only \"%2\" supported."; + Events_InfoMessage("BuildPlugin_Validators", aMsg) + .arg(theAttribute->attributeType()) + .arg(ModelAPI_AttributeSelectionList::typeId()) + .send(); return false; // LCOV_EXCL_STOP } AttributeSelectionListPtr aSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!aSelectionList.get()) { + std::dynamic_pointer_cast(theAttribute); + if (!aSelectionList.get()) { theError = "Could not get selection list."; return false; } @@ -554,15 +573,15 @@ bool BuildPlugin_ValidatorSubShapesSelection::isValid(const AttributePtr& theAtt FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr aShapeAttrSelection = aFeature->selection(aBaseShapeId); - if(!aShapeAttrSelection.get()) { + if (!aShapeAttrSelection.get()) { theError = "Base shape is empty."; return false; } ResultPtr aBaseContext = aShapeAttrSelection->context(); - GeomShapePtr aBaseShape = aShapeAttrSelection->value(); - if(!aBaseShape.get()) { + GeomShapePtr aBaseShape = aShapeAttrSelection->value(); + if (!aBaseShape.get()) { theError = "Base shape is empty."; return false; } @@ -571,47 +590,54 @@ bool BuildPlugin_ValidatorSubShapesSelection::isValid(const AttributePtr& theAtt aBuilder.removeInternal(aBaseShape); aBaseShape = aBuilder.shape(); - // If selected shape is wire allow to select only vertices. If face - allow vertices and edges. + // If selected shape is wire allow to select only vertices. If face - allow + // vertices and edges. std::set anAllowedTypes; - switch(aBaseShape->shapeType()) { - case GeomAPI_Shape::FACE: anAllowedTypes.insert(GeomAPI_Shape::EDGE); - case GeomAPI_Shape::WIRE: anAllowedTypes.insert(GeomAPI_Shape::VERTEX); - default: break; + switch (aBaseShape->shapeType()) { + case GeomAPI_Shape::FACE: + anAllowedTypes.insert(GeomAPI_Shape::EDGE); + case GeomAPI_Shape::WIRE: + anAllowedTypes.insert(GeomAPI_Shape::VERTEX); + default: + break; } // Check selected shapes. GeomValidators_FeatureKind aFeatureKindValidator; std::list anArguments; anArguments.push_back(theArguments.front()); - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelectionAttrInList = aSelectionList->value(anIndex); - if(!aSelectionAttrInList.get()) { + if (!aSelectionAttrInList.get()) { theError = "Empty attribute in list."; return false; } // If context of selection same skip. - if(aBaseContext == aSelectionAttrInList->context()) { + if (aBaseContext == aSelectionAttrInList->context()) { continue; } // Check that it is a selection on Sketch. - if(!aFeatureKindValidator.isValid(aSelectionAttrInList, anArguments, theError)) { + if (!aFeatureKindValidator.isValid(aSelectionAttrInList, anArguments, + theError)) { return false; } // Check shape type. GeomShapePtr aShapeInList = aSelectionAttrInList->value(); - if(!aShapeInList.get()) { + if (!aShapeInList.get()) { aShapeInList = aSelectionAttrInList->context()->shape(); } - if(anAllowedTypes.find(aShapeInList->shapeType()) == anAllowedTypes.cend()) { + if (anAllowedTypes.find(aShapeInList->shapeType()) == + anAllowedTypes.cend()) { theError = "Selected shape has unacceptable type."; return false; } // Check that shape inside wire or face. - if(!GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(aShapeInList, aBaseShape)) { + if (!GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(aShapeInList, + aBaseShape)) { theError = "Selected shape is not inside base face."; return false; } @@ -620,31 +646,33 @@ bool BuildPlugin_ValidatorSubShapesSelection::isValid(const AttributePtr& theAtt return true; } - //================================================================================================= -bool BuildPlugin_ValidatorFillingSelection::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool BuildPlugin_ValidatorFillingSelection::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { // Get base objects list. - if (theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) { + if (theAttribute->attributeType() != + ModelAPI_AttributeSelectionList::typeId()) { // LCOV_EXCL_START - std::string aMsg = - "Error: BuildPlugin_ValidatorFillingSelection does not support attribute type \"" - "%1\"\n Only \"%2\" supported."; - Events_InfoMessage("BuildPlugin_Validators", aMsg). - arg(theAttribute->attributeType()).arg(ModelAPI_AttributeSelectionList::typeId()).send(); + std::string aMsg = "Error: BuildPlugin_ValidatorFillingSelection does not " + "support attribute type \"" + "%1\"\n Only \"%2\" supported."; + Events_InfoMessage("BuildPlugin_Validators", aMsg) + .arg(theAttribute->attributeType()) + .arg(ModelAPI_AttributeSelectionList::typeId()) + .send(); return false; // LCOV_EXCL_STOP } AttributeSelectionListPtr aSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!aSelectionList.get()) { theError = "Could not get selection list."; return false; } - //FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); + // FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); // Check selected shapes. for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { @@ -672,19 +700,18 @@ bool BuildPlugin_ValidatorFillingSelection::isValid(const AttributePtr& theAttri return true; } - //================================================================================================= -bool BuildPlugin_ValidatorBaseForVertex::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool BuildPlugin_ValidatorBaseForVertex::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { if (!theAttribute.get()) { theError = "Error: empty selection."; return false; } AttributeSelectionListPtr aSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!aSelectionList.get()) { theError = "Could not get selection list."; return false; @@ -734,11 +761,12 @@ bool BuildPlugin_ValidatorBaseForVertex::isValid(const AttributePtr& theAttribut } //================================================================================================= -bool BuildPlugin_ValidatorExpressionInterpolation::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); +bool BuildPlugin_ValidatorExpressionInterpolation::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(theAttribute); @@ -753,6 +781,7 @@ bool BuildPlugin_ValidatorExpressionInterpolation::isValid(const AttributePtr& t return false; } - theError = aFeature->string(BuildPlugin_Interpolation::EXPRESSION_ERROR_ID())->value(); + theError = aFeature->string(BuildPlugin_Interpolation::EXPRESSION_ERROR_ID()) + ->value(); return theError.empty(); } diff --git a/src/BuildPlugin/BuildPlugin_Validators.h b/src/BuildPlugin/BuildPlugin_Validators.h index 709e9d5ac..5c8703585 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.h +++ b/src/BuildPlugin/BuildPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Validators_H_ @@ -28,124 +29,121 @@ /// \brief A validator for selection base shapes for build features. /// Allows to select shapes on sketch and /// whole objects with allowed type. -class BuildPlugin_ValidatorBaseForBuild: public ModelAPI_AttributeValidator -{ +class BuildPlugin_ValidatorBaseForBuild : public ModelAPI_AttributeValidator { public: //! Returns true if attribute is ok. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class BuildPlugin_ValidatorBaseForWire /// \ingroup Validators -/// \brief A validator for selection base shapes for wire. Allows to select edges on sketch and -/// wires objects that are connected to already selected shapes. -class BuildPlugin_ValidatorBaseForWire: public ModelAPI_FeatureValidator -{ +/// \brief A validator for selection base shapes for wire. Allows to select +/// edges on sketch and wires objects that are connected to already selected +/// shapes. +class BuildPlugin_ValidatorBaseForWire : public ModelAPI_FeatureValidator { public: //! Returns true if attributes is ok. //! \param theFeature the checked feature. //! \param theArguments arguments of the feature. //! \param theError error message. - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class BuildPlugin_ValidatorBaseForFace /// \ingroup Validators -/// \brief A validator for selection base shapes for face. Allows to select sketch edges, edges and -/// wires objects that lie in the same plane and don't have intersections. -class BuildPlugin_ValidatorBaseForFace: public ModelAPI_FeatureValidator -{ +/// \brief A validator for selection base shapes for face. Allows to select +/// sketch edges, edges and wires objects that lie in the same plane and don't +/// have intersections. +class BuildPlugin_ValidatorBaseForFace : public ModelAPI_FeatureValidator { public: //! Returns true if attributes is ok. //! \param theFeature the checked feature. //! \param theArguments arguments of the feature. //! \param theError error message. - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class BuildPlugin_ValidatorBaseForSolids /// \ingroup Validators -/// \brief A validator for selection base shapes for solid. Allows to select faces closed enough -/// to create a solid. -class BuildPlugin_ValidatorBaseForSolids: public ModelAPI_FeatureValidator -{ +/// \brief A validator for selection base shapes for solid. Allows to select +/// faces closed enough to create a solid. +class BuildPlugin_ValidatorBaseForSolids : public ModelAPI_FeatureValidator { public: //! Returns true if attributes is ok. //! \param theFeature the checked feature. //! \param theArguments arguments of the feature. //! \param theError error message. - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class BuildPlugin_ValidatorSubShapesSelection /// \ingroup Validators /// \brief A validator for selection sub-shapes for SubShape feature. -class BuildPlugin_ValidatorSubShapesSelection: public ModelAPI_AttributeValidator -{ +class BuildPlugin_ValidatorSubShapesSelection + : public ModelAPI_AttributeValidator { public: //! Returns true if attribute is ok. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class BuildPlugin_ValidatorFillingSelection /// \ingroup Validators /// \brief A validator for selection of Filling feature. -class BuildPlugin_ValidatorFillingSelection: public ModelAPI_AttributeValidator -{ +class BuildPlugin_ValidatorFillingSelection + : public ModelAPI_AttributeValidator { public: //! Returns true if attribute is ok. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class BuildPlugin_ValidatorBaseForVertex /// \ingroup Validators /// \brief A validator for selection of Vertex feature. -class BuildPlugin_ValidatorBaseForVertex: public ModelAPI_AttributeValidator -{ +class BuildPlugin_ValidatorBaseForVertex : public ModelAPI_AttributeValidator { public: //! Returns true if attribute is ok. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - /// \class BuildPlugin_ValidatorExpression - /// \ingroup Validators - /// \brief Validator for the expression of parameter. -class BuildPlugin_ValidatorExpressionInterpolation: public ModelAPI_AttributeValidator -{ +/// \class BuildPlugin_ValidatorExpression +/// \ingroup Validators +/// \brief Validator for the expression of parameter. +class BuildPlugin_ValidatorExpressionInterpolation + : public ModelAPI_AttributeValidator { public: - //! Returns true if attribute has a valid parameter expression. - //! \param theAttribute the checked attribute - //! \param theArguments arguments of the attribute - //! \param theError the error string message if validation fails - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + //! Returns true if attribute has a valid parameter expression. + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute + //! \param theError the error string message if validation fails + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Vertex.cpp b/src/BuildPlugin/BuildPlugin_Vertex.cpp index 058b664b0..d893c0373 100644 --- a/src/BuildPlugin/BuildPlugin_Vertex.cpp +++ b/src/BuildPlugin/BuildPlugin_Vertex.cpp @@ -14,64 +14,65 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Vertex.h" -#include #include +#include #include #include -#include #include +#include #include #include #include -#include #include #include +#include #include //================================================================================================= -BuildPlugin_Vertex::BuildPlugin_Vertex() -{ -} +BuildPlugin_Vertex::BuildPlugin_Vertex() {} //================================================================================================= -void BuildPlugin_Vertex::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Vertex::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(INTERSECT_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), INTERSECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + INTERSECT_ID()); } -void BuildPlugin_Vertex::buildVertices(const ListOfShape& theShapes, bool isIntersect) -{ +void BuildPlugin_Vertex::buildVertices(const ListOfShape &theShapes, + bool isIntersect) { GeomShapePtr aResult; std::shared_ptr aPartitionAlgo; if (isIntersect) { aPartitionAlgo.reset(new GeomAlgoAPI_Partition(theShapes, ListOfShape())); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, + getKind(), anError)) { setError(anError); return; } aResult = aPartitionAlgo->shape(); - } - else + } else aResult = GeomAlgoAPI_CompoundBuilder::compound(theShapes); int aResultIndex = 0; // Explode on vertices std::set aProcessed; - for (GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::VERTEX); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::VERTEX); + anExp.more(); anExp.next()) { GeomVertexPtr aVertex(new GeomAPI_Vertex(anExp.current())); if (aProcessed.find(aVertex) != aProcessed.end()) continue; // vertex is already processed @@ -80,7 +81,8 @@ void BuildPlugin_Vertex::buildVertices(const ListOfShape& theShapes, bool isInte std::shared_ptr aCopy(new GeomAlgoAPI_Copy(aVertex)); aVertex.reset(new GeomAPI_Vertex(aCopy->shape())); - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); if (aPartitionAlgo) aMakeShapeList->appendAlgo(aPartitionAlgo); aMakeShapeList->appendAlgo(aCopy); @@ -95,8 +97,8 @@ void BuildPlugin_Vertex::buildVertices(const ListOfShape& theShapes, bool isInte removeResults(aResultIndex); } -static void collectEdgesAndVertices(AttributeSelectionPtr theSelection, ListOfShape& thePrimitives) -{ +static void collectEdgesAndVertices(AttributeSelectionPtr theSelection, + ListOfShape &thePrimitives) { FeaturePtr aFeature = theSelection->contextFeature(); ResultPtr aContext = theSelection->context(); GeomShapePtr aShape = theSelection->value(); @@ -109,7 +111,7 @@ static void collectEdgesAndVertices(AttributeSelectionPtr theSelection, ListOfSh return; // process results of the feature - const std::list& aResults = aFeature->results(); + const std::list &aResults = aFeature->results(); std::list::const_iterator anIt = aResults.begin(); for (; anIt != aResults.end(); ++anIt) thePrimitives.push_back((*anIt)->shape()); @@ -122,7 +124,7 @@ static void collectEdgesAndVertices(AttributeSelectionPtr theSelection, ListOfSh // add construction points (centers of circles, etc.) for (int i = 0, nbSubs = aComposite->numberOfSubs(); i < nbSubs; ++i) { FeaturePtr aSubFeature = aComposite->subFeature(i); - const std::list& aSubResults = aSubFeature->results(); + const std::list &aSubResults = aSubFeature->results(); // find all points for (anIt = aSubResults.begin(); anIt != aSubResults.cend(); ++anIt) { GeomShapePtr aSubResShape = (*anIt)->shape(); @@ -133,8 +135,7 @@ static void collectEdgesAndVertices(AttributeSelectionPtr theSelection, ListOfSh } } -void BuildPlugin_Vertex::execute() -{ +void BuildPlugin_Vertex::execute() { // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); if (!aSelectionList.get()) { @@ -148,7 +149,8 @@ void BuildPlugin_Vertex::execute() // Get "Compute intersections" flag value bool isIntersect = false; - if (boolean(INTERSECT_ID()).get() && boolean(INTERSECT_ID())->isInitialized()) { + if (boolean(INTERSECT_ID()).get() && + boolean(INTERSECT_ID())->isInitialized()) { isIntersect = boolean(INTERSECT_ID())->value(); } diff --git a/src/BuildPlugin/BuildPlugin_Vertex.h b/src/BuildPlugin/BuildPlugin_Vertex.h index 1c58a5338..057c77caf 100644 --- a/src/BuildPlugin/BuildPlugin_Vertex.h +++ b/src/BuildPlugin/BuildPlugin_Vertex.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Vertex_H_ @@ -22,54 +23,51 @@ #include "BuildPlugin.h" -#include #include +#include /// \class BuildPlugin_Vertex /// \ingroup Plugins -/// \brief Feature for creation of vertex from sketch vertex or existing vertices. -class BuildPlugin_Vertex: public ModelAPI_Feature -{ +/// \brief Feature for creation of vertex from sketch vertex or existing +/// vertices. +class BuildPlugin_Vertex : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_Vertex(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Vertex"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of "Compute intersections" checkbox. - inline static const std::string& INTERSECT_ID() - { + inline static const std::string &INTERSECT_ID() { static const std::string MY_INTERSECT_ID("intersect"); return MY_INTERSECT_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Vertex::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. BUILDPLUGIN_EXPORT virtual void execute(); protected: - void buildVertices(const ListOfShape& theShapes, bool isIntersect); + void buildVertices(const ListOfShape &theShapes, bool isIntersect); }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Wire.cpp b/src/BuildPlugin/BuildPlugin_Wire.cpp index f39e30d51..a2b23939e 100644 --- a/src/BuildPlugin/BuildPlugin_Wire.cpp +++ b/src/BuildPlugin/BuildPlugin_Wire.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "BuildPlugin_Wire.h" @@ -42,62 +43,65 @@ #include -static bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, - bool isIntersect, - ListOfShape& theWires, GeomMakeShapePtr& theAlgo, - std::string& theError); +static bool buildSketchWires(FeaturePtr theSketchFeature, + GeomShapePtr theSketchShape, bool isIntersect, + ListOfShape &theWires, GeomMakeShapePtr &theAlgo, + std::string &theError); -static bool buildWire(const ListOfShape& theEdges, GeomShapePtr& theWire, std::string& theError); +static bool buildWire(const ListOfShape &theEdges, GeomShapePtr &theWire, + std::string &theError); //================================================================================================= -BuildPlugin_Wire::BuildPlugin_Wire() -{ -} +BuildPlugin_Wire::BuildPlugin_Wire() {} //================================================================================================= -void BuildPlugin_Wire::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void BuildPlugin_Wire::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(INTERSECT_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), INTERSECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + INTERSECT_ID()); } //================================================================================================= -void BuildPlugin_Wire::execute() -{ +void BuildPlugin_Wire::execute() { // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); - if(!aSelectionList.get()) { + if (!aSelectionList.get()) { setError("Error: Could not get selection list."); return; } - if(aSelectionList->size() == 0) { + if (aSelectionList->size() == 0) { setError("Error: Empty selection list."); return; } AttributeBooleanPtr anIntersectAttr = boolean(INTERSECT_ID()); - bool isIntersect = anIntersectAttr->isInitialized() && anIntersectAttr->value(); + bool isIntersect = + anIntersectAttr->isInitialized() && anIntersectAttr->value(); // Collect base shapes. ListOfShape anEdges; - std::list< std::pair > aSketches; - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + std::list> aSketches; + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); - if(!aShape.get()) { + if (!aShape.get()) { aShape = aSelection->context()->shape(); std::shared_ptr aSketchShape = std::dynamic_pointer_cast(aShape); if (aSketchShape) { - FeaturePtr aSketchFeature = ModelAPI_Feature::feature(aSelection->context()); - aSketches.push_back(std::pair(aSketchFeature, aSketchShape)); + FeaturePtr aSketchFeature = + ModelAPI_Feature::feature(aSelection->context()); + aSketches.push_back( + std::pair(aSketchFeature, aSketchShape)); continue; } } - for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { GeomShapePtr anEdge = anExp.current(); anEdges.push_back(anEdge); } @@ -117,9 +121,11 @@ void BuildPlugin_Wire::execute() // Store result. ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); aResultBody->store(aWire); - for (GeomAPI_ShapeExplorer anExp(aWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aWire, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { GeomShapePtr anEdgeInResult = anExp.current(); - for (ListOfShape::const_iterator anIt = anEdges.cbegin(); anIt != anEdges.cend(); ++anIt) { + for (ListOfShape::const_iterator anIt = anEdges.cbegin(); + anIt != anEdges.cend(); ++anIt) { std::shared_ptr anEdgeInList(new GeomAPI_Edge(*anIt)); if (anEdgeInList->isEqual(anEdgeInResult)) { if (anEdgeInList->isSame(anEdgeInResult)) @@ -135,22 +141,25 @@ void BuildPlugin_Wire::execute() } // create wires from sketches - for (std::list >::iterator anIt = aSketches.begin(); + for (std::list>::iterator anIt = + aSketches.begin(); anIt != aSketches.end(); ++anIt) { ListOfShape aWires; GeomMakeShapePtr aMakeShapeList; - if (!buildSketchWires(anIt->first, anIt->second, isIntersect, - aWires, aMakeShapeList, anError)) { + if (!buildSketchWires(anIt->first, anIt->second, isIntersect, aWires, + aMakeShapeList, anError)) { setError(anError); return; } - for (ListOfShape::iterator aWIt = aWires.begin(); aWIt != aWires.end(); ++aWIt) { + for (ListOfShape::iterator aWIt = aWires.begin(); aWIt != aWires.end(); + ++aWIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ListOfShape aSketch; aSketch.push_back(anIt->second); aResultBody->storeModified(aSketch, *aWIt, aMakeShapeList); - aResultBody->loadModifiedShapes(aMakeShapeList, anIt->second, GeomAPI_Shape::EDGE); + aResultBody->loadModifiedShapes(aMakeShapeList, anIt->second, + GeomAPI_Shape::EDGE); setResult(aResultBody, aResultIndex); ++aResultIndex; } @@ -160,59 +169,61 @@ void BuildPlugin_Wire::execute() } //================================================================================================= -bool BuildPlugin_Wire::customAction(const std::string& theActionId) -{ - if(theActionId == ADD_CONTOUR_ACTION_ID()) { +bool BuildPlugin_Wire::customAction(const std::string &theActionId) { + if (theActionId == ADD_CONTOUR_ACTION_ID()) { return addContour(); } else { std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\"."; - Events_InfoMessage("BuildPlugin_Wire", aMsg).arg(getKind()).arg(theActionId).send(); + Events_InfoMessage("BuildPlugin_Wire", aMsg) + .arg(getKind()) + .arg(theActionId) + .send(); } return false; } //================================================================================================= -bool BuildPlugin_Wire::addContour() -{ +bool BuildPlugin_Wire::addContour() { // Get base objects list. AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); - if(aSelectionList->size() == 0) { - Events_InfoMessage("BuildPlugin_Wire", "Error: Empty selection list.").send(); + if (aSelectionList->size() == 0) { + Events_InfoMessage("BuildPlugin_Wire", "Error: Empty selection list.") + .send(); return false; } // Collect attributes to check. ListOfShape anAddedEdges; std::list anAttributesToCheck; - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr anEdgeInList = aSelection->value(); - if(!anEdgeInList.get()) { + if (!anEdgeInList.get()) { continue; } // Check that it is edge. - if(anEdgeInList->shapeType() != GeomAPI_Shape::EDGE) { + if (anEdgeInList->shapeType() != GeomAPI_Shape::EDGE) { continue; } // Check that it is edge on sketch. ResultPtr aContext = aSelection->context(); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aContext); - if(!aConstruction.get()) { + std::dynamic_pointer_cast(aContext); + if (!aConstruction.get()) { continue; } GeomShapePtr aContextShape = aConstruction->shape(); std::shared_ptr aPlanarEdges = - std::dynamic_pointer_cast(aContextShape); - if(!aPlanarEdges.get()) { + std::dynamic_pointer_cast(aContextShape); + if (!aPlanarEdges.get()) { continue; } // Check that sketch have faces. - if(aConstruction->facesNum() == 0) { + if (aConstruction->facesNum() == 0) { continue; } @@ -222,48 +233,52 @@ bool BuildPlugin_Wire::addContour() // Check if edges have contours. bool isAnyContourAdded = false; - for(std::list::const_iterator aListIt = anAttributesToCheck.cbegin(); - aListIt != anAttributesToCheck.cend(); - ++aListIt) { + for (std::list::const_iterator aListIt = + anAttributesToCheck.cbegin(); + aListIt != anAttributesToCheck.cend(); ++aListIt) { AttributeSelectionPtr aSelection = *aListIt; - std::shared_ptr anEdgeInList(new GeomAPI_Edge(aSelection->value())); + std::shared_ptr anEdgeInList( + new GeomAPI_Edge(aSelection->value())); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aSelection->context()); + std::dynamic_pointer_cast( + aSelection->context()); // Iterate on wires and add wire with this edge. std::shared_ptr aFoundWire; - for(int anIndex = 0; anIndex < aConstruction->facesNum(); ++anIndex) { + for (int anIndex = 0; anIndex < aConstruction->facesNum(); ++anIndex) { std::shared_ptr aFace = aConstruction->face(anIndex); - for(GeomAPI_ShapeExplorer - aWireExp(aFace, GeomAPI_Shape::WIRE); aWireExp.more(); aWireExp.next()) { + for (GeomAPI_ShapeExplorer aWireExp(aFace, GeomAPI_Shape::WIRE); + aWireExp.more(); aWireExp.next()) { GeomShapePtr aWireOnFace = aWireExp.current(); - for(GeomAPI_ShapeExplorer - anExp(aWireOnFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { - std::shared_ptr anEdgeOnFace(new GeomAPI_Edge(anExp.current())); - if(anEdgeInList->isEqual(anEdgeOnFace)) { + for (GeomAPI_ShapeExplorer anExp(aWireOnFace, GeomAPI_Shape::EDGE); + anExp.more(); anExp.next()) { + std::shared_ptr anEdgeOnFace( + new GeomAPI_Edge(anExp.current())); + if (anEdgeInList->isEqual(anEdgeOnFace)) { aFoundWire = aWireOnFace; break; } } } - if(aFoundWire.get()) { + if (aFoundWire.get()) { break; } } // If wire with the same edge found. Add all other edges to list. - if(aFoundWire.get()) { - for(GeomAPI_ShapeExplorer - anExp(aFoundWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { - std::shared_ptr anEdgeOnFace(new GeomAPI_Edge(anExp.current())); + if (aFoundWire.get()) { + for (GeomAPI_ShapeExplorer anExp(aFoundWire, GeomAPI_Shape::EDGE); + anExp.more(); anExp.next()) { + std::shared_ptr anEdgeOnFace( + new GeomAPI_Edge(anExp.current())); ListOfShape::const_iterator anEdgesIt = anAddedEdges.cbegin(); - for(; anEdgesIt != anAddedEdges.cend(); ++anEdgesIt) { - if(anEdgeOnFace->isEqual(*anEdgesIt)) { + for (; anEdgesIt != anAddedEdges.cend(); ++anEdgesIt) { + if (anEdgeOnFace->isEqual(*anEdgesIt)) { break; } } - if(anEdgesIt == anAddedEdges.cend()) { + if (anEdgesIt == anAddedEdges.cend()) { isAnyContourAdded = true; anAddedEdges.push_back(anEdgeOnFace); aSelectionList->append(aConstruction, anEdgeOnFace); @@ -272,36 +287,40 @@ bool BuildPlugin_Wire::addContour() } } - if(!isAnyContourAdded) { + if (!isAnyContourAdded) { Events_InfoMessage("BuildPlugin_Wire", - "Error: Contours already closed or no contours found for selected edges.").send(); + "Error: Contours already closed or no contours found " + "for selected edges.") + .send(); return false; } return true; } +// ===================== Auxiliary functions +// ============================================== - -// ===================== Auxiliary functions ============================================== - -bool buildWire(const ListOfShape& theEdges, GeomShapePtr& theWire, std::string& theError) -{ +bool buildWire(const ListOfShape &theEdges, GeomShapePtr &theWire, + std::string &theError) { theWire = GeomAlgoAPI_WireBuilder::wire(theEdges); if (!theWire.get()) { - theError = "Error: Result wire is empty. Probably it has disconnected edges or non-manifold."; + theError = "Error: Result wire is empty. Probably it has disconnected " + "edges or non-manifold."; return false; } return true; } -bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, bool isIntersect, - ListOfShape& theWires, GeomMakeShapePtr& theAlgo, std::string& theError) -{ +bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, + bool isIntersect, ListOfShape &theWires, + GeomMakeShapePtr &theAlgo, std::string &theError) { ListOfShape aSketchEdges = - std::dynamic_pointer_cast(theSketchShape)->getEdges(); + std::dynamic_pointer_cast(theSketchShape) + ->getEdges(); - std::shared_ptr anAlgoList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr anAlgoList( + new GeomAlgoAPI_MakeShapeList); if (isIntersect) { std::set aProcessedEdges; // perform sketch builder first @@ -311,15 +330,18 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, theSketchFeature->attribute(SketchPlugin_Sketch::NORM_ID())); AttributeDirPtr aDirX = std::dynamic_pointer_cast( theSketchFeature->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aSketchBuilder(new GeomAlgoAPI_SketchBuilder( - anOrigin->pnt(), aDirX->dir(), aNormal->dir(), theSketchShape)); + std::shared_ptr aSketchBuilder( + new GeomAlgoAPI_SketchBuilder(anOrigin->pnt(), aDirX->dir(), + aNormal->dir(), theSketchShape)); anAlgoList->appendAlgo(aSketchBuilder); // collect wires from faces - const ListOfShape& aFaces = aSketchBuilder->faces(); - for (ListOfShape::const_iterator anIt = aFaces.begin(); anIt != aFaces.end(); ++anIt) { - for (GeomAPI_ShapeExplorer aWExp(*anIt, GeomAPI_Shape::WIRE); aWExp.more(); aWExp.next()) { + const ListOfShape &aFaces = aSketchBuilder->faces(); + for (ListOfShape::const_iterator anIt = aFaces.begin(); + anIt != aFaces.end(); ++anIt) { + for (GeomAPI_ShapeExplorer aWExp(*anIt, GeomAPI_Shape::WIRE); + aWExp.more(); aWExp.next()) { // skip the wire if at least one its edge was already processed GeomAPI_ShapeExplorer aEExp(aWExp.current(), GeomAPI_Shape::EDGE); for (; aEExp.more(); aEExp.next()) { @@ -329,7 +351,8 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, if (aEExp.more()) continue; // mark edges as processed - for (aEExp.init(aWExp.current(), GeomAPI_Shape::EDGE); aEExp.more(); aEExp.next()) + for (aEExp.init(aWExp.current(), GeomAPI_Shape::EDGE); aEExp.more(); + aEExp.next()) aProcessedEdges.insert(aEExp.current()); // store the wire theWires.push_back(aWExp.current()); @@ -338,17 +361,20 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, // collect unused edges ListOfShape aCopy; - for (ListOfShape::iterator anIt = aSketchEdges.begin(); anIt != aSketchEdges.end(); ++anIt) { + for (ListOfShape::iterator anIt = aSketchEdges.begin(); + anIt != aSketchEdges.end(); ++anIt) { ListOfShape anImages; aSketchBuilder->modified(*anIt, anImages); - for (ListOfShape::iterator anEdge = anImages.begin(); anEdge != anImages.end(); ++anEdge) + for (ListOfShape::iterator anEdge = anImages.begin(); + anEdge != anImages.end(); ++anEdge) if (aProcessedEdges.find(*anEdge) == aProcessedEdges.end()) aCopy.push_back(*anEdge); } if (aCopy.size() > 1) { // split these edges - std::shared_ptr aGeneralFuse(new GeomAlgoAPI_PaveFiller(aCopy)); + std::shared_ptr aGeneralFuse( + new GeomAlgoAPI_PaveFiller(aCopy)); if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( aGeneralFuse, BuildPlugin_Wire::ID(), theError)) return false; @@ -356,11 +382,11 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, // collect edges after the split aSketchEdges.clear(); - for (GeomAPI_ShapeExplorer anExp(aGeneralFuse->shape(), GeomAPI_Shape::EDGE); + for (GeomAPI_ShapeExplorer anExp(aGeneralFuse->shape(), + GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) aSketchEdges.push_back(anExp.current()); - } - else + } else aSketchEdges = aCopy; } @@ -368,9 +394,11 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, typedef std::list ListOfWires; ListOfWires aNewWires; typedef std::map MapVertexWire; + GeomAPI_Vertex::GeometricComparator> + MapVertexWire; MapVertexWire aMapVW; - for (ListOfShape::iterator aEIt = aSketchEdges.begin(); aEIt != aSketchEdges.end(); ++aEIt) { + for (ListOfShape::iterator aEIt = aSketchEdges.begin(); + aEIt != aSketchEdges.end(); ++aEIt) { GeomEdgePtr anEdge = (*aEIt)->edge(); GeomVertexPtr aStartV, aEndV; anEdge->vertices(aStartV, aEndV); @@ -386,14 +414,12 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, aMapVW[aEndV] = aNewW; continue; } - } - else { + } else { if (aFoundEnd == aMapVW.end()) { // swap found vertices for correct further processing aFoundEnd = aFoundStart; aStartV = aEndV; - } - else { + } else { // both vertices are found aFoundStart->second->push_back(anEdge); if (aFoundStart->second == aFoundEnd->second) @@ -401,8 +427,10 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, else { // different wires => merge segments aFoundStart->second->insert(aFoundStart->second->end(), - aFoundEnd->second->begin(), aFoundEnd->second->end()); - for (MapVertexWire::iterator it = aMapVW.begin(); it != aMapVW.end(); ++it) + aFoundEnd->second->begin(), + aFoundEnd->second->end()); + for (MapVertexWire::iterator it = aMapVW.begin(); it != aMapVW.end(); + ++it) if (it != aFoundEnd && it->second == aFoundEnd->second) { // another boundary of the wire, change link to the whole result it->second = aFoundStart->second; @@ -423,7 +451,8 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, } // generate new wires from the sets of edges - for (ListOfWires::iterator anIt = aNewWires.begin(); anIt != aNewWires.end(); ++anIt) { + for (ListOfWires::iterator anIt = aNewWires.begin(); anIt != aNewWires.end(); + ++anIt) { GeomShapePtr aWire; if (!buildWire(*anIt, aWire, theError)) return false; diff --git a/src/BuildPlugin/BuildPlugin_Wire.h b/src/BuildPlugin/BuildPlugin_Wire.h index 692f7604e..e1e580a2b 100644 --- a/src/BuildPlugin/BuildPlugin_Wire.h +++ b/src/BuildPlugin/BuildPlugin_Wire.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef BuildPlugin_Wire_H_ @@ -27,48 +28,43 @@ /// \class BuildPlugin_Wire /// \ingroup Plugins /// \brief Feature for creation of wire from sketch edges or existing wires. -class BuildPlugin_Wire: public ModelAPI_Feature -{ +class BuildPlugin_Wire : public ModelAPI_Feature { public: /// Use plugin manager for features creation BuildPlugin_Wire(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Wire"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of base objects. - inline static const std::string& ADD_CONTOUR_ACTION_ID() - { + inline static const std::string &ADD_CONTOUR_ACTION_ID() { static const std::string MY_ADD_CONTOUR_ACTION_ID("add_contour"); return MY_ADD_CONTOUR_ACTION_ID; } /// Attribute name of "Compute intersections" checkbox. - inline static const std::string& INTERSECT_ID() - { + inline static const std::string &INTERSECT_ID() { static const std::string MY_INTERSECT_ID("intersect"); return MY_INTERSECT_ID; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string& getKind() - { + BUILDPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = BuildPlugin_Wire::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. BUILDPLUGIN_EXPORT virtual void initAttributes(); /// Creates a new part document if needed. @@ -77,12 +73,12 @@ public: /// Performs some functionality by action id. /// \param[in] theAttributeId action key id. /// \return false in case if action not perfomed. - BUILDPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId); + BUILDPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); private: - /// Action: Adds to the list of segments other segments of the sketcher connected to - /// the already selected ones to create a closed contour. - /// \return false in case if no countours have been added. + /// Action: Adds to the list of segments other segments of the sketcher + /// connected to the already selected ones to create a closed contour. \return + /// false in case if no countours have been added. bool addContour(); }; diff --git a/src/BuildPlugin/CMakeLists.txt b/src/BuildPlugin/CMakeLists.txt index 6d28cd02e..bb1414460 100644 --- a/src/BuildPlugin/CMakeLists.txt +++ b/src/BuildPlugin/CMakeLists.txt @@ -122,16 +122,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/BuildPlugin") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/BuildPlugin/doc/TUI_compoundFeature.rst b/src/BuildPlugin/doc/TUI_compoundFeature.rst index 22d29f8e8..826805e0d 100644 --- a/src/BuildPlugin/doc/TUI_compoundFeature.rst +++ b/src/BuildPlugin/doc/TUI_compoundFeature.rst @@ -8,5 +8,4 @@ Create Compound :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_compsolidFeature.rst b/src/BuildPlugin/doc/TUI_compsolidFeature.rst index ce9307bb8..fc11b885b 100644 --- a/src/BuildPlugin/doc/TUI_compsolidFeature.rst +++ b/src/BuildPlugin/doc/TUI_compsolidFeature.rst @@ -8,5 +8,4 @@ Create CompSolid :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_edgeFeature.rst b/src/BuildPlugin/doc/TUI_edgeFeature.rst index 11671f2c4..da3c6a341 100644 --- a/src/BuildPlugin/doc/TUI_edgeFeature.rst +++ b/src/BuildPlugin/doc/TUI_edgeFeature.rst @@ -8,5 +8,4 @@ Create Edge :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_edgeSegmentFeature.rst b/src/BuildPlugin/doc/TUI_edgeSegmentFeature.rst index 897a80f78..874f16068 100644 --- a/src/BuildPlugin/doc/TUI_edgeSegmentFeature.rst +++ b/src/BuildPlugin/doc/TUI_edgeSegmentFeature.rst @@ -8,5 +8,4 @@ Create Edge by Points :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_faceFeatures.rst b/src/BuildPlugin/doc/TUI_faceFeatures.rst index 010139a58..f182ceaf0 100644 --- a/src/BuildPlugin/doc/TUI_faceFeatures.rst +++ b/src/BuildPlugin/doc/TUI_faceFeatures.rst @@ -8,5 +8,4 @@ Create Face :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_fillingFeature.rst b/src/BuildPlugin/doc/TUI_fillingFeature.rst index 751bafb94..11de07dbe 100644 --- a/src/BuildPlugin/doc/TUI_fillingFeature.rst +++ b/src/BuildPlugin/doc/TUI_fillingFeature.rst @@ -8,5 +8,4 @@ Create Filling :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_interpolationAnalytical.rst b/src/BuildPlugin/doc/TUI_interpolationAnalytical.rst index 137be1458..584a0de29 100644 --- a/src/BuildPlugin/doc/TUI_interpolationAnalytical.rst +++ b/src/BuildPlugin/doc/TUI_interpolationAnalytical.rst @@ -1,4 +1,4 @@ - + .. _tui_create_interpolation_analytical: Create Interpolation analytical @@ -8,5 +8,4 @@ Create Interpolation analytical :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_interpolationBySelection.rst b/src/BuildPlugin/doc/TUI_interpolationBySelection.rst index 6e5a6a5f9..0cb935b68 100644 --- a/src/BuildPlugin/doc/TUI_interpolationBySelection.rst +++ b/src/BuildPlugin/doc/TUI_interpolationBySelection.rst @@ -8,5 +8,4 @@ Create Interpolation by selection :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_polylineFeature.rst b/src/BuildPlugin/doc/TUI_polylineFeature.rst index b521ae80b..349d21986 100644 --- a/src/BuildPlugin/doc/TUI_polylineFeature.rst +++ b/src/BuildPlugin/doc/TUI_polylineFeature.rst @@ -4,9 +4,8 @@ Create Polyline =============== -.. literalinclude:: examples/polyline.py +.. literalinclude:: examples/polyline.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/BuildPlugin/doc/TUI_shellFeature.rst b/src/BuildPlugin/doc/TUI_shellFeature.rst index 6ee08c997..ba0b34277 100644 --- a/src/BuildPlugin/doc/TUI_shellFeature.rst +++ b/src/BuildPlugin/doc/TUI_shellFeature.rst @@ -8,5 +8,4 @@ Create Shell :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_solidFeature.rst b/src/BuildPlugin/doc/TUI_solidFeature.rst index e82ba11ca..b840bc4d5 100644 --- a/src/BuildPlugin/doc/TUI_solidFeature.rst +++ b/src/BuildPlugin/doc/TUI_solidFeature.rst @@ -8,5 +8,4 @@ Create Solid :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_subshapeFeature.rst b/src/BuildPlugin/doc/TUI_subshapeFeature.rst index ddde6b457..9672a15f3 100644 --- a/src/BuildPlugin/doc/TUI_subshapeFeature.rst +++ b/src/BuildPlugin/doc/TUI_subshapeFeature.rst @@ -4,7 +4,7 @@ Create Sub-shapes ================= -.. literalinclude:: examples/subshapes.py +.. literalinclude:: examples/subshapes.py :linenos: :language: python diff --git a/src/BuildPlugin/doc/TUI_vertexFeature.rst b/src/BuildPlugin/doc/TUI_vertexFeature.rst index d1224145e..01fc7b3f5 100644 --- a/src/BuildPlugin/doc/TUI_vertexFeature.rst +++ b/src/BuildPlugin/doc/TUI_vertexFeature.rst @@ -8,5 +8,4 @@ Create Vertex :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/TUI_wireFeature.rst b/src/BuildPlugin/doc/TUI_wireFeature.rst index d22d216a1..0e6c975e8 100644 --- a/src/BuildPlugin/doc/TUI_wireFeature.rst +++ b/src/BuildPlugin/doc/TUI_wireFeature.rst @@ -8,5 +8,4 @@ Create Wire :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/BuildPlugin/doc/compoundFeature.rst b/src/BuildPlugin/doc/compoundFeature.rst index 4c4d1b31e..92dccd4cc 100644 --- a/src/BuildPlugin/doc/compoundFeature.rst +++ b/src/BuildPlugin/doc/compoundFeature.rst @@ -21,7 +21,7 @@ Select one or several shapes in the viewer. The selected shapes can be of any ty **Apply** button creates a compound. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/compsolidFeature.rst b/src/BuildPlugin/doc/compsolidFeature.rst index 5f5c3feb6..096088c4f 100644 --- a/src/BuildPlugin/doc/compsolidFeature.rst +++ b/src/BuildPlugin/doc/compsolidFeature.rst @@ -21,7 +21,7 @@ Select one or several shapes in the viewer. **Apply** button creates a compsolid. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/edgeFeature.rst b/src/BuildPlugin/doc/edgeFeature.rst index e94acf0bc..227fc7bca 100644 --- a/src/BuildPlugin/doc/edgeFeature.rst +++ b/src/BuildPlugin/doc/edgeFeature.rst @@ -39,7 +39,7 @@ Checkbox **Compute intersections** forces to split sketch edges in the points of **Apply** button creates edges. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: @@ -75,7 +75,7 @@ Select two points in the viewer. **Apply** button creates a segment. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/faceFeature.rst b/src/BuildPlugin/doc/faceFeature.rst index b37ee7deb..6f298d7ee 100644 --- a/src/BuildPlugin/doc/faceFeature.rst +++ b/src/BuildPlugin/doc/faceFeature.rst @@ -12,12 +12,12 @@ To create a face in the active part: #. click |feature_face.icon| **Face** button in the toolbar The following property panel will be opened: - + .. figure:: images/Face.png :align: center Create a face - + Select one or several faces in viewer. Additionally, a face can be build by a closed wire or a set of edges composing a closed wire. It is possible to build a non-planar face by selecting non-planar wire or set of edges composing a closed wire, which do not belong to only one plane. @@ -26,7 +26,7 @@ It is also possible to select a whole sketch result from the object browser. In **Apply** button creates faces. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/interpolationFeature.rst b/src/BuildPlugin/doc/interpolationFeature.rst index 2840693e1..f9a411172 100644 --- a/src/BuildPlugin/doc/interpolationFeature.rst +++ b/src/BuildPlugin/doc/interpolationFeature.rst @@ -12,13 +12,13 @@ To create an interpolation in the active part: There are two creation modes of an interpolation: -.. figure:: images/feature_interpolation_by_selection.png +.. figure:: images/feature_interpolation_by_selection.png :align: left :height: 24px Interpolation by selection -.. figure:: images/feature_interpolation_analytical.png +.. figure:: images/feature_interpolation_analytical.png :align: left :height: 24px @@ -43,7 +43,7 @@ Select one or several vertices or points in the viewer. **Apply** button creates an interpolation. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Commands**: @@ -100,7 +100,7 @@ The property panel is shown below. **Apply** button creates an interpolation. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Commands**: @@ -112,7 +112,7 @@ The property panel is shown below. :param string: Expression of z. :param number: Minimum value of t. :param number: Maximum value of t. - :param number: Number of steps. + :param number: Number of steps. :return: Result object. Result diff --git a/src/BuildPlugin/doc/polylineFeature.rst b/src/BuildPlugin/doc/polylineFeature.rst index 782aae457..c3d72bc87 100644 --- a/src/BuildPlugin/doc/polylineFeature.rst +++ b/src/BuildPlugin/doc/polylineFeature.rst @@ -41,4 +41,4 @@ The result of the operation is a closed or open Polyline. Polyline -**See Also** a sample TUI Script of :ref:`tui_create_polyline` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_create_polyline` operation. diff --git a/src/BuildPlugin/doc/shellFeature.rst b/src/BuildPlugin/doc/shellFeature.rst index 05529713a..5dfeb0ff7 100644 --- a/src/BuildPlugin/doc/shellFeature.rst +++ b/src/BuildPlugin/doc/shellFeature.rst @@ -16,12 +16,12 @@ The following property panel will be opened: :align: center Create a shell - + Select one or several faces in the viewer. Additionally, it is allowed to select a whole sketch result from the object browser. In this case, the result shell will contain faces corresponding to all smallest closed contours of the sketch. **Apply** button creates a shell. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/solidFeature.rst b/src/BuildPlugin/doc/solidFeature.rst index 69fa7a341..66f772def 100644 --- a/src/BuildPlugin/doc/solidFeature.rst +++ b/src/BuildPlugin/doc/solidFeature.rst @@ -16,12 +16,12 @@ The following property panel will be opened: :align: center Create a solid - + Select one or several faces in the viewer. The selected faces have to define a closed volume. **Apply** button creates a solid. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/subShapesFeature.rst b/src/BuildPlugin/doc/subShapesFeature.rst index 6bf463bff..47d9bb3e1 100644 --- a/src/BuildPlugin/doc/subShapesFeature.rst +++ b/src/BuildPlugin/doc/subShapesFeature.rst @@ -44,7 +44,3 @@ The result replaces the original shape with its copy with added/removed sub-shap Sub-shapes **See Also** a sample TUI Script of :ref:`tui_create_subshape` operation. - - - - diff --git a/src/BuildPlugin/doc/vertexFeature.rst b/src/BuildPlugin/doc/vertexFeature.rst index 9d05086e2..d9534f8d1 100644 --- a/src/BuildPlugin/doc/vertexFeature.rst +++ b/src/BuildPlugin/doc/vertexFeature.rst @@ -21,7 +21,7 @@ Select one or several vertices in the viewer. It is also possible to select a wh **Apply** button creates vertices. -**Cancel** button cancels operation. +**Cancel** button cancels operation. **TUI Command**: diff --git a/src/BuildPlugin/doc/wireFeature.rst b/src/BuildPlugin/doc/wireFeature.rst index 05467d8cd..84fa7bb14 100644 --- a/src/BuildPlugin/doc/wireFeature.rst +++ b/src/BuildPlugin/doc/wireFeature.rst @@ -16,7 +16,7 @@ The following property panel will be opened: :align: center Create a wire - + Select one or several edges in the viewer. For automatic selection of a closed contour starting from the selected edge it is necessary to press **Add contour** button. Moreover, the full sketch can be selected. In this case, a set of wires is composed using edges of the sketch. @@ -24,7 +24,7 @@ Checkbox **Compute intersections** forces to split sketch edges in the points of **Apply** button creates a wire. -**Cancel** button cancels the operation. +**Cancel** button cancels the operation. **TUI Command**: diff --git a/src/BuildPlugin/interpolation_widget.xml b/src/BuildPlugin/interpolation_widget.xml index fed9ed99d..1964964fe 100644 --- a/src/BuildPlugin/interpolation_widget.xml +++ b/src/BuildPlugin/interpolation_widget.xml @@ -1,6 +1,6 @@ - +#include #include #include #include #include -#include -#include #include // for std::transform //================================================================================================= -CollectionAPI_Field::CollectionAPI_Field(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +CollectionAPI_Field::CollectionAPI_Field( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================= -CollectionAPI_Field::~CollectionAPI_Field() -{ -} +CollectionAPI_Field::~CollectionAPI_Field() {} //================================================================================================= -void CollectionAPI_Field::setSelection(const std::list& theFieldList) -{ +void CollectionAPI_Field::setSelection( + const std::list &theFieldList) { fillAttribute(theFieldList, myselection); execute(); } //================================================================================================= -void CollectionAPI_Field::setComponentsNames(const std::list& theNames) -{ +void CollectionAPI_Field::setComponentsNames( + const std::list &theNames) { fillAttribute(theNames, mycomponentsNames); execute(); } //================================================================================================= -void CollectionAPI_Field::setValuesType(const std::string& theType) -{ +void CollectionAPI_Field::setValuesType(const std::string &theType) { myvalues->setType(valueTypeByStr(theType)); execute(); } //================================================================================================= -void CollectionAPI_Field::setStepsNum(const ModelHighAPI_Integer& theSteps) -{ +void CollectionAPI_Field::setStepsNum(const ModelHighAPI_Integer &theSteps) { mystamps->setSize(theSteps.intValue()); execute(); } //================================================================================================= -void CollectionAPI_Field::setStamps(const std::list& theStamps) -{ +void CollectionAPI_Field::setStamps( + const std::list &theStamps) { fillAttribute(theStamps, mystamps); execute(); } //================================================================================================= -#define addStepImplementation(type, fieldType, type2, fieldType2, type3, fieldType3) \ -void CollectionAPI_Field::addStep(const ModelHighAPI_Integer& theStepNum, \ - const ModelHighAPI_Integer& theStamp, \ - const std::list >& theComponents) \ -{ \ - mystamps->setValue(theStepNum.intValue(), theStamp.intValue()); \ - int aRowIndex = 0; \ - std::list >::const_iterator \ - aRowsIter = theComponents.begin(); \ - for(; aRowsIter != theComponents.end(); aRowsIter++, aRowIndex++) { \ - int aColIndex = 0; \ - std::list::const_iterator aColIter = aRowsIter->begin(); \ - for(; aColIter != aRowsIter->end(); aColIter++, aColIndex++) { \ - ModelAPI_AttributeTables::Value aVal; \ - aVal.fieldType = *aColIter; \ - aVal.fieldType2 = type2(*aColIter); \ - aVal.fieldType3 = type3(*aColIter); \ - myvalues->setValue(aVal, aRowIndex, aColIndex, theStepNum.intValue()); \ - } \ - } \ - execute(); \ -} +#define addStepImplementation(type, fieldType, type2, fieldType2, type3, \ + fieldType3) \ + void CollectionAPI_Field::addStep( \ + const ModelHighAPI_Integer &theStepNum, \ + const ModelHighAPI_Integer &theStamp, \ + const std::list> &theComponents) { \ + mystamps->setValue(theStepNum.intValue(), theStamp.intValue()); \ + int aRowIndex = 0; \ + std::list>::const_iterator aRowsIter = \ + theComponents.begin(); \ + for (; aRowsIter != theComponents.end(); aRowsIter++, aRowIndex++) { \ + int aColIndex = 0; \ + std::list::const_iterator aColIter = aRowsIter->begin(); \ + for (; aColIter != aRowsIter->end(); aColIter++, aColIndex++) { \ + ModelAPI_AttributeTables::Value aVal; \ + aVal.fieldType = *aColIter; \ + aVal.fieldType2 = type2(*aColIter); \ + aVal.fieldType3 = type3(*aColIter); \ + myvalues->setValue(aVal, aRowIndex, aColIndex, theStepNum.intValue()); \ + } \ + } \ + execute(); \ + } addStepImplementation(double, myDouble, int, myInt, bool, myBool); addStepImplementation(int, myInt, double, myDouble, bool, myBool); addStepImplementation(bool, myBool, int, myInt, double, myDouble); -addStepImplementation(std::string, myStr, std::string, myStr, std::string, myStr); +addStepImplementation(std::string, myStr, std::string, myStr, std::string, + myStr); //================================================================================================= -void CollectionAPI_Field::dump(ModelHighAPI_Dumper& theDumper) const -{ +void CollectionAPI_Field::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - theDumper<tables()<<", \"" - <type())<<"\", "<size()<<", "; - theDumper<tables() << ", \"" << strByValueType(myvalues->type()) + << "\", " << mycomponentsNames->size() << ", "; + theDumper << mycomponentsNames << ", "; + theDumper << myselection << ")" << std::endl; // set values step by step - for(int aStep = 0; aStep < myvalues->tables(); aStep++) { - theDumper<value(aStep)<<", ["; - for(int aRow = 0; aRow < myvalues->rows(); aRow++) { + for (int aStep = 0; aStep < myvalues->tables(); aStep++) { + theDumper << aBase << ".addStep(" << aStep << ", " << mystamps->value(aStep) + << ", ["; + for (int aRow = 0; aRow < myvalues->rows(); aRow++) { if (aRow != 0) - theDumper<<", "; - theDumper<<"["; - for(int aCol = 0; aCol < myvalues->columns(); aCol++) { + theDumper << ", "; + theDumper << "["; + for (int aCol = 0; aCol < myvalues->columns(); aCol++) { if (aCol != 0) - theDumper<<", "; - switch(myvalues->type()) { + theDumper << ", "; + switch (myvalues->type()) { case ModelAPI_AttributeTables::BOOLEAN: - theDumper<value(aRow, aCol, aStep).myBool; + theDumper << myvalues->value(aRow, aCol, aStep).myBool; break; case ModelAPI_AttributeTables::INTEGER: - theDumper<value(aRow, aCol, aStep).myInt; + theDumper << myvalues->value(aRow, aCol, aStep).myInt; break; case ModelAPI_AttributeTables::DOUBLE: - theDumper<value(aRow, aCol, aStep).myDouble; + theDumper << myvalues->value(aRow, aCol, aStep).myDouble; break; case ModelAPI_AttributeTables::STRING: - theDumper<<'"'<value(aRow, aCol, aStep).myStr<<'"'; + theDumper << '"' << myvalues->value(aRow, aCol, aStep).myStr << '"'; break; } } - theDumper<<"]"; + theDumper << "]"; } - theDumper<<"])"< CollectionAPI_Field::tableValues() -{ +std::shared_ptr CollectionAPI_Field::tableValues() { return myvalues; } //================================================================================================= -FieldPtr addField(const std::shared_ptr& thePart, - const ModelHighAPI_Integer& theStepsNum, - const std::string& theComponentType, +FieldPtr addField(const std::shared_ptr &thePart, + const ModelHighAPI_Integer &theStepsNum, + const std::string &theComponentType, const int theComponentsNum, - const std::list& theComponentNames, - const std::list& theSelectionList) -{ - std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_Field::ID()); - std::shared_ptr aField(new CollectionAPI_Field(aFeature)); + const std::list &theComponentNames, + const std::list &theSelectionList) { + std::shared_ptr aFeature = + thePart->addFeature(CollectionAPI_Field::ID()); + std::shared_ptr aField( + new CollectionAPI_Field(aFeature)); aField->setStepsNum(theStepsNum); aField->setValuesType(theComponentType); aField->setComponentsNames(theComponentNames); aField->setSelection(theSelectionList); - aField->tableValues()->setSize( - int(theSelectionList.size() + 1), theComponentsNum, theStepsNum.intValue()); + aField->tableValues()->setSize(int(theSelectionList.size() + 1), + theComponentsNum, theStepsNum.intValue()); return aField; } diff --git a/src/CollectionAPI/CollectionAPI_Field.h b/src/CollectionAPI/CollectionAPI_Field.h index 7f99ad142..f88032980 100644 --- a/src/CollectionAPI/CollectionAPI_Field.h +++ b/src/CollectionAPI/CollectionAPI_Field.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionAPI_Field_H_ @@ -35,67 +36,71 @@ class ModelHighAPI_ComponentValue; /// \class CollectionAPI_Field /// \inField CPPHighAPI /// \brief Interface for Field feature. -class CollectionAPI_Field: public ModelHighAPI_Interface -{ +class CollectionAPI_Field : public ModelHighAPI_Interface { public: /// Constructor without values. COLLECTIONAPI_EXPORT - explicit CollectionAPI_Field(const std::shared_ptr& theFeature); + explicit CollectionAPI_Field( + const std::shared_ptr &theFeature); /// Destructor. COLLECTIONAPI_EXPORT virtual ~CollectionAPI_Field(); - INTERFACE_4(CollectionPlugin_Field::ID(), - selection, CollectionPlugin_Field::SELECTED_ID(), - ModelAPI_AttributeSelectionList, /** Field selection list*/, - componentsNames, CollectionPlugin_Field::COMPONENTS_NAMES_ID(), - ModelAPI_AttributeStringArray, /** Names of components list of strings */, - stamps, CollectionPlugin_Field::STAMPS_ID(), - ModelAPI_AttributeIntArray, /** Identifiers of stamps */, - values, CollectionPlugin_Field::VALUES_ID(), ModelAPI_AttributeTables /** Table of values */, - ) + INTERFACE_4(CollectionPlugin_Field::ID(), selection, + CollectionPlugin_Field::SELECTED_ID(), + ModelAPI_AttributeSelectionList, /** Field selection list*/, + componentsNames, CollectionPlugin_Field::COMPONENTS_NAMES_ID(), + ModelAPI_AttributeStringArray, + /** Names of components list of strings */, stamps, + CollectionPlugin_Field::STAMPS_ID(), ModelAPI_AttributeIntArray, + /** Identifiers of stamps */, values, + CollectionPlugin_Field::VALUES_ID(), + ModelAPI_AttributeTables /** Table of values */, ) /// Set selected objects. COLLECTIONAPI_EXPORT - void setSelection(const std::list& theFieldList); + void setSelection(const std::list &theFieldList); /// Set names of components COLLECTIONAPI_EXPORT - void setComponentsNames(const std::list& theNames); + void setComponentsNames(const std::list &theNames); /// Set type of values COLLECTIONAPI_EXPORT - void setValuesType(const std::string& theType); + void setValuesType(const std::string &theType); /// Set number of steps COLLECTIONAPI_EXPORT - void setStepsNum(const ModelHighAPI_Integer& theSteps); + void setStepsNum(const ModelHighAPI_Integer &theSteps); /// Set stamps identifiers COLLECTIONAPI_EXPORT - void setStamps(const std::list& theStamps); + void setStamps(const std::list &theStamps); /// Sets the double values of specific step COLLECTIONAPI_EXPORT - void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp, - const std::list >& theComponents); + void addStep(const ModelHighAPI_Integer &theStepNum, + const ModelHighAPI_Integer &theStamp, + const std::list> &theComponents); /// Sets the integer values of specific step COLLECTIONAPI_EXPORT - void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp, - const std::list >& theComponents); + void addStep(const ModelHighAPI_Integer &theStepNum, + const ModelHighAPI_Integer &theStamp, + const std::list> &theComponents); /// Sets the string values of specific step COLLECTIONAPI_EXPORT - void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp, - const std::list >& theComponents); + void addStep(const ModelHighAPI_Integer &theStepNum, + const ModelHighAPI_Integer &theStamp, + const std::list> &theComponents); /// Sets the boolean values of specific step COLLECTIONAPI_EXPORT - void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp, - const std::list >& theComponents); + void addStep(const ModelHighAPI_Integer &theStepNum, + const ModelHighAPI_Integer &theStamp, + const std::list> &theComponents); /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; /// Returns the internal values tables COLLECTIONAPI_EXPORT std::shared_ptr tableValues(); - }; /// Pointer on Field object. @@ -104,11 +109,11 @@ typedef std::shared_ptr FieldPtr; /// \inField CPPHighAPI /// \brief Create Field feature. COLLECTIONAPI_EXPORT -FieldPtr addField(const std::shared_ptr& thePart, - const ModelHighAPI_Integer& theStepsNum, - const std::string& theComponentType, +FieldPtr addField(const std::shared_ptr &thePart, + const ModelHighAPI_Integer &theStepsNum, + const std::string &theComponentType, const int theComponentsNum, - const std::list& theComponentNames, - const std::list& theSelectionList); + const std::list &theComponentNames, + const std::list &theSelectionList); #endif // CollectionAPI_Field_H_ diff --git a/src/CollectionAPI/CollectionAPI_Group.cpp b/src/CollectionAPI/CollectionAPI_Group.cpp index 63d500bda..e8639efaa 100644 --- a/src/CollectionAPI/CollectionAPI_Group.cpp +++ b/src/CollectionAPI/CollectionAPI_Group.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionAPI_Group.h" @@ -25,73 +26,74 @@ #include //================================================================================================== -CollectionAPI_Group::CollectionAPI_Group(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +CollectionAPI_Group::CollectionAPI_Group( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -CollectionAPI_Group::CollectionAPI_Group(const std::shared_ptr& theFeature, - const std::list& theGroupList) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +CollectionAPI_Group::CollectionAPI_Group( + const std::shared_ptr &theFeature, + const std::list &theGroupList) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setGroupList(theGroupList); } } //================================================================================================== -CollectionAPI_Group::~CollectionAPI_Group() -{ - -} +CollectionAPI_Group::~CollectionAPI_Group() {} //================================================================================================== -void CollectionAPI_Group::setGroupList(const std::list& theGroupList) -{ +void CollectionAPI_Group::setGroupList( + const std::list &theGroupList) { fillAttribute(theGroupList, mygroupList); execute(); } //================================================================================================== -void CollectionAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const -{ +void CollectionAPI_Group::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_Group::LIST_ID()); + AttributeSelectionListPtr anAttrList = + aBase->selectionList(CollectionPlugin_Group::LIST_ID()); theDumper << aBase << " = model.addGroup(" << aDocName << ", "; - if (anAttrList->isWholeResultAllowed() && !anAttrList->selectionType().empty()) - theDumper<<"\""<selectionType()<<"\", "; + if (anAttrList->isWholeResultAllowed() && + !anAttrList->selectionType().empty()) + theDumper << "\"" << anAttrList->selectionType() << "\", "; theDumper << anAttrList; if (anAttrList->isGeometricalSelection()) - theDumper <<", True"; + theDumper << ", True"; theDumper << ")" << std::endl; } //================================================================================================== -GroupPtr addGroup(const std::shared_ptr& thePart, - const std::list& theGroupList, - const bool theShareSameTopology) -{ - std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_Group::ID()); +GroupPtr addGroup(const std::shared_ptr &thePart, + const std::list &theGroupList, + const bool theShareSameTopology) { + std::shared_ptr aFeature = + thePart->addFeature(CollectionAPI_Group::ID()); if (theShareSameTopology) - aFeature->selectionList(CollectionPlugin_Group::LIST_ID())->setGeometricalSelection(true); + aFeature->selectionList(CollectionPlugin_Group::LIST_ID()) + ->setGeometricalSelection(true); return GroupPtr(new CollectionAPI_Group(aFeature, theGroupList)); } //================================================================================================== -GroupPtr addGroup(const std::shared_ptr& thePart, - const std::string& theSelectionType, - const std::list& theGroupList, - const bool theShareSameTopology) -{ - std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_Group::ID()); - aFeature->selectionList(CollectionPlugin_Group::LIST_ID())->setSelectionType(theSelectionType); +GroupPtr addGroup(const std::shared_ptr &thePart, + const std::string &theSelectionType, + const std::list &theGroupList, + const bool theShareSameTopology) { + std::shared_ptr aFeature = + thePart->addFeature(CollectionAPI_Group::ID()); + aFeature->selectionList(CollectionPlugin_Group::LIST_ID()) + ->setSelectionType(theSelectionType); if (theShareSameTopology) - aFeature->selectionList(CollectionPlugin_Group::LIST_ID())->setGeometricalSelection(true); + aFeature->selectionList(CollectionPlugin_Group::LIST_ID()) + ->setGeometricalSelection(true); return GroupPtr(new CollectionAPI_Group(aFeature, theGroupList)); } diff --git a/src/CollectionAPI/CollectionAPI_Group.h b/src/CollectionAPI/CollectionAPI_Group.h index 848eccbd7..6e685fe35 100644 --- a/src/CollectionAPI/CollectionAPI_Group.h +++ b/src/CollectionAPI/CollectionAPI_Group.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionAPI_Group_H_ @@ -33,33 +34,34 @@ class ModelHighAPI_Selection; /// \class CollectionAPI_Group /// \ingroup CPPHighAPI /// \brief Interface for Group feature. -class CollectionAPI_Group: public ModelHighAPI_Interface -{ +class CollectionAPI_Group : public ModelHighAPI_Interface { public: /// Constructor without values. COLLECTIONAPI_EXPORT - explicit CollectionAPI_Group(const std::shared_ptr& theFeature); + explicit CollectionAPI_Group( + const std::shared_ptr &theFeature); /// Constructor with values. COLLECTIONAPI_EXPORT - CollectionAPI_Group(const std::shared_ptr& theFeature, - const std::list& theGroupList); + CollectionAPI_Group(const std::shared_ptr &theFeature, + const std::list &theGroupList); /// Destructor. COLLECTIONAPI_EXPORT virtual ~CollectionAPI_Group(); - INTERFACE_1(CollectionPlugin_Group::ID(), - groupList, CollectionPlugin_Group::LIST_ID(), - ModelAPI_AttributeSelectionList, /** Group list*/) + INTERFACE_1(CollectionPlugin_Group::ID(), groupList, + CollectionPlugin_Group::LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Group list*/) /// Set main objects. COLLECTIONAPI_EXPORT - void setGroupList(const std::list& theGroupList); + void setGroupList(const std::list &theGroupList); /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Group object. @@ -68,16 +70,17 @@ typedef std::shared_ptr GroupPtr; /// \ingroup CPPHighAPI /// \brief Create Group feature. COLLECTIONAPI_EXPORT -GroupPtr addGroup(const std::shared_ptr& thePart, - const std::list& theGroupList, +GroupPtr addGroup(const std::shared_ptr &thePart, + const std::list &theGroupList, const bool theShareSameTopology = false); /// \ingroup CPPHighAPI -/// \brief Create Group with the additional selection type for case the whole result selected. +/// \brief Create Group with the additional selection type for case the whole +/// result selected. COLLECTIONAPI_EXPORT -GroupPtr addGroup(const std::shared_ptr& thePart, - const std::string& theSelectionType, - const std::list& theGroupList, - const bool theShareSameTopology = false); +GroupPtr addGroup(const std::shared_ptr &thePart, + const std::string &theSelectionType, + const std::list &theGroupList, + const bool theShareSameTopology = false); #endif // CollectionAPI_Group_H_ diff --git a/src/CollectionAPI/CollectionAPI_GroupAddition.cpp b/src/CollectionAPI/CollectionAPI_GroupAddition.cpp index 71bbc1591..a104971d6 100644 --- a/src/CollectionAPI/CollectionAPI_GroupAddition.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupAddition.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionAPI_GroupAddition.h" @@ -23,37 +24,31 @@ #include CollectionAPI_GroupAddition::CollectionAPI_GroupAddition( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } CollectionAPI_GroupAddition::CollectionAPI_GroupAddition( - const std::shared_ptr& theFeature, - const std::list& theGroupList) - : ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theGroupList) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setGroupList(theGroupList); } } -CollectionAPI_GroupAddition::~CollectionAPI_GroupAddition() -{ -} +CollectionAPI_GroupAddition::~CollectionAPI_GroupAddition() {} void CollectionAPI_GroupAddition::setGroupList( - const std::list& theGroupList) -{ + const std::list &theGroupList) { fillAttribute(theGroupList, mygroupList); execute(); } -void CollectionAPI_GroupAddition::dump(ModelHighAPI_Dumper& theDumper) const -{ +void CollectionAPI_GroupAddition::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_GroupAddition::LIST_ID()); @@ -62,10 +57,11 @@ void CollectionAPI_GroupAddition::dump(ModelHighAPI_Dumper& theDumper) const << anAttrList << ")" << std::endl; } -GroupAdditionPtr addGroupAddition(const std::shared_ptr& thePart, - const std::list& theGroupList) -{ +GroupAdditionPtr +addGroupAddition(const std::shared_ptr &thePart, + const std::list &theGroupList) { std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_GroupAddition::ID()); - return GroupAdditionPtr(new CollectionAPI_GroupAddition(aFeature, theGroupList)); + return GroupAdditionPtr( + new CollectionAPI_GroupAddition(aFeature, theGroupList)); } diff --git a/src/CollectionAPI/CollectionAPI_GroupAddition.h b/src/CollectionAPI/CollectionAPI_GroupAddition.h index 1c5a719a5..be237cc27 100644 --- a/src/CollectionAPI/CollectionAPI_GroupAddition.h +++ b/src/CollectionAPI/CollectionAPI_GroupAddition.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionAPI_GroupAddition_H_ @@ -33,33 +34,35 @@ class ModelHighAPI_Selection; /// \class CollectionAPI_GroupAddition /// \ingroup CPPHighAPI /// \brief Interface for Group Addition feature. -class CollectionAPI_GroupAddition : public ModelHighAPI_Interface -{ +class CollectionAPI_GroupAddition : public ModelHighAPI_Interface { public: /// Constructor without values. COLLECTIONAPI_EXPORT - explicit CollectionAPI_GroupAddition(const std::shared_ptr& theFeature); + explicit CollectionAPI_GroupAddition( + const std::shared_ptr &theFeature); /// Constructor with values. COLLECTIONAPI_EXPORT - CollectionAPI_GroupAddition(const std::shared_ptr& theFeature, - const std::list& theGroupList); + CollectionAPI_GroupAddition( + const std::shared_ptr &theFeature, + const std::list &theGroupList); /// Destructor. COLLECTIONAPI_EXPORT virtual ~CollectionAPI_GroupAddition(); - INTERFACE_1(CollectionPlugin_GroupAddition::ID(), - groupList, CollectionPlugin_GroupAddition::LIST_ID(), - ModelAPI_AttributeSelectionList, /** Group list*/) + INTERFACE_1(CollectionPlugin_GroupAddition::ID(), groupList, + CollectionPlugin_GroupAddition::LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Group list*/) /// Set main objects. COLLECTIONAPI_EXPORT - void setGroupList(const std::list& theGroupList); + void setGroupList(const std::list &theGroupList); /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Group Addition object. @@ -68,7 +71,8 @@ typedef std::shared_ptr GroupAdditionPtr; /// \ingroup CPPHighAPI /// \brief Create Group Addition feature. COLLECTIONAPI_EXPORT -GroupAdditionPtr addGroupAddition(const std::shared_ptr& thePart, - const std::list& theGroupsList); +GroupAdditionPtr +addGroupAddition(const std::shared_ptr &thePart, + const std::list &theGroupsList); #endif // CollectionAPI_GroupAddition_H_ diff --git a/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp b/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp index 04f3283d9..712dbe87f 100644 --- a/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionAPI_GroupIntersection.h" @@ -23,37 +24,32 @@ #include CollectionAPI_GroupIntersection::CollectionAPI_GroupIntersection( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } CollectionAPI_GroupIntersection::CollectionAPI_GroupIntersection( - const std::shared_ptr& theFeature, - const std::list& theGroupList) - : ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theGroupList) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setGroupList(theGroupList); } } -CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection() -{ -} +CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection() {} void CollectionAPI_GroupIntersection::setGroupList( - const std::list& theGroupList) -{ + const std::list &theGroupList) { fillAttribute(theGroupList, mygroupList); execute(); } -void CollectionAPI_GroupIntersection::dump(ModelHighAPI_Dumper& theDumper) const -{ +void CollectionAPI_GroupIntersection::dump( + ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_GroupIntersection::LIST_ID()); @@ -62,10 +58,11 @@ void CollectionAPI_GroupIntersection::dump(ModelHighAPI_Dumper& theDumper) const << anAttrList << ")" << std::endl; } -GroupIntersectionPtr addGroupIntersection(const std::shared_ptr& thePart, - const std::list& theGroupList) -{ +GroupIntersectionPtr +addGroupIntersection(const std::shared_ptr &thePart, + const std::list &theGroupList) { std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_GroupIntersection::ID()); - return GroupIntersectionPtr(new CollectionAPI_GroupIntersection(aFeature, theGroupList)); + return GroupIntersectionPtr( + new CollectionAPI_GroupIntersection(aFeature, theGroupList)); } diff --git a/src/CollectionAPI/CollectionAPI_GroupIntersection.h b/src/CollectionAPI/CollectionAPI_GroupIntersection.h index ead3ce05c..fd74c86ba 100644 --- a/src/CollectionAPI/CollectionAPI_GroupIntersection.h +++ b/src/CollectionAPI/CollectionAPI_GroupIntersection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionAPI_GroupIntersection_H_ @@ -33,33 +34,35 @@ class ModelHighAPI_Selection; /// \class CollectionAPI_GroupIntersection /// \ingroup CPPHighAPI /// \brief Interface for Group Intersection feature. -class CollectionAPI_GroupIntersection : public ModelHighAPI_Interface -{ +class CollectionAPI_GroupIntersection : public ModelHighAPI_Interface { public: /// Constructor without values. COLLECTIONAPI_EXPORT - explicit CollectionAPI_GroupIntersection(const std::shared_ptr& theFeature); + explicit CollectionAPI_GroupIntersection( + const std::shared_ptr &theFeature); /// Constructor with values. COLLECTIONAPI_EXPORT - CollectionAPI_GroupIntersection(const std::shared_ptr& theFeature, - const std::list& theGroupList); + CollectionAPI_GroupIntersection( + const std::shared_ptr &theFeature, + const std::list &theGroupList); /// Destructor. COLLECTIONAPI_EXPORT virtual ~CollectionAPI_GroupIntersection(); - INTERFACE_1(CollectionPlugin_GroupIntersection::ID(), - groupList, CollectionPlugin_GroupIntersection::LIST_ID(), - ModelAPI_AttributeSelectionList, /** Group list*/) + INTERFACE_1(CollectionPlugin_GroupIntersection::ID(), groupList, + CollectionPlugin_GroupIntersection::LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Group list*/) /// Set main objects. COLLECTIONAPI_EXPORT - void setGroupList(const std::list& theGroupList); + void setGroupList(const std::list &theGroupList); /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Group Addition object. @@ -68,7 +71,8 @@ typedef std::shared_ptr GroupIntersectionPtr; /// \ingroup CPPHighAPI /// \brief Create Group Intersection feature. COLLECTIONAPI_EXPORT -GroupIntersectionPtr addGroupIntersection(const std::shared_ptr& thePart, - const std::list& theGroupsList); +GroupIntersectionPtr +addGroupIntersection(const std::shared_ptr &thePart, + const std::list &theGroupsList); #endif // CollectionAPI_GroupIntersection_H_ diff --git a/src/CollectionAPI/CollectionAPI_GroupShape.cpp b/src/CollectionAPI/CollectionAPI_GroupShape.cpp index 399e9a9c3..337cc94b4 100644 --- a/src/CollectionAPI/CollectionAPI_GroupShape.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupShape.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionAPI_GroupShape.h" @@ -23,37 +24,31 @@ #include CollectionAPI_GroupShape::CollectionAPI_GroupShape( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } CollectionAPI_GroupShape::CollectionAPI_GroupShape( - const std::shared_ptr& theFeature, - const std::list& theGroupList) - : ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theGroupList) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setGroupList(theGroupList); } } -CollectionAPI_GroupShape::~CollectionAPI_GroupShape() -{ -} +CollectionAPI_GroupShape::~CollectionAPI_GroupShape() {} void CollectionAPI_GroupShape::setGroupList( - const std::list& theGroupList) -{ + const std::list &theGroupList) { fillAttribute(theGroupList, mygroupList); execute(); } -void CollectionAPI_GroupShape::dump(ModelHighAPI_Dumper& theDumper) const -{ +void CollectionAPI_GroupShape::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_GroupShape::LIST_ID()); @@ -62,9 +57,9 @@ void CollectionAPI_GroupShape::dump(ModelHighAPI_Dumper& theDumper) const << anAttrList << ")" << std::endl; } -GroupShapePtr addGroupShape(const std::shared_ptr& thePart, - const std::list& theGroupList) -{ +GroupShapePtr +addGroupShape(const std::shared_ptr &thePart, + const std::list &theGroupList) { std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_GroupShape::ID()); return GroupShapePtr(new CollectionAPI_GroupShape(aFeature, theGroupList)); diff --git a/src/CollectionAPI/CollectionAPI_GroupShape.h b/src/CollectionAPI/CollectionAPI_GroupShape.h index 4609f4e3d..0a06e1f92 100644 --- a/src/CollectionAPI/CollectionAPI_GroupShape.h +++ b/src/CollectionAPI/CollectionAPI_GroupShape.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionAPI_GroupShape_H_ @@ -33,33 +34,35 @@ class ModelHighAPI_Selection; /// \class CollectionAPI_GroupShape /// \ingroup CPPHighAPI /// \brief Interface for Group Shape feature. -class CollectionAPI_GroupShape : public ModelHighAPI_Interface -{ +class CollectionAPI_GroupShape : public ModelHighAPI_Interface { public: /// Constructor without values. COLLECTIONAPI_EXPORT - explicit CollectionAPI_GroupShape(const std::shared_ptr& theFeature); + explicit CollectionAPI_GroupShape( + const std::shared_ptr &theFeature); /// Constructor with values. COLLECTIONAPI_EXPORT - CollectionAPI_GroupShape(const std::shared_ptr& theFeature, - const std::list& theGroupList); + CollectionAPI_GroupShape( + const std::shared_ptr &theFeature, + const std::list &theGroupList); /// Destructor. COLLECTIONAPI_EXPORT virtual ~CollectionAPI_GroupShape(); - INTERFACE_1(CollectionPlugin_GroupShape::ID(), - groupList, CollectionPlugin_GroupShape::LIST_ID(), - ModelAPI_AttributeSelectionList, /** Group list*/) + INTERFACE_1(CollectionPlugin_GroupShape::ID(), groupList, + CollectionPlugin_GroupShape::LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Group list*/) /// Set main objects. COLLECTIONAPI_EXPORT - void setGroupList(const std::list& theGroupList); + void setGroupList(const std::list &theGroupList); /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Group Shape object. @@ -68,7 +71,8 @@ typedef std::shared_ptr GroupShapePtr; /// \ingroup CPPHighAPI /// \brief Create Group Shape feature. COLLECTIONAPI_EXPORT -GroupShapePtr addGroupShape(const std::shared_ptr& thePart, - const std::list& theGroupsList); +GroupShapePtr +addGroupShape(const std::shared_ptr &thePart, + const std::list &theGroupsList); #endif // CollectionAPI_GroupShape_H_ diff --git a/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp b/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp index 94e8ecba8..8e78a3e7f 100644 --- a/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionAPI_GroupSubstraction.h" @@ -23,46 +24,40 @@ #include CollectionAPI_GroupSubstraction::CollectionAPI_GroupSubstraction( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } CollectionAPI_GroupSubstraction::CollectionAPI_GroupSubstraction( - const std::shared_ptr& theFeature, - const std::list& theObjectsList, - const std::list& theToolsList) - : ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theObjectsList, + const std::list &theToolsList) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setObjectsList(theObjectsList); setToolsList(theToolsList); } } -CollectionAPI_GroupSubstraction::~CollectionAPI_GroupSubstraction() -{ -} +CollectionAPI_GroupSubstraction::~CollectionAPI_GroupSubstraction() {} void CollectionAPI_GroupSubstraction::setObjectsList( - const std::list& theGroupList) -{ + const std::list &theGroupList) { fillAttribute(theGroupList, myobjectsList); execute(); } void CollectionAPI_GroupSubstraction::setToolsList( - const std::list& theGroupList) -{ + const std::list &theGroupList) { fillAttribute(theGroupList, mytoolsList); execute(); } -void CollectionAPI_GroupSubstraction::dump(ModelHighAPI_Dumper& theDumper) const -{ +void CollectionAPI_GroupSubstraction::dump( + ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anObjectsList = aBase->selectionList(CollectionPlugin_GroupSubstraction::LIST_ID()); @@ -73,10 +68,10 @@ void CollectionAPI_GroupSubstraction::dump(ModelHighAPI_Dumper& theDumper) const << anObjectsList << ", " << aToolsList << ")" << std::endl; } -GroupSubstractionPtr addGroupSubstraction(const std::shared_ptr& thePart, - const std::list& theObjectsList, - const std::list& theToolsList) -{ +GroupSubstractionPtr +addGroupSubstraction(const std::shared_ptr &thePart, + const std::list &theObjectsList, + const std::list &theToolsList) { std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_GroupSubstraction::ID()); return GroupSubstractionPtr(new CollectionAPI_GroupSubstraction( diff --git a/src/CollectionAPI/CollectionAPI_GroupSubstraction.h b/src/CollectionAPI/CollectionAPI_GroupSubstraction.h index 37901bd99..1a6644e01 100644 --- a/src/CollectionAPI/CollectionAPI_GroupSubstraction.h +++ b/src/CollectionAPI/CollectionAPI_GroupSubstraction.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionAPI_GroupSubstraction_H_ @@ -33,40 +34,42 @@ class ModelHighAPI_Selection; /// \class CollectionAPI_GroupSubstraction /// \ingroup CPPHighAPI /// \brief Interface for Group Intersection feature. -class CollectionAPI_GroupSubstraction : public ModelHighAPI_Interface -{ +class CollectionAPI_GroupSubstraction : public ModelHighAPI_Interface { public: /// Constructor without values. COLLECTIONAPI_EXPORT - explicit CollectionAPI_GroupSubstraction(const std::shared_ptr& theFeature); + explicit CollectionAPI_GroupSubstraction( + const std::shared_ptr &theFeature); /// Constructor with values. COLLECTIONAPI_EXPORT - CollectionAPI_GroupSubstraction(const std::shared_ptr& theFeature, - const std::list& theObjectsList, - const std::list& theToolsList); + CollectionAPI_GroupSubstraction( + const std::shared_ptr &theFeature, + const std::list &theObjectsList, + const std::list &theToolsList); /// Destructor. COLLECTIONAPI_EXPORT virtual ~CollectionAPI_GroupSubstraction(); - INTERFACE_2(CollectionPlugin_GroupSubstraction::ID(), - objectsList, CollectionPlugin_GroupSubstraction::LIST_ID(), - ModelAPI_AttributeSelectionList, /** Objects list*/, - toolsList, CollectionPlugin_GroupSubstraction::TOOLS_ID(), - ModelAPI_AttributeSelectionList, /** Tools list*/) + INTERFACE_2(CollectionPlugin_GroupSubstraction::ID(), objectsList, + CollectionPlugin_GroupSubstraction::LIST_ID(), + ModelAPI_AttributeSelectionList, /** Objects list*/, toolsList, + CollectionPlugin_GroupSubstraction::TOOLS_ID(), + ModelAPI_AttributeSelectionList, + /** Tools list*/) /// Set main objects. COLLECTIONAPI_EXPORT - void setObjectsList(const std::list& theGroupList); + void setObjectsList(const std::list &theGroupList); /// Set tools. COLLECTIONAPI_EXPORT - void setToolsList(const std::list& theGroupList); + void setToolsList(const std::list &theGroupList); /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Group Addition object. @@ -75,8 +78,9 @@ typedef std::shared_ptr GroupSubstractionPtr; /// \ingroup CPPHighAPI /// \brief Create Group Substraction feature. COLLECTIONAPI_EXPORT -GroupSubstractionPtr addGroupSubstraction(const std::shared_ptr& thePart, - const std::list& theObjectsList, - const std::list& theToolsList); +GroupSubstractionPtr +addGroupSubstraction(const std::shared_ptr &thePart, + const std::list &theObjectsList, + const std::list &theToolsList); #endif // CollectionAPI_GroupSubstraction_H_ diff --git a/src/CollectionPlugin/CMakeLists.txt b/src/CollectionPlugin/CMakeLists.txt index 1a3850582..5ca2b9fa6 100644 --- a/src/CollectionPlugin/CMakeLists.txt +++ b/src/CollectionPlugin/CMakeLists.txt @@ -126,16 +126,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/CollectionPlugin") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/CollectionPlugin/CollectionPlugin.h b/src/CollectionPlugin/CollectionPlugin.h index f27ef8d44..b574c7ac7 100644 --- a/src/CollectionPlugin/CollectionPlugin.h +++ b/src/CollectionPlugin/CollectionPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_H @@ -22,13 +23,13 @@ #if defined COLLECTIONPLUGIN_EXPORTS #if defined WIN32 -#define COLLECTIONPLUGIN_EXPORT __declspec( dllexport ) +#define COLLECTIONPLUGIN_EXPORT __declspec(dllexport) #else #define COLLECTIONPLUGIN_EXPORT #endif #else #if defined WIN32 -#define COLLECTIONPLUGIN_EXPORT __declspec( dllimport ) +#define COLLECTIONPLUGIN_EXPORT __declspec(dllimport) #else #define COLLECTIONPLUGIN_EXPORT #endif diff --git a/src/CollectionPlugin/CollectionPlugin_Field.cpp b/src/CollectionPlugin/CollectionPlugin_Field.cpp index 7651133a8..46c7e31b2 100644 --- a/src/CollectionPlugin/CollectionPlugin_Field.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Field.cpp @@ -14,39 +14,40 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_Field.h" -#include -#include -#include -#include #include +#include +#include #include +#include +#include #include #include #include -CollectionPlugin_Field::CollectionPlugin_Field() -{ -} +CollectionPlugin_Field::CollectionPlugin_Field() {} -void CollectionPlugin_Field::initAttributes() -{ - data()->addAttribute(SELECTED_ID(), ModelAPI_AttributeSelectionList::typeId()); +void CollectionPlugin_Field::initAttributes() { + data()->addAttribute(SELECTED_ID(), + ModelAPI_AttributeSelectionList::typeId()); // for the whole part result is not obligatory - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SELECTED_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + SELECTED_ID()); - data()->addAttribute(COMPONENTS_NAMES_ID(), ModelAPI_AttributeStringArray::typeId()); + data()->addAttribute(COMPONENTS_NAMES_ID(), + ModelAPI_AttributeStringArray::typeId()); data()->addAttribute(STAMPS_ID(), ModelAPI_AttributeIntArray::typeId()); data()->addAttribute(VALUES_ID(), ModelAPI_AttributeTables::typeId()); } -void CollectionPlugin_Field::execute() -{ - if (results().empty() || firstResult()->isDisabled()) { // just create result if not exists +void CollectionPlugin_Field::execute() { + if (results().empty() || + firstResult()->isDisabled()) { // just create result if not exists ResultPtr aField = document()->createField(data()); setResult(aField); } diff --git a/src/CollectionPlugin/CollectionPlugin_Field.h b/src/CollectionPlugin/CollectionPlugin_Field.h index 2fa2b2806..342e35d33 100644 --- a/src/CollectionPlugin/CollectionPlugin_Field.h +++ b/src/CollectionPlugin/CollectionPlugin_Field.h @@ -14,68 +14,65 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_FIELD_H_ #define COLLECTIONPLUGIN_FIELD_H_ #include "CollectionPlugin.h" -#include #include +#include /**\class CollectionPlugin_Field * \ingroup Plugins - * \brief Feature for selection of sub-shapes of some shapes and assigning data on them. + * \brief Feature for selection of sub-shapes of some shapes and assigning data + * on them. + * + * There is a set of containers that contains the following data that may be + * inserted by the user: * - * There is a set of containers that contains the following data that may be inserted by the user: - * * Selected sub-shapes (like in Groups). * Number of components for each selection. * Components names * Type of values: Boolean, Integer, Double or String. - * Number of steps: for each step (indexes are zero-based) the values below are multiplied. - * Stamp: integer identifier per each step - * Defaul values for each components - * Values for each component and each selected sub-shape: all are of specific type. + * Number of steps: for each step (indexes are zero-based) the values below are + * multiplied. Stamp: integer identifier per each step Defaul values for each + * components Values for each component and each selected sub-shape: all are of + * specific type. */ -class CollectionPlugin_Field : public ModelAPI_Feature -{ - public: +class CollectionPlugin_Field : public ModelAPI_Feature { +public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_FIELD_ID("Field"); return MY_FIELD_ID; } /// attribute name of selected entities list - inline static const std::string& SELECTED_ID() - { + inline static const std::string &SELECTED_ID() { static const std::string MY_SELECTED_ID("selected"); return MY_SELECTED_ID; } /// attribute name of componenets titles array - inline static const std::string& COMPONENTS_NAMES_ID() - { + inline static const std::string &COMPONENTS_NAMES_ID() { static const std::string MY_COMPONENTS_NAMES_ID("components_names"); return MY_COMPONENTS_NAMES_ID; } /// attribute name of stamps integer array - inline static const std::string& STAMPS_ID() - { + inline static const std::string &STAMPS_ID() { static const std::string MY_STAMPS_ID("stamps"); return MY_STAMPS_ID; } - /// attribute name of list of tables that contain deafult values (row 0) and the custom values - inline static const std::string& VALUES_ID() - { + /// attribute name of list of tables that contain deafult values (row 0) and + /// the custom values + inline static const std::string &VALUES_ID() { static const std::string MY_VALUES_ID("values"); return MY_VALUES_ID; } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = CollectionPlugin_Field::ID(); return MY_KIND; } @@ -83,15 +80,15 @@ class CollectionPlugin_Field : public ModelAPI_Feature /// Creates a new field result if needed COLLECTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); /// Result of fields is created on the fly and don't stored to the document - COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} + COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return false; } /// Use plugin manager for features creation CollectionPlugin_Field(); - }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_Group.cpp b/src/CollectionPlugin/CollectionPlugin_Group.cpp index bba5dc1e0..451371c81 100644 --- a/src/CollectionPlugin/CollectionPlugin_Group.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Group.cpp @@ -14,89 +14,90 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_Group.h" -#include -#include +#include #include -#include #include -#include +#include +#include +#include #include #include #include -CollectionPlugin_Group::CollectionPlugin_Group() -{ -} +CollectionPlugin_Group::CollectionPlugin_Group() {} -void CollectionPlugin_Group::initAttributes() -{ - AttributeSelectionListPtr aList = std::dynamic_pointer_cast( - data()->addAttribute(LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); +void CollectionPlugin_Group::initAttributes() { + AttributeSelectionListPtr aList = + std::dynamic_pointer_cast( + data()->addAttribute(LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); aList->setWholeResultAllowed(true); // allow to select the whole result } -void CollectionPlugin_Group::execute() -{ - if (results().empty() || firstResult()->isDisabled()) { // just create result if not exists +void CollectionPlugin_Group::execute() { + if (results().empty() || + firstResult()->isDisabled()) { // just create result if not exists ResultPtr aGroup = document()->createGroup(data()); setResult(aGroup); } } // returns name with suffix, not existing in the existing set -static std::wstring findName( - const std::wstring theOrigin, int& theSuffix, std::set& theExisting) -{ +static std::wstring findName(const std::wstring theOrigin, int &theSuffix, + std::set &theExisting) { std::wstring aRes; do { std::wostringstream aName; - aName<contextFeature().get()) return 0; - ResultBodyPtr aRes = std::dynamic_pointer_cast(theAttr->context()); + ResultBodyPtr aRes = + std::dynamic_pointer_cast(theAttr->context()); if (aRes.get()) { int aDepth = 0; - for(aRes = ModelAPI_Tools::bodyOwner(aRes); aRes.get(); aRes = ModelAPI_Tools::bodyOwner(aRes)) + for (aRes = ModelAPI_Tools::bodyOwner(aRes); aRes.get(); + aRes = ModelAPI_Tools::bodyOwner(aRes)) aDepth++; return aDepth; } return 0; } -bool CollectionPlugin_Group::customAction(const std::string& theActionId) -{ +bool CollectionPlugin_Group::customAction(const std::string &theActionId) { if (theActionId == "split") { DocumentPtr aDoc = document(); // collect all existing names of features to give unique names std::set aFeatNames, aResNames; std::list allFeat = aDoc->allFeatures(); std::list::iterator allFeatIter = allFeat.begin(); - for(; allFeatIter != allFeat.end(); allFeatIter++) { + for (; allFeatIter != allFeat.end(); allFeatIter++) { FeaturePtr aFeat = *allFeatIter; if (aFeat->data().get() && aFeat->data()->isValid()) { aFeatNames.insert(aFeat->name()); - if (aFeat->getKind() == ID() && aFeat->data().get() && aFeat->data()->isValid()) { - std::list::const_iterator aRess = aFeat->results().cbegin(); - for(; aRess != aFeat->results().cend(); aRess++) { - ResultPtr aRes = *aRess; - if (aRes->data().get() && aRes->data()->isValid()) { - aResNames.insert(aRes->data()->name()); - } - } + if (aFeat->getKind() == ID() && aFeat->data().get() && + aFeat->data()->isValid()) { + std::list::const_iterator aRess = + aFeat->results().cbegin(); + for (; aRess != aFeat->results().cend(); aRess++) { + ResultPtr aRes = *aRess; + if (aRes->data().get() && aRes->data()->isValid()) { + aResNames.insert(aRes->data()->name()); + } + } } } } @@ -118,17 +119,19 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) std::map aFathers; std::map aFatherGroup; bool aSplitAnyway = false; - for(int aCurrentDepth = 0; aCurrentDepth <= aMinDepth; aCurrentDepth++) { + for (int aCurrentDepth = 0; aCurrentDepth <= aMinDepth; aCurrentDepth++) { aFathers.clear(); aFatherGroup.clear(); for (int a = aList->size() - 1; a >= 0; a--) { - // start from zero (this group index), then from the end - as in the next iteration + // start from zero (this group index), then from the end - as in the + // next iteration AttributeSelectionPtr anAttr = aList->value(a); if (!anAttr->isInvalid() && anAttr->contextObject().get()) { ObjectPtr anObj = anAttr->contextObject(); int aDepth = aStoredDepth[anObj]; if (!aSplitAnyway && aDepth > aCurrentDepth) { - ResultBodyPtr aRes = std::dynamic_pointer_cast(anObj); + ResultBodyPtr aRes = + std::dynamic_pointer_cast(anObj); while (aDepth > aCurrentDepth) { aRes = ModelAPI_Tools::bodyOwner(aRes); aDepth--; @@ -142,21 +145,27 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) } } } - if (aFatherGroup.size() < (size_t)aList->size() && aFatherGroup.size() != 1) // already good + if (aFatherGroup.size() < (size_t)aList->size() && + aFatherGroup.size() != 1) // already good break; - if (aFatherGroup.size() == (size_t)aList->size()) // no sence to iterate further + if (aFatherGroup.size() == + (size_t)aList->size()) // no sence to iterate further break; - if (aFatherGroup.size() == 1 && aList->size() > 1 && aCurrentDepth == aMinDepth) - aSplitAnyway = true; // split anyway, better that just move + if (aFatherGroup.size() == 1 && aList->size() > 1 && + aCurrentDepth == aMinDepth) + aSplitAnyway = true; // split anyway, better that just move } std::set aRemoved; - bool aStay = false; // to indicate that the good attribute found stays in the list - // added in the order: 3 2 1 orig=0, so, keep the results to give names later + bool aStay = + false; // to indicate that the good attribute found stays in the list + // added in the order: 3 2 1 orig=0, so, keep the results to give names + // later std::list aResults; - for(int aNext = aList->size() - 1; aNext >= 0; aNext--) { + for (int aNext = aList->size() - 1; aNext >= 0; aNext--) { AttributeSelectionPtr anOldAttr = aList->value(aNext); - if (anOldAttr->isInvalid() || !anOldAttr->contextObject().get()) {// remove invalids + if (anOldAttr->isInvalid() || + !anOldAttr->contextObject().get()) { // remove invalids aRemoved.insert(aNext); continue; } @@ -173,7 +182,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) if (aSplitAnyway || aFGroup > (int)aResults.size()) { aNew = aDoc->addFeature(ID(), false); aResults.push_front(aNew); // to keep the order - } else { // appending in already created new result + } else { // appending in already created new result std::list::reverse_iterator aResIter = aResults.rbegin(); for (; aFGroup > 1; aResIter++) aFGroup--; @@ -184,21 +193,25 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) aNewList->setSelectionType(aList->selectionType()); aNewList->append(anOldAttr->contextObject(), anOldAttr->value()); } - aResults.push_back(std::dynamic_pointer_cast(data()->owner())); + aResults.push_back( + std::dynamic_pointer_cast(data()->owner())); // remove all selections except the first aList->remove(aRemoved); // set names if (aResults.size() > 1) { // rename if there are new groups appeared only std::list::iterator aResIter = aResults.begin(); - for(int aSuffix = 1; aResIter != aResults.end(); aResIter++) { - FeaturePtr aFeat = std::dynamic_pointer_cast(*aResIter); + for (int aSuffix = 1; aResIter != aResults.end(); aResIter++) { + FeaturePtr aFeat = + std::dynamic_pointer_cast(*aResIter); aFeat->execute(); aFeat->data()->setName(findName(name(), aSuffix, aFeatNames)); if (!aFeat->results().empty() && !results().empty()) { int aResSuf = aSuffix - 1; - std::wstring aResName = findName(firstResult()->data()->name(), aResSuf, aResNames); + std::wstring aResName = + findName(firstResult()->data()->name(), aResSuf, aResNames); aFeat->firstResult()->data()->setName(aResName); - ModelAPI_Tools::copyVisualizationAttrs(firstResult(), aFeat->firstResult()); + ModelAPI_Tools::copyVisualizationAttrs(firstResult(), + aFeat->firstResult()); } } // remove also filters if split performed @@ -206,7 +219,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) if (aFilters.get()) { std::list aFiltersList = aFilters->filters(); std::list::iterator aFilterName = aFiltersList.begin(); - for(; aFilterName != aFiltersList.end(); aFilterName++) { + for (; aFilterName != aFiltersList.end(); aFilterName++) { aFilters->removeFilter(*aFilterName); } } diff --git a/src/CollectionPlugin/CollectionPlugin_Group.h b/src/CollectionPlugin/CollectionPlugin_Group.h index ec3ce4ec7..0994b19fa 100644 --- a/src/CollectionPlugin/CollectionPlugin_Group.h +++ b/src/CollectionPlugin/CollectionPlugin_Group.h @@ -14,42 +14,39 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUP_H_ #define COLLECTIONPLUGIN_GROUP_H_ #include "CollectionPlugin.h" -#include #include +#include /**\class CollectionPlugin_Group * \ingroup Plugins * \brief Feature for selection of sub-shapes of some shapes. * - * All selected sub-shapes must be of equal type (vertex, edge, face, etc) but may - * be selected on different objects. + * All selected sub-shapes must be of equal type (vertex, edge, face, etc) but + * may be selected on different objects. */ -class CollectionPlugin_Group : public ModelAPI_Feature -{ - public: +class CollectionPlugin_Group : public ModelAPI_Feature { +public: /// Extrusion kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_GROUP_ID("Group"); return MY_GROUP_ID; } /// attribute name of selected entities list - inline static const std::string& LIST_ID() - { + inline static const std::string &LIST_ID() { static const std::string MY_GROUP_LIST_ID("group_list"); return MY_GROUP_LIST_ID; } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = CollectionPlugin_Group::ID(); return MY_KIND; } @@ -57,17 +54,19 @@ class CollectionPlugin_Group : public ModelAPI_Feature /// Creates a new group result if needed COLLECTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); /// Result of groups is created on the fly and don't stored to the document - COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return true;} + COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return true; } /// Use plugin manager for features creation CollectionPlugin_Group(); /// Used for the split action of the group (Move to the end and split) - COLLECTIONPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId); + COLLECTIONPLUGIN_EXPORT virtual bool + customAction(const std::string &theActionId); }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupAddition.cpp b/src/CollectionPlugin/CollectionPlugin_GroupAddition.cpp index 714d3a533..a202cf0b1 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupAddition.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupAddition.cpp @@ -14,14 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_GroupAddition.h" - -void CollectionPlugin_GroupAddition::execute() -{ +void CollectionPlugin_GroupAddition::execute() { ResultGroupPtr aGroup; CollectionPlugin_GroupMerge::execute(aGroup); setResult(aGroup); diff --git a/src/CollectionPlugin/CollectionPlugin_GroupAddition.h b/src/CollectionPlugin/CollectionPlugin_GroupAddition.h index e1cacee86..300db8d06 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupAddition.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupAddition.h @@ -14,33 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUPADDITION_H_ #define COLLECTIONPLUGIN_GROUPADDITION_H_ #include "CollectionPlugin.h" -#include "CollectionPlugin_GroupOperation.h" #include "CollectionPlugin_GroupMerge.h" +#include "CollectionPlugin_GroupOperation.h" /**\class CollectionPlugin_GroupAddition * \ingroup Plugins * \brief Merge several groups of same shape type into single group. */ -class CollectionPlugin_GroupAddition : public CollectionPlugin_GroupMerge -{ +class CollectionPlugin_GroupAddition : public CollectionPlugin_GroupMerge { public: /// Extrusion kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_GROUP_ID("GroupAddition"); return MY_GROUP_ID; } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = CollectionPlugin_GroupAddition::ID(); return MY_KIND; } @@ -50,7 +48,6 @@ public: /// Use plugin manager for features creation CollectionPlugin_GroupAddition() = default; - }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp index a297f08d8..05c0532e9 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_GroupIntersection.h" -#include -#include #include -#include #include +#include +#include +#include #include #include @@ -32,29 +33,25 @@ typedef std::set SetOfShape; -CollectionPlugin_GroupIntersection::CollectionPlugin_GroupIntersection() -{ -} +CollectionPlugin_GroupIntersection::CollectionPlugin_GroupIntersection() {} -void CollectionPlugin_GroupIntersection::initAttributes() -{ +void CollectionPlugin_GroupIntersection::initAttributes() { data()->addAttribute(CollectionPlugin_GroupIntersection::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); } -static void explodeCompound(const GeomShapePtr& theCompound, SetOfShape& theSet) -{ +static void explodeCompound(const GeomShapePtr &theCompound, + SetOfShape &theSet) { for (GeomAPI_ShapeIterator anIt(theCompound); anIt.more(); anIt.next()) theSet.insert(anIt.current()); } -static void keepCommonShapes(const GeomShapePtr& theCompound, ListOfShape& theShapes) -{ +static void keepCommonShapes(const GeomShapePtr &theCompound, + ListOfShape &theShapes) { if (theShapes.empty()) { for (GeomAPI_ShapeIterator anIt(theCompound); anIt.more(); anIt.next()) theShapes.push_back(anIt.current()); - } - else { + } else { SetOfShape aSubs; explodeCompound(theCompound, aSubs); @@ -64,15 +61,13 @@ static void keepCommonShapes(const GeomShapePtr& theCompound, ListOfShape& theSh // the shape is not found ListOfShape::iterator aRemoveIt = anIt++; theShapes.erase(aRemoveIt); - } - else + } else ++anIt; } } } -void CollectionPlugin_GroupIntersection::execute() -{ +void CollectionPlugin_GroupIntersection::execute() { ResultGroupPtr aGroup = document()->createGroup(data()); // clean the result of the operation aGroup->store(GeomShapePtr()); @@ -84,8 +79,8 @@ void CollectionPlugin_GroupIntersection::execute() AttributeSelectionListPtr aSelectedGroups = selectionList(LIST_ID()); for (int anIndex = 0; anIndex < aSelectedGroups->size(); ++anIndex) { AttributeSelectionPtr aCurSelection = aSelectedGroups->value(anIndex); - ResultGroupPtr aCurGroup = - std::dynamic_pointer_cast(aCurSelection->context()); + ResultGroupPtr aCurGroup = std::dynamic_pointer_cast( + aCurSelection->context()); keepCommonShapes(aCurGroup->shape(), aCommon); if (aCommon.empty()) break; @@ -94,8 +89,7 @@ void CollectionPlugin_GroupIntersection::execute() if (aCommon.empty()) { setError("Error: Empty result."); removeResults(0); - } - else { + } else { // update the type of selection updateGroupType(LIST_ID()); diff --git a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h index 4cbd72136..4df08889d 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUPINTERSECTION_H_ @@ -27,25 +28,22 @@ * \ingroup Plugins * \brief Merge several groups of same shape type into single group. */ -class CollectionPlugin_GroupIntersection : public CollectionPlugin_GroupOperation -{ +class CollectionPlugin_GroupIntersection + : public CollectionPlugin_GroupOperation { public: /// Extrusion kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_GROUP_ID("GroupIntersection"); return MY_GROUP_ID; } /// attribute name of selected entities list - inline static const std::string& LIST_ID() - { + inline static const std::string &LIST_ID() { static const std::string MY_GROUP_LIST_ID("group_list"); return MY_GROUP_LIST_ID; } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = CollectionPlugin_GroupIntersection::ID(); return MY_KIND; } @@ -53,12 +51,12 @@ public: /// Creates a new group result if needed COLLECTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation CollectionPlugin_GroupIntersection(); - }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp b/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp index b85555eda..8be380abe 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp @@ -14,40 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_GroupMerge.h" -#include -#include #include -#include #include +#include +#include +#include #include #include #include -void CollectionPlugin_GroupMerge::initAttributes() -{ +void CollectionPlugin_GroupMerge::initAttributes() { data()->addAttribute(CollectionPlugin_GroupMerge::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); } -static void explodeCompound(const GeomShapePtr& theCompound, ListOfShape& theSubs) -{ +static void explodeCompound(const GeomShapePtr &theCompound, + ListOfShape &theSubs) { if (theCompound->isCompound()) { GeomAPI_ShapeIterator anIt(theCompound); for (; anIt.more(); anIt.next()) explodeCompound(anIt.current(), theSubs); - } - else + } else theSubs.push_back(theCompound); } -static void keepUniqueShapes(ListOfShape& theShapes) -{ +static void keepUniqueShapes(ListOfShape &theShapes) { ListOfShape::iterator anIt = theShapes.begin(); while (anIt != theShapes.end()) { GeomShapePtr aCurrent = *anIt; @@ -59,14 +57,12 @@ static void keepUniqueShapes(ListOfShape& theShapes) // the same shape is found ListOfShape::iterator aRemoveIt = anIt++; theShapes.erase(aRemoveIt); - } - else + } else ++anIt; } } -void CollectionPlugin_GroupMerge::execute(ResultGroupPtr & aGroup) -{ +void CollectionPlugin_GroupMerge::execute(ResultGroupPtr &aGroup) { aGroup = document()->createGroup(data()); // clean the result of the operation aGroup->store(GeomShapePtr()); @@ -76,7 +72,8 @@ void CollectionPlugin_GroupMerge::execute(ResultGroupPtr & aGroup) ListOfShape aSubs; explodeCompound(aCompound, aSubs); keepUniqueShapes(aSubs); - aCompound = aSubs.empty() ? GeomShapePtr() : GeomAlgoAPI_CompoundBuilder::compound(aSubs); + aCompound = aSubs.empty() ? GeomShapePtr() + : GeomAlgoAPI_CompoundBuilder::compound(aSubs); aGroup->store(aCompound); // update the type of selection diff --git a/src/CollectionPlugin/CollectionPlugin_GroupMerge.h b/src/CollectionPlugin/CollectionPlugin_GroupMerge.h index 66dc05271..799a51595 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupMerge.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupMerge.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUPMERGE_H_ @@ -29,26 +30,23 @@ * \brief Merge several groups of same or different shape type, * \the validator being used for the shape type. */ -class CollectionPlugin_GroupMerge: public CollectionPlugin_GroupOperation -{ +class CollectionPlugin_GroupMerge : public CollectionPlugin_GroupOperation { public: /// attribute name of selected entities list - inline static const std::string& LIST_ID() - { + inline static const std::string &LIST_ID() { static const std::string MY_GROUP_LIST_ID("group_list"); return MY_GROUP_LIST_ID; } - /// Creates a new group result if needed - COLLECTIONPLUGIN_EXPORT void execute(ResultGroupPtr & aGroup); + COLLECTIONPLUGIN_EXPORT void execute(ResultGroupPtr &aGroup); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation CollectionPlugin_GroupMerge() = default; - }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupOperation.cpp b/src/CollectionPlugin/CollectionPlugin_GroupOperation.cpp index ede8242bd..cb3d5c494 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupOperation.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupOperation.cpp @@ -14,21 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_GroupOperation.h" #include -void CollectionPlugin_GroupOperation::updateGroupType(const std::string& theAttributeName) -{ +void CollectionPlugin_GroupOperation::updateGroupType( + const std::string &theAttributeName) { AttributeSelectionListPtr aSelected = selectionList(theAttributeName); if (aSelected->size()) { - FeaturePtr aFirstGroup = ModelAPI_Feature::feature(aSelected->value(0)->context()); + FeaturePtr aFirstGroup = + ModelAPI_Feature::feature(aSelected->value(0)->context()); if (aFirstGroup) { AttributeSelectionListPtr aFirstGroupShapes = - aFirstGroup->selectionList(CollectionPlugin_Group::LIST_ID()); + aFirstGroup->selectionList(CollectionPlugin_Group::LIST_ID()); if (aFirstGroupShapes) aSelected->setSelectionType(aFirstGroupShapes->selectionType()); } diff --git a/src/CollectionPlugin/CollectionPlugin_GroupOperation.h b/src/CollectionPlugin/CollectionPlugin_GroupOperation.h index c6a5242d3..9b8db711b 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupOperation.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupOperation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUPOPERATION_H_ @@ -27,15 +28,14 @@ * \ingroup Plugins * \brief Base class for operations on groups. */ -class CollectionPlugin_GroupOperation : public CollectionPlugin_Group -{ +class CollectionPlugin_GroupOperation : public CollectionPlugin_Group { public: /// Result of groups is created on the fly and don't stored to the document - COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return true;} + COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return true; } protected: /// Updates the type of selection list based on types of selected groups - void updateGroupType(const std::string& theAttributeName); + void updateGroupType(const std::string &theAttributeName); }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp index e74ccabfa..7f152f499 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_GroupShape.h" @@ -22,16 +23,14 @@ #include #include -void CollectionPlugin_GroupShape::execute() -{ +void CollectionPlugin_GroupShape::execute() { ResultGroupPtr aGroup; CollectionPlugin_GroupMerge::execute(aGroup); GeomShapePtr aCompound = aGroup->shape(); - const TopoDS_Shape & aShape = aCompound->impl(); + const TopoDS_Shape &aShape = aCompound->impl(); - if(aShape.NbChildren() == 1) - { + if (aShape.NbChildren() == 1) { /// unique shape, remove compound on type TopoDS_Iterator anIt(aShape); @@ -42,9 +41,10 @@ void CollectionPlugin_GroupShape::execute() aCompound = aGroup->shape(); } - std::shared_ptr theResultBody = document()->createBody(data()); + std::shared_ptr theResultBody = + document()->createBody(data()); theResultBody->store(GeomShapePtr()); - if(!aCompound->empty()) + if (!aCompound->empty()) theResultBody->store(aCompound); setResult(theResultBody); } diff --git a/src/CollectionPlugin/CollectionPlugin_GroupShape.h b/src/CollectionPlugin/CollectionPlugin_GroupShape.h index 66caf176d..5a7c92b93 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupShape.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupShape.h @@ -14,33 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUPSHAPE_H_ #define COLLECTIONPLUGIN_GROUPSHAPE_H_ #include "CollectionPlugin.h" -#include "CollectionPlugin_GroupOperation.h" #include "CollectionPlugin_GroupMerge.h" +#include "CollectionPlugin_GroupOperation.h" /**\class CollectionPlugin_GroupShape * \ingroup Plugins * \brief Merge several groups of different shape type into a single shape. */ -class CollectionPlugin_GroupShape: public CollectionPlugin_GroupMerge -{ +class CollectionPlugin_GroupShape : public CollectionPlugin_GroupMerge { public: /// Extrusion kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_GROUP_ID("GroupShape"); return MY_GROUP_ID; } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = CollectionPlugin_GroupShape::ID(); return MY_KIND; } @@ -50,7 +48,6 @@ public: /// Use plugin manager for features creation CollectionPlugin_GroupShape() = default; - }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp index 46056805d..c3af3434f 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_GroupSubstraction.h" -#include -#include #include -#include #include +#include +#include +#include #include #include @@ -32,28 +33,24 @@ typedef std::set SetOfShape; -CollectionPlugin_GroupSubstraction::CollectionPlugin_GroupSubstraction() -{ -} +CollectionPlugin_GroupSubstraction::CollectionPlugin_GroupSubstraction() {} -void CollectionPlugin_GroupSubstraction::initAttributes() -{ +void CollectionPlugin_GroupSubstraction::initAttributes() { data()->addAttribute(CollectionPlugin_GroupSubstraction::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(CollectionPlugin_GroupSubstraction::TOOLS_ID(), ModelAPI_AttributeSelectionList::typeId()); } -static void explodeCompound(const GeomShapePtr& theCompound, SetOfShape& theSet) -{ +static void explodeCompound(const GeomShapePtr &theCompound, + SetOfShape &theSet) { for (GeomAPI_ShapeIterator anIt(theCompound); anIt.more(); anIt.next()) theSet.insert(anIt.current()); } -static void subtractLists(const GeomShapePtr& theCompound, - const SetOfShape& theExclude, - ListOfShape& theResult) -{ +static void subtractLists(const GeomShapePtr &theCompound, + const SetOfShape &theExclude, + ListOfShape &theResult) { for (GeomAPI_ShapeIterator anIt(theCompound); anIt.more(); anIt.next()) { GeomShapePtr aCurrent = anIt.current(); if (theExclude.find(aCurrent) != theExclude.end()) @@ -68,8 +65,7 @@ static void subtractLists(const GeomShapePtr& theCompound, } } -void CollectionPlugin_GroupSubstraction::execute() -{ +void CollectionPlugin_GroupSubstraction::execute() { ResultGroupPtr aGroup = document()->createGroup(data()); // clean the result of the operation aGroup->store(GeomShapePtr()); @@ -79,8 +75,8 @@ void CollectionPlugin_GroupSubstraction::execute() AttributeSelectionListPtr aTools = selectionList(TOOLS_ID()); for (int anIndex = 0; anIndex < aTools->size(); ++anIndex) { AttributeSelectionPtr aCurSelection = aTools->value(anIndex); - ResultGroupPtr aCurGroup = - std::dynamic_pointer_cast(aCurSelection->context()); + ResultGroupPtr aCurGroup = std::dynamic_pointer_cast( + aCurSelection->context()); explodeCompound(aCurGroup->shape(), aShapesToExclude); } @@ -89,8 +85,8 @@ void CollectionPlugin_GroupSubstraction::execute() AttributeSelectionListPtr anObjects = selectionList(LIST_ID()); for (int anIndex = 0; anIndex < anObjects->size(); ++anIndex) { AttributeSelectionPtr aCurSelection = anObjects->value(anIndex); - ResultGroupPtr aCurGroup = - std::dynamic_pointer_cast(aCurSelection->context()); + ResultGroupPtr aCurGroup = std::dynamic_pointer_cast( + aCurSelection->context()); subtractLists(aCurGroup->shape(), aShapesToExclude, aCut); if (aCut.empty()) break; @@ -99,8 +95,7 @@ void CollectionPlugin_GroupSubstraction::execute() if (aCut.empty()) { setError("Error: Empty result."); removeResults(0); - } - else { + } else { // update the type of selection updateGroupType(LIST_ID()); diff --git a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h index 4c3e5df6f..9c6c00b60 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef COLLECTIONPLUGIN_GROUPSUBSTRACTION_H_ @@ -25,33 +26,30 @@ /**\class CollectionPlugin_GroupSubstraction * \ingroup Plugins - * \brief Remove all elements in "objects" groups which contain in "tools" groups. + * \brief Remove all elements in "objects" groups which contain in "tools" + * groups. */ -class CollectionPlugin_GroupSubstraction : public CollectionPlugin_GroupOperation -{ +class CollectionPlugin_GroupSubstraction + : public CollectionPlugin_GroupOperation { public: /// Extrusion kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_GROUP_ID("GroupSubstraction"); return MY_GROUP_ID; } /// attribute name of selected objects list - inline static const std::string& LIST_ID() - { + inline static const std::string &LIST_ID() { static const std::string MY_GROUP_LIST_ID("group_list"); return MY_GROUP_LIST_ID; } /// attribute name of selected tools list - inline static const std::string& TOOLS_ID() - { + inline static const std::string &TOOLS_ID() { static const std::string MY_GROUP_LIST_ID("tools_list"); return MY_GROUP_LIST_ID; } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = CollectionPlugin_GroupSubstraction::ID(); return MY_KIND; } @@ -59,12 +57,12 @@ public: /// Creates a new group result if needed COLLECTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation CollectionPlugin_GroupSubstraction(); - }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_Plugin.cpp b/src/CollectionPlugin/CollectionPlugin_Plugin.cpp index db4a641b4..b0e9e6e39 100644 --- a/src/CollectionPlugin/CollectionPlugin_Plugin.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Plugin.cpp @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include +#include #include #include #include -#include #include -#include +#include #include #include @@ -32,34 +33,36 @@ #include "CollectionPlugin_WidgetCreator.h" -#include #include +#include // the only created instance of this plugin -static CollectionPlugin_Plugin* MY_COLLECTION_INSTANCE = new CollectionPlugin_Plugin(); +static CollectionPlugin_Plugin *MY_COLLECTION_INSTANCE = + new CollectionPlugin_Plugin(); -CollectionPlugin_Plugin::CollectionPlugin_Plugin() -{ - WidgetCreatorFactoryPtr aWidgetCreatorFactory = ModuleBase_WidgetCreatorFactory::get(); +CollectionPlugin_Plugin::CollectionPlugin_Plugin() { + WidgetCreatorFactoryPtr aWidgetCreatorFactory = + ModuleBase_WidgetCreatorFactory::get(); aWidgetCreatorFactory->registerCreator( - std::shared_ptr(new CollectionPlugin_WidgetCreator())); + std::shared_ptr( + new CollectionPlugin_WidgetCreator())); SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("CollectionPlugin_FieldValidator", - new CollectionPlugin_FieldValidator); - aFactory->registerValidator("CollectionPlugin_OperationAttribute", - new CollectionPlugin_GroupOperationAttributeValidator); + new CollectionPlugin_FieldValidator); + aFactory->registerValidator( + "CollectionPlugin_OperationAttribute", + new CollectionPlugin_GroupOperationAttributeValidator); aFactory->registerValidator("CollectionPlugin_GroupSelectionValidator", - new CollectionPlugin_GroupSelectionValidator); + new CollectionPlugin_GroupSelectionValidator); // register this plugin ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr CollectionPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr CollectionPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == CollectionPlugin_Group::ID()) { return FeaturePtr(new CollectionPlugin_Group); } else if (theFeatureID == CollectionPlugin_Field::ID()) { @@ -71,8 +74,8 @@ FeaturePtr CollectionPlugin_Plugin::createFeature(std::string theFeatureID) } else if (theFeatureID == CollectionPlugin_GroupSubstraction::ID()) { return FeaturePtr(new CollectionPlugin_GroupSubstraction); } else if (theFeatureID == CollectionPlugin_GroupShape::ID()) { - return FeaturePtr(new CollectionPlugin_GroupShape); - } + return FeaturePtr(new CollectionPlugin_GroupShape); + } // feature of such kind is not found return FeaturePtr(); diff --git a/src/CollectionPlugin/CollectionPlugin_Plugin.h b/src/CollectionPlugin/CollectionPlugin_Plugin.h index 5e60edce3..11d093cdc 100644 --- a/src/CollectionPlugin/CollectionPlugin_Plugin.h +++ b/src/CollectionPlugin/CollectionPlugin_Plugin.h @@ -14,27 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionPlugin_Plugin_H_ #define CollectionPlugin_Plugin_H_ #include "CollectionPlugin.h" -#include #include +#include /**\class CollectionPlugin_Plugin * \ingroup Plugins * \brief The main class for management the 3D features as plugin. */ -class COLLECTIONPLUGIN_EXPORT CollectionPlugin_Plugin : public ModelAPI_Plugin -{ - public: +class COLLECTIONPLUGIN_EXPORT CollectionPlugin_Plugin : public ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); - public: +public: /// Default constructor CollectionPlugin_Plugin(); }; diff --git a/src/CollectionPlugin/CollectionPlugin_Validators.cpp b/src/CollectionPlugin/CollectionPlugin_Validators.cpp index 3fd3e1f32..4114bdb5c 100644 --- a/src/CollectionPlugin/CollectionPlugin_Validators.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Validators.cpp @@ -14,23 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_Validators.h" -#include "CollectionPlugin_Group.h" #include "CollectionPlugin_Field.h" +#include "CollectionPlugin_Group.h" +#include #include #include -#include - -bool CollectionPlugin_FieldValidator::isValid(const FeaturePtr& theFeature, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool CollectionPlugin_FieldValidator::isValid( + const FeaturePtr &theFeature, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { AttributeSelectionListPtr aSelList = - theFeature->selectionList(CollectionPlugin_Field::SELECTED_ID()); + theFeature->selectionList(CollectionPlugin_Field::SELECTED_ID()); std::string aTypeStr = aSelList->selectionType(); if (aTypeStr == "part") return true; @@ -45,20 +45,22 @@ bool CollectionPlugin_FieldValidator::isValid(const FeaturePtr& theFeature, return false; } -static bool isGroupTypeCorrect(const AttributeSelectionPtr& theSelection, - std::string& theType, - Events_InfoMessage& theError) -{ +static bool isGroupTypeCorrect(const AttributeSelectionPtr &theSelection, + std::string &theType, + Events_InfoMessage &theError) { // applicable the groups only ResultPtr aGroupResult = theSelection->context(); - if (!aGroupResult.get() || aGroupResult->groupName() != ModelAPI_ResultGroup::group()) { + if (!aGroupResult.get() || + aGroupResult->groupName() != ModelAPI_ResultGroup::group()) { theError = "Error: Groups can be selected only."; return false; } // groups of same type can be selected only - FeaturePtr aGroupFeature = ModelAPI_Feature::feature(aGroupResult->data()->owner()); + FeaturePtr aGroupFeature = + ModelAPI_Feature::feature(aGroupResult->data()->owner()); std::string aGroupType = - aGroupFeature->selectionList(CollectionPlugin_Group::LIST_ID())->selectionType(); + aGroupFeature->selectionList(CollectionPlugin_Group::LIST_ID()) + ->selectionType(); if (theType.empty()) theType = aGroupType; else if (theType != aGroupType) { @@ -69,14 +71,14 @@ static bool isGroupTypeCorrect(const AttributeSelectionPtr& theSelection, } bool CollectionPlugin_GroupOperationAttributeValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr aSelList = std::dynamic_pointer_cast(theAttribute); if (!aSelList) { - theError = "Error: This validator can only work with selection list of attributes"; + theError = + "Error: This validator can only work with selection list of attributes"; return false; } @@ -102,14 +104,14 @@ bool CollectionPlugin_GroupOperationAttributeValidator::isValid( } bool CollectionPlugin_GroupSelectionValidator::isValid( - const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { AttributeSelectionListPtr aSelList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!aSelList) { - theError = "Error: This validator can only work with selection list of attributes"; + theError = + "Error: This validator can only work with selection list of attributes"; return false; } @@ -118,7 +120,8 @@ bool CollectionPlugin_GroupSelectionValidator::isValid( FeaturePtr aCurFeature = aCurSelection->contextFeature(); ResultPtr aGroupResult = aCurFeature.get() ? aCurFeature->lastResult() : aCurSelection->context(); - if (!aGroupResult.get() || aGroupResult->groupName() == ModelAPI_ResultGroup::group()) { + if (!aGroupResult.get() || + aGroupResult->groupName() == ModelAPI_ResultGroup::group()) { theError = "Error: Whole group mustn't be selected."; return false; } diff --git a/src/CollectionPlugin/CollectionPlugin_Validators.h b/src/CollectionPlugin/CollectionPlugin_Validators.h index a78790d50..5f252021f 100644 --- a/src/CollectionPlugin/CollectionPlugin_Validators.h +++ b/src/CollectionPlugin/CollectionPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionPlugin_Validators_H @@ -28,46 +29,45 @@ * \ingroup Validators * \brief Validator for the field. */ -class CollectionPlugin_FieldValidator : public ModelAPI_FeatureValidator -{ +class CollectionPlugin_FieldValidator : public ModelAPI_FeatureValidator { public: //! returns true if there are no solver errors //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const FeaturePtr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const FeaturePtr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class CollectionPlugin_GroupOperationAttributeValidator * \ingroup Validators * \brief Validator for the parameters of operation on groups. */ -class CollectionPlugin_GroupOperationAttributeValidator : public ModelAPI_AttributeValidator -{ +class CollectionPlugin_GroupOperationAttributeValidator + : public ModelAPI_AttributeValidator { //! Returns true if attribute is ok. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class CollectionPlugin_GroupSelectionValidator -* \ingroup Validators -* \brief Validator for prevent adding whole group in other group. -*/ -class CollectionPlugin_GroupSelectionValidator : public ModelAPI_AttributeValidator -{ + * \ingroup Validators + * \brief Validator for prevent adding whole group in other group. + */ +class CollectionPlugin_GroupSelectionValidator + : public ModelAPI_AttributeValidator { //! Returns true if attribute is ok. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute (not used). //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp index cff5b1155..18905621d 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp @@ -14,37 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_WidgetCreator.h" #include "CollectionPlugin_WidgetField.h" - CollectionPlugin_WidgetCreator::CollectionPlugin_WidgetCreator() -: ModuleBase_IWidgetCreator() -{ + : ModuleBase_IWidgetCreator() { myPanelTypes.insert("field-panel"); } -void CollectionPlugin_WidgetCreator::widgetTypes(std::set& theTypes) -{ +void CollectionPlugin_WidgetCreator::widgetTypes( + std::set &theTypes) { theTypes = myPanelTypes; } - -ModuleBase_ModelWidget* CollectionPlugin_WidgetCreator::createWidgetByType( - const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop) -{ - ModuleBase_ModelWidget* aWidget = 0; +ModuleBase_ModelWidget *CollectionPlugin_WidgetCreator::createWidgetByType( + const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { + ModuleBase_ModelWidget *aWidget = 0; if (myPanelTypes.find(theType) == myPanelTypes.end()) return aWidget; if (theType == "field-panel") { - aWidget = new CollectionPlugin_WidgetField(theParent, theWorkshop, theWidgetApi); + aWidget = + new CollectionPlugin_WidgetField(theParent, theWorkshop, theWidgetApi); } return aWidget; diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h index af2791991..3706652d2 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h +++ b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h @@ -14,27 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionPlugin_WidgetCreator_H #define CollectionPlugin_WidgetCreator_H - #include "CollectionPlugin.h" #include -#include #include +#include class QWidget; -/** -* \ingroup GUI -* Interface to WidgetCreator which can create specific widgets by type -*/ -class CollectionPlugin_WidgetCreator : public ModuleBase_IWidgetCreator -{ +/** + * \ingroup GUI + * Interface to WidgetCreator which can create specific widgets by type + */ +class CollectionPlugin_WidgetCreator : public ModuleBase_IWidgetCreator { public: /// Default constructor CollectionPlugin_WidgetCreator(); @@ -44,7 +43,7 @@ public: /// Returns a container of possible page types, which this creator can process /// \param theTypes a list of type names - virtual void widgetTypes(std::set& theTypes); + virtual void widgetTypes(std::set &theTypes); /// Create widget by its type /// The default implementation is empty @@ -53,12 +52,13 @@ public: /// \param theData a low-level API for reading xml definitions of widgets /// \param theWorkshop a current workshop /// \return a created model widget or null - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* /*theWorkshop*/); + virtual ModuleBase_ModelWidget * + createWidgetByType(const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, + ModuleBase_IWorkshop * /*theWorkshop*/); + private: std::set myPanelTypes; ///< types of panels }; -#endif \ No newline at end of file +#endif diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp index f1a5109ef..e9fa02049 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp @@ -14,142 +14,133 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "CollectionPlugin_WidgetField.h" #include "CollectionPlugin_Field.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 - -const char* MYFirstCol = "Shape"; -const char* MYTrue = "True"; -const char* MYFalse = "False"; +#include +#include +#include +#include +#include +#include -DataTableItemDelegate::DataTableItemDelegate(ModelAPI_AttributeTables::ValueType theType) - : QStyledItemDelegate(), myType(theType) -{ -} +const char *MYFirstCol = "Shape"; +const char *MYTrue = "True"; +const char *MYFalse = "False"; +DataTableItemDelegate::DataTableItemDelegate( + ModelAPI_AttributeTables::ValueType theType) + : QStyledItemDelegate(), myType(theType) {} -QWidget* DataTableItemDelegate::createEditor(QWidget* theParent, - const QStyleOptionViewItem & theOption, - const QModelIndex& theIndex ) const -{ - QWidget* aEditor = 0; +QWidget * +DataTableItemDelegate::createEditor(QWidget *theParent, + const QStyleOptionViewItem &theOption, + const QModelIndex &theIndex) const { + QWidget *aEditor = 0; if ((theIndex.column() == 0) && (theIndex.row() > 0)) { - QWidget* aWgt = QStyledItemDelegate::createEditor(theParent, theOption, theIndex); - QLineEdit* aEdt = static_cast(aWgt); + QWidget *aWgt = + QStyledItemDelegate::createEditor(theParent, theOption, theIndex); + QLineEdit *aEdt = static_cast(aWgt); aEdt->setReadOnly(true); aEditor = aEdt; } else { - QLineEdit* aLineEdt = 0; + QLineEdit *aLineEdt = 0; switch (myType) { case ModelAPI_AttributeTables::DOUBLE: - aLineEdt = dynamic_cast(QStyledItemDelegate::createEditor(theParent, - theOption, - theIndex)); + aLineEdt = dynamic_cast( + QStyledItemDelegate::createEditor(theParent, theOption, theIndex)); if (aLineEdt) { aLineEdt->setValidator(new QDoubleValidator(aLineEdt)); aEditor = aLineEdt; } break; case ModelAPI_AttributeTables::INTEGER: - aLineEdt = dynamic_cast(QStyledItemDelegate::createEditor(theParent, - theOption, - theIndex)); + aLineEdt = dynamic_cast( + QStyledItemDelegate::createEditor(theParent, theOption, theIndex)); if (aLineEdt) { aLineEdt->setValidator(new QIntValidator(aLineEdt)); aEditor = aLineEdt; } break; - case ModelAPI_AttributeTables::BOOLEAN: - { - QComboBox* aBox = new QComboBox(theParent); - aBox->addItem(MYFalse); - aBox->addItem(MYTrue); - aEditor = aBox; - } - break; + case ModelAPI_AttributeTables::BOOLEAN: { + QComboBox *aBox = new QComboBox(theParent); + aBox->addItem(MYFalse); + aBox->addItem(MYTrue); + aEditor = aBox; + } break; default: - aEditor = QStyledItemDelegate::createEditor(theParent, theOption, theIndex); + aEditor = + QStyledItemDelegate::createEditor(theParent, theOption, theIndex); } } if (myType == ModelAPI_AttributeTables::BOOLEAN) - connect(aEditor, SIGNAL(currentTextChanged(const QString&)), - SLOT(onEditItem(const QString&))); + connect(aEditor, SIGNAL(currentTextChanged(const QString &)), + SLOT(onEditItem(const QString &))); else - connect(aEditor, SIGNAL(textEdited(const QString&)), - SLOT(onEditItem(const QString&))); + connect(aEditor, SIGNAL(textEdited(const QString &)), + SLOT(onEditItem(const QString &))); return aEditor; } -void DataTableItemDelegate::onEditItem(const QString& theText) -{ - QWidget* aWgt = dynamic_cast(sender()); +void DataTableItemDelegate::onEditItem(const QString &theText) { + QWidget *aWgt = dynamic_cast(sender()); commitData(aWgt); } - - //********************************************************************************** //********************************************************************************** //********************************************************************************** -CollectionPlugin_WidgetField:: - CollectionPlugin_WidgetField(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData): -ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), - myIsTabEdit(false), myActivation(false) -{ - QVBoxLayout* aMainLayout = new QVBoxLayout(this); +CollectionPlugin_WidgetField::CollectionPlugin_WidgetField( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetSelector(theParent, theWorkshop, theData), + myHeaderEditor(0), myIsTabEdit(false), myActivation(false) { + QVBoxLayout *aMainLayout = new QVBoxLayout(this); // Types definition controls - QWidget* aTypesWgt = new QWidget(this); - QFormLayout* aTypesLayout = new QFormLayout(aTypesWgt); + QWidget *aTypesWgt = new QWidget(this); + QFormLayout *aTypesLayout = new QFormLayout(aTypesWgt); aTypesLayout->setContentsMargins(0, 0, 0, 0); aMainLayout->addWidget(aTypesWgt); // Type of shapes myShapeTypeCombo = new QComboBox(aTypesWgt); QStringList aShapeTypes; - aShapeTypes << tr("Vertices") << tr("Edges") << tr("Faces") - << tr("Solids") << tr("Objects") << tr("Parts"); + aShapeTypes << tr("Vertices") << tr("Edges") << tr("Faces") << tr("Solids") + << tr("Objects") << tr("Parts"); myShapeTypeCombo->addItems(aShapeTypes); aTypesLayout->addRow(tr("Type of shapes"), myShapeTypeCombo); // Type of field myFieldTypeCombo = new QComboBox(aTypesWgt); QStringList aFieldTypes; - aFieldTypes << tr("Boolean") << tr("Integer") << tr("Double") - << tr("String"); + aFieldTypes << tr("Boolean") << tr("Integer") << tr("Double") << tr("String"); myFieldTypeCombo->addItems(aFieldTypes); myFieldTypeCombo->setCurrentIndex(2); aTypesLayout->addRow(tr("Type of field"), myFieldTypeCombo); @@ -160,10 +151,10 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), aTypesLayout->addRow(tr("Nb. of components"), myNbComponentsSpn); // Steps controls - QFrame* aStepFrame = new QFrame(this); + QFrame *aStepFrame = new QFrame(this); aStepFrame->setFrameShape(QFrame::Box); aStepFrame->setFrameStyle(QFrame::StyledPanel); - QGridLayout* aStepLayout = new QGridLayout(aStepFrame); + QGridLayout *aStepLayout = new QGridLayout(aStepFrame); aMainLayout->addWidget(aStepFrame); // Current step label @@ -175,9 +166,9 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), aStepLayout->addWidget(myCurStepLbl, 0, 1); // Steps slider - QWidget* aSliderWidget = new QWidget(aStepFrame); + QWidget *aSliderWidget = new QWidget(aStepFrame); aStepLayout->addWidget(aSliderWidget, 1, 0, 1, 2); - QHBoxLayout* aSliderLayout = new QHBoxLayout(aSliderWidget); + QHBoxLayout *aSliderLayout = new QHBoxLayout(aSliderWidget); aSliderLayout->setContentsMargins(0, 0, 0, 0); aSliderLayout->addWidget(new QLabel("1", aSliderWidget)); @@ -196,19 +187,18 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), myStepWgt = new QStackedWidget(aStepFrame); aStepLayout->addWidget(myStepWgt, 2, 0, 1, 2); - myDelegate = - new DataTableItemDelegate((ModelAPI_AttributeTables::ValueType) - myFieldTypeCombo->currentIndex()); + myDelegate = new DataTableItemDelegate( + (ModelAPI_AttributeTables::ValueType)myFieldTypeCombo->currentIndex()); appendStepControls(); // Buttons below - QWidget* aBtnWgt = new QWidget(this); + QWidget *aBtnWgt = new QWidget(this); aMainLayout->addWidget(aBtnWgt); - QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnWgt); + QHBoxLayout *aBtnLayout = new QHBoxLayout(aBtnWgt); aBtnLayout->setContentsMargins(0, 0, 0, 0); - QPushButton* aAddBtn = new QPushButton(tr("Add step"), aBtnWgt); + QPushButton *aAddBtn = new QPushButton(tr("Add step"), aBtnWgt); aBtnLayout->addWidget(aAddBtn); aBtnLayout->addStretch(1); @@ -217,38 +207,43 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), aBtnLayout->addWidget(myRemoveBtn); myRemoveBtn->setEnabled(false); - connect(myNbComponentsSpn, SIGNAL(valueChanged(int)), SLOT(onNbCompChanged(int))); + connect(myNbComponentsSpn, SIGNAL(valueChanged(int)), + SLOT(onNbCompChanged(int))); connect(aAddBtn, SIGNAL(clicked(bool)), SLOT(onAddStep())); connect(myRemoveBtn, SIGNAL(clicked(bool)), SLOT(onRemoveStep())); connect(myStepSlider, SIGNAL(valueChanged(int)), SLOT(onStepMove(int))); - connect(myStepSlider, SIGNAL(rangeChanged(int, int)), SLOT(onRangeChanged(int, int))); - connect(myFieldTypeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onFieldTypeChanged(int))); - connect(myShapeTypeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onShapeTypeChanged(int))); - connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), SLOT(onFocusChanged(QWidget*, QWidget*))); + connect(myStepSlider, SIGNAL(rangeChanged(int, int)), + SLOT(onRangeChanged(int, int))); + connect(myFieldTypeCombo, SIGNAL(currentIndexChanged(int)), + SLOT(onFieldTypeChanged(int))); + connect(myShapeTypeCombo, SIGNAL(currentIndexChanged(int)), + SLOT(onShapeTypeChanged(int))); + connect(qApp, SIGNAL(focusChanged(QWidget *, QWidget *)), + SLOT(onFocusChanged(QWidget *, QWidget *))); } //********************************************************************************** -void CollectionPlugin_WidgetField::appendStepControls() -{ - QWidget* aWidget = new QWidget(myStepWgt); - QGridLayout* aStepLayout = new QGridLayout(aWidget); +void CollectionPlugin_WidgetField::appendStepControls() { + QWidget *aWidget = new QWidget(myStepWgt); + QGridLayout *aStepLayout = new QGridLayout(aWidget); aStepLayout->setContentsMargins(0, 0, 0, 0); aStepLayout->addWidget(new QLabel(tr("Stamp"), aWidget), 0, 0); - QSpinBox* aStampSpn = new QSpinBox(aWidget); + QSpinBox *aStampSpn = new QSpinBox(aWidget); aStepLayout->addWidget(aStampSpn, 0, 1); myStampSpnList.append(aStampSpn); // Data table - QTableWidget* aDataTbl = new QTableWidget(1, myCompNamesList.count() + 1, aWidget); + QTableWidget *aDataTbl = + new QTableWidget(1, myCompNamesList.count() + 1, aWidget); aDataTbl->installEventFilter(this); aDataTbl->setItemDelegate(myDelegate); QIntList aColWidth; if (!myDataTblList.isEmpty()) { - QTableWidget* aFirstTable = myDataTblList.first(); + QTableWidget *aFirstTable = myDataTblList.first(); for (int i = 0; i < aFirstTable->columnCount(); i++) aColWidth.append(aFirstTable->columnWidth(i)); } @@ -263,7 +258,7 @@ void CollectionPlugin_WidgetField::appendStepControls() updateHeaders(aDataTbl); - QTableWidgetItem* aItem = new QTableWidgetItem("Default value"); + QTableWidgetItem *aItem = new QTableWidgetItem("Default value"); aItem->setBackgroundColor(Qt::lightGray); aItem->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled); aDataTbl->setItem(0, 0, aItem); @@ -278,25 +273,25 @@ void CollectionPlugin_WidgetField::appendStepControls() if (aColWidth.length() > 0) { for (int i = 0; i < aDataTbl->columnCount(); i++) { if (i < aColWidth.size()) - aDataTbl->setColumnWidth(i, aColWidth.at(i)); + aDataTbl->setColumnWidth(i, aColWidth.at(i)); } } aStepLayout->addWidget(aDataTbl, 1, 0, 1, 2); - connect(aDataTbl, SIGNAL(cellChanged(int, int)), SLOT(onTableEdited(int, int))); + connect(aDataTbl, SIGNAL(cellChanged(int, int)), + SLOT(onTableEdited(int, int))); myStepWgt->addWidget(aWidget); aDataTbl->horizontalHeader()->viewport()->installEventFilter(this); } //********************************************************************************** -void CollectionPlugin_WidgetField::deactivate() -{ +void CollectionPlugin_WidgetField::deactivate() { ModuleBase_WidgetSelector::deactivate(); storeValueCustom(); } //********************************************************************************** -//void CollectionPlugin_WidgetField::showEvent(QShowEvent* theEvent) +// void CollectionPlugin_WidgetField::showEvent(QShowEvent* theEvent) //{ // myShapeTypeCombo->setEnabled(!isEditingMode()); // myFieldTypeCombo->setEnabled(!isEditingMode()); @@ -304,10 +299,10 @@ void CollectionPlugin_WidgetField::deactivate() //} //********************************************************************************** -bool CollectionPlugin_WidgetField::eventFilter(QObject* theObject, QEvent* theEvent) -{ - QObject* aObject = 0; - foreach(QTableWidget* aTable, myDataTblList) { +bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject, + QEvent *theEvent) { + QObject *aObject = 0; + foreach (QTableWidget *aTable, myDataTblList) { if (aTable->horizontalHeader()->viewport() == theObject) { aObject = theObject; break; @@ -315,13 +310,14 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject* theObject, QEvent* theEv } if (aObject) { if (theEvent->type() == QEvent::MouseButtonDblClick) { - if (myHeaderEditor) { //delete previous editor + if (myHeaderEditor) { // delete previous editor myHeaderEditor->deleteLater(); myHeaderEditor = 0; } - QMouseEvent* aMouseEvent = static_cast(theEvent); - QHeaderView* aHeader = static_cast(aObject->parent()); - QTableWidget* aTable = static_cast(aHeader->parentWidget()); + QMouseEvent *aMouseEvent = static_cast(theEvent); + QHeaderView *aHeader = static_cast(aObject->parent()); + QTableWidget *aTable = + static_cast(aHeader->parentWidget()); int aShift = aTable->horizontalScrollBar()->value(); int aPos = aMouseEvent->x(); @@ -339,35 +335,38 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject* theObject, QEvent* theEv myHeaderEditor->move(aRect.topLeft()); myHeaderEditor->resize(aRect.size()); myHeaderEditor->setFrame(false); - QString aText = aHeader->model()-> - headerData(aIndex, aHeader->orientation()).toString(); + QString aText = aHeader->model() + ->headerData(aIndex, aHeader->orientation()) + .toString(); myHeaderEditor->setText(aText); myHeaderEditor->setFocus(); - myEditIndex = aIndex; //save for future use - myHeaderEditor->installEventFilter(this); //catch focus out event - //if user presses Enter it should close editor - connect(myHeaderEditor, SIGNAL(returnPressed()), aTable, SLOT(setFocus())); + myEditIndex = aIndex; // save for future use + myHeaderEditor->installEventFilter(this); // catch focus out event + // if user presses Enter it should close editor + connect(myHeaderEditor, SIGNAL(returnPressed()), aTable, + SLOT(setFocus())); myHeaderEditor->show(); return true; } } - } else if ((theObject == myHeaderEditor) && (theEvent->type() == QEvent::FocusOut)) { + } else if ((theObject == myHeaderEditor) && + (theEvent->type() == QEvent::FocusOut)) { QString aNewTitle = myHeaderEditor->text(); - //save item text + // save item text myCompNamesList.replace(myEditIndex - 1, aNewTitle); - myHeaderEditor->deleteLater(); //safely delete editor + myHeaderEditor->deleteLater(); // safely delete editor myHeaderEditor = 0; // Store into data model - AttributeStringArrayPtr aStringsAttr = - myFeature->data()->stringArray(CollectionPlugin_Field::COMPONENTS_NAMES_ID()); + AttributeStringArrayPtr aStringsAttr = myFeature->data()->stringArray( + CollectionPlugin_Field::COMPONENTS_NAMES_ID()); aStringsAttr->setValue(myEditIndex - 1, aNewTitle.toStdString()); - foreach(QTableWidget* aTable, myDataTblList) { + foreach (QTableWidget *aTable, myDataTblList) { updateHeaders(aTable); } } else if (theEvent->type() == QEvent::FocusIn) { - QTableWidget* aTable = dynamic_cast(theObject); + QTableWidget *aTable = dynamic_cast(theObject); if (aTable) { - ModuleBase_IPropertyPanel* aPanel = myWorkshop->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = myWorkshop->propertyPanel(); if (aPanel->activeWidget() != this) { myActivation = true; aPanel->activateWidget(this, false); @@ -378,9 +377,8 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject* theObject, QEvent* theEv } //********************************************************************************** -QTableWidgetItem* CollectionPlugin_WidgetField::createDefaultItem() const -{ - QTableWidgetItem* aItem = new QTableWidgetItem(); +QTableWidgetItem *CollectionPlugin_WidgetField::createDefaultItem() const { + QTableWidgetItem *aItem = new QTableWidgetItem(); switch (myFieldTypeCombo->currentIndex()) { case ModelAPI_AttributeTables::DOUBLE: case ModelAPI_AttributeTables::INTEGER: @@ -397,34 +395,32 @@ QTableWidgetItem* CollectionPlugin_WidgetField::createDefaultItem() const } //********************************************************************************** -QTableWidgetItem* CollectionPlugin_WidgetField:: - createValueItem(ModelAPI_AttributeTables::Value& theVal) const -{ - QTableWidgetItem* aItem = new QTableWidgetItem(); +QTableWidgetItem *CollectionPlugin_WidgetField::createValueItem( + ModelAPI_AttributeTables::Value &theVal) const { + QTableWidgetItem *aItem = new QTableWidgetItem(); aItem->setText(getValueText(theVal)); return aItem; } //********************************************************************************** -QString CollectionPlugin_WidgetField::getValueText(ModelAPI_AttributeTables::Value& theVal) const -{ +QString CollectionPlugin_WidgetField::getValueText( + ModelAPI_AttributeTables::Value &theVal) const { switch (myFieldTypeCombo->currentIndex()) { case ModelAPI_AttributeTables::DOUBLE: return QString::number(theVal.myDouble); case ModelAPI_AttributeTables::INTEGER: return QString::number(theVal.myInt); case ModelAPI_AttributeTables::BOOLEAN: - return theVal.myBool? MYTrue : MYFalse; + return theVal.myBool ? MYTrue : MYFalse; case ModelAPI_AttributeTables::STRING: return theVal.myStr.c_str(); } return ""; } - //********************************************************************************** -void CollectionPlugin_WidgetField::updateHeaders(QTableWidget* theDataTbl) const -{ +void CollectionPlugin_WidgetField::updateHeaders( + QTableWidget *theDataTbl) const { QStringList aHeaders; aHeaders << tr(MYFirstCol); aHeaders << myCompNamesList; @@ -432,10 +428,9 @@ void CollectionPlugin_WidgetField::updateHeaders(QTableWidget* theDataTbl) const } //********************************************************************************** -void CollectionPlugin_WidgetField::removeStepControls() -{ +void CollectionPlugin_WidgetField::removeStepControls() { int aCurWgtId = myStepWgt->currentIndex(); - QWidget* aWgt = myStepWgt->currentWidget(); + QWidget *aWgt = myStepWgt->currentWidget(); myStepWgt->removeWidget(aWgt); myStampSpnList.removeAt(aCurWgtId); @@ -444,10 +439,10 @@ void CollectionPlugin_WidgetField::removeStepControls() } //********************************************************************************** -QList CollectionPlugin_WidgetField::getControls() const -{ - QList aControls; - // this control will accept focus and will be highlighted in the Property Panel +QList CollectionPlugin_WidgetField::getControls() const { + QList aControls; + // this control will accept focus and will be highlighted in the Property + // Panel aControls.append(myShapeTypeCombo); aControls.append(myFieldTypeCombo); aControls.append(myNbComponentsSpn); @@ -460,28 +455,29 @@ QList CollectionPlugin_WidgetField::getControls() const } //********************************************************************************** -bool CollectionPlugin_WidgetField::storeValueCustom() -{ +bool CollectionPlugin_WidgetField::storeValueCustom() { DataPtr aData = myFeature->data(); // Store number of components AttributeStringArrayPtr aStringsAttr = - aData->stringArray(CollectionPlugin_Field::COMPONENTS_NAMES_ID()); + aData->stringArray(CollectionPlugin_Field::COMPONENTS_NAMES_ID()); int aNbComps = myCompNamesList.size(); aStringsAttr->setSize(aNbComps); - for ( int i = 0; i < aNbComps; i++) + for (int i = 0; i < aNbComps; i++) aStringsAttr->setValue(i, myCompNamesList.at(i).toStdString()); - AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + aData->tables(CollectionPlugin_Field::VALUES_ID()); // Store number of steps - int aNbSteps = myDataTblList.size(); + int aNbSteps = myDataTblList.size(); // Store Type of the field values int aFldType = myFieldTypeCombo->currentIndex(); - AttributeIntArrayPtr aStampsAttr = aData->intArray(CollectionPlugin_Field::STAMPS_ID()); + AttributeIntArrayPtr aStampsAttr = + aData->intArray(CollectionPlugin_Field::STAMPS_ID()); aStampsAttr->setSize(aNbSteps); // Store data - QTableWidget* aTable = myDataTblList.first(); + QTableWidget *aTable = myDataTblList.first(); int aRows = aTable->rowCount(); // first column contains selected names which should not be stored int aColumns = aTable->columnCount() - 1; @@ -502,12 +498,12 @@ bool CollectionPlugin_WidgetField::storeValueCustom() } //********************************************************************************** -bool CollectionPlugin_WidgetField::restoreValueCustom() -{ +bool CollectionPlugin_WidgetField::restoreValueCustom() { bool isBlocked; DataPtr aData = myFeature->data(); - AttributeSelectionListPtr aSelList = aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); + AttributeSelectionListPtr aSelList = + aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); std::string aTypeStr = aSelList->selectionType(); if (aTypeStr == "") return false; // The attribute is not initialized @@ -517,7 +513,7 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() // Get number of components AttributeStringArrayPtr aStringsAttr = - aData->stringArray(CollectionPlugin_Field::COMPONENTS_NAMES_ID()); + aData->stringArray(CollectionPlugin_Field::COMPONENTS_NAMES_ID()); myCompNamesList.clear(); for (int i = 0; i < aStringsAttr->size(); i++) { @@ -527,14 +523,15 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() myNbComponentsSpn->setValue(myCompNamesList.size()); myNbComponentsSpn->blockSignals(isBlocked); - AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + aData->tables(CollectionPlugin_Field::VALUES_ID()); // Get number of steps int aNbSteps = aTablesAttr->tables(); myStepSlider->setMaximum(aNbSteps); - //myStepSlider->setValue(1); - // Clear old tables + // myStepSlider->setValue(1); + // Clear old tables while (myDataTblList.count() > aNbSteps) { - QWidget* aWgt = myStepWgt->widget(myStepWgt->count() - 1); + QWidget *aWgt = myStepWgt->widget(myStepWgt->count() - 1); myStepWgt->removeWidget(aWgt); aWgt->deleteLater(); @@ -543,7 +540,7 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() } while (myDataTblList.count() < aNbSteps) appendStepControls(); - //myStepWgt->setCurrentIndex(myStepSlider->value() - 1); + // myStepWgt->setCurrentIndex(myStepSlider->value() - 1); clearData(); // Get Type of the field values @@ -552,21 +549,22 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() myFieldTypeCombo->blockSignals(isBlocked); myDelegate->setDataType(aTablesAttr->type()); - AttributeIntArrayPtr aStampsAttr = aData->intArray(CollectionPlugin_Field::STAMPS_ID()); + AttributeIntArrayPtr aStampsAttr = + aData->intArray(CollectionPlugin_Field::STAMPS_ID()); // Fill data table int aRows = aTablesAttr->rows(); int aCols = aTablesAttr->columns(); // Get width of columns QIntList aColWidth; - QTableWidget* aFirstTable = myDataTblList.first(); + QTableWidget *aFirstTable = myDataTblList.first(); for (int i = 0; i < aFirstTable->columnCount(); i++) aColWidth.append(aFirstTable->columnWidth(i)); - QTableWidgetItem* aItem = 0; + QTableWidgetItem *aItem = 0; for (int i = 0; i < aNbSteps; i++) { myStampSpnList.at(i)->setValue(aStampsAttr->value(i)); - QTableWidget* aTable = myDataTblList.at(i); + QTableWidget *aTable = myDataTblList.at(i); isBlocked = aTable->blockSignals(true); aTable->setRowCount(aRows); aTable->setColumnCount(aCols + 1); @@ -580,12 +578,14 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() if (aItem) { aItem->setText(QString::fromStdWString(aAttr->namingName())); } else { - aItem = new QTableWidgetItem(QString::fromStdWString(aAttr->namingName())); + aItem = new QTableWidgetItem( + QString::fromStdWString(aAttr->namingName())); aTable->setItem(k, j, aItem); } } else if (j > 0) { // Add Values - ModelAPI_AttributeTables::Value aVal = aTablesAttr->value(k, j - 1, i); + ModelAPI_AttributeTables::Value aVal = + aTablesAttr->value(k, j - 1, i); if (aItem) { aItem->setText(getValueText(aVal)); } else { @@ -609,8 +609,8 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() } //********************************************************************************** -int CollectionPlugin_WidgetField::getSelectionType(const std::string& theStr) const -{ +int CollectionPlugin_WidgetField::getSelectionType( + const std::string &theStr) const { QString aType(theStr.c_str()); aType = aType.toLower(); if (aType == "vertex") @@ -628,10 +628,8 @@ int CollectionPlugin_WidgetField::getSelectionType(const std::string& theStr) co return -1; } - //********************************************************************************** -std::string CollectionPlugin_WidgetField::getSelectionType(int theType) const -{ +std::string CollectionPlugin_WidgetField::getSelectionType(int theType) const { switch (theType) { case 0: //"Vertices" return "vertex"; @@ -650,8 +648,7 @@ std::string CollectionPlugin_WidgetField::getSelectionType(int theType) const } //********************************************************************************** -QIntList CollectionPlugin_WidgetField::shapeTypes() const -{ +QIntList CollectionPlugin_WidgetField::shapeTypes() const { QIntList aRes; switch (myShapeTypeCombo->currentIndex()) { case 0: //"Vertices" @@ -677,12 +674,12 @@ QIntList CollectionPlugin_WidgetField::shapeTypes() const } //********************************************************************************** -ModelAPI_AttributeTables::Value CollectionPlugin_WidgetField::getValue(QString theStrVal) const -{ +ModelAPI_AttributeTables::Value +CollectionPlugin_WidgetField::getValue(QString theStrVal) const { ModelAPI_AttributeTables::Value aVal; switch (myFieldTypeCombo->currentIndex()) { case ModelAPI_AttributeTables::BOOLEAN: - aVal.myBool = (theStrVal == MYTrue)? true : false; + aVal.myBool = (theStrVal == MYTrue) ? true : false; break; case ModelAPI_AttributeTables::DOUBLE: aVal.myDouble = theStrVal.toDouble(); @@ -696,26 +693,26 @@ ModelAPI_AttributeTables::Value CollectionPlugin_WidgetField::getValue(QString t return aVal; } - //********************************************************************************** -void CollectionPlugin_WidgetField::onNbCompChanged(int theVal) -{ +void CollectionPlugin_WidgetField::onNbCompChanged(int theVal) { int aOldCol = myCompNamesList.count(); int aNbRows = myDataTblList.first()->rowCount(); int aDif = theVal - aOldCol; - QTableWidgetItem* aItem = 0; + QTableWidgetItem *aItem = 0; while (myCompNamesList.count() != theVal) { if (aDif > 0) - myCompNamesList.append(QString("Comp %1").arg(myCompNamesList.count() + 1)); + myCompNamesList.append( + QString("Comp %1").arg(myCompNamesList.count() + 1)); else myCompNamesList.removeLast(); } - AttributeTablesPtr aTablesAttr = myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); aTablesAttr->setSize(aNbRows, myCompNamesList.size(), myDataTblList.size()); - foreach(QTableWidget* aDataTbl, myDataTblList) { + foreach (QTableWidget *aDataTbl, myDataTblList) { aDataTbl->setColumnCount(theVal + 1); updateHeaders(aDataTbl); for (int i = aOldCol; i < myCompNamesList.count(); i++) { @@ -734,8 +731,7 @@ void CollectionPlugin_WidgetField::onNbCompChanged(int theVal) } //********************************************************************************** -void CollectionPlugin_WidgetField::onAddStep() -{ +void CollectionPlugin_WidgetField::onAddStep() { int aMax = myStepSlider->maximum(); aMax++; myStepSlider->setMaximum(aMax); @@ -743,12 +739,13 @@ void CollectionPlugin_WidgetField::onAddStep() appendStepControls(); myStepSlider->setValue(aMax); - AttributeTablesPtr aTablesAttr = myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); - aTablesAttr->setSize(aTablesAttr->rows(), aTablesAttr->columns(), myDataTblList.size()); - + AttributeTablesPtr aTablesAttr = + myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); + aTablesAttr->setSize(aTablesAttr->rows(), aTablesAttr->columns(), + myDataTblList.size()); AttributeSelectionListPtr aSelList = - myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); + myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); if (!aSelList->isInitialized()) return; int aSelNb = aSelList->size(); @@ -757,12 +754,12 @@ void CollectionPlugin_WidgetField::onAddStep() int aColumns = myNbComponentsSpn->value() + 1; int aRows = aSelNb + 1; - QTableWidget* aTable = myDataTblList.last(); + QTableWidget *aTable = myDataTblList.last(); aTable->setRowCount(aRows); - QTableWidgetItem* aItem = 0; - for(int i = 0; i < aColumns; i++) { + QTableWidgetItem *aItem = 0; + for (int i = 0; i < aColumns; i++) { if (i == 0) { - for(int j = 1; j < aRows; j++) { + for (int j = 1; j < aRows; j++) { aItem = aTable->item(j, i); if (!aItem) { aItem = new QTableWidgetItem(); @@ -774,7 +771,7 @@ void CollectionPlugin_WidgetField::onAddStep() } } else { QString aDefVal = aTable->item(0, i)->text(); - for(int j = 1; j < aRows; j++) { + for (int j = 1; j < aRows; j++) { aItem = aTable->item(j, i); if (!aItem) { aItem = new QTableWidgetItem(); @@ -788,45 +785,43 @@ void CollectionPlugin_WidgetField::onAddStep() } //********************************************************************************** -void CollectionPlugin_WidgetField::onRemoveStep() -{ +void CollectionPlugin_WidgetField::onRemoveStep() { int aMax = myStepSlider->maximum(); aMax--; myMaxLbl->setText(QString::number(aMax)); removeStepControls(); myStepSlider->setMaximum(aMax); - //AttributeTablesPtr aTablesAttr = myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); - //aTablesAttr->setSize(aTablesAttr->rows(), aTablesAttr->columns(), myDataTblList.size()); + // AttributeTablesPtr aTablesAttr = + // myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); + // aTablesAttr->setSize(aTablesAttr->rows(), aTablesAttr->columns(), + // myDataTblList.size()); emit valuesChanged(); } //********************************************************************************** -void CollectionPlugin_WidgetField::clearData() -{ - foreach(QTableWidget* aDataTbl, myDataTblList) { +void CollectionPlugin_WidgetField::clearData() { + foreach (QTableWidget *aDataTbl, myDataTblList) { aDataTbl->setRowCount(1); } } //********************************************************************************** -void CollectionPlugin_WidgetField::onStepMove(int theStep) -{ +void CollectionPlugin_WidgetField::onStepMove(int theStep) { myCurStepLbl->setText(QString::number(theStep)); myStepWgt->setCurrentIndex(theStep - 1); } //********************************************************************************** -bool CollectionPlugin_WidgetField:: - isValidSelectionCustom(const std::shared_ptr& thePrs) -{ - return (myShapeTypeCombo->currentIndex() == 5)? false : true; +bool CollectionPlugin_WidgetField::isValidSelectionCustom( + const std::shared_ptr &thePrs) { + return (myShapeTypeCombo->currentIndex() == 5) ? false : true; } //********************************************************************************** -bool CollectionPlugin_WidgetField:: - setSelection(QList>& theValues, const bool theToValidate) -{ +bool CollectionPlugin_WidgetField::setSelection( + QList> &theValues, + const bool theToValidate) { if (myActivation) { myActivation = false; return false; @@ -839,7 +834,8 @@ bool CollectionPlugin_WidgetField:: QList::const_iterator anIt; for (anIt = theValues.begin(); anIt != theValues.end(); anIt++) { ModuleBase_ViewerPrsPtr aValue = *anIt; - ResultPtr aRes = std::dynamic_pointer_cast(aValue->object()); + ResultPtr aRes = + std::dynamic_pointer_cast(aValue->object()); if (theToValidate && aRes.get()) { if (myShapeTypeCombo->currentIndex() > 3) aSelected.append(aValue); @@ -848,14 +844,15 @@ bool CollectionPlugin_WidgetField:: } } AttributeSelectionListPtr aSelList = - myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); - aSelList->setSelectionType(getSelectionType(myShapeTypeCombo->currentIndex())); + myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); + aSelList->setSelectionType( + getSelectionType(myShapeTypeCombo->currentIndex())); aSelList->clear(); ResultPtr aResult; GeomShapePtr aShape; int aNbData = 0; - foreach(ModuleBase_ViewerPrsPtr aPrs, aSelected) { + foreach (ModuleBase_ViewerPrsPtr aPrs, aSelected) { aResult = std::dynamic_pointer_cast(aPrs->object()); aShape = aPrs->shape(); if (!aResult.get() && !aShape.get()) @@ -868,17 +865,18 @@ bool CollectionPlugin_WidgetField:: int aColumns = myDataTblList.first()->columnCount(); int aRows = myDataTblList.first()->rowCount(); int aNewRows = aNbData + 1; - AttributeTablesPtr aTablesAttr = myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); aTablesAttr->setSize(aNewRows, aColumns - 1, myDataTblList.size()); - QTableWidgetItem* aItem = 0; - foreach(QTableWidget* aTable, myDataTblList) { + QTableWidgetItem *aItem = 0; + foreach (QTableWidget *aTable, myDataTblList) { aTable->setRowCount(aNewRows); if (aNewRows > aRows) { // Add new data - for(int i = 0; i < aColumns; i++) { + for (int i = 0; i < aColumns; i++) { if (i == 0) { - for(int j = 1; j < aNewRows; j++) { + for (int j = 1; j < aNewRows; j++) { aItem = aTable->item(j, i); if (!aItem) { aItem = new QTableWidgetItem(); @@ -890,7 +888,7 @@ bool CollectionPlugin_WidgetField:: } } else { QString aDefVal = aTable->item(0, i)->text(); - for(int j = aRows; j < aNewRows; j++) { + for (int j = aRows; j < aNewRows; j++) { aItem = aTable->item(j, i); if (!aItem) { aItem = new QTableWidgetItem(); @@ -902,10 +900,12 @@ bool CollectionPlugin_WidgetField:: } } else { // Update only selection name - for(int j = 1; j < aNewRows - 1; j++) { + for (int j = 1; j < aNewRows - 1; j++) { AttributeSelectionPtr aAttr = aSelList->value(j); - aTable->item(j, 0)->setText(QString::fromStdWString(aAttr->namingName())); - aTable->item(j, 0)->setToolTip(QString::fromStdWString(aAttr->namingName())); + aTable->item(j, 0)->setText( + QString::fromStdWString(aAttr->namingName())); + aTable->item(j, 0)->setToolTip( + QString::fromStdWString(aAttr->namingName())); } } } @@ -913,16 +913,15 @@ bool CollectionPlugin_WidgetField:: } //********************************************************************************** -void CollectionPlugin_WidgetField::onFieldTypeChanged(int theIdx) -{ +void CollectionPlugin_WidgetField::onFieldTypeChanged(int theIdx) { ModelAPI_AttributeTables::ValueType aOldType = myDelegate->dataType(); if (aOldType != theIdx) { myDelegate->setDataType((ModelAPI_AttributeTables::ValueType)theIdx); int aColumns = myDataTblList.first()->columnCount(); int aRows = myDataTblList.first()->rowCount(); - foreach(QTableWidget* aTable, myDataTblList) { - for(int i = 1; i < aColumns; i++) { - for(int j = 0; j < aRows; j++) { + foreach (QTableWidget *aTable, myDataTblList) { + for (int i = 1; i < aColumns; i++) { + for (int j = 0; j < aRows; j++) { switch (theIdx) { case ModelAPI_AttributeTables::DOUBLE: case ModelAPI_AttributeTables::INTEGER: @@ -943,33 +942,33 @@ void CollectionPlugin_WidgetField::onFieldTypeChanged(int theIdx) } //********************************************************************************** -void CollectionPlugin_WidgetField::onTableEdited(int theRow, int theCol) -{ +void CollectionPlugin_WidgetField::onTableEdited(int theRow, int theCol) { // Do not store here column of names if (theCol == 0) return; if (!myFeature.get()) return; - QTableWidget* aTable = static_cast(sender()); + QTableWidget *aTable = static_cast(sender()); int aNb = myDataTblList.indexOf(aTable); if (aNb == -1) return; - ModelAPI_AttributeTables::Value aVal = getValue(aTable->item(theRow, theCol)->text()); + ModelAPI_AttributeTables::Value aVal = + getValue(aTable->item(theRow, theCol)->text()); - AttributeTablesPtr aTablesAttr = myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); if (aTablesAttr->isInitialized()) - aTablesAttr->setValue(aVal,theRow, theCol - 1, aNb); + aTablesAttr->setValue(aVal, theRow, theCol - 1, aNb); else emit valuesChanged(); } //********************************************************************************** -void CollectionPlugin_WidgetField::onShapeTypeChanged(int theType) -{ - updateSelectionModesAndFilters(theType == 5? false:true); +void CollectionPlugin_WidgetField::onShapeTypeChanged(int theType) { + updateSelectionModesAndFilters(theType == 5 ? false : true); AttributeSelectionListPtr aSelList = - myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); + myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); std::string aTypeName = getSelectionType(theType); if (aTypeName == aSelList->selectionType()) @@ -979,26 +978,25 @@ void CollectionPlugin_WidgetField::onShapeTypeChanged(int theType) // was changed from Part to any other in order to updater Apply button status myFeature->data()->sendAttributeUpdated(aSelList.get()); - //Clear old selection + // Clear old selection clearData(); aSelList->clear(); - AttributeTablesPtr aTablesAttr = myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); aTablesAttr->setSize(1, myNbComponentsSpn->value(), myDataTblList.size()); updateObject(myFeature); emit valuesChanged(); } //********************************************************************************** -bool CollectionPlugin_WidgetField::processEnter() -{ +bool CollectionPlugin_WidgetField::processEnter() { if (myIsTabEdit) { myIsTabEdit = false; return true; } - QWidget* aCurrWgt = qApp->focusWidget(); + QWidget *aCurrWgt = qApp->focusWidget(); int aCurWgtId = myStepWgt->currentIndex(); - if ((aCurrWgt == myShapeTypeCombo) || - (aCurrWgt == myFieldTypeCombo) || + if ((aCurrWgt == myShapeTypeCombo) || (aCurrWgt == myFieldTypeCombo) || (aCurrWgt == myNbComponentsSpn) || (aCurrWgt == myStampSpnList[aCurWgtId]) || (aCurrWgt == myDataTblList[aCurWgtId])) { @@ -1009,26 +1007,25 @@ bool CollectionPlugin_WidgetField::processEnter() } //********************************************************************************** -void CollectionPlugin_WidgetField::onFocusChanged(QWidget* theOld, QWidget* theNew) -{ +void CollectionPlugin_WidgetField::onFocusChanged(QWidget *theOld, + QWidget *theNew) { if (theNew && (!myIsTabEdit)) - myIsTabEdit = dynamic_cast(theNew); + myIsTabEdit = dynamic_cast(theNew); } //********************************************************************************** -void CollectionPlugin_WidgetField::onRangeChanged(int theMin, int theMax) -{ +void CollectionPlugin_WidgetField::onRangeChanged(int theMin, int theMax) { myMaxLbl->setText(QString::number(theMax)); myRemoveBtn->setEnabled(theMax > 1); } //********************************************************************************** -void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int theOld, int theNew) -{ +void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int theOld, + int theNew) { if (myDataTblList.count() < 2) return; - QObject* aSender = sender(); - foreach(QTableWidget* aTable, myDataTblList) { + QObject *aSender = sender(); + foreach (QTableWidget *aTable, myDataTblList) { if (aTable->horizontalHeader() != aSender) aTable->setColumnWidth(theIndex, theNew); } @@ -1036,21 +1033,20 @@ void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int theOld, int //********************************************************************************** QList> - CollectionPlugin_WidgetField::getAttributeSelection() const -{ +CollectionPlugin_WidgetField::getAttributeSelection() const { QList> aList; - if(myFeature) { + if (myFeature) { DataPtr aData = myFeature->data(); AttributeSelectionListPtr aSelList = - aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); + aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); AttributeSelectionPtr aAttr; ObjectPtr anObject; for (int i = 0; i < aSelList->size(); i++) { aAttr = aSelList->value(i); - ModuleBase_ViewerPrsPtr - aPrs(new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), NULL)); + ModuleBase_ViewerPrsPtr aPrs( + new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), NULL)); aList.append(aPrs); } } return aList; -} \ No newline at end of file +} diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.h b/src/CollectionPlugin/CollectionPlugin_WidgetField.h index cb1e975f3..eddb85aa9 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.h +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.h @@ -14,24 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CollectionPlugin_WidgetField_H #define CollectionPlugin_WidgetField_H - #include "CollectionPlugin.h" -#include -#include #include +#include +#include #include #include #include - class QWidget; class QComboBox; class QSpinBox; @@ -43,52 +42,51 @@ class QPushButton; class QTableWidgetItem; class QLineEdit; - -class DataTableItemDelegate : public QStyledItemDelegate -{ - Q_OBJECT +class DataTableItemDelegate : public QStyledItemDelegate { + Q_OBJECT public: DataTableItemDelegate(ModelAPI_AttributeTables::ValueType theType); - virtual QWidget* createEditor(QWidget* theParent, - const QStyleOptionViewItem & theOption, - const QModelIndex& theIndex) const; + virtual QWidget *createEditor(QWidget *theParent, + const QStyleOptionViewItem &theOption, + const QModelIndex &theIndex) const; ModelAPI_AttributeTables::ValueType dataType() const { return myType; } - void setDataType(ModelAPI_AttributeTables::ValueType theType) { myType = theType; } + void setDataType(ModelAPI_AttributeTables::ValueType theType) { + myType = theType; + } private slots: - void onEditItem(const QString& theText); + void onEditItem(const QString &theText); private: ModelAPI_AttributeTables::ValueType myType; }; - - /*! * \ingroup GUI - * Represent a content of the property panel to show/modify parameters of a Field feature. + * Represent a content of the property panel to show/modify parameters of a + * Field feature. */ -class CollectionPlugin_WidgetField : public ModuleBase_WidgetSelector -{ - Q_OBJECT +class CollectionPlugin_WidgetField : public ModuleBase_WidgetSelector { + Q_OBJECT public: - CollectionPlugin_WidgetField(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + CollectionPlugin_WidgetField(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~CollectionPlugin_WidgetField() {} /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& theValue); + virtual bool + isValidSelectionCustom(const std::shared_ptr &theValue); /// Returns true if the event is processed. virtual bool processEnter(); @@ -100,8 +98,9 @@ public: /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values /// \param theToValidate a validation of the values flag - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); protected: /// Saves the internal parameters to the given feature @@ -118,14 +117,15 @@ protected: /// Redefinition of virtual function /// \param theObject an object for the event /// \param theEvent an event - virtual bool eventFilter(QObject* theObject, QEvent* theEvent); + virtual bool eventFilter(QObject *theObject, QEvent *theEvent); - //virtual void showEvent(QShowEvent* theEvent); + // virtual void showEvent(QShowEvent* theEvent); /// Return the attribute values wrapped in a list of viewer presentations - /// \return a list of viewer presentations, which contains an attribute result and - /// a shape. If the attribute do not uses the shape, it is empty - virtual QList> getAttributeSelection() const; + /// \return a list of viewer presentations, which contains an attribute result + /// and a shape. If the attribute do not uses the shape, it is empty + virtual QList> + getAttributeSelection() const; private slots: /// Slot called on number of component changed @@ -158,7 +158,7 @@ private slots: /// Slot called on widget focus changed /// \param theOld a widget wgich lost focus /// \param theNew a widget which get focus - void onFocusChanged(QWidget* theOld, QWidget* theNew); + void onFocusChanged(QWidget *theOld, QWidget *theNew); /// Slot called on a slider navigation changed /// \param theMin - a minimal value @@ -179,64 +179,65 @@ private: /// Update header of a table /// \param theDataTbl a table widget - void updateHeaders(QTableWidget* theDataTbl) const; + void updateHeaders(QTableWidget *theDataTbl) const; /// Return Item Id of myShapeTypeCombo by selection mode /// \param theStr a selection mode - int getSelectionType(const std::string& theStr) const; + int getSelectionType(const std::string &theStr) const; /// Return selection mode by Item Id of myShapeTypeCombo /// \param theType an item id std::string getSelectionType(int theType) const; /// Create default table item - QTableWidgetItem* createDefaultItem() const; + QTableWidgetItem *createDefaultItem() const; /// Create a table item from the given value /// \param theVal a value for the item - QTableWidgetItem* createValueItem(ModelAPI_AttributeTables::Value& theVal) const; + QTableWidgetItem * + createValueItem(ModelAPI_AttributeTables::Value &theVal) const; - QString getValueText(ModelAPI_AttributeTables::Value& theVal) const; + QString getValueText(ModelAPI_AttributeTables::Value &theVal) const; /// Return a value from the string /// \param theStrVal a string ModelAPI_AttributeTables::Value getValue(QString theStrVal) const; /// Types of shapes selection - QComboBox* myShapeTypeCombo; + QComboBox *myShapeTypeCombo; /// Types of field data - QComboBox* myFieldTypeCombo; + QComboBox *myFieldTypeCombo; /// Number of components - QSpinBox* myNbComponentsSpn; + QSpinBox *myNbComponentsSpn; /// Label of current step - QLabel* myCurStepLbl; + QLabel *myCurStepLbl; /// Slider for steps management - QSlider* myStepSlider; + QSlider *myStepSlider; /// Stamp value - QList myStampSpnList; + QList myStampSpnList; /// List of created tables - QList myDataTblList; + QList myDataTblList; /// Max value Label for the slider - QLabel* myMaxLbl; + QLabel *myMaxLbl; /// A container for step controls - QStackedWidget* myStepWgt; + QStackedWidget *myStepWgt; /// A list for component names QStringList myCompNamesList; /// Remove button - QPushButton* myRemoveBtn; + QPushButton *myRemoveBtn; /// Editor for table header - QLineEdit* myHeaderEditor; + QLineEdit *myHeaderEditor; /// Index of header section under editing int myEditIndex; @@ -246,7 +247,7 @@ private: bool myActivation; - DataTableItemDelegate* myDelegate; + DataTableItemDelegate *myDelegate; }; -#endif \ No newline at end of file +#endif diff --git a/src/CollectionPlugin/doc/fieldFeature.rst b/src/CollectionPlugin/doc/fieldFeature.rst index de8516f84..49983063c 100644 --- a/src/CollectionPlugin/doc/fieldFeature.rst +++ b/src/CollectionPlugin/doc/fieldFeature.rst @@ -14,7 +14,7 @@ To create a Field in the active part: #. select in the Main Menu *Features - > Field* item or #. click |field.icon| **Field** button in the toolbar: -The following property panel appears. +The following property panel appears. .. figure:: images/field_property_panel.png :align: center @@ -24,7 +24,7 @@ The following property panel appears. Input fields: - **Type of shapes** selects geometrical entities to which field values will be assigned from drop-down list: - + - Vertices; - Edges; - Faces; @@ -33,22 +33,22 @@ Input fields: - Parts; - **Type of field** selects type of field values from drop-down list: - + - Boolean; - Integer; - Double; - String; - + - **Nb. Components** defines number of named values (components) assigned to each geometrical entity; - **Stamp** sets time stamp for the current time step; -- **Current step** slider navigates through added steps; +- **Current step** slider navigates through added steps; - table of values for each step contains: - rows whose number depends on the number of entities selected in OCC 3D viewer; - - **Default value** row contains values assigned to non-selected entities of the parent shape with given type; + - **Default value** row contains values assigned to non-selected entities of the parent shape with given type; - columns whose number depends on **Nb. Components**; - - to rename a component double-click a column header; - + - to rename a component double-click a column header; + - **Add Step** button adds a new time step; - **Remove Step** button deletes the current time step. @@ -60,7 +60,7 @@ When a field is created then its result in data tree looks like following. :align: center Result of created field with two steps. - + It consists of a Field result object and steps as sub-objects. Only one object can be displayed at one moment: field or one of its step. Field result presentation repersents entities used for the Field definition. Step presentation shows field entities and values defined on them. For example a step defined on faces with double values looks like following. @@ -68,7 +68,7 @@ Step presentation shows field entities and values defined on them. For example a :align: center Color bar for displayed step is shown only if the setep is selected in **Object Browser**. Desirable parameters of the Color bar (position, number of intervals, text color) can be defined in **Preferences** dialog box. - + **TUI Commands**: .. py:function:: model.addField(Part_1_doc, 2, "DOUBLE", 2, ["DX", "DY"], [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) diff --git a/src/CollectionPlugin/doc/groupAdditionFeature.rst b/src/CollectionPlugin/doc/groupAdditionFeature.rst index e62bd3614..2c4c969bd 100644 --- a/src/CollectionPlugin/doc/groupAdditionFeature.rst +++ b/src/CollectionPlugin/doc/groupAdditionFeature.rst @@ -9,7 +9,7 @@ To create a Group Addition in the active part: #. select in the Main Menu *Features - > Group Addition* item or #. click |group_addition.icon| **Group Addition** button in the toolbar: -The following property panel appears. +The following property panel appears. .. figure:: images/group_addition_property_panel.png :align: center diff --git a/src/CollectionPlugin/doc/groupFeature.rst b/src/CollectionPlugin/doc/groupFeature.rst index 0b150e912..391328a49 100644 --- a/src/CollectionPlugin/doc/groupFeature.rst +++ b/src/CollectionPlugin/doc/groupFeature.rst @@ -11,7 +11,7 @@ To create a Group in the active part: #. select in the Main Menu *Features - > Group* item or #. click |shape_group.icon| **Group** button in the toolbar: -The following property panel appears. +The following property panel appears. .. figure:: images/group_property_panel.png :align: center @@ -27,7 +27,7 @@ Input fields: - **Name** defines the name of the group, by default, it is **Group_n**. - **Type** buttons select geometrical entities to be included in group: - + |group_vertices| Vertices; |group_edges| Edges; @@ -35,7 +35,7 @@ Input fields: |group_faces| Faces; |group_solids| Solids; - + - The list of selected entities of the given type. Multiple selection can be done manually in OCC 3D Viewer by mouse click with Shift button pressed or by rectangle selection. To delete entities from the list, select them and call pop-up menu *Delete* item. - **Selection by filters** button opens "selection by filters" property panel and allows to select entities by set of selected filters. For details on filters see :ref:`filtersPlugin` diff --git a/src/CollectionPlugin/doc/groupIntersectionFeature.rst b/src/CollectionPlugin/doc/groupIntersectionFeature.rst index 08ec1f41f..4eb87f2d8 100644 --- a/src/CollectionPlugin/doc/groupIntersectionFeature.rst +++ b/src/CollectionPlugin/doc/groupIntersectionFeature.rst @@ -9,7 +9,7 @@ To create a Group Intersection in the active part: #. select in the Main Menu *Features - > Group Intersection* item or #. click |group_intersection.icon| **Group Intersection** button in the toolbar: -The following property panel appears. +The following property panel appears. .. figure:: images/group_intersection_property_panel.png :align: center diff --git a/src/CollectionPlugin/doc/groupShapeFeature.rst b/src/CollectionPlugin/doc/groupShapeFeature.rst index 33a84a3a4..8530496a5 100644 --- a/src/CollectionPlugin/doc/groupShapeFeature.rst +++ b/src/CollectionPlugin/doc/groupShapeFeature.rst @@ -9,7 +9,7 @@ To create a Group Shape in the active part: #. select in the Main Menu *Features - > Group Shape* item or #. click |group_shape.icon| **Group Shape** button in the toolbar: -The following property panel appears. +The following property panel appears. .. figure:: images/group_shape_property_panel.png :align: center diff --git a/src/CollectionPlugin/doc/groupSubstractionFeature.rst b/src/CollectionPlugin/doc/groupSubstractionFeature.rst index 2dd1123b3..d5454a519 100644 --- a/src/CollectionPlugin/doc/groupSubstractionFeature.rst +++ b/src/CollectionPlugin/doc/groupSubstractionFeature.rst @@ -9,7 +9,7 @@ To create a Group Substraction in the active part: #. select in the Main Menu *Features - > Group Substraction* item or #. click |group_substraction.icon| **Group Substraction** button in the toolbar: -The following property panel appears. +The following property panel appears. .. figure:: images/group_substraction_property_panel.png :align: center diff --git a/src/CollectionPlugin/group_widget.xml b/src/CollectionPlugin/group_widget.xml index b73c0bf4c..3c920aba4 100644 --- a/src/CollectionPlugin/group_widget.xml +++ b/src/CollectionPlugin/group_widget.xml @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/CollectionPlugin/tests.set b/src/CollectionPlugin/tests.set index c3bfe8cb1..cf66a5e75 100755 --- a/src/CollectionPlugin/tests.set +++ b/src/CollectionPlugin/tests.set @@ -70,4 +70,4 @@ SET(TEST_NAMES Test3114.py Test18739.py TestCreateShapesFromGroups.py -) \ No newline at end of file +) diff --git a/src/Config/CMakeLists.txt b/src/Config/CMakeLists.txt index 9d7c041c1..38e745ccc 100644 --- a/src/Config/CMakeLists.txt +++ b/src/Config/CMakeLists.txt @@ -158,16 +158,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/Config") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/Config/Config_AttributeMessage.cpp b/src/Config/Config_AttributeMessage.cpp index 155ae1a16..b163e079c 100644 --- a/src/Config/Config_AttributeMessage.cpp +++ b/src/Config/Config_AttributeMessage.cpp @@ -14,93 +14,75 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_AttributeMessage.h" -Config_AttributeMessage::Config_AttributeMessage(const Events_ID theId, const void* theParent) - : Events_Message(theId, theParent) -{ +Config_AttributeMessage::Config_AttributeMessage(const Events_ID theId, + const void *theParent) + : Events_Message(theId, theParent) { myAttributeId = std::string(); // Attribute unique id - myFeatureId = std::string(); // Feature unique id + myFeatureId = std::string(); // Feature unique id myIsObligatory = true; myIsConcealment = false; myIsGeometricalSelection = false; } -Config_AttributeMessage::~Config_AttributeMessage() -{ +Config_AttributeMessage::~Config_AttributeMessage() {} -} - -const std::string& Config_AttributeMessage::featureId() const -{ +const std::string &Config_AttributeMessage::featureId() const { return myFeatureId; } -void Config_AttributeMessage::setFeatureId(const std::string& theId) -{ +void Config_AttributeMessage::setFeatureId(const std::string &theId) { myFeatureId = theId; } -const std::string& Config_AttributeMessage::attributeId() const -{ +const std::string &Config_AttributeMessage::attributeId() const { return myAttributeId; } -void Config_AttributeMessage::setAttributeId(const std::string& theId) -{ +void Config_AttributeMessage::setAttributeId(const std::string &theId) { myAttributeId = theId; } -bool Config_AttributeMessage::isConcealment() const -{ - return myIsConcealment; -} +bool Config_AttributeMessage::isConcealment() const { return myIsConcealment; } -void Config_AttributeMessage::setConcealment(bool theConcealment) -{ +void Config_AttributeMessage::setConcealment(bool theConcealment) { this->myIsConcealment = theConcealment; } -bool Config_AttributeMessage::isObligatory() const -{ - return myIsObligatory; -} +bool Config_AttributeMessage::isObligatory() const { return myIsObligatory; } -void Config_AttributeMessage::setObligatory(bool theObligatory) -{ +void Config_AttributeMessage::setObligatory(bool theObligatory) { this->myIsObligatory = theObligatory; } -const std::list >& Config_AttributeMessage::getCases() const -{ +const std::list> & +Config_AttributeMessage::getCases() const { return myCases; } -void Config_AttributeMessage::setCases(const std::list >& theCases) -{ +void Config_AttributeMessage::setCases( + const std::list> &theCases) { myCases = theCases; } -bool Config_AttributeMessage::isMainArgument() const -{ +bool Config_AttributeMessage::isMainArgument() const { return myIsMainArgument; } -void Config_AttributeMessage::setMainArgument(bool isMainArg) -{ +void Config_AttributeMessage::setMainArgument(bool isMainArg) { myIsMainArgument = isMainArg; } -bool Config_AttributeMessage::isGeometricalSelection() const -{ +bool Config_AttributeMessage::isGeometricalSelection() const { return myIsGeometricalSelection; } -void Config_AttributeMessage::setGeometricalSelection(bool isGeometricalSelection) -{ +void Config_AttributeMessage::setGeometricalSelection( + bool isGeometricalSelection) { myIsGeometricalSelection = isGeometricalSelection; } diff --git a/src/Config/Config_AttributeMessage.h b/src/Config/Config_AttributeMessage.h index 671bda59e..4131a4d4a 100644 --- a/src/Config/Config_AttributeMessage.h +++ b/src/Config/Config_AttributeMessage.h @@ -14,54 +14,55 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ATTRIBUTE_MESSAGE_H #define ATTRIBUTE_MESSAGE_H -#include #include +#include #include -#include #include +#include /*! * \class Config_AttributeMessage - * \brief Class to pass an attribute's (widget's) entry info extracted from xml file. - * \code - * + * \brief Class to pass an attribute's (widget's) entry info extracted from xml + * file. \code * \endcode */ -class Config_AttributeMessage : public Events_Message -{ +class Config_AttributeMessage : public Events_Message { std::string myAttributeId; ///< Attribute's unique id - std::string myFeatureId; ///< Attribute's feature's unique id - bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid. - bool myIsConcealment; ///< If true, conceals features used as input + std::string myFeatureId; ///< Attribute's feature's unique id + bool myIsObligatory; ///< Required to be set by user, else it's feature is + ///< invalid. + bool myIsConcealment; ///< If true, conceals features used as input bool myIsMainArgument; ///< Mark attribute as a main argument of the feature bool myIsGeometricalSelection; ///< If true selects geometry instead of shape; - ///< a list of pairs, if the attribute is placed inside paged containers: (case, switch) - std::list > myCases; + ///< a list of pairs, if the attribute is placed inside paged containers: + ///< (case, switch) + std::list> myCases; public: /// Same event as Config_FeatureMessage::MODEL_EVENT() - inline static const char* MODEL_EVENT() - { + inline static const char *MODEL_EVENT() { return Config_FeatureMessage::MODEL_EVENT(); } /// Constructor - CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, const void* theParent = 0); + CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, + const void *theParent = 0); /// Destructor CONFIG_EXPORT virtual ~Config_AttributeMessage(); - //Auto-generated getters/setters + // Auto-generated getters/setters /// Returns attribute's unique id - CONFIG_EXPORT const std::string& attributeId() const; + CONFIG_EXPORT const std::string &attributeId() const; /// Returns attribute's feature's unique id - CONFIG_EXPORT const std::string& featureId() const; + CONFIG_EXPORT const std::string &featureId() const; /// Returns true if attribute is obligatory: /// Required to be set by user, else it's feature is invalid. CONFIG_EXPORT bool isObligatory() const; @@ -72,14 +73,16 @@ public: /// Returns true if attribute selects geometry instead of shape; CONFIG_EXPORT bool isGeometricalSelection() const; /// Returns container of ids of pair of a case and switches - CONFIG_EXPORT const std::list >& getCases() const; + CONFIG_EXPORT const std::list> & + getCases() const; /// Sets ids of pair of a case and switches - CONFIG_EXPORT void setCases(const std::list >& theCases); + CONFIG_EXPORT void + setCases(const std::list> &theCases); /// Set attribute's unique id - CONFIG_EXPORT void setAttributeId(const std::string& theId); + CONFIG_EXPORT void setAttributeId(const std::string &theId); /// Set attribute's feature's unique id - CONFIG_EXPORT void setFeatureId(const std::string& id); + CONFIG_EXPORT void setFeatureId(const std::string &id); /// Set attribute's concealment state CONFIG_EXPORT void setConcealment(bool isConcealment); /// Set attribute's obligatory state diff --git a/src/Config/Config_Common.cpp b/src/Config/Config_Common.cpp index a4b68bbf8..f8a50d2b7 100644 --- a/src/Config/Config_Common.cpp +++ b/src/Config/Config_Common.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_Common.h" @@ -25,88 +26,80 @@ #include // for stringstream -#include #include // for std::transform +#include #include -bool isElementNode(xmlNodePtr theNode) -{ +bool isElementNode(xmlNodePtr theNode) { if (!theNode) return false; return theNode->type == XML_ELEMENT_NODE; } -bool isNode(xmlNodePtr theNode, const char* theNodeName, ...) -{ - const xmlChar* aName = theNode->name; +bool isNode(xmlNodePtr theNode, const char *theNodeName, ...) { + const xmlChar *aName = theNode->name; if (!aName || !isElementNode(theNode)) { return false; } - if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) { + if (!xmlStrcmp(aName, (const xmlChar *)theNodeName)) { return true; } - va_list args; // define argument list variable - va_start(args, theNodeName); // init list; point to last defined argument + va_list args; // define argument list variable + va_start(args, theNodeName); // init list; point to last defined argument while (true) { - char *anArg = va_arg (args, char*); // get next argument + char *anArg = va_arg(args, char *); // get next argument if (anArg == NULL) break; - if (!xmlStrcmp(aName, (const xmlChar *) anArg)) { - va_end(args); // cleanup the system stack + if (!xmlStrcmp(aName, (const xmlChar *)anArg)) { + va_end(args); // cleanup the system stack return true; } } - va_end(args); // cleanup the system stack + va_end(args); // cleanup the system stack return false; } -bool isAttributeNode(xmlNodePtr theNode) -{ - if(!isElementNode(theNode)) +bool isAttributeNode(xmlNodePtr theNode) { + if (!isElementNode(theNode)) return false; // it's parent is "feature" or "source" or page ("case" or "box") - if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE, - WDG_GROUP, WDG_OPTIONALBOX, - WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, - WDG_SWITCH_CASE, NULL)) + if (!hasParent(theNode, NODE_FEATURE, NODE_SOURCE, WDG_GROUP, WDG_OPTIONALBOX, + WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_SWITCH_CASE, NULL)) return false; - //it should not be a "source" or a "validator" node + // it should not be a "source" or a "validator" node bool isLogical = isNode(theNode, NODE_SOURCE, NODE_VALIDATOR, NULL); // here must be only widgets not connected to attributes - bool isPagedContainer = isNode(theNode, WDG_TOOLBOX_BOX, - WDG_GROUP, - WDG_SWITCH_CASE, NULL); + bool isPagedContainer = + isNode(theNode, WDG_TOOLBOX_BOX, WDG_GROUP, WDG_SWITCH_CASE, NULL); return !isLogical && !isPagedContainer; } -bool isWidgetNode(xmlNodePtr theNode) -{ - if(!isElementNode(theNode)) +bool isWidgetNode(xmlNodePtr theNode) { + if (!isElementNode(theNode)) return false; // it's parent is "feature" or "source" or a page ("box", "case") - if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE, WDG_GROUP, WDG_OPTIONALBOX, - WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_SWITCH_CASE, WDG_FILTER, NULL)) + if (!hasParent(theNode, NODE_FEATURE, NODE_SOURCE, WDG_GROUP, WDG_OPTIONALBOX, + WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_SWITCH_CASE, + WDG_FILTER, NULL)) return false; - //it should not be a "source" or a "validator" node + // it should not be a "source" or a "validator" node return !isNode(theNode, NODE_SOURCE, NODE_VALIDATOR, NULL); } // LCOV_EXCL_START // widget api? -bool isCaseNode(xmlNodePtr theNode) -{ - if(!isElementNode(theNode)) +bool isCaseNode(xmlNodePtr theNode) { + if (!isElementNode(theNode)) return false; return isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, - WDG_RADIOBOX_ITEM, NULL); + WDG_RADIOBOX_ITEM, NULL); } // LCOV_EXCL_STOP -bool hasChild(xmlNodePtr theNode) -{ +bool hasChild(xmlNodePtr theNode) { xmlNodePtr aNode = theNode->children; for (; aNode; aNode = aNode->next) { if (isElementNode(theNode)) { @@ -116,8 +109,7 @@ bool hasChild(xmlNodePtr theNode) return false; } -bool hasParent(xmlNodePtr theNode) -{ +bool hasParent(xmlNodePtr theNode) { xmlNodePtr aNode = theNode->parent; if (!aNode) { return false; @@ -130,79 +122,77 @@ bool hasParent(xmlNodePtr theNode) return false; } -bool hasParent(xmlNodePtr theNode, const char* theNodeName, ...) -{ +bool hasParent(xmlNodePtr theNode, const char *theNodeName, ...) { if (!hasParent(theNode)) { return false; // have no parents at all } xmlNodePtr aNode = theNode->parent; - const xmlChar* aName = aNode->name; + const xmlChar *aName = aNode->name; if (!aName || !isElementNode(aNode)) { return false; } - if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) { + if (!xmlStrcmp(aName, (const xmlChar *)theNodeName)) { return true; } - va_list args; // define argument list variable - va_start(args, theNodeName); // init list; point to last defined argument + va_list args; // define argument list variable + va_start(args, theNodeName); // init list; point to last defined argument while (true) { - char *anArg = va_arg (args, char*); // get next argument + char *anArg = va_arg(args, char *); // get next argument if (anArg == NULL) break; - if (!xmlStrcmp(aName, (const xmlChar *) anArg)) { - va_end(args); // cleanup the system stack + if (!xmlStrcmp(aName, (const xmlChar *)anArg)) { + va_end(args); // cleanup the system stack return true; } } - va_end(args); // cleanup the system stack + va_end(args); // cleanup the system stack return false; } -xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const std::vector& theNodeNames) -{ +xmlNodePtr hasParentRecursive(xmlNodePtr theNode, + const std::vector &theNodeNames) { if (!hasParent(theNode)) { return 0; // have no parents at all } xmlNodePtr aNode = theNode->parent; - const xmlChar* aName = aNode->name; + const xmlChar *aName = aNode->name; if (!aName || !isElementNode(aNode)) { return 0; } for (size_t anIndex = 0; anIndex < theNodeNames.size(); ++anIndex) { - if (!xmlStrcmp(aName, (const xmlChar *) theNodeNames[anIndex])) + if (!xmlStrcmp(aName, (const xmlChar *)theNodeNames[anIndex])) return aNode; } return hasParentRecursive(aNode, theNodeNames); } -xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const char* theNodeName, ...) -{ - std::vector aNodeNames; - va_list args; // define argument list variable - va_start(args, theNodeName); // init list; point to last defined argument +xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const char *theNodeName, + ...) { + std::vector aNodeNames; + va_list args; // define argument list variable + va_start(args, theNodeName); // init list; point to last defined argument aNodeNames.push_back(theNodeName); while (true) { - char *anArg = va_arg (args, char*); // get next argument + char *anArg = va_arg(args, char *); // get next argument if (anArg == NULL) break; aNodeNames.push_back(anArg); } - va_end(args); // cleanup the system stack + va_end(args); // cleanup the system stack return hasParentRecursive(theNode, aNodeNames); } -bool getParametersInfo(xmlNodePtr theNode, std::string& outPropertyId, - std::list& outValidatorParameters) -{ - //Property id: - char* anIdProp = (char*) xmlGetProp(theNode, BAD_CAST _ID); +bool getParametersInfo(xmlNodePtr theNode, std::string &outPropertyId, + std::list &outValidatorParameters) { + // Property id: + char *anIdProp = (char *)xmlGetProp(theNode, BAD_CAST _ID); if (!anIdProp || anIdProp[0] == 0) { return false; } outPropertyId = std::string(anIdProp); - //Property parameters: - char* aParamProp = (char*) xmlGetProp(theNode, BAD_CAST _PARAMETERS); + // Property parameters: + char *aParamProp = (char *)xmlGetProp(theNode, BAD_CAST _PARAMETERS); if (aParamProp && aParamProp[0] != 0) { std::string aPropString = std::string(aParamProp); std::stringstream aPropStringStream(aPropString); @@ -215,14 +205,13 @@ bool getParametersInfo(xmlNodePtr theNode, std::string& outPropertyId, return true; } -std::string library(const std::string& theLibName) -{ - if(theLibName.empty()) +std::string library(const std::string &theLibName) { + if (theLibName.empty()) return std::string(); std::string aLibName = theLibName; #ifndef WIN32 - static std::string aLibExt( ".so" ); - if (aLibName.size() < 3 || aLibName.substr(0, 3) !="lib") { + static std::string aLibExt(".so"); + if (aLibName.size() < 3 || aLibName.substr(0, 3) != "lib") { aLibName = "lib" + aLibName; } #else @@ -237,41 +226,39 @@ std::string library(const std::string& theLibName) bool BothAreSpaces(char lhs, char rhs) { return (lhs == rhs) && (lhs == ' '); } -std::string getProperty(xmlNodePtr theNode, const char* thePropName) -{ +std::string getProperty(xmlNodePtr theNode, const char *thePropName) { std::string result = ""; - xmlChar* aPropChars = xmlGetProp(theNode, BAD_CAST thePropName); + xmlChar *aPropChars = xmlGetProp(theNode, BAD_CAST thePropName); if (!aPropChars || aPropChars[0] == 0) return result; - result = std::string((char*)aPropChars); + result = std::string((char *)aPropChars); xmlFree(aPropChars); - std::string::iterator new_end = std::unique(result.begin(), result.end(), BothAreSpaces); + std::string::iterator new_end = + std::unique(result.begin(), result.end(), BothAreSpaces); result.erase(new_end, result.end()); return result; } // LCOV_EXCL_START -std::string getContent(xmlNodePtr theNode) -{ +std::string getContent(xmlNodePtr theNode) { std::string result = ""; - xmlChar* aContent = xmlNodeGetContent(theNode); + xmlChar *aContent = xmlNodeGetContent(theNode); if (!aContent || aContent[0] == 0) return result; - result = std::string((char*)aContent); + result = std::string((char *)aContent); xmlFree(aContent); return result; } // LCOV_EXCL_STOP -std::string getNormalizedProperty(xmlNodePtr theNode, const char* thePropName) -{ +std::string getNormalizedProperty(xmlNodePtr theNode, const char *thePropName) { return normalize(getProperty(theNode, thePropName)); } -bool getBooleanAttribute(xmlNodePtr theNode, const char* theAttributeName, bool theDefault) -{ +bool getBooleanAttribute(xmlNodePtr theNode, const char *theAttributeName, + bool theDefault) { std::string prop = normalize(getProperty(theNode, theAttributeName)); bool result = theDefault; if (prop == "true" || prop == "1") { @@ -282,8 +269,7 @@ bool getBooleanAttribute(xmlNodePtr theNode, const char* theAttributeName, bool return result; } -CONFIG_EXPORT std::string normalize(const std::string& theString) -{ +CONFIG_EXPORT std::string normalize(const std::string &theString) { std::string result = theString; std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast(::tolower(c)); }); diff --git a/src/Config/Config_Common.h b/src/Config/Config_Common.h index 1e547ce94..6abd2adba 100644 --- a/src/Config/Config_Common.h +++ b/src/Config/Config_Common.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_COMMON_H_ @@ -22,9 +23,9 @@ #include "Config_def.h" -#include #include #include +#include //>> Forward declaration of xmlNodePtr. typedef struct _xmlNode xmlNode; @@ -51,7 +52,7 @@ CONFIG_EXPORT bool isElementNode(xmlNodePtr theNode); * ", NULL" is required to use unlimited number of arguments. * TODO(sbh): find a way to simplify calling this method. */ -CONFIG_EXPORT bool isNode(xmlNodePtr theNode, const char* theNodeName, ...); +CONFIG_EXPORT bool isNode(xmlNodePtr theNode, const char *theNodeName, ...); //#define isNode(p) _isNode(p, NULL) @@ -80,7 +81,6 @@ CONFIG_EXPORT bool isCaseNode(xmlNodePtr theNode); */ CONFIG_EXPORT bool hasChild(xmlNodePtr theNode); - /*! * Checks if the given node has a valid parent. */ @@ -89,19 +89,22 @@ CONFIG_EXPORT bool hasParent(xmlNodePtr theNode); /*! * Checks if the given node has a valid parent with any of the given node names. */ -CONFIG_EXPORT bool hasParent(xmlNodePtr theNode, const char* theNodeName, ...); +CONFIG_EXPORT bool hasParent(xmlNodePtr theNode, const char *theNodeName, ...); /*! - * Checks if the given node has any valid parent in hierarchy with any of the given node names. + * Checks if the given node has any valid parent in hierarchy with any of the + * given node names. */ -CONFIG_EXPORT xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const char* theNodeName, ...); - +CONFIG_EXPORT xmlNodePtr hasParentRecursive(xmlNodePtr theNode, + const char *theNodeName, ...); /*! - * Returns named property for an id node as std::string and the parameters of the node. + * Returns named property for an id node as std::string and the parameters of + * the node. */ -CONFIG_EXPORT bool getParametersInfo(xmlNodePtr theNode, std::string& outPropertyId, - std::list& outValidatorParameters); +CONFIG_EXPORT bool +getParametersInfo(xmlNodePtr theNode, std::string &outPropertyId, + std::list &outValidatorParameters); /*! \brief Convert the given parameter to the platform-specific library name. @@ -114,12 +117,13 @@ CONFIG_EXPORT bool getParametersInfo(xmlNodePtr theNode, std::string& outPropert \param str short library name \return full library name */ -CONFIG_EXPORT std::string library(const std::string& theLibName); +CONFIG_EXPORT std::string library(const std::string &theLibName); /*! * Returns named property for a given node as std::string. */ -CONFIG_EXPORT std::string getProperty(xmlNodePtr theNode, const char* thePropName); +CONFIG_EXPORT std::string getProperty(xmlNodePtr theNode, + const char *thePropName); /*! * Returns content of the node as std::string if it is exists. @@ -127,9 +131,10 @@ CONFIG_EXPORT std::string getProperty(xmlNodePtr theNode, const char* thePropNam CONFIG_EXPORT std::string getContent(xmlNodePtr theNode); /*! - * Returns normalized (lower case) named property for a given node as std::string. + * Returns normalized (lower case) named property for a given node as + * std::string. */ -std::string getNormalizedProperty(xmlNodePtr theNode, const char* thePropName); +std::string getNormalizedProperty(xmlNodePtr theNode, const char *thePropName); /*! * Checks if the given XML node has the given attribute, @@ -140,18 +145,18 @@ std::string getNormalizedProperty(xmlNodePtr theNode, const char* thePropName); * \return the boolean result */ CONFIG_EXPORT bool getBooleanAttribute(xmlNodePtr theNode, - const char* theAttributeName, + const char *theAttributeName, bool theDefault); /*! * Returns normalized (lower case) version of string. * Should be used for case insensitive string matching. */ -CONFIG_EXPORT std::string normalize(const char* theString); +CONFIG_EXPORT std::string normalize(const char *theString); /*! * Returns normalized (lower case) version of string. * Should be used for case insensitive string matching. */ -CONFIG_EXPORT std::string normalize(const std::string& theString); +CONFIG_EXPORT std::string normalize(const std::string &theString); #endif diff --git a/src/Config/Config_DataModelReader.cpp b/src/Config/Config_DataModelReader.cpp index 0c66ad00e..e8e5d807c 100644 --- a/src/Config/Config_DataModelReader.cpp +++ b/src/Config/Config_DataModelReader.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_DataModelReader.h" -#include #include "Config_Common.h" +#include #include @@ -28,22 +29,19 @@ // used only for GUI xml data reading // LCOV_EXCL_START Config_DataModelReader::Config_DataModelReader() - : Config_XMLReader(DATAMODEL_FILE), isRootReading(true), myIsResultLink(false) -{ -} + : Config_XMLReader(DATAMODEL_FILE), isRootReading(true), + myIsResultLink(false) {} -Config_DataModelReader::~Config_DataModelReader() -{ -} +Config_DataModelReader::~Config_DataModelReader() {} -void Config_DataModelReader::processNode(xmlNodePtr theNode) -{ +void Config_DataModelReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_FOLDER, NULL)) { std::string aName = getProperty(theNode, FOLDER_NAME); std::string aGroupType = getProperty(theNode, GROUP_TYPE); if (aName.empty() || aGroupType.empty()) Events_InfoMessage("Config_DataModelReader", - "Reading dataModel.xml: wrong folder definition.").send(); + "Reading dataModel.xml: wrong folder definition.") + .send(); std::string aIcon = getProperty(theNode, NODE_ICON); std::string aEmpty = getProperty(theNode, SHOW_EMPTY); @@ -51,64 +49,63 @@ void Config_DataModelReader::processNode(xmlNodePtr theNode) std::transform(aEmpty.begin(), aEmpty.end(), aEmpty.begin(), [](char c) { return static_cast(::toupper(c)); }); - bool aIsEmpty = (aEmpty == "FALSE")? false : true; + bool aIsEmpty = (aEmpty == "FALSE") ? false : true; - if (isRootReading) { + if (isRootReading) { myRootFolderNames.push_back(aName); myRootFolderTypes.push_back(aGroupType); myRootFolderIcons.push_back(aIcon); myRootFolderShowEmpty.push_back(aIsEmpty); myRootFeaturesList.push_back(aFeatures); - } else { + } else { mySubFolderNames.push_back(aName); mySubFolderTypes.push_back(aGroupType); mySubFolderIcons.push_back(aIcon); mySubFolderShowEmpty.push_back(aIsEmpty); mySubFeaturesList.push_back(aFeatures); - } - } else if (isNode(theNode, ROOT_DOCUMENT, NULL)) { + } + } else if (isNode(theNode, ROOT_DOCUMENT, NULL)) { isRootReading = true; myRootTypes = getProperty(theNode, GROUP_TYPE); - } else if (isNode(theNode, SUB_DOCUMENT, NULL)) { + } else if (isNode(theNode, SUB_DOCUMENT, NULL)) { isRootReading = false; mySubTypes = getProperty(theNode, GROUP_TYPE); std::string isResult = getProperty(theNode, LINK_ITEM); std::transform(isResult.begin(), isResult.end(), isResult.begin(), [](char c) { return static_cast(::toupper(c)); }); - myIsResultLink = (isResult == "TRUE")? true : false; + myIsResultLink = (isResult == "TRUE") ? true : false; } } -int Config_DataModelReader::rootFolderId(std::string theType) const -{ +int Config_DataModelReader::rootFolderId(std::string theType) const { std::vector::const_iterator aIt; int aId; - for (aIt = myRootFolderTypes.cbegin(), aId = 0; aIt != myRootFolderTypes.cend(); ++aIt, ++aId) { + for (aIt = myRootFolderTypes.cbegin(), aId = 0; + aIt != myRootFolderTypes.cend(); ++aIt, ++aId) { if ((*aIt) == theType) return aId; } return -1; } -int Config_DataModelReader::subFolderId(std::string theType) const -{ +int Config_DataModelReader::subFolderId(std::string theType) const { std::vector::const_iterator aIt; int aId; - for (aIt = mySubFolderTypes.cbegin(), aId = 0; aIt != mySubFolderTypes.cend(); ++aIt, ++aId) { + for (aIt = mySubFolderTypes.cbegin(), aId = 0; aIt != mySubFolderTypes.cend(); + ++aIt, ++aId) { if ((*aIt) == theType) return aId; } return -1; } -std::string getFolderFeatures(const std::string& theFolderName, - const std::vector& theNames, - const std::vector& theFeatures) -{ +std::string getFolderFeatures(const std::string &theFolderName, + const std::vector &theNames, + const std::vector &theFeatures) { int aId; bool aFound = false; std::vector::const_iterator aIt; - for(aIt = theNames.cbegin(), aId = 0; aIt != theNames.cend(); ++aIt, ++aId) { + for (aIt = theNames.cbegin(), aId = 0; aIt != theNames.cend(); ++aIt, ++aId) { if ((*aIt) == theFolderName) { aFound = true; break; @@ -119,16 +116,14 @@ std::string getFolderFeatures(const std::string& theFolderName, return std::string(); } -std::string Config_DataModelReader:: - subFolderFeatures(const std::string& theFolderName) const -{ +std::string Config_DataModelReader::subFolderFeatures( + const std::string &theFolderName) const { return getFolderFeatures(theFolderName, mySubFolderNames, mySubFeaturesList); } - -std::string Config_DataModelReader:: - rootFolderFeatures(const std::string& theFolderName) const -{ - return getFolderFeatures(theFolderName, myRootFolderNames, myRootFeaturesList); +std::string Config_DataModelReader::rootFolderFeatures( + const std::string &theFolderName) const { + return getFolderFeatures(theFolderName, myRootFolderNames, + myRootFeaturesList); } // LCOV_EXCL_STOP diff --git a/src/Config/Config_DataModelReader.h b/src/Config/Config_DataModelReader.h index 922c165ef..9298e34c8 100644 --- a/src/Config/Config_DataModelReader.h +++ b/src/Config/Config_DataModelReader.h @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_DATAMODELREADER_H_ #define CONFIG_DATAMODELREADER_H_ -#include #include +#include -#include #include +#include /*! * \class Config_DataModelReader @@ -32,9 +33,8 @@ * \brief Class that reads data model definition XML for * further processing in the XGUI_DataModel */ -class Config_DataModelReader : public Config_XMLReader -{ - public: +class Config_DataModelReader : public Config_XMLReader { +public: /*! * Constructor */ @@ -46,19 +46,27 @@ class Config_DataModelReader : public Config_XMLReader CONFIG_EXPORT std::string rootType() const { return myRootTypes; } /// Returns number of folders under root - CONFIG_EXPORT size_t rootFoldersNumber() const { return myRootFolderNames.size(); } + CONFIG_EXPORT size_t rootFoldersNumber() const { + return myRootFolderNames.size(); + } /// Returns name of the folder by its Id /// \param theId id of the folder - CONFIG_EXPORT std::string rootFolderName(int theId) const { return myRootFolderNames[theId]; } + CONFIG_EXPORT std::string rootFolderName(int theId) const { + return myRootFolderNames[theId]; + } /// Returns data type in the folder by its Id /// \param theId id of the folder - CONFIG_EXPORT std::string rootFolderType(int theId) const { return myRootFolderTypes[theId]; } + CONFIG_EXPORT std::string rootFolderType(int theId) const { + return myRootFolderTypes[theId]; + } /// Returns icon of a folder by its Id /// \param theId id of the folder - CONFIG_EXPORT std::string rootFolderIcon(int theId) const { return myRootFolderIcons[theId]; } + CONFIG_EXPORT std::string rootFolderIcon(int theId) const { + return myRootFolderIcons[theId]; + } /// Returns id of a folder containing the given type /// \param theType type of objects in folder @@ -66,47 +74,59 @@ class Config_DataModelReader : public Config_XMLReader /// Returns true if the folder can be shown without items /// \param theId id of the folder - CONFIG_EXPORT bool rootShowEmpty(int theId) const { return myRootFolderShowEmpty[theId]; } - - /// Returns list of features attached to folder with name theFolderName in sub-document - /// \param theFolderName a name of the folder - CONFIG_EXPORT std::string rootFolderFeatures(const std::string& theFolderName) const; + CONFIG_EXPORT bool rootShowEmpty(int theId) const { + return myRootFolderShowEmpty[theId]; + } + /// Returns list of features attached to folder with name theFolderName in + /// sub-document \param theFolderName a name of the folder + CONFIG_EXPORT std::string + rootFolderFeatures(const std::string &theFolderName) const; // SUB folders propertiues ******************** /// Returns name of type of tree items in sub document CONFIG_EXPORT std::string subType() const { return mySubTypes; } /// Returns number of folders under sub document - CONFIG_EXPORT size_t subFoldersNumber() const { return mySubFolderNames.size(); } + CONFIG_EXPORT size_t subFoldersNumber() const { + return mySubFolderNames.size(); + } /// Returns name of the folder by its Id /// \param theId id of the folder - CONFIG_EXPORT std::string subFolderName(int theId) const { return mySubFolderNames[theId]; } + CONFIG_EXPORT std::string subFolderName(int theId) const { + return mySubFolderNames[theId]; + } /// Returns data type in the folder by its Id /// \param theId id of the folder - CONFIG_EXPORT std::string subFolderType(int theId) const { return mySubFolderTypes[theId]; } + CONFIG_EXPORT std::string subFolderType(int theId) const { + return mySubFolderTypes[theId]; + } /// Returns icon of a folder by its Id /// \param theId id of the folder - CONFIG_EXPORT std::string subFolderIcon(int theId) const { return mySubFolderIcons[theId]; } + CONFIG_EXPORT std::string subFolderIcon(int theId) const { + return mySubFolderIcons[theId]; + } /// Returns true if the folder can be shown without items /// \param theId id of the folder - CONFIG_EXPORT bool subShowEmpty(int theId) const { return mySubFolderShowEmpty[theId]; } + CONFIG_EXPORT bool subShowEmpty(int theId) const { + return mySubFolderShowEmpty[theId]; + } /// Returns id of a folder containing the given type /// \param theType type of objects in folder CONFIG_EXPORT int subFolderId(std::string theType) const; - /// Returns list of features attached to folder with name theFolderName in sub-document - /// \param theFolderName a name of the folder - CONFIG_EXPORT std::string subFolderFeatures(const std::string& theFolderName) const; - + /// Returns list of features attached to folder with name theFolderName in + /// sub-document \param theFolderName a name of the folder + CONFIG_EXPORT std::string + subFolderFeatures(const std::string &theFolderName) const; - /// Returns true if the sub-document data tree has to be attached to Part Result node - /// Otherwise it has to be connected to Part feature node + /// Returns true if the sub-document data tree has to be attached to Part + /// Result node Otherwise it has to be connected to Part feature node CONFIG_EXPORT bool isAttachToResult() const { return myIsResultLink; } protected: @@ -136,5 +156,4 @@ private: std::string mySubTypes; }; - #endif diff --git a/src/Config/Config_FeatureMessage.cpp b/src/Config/Config_FeatureMessage.cpp index 09c288d7d..af52224c1 100644 --- a/src/Config/Config_FeatureMessage.cpp +++ b/src/Config/Config_FeatureMessage.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_FeatureMessage.h" -Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* theParent) - : Events_Message(theId, theParent) -{ +Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, + const void *theParent) + : Events_Message(theId, theParent) { myId = ""; myText = ""; myTooltip = ""; @@ -44,220 +45,151 @@ Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* myAbortConfirmation = true; } -Config_FeatureMessage::~Config_FeatureMessage() -{ +Config_FeatureMessage::~Config_FeatureMessage() {} -} - -const std::string& Config_FeatureMessage::icon() const -{ - return myIcon; -} +const std::string &Config_FeatureMessage::icon() const { return myIcon; } -void Config_FeatureMessage::setIcon(const std::string& icon) -{ - myIcon = icon; -} +void Config_FeatureMessage::setIcon(const std::string &icon) { myIcon = icon; } -const std::string& Config_FeatureMessage::id() const -{ - return myId; -} +const std::string &Config_FeatureMessage::id() const { return myId; } -void Config_FeatureMessage::setId(const std::string& id) -{ - myId = id; -} +void Config_FeatureMessage::setId(const std::string &id) { myId = id; } -const std::string& Config_FeatureMessage::keysequence() const -{ +const std::string &Config_FeatureMessage::keysequence() const { return myKeysequence; } -void Config_FeatureMessage::setKeysequence(const std::string& keysequence) -{ +void Config_FeatureMessage::setKeysequence(const std::string &keysequence) { myKeysequence = keysequence; } -const std::string& Config_FeatureMessage::text() const -{ - return myText; -} +const std::string &Config_FeatureMessage::text() const { return myText; } -void Config_FeatureMessage::setText(const std::string& text) -{ - myText = text; -} +void Config_FeatureMessage::setText(const std::string &text) { myText = text; } -const std::string& Config_FeatureMessage::tooltip() const -{ - return myTooltip; -} +const std::string &Config_FeatureMessage::tooltip() const { return myTooltip; } -const std::string& Config_FeatureMessage::groupId() const -{ - return myGroupId; -} +const std::string &Config_FeatureMessage::groupId() const { return myGroupId; } -void Config_FeatureMessage::setGroupId(const std::string& groupId) -{ +void Config_FeatureMessage::setGroupId(const std::string &groupId) { myGroupId = groupId; } -const std::string& Config_FeatureMessage::toolBarId() const -{ +const std::string &Config_FeatureMessage::toolBarId() const { return myToolBarId; } -void Config_FeatureMessage::setToolBarId(const std::string& aId) -{ +void Config_FeatureMessage::setToolBarId(const std::string &aId) { myToolBarId = aId; } -const std::string& Config_FeatureMessage::workbenchId() const -{ +const std::string &Config_FeatureMessage::workbenchId() const { return myWorkbenchId; } -void Config_FeatureMessage::setWorkbenchId(const std::string& workbenchId) -{ +void Config_FeatureMessage::setWorkbenchId(const std::string &workbenchId) { myWorkbenchId = workbenchId; } -const std::string& Config_FeatureMessage::documentKind() const -{ +const std::string &Config_FeatureMessage::documentKind() const { return myDocumentKind; } -void Config_FeatureMessage::setDocumentKind(const std::string& documentKind) -{ +void Config_FeatureMessage::setDocumentKind(const std::string &documentKind) { myDocumentKind = documentKind; } -void Config_FeatureMessage::setTooltip(const std::string& tooltip) -{ +void Config_FeatureMessage::setTooltip(const std::string &tooltip) { myTooltip = tooltip; } -const std::string& Config_FeatureMessage::pluginLibrary() const -{ +const std::string &Config_FeatureMessage::pluginLibrary() const { return myPluginLibrary; } -void Config_FeatureMessage::setPluginLibrary(const std::string& thePluginLibrary) -{ +void Config_FeatureMessage::setPluginLibrary( + const std::string &thePluginLibrary) { this->myPluginLibrary = thePluginLibrary; } // LCOV_EXCL_START -bool Config_FeatureMessage::isUseInput() const -{ - return myUseInput; -} +bool Config_FeatureMessage::isUseInput() const { return myUseInput; } -bool Config_FeatureMessage::isInternal() const -{ - return myInternal; -} +bool Config_FeatureMessage::isInternal() const { return myInternal; } -bool Config_FeatureMessage::isAutoPreview() const -{ - return myIsAutoPreview; -} +bool Config_FeatureMessage::isAutoPreview() const { return myIsAutoPreview; } -bool Config_FeatureMessage::isTitleInToolbar() const -{ +bool Config_FeatureMessage::isTitleInToolbar() const { return myIsTitleInToolbar; } -bool Config_FeatureMessage::isModal() const -{ - return myModal; -} +bool Config_FeatureMessage::isModal() const { return myModal; } -bool Config_FeatureMessage::isApplyContinue() const -{ +bool Config_FeatureMessage::isApplyContinue() const { return myIsApplyContinue; } // LCOV_EXCL_STOP -void Config_FeatureMessage::setUseInput(bool isUseInput) -{ +void Config_FeatureMessage::setUseInput(bool isUseInput) { myUseInput = isUseInput; } -void Config_FeatureMessage::setInternal(bool isInternal) -{ +void Config_FeatureMessage::setInternal(bool isInternal) { myInternal = isInternal; } -void Config_FeatureMessage::setModal(bool isModal) -{ - myModal = isModal; -} +void Config_FeatureMessage::setModal(bool isModal) { myModal = isModal; } -const std::string& Config_FeatureMessage::nestedFeatures() const -{ +const std::string &Config_FeatureMessage::nestedFeatures() const { return myNestedFeatures; } -const std::string& Config_FeatureMessage::actionsWhenNested() const -{ +const std::string &Config_FeatureMessage::actionsWhenNested() const { return myActionsWhenNested; } -void Config_FeatureMessage::setNestedFeatures(const std::string& theNestedFeatures) -{ +void Config_FeatureMessage::setNestedFeatures( + const std::string &theNestedFeatures) { myNestedFeatures = theNestedFeatures; } -void Config_FeatureMessage::setActionsWhenNested(const std::string& theActions) -{ +void Config_FeatureMessage::setActionsWhenNested( + const std::string &theActions) { myActionsWhenNested = theActions; } -void Config_FeatureMessage::setAutoPreview(bool isAutoPreview) -{ +void Config_FeatureMessage::setAutoPreview(bool isAutoPreview) { myIsAutoPreview = isAutoPreview; } -void Config_FeatureMessage::setApplyContinue(bool isModal) -{ +void Config_FeatureMessage::setApplyContinue(bool isModal) { myIsApplyContinue = isModal; } -const std::string& Config_FeatureMessage::helpFileName() const -{ +const std::string &Config_FeatureMessage::helpFileName() const { return myHelpFile; } -void Config_FeatureMessage::setHelpFileName(const std::string& aName) -{ +void Config_FeatureMessage::setHelpFileName(const std::string &aName) { myHelpFile = aName; } -void Config_FeatureMessage::setTitleInToolbar(bool theValue) -{ +void Config_FeatureMessage::setTitleInToolbar(bool theValue) { myIsTitleInToolbar = theValue; } -bool Config_FeatureMessage::isHideFacesPanel() const -{ +bool Config_FeatureMessage::isHideFacesPanel() const { return myHideFacesPanel; } - -void Config_FeatureMessage::setHideFacesPanel(bool theValue) -{ +void Config_FeatureMessage::setHideFacesPanel(bool theValue) { myHideFacesPanel = theValue; } -bool Config_FeatureMessage::isAbortConfirmation() const -{ +bool Config_FeatureMessage::isAbortConfirmation() const { return myAbortConfirmation; } -void Config_FeatureMessage::setAbortConfirmation(bool theValue) -{ +void Config_FeatureMessage::setAbortConfirmation(bool theValue) { myAbortConfirmation = theValue; } diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index 8e560aa80..c3fd66b3f 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_FEATUREMESSAGE_H @@ -32,84 +33,87 @@ * Example of the feature entry: * \code - * + * * \endcode */ -class Config_FeatureMessage : public Events_Message -{ - std::string myId; /// +#include #include #include -#include #include +#include #include -#include #include +#include #include #include #include -#include #include #include +#include #ifdef _DEBUG #include #endif -Config_FeatureReader::Config_FeatureReader(const std::string& theXmlFile, - const std::string& theLibraryName, - const std::string& theDocSection, - const char* theEventGenerated) - : Config_XMLReader(theXmlFile), - myLibraryName(theLibraryName), +Config_FeatureReader::Config_FeatureReader(const std::string &theXmlFile, + const std::string &theLibraryName, + const std::string &theDocSection, + const char *theEventGenerated) + : Config_XMLReader(theXmlFile), myLibraryName(theLibraryName), myLibraryDocSection(theDocSection), - myEventGenerated(theEventGenerated ? theEventGenerated : Config_FeatureMessage::GUI_EVENT()), - myIsProcessWidgets(theEventGenerated != NULL) -{ -} + myEventGenerated(theEventGenerated ? theEventGenerated + : Config_FeatureMessage::GUI_EVENT()), + myIsProcessWidgets(theEventGenerated != NULL) {} -Config_FeatureReader::~Config_FeatureReader() -{ -} +Config_FeatureReader::~Config_FeatureReader() {} -std::list Config_FeatureReader::features() const -{ +std::list Config_FeatureReader::features() const { return myFeatures; } -void Config_FeatureReader::processNode(xmlNodePtr theNode) -{ +void Config_FeatureReader::processNode(xmlNodePtr theNode) { Events_ID aMenuItemEvent = Events_Loop::eventByName(myEventGenerated); if (isNode(theNode, NODE_FEATURE, NULL)) { storeAttribute(theNode, _ID); - std::shared_ptr - aMessage(new Config_FeatureMessage(aMenuItemEvent, this)); + std::shared_ptr aMessage( + new Config_FeatureMessage(aMenuItemEvent, this)); fillFeature(theNode, aMessage); myFeatures.push_back(getProperty(theNode, _ID)); - //If a feature has xml definition for it's widget: + // If a feature has xml definition for it's widget: aMessage->setUseInput(hasChild(theNode)); Events_Loop::loop()->send(aMessage); - //The m_last* variables always defined before fillFeature() call. XML is a tree. + // The m_last* variables always defined before fillFeature() call. XML is a + // tree. } else if (isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NULL)) { storeAttribute(theNode, _ID); storeAttribute(theNode, GROUP_TOOLBAR); @@ -79,39 +75,40 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode) } else if (myIsProcessWidgets) { // widgets, like shape_selector or containers, like toolbox if (isAttributeNode(theNode)) { - std::shared_ptr - aMessage(new Config_AttributeMessage(aMenuItemEvent, this)); + std::shared_ptr aMessage( + new Config_AttributeMessage(aMenuItemEvent, this)); aMessage->setFeatureId(restoreAttribute(NODE_FEATURE, _ID)); std::string anAttributeID = getProperty(theNode, _ID); if (!anAttributeID.empty()) { aMessage->setAttributeId(anAttributeID); - aMessage->setObligatory(getBooleanAttribute(theNode, ATTR_OBLIGATORY, true)); - bool isConcealment = getBooleanAttribute(theNode, ATTR_CONCEALMENT, false); + aMessage->setObligatory( + getBooleanAttribute(theNode, ATTR_OBLIGATORY, true)); + bool isConcealment = + getBooleanAttribute(theNode, ATTR_CONCEALMENT, false); aMessage->setConcealment(isConcealment); - bool isMainArg = isConcealment && getBooleanAttribute(theNode, ATTR_MAIN_ARG, false); + bool isMainArg = + isConcealment && getBooleanAttribute(theNode, ATTR_MAIN_ARG, false); aMessage->setMainArgument(isMainArg); - aMessage->setGeometricalSelection(getBooleanAttribute(theNode, - ATTR_GEOMETRICAL_SELECTION, - false)); - - std::list > aCases; - xmlNodePtr aCaseNode = hasParentRecursive(theNode, - WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL); - while(aCaseNode) { + aMessage->setGeometricalSelection( + getBooleanAttribute(theNode, ATTR_GEOMETRICAL_SELECTION, false)); + + std::list> aCases; + xmlNodePtr aCaseNode = + hasParentRecursive(theNode, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, + WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL); + while (aCaseNode) { std::string aCaseNodeID = getProperty(aCaseNode, _ID); std::string aSwitchNodeID = ""; - const xmlChar* aName = aCaseNode->name; + const xmlChar *aName = aCaseNode->name; xmlNodePtr aSwitchNode = 0; - if (!xmlStrcmp(aName, (const xmlChar *) WDG_SWITCH_CASE)) { + if (!xmlStrcmp(aName, (const xmlChar *)WDG_SWITCH_CASE)) { aSwitchNode = hasParentRecursive(aCaseNode, WDG_SWITCH, NULL); - } - else if (!xmlStrcmp(aName, (const xmlChar *) WDG_TOOLBOX_BOX)) { + } else if (!xmlStrcmp(aName, (const xmlChar *)WDG_TOOLBOX_BOX)) { aSwitchNode = hasParentRecursive(aCaseNode, WDG_TOOLBOX, NULL); - } - else if (!xmlStrcmp(aName, (const xmlChar *)WDG_RADIOBOX_ITEM)) { + } else if (!xmlStrcmp(aName, (const xmlChar *)WDG_RADIOBOX_ITEM)) { aSwitchNode = hasParentRecursive(aCaseNode, WDG_RADIOBOX, NULL); } - if (!xmlStrcmp(aName, (const xmlChar *) WDG_OPTIONALBOX)) { + if (!xmlStrcmp(aName, (const xmlChar *)WDG_OPTIONALBOX)) { /// the box is optional, attribute is in case /// if the optional attribute value is not empty aSwitchNode = aCaseNode; @@ -120,59 +117,59 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode) aSwitchNodeID = getProperty(aSwitchNode, _ID); aCases.push_back(std::make_pair(aSwitchNodeID, aCaseNodeID)); - aCaseNode = hasParentRecursive(aSwitchNode, WDG_SWITCH_CASE, - WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL); + aCaseNode = + hasParentRecursive(aSwitchNode, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, + WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL); } aMessage->setCases(aCases); Events_Loop::loop()->send(aMessage); } - // container pages, like "case" or "box" + // container pages, like "case" or "box" } else if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE, - WDG_TOOLBOX, WDG_TOOLBOX_BOX, - WDG_RADIOBOX, WDG_RADIOBOX_ITEM, NULL)) { + WDG_TOOLBOX, WDG_TOOLBOX_BOX, WDG_RADIOBOX, + WDG_RADIOBOX_ITEM, NULL)) { storeAttribute(theNode, _ID); // save case:caseId (or box:boxId) } } - //Process SOURCE nodes. + // Process SOURCE nodes. Config_XMLReader::processNode(theNode); } -void Config_FeatureReader::cleanup(xmlNodePtr theNode) -{ - if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE, - WDG_TOOLBOX, WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_RADIOBOX, NULL)) { +void Config_FeatureReader::cleanup(xmlNodePtr theNode) { + if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE, WDG_TOOLBOX, + WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_RADIOBOX, NULL)) { // cleanup id of cases when leave case node cleanupAttribute(theNode, _ID); } } -bool Config_FeatureReader::processChildren(xmlNodePtr theNode) -{ +bool Config_FeatureReader::processChildren(xmlNodePtr theNode) { bool result = isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NULL); - if(!result && myIsProcessWidgets) { - result = isNode(theNode, NODE_FEATURE, - WDG_GROUP, WDG_OPTIONALBOX, - WDG_TOOLBOX, WDG_TOOLBOX_BOX, - WDG_RADIOBOX, WDG_RADIOBOX_ITEM, - WDG_SWITCH, WDG_SWITCH_CASE, NULL); + if (!result && myIsProcessWidgets) { + result = isNode(theNode, NODE_FEATURE, WDG_GROUP, WDG_OPTIONALBOX, + WDG_TOOLBOX, WDG_TOOLBOX_BOX, WDG_RADIOBOX, + WDG_RADIOBOX_ITEM, WDG_SWITCH, WDG_SWITCH_CASE, NULL); } return result; } -void Config_FeatureReader::fillFeature(xmlNodePtr theFeatureNode, - const std::shared_ptr& outFeatureMessage) -{ +void Config_FeatureReader::fillFeature( + xmlNodePtr theFeatureNode, + const std::shared_ptr &outFeatureMessage) { std::string anId = getProperty(theFeatureNode, _ID); outFeatureMessage->setId(anId); outFeatureMessage->setPluginLibrary(myLibraryName); - outFeatureMessage->setNestedFeatures(getProperty(theFeatureNode, FEATURE_NESTED)); - outFeatureMessage->setActionsWhenNested(getNormalizedProperty(theFeatureNode, - FEATURE_WHEN_NESTED)); - outFeatureMessage->setModal(getBooleanAttribute(theFeatureNode, FEATURE_MODAL, false)); - bool isAutoPreview = getBooleanAttribute(theFeatureNode, FEATURE_AUTO_PREVIEW, true); + outFeatureMessage->setNestedFeatures( + getProperty(theFeatureNode, FEATURE_NESTED)); + outFeatureMessage->setActionsWhenNested( + getNormalizedProperty(theFeatureNode, FEATURE_WHEN_NESTED)); + outFeatureMessage->setModal( + getBooleanAttribute(theFeatureNode, FEATURE_MODAL, false)); + bool isAutoPreview = + getBooleanAttribute(theFeatureNode, FEATURE_AUTO_PREVIEW, true); outFeatureMessage->setAutoPreview(isAutoPreview); outFeatureMessage->setApplyContinue( - getBooleanAttribute(theFeatureNode, FEATURE_APPLY_CONTINUE, false)); + getBooleanAttribute(theFeatureNode, FEATURE_APPLY_CONTINUE, false)); bool isInternal = getBooleanAttribute(theFeatureNode, ATTR_INTERNAL, false); outFeatureMessage->setInternal(isInternal); @@ -180,30 +177,36 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theFeatureNode, std::string aHelpFile = getProperty(theFeatureNode, HELP_FILE); if (!aHelpFile.empty()) { aHelpFile = - (myLibraryDocSection.empty() ? myLibraryName : myLibraryDocSection) + "/" + aHelpFile; + (myLibraryDocSection.empty() ? myLibraryName : myLibraryDocSection) + + "/" + aHelpFile; outFeatureMessage->setHelpFileName(aHelpFile); } - bool isHideFaces = getBooleanAttribute(theFeatureNode, HIDEFACES_PANEL, false); + bool isHideFaces = + getBooleanAttribute(theFeatureNode, HIDEFACES_PANEL, false); outFeatureMessage->setHideFacesPanel(isHideFaces); - bool isConfirmAbort = getBooleanAttribute(theFeatureNode, ABORT_CONFIRMATION, true); + bool isConfirmAbort = + getBooleanAttribute(theFeatureNode, ABORT_CONFIRMATION, true); outFeatureMessage->setAbortConfirmation(isConfirmAbort); - //if (isInternal) { - // //Internal feature has no visual representation. - // return; - //} + // if (isInternal) { + // //Internal feature has no visual representation. + // return; + // } - std::string aText = Config_Translator::translate(anId, getProperty(theFeatureNode, FEATURE_TEXT)); + std::string aText = Config_Translator::translate( + anId, getProperty(theFeatureNode, FEATURE_TEXT)); outFeatureMessage->setText(aText); - bool isTitleInToolbar = getBooleanAttribute(theFeatureNode, FEATURE_TITLE_IN_TOOLBAR, true); + bool isTitleInToolbar = + getBooleanAttribute(theFeatureNode, FEATURE_TITLE_IN_TOOLBAR, true); outFeatureMessage->setTitleInToolbar(isTitleInToolbar); std::string aToolTip = Config_Translator::translate( - anId, getProperty(theFeatureNode, FEATURE_TOOLTIP)); + anId, getProperty(theFeatureNode, FEATURE_TOOLTIP)); outFeatureMessage->setTooltip(aToolTip); outFeatureMessage->setIcon(getProperty(theFeatureNode, FEATURE_ICON)); - outFeatureMessage->setKeysequence(getProperty(theFeatureNode, FEATURE_KEYSEQUENCE)); + outFeatureMessage->setKeysequence( + getProperty(theFeatureNode, FEATURE_KEYSEQUENCE)); std::string aGroupName = restoreAttribute(NODE_GROUP, _ID); std::string aWBNName = restoreAttribute(NODE_WORKBENCH, _ID); @@ -215,9 +218,10 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theFeatureNode, outFeatureMessage->setWorkbenchId(aWBNName); outFeatureMessage->setToolBarId(isGroupToolbar ? aGroupName : aWBNName); - // Get document kind of a feature, if empty set workbench's kind (might be empty too) + // Get document kind of a feature, if empty set workbench's kind (might be + // empty too) std::string aDocKind = getProperty(theFeatureNode, FEATURE_DOC); - if(aDocKind.empty()) { + if (aDocKind.empty()) { aDocKind = restoreAttribute(NODE_WORKBENCH, WORKBENCH_DOC); } outFeatureMessage->setDocumentKind(aDocKind); diff --git a/src/Config/Config_FeatureReader.h b/src/Config/Config_FeatureReader.h index f191d7d83..c72283a40 100644 --- a/src/Config/Config_FeatureReader.h +++ b/src/Config/Config_FeatureReader.h @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_FEATUREREADER_H_ #define CONFIG_FEATUREREADER_H_ -#include #include +#include #include -#include #include +#include class Config_FeatureMessage; @@ -34,19 +35,18 @@ class Config_FeatureMessage; * \ingroup Config * \brief Class to process feature's xml definition. */ -class Config_FeatureReader : public Config_XMLReader -{ - public: +class Config_FeatureReader : public Config_XMLReader { +public: /// Constructor - Config_FeatureReader(const std::string& theXmlFile, - const std::string& theLibraryName, - const std::string& theDocSection = std::string(), - const char* theEventGenerated = 0); + Config_FeatureReader(const std::string &theXmlFile, + const std::string &theLibraryName, + const std::string &theDocSection = std::string(), + const char *theEventGenerated = 0); virtual ~Config_FeatureReader(); /// Returns list of all features defined in reader's file std::list features() const; - protected: +protected: /// Overloaded method. Defines how to process each node virtual void processNode(xmlNodePtr aNode); @@ -57,16 +57,18 @@ class Config_FeatureReader : public Config_XMLReader virtual bool processChildren(xmlNodePtr aNode); /// Fills feature message - void fillFeature(xmlNodePtr theRoot, - const std::shared_ptr& outFeatureMessage); + void + fillFeature(xmlNodePtr theRoot, + const std::shared_ptr &outFeatureMessage); - private: +private: std::string myLibraryName; std::string myLibraryDocSection; std::list myFeatures; - /// event generated on feature data sending, by default it is Config_FeatureMessage::GUI_EVENT() - const char* myEventGenerated; + /// event generated on feature data sending, by default it is + /// Config_FeatureMessage::GUI_EVENT() + const char *myEventGenerated; bool myIsProcessWidgets; }; diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 3bb4a6b38..531e95398 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_KEYWORDS_H_ @@ -25,141 +26,145 @@ /* * Hardcoded xml entities of plugin-*.xml */ -MAYBE_UNUSED const static char* NODE_WORKBENCH = "workbench"; -MAYBE_UNUSED const static char* NODE_GROUP = "group"; -MAYBE_UNUSED const static char* NODE_FEATURE = "feature"; -MAYBE_UNUSED const static char* NODE_SOURCE = "source"; -MAYBE_UNUSED const static char* NODE_VALIDATOR = "validator"; -MAYBE_UNUSED const static char* NODE_XMLPARENT = "libxml_parent"; +MAYBE_UNUSED const static char *NODE_WORKBENCH = "workbench"; +MAYBE_UNUSED const static char *NODE_GROUP = "group"; +MAYBE_UNUSED const static char *NODE_FEATURE = "feature"; +MAYBE_UNUSED const static char *NODE_SOURCE = "source"; +MAYBE_UNUSED const static char *NODE_VALIDATOR = "validator"; +MAYBE_UNUSED const static char *NODE_XMLPARENT = "libxml_parent"; // Property panels -MAYBE_UNUSED const static char* PROPERTY_PANEL_ID = "property_panel_id"; +MAYBE_UNUSED const static char *PROPERTY_PANEL_ID = "property_panel_id"; // Widgets -MAYBE_UNUSED const static char* WDG_INFO = "label"; -MAYBE_UNUSED const static char* WDG_UNDOLABEL = "undo_label"; -MAYBE_UNUSED const static char* WDG_DOUBLEVALUE = "doublevalue"; -MAYBE_UNUSED const static char* WDG_DOUBLEVALUELABEL = "labelvalue"; -MAYBE_UNUSED const static char* WDG_INTEGERVALUE = "integervalue"; -MAYBE_UNUSED const static char* WDG_BOOLVALUE = "boolvalue"; -MAYBE_UNUSED const static char* WDG_STRINGVALUE = "stringvalue"; -MAYBE_UNUSED const static char* WDG_NAMEVALUE = "namevalue"; -MAYBE_UNUSED const static char* WDG_MULTISELECTOR = "multi_selector"; -MAYBE_UNUSED const static char* WDG_SHAPE_SELECTOR = "shape_selector"; -MAYBE_UNUSED const static char* WDG_FEATURE_SELECTOR = "feature_selector"; -MAYBE_UNUSED const static char* WDG_CONCEALED_OBJECTS_VIEW = "concealed_objects_view"; -MAYBE_UNUSED const static char* WDG_CHOICE = "choice"; -MAYBE_UNUSED const static char* WDG_DOUBLEVALUE_EDITOR = "doublevalue_editor"; -MAYBE_UNUSED const static char* WDG_FILE_SELECTOR= "file_selector"; -MAYBE_UNUSED const static char* WDG_EXPR_EDITOR = "expr_editor"; -MAYBE_UNUSED const static char* WDG_PLACE_HOLDER = "placeholder"; -MAYBE_UNUSED const static char* WDG_ACTION = "action"; -MAYBE_UNUSED const static char* WDG_POINT_INPUT = "point_input"; -MAYBE_UNUSED const static char* WDG_SELECTION_FILTERS = "selection_filters"; +MAYBE_UNUSED const static char *WDG_INFO = "label"; +MAYBE_UNUSED const static char *WDG_UNDOLABEL = "undo_label"; +MAYBE_UNUSED const static char *WDG_DOUBLEVALUE = "doublevalue"; +MAYBE_UNUSED const static char *WDG_DOUBLEVALUELABEL = "labelvalue"; +MAYBE_UNUSED const static char *WDG_INTEGERVALUE = "integervalue"; +MAYBE_UNUSED const static char *WDG_BOOLVALUE = "boolvalue"; +MAYBE_UNUSED const static char *WDG_STRINGVALUE = "stringvalue"; +MAYBE_UNUSED const static char *WDG_NAMEVALUE = "namevalue"; +MAYBE_UNUSED const static char *WDG_MULTISELECTOR = "multi_selector"; +MAYBE_UNUSED const static char *WDG_SHAPE_SELECTOR = "shape_selector"; +MAYBE_UNUSED const static char *WDG_FEATURE_SELECTOR = "feature_selector"; +MAYBE_UNUSED const static char *WDG_CONCEALED_OBJECTS_VIEW = + "concealed_objects_view"; +MAYBE_UNUSED const static char *WDG_CHOICE = "choice"; +MAYBE_UNUSED const static char *WDG_DOUBLEVALUE_EDITOR = "doublevalue_editor"; +MAYBE_UNUSED const static char *WDG_FILE_SELECTOR = "file_selector"; +MAYBE_UNUSED const static char *WDG_EXPR_EDITOR = "expr_editor"; +MAYBE_UNUSED const static char *WDG_PLACE_HOLDER = "placeholder"; +MAYBE_UNUSED const static char *WDG_ACTION = "action"; +MAYBE_UNUSED const static char *WDG_POINT_INPUT = "point_input"; +MAYBE_UNUSED const static char *WDG_SELECTION_FILTERS = "selection_filters"; // Containers -MAYBE_UNUSED const static char* WDG_GROUP = "groupbox"; -MAYBE_UNUSED const static char* WDG_OPTIONALBOX = "optionalbox"; -MAYBE_UNUSED const static char* WDG_TOOLBOX = "toolbox"; -MAYBE_UNUSED const static char* WDG_RADIOBOX = "radiobox"; -MAYBE_UNUSED const static char* WDG_RADIOBOX_ITEM = "radio"; -MAYBE_UNUSED const static char* WDG_TOOLBOX_BOX = "box"; -MAYBE_UNUSED const static char* WDG_SWITCH = "switch"; -MAYBE_UNUSED const static char* WDG_SWITCH_CASE = "case"; -MAYBE_UNUSED const static char* WDG_FILTER = "filter"; +MAYBE_UNUSED const static char *WDG_GROUP = "groupbox"; +MAYBE_UNUSED const static char *WDG_OPTIONALBOX = "optionalbox"; +MAYBE_UNUSED const static char *WDG_TOOLBOX = "toolbox"; +MAYBE_UNUSED const static char *WDG_RADIOBOX = "radiobox"; +MAYBE_UNUSED const static char *WDG_RADIOBOX_ITEM = "radio"; +MAYBE_UNUSED const static char *WDG_TOOLBOX_BOX = "box"; +MAYBE_UNUSED const static char *WDG_SWITCH = "switch"; +MAYBE_UNUSED const static char *WDG_SWITCH_CASE = "case"; +MAYBE_UNUSED const static char *WDG_FILTER = "filter"; // Common properties (xml attributes of nodes) -MAYBE_UNUSED const static char* _ID = "id"; +MAYBE_UNUSED const static char *_ID = "id"; // NODE_WORKBENCH properties -MAYBE_UNUSED const static char* WORKBENCH_DOC = "document"; +MAYBE_UNUSED const static char *WORKBENCH_DOC = "document"; // NODE_SOURCE properties -MAYBE_UNUSED const static char* SOURCE_FILE = "path"; +MAYBE_UNUSED const static char *SOURCE_FILE = "path"; // NODE_FEATURE properties -MAYBE_UNUSED const static char* FEATURE_TOOLTIP = "tooltip"; -MAYBE_UNUSED const static char* GROUP_TOOLBAR = "toolbar"; -MAYBE_UNUSED const static char* FEATURE_ICON = "icon"; -MAYBE_UNUSED const static char* FEATURE_TEXT = "title"; -MAYBE_UNUSED const static char* HELP_FILE = "helpfile"; -MAYBE_UNUSED const static char* ABORT_CONFIRMATION = "abort_confirmation"; -MAYBE_UNUSED const static char* HIDEFACES_PANEL = "hidefaces_panel"; -MAYBE_UNUSED const static char* FEATURE_KEYSEQUENCE = "keysequence"; -MAYBE_UNUSED const static char* FEATURE_NESTED = "nested"; -MAYBE_UNUSED const static char* FEATURE_WHEN_NESTED = "when_nested"; -MAYBE_UNUSED const static char* FEATURE_WHEN_NESTED_ACCEPT = "accept"; -MAYBE_UNUSED const static char* FEATURE_WHEN_NESTED_ABORT = "abort"; -MAYBE_UNUSED const static char* FEATURE_DOC = WORKBENCH_DOC; -MAYBE_UNUSED const static char* FEATURE_MODAL = "modal"; -MAYBE_UNUSED const static char* FEATURE_APPLY_CONTINUE = "apply_continue"; -MAYBE_UNUSED const static char* FEATURE_AUTO_PREVIEW = "auto_preview"; -MAYBE_UNUSED const static char* FEATURE_TITLE_IN_TOOLBAR = "titleInToolbar"; +MAYBE_UNUSED const static char *FEATURE_TOOLTIP = "tooltip"; +MAYBE_UNUSED const static char *GROUP_TOOLBAR = "toolbar"; +MAYBE_UNUSED const static char *FEATURE_ICON = "icon"; +MAYBE_UNUSED const static char *FEATURE_TEXT = "title"; +MAYBE_UNUSED const static char *HELP_FILE = "helpfile"; +MAYBE_UNUSED const static char *ABORT_CONFIRMATION = "abort_confirmation"; +MAYBE_UNUSED const static char *HIDEFACES_PANEL = "hidefaces_panel"; +MAYBE_UNUSED const static char *FEATURE_KEYSEQUENCE = "keysequence"; +MAYBE_UNUSED const static char *FEATURE_NESTED = "nested"; +MAYBE_UNUSED const static char *FEATURE_WHEN_NESTED = "when_nested"; +MAYBE_UNUSED const static char *FEATURE_WHEN_NESTED_ACCEPT = "accept"; +MAYBE_UNUSED const static char *FEATURE_WHEN_NESTED_ABORT = "abort"; +MAYBE_UNUSED const static char *FEATURE_DOC = WORKBENCH_DOC; +MAYBE_UNUSED const static char *FEATURE_MODAL = "modal"; +MAYBE_UNUSED const static char *FEATURE_APPLY_CONTINUE = "apply_continue"; +MAYBE_UNUSED const static char *FEATURE_AUTO_PREVIEW = "auto_preview"; +MAYBE_UNUSED const static char *FEATURE_TITLE_IN_TOOLBAR = "titleInToolbar"; // NODE_VALIDATOR properties -MAYBE_UNUSED const static char* _PARAMETERS = "parameters"; +MAYBE_UNUSED const static char *_PARAMETERS = "parameters"; // Widget (attribute) properties -MAYBE_UNUSED const static char* ATTR_TOOLTIP = FEATURE_TOOLTIP; -MAYBE_UNUSED const static char* ATTR_ICON = FEATURE_ICON; -MAYBE_UNUSED const static char* ATTR_LABEL = "label"; -MAYBE_UNUSED const static char* ATTR_STYLE_SHEET = "styleSheet"; -MAYBE_UNUSED const static char* ATTR_IS_SELECTABLE = "isSelectable"; -MAYBE_UNUSED const static char* ATTR_HTML_STYLE = "isHTML"; -MAYBE_UNUSED const static char* ATTR_DEFAULT = "default"; -MAYBE_UNUSED const static char* ATTR_INTERNAL = "internal"; -MAYBE_UNUSED const static char* ATTR_OBLIGATORY = "obligatory"; -MAYBE_UNUSED const static char* ATTR_CONCEALMENT = "concealment"; -MAYBE_UNUSED const static char* ATTR_USE_RESET = "use_reset"; -MAYBE_UNUSED const static char* ATTR_GREED = "greed"; -MAYBE_UNUSED const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit"; -MAYBE_UNUSED const static char* ATTR_MAIN_ARG = "main_argument"; -MAYBE_UNUSED const static char* ATTR_GEOMETRICAL_SELECTION = "geometrical_selection"; -MAYBE_UNUSED const static char* ATTR_VISUAL_CHANGED = "change_visual_attributes"; - +MAYBE_UNUSED const static char *ATTR_TOOLTIP = FEATURE_TOOLTIP; +MAYBE_UNUSED const static char *ATTR_ICON = FEATURE_ICON; +MAYBE_UNUSED const static char *ATTR_LABEL = "label"; +MAYBE_UNUSED const static char *ATTR_STYLE_SHEET = "styleSheet"; +MAYBE_UNUSED const static char *ATTR_IS_SELECTABLE = "isSelectable"; +MAYBE_UNUSED const static char *ATTR_HTML_STYLE = "isHTML"; +MAYBE_UNUSED const static char *ATTR_DEFAULT = "default"; +MAYBE_UNUSED const static char *ATTR_INTERNAL = "internal"; +MAYBE_UNUSED const static char *ATTR_OBLIGATORY = "obligatory"; +MAYBE_UNUSED const static char *ATTR_CONCEALMENT = "concealment"; +MAYBE_UNUSED const static char *ATTR_USE_RESET = "use_reset"; +MAYBE_UNUSED const static char *ATTR_GREED = "greed"; +MAYBE_UNUSED const static char *ATTR_MODIFIED_IN_EDIT = "modified_in_edit"; +MAYBE_UNUSED const static char *ATTR_MAIN_ARG = "main_argument"; +MAYBE_UNUSED const static char *ATTR_GEOMETRICAL_SELECTION = + "geometrical_selection"; +MAYBE_UNUSED const static char *ATTR_VISUAL_CHANGED = + "change_visual_attributes"; // WDG_INFO properties -MAYBE_UNUSED const static char* INFO_WDG_TEXT = FEATURE_TEXT; -MAYBE_UNUSED const static char* INFO_WDG_TOOLTIP = FEATURE_TOOLTIP; +MAYBE_UNUSED const static char *INFO_WDG_TEXT = FEATURE_TEXT; +MAYBE_UNUSED const static char *INFO_WDG_TOOLTIP = FEATURE_TOOLTIP; // WDG_DOUBLEVALUE properties: -MAYBE_UNUSED const static char* DOUBLE_WDG_MIN = "min"; -MAYBE_UNUSED const static char* DOUBLE_WDG_MAX = "max"; -MAYBE_UNUSED const static char* DOUBLE_WDG_STEP = "step"; -MAYBE_UNUSED const static char* DOUBLE_WDG_DEFAULT_COMPUTED = "computed"; -MAYBE_UNUSED const static char* DOUBLE_WDG_ACCEPT_EXPRESSIONS = "accept_expressions"; -MAYBE_UNUSED const static char* DOUBLE_WDG_ENABLE_VALUE = "enable_value"; +MAYBE_UNUSED const static char *DOUBLE_WDG_MIN = "min"; +MAYBE_UNUSED const static char *DOUBLE_WDG_MAX = "max"; +MAYBE_UNUSED const static char *DOUBLE_WDG_STEP = "step"; +MAYBE_UNUSED const static char *DOUBLE_WDG_DEFAULT_COMPUTED = "computed"; +MAYBE_UNUSED const static char *DOUBLE_WDG_ACCEPT_EXPRESSIONS = + "accept_expressions"; +MAYBE_UNUSED const static char *DOUBLE_WDG_ENABLE_VALUE = "enable_value"; -MAYBE_UNUSED const static char* DOUBLE_WDG_ENABLE_VALUE_BY_PREFERENCES = "enable_by_preferences"; +MAYBE_UNUSED const static char *DOUBLE_WDG_ENABLE_VALUE_BY_PREFERENCES = + "enable_by_preferences"; // WDG_TOOLBOX/WDG_SWITCH properties -MAYBE_UNUSED const static char* CONTAINER_PAGE_NAME = "title"; -MAYBE_UNUSED const static char* CONTAINER_PAGE_ICON = "icon"; +MAYBE_UNUSED const static char *CONTAINER_PAGE_NAME = "title"; +MAYBE_UNUSED const static char *CONTAINER_PAGE_ICON = "icon"; /* * Hardcoded xml entities of plugins.xml */ -MAYBE_UNUSED const static char* PLUGIN_FILE = "plugins.xml"; -MAYBE_UNUSED const static char* NODE_PLUGIN = "plugin"; -MAYBE_UNUSED const static char* NODE_PLUGINS = "plugins"; +MAYBE_UNUSED const static char *PLUGIN_FILE = "plugins.xml"; +MAYBE_UNUSED const static char *NODE_PLUGIN = "plugin"; +MAYBE_UNUSED const static char *NODE_PLUGINS = "plugins"; -MAYBE_UNUSED const static char* PLUGINS_MODULE = "module"; -MAYBE_UNUSED const static char* PLUGIN_CONFIG = "configuration"; -MAYBE_UNUSED const static char* PLUGIN_LIBRARY = "library"; -MAYBE_UNUSED const static char* PLUGIN_SCRIPT = "script"; -MAYBE_UNUSED const static char* PLUGIN_DEPENDENCY = "dependency"; -MAYBE_UNUSED const static char* PLUGIN_USES = "uses"; -MAYBE_UNUSED const static char* PLUGIN_DOCSECTION = "docsection"; -MAYBE_UNUSED const static char* PLUGIN_LICENSE = "license"; +MAYBE_UNUSED const static char *PLUGINS_MODULE = "module"; +MAYBE_UNUSED const static char *PLUGIN_CONFIG = "configuration"; +MAYBE_UNUSED const static char *PLUGIN_LIBRARY = "library"; +MAYBE_UNUSED const static char *PLUGIN_SCRIPT = "script"; +MAYBE_UNUSED const static char *PLUGIN_DEPENDENCY = "dependency"; +MAYBE_UNUSED const static char *PLUGIN_USES = "uses"; +MAYBE_UNUSED const static char *PLUGIN_DOCSECTION = "docsection"; +MAYBE_UNUSED const static char *PLUGIN_LICENSE = "license"; /* * Hardcoded xml entities of dataModel.xml */ -MAYBE_UNUSED const static char* DATAMODEL_FILE = "dataModel.xml"; -MAYBE_UNUSED const static char* NODE_FOLDER = "folder"; -MAYBE_UNUSED const static char* FOLDER_NAME = "name"; -MAYBE_UNUSED const static char* GROUP_TYPE = "group_type"; -MAYBE_UNUSED const static char* ROOT_DOCUMENT = "root_document"; -MAYBE_UNUSED const static char* SUB_DOCUMENT = "sub_document"; -MAYBE_UNUSED const static char* NODE_ICON = "icon"; -MAYBE_UNUSED const static char* SHOW_EMPTY = "show_empty"; -MAYBE_UNUSED const static char* LINK_ITEM = "from_result"; -MAYBE_UNUSED const static char* FOLDER_FEATURES = "folder_features"; +MAYBE_UNUSED const static char *DATAMODEL_FILE = "dataModel.xml"; +MAYBE_UNUSED const static char *NODE_FOLDER = "folder"; +MAYBE_UNUSED const static char *FOLDER_NAME = "name"; +MAYBE_UNUSED const static char *GROUP_TYPE = "group_type"; +MAYBE_UNUSED const static char *ROOT_DOCUMENT = "root_document"; +MAYBE_UNUSED const static char *SUB_DOCUMENT = "sub_document"; +MAYBE_UNUSED const static char *NODE_ICON = "icon"; +MAYBE_UNUSED const static char *SHOW_EMPTY = "show_empty"; +MAYBE_UNUSED const static char *LINK_ITEM = "from_result"; +MAYBE_UNUSED const static char *FOLDER_FEATURES = "folder_features"; #endif /* CONFIG_KEYWORDS_H_ */ diff --git a/src/Config/Config_ModuleReader.cpp b/src/Config/Config_ModuleReader.cpp index ef7073dea..0b81a8e85 100644 --- a/src/Config/Config_ModuleReader.cpp +++ b/src/Config/Config_ModuleReader.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include -#include #include +#include +#include #include #include @@ -33,9 +34,9 @@ #include #include -//Necessary for cerr -#include +// Necessary for cerr #include +#include #ifdef WIN32 #include @@ -44,36 +45,30 @@ #include #endif -std::map Config_ModuleReader::myPluginTypes; +std::map + Config_ModuleReader::myPluginTypes; std::set Config_ModuleReader::myDependencyModules; -Config_ModuleReader::Config_ModuleReader(const char* theEventGenerated) - : Config_XMLReader(PLUGIN_FILE), - myEventGenerated(theEventGenerated) -{ -} +Config_ModuleReader::Config_ModuleReader(const char *theEventGenerated) + : Config_XMLReader(PLUGIN_FILE), myEventGenerated(theEventGenerated) {} -Config_ModuleReader::~Config_ModuleReader() -{ -} +Config_ModuleReader::~Config_ModuleReader() {} -const std::map& Config_ModuleReader::featuresInFiles() const -{ +const std::map & +Config_ModuleReader::featuresInFiles() const { return myFeaturesInFiles; } -const std::map& Config_ModuleReader::proprietaryFeatures() const -{ +const std::map & +Config_ModuleReader::proprietaryFeatures() const { return myProprietaryFeatures; } -const std::set& Config_ModuleReader::proprietaryPlugins() const -{ +const std::set &Config_ModuleReader::proprietaryPlugins() const { return myProprietaryPlugins; } -const std::set& Config_ModuleReader::modulePluginFiles() const -{ +const std::set &Config_ModuleReader::modulePluginFiles() const { return myPluginFiles; } @@ -81,48 +76,47 @@ const std::set& Config_ModuleReader::modulePluginFiles() const * Get module name from plugins.xml * (property "module") */ -std::string Config_ModuleReader::getModuleName() -{ +std::string Config_ModuleReader::getModuleName() { xmlNodePtr aRoot = findRoot(); return getProperty(aRoot, PLUGINS_MODULE); } - -void Config_ModuleReader::addFeature(const std::string& theFeatureName, - const std::string& thePluginConfig) -{ +void Config_ModuleReader::addFeature(const std::string &theFeatureName, + const std::string &thePluginConfig) { if (myProprietaryFeatures.count(theFeatureName)) { myProprietaryFeatures.erase(theFeatureName); } if (myFeaturesInFiles.count(theFeatureName)) { std::string anErrorMsg = "Can not register feature '%1' in plugin '%2'." - " There is a feature with the same ID."; + " There is a feature with the same ID."; Events_InfoMessage("Config_ModuleReader", anErrorMsg) - .arg(theFeatureName).arg(thePluginConfig).send(); + .arg(theFeatureName) + .arg(thePluginConfig) + .send(); return; } myFeaturesInFiles[theFeatureName] = thePluginConfig; } -void Config_ModuleReader::addFeatureRequireLicense(const std::string& theFeatureName, - const std::string& thePluginConfig) -{ +void Config_ModuleReader::addFeatureRequireLicense( + const std::string &theFeatureName, const std::string &thePluginConfig) { if (myFeaturesInFiles.count(theFeatureName) || myProprietaryFeatures.count(theFeatureName)) { std::string anErrorMsg = "Can not register feature '%1' in plugin '%2'." - " There is a feature with the same ID."; + " There is a feature with the same ID."; Events_InfoMessage("Config_ModuleReader", anErrorMsg) - .arg(theFeatureName).arg(thePluginConfig).send(); + .arg(theFeatureName) + .arg(thePluginConfig) + .send(); return; } myProprietaryFeatures[theFeatureName] = thePluginConfig; } -void Config_ModuleReader::processNode(xmlNodePtr theNode) -{ +void Config_ModuleReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_PLUGIN, NULL)) { if (!hasRequiredModules(theNode)) return; @@ -131,23 +125,28 @@ void Config_ModuleReader::processNode(xmlNodePtr theNode) myPluginFiles.insert(aPluginConf); std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY); std::string aPluginScript = getProperty(theNode, PLUGIN_SCRIPT); - std::string aPluginName = addPlugin(aPluginLibrary, aPluginScript, aPluginConf); + std::string aPluginName = + addPlugin(aPluginLibrary, aPluginScript, aPluginConf); std::string aPluginDocSection = getProperty(theNode, PLUGIN_DOCSECTION); std::string aUsesPlugin = getProperty(theNode, PLUGIN_USES); - if (!aUsesPlugin.empty()) { // send information about the plugin dependencies + if (!aUsesPlugin + .empty()) { // send information about the plugin dependencies std::shared_ptr aMess(new Config_PluginMessage( - Events_Loop::loop()->eventByName(Config_PluginMessage::EVENT_ID()), aPluginName)); + Events_Loop::loop()->eventByName(Config_PluginMessage::EVENT_ID()), + aPluginName)); aMess->setUses(aUsesPlugin); Events_Loop::loop()->send(aMess); } std::string aLicense = getProperty(theNode, PLUGIN_LICENSE); - std::transform(aLicense.begin(), aLicense.end(), aLicense.begin(), ::tolower); + std::transform(aLicense.begin(), aLicense.end(), aLicense.begin(), + ::tolower); bool isLicensed = aLicense == "true"; if (isLicensed) myProprietaryPlugins.insert(aPluginName); - std::list aFeatures = importPlugin(aPluginName, aPluginConf, aPluginDocSection); + std::list aFeatures = + importPlugin(aPluginName, aPluginConf, aPluginDocSection); std::list::iterator it = aFeatures.begin(); for (; it != aFeatures.end(); it++) { if (isLicensed) @@ -158,44 +157,42 @@ void Config_ModuleReader::processNode(xmlNodePtr theNode) } } -bool Config_ModuleReader::processChildren(xmlNodePtr theNode) -{ +bool Config_ModuleReader::processChildren(xmlNodePtr theNode) { return isNode(theNode, NODE_PLUGINS, NULL); } -bool Config_ModuleReader::hasRequiredModules(xmlNodePtr theNode) const -{ - std::string aRequiredModule = normalize(getProperty(theNode, PLUGIN_DEPENDENCY)); - if(aRequiredModule.empty()) +bool Config_ModuleReader::hasRequiredModules(xmlNodePtr theNode) const { + std::string aRequiredModule = + normalize(getProperty(theNode, PLUGIN_DEPENDENCY)); + if (aRequiredModule.empty()) return true; std::set::iterator it = myDependencyModules.begin(); - for ( ; it != myDependencyModules.end(); it++ ) { - if (*it == aRequiredModule) return true; + for (; it != myDependencyModules.end(); it++) { + if (*it == aRequiredModule) + return true; } return false; } -std::list Config_ModuleReader::importPlugin(const std::string& thePluginLibrary, - const std::string& thePluginXmlConf, - const std::string& thePluginDocSection) -{ - if (thePluginXmlConf.empty()) { //probably a third party library +std::list +Config_ModuleReader::importPlugin(const std::string &thePluginLibrary, + const std::string &thePluginXmlConf, + const std::string &thePluginDocSection) { + if (thePluginXmlConf.empty()) { // probably a third party library loadLibrary(thePluginLibrary); return std::list(); } - Config_FeatureReader aReader = Config_FeatureReader(thePluginXmlConf, - thePluginLibrary, - thePluginDocSection, - myEventGenerated); + Config_FeatureReader aReader = + Config_FeatureReader(thePluginXmlConf, thePluginLibrary, + thePluginDocSection, myEventGenerated); aReader.readAll(); return aReader.features(); } -std::string Config_ModuleReader::addPlugin(const std::string& aPluginLibrary, - const std::string& aPluginScript, - const std::string& aPluginConf) -{ +std::string Config_ModuleReader::addPlugin(const std::string &aPluginLibrary, + const std::string &aPluginScript, + const std::string &aPluginConf) { PluginType aType = Config_ModuleReader::Binary; std::string aPluginName; if (!aPluginLibrary.empty()) { @@ -207,90 +204,78 @@ std::string Config_ModuleReader::addPlugin(const std::string& aPluginLibrary, aPluginName = aPluginScript; aType = Config_ModuleReader::Python; } - if(!aPluginName.empty()) { + if (!aPluginName.empty()) { myPluginTypes[aPluginName] = aType; } addDependencyModule(aPluginName); return aPluginName; } -void Config_ModuleReader::loadPlugin(const std::string& thePluginName) -{ +void Config_ModuleReader::loadPlugin(const std::string &thePluginName) { // informs model that plugin loading is started static const Events_ID kEVENT_ID = - Events_Loop::loop()->eventByName(Config_PluginMessage::EVENT_ID()); - std::shared_ptr aMess(new Config_PluginMessage(kEVENT_ID, thePluginName)); + Events_Loop::loop()->eventByName(Config_PluginMessage::EVENT_ID()); + std::shared_ptr aMess( + new Config_PluginMessage(kEVENT_ID, thePluginName)); Events_Loop::loop()->send(aMess); PluginType aType = Config_ModuleReader::Binary; - if(myPluginTypes.find(thePluginName) != myPluginTypes.end()) { + if (myPluginTypes.find(thePluginName) != myPluginTypes.end()) { aType = myPluginTypes.at(thePluginName); } switch (aType) { - case Config_ModuleReader::Python: - loadScript(thePluginName); - break; - case Config_ModuleReader::Binary: - case Config_ModuleReader::Intrenal: - default: - loadLibrary(thePluginName); - break; + case Config_ModuleReader::Python: + loadScript(thePluginName); + break; + case Config_ModuleReader::Binary: + case Config_ModuleReader::Intrenal: + default: + loadLibrary(thePluginName); + break; } } -namespace -{ - // Handle Python exception - // Reuse code from KERNEL module - typedef struct - { - PyObject_HEAD - int softspace; - std::string *out; - } PyStdOut; - - static void - PyStdOut_dealloc(PyStdOut *self) - { - PyObject_Del(self); - } +namespace { +// Handle Python exception +// Reuse code from KERNEL module +typedef struct { + PyObject_HEAD int softspace; + std::string *out; +} PyStdOut; - static PyObject* - PyStdOut_write(PyStdOut* self, PyObject* args) - { - char *c; - if (!PyArg_ParseTuple(args, "s", &c)) - return NULL; +static void PyStdOut_dealloc(PyStdOut *self) { PyObject_Del(self); } - *(self->out) = *(self->out) + c; +static PyObject *PyStdOut_write(PyStdOut *self, PyObject *args) { + char *c; + if (!PyArg_ParseTuple(args, "s", &c)) + return NULL; - Py_INCREF(Py_None); - return Py_None; - } + *(self->out) = *(self->out) + c; + + Py_INCREF(Py_None); + return Py_None; +} - static PyMethodDef PyStdOut_methods[] = - { - {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, - PyDoc_STR("write(string) -> None")}, - {0, 0, 0, 0} /* sentinel */ - }; - - static PyMemberDef PyStdOut_memberlist[] = - { - {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0, - (char*)"flag indicating that a space needs to be printed; used by print"}, - {0, 0, 0, 0, 0} /* sentinel */ - }; - - static PyTypeObject PyStdOut_Type = - { +static PyMethodDef PyStdOut_methods[] = { + {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, + PyDoc_STR("write(string) -> None")}, + {0, 0, 0, 0} /* sentinel */ +}; + +static PyMemberDef PyStdOut_memberlist[] = { + {(char *)"softspace", T_INT, offsetof(PyStdOut, softspace), 0, + (char *)"flag indicating that a space needs to be printed; used by print"}, + {0, 0, 0, 0, 0} /* sentinel */ +}; + +static PyTypeObject PyStdOut_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ PyVarObject_HEAD_INIT(NULL, 0) - /* 0, */ /*ob_size*/ - "PyOut", /*tp_name*/ - sizeof(PyStdOut), /*tp_basicsize*/ - 0, /*tp_itemsize*/ + /* 0, */ /*ob_size*/ + "PyOut", /*tp_name*/ + sizeof(PyStdOut), /*tp_basicsize*/ + 0, /*tp_itemsize*/ /* methods */ (destructor)PyStdOut_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ @@ -306,72 +291,69 @@ namespace 0, /*tp_str*/ PyObject_GenericGetAttr, /*tp_getattro*/ /* softspace is writable: we must supply tp_setattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - PyStdOut_methods, /*tp_methods*/ - PyStdOut_memberlist, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - 0, /*tp_finalize*/ - }; - - PyObject* newPyStdOut(std::string& out) - { - PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type); - if (self) { - self->softspace = 0; - self->out=&out; - } - return (PyObject*)self; + PyObject_GenericSetAttr, /* tp_setattro */ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + PyStdOut_methods, /*tp_methods*/ + PyStdOut_memberlist, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + 0, /*tp_finalize*/ +}; + +PyObject *newPyStdOut(std::string &out) { + PyStdOut *self = PyObject_New(PyStdOut, &PyStdOut_Type); + if (self) { + self->softspace = 0; + self->out = &out; } + return (PyObject *)self; +} - std::string parseException() - { - std::string error; - if (PyErr_Occurred()) - { - PyObject* new_stderr = newPyStdOut(error); - PyObject* old_stderr = PySys_GetObject((char*)"stderr"); - Py_INCREF(old_stderr); - PySys_SetObject((char*)"stderr", new_stderr); - PyErr_Print(); - PySys_SetObject((char*)"stderr", old_stderr); - Py_DECREF(new_stderr); - } - return error; +std::string parseException() { + std::string error; + if (PyErr_Occurred()) { + PyObject *new_stderr = newPyStdOut(error); + PyObject *old_stderr = PySys_GetObject((char *)"stderr"); + Py_INCREF(old_stderr); + PySys_SetObject((char *)"stderr", new_stderr); + PyErr_Print(); + PySys_SetObject((char *)"stderr", old_stderr); + Py_DECREF(new_stderr); } + return error; } +} // namespace -void Config_ModuleReader::loadScript(const std::string& theFileName, bool theSendErr) -{ +void Config_ModuleReader::loadScript(const std::string &theFileName, + bool theSendErr) { /* acquire python thread */ PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject* module = PyImport_ImportModule(theFileName.c_str()); + PyObject *module = PyImport_ImportModule(theFileName.c_str()); if (!module) { std::string anErrorMsg = "An error occurred while importing " + theFileName; // Get detailed error message (including traceback) @@ -388,42 +370,38 @@ void Config_ModuleReader::loadScript(const std::string& theFileName, bool theSen PyGILState_Release(gstate); } -void Config_ModuleReader::loadLibrary(const std::string& theLibName) -{ +void Config_ModuleReader::loadLibrary(const std::string &theLibName) { std::string aFileName = library(theLibName); if (aFileName.empty()) return; - #ifdef WIN32 +#ifdef WIN32 HINSTANCE aModLib = ::LoadLibraryA(aFileName.c_str()); - #else - void* aModLib = dlopen( aFileName.c_str(), RTLD_LAZY | RTLD_GLOBAL ); - #endif - if(!aModLib && theLibName != "DFBrowser") { // don't show error for internal debugging tool -// LCOV_EXCL_START +#else + void *aModLib = dlopen(aFileName.c_str(), RTLD_LAZY | RTLD_GLOBAL); +#endif + if (!aModLib && theLibName != "DFBrowser") { // don't show error for internal + // debugging tool LCOV_EXCL_START std::string anErrorMsg = "Failed to load " + aFileName; - #ifdef WIN32 - DWORD dwLastError = ::GetLastError(); +#ifdef WIN32 + DWORD dwLastError = ::GetLastError(); LPSTR messageBuffer = NULL; - size_t size = ::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dwLastError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)&messageBuffer, 0, NULL); - anErrorMsg += ": " + std::string(messageBuffer, size); - #else + size_t size = ::FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, dwLastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&messageBuffer, 0, NULL); + anErrorMsg += ": " + std::string(messageBuffer, size); +#else anErrorMsg += ": " + std::string(dlerror()); - #endif +#endif std::cerr << anErrorMsg << std::endl; Events_InfoMessage("Config_ModuleReader", anErrorMsg).send(); -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } } -void Config_ModuleReader::addDependencyModule(const std::string& theModuleName) -{ +void Config_ModuleReader::addDependencyModule( + const std::string &theModuleName) { myDependencyModules.insert(normalize(theModuleName)); } - diff --git a/src/Config/Config_ModuleReader.h b/src/Config/Config_ModuleReader.h index 9b08fe1e2..09a7a079a 100644 --- a/src/Config/Config_ModuleReader.h +++ b/src/Config/Config_ModuleReader.h @@ -14,67 +14,70 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_MODULEREADER_H_ #define CONFIG_MODULEREADER_H_ -#include #include +#include -#include #include +#include #include #include /*! * \class Config_ModuleReader * \ingroup Config - * \brief Class to process plugins.xml - definition of plugins (scripts, libraries). + * \brief Class to process plugins.xml - definition of plugins (scripts, + * libraries). */ -class Config_ModuleReader : public Config_XMLReader -{ - enum PluginType { - Binary = 0, - Intrenal = 1, - Python = 2 - }; +class Config_ModuleReader : public Config_XMLReader { + enum PluginType { Binary = 0, Intrenal = 1, Python = 2 }; - public: +public: /// Constructor - CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0); + CONFIG_EXPORT Config_ModuleReader(const char *theEventGenerated = 0); /// Destructor CONFIG_EXPORT virtual ~Config_ModuleReader(); /// Returns map that describes which file contains a feature /// (the feature is key, the file is value) - CONFIG_EXPORT const std::map& featuresInFiles() const; + CONFIG_EXPORT const std::map & + featuresInFiles() const; /// Returns map containing features, which have licensed. /// The valid license should be confirmed first /// (the feature is key, the file is value) - CONFIG_EXPORT const std::map& proprietaryFeatures() const; + CONFIG_EXPORT const std::map & + proprietaryFeatures() const; /// Returns proprietary plugins - CONFIG_EXPORT const std::set& proprietaryPlugins() const; + CONFIG_EXPORT const std::set &proprietaryPlugins() const; /// Returns list of module's xml files - CONFIG_EXPORT const std::set& modulePluginFiles() const; + CONFIG_EXPORT const std::set &modulePluginFiles() const; /// Returns module name: an xml attribute from the root of the plugins.xml: /// e.g \code \endcode CONFIG_EXPORT std::string getModuleName(); - /// Detects type of the given plugin and loads it using loadLibrary or loadScript. - CONFIG_EXPORT static void loadPlugin(const std::string& thePluginName); - /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform - CONFIG_EXPORT static void loadLibrary(const std::string& theLibName); + /// Detects type of the given plugin and loads it using loadLibrary or + /// loadScript. + CONFIG_EXPORT static void loadPlugin(const std::string &thePluginName); + /// loads the library with specific name, appends "lib*.dll" or "*.so" + /// depending on the platform + CONFIG_EXPORT static void loadLibrary(const std::string &theLibName); /// loads the python module with specified name /// \param theFileName name of the script /// \param theSendErr send error message in case of faile - CONFIG_EXPORT static void loadScript(const std::string& theFileName, bool theSendErr = true); + CONFIG_EXPORT static void loadScript(const std::string &theFileName, + bool theSendErr = true); /*! * Extends set of modules, used for dependency checking (if there is no * required module in the set, a plugin will not be loaded) */ - CONFIG_EXPORT static void addDependencyModule(const std::string& theModuleName); + CONFIG_EXPORT static void + addDependencyModule(const std::string &theModuleName); - protected: +protected: /// Recursively process the given xmlNode virtual void processNode(xmlNodePtr aNode); /// Defines if the reader should process children of the given node @@ -82,32 +85,37 @@ class Config_ModuleReader : public Config_XMLReader /// check if dependencies of the given node are in the list of loaded modules bool hasRequiredModules(xmlNodePtr aNode) const; /// reads info about plugin's features from plugin xml description - std::list importPlugin(const std::string& thePluginLibrary, - const std::string& thePluginFile, - const std::string& thePluginDocSection); + std::list importPlugin(const std::string &thePluginLibrary, + const std::string &thePluginFile, + const std::string &thePluginDocSection); /// stores information about plugin in the internal cache - std::string addPlugin(const std::string& aPluginLibrary, - const std::string& aPluginScript, - const std::string& aPluginConf); + std::string addPlugin(const std::string &aPluginLibrary, + const std::string &aPluginScript, + const std::string &aPluginConf); /// Save feature in myFeaturesInFiles. /// Generates an error if the feature name is already registered. - void addFeature(const std::string& theFeatureName, const std::string& thePluginConfig); + void addFeature(const std::string &theFeatureName, + const std::string &thePluginConfig); /// Save feature in myFeaturesRequireLicense. /// Generates an error if the feature name is already registered. - void addFeatureRequireLicense(const std::string& theFeatureName, - const std::string& thePluginConfig); + void addFeatureRequireLicense(const std::string &theFeatureName, + const std::string &thePluginConfig); - private: - std::map myFeaturesInFiles; ///< a feature name is key, a file is value +private: + std::map + myFeaturesInFiles; ///< a feature name is key, a file is value /// list of features, which need a license, and their config files std::map myProprietaryFeatures; - std::set myPluginFiles; ///< a feature name is key, a file is value + std::set + myPluginFiles; ///< a feature name is key, a file is value /// a plugin name is key, a plugin type is value static std::map myPluginTypes; static std::set myDependencyModules; ///< set of loaded modules - const char* myEventGenerated; ///< gives ability to send Feature_Messages to various listeners + const char *myEventGenerated; ///< gives ability to send Feature_Messages to + ///< various listeners - std::set myProprietaryPlugins; ///< list of plugins protected by license + std::set + myProprietaryPlugins; ///< list of plugins protected by license }; #endif /* CONFIG_XMLMODULEREADER_H_ */ diff --git a/src/Config/Config_PluginMessage.cpp b/src/Config/Config_PluginMessage.cpp index c5c9241b3..1469c313a 100644 --- a/src/Config/Config_PluginMessage.cpp +++ b/src/Config/Config_PluginMessage.cpp @@ -14,34 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_PluginMessage.h" Config_PluginMessage::Config_PluginMessage(const Events_ID theId, - const std::string& thePluginId, const void* theParent) - : Events_Message(theId, theParent) -{ + const std::string &thePluginId, + const void *theParent) + : Events_Message(theId, theParent) { myPluginId = thePluginId; } -Config_PluginMessage::~Config_PluginMessage() -{ +Config_PluginMessage::~Config_PluginMessage() {} -} - -const std::string& Config_PluginMessage::pluginId() const -{ - return myPluginId; -} +const std::string &Config_PluginMessage::pluginId() const { return myPluginId; } -const std::string& Config_PluginMessage::uses() const -{ - return myUses; -} +const std::string &Config_PluginMessage::uses() const { return myUses; } -void Config_PluginMessage::setUses(const std::string& theUses) -{ +void Config_PluginMessage::setUses(const std::string &theUses) { myUses = theUses; } diff --git a/src/Config/Config_PluginMessage.h b/src/Config/Config_PluginMessage.h index 08af39492..f17faf72b 100644 --- a/src/Config/Config_PluginMessage.h +++ b/src/Config/Config_PluginMessage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_PLUGINMESSAGE_H @@ -33,31 +34,30 @@ * Contains the plugin name. Event is posted just before load of the plugin * before registerPlugin call. */ -class Config_PluginMessage : public Events_Message -{ - std::string myPluginId; ///< Plugin unique id - std::string myUses; ///< Which plugins are used by this one Id +class Config_PluginMessage : public Events_Message { + std::string myPluginId; ///< Plugin unique id + std::string myUses; ///< Which plugins are used by this one Id - public: +public: /// Event ID that plugin will be loaded - inline static const char* EVENT_ID() - { - static const char * MY_EVENT_ID("BeforePluginLoad"); + inline static const char *EVENT_ID() { + static const char *MY_EVENT_ID("BeforePluginLoad"); return MY_EVENT_ID; } /// Constructs Config_PluginMessage CONFIG_EXPORT Config_PluginMessage(const Events_ID theId, - const std::string& thePluginId, const void* theParent = 0); + const std::string &thePluginId, + const void *theParent = 0); /// Deletes Config_PluginMessage CONFIG_EXPORT virtual ~Config_PluginMessage(); /// Plugin Id - CONFIG_EXPORT const std::string& pluginId() const; + CONFIG_EXPORT const std::string &pluginId() const; /// Which plugins are used by this one Id - CONFIG_EXPORT const std::string& uses() const; + CONFIG_EXPORT const std::string &uses() const; /// Sets which plugins are used by this one Id - CONFIG_EXPORT void setUses(const std::string& theUses); + CONFIG_EXPORT void setUses(const std::string &theUses); }; #endif // CONFIG_MESSAGE_H diff --git a/src/Config/Config_PointerMessage.cpp b/src/Config/Config_PointerMessage.cpp index b296fc263..f3152ee7e 100644 --- a/src/Config/Config_PointerMessage.cpp +++ b/src/Config/Config_PointerMessage.cpp @@ -14,31 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include // LCOV_EXCL_START -Config_PointerMessage::Config_PointerMessage(const Events_ID theId, const void* theParent) - : Events_Message(theId, theParent), - myPointer(0) -{ +Config_PointerMessage::Config_PointerMessage(const Events_ID theId, + const void *theParent) + : Events_Message(theId, theParent), myPointer(0) {} -} +Config_PointerMessage::~Config_PointerMessage() {} -Config_PointerMessage::~Config_PointerMessage() -{ +void *Config_PointerMessage::pointer() const { return myPointer; } -} - -void* Config_PointerMessage::pointer() const -{ - return myPointer; -} - -void Config_PointerMessage::setPointer(void* pointer) -{ - myPointer = pointer; -} +void Config_PointerMessage::setPointer(void *pointer) { myPointer = pointer; } // LCOV_EXCL_STOP diff --git a/src/Config/Config_PointerMessage.h b/src/Config/Config_PointerMessage.h index 4e5afb2e5..5c512d331 100644 --- a/src/Config/Config_PointerMessage.h +++ b/src/Config/Config_PointerMessage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARTSET_MESSAGE_H_ @@ -28,20 +29,19 @@ * \ingroup Config * \brief A general class to pass pointers over the event loop. */ -class CONFIG_EXPORT Config_PointerMessage : public Events_Message -{ - public: +class CONFIG_EXPORT Config_PointerMessage : public Events_Message { +public: /// Constructor - Config_PointerMessage(const Events_ID theId, const void* theParent = 0); + Config_PointerMessage(const Events_ID theId, const void *theParent = 0); virtual ~Config_PointerMessage(); /// Returns pointer to an object - void* pointer() const; + void *pointer() const; /// Sets pointer to an object - void setPointer(void* pointer); + void setPointer(void *pointer); - private: - void* myPointer; ///< Pointer to an object +private: + void *myPointer; ///< Pointer to an object }; #endif /* PARTSET_MESSAGE_H_ */ diff --git a/src/Config/Config_Prop.cpp b/src/Config/Config_Prop.cpp index e465c430b..625e52735 100644 --- a/src/Config/Config_Prop.cpp +++ b/src/Config/Config_Prop.cpp @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_Prop.h" #include "Events_Loop.h" #include "Events_Message.h" -void Config_Prop::setValue(const std::string& theValue) -{ +void Config_Prop::setValue(const std::string &theValue) { if (theValue != myValue) { myValue = theValue; - static const Events_ID aChangedEvent = Events_Loop::loop()->eventByName("PreferenceChanged"); + static const Events_ID aChangedEvent = + Events_Loop::loop()->eventByName("PreferenceChanged"); Events_Loop::loop()->send(std::shared_ptr( - new Events_Message(aChangedEvent, this))); + new Events_Message(aChangedEvent, this))); } } -void Config_Prop::setDefaultValue(const std::string& theValue) -{ +void Config_Prop::setDefaultValue(const std::string &theValue) { if (theValue != myDefaultValue) { myDefaultValue = theValue; } diff --git a/src/Config/Config_Prop.h b/src/Config/Config_Prop.h index 214fad1dd..d7eb4b977 100644 --- a/src/Config/Config_Prop.h +++ b/src/Config/Config_Prop.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_PROP_H @@ -22,8 +23,8 @@ #include "Config_def.h" -#include #include +#include static const char SKETCH_TAB_NAME[] = "Sketch"; @@ -32,13 +33,10 @@ static const char SKETCH_TAB_NAME[] = "Sketch"; * \brief Class which describes a one property * \ingroup Config */ -class Config_Prop -{ - public: - +class Config_Prop { +public: /// Type of stored property - enum PropType - { + enum PropType { Disabled, Space, Boolean, @@ -64,26 +62,21 @@ class Config_Prop Cursor }; - enum CursorType - { - ArrowCursor, - CrossCursor, - HandCursor - }; + enum CursorType { ArrowCursor, CrossCursor, HandCursor }; - /** + /** * Creates a one property * \param theSection - name of section (domain of using) of the property. * \param theName - name (title) of the value. * \param theTitle - title of the value * \param theType - type of the value. - * \param theDefaultValue - default value of the property. This is an initial property value + * \param theDefaultValue - default value of the property. This is an initial + * property value */ - Config_Prop(const std::string& theSection, const std::string& theName, - const std::string& theTitle, PropType theType, - const std::string& theDefaultValue, - const std::string& theMin, const std::string& theMax) - { + Config_Prop(const std::string &theSection, const std::string &theName, + const std::string &theTitle, PropType theType, + const std::string &theDefaultValue, const std::string &theMin, + const std::string &theMax) { mySection = theSection; myName = theName; myTitle = theTitle; @@ -95,80 +88,51 @@ class Config_Prop } /// Get name of section - std::string section() const - { - return mySection; - } + std::string section() const { return mySection; } /// Get name of property - std::string name() const - { - return myName; - } + std::string name() const { return myName; } /// Get title of property - std::string title() const - { - return myTitle; - } + std::string title() const { return myTitle; } /// Set title of property - void setTitle(const std::string& theTitle) - { - myTitle = theTitle; - } + void setTitle(const std::string &theTitle) { myTitle = theTitle; } /// Get type of property - PropType type() const - { - return myType; - } + PropType type() const { return myType; } /// Set type of property - void setType(PropType theType) - { - myType = theType; - } + void setType(PropType theType) { myType = theType; } /// Get property's value in string format - std::string value() const - { - return myValue; - } + std::string value() const { return myValue; } /// Set property's value in string format - CONFIG_EXPORT void setValue(const std::string& theValue); + CONFIG_EXPORT void setValue(const std::string &theValue); /// Get default value of property - std::string defaultValue() const - { - return myDefaultValue; - } + std::string defaultValue() const { return myDefaultValue; } /// Set default value of property - CONFIG_EXPORT void setDefaultValue(const std::string& theValue); + CONFIG_EXPORT void setDefaultValue(const std::string &theValue); /// Alows to compare Config_Prop with each other - bool operator==(const Config_Prop* theProp) const - { + bool operator==(const Config_Prop *theProp) const { return (mySection == theProp->section()) && (myName == theProp->name()); } /// Returns minimal value std::string min() const { return myMin; } - void setMin(const std::string& theMin) { - myMin = theMin; - } + void setMin(const std::string &theMin) { myMin = theMin; } /// Returns maximal value std::string max() const { return myMax; } - void setMax(const std::string& theMax) { - myMax = theMax; - } + void setMax(const std::string &theMax) { myMax = theMax; } - private: - std::string mySection; ///< Name of section - std::string myName; ///< Name of property - std::string myTitle; ///< Title of property - PropType myType; ///< Type of property - std::string myValue; // Value in string format +private: + std::string mySection; ///< Name of section + std::string myName; ///< Name of property + std::string myTitle; ///< Title of property + PropType myType; ///< Type of property + std::string myValue; // Value in string format std::string myDefaultValue; // Default value - std::string myMin; // Minimal value - std::string myMax; // Maximal value + std::string myMin; // Minimal value + std::string myMax; // Maximal value }; -typedef std::list Config_Properties; +typedef std::list Config_Properties; #endif diff --git a/src/Config/Config_PropManager.cpp b/src/Config/Config_PropManager.cpp index 480c1cdae..fb320c559 100644 --- a/src/Config/Config_PropManager.cpp +++ b/src/Config/Config_PropManager.cpp @@ -14,41 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_PropManager.h" bool Config_PropManager::autoColorStatus = false; -std::vector stringToRGB(const std::string& theColor); -int stringToInteger(const std::string& theInt); -bool stringToBoolean(const std::string& theInt); +std::vector stringToRGB(const std::string &theColor); +int stringToInteger(const std::string &theInt); +bool stringToBoolean(const std::string &theInt); -Config_Properties& Config_PropManager::props() { - static Config_Properties* confProps = new Config_Properties(); +Config_Properties &Config_PropManager::props() { + static Config_Properties *confProps = new Config_Properties(); return *confProps; } -bool Config_PropManager::getAutoColorStatus() -{ - return Config_PropManager::autoColorStatus; +bool Config_PropManager::getAutoColorStatus() { + return Config_PropManager::autoColorStatus; } -void Config_PropManager::setAutoColorStatus(const bool theValue) -{ - Config_PropManager::autoColorStatus = theValue; +void Config_PropManager::setAutoColorStatus(const bool theValue) { + Config_PropManager::autoColorStatus = theValue; } -Config_Prop* Config_PropManager::registerProp(const std::string& theSection, - const std::string& theName, - const std::string& theTitle, - Config_Prop::PropType theType, - const std::string& theDefaultValue, - const std::string& theMin, - const std::string& theMax) -{ - Config_Prop* aProp = findProp(theSection, theName); +Config_Prop *Config_PropManager::registerProp( + const std::string &theSection, const std::string &theName, + const std::string &theTitle, Config_Prop::PropType theType, + const std::string &theDefaultValue, const std::string &theMin, + const std::string &theMax) { + Config_Prop *aProp = findProp(theSection, theName); if (aProp) { if (aProp->value() == "") { @@ -65,48 +61,45 @@ Config_Prop* Config_PropManager::registerProp(const std::string& theSection, aProp->setMin(theMin); if (theMax != "") aProp->setMax(theMax); - } - else { - aProp = - new Config_Prop(theSection, theName, theTitle, theType, theDefaultValue, theMin, theMax); + } else { + aProp = new Config_Prop(theSection, theName, theTitle, theType, + theDefaultValue, theMin, theMax); props().push_back(aProp); } return aProp; } -Config_Prop* Config_PropManager::findProp(const std::string& theSection, const std::string& theName) -{ +Config_Prop *Config_PropManager::findProp(const std::string &theSection, + const std::string &theName) { Config_Properties::const_iterator aIt; Config_Properties aProps = props(); for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); if ((aProp->section() == theSection) && (aProp->name() == theName)) return aProp; } return NULL; } -Config_Properties Config_PropManager::getProperties() -{ +Config_Properties Config_PropManager::getProperties() { Config_Properties aRes; Config_Properties::const_iterator aIt; Config_Properties aProps = props(); for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); if (aProp->type() != Config_Prop::Disabled) aRes.push_back(aProp); } return aRes; } -std::list Config_PropManager::getSections() -{ +std::list Config_PropManager::getSections() { // Return only non disabled sections std::list aSections; Config_Properties::const_iterator aIt; Config_Properties aProps = props(); for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) { - const Config_Prop* aProp = (*aIt); + const Config_Prop *aProp = (*aIt); if (aProp->type() != Config_Prop::Disabled) aSections.push_back(aProp->section()); } @@ -114,65 +107,64 @@ std::list Config_PropManager::getSections() return aSections; } -Config_Properties Config_PropManager::getProperties(const std::string& theSection) -{ +Config_Properties +Config_PropManager::getProperties(const std::string &theSection) { Config_Properties aRes; Config_Properties::iterator aIt; Config_Properties aProps = props(); for (aIt = aProps.begin(); aIt != aProps.end(); aIt++) { - Config_Prop* aProp = (*aIt); - if ((aProp->section() == theSection) && (aProp->type() != Config_Prop::Disabled)) + Config_Prop *aProp = (*aIt); + if ((aProp->section() == theSection) && + (aProp->type() != Config_Prop::Disabled)) aRes.push_back(aProp); } return aRes; } -std::string Config_PropManager::string(const std::string& theSection, const std::string& theName) -{ +std::string Config_PropManager::string(const std::string &theSection, + const std::string &theName) { Config_Properties aProps = getProperties(theSection); Config_Properties::const_iterator aIt; for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); if (aProp->name() == theName) return aProp->value(); } - std::string aMsg = "Property " + theSection + ":" + theName + " is not registered"; + std::string aMsg = + "Property " + theSection + ":" + theName + " is not registered"; throw aMsg.c_str(); } -std::vector Config_PropManager::color(const std::string& theSection, - const std::string& theName) -{ +std::vector Config_PropManager::color(const std::string &theSection, + const std::string &theName) { std::string aStr = string(theSection, theName); return stringToRGB(aStr); } -int Config_PropManager::integer(const std::string& theSection, const std::string& theName) -{ +int Config_PropManager::integer(const std::string &theSection, + const std::string &theName) { std::string aStr = string(theSection, theName); return stringToInteger(aStr); } -double Config_PropManager::real(const std::string& theSection, const std::string& theName) -{ +double Config_PropManager::real(const std::string &theSection, + const std::string &theName) { std::string aStr = string(theSection, theName); return stringToDouble(aStr); } -bool Config_PropManager::boolean(const std::string& theSection, - const std::string& theName) -{ +bool Config_PropManager::boolean(const std::string &theSection, + const std::string &theName) { std::string aStr = string(theSection, theName); return stringToBoolean(aStr); } -std::vector stringToRGB(const std::string& theColor) -{ +std::vector stringToRGB(const std::string &theColor) { std::vector aRes(3); if (theColor[0] == '#') { char aBuf[3]; - char* aP; + char *aP; aBuf[2] = '\0'; aBuf[0] = theColor[1]; @@ -208,13 +200,9 @@ std::vector stringToRGB(const std::string& theColor) return aRes; } -int stringToInteger(const std::string& theInt) -{ - return atoi(theInt.c_str()); -} +int stringToInteger(const std::string &theInt) { return atoi(theInt.c_str()); } -double Config_PropManager::stringToDouble(const std::string& theDouble) -{ +double Config_PropManager::stringToDouble(const std::string &theDouble) { std::string aStr = theDouble; // change locale and convert "," to "." if exists @@ -224,7 +212,7 @@ double Config_PropManager::stringToDouble(const std::string& theDouble) if (dotpos != std::string::npos) aStr.replace(dotpos, 1, "."); - char* p; + char *p; double aValue = strtod(aStr.c_str(), &p); // restore locale @@ -232,7 +220,6 @@ double Config_PropManager::stringToDouble(const std::string& theDouble) return aValue; } -bool stringToBoolean(const std::string& theBoolean) -{ +bool stringToBoolean(const std::string &theBoolean) { return theBoolean == "true"; } diff --git a/src/Config/Config_PropManager.h b/src/Config/Config_PropManager.h index d5f178dc8..2832303f7 100644 --- a/src/Config/Config_PropManager.h +++ b/src/Config/Config_PropManager.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Config_PropManager_H #define Config_PropManager_H -#include "Config_def.h" #include "Config_Prop.h" +#include "Config_def.h" #include #include @@ -32,10 +33,8 @@ * \ingroup Config * \brief Class which let to register properties */ -class Config_PropManager -{ - public: - +class Config_PropManager { +public: /** * Registers property parameters * \param theSection - name of section (domain of using) of the property. @@ -47,16 +46,16 @@ class Config_PropManager * \param theMax - maximal value * Returns True if the property succesfully registered */ - CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, - const std::string& theName, - const std::string& theTitle, Config_Prop::PropType theType, - const std::string& theDefValue = "", - const std::string& theMin = "", - const std::string& theMax = ""); + CONFIG_EXPORT static Config_Prop * + registerProp(const std::string &theSection, const std::string &theName, + const std::string &theTitle, Config_Prop::PropType theType, + const std::string &theDefValue = "", + const std::string &theMin = "", const std::string &theMax = ""); - //! Finds property in the given section by the given name, if property not found returns NULL - CONFIG_EXPORT static Config_Prop* findProp( - const std::string& theSection, const std::string& theName); + //! Finds property in the given section by the given name, if property not + //! found returns NULL + CONFIG_EXPORT static Config_Prop *findProp(const std::string &theSection, + const std::string &theName); //! Returns std::list of all existing properies CONFIG_EXPORT static Config_Properties getProperties(); @@ -65,29 +64,29 @@ class Config_PropManager CONFIG_EXPORT static std::list getSections(); //! Returns list of properties by its owner and section. - CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection); + CONFIG_EXPORT static Config_Properties + getProperties(const std::string &theSection); //! Returns value of the property by its owner, section, and name - CONFIG_EXPORT static std::string string(const std::string& theSection, - const std::string& theName); + CONFIG_EXPORT static std::string string(const std::string &theSection, + const std::string &theName); //! Returns color by given section and name as 3-element vector {r,g,b}. - CONFIG_EXPORT static std::vector color(const std::string& theSection, - const std::string& theName); + CONFIG_EXPORT static std::vector color(const std::string &theSection, + const std::string &theName); //! Returns integer by given section and name - CONFIG_EXPORT static int integer(const std::string& theSection, - const std::string& theName); + CONFIG_EXPORT static int integer(const std::string &theSection, + const std::string &theName); //! Returns real by given section and name - CONFIG_EXPORT static double real(const std::string& theSection, - const std::string& theName); + CONFIG_EXPORT static double real(const std::string &theSection, + const std::string &theName); //! Returns boolean by given section and name - CONFIG_EXPORT static bool boolean(const std::string& theSection, - const std::string& theName); + CONFIG_EXPORT static bool boolean(const std::string &theSection, + const std::string &theName); - //! Returns convertion of the string to double value. Temporary changes locale to process - //! values contained "," or "." separator. - //! \param theDouble a value to be converted - //! \return double result or zero - CONFIG_EXPORT static double stringToDouble(const std::string& theDouble); + //! Returns convertion of the string to double value. Temporary changes locale + //! to process values contained "," or "." separator. \param theDouble a value + //! to be converted \return double result or zero + CONFIG_EXPORT static double stringToDouble(const std::string &theDouble); //! Returns Auto-color status as a Boolean CONFIG_EXPORT static bool getAutoColorStatus(); @@ -96,11 +95,11 @@ class Config_PropManager //! \param theValue a value to use CONFIG_EXPORT static void setAutoColorStatus(const bool theValue); - private: - +private: CONFIG_EXPORT static bool autoColorStatus; // Auto-color status - CONFIG_EXPORT static Config_Properties& props(); ///< List of all stored properties + CONFIG_EXPORT static Config_Properties & + props(); ///< List of all stored properties }; #endif diff --git a/src/Config/Config_Translator.cpp b/src/Config/Config_Translator.cpp index e9764a5be..e14545fca 100644 --- a/src/Config/Config_Translator.cpp +++ b/src/Config/Config_Translator.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Config_Translator.h" -#include "Config_XMLReader.h" #include "Config_Common.h" +#include "Config_XMLReader.h" #include #include @@ -34,29 +35,30 @@ * \ingroup Config * \brief Class for reading translations from TS files (an XML format). */ -class Config_TSReader : public Config_XMLReader -{ +class Config_TSReader : public Config_XMLReader { public: /// Constructor /// \param theTSFile name of TS file - Config_TSReader(const std::string& theTSFile) : Config_XMLReader(theTSFile) {} + Config_TSReader(const std::string &theTSFile) : Config_XMLReader(theTSFile) {} /// Returns content of TS file - const Config_Translator::Translator& translator() const { return myTranslator; } + const Config_Translator::Translator &translator() const { + return myTranslator; + } /// Returns codecs defined in TS files - const Config_Translator::Dictionary& codecs() const { return myCodecs; } + const Config_Translator::Dictionary &codecs() const { return myCodecs; } protected: /// Overloaded method. Defines how to process each node virtual void processNode(xmlNodePtr theNode); + private: Config_Translator::Translator myTranslator; Config_Translator::Dictionary myCodecs; }; -void Config_TSReader::processNode(xmlNodePtr theNode) -{ +void Config_TSReader::processNode(xmlNodePtr theNode) { static std::string aName; static std::string aSource; std::string aTranslat; @@ -89,12 +91,11 @@ Config_Translator::Translator Config_Translator::myMissed; #endif #endif -bool Config_Translator::load(const std::string& theFileName) -{ +bool Config_Translator::load(const std::string &theFileName) { Config_TSReader aReader(theFileName); aReader.readAll(); - const Translator& aTranslator = aReader.translator(); + const Translator &aTranslator = aReader.translator(); Translator::const_iterator aIt; std::string aContext; Dictionary aDictionary; @@ -105,7 +106,8 @@ bool Config_Translator::load(const std::string& theFileName) myTranslator[aContext] = aDictionary; } else { Dictionary::const_iterator aDictIt; - for (aDictIt = aDictionary.cbegin(); aDictIt != aDictionary.cend(); aDictIt++) { + for (aDictIt = aDictionary.cbegin(); aDictIt != aDictionary.cend(); + aDictIt++) { myTranslator[aContext][(*aDictIt).first] = (*aDictIt).second; } } @@ -120,39 +122,39 @@ bool Config_Translator::load(const std::string& theFileName) } // LCOV_EXCL_STOP -std::string Config_Translator::translate(const Events_InfoMessage& theInfo) -{ +std::string Config_Translator::translate(const Events_InfoMessage &theInfo) { std::string aContext = theInfo.context(); std::string aMessage = theInfo.messageString(); std::list aParameters = theInfo.parameters(); return translate(aContext, aMessage, aParameters); } -std::string insertParameters(const std::string& theString, const std::list& theParams) -{ +std::string insertParameters(const std::string &theString, + const std::list &theParams) { std::string aResult = theString; std::list::const_iterator aIt; int i; char aBuf[20]; std::string aParam; - for (i=1, aIt = theParams.cbegin(); aIt != theParams.cend(); aIt++, i++) { + for (i = 1, aIt = theParams.cbegin(); aIt != theParams.cend(); aIt++, i++) { aParam = (*aIt); sprintf(aBuf, "%d", i); std::string aCode = std::string("%") + std::string(aBuf); size_t aPos = aResult.find(aCode); if (aPos != std::string::npos) { std::string aFirst = aResult.substr(0, aPos); - std::string aLast = aResult.substr(aPos + aCode.length(), std::string::npos); + std::string aLast = + aResult.substr(aPos + aCode.length(), std::string::npos); aResult = aFirst + aParam + aLast; } } return aResult; } -std::string Config_Translator::translate(const std::string& theContext, - const std::string& theMessage, - const std::list& theParams) -{ +std::string +Config_Translator::translate(const std::string &theContext, + const std::string &theMessage, + const std::list &theParams) { if (myTranslator.count(theContext) > 0) { if (myTranslator[theContext].count(theMessage) > 0) { std::string aTranslation = myTranslator[theContext][theMessage]; @@ -176,25 +178,22 @@ std::string Config_Translator::translate(const std::string& theContext, } // LCOV_EXCL_START -std::string Config_Translator::codec(const std::string& theContext) -{ - return (myCodecs.count(theContext) > 0)? myCodecs[theContext] : "UTF-8"; +std::string Config_Translator::codec(const std::string &theContext) { + return (myCodecs.count(theContext) > 0) ? myCodecs[theContext] : "UTF-8"; } -std::string Config_Translator::codec(const Events_InfoMessage& theInfo) -{ +std::string Config_Translator::codec(const Events_InfoMessage &theInfo) { return codec(theInfo.context()); } // LCOV_EXCL_STOP #ifdef _DEBUG #ifdef MISSED_TRANSLATION -void Config_Translator::saveMissedTranslations() -{ +void Config_Translator::saveMissedTranslations() { if (myMissed.size() == 0) return; - char* aPath = getenv("ROOT_DIR"); + char *aPath = getenv("ROOT_DIR"); #ifdef WIN32 std::string aFile = aPath + std::string("\\MissedTranslation.ts"); #else @@ -214,19 +213,20 @@ void Config_Translator::saveMissedTranslations() Dictionary aDict; oFStream << "" << std::endl; - for(aContIt = myMissed.cbegin(); aContIt != myMissed.cend(); aContIt++) { + for (aContIt = myMissed.cbegin(); aContIt != myMissed.cend(); aContIt++) { oFStream << "" << std::endl; aContext = aContIt->first; oFStream << " " << aContext << "" << std::endl; aDict = aContIt->second; - for(aDictIt = aDict.cbegin(); aDictIt != aDict.cend(); aDictIt++) { + for (aDictIt = aDict.cbegin(); aDictIt != aDict.cend(); aDictIt++) { oFStream << " " << std::endl; aSrc = aDictIt->first; oFStream << " " << aSrc << "" << std::endl; - oFStream << " " << "" << std::endl; + oFStream << " " + << "" << std::endl; oFStream << " " << std::endl; } diff --git a/src/Config/Config_Translator.h b/src/Config/Config_Translator.h index b72621140..83ceb64e1 100644 --- a/src/Config/Config_Translator.h +++ b/src/Config/Config_Translator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Config_Translator_H @@ -23,9 +24,8 @@ #include "Config_def.h" #include -#include #include - +#include /// The definition provides collection and writing of missed translations //#define MISSED_TRANSLATION @@ -34,10 +34,10 @@ * \class Config_Translator * \ingroup Config * \brief Class for messages translation on different languages. It can load TS - * files wich contain translation string and provides translations of messages from source code + * files wich contain translation string and provides translations of messages + * from source code */ -class Config_Translator -{ +class Config_Translator { public: /// A data type of dictionary typedef std::map Dictionary; @@ -46,43 +46,42 @@ public: typedef std::map Translator; /** - * Load translations from TS file - * \param theFileName a TS file name with full path - */ - static CONFIG_EXPORT bool load(const std::string& theFileName); + * Load translations from TS file + * \param theFileName a TS file name with full path + */ + static CONFIG_EXPORT bool load(const std::string &theFileName); /** - * Returns translation from the given info message. - * If translation is not exists then it returns a string - * from the info data without translation - * \param theInfo an info message - */ - static CONFIG_EXPORT std::string translate(const Events_InfoMessage& theInfo); + * Returns translation from the given info message. + * If translation is not exists then it returns a string + * from the info data without translation + * \param theInfo an info message + */ + static CONFIG_EXPORT std::string translate(const Events_InfoMessage &theInfo); /** - * Returns translation from the given data. - * If translation is not exists then it returns a string - * from the info data without translation - * \param theContext context of the message (Feature Id) - * \param theMessage a message which dave to be translated - * \param theParams a list of parameters (can be empty) - */ - static CONFIG_EXPORT std::string translate(const std::string& theContext, - const std::string& theMessage, - const std::list& theParams = std::list()); - + * Returns translation from the given data. + * If translation is not exists then it returns a string + * from the info data without translation + * \param theContext context of the message (Feature Id) + * \param theMessage a message which dave to be translated + * \param theParams a list of parameters (can be empty) + */ + static CONFIG_EXPORT std::string + translate(const std::string &theContext, const std::string &theMessage, + const std::list &theParams = std::list()); /** - * Returns codec for the context - * \param theContext the context - */ - static CONFIG_EXPORT std::string codec(const std::string& theContext); + * Returns codec for the context + * \param theContext the context + */ + static CONFIG_EXPORT std::string codec(const std::string &theContext); /** - * Returns codec for the context - * \param theInfo the info - */ - static CONFIG_EXPORT std::string codec(const Events_InfoMessage& theInfo); + * Returns codec for the context + * \param theInfo the info + */ + static CONFIG_EXPORT std::string codec(const Events_InfoMessage &theInfo); #ifdef _DEBUG #ifdef MISSED_TRANSLATION @@ -90,7 +89,6 @@ public: #endif #endif - private: /// A map of translations static Translator myTranslator; diff --git a/src/Config/Config_ValidatorMessage.cpp b/src/Config/Config_ValidatorMessage.cpp index a5fa0fe11..72b31cd33 100644 --- a/src/Config/Config_ValidatorMessage.cpp +++ b/src/Config/Config_ValidatorMessage.cpp @@ -14,64 +14,53 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -Config_ValidatorMessage::Config_ValidatorMessage(const Events_ID theId, const void* theParent) - : Events_Message(theId, theParent) -{ +Config_ValidatorMessage::Config_ValidatorMessage(const Events_ID theId, + const void *theParent) + : Events_Message(theId, theParent) { myValidatorId = ""; myFeatureId = ""; myAttributeId = ""; } -Config_ValidatorMessage::~Config_ValidatorMessage() -{ -} +Config_ValidatorMessage::~Config_ValidatorMessage() {} -const std::string& Config_ValidatorMessage::validatorId() const -{ +const std::string &Config_ValidatorMessage::validatorId() const { return myValidatorId; } -const std::string& Config_ValidatorMessage::featureId() const -{ +const std::string &Config_ValidatorMessage::featureId() const { return myFeatureId; } -const std::string& Config_ValidatorMessage::attributeId() const -{ +const std::string &Config_ValidatorMessage::attributeId() const { return myAttributeId; } -const std::list& Config_ValidatorMessage::parameters() const -{ +const std::list &Config_ValidatorMessage::parameters() const { return myVaidatorParameters; } -bool Config_ValidatorMessage::isValid() const -{ - return !myValidatorId.empty(); -} +bool Config_ValidatorMessage::isValid() const { return !myValidatorId.empty(); } -void Config_ValidatorMessage::setValidatorId(const std::string& validatorId) -{ +void Config_ValidatorMessage::setValidatorId(const std::string &validatorId) { myValidatorId = validatorId; } -void Config_ValidatorMessage::setValidatorParameters(const std::list& parameters) -{ +void Config_ValidatorMessage::setValidatorParameters( + const std::list ¶meters) { myVaidatorParameters = parameters; } -void Config_ValidatorMessage::setFeatureId(const std::string& theId) -{ +void Config_ValidatorMessage::setFeatureId(const std::string &theId) { myFeatureId = theId; } -void Config_ValidatorMessage::setAttributeId(const std::string& theId) -{ +void Config_ValidatorMessage::setAttributeId(const std::string &theId) { myAttributeId = theId; } diff --git a/src/Config/Config_ValidatorMessage.h b/src/Config/Config_ValidatorMessage.h index da569a192..d3c352840 100644 --- a/src/Config/Config_ValidatorMessage.h +++ b/src/Config/Config_ValidatorMessage.h @@ -14,61 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_VALIDATORMESSAGE_H_ #define CONFIG_VALIDATORMESSAGE_H_ -#include #include +#include #include #include /// Event ID that Validator is loaded (comes with Config_ValidatorMessage) -MAYBE_UNUSED static const char * EVENT_VALIDATOR_LOADED = "ValidatorLoaded"; +MAYBE_UNUSED static const char *EVENT_VALIDATOR_LOADED = "ValidatorLoaded"; /*! * \class Config_ValidatorMessage * \ingroup Config * \brief Transmits info about created validator on "ValidatorLoaded" event */ -class Config_ValidatorMessage : public Events_Message -{ +class Config_ValidatorMessage : public Events_Message { std::string myValidatorId; std::string myFeatureId; std::string myAttributeId; std::list myVaidatorParameters; - public: +public: /*! * Constructor. * \param theId - Events_ID of the message * \param theParent - pointer to the sender */ - CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId, const void* theParent = 0); + CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId, + const void *theParent = 0); CONFIG_EXPORT virtual ~Config_ValidatorMessage(); //! Get id of the filter - CONFIG_EXPORT const std::string& validatorId() const; + CONFIG_EXPORT const std::string &validatorId() const; //! Get id of a feature to which the filter belongs to - CONFIG_EXPORT const std::string& featureId() const; + CONFIG_EXPORT const std::string &featureId() const; //! Get id of an attribute to which the filter belongs to - CONFIG_EXPORT const std::string& attributeId() const; + CONFIG_EXPORT const std::string &attributeId() const; //! Get filter parameters - CONFIG_EXPORT const std::list& parameters() const; + CONFIG_EXPORT const std::list ¶meters() const; //! Returns true if validator id is not empty CONFIG_EXPORT bool isValid() const; //! Set id of the filter - CONFIG_EXPORT void setValidatorId(const std::string& theId); + CONFIG_EXPORT void setValidatorId(const std::string &theId); //! Set id of a feature to which the filter belongs to - CONFIG_EXPORT void setFeatureId(const std::string& theId); + CONFIG_EXPORT void setFeatureId(const std::string &theId); //! Set id of an attribute to which the filter belongs to - CONFIG_EXPORT void setAttributeId(const std::string& theId); + CONFIG_EXPORT void setAttributeId(const std::string &theId); //! Get filter parameters - CONFIG_EXPORT void setValidatorParameters(const std::list& parameters); + CONFIG_EXPORT void + setValidatorParameters(const std::list ¶meters); }; #endif /* Config_ValidatorMessage_H_ */ diff --git a/src/Config/Config_ValidatorReader.cpp b/src/Config/Config_ValidatorReader.cpp index 9bf19d1f2..20b2c01e1 100644 --- a/src/Config/Config_ValidatorReader.cpp +++ b/src/Config/Config_ValidatorReader.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include -#include +#include #include +#include +#include #include #include @@ -33,17 +34,13 @@ #include #endif -Config_ValidatorReader::Config_ValidatorReader(const std::string& theXmlFileName, bool isXMLContent) -: Config_XMLReader(theXmlFileName, isXMLContent) -{ -} +Config_ValidatorReader::Config_ValidatorReader( + const std::string &theXmlFileName, bool isXMLContent) + : Config_XMLReader(theXmlFileName, isXMLContent) {} -Config_ValidatorReader::~Config_ValidatorReader() -{ -} +Config_ValidatorReader::~Config_ValidatorReader() {} -void Config_ValidatorReader::processNode(xmlNodePtr theNode) -{ +void Config_ValidatorReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_VALIDATOR, NULL)) { processValidator(theNode); } else if (isNode(theNode, NODE_FEATURE, NULL)) { @@ -53,12 +50,11 @@ void Config_ValidatorReader::processNode(xmlNodePtr theNode) // Store widget name to restore it's id on validator/selector processing myCurrentWidget = getNodeName(theNode); } - //Process SOURCE nodes. + // Process SOURCE nodes. Config_XMLReader::processNode(theNode); } -void Config_ValidatorReader::cleanup(xmlNodePtr theNode) -{ +void Config_ValidatorReader::cleanup(xmlNodePtr theNode) { if (isNode(theNode, NODE_FEATURE, NULL)) { cleanupAttribute(theNode, _ID); } else if (isWidgetNode(theNode)) { @@ -68,17 +64,15 @@ void Config_ValidatorReader::cleanup(xmlNodePtr theNode) } } -bool Config_ValidatorReader::processChildren(xmlNodePtr /*aNode*/) -{ +bool Config_ValidatorReader::processChildren(xmlNodePtr /*aNode*/) { return true; } -void Config_ValidatorReader::processValidator(xmlNodePtr theNode) -{ +void Config_ValidatorReader::processValidator(xmlNodePtr theNode) { Events_ID aValidatoEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED); - Events_Loop* aEvLoop = Events_Loop::loop(); - std::shared_ptr - aMessage(new Config_ValidatorMessage(aValidatoEvent, this)); + Events_Loop *aEvLoop = Events_Loop::loop(); + std::shared_ptr aMessage( + new Config_ValidatorMessage(aValidatoEvent, this)); std::string aValidatorId; std::list aParameters; getParametersInfo(theNode, aValidatorId, aParameters); diff --git a/src/Config/Config_ValidatorReader.h b/src/Config/Config_ValidatorReader.h index b8396820b..deed3da0b 100644 --- a/src/Config/Config_ValidatorReader.h +++ b/src/Config/Config_ValidatorReader.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_VALIDATORREADER_H_ #define CONFIG_VALIDATORREADER_H_ -#include #include +#include #include #include @@ -31,25 +32,27 @@ * \ingroup Config * \brief Base class for all libxml readers. Provides high-level API * for all xml operations. -*/ -class Config_ValidatorReader : public Config_XMLReader -{ - public: + */ +class Config_ValidatorReader : public Config_XMLReader { +public: /*! * Constructor - * \param theXmlFile - full path to the xml file which will be processed by the reader + * \param theXmlFile - full path to the xml file which will be processed by + * the reader */ - CONFIG_EXPORT Config_ValidatorReader(const std::string& theXmlFile, bool isXMLContent = false); + CONFIG_EXPORT Config_ValidatorReader(const std::string &theXmlFile, + bool isXMLContent = false); CONFIG_EXPORT virtual ~Config_ValidatorReader(); - /// Set feature ID for cases when XML for validators is parsed from memory - CONFIG_EXPORT void setFeatureId(const std::string& theId) { myExtFeatureId = theId; } + CONFIG_EXPORT void setFeatureId(const std::string &theId) { + myExtFeatureId = theId; + } // for correct SWIG wrapping using Config_XMLReader::readAll; - protected: +protected: /*! * \brief Allows to customize reader's behavior for a node. Virtual. * The default implementation process "source" and "validator" nodes. @@ -72,7 +75,7 @@ class Config_ValidatorReader : public Config_XMLReader */ void processValidator(xmlNodePtr theNode); - private: +private: std::string myCurrentWidget; std::string myExtFeatureId; }; diff --git a/src/Config/Config_WidgetAPI.cpp b/src/Config/Config_WidgetAPI.cpp index aa5a09c82..193bec12b 100644 --- a/src/Config/Config_WidgetAPI.cpp +++ b/src/Config/Config_WidgetAPI.cpp @@ -14,34 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include #include #include #include -Config_WidgetAPI::Config_WidgetAPI(std::string theRawXml, const std::string theAttributePrefix) -{ +Config_WidgetAPI::Config_WidgetAPI(std::string theRawXml, + const std::string theAttributePrefix) { myDoc = xmlParseDoc(BAD_CAST theRawXml.c_str()); myCurrentNode = xmlDocGetRootElement(myDoc); myFeatureId = getProperty(_ID); myAttributePrefix = theAttributePrefix; } -Config_WidgetAPI::~Config_WidgetAPI() -{ - xmlFreeDoc(myDoc); -} +Config_WidgetAPI::~Config_WidgetAPI() { xmlFreeDoc(myDoc); } -bool Config_WidgetAPI::toNextWidget() -{ - //Skip all non-element node, stop if next node is null +bool Config_WidgetAPI::toNextWidget() { + // Skip all non-element node, stop if next node is null xmlNodePtr aNextNode = myCurrentNode; do { aNextNode = aNextNode->next; @@ -55,14 +52,13 @@ bool Config_WidgetAPI::toNextWidget() return true; } -bool Config_WidgetAPI::toChildWidget() -{ +bool Config_WidgetAPI::toChildWidget() { if (myCurrentNode && hasChild(myCurrentNode)) { xmlNodePtr aChildNode = myCurrentNode->children; // it is possible that among child nodes, there is no an element node, so // we should not change the current node until not-zero node is found - // otherwise, it may happens that the current node is null and the node tree information - // is lost + // otherwise, it may happens that the current node is null and the node tree + // information is lost while (aChildNode && !isElementNode(aChildNode)) { aChildNode = aChildNode->next; } @@ -74,66 +70,52 @@ bool Config_WidgetAPI::toChildWidget() return false; } -bool Config_WidgetAPI::toParentWidget() -{ +bool Config_WidgetAPI::toParentWidget() { if (myCurrentNode) { myCurrentNode = myCurrentNode->parent; } return myCurrentNode != NULL; } -std::string Config_WidgetAPI::widgetType() const -{ +std::string Config_WidgetAPI::widgetType() const { std::string result = ""; if (myCurrentNode) { - result = std::string((char *) myCurrentNode->name); + result = std::string((char *)myCurrentNode->name); } return result; } -bool Config_WidgetAPI::isGroupBoxWidget() const -{ - return isNode(myCurrentNode, WDG_GROUP, WDG_OPTIONALBOX, - NULL); +bool Config_WidgetAPI::isGroupBoxWidget() const { + return isNode(myCurrentNode, WDG_GROUP, WDG_OPTIONALBOX, NULL); } -bool Config_WidgetAPI::isPagedWidget() const -{ - return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH, WDG_RADIOBOX, - NULL); +bool Config_WidgetAPI::isPagedWidget() const { + return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH, WDG_RADIOBOX, NULL); } -std::string Config_WidgetAPI::getProperty(const char* thePropName) const -{ +std::string Config_WidgetAPI::getProperty(const char *thePropName) const { return ::getProperty(myCurrentNode, thePropName); } -bool Config_WidgetAPI::getBooleanAttribute(const char* theAttributeName, bool theDefault) const -{ +bool Config_WidgetAPI::getBooleanAttribute(const char *theAttributeName, + bool theDefault) const { return ::getBooleanAttribute(myCurrentNode, theAttributeName, theDefault); } -std::string Config_WidgetAPI::featureId() const -{ - return myFeatureId; -} +std::string Config_WidgetAPI::featureId() const { return myFeatureId; } -std::string Config_WidgetAPI::widgetId() const -{ +std::string Config_WidgetAPI::widgetId() const { return myAttributePrefix + getProperty(_ID); } -std::string Config_WidgetAPI::widgetIcon() const -{ +std::string Config_WidgetAPI::widgetIcon() const { return getProperty(ATTR_ICON); } -std::string Config_WidgetAPI::widgetLabel() const -{ +std::string Config_WidgetAPI::widgetLabel() const { return getProperty(ATTR_LABEL); } -std::string Config_WidgetAPI::widgetTooltip() const -{ +std::string Config_WidgetAPI::widgetTooltip() const { return getProperty(ATTR_TOOLTIP); } diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index 41d5ecd36..f47425a11 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_WIDGETAPI_H_ @@ -40,16 +41,17 @@ struct _xmlDoc; /*! * \class Config_WidgetAPI * \ingroup Config - * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets + * \brief Provides low-level API for WidgetFactory for reading xml definitions + * of widgets */ -class Config_WidgetAPI -{ - public: +class Config_WidgetAPI { +public: CONFIG_EXPORT virtual ~Config_WidgetAPI(); //! Returns name of widget's node (attribute) CONFIG_EXPORT std::string widgetType() const; - //! Returns true if widget has container type, which means it able to contain other widgets + //! Returns true if widget has container type, which means it able to contain + //! other widgets CONFIG_EXPORT bool isGroupBoxWidget() const; //! Returns true if widget has page type; //! Page is container widget with combo box control to switch between pages @@ -66,7 +68,7 @@ class Config_WidgetAPI //! Returns text for tooltip of current widget CONFIG_EXPORT std::string widgetTooltip() const; //! Returns a custom property of current widget - CONFIG_EXPORT std::string getProperty(const char* thePropName) const; + CONFIG_EXPORT std::string getProperty(const char *thePropName) const; /*! Checks if the XML representation of widget has given attribute, * if yes - returns it's bool value, if no, or if the value can not @@ -75,22 +77,29 @@ class Config_WidgetAPI * \param theDefault default value on bad data * \return the boolean result */ - CONFIG_EXPORT bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const; + CONFIG_EXPORT bool getBooleanAttribute(const char *theAttributeName, + bool theDefault) const; /// These fields are accessible for ModuleBase_WidgetFactory only - CONFIG_EXPORT Config_WidgetAPI(std::string theRawXml, const std::string theAttributePrefix = ""); - //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false + CONFIG_EXPORT Config_WidgetAPI(std::string theRawXml, + const std::string theAttributePrefix = ""); + //! Pass to the next (sibling) node of widget's xml definition. If impossible, + //! returns false CONFIG_EXPORT bool toNextWidget(); - //! Pass into the child node of widget's xml definition. If impossible, returns false + //! Pass into the child node of widget's xml definition. If impossible, + //! returns false CONFIG_EXPORT bool toChildWidget(); - //! Pass into the parent node of widget's xml definition. If impossible, returns false + //! Pass into the parent node of widget's xml definition. If impossible, + //! returns false CONFIG_EXPORT bool toParentWidget(); - private: - xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition - xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition +private: + xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition + xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml + //!< definition std::string myFeatureId; - std::string myAttributePrefix; //!< prefix that must be added to the attribute name + std::string + myAttributePrefix; //!< prefix that must be added to the attribute name friend class ModuleBase_WidgetFactory; }; diff --git a/src/Config/Config_WidgetReader.cpp b/src/Config/Config_WidgetReader.cpp index ddd64877b..2612fdfb6 100644 --- a/src/Config/Config_WidgetReader.cpp +++ b/src/Config/Config_WidgetReader.cpp @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include #include #include -#include #include +#include #include @@ -32,51 +33,45 @@ #include #endif -Config_WidgetReader::Config_WidgetReader(const std::string& theXmlFile) +Config_WidgetReader::Config_WidgetReader(const std::string &theXmlFile) : Config_XMLReader(theXmlFile) -{ -} +{} -Config_WidgetReader::~Config_WidgetReader() -{ -} +Config_WidgetReader::~Config_WidgetReader() {} -std::string Config_WidgetReader::featureWidgetCfg(const std::string& theFeatureName) -{ +std::string +Config_WidgetReader::featureWidgetCfg(const std::string &theFeatureName) { return myWidgetCache[theFeatureName]; } -std::string Config_WidgetReader::featureDescription(const std::string& theFeatureName) -{ +std::string +Config_WidgetReader::featureDescription(const std::string &theFeatureName) { return myDescriptionCache[theFeatureName]; } -void Config_WidgetReader::processNode(xmlNodePtr theNode) -{ +void Config_WidgetReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_FEATURE, NULL)) { std::string aFeature = getProperty(theNode, _ID); myWidgetCache[aFeature] = dumpNode(theNode); myDescriptionCache[aFeature] = getProperty(theNode, FEATURE_TEXT); } - //Process SOURCE nodes. + // Process SOURCE nodes. Config_XMLReader::processNode(theNode); } -bool Config_WidgetReader::processChildren(xmlNodePtr theNode) -{ - //Read all nodes recursively, source and validator nodes have no children - return !isNode(theNode, NODE_VALIDATOR, - NODE_SOURCE, NULL); +bool Config_WidgetReader::processChildren(xmlNodePtr theNode) { + // Read all nodes recursively, source and validator nodes have no children + return !isNode(theNode, NODE_VALIDATOR, NODE_SOURCE, NULL); } -void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) -{ +void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) { xmlNodePtr aNode = xmlFirstElementChild(theNode); std::list aSourceNodes; while (aNode != NULL) { if (isNode(aNode, NODE_SOURCE, NULL)) { - Config_XMLReader aSourceReader = Config_XMLReader(getProperty(aNode, SOURCE_FILE)); + Config_XMLReader aSourceReader = + Config_XMLReader(getProperty(aNode, SOURCE_FILE)); xmlNodePtr aSourceRoot = aSourceReader.findRoot(); if (aSourceRoot) { xmlNodePtr aSourceNode = xmlFirstElementChild(aSourceRoot); @@ -91,7 +86,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) } aNode = xmlNextElementSibling(aNode); } - //Remove "SOURCE" node. + // Remove "SOURCE" node. std::list::iterator it = aSourceNodes.begin(); for (; it != aSourceNodes.end(); it++) { xmlUnlinkNode(*it); @@ -99,8 +94,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) } } -std::string Config_WidgetReader::dumpNode(xmlNodePtr theNode) -{ +std::string Config_WidgetReader::dumpNode(xmlNodePtr theNode) { std::string result = ""; if (!hasChild(theNode)) { // feature which has the next property should be dumped itself @@ -110,20 +104,20 @@ std::string Config_WidgetReader::dumpNode(xmlNodePtr theNode) #ifdef _DEBUG int size = #endif - xmlNodeDump(buffer, theNode->doc, theNode, 0, 0); - result = std::string((char*) (buffer->content)); + xmlNodeDump(buffer, theNode->doc, theNode, 0, 0); + result = std::string((char *)(buffer->content)); xmlBufferFree(buffer); } return result; } - //Replace all "source" nodes with content; + // Replace all "source" nodes with content; resolveSourceNodes(theNode); xmlBufferPtr buffer = xmlBufferCreate(); #ifdef _DEBUG int size = #endif - xmlNodeDump(buffer, theNode->doc, theNode, 0, 0); - result = std::string((char*) (buffer->content)); + xmlNodeDump(buffer, theNode->doc, theNode, 0, 0); + result = std::string((char *)(buffer->content)); xmlBufferFree(buffer); return result; } diff --git a/src/Config/Config_WidgetReader.h b/src/Config/Config_WidgetReader.h index cd33ea039..c5218a28a 100644 --- a/src/Config/Config_WidgetReader.h +++ b/src/Config/Config_WidgetReader.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_WIDGETREADER_H_ #define CONFIG_WIDGETREADER_H_ -#include #include +#include #include #include @@ -32,22 +33,24 @@ * \brief Class that dumps xml definitions of widgets for * further processing in the WidgetFactory */ -class Config_WidgetReader : public Config_XMLReader -{ - public: +class Config_WidgetReader : public Config_XMLReader { +public: /*! * Constructor - * \param theXmlFile - full path to the xml file which will be processed by the reader + * \param theXmlFile - full path to the xml file which will be processed by + * the reader */ - CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile); + CONFIG_EXPORT Config_WidgetReader(const std::string &theXmlFile); CONFIG_EXPORT virtual ~Config_WidgetReader(); - /// Extract feature's widget configuration from local cache, stored on node processing - CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName); + /// Extract feature's widget configuration from local cache, stored on node + /// processing + CONFIG_EXPORT std::string featureWidgetCfg(const std::string &theFeatureName); /// Extract feature's description from local cache, stored on node processing - CONFIG_EXPORT std::string featureDescription(const std::string& theFeatureName); + CONFIG_EXPORT std::string + featureDescription(const std::string &theFeatureName); - protected: +protected: /// Overloaded method. Defines how to process each node void processNode(xmlNodePtr theNode); /// Overloaded method. Defines if the given node should be parsed recursively @@ -57,10 +60,9 @@ class Config_WidgetReader : public Config_XMLReader /// Replace all "source" nodes with their content (used before dumping nodes) void resolveSourceNodes(xmlNodePtr theNode); - private: +private: std::map myWidgetCache; std::map myDescriptionCache; - }; #endif /* CONFIG_WIDGETREADER_H_ */ diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index a9c56d7de..1d0a86839 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include -#include +#include #include +#include +#include -#include #include +#include #include #include @@ -40,36 +41,34 @@ #endif #ifdef WIN32 - static const char FSEP = '\\'; +static const char FSEP = '\\'; #else - static const char FSEP = '/'; +static const char FSEP = '/'; #endif -Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName, bool isXMLContent) - : myXmlDoc(NULL), myRootFileName(theXmlFileName) -{ +Config_XMLReader::Config_XMLReader(const std::string &theXmlFileName, + bool isXMLContent) + : myXmlDoc(NULL), myRootFileName(theXmlFileName) { isFromMemory = isXMLContent; if (!isXMLContent) { myDocumentPath = findConfigFile(theXmlFileName); if (myDocumentPath.empty()) { - Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(theXmlFileName).send(); + Events_InfoMessage("Config_XMLReader", "Unable to open %1") + .arg(theXmlFileName) + .send(); } } } -Config_XMLReader::~Config_XMLReader() -{ - xmlFreeDoc(myXmlDoc); -} +Config_XMLReader::~Config_XMLReader() { xmlFreeDoc(myXmlDoc); } // LCOV_EXCL_START -std::string Config_XMLReader::resourcesConfigFile() -{ +std::string Config_XMLReader::resourcesConfigFile() { std::string aValue; - char* anEnv = getenv("SHAPER_ROOT_DIR"); + char *anEnv = getenv("SHAPER_ROOT_DIR"); if (anEnv) { - aValue = std::string(anEnv) + - FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; + aValue = std::string(anEnv) + FSEP + "share" + FSEP + "salome" + FSEP + + "resources" + FSEP + "shaper"; } else { anEnv = getenv("CADBUILDER_ROOT_DIR"); if (anEnv) { @@ -79,13 +78,12 @@ std::string Config_XMLReader::resourcesConfigFile() return aValue; } -std::string Config_XMLReader::pluginConfigFile() -{ +std::string Config_XMLReader::pluginConfigFile() { std::string aValue; - char* anEnv = getenv("SHAPER_ROOT_DIR"); + char *anEnv = getenv("SHAPER_ROOT_DIR"); if (anEnv) { - aValue = std::string(anEnv) + - FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; + aValue = std::string(anEnv) + FSEP + "share" + FSEP + "salome" + FSEP + + "resources" + FSEP + "shaper"; } else { anEnv = getenv("CADBUILDER_ROOT_DIR"); if (anEnv) { @@ -96,33 +94,34 @@ std::string Config_XMLReader::pluginConfigFile() } // LCOV_EXCL_STOP -std::string Config_XMLReader::findConfigFile(const std::string theFileName, const int theFindIndex) -{ +std::string Config_XMLReader::findConfigFile(const std::string theFileName, + const int theFindIndex) { int aResultIndex = 0; - for(int aSolution = 0; aSolution < 12; aSolution++) { + for (int aSolution = 0; aSolution < 12; aSolution++) { std::string aFileName; if (aSolution == 0) { - Config_Prop* aProp = Config_PropManager::findProp("Plugins", "default_path"); + Config_Prop *aProp = + Config_PropManager::findProp("Plugins", "default_path"); if (!aProp) continue; aFileName = aProp->value(); } else { std::ostringstream anEnvName; if (aSolution == 1) - anEnvName<<"SHAPER_ROOT_DIR"; + anEnvName << "SHAPER_ROOT_DIR"; else if (aSolution == 2) - anEnvName<<"CADBUILDER_ROOT_DIR"; + anEnvName << "CADBUILDER_ROOT_DIR"; else - anEnvName<<"CADBUILDER_ROOT_DIR"; + anEnvName << "CADBUILDER_ROOT_DIR"; - char* anEnv = getenv(anEnvName.str().c_str()); + char *anEnv = getenv(anEnvName.str().c_str()); if (!anEnv) continue; if (aSolution > 2) { // there may be several paths separated by ";" symbol -// LCOV_EXCL_START + // LCOV_EXCL_START std::string anEnvPart = anEnv; size_t aPosStart = 0, aPosEnd; - for(int aSubNum = 0; aSubNum < aSolution - 3; aSubNum++) { + for (int aSubNum = 0; aSubNum < aSolution - 3; aSubNum++) { aPosStart++; aPosStart = anEnvPart.find(';', aPosStart); if (aPosStart == std::string::npos) @@ -133,14 +132,17 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons if (aPosStart != 0) aPosStart++; aPosEnd = anEnvPart.find(';', aPosStart); - aFileName = anEnvPart.substr(aPosStart, - aPosEnd == std::string::npos ? aPosEnd : aPosEnd - aPosStart) + FSEP; -// LCOV_EXCL_STOP + aFileName = anEnvPart.substr(aPosStart, aPosEnd == std::string::npos + ? aPosEnd + : aPosEnd - aPosStart) + + FSEP; + // LCOV_EXCL_STOP } else { aFileName = std::string(anEnv) + FSEP; } if (aSolution == 1) - aFileName += std::string("share") + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; + aFileName += std::string("share") + FSEP + "salome" + FSEP + + "resources" + FSEP + "shaper"; else if (aSolution == 2) aFileName += "plugins"; } @@ -151,17 +153,18 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons if (aResultIndex == theFindIndex) return aFileName; aResultIndex++; - if (aSolution == 1) // don't allow SHAPER and CADBuilder paths treated simultaneously + if (aSolution == + 1) // don't allow SHAPER and CADBuilder paths treated simultaneously aSolution++; } } return ""; // no files found } -void Config_XMLReader::readAll() -{ +void Config_XMLReader::readAll() { if (isFromMemory) { - myXmlDoc = xmlParseMemory(myRootFileName.c_str(), (int)myRootFileName.length()); + myXmlDoc = + xmlParseMemory(myRootFileName.c_str(), (int)myRootFileName.length()); xmlNodePtr aRoot = xmlDocGetRootElement(myXmlDoc); readRecursively(aRoot); return; @@ -170,13 +173,14 @@ void Config_XMLReader::readAll() // to load external modules dependencies (like GEOM for Connector Feature) Config_ModuleReader::loadScript("salome.shaper.initConfig", false); - for(int aSolution = 0; true; aSolution++) { + for (int aSolution = 0; true; aSolution++) { std::string aFoundFile = findConfigFile(myRootFileName, aSolution); if (aFoundFile.empty()) { break; // no more solutions } - if (myXmlDoc != NULL) { // clear the previous XML document - now the new one will be opened + if (myXmlDoc != NULL) { // clear the previous XML document - now the new one + // will be opened xmlFreeDoc(myXmlDoc); myXmlDoc = NULL; } @@ -185,59 +189,56 @@ void Config_XMLReader::readAll() } } -void Config_XMLReader::processNode(xmlNodePtr theNode) -{ +void Config_XMLReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_SOURCE, NULL)) { std::string aSourceFile = getProperty(theNode, SOURCE_FILE); Config_XMLReader aSourceReader = Config_XMLReader(aSourceFile); readRecursively(aSourceReader.findRoot()); #ifdef _DEBUG - //std::cout << "Config_XMLReader::sourced node: " << aSourceFile << std::endl; + // std::cout << "Config_XMLReader::sourced node: " << aSourceFile << + // std::endl; #endif } } -void Config_XMLReader::cleanup(xmlNodePtr) -{ +void Config_XMLReader::cleanup(xmlNodePtr) { // do nothing; } // LCOV_EXCL_START -bool Config_XMLReader::processChildren(xmlNodePtr /*aNode*/) -{ - return true; -} +bool Config_XMLReader::processChildren(xmlNodePtr /*aNode*/) { return true; } // LCOV_EXCL_STOP -xmlNodePtr Config_XMLReader::findRoot(const std::string theDocumentPath) -{ - std::string aDocPath = theDocumentPath.empty() ? myDocumentPath : theDocumentPath; +xmlNodePtr Config_XMLReader::findRoot(const std::string theDocumentPath) { + std::string aDocPath = + theDocumentPath.empty() ? myDocumentPath : theDocumentPath; if (myXmlDoc == NULL) { myXmlDoc = xmlParseFile(aDocPath.c_str()); } if (myXmlDoc == NULL) { #ifdef _DEBUG - std::cout << "Config_XMLReader::import: " << "Document " << aDocPath - << " is not parsed successfully." << std::endl; + std::cout << "Config_XMLReader::import: " + << "Document " << aDocPath << " is not parsed successfully." + << std::endl; #endif return NULL; } xmlNodePtr aRoot = xmlDocGetRootElement(myXmlDoc); #ifdef _DEBUG - if(aRoot == NULL) { - std::cout << "Config_XMLReader::import: " << "Error: empty document"; + if (aRoot == NULL) { + std::cout << "Config_XMLReader::import: " + << "Error: empty document"; } #endif return aRoot; } -void Config_XMLReader::readRecursively(xmlNodePtr theParent) -{ +void Config_XMLReader::readRecursively(xmlNodePtr theParent) { if (!theParent) return; xmlNodePtr aNode = theParent->xmlChildrenNode; for (; aNode; aNode = aNode->next) { - //Still no text processing in features... + // Still no text processing in features... if (!isElementNode(aNode)) { continue; } @@ -250,24 +251,22 @@ void Config_XMLReader::readRecursively(xmlNodePtr theParent) } // LCOV_EXCL_START -xmlNodePtr Config_XMLReader::node(void* theNode) -{ +xmlNodePtr Config_XMLReader::node(void *theNode) { return static_cast(theNode); } // LCOV_EXCL_STOP -std::string Config_XMLReader::getNodeName(xmlNodePtr theNode) -{ +std::string Config_XMLReader::getNodeName(xmlNodePtr theNode) { std::string result = ""; - char* aPropChars = (char*) theNode->name; + char *aPropChars = (char *)theNode->name; if (!aPropChars || aPropChars[0] == 0) return result; result = std::string(aPropChars); return result; } -void Config_XMLReader::storeAttribute(xmlNodePtr theNode, const char* theAttribute, bool doClean) -{ +void Config_XMLReader::storeAttribute(xmlNodePtr theNode, + const char *theAttribute, bool doClean) { std::string aKey = getNodeName(theNode) + ":" + std::string(theAttribute); std::string aValue = getProperty(theNode, theAttribute); if (doClean || !aValue.empty()) { @@ -276,33 +275,35 @@ void Config_XMLReader::storeAttribute(xmlNodePtr theNode, const char* theAttribu } // LCOV_EXCL_START -std::string Config_XMLReader::restoreAttribute(xmlNodePtr theNode, const char* theAttribute) -{ +std::string Config_XMLReader::restoreAttribute(xmlNodePtr theNode, + const char *theAttribute) { return restoreAttribute(getNodeName(theNode).c_str(), theAttribute); } // LCOV_EXCL_STOP -std::string Config_XMLReader::restoreAttribute(const char* theNodeName, const char* theAttribute) -{ +std::string Config_XMLReader::restoreAttribute(const char *theNodeName, + const char *theAttribute) { std::string aKey = std::string(theNodeName) + ":" + std::string(theAttribute); std::string result = ""; - if(myCachedAttributes.find(aKey) != myCachedAttributes.end()) { + if (myCachedAttributes.find(aKey) != myCachedAttributes.end()) { result = myCachedAttributes[aKey]; } return result; } -bool Config_XMLReader::cleanupAttribute(xmlNodePtr theNode, const char* theNodeAttribute) -{ +bool Config_XMLReader::cleanupAttribute(xmlNodePtr theNode, + const char *theNodeAttribute) { return cleanupAttribute(getNodeName(theNode).c_str(), theNodeAttribute); } -bool Config_XMLReader::cleanupAttribute(const char* theNodeName, const char* theNodeAttribute) -{ - std::string aKey = std::string(theNodeName) + ":" + std::string(theNodeAttribute); +bool Config_XMLReader::cleanupAttribute(const char *theNodeName, + const char *theNodeAttribute) { + std::string aKey = + std::string(theNodeName) + ":" + std::string(theNodeAttribute); bool result = false; - std::map::iterator anEntry = myCachedAttributes.find(aKey); - if( anEntry != myCachedAttributes.end()) { + std::map::iterator anEntry = + myCachedAttributes.find(aKey); + if (anEntry != myCachedAttributes.end()) { myCachedAttributes.erase(anEntry); result = true; } @@ -310,8 +311,7 @@ bool Config_XMLReader::cleanupAttribute(const char* theNodeName, const char* the } // LCOV_EXCL_START -const char* Config_XMLReader::encoding() const -{ - return (const char*) myXmlDoc->encoding; +const char *Config_XMLReader::encoding() const { + return (const char *)myXmlDoc->encoding; } // LCOV_EXCL_STOP diff --git a/src/Config/Config_XMLReader.h b/src/Config/Config_XMLReader.h index 18a8b6351..681c1bd5f 100644 --- a/src/Config/Config_XMLReader.h +++ b/src/Config/Config_XMLReader.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_XMLREADER_H_ @@ -23,8 +24,8 @@ #include #include -#include #include +#include //>> Forward declaration of xmlNodePtr. typedef struct _xmlNode xmlNode; @@ -43,24 +44,25 @@ struct _xmlDoc; * \ingroup Config * \brief Base class for all libxml readers. Provides high-level API * for all xml operations. -*/ -class Config_XMLReader -{ - public: + */ +class Config_XMLReader { +public: /*! * Constructor - * \param theXmlFile - full path to the xml file which will be processed by the reader + * \param theXmlFile - full path to the xml file which will be processed by + * the reader */ - CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile, bool isXMLContent = false); + CONFIG_EXPORT Config_XMLReader(const std::string &theXmlFile, + bool isXMLContent = false); CONFIG_EXPORT virtual ~Config_XMLReader(); /*! - * Returns a path to resource files (created from ROOT_DIR environment variable) - * \return string value + * Returns a path to resource files (created from ROOT_DIR environment + * variable) \return string value */ CONFIG_EXPORT static std::string resourcesConfigFile(); /*! - * Returns a path to the plugins.xml file (created from ROOT_DIR environment variable) - * \return string value + * Returns a path to the plugins.xml file (created from ROOT_DIR environment + * variable) \return string value */ CONFIG_EXPORT static std::string pluginConfigFile(); /*! @@ -75,14 +77,15 @@ class Config_XMLReader */ CONFIG_EXPORT xmlNodePtr findRoot(const std::string theDocumentPath = ""); - CONFIG_EXPORT const char* encoding() const; + CONFIG_EXPORT const char *encoding() const; /// Checks all possible paths to configuration file given - /// Uses theFindIndex if several solutions can be found (this is the number of solution to find) - CONFIG_EXPORT static std::string - findConfigFile(const std::string theFileName, const int theFindIndex = 0); + /// Uses theFindIndex if several solutions can be found (this is the number of + /// solution to find) + CONFIG_EXPORT static std::string findConfigFile(const std::string theFileName, + const int theFindIndex = 0); - protected: +protected: /*! * \brief Allows to customize reader's behavior for a node. Virtual. * The default implementation process "source" and "validator" nodes. @@ -91,7 +94,8 @@ class Config_XMLReader /*! * This method gives an ability to finalize processing of a node, - * when reader is about to leave the node (node and all it's children are processed) + * when reader is about to leave the node (node and all it's children are + * processed) */ virtual void cleanup(xmlNodePtr aNode); /*! @@ -108,24 +112,28 @@ class Config_XMLReader /*! * \brief void* -> xmlNodePtr */ - xmlNodePtr node(void* theNode); + xmlNodePtr node(void *theNode); /// Gets xml node name std::string getNodeName(xmlNodePtr theNode); /// Stores an attribute in internal map for later use. - /// Key is "Node_Name:Node_Attribute" and value is getProperty(theNodeAttribute) - void storeAttribute(xmlNodePtr theNode, const char* theNodeAttribute, bool doClean = false); + /// Key is "Node_Name:Node_Attribute" and value is + /// getProperty(theNodeAttribute) + void storeAttribute(xmlNodePtr theNode, const char *theNodeAttribute, + bool doClean = false); /// Restores an attribute from internal map. - std::string restoreAttribute(xmlNodePtr theNode, const char* theNodeAttribute); + std::string restoreAttribute(xmlNodePtr theNode, + const char *theNodeAttribute); /// Restores an attribute from internal map. - std::string restoreAttribute(const char* theNodeName, const char* theNodeAttribute); + std::string restoreAttribute(const char *theNodeName, + const char *theNodeAttribute); /// Cleanups attribute from cache - bool cleanupAttribute(xmlNodePtr theNode, const char* theNodeAttribute); + bool cleanupAttribute(xmlNodePtr theNode, const char *theNodeAttribute); /// Cleanups attribute from cache - bool cleanupAttribute(const char* theNodeName, const char* theNodeAttribute); + bool cleanupAttribute(const char *theNodeName, const char *theNodeAttribute); - protected: +protected: std::string myDocumentPath; ///< Path to the xml document - xmlDocPtr myXmlDoc; ///< Root of the xml document + xmlDocPtr myXmlDoc; ///< Root of the xml document std::string myRootFileName; ///< name of the root file /// A map to store all parent's attributes. /// The key has from "Node_Name:Node_Attribute" diff --git a/src/Config/Config_def.h b/src/Config/Config_def.h index 0644bc366..a61741f5c 100644 --- a/src/Config/Config_def.h +++ b/src/Config/Config_def.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONFIG_H @@ -22,13 +23,13 @@ #if defined CONFIG_EXPORTS #if defined WIN32 -#define CONFIG_EXPORT __declspec( dllexport ) +#define CONFIG_EXPORT __declspec(dllexport) #else #define CONFIG_EXPORT #endif #else #if defined WIN32 -#define CONFIG_EXPORT __declspec( dllimport ) +#define CONFIG_EXPORT __declspec(dllimport) #else #define CONFIG_EXPORT #endif @@ -40,4 +41,4 @@ #define MAYBE_UNUSED #endif -#endif //CONFIG_H +#endif // CONFIG_H diff --git a/src/Config/Config_swig.h b/src/Config/Config_swig.h index c2a3c9e9f..a35eb3540 100644 --- a/src/Config/Config_swig.h +++ b/src/Config/Config_swig.h @@ -14,24 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONFIG_SWIG_H_ #define SRC_CONFIG_SWIG_H_ - #include "Config_ModuleReader.h" - #include "Config_Prop.h" - #include "Config_PropManager.h" - #include "Config_ValidatorReader.h" - #include "Config_XMLReader.h" +#include "Config_ModuleReader.h" +#include "Config_Prop.h" +#include "Config_PropManager.h" +#include "Config_ValidatorReader.h" +#include "Config_XMLReader.h" - #ifdef _MSC_VER - # pragma warning(disable: 4127) // conditional expression is constant - # pragma warning(disable: 4456) // declaration of variable hides previous local declaration - # pragma warning(disable: 4459) // declaration of variable hides global declaration - # pragma warning(disable: 4701) // potentially uninitialized local variable - # pragma warning(disable: 4703) // potentially uninitialized local pointer variable - #endif +#ifdef _MSC_VER +#pragma warning(disable : 4127) // conditional expression is constant +#pragma warning(disable : 4456) // declaration of variable hides previous local + // declaration +#pragma warning( \ + disable : 4459) // declaration of variable hides global declaration +#pragma warning(disable : 4701) // potentially uninitialized local variable +#pragma warning( \ + disable : 4703) // potentially uninitialized local pointer variable +#endif #endif /* SRC_CONFIG_SWIG_H_ */ diff --git a/src/Config/dataModel.xml b/src/Config/dataModel.xml index 0d79b9be0..00ac50318 100644 --- a/src/Config/dataModel.xml +++ b/src/Config/dataModel.xml @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/src/ConnectorAPI/ConnectorAPI.h b/src/ConnectorAPI/ConnectorAPI.h index a3a803537..7d1b79d7e 100644 --- a/src/ConnectorAPI/ConnectorAPI.h +++ b/src/ConnectorAPI/ConnectorAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONNECTORAPI_H @@ -22,13 +23,13 @@ #if defined CONNECTORAPI_EXPORTS #if defined WIN32 -#define CONNECTORAPI_EXPORT __declspec( dllexport ) +#define CONNECTORAPI_EXPORT __declspec(dllexport) #else #define CONNECTORAPI_EXPORT #endif #else #if defined WIN32 -#define CONNECTORAPI_EXPORT __declspec( dllimport ) +#define CONNECTORAPI_EXPORT __declspec(dllimport) #else #define CONNECTORAPI_EXPORT #endif diff --git a/src/ConnectorAPI/ConnectorAPI_Connector.cpp b/src/ConnectorAPI/ConnectorAPI_Connector.cpp index f9faf59cc..3ef1e3907 100644 --- a/src/ConnectorAPI/ConnectorAPI_Connector.cpp +++ b/src/ConnectorAPI/ConnectorAPI_Connector.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConnectorAPI_Connector.h" @@ -22,8 +23,8 @@ #include #include //-------------------------------------------------------------------------------------- -void exportToGEOM(const std::shared_ptr & thePart) -{ +void exportToGEOM(const std::shared_ptr &thePart) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature("ExportToGEOM"); + std::shared_ptr aFeature = + thePart->addFeature("ExportToGEOM"); } diff --git a/src/ConnectorAPI/ConnectorAPI_Connector.h b/src/ConnectorAPI/ConnectorAPI_Connector.h index 18c31cff6..a9aae7a11 100644 --- a/src/ConnectorAPI/ConnectorAPI_Connector.h +++ b/src/ConnectorAPI/ConnectorAPI_Connector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONNECTORAPI_CONNECTORAPI_PART_H_ @@ -31,7 +32,7 @@ class ModelAPI_Document; * \brief Export to GEOM */ CONNECTORAPI_EXPORT -void exportToGEOM(const std::shared_ptr & thePart); +void exportToGEOM(const std::shared_ptr &thePart); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/ConnectorAPI/ConnectorAPI_swig.h b/src/ConnectorAPI/ConnectorAPI_swig.h index c1b62ee44..afc87f0d4 100644 --- a/src/ConnectorAPI/ConnectorAPI_swig.h +++ b/src/ConnectorAPI/ConnectorAPI_swig.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_ #define SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_ - #include +#include - #include "ConnectorAPI_Connector.h" +#include "ConnectorAPI_Connector.h" #endif /* SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_ */ diff --git a/src/ConnectorAPI/Test/TestImportSTEP.py b/src/ConnectorAPI/Test/TestImportSTEP.py index 7cd15dc66..2cc52d0fc 100644 --- a/src/ConnectorAPI/Test/TestImportSTEP.py +++ b/src/ConnectorAPI/Test/TestImportSTEP.py @@ -19,7 +19,7 @@ """ TestImportStep.py - Unit test of ExchangePlugin_ImportFeature class for STEP + Unit test of ExchangePlugin_ImportFeature class for STEP """ # ========================================================================= # Initialization of the test diff --git a/src/ConnectorAPI/Test/data/cube_ascii.stl b/src/ConnectorAPI/Test/data/cube_ascii.stl index 125cfe199..516328366 100755 --- a/src/ConnectorAPI/Test/data/cube_ascii.stl +++ b/src/ConnectorAPI/Test/data/cube_ascii.stl @@ -1,4 +1,4 @@ -solid +solid facet normal -1.000000e+00 0.000000e+00 0.000000e+00 outer loop vertex 0.000000e+00 0.000000e+00 0.000000e+00 diff --git a/src/ConnectorPlugin/doc/ConnectorPlugin.rst b/src/ConnectorPlugin/doc/ConnectorPlugin.rst index aa775167f..dea5c8801 100644 --- a/src/ConnectorPlugin/doc/ConnectorPlugin.rst +++ b/src/ConnectorPlugin/doc/ConnectorPlugin.rst @@ -14,4 +14,4 @@ Connector plug-in is used to export Results, Groups, Fields created in active pa :param part: The current part object -The result can be checked in GEOM module. \ No newline at end of file +The result can be checked in GEOM module. diff --git a/src/ConnectorPlugin/plugin-Connector.xml b/src/ConnectorPlugin/plugin-Connector.xml index e8042523a..9bb21ac53 100644 --- a/src/ConnectorPlugin/plugin-Connector.xml +++ b/src/ConnectorPlugin/plugin-Connector.xml @@ -13,4 +13,4 @@ internal="1"/> - \ No newline at end of file + diff --git a/src/ConstructionAPI/CMakeLists.txt b/src/ConstructionAPI/CMakeLists.txt index 674674acc..f6479584b 100644 --- a/src/ConstructionAPI/CMakeLists.txt +++ b/src/ConstructionAPI/CMakeLists.txt @@ -106,16 +106,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ConstructionAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ConstructionAPI/ConstructionAPI.h b/src/ConstructionAPI/ConstructionAPI.h index 980b8a95d..2ce23486b 100644 --- a/src/ConstructionAPI/ConstructionAPI.h +++ b/src/ConstructionAPI/ConstructionAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONSTRUCTIONAPI_H @@ -22,13 +23,13 @@ #if defined CONSTRUCTIONAPI_EXPORTS #if defined WIN32 -#define CONSTRUCTIONAPI_EXPORT __declspec( dllexport ) +#define CONSTRUCTIONAPI_EXPORT __declspec(dllexport) #else #define CONSTRUCTIONAPI_EXPORT #endif #else #if defined WIN32 -#define CONSTRUCTIONAPI_EXPORT __declspec( dllimport ) +#define CONSTRUCTIONAPI_EXPORT __declspec(dllimport) #else #define CONSTRUCTIONAPI_EXPORT #endif diff --git a/src/ConstructionAPI/ConstructionAPI_Axis.cpp b/src/ConstructionAPI/ConstructionAPI_Axis.cpp index d54a64544..8c10c548f 100644 --- a/src/ConstructionAPI/ConstructionAPI_Axis.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Axis.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionAPI_Axis.h" @@ -23,123 +24,116 @@ #include //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1); GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2); - if(aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::VERTEX) { + if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::VERTEX) { setByPoints(theObject1, theObject2); - } else if(aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::VERTEX) { + } else if (aType1 == GeomAPI_Shape::FACE && + aType2 == GeomAPI_Shape::VERTEX) { setByPlaneAndPoint(theObject1, theObject2); - } else if(aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::FACE) { + } else if (aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::FACE) { setByTwoPlanes(theObject1, theObject2); } } } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { GeomAPI_Shape::ShapeType aType = getShapeType(theObject); - if(aType == GeomAPI_Shape::EDGE) { + if (aType == GeomAPI_Shape::EDGE) { setByLine(theObject); - } else if(aType == GeomAPI_Shape::FACE) { + } else if (aType == GeomAPI_Shape::FACE) { setByCylindricalFace(theObject); } } } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePoint, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePoint, const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, const ModelHighAPI_Double &theZ) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByPointAndDirection(thePoint, theX, theY, theZ); } } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theDX, - const ModelHighAPI_Double& theDY, - const ModelHighAPI_Double& theDZ) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theDX, const ModelHighAPI_Double &theDY, + const ModelHighAPI_Double &theDZ) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByDimensions(theDX, theDY, theDZ); } } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, - const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, - const bool theReverseOffset2) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { - setByTwoPlanes(thePlane1, theOffset1, theReverseOffset1, - thePlane2, theOffset2, theReverseOffset2); +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { + setByTwoPlanes(thePlane1, theOffset1, theReverseOffset1, thePlane2, + theOffset2, theReverseOffset2); } } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, - const bool theReverseOffset2) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByTwoPlanes(thePlane1, thePlane2, theOffset2, theReverseOffset2); } } //================================================================================================== -ConstructionAPI_Axis::ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, - const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Axis::ConstructionAPI_Axis( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, + const ModelHighAPI_Selection &thePlane2) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByTwoPlanes(thePlane1, theOffset1, theReverseOffset1, thePlane2); } } //================================================================================================== -ConstructionAPI_Axis::~ConstructionAPI_Axis() -{ -} +ConstructionAPI_Axis::~ConstructionAPI_Axis() {} //================================================================================================== -void ConstructionAPI_Axis::setByPoints(const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_POINTS(), creationMethod()); +void ConstructionAPI_Axis::setByPoints( + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_POINTS(), + creationMethod()); fillAttribute(thePoint1, firstPoint()); fillAttribute(thePoint2, secondPoint()); @@ -147,22 +141,22 @@ void ConstructionAPI_Axis::setByPoints(const ModelHighAPI_Selection& thePoint1, } //================================================================================================== -void ConstructionAPI_Axis::setByCylindricalFace(const ModelHighAPI_Selection& theCylindricalFace) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_CYLINDRICAL_FACE(), creationMethod()); +void ConstructionAPI_Axis::setByCylindricalFace( + const ModelHighAPI_Selection &theCylindricalFace) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_CYLINDRICAL_FACE(), + creationMethod()); fillAttribute(theCylindricalFace, cylindricalFace()); execute(); } //================================================================================================== -void ConstructionAPI_Axis::setByPointAndDirection(const ModelHighAPI_Selection& thePoint, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_POINT_AND_DIRECTION(), - creationMethod()); +void ConstructionAPI_Axis::setByPointAndDirection( + const ModelHighAPI_Selection &thePoint, const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, const ModelHighAPI_Double &theZ) { + fillAttribute( + ConstructionPlugin_Axis::CREATION_METHOD_BY_POINT_AND_DIRECTION(), + creationMethod()); fillAttribute(thePoint, firstPoint()); fillAttribute(theX, xDirection()); fillAttribute(theY, yDirection()); @@ -172,11 +166,11 @@ void ConstructionAPI_Axis::setByPointAndDirection(const ModelHighAPI_Selection& } //================================================================================================== -void ConstructionAPI_Axis::setByDimensions(const ModelHighAPI_Double& theDX, - const ModelHighAPI_Double& theDY, - const ModelHighAPI_Double& theDZ) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_DIMENSIONS(), creationMethod()); +void ConstructionAPI_Axis::setByDimensions(const ModelHighAPI_Double &theDX, + const ModelHighAPI_Double &theDY, + const ModelHighAPI_Double &theDZ) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_DIMENSIONS(), + creationMethod()); fillAttribute(theDX, xDimension()); fillAttribute(theDY, yDimension()); fillAttribute(theDZ, zDimension()); @@ -185,19 +179,20 @@ void ConstructionAPI_Axis::setByDimensions(const ModelHighAPI_Double& theDX, } //================================================================================================== -void ConstructionAPI_Axis::setByLine(const ModelHighAPI_Selection& theLine) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_LINE(), creationMethod()); +void ConstructionAPI_Axis::setByLine(const ModelHighAPI_Selection &theLine) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_LINE(), + creationMethod()); fillAttribute(theLine, line()); execute(); } //================================================================================================== -void ConstructionAPI_Axis::setByPlaneAndPoint(const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& thePoint) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_PLANE_AND_POINT(), creationMethod()); +void ConstructionAPI_Axis::setByPlaneAndPoint( + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &thePoint) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_PLANE_AND_POINT(), + creationMethod()); fillAttribute(thePlane, plane()); fillAttribute(thePoint, point()); @@ -205,10 +200,11 @@ void ConstructionAPI_Axis::setByPlaneAndPoint(const ModelHighAPI_Selection& theP } //================================================================================================== -void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), creationMethod()); +void ConstructionAPI_Axis::setByTwoPlanes( + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), + creationMethod()); fillAttribute(thePlane1, plane1()); fillAttribute("", useOffset1()); fillAttribute(thePlane2, plane2()); @@ -218,14 +214,13 @@ void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane } //================================================================================================== -void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, - const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, - const bool theReverseOffset2) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), creationMethod()); +void ConstructionAPI_Axis::setByTwoPlanes( + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), + creationMethod()); fillAttribute(thePlane1, plane1()); fillAttribute(ConstructionPlugin_Axis::USE_OFFSET1(), useOffset1()); fillAttribute(theOffset1, offset1()); @@ -239,12 +234,12 @@ void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane } //================================================================================================== -void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, - const bool theReverseOffset2) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), creationMethod()); +void ConstructionAPI_Axis::setByTwoPlanes( + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), + creationMethod()); fillAttribute(thePlane1, plane1()); fillAttribute("", useOffset1()); fillAttribute(thePlane2, plane2()); @@ -256,12 +251,12 @@ void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane } //================================================================================================== -void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, - const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2) -{ - fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), creationMethod()); +void ConstructionAPI_Axis::setByTwoPlanes( + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, + const ModelHighAPI_Selection &thePlane2) { + fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES(), + creationMethod()); fillAttribute(thePlane1, plane1()); fillAttribute(ConstructionPlugin_Axis::USE_OFFSET1(), useOffset1()); fillAttribute(theOffset1, offset1()); @@ -273,154 +268,181 @@ void ConstructionAPI_Axis::setByTwoPlanes(const ModelHighAPI_Selection& thePlane } //================================================================================================== -void ConstructionAPI_Axis::dump(ModelHighAPI_Dumper& theDumper) const -{ +void ConstructionAPI_Axis::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addAxis(" << aDocName; - std::string aCreationMethod = aBase->string(ConstructionPlugin_Axis::METHOD())->value(); + std::string aCreationMethod = + aBase->string(ConstructionPlugin_Axis::METHOD())->value(); - if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_DIMENSIONS()) { + if (aCreationMethod == + ConstructionPlugin_Axis::CREATION_METHOD_BY_DIMENSIONS()) { AttributeDoublePtr anAttrDX = aBase->real(ConstructionPlugin_Axis::DX()); AttributeDoublePtr anAttrDY = aBase->real(ConstructionPlugin_Axis::DY()); AttributeDoublePtr anAttrDZ = aBase->real(ConstructionPlugin_Axis::DZ()); theDumper << ", " << anAttrDX << ", " << anAttrDY << ", " << anAttrDZ; - } else if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_POINTS()) { + } else if (aCreationMethod == + ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_POINTS()) { AttributeSelectionPtr anAttrFirstPnt = - aBase->selection(ConstructionPlugin_Axis::POINT_FIRST()); + aBase->selection(ConstructionPlugin_Axis::POINT_FIRST()); AttributeSelectionPtr anAttrSecondPnt = - aBase->selection(ConstructionPlugin_Axis::POINT_SECOND()); + aBase->selection(ConstructionPlugin_Axis::POINT_SECOND()); theDumper << ", " << anAttrFirstPnt << ", " << anAttrSecondPnt; - } else if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_LINE()) { - AttributeSelectionPtr anAttrLine = aBase->selection(ConstructionPlugin_Axis::LINE()); + } else if (aCreationMethod == + ConstructionPlugin_Axis::CREATION_METHOD_BY_LINE()) { + AttributeSelectionPtr anAttrLine = + aBase->selection(ConstructionPlugin_Axis::LINE()); theDumper << ", " << anAttrLine; - } else if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_CYLINDRICAL_FACE()) { + } else if (aCreationMethod == + ConstructionPlugin_Axis::CREATION_METHOD_BY_CYLINDRICAL_FACE()) { AttributeSelectionPtr anAttrFace = - aBase->selection(ConstructionPlugin_Axis::CYLINDRICAL_FACE()); + aBase->selection(ConstructionPlugin_Axis::CYLINDRICAL_FACE()); theDumper << ", " << anAttrFace; - } else if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_PLANE_AND_POINT()) { - AttributeSelectionPtr anAttrPlane = aBase->selection(ConstructionPlugin_Axis::PLANE()); - AttributeSelectionPtr anAttrPoint = aBase->selection(ConstructionPlugin_Axis::POINT()); + } else if (aCreationMethod == + ConstructionPlugin_Axis::CREATION_METHOD_BY_PLANE_AND_POINT()) { + AttributeSelectionPtr anAttrPlane = + aBase->selection(ConstructionPlugin_Axis::PLANE()); + AttributeSelectionPtr anAttrPoint = + aBase->selection(ConstructionPlugin_Axis::POINT()); theDumper << ", " << anAttrPlane << ", " << anAttrPoint; - } else if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES()) { - AttributeSelectionPtr anAttrPlane1 = aBase->selection(ConstructionPlugin_Axis::PLANE1()); - AttributeSelectionPtr anAttrPlane2 = aBase->selection(ConstructionPlugin_Axis::PLANE2()); + } else if (aCreationMethod == + ConstructionPlugin_Axis::CREATION_METHOD_BY_TWO_PLANES()) { + AttributeSelectionPtr anAttrPlane1 = + aBase->selection(ConstructionPlugin_Axis::PLANE1()); + AttributeSelectionPtr anAttrPlane2 = + aBase->selection(ConstructionPlugin_Axis::PLANE2()); theDumper << ", " << anAttrPlane1; - if(aBase->string(ConstructionPlugin_Axis::USE_OFFSET1())->isInitialized() - && !aBase->string(ConstructionPlugin_Axis::USE_OFFSET1())->value().empty()) { - AttributeDoublePtr anAttrOffset1 = aBase->real(ConstructionPlugin_Axis::OFFSET1()); + if (aBase->string(ConstructionPlugin_Axis::USE_OFFSET1()) + ->isInitialized() && + !aBase->string(ConstructionPlugin_Axis::USE_OFFSET1()) + ->value() + .empty()) { + AttributeDoublePtr anAttrOffset1 = + aBase->real(ConstructionPlugin_Axis::OFFSET1()); AttributeBooleanPtr anAttrReverseOffset1 = - aBase->boolean(ConstructionPlugin_Axis::REVERSE_OFFSET1()); + aBase->boolean(ConstructionPlugin_Axis::REVERSE_OFFSET1()); theDumper << ", " << anAttrOffset1 << ", " << anAttrReverseOffset1; } theDumper << ", " << anAttrPlane2; - if(aBase->string(ConstructionPlugin_Axis::USE_OFFSET2())->isInitialized() - && !aBase->string(ConstructionPlugin_Axis::USE_OFFSET2())->value().empty()) { - AttributeDoublePtr anAttrOffset2 = aBase->real(ConstructionPlugin_Axis::OFFSET2()); + if (aBase->string(ConstructionPlugin_Axis::USE_OFFSET2()) + ->isInitialized() && + !aBase->string(ConstructionPlugin_Axis::USE_OFFSET2()) + ->value() + .empty()) { + AttributeDoublePtr anAttrOffset2 = + aBase->real(ConstructionPlugin_Axis::OFFSET2()); AttributeBooleanPtr anAttrReverseOffset2 = - aBase->boolean(ConstructionPlugin_Axis::REVERSE_OFFSET2()); + aBase->boolean(ConstructionPlugin_Axis::REVERSE_OFFSET2()); theDumper << ", " << anAttrOffset2 << ", " << anAttrReverseOffset2; } - } else if(aCreationMethod == ConstructionPlugin_Axis::CREATION_METHOD_BY_POINT_AND_DIRECTION()) { - AttributeSelectionPtr anAttrFirstPnt = aBase->selection(ConstructionPlugin_Axis::POINT_FIRST()); - AttributeDoublePtr anAttrX = aBase->real(ConstructionPlugin_Axis::X_DIRECTION()); - AttributeDoublePtr anAttrY = aBase->real(ConstructionPlugin_Axis::Y_DIRECTION()); - AttributeDoublePtr anAttrZ = aBase->real(ConstructionPlugin_Axis::Z_DIRECTION()); - - theDumper << ", " << anAttrFirstPnt << ", " << anAttrX << ", " << anAttrY << ", " << anAttrZ; + } else if (aCreationMethod == ConstructionPlugin_Axis:: + CREATION_METHOD_BY_POINT_AND_DIRECTION()) { + AttributeSelectionPtr anAttrFirstPnt = + aBase->selection(ConstructionPlugin_Axis::POINT_FIRST()); + AttributeDoublePtr anAttrX = + aBase->real(ConstructionPlugin_Axis::X_DIRECTION()); + AttributeDoublePtr anAttrY = + aBase->real(ConstructionPlugin_Axis::Y_DIRECTION()); + AttributeDoublePtr anAttrZ = + aBase->real(ConstructionPlugin_Axis::Z_DIRECTION()); + + theDumper << ", " << anAttrFirstPnt << ", " << anAttrX << ", " << anAttrY + << ", " << anAttrZ; } theDumper << ")" << std::endl; } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2) -{ +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); return AxisPtr(new ConstructionAPI_Axis(aFeature, theObject1, theObject2)); } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject) -{ +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); return AxisPtr(new ConstructionAPI_Axis(aFeature, theObject)); } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ) -{ +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); - return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint, theX, theY, theZ)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); + return AxisPtr( + new ConstructionAPI_Axis(aFeature, thePoint, theX, theY, theZ)); } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theDX, - const ModelHighAPI_Double& theDY, - const ModelHighAPI_Double& theDZ) -{ +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theDX, + const ModelHighAPI_Double &theDY, + const ModelHighAPI_Double &theDZ) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); return AxisPtr(new ConstructionAPI_Axis(aFeature, theDX, theDY, theDZ)); } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, - const bool theReverseOffset2) -{ + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, + const bool theReverseOffset2) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); - return AxisPtr(new ConstructionAPI_Axis(aFeature, thePlane1, theOffset1, theReverseOffset1, - thePlane2, theOffset2, theReverseOffset2)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); + return AxisPtr(new ConstructionAPI_Axis(aFeature, thePlane1, theOffset1, + theReverseOffset1, thePlane2, + theOffset2, theReverseOffset2)); } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, - const bool theReverseOffset2) -{ +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, + const bool theReverseOffset2) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); - return AxisPtr(new ConstructionAPI_Axis(aFeature, thePlane1, - thePlane2, theOffset2, theReverseOffset2)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); + return AxisPtr(new ConstructionAPI_Axis(aFeature, thePlane1, thePlane2, + theOffset2, theReverseOffset2)); } //================================================================================================== -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2) -{ + const ModelHighAPI_Selection &thePlane2) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Axis::ID()); - return AxisPtr(new ConstructionAPI_Axis(aFeature, thePlane1, theOffset1, theReverseOffset1, - thePlane2)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Axis::ID()); + return AxisPtr(new ConstructionAPI_Axis(aFeature, thePlane1, theOffset1, + theReverseOffset1, thePlane2)); } diff --git a/src/ConstructionAPI/ConstructionAPI_Axis.h b/src/ConstructionAPI/ConstructionAPI_Axis.h index f2d7f0c1a..21fb527a9 100644 --- a/src/ConstructionAPI/ConstructionAPI_Axis.h +++ b/src/ConstructionAPI/ConstructionAPI_Axis.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_ @@ -33,175 +34,167 @@ class ModelHighAPI_Selection; /// \class ConstructionAPI_Axis /// \ingroup CPPHighAPI /// \brief Interface for Axis feature -class ConstructionAPI_Axis: public ModelHighAPI_Interface -{ +class ConstructionAPI_Axis : public ModelHighAPI_Interface { public: /// Constructor without values CONSTRUCTIONAPI_EXPORT - explicit ConstructionAPI_Axis(const std::shared_ptr& theFeature); + explicit ConstructionAPI_Axis( + const std::shared_ptr &theFeature); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2); + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject); + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePoint, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ); + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePoint, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theDX, - const ModelHighAPI_Double& theDY, - const ModelHighAPI_Double& theDZ); + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theDX, + const ModelHighAPI_Double &theDY, + const ModelHighAPI_Double &theDZ); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Axis(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, + ConstructionAPI_Axis(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2); + const ModelHighAPI_Selection &thePlane2); /// Destructor CONSTRUCTIONAPI_EXPORT virtual ~ConstructionAPI_Axis(); - INTERFACE_21(ConstructionPlugin_Axis::ID(), - creationMethod, ConstructionPlugin_Axis::METHOD(), - ModelAPI_AttributeString, /** Creation method */, - firstPoint, ConstructionPlugin_Axis::POINT_FIRST(), - ModelAPI_AttributeSelection, /** First point */, - secondPoint, ConstructionPlugin_Axis::POINT_SECOND(), - ModelAPI_AttributeSelection, /** Second point */, - cylindricalFace, ConstructionPlugin_Axis::CYLINDRICAL_FACE(), - ModelAPI_AttributeSelection, /** Cylindrical face */, - xDirection, ConstructionPlugin_Axis::X_DIRECTION(), - ModelAPI_AttributeDouble, /** X direction */, - yDirection, ConstructionPlugin_Axis::Y_DIRECTION(), - ModelAPI_AttributeDouble, /** Y direction */, - zDirection, ConstructionPlugin_Axis::Z_DIRECTION(), - ModelAPI_AttributeDouble, /** Z direction */, - xDimension, ConstructionPlugin_Axis::DX(), - ModelAPI_AttributeDouble, /** X dimension */, - yDimension, ConstructionPlugin_Axis::DY(), - ModelAPI_AttributeDouble, /** Y dimension */, - zDimension, ConstructionPlugin_Axis::DZ(), - ModelAPI_AttributeDouble, /** Z dimension */, - line, ConstructionPlugin_Axis::LINE(), - ModelAPI_AttributeSelection, /** Line */, - plane, ConstructionPlugin_Axis::PLANE(), - ModelAPI_AttributeSelection, /** Plane */, - point, ConstructionPlugin_Axis::POINT(), - ModelAPI_AttributeSelection, /** Point */, - plane1, ConstructionPlugin_Axis::PLANE1(), - ModelAPI_AttributeSelection, /** Plane 1 */, - useOffset1, ConstructionPlugin_Axis::USE_OFFSET1(), - ModelAPI_AttributeString, /** Use offset 1 */, - offset1, ConstructionPlugin_Axis::OFFSET1(), - ModelAPI_AttributeDouble, /** Offset 1 */, - reverseOffset1, ConstructionPlugin_Axis::REVERSE_OFFSET1(), - ModelAPI_AttributeBoolean, /** Reverse offset 1 */, - plane2, ConstructionPlugin_Axis::PLANE2(), - ModelAPI_AttributeSelection, /** Plane 2 */, - useOffset2, ConstructionPlugin_Axis::USE_OFFSET2(), - ModelAPI_AttributeString, /** Use offset 2 */, - offset2, ConstructionPlugin_Axis::OFFSET2(), - ModelAPI_AttributeDouble, /** Offset 2 */, - reverseOffset2, ConstructionPlugin_Axis::REVERSE_OFFSET2(), - ModelAPI_AttributeBoolean, /** Reverse offset 2 */) + INTERFACE_21( + ConstructionPlugin_Axis::ID(), creationMethod, + ConstructionPlugin_Axis::METHOD(), ModelAPI_AttributeString, + /** Creation method */, firstPoint, + ConstructionPlugin_Axis::POINT_FIRST(), ModelAPI_AttributeSelection, + /** First point */, secondPoint, ConstructionPlugin_Axis::POINT_SECOND(), + ModelAPI_AttributeSelection, /** Second point */, cylindricalFace, + ConstructionPlugin_Axis::CYLINDRICAL_FACE(), ModelAPI_AttributeSelection, + /** Cylindrical face */, xDirection, + ConstructionPlugin_Axis::X_DIRECTION(), ModelAPI_AttributeDouble, + /** X direction */, yDirection, ConstructionPlugin_Axis::Y_DIRECTION(), + ModelAPI_AttributeDouble, /** Y direction */, zDirection, + ConstructionPlugin_Axis::Z_DIRECTION(), ModelAPI_AttributeDouble, + /** Z direction */, xDimension, ConstructionPlugin_Axis::DX(), + ModelAPI_AttributeDouble, /** X dimension */, yDimension, + ConstructionPlugin_Axis::DY(), ModelAPI_AttributeDouble, + /** Y dimension */, zDimension, ConstructionPlugin_Axis::DZ(), + ModelAPI_AttributeDouble, /** Z dimension */, line, + ConstructionPlugin_Axis::LINE(), ModelAPI_AttributeSelection, /** Line */, + plane, ConstructionPlugin_Axis::PLANE(), ModelAPI_AttributeSelection, + /** Plane */, point, ConstructionPlugin_Axis::POINT(), + ModelAPI_AttributeSelection, /** Point */, plane1, + ConstructionPlugin_Axis::PLANE1(), ModelAPI_AttributeSelection, + /** Plane 1 */, useOffset1, ConstructionPlugin_Axis::USE_OFFSET1(), + ModelAPI_AttributeString, /** Use offset 1 */, offset1, + ConstructionPlugin_Axis::OFFSET1(), ModelAPI_AttributeDouble, + /** Offset 1 */, reverseOffset1, + ConstructionPlugin_Axis::REVERSE_OFFSET1(), ModelAPI_AttributeBoolean, + /** Reverse offset 1 */, plane2, ConstructionPlugin_Axis::PLANE2(), + ModelAPI_AttributeSelection, /** Plane 2 */, useOffset2, + ConstructionPlugin_Axis::USE_OFFSET2(), ModelAPI_AttributeString, + /** Use offset 2 */, offset2, ConstructionPlugin_Axis::OFFSET2(), + ModelAPI_AttributeDouble, /** Offset 2 */, reverseOffset2, + ConstructionPlugin_Axis::REVERSE_OFFSET2(), ModelAPI_AttributeBoolean, + /** Reverse offset 2 */) /// Set points CONSTRUCTIONAPI_EXPORT - void setByPoints(const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2); + void setByPoints(const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2); /// Set cylindrical face CONSTRUCTIONAPI_EXPORT - void setByCylindricalFace(const ModelHighAPI_Selection& theCylindricalFace); + void setByCylindricalFace(const ModelHighAPI_Selection &theCylindricalFace); /// Set direction CONSTRUCTIONAPI_EXPORT - void setByPointAndDirection(const ModelHighAPI_Selection& thePoint, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ); + void setByPointAndDirection(const ModelHighAPI_Selection &thePoint, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ); /// Set dimensions CONSTRUCTIONAPI_EXPORT - void setByDimensions(const ModelHighAPI_Double& theDX, - const ModelHighAPI_Double& theDY, - const ModelHighAPI_Double& theDZ); + void setByDimensions(const ModelHighAPI_Double &theDX, + const ModelHighAPI_Double &theDY, + const ModelHighAPI_Double &theDZ); /// Set by line CONSTRUCTIONAPI_EXPORT - void setByLine(const ModelHighAPI_Selection& theCylindricalFace); + void setByLine(const ModelHighAPI_Selection &theCylindricalFace); /// Set by plane and point CONSTRUCTIONAPI_EXPORT - void setByPlaneAndPoint(const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& thePoint); + void setByPlaneAndPoint(const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &thePoint); /// Set by two planes CONSTRUCTIONAPI_EXPORT - void setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2); + void setByTwoPlanes(const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2); /// Set by two planes CONSTRUCTIONAPI_EXPORT - void setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, + void setByTwoPlanes(const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2); /// Set by two planes CONSTRUCTIONAPI_EXPORT - void setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, + void setByTwoPlanes(const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2); /// Set by two planes CONSTRUCTIONAPI_EXPORT - void setByTwoPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, + void setByTwoPlanes(const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2); + const ModelHighAPI_Selection &thePlane2); /// Dump wrapped feature CONSTRUCTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Axis object @@ -210,60 +203,60 @@ typedef std::shared_ptr AxisPtr; /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2); +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2); /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject); +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject); /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ); +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ); /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theDX, - const ModelHighAPI_Double& theDY, - const ModelHighAPI_Double& theDZ); +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theDX, + const ModelHighAPI_Double &theDY, + const ModelHighAPI_Double &theDZ); /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2); /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2, - const ModelHighAPI_Double& theOffset2, +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2, + const ModelHighAPI_Double &theOffset2, const bool theReverseOffset2); /// \ingroup CPPHighAPI /// \brief Create Axis feature CONSTRUCTIONAPI_EXPORT -AxisPtr addAxis(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Double& theOffset1, +AxisPtr addAxis(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Double &theOffset1, const bool theReverseOffset1, - const ModelHighAPI_Selection& thePlane2); + const ModelHighAPI_Selection &thePlane2); #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_ */ diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.cpp b/src/ConstructionAPI/ConstructionAPI_Plane.cpp index ca8203433..61bac7f7e 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Plane.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionAPI_Plane.h" @@ -23,107 +24,101 @@ #include //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Double& theDistance, - const bool theIsReverse, - const ModelHighAPI_Integer& theNbCopy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Double &theDistance, const bool theIsReverse, + const ModelHighAPI_Integer &theNbCopy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByFaceAndDistance(theFace, theDistance, theIsReverse, theNbCopy); } } //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theA, - const ModelHighAPI_Double& theB, - const ModelHighAPI_Double& theC, - const ModelHighAPI_Double& theD) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theA, const ModelHighAPI_Double &theB, + const ModelHighAPI_Double &theC, const ModelHighAPI_Double &theD) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByGeneralEquation(theA, theB, theC, theD); } } //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByThreePoints(thePoint1, thePoint2, thePoint3); } } //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theLine, - const ModelHighAPI_Selection& thePoint, - const bool theIsPerpendicular) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theLine, + const ModelHighAPI_Selection &thePoint, const bool theIsPerpendicular) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByLineAndPoint(theLine, thePoint, theIsPerpendicular); } } //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1); GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2); - if(aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::VERTEX) { + if (aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::VERTEX) { setByCoincidentToPoint(theObject1, theObject2); - } else if(aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::FACE) { + } else if (aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::FACE) { setByTwoParallelPlanes(theObject1, theObject2); } } } //================================================================================================== -ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const ModelHighAPI_Integer& theNbCopy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Plane::ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNbCopy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByRotation(thePlane, theAxis, theAngle, theNbCopy); } } //================================================================================================== -ConstructionAPI_Plane::~ConstructionAPI_Plane() -{ -} +ConstructionAPI_Plane::~ConstructionAPI_Plane() {} //================================================================================================== -void ConstructionAPI_Plane::setByFaceAndDistance(const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Double& theDistance, - const bool theIsReverse, - const ModelHighAPI_Integer& theNbCopy) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod); +void ConstructionAPI_Plane::setByFaceAndDistance( + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Double &theDistance, const bool theIsReverse, + const ModelHighAPI_Integer &theNbCopy) { + fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), + mycreationMethod); fillAttribute(theFace, myplane); - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_DISTANCE_FROM_OTHER(), - mycreationMethodByOtherPlane); + fillAttribute( + ConstructionPlugin_Plane::CREATION_METHOD_BY_DISTANCE_FROM_OTHER(), + mycreationMethodByOtherPlane); fillAttribute(theDistance, mydistance); fillAttribute(theIsReverse, myreverse); fillAttribute(theNbCopy, mynbcopy); @@ -132,12 +127,11 @@ void ConstructionAPI_Plane::setByFaceAndDistance(const ModelHighAPI_Selection& t } //================================================================================================== -void ConstructionAPI_Plane::setByGeneralEquation(const ModelHighAPI_Double& theA, - const ModelHighAPI_Double& theB, - const ModelHighAPI_Double& theC, - const ModelHighAPI_Double& theD) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION(), mycreationMethod); +void ConstructionAPI_Plane::setByGeneralEquation( + const ModelHighAPI_Double &theA, const ModelHighAPI_Double &theB, + const ModelHighAPI_Double &theC, const ModelHighAPI_Double &theD) { + fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION(), + mycreationMethod); fillAttribute(theA, myA); fillAttribute(theB, myB); fillAttribute(theC, myC); @@ -147,11 +141,12 @@ void ConstructionAPI_Plane::setByGeneralEquation(const ModelHighAPI_Double& theA } //================================================================================================== -void ConstructionAPI_Plane::setByThreePoints(const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_THREE_POINTS(), mycreationMethod); +void ConstructionAPI_Plane::setByThreePoints( + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3) { + fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_THREE_POINTS(), + mycreationMethod); fillAttribute(thePoint1, mypoint1); fillAttribute(thePoint2, mypoint2); fillAttribute(thePoint3, mypoint3); @@ -160,11 +155,11 @@ void ConstructionAPI_Plane::setByThreePoints(const ModelHighAPI_Selection& thePo } //================================================================================================== -void ConstructionAPI_Plane::setByLineAndPoint(const ModelHighAPI_Selection& theLine, - const ModelHighAPI_Selection& thePoint, - const bool theIsPerpendicular) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_LINE_AND_POINT(), mycreationMethod); +void ConstructionAPI_Plane::setByLineAndPoint( + const ModelHighAPI_Selection &theLine, + const ModelHighAPI_Selection &thePoint, const bool theIsPerpendicular) { + fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_LINE_AND_POINT(), + mycreationMethod); fillAttribute(theLine, myline); fillAttribute(thePoint, mypoint); fillAttribute(theIsPerpendicular, myperpendicular); @@ -173,11 +168,12 @@ void ConstructionAPI_Plane::setByLineAndPoint(const ModelHighAPI_Selection& theL } //================================================================================================== -void ConstructionAPI_Plane::setByTwoParallelPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES(), - mycreationMethod); +void ConstructionAPI_Plane::setByTwoParallelPlanes( + const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2) { + fillAttribute( + ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES(), + mycreationMethod); fillAttribute(thePlane1, myplane1); fillAttribute(thePlane2, myplane2); @@ -185,25 +181,27 @@ void ConstructionAPI_Plane::setByTwoParallelPlanes(const ModelHighAPI_Selection& } //================================================================================================== -void ConstructionAPI_Plane::setByCoincidentToPoint(const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& thePoint) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod); +void ConstructionAPI_Plane::setByCoincidentToPoint( + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &thePoint) { + fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), + mycreationMethod); fillAttribute(thePlane, myplane); - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT(), - mycreationMethodByOtherPlane); + fillAttribute( + ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT(), + mycreationMethodByOtherPlane); fillAttribute(thePoint, mycoincidentPoint); execute(); } //================================================================================================== -void ConstructionAPI_Plane::setByRotation(const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const ModelHighAPI_Integer& theNbCopy) -{ - fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod); +void ConstructionAPI_Plane::setByRotation( + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNbCopy) { + fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), + mycreationMethod); fillAttribute(thePlane, myplane); fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_ROTATION(), mycreationMethodByOtherPlane); @@ -215,69 +213,95 @@ void ConstructionAPI_Plane::setByRotation(const ModelHighAPI_Selection& thePlane } //================================================================================================== -void ConstructionAPI_Plane::dump(ModelHighAPI_Dumper& theDumper) const -{ +void ConstructionAPI_Plane::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addPlane(" << aDocName; std::string aCreationMethod = - aBase->string(ConstructionPlugin_Plane::CREATION_METHOD())->value(); + aBase->string(ConstructionPlugin_Plane::CREATION_METHOD())->value(); - if(aCreationMethod == ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION()) { + if (aCreationMethod == + ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION()) { AttributeDoublePtr anAttrA = aBase->real(ConstructionPlugin_Plane::A()); AttributeDoublePtr anAttrB = aBase->real(ConstructionPlugin_Plane::B()); AttributeDoublePtr anAttrC = aBase->real(ConstructionPlugin_Plane::C()); AttributeDoublePtr anAttrD = aBase->real(ConstructionPlugin_Plane::D()); - theDumper << ", " << anAttrA << ", " << anAttrB << ", " << anAttrC << ", " << anAttrD; - } else if(aCreationMethod == ConstructionPlugin_Plane::CREATION_METHOD_BY_THREE_POINTS()) { - AttributeSelectionPtr anAttrPnt1 = aBase->selection(ConstructionPlugin_Plane::POINT1()); - AttributeSelectionPtr anAttrPnt2 = aBase->selection(ConstructionPlugin_Plane::POINT2()); - AttributeSelectionPtr anAttrPnt3 = aBase->selection(ConstructionPlugin_Plane::POINT3()); + theDumper << ", " << anAttrA << ", " << anAttrB << ", " << anAttrC << ", " + << anAttrD; + } else if (aCreationMethod == + ConstructionPlugin_Plane::CREATION_METHOD_BY_THREE_POINTS()) { + AttributeSelectionPtr anAttrPnt1 = + aBase->selection(ConstructionPlugin_Plane::POINT1()); + AttributeSelectionPtr anAttrPnt2 = + aBase->selection(ConstructionPlugin_Plane::POINT2()); + AttributeSelectionPtr anAttrPnt3 = + aBase->selection(ConstructionPlugin_Plane::POINT3()); theDumper << ", " << anAttrPnt1 << ", " << anAttrPnt2 << ", " << anAttrPnt3; - } else if(aCreationMethod == ConstructionPlugin_Plane::CREATION_METHOD_BY_LINE_AND_POINT()) { - AttributeSelectionPtr anAttrLine = aBase->selection(ConstructionPlugin_Plane::LINE()); - AttributeSelectionPtr anAttrPoint = aBase->selection(ConstructionPlugin_Plane::POINT()); + } else if (aCreationMethod == + ConstructionPlugin_Plane::CREATION_METHOD_BY_LINE_AND_POINT()) { + AttributeSelectionPtr anAttrLine = + aBase->selection(ConstructionPlugin_Plane::LINE()); + AttributeSelectionPtr anAttrPoint = + aBase->selection(ConstructionPlugin_Plane::POINT()); AttributeBooleanPtr anAttrPerpendicular = - aBase->boolean(ConstructionPlugin_Plane::PERPENDICULAR()); + aBase->boolean(ConstructionPlugin_Plane::PERPENDICULAR()); - theDumper << ", " << anAttrLine << ", " << anAttrPoint << ", " << anAttrPerpendicular; - } else if(aCreationMethod == ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE()) { - AttributeSelectionPtr anAttrPlane = aBase->selection(ConstructionPlugin_Plane::PLANE()); + theDumper << ", " << anAttrLine << ", " << anAttrPoint << ", " + << anAttrPerpendicular; + } else if (aCreationMethod == + ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE()) { + AttributeSelectionPtr anAttrPlane = + aBase->selection(ConstructionPlugin_Plane::PLANE()); std::string aCreationMethodOption = - aBase->string(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE_OPTION())->value(); - if(aCreationMethodOption == - ConstructionPlugin_Plane::CREATION_METHOD_BY_DISTANCE_FROM_OTHER()) { - AttributeDoublePtr anAttrDistance = aBase->real(ConstructionPlugin_Plane::DISTANCE()); - AttributeBooleanPtr anAttrReverse = aBase->boolean(ConstructionPlugin_Plane::REVERSE()); - AttributeIntegerPtr anAttrNbCopy = aBase->integer(ConstructionPlugin_Plane::NB_COPIES()); - - theDumper << ", " << anAttrPlane << ", " << anAttrDistance << ", " << anAttrReverse; - if(anAttrNbCopy.get() && anAttrNbCopy->value() > 1) + aBase + ->string(ConstructionPlugin_Plane:: + CREATION_METHOD_BY_OTHER_PLANE_OPTION()) + ->value(); + if (aCreationMethodOption == + ConstructionPlugin_Plane::CREATION_METHOD_BY_DISTANCE_FROM_OTHER()) { + AttributeDoublePtr anAttrDistance = + aBase->real(ConstructionPlugin_Plane::DISTANCE()); + AttributeBooleanPtr anAttrReverse = + aBase->boolean(ConstructionPlugin_Plane::REVERSE()); + AttributeIntegerPtr anAttrNbCopy = + aBase->integer(ConstructionPlugin_Plane::NB_COPIES()); + + theDumper << ", " << anAttrPlane << ", " << anAttrDistance << ", " + << anAttrReverse; + if (anAttrNbCopy.get() && anAttrNbCopy->value() > 1) theDumper << ", " << anAttrNbCopy; - } else if(aCreationMethodOption == - ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT()) { + } else if (aCreationMethodOption == + ConstructionPlugin_Plane:: + CREATION_METHOD_BY_COINCIDENT_TO_POINT()) { AttributeSelectionPtr anAttrPoint = - aBase->selection(ConstructionPlugin_Plane::COINCIDENT_POINT()); + aBase->selection(ConstructionPlugin_Plane::COINCIDENT_POINT()); theDumper << ", " << anAttrPlane << ", " << anAttrPoint; - } else if(aCreationMethodOption == ConstructionPlugin_Plane::CREATION_METHOD_BY_ROTATION()) { - AttributeSelectionPtr anAttrAxis = aBase->selection(ConstructionPlugin_Plane::AXIS()); - AttributeDoublePtr anAttrAngle = aBase->real(ConstructionPlugin_Plane::ANGLE()); - AttributeIntegerPtr anAttrNbCopy = aBase->integer(ConstructionPlugin_Plane::NB_COPIES()); - - theDumper << ", " << anAttrPlane << ", " << anAttrAxis << ", " << anAttrAngle; + } else if (aCreationMethodOption == + ConstructionPlugin_Plane::CREATION_METHOD_BY_ROTATION()) { + AttributeSelectionPtr anAttrAxis = + aBase->selection(ConstructionPlugin_Plane::AXIS()); + AttributeDoublePtr anAttrAngle = + aBase->real(ConstructionPlugin_Plane::ANGLE()); + AttributeIntegerPtr anAttrNbCopy = + aBase->integer(ConstructionPlugin_Plane::NB_COPIES()); + + theDumper << ", " << anAttrPlane << ", " << anAttrAxis << ", " + << anAttrAngle; if (anAttrNbCopy.get() && anAttrNbCopy->value() > 1) - theDumper << ", " << anAttrNbCopy; + theDumper << ", " << anAttrNbCopy; } - } else if(aCreationMethod == - ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) { - AttributeSelectionPtr anAttrPlane1 = aBase->selection(ConstructionPlugin_Plane::PLANE1()); - AttributeSelectionPtr anAttrPlane2 = aBase->selection(ConstructionPlugin_Plane::PLANE2()); + } else if (aCreationMethod == ConstructionPlugin_Plane:: + CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) { + AttributeSelectionPtr anAttrPlane1 = + aBase->selection(ConstructionPlugin_Plane::PLANE1()); + AttributeSelectionPtr anAttrPlane2 = + aBase->selection(ConstructionPlugin_Plane::PLANE2()); theDumper << ", " << anAttrPlane1 << ", " << anAttrPlane2; } @@ -286,70 +310,73 @@ void ConstructionAPI_Plane::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Double& theDistance, +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Double &theDistance, const bool theIsReverse, - const ModelHighAPI_Integer& theNbCopies) -{ + const ModelHighAPI_Integer &theNbCopies) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Plane::ID()); return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance, theIsReverse, theNbCopies)); } //================================================================================================== -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theA, - const ModelHighAPI_Double& theB, - const ModelHighAPI_Double& theC, - const ModelHighAPI_Double& theD) -{ +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theA, + const ModelHighAPI_Double &theB, + const ModelHighAPI_Double &theC, + const ModelHighAPI_Double &theD) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Plane::ID()); return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD)); } //================================================================================================== -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3) -{ +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); - return PlanePtr(new ConstructionAPI_Plane(aFeature, thePoint1, thePoint2, thePoint3)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Plane::ID()); + return PlanePtr( + new ConstructionAPI_Plane(aFeature, thePoint1, thePoint2, thePoint3)); } //================================================================================================== -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theLine, - const ModelHighAPI_Selection& thePoint, - const bool theIsPerpendicular) -{ +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theLine, + const ModelHighAPI_Selection &thePoint, + const bool theIsPerpendicular) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); - return PlanePtr(new ConstructionAPI_Plane(aFeature, theLine, thePoint, theIsPerpendicular)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Plane::ID()); + return PlanePtr(new ConstructionAPI_Plane(aFeature, theLine, thePoint, + theIsPerpendicular)); } //================================================================================================== -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2) -{ +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Plane::ID()); return PlanePtr(new ConstructionAPI_Plane(aFeature, theObject1, theObject2)); } //================================================================================================== -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const ModelHighAPI_Integer& theNbCopies) -{ +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNbCopies) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); - return PlanePtr(new ConstructionAPI_Plane(aFeature, thePlane, theAxis, theAngle, theNbCopies)); + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Plane::ID()); + return PlanePtr(new ConstructionAPI_Plane(aFeature, thePlane, theAxis, + theAngle, theNbCopies)); } diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.h b/src/ConstructionAPI/ConstructionAPI_Plane.h index e0847dec2..154973922 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.h +++ b/src/ConstructionAPI/ConstructionAPI_Plane.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Double; class ModelHighAPI_Selection; @@ -34,152 +35,147 @@ class ModelHighAPI_Selection; /// \class ConstructionAPI_Plane /// \ingroup CPPHighAPI /// \brief Interface for Plane feature -class ConstructionAPI_Plane: public ModelHighAPI_Interface -{ +class ConstructionAPI_Plane : public ModelHighAPI_Interface { public: /// Constructor without values CONSTRUCTIONAPI_EXPORT - explicit ConstructionAPI_Plane(const std::shared_ptr& theFeature); + explicit ConstructionAPI_Plane( + const std::shared_ptr &theFeature); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Double& theDistance, - const bool theIsReverse, - const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1)); + ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Double &theDistance, const bool theIsReverse, + const ModelHighAPI_Integer &theNbCopy = ModelHighAPI_Integer(1)); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theA, - const ModelHighAPI_Double& theB, - const ModelHighAPI_Double& theC, - const ModelHighAPI_Double& theD); + ConstructionAPI_Plane(const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theA, + const ModelHighAPI_Double &theB, + const ModelHighAPI_Double &theC, + const ModelHighAPI_Double &theD); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3); + ConstructionAPI_Plane(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theLine, - const ModelHighAPI_Selection& thePoint, + ConstructionAPI_Plane(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theLine, + const ModelHighAPI_Selection &thePoint, const bool theIsPerpendicular); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2); + ConstructionAPI_Plane(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2); /// Constructor with values CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Plane(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1)); + ConstructionAPI_Plane( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNbCopy = ModelHighAPI_Integer(1)); /// Destructor CONSTRUCTIONAPI_EXPORT virtual ~ConstructionAPI_Plane(); - INTERFACE_21(ConstructionPlugin_Plane::ID(), - creationMethod, ConstructionPlugin_Plane::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - A, ConstructionPlugin_Plane::A(), - ModelAPI_AttributeDouble, /** Parameter A for general equation */, - B, ConstructionPlugin_Plane::B(), - ModelAPI_AttributeDouble, /** Parameter B for general equation */, - C, ConstructionPlugin_Plane::C(), - ModelAPI_AttributeDouble, /** Parameter C for general equation */, - D, ConstructionPlugin_Plane::D(), - ModelAPI_AttributeDouble, /** Parameter D for general equation */, - point1, ConstructionPlugin_Plane::POINT1(), - ModelAPI_AttributeSelection, /** Point 1 for plane */, - point2, ConstructionPlugin_Plane::POINT2(), - ModelAPI_AttributeSelection, /** Point 2 for plane */, - point3, ConstructionPlugin_Plane::POINT3(), - ModelAPI_AttributeSelection, /** Point 3 for plane */, - line, ConstructionPlugin_Plane::LINE(), - ModelAPI_AttributeSelection, /** Line for plane */, - point, ConstructionPlugin_Plane::POINT(), - ModelAPI_AttributeSelection, /** Point for plane */, - perpendicular, ConstructionPlugin_Plane::PERPENDICULAR(), - ModelAPI_AttributeBoolean, /** Perpendicular flag */, - creationMethodByOtherPlane, - ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE_OPTION(), - ModelAPI_AttributeString, /** Creation method by other plane*/, - plane, ConstructionPlugin_Plane::PLANE(), - ModelAPI_AttributeSelection, /** Plane face */, - distance, ConstructionPlugin_Plane::DISTANCE(), - ModelAPI_AttributeDouble, /** Distance */, - reverse, ConstructionPlugin_Plane::REVERSE(), - ModelAPI_AttributeBoolean, /** Reverse flag */, - coincidentPoint, ConstructionPlugin_Plane::COINCIDENT_POINT(), - ModelAPI_AttributeSelection, /** Coincident point */, - axis, ConstructionPlugin_Plane::AXIS(), - ModelAPI_AttributeSelection, /** Axis for rotation */, - angle, ConstructionPlugin_Plane::ANGLE(), - ModelAPI_AttributeDouble, /** Rotation angle */, - plane1, ConstructionPlugin_Plane::PLANE1(), - ModelAPI_AttributeSelection, /** Plane 1 */, - plane2, ConstructionPlugin_Plane::PLANE2(), - ModelAPI_AttributeSelection, /** Plane 2 */, - nbcopy, ConstructionPlugin_Plane::NB_COPIES(), - ModelAPI_AttributeInteger, /** Number of copies */) + INTERFACE_21( + ConstructionPlugin_Plane::ID(), creationMethod, + ConstructionPlugin_Plane::CREATION_METHOD(), ModelAPI_AttributeString, + /** Creation method */, A, ConstructionPlugin_Plane::A(), + ModelAPI_AttributeDouble, /** Parameter A for general equation */, B, + ConstructionPlugin_Plane::B(), ModelAPI_AttributeDouble, + /** Parameter B for general equation */, C, ConstructionPlugin_Plane::C(), + ModelAPI_AttributeDouble, /** Parameter C for general equation */, D, + ConstructionPlugin_Plane::D(), ModelAPI_AttributeDouble, + /** Parameter D for general equation */, point1, + ConstructionPlugin_Plane::POINT1(), ModelAPI_AttributeSelection, + /** Point 1 for plane */, point2, ConstructionPlugin_Plane::POINT2(), + ModelAPI_AttributeSelection, /** Point 2 for plane */, point3, + ConstructionPlugin_Plane::POINT3(), ModelAPI_AttributeSelection, + /** Point 3 for plane */, line, ConstructionPlugin_Plane::LINE(), + ModelAPI_AttributeSelection, /** Line for plane */, point, + ConstructionPlugin_Plane::POINT(), ModelAPI_AttributeSelection, + /** Point for plane */, perpendicular, + ConstructionPlugin_Plane::PERPENDICULAR(), ModelAPI_AttributeBoolean, + /** Perpendicular flag */, creationMethodByOtherPlane, + ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE_OPTION(), + ModelAPI_AttributeString, /** Creation method by other plane*/, plane, + ConstructionPlugin_Plane::PLANE(), ModelAPI_AttributeSelection, + /** Plane face */, distance, ConstructionPlugin_Plane::DISTANCE(), + ModelAPI_AttributeDouble, /** Distance */, reverse, + ConstructionPlugin_Plane::REVERSE(), ModelAPI_AttributeBoolean, + /** Reverse flag */, coincidentPoint, + ConstructionPlugin_Plane::COINCIDENT_POINT(), ModelAPI_AttributeSelection, + /** Coincident point */, axis, ConstructionPlugin_Plane::AXIS(), + ModelAPI_AttributeSelection, /** Axis for rotation */, angle, + ConstructionPlugin_Plane::ANGLE(), ModelAPI_AttributeDouble, + /** Rotation angle */, plane1, ConstructionPlugin_Plane::PLANE1(), + ModelAPI_AttributeSelection, /** Plane 1 */, plane2, + ConstructionPlugin_Plane::PLANE2(), ModelAPI_AttributeSelection, + /** Plane 2 */, nbcopy, ConstructionPlugin_Plane::NB_COPIES(), + ModelAPI_AttributeInteger, + /** Number of copies */) /// Set face and distance CONSTRUCTIONAPI_EXPORT - void setByFaceAndDistance(const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Double& theDistance, - const bool theIsReverse, - const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1)); + void setByFaceAndDistance( + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Double &theDistance, const bool theIsReverse, + const ModelHighAPI_Integer &theNbCopy = ModelHighAPI_Integer(1)); /// Set GeneralEquation parameters of the feature CONSTRUCTIONAPI_EXPORT - void setByGeneralEquation(const ModelHighAPI_Double& theA, - const ModelHighAPI_Double& theB, - const ModelHighAPI_Double& theC, - const ModelHighAPI_Double& theD); + void setByGeneralEquation(const ModelHighAPI_Double &theA, + const ModelHighAPI_Double &theB, + const ModelHighAPI_Double &theC, + const ModelHighAPI_Double &theD); /// Set by three points. CONSTRUCTIONAPI_EXPORT - void setByThreePoints(const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3); + void setByThreePoints(const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3); /// Set by line and point. CONSTRUCTIONAPI_EXPORT - void setByLineAndPoint(const ModelHighAPI_Selection& theLine, - const ModelHighAPI_Selection& thePoint, + void setByLineAndPoint(const ModelHighAPI_Selection &theLine, + const ModelHighAPI_Selection &thePoint, const bool theIsPerpendicular); /// Set by two parallel planes. CONSTRUCTIONAPI_EXPORT - void setByTwoParallelPlanes(const ModelHighAPI_Selection& thePlane1, - const ModelHighAPI_Selection& thePlane2); + void setByTwoParallelPlanes(const ModelHighAPI_Selection &thePlane1, + const ModelHighAPI_Selection &thePlane2); /// Set by coincident to point. CONSTRUCTIONAPI_EXPORT - void setByCoincidentToPoint(const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& thePoint); + void setByCoincidentToPoint(const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &thePoint); /// Set by rotation. CONSTRUCTIONAPI_EXPORT - void setByRotation(const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1)); + void setByRotation( + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNbCopy = ModelHighAPI_Integer(1)); /// Dump wrapped feature CONSTRUCTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Plane object @@ -188,51 +184,52 @@ typedef std::shared_ptr PlanePtr; /// \ingroup CPPHighAPI /// \brief Create Plane feature CONSTRUCTIONAPI_EXPORT -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Double& theDistance, - const bool theIsReverse, - const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1)); +PlanePtr +addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Double &theDistance, const bool theIsReverse, + const ModelHighAPI_Integer &theNbCopy = ModelHighAPI_Integer(1)); /// \ingroup CPPHighAPI /// \brief Create Plane feature CONSTRUCTIONAPI_EXPORT -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theA, - const ModelHighAPI_Double& theB, - const ModelHighAPI_Double& theC, - const ModelHighAPI_Double& theD); +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theA, + const ModelHighAPI_Double &theB, + const ModelHighAPI_Double &theC, + const ModelHighAPI_Double &theD); /// \ingroup CPPHighAPI /// \brief Create Plane feature CONSTRUCTIONAPI_EXPORT -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3); +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3); /// \ingroup CPPHighAPI /// \brief Create Plane feature CONSTRUCTIONAPI_EXPORT -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theLine, - const ModelHighAPI_Selection& thePoint, +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theLine, + const ModelHighAPI_Selection &thePoint, const bool theIsPerpendicular); /// \ingroup CPPHighAPI /// \brief Create Plane feature CONSTRUCTIONAPI_EXPORT -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2); +PlanePtr addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2); /// \ingroup CPPHighAPI /// \brief Create Plane feature CONSTRUCTIONAPI_EXPORT -PlanePtr addPlane(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePlane, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1)); +PlanePtr +addPlane(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePlane, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNbCopy = ModelHighAPI_Integer(1)); #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ */ diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index 5202ea242..1e2f665c1 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionAPI_Point.h" @@ -29,92 +30,88 @@ #include //================================================================================================== -ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +ConstructionAPI_Point::ConstructionAPI_Point( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Point::ConstructionAPI_Point( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theX, const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByXYZ(theX, theY, theZ); } } //================================================================================================== -ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theOffset, - const bool theUseRatio, - const bool theReverse) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Point::ConstructionAPI_Point( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theEdge, const ModelHighAPI_Double &theOffset, + const bool theUseRatio, const bool theReverse) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByOffsetOnEdge(theEdge, theOffset, theUseRatio, theReverse); } } //================================================================================================== -ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +ConstructionAPI_Point::ConstructionAPI_Point( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1); GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2); - if(aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::FACE) { - // If first object is vertex and second object is face then set by projection. + if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::FACE) { + // If first object is vertex and second object is face then set by + // projection. setByProjectionOnFace(theObject1, theObject2); - } else if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::EDGE) { - // If first object is vertex and second object is edge then set by projection. + } else if (aType1 == GeomAPI_Shape::VERTEX && + aType2 == GeomAPI_Shape::EDGE) { + // If first object is vertex and second object is edge then set by + // projection. setByProjectionOnEdge(theObject1, theObject2); - } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) { + } else if (aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) { // If both objects are edges then set by lines intersection. setByLinesIntersection(theObject1, theObject2); - } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) { - // If first object is edge and second object is face then set by line and plane intersection. + } else if (aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) { + // If first object is edge and second object is face then set by line and + // plane intersection. setByLineAndPlaneIntersection(theObject1, theObject2); } } } //================================================================================================== -ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2, - const ModelHighAPI_Selection& theObject3) -: ModelHighAPI_Interface(theFeature) -{ - if (initialize()) - { +ConstructionAPI_Point::ConstructionAPI_Point( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2, + const ModelHighAPI_Selection &theObject3) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1); GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2); GeomAPI_Shape::ShapeType aType3 = getShapeType(theObject3); - if (aType1 == GeomAPI_Shape::FACE - && aType2 == GeomAPI_Shape::FACE - && aType3 == GeomAPI_Shape::FACE) - { + if (aType1 == GeomAPI_Shape::FACE && aType2 == GeomAPI_Shape::FACE && + aType3 == GeomAPI_Shape::FACE) { setByPlanesIntersection(theObject1, theObject2, theObject3); } } } //================================================================================================== -ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject, - const bool theIsCircularEdge, - const bool theIsXYZSelection) -: ModelHighAPI_Interface(theFeature) -{ - if (initialize()) - { +ConstructionAPI_Point::ConstructionAPI_Point( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject, const bool theIsCircularEdge, + const bool theIsXYZSelection) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { if (theIsCircularEdge) { setByCenterOfCircle(theObject); } else if (theObject.shapeType() == "VERTEX" && theIsXYZSelection) { @@ -156,36 +153,33 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptrdocument()); + const std::string &aDocName = theDumper.name(aBase->document()); const std::string aMeth = creationMethod()->value(); // common part @@ -299,49 +299,50 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const if (aMeth == "" || // default is XYZ aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ()) { theDumper << point(); - } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION()) { + } else if (aMeth == + ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION()) { const std::string anIntersectionType = intersectionType()->value(); - if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES()) - { + if (anIntersectionType == + ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES()) { theDumper << intersectionLine1() << ", " << intersectionLine2(); - } - else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE()) - { + } else if (anIntersectionType == + ConstructionPlugin_Point:: + INTERSECTION_TYPE_BY_LINE_AND_PLANE()) { theDumper << intersectionLine() << ", " << intersectionPlane(); if (!useOffset()->value().empty()) { // call method with defined offset theDumper << ", " << offset() << ", " << reverseOffset(); } - } - else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES()) - { - theDumper << intersectionPlane1() << ", " - << intersectionPlane2() << ", " + } else if (anIntersectionType == + ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES()) { + theDumper << intersectionPlane1() << ", " << intersectionPlane2() << ", " << intersectionPlane3(); } - } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) { + } else if (aMeth == + ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) { theDumper << edge() << ", "; - if (offsetType()->value() == ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE()) { + if (offsetType()->value() == + ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE()) { theDumper << distance() << ", " << false; - } - else { + } else { theDumper << ratio() << ", " << true; } theDumper << ", " << reverse()->value(); - } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION()) { + } else if (aMeth == + ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION()) { theDumper << pointToProject() << ", "; - if (projectionType()->value() == ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE()) { + if (projectionType()->value() == + ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE()) { theDumper << edgeForPointProjection(); } else { theDumper << faceForPointProjection(); } - } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) { + } else if (aMeth == ConstructionPlugin_Point:: + CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) { if (geometricalPropertyType()->value() == - ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()) - { + ConstructionPlugin_Point:: + GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()) { theDumper << objectForCenterOfGravity(); - } - else - { + } else { theDumper << objectForCenterOfCircle() << ", " << true; } } @@ -350,43 +351,43 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -PointPtr addPoint(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ)); } //================================================================================================== -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theOffset, - const bool theUseRatio, - const bool theReverse) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); - return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theOffset, theUseRatio, theReverse)); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theEdge, + const ModelHighAPI_Double &theOffset, const bool theUseRatio, + const bool theReverse) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); + return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theOffset, + theUseRatio, theReverse)); } //================================================================================================== -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2)); } //================================================================================================== -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2, - const ModelHighAPI_Double& theDistanceValue, - const bool theReverse) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2, + const ModelHighAPI_Double &theDistanceValue, + const bool theReverse) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); PointPtr anAPI(new ConstructionAPI_Point(aFeature, theObject1, theObject2)); fillAttribute(ConstructionPlugin_Point::USE_OFFSET(), anAPI->useOffset()); @@ -397,28 +398,30 @@ PointPtr addPoint(const std::shared_ptr & thePart, } //================================================================================================== -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2, - const ModelHighAPI_Selection& theObject3) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); - return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2, theObject3)); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2, + const ModelHighAPI_Selection &theObject3) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); + return PointPtr( + new ConstructionAPI_Point(aFeature, theObject1, theObject2, theObject3)); } //================================================================================================== -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject, - const bool theIsCircularEdge) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); - return PointPtr(new ConstructionAPI_Point(aFeature, theObject, theIsCircularEdge)); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject, + const bool theIsCircularEdge) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); + return PointPtr( + new ConstructionAPI_Point(aFeature, theObject, theIsCircularEdge)); } //================================================================================================== -PointPtr addPointXYZ(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject) -{ - std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); +PointPtr addPointXYZ(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject) { + std::shared_ptr aFeature = + thePart->addFeature(ConstructionAPI_Point::ID()); return PointPtr(new ConstructionAPI_Point(aFeature, theObject, false, true)); } diff --git a/src/ConstructionAPI/ConstructionAPI_Point.h b/src/ConstructionAPI/ConstructionAPI_Point.h index 217348620..320b41edf 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.h +++ b/src/ConstructionAPI/ConstructionAPI_Point.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ @@ -34,46 +35,46 @@ class ModelHighAPI_Double; /// \class ConstructionAPI_Point /// \ingroup CPPHighAPI /// \brief Interface for Point feature. -class ConstructionAPI_Point: public ModelHighAPI_Interface -{ +class ConstructionAPI_Point : public ModelHighAPI_Interface { public: /// Constructor without values. CONSTRUCTIONAPI_EXPORT - explicit ConstructionAPI_Point(const std::shared_ptr& theFeature); + explicit ConstructionAPI_Point( + const std::shared_ptr &theFeature); /// Constructor with values. CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theX, - const ModelHighAPI_Double& theY, - const ModelHighAPI_Double& theZ); + ConstructionAPI_Point(const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ); /// Constructor with values. CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theOffset, + ConstructionAPI_Point(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theEdge, + const ModelHighAPI_Double &theOffset, const bool theUseRatio = false, const bool theReverse = false); /// Constructor with values: intersected objects. CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2); + ConstructionAPI_Point(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2); /// Constructor with values: intersected objects. CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2, - const ModelHighAPI_Selection& theObject3); + ConstructionAPI_Point(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2, + const ModelHighAPI_Selection &theObject3); /// Constructor with values: object and circular edge flag. /// May be used for creation of point by coordinates using selection-vertex. CONSTRUCTIONAPI_EXPORT - ConstructionAPI_Point(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject, + ConstructionAPI_Point(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject, const bool theIsCircularEdge = false, const bool theIsXYZSelection = false); @@ -81,108 +82,111 @@ public: CONSTRUCTIONAPI_EXPORT virtual ~ConstructionAPI_Point(); - INTERFACE_25(ConstructionPlugin_Point::ID(), - point, ConstructionPlugin_Point::POINT3D(), - GeomDataAPI_Point, /** Point attribute */, - creationMethod, ConstructionPlugin_Point::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(), - ModelAPI_AttributeString, /** Type of the intersection */, - intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(), - ModelAPI_AttributeSelection, /** Line for intersection */, - intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(), - ModelAPI_AttributeSelection, /** Line for intersection */, - intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(), - ModelAPI_AttributeSelection, /** Line for intersection */, - intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(), - ModelAPI_AttributeSelection, /** Plane for intersection */, - intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(), - ModelAPI_AttributeSelection, /** Plane for intersection */, - intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(), - ModelAPI_AttributeSelection, /** Plane for intersection */, - intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(), - ModelAPI_AttributeSelection, /** Plane for intersection */, - useOffset, ConstructionPlugin_Point::USE_OFFSET(), - ModelAPI_AttributeString, /** Use offset */, - offset, ConstructionPlugin_Point::OFFSET(), - ModelAPI_AttributeDouble, /** Offset */, - reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(), - ModelAPI_AttributeBoolean, /** Reverse offset */, - edge, ConstructionPlugin_Point::EDGE(), - ModelAPI_AttributeSelection, /** Edge */, - offsetType, ConstructionPlugin_Point::OFFSET_TYPE(), - ModelAPI_AttributeString, /** Type of the offset on edge */, - distance, ConstructionPlugin_Point::DISTANCE(), - ModelAPI_AttributeDouble, /** Distance */, - ratio, ConstructionPlugin_Point::RATIO(), - ModelAPI_AttributeDouble, /** Ratio */, - reverse, ConstructionPlugin_Point::REVERSE(), - ModelAPI_AttributeBoolean, /** Reverse */, - pointToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(), - ModelAPI_AttributeSelection, /** Point to project*/, - projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(), - ModelAPI_AttributeString, /** Type of the point projection */, - faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(), - ModelAPI_AttributeSelection, /** Face for point projection */, - edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(), - ModelAPI_AttributeSelection, /** Edge for point projection */, - geometricalPropertyType, ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(), - ModelAPI_AttributeString, /** Type of the geometrical property */, - objectForCenterOfGravity, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(), - ModelAPI_AttributeSelection, /** Object for center of gravity */, - objectForCenterOfCircle, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(), - ModelAPI_AttributeSelection, /** Object for center of circle */) + INTERFACE_25( + ConstructionPlugin_Point::ID(), point, + ConstructionPlugin_Point::POINT3D(), GeomDataAPI_Point, + /** Point attribute */, creationMethod, + ConstructionPlugin_Point::CREATION_METHOD(), ModelAPI_AttributeString, + /** Creation method */, intersectionType, + ConstructionPlugin_Point::INTERSECTION_TYPE(), ModelAPI_AttributeString, + /** Type of the intersection */, intersectionLine1, + ConstructionPlugin_Point::INTERSECTION_LINE_1(), + ModelAPI_AttributeSelection, /** Line for intersection */, + intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(), + ModelAPI_AttributeSelection, /** Line for intersection */, + intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(), + ModelAPI_AttributeSelection, /** Line for intersection */, + intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(), + ModelAPI_AttributeSelection, /** Plane for intersection */, + intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(), + ModelAPI_AttributeSelection, /** Plane for intersection */, + intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(), + ModelAPI_AttributeSelection, /** Plane for intersection */, + intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(), + ModelAPI_AttributeSelection, /** Plane for intersection */, useOffset, + ConstructionPlugin_Point::USE_OFFSET(), ModelAPI_AttributeString, + /** Use offset */, offset, ConstructionPlugin_Point::OFFSET(), + ModelAPI_AttributeDouble, /** Offset */, reverseOffset, + ConstructionPlugin_Point::REVERSE_OFFSET(), ModelAPI_AttributeBoolean, + /** Reverse offset */, edge, ConstructionPlugin_Point::EDGE(), + ModelAPI_AttributeSelection, /** Edge */, offsetType, + ConstructionPlugin_Point::OFFSET_TYPE(), ModelAPI_AttributeString, + /** Type of the offset on edge */, distance, + ConstructionPlugin_Point::DISTANCE(), ModelAPI_AttributeDouble, + /** Distance */, ratio, ConstructionPlugin_Point::RATIO(), + ModelAPI_AttributeDouble, /** Ratio */, reverse, + ConstructionPlugin_Point::REVERSE(), ModelAPI_AttributeBoolean, + /** Reverse */, pointToProject, + ConstructionPlugin_Point::POINT_TO_PROJECT(), ModelAPI_AttributeSelection, + /** Point to project*/, projectionType, + ConstructionPlugin_Point::PROJECTION_TYPE(), ModelAPI_AttributeString, + /** Type of the point projection */, faceForPointProjection, + ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(), + ModelAPI_AttributeSelection, /** Face for point projection */, + edgeForPointProjection, + ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(), + ModelAPI_AttributeSelection, /** Edge for point projection */, + geometricalPropertyType, + ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(), + ModelAPI_AttributeString, /** Type of the geometrical property */, + objectForCenterOfGravity, + ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(), + ModelAPI_AttributeSelection, /** Object for center of gravity */, + objectForCenterOfCircle, + ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(), + ModelAPI_AttributeSelection, + /** Object for center of circle */) /// Set point values. CONSTRUCTIONAPI_EXPORT - void setByXYZ(const ModelHighAPI_Double & theX, - const ModelHighAPI_Double & theY, - const ModelHighAPI_Double & theZ); + void setByXYZ(const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ); /// Set edge and distance on it for point. CONSTRUCTIONAPI_EXPORT - void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theOffset, + void setByOffsetOnEdge(const ModelHighAPI_Selection &theEdge, + const ModelHighAPI_Double &theOffset, const bool theUseRatio = false, const bool theReverse = false); /// Set point and edge for projection. CONSTRUCTIONAPI_EXPORT - void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex, - const ModelHighAPI_Selection& theEdge); + void setByProjectionOnEdge(const ModelHighAPI_Selection &theVertex, + const ModelHighAPI_Selection &theEdge); /// Set point and face for projection. CONSTRUCTIONAPI_EXPORT - void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex, - const ModelHighAPI_Selection& theFace); + void setByProjectionOnFace(const ModelHighAPI_Selection &theVertex, + const ModelHighAPI_Selection &theFace); /// Set lines for intersections. CONSTRUCTIONAPI_EXPORT - void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1, - const ModelHighAPI_Selection& theEdge2); + void setByLinesIntersection(const ModelHighAPI_Selection &theEdge1, + const ModelHighAPI_Selection &theEdge2); /// Set line and plane for intersections. CONSTRUCTIONAPI_EXPORT - void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Selection& theFace); + void setByLineAndPlaneIntersection(const ModelHighAPI_Selection &theEdge, + const ModelHighAPI_Selection &theFace); /// Set faces for intersections. CONSTRUCTIONAPI_EXPORT - void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1, - const ModelHighAPI_Selection& theFace2, - const ModelHighAPI_Selection& theFace3); + void setByPlanesIntersection(const ModelHighAPI_Selection &theFace1, + const ModelHighAPI_Selection &theFace2, + const ModelHighAPI_Selection &theFace3); /// Set object for center of gravity. CONSTRUCTIONAPI_EXPORT - void setByCenterOfGravity(const ModelHighAPI_Selection& theObject); + void setByCenterOfGravity(const ModelHighAPI_Selection &theObject); /// Set object for center of circular edge. CONSTRUCTIONAPI_EXPORT - void setByCenterOfCircle(const ModelHighAPI_Selection& theObject); + void setByCenterOfCircle(const ModelHighAPI_Selection &theObject); /// Dump wrapped feature CONSTRUCTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Point object. @@ -191,56 +195,58 @@ typedef std::shared_ptr PointPtr; /// \ingroup CPPHighAPI /// \brief Create Point feature CONSTRUCTIONAPI_EXPORT -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Double & theX, - const ModelHighAPI_Double & theY, - const ModelHighAPI_Double & theZ); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ); /// \ingroup CPPHighAPI /// \brief Create Point feature CONSTRUCTIONAPI_EXPORT -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theOffset, +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theEdge, + const ModelHighAPI_Double &theOffset, const bool theUseRatio = false, const bool theReverse = false); /// \ingroup CPPHighAPI -/// \brief Create Point feature as an intersection of selected plane (or planar face) and edge +/// \brief Create Point feature as an intersection of selected plane (or planar +/// face) and edge CONSTRUCTIONAPI_EXPORT -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2); /// \ingroup CPPHighAPI -/// \brief Create Point feature as an intersection of selected plane (or planar face) and edge -/// with positive distance from the plane and flag to reverse the offset direction. +/// \brief Create Point feature as an intersection of selected plane (or planar +/// face) and edge with positive distance from the plane and flag to reverse the +/// offset direction. CONSTRUCTIONAPI_EXPORT -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2, - const ModelHighAPI_Double& theDistanceValue, +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2, + const ModelHighAPI_Double &theDistanceValue, const bool theReverse = false); /// \ingroup CPPHighAPI /// \brief Create Point feature as an intersection of selected planes. CONSTRUCTIONAPI_EXPORT -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject1, - const ModelHighAPI_Selection& theObject2, - const ModelHighAPI_Selection& theObject3); +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject1, + const ModelHighAPI_Selection &theObject2, + const ModelHighAPI_Selection &theObject3); /// \ingroup CPPHighAPI /// \brief Create Point feature as a geometrical property. CONSTRUCTIONAPI_EXPORT -PointPtr addPoint(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject, +PointPtr addPoint(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject, const bool theIsCircularEdge = false); /// \ingroup CPPHighAPI /// \brief Create Point feature by coordinates using the selected vertex. CONSTRUCTIONAPI_EXPORT -PointPtr addPointXYZ(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theObject); +PointPtr addPointXYZ(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject); #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */ diff --git a/src/ConstructionAPI/ConstructionAPI_swig.h b/src/ConstructionAPI/ConstructionAPI_swig.h index a966e493b..5a87dcde4 100644 --- a/src/ConstructionAPI/ConstructionAPI_swig.h +++ b/src/ConstructionAPI/ConstructionAPI_swig.h @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_SWIG_H_ #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_SWIG_H_ - #include +#include - #include "ConstructionAPI.h" - #include "ConstructionAPI_Axis.h" - #include "ConstructionAPI_Plane.h" - #include "ConstructionAPI_Point.h" +#include "ConstructionAPI.h" +#include "ConstructionAPI_Axis.h" +#include "ConstructionAPI_Plane.h" +#include "ConstructionAPI_Point.h" #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_SWIG_H_ */ diff --git a/src/ConstructionPlugin/CMakeLists.txt b/src/ConstructionPlugin/CMakeLists.txt index b80e6e6ab..8b29bcde9 100644 --- a/src/ConstructionPlugin/CMakeLists.txt +++ b/src/ConstructionPlugin/CMakeLists.txt @@ -84,16 +84,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ConstructionPlugin") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ConstructionPlugin/ConstructionPlugin.h b/src/ConstructionPlugin/ConstructionPlugin.h index c4b03f113..c7283cfc3 100644 --- a/src/ConstructionPlugin/ConstructionPlugin.h +++ b/src/ConstructionPlugin/ConstructionPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef CONSTRUCTIONPLUGIN_H @@ -22,13 +23,13 @@ #if defined CONSTRUCTIONPLUGIN_EXPORTS #if defined WIN32 -#define CONSTRUCTIONPLUGIN_EXPORT __declspec( dllexport ) +#define CONSTRUCTIONPLUGIN_EXPORT __declspec(dllexport) #else #define CONSTRUCTIONPLUGIN_EXPORT #endif #else #if defined WIN32 -#define CONSTRUCTIONPLUGIN_EXPORT __declspec( dllimport ) +#define CONSTRUCTIONPLUGIN_EXPORT __declspec(dllimport) #else #define CONSTRUCTIONPLUGIN_EXPORT #endif diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index 577414796..b819d1e82 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionPlugin_Axis.h" @@ -22,10 +23,10 @@ #include #include +#include #include -#include #include -#include +#include #include #include @@ -46,12 +47,9 @@ static const double defaultAxisSize = 100; -ConstructionPlugin_Axis::ConstructionPlugin_Axis() -{ -} +ConstructionPlugin_Axis::ConstructionPlugin_Axis() {} -void ConstructionPlugin_Axis::initAttributes() -{ +void ConstructionPlugin_Axis::initAttributes() { data()->addAttribute(ConstructionPlugin_Axis::METHOD(), ModelAPI_AttributeString::typeId()); @@ -70,14 +68,14 @@ void ConstructionPlugin_Axis::initAttributes() ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ConstructionPlugin_Axis::Z_DIRECTION(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ConstructionPlugin_Axis::X_DIRECTION()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ConstructionPlugin_Axis::Y_DIRECTION()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ConstructionPlugin_Axis::Z_DIRECTION()); - - //Attributes needed to build the axis using the "three dimensions" method + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ConstructionPlugin_Axis::X_DIRECTION()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ConstructionPlugin_Axis::Y_DIRECTION()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ConstructionPlugin_Axis::Z_DIRECTION()); + + // Attributes needed to build the axis using the "three dimensions" method data()->addAttribute(ConstructionPlugin_Axis::DX(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ConstructionPlugin_Axis::DY(), @@ -103,10 +101,11 @@ void ConstructionPlugin_Axis::initAttributes() data()->addAttribute(REVERSE_OFFSET2(), ModelAPI_AttributeBoolean::typeId()); } -void ConstructionPlugin_Axis::createAxisByTwoPoints() -{ - AttributeSelectionPtr aRef1 = data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); - AttributeSelectionPtr aRef2 = data()->selection(ConstructionPlugin_Axis::POINT_SECOND()); +void ConstructionPlugin_Axis::createAxisByTwoPoints() { + AttributeSelectionPtr aRef1 = + data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); + AttributeSelectionPtr aRef2 = + data()->selection(ConstructionPlugin_Axis::POINT_SECOND()); if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { GeomShapePtr aShape1 = aRef1->value(); if (!aShape1.get()) @@ -114,11 +113,15 @@ void ConstructionPlugin_Axis::createAxisByTwoPoints() GeomShapePtr aShape2 = aRef2->value(); if (!aShape2.get()) aShape2 = aRef2->context()->shape(); - if (aShape1->isVertex() && aShape2->isVertex() && (!aShape1->isEqual(aShape2))) { - std::shared_ptr aStart = GeomAlgoAPI_PointBuilder::point(aShape1); - std::shared_ptr anEnd = GeomAlgoAPI_PointBuilder::point(aShape2); + if (aShape1->isVertex() && aShape2->isVertex() && + (!aShape1->isEqual(aShape2))) { + std::shared_ptr aStart = + GeomAlgoAPI_PointBuilder::point(aShape1); + std::shared_ptr anEnd = + GeomAlgoAPI_PointBuilder::point(aShape2); if (aStart->distance(anEnd) > ConstructionPlugin_Axis::MINIMAL_LENGTH()) { - std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); + std::shared_ptr anEdge = + GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -129,32 +132,34 @@ void ConstructionPlugin_Axis::createAxisByTwoPoints() } } - -void ConstructionPlugin_Axis::createAxisByPointAndDirection() -{ - AttributeSelectionPtr aRef1 = data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); - AttributeDoublePtr aXAttr = data()->real(ConstructionPlugin_Axis::X_DIRECTION()); - AttributeDoublePtr aYAttr = data()->real(ConstructionPlugin_Axis::Y_DIRECTION()); - AttributeDoublePtr aZAttr = data()->real(ConstructionPlugin_Axis::Z_DIRECTION()); +void ConstructionPlugin_Axis::createAxisByPointAndDirection() { + AttributeSelectionPtr aRef1 = + data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); + AttributeDoublePtr aXAttr = + data()->real(ConstructionPlugin_Axis::X_DIRECTION()); + AttributeDoublePtr aYAttr = + data()->real(ConstructionPlugin_Axis::Y_DIRECTION()); + AttributeDoublePtr aZAttr = + data()->real(ConstructionPlugin_Axis::Z_DIRECTION()); if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) && (aYAttr.get() != NULL) && (aZAttr.get() != NULL)) { GeomShapePtr aShape1 = aRef1->value(); if (!aShape1.get()) aShape1 = aRef1->context()->shape(); - std::shared_ptr aVertex(new GeomAPI_Vertex(aXAttr->value(), - aYAttr->value(), - aZAttr->value())); - if (aShape1->isVertex() && - (fabs(aXAttr->value()) > MINIMAL_LENGTH() || - fabs(aYAttr->value()) > MINIMAL_LENGTH() || - fabs(aZAttr->value()) > MINIMAL_LENGTH())) { - std::shared_ptr aStart = GeomAlgoAPI_PointBuilder::point(aShape1); - std::shared_ptr anEnd(new GeomAPI_Pnt(aStart->x() + aXAttr->value(), - aStart->y() + aYAttr->value(), - aStart->z() + aZAttr->value())); + std::shared_ptr aVertex( + new GeomAPI_Vertex(aXAttr->value(), aYAttr->value(), aZAttr->value())); + if (aShape1->isVertex() && (fabs(aXAttr->value()) > MINIMAL_LENGTH() || + fabs(aYAttr->value()) > MINIMAL_LENGTH() || + fabs(aZAttr->value()) > MINIMAL_LENGTH())) { + std::shared_ptr aStart = + GeomAlgoAPI_PointBuilder::point(aShape1); + std::shared_ptr anEnd(new GeomAPI_Pnt( + aStart->x() + aXAttr->value(), aStart->y() + aYAttr->value(), + aStart->z() + aZAttr->value())); - std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); + std::shared_ptr anEdge = + GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -164,11 +169,10 @@ void ConstructionPlugin_Axis::createAxisByPointAndDirection() } } - -void ConstructionPlugin_Axis::createAxisByCylindricalFace() -{ - std::shared_ptr aSelection = data()->selection(CYLINDRICAL_FACE())->value(); - // update arguments due to the selection value +void ConstructionPlugin_Axis::createAxisByCylindricalFace() { + std::shared_ptr aSelection = + data()->selection(CYLINDRICAL_FACE())->value(); + // update arguments due to the selection value if (!aSelection.get() || aSelection->isNull()) { return; @@ -180,7 +184,8 @@ void ConstructionPlugin_Axis::createAxisByCylindricalFace() } if (aSelection->isFace()) { - std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection); + std::shared_ptr anEdge = + GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -189,53 +194,55 @@ void ConstructionPlugin_Axis::createAxisByCylindricalFace() } } -void ConstructionPlugin_Axis::createAxisByDimensions() -{ +void ConstructionPlugin_Axis::createAxisByDimensions() { // Start by getting these dimensions double aDX = data()->real(DX())->value(); double aDY = data()->real(DY())->value(); double aDZ = data()->real(DZ())->value(); - if (fabs(aDX) < MINIMAL_LENGTH() && fabs(aDY) < MINIMAL_LENGTH() && + if (fabs(aDX) < MINIMAL_LENGTH() && fabs(aDY) < MINIMAL_LENGTH() && fabs(aDZ) < MINIMAL_LENGTH()) { setError("Axis builder with dimensions :: all dimensions are null", false); - return ; + return; } // Make the axis, build the ResultConstructionPtr and write it - std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(aDX, aDY, aDZ); + std::shared_ptr anEdge = + GeomAlgoAPI_EdgeBuilder::line(aDX, aDY, aDZ); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); aConstr->setShape(anEdge); setResult(aConstr); } -void ConstructionPlugin_Axis::createAxisByLine() -{ +void ConstructionPlugin_Axis::createAxisByLine() { // Get edge. AttributeSelectionPtr anEdgeSelection = selection(LINE()); GeomShapePtr aLineShape = anEdgeSelection->value(); - if(!aLineShape.get()) { + if (!aLineShape.get()) { aLineShape = anEdgeSelection->context()->shape(); } GeomEdgePtr anEdge; if (aLineShape->isEdge()) { anEdge = aLineShape->edge(); - } - else if (aLineShape->isCompound()) { - // create an edge which covers all edges from compounds (they are on the same line) + } else if (aLineShape->isCompound()) { + // create an edge which covers all edges from compounds (they are on the + // same line) GeomPointPtr aFirst, aLast; GeomXYZPtr aLineVec; - for(GeomAPI_ShapeIterator anIt(aLineShape); anIt.more(); anIt.next()) { + for (GeomAPI_ShapeIterator anIt(aLineShape); anIt.more(); anIt.next()) { GeomEdgePtr aSub = anIt.current()->edge(); if (aSub.get() && aSub->isLine()) { if (!aLineVec.get()) { aFirst = aSub->firstPoint(); aLast = aSub->lastPoint(); } else { // set aFirst and aLast by extreme points - GeomXYZPtr aFirstVec = aSub->firstPoint()->xyz()->decreased(aFirst->xyz()); - bool aSameDirection = - aSub->lastPoint()->xyz()->decreased(aSub->firstPoint()->xyz())->dot(aLineVec) > 0; + GeomXYZPtr aFirstVec = + aSub->firstPoint()->xyz()->decreased(aFirst->xyz()); + bool aSameDirection = aSub->lastPoint() + ->xyz() + ->decreased(aSub->firstPoint()->xyz()) + ->dot(aLineVec) > 0; if (aLineVec->dot(aFirstVec) < -1.e-7) { // first point is changed aFirst = aSameDirection ? aSub->firstPoint() : aSub->lastPoint(); } else { // last point is changed @@ -255,19 +262,17 @@ void ConstructionPlugin_Axis::createAxisByLine() setResult(aConstr); } -void ConstructionPlugin_Axis::createAxisByPlaneAndPoint() -{ +void ConstructionPlugin_Axis::createAxisByPlaneAndPoint() { // Get face. AttributeSelectionPtr aFaceSelection = selection(PLANE()); GeomShapePtr aFaceShape = aFaceSelection->value(); - if(!aFaceShape.get()) { + if (!aFaceShape.get()) { aFaceShape = aFaceSelection->context()->shape(); } GeomFacePtr aFace; if (aFaceShape->isFace()) { aFace = aFaceShape->face(); - } - else if (aFaceShape->isCompound()) { + } else if (aFaceShape->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape); aFace = anIt.current()->face(); } @@ -278,7 +283,7 @@ void ConstructionPlugin_Axis::createAxisByPlaneAndPoint() // Get point. AttributeSelectionPtr aPointSelection = selection(POINT()); GeomShapePtr aPointShape = aPointSelection->value(); - if(!aPointShape.get()) { + if (!aPointShape.get()) { aPointShape = aPointSelection->context()->shape(); } std::shared_ptr aVertex(new GeomAPI_Vertex(aPointShape)); @@ -286,11 +291,12 @@ void ConstructionPlugin_Axis::createAxisByPlaneAndPoint() std::shared_ptr aProjPnt = aPln->project(aPnt); - if(aProjPnt->isEqual(aPnt)) { + if (aProjPnt->isEqual(aPnt)) { aPnt->translate(aPln->direction(), defaultAxisSize); } - std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(aPnt, aProjPnt); + std::shared_ptr anEdge = + GeomAlgoAPI_EdgeBuilder::line(aPnt, aProjPnt); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -298,19 +304,17 @@ void ConstructionPlugin_Axis::createAxisByPlaneAndPoint() setResult(aConstr); } -void ConstructionPlugin_Axis::createAxisByTwoPlanes() -{ +void ConstructionPlugin_Axis::createAxisByTwoPlanes() { // Get face 1. AttributeSelectionPtr aFaceSelection1 = selection(PLANE1()); GeomShapePtr aFaceShape1 = aFaceSelection1->value(); - if(!aFaceShape1.get()) { + if (!aFaceShape1.get()) { aFaceShape1 = aFaceSelection1->context()->shape(); } std::shared_ptr aFace1; if (aFaceShape1->isFace()) { aFace1 = aFaceShape1->face(); - } - else if (aFaceShape1->isCompound()) { + } else if (aFaceShape1->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape1); aFace1 = anIt.current()->face(); } @@ -319,10 +323,10 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes() std::shared_ptr aPln1 = aFace1->getPlane(); std::string useOffset1 = string(USE_OFFSET1())->value(); - if(!useOffset1.empty()) { + if (!useOffset1.empty()) { double anOffset1 = real(OFFSET1())->value(); bool reverseOffset1 = boolean(REVERSE_OFFSET1())->value(); - if(reverseOffset1) { + if (reverseOffset1) { anOffset1 = -anOffset1; } aPln1->translate(aPln1->direction(), anOffset1); @@ -331,14 +335,13 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes() // Get face 2. AttributeSelectionPtr aFaceSelection2 = selection(PLANE2()); GeomShapePtr aFaceShape2 = aFaceSelection2->value(); - if(!aFaceShape2.get()) { + if (!aFaceShape2.get()) { aFaceShape2 = aFaceSelection2->context()->shape(); } std::shared_ptr aFace2; if (aFaceShape2->isFace()) { aFace2 = aFaceShape2->face(); - } - else if (aFaceShape2->isCompound()) { + } else if (aFaceShape2->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape2); aFace2 = anIt.current()->face(); } @@ -347,10 +350,10 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes() std::shared_ptr aPln2 = aFace2->getPlane(); std::string useOffset2 = string(USE_OFFSET2())->value(); - if(!useOffset2.empty()) { + if (!useOffset2.empty()) { double anOffset2 = real(OFFSET2())->value(); bool reverseOffset2 = boolean(REVERSE_OFFSET2())->value(); - if(reverseOffset2) { + if (reverseOffset2) { anOffset2 = -anOffset2; } aPln2->translate(aPln2->direction(), anOffset2); @@ -361,7 +364,8 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes() std::shared_ptr aPnt2 = aLin->location(); aPnt2->translate(aLin->direction(), defaultAxisSize); - std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(aPnt1, aPnt2); + std::shared_ptr anEdge = + GeomAlgoAPI_EdgeBuilder::line(aPnt1, aPnt2); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -369,9 +373,9 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes() setResult(aConstr); } -void ConstructionPlugin_Axis::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(ConstructionPlugin_Axis::METHOD()); +void ConstructionPlugin_Axis::execute() { + AttributeStringPtr aMethodTypeAttr = + string(ConstructionPlugin_Axis::METHOD()); std::string aMethodType = aMethodTypeAttr->value(); if (aMethodType == CREATION_METHOD_BY_TWO_POINTS()) { createAxisByTwoPoints(); @@ -381,17 +385,17 @@ void ConstructionPlugin_Axis::execute() createAxisByPointAndDirection(); } else if (aMethodType == CREATION_METHOD_BY_DIMENSIONS()) { createAxisByDimensions(); - } else if(aMethodType == CREATION_METHOD_BY_LINE()) { + } else if (aMethodType == CREATION_METHOD_BY_LINE()) { createAxisByLine(); - } else if(aMethodType == CREATION_METHOD_BY_PLANE_AND_POINT()) { + } else if (aMethodType == CREATION_METHOD_BY_PLANE_AND_POINT()) { createAxisByPlaneAndPoint(); - } else if(aMethodType == CREATION_METHOD_BY_TWO_PLANES()) { + } else if (aMethodType == CREATION_METHOD_BY_TWO_PLANES()) { createAxisByTwoPlanes(); } } -bool ConstructionPlugin_Axis::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) -{ +bool ConstructionPlugin_Axis::customisePresentation(ResultPtr theResult, + AISObjectPtr thePrs) { bool isCustomized = false; isCustomized = thePrs->setLineStyle(3) || isCustomized; diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.h b/src/ConstructionPlugin/ConstructionPlugin_Axis.h index 90b61149b..7270790be 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@ -14,225 +14,196 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ConstructionPlugin_Axis_H #define ConstructionPlugin_Axis_H #include "ConstructionPlugin.h" +#include #include #include -#include /**\class ConstructionPlugin_Axis * \ingroup Plugins * \brief Feature for creation of the new axis in PartSet. */ -class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs -{ - public: +class ConstructionPlugin_Axis : public ModelAPI_Feature, + public GeomAPI_ICustomPrs { +public: /// Returns the kind of a feature - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + CONSTRUCTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = ConstructionPlugin_Axis::ID(); return MY_KIND; } /// Axis kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string CONSTRUCTION_AXIS_KIND("Axis"); return CONSTRUCTION_AXIS_KIND; } /// attribute name for first point - inline static const std::string& METHOD() - { + inline static const std::string &METHOD() { static const std::string METHOD_ATTR("CreationMethod"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_TWO_POINTS() - { + inline static const std::string &CREATION_METHOD_BY_TWO_POINTS() { static const std::string METHOD_ATTR("AxisByPointsCase"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_CYLINDRICAL_FACE() - { + inline static const std::string &CREATION_METHOD_BY_CYLINDRICAL_FACE() { static const std::string METHOD_ATTR("AxisByCylindricalFaceCase"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_POINT_AND_DIRECTION() - { + inline static const std::string &CREATION_METHOD_BY_POINT_AND_DIRECTION() { static const std::string METHOD_ATTR("AxisByPointAndDirection"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() - { + inline static const std::string &CREATION_METHOD_BY_DIMENSIONS() { static const std::string METHOD_ATTR("AxisByDimensionsCase"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_LINE() - { + inline static const std::string &CREATION_METHOD_BY_LINE() { static const std::string METHOD_ATTR("by_line"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_PLANE_AND_POINT() - { + inline static const std::string &CREATION_METHOD_BY_PLANE_AND_POINT() { static const std::string METHOD_ATTR("by_plane_and_point"); return METHOD_ATTR; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_TWO_PLANES() - { + inline static const std::string &CREATION_METHOD_BY_TWO_PLANES() { static const std::string METHOD_ATTR("by_two_planes"); return METHOD_ATTR; } /// attribute name for first point - inline static const std::string& POINT_FIRST() - { + inline static const std::string &POINT_FIRST() { static const std::string POINT_ATTR_FIRST("FirstPoint"); return POINT_ATTR_FIRST; } /// attribute name for second point - inline static const std::string& POINT_SECOND() - { + inline static const std::string &POINT_SECOND() { static const std::string POINT_ATTR_SECOND("SecondPoint"); return POINT_ATTR_SECOND; } /// attribute name for second point - inline static const std::string& CYLINDRICAL_FACE() - { + inline static const std::string &CYLINDRICAL_FACE() { static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace"); return CYLINDRICAL_FACE_ATTR; } /// attribute name for the X dimension - inline static const std::string& DX() - { + inline static const std::string &DX() { static const std::string DX_ATTR("DX"); return DX_ATTR; } /// attribute name for the Y dimension - inline static const std::string& DY() - { + inline static const std::string &DY() { static const std::string DY_ATTR("DY"); return DY_ATTR; } /// attribute name for the Z dimension - inline static const std::string& DZ() - { + inline static const std::string &DZ() { static const std::string DZ_ATTR("DZ"); return DZ_ATTR; } /// attribute name for X direction - inline static const std::string& X_DIRECTION() - { + inline static const std::string &X_DIRECTION() { static const std::string ATTR_X_DIRECTION("X_Direction"); return ATTR_X_DIRECTION; } /// attribute name for Y direction - inline static const std::string& Y_DIRECTION() - { + inline static const std::string &Y_DIRECTION() { static const std::string ATTR_Y_DIRECTION("Y_Direction"); return ATTR_Y_DIRECTION; } /// attribute name for Y direction - inline static const std::string& Z_DIRECTION() - { + inline static const std::string &Z_DIRECTION() { static const std::string ATTR_Z_DIRECTION("Z_Direction"); return ATTR_Z_DIRECTION; } /// Attribute name for line. - inline static const std::string& LINE() - { + inline static const std::string &LINE() { static const std::string ATTR_ID("line"); return ATTR_ID; } /// Attribute name for plane. - inline static const std::string& PLANE() - { + inline static const std::string &PLANE() { static const std::string ATTR_ID("plane"); return ATTR_ID; } /// Attribute name for point. - inline static const std::string& POINT() - { + inline static const std::string &POINT() { static const std::string ATTR_ID("point"); return ATTR_ID; } /// Attribute name for plane 1. - inline static const std::string& PLANE1() - { + inline static const std::string &PLANE1() { static const std::string ATTR_ID("plane1"); return ATTR_ID; } /// Attribute name for use offset for plane 1. - inline static const std::string& USE_OFFSET1() - { + inline static const std::string &USE_OFFSET1() { static const std::string ATTR_ID("use_offset1"); return ATTR_ID; } /// Attribute name for offset for plane 1. - inline static const std::string& OFFSET1() - { + inline static const std::string &OFFSET1() { static const std::string ATTR_ID("offset1"); return ATTR_ID; } /// Attribute name for reverse offset for plane 1. - inline static const std::string& REVERSE_OFFSET1() - { + inline static const std::string &REVERSE_OFFSET1() { static const std::string ATTR_ID("reverse_offset1"); return ATTR_ID; } /// Attribute name for plane 2. - inline static const std::string& PLANE2() - { + inline static const std::string &PLANE2() { static const std::string ATTR_ID("plane2"); return ATTR_ID; } /// Attribute name for use offset for plane 2. - inline static const std::string& USE_OFFSET2() - { + inline static const std::string &USE_OFFSET2() { static const std::string ATTR_ID("use_offset2"); return ATTR_ID; } /// Attribute name for offset for plane 2. - inline static const std::string& OFFSET2() - { + inline static const std::string &OFFSET2() { static const std::string ATTR_ID("offset2"); return ATTR_ID; } /// Attribute name for reverse offset for plane 2. - inline static const std::string& REVERSE_OFFSET2() - { + inline static const std::string &REVERSE_OFFSET2() { static const std::string ATTR_ID("reverse_offset2"); return ATTR_ID; } @@ -243,7 +214,8 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation @@ -252,7 +224,7 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP /// Customize presentation of the feature virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs); - protected: +protected: /// Creates a new axis by two defined points void createAxisByTwoPoints(); /// Creates a new axis using three dimensions @@ -266,5 +238,4 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP void createAxisByTwoPlanes(); }; - #endif diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 4d02af97f..8fb4a14bf 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionPlugin_Plane.h" @@ -37,34 +38,31 @@ #include #include +#include #include #include +#include #include #include -#include -#include #include #include #include #include - -static GeomShapePtr faceByThreeVertices(const std::shared_ptr theV1, - const std::shared_ptr theV2, - const std::shared_ptr theV3); -static std::shared_ptr makeRectangularFace( - const std::shared_ptr theFace, - const std::shared_ptr thePln); +static GeomShapePtr +faceByThreeVertices(const std::shared_ptr theV1, + const std::shared_ptr theV2, + const std::shared_ptr theV3); +static std::shared_ptr +makeRectangularFace(const std::shared_ptr theFace, + const std::shared_ptr thePln); //================================================================================================== -ConstructionPlugin_Plane::ConstructionPlugin_Plane() -{ -} +ConstructionPlugin_Plane::ConstructionPlugin_Plane() {} //================================================================================================== -void ConstructionPlugin_Plane::initAttributes() -{ +void ConstructionPlugin_Plane::initAttributes() { data()->addAttribute(ConstructionPlugin_Plane::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); @@ -91,9 +89,11 @@ void ConstructionPlugin_Plane::initAttributes() data()->addAttribute(PERPENDICULAR(), ModelAPI_AttributeBoolean::typeId()); // By other plane. - data()->addAttribute(CREATION_METHOD_BY_OTHER_PLANE_OPTION(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(CREATION_METHOD_BY_OTHER_PLANE_OPTION(), + ModelAPI_AttributeString::typeId()); data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(COINCIDENT_POINT(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(COINCIDENT_POINT(), + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(AXIS(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(ANGLE(), ModelAPI_AttributeDouble::typeId()); @@ -102,56 +102,59 @@ void ConstructionPlugin_Plane::initAttributes() data()->addAttribute(PLANE2(), ModelAPI_AttributeSelection::typeId()); // By other plane. - AttributeIntegerPtr aNbCopies = std::dynamic_pointer_cast( - data()->addAttribute(NB_COPIES(), ModelAPI_AttributeInteger::typeId())); + AttributeIntegerPtr aNbCopies = + std::dynamic_pointer_cast(data()->addAttribute( + NB_COPIES(), ModelAPI_AttributeInteger::typeId())); if (!aNbCopies->isInitialized()) aNbCopies->setValue(1); } //================================================================================================== -void ConstructionPlugin_Plane::execute() -{ +void ConstructionPlugin_Plane::execute() { ListOfShape aShapes; std::string aCreationMethod = string(CREATION_METHOD())->value(); - if(aCreationMethod == CREATION_METHOD_BY_GENERAL_EQUATION() || + if (aCreationMethod == CREATION_METHOD_BY_GENERAL_EQUATION() || aCreationMethod == "PlaneByGeneralEquation") { aShapes.push_back(createByGeneralEquation()); - } else if(aCreationMethod == CREATION_METHOD_BY_THREE_POINTS()) { + } else if (aCreationMethod == CREATION_METHOD_BY_THREE_POINTS()) { aShapes.push_back(createByThreePoints()); - } else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_POINT()) { + } else if (aCreationMethod == CREATION_METHOD_BY_LINE_AND_POINT()) { aShapes.push_back(createByLineAndPoint()); - } else if(aCreationMethod == CREATION_METHOD_BY_OTHER_PLANE()) { - std::string aCreationMethodOption = string(CREATION_METHOD_BY_OTHER_PLANE_OPTION())->value(); - if(aCreationMethodOption == CREATION_METHOD_BY_DISTANCE_FROM_OTHER()) { + } else if (aCreationMethod == CREATION_METHOD_BY_OTHER_PLANE()) { + std::string aCreationMethodOption = + string(CREATION_METHOD_BY_OTHER_PLANE_OPTION())->value(); + if (aCreationMethodOption == CREATION_METHOD_BY_DISTANCE_FROM_OTHER()) { createByDistanceFromOther(aShapes); - } else if(aCreationMethodOption == CREATION_METHOD_BY_COINCIDENT_TO_POINT()) { + } else if (aCreationMethodOption == + CREATION_METHOD_BY_COINCIDENT_TO_POINT()) { aShapes.push_back(createByCoincidentPoint()); - } else if(aCreationMethodOption == CREATION_METHOD_BY_ROTATION()) { + } else if (aCreationMethodOption == CREATION_METHOD_BY_ROTATION()) { createByRotation(aShapes); } - } else if(aCreationMethod == CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) { + } else if (aCreationMethod == CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) { aShapes.push_back(createByTwoParallelPlanes()); } else { - setError("Error: Plane creation method \"" + aCreationMethod + "\" not supported."); + setError("Error: Plane creation method \"" + aCreationMethod + + "\" not supported."); return; } - if(aShapes.size() == 0) { + if (aShapes.size() == 0) { setError("Error: Could not create a plane."); return; } int anIndex = 0; - for (auto aShapeIter = aShapes.begin(); aShapeIter != aShapes.end(); ++aShapeIter, ++anIndex) - { - if (!aShapeIter->get()) - { + for (auto aShapeIter = aShapes.begin(); aShapeIter != aShapes.end(); + ++aShapeIter, ++anIndex) { + if (!aShapeIter->get()) { setError("Error: Could not create a plane."); continue; } - ResultConstructionPtr aConstr = document()->createConstruction(data(), anIndex); + ResultConstructionPtr aConstr = + document()->createConstruction(data(), anIndex); aConstr->setInfinite(true); aConstr->setShape(*aShapeIter); setResult(aConstr, anIndex); @@ -160,13 +163,14 @@ void ConstructionPlugin_Plane::execute() } //================================================================================================== -bool ConstructionPlugin_Plane::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) -{ +bool ConstructionPlugin_Plane::customisePresentation(ResultPtr theResult, + AISObjectPtr thePrs) { std::vector aColor; // get color from the attribute of the result if (theResult.get() != NULL && theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { - AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aColorAttr = + theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() && aColorAttr->size()) { aColor.push_back(aColorAttr->value(0)); aColor.push_back(aColorAttr->value(1)); @@ -186,8 +190,8 @@ bool ConstructionPlugin_Plane::customisePresentation(ResultPtr theResult, AISObj } //================================================================================================== -std::shared_ptr ConstructionPlugin_Plane::createByGeneralEquation() -{ +std::shared_ptr +ConstructionPlugin_Plane::createByGeneralEquation() { AttributeDoublePtr anAttrA = real(ConstructionPlugin_Plane::A()); AttributeDoublePtr anAttrB = real(ConstructionPlugin_Plane::B()); AttributeDoublePtr anAttrC = real(ConstructionPlugin_Plane::C()); @@ -196,26 +200,25 @@ std::shared_ptr ConstructionPlugin_Plane::createByGeneralEquation if ((anAttrA.get() != NULL) && (anAttrB.get() != NULL) && (anAttrC.get() != NULL) && (anAttrD.get() != NULL) && anAttrA->isInitialized() && anAttrB->isInitialized() && - anAttrC->isInitialized() && anAttrD->isInitialized() ) { - double aA = anAttrA->value(), aB = anAttrB->value(), - aC = anAttrC->value(), aD = anAttrD->value(); + anAttrC->isInitialized() && anAttrD->isInitialized()) { + double aA = anAttrA->value(), aB = anAttrB->value(), aC = anAttrC->value(), + aD = anAttrD->value(); std::shared_ptr aPlane = - std::shared_ptr(new GeomAPI_Pln(aA, aB, aC, aD)); + std::shared_ptr(new GeomAPI_Pln(aA, aB, aC, aD)); double aSize = Config_PropManager::real(SKETCH_TAB_NAME, "planes_size"); if (aSize <= 1.e-7) - aSize = 200; // Set default value + aSize = 200; // Set default value aSize *= 4.; aPlaneFace = GeomAlgoAPI_FaceBuilder::squareFace(aPlane, aSize); } return aPlaneFace; } //================================================================================================== -std::shared_ptr ConstructionPlugin_Plane::createByThreePoints() -{ +std::shared_ptr ConstructionPlugin_Plane::createByThreePoints() { // Get first point. AttributeSelectionPtr aPointSelection1 = selection(POINT1()); GeomShapePtr aPointShape1 = aPointSelection1->value(); - if(!aPointShape1.get()) { + if (!aPointShape1.get()) { aPointShape1 = aPointSelection1->context()->shape(); } std::shared_ptr aVertex1(new GeomAPI_Vertex(aPointShape1)); @@ -223,7 +226,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByThreePoints() // Get second point. AttributeSelectionPtr aPointSelection2 = selection(POINT2()); GeomShapePtr aPointShape2 = aPointSelection2->value(); - if(!aPointShape2.get()) { + if (!aPointShape2.get()) { aPointShape2 = aPointSelection2->context()->shape(); } std::shared_ptr aVertex2(new GeomAPI_Vertex(aPointShape2)); @@ -231,7 +234,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByThreePoints() // Get third point. AttributeSelectionPtr aPointSelection3 = selection(POINT3()); GeomShapePtr aPointShape3 = aPointSelection3->value(); - if(!aPointShape3.get()) { + if (!aPointShape3.get()) { aPointShape3 = aPointSelection3->context()->shape(); } std::shared_ptr aVertex3(new GeomAPI_Vertex(aPointShape3)); @@ -242,19 +245,18 @@ std::shared_ptr ConstructionPlugin_Plane::createByThreePoints() } //================================================================================================== -std::shared_ptr ConstructionPlugin_Plane::createByLineAndPoint() -{ +std::shared_ptr +ConstructionPlugin_Plane::createByLineAndPoint() { // Get edge. AttributeSelectionPtr anEdgeSelection = selection(LINE()); GeomShapePtr aLineShape = anEdgeSelection->value(); - if(!aLineShape.get()) { + if (!aLineShape.get()) { aLineShape = anEdgeSelection->context()->shape(); } std::shared_ptr anEdge; if (aLineShape->isEdge()) { anEdge = aLineShape->edge(); - } - else if (aLineShape->isCompound()) { + } else if (aLineShape->isCompound()) { GeomAPI_ShapeIterator anIt(aLineShape); anEdge = anIt.current()->edge(); } @@ -264,24 +266,27 @@ std::shared_ptr ConstructionPlugin_Plane::createByLineAndPoint() // Get point. AttributeSelectionPtr aPointSelection = selection(POINT()); GeomShapePtr aPointShape = aPointSelection->value(); - if(!aPointShape.get()) { + if (!aPointShape.get()) { aPointShape = aPointSelection->context()->shape(); } std::shared_ptr aVertex(new GeomAPI_Vertex(aPointShape)); // Get perpendicular flag. - bool anIsPerpendicular= boolean(PERPENDICULAR())->value(); + bool anIsPerpendicular = boolean(PERPENDICULAR())->value(); GeomShapePtr aRes; - if(anIsPerpendicular) { + if (anIsPerpendicular) { std::shared_ptr aLin = anEdge->line(); std::shared_ptr aPnt = aVertex->point(); - std::shared_ptr aNewPln(new GeomAPI_Pln(aPnt, aLin->direction())); + std::shared_ptr aNewPln( + new GeomAPI_Pln(aPnt, aLin->direction())); double aSize = aLin->distance(aPnt) * 2; - // point may belong to line, so for the face size use maximum distance between point and line - // and the line size (distance between the start and end point) + // point may belong to line, so for the face size use maximum distance + // between point and line and the line size (distance between the start and + // end point) double aDistance = anEdge->firstPoint()->distance(anEdge->lastPoint()); - aRes = GeomAlgoAPI_FaceBuilder::squareFace(aNewPln, aSize > aDistance ? aSize : aDistance); + aRes = GeomAlgoAPI_FaceBuilder::squareFace( + aNewPln, aSize > aDistance ? aSize : aDistance); } else { std::shared_ptr aV1, aV2; GeomAlgoAPI_ShapeTools::findBounds(anEdge, aV1, aV2); @@ -292,33 +297,36 @@ std::shared_ptr ConstructionPlugin_Plane::createByLineAndPoint() } //================================================================================================== -void ConstructionPlugin_Plane::createByDistanceFromOther(ListOfShape& theShapes) -{ - AttributeSelectionPtr aFaceAttr = data()->selection(ConstructionPlugin_Plane::PLANE()); - AttributeDoublePtr aDistAttr = data()->real(ConstructionPlugin_Plane::DISTANCE()); - AttributeIntegerPtr aNbCopyAttr = data()->integer(ConstructionPlugin_Plane::NB_COPIES()); - if ((aFaceAttr.get() != NULL) && - (aDistAttr.get() != NULL) && (aNbCopyAttr.get() != NULL) && - aFaceAttr->isInitialized() && aDistAttr->isInitialized()) { +void ConstructionPlugin_Plane::createByDistanceFromOther( + ListOfShape &theShapes) { + AttributeSelectionPtr aFaceAttr = + data()->selection(ConstructionPlugin_Plane::PLANE()); + AttributeDoublePtr aDistAttr = + data()->real(ConstructionPlugin_Plane::DISTANCE()); + AttributeIntegerPtr aNbCopyAttr = + data()->integer(ConstructionPlugin_Plane::NB_COPIES()); + if ((aFaceAttr.get() != NULL) && (aDistAttr.get() != NULL) && + (aNbCopyAttr.get() != NULL) && aFaceAttr->isInitialized() && + aDistAttr->isInitialized()) { double aDist = aDistAttr->value(); bool anIsReverse = boolean(REVERSE())->value(); int aNumOfCopies = aNbCopyAttr->value(); - if(anIsReverse) aDist = -aDist; + if (anIsReverse) + aDist = -aDist; GeomShapePtr aShape = aFaceAttr->value(); if (!aShape.get() && aFaceAttr->context()) { aShape = aFaceAttr->context()->shape(); } - if(!aShape.get()) { + if (!aShape.get()) { return; } std::shared_ptr aFace; if (aShape->isFace()) { aFace = aShape->face(); - } - else if (aShape->isCompound()) { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); aFace = anIt.current()->face(); } @@ -329,8 +337,7 @@ void ConstructionPlugin_Plane::createByDistanceFromOther(ListOfShape& theShapes) std::shared_ptr aOrig = aPln->location(); std::shared_ptr aDir = aPln->direction(); - for (int aNbCopy = 0; aNbCopy < aNumOfCopies; ++aNbCopy) - { + for (int aNbCopy = 0; aNbCopy < aNumOfCopies; ++aNbCopy) { std::shared_ptr aPlane; aOrig->translate(aDir, aDist); std::shared_ptr aNewPln(new GeomAPI_Pln(aOrig, aDir)); @@ -342,19 +349,18 @@ void ConstructionPlugin_Plane::createByDistanceFromOther(ListOfShape& theShapes) } //================================================================================================== -std::shared_ptr ConstructionPlugin_Plane::createByCoincidentPoint() -{ +std::shared_ptr +ConstructionPlugin_Plane::createByCoincidentPoint() { // Get face. AttributeSelectionPtr aFaceSelection = selection(PLANE()); GeomShapePtr aFaceShape = aFaceSelection->value(); - if(!aFaceShape.get()) { + if (!aFaceShape.get()) { aFaceShape = aFaceSelection->context()->shape(); } std::shared_ptr aFace; if (aFaceShape->isFace()) { aFace = aFaceShape->face(); - } - else if (aFaceShape->isCompound()) { + } else if (aFaceShape->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape); aFace = anIt.current()->face(); } @@ -362,7 +368,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByCoincidentPoint // Get point. AttributeSelectionPtr aPointSelection = selection(COINCIDENT_POINT()); GeomShapePtr aPointShape = aPointSelection->value(); - if(!aPointShape.get()) { + if (!aPointShape.get()) { aPointShape = aPointSelection->context()->shape(); } std::shared_ptr aVertex = aPointShape->vertex(); @@ -379,19 +385,17 @@ std::shared_ptr ConstructionPlugin_Plane::createByCoincidentPoint } //================================================================================================== -void ConstructionPlugin_Plane::createByRotation(ListOfShape& theShapes) -{ +void ConstructionPlugin_Plane::createByRotation(ListOfShape &theShapes) { // Get face. AttributeSelectionPtr aFaceSelection = selection(PLANE()); GeomShapePtr aFaceShape = aFaceSelection->value(); - if(!aFaceShape.get()) { + if (!aFaceShape.get()) { aFaceShape = aFaceSelection->context()->shape(); } std::shared_ptr aFace; if (aFaceShape->isFace()) { aFace = aFaceShape->face(); - } - else if (aFaceShape->isCompound()) { + } else if (aFaceShape->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape); aFace = anIt.current()->face(); } @@ -402,64 +406,63 @@ void ConstructionPlugin_Plane::createByRotation(ListOfShape& theShapes) // Get axis. AttributeSelectionPtr anAxisSelection = selection(AXIS()); GeomShapePtr anAxisShape = anAxisSelection->value(); - if(!anAxisShape.get()) { + if (!anAxisShape.get()) { anAxisShape = anAxisSelection->context()->shape(); } std::shared_ptr anEdge; if (anAxisShape->isEdge()) { anEdge = anAxisShape->edge(); - } - else if (anAxisShape->isCompound()) { + } else if (anAxisShape->isCompound()) { GeomAPI_ShapeIterator anIt(anAxisShape); anEdge = anIt.current()->edge(); } if (!anEdge) return; - AttributeIntegerPtr aNbCopyAttr = data()->integer(ConstructionPlugin_Plane::NB_COPIES()); + AttributeIntegerPtr aNbCopyAttr = + data()->integer(ConstructionPlugin_Plane::NB_COPIES()); int aNBCopy; if (!aNbCopyAttr.get()) return; aNBCopy = aNbCopyAttr->value(); - std::shared_ptr anAxis = - std::shared_ptr(new GeomAPI_Ax1(anEdge->line()->location(), - anEdge->line()->direction())); + std::shared_ptr anAxis = std::shared_ptr( + new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); // Getting angle. double anAngle = real(ANGLE())->value(); - for (int anIndex = 1; anIndex <= aNBCopy; ++anIndex) - { + for (int anIndex = 1; anIndex <= aNBCopy; ++anIndex) { std::shared_ptr aRotationAlgo( - new GeomAlgoAPI_Rotation(aFace, anAxis, anAngle * anIndex)); + new GeomAlgoAPI_Rotation(aFace, anAxis, anAngle * anIndex)); // Checking that the algorithm worked properly. std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, + getKind(), anError)) { setError("Error: Failed to rotate plane"); return; } - std::shared_ptr aRes(new GeomAPI_Face(aRotationAlgo->shape())); + std::shared_ptr aRes( + new GeomAPI_Face(aRotationAlgo->shape())); theShapes.push_back(aRes); } } //================================================================================================== -std::shared_ptr ConstructionPlugin_Plane::createByTwoParallelPlanes() -{ +std::shared_ptr +ConstructionPlugin_Plane::createByTwoParallelPlanes() { // Get plane 1. AttributeSelectionPtr aFaceSelection1 = selection(PLANE1()); GeomShapePtr aFaceShape1 = aFaceSelection1->value(); - if(!aFaceShape1.get()) { + if (!aFaceShape1.get()) { aFaceShape1 = aFaceSelection1->context()->shape(); } std::shared_ptr aFace1; if (aFaceShape1->isFace()) { aFace1 = aFaceShape1->face(); - } - else if (aFaceShape1->isCompound()) { + } else if (aFaceShape1->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape1); aFace1 = anIt.current()->face(); } @@ -470,14 +473,13 @@ std::shared_ptr ConstructionPlugin_Plane::createByTwoParallelPlan // Get plane 2. AttributeSelectionPtr aFaceSelection2 = selection(PLANE2()); GeomShapePtr aFaceShape2 = aFaceSelection2->value(); - if(!aFaceShape2.get()) { + if (!aFaceShape2.get()) { aFaceShape2 = aFaceSelection2->context()->shape(); } std::shared_ptr aFace2; if (aFaceShape2->isFace()) { aFace2 = aFaceShape2->face(); - } - else if (aFaceShape2->isCompound()) { + } else if (aFaceShape2->isCompound()) { GeomAPI_ShapeIterator anIt(aFaceShape2); aFace2 = anIt.current()->face(); } @@ -488,10 +490,11 @@ std::shared_ptr ConstructionPlugin_Plane::createByTwoParallelPlan std::shared_ptr anOrig1 = aPln1->location(); std::shared_ptr aPntOnPln2 = aPln2->project(anOrig1); - std::shared_ptr aNewOrig(new GeomAPI_Pnt(anOrig1->xyz()->added( - aPntOnPln2->xyz())->multiplied(0.5))); + std::shared_ptr aNewOrig(new GeomAPI_Pnt( + anOrig1->xyz()->added(aPntOnPln2->xyz())->multiplied(0.5))); - std::shared_ptr aNewPln(new GeomAPI_Pln(aNewOrig, aPln1->direction())); + std::shared_ptr aNewPln( + new GeomAPI_Pln(aNewOrig, aPln1->direction())); std::shared_ptr aRes = makeRectangularFace(aFace1, aNewPln); @@ -501,26 +504,26 @@ std::shared_ptr ConstructionPlugin_Plane::createByTwoParallelPlan //================================================================================================== GeomShapePtr faceByThreeVertices(const std::shared_ptr theV1, const std::shared_ptr theV2, - const std::shared_ptr theV3) -{ + const std::shared_ptr theV3) { std::shared_ptr aFace = - GeomAlgoAPI_FaceBuilder::planarFaceByThreeVertices(theV1, theV2, theV3); + GeomAlgoAPI_FaceBuilder::planarFaceByThreeVertices(theV1, theV2, theV3); ListOfShape anObjects; anObjects.push_back(theV1); anObjects.push_back(theV2); anObjects.push_back(theV3); - std::list > aBoundingPoints = - GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0); - GeomShapePtr aRes = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aFace, aBoundingPoints); + std::list> aBoundingPoints = + GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0); + GeomShapePtr aRes = + GeomAlgoAPI_ShapeTools::fitPlaneToBox(aFace, aBoundingPoints); return aRes; } //================================================================================================== -std::shared_ptr makeRectangularFace(const std::shared_ptr theFace, - const std::shared_ptr thePln) -{ +std::shared_ptr +makeRectangularFace(const std::shared_ptr theFace, + const std::shared_ptr thePln) { // Create rectangular face close to the selected double aXmin, aYmin, Zmin, aXmax, aYmax, Zmax; theFace->computeSize(aXmin, aYmin, Zmin, aXmax, aYmax, Zmax); @@ -529,11 +532,12 @@ std::shared_ptr makeRectangularFace(const std::shared_ptr aPnt(new GeomAPI_Pnt( - aXIsMin ? aXmin : aXmax, aYIsMin ? aYmin : aYmax, aZIsMin ? Zmin : Zmax)); + for (int aXIsMin = 0; aXIsMin < 2; aXIsMin++) { + for (int aYIsMin = 0; aYIsMin < 2; aYIsMin++) { + for (int aZIsMin = 0; aZIsMin < 2; aZIsMin++) { + std::shared_ptr aPnt( + new GeomAPI_Pnt(aXIsMin ? aXmin : aXmax, aYIsMin ? aYmin : aYmax, + aZIsMin ? Zmin : Zmax)); std::shared_ptr aPnt2d = aPnt->to2D(thePln); if (isFirst || aPnt2d->x() < aMinX2d) aMinX2d = aPnt2d->x(); @@ -550,9 +554,9 @@ std::shared_ptr makeRectangularFace(const std::shared_ptr aResFace = GeomAlgoAPI_FaceBuilder::planarFace(thePln, - aMinX2d - aWgap, aMinY2d - aHgap, aMaxX2d - aMinX2d + 2. * aWgap, - aMaxY2d - aMinY2d + 2. * aHgap); + std::shared_ptr aResFace = GeomAlgoAPI_FaceBuilder::planarFace( + thePln, aMinX2d - aWgap, aMinY2d - aHgap, aMaxX2d - aMinX2d + 2. * aWgap, + aMaxY2d - aMinY2d + 2. * aHgap); return aResFace; } diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index aa741eceb..39af4dda3 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ConstructionPlugin_Plane_H @@ -22,238 +23,209 @@ #include "ConstructionPlugin.h" -#include -#include #include #include +#include +#include /// \class ConstructionPlugin_Plane /// \ingroup Plugins /// \brief Feature for creation of the new planar surface in PartSet. -class ConstructionPlugin_Plane: public ModelAPI_Feature, public GeomAPI_ICustomPrs -{ +class ConstructionPlugin_Plane : public ModelAPI_Feature, + public GeomAPI_ICustomPrs { public: /// \return the kind of a feature. - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() - { + CONSTRUCTIONPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = ConstructionPlugin_Plane::ID(); return MY_KIND; } /// Default color for a plane. - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string CONSTRUCTION_PLANE_COLOR("150,150,180"); return CONSTRUCTION_PLANE_COLOR; } /// Default color property name. - inline static const std::string& COLOR_NAME() - { + inline static const std::string &COLOR_NAME() { static const std::string PLANE_COLOR_NAME("construction_plane_color"); return PLANE_COLOR_NAME; } /// Plane kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string CONSTRUCTION_PLANE_KIND("Plane"); return CONSTRUCTION_PLANE_KIND; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("creation_method"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_GENERAL_EQUATION() - { + inline static const std::string &CREATION_METHOD_BY_GENERAL_EQUATION() { static const std::string MY_CREATION_METHOD_ID("by_general_equation"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_THREE_POINTS() - { + inline static const std::string &CREATION_METHOD_BY_THREE_POINTS() { static const std::string MY_CREATION_METHOD_ID("by_three_points"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_LINE_AND_POINT() - { + inline static const std::string &CREATION_METHOD_BY_LINE_AND_POINT() { static const std::string MY_CREATION_METHOD_ID("by_line_and_point"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_OTHER_PLANE() - { + inline static const std::string &CREATION_METHOD_BY_OTHER_PLANE() { static const std::string MY_CREATION_METHOD_ID("by_other_plane"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_OTHER_PLANE_OPTION() - { + inline static const std::string &CREATION_METHOD_BY_OTHER_PLANE_OPTION() { static const std::string MY_CREATION_METHOD_ID("by_other_plane_option"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_DISTANCE_FROM_OTHER() - { + inline static const std::string &CREATION_METHOD_BY_DISTANCE_FROM_OTHER() { static const std::string MY_CREATION_METHOD_ID("by_distance_from_other"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_COINCIDENT_TO_POINT() - { + inline static const std::string &CREATION_METHOD_BY_COINCIDENT_TO_POINT() { static const std::string MY_CREATION_METHOD_ID("by_coincident_to_point"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_ROTATION() - { + inline static const std::string &CREATION_METHOD_BY_ROTATION() { static const std::string MY_CREATION_METHOD_ID("by_rotation"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_TWO_PARALLEL_PLANES() - { + inline static const std::string &CREATION_METHOD_BY_TWO_PARALLEL_PLANES() { static const std::string MY_CREATION_METHOD_ID("by_two_parallel_planes"); return MY_CREATION_METHOD_ID; } /// Attribute name for first point. - inline static const std::string& POINT1() - { + inline static const std::string &POINT1() { static const std::string ATTR_ID("point1"); return ATTR_ID; } /// Attribute name for second point. - inline static const std::string& POINT2() - { + inline static const std::string &POINT2() { static const std::string ATTR_ID("point2"); return ATTR_ID; } /// Attribute name for third point. - inline static const std::string& POINT3() - { + inline static const std::string &POINT3() { static const std::string ATTR_ID("point3"); return ATTR_ID; } /// Attribute name for line. - inline static const std::string& LINE() - { + inline static const std::string &LINE() { static const std::string ATTR_ID("line"); return ATTR_ID; } /// Attribute name for point. - inline static const std::string& POINT() - { + inline static const std::string &POINT() { static const std::string ATTR_ID("point"); return ATTR_ID; } /// Attribute name for perpendicular flag. - inline static const std::string& PERPENDICULAR() - { + inline static const std::string &PERPENDICULAR() { static const std::string ATTR_ID("perpendicular"); return ATTR_ID; } /// Attribute name for selected plane. - inline static const std::string& PLANE() - { + inline static const std::string &PLANE() { static const std::string ATTR_ID("plane"); return ATTR_ID; } /// Attribute name for distance. - inline static const std::string& DISTANCE() - { + inline static const std::string &DISTANCE() { static const std::string ATTR_ID("distance"); return ATTR_ID; } /// Attribute name for reverse flag. - inline static const std::string& REVERSE() - { + inline static const std::string &REVERSE() { static const std::string ATTR_ID("reverse"); return ATTR_ID; } /// Attribute name for coincident point. - inline static const std::string& COINCIDENT_POINT() - { + inline static const std::string &COINCIDENT_POINT() { static const std::string ATTR_ID("coincident_point"); return ATTR_ID; } /// Attribute name for axis. - inline static const std::string& AXIS() - { + inline static const std::string &AXIS() { static const std::string ATTR_ID("axis"); return ATTR_ID; } /// Attribute name for angle. - inline static const std::string& ANGLE() - { + inline static const std::string &ANGLE() { static const std::string ATTR_ID("angle"); return ATTR_ID; } - inline static const std::string& PLANE1() - { + inline static const std::string &PLANE1() { static const std::string ATTR_ID("plane1"); return ATTR_ID; } - inline static const std::string& PLANE2() - { + inline static const std::string &PLANE2() { static const std::string ATTR_ID("plane2"); return ATTR_ID; } - inline static const std::string& NB_COPIES() - { + inline static const std::string &NB_COPIES() { static const std::string ATTR_ID("nb_copies"); return ATTR_ID; } - /// Attribute name for a parameter for the general equation of a plane (ax+by+cz+d=0) - inline static const std::string& A() - { + /// Attribute name for a parameter for the general equation of a plane + /// (ax+by+cz+d=0) + inline static const std::string &A() { static const std::string ATTR_ID("A"); return ATTR_ID; } - /// Attribute name for b parameter for the general equation of a plane (ax+by+cz+d=0) - inline static const std::string& B() - { + /// Attribute name for b parameter for the general equation of a plane + /// (ax+by+cz+d=0) + inline static const std::string &B() { static const std::string ATTR_ID("B"); return ATTR_ID; } - /// Attribute name for c parameter for the general equation of a plane (ax+by+cz+d=0) - inline static const std::string& C() - { + /// Attribute name for c parameter for the general equation of a plane + /// (ax+by+cz+d=0) + inline static const std::string &C() { static const std::string ATTR_ID("C"); return ATTR_ID; } - /// Attribute name for d parameter for the general equation of a plane (ax+by+cz+d=0) - inline static const std::string& D() - { + /// Attribute name for d parameter for the general equation of a plane + /// (ax+by+cz+d=0) + inline static const std::string &D() { static const std::string ATTR_ID("D"); return ATTR_ID; } @@ -261,7 +233,8 @@ public: /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation @@ -276,11 +249,11 @@ protected: std::shared_ptr createByThreePoints(); std::shared_ptr createByLineAndPoint(); std::shared_ptr createByCoincidentPoint(); - void createByRotation(ListOfShape& theShapes); + void createByRotation(ListOfShape &theShapes); std::shared_ptr createByTwoParallelPlanes(); - /// Creates a new plane by copy of face plane with translation along the normal - /// to the specified distance. - void createByDistanceFromOther(ListOfShape& theShapes); + /// Creates a new plane by copy of face plane with translation along the + /// normal to the specified distance. + void createByDistanceFromOther(ListOfShape &theShapes); }; #endif diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp index a777b6879..80cdd0b3b 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp @@ -14,83 +14,97 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionPlugin_Plugin.h" -#include "ConstructionPlugin_Point.h" #include "ConstructionPlugin_Axis.h" #include "ConstructionPlugin_Plane.h" +#include "ConstructionPlugin_Point.h" #include "ConstructionPlugin_Validators.h" #include -#include #include +#include -#define SKETCH_WIDTH "4" +#define SKETCH_WIDTH "4" /// face of the square-face displayed for selection of general plane -#define PLANE_SIZE "200" +#define PLANE_SIZE "200" // the only created instance of this plugin -static ConstructionPlugin_Plugin* MY_CONSTRUCTION_INSTANCE = new ConstructionPlugin_Plugin(); +static ConstructionPlugin_Plugin *MY_CONSTRUCTION_INSTANCE = + new ConstructionPlugin_Plugin(); -ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() -{ +ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("ConstructionPlugin_ValidatorPointLines", new ConstructionPlugin_ValidatorPointLines()); - aFactory->registerValidator("ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel", - new ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel()); - aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneThreePoints", - new ConstructionPlugin_ValidatorPlaneThreePoints()); + aFactory->registerValidator( + "ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel", + new ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel()); + aFactory->registerValidator( + "ConstructionPlugin_ValidatorPlaneThreePoints", + new ConstructionPlugin_ValidatorPlaneThreePoints()); aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneLinePoint", new ConstructionPlugin_ValidatorPlaneLinePoint()); - aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneTwoParallelPlanes", - new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes()); - aFactory->registerValidator("ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes", - new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes()); - aFactory->registerValidator("ConstructionPlugin_ValidatorPointThreeNonParallelPlanes", - new ConstructionPlugin_ValidatorPointThreeNonParallelPlanes()); + aFactory->registerValidator( + "ConstructionPlugin_ValidatorPlaneTwoParallelPlanes", + new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes()); + aFactory->registerValidator( + "ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes", + new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes()); + aFactory->registerValidator( + "ConstructionPlugin_ValidatorPointThreeNonParallelPlanes", + new ConstructionPlugin_ValidatorPointThreeNonParallelPlanes()); aFactory->registerValidator("ConstructionPlugin_ValidatorNotFeature", new ConstructionPlugin_ValidatorNotFeature()); - Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::DblSpin, - PLANE_SIZE, "0", "1000"); - Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness", - Config_Prop::IntSpin, SKETCH_WIDTH); - Config_PropManager::registerProp(SKETCH_TAB_NAME, "angular_tolerance", "Angular tolerance", - Config_Prop::DblSpin, "0.04"); - Config_PropManager::registerProp(SKETCH_TAB_NAME, "spline_weight", "Default spline weight", - Config_Prop::DblSpin, "1.0"); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", + Config_Prop::DblSpin, PLANE_SIZE, "0", + "1000"); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", + "Thickness", Config_Prop::IntSpin, + SKETCH_WIDTH); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "angular_tolerance", + "Angular tolerance", Config_Prop::DblSpin, + "0.04"); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "spline_weight", + "Default spline weight", + Config_Prop::DblSpin, "1.0"); Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane", - "Rotate to plane when selected", Config_Prop::Boolean, "false"); + "Rotate to plane when selected", + Config_Prop::Boolean, "false"); Config_PropManager::registerProp(SKETCH_TAB_NAME, "operation_cursor", - "Cursor for Sketch operation", Config_Prop::Cursor, "0"); + "Cursor for Sketch operation", + Config_Prop::Cursor, "0"); Config_PropManager::registerProp(SKETCH_TAB_NAME, "create_by_dragging", - "Create sketch entities by dragging", Config_Prop::Boolean, "false"); + "Create sketch entities by dragging", + Config_Prop::Boolean, "false"); // register this plugin ModelAPI_Session::get()->registerPlugin(this); // register construction properties - Config_PropManager::registerProp("Visualization", ConstructionPlugin_Plane::COLOR_NAME(), - "Construction plane color", Config_Prop::Color, ConstructionPlugin_Plane::DEFAULT_COLOR()); + Config_PropManager::registerProp( + "Visualization", ConstructionPlugin_Plane::COLOR_NAME(), + "Construction plane color", Config_Prop::Color, + ConstructionPlugin_Plane::DEFAULT_COLOR()); - Config_PropManager::registerProp("Visualization", ConstructionPlugin_Point::COLOR_NAME(), - "Construction point color", Config_Prop::Color, ConstructionPlugin_Point::DEFAULT_COLOR()); + Config_PropManager::registerProp( + "Visualization", ConstructionPlugin_Point::COLOR_NAME(), + "Construction point color", Config_Prop::Color, + ConstructionPlugin_Point::DEFAULT_COLOR()); } -FeaturePtr ConstructionPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr ConstructionPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == ConstructionPlugin_Point::ID()) { return FeaturePtr(new ConstructionPlugin_Point); - } - else if (theFeatureID == ConstructionPlugin_Axis::ID()) { + } else if (theFeatureID == ConstructionPlugin_Axis::ID()) { return FeaturePtr(new ConstructionPlugin_Axis); - } - else if (theFeatureID == ConstructionPlugin_Plane::ID()) { + } else if (theFeatureID == ConstructionPlugin_Plane::ID()) { return FeaturePtr(new ConstructionPlugin_Plane); } // feature of such kind is not found diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h index 1abdb256b..6b128b60c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ConstructionPlugin_Plugin_H_ #define ConstructionPlugin_Plugin_H_ #include "ConstructionPlugin.h" -#include "ModelAPI_Plugin.h" #include "ModelAPI_Feature.h" +#include "ModelAPI_Plugin.h" /**\class ConstructionPlugin_Plugin * \ingroup Plugins * \brief The main class for management the construction features as plugin. */ -class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin : public ModelAPI_Plugin -{ +class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin + : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 830920ad3..59b621686 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionPlugin_Point.h" @@ -33,37 +34,37 @@ #include #include -#include -#include #include +#include #include +#include #include //================================================================================================== -ConstructionPlugin_Point::ConstructionPlugin_Point() -{ -} +ConstructionPlugin_Point::ConstructionPlugin_Point() {} //================================================================================================== -const std::string& ConstructionPlugin_Point::getKind() -{ +const std::string &ConstructionPlugin_Point::getKind() { static std::string MY_KIND = ConstructionPlugin_Point::ID(); return MY_KIND; } //================================================================================================== -void ConstructionPlugin_Point::initAttributes() -{ +void ConstructionPlugin_Point::initAttributes() { data()->addAttribute(POINT3D(), GeomDataAPI_Point::typeId()); data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(INTERSECTION_LINE_1(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(INTERSECTION_LINE_2(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_LINE_1(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_LINE_2(), + ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(INTERSECTION_LINE(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(INTERSECTION_PLANE(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_LINE(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_PLANE(), + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(USE_OFFSET(), ModelAPI_AttributeString::typeId()); data()->addAttribute(OFFSET(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(REVERSE_OFFSET(), ModelAPI_AttributeBoolean::typeId()); @@ -74,53 +75,67 @@ void ConstructionPlugin_Point::initAttributes() data()->addAttribute(RATIO(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(POINT_TO_PROJECT(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(POINT_TO_PROJECT(), + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(PROJECTION_TYPE(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(EDGE_FOR_POINT_PROJECTION(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FACE_FOR_POINT_PROJECTION(), + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(INTERSECTION_TYPE(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection::typeId()); - - data()->addAttribute(GEOMETRICAL_PROPERTY_TYPE(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(OBJECT_FOR_CENTER_OF_GRAVITY(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(OBJECT_FOR_CENTER_OF_CIRCLE(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_PLANE_1(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_PLANE_2(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_PLANE_3(), + ModelAPI_AttributeSelection::typeId()); + + data()->addAttribute(GEOMETRICAL_PROPERTY_TYPE(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(OBJECT_FOR_CENTER_OF_GRAVITY(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(OBJECT_FOR_CENTER_OF_CIRCLE(), + ModelAPI_AttributeSelection::typeId()); } //================================================================================================== -void ConstructionPlugin_Point::execute() -{ +void ConstructionPlugin_Point::execute() { GeomShapePtr aShape; - // to support compatibility with old documents where aCreationMethod did not exist + // to support compatibility with old documents where aCreationMethod did not + // exist std::string aCreationMethod = - string(CREATION_METHOD()).get() && !string(CREATION_METHOD())->value().empty() ? - string(CREATION_METHOD())->value() : CREATION_METHOD_BY_XYZ(); - if(aCreationMethod == CREATION_METHOD_BY_XYZ()) { + string(CREATION_METHOD()).get() && + !string(CREATION_METHOD())->value().empty() + ? string(CREATION_METHOD())->value() + : CREATION_METHOD_BY_XYZ(); + if (aCreationMethod == CREATION_METHOD_BY_XYZ()) { aShape = createByXYZ(); - } else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) { + } else if (aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) { aShape = createByDistanceOnEdge(); - } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) { + } else if (aCreationMethod == CREATION_METHOD_BY_PROJECTION()) { if (string(PROJECTION_TYPE())->value() == PROJECTION_TYPE_ON_EDGE()) { aShape = createByProjectionOnEdge(); } else { aShape = createByProjectionOnFace(); } - } else if(aCreationMethod == CREATION_METHOD_BY_INTERSECTION()) { + } else if (aCreationMethod == CREATION_METHOD_BY_INTERSECTION()) { std::string anIntersectionType = string(INTERSECTION_TYPE())->value(); if (anIntersectionType == INTERSECTION_TYPE_BY_LINES()) { aShape = createByLinesIntersection(); } else if (anIntersectionType == INTERSECTION_TYPE_BY_LINE_AND_PLANE()) { // this may produce several points - std::list > aPoints = createByLineAndPlaneIntersection(); - if (!aPoints.empty()) { // if no points found produce the standard error later + std::list> aPoints = + createByLineAndPlaneIntersection(); + if (!aPoints.empty()) { // if no points found produce the standard error + // later int anIndex = 0; - std::list >::iterator aPIter = aPoints.begin(); + std::list>::iterator aPIter = + aPoints.begin(); for (; aPIter != aPoints.end(); aPIter++, anIndex++) { std::shared_ptr aConstr = - document()->createConstruction(data(), anIndex); + document()->createConstruction(data(), anIndex); aConstr->setInfinite(true); aConstr->setShape(*aPIter); setResult(aConstr, anIndex); @@ -132,21 +147,25 @@ void ConstructionPlugin_Point::execute() aShape = createByPlanesIntersection(); } } else if (aCreationMethod == CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) { - std::string aGeometricalPropertyType = string(GEOMETRICAL_PROPERTY_TYPE())->value(); - if (aGeometricalPropertyType == GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()) { + std::string aGeometricalPropertyType = + string(GEOMETRICAL_PROPERTY_TYPE())->value(); + if (aGeometricalPropertyType == + GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()) { aShape = createByCenterOfGravity(); } else { aShape = createByCenterOfCircle(); } } - if(!aShape.get()) { + if (!aShape.get()) { setError("Error: intersection not found."); return; } - removeResults(1); // for case the point type was switched from multi-results type - std::shared_ptr aConstr = document()->createConstruction(data()); + removeResults( + 1); // for case the point type was switched from multi-results type + std::shared_ptr aConstr = + document()->createConstruction(data()); aConstr->setInfinite(true); aConstr->setShape(aShape); setResult(aConstr); @@ -154,13 +173,13 @@ void ConstructionPlugin_Point::execute() //================================================================================================== bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult, - AISObjectPtr thePrs) -{ + AISObjectPtr thePrs) { std::vector aColor; // get color from the attribute of the result if (theResult.get() != NULL && - theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { - AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { + AttributeIntArrayPtr aColorAttr = + theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() && aColorAttr->size()) { aColor.push_back(aColorAttr->value(0)); aColor.push_back(aColorAttr->value(1)); @@ -173,25 +192,25 @@ bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult, bool isCustomized = false; if (aColor.size() == 3) isCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]); - //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol + // thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol return isCustomized; } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByXYZ() -{ - AttributePointPtr aPoint = - std::dynamic_pointer_cast(data()->attribute(POINT3D())); - return GeomAlgoAPI_PointBuilder::vertex(aPoint->x(), aPoint->y(), aPoint->z()); +std::shared_ptr ConstructionPlugin_Point::createByXYZ() { + AttributePointPtr aPoint = std::dynamic_pointer_cast( + data()->attribute(POINT3D())); + return GeomAlgoAPI_PointBuilder::vertex(aPoint->x(), aPoint->y(), + aPoint->z()); } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByDistanceOnEdge() -{ +std::shared_ptr +ConstructionPlugin_Point::createByDistanceOnEdge() { // Get edge. AttributeSelectionPtr anEdgeSelection = selection(EDGE()); GeomShapePtr aShape = anEdgeSelection->value(); - if(!aShape.get()) { + if (!aShape.get()) { aShape = anEdgeSelection->context()->shape(); } std::shared_ptr anEdge(new GeomAPI_Edge(aShape)); @@ -210,12 +229,13 @@ std::shared_ptr ConstructionPlugin_Point::createByDistanceOnEdge // Get reverse flag. bool anIsReverse = boolean(REVERSE())->value(); - return GeomAlgoAPI_PointBuilder::vertexOnEdge(anEdge, aValue, anIsPercent, anIsReverse); + return GeomAlgoAPI_PointBuilder::vertexOnEdge(anEdge, aValue, anIsPercent, + anIsReverse); } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByProjectionOnEdge() -{ +std::shared_ptr +ConstructionPlugin_Point::createByProjectionOnEdge() { // Get point. AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT()); GeomShapePtr aPointShape = aPointSelection->value(); @@ -225,7 +245,8 @@ std::shared_ptr ConstructionPlugin_Point::createByProjectionOnEd std::shared_ptr aVertex(new GeomAPI_Vertex(aPointShape)); // Get edge. - AttributeSelectionPtr anEdgeSelection = selection(EDGE_FOR_POINT_PROJECTION()); + AttributeSelectionPtr anEdgeSelection = + selection(EDGE_FOR_POINT_PROJECTION()); GeomShapePtr anEdgeShape = anEdgeSelection->value(); if (!anEdgeShape.get()) { anEdgeShape = anEdgeSelection->context()->shape(); @@ -236,20 +257,21 @@ std::shared_ptr ConstructionPlugin_Point::createByProjectionOnEd } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByProjectionOnFace() -{ +std::shared_ptr +ConstructionPlugin_Point::createByProjectionOnFace() { // Get point. AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT()); GeomShapePtr aPointShape = aPointSelection->value(); - if(!aPointShape.get()) { + if (!aPointShape.get()) { aPointShape = aPointSelection->context()->shape(); } std::shared_ptr aVertex(new GeomAPI_Vertex(aPointShape)); // Get plane. - AttributeSelectionPtr aPlaneSelection = selection(FACE_FOR_POINT_PROJECTION()); + AttributeSelectionPtr aPlaneSelection = + selection(FACE_FOR_POINT_PROJECTION()); GeomShapePtr aPlaneShape = aPlaneSelection->value(); - if(!aPlaneShape.get()) { + if (!aPlaneShape.get()) { aPlaneShape = aPlaneSelection->context()->shape(); } std::shared_ptr aFace(new GeomAPI_Face(aPlaneShape)); @@ -258,57 +280,55 @@ std::shared_ptr ConstructionPlugin_Point::createByProjectionOnFa } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByLinesIntersection() -{ +std::shared_ptr +ConstructionPlugin_Point::createByLinesIntersection() { // Get first line. - AttributeSelectionPtr aFirstLineSelection= selection(INTERSECTION_LINE_1()); + AttributeSelectionPtr aFirstLineSelection = selection(INTERSECTION_LINE_1()); GeomShapePtr aFirstLineShape = aFirstLineSelection->value(); - if(!aFirstLineShape.get()) { + if (!aFirstLineShape.get()) { aFirstLineShape = aFirstLineSelection->context()->shape(); } std::shared_ptr aFirstEdge(new GeomAPI_Edge(aFirstLineShape)); // Get second line. - AttributeSelectionPtr aSecondLineSelection= selection(INTERSECTION_LINE_2()); + AttributeSelectionPtr aSecondLineSelection = selection(INTERSECTION_LINE_2()); GeomShapePtr aSecondLineShape = aSecondLineSelection->value(); - if(!aSecondLineShape.get()) { + if (!aSecondLineShape.get()) { aSecondLineShape = aSecondLineSelection->context()->shape(); } std::shared_ptr aSecondEdge(new GeomAPI_Edge(aSecondLineShape)); - return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, aSecondEdge); + return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, + aSecondEdge); } //================================================================================================== -std::list > - ConstructionPlugin_Point::createByLineAndPlaneIntersection() -{ +std::list> +ConstructionPlugin_Point::createByLineAndPlaneIntersection() { // Get line. AttributeSelectionPtr aLineSelection = selection(INTERSECTION_LINE()); GeomShapePtr aLineShape = aLineSelection->value(); - if(!aLineShape.get()) { + if (!aLineShape.get()) { aLineShape = aLineSelection->context()->shape(); } GeomEdgePtr anEdge; if (aLineShape->isEdge()) { anEdge = aLineShape->edge(); - } - else if (aLineShape->isCompound()) { + } else if (aLineShape->isCompound()) { GeomAPI_ShapeIterator anIt(aLineShape); anEdge = anIt.current()->edge(); } // Get plane. - AttributeSelectionPtr aPlaneSelection= selection(INTERSECTION_PLANE()); + AttributeSelectionPtr aPlaneSelection = selection(INTERSECTION_PLANE()); GeomShapePtr aPlaneShape = aPlaneSelection->value(); - if(!aPlaneShape.get()) { + if (!aPlaneShape.get()) { aPlaneShape = aPlaneSelection->context()->shape(); } GeomFacePtr aFace; if (aPlaneShape->isFace()) { aFace = aPlaneShape->face(); - } - else if (aPlaneShape->isCompound()) { + } else if (aPlaneShape->isCompound()) { GeomAPI_ShapeIterator anIt(aPlaneShape); aFace = anIt.current()->face(); } @@ -326,8 +346,8 @@ std::list > } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByPlanesIntersection() -{ +std::shared_ptr +ConstructionPlugin_Point::createByPlanesIntersection() { // Get plane. AttributeSelectionPtr aPlaneSelection1 = selection(INTERSECTION_PLANE_1()); GeomShapePtr aPlaneShape1 = aPlaneSelection1->value(); @@ -371,20 +391,20 @@ std::shared_ptr ConstructionPlugin_Point::createByPlanesIntersec } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByCenterOfGravity() -{ +std::shared_ptr +ConstructionPlugin_Point::createByCenterOfGravity() { // Get shape. - AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_GRAVITY()); + AttributeSelectionPtr aShapeSelection = + selection(OBJECT_FOR_CENTER_OF_GRAVITY()); GeomShapePtr aShape = aShapeSelection->value(); - if (!aShape.get()) - { + if (!aShape.get()) { aShape = aShapeSelection->context()->shape(); } std::shared_ptr aVertex; - std::shared_ptr aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShape); - if (aPnt.get()) - { + std::shared_ptr aPnt = + GeomAlgoAPI_ShapeTools::centreOfMass(aShape); + if (aPnt.get()) { aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z())); } @@ -392,10 +412,11 @@ std::shared_ptr ConstructionPlugin_Point::createByCenterOfGravit } //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByCenterOfCircle() -{ +std::shared_ptr +ConstructionPlugin_Point::createByCenterOfCircle() { // Get shape. - AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_CIRCLE()); + AttributeSelectionPtr aShapeSelection = + selection(OBJECT_FOR_CENTER_OF_CIRCLE()); GeomShapePtr aShape = aShapeSelection->value(); if (!aShape.get()) { aShape = aShapeSelection->context()->shape(); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index f845a54ae..db9c1b976 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ConstructionPlugin_Point_H_ @@ -33,302 +34,266 @@ class GeomAPI_Vertex; /// \class ConstructionPlugin_Point /// \ingroup Plugins /// \brief Feature for creation of the new part in PartSet. -class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs -{ +class ConstructionPlugin_Point : public ModelAPI_Feature, + public GeomAPI_ICustomPrs { public: /// Returns the kind of a feature. - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind(); + CONSTRUCTIONPLUGIN_EXPORT virtual const std::string &getKind(); /// Default color for a point. - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string POINT_COLOR("85,85,0"); return POINT_COLOR; } /// Default color property name. - inline static const std::string& COLOR_NAME() - { + inline static const std::string &COLOR_NAME() { static const std::string POINT_COLOR_NAME("construction_point_color"); return POINT_COLOR_NAME; } - /// Point kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string CONSTRUCTION_POINT_KIND("Point"); return CONSTRUCTION_POINT_KIND; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("creation_method"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_XYZ() - { + inline static const std::string &CREATION_METHOD_BY_XYZ() { static const std::string MY_CREATION_METHOD_ID("by_xyz"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE() - { + inline static const std::string &CREATION_METHOD_BY_DISTANCE_ON_EDGE() { static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_PROJECTION() - { + inline static const std::string &CREATION_METHOD_BY_PROJECTION() { static const std::string MY_CREATION_METHOD_ID("by_projection"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_INTERSECTION() - { + inline static const std::string &CREATION_METHOD_BY_INTERSECTION() { static const std::string MY_CREATION_METHOD_ID("by_intersection"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_GEOMETRICAL_PROPERTY() - { + inline static const std::string &CREATION_METHOD_BY_GEOMETRICAL_PROPERTY() { static const std::string MY_CREATION_METHOD_ID("by_geometrical_property"); return MY_CREATION_METHOD_ID; } - inline static const std::string& POINT3D() - { + inline static const std::string &POINT3D() { static const std::string POINT_ATTR("point3d"); return POINT_ATTR; } /// Attribute name for selected edge. - inline static const std::string& EDGE() - { + inline static const std::string &EDGE() { static const std::string ATTR_ID("edge"); return ATTR_ID; } /// Attribute name for offset type on selected edge. - inline static const std::string& OFFSET_TYPE() - { + inline static const std::string &OFFSET_TYPE() { static const std::string ATTR_ID("offset_type"); return ATTR_ID; } /// Attribute name for offset type by distance. - inline static const std::string& OFFSET_TYPE_BY_DISTANCE() - { + inline static const std::string &OFFSET_TYPE_BY_DISTANCE() { static const std::string ATTR_ID("offset_type_by_distance"); return ATTR_ID; } /// Attribute name for offset type by ratio. - inline static const std::string& OFFSET_TYPE_BY_RATIO() - { + inline static const std::string &OFFSET_TYPE_BY_RATIO() { static const std::string ATTR_ID("offset_type_by_ratio"); return ATTR_ID; } /// Attribute name for distance. - inline static const std::string& DISTANCE() - { + inline static const std::string &DISTANCE() { static const std::string ATTR_ID("distance"); return ATTR_ID; } /// Attribute name for percent flag. - inline static const std::string& RATIO() - { + inline static const std::string &RATIO() { static const std::string ATTR_ID("ratio"); return ATTR_ID; } /// Attribute name for reverse flag. - inline static const std::string& REVERSE() - { + inline static const std::string &REVERSE() { static const std::string ATTR_ID("reverse"); return ATTR_ID; } /// Attribute name for point to projection. - inline static const std::string& POINT_TO_PROJECT() - { + inline static const std::string &POINT_TO_PROJECT() { static const std::string ATTR_ID("point_to_project"); return ATTR_ID; } /// Attribute name for projection type. - inline static const std::string& PROJECTION_TYPE() - { + inline static const std::string &PROJECTION_TYPE() { static const std::string ATTR_ID("projection_type"); return ATTR_ID; } /// Attribute name for projection type on edge. - inline static const std::string& PROJECTION_TYPE_ON_EDGE() - { + inline static const std::string &PROJECTION_TYPE_ON_EDGE() { static const std::string ATTR_ID("projection_type_on_edge"); return ATTR_ID; } /// Attribute name for projection type on face. - inline static const std::string& PROJECTION_TYPE_ON_FACE() - { + inline static const std::string &PROJECTION_TYPE_ON_FACE() { static const std::string ATTR_ID("projection_type_on_face"); return ATTR_ID; } /// Attribute name for edge for point projection. - inline static const std::string& EDGE_FOR_POINT_PROJECTION() - { + inline static const std::string &EDGE_FOR_POINT_PROJECTION() { static const std::string ATTR_ID("edge_for_point_projection"); return ATTR_ID; } /// Attribute name for face for point projection. - inline static const std::string& FACE_FOR_POINT_PROJECTION() - { + inline static const std::string &FACE_FOR_POINT_PROJECTION() { static const std::string ATTR_ID("face_for_point_projection"); return ATTR_ID; } /// Attribute name for intersection type. - inline static const std::string& INTERSECTION_TYPE() - { + inline static const std::string &INTERSECTION_TYPE() { static const std::string ATTR_ID("intersection_type"); return ATTR_ID; } /// Attribute name for intersection type by lines. - inline static const std::string& INTERSECTION_TYPE_BY_LINES() - { - static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines"); + inline static const std::string &INTERSECTION_TYPE_BY_LINES() { + static const std::string MY_CREATION_METHOD_ID( + "intersection_type_by_lines"); return MY_CREATION_METHOD_ID; } /// Attribute name for intersection type by line and plane. - inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE() - { - static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane"); + inline static const std::string &INTERSECTION_TYPE_BY_LINE_AND_PLANE() { + static const std::string MY_CREATION_METHOD_ID( + "intersection_type_by_line_and_plane"); return MY_CREATION_METHOD_ID; } /// Attribute name for intersection type by planes. - inline static const std::string& INTERSECTION_TYPE_BY_PLANES() - { - static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes"); + inline static const std::string &INTERSECTION_TYPE_BY_PLANES() { + static const std::string MY_CREATION_METHOD_ID( + "intersection_type_by_planes"); return MY_CREATION_METHOD_ID; } /// Attribute name for selected first intersection line. - inline static const std::string& INTERSECTION_LINE_1() - { + inline static const std::string &INTERSECTION_LINE_1() { static const std::string ATTR_ID("intersection_line_1"); return ATTR_ID; } /// Attribute name for selected second intersection line. - inline static const std::string& INTERSECTION_LINE_2() - { + inline static const std::string &INTERSECTION_LINE_2() { static const std::string ATTR_ID("intersection_line_2"); return ATTR_ID; } /// Attribute name for selected intersection line. - inline static const std::string& INTERSECTION_LINE() - { + inline static const std::string &INTERSECTION_LINE() { static const std::string ATTR_ID("intersection_line"); return ATTR_ID; } /// Attribute name for selected intersection plane. - inline static const std::string& INTERSECTION_PLANE() - { + inline static const std::string &INTERSECTION_PLANE() { static const std::string ATTR_ID("intersection_plane"); return ATTR_ID; } /// Attribute name for use offset for the intersection plane. - inline static const std::string& USE_OFFSET() - { + inline static const std::string &USE_OFFSET() { static const std::string ATTR_ID("use_offset"); return ATTR_ID; } /// Attribute name for offset for the intersection plane. - inline static const std::string& OFFSET() - { + inline static const std::string &OFFSET() { static const std::string ATTR_ID("offset"); return ATTR_ID; } /// Attribute name for reverse offset for the intersection plane. - inline static const std::string& REVERSE_OFFSET() - { + inline static const std::string &REVERSE_OFFSET() { static const std::string ATTR_ID("reverse_offset"); return ATTR_ID; } /// Attribute name for selected intersection plane. - inline static const std::string& INTERSECTION_PLANE_1() - { + inline static const std::string &INTERSECTION_PLANE_1() { static const std::string ATTR_ID("intersection_plane_1"); return ATTR_ID; } /// Attribute name for selected intersection plane. - inline static const std::string& INTERSECTION_PLANE_2() - { + inline static const std::string &INTERSECTION_PLANE_2() { static const std::string ATTR_ID("intersection_plane_2"); return ATTR_ID; } /// Attribute name for selected intersection plane. - inline static const std::string& INTERSECTION_PLANE_3() - { + inline static const std::string &INTERSECTION_PLANE_3() { static const std::string ATTR_ID("intersection_plane_3"); return ATTR_ID; } /// Attribute name for property type. - inline static const std::string& GEOMETRICAL_PROPERTY_TYPE() - { + inline static const std::string &GEOMETRICAL_PROPERTY_TYPE() { static const std::string ATTR_ID("geometrical_property_type"); return ATTR_ID; } /// Attribute name for property type by center of gravity. - inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY() - { - static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_gravity"); + inline static const std::string & + GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY() { + static const std::string PROPERTY_TYPE( + "geometrical_property_type_by_center_of_gravity"); return PROPERTY_TYPE; } /// Attribute name for property type by center of circle. - inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE() - { - static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_circle"); + inline static const std::string & + GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE() { + static const std::string PROPERTY_TYPE( + "geometrical_property_type_by_center_of_circle"); return PROPERTY_TYPE; } /// Attribute name for selected object for center of gravity. - inline static const std::string& OBJECT_FOR_CENTER_OF_GRAVITY() - { + inline static const std::string &OBJECT_FOR_CENTER_OF_GRAVITY() { static const std::string ATTR_ID("object_for_center_of_gravity"); return ATTR_ID; } /// Attribute name for selected object for center of cricle. - inline static const std::string& OBJECT_FOR_CENTER_OF_CIRCLE() - { + inline static const std::string &OBJECT_FOR_CENTER_OF_CIRCLE() { static const std::string ATTR_ID("object_for_center_of_circle"); return ATTR_ID; } @@ -336,7 +301,8 @@ public: /// Creates a new part document if needed. CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation @@ -351,7 +317,7 @@ private: std::shared_ptr createByProjectionOnEdge(); std::shared_ptr createByProjectionOnFace(); std::shared_ptr createByLinesIntersection(); - std::list > createByLineAndPlaneIntersection(); + std::list> createByLineAndPlaneIntersection(); std::shared_ptr createByPlanesIntersection(); std::shared_ptr createByCenterOfGravity(); std::shared_ptr createByCenterOfCircle(); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp b/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp index fbe2fb92e..877bac80f 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ConstructionPlugin_Validators.h" @@ -24,13 +25,13 @@ #include #include #include -#include #include #include +#include #include -#include #include +#include #include @@ -41,39 +42,40 @@ static std::shared_ptr getPln(const GeomShapePtr theShape); static std::shared_ptr getPnt(const GeomShapePtr theShape); //================================================================================================== -bool ConstructionPlugin_ValidatorPointLines::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool ConstructionPlugin_ValidatorPointLines::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr aLineAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr aLineAttribute2 = aFeature->selection(theArguments.front()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr aLineAttribute2 = + aFeature->selection(theArguments.front()); GeomShapePtr aLineShape1 = aLineAttribute1->value(); ResultPtr aContext1 = aLineAttribute1->context(); - if(!aContext1.get()) { + if (!aContext1.get()) { theError = "One of the attribute is not initialized."; return false; } - if(!aLineShape1.get()) { + if (!aLineShape1.get()) { aLineShape1 = aContext1->shape(); } - if(!aLineShape1->isEdge()) { + if (!aLineShape1->isEdge()) { theError = "One of the selected shapes not an edge."; return false; } GeomShapePtr aLineShape2 = aLineAttribute2->value(); ResultPtr aContext2 = aLineAttribute2->context(); - if(!aContext2.get()) { + if (!aContext2.get()) { return true; } - if(!aLineShape2.get()) { + if (!aLineShape2.get()) { aLineShape2 = aContext2->shape(); } - if(!aLineShape2->isEdge()) { + if (!aLineShape2->isEdge()) { theError = "One of the selected shapes not an edge."; return false; } @@ -89,12 +91,12 @@ bool ConstructionPlugin_ValidatorPointLines::isValid(const AttributePtr& theAttr return false; } - if(!aLine1->isCoplanar(aLine2)) { + if (!aLine1->isCoplanar(aLine2)) { theError = "Selected lines not coplanar."; return false; } - if(aLine1->isParallel(aLine2)) { + if (aLine1->isParallel(aLine2)) { theError = "Selected lines are parallel."; return false; } @@ -104,51 +106,51 @@ bool ConstructionPlugin_ValidatorPointLines::isValid(const AttributePtr& theAttr //================================================================================================== bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr anAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr anAttribute2 = + aFeature->selection(theArguments.front()); std::shared_ptr anEdge; std::shared_ptr aFace; GeomShapePtr aShape1 = anAttribute1->value(); ResultPtr aContext1 = anAttribute1->context(); - if(!aContext1.get()) { + if (!aContext1.get()) { theError = "One of the attribute is not initialized."; return false; } - if(!aShape1.get()) { + if (!aShape1.get()) { aShape1 = aContext1->shape(); } GeomShapePtr aShape2 = anAttribute2->value(); ResultPtr aContext2 = anAttribute2->context(); - if(!aContext2.get()) { + if (!aContext2.get()) { return true; } - if(!aShape2.get()) { + if (!aShape2.get()) { aShape2 = aContext2->shape(); } anEdge = getEdge(aShape1); aFace = getFace(aShape2); - if(!anEdge.get() || !aFace.get()) { + if (!anEdge.get() || !aFace.get()) { anEdge = getEdge(aShape2); aFace = getFace(aShape1); } - if(!anEdge.get() || !aFace.get()) { + if (!anEdge.get() || !aFace.get()) { theError = "Wrong shape types selected."; return false; } - if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aFace)) { + if (GeomAlgoAPI_ShapeTools::isParallel(anEdge, aFace)) { theError = "Plane and edge are parallel."; return false; } @@ -157,53 +159,55 @@ bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid( } //================================================================================================== -bool ConstructionPlugin_ValidatorPlaneThreePoints::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool ConstructionPlugin_ValidatorPlaneThreePoints::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr aPointAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr aPointAttribute2 = aFeature->selection(theArguments.front()); - AttributeSelectionPtr aPointAttribute3 = aFeature->selection(theArguments.back()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr aPointAttribute2 = + aFeature->selection(theArguments.front()); + AttributeSelectionPtr aPointAttribute3 = + aFeature->selection(theArguments.back()); GeomShapePtr aPointShape1 = aPointAttribute1->value(); ResultPtr aContext1 = aPointAttribute1->context(); - if(!aContext1.get()) { + if (!aContext1.get()) { theError = "One of the attribute is not initialized."; return false; } - if(!aPointShape1.get()) { + if (!aPointShape1.get()) { aPointShape1 = aContext1->shape(); } - if(!aPointShape1->isVertex()) { + if (!aPointShape1->isVertex()) { theError = "One of the selected shapes not a vertex."; return false; } GeomShapePtr aPointShape2 = aPointAttribute2->value(); ResultPtr aContext2 = aPointAttribute2->context(); - if(!aContext2.get()) { + if (!aContext2.get()) { return true; } - if(!aPointShape2.get()) { + if (!aPointShape2.get()) { aPointShape2 = aContext2->shape(); } - if(!aPointShape2->isVertex()) { + if (!aPointShape2->isVertex()) { theError = "One of the selected shapes not a vertex."; return false; } GeomShapePtr aPointShape3 = aPointAttribute3->value(); ResultPtr aContext3 = aPointAttribute3->context(); - if(!aContext3.get()) { + if (!aContext3.get()) { return true; } - if(!aPointShape3.get()) { + if (!aPointShape3.get()) { aPointShape3 = aContext3->shape(); } - if(!aPointShape3->isVertex()) { + if (!aPointShape3->isVertex()) { theError = "One of the selected shapes not a vertex."; return false; } @@ -223,7 +227,7 @@ bool ConstructionPlugin_ValidatorPlaneThreePoints::isValid(const AttributePtr& t std::shared_ptr aLin(new GeomAPI_Lin(aPnt1, aPnt2)); - if(aLin->contains(aPnt3)) { + if (aLin->contains(aPnt3)) { theError = "Selected points lie on a line."; return false; } @@ -233,46 +237,46 @@ bool ConstructionPlugin_ValidatorPlaneThreePoints::isValid(const AttributePtr& t //================================================================================================== bool ConstructionPlugin_ValidatorPlaneLinePoint::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr anAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr anAttribute2 = + aFeature->selection(theArguments.front()); std::shared_ptr aLin; std::shared_ptr aPnt; GeomShapePtr aShape1 = anAttribute1->value(); ResultPtr aContext1 = anAttribute1->context(); - if(!aContext1.get()) { + if (!aContext1.get()) { theError = "One of the attribute is not initialized."; return false; } - if(!aShape1.get()) { + if (!aShape1.get()) { aShape1 = aContext1->shape(); } GeomShapePtr aShape2 = anAttribute2->value(); ResultPtr aContext2 = anAttribute2->context(); - if(!aContext2.get()) { + if (!aContext2.get()) { return true; } - if(!aShape2.get()) { + if (!aShape2.get()) { aShape2 = aContext2->shape(); } aLin = getLin(aShape1); aPnt = getPnt(aShape2); - if(!aLin.get() || !aPnt.get()) { + if (!aLin.get() || !aPnt.get()) { aLin = getLin(aShape2); aPnt = getPnt(aShape1); } - if(!aLin.get() || !aPnt.get()) { + if (!aLin.get() || !aPnt.get()) { theError = "Wrong shape types selected."; return false; } @@ -280,7 +284,7 @@ bool ConstructionPlugin_ValidatorPlaneLinePoint::isValid( // line should not contain point only for not-prependicular case AttributeBooleanPtr aBoolAttr = aFeature->boolean(theArguments.back()); if (aBoolAttr.get() && !aBoolAttr->value()) { - if(aLin->contains(aPnt)) { + if (aLin->contains(aPnt)) { theError = "Point lies on the line."; return false; } @@ -291,42 +295,42 @@ bool ConstructionPlugin_ValidatorPlaneLinePoint::isValid( //================================================================================================== bool ConstructionPlugin_ValidatorPlaneTwoParallelPlanes::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr anAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr anAttribute2 = + aFeature->selection(theArguments.front()); std::shared_ptr aPln1; std::shared_ptr aPln2; GeomShapePtr aShape1 = anAttribute1->value(); ResultPtr aContext1 = anAttribute1->context(); - if(!aContext1.get()) { + if (!aContext1.get()) { theError = "One of the attribute is not initialized."; return false; } - if(!aShape1.get()) { + if (!aShape1.get()) { aShape1 = aContext1->shape(); } GeomShapePtr aShape2 = anAttribute2->value(); ResultPtr aContext2 = anAttribute2->context(); - if(!aContext2.get()) { + if (!aContext2.get()) { return true; } - if(!aShape2.get()) { + if (!aShape2.get()) { aShape2 = aContext2->shape(); } aPln1 = getPln(aShape1); aPln2 = getPln(aShape2); - if(!aPln1.get() || !aPln2.get()) { + if (!aPln1.get() || !aPln2.get()) { theError = "Wrong shape types selected."; return false; } @@ -334,7 +338,7 @@ bool ConstructionPlugin_ValidatorPlaneTwoParallelPlanes::isValid( std::shared_ptr aDir1 = aPln1->direction(); std::shared_ptr aDir2 = aPln2->direction(); - if(!aDir1->isParallel(aDir2)) { + if (!aDir1->isParallel(aDir2)) { theError = "Planes not parallel."; return false; } @@ -344,42 +348,42 @@ bool ConstructionPlugin_ValidatorPlaneTwoParallelPlanes::isValid( //================================================================================================== bool ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr anAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr anAttribute2 = + aFeature->selection(theArguments.front()); std::shared_ptr aPln1; std::shared_ptr aPln2; GeomShapePtr aShape1 = anAttribute1->value(); ResultPtr aContext1 = anAttribute1->context(); - if(!aContext1.get()) { + if (!aContext1.get()) { theError = "One of the attribute is not initialized."; return false; } - if(!aShape1.get()) { + if (!aShape1.get()) { aShape1 = aContext1->shape(); } GeomShapePtr aShape2 = anAttribute2->value(); ResultPtr aContext2 = anAttribute2->context(); - if(!aContext2.get()) { + if (!aContext2.get()) { return true; } - if(!aShape2.get()) { + if (!aShape2.get()) { aShape2 = aContext2->shape(); } aPln1 = getPln(aShape1); aPln2 = getPln(aShape2); - if(!aPln1.get() || !aPln2.get()) { + if (!aPln1.get() || !aPln2.get()) { theError = "Wrong shape types selected."; return false; } @@ -387,7 +391,7 @@ bool ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes::isValid( std::shared_ptr aDir1 = aPln1->direction(); std::shared_ptr aDir2 = aPln2->direction(); - if(aDir1->isParallel(aDir2)) { + if (aDir1->isParallel(aDir2)) { theError = "Planes are parallel."; return false; } @@ -397,15 +401,15 @@ bool ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes::isValid( //================================================================================================== bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeSelectionPtr anAttribute1 = - std::dynamic_pointer_cast(theAttribute); - AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front()); + std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr anAttribute2 = + aFeature->selection(theArguments.front()); AttributeSelectionPtr anAttribute3 = aFeature->selection(theArguments.back()); GeomShapePtr aShape1 = anAttribute1->value(); @@ -472,10 +476,9 @@ bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid( //================================================================================================== bool ConstructionPlugin_ValidatorNotFeature::isValid( - const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast(theAttribute); if (!aSelAttr) { @@ -493,14 +496,12 @@ bool ConstructionPlugin_ValidatorNotFeature::isValid( //================================================================================================== -std::shared_ptr getEdge(const GeomShapePtr theShape) -{ +std::shared_ptr getEdge(const GeomShapePtr theShape) { GeomEdgePtr anEdge; - if(theShape->isEdge()) { + if (theShape->isEdge()) { anEdge = theShape->edge(); - } - else if (theShape->isCompound()) { + } else if (theShape->isCompound()) { GeomAPI_ShapeIterator anIt(theShape); anEdge = anIt.current()->edge(); } @@ -508,14 +509,12 @@ std::shared_ptr getEdge(const GeomShapePtr theShape) return anEdge; } -GeomFacePtr getFace(const GeomShapePtr theShape) -{ +GeomFacePtr getFace(const GeomShapePtr theShape) { GeomFacePtr aFace; if (theShape->isFace()) { aFace = theShape->face(); - } - else if (theShape->isCompound()) { + } else if (theShape->isCompound()) { GeomAPI_ShapeIterator anIt(theShape); aFace = anIt.current()->face(); } @@ -523,24 +522,21 @@ GeomFacePtr getFace(const GeomShapePtr theShape) return aFace; } -std::shared_ptr getLin(const GeomShapePtr theShape) -{ +std::shared_ptr getLin(const GeomShapePtr theShape) { std::shared_ptr aLin; GeomEdgePtr anEdge; if (theShape->isEdge()) { anEdge = theShape->edge(); - } - else if (theShape->isCompound()) { + } else if (theShape->isCompound()) { GeomAPI_ShapeIterator anIt(theShape); anEdge = anIt.current()->edge(); - } - else { + } else { return aLin; } - if(!anEdge->isLine()) { + if (!anEdge->isLine()) { return aLin; } @@ -549,24 +545,21 @@ std::shared_ptr getLin(const GeomShapePtr theShape) return aLin; } -std::shared_ptr getPln(const GeomShapePtr theShape) -{ +std::shared_ptr getPln(const GeomShapePtr theShape) { std::shared_ptr aPln; GeomFacePtr aFace; - if(theShape->isFace()) { + if (theShape->isFace()) { aFace = theShape->face(); - } - else if (theShape->isCompound()) { + } else if (theShape->isCompound()) { GeomAPI_ShapeIterator anIt(theShape); aFace = anIt.current()->face(); - } - else { + } else { return aPln; } - if(!aFace || !aFace->isPlanar()) { + if (!aFace || !aFace->isPlanar()) { return aPln; } @@ -575,11 +568,10 @@ std::shared_ptr getPln(const GeomShapePtr theShape) return aPln; } -std::shared_ptr getPnt(const GeomShapePtr theShape) -{ +std::shared_ptr getPnt(const GeomShapePtr theShape) { std::shared_ptr aPnt; - if(!theShape->isVertex()) { + if (!theShape->isVertex()) { return aPnt; } diff --git a/src/ConstructionPlugin/ConstructionPlugin_Validators.h b/src/ConstructionPlugin/ConstructionPlugin_Validators.h index f5ba41281..c2396c1a9 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Validators.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ConstructionPlugin_Validators_H_ @@ -25,121 +26,121 @@ /// \class ConstructionPlugin_ValidatorPointLines /// \ingroup Validators /// \brief A validator for selection lines for point by intersection. -class ConstructionPlugin_ValidatorPointLines: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorPointLines + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel /// \ingroup Validators /// \brief A validator for selection edge and plane for point by intersection. -class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorPlaneThreePoints /// \ingroup Validators /// \brief A validator for selection three points for plane. -class ConstructionPlugin_ValidatorPlaneThreePoints: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorPlaneThreePoints + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorPlaneLinePoint /// \ingroup Validators /// \brief A validator for selection line and point for plane. -class ConstructionPlugin_ValidatorPlaneLinePoint: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorPlaneLinePoint + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorPlaneTwoParallelPlanes /// \ingroup Validators /// \brief A validator for selection two parallel planes. -class ConstructionPlugin_ValidatorPlaneTwoParallelPlanes: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorPlaneTwoParallelPlanes + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes /// \ingroup Validators /// \brief A validator for selection two parallel planes. -class ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes /// \ingroup Validators /// \brief A validator for selection three non parallel planes. -class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes: public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class ConstructionPlugin_ValidatorNotFeature /// \ingroup Validators /// \brief A validator for selection of a result but not a feature. -class ConstructionPlugin_ValidatorNotFeature : public ModelAPI_AttributeValidator -{ +class ConstructionPlugin_ValidatorNotFeature + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/ConstructionPlugin/doc/TUI_axis1Feature.rst b/src/ConstructionPlugin/doc/TUI_axis1Feature.rst index 18235b37f..1463b7c1c 100644 --- a/src/ConstructionPlugin/doc/TUI_axis1Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_axis1Feature.rst @@ -8,5 +8,4 @@ Create Axis by dimensions :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_axis2Feature.rst b/src/ConstructionPlugin/doc/TUI_axis2Feature.rst index ecb2d2717..2b4580e54 100644 --- a/src/ConstructionPlugin/doc/TUI_axis2Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_axis2Feature.rst @@ -8,5 +8,4 @@ Create Axis by points :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_axis3Feature.rst b/src/ConstructionPlugin/doc/TUI_axis3Feature.rst index 1b6cb10d6..6ff081f9e 100644 --- a/src/ConstructionPlugin/doc/TUI_axis3Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_axis3Feature.rst @@ -8,5 +8,4 @@ Create Axis by line :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_axis4Feature.rst b/src/ConstructionPlugin/doc/TUI_axis4Feature.rst index 7f5fa8c7e..8616ab191 100644 --- a/src/ConstructionPlugin/doc/TUI_axis4Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_axis4Feature.rst @@ -8,5 +8,4 @@ Create Axis by cylinder :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_axis5Feature.rst b/src/ConstructionPlugin/doc/TUI_axis5Feature.rst index 669508f16..8962c9f66 100644 --- a/src/ConstructionPlugin/doc/TUI_axis5Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_axis5Feature.rst @@ -8,5 +8,4 @@ Create Axis by plane and point :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_axis6Feature.rst b/src/ConstructionPlugin/doc/TUI_axis6Feature.rst index fe41dedfa..a87ed909b 100644 --- a/src/ConstructionPlugin/doc/TUI_axis6Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_axis6Feature.rst @@ -8,5 +8,4 @@ Create Axis by two planes :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_plane1Feature.rst b/src/ConstructionPlugin/doc/TUI_plane1Feature.rst index 7c9e358b7..8a3448146 100644 --- a/src/ConstructionPlugin/doc/TUI_plane1Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_plane1Feature.rst @@ -8,5 +8,4 @@ Create Plane by points :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_plane2Feature.rst b/src/ConstructionPlugin/doc/TUI_plane2Feature.rst index aca97ad70..4e3b74356 100644 --- a/src/ConstructionPlugin/doc/TUI_plane2Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_plane2Feature.rst @@ -8,5 +8,4 @@ Create Plane by line and point :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_plane3Feature.rst b/src/ConstructionPlugin/doc/TUI_plane3Feature.rst index a8b0a56d2..babfe19fe 100644 --- a/src/ConstructionPlugin/doc/TUI_plane3Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_plane3Feature.rst @@ -8,5 +8,4 @@ Create Plane by other plane :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_plane4Feature.rst b/src/ConstructionPlugin/doc/TUI_plane4Feature.rst index eed5e7dff..9980ea1db 100644 --- a/src/ConstructionPlugin/doc/TUI_plane4Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_plane4Feature.rst @@ -8,5 +8,4 @@ Create Plane by two parallel planes :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_point1Feature.rst b/src/ConstructionPlugin/doc/TUI_point1Feature.rst index 9ab252625..edcbea23d 100644 --- a/src/ConstructionPlugin/doc/TUI_point1Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_point1Feature.rst @@ -8,5 +8,4 @@ Create Point by X,Y,Z :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_point2Feature.rst b/src/ConstructionPlugin/doc/TUI_point2Feature.rst index 7468c3380..576e389a8 100644 --- a/src/ConstructionPlugin/doc/TUI_point2Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_point2Feature.rst @@ -8,5 +8,4 @@ Create Point on an edge :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_point3Feature.rst b/src/ConstructionPlugin/doc/TUI_point3Feature.rst index 975cca552..6915e4509 100644 --- a/src/ConstructionPlugin/doc/TUI_point3Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_point3Feature.rst @@ -8,4 +8,4 @@ Create Point by projection :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_point4Feature.rst b/src/ConstructionPlugin/doc/TUI_point4Feature.rst index e4a408b11..fdc86f0cc 100644 --- a/src/ConstructionPlugin/doc/TUI_point4Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_point4Feature.rst @@ -8,4 +8,4 @@ Create Point by intersection :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/TUI_point5Feature.rst b/src/ConstructionPlugin/doc/TUI_point5Feature.rst index 82fa596a7..e1cc9cf9c 100644 --- a/src/ConstructionPlugin/doc/TUI_point5Feature.rst +++ b/src/ConstructionPlugin/doc/TUI_point5Feature.rst @@ -8,4 +8,4 @@ Create Point by object property :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` diff --git a/src/ConstructionPlugin/doc/planeFeature.rst b/src/ConstructionPlugin/doc/planeFeature.rst index a0b2d71fb..f781286f2 100644 --- a/src/ConstructionPlugin/doc/planeFeature.rst +++ b/src/ConstructionPlugin/doc/planeFeature.rst @@ -99,7 +99,7 @@ The Result of the operation will be a plane: .. figure:: images/CreatedPlane2.png :align: center - Plane created + Plane created **See Also** a sample TUI Script of :ref:`tui_create_plane_line` operation. @@ -158,7 +158,7 @@ The Result of the operation will be a plane (or planes at equal distance from ea By two parallel planes ---------------------- - + .. figure:: images/Plane4.png :align: center diff --git a/src/ConstructionPlugin/doc/pointFeature.rst b/src/ConstructionPlugin/doc/pointFeature.rst index 645e75018..73f416371 100644 --- a/src/ConstructionPlugin/doc/pointFeature.rst +++ b/src/ConstructionPlugin/doc/pointFeature.rst @@ -224,7 +224,7 @@ It is possible to use the following property of selected object: :align: center **By center of a circle** - + To create a point, select a desirable object. **TUI Commands**: diff --git a/src/Events/Events.h b/src/Events/Events.h index da3acc30c..9b9723871 100644 --- a/src/Events/Events.h +++ b/src/Events/Events.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EVENTS_H @@ -22,13 +23,13 @@ #if defined EVENTS_EXPORTS #if defined WIN32 -#define EVENTS_EXPORT __declspec( dllexport ) +#define EVENTS_EXPORT __declspec(dllexport) #else #define EVENTS_EXPORT #endif #else #if defined WIN32 -#define EVENTS_EXPORT __declspec( dllimport ) +#define EVENTS_EXPORT __declspec(dllimport) #else #define EVENTS_EXPORT #endif diff --git a/src/Events/Events_InfoMessage.cpp b/src/Events/Events_InfoMessage.cpp index 54088a90f..3078c826c 100644 --- a/src/Events/Events_InfoMessage.cpp +++ b/src/Events/Events_InfoMessage.cpp @@ -14,35 +14,32 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Events_InfoMessage.h" #include #include -void Events_InfoMessage::addParameter(double theParam) -{ +void Events_InfoMessage::addParameter(double theParam) { std::stringstream aStream; aStream << theParam; myParameters.push_back(aStream.str()); } -void Events_InfoMessage::addParameter(int theParam) -{ +void Events_InfoMessage::addParameter(int theParam) { std::stringstream aStream; aStream << theParam; myParameters.push_back(aStream.str()); } -void Events_InfoMessage::send() -{ +void Events_InfoMessage::send() { std::shared_ptr aMsg(new Events_InfoMessage(*this)); Events_Loop::loop()->send(aMsg); } -Events_InfoMessage& Events_InfoMessage::arg(const std::wstring& theParam) -{ +Events_InfoMessage &Events_InfoMessage::arg(const std::wstring &theParam) { addParameter(Locale::Convert::toString(theParam)); return *this; } diff --git a/src/Events/Events_InfoMessage.h b/src/Events/Events_InfoMessage.h index baead092d..2e2a2c636 100644 --- a/src/Events/Events_InfoMessage.h +++ b/src/Events/Events_InfoMessage.h @@ -14,73 +14,71 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Events_InfoMessage_H_ #define Events_InfoMessage_H_ #include -#include #include +#include -#include #include +#include /**\class Events_InfoMessage * \ingroup EventsLoop - * \brief An event message for sending a string message which has to be translated. + * \brief An event message for sending a string message which has to be + * translated. */ -class Events_InfoMessage: public Events_Message -{ +class Events_InfoMessage : public Events_Message { public: - /// Constructor /// \param theSender a pointer on sender object - explicit Events_InfoMessage(const void* theSender = 0): - Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {} + explicit Events_InfoMessage(const void *theSender = 0) + : Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {} /// Constructor /// \param theSender a pointer on sender object - Events_InfoMessage(const std::string& theContext, - const std::string& theMsg, const void* theSender = 0): - Events_Message(Events_Loop::eventByName("InfoMessage"), theSender), - myContext(theContext), myMessage(theMsg) {} + Events_InfoMessage(const std::string &theContext, const std::string &theMsg, + const void *theSender = 0) + : Events_Message(Events_Loop::eventByName("InfoMessage"), theSender), + myContext(theContext), myMessage(theMsg) {} /// default destructor virtual ~Events_InfoMessage() {} /// Identifier of this event (one for all errors) - static Events_ID errorID() { return Events_Loop::loop()->eventByName("InfoMessage"); } + static Events_ID errorID() { + return Events_Loop::loop()->eventByName("InfoMessage"); + } /// Set a context string /// \param theContext a context string - void setContext(const std::string& theContext) { myContext = theContext; } - + void setContext(const std::string &theContext) { myContext = theContext; } /// Returns context string std::string context() const { return myContext; } /// Set message string for translation /// \param theMsg the string of message - void setMessageString(const std::string& theMsg) { myMessage = theMsg; } + void setMessageString(const std::string &theMsg) { myMessage = theMsg; } /// Returns message std::string messageString() const { return myMessage; } - Events_InfoMessage& operator=(const std::string& theMsg) { + Events_InfoMessage &operator=(const std::string &theMsg) { setMessageString(theMsg); return *this; } - bool empty() const { - return myMessage.empty(); - } + bool empty() const { return myMessage.empty(); } /// Add parameter for message string of string type /// \param theParam the parameter - void addParameter(const std::string& theParam) - { + void addParameter(const std::string &theParam) { myParameters.push_back(theParam); } @@ -97,25 +95,33 @@ public: /// Add parameter for message string of wstring type /// \param theParam the parameter - EVENTS_EXPORT Events_InfoMessage& arg(const std::wstring& theParam); + EVENTS_EXPORT Events_InfoMessage &arg(const std::wstring &theParam); /// Add parameter for message string of string type /// \param theParam the parameter - Events_InfoMessage& arg(const std::string& theParam) { addParameter(theParam); return *this; } + Events_InfoMessage &arg(const std::string &theParam) { + addParameter(theParam); + return *this; + } /// Add parameter for message string of integer type /// \param theParam the parameter - Events_InfoMessage& arg(int theParam) { addParameter(theParam); return *this; } + Events_InfoMessage &arg(int theParam) { + addParameter(theParam); + return *this; + } /// Add parameter for message string of double type /// \param theParam the parameter - Events_InfoMessage& arg(double theParam) { addParameter(theParam); return *this; } + Events_InfoMessage &arg(double theParam) { + addParameter(theParam); + return *this; + } /// Send the message EVENTS_EXPORT void send(); private: - /// Context of the messgae std::string myContext; diff --git a/src/Events/Events_Listener.cpp b/src/Events/Events_Listener.cpp index 17ee7d501..cc2f88bf3 100644 --- a/src/Events/Events_Listener.cpp +++ b/src/Events/Events_Listener.cpp @@ -14,34 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include -void Events_Listener::groupWhileFlush(const std::shared_ptr& theMessage) { +void Events_Listener::groupWhileFlush( + const std::shared_ptr &theMessage) { std::shared_ptr aGroup = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aGroup) { - std::map >::iterator aMyGroup = myGroups.find( - aGroup->eventID().eventText()); - if (aMyGroup == myGroups.end()) { // create a new group of messages for accumulation + std::map>::iterator aMyGroup = + myGroups.find(aGroup->eventID().eventText()); + if (aMyGroup == + myGroups.end()) { // create a new group of messages for accumulation myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty(); aMyGroup = myGroups.find(aGroup->eventID().eventText()); } std::shared_ptr aStored = - std::dynamic_pointer_cast(aMyGroup->second); + std::dynamic_pointer_cast(aMyGroup->second); aStored->Join(aGroup); - //std::cout<<"Add to group "<eventID().eventText()<eventID().eventText()< >::iterator aMyGroup = - myGroups.find(theID.eventText()); +void Events_Listener::flushGrouped(const Events_ID &theID) { + std::map>::iterator aMyGroup = + myGroups.find(theID.eventText()); if (aMyGroup != myGroups.end()) { std::shared_ptr aMessage = aMyGroup->second; myGroups.erase(aMyGroup); diff --git a/src/Events/Events_Listener.h b/src/Events/Events_Listener.h index 9e66c389b..00bbadfcf 100644 --- a/src/Events/Events_Listener.h +++ b/src/Events/Events_Listener.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Events_Listener_H_ #define Events_Listener_H_ #include -#include #include +#include class Events_Message; class Events_ID; @@ -35,25 +36,28 @@ class Events_ID; * this class and register in the Loop. */ class Events_Listener { - /// map from event ID to groupped messages (for flush for groupMessages=true listeners) - std::map > myGroups; + /// map from event ID to groupped messages (for flush for groupMessages=true + /// listeners) + std::map> myGroups; public: virtual ~Events_Listener() {} //! This method is called by loop when the event is started to process. - EVENTS_EXPORT virtual void processEvent(const std::shared_ptr& theMessage) = 0; + EVENTS_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage) = 0; - //! Listener that needs mostly grouped messages received returns true in this method. - //! In this case during the message is flushed, all the new messages are grouped, not sended - //! immideately and then sent in the end of flush. - EVENTS_EXPORT virtual bool groupMessages() {return false;} + //! Listener that needs mostly grouped messages received returns true in this + //! method. In this case during the message is flushed, all the new messages + //! are grouped, not sended immideately and then sent in the end of flush. + EVENTS_EXPORT virtual bool groupMessages() { return false; } protected: - //! Allows to group messages while they are flushed (for flush for groupMessages=true listeners) - void groupWhileFlush(const std::shared_ptr& theMessage); + //! Allows to group messages while they are flushed (for flush for + //! groupMessages=true listeners) + void groupWhileFlush(const std::shared_ptr &theMessage); //! Sends myGroups on flush finish - EVENTS_EXPORT void flushGrouped(const Events_ID& theID); + EVENTS_EXPORT void flushGrouped(const Events_ID &theID); friend class Events_Loop; }; diff --git a/src/Events/Events_LongOp.cpp b/src/Events/Events_LongOp.cpp index 595889995..ecbb4c451 100644 --- a/src/Events/Events_LongOp.cpp +++ b/src/Events/Events_LongOp.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,25 +23,19 @@ /// senders of the long operation collected, ends the long operation event only /// if all senders are stopped -std::map MY_SENDERS; +std::map MY_SENDERS; -Events_LongOp::Events_LongOp(void* theSender) - : Events_Message(Events_LongOp::eventID(), theSender) -{ -} +Events_LongOp::Events_LongOp(void *theSender) + : Events_Message(Events_LongOp::eventID(), theSender) {} -Events_LongOp::~Events_LongOp() -{ -} +Events_LongOp::~Events_LongOp() {} -Events_ID Events_LongOp::eventID() -{ - Events_Loop* aLoop = Events_Loop::loop(); +Events_ID Events_LongOp::eventID() { + Events_Loop *aLoop = Events_Loop::loop(); return aLoop->eventByName("LongOperation"); } -void Events_LongOp::start(void* theSender) -{ +void Events_LongOp::start(void *theSender) { bool toSend = MY_SENDERS.empty(); if (MY_SENDERS.find(theSender) == MY_SENDERS.end()) MY_SENDERS[theSender] = 1; @@ -49,13 +44,12 @@ void Events_LongOp::start(void* theSender) if (toSend) { std::shared_ptr aNewOne = - std::shared_ptr(new Events_LongOp(theSender)); + std::shared_ptr(new Events_LongOp(theSender)); Events_Loop::loop()->send(aNewOne); } } -void Events_LongOp::end(void* theSender) -{ +void Events_LongOp::end(void *theSender) { if (MY_SENDERS.find(theSender) != MY_SENDERS.end()) { int aCount = MY_SENDERS[theSender]; if (aCount <= 1) @@ -65,12 +59,9 @@ void Events_LongOp::end(void* theSender) } if (MY_SENDERS.empty()) { std::shared_ptr aNewOne = - std::shared_ptr(new Events_LongOp(theSender)); + std::shared_ptr(new Events_LongOp(theSender)); Events_Loop::loop()->send(aNewOne); } } -bool Events_LongOp::isPerformed() -{ - return !MY_SENDERS.empty(); -} +bool Events_LongOp::isPerformed() { return !MY_SENDERS.empty(); } diff --git a/src/Events/Events_LongOp.h b/src/Events/Events_LongOp.h index a88e9ec85..74dea23b2 100644 --- a/src/Events/Events_LongOp.h +++ b/src/Events/Events_LongOp.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EVENTS_LONGOP_H_ @@ -27,23 +28,22 @@ * Informs the application that the long operation is performed. * Causes waiting coursor in GUI. */ -class EVENTS_EXPORT Events_LongOp : public Events_Message -{ +class EVENTS_EXPORT Events_LongOp : public Events_Message { public: /// Default destructor virtual ~Events_LongOp(); /// Returns the identifier of this event static Events_ID eventID(); /// Starts the long operation - static void start(void* theSender = 0); + static void start(void *theSender = 0); /// Stops the long operation - static void end(void* theSender = 0); + static void end(void *theSender = 0); /// Returns true if the long operation is performed static bool isPerformed(); protected: /// Default constructor. Use "start" and "end" for generation. - Events_LongOp(void* theSender = 0); + Events_LongOp(void *theSender = 0); }; #endif /* EVENTS_ERROR_H_ */ diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index 7f8465501..3180c0322 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -14,34 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include +#include -Events_Loop* Events_Loop::loop() -{ +Events_Loop *Events_Loop::loop() { // initialized on initialization of the application static Events_Loop MAIN_LOOP; return &MAIN_LOOP; } -Events_ID Events_Loop::eventByName(const char* theName) -{ - ///! All events created in this session, uniquely identified by the text and char pointer - static std::map CREATED_EVENTS; - char* aResult; +Events_ID Events_Loop::eventByName(const char *theName) { + ///! All events created in this session, uniquely identified by the text and + /// char pointer + static std::map CREATED_EVENTS; + char *aResult; std::string aName(theName); - std::map::iterator aFound = CREATED_EVENTS.find(aName); - if (aFound == CREATED_EVENTS.end()) { //not created yet + std::map::iterator aFound = CREATED_EVENTS.find(aName); + if (aFound == CREATED_EVENTS.end()) { // not created yet #ifdef WIN32 - aResult = _strdup(theName); // copy to make unique internal pointer + aResult = _strdup(theName); // copy to make unique internal pointer #else - aResult = strdup(theName); // copy to make unique internal pointer + aResult = strdup(theName); // copy to make unique internal pointer #endif CREATED_EVENTS[aName] = aResult; } else @@ -50,10 +50,10 @@ Events_ID Events_Loop::eventByName(const char* theName) return Events_ID(aResult); } -void Events_Loop::sendProcessEvent(const std::shared_ptr& theMessage, - std::list& theListeners, const bool theFlushedNow) -{ - std::list::iterator aL = theListeners.begin(); +void Events_Loop::sendProcessEvent( + const std::shared_ptr &theMessage, + std::list &theListeners, const bool theFlushedNow) { + std::list::iterator aL = theListeners.begin(); for (; aL != theListeners.end(); aL++) { if (theFlushedNow && (*aL)->groupMessages()) { (*aL)->groupWhileFlush(theMessage); @@ -63,87 +63,97 @@ void Events_Loop::sendProcessEvent(const std::shared_ptr& theMes } } -void Events_Loop::send(const std::shared_ptr& theMessage, bool isGroup) -{ - if (myImmediateListeners.find(theMessage->eventID().eventText()) != myImmediateListeners.end()) { - myImmediateListeners[theMessage->eventID().eventText()]->processEvent(theMessage); +void Events_Loop::send(const std::shared_ptr &theMessage, + bool isGroup) { + if (myImmediateListeners.find(theMessage->eventID().eventText()) != + myImmediateListeners.end()) { + myImmediateListeners[theMessage->eventID().eventText()]->processEvent( + theMessage); } // if it is grouped message, just accumulate it - bool isFlushedNow = myFlushed.find(theMessage->eventID().myID) != myFlushed.end(); + bool isFlushedNow = + myFlushed.find(theMessage->eventID().myID) != myFlushed.end(); if (isGroup && !isFlushedNow) { std::shared_ptr aGroup = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aGroup) { - std::map >::iterator aMyGroup = myGroups.find( - aGroup->eventID().eventText()); - if (aMyGroup == myGroups.end()) { // create a new group of messages for accumulation + std::map>::iterator aMyGroup = + myGroups.find(aGroup->eventID().eventText()); + if (aMyGroup == + myGroups.end()) { // create a new group of messages for accumulation myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty(); aMyGroup = myGroups.find(aGroup->eventID().eventText()); } std::shared_ptr aStored = - std::dynamic_pointer_cast(aMyGroup->second); + std::dynamic_pointer_cast(aMyGroup->second); aStored->Join(aGroup); return; } } // send - std::map > >::iterator aFindID = - myListeners.find(theMessage->eventID().eventText()); + std::map>>::iterator + aFindID = myListeners.find(theMessage->eventID().eventText()); if (aFindID != myListeners.end()) { - std::map >::iterator aFindSender = aFindID->second.find( - theMessage->sender()); + std::map>::iterator aFindSender = + aFindID->second.find(theMessage->sender()); if (aFindSender != aFindID->second.end()) { - sendProcessEvent(theMessage, aFindSender->second, isFlushedNow && isGroup); + sendProcessEvent(theMessage, aFindSender->second, + isFlushedNow && isGroup); } - if (theMessage->sender()) { // also call for NULL senders registered + if (theMessage->sender()) { // also call for NULL senders registered aFindSender = aFindID->second.find(NULL); if (aFindSender != aFindID->second.end()) { - sendProcessEvent(theMessage, aFindSender->second, isFlushedNow && isGroup); + sendProcessEvent(theMessage, aFindSender->second, + isFlushedNow && isGroup); } } } } -void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID theID, - void* theSender, bool theImmediate) -{ +void Events_Loop::registerListener(Events_Listener *theListener, + const Events_ID theID, void *theSender, + bool theImmediate) { if (theImmediate) { // just register as an immediate myImmediateListeners[theID.eventText()] = theListener; return; } - std::map > >::iterator aFindID = - myListeners.find(theID.eventText()); - if (aFindID == myListeners.end()) { // create container associated with ID - myListeners[theID.eventText()] = std::map >(); + std::map>>::iterator + aFindID = myListeners.find(theID.eventText()); + if (aFindID == myListeners.end()) { // create container associated with ID + myListeners[theID.eventText()] = + std::map>(); aFindID = myListeners.find(theID.eventText()); } - std::map >::iterator aFindSender = - aFindID->second.find(theSender); - if (aFindSender == aFindID->second.end()) { // create container associated with sender - aFindID->second[theSender] = std::list(); + std::map>::iterator aFindSender = + aFindID->second.find(theSender); + if (aFindSender == + aFindID->second.end()) { // create container associated with sender + aFindID->second[theSender] = std::list(); aFindSender = aFindID->second.find(theSender); } // check that listener was not registered with such parameters before - std::list& aListeners = aFindSender->second; - for (std::list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) + std::list &aListeners = aFindSender->second; + for (std::list::iterator aL = aListeners.begin(); + aL != aListeners.end(); aL++) if (*aL == theListener) - return; // avoid duplicates + return; // avoid duplicates aListeners.push_back(theListener); } -void Events_Loop::removeListener(Events_Listener* theListener) -{ +void Events_Loop::removeListener(Events_Listener *theListener) { // remove the listener in myListeners map - std::map > >::const_reverse_iterator - anIt = myListeners.rbegin(); - while(anIt != myListeners.rend()) { - std::map > aLMap = anIt->second; - std::map >::const_reverse_iterator aLIt = aLMap.rbegin(); + std::map>>:: + const_reverse_iterator anIt = myListeners.rbegin(); + while (anIt != myListeners.rend()) { + std::map> aLMap = anIt->second; + std::map>::const_reverse_iterator + aLIt = aLMap.rbegin(); while (aLIt != aLMap.rend()) { - std::list aListeners = aLIt->second; - std::list::const_reverse_iterator aLsIt = aListeners.rbegin(); + std::list aListeners = aLIt->second; + std::list::const_reverse_iterator aLsIt = + aListeners.rbegin(); for (; aLsIt != aListeners.rend(); aLsIt++) { if (*aLsIt == theListener) { aListeners.remove(theListener); @@ -156,7 +166,8 @@ void Events_Loop::removeListener(Events_Listener* theListener) aLMap.erase(aLIt->first); myListeners[anIt->first] = aLMap; if (aLMap.empty()) - break; // avoid incrementation of the iterator if the container is empty + break; // avoid incrementation of the iterator if the container is + // empty } aLIt++; } @@ -169,8 +180,9 @@ void Events_Loop::removeListener(Events_Listener* theListener) } // remove the listener in myImmediateListeners map - std::map::const_reverse_iterator anImIt = myImmediateListeners.rbegin(); - while(anImIt != myImmediateListeners.rend()) { + std::map::const_reverse_iterator anImIt = + myImmediateListeners.rbegin(); + while (anImIt != myImmediateListeners.rend()) { if (anImIt->second == theListener) { myImmediateListeners.erase(anImIt->first); if (myImmediateListeners.empty()) @@ -180,15 +192,13 @@ void Events_Loop::removeListener(Events_Listener* theListener) } } -void Events_Loop::flush(const Events_ID& theID) -{ +void Events_Loop::flush(const Events_ID &theID) { if (!myFlushActive) return; bool hasEventsToFlush = !myGroups.empty(); - std::map >::iterator aMyGroup; - for(aMyGroup = myGroups.find(theID.eventText()); - aMyGroup != myGroups.end(); aMyGroup = myGroups.find(theID.eventText())) - { // really sends + std::map>::iterator aMyGroup; + for (aMyGroup = myGroups.find(theID.eventText()); aMyGroup != myGroups.end(); + aMyGroup = myGroups.find(theID.eventText())) { // really sends bool aWasFlushed = myFlushed.find(theID.myID) != myFlushed.end(); if (!aWasFlushed) myFlushed.insert(theID.myID); @@ -198,7 +208,7 @@ void Events_Loop::flush(const Events_ID& theID) if (!aWasFlushed) { // TODO: Stabilization fix. Check later. - if(myFlushed.find(theID.myID) != myFlushed.end()) { + if (myFlushed.find(theID.myID) != myFlushed.end()) { myFlushed.erase(myFlushed.find(theID.myID)); } #ifdef _DEBUG @@ -208,14 +218,15 @@ void Events_Loop::flush(const Events_ID& theID) #endif } // send accumulated messages to "groupListeners" - std::map > >::iterator aFindID = - myListeners.find(theID.eventText()); + std::map>>::iterator + aFindID = myListeners.find(theID.eventText()); if (aFindID != myListeners.end()) { - std::map >::iterator aFindSender = - aFindID->second.begin(); - for(; aFindSender != aFindID->second.end(); aFindSender++) { - std::list::iterator aListener = aFindSender->second.begin(); - for(; aListener != aFindSender->second.end(); aListener++) { + std::map>::iterator aFindSender = + aFindID->second.begin(); + for (; aFindSender != aFindID->second.end(); aFindSender++) { + std::list::iterator aListener = + aFindSender->second.begin(); + for (; aListener != aFindSender->second.end(); aListener++) { if ((*aListener)->groupMessages()) { (*aListener)->flushGrouped(theID); } @@ -231,46 +242,39 @@ void Events_Loop::flush(const Events_ID& theID) } } -void Events_Loop::eraseMessages(const Events_ID& theID) -{ - std::map >::iterator aMyGroup = - myGroups.find(theID.eventText()); +void Events_Loop::eraseMessages(const Events_ID &theID) { + std::map>::iterator aMyGroup = + myGroups.find(theID.eventText()); if (aMyGroup != myGroups.end()) { myGroups.erase(aMyGroup); } } - -bool Events_Loop::activateFlushes(const bool theActivate) -{ +bool Events_Loop::activateFlushes(const bool theActivate) { bool isActive = myFlushActive; myFlushActive = theActivate; return isActive; } -void Events_Loop::clear(const Events_ID& theID) -{ - std::map>::iterator aMyGroup = - myGroups.find(theID.eventText()); - if (aMyGroup != myGroups.end()) { // really sends +void Events_Loop::clear(const Events_ID &theID) { + std::map>::iterator aMyGroup = + myGroups.find(theID.eventText()); + if (aMyGroup != myGroups.end()) { // really sends myGroups.erase(aMyGroup); } } -bool Events_Loop::isFlushed(const Events_ID& theID) -{ +bool Events_Loop::isFlushed(const Events_ID &theID) { return myFlushed.find(theID.myID) != myFlushed.end(); } -void Events_Loop::setFlushed(const Events_ID& theID, const bool theValue) -{ +void Events_Loop::setFlushed(const Events_ID &theID, const bool theValue) { if (theValue) myFlushed.insert(theID.myID); else myFlushed.erase(myFlushed.find(theID.myID)); } -bool Events_Loop::hasGrouppedEvent(const Events_ID& theID) -{ +bool Events_Loop::hasGrouppedEvent(const Events_ID &theID) { return myGroups.find(theID.myID) != myGroups.end(); -} \ No newline at end of file +} diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index ad68228b1..82b97a47b 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Events_Loop_H_ #define Events_Loop_H_ -#include #include +#include +#include #include #include -#include class Events_MessageGroup; @@ -34,85 +35,93 @@ class Events_MessageGroup; * \brief Base class that manages the receiving and sending of all * not Qt-events in the application. * - * One per application, initialized on start. Listeners must register in this loop - * to get events, called by senders. Sending of events is very fast (just adding to container). - * Performing of events is processed in separated thread, so, sender takes - * control back immideately. + * One per application, initialized on start. Listeners must register in this + * loop to get events, called by senders. Sending of events is very fast (just + * adding to container). Performing of events is processed in separated thread, + * so, sender takes control back immideately. */ -class Events_Loop -{ - /// map from event ID to sender pointer to listeners that must be called for this - std::map > > myListeners; +class Events_Loop { + /// map from event ID to sender pointer to listeners that must be called for + /// this + std::map>> myListeners; - /// map from event ID to listeners which must process message without waiting for flush - std::map myImmediateListeners; + /// map from event ID to listeners which must process message without waiting + /// for flush + std::map myImmediateListeners; /// map from event ID to groupped messages (accumulated for flush) - std::map > myGroups; + std::map> myGroups; ///< set of messages that are flushed right now, so they are not grouped - std::set myFlushed; + std::set myFlushed; /// to process flushes or not bool myFlushActive; - //! The empty constructor, will be called at startup of the application, only once + //! The empty constructor, will be called at startup of the application, only + //! once Events_Loop() : myFlushActive(true) {} - public: +public: ///! Returns the main object of the loop, one per application. - EVENTS_EXPORT static Events_Loop* loop(); - //! Returns the unique event by the given name. Call this method only on initialization of object - //! to speedup the events processing without parsing of the string. - EVENTS_EXPORT static Events_ID eventByName(const char* theName); + EVENTS_EXPORT static Events_Loop *loop(); + //! Returns the unique event by the given name. Call this method only on + //! initialization of object to speedup the events processing without parsing + //! of the string. + EVENTS_EXPORT static Events_ID eventByName(const char *theName); //! Allows to send an event //! \param theMessage the enevt message to send //! \param isGroup is true for grouping messages if possible - EVENTS_EXPORT void send(const std::shared_ptr& theMessage, bool isGroup = true); + EVENTS_EXPORT void send(const std::shared_ptr &theMessage, + bool isGroup = true); //! Registers (or adds if such listener is already registered) a listener //! that will be called on the event and from the defined sender //! \param theListener the object that will listen (process) the event //! \param theID listen for messages with this ID //! \param theSender listen only for this sender (NULL - listen everybody) - //! \param theImmediate for listeners who can not wait (no groupping mechanism is used for it) - EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID, - void* theSender = 0, bool theImmediate = false); + //! \param theImmediate for listeners who can not wait (no groupping mechanism + //! is used for it) + EVENTS_EXPORT void registerListener(Events_Listener *theListener, + const Events_ID theID, + void *theSender = 0, + bool theImmediate = false); //! Remove the listener from internal maps if it was registered there //! \param theListener a listener - EVENTS_EXPORT void removeListener(Events_Listener* theListener); + EVENTS_EXPORT void removeListener(Events_Listener *theListener); //! Initializes sending of a group-message by the given ID - EVENTS_EXPORT void flush(const Events_ID& theID); + EVENTS_EXPORT void flush(const Events_ID &theID); - //! Removes messages with the given ID: they are not needed anymore (UPDATE on close) - EVENTS_EXPORT void eraseMessages(const Events_ID& theID); + //! Removes messages with the given ID: they are not needed anymore (UPDATE on + //! close) + EVENTS_EXPORT void eraseMessages(const Events_ID &theID); //! Allows to disable flushes: needed in synchronization of document mechanism - //! (to synchronize all and only then flush create, update, etc in correct order) - //! \param theActivate a state about flushe is active. If false, the flush is disabled - //! \return the previous active flush state + //! (to synchronize all and only then flush create, update, etc in correct + //! order) \param theActivate a state about flushe is active. If false, the + //! flush is disabled \return the previous active flush state EVENTS_EXPORT bool activateFlushes(const bool theActivate); //! Clears all collected messages - EVENTS_EXPORT void clear(const Events_ID& theID); + EVENTS_EXPORT void clear(const Events_ID &theID); //! Returns true if the evement is flushed right now - EVENTS_EXPORT bool isFlushed(const Events_ID& theID); + EVENTS_EXPORT bool isFlushed(const Events_ID &theID); //! Sets the flag that the event is flished right now - EVENTS_EXPORT void setFlushed(const Events_ID& theID, const bool theValue); + EVENTS_EXPORT void setFlushed(const Events_ID &theID, const bool theValue); //! Returns true if a loop accumulated events to be flashed - EVENTS_EXPORT bool hasGrouppedEvent(const Events_ID& theID); + EVENTS_EXPORT bool hasGrouppedEvent(const Events_ID &theID); private: //! Calls "processEvent" for the given listeners. //! If theFlushedNow for grouped listeners is stores message in listeners. - void sendProcessEvent(const std::shared_ptr& theMessage, - std::list& theListeners, const bool theFlushedNow); - + void sendProcessEvent(const std::shared_ptr &theMessage, + std::list &theListeners, + const bool theFlushedNow); }; #endif diff --git a/src/Events/Events_Message.cpp b/src/Events/Events_Message.cpp index 6d1dc1d68..bb0466238 100644 --- a/src/Events/Events_Message.cpp +++ b/src/Events/Events_Message.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include diff --git a/src/Events/Events_Message.h b/src/Events/Events_Message.h index 9ba35a6d7..79c1b481b 100644 --- a/src/Events/Events_Message.h +++ b/src/Events/Events_Message.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Events_Message_H_ @@ -32,64 +33,43 @@ * used as an identifier (this is useful for debugging of the events * with log files and in debugger). */ -class EVENTS_EXPORT Events_ID -{ - /// pointer to the text-identifier of the event, unique pointer for all events of such type - char* myID; +class EVENTS_EXPORT Events_ID { + /// pointer to the text-identifier of the event, unique pointer for all events + /// of such type + char *myID; - Events_ID(char* theID) - { - myID = theID; - } + Events_ID(char *theID) { myID = theID; } friend class Events_Loop; - public: + +public: /// Returns the text-identifier of the event (for debugging reasons) - char* eventText() const - { - return myID; - } + char *eventText() const { return myID; } /// Allows to compare identifiers - bool operator==(const Events_ID& theID) const - { - return myID == theID.myID; - } + bool operator==(const Events_ID &theID) const { return myID == theID.myID; } }; /**\class Events_Message * \ingroup EventsLoop * \brief Message for communication between sender and listener of event. - * Normally it is inherited by the higher-level + * Normally it is inherited by the higher-level */ -class EVENTS_EXPORT Events_Message -{ - Events_ID myEventsId; ///< identifier of the event - void* mySender; ///< the sender object - - public: +class EVENTS_EXPORT Events_Message { + Events_ID myEventsId; ///< identifier of the event + void *mySender; ///< the sender object +public: //! Creates the message - Events_Message(const Events_ID theID, const void* theSender = 0) - : myEventsId(theID), - mySender((void*) theSender) - { - } + Events_Message(const Events_ID theID, const void *theSender = 0) + : myEventsId(theID), mySender((void *)theSender) {} //! do nothing in the destructor yet - virtual ~Events_Message() - { - } + virtual ~Events_Message() {} //! Returns identifier of the message - const Events_ID& eventID() const - { - return myEventsId; - } + const Events_ID &eventID() const { return myEventsId; } //! Returns sender of the message or NULL if it is anonymous message - void* sender() const - { - return mySender; - } + void *sender() const { return mySender; } }; #endif diff --git a/src/Events/Events_MessageBool.cpp b/src/Events/Events_MessageBool.cpp index 9046df47e..63c95b2d6 100644 --- a/src/Events/Events_MessageBool.cpp +++ b/src/Events/Events_MessageBool.cpp @@ -14,13 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Events_MessageBool.h" -void Events_MessageBool::send() -{ +void Events_MessageBool::send() { std::shared_ptr aMsg(new Events_MessageBool(*this)); Events_Loop::loop()->send(aMsg); } diff --git a/src/Events/Events_MessageBool.h b/src/Events/Events_MessageBool.h index 0db0072ca..583d6eeb0 100644 --- a/src/Events/Events_MessageBool.h +++ b/src/Events/Events_MessageBool.h @@ -14,34 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Events_MessageBool_H_ #define Events_MessageBool_H_ #include -#include #include +#include -#include #include +#include /**\class Events_MessageBool * \ingroup EventsLoop * \brief An event message for sending a message with a boolean value. * May be used for different where just a Boolean flag is needed to send. */ -class Events_MessageBool: public Events_Message -{ +class Events_MessageBool : public Events_Message { public: - /// Constructor /// \param theEventID an indentifier of the message /// \param theValue a Boolean value to send /// \param theSender a pointer on sender object - Events_MessageBool(const Events_ID theEventID, const bool theValue, const void* theSender = 0): - Events_Message(theEventID, theSender), myValue(theValue) {} + Events_MessageBool(const Events_ID theEventID, const bool theValue, + const void *theSender = 0) + : Events_Message(theEventID, theSender), myValue(theValue) {} /// Default destructor virtual ~Events_MessageBool() {} @@ -53,10 +53,8 @@ public: EVENTS_EXPORT void send(); private: - /// The stored value bool myValue; - }; #endif diff --git a/src/Events/Events_MessageGroup.cpp b/src/Events/Events_MessageGroup.cpp index 96664e009..14a10e78b 100644 --- a/src/Events/Events_MessageGroup.cpp +++ b/src/Events/Events_MessageGroup.cpp @@ -14,15 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -Events_MessageGroup::Events_MessageGroup(const Events_ID theID, const void* theSender) -: Events_Message(theID, theSender) -{} - -Events_MessageGroup::~Events_MessageGroup() -{} +Events_MessageGroup::Events_MessageGroup(const Events_ID theID, + const void *theSender) + : Events_Message(theID, theSender) {} +Events_MessageGroup::~Events_MessageGroup() {} diff --git a/src/Events/Events_MessageGroup.h b/src/Events/Events_MessageGroup.h index 235ebaded..c5ddc535a 100644 --- a/src/Events/Events_MessageGroup.h +++ b/src/Events/Events_MessageGroup.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Events_MessageGroup_H_ @@ -25,25 +26,24 @@ /**\class Events_MessageGroup * \ingroup EventsLoop - * \brief Message that allows to group messages and send them later as a group of messages. + * \brief Message that allows to group messages and send them later as a group + * of messages. * - * Loop detects such messages and accumulates them without sending. On "flush" loop sends it - * as a group-message. + * Loop detects such messages and accumulates them without sending. On "flush" + * loop sends it as a group-message. */ -class EVENTS_EXPORT Events_MessageGroup : public Events_Message -{ - - public: +class EVENTS_EXPORT Events_MessageGroup : public Events_Message { +public: //! Creates the message - Events_MessageGroup(const Events_ID theID, const void* theSender = 0); + Events_MessageGroup(const Events_ID theID, const void *theSender = 0); //! do nothing in the destructor yet virtual ~Events_MessageGroup(); //! Creates a new empty group (to store it in the loop before flush) virtual std::shared_ptr newEmpty() = 0; //! Allows to join the given message with the current one - virtual void Join(const std::shared_ptr& theJoined) = 0; + virtual void Join(const std::shared_ptr &theJoined) = 0; }; #endif diff --git a/src/ExchangeAPI/CMakeLists.txt b/src/ExchangeAPI/CMakeLists.txt index 38506bea9..61dff48e2 100644 --- a/src/ExchangeAPI/CMakeLists.txt +++ b/src/ExchangeAPI/CMakeLists.txt @@ -113,16 +113,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ExchangeAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ExchangeAPI/ExchangeAPI.h b/src/ExchangeAPI/ExchangeAPI.h index 51e42f2a3..a343106ed 100644 --- a/src/ExchangeAPI/ExchangeAPI.h +++ b/src/ExchangeAPI/ExchangeAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEAPI_H @@ -22,13 +23,13 @@ #if defined EXCHANGEAPI_EXPORTS #if defined WIN32 -#define EXCHANGEAPI_EXPORT __declspec( dllexport ) +#define EXCHANGEAPI_EXPORT __declspec(dllexport) #else #define EXCHANGEAPI_EXPORT #endif #else #if defined WIN32 -#define EXCHANGEAPI_EXPORT __declspec( dllimport ) +#define EXCHANGEAPI_EXPORT __declspec(dllimport) #else #define EXCHANGEAPI_EXPORT #endif diff --git a/src/ExchangeAPI/ExchangeAPI_Export.cpp b/src/ExchangeAPI/ExchangeAPI_Export.cpp index 461d476d2..6b5bae013 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Export.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ExchangeAPI_Export.h" @@ -25,155 +26,186 @@ //-------------------------------------------------------------------------------------- #include #include -#include #include -#include #include +#include +#include //-------------------------------------------------------------------------------------- #include //-------------------------------------------------------------------------------------- -ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +ExchangeAPI_Export::ExchangeAPI_Export( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } /// Constructor with values for XAO export. -ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const std::string & theAuthor, - const std::string & theGeometryName) -: ModelHighAPI_Interface(theFeature) -{ +ExchangeAPI_Export::ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, const std::string &theAuthor, + const std::string &theGeometryName) + : ModelHighAPI_Interface(theFeature) { initialize(); - fillAttribute("XAO", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); - fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())); - fillAttribute(theAuthor, theFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); - fillAttribute(theGeometryName, - theFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); - fillAttribute("XAO", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); + fillAttribute("XAO", theFeature->string( + ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); + fillAttribute( + theFilePath, + theFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())); + fillAttribute(theAuthor, theFeature->string( + ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); + fillAttribute( + theGeometryName, + theFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); + fillAttribute("XAO", theFeature->string( + ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); execute(); - apply(); // finish operation to make sure the export is done on the current state of the history + apply(); // finish operation to make sure the export is done on the current + // state of the history } // Constructor with values for STL of selected result export. -ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, - const ModelHighAPI_Double& theDeflectionRelative, - const ModelHighAPI_Double& theDeflectionAbsolute, - const bool theIsRelative, - const bool theIsASCII) - : ModelHighAPI_Interface(theFeature) -{ +ExchangeAPI_Export::ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, + const ModelHighAPI_Selection &theSelectedShape, + const ModelHighAPI_Double &theDeflectionRelative, + const ModelHighAPI_Double &theDeflectionAbsolute, const bool theIsRelative, + const bool theIsASCII) + : ModelHighAPI_Interface(theFeature) { initialize(); - fillAttribute("STL", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); - fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())); + fillAttribute("STL", theFeature->string( + ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); + fillAttribute( + theFilePath, + theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())); if (theIsRelative) { fillAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(), - theFeature->string(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE()) ); - fillAttribute(theDeflectionRelative, - theFeature->real(ExchangePlugin_ExportFeature::STL_RELATIVE()) ); - } - else { + theFeature->string( + ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE())); + fillAttribute( + theDeflectionRelative, + theFeature->real(ExchangePlugin_ExportFeature::STL_RELATIVE())); + } else { fillAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(), - theFeature->string(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE()) ); - fillAttribute(theDeflectionAbsolute, - theFeature->real(ExchangePlugin_ExportFeature::STL_ABSOLUTE()) ); + theFeature->string( + ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE())); + fillAttribute( + theDeflectionAbsolute, + theFeature->real(ExchangePlugin_ExportFeature::STL_ABSOLUTE())); } - if(theIsASCII){ - fillAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE_ASCII(), - theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_TYPE())); - } - else - { - fillAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY(), - theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_TYPE())); + if (theIsASCII) { + fillAttribute( + ExchangePlugin_ExportFeature::STL_FILE_TYPE_ASCII(), + theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_TYPE())); + } else { + fillAttribute( + ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY(), + theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_TYPE())); } fillAttribute(theSelectedShape, - theFeature->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED())); - fillAttribute("STL", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); + theFeature->selection( + ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED())); + fillAttribute("STL", theFeature->string( + ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); execute(); - apply(); // finish operation to make sure the export is done on the current state of the history + apply(); // finish operation to make sure the export is done on the current + // state of the history } /// Constructor with values for XAO of selected result export. -ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const ModelHighAPI_Selection& theResult, - const std::string & theAuthor, - const std::string & theGeometryName) - : ModelHighAPI_Interface(theFeature) -{ +ExchangeAPI_Export::ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, const ModelHighAPI_Selection &theResult, + const std::string &theAuthor, const std::string &theGeometryName) + : ModelHighAPI_Interface(theFeature) { initialize(); - fillAttribute("XAO", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); - fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())); - fillAttribute(theAuthor, theFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); - fillAttribute(theGeometryName, - theFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); - fillAttribute("XAO", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); + fillAttribute("XAO", theFeature->string( + ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); + fillAttribute( + theFilePath, + theFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())); + fillAttribute(theAuthor, theFeature->string( + ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); + fillAttribute( + theGeometryName, + theFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); + fillAttribute("XAO", theFeature->string( + ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); std::list aListOfOneSel; aListOfOneSel.push_back(theResult); fillAttribute(aListOfOneSel, - theFeature->selectionList(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID())); + theFeature->selectionList( + ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID())); execute(); - apply(); // finish operation to make sure the export is done on the current state of the history + apply(); // finish operation to make sure the export is done on the current + // state of the history } /// Constructor with values for XAO of selected result export to memory buffer. -ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theResult, - const std::string & theAuthor, - const std::string & theGeometryName) - : ModelHighAPI_Interface(theFeature) -{ +ExchangeAPI_Export::ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theResult, const std::string &theAuthor, + const std::string &theGeometryName) + : ModelHighAPI_Interface(theFeature) { initialize(); - fillAttribute("XAOMem", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); - fillAttribute(theAuthor, theFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); - fillAttribute(theGeometryName, - theFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); - fillAttribute("XAO", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); + fillAttribute("XAOMem", theFeature->string( + ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); + fillAttribute(theAuthor, theFeature->string( + ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); + fillAttribute( + theGeometryName, + theFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); + fillAttribute("XAO", theFeature->string( + ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); std::list aListOfOneSel; aListOfOneSel.push_back(theResult); fillAttribute(aListOfOneSel, - theFeature->selectionList(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID())); + theFeature->selectionList( + ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID())); execute(); - apply(); // finish operation to make sure the export is done on the current state of the history + apply(); // finish operation to make sure the export is done on the current + // state of the history } /// Constructor with values for export in other formats than XAO. -ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const std::list & theSelectionList, - const std::string & theFileFormat) -: ModelHighAPI_Interface(theFeature) -{ +ExchangeAPI_Export::ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, + const std::list &theSelectionList, + const std::string &theFileFormat) + : ModelHighAPI_Interface(theFeature) { initialize(); - fillAttribute("Regular", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); - fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())); + fillAttribute("Regular", theFeature->string( + ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); + fillAttribute(theFilePath, theFeature->string( + ExchangePlugin_ExportFeature::FILE_PATH_ID())); fillAttribute(theSelectionList, - theFeature->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID())); - fillAttribute(theFileFormat, theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); + theFeature->selectionList( + ExchangePlugin_ExportFeature::SELECTION_LIST_ID())); + fillAttribute( + theFileFormat, + theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); execute(); - apply(); // finish operation to make sure the export is done on the current state of the history + apply(); // finish operation to make sure the export is done on the current + // state of the history } -ExchangeAPI_Export::~ExchangeAPI_Export() -{ -} +ExchangeAPI_Export::~ExchangeAPI_Export() {} -// this method is needed on Windows because back-slashes in python may cause error -static void correctSeparators(std::string& thePath) { +// this method is needed on Windows because back-slashes in python may cause +// error +static void correctSeparators(std::string &thePath) { // replace single "\" or triple "\\\" or more by double "\" for (std::size_t aFind = thePath.find('\\'); aFind != std::string::npos; - aFind = thePath.find('\\', aFind)) { + aFind = thePath.find('\\', aFind)) { // search the next std::size_t aFind2 = thePath.find('\\', aFind + 1); - if (aFind2 == std::string::npos || aFind2 > aFind + 1) { // single, so add one more + if (aFind2 == std::string::npos || + aFind2 > aFind + 1) { // single, so add one more thePath.replace(aFind, 1, 2, '\\'); } else { // if there is more than double "\", remove them for (aFind2 = thePath.find('\\', aFind2 + 1); @@ -186,41 +218,42 @@ static void correctSeparators(std::string& thePath) { } } -void ExchangeAPI_Export::dump(ModelHighAPI_Dumper& theDumper) const -{ +void ExchangeAPI_Export::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - std::string exportType = aBase->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())->value(); + std::string exportType = + aBase->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())->value(); if (exportType == "XAOMem") { std::string aGeometryName = - aBase->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value(); + aBase->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()) + ->value(); theDumper << "aXAOBuff"; std::string aGeometryNamePy; - if (! aGeometryName.empty()) { + if (!aGeometryName.empty()) { aGeometryNamePy = aGeometryName; - } - else { + } else { aGeometryNamePy = Locale::Convert::toString(aBase->data()->name()); } - if (! aGeometryNamePy.empty()) { + if (!aGeometryNamePy.empty()) { // add shape name std::replace(aGeometryNamePy.begin(), aGeometryNamePy.end(), ' ', '_'); theDumper << "_" << aGeometryNamePy; } theDumper << " = model.exportToXAOMem(" << aDocName; - AttributeSelectionListPtr aShapeSelected = - aBase->selectionList(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID()); + AttributeSelectionListPtr aShapeSelected = aBase->selectionList( + ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID()); if (aShapeSelected->isInitialized() && aShapeSelected->size() == 1) { theDumper << ", " << aShapeSelected->value(0); } - std::string theAuthor = aBase->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value(); - if (! theAuthor.empty()) + std::string theAuthor = + aBase->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value(); + if (!theAuthor.empty()) theDumper << ", '" << theAuthor << "'"; - if (! aGeometryName.empty()) + if (!aGeometryName.empty()) theDumper << ", '" << aGeometryName << "'"; theDumper << ")" << std::endl; return; @@ -230,144 +263,151 @@ void ExchangeAPI_Export::dump(ModelHighAPI_Dumper& theDumper) const if (exportType == "XAO") { std::string aTmpXAOFile = - aBase->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value(); + aBase->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID()) + ->value(); correctSeparators(aTmpXAOFile); - theDumper << "exportToXAO(" << aDocName << ", '" << aTmpXAOFile << "'" ; - AttributeSelectionListPtr aShapeSelected = - aBase->selectionList(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID()); + theDumper << "exportToXAO(" << aDocName << ", '" << aTmpXAOFile << "'"; + AttributeSelectionListPtr aShapeSelected = aBase->selectionList( + ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID()); if (aShapeSelected->isInitialized() && aShapeSelected->size() == 1) { - theDumper<<", "<value(0); + theDumper << ", " << aShapeSelected->value(0); } - std::string theAuthor = aBase->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value(); - if (! theAuthor.empty()) + std::string theAuthor = + aBase->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value(); + if (!theAuthor.empty()) theDumper << ", '" << theAuthor << "'"; std::string theGeometryName = - aBase->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value(); - if (! theGeometryName.empty()) + aBase->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()) + ->value(); + if (!theGeometryName.empty()) theDumper << ", '" << theGeometryName << "'"; theDumper << ")" << std::endl; - } - else if (exportType == "STL") { + } else if (exportType == "STL") { std::string aTmpSTLFile = - aBase->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())->value(); + aBase->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID()) + ->value(); correctSeparators(aTmpSTLFile); - theDumper << "exportToSTL(" << aDocName << ", '" << aTmpSTLFile << "'" ; + theDumper << "exportToSTL(" << aDocName << ", '" << aTmpSTLFile << "'"; AttributeSelectionPtr aShapeSelected = - aBase->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED()); + aBase->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED()); - theDumper<<","<< aShapeSelected; + theDumper << "," << aShapeSelected; - theDumper <<","<< stlabsolute() <<","<< stlrelative(); + theDumper << "," << stlabsolute() << "," << stlrelative(); - if (stldeflectionType()->value() - == ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE()){ - theDumper <<","<< "True"; - } - else { - theDumper <<","<< "False"; + if (stldeflectionType()->value() == + ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE()) { + theDumper << "," + << "True"; + } else { + theDumper << "," + << "False"; } - if (stlfileType()->value() == ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY()) { + if (stlfileType()->value() == + ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY()) { theDumper << "False"; - } - else { - theDumper << "True"; + } else { + theDumper << "True"; } theDumper << ")" << std::endl; - } - else { - std::string aFilePath = aBase->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->value(); + } else { + std::string aFilePath = + aBase->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->value(); correctSeparators(aFilePath); - theDumper << "exportToFile(" << aDocName << ", \"" << aFilePath << "\", " << - aBase->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID()); + theDumper << "exportToFile(" << aDocName << ", \"" << aFilePath << "\", " + << aBase->selectionList( + ExchangePlugin_ExportFeature::SELECTION_LIST_ID()); std::string theFileFormat = - aBase->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())->value(); + aBase->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())->value(); if (!theFileFormat.empty()) theDumper << ", '" << theFileFormat << "'"; theDumper << ")" << std::endl; } } -ExportPtr exportToFile(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::list & theSelectionList, - const std::string & theFileFormat) -{ - apply(); // finish previous operation to make sure all previous operations are done +ExportPtr +exportToFile(const std::shared_ptr &thePart, + const std::string &theFilePath, + const std::list &theSelectionList, + const std::string &theFileFormat) { + apply(); // finish previous operation to make sure all previous operations are + // done std::shared_ptr aFeature = - thePart->addFeature(ExchangePlugin_ExportFeature::ID()); - return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theSelectionList, theFileFormat)); + thePart->addFeature(ExchangePlugin_ExportFeature::ID()); + return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, + theSelectionList, theFileFormat)); } -ExportPtr exportToXAO(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::string & theAuthor, - const std::string & theGeometryName) -{ - apply(); // finish previous operation to make sure all previous operations are done +ExportPtr exportToXAO(const std::shared_ptr &thePart, + const std::string &theFilePath, + const std::string &theAuthor, + const std::string &theGeometryName) { + apply(); // finish previous operation to make sure all previous operations are + // done std::shared_ptr aFeature = - thePart->addFeature(ExchangePlugin_ExportFeature::ID()); - return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theAuthor, theGeometryName)); + thePart->addFeature(ExchangePlugin_ExportFeature::ID()); + return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theAuthor, + theGeometryName)); } -ExportPtr exportToSTL(const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, - const ModelHighAPI_Double& theDeflectionRelative, - const ModelHighAPI_Double& theDeflectionAbsolute, - const bool theIsRelative, - const bool theIsASCII) -{ - apply(); // finish previous operation to make sure all previous operations are done +ExportPtr exportToSTL(const std::shared_ptr &thePart, + const std::string &theFilePath, + const ModelHighAPI_Selection &theSelectedShape, + const ModelHighAPI_Double &theDeflectionRelative, + const ModelHighAPI_Double &theDeflectionAbsolute, + const bool theIsRelative, const bool theIsASCII) { + apply(); // finish previous operation to make sure all previous operations are + // done std::shared_ptr aFeature = - thePart->addFeature(ExchangePlugin_ExportFeature::ID()); + thePart->addFeature(ExchangePlugin_ExportFeature::ID()); - return ExportPtr(new ExchangeAPI_Export(aFeature, - theFilePath, - theSelectedShape, - theDeflectionRelative, - theDeflectionAbsolute, - theIsRelative, - theIsASCII)); + return ExportPtr(new ExchangeAPI_Export( + aFeature, theFilePath, theSelectedShape, theDeflectionRelative, + theDeflectionAbsolute, theIsRelative, theIsASCII)); } -ExportPtr exportToXAO(const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, +ExportPtr exportToXAO(const std::shared_ptr &thePart, + const std::string &theFilePath, + const ModelHighAPI_Selection &theSelectedShape, const std::string & /*theAuthor*/, - const std::string & /*theGeometryName*/) -{ - apply(); // finish previous operation to make sure all previous operations are done + const std::string & /*theGeometryName*/) { + apply(); // finish previous operation to make sure all previous operations are + // done std::shared_ptr aFeature = - thePart->addFeature(ExchangePlugin_ExportFeature::ID()); + thePart->addFeature(ExchangePlugin_ExportFeature::ID()); // special internal case when for XAO a selection list is filled - return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theSelectedShape, "XAO")); + return ExportPtr( + new ExchangeAPI_Export(aFeature, theFilePath, theSelectedShape, "XAO")); } -PyObject* exportToXAOMem(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theSelectedShape, - const std::string & theAuthor, - const std::string & theGeometryName) -{ - apply(); // finish previous operation to make sure all previous operations are done +PyObject *exportToXAOMem(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theSelectedShape, + const std::string &theAuthor, + const std::string &theGeometryName) { + apply(); // finish previous operation to make sure all previous operations are + // done std::shared_ptr aFeature = - thePart->addFeature(ExchangePlugin_ExportFeature::ID()); - ExportPtr aXAOExportAPI (new ExchangeAPI_Export - (aFeature, theSelectedShape, theAuthor, theGeometryName)); - std::string aBuff = aFeature->string(ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID())->value(); + thePart->addFeature(ExchangePlugin_ExportFeature::ID()); + ExportPtr aXAOExportAPI(new ExchangeAPI_Export(aFeature, theSelectedShape, + theAuthor, theGeometryName)); + std::string aBuff = + aFeature->string(ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID()) + ->value(); return PyBytes_FromStringAndSize(aBuff.c_str(), aBuff.length()); } -void exportPart(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::list & theSelected) -{ +void exportPart(const std::shared_ptr &thePart, + const std::string &theFilePath, + const std::list &theSelected) { FeaturePtr aFeature = thePart->addFeature(ExchangePlugin_ExportPart::ID()); - aFeature->string(ExchangePlugin_ExportPart::FILE_PATH_ID())->setValue(theFilePath); + aFeature->string(ExchangePlugin_ExportPart::FILE_PATH_ID()) + ->setValue(theFilePath); if (!theSelected.empty()) { fillAttribute(theSelected, - aFeature->selectionList(ExchangePlugin_ExportPart::SELECTION_LIST_ID())); + aFeature->selectionList( + ExchangePlugin_ExportPart::SELECTION_LIST_ID())); } // restart transaction to execute and delete the macro-feature apply(); diff --git a/src/ExchangeAPI/ExchangeAPI_Export.h b/src/ExchangeAPI/ExchangeAPI_Export.h index c23bc9e66..c6bc52c81 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.h +++ b/src/ExchangeAPI/ExchangeAPI_Export.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ @@ -38,99 +39,100 @@ class ModelHighAPI_Selection; class ModelHighAPI_Double; //-------------------------------------------------------------------------------------- - /// \class ExchangeAPI_Export /// \ingroup CPPHighAPI /// \brief Interface for Export feature. -class ExchangeAPI_Export: public ModelHighAPI_Interface -{ +class ExchangeAPI_Export : public ModelHighAPI_Interface { public: /// Constructor without values. EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Export(const std::shared_ptr& theFeature); + explicit ExchangeAPI_Export( + const std::shared_ptr &theFeature); /// Constructor with values for XAO export. EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const std::string & theAuthor = std::string(), - const std::string & theGeometryName = std::string()); + explicit ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, + const std::string &theAuthor = std::string(), + const std::string &theGeometryName = std::string()); /// Constructor with values for STL of selected result export. EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, - const ModelHighAPI_Double& theDeflectionRelative , - const ModelHighAPI_Double& theDeflectionAbsolute, - const bool theIsRelative, - const bool theIsASCII); + explicit ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, + const ModelHighAPI_Selection &theSelectedShape, + const ModelHighAPI_Double &theDeflectionRelative, + const ModelHighAPI_Double &theDeflectionAbsolute, + const bool theIsRelative, const bool theIsASCII); /// Constructor with values for XAO of selected result export. EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const ModelHighAPI_Selection& theResult, - const std::string & theAuthor, - const std::string & theGeometryName = std::string()); - - /// Constructor with values for XAO of selected result export to memory buffer. + explicit ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, const ModelHighAPI_Selection &theResult, + const std::string &theAuthor, + const std::string &theGeometryName = std::string()); + + /// Constructor with values for XAO of selected result export to memory + /// buffer. EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theResult, - const std::string & theAuthor, - const std::string & theGeometryName = std::string()); + explicit ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theResult, const std::string &theAuthor, + const std::string &theGeometryName = std::string()); /// Constructor with values for export in other formats than XAO. EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const std::list & theSelectionList, - const std::string & theFileFormat = std::string()); + explicit ExchangeAPI_Export( + const std::shared_ptr &theFeature, + const std::string &theFilePath, + const std::list &theSelectionList, + const std::string &theFileFormat = std::string()); /// Destructor. EXCHANGEAPI_EXPORT virtual ~ExchangeAPI_Export(); - INTERFACE_16(ExchangePlugin_ExportFeature::ID(), - exportType, ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(), - ModelAPI_AttributeString, /** ExportType */, - filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(), - ModelAPI_AttributeString, /** file path */, - xaoFilePath, ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(), - ModelAPI_AttributeString, /** xao_file_path */, - fileFormat, ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), - ModelAPI_AttributeString, /** file format */, - selectionList, ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), - ModelAPI_AttributeString, /** selection list */, - xaoAuthor, ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(), - ModelAPI_AttributeString, /** xao author */, - xaoGeometryName, ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(), - ModelAPI_AttributeString, /** xao geometry name */, - stlFilePath, ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(), - ModelAPI_AttributeString, /** stl_file_path */, - stlobjectselected, ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(), - ModelAPI_AttributeSelection, /** Object selected to export in stl file*/, - stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(), - ModelAPI_AttributeString, /** Type of the defelection */, - stlrelative, ExchangePlugin_ExportFeature::STL_RELATIVE(), - ModelAPI_AttributeDouble, /** Relative*/, - stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(), - ModelAPI_AttributeDouble, /** Absolute */, - stlfileType, ExchangePlugin_ExportFeature::STL_FILE_TYPE(), - ModelAPI_AttributeString, /** Type of the stl file*/, - stldeflectionTypeabsolute, - ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(), - ModelAPI_AttributeString, /** Type of the defelection */, - stldeflectionTyperelative, - ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(), - ModelAPI_AttributeString, /** Type of the defelection */, - memoryBuff, ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID(), - ModelAPI_AttributeString, /** Bytes*/) + INTERFACE_16( + ExchangePlugin_ExportFeature::ID(), exportType, + ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(), ModelAPI_AttributeString, + /** ExportType */, filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(), + ModelAPI_AttributeString, /** file path */, xaoFilePath, + ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(), + ModelAPI_AttributeString, /** xao_file_path */, fileFormat, + ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), ModelAPI_AttributeString, + /** file format */, selectionList, + ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), + ModelAPI_AttributeString, /** selection list */, xaoAuthor, + ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(), ModelAPI_AttributeString, + /** xao author */, xaoGeometryName, + ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(), + ModelAPI_AttributeString, /** xao geometry name */, stlFilePath, + ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(), + ModelAPI_AttributeString, /** stl_file_path */, stlobjectselected, + ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(), + ModelAPI_AttributeSelection, /** Object selected to export in stl file*/, + stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(), + ModelAPI_AttributeString, /** Type of the defelection */, stlrelative, + ExchangePlugin_ExportFeature::STL_RELATIVE(), ModelAPI_AttributeDouble, + /** Relative*/, stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(), + ModelAPI_AttributeDouble, /** Absolute */, stlfileType, + ExchangePlugin_ExportFeature::STL_FILE_TYPE(), ModelAPI_AttributeString, + /** Type of the stl file*/, stldeflectionTypeabsolute, + ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(), + ModelAPI_AttributeString, /** Type of the defelection */, + stldeflectionTyperelative, + ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(), + ModelAPI_AttributeString, /** Type of the defelection */, memoryBuff, + ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID(), + ModelAPI_AttributeString, + /** Bytes*/) /// Dump wrapped feature EXCHANGEAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Export object @@ -140,59 +142,61 @@ typedef std::shared_ptr ExportPtr; * \brief Export to file */ EXCHANGEAPI_EXPORT -ExportPtr exportToFile(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::list & theSelectionList, - const std::string & theFileFormat = std::string()); +ExportPtr +exportToFile(const std::shared_ptr &thePart, + const std::string &theFilePath, + const std::list &theSelectionList, + const std::string &theFileFormat = std::string()); /**\ingroup CPPHighAPI * \brief Exports to XAO file all results of the current document */ EXCHANGEAPI_EXPORT -ExportPtr exportToXAO(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::string & theAuthor = std::string(), - const std::string & theGeometryName = std::string()); +ExportPtr exportToXAO(const std::shared_ptr &thePart, + const std::string &theFilePath, + const std::string &theAuthor = std::string(), + const std::string &theGeometryName = std::string()); /**\ingroup CPPHighAPI * \brief Exports to STL file the result of the current document */ EXCHANGEAPI_EXPORT -ExportPtr exportToSTL(const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, - const ModelHighAPI_Double& theDeflectionRelative, - const ModelHighAPI_Double& theDeflectionAbsolute, - const bool theIsRelative, - const bool theIsASCII); +ExportPtr exportToSTL(const std::shared_ptr &thePart, + const std::string &theFilePath, + const ModelHighAPI_Selection &theSelectedShape, + const ModelHighAPI_Double &theDeflectionRelative, + const ModelHighAPI_Double &theDeflectionAbsolute, + const bool theIsRelative, const bool theIsASCII); /**\ingroup CPPHighAPI -* \brief Exports to XAO file the selected result with groups parts related to it only. -*/ + * \brief Exports to XAO file the selected result with groups parts related to + * it only. + */ EXCHANGEAPI_EXPORT -ExportPtr exportToXAO(const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, - const std::string & theAuthor = std::string(), - const std::string & theGeometryName = std::string()); +ExportPtr exportToXAO(const std::shared_ptr &thePart, + const std::string &theFilePath, + const ModelHighAPI_Selection &theSelectedShape, + const std::string &theAuthor = std::string(), + const std::string &theGeometryName = std::string()); /**\ingroup CPPHighAPI -* \brief Exports to XAO format buffer the selected result with groups parts related to it only. -*/ + * \brief Exports to XAO format buffer the selected result with groups parts + * related to it only. + */ EXCHANGEAPI_EXPORT -PyObject* exportToXAOMem(const std::shared_ptr & thePart, - const ModelHighAPI_Selection& theSelectedShape, - const std::string & theAuthor = std::string(), - const std::string & theGeometryName = std::string()); - +PyObject *exportToXAOMem(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theSelectedShape, + const std::string &theAuthor = std::string(), + const std::string &theGeometryName = std::string()); /** \ingroup CPPHighAPI * \brief Export selected features or the whole part to the binary file. */ -EXCHANGEAPI_EXPORT void exportPart( - const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::list & theSelected = std::list()); +EXCHANGEAPI_EXPORT void +exportPart(const std::shared_ptr &thePart, + const std::string &theFilePath, + const std::list &theSelected = + std::list()); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/ExchangeAPI/ExchangeAPI_Import.cpp b/src/ExchangeAPI/ExchangeAPI_Import.cpp index 09df54f08..8f11c518a 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Import.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ExchangeAPI_Import.h" @@ -27,41 +28,37 @@ #include #include //-------------------------------------------------------------------------------------- -#include +#include #include +#include #include #include -#include //-------------------------------------------------------------------------------------- #include //-------------------------------------------------------------------------------------- -#include #include #include #include +#include ExchangeAPI_Import::ExchangeAPI_Import( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } ExchangeAPI_Import::ExchangeAPI_Import( - const std::shared_ptr & theFeature, - const std::string & theFilePath) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::string &theFilePath) + : ModelHighAPI_Interface(theFeature) { if (initialize()) setFilePath(theFilePath); } ExchangeAPI_Import::ExchangeAPI_Import( - const std::shared_ptr & theFeature, - const std::string & /*theFilePath*/, - const std::string & theBuffer) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::string & /*theFilePath*/, const std::string &theBuffer) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute("XAOMem", myimportType); fillAttribute(theBuffer, mymemoryBuffer); @@ -70,43 +67,36 @@ ExchangeAPI_Import::ExchangeAPI_Import( } ExchangeAPI_Import::ExchangeAPI_Import( - const std::shared_ptr & theFeature, - const std::string & theFilePath, - const bool theScalInterUnits, - const bool theMaterials, - const bool theColor) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::string &theFilePath, const bool theScalInterUnits, + const bool theMaterials, const bool theColor) + : ModelHighAPI_Interface(theFeature) { if (initialize()) setParameters(theFilePath, theScalInterUnits, theMaterials, theColor); } -ExchangeAPI_Import::~ExchangeAPI_Import() -{ - -} +ExchangeAPI_Import::~ExchangeAPI_Import() {} //-------------------------------------------------------------------------------------- -void ExchangeAPI_Import::setParameters(const std::string & theFilePath, +void ExchangeAPI_Import::setParameters(const std::string &theFilePath, const bool theScalInterUnits, const bool theMaterials, - const bool theColor) -{ + const bool theColor) { fillAttribute(theFilePath, mystepFilePath); fillAttribute("STEP", myimportType); fillAttribute(theScalInterUnits, myscalInterUnits); - fillAttribute(theMaterials,mymaterials); - fillAttribute(theColor,mycolors); + fillAttribute(theMaterials, mymaterials); + fillAttribute(theColor, mycolors); execute(); } //-------------------------------------------------------------------------------------- -void ExchangeAPI_Import::setFilePath(const std::string & theFilePath) -{ +void ExchangeAPI_Import::setFilePath(const std::string &theFilePath) { - std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFilePath); + std::string anExtension = + GeomAlgoAPI_Tools::File_Tools::extension(theFilePath); if (anExtension == "STEP" || anExtension == "STP") { - setParameters(theFilePath,true,false,false); + setParameters(theFilePath, true, false, false); } else { fillAttribute(theFilePath, myfilePath); fillAttribute(anExtension, myimportType); @@ -115,51 +105,53 @@ void ExchangeAPI_Import::setFilePath(const std::string & theFilePath) } //-------------------------------------------------------------------------------------- -void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const -{ +void ExchangeAPI_Import::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); AttributeStringPtr aImportTypeAttr = - aBase->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); + aBase->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); std::string aFormat = aImportTypeAttr->value(); if (aFormat == "XAOMem") { - theDumper << aBase << " = model.addImportXAOMem(" << aPartName << ", aXAOBuff"; - std::string aGeometryNamePy = Locale::Convert::toString(aBase->data()->name()); - if (! aGeometryNamePy.empty()) { + theDumper << aBase << " = model.addImportXAOMem(" << aPartName + << ", aXAOBuff"; + std::string aGeometryNamePy = + Locale::Convert::toString(aBase->data()->name()); + if (!aGeometryNamePy.empty()) { // add shape name std::replace(aGeometryNamePy.begin(), aGeometryNamePy.end(), ' ', '_'); theDumper << "_" << aGeometryNamePy; } theDumper << ")" << std::endl; - } - else { + } else { std::string aFilePath; if (aFormat == "STEP" || aFormat == "STP") { - aFilePath = aBase->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID())->value(); + aFilePath = + aBase->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID()) + ->value(); } else { - aFilePath = aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID())->value(); + aFilePath = + aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID())->value(); } std::string aFrom = "\\"; std::string aTo = "\\\\"; - for (std::size_t aPos = aFilePath.find(aFrom); - aPos != std::string::npos; + for (std::size_t aPos = aFilePath.find(aFrom); aPos != std::string::npos; aPos = aFilePath.find(aFrom, aPos)) { aFilePath.replace(aPos, aFrom.size(), aTo); aPos += aTo.size(); } - std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath); + std::string anExtension = + GeomAlgoAPI_Tools::File_Tools::extension(aFilePath); if (anExtension == "STP" || anExtension == "STEP") { theDumper << aBase << " = model.addImportSTEP(" << aPartName << ", \"" - << aFilePath << "\"" ; + << aFilePath << "\""; - theDumper << ", " << scalInterUnits()->value() - << ", " << materials()->value() - << ", " << colors()->value() << ")"<< std::endl; - } - else { + theDumper << ", " << scalInterUnits()->value() << ", " + << materials()->value() << ", " << colors()->value() << ")" + << std::endl; + } else { theDumper << aBase << " = model.addImport(" << aPartName << ", \"" << aFilePath << "\")" << std::endl; } @@ -169,50 +161,47 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const theDumper << "model.do()" << std::endl; CompositeFeaturePtr aCompositeFeature = - std::dynamic_pointer_cast(aBase); + std::dynamic_pointer_cast(aBase); if (aCompositeFeature.get()) { int aNbOfSubs = aCompositeFeature->numberOfSubs(); - for(int anIndex = 0; anIndex < aNbOfSubs; ++anIndex) { - std::string aSubFeatureGet = - theDumper.name(aBase) + ".subFeature(" + std::to_string((long long)anIndex) + ")"; - theDumper.dumpSubFeatureNameAndColor(aSubFeatureGet, aCompositeFeature->subFeature(anIndex)); + for (int anIndex = 0; anIndex < aNbOfSubs; ++anIndex) { + std::string aSubFeatureGet = theDumper.name(aBase) + ".subFeature(" + + std::to_string((long long)anIndex) + ")"; + theDumper.dumpSubFeatureNameAndColor( + aSubFeatureGet, aCompositeFeature->subFeature(anIndex)); } } } //-------------------------------------------------------------------------------------- -ImportPtr addImport( - const std::shared_ptr & thePart, - const std::string & theFilePath) -{ - std::shared_ptr aFeature = thePart->addFeature(ExchangeAPI_Import::ID()); +ImportPtr addImport(const std::shared_ptr &thePart, + const std::string &theFilePath) { + std::shared_ptr aFeature = + thePart->addFeature(ExchangeAPI_Import::ID()); return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath)); } -ImportPtr addImportXAOMem(const std::shared_ptr & thePart, - PyObject* theBuffer) -{ - std::shared_ptr aFeature = thePart->addFeature(ExchangeAPI_Import::ID()); - std::string aString (PyBytes_AsString(theBuffer)); +ImportPtr addImportXAOMem(const std::shared_ptr &thePart, + PyObject *theBuffer) { + std::shared_ptr aFeature = + thePart->addFeature(ExchangeAPI_Import::ID()); + std::string aString(PyBytes_AsString(theBuffer)); return ImportPtr(new ExchangeAPI_Import(aFeature, "", aString)); } -ImportPtr addImportSTEP( - const std::shared_ptr & thePart, - const std::string & theFilePath, - const bool theScalInterUnits, - const bool theMaterials, - const bool theColor ) -{ - std::shared_ptr aFeature = thePart->addFeature(ExchangeAPI_Import::ID()); - return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath, - theScalInterUnits, theMaterials, theColor)); +ImportPtr addImportSTEP(const std::shared_ptr &thePart, + const std::string &theFilePath, + const bool theScalInterUnits, const bool theMaterials, + const bool theColor) { + std::shared_ptr aFeature = + thePart->addFeature(ExchangeAPI_Import::ID()); + return ImportPtr(new ExchangeAPI_Import( + aFeature, theFilePath, theScalInterUnits, theMaterials, theColor)); } -void importPart(const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Reference & theAfterThis) -{ +void importPart(const std::shared_ptr &thePart, + const std::string &theFilePath, + const ModelHighAPI_Reference &theAfterThis) { static const bool THE_VISIBLE_FEATURE = false; FeaturePtr aCurrentFeature; if (theAfterThis.feature()) { @@ -221,24 +210,26 @@ void importPart(const std::shared_ptr & thePart, } FeaturePtr aFeature = thePart->addFeature(ExchangePlugin_ImportPart::ID()); - aFeature->string(ExchangePlugin_ImportPart::FILE_PATH_ID())->setValue(theFilePath); + aFeature->string(ExchangePlugin_ImportPart::FILE_PATH_ID()) + ->setValue(theFilePath); // specify the ID of selected document int aTargetPartIndex = 0; SessionPtr aSession = ModelAPI_Session::get(); if (aSession->moduleDocument() == thePart) { - // Importing to PartSet has 2 choices: import directly to PartSet (if possible) - // or create a new part. Because then importing to existing part the document - // has to be specified explicitly. - // As a result, parse the list of possible target documents and generate new part - // if the import document is not applicable on PartSet level - // (there is no 'PartSet' in the list of applicable documents). - AttributeStringArrayPtr aDocsList = - aFeature->stringArray(ExchangePlugin_ImportPart::TARGET_PARTS_LIST_ID()); + // Importing to PartSet has 2 choices: import directly to PartSet (if + // possible) or create a new part. Because then importing to existing part + // the document has to be specified explicitly. As a result, parse the list + // of possible target documents and generate new part if the import document + // is not applicable on PartSet level (there is no 'PartSet' in the list of + // applicable documents). + AttributeStringArrayPtr aDocsList = aFeature->stringArray( + ExchangePlugin_ImportPart::TARGET_PARTS_LIST_ID()); if (aDocsList->size() > 1 && aDocsList->value(1) == "PartSet") aTargetPartIndex = 1; } - aFeature->integer(ExchangePlugin_ImportPart::TARGET_PART_ID())->setValue(aTargetPartIndex); + aFeature->integer(ExchangePlugin_ImportPart::TARGET_PART_ID()) + ->setValue(aTargetPartIndex); // restart transaction to execute and delete the macro-feature apply(); @@ -252,42 +243,38 @@ void importPart(const std::shared_ptr & thePart, //------------------------------------------------------------------------------------------------- ExchangeAPI_Import_Image::ExchangeAPI_Import_Image( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } ExchangeAPI_Import_Image::ExchangeAPI_Import_Image( - const std::shared_ptr & theFeature, - const std::string & theFilePath) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::string &theFilePath) + : ModelHighAPI_Interface(theFeature) { if (initialize()) setFilePath(theFilePath); } -void ExchangeAPI_Import_Image::setFilePath(const std::string & theFilePath) -{ +void ExchangeAPI_Import_Image::setFilePath(const std::string &theFilePath) { fillAttribute(theFilePath, myfilePath); execute(); } -ImportImagePtr addImportImage( - const std::shared_ptr & thePart, - const std::string & theFilePath) -{ - std::shared_ptr aFeature = thePart->addFeature(ExchangeAPI_Import_Image::ID()); +ImportImagePtr addImportImage(const std::shared_ptr &thePart, + const std::string &theFilePath) { + std::shared_ptr aFeature = + thePart->addFeature(ExchangeAPI_Import_Image::ID()); return ImportImagePtr(new ExchangeAPI_Import_Image(aFeature, theFilePath)); } -void ExchangeAPI_Import_Image::dump(ModelHighAPI_Dumper& theDumper) const -{ +void ExchangeAPI_Import_Image::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); std::string aFilePath = - aBase->string(ExchangePlugin_Import_ImageFeature::FILE_PATH_ID())->value(); + aBase->string(ExchangePlugin_Import_ImageFeature::FILE_PATH_ID()) + ->value(); // store image into a new file near the dumped python script ResultPtr aResult = aBase->firstResult(); @@ -298,20 +285,20 @@ void ExchangeAPI_Import_Image::dump(ModelHighAPI_Dumper& theDumper) const std::string aFormat; std::list aByteList; AttributeImagePtr anImageAttr = - aResult->data()->image(ModelAPI_ResultBody::IMAGE_ID()); + aResult->data()->image(ModelAPI_ResultBody::IMAGE_ID()); anImageAttr->texture(aWidth, aHeight, aByteList, aFormat); // convert image data to QPixmap - uchar* arr = new uchar[aByteList.size()]; + uchar *arr = new uchar[aByteList.size()]; std::copy(aByteList.begin(), aByteList.end(), arr); - QImage image (arr, aWidth, aHeight, QImage::Format_ARGB32); - QPixmap pixmap = QPixmap::fromImage( image ); + QImage image(arr, aWidth, aHeight, QImage::Format_ARGB32); + QPixmap pixmap = QPixmap::fromImage(image); // get new file name std::wstring aName = aBase->name(); - std::string anImageName (aName.begin(), aName.end()); + std::string anImageName(aName.begin(), aName.end()); std::string aNewImageFile = anImageName + "." + aFormat; - QFileInfo aNewFileInfo (QDir(aNewImageDir.c_str()), aNewImageFile.c_str()); + QFileInfo aNewFileInfo(QDir(aNewImageDir.c_str()), aNewImageFile.c_str()); for (int ii = 1; QFile::exists(aNewFileInfo.absoluteFilePath()); ii++) { // construct the new file name by adding the unique number aNewImageFile = anImageName + "_" + std::to_string(ii) + "." + aFormat; @@ -323,7 +310,7 @@ void ExchangeAPI_Import_Image::dump(ModelHighAPI_Dumper& theDumper) const // to dump new file name aFilePath = aNewFileInfo.absoluteFilePath().toStdString(); } - delete [] arr; + delete[] arr; } theDumper << aBase << " = model.addImportImage(" << aPartName << ", \"" diff --git a/src/ExchangeAPI/ExchangeAPI_Import.h b/src/ExchangeAPI/ExchangeAPI_Import.h index 76262f8e3..df5095dc7 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.h +++ b/src/ExchangeAPI/ExchangeAPI_Import.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_ @@ -39,65 +40,63 @@ * \ingroup CPPHighAPI * \brief Interface for Import feature */ -class ExchangeAPI_Import : public ModelHighAPI_Interface -{ +class ExchangeAPI_Import : public ModelHighAPI_Interface { public: /// Constructor without values EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Import(const std::shared_ptr & theFeature); + explicit ExchangeAPI_Import( + const std::shared_ptr &theFeature); /// Constructor with values EXCHANGEAPI_EXPORT - ExchangeAPI_Import(const std::shared_ptr & theFeature, - const std::string & theFilePath); + ExchangeAPI_Import(const std::shared_ptr &theFeature, + const std::string &theFilePath); /// Constructor with values for XAO import from memory buffer EXCHANGEAPI_EXPORT - ExchangeAPI_Import(const std::shared_ptr & theFeature, - const std::string & theFilePath, - const std::string & theBuffer); + ExchangeAPI_Import(const std::shared_ptr &theFeature, + const std::string &theFilePath, + const std::string &theBuffer); /// Constructor with values for Step file EXCHANGEAPI_EXPORT - ExchangeAPI_Import(const std::shared_ptr & theFeature, - const std::string & theFilePath, - const bool theScalInterUnits, - const bool theMaterials, - const bool theColor); + ExchangeAPI_Import(const std::shared_ptr &theFeature, + const std::string &theFilePath, + const bool theScalInterUnits, const bool theMaterials, + const bool theColor); /// Destructor EXCHANGEAPI_EXPORT virtual ~ExchangeAPI_Import(); - INTERFACE_7(ExchangePlugin_ImportFeature::ID(), - filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(), - ModelAPI_AttributeString, /** File path */, - importType, ExchangePlugin_ImportFeature::IMPORT_TYPE_ID(), - ModelAPI_AttributeString, /**import type */, - stepFilePath, ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID(), - ModelAPI_AttributeString, /**step File path */, - scalInterUnits, ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID(), + INTERFACE_7(ExchangePlugin_ImportFeature::ID(), filePath, + ExchangePlugin_ImportFeature::FILE_PATH_ID(), + ModelAPI_AttributeString, /** File path */, importType, + ExchangePlugin_ImportFeature::IMPORT_TYPE_ID(), + ModelAPI_AttributeString, /**import type */, stepFilePath, + ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID(), + ModelAPI_AttributeString, /**step File path */, scalInterUnits, + ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID(), ModelAPI_AttributeBoolean, /** Scale internationals units */, materials, ExchangePlugin_ImportFeature::STEP_MATERIALS_ID(), - ModelAPI_AttributeBoolean, /** Materials */, - colors, ExchangePlugin_ImportFeature::STEP_COLORS_ID(), - ModelAPI_AttributeBoolean, /** Colors */, - memoryBuffer, ExchangePlugin_ImportFeature::MEMORY_BUFFER_ID(), + ModelAPI_AttributeBoolean, /** Materials */, colors, + ExchangePlugin_ImportFeature::STEP_COLORS_ID(), + ModelAPI_AttributeBoolean, /** Colors */, memoryBuffer, + ExchangePlugin_ImportFeature::MEMORY_BUFFER_ID(), ModelAPI_AttributeString, /** Bytes */ ) /// Set point values EXCHANGEAPI_EXPORT - void setFilePath(const std::string & theFilePath); + void setFilePath(const std::string &theFilePath); EXCHANGEAPI_EXPORT - void setParameters(const std::string & theFilePath, - const bool theScalInterUnits, - const bool theMaterials, + void setParameters(const std::string &theFilePath, + const bool theScalInterUnits, const bool theMaterials, const bool theColor); /// Dump wrapped feature EXCHANGEAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Import object @@ -107,34 +106,33 @@ typedef std::shared_ptr ImportPtr; * \brief Create Import feature */ EXCHANGEAPI_EXPORT -ImportPtr addImport(const std::shared_ptr & thePart, - const std::string & theFilePath); +ImportPtr addImport(const std::shared_ptr &thePart, + const std::string &theFilePath); /**\ingroup CPPHighAPI * \brief Create Import feature to import XAO data from bytes buffer */ EXCHANGEAPI_EXPORT -ImportPtr addImportXAOMem(const std::shared_ptr & thePart, - PyObject* theBuffer); +ImportPtr addImportXAOMem(const std::shared_ptr &thePart, + PyObject *theBuffer); /**\ingroup CPPHighAPI * \brief Create Import Step feature */ EXCHANGEAPI_EXPORT -ImportPtr addImportSTEP(const std::shared_ptr & thePart, - const std::string & theFilePath, - const bool theScalInterUnits, - const bool theMaterials, +ImportPtr addImportSTEP(const std::shared_ptr &thePart, + const std::string &theFilePath, + const bool theScalInterUnits, const bool theMaterials, const bool theColor); - /** \ingroup CPPHighAPI - * \brief Import features from the file to the document after the current feature (or to the end). + * \brief Import features from the file to the document after the current + * feature (or to the end). */ EXCHANGEAPI_EXPORT void importPart( - const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Reference & theAfterThis = ModelHighAPI_Reference()); + const std::shared_ptr &thePart, + const std::string &theFilePath, + const ModelHighAPI_Reference &theAfterThis = ModelHighAPI_Reference()); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- @@ -142,43 +140,41 @@ EXCHANGEAPI_EXPORT void importPart( * \ingroup CPPHighAPI * \brief Interface for Import feature */ -class ExchangeAPI_Import_Image : public ModelHighAPI_Interface -{ +class ExchangeAPI_Import_Image : public ModelHighAPI_Interface { public: /// Constructor without values EXCHANGEAPI_EXPORT - explicit ExchangeAPI_Import_Image(const std::shared_ptr & theFeature); + explicit ExchangeAPI_Import_Image( + const std::shared_ptr &theFeature); /// Constructor with values EXCHANGEAPI_EXPORT - ExchangeAPI_Import_Image(const std::shared_ptr & theFeature, - const std::string & theFilePath); + ExchangeAPI_Import_Image(const std::shared_ptr &theFeature, + const std::string &theFilePath); /// Destructor EXCHANGEAPI_EXPORT virtual ~ExchangeAPI_Import_Image() = default; - INTERFACE_1(ExchangePlugin_Import_ImageFeature::ID(), - filePath, ExchangePlugin_Import_ImageFeature::FILE_PATH_ID(), + INTERFACE_1(ExchangePlugin_Import_ImageFeature::ID(), filePath, + ExchangePlugin_Import_ImageFeature::FILE_PATH_ID(), ModelAPI_AttributeString, /** File path */ ) /// Set point values EXCHANGEAPI_EXPORT - void setFilePath(const std::string & theFilePath); + void setFilePath(const std::string &theFilePath); /// Dump wrapped feature EXCHANGEAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; - + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Import object typedef std::shared_ptr ImportImagePtr; - EXCHANGEAPI_EXPORT -ImportImagePtr addImportImage(const std::shared_ptr & thePart, - const std::string & theFilePath); +ImportImagePtr addImportImage(const std::shared_ptr &thePart, + const std::string &theFilePath); //-------------------------------------------------------------------------------------- #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_ */ diff --git a/src/ExchangeAPI/ExchangeAPI_swig.h b/src/ExchangeAPI/ExchangeAPI_swig.h index 6b68aedb5..30d3d829a 100644 --- a/src/ExchangeAPI/ExchangeAPI_swig.h +++ b/src/ExchangeAPI/ExchangeAPI_swig.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_SWIG_H_ #define SRC_EXCHANGEAPI_EXCHANGEAPI_SWIG_H_ - #include +#include - #include "ExchangeAPI.h" - #include "ExchangeAPI_Export.h" - #include "ExchangeAPI_Import.h" +#include "ExchangeAPI.h" +#include "ExchangeAPI_Export.h" +#include "ExchangeAPI_Import.h" #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_SWIG_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin.h b/src/ExchangePlugin/ExchangePlugin.h index 0967ce359..a1fac4976 100644 --- a/src/ExchangePlugin/ExchangePlugin.h +++ b/src/ExchangePlugin/ExchangePlugin.h @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_H #define EXCHANGEPLUGIN_H #if defined EXCHANGEPLUGIN_EXPORTS -# if defined WIN32 -# define EXCHANGEPLUGIN_EXPORT __declspec( dllexport ) -# else -# define EXCHANGEPLUGIN_EXPORT -# endif +#if defined WIN32 +#define EXCHANGEPLUGIN_EXPORT __declspec(dllexport) #else -# if defined WIN32 -# define EXCHANGEPLUGIN_EXPORT __declspec( dllimport ) -# else -# define EXCHANGEPLUGIN_EXPORT -# endif +#define EXCHANGEPLUGIN_EXPORT +#endif +#else +#if defined WIN32 +#define EXCHANGEPLUGIN_EXPORT __declspec(dllimport) +#else +#define EXCHANGEPLUGIN_EXPORT +#endif #endif #endif diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index 7ac28dd09..3e4b89081 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,8 +23,8 @@ #include #include #include -#include #include +#include #include #include @@ -50,25 +51,23 @@ static const bool THE_DUMP_WEAK = true; static const bool THE_DUMP_WEAK = false; #endif +ExchangePlugin_Dump::ExchangePlugin_Dump() {} -ExchangePlugin_Dump::ExchangePlugin_Dump() -{ -} - -ExchangePlugin_Dump::~ExchangePlugin_Dump() -{ -} +ExchangePlugin_Dump::~ExchangePlugin_Dump() {} -void ExchangePlugin_Dump::initAttributes() -{ +void ExchangePlugin_Dump::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(TOPOLOGICAL_NAMING_DUMP_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(GEOMETRIC_DUMP_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(WEAK_NAMING_DUMP_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(TOPOLOGICAL_NAMING_DUMP_ID(), + ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(GEOMETRIC_DUMP_ID(), + ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(WEAK_NAMING_DUMP_ID(), + ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(EXPORT_VARIABLES_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(EXPORT_VARIABLES_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(DUMP_DIR_ID(), ModelAPI_AttributeString::typeId()); @@ -78,11 +77,11 @@ void ExchangePlugin_Dump::initAttributes() boolean(WEAK_NAMING_DUMP_ID())->setValue(THE_DUMP_WEAK); boolean(EXPORT_VARIABLES_ID())->setValue(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), DUMP_DIR_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + DUMP_DIR_ID()); } -void ExchangePlugin_Dump::execute() -{ +void ExchangePlugin_Dump::execute() { AttributeStringPtr aFilePathAttr = this->string(ExchangePlugin_Dump::FILE_PATH_ID()); std::string aFilePath = aFilePathAttr->value(); @@ -92,42 +91,42 @@ void ExchangePlugin_Dump::execute() dump(aFilePath); } -void ExchangePlugin_Dump::dump(const std::string& theFileName) -{ +void ExchangePlugin_Dump::dump(const std::string &theFileName) { // load DumpAssistant from Python side Config_ModuleReader::loadScript("salome.shaper.model.dump"); DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument(); int aFeaturesNb = aDoc->size(ModelAPI_Feature::group()); - if(aFeaturesNb > 1) { - FeaturePtr aLastFeature = - ModelAPI_Feature::feature(aDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); - if(aDoc->currentFeature(true) != aLastFeature) { - setError("Dump cannot be done. Please move the history line to the end before dumping."); - return; + if (aFeaturesNb > 1) { + FeaturePtr aLastFeature = ModelAPI_Feature::feature( + aDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); + if (aDoc->currentFeature(true) != aLastFeature) { + setError("Dump cannot be done. Please move the history line to the end " + "before dumping."); + return; } } DocumentPtr anActiveDoc = ModelAPI_Session::get()->activeDocument(); aFeaturesNb = anActiveDoc->size(ModelAPI_Feature::group()); - if(aFeaturesNb > 1) { - FeaturePtr aLastFeature = - ModelAPI_Feature::feature(anActiveDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); - if(anActiveDoc->currentFeature(true) != aLastFeature) { - setError("Dump cannot be done. Please move the history line to the end before dumping."); + if (aFeaturesNb > 1) { + FeaturePtr aLastFeature = ModelAPI_Feature::feature( + anActiveDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); + if (anActiveDoc->currentFeature(true) != aLastFeature) { + setError("Dump cannot be done. Please move the history line to the end " + "before dumping."); return; } } std::list aFeatures = aDoc->allFeatures(); - for(std::list::const_iterator aFeatIt = aFeatures.begin(); - aFeatIt != aFeatures.end(); - ++aFeatIt) { - ResultPartPtr aResultPart = - std::dynamic_pointer_cast((*aFeatIt)->firstResult()); - if(aResultPart.get()) { - if(!aResultPart->isActivated()) { + for (std::list::const_iterator aFeatIt = aFeatures.begin(); + aFeatIt != aFeatures.end(); ++aFeatIt) { + ResultPartPtr aResultPart = std::dynamic_pointer_cast( + (*aFeatIt)->firstResult()); + if (aResultPart.get()) { + if (!aResultPart->isActivated()) { setError("Error: Not all parts are loaded. Can not dump."); return; } @@ -135,23 +134,22 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) } // process selected types of the dump - ModelHighAPI_Dumper* aDumper = ModelHighAPI_Dumper::getInstance(); + ModelHighAPI_Dumper *aDumper = ModelHighAPI_Dumper::getInstance(); if (!aDumper) setError("An error occured while dumping to " + theFileName); static const int THE_TYPES_SIZE = 3; - bool aTypes[THE_TYPES_SIZE] = { - boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value(), - boolean(GEOMETRIC_DUMP_ID())->value(), - boolean(WEAK_NAMING_DUMP_ID())->value() - }; + bool aTypes[THE_TYPES_SIZE] = {boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value(), + boolean(GEOMETRIC_DUMP_ID())->value(), + boolean(WEAK_NAMING_DUMP_ID())->value()}; int aNbSelectedTypes = 0; for (int i = 0; i < THE_TYPES_SIZE; ++i) if (aTypes[i]) ++aNbSelectedTypes; if (boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value()) { - ModelHighAPI_Dumper::DumpStoragePtr aTopoNameStorage(new ModelHighAPI_Dumper::DumpStorage); + ModelHighAPI_Dumper::DumpStoragePtr aTopoNameStorage( + new ModelHighAPI_Dumper::DumpStorage); aDumper->addCustomStorage(aTopoNameStorage); } if (boolean(GEOMETRIC_DUMP_ID())->value()) { @@ -171,7 +169,7 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) // pass dump directory to the dumper AttributeStringPtr aDumpDirAttr = - this->string(ExchangePlugin_Dump::DUMP_DIR_ID()); + this->string(ExchangePlugin_Dump::DUMP_DIR_ID()); std::string aDumpDir; if (aDumpDirAttr.get() && aDumpDirAttr->isInitialized()) aDumpDir = aDumpDirAttr->value(); @@ -188,5 +186,4 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) } // clear cashed data after export variables was performed aDumper->clearCustomStorage(); - } diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.h b/src/ExchangePlugin/ExchangePlugin_Dump.h index 28157c701..3a31cf1c7 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.h +++ b/src/ExchangePlugin/ExchangePlugin_Dump.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_DUMP_H_ @@ -29,57 +30,49 @@ * \ingroup Plugins * \brief Store full model as a Python script */ -class ExchangePlugin_Dump : public ModelAPI_Feature -{ +class ExchangePlugin_Dump : public ModelAPI_Feature { public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_DUMP_ID("Dump"); return MY_DUMP_ID; } /// attribute name of true dumping directory - inline static const std::string& DUMP_DIR_ID() - { + inline static const std::string &DUMP_DIR_ID() { static const std::string MY_DUMP_DIR_ID("dump_dir"); return MY_DUMP_DIR_ID; } /// attribute name of file path - inline static const std::string& FILE_PATH_ID() - { + inline static const std::string &FILE_PATH_ID() { static const std::string MY_FILE_PATH_ID("file_path"); return MY_FILE_PATH_ID; } /// attribute name of file format - inline static const std::string& FILE_FORMAT_ID() - { + inline static const std::string &FILE_FORMAT_ID() { static const std::string MY_FILE_FORMAT_ID("file_format"); return MY_FILE_FORMAT_ID; } /// attribute name of dumping by topological naming - inline static const std::string& TOPOLOGICAL_NAMING_DUMP_ID() - { + inline static const std::string &TOPOLOGICAL_NAMING_DUMP_ID() { static const std::string MY_TOOPNAMING_DUMP_ID("topological_naming"); return MY_TOOPNAMING_DUMP_ID; } /// attribute name of dumping by geometric selection - inline static const std::string& GEOMETRIC_DUMP_ID() - { + inline static const std::string &GEOMETRIC_DUMP_ID() { static const std::string MY_GEOM_DUMP_ID("geometric_selection"); return MY_GEOM_DUMP_ID; } /// attribute name of dumping by using weak naming identifiers of selection - inline static const std::string& WEAK_NAMING_DUMP_ID() - { + inline static const std::string &WEAK_NAMING_DUMP_ID() { static const std::string MY_WEAK_NAMING_DUMP_ID("weak_naming"); return MY_WEAK_NAMING_DUMP_ID; } - /// attribute name for boolean flag to export variable names correspondence to another module - inline static const std::string& EXPORT_VARIABLES_ID() - { + /// attribute name for boolean flag to export variable names correspondence to + /// another module + inline static const std::string &EXPORT_VARIABLES_ID() { static const std::string MY_EXPORT_VARIABLES_ID("export_variables"); return MY_EXPORT_VARIABLES_ID; } @@ -90,12 +83,12 @@ public: EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Dump(); /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { return ExchangePlugin_Dump::ID(); } - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Computes or recomputes the results @@ -109,7 +102,7 @@ public: protected: /// Performs dump to the file - EXCHANGEPLUGIN_EXPORT void dump(const std::string& theFileName); + EXCHANGEPLUGIN_EXPORT void dump(const std::string &theFileName); }; #endif diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index ca1a2e4dd..94cd7b882 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -44,96 +45,94 @@ #include +#include +#include +#include #include #include #include -#include #include -#include -#include #include #include #include #include -#include -#include #include +#include +#include #include -#include #include +#include #include -#include #include -#include #include +#include +#include #include -ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature() -{ -} +ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature() {} -ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature() -{ +ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature() { // TODO Auto-generated destructor stub } /* - * Request for initialization of data model of the feature: adding all attributes + * Request for initialization of data model of the feature: adding all + * attributes */ -void ExchangePlugin_ExportFeature::initAttributes() -{ +void ExchangePlugin_ExportFeature::initAttributes() { data()->addAttribute(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::FILE_PATH_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), - ModelAPI_AttributeSelectionList::typeId()); + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID(), - ModelAPI_AttributeSelectionList::typeId()); + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(), - ModelAPI_AttributeSelection::typeId()); + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_RELATIVE(), - ModelAPI_AttributeDouble::typeId()); + ModelAPI_AttributeDouble::typeId()); - double defelection = Config_PropManager::real("Visualization", "body_deflection"); + double defelection = + Config_PropManager::real("Visualization", "body_deflection"); real(ExchangePlugin_ExportFeature::STL_RELATIVE())->setValue(defelection); data()->addAttribute(ExchangePlugin_ExportFeature::STL_ABSOLUTE(), - ModelAPI_AttributeDouble::typeId()); + ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE(), - ModelAPI_AttributeString::typeId()); + ModelAPI_AttributeString::typeId()); // export to memory buffer (implemented for XAO format only) data()->addAttribute(ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID(), ModelAPI_AttributeString::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ExchangePlugin_ExportFeature::STL_FILE_PATH_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ExchangePlugin_ExportFeature::XAO_AUTHOR_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ExchangePlugin_ExportFeature::STL_FILE_PATH_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ExchangePlugin_ExportFeature::XAO_AUTHOR_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID()); // to support previous version of document, move the selection list // if the type of export operation is XAO @@ -142,7 +141,8 @@ void ExchangePlugin_ExportFeature::initAttributes() (aTypeAttr->value() == "XAO" || aTypeAttr->value() == "XAOMem")) { bool aWasBlocked = data()->blockSendAttributeUpdated(true, false); AttributeSelectionListPtr aSelList = selectionList(SELECTION_LIST_ID()); - AttributeSelectionListPtr aXAOSelList = selectionList(XAO_SELECTION_LIST_ID()); + AttributeSelectionListPtr aXAOSelList = + selectionList(XAO_SELECTION_LIST_ID()); if (aSelList->size() > 0 && aXAOSelList->size() == 0) aSelList->copyTo(aXAOSelList); aSelList->clear(); @@ -150,23 +150,22 @@ void ExchangePlugin_ExportFeature::initAttributes() } } -void ExchangePlugin_ExportFeature::attributeChanged(const std::string& theID) -{ +void ExchangePlugin_ExportFeature::attributeChanged(const std::string &theID) { if (theID == XAO_FILE_PATH_ID()) { - string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue( - string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value()); - } - else if (theID == STL_FILE_PATH_ID()) { - string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue( - string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())->value()); + string(ExchangePlugin_ExportFeature::FILE_PATH_ID()) + ->setValue( + string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value()); + } else if (theID == STL_FILE_PATH_ID()) { + string(ExchangePlugin_ExportFeature::FILE_PATH_ID()) + ->setValue( + string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())->value()); } } /* * Computes or recomputes the results */ -void ExchangePlugin_ExportFeature::execute() -{ +void ExchangePlugin_ExportFeature::execute() { AttributeStringPtr aFormatAttr = this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()); std::string aFormat = aFormatAttr->value(); @@ -185,17 +184,18 @@ void ExchangePlugin_ExportFeature::execute() exportFile(aFilePath, aFormat, isMemoryExport); } -void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, - const std::string& theFormat, - const bool isMemoryExport) -{ +void ExchangePlugin_ExportFeature::exportFile(const std::string &theFileName, + const std::string &theFormat, + const bool isMemoryExport) { std::string aFormatName = theFormat; if (aFormatName.empty()) { // get default format for the extension - if (isMemoryExport) return; + if (isMemoryExport) + return; // ".brep" -> "BREP" - std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName); + std::string anExtension = + GeomAlgoAPI_Tools::File_Tools::extension(theFileName); if (anExtension == "BREP" || anExtension == "BRP") { aFormatName = "BREP"; } else if (anExtension == "STEP" || anExtension == "STP") { @@ -225,15 +225,14 @@ void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, /// do not export pictures ResultPtr aBodyContext = - std::dynamic_pointer_cast(anAttrSelection->context()); + std::dynamic_pointer_cast(anAttrSelection->context()); if (aBodyContext.get() && aBodyContext->hasTexture()) continue; std::shared_ptr aCurShape = anAttrSelection->value(); if (aCurShape.get() == NULL) aCurShape = anAttrSelection->context()->shape(); - if (aCurShape.get() != NULL) - { + if (aCurShape.get() != NULL) { aShapes.push_back(aCurShape); aContexts.push_back(anAttrSelection->context()); } @@ -241,7 +240,8 @@ void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, // Store compound if we have more than one shape. std::shared_ptr aShape = - aShapes.size() == 1 ? aShapes.front() : GeomAlgoAPI_CompoundBuilder::compound(aShapes); + aShapes.size() == 1 ? aShapes.front() + : GeomAlgoAPI_CompoundBuilder::compound(aShapes); // Perform the export std::string anError; @@ -257,35 +257,35 @@ void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, } if (!aResult || !anError.empty()) { - setError("An error occurred while exporting " + theFileName + ": " + anError); + setError("An error occurred while exporting " + theFileName + ": " + + anError); return; } } /// Returns XAO string by the value from the table -static std::string valToString(const ModelAPI_AttributeTables::Value& theVal, - const ModelAPI_AttributeTables::ValueType& theType) -{ +static std::string +valToString(const ModelAPI_AttributeTables::Value &theVal, + const ModelAPI_AttributeTables::ValueType &theType) { std::ostringstream aStr; // the resulting string value - switch(theType) { + switch (theType) { case ModelAPI_AttributeTables::BOOLEAN: - aStr<<(theVal.myBool ? "true" : "false"); + aStr << (theVal.myBool ? "true" : "false"); break; case ModelAPI_AttributeTables::INTEGER: - aStr<value(); @@ -298,7 +298,8 @@ void ExchangePlugin_ExportFeature::exportSTL(const std::string& theFileName) bool anIsRelative = false; bool anIsASCII = false; - if (string(STL_DEFLECTION_TYPE())->value() == STL_DEFLECTION_TYPE_RELATIVE()) { + if (string(STL_DEFLECTION_TYPE())->value() == + STL_DEFLECTION_TYPE_RELATIVE()) { aValue = real(STL_RELATIVE())->value(); anIsRelative = true; } else { @@ -312,307 +313,336 @@ void ExchangePlugin_ExportFeature::exportSTL(const std::string& theFileName) std::string anError; bool aResult = false; - aResult = STLExport(theFileName, - aShape, - aValue, - anIsRelative, - anIsASCII, - anError); + aResult = + STLExport(theFileName, aShape, aValue, anIsRelative, anIsASCII, anError); if (!aResult || !anError.empty()) { - setError("An error occurred while exporting " + theFileName + ": " + anError); + setError("An error occurred while exporting " + theFileName + ": " + + anError); return; } } - -void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName, - const bool isMemoryExport) -{ +void ExchangePlugin_ExportFeature::exportXAO(const std::string &theFileName, + const bool isMemoryExport) { try { - std::string anError; - XAO::Xao aXao; - - // author - - std::string anAuthor = string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value(); - aXao.setAuthor(anAuthor); - - // make shape for export from all results - std::list aShapes; - std::list aResults; - std::list aDocuments; /// documents of Parts selected and used in export - std::map aDocTrsf; /// translation of the part - - bool anExCludedIsImage = false; - AttributeSelectionListPtr aSelection = selectionList(XAO_SELECTION_LIST_ID()); - bool aIsSelection = aSelection->isInitialized() && aSelection->size() > 0; - if (aIsSelection) { // a mode for export to geom result by result - for (int a = 0; a < aSelection->size(); a++) { - AttributeSelectionPtr anAttr = aSelection->value(a); - ResultPtr aBodyContext = - std::dynamic_pointer_cast(anAttr->context()); - if (aBodyContext.get() && !aBodyContext->isDisabled() && aBodyContext->shape().get()) { + std::string anError; + XAO::Xao aXao; + + // author + + std::string anAuthor = + string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value(); + aXao.setAuthor(anAuthor); + + // make shape for export from all results + std::list aShapes; + std::list aResults; + std::list + aDocuments; /// documents of Parts selected and used in export + std::map aDocTrsf; /// translation of the part + + bool anExCludedIsImage = false; + AttributeSelectionListPtr aSelection = + selectionList(XAO_SELECTION_LIST_ID()); + bool aIsSelection = aSelection->isInitialized() && aSelection->size() > 0; + if (aIsSelection) { // a mode for export to geom result by result + for (int a = 0; a < aSelection->size(); a++) { + AttributeSelectionPtr anAttr = aSelection->value(a); + ResultPtr aBodyContext = + std::dynamic_pointer_cast(anAttr->context()); + if (aBodyContext.get() && !aBodyContext->isDisabled() && + aBodyContext->shape().get()) { /// do not export pictures - if (aBodyContext->hasTexture()){ + if (aBodyContext->hasTexture()) { anExCludedIsImage = true; continue; } - aResults.push_back(aBodyContext); - GeomShapePtr aShape = anAttr->value(); - if (!aShape.get()) - aShape = aBodyContext->shape(); - aShapes.push_back(aShape); - if (aBodyContext->groupName() == ModelAPI_ResultPart::group()) { - ResultPartPtr aResPart = std::dynamic_pointer_cast(aBodyContext); - DocumentPtr aPartDoc = aResPart->partDoc(); - if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible - std::string msg = "Can not export XAO for not loaded part"; - Events_InfoMessage("ExportFeature", msg, this).send(); - return; - } else { - aDocuments.push_back(aPartDoc); - aDocTrsf[aPartDoc] = aResPart->summaryTrsf(); + aResults.push_back(aBodyContext); + GeomShapePtr aShape = anAttr->value(); + if (!aShape.get()) + aShape = aBodyContext->shape(); + aShapes.push_back(aShape); + if (aBodyContext->groupName() == ModelAPI_ResultPart::group()) { + ResultPartPtr aResPart = + std::dynamic_pointer_cast(aBodyContext); + DocumentPtr aPartDoc = aResPart->partDoc(); + if (!aPartDoc.get() || + !aPartDoc->isOpened()) { // document is not accessible + std::string msg = "Can not export XAO for not loaded part"; + Events_InfoMessage("ExportFeature", msg, this).send(); + return; + } else { + aDocuments.push_back(aPartDoc); + aDocTrsf[aPartDoc] = aResPart->summaryTrsf(); + } } } } + } else { + int aBodyCount = document()->size(ModelAPI_ResultBody::group()); + for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) { + ResultBodyPtr aResultBody = + std::dynamic_pointer_cast( + document()->object(ModelAPI_ResultBody::group(), aBodyIndex)); + if (!aResultBody.get()) + continue; + aShapes.push_back(aResultBody->shape()); + aResults.push_back(aResultBody); + } } - } else { - int aBodyCount = document()->size(ModelAPI_ResultBody::group()); - for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) { - ResultBodyPtr aResultBody = - std::dynamic_pointer_cast( - document()->object(ModelAPI_ResultBody::group(), aBodyIndex)); - if (!aResultBody.get()) - continue; - aShapes.push_back(aResultBody->shape()); - aResults.push_back(aResultBody); + if (aShapes.empty()) { + if (!anExCludedIsImage) + setError("No shapes to export"); + return; } - } - if (aShapes.empty()) { - if(!anExCludedIsImage) - setError("No shapes to export"); - return; - } + GeomShapePtr aShape = (aShapes.size() == 1) + ? *aShapes.begin() + : GeomAlgoAPI_CompoundBuilder::compound(aShapes); - GeomShapePtr aShape = (aShapes.size() == 1) - ? *aShapes.begin() - : GeomAlgoAPI_CompoundBuilder::compound(aShapes); + SetShapeToXAO(aShape, &aXao, anError); - SetShapeToXAO(aShape, &aXao, anError); - - if (!anError.empty()) { - setError("An error occurred while exporting " + theFileName + ": " + anError); - return; - } - - // geometry name - std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value(); - if (aGeometryName.empty() && aResults.size() == 1) { - // get the name from the first result - ResultPtr aResultBody = *aResults.begin(); - aGeometryName = Locale::Convert::toString(aResultBody->data()->name()); - if (isMemoryExport) { - // for python dump - string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->setValue(aGeometryName); - // or - //data()->setName(Locale::Convert::toWString(aGeometryName)); + if (!anError.empty()) { + setError("An error occurred while exporting " + theFileName + ": " + + anError); + return; } - } - aXao.getGeometry()->setName(aGeometryName); - - std::set allResultsCashed; // cash to speed up searching in all results selected - - // iterate all documents used - if (aDocuments.empty()) - aDocuments.push_back(document()); - std::list::iterator aDoc = aDocuments.begin(); - for(; aDoc != aDocuments.end(); aDoc++) { - // groups - int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group()); - for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) { - ResultGroupPtr aResultGroup = std::dynamic_pointer_cast( - (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex)); - if (!aResultGroup.get() || !aResultGroup->shape().get()) - continue; - - FeaturePtr aGroupFeature = (*aDoc)->feature(aResultGroup); - - AttributeSelectionListPtr aSelectionList = - aGroupFeature->selectionList("group_list"); - if (!ModelAPI_Tools::isInResults(aSelectionList, - aResults, - allResultsCashed))// skip group not used in result - continue; - - // conversion of dimension - std::string aSelectionType = aSelectionList->selectionType(); - GeomAPI_Shape::ShapeType aSelType = GeomAPI_Shape::shapeTypeByStr(aSelectionType); - std::string aDimensionString = - ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType); - XAO::Dimension aGroupDimension = XAO::XaoUtils::stringToDimension(aDimensionString); - - XAO::Group* aXaoGroup = aXao.addGroup(aGroupDimension, - Locale::Convert::toString(aResultGroup->data()->name())); - - try { - GeomAPI_ShapeExplorer aGroupResExplorer(aResultGroup->shape(), aSelType); - for(; aGroupResExplorer.more(); aGroupResExplorer.next()) { - GeomShapePtr aGroupShape = aGroupResExplorer.current(); - if (aDocTrsf.find(*aDoc) != aDocTrsf.end()) - aGroupShape->move(aDocTrsf[*aDoc]); - int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aGroupShape); - if (aReferenceID == 0) // selected value does not found in the exported shape - continue; - std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID); - int anElementID = - aXao.getGeometry()->getElementIndexByReference(aGroupDimension, aReferenceString); - aXaoGroup->add(anElementID); - } - } catch (XAO::XAO_Exception& e) { - // LCOV_EXCL_START - std::string msg = "An error occurred while exporting group " + - Locale::Convert::toString(aResultGroup->data()->name()); - msg += ".\n"; - msg += e.what(); - msg += "\n"; - msg += "=> skipping this group from XAO export."; - Events_InfoMessage("ExportFeature", msg, this).send(); - aXao.removeGroup(aXaoGroup); - // LCOV_EXCL_STOP + // geometry name + std::string aGeometryName = + string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value(); + if (aGeometryName.empty() && aResults.size() == 1) { + // get the name from the first result + ResultPtr aResultBody = *aResults.begin(); + aGeometryName = Locale::Convert::toString(aResultBody->data()->name()); + if (isMemoryExport) { + // for python dump + string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()) + ->setValue(aGeometryName); + // or + // data()->setName(Locale::Convert::toWString(aGeometryName)); } } - // fields - int aFieldCount = (*aDoc)->size(ModelAPI_ResultField::group()); - for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) { - ResultFieldPtr aResultField = std::dynamic_pointer_cast( - (*aDoc)->object(ModelAPI_ResultField::group(), aFieldIndex)); - - FeaturePtr aFieldFeature = (*aDoc)->feature(aResultField); - - AttributeSelectionListPtr aSelectionList = - aFieldFeature->selectionList("selected"); - std::string aSelectionType = aSelectionList->selectionType(); - bool isWholePart = aSelectionType == "part"; - // skip field not used in results - if (!isWholePart && - !ModelAPI_Tools::isInResults(aSelectionList, aResults, allResultsCashed)) - continue; - - // conversion of dimension - std::string aDimensionString = - ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType); - XAO::Dimension aFieldDimension = XAO::XaoUtils::stringToDimension(aDimensionString); - // get tables and their type - std::shared_ptr aTables = aFieldFeature->tables("values"); - std::string aTypeString = ExchangePlugin_Tools::valuesType2xaoType(aTables->type()); - XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString); - - XAO::Field* aXaoField = aXao.addField(aFieldType, aFieldDimension, aTables->columns(), - Locale::Convert::toString(aResultField->data()->name())); - - - try { - // set components names - AttributeStringArrayPtr aComponents = aFieldFeature->stringArray("components_names"); - for(int aComp = 0; aComp < aComponents->size(); aComp++) { - std::string aName = aComponents->value(aComp); - aXaoField->setComponentName(aComp, aName); + aXao.getGeometry()->setName(aGeometryName); + + std::set + allResultsCashed; // cash to speed up searching in all results selected + + // iterate all documents used + if (aDocuments.empty()) + aDocuments.push_back(document()); + std::list::iterator aDoc = aDocuments.begin(); + for (; aDoc != aDocuments.end(); aDoc++) { + // groups + int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group()); + for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) { + ResultGroupPtr aResultGroup = + std::dynamic_pointer_cast( + (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex)); + if (!aResultGroup.get() || !aResultGroup->shape().get()) + continue; + + FeaturePtr aGroupFeature = (*aDoc)->feature(aResultGroup); + + AttributeSelectionListPtr aSelectionList = + aGroupFeature->selectionList("group_list"); + if (!ModelAPI_Tools::isInResults( + aSelectionList, aResults, + allResultsCashed)) // skip group not used in result + continue; + + // conversion of dimension + std::string aSelectionType = aSelectionList->selectionType(); + GeomAPI_Shape::ShapeType aSelType = + GeomAPI_Shape::shapeTypeByStr(aSelectionType); + std::string aDimensionString = + ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType); + XAO::Dimension aGroupDimension = + XAO::XaoUtils::stringToDimension(aDimensionString); + + XAO::Group *aXaoGroup = aXao.addGroup( + aGroupDimension, + Locale::Convert::toString(aResultGroup->data()->name())); + + try { + GeomAPI_ShapeExplorer aGroupResExplorer(aResultGroup->shape(), + aSelType); + for (; aGroupResExplorer.more(); aGroupResExplorer.next()) { + GeomShapePtr aGroupShape = aGroupResExplorer.current(); + if (aDocTrsf.find(*aDoc) != aDocTrsf.end()) + aGroupShape->move(aDocTrsf[*aDoc]); + int aReferenceID = + GeomAlgoAPI_CompoundBuilder::id(aShape, aGroupShape); + if (aReferenceID == + 0) // selected value does not found in the exported shape + continue; + std::string aReferenceString = + XAO::XaoUtils::intToString(aReferenceID); + int anElementID = aXao.getGeometry()->getElementIndexByReference( + aGroupDimension, aReferenceString); + aXaoGroup->add(anElementID); + } + } catch (XAO::XAO_Exception &e) { + // LCOV_EXCL_START + std::string msg = + "An error occurred while exporting group " + + Locale::Convert::toString(aResultGroup->data()->name()); + msg += ".\n"; + msg += e.what(); + msg += "\n"; + msg += "=> skipping this group from XAO export."; + Events_InfoMessage("ExportFeature", msg, this).send(); + aXao.removeGroup(aXaoGroup); + // LCOV_EXCL_STOP } + } - AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps"); - for (int aStepIndex = 0; aStepIndex < aTables->tables(); aStepIndex++) { - XAO::Step* aStep = aXaoField->addNewStep(aStepIndex + 1); - aStep->setStep(aStepIndex + 1); - int aStampIndex = aStamps->value(aStepIndex); - aStep->setStamp(aStampIndex); - int aNumElements = isWholePart ? aXaoField->countElements() : aTables->rows(); - int aNumComps = aTables->columns(); - std::set aFilledIDs; // to fill the rest by defaults - // omit default values first row - for(int aRow = isWholePart ? 0 : 1; aRow < aNumElements; aRow++) { - for(int aCol = 0; aCol < aNumComps; aCol++) { - int anElementID = 0; - if (!isWholePart) { - // element index actually is the ID of the selection - AttributeSelectionPtr aSel = aSelectionList->value(aRow - 1); - int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSel->value()); - if (aReferenceID == 0) // selected value does not found in the exported shape - continue; + // fields + int aFieldCount = (*aDoc)->size(ModelAPI_ResultField::group()); + for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) { + ResultFieldPtr aResultField = + std::dynamic_pointer_cast( + (*aDoc)->object(ModelAPI_ResultField::group(), aFieldIndex)); + + FeaturePtr aFieldFeature = (*aDoc)->feature(aResultField); + + AttributeSelectionListPtr aSelectionList = + aFieldFeature->selectionList("selected"); + std::string aSelectionType = aSelectionList->selectionType(); + bool isWholePart = aSelectionType == "part"; + // skip field not used in results + if (!isWholePart && !ModelAPI_Tools::isInResults( + aSelectionList, aResults, allResultsCashed)) + continue; + + // conversion of dimension + std::string aDimensionString = + ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType); + XAO::Dimension aFieldDimension = + XAO::XaoUtils::stringToDimension(aDimensionString); + // get tables and their type + std::shared_ptr aTables = + aFieldFeature->tables("values"); + std::string aTypeString = + ExchangePlugin_Tools::valuesType2xaoType(aTables->type()); + XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString); + + XAO::Field *aXaoField = aXao.addField( + aFieldType, aFieldDimension, aTables->columns(), + Locale::Convert::toString(aResultField->data()->name())); + + try { + // set components names + AttributeStringArrayPtr aComponents = + aFieldFeature->stringArray("components_names"); + for (int aComp = 0; aComp < aComponents->size(); aComp++) { + std::string aName = aComponents->value(aComp); + aXaoField->setComponentName(aComp, aName); + } - std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID); - anElementID = aXao.getGeometry()-> - getElementIndexByReference(aFieldDimension, aReferenceString); + AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps"); + for (int aStepIndex = 0; aStepIndex < aTables->tables(); + aStepIndex++) { + XAO::Step *aStep = aXaoField->addNewStep(aStepIndex + 1); + aStep->setStep(aStepIndex + 1); + int aStampIndex = aStamps->value(aStepIndex); + aStep->setStamp(aStampIndex); + int aNumElements = + isWholePart ? aXaoField->countElements() : aTables->rows(); + int aNumComps = aTables->columns(); + std::set aFilledIDs; // to fill the rest by defaults + // omit default values first row + for (int aRow = isWholePart ? 0 : 1; aRow < aNumElements; aRow++) { + for (int aCol = 0; aCol < aNumComps; aCol++) { + int anElementID = 0; + if (!isWholePart) { + // element index actually is the ID of the selection + AttributeSelectionPtr aSel = aSelectionList->value(aRow - 1); + int aReferenceID = + GeomAlgoAPI_CompoundBuilder::id(aShape, aSel->value()); + if (aReferenceID == + 0) // selected value does not found in the exported shape + continue; + + std::string aReferenceString = + XAO::XaoUtils::intToString(aReferenceID); + anElementID = aXao.getGeometry()->getElementIndexByReference( + aFieldDimension, aReferenceString); + } + + ModelAPI_AttributeTables::Value aVal = + aTables->value(isWholePart ? 0 : aRow, aCol, aStepIndex); + std::string aStrVal = valToString(aVal, aTables->type()); + aStep->setStringValue(isWholePart ? aRow : anElementID, aCol, + aStrVal); + aFilledIDs.insert(anElementID); } - - ModelAPI_AttributeTables::Value aVal = aTables->value( - isWholePart ? 0 : aRow, aCol, aStepIndex); - std::string aStrVal = valToString(aVal, aTables->type()); - aStep->setStringValue(isWholePart ? aRow : anElementID, aCol, aStrVal); - aFilledIDs.insert(anElementID); } - } - if (!isWholePart) { // fill the rest values by default ones - XAO::GeometricElementList::iterator allElem = - aXao.getGeometry()->begin(aFieldDimension); - for(; allElem != aXao.getGeometry()->end(aFieldDimension); allElem++) { - if (aFilledIDs.find(allElem->first) != aFilledIDs.end()) - continue; - for(int aCol = 0; aCol < aNumComps; aCol++) { - // default value - ModelAPI_AttributeTables::Value aVal = aTables->value(0, aCol, aStepIndex); - std::string aStrVal = valToString(aVal, aTables->type()); - aStep->setStringValue(allElem->first, aCol, aStrVal); + if (!isWholePart) { // fill the rest values by default ones + XAO::GeometricElementList::iterator allElem = + aXao.getGeometry()->begin(aFieldDimension); + for (; allElem != aXao.getGeometry()->end(aFieldDimension); + allElem++) { + if (aFilledIDs.find(allElem->first) != aFilledIDs.end()) + continue; + for (int aCol = 0; aCol < aNumComps; aCol++) { + // default value + ModelAPI_AttributeTables::Value aVal = + aTables->value(0, aCol, aStepIndex); + std::string aStrVal = valToString(aVal, aTables->type()); + aStep->setStringValue(allElem->first, aCol, aStrVal); + } } } } + } catch (XAO::XAO_Exception &e) { + // LCOV_EXCL_START + std::string msg = + "An error occurred while exporting field " + + Locale::Convert::toString(aResultField->data()->name()); + msg += ".\n"; + msg += e.what(); + msg += "\n"; + msg += "=> skipping this field from XAO export."; + Events_InfoMessage("ExportFeature", msg, this).send(); + aXao.removeField(aXaoField); + // LCOV_EXCL_STOP } - } catch (XAO::XAO_Exception& e) { - // LCOV_EXCL_START - std::string msg = "An error occurred while exporting field " + - Locale::Convert::toString(aResultField->data()->name()); - msg += ".\n"; - msg += e.what(); - msg += "\n"; - msg += "=> skipping this field from XAO export."; - Events_InfoMessage("ExportFeature", msg, this).send(); - aXao.removeField(aXaoField); - // LCOV_EXCL_STOP } } - } - // exporting - if (isMemoryExport) { - string(ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID())->setValue(XAOExportMem(&aXao, anError)); - } - else { - XAOExport(theFileName, &aXao, anError); - } + // exporting + if (isMemoryExport) { + string(ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID()) + ->setValue(XAOExportMem(&aXao, anError)); + } else { + XAOExport(theFileName, &aXao, anError); + } - if (!anError.empty()) { - setError("An error occurred while exporting " + theFileName + ": " + anError); - return; - } + if (!anError.empty()) { + setError("An error occurred while exporting " + theFileName + ": " + + anError); + return; + } -// LCOV_EXCL_START - } catch (XAO::XAO_Exception& e) { + // LCOV_EXCL_START + } catch (XAO::XAO_Exception &e) { std::string anError = e.what(); - setError("An error occurred while exporting " + theFileName + ": " + anError); + setError("An error occurred while exporting " + theFileName + ": " + + anError); return; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } -bool ExchangePlugin_ExportFeature::isMacro() const -{ +bool ExchangePlugin_ExportFeature::isMacro() const { if (!data().get() || !data()->isValid()) return false; - ExchangePlugin_ExportFeature* aThis = ((ExchangePlugin_ExportFeature*)(this)); + ExchangePlugin_ExportFeature *aThis = + ((ExchangePlugin_ExportFeature *)(this)); AttributeStringPtr aFormatAttr = aThis->string(FILE_FORMAT_ID()); std::string aFormat(aFormatAttr.get() ? aFormatAttr->value() : ""); @@ -620,14 +650,17 @@ bool ExchangePlugin_ExportFeature::isMacro() const AttributeStringPtr aFilePathAttr = aThis->string(FILE_PATH_ID()); std::string aFilePath = aFilePathAttr->value(); if (!aFilePath.empty()) { - std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath); + std::string anExtension = + GeomAlgoAPI_Tools::File_Tools::extension(aFilePath); aFormat = anExtension; } } - if (aFormat == "XAO") { // on export to GEOM the selection attribute is filled - this is - // an exceptional case where export to XAO feature must be kept - AttributeSelectionListPtr aList = aThis->selectionList(XAO_SELECTION_LIST_ID()); + if (aFormat == + "XAO") { // on export to GEOM the selection attribute is filled - this is + // an exceptional case where export to XAO feature must be kept + AttributeSelectionListPtr aList = + aThis->selectionList(XAO_SELECTION_LIST_ID()); return !aList->isInitialized() || aList->size() == 0; } return true; diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h index 100a5e00c..db7ed4086 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_EXPORTFEATURE_H_ @@ -33,126 +34,105 @@ * * The list of supported formats is defined in the configuration file. */ -class ExchangePlugin_ExportFeature : public ModelAPI_Feature -{ +class ExchangePlugin_ExportFeature : public ModelAPI_Feature { public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_EXPORT_ID("Export"); return MY_EXPORT_ID; } /// attribute name for file format - inline static const std::string& EXPORT_TYPE_ID() - { + inline static const std::string &EXPORT_TYPE_ID() { static const std::string MY_EXPORT_TYPE_ID("ExportType"); return MY_EXPORT_TYPE_ID; } /// attribute name of file path - inline static const std::string& FILE_PATH_ID() - { + inline static const std::string &FILE_PATH_ID() { static const std::string MY_FILE_PATH_ID("file_path"); return MY_FILE_PATH_ID; } /// attribute name of xao file path - inline static const std::string& XAO_FILE_PATH_ID() - { + inline static const std::string &XAO_FILE_PATH_ID() { static const std::string MY_XAO_FILE_PATH_ID("xao_file_path"); return MY_XAO_FILE_PATH_ID; } /// attribute name of stl file path - inline static const std::string& STL_FILE_PATH_ID() - { + inline static const std::string &STL_FILE_PATH_ID() { static const std::string MY_STL_FILE_PATH_ID("stl_file_path"); return MY_STL_FILE_PATH_ID; } /// Attribute name for selected object to export in stl file path. - inline static const std::string& STL_OBJECT_SELECTED() - { + inline static const std::string &STL_OBJECT_SELECTED() { static const std::string ATTR_ID("stl_object_selected"); return ATTR_ID; } /// Attribute name for deflection type. - inline static const std::string& STL_DEFLECTION_TYPE() - { + inline static const std::string &STL_DEFLECTION_TYPE() { static const std::string ATTR_ID("stl_deflection_type"); return ATTR_ID; } /// Attribute name for deflection type relative. - inline static const std::string& STL_DEFLECTION_TYPE_RELATIVE() - { + inline static const std::string &STL_DEFLECTION_TYPE_RELATIVE() { static const std::string ATTR_ID("stl_deflection_type_relative"); return ATTR_ID; } /// Attribute name for deflection type absolute. - inline static const std::string& STL_DEFLECTION_TYPE_ABSOLUTE() - { + inline static const std::string &STL_DEFLECTION_TYPE_ABSOLUTE() { static const std::string ATTR_ID("stl_deflection_type_absolute"); return ATTR_ID; } /// Attribute name for relative. - inline static const std::string& STL_RELATIVE() - { + inline static const std::string &STL_RELATIVE() { static const std::string ATTR_ID("stl_relative"); return ATTR_ID; } /// Attribute name for absolute. - inline static const std::string& STL_ABSOLUTE() - { + inline static const std::string &STL_ABSOLUTE() { static const std::string ATTR_ID("stl_absolute"); return ATTR_ID; } /// Attribute name for stl file type. - inline static const std::string& STL_FILE_TYPE() - { + inline static const std::string &STL_FILE_TYPE() { static const std::string ATTR_ID("stl_file_type"); return ATTR_ID; } /// Attribute name for stl file type ascii. - inline static const std::string& STL_FILE_TYPE_ASCII() - { + inline static const std::string &STL_FILE_TYPE_ASCII() { static const std::string ATTR_ID("stl_file_type_acii"); return ATTR_ID; } /// Attribute name for stl file type binary. - inline static const std::string& STL_FILE_TYPE_BINARY() - { + inline static const std::string &STL_FILE_TYPE_BINARY() { static const std::string ATTR_ID("stl_file_type_binary"); return ATTR_ID; } /// attribute name of file format - inline static const std::string& FILE_FORMAT_ID() - { + inline static const std::string &FILE_FORMAT_ID() { static const std::string MY_FILE_FORMAT_ID("file_format"); return MY_FILE_FORMAT_ID; } /// attribute name of selection list - inline static const std::string& SELECTION_LIST_ID() - { + inline static const std::string &SELECTION_LIST_ID() { static const std::string MY_SELECTION_LIST_ID("selection_list"); return MY_SELECTION_LIST_ID; } /// attribute name of xao selection list - inline static const std::string& XAO_SELECTION_LIST_ID() - { + inline static const std::string &XAO_SELECTION_LIST_ID() { static const std::string MY_SELECTION_LIST_ID("xao_selection_list"); return MY_SELECTION_LIST_ID; } /// attribute name of author for XAO format - inline static const std::string& XAO_AUTHOR_ID() - { + inline static const std::string &XAO_AUTHOR_ID() { static const std::string MY_XAO_AUTHOR_ID("xao_author"); return MY_XAO_AUTHOR_ID; } /// attribute name of geometry name for XAO format - inline static const std::string& XAO_GEOMETRY_NAME_ID() - { + inline static const std::string &XAO_GEOMETRY_NAME_ID() { static const std::string MY_XAO_GEOMETRY_NAME_ID("xao_geometry_name"); return MY_XAO_GEOMETRY_NAME_ID; } /// attribute string memory buffer - inline static const std::string& MEMORY_BUFFER_ID() - { + inline static const std::string &MEMORY_BUFFER_ID() { static const std::string MY_MEMORY_BUFFER_ID("memory_buffer"); return MY_MEMORY_BUFFER_ID; } @@ -163,23 +143,23 @@ public: EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature(); /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { return ExchangePlugin_ExportFeature::ID(); } - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Reimplemented from ModelAPI_Feature::attributeChanged() - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute(); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns false. - // It is macro for not-XAO export. For XAO the feature is kept invisible in the tree - // for the export to GEOM functionality correct working. + // It is macro for not-XAO export. For XAO the feature is kept invisible in + // the tree for the export to GEOM functionality correct working. EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const; /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. @@ -187,20 +167,20 @@ public: /// Do not put in history. /// Since it is not a macro, it is not deleted, but we don't want to see it. - bool isInHistory() { return false; } + bool isInHistory() { return false; } protected: /// Performs export of the file - EXCHANGEPLUGIN_EXPORT void exportFile(const std::string& theFileName, - const std::string& theFormat, - const bool isMemoryExport); + EXCHANGEPLUGIN_EXPORT void exportFile(const std::string &theFileName, + const std::string &theFormat, + const bool isMemoryExport); /// Performs export to XAO file - EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName, - const bool isMemoryExport); + EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string &theFileName, + const bool isMemoryExport); /// Performs export to STL file - EXCHANGEPLUGIN_EXPORT void exportSTL(const std::string& theFileName); + EXCHANGEPLUGIN_EXPORT void exportSTL(const std::string &theFileName); }; #endif /* EXPORT_EXPORTFEATURE_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp index 1b97b073d..61473458d 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -38,36 +39,35 @@ // Obtain all features to be exported to get the list of selected results. static void collectFeatures(DocumentPtr theDocument, AttributeSelectionListPtr theSelected, - std::list& theExport); + std::list &theExport); // Obtain all constuction elements of the document. -static void collectConstructions(DocumentPtr theDocument, std::list& theExport); +static void collectConstructions(DocumentPtr theDocument, + std::list &theExport); // Check features could be exported. The following features cannot be exported: // * non-construction result (Part) when exporting the PartSet; // * features, which refer to objects from another document. // Returns true if all features can be exported. -static bool verifyExport(const std::list& theFeatures, - std::list& theExternalReferences, - std::list& theExportedParts, - std::list& theReferredParts); +static bool verifyExport(const std::list &theFeatures, + std::list &theExternalReferences, + std::list &theExportedParts, + std::list &theReferredParts); // Collect names of features as a single string -static std::wstring namesOfFeatures(const std::list& theFeatures); +static std::wstring namesOfFeatures(const std::list &theFeatures); +ExchangePlugin_ExportPart::ExchangePlugin_ExportPart() {} -ExchangePlugin_ExportPart::ExchangePlugin_ExportPart() -{ -} - -void ExchangePlugin_ExportPart::initAttributes() -{ +void ExchangePlugin_ExportPart::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FILE_FORMAT_ID()); - data()->addAttribute(SELECTION_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SELECTION_LIST_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), FILE_FORMAT_ID()); + data()->addAttribute(SELECTION_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SELECTION_LIST_ID()); } -void ExchangePlugin_ExportPart::execute() -{ +void ExchangePlugin_ExportPart::execute() { AttributeStringPtr aFilePathAttr = string(FILE_PATH_ID()); std::string aFilename = aFilePathAttr->value(); if (aFilename.empty()) { @@ -81,16 +81,17 @@ void ExchangePlugin_ExportPart::execute() DocumentPtr aPartSetDoc = ModelAPI_Session::get()->moduleDocument(); AttributeSelectionListPtr aSelected = selectionList(SELECTION_LIST_ID()); if (aSelected && aSelected->size() == 0 && anExportDoc == aPartSetDoc) { - // no result is selected, thus have to export all features of the current document, - // but the document is a PartSet; and it is forbidden to copy results of Parts, - // thus copy construction elements only + // no result is selected, thus have to export all features of the current + // document, but the document is a PartSet; and it is forbidden to copy + // results of Parts, thus copy construction elements only collectConstructions(anExportDoc, aFeaturesToExport); - } - else + } else collectFeatures(anExportDoc, aSelected, aFeaturesToExport); if (aFeaturesToExport.empty()) { - Events_InfoMessage(getKind(), "Selected features cannot be exported from the document.").send(); + Events_InfoMessage( + getKind(), "Selected features cannot be exported from the document.") + .send(); return; } @@ -99,22 +100,25 @@ void ExchangePlugin_ExportPart::execute() aFeaturesToExport.pop_back(); std::list anExternalLinks, anExportedParts, aReferredParts; - if (!verifyExport(aFeaturesToExport, anExternalLinks, anExportedParts, aReferredParts)) { + if (!verifyExport(aFeaturesToExport, anExternalLinks, anExportedParts, + aReferredParts)) { if (!anExternalLinks.empty()) { std::wstring aListOfFeatures = namesOfFeatures(anExternalLinks); - std::string aMessage = "The selected results were created using external references " - "outside of this Part from features %1. " - "Please, remove these references or select another " - "sub-set of results to be able to export."; + std::string aMessage = + "The selected results were created using external references " + "outside of this Part from features %1. " + "Please, remove these references or select another " + "sub-set of results to be able to export."; Events_InfoMessage(getKind(), aMessage).arg(aListOfFeatures).send(); } if (!aReferredParts.empty()) { std::wstring aListOfParts = namesOfFeatures(aReferredParts); - std::string aMessage = "The selected results were created using references " - "to the results of Parts: %1. Please, remove these references " - "or select another sub-set of results to be able to export."; + std::string aMessage = + "The selected results were created using references " + "to the results of Parts: %1. Please, remove these references " + "or select another sub-set of results to be able to export."; Events_InfoMessage(getKind(), aMessage).arg(aListOfParts).send(); } if (!anExportedParts.empty()) { @@ -134,29 +138,28 @@ void ExchangePlugin_ExportPart::execute() } } +// ================================ Auxiliary functions +// =================================== -// ================================ Auxiliary functions =================================== - -static bool isCoordinate(FeaturePtr theFeature) -{ +static bool isCoordinate(FeaturePtr theFeature) { return !theFeature->isInHistory() && - (theFeature->getKind() == ConstructionPlugin_Point::ID() || - theFeature->getKind() == ConstructionPlugin_Axis::ID() || - theFeature->getKind() == ConstructionPlugin_Plane::ID()); + (theFeature->getKind() == ConstructionPlugin_Point::ID() || + theFeature->getKind() == ConstructionPlugin_Axis::ID() || + theFeature->getKind() == ConstructionPlugin_Plane::ID()); } -static void allReferencedFeatures(const std::set& theFeatures, - std::set& theReferencedFeatures) -{ +static void allReferencedFeatures(const std::set &theFeatures, + std::set &theReferencedFeatures) { std::set aReferences; for (std::set::const_iterator anIt = theFeatures.begin(); anIt != theFeatures.end(); ++anIt) { theReferencedFeatures.insert(*anIt); - std::list > > aRefs; + std::list>> aRefs; (*anIt)->data()->referencesToObjects(aRefs); - for (std::list > >::iterator aRIt = aRefs.begin(); + for (std::list>>::iterator + aRIt = aRefs.begin(); aRIt != aRefs.end(); ++aRIt) { for (std::list::iterator anObjIt = aRIt->second.begin(); anObjIt != aRIt->second.end(); ++anObjIt) { @@ -174,8 +177,7 @@ static void allReferencedFeatures(const std::set& theFeatures, void collectFeatures(DocumentPtr theDocument, AttributeSelectionListPtr theSelected, - std::list& theExport) -{ + std::list &theExport) { theExport = theDocument->allFeatures(); // remove all features after the current one @@ -194,7 +196,8 @@ void collectFeatures(DocumentPtr theDocument, // collect initial list of features basing on the selected results std::set aFeaturesToExport; - for (int anIndex = 0, aSize = theSelected->size(); anIndex < aSize; ++anIndex) { + for (int anIndex = 0, aSize = theSelected->size(); anIndex < aSize; + ++anIndex) { AttributeSelectionPtr aCurrent = theSelected->value(anIndex); FeaturePtr aCurFeature = ModelAPI_Feature::feature(aCurrent->context()); if (aCurFeature) @@ -209,14 +212,13 @@ void collectFeatures(DocumentPtr theDocument, if (aFeaturesToExport.find(*anIt) == aFeaturesToExport.end()) { std::list::iterator aRemoveIt = anIt++; theExport.erase(aRemoveIt); - } - else + } else ++anIt; } } -void collectConstructions(DocumentPtr theDocument, std::list& theExport) -{ +void collectConstructions(DocumentPtr theDocument, + std::list &theExport) { theExport = theDocument->allFeatures(); // keep constructions only std::list::iterator anIt = theExport.begin(); @@ -225,7 +227,8 @@ void collectConstructions(DocumentPtr theDocument, std::list& theExp ResultPtr aCurResult = aCurFeature->lastResult(); bool isApplicable = - (!aCurResult || aCurResult->groupName() == ModelAPI_ResultConstruction::group()) && + (!aCurResult || + aCurResult->groupName() == ModelAPI_ResultConstruction::group()) && !isCoordinate(aCurFeature); if (isApplicable) @@ -237,11 +240,10 @@ void collectConstructions(DocumentPtr theDocument, std::list& theExp } } -bool verifyExport(const std::list& theFeatures, - std::list& theExternalReferences, - std::list& theExportedParts, - std::list& theReferredParts) -{ +bool verifyExport(const std::list &theFeatures, + std::list &theExternalReferences, + std::list &theExportedParts, + std::list &theReferredParts) { for (std::list::const_iterator anIt = theFeatures.begin(); anIt != theFeatures.end(); ++anIt) { // full part should not be exported @@ -250,10 +252,11 @@ bool verifyExport(const std::list& theFeatures, DocumentPtr aDoc = (*anIt)->document(); - std::list > > aRefs; + std::list>> aRefs; (*anIt)->data()->referencesToObjects(aRefs); - std::list > >::iterator aRIt = aRefs.begin(); - for (; aRIt != aRefs.end(); ++aRIt) { + std::list>>::iterator aRIt = + aRefs.begin(); + for (; aRIt != aRefs.end(); ++aRIt) { for (std::list::iterator anObjIt = aRIt->second.begin(); anObjIt != aRIt->second.end(); ++anObjIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt); @@ -270,11 +273,11 @@ bool verifyExport(const std::list& theFeatures, } } - return theExternalReferences.empty() && theExportedParts.empty() && theReferredParts.empty(); + return theExternalReferences.empty() && theExportedParts.empty() && + theReferredParts.empty(); } -std::wstring namesOfFeatures(const std::list& theFeatures) -{ +std::wstring namesOfFeatures(const std::list &theFeatures) { std::wostringstream aListOfFeatures; for (std::list::const_iterator anIt = theFeatures.begin(); anIt != theFeatures.end(); ++anIt) { diff --git a/src/ExchangePlugin/ExchangePlugin_ExportPart.h b/src/ExchangePlugin/ExchangePlugin_ExportPart.h index 6dd82cfd6..fb5fb8d14 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportPart.h +++ b/src/ExchangePlugin/ExchangePlugin_ExportPart.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_EXPORTPART_H_ @@ -26,32 +27,28 @@ /** * \class ExchangePlugin_ExportPart * \ingroup Plugins - * \brief Feature for export some results of a Part to the binary format for the further import. + * \brief Feature for export some results of a Part to the binary format for the + * further import. */ -class ExchangePlugin_ExportPart : public ModelAPI_Feature -{ +class ExchangePlugin_ExportPart : public ModelAPI_Feature { public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_EXPORT_ID("ExportPart"); return MY_EXPORT_ID; } /// attribute name of file path - inline static const std::string& FILE_PATH_ID() - { + inline static const std::string &FILE_PATH_ID() { static const std::string MY_FILE_PATH_ID("file_path"); return MY_FILE_PATH_ID; } /// attribute name of file format - inline static const std::string& FILE_FORMAT_ID() - { + inline static const std::string &FILE_FORMAT_ID() { static const std::string MY_FILE_FORMAT_ID("file_format"); return MY_FILE_FORMAT_ID; } /// attribute name of selection list - inline static const std::string& SELECTION_LIST_ID() - { + inline static const std::string &SELECTION_LIST_ID() { static const std::string MY_SELECTION_LIST_ID("selection_list"); return MY_SELECTION_LIST_ID; } @@ -59,18 +56,19 @@ public: ExchangePlugin_ExportPart(); /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { return ExchangePlugin_ExportPart::ID(); } - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute(); - /// Returns true if this feature is used as macro: creates other features and then removed. + /// Returns true if this feature is used as macro: creates other features and + /// then removed. EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. @@ -78,7 +76,7 @@ public: /// Do not put in history. /// Since it is not a macro, it is not deleted, but we don't want to see it. - bool isInHistory() { return false; } + bool isInHistory() { return false; } }; #endif /* EXCHANGEPLUGIN_EXPORTPART_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_Import.cpp b/src/ExchangePlugin/ExchangePlugin_Import.cpp index 312d59ac1..25d42adcb 100644 --- a/src/ExchangePlugin/ExchangePlugin_Import.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Import.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ExchangePlugin_Import.h" @@ -24,20 +25,19 @@ #include -#include +#include #include +#include #include -#include -#include #include +#include #include #include - static const std::wstring THE_NEW_PART_STR(L"New Part"); -DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::wstring& thePartName) -{ +DocumentPtr findDocument(DocumentPtr thePartSetDoc, + const std::wstring &thePartName) { DocumentPtr aDoc; FeaturePtr aPartFeature; if (thePartName == THE_NEW_PART_STR) { @@ -45,13 +45,13 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::wstring& thePartN aPartFeature = thePartSetDoc->addFeature(PartSetPlugin_Part::ID()); if (aPartFeature) aPartFeature->execute(); - } - else { + } else { // find existing part by its name std::list aSubFeatures = thePartSetDoc->allFeatures(); for (std::list::iterator aFIt = aSubFeatures.begin(); - aFIt != aSubFeatures.end(); ++aFIt) { - if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() && (*aFIt)->name() == thePartName) { + aFIt != aSubFeatures.end(); ++aFIt) { + if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() && + (*aFIt)->name() == thePartName) { aPartFeature = *aFIt; break; } @@ -59,52 +59,55 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::wstring& thePartN } if (aPartFeature) { - ResultPartPtr aPartResult = - std::dynamic_pointer_cast(aPartFeature->lastResult()); + ResultPartPtr aPartResult = std::dynamic_pointer_cast( + aPartFeature->lastResult()); if (aPartResult) aDoc = aPartResult->partDoc(); } return aDoc; } - /* - * Request for initialization of data model of the feature: adding all attributes + * Request for initialization of data model of the feature: adding all + * attributes */ -void ExchangePlugin_ImportBase::initAttributes() -{ +void ExchangePlugin_ImportBase::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(TARGET_PART_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(TARGET_PARTS_LIST_ID(), ModelAPI_AttributeStringArray::typeId()); + data()->addAttribute(TARGET_PARTS_LIST_ID(), + ModelAPI_AttributeStringArray::typeId()); } -void ExchangePlugin_Import::initAttributes() -{ +void ExchangePlugin_Import::initAttributes() { ExchangePlugin_ImportBase::initAttributes(); data()->addAttribute(STEP_FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(IMPORT_TYPE_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(STEP_TARGET_PART_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(STEP_TARGET_PARTS_LIST_ID(), ModelAPI_AttributeStringArray::typeId()); - data()->addAttribute(STEP_MATERIALS_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(STEP_TARGET_PART_ID(), + ModelAPI_AttributeInteger::typeId()); + data()->addAttribute(STEP_TARGET_PARTS_LIST_ID(), + ModelAPI_AttributeStringArray::typeId()); + data()->addAttribute(STEP_MATERIALS_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(STEP_COLORS_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(STEP_SCALE_INTER_UNITS_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(STEP_SCALE_INTER_UNITS_ID(), + ModelAPI_AttributeBoolean::typeId()); #ifndef HAVE_SALOME ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::IMPORT_TYPE_ID()); + getKind(), ExchangePlugin_Import::IMPORT_TYPE_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::STEP_FILE_PATH_ID()); + getKind(), ExchangePlugin_Import::STEP_FILE_PATH_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::STEP_TARGET_PART_ID()); + getKind(), ExchangePlugin_Import::STEP_TARGET_PART_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::STEP_TARGET_PARTS_LIST_ID()); + getKind(), ExchangePlugin_Import::STEP_TARGET_PARTS_LIST_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::STEP_MATERIALS_ID()); + getKind(), ExchangePlugin_Import::STEP_MATERIALS_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::STEP_COLORS_ID()); + getKind(), ExchangePlugin_Import::STEP_COLORS_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), ExchangePlugin_Import::STEP_SCALE_INTER_UNITS_ID()); + getKind(), ExchangePlugin_Import::STEP_SCALE_INTER_UNITS_ID()); #endif } @@ -112,8 +115,7 @@ void ExchangePlugin_Import::initAttributes() * Computes or recomputes the results */ -void ExchangePlugin_Import::execute() -{ +void ExchangePlugin_Import::execute() { AttributeStringPtr aFormatAttr = this->string(ExchangePlugin_Import::IMPORT_TYPE_ID()); std::string aFormat = aFormatAttr->value(); @@ -121,14 +123,13 @@ void ExchangePlugin_Import::execute() std::string aFilePath; AttributeStringArrayPtr aPartsAttr; AttributeIntegerPtr aTargetAttr; - if (aFormat == "STEP" || aFormat == "STP") - { + if (aFormat == "STEP" || aFormat == "STP") { aFilePathAttr = string(ExchangePlugin_Import::STEP_FILE_PATH_ID()); aFilePath = aFilePathAttr->value(); // get the document where to import aPartsAttr = stringArray(STEP_TARGET_PARTS_LIST_ID()); aTargetAttr = integer(STEP_TARGET_PART_ID()); - }else{ + } else { aFilePathAttr = string(ExchangePlugin_Import::FILE_PATH_ID()); aFilePath = aFilePathAttr->value(); // get the document where to import @@ -137,22 +138,23 @@ void ExchangePlugin_Import::execute() } if (aFilePath.empty()) { - setError("File path is empty."); - return; + setError("File path is empty."); + return; } SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = findDocument(aSession->moduleDocument(), + DocumentPtr aDoc = findDocument( + aSession->moduleDocument(), Locale::Convert::toWString(aPartsAttr->value(aTargetAttr->value()))); if (aDoc.get()) { - FeaturePtr aImportFeature = aDoc->addFeature(ExchangePlugin_ImportFeature::ID()); + FeaturePtr aImportFeature = + aDoc->addFeature(ExchangePlugin_ImportFeature::ID()); DataPtr aData = aImportFeature->data(); AttributeStringPtr aPathAttr; - if (aFormat == "STEP" || aFormat == "STP") - { - aPathAttr = aData->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID()); - }else - { + if (aFormat == "STEP" || aFormat == "STP") { + aPathAttr = + aData->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID()); + } else { aPathAttr = aData->string(ExchangePlugin_ImportFeature::FILE_PATH_ID()); } @@ -160,11 +162,13 @@ void ExchangePlugin_Import::execute() aData->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); aData->boolean(ExchangePlugin_ImportFeature::STEP_MATERIALS_ID()) - ->setValue(boolean(ExchangePlugin_Import::STEP_MATERIALS_ID())->value()); + ->setValue( + boolean(ExchangePlugin_Import::STEP_MATERIALS_ID())->value()); aData->boolean(ExchangePlugin_ImportFeature::STEP_COLORS_ID()) ->setValue(boolean(ExchangePlugin_Import::STEP_COLORS_ID())->value()); aData->boolean(ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID()) - ->setValue(boolean(ExchangePlugin_Import::STEP_SCALE_INTER_UNITS_ID())->value()); + ->setValue(boolean(ExchangePlugin_Import::STEP_SCALE_INTER_UNITS_ID()) + ->value()); aPathAttr->setValue(aFilePathAttr->value()); aImportTypeAttr->setValue(aFormat); @@ -172,9 +176,9 @@ void ExchangePlugin_Import::execute() } } -void ExchangePlugin_Import_Image::execute() -{ - AttributeStringPtr aFilePathAttr = string(ExchangePlugin_ImportBase::FILE_PATH_ID()); +void ExchangePlugin_Import_Image::execute() { + AttributeStringPtr aFilePathAttr = + string(ExchangePlugin_ImportBase::FILE_PATH_ID()); std::string aFilePath = aFilePathAttr->value(); if (aFilePath.empty()) { setError("File path is empty."); @@ -185,11 +189,13 @@ void ExchangePlugin_Import_Image::execute() AttributeStringArrayPtr aPartsAttr = stringArray(TARGET_PARTS_LIST_ID()); AttributeIntegerPtr aTargetAttr = integer(TARGET_PART_ID()); SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = findDocument(aSession->moduleDocument(), + DocumentPtr aDoc = findDocument( + aSession->moduleDocument(), Locale::Convert::toWString(aPartsAttr->value(aTargetAttr->value()))); if (aDoc.get()) { - FeaturePtr aImportFeature = aDoc->addFeature(ExchangePlugin_Import_ImageFeature::ID()); + FeaturePtr aImportFeature = + aDoc->addFeature(ExchangePlugin_Import_ImageFeature::ID()); DataPtr aData = aImportFeature->data(); AttributeStringPtr aPathAttr = aData->string(ExchangePlugin_Import_ImageFeature::FILE_PATH_ID()); @@ -197,13 +203,12 @@ void ExchangePlugin_Import_Image::execute() aImportFeature->execute(); } } -void ExchangePlugin_Import::attributeChanged(const std::string& theID) -{ +void ExchangePlugin_Import::attributeChanged(const std::string &theID) { AttributeStringPtr aFilePathAttr; AttributeStringArrayPtr aPartsAttr; AttributeIntegerPtr aTargetAttr; - if (theID == FILE_PATH_ID() ||theID == STEP_FILE_PATH_ID() ) { + if (theID == FILE_PATH_ID() || theID == STEP_FILE_PATH_ID()) { aFilePathAttr = string(FILE_PATH_ID()); if (theID == FILE_PATH_ID() && aFilePathAttr->value().empty()) return; @@ -219,11 +224,10 @@ void ExchangePlugin_Import::attributeChanged(const std::string& theID) aPartsAttr = stringArray(STEP_TARGET_PARTS_LIST_ID()); aTargetAttr = integer(STEP_TARGET_PART_ID()); updatePart(aPartsAttr, aTargetAttr); - } + } } -void ExchangePlugin_Import_Image::attributeChanged(const std::string& theID) -{ +void ExchangePlugin_Import_Image::attributeChanged(const std::string &theID) { if (theID == FILE_PATH_ID()) { AttributeStringPtr aFilePathAttr = string(FILE_PATH_ID()); if (aFilePathAttr->value().empty()) @@ -235,9 +239,8 @@ void ExchangePlugin_Import_Image::attributeChanged(const std::string& theID) } } -void ExchangePlugin_ImportBase::updatePart(AttributeStringArrayPtr& aPartsAttr, - AttributeIntegerPtr& aTargetAttr) -{ +void ExchangePlugin_ImportBase::updatePart(AttributeStringArrayPtr &aPartsAttr, + AttributeIntegerPtr &aTargetAttr) { // update the list of target parts SessionPtr aSession = ModelAPI_Session::get(); @@ -262,11 +265,11 @@ void ExchangePlugin_ImportBase::updatePart(AttributeStringArrayPtr& aPartsAttr, std::list::iterator anIt = anAcceptedValues.begin(); for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd) aPartsAttr->setValue(anInd, Locale::Convert::toString(*anIt)); - } - else { + } else { // keep only the name of the current part if (aPartsAttr->size() == 0) { - FeaturePtr aPartFeature = ModelAPI_Tools::findPartFeature(aSession->moduleDocument(), aDoc); + FeaturePtr aPartFeature = + ModelAPI_Tools::findPartFeature(aSession->moduleDocument(), aDoc); aPartsAttr->setSize(1); aPartsAttr->setValue(0, Locale::Convert::toString(aPartFeature->name())); diff --git a/src/ExchangePlugin/ExchangePlugin_Import.h b/src/ExchangePlugin/ExchangePlugin_Import.h index 01e406bb2..b897c9123 100644 --- a/src/ExchangePlugin/ExchangePlugin_Import.h +++ b/src/ExchangePlugin/ExchangePlugin_Import.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_IMPORT_H_ @@ -22,13 +23,12 @@ #include "ExchangePlugin.h" -#include -#include #include #include +#include +#include #include - /** * \class ExchangePlugin_ImportFeature * \ingroup Plugins @@ -36,103 +36,93 @@ * * The list of supported formats is defined in the configuration file. */ -class ExchangePlugin_ImportBase : public ModelAPI_Feature -{ - public: +class ExchangePlugin_ImportBase : public ModelAPI_Feature { +public: /// attribute name of file path - inline static const std::string& FILE_PATH_ID() - { + inline static const std::string &FILE_PATH_ID() { static const std::string MY_FILE_PATH_ID("file_path"); return MY_FILE_PATH_ID; } /// attribute name of target part - inline static const std::string& TARGET_PART_ID() - { + inline static const std::string &TARGET_PART_ID() { static const std::string MY_TARGET_PART_ID("target_part"); return MY_TARGET_PART_ID; } /// attribute name of list of target parts - inline static const std::string& TARGET_PARTS_LIST_ID() - { + inline static const std::string &TARGET_PARTS_LIST_ID() { static const std::string MY_TARGET_PARTS_LIST_ID("target_parts_list"); return MY_TARGET_PARTS_LIST_ID; } /// Default constructor - EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase()= default; + EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase()= default; - + EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase() = default; - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) = 0; + EXCHANGEPLUGIN_EXPORT virtual void + attributeChanged(const std::string &theID) = 0; /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute() = 0; - /// Returns true if this feature is used as macro: creates other features and then removed. + /// Returns true if this feature is used as macro: creates other features and + /// then removed. EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } - protected: - - EXCHANGEPLUGIN_EXPORT void updatePart(AttributeStringArrayPtr& aPartsAttr, - AttributeIntegerPtr& aTargetAttr); +protected: + EXCHANGEPLUGIN_EXPORT void updatePart(AttributeStringArrayPtr &aPartsAttr, + AttributeIntegerPtr &aTargetAttr); }; -class ExchangePlugin_Import : public ExchangePlugin_ImportBase -{ - public: +class ExchangePlugin_Import : public ExchangePlugin_ImportBase { +public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_IMPORT_ID("ImportMacro"); return MY_IMPORT_ID; } - /// Feature kind - inline static const std::string& IMPORT_TYPE_ID() - { + /// Feature kind + inline static const std::string &IMPORT_TYPE_ID() { static const std::string MY_IMPORT_TYPE_ID("ImportType"); return MY_IMPORT_TYPE_ID; } - /// attribute name of step file path - inline static const std::string& STEP_FILE_PATH_ID() - { + /// attribute name of step file path + inline static const std::string &STEP_FILE_PATH_ID() { static const std::string MY_STEP_FILE_PATH_ID("step_file_path"); return MY_STEP_FILE_PATH_ID; } /// attribute name of step target part - inline static const std::string& STEP_TARGET_PART_ID() - { + inline static const std::string &STEP_TARGET_PART_ID() { static const std::string MY_STEP_TARGET_PART_ID("step_target_part"); return MY_STEP_TARGET_PART_ID; } /// attribute name of list ofstep target parts - inline static const std::string& STEP_TARGET_PARTS_LIST_ID() - { - static const std::string MY_STEP_TARGET_PARTS_LIST_ID("step_target_parts_list"); + inline static const std::string &STEP_TARGET_PARTS_LIST_ID() { + static const std::string MY_STEP_TARGET_PARTS_LIST_ID( + "step_target_parts_list"); return MY_STEP_TARGET_PARTS_LIST_ID; } /// attribute name of step Scale to International System Units - inline static const std::string& STEP_SCALE_INTER_UNITS_ID() - { - static const std::string MY_STEP_SCALE_INTER_UNITS_ID("step_scale_inter_units"); + inline static const std::string &STEP_SCALE_INTER_UNITS_ID() { + static const std::string MY_STEP_SCALE_INTER_UNITS_ID( + "step_scale_inter_units"); return MY_STEP_SCALE_INTER_UNITS_ID; } /// attribute name of step materiels - inline static const std::string& STEP_MATERIALS_ID() - { + inline static const std::string &STEP_MATERIALS_ID() { static const std::string MY_STEP_MATERIALS_ID("step_materials"); return MY_STEP_MATERIALS_ID; } /// attribute name of step colors - inline static const std::string& STEP_COLORS_ID() - { + inline static const std::string &STEP_COLORS_ID() { static const std::string MY_STEP_COLORS_ID("step_colors"); return MY_STEP_COLORS_ID; } @@ -142,28 +132,26 @@ class ExchangePlugin_Import : public ExchangePlugin_ImportBase EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import() = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { return ExchangePlugin_Import::ID(); } /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute() override; - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); // Called on change of any argument-attribute of this object - /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) override; - + /// \param theID identifier of changed attribute + EXCHANGEPLUGIN_EXPORT virtual void + attributeChanged(const std::string &theID) override; }; -class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase -{ - public: +class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase { +public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_IMPORT_ID("ImportImageMacro"); return MY_IMPORT_ID; } @@ -174,8 +162,7 @@ class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_Image() = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { return ExchangePlugin_Import_Image::ID(); } @@ -183,9 +170,9 @@ class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase EXCHANGEPLUGIN_EXPORT virtual void execute() override; // Called on change of any argument-attribute of this object - /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) override; - + /// \param theID identifier of changed attribute + EXCHANGEPLUGIN_EXPORT virtual void + attributeChanged(const std::string &theID) override; }; #endif /* IMPORT_IMPORTFEATURE_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index a57986e32..2b6a73650 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -27,28 +28,28 @@ #include #include +#include #include +#include #include #include -#include -#include -#include #include +#include #include #include #include +#include +#include +#include +#include #include #include #include #include -#include -#include #include -#include -#include #include #include #include @@ -57,43 +58,44 @@ #include #include #include -#include #include +#include -#include -#include #include +#include #include +#include #include #include /* - * Request for initialization of data model of the feature: adding all attributes + * Request for initialization of data model of the feature: adding all + * attributes */ -void ExchangePlugin_ImportFeatureBase::initAttributes() -{ +void ExchangePlugin_ImportFeatureBase::initAttributes() { data()->addAttribute(ExchangePlugin_ImportFeatureBase::FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); AttributePtr aFeaturesAttribute = - data()->addAttribute(ExchangePlugin_ImportFeatureBase::FEATURES_ID(), - ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(ExchangePlugin_ImportFeatureBase::FEATURES_ID(), + ModelAPI_AttributeRefList::typeId()); aFeaturesAttribute->setIsArgument(false); ModelAPI_Session::get()->validators()->registerNotObligatory( getKind(), ExchangePlugin_ImportFeatureBase::FEATURES_ID()); } -void ExchangePlugin_ImportFeature::initAttributes() -{ +void ExchangePlugin_ImportFeature::initAttributes() { ExchangePlugin_ImportFeatureBase::initAttributes(); data()->addAttribute(STEP_FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(IMPORT_TYPE_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(STEP_MATERIALS_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(STEP_MATERIALS_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(STEP_COLORS_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(STEP_SCALE_INTER_UNITS_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(STEP_SCALE_INTER_UNITS_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(MEMORY_BUFFER_ID(), ModelAPI_AttributeString::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory( @@ -110,13 +112,14 @@ void ExchangePlugin_ImportFeature::initAttributes() getKind(), ExchangePlugin_ImportFeature::MEMORY_BUFFER_ID()); } -bool ExchangePlugin_ImportFeature::isEditable() -{ - AttributeStringPtr aImportTypeAttr = string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); +bool ExchangePlugin_ImportFeature::isEditable() { + AttributeStringPtr aImportTypeAttr = + string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); std::string aFormat = aImportTypeAttr->value(); if (aFormat == "XAOMem") - // If the shape is imported from memory buffer, do not allow to edit the feature + // If the shape is imported from memory buffer, do not allow to edit the + // feature return false; return true; @@ -125,29 +128,27 @@ bool ExchangePlugin_ImportFeature::isEditable() /* * Computes or recomputes the results */ -void ExchangePlugin_ImportFeature::execute() -{ - AttributeStringPtr aImportTypeAttr = string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); +void ExchangePlugin_ImportFeature::execute() { + AttributeStringPtr aImportTypeAttr = + string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()); std::string aFormat = aImportTypeAttr->value(); if (aFormat == "XAOMem") { // Import from memory buffer AttributeStringPtr aMemoryBuffAttr = - string(ExchangePlugin_ImportFeature::MEMORY_BUFFER_ID()); + string(ExchangePlugin_ImportFeature::MEMORY_BUFFER_ID()); std::string aMemoryBuff = aMemoryBuffAttr->value(); if (aMemoryBuff.empty()) { setError("Memory buffer is empty."); return; } importXAO("", aMemoryBuff, true); - } - else { + } else { // Import from file AttributeStringPtr aFilePathAttr; if (aFormat == "STEP" || aFormat == "STP") { - aFilePathAttr = string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID()); - } - else { + aFilePathAttr = string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID()); + } else { aFilePathAttr = string(ExchangePlugin_ImportFeature::FILE_PATH_ID()); } std::string aFilePath = aFilePathAttr->value(); @@ -159,9 +160,9 @@ void ExchangePlugin_ImportFeature::execute() } } -void ExchangePlugin_Import_ImageFeature::execute() -{ - AttributeStringPtr aFilePathAttr = string(ExchangePlugin_Import_ImageFeature::FILE_PATH_ID()); +void ExchangePlugin_Import_ImageFeature::execute() { + AttributeStringPtr aFilePathAttr = + string(ExchangePlugin_Import_ImageFeature::FILE_PATH_ID()); std::string aFilePath = aFilePathAttr->value(); if (aFilePath.empty()) { setError("File path is empty."); @@ -170,19 +171,20 @@ void ExchangePlugin_Import_ImageFeature::execute() importFile(aFilePath); } -std::shared_ptr ExchangePlugin_ImportFeatureBase::createResultBody( - std::shared_ptr aGeomShape) -{ - std::shared_ptr aResultBody = document()->createBody(data()); - //LoadNamingDS of the imported shape +std::shared_ptr +ExchangePlugin_ImportFeatureBase::createResultBody( + std::shared_ptr aGeomShape) { + std::shared_ptr aResultBody = + document()->createBody(data()); + // LoadNamingDS of the imported shape loadNamingDS(aGeomShape, aResultBody); return aResultBody; } -void ExchangePlugin_ImportFeature::importFile(const std::string& theFileName) -{ +void ExchangePlugin_ImportFeature::importFile(const std::string &theFileName) { // "*.brep" -> "BREP" - std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName); + std::string anExtension = + GeomAlgoAPI_Tools::File_Tools::extension(theFileName); if (anExtension == "XAO") { importXAO(theFileName); @@ -213,25 +215,27 @@ void ExchangePlugin_ImportFeature::importFile(const std::string& theFileName) std::list anGroupList = aRefListOfGroups->list(); std::list::iterator anGroupIt = anGroupList.begin(); for (; anGroupIt != anGroupList.end(); ++anGroupIt) { - std::shared_ptr aFeature = ModelAPI_Feature::feature(*anGroupIt); + std::shared_ptr aFeature = + ModelAPI_Feature::feature(*anGroupIt); if (aFeature) document()->removeFeature(aFeature); } - aGeomShape = STEPImportAttributs(theFileName, aResult, anScalInterUnits, - anMaterialsGroupSelected, anColorGroupSelected, - theMaterialShape, anError); + aGeomShape = STEPImportAttributs( + theFileName, aResult, anScalInterUnits, anMaterialsGroupSelected, + anColorGroupSelected, theMaterialShape, anError); } else if (anExtension == "IGES" || anExtension == "IGS") { aGeomShape = IGESImport(theFileName, anExtension, anError); } else if (anExtension == "STL") { aGeomShape = STLImport(theFileName, anError); - } else { + } else { anError = "Unsupported format: " + anExtension; } // Check if shape is valid if (!anError.empty()) { - setError("An error occurred while importing " + theFileName + ": " + anError); + setError("An error occurred while importing " + theFileName + ": " + + anError); return; } @@ -239,32 +243,29 @@ void ExchangePlugin_ImportFeature::importFile(const std::string& theFileName) loadNamingDS(aGeomShape, aResult); // create color group - if (anColorGroupSelected) - { + if (anColorGroupSelected) { setColorGroups(aResult); } // create Material group - if (anMaterialsGroupSelected){ - setMaterielGroup(aResult,theMaterialShape); + if (anMaterialsGroupSelected) { + setMaterielGroup(aResult, theMaterialShape); } setResult(aResult); aResult->clearShapeNameAndColor(); - } void ExchangePlugin_ImportFeature::setColorGroups( - std::shared_ptr theResultBody) -{ + std::shared_ptr theResultBody) { std::vector aColor; int anIndice = 1; std::list> aColorsRead; ModelAPI_Tools::getColor(theResultBody, aColor); - if (!aColor.empty() ){ + if (!aColor.empty()) { std::wstringstream aColorName; - aColorName < allRes; ModelAPI_Tools::allSubs(theResultBody, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); ++aRes) { + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); ++aRes) { ModelAPI_Tools::getColor(*aRes, aColor); - if (!aColor.empty() ){ + if (!aColor.empty()) { auto it = std::find(aColorsRead.begin(), aColorsRead.end(), aColor); - if ( it == aColorsRead.end() ){ + if (it == aColorsRead.end()) { std::wstringstream aColorName; - aColorName< theResultBody, - std::vector &theColor, - const std::wstring& theName ) -{ + std::shared_ptr theResultBody, + std::vector &theColor, const std::wstring &theName) { std::vector aColor; std::shared_ptr aGroupFeature = addFeature("Group"); - // group name + // group name aGroupFeature->data()->setName(theName); // fill selection - AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list"); + AttributeSelectionListPtr aSelectionList = + aGroupFeature->selectionList("group_list"); ModelAPI_Tools::getColor(theResultBody, aColor); - if (!aColor.empty()){ + if (!aColor.empty()) { if (aColor == theColor) { GeomShapePtr aShape = theResultBody->shape(); aSelectionList->setSelectionType(aShape->shapeTypeStr()); - aSelectionList->append(theResultBody,aShape); + aSelectionList->append(theResultBody, aShape); } } // add element with the same color std::list allRes; ModelAPI_Tools::allSubs(theResultBody, allRes); - for(std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); ++aRes) { + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); ++aRes) { ModelAPI_Tools::getColor(*aRes, aColor); GeomShapePtr aShape = (*aRes)->shape(); - if (!aColor.empty()){ - if (aRes->get() && aColor == theColor) { + if (!aColor.empty()) { + if (aRes->get() && aColor == theColor) { if (aShape->isCompound() || aShape->isCompSolid()) { GeomAPI_ShapeIterator anIt(aShape); for (; anIt.more(); anIt.next()) { aSelectionList->setSelectionType(anIt.current()->shapeTypeStr()); - aSelectionList->append(theResultBody,anIt.current()); + aSelectionList->append(theResultBody, anIt.current()); } } else { aSelectionList->setSelectionType(aShape->shapeTypeStr()); - aSelectionList->append(theResultBody,aShape); + aSelectionList->append(theResultBody, aShape); } } } @@ -337,7 +338,7 @@ void ExchangePlugin_ImportFeature::setColorGroup( ResultPtr aGroup = document()->createGroup(aGroupFeature->data()); aGroupFeature->setResult(aGroup); - ModelAPI_Tools::setColor(aGroupFeature->lastResult(),theColor); + ModelAPI_Tools::setColor(aGroupFeature->lastResult(), theColor); if (aSelectionList->size() == 0) { document()->removeFeature(aGroupFeature); @@ -345,276 +346,297 @@ void ExchangePlugin_ImportFeature::setColorGroup( } void ExchangePlugin_ImportFeature::setMaterielGroup( - std::shared_ptr theResultBody, - std::map< std::wstring,std::list>& theMaterialShape) -{ - std::map< std::wstring, std::list>::iterator anIt; - for (anIt = theMaterialShape.begin(); anIt != theMaterialShape.end(); ++anIt) { + std::shared_ptr theResultBody, + std::map> &theMaterialShape) { + std::map>::iterator anIt; + for (anIt = theMaterialShape.begin(); anIt != theMaterialShape.end(); + ++anIt) { std::shared_ptr aGroupFeature = addFeature("Group"); // group name aGroupFeature->data()->setName((*anIt).first); // fill selection - AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list"); + AttributeSelectionListPtr aSelectionList = + aGroupFeature->selectionList("group_list"); std::list allRes; ModelAPI_Tools::allSubs(theResultBody, allRes); - for (std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); ++aRes) { + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); ++aRes) { GeomShapePtr aShape = (*aRes)->shape(); for (std::list::iterator aResMat = anIt->second.begin(); - aResMat != anIt->second.end(); ++aResMat) { - if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) - { + aResMat != anIt->second.end(); ++aResMat) { + if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) { if (aShape->isCompound() || aShape->isCompSolid()) { GeomAPI_ShapeIterator aShapeIt(aShape); for (; aShapeIt.more(); aShapeIt.next()) { - aSelectionList->setSelectionType(aShapeIt.current()->shapeTypeStr()); + aSelectionList->setSelectionType( + aShapeIt.current()->shapeTypeStr()); aSelectionList->append(theResultBody, aShapeIt.current()); } } else { aSelectionList->setSelectionType(aShape->shapeTypeStr()); - aSelectionList->append(theResultBody,aShape); + aSelectionList->append(theResultBody, aShape); } break; } } } - if (aSelectionList->size() == 0){ + if (aSelectionList->size() == 0) { document()->removeFeature(aGroupFeature); } } } -void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName, - const std::string& theMemoryBuff, - const bool isMemoryImport) -{ +void ExchangePlugin_ImportFeature::importXAO(const std::string &theFileName, + const std::string &theMemoryBuff, + const bool isMemoryImport) { std::string aDataSource = theFileName; try { - std::string anError; + std::string anError; - XAO::Xao aXao; - std::shared_ptr aGeomShape; - if (isMemoryImport) { - aGeomShape = XAOImportMem(theMemoryBuff, anError, &aXao); - aDataSource = "memory buffer"; - } - else - aGeomShape = XAOImport(theFileName, anError, &aXao); + XAO::Xao aXao; + std::shared_ptr aGeomShape; + if (isMemoryImport) { + aGeomShape = XAOImportMem(theMemoryBuff, anError, &aXao); + aDataSource = "memory buffer"; + } else + aGeomShape = XAOImport(theFileName, anError, &aXao); - if (!anError.empty()) { - setError("An error occurred while importing " + aDataSource + ": " + anError); - return; - } - - XAO::Geometry* aXaoGeometry = aXao.getGeometry(); + if (!anError.empty()) { + setError("An error occurred while importing " + aDataSource + ": " + + anError); + return; + } - // use the geometry name or the file name for the feature - std::string aBodyName = aXaoGeometry->getName(); - if (aBodyName.empty()) { - if (isMemoryImport) - aBodyName = "ImportXAOMem"; - else - aBodyName = GeomAlgoAPI_Tools::File_Tools::name(theFileName); - } - data()->setName(Locale::Convert::toWString(aBodyName)); - - ResultBodyPtr aResultBody = createResultBody(aGeomShape); - setResult(aResultBody); - - // Process groups/fields - std::shared_ptr aRefListOfGroups = - std::dynamic_pointer_cast(data()->attribute(FEATURES_ID())); - - // Remove previous groups/fields stored in RefList - std::list anGroupList = aRefListOfGroups->list(); - std::list::iterator anGroupIt = anGroupList.begin(); - for (; anGroupIt != anGroupList.end(); ++anGroupIt) { - std::shared_ptr aFeature = ModelAPI_Feature::feature(*anGroupIt); - if (aFeature) - document()->removeFeature(aFeature); - } + XAO::Geometry *aXaoGeometry = aXao.getGeometry(); - // Create new groups - for (int aGroupIndex = 0; aGroupIndex < aXao.countGroups(); ++aGroupIndex) { - XAO::Group* aXaoGroup = aXao.getGroup(aGroupIndex); + // use the geometry name or the file name for the feature + std::string aBodyName = aXaoGeometry->getName(); + if (aBodyName.empty()) { + if (isMemoryImport) + aBodyName = "ImportXAOMem"; + else + aBodyName = GeomAlgoAPI_Tools::File_Tools::name(theFileName); + } + data()->setName(Locale::Convert::toWString(aBodyName)); - std::shared_ptr aGroupFeature = addFeature("Group"); + ResultBodyPtr aResultBody = createResultBody(aGeomShape); + setResult(aResultBody); - // group name - if (!aXaoGroup->getName().empty()) - aGroupFeature->data()->setName(Locale::Convert::toWString(aXaoGroup->getName())); + // Process groups/fields + std::shared_ptr aRefListOfGroups = + std::dynamic_pointer_cast( + data()->attribute(FEATURES_ID())); - // fill selection - AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list"); - - // conversion of dimension - std::string aDimensionString = XAO::XaoUtils::dimensionToString(aXaoGroup->getDimension()); - std::string aSelectionType = - ExchangePlugin_Tools::xaoDimension2selectionType(aDimensionString); - - aSelectionList->setSelectionType(aSelectionType); - for (int anElementIndex = 0; anElementIndex < aXaoGroup->count(); ++anElementIndex) { - aSelectionList->append(aResultBody, GeomShapePtr()); - // complex conversion of element index to reference id - int anElementID = aXaoGroup->get(anElementIndex); - std::string aReferenceString = - aXaoGeometry->getElementReference(aXaoGroup->getDimension(), anElementID); - int aReferenceID = XAO::XaoUtils::stringToInt(aReferenceString); - - aSelectionList->value(anElementIndex)->setId(aReferenceID); + // Remove previous groups/fields stored in RefList + std::list anGroupList = aRefListOfGroups->list(); + std::list::iterator anGroupIt = anGroupList.begin(); + for (; anGroupIt != anGroupList.end(); ++anGroupIt) { + std::shared_ptr aFeature = + ModelAPI_Feature::feature(*anGroupIt); + if (aFeature) + document()->removeFeature(aFeature); } - } - // Create new fields - for (int aFieldIndex = 0; aFieldIndex < aXao.countFields(); ++aFieldIndex) { - XAO::Field* aXaoField = aXao.getField(aFieldIndex); - - std::shared_ptr aFieldFeature = addFeature("Field"); - // group name - if (!aXaoField->getName().empty()) - aFieldFeature->data()->setName(Locale::Convert::toWString(aXaoField->getName())); - - // fill selection - AttributeSelectionListPtr aSelectionList = aFieldFeature->selectionList("selected"); - - // conversion of dimension - std::string aDimensionString = XAO::XaoUtils::dimensionToString(aXaoField->getDimension()); - std::string aSelectionType = - ExchangePlugin_Tools::xaoDimension2selectionType(aDimensionString); - aSelectionList->setSelectionType(aSelectionType); - // limitation: now in XAO fields are related to everything, so, iterate all sub-shapes to fill - int aCountSelected = aXaoField->countElements(); - std::list::const_iterator aResIter = results().begin(); - for(; aResIter != results().end() && aCountSelected; aResIter++) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(*aResIter); - if (!aBody.get()) - continue; - // check that only results that were created before this field are used - FeaturePtr aResultFeature = document()->feature(aBody); - if (!aResultFeature.get()) - continue; - GeomShapePtr aShape = aBody->shape(); - if (!aShape.get() || aShape->isNull()) - continue; - GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::shapeTypeByStr(aSelectionType)); - for(; anExp.more(); anExp.next()) { - aSelectionList->append(aBody, anExp.current()); - aCountSelected--; - if (aCountSelected == 0) - break; + // Create new groups + for (int aGroupIndex = 0; aGroupIndex < aXao.countGroups(); ++aGroupIndex) { + XAO::Group *aXaoGroup = aXao.getGroup(aGroupIndex); + + std::shared_ptr aGroupFeature = addFeature("Group"); + + // group name + if (!aXaoGroup->getName().empty()) + aGroupFeature->data()->setName( + Locale::Convert::toWString(aXaoGroup->getName())); + + // fill selection + AttributeSelectionListPtr aSelectionList = + aGroupFeature->selectionList("group_list"); + + // conversion of dimension + std::string aDimensionString = + XAO::XaoUtils::dimensionToString(aXaoGroup->getDimension()); + std::string aSelectionType = + ExchangePlugin_Tools::xaoDimension2selectionType(aDimensionString); + + aSelectionList->setSelectionType(aSelectionType); + for (int anElementIndex = 0; anElementIndex < aXaoGroup->count(); + ++anElementIndex) { + aSelectionList->append(aResultBody, GeomShapePtr()); + // complex conversion of element index to reference id + int anElementID = aXaoGroup->get(anElementIndex); + std::string aReferenceString = aXaoGeometry->getElementReference( + aXaoGroup->getDimension(), anElementID); + int aReferenceID = XAO::XaoUtils::stringToInt(aReferenceString); + + aSelectionList->value(anElementIndex)->setId(aReferenceID); } } + // Create new fields + for (int aFieldIndex = 0; aFieldIndex < aXao.countFields(); ++aFieldIndex) { + XAO::Field *aXaoField = aXao.getField(aFieldIndex); + + std::shared_ptr aFieldFeature = addFeature("Field"); + + // group name + if (!aXaoField->getName().empty()) + aFieldFeature->data()->setName( + Locale::Convert::toWString(aXaoField->getName())); + + // fill selection + AttributeSelectionListPtr aSelectionList = + aFieldFeature->selectionList("selected"); + + // conversion of dimension + std::string aDimensionString = + XAO::XaoUtils::dimensionToString(aXaoField->getDimension()); + std::string aSelectionType = + ExchangePlugin_Tools::xaoDimension2selectionType(aDimensionString); + aSelectionList->setSelectionType(aSelectionType); + // limitation: now in XAO fields are related to everything, so, iterate + // all sub-shapes to fill + int aCountSelected = aXaoField->countElements(); + std::list::const_iterator aResIter = results().begin(); + for (; aResIter != results().end() && aCountSelected; aResIter++) { + ResultBodyPtr aBody = + std::dynamic_pointer_cast(*aResIter); + if (!aBody.get()) + continue; + // check that only results that were created before this field are used + FeaturePtr aResultFeature = document()->feature(aBody); + if (!aResultFeature.get()) + continue; + GeomShapePtr aShape = aBody->shape(); + if (!aShape.get() || aShape->isNull()) + continue; + GeomAPI_ShapeExplorer anExp( + aShape, GeomAPI_Shape::shapeTypeByStr(aSelectionType)); + for (; anExp.more(); anExp.next()) { + aSelectionList->append(aBody, anExp.current()); + aCountSelected--; + if (aCountSelected == 0) + break; + } + } - // conversion of type - XAO::Type aFieldType = aXaoField->getType(); - std::string aTypeString = XAO::XaoUtils::fieldTypeToString(aFieldType); - ModelAPI_AttributeTables::ValueType aType = - ExchangePlugin_Tools::xaoType2valuesType(aTypeString); - // set components names - AttributeStringArrayPtr aComponents = aFieldFeature->stringArray("components_names"); - aComponents->setSize(aXaoField->countComponents()); - for(int aComp = 0; aComp < aXaoField->countComponents(); aComp++) { - aComponents->setValue(aComp, aXaoField->getComponentName(aComp)); - } + // conversion of type + XAO::Type aFieldType = aXaoField->getType(); + std::string aTypeString = XAO::XaoUtils::fieldTypeToString(aFieldType); + ModelAPI_AttributeTables::ValueType aType = + ExchangePlugin_Tools::xaoType2valuesType(aTypeString); + // set components names + AttributeStringArrayPtr aComponents = + aFieldFeature->stringArray("components_names"); + aComponents->setSize(aXaoField->countComponents()); + for (int aComp = 0; aComp < aXaoField->countComponents(); aComp++) { + aComponents->setValue(aComp, aXaoField->getComponentName(aComp)); + } - AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps"); - aStamps->setSize(aXaoField->countSteps()); - std::shared_ptr aTables = aFieldFeature->tables("values"); - aTables->setSize( - aXaoField->countElements() + 1, aXaoField->countComponents(), aXaoField->countSteps()); - aTables->setType(aType); - // iterate steps - XAO::stepIterator aStepIter = aXaoField->begin(); - for(int aStepIndex = 0; aStepIter != aXaoField->end(); aStepIter++, aStepIndex++) { - aStamps->setValue(aStepIndex, (*aStepIter)->getStamp()); - for(int aRow = 1; aRow <= aXaoField->countElements(); aRow++) { - for(int aCol = 0; aCol < aXaoField->countComponents(); aCol++) { - ModelAPI_AttributeTables::Value aVal; - std::string aValStr = (*aStepIter)->getStringValue(aRow - 1, aCol); - switch(aType) { - case ModelAPI_AttributeTables::BOOLEAN: - aVal.myBool = aValStr == "true"; - break; - case ModelAPI_AttributeTables::INTEGER: - aVal.myInt = atoi(aValStr.c_str()); - break; - case ModelAPI_AttributeTables::DOUBLE: - aVal.myDouble = atof(aValStr.c_str()); - break; - case ModelAPI_AttributeTables::STRING: - aVal.myStr = aValStr; - break; + AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps"); + aStamps->setSize(aXaoField->countSteps()); + std::shared_ptr aTables = + aFieldFeature->tables("values"); + aTables->setSize(aXaoField->countElements() + 1, + aXaoField->countComponents(), aXaoField->countSteps()); + aTables->setType(aType); + // iterate steps + XAO::stepIterator aStepIter = aXaoField->begin(); + for (int aStepIndex = 0; aStepIter != aXaoField->end(); + aStepIter++, aStepIndex++) { + aStamps->setValue(aStepIndex, (*aStepIter)->getStamp()); + for (int aRow = 1; aRow <= aXaoField->countElements(); aRow++) { + for (int aCol = 0; aCol < aXaoField->countComponents(); aCol++) { + ModelAPI_AttributeTables::Value aVal; + std::string aValStr = (*aStepIter)->getStringValue(aRow - 1, aCol); + switch (aType) { + case ModelAPI_AttributeTables::BOOLEAN: + aVal.myBool = aValStr == "true"; + break; + case ModelAPI_AttributeTables::INTEGER: + aVal.myInt = atoi(aValStr.c_str()); + break; + case ModelAPI_AttributeTables::DOUBLE: + aVal.myDouble = atof(aValStr.c_str()); + break; + case ModelAPI_AttributeTables::STRING: + aVal.myStr = aValStr; + break; + } + aTables->setValue(aVal, aRow, aCol, aStepIndex); } - aTables->setValue(aVal, aRow, aCol, aStepIndex); } } - } - // remove everything with zero-values: zeroes are treated as defaults - std::set aRowsToRemove; - for(int aRow = 1; aRow < aTables->rows(); aRow++) { - bool isZero = true; - for(int aCol = 0; aCol < aTables->columns() && isZero; aCol++) { - for(int aStepIndex = 0; aStepIndex != aTables->tables() && isZero; aStepIndex++) { - if (aTables->valueStr(aRow, aCol, aStepIndex) != aTables->valueStr(0, aCol, aStepIndex)) - isZero = false; + // remove everything with zero-values: zeroes are treated as defaults + std::set aRowsToRemove; + for (int aRow = 1; aRow < aTables->rows(); aRow++) { + bool isZero = true; + for (int aCol = 0; aCol < aTables->columns() && isZero; aCol++) { + for (int aStepIndex = 0; aStepIndex != aTables->tables() && isZero; + aStepIndex++) { + if (aTables->valueStr(aRow, aCol, aStepIndex) != + aTables->valueStr(0, aCol, aStepIndex)) + isZero = false; + } } + if (isZero) + aRowsToRemove.insert( + aRow - 1); // -1 to make prepared for remove from SelectionList } - if (isZero) - aRowsToRemove.insert(aRow - 1); // -1 to make prepared for remove from SelectionList - } - if (!aRowsToRemove.empty()) { // move usefull rows on bottom to the up of the tables - // number of rows passed during going through: the current rows will - // be moved up for this value - int aRemovedPassed = 0; - for(int aRow = 1; aRow < aTables->rows(); aRow++) { - if (aRowsToRemove.find(aRow - 1) != aRowsToRemove.end()) { - aRemovedPassed++; - } else if (aRemovedPassed != 0) { // copy the line up - for(int aCol = 0; aCol < aTables->columns(); aCol++) { - for(int aTable = 0; aTable != aTables->tables(); aTable++) { - aTables->setValue( - aTables->value(aRow, aCol, aTable), aRow - aRemovedPassed, aCol, aTable); + if (!aRowsToRemove.empty()) { // move usefull rows on bottom to the up of + // the tables + // number of rows passed during going through: the current rows will + // be moved up for this value + int aRemovedPassed = 0; + for (int aRow = 1; aRow < aTables->rows(); aRow++) { + if (aRowsToRemove.find(aRow - 1) != aRowsToRemove.end()) { + aRemovedPassed++; + } else if (aRemovedPassed != 0) { // copy the line up + for (int aCol = 0; aCol < aTables->columns(); aCol++) { + for (int aTable = 0; aTable != aTables->tables(); aTable++) { + aTables->setValue(aTables->value(aRow, aCol, aTable), + aRow - aRemovedPassed, aCol, aTable); + } } } } + aTables->setSize(aTables->rows() - aRemovedPassed, aTables->columns(), + aTables->tables()); + aSelectionList->remove(aRowsToRemove); // remove also selected elements } - aTables->setSize(aTables->rows() - aRemovedPassed, aTables->columns(), aTables->tables()); - aSelectionList->remove(aRowsToRemove); // remove also selected elements } - } - // Top avoid problems in Object Browser update: issue #1647. - ModelAPI_EventCreator::get()->sendReordered( - std::dynamic_pointer_cast(aRefListOfGroups->owner())); + // Top avoid problems in Object Browser update: issue #1647. + ModelAPI_EventCreator::get()->sendReordered( + std::dynamic_pointer_cast(aRefListOfGroups->owner())); -// LCOV_EXCL_START - } catch (XAO::XAO_Exception& e) { + // LCOV_EXCL_START + } catch (XAO::XAO_Exception &e) { std::string anError = e.what(); - setError("An error occurred while importing " + aDataSource + ": " + anError); + setError("An error occurred while importing " + aDataSource + ": " + + anError); return; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } //============================================================================ -std::shared_ptr ExchangePlugin_ImportFeatureBase::addFeature( - std::string theID) -{ +std::shared_ptr +ExchangePlugin_ImportFeatureBase::addFeature(std::string theID) { std::shared_ptr aNew = document()->addFeature(theID, false); if (aNew) data()->reflist(FEATURES_ID())->append(aNew); - // set as current also after it becomes sub to set correctly enabled for other subs - //document()->setCurrentFeature(aNew, false); + // set as current also after it becomes sub to set correctly enabled for other + // subs + // document()->setCurrentFeature(aNew, false); return aNew; } // LCOV_EXCL_START void ExchangePlugin_ImportFeatureBase::removeFeature( - std::shared_ptr theFeature) -{ + std::shared_ptr theFeature) { if (!data()->isValid()) return; AttributeRefListPtr aList = reflist(FEATURES_ID()); @@ -622,27 +644,27 @@ void ExchangePlugin_ImportFeatureBase::removeFeature( } // LCOV_EXCL_STOP -int ExchangePlugin_ImportFeatureBase::numberOfSubs(bool /*forTree*/) const -{ +int ExchangePlugin_ImportFeatureBase::numberOfSubs(bool /*forTree*/) const { return data()->reflist(FEATURES_ID())->size(true); } -std::shared_ptr ExchangePlugin_ImportFeatureBase::subFeature( - const int theIndex, bool /*forTree*/) -{ +std::shared_ptr +ExchangePlugin_ImportFeatureBase::subFeature(const int theIndex, + bool /*forTree*/) { ObjectPtr anObj = data()->reflist(FEATURES_ID())->object(theIndex, false); FeaturePtr aRes = std::dynamic_pointer_cast(anObj); return aRes; } // LCOV_EXCL_START -int ExchangePlugin_ImportFeatureBase::subFeatureId(const int theIndex) const -{ - std::shared_ptr aRefList = std::dynamic_pointer_cast< - ModelAPI_AttributeRefList>(data()->attribute(FEATURES_ID())); +int ExchangePlugin_ImportFeatureBase::subFeatureId(const int theIndex) const { + std::shared_ptr aRefList = + std::dynamic_pointer_cast( + data()->attribute(FEATURES_ID())); std::list aFeatures = aRefList->list(); std::list::const_iterator anIt = aFeatures.begin(); - int aResultIndex = 1; // number of the counted (created) features, started from 1 + int aResultIndex = + 1; // number of the counted (created) features, started from 1 int aFeatureIndex = -1; // number of the not-empty features in the list for (; anIt != aFeatures.end(); anIt++) { if (anIt->get()) @@ -655,8 +677,7 @@ int ExchangePlugin_ImportFeatureBase::subFeatureId(const int theIndex) const } // LCOV_EXCL_STOP -bool ExchangePlugin_ImportFeatureBase::isSub(ObjectPtr theObject) const -{ +bool ExchangePlugin_ImportFeatureBase::isSub(ObjectPtr theObject) const { // check is this feature of result FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature) @@ -667,15 +688,13 @@ bool ExchangePlugin_ImportFeatureBase::isSub(ObjectPtr theObject) const //============================================================================ void ExchangePlugin_ImportFeatureBase::loadNamingDS( std::shared_ptr theGeomShape, - std::shared_ptr theResultBody) -{ - //load result + std::shared_ptr theResultBody) { + // load result theResultBody->store(theGeomShape); // to store color of higher-level shape std::wstring aName = theResultBody->findShapeName(theGeomShape); - if (!aName.empty()) - { + if (!aName.empty()) { std::vector aColor = theResultBody->findShapeColor(aName); if (!aColor.empty()) ModelAPI_Tools::setColor(theResultBody, aColor); @@ -685,30 +704,32 @@ void ExchangePlugin_ImportFeatureBase::loadNamingDS( theResultBody->loadFirstLevel(theGeomShape, aNameMS); } -void ExchangePlugin_Import_ImageFeature::importFile(const std::string& theFileName) -{ - std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName); +void ExchangePlugin_Import_ImageFeature::importFile( + const std::string &theFileName) { + std::string anExtension = + GeomAlgoAPI_Tools::File_Tools::extension(theFileName); std::string anError; - if (anExtension == "PNG" || anExtension == "GIF" || - anExtension == "TIFF" || anExtension == "JPE" || - anExtension == "JPEG" || anExtension == "JPG" || - anExtension == "BMP" || anExtension == "PPM" - ) { + if (anExtension == "PNG" || anExtension == "GIF" || anExtension == "TIFF" || + anExtension == "JPE" || anExtension == "JPEG" || anExtension == "JPG" || + anExtension == "BMP" || anExtension == "PPM") { // Perform the import - QPixmap px (theFileName.c_str()); - int aWidth = px.width(); + QPixmap px(theFileName.c_str()); + int aWidth = px.width(); int aHeight = px.height(); if (aWidth < 1 || aHeight < 1) { - setError("An error occurred while importing " + theFileName + ": invalid image"); + setError("An error occurred while importing " + theFileName + + ": invalid image"); return; } - std::shared_ptr aGeomShape = ImageImport(aWidth, aHeight, anError); + std::shared_ptr aGeomShape = + ImageImport(aWidth, aHeight, anError); // Check if shape is valid if (!anError.empty()) { - setError("An error occurred while importing " + theFileName + ": " + anError); + setError("An error occurred while importing " + theFileName + ": " + + anError); return; } @@ -719,18 +740,20 @@ void ExchangePlugin_Import_ImageFeature::importFile(const std::string& theFileNa auto resultBody = createResultBody(aGeomShape); // Store image in result body attribute - AttributeImagePtr anImageAttr = resultBody->data()->image(ModelAPI_ResultBody::IMAGE_ID()); + AttributeImagePtr anImageAttr = + resultBody->data()->image(ModelAPI_ResultBody::IMAGE_ID()); if (anImageAttr.get() != NULL) { QImage aQImage = px.toImage(); - const uchar* aImageBytes = aQImage.bits(); - std::list aByteArray (aImageBytes, aImageBytes + aQImage.sizeInBytes()); + const uchar *aImageBytes = aQImage.bits(); + std::list aByteArray(aImageBytes, + aImageBytes + aQImage.sizeInBytes()); anImageAttr->setTexture(aWidth, aHeight, aByteArray, anExtension); } setResult(resultBody); - } - else { + } else { anError = "Unsupported format: " + anExtension; - setError("An error occurred while importing " + theFileName + ": " + anError); + setError("An error occurred while importing " + theFileName + ": " + + anError); } } diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h index 8a47253a3..7d55f9b19 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_ @@ -22,9 +23,9 @@ #include "ExchangePlugin.h" +#include #include #include -#include #include @@ -35,24 +36,20 @@ * * The list of supported formats is defined in the configuration file. */ -class ExchangePlugin_ImportFeatureBase : public ModelAPI_CompositeFeature -{ +class ExchangePlugin_ImportFeatureBase : public ModelAPI_CompositeFeature { public: /// attribute name of file path - inline static const std::string& FILE_PATH_ID() - { + inline static const std::string &FILE_PATH_ID() { static const std::string MY_FILE_PATH_ID("file_path"); return MY_FILE_PATH_ID; } /// All features (list of references) - inline static const std::string& FEATURES_ID() - { + inline static const std::string &FEATURES_ID() { static const std::string MY_FEATURES_ID("Features"); return MY_FEATURES_ID; } /// attribute name of target part - inline static const std::string& TARGET_PART_ID() - { + inline static const std::string &TARGET_PART_ID() { static const std::string MY_TARGET_PART_ID("target_part"); return MY_TARGET_PART_ID; } @@ -62,9 +59,10 @@ public: EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeatureBase() = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() = 0; + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() = 0; - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Computes or recomputes the results @@ -80,7 +78,8 @@ public: virtual int numberOfSubs(bool forTree = false) const; /// Reimplemented from ModelAPI_CompositeFeature::subFeature() - virtual std::shared_ptr subFeature(const int theIndex, bool forTree = false); + virtual std::shared_ptr subFeature(const int theIndex, + bool forTree = false); /// Reimplemented from ModelAPI_CompositeFeature::subFeatureId() virtual int subFeatureId(const int theIndex) const; @@ -91,37 +90,34 @@ public: /// Reimplemented from ModelAPI_CompositeFeature::removeFeature() virtual void removeFeature(std::shared_ptr theFeature); - protected: +protected: /// Performs the import of the file - EXCHANGEPLUGIN_EXPORT virtual void importFile(const std::string& theFileName) = 0; + EXCHANGEPLUGIN_EXPORT virtual void + importFile(const std::string &theFileName) = 0; /// Creates and prepares a result body from the shape - std::shared_ptr createResultBody( - std::shared_ptr aGeomShape); + std::shared_ptr + createResultBody(std::shared_ptr aGeomShape); /// Loads Naming data structure to the document void loadNamingDS(std::shared_ptr theGeomShape, std::shared_ptr theResultBody); }; -class ExchangePlugin_ImportFeature : public ExchangePlugin_ImportFeatureBase -{ +class ExchangePlugin_ImportFeature : public ExchangePlugin_ImportFeatureBase { public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_IMPORT_ID("Import"); return MY_IMPORT_ID; } /// Feature kind - inline static const std::string& IMPORT_TYPE_ID() - { + inline static const std::string &IMPORT_TYPE_ID() { static const std::string MY_IMPORT_TYPE_ID("ImportType"); return MY_IMPORT_TYPE_ID; } /// attribute name of file path - inline static const std::string& STEP_FILE_PATH_ID() - { + inline static const std::string &STEP_FILE_PATH_ID() { static const std::string MY_STEP_FILE_PATH_ID("step_file_path"); return MY_STEP_FILE_PATH_ID; } @@ -132,39 +128,36 @@ public: EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature() = default; /// attribute name of step Scale to International System Units - inline static const std::string& STEP_SCALE_INTER_UNITS_ID() - { - static const std::string MY_STEP_SCALE_INTER_UNITS_ID("step_scale_inter_units"); + inline static const std::string &STEP_SCALE_INTER_UNITS_ID() { + static const std::string MY_STEP_SCALE_INTER_UNITS_ID( + "step_scale_inter_units"); return MY_STEP_SCALE_INTER_UNITS_ID; } /// attribute name of step materiels - inline static const std::string& STEP_MATERIALS_ID() - { + inline static const std::string &STEP_MATERIALS_ID() { static const std::string MY_STEP_MATERIALS_ID("step_materials"); return MY_STEP_MATERIALS_ID; } /// attribute name of step colors - inline static const std::string& STEP_COLORS_ID() - { + inline static const std::string &STEP_COLORS_ID() { static const std::string MY_STEP_COLORS_ID("step_colors"); return MY_STEP_COLORS_ID; } /// attribute memory buffer - inline static const std::string& MEMORY_BUFFER_ID() - { + inline static const std::string &MEMORY_BUFFER_ID() { static const std::string MY_MEMORY_BUFFER_ID("memory_buffer"); return MY_MEMORY_BUFFER_ID; } /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { return ExchangePlugin_ImportFeature::ID(); } /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute() override; - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Return false in case of XAOMem import. @@ -172,12 +165,14 @@ public: protected: /// Performs the import of the file - EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName) override; + EXCHANGEPLUGIN_EXPORT void + importFile(const std::string &theFileName) override; /// Performs the import of XAO file - EXCHANGEPLUGIN_EXPORT void importXAO(const std::string& theFileName, - const std::string& theMemoryBuff = std::string(), - const bool isMemoryImport = false); + EXCHANGEPLUGIN_EXPORT void + importXAO(const std::string &theFileName, + const std::string &theMemoryBuff = std::string(), + const bool isMemoryImport = false); private: /// Set groups of color @@ -185,21 +180,19 @@ private: /// set a group of color void setColorGroup(std::shared_ptr theResultBody, - std::vector& theColor, - const std::wstring& theName ); + std::vector &theColor, const std::wstring &theName); /// set Materiel group of color - void setMaterielGroup(std::shared_ptr theResultBody, - std::map< std::wstring, std::list>& theMaterialShape); - + void setMaterielGroup( + std::shared_ptr theResultBody, + std::map> &theMaterialShape); }; -class ExchangePlugin_Import_ImageFeature : public ExchangePlugin_ImportFeatureBase -{ - public: +class ExchangePlugin_Import_ImageFeature + : public ExchangePlugin_ImportFeatureBase { +public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_IMPORT_ID("ImportImage"); return MY_IMPORT_ID; } @@ -210,17 +203,16 @@ class ExchangePlugin_Import_ImageFeature : public ExchangePlugin_ImportFeatureBa EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_ImageFeature() = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { return ExchangePlugin_Import_ImageFeature::ID(); } - /// Computes or recomputes the results + /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute() override; protected: /// Performs the import of the file - EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName) override; - + EXCHANGEPLUGIN_EXPORT void + importFile(const std::string &theFileName) override; }; #endif /* IMPORT_IMPORTFEATURE_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp index 3e1de511e..bfa4a64ae 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -38,24 +39,22 @@ static const std::string THE_NEW_PART_STR("New Part"); static const std::string THE_PART_SET_STR("PartSet"); // Update names of imported features/results concurent with existing objects. -static void correntNonUniqueNames(DocumentPtr theDocument, std::list& theImported); +static void correntNonUniqueNames(DocumentPtr theDocument, + std::list &theImported); // Find the document according to its name or create the new one. -static DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartName); +static DocumentPtr findDocument(DocumentPtr thePartSetDoc, + const std::string &thePartName); -ExchangePlugin_ImportPart::ExchangePlugin_ImportPart() -{ -} +ExchangePlugin_ImportPart::ExchangePlugin_ImportPart() {} -void ExchangePlugin_ImportPart::initAttributes() -{ +void ExchangePlugin_ImportPart::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(TARGET_PART_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(TARGET_PARTS_LIST_ID(), ModelAPI_AttributeStringArray::typeId()); + data()->addAttribute(TARGET_PARTS_LIST_ID(), + ModelAPI_AttributeStringArray::typeId()); } - -void ExchangePlugin_ImportPart::execute() -{ +void ExchangePlugin_ImportPart::execute() { AttributeStringPtr aFilePathAttr = string(FILE_PATH_ID()); std::string aFilename = aFilePathAttr->value(); if (aFilename.empty()) { @@ -67,8 +66,8 @@ void ExchangePlugin_ImportPart::execute() AttributeStringArrayPtr aPartsAttr = stringArray(TARGET_PARTS_LIST_ID()); AttributeIntegerPtr aTargetAttr = integer(TARGET_PART_ID()); SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = - findDocument(aSession->moduleDocument(), aPartsAttr->value(aTargetAttr->value())); + DocumentPtr aDoc = findDocument(aSession->moduleDocument(), + aPartsAttr->value(aTargetAttr->value())); // load the file into the document std::list anImportedFeatures; @@ -78,8 +77,7 @@ void ExchangePlugin_ImportPart::execute() setError("Cannot import the document."); } -void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID) -{ +void ExchangePlugin_ImportPart::attributeChanged(const std::string &theID) { if (theID == FILE_PATH_ID()) { AttributeStringPtr aFilePathAttr = string(FILE_PATH_ID()); if (aFilePathAttr->value().empty()) @@ -97,7 +95,8 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID) anAcceptedValues.push_back(THE_NEW_PART_STR); std::list anImportedFeatures; - if (aDoc->importPart(aFilePathAttr->value().c_str(), anImportedFeatures, isPartSet)) + if (aDoc->importPart(aFilePathAttr->value().c_str(), anImportedFeatures, + isPartSet)) anAcceptedValues.push_back(THE_PART_SET_STR); // append names of all parts @@ -105,7 +104,8 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID) for (std::list::iterator aFIt = aSubFeatures.begin(); aFIt != aSubFeatures.end(); ++aFIt) { if ((*aFIt)->getKind() == PartSetPlugin_Part::ID()) - anAcceptedValues.push_back(Locale::Convert::toString((*aFIt)->name())); + anAcceptedValues.push_back( + Locale::Convert::toString((*aFIt)->name())); } if ((size_t)aPartsAttr->size() != anAcceptedValues.size()) @@ -115,25 +115,26 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID) std::list::iterator anIt = anAcceptedValues.begin(); for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd) aPartsAttr->setValue(anInd, *anIt); - } - else { + } else { // keep only the name of the current part if (aPartsAttr->size() == 0) { - FeaturePtr aPartFeature = ModelAPI_Tools::findPartFeature(aSession->moduleDocument(), aDoc); + FeaturePtr aPartFeature = + ModelAPI_Tools::findPartFeature(aSession->moduleDocument(), aDoc); aPartsAttr->setSize(1); - aPartsAttr->setValue(0, Locale::Convert::toString(aPartFeature->name())); + aPartsAttr->setValue(0, + Locale::Convert::toString(aPartFeature->name())); aTargetAttr->setValue(0); } } } } +// ================================ Auxiliary functions +// =================================== -// ================================ Auxiliary functions =================================== - -DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartName) -{ +DocumentPtr findDocument(DocumentPtr thePartSetDoc, + const std::string &thePartName) { DocumentPtr aDoc; if (thePartName == THE_PART_SET_STR) aDoc = thePartSetDoc; @@ -144,14 +145,13 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartNa aPartFeature = thePartSetDoc->addFeature(PartSetPlugin_Part::ID()); if (aPartFeature) aPartFeature->execute(); - } - else { + } else { // find existing part by its name std::list aSubFeatures = thePartSetDoc->allFeatures(); for (std::list::iterator aFIt = aSubFeatures.begin(); aFIt != aSubFeatures.end(); ++aFIt) { if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() && - Locale::Convert::toString((*aFIt)->name()) == thePartName) { + Locale::Convert::toString((*aFIt)->name()) == thePartName) { aPartFeature = *aFIt; break; } @@ -160,7 +160,8 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartNa if (aPartFeature) { ResultPartPtr aPartResult = - std::dynamic_pointer_cast(aPartFeature->lastResult()); + std::dynamic_pointer_cast( + aPartFeature->lastResult()); if (aPartResult) aDoc = aPartResult->partDoc(); } @@ -168,10 +169,10 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartNa return aDoc; } -typedef std::map > > ObjectNameMap; +typedef std::map>> + ObjectNameMap; -bool splitName(std::wstring& theName, int& theIndex) -{ +bool splitName(std::wstring &theName, int &theIndex) { size_t aLastUndercore = theName.find_last_of('_'); bool isOk = aLastUndercore != std::wstring::npos; if (isOk) { @@ -185,25 +186,25 @@ bool splitName(std::wstring& theName, int& theIndex) return isOk; } -void addIndexedName(const ObjectPtr& theObject, ObjectNameMap& theIndexedNames) -{ - std::wstring aName =theObject->data()->name(); +void addIndexedName(const ObjectPtr &theObject, + ObjectNameMap &theIndexedNames) { + std::wstring aName = theObject->data()->name(); std::string aGroup = theObject->groupName(); int anIndex = 0; bool isIndexed = splitName(aName, anIndex); - std::set& anIndices = theIndexedNames[aGroup][aName]; + std::set &anIndices = theIndexedNames[aGroup][aName]; if (isIndexed) anIndices.insert(anIndex); } // Collect names of features and results in the document before the import. -// The name of indexed feature/result will be split to the name and the index. For example , -// 'Point_1', 'Point_2' will be placed at the same key with the set of corrsponding indices: -// 'Point_1', 'Point_2' => {'Point', [1, 2]}. -// Thus, the new point should have index 3 and therefore the name 'Point_3'. -static void collectOldNames(DocumentPtr theDocument, std::list& theAvoided, - ObjectNameMap& theIndexedNames) -{ +// The name of indexed feature/result will be split to the name and the index. +// For example , 'Point_1', 'Point_2' will be placed at the same key with the +// set of corrsponding indices: 'Point_1', 'Point_2' => {'Point', [1, 2]}. Thus, +// the new point should have index 3 and therefore the name 'Point_3'. +static void collectOldNames(DocumentPtr theDocument, + std::list &theAvoided, + ObjectNameMap &theIndexedNames) { std::list anAllFeatures = theDocument->allFeatures(); std::list::iterator aFIt = anAllFeatures.begin(); std::list::iterator anAvoidIt = theAvoided.begin(); @@ -217,15 +218,15 @@ static void collectOldNames(DocumentPtr theDocument, std::list& theA // store name of feature addIndexedName(*aFIt, theIndexedNames); // store names of results - const std::list& aResults = (*aFIt)->results(); + const std::list &aResults = (*aFIt)->results(); for (std::list::const_iterator aRIt = aResults.begin(); aRIt != aResults.end(); ++aRIt) addIndexedName(*aRIt, theIndexedNames); } } -static std::wstring uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExistingNames) -{ +static std::wstring uniqueName(const ObjectPtr &theObject, + ObjectNameMap &theExistingNames) { std::wstring aName = theObject->data()->name(); std::string aGroup = theObject->groupName(); int anIndex = 1; @@ -234,7 +235,7 @@ static std::wstring uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExi ObjectNameMap::iterator aFoundGroup = theExistingNames.find(aGroup); bool isUnique = aFoundGroup == theExistingNames.end(); - std::map >::iterator aFound; + std::map>::iterator aFound; if (!isUnique) { aFound = aFoundGroup->second.find(aName); isUnique = aFound == aFoundGroup->second.end(); @@ -244,8 +245,7 @@ static std::wstring uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExi // name is unique aName = theObject->data()->name(); addIndexedName(theObject, theExistingNames); - } - else { + } else { // search the appropriate index std::set::iterator aFoundIndex = aFound->second.find(anIndex); for (; aFoundIndex != aFound->second.end(); ++aFoundIndex, ++anIndex) @@ -262,8 +262,8 @@ static std::wstring uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExi return aName; } -void correntNonUniqueNames(DocumentPtr theDocument, std::list& theImported) -{ +void correntNonUniqueNames(DocumentPtr theDocument, + std::list &theImported) { ObjectNameMap aNames; collectOldNames(theDocument, theImported, aNames); @@ -273,7 +273,7 @@ void correntNonUniqueNames(DocumentPtr theDocument, std::list& theIm std::wstring aNewName = uniqueName(*anIt, aNames); (*anIt)->data()->setName(aNewName); // update names of results - const std::list& aResults = (*anIt)->results(); + const std::list &aResults = (*anIt)->results(); for (std::list::const_iterator aRIt = aResults.begin(); aRIt != aResults.end(); ++aRIt) { aNewName = uniqueName(*aRIt, aNames); diff --git a/src/ExchangePlugin/ExchangePlugin_ImportPart.h b/src/ExchangePlugin/ExchangePlugin_ImportPart.h index 02f748f3c..123043579 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportPart.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportPart.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_IMPORTPART_H_ @@ -28,30 +29,25 @@ * \ingroup Plugins * \brief Feature for import the structure of Part into the current document. */ -class ExchangePlugin_ImportPart : public ModelAPI_Feature -{ +class ExchangePlugin_ImportPart : public ModelAPI_Feature { public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_IMPORT_ID("ImportPart"); return MY_IMPORT_ID; } /// attribute name of file path - inline static const std::string& FILE_PATH_ID() - { + inline static const std::string &FILE_PATH_ID() { static const std::string MY_FILE_PATH_ID("file_path"); return MY_FILE_PATH_ID; } /// attribute name of target part - inline static const std::string& TARGET_PART_ID() - { + inline static const std::string &TARGET_PART_ID() { static const std::string MY_TARGET_PART_ID("target_part"); return MY_TARGET_PART_ID; } /// attribute name of list of target parts - inline static const std::string& TARGET_PARTS_LIST_ID() - { + inline static const std::string &TARGET_PARTS_LIST_ID() { static const std::string MY_TARGET_PARTS_LIST_ID("target_parts_list"); return MY_TARGET_PARTS_LIST_ID; } @@ -59,22 +55,23 @@ public: ExchangePlugin_ImportPart(); /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() - { + EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { return ExchangePlugin_ImportPart::ID(); } - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Computes or recomputes the results EXCHANGEPLUGIN_EXPORT virtual void execute(); - /// Returns true if this feature is used as macro: creates other features and then removed. + /// Returns true if this feature is used as macro: creates other features and + /// then removed. EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. diff --git a/src/ExchangePlugin/ExchangePlugin_Plugin.cpp b/src/ExchangePlugin/ExchangePlugin_Plugin.cpp index 4c1c5f151..9ece24b4f 100644 --- a/src/ExchangePlugin/ExchangePlugin_Plugin.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Plugin.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include -#include #include -#include #include #include +#include +#include +#include #include #include @@ -34,14 +35,14 @@ #include // the only created instance of this plugin -static ExchangePlugin_Plugin* MY_EXCHANGE_INSTANCE = new ExchangePlugin_Plugin(); +static ExchangePlugin_Plugin *MY_EXCHANGE_INSTANCE = + new ExchangePlugin_Plugin(); -ExchangePlugin_Plugin::ExchangePlugin_Plugin() -{ +ExchangePlugin_Plugin::ExchangePlugin_Plugin() { // register this plugin SessionPtr aSession = ModelAPI_Session::get(); aSession->registerPlugin(this); - ModelAPI_ValidatorsFactory* aFactory = aSession->validators(); + ModelAPI_ValidatorsFactory *aFactory = aSession->validators(); aFactory->registerValidator("ExchangePlugin_ImportFormat", new ExchangePlugin_ImportFormatValidator); aFactory->registerValidator("ExchangePlugin_ExportFormat", @@ -50,31 +51,23 @@ ExchangePlugin_Plugin::ExchangePlugin_Plugin() new ExchangePlugin_InHistoryValidator); } -FeaturePtr ExchangePlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr ExchangePlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == ExchangePlugin_ImportFeature::ID()) { return FeaturePtr(new ExchangePlugin_ImportFeature); - } else - if (theFeatureID == ExchangePlugin_Import_ImageFeature::ID()) { - return FeaturePtr(new ExchangePlugin_Import_ImageFeature); - } else - if (theFeatureID == ExchangePlugin_ExportFeature::ID()) { + } else if (theFeatureID == ExchangePlugin_Import_ImageFeature::ID()) { + return FeaturePtr(new ExchangePlugin_Import_ImageFeature); + } else if (theFeatureID == ExchangePlugin_ExportFeature::ID()) { return FeaturePtr(new ExchangePlugin_ExportFeature); - } else - if (theFeatureID == ExchangePlugin_ImportPart::ID()) { + } else if (theFeatureID == ExchangePlugin_ImportPart::ID()) { return FeaturePtr(new ExchangePlugin_ImportPart); - } else - if (theFeatureID == ExchangePlugin_ExportPart::ID()) { + } else if (theFeatureID == ExchangePlugin_ExportPart::ID()) { return FeaturePtr(new ExchangePlugin_ExportPart); - } else - if (theFeatureID == ExchangePlugin_Dump::ID()) { + } else if (theFeatureID == ExchangePlugin_Dump::ID()) { return FeaturePtr(new ExchangePlugin_Dump); - } else - if (theFeatureID == ExchangePlugin_Import::ID()) { + } else if (theFeatureID == ExchangePlugin_Import::ID()) { return FeaturePtr(new ExchangePlugin_Import); - } else - if (theFeatureID == ExchangePlugin_Import_Image::ID()) { - return FeaturePtr(new ExchangePlugin_Import_Image); + } else if (theFeatureID == ExchangePlugin_Import_Image::ID()) { + return FeaturePtr(new ExchangePlugin_Import_Image); } // feature of such kind is not found return FeaturePtr(); diff --git a/src/ExchangePlugin/ExchangePlugin_Plugin.h b/src/ExchangePlugin/ExchangePlugin_Plugin.h index 6f9ab8eec..0a139c81e 100644 --- a/src/ExchangePlugin/ExchangePlugin_Plugin.h +++ b/src/ExchangePlugin/ExchangePlugin_Plugin.h @@ -14,28 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_PLUGIN_H_ #define EXCHANGEPLUGIN_PLUGIN_H_ #include -#include #include +#include /** * \class ExchangePlugin_Plugin * \ingroup Plugins * \brief The main class for management import and export operations as plugin. */ -class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Plugin : public ModelAPI_Plugin -{ - public: +class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Plugin : public ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); - public: +public: ExchangePlugin_Plugin(); }; diff --git a/src/ExchangePlugin/ExchangePlugin_Tools.cpp b/src/ExchangePlugin/ExchangePlugin_Tools.cpp index e0040d4f7..3a47f82fc 100644 --- a/src/ExchangePlugin/ExchangePlugin_Tools.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Tools.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -std::list ExchangePlugin_Tools::split(const std::string& theString, char theDelimiter) -{ +std::list ExchangePlugin_Tools::split(const std::string &theString, + char theDelimiter) { std::list theResult; std::istringstream aStream(theString); std::string aSection; @@ -31,8 +32,8 @@ std::list ExchangePlugin_Tools::split(const std::string& theString, return theResult; } -std::string ExchangePlugin_Tools::selectionType2xaoDimension(const std::string& theType) -{ +std::string +ExchangePlugin_Tools::selectionType2xaoDimension(const std::string &theType) { if (theType == "Vertices" || theType == "vertex" || theType == "VERTEX") return "vertex"; else if (theType == "Edges" || theType == "edge" || theType == "EDGE") @@ -47,8 +48,8 @@ std::string ExchangePlugin_Tools::selectionType2xaoDimension(const std::string& return std::string(); } -std::string ExchangePlugin_Tools::xaoDimension2selectionType(const std::string& theDimension) -{ +std::string ExchangePlugin_Tools::xaoDimension2selectionType( + const std::string &theDimension) { if (theDimension == "vertex") return "vertex"; else if (theDimension == "edge") @@ -61,11 +62,9 @@ std::string ExchangePlugin_Tools::xaoDimension2selectionType(const std::string& return std::string(); } - std::string ExchangePlugin_Tools::valuesType2xaoType( - const ModelAPI_AttributeTables::ValueType& theType) -{ - switch(theType) { + const ModelAPI_AttributeTables::ValueType &theType) { + switch (theType) { case ModelAPI_AttributeTables::BOOLEAN: return "boolean"; case ModelAPI_AttributeTables::INTEGER: @@ -78,8 +77,8 @@ std::string ExchangePlugin_Tools::valuesType2xaoType( return ""; } -ModelAPI_AttributeTables::ValueType ExchangePlugin_Tools::xaoType2valuesType(std::string theType) -{ +ModelAPI_AttributeTables::ValueType +ExchangePlugin_Tools::xaoType2valuesType(std::string theType) { if (theType == "boolean") return ModelAPI_AttributeTables::BOOLEAN; if (theType == "integer") diff --git a/src/ExchangePlugin/ExchangePlugin_Tools.h b/src/ExchangePlugin/ExchangePlugin_Tools.h index 060ca874e..8df840e82 100644 --- a/src/ExchangePlugin/ExchangePlugin_Tools.h +++ b/src/ExchangePlugin/ExchangePlugin_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_TOOLS_H_ @@ -33,19 +34,22 @@ class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Tools { public: /// Splits theString using theDelimiter. - static std::list split(const std::string& theString, + static std::list split(const std::string &theString, char theDelimiter); /// Converts string representation of selection type to XAO dimension. - static std::string selectionType2xaoDimension(const std::string& theString); + static std::string selectionType2xaoDimension(const std::string &theString); /// Converts string representation of XAO dimension to selection type. - static std::string xaoDimension2selectionType(const std::string& theDimension); + static std::string + xaoDimension2selectionType(const std::string &theDimension); /// Converts representation of values type to XAO type. - static std::string valuesType2xaoType(const ModelAPI_AttributeTables::ValueType& theType); + static std::string + valuesType2xaoType(const ModelAPI_AttributeTables::ValueType &theType); /// Converts representation of values type to XAO type. - static ModelAPI_AttributeTables::ValueType xaoType2valuesType(std::string theType); + static ModelAPI_AttributeTables::ValueType + xaoType2valuesType(std::string theType); }; #endif /* EXCHANGEPLUGIN_TOOLS_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.cpp b/src/ExchangePlugin/ExchangePlugin_Validators.cpp index 4af768c74..e5935942a 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Validators.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,19 +24,19 @@ #include +#include +#include #include #include #include -#include -#include +#include #include #include -#include -bool ExchangePlugin_FormatValidator::parseFormats(const std::list& theArguments, - std::list& outFormats) -{ +bool ExchangePlugin_FormatValidator::parseFormats( + const std::list &theArguments, + std::list &outFormats) { std::list::const_iterator it = theArguments.begin(); bool result = true; for (; it != theArguments.end(); ++it) { @@ -48,32 +49,33 @@ bool ExchangePlugin_FormatValidator::parseFormats(const std::list& std::string aFormats = anArg.substr(0, aSepPos); std::transform(aFormats.begin(), aFormats.end(), aFormats.begin(), [](char c) { return static_cast(::toupper(c)); }); - std::list aFormatList = ExchangePlugin_Tools::split(aFormats, '|'); + std::list aFormatList = + ExchangePlugin_Tools::split(aFormats, '|'); outFormats.insert(outFormats.end(), aFormatList.begin(), aFormatList.end()); } return result; } -bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool ExchangePlugin_FormatValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (!theAttribute->isInitialized()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "%1 is not initialized."; theError.arg(theAttribute->id()); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } const AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(theAttribute); if (!aStrAttr) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "%1 is not a string attribute."; theError.arg(theAttribute->id()); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::string aFileName = aStrAttr->value(); @@ -102,15 +104,14 @@ bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute, return false; } - -bool ExchangePlugin_InHistoryValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool ExchangePlugin_InHistoryValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttrSelection = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttrSelection->context(); if (!aContext.get()) { theError = "Error: Context is empty."; @@ -122,23 +123,26 @@ bool ExchangePlugin_InHistoryValidator::isValid(const AttributePtr& theAttribute theError = "Error: Feature is not in history."; return false; } - } else if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); // All objects should not be result constructions. - for(int anIndex = 0, aSize = anAttrSelectionList->size(); anIndex < aSize; ++anIndex) { - AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); - if(!isValid(anAttrSelection, theArguments, theError)) { + for (int anIndex = 0, aSize = anAttrSelectionList->size(); anIndex < aSize; + ++anIndex) { + AttributeSelectionPtr anAttrSelection = + anAttrSelectionList->value(anIndex); + if (!isValid(anAttrSelection, theArguments, theError)) { return false; } } } else { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Attribute \"%1\" does not supported by this validator."; theError.arg(anAttributeType); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } return true; diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.h b/src/ExchangePlugin/ExchangePlugin_Validators.h index 1d73ae116..96be13a0c 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.h +++ b/src/ExchangePlugin/ExchangePlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef EXCHANGEPLUGIN_VALIDATORS_H @@ -32,23 +33,23 @@ * about which formats are supported and the extension of the associated files. * This validator filters out files that are out of this description. */ -class ExchangePlugin_FormatValidator : public ModelAPI_AttributeValidator -{ +class ExchangePlugin_FormatValidator : public ModelAPI_AttributeValidator { /** * Parses input arguments "BREP:BREPImport", "STEP|STP:STEPImport" * into list of file formats "BREP","STEP","STP" * and list of corresponding plugins: "BREPImport", "STEPImport" */ - static bool parseFormats(const std::list& theArguments, - std::list& outFormats); + static bool parseFormats(const std::list &theArguments, + std::list &outFormats); + public: /** * Returns true is the file-name attribute correctly corresponds to the set of * allowed formats. */ - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /** @@ -56,35 +57,31 @@ public: * \ingroup Validators * \brief Validator for the import format. */ -class ExchangePlugin_ImportFormatValidator : public ExchangePlugin_FormatValidator -{ - -}; +class ExchangePlugin_ImportFormatValidator + : public ExchangePlugin_FormatValidator {}; /** * \class ExchangePlugin_ExportFormatValidator * \ingroup Validators * \brief Validator for the export format. */ -class ExchangePlugin_ExportFormatValidator : public ExchangePlugin_FormatValidator -{ - -}; +class ExchangePlugin_ExportFormatValidator + : public ExchangePlugin_FormatValidator {}; /** - * Check the selected result is in history (avoid Origin and coordinate axes and planes). + * Check the selected result is in history (avoid Origin and coordinate axes + * and planes). */ -class ExchangePlugin_InHistoryValidator : public ModelAPI_AttributeValidator -{ +class ExchangePlugin_InHistoryValidator : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. /// It checks whether the selected object is in history. /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/ExchangePlugin/ExchangePlugin_msg_fr.ts b/src/ExchangePlugin/ExchangePlugin_msg_fr.ts index cd29c1b85..29f33a691 100644 --- a/src/ExchangePlugin/ExchangePlugin_msg_fr.ts +++ b/src/ExchangePlugin/ExchangePlugin_msg_fr.ts @@ -271,7 +271,7 @@ - Export:stl_file_type + Export:stl_file_type File type type du fichier @@ -411,7 +411,7 @@ STEP options Options STEP - + ImportMacro:ImportType diff --git a/src/ExchangePlugin/Test/CMakeLists.txt b/src/ExchangePlugin/Test/CMakeLists.txt index db0da687e..ed8f3ff17 100755 --- a/src/ExchangePlugin/Test/CMakeLists.txt +++ b/src/ExchangePlugin/Test/CMakeLists.txt @@ -24,17 +24,17 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ExchangePlugin") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "${tfile}") endforeach(tfile ${TEST_NAMES}) - + # tests which require SALOME GUI include(tests_gui.set) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) diff --git a/src/ExchangePlugin/Test/tests_gui.set b/src/ExchangePlugin/Test/tests_gui.set index daa28cd08..2978d5273 100755 --- a/src/ExchangePlugin/Test/tests_gui.set +++ b/src/ExchangePlugin/Test/tests_gui.set @@ -21,4 +21,4 @@ SET(TEST_WITH_GUI_NAMES TestImportImage_1.py TestImportImage_2.py TestImportImage_3.py -) \ No newline at end of file +) diff --git a/src/ExchangePlugin/doc/TUI_exportFeature.rst b/src/ExchangePlugin/doc/TUI_exportFeature.rst index 4ef25d686..0a0fda318 100644 --- a/src/ExchangePlugin/doc/TUI_exportFeature.rst +++ b/src/ExchangePlugin/doc/TUI_exportFeature.rst @@ -8,7 +8,7 @@ Export File :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` .. _tui_export_file_STL: @@ -19,6 +19,4 @@ Export STL File :linenos: :language: python -:download:`Download this script ` - - +:download:`Download this script ` diff --git a/src/ExchangePlugin/doc/TUI_exportPart.rst b/src/ExchangePlugin/doc/TUI_exportPart.rst index 58e70a79a..39b5b1938 100644 --- a/src/ExchangePlugin/doc/TUI_exportPart.rst +++ b/src/ExchangePlugin/doc/TUI_exportPart.rst @@ -8,5 +8,4 @@ Export File :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/ExchangePlugin/doc/TUI_importFeature.rst b/src/ExchangePlugin/doc/TUI_importFeature.rst index ff000831f..b020b5b4a 100644 --- a/src/ExchangePlugin/doc/TUI_importFeature.rst +++ b/src/ExchangePlugin/doc/TUI_importFeature.rst @@ -8,8 +8,8 @@ Import File :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` + .. _tui_import_file_step: Import STEP File diff --git a/src/ExchangePlugin/doc/dumpFeature.rst b/src/ExchangePlugin/doc/dumpFeature.rst index 515271509..c30dceedd 100644 --- a/src/ExchangePlugin/doc/dumpFeature.rst +++ b/src/ExchangePlugin/doc/dumpFeature.rst @@ -23,9 +23,9 @@ In this panel it is necessary to enter a file name directly or press **'...'** b :align: center **Dump file dialog box** - + **Apply** button writes the dump file. - + **Cancel** button cancels the operation. **TUI Command**: Is not supported. diff --git a/src/ExchangePlugin/doc/exportFeature.rst b/src/ExchangePlugin/doc/exportFeature.rst index 072c9495a..decc5c54d 100644 --- a/src/ExchangePlugin/doc/exportFeature.rst +++ b/src/ExchangePlugin/doc/exportFeature.rst @@ -47,7 +47,7 @@ If the PartSet is active, only results (construction elements) of this PartSet m **Apply** button exports the file. - + **Cancel** button cancels the operation. **TUI Command**: @@ -80,7 +80,7 @@ The following property panel will be opened: **Export property panel** -In this panel, it is necessary to select desirable format of export file. It can be **'BREP, STEP, IGES'** , **'XAO'** or **'STL'** . +In this panel, it is necessary to select desirable format of export file. It can be **'BREP, STEP, IGES'** , **'XAO'** or **'STL'** . Export to BREP, STEP, IGES @@ -98,7 +98,7 @@ Selection list in the property panel contains a list of exported objects which c *Note*: For XAO format, selection list is not available, the whole part is exported. **Apply** button exports the file. - + **Cancel** button cancels the operation. **TUI Command**: @@ -148,11 +148,11 @@ The file name and path can be defined in **Export file** field by direct input **Object** field contains an exported object which can be selected in a viewer or object browser. -**Deflection** (**Relative** or **Absolute**) has to be chosen and defined in the corresponding field as well as the **File type** which can defined as **Binary** or as **ASCII**. +**Deflection** (**Relative** or **Absolute**) has to be chosen and defined in the corresponding field as well as the **File type** which can defined as **Binary** or as **ASCII**. **Apply** button exports the file. - + **Cancel** button cancels the operation. **TUI Command**: @@ -165,7 +165,7 @@ The file name and path can be defined in **Export file** field by direct input :param real: value of the relative deflection :param real: value of the absolute deflection :param boolean: indicate if use deflection relative - :param boolean: indicate if the file is in ASCII type + :param boolean: indicate if the file is in ASCII type Result """""" diff --git a/src/ExchangePlugin/doc/importFeature.rst b/src/ExchangePlugin/doc/importFeature.rst index f035ea360..bbb2f6bd7 100644 --- a/src/ExchangePlugin/doc/importFeature.rst +++ b/src/ExchangePlugin/doc/importFeature.rst @@ -40,9 +40,9 @@ In this panel it is possible to enter a file name directly or press **'...'** bu **Dialog box to import Part** The import will be performed within the active part. If no part is active, the possible targets to import will be proposed in **Import to** combobox, which contains the list of existing parts, PartSet or a new part creation option. - + **Apply** button imports the file. - + **Cancel** button cancels the operation. **TUI Command**: @@ -79,9 +79,9 @@ In this panel it is possible to enter a file name directly or press **'...'** bu Import BREP, XAO, IGES """""""""""""""""""""" In case of first choice the format of imported file will be defined according to file extension. - + **Apply** button imports the file. - + **Cancel** button cancels the operation. **TUI Command**: diff --git a/src/FeaturesAPI/FeaturesAPI.h b/src/FeaturesAPI/FeaturesAPI.h index bbb243843..fd03b0c1b 100644 --- a/src/FeaturesAPI/FeaturesAPI.h +++ b/src/FeaturesAPI/FeaturesAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESAPI_H @@ -22,13 +23,13 @@ #if defined FEATURESAPI_EXPORTS #if defined WIN32 -#define FEATURESAPI_EXPORT __declspec( dllexport ) +#define FEATURESAPI_EXPORT __declspec(dllexport) #else #define FEATURESAPI_EXPORT #endif #else #if defined WIN32 -#define FEATURESAPI_EXPORT __declspec( dllimport ) +#define FEATURESAPI_EXPORT __declspec(dllimport) #else #define FEATURESAPI_EXPORT #endif diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp index e7ad27b67..1fdabbed3 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_BooleanCommon.h" @@ -23,27 +24,24 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod)); + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), + VAR_NAME(creationMethod)); fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -61,14 +59,14 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( //================================================================================================== FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), + VAR_NAME(creationMethod)); fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -86,15 +84,11 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( } //================================================================================================== -FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() -{ -} - +FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() {} //================================================================================================== void FeaturesAPI_BooleanCommon::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); @@ -102,61 +96,64 @@ void FeaturesAPI_BooleanCommon::setMainObjects( //================================================================================================== void FeaturesAPI_BooleanCommon::setToolObjects( - const std::list& theToolObjects) -{ - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + const std::list &theToolObjects) { + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), + VAR_NAME(creationMethod)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_BooleanCommon::setFuzzyValue( + const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCommon::setAdvancedMode(const bool theMode) -{ +void FeaturesAPI_BooleanCommon::setAdvancedMode(const bool theMode) { if (theMode) { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), + VAR_NAME(creationMethod)); } else { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod)); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), + VAR_NAME(creationMethod)); } execute(); } //================================================================================================== -void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); theDumper << aBase << " = model.addCommon"; - const std::string& aDocName = theDumper.name(aBase->document()); - AttributeStringPtr aMode = aBase->string(FeaturesPlugin_BooleanCommon::CREATION_METHOD()); + const std::string &aDocName = theDumper.name(aBase->document()); + AttributeStringPtr aMode = + aBase->string(FeaturesPlugin_BooleanCommon::CREATION_METHOD()); AttributeSelectionListPtr anObjects = - aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = - aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanCommon::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_BooleanCommon::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID()); theDumper << "(" << aDocName << ", " << anObjects; - if (aMode->value() == FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED()) { + if (aMode->value() == + FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED()) { theDumper << ", " << aTools; } @@ -170,19 +167,21 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -BooleanCommonPtr addCommon(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID()); +BooleanCommonPtr +addCommon(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy, const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_BooleanCommon::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); BooleanCommonPtr aCommon; if (theToolObjects.empty()) - aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theFuzzy)); + aCommon.reset( + new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theFuzzy)); else - aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theToolObjects, theFuzzy)); + aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, + theToolObjects, theFuzzy)); return aCommon; } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h index 1fa452171..bc5222b95 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_BooleanCommon_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Integer; class ModelHighAPI_Selection; @@ -34,49 +35,52 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_BooleanCommon /// \ingroup CPPHighAPI /// \brief Interface for Boolean Common feature. -class FeaturesAPI_BooleanCommon: public ModelHighAPI_Interface -{ +class FeaturesAPI_BooleanCommon : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_BooleanCommon(const std::shared_ptr& theFeature); + explicit FeaturesAPI_BooleanCommon( + const std::shared_ptr &theFeature); - /// Constructor with values. + /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanCommon(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanCommon( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanCommon(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanCommon( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanCommon(); - INTERFACE_5(FeaturesPlugin_BooleanCommon::ID(), - creationMethod, FeaturesPlugin_BooleanCommon::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - mainObjects, FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - toolObjects, FeaturesPlugin_BooleanCommon::TOOL_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Tool objects*/, - useFuzzy, FeaturesPlugin_BooleanCommon::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter*/) + INTERFACE_5(FeaturesPlugin_BooleanCommon::ID(), creationMethod, + FeaturesPlugin_BooleanCommon::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, mainObjects, + FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, + FeaturesPlugin_BooleanCommon::TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Tool objects*/, useFuzzy, + FeaturesPlugin_BooleanCommon::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter*/) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set tool objects. FEATURESAPI_EXPORT - void setToolObjects(const std::list& theToolObjects); + void setToolObjects(const std::list &theToolObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -84,7 +88,7 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Set mode. FEATURESAPI_EXPORT @@ -92,7 +96,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Boolean object. @@ -100,11 +104,12 @@ typedef std::shared_ptr BooleanCommonPtr; /// \ingroup CPPHighAPI /// \brief Create Boolean Common feature. -FEATURESAPI_EXPORT BooleanCommonPtr addCommon( - const std::shared_ptr& part, - const std::list& objects, - const std::list& tools = std::list(), - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +FEATURESAPI_EXPORT BooleanCommonPtr +addCommon(const std::shared_ptr &part, + const std::list &objects, + const std::list &tools = + std::list(), + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_BooleanCommon_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp index 66b7ab2d6..d6d98a987 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_BooleanCut.h" @@ -23,26 +24,23 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== -FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -60,57 +58,54 @@ FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut( } //================================================================================================== -FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut() -{ -} - +FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut() {} //================================================================================================== -void FeaturesAPI_BooleanCut::setMainObjects(const std::list& theMainObjects) -{ +void FeaturesAPI_BooleanCut::setMainObjects( + const std::list &theMainObjects) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCut::setToolObjects(const std::list& theToolObjects) -{ +void FeaturesAPI_BooleanCut::setToolObjects( + const std::list &theToolObjects) { fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCut::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_BooleanCut::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCut::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_BooleanCut::setFuzzyValue( + const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); theDumper << aBase << " = model.addCut"; - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anObjects = - aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = - aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanCut::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_BooleanCut::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_BooleanCut::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_BooleanCut::FUZZY_PARAM_ID()); theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; @@ -124,14 +119,15 @@ void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -BooleanCutPtr addCut(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID()); +BooleanCutPtr addCut(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_BooleanCut::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature, theMainObjects, theToolObjects, theFuzzy)); + return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature, theMainObjects, + theToolObjects, theFuzzy)); } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h index 6324131e4..47b3aaeb3 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_BooleanCut_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Integer; class ModelHighAPI_Selection; @@ -34,41 +35,43 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_BooleanCut /// \ingroup CPPHighAPI /// \brief Interface for Boolean Cut feature. -class FeaturesAPI_BooleanCut: public ModelHighAPI_Interface -{ +class FeaturesAPI_BooleanCut : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_BooleanCut(const std::shared_ptr& theFeature); + explicit FeaturesAPI_BooleanCut( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanCut(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanCut( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanCut(); - INTERFACE_4(FeaturesPlugin_BooleanCut::ID(), - mainObjects, FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - toolObjects, FeaturesPlugin_BooleanCut::TOOL_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Tool objects*/, - useFuzzy, FeaturesPlugin_BooleanCut::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_BooleanCut::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_4(FeaturesPlugin_BooleanCut::ID(), mainObjects, + FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, + FeaturesPlugin_BooleanCut::TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Tool objects*/, useFuzzy, + FeaturesPlugin_BooleanCut::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_BooleanCut::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set tool objects. FEATURESAPI_EXPORT - void setToolObjects(const std::list& theToolObjects); + void setToolObjects(const std::list &theToolObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -76,11 +79,11 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Boolean object. @@ -89,10 +92,11 @@ typedef std::shared_ptr BooleanCutPtr; /// \ingroup CPPHighAPI /// \brief Create Boolean Cut feature. FEATURESAPI_EXPORT -BooleanCutPtr addCut(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +BooleanCutPtr +addCut(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_BooleanCut_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp index 83e380b8c..38caf1c46 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_BooleanFill.h" @@ -23,27 +24,23 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -61,15 +58,11 @@ FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( } //================================================================================================== -FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill() -{ -} - +FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill() {} //================================================================================================== void FeaturesAPI_BooleanFill::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); @@ -77,43 +70,42 @@ void FeaturesAPI_BooleanFill::setMainObjects( //================================================================================================== void FeaturesAPI_BooleanFill::setToolObjects( - const std::list& theToolObjects) -{ + const std::list &theToolObjects) { fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFill::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_BooleanFill::setFuzzyValue( + const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); theDumper << aBase << " = model.addSplit"; - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anObjects = - aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = - aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanFill::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_BooleanFill::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID()); theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; @@ -127,14 +119,15 @@ void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -BooleanFillPtr addSplit(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID()); +BooleanFillPtr addSplit(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_BooleanFill::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature, theMainObjects, theToolObjects, theFuzzy)); + return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature, theMainObjects, + theToolObjects, theFuzzy)); } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h index ee5dcadea..f3f913220 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_BooleanFill_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Integer; class ModelHighAPI_Selection; @@ -34,41 +35,43 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_BooleanFill /// \ingroup CPPHighAPI /// \brief Interface for Boolean Fill feature. -class FeaturesAPI_BooleanFill: public ModelHighAPI_Interface -{ +class FeaturesAPI_BooleanFill : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_BooleanFill(const std::shared_ptr& theFeature); + explicit FeaturesAPI_BooleanFill( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanFill(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanFill( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanFill(); - INTERFACE_4(FeaturesPlugin_BooleanFill::ID(), - mainObjects, FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - toolObjects, FeaturesPlugin_BooleanFill::TOOL_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Tool objects*/, - useFuzzy, FeaturesPlugin_BooleanFill::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_4(FeaturesPlugin_BooleanFill::ID(), mainObjects, + FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, + FeaturesPlugin_BooleanFill::TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Tool objects*/, useFuzzy, + FeaturesPlugin_BooleanFill::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set tool objects. FEATURESAPI_EXPORT - void setToolObjects(const std::list& theToolObjects); + void setToolObjects(const std::list &theToolObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -76,11 +79,11 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Boolean object. @@ -89,10 +92,11 @@ typedef std::shared_ptr BooleanFillPtr; /// \ingroup CPPHighAPI /// \brief Create Boolean Fill feature. FEATURESAPI_EXPORT -BooleanFillPtr addSplit(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +BooleanFillPtr +addSplit(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_BooleanFill_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp index dee597779..4b989d0a9 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_BooleanFuse.h" @@ -23,28 +24,24 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const bool theRemoveEdges, - const ModelHighAPI_Double& theFuzzy) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const bool theRemoveEdges, const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod)); + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), + VAR_NAME(creationMethod)); fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theRemoveEdges, VAR_NAME(removeEdges)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -63,15 +60,14 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( //================================================================================================== FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const bool theRemoveEdges, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const bool theRemoveEdges, const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), + VAR_NAME(creationMethod)); fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); fillAttribute(theRemoveEdges, VAR_NAME(removeEdges)); @@ -90,15 +86,11 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( } //================================================================================================== -FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse() -{ -} - +FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse() {} //================================================================================================== void FeaturesAPI_BooleanFuse::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); @@ -106,71 +98,73 @@ void FeaturesAPI_BooleanFuse::setMainObjects( //================================================================================================== void FeaturesAPI_BooleanFuse::setToolObjects( - const std::list& theToolObjects) -{ - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + const std::list &theToolObjects) { + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), + VAR_NAME(creationMethod)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges) -{ +void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges) { fillAttribute(theRemoveEdges, VAR_NAME(removeEdges)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFuse::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_BooleanFuse::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFuse::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_BooleanFuse::setFuzzyValue( + const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanFuse::setAdvancedMode(const bool theMode) -{ +void FeaturesAPI_BooleanFuse::setAdvancedMode(const bool theMode) { if (theMode) { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), + VAR_NAME(creationMethod)); } else { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod)); + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), + VAR_NAME(creationMethod)); } execute(); } //================================================================================================== -void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); theDumper << aBase << " = model.addFuse"; - const std::string& aDocName = theDumper.name(aBase->document()); - AttributeStringPtr aMode = aBase->string(FeaturesPlugin_BooleanFuse::CREATION_METHOD()); + const std::string &aDocName = theDumper.name(aBase->document()); + AttributeStringPtr aMode = + aBase->string(FeaturesPlugin_BooleanFuse::CREATION_METHOD()); AttributeSelectionListPtr anObjects = - aBase->selectionList(FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = - aBase->selectionList(FeaturesPlugin_BooleanFuse::TOOL_LIST_ID()); - AttributeBooleanPtr aRemoveEdges = - aBase->boolean(FeaturesPlugin_BooleanFuse::REMOVE_INTERSECTION_EDGES_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanFuse::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_BooleanFuse::TOOL_LIST_ID()); + AttributeBooleanPtr aRemoveEdges = aBase->boolean( + FeaturesPlugin_BooleanFuse::REMOVE_INTERSECTION_EDGES_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_BooleanFuse::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID()); theDumper << "(" << aDocName << ", " << anObjects; - if (aMode->value() == FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED()) { + if (aMode->value() == + FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED()) { theDumper << ", " << aTools; } @@ -188,14 +182,14 @@ void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -BooleanFusePtr addFuse(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::pair, bool>& theToolObjects, - const bool theRemoveEdges, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID()); +BooleanFusePtr addFuse( + const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::pair, bool> &theToolObjects, + const bool theRemoveEdges, const ModelHighAPI_Double &theFuzzy, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_BooleanFuse::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); @@ -205,10 +199,12 @@ BooleanFusePtr addFuse(const std::shared_ptr& thePart, BooleanFusePtr aFuse; if (theToolObjects.first.empty()) - aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, aRemoveEdges, theFuzzy)); - else { - aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, theToolObjects.first, + aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, aRemoveEdges, theFuzzy)); + else { + aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, + theToolObjects.first, aRemoveEdges, + theFuzzy)); } return aFuse; } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h index 3dfd69c0e..c91e952a7 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_BooleanFuse_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Integer; class ModelHighAPI_Selection; @@ -34,53 +35,56 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_BooleanFuse /// \ingroup CPPHighAPI /// \brief Interface for Boolean Fuse feature. -class FeaturesAPI_BooleanFuse: public ModelHighAPI_Interface -{ +class FeaturesAPI_BooleanFuse : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_BooleanFuse(const std::shared_ptr& theFeature); + explicit FeaturesAPI_BooleanFuse( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanFuse(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const bool theRemoveEdges = false, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanFuse( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const bool theRemoveEdges = false, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanFuse(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const bool theRemoveEdges = false, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanFuse( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const bool theRemoveEdges = false, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanFuse(); - INTERFACE_6(FeaturesPlugin_BooleanFuse::ID(), - creationMethod, FeaturesPlugin_BooleanFuse::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - mainObjects, FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - toolObjects, FeaturesPlugin_BooleanFuse::TOOL_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Tool objects*/, - removeEdges, FeaturesPlugin_BooleanFuse::REMOVE_INTERSECTION_EDGES_ID(), - ModelAPI_AttributeBoolean, /** Remove edges */, - useFuzzy, FeaturesPlugin_BooleanFuse::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_6(FeaturesPlugin_BooleanFuse::ID(), creationMethod, + FeaturesPlugin_BooleanFuse::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, mainObjects, + FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, + FeaturesPlugin_BooleanFuse::TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Tool objects*/, removeEdges, + FeaturesPlugin_BooleanFuse::REMOVE_INTERSECTION_EDGES_ID(), + ModelAPI_AttributeBoolean, /** Remove edges */, useFuzzy, + FeaturesPlugin_BooleanFuse::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set tool objects. FEATURESAPI_EXPORT - void setToolObjects(const std::list& theToolObjects); + void setToolObjects(const std::list &theToolObjects); /// Set remove edges. FEATURESAPI_EXPORT @@ -92,7 +96,7 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Set mode. FEATURESAPI_EXPORT @@ -100,23 +104,25 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Boolean object. typedef std::shared_ptr BooleanFusePtr; -#define DUMMY_TOOLS std::pair, bool>\ - (std::list(), false) +#define DUMMY_TOOLS \ + std::pair, bool>( \ + std::list(), false) /// \ingroup CPPHighAPI /// \brief Create Boolean Fuse feature. -FEATURESAPI_EXPORT BooleanFusePtr addFuse( - const std::shared_ptr& part, - const std::list& objects, - const std::pair, bool>& tools = DUMMY_TOOLS, - const bool removeEdges = false, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +FEATURESAPI_EXPORT BooleanFusePtr +addFuse(const std::shared_ptr &part, + const std::list &objects, + const std::pair, bool> &tools = + DUMMY_TOOLS, + const bool removeEdges = false, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_BooleanFuse_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp index 858f8b70c..b03f187de 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_BooleanSmash.h" @@ -23,27 +24,23 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); fillAttribute(theToolObjects, VAR_NAME(toolObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -61,15 +58,11 @@ FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash( } //================================================================================================== -FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash() -{ -} - +FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash() {} //================================================================================================== void FeaturesAPI_BooleanSmash::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); @@ -77,43 +70,42 @@ void FeaturesAPI_BooleanSmash::setMainObjects( //================================================================================================== void FeaturesAPI_BooleanSmash::setToolObjects( - const std::list& theToolObjects) -{ + const std::list &theToolObjects) { fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanSmash::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_BooleanSmash::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanSmash::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_BooleanSmash::setFuzzyValue( + const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); theDumper << aBase << " = model.addSmash"; - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anObjects = - aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = - aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanSmash::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_BooleanSmash::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_BooleanSmash::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_BooleanSmash::FUZZY_PARAM_ID()); theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; @@ -127,14 +119,15 @@ void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -BooleanSmashPtr addSmash(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanSmash::ID()); +BooleanSmashPtr +addSmash(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy, const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_BooleanSmash::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature, theMainObjects, theToolObjects, theFuzzy)); + return BooleanSmashPtr(new FeaturesAPI_BooleanSmash( + aFeature, theMainObjects, theToolObjects, theFuzzy)); } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h index d710105b7..0837d4d74 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_BooleanSmash_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Integer; class ModelHighAPI_Selection; @@ -34,41 +35,43 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_BooleanSmash /// \ingroup CPPHighAPI /// \brief Interface for Boolean Smash feature. -class FeaturesAPI_BooleanSmash: public ModelHighAPI_Interface -{ +class FeaturesAPI_BooleanSmash : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_BooleanSmash(const std::shared_ptr& theFeature); + explicit FeaturesAPI_BooleanSmash( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_BooleanSmash(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + FeaturesAPI_BooleanSmash( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanSmash(); - INTERFACE_4(FeaturesPlugin_BooleanSmash::ID(), - mainObjects, FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - toolObjects, FeaturesPlugin_BooleanSmash::TOOL_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Tool objects*/, - useFuzzy, FeaturesPlugin_BooleanSmash::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_BooleanSmash::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_4(FeaturesPlugin_BooleanSmash::ID(), mainObjects, + FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, + FeaturesPlugin_BooleanSmash::TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Tool objects*/, useFuzzy, + FeaturesPlugin_BooleanSmash::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_BooleanSmash::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set tool objects. FEATURESAPI_EXPORT - void setToolObjects(const std::list& theToolObjects); + void setToolObjects(const std::list &theToolObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -76,11 +79,11 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Boolean object. @@ -89,10 +92,11 @@ typedef std::shared_ptr BooleanSmashPtr; /// \ingroup CPPHighAPI /// \brief Create Boolean Smash feature. FEATURESAPI_EXPORT -BooleanSmashPtr addSmash(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +BooleanSmashPtr +addSmash(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const std::list &theToolObjects, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_BooleanSmash_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp b/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp index 05dc4a847..e629ae671 100644 --- a/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_BoundingBox.h" @@ -30,18 +31,16 @@ //================================================================================================= FeaturesAPI_BoundingBox::FeaturesAPI_BoundingBox( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================= FeaturesAPI_BoundingBox::FeaturesAPI_BoundingBox( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject) -:ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theObject, myobjectSelected); execute(); @@ -49,31 +48,27 @@ FeaturesAPI_BoundingBox::FeaturesAPI_BoundingBox( } //================================================================================================= -FeaturesAPI_BoundingBox::~FeaturesAPI_BoundingBox() -{ -} +FeaturesAPI_BoundingBox::~FeaturesAPI_BoundingBox() {} //================================================================================================= -void FeaturesAPI_BoundingBox::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_BoundingBox::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrObject; - anAttrObject = aBase->selection(FeaturesPlugin_BoundingBox::OBJECT_ID()); + anAttrObject = aBase->selection(FeaturesPlugin_BoundingBox::OBJECT_ID()); - theDumper << aBase << " = model.getBoundingBox(" << aDocName << ", " << anAttrObject; + theDumper << aBase << " = model.getBoundingBox(" << aDocName << ", " + << anAttrObject; theDumper << ")" << std::endl; } //================================================================================================= -BoundingBoxPtr getBoundingBox(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject) -{ +BoundingBoxPtr getBoundingBox(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject) { - FeaturePtr aFeature = - thePart->addFeature(FeaturesPlugin_BoundingBox::ID()); + FeaturePtr aFeature = thePart->addFeature(FeaturesPlugin_BoundingBox::ID()); BoundingBoxPtr aBoundingBox; diff --git a/src/FeaturesAPI/FeaturesAPI_BoundingBox.h b/src/FeaturesAPI/FeaturesAPI_BoundingBox.h index a12b1800f..737001dfd 100644 --- a/src/FeaturesAPI/FeaturesAPI_BoundingBox.h +++ b/src/FeaturesAPI/FeaturesAPI_BoundingBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_BoundingBox_H_ @@ -35,29 +36,30 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_NormalToFace /// \ingroup CPPHighAPI /// \brief Interface for NormalToface feature. -class FeaturesAPI_BoundingBox: public ModelHighAPI_Interface -{ +class FeaturesAPI_BoundingBox : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_BoundingBox(const std::shared_ptr& theFeature); + explicit FeaturesAPI_BoundingBox( + const std::shared_ptr &theFeature); FEATURESAPI_EXPORT - explicit FeaturesAPI_BoundingBox(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject); + explicit FeaturesAPI_BoundingBox( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BoundingBox(); - INTERFACE_1(FeaturesPlugin_BoundingBox::ID(), - objectSelected, FeaturesPlugin_BoundingBox::OBJECT_ID(), - ModelAPI_AttributeSelection, /** object selected*/) + INTERFACE_1(FeaturesPlugin_BoundingBox::ID(), objectSelected, + FeaturesPlugin_BoundingBox::OBJECT_ID(), + ModelAPI_AttributeSelection, + /** object selected*/) /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; - + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on the NormalToface object. @@ -68,7 +70,7 @@ typedef std::shared_ptr BoundingBoxPtr; /// \param thePart the part /// \param theobject the object selected FEATURESAPI_EXPORT -BoundingBoxPtr getBoundingBox(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject); +BoundingBoxPtr getBoundingBox(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject); #endif // FeaturesAPI_BoundingBox_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp b/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp index a534f7cea..f067a3795 100644 --- a/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Chamfer.h" @@ -23,27 +24,28 @@ #include #include -FeaturesAPI_Chamfer::FeaturesAPI_Chamfer(const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Chamfer::FeaturesAPI_Chamfer( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } -FeaturesAPI_Chamfer::FeaturesAPI_Chamfer(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool performDistances, - const ModelHighAPI_Double& theVal1, - const ModelHighAPI_Double& theVal2) - : ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Chamfer::FeaturesAPI_Chamfer( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool performDistances, const ModelHighAPI_Double &theVal1, + const ModelHighAPI_Double &theVal2) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); if (performDistances) { - fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_DISTANCE(), mycreationMethod); + fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_DISTANCE(), + mycreationMethod); fillAttribute(theVal1, myd1); fillAttribute(theVal2, myd2); } else { - fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_ANGLE(), mycreationMethod); + fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_ANGLE(), + mycreationMethod); fillAttribute(theVal1, myd); fillAttribute(theVal2, myangle); } @@ -52,58 +54,60 @@ FeaturesAPI_Chamfer::FeaturesAPI_Chamfer(const std::shared_ptr } } -FeaturesAPI_Chamfer::~FeaturesAPI_Chamfer() -{ -} +FeaturesAPI_Chamfer::~FeaturesAPI_Chamfer() {} //================================================================================================== -void FeaturesAPI_Chamfer::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_Chamfer::setBase( + const std::list &theBaseObjects) { mybaseObjects->clear(); fillAttribute(theBaseObjects, mybaseObjects); execIfBaseNotEmpty(); } -void FeaturesAPI_Chamfer::setDistances(const ModelHighAPI_Double& theD1, - const ModelHighAPI_Double& theD2) -{ - fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_DISTANCE(), mycreationMethod); +void FeaturesAPI_Chamfer::setDistances(const ModelHighAPI_Double &theD1, + const ModelHighAPI_Double &theD2) { + fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_DISTANCE(), + mycreationMethod); fillAttribute(theD1, myd1); fillAttribute(theD2, myd2); execIfBaseNotEmpty(); } -void FeaturesAPI_Chamfer::setDistAngle(const ModelHighAPI_Double& theDistance, - const ModelHighAPI_Double& theAngle) -{ - fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_ANGLE(), mycreationMethod); +void FeaturesAPI_Chamfer::setDistAngle(const ModelHighAPI_Double &theDistance, + const ModelHighAPI_Double &theAngle) { + fillAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_ANGLE(), + mycreationMethod); fillAttribute(theDistance, myd); fillAttribute(theAngle, myangle); execIfBaseNotEmpty(); } -void FeaturesAPI_Chamfer::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Chamfer::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Chamfer::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_Chamfer::OBJECT_LIST_ID()); - theDumper << aBase << " = model.addChamfer(" << aDocName << ", " << anAttrObjects; + theDumper << aBase << " = model.addChamfer(" << aDocName << ", " + << anAttrObjects; - std::string aCreationMethod = aBase->string(FeaturesPlugin_Chamfer::CREATION_METHOD())->value(); + std::string aCreationMethod = + aBase->string(FeaturesPlugin_Chamfer::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_DISTANCE()) { + if (aCreationMethod == + FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_DISTANCE()) { AttributeDoublePtr anAttrD1 = aBase->real(FeaturesPlugin_Chamfer::D1_ID()); AttributeDoublePtr anAttrD2 = aBase->real(FeaturesPlugin_Chamfer::D2_ID()); theDumper << ", True, " << anAttrD1 << ", " << anAttrD2; - } else if(aCreationMethod == FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_ANGLE()) { + } else if (aCreationMethod == + FeaturesPlugin_Chamfer::CREATION_METHOD_DISTANCE_ANGLE()) { AttributeDoublePtr anAttrD = aBase->real(FeaturesPlugin_Chamfer::D_ID()); - AttributeDoublePtr anAttrAngle = aBase->real(FeaturesPlugin_Chamfer::ANGLE_ID()); + AttributeDoublePtr anAttrAngle = + aBase->real(FeaturesPlugin_Chamfer::ANGLE_ID()); theDumper << ", False, " << anAttrD << ", " << anAttrAngle; } @@ -113,25 +117,23 @@ void FeaturesAPI_Chamfer::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ")" << std::endl; } -void FeaturesAPI_Chamfer::execIfBaseNotEmpty() -{ +void FeaturesAPI_Chamfer::execIfBaseNotEmpty() { if (mybaseObjects->size() > 0) execute(); } - //================================================================================================== -ChamferPtr addChamfer(const std::shared_ptr& thePart, - const std::list& theBaseObjects, +ChamferPtr addChamfer(const std::shared_ptr &thePart, + const std::list &theBaseObjects, const bool performDistances, - const ModelHighAPI_Double& theVal1, - const ModelHighAPI_Double& theVal2, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Chamfer::ID()); + const ModelHighAPI_Double &theVal1, + const ModelHighAPI_Double &theVal2, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Chamfer::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return ChamferPtr(new FeaturesAPI_Chamfer(aFeature, theBaseObjects, performDistances, - theVal1, theVal2)); + return ChamferPtr(new FeaturesAPI_Chamfer( + aFeature, theBaseObjects, performDistances, theVal1, theVal2)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Chamfer.h b/src/FeaturesAPI/FeaturesAPI_Chamfer.h index a2fd78ff3..45cc3c20b 100644 --- a/src/FeaturesAPI/FeaturesAPI_Chamfer.h +++ b/src/FeaturesAPI/FeaturesAPI_Chamfer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Chamfer_H_ @@ -33,60 +34,58 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Chamfer /// \ingroup CPPHighAPI /// \brief Interface for Chamfer feature. -class FeaturesAPI_Chamfer: public ModelHighAPI_Interface -{ +class FeaturesAPI_Chamfer : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Chamfer(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Chamfer( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Chamfer(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const bool performDistances, - const ModelHighAPI_Double& aVal1, - const ModelHighAPI_Double& aVal2); + explicit FeaturesAPI_Chamfer( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const bool performDistances, const ModelHighAPI_Double &aVal1, + const ModelHighAPI_Double &aVal2); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Chamfer(); - INTERFACE_6(FeaturesPlugin_Chamfer::ID(), - creationMethod, FeaturesPlugin_Chamfer::CREATION_METHOD(), - ModelAPI_AttributeString, - /** Creation method */, - baseObjects, FeaturesPlugin_Chamfer::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, - /** Base objects */, - d1, FeaturesPlugin_Chamfer::D1_ID(), - ModelAPI_AttributeDouble, - /** Value of the first distance chamfer */, - d2, FeaturesPlugin_Chamfer::D2_ID(), - ModelAPI_AttributeDouble, - /** Value of the second distance chamfer */, - d, FeaturesPlugin_Chamfer::D_ID(), - ModelAPI_AttributeDouble, - /** Value of the distance chamfer */, - angle, FeaturesPlugin_Chamfer::ANGLE_ID(), - ModelAPI_AttributeDouble, - /** Angle chamfer */) + INTERFACE_6(FeaturesPlugin_Chamfer::ID(), creationMethod, + FeaturesPlugin_Chamfer::CREATION_METHOD(), + ModelAPI_AttributeString, + /** Creation method */, baseObjects, + FeaturesPlugin_Chamfer::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */, d1, FeaturesPlugin_Chamfer::D1_ID(), + ModelAPI_AttributeDouble, + /** Value of the first distance chamfer */, d2, + FeaturesPlugin_Chamfer::D2_ID(), ModelAPI_AttributeDouble, + /** Value of the second distance chamfer */, d, + FeaturesPlugin_Chamfer::D_ID(), ModelAPI_AttributeDouble, + /** Value of the distance chamfer */, angle, + FeaturesPlugin_Chamfer::ANGLE_ID(), ModelAPI_AttributeDouble, + /** Angle chamfer */) /// Modify base objects of the chamfer. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Modify chamfer to have two distances FEATURESAPI_EXPORT - void setDistances(const ModelHighAPI_Double& theD1, const ModelHighAPI_Double& theD2); + void setDistances(const ModelHighAPI_Double &theD1, + const ModelHighAPI_Double &theD2); /// Modify chamfer to have distance and angle FEATURESAPI_EXPORT - void setDistAngle(const ModelHighAPI_Double& theDistance, const ModelHighAPI_Double& theAngle); + void setDistAngle(const ModelHighAPI_Double &theDistance, + const ModelHighAPI_Double &theAngle); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); @@ -98,11 +97,11 @@ typedef std::shared_ptr ChamferPtr; /// \ingroup CPPHighAPI /// \brief Create Chamfer feature. FEATURESAPI_EXPORT -ChamferPtr addChamfer(const std::shared_ptr& thePart, - const std::list& theBaseObjects, +ChamferPtr addChamfer(const std::shared_ptr &thePart, + const std::list &theBaseObjects, const bool performDistances, - const ModelHighAPI_Double& theVal1, - const ModelHighAPI_Double& theVal2, + const ModelHighAPI_Double &theVal1, + const ModelHighAPI_Double &theVal2, const bool keepSubResults = false); #endif // FeaturesAPI_Chamfer_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Copy.cpp b/src/FeaturesAPI/FeaturesAPI_Copy.cpp index 3fd6eb330..b9406b79e 100644 --- a/src/FeaturesAPI/FeaturesAPI_Copy.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Copy.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Copy.h" @@ -23,19 +24,18 @@ #include //================================================================================================ -FeaturesAPI_Copy::FeaturesAPI_Copy(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Copy::FeaturesAPI_Copy( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================ -FeaturesAPI_Copy::FeaturesAPI_Copy(const std::shared_ptr& theFeature, - const std::list& theObjects, - const int theNumber) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Copy::FeaturesAPI_Copy( + const std::shared_ptr &theFeature, + const std::list &theObjects, const int theNumber) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setNumber(theNumber); setObjects(theObjects); } @@ -45,36 +45,35 @@ FeaturesAPI_Copy::FeaturesAPI_Copy(const std::shared_ptr& theF FeaturesAPI_Copy::~FeaturesAPI_Copy() {} //================================================================================================= -void FeaturesAPI_Copy::setObjects(const std::list& theObjects) -{ +void FeaturesAPI_Copy::setObjects( + const std::list &theObjects) { fillAttribute(theObjects, myobjects); execute(); } //================================================================================================= -void FeaturesAPI_Copy::setNumber(const int theNumber) -{ +void FeaturesAPI_Copy::setNumber(const int theNumber) { fillAttribute(theNumber, mynumber); execute(); } //================================================================================================= -void FeaturesAPI_Copy::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Copy::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeSelectionListPtr anObjects = aBase->selectionList(FeaturesPlugin_Copy::OBJECTS()); + AttributeSelectionListPtr anObjects = + aBase->selectionList(FeaturesPlugin_Copy::OBJECTS()); AttributeIntegerPtr aNumber = aBase->integer(FeaturesPlugin_Copy::NUMBER()); - theDumper << aBase << " = model.addCopy(" - << aDocName << ", " << anObjects << ", " << aNumber << ")" << std::endl; + theDumper << aBase << " = model.addCopy(" << aDocName << ", " << anObjects + << ", " << aNumber << ")" << std::endl; } //================================================================================================= -CopyPtr addCopy(const std::shared_ptr& thePart, - const std::list& theObjects, - const int theNumber) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Copy::ID()); +CopyPtr addCopy(const std::shared_ptr &thePart, + const std::list &theObjects, + const int theNumber) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Copy::ID()); return CopyPtr(new FeaturesAPI_Copy(aFeature, theObjects, theNumber)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Copy.h b/src/FeaturesAPI/FeaturesAPI_Copy.h index f7c54cc96..683d96aa7 100644 --- a/src/FeaturesAPI/FeaturesAPI_Copy.h +++ b/src/FeaturesAPI/FeaturesAPI_Copy.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Copy_H_ @@ -33,36 +34,38 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Copy /// \ingroup CPPHighAPI /// \brief Interface for Copy feature. -class FeaturesAPI_Copy: public ModelHighAPI_Interface -{ +class FeaturesAPI_Copy : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Copy(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Copy( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Copy(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const int theNumber); + explicit FeaturesAPI_Copy( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const int theNumber); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Copy(); - INTERFACE_2(FeaturesPlugin_Copy::ID(), - objects, FeaturesPlugin_Copy::OBJECTS(), - ModelAPI_AttributeSelectionList, /** Source objects */, - number, FeaturesPlugin_Copy::NUMBER(), - ModelAPI_AttributeInteger, /** Number of copies */) + INTERFACE_2(FeaturesPlugin_Copy::ID(), objects, + FeaturesPlugin_Copy::OBJECTS(), ModelAPI_AttributeSelectionList, + /** Source objects */, number, FeaturesPlugin_Copy::NUMBER(), + ModelAPI_AttributeInteger, + /** Number of copies */) /// Modify objects attribute of the feature. - FEATURESAPI_EXPORT void setObjects(const std::list& theBaseObjects); + FEATURESAPI_EXPORT void + setObjects(const std::list &theBaseObjects); /// Modify number of copies attribute of the feature. FEATURESAPI_EXPORT void setNumber(const int theNumber); /// Dump wrapped feature - FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; + FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Copy object. @@ -71,8 +74,8 @@ typedef std::shared_ptr CopyPtr; /// \ingroup CPPHighAPI /// \brief Create Copy feature. FEATURESAPI_EXPORT -CopyPtr addCopy(const std::shared_ptr& thePart, - const std::list& theObjects, +CopyPtr addCopy(const std::shared_ptr &thePart, + const std::list &theObjects, const int theNumber); #endif // FeaturesAPI_Copy_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp b/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp index aa3609eac..13966c878 100644 --- a/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Defeaturing.h" @@ -23,57 +24,51 @@ #include FeaturesAPI_Defeaturing::FeaturesAPI_Defeaturing( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } FeaturesAPI_Defeaturing::FeaturesAPI_Defeaturing( - const std::shared_ptr& theFeature, - const std::list& theFacesToRemove) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::list &theFacesToRemove) + : ModelHighAPI_Interface(theFeature) { if (initialize()) setFaces(theFacesToRemove); } -FeaturesAPI_Defeaturing::~FeaturesAPI_Defeaturing() -{ -} +FeaturesAPI_Defeaturing::~FeaturesAPI_Defeaturing() {} -void FeaturesAPI_Defeaturing::setFaces(const std::list& theFacesToRemove) -{ +void FeaturesAPI_Defeaturing::setFaces( + const std::list &theFacesToRemove) { mybaseObjects->clear(); fillAttribute(theFacesToRemove, mybaseObjects); execIfBaseNotEmpty(); } -void FeaturesAPI_Defeaturing::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Defeaturing::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Defeaturing::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_Defeaturing::OBJECT_LIST_ID()); theDumper << aBase << " = model.addDefeaturing(" << aDocName << ", " << anAttrObjects << ")" << std::endl; } -void FeaturesAPI_Defeaturing::execIfBaseNotEmpty() -{ +void FeaturesAPI_Defeaturing::execIfBaseNotEmpty() { if (mybaseObjects->size() > 0) execute(); } - //================================================================================================== -DefeaturingPtr addDefeaturing(const std::shared_ptr& thePart, - const std::list& theFaces) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Defeaturing::ID()); +DefeaturingPtr +addDefeaturing(const std::shared_ptr &thePart, + const std::list &theFaces) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Defeaturing::ID()); return DefeaturingPtr(new FeaturesAPI_Defeaturing(aFeature, theFaces)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Defeaturing.h b/src/FeaturesAPI/FeaturesAPI_Defeaturing.h index bb38dfcbf..9df51a1ea 100644 --- a/src/FeaturesAPI/FeaturesAPI_Defeaturing.h +++ b/src/FeaturesAPI/FeaturesAPI_Defeaturing.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Defeaturing_H_ @@ -32,33 +33,35 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Defeaturing /// \ingroup CPPHighAPI /// \brief Interface for the Defeaturing feature. -class FeaturesAPI_Defeaturing: public ModelHighAPI_Interface -{ +class FeaturesAPI_Defeaturing : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Defeaturing(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Defeaturing( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Defeaturing(const std::shared_ptr& theFeature, - const std::list& theFacesToRemove); + explicit FeaturesAPI_Defeaturing( + const std::shared_ptr &theFeature, + const std::list &theFacesToRemove); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Defeaturing(); - INTERFACE_1(FeaturesPlugin_Defeaturing::ID(), - baseObjects, FeaturesPlugin_Defeaturing::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */) + INTERFACE_1(FeaturesPlugin_Defeaturing::ID(), baseObjects, + FeaturesPlugin_Defeaturing::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */) /// Modify faces to be removed. FEATURESAPI_EXPORT - void setFaces(const std::list& theFacesToRemove); + void setFaces(const std::list &theFacesToRemove); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); @@ -70,7 +73,8 @@ typedef std::shared_ptr DefeaturingPtr; /// \ingroup CPPHighAPI /// \brief Create Defeaturing feature. FEATURESAPI_EXPORT -DefeaturingPtr addDefeaturing(const std::shared_ptr& thePart, - const std::list& theFaces); +DefeaturingPtr +addDefeaturing(const std::shared_ptr &thePart, + const std::list &theFaces); #endif // FeaturesAPI_Defeaturing_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp index 6d49af50f..461713249 100644 --- a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Extrusion.h" @@ -25,32 +26,32 @@ #include //================================================================================================== -FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setSizes(theSize, ModelHighAPI_Double()); } } //================================================================================================== -FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setSizes(theSize, ModelHighAPI_Double()); @@ -58,28 +59,27 @@ FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setSizes(theToSize, theFromSize); } } //================================================================================================== -FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::string& theSelectionType) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, const std::string &theSelectionType) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { if (!theSelectionType.empty()) mybaseObjects->setSelectionType(theSelectionType); fillAttribute(theBaseObjects, mybaseObjects); @@ -89,32 +89,32 @@ FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset); } } //================================================================================================== -FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { if (!theSelectionType.empty()) mybaseObjects->setSelectionType(theSelectionType); fillAttribute(theBaseObjects, mybaseObjects); @@ -124,19 +124,18 @@ FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptrsetValue(theSketch.feature()); // To make Sketch feature execute and subfeatures execute. feature()->document()->setCurrentFeature(feature(), false); - // to inform that the history is updated due to the sketch moved under the composite feature + // to inform that the history is updated due to the sketch moved under the + // composite feature if (theSketch.feature().get()) { theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group()); if (theSketch.feature()->firstResult().get()) @@ -149,8 +148,8 @@ void FeaturesAPI_Extrusion::setNestedSketch(const ModelHighAPI_Reference& theSke } //================================================================================================== -void FeaturesAPI_Extrusion::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_Extrusion::setBase( + const std::list &theBaseObjects) { mysketch->setValue(ObjectPtr()); mybaseObjects->clear(); fillAttribute(theBaseObjects, mybaseObjects); @@ -159,18 +158,18 @@ void FeaturesAPI_Extrusion::setBase(const std::list& the } //================================================================================================== -void FeaturesAPI_Extrusion::setDirection(const ModelHighAPI_Selection& theDirection) -{ +void FeaturesAPI_Extrusion::setDirection( + const ModelHighAPI_Selection &theDirection) { fillAttribute(theDirection, mydirection); execIfBaseNotEmpty(); } //================================================================================================== -void FeaturesAPI_Extrusion::setSizes(const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize) -{ - fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod); +void FeaturesAPI_Extrusion::setSizes(const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize) { + fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), + mycreationMethod); fillAttribute(theToSize, mytoSize); fillAttribute(theFromSize, myfromSize); @@ -178,18 +177,18 @@ void FeaturesAPI_Extrusion::setSizes(const ModelHighAPI_Double& theToSize, } //================================================================================================== -void FeaturesAPI_Extrusion::setSize(const ModelHighAPI_Double& theSize) -{ +void FeaturesAPI_Extrusion::setSize(const ModelHighAPI_Double &theSize) { setSizes(theSize, ModelHighAPI_Double()); } //================================================================================================== -void FeaturesAPI_Extrusion::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset) -{ - fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod); +void FeaturesAPI_Extrusion::setPlanesAndOffsets( + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset) { + fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), + mycreationMethod); fillAttribute(theToObject, mytoObject); fillAttribute(theToOffset, mytoOffset); fillAttribute(theFromObject, myfromObject); @@ -199,39 +198,45 @@ void FeaturesAPI_Extrusion::setPlanesAndOffsets(const ModelHighAPI_Selection& th } //================================================================================================== -void FeaturesAPI_Extrusion::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Extrusion::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID()); + AttributeReferencePtr anAttrSketch = + aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID()); + aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID()); AttributeSelectionPtr anAttrDirection = - aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID()); theDumper << aBase << " = model.addExtrusion(" << aDocName << ", "; - anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects; + anAttrSketch->isInitialized() ? theDumper << "[]" + : theDumper << anAttrObjects; theDumper << ", " << anAttrDirection; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES()) { - AttributeDoublePtr anAttrToSize = aBase->real(FeaturesPlugin_Extrusion::TO_SIZE_ID()); - AttributeDoublePtr anAttrFromSize = aBase->real(FeaturesPlugin_Extrusion::FROM_SIZE_ID()); + if (aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES()) { + AttributeDoublePtr anAttrToSize = + aBase->real(FeaturesPlugin_Extrusion::TO_SIZE_ID()); + AttributeDoublePtr anAttrFromSize = + aBase->real(FeaturesPlugin_Extrusion::FROM_SIZE_ID()); theDumper << ", " << anAttrToSize << ", " << anAttrFromSize; - } else if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) { + } else if (aCreationMethod == + FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) { AttributeSelectionPtr anAttrToObject = - aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID()); - AttributeDoublePtr anAttrToOffset = aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID()); + aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID()); + AttributeDoublePtr anAttrToOffset = + aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID()); AttributeSelectionPtr anAttrFromObject = - aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID()); - AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID()); + aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID()); + AttributeDoublePtr anAttrFromOffset = + aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID()); - theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << - ", " << anAttrFromObject << ", " << anAttrFromOffset; + theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << ", " + << anAttrFromObject << ", " << anAttrFromOffset; } // write explicitly the type of selection if it does not correspond @@ -242,105 +247,104 @@ void FeaturesAPI_Extrusion::dump(ModelHighAPI_Dumper& theDumper) const GeomShapePtr aFirstShape = aFirstSelection->value(); if (!aFirstShape) aFirstShape = aFirstSelection->context()->shape(); - if (!aFirstShape || aFirstShape->shapeType() != GeomAPI_Shape::shapeTypeByStr(aListSelType)) + if (!aFirstShape || + aFirstShape->shapeType() != GeomAPI_Shape::shapeTypeByStr(aListSelType)) theDumper << ", \"" << aListSelType << "\""; } theDumper << ")" << std::endl; - if(anAttrSketch->isInitialized()) { - theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl; + if (anAttrSketch->isInitialized()) { + theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" + << std::endl; } } //================================================================================================== -void FeaturesAPI_Extrusion::execIfBaseNotEmpty() -{ - if(mybaseObjects->size() > 0) { +void FeaturesAPI_Extrusion::execIfBaseNotEmpty() { + if (mybaseObjects->size() > 0) { execute(); } } //================================================================================================== -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID()); - return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theSize)); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Extrusion::ID()); + return ExtrusionPtr( + new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theSize)); } //================================================================================================== -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID()); - return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theDirection, theSize)); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Extrusion::ID()); + return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, + theDirection, theSize)); } //================================================================================================== -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID()); - return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theToSize, theFromSize)); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Extrusion::ID()); + return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, + theToSize, theFromSize)); } //================================================================================================== -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::string& theSelectionType) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID()); - return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, - theBaseObjects, - theDirection, - theToSize, - theFromSize, - theSelectionType)); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::string &theSelectionType) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Extrusion::ID()); + return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, + theDirection, theToSize, + theFromSize, theSelectionType)); } //================================================================================================== -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID()); - return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, - theBaseObjects, - theToObject, - theToOffset, - theFromObject, - theFromOffset)); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Extrusion::ID()); + return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, + theToObject, theToOffset, + theFromObject, theFromOffset)); } //================================================================================================== -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID()); - return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, - theBaseObjects, - theDirection, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theSelectionType)); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Extrusion::ID()); + return ExtrusionPtr(new FeaturesAPI_Extrusion( + aFeature, theBaseObjects, theDirection, theToObject, theToOffset, + theFromObject, theFromOffset, theSelectionType)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.h b/src/FeaturesAPI/FeaturesAPI_Extrusion.h index 32af534eb..820aec6e5 100644 --- a/src/FeaturesAPI/FeaturesAPI_Extrusion.h +++ b/src/FeaturesAPI/FeaturesAPI_Extrusion.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Extrusion_H_ @@ -34,119 +35,123 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Extrusion /// \ingroup CPPHighAPI /// \brief Interface for Extrusion feature. -class FeaturesAPI_Extrusion: public ModelHighAPI_Interface -{ +class FeaturesAPI_Extrusion : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::string& theSelectionType = std::string()); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::string &theSelectionType = std::string()); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Extrusion(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType = std::string()); + explicit FeaturesAPI_Extrusion( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType = std::string()); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Extrusion(); - INTERFACE_10(FeaturesPlugin_Extrusion::ID(), - sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), - ModelAPI_AttributeReference, /** Sketch launcher */, - baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Direction */, - creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), - ModelAPI_AttributeDouble, /** To size */, - fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), - ModelAPI_AttributeDouble, /** From size */, - toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), - ModelAPI_AttributeSelection, /** To object */, - toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), - ModelAPI_AttributeDouble, /** To offset */, - fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), - ModelAPI_AttributeSelection, /** From object */, - fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), - ModelAPI_AttributeDouble, /** From offset */) + INTERFACE_10( + FeaturesPlugin_Extrusion::ID(), sketch, + FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, + /** Sketch launcher */, baseObjects, + FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, direction, + FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Direction */, creationMethod, + FeaturesPlugin_Extrusion::CREATION_METHOD(), ModelAPI_AttributeString, + /** Creation method */, toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), + ModelAPI_AttributeDouble, /** To size */, fromSize, + FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble, + /** From size */, toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), + ModelAPI_AttributeSelection, /** To object */, toOffset, + FeaturesPlugin_Extrusion::TO_OFFSET_ID(), ModelAPI_AttributeDouble, + /** To offset */, fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), + ModelAPI_AttributeSelection, /** From object */, fromOffset, + FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, + /** From offset */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setNestedSketch(const ModelHighAPI_Reference& theSketch); + void setNestedSketch(const ModelHighAPI_Reference &theSketch); /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Modify direction_object attribute of the feature. FEATURESAPI_EXPORT - void setDirection(const ModelHighAPI_Selection& theDirection); + void setDirection(const ModelHighAPI_Selection &theDirection); /// Modify CreationMethod, to_size, from_size attributes of the feature. FEATURESAPI_EXPORT - void setSizes(const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize); + void setSizes(const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize); /// Modify creation_method, to_size, from_size attributes of the feature. FEATURESAPI_EXPORT - void setSize(const ModelHighAPI_Double& theSize); + void setSize(const ModelHighAPI_Double &theSize); /// Modify creation_method, to_object, to_offset, /// from_object, from_offset attributes of the feature. FEATURESAPI_EXPORT - void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset); + void setPlanesAndOffsets(const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); @@ -158,56 +163,62 @@ typedef std::shared_ptr ExtrusionPtr; /// \ingroup CPPHighAPI /// \brief Create Extrusion feature. FEATURESAPI_EXPORT -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize); /// \ingroup CPPHighAPI /// \brief Create Extrusion feature. FEATURESAPI_EXPORT -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize); /// \ingroup CPPHighAPI /// \brief Create Extrusion feature. FEATURESAPI_EXPORT -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize); /// \ingroup CPPHighAPI /// \brief Create Extrusion feature. FEATURESAPI_EXPORT -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::string& theSelectionType = std::string()); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::string &theSelectionType = std::string()); /// \ingroup CPPHighAPI /// \brief Create Extrusion feature. FEATURESAPI_EXPORT -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset); /// \ingroup CPPHighAPI /// \brief Create Extrusion feature. FEATURESAPI_EXPORT -ExtrusionPtr addExtrusion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType = std::string()); +ExtrusionPtr +addExtrusion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType = std::string()); #endif // FeaturesAPI_Extrusion_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp index 6db2e75c2..e60fb1f98 100644 --- a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp +++ b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_ExtrusionBoolean.h" @@ -26,25 +27,22 @@ //================================================================================================== FeaturesAPI_ExtrusionBoolean::FeaturesAPI_ExtrusionBoolean( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ -} + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) {} //================================================================================================== -FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean() -{ -} +FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean() {} //================================================================================================== -void FeaturesAPI_ExtrusionBoolean::setNestedSketch(const ModelHighAPI_Reference& theSketch) -{ +void FeaturesAPI_ExtrusionBoolean::setNestedSketch( + const ModelHighAPI_Reference &theSketch) { mysketch->setValue(theSketch.feature()); // To make Sketch feature execute and subfeatures execute. feature()->document()->setCurrentFeature(feature(), false); - // to inform that the history is updated due to the sketch moved under the composite feature + // to inform that the history is updated due to the sketch moved under the + // composite feature if (theSketch.feature().get()) { theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group()); if (theSketch.feature()->firstResult().get()) @@ -57,8 +55,8 @@ void FeaturesAPI_ExtrusionBoolean::setNestedSketch(const ModelHighAPI_Reference& } //================================================================================================== -void FeaturesAPI_ExtrusionBoolean::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_ExtrusionBoolean::setBase( + const std::list &theBaseObjects) { mysketch->setValue(ObjectPtr()); mybaseObjects->clear(); fillAttribute(theBaseObjects, mybaseObjects); @@ -67,18 +65,19 @@ void FeaturesAPI_ExtrusionBoolean::setBase(const std::list& theBooleanObjects) -{ + const std::list &theBooleanObjects) { fillAttribute(theBooleanObjects, mybooleanObjects); execIfBaseNotEmpty(); } //================================================================================================== -void FeaturesAPI_ExtrusionBoolean::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_ExtrusionBoolean::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID()); + AttributeReferencePtr anAttrSketch = + aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID()); + aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID()); AttributeSelectionPtr anAttrDirection = - aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID()); theDumper << aBase << " = model.addExtrusion"; - if(aBase->getKind() == FeaturesPlugin_ExtrusionCut::ID()) { + if (aBase->getKind() == FeaturesPlugin_ExtrusionCut::ID()) { theDumper << "Cut"; - } else if(aBase->getKind() == FeaturesPlugin_ExtrusionFuse::ID()) { + } else if (aBase->getKind() == FeaturesPlugin_ExtrusionFuse::ID()) { theDumper << "Fuse"; } theDumper << "(" << aDocName << ", "; - anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects; + anAttrSketch->isInitialized() ? theDumper << "[]" + : theDumper << anAttrObjects; theDumper << ", " << anAttrDirection; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES()) { - AttributeDoublePtr anAttrToSize = aBase->real(FeaturesPlugin_Extrusion::TO_SIZE_ID()); - AttributeDoublePtr anAttrFromSize = aBase->real(FeaturesPlugin_Extrusion::FROM_SIZE_ID()); + if (aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES()) { + AttributeDoublePtr anAttrToSize = + aBase->real(FeaturesPlugin_Extrusion::TO_SIZE_ID()); + AttributeDoublePtr anAttrFromSize = + aBase->real(FeaturesPlugin_Extrusion::FROM_SIZE_ID()); theDumper << ", " << anAttrToSize << ", " << anAttrFromSize; - } else if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) { + } else if (aCreationMethod == + FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) { AttributeSelectionPtr anAttrToObject = - aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID()); - AttributeDoublePtr anAttrToOffset = aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID()); + aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID()); + AttributeDoublePtr anAttrToOffset = + aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID()); AttributeSelectionPtr anAttrFromObject = - aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID()); - AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID()); + aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID()); + AttributeDoublePtr anAttrFromOffset = + aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID()); - theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << - ", " << anAttrFromObject << ", " << anAttrFromOffset; + theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << ", " + << anAttrFromObject << ", " << anAttrFromOffset; } else { // Through all } AttributeSelectionListPtr anAttrBoolObjects = - aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID()); + aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID()); theDumper << ", " << anAttrBoolObjects << ")" << std::endl; - if(anAttrSketch->isInitialized()) { - theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl; + if (anAttrSketch->isInitialized()) { + theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" + << std::endl; } } //================================================================================================== -void FeaturesAPI_ExtrusionBoolean::execIfBaseNotEmpty() -{ - if(mybaseObjects->size() > 0) { +void FeaturesAPI_ExtrusionBoolean::execIfBaseNotEmpty() { + if (mybaseObjects->size() > 0) { execute(); } } - //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ + const std::shared_ptr &theFeature) + : FeaturesAPI_ExtrusionBoolean(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); - fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod); + fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), + mycreationMethod); setBooleanObjects(theBooleanObjects); } } //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setSize(theSize); setBooleanObjects(theBooleanObjects); @@ -216,30 +217,29 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); - fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod); + fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), + mycreationMethod); setBooleanObjects(theBooleanObjects); } } //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setSize(theSize); @@ -249,14 +249,13 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setSizes(theToSize, theFromSize); setBooleanObjects(theBooleanObjects); @@ -265,15 +264,14 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setSizes(theToSize, theFromSize); @@ -283,16 +281,15 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset); setBooleanObjects(theBooleanObjects); @@ -301,17 +298,16 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( //================================================================================================== FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset); @@ -320,158 +316,143 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut( } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theBooleanObjects)); } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, - theSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut( + aFeature, theBaseObjects, theSize, theBooleanObjects)); } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut( + aFeature, theBaseObjects, theDirection, theBooleanObjects)); } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection, - theSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut( + aFeature, theBaseObjects, theDirection, theSize, theBooleanObjects)); } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, - theToSize, theFromSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut( + aFeature, theBaseObjects, theToSize, theFromSize, theBooleanObjects)); } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, - theBaseObjects, - theDirection, - theToSize, - theFromSize, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr( + new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection, + theToSize, theFromSize, theBooleanObjects)); } //================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -{ +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, - theBaseObjects, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theBooleanObjects)); -} - -//================================================================================================== -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -{ + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut( + aFeature, theBaseObjects, theToObject, theToOffset, theFromObject, + theFromOffset, theBooleanObjects)); +} + +//================================================================================================== +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); - return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, - theBaseObjects, - theDirection, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID()); + return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut( + aFeature, theBaseObjects, theDirection, theToObject, theToOffset, + theFromObject, theFromOffset, theBooleanObjects)); } - //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ + const std::shared_ptr &theFeature) + : FeaturesAPI_ExtrusionBoolean(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); - fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod); + fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), + mycreationMethod); setBooleanObjects(theBooleanObjects); } } //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setSize(theSize); setBooleanObjects(theBooleanObjects); @@ -480,30 +461,29 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); - fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod); + fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), + mycreationMethod); setBooleanObjects(theBooleanObjects); } } //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setSize(theSize); @@ -513,14 +493,13 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setSizes(theToSize, theFromSize); setBooleanObjects(theBooleanObjects); @@ -529,15 +508,14 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setSizes(theToSize, theFromSize); @@ -547,16 +525,15 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset); setBooleanObjects(theBooleanObjects); @@ -565,17 +542,16 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( //================================================================================================== FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -: FeaturesAPI_ExtrusionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) + : FeaturesAPI_ExtrusionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theDirection, mydirection); setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset); @@ -584,122 +560,110 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse( } //================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const std::list& theBooleanObjects) -{ +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theBooleanObjects)); } //================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -{ +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, - theSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theSize, theBooleanObjects)); } //================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects) -{ +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, - theDirection, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theDirection, theBooleanObjects)); } //================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -{ +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, - theDirection, theSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theDirection, theSize, theBooleanObjects)); } //================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -{ +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, - theToSize, theFromSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theToSize, theFromSize, theBooleanObjects)); } //================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects) -{ +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, - theBaseObjects, - theDirection, - theToSize, - theFromSize, - theBooleanObjects)); -} - -//================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -{ + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr( + new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theDirection, + theToSize, theFromSize, theBooleanObjects)); +} + +//================================================================================================== +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, - theBaseObjects, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theBooleanObjects)); -} - -//================================================================================================== -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -{ + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theToObject, theToOffset, theFromObject, + theFromOffset, theBooleanObjects)); +} + +//================================================================================================== +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); - return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, - theBaseObjects, - theDirection, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID()); + return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse( + aFeature, theBaseObjects, theDirection, theToObject, theToOffset, + theFromObject, theFromOffset, theBooleanObjects)); } diff --git a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h index dd841cfcc..a60e6b1c9 100644 --- a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h +++ b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_ExtrusionBoolean_H_ @@ -35,77 +36,79 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_ExtrusionBoolean /// \ingroup CPPHighAPI /// \brief Interface for ExtrusionBoolean feature. -class FeaturesAPI_ExtrusionBoolean: public ModelHighAPI_Interface -{ +class FeaturesAPI_ExtrusionBoolean : public ModelHighAPI_Interface { public: /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_ExtrusionBoolean(); - INTERFACE_11("", - sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), - ModelAPI_AttributeReference, /** Sketch launcher */, - baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Direction */, - creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), - ModelAPI_AttributeDouble, /** To size */, - fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), - ModelAPI_AttributeDouble, /** From size */, - toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), - ModelAPI_AttributeSelection, /** To object */, - toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), - ModelAPI_AttributeDouble, /** To offset */, - fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), - ModelAPI_AttributeSelection, /** From object */, - fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), - ModelAPI_AttributeDouble, /** From offset */, - booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Boolean objects */) + INTERFACE_11("", sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), + ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects, + FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, direction, + FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Direction */, creationMethod, + FeaturesPlugin_Extrusion::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, toSize, + FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble, + /** To size */, fromSize, + FeaturesPlugin_Extrusion::FROM_SIZE_ID(), + ModelAPI_AttributeDouble, /** From size */, toObject, + FeaturesPlugin_Extrusion::TO_OBJECT_ID(), + ModelAPI_AttributeSelection, /** To object */, toOffset, + FeaturesPlugin_Extrusion::TO_OFFSET_ID(), + ModelAPI_AttributeDouble, /** To offset */, fromObject, + FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), + ModelAPI_AttributeSelection, /** From object */, fromOffset, + FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), + ModelAPI_AttributeDouble, /** From offset */, booleanObjects, + FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Boolean objects */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setNestedSketch(const ModelHighAPI_Reference& theSketch); + void setNestedSketch(const ModelHighAPI_Reference &theSketch); /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Modify direction_object attribute of the feature. FEATURESAPI_EXPORT - void setDirection(const ModelHighAPI_Selection& theDirection); + void setDirection(const ModelHighAPI_Selection &theDirection); /// Modify CreationMethod, to_size, from_size attributes of the feature. FEATURESAPI_EXPORT - void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize); + void setSizes(const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize); /// Modify creation_method, to_size, from_size attributes of the feature. FEATURESAPI_EXPORT - void setSize(const ModelHighAPI_Double& theSize); + void setSize(const ModelHighAPI_Double &theSize); /// Modify creation_method, to_object, to_offset, from_object, /// from_offset attributes of the feature. FEATURESAPI_EXPORT - void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset); + void setPlanesAndOffsets(const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset); /// Modiyfy main_objects attribute of the feature. FEATURESAPI_EXPORT - void setBooleanObjects(const std::list& theBooleanObjects); + void + setBooleanObjects(const std::list &theBooleanObjects); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; protected: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionBoolean(const std::shared_ptr& theFeature); + explicit FeaturesAPI_ExtrusionBoolean( + const std::shared_ptr &theFeature); private: void execIfBaseNotEmpty(); @@ -114,87 +117,94 @@ private: /// \class FeaturesAPI_ExtrusionCut /// \ingroup CPPHighAPI /// \brief Interface for ExtrusionCut feature. -class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean -{ +class FeaturesAPI_ExtrusionCut : public FeaturesAPI_ExtrusionBoolean { public: - static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); } virtual std::string getID() { return ID(); } - //FEATURESAPI_EXPORT - //virtual std::string getID() { - // return FeaturesPlugin_ExtrusionCut::ID(); - //} + // FEATURESAPI_EXPORT + // virtual std::string getID() { + // return FeaturesPlugin_ExtrusionCut::ID(); + // } /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); }; /// Pointer on ExtrusionCut object. @@ -203,155 +213,171 @@ typedef std::shared_ptr ExtrusionCutPtr; /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionCut feature. FEATURESAPI_EXPORT -ExtrusionCutPtr addExtrusionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); +ExtrusionCutPtr +addExtrusionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); /// \class FeaturesAPI_ExtrusionFuse /// \ingroup CPPHighAPI /// \brief Interface for ExtrusionFuse feature. -class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean -{ +class FeaturesAPI_ExtrusionFuse : public FeaturesAPI_ExtrusionBoolean { public: static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); } virtual std::string getID() { return ID(); } /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); + explicit FeaturesAPI_ExtrusionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); }; /// Pointer on ExtrusionFuse object. @@ -360,75 +386,83 @@ typedef std::shared_ptr ExtrusionFusePtr; /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Double& theToSize, - const ModelHighAPI_Double& theFromSize, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Double &theToSize, + const ModelHighAPI_Double &theFromSize, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. FEATURESAPI_EXPORT -ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theDirection, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); +ExtrusionFusePtr +addExtrusionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theDirection, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); #endif // FeaturesAPI_ExtrusionBoolean_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Fillet.cpp b/src/FeaturesAPI/FeaturesAPI_Fillet.cpp index 59c1c8e29..bb282bb7b 100644 --- a/src/FeaturesAPI/FeaturesAPI_Fillet.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Fillet.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Fillet.h" @@ -24,33 +25,32 @@ #include #include -static GeomAPI_Shape::ShapeType typeOfSelection( - const std::list& theBaseObjects) -{ - std::string aType = theBaseObjects.empty() ? "SHAPE" : theBaseObjects.front().shapeType(); +static GeomAPI_Shape::ShapeType +typeOfSelection(const std::list &theBaseObjects) { + std::string aType = + theBaseObjects.empty() ? "SHAPE" : theBaseObjects.front().shapeType(); return GeomAPI_Shape::shapeTypeByStr(aType); } //================================================================================================== -FeaturesAPI_Fillet::FeaturesAPI_Fillet(const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ -} +FeaturesAPI_Fillet::FeaturesAPI_Fillet( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) {} //================================================================================================== -FeaturesAPI_Fillet1D::FeaturesAPI_Fillet1D(const std::shared_ptr& theFeature) - : FeaturesAPI_Fillet(theFeature) -{ +FeaturesAPI_Fillet1D::FeaturesAPI_Fillet1D( + const std::shared_ptr &theFeature) + : FeaturesAPI_Fillet(theFeature) { initialize(); } -FeaturesAPI_Fillet1D::FeaturesAPI_Fillet1D(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius) - : FeaturesAPI_Fillet(theFeature) -{ +FeaturesAPI_Fillet1D::FeaturesAPI_Fillet1D( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius) + : FeaturesAPI_Fillet(theFeature) { if (initialize()) { setBase(theBaseObjects); fillAttribute(theRadius, myradius); @@ -59,54 +59,54 @@ FeaturesAPI_Fillet1D::FeaturesAPI_Fillet1D(const std::shared_ptr& theBaseObjects) -{ +void FeaturesAPI_Fillet1D::setBase( + const std::list &theBaseObjects) { mybaseWires->clear(); mybaseVertices->clear(); if (typeOfSelection(theBaseObjects) == GeomAPI_Shape::WIRE) { - fillAttribute(FeaturesPlugin_Fillet1D::CREATION_BY_WIRES(), mycreationMethod); + fillAttribute(FeaturesPlugin_Fillet1D::CREATION_BY_WIRES(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseWires); - } - else { - fillAttribute(FeaturesPlugin_Fillet1D::CREATION_BY_VERTICES(), mycreationMethod); + } else { + fillAttribute(FeaturesPlugin_Fillet1D::CREATION_BY_VERTICES(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseVertices); } execIfBaseNotEmpty(); } -void FeaturesAPI_Fillet1D::setRadius(const ModelHighAPI_Double& theRadius) -{ +void FeaturesAPI_Fillet1D::setRadius(const ModelHighAPI_Double &theRadius) { fillAttribute(theRadius, myradius); execIfBaseNotEmpty(); } -void FeaturesAPI_Fillet1D::execIfBaseNotEmpty() -{ +void FeaturesAPI_Fillet1D::execIfBaseNotEmpty() { if (mybaseWires->size() > 0 || mybaseVertices->size() > 0) execute(); } -void FeaturesAPI_Fillet1D::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Fillet1D::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects; if (creationMethod()->value() == FeaturesPlugin_Fillet1D::CREATION_BY_WIRES()) - anAttrObjects = aBase->selectionList(FeaturesPlugin_Fillet1D::WIRE_LIST_ID()); - else if (creationMethod()->value() == FeaturesPlugin_Fillet1D::CREATION_BY_VERTICES()) - anAttrObjects = aBase->selectionList(FeaturesPlugin_Fillet1D::VERTEX_LIST_ID()); + anAttrObjects = + aBase->selectionList(FeaturesPlugin_Fillet1D::WIRE_LIST_ID()); + else if (creationMethod()->value() == + FeaturesPlugin_Fillet1D::CREATION_BY_VERTICES()) + anAttrObjects = + aBase->selectionList(FeaturesPlugin_Fillet1D::VERTEX_LIST_ID()); - AttributeDoublePtr anAttrRadius = aBase->real(FeaturesPlugin_Fillet1D::RADIUS_ID()); + AttributeDoublePtr anAttrRadius = + aBase->real(FeaturesPlugin_Fillet1D::RADIUS_ID()); - theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrObjects - << ", " << anAttrRadius; + theDumper << aBase << " = model.addFillet(" << aDocName << ", " + << anAttrObjects << ", " << anAttrRadius; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; @@ -116,19 +116,20 @@ void FeaturesAPI_Fillet1D::dump(ModelHighAPI_Dumper& theDumper) const //================================================================================================== -FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr& theFeature) - : FeaturesAPI_Fillet(theFeature) -{ +FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D( + const std::shared_ptr &theFeature) + : FeaturesAPI_Fillet(theFeature) { initialize(); } -FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius) - : FeaturesAPI_Fillet(theFeature) -{ +FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius) + : FeaturesAPI_Fillet(theFeature) { if (initialize()) { - fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS(), mycreationMethod); + fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theRadius, myradius); @@ -136,14 +137,15 @@ FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius1, - const ModelHighAPI_Double& theRadius2) - : FeaturesAPI_Fillet(theFeature) -{ +FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius1, + const ModelHighAPI_Double &theRadius2) + : FeaturesAPI_Fillet(theFeature) { if (initialize()) { - fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS(), mycreationMethod); + fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theRadius1, mystartRadius); fillAttribute(theRadius2, myendRadius); @@ -152,54 +154,58 @@ FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr& theBaseObjects) -{ +void FeaturesAPI_Fillet2D::setBase( + const std::list &theBaseObjects) { mybaseObjects->clear(); fillAttribute(theBaseObjects, mybaseObjects); execIfBaseNotEmpty(); } -void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double& theRadius) -{ - fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS(), mycreationMethod); +void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double &theRadius) { + fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS(), + mycreationMethod); fillAttribute(theRadius, myradius); execIfBaseNotEmpty(); } -void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double& theRadius1, - const ModelHighAPI_Double& theRadius2) -{ - fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS(), mycreationMethod); +void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double &theRadius1, + const ModelHighAPI_Double &theRadius2) { + fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS(), + mycreationMethod); fillAttribute(theRadius1, mystartRadius); fillAttribute(theRadius2, myendRadius); execIfBaseNotEmpty(); } -void FeaturesAPI_Fillet2D::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Fillet2D::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Fillet::OBJECT_LIST_ID()); + aBase->selectionList(FeaturesPlugin_Fillet::OBJECT_LIST_ID()); - theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrObjects; + theDumper << aBase << " = model.addFillet(" << aDocName << ", " + << anAttrObjects; - std::string aCreationMethod = aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value(); + std::string aCreationMethod = + aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS()) { - AttributeDoublePtr anAttrRadius = aBase->real(FeaturesPlugin_Fillet::RADIUS_ID()); + if (aCreationMethod == + FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS()) { + AttributeDoublePtr anAttrRadius = + aBase->real(FeaturesPlugin_Fillet::RADIUS_ID()); theDumper << ", " << anAttrRadius; - } else if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS()) { - AttributeDoublePtr anAttrRadius1 = aBase->real(FeaturesPlugin_Fillet::START_RADIUS_ID()); - AttributeDoublePtr anAttrRadius2 = aBase->real(FeaturesPlugin_Fillet::END_RADIUS_ID()); + } else if (aCreationMethod == + FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS()) { + AttributeDoublePtr anAttrRadius1 = + aBase->real(FeaturesPlugin_Fillet::START_RADIUS_ID()); + AttributeDoublePtr anAttrRadius2 = + aBase->real(FeaturesPlugin_Fillet::END_RADIUS_ID()); theDumper << ", " << anAttrRadius1 << ", " << anAttrRadius2; } @@ -209,35 +215,35 @@ void FeaturesAPI_Fillet2D::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ")" << std::endl; } -void FeaturesAPI_Fillet2D::execIfBaseNotEmpty() -{ +void FeaturesAPI_Fillet2D::execIfBaseNotEmpty() { if (mybaseObjects->size() > 0) execute(); } - //================================================================================================== -FilletPtr addFillet(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius1, - const ModelHighAPI_Double& theRadius2, - const bool keepSubResults) -{ +FilletPtr addFillet(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius1, + const ModelHighAPI_Double &theRadius2, + const bool keepSubResults) { GeomAPI_Shape::ShapeType aType = typeOfSelection(theBaseObjects); bool is1D = aType == GeomAPI_Shape::WIRE || aType == GeomAPI_Shape::VERTEX; - FeaturePtr aFeature = - thePart->addFeature(is1D ? FeaturesAPI_Fillet1D::ID() : FeaturesAPI_Fillet2D::ID()); + FeaturePtr aFeature = thePart->addFeature(is1D ? FeaturesAPI_Fillet1D::ID() + : FeaturesAPI_Fillet2D::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); FilletPtr aFillet; if (is1D) - aFillet.reset(new FeaturesAPI_Fillet1D(aFeature, theBaseObjects, theRadius1)); + aFillet.reset( + new FeaturesAPI_Fillet1D(aFeature, theBaseObjects, theRadius1)); else if (theRadius2.value() < 0.0) - aFillet.reset(new FeaturesAPI_Fillet2D(aFeature, theBaseObjects, theRadius1)); + aFillet.reset( + new FeaturesAPI_Fillet2D(aFeature, theBaseObjects, theRadius1)); else - aFillet.reset(new FeaturesAPI_Fillet2D(aFeature, theBaseObjects, theRadius1, theRadius2)); + aFillet.reset(new FeaturesAPI_Fillet2D(aFeature, theBaseObjects, theRadius1, + theRadius2)); return aFillet; } diff --git a/src/FeaturesAPI/FeaturesAPI_Fillet.h b/src/FeaturesAPI/FeaturesAPI_Fillet.h index 4023bfced..ad9964c21 100644 --- a/src/FeaturesAPI/FeaturesAPI_Fillet.h +++ b/src/FeaturesAPI/FeaturesAPI_Fillet.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Fillet_H_ @@ -34,8 +35,7 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Fillet /// \ingroup CPPHighAPI /// \brief Interface for Fillet feature. -class FeaturesAPI_Fillet: public ModelHighAPI_Interface -{ +class FeaturesAPI_Fillet : public ModelHighAPI_Interface { public: /// Destructor. virtual ~FeaturesAPI_Fillet() {} @@ -43,142 +43,142 @@ public: virtual std::shared_ptr radius() const = 0; /// Modify base objects of the fillet. - virtual void setBase(const std::list& theBaseObjects) = 0; + virtual void + setBase(const std::list &theBaseObjects) = 0; /// Modify fillet to have fixed radius - virtual void setRadius(const ModelHighAPI_Double& theRadius) = 0; + virtual void setRadius(const ModelHighAPI_Double &theRadius) = 0; protected: - FeaturesAPI_Fillet(const std::shared_ptr& theFeature); + FeaturesAPI_Fillet(const std::shared_ptr &theFeature); }; /// Pointer on the fillet object. typedef std::shared_ptr FilletPtr; - /// \class FeaturesAPI_Fillet1D /// \ingroup CPPHighAPI /// \brief Interface for Fillet1D feature - fillet on vertices of a wire. -class FeaturesAPI_Fillet1D : public FeaturesAPI_Fillet -{ +class FeaturesAPI_Fillet1D : public FeaturesAPI_Fillet { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Fillet1D(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Fillet1D( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Fillet1D(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius); + explicit FeaturesAPI_Fillet1D( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Fillet1D(); - INTERFACE_4(FeaturesPlugin_Fillet1D::ID(), - creationMethod, FeaturesPlugin_Fillet1D::CREATION_METHOD(), - ModelAPI_AttributeString, - /** Creation method */, - baseWires, FeaturesPlugin_Fillet1D::WIRE_LIST_ID(), - ModelAPI_AttributeSelectionList, - /** Base objects */, - baseVertices, FeaturesPlugin_Fillet1D::VERTEX_LIST_ID(), - ModelAPI_AttributeSelectionList, - /** Base objects */, - radius, FeaturesPlugin_Fillet1D::RADIUS_ID(), - ModelAPI_AttributeDouble, - /** Value of the fixed radius fillet */) + INTERFACE_4(FeaturesPlugin_Fillet1D::ID(), creationMethod, + FeaturesPlugin_Fillet1D::CREATION_METHOD(), + ModelAPI_AttributeString, + /** Creation method */, baseWires, + FeaturesPlugin_Fillet1D::WIRE_LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */, baseVertices, + FeaturesPlugin_Fillet1D::VERTEX_LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */, radius, FeaturesPlugin_Fillet1D::RADIUS_ID(), + ModelAPI_AttributeDouble, + /** Value of the fixed radius fillet */) /// Modify base objects of the fillet. FEATURESAPI_EXPORT - virtual void setBase(const std::list& theBaseObjects); + virtual void setBase(const std::list &theBaseObjects); /// Modify fillet to have fixed radius FEATURESAPI_EXPORT - virtual void setRadius(const ModelHighAPI_Double& theRadius); + virtual void setRadius(const ModelHighAPI_Double &theRadius); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); }; - /// \class FeaturesAPI_Fillet2D /// \ingroup CPPHighAPI /// \brief Interface for Fillet feature - fillet edges on a solid. -class FeaturesAPI_Fillet2D : public FeaturesAPI_Fillet -{ +class FeaturesAPI_Fillet2D : public FeaturesAPI_Fillet { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Fillet2D(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Fillet2D( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Fillet2D(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius); + explicit FeaturesAPI_Fillet2D( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Fillet2D(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius1, - const ModelHighAPI_Double& theRadius2); + explicit FeaturesAPI_Fillet2D( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius1, + const ModelHighAPI_Double &theRadius2); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Fillet2D(); - INTERFACE_5(FeaturesPlugin_Fillet::ID(), - creationMethod, FeaturesPlugin_Fillet::CREATION_METHOD(), - ModelAPI_AttributeString, - /** Creation method */, - baseObjects, FeaturesPlugin_Fillet::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, - /** Base objects */, - radius, FeaturesPlugin_Fillet::RADIUS_ID(), - ModelAPI_AttributeDouble, - /** Value of the fixed radius fillet */, - startRadius, FeaturesPlugin_Fillet::START_RADIUS_ID(), - ModelAPI_AttributeDouble, - /** Start radius of the varying radius fillet */, - endRadius, FeaturesPlugin_Fillet::END_RADIUS_ID(), - ModelAPI_AttributeDouble, - /** End radius of the varying radius fillet */) + INTERFACE_5(FeaturesPlugin_Fillet::ID(), creationMethod, + FeaturesPlugin_Fillet::CREATION_METHOD(), + ModelAPI_AttributeString, + /** Creation method */, baseObjects, + FeaturesPlugin_Fillet::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, + /** Base objects */, radius, FeaturesPlugin_Fillet::RADIUS_ID(), + ModelAPI_AttributeDouble, + /** Value of the fixed radius fillet */, startRadius, + FeaturesPlugin_Fillet::START_RADIUS_ID(), + ModelAPI_AttributeDouble, + /** Start radius of the varying radius fillet */, endRadius, + FeaturesPlugin_Fillet::END_RADIUS_ID(), ModelAPI_AttributeDouble, + /** End radius of the varying radius fillet */) /// Modify base objects of the fillet. FEATURESAPI_EXPORT - virtual void setBase(const std::list& theBaseObjects); + virtual void setBase(const std::list &theBaseObjects); /// Modify fillet to have fixed radius FEATURESAPI_EXPORT - virtual void setRadius(const ModelHighAPI_Double& theRadius); + virtual void setRadius(const ModelHighAPI_Double &theRadius); /// Modify fillet to have varying radius FEATURESAPI_EXPORT - void setRadius(const ModelHighAPI_Double& theRadius1, const ModelHighAPI_Double& theRadius2); + void setRadius(const ModelHighAPI_Double &theRadius1, + const ModelHighAPI_Double &theRadius2); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); }; - /// \ingroup CPPHighAPI /// \brief Create Fillet feature. FEATURESAPI_EXPORT -FilletPtr addFillet(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theRadius1, - const ModelHighAPI_Double& theRadius2 = ModelHighAPI_Double(-1.0), - const bool keepSubResults = false); +FilletPtr +addFillet(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theRadius1, + const ModelHighAPI_Double &theRadius2 = ModelHighAPI_Double(-1.0), + const bool keepSubResults = false); #endif // FeaturesAPI_Fillet_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp b/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp index 3c0a23880..5589c3679 100644 --- a/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp +++ b/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_FusionFaces.h" @@ -24,55 +25,47 @@ //================================================================================================== FeaturesAPI_FusionFaces::FeaturesAPI_FusionFaces( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_FusionFaces::FeaturesAPI_FusionFaces( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBase) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBase) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBase); } } //================================================================================================== -FeaturesAPI_FusionFaces::~FeaturesAPI_FusionFaces() -{ - -} +FeaturesAPI_FusionFaces::~FeaturesAPI_FusionFaces() {} //================================================================================================== -void FeaturesAPI_FusionFaces::setBase(const ModelHighAPI_Selection& theBase) -{ +void FeaturesAPI_FusionFaces::setBase(const ModelHighAPI_Selection &theBase) { fillAttribute(theBase, mybase); execute(); } //================================================================================================== -void FeaturesAPI_FusionFaces::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_FusionFaces::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aPartName = theDumper.name(aBase->document()); + const std::string &aPartName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrBaseShape = - aBase->selection(FeaturesPlugin_FusionFaces::BASE_SHAPE_ID()); + aBase->selection(FeaturesPlugin_FusionFaces::BASE_SHAPE_ID()); - theDumper << aBase << " = model.addFusionFaces(" - << aPartName << ", " << anAttrBaseShape << ")" << std::endl; + theDumper << aBase << " = model.addFusionFaces(" << aPartName << ", " + << anAttrBaseShape << ")" << std::endl; } //================================================================================================== -FusionFacesPtr addFusionFaces(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBase) -{ +FusionFacesPtr addFusionFaces(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBase) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesAPI_FusionFaces::ID()); + thePart->addFeature(FeaturesAPI_FusionFaces::ID()); return FusionFacesPtr(new FeaturesAPI_FusionFaces(aFeature, theBase)); } diff --git a/src/FeaturesAPI/FeaturesAPI_FusionFaces.h b/src/FeaturesAPI/FeaturesAPI_FusionFaces.h index 985171527..b82aaa190 100644 --- a/src/FeaturesAPI/FeaturesAPI_FusionFaces.h +++ b/src/FeaturesAPI/FeaturesAPI_FusionFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_FusionFaces_H_ @@ -33,33 +34,35 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_FusionFaces /// \ingroup CPPHighAPI /// \brief Interface for FusionFaces feature. -class FeaturesAPI_FusionFaces: public ModelHighAPI_Interface -{ +class FeaturesAPI_FusionFaces : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_FusionFaces(const std::shared_ptr& theFeature); + explicit FeaturesAPI_FusionFaces( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_FusionFaces(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBase); + explicit FeaturesAPI_FusionFaces( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBase); /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_FusionFaces(); + virtual ~FeaturesAPI_FusionFaces(); - INTERFACE_1(FeaturesPlugin_FusionFaces::ID(), - base, FeaturesPlugin_FusionFaces::BASE_SHAPE_ID(), - ModelAPI_AttributeSelection, /** Base */) + INTERFACE_1(FeaturesPlugin_FusionFaces::ID(), base, + FeaturesPlugin_FusionFaces::BASE_SHAPE_ID(), + ModelAPI_AttributeSelection, + /** Base */) /// Modify base object attribute of the feature. FEATURESAPI_EXPORT - void setBase(const ModelHighAPI_Selection& theBase); + void setBase(const ModelHighAPI_Selection &theBase); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on FusionFaces object. @@ -68,7 +71,7 @@ typedef std::shared_ptr FusionFacesPtr; /// \ingroup CPPHighAPI /// \brief Create FusionFaces feature. FEATURESAPI_EXPORT -FusionFacesPtr addFusionFaces(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBase); +FusionFacesPtr addFusionFaces(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBase); #endif // FeaturesAPI_FusionFaces_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp index c45edf5b1..8966fd5fc 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_GeometryCalculation.h" @@ -25,18 +26,22 @@ #include //================================================================================================= -std::list getGeometryCalculation(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject) -{ - FeaturePtr aPointCoodFeat = thePart->addFeature(FeaturesPlugin_GeometryCalculation::ID()); +std::list +getGeometryCalculation(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject) { + FeaturePtr aPointCoodFeat = + thePart->addFeature(FeaturesPlugin_GeometryCalculation::ID()); - fillAttribute(theObject, aPointCoodFeat - ->selection(FeaturesPlugin_GeometryCalculation::OBJECT_SELECTED_ID())); + fillAttribute(theObject, + aPointCoodFeat->selection( + FeaturesPlugin_GeometryCalculation::OBJECT_SELECTED_ID())); std::list res; // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aPointCoodFeat->attribute(FeaturesPlugin_GeometryCalculation::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aPointCoodFeat->attribute( + FeaturesPlugin_GeometryCalculation::RESULT_VALUES_ID())); for (int i : {0, 1, 2}) res.push_back(aResult->value(i)); diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h index c62aca2d7..20c103125 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_GeometryCalculation_H_ @@ -31,7 +32,8 @@ class ModelHighAPI_Selection; /// \ingroup CPPHighAPI /// \brief get the geometry calculation (length, Surface area, volume) FEATURESAPI_EXPORT -std::list getGeometryCalculation(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject); +std::list +getGeometryCalculation(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject); -#endif // FeaturesAPI_GeometryCalculation_H_ \ No newline at end of file +#endif // FeaturesAPI_GeometryCalculation_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp b/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp index 6e8f819d7..2166dabd3 100644 --- a/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp +++ b/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_GlueFaces.h" @@ -24,19 +25,18 @@ #include //================================================================================================== -FeaturesAPI_GlueFaces::FeaturesAPI_GlueFaces(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_GlueFaces::FeaturesAPI_GlueFaces( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_GlueFaces::FeaturesAPI_GlueFaces(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - bool theIsKeepNonSolids) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_GlueFaces::FeaturesAPI_GlueFaces( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, bool theIsKeepNonSolids) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theMainObjects, mainObjects()); setTolerance(theTolerance); @@ -45,58 +45,59 @@ FeaturesAPI_GlueFaces::FeaturesAPI_GlueFaces(const std::shared_ptr& theMainObjects) -{ +void FeaturesAPI_GlueFaces::setMainObjects( + const std::list &theMainObjects) { fillAttribute(theMainObjects, mainObjects()); execute(); } //================================================================================================== -void FeaturesAPI_GlueFaces::setTolerance(const ModelHighAPI_Double& theTolerance) -{ +void FeaturesAPI_GlueFaces::setTolerance( + const ModelHighAPI_Double &theTolerance) { fillAttribute(theTolerance, tolerance()); execute(); } //================================================================================================== -void FeaturesAPI_GlueFaces::setKeepNonSolids(bool theFlag) -{ +void FeaturesAPI_GlueFaces::setKeepNonSolids(bool theFlag) { fillAttribute(theFlag, keepNonSolids()); execute(); } //================================================================================================== -void FeaturesAPI_GlueFaces::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_GlueFaces::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_GlueFaces::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addGlueFaces(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_GlueFaces::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addGlueFaces(" << aDocName << ", " + << anAttrObjects; - AttributeDoublePtr anAttrTolerance = aBase->real(FeaturesPlugin_GlueFaces::TOLERANCE_ID()); + AttributeDoublePtr anAttrTolerance = + aBase->real(FeaturesPlugin_GlueFaces::TOLERANCE_ID()); theDumper << ", " << anAttrTolerance; - AttributeBooleanPtr anAttrKeepNonSolids = aBase->boolean(FeaturesPlugin_GlueFaces::KEEP_NON_SOLIDS_ID()); + AttributeBooleanPtr anAttrKeepNonSolids = + aBase->boolean(FeaturesPlugin_GlueFaces::KEEP_NON_SOLIDS_ID()); theDumper << ", " << anAttrKeepNonSolids; theDumper << ")" << std::endl; } //================================================================================================== -GlueFacesPtr addGlueFaces(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - const bool theKeepNonSolids) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_GlueFaces::ID()); +GlueFacesPtr +addGlueFaces(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, + const bool theKeepNonSolids) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_GlueFaces::ID()); GlueFacesPtr aGlueFaces; - aGlueFaces.reset(new FeaturesAPI_GlueFaces(aFeature, theMainObjects, theTolerance, theKeepNonSolids)); + aGlueFaces.reset(new FeaturesAPI_GlueFaces(aFeature, theMainObjects, + theTolerance, theKeepNonSolids)); return aGlueFaces; } diff --git a/src/FeaturesAPI/FeaturesAPI_GlueFaces.h b/src/FeaturesAPI/FeaturesAPI_GlueFaces.h index a857e9078..2942fbc1d 100644 --- a/src/FeaturesAPI/FeaturesAPI_GlueFaces.h +++ b/src/FeaturesAPI/FeaturesAPI_GlueFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeatureAPI_GlueFaces_H_ @@ -34,39 +35,40 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_GlueFaces /// \ingroup CPPHighAPI /// \brief Interface for Glue Faces feature. -class FeaturesAPI_GlueFaces: public ModelHighAPI_Interface -{ +class FeaturesAPI_GlueFaces : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_GlueFaces(const std::shared_ptr& theFeature); + explicit FeaturesAPI_GlueFaces( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_GlueFaces(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - bool theIsKeepNonSolids = true); + explicit FeaturesAPI_GlueFaces( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, bool theIsKeepNonSolids = true); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_GlueFaces(); - INTERFACE_3(FeaturesPlugin_GlueFaces::ID(), - mainObjects, FeaturesPlugin_GlueFaces::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - tolerance, FeaturesPlugin_GlueFaces::TOLERANCE_ID(), - ModelAPI_AttributeDouble, /** Tolerance */, - keepNonSolids, FeaturesPlugin_GlueFaces::KEEP_NON_SOLIDS_ID(), - ModelAPI_AttributeBoolean, /** Keep all non-solid shapes */) + INTERFACE_3(FeaturesPlugin_GlueFaces::ID(), mainObjects, + FeaturesPlugin_GlueFaces::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, tolerance, + FeaturesPlugin_GlueFaces::TOLERANCE_ID(), + ModelAPI_AttributeDouble, /** Tolerance */, keepNonSolids, + FeaturesPlugin_GlueFaces::KEEP_NON_SOLIDS_ID(), + ModelAPI_AttributeBoolean, + /** Keep all non-solid shapes */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set the tolerance. FEATURESAPI_EXPORT - void setTolerance(const ModelHighAPI_Double& theTolerance); + void setTolerance(const ModelHighAPI_Double &theTolerance); /// Set flag whether to keep all non-solid shapes. FEATURESAPI_EXPORT @@ -74,7 +76,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Glue Faces object. @@ -83,9 +85,10 @@ typedef std::shared_ptr GlueFacesPtr; /// \ingroup CPPHighAPI /// \brief Create Glue Faces feature. FEATURESAPI_EXPORT -GlueFacesPtr addGlueFaces(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - const bool theKeepNonSolids); +GlueFacesPtr +addGlueFaces(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, + const bool theKeepNonSolids); #endif // FeatureAPI_GlueFaces_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp b/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp index 463d78cc4..cd5517494 100644 --- a/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp +++ b/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_ImportResult.h" @@ -24,17 +25,17 @@ //================================================================================================ FeaturesAPI_ImportResult::FeaturesAPI_ImportResult( - const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================ FeaturesAPI_ImportResult::FeaturesAPI_ImportResult( - const std::shared_ptr& theFeature, - const std::list& theObjects) : ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theObjects) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setObjects(theObjects); } } @@ -43,36 +44,36 @@ FeaturesAPI_ImportResult::FeaturesAPI_ImportResult( FeaturesAPI_ImportResult::~FeaturesAPI_ImportResult() {} //================================================================================================= -void FeaturesAPI_ImportResult::setObjects(const std::list& theObjects) -{ +void FeaturesAPI_ImportResult::setObjects( + const std::list &theObjects) { fillAttribute(theObjects, myobjects); execute(); } //================================================================================================= -void FeaturesAPI_ImportResult::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_ImportResult::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anObjects = - aBase->selectionList(FeaturesPlugin_ImportResult::OBJECTS()); + aBase->selectionList(FeaturesPlugin_ImportResult::OBJECTS()); CompositeFeaturePtr aCompositeFeature = std::dynamic_pointer_cast(aBase); int aNbOfSubs = aCompositeFeature->numberOfSubs(); for (int anIndex = 0; anIndex < aNbOfSubs; anIndex++) { FeaturePtr aSubFeature = aCompositeFeature->subFeature(anIndex); - theDumper.name(aSubFeature, false, false, true); //mark as not to dump + theDumper.name(aSubFeature, false, false, true); // mark as not to dump } - theDumper << aBase << " = model.addImportResult(" - << aDocName << ", " << anObjects << ")" << std::endl; + theDumper << aBase << " = model.addImportResult(" << aDocName << ", " + << anObjects << ")" << std::endl; } //================================================================================================= -ImportResultPtr addImportResult(const std::shared_ptr& thePart, - const std::list& theObjects) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_ImportResult::ID()); +ImportResultPtr +addImportResult(const std::shared_ptr &thePart, + const std::list &theObjects) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_ImportResult::ID()); return ImportResultPtr(new FeaturesAPI_ImportResult(aFeature, theObjects)); } diff --git a/src/FeaturesAPI/FeaturesAPI_ImportResult.h b/src/FeaturesAPI/FeaturesAPI_ImportResult.h index 15ce0da0d..a9e160732 100644 --- a/src/FeaturesAPI/FeaturesAPI_ImportResult.h +++ b/src/FeaturesAPI/FeaturesAPI_ImportResult.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_ImportResult_H_ @@ -33,30 +34,33 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_ImportResult /// \ingroup CPPHighAPI /// \brief Interface for ImportResult feature. -class FeaturesAPI_ImportResult: public ModelHighAPI_Interface -{ +class FeaturesAPI_ImportResult : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ImportResult(const std::shared_ptr& theFeature); + explicit FeaturesAPI_ImportResult( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_ImportResult(const std::shared_ptr& theFeature, - const std::list& theBaseObjects); + explicit FeaturesAPI_ImportResult( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_ImportResult(); - INTERFACE_1(FeaturesPlugin_ImportResult::ID(), - objects, FeaturesPlugin_ImportResult::OBJECTS(), - ModelAPI_AttributeSelectionList, /** Source objects */) + INTERFACE_1(FeaturesPlugin_ImportResult::ID(), objects, + FeaturesPlugin_ImportResult::OBJECTS(), + ModelAPI_AttributeSelectionList, + /** Source objects */) /// Modify objects attribute of the feature. - FEATURESAPI_EXPORT void setObjects(const std::list& theBaseObjects); + FEATURESAPI_EXPORT void + setObjects(const std::list &theBaseObjects); /// Dump wrapped feature - FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; + FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on ImportResult object. @@ -65,7 +69,8 @@ typedef std::shared_ptr ImportResultPtr; /// \ingroup CPPHighAPI /// \brief Create ImportResult feature. FEATURESAPI_EXPORT -ImportResultPtr addImportResult(const std::shared_ptr& thePart, - const std::list& theObjects); +ImportResultPtr +addImportResult(const std::shared_ptr &thePart, + const std::list &theObjects); #endif // FeaturesAPI_ImportResult_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp index ca74d1ccd..056e4e698 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Intersection.h" @@ -22,26 +23,22 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesAPI_Intersection::FeaturesAPI_Intersection( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_Intersection::FeaturesAPI_Intersection( - const std::shared_ptr& theFeature, - const std::list& theObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theObjects, VAR_NAME(objects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -58,47 +55,45 @@ FeaturesAPI_Intersection::FeaturesAPI_Intersection( } //================================================================================================== -FeaturesAPI_Intersection::~FeaturesAPI_Intersection() -{ - -} +FeaturesAPI_Intersection::~FeaturesAPI_Intersection() {} //================================================================================================== -void FeaturesAPI_Intersection::setObjects(const std::list& theObjects) -{ +void FeaturesAPI_Intersection::setObjects( + const std::list &theObjects) { fillAttribute(theObjects, VAR_NAME(objects)); execute(); } //================================================================================================== -void FeaturesAPI_Intersection::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_Intersection::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_Intersection::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_Intersection::setFuzzyValue( + const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_Intersection::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_Intersection::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_Intersection::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_Intersection::FUZZY_PARAM_ID()); - theDumper << aBase << " = model.addIntersection(" << aDocName << ", " << anAttrObjects; + theDumper << aBase << " = model.addIntersection(" << aDocName << ", " + << anAttrObjects; if (aUseFuzzy) theDumper << ", fuzzyParam = " << aFuzzy; @@ -110,13 +105,15 @@ void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -IntersectionPtr addIntersection(const std::shared_ptr& thePart, - const std::list& theObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Intersection::ID()); +IntersectionPtr +addIntersection(const std::shared_ptr &thePart, + const std::list &theObjects, + const ModelHighAPI_Double &theFuzzy, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Intersection::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, theFuzzy)); + return IntersectionPtr( + new FeaturesAPI_Intersection(aFeature, theObjects, theFuzzy)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.h b/src/FeaturesAPI/FeaturesAPI_Intersection.h index d98e98003..40810ac53 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.h +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Intersection_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Dumper; class ModelHighAPI_Selection; @@ -34,34 +35,36 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Intersection /// \ingroup CPPHighAPI /// \brief Interface for Intersection feature. -class FeaturesAPI_Intersection: public ModelHighAPI_Interface -{ +class FeaturesAPI_Intersection : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Intersection(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Intersection( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Intersection(const std::shared_ptr& theFeature, - const std::list& theObjects, - const ModelHighAPI_Double& aFuzzy = ModelHighAPI_Double(-1)); + explicit FeaturesAPI_Intersection( + const std::shared_ptr &theFeature, + const std::list &theObjects, + const ModelHighAPI_Double &aFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Intersection(); - INTERFACE_3(FeaturesPlugin_Intersection::ID(), - objects, FeaturesPlugin_Intersection::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Objects */, - useFuzzy, FeaturesPlugin_Intersection::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_Intersection::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_3(FeaturesPlugin_Intersection::ID(), objects, + FeaturesPlugin_Intersection::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Objects */, useFuzzy, + FeaturesPlugin_Intersection::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_Intersection::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Modify objects attribute of the feature. FEATURESAPI_EXPORT - void setObjects(const std::list& theObjects); + void setObjects(const std::list &theObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -69,11 +72,11 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Intersection object. @@ -82,9 +85,10 @@ typedef std::shared_ptr IntersectionPtr; /// \ingroup CPPHighAPI /// \brief Create Intersection feature. FEATURESAPI_EXPORT -IntersectionPtr addIntersection(const std::shared_ptr& part, - const std::list& objects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +IntersectionPtr +addIntersection(const std::shared_ptr &part, + const std::list &objects, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_Intersection_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp index e76c309f6..3d80ac377 100644 --- a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp +++ b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_LimitTolerance.h" @@ -24,66 +25,67 @@ #include //================================================================================================== -FeaturesAPI_LimitTolerance::FeaturesAPI_LimitTolerance(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_LimitTolerance::FeaturesAPI_LimitTolerance( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_LimitTolerance::FeaturesAPI_LimitTolerance(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theMainObject, - const ModelHighAPI_Double& theTolerance) -: ModelHighAPI_Interface(theFeature) -{ - if (initialize()) - { +FeaturesAPI_LimitTolerance::FeaturesAPI_LimitTolerance( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theMainObject, + const ModelHighAPI_Double &theTolerance) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setMainObject(theMainObject); setTolerance(theTolerance); } } //================================================================================================== -FeaturesAPI_LimitTolerance::~FeaturesAPI_LimitTolerance() -{ -} +FeaturesAPI_LimitTolerance::~FeaturesAPI_LimitTolerance() {} //================================================================================================== -void FeaturesAPI_LimitTolerance::setMainObject(const ModelHighAPI_Selection& theMainObject) -{ +void FeaturesAPI_LimitTolerance::setMainObject( + const ModelHighAPI_Selection &theMainObject) { fillAttribute(theMainObject, mainObject()); execute(); } //================================================================================================== -void FeaturesAPI_LimitTolerance::setTolerance(const ModelHighAPI_Double& theTolerance) -{ +void FeaturesAPI_LimitTolerance::setTolerance( + const ModelHighAPI_Double &theTolerance) { fillAttribute(theTolerance, tolerance()); execute(); } //================================================================================================== -void FeaturesAPI_LimitTolerance::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_LimitTolerance::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeSelectionPtr anAttrObject = aBase->selection(FeaturesPlugin_LimitTolerance::OBJECT_ID()); - theDumper << aBase << " = model.addLimitTolerance(" << aDocName << ", " << anAttrObject; + AttributeSelectionPtr anAttrObject = + aBase->selection(FeaturesPlugin_LimitTolerance::OBJECT_ID()); + theDumper << aBase << " = model.addLimitTolerance(" << aDocName << ", " + << anAttrObject; - AttributeDoublePtr anAttrTolerance = aBase->real(FeaturesPlugin_LimitTolerance::TOLERANCE_ID()); + AttributeDoublePtr anAttrTolerance = + aBase->real(FeaturesPlugin_LimitTolerance::TOLERANCE_ID()); theDumper << ", " << anAttrTolerance; theDumper << ")" << std::endl; } //================================================================================================== -LimitTolerancePtr addLimitTolerance(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theMainObject, - const ModelHighAPI_Double& theTolerance) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_LimitTolerance::ID()); +LimitTolerancePtr +addLimitTolerance(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theMainObject, + const ModelHighAPI_Double &theTolerance) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_LimitTolerance::ID()); LimitTolerancePtr aLimitTolerance; - aLimitTolerance.reset(new FeaturesAPI_LimitTolerance(aFeature, theMainObject, theTolerance)); + aLimitTolerance.reset( + new FeaturesAPI_LimitTolerance(aFeature, theMainObject, theTolerance)); return aLimitTolerance; } diff --git a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h index cb8da3d00..b6388b75c 100644 --- a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h +++ b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESAPI_LIMITTOLERANCE_H_ @@ -34,40 +35,42 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_LimitTolerance /// \ingroup CPPHighAPI /// \brief Interface for LimitTolerance feature. -class FeaturesAPI_LimitTolerance: public ModelHighAPI_Interface -{ +class FeaturesAPI_LimitTolerance : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_LimitTolerance(const std::shared_ptr& theFeature); + explicit FeaturesAPI_LimitTolerance( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_LimitTolerance(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theShape, - const ModelHighAPI_Double& theTolerance); + explicit FeaturesAPI_LimitTolerance( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theShape, + const ModelHighAPI_Double &theTolerance); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_LimitTolerance(); - INTERFACE_2(FeaturesPlugin_LimitTolerance::ID(), - mainObject, FeaturesPlugin_LimitTolerance::OBJECT_ID(), - ModelAPI_AttributeSelection, /** Main object */, - tolerance, FeaturesPlugin_LimitTolerance::TOLERANCE_ID(), - ModelAPI_AttributeDouble, /** Tolerance */) + INTERFACE_2(FeaturesPlugin_LimitTolerance::ID(), mainObject, + FeaturesPlugin_LimitTolerance::OBJECT_ID(), + ModelAPI_AttributeSelection, /** Main object */, tolerance, + FeaturesPlugin_LimitTolerance::TOLERANCE_ID(), + ModelAPI_AttributeDouble, + /** Tolerance */) /// Set main object. FEATURESAPI_EXPORT - void setMainObject(const ModelHighAPI_Selection& theMainObject); + void setMainObject(const ModelHighAPI_Selection &theMainObject); /// Set the tolerance. FEATURESAPI_EXPORT - void setTolerance(const ModelHighAPI_Double& theTolerance); + void setTolerance(const ModelHighAPI_Double &theTolerance); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on LimitTolerance object. @@ -76,8 +79,9 @@ typedef std::shared_ptr LimitTolerancePtr; /// \ingroup CPPHighAPI /// \brief Create LimitTolerance feature. FEATURESAPI_EXPORT -LimitTolerancePtr addLimitTolerance(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theMainObject, - const ModelHighAPI_Double& theTolerance); +LimitTolerancePtr +addLimitTolerance(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theMainObject, + const ModelHighAPI_Double &theTolerance); #endif // FEATURESAPI_LIMITTOLERANCE_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Loft.cpp b/src/FeaturesAPI/FeaturesAPI_Loft.cpp index f0b726c72..5b4454530 100644 --- a/src/FeaturesAPI/FeaturesAPI_Loft.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Loft.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Loft.h" @@ -23,19 +24,19 @@ #include //================================================================================================== -FeaturesAPI_Loft::FeaturesAPI_Loft(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Loft::FeaturesAPI_Loft( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Loft::FeaturesAPI_Loft(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFirstObject, - const ModelHighAPI_Selection& theSecondObject) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Loft::FeaturesAPI_Loft( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFirstObject, + const ModelHighAPI_Selection &theSecondObject) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theFirstObject, myfisrstObject); fillAttribute(theSecondObject, mysecondObject); execute(); @@ -43,21 +44,17 @@ FeaturesAPI_Loft::FeaturesAPI_Loft(const std::shared_ptr& theF } //================================================================================================== -FeaturesAPI_Loft::~FeaturesAPI_Loft() -{ - -} +FeaturesAPI_Loft::~FeaturesAPI_Loft() {} //================================================================================================== -void FeaturesAPI_Loft::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Loft::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrFirstObject = - aBase->selection(FeaturesPlugin_Loft::FIRST_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Loft::FIRST_OBJECT_ID()); AttributeSelectionPtr anAttrSecondObject = - aBase->selection(FeaturesPlugin_Loft::SECOND_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Loft::SECOND_OBJECT_ID()); theDumper << aBase << " = model.addLoft(" << aDocName << ", " << anAttrFirstObject << ", " << anAttrSecondObject; @@ -66,12 +63,12 @@ void FeaturesAPI_Loft::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -LoftPtr addLoft(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFirstObject, - const ModelHighAPI_Selection& theSecondObject) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Loft::ID()); +LoftPtr addLoft(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFirstObject, + const ModelHighAPI_Selection &theSecondObject) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Loft::ID()); - return LoftPtr(new FeaturesAPI_Loft(aFeature, theFirstObject, theSecondObject)); + return LoftPtr( + new FeaturesAPI_Loft(aFeature, theFirstObject, theSecondObject)); } - diff --git a/src/FeaturesAPI/FeaturesAPI_Loft.h b/src/FeaturesAPI/FeaturesAPI_Loft.h index 0489bdd96..e64c23e6e 100644 --- a/src/FeaturesAPI/FeaturesAPI_Loft.h +++ b/src/FeaturesAPI/FeaturesAPI_Loft.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Loft_H_ @@ -33,32 +34,33 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Loft /// \ingroup CPPHighAPI /// \brief Interface for Loft feature. -class FeaturesAPI_Loft: public ModelHighAPI_Interface -{ +class FeaturesAPI_Loft : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Loft(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Loft( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Loft(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFirstObject, - const ModelHighAPI_Selection& theSecondObject); + explicit FeaturesAPI_Loft(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFirstObject, + const ModelHighAPI_Selection &theSecondObject); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Loft(); - INTERFACE_2(FeaturesPlugin_Loft::ID(), - fisrstObject, FeaturesPlugin_Loft::FIRST_OBJECT_ID(), - ModelAPI_AttributeSelection, /** First object */, - secondObject, FeaturesPlugin_Loft::SECOND_OBJECT_ID(), - ModelAPI_AttributeSelection, /** second objexct */) + INTERFACE_2(FeaturesPlugin_Loft::ID(), fisrstObject, + FeaturesPlugin_Loft::FIRST_OBJECT_ID(), + ModelAPI_AttributeSelection, /** First object */, secondObject, + FeaturesPlugin_Loft::SECOND_OBJECT_ID(), + ModelAPI_AttributeSelection, + /** second objexct */) /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Loft object. @@ -67,8 +69,8 @@ typedef std::shared_ptr LoftPtr; /// \ingroup CPPHighAPI /// \brief Create Loft feature. FEATURESAPI_EXPORT -LoftPtr addLoft(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFirstObject, - const ModelHighAPI_Selection& theSecondObject); +LoftPtr addLoft(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFirstObject, + const ModelHighAPI_Selection &theSecondObject); #endif // FeaturesAPI_Loft_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Measurement.cpp b/src/FeaturesAPI/FeaturesAPI_Measurement.cpp index 6e1e770d2..ca49e7e3f 100644 --- a/src/FeaturesAPI/FeaturesAPI_Measurement.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Measurement.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Measurement.h" @@ -24,18 +25,19 @@ #include #include -double measureLength(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theEdge) -{ +double measureLength(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theEdge) { FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); fillAttribute(FeaturesPlugin_Measurement::MEASURE_LENGTH(), aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); - fillAttribute(theEdge, aMeasure->selection(FeaturesPlugin_Measurement::EDGE_FOR_LENGTH_ID())); + fillAttribute(theEdge, aMeasure->selection( + FeaturesPlugin_Measurement::EDGE_FOR_LENGTH_ID())); aMeasure->execute(); // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); double aValue = aResult->size() ? aResult->value(0) : -1.0; // perform removing macro feature Measurement @@ -45,21 +47,24 @@ double measureLength(const std::shared_ptr& thePart, return aValue; } -double measureDistance(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFrom, - const ModelHighAPI_Selection& theTo) -{ +double measureDistance(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFrom, + const ModelHighAPI_Selection &theTo) { FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); fillAttribute(FeaturesPlugin_Measurement::MEASURE_DISTANCE(), aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); fillAttribute(theFrom, - aMeasure->selection(FeaturesPlugin_Measurement::DISTANCE_FROM_OBJECT_ID())); - fillAttribute(theTo, aMeasure->selection(FeaturesPlugin_Measurement::DISTANCE_TO_OBJECT_ID())); + aMeasure->selection( + FeaturesPlugin_Measurement::DISTANCE_FROM_OBJECT_ID())); + fillAttribute( + theTo, + aMeasure->selection(FeaturesPlugin_Measurement::DISTANCE_TO_OBJECT_ID())); aMeasure->execute(); // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); double aValue = aResult->size() ? aResult->value(0) : -1.0; // perform removing macro feature Measurement @@ -69,18 +74,20 @@ double measureDistance(const std::shared_ptr& thePart, return aValue; } -double measureRadius(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject) -{ +double measureRadius(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject) { FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); fillAttribute(FeaturesPlugin_Measurement::MEASURE_RADIUS(), aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); - fillAttribute(theObject, aMeasure->selection(FeaturesPlugin_Measurement::CIRCULAR_OBJECT_ID())); + fillAttribute( + theObject, + aMeasure->selection(FeaturesPlugin_Measurement::CIRCULAR_OBJECT_ID())); aMeasure->execute(); // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); double aValue = aResult->size() ? aResult->value(0) : -1.0; // perform removing macro feature Measurement @@ -90,20 +97,23 @@ double measureRadius(const std::shared_ptr& thePart, return aValue; } -std::list measureAngle(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFrom, - const ModelHighAPI_Selection& theTo) -{ +std::list +measureAngle(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFrom, + const ModelHighAPI_Selection &theTo) { FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); fillAttribute(FeaturesPlugin_Measurement::MEASURE_ANGLE(), aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); - fillAttribute(theFrom, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_FROM_EDGE_ID())); - fillAttribute(theTo, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_TO_EDGE_ID())); + fillAttribute(theFrom, aMeasure->selection( + FeaturesPlugin_Measurement::ANGLE_FROM_EDGE_ID())); + fillAttribute(theTo, aMeasure->selection( + FeaturesPlugin_Measurement::ANGLE_TO_EDGE_ID())); aMeasure->execute(); // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); std::list aValues; for (int i = 0, n = aResult->size(); i < n; ++i) aValues.push_back(aResult->value(i)); @@ -115,22 +125,25 @@ std::list measureAngle(const std::shared_ptr& thePart return aValues; } -double measureAngle(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3) -{ +double measureAngle(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3) { FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); fillAttribute(FeaturesPlugin_Measurement::MEASURE_ANGLE_POINTS(), aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); - fillAttribute(thePoint1, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_POINT1_ID())); - fillAttribute(thePoint2, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_POINT2_ID())); - fillAttribute(thePoint3, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_POINT3_ID())); + fillAttribute(thePoint1, aMeasure->selection( + FeaturesPlugin_Measurement::ANGLE_POINT1_ID())); + fillAttribute(thePoint2, aMeasure->selection( + FeaturesPlugin_Measurement::ANGLE_POINT2_ID())); + fillAttribute(thePoint3, aMeasure->selection( + FeaturesPlugin_Measurement::ANGLE_POINT3_ID())); aMeasure->execute(); // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); double aValue = aResult->size() ? aResult->value(0) : -1.0; // perform removing macro feature Measurement @@ -140,22 +153,24 @@ double measureAngle(const std::shared_ptr& thePart, return aValue; } -double shapeProximity(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFrom, - const ModelHighAPI_Selection& theTo) -{ +double shapeProximity(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFrom, + const ModelHighAPI_Selection &theTo) { FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); fillAttribute(FeaturesPlugin_Measurement::MEASURE_PROXIMITY(), aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); fillAttribute(theFrom, - aMeasure->selection(FeaturesPlugin_Measurement::DISTANCE_FROM_OBJECT_ID())); - fillAttribute(theTo, - aMeasure->selection(FeaturesPlugin_Measurement::DISTANCE_TO_OBJECT_ID())); + aMeasure->selection( + FeaturesPlugin_Measurement::DISTANCE_FROM_OBJECT_ID())); + fillAttribute( + theTo, + aMeasure->selection(FeaturesPlugin_Measurement::DISTANCE_TO_OBJECT_ID())); aMeasure->execute(); // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); double aValue = aResult->size() ? aResult->value(0) : -1.0; // perform removing macro feature Measurement diff --git a/src/FeaturesAPI/FeaturesAPI_Measurement.h b/src/FeaturesAPI/FeaturesAPI_Measurement.h index 19923d865..b52ec05cb 100644 --- a/src/FeaturesAPI/FeaturesAPI_Measurement.h +++ b/src/FeaturesAPI/FeaturesAPI_Measurement.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Measurement_H_ @@ -31,42 +32,43 @@ class ModelHighAPI_Selection; /// \ingroup CPPHighAPI /// \brief Calculate length of the edge. FEATURESAPI_EXPORT -double measureLength(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theEdge); +double measureLength(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theEdge); /// \ingroup CPPHighAPI /// \brief Calculate distance between objects. FEATURESAPI_EXPORT -double measureDistance(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFrom, - const ModelHighAPI_Selection& theTo); +double measureDistance(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFrom, + const ModelHighAPI_Selection &theTo); /// \ingroup CPPHighAPI /// \brief Calculate radius of circular edge, cylindrical surface or sphere. FEATURESAPI_EXPORT -double measureRadius(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject); +double measureRadius(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject); /// \ingroup CPPHighAPI /// \brief Calculate angle(s) between edges. FEATURESAPI_EXPORT -std::list measureAngle(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFrom, - const ModelHighAPI_Selection& theTo); +std::list +measureAngle(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFrom, + const ModelHighAPI_Selection &theTo); /// \ingroup CPPHighAPI /// \brief Calculate angle by 3 points. FEATURESAPI_EXPORT -double measureAngle(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint1, - const ModelHighAPI_Selection& thePoint2, - const ModelHighAPI_Selection& thePoint3); +double measureAngle(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint1, + const ModelHighAPI_Selection &thePoint2, + const ModelHighAPI_Selection &thePoint3); /// \ingroup CPPHighAPI /// \brief Calculate maximum of all distances between objects. FEATURESAPI_EXPORT -double shapeProximity(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFrom, - const ModelHighAPI_Selection& theTo); +double shapeProximity(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFrom, + const ModelHighAPI_Selection &theTo); #endif // FeaturesAPI_Measurement_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp b/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp index 58188025e..073fc401d 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: FeaturesAPI_MultiRotation.cpp @@ -29,108 +30,104 @@ //================================================================================================== FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } - //================================================================================================== FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Integer& theNumber) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Integer &theNumber) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theAxis, axisAngular()); - fillAttribute("",useStepAngular()); + fillAttribute("", useStepAngular()); setNumberAngular(theNumber); } } //================================================================================================== FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theStep, + const ModelHighAPI_Integer &theNumber) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theAxis, axisAngular()); - fillAttribute(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(),useStepAngular()); + fillAttribute(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(), + useStepAngular()); fillAttribute(theStep, stepAngular()); setNumberAngular(theNumber); } } //================================================================================================== -FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation() -{ -} +FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation() {} //================================================================================================== void FeaturesAPI_MultiRotation::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, mainObjects()); execute(); } //================================================================================================== -void FeaturesAPI_MultiRotation::setAxisAngular(const ModelHighAPI_Selection& theAxis) -{ +void FeaturesAPI_MultiRotation::setAxisAngular( + const ModelHighAPI_Selection &theAxis) { fillAttribute(theAxis, axisAngular()); execute(); } //================================================================================================== -void FeaturesAPI_MultiRotation::setStepAngular(const ModelHighAPI_Double& theStep) -{ +void FeaturesAPI_MultiRotation::setStepAngular( + const ModelHighAPI_Double &theStep) { fillAttribute(theStep, stepAngular()); execute(); } //================================================================================================== -void FeaturesAPI_MultiRotation::setNumberAngular(const ModelHighAPI_Integer& theNumber) -{ +void FeaturesAPI_MultiRotation::setNumberAngular( + const ModelHighAPI_Integer &theNumber) { fillAttribute(theNumber, nbAngular()); execute(); } //================================================================================================== -void FeaturesAPI_MultiRotation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_MultiRotation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addMultiRotation(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addMultiRotation(" << aDocName << ", " + << anAttrObjects; AttributeSelectionPtr anAttrAxis = - aBase->selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID()); + aBase->selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID()); theDumper << ", " << anAttrAxis; - if (aBase->string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->isInitialized() - && !aBase->string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->value().empty()) { + if (aBase->string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID()) + ->isInitialized() && + !aBase->string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID()) + ->value() + .empty()) { AttributeDoublePtr anAttrStepAngular = - aBase->real(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID()); - theDumper << ", " << anAttrStepAngular; + aBase->real(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID()); + theDumper << ", " << anAttrStepAngular; } AttributeIntegerPtr anAttrNumberAngular = - aBase->integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID()); + aBase->integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID()); theDumper << ", " << anAttrNumberAngular; if (!aBase->data()->version().empty()) @@ -140,15 +137,13 @@ void FeaturesAPI_MultiRotation::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -MultiRotationPtr addMultiRotation(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber, - const bool keepSubResults) -{ +MultiRotationPtr addMultiRotation( + const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theStep, + const ModelHighAPI_Integer &theNumber, const bool keepSubResults) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesAPI_MultiRotation::ID()); + thePart->addFeature(FeaturesAPI_MultiRotation::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); @@ -161,11 +156,11 @@ MultiRotationPtr addMultiRotation(const std::shared_ptr& theP aStepValAsStr << aStepVal; ModelHighAPI_Integer aNumber = aStepStr == aStepValAsStr.str() - ? ModelHighAPI_Integer((int)aStepVal) - : ModelHighAPI_Integer(aStepStr); - aResult.reset(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, theAxis, aNumber)); - } - else { + ? ModelHighAPI_Integer((int)aStepVal) + : ModelHighAPI_Integer(aStepStr); + aResult.reset(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, + theAxis, aNumber)); + } else { aResult.reset(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, theAxis, theStep, theNumber)); } diff --git a/src/FeaturesAPI/FeaturesAPI_MultiRotation.h b/src/FeaturesAPI/FeaturesAPI_MultiRotation.h index 1a3180f7c..3bfe6c2b8 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiRotation.h +++ b/src/FeaturesAPI/FeaturesAPI_MultiRotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: FeaturesAPI_MultiRotation.h @@ -39,64 +40,66 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_MultiRotation /// \ingroup CPPHighAPI /// \brief Interface for Translation feature. -class FeaturesAPI_MultiRotation: public ModelHighAPI_Interface -{ +class FeaturesAPI_MultiRotation : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_MultiRotation(const std::shared_ptr& theFeature); + explicit FeaturesAPI_MultiRotation( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_MultiRotation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Integer& theNumber); + FeaturesAPI_MultiRotation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Integer &theNumber); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_MultiRotation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber); + FeaturesAPI_MultiRotation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theStep, + const ModelHighAPI_Integer &theNumber); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_MultiRotation(); - INTERFACE_5(FeaturesPlugin_MultiRotation::ID(), - mainObjects, FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - axisAngular, FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID(), + INTERFACE_5(FeaturesPlugin_MultiRotation::ID(), mainObjects, + FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, axisAngular, + FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID(), ModelAPI_AttributeSelection, /** Angular direction */, - useStepAngular, FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(), - ModelAPI_AttributeString, /** Use step angular */, - stepAngular, FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID(), - ModelAPI_AttributeDouble, /** Step angular */, - nbAngular, FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID(), + useStepAngular, + FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(), + ModelAPI_AttributeString, /** Use step angular */, stepAngular, + FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID(), + ModelAPI_AttributeDouble, /** Step angular */, nbAngular, + FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID(), ModelAPI_AttributeInteger, /** Number of copies for angular */ - ) + ) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Modify CreationMethod, axis_angular attribute of the feature. FEATURESAPI_EXPORT - void setAxisAngular(const ModelHighAPI_Selection& theAxis); + void setAxisAngular(const ModelHighAPI_Selection &theAxis); /// Modify CreationMethod, step_angular attribute of the feature. FEATURESAPI_EXPORT - void setStepAngular(const ModelHighAPI_Double& theStep); + void setStepAngular(const ModelHighAPI_Double &theStep); /// Modify CreationMethod, nb_angular attribute of the feature. FEATURESAPI_EXPORT - void setNumberAngular(const ModelHighAPI_Integer& theNumber); + void setNumberAngular(const ModelHighAPI_Integer &theNumber); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Multirotation object. @@ -105,11 +108,11 @@ typedef std::shared_ptr MultiRotationPtr; /// \ingroup CPPHighAPI /// \brief Create MultiRotation feature. FEATURESAPI_EXPORT -MultiRotationPtr addMultiRotation(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber = ModelHighAPI_Integer(L""), - const bool keepSubResults = false); +MultiRotationPtr addMultiRotation( + const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theStep, + const ModelHighAPI_Integer &theNumber = ModelHighAPI_Integer(L""), + const bool keepSubResults = false); #endif // FEATURESAPI_MULTIROTATION_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp index 784c1efdd..fbf8057c1 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,48 +25,45 @@ //================================================================================================== FeaturesAPI_MultiTranslation::FeaturesAPI_MultiTranslation( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_MultiTranslation::FeaturesAPI_MultiTranslation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theStep, const ModelHighAPI_Integer &theNumber) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theAxisObject, firstAxisObject()); fillAttribute(theStep, firstStep()); - fillAttribute("",useSecondDir()); + fillAttribute("", useSecondDir()); setFirstNumber(theNumber); } } //================================================================================================== FeaturesAPI_MultiTranslation::FeaturesAPI_MultiTranslation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theFirstAxisObject, - const ModelHighAPI_Double& theFirstStep, - const ModelHighAPI_Integer& theFirstNumber, - const ModelHighAPI_Selection& theSecondAxisObject, - const ModelHighAPI_Double& theSecondStep, - const ModelHighAPI_Integer& theSecondNumber) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theFirstAxisObject, + const ModelHighAPI_Double &theFirstStep, + const ModelHighAPI_Integer &theFirstNumber, + const ModelHighAPI_Selection &theSecondAxisObject, + const ModelHighAPI_Double &theSecondStep, + const ModelHighAPI_Integer &theSecondNumber) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theFirstAxisObject, firstAxisObject()); fillAttribute(theFirstStep, firstStep()); fillAttribute(theFirstNumber, firstNumber()); - fillAttribute(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID(),useSecondDir()); + fillAttribute(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID(), + useSecondDir()); fillAttribute(theSecondAxisObject, secondAxisObject()); fillAttribute(theSecondStep, secondStep()); setSecondNumber(theSecondNumber); @@ -73,14 +71,11 @@ FeaturesAPI_MultiTranslation::FeaturesAPI_MultiTranslation( } //================================================================================================== -FeaturesAPI_MultiTranslation::~FeaturesAPI_MultiTranslation() -{ -} +FeaturesAPI_MultiTranslation::~FeaturesAPI_MultiTranslation() {} //================================================================================================== void FeaturesAPI_MultiTranslation::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, mainObjects()); execute(); @@ -88,9 +83,8 @@ void FeaturesAPI_MultiTranslation::setMainObjects( //================================================================================================== void FeaturesAPI_MultiTranslation::setFirstAxisAndDistance( - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) -{ + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance) { fillAttribute(theAxisObject, firstAxisObject()); fillAttribute(theDistance, firstStep()); @@ -99,9 +93,8 @@ void FeaturesAPI_MultiTranslation::setFirstAxisAndDistance( //================================================================================================== void FeaturesAPI_MultiTranslation::setSecondAxisAndDistance( - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) -{ + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance) { fillAttribute(theAxisObject, secondAxisObject()); fillAttribute(theDistance, secondStep()); @@ -109,48 +102,51 @@ void FeaturesAPI_MultiTranslation::setSecondAxisAndDistance( } //================================================================================================== -void FeaturesAPI_MultiTranslation::setFirstNumber(const ModelHighAPI_Integer& theFirstNumber) -{ +void FeaturesAPI_MultiTranslation::setFirstNumber( + const ModelHighAPI_Integer &theFirstNumber) { fillAttribute(theFirstNumber, firstNumber()); execute(); } //================================================================================================== -void FeaturesAPI_MultiTranslation::setSecondNumber(const ModelHighAPI_Integer& theSecondNumber) -{ +void FeaturesAPI_MultiTranslation::setSecondNumber( + const ModelHighAPI_Integer &theSecondNumber) { fillAttribute(theSecondNumber, secondNumber()); execute(); } //================================================================================================== -void FeaturesAPI_MultiTranslation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_MultiTranslation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addMultiTranslation(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addMultiTranslation(" << aDocName << ", " + << anAttrObjects; AttributeSelectionPtr anAttrFirstAxis = - aBase->selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID()); + aBase->selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID()); AttributeDoublePtr anAttrFirstStep = - aBase->real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID()); + aBase->real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID()); AttributeIntegerPtr anAttrFirstNumber = - aBase->integer(FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID()); + aBase->integer(FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID()); theDumper << ", " << anAttrFirstAxis << ", " << anAttrFirstStep; theDumper << ", " << anAttrFirstNumber; - if (aBase->string(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID())->isInitialized() - && !aBase->string(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID())->value().empty()) { + if (aBase->string(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID()) + ->isInitialized() && + !aBase->string(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID()) + ->value() + .empty()) { AttributeSelectionPtr anAttrSecondAxis = - aBase->selection(FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID()); + aBase->selection(FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID()); AttributeDoublePtr anAttrSecondStep = - aBase->real(FeaturesPlugin_MultiTranslation::STEP_SECOND_DIR_ID()); - AttributeIntegerPtr anAttrSecondNumber = - aBase->integer(FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID()); + aBase->real(FeaturesPlugin_MultiTranslation::STEP_SECOND_DIR_ID()); + AttributeIntegerPtr anAttrSecondNumber = aBase->integer( + FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID()); theDumper << ", " << anAttrSecondAxis << ", " << anAttrSecondStep; theDumper << ", " << anAttrSecondNumber; } @@ -162,29 +158,29 @@ void FeaturesAPI_MultiTranslation::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -MultiTranslationPtr addMultiTranslation(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theFirstAxisObject, - const ModelHighAPI_Double& theFirstStep, - const ModelHighAPI_Integer& theFirstNumber, - const ModelHighAPI_Selection& theSecondAxisObject, - const ModelHighAPI_Double& theSecondStep, - const ModelHighAPI_Integer& theSecondNumber, - const bool keepSubResults) -{ +MultiTranslationPtr +addMultiTranslation(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theFirstAxisObject, + const ModelHighAPI_Double &theFirstStep, + const ModelHighAPI_Integer &theFirstNumber, + const ModelHighAPI_Selection &theSecondAxisObject, + const ModelHighAPI_Double &theSecondStep, + const ModelHighAPI_Integer &theSecondNumber, + const bool keepSubResults) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesAPI_MultiTranslation::ID()); + thePart->addFeature(FeaturesAPI_MultiTranslation::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); MultiTranslationPtr aMT; if (theSecondAxisObject.variantType() == ModelHighAPI_Selection::VT_Empty) { aMT.reset(new FeaturesAPI_MultiTranslation(aFeature, theMainObjects, - theFirstAxisObject, theFirstStep, theFirstNumber)); - } - else { - aMT.reset(new FeaturesAPI_MultiTranslation(aFeature, theMainObjects, - theFirstAxisObject, theFirstStep, theFirstNumber, - theSecondAxisObject, theSecondStep, theSecondNumber)); + theFirstAxisObject, theFirstStep, + theFirstNumber)); + } else { + aMT.reset(new FeaturesAPI_MultiTranslation( + aFeature, theMainObjects, theFirstAxisObject, theFirstStep, + theFirstNumber, theSecondAxisObject, theSecondStep, theSecondNumber)); } return aMT; } diff --git a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h index ab1f1167a..6336a8f8b 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h +++ b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESAPI_MULTITRANSLATION_H_ @@ -35,80 +36,87 @@ class ModelHighAPI_Dumper; /// \class FeaturesAPI_MultiTranslation /// \ingroup CPPHighAPI /// \brief Interface for Translation feature. -class FeaturesAPI_MultiTranslation: public ModelHighAPI_Interface -{ +class FeaturesAPI_MultiTranslation : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_MultiTranslation(const std::shared_ptr& theFeature); + explicit FeaturesAPI_MultiTranslation( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_MultiTranslation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber); + explicit FeaturesAPI_MultiTranslation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theStep, + const ModelHighAPI_Integer &theNumber); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_MultiTranslation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theFirstAxisObject, - const ModelHighAPI_Double& theFirstStep, - const ModelHighAPI_Integer& theFirstNumber, - const ModelHighAPI_Selection& theSecondAxisObject, - const ModelHighAPI_Double& theSecondStep, - const ModelHighAPI_Integer& theSecondNumber); + explicit FeaturesAPI_MultiTranslation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theFirstAxisObject, + const ModelHighAPI_Double &theFirstStep, + const ModelHighAPI_Integer &theFirstNumber, + const ModelHighAPI_Selection &theSecondAxisObject, + const ModelHighAPI_Double &theSecondStep, + const ModelHighAPI_Integer &theSecondNumber); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_MultiTranslation(); - INTERFACE_8(FeaturesPlugin_MultiTranslation::ID(), - mainObjects, FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID(), + INTERFACE_8(FeaturesPlugin_MultiTranslation::ID(), mainObjects, + FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */, - firstAxisObject, FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID(), - ModelAPI_AttributeSelection, /** First axis object */, - firstStep, FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID(), - ModelAPI_AttributeDouble, /** First step */, - firstNumber, FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID(), + firstAxisObject, + FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID(), + ModelAPI_AttributeSelection, /** First axis object */, firstStep, + FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID(), + ModelAPI_AttributeDouble, /** First step */, firstNumber, + FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID(), ModelAPI_AttributeInteger, /** First number of copies */, - useSecondDir, FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID(), + useSecondDir, + FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID(), ModelAPI_AttributeString, /** Use the second dir */, - secondAxisObject, FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID(), + secondAxisObject, + FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID(), ModelAPI_AttributeSelection, /** Second axis object */, secondStep, FeaturesPlugin_MultiTranslation::STEP_SECOND_DIR_ID(), - ModelAPI_AttributeDouble, /** Second step */, - secondNumber, FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID(), + ModelAPI_AttributeDouble, /** Second step */, secondNumber, + FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID(), ModelAPI_AttributeInteger, /** Second number of copies */ - ) + ) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); - /// Modify CreationMethod, axis_first_dir, step_first_dir attributes of the feature. + /// Modify CreationMethod, axis_first_dir, step_first_dir attributes of the + /// feature. FEATURESAPI_EXPORT - void setFirstAxisAndDistance(const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance); + void setFirstAxisAndDistance(const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance); - /// Modify CreationMethod, axis_second_dir, step_second_dir attributes of the feature. + /// Modify CreationMethod, axis_second_dir, step_second_dir attributes of the + /// feature. FEATURESAPI_EXPORT - void setSecondAxisAndDistance(const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance); + void setSecondAxisAndDistance(const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance); /// Modify CreationMethod, nb_first_dir attribute of the feature. FEATURESAPI_EXPORT - void setFirstNumber(const ModelHighAPI_Integer& theFirstNumber); + void setFirstNumber(const ModelHighAPI_Integer &theFirstNumber); /// Modify CreationMethod, nb_second_dir attribute of the feature. FEATURESAPI_EXPORT - void setSecondNumber(const ModelHighAPI_Integer& theSecondNumber); + void setSecondNumber(const ModelHighAPI_Integer &theSecondNumber); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on MultiTranslation object. @@ -117,14 +125,15 @@ typedef std::shared_ptr MultiTranslationPtr; /// \ingroup CPPHighAPI /// \brief Create MultiTranslation feature. FEATURESAPI_EXPORT MultiTranslationPtr addMultiTranslation( - const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theFirstAxisObject, - const ModelHighAPI_Double& theFirstStep, - const ModelHighAPI_Integer& theFirstNumber, - const ModelHighAPI_Selection& theSecondAxisObject = ModelHighAPI_Selection(), - const ModelHighAPI_Double& theSecondStep = ModelHighAPI_Double(), - const ModelHighAPI_Integer& theSecondNumber = ModelHighAPI_Integer(), + const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theFirstAxisObject, + const ModelHighAPI_Double &theFirstStep, + const ModelHighAPI_Integer &theFirstNumber, + const ModelHighAPI_Selection &theSecondAxisObject = + ModelHighAPI_Selection(), + const ModelHighAPI_Double &theSecondStep = ModelHighAPI_Double(), + const ModelHighAPI_Integer &theSecondNumber = ModelHighAPI_Integer(), const bool keepSubResults = false); #endif // FEATURESAPI_MULTITRANSLATION_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp b/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp index 29626c675..4bed8aceb 100644 --- a/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp +++ b/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_NormalToFace.h" @@ -25,60 +26,62 @@ //================================================================================================= FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================= FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBaseFace, - const ModelHighAPI_Selection& theOptionalPoint) -:ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBaseFace, + const ModelHighAPI_Selection &theOptionalPoint) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theBaseFace, myfaceSelected); fillAttribute(theOptionalPoint, myvertexSelected); - feature()->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID())->setValue("true"); + feature() + ->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID()) + ->setValue("true"); execute(); } } //================================================================================================= FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBaseFace) -:ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBaseFace) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theBaseFace, myfaceSelected); - feature()->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID())->setValue(""); + feature() + ->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID()) + ->setValue(""); execute(); } } //================================================================================================= -FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() -{ -} +FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() {} //================================================================================================= -void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrObject; - anAttrObject = aBase->selection(FeaturesPlugin_NormalToFace::FACE_SELECTED_ID()); + anAttrObject = + aBase->selection(FeaturesPlugin_NormalToFace::FACE_SELECTED_ID()); - theDumper << aBase << " = model.getNormal(" << aDocName << ", " << anAttrObject; + theDumper << aBase << " = model.getNormal(" << aDocName << ", " + << anAttrObject; - if (!aBase->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID())->value().empty()) { + if (!aBase->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID()) + ->value() + .empty()) { AttributeSelectionPtr anAttrVertex = - aBase->selection(FeaturesPlugin_NormalToFace::VERTEX_SELECTED_ID()); + aBase->selection(FeaturesPlugin_NormalToFace::VERTEX_SELECTED_ID()); theDumper << ", " << anAttrVertex; } @@ -87,22 +90,21 @@ void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -NormalPtr getNormal(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseFace, - const ModelHighAPI_Selection& theOptionalPoint) -{ +NormalPtr getNormal(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBaseFace, + const ModelHighAPI_Selection &theOptionalPoint) { FeaturePtr aFeature = thePart->addFeature(FeaturesPlugin_NormalToFace::ID()); NormalPtr aNormalToface; - aNormalToface.reset(new FeaturesAPI_NormalToFace(aFeature, theBaseFace, theOptionalPoint)); + aNormalToface.reset( + new FeaturesAPI_NormalToFace(aFeature, theBaseFace, theOptionalPoint)); return aNormalToface; } //================================================================================================= -NormalPtr getNormal(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseFace) -{ +NormalPtr getNormal(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBaseFace) { FeaturePtr aFeature = thePart->addFeature(FeaturesPlugin_NormalToFace::ID()); NormalPtr aNormalToface; @@ -110,4 +112,3 @@ NormalPtr getNormal(const std::shared_ptr& thePart, return aNormalToface; } - diff --git a/src/FeaturesAPI/FeaturesAPI_NormalToFace.h b/src/FeaturesAPI/FeaturesAPI_NormalToFace.h index 815f3ccc6..7f435a34e 100644 --- a/src/FeaturesAPI/FeaturesAPI_NormalToFace.h +++ b/src/FeaturesAPI/FeaturesAPI_NormalToFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_NormalToFace_H_ @@ -27,46 +28,47 @@ #include #include - class ModelHighAPI_Selection; /// \class FeaturesAPI_NormalToFace /// \ingroup CPPHighAPI /// \brief Interface for NormalToface feature. -class FeaturesAPI_NormalToFace: public ModelHighAPI_Interface -{ +class FeaturesAPI_NormalToFace : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_NormalToFace(const std::shared_ptr& theFeature); + explicit FeaturesAPI_NormalToFace( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_NormalToFace(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBaseFace, - const ModelHighAPI_Selection& theOptionalPoint); + explicit FeaturesAPI_NormalToFace( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBaseFace, + const ModelHighAPI_Selection &theOptionalPoint); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_NormalToFace(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBaseFace); + explicit FeaturesAPI_NormalToFace( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBaseFace); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_NormalToFace(); - INTERFACE_3(FeaturesPlugin_NormalToFace::ID(), - faceSelected, FeaturesPlugin_NormalToFace::FACE_SELECTED_ID(), - ModelAPI_AttributeSelection, /** base face */, - vertexSelected, FeaturesPlugin_NormalToFace::VERTEX_SELECTED_ID(), - ModelAPI_AttributeSelection, /** vertex */, - vertexOption, FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID(), - ModelAPI_AttributeString, /** use a vertex */) + INTERFACE_3(FeaturesPlugin_NormalToFace::ID(), faceSelected, + FeaturesPlugin_NormalToFace::FACE_SELECTED_ID(), + ModelAPI_AttributeSelection, /** base face */, vertexSelected, + FeaturesPlugin_NormalToFace::VERTEX_SELECTED_ID(), + ModelAPI_AttributeSelection, /** vertex */, vertexOption, + FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID(), + ModelAPI_AttributeString, + /** use a vertex */) /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; - + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on the NormalToface object. @@ -78,16 +80,16 @@ typedef std::shared_ptr NormalPtr; /// \param theBaseFace the selected face /// \param theOptionalPoint the selected point FEATURESAPI_EXPORT -NormalPtr getNormal(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseFace, - const ModelHighAPI_Selection& theOptionalPoint); +NormalPtr getNormal(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBaseFace, + const ModelHighAPI_Selection &theOptionalPoint); /// \ingroup CPPHighAPI /// \brief Create normal to a face feature /// \param thePart the part /// \param theBaseFace the selected face FEATURESAPI_EXPORT -NormalPtr getNormal(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseFace); +NormalPtr getNormal(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBaseFace); #endif // FeaturesAPI_NormalToFace_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.cpp b/src/FeaturesAPI/FeaturesAPI_Partition.cpp index 8ba553f1a..fd67b8b50 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Partition.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Partition.h" @@ -22,25 +23,22 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== -FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Partition::FeaturesAPI_Partition( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_Partition::FeaturesAPI_Partition( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, VAR_NAME(baseObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -57,47 +55,44 @@ FeaturesAPI_Partition::FeaturesAPI_Partition( } //================================================================================================== -FeaturesAPI_Partition::~FeaturesAPI_Partition() -{ - -} +FeaturesAPI_Partition::~FeaturesAPI_Partition() {} //================================================================================================== -void FeaturesAPI_Partition::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_Partition::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, VAR_NAME(baseObjects)); execute(); } //================================================================================================== -void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Partition::BASE_OBJECTS_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_Partition::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_Partition::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_Partition::BASE_OBJECTS_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_Partition::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_Partition::FUZZY_PARAM_ID()); - theDumper << aBase << " = model.addPartition(" << aDocName << ", " << anAttrObjects; + theDumper << aBase << " = model.addPartition(" << aDocName << ", " + << anAttrObjects; if (aUseFuzzy) theDumper << ", fuzzyParam = " << aFuzzy; @@ -109,13 +104,14 @@ void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -PartitionPtr addPartition(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Partition::ID()); +PartitionPtr +addPartition(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theFuzzy, const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Partition::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects, theFuzzy)); + return PartitionPtr( + new FeaturesAPI_Partition(aFeature, theBaseObjects, theFuzzy)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.h b/src/FeaturesAPI/FeaturesAPI_Partition.h index 769a0ba2c..63fe5c253 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.h +++ b/src/FeaturesAPI/FeaturesAPI_Partition.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Partition_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Dumper; class ModelHighAPI_Selection; @@ -34,34 +35,36 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Partition /// \ingroup CPPHighAPI /// \brief Interface for Partition feature. -class FeaturesAPI_Partition: public ModelHighAPI_Interface -{ +class FeaturesAPI_Partition : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Partition(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Partition( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Partition(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + explicit FeaturesAPI_Partition( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Partition(); - INTERFACE_3(FeaturesPlugin_Partition::ID(), - baseObjects, FeaturesPlugin_Partition::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - useFuzzy, FeaturesPlugin_Partition::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_Partition::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_3(FeaturesPlugin_Partition::ID(), baseObjects, + FeaturesPlugin_Partition::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, useFuzzy, + FeaturesPlugin_Partition::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_Partition::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -69,11 +72,11 @@ public: /// Modify fuzzy parameter attribute of the feature. FEATURESAPI_EXPORT - void setFuzzy(const ModelHighAPI_Double& theFuzzy); + void setFuzzy(const ModelHighAPI_Double &theFuzzy); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Partition object. @@ -82,9 +85,10 @@ typedef std::shared_ptr PartitionPtr; /// \ingroup CPPHighAPI /// \brief Create Partition feature. FEATURESAPI_EXPORT -PartitionPtr addPartition(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +PartitionPtr +addPartition(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_Partition_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Pipe.cpp b/src/FeaturesAPI/FeaturesAPI_Pipe.cpp index 60c374e9b..b26fe63e4 100644 --- a/src/FeaturesAPI/FeaturesAPI_Pipe.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Pipe.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Pipe.h" @@ -23,74 +24,71 @@ #include //================================================================================================== -FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Pipe::FeaturesAPI_Pipe( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Pipe::FeaturesAPI_Pipe( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByBasePath(theBaseObjects, thePath); } } //================================================================================================== -FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const ModelHighAPI_Selection& theBiNoramal) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Pipe::FeaturesAPI_Pipe( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const ModelHighAPI_Selection &theBiNoramal) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByBasePathBiNormal(theBaseObjects, thePath, theBiNoramal); } } //================================================================================================== -FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const std::list& theLocations) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Pipe::FeaturesAPI_Pipe( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const std::list &theLocations) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setByBasePathLocations(theBaseObjects, thePath, theLocations); } } //================================================================================================== -FeaturesAPI_Pipe::~FeaturesAPI_Pipe() -{ - -} +FeaturesAPI_Pipe::~FeaturesAPI_Pipe() {} //================================================================================================== -void FeaturesAPI_Pipe::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_Pipe::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, mybaseObjects); execute(); } //================================================================================================== -void FeaturesAPI_Pipe::setPath(const ModelHighAPI_Selection& thePath) -{ +void FeaturesAPI_Pipe::setPath(const ModelHighAPI_Selection &thePath) { fillAttribute(thePath, mypath); execute(); } //================================================================================================== -void FeaturesAPI_Pipe::setByBasePath(const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath) -{ - fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE(), mycreationMethod); +void FeaturesAPI_Pipe::setByBasePath( + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath) { + fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(thePath, mypath); @@ -99,11 +97,11 @@ void FeaturesAPI_Pipe::setByBasePath(const std::list& th //================================================================================================== void FeaturesAPI_Pipe::setByBasePathBiNormal( - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const ModelHighAPI_Selection& theBiNoramal) -{ - fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL(), mycreationMethod); + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const ModelHighAPI_Selection &theBiNoramal) { + fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(thePath, mypath); fillAttribute(theBiNoramal, mybiNormal); @@ -113,11 +111,11 @@ void FeaturesAPI_Pipe::setByBasePathBiNormal( //================================================================================================== void FeaturesAPI_Pipe::setByBasePathLocations( - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const std::list& theLocations) -{ - fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS(), mycreationMethod); + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const std::list &theLocations) { + fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS(), + mycreationMethod); fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(thePath, mypath); fillAttribute(theLocations, mylocations); @@ -126,29 +124,33 @@ void FeaturesAPI_Pipe::setByBasePathLocations( } //================================================================================================== -void FeaturesAPI_Pipe::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Pipe::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Pipe::BASE_OBJECTS_ID()); - AttributeSelectionPtr anAttrPath = aBase->selection(FeaturesPlugin_Pipe::PATH_OBJECT_ID()); + aBase->selectionList(FeaturesPlugin_Pipe::BASE_OBJECTS_ID()); + AttributeSelectionPtr anAttrPath = + aBase->selection(FeaturesPlugin_Pipe::PATH_OBJECT_ID()); - theDumper << aBase << " = model.addPipe(" << aDocName << ", " - << anAttrObjects << ", " << anAttrPath; + theDumper << aBase << " = model.addPipe(" << aDocName << ", " << anAttrObjects + << ", " << anAttrPath; - std::string aCreationMethod = aBase->string(FeaturesPlugin_Pipe::CREATION_METHOD())->value(); + std::string aCreationMethod = + aBase->string(FeaturesPlugin_Pipe::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE()) { + if (aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE()) { // Do nothing; - } else if(aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL()) { - AttributeSelectionPtr anAttrBiNormal = aBase->selection(FeaturesPlugin_Pipe::BINORMAL_ID()); + } else if (aCreationMethod == + FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL()) { + AttributeSelectionPtr anAttrBiNormal = + aBase->selection(FeaturesPlugin_Pipe::BINORMAL_ID()); theDumper << ", " << anAttrBiNormal; - } else if(aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS()) { + } else if (aCreationMethod == + FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS()) { AttributeSelectionListPtr anAttrLocations = - aBase->selectionList(FeaturesPlugin_Pipe::LOCATIONS_ID()); + aBase->selectionList(FeaturesPlugin_Pipe::LOCATIONS_ID()); theDumper << ", " << anAttrLocations; } @@ -157,30 +159,32 @@ void FeaturesAPI_Pipe::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -PipePtr addPipe(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID()); +PipePtr addPipe(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Pipe::ID()); return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath)); } //================================================================================================== -PipePtr addPipe(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const ModelHighAPI_Selection& theBiNoramal) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID()); - return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theBiNoramal)); +PipePtr addPipe(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const ModelHighAPI_Selection &theBiNoramal) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Pipe::ID()); + return PipePtr( + new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theBiNoramal)); } //================================================================================================== -PipePtr addPipe(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const std::list& theLocations) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID()); - return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theLocations)); +PipePtr addPipe(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const std::list &theLocations) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Pipe::ID()); + return PipePtr( + new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theLocations)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Pipe.h b/src/FeaturesAPI/FeaturesAPI_Pipe.h index cbad20cc8..e95b617d2 100644 --- a/src/FeaturesAPI/FeaturesAPI_Pipe.h +++ b/src/FeaturesAPI/FeaturesAPI_Pipe.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Pipe_H_ @@ -33,77 +34,82 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Pipe /// \ingroup CPPHighAPI /// \brief Interface for Pipe feature. -class FeaturesAPI_Pipe: public ModelHighAPI_Interface -{ +class FeaturesAPI_Pipe : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Pipe(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Pipe( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Pipe(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath); + explicit FeaturesAPI_Pipe( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Pipe(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const ModelHighAPI_Selection& theBiNoramal); + explicit FeaturesAPI_Pipe( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const ModelHighAPI_Selection &theBiNoramal); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Pipe(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const std::list& theLocations); + explicit FeaturesAPI_Pipe( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const std::list &theLocations); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Pipe(); - INTERFACE_5(FeaturesPlugin_Pipe::ID(), - baseObjects, FeaturesPlugin_Pipe::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - path, FeaturesPlugin_Pipe::PATH_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Path */, - creationMethod, FeaturesPlugin_Pipe::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - biNormal, FeaturesPlugin_Pipe::BINORMAL_ID(), - ModelAPI_AttributeSelection, /** Bi-Normal */, - locations, FeaturesPlugin_Pipe::LOCATIONS_ID(), - ModelAPI_AttributeSelectionList, /** Locations */) + INTERFACE_5(FeaturesPlugin_Pipe::ID(), baseObjects, + FeaturesPlugin_Pipe::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, path, + FeaturesPlugin_Pipe::PATH_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Path */, creationMethod, + FeaturesPlugin_Pipe::CREATION_METHOD(), ModelAPI_AttributeString, + /** Creation method */, biNormal, + FeaturesPlugin_Pipe::BINORMAL_ID(), ModelAPI_AttributeSelection, + /** Bi-Normal */, locations, FeaturesPlugin_Pipe::LOCATIONS_ID(), + ModelAPI_AttributeSelectionList, + /** Locations */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Modify path attribute of the feature. FEATURESAPI_EXPORT - void setPath(const ModelHighAPI_Selection& thePath); + void setPath(const ModelHighAPI_Selection &thePath); /// Modify creation method, base and path. FEATURESAPI_EXPORT - void setByBasePath(const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath); + void setByBasePath(const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath); /// Modify creation method, base, path and bi-normal. FEATURESAPI_EXPORT - void setByBasePathBiNormal(const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const ModelHighAPI_Selection& theBiNoramal); + void + setByBasePathBiNormal(const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const ModelHighAPI_Selection &theBiNoramal); /// Modify creation method, base, path and locations. FEATURESAPI_EXPORT - void setByBasePathLocations(const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const std::list& theLocations); + void setByBasePathLocations( + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const std::list &theLocations); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Pipe object. @@ -112,24 +118,24 @@ typedef std::shared_ptr PipePtr; /// \ingroup CPPHighAPI /// \brief Create Pipe feature. FEATURESAPI_EXPORT -PipePtr addPipe(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath); +PipePtr addPipe(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath); /// \ingroup CPPHighAPI /// \brief Create Pipe feature. FEATURESAPI_EXPORT -PipePtr addPipe(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const ModelHighAPI_Selection& theBiNoramal); +PipePtr addPipe(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const ModelHighAPI_Selection &theBiNoramal); /// \ingroup CPPHighAPI /// \brief Create Pipe feature. FEATURESAPI_EXPORT -PipePtr addPipe(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& thePath, - const std::list& theLocations); +PipePtr addPipe(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &thePath, + const std::list &theLocations); #endif // FeaturesAPI_Pipe_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Placement.cpp b/src/FeaturesAPI/FeaturesAPI_Placement.cpp index 5b584476b..48ff8854d 100644 --- a/src/FeaturesAPI/FeaturesAPI_Placement.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Placement.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Placement.h" @@ -23,22 +24,21 @@ #include //================================================================================================== -FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Placement::FeaturesAPI_Placement( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr& theFeature, - const std::list& theObjects, - const ModelHighAPI_Selection& theStartShape, - const ModelHighAPI_Selection& theEndShape, - const bool theReverseDirection, - const bool theCentering) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Placement::FeaturesAPI_Placement( + const std::shared_ptr &theFeature, + const std::list &theObjects, + const ModelHighAPI_Selection &theStartShape, + const ModelHighAPI_Selection &theEndShape, const bool theReverseDirection, + const bool theCentering) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theObjects, myobjects); fillAttribute(theStartShape, mystartShape); fillAttribute(theEndShape, myendShape); @@ -48,67 +48,66 @@ FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr& theObjects) -{ +void FeaturesAPI_Placement::setObjects( + const std::list &theObjects) { fillAttribute(theObjects, myobjects); execute(); } //================================================================================================== -void FeaturesAPI_Placement::setStartShape(const ModelHighAPI_Selection& theStartShape) -{ +void FeaturesAPI_Placement::setStartShape( + const ModelHighAPI_Selection &theStartShape) { fillAttribute(theStartShape, mystartShape); execute(); } //================================================================================================== -void FeaturesAPI_Placement::setEndShape(const ModelHighAPI_Selection& theEndShape) -{ +void FeaturesAPI_Placement::setEndShape( + const ModelHighAPI_Selection &theEndShape) { fillAttribute(theEndShape, myendShape); execute(); } //================================================================================================== -void FeaturesAPI_Placement::setReverseDirection(const bool theReverseDirection) -{ +void FeaturesAPI_Placement::setReverseDirection( + const bool theReverseDirection) { fillAttribute(theReverseDirection, myreverseDirection); execute(); } //================================================================================================== -void FeaturesAPI_Placement::setCentering(const bool theCentering) -{ +void FeaturesAPI_Placement::setCentering(const bool theCentering) { fillAttribute(theCentering, mycentering); execute(); } //================================================================================================== -void FeaturesAPI_Placement::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Placement::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Placement::OBJECTS_LIST_ID()); + aBase->selectionList(FeaturesPlugin_Placement::OBJECTS_LIST_ID()); AttributeSelectionPtr anAttrStartShape = - aBase->selection(FeaturesPlugin_Placement::START_SHAPE_ID()); - AttributeSelectionPtr anAttrEndShape = aBase->selection(FeaturesPlugin_Placement::END_SHAPE_ID()); - AttributeBooleanPtr anAttrReverse = aBase->boolean(FeaturesPlugin_Placement::REVERSE_ID()); - AttributeBooleanPtr anAttrCentering = aBase->boolean(FeaturesPlugin_Placement::CENTERING_ID()); + aBase->selection(FeaturesPlugin_Placement::START_SHAPE_ID()); + AttributeSelectionPtr anAttrEndShape = + aBase->selection(FeaturesPlugin_Placement::END_SHAPE_ID()); + AttributeBooleanPtr anAttrReverse = + aBase->boolean(FeaturesPlugin_Placement::REVERSE_ID()); + AttributeBooleanPtr anAttrCentering = + aBase->boolean(FeaturesPlugin_Placement::CENTERING_ID()); theDumper << aBase << " = model.addPlacement(" << aDocName << ", " - << anAttrObjects << ", " << anAttrStartShape << ", " << anAttrEndShape; + << anAttrObjects << ", " << anAttrStartShape << ", " + << anAttrEndShape; if (anAttrReverse->value()) theDumper << ", reverse = " << anAttrReverse; @@ -121,21 +120,17 @@ void FeaturesAPI_Placement::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -PlacementPtr addPlacement(const std::shared_ptr& thePart, - const std::list& theObjects, - const ModelHighAPI_Selection& theStartShape, - const ModelHighAPI_Selection& theEndShape, +PlacementPtr addPlacement(const std::shared_ptr &thePart, + const std::list &theObjects, + const ModelHighAPI_Selection &theStartShape, + const ModelHighAPI_Selection &theEndShape, const bool theReverseDirection, - const bool theCentering, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Placement::ID()); + const bool theCentering, const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Placement::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); - return PlacementPtr(new FeaturesAPI_Placement(aFeature, - theObjects, - theStartShape, - theEndShape, - theReverseDirection, - theCentering)); + return PlacementPtr(new FeaturesAPI_Placement( + aFeature, theObjects, theStartShape, theEndShape, theReverseDirection, + theCentering)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Placement.h b/src/FeaturesAPI/FeaturesAPI_Placement.h index 86f9f9430..5b6d4a445 100644 --- a/src/FeaturesAPI/FeaturesAPI_Placement.h +++ b/src/FeaturesAPI/FeaturesAPI_Placement.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Placement_H_ @@ -33,19 +34,19 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Placement /// \ingroup CPPHighAPI /// \brief Interface for Placement feature. -class FeaturesAPI_Placement: public ModelHighAPI_Interface -{ +class FeaturesAPI_Placement : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Placement(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Placement( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_Placement(const std::shared_ptr& theFeature, - const std::list& theObjects, - const ModelHighAPI_Selection& theStartShape, - const ModelHighAPI_Selection& theEndShape, + FeaturesAPI_Placement(const std::shared_ptr &theFeature, + const std::list &theObjects, + const ModelHighAPI_Selection &theStartShape, + const ModelHighAPI_Selection &theEndShape, const bool theReverseDirection = false, const bool theCentering = false); @@ -53,29 +54,30 @@ public: FEATURESAPI_EXPORT virtual ~FeaturesAPI_Placement(); - INTERFACE_5(FeaturesPlugin_Placement::ID(), - objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - startShape, FeaturesPlugin_Placement::START_SHAPE_ID(), - ModelAPI_AttributeSelection, /** Start shape */, - endShape, FeaturesPlugin_Placement::END_SHAPE_ID(), - ModelAPI_AttributeSelection, /** End shape */, - reverseDirection, FeaturesPlugin_Placement::REVERSE_ID(), - ModelAPI_AttributeBoolean, /** Reverse direction flag */, - centering, FeaturesPlugin_Placement::CENTERING_ID(), - ModelAPI_AttributeBoolean, /** Centering flag */) + INTERFACE_5(FeaturesPlugin_Placement::ID(), objects, + FeaturesPlugin_Placement::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, startShape, + FeaturesPlugin_Placement::START_SHAPE_ID(), + ModelAPI_AttributeSelection, /** Start shape */, endShape, + FeaturesPlugin_Placement::END_SHAPE_ID(), + ModelAPI_AttributeSelection, /** End shape */, reverseDirection, + FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean, + /** Reverse direction flag */, centering, + FeaturesPlugin_Placement::CENTERING_ID(), + ModelAPI_AttributeBoolean, + /** Centering flag */) /// Set objects. FEATURESAPI_EXPORT - void setObjects(const std::list& theObjects); + void setObjects(const std::list &theObjects); /// Set start shape. FEATURESAPI_EXPORT - void setStartShape(const ModelHighAPI_Selection& theStartShape); + void setStartShape(const ModelHighAPI_Selection &theStartShape); /// Set end shape. FEATURESAPI_EXPORT - void setEndShape(const ModelHighAPI_Selection& theEndShape); + void setEndShape(const ModelHighAPI_Selection &theEndShape); /// Set reverse direction flag. FEATURESAPI_EXPORT @@ -87,7 +89,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Placement object. @@ -96,10 +98,10 @@ typedef std::shared_ptr PlacementPtr; /// \ingroup CPPHighAPI /// \brief Create Placement feature. FEATURESAPI_EXPORT -PlacementPtr addPlacement(const std::shared_ptr& thePart, - const std::list& theObjects, - const ModelHighAPI_Selection& theStartShape, - const ModelHighAPI_Selection& theEndShape, +PlacementPtr addPlacement(const std::shared_ptr &thePart, + const std::list &theObjects, + const ModelHighAPI_Selection &theStartShape, + const ModelHighAPI_Selection &theEndShape, const bool reverse = false, const bool centering = false, const bool keepSubResults = false); diff --git a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp index f97a31545..81517a348 100644 --- a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp +++ b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_PointCloudOnFace.h" @@ -24,61 +25,59 @@ #include //================================================================================================= -FeaturesAPI_PointCloudOnFace::FeaturesAPI_PointCloudOnFace(const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_PointCloudOnFace::FeaturesAPI_PointCloudOnFace( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================= FeaturesAPI_PointCloudOnFace::FeaturesAPI_PointCloudOnFace( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Integer& theNumber) -:ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Integer &theNumber) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theFace, myfaceSelected); setNumberOfPoints(theNumber); } } - //================================================================================================= -FeaturesAPI_PointCloudOnFace::~FeaturesAPI_PointCloudOnFace() -{ -} +FeaturesAPI_PointCloudOnFace::~FeaturesAPI_PointCloudOnFace() {} //================================================================================================== -void FeaturesAPI_PointCloudOnFace::setNumberOfPoints(const ModelHighAPI_Integer& theNumber) -{ +void FeaturesAPI_PointCloudOnFace::setNumberOfPoints( + const ModelHighAPI_Integer &theNumber) { fillAttribute(theNumber, nbPoints()); execute(); } //================================================================================================= -void FeaturesAPI_PointCloudOnFace::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_PointCloudOnFace::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrObject = - aBase->selection(FeaturesPlugin_PointCloudOnFace::FACE_SELECTED_ID()); - int aNbPnts = aBase->integer(FeaturesPlugin_PointCloudOnFace::NUMBER_ID())->value(); + aBase->selection(FeaturesPlugin_PointCloudOnFace::FACE_SELECTED_ID()); + int aNbPnts = + aBase->integer(FeaturesPlugin_PointCloudOnFace::NUMBER_ID())->value(); - theDumper << aBase << " = model.makeVertexInsideFace(" << aDocName - << ", " << anAttrObject << ", " << aNbPnts << ")" << std::endl; + theDumper << aBase << " = model.makeVertexInsideFace(" << aDocName << ", " + << anAttrObject << ", " << aNbPnts << ")" << std::endl; } //================================================================================================== -PointCloudPtr makeVertexInsideFace(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Integer& theNumber) -{ - FeaturePtr aFeature = thePart->addFeature(FeaturesPlugin_PointCloudOnFace::ID()); +PointCloudPtr +makeVertexInsideFace(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Integer &theNumber) { + FeaturePtr aFeature = + thePart->addFeature(FeaturesPlugin_PointCloudOnFace::ID()); PointCloudPtr aPointCloud; - aPointCloud.reset(new FeaturesAPI_PointCloudOnFace(aFeature, theFace, theNumber)); + aPointCloud.reset( + new FeaturesAPI_PointCloudOnFace(aFeature, theFace, theNumber)); return aPointCloud; } diff --git a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h index e54d92ce1..848f36622 100644 --- a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h +++ b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_PointCloudOnFace_H_ @@ -24,47 +25,47 @@ #include +#include #include #include -#include - class ModelHighAPI_Selection; /// \class FeaturesAPI_PointCloudOnFace /// \ingroup CPPHighAPI /// \brief Interface for PointCloudOnFace feature. -class FeaturesAPI_PointCloudOnFace: public ModelHighAPI_Interface -{ +class FeaturesAPI_PointCloudOnFace : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_PointCloudOnFace(const std::shared_ptr& theFeature); + explicit FeaturesAPI_PointCloudOnFace( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_PointCloudOnFace(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Integer& theNumber); + explicit FeaturesAPI_PointCloudOnFace( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Integer &theNumber); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_PointCloudOnFace(); - INTERFACE_2(FeaturesPlugin_PointCloudOnFace::ID(), - faceSelected, FeaturesPlugin_PointCloudOnFace::FACE_SELECTED_ID(), - ModelAPI_AttributeSelection, /** face */, - nbPoints, FeaturesPlugin_PointCloudOnFace::NUMBER_ID(), - ModelAPI_AttributeInteger, /** Number of points */) + INTERFACE_2(FeaturesPlugin_PointCloudOnFace::ID(), faceSelected, + FeaturesPlugin_PointCloudOnFace::FACE_SELECTED_ID(), + ModelAPI_AttributeSelection, /** face */, nbPoints, + FeaturesPlugin_PointCloudOnFace::NUMBER_ID(), + ModelAPI_AttributeInteger, + /** Number of points */) /// Modify CreationMethod, nb_points attribute of the feature. FEATURESAPI_EXPORT - void setNumberOfPoints(const ModelHighAPI_Integer& theNumber); + void setNumberOfPoints(const ModelHighAPI_Integer &theNumber); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; - + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on the PointCloudOnFace object. @@ -76,8 +77,9 @@ typedef std::shared_ptr PointCloudPtr; /// \param theFace the selected face /// \param theNumberOfPoints the selected point FEATURESAPI_EXPORT -PointCloudPtr makeVertexInsideFace(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFace, - const ModelHighAPI_Integer& theNumber); +PointCloudPtr +makeVertexInsideFace(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFace, + const ModelHighAPI_Integer &theNumber); #endif // FeaturesAPI_PointCloudOnFace_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp index 784d7775a..6c05374f8 100644 --- a/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp +++ b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_PointCoordinates.h" @@ -24,21 +25,25 @@ #include #include -std::list getPointCoordinates(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint) -{ - FeaturePtr aPointCoordFeat = thePart->addFeature(FeaturesPlugin_PointCoordinates::ID()); +std::list +getPointCoordinates(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint) { + FeaturePtr aPointCoordFeat = + thePart->addFeature(FeaturesPlugin_PointCoordinates::ID()); - fillAttribute(thePoint, aPointCoordFeat - ->selection(FeaturesPlugin_PointCoordinates::POINT_SELECTED_ID())); + fillAttribute(thePoint, + aPointCoordFeat->selection( + FeaturesPlugin_PointCoordinates::POINT_SELECTED_ID())); std::list res; // obtain result - AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( - aPointCoordFeat->attribute(FeaturesPlugin_PointCoordinates::RESULT_VALUES_ID())); + AttributeDoubleArrayPtr aResult = + std::dynamic_pointer_cast( + aPointCoordFeat->attribute( + FeaturesPlugin_PointCoordinates::RESULT_VALUES_ID())); - for ( int i : {0, 1, 2}) - res.push_back( aResult->value(i)); + for (int i : {0, 1, 2}) + res.push_back(aResult->value(i)); return res; } diff --git a/src/FeaturesAPI/FeaturesAPI_PointCoordinates.h b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.h index 1e1d6fb5c..87c281eae 100644 --- a/src/FeaturesAPI/FeaturesAPI_PointCoordinates.h +++ b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_PointCoordinates_H_ @@ -31,7 +32,8 @@ class ModelHighAPI_Selection; /// \ingroup CPPHighAPI /// \brief Get the point coordinates. FEATURESAPI_EXPORT -std::list getPointCoordinates(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& thePoint); +std::list +getPointCoordinates(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &thePoint); #endif // FeaturesAPI_PointCoordinates_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Recover.cpp b/src/FeaturesAPI/FeaturesAPI_Recover.cpp index 149a8e244..e399fb8b3 100644 --- a/src/FeaturesAPI/FeaturesAPI_Recover.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Recover.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Recover.h" @@ -24,23 +25,25 @@ #include //================================================================================================= -FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Recover::FeaturesAPI_Recover( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================= -FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr& theFeature, - const ModelHighAPI_Reference& theBaseFeature, - const std::list& theRecoveredList, - const bool theRecoverCompound) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Recover::FeaturesAPI_Recover( + const std::shared_ptr &theFeature, + const ModelHighAPI_Reference &theBaseFeature, + const std::list &theRecoveredList, + const bool theRecoverCompound) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - std::string aMethod = theRecoverCompound ? FeaturesPlugin_Recover::METHOD_COMPOUND() - : FeaturesPlugin_Recover::METHOD_DEFAULT(); - fillAttribute(aMethod, theFeature->string(FeaturesPlugin_Recover::METHOD())); + std::string aMethod = theRecoverCompound + ? FeaturesPlugin_Recover::METHOD_COMPOUND() + : FeaturesPlugin_Recover::METHOD_DEFAULT(); + fillAttribute(aMethod, + theFeature->string(FeaturesPlugin_Recover::METHOD())); fillAttribute(theBaseFeature.feature(), mybaseFeature); setRecoveredList(theRecoveredList); @@ -48,39 +51,37 @@ FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr } //================================================================================================= -FeaturesAPI_Recover::~FeaturesAPI_Recover() -{} +FeaturesAPI_Recover::~FeaturesAPI_Recover() {} //================================================================================================= -void FeaturesAPI_Recover::setBaseFeature(const ModelHighAPI_Reference& theBaseFeature) -{ +void FeaturesAPI_Recover::setBaseFeature( + const ModelHighAPI_Reference &theBaseFeature) { fillAttribute(theBaseFeature.feature(), mybaseFeature); execute(); } //================================================================================================= -void FeaturesAPI_Recover::setRecoveredList(const std::list& theRecoverList) -{ +void FeaturesAPI_Recover::setRecoveredList( + const std::list &theRecoverList) { fillAttribute(theRecoverList, myrecoveredList); execute(); } //================================================================================================== -void FeaturesAPI_Recover::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Recover::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeReferencePtr anAttrBaseFeature = - aBase->reference(FeaturesPlugin_Recover::BASE_FEATURE()); + aBase->reference(FeaturesPlugin_Recover::BASE_FEATURE()); AttributeRefListPtr anAttrRecoveredEntities = - aBase->reflist(FeaturesPlugin_Recover::RECOVERED_ENTITIES()); + aBase->reflist(FeaturesPlugin_Recover::RECOVERED_ENTITIES()); FeaturePtr aFeature = ModelAPI_Feature::feature(anAttrBaseFeature->value()); - theDumper << aBase << " = model.addRecover(" << aDocName << ", " - << aFeature << ", " << anAttrRecoveredEntities; + theDumper << aBase << " = model.addRecover(" << aDocName << ", " << aFeature + << ", " << anAttrRecoveredEntities; AttributeStringPtr aMethod = aBase->string(FeaturesPlugin_Recover::METHOD()); if (aMethod && aMethod->isInitialized() && @@ -91,11 +92,12 @@ void FeaturesAPI_Recover::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================= -RecoverPtr addRecover(const std::shared_ptr& thePart, - const ModelHighAPI_Reference& theBaseFeature, - const std::list& theRecoveredList, const bool theRecoverCompound) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Recover::ID()); +RecoverPtr addRecover(const std::shared_ptr &thePart, + const ModelHighAPI_Reference &theBaseFeature, + const std::list &theRecoveredList, + const bool theRecoverCompound) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Recover::ID()); return RecoverPtr(new FeaturesAPI_Recover( - aFeature, theBaseFeature, theRecoveredList, theRecoverCompound)); + aFeature, theBaseFeature, theRecoveredList, theRecoverCompound)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Recover.h b/src/FeaturesAPI/FeaturesAPI_Recover.h index 3f41823c0..eacf68078 100644 --- a/src/FeaturesAPI/FeaturesAPI_Recover.h +++ b/src/FeaturesAPI/FeaturesAPI_Recover.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Recover_H_ @@ -33,41 +34,43 @@ class ModelHighAPI_Reference; /// \class FeaturesAPI_Recover /// \ingroup CPPHighAPI /// \brief Interface for Recover feature. -class FeaturesAPI_Recover: public ModelHighAPI_Interface -{ +class FeaturesAPI_Recover : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Recover(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Recover( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_Recover(const std::shared_ptr& theFeature, - const ModelHighAPI_Reference& theBaseFeature, - const std::list& theRecoveredList, + FeaturesAPI_Recover(const std::shared_ptr &theFeature, + const ModelHighAPI_Reference &theBaseFeature, + const std::list &theRecoveredList, const bool theRecoverCompound = false); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Recover(); - INTERFACE_2(FeaturesPlugin_Recover::ID(), - baseFeature, FeaturesPlugin_Recover::BASE_FEATURE(), + INTERFACE_2(FeaturesPlugin_Recover::ID(), baseFeature, + FeaturesPlugin_Recover::BASE_FEATURE(), ModelAPI_AttributeReference, /** Concealed feature */, recoveredList, FeaturesPlugin_Recover::RECOVERED_ENTITIES(), - ModelAPI_AttributeRefList, /** Recover list*/) + ModelAPI_AttributeRefList, + /** Recover list*/) /// Set base feature. FEATURESAPI_EXPORT - void setBaseFeature(const ModelHighAPI_Reference& theBaseFeature); + void setBaseFeature(const ModelHighAPI_Reference &theBaseFeature); /// Set recovered list of the base feature FEATURESAPI_EXPORT - void setRecoveredList(const std::list& theRecoverList); + void + setRecoveredList(const std::list &theRecoverList); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Recover object. @@ -76,9 +79,9 @@ typedef std::shared_ptr RecoverPtr; /// \ingroup CPPHighAPI /// \brief Create Recover feature. FEATURESAPI_EXPORT -RecoverPtr addRecover(const std::shared_ptr& thePart, - const ModelHighAPI_Reference& theBaseFeature, - const std::list& theRecoveredList, +RecoverPtr addRecover(const std::shared_ptr &thePart, + const ModelHighAPI_Reference &theBaseFeature, + const std::list &theRecoveredList, const bool theRecoverCompound = false); #endif // FeaturesAPI_Recover_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp b/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp index b669a987d..851426322 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_RemoveResults.h" @@ -22,53 +23,47 @@ #include #include - //================================================================================================== FeaturesAPI_RemoveResults::FeaturesAPI_RemoveResults( - const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{} + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) {} //================================================================================================== FeaturesAPI_RemoveResults::FeaturesAPI_RemoveResults( - const std::shared_ptr& theFeature, - const std::list& theResults) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theResults) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setRemoved(theResults); } } //================================================================================================== -FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults() -{} +FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults() {} //================================================================================================== void FeaturesAPI_RemoveResults::setRemoved( - const std::list& theResults) -{ + const std::list &theResults) { fillAttribute(theResults, myremoved); } //================================================================================================== -void FeaturesAPI_RemoveResults::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_RemoveResults::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrResults = - aBase->selectionList(FeaturesPlugin_RemoveResults::RESULTS_ID()); + aBase->selectionList(FeaturesPlugin_RemoveResults::RESULTS_ID()); - theDumper << aBase << " = model.addRemoveResults(" - << aDocName << ", " << anAttrResults << ")" << std::endl; + theDumper << aBase << " = model.addRemoveResults(" << aDocName << ", " + << anAttrResults << ")" << std::endl; } //================================================================================================== -RemoveResultsPtr addRemoveResults(const std::shared_ptr& thePart, - const std::list& theResults) -{ +RemoveResultsPtr +addRemoveResults(const std::shared_ptr &thePart, + const std::list &theResults) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesAPI_RemoveResults::ID()); + thePart->addFeature(FeaturesAPI_RemoveResults::ID()); return RemoveResultsPtr(new FeaturesAPI_RemoveResults(aFeature, theResults)); } diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveResults.h b/src/FeaturesAPI/FeaturesAPI_RemoveResults.h index 8794200e1..b549649de 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveResults.h +++ b/src/FeaturesAPI/FeaturesAPI_RemoveResults.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_RemoveResults_H_ @@ -33,32 +34,34 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_RemoveResults /// \ingroup CPPHighAPI /// \brief Interface for RemoveResults feature. -class FeaturesAPI_RemoveResults: public ModelHighAPI_Interface -{ +class FeaturesAPI_RemoveResults : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RemoveResults(const std::shared_ptr& theFeature); + explicit FeaturesAPI_RemoveResults( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RemoveResults(const std::shared_ptr& theFeature, - const std::list& theResults); + explicit FeaturesAPI_RemoveResults( + const std::shared_ptr &theFeature, + const std::list &theResults); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_RemoveResults(); - INTERFACE_1(FeaturesPlugin_RemoveResults::ID(), - removed, FeaturesPlugin_RemoveResults::RESULTS_ID(), - ModelAPI_AttributeSelectionList, /** Results to remove */) + INTERFACE_1(FeaturesPlugin_RemoveResults::ID(), removed, + FeaturesPlugin_RemoveResults::RESULTS_ID(), + ModelAPI_AttributeSelectionList, + /** Results to remove */) /// Modify removed results arguments. FEATURESAPI_EXPORT - void setRemoved(const std::list& theResults); + void setRemoved(const std::list &theResults); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on RemoveResults object. @@ -67,7 +70,8 @@ typedef std::shared_ptr RemoveResultsPtr; /// \ingroup CPPHighAPI /// \brief Create RemoveResults feature. FEATURESAPI_EXPORT -RemoveResultsPtr addRemoveResults(const std::shared_ptr& thePart, - const std::list& theResults); +RemoveResultsPtr +addRemoveResults(const std::shared_ptr &thePart, + const std::list &theResults); #endif // FeaturesAPI_RemoveResults_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp index eb8805c72..22ced69a8 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_RemoveSubShapes.h" @@ -24,19 +25,17 @@ //================================================================================================== FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBase) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBase) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { setBase(theBase); execute(); @@ -44,14 +43,11 @@ FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes( } //================================================================================================== -FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes() -{ - -} +FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes() {} //================================================================================================== -void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase) -{ +void FeaturesAPI_RemoveSubShapes::setBase( + const ModelHighAPI_Selection &theBase) { fillAttribute(theBase, mybase); execute(); @@ -59,10 +55,10 @@ void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase) //================================================================================================== void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep( - const std::list& theSubShapes) -{ - fillAttribute(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_KEEP_SUBSHAPES(), - mycreationMethod); + const std::list &theSubShapes) { + fillAttribute( + FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_KEEP_SUBSHAPES(), + mycreationMethod); fillAttribute(theSubShapes, mysubshapesToKeep); execute(); @@ -70,42 +66,41 @@ void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep( //================================================================================================== void FeaturesAPI_RemoveSubShapes::setSubShapesToRemove( - const std::list& theSubShapes) -{ - fillAttribute(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_REMOVE_SUBSHAPES(), - mycreationMethod); + const std::list &theSubShapes) { + fillAttribute( + FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_REMOVE_SUBSHAPES(), + mycreationMethod); fillAttribute(theSubShapes, mysubshapesToRemove); execute(); } //================================================================================================== -void FeaturesAPI_RemoveSubShapes::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_RemoveSubShapes::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrBaseShape = - aBase->selection(FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID()); + aBase->selection(FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID()); std::string aCreationMethod = - aBase->string(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD())->value(); AttributeSelectionListPtr anAttrSubShapes; bool isKeepSubs = - aCreationMethod == FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_KEEP_SUBSHAPES(); + aCreationMethod == + FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_KEEP_SUBSHAPES(); if (isKeepSubs) { - anAttrSubShapes = - aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_KEEP_ID()); - } - else { - anAttrSubShapes = - aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_REMOVE_ID()); + anAttrSubShapes = aBase->selectionList( + FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_KEEP_ID()); + } else { + anAttrSubShapes = aBase->selectionList( + FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_REMOVE_ID()); } - theDumper << aBase << " = model.addRemoveSubShapes(" - << aDocName << ", " << anAttrBaseShape << ")" + theDumper << aBase << " = model.addRemoveSubShapes(" << aDocName << ", " + << anAttrBaseShape << ")" << "\n" << theDumper.name(aBase) << (isKeepSubs ? ".setSubShapesToKeep(" : ".setSubShapesToRemove(") @@ -113,10 +108,10 @@ void FeaturesAPI_RemoveSubShapes::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBase) -{ +RemoveSubShapesPtr +addRemoveSubShapes(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBase) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesAPI_RemoveSubShapes::ID()); + thePart->addFeature(FeaturesAPI_RemoveSubShapes::ID()); return RemoveSubShapesPtr(new FeaturesAPI_RemoveSubShapes(aFeature, theBase)); } diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h index cdd32f2ba..63d3f5317 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h +++ b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_RemoveSubShapes_H_ @@ -33,47 +34,52 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_RemoveSubShapes /// \ingroup CPPHighAPI /// \brief Interface for RemoveSubShapes feature. -class FeaturesAPI_RemoveSubShapes: public ModelHighAPI_Interface -{ +class FeaturesAPI_RemoveSubShapes : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RemoveSubShapes(const std::shared_ptr& theFeature); + explicit FeaturesAPI_RemoveSubShapes( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RemoveSubShapes(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBase); + explicit FeaturesAPI_RemoveSubShapes( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBase); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_RemoveSubShapes(); - INTERFACE_4(FeaturesPlugin_RemoveSubShapes::ID(), - base, FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(), - ModelAPI_AttributeSelection, /** Base */, - creationMethod, FeaturesPlugin_RemoveSubShapes::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - subshapesToKeep, FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_KEEP_ID(), + INTERFACE_4(FeaturesPlugin_RemoveSubShapes::ID(), base, + FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(), + ModelAPI_AttributeSelection, /** Base */, creationMethod, + FeaturesPlugin_RemoveSubShapes::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, subshapesToKeep, + FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_KEEP_ID(), ModelAPI_AttributeSelectionList, /** Subshapes to keep*/, - subshapesToRemove, FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_REMOVE_ID(), - ModelAPI_AttributeSelectionList, /** Subshapes to remove*/) + subshapesToRemove, + FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_REMOVE_ID(), + ModelAPI_AttributeSelectionList, + /** Subshapes to remove*/) /// Modify objects attribute of the feature. FEATURESAPI_EXPORT - void setBase(const ModelHighAPI_Selection& theBase); + void setBase(const ModelHighAPI_Selection &theBase); /// Modify tools attribute of the feature. FEATURESAPI_EXPORT - void setSubShapesToKeep(const std::list& theSubShapes); + void + setSubShapesToKeep(const std::list &theSubShapes); /// Modify tools attribute of the feature. FEATURESAPI_EXPORT - void setSubShapesToRemove(const std::list& theSubShapes); + void + setSubShapesToRemove(const std::list &theSubShapes); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on RemoveSubShapes object. @@ -82,7 +88,8 @@ typedef std::shared_ptr RemoveSubShapesPtr; /// \ingroup CPPHighAPI /// \brief Create RemoveSubShapes feature. FEATURESAPI_EXPORT -RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBase); +RemoveSubShapesPtr +addRemoveSubShapes(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBase); #endif // FeaturesAPI_RemoveSubShapes_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Revolution.cpp b/src/FeaturesAPI/FeaturesAPI_Revolution.cpp index 2b560b8ba..62e69b5de 100644 --- a/src/FeaturesAPI/FeaturesAPI_Revolution.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Revolution.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Revolution.h" @@ -25,21 +26,19 @@ #include //================================================================================================== -FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Revolution::FeaturesAPI_Revolution( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_Revolution::FeaturesAPI_Revolution( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theAngle) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); setAngles(theAngle, ModelHighAPI_Double()); @@ -48,15 +47,14 @@ FeaturesAPI_Revolution::FeaturesAPI_Revolution( //================================================================================================== FeaturesAPI_Revolution::FeaturesAPI_Revolution( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::string& theSelectionType) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::string &theSelectionType) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { if (!theSelectionType.empty()) mybaseObjects->setSelectionType(theSelectionType); fillAttribute(theBaseObjects, mybaseObjects); @@ -67,17 +65,16 @@ FeaturesAPI_Revolution::FeaturesAPI_Revolution( //================================================================================================== FeaturesAPI_Revolution::FeaturesAPI_Revolution( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { if (!theSelectionType.empty()) mybaseObjects->setSelectionType(theSelectionType); fillAttribute(theBaseObjects, mybaseObjects); @@ -87,20 +84,18 @@ FeaturesAPI_Revolution::FeaturesAPI_Revolution( } //================================================================================================== -FeaturesAPI_Revolution::~FeaturesAPI_Revolution() -{ - -} +FeaturesAPI_Revolution::~FeaturesAPI_Revolution() {} //================================================================================================== -void FeaturesAPI_Revolution::setNestedSketch(const ModelHighAPI_Reference& theSketch) -{ +void FeaturesAPI_Revolution::setNestedSketch( + const ModelHighAPI_Reference &theSketch) { mysketch->setValue(theSketch.feature()); // To make Sketch feature execute and subfeatures execute. feature()->document()->setCurrentFeature(feature(), false); - // to inform that the history is updated due to the sketch moved under the composite feature + // to inform that the history is updated due to the sketch moved under the + // composite feature if (theSketch.feature().get()) { theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group()); if (theSketch.feature()->firstResult().get()) @@ -113,8 +108,8 @@ void FeaturesAPI_Revolution::setNestedSketch(const ModelHighAPI_Reference& theSk } //================================================================================================== -void FeaturesAPI_Revolution::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_Revolution::setBase( + const std::list &theBaseObjects) { mysketch->setValue(ObjectPtr()); mybaseObjects->clear(); fillAttribute(theBaseObjects, mybaseObjects); @@ -123,18 +118,18 @@ void FeaturesAPI_Revolution::setBase(const std::list& th } //================================================================================================== -void FeaturesAPI_Revolution::setAxis(const ModelHighAPI_Selection& theAxis) -{ +void FeaturesAPI_Revolution::setAxis(const ModelHighAPI_Selection &theAxis) { fillAttribute(theAxis, myaxis); execIfBaseNotEmpty(); } //================================================================================================== -void FeaturesAPI_Revolution::setAngles(const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle) -{ - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod); +void FeaturesAPI_Revolution::setAngles( + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle) { + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), + mycreationMethod); fillAttribute(theToAngle, mytoAngle); fillAttribute(theFromAngle, myfromAngle); @@ -142,17 +137,16 @@ void FeaturesAPI_Revolution::setAngles(const ModelHighAPI_Double& theToAngle, } //================================================================================================== -void FeaturesAPI_Revolution::setAngle(const ModelHighAPI_Double& theAngle) -{ +void FeaturesAPI_Revolution::setAngle(const ModelHighAPI_Double &theAngle) { setAngles(theAngle, ModelHighAPI_Double()); } //================================================================================================== -void FeaturesAPI_Revolution::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset) -{ +void FeaturesAPI_Revolution::setPlanesAndOffsets( + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset) { fillAttribute("ByPlanesAndOffsets", mycreationMethod); fillAttribute(theToObject, mytoObject); fillAttribute(theToOffset, mytoOffset); @@ -163,38 +157,46 @@ void FeaturesAPI_Revolution::setPlanesAndOffsets(const ModelHighAPI_Selection& t } //================================================================================================== -void FeaturesAPI_Revolution::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Revolution::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Revolution::SKETCH_ID()); + AttributeReferencePtr anAttrSketch = + aBase->reference(FeaturesPlugin_Revolution::SKETCH_ID()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Revolution::BASE_OBJECTS_ID()); - AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID()); + aBase->selectionList(FeaturesPlugin_Revolution::BASE_OBJECTS_ID()); + AttributeSelectionPtr anAttrAxis = + aBase->selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID()); theDumper << aBase << " = model.addRevolution(" << aDocName << ", "; - anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects; + anAttrSketch->isInitialized() ? theDumper << "[]" + : theDumper << anAttrObjects; theDumper << ", " << anAttrAxis; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES()) { - AttributeDoublePtr anAttrToAngle = aBase->real(FeaturesPlugin_Revolution::TO_ANGLE_ID()); - AttributeDoublePtr anAttrFromAngle = aBase->real(FeaturesPlugin_Revolution::FROM_ANGLE_ID()); + if (aCreationMethod == + FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES()) { + AttributeDoublePtr anAttrToAngle = + aBase->real(FeaturesPlugin_Revolution::TO_ANGLE_ID()); + AttributeDoublePtr anAttrFromAngle = + aBase->real(FeaturesPlugin_Revolution::FROM_ANGLE_ID()); theDumper << ", " << anAttrToAngle << ", " << anAttrFromAngle; - } else if(aCreationMethod == FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES()) { + } else if (aCreationMethod == + FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES()) { AttributeSelectionPtr anAttrToObject = - aBase->selection(FeaturesPlugin_Revolution::TO_OBJECT_ID()); - AttributeDoublePtr anAttrToOffset = aBase->real(FeaturesPlugin_Revolution::TO_OFFSET_ID()); + aBase->selection(FeaturesPlugin_Revolution::TO_OBJECT_ID()); + AttributeDoublePtr anAttrToOffset = + aBase->real(FeaturesPlugin_Revolution::TO_OFFSET_ID()); AttributeSelectionPtr anAttrFromObject = - aBase->selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID()); - AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Revolution::FROM_OFFSET_ID()); + aBase->selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID()); + AttributeDoublePtr anAttrFromOffset = + aBase->real(FeaturesPlugin_Revolution::FROM_OFFSET_ID()); - theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << - ", " << anAttrFromObject << ", " << anAttrFromOffset; + theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << ", " + << anAttrFromObject << ", " << anAttrFromOffset; } // write explicitly the type of selection if it does not correspond @@ -205,69 +207,66 @@ void FeaturesAPI_Revolution::dump(ModelHighAPI_Dumper& theDumper) const GeomShapePtr aFirstShape = aFirstSelection->value(); if (!aFirstShape) aFirstShape = aFirstSelection->context()->shape(); - if (!aFirstShape || aFirstShape->shapeType() != GeomAPI_Shape::shapeTypeByStr(aListSelType)) + if (!aFirstShape || + aFirstShape->shapeType() != GeomAPI_Shape::shapeTypeByStr(aListSelType)) theDumper << ", \"" << aListSelType << "\""; } theDumper << ")" << std::endl; - if(anAttrSketch->isInitialized()) { - theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl; + if (anAttrSketch->isInitialized()) { + theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" + << std::endl; } } //================================================================================================== -void FeaturesAPI_Revolution::execIfBaseNotEmpty() -{ - if(mybaseObjects->size() > 0) { +void FeaturesAPI_Revolution::execIfBaseNotEmpty() { + if (mybaseObjects->size() > 0) { execute(); } } //================================================================================================== -RevolutionPtr addRevolution(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID()); - return RevolutionPtr(new FeaturesAPI_Revolution(aFeature, theBaseObjects, theAxis, theAngle)); +RevolutionPtr +addRevolution(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Revolution::ID()); + return RevolutionPtr( + new FeaturesAPI_Revolution(aFeature, theBaseObjects, theAxis, theAngle)); } //================================================================================================== -RevolutionPtr addRevolution(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::string& theSelectionType) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID()); - return RevolutionPtr(new FeaturesAPI_Revolution(aFeature, - theBaseObjects, - theAxis, - theToAngle, - theFromAngle, - theSelectionType)); +RevolutionPtr +addRevolution(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::string &theSelectionType) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Revolution::ID()); + return RevolutionPtr( + new FeaturesAPI_Revolution(aFeature, theBaseObjects, theAxis, theToAngle, + theFromAngle, theSelectionType)); } //================================================================================================== -RevolutionPtr addRevolution(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID()); - return RevolutionPtr(new FeaturesAPI_Revolution(aFeature, - theBaseObjects, - theAxis, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theSelectionType)); +RevolutionPtr +addRevolution(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Revolution::ID()); + return RevolutionPtr(new FeaturesAPI_Revolution( + aFeature, theBaseObjects, theAxis, theToObject, theToOffset, + theFromObject, theFromOffset, theSelectionType)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Revolution.h b/src/FeaturesAPI/FeaturesAPI_Revolution.h index adfdd60bb..b1e196a02 100644 --- a/src/FeaturesAPI/FeaturesAPI_Revolution.h +++ b/src/FeaturesAPI/FeaturesAPI_Revolution.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Revolution_H_ @@ -34,98 +35,99 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Revolution /// \ingroup CPPHighAPI /// \brief Interface for Revolution feature. -class FeaturesAPI_Revolution: public ModelHighAPI_Interface -{ +class FeaturesAPI_Revolution : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Revolution(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Revolution( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Revolution(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle); + explicit FeaturesAPI_Revolution( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Revolution(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::string& theSelectionType = std::string()); + explicit FeaturesAPI_Revolution( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::string &theSelectionType = std::string()); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Revolution(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType = std::string()); + explicit FeaturesAPI_Revolution( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType = std::string()); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Revolution(); - INTERFACE_10(FeaturesPlugin_Revolution::ID(), - sketch, FeaturesPlugin_Revolution::SKETCH_ID(), - ModelAPI_AttributeReference, /** Sketch launcher */, - baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Axis */, - creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(), - ModelAPI_AttributeDouble, /** To angle */, - fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(), - ModelAPI_AttributeDouble, /** From angle */, - toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(), - ModelAPI_AttributeSelection, /** To object */, - toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(), - ModelAPI_AttributeDouble, /** To offset */, - fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(), - ModelAPI_AttributeSelection, /** From object */, - fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(), - ModelAPI_AttributeDouble, /** From offset */) + INTERFACE_10( + FeaturesPlugin_Revolution::ID(), sketch, + FeaturesPlugin_Revolution::SKETCH_ID(), ModelAPI_AttributeReference, + /** Sketch launcher */, baseObjects, + FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, axis, + FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, + /** Axis */, creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, toAngle, + FeaturesPlugin_Revolution::TO_ANGLE_ID(), ModelAPI_AttributeDouble, + /** To angle */, fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(), + ModelAPI_AttributeDouble, /** From angle */, toObject, + FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection, + /** To object */, toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(), + ModelAPI_AttributeDouble, /** To offset */, fromObject, + FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, + /** From object */, fromOffset, + FeaturesPlugin_Revolution::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, + /** From offset */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setNestedSketch(const ModelHighAPI_Reference& theSketch); + void setNestedSketch(const ModelHighAPI_Reference &theSketch); /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Modify axis_object attribute of the feature. FEATURESAPI_EXPORT - void setAxis(const ModelHighAPI_Selection& theAxis); + void setAxis(const ModelHighAPI_Selection &theAxis); /// Modify CreationMethod, to_angle, from_angle attributes of the feature. FEATURESAPI_EXPORT - void setAngles(const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle); + void setAngles(const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle); /// Modify CreationMethod, to_angle, from_angle attributes of the feature. FEATURESAPI_EXPORT - void setAngle(const ModelHighAPI_Double& theAngle); + void setAngle(const ModelHighAPI_Double &theAngle); /// Modify CreationMethod, to_object, to_offset, /// from_object, from_offset attributes of the feature. FEATURESAPI_EXPORT - void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset); + void setPlanesAndOffsets(const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: void execIfBaseNotEmpty(); @@ -137,31 +139,34 @@ typedef std::shared_ptr RevolutionPtr; /// \ingroup CPPHighAPI /// \brief Create Revolution feature. FEATURESAPI_EXPORT -RevolutionPtr addRevolution(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle); +RevolutionPtr +addRevolution(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle); /// \ingroup CPPHighAPI /// \brief Create Revolution feature. FEATURESAPI_EXPORT -RevolutionPtr addRevolution(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::string& theSelectionType = std::string()); +RevolutionPtr +addRevolution(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::string &theSelectionType = std::string()); /// \ingroup CPPHighAPI /// \brief Create Revolution feature. FEATURESAPI_EXPORT -RevolutionPtr addRevolution(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::string& theSelectionType = std::string()); +RevolutionPtr +addRevolution(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::string &theSelectionType = std::string()); #endif // FeaturesAPI_Revolution_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp index 668a17c13..3c685ad90 100644 --- a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_RevolutionBoolean.h" @@ -26,25 +27,22 @@ //================================================================================================== FeaturesAPI_RevolutionBoolean::FeaturesAPI_RevolutionBoolean( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ -} + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) {} //================================================================================================== -FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean() -{ -} +FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean() {} //================================================================================================== -void FeaturesAPI_RevolutionBoolean::setNestedSketch(const ModelHighAPI_Reference& theSketch) -{ +void FeaturesAPI_RevolutionBoolean::setNestedSketch( + const ModelHighAPI_Reference &theSketch) { mysketch->setValue(theSketch.feature()); // To make Sketch feature execute and subfeatures execute. feature()->document()->setCurrentFeature(feature(), false); - // to inform that the history is updated due to the sketch moved under the composite feature + // to inform that the history is updated due to the sketch moved under the + // composite feature if (theSketch.feature().get()) { theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group()); if (theSketch.feature()->firstResult().get()) @@ -57,8 +55,8 @@ void FeaturesAPI_RevolutionBoolean::setNestedSketch(const ModelHighAPI_Reference } //================================================================================================== -void FeaturesAPI_RevolutionBoolean::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_RevolutionBoolean::setBase( + const std::list &theBaseObjects) { mysketch->setValue(ObjectPtr()); mybaseObjects->clear(); fillAttribute(theBaseObjects, mybaseObjects); @@ -67,18 +65,19 @@ void FeaturesAPI_RevolutionBoolean::setBase(const std::list& theBooleanObjects) -{ + const std::list &theBooleanObjects) { fillAttribute(theBooleanObjects, mybooleanObjects); execIfBaseNotEmpty(); } //================================================================================================== -void FeaturesAPI_RevolutionBoolean::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_RevolutionBoolean::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeReferencePtr anAttrSketch = - aBase->reference(FeaturesPlugin_Revolution::SKETCH_ID()); + aBase->reference(FeaturesPlugin_Revolution::SKETCH_ID()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Revolution::BASE_OBJECTS_ID()); + aBase->selectionList(FeaturesPlugin_Revolution::BASE_OBJECTS_ID()); AttributeSelectionPtr anAttrAxis = - aBase->selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID()); theDumper << aBase << " = model.addRevolution"; - if(aBase->getKind() == FeaturesPlugin_RevolutionCut::ID()) { + if (aBase->getKind() == FeaturesPlugin_RevolutionCut::ID()) { theDumper << "Cut"; - } else if(aBase->getKind() == FeaturesPlugin_RevolutionFuse::ID()) { + } else if (aBase->getKind() == FeaturesPlugin_RevolutionFuse::ID()) { theDumper << "Fuse"; } theDumper << "(" << aDocName << ", "; - anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects; + anAttrSketch->isInitialized() ? theDumper << "[]" + : theDumper << anAttrObjects; theDumper << ", " << anAttrAxis; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value(); - if(aCreationMethod == FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES()) { - AttributeDoublePtr anAttrToAngle = aBase->real(FeaturesPlugin_Revolution::TO_ANGLE_ID()); - AttributeDoublePtr anAttrFromAngle = aBase->real(FeaturesPlugin_Revolution::FROM_ANGLE_ID()); + if (aCreationMethod == + FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES()) { + AttributeDoublePtr anAttrToAngle = + aBase->real(FeaturesPlugin_Revolution::TO_ANGLE_ID()); + AttributeDoublePtr anAttrFromAngle = + aBase->real(FeaturesPlugin_Revolution::FROM_ANGLE_ID()); theDumper << ", " << anAttrToAngle << ", " << anAttrFromAngle; - } else if(aCreationMethod == FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES()) { + } else if (aCreationMethod == + FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES()) { AttributeSelectionPtr anAttrToObject = - aBase->selection(FeaturesPlugin_Revolution::TO_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Revolution::TO_OBJECT_ID()); AttributeDoublePtr anAttrToOffset = - aBase->real(FeaturesPlugin_Revolution::TO_OFFSET_ID()); + aBase->real(FeaturesPlugin_Revolution::TO_OFFSET_ID()); AttributeSelectionPtr anAttrFromObject = - aBase->selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID()); AttributeDoublePtr anAttrFromOffset = - aBase->real(FeaturesPlugin_Revolution::FROM_OFFSET_ID()); + aBase->real(FeaturesPlugin_Revolution::FROM_OFFSET_ID()); - theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << - ", " << anAttrFromObject << ", " << anAttrFromOffset; + theDumper << ", " << anAttrToObject << ", " << anAttrToOffset << ", " + << anAttrFromObject << ", " << anAttrFromOffset; } else { // Through All } AttributeSelectionListPtr anAttrBoolObjects = - aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID()); + aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID()); theDumper << ", " << anAttrBoolObjects << ")" << std::endl; - if(anAttrSketch->isInitialized()) { - theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl; + if (anAttrSketch->isInitialized()) { + theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" + << std::endl; } } //================================================================================================== -void FeaturesAPI_RevolutionBoolean::execIfBaseNotEmpty() -{ - if(mybaseObjects->size() > 0) { +void FeaturesAPI_RevolutionBoolean::execIfBaseNotEmpty() { + if (mybaseObjects->size() > 0) { execute(); } } //================================================================================================== FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( - const std::shared_ptr& theFeature) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ + const std::shared_ptr &theFeature) + : FeaturesAPI_RevolutionBoolean(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_THROUGH_ALL(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_THROUGH_ALL(), + mycreationMethod); setBooleanObjects(theBooleanObjects); } } //================================================================================================== FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); setAngle(theSize); @@ -222,18 +222,18 @@ FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( //================================================================================================== FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), + mycreationMethod); fillAttribute(theToAngle, mytoAngle); fillAttribute(theFromAngle, myfromAngle); setBooleanObjects(theBooleanObjects); @@ -242,20 +242,20 @@ FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( //================================================================================================== FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES(), + mycreationMethod); fillAttribute(theToObject, mytoObject); fillAttribute(theToOffset, mytoOffset); fillAttribute(theFromObject, myfromObject); @@ -265,108 +265,97 @@ FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut( } //================================================================================================== -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects) -{ +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); - return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects, - theAxis, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); + return RevolutionCutPtr(new FeaturesAPI_RevolutionCut( + aFeature, theBaseObjects, theAxis, theBooleanObjects)); } //================================================================================================== -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -{ +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); - return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects, - theAxis, theSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); + return RevolutionCutPtr(new FeaturesAPI_RevolutionCut( + aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects)); } //================================================================================================== -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects) -{ +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); - return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, - theBaseObjects, - theAxis, - theToAngle, - theFromAngle, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); + return RevolutionCutPtr(new FeaturesAPI_RevolutionCut( + aFeature, theBaseObjects, theAxis, theToAngle, theFromAngle, + theBooleanObjects)); } //================================================================================================== -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -{ +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); - return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, - theBaseObjects, - theAxis, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionCut::ID()); + return RevolutionCutPtr(new FeaturesAPI_RevolutionCut( + aFeature, theBaseObjects, theAxis, theToObject, theToOffset, + theFromObject, theFromOffset, theBooleanObjects)); } - //================================================================================================== FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( - const std::shared_ptr& theFeature) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ + const std::shared_ptr &theFeature) + : FeaturesAPI_RevolutionBoolean(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_THROUGH_ALL(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_THROUGH_ALL(), + mycreationMethod); setBooleanObjects(theBooleanObjects); } } //================================================================================================== FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), + mycreationMethod); fillAttribute(theSize, mytoAngle); fillAttribute(ModelHighAPI_Double(), myfromAngle); setBooleanObjects(theBooleanObjects); @@ -375,18 +364,18 @@ FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( //================================================================================================== FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), + mycreationMethod); fillAttribute(theToAngle, mytoAngle); fillAttribute(theFromAngle, myfromAngle); setBooleanObjects(theBooleanObjects); @@ -395,20 +384,20 @@ FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( //================================================================================================== FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( - const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -: FeaturesAPI_RevolutionBoolean(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) + : FeaturesAPI_RevolutionBoolean(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, mybaseObjects); fillAttribute(theAxis, myaxis); - fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES(), mycreationMethod); + fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES(), + mycreationMethod); fillAttribute(theToObject, mytoObject); fillAttribute(theToOffset, mytoOffset); fillAttribute(theFromObject, myfromObject); @@ -418,66 +407,58 @@ FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse( } //================================================================================================== -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects) -{ +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); - return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects, - theAxis, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); + return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse( + aFeature, theBaseObjects, theAxis, theBooleanObjects)); } //================================================================================================== -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theSize, - const std::list& theBooleanObjects) -{ +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theSize, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); - return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects, - theAxis, theSize, theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); + return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse( + aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects)); } //================================================================================================== -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects) -{ +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); - return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, - theBaseObjects, - theAxis, - theToAngle, - theFromAngle, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); + return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse( + aFeature, theBaseObjects, theAxis, theToAngle, theFromAngle, + theBooleanObjects)); } //================================================================================================== -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects) -{ +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects) { std::shared_ptr aFeature = - thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); - return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, - theBaseObjects, - theAxis, - theToObject, - theToOffset, - theFromObject, - theFromOffset, - theBooleanObjects)); + thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID()); + return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse( + aFeature, theBaseObjects, theAxis, theToObject, theToOffset, + theFromObject, theFromOffset, theBooleanObjects)); } diff --git a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h index ff760b9de..0aabc238d 100644 --- a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h +++ b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_RevolutionBoolean_H_ @@ -37,77 +38,79 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_RevolutionBoolean /// \ingroup CPPHighAPI /// \brief Interface for RevolutionBoolean feature. -class FeaturesAPI_RevolutionBoolean: public ModelHighAPI_Interface -{ +class FeaturesAPI_RevolutionBoolean : public ModelHighAPI_Interface { public: /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_RevolutionBoolean(); - INTERFACE_11("", - sketch, FeaturesPlugin_Revolution::SKETCH_ID(), - ModelAPI_AttributeReference, /** Sketch launcher */, - baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Axis */, - creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(), - ModelAPI_AttributeDouble, /** To angle */, - fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(), - ModelAPI_AttributeDouble, /** From angle */, - toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(), - ModelAPI_AttributeSelection, /** To object */, - toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(), - ModelAPI_AttributeDouble, /** To offset */, - fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(), - ModelAPI_AttributeSelection, /** From object */, - fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(), - ModelAPI_AttributeDouble, /** From offset */, - booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Boolean objects */) + INTERFACE_11("", sketch, FeaturesPlugin_Revolution::SKETCH_ID(), + ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects, + FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, axis, + FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Axis */, creationMethod, + FeaturesPlugin_Revolution::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, toAngle, + FeaturesPlugin_Revolution::TO_ANGLE_ID(), + ModelAPI_AttributeDouble, /** To angle */, fromAngle, + FeaturesPlugin_Revolution::FROM_ANGLE_ID(), + ModelAPI_AttributeDouble, /** From angle */, toObject, + FeaturesPlugin_Revolution::TO_OBJECT_ID(), + ModelAPI_AttributeSelection, /** To object */, toOffset, + FeaturesPlugin_Revolution::TO_OFFSET_ID(), + ModelAPI_AttributeDouble, /** To offset */, fromObject, + FeaturesPlugin_Revolution::FROM_OBJECT_ID(), + ModelAPI_AttributeSelection, /** From object */, fromOffset, + FeaturesPlugin_Revolution::FROM_OFFSET_ID(), + ModelAPI_AttributeDouble, /** From offset */, booleanObjects, + FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), + ModelAPI_AttributeSelectionList, + /** Boolean objects */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setNestedSketch(const ModelHighAPI_Reference& theSketch); + void setNestedSketch(const ModelHighAPI_Reference &theSketch); /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Modify axis_object attribute of the feature. FEATURESAPI_EXPORT - void setAxis(const ModelHighAPI_Selection& theAxis); + void setAxis(const ModelHighAPI_Selection &theAxis); /// Modify CreationMethod, to_angle, from_angle attributes of the feature. FEATURESAPI_EXPORT - void setAngles(const ModelHighAPI_Double& theToAngle, const ModelHighAPI_Double& theFromAngle); + void setAngles(const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle); /// Modify creation_method, to_angle, from_angle attributes of the feature. FEATURESAPI_EXPORT - void setAngle(const ModelHighAPI_Double& theAngle); + void setAngle(const ModelHighAPI_Double &theAngle); /// Modify creation_method, to_object, to_offset, from_object, /// from_offset attributes of the feature. FEATURESAPI_EXPORT - void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset); + void setPlanesAndOffsets(const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset); /// Modiyfy main_objects attribute of the feature. FEATURESAPI_EXPORT - void setBooleanObjects(const std::list& theBooleanObjects); + void + setBooleanObjects(const std::list &theBooleanObjects); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; protected: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionBoolean(const std::shared_ptr& theFeature); + explicit FeaturesAPI_RevolutionBoolean( + const std::shared_ptr &theFeature); private: void execIfBaseNotEmpty(); @@ -116,51 +119,54 @@ private: /// \class FeaturesAPI_RevolutionCut /// \ingroup CPPHighAPI /// \brief Interface for RevolutionCut feature. -class FeaturesAPI_RevolutionCut: public FeaturesAPI_RevolutionBoolean -{ +class FeaturesAPI_RevolutionCut : public FeaturesAPI_RevolutionBoolean { public: - static std::string ID() { return FeaturesPlugin_RevolutionCut::ID(); } virtual std::string getID() { return ID(); } /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionCut(const std::shared_ptr& theFeature); + explicit FeaturesAPI_RevolutionCut( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionCut(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionCut( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); }; /// Pointer on RevolutionCut object. @@ -169,90 +175,97 @@ typedef std::shared_ptr RevolutionCutPtr; /// \ingroup CPPHighAPI /// \brief Create RevolutionCut feature. FEATURESAPI_EXPORT -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects); +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create RevolutionCut feature. FEATURESAPI_EXPORT -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const std::list& theBooleanObjects); +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create RevolutionCut feature. FEATURESAPI_EXPORT -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects); +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create RevolutionCut feature. FEATURESAPI_EXPORT -RevolutionCutPtr addRevolutionCut(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); +RevolutionCutPtr +addRevolutionCut(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); /// \class FeaturesAPI_RevolutionFuse /// \ingroup CPPHighAPI /// \brief Interface for RevolutionFuse feature. -class FeaturesAPI_RevolutionFuse: public FeaturesAPI_RevolutionBoolean -{ +class FeaturesAPI_RevolutionFuse : public FeaturesAPI_RevolutionBoolean { public: - static std::string ID() { return FeaturesPlugin_RevolutionFuse::ID(); } virtual std::string getID() { return ID(); } /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr& theFeature); + explicit FeaturesAPI_RevolutionFuse( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); + explicit FeaturesAPI_RevolutionFuse( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); }; /// Pointer on RevolutionFuse object. @@ -261,40 +274,44 @@ typedef std::shared_ptr RevolutionFusePtr; /// \ingroup CPPHighAPI /// \brief Create RevolutionFuse feature. FEATURESAPI_EXPORT -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const std::list& theBooleanObjects); +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create RevolutionFuse feature. FEATURESAPI_EXPORT -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theAngle, - const std::list& theBooleanObjects); +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theAngle, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create RevolutionFuse feature. FEATURESAPI_EXPORT -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theToAngle, - const ModelHighAPI_Double& theFromAngle, - const std::list& theBooleanObjects); +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theToAngle, + const ModelHighAPI_Double &theFromAngle, + const std::list &theBooleanObjects); /// \ingroup CPPHighAPI /// \brief Create RevolutionFuse feature. FEATURESAPI_EXPORT -RevolutionFusePtr addRevolutionFuse(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Selection& theToObject, - const ModelHighAPI_Double& theToOffset, - const ModelHighAPI_Selection& theFromObject, - const ModelHighAPI_Double& theFromOffset, - const std::list& theBooleanObjects); +RevolutionFusePtr +addRevolutionFuse(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Selection &theToObject, + const ModelHighAPI_Double &theToOffset, + const ModelHighAPI_Selection &theFromObject, + const ModelHighAPI_Double &theFromOffset, + const std::list &theBooleanObjects); #endif // FeaturesAPI_RevolutionBoolean_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp index c40a6ed6f..f974b2483 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Rotation.h" @@ -23,20 +24,20 @@ #include //================================================================================================== -FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Rotation::FeaturesAPI_Rotation( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theAngle) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Rotation::FeaturesAPI_Rotation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theAngle) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mymainObjects); fillAttribute(theAxisObject, myaxisObject); setAngle(theAngle); @@ -44,57 +45,56 @@ FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Rotation::FeaturesAPI_Rotation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mymainObjects); setPoints(theCenterPoint, theStartPoint, theEndPoint); } } //================================================================================================== -FeaturesAPI_Rotation::~FeaturesAPI_Rotation() -{ - -} +FeaturesAPI_Rotation::~FeaturesAPI_Rotation() {} //================================================================================================== -void FeaturesAPI_Rotation::setMainObjects(const std::list& theMainObjects) -{ +void FeaturesAPI_Rotation::setMainObjects( + const std::list &theMainObjects) { fillAttribute(theMainObjects, mymainObjects); execute(); } //================================================================================================== -void FeaturesAPI_Rotation::setAxisObject(const ModelHighAPI_Selection& theAxisObject) -{ - fillAttribute(FeaturesPlugin_Rotation::CREATION_METHOD_BY_ANGLE(), mycreationMethod); +void FeaturesAPI_Rotation::setAxisObject( + const ModelHighAPI_Selection &theAxisObject) { + fillAttribute(FeaturesPlugin_Rotation::CREATION_METHOD_BY_ANGLE(), + mycreationMethod); fillAttribute(theAxisObject, myaxisObject); execute(); } //================================================================================================== -void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double& theAngle) -{ - fillAttribute(FeaturesPlugin_Rotation::CREATION_METHOD_BY_ANGLE(), mycreationMethod); +void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double &theAngle) { + fillAttribute(FeaturesPlugin_Rotation::CREATION_METHOD_BY_ANGLE(), + mycreationMethod); fillAttribute(theAngle, myangle); execute(); } //================================================================================================== -void FeaturesAPI_Rotation::setPoints(const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint) -{ - fillAttribute(FeaturesPlugin_Rotation::CREATION_METHOD_BY_THREE_POINTS(), mycreationMethod); +void FeaturesAPI_Rotation::setPoints( + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint) { + fillAttribute(FeaturesPlugin_Rotation::CREATION_METHOD_BY_THREE_POINTS(), + mycreationMethod); fillAttribute(theCenterPoint, centerPoint()); fillAttribute(theStartPoint, startPoint()); fillAttribute(theEndPoint, endPoint()); @@ -103,30 +103,33 @@ void FeaturesAPI_Rotation::setPoints(const ModelHighAPI_Selection& theCenterPoin } //================================================================================================== -void FeaturesAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Rotation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID()); + aBase->selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addRotation(" << aDocName << ", " << anAttrObjects; + theDumper << aBase << " = model.addRotation(" << aDocName << ", " + << anAttrObjects; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Rotation::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Rotation::CREATION_METHOD())->value(); if (aCreationMethod == FeaturesPlugin_Rotation::CREATION_METHOD_BY_ANGLE()) { - AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID()); - AttributeDoublePtr anAttrAngle = aBase->real(FeaturesPlugin_Rotation::ANGLE_ID()); + AttributeSelectionPtr anAttrAxis = + aBase->selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID()); + AttributeDoublePtr anAttrAngle = + aBase->real(FeaturesPlugin_Rotation::ANGLE_ID()); theDumper << ", axis = " << anAttrAxis << ", angle = " << anAttrAngle; - } else if (aCreationMethod == FeaturesPlugin_Rotation::CREATION_METHOD_BY_THREE_POINTS()) { + } else if (aCreationMethod == + FeaturesPlugin_Rotation::CREATION_METHOD_BY_THREE_POINTS()) { AttributeSelectionPtr anAttrCenterPoint = - aBase->selection(FeaturesPlugin_Rotation::CENTER_POINT_ID()); + aBase->selection(FeaturesPlugin_Rotation::CENTER_POINT_ID()); AttributeSelectionPtr anAttrStartPoint = - aBase->selection(FeaturesPlugin_Rotation::START_POINT_ID()); + aBase->selection(FeaturesPlugin_Rotation::START_POINT_ID()); AttributeSelectionPtr anAttrEndPoint = - aBase->selection(FeaturesPlugin_Rotation::END_POINT_ID()); + aBase->selection(FeaturesPlugin_Rotation::END_POINT_ID()); theDumper << ", center = " << anAttrCenterPoint << ", start = " << anAttrStartPoint << ", end = " << anAttrEndPoint; @@ -139,16 +142,16 @@ void FeaturesAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -RotationPtr addRotation(const std::shared_ptr& part, - const std::list& objects, - const ModelHighAPI_Selection& axis, - const std::pair& angle, - const ModelHighAPI_Selection& center, - const ModelHighAPI_Selection& start, - const ModelHighAPI_Selection& end, - const bool keepSubResults) -{ - std::shared_ptr aFeature = part->addFeature(FeaturesAPI_Rotation::ID()); +RotationPtr +addRotation(const std::shared_ptr &part, + const std::list &objects, + const ModelHighAPI_Selection &axis, + const std::pair &angle, + const ModelHighAPI_Selection ¢er, + const ModelHighAPI_Selection &start, + const ModelHighAPI_Selection &end, const bool keepSubResults) { + std::shared_ptr aFeature = + part->addFeature(FeaturesAPI_Rotation::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); @@ -161,24 +164,22 @@ RotationPtr addRotation(const std::shared_ptr& part, aPoints[0] = center; aPoints[1] = start; aPoints[2] = end; - } - else + } else byAxis = true; - } - else { + } else { byPoints = true; aPoints[0] = axis; aPoints[1] = angle.first; aPoints[2] = center; } - RotationPtr aRotation; if (byAxis) - aRotation.reset(new FeaturesAPI_Rotation(aFeature, objects, axis, angle.second)); + aRotation.reset( + new FeaturesAPI_Rotation(aFeature, objects, axis, angle.second)); else if (byPoints) { - aRotation.reset(new FeaturesAPI_Rotation(aFeature, objects, - aPoints[0], aPoints[1], aPoints[2])); + aRotation.reset(new FeaturesAPI_Rotation(aFeature, objects, aPoints[0], + aPoints[1], aPoints[2])); } return aRotation; } diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.h b/src/FeaturesAPI/FeaturesAPI_Rotation.h index 13fdc2aca..afa6f6618 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.h +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Rotation_H_ @@ -34,88 +35,87 @@ class ModelHighAPI_Dumper; /// \class FeaturesAPI_Rotation /// \ingroup CPPHighAPI /// \brief Interface for Rotation feature. -class FeaturesAPI_Rotation: public ModelHighAPI_Interface -{ +class FeaturesAPI_Rotation : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Rotation(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Rotation( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_Rotation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theAngle); + FeaturesAPI_Rotation(const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theAngle); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_Rotation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint); + FeaturesAPI_Rotation(const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Rotation(); - INTERFACE_7(FeaturesPlugin_Rotation::ID(), - creationMethod, FeaturesPlugin_Rotation::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - mainObjects, FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - axisObject, FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Axis object */, - angle, FeaturesPlugin_Rotation::ANGLE_ID(), - ModelAPI_AttributeDouble, /** Angle */, - centerPoint, FeaturesPlugin_Rotation::CENTER_POINT_ID(), - ModelAPI_AttributeSelection, /** Center point */, - startPoint, FeaturesPlugin_Rotation::START_POINT_ID(), - ModelAPI_AttributeSelection, /** Start point */, - endPoint, FeaturesPlugin_Rotation::END_POINT_ID(), + INTERFACE_7(FeaturesPlugin_Rotation::ID(), creationMethod, + FeaturesPlugin_Rotation::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, mainObjects, + FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, axisObject, + FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Axis object */, angle, + FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble, + /** Angle */, centerPoint, + FeaturesPlugin_Rotation::CENTER_POINT_ID(), + ModelAPI_AttributeSelection, /** Center point */, startPoint, + FeaturesPlugin_Rotation::START_POINT_ID(), + ModelAPI_AttributeSelection, /** Start point */, endPoint, + FeaturesPlugin_Rotation::END_POINT_ID(), ModelAPI_AttributeSelection, /** End point */ - ) + ) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set axis object. FEATURESAPI_EXPORT - void setAxisObject(const ModelHighAPI_Selection& theAxisObject); + void setAxisObject(const ModelHighAPI_Selection &theAxisObject); /// Set angle. FEATURESAPI_EXPORT - void setAngle(const ModelHighAPI_Double& theAngle); + void setAngle(const ModelHighAPI_Double &theAngle); /// Set center point, start point and end point FEATURESAPI_EXPORT - void setPoints(const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint); + void setPoints(const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Rotation object. typedef std::shared_ptr RotationPtr; - #define DUMMY std::pair() /// \ingroup CPPHighAPI /// \brief Create Rotation feature. FEATURESAPI_EXPORT RotationPtr addRotation( - const std::shared_ptr& part, - const std::list& objects, - const ModelHighAPI_Selection& axis = ModelHighAPI_Selection(), - const std::pair& angle = DUMMY, - const ModelHighAPI_Selection& center = ModelHighAPI_Selection(), - const ModelHighAPI_Selection& start = ModelHighAPI_Selection(), - const ModelHighAPI_Selection& end = ModelHighAPI_Selection(), + const std::shared_ptr &part, + const std::list &objects, + const ModelHighAPI_Selection &axis = ModelHighAPI_Selection(), + const std::pair &angle = DUMMY, + const ModelHighAPI_Selection ¢er = ModelHighAPI_Selection(), + const ModelHighAPI_Selection &start = ModelHighAPI_Selection(), + const ModelHighAPI_Selection &end = ModelHighAPI_Selection(), const bool keepSubResults = false); #endif // FeaturesAPI_Rotation_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Scale.cpp b/src/FeaturesAPI/FeaturesAPI_Scale.cpp index 27354643b..e13463f83 100644 --- a/src/FeaturesAPI/FeaturesAPI_Scale.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Scale.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Scale.h" @@ -23,19 +24,19 @@ #include //================================================================================================== -FeaturesAPI_Scale::FeaturesAPI_Scale(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Scale::FeaturesAPI_Scale( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Scale::FeaturesAPI_Scale(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theScaleFactor) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Scale::FeaturesAPI_Scale( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theScaleFactor) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theCenterPoint, centerPoint()); @@ -44,14 +45,14 @@ FeaturesAPI_Scale::FeaturesAPI_Scale(const std::shared_ptr& th } //================================================================================================== -FeaturesAPI_Scale::FeaturesAPI_Scale(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theScaleFactorX, - const ModelHighAPI_Double& theScaleFactorY, - const ModelHighAPI_Double& theScaleFactorZ) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Scale::FeaturesAPI_Scale( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theScaleFactorX, + const ModelHighAPI_Double &theScaleFactorY, + const ModelHighAPI_Double &theScaleFactorZ) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theCenterPoint, centerPoint()); @@ -60,38 +61,38 @@ FeaturesAPI_Scale::FeaturesAPI_Scale(const std::shared_ptr& th } //================================================================================================== -FeaturesAPI_Scale::~FeaturesAPI_Scale() -{ -} +FeaturesAPI_Scale::~FeaturesAPI_Scale() {} //================================================================================================== -void FeaturesAPI_Scale::setMainObjects(const std::list& theMainObjects) -{ +void FeaturesAPI_Scale::setMainObjects( + const std::list &theMainObjects) { fillAttribute(theMainObjects, mainObjects()); execute(); } //================================================================================================== -void FeaturesAPI_Scale::setCenterPoint(const ModelHighAPI_Selection& theCenterPoint) -{ +void FeaturesAPI_Scale::setCenterPoint( + const ModelHighAPI_Selection &theCenterPoint) { fillAttribute(theCenterPoint, centerPoint()); execute(); } //================================================================================================== -void FeaturesAPI_Scale::setScaleFactor(const ModelHighAPI_Double& theScaleFactor) -{ - fillAttribute(FeaturesPlugin_Scale::CREATION_METHOD_BY_FACTOR(), creationMethod()); +void FeaturesAPI_Scale::setScaleFactor( + const ModelHighAPI_Double &theScaleFactor) { + fillAttribute(FeaturesPlugin_Scale::CREATION_METHOD_BY_FACTOR(), + creationMethod()); fillAttribute(theScaleFactor, scaleFactor()); execute(); } //================================================================================================== -void FeaturesAPI_Scale::setDimensions(const ModelHighAPI_Double& theScaleFactorX, - const ModelHighAPI_Double& theScaleFactorY, - const ModelHighAPI_Double& theScaleFactorZ) -{ - fillAttribute(FeaturesPlugin_Scale::CREATION_METHOD_BY_DIMENSIONS(), creationMethod()); +void FeaturesAPI_Scale::setDimensions( + const ModelHighAPI_Double &theScaleFactorX, + const ModelHighAPI_Double &theScaleFactorY, + const ModelHighAPI_Double &theScaleFactorZ) { + fillAttribute(FeaturesPlugin_Scale::CREATION_METHOD_BY_DIMENSIONS(), + creationMethod()); fillAttribute(theScaleFactorX, scaleFactorX()); fillAttribute(theScaleFactorY, scaleFactorY()); fillAttribute(theScaleFactorZ, scaleFactorZ()); @@ -99,33 +100,34 @@ void FeaturesAPI_Scale::setDimensions(const ModelHighAPI_Double& theScaleFactorX } //================================================================================================== -void FeaturesAPI_Scale::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Scale::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Scale::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addScale(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_Scale::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addScale(" << aDocName << ", " + << anAttrObjects; AttributeSelectionPtr anAttrPoint = - aBase->selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); + aBase->selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); theDumper << " , " << anAttrPoint; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Scale::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Scale::CREATION_METHOD())->value(); if (aCreationMethod == FeaturesPlugin_Scale::CREATION_METHOD_BY_FACTOR()) { AttributeDoublePtr anAttrScaleFactor = - aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_ID()); + aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_ID()); theDumper << ", " << anAttrScaleFactor; - } else if (aCreationMethod == FeaturesPlugin_Scale::CREATION_METHOD_BY_DIMENSIONS()) { + } else if (aCreationMethod == + FeaturesPlugin_Scale::CREATION_METHOD_BY_DIMENSIONS()) { AttributeDoublePtr anAttrScaleFactorX = - aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_X_ID()); + aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_X_ID()); AttributeDoublePtr anAttrScaleFactorY = - aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID()); + aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID()); AttributeDoublePtr anAttrScaleFactorZ = - aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID()); + aBase->real(FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID()); theDumper << ", " << anAttrScaleFactorX << " , " << anAttrScaleFactorY; theDumper << ", " << anAttrScaleFactorZ; } @@ -137,22 +139,24 @@ void FeaturesAPI_Scale::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -ScalePtr addScale(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theScaleFactorX, - const ModelHighAPI_Double& theScaleFactorY, - const ModelHighAPI_Double& theScaleFactorZ, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Scale::ID()); +ScalePtr addScale(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theScaleFactorX, + const ModelHighAPI_Double &theScaleFactorY, + const ModelHighAPI_Double &theScaleFactorZ, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Scale::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); ScalePtr aScale; if (theScaleFactorY.value() == 0 && theScaleFactorZ.value() == 0) - aScale.reset(new FeaturesAPI_Scale(aFeature, theMainObjects, theCenterPoint, theScaleFactorX)); + aScale.reset(new FeaturesAPI_Scale(aFeature, theMainObjects, theCenterPoint, + theScaleFactorX)); else aScale.reset(new FeaturesAPI_Scale(aFeature, theMainObjects, theCenterPoint, - theScaleFactorX, theScaleFactorY, theScaleFactorZ)); + theScaleFactorX, theScaleFactorY, + theScaleFactorZ)); return aScale; -} \ No newline at end of file +} diff --git a/src/FeaturesAPI/FeaturesAPI_Scale.h b/src/FeaturesAPI/FeaturesAPI_Scale.h index 2662c7bc5..8011960be 100644 --- a/src/FeaturesAPI/FeaturesAPI_Scale.h +++ b/src/FeaturesAPI/FeaturesAPI_Scale.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESAPI_SCALE_H_ @@ -34,71 +35,74 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Scale /// \ingroup CPPHighAPI /// \brief Interface for Scale feature. -class FeaturesAPI_Scale: public ModelHighAPI_Interface -{ +class FeaturesAPI_Scale : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Scale(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Scale( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Scale(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theScaleFactor); + explicit FeaturesAPI_Scale( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theScaleFactor); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Scale(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theScaleFactorX, - const ModelHighAPI_Double& theScaleFactorY, - const ModelHighAPI_Double& theScaleFactorZ); + explicit FeaturesAPI_Scale( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theScaleFactorX, + const ModelHighAPI_Double &theScaleFactorY, + const ModelHighAPI_Double &theScaleFactorZ); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Scale(); - INTERFACE_7(FeaturesPlugin_Scale::ID(), - creationMethod, FeaturesPlugin_Scale::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - mainObjects, FeaturesPlugin_Scale::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - centerPoint, FeaturesPlugin_Scale::CENTER_POINT_ID(), - ModelAPI_AttributeSelection, /** Center point */, - scaleFactor, FeaturesPlugin_Scale::SCALE_FACTOR_ID(), - ModelAPI_AttributeDouble, /** Scale factor */, - scaleFactorX, FeaturesPlugin_Scale::SCALE_FACTOR_X_ID(), - ModelAPI_AttributeDouble, /** Scale factor in X */, - scaleFactorY, FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID(), - ModelAPI_AttributeDouble, /** Scale factor in Y */, - scaleFactorZ, FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID(), - ModelAPI_AttributeDouble, /** Scale factor in Z */) + INTERFACE_7(FeaturesPlugin_Scale::ID(), creationMethod, + FeaturesPlugin_Scale::CREATION_METHOD(), ModelAPI_AttributeString, + /** Creation method */, mainObjects, + FeaturesPlugin_Scale::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, centerPoint, + FeaturesPlugin_Scale::CENTER_POINT_ID(), + ModelAPI_AttributeSelection, /** Center point */, scaleFactor, + FeaturesPlugin_Scale::SCALE_FACTOR_ID(), ModelAPI_AttributeDouble, + /** Scale factor */, scaleFactorX, + FeaturesPlugin_Scale::SCALE_FACTOR_X_ID(), + ModelAPI_AttributeDouble, /** Scale factor in X */, scaleFactorY, + FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID(), + ModelAPI_AttributeDouble, /** Scale factor in Y */, scaleFactorZ, + FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID(), + ModelAPI_AttributeDouble, + /** Scale factor in Z */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Modify center_point attribute of the feature. FEATURESAPI_EXPORT - void setCenterPoint(const ModelHighAPI_Selection& theCenterPoint); + void setCenterPoint(const ModelHighAPI_Selection &theCenterPoint); /// Modify Creation Method and scale_factor attribute of the feature. FEATURESAPI_EXPORT - void setScaleFactor(const ModelHighAPI_Double& theScaleFactor); + void setScaleFactor(const ModelHighAPI_Double &theScaleFactor); - /// Modify Creation Method and scale_factor_x, scale_factor_y and scale_factor_z - /// attributes of the feature. + /// Modify Creation Method and scale_factor_x, scale_factor_y and + /// scale_factor_z attributes of the feature. FEATURESAPI_EXPORT - void setDimensions(const ModelHighAPI_Double& theScaleFactorX, - const ModelHighAPI_Double& theScaleFactorY, - const ModelHighAPI_Double& theScaleFactorZ); + void setDimensions(const ModelHighAPI_Double &theScaleFactorX, + const ModelHighAPI_Double &theScaleFactorY, + const ModelHighAPI_Double &theScaleFactorZ); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Scale object. @@ -107,12 +111,13 @@ typedef std::shared_ptr ScalePtr; /// \ingroup CPPHighAPI /// \brief Create Scale feature. FEATURESAPI_EXPORT -ScalePtr addScale(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theScaleFactorX, - const ModelHighAPI_Double& theScaleFactorY = ModelHighAPI_Double(0.0), - const ModelHighAPI_Double& theScaleFactorZ = ModelHighAPI_Double(0.0), - const bool keepSubResults = false); - -#endif // FEATURESAPI_SCALE_H_ \ No newline at end of file +ScalePtr +addScale(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theScaleFactorX, + const ModelHighAPI_Double &theScaleFactorY = ModelHighAPI_Double(0.0), + const ModelHighAPI_Double &theScaleFactorZ = ModelHighAPI_Double(0.0), + const bool keepSubResults = false); + +#endif // FEATURESAPI_SCALE_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Sewing.cpp b/src/FeaturesAPI/FeaturesAPI_Sewing.cpp index 39663b0b3..e13f47d04 100644 --- a/src/FeaturesAPI/FeaturesAPI_Sewing.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Sewing.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Sewing.h" @@ -24,20 +25,20 @@ #include //================================================================================================== -FeaturesAPI_Sewing::FeaturesAPI_Sewing(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Sewing::FeaturesAPI_Sewing( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Sewing::FeaturesAPI_Sewing(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - bool theIsAllowNonManifold/*=false*/, - bool theIsAlwaysCreateResult/*=true*/) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Sewing::FeaturesAPI_Sewing( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, + bool theIsAllowNonManifold /*=false*/, + bool theIsAlwaysCreateResult /*=true*/) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theMainObjects, mainObjects()); setTolerance(theTolerance); @@ -47,69 +48,68 @@ FeaturesAPI_Sewing::FeaturesAPI_Sewing(const std::shared_ptr& } //================================================================================================== -FeaturesAPI_Sewing::~FeaturesAPI_Sewing() -{ -} +FeaturesAPI_Sewing::~FeaturesAPI_Sewing() {} //================================================================================================== -void FeaturesAPI_Sewing::setMainObjects(const std::list& theMainObjects) -{ +void FeaturesAPI_Sewing::setMainObjects( + const std::list &theMainObjects) { fillAttribute(theMainObjects, mainObjects()); execute(); } //================================================================================================== -void FeaturesAPI_Sewing::setTolerance(const ModelHighAPI_Double& theTolerance) -{ +void FeaturesAPI_Sewing::setTolerance(const ModelHighAPI_Double &theTolerance) { fillAttribute(theTolerance, tolerance()); execute(); } //================================================================================================== -void FeaturesAPI_Sewing::setIsAllowNonManifold(bool theFlag) -{ +void FeaturesAPI_Sewing::setIsAllowNonManifold(bool theFlag) { fillAttribute(theFlag, isAllowNonManifold()); execute(); } //================================================================================================== -void FeaturesAPI_Sewing::setIsAlwaysCreateResult(bool theFlag) -{ +void FeaturesAPI_Sewing::setIsAlwaysCreateResult(bool theFlag) { fillAttribute(theFlag, isAlwaysCreateResult()); execute(); } //================================================================================================== -void FeaturesAPI_Sewing::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Sewing::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Sewing::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addSewing(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_Sewing::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addSewing(" << aDocName << ", " + << anAttrObjects; - AttributeDoublePtr anAttrTolerance = aBase->real(FeaturesPlugin_Sewing::TOLERANCE_ID()); + AttributeDoublePtr anAttrTolerance = + aBase->real(FeaturesPlugin_Sewing::TOLERANCE_ID()); theDumper << ", " << anAttrTolerance; - AttributeBooleanPtr anAttrAllowNonMFold = aBase->boolean(FeaturesPlugin_Sewing::ALLOW_NON_MANIFOLD_ID()); + AttributeBooleanPtr anAttrAllowNonMFold = + aBase->boolean(FeaturesPlugin_Sewing::ALLOW_NON_MANIFOLD_ID()); theDumper << ", allowNonManifold = " << anAttrAllowNonMFold; - AttributeBooleanPtr anAttrAlwaysResult = aBase->boolean(FeaturesPlugin_Sewing::ALWAYS_CREATE_RESULT_ID()); + AttributeBooleanPtr anAttrAlwaysResult = + aBase->boolean(FeaturesPlugin_Sewing::ALWAYS_CREATE_RESULT_ID()); theDumper << ", alwaysCreateResult = " << anAttrAlwaysResult; theDumper << ")" << std::endl; } //================================================================================================== -SewingPtr addSewing(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, +SewingPtr addSewing(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, const bool allowNonManifold, - const bool alwaysCreateResult) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Sewing::ID()); + const bool alwaysCreateResult) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Sewing::ID()); SewingPtr aSewing; - aSewing.reset(new FeaturesAPI_Sewing(aFeature, theMainObjects, theTolerance, allowNonManifold, alwaysCreateResult)); + aSewing.reset(new FeaturesAPI_Sewing(aFeature, theMainObjects, theTolerance, + allowNonManifold, alwaysCreateResult)); return aSewing; } diff --git a/src/FeaturesAPI/FeaturesAPI_Sewing.h b/src/FeaturesAPI/FeaturesAPI_Sewing.h index ba1793d34..8c78adbf9 100644 --- a/src/FeaturesAPI/FeaturesAPI_Sewing.h +++ b/src/FeaturesAPI/FeaturesAPI_Sewing.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESAPI_SEWING_H_ @@ -34,42 +35,44 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Sewing /// \ingroup CPPHighAPI /// \brief Interface for Sewing feature. -class FeaturesAPI_Sewing: public ModelHighAPI_Interface -{ +class FeaturesAPI_Sewing : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Sewing(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Sewing( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Sewing(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - bool theIsAllowNonManifold = false, - bool theIsAlwaysCreateResult = true); + explicit FeaturesAPI_Sewing( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, + bool theIsAllowNonManifold = false, bool theIsAlwaysCreateResult = true); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Sewing(); - INTERFACE_4(FeaturesPlugin_Sewing::ID(), - mainObjects, FeaturesPlugin_Sewing::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - tolerance, FeaturesPlugin_Sewing::TOLERANCE_ID(), - ModelAPI_AttributeDouble, /** Tolerance */, - isAllowNonManifold, FeaturesPlugin_Sewing::ALLOW_NON_MANIFOLD_ID(), + INTERFACE_4(FeaturesPlugin_Sewing::ID(), mainObjects, + FeaturesPlugin_Sewing::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, tolerance, + FeaturesPlugin_Sewing::TOLERANCE_ID(), ModelAPI_AttributeDouble, + /** Tolerance */, isAllowNonManifold, + FeaturesPlugin_Sewing::ALLOW_NON_MANIFOLD_ID(), ModelAPI_AttributeBoolean, /** Allow Non-Manifold Shapes */, - isAlwaysCreateResult, FeaturesPlugin_Sewing::ALWAYS_CREATE_RESULT_ID(), - ModelAPI_AttributeBoolean, /** Always Create Result */) + isAlwaysCreateResult, + FeaturesPlugin_Sewing::ALWAYS_CREATE_RESULT_ID(), + ModelAPI_AttributeBoolean, + /** Always Create Result */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Set the tolerance. FEATURESAPI_EXPORT - void setTolerance(const ModelHighAPI_Double& theTolerance); + void setTolerance(const ModelHighAPI_Double &theTolerance); /// Set flag whether to allow non-manifold results. FEATURESAPI_EXPORT @@ -81,7 +84,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Sewing object. @@ -89,11 +92,10 @@ typedef std::shared_ptr SewingPtr; /// \ingroup CPPHighAPI /// \brief Create Sewing feature. -FEATURESAPI_EXPORT SewingPtr addSewing( - const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Double& theTolerance, - const bool allowNonManifold, - const bool alwaysCreateResult); +FEATURESAPI_EXPORT SewingPtr +addSewing(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Double &theTolerance, const bool allowNonManifold, + const bool alwaysCreateResult); #endif // FEATURESAPI_SEWING_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp b/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp index 0f4d77a69..feb9249be 100644 --- a/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp +++ b/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_SharedFaces.h" @@ -28,19 +29,16 @@ //================================================================================================= FeaturesAPI_SharedFaces::FeaturesAPI_SharedFaces( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================= FeaturesAPI_SharedFaces::FeaturesAPI_SharedFaces( - const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject, - const std::string & theNameGroup) -:ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject, const std::string &theNameGroup) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theObject, myobjectselected); fillAttribute(theNameGroup, mygroupname); @@ -49,35 +47,32 @@ FeaturesAPI_SharedFaces::FeaturesAPI_SharedFaces( } //================================================================================================= -FeaturesAPI_SharedFaces::~FeaturesAPI_SharedFaces() -{ -} +FeaturesAPI_SharedFaces::~FeaturesAPI_SharedFaces() {} //================================================================================================= -void FeaturesAPI_SharedFaces::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_SharedFaces::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrObject; anAttrObject = aBase->selection(FeaturesPlugin_GroupSharedFaces::OBJECT_ID()); - theDumper << aBase << " = model.getSharedFaces(" << aDocName << ", " << anAttrObject; - theDumper << ", " << aBase->string(FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID()); + theDumper << aBase << " = model.getSharedFaces(" << aDocName << ", " + << anAttrObject; + theDumper << ", " + << aBase->string(FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID()); theDumper << ")" << std::endl; } //================================================================================================= -SharedFacesPtr getSharedFaces(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject, - const std::string & theNameGroup) -{ - FeaturePtr aFeature = thePart->addFeature(FeaturesPlugin_GroupSharedFaces::ID()); +SharedFacesPtr getSharedFaces(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject, + const std::string &theNameGroup) { + FeaturePtr aFeature = + thePart->addFeature(FeaturesPlugin_GroupSharedFaces::ID()); SharedFacesPtr aSharedFaces; - aSharedFaces.reset(new FeaturesAPI_SharedFaces(aFeature, - theObject, - theNameGroup)); + aSharedFaces.reset( + new FeaturesAPI_SharedFaces(aFeature, theObject, theNameGroup)); return aSharedFaces; } - diff --git a/src/FeaturesAPI/FeaturesAPI_SharedFaces.h b/src/FeaturesAPI/FeaturesAPI_SharedFaces.h index 0245727b1..9d03435ae 100644 --- a/src/FeaturesAPI/FeaturesAPI_SharedFaces.h +++ b/src/FeaturesAPI/FeaturesAPI_SharedFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_SharedFaces_H_ @@ -34,31 +35,32 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_SharedFaces /// \ingroup CPPHighAPI /// \brief Interface to find shared faces -class FeaturesAPI_SharedFaces: public ModelHighAPI_Interface -{ +class FeaturesAPI_SharedFaces : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_SharedFaces(const std::shared_ptr& theFeature); + explicit FeaturesAPI_SharedFaces( + const std::shared_ptr &theFeature); FEATURESAPI_EXPORT - explicit FeaturesAPI_SharedFaces(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theObject, - const std::string & theNameGroup); + explicit FeaturesAPI_SharedFaces( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theObject, const std::string &theNameGroup); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_SharedFaces(); - INTERFACE_2(FeaturesPlugin_GroupSharedFaces::ID(), - objectselected, FeaturesPlugin_GroupSharedFaces::OBJECT_ID(), - ModelAPI_AttributeSelection, /** object selected*/, - groupname, FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID(), - ModelAPI_AttributeString, /** group name*/) + INTERFACE_2(FeaturesPlugin_GroupSharedFaces::ID(), objectselected, + FeaturesPlugin_GroupSharedFaces::OBJECT_ID(), + ModelAPI_AttributeSelection, /** object selected*/, groupname, + FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID(), + ModelAPI_AttributeString, + /** group name*/) /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on the SharedFaces object. @@ -70,8 +72,8 @@ typedef std::shared_ptr SharedFacesPtr; /// \param theObject the selected object /// \param theNameGroup the group name FEATURESAPI_EXPORT -SharedFacesPtr getSharedFaces(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject, - const std::string & theNameGroup); +SharedFacesPtr getSharedFaces(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theObject, + const std::string &theNameGroup); #endif // FeaturesAPI_SharedFaces_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp b/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp index ac1fa3dee..dd94e99e4 100644 --- a/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Symmetry.h" @@ -23,98 +24,99 @@ #include //================================================================================================== -FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Symmetry::FeaturesAPI_Symmetry( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theObject, - bool theKeepOriginal) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Symmetry::FeaturesAPI_Symmetry( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theObject, bool theKeepOriginal) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mainObjects()); fillAttribute(theKeepOriginal, keepOriginal()); GeomAPI_Shape::ShapeType aType = getShapeType(theObject); - if(aType == GeomAPI_Shape::VERTEX) { + if (aType == GeomAPI_Shape::VERTEX) { setPoint(theObject); - } else if(aType == GeomAPI_Shape::EDGE) { + } else if (aType == GeomAPI_Shape::EDGE) { setAxis(theObject); - } else if(aType == GeomAPI_Shape::FACE) { + } else if (aType == GeomAPI_Shape::FACE) { setPlane(theObject); } } } //================================================================================================== -FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry() -{ -} +FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry() {} //================================================================================================== void FeaturesAPI_Symmetry::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, mainObjects()); execute(); } //================================================================================================== -void FeaturesAPI_Symmetry::setPoint(const ModelHighAPI_Selection& thePointObject) -{ - fillAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD_BY_POINT(), creationMethod()); +void FeaturesAPI_Symmetry::setPoint( + const ModelHighAPI_Selection &thePointObject) { + fillAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD_BY_POINT(), + creationMethod()); fillAttribute(thePointObject, pointObject()); execute(); } //================================================================================================== -void FeaturesAPI_Symmetry::setAxis(const ModelHighAPI_Selection& theAxisObject) -{ - fillAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD_BY_AXIS(), creationMethod()); +void FeaturesAPI_Symmetry::setAxis( + const ModelHighAPI_Selection &theAxisObject) { + fillAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD_BY_AXIS(), + creationMethod()); fillAttribute(theAxisObject, axisObject()); execute(); } //================================================================================================== -void FeaturesAPI_Symmetry::setPlane(const ModelHighAPI_Selection& thePlaneObject) -{ - fillAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD_BY_PLANE(), creationMethod()); +void FeaturesAPI_Symmetry::setPlane( + const ModelHighAPI_Selection &thePlaneObject) { + fillAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD_BY_PLANE(), + creationMethod()); fillAttribute(thePlaneObject, planeObject()); execute(); } //================================================================================================== -void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Symmetry::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addSymmetry(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_Symmetry::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addSymmetry(" << aDocName << ", " + << anAttrObjects; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Symmetry::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Symmetry::CREATION_METHOD())->value(); if (aCreationMethod == FeaturesPlugin_Symmetry::CREATION_METHOD_BY_POINT()) { AttributeSelectionPtr anAttrPoint = - aBase->selection(FeaturesPlugin_Symmetry::POINT_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Symmetry::POINT_OBJECT_ID()); theDumper << ", " << anAttrPoint; - } else if (aCreationMethod == FeaturesPlugin_Symmetry::CREATION_METHOD_BY_AXIS()) { + } else if (aCreationMethod == + FeaturesPlugin_Symmetry::CREATION_METHOD_BY_AXIS()) { AttributeSelectionPtr anAttrAxis = - aBase->selection(FeaturesPlugin_Symmetry::AXIS_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Symmetry::AXIS_OBJECT_ID()); theDumper << ", " << anAttrAxis; - } else if (aCreationMethod == FeaturesPlugin_Symmetry::CREATION_METHOD_BY_PLANE()) { + } else if (aCreationMethod == + FeaturesPlugin_Symmetry::CREATION_METHOD_BY_PLANE()) { AttributeSelectionPtr anAttrPlane = - aBase->selection(FeaturesPlugin_Symmetry::PLANE_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Symmetry::PLANE_OBJECT_ID()); theDumper << ", " << anAttrPlane; } @@ -127,15 +129,15 @@ void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -SymmetryPtr addSymmetry(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theObject, +SymmetryPtr addSymmetry(const std::shared_ptr &thePart, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theObject, const bool theKeepOriginal, - const bool theKeepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Symmetry::ID()); + const bool theKeepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Symmetry::ID()); if (!theKeepSubResults) aFeature->data()->setVersion(""); - return SymmetryPtr(new FeaturesAPI_Symmetry( - aFeature, theMainObjects, theObject, theKeepOriginal)); + return SymmetryPtr(new FeaturesAPI_Symmetry(aFeature, theMainObjects, + theObject, theKeepOriginal)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Symmetry.h b/src/FeaturesAPI/FeaturesAPI_Symmetry.h index 801b3e2bb..103982903 100644 --- a/src/FeaturesAPI/FeaturesAPI_Symmetry.h +++ b/src/FeaturesAPI/FeaturesAPI_Symmetry.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESAPI_SYMMETRY_H_ @@ -34,57 +35,58 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Symmetry /// \ingroup CPPHighAPI /// \brief Interface for Symmetry feature. -class FeaturesAPI_Symmetry: public ModelHighAPI_Interface -{ +class FeaturesAPI_Symmetry : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Symmetry(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Symmetry( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Symmetry(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theObject, - bool theKeepOriginal = true); + explicit FeaturesAPI_Symmetry( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theObject, bool theKeepOriginal = true); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Symmetry(); - INTERFACE_6(FeaturesPlugin_Symmetry::ID(), - creationMethod, FeaturesPlugin_Symmetry::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - mainObjects, FeaturesPlugin_Symmetry::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - pointObject, FeaturesPlugin_Symmetry::POINT_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Point object */, - axisObject, FeaturesPlugin_Symmetry::AXIS_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Axis object */, - planeObject, FeaturesPlugin_Symmetry::PLANE_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Plane object */, - keepOriginal, FeaturesPlugin_Symmetry::KEEP_ORIGINAL_RESULT(), - ModelAPI_AttributeBoolean, /** Keep original shape */) + INTERFACE_6(FeaturesPlugin_Symmetry::ID(), creationMethod, + FeaturesPlugin_Symmetry::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, mainObjects, + FeaturesPlugin_Symmetry::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, pointObject, + FeaturesPlugin_Symmetry::POINT_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Point object */, axisObject, + FeaturesPlugin_Symmetry::AXIS_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Axis object */, planeObject, + FeaturesPlugin_Symmetry::PLANE_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Plane object */, keepOriginal, + FeaturesPlugin_Symmetry::KEEP_ORIGINAL_RESULT(), + ModelAPI_AttributeBoolean, + /** Keep original shape */) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Modify CreationMethod, point_object attribute of the feature. FEATURESAPI_EXPORT - void setPoint(const ModelHighAPI_Selection& thePointObject); + void setPoint(const ModelHighAPI_Selection &thePointObject); /// Modify CreationMethod, axis_object attribute of the feature. FEATURESAPI_EXPORT - void setAxis(const ModelHighAPI_Selection& theAxisObject); + void setAxis(const ModelHighAPI_Selection &theAxisObject); /// Modify CreationMethod, plane_object attribute of the feature. FEATURESAPI_EXPORT - void setPlane(const ModelHighAPI_Selection& thePlaneObject); + void setPlane(const ModelHighAPI_Selection &thePlaneObject); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Symmetry object. @@ -93,9 +95,9 @@ typedef std::shared_ptr SymmetryPtr; /// \ingroup CPPHighAPI /// \brief Create Symmetry feature. FEATURESAPI_EXPORT -SymmetryPtr addSymmetry(const std::shared_ptr& part, - const std::list& objects, - const ModelHighAPI_Selection& basis, +SymmetryPtr addSymmetry(const std::shared_ptr &part, + const std::list &objects, + const ModelHighAPI_Selection &basis, const bool keepOriginal = true, const bool keepSubResults = false); diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.cpp b/src/FeaturesAPI/FeaturesAPI_Translation.cpp index 0a0d30899..a2bc3b062 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Translation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Translation.h" @@ -24,21 +25,19 @@ //================================================================================================== FeaturesAPI_Translation::FeaturesAPI_Translation( - const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== FeaturesAPI_Translation::FeaturesAPI_Translation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mymainObjects); setAxisAndDistance(theAxisObject, theDistance); } @@ -46,14 +45,12 @@ FeaturesAPI_Translation::FeaturesAPI_Translation( //================================================================================================== FeaturesAPI_Translation::FeaturesAPI_Translation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theDx, const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mymainObjects); setDimensions(theDx, theDy, theDz); } @@ -61,38 +58,34 @@ FeaturesAPI_Translation::FeaturesAPI_Translation( //================================================================================================== FeaturesAPI_Translation::FeaturesAPI_Translation( - const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theMainObjects, mymainObjects); setPoints(theStartPoint, theEndPoint); } } //================================================================================================== -FeaturesAPI_Translation::~FeaturesAPI_Translation() -{ - -} +FeaturesAPI_Translation::~FeaturesAPI_Translation() {} //================================================================================================== void FeaturesAPI_Translation::setMainObjects( - const std::list& theMainObjects) -{ + const std::list &theMainObjects) { fillAttribute(theMainObjects, mymainObjects); execute(); } //================================================================================================== -void FeaturesAPI_Translation::setAxisAndDistance(const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) -{ - fillAttribute(FeaturesPlugin_Translation::CREATION_METHOD_BY_DISTANCE(), mycreationMethod); +void FeaturesAPI_Translation::setAxisAndDistance( + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance) { + fillAttribute(FeaturesPlugin_Translation::CREATION_METHOD_BY_DISTANCE(), + mycreationMethod); fillAttribute(theAxisObject, myaxisObject); fillAttribute(theDistance, mydistance); @@ -100,11 +93,11 @@ void FeaturesAPI_Translation::setAxisAndDistance(const ModelHighAPI_Selection& t } //================================================================================================== -void FeaturesAPI_Translation::setDimensions(const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz) -{ - fillAttribute(FeaturesPlugin_Translation::CREATION_METHOD_BY_DIMENSIONS(), mycreationMethod); +void FeaturesAPI_Translation::setDimensions(const ModelHighAPI_Double &theDx, + const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz) { + fillAttribute(FeaturesPlugin_Translation::CREATION_METHOD_BY_DIMENSIONS(), + mycreationMethod); fillAttribute(theDx, mydx); fillAttribute(theDy, mydy); fillAttribute(theDz, mydz); @@ -113,10 +106,11 @@ void FeaturesAPI_Translation::setDimensions(const ModelHighAPI_Double& theDx, } //================================================================================================== -void FeaturesAPI_Translation::setPoints(const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint) -{ - fillAttribute(FeaturesPlugin_Translation::CREATION_METHOD_BY_TWO_POINTS(), mycreationMethod); +void FeaturesAPI_Translation::setPoints( + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint) { + fillAttribute(FeaturesPlugin_Translation::CREATION_METHOD_BY_TWO_POINTS(), + mycreationMethod); fillAttribute(theStartPoint, mystartPoint); fillAttribute(theEndPoint, myendPoint); @@ -124,35 +118,43 @@ void FeaturesAPI_Translation::setPoints(const ModelHighAPI_Selection& theStartPo } //================================================================================================== -void FeaturesAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Translation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID()); - theDumper << aBase << " = model.addTranslation(" << aDocName << ", " << anAttrObjects; + aBase->selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID()); + theDumper << aBase << " = model.addTranslation(" << aDocName << ", " + << anAttrObjects; std::string aCreationMethod = - aBase->string(FeaturesPlugin_Translation::CREATION_METHOD())->value(); + aBase->string(FeaturesPlugin_Translation::CREATION_METHOD())->value(); - if (aCreationMethod == FeaturesPlugin_Translation::CREATION_METHOD_BY_DISTANCE()) { + if (aCreationMethod == + FeaturesPlugin_Translation::CREATION_METHOD_BY_DISTANCE()) { AttributeSelectionPtr anAttrAxis = - aBase->selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID()); + aBase->selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID()); AttributeDoublePtr anAttrDistance = - aBase->real(FeaturesPlugin_Translation::DISTANCE_ID()); + aBase->real(FeaturesPlugin_Translation::DISTANCE_ID()); theDumper << ", axis = " << anAttrAxis << ", distance = " << anAttrDistance; - } else if (aCreationMethod == FeaturesPlugin_Translation::CREATION_METHOD_BY_DIMENSIONS()) { - AttributeDoublePtr anAttrDx = aBase->real(FeaturesPlugin_Translation::DX_ID()); - AttributeDoublePtr anAttrDy = aBase->real(FeaturesPlugin_Translation::DY_ID()); - AttributeDoublePtr anAttrDz = aBase->real(FeaturesPlugin_Translation::DZ_ID()); - theDumper << ", vector = [" << anAttrDx << ", " << anAttrDy << ", " << anAttrDz << "]"; - } else if (aCreationMethod == FeaturesPlugin_Translation::CREATION_METHOD_BY_TWO_POINTS()) { + } else if (aCreationMethod == + FeaturesPlugin_Translation::CREATION_METHOD_BY_DIMENSIONS()) { + AttributeDoublePtr anAttrDx = + aBase->real(FeaturesPlugin_Translation::DX_ID()); + AttributeDoublePtr anAttrDy = + aBase->real(FeaturesPlugin_Translation::DY_ID()); + AttributeDoublePtr anAttrDz = + aBase->real(FeaturesPlugin_Translation::DZ_ID()); + theDumper << ", vector = [" << anAttrDx << ", " << anAttrDy << ", " + << anAttrDz << "]"; + } else if (aCreationMethod == + FeaturesPlugin_Translation::CREATION_METHOD_BY_TWO_POINTS()) { AttributeSelectionPtr anAttrStartPoint = - aBase->selection(FeaturesPlugin_Translation::START_POINT_ID()); + aBase->selection(FeaturesPlugin_Translation::START_POINT_ID()); AttributeSelectionPtr anAttrEndPoint = - aBase->selection(FeaturesPlugin_Translation::END_POINT_ID()); - theDumper << ", startPoint = " << anAttrStartPoint << ", endPoint = " << anAttrEndPoint; + aBase->selection(FeaturesPlugin_Translation::END_POINT_ID()); + theDumper << ", startPoint = " << anAttrStartPoint + << ", endPoint = " << anAttrEndPoint; } if (!aBase->data()->version().empty()) @@ -163,17 +165,17 @@ void FeaturesAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const //================================================================================================== TranslationPtr addTranslation( - const std::shared_ptr& part, - const std::list& objects, - const std::pair& deprecated1, - const std::pair& deprecated2, - const std::pair& deprecated3, - const ModelHighAPI_Selection& axis, const ModelHighAPI_Double& distance, - const std::list& vector, - const ModelHighAPI_Selection& startPoint, const ModelHighAPI_Selection& endPoint, - const bool keepSubResults) -{ - std::shared_ptr aFeature = part->addFeature(FeaturesAPI_Translation::ID()); + const std::shared_ptr &part, + const std::list &objects, + const std::pair &deprecated1, + const std::pair &deprecated2, + const std::pair &deprecated3, + const ModelHighAPI_Selection &axis, const ModelHighAPI_Double &distance, + const std::list &vector, + const ModelHighAPI_Selection &startPoint, + const ModelHighAPI_Selection &endPoint, const bool keepSubResults) { + std::shared_ptr aFeature = + part->addFeature(FeaturesAPI_Translation::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); @@ -181,32 +183,30 @@ TranslationPtr addTranslation( bool byAxis = axis.variantType() != ModelHighAPI_Selection::VT_Empty; bool byVector = vector.size() == VEC_SIZE; - bool byPoints = startPoint.variantType() != ModelHighAPI_Selection::VT_Empty && - endPoint.variantType() != ModelHighAPI_Selection::VT_Empty; + bool byPoints = + startPoint.variantType() != ModelHighAPI_Selection::VT_Empty && + endPoint.variantType() != ModelHighAPI_Selection::VT_Empty; ModelHighAPI_Selection firstSel, secondSel; ModelHighAPI_Double values[VEC_SIZE]; if (byAxis) { firstSel = axis; values[0] = distance; - } - else if (byVector) { + } else if (byVector) { std::list::const_iterator it = vector.begin(); - for (ModelHighAPI_Double* vIt = values; it != vector.end(); ++vIt, ++it) + for (ModelHighAPI_Double *vIt = values; it != vector.end(); ++vIt, ++it) *vIt = *it; - } - else if (byPoints) { + } else if (byPoints) { firstSel = startPoint; secondSel = endPoint; - } - else { - byVector = deprecated1.first.variantType() == ModelHighAPI_Selection::VT_Empty; + } else { + byVector = + deprecated1.first.variantType() == ModelHighAPI_Selection::VT_Empty; if (byVector) { values[0] = deprecated1.second; values[1] = deprecated2.second; values[2] = deprecated3.second; - } - else { + } else { firstSel = deprecated1.first; secondSel = deprecated2.first; values[0] = deprecated2.second; @@ -219,13 +219,14 @@ TranslationPtr addTranslation( TranslationPtr aTranslation; if (byAxis) - aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects, firstSel, values[0])); + aTranslation.reset( + new FeaturesAPI_Translation(aFeature, objects, firstSel, values[0])); else if (byVector) { - aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects, - values[0], values[1], values[2])); - } - else if (byPoints) - aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects, firstSel, secondSel)); + aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects, values[0], + values[1], values[2])); + } else if (byPoints) + aTranslation.reset( + new FeaturesAPI_Translation(aFeature, objects, firstSel, secondSel)); return aTranslation; } diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.h b/src/FeaturesAPI/FeaturesAPI_Translation.h index 62296f7f9..f63ba966c 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.h +++ b/src/FeaturesAPI/FeaturesAPI_Translation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Translation_H_ @@ -34,83 +35,84 @@ class ModelHighAPI_Dumper; /// \class FeaturesAPI_Translation /// \ingroup CPPHighAPI /// \brief Interface for Translation feature. -class FeaturesAPI_Translation: public ModelHighAPI_Interface -{ +class FeaturesAPI_Translation : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Translation(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Translation( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Translation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance); + explicit FeaturesAPI_Translation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Translation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz); + explicit FeaturesAPI_Translation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Double &theDx, const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Translation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint); + explicit FeaturesAPI_Translation( + const std::shared_ptr &theFeature, + const std::list &theMainObjects, + const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Translation(); - INTERFACE_9(FeaturesPlugin_Translation::ID(), - creationMethod, FeaturesPlugin_Translation::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - mainObjects, FeaturesPlugin_Translation::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList, /** Main objects */, - axisObject, FeaturesPlugin_Translation::AXIS_OBJECT_ID(), - ModelAPI_AttributeSelection, /** Axis object */, - distance, FeaturesPlugin_Translation::DISTANCE_ID(), - ModelAPI_AttributeDouble, /** Distance */, - dx, FeaturesPlugin_Translation::DX_ID(), - ModelAPI_AttributeDouble, /** Dimension in X */, - dy, FeaturesPlugin_Translation::DY_ID(), - ModelAPI_AttributeDouble, /** Dimension in Y */, - dz, FeaturesPlugin_Translation::DZ_ID(), - ModelAPI_AttributeDouble, /** Dimension in Z */, - startPoint, FeaturesPlugin_Translation::START_POINT_ID(), - ModelAPI_AttributeSelection, /** Start point object */, - endPoint, FeaturesPlugin_Translation::END_POINT_ID(), + INTERFACE_9(FeaturesPlugin_Translation::ID(), creationMethod, + FeaturesPlugin_Translation::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, mainObjects, + FeaturesPlugin_Translation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList, /** Main objects */, axisObject, + FeaturesPlugin_Translation::AXIS_OBJECT_ID(), + ModelAPI_AttributeSelection, /** Axis object */, distance, + FeaturesPlugin_Translation::DISTANCE_ID(), + ModelAPI_AttributeDouble, /** Distance */, dx, + FeaturesPlugin_Translation::DX_ID(), ModelAPI_AttributeDouble, + /** Dimension in X */, dy, FeaturesPlugin_Translation::DY_ID(), + ModelAPI_AttributeDouble, /** Dimension in Y */, dz, + FeaturesPlugin_Translation::DZ_ID(), ModelAPI_AttributeDouble, + /** Dimension in Z */, startPoint, + FeaturesPlugin_Translation::START_POINT_ID(), + ModelAPI_AttributeSelection, /** Start point object */, endPoint, + FeaturesPlugin_Translation::END_POINT_ID(), ModelAPI_AttributeSelection, /** End point object */ - ) + ) /// Set main objects. FEATURESAPI_EXPORT - void setMainObjects(const std::list& theMainObjects); + void setMainObjects(const std::list &theMainObjects); /// Modify CreationMethod, axis_object, distance attributes of the feature. FEATURESAPI_EXPORT - void setAxisAndDistance(const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance); + void setAxisAndDistance(const ModelHighAPI_Selection &theAxisObject, + const ModelHighAPI_Double &theDistance); /// Modify CreationMethod, dx, dy, dz attributes of the feature. FEATURESAPI_EXPORT - void setDimensions(const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz); + void setDimensions(const ModelHighAPI_Double &theDx, + const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz); /// Modify CreationMethod, start_point, end_point attributes of the feature. FEATURESAPI_EXPORT - void setPoints(const ModelHighAPI_Selection& theStartPoint, - const ModelHighAPI_Selection& theEndPoint); + void setPoints(const ModelHighAPI_Selection &theStartPoint, + const ModelHighAPI_Selection &theEndPoint); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Translation object. @@ -121,16 +123,20 @@ typedef std::shared_ptr TranslationPtr; /// \ingroup CPPHighAPI /// \brief Create Translation feature. FEATURESAPI_EXPORT TranslationPtr addTranslation( - const std::shared_ptr& part, - const std::list& objects, - const std::pair& deprecated1 = DUMMY, - const std::pair& deprecated2 = DUMMY, - const std::pair& deprecated3 = DUMMY, - const ModelHighAPI_Selection& axis = ModelHighAPI_Selection(), - const ModelHighAPI_Double& distance = ModelHighAPI_Double(0.0), - const std::list& vector = std::list(), - const ModelHighAPI_Selection& startPoint = ModelHighAPI_Selection(), - const ModelHighAPI_Selection& endPoint = ModelHighAPI_Selection(), - const bool keepSubResults = false ); + const std::shared_ptr &part, + const std::list &objects, + const std::pair &deprecated1 = + DUMMY, + const std::pair &deprecated2 = + DUMMY, + const std::pair &deprecated3 = + DUMMY, + const ModelHighAPI_Selection &axis = ModelHighAPI_Selection(), + const ModelHighAPI_Double &distance = ModelHighAPI_Double(0.0), + const std::list &vector = + std::list(), + const ModelHighAPI_Selection &startPoint = ModelHighAPI_Selection(), + const ModelHighAPI_Selection &endPoint = ModelHighAPI_Selection(), + const bool keepSubResults = false); #endif // FeaturesAPI_Translation_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Union.cpp b/src/FeaturesAPI/FeaturesAPI_Union.cpp index 6ff051d09..30532c968 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Union.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesAPI_Union.h" @@ -22,24 +23,22 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================ -FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +FeaturesAPI_Union::FeaturesAPI_Union( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================ -FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy) -: ModelHighAPI_Interface(theFeature) -{ - if(initialize()) { +FeaturesAPI_Union::FeaturesAPI_Union( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theFuzzy) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { fillAttribute(theBaseObjects, VAR_NAME(baseObjects)); fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); @@ -56,47 +55,44 @@ FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr& th } //================================================================================================ -FeaturesAPI_Union::~FeaturesAPI_Union() -{ - -} +FeaturesAPI_Union::~FeaturesAPI_Union() {} //================================================================================================== -void FeaturesAPI_Union::setBase(const std::list& theBaseObjects) -{ +void FeaturesAPI_Union::setBase( + const std::list &theBaseObjects) { fillAttribute(theBaseObjects, VAR_NAME(baseObjects)); execute(); } //================================================================================================== -void FeaturesAPI_Union::setUseFuzzy(bool theUseFuzzy) -{ +void FeaturesAPI_Union::setUseFuzzy(bool theUseFuzzy) { fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } //================================================================================================== -void FeaturesAPI_Union::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) -{ +void FeaturesAPI_Union::setFuzzyValue(const ModelHighAPI_Double &theFuzzy) { fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } //================================================================================================== -void FeaturesAPI_Union::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FeaturesAPI_Union::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anAttrObjects = - aBase->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); - bool aUseFuzzy = aBase->boolean(FeaturesPlugin_Union::USE_FUZZY_ID())->value(); - AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_Union::FUZZY_PARAM_ID()); + aBase->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); + bool aUseFuzzy = + aBase->boolean(FeaturesPlugin_Union::USE_FUZZY_ID())->value(); + AttributeDoublePtr aFuzzy = + aBase->real(FeaturesPlugin_Union::FUZZY_PARAM_ID()); - theDumper << aBase << " = model.addUnion(" << aDocName << ", " << anAttrObjects; + theDumper << aBase << " = model.addUnion(" << aDocName << ", " + << anAttrObjects; if (aUseFuzzy) theDumper << ", fuzzyParam = " << aFuzzy; @@ -108,12 +104,12 @@ void FeaturesAPI_Union::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -UnionPtr addUnion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy, - const bool keepSubResults) -{ - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Union::ID()); +UnionPtr addUnion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theFuzzy, + const bool keepSubResults) { + std::shared_ptr aFeature = + thePart->addFeature(FeaturesAPI_Union::ID()); if (!keepSubResults) aFeature->data()->setVersion(""); return UnionPtr(new FeaturesAPI_Union(aFeature, theBaseObjects, theFuzzy)); diff --git a/src/FeaturesAPI/FeaturesAPI_Union.h b/src/FeaturesAPI/FeaturesAPI_Union.h index 2f08a2f4a..bf38add5d 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.h +++ b/src/FeaturesAPI/FeaturesAPI_Union.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_Union_H_ @@ -24,9 +25,9 @@ #include +#include #include #include -#include class ModelHighAPI_Dumper; class ModelHighAPI_Selection; @@ -34,34 +35,35 @@ class ModelHighAPI_Selection; /// \class FeaturesAPI_Union /// \ingroup CPPHighAPI /// \brief Interface for Union feature. -class FeaturesAPI_Union: public ModelHighAPI_Interface -{ +class FeaturesAPI_Union : public ModelHighAPI_Interface { public: /// Constructor without values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Union(const std::shared_ptr& theFeature); + explicit FeaturesAPI_Union( + const std::shared_ptr &theFeature); /// Constructor with values. FEATURESAPI_EXPORT - explicit FeaturesAPI_Union(const std::shared_ptr& theFeature, - const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); + explicit FeaturesAPI_Union( + const std::shared_ptr &theFeature, + const std::list &theBaseObjects, + const ModelHighAPI_Double &theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Union(); - INTERFACE_3(FeaturesPlugin_Union::ID(), - baseObjects, FeaturesPlugin_Union::BASE_OBJECTS_ID(), - ModelAPI_AttributeSelectionList, /** Base objects */, - useFuzzy, FeaturesPlugin_Union::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, - fuzzyParam, FeaturesPlugin_Union::FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble, /** Fuzzy parameter */) + INTERFACE_3(FeaturesPlugin_Union::ID(), baseObjects, + FeaturesPlugin_Union::BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList, /** Base objects */, useFuzzy, + FeaturesPlugin_Union::USE_FUZZY_ID(), ModelAPI_AttributeBoolean, + /** Use Fuzzy parameter*/, fuzzyParam, + FeaturesPlugin_Union::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, + /** Fuzzy parameter */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT - void setBase(const std::list& theBaseObjects); + void setBase(const std::list &theBaseObjects); /// Set use fuzzy parameter. FEATURESAPI_EXPORT @@ -69,11 +71,11 @@ public: /// Set fuzzy parameter. FEATURESAPI_EXPORT - void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); + void setFuzzyValue(const ModelHighAPI_Double &theFuzzy); /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Union object. @@ -82,9 +84,10 @@ typedef std::shared_ptr UnionPtr; /// \ingroup CPPHighAPI /// \brief Create Union feature. FEATURESAPI_EXPORT -UnionPtr addUnion(const std::shared_ptr& thePart, - const std::list& theBaseObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), - const bool keepSubResults = false); +UnionPtr +addUnion(const std::shared_ptr &thePart, + const std::list &theBaseObjects, + const ModelHighAPI_Double &fuzzyParam = ModelHighAPI_Double(-1), + const bool keepSubResults = false); #endif // FeaturesAPI_Union_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_swig.h b/src/FeaturesAPI/FeaturesAPI_swig.h index 6b3559f17..03cdbc73b 100644 --- a/src/FeaturesAPI/FeaturesAPI_swig.h +++ b/src/FeaturesAPI/FeaturesAPI_swig.h @@ -14,54 +14,55 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesAPI_swig_H_ #define FeaturesAPI_swig_H_ - #include +#include - #include "FeaturesAPI.h" - #include "FeaturesAPI_BooleanCut.h" - #include "FeaturesAPI_BooleanFuse.h" - #include "FeaturesAPI_BooleanCommon.h" - #include "FeaturesAPI_BooleanSmash.h" - #include "FeaturesAPI_BooleanFill.h" - #include "FeaturesAPI_Chamfer.h" - #include "FeaturesAPI_Defeaturing.h" - #include "FeaturesAPI_Extrusion.h" - #include "FeaturesAPI_ExtrusionBoolean.h" - #include "FeaturesAPI_Fillet.h" - #include "FeaturesAPI_Intersection.h" - #include "FeaturesAPI_Measurement.h" - #include "FeaturesAPI_NormalToFace.h" - #include "FeaturesAPI_MultiRotation.h" - #include "FeaturesAPI_MultiTranslation.h" - #include "FeaturesAPI_Partition.h" - #include "FeaturesAPI_Pipe.h" - #include "FeaturesAPI_Loft.h" - #include "FeaturesAPI_Placement.h" - #include "FeaturesAPI_PointCloudOnFace.h" - #include "FeaturesAPI_Recover.h" - #include "FeaturesAPI_RemoveSubShapes.h" - #include "FeaturesAPI_Revolution.h" - #include "FeaturesAPI_RevolutionBoolean.h" - #include "FeaturesAPI_Rotation.h" - #include "FeaturesAPI_Scale.h" - #include "FeaturesAPI_Sewing.h" - #include "FeaturesAPI_Symmetry.h" - #include "FeaturesAPI_Translation.h" - #include "FeaturesAPI_Union.h" - #include "FeaturesAPI_FusionFaces.h" - #include "FeaturesAPI_GlueFaces.h" - #include "FeaturesAPI_RemoveResults.h" - #include "FeaturesAPI_Copy.h" - #include "FeaturesAPI_ImportResult.h" - #include "FeaturesAPI_PointCoordinates.h" - #include "FeaturesAPI_GeometryCalculation.h" - #include "FeaturesAPI_BoundingBox.h" - #include "FeaturesAPI_LimitTolerance.h" - #include "FeaturesAPI_SharedFaces.h" +#include "FeaturesAPI.h" +#include "FeaturesAPI_BooleanCommon.h" +#include "FeaturesAPI_BooleanCut.h" +#include "FeaturesAPI_BooleanFill.h" +#include "FeaturesAPI_BooleanFuse.h" +#include "FeaturesAPI_BooleanSmash.h" +#include "FeaturesAPI_BoundingBox.h" +#include "FeaturesAPI_Chamfer.h" +#include "FeaturesAPI_Copy.h" +#include "FeaturesAPI_Defeaturing.h" +#include "FeaturesAPI_Extrusion.h" +#include "FeaturesAPI_ExtrusionBoolean.h" +#include "FeaturesAPI_Fillet.h" +#include "FeaturesAPI_FusionFaces.h" +#include "FeaturesAPI_GeometryCalculation.h" +#include "FeaturesAPI_GlueFaces.h" +#include "FeaturesAPI_ImportResult.h" +#include "FeaturesAPI_Intersection.h" +#include "FeaturesAPI_LimitTolerance.h" +#include "FeaturesAPI_Loft.h" +#include "FeaturesAPI_Measurement.h" +#include "FeaturesAPI_MultiRotation.h" +#include "FeaturesAPI_MultiTranslation.h" +#include "FeaturesAPI_NormalToFace.h" +#include "FeaturesAPI_Partition.h" +#include "FeaturesAPI_Pipe.h" +#include "FeaturesAPI_Placement.h" +#include "FeaturesAPI_PointCloudOnFace.h" +#include "FeaturesAPI_PointCoordinates.h" +#include "FeaturesAPI_Recover.h" +#include "FeaturesAPI_RemoveResults.h" +#include "FeaturesAPI_RemoveSubShapes.h" +#include "FeaturesAPI_Revolution.h" +#include "FeaturesAPI_RevolutionBoolean.h" +#include "FeaturesAPI_Rotation.h" +#include "FeaturesAPI_Scale.h" +#include "FeaturesAPI_Sewing.h" +#include "FeaturesAPI_SharedFaces.h" +#include "FeaturesAPI_Symmetry.h" +#include "FeaturesAPI_Translation.h" +#include "FeaturesAPI_Union.h" #endif // FeaturesAPI_swig_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin.h b/src/FeaturesPlugin/FeaturesPlugin.h index 554ba4524..422fe6bbd 100644 --- a/src/FeaturesPlugin/FeaturesPlugin.h +++ b/src/FeaturesPlugin/FeaturesPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_H @@ -22,13 +23,13 @@ #if defined FEATURESPLUGIN_EXPORTS #if defined WIN32 -#define FEATURESPLUGIN_EXPORT __declspec( dllexport ) +#define FEATURESPLUGIN_EXPORT __declspec(dllexport) #else #define FEATURESPLUGIN_EXPORT #endif #else #if defined WIN32 -#define FEATURESPLUGIN_EXPORT __declspec( dllimport ) +#define FEATURESPLUGIN_EXPORT __declspec(dllimport) #else #define FEATURESPLUGIN_EXPORT #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 86af611e6..fdc44461e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -14,23 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Boolean.h" -#include -#include #include #include -#include #include -#include +#include #include +#include +#include +#include #include -#include #include +#include +#include +#include +#include #include #include #include @@ -40,105 +44,100 @@ #include #include #include -#include -#include -#include #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================= -FeaturesPlugin_Boolean::FeaturesPlugin_Boolean(const OperationType theOperationType) -: myOperationType(theOperationType) -{ -} +FeaturesPlugin_Boolean::FeaturesPlugin_Boolean( + const OperationType theOperationType) + : myOperationType(theOperationType) {} //================================================================================================= -void FeaturesPlugin_Boolean::initAttributes() -{ - data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(FeaturesPlugin_Boolean::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - - data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(FeaturesPlugin_Boolean::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. +void FeaturesPlugin_Boolean::initAttributes() { + data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(FeaturesPlugin_Boolean::TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + + data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(FeaturesPlugin_Boolean::FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble::typeId()); + boolean(USE_FUZZY_ID()) + ->setValue(false); // Do NOT use the fuzzy parameter by default. real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_LIST_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), OBJECT_LIST_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + TOOL_LIST_ID()); } //================================================================================================= -FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType() -{ +FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType() { return myOperationType; } //================================================================================================= -void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr theResultBody, - const std::shared_ptr theBaseShape, - const ListOfShape& theTools, - const std::shared_ptr theResultShape, - const GeomMakeShapePtr& theMakeShape) -{ - //load result - if(theBaseShape->isEqual(theResultShape)) { +void FeaturesPlugin_Boolean::loadNamingDS( + std::shared_ptr theResultBody, + const std::shared_ptr theBaseShape, + const ListOfShape &theTools, + const std::shared_ptr theResultShape, + const GeomMakeShapePtr &theMakeShape) { + // load result + if (theBaseShape->isEqual(theResultShape)) { theResultBody->store(theResultShape, false); return; } theResultBody->storeModified(theBaseShape, theResultShape); - theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE); - theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE); + theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::EDGE); + theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::FACE); - theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE); + theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::FACE); for (ListOfShape::const_iterator anIter = theTools.begin(); - anIter != theTools.end(); - ++anIter) - { + anIter != theTools.end(); ++anIter) { GeomAPI_Shape::ShapeType aShapeType = - (*anIter)->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE - : GeomAPI_Shape::EDGE; + (*anIter)->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE + : GeomAPI_Shape::EDGE; theResultBody->loadModifiedShapes(theMakeShape, *anIter, aShapeType); - theResultBody->loadDeletedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE); + theResultBody->loadDeletedShapes(theMakeShape, *anIter, + GeomAPI_Shape::FACE); } } //================================================================================================= void FeaturesPlugin_Boolean::storeResult( - const ListOfShape& theObjects, - const ListOfShape& theTools, - const GeomShapePtr theResultShape, - int& theResultIndex, + const ListOfShape &theObjects, const ListOfShape &theTools, + const GeomShapePtr theResultShape, int &theResultIndex, std::shared_ptr theMakeShapeList, - std::vector& theResultBaseAlgoList) -{ + std::vector &theResultBaseAlgoList) { if (!theResultShape) return; std::shared_ptr aResultBody = document()->createBody(data(), theResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, - theObjects, - theTools, - theMakeShapeList, - theResultShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, theObjects, theTools, + theMakeShapeList, theResultShape); setResult(aResultBody, theResultIndex++); // merge algorithms ModelAPI_Tools::ResultBaseAlgo aRBA; aRBA.resultBody = aResultBody; aRBA.baseShape = theObjects.front(); - for (std::vector::iterator - aRBAIt = theResultBaseAlgoList.begin(); + for (std::vector::iterator aRBAIt = + theResultBaseAlgoList.begin(); aRBAIt != theResultBaseAlgoList.end(); ++aRBAIt) { theMakeShapeList->appendAlgo(aRBAIt->makeShape); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h index e1a32b240..a3074732f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Boolean_H_ @@ -26,8 +27,7 @@ /// \ingroup Plugins /// \brief Feature for applying of Boolean operations on Solids. /// Supports four kinds of Boolean operations: Cut, Fuse, Common and Smash. -class FeaturesPlugin_Boolean : public FeaturesPlugin_VersionedBoolean -{ +class FeaturesPlugin_Boolean : public FeaturesPlugin_VersionedBoolean { public: enum OperationType { BOOL_CUT, @@ -38,29 +38,25 @@ public: }; /// Attribute name of main objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } /// Attribute name of tool objects. - inline static const std::string& TOOL_LIST_ID() - { + inline static const std::string &TOOL_LIST_ID() { static const std::string MY_TOOL_LIST_ID("tool_objects"); return MY_TOOL_LIST_ID; } /// Attribute name of use fuzzy parameter. - inline static const std::string& USE_FUZZY_ID() - { + inline static const std::string &USE_FUZZY_ID() { static const std::string MY_USE_FUZZY_ID("use_fuzzy"); return MY_USE_FUZZY_ID; } /// Attribute name of fuzzy parameter. - inline static const std::string& FUZZY_PARAM_ID() - { + inline static const std::string &FUZZY_PARAM_ID() { static const std::string MY_FUZZY_PARAM_ID("fuzzy_param"); return MY_FUZZY_PARAM_ID; } @@ -68,28 +64,27 @@ public: /// \return boolean operation type. FEATURESPLUGIN_EXPORT OperationType operationType(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); protected: - /// Use plugin manager for features creation. FeaturesPlugin_Boolean(const OperationType theOperationType); /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theResultBody, const std::shared_ptr theBaseShape, - const ListOfShape& theTools, + const ListOfShape &theTools, const std::shared_ptr theResultShape, - const GeomMakeShapePtr& theMakeShape); + const GeomMakeShapePtr &theMakeShape); /// Store result shape if it is not empty and increase results counter - void storeResult(const ListOfShape& theObjects, - const ListOfShape& theTools, - const GeomShapePtr theResultShape, - int& theResultIndex, - std::shared_ptr theMakeShapeList, - std::vector& theResultBaseAlgoList); + void storeResult( + const ListOfShape &theObjects, const ListOfShape &theTools, + const GeomShapePtr theResultShape, int &theResultIndex, + std::shared_ptr theMakeShapeList, + std::vector &theResultBaseAlgoList); private: OperationType myOperationType; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp index b33bd7790..6fa2beb88 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp @@ -14,69 +14,68 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BooleanCommon.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 - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesPlugin_BooleanCommon::FeaturesPlugin_BooleanCommon() -: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_COMMON) -{ -} + : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_COMMON) {} //================================================================================================== -void FeaturesPlugin_BooleanCommon::initAttributes() -{ +void FeaturesPlugin_BooleanCommon::initAttributes() { data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + boolean(USE_FUZZY_ID()) + ->setValue(false); // Do NOT use the fuzzy parameter by default. real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); - initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); + initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), + selectionList(TOOL_LIST_ID())); } //================================================================================================== -void FeaturesPlugin_BooleanCommon::execute() -{ +void FeaturesPlugin_BooleanCommon::execute() { ListOfShape aPlanes; GeomAPI_ShapeHierarchy anObjects, aTools; bool isSimpleMode = false; AttributeStringPtr aCreationMethodAttr = string(CREATION_METHOD()); - if (aCreationMethodAttr.get() - && aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE()) { + if (aCreationMethodAttr.get() && + aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE()) { isSimpleMode = true; } @@ -87,19 +86,21 @@ void FeaturesPlugin_BooleanCommon::execute() aPlanes.clear(); // Getting tools. - if (!isSimpleMode && - !processAttribute(TOOL_LIST_ID(), aTools, aPlanes)) + if (!isSimpleMode && !processAttribute(TOOL_LIST_ID(), aTools, aPlanes)) return; - if (anObjects.empty() || (!isSimpleMode && aTools.empty() && aPlanes.empty())) { - std::string aFeatureError = "Error: Not enough objects for boolean operation."; + if (anObjects.empty() || + (!isSimpleMode && aTools.empty() && aPlanes.empty())) { + std::string aFeatureError = + "Error: Not enough objects for boolean operation."; setError(aFeatureError); return; } // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); @@ -110,7 +111,8 @@ void FeaturesPlugin_BooleanCommon::execute() GeomShapePtr aResultCompound; std::string anError; - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; @@ -118,13 +120,11 @@ void FeaturesPlugin_BooleanCommon::execute() GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); GeomShapePtr aShape = *anObjectsIt; for (++anObjectsIt; anObjectsIt != anObjects.end(); ++anObjectsIt) { - std::shared_ptr aCommonAlgo( - new GeomAlgoAPI_Boolean(aShape, - *anObjectsIt, - GeomAlgoAPI_Tools::BOOL_COMMON, - aFuzzy)); + std::shared_ptr aCommonAlgo(new GeomAlgoAPI_Boolean( + aShape, *anObjectsIt, GeomAlgoAPI_Tools::BOOL_COMMON, aFuzzy)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, + getKind(), anError)) { setError(anError); return; } @@ -136,21 +136,19 @@ void FeaturesPlugin_BooleanCommon::execute() if (aCommonVersion == BOP_VERSION_9_4()) { // merge hierarchies of compounds containing objects and tools // and append the result of the FUSE operation - aShape = keepUnusedSubsOfCompound(aShape, anObjects, aTools, aMakeShapeList); + aShape = + keepUnusedSubsOfCompound(aShape, anObjects, aTools, aMakeShapeList); } GeomAPI_ShapeIterator aShapeIt(aShape); if (aShapeIt.more() || aShape->shapeType() == GeomAPI_Shape::VERTEX) { std::shared_ptr aResultBody = - document()->createBody(data(), aResultIndex); + document()->createBody(data(), aResultIndex); ListOfShape anObjectList = anObjects.objects(); ListOfShape aToolsList; - ModelAPI_Tools::loadModifiedShapes(aResultBody, - anObjectList, - aToolsList, - aMakeShapeList, - aShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anObjectList, aToolsList, + aMakeShapeList, aShape); GeomShapePtr aBaseShape = anObjectList.front(); anObjectList.pop_front(); setResult(aResultBody, aResultIndex); @@ -167,15 +165,13 @@ void FeaturesPlugin_BooleanCommon::execute() } else { if (aCommonVersion == BOP_VERSION_9_4()) { // merge hierarchies of compounds containing objects and tools - aResultCompound = - keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList); + aResultCompound = keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, + aTools, aMakeShapeList); } bool isOk = true; for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end() && isOk; - ++anObjectsIt) - { + anObjectsIt != anObjects.end() && isOk; ++anObjectsIt) { GeomShapePtr anObject = *anObjectsIt; GeomShapePtr aParent = anObjects.parent(anObject); @@ -183,40 +179,36 @@ void FeaturesPlugin_BooleanCommon::execute() GeomAPI_Shape::ShapeType aShapeType = aParent->shapeType(); if (aShapeType == GeomAPI_Shape::COMPOUND) { // Compound handling - isOk = processCompound(GeomAlgoAPI_Tools::BOOL_COMMON, - anObjects, aParent, aTools.objects(), - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, - aResultCompound); - } - else if (aShapeType == GeomAPI_Shape::COMPSOLID) { + isOk = processCompound(GeomAlgoAPI_Tools::BOOL_COMMON, anObjects, + aParent, aTools.objects(), aFuzzy, + aResultIndex, aResultBaseAlgoList, + aResultShapesList, aResultCompound); + } else if (aShapeType == GeomAPI_Shape::COMPSOLID) { // Compsolid handling - isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_COMMON, - anObjects, aParent, aTools.objects(), ListOfShape(), - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, - aResultCompound); + isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_COMMON, anObjects, + aParent, aTools.objects(), ListOfShape(), + aFuzzy, aResultIndex, aResultBaseAlgoList, + aResultShapesList, aResultCompound); } } else { // process object as is - isOk = processObject(GeomAlgoAPI_Tools::BOOL_COMMON, - anObject, aTools.objects(), aPlanes, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, + isOk = processObject(GeomAlgoAPI_Tools::BOOL_COMMON, anObject, + aTools.objects(), aPlanes, aFuzzy, aResultIndex, + aResultBaseAlgoList, aResultShapesList, aResultCompound); } } - storeResult(anObjects.objects(), aTools.objects(), aResultCompound, aResultIndex, - aMakeShapeList, aResultBaseAlgoList); + storeResult(anObjects.objects(), aTools.objects(), aResultCompound, + aResultIndex, aMakeShapeList, aResultBaseAlgoList); } - // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one - // result shape has been deleted, but in another it was modified or stayed. + // Store deleted shapes after all results has been proceeded. This is to avoid + // issue when in one result shape has been deleted, but in another it was + // modified or stayed. if (!aResultCompound) aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); - ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, - aTools.objects(), + ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools.objects(), aResultCompound); // remove the rest results if there were produced in the previous pass diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h index 453dda311..68cb5b9a6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BooleanCommon_H_ @@ -27,53 +28,46 @@ /// \class FeaturesPlugin_BooleanCommon /// \ingroup Plugins /// \brief Feature for applying of Boolean Common operation. -class FeaturesPlugin_BooleanCommon : public FeaturesPlugin_Boolean -{ +class FeaturesPlugin_BooleanCommon : public FeaturesPlugin_Boolean { public: - /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Common"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_BooleanCommon::ID(); return MY_KIND; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("creation_method"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_SIMPLE() - { + inline static const std::string &CREATION_METHOD_SIMPLE() { static const std::string MY_CREATION_METHOD_ID("simple"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_ADVANCED() - { + inline static const std::string &CREATION_METHOD_ADVANCED() { static const std::string MY_CREATION_METHOD_ID("advanced"); return MY_CREATION_METHOD_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: - /// Use plugin manager for features creation. FeaturesPlugin_BooleanCommon(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp index c4b68c44e..33695bd8e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BooleanCut.h" -#include #include #include #include +#include #include #include @@ -35,20 +36,16 @@ #include #include - -static const ListOfShape ExplodeCompounds(const ListOfShape &aList) -{ +static const ListOfShape ExplodeCompounds(const ListOfShape &aList) { ListOfShape subShapes; - for (auto shp = aList.cbegin(); shp != aList.cend(); ++shp) - { + for (auto shp = aList.cbegin(); shp != aList.cend(); ++shp) { if ((*shp).get() && (*shp)->isCompound()) { // Use all sub shapes of the compound for (GeomAPI_ShapeIterator anExp(*shp); anExp.more(); anExp.next()) { GeomShapePtr aCurrent = anExp.current(); subShapes.push_back(aCurrent); } - } - else + } else subShapes.push_back(*shp); } @@ -57,20 +54,17 @@ static const ListOfShape ExplodeCompounds(const ListOfShape &aList) //================================================================================================== FeaturesPlugin_BooleanCut::FeaturesPlugin_BooleanCut() -: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_CUT) -{ -} + : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_CUT) {} //================================================================================================== -void FeaturesPlugin_BooleanCut::initAttributes() -{ +void FeaturesPlugin_BooleanCut::initAttributes() { FeaturesPlugin_Boolean::initAttributes(); - initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); + initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), + selectionList(TOOL_LIST_ID())); } //================================================================================================== -void FeaturesPlugin_BooleanCut::execute() -{ +void FeaturesPlugin_BooleanCut::execute() { GeomAPI_ShapeHierarchy anObjects, aTools; ListOfShape aPlanes; @@ -81,8 +75,9 @@ void FeaturesPlugin_BooleanCut::execute() int aResultIndex = 0; - if(anObjects.empty() || aTools.empty()) { - std::string aFeatureError = "Error: Not enough objects for boolean operation."; + if (anObjects.empty() || aTools.empty()) { + std::string aFeatureError = + "Error: Not enough objects for boolean operation."; setError(aFeatureError); return; } @@ -91,29 +86,31 @@ void FeaturesPlugin_BooleanCut::execute() ListOfShape aResultShapesList; std::string anError; - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); GeomShapePtr aResultCompound; if (data()->version() == BOP_VERSION_9_4()) { // merge hierarchies of compounds containing objects and tools - aResultCompound = - keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList); + aResultCompound = keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, + aTools, aMakeShapeList); } // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); - // When selecting a compound tool object, use its exploded subshapes as tool object instead. + // When selecting a compound tool object, use its exploded subshapes as tool + // object instead. const ListOfShape aToolList = ExplodeCompounds(aTools.objects()); // For solids cut each object with all tools. bool isOk = true; for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end() && isOk; - ++anObjectsIt) { + anObjectsIt != anObjects.end() && isOk; ++anObjectsIt) { GeomShapePtr anObject = *anObjectsIt; GeomShapePtr aParent = anObjects.parent(anObject); @@ -121,39 +118,34 @@ void FeaturesPlugin_BooleanCut::execute() GeomAPI_Shape::ShapeType aShapeType = aParent->shapeType(); if (aShapeType == GeomAPI_Shape::COMPOUND) { // Compound handling - isOk = processCompound(GeomAlgoAPI_Tools::BOOL_CUT, - anObjects, aParent, aToolList, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, + isOk = processCompound(GeomAlgoAPI_Tools::BOOL_CUT, anObjects, aParent, + aToolList, aFuzzy, aResultIndex, + aResultBaseAlgoList, aResultShapesList, aResultCompound); - } - else if (aShapeType == GeomAPI_Shape::COMPSOLID) { + } else if (aShapeType == GeomAPI_Shape::COMPSOLID) { // Compsolid handling - isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_CUT, - anObjects, aParent, aToolList, ListOfShape(), - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, + isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_CUT, anObjects, aParent, + aToolList, ListOfShape(), aFuzzy, aResultIndex, + aResultBaseAlgoList, aResultShapesList, aResultCompound); } } else { // process object as is - isOk = processObject(GeomAlgoAPI_Tools::BOOL_CUT, - anObject, aToolList, aPlanes, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, - aResultCompound); + isOk = processObject(GeomAlgoAPI_Tools::BOOL_CUT, anObject, aToolList, + aPlanes, aFuzzy, aResultIndex, aResultBaseAlgoList, + aResultShapesList, aResultCompound); } } storeResult(anObjects.objects(), aToolList, aResultCompound, aResultIndex, aMakeShapeList, aResultBaseAlgoList); - // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one - // result shape has been deleted, but in another it was modified or stayed. + // Store deleted shapes after all results has been proceeded. This is to avoid + // issue when in one result shape has been deleted, but in another it was + // modified or stayed. if (!aResultCompound) aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); - ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, - aToolList, + ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, aToolList, aResultCompound); // remove the rest results if there were produced in the previous pass diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h index 7d0bac56c..9180f36de 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BooleanCut_H_ @@ -28,35 +29,30 @@ /// \class FeaturesPlugin_BooleanCut /// \ingroup Plugins /// \brief Feature for applying of Boolean Cut operation. -class FeaturesPlugin_BooleanCut: public FeaturesPlugin_Boolean -{ +class FeaturesPlugin_BooleanCut : public FeaturesPlugin_Boolean { public: - /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Cut"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_BooleanCut::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: - /// Use plugin manager for features creation. FeaturesPlugin_BooleanCut(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp index 755893497..695893e90 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BooleanFill.h" -#include #include #include #include +#include #include #include @@ -41,23 +42,19 @@ #include #include - //================================================================================================= FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill() - : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL) -{ -} + : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL) {} //================================================================================================= -void FeaturesPlugin_BooleanFill::initAttributes() -{ +void FeaturesPlugin_BooleanFill::initAttributes() { FeaturesPlugin_Boolean::initAttributes(); - initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); + initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), + selectionList(TOOL_LIST_ID())); } //================================================================================================= -void FeaturesPlugin_BooleanFill::execute() -{ +void FeaturesPlugin_BooleanFill::execute() { std::string anError; GeomAPI_ShapeHierarchy anObjects, aTools; ListOfShape aPlanes; @@ -75,7 +72,8 @@ void FeaturesPlugin_BooleanFill::execute() int aResultIndex = 0; if (anObjects.empty() || (aTools.empty() && aPlanes.empty())) { - std::string aFeatureError = "Error: Not enough objects for boolean operation."; + std::string aFeatureError = + "Error: Not enough objects for boolean operation."; setError(aFeatureError); return; } @@ -83,26 +81,27 @@ void FeaturesPlugin_BooleanFill::execute() std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); GeomShapePtr aResultCompound; if (data()->version() == BOP_VERSION_9_4()) { // merge hierarchies of compounds containing objects and tools - aResultCompound = - keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList); + aResultCompound = keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, + aTools, aMakeShapeList); } // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); // For solids cut each object with all tools. bool isOk = true; for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end() && isOk; - ++anObjectsIt) { + anObjectsIt != anObjects.end() && isOk; ++anObjectsIt) { GeomShapePtr anObject = *anObjectsIt; GeomShapePtr aParent = anObjects.parent(anObject, false); @@ -110,30 +109,28 @@ void FeaturesPlugin_BooleanFill::execute() // get parent once again to mark it and the subs as processed aParent = anObjects.parent(anObject); // compsolid handling - isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_PARTITION, - anObjects, aParent, aTools.objects(), aPlanes, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, - aResultCompound); + isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_PARTITION, anObjects, + aParent, aTools.objects(), aPlanes, aFuzzy, + aResultIndex, aResultBaseAlgoList, + aResultShapesList, aResultCompound); } else { // process object as is - isOk = processObject(GeomAlgoAPI_Tools::BOOL_PARTITION, - anObject, aTools.objects(), aPlanes, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, + isOk = processObject(GeomAlgoAPI_Tools::BOOL_PARTITION, anObject, + aTools.objects(), aPlanes, aFuzzy, aResultIndex, + aResultBaseAlgoList, aResultShapesList, aResultCompound); } } - storeResult(anObjects.objects(), aTools.objects(), aResultCompound, aResultIndex, - aMakeShapeList, aResultBaseAlgoList); + storeResult(anObjects.objects(), aTools.objects(), aResultCompound, + aResultIndex, aMakeShapeList, aResultBaseAlgoList); - // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one - // result shape has been deleted, but in another it was modified or stayed. + // Store deleted shapes after all results has been proceeded. This is to avoid + // issue when in one result shape has been deleted, but in another it was + // modified or stayed. if (!aResultCompound) aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); - ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, - aTools.objects(), + ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools.objects(), aResultCompound); // remove the rest results if there were produced in the previous pass diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h index faa355611..f483f9ca7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BooleanFill_H_ @@ -25,35 +26,30 @@ /// \class FeaturesPlugin_BooleanFill /// \ingroup Plugins /// \brief Feature for applying of Boolean Fill operation. -class FeaturesPlugin_BooleanFill : public FeaturesPlugin_Boolean -{ +class FeaturesPlugin_BooleanFill : public FeaturesPlugin_Boolean { public: - /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Split"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_BooleanFill::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: - - /// Use plugin manager for features creation. + /// Use plugin manager for features creation. FeaturesPlugin_BooleanFill(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp index 6b19e7e5c..2dd93d5bb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BooleanFuse.h" -#include #include #include #include #include #include +#include #include #include #include @@ -40,13 +41,11 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== -static void explodeCompound(const GeomShapePtr& theShape, ListOfShape& theResult) -{ +static void explodeCompound(const GeomShapePtr &theShape, + ListOfShape &theResult) { if (theShape->shapeType() == GeomAPI_Shape::COMPOUND) { GeomAPI_ShapeIterator it(theShape); for (; it.more(); it.next()) @@ -55,52 +54,54 @@ static void explodeCompound(const GeomShapePtr& theShape, ListOfShape& theResult theResult.push_back(theShape); } -static void collectSolids(const ListOfShape& theShapes, ListOfShape& theResult) -{ - for (ListOfShape::const_iterator it = theShapes.begin(); it != theShapes.end(); ++it) +static void collectSolids(const ListOfShape &theShapes, + ListOfShape &theResult) { + for (ListOfShape::const_iterator it = theShapes.begin(); + it != theShapes.end(); ++it) explodeCompound(*it, theResult); } //================================================================================================== FeaturesPlugin_BooleanFuse::FeaturesPlugin_BooleanFuse() -: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FUSE) -{ -} + : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FUSE) {} //================================================================================================== -void FeaturesPlugin_BooleanFuse::initAttributes() -{ - AttributeStringPtr aMethodAttr = std::dynamic_pointer_cast - (data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId())); // #1 +void FeaturesPlugin_BooleanFuse::initAttributes() { + AttributeStringPtr aMethodAttr = + std::dynamic_pointer_cast(data()->addAttribute( + CREATION_METHOD(), ModelAPI_AttributeString::typeId())); // #1 - data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); // #2 - data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); // #3 + data()->addAttribute(OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); // #2 + data()->addAttribute(TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); // #3 data()->addAttribute(REMOVE_INTERSECTION_EDGES_ID(), ModelAPI_AttributeBoolean::typeId()); // #4 ??? AttributeBooleanPtr aUseFuzzyAttr; // #5 ??? - AttributeDoublePtr aValFuzzyAttr; // #6 ??? + AttributeDoublePtr aValFuzzyAttr; // #6 ??? bool badOrder = false; if (aMethodAttr->isInitialized()) { // restoring data from saved study // It is a fix for 37570 Tuleap issue. - // We could have studies with aValFuzzyAttr at the 5th position instead of expected 6th. + // We could have studies with aValFuzzyAttr at the 5th position instead of + // expected 6th. // Fuzzy value (check, is it present at 5th label) - aValFuzzyAttr = std::dynamic_pointer_cast - (data()->addAttribute(FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble::typeId())); // #5 + aValFuzzyAttr = std::dynamic_pointer_cast( + data()->addAttribute(FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble::typeId())); // #5 if (aValFuzzyAttr->isInitialized()) { badOrder = true; // bad order of attributes in saved study // 4 - is fuzzy // 5 - fuzzy value // 6 - remove edges - aUseFuzzyAttr = std::dynamic_pointer_cast - (data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean::typeId(), - 4)); // #4 + aUseFuzzyAttr = std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean::typeId(), + 4)); // #4 data()->addAttribute(REMOVE_INTERSECTION_EDGES_ID(), ModelAPI_AttributeBoolean::typeId(), 6); // #6 @@ -114,31 +115,34 @@ void FeaturesPlugin_BooleanFuse::initAttributes() // 6 - fuzzy value // Is fuzzy value - aUseFuzzyAttr = std::dynamic_pointer_cast - (data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), - ModelAPI_AttributeBoolean::typeId(), - 5)); // #5 + aUseFuzzyAttr = std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean::typeId(), + 5)); // #5 // Fuzzy value - aValFuzzyAttr = std::dynamic_pointer_cast - (data()->addAttribute(FUZZY_PARAM_ID(), - ModelAPI_AttributeDouble::typeId(), - 6)); // #6 + aValFuzzyAttr = std::dynamic_pointer_cast( + data()->addAttribute(FUZZY_PARAM_ID(), + ModelAPI_AttributeDouble::typeId(), + 6)); // #6 } if (!aUseFuzzyAttr->isInitialized()) - aUseFuzzyAttr->setValue(false); // Do NOT use the fuzzy parameter by default. + aUseFuzzyAttr->setValue( + false); // Do NOT use the fuzzy parameter by default. if (!aValFuzzyAttr->isInitialized()) aValFuzzyAttr->setValue(DEFAULT_FUZZY); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_LIST_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), OBJECT_LIST_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + TOOL_LIST_ID()); - initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); + initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), + selectionList(TOOL_LIST_ID())); } //================================================================================================== -void FeaturesPlugin_BooleanFuse::execute() -{ +void FeaturesPlugin_BooleanFuse::execute() { std::string anError; GeomAPI_ShapeHierarchy anObjectsHierarchy, aToolsHierarchy; ListOfShape aPlanes; @@ -146,9 +150,8 @@ void FeaturesPlugin_BooleanFuse::execute() bool isSimpleCreation = false; AttributeStringPtr aCreationMethodAttr = string(CREATION_METHOD()); - if (aCreationMethodAttr.get() - && aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE()) - { + if (aCreationMethodAttr.get() && + aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE()) { isSimpleCreation = true; } @@ -165,18 +168,20 @@ void FeaturesPlugin_BooleanFuse::execute() // all objects except edges and faces anObjectsHierarchy.objectsByType(anEdgesAndFaces, anObjects, GeomAPI_Shape::FACE, GeomAPI_Shape::EDGE); - aToolsHierarchy.objectsByType(anEdgesAndFaces, aTools, - GeomAPI_Shape::FACE, GeomAPI_Shape::EDGE); + aToolsHierarchy.objectsByType(anEdgesAndFaces, aTools, GeomAPI_Shape::FACE, + GeomAPI_Shape::EDGE); if ((anObjects.size() + aTools.size() + anEdgesAndFaces.size()) < 2) { - std::string aFeatureError = "Error: Not enough objects for boolean operation."; + std::string aFeatureError = + "Error: Not enough objects for boolean operation."; setError(aFeatureError); return; } // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); @@ -184,10 +189,10 @@ void FeaturesPlugin_BooleanFuse::execute() const std::string aFuseVersion = data()->version(); // Collecting all solids which will be fused. - // We explode the top-level compounds here because of issue #19931. It performs Fuse operation - // on a set of compounds, one of which is treated as self-intersected. - // But this problem is eliminated after the exploding, because in this case, - // the shapes are intersected, but not self-intersected. + // We explode the top-level compounds here because of issue #19931. It + // performs Fuse operation on a set of compounds, one of which is treated as + // self-intersected. But this problem is eliminated after the exploding, + // because in this case, the shapes are intersected, but not self-intersected. ListOfShape aSolidsToFuse; collectSolids(anObjects, aSolidsToFuse); collectSolids(aTools, aSolidsToFuse); @@ -196,9 +201,11 @@ void FeaturesPlugin_BooleanFuse::execute() // in boolean operation and will be added to result. bool isProcessCompsolid = !isSimpleCreation || !aFuseVersion.empty(); ListOfShape aShapesToAdd; - int aNbCompsolids = 0; // number of compsolids, which subs is taken into operation + int aNbCompsolids = + 0; // number of compsolids, which subs is taken into operation bool hasSeparateSolids = false; // are solids or full results exist - for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjectsHierarchy.begin(); + for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = + anObjectsHierarchy.begin(); isProcessCompsolid && anObjectsIt != anObjectsHierarchy.end(); ++anObjectsIt) { GeomShapePtr anObject = *anObjectsIt; @@ -212,21 +219,23 @@ void FeaturesPlugin_BooleanFuse::execute() ListOfShape aUsed, aNotUsed; anObjectsHierarchy.splitCompound(aParent, aUsed, aNotUsed); aShapesToAdd.insert(aShapesToAdd.end(), aNotUsed.begin(), aNotUsed.end()); - } - else + } else hasSeparateSolids = true; } bool isSingleCompsolid = aNbCompsolids == 1 && !hasSeparateSolids; ListOfShape anOriginalShapes = aSolidsToFuse; - anOriginalShapes.insert(anOriginalShapes.end(), aShapesToAdd.begin(), aShapesToAdd.end()); + anOriginalShapes.insert(anOriginalShapes.end(), aShapesToAdd.begin(), + aShapesToAdd.end()); // Cut edges and faces(if we have any) with solids. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); GeomShapePtr aCuttedEdgesAndFaces; if (!anEdgesAndFaces.empty()) { - std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces, - anOriginalShapes, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); + std::shared_ptr aCutAlgo( + new GeomAlgoAPI_Boolean(anEdgesAndFaces, anOriginalShapes, + GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); if (aCutAlgo->isDone()) { aCuttedEdgesAndFaces = aCutAlgo->shape(); aMakeShapeList->appendAlgo(aCutAlgo); @@ -241,12 +250,12 @@ void FeaturesPlugin_BooleanFuse::execute() // If we have compsolids then cut with not used solids all others. if (!aShapesToAdd.empty() && !isSingleCompsolid) { aSolidsToFuse.clear(); - for (ListOfShape::iterator - anIt = anOriginalShapes.begin(); anIt != anOriginalShapes.end(); anIt++) { + for (ListOfShape::iterator anIt = anOriginalShapes.begin(); + anIt != anOriginalShapes.end(); anIt++) { ListOfShape aOneObjectList; aOneObjectList.push_back(*anIt); - std::shared_ptr aCutAlgo( - new GeomAlgoAPI_Boolean(aOneObjectList, aShapesToAdd, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); + std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean( + aOneObjectList, aShapesToAdd, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); if (GeomAlgoAPI_ShapeTools::area(aCutAlgo->shape()) > 1.e-27) { aSolidsToFuse.push_back(aCutAlgo->shape()); @@ -269,13 +278,12 @@ void FeaturesPlugin_BooleanFuse::execute() } else if (anObjects.empty() && aTools.size() == 1) { aShape = aTools.front(); } else if ((anObjects.size() + aTools.size()) > 1) { - std::shared_ptr aFuseAlgo(new GeomAlgoAPI_Boolean(anObjects, - aTools, - GeomAlgoAPI_Tools::BOOL_FUSE, - aFuzzy)); + std::shared_ptr aFuseAlgo(new GeomAlgoAPI_Boolean( + anObjects, aTools, GeomAlgoAPI_Tools::BOOL_FUSE, aFuzzy)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFuseAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFuseAlgo, getKind(), + anError)) { setError(anError); return; } @@ -284,19 +292,22 @@ void FeaturesPlugin_BooleanFuse::execute() aMakeShapeList->appendAlgo(aFuseAlgo); } - // Combine result with not used solids from compsolid and edges and faces (if we have any). + // Combine result with not used solids from compsolid and edges and faces (if + // we have any). if (aCuttedEdgesAndFaces.get() && !aCuttedEdgesAndFaces->isNull()) { aShapesToAdd.push_back(aCuttedEdgesAndFaces); } else { - aShapesToAdd.insert(aShapesToAdd.end(), anEdgesAndFaces.begin(), anEdgesAndFaces.end()); + aShapesToAdd.insert(aShapesToAdd.end(), anEdgesAndFaces.begin(), + anEdgesAndFaces.end()); } if (!aShapesToAdd.empty()) { if (aShape.get()) { aShapesToAdd.push_back(aShape); } std::shared_ptr aFillerAlgo( - new GeomAlgoAPI_PaveFiller(aShapesToAdd, true, aFuzzy)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) { + new GeomAlgoAPI_PaveFiller(aShapesToAdd, true, aFuzzy)); + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), + anError)) { setError(anError); return; } @@ -313,9 +324,10 @@ void FeaturesPlugin_BooleanFuse::execute() if (isRemoveEdges) { std::shared_ptr aUnifyAlgo( - new GeomAlgoAPI_UnifySameDomain(aShape)); + new GeomAlgoAPI_UnifySameDomain(aShape)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aUnifyAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aUnifyAlgo, getKind(), + anError)) { setError(anError); return; } @@ -327,7 +339,8 @@ void FeaturesPlugin_BooleanFuse::execute() if (aFuseVersion == BOP_VERSION_9_4()) { // merge hierarchies of compounds containing objects and tools // and append the result of the FUSE operation - aShape = keepUnusedSubsOfCompound(aShape, anObjectsHierarchy, aToolsHierarchy, aMakeShapeList); + aShape = keepUnusedSubsOfCompound(aShape, anObjectsHierarchy, + aToolsHierarchy, aMakeShapeList); } int aResultIndex = 0; @@ -335,19 +348,13 @@ void FeaturesPlugin_BooleanFuse::execute() ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ListOfShape anEmptyTools; - ModelAPI_Tools::loadModifiedShapes(aResultBody, - anOriginalShapes, - anEmptyTools, - aMakeShapeList, - aShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + anEmptyTools, aMakeShapeList, aShape); setResult(aResultBody, aResultIndex); aResultIndex++; - ModelAPI_Tools::loadDeletedShapes(aResultBody, - GeomShapePtr(), - anOriginalShapes, - aMakeShapeList, - aShape); + ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), + anOriginalShapes, aMakeShapeList, aShape); // remove the rest results if there were produced in the previous pass removeResults(aResultIndex); diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h index ab9281969..de47261cf 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BooleanFuse_H_ @@ -25,74 +26,64 @@ /// \class FeaturesPlugin_BooleanFuse /// \ingroup Plugins /// \brief Feature for applying of Boolean Fuse operation. -class FeaturesPlugin_BooleanFuse : public FeaturesPlugin_Boolean -{ +class FeaturesPlugin_BooleanFuse : public FeaturesPlugin_Boolean { public: - /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Fuse"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_BooleanFuse::ID(); return MY_KIND; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("creation_method"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_SIMPLE() - { + inline static const std::string &CREATION_METHOD_SIMPLE() { static const std::string MY_CREATION_METHOD_ID("simple"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_ADVANCED() - { + inline static const std::string &CREATION_METHOD_ADVANCED() { static const std::string MY_CREATION_METHOD_ID("advanced"); return MY_CREATION_METHOD_ID; } /// Attribute name of main objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } /// Attribute name of tool objects. - inline static const std::string& TOOL_LIST_ID() - { + inline static const std::string &TOOL_LIST_ID() { static const std::string MY_TOOL_LIST_ID("tool_objects"); return MY_TOOL_LIST_ID; } /// Attribute name of remove edges option. - inline static const std::string& REMOVE_INTERSECTION_EDGES_ID() - { + inline static const std::string &REMOVE_INTERSECTION_EDGES_ID() { static const std::string MY_TOOL_LIST_ID("remove_intersection_edges"); return MY_TOOL_LIST_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: - /// Use plugin manager for features creation. FeaturesPlugin_BooleanFuse(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp index bffdf4fb0..4910dc56d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BooleanSmash.h" -#include #include #include #include +#include #include #include @@ -35,33 +36,31 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================== FeaturesPlugin_BooleanSmash::FeaturesPlugin_BooleanSmash() -: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_SMASH) -{ -} + : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_SMASH) {} //================================================================================================== -void FeaturesPlugin_BooleanSmash::initAttributes() -{ - data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); +void FeaturesPlugin_BooleanSmash::initAttributes() { + data()->addAttribute(OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(TOOL_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + boolean(USE_FUZZY_ID()) + ->setValue(false); // Do NOT use the fuzzy parameter by default. real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); - initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); + initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), + selectionList(TOOL_LIST_ID())); } //================================================================================================== -void FeaturesPlugin_BooleanSmash::execute() -{ +void FeaturesPlugin_BooleanSmash::execute() { std::string anError; GeomAPI_ShapeHierarchy anObjectsHistory, aToolsHistory; ListOfShape aPlanes; @@ -74,7 +73,8 @@ void FeaturesPlugin_BooleanSmash::execute() int aResultIndex = 0; if (anObjectsHistory.empty() || aToolsHistory.empty()) { - std::string aFeatureError = "Error: Not enough objects for boolean operation."; + std::string aFeatureError = + "Error: Not enough objects for boolean operation."; setError(aFeatureError); return; } @@ -84,7 +84,8 @@ void FeaturesPlugin_BooleanSmash::execute() // List of original shapes for naming. ListOfShape anOriginalShapes; - anOriginalShapes.insert(anOriginalShapes.end(), aShapesToSmash.begin(), aShapesToSmash.end()); + anOriginalShapes.insert(anOriginalShapes.end(), aShapesToSmash.begin(), + aShapesToSmash.end()); ListOfShape aTools = aToolsHistory.objects(); anOriginalShapes.insert(anOriginalShapes.end(), aTools.begin(), aTools.end()); @@ -92,9 +93,7 @@ void FeaturesPlugin_BooleanSmash::execute() // boolean operation and will be added to result. ListOfShape aShapesToAdd; for (GeomAPI_ShapeHierarchy::iterator anIt = anObjectsHistory.begin(); - anIt != anObjectsHistory.end(); - ++anIt) - { + anIt != anObjectsHistory.end(); ++anIt) { GeomShapePtr aParent = anObjectsHistory.parent(*anIt, false); if (aParent) { anOriginalShapes.push_back(aParent); @@ -104,27 +103,29 @@ void FeaturesPlugin_BooleanSmash::execute() aShapesToAdd.insert(aShapesToAdd.end(), aNotUsed.begin(), aNotUsed.end()); // add unused shapes of compounds/compsolids to the history, - // to avoid treating them as unused later when constructing a compound containing - // the result of Smash and all unused sub-shapes of multi-level compounds - for (ListOfShape::iterator aNUIt = aNotUsed.begin(); aNUIt != aNotUsed.end(); ++aNUIt) + // to avoid treating them as unused later when constructing a compound + // containing the result of Smash and all unused sub-shapes of multi-level + // compounds + for (ListOfShape::iterator aNUIt = aNotUsed.begin(); + aNUIt != aNotUsed.end(); ++aNUIt) anObjectsHistory.addObject(*aNUIt); } } // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); if (!aShapesToAdd.empty()) { // Cut objects with not used solids. std::shared_ptr anObjectsCutAlgo( - new GeomAlgoAPI_Boolean(aShapesToSmash, - aShapesToAdd, - GeomAlgoAPI_Tools::BOOL_CUT, - aFuzzy)); + new GeomAlgoAPI_Boolean(aShapesToSmash, aShapesToAdd, + GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); if (GeomAlgoAPI_ShapeTools::area(anObjectsCutAlgo->shape()) > 1.e-27) { aShapesToSmash.clear(); @@ -133,11 +134,8 @@ void FeaturesPlugin_BooleanSmash::execute() } // Cut tools with not used solids. - std::shared_ptr aToolsCutAlgo( - new GeomAlgoAPI_Boolean(aTools, - aShapesToAdd, - GeomAlgoAPI_Tools::BOOL_CUT, - aFuzzy)); + std::shared_ptr aToolsCutAlgo(new GeomAlgoAPI_Boolean( + aTools, aShapesToAdd, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); if (GeomAlgoAPI_ShapeTools::area(aToolsCutAlgo->shape()) > 1.e-27) { aTools.clear(); @@ -147,14 +145,12 @@ void FeaturesPlugin_BooleanSmash::execute() } // Cut objects with tools. - std::shared_ptr aBoolAlgo( - new GeomAlgoAPI_Boolean(aShapesToSmash, - aTools, - GeomAlgoAPI_Tools::BOOL_CUT, - aFuzzy)); + std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean( + aShapesToSmash, aTools, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), + anError)) { setError(anError); return; } @@ -171,11 +167,11 @@ void FeaturesPlugin_BooleanSmash::execute() if (aShapesToAdd.size() == 1) { aShape = aShapesToAdd.front(); - } - else { + } else { std::shared_ptr aFillerAlgo( - new GeomAlgoAPI_PaveFiller(aShapesToAdd, true, aFuzzy)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) { + new GeomAlgoAPI_PaveFiller(aShapesToAdd, true, aFuzzy)); + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), + anError)) { setError(anError); return; } @@ -188,25 +184,21 @@ void FeaturesPlugin_BooleanSmash::execute() if (data()->version() == BOP_VERSION_9_4()) { // merge hierarchies of compounds containing objects and tools // and append the result of the FUSE operation - aShape = keepUnusedSubsOfCompound(aShape, anObjectsHistory, aToolsHistory, aMakeShapeList); + aShape = keepUnusedSubsOfCompound(aShape, anObjectsHistory, aToolsHistory, + aMakeShapeList); } - std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); + std::shared_ptr aResultBody = + document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, - anOriginalShapes, - anOriginalShapes, - aMakeShapeList, - aShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + anOriginalShapes, aMakeShapeList, aShape); setResult(aResultBody, aResultIndex); aResultIndex++; - ModelAPI_Tools::loadDeletedShapes(aResultBody, - GeomShapePtr(), - anOriginalShapes, - aMakeShapeList, - aShape); + ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), + anOriginalShapes, aMakeShapeList, aShape); // remove the rest results if there were produced in the previous pass removeResults(aResultIndex); diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h index 6badae809..bea982bd1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BooleanSmash_H_ @@ -27,46 +28,40 @@ /// \class FeaturesPlugin_BooleanSmash /// \ingroup Plugins /// \brief Feature for applying of Boolean Smash operation. -class FeaturesPlugin_BooleanSmash : public FeaturesPlugin_Boolean -{ +class FeaturesPlugin_BooleanSmash : public FeaturesPlugin_Boolean { public: - /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Smash"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_BooleanSmash::ID(); return MY_KIND; } /// Attribute name of main objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } /// Attribute name of tool objects. - inline static const std::string& TOOL_LIST_ID() - { + inline static const std::string &TOOL_LIST_ID() { static const std::string MY_TOOL_LIST_ID("tool_objects"); return MY_TOOL_LIST_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: - /// Use plugin manager for features creation. FeaturesPlugin_BooleanSmash(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp index 1dabc4e2d..4770f036d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BoundingBox.h" -#include +#include #include +#include #include -#include #include #include @@ -37,13 +38,10 @@ #include //================================================================================================= -FeaturesPlugin_BoundingBox::FeaturesPlugin_BoundingBox() -{ -} +FeaturesPlugin_BoundingBox::FeaturesPlugin_BoundingBox() {} //================================================================================================= -void FeaturesPlugin_BoundingBox::initAttributes() -{ +void FeaturesPlugin_BoundingBox::initAttributes() { // attribute for object selected data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -56,23 +54,31 @@ void FeaturesPlugin_BoundingBox::initAttributes() data()->addAttribute(Z_MAX_COORD_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MIN_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MIN_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MIN_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MAX_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MAX_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MAX_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_ID()); - data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), X_MIN_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Y_MIN_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Z_MIN_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), X_MAX_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Y_MAX_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Z_MAX_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + COMPUTE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + OBJECT_ID()); + data()->addAttribute(RESULT_VALUES_ID(), + ModelAPI_AttributeDoubleArray::typeId()); data()->realArray(RESULT_VALUES_ID())->setSize(6); data()->boolean(COMPUTE_ID())->setValue(true); } //================================================================================================= -void FeaturesPlugin_BoundingBox::execute() -{ +void FeaturesPlugin_BoundingBox::execute() { if (!updateValues()) return; @@ -80,16 +86,14 @@ void FeaturesPlugin_BoundingBox::execute() } //================================================================================================= -void FeaturesPlugin_BoundingBox::attributeChanged(const std::string&) -{ -} +void FeaturesPlugin_BoundingBox::attributeChanged(const std::string &) {} //================================================================================================= -bool FeaturesPlugin_BoundingBox::updateValues() -{ +bool FeaturesPlugin_BoundingBox::updateValues() { AttributeSelectionPtr aSelection = selection(OBJECT_ID()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); if (aSelection->isInitialized()) { std::stringstream streamxmin; @@ -115,12 +119,9 @@ bool FeaturesPlugin_BoundingBox::updateValues() if (aShape && !aShape->isEqual(myShape)) { double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax; std::string anError; - if (!GetBoundingBox(aShape, - aXmin, aXmax, - aYmin, aYmax, - aZmin, aZmax, + if (!GetBoundingBox(aShape, aXmin, aXmax, aYmin, aYmax, aZmin, aZmax, anError)) { - setError("Error in bounding box calculation :" + anError); + setError("Error in bounding box calculation :" + anError); return false; } myShape = aShape; @@ -145,18 +146,17 @@ bool FeaturesPlugin_BoundingBox::updateValues() streamzmax << std::setprecision(14) << aValues->value(5); } - string(X_MIN_COORD_ID() )->setValue( "X = " + streamxmin.str() ); - string(Y_MIN_COORD_ID() )->setValue( "Y = " + streamymin.str() ); - string(Z_MIN_COORD_ID() )->setValue( "Z = " + streamzmin.str() ); - string(X_MAX_COORD_ID() )->setValue( "X = " + streamxmax.str() ); - string(Y_MAX_COORD_ID() )->setValue( "Y = " + streamymax.str() ); - string(Z_MAX_COORD_ID() )->setValue( "Z = " + streamzmax.str() ); + string(X_MIN_COORD_ID())->setValue("X = " + streamxmin.str()); + string(Y_MIN_COORD_ID())->setValue("Y = " + streamymin.str()); + string(Z_MIN_COORD_ID())->setValue("Z = " + streamzmin.str()); + string(X_MAX_COORD_ID())->setValue("X = " + streamxmax.str()); + string(Y_MAX_COORD_ID())->setValue("Y = " + streamymax.str()); + string(Z_MAX_COORD_ID())->setValue("Z = " + streamzmax.str()); } return true; } //================================================================================================= -AttributePtr FeaturesPlugin_BoundingBox::attributResultValues() -{ - return attribute(RESULT_VALUES_ID()); +AttributePtr FeaturesPlugin_BoundingBox::attributResultValues() { + return attribute(RESULT_VALUES_ID()); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h index 4c122a1f6..e60cfc5c7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BoundingBox_H_ @@ -26,94 +27,81 @@ /// \ingroup Plugins /// \brief Persistence feature to create the bounding box. -class FeaturesPlugin_BoundingBox : public FeaturesPlugin_BoundingBoxBase -{ +class FeaturesPlugin_BoundingBox : public FeaturesPlugin_BoundingBoxBase { public: /// Bounding box kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("BoundingBox"); return MY_ID; } /// Attribute name for object selected. - inline static const std::string& OBJECT_ID() - { + inline static const std::string &OBJECT_ID() { static const std::string MY_OBJECT_ID("main_object"); return MY_OBJECT_ID; } /// Attribute name for x coodinate. - inline static const std::string& X_MIN_COORD_ID() - { + inline static const std::string &X_MIN_COORD_ID() { static const std::string MY_X_MIN_COORD_ID("xmincoordinate"); return MY_X_MIN_COORD_ID; } /// Attribute name for y coodinate. - inline static const std::string& Y_MIN_COORD_ID() - { + inline static const std::string &Y_MIN_COORD_ID() { static const std::string MY_Y_MIN_COORD_ID("ymincoordinate"); return MY_Y_MIN_COORD_ID; } /// Attribute name for z coodinate. - inline static const std::string& Z_MIN_COORD_ID() - { + inline static const std::string &Z_MIN_COORD_ID() { static const std::string MY_Z_MIN_COORD_ID("zmincoordinate"); return MY_Z_MIN_COORD_ID; } /// Attribute name for x max coodinate. - inline static const std::string& X_MAX_COORD_ID() - { + inline static const std::string &X_MAX_COORD_ID() { static const std::string MY_X_MAX_COORD_ID("xmaxcoordinate"); return MY_X_MAX_COORD_ID; } /// Attribute name for y max coodinate. - inline static const std::string& Y_MAX_COORD_ID() - { + inline static const std::string &Y_MAX_COORD_ID() { static const std::string MY_Y_MAX_COORD_ID("ymaxcoordinate"); return MY_Y_MAX_COORD_ID; } /// Attribute name for z max coodinate. - inline static const std::string& Z_MAX_COORD_ID() - { + inline static const std::string &Z_MAX_COORD_ID() { static const std::string MY_Z_MAX_COORD_ID("zmaxcoordinate"); return MY_Z_MAX_COORD_ID; } /// Attribute name for values of result. - inline static const std::string& RESULT_VALUES_ID() - { + inline static const std::string &RESULT_VALUES_ID() { static const std::string MY_RESULT_VALUES_ID("result_values"); return MY_RESULT_VALUES_ID; } /// Attribute name for indicate to compute the bounding box. - inline static const std::string& COMPUTE_ID() - { + inline static const std::string &COMPUTE_ID() { static const std::string MY_COMPUTE_ID("compute"); return MY_COMPUTE_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Return Attribut values of result. FEATURESPLUGIN_EXPORT virtual AttributePtr attributResultValues(); @@ -124,7 +112,6 @@ public: private: /// Update values displayed. bool updateValues(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp index 9c8563d71..31bc75cc1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_BoundingBoxBase.h" #include +#include #include #include #include #include -#include #include #include @@ -36,35 +37,26 @@ #include #include - - //================================================================================================= -void FeaturesPlugin_BoundingBoxBase::createBoxByTwoPoints() -{ +void FeaturesPlugin_BoundingBoxBase::createBoxByTwoPoints() { AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attributResultValues()); + std::dynamic_pointer_cast( + attributResultValues()); SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); - GeomVertexPtr vertexFirst = - GeomAlgoAPI_PointBuilder::vertex(aValues->value(0), - aValues->value(2), - aValues->value(4)); - - GeomVertexPtr vertexSecond = - GeomAlgoAPI_PointBuilder::vertex(aValues->value(1), - aValues->value(3), - aValues->value(5)); + GeomVertexPtr vertexFirst = GeomAlgoAPI_PointBuilder::vertex( + aValues->value(0), aValues->value(2), aValues->value(4)); + GeomVertexPtr vertexSecond = GeomAlgoAPI_PointBuilder::vertex( + aValues->value(1), aValues->value(3), aValues->value(5)); std::shared_ptr aBoxAlgo; - aBoxAlgo = std::shared_ptr( - new GeomAlgoAPI_Box(vertexFirst->point(),vertexSecond->point())); - + new GeomAlgoAPI_Box(vertexFirst->point(), vertexSecond->point())); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -78,12 +70,14 @@ void FeaturesPlugin_BoundingBoxBase::createBoxByTwoPoints() // Check if the creation of the box if (!aBoxAlgo->isDone()) { - // The error is not displayed in a popup window. It must be in the message console. + // The error is not displayed in a popup window. It must be in the message + // console. setError(aBoxAlgo->getError()); return; } if (!aBoxAlgo->checkValid("Box builder with two points")) { - // The error is not displayed in a popup window. It must be in the message console. + // The error is not displayed in a popup window. It must be in the message + // console. setError(aBoxAlgo->getError()); return; } @@ -95,9 +89,9 @@ void FeaturesPlugin_BoundingBoxBase::createBoxByTwoPoints() } //================================================================================================= -void FeaturesPlugin_BoundingBoxBase::loadNamingDS(std::shared_ptr theBoxAlgo, - std::shared_ptr theResultBox) -{ +void FeaturesPlugin_BoundingBoxBase::loadNamingDS( + std::shared_ptr theBoxAlgo, + std::shared_ptr theResultBox) { // Load the result theResultBox->store(theBoxAlgo->shape()); @@ -105,11 +99,11 @@ void FeaturesPlugin_BoundingBoxBase::loadNamingDS(std::shared_ptrprepareNamingFaces(); // Insert to faces - std::map< std::string, std::shared_ptr > listOfFaces = - theBoxAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) { + std::map> listOfFaces = + theBoxAlgo->getCreatedFaces(); + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultBox->generated((*it).second, (*it).first); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h index b3ddc2bd8..a9ef58191 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_BoundingBoxBase_H_ @@ -34,8 +35,7 @@ /// \ingroup Plugins /// \brief Base feature to inspect properties of bounding box /// and create that box for the selected shape. -class FeaturesPlugin_BoundingBoxBase : public ModelAPI_Feature -{ +class FeaturesPlugin_BoundingBoxBase : public ModelAPI_Feature { public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(){}; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp index 30e331868..d6d937407 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Chamfer.h" @@ -46,22 +47,22 @@ //// GeomAPI_ShapeExplorer anExp(theShape, theShapeType); //// for (; anExp.more(); anExp.next()) { //// GeomShapePtr aShape = anExp.current(); -//// // Store all shapes with FORWARD orientation to avoid duplication of shared edges/vertices -//// aShape->setOrientation(GeomAPI_Shape::FORWARD); -//// theSubs.push_back(aShape); -//// } +//// // Store all shapes with FORWARD orientation to avoid duplication of +/// shared edges/vertices / aShape->setOrientation(GeomAPI_Shape::FORWARD); / +/// theSubs.push_back(aShape); / } ////} // Extract edges from the list -static void extractEdgesAndFaces(const ListOfShape& theShapes, - ListOfShape& theEdges, - std::map& theMapEdgeFace) -{ - for (ListOfShape::const_iterator anIt = theShapes.begin(); anIt != theShapes.end(); ++anIt) +static void +extractEdgesAndFaces(const ListOfShape &theShapes, ListOfShape &theEdges, + std::map &theMapEdgeFace) { + for (ListOfShape::const_iterator anIt = theShapes.begin(); + anIt != theShapes.end(); ++anIt) if ((*anIt)->isEdge()) theEdges.push_back(*anIt); else { - for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); + anExp.more(); anExp.next()) { GeomShapePtr aCurrent = anExp.current(); theEdges.push_back(aCurrent); theMapEdgeFace[aCurrent] = *anIt; @@ -69,50 +70,49 @@ static void extractEdgesAndFaces(const ListOfShape& theShapes, } } +FeaturesPlugin_Chamfer::FeaturesPlugin_Chamfer() {} -FeaturesPlugin_Chamfer::FeaturesPlugin_Chamfer() -{ -} - -void FeaturesPlugin_Chamfer::initAttributes() -{ +void FeaturesPlugin_Chamfer::initAttributes() { data()->addAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - AttributePtr aSelectionList = data()->addAttribute(FeaturesPlugin_Chamfer::OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(FeaturesPlugin_Chamfer::D1_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Chamfer::D2_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Chamfer::D_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Chamfer::ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + AttributePtr aSelectionList = + data()->addAttribute(FeaturesPlugin_Chamfer::OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(FeaturesPlugin_Chamfer::D1_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_Chamfer::D2_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_Chamfer::D_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_Chamfer::ANGLE_ID(), + ModelAPI_AttributeDouble::typeId()); initVersion(aSelectionList); } -AttributePtr FeaturesPlugin_Chamfer::objectsAttribute() -{ +AttributePtr FeaturesPlugin_Chamfer::objectsAttribute() { return attribute(OBJECT_LIST_ID()); } -const std::string& FeaturesPlugin_Chamfer::modifiedShapePrefix() const -{ - static const std::string& THE_PREFIX("Chamfer"); +const std::string &FeaturesPlugin_Chamfer::modifiedShapePrefix() const { + static const std::string &THE_PREFIX("Chamfer"); return THE_PREFIX; } -GeomMakeShapePtr FeaturesPlugin_Chamfer::performOperation(const GeomShapePtr& theSolid, - const ListOfShape& theEdges) -{ +GeomMakeShapePtr +FeaturesPlugin_Chamfer::performOperation(const GeomShapePtr &theSolid, + const ListOfShape &theEdges) { AttributeStringPtr aCreationMethod = string(CREATION_METHOD()); if (!aCreationMethod) return GeomMakeShapePtr(); - bool isDistDist = aCreationMethod->value() == CREATION_METHOD_DISTANCE_DISTANCE(); + bool isDistDist = + aCreationMethod->value() == CREATION_METHOD_DISTANCE_DISTANCE(); double aD1 = 0.0, aD2 = 0.0, aD = 0.0, anAngle = 0.0; if (isDistDist) { aD1 = real(FeaturesPlugin_Chamfer::D1_ID())->value(); aD2 = real(FeaturesPlugin_Chamfer::D2_ID())->value(); - } - else { + } else { aD = real(FeaturesPlugin_Chamfer::D_ID())->value(); anAngle = real(FeaturesPlugin_Chamfer::ANGLE_ID())->value(); } @@ -128,13 +128,13 @@ GeomMakeShapePtr FeaturesPlugin_Chamfer::performOperation(const GeomShapePtr& th if (isDistDist) { aChamferBuilder.reset(new GeomAlgoAPI_Chamfer( theSolid, aChamferEdges, aMapEdgeFace, true, aD1, aD2)); - } - else { + } else { aChamferBuilder.reset(new GeomAlgoAPI_Chamfer( theSolid, aChamferEdges, aMapEdgeFace, false, aD, anAngle)); } - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aChamferBuilder, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aChamferBuilder, + getKind(), anError)) { setError(anError); return GeomMakeShapePtr(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h index 0878feb56..0dc642664 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Chamfer_H_ @@ -26,77 +27,67 @@ /// \ingroup Plugins /// \brief Feature for applying the Chamfer operations on Solids. /// Supports two distances chamfer and distance-angle chamfer. -class FeaturesPlugin_Chamfer : public FeaturesPlugin_VersionedChFi -{ +class FeaturesPlugin_Chamfer : public FeaturesPlugin_VersionedChFi { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Chamfer"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Chamfer::ID(); return MY_KIND; } - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static std::string MY_CREATION_METHOD("creation_method"); return MY_CREATION_METHOD; } - inline static const std::string CREATION_METHOD_DISTANCE_DISTANCE() - { + inline static const std::string CREATION_METHOD_DISTANCE_DISTANCE() { static std::string MY_SINGLE_RADIUS("distance_distance"); return MY_SINGLE_RADIUS; } - inline static const std::string CREATION_METHOD_DISTANCE_ANGLE() - { + inline static const std::string CREATION_METHOD_DISTANCE_ANGLE() { static std::string MY_VARYING_RADIUS("distance_angle"); return MY_VARYING_RADIUS; } /// Attribute name of main objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } /// Attribute name of D1. - inline static const std::string& D1_ID() - { + inline static const std::string &D1_ID() { static const std::string MY_D1_ID("d1"); return MY_D1_ID; } /// Attribute name of D2. - inline static const std::string& D2_ID() - { + inline static const std::string &D2_ID() { static const std::string MY_D2_ID("d2"); return MY_D2_ID; } /// Attribute name of D. - inline static const std::string& D_ID() - { + inline static const std::string &D_ID() { static const std::string MY_D_ID("d"); return MY_D_ID; } /// Attribute name of Angle. - inline static const std::string& ANGLE_ID() - { + inline static const std::string &ANGLE_ID() { static const std::string MY_ANGLE_ID("angle"); return MY_ANGLE_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -107,11 +98,12 @@ private: virtual std::shared_ptr objectsAttribute(); /// Return name of modified shape prefix name - virtual const std::string& modifiedShapePrefix() const; + virtual const std::string &modifiedShapePrefix() const; - /// Run chamfer/fillet operation and returns the modification algorithm if succeed. + /// Run chamfer/fillet operation and returns the modification algorithm if + /// succeed. virtual std::shared_ptr - performOperation(const GeomShapePtr& theSolid, const ListOfShape& theEdges); + performOperation(const GeomShapePtr &theSolid, const ListOfShape &theEdges); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp index 718c83abf..d412e1b35 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_CommonSharedFaces.h" +#include #include #include #include -#include #include #include @@ -31,31 +32,32 @@ #include //================================================================================================= -void FeaturesPlugin_CommonSharedFaces::updateFaces() -{ +void FeaturesPlugin_CommonSharedFaces::updateFaces() { AttributeSelectionPtr aCompSolidAttr = - std::dynamic_pointer_cast(attributObject()); + std::dynamic_pointer_cast(attributObject()); AttributeSelectionListPtr aFacesListAttr = - std::dynamic_pointer_cast (attributListFaces()); + std::dynamic_pointer_cast( + attributListFaces()); GeomShapePtr aShape = aCompSolidAttr->value(); AttributeBooleanPtr anIsCompute = - std::dynamic_pointer_cast(attributIsCompute()); + std::dynamic_pointer_cast(attributIsCompute()); if (!anIsCompute->value()) { myShape = aShape; anIsCompute->setValue(true); } - if (aShape.get() && aCompSolidAttr->context().get() && !aShape->isEqual(myShape)) { + if (aShape.get() && aCompSolidAttr->context().get() && + !aShape->isEqual(myShape)) { if (aFacesListAttr->isInitialized()) - aFacesListAttr->clear(); + aFacesListAttr->clear(); aShape = aCompSolidAttr->context()->shape(); if (aShape) { ListOfShape aFaces = GeomAlgoAPI_ShapeTools::getSharedFaces(aShape); myShape = aShape; aFacesListAttr->setSelectionType("face"); ListOfShape::const_iterator anIt = aFaces.cbegin(); - for(; anIt != aFaces.cend(); ++anIt) { + for (; anIt != aFaces.cend(); ++anIt) { GeomShapePtr aFacePtr = *anIt; if (!(aFacesListAttr->isInList(aCompSolidAttr->context(), aFacePtr))) { aFacesListAttr->append(aCompSolidAttr->context(), aFacePtr); @@ -64,15 +66,16 @@ void FeaturesPlugin_CommonSharedFaces::updateFaces() std::stringstream aLabel; aLabel << aFacesListAttr->size(); AttributeStringPtr aNumberFacesAttr = - std::dynamic_pointer_cast(attributNumberFaces()); + std::dynamic_pointer_cast( + attributNumberFaces()); aNumberFacesAttr->setValue(aLabel.str()); } } } //================================================================================================= -void FeaturesPlugin_CommonSharedFaces::setFacesGroup(const std::wstring& theName) -{ +void FeaturesPlugin_CommonSharedFaces::setFacesGroup( + const std::wstring &theName) { std::vector aColor; ResultGroupPtr aGroup = document()->createGroup(data()); // Clean the result of the operation @@ -82,17 +85,17 @@ void FeaturesPlugin_CommonSharedFaces::setFacesGroup(const std::wstring& theName // shapes containing in group ListOfShape aFaces; AttributeSelectionListPtr aFacesListAttr = - std::dynamic_pointer_cast (attributListFaces()); + std::dynamic_pointer_cast( + attributListFaces()); - for (int anI =0; anI< aFacesListAttr->size(); anI++) { + for (int anI = 0; anI < aFacesListAttr->size(); anI++) { AttributeSelectionPtr aAtt = aFacesListAttr->value(anI); aFaces.push_back(aAtt->value()); } GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces); aGroup->store(aCompound); - aColor = {255,0,0}; + aColor = {255, 0, 0}; setResult(aGroup); - ModelAPI_Tools::setColor(lastResult(),aColor); + ModelAPI_Tools::setColor(lastResult(), aColor); } - diff --git a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h index 9d2ba5590..4a4a7d6cd 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_CommonSharedFaces_H_ @@ -26,13 +27,11 @@ #include #include - /// \class FeaturesPlugin_CommonSharedFaces /// \ingroup Plugins /// \brief Feature to check the shared faces of solid -class FeaturesPlugin_CommonSharedFaces : public ModelAPI_Feature -{ +class FeaturesPlugin_CommonSharedFaces : public ModelAPI_Feature { public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(){}; @@ -49,18 +48,17 @@ public: /// Return Attribut values of IsCompute. virtual AttributePtr attributIsCompute() = 0; - protected: +protected: FeaturesPlugin_CommonSharedFaces() {} - //Set group of faces - void setFacesGroup(const std::wstring& theName ); + // Set group of faces + void setFacesGroup(const std::wstring &theName); // Update the list of faces void updateFaces(); // the shape studied GeomShapePtr myShape; - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index cc9d88f82..09b483f65 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_CompositeBoolean.h" @@ -24,46 +25,45 @@ #include #include +#include #include #include #include -#include #include #include //================================================================================================= -void FeaturesPlugin_CompositeBoolean::initBooleanAttributes() -{ - myFeature->data()->addAttribute(OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void FeaturesPlugin_CompositeBoolean::initBooleanAttributes() { + myFeature->data()->addAttribute(OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); } //================================================================================================= -void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() -{ +void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() { // Make generation. ListOfShape aGenBaseShapes; ListOfMakeShape aGenMakeShapes; - if(!makeGeneration(aGenBaseShapes, aGenMakeShapes)) { + if (!makeGeneration(aGenBaseShapes, aGenMakeShapes)) { return; } // Getting tools. ListOfShape aTools; - for(ListOfMakeShape::const_iterator - anIt = aGenMakeShapes.cbegin(); anIt != aGenMakeShapes.cend(); ++anIt) { + for (ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin(); + anIt != aGenMakeShapes.cend(); ++anIt) { aTools.push_back((*anIt)->shape()); } // Make boolean. ListOfShape aBooleanObjects; ListOfMakeShape aBooleanMakeShapes; - if(!makeBoolean(aTools, aBooleanObjects, aBooleanMakeShapes)) { + if (!makeBoolean(aTools, aBooleanObjects, aBooleanMakeShapes)) { return; } - if(myOperationType == BOOL_FUSE) { + if (myOperationType == BOOL_FUSE) { aTools.splice(aTools.begin(), aBooleanObjects); aBooleanObjects.splice(aBooleanObjects.begin(), aTools, aTools.begin()); } @@ -74,24 +74,26 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() ListOfShape aResultShapesList; ListOfShape::const_iterator aBoolObjIt = aBooleanObjects.cbegin(); ListOfMakeShape::const_iterator aBoolMSIt = aBooleanMakeShapes.cbegin(); - for(; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend(); - ++aBoolObjIt, ++aBoolMSIt) { + for (; aBoolObjIt != aBooleanObjects.cend() && + aBoolMSIt != aBooleanMakeShapes.cend(); + ++aBoolObjIt, ++aBoolMSIt) { - ResultBodyPtr aResultBody = myFeature->document()->createBody(myFeature->data(), aResultIndex); + ResultBodyPtr aResultBody = + myFeature->document()->createBody(myFeature->data(), aResultIndex); - if((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) { + if ((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) { aResultBody->store((*aBoolMSIt)->shape(), false); - } - else - { + } else { aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape()); // Store generation history. ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin(); ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin(); - for(; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend(); - ++aGenBaseIt, ++aGenMSIt) { - std::shared_ptr aMSList(new GeomAlgoAPI_MakeShapeList()); + for (; aGenBaseIt != aGenBaseShapes.cend() && + aGenMSIt != aGenMakeShapes.cend(); + ++aGenBaseIt, ++aGenMSIt) { + std::shared_ptr aMSList( + new GeomAlgoAPI_MakeShapeList()); aMSList->appendAlgo(*aGenMSIt); aMSList->appendAlgo(*aBoolMSIt); storeGenerationHistory(aResultBody, *aGenBaseIt, aMSList); @@ -110,36 +112,40 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() myFeature->setResult(aResultBody, aResultIndex++); } - // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one - // result shape has been deleted, but in another it was modified or stayed. - GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); + // Store deleted shapes after all results has been proceeded. This is to avoid + // issue when in one result shape has been deleted, but in another it was + // modified or stayed. + GeomShapePtr aResultShapesCompound = + GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); storeDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound); myFeature->removeResults(aResultIndex); } //================================================================================================= -bool FeaturesPlugin_CompositeBoolean::cutRecursiveCompound(const GeomShapePtr theCompound, - const ListOfShape& theTools, - std::shared_ptr& theMakeShapeList, - GeomShapePtr& theResult) -{ +bool FeaturesPlugin_CompositeBoolean::cutRecursiveCompound( + const GeomShapePtr theCompound, const ListOfShape &theTools, + std::shared_ptr &theMakeShapeList, + GeomShapePtr &theResult) { // I. If theCompound is among the selected objects, // cut it by all tools and return result through theResult. // It can be a SOLID, ?COMPOUND?, ?COMPSOLID? - AttributeSelectionListPtr anObjectsSelList = myFeature->selectionList(OBJECTS_ID()); - for (int anObjIndex = 0; anObjIndex < anObjectsSelList->size(); anObjIndex++) { + AttributeSelectionListPtr anObjectsSelList = + myFeature->selectionList(OBJECTS_ID()); + for (int anObjIndex = 0; anObjIndex < anObjectsSelList->size(); + anObjIndex++) { AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjIndex); GeomShapePtr anObject = anObjectAttr->value(); if (theCompound->isEqual(anObject)) { // Cut theCompound itself ListOfShape aListWithObject; aListWithObject.push_back(anObject); - std::shared_ptr aBoolAlgo - (new GeomAlgoAPI_Boolean(aListWithObject, theTools, GeomAlgoAPI_Tools::BOOL_CUT)); + std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean( + aListWithObject, theTools, GeomAlgoAPI_Tools::BOOL_CUT)); // Checking that the algorithm worked properly. - if (!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || !aBoolAlgo->isValid()) { + if (!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || + !aBoolAlgo->isValid()) { myFeature->setError("Error: Boolean algorithm failed."); return false; } @@ -160,14 +166,14 @@ bool FeaturesPlugin_CompositeBoolean::cutRecursiveCompound(const GeomShapePtr th bool hasCut = false; ListOfShape aShapesToAdd; - for (GeomAPI_ShapeIterator it (theCompound); it.more(); it.next()) { + for (GeomAPI_ShapeIterator it(theCompound); it.more(); it.next()) { GeomShapePtr aSubShape = it.current(); GeomShapePtr aResult; - if (cutRecursiveCompound(aSubShape, theTools, theMakeShapeList, aResult)) { + if (cutRecursiveCompound(aSubShape, theTools, theMakeShapeList, + aResult)) { hasCut = true; aShapesToAdd.push_back(aResult); - } - else { + } else { aShapesToAdd.push_back(aSubShape); } } @@ -175,19 +181,20 @@ bool FeaturesPlugin_CompositeBoolean::cutRecursiveCompound(const GeomShapePtr th if (hasCut) { if (theCompound->shapeType() == GeomAPI_Shape::COMPSOLID) { // Build COMPSOLID - std::shared_ptr aFillerAlgo - (new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); - if (!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || !aFillerAlgo->isValid()) { + std::shared_ptr aFillerAlgo( + new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); + if (!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || + !aFillerAlgo->isValid()) { myFeature->setError("Error: PaveFiller algorithm failed."); return false; } theResult = aFillerAlgo->shape(); theMakeShapeList->appendAlgo(aFillerAlgo); - } - else { + } else { // Build COMPOUND theResult = GeomAlgoAPI_CompoundBuilder::compound(aShapesToAdd); - std::shared_ptr aCompMkr (new GeomAlgoAPI_MakeShapeCustom); + std::shared_ptr aCompMkr( + new GeomAlgoAPI_MakeShapeCustom); aCompMkr->setResult(theResult); aCompMkr->addModified(theCompound, theResult); // ?? theMakeShapeList->appendAlgo(aCompMkr); @@ -200,11 +207,10 @@ bool FeaturesPlugin_CompositeBoolean::cutRecursiveCompound(const GeomShapePtr th } //================================================================================================= -void FeaturesPlugin_CompositeBoolean::addSubShapes (const GeomShapePtr theCompound, - const ListOfShape& theSubShapesToAvoid, - ListOfShape& theSubShapesToAdd) { - for (GeomAPI_ShapeIterator aCompoundIt (theCompound); - aCompoundIt.more(); +void FeaturesPlugin_CompositeBoolean::addSubShapes( + const GeomShapePtr theCompound, const ListOfShape &theSubShapesToAvoid, + ListOfShape &theSubShapesToAdd) { + for (GeomAPI_ShapeIterator aCompoundIt(theCompound); aCompoundIt.more(); aCompoundIt.next()) { GeomShapePtr aCompoundSS = aCompoundIt.current(); ListOfShape::const_iterator aUseIt = theSubShapesToAvoid.cbegin(); @@ -217,8 +223,7 @@ void FeaturesPlugin_CompositeBoolean::addSubShapes (const GeomShapePtr theCompou if (aCompoundSS->shapeType() == GeomAPI_Shape::COMPSOLID || aCompoundSS->shapeType() == GeomAPI_Shape::COMPOUND) { addSubShapes(aCompoundSS, theSubShapesToAvoid, theSubShapesToAdd); - } - else { + } else { theSubShapesToAdd.push_back(aCompoundSS); } } @@ -226,22 +231,25 @@ void FeaturesPlugin_CompositeBoolean::addSubShapes (const GeomShapePtr theCompou } //================================================================================================= -bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, - ListOfShape& theObjects, - ListOfMakeShape& theMakeShapes) -{ +bool FeaturesPlugin_CompositeBoolean::makeBoolean( + const ListOfShape &theTools, ListOfShape &theObjects, + ListOfMakeShape &theMakeShapes) { // Getting objects. ListOfShape anObjects, anEdgesAndFaces, aCompSolids; std::map aCompSolidsObjects; - bool aCompoundsOnly = true;// if there are only compounds, do not use filler restoring compsolids + bool aCompoundsOnly = true; // if there are only compounds, do not use filler + // restoring compsolids - AttributeSelectionListPtr anObjectsSelList = myFeature->selectionList(OBJECTS_ID()); + AttributeSelectionListPtr anObjectsSelList = + myFeature->selectionList(OBJECTS_ID()); // collect recursive (complex) compounds, if any - ListOfShape aCompounds; // recursive compounds + ListOfShape aCompounds; // recursive compounds GeomAPI_DataMapOfShapeShape aCompoundsMap; // recursive compounds map - for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + anObjectsIndex++) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); ResultPtr aContext = anObjectAttr->context(); ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext); if (aResCompSolidPtr.get()) { @@ -254,28 +262,31 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } } - for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + anObjectsIndex++) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); GeomShapePtr anObject = anObjectAttr->value(); - if(!anObject.get()) { + if (!anObject.get()) { myFeature->setError("Error: Could not get object."); return false; } ResultPtr aContext = anObjectAttr->context(); ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext); - if(aResCompSolidPtr.get()) { + if (aResCompSolidPtr.get()) { ResultBodyPtr aResRootPtr = ModelAPI_Tools::bodyOwner(aContext, true); if (!aCompoundsMap.isBound(aResRootPtr->shape())) { // Compsolid or a simple (one-level) compound GeomShapePtr aContextShape = aResCompSolidPtr->shape(); - std::map::iterator anIt = aCompSolidsObjects.begin(); - for(; anIt != aCompSolidsObjects.end(); anIt++) { - if(anIt->first->isEqual(aContextShape)) { + std::map::iterator anIt = + aCompSolidsObjects.begin(); + for (; anIt != aCompSolidsObjects.end(); anIt++) { + if (anIt->first->isEqual(aContextShape)) { aCompSolidsObjects[anIt->first].push_back(anObject); break; } } - if(anIt == aCompSolidsObjects.end()) { + if (anIt == aCompSolidsObjects.end()) { aCompSolidsObjects[aContextShape].push_back(anObject); aCompSolids.push_back(aContextShape); if (aContextShape->shapeType() != GeomAPI_Shape::COMPOUND) @@ -283,8 +294,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } } } else { - if(anObject->shapeType() == GeomAPI_Shape::EDGE || - anObject->shapeType() == GeomAPI_Shape::FACE) { + if (anObject->shapeType() == GeomAPI_Shape::EDGE || + anObject->shapeType() == GeomAPI_Shape::FACE) { anEdgesAndFaces.push_back(anObject); } else { anObjects.push_back(anObject); @@ -292,287 +303,294 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } } - switch(myOperationType) { - case BOOL_CUT: { - if((anObjects.empty() && aCompSolidsObjects.empty() - && aCompoundsMap.size() < 1) || theTools.empty()) { - myFeature->setError("Error: Not enough objects for boolean operation."); + switch (myOperationType) { + case BOOL_CUT: { + if ((anObjects.empty() && aCompSolidsObjects.empty() && + aCompoundsMap.size() < 1) || + theTools.empty()) { + myFeature->setError("Error: Not enough objects for boolean operation."); + return false; + } + + // For solids cut each object with all tools. + for (ListOfShape::const_iterator anIt = anObjects.cbegin(); + anIt != anObjects.cend(); ++anIt) { + GeomShapePtr anObject = *anIt; + ListOfShape aListWithObject; + aListWithObject.push_back(anObject); + std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean( + aListWithObject, theTools, GeomAlgoAPI_Tools::BOOL_CUT)); + + // Checking that the algorithm worked properly. + if (!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || + !aBoolAlgo->isValid()) { + myFeature->setError("Error: Boolean algorithm failed."); return false; } - // For solids cut each object with all tools. - for(ListOfShape::const_iterator - anIt = anObjects.cbegin(); anIt != anObjects.cend(); ++anIt) { - GeomShapePtr anObject = *anIt; - ListOfShape aListWithObject; - aListWithObject.push_back(anObject); - std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean(aListWithObject, - theTools, - GeomAlgoAPI_Tools::BOOL_CUT)); - - // Checking that the algorithm worked properly. - if(!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || !aBoolAlgo->isValid()) { - myFeature->setError("Error: Boolean algorithm failed."); - return false; - } - - if(GeomAlgoAPI_ShapeTools::area(aBoolAlgo->shape()) > 1.e-27) { - theObjects.push_back(anObject); - theMakeShapes.push_back(aBoolAlgo); - } + if (GeomAlgoAPI_ShapeTools::area(aBoolAlgo->shape()) > 1.e-27) { + theObjects.push_back(anObject); + theMakeShapes.push_back(aBoolAlgo); } + } - // Compsolids handling - for(std::map::const_iterator anIt = aCompSolidsObjects.cbegin(); - anIt != aCompSolidsObjects.cend(); ++anIt) { - GeomShapePtr aCompSolid = anIt->first; - const ListOfShape& aUsedShapes = anIt->second; - - // Collecting solids from compsolids which will not be modified in boolean operation. - ListOfShape aShapesToAdd; - for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid); - aCompSolidIt.more(); - aCompSolidIt.next()) - { - GeomShapePtr aSolidInCompSolid = aCompSolidIt.current(); - ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin(); - for(; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) { - if(aSolidInCompSolid->isEqual(*aUsedShapesIt)) { - break; - } - } - if(aUsedShapesIt == aUsedShapes.end()) { - aShapesToAdd.push_back(aSolidInCompSolid); + // Compsolids handling + for (std::map::const_iterator anIt = + aCompSolidsObjects.cbegin(); + anIt != aCompSolidsObjects.cend(); ++anIt) { + GeomShapePtr aCompSolid = anIt->first; + const ListOfShape &aUsedShapes = anIt->second; + + // Collecting solids from compsolids which will not be modified in boolean + // operation. + ListOfShape aShapesToAdd; + for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid); aCompSolidIt.more(); + aCompSolidIt.next()) { + GeomShapePtr aSolidInCompSolid = aCompSolidIt.current(); + ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin(); + for (; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) { + if (aSolidInCompSolid->isEqual(*aUsedShapesIt)) { + break; } } + if (aUsedShapesIt == aUsedShapes.end()) { + aShapesToAdd.push_back(aSolidInCompSolid); + } + } - std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean(aUsedShapes, - theTools, - GeomAlgoAPI_Tools::BOOL_CUT)); + std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean( + aUsedShapes, theTools, GeomAlgoAPI_Tools::BOOL_CUT)); - // Checking that the algorithm worked properly. - if(!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || !aBoolAlgo->isValid()) { - myFeature->setError("Error: Boolean algorithm failed."); - return false; - } + // Checking that the algorithm worked properly. + if (!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || + !aBoolAlgo->isValid()) { + myFeature->setError("Error: Boolean algorithm failed."); + return false; + } - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); - aMakeShapeList->appendAlgo(aBoolAlgo); - - // Add result to not used solids from compsolid. - GeomShapePtr aBoolRes = aBoolAlgo->shape(); - if (!aShapesToAdd.empty()) { - aShapesToAdd.push_back(aBoolRes); - if (aCompoundsOnly) - { // 23885: if there are no compsolids in input, do not use filler to make compsolids - aBoolRes = GeomAlgoAPI_CompoundBuilder::compound(aShapesToAdd); - std::shared_ptr aCompMkr(new GeomAlgoAPI_MakeShapeCustom); - aCompMkr->setResult(aBoolRes); - for(ListOfShape::iterator aCS = aCompSolids.begin(); aCS != aCompSolids.end(); aCS++) - aCompMkr->addModified(*aCS, aBoolRes); - aMakeShapeList->appendAlgo(aCompMkr); - } - else - { - std::shared_ptr aFillerAlgo( + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); + aMakeShapeList->appendAlgo(aBoolAlgo); + + // Add result to not used solids from compsolid. + GeomShapePtr aBoolRes = aBoolAlgo->shape(); + if (!aShapesToAdd.empty()) { + aShapesToAdd.push_back(aBoolRes); + if (aCompoundsOnly) { // 23885: if there are no compsolids in input, do + // not use filler to make compsolids + aBoolRes = GeomAlgoAPI_CompoundBuilder::compound(aShapesToAdd); + std::shared_ptr aCompMkr( + new GeomAlgoAPI_MakeShapeCustom); + aCompMkr->setResult(aBoolRes); + for (ListOfShape::iterator aCS = aCompSolids.begin(); + aCS != aCompSolids.end(); aCS++) + aCompMkr->addModified(*aCS, aBoolRes); + aMakeShapeList->appendAlgo(aCompMkr); + } else { + std::shared_ptr aFillerAlgo( new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); - if (!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || !aFillerAlgo->isValid()) - { - myFeature->setError("Error: PaveFiller algorithm failed."); - return false; - } - aBoolRes = aFillerAlgo->shape(); - aMakeShapeList->appendAlgo(aFillerAlgo); + if (!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || + !aFillerAlgo->isValid()) { + myFeature->setError("Error: PaveFiller algorithm failed."); + return false; } - } - - if(GeomAlgoAPI_ShapeTools::area(aBoolRes) > 1.e-27) { - theObjects.push_back(aCompSolid); - theMakeShapes.push_back(aMakeShapeList); + aBoolRes = aFillerAlgo->shape(); + aMakeShapeList->appendAlgo(aFillerAlgo); } } - // Complex (recursive) compounds handling - for(ListOfShape::const_iterator anIt = aCompounds.cbegin(); - anIt != aCompounds.cend(); ++anIt) { - GeomShapePtr aCompound = (*anIt); - GeomShapePtr aRes; - std::shared_ptr aMakeShapeList (new GeomAlgoAPI_MakeShapeList()); - cutRecursiveCompound(aCompound, theTools, aMakeShapeList, aRes); - theObjects.push_back(aCompound); + if (GeomAlgoAPI_ShapeTools::area(aBoolRes) > 1.e-27) { + theObjects.push_back(aCompSolid); theMakeShapes.push_back(aMakeShapeList); } + } - break; + // Complex (recursive) compounds handling + for (ListOfShape::const_iterator anIt = aCompounds.cbegin(); + anIt != aCompounds.cend(); ++anIt) { + GeomShapePtr aCompound = (*anIt); + GeomShapePtr aRes; + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); + cutRecursiveCompound(aCompound, theTools, aMakeShapeList, aRes); + theObjects.push_back(aCompound); + theMakeShapes.push_back(aMakeShapeList); } - case BOOL_FUSE: { - // Set objects. - theObjects.insert(theObjects.end(), anEdgesAndFaces.begin(), anEdgesAndFaces.end()); - theObjects.insert(theObjects.end(), anObjects.begin(), anObjects.end()); - theObjects.insert(theObjects.end(), aCompSolids.begin(), aCompSolids.end()); - theObjects.insert(theObjects.end(), aCompounds.begin(), aCompounds.end()); - - // Filter edges and faces in tools. - ListOfShape aTools; - for(ListOfShape::const_iterator anIt = theTools.cbegin(); anIt != theTools.cend(); ++anIt) { - if((*anIt)->shapeType() == GeomAPI_Shape::EDGE || - (*anIt)->shapeType() == GeomAPI_Shape::FACE) { - anEdgesAndFaces.push_back(*anIt); - } else { - aTools.push_back(*anIt); - } - } - if((anObjects.size() + aTools.size() + aCompounds.size() + - aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) { - myFeature->setError("Error: Not enough objects for boolean operation."); - return false; + break; + } + case BOOL_FUSE: { + // Set objects. + theObjects.insert(theObjects.end(), anEdgesAndFaces.begin(), + anEdgesAndFaces.end()); + theObjects.insert(theObjects.end(), anObjects.begin(), anObjects.end()); + theObjects.insert(theObjects.end(), aCompSolids.begin(), aCompSolids.end()); + theObjects.insert(theObjects.end(), aCompounds.begin(), aCompounds.end()); + + // Filter edges and faces in tools. + ListOfShape aTools; + for (ListOfShape::const_iterator anIt = theTools.cbegin(); + anIt != theTools.cend(); ++anIt) { + if ((*anIt)->shapeType() == GeomAPI_Shape::EDGE || + (*anIt)->shapeType() == GeomAPI_Shape::FACE) { + anEdgesAndFaces.push_back(*anIt); + } else { + aTools.push_back(*anIt); } + } - // Collecting all solids which will be fused. - ListOfShape aSolidsToFuse; - aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end()); - aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end()); + if ((anObjects.size() + aTools.size() + aCompounds.size() + + aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) { + myFeature->setError("Error: Not enough objects for boolean operation."); + return false; + } - // Collecting solids and compsolids from compounds which will not be - // modified in boolean operation and will be added to result. - ListOfShape aShapesToAdd; - for (ListOfShape::iterator anIt = aCompounds.begin(); - anIt != aCompounds.end(); anIt++) { - GeomShapePtr aCompound = (*anIt); - addSubShapes(aCompound, anObjects, aShapesToAdd); - } + // Collecting all solids which will be fused. + ListOfShape aSolidsToFuse; + aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), + anObjects.end()); + aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end()); - // Collecting solids from compsolids which will not be - // modified in boolean operation and will be added to result. - for (std::map::iterator anIt = aCompSolidsObjects.begin(); - anIt != aCompSolidsObjects.end(); anIt++) { - GeomShapePtr aCompSolid = anIt->first; - ListOfShape& aUsedShapes = anIt->second; - aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end()); //??? - addSubShapes(aCompSolid, aUsedShapes, aShapesToAdd); - } + // Collecting solids and compsolids from compounds which will not be + // modified in boolean operation and will be added to result. + ListOfShape aShapesToAdd; + for (ListOfShape::iterator anIt = aCompounds.begin(); + anIt != aCompounds.end(); anIt++) { + GeomShapePtr aCompound = (*anIt); + addSubShapes(aCompound, anObjects, aShapesToAdd); + } - // Cut edges and faces(if we have any) with solids. - ListOfShape aCutTools; - aCutTools.insert(aCutTools.end(), anObjects.begin(), anObjects.end()); - aCutTools.insert(aCutTools.end(), aCompSolids.begin(), aCompSolids.end()); - aCutTools.insert(aCutTools.end(), aTools.begin(), aTools.end()); - - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); - if(!anEdgesAndFaces.empty() && !aCutTools.empty()) { - std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces, - aCutTools, - GeomAlgoAPI_Tools::BOOL_CUT)); - if(aCutAlgo->isDone() && !aCutAlgo->shape()->isNull() && aCutAlgo->isValid()) { - anEdgesAndFaces.clear(); - anEdgesAndFaces.push_back(aCutAlgo->shape()); - aMakeShapeList->appendAlgo(aCutAlgo); - } + // Collecting solids from compsolids which will not be + // modified in boolean operation and will be added to result. + for (std::map::iterator anIt = + aCompSolidsObjects.begin(); + anIt != aCompSolidsObjects.end(); anIt++) { + GeomShapePtr aCompSolid = anIt->first; + ListOfShape &aUsedShapes = anIt->second; + aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), + aUsedShapes.end()); //??? + addSubShapes(aCompSolid, aUsedShapes, aShapesToAdd); + } + + // Cut edges and faces(if we have any) with solids. + ListOfShape aCutTools; + aCutTools.insert(aCutTools.end(), anObjects.begin(), anObjects.end()); + aCutTools.insert(aCutTools.end(), aCompSolids.begin(), aCompSolids.end()); + aCutTools.insert(aCutTools.end(), aTools.begin(), aTools.end()); + + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); + if (!anEdgesAndFaces.empty() && !aCutTools.empty()) { + std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean( + anEdgesAndFaces, aCutTools, GeomAlgoAPI_Tools::BOOL_CUT)); + if (aCutAlgo->isDone() && !aCutAlgo->shape()->isNull() && + aCutAlgo->isValid()) { + anEdgesAndFaces.clear(); + anEdgesAndFaces.push_back(aCutAlgo->shape()); + aMakeShapeList->appendAlgo(aCutAlgo); } + } - // If we have compsolids then cut with not used solids all others. - if(!aShapesToAdd.empty()) { - std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean(aSolidsToFuse, - aShapesToAdd, - GeomAlgoAPI_Tools::BOOL_CUT)); - if(aCutAlgo->isDone() && GeomAlgoAPI_ShapeTools::area(aCutAlgo->shape()) > 1.e-27) { - aSolidsToFuse.clear(); - aSolidsToFuse.push_back(aCutAlgo->shape()); - aMakeShapeList->appendAlgo(aCutAlgo); - } + // If we have compsolids then cut with not used solids all others. + if (!aShapesToAdd.empty()) { + std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean( + aSolidsToFuse, aShapesToAdd, GeomAlgoAPI_Tools::BOOL_CUT)); + if (aCutAlgo->isDone() && + GeomAlgoAPI_ShapeTools::area(aCutAlgo->shape()) > 1.e-27) { + aSolidsToFuse.clear(); + aSolidsToFuse.push_back(aCutAlgo->shape()); + aMakeShapeList->appendAlgo(aCutAlgo); } + } - // Fuse all objects and all tools. - GeomShapePtr aFusedShape; - if(aSolidsToFuse.size() == 1) { - aFusedShape = aSolidsToFuse.front(); - } else if(aSolidsToFuse.size() > 1){ - anObjects.clear(); - anObjects.push_back(aSolidsToFuse.front()); - aSolidsToFuse.pop_front(); - aTools = aSolidsToFuse; - - std::shared_ptr aFuseAlgo(new GeomAlgoAPI_Boolean(anObjects, - aTools, - GeomAlgoAPI_Tools::BOOL_FUSE)); - - // Checking that the algorithm worked properly. - if(!aFuseAlgo->isDone() || aFuseAlgo->shape()->isNull() || !aFuseAlgo->isValid()) { - myFeature->setError("Error: Boolean algorithm failed."); - return false; - } + // Fuse all objects and all tools. + GeomShapePtr aFusedShape; + if (aSolidsToFuse.size() == 1) { + aFusedShape = aSolidsToFuse.front(); + } else if (aSolidsToFuse.size() > 1) { + anObjects.clear(); + anObjects.push_back(aSolidsToFuse.front()); + aSolidsToFuse.pop_front(); + aTools = aSolidsToFuse; - aFusedShape = aFuseAlgo->shape(); - aMakeShapeList->appendAlgo(aFuseAlgo); + std::shared_ptr aFuseAlgo(new GeomAlgoAPI_Boolean( + anObjects, aTools, GeomAlgoAPI_Tools::BOOL_FUSE)); + + // Checking that the algorithm worked properly. + if (!aFuseAlgo->isDone() || aFuseAlgo->shape()->isNull() || + !aFuseAlgo->isValid()) { + myFeature->setError("Error: Boolean algorithm failed."); + return false; } - // Combine result with not used solids from compsolid and edges and faces (if we have any). - aShapesToAdd.insert(aShapesToAdd.end(), anEdgesAndFaces.begin(), anEdgesAndFaces.end()); - if(!aShapesToAdd.empty()) { - if(aFusedShape.get()) { - aShapesToAdd.push_back(aFusedShape); - } + aFusedShape = aFuseAlgo->shape(); + aMakeShapeList->appendAlgo(aFuseAlgo); + } - std::shared_ptr aFillerAlgo( - new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); - if(!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || !aFillerAlgo->isValid()) { - myFeature->setError("Error: PaveFiller algorithm failed."); - return false; - } + // Combine result with not used solids from compsolid and edges and faces + // (if we have any). + aShapesToAdd.insert(aShapesToAdd.end(), anEdgesAndFaces.begin(), + anEdgesAndFaces.end()); + if (!aShapesToAdd.empty()) { + if (aFusedShape.get()) { + aShapesToAdd.push_back(aFusedShape); + } - aMakeShapeList->appendAlgo(aFillerAlgo); + std::shared_ptr aFillerAlgo( + new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); + if (!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || + !aFillerAlgo->isValid()) { + myFeature->setError("Error: PaveFiller algorithm failed."); + return false; } - theMakeShapes.push_back(aMakeShapeList); - break; + aMakeShapeList->appendAlgo(aFillerAlgo); } - default: // [to avoid compilation warnings] - break; + + theMakeShapes.push_back(aMakeShapeList); + break; + } + default: // [to avoid compilation warnings] + break; } return true; } //================================================================================================= -void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theObject, - const ListOfShape& theTools, - const std::shared_ptr theMakeShape) -{ +void FeaturesPlugin_CompositeBoolean::storeModificationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theObject, + const ListOfShape &theTools, + const std::shared_ptr theMakeShape) { ListOfShape aTools = theTools; aTools.push_back(theObject); - for(ListOfShape::const_iterator anIt = aTools.begin(); anIt != aTools.end(); anIt++) { - theResultBody->loadModifiedShapes(theMakeShape, *anIt, - (*anIt)->shapeType() == GeomAPI_Shape::EDGE ? - GeomAPI_Shape::EDGE : - GeomAPI_Shape::FACE); + for (ListOfShape::const_iterator anIt = aTools.begin(); anIt != aTools.end(); + anIt++) { + theResultBody->loadModifiedShapes( + theMakeShape, *anIt, + (*anIt)->shapeType() == GeomAPI_Shape::EDGE ? GeomAPI_Shape::EDGE + : GeomAPI_Shape::FACE); } } //================================================================================================== void FeaturesPlugin_CompositeBoolean::storeDeletedShapes( - std::vector& theResultBaseAlgoList, - const ListOfShape& theTools, - const GeomShapePtr theResultShapesCompound) -{ - for (std::vector::iterator anIt = theResultBaseAlgoList.begin(); - anIt != theResultBaseAlgoList.end(); - ++anIt) - { - ResultBaseAlgo& aRCA = *anIt; - aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, - aRCA.baseShape, - GeomAPI_Shape::FACE, - theResultShapesCompound); - - for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) - { - aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, - *anIter, - GeomAPI_Shape::FACE, - theResultShapesCompound); + std::vector &theResultBaseAlgoList, + const ListOfShape &theTools, const GeomShapePtr theResultShapesCompound) { + for (std::vector::iterator anIt = + theResultBaseAlgoList.begin(); + anIt != theResultBaseAlgoList.end(); ++anIt) { + ResultBaseAlgo &aRCA = *anIt; + aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, aRCA.baseShape, + GeomAPI_Shape::FACE, + theResultShapesCompound); + + for (ListOfShape::const_iterator anIter = theTools.begin(); + anIter != theTools.end(); anIter++) { + aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, *anIter, + GeomAPI_Shape::FACE, + theResultShapesCompound); } } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index 65467ca72..f42958ccc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_CompositeBoolean_H_ @@ -22,27 +23,20 @@ #include "FeaturesPlugin.h" -#include -#include #include #include +#include +#include /// \class FeaturesPlugin_CompositeBoolean /// \ingroup Plugins /// \brief Interface for the composite boolean feature. -class FeaturesPlugin_CompositeBoolean -{ +class FeaturesPlugin_CompositeBoolean { public: - enum OperationType { - BOOL_CUT, - BOOL_FUSE, - BOOL_COMMON, - BOOL_SMASH - }; + enum OperationType { BOOL_CUT, BOOL_FUSE, BOOL_COMMON, BOOL_SMASH }; /// Attribute name of main objects. - inline static const std::string& OBJECTS_ID() - { + inline static const std::string &OBJECTS_ID() { static const std::string MY_OBJECTS_ID("main_objects"); return MY_OBJECTS_ID; } @@ -50,7 +44,7 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean(); - const OperationType& operationType() const { return myOperationType; } + const OperationType &operationType() const { return myOperationType; } protected: struct ResultBaseAlgo { @@ -66,17 +60,16 @@ protected: void initBooleanAttributes(); /// This function need to be defined for extrusion/revolution generation. - virtual bool makeGeneration(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes) = 0; + virtual bool makeGeneration(ListOfShape &theBaseShapes, + ListOfMakeShape &theMakeShapes) = 0; /// Makes boolean operation. /// \param[in] theTools list of tools. /// \param[out] theObjects list of objects. /// \param[out] theMakeShapes list of according algos. /// \return false if failed. - bool makeBoolean(const ListOfShape& theTools, - ListOfShape& theObjects, - ListOfMakeShape& theMakeShapes); + bool makeBoolean(const ListOfShape &theTools, ListOfShape &theObjects, + ListOfMakeShape &theMakeShapes); /// Stores generation history. virtual void storeGenerationHistory(ResultBodyPtr theResultBody, @@ -84,14 +77,14 @@ protected: const GeomMakeShapePtr theMakeShape) = 0; /// Stores modification history. - void storeModificationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theObject, - const ListOfShape& theTools, - const std::shared_ptr theMakeShape); + void storeModificationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theObject, + const ListOfShape &theTools, + const std::shared_ptr theMakeShape); /// Stores deleted shapes. - void storeDeletedShapes(std::vector& theResultBaseAlgoList, - const ListOfShape& theTools, + void storeDeletedShapes(std::vector &theResultBaseAlgoList, + const ListOfShape &theTools, const GeomShapePtr theResultShapesCompound); private: @@ -102,23 +95,23 @@ private: /// \param[out] theMakeShapeList list of according algos. /// \param[out] theResult result of cut. /// \return false if failed or no cuts done (this is normal case). - bool cutRecursiveCompound (const GeomShapePtr theCompound, - const ListOfShape& theTools, - std::shared_ptr& theMakeShapeList, - GeomShapePtr& theResult); + bool cutRecursiveCompound( + const GeomShapePtr theCompound, const ListOfShape &theTools, + std::shared_ptr &theMakeShapeList, + GeomShapePtr &theResult); /// Add subshapes of \a theCompound to \a theSubShapesToAdd list, /// except ones from \a theSubShapesToAvoid. /// Called from makeBoolean(). /// \param[in] theCompound the shape to collect sub-shapes of. - /// \param[in] theSubShapesToAvoid list of shapes that should not be added to the result. - /// \param[out] theSubShapesToAdd list of found sub-shapes. - void addSubShapes (const GeomShapePtr theCompound, - const ListOfShape& theSubShapesToAvoid, - ListOfShape& theSubShapesToAdd); + /// \param[in] theSubShapesToAvoid list of shapes that should not be added to + /// the result. \param[out] theSubShapesToAdd list of found sub-shapes. + void addSubShapes(const GeomShapePtr theCompound, + const ListOfShape &theSubShapesToAvoid, + ListOfShape &theSubShapesToAdd); protected: - ModelAPI_Feature* myFeature; + ModelAPI_Feature *myFeature; OperationType myOperationType; }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 3d5b66c2a..7a6de460d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include +#include #include #include #include @@ -31,29 +32,30 @@ #include - static const std::string COMPOSITESKETCH_VERSION_1("v9.6"); -static void storeSubShape(const std::shared_ptr theMakeShape, - ResultBodyPtr theResultBody, - const GeomShapePtr theShape, - const GeomAPI_Shape::ShapeType theType, - const std::string& theName); +static void +storeSubShape(const std::shared_ptr theMakeShape, + ResultBodyPtr theResultBody, const GeomShapePtr theShape, + const GeomAPI_Shape::ShapeType theType, + const std::string &theName); //================================================================================================= -void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int theInitFlags) -{ +void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues( + const int theInitFlags) { // Initialize sketch launcher. - if(theInitFlags & InitSketchLauncher) { + if (theInitFlags & InitSketchLauncher) { data()->addAttribute(SKETCH_ID(), ModelAPI_AttributeReference::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SKETCH_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + SKETCH_ID()); } // Initialize selection list. - if(theInitFlags & InitBaseObjectsList) { + if (theInitFlags & InitBaseObjectsList) { AttributeSelectionListPtr anObjectsAttr = std::dynamic_pointer_cast( - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId())); + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId())); myCurrentSelectionType = selectionList(BASE_OBJECTS_ID())->selectionType(); anObjectsAttr->setWholeResultAllowed(true); if (!anObjectsAttr->isInitialized()) { @@ -64,44 +66,43 @@ void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int the } //================================================================================================= -std::shared_ptr FeaturesPlugin_CompositeSketch::addFeature(std::string theID) -{ +std::shared_ptr +FeaturesPlugin_CompositeSketch::addFeature(std::string theID) { FeaturePtr aNew = document()->addFeature(theID, false); - if(aNew) { + if (aNew) { data()->reference(SKETCH_ID())->setValue(aNew); } - // Set as current also after it becomes sub to set correctly enabled for other sketch subs. + // Set as current also after it becomes sub to set correctly enabled for other + // sketch subs. document()->setCurrentFeature(aNew, false); return aNew; } //================================================================================================= -int FeaturesPlugin_CompositeSketch::numberOfSubs(bool /*forTree*/) const -{ +int FeaturesPlugin_CompositeSketch::numberOfSubs(bool /*forTree*/) const { ObjectPtr aObj = data()->reference(SKETCH_ID())->value(); return aObj.get() ? 1 : 0; } //================================================================================================= -std::shared_ptr FeaturesPlugin_CompositeSketch::subFeature(const int theIndex, - bool /*forTree*/) -{ +std::shared_ptr +FeaturesPlugin_CompositeSketch::subFeature(const int theIndex, + bool /*forTree*/) { FeaturePtr aSubFeature; - if(theIndex == 0) { - aSubFeature = - std::dynamic_pointer_cast(data()->reference(SKETCH_ID())->value()); + if (theIndex == 0) { + aSubFeature = std::dynamic_pointer_cast( + data()->reference(SKETCH_ID())->value()); } return aSubFeature; } //================================================================================================= -int FeaturesPlugin_CompositeSketch::subFeatureId(const int theIndex) const -{ - if(theIndex == 0) { - FeaturePtr aFeature = - std::dynamic_pointer_cast(data()->reference(SKETCH_ID())->value()); - if(aFeature.get()) { +int FeaturesPlugin_CompositeSketch::subFeatureId(const int theIndex) const { + if (theIndex == 0) { + FeaturePtr aFeature = std::dynamic_pointer_cast( + data()->reference(SKETCH_ID())->value()); + if (aFeature.get()) { return aFeature->data()->featureId(); } } @@ -110,8 +111,7 @@ int FeaturesPlugin_CompositeSketch::subFeatureId(const int theIndex) const } //================================================================================================= -bool FeaturesPlugin_CompositeSketch::isSub(ObjectPtr theObject) const -{ +bool FeaturesPlugin_CompositeSketch::isSub(ObjectPtr theObject) const { bool isSubFeature = false; // Check is this feature of result FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); @@ -123,10 +123,12 @@ bool FeaturesPlugin_CompositeSketch::isSub(ObjectPtr theObject) const } //================================================================================================= -void FeaturesPlugin_CompositeSketch::removeFeature(std::shared_ptr theFeature) -{ - AttributeSelectionListPtr aBaseObjectsSelectionList = selectionList(BASE_OBJECTS_ID()); - if(aBaseObjectsSelectionList.get() && aBaseObjectsSelectionList->size() > 0) { +void FeaturesPlugin_CompositeSketch::removeFeature( + std::shared_ptr theFeature) { + AttributeSelectionListPtr aBaseObjectsSelectionList = + selectionList(BASE_OBJECTS_ID()); + if (aBaseObjectsSelectionList.get() && + aBaseObjectsSelectionList->size() > 0) { aBaseObjectsSelectionList->clear(); } @@ -134,10 +136,10 @@ void FeaturesPlugin_CompositeSketch::removeFeature(std::shared_ptr theMakeShape, - const int theIndex) -{ +void FeaturesPlugin_CompositeSketch::storeResult( + const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape, + const int theIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theIndex); @@ -163,132 +165,140 @@ void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape } //================================================================================================= -void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape) -{ +void FeaturesPlugin_CompositeSketch::storeGenerationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape) { GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; - switch(aBaseShapeType) { - case GeomAPI_Shape::EDGE: { - aShapeTypeToExplode = GeomAPI_Shape::VERTEX; - break; - } - case GeomAPI_Shape::WIRE: { - aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; - break; - } - case GeomAPI_Shape::FACE: - case GeomAPI_Shape::SHELL: { - aShapeTypeToExplode = GeomAPI_Shape::EDGE; - break; - } - case GeomAPI_Shape::COMPOUND: { - aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; - } - default: // [to avoid compilation warnings] - break; + switch (aBaseShapeType) { + case GeomAPI_Shape::EDGE: { + aShapeTypeToExplode = GeomAPI_Shape::VERTEX; + break; + } + case GeomAPI_Shape::WIRE: { + aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; + break; + } + case GeomAPI_Shape::FACE: + case GeomAPI_Shape::SHELL: { + aShapeTypeToExplode = GeomAPI_Shape::EDGE; + break; + } + case GeomAPI_Shape::COMPOUND: { + aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; + } + default: // [to avoid compilation warnings] + break; } - if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || + if (aShapeTypeToExplode == GeomAPI_Shape::VERTEX || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX); + theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::VERTEX); } - if(aShapeTypeToExplode == GeomAPI_Shape::EDGE || + if (aShapeTypeToExplode == GeomAPI_Shape::EDGE || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE); + theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::EDGE); } - std::list > aSweeps; // all sweeps collected + std::list> + aSweeps; // all sweeps collected std::shared_ptr aMakeSweep = - std::dynamic_pointer_cast(theMakeShape); - if(aMakeSweep.get()) { + std::dynamic_pointer_cast(theMakeShape); + if (aMakeSweep.get()) { aSweeps.push_back(aMakeSweep); } else { std::shared_ptr aMakeList = - std::dynamic_pointer_cast(theMakeShape); + std::dynamic_pointer_cast(theMakeShape); if (aMakeList.get()) { ListOfMakeShape::const_iterator anIter = aMakeList->list().cbegin(); - for(; anIter != aMakeList->list().cend(); anIter++) { + for (; anIter != aMakeList->list().cend(); anIter++) { std::shared_ptr aSweep = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (aSweep.get()) aSweeps.push_back(aSweep); } } } - std::list >::iterator aSweep = aSweeps.begin(); - for(; aSweep != aSweeps.end(); aSweep++) { + std::list>::iterator aSweep = + aSweeps.begin(); + for (; aSweep != aSweeps.end(); aSweep++) { // Store from shapes. - storeShapes(theMakeShape, theResultBody, aBaseShapeType, (*aSweep)->fromShapes(), "From_"); + storeShapes(theMakeShape, theResultBody, aBaseShapeType, + (*aSweep)->fromShapes(), "From_"); // Store to shapes. - storeShapes(theMakeShape, theResultBody, aBaseShapeType, (*aSweep)->toShapes(), "To_"); + storeShapes(theMakeShape, theResultBody, aBaseShapeType, + (*aSweep)->toShapes(), "To_"); } } //================================================================================================= void FeaturesPlugin_CompositeSketch::storeShapes( - const std::shared_ptr theMakeShape, - ResultBodyPtr theResultBody, - const GeomAPI_Shape::ShapeType theBaseShapeType, - const ListOfShape& theShapes, - const std::string theName) -{ + const std::shared_ptr theMakeShape, + ResultBodyPtr theResultBody, + const GeomAPI_Shape::ShapeType theBaseShapeType, + const ListOfShape &theShapes, const std::string theName) { GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE; std::string aShapeTypeStr = "Face"; - switch(theBaseShapeType) { - case GeomAPI_Shape::VERTEX: { - aShapeTypeToExplore = GeomAPI_Shape::VERTEX; - aShapeTypeStr = "Vertex"; - break; - } - case GeomAPI_Shape::EDGE: - case GeomAPI_Shape::WIRE: { - aShapeTypeToExplore = GeomAPI_Shape::EDGE; - aShapeTypeStr = "Edge"; - break; - } - case GeomAPI_Shape::FACE: - case GeomAPI_Shape::SHELL: { - aShapeTypeToExplore = GeomAPI_Shape::FACE; - aShapeTypeStr = "Face"; - break; - } - case GeomAPI_Shape::COMPOUND: { - aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; - break; - } - default: // [to avoid compilation warnings] - break; + switch (theBaseShapeType) { + case GeomAPI_Shape::VERTEX: { + aShapeTypeToExplore = GeomAPI_Shape::VERTEX; + aShapeTypeStr = "Vertex"; + break; + } + case GeomAPI_Shape::EDGE: + case GeomAPI_Shape::WIRE: { + aShapeTypeToExplore = GeomAPI_Shape::EDGE; + aShapeTypeStr = "Edge"; + break; + } + case GeomAPI_Shape::FACE: + case GeomAPI_Shape::SHELL: { + aShapeTypeToExplore = GeomAPI_Shape::FACE; + aShapeTypeStr = "Face"; + break; + } + case GeomAPI_Shape::COMPOUND: { + aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; + break; + } + default: // [to avoid compilation warnings] + break; } // Store shapes. - for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) { + for (ListOfShape::const_iterator anIt = theShapes.cbegin(); + anIt != theShapes.cend(); ++anIt) { GeomShapePtr aShape = *anIt; - if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { - std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face"); - storeSubShape(theMakeShape, theResultBody, aShape, aShape->shapeType(), aName); + if (aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { + std::string aName = + theName + + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face"); + storeSubShape(theMakeShape, theResultBody, aShape, aShape->shapeType(), + aName); } else { std::string aName = theName + aShapeTypeStr; - storeSubShape(theMakeShape, theResultBody, aShape, aShapeTypeToExplore, aName); - if (theBaseShapeType == GeomAPI_Shape::WIRE) { // issue 2289: special names also for vertices + storeSubShape(theMakeShape, theResultBody, aShape, aShapeTypeToExplore, + aName); + if (theBaseShapeType == + GeomAPI_Shape::WIRE) { // issue 2289: special names also for vertices aName = theName + "Vertex"; - storeSubShape(theMakeShape, theResultBody, aShape, GeomAPI_Shape::VERTEX, aName); + storeSubShape(theMakeShape, theResultBody, aShape, + GeomAPI_Shape::VERTEX, aName); } } } } -void storeSubShape( - const std::shared_ptr theMakeShape, - ResultBodyPtr theResultBody, - const GeomShapePtr theShape, - const GeomAPI_Shape::ShapeType theType, - const std::string& theName) -{ - for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) { +void storeSubShape(const std::shared_ptr theMakeShape, + ResultBodyPtr theResultBody, const GeomShapePtr theShape, + const GeomAPI_Shape::ShapeType theType, + const std::string &theName) { + for (GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); + anExp.next()) { GeomShapePtr aSubShape = anExp.current(); if (!theResultBody->generated(aSubShape, theName)) { int aNbSubs = theResultBody->numberOfSubs(); @@ -304,14 +314,15 @@ void storeSubShape( if (aShape->isSubShape(*aNewIt, false)) break; if (aNewIt != aNewShapes.end()) { - // store from/to shapes as primitives and then store modification of them by the boolean + // store from/to shapes as primitives and then store modification of + // them by the boolean aSubRes->generated(aSubShape, theName, false); aSubRes->loadModifiedShapes(theMakeShape, aSubShape, theType); } } - } - else { - // store from/to shapes as primitives and then store modification of them by the boolean + } else { + // store from/to shapes as primitives and then store modification of + // them by the boolean theResultBody->generated(aSubShape, theName, false); theResultBody->loadModifiedShapes(theMakeShape, aSubShape, theType); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h index c9f9dd4a9..fd809c4f6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_CompositeSketch_H_ @@ -29,48 +30,47 @@ /// \class FeaturesPlugin_CompositeSketch /// \ingroup Plugins /// \brief Interface for the composite sketch feature. -class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature -{ +class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature { public: /// Attribute name of sketch feature. - inline static const std::string& SKETCH_ID() - { + inline static const std::string &SKETCH_ID() { static const std::string MY_SKETCH_ID("sketch"); return MY_SKETCH_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base"); return MY_BASE_OBJECTS_ID; } /// Appends a feature to the sketch sub-elements container. - FEATURESPLUGIN_EXPORT virtual std::shared_ptr addFeature(std::string theID); + FEATURESPLUGIN_EXPORT virtual std::shared_ptr + addFeature(std::string theID); /// \return the number of sub-elements. FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const; /// \return the sub-feature by zero-base index. - FEATURESPLUGIN_EXPORT virtual - std::shared_ptr subFeature(const int theIndex, bool forTree = false); + FEATURESPLUGIN_EXPORT virtual std::shared_ptr + subFeature(const int theIndex, bool forTree = false); - /// \return the sub-feature unique identifier in this composite feature by zero-base index. + /// \return the sub-feature unique identifier in this composite feature by + /// zero-base index. FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const; - /// \return true if feature or result belong to this composite feature as subs. + /// \return true if feature or result belong to this composite feature as + /// subs. FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const; - /// This method to inform that sub-feature is removed and must be removed from the internal data - /// structures of the owner (the remove from the document will be done outside just after). - FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr theFeature); + /// This method to inform that sub-feature is removed and must be removed from + /// the internal data structures of the owner (the remove from the document + /// will be done outside just after). + FEATURESPLUGIN_EXPORT virtual void + removeFeature(std::shared_ptr theFeature); protected: - enum InitFlags { - InitSketchLauncher = 1 << 0, - InitBaseObjectsList = 1 << 1 - }; + enum InitFlags { InitSketchLauncher = 1 << 0, InitBaseObjectsList = 1 << 1 }; FeaturesPlugin_CompositeSketch(){}; @@ -78,9 +78,11 @@ protected: void initCompositeSketchAttribtues(const int theInitFlags); /// \brief Returns list of base shapes. - /// \param[out] theBaseShapesList list of base shapes (warning: list not cleared). - /// \param[in] theIsMakeShells if true make shells from faces with shared edges. - void getBaseShapes(ListOfShape& theBaseShapesList, const bool theIsMakeShells = true); + /// \param[out] theBaseShapesList list of base shapes (warning: list not + /// cleared). \param[in] theIsMakeShells if true make shells from faces with + /// shared edges. + void getBaseShapes(ListOfShape &theBaseShapesList, + const bool theIsMakeShells = true); /// Stores result of generation. void storeResult(const GeomShapePtr theBaseShape, @@ -88,19 +90,19 @@ protected: const int theIndex = 0); /// Stores generation history. - void storeGenerationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape); + void storeGenerationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape); /// Used to store from and to shapes: generated, or in common modified tag void storeShapes(const std::shared_ptr theMakeShape, ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theBaseShapeType, - const ListOfShape& theShapes, - const std::string theName); + const ListOfShape &theShapes, const std::string theName); private: - std::string myCurrentSelectionType; //< type of selection (vertex, edge or face) + std::string + myCurrentSelectionType; //< type of selection (vertex, edge or face) }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp b/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp index 5a804a522..b4425f36b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp @@ -14,23 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Copy.h" -#include #include +#include #include +#include #include #include -#include #include -void FeaturesPlugin_Copy::initAttributes() -{ +void FeaturesPlugin_Copy::initAttributes() { data()->addAttribute(OBJECTS(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(NUMBER(), ModelAPI_AttributeInteger::typeId()); } @@ -39,9 +39,11 @@ static GeomShapePtr shapeOfSelection(AttributeSelectionPtr theSel) { GeomShapePtr aResult; FeaturePtr aSelFeature = theSel->contextFeature(); if (aSelFeature.get()) { - if (aSelFeature->results().empty()) // if selected feature has no results, make nothing + if (aSelFeature->results() + .empty()) // if selected feature has no results, make nothing return aResult; - if (aSelFeature->results().size() == 1) { // for one sub-result don't make compound + if (aSelFeature->results().size() == + 1) { // for one sub-result don't make compound aResult = aSelFeature->firstResult()->shape(); } } @@ -54,28 +56,31 @@ static GeomShapePtr shapeOfSelection(AttributeSelectionPtr theSel) { return aResult; } -void FeaturesPlugin_Copy::execute() -{ +void FeaturesPlugin_Copy::execute() { int aCopiesNum = integer(NUMBER())->value(); AttributeSelectionListPtr aList = selectionList(OBJECTS()); int aResultIndex = 0; std::set anExistingNames; // to avoid names duplication - for(int aCopy = 0; aCopy < aCopiesNum; aCopy++) { + for (int aCopy = 0; aCopy < aCopiesNum; aCopy++) { for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) { AttributeSelectionPtr aSel = aList->value(aSelIndex); GeomShapePtr aShape = shapeOfSelection(aSel); if (!aShape.get()) continue; - std::shared_ptr aCopyBuilder(new GeomAlgoAPI_Copy(aShape, false, false)); + std::shared_ptr aCopyBuilder( + new GeomAlgoAPI_Copy(aShape, false, false)); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyBuilder, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyBuilder, + getKind(), anError)) { setError(anError); return; } GeomShapePtr aResult = aCopyBuilder->shape(); - std::wstring aBaseName = aSel->context() ? aSel->context()->data()->name() : - aSel->contextFeature()->firstResult()->data()->name(); + std::wstring aBaseName = + aSel->context() + ? aSel->context()->data()->name() + : aSel->contextFeature()->firstResult()->data()->name(); std::wstring aName; int anInd = 0; do { @@ -87,9 +92,10 @@ void FeaturesPlugin_Copy::execute() anExistingNames.insert(aName); std::shared_ptr aResultBody = - document()->createBody(data(), aResultIndex); + document()->createBody(data(), aResultIndex); aResultBody->data()->setName(aName); - // to make sub-results also names with a similar name temporarily rename the feature + // to make sub-results also names with a similar name temporarily rename + // the feature std::wstring anOrigName = name(); data()->setName(aBaseName); aResultBody->store(aResult); @@ -102,40 +108,50 @@ void FeaturesPlugin_Copy::execute() } void FeaturesPlugin_Copy::getCopies( - ObjectPtr theContext, std::shared_ptr theValue, - std::list& theCopyContext, std::list >& theCopyVals) -{ - ResultPtr aContextRes = std::dynamic_pointer_cast(theContext); + ObjectPtr theContext, std::shared_ptr theValue, + std::list &theCopyContext, + std::list> &theCopyVals) { + ResultPtr aContextRes = + std::dynamic_pointer_cast(theContext); GeomShapePtr aGroupValue = theValue.get() ? theValue : aContextRes->shape(); AttributeSelectionListPtr aList = selectionList(OBJECTS()); std::list::const_iterator aResIter = results().cbegin(); - while(aResIter != results().cend()) { // do as long as many iterations + while (aResIter != results().cend()) { // do as long as many iterations for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) { - if (aResIter == results().cend()) // no more results corresponding to the selection + if (aResIter == + results().cend()) // no more results corresponding to the selection return; AttributeSelectionPtr aSel = aList->value(aSelIndex); GeomShapePtr aShape = shapeOfSelection(aSel); if (!aShape.get()) continue; - if (aShape->isSubShape(aGroupValue, false)) { // group value is subshape of copied => copy - // search the same result in the copy by the same index of sub-shape in the shape + if (aShape->isSubShape( + aGroupValue, + false)) { // group value is subshape of copied => copy + // search the same result in the copy by the same index of sub-shape in + // the shape GeomAPI_ShapeExplorer anOrigExp(aShape, aGroupValue->shapeType()); - GeomAPI_ShapeExplorer aCopyShape((*aResIter)->shape(), aGroupValue->shapeType()); - for(; anOrigExp.more(); anOrigExp.next(), aCopyShape.next()) { + GeomAPI_ShapeExplorer aCopyShape((*aResIter)->shape(), + aGroupValue->shapeType()); + for (; anOrigExp.more(); anOrigExp.next(), aCopyShape.next()) { if (anOrigExp.current()->isSame(aGroupValue)) { - // searching for sub-result if it is composite result, but context-not + // searching for sub-result if it is composite result, but + // context-not ResultPtr aResContext = *aResIter; - if (aContextRes->shape()->shapeType() > (*aResIter)->shape()->shapeType()) { - ResultBodyPtr aResBody = std::dynamic_pointer_cast(aResContext); + if (aContextRes->shape()->shapeType() > + (*aResIter)->shape()->shapeType()) { + ResultBodyPtr aResBody = + std::dynamic_pointer_cast(aResContext); if (aResBody.get()) { std::list aSubs; ModelAPI_Tools::allSubs(aResBody, aSubs, true); std::list::iterator aSubIter = aSubs.begin(); - for(; aSubIter != aSubs.end(); aSubIter++) { + for (; aSubIter != aSubs.end(); aSubIter++) { GeomShapePtr aSubShape = (*aSubIter)->shape(); - if (aSubShape.get() && aSubShape->isSubShape(aCopyShape.current(), false)) { + if (aSubShape.get() && + aSubShape->isSubShape(aCopyShape.current(), false)) { aResContext = *aSubIter; break; } @@ -143,8 +159,10 @@ void FeaturesPlugin_Copy::getCopies( } } theCopyContext.push_back(aResContext); - theCopyVals.push_back(aResContext->shape()->isSame( - aCopyShape.current()) ? GeomShapePtr() : aCopyShape.current()); + theCopyVals.push_back( + aResContext->shape()->isSame(aCopyShape.current()) + ? GeomShapePtr() + : aCopyShape.current()); break; } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Copy.h b/src/FeaturesPlugin/FeaturesPlugin_Copy.h index f6df35476..10de826b1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Copy.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Copy.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Copy_H_ @@ -26,38 +27,36 @@ /// \class FeaturesPlugin_Copy /// \ingroup Plugins -/// \brief This feature copies the selected results and sub-results (for the whole feature selected -/// all results of this feature are copied). The referenced arguments of this feature are -/// not concealed. The difference with ”Recover” feature is that not concealed results may -/// be selected and in the history behavior: the “Move to the End” of groups will move to -/// all copy-results. +/// \brief This feature copies the selected results and sub-results (for the +/// whole feature selected +/// all results of this feature are copied). The referenced arguments of +/// this feature are not concealed. The difference with ”Recover” feature +/// is that not concealed results may be selected and in the history +/// behavior: the “Move to the End” of groups will move to all +/// copy-results. -class FeaturesPlugin_Copy : public ModelAPI_Feature, public ModelAPI_FeatureCopyInterface -{ +class FeaturesPlugin_Copy : public ModelAPI_Feature, + public ModelAPI_FeatureCopyInterface { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Copy"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Copy::ID(); return MY_KIND; } /// Selection list attribute that contains all copied shapes selection. - inline static const std::string& OBJECTS() - { + inline static const std::string &OBJECTS() { static const std::string MY_OBJECTS("objects"); return MY_OBJECTS; } /// Integer attribute that contains the number of resulting copies needed - inline static const std::string NUMBER() - { + inline static const std::string NUMBER() { static std::string MY_NUMBER("number"); return MY_NUMBER; } @@ -65,13 +64,16 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// To update the group feature which is moved over this copy feature (to add copies to selection) - FEATURESPLUGIN_EXPORT virtual void getCopies( - ObjectPtr theContext, std::shared_ptr theValue, - std::list& theCopyContext, std::list >& theCopyVals); + /// To update the group feature which is moved over this copy feature (to add + /// copies to selection) + FEATURESPLUGIN_EXPORT virtual void + getCopies(ObjectPtr theContext, std::shared_ptr theValue, + std::list &theCopyContext, + std::list> &theCopyVals); /// Use plugin manager for features creation. FeaturesPlugin_Copy() {} diff --git a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp index 037e5ef96..8db92f508 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -31,27 +32,25 @@ #include +FeaturesPlugin_Defeaturing::FeaturesPlugin_Defeaturing() {} -FeaturesPlugin_Defeaturing::FeaturesPlugin_Defeaturing() -{ +void FeaturesPlugin_Defeaturing::initAttributes() { + data()->addAttribute(OBJECT_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); } -void FeaturesPlugin_Defeaturing::initAttributes() -{ - data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); -} - - -void FeaturesPlugin_Defeaturing::execute() -{ - typedef std::unordered_map SolidFaces; +void FeaturesPlugin_Defeaturing::execute() { + typedef std::unordered_map + SolidFaces; SolidFaces aBodiesAndFacesToRemove; // getting objects and sort them according to parent solids AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECT_LIST_ID()); - for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); ++anObjectsIndex) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + ++anObjectsIndex) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); GeomShapePtr anObject = anObjectAttr->value(); if (!anObject) return; @@ -78,17 +77,20 @@ void FeaturesPlugin_Defeaturing::execute() anIt != aBodiesAndFacesToRemove.end(); ++anIt) { GeomShapePtr aParent = anIt->first; anAlgo.reset(new GeomAlgoAPI_Defeaturing(aParent, anIt->second)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), + anError)) { setError(anError); return; } GeomShapePtr aResult = anAlgo->shape(); ListOfShape aBaseShapes; - for (GeomAPI_ShapeExplorer anExp(aParent, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) + for (GeomAPI_ShapeExplorer anExp(aParent, GeomAPI_Shape::SOLID); + anExp.more(); anExp.next()) aBaseShapes.push_back(anExp.current()); - std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); + std::shared_ptr aResultBody = + document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(), anAlgo, aResult, "Defeaturing"); @@ -101,14 +103,17 @@ void FeaturesPlugin_Defeaturing::execute() aRBA.makeShape = anAlgo; aResultBaseAlgoList.push_back(aRBA); aResultShapesList.push_back(aResult); - anOriginalShapesList.insert(anOriginalShapesList.end(), aBaseShapes.begin(), aBaseShapes.end()); + anOriginalShapesList.insert(anOriginalShapesList.end(), aBaseShapes.begin(), + aBaseShapes.end()); } - // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one - // result shape has been deleted, but in another it was modified or stayed. - GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); - ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, - anOriginalShapesList, aResultShapesCompound); + // Store deleted shapes after all results has been proceeded. This is to avoid + // issue when in one result shape has been deleted, but in another it was + // modified or stayed. + GeomShapePtr aResultShapesCompound = + GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); + ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList, anOriginalShapesList, + aResultShapesCompound); removeResults(aResultIndex); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h index 4b16fc64d..8b0817c90 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Defeaturing_H_ @@ -29,27 +30,24 @@ class GeomAPI_Shape; /// \class FeaturesPlugin_Defeaturing /// \ingroup Plugins -/// \brief Feature for the removal of the unwanted parts or features from the model. -class FeaturesPlugin_Defeaturing : public ModelAPI_Feature -{ +/// \brief Feature for the removal of the unwanted parts or features from the +/// model. +class FeaturesPlugin_Defeaturing : public ModelAPI_Feature { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Defeaturing"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Defeaturing::ID(); return MY_KIND; } /// Attribute name of main objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } @@ -57,7 +55,8 @@ public: /// Performs the defeaturing algorithm and stores it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -68,7 +67,7 @@ private: void loadNamingDS(std::shared_ptr theResultBody, const std::shared_ptr theBaseShape, const std::shared_ptr theResultShape, - const std::shared_ptr& theMakeShape); + const std::shared_ptr &theMakeShape); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index 53002bc15..86a4731f9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Extrusion.h" @@ -23,8 +24,8 @@ #include #include #include -#include #include +#include #include #include @@ -35,13 +36,10 @@ #include //================================================================================================= -FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() -{ -} +FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() {} //================================================================================================= -void FeaturesPlugin_Extrusion::initAttributes() -{ +void FeaturesPlugin_Extrusion::initAttributes() { initCompositeSketchAttribtues(InitBaseObjectsList); data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); @@ -55,23 +53,26 @@ void FeaturesPlugin_Extrusion::initAttributes() data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(DIRECTION_OBJECT_ID(), + ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), DIRECTION_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), FROM_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), DIRECTION_OBJECT_ID()); initCompositeSketchAttribtues(InitSketchLauncher); } //================================================================================================= -void FeaturesPlugin_Extrusion::execute() -{ +void FeaturesPlugin_Extrusion::execute() { ListOfShape aBaseShapesList, aBoundaryShapes; ListOfMakeShape aMakeShapesList; // Make extrusions. - if(!makeExtrusions(aBaseShapesList, aBoundaryShapes, aMakeShapesList)) { + if (!makeExtrusions(aBaseShapesList, aBoundaryShapes, aMakeShapesList)) { return; } @@ -79,28 +80,29 @@ void FeaturesPlugin_Extrusion::execute() int aResultIndex = 0; ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin(); ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin(); - for(; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); - ++aBaseIt, ++anAlgoIt) { + for (; + aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); + ++aBaseIt, ++anAlgoIt) { if (aBoundaryShapes.empty()) storeResult(*aBaseIt, *anAlgoIt, aResultIndex++); else - storeResultWithBoundaries(*aBaseIt, aBoundaryShapes, *anAlgoIt, aResultIndex++); + storeResultWithBoundaries(*aBaseIt, aBoundaryShapes, *anAlgoIt, + aResultIndex++); } removeResults(aResultIndex); } //================================================================================================= -bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, - ListOfShape& theBoundaryShapes, - ListOfMakeShape& theMakeShapes) -{ +bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape &theBaseShapes, + ListOfShape &theBoundaryShapes, + ListOfMakeShape &theMakeShapes) { theMakeShapes.clear(); // Getting base shapes. getBaseShapes(theBaseShapes); - //Getting direction. + // Getting direction. std::shared_ptr aDir; getDirection(aDir); @@ -113,11 +115,11 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, GeomShapePtr aToShape; GeomShapePtr aFromShape; - if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { + if (string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { AttributeSelectionPtr aSelection = selection(TO_OBJECT_ID()); - if(aSelection.get()) { + if (aSelection.get()) { aToShape = std::dynamic_pointer_cast(aSelection->value()); - if(!aToShape.get() && aSelection->context().get()) { + if (!aToShape.get() && aSelection->context().get()) { aToShape = aSelection->context()->shape(); } if (aToShape.get() && aToShape->isCompound()) { @@ -126,9 +128,10 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, } } aSelection = selection(FROM_OBJECT_ID()); - if(aSelection.get()) { - aFromShape = std::dynamic_pointer_cast(aSelection->value()); - if(!aFromShape.get() && aSelection->context().get()) { + if (aSelection.get()) { + aFromShape = + std::dynamic_pointer_cast(aSelection->value()); + if (!aFromShape.get() && aSelection->context().get()) { aFromShape = aSelection->context()->shape(); } if (aFromShape.get() && aFromShape->isCompound()) { @@ -144,14 +147,14 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, // Generating result for each base shape. std::string anError; - for(ListOfShape::const_iterator - anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) { + for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); + anIter != theBaseShapes.cend(); anIter++) { std::shared_ptr aBaseShape = *anIter; - std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, aDir, - aToShape, aToSize, - aFromShape, aFromSize)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(), anError)) { + std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism( + aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize)); + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(), + anError)) { setError(anError); return false; } @@ -164,17 +167,16 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, //================================================================================================= void FeaturesPlugin_Extrusion::storeResultWithBoundaries( - const GeomShapePtr theBaseShape, - const ListOfShape& theBoundaryShapes, + const GeomShapePtr theBaseShape, const ListOfShape &theBoundaryShapes, const std::shared_ptr theMakeShape, - const int theIndex) -{ + const int theIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theIndex); // Store modified shapes. - ModelAPI_Tools::loadModifiedShapes(aResultBody, theBoundaryShapes, ListOfShape(), - theMakeShape, theMakeShape->shape()); + ModelAPI_Tools::loadModifiedShapes(aResultBody, theBoundaryShapes, + ListOfShape(), theMakeShape, + theMakeShape->shape()); // Store generated edges/faces. storeGenerationHistory(aResultBody, theBaseShape, theMakeShape); @@ -183,9 +185,10 @@ void FeaturesPlugin_Extrusion::storeResultWithBoundaries( } //================================================================================================= -void FeaturesPlugin_Extrusion::getDirection(std::shared_ptr& theDir) -{ - static const std::string aSelectionError = "Error: The direction shape selection is bad."; +void FeaturesPlugin_Extrusion::getDirection( + std::shared_ptr &theDir) { + static const std::string aSelectionError = + "Error: The direction shape selection is bad."; AttributeSelectionPtr aSelection = selection(DIRECTION_OBJECT_ID()); GeomShapePtr aShape = aSelection->value(); if (!aShape.get()) { @@ -196,12 +199,9 @@ void FeaturesPlugin_Extrusion::getDirection(std::shared_ptr& theDir GeomEdgePtr anEdge; if (aShape.get()) { - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } @@ -215,12 +215,13 @@ void FeaturesPlugin_Extrusion::getDirection(std::shared_ptr& theDir } //================================================================================================= -void FeaturesPlugin_Extrusion::getSizes(double& theToSize, double& theFromSize) -{ +void FeaturesPlugin_Extrusion::getSizes(double &theToSize, + double &theFromSize) { if (string(CREATION_METHOD())->value() == CREATION_METHOD_BY_SIZES()) { theToSize = real(TO_SIZE_ID())->value(); theFromSize = real(FROM_SIZE_ID())->value(); - } else if (string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { + } else if (string(CREATION_METHOD())->value() == + CREATION_METHOD_BY_PLANES()) { theToSize = real(TO_OFFSET_ID())->value(); theFromSize = real(FROM_OFFSET_ID())->value(); } else { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h index 5f742eacd..f55afcaf5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Extrusion_H_ @@ -30,107 +31,95 @@ /// \ingroup Plugins /// \brief Feature for creation of extrusion from the planar face. /// Extrusion creates the lateral faces based on edges of the base face and -/// the top and bottom faces equal to the base face or this faces can be projection on the -/// bounding planes if they were set. Direction of extrusion is taken from the face -/// plane or if the bounding faces were set then it will be from the bottom to the top plane. -class FeaturesPlugin_Extrusion: public FeaturesPlugin_CompositeSketch -{ +/// the top and bottom faces equal to the base face or this faces can be +/// projection on the bounding planes if they were set. Direction of extrusion +/// is taken from the face plane or if the bounding faces were set then it will +/// be from the bottom to the top plane. +class FeaturesPlugin_Extrusion : public FeaturesPlugin_CompositeSketch { public: /// Use plugin manager for features creation FeaturesPlugin_Extrusion(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Extrusion"); return MY_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_SIZES() - { + inline static const std::string &CREATION_METHOD_BY_SIZES() { static const std::string MY_CREATION_METHOD_BY_SIZES("BySizes"); return MY_CREATION_METHOD_BY_SIZES; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_PLANES() - { + inline static const std::string &CREATION_METHOD_BY_PLANES() { static const std::string MY_CREATION_METHOD_BY_PLANES("ByPlanesAndOffsets"); return MY_CREATION_METHOD_BY_PLANES; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_THROUGH_ALL() - { + inline static const std::string &CREATION_METHOD_THROUGH_ALL() { static const std::string MY_CREATION_METHOD_THROUGH_ALL("ThroughAll"); return MY_CREATION_METHOD_THROUGH_ALL; } /// Attribute name of an object to which the extrusion grows. - inline static const std::string& DIRECTION_OBJECT_ID() - { + inline static const std::string &DIRECTION_OBJECT_ID() { static const std::string MY_DIRECTION_OBJECT_ID("direction_object"); return MY_DIRECTION_OBJECT_ID; } /// Attribute name of extrusion to size. - inline static const std::string& TO_SIZE_ID() - { + inline static const std::string &TO_SIZE_ID() { static const std::string MY_TO_SIZE_ID("to_size"); return MY_TO_SIZE_ID; } /// Attribute name of extrusion from size. - inline static const std::string& FROM_SIZE_ID() - { + inline static const std::string &FROM_SIZE_ID() { static const std::string MY_FROM_SIZE_ID("from_size"); return MY_FROM_SIZE_ID; } /// Attribute name of an object to which the extrusion grows. - inline static const std::string& TO_OBJECT_ID() - { + inline static const std::string &TO_OBJECT_ID() { static const std::string MY_TO_OBJECT_ID("to_object"); return MY_TO_OBJECT_ID; } /// Attribute name of extrusion offset. - inline static const std::string& TO_OFFSET_ID() - { + inline static const std::string &TO_OFFSET_ID() { static const std::string MY_TO_OFFSET_ID("to_offset"); return MY_TO_OFFSET_ID; } /// Attribute name of an object from which the extrusion grows. - inline static const std::string& FROM_OBJECT_ID() - { + inline static const std::string &FROM_OBJECT_ID() { static const std::string MY_FROM_OBJECT_ID("from_object"); return MY_FROM_OBJECT_ID; } /// Attribute name of extrusion offset. - inline static const std::string& FROM_OFFSET_ID() - { + inline static const std::string &FROM_OFFSET_ID() { static const std::string MY_FROM_OFFSET_ID("from_offset"); return MY_FROM_OFFSET_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Extrusion::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results it in the data structure. @@ -142,21 +131,21 @@ protected: /// \param[out] theBoundaryShapes list of faces limiting the extrusion /// \param[out] theMakeShapes list of according algos. /// \return false in case one of algo failed. - bool makeExtrusions(ListOfShape& theBaseShapes, - ListOfShape& theBoundaryShapes, - ListOfMakeShape& theMakeShapes); + bool makeExtrusions(ListOfShape &theBaseShapes, + ListOfShape &theBoundaryShapes, + ListOfMakeShape &theMakeShapes); /// Stores result of generation. - void storeResultWithBoundaries(const GeomShapePtr theBaseShape, - const ListOfShape& theBoundaryShapes, - const std::shared_ptr theMakeShape, - const int theIndex = 0); + void storeResultWithBoundaries( + const GeomShapePtr theBaseShape, const ListOfShape &theBoundaryShapes, + const std::shared_ptr theMakeShape, + const int theIndex = 0); /// Retrieve direction argument. - void getDirection(std::shared_ptr& theDir); + void getDirection(std::shared_ptr &theDir); /// Retrieve or calculate prism sizes. - virtual void getSizes(double& theToSize, double& theFromSize); + virtual void getSizes(double &theToSize, double &theFromSize); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp index 565bc52d3..b1c28d99d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_ExtrusionBoolean.h" @@ -25,40 +26,41 @@ #include //================================================================================================= -void FeaturesPlugin_ExtrusionBoolean::initAttributes() -{ +void FeaturesPlugin_ExtrusionBoolean::initAttributes() { FeaturesPlugin_Extrusion::initAttributes(); initBooleanAttributes(); } //================================================================================================= -bool FeaturesPlugin_ExtrusionBoolean::makeGeneration(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes) -{ +bool FeaturesPlugin_ExtrusionBoolean::makeGeneration( + ListOfShape &theBaseShapes, ListOfMakeShape &theMakeShapes) { ListOfShape aBoundaryShapes; return makeExtrusions(theBaseShapes, aBoundaryShapes, theMakeShapes); } //================================================================================================= -void FeaturesPlugin_ExtrusionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape) -{ - FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape); +void FeaturesPlugin_ExtrusionBoolean::storeGenerationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape) { + FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, + theMakeShape); } //================================================================================================= -void FeaturesPlugin_ExtrusionBoolean::getSizes(double& theToSize, double& theFromSize) -{ +void FeaturesPlugin_ExtrusionBoolean::getSizes(double &theToSize, + double &theFromSize) { if (string(CREATION_METHOD())->value() != CREATION_METHOD_THROUGH_ALL()) { FeaturesPlugin_Extrusion::getSizes(theToSize, theFromSize); } else { // Getting objects. ListOfShape anObjects; - AttributeSelectionListPtr anObjectsSelList = myFeature->selectionList(OBJECTS_ID()); - for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + AttributeSelectionListPtr anObjectsSelList = + myFeature->selectionList(OBJECTS_ID()); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + anObjectsIndex++) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); GeomShapePtr anObject = anObjectAttr->value(); if (!anObject.get()) { myFeature->setError("Error: Could not get object."); @@ -76,6 +78,7 @@ void FeaturesPlugin_ExtrusionBoolean::getSizes(double& theToSize, double& theFro getDirection(aDir); // Calculate sizes - GeomAlgoAPI_ShapeTools::computeThroughAll(anObjects, aBaseShapes, aDir, theToSize, theFromSize); + GeomAlgoAPI_ShapeTools::computeThroughAll(anObjects, aBaseShapes, aDir, + theToSize, theFromSize); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h index a56e651f3..cca1e98ab 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h @@ -14,40 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_ExtrusionBoolean_H_ #define FeaturesPlugin_ExtrusionBoolean_H_ -#include "FeaturesPlugin_Extrusion.h" #include "FeaturesPlugin_CompositeBoolean.h" +#include "FeaturesPlugin_Extrusion.h" /// \class FeaturesPlugin_ExtrusionBoolean /// \ingroup Plugins /// \brief Interface for the composite extrusion feature. -class FeaturesPlugin_ExtrusionBoolean: public FeaturesPlugin_Extrusion, - public FeaturesPlugin_CompositeBoolean -{ +class FeaturesPlugin_ExtrusionBoolean : public FeaturesPlugin_Extrusion, + public FeaturesPlugin_CompositeBoolean { public: - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); protected: FeaturesPlugin_ExtrusionBoolean(){}; // Creates extrusions. - bool makeGeneration(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes); + bool makeGeneration(ListOfShape &theBaseShapes, + ListOfMakeShape &theMakeShapes); /// Stores generation history. - void storeGenerationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape); + void storeGenerationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape); /// Calculate prism sizes to ensure that it passes through all objects /// Redefined from FeaturesPlugin_Extrusion - virtual void getSizes(double& theToSize, double& theFromSize); + virtual void getSizes(double &theToSize, double &theFromSize); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp index a28ecdc0a..6dd93eddd 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp @@ -14,20 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_ExtrusionCut.h" //================================================================================================= -FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut() -{ +FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut() { myFeature = this; myOperationType = BOOL_CUT; } //================================================================================================= -void FeaturesPlugin_ExtrusionCut::execute() -{ - executeCompositeBoolean(); -} +void FeaturesPlugin_ExtrusionCut::execute() { executeCompositeBoolean(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h index 52b877998..294011aef 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_ExtrusionCut_H_ @@ -24,24 +25,22 @@ /// \class FeaturesPlugin_ExtrusionCut /// \ingroup Plugins -/// \brief This feature allows to create sketch, extrude faces from this sketch and +/// \brief This feature allows to create sketch, extrude faces from this sketch +/// and /// cut result from other objects in a single operation. -class FeaturesPlugin_ExtrusionCut : public FeaturesPlugin_ExtrusionBoolean -{ +class FeaturesPlugin_ExtrusionCut : public FeaturesPlugin_ExtrusionBoolean { public: /// Use plugin manager for features creation. FeaturesPlugin_ExtrusionCut(); - /// Feature kind. - inline static const std::string& ID() - { + /// Feature kind. + inline static const std::string &ID() { static const std::string MY_EXTRUSION_ID("ExtrusionCut"); return MY_EXTRUSION_ID; } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID(); return MY_KIND; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp index 379fd76c3..5596730a7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp @@ -14,29 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_ExtrusionFuse.h" -#include #include +#include #include +#include #include #include -#include //================================================================================================= -FeaturesPlugin_ExtrusionFuse::FeaturesPlugin_ExtrusionFuse() -{ +FeaturesPlugin_ExtrusionFuse::FeaturesPlugin_ExtrusionFuse() { myFeature = this; myOperationType = BOOL_FUSE; } //================================================================================================= -void FeaturesPlugin_ExtrusionFuse::execute() -{ +void FeaturesPlugin_ExtrusionFuse::execute() { if (string(CREATION_METHOD())->value() != CREATION_METHOD_THROUGH_ALL()) executeCompositeBoolean(); else { @@ -45,13 +44,15 @@ void FeaturesPlugin_ExtrusionFuse::execute() } //================================================================================================= -void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() -{ +void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() { // Getting objects. ListOfShape anObjects; - AttributeSelectionListPtr anObjectsSelList = myFeature->selectionList(OBJECTS_ID()); - for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + AttributeSelectionListPtr anObjectsSelList = + myFeature->selectionList(OBJECTS_ID()); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + anObjectsIndex++) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); GeomShapePtr anObject = anObjectAttr->value(); if (!anObject.get()) { myFeature->setError("Error: Could not get object."); @@ -70,18 +71,19 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() // Getting tools. ListOfShape aNewTools; ListOfMakeShape aToolsMakeShapes; - for (ListOfMakeShape::const_iterator - anIt = aGenMakeShapes.cbegin(); anIt != aGenMakeShapes.cend(); ++anIt) { + for (ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin(); + anIt != aGenMakeShapes.cend(); ++anIt) { GeomMakeShapePtr anAlgo = (*anIt); std::shared_ptr aPrismAlgo = std::dynamic_pointer_cast(anAlgo); // Cut the prism by all objects and throw away end pieces - std::shared_ptr aToolAlgo ( + std::shared_ptr aToolAlgo( new GeomAlgoAPI_ThroughAll(aPrismAlgo, anObjects)); // Checking that the algorithm worked properly - if (!aToolAlgo->isDone() || aToolAlgo->shape()->isNull() || !aToolAlgo->isValid()) { + if (!aToolAlgo->isDone() || aToolAlgo->shape()->isNull() || + !aToolAlgo->isValid()) { myFeature->setError("Error: ThroughAll algorithm failed."); } else { GeomShapePtr aCuttedTool = aToolAlgo->shape(); @@ -90,7 +92,8 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() } } - // Perform FeaturesPlugin_CompositeBoolean::makeBoolean() with new (cutted) tools + // Perform FeaturesPlugin_CompositeBoolean::makeBoolean() with new (cutted) + // tools ListOfShape aBooleanObjects; ListOfMakeShape aBooleanMakeShapes; if (!makeBoolean(aNewTools, aBooleanObjects, aBooleanMakeShapes)) { @@ -99,37 +102,41 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() if (myOperationType == BOOL_FUSE) { aNewTools.splice(aNewTools.begin(), aBooleanObjects); - aBooleanObjects.splice(aBooleanObjects.begin(), aNewTools, aNewTools.begin()); + aBooleanObjects.splice(aBooleanObjects.begin(), aNewTools, + aNewTools.begin()); } - // 4. Store result (like in FeaturesPlugin_CompositeBoolean::executeCompositeBoolean()) + // 4. Store result (like in + // FeaturesPlugin_CompositeBoolean::executeCompositeBoolean()) int aResultIndex = 0; std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; ListOfShape::const_iterator aBoolObjIt = aBooleanObjects.cbegin(); ListOfMakeShape::const_iterator aBoolMSIt = aBooleanMakeShapes.cbegin(); - for(; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend(); - ++aBoolObjIt, ++aBoolMSIt) { + for (; aBoolObjIt != aBooleanObjects.cend() && + aBoolMSIt != aBooleanMakeShapes.cend(); + ++aBoolObjIt, ++aBoolMSIt) { - ResultBodyPtr aResultBody = myFeature->document()->createBody(myFeature->data(), aResultIndex); + ResultBodyPtr aResultBody = + myFeature->document()->createBody(myFeature->data(), aResultIndex); - if((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) { + if ((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) { aResultBody->store((*aBoolMSIt)->shape(), false); - } - else - { + } else { aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape()); // Store generation history. ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin(); ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin(); - for(; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend(); - ++aGenBaseIt, ++aGenMSIt) { + for (; aGenBaseIt != aGenBaseShapes.cend() && + aGenMSIt != aGenMakeShapes.cend(); + ++aGenBaseIt, ++aGenMSIt) { // ??? ListOfMakeShape::const_iterator aToolsMSIt = aToolsMakeShapes.cbegin(); - for(; aToolsMSIt != aToolsMakeShapes.cend(); ++aToolsMSIt) { - std::shared_ptr aMSList(new GeomAlgoAPI_MakeShapeList()); + for (; aToolsMSIt != aToolsMakeShapes.cend(); ++aToolsMSIt) { + std::shared_ptr aMSList( + new GeomAlgoAPI_MakeShapeList()); // prism generation aMSList->appendAlgo(*aGenMSIt); @@ -156,9 +163,11 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() myFeature->setResult(aResultBody, aResultIndex++); } - // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one - // result shape has been deleted, but in another it was modified or stayed. - GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); + // Store deleted shapes after all results has been proceeded. This is to avoid + // issue when in one result shape has been deleted, but in another it was + // modified or stayed. + GeomShapePtr aResultShapesCompound = + GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); storeDeletedShapes(aResultBaseAlgoList, aNewTools, aResultShapesCompound); myFeature->removeResults(aResultIndex); diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h index 39c0415d7..9c9768e30 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_ExtrusionFuse_H_ @@ -24,24 +25,22 @@ /// \class FeaturesPlugin_ExtrusionFuse /// \ingroup Plugins -/// \brief This feature allows to create sketch, extrude faces from this sketch and +/// \brief This feature allows to create sketch, extrude faces from this sketch +/// and /// fuse result with other objects in a single operation. -class FeaturesPlugin_ExtrusionFuse : public FeaturesPlugin_ExtrusionBoolean -{ - public: +class FeaturesPlugin_ExtrusionFuse : public FeaturesPlugin_ExtrusionBoolean { +public: /// Use plugin manager for features creation. FeaturesPlugin_ExtrusionFuse(); - /// Feature kind. - inline static const std::string& ID() - { + /// Feature kind. + inline static const std::string &ID() { static const std::string MY_EXTRUSION_ID("ExtrusionFuse"); return MY_EXTRUSION_ID; } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_ExtrusionFuse::ID(); return MY_KIND; } @@ -49,7 +48,7 @@ class FeaturesPlugin_ExtrusionFuse : public FeaturesPlugin_ExtrusionBoolean /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - private: +private: void executeFuseThroughAll(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp index f922a5212..e87842b67 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Fillet.h" @@ -32,52 +33,49 @@ #include // Extract edges from the list -static ListOfShape extractEdges(const ListOfShape& theShapes) -{ +static ListOfShape extractEdges(const ListOfShape &theShapes) { ListOfShape anEdges; - for (ListOfShape::const_iterator anIt = theShapes.begin(); anIt != theShapes.end(); ++anIt) - for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) + for (ListOfShape::const_iterator anIt = theShapes.begin(); + anIt != theShapes.end(); ++anIt) + for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) anEdges.push_back(anExp.current()); return anEdges; } +FeaturesPlugin_Fillet::FeaturesPlugin_Fillet() {} -FeaturesPlugin_Fillet::FeaturesPlugin_Fillet() -{ -} - -void FeaturesPlugin_Fillet::initAttributes() -{ +void FeaturesPlugin_Fillet::initAttributes() { data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - AttributePtr aSelectionList = - data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + AttributePtr aSelectionList = data()->addAttribute( + OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(START_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(END_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), END_RADIUS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + END_RADIUS_ID()); initVersion(aSelectionList); } -AttributePtr FeaturesPlugin_Fillet::objectsAttribute() -{ +AttributePtr FeaturesPlugin_Fillet::objectsAttribute() { return attribute(OBJECT_LIST_ID()); } -const std::string& FeaturesPlugin_Fillet::modifiedShapePrefix() const -{ - static const std::string& THE_PREFIX("Fillet"); +const std::string &FeaturesPlugin_Fillet::modifiedShapePrefix() const { + static const std::string &THE_PREFIX("Fillet"); return THE_PREFIX; } -GeomMakeShapePtr FeaturesPlugin_Fillet::performOperation(const GeomShapePtr& theSolid, - const ListOfShape& theEdges) -{ +GeomMakeShapePtr +FeaturesPlugin_Fillet::performOperation(const GeomShapePtr &theSolid, + const ListOfShape &theEdges) { AttributeStringPtr aCreationMethod = string(CREATION_METHOD()); if (!aCreationMethod) return GeomMakeShapePtr(); - bool isFixedRadius = aCreationMethod->value() == CREATION_METHOD_SINGLE_RADIUS(); + bool isFixedRadius = + aCreationMethod->value() == CREATION_METHOD_SINGLE_RADIUS(); double aRadius1 = 0.0, aRadius2 = 0.0; if (isFixedRadius) aRadius1 = real(RADIUS_ID())->value(); @@ -92,11 +90,14 @@ GeomMakeShapePtr FeaturesPlugin_Fillet::performOperation(const GeomShapePtr& the ListOfShape aFilletEdges = extractEdges(theEdges); if (isFixedRadius) - aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1)); + aFilletBuilder.reset( + new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1)); else - aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1, aRadius2)); + aFilletBuilder.reset( + new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1, aRadius2)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), + anError)) { setError(anError); return GeomMakeShapePtr(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h index 18176d4c1..2a943a197 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Fillet_H_ @@ -26,69 +27,58 @@ /// \ingroup Plugins /// \brief Feature for applying the Fillet operations on Solids. /// Supports fixed radius fillet and varying 2-radius fillet. -class FeaturesPlugin_Fillet : public FeaturesPlugin_VersionedChFi -{ +class FeaturesPlugin_Fillet : public FeaturesPlugin_VersionedChFi { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Fillet"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Fillet::ID(); return MY_KIND; } - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static std::string MY_CREATION_METHOD("creation_method"); return MY_CREATION_METHOD; } - inline static const std::string CREATION_METHOD_SINGLE_RADIUS() - { + inline static const std::string CREATION_METHOD_SINGLE_RADIUS() { static std::string MY_SINGLE_RADIUS("fixed_radius"); return MY_SINGLE_RADIUS; } - inline static const std::string CREATION_METHOD_VARYING_RADIUS() - { + inline static const std::string CREATION_METHOD_VARYING_RADIUS() { static std::string MY_VARYING_RADIUS("variable_radius"); return MY_VARYING_RADIUS; } /// Attribute name of main objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } /// Attribute name of start radius. - inline static const std::string& START_RADIUS_ID() - { + inline static const std::string &START_RADIUS_ID() { static const std::string MY_START_RADIUS_ID("radius1"); return MY_START_RADIUS_ID; } /// Attribute name of end radius. - inline static const std::string& END_RADIUS_ID() - { + inline static const std::string &END_RADIUS_ID() { static const std::string MY_END_RADIUS_ID("radius2"); return MY_END_RADIUS_ID; } /// Attribute name of a radius for fillet with fixed radius. - inline static const std::string& RADIUS_ID() - { - return START_RADIUS_ID(); - } + inline static const std::string &RADIUS_ID() { return START_RADIUS_ID(); } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -99,11 +89,12 @@ private: virtual std::shared_ptr objectsAttribute(); /// Return name of modified shape prefix name - virtual const std::string& modifiedShapePrefix() const; + virtual const std::string &modifiedShapePrefix() const; - /// Run chamfer/fillet operation and returns the modification algorithm if succeed. + /// Run chamfer/fillet operation and returns the modification algorithm if + /// succeed. virtual std::shared_ptr - performOperation(const GeomShapePtr& theSolid, const ListOfShape& theEdges); + performOperation(const GeomShapePtr &theSolid, const ListOfShape &theEdges); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp index 9bef63f57..6ef6857c2 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -34,42 +35,40 @@ #include #include -void sendMessageWithFailedShapes(const ListOfShape& theVertices) -{ +void sendMessageWithFailedShapes(const ListOfShape &theVertices) { std::shared_ptr aMessage( - new ModelAPI_ShapesFailedMessage(Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED))); + new ModelAPI_ShapesFailedMessage( + Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED))); aMessage->setShapes(theVertices); Events_Loop::loop()->send(aMessage); } -FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() -{ -} +FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() {} -void FeaturesPlugin_Fillet1D::initAttributes() -{ +void FeaturesPlugin_Fillet1D::initAttributes() { data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(WIRE_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(VERTEX_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(WIRE_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(VERTEX_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); } -void FeaturesPlugin_Fillet1D::execute() -{ +void FeaturesPlugin_Fillet1D::execute() { ListOfShape aWires; MapShapeSubs aVertices; if (!baseShapes(aWires, aVertices)) return; int aResultIndex = 0; - for (ListOfShape::iterator anIt = aWires.begin(); anIt != aWires.end(); ++anIt) + for (ListOfShape::iterator anIt = aWires.begin(); anIt != aWires.end(); + ++anIt) if (!performFillet(*anIt, aVertices[*anIt], aResultIndex++)) break; removeResults(aResultIndex); } -void FeaturesPlugin_Fillet1D::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_Fillet1D::attributeChanged(const std::string &theID) { if (theID == CREATION_METHOD()) { // creation method is changed, drop failed vertices and send the message removeResults(0); @@ -77,8 +76,8 @@ void FeaturesPlugin_Fillet1D::attributeChanged(const std::string& theID) } } -bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& theWireVertices) -{ +bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape &theWires, + MapShapeSubs &theWireVertices) { std::set aProcessedWires; std::string aMethod = string(CREATION_METHOD())->value(); if (aMethod == CREATION_BY_WIRES()) { @@ -95,8 +94,9 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& th aProcessedWires.insert(aWire); // get vertices applicable for fillet - GeomAlgoAPI_MapShapesAndAncestors aMapVE(aWire, GeomAPI_Shape::VERTEX, GeomAPI_Shape::EDGE); - const MapShapeToShapes& aSubshapes = aMapVE.map(); + GeomAlgoAPI_MapShapesAndAncestors aMapVE(aWire, GeomAPI_Shape::VERTEX, + GeomAPI_Shape::EDGE); + const MapShapeToShapes &aSubshapes = aMapVE.map(); std::set aFilletVertices; for (MapShapeToShapes::const_iterator anIt = aSubshapes.begin(); anIt != aSubshapes.end(); ++anIt) { @@ -128,14 +128,14 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& th // keep the sequence of wires and fillet vertices stable theWires.push_back(aWire); - for (GeomAPI_WireExplorer anExp(aWire->wire()); anExp.more(); anExp.next()) { + for (GeomAPI_WireExplorer anExp(aWire->wire()); anExp.more(); + anExp.next()) { GeomShapePtr aVertex = anExp.currentVertex(); if (aFilletVertices.find(aVertex) != aFilletVertices.end()) theWireVertices[aWire].push_back(aVertex); } } - } - else if (aMethod == CREATION_BY_VERTICES()) { + } else if (aMethod == CREATION_BY_VERTICES()) { AttributeSelectionListPtr aSelList = selectionList(VERTEX_LIST_ID()); int aNbSel = aSelList->size(); for (int ind = 0; ind < aNbSel; ++ind) { @@ -155,10 +155,9 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& th return true; } -bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire, - const ListOfShape& theVertices, - const int theResultIndex) -{ +bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr &theWire, + const ListOfShape &theVertices, + const int theResultIndex) { double aRadius = real(RADIUS_ID())->value(); // perform fillet operation @@ -170,9 +169,11 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire, myFailedVertices = aFilletBuilder->failedVertices(); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), + anError)) { isOk = false; - // in case of vertices, the fillet completed, send message to highlight them in the viewer + // in case of vertices, the fillet completed, send message to highlight them + // in the viewer isSendMessage = true; bool isAllFailed = myFailedVertices.size() == theVertices.size(); setError(anError, isAllFailed); @@ -192,11 +193,14 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire, ListOfShape anOriginal; anOriginal.push_back(theWire); ModelAPI_Tools::loadModifiedShapes(aResult, anOriginal, ListOfShape(), - aFilletBuilder, aFilletBuilder->shape(), THE_PREFIX); + aFilletBuilder, aFilletBuilder->shape(), + THE_PREFIX); setResult(aResult, theResultIndex); // store new edges generated from vertices - for (ListOfShape::const_iterator anIt = theVertices.begin(); anIt != theVertices.end(); ++anIt) - aResult->loadGeneratedShapes(aFilletBuilder, *anIt, GeomAPI_Shape::VERTEX, THE_PREFIX, true); + for (ListOfShape::const_iterator anIt = theVertices.begin(); + anIt != theVertices.end(); ++anIt) + aResult->loadGeneratedShapes(aFilletBuilder, *anIt, GeomAPI_Shape::VERTEX, + THE_PREFIX, true); return isOk; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h index bd8ed37e8..fe60924d0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Fillet1D_H_ @@ -30,70 +31,63 @@ /// \class FeaturesPlugin_Fillet1D /// \ingroup Plugins /// \brief Feature for appling fillet on vertices of 3D wire. -class FeaturesPlugin_Fillet1D : public ModelAPI_Feature -{ - typedef std::map MapShapeSubs; +class FeaturesPlugin_Fillet1D : public ModelAPI_Feature { + typedef std::map + MapShapeSubs; public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Fillet1D"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Fillet1D::ID(); return MY_KIND; } - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static std::string MY_CREATION_METHOD("creation_method"); return MY_CREATION_METHOD; } - inline static const std::string CREATION_BY_WIRES() - { + inline static const std::string CREATION_BY_WIRES() { static std::string MY_SINGLE_RADIUS("by_wires"); return MY_SINGLE_RADIUS; } - inline static const std::string CREATION_BY_VERTICES() - { + inline static const std::string CREATION_BY_VERTICES() { static std::string MY_VARYING_RADIUS("by_vertices"); return MY_VARYING_RADIUS; } /// Attribute name of selected wires. - inline static const std::string& WIRE_LIST_ID() - { + inline static const std::string &WIRE_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_wires"); return MY_OBJECT_LIST_ID; } /// Attribute name of selected vertices. - inline static const std::string& VERTEX_LIST_ID() - { + inline static const std::string &VERTEX_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_vertices"); return MY_OBJECT_LIST_ID; } /// Attribute name of radius. - inline static const std::string& RADIUS_ID() - { + inline static const std::string &RADIUS_ID() { static const std::string MY_RADIUS_ID("radius"); return MY_RADIUS_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Performs the fillet algorithm and stores it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); @@ -104,13 +98,12 @@ public: private: /// Get the list of wires and fillet vertices /// \retun \c false if errors occured - bool baseShapes(ListOfShape& theWires, MapShapeSubs& theWireVertices); + bool baseShapes(ListOfShape &theWires, MapShapeSubs &theWireVertices); /// Run fillet operation and store result. /// \return \c false if fillet failed. - bool performFillet(const GeomShapePtr& theWire, - const ListOfShape& theVertices, - const int theResultIndex); + bool performFillet(const GeomShapePtr &theWire, + const ListOfShape &theVertices, const int theResultIndex); private: ListOfShape myFailedVertices; diff --git a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp index d77104cc9..e04f543ab 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_FusionFaces.h" @@ -24,30 +25,25 @@ #include #include #include -#include #include +#include -#include #include +#include #include #include - //================================================================================================== -FeaturesPlugin_FusionFaces::FeaturesPlugin_FusionFaces() -{ -} +FeaturesPlugin_FusionFaces::FeaturesPlugin_FusionFaces() {} //================================================================================================== -void FeaturesPlugin_FusionFaces::initAttributes() -{ +void FeaturesPlugin_FusionFaces::initAttributes() { data()->addAttribute(BASE_SHAPE_ID(), ModelAPI_AttributeSelection::typeId()); } //================================================================================================== -void FeaturesPlugin_FusionFaces::execute() -{ +void FeaturesPlugin_FusionFaces::execute() { // Get selection. AttributeSelectionPtr aShapeAttrSelection = selection(BASE_SHAPE_ID()); if (!aShapeAttrSelection.get()) { @@ -58,11 +54,13 @@ void FeaturesPlugin_FusionFaces::execute() GeomShapePtr aBaseShape = aShapeAttrSelection->value(); // Make fusion - std::shared_ptr anAlgo(new GeomAlgoAPI_UnifySameDomain(aBaseShape)); + std::shared_ptr anAlgo( + new GeomAlgoAPI_UnifySameDomain(aBaseShape)); // Check algo status std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), + anError)) { setError(anError); return; } @@ -73,7 +71,7 @@ void FeaturesPlugin_FusionFaces::execute() ListOfShape aBaseShapesList; aBaseShapesList.push_back(aBaseShape); - ModelAPI_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, ListOfShape(), - anAlgo, aResultShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, + ListOfShape(), anAlgo, aResultShape); setResult(aResultBody); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h index c59ae6749..ca10c7904 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_FusionFaces_H_ @@ -27,34 +28,31 @@ /// \class FeaturesPlugin_FusionFaces /// \ingroup Plugins /// \brief Feature for fusion of connected faces. -class FeaturesPlugin_FusionFaces : public ModelAPI_Feature -{ +class FeaturesPlugin_FusionFaces : public ModelAPI_Feature { public: /// Use plugin manager for features creation FeaturesPlugin_FusionFaces(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("FusionFaces"); return MY_ID; } /// Attribute name of base shape. - inline static const std::string& BASE_SHAPE_ID() - { + inline static const std::string &BASE_SHAPE_ID() { static const std::string MY_BASE_SHAPE_ID("base_shape"); return MY_BASE_SHAPE_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_FusionFaces::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Executes the faces fusion and stores the modififed shape. diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp index c8d485d1c..464fc5b61 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp @@ -14,13 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_GeometryCalculation.h" -#include #include +#include #include #include @@ -31,44 +32,40 @@ #include #include - #include #include //================================================================================================= -FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() -{ -} +FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() {} //================================================================================================= -void FeaturesPlugin_GeometryCalculation::initAttributes() -{ +void FeaturesPlugin_GeometryCalculation::initAttributes() { // attribute for point selected - data()->addAttribute(OBJECT_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(OBJECT_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for result message and values data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(AREA_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(VOLUME_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + data()->addAttribute(RESULT_VALUES_ID(), + ModelAPI_AttributeDoubleArray::typeId()); data()->realArray(RESULT_VALUES_ID())->setSize(3); - } //================================================================================================= -void FeaturesPlugin_GeometryCalculation::execute() -{ -} +void FeaturesPlugin_GeometryCalculation::execute() {} //================================================================================================= -void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_GeometryCalculation::attributeChanged( + const std::string &theID) { if (theID == OBJECT_SELECTED_ID()) { AttributeSelectionPtr aSelection = selection(OBJECT_SELECTED_ID()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); std::stringstream streamL; std::stringstream streamA; std::stringstream streamV; diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h index 57cbd6be6..f4857bba9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_GeometryCalculation_H_ @@ -30,52 +31,42 @@ /// \ingroup Plugins /// \brief Feature for geometry calculation. -class FeaturesPlugin_GeometryCalculation : public ModelAPI_Feature -{ +class FeaturesPlugin_GeometryCalculation : public ModelAPI_Feature { public: - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("GeometryCalculation"); return MY_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Attribute name for object selected. - inline static const std::string& OBJECT_SELECTED_ID() - { + inline static const std::string &OBJECT_SELECTED_ID() { static const std::string MY_OBJECT_SELECTED_ID("main_object"); return MY_OBJECT_SELECTED_ID; } /// Attribute name for length - inline static const std::string& LENGTH_ID() - { + inline static const std::string &LENGTH_ID() { static const std::string MY_LENGTH_ID("length"); return MY_LENGTH_ID; } /// Attribute name for area - inline static const std::string& AREA_ID() - { + inline static const std::string &AREA_ID() { static const std::string MY_AREA_ID("area"); return MY_AREA_ID; } /// Attribute name for volume. - inline static const std::string& VOLUME_ID() - { + inline static const std::string &VOLUME_ID() { static const std::string MY_VOLUME_ID("volume"); return MY_VOLUME_ID; } /// Attribute name for values of result. - inline static const std::string& RESULT_VALUES_ID() - { + inline static const std::string &RESULT_VALUES_ID() { static const std::string MY_RESULT_VALUES_ID("result_values"); return MY_RESULT_VALUES_ID; } @@ -83,19 +74,19 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// Use plugin manager for features creation FeaturesPlugin_GeometryCalculation(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp index 35b790c72..4df5fcaca 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_GlueFaces.h" @@ -25,11 +26,11 @@ #include #include #include -#include #include +#include -#include #include +#include #include #include @@ -38,36 +39,35 @@ #include - //================================================================================================== -FeaturesPlugin_GlueFaces::FeaturesPlugin_GlueFaces() -{ -} +FeaturesPlugin_GlueFaces::FeaturesPlugin_GlueFaces() {} //================================================================================================== -void FeaturesPlugin_GlueFaces::initAttributes() -{ - data()->addAttribute(OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); +void FeaturesPlugin_GlueFaces::initAttributes() { + data()->addAttribute(OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(TOLERANCE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(KEEP_NON_SOLIDS_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(KEEP_NON_SOLIDS_ID(), + ModelAPI_AttributeBoolean::typeId()); } //================================================================================================== -void FeaturesPlugin_GlueFaces::execute() -{ +void FeaturesPlugin_GlueFaces::execute() { // Collect all selected shapes into a single list of shapes ListOfShape aShapes; getOriginalShapes(OBJECTS_LIST_ID(), aShapes); // Get all other feature arguments double aTolerance = real(FeaturesPlugin_GlueFaces::TOLERANCE_ID())->value(); - bool isKeepNonSolids = boolean(FeaturesPlugin_GlueFaces::KEEP_NON_SOLIDS_ID())->value(); + bool isKeepNonSolids = + boolean(FeaturesPlugin_GlueFaces::KEEP_NON_SOLIDS_ID())->value(); - std::shared_ptr aGluingAlgo(new GeomAlgoAPI_GlueFaces(aShapes, aTolerance, isKeepNonSolids)); + std::shared_ptr aGluingAlgo( + new GeomAlgoAPI_GlueFaces(aShapes, aTolerance, isKeepNonSolids)); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aGluingAlgo, getKind(), anError)) - { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aGluingAlgo, getKind(), + anError)) { setError(anError); eraseResults(); return; @@ -76,8 +76,7 @@ void FeaturesPlugin_GlueFaces::execute() // Store result. GeomShapePtr aResult = aGluingAlgo->shape(); - if (!isGlued(aShapes, aResult)) - { + if (!isGlued(aShapes, aResult)) { static const std::string anError2 = "Error: No faces were glued."; setError(anError2); data()->execState(ModelAPI_ExecState::ModelAPI_StateDone); @@ -93,9 +92,9 @@ void FeaturesPlugin_GlueFaces::execute() // use that compound subshape as the result. if (aResult->typeOfCompoundShapes() == GeomAPI_Shape::COMPSOLID) { ListOfShape aResults; - aResult = GeomAlgoAPI_ShapeTools::combineShapes(aResult, GeomAPI_Shape::COMPSOLID, aResults); - } - else if (aResult->typeOfCompoundShapes() == GeomAPI_Shape::COMPOUND) { + aResult = GeomAlgoAPI_ShapeTools::combineShapes( + aResult, GeomAPI_Shape::COMPSOLID, aResults); + } else if (aResult->typeOfCompoundShapes() == GeomAPI_Shape::COMPOUND) { aResult = aResult->subShapes(GeomAPI_Shape::COMPOUND).front(); } } @@ -107,7 +106,7 @@ void FeaturesPlugin_GlueFaces::execute() // Ensure the result body is named after this feature std::wstring aBaseName = feature(aResultBody)->data()->name(); std::wostringstream aNameStr; - aNameStr << aBaseName << "_" << (anIndex+1); + aNameStr << aBaseName << "_" << (anIndex + 1); std::wstring aName = aNameStr.str(); aResultBody->data()->setName(aName); @@ -115,18 +114,15 @@ void FeaturesPlugin_GlueFaces::execute() } //================================================================================================= -void FeaturesPlugin_GlueFaces::getOriginalShapes(const std::string& theAttributeName, - ListOfShape& theShapes) -{ +void FeaturesPlugin_GlueFaces::getOriginalShapes( + const std::string &theAttributeName, ListOfShape &theShapes) { // Collect all selections into a single list of shapes AttributeSelectionListPtr aSelectionList = selectionList(theAttributeName); - for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) - { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); GeomShapePtr aContext = aSelection->context()->shape(); - if (!aShape.get()) - { + if (!aShape.get()) { aShape = aContext; } theShapes.push_back(aShape); @@ -134,9 +130,8 @@ void FeaturesPlugin_GlueFaces::getOriginalShapes(const std::string& theAttribute } //================================================================================================= -bool FeaturesPlugin_GlueFaces::isGlued(const ListOfShape& theInputs, - const GeomShapePtr theResult) -{ +bool FeaturesPlugin_GlueFaces::isGlued(const ListOfShape &theInputs, + const GeomShapePtr theResult) { if (!theResult.get()) return false; @@ -144,12 +139,9 @@ bool FeaturesPlugin_GlueFaces::isGlued(const ListOfShape& theInputs, // * the total number of faces did NOT change. int nbInputFaces = 0, nbInputEdges = 0; for (ListOfShape::const_iterator anIt = theInputs.cbegin(); - anIt != theInputs.cend(); - ++anIt) - { + anIt != theInputs.cend(); ++anIt) { GeomShapePtr aShape = *anIt; - if (aShape.get()) - { + if (aShape.get()) { nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size(); nbInputEdges += aShape->subShapes(GeomAPI_Shape::EDGE, true).size(); } @@ -158,21 +150,21 @@ bool FeaturesPlugin_GlueFaces::isGlued(const ListOfShape& theInputs, int nbResultFaces = 0, nbResultEdges = 0; nbResultFaces = theResult->subShapes(GeomAPI_Shape::FACE, true).size(); nbResultEdges = theResult->subShapes(GeomAPI_Shape::EDGE, true).size(); - return(0 < nbResultFaces && ((nbResultFaces < nbInputFaces) || (nbResultFaces == nbInputFaces && nbResultEdges < nbInputEdges))); + return (0 < nbResultFaces && + ((nbResultFaces < nbInputFaces) || + (nbResultFaces == nbInputFaces && nbResultEdges < nbInputEdges))); } //================================================================================================= -void FeaturesPlugin_GlueFaces::setResultFromInput(const ListOfShape& theInputs) -{ +void FeaturesPlugin_GlueFaces::setResultFromInput( + const ListOfShape &theInputs) { GeomShapePtr aResult; // Make sure the result will be a compound of the input shapes, if not already - if (theInputs.size() == 1 && theInputs.front().get() && theInputs.front()->isCompound()) - { + if (theInputs.size() == 1 && theInputs.front().get() && + theInputs.front()->isCompound()) { aResult = theInputs.front(); - } - else - { + } else { aResult = GeomAlgoAPI_CompoundBuilder::compound(theInputs); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h index c244d0ecd..b3d9f4112 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_GlueFaces_H_ @@ -22,55 +23,49 @@ #include "FeaturesPlugin.h" -#include #include - +#include /// \class FeaturesPlugin_GlueFaces /// \ingroup Plugins /// \brief Feature to glue duplicated faces. -class FeaturesPlugin_GlueFaces : public ModelAPI_Feature -{ +class FeaturesPlugin_GlueFaces : public ModelAPI_Feature { public: /// Use plugin manager for features creation FeaturesPlugin_GlueFaces(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("GlueFaces"); return MY_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_GlueFaces::ID(); return MY_KIND; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name for tolerance. - inline static const std::string& TOLERANCE_ID() - { + inline static const std::string &TOLERANCE_ID() { static const std::string MY_TOLERANCE_ID("tolerance"); return MY_TOLERANCE_ID; } /// Attribute name for keeping non-solid shapes. - inline static const std::string& KEEP_NON_SOLIDS_ID() - { + inline static const std::string &KEEP_NON_SOLIDS_ID() { static const std::string MY_KEEP_NON_SOLIDS_ID("keep_non_solids"); return MY_KEEP_NON_SOLIDS_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Executes the faces fusion and stores the modififed shape. @@ -78,15 +73,14 @@ public: private: /// Retrieve all shapes from the selection list - void getOriginalShapes(const std::string& theAttributeName, - ListOfShape& theShapes); + void getOriginalShapes(const std::string &theAttributeName, + ListOfShape &theShapes); /// Check, whether the result is glued or not - bool isGlued(const ListOfShape& theInputs, - const GeomShapePtr theResult); + bool isGlued(const ListOfShape &theInputs, const GeomShapePtr theResult); /// Create a compound result object from the unchanged input shapes - void setResultFromInput(const ListOfShape& theInputs); + void setResultFromInput(const ListOfShape &theInputs); }; #endif // FeaturesPlugin_GlueFaces_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp index d9292e10c..c1e98395c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_GroupSharedFaces.h" +#include +#include #include #include -#include #include -#include #include #include #include @@ -33,61 +34,58 @@ #include //================================================================================================= -FeaturesPlugin_GroupSharedFaces::FeaturesPlugin_GroupSharedFaces() -{ -} +FeaturesPlugin_GroupSharedFaces::FeaturesPlugin_GroupSharedFaces() {} //================================================================================================= -void FeaturesPlugin_GroupSharedFaces::initAttributes() -{ +void FeaturesPlugin_GroupSharedFaces::initAttributes() { data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(LIST_FACES_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(LIST_FACES_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(NUMBER_FACES_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId()); data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TRANSPARENCY_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), NUMBER_FACES_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), LIST_FACES_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), TRANSPARENCY_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + COMPUTE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), NUMBER_FACES_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + LIST_FACES_ID()); data()->boolean(COMPUTE_ID())->setValue(true); } //================================================================================================= -AttributePtr FeaturesPlugin_GroupSharedFaces::attributObject() -{ +AttributePtr FeaturesPlugin_GroupSharedFaces::attributObject() { return attribute(OBJECT_ID()); } //================================================================================================= -AttributePtr FeaturesPlugin_GroupSharedFaces::attributIsCompute() -{ +AttributePtr FeaturesPlugin_GroupSharedFaces::attributIsCompute() { return attribute(COMPUTE_ID()); } //================================================================================================= -AttributePtr FeaturesPlugin_GroupSharedFaces::attributListFaces() -{ +AttributePtr FeaturesPlugin_GroupSharedFaces::attributListFaces() { return attribute(LIST_FACES_ID()); } //================================================================================================= -AttributePtr FeaturesPlugin_GroupSharedFaces::attributNumberFaces() -{ +AttributePtr FeaturesPlugin_GroupSharedFaces::attributNumberFaces() { return attribute(NUMBER_FACES_ID()); } //================================================================================================= -void FeaturesPlugin_GroupSharedFaces::execute() -{ - if (selectionList(LIST_FACES_ID())->isInitialized() - && string(GROUP_NAME_ID())->value() != "") { - AttributeStringPtr aNameAtt = string(GROUP_NAME_ID()) ; - std::wstring aNameFace = aNameAtt->isUValue() ? - Locale::Convert::toWString(aNameAtt->valueU()) : - Locale::Convert::toWString(aNameAtt->value()); +void FeaturesPlugin_GroupSharedFaces::execute() { + if (selectionList(LIST_FACES_ID())->isInitialized() && + string(GROUP_NAME_ID())->value() != "") { + AttributeStringPtr aNameAtt = string(GROUP_NAME_ID()); + std::wstring aNameFace = + aNameAtt->isUValue() ? Locale::Convert::toWString(aNameAtt->valueU()) + : Locale::Convert::toWString(aNameAtt->value()); if (lastResult().get()) eraseResultFromList(lastResult()); @@ -97,35 +95,39 @@ void FeaturesPlugin_GroupSharedFaces::execute() eraseResultFromList(lastResult()); } } - if (selection(OBJECT_ID())->isInitialized() && integer(TRANSPARENCY_ID())->isInitialized()) { + if (selection(OBJECT_ID())->isInitialized() && + integer(TRANSPARENCY_ID())->isInitialized()) { AttributeSelectionPtr aCompSolidAttr = selection(OBJECT_ID()); ResultPtr aResult = aCompSolidAttr->context(); double aTranparency = integer(TRANSPARENCY_ID())->value() / 100.0; ModelAPI_Tools::setTransparency(aResult, aTranparency); - ResultBodyPtr aResultBody = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aResultBody = + std::dynamic_pointer_cast(aResult); std::list allRes; ModelAPI_Tools::allSubs(aResultBody, allRes); std::list::iterator aRes; - for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) { + for (aRes = allRes.begin(); aRes != allRes.end(); aRes++) { ModelAPI_Tools::setTransparency(*aRes, aTranparency); } } // Update the number of shared faces AttributeSelectionListPtr aFacesListAttr = - std::dynamic_pointer_cast (attributListFaces()); + std::dynamic_pointer_cast( + attributListFaces()); AttributeStringPtr aNumberFacesAttr = - std::dynamic_pointer_cast (attributNumberFaces()); + std::dynamic_pointer_cast( + attributNumberFaces()); std::stringstream aLabel; aLabel << aFacesListAttr->size(); aNumberFacesAttr->setValue(aLabel.str()); } //================================================================================================= -void FeaturesPlugin_GroupSharedFaces::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_GroupSharedFaces::attributeChanged( + const std::string &theID) { if (theID == OBJECT_ID() || theID == LIST_FACES_ID()) updateFaces(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h index e42e604d4..5b43fc7cb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_GroupSharedFaces_H_ @@ -26,73 +27,64 @@ /// \ingroup Plugins /// \brief Feature to check the shared faces of solid -class FeaturesPlugin_GroupSharedFaces : public FeaturesPlugin_CommonSharedFaces -{ +class FeaturesPlugin_GroupSharedFaces + : public FeaturesPlugin_CommonSharedFaces { public: /// Group shared faces kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Shared_faces"); return MY_ID; } /// Attribute name for object selected. - inline static const std::string& OBJECT_ID() - { + inline static const std::string &OBJECT_ID() { static const std::string MY_OBJECT_ID("main_object"); return MY_OBJECT_ID; } /// Attribute name for number of faces. - inline static const std::string& NUMBER_FACES_ID() - { + inline static const std::string &NUMBER_FACES_ID() { static const std::string MY_NUMBER_FACES_ID("number_shared_faces"); return MY_NUMBER_FACES_ID; } /// Attribute name for z coodinate. - inline static const std::string& LIST_FACES_ID() - { + inline static const std::string &LIST_FACES_ID() { static const std::string MY_LIST_FACES_ID("group_list"); return MY_LIST_FACES_ID; } /// Attribute name for transparency. - inline static const std::string& TRANSPARENCY_ID() - { + inline static const std::string &TRANSPARENCY_ID() { static const std::string MY_TRANSPARENCY_ID("transparency"); return MY_TRANSPARENCY_ID; } /// Attribute name for group name. - inline static const std::string& GROUP_NAME_ID() - { + inline static const std::string &GROUP_NAME_ID() { static const std::string MY_GROUP_NAME_ID("group_name"); return MY_GROUP_NAME_ID; } /// Attribute name for indicate to launch the algo. - inline static const std::string& COMPUTE_ID() - { + inline static const std::string &COMPUTE_ID() { static const std::string MY_COMPUTE_ID("compute"); return MY_COMPUTE_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation FeaturesPlugin_GroupSharedFaces(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp index c23c1d00b..d2748ab1b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp @@ -14,106 +14,103 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_ImportResult.h" -#include +#include +#include #include +#include #include #include -#include #include +#include #include -#include -#include -void FeaturesPlugin_ImportResult::initAttributes() -{ +void FeaturesPlugin_ImportResult::initAttributes() { data()->addAttribute(OBJECTS(), ModelAPI_AttributeSelectionList::typeId()); AttributePtr aFeaturesAttribute = - data()->addAttribute(FEATURES_ID(), - ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(FEATURES_ID(), ModelAPI_AttributeRefList::typeId()); aFeaturesAttribute->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), FEATURES_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + FEATURES_ID()); } -void FeaturesPlugin_ImportResult::execute() -{ +void FeaturesPlugin_ImportResult::execute() { // Process groups/fields std::shared_ptr aRefListOfGroups = - std::dynamic_pointer_cast(data()->attribute(FEATURES_ID())); + std::dynamic_pointer_cast( + data()->attribute(FEATURES_ID())); // Remove previous groups/fields stored in RefList - //std::list anGroupList = aRefListOfGroups->list(); - //std::list::iterator anGroupIt = anGroupList.begin(); - const std::list& anGroupList = aRefListOfGroups->list(); + // std::list anGroupList = aRefListOfGroups->list(); + // std::list::iterator anGroupIt = anGroupList.begin(); + const std::list &anGroupList = aRefListOfGroups->list(); std::list::const_iterator anGroupIt = anGroupList.begin(); for (; anGroupIt != anGroupList.end(); ++anGroupIt) { - std::shared_ptr aFeature = ModelAPI_Feature::feature(*anGroupIt); + std::shared_ptr aFeature = + ModelAPI_Feature::feature(*anGroupIt); if (aFeature) document()->removeFeature(aFeature); } aRefListOfGroups->clear(); - std::set aGlobalResultsCashed; // cash to speed up searching in all results selected + std::set aGlobalResultsCashed; // cash to speed up searching in all + // results selected std::list aGroups; std::list aResults; AttributeSelectionListPtr aList = selectionList(OBJECTS()); int aResultIndex = 0; - for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) - { + for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) { AttributeSelectionPtr aSel = aList->value(aSelIndex); ResultPtr aContext = aSel->context(); if (aContext.get()) - aResults.push_back (aContext); - else - { + aResults.push_back(aContext); + else { FeaturePtr aFeature = aSel->contextFeature(); - if (aFeature.get()) - { - const std::list& aResList = aFeature->results(); - aResults.assign (aResList.begin(), aResList.end()); + if (aFeature.get()) { + const std::list &aResList = aFeature->results(); + aResults.assign(aResList.begin(), aResList.end()); } } } std::list::iterator aResIter = aResults.begin(); - for(; aResIter != aResults.end(); aResIter++) - { + for (; aResIter != aResults.end(); aResIter++) { GeomShapePtr aShape = (*aResIter)->shape(); if (!aShape.get() || aShape->isNull()) continue; - std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); + std::shared_ptr aResultBody = + document()->createBody(data(), aResultIndex); aResultBody->store(aShape); aResultBody->loadFirstLevel(aShape, "ImportResult"); setResult(aResultBody, aResultIndex++); - std::set allResultsCashed; // cash to speed up searching in all results selected + std::set + allResultsCashed; // cash to speed up searching in all results selected std::list aLocalResults; - aLocalResults.push_back (*aResIter); + aLocalResults.push_back(*aResIter); std::list aDocuments; /// documents of Parts - aDocuments.push_back ((*aResIter)->document()); + aDocuments.push_back((*aResIter)->document()); std::list::iterator aDoc = aDocuments.begin(); - for(; aDoc != aDocuments.end(); aDoc++) - { + for (; aDoc != aDocuments.end(); aDoc++) { // groups int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group()); - for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) - { + for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) { ResultGroupPtr aResultGroup = std::dynamic_pointer_cast( - (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex)); + (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex)); if (!aResultGroup.get() || !aResultGroup->shape().get()) continue; @@ -121,74 +118,71 @@ void FeaturesPlugin_ImportResult::execute() FeaturePtr aGroupFeature = (*aDoc)->feature(aResultGroup); AttributeSelectionListPtr aSelectionList = - aGroupFeature->selectionList("group_list"); + aGroupFeature->selectionList("group_list"); - if (!ModelAPI_Tools::isInResults(aSelectionList, - aLocalResults, - allResultsCashed))// skip group not used in result + if (!ModelAPI_Tools::isInResults( + aSelectionList, aLocalResults, + allResultsCashed)) // skip group not used in result continue; - aGlobalResultsCashed.insert (allResultsCashed.begin(), allResultsCashed.end()); + aGlobalResultsCashed.insert(allResultsCashed.begin(), + allResultsCashed.end()); - //Check: may be this group already exists in the list + // Check: may be this group already exists in the list bool anIsFound = false; std::list::iterator anIter = aGroups.begin(); - for (; anIter != aGroups.end(); anIter++) - { - if (*anIter == aResultGroup) - { + for (; anIter != aGroups.end(); anIter++) { + if (*anIter == aResultGroup) { anIsFound = true; break; } } if (!anIsFound) - aGroups.push_back (aResultGroup); + aGroups.push_back(aResultGroup); } } } std::list::iterator anIter = aGroups.begin(); - for (; anIter != aGroups.end(); anIter++) - { + for (; anIter != aGroups.end(); anIter++) { DocumentPtr aDoc = (*anIter)->document(); FeaturePtr aGroupFeature = aDoc->feature(*anIter); AttributeSelectionListPtr aSelectionList = - aGroupFeature->selectionList("group_list"); + aGroupFeature->selectionList("group_list"); std::shared_ptr aNewGroupFeature = addFeature("Group"); aNewGroupFeature->data()->setName(aGroupFeature->name()); - AttributeSelectionListPtr aNewSelectionList = aNewGroupFeature->selectionList("group_list"); - aNewSelectionList->setSelectionType (aSelectionList->selectionType()); + AttributeSelectionListPtr aNewSelectionList = + aNewGroupFeature->selectionList("group_list"); + aNewSelectionList->setSelectionType(aSelectionList->selectionType()); GeomAPI_Shape::ShapeType aTypeOfShape = GeomAPI_Shape::shapeTypeByStr(aSelectionList->selectionType()); - for (int aLocalSelIndex = 0; aLocalSelIndex < aSelectionList->size(); aLocalSelIndex++) { + for (int aLocalSelIndex = 0; aLocalSelIndex < aSelectionList->size(); + aLocalSelIndex++) { AttributeSelectionPtr aLocalSel = aSelectionList->value(aLocalSelIndex); ResultPtr aLocalContext = aLocalSel->context(); - ResultGroupPtr aLocalGroup = std::dynamic_pointer_cast (aLocalContext); - if (aLocalGroup.get()) - { + ResultGroupPtr aLocalGroup = + std::dynamic_pointer_cast(aLocalContext); + if (aLocalGroup.get()) { GeomShapePtr aLocalShape = aGroupFeature->firstResult()->shape(); - GeomAPI_ShapeExplorer anExplo (aLocalShape, aTypeOfShape); - for (; anExplo.more(); anExplo.next()) - { + GeomAPI_ShapeExplorer anExplo(aLocalShape, aTypeOfShape); + for (; anExplo.more(); anExplo.next()) { GeomShapePtr anExploredShape = anExplo.current(); - std::set::iterator aResultIter = aGlobalResultsCashed.begin(); - for (; aResultIter != aGlobalResultsCashed.end(); aResultIter++) - { + std::set::iterator aResultIter = + aGlobalResultsCashed.begin(); + for (; aResultIter != aGlobalResultsCashed.end(); aResultIter++) { GeomShapePtr aCashedShape = (*aResultIter)->shape(); if (aCashedShape->isSubShape(anExploredShape)) aNewSelectionList->append((*aResultIter), anExploredShape); } } break; - } - else - { + } else { GeomShapePtr aLocalShape = aLocalSel->value(); if (aLocalContext.get() && aGlobalResultsCashed.count(aLocalContext)) @@ -200,11 +194,11 @@ void FeaturesPlugin_ImportResult::execute() removeResults(aResultIndex); } -bool FeaturesPlugin_ValidatorImportResults::isValid(const AttributePtr& theAttribute, - const std::list&, Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorImportResults::isValid( + const AttributePtr &theAttribute, const std::list &, + Events_InfoMessage &theError) const { AttributeSelectionListPtr aList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aList->size() == 0) { // LCOV_EXCL_START theError = "Please select sources."; @@ -218,10 +212,11 @@ bool FeaturesPlugin_ValidatorImportResults::isValid(const AttributePtr& theAttri int aNum = aRoot->size(ModelAPI_Feature::group()); for (int a = 0; a < aNum; a++) { FeaturePtr aFeat = std::dynamic_pointer_cast( - aRoot->object(ModelAPI_Feature::group(), a)); - if (aFeat.get() && aFeat->data() && aFeat->data()->isValid() && aFeat->getKind() == "Part" && - aFeat->results().size()) { - ResultPartPtr aPart = std::dynamic_pointer_cast(aFeat->firstResult()); + aRoot->object(ModelAPI_Feature::group(), a)); + if (aFeat.get() && aFeat->data() && aFeat->data()->isValid() && + aFeat->getKind() == "Part" && aFeat->results().size()) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(aFeat->firstResult()); if (aPart.get() && aPart->partDoc()) { aDocIndices[aPart->partDoc()] = a; } @@ -238,13 +233,15 @@ bool FeaturesPlugin_ValidatorImportResults::isValid(const AttributePtr& theAttri // LCOV_EXCL_STOP } GeomShapePtr aShape = aSel->value(); - if (aShape.get() && !aShape->isNull() && !aShape->isSame(aContext->shape())) { + if (aShape.get() && !aShape->isNull() && + !aShape->isSame(aContext->shape())) { // LCOV_EXCL_START theError = "Import results does not support selection of sub-shapes"; return false; // LCOV_EXCL_STOP } - ResultBodyPtr aBody = std::dynamic_pointer_cast(aContext); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(aContext); if (!aBody.get()) { // LCOV_EXCL_START theError = "Only results may be selected."; @@ -267,40 +264,39 @@ bool FeaturesPlugin_ValidatorImportResults::isValid(const AttributePtr& theAttri } //============================================================================ -std::shared_ptr FeaturesPlugin_ImportResult::addFeature( - std::string theID) -{ +std::shared_ptr +FeaturesPlugin_ImportResult::addFeature(std::string theID) { std::shared_ptr aNew = document()->addFeature(theID, false); if (aNew) data()->reflist(FEATURES_ID())->append(aNew); - // set as current also after it becomes sub to set correctly enabled for other subs - //document()->setCurrentFeature(aNew, false); + // set as current also after it becomes sub to set correctly enabled for other + // subs + // document()->setCurrentFeature(aNew, false); return aNew; } //================================================================================================= -int FeaturesPlugin_ImportResult::numberOfSubs(bool /*forTree*/) const -{ +int FeaturesPlugin_ImportResult::numberOfSubs(bool /*forTree*/) const { return data()->reflist(FEATURES_ID())->size(true); } //================================================================================================= -std::shared_ptr FeaturesPlugin_ImportResult::subFeature(const int theIndex, - bool /*forTree*/) -{ +std::shared_ptr +FeaturesPlugin_ImportResult::subFeature(const int theIndex, bool /*forTree*/) { ObjectPtr anObj = data()->reflist(FEATURES_ID())->object(theIndex, false); FeaturePtr aRes = std::dynamic_pointer_cast(anObj); return aRes; } //================================================================================================= -int FeaturesPlugin_ImportResult::subFeatureId(const int theIndex) const -{ - std::shared_ptr aRefList = std::dynamic_pointer_cast< - ModelAPI_AttributeRefList>(data()->attribute(FEATURES_ID())); +int FeaturesPlugin_ImportResult::subFeatureId(const int theIndex) const { + std::shared_ptr aRefList = + std::dynamic_pointer_cast( + data()->attribute(FEATURES_ID())); std::list aFeatures = aRefList->list(); std::list::const_iterator anIt = aFeatures.begin(); - int aResultIndex = 1; // number of the counted (created) features, started from 1 + int aResultIndex = + 1; // number of the counted (created) features, started from 1 int aFeatureIndex = -1; // number of the not-empty features in the list for (; anIt != aFeatures.end(); anIt++) { if (anIt->get()) @@ -313,8 +309,7 @@ int FeaturesPlugin_ImportResult::subFeatureId(const int theIndex) const } //================================================================================================= -bool FeaturesPlugin_ImportResult::isSub(ObjectPtr theObject) const -{ +bool FeaturesPlugin_ImportResult::isSub(ObjectPtr theObject) const { // check is this feature of result FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature) @@ -324,8 +319,7 @@ bool FeaturesPlugin_ImportResult::isSub(ObjectPtr theObject) const //================================================================================================= void FeaturesPlugin_ImportResult::removeFeature( - std::shared_ptr theFeature) -{ + std::shared_ptr theFeature) { if (!data()->isValid()) return; AttributeRefListPtr aList = reflist(FEATURES_ID()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h index 0ae6985de..713900851 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_ImportResult_H_ @@ -22,40 +23,36 @@ #include "FeaturesPlugin.h" -#include #include +#include /// \class FeaturesPlugin_ImportResult /// \ingroup Plugins -/// \brief The Import Result feature allows the user to import one or several results +/// \brief The Import Result feature allows the user to import one or several +/// results /// from another Part. -class FeaturesPlugin_ImportResult : public ModelAPI_CompositeFeature -{ +class FeaturesPlugin_ImportResult : public ModelAPI_CompositeFeature { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("ImportResult"); return MY_ID; } /// All features (list of references) - inline static const std::string& FEATURES_ID() - { + inline static const std::string &FEATURES_ID() { static const std::string MY_FEATURES_ID("Features"); return MY_FEATURES_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_ImportResult::ID(); return MY_KIND; } /// Selection list attribute that contains all copied shapes selection. - inline static const std::string& OBJECTS() - { + inline static const std::string &OBJECTS() { static const std::string MY_OBJECTS("objects"); return MY_OBJECTS; } @@ -63,28 +60,34 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Appends a feature - FEATURESPLUGIN_EXPORT virtual std::shared_ptr addFeature(std::string theID); + FEATURESPLUGIN_EXPORT virtual std::shared_ptr + addFeature(std::string theID); /// \return the number of sub-elements. FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const; /// \return the sub-feature by zero-base index. - FEATURESPLUGIN_EXPORT virtual - std::shared_ptr subFeature(const int theIndex, bool forTree = false); + FEATURESPLUGIN_EXPORT virtual std::shared_ptr + subFeature(const int theIndex, bool forTree = false); - /// \return the sub-feature unique identifier in this composite feature by zero-base index. + /// \return the sub-feature unique identifier in this composite feature by + /// zero-base index. FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const; - /// \return true if feature or result belong to this composite feature as subs. + /// \return true if feature or result belong to this composite feature as + /// subs. FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const; - /// This method to inform that sub-feature is removed and must be removed from the internal data - /// structures of the owner (the remove from the document will be done outside just after). - FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr theFeature); + /// This method to inform that sub-feature is removed and must be removed from + /// the internal data structures of the owner (the remove from the document + /// will be done outside just after). + FEATURESPLUGIN_EXPORT virtual void + removeFeature(std::shared_ptr theFeature); /// Use plugin manager for features creation. FeaturesPlugin_ImportResult() {} @@ -94,15 +97,16 @@ public: /// \ingroup Validators /// \brief A validator for selection of objects that may be imported: /// from another part, result bodies. -class FeaturesPlugin_ValidatorImportResults : public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorImportResults + : public ModelAPI_AttributeValidator { public: //! \return True if selection is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp index 29b2ab5c2..9d5e27635 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_InspectBoundingBox.h" @@ -25,9 +26,9 @@ #include -#include -#include #include +#include +#include #include #include #include @@ -37,13 +38,10 @@ #include //================================================================================================= -FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox() -{ -} +FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox() {} //================================================================================================= -void FeaturesPlugin_InspectBoundingBox::initAttributes() -{ +void FeaturesPlugin_InspectBoundingBox::initAttributes() { // attribute for object selected data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -56,24 +54,31 @@ void FeaturesPlugin_InspectBoundingBox::initAttributes() data()->addAttribute(Z_MAX_COORD_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(CREATEBOX_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MIN_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MIN_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MIN_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MAX_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MAX_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MAX_COORD_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATEBOX_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), RESULT_VALUES_ID()); - - data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), X_MIN_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Y_MIN_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Z_MIN_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), X_MAX_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Y_MAX_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), Z_MAX_COORD_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + CREATEBOX_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), RESULT_VALUES_ID()); + + data()->addAttribute(RESULT_VALUES_ID(), + ModelAPI_AttributeDoubleArray::typeId()); data()->realArray(RESULT_VALUES_ID())->setSize(6); - } //================================================================================================= -void FeaturesPlugin_InspectBoundingBox::execute() -{ +void FeaturesPlugin_InspectBoundingBox::execute() { if (!updateValues()) return; @@ -87,7 +92,7 @@ void FeaturesPlugin_InspectBoundingBox::execute() if (myCreateFeature.get()) { myCreateFeature->eraseResults(); SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); aDoc->removeFeature(myCreateFeature); myCreateFeature.reset(); } @@ -95,8 +100,8 @@ void FeaturesPlugin_InspectBoundingBox::execute() } //================================================================================================= -void FeaturesPlugin_InspectBoundingBox::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_InspectBoundingBox::attributeChanged( + const std::string &theID) { if (theID == OBJECT_ID()) { if (myCreateFeature.get()) updateBox(); @@ -104,18 +109,17 @@ void FeaturesPlugin_InspectBoundingBox::attributeChanged(const std::string& theI } //================================================================================================= -AttributePtr FeaturesPlugin_InspectBoundingBox::attributResultValues() -{ - return attribute(RESULT_VALUES_ID()); +AttributePtr FeaturesPlugin_InspectBoundingBox::attributResultValues() { + return attribute(RESULT_VALUES_ID()); } //================================================================================================= -bool FeaturesPlugin_InspectBoundingBox::updateValues() -{ +bool FeaturesPlugin_InspectBoundingBox::updateValues() { AttributeSelectionPtr aSelection = selection(OBJECT_ID()); if (aSelection->isInitialized()) { AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); std::stringstream streamxmin; std::stringstream streamymin; std::stringstream streamzmin; @@ -133,12 +137,9 @@ bool FeaturesPlugin_InspectBoundingBox::updateValues() if (aShape && !aShape->isEqual(myShape)) { double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax; std::string anError; - if (!GetBoundingBox(aShape, - aXmin, aXmax, - aYmin, aYmax, - aZmin, aZmax, + if (!GetBoundingBox(aShape, aXmin, aXmax, aYmin, aYmax, aZmin, aZmax, anError)) { - setError("Error in bounding box calculation :" + anError); + setError("Error in bounding box calculation :" + anError); return false; } @@ -155,23 +156,22 @@ bool FeaturesPlugin_InspectBoundingBox::updateValues() aValues->setValue(4, aZmin); streamzmax << std::setprecision(14) << aZmax; aValues->setValue(5, aZmax); - string(X_MIN_COORD_ID() )->setValue( "X = " + streamxmin.str() ); - string(Y_MIN_COORD_ID() )->setValue( "Y = " + streamymin.str() ); - string(Z_MIN_COORD_ID() )->setValue( "Z = " + streamzmin.str() ); - string(X_MAX_COORD_ID() )->setValue( "X = " + streamxmax.str() ); - string(Y_MAX_COORD_ID() )->setValue( "Y = " + streamymax.str() ); - string(Z_MAX_COORD_ID() )->setValue( "Z = " + streamzmax.str() ); + string(X_MIN_COORD_ID())->setValue("X = " + streamxmin.str()); + string(Y_MIN_COORD_ID())->setValue("Y = " + streamymin.str()); + string(Z_MIN_COORD_ID())->setValue("Z = " + streamzmin.str()); + string(X_MAX_COORD_ID())->setValue("X = " + streamxmax.str()); + string(Y_MAX_COORD_ID())->setValue("Y = " + streamymax.str()); + string(Z_MAX_COORD_ID())->setValue("Z = " + streamzmax.str()); } } return true; } //================================================================================================= -void FeaturesPlugin_InspectBoundingBox::createBox() -{ +void FeaturesPlugin_InspectBoundingBox::createBox() { SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); if (aDoc.get()) { myCreateFeature = aDoc->addFeature(FeaturesPlugin_BoundingBox::ID()); @@ -179,21 +179,23 @@ void FeaturesPlugin_InspectBoundingBox::createBox() } //================================================================================================= -void FeaturesPlugin_InspectBoundingBox::updateBox() -{ - myCreateFeature->boolean(FeaturesPlugin_BoundingBox::COMPUTE_ID())->setValue(false); +void FeaturesPlugin_InspectBoundingBox::updateBox() { + myCreateFeature->boolean(FeaturesPlugin_BoundingBox::COMPUTE_ID()) + ->setValue(false); myCreateFeature->selection(FeaturesPlugin_BoundingBox::OBJECT_ID()) - ->setValue(selection(OBJECT_ID())->context(), - selection(OBJECT_ID())->value()); + ->setValue(selection(OBJECT_ID())->context(), + selection(OBJECT_ID())->value()); AttributeDoubleArrayPtr aValuesFeatures = - std::dynamic_pointer_cast - (myCreateFeature->attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + myCreateFeature->attribute(RESULT_VALUES_ID())); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); - for (int anI=0; anI < 6; anI++) - aValuesFeatures->setValue(anI,aValues->value(anI)); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); + for (int anI = 0; anI < 6; anI++) + aValuesFeatures->setValue(anI, aValues->value(anI)); myCreateFeature->execute(); - myCreateFeature->boolean(FeaturesPlugin_BoundingBox::COMPUTE_ID())->setValue(true); + myCreateFeature->boolean(FeaturesPlugin_BoundingBox::COMPUTE_ID()) + ->setValue(true); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h index eeac45b3c..14b864667 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_InspectBoundingBox_H_ @@ -26,94 +27,82 @@ /// \ingroup Plugins /// \brief Feature to view the Bounding Box. -class FeaturesPlugin_InspectBoundingBox : public FeaturesPlugin_BoundingBoxBase -{ +class FeaturesPlugin_InspectBoundingBox + : public FeaturesPlugin_BoundingBoxBase { public: /// Bounding box macro kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("BoundingBoxMacro"); return MY_ID; } /// Attribute name for object selected. - inline static const std::string& OBJECT_ID() - { + inline static const std::string &OBJECT_ID() { static const std::string MY_OBJECT_ID("main_object"); return MY_OBJECT_ID; } /// Attribute name for x coodinate. - inline static const std::string& X_MIN_COORD_ID() - { + inline static const std::string &X_MIN_COORD_ID() { static const std::string MY_X_MIN_COORD_ID("xmincoordinate"); return MY_X_MIN_COORD_ID; } /// Attribute name for y coodinate. - inline static const std::string& Y_MIN_COORD_ID() - { + inline static const std::string &Y_MIN_COORD_ID() { static const std::string MY_Y_MIN_COORD_ID("ymincoordinate"); return MY_Y_MIN_COORD_ID; } /// Attribute name for z coodinate. - inline static const std::string& Z_MIN_COORD_ID() - { + inline static const std::string &Z_MIN_COORD_ID() { static const std::string MY_Z_MIN_COORD_ID("zmincoordinate"); return MY_Z_MIN_COORD_ID; } /// Attribute name for x max coodinate. - inline static const std::string& X_MAX_COORD_ID() - { + inline static const std::string &X_MAX_COORD_ID() { static const std::string MY_X_MAX_COORD_ID("xmaxcoordinate"); return MY_X_MAX_COORD_ID; } /// Attribute name for y max coodinate. - inline static const std::string& Y_MAX_COORD_ID() - { + inline static const std::string &Y_MAX_COORD_ID() { static const std::string MY_Y_MAX_COORD_ID("ymaxcoordinate"); return MY_Y_MAX_COORD_ID; } /// Attribute name for z max coodinate. - inline static const std::string& Z_MAX_COORD_ID() - { + inline static const std::string &Z_MAX_COORD_ID() { static const std::string MY_Z_MAX_COORD_ID("zmaxcoordinate"); return MY_Z_MAX_COORD_ID; } /// Attribute name for checkbox create box. - inline static const std::string& CREATEBOX_ID() - { + inline static const std::string &CREATEBOX_ID() { static const std::string MY_CREATEBOX_ID("createbox"); return MY_CREATEBOX_ID; } /// Attribute name for values of result. - inline static const std::string& RESULT_VALUES_ID() - { + inline static const std::string &RESULT_VALUES_ID() { static const std::string MY_RESULT_VALUES_ID("result_values"); return MY_RESULT_VALUES_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } @@ -134,7 +123,6 @@ private: /// Feature to create box FeaturePtr myCreateFeature; - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp index 8a7893c97..e0d01aa4c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_InspectNormalToFace.h" #include -#include #include +#include #include #include #include @@ -47,22 +48,22 @@ FeaturesPlugin_InspectNormalToFace::FeaturesPlugin_InspectNormalToFace() {} //================================================================================================= -void FeaturesPlugin_InspectNormalToFace::initAttributes() -{ +void FeaturesPlugin_InspectNormalToFace::initAttributes() { // attribute for object selected - data()->addAttribute(FACE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(VERTEX_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FACE_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(VERTEX_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for result message and values data()->addAttribute(CREATENORMAL_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(VERTEX_OPTION_ID(), ModelAPI_AttributeString::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERTEX_SELECTED_ID()); - + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), VERTEX_SELECTED_ID()); } //================================================================================================= -void FeaturesPlugin_InspectNormalToFace::execute() -{ +void FeaturesPlugin_InspectNormalToFace::execute() { AttributeSelectionPtr aSelectionFace = selection(FACE_SELECTED_ID()); AttributeSelectionPtr aSelectionPoint = selection(VERTEX_SELECTED_ID()); @@ -78,18 +79,16 @@ void FeaturesPlugin_InspectNormalToFace::execute() if (aSelectionFace && aSelectionFace->isInitialized()) { aShape = aSelectionFace->value(); - if (!aShape && aSelectionFace->context()) - aShape = aSelectionFace->context()->shape(); + if (!aShape && aSelectionFace->context()) + aShape = aSelectionFace->context()->shape(); } if (aShape) { std::string aError; std::shared_ptr theNormal(new GeomAPI_Edge); - if (!GeomAlgoAPI_NormalToFace::normal(aShape, - aShapePoint, - theNormal, + if (!GeomAlgoAPI_NormalToFace::normal(aShape, aShapePoint, theNormal, aError)) - setError("Error in bounding box calculation :" + aError); + setError("Error in bounding box calculation :" + aError); GeomDirPtr theDir; std::shared_ptr aPnt = theNormal->lastPoint(); @@ -101,7 +100,7 @@ void FeaturesPlugin_InspectNormalToFace::execute() aPnt->translate(theDir, 100); std::shared_ptr anEdge = - GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), aPnt); + GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), aPnt); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -117,7 +116,7 @@ void FeaturesPlugin_InspectNormalToFace::execute() if (myCreateFeature.get()) { myCreateFeature->eraseResults(); SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); aDoc->removeFeature(myCreateFeature); myCreateFeature.reset(); } @@ -125,20 +124,19 @@ void FeaturesPlugin_InspectNormalToFace::execute() } //================================================================================================= -void FeaturesPlugin_InspectNormalToFace::attributeChanged(const std::string& theID) -{ - if (theID == FACE_SELECTED_ID()) { +void FeaturesPlugin_InspectNormalToFace::attributeChanged( + const std::string &theID) { + if (theID == FACE_SELECTED_ID()) { if (myCreateFeature.get()) updateNormal(); } } //================================================================================================= -void FeaturesPlugin_InspectNormalToFace::createNormal() -{ +void FeaturesPlugin_InspectNormalToFace::createNormal() { SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); if (aDoc.get()) { myCreateFeature = aDoc->addFeature(FeaturesPlugin_NormalToFace::ID()); @@ -146,19 +144,19 @@ void FeaturesPlugin_InspectNormalToFace::createNormal() } //================================================================================================= -void FeaturesPlugin_InspectNormalToFace::updateNormal() -{ +void FeaturesPlugin_InspectNormalToFace::updateNormal() { myCreateFeature->selection(FeaturesPlugin_NormalToFace::FACE_SELECTED_ID()) - ->setValue(selection(FACE_SELECTED_ID())->context() , - selection(FACE_SELECTED_ID())->value()); + ->setValue(selection(FACE_SELECTED_ID())->context(), + selection(FACE_SELECTED_ID())->value()); myCreateFeature->string(FeaturesPlugin_NormalToFace::VERTEX_OPTION_ID()) - ->setValue(string(VERTEX_OPTION_ID())->value()); + ->setValue(string(VERTEX_OPTION_ID())->value()); if (!string(VERTEX_OPTION_ID())->value().empty()) { - myCreateFeature->selection(FeaturesPlugin_NormalToFace::VERTEX_SELECTED_ID()) - ->setValue(selection(VERTEX_SELECTED_ID())->context() , - selection(VERTEX_SELECTED_ID())->value()); + myCreateFeature + ->selection(FeaturesPlugin_NormalToFace::VERTEX_SELECTED_ID()) + ->setValue(selection(VERTEX_SELECTED_ID())->context(), + selection(VERTEX_SELECTED_ID())->value()); } myCreateFeature->execute(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h index 4a930c0fb..e159f17a8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_InspectNormalToFace_H_ @@ -30,59 +31,51 @@ /// \ingroup Plugins /// \brief Feature to view the normal to face -class FeaturesPlugin_InspectNormalToFace : public ModelAPI_Feature -{ +class FeaturesPlugin_InspectNormalToFace : public ModelAPI_Feature { public: /// Normal to face macro kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("NormalMacro"); return MY_ID; } /// Attribute name for face selected. - inline static const std::string& FACE_SELECTED_ID() - { + inline static const std::string &FACE_SELECTED_ID() { static const std::string MY_FACE_SELECTED_ID("face"); return MY_FACE_SELECTED_ID; } /// Attribute name for vertex selected. - inline static const std::string& VERTEX_SELECTED_ID() - { + inline static const std::string &VERTEX_SELECTED_ID() { static const std::string MY_VERTEX_SELECTED_ID("vertex"); return MY_VERTEX_SELECTED_ID; } - /// Attribute name for checkbox create box. - inline static const std::string& CREATENORMAL_ID() - { + /// Attribute name for checkbox create box. + inline static const std::string &CREATENORMAL_ID() { static const std::string MY_CREATENORMAL_ID("createnormal"); return MY_CREATENORMAL_ID; } /// Attribute name of vertex option. - inline static const std::string& VERTEX_OPTION_ID() - { + inline static const std::string &VERTEX_OPTION_ID() { static const std::string MY_VERTEX_OPTION_ID("vertex_option"); return MY_VERTEX_OPTION_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } @@ -90,14 +83,13 @@ public: /// Use plugin manager for features creation FeaturesPlugin_InspectNormalToFace(); - private: +private: /// Create normal in feature void createNormal(); /// Update normal in feature void updateNormal(); /// Feature to create normal FeaturePtr myCreateFeature; - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp index d7cc5aeb9..bf84ae45e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp @@ -14,54 +14,50 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Intersection.h" -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include #include +#include #include #include #include -#include #include - static const std::string INTERSECTION_VERSION_1("v9.5"); static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================= -FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() -{ -} +FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() {} //================================================================================================= -void FeaturesPlugin_Intersection::initAttributes() -{ - AttributePtr anObjectsAttr = data()->addAttribute(OBJECT_LIST_ID(), - ModelAPI_AttributeSelectionList::typeId()); +void FeaturesPlugin_Intersection::initAttributes() { + AttributePtr anObjectsAttr = data()->addAttribute( + OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + boolean(USE_FUZZY_ID()) + ->setValue(false); // Do NOT use the fuzzy parameter by default. real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(INTERSECTION_VERSION_1, anObjectsAttr, AttributePtr()); } //================================================================================================= -void FeaturesPlugin_Intersection::execute() -{ +void FeaturesPlugin_Intersection::execute() { GeomAPI_ShapeHierarchy anObjectsHierarchy; ListOfShape aPlanes; // Getting objects. @@ -72,48 +68,48 @@ void FeaturesPlugin_Intersection::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); int aResultIndex = 0; // Create result. - const ListOfShape& anObjects = anObjectsHierarchy.objects(); - GeomMakeShapePtr anIntersectionAlgo(new GeomAlgoAPI_Intersection(anObjects, aFuzzy)); + const ListOfShape &anObjects = anObjectsHierarchy.objects(); + GeomMakeShapePtr anIntersectionAlgo( + new GeomAlgoAPI_Intersection(anObjects, aFuzzy)); // Checking that the algorithm worked properly. std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anIntersectionAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anIntersectionAlgo, + getKind(), anError)) { setError(anError); return; } - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); aMakeShapeList->appendAlgo(anIntersectionAlgo); GeomShapePtr aResShape = anIntersectionAlgo->shape(); if (data()->version() == INTERSECTION_VERSION_1) { // merge hierarchies of compounds containing objects and tools // and append the result of the FUSE operation - aResShape = keepUnusedSubsOfCompound(aResShape, anObjectsHierarchy, - GeomAPI_ShapeHierarchy(), aMakeShapeList); + aResShape = + keepUnusedSubsOfCompound(aResShape, anObjectsHierarchy, + GeomAPI_ShapeHierarchy(), aMakeShapeList); } - std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, - anObjects, - ListOfShape(), - aMakeShapeList, - aResShape); + std::shared_ptr aResultBody = + document()->createBody(data(), aResultIndex); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anObjects, ListOfShape(), + aMakeShapeList, aResShape); setResult(aResultBody, aResultIndex); aResultIndex++; - ModelAPI_Tools::loadDeletedShapes(aResultBody, - GeomShapePtr(), - anObjects, - aMakeShapeList, - aResShape); + ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), anObjects, + aMakeShapeList, aResShape); // remove the rest results if there were produced in the previous pass removeResults(aResultIndex); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.h b/src/FeaturesPlugin/FeaturesPlugin_Intersection.h index ec1088712..e5a79609c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Intersection_H_ @@ -26,45 +27,39 @@ class GeomAlgoAPI_MakeShape; /// \class FeaturesPlugin_Intersection /// \ingroup Plugins -/// \brief Intersection feature takes a list of shapes as objects and list of shapes as tools. -/// The types of objects and tools may be different: -/// whole objects, compsoilds, solids, shells, faces or edges. -/// The result is less than the minimal dimension from pair of intersection: -/// for two solids or two faces it is wire, for the edge and face it is vertex, etc. -class FeaturesPlugin_Intersection : public FeaturesPlugin_VersionedBoolean -{ +/// \brief Intersection feature takes a list of shapes as objects and list of +/// shapes as tools. The types of objects and tools may be different: whole +/// objects, compsoilds, solids, shells, faces or edges. The result is less than +/// the minimal dimension from pair of intersection: for two solids or two faces +/// it is wire, for the edge and face it is vertex, etc. +class FeaturesPlugin_Intersection : public FeaturesPlugin_VersionedBoolean { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Intersection"); return MY_ID; } /// Attribute name of objects. - inline static const std::string& OBJECT_LIST_ID() - { + inline static const std::string &OBJECT_LIST_ID() { static const std::string MY_OBJECT_LIST_ID("main_objects"); return MY_OBJECT_LIST_ID; } /// Attribute name of use fuzzy parameter. - inline static const std::string& USE_FUZZY_ID() - { + inline static const std::string &USE_FUZZY_ID() { static const std::string MY_USE_FUZZY_ID("use_fuzzy"); return MY_USE_FUZZY_ID; } /// Attribute name of fuzzy parameter. - inline static const std::string& FUZZY_PARAM_ID() - { + inline static const std::string &FUZZY_PARAM_ID() { static const std::string MY_FUZZY_PARAM_ID("fuzzy_param"); return MY_FUZZY_PARAM_ID; } /// Returns the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Intersection::ID(); return MY_KIND; } @@ -72,7 +67,8 @@ public: /// Executes feature. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp index c904f66f1..aa5dad597 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -28,36 +29,33 @@ #include #include - - //================================================================================================= -FeaturesPlugin_LimitTolerance::FeaturesPlugin_LimitTolerance() -{ -} +FeaturesPlugin_LimitTolerance::FeaturesPlugin_LimitTolerance() {} //================================================================================================= -void FeaturesPlugin_LimitTolerance::initAttributes() -{ +void FeaturesPlugin_LimitTolerance::initAttributes() { data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(TOLERANCE_ID(), ModelAPI_AttributeDouble::typeId()); } //================================================================================================= -void FeaturesPlugin_LimitTolerance::execute() -{ +void FeaturesPlugin_LimitTolerance::execute() { // Get all feature arguments - GeomShapePtr aShape = selection(FeaturesPlugin_LimitTolerance::OBJECT_ID())->value(); - double aTolerance = real(FeaturesPlugin_LimitTolerance::TOLERANCE_ID())->value(); + GeomShapePtr aShape = + selection(FeaturesPlugin_LimitTolerance::OBJECT_ID())->value(); + double aTolerance = + real(FeaturesPlugin_LimitTolerance::TOLERANCE_ID())->value(); - std::shared_ptr aLimitToleranceAlgo(new GeomAlgoAPI_LimitTolerance(aShape, aTolerance)); + std::shared_ptr aLimitToleranceAlgo( + new GeomAlgoAPI_LimitTolerance(aShape, aTolerance)); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aLimitToleranceAlgo, getKind(), anError)) - { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aLimitToleranceAlgo, + getKind(), anError)) { setError(anError); return; } - + // Store result. GeomShapePtr aResult = aLimitToleranceAlgo->shape(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h index 44dd87c97..644ad2819 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h +++ b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_LIMITTOLERANCE_H_ @@ -22,46 +23,41 @@ #include -#include #include - +#include /** \class FeaturesPlugin_LimitTolerance * \ingroup Plugins * \brief Feature to limit the tolerance on selected shapes. */ -class FeaturesPlugin_LimitTolerance : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_LimitTolerance : public ModelAPI_Feature { +public: /// LimitTolerance kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_LIMIT_TOLERANCE_ID("LimitTolerance"); return MY_LIMIT_TOLERANCE_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_LimitTolerance::ID(); return MY_KIND; } /// Attribute name of referenced object. - inline static const std::string& OBJECT_ID() - { + inline static const std::string &OBJECT_ID() { static const std::string MY_OBJECT_ID("object"); return MY_OBJECT_ID; } /// Attribute name for tolerance. - inline static const std::string& TOLERANCE_ID() - { + inline static const std::string &TOLERANCE_ID() { static const std::string MY_TOLERANCE_ID("tolerance"); return MY_TOLERANCE_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results in the data structure. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp b/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp index 5e74c75c9..21d53686b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Loft.h" @@ -22,30 +23,28 @@ #include +#include +#include #include #include #include #include -#include -#include #include //================================================================================================== -FeaturesPlugin_Loft::FeaturesPlugin_Loft() -{ -} +FeaturesPlugin_Loft::FeaturesPlugin_Loft() {} //================================================================================================== -void FeaturesPlugin_Loft::initAttributes() -{ - data()->addAttribute(FIRST_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(SECOND_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); +void FeaturesPlugin_Loft::initAttributes() { + data()->addAttribute(FIRST_OBJECT_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(SECOND_OBJECT_ID(), + ModelAPI_AttributeSelection::typeId()); } //================================================================================================== -void FeaturesPlugin_Loft::execute() -{ +void FeaturesPlugin_Loft::execute() { AttributeSelectionPtr aFirstSelection = selection(FIRST_OBJECT_ID()); AttributeSelectionPtr aSecondelection = selection(SECOND_OBJECT_ID()); @@ -64,13 +63,15 @@ void FeaturesPlugin_Loft::execute() } std::string anError; - std::shared_ptr aLoftAlgo(new GeomAlgoAPI_Loft(aFirstShape, aSecondShape)); + std::shared_ptr aLoftAlgo( + new GeomAlgoAPI_Loft(aFirstShape, aSecondShape)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aLoftAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aLoftAlgo, getKind(), + anError)) { setError(anError); return; } - ListOfShape theBoundaryShapes; + ListOfShape theBoundaryShapes; theBoundaryShapes.push_back(aFirstShape); theBoundaryShapes.push_back(aSecondShape); @@ -79,8 +80,8 @@ void FeaturesPlugin_Loft::execute() aResultBody->store(aLoftAlgo->shape()); // store Faces - for(GeomAPI_ShapeExplorer anExp(aLoftAlgo->shape(), GeomAPI_Shape::FACE); - anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aLoftAlgo->shape(), GeomAPI_Shape::FACE); + anExp.more(); anExp.next()) { GeomShapePtr anEdge = anExp.current(); aResultBody->generated(anEdge, "Loft_Face"); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Loft.h b/src/FeaturesPlugin/FeaturesPlugin_Loft.h index 437feb386..273457be3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Loft.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Loft.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Loft_H_ @@ -38,33 +39,28 @@ class GeomAPI_Pnt; /// Edge -> Face /// Wire -> Shell /// Face -> Solid -class FeaturesPlugin_Loft : public ModelAPI_Feature -{ +class FeaturesPlugin_Loft : public ModelAPI_Feature { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_FEATURE_ID("Loft"); return MY_FEATURE_ID; } /// Attribute name for first object selected. - inline static const std::string& FIRST_OBJECT_ID() - { + inline static const std::string &FIRST_OBJECT_ID() { static const std::string MY_FIRST_OBJECT("first_object"); return MY_FIRST_OBJECT; } /// Attribute name for second object selected. - inline static const std::string& SECOND_OBJECT_ID() - { + inline static const std::string &SECOND_OBJECT_ID() { static const std::string MY_SECOND_OBJECT("second_object"); return MY_SECOND_OBJECT; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Loft::ID(); return MY_KIND; } @@ -72,7 +68,8 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp index 2bae620a3..4e21f8886 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Measurement.h" @@ -38,63 +39,66 @@ #include -#include -#include -#include +#include +#include #include #include #include -#include -#include +#include +#include +#include #include +#include #include #include -#include -FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() : mySceenScale(1) -{ -} +FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() : mySceenScale(1) {} -void FeaturesPlugin_Measurement::initAttributes() -{ +void FeaturesPlugin_Measurement::initAttributes() { data()->addAttribute(FeaturesPlugin_Measurement::MEASURE_KIND(), ModelAPI_AttributeString::typeId()); // attribute for length - data()->addAttribute(EDGE_FOR_LENGTH_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(EDGE_FOR_LENGTH_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for distance - data()->addAttribute(DISTANCE_FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(DISTANCE_TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(DISTANCE_FROM_OBJECT_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(DISTANCE_TO_OBJECT_ID(), + ModelAPI_AttributeSelection::typeId()); // attribute for radius - data()->addAttribute(CIRCULAR_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(CIRCULAR_OBJECT_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for angle - data()->addAttribute(ANGLE_FROM_EDGE_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(ANGLE_TO_EDGE_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(ANGLE_FROM_EDGE_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(ANGLE_TO_EDGE_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for angle by 3 points - data()->addAttribute(ANGLE_POINT1_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(ANGLE_POINT2_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(ANGLE_POINT3_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(ANGLE_POINT1_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(ANGLE_POINT2_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(ANGLE_POINT3_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for result message and values data()->addAttribute(RESULT_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + data()->addAttribute(RESULT_VALUES_ID(), + ModelAPI_AttributeDoubleArray::typeId()); } -void FeaturesPlugin_Measurement::execute() -{ -} +void FeaturesPlugin_Measurement::execute() {} -void FeaturesPlugin_Measurement::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_Measurement::attributeChanged(const std::string &theID) { if (theID == MEASURE_KIND()) { // clear results string(RESULT_ID())->setValue(""); std::dynamic_pointer_cast( - attribute(RESULT_VALUES_ID()))->setSize(0); - } - else if (theID != RESULT_ID() && - theID != RESULT_VALUES_ID()) { + attribute(RESULT_VALUES_ID())) + ->setSize(0); + } else if (theID != RESULT_ID() && theID != RESULT_VALUES_ID()) { std::string aKind = string(MEASURE_KIND())->value(); if (aKind == MEASURE_LENGTH()) computeLength(); @@ -111,8 +115,7 @@ void FeaturesPlugin_Measurement::attributeChanged(const std::string& theID) } } -void FeaturesPlugin_Measurement::computeLength() -{ +void FeaturesPlugin_Measurement::computeLength() { AttributeSelectionPtr aSelectedFeature = selection(EDGE_FOR_LENGTH_ID()); GeomShapePtr aShape; @@ -131,25 +134,27 @@ void FeaturesPlugin_Measurement::computeLength() std::ostringstream anOutput; anOutput << "Length = " << std::setprecision(10) << anEdge->length(); - if(anEdge->isLine()) - { + if (anEdge->isLine()) { auto point1 = anEdge->firstPoint(); auto point2 = anEdge->lastPoint(); - anOutput <<"\n|dx| = " << std::setprecision(10) << std::abs(point2->x() - point1->x()) - <<"\n|dy| = " << std::setprecision(10) << std::abs(point2->y() - point1->y()) - <<"\n|dz| = " << std::setprecision(10) << std::abs(point2->z() - point1->z()); + anOutput << "\n|dx| = " << std::setprecision(10) + << std::abs(point2->x() - point1->x()) + << "\n|dy| = " << std::setprecision(10) + << std::abs(point2->y() - point1->y()) + << "\n|dz| = " << std::setprecision(10) + << std::abs(point2->z() - point1->z()); } string(RESULT_ID())->setValue(anOutput.str()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); aValues->setSize(1); aValues->setValue(0, anEdge->length()); } -void FeaturesPlugin_Measurement::computeDistance() -{ +void FeaturesPlugin_Measurement::computeDistance() { AttributeSelectionPtr aFirstFeature = selection(DISTANCE_FROM_OBJECT_ID()); GeomShapePtr aShape1; if (aFirstFeature && aFirstFeature->isInitialized()) { @@ -172,23 +177,25 @@ void FeaturesPlugin_Measurement::computeDistance() } std::array fromShape1To2; - double aDistance = GeomAlgoAPI_ShapeTools::minimalDistance(aShape1, aShape2, fromShape1To2); + double aDistance = + GeomAlgoAPI_ShapeTools::minimalDistance(aShape1, aShape2, fromShape1To2); std::ostringstream anOutput; anOutput << "Distance = " << std::setprecision(10) << aDistance - <<"\n|dx| = " << std::setprecision(10) << std::abs(fromShape1To2[0]) - <<"\n|dy| = " << std::setprecision(10) << std::abs(fromShape1To2[1]) - <<"\n|dz| = " << std::setprecision(10) << std::abs(fromShape1To2[2]); + << "\n|dx| = " << std::setprecision(10) << std::abs(fromShape1To2[0]) + << "\n|dy| = " << std::setprecision(10) << std::abs(fromShape1To2[1]) + << "\n|dz| = " << std::setprecision(10) + << std::abs(fromShape1To2[2]); string(RESULT_ID())->setValue(anOutput.str()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); aValues->setSize(1); aValues->setValue(0, aDistance); } -void FeaturesPlugin_Measurement::computeProximity() -{ +void FeaturesPlugin_Measurement::computeProximity() { AttributeSelectionPtr aFirstFeature = selection(DISTANCE_FROM_OBJECT_ID()); GeomShapePtr aShape1; if (aFirstFeature && aFirstFeature->isInitialized()) { @@ -217,13 +224,13 @@ void FeaturesPlugin_Measurement::computeProximity() string(RESULT_ID())->setValue(anOutput.str()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); aValues->setSize(1); aValues->setValue(0, aDistance); } -void FeaturesPlugin_Measurement::computeRadius() -{ +void FeaturesPlugin_Measurement::computeRadius() { AttributeSelectionPtr aSelectedFeature = selection(CIRCULAR_OBJECT_ID()); GeomShapePtr aShape; @@ -256,13 +263,13 @@ void FeaturesPlugin_Measurement::computeRadius() string(RESULT_ID())->setValue(anOutput.str()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); aValues->setSize(1); aValues->setValue(0, aRadius); } -void FeaturesPlugin_Measurement::computeAngle() -{ +void FeaturesPlugin_Measurement::computeAngle() { AttributeSelectionPtr aFirstFeature = selection(ANGLE_FROM_EDGE_ID()); GeomShapePtr aShape1; GeomEdgePtr anEdge1; @@ -301,10 +308,10 @@ void FeaturesPlugin_Measurement::computeAngle() std::shared_ptr anAngle( new GeomAPI_Angle(anEdge1, anEdge2, aVertex->point())); double anAngleValue = anAngle->angleDegree(); - anOutput << "Angle = " << std::setprecision(10) << anAngleValue << std::endl; + anOutput << "Angle = " << std::setprecision(10) << anAngleValue + << std::endl; aValuesList.push_back(anAngleValue); - } - else { + } else { GeomAPI_ShapeIterator anIt(anInter); for (int anIndex = 1; anIt.more(); anIt.next(), ++anIndex) { GeomShapePtr aCurrent = anIt.current(); @@ -314,8 +321,8 @@ void FeaturesPlugin_Measurement::computeAngle() std::shared_ptr anAngle( new GeomAPI_Angle(anEdge1, anEdge2, aVertex->point())); double anAngleValue = anAngle->angleDegree(); - anOutput << "Angle" << anIndex << " = " - << std::setprecision(10) << anAngleValue << std::endl; + anOutput << "Angle" << anIndex << " = " << std::setprecision(10) + << anAngleValue << std::endl; aValuesList.push_back(anAngleValue); } } @@ -324,15 +331,17 @@ void FeaturesPlugin_Measurement::computeAngle() string(RESULT_ID())->setValue(anOutput.str()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); aValues->setSize((int)aValuesList.size()); int anIndex = 0; - for (std::list::iterator anIt = aValuesList.begin(); anIt != aValuesList.end(); ++anIt) + for (std::list::iterator anIt = aValuesList.begin(); + anIt != aValuesList.end(); ++anIt) aValues->setValue(anIndex++, *anIt); } -static GeomVertexPtr selectionToVertex(const AttributeSelectionPtr& aSelection) -{ +static GeomVertexPtr +selectionToVertex(const AttributeSelectionPtr &aSelection) { GeomShapePtr aShape; GeomVertexPtr aVertex; if (aSelection && aSelection->isInitialized()) { @@ -345,19 +354,18 @@ static GeomVertexPtr selectionToVertex(const AttributeSelectionPtr& aSelection) return aVertex; } -void FeaturesPlugin_Measurement::computeAngleByPoints() -{ +void FeaturesPlugin_Measurement::computeAngleByPoints() { GeomVertexPtr aVertex1 = selectionToVertex(selection(ANGLE_POINT1_ID())); GeomVertexPtr aVertex2 = selectionToVertex(selection(ANGLE_POINT2_ID())); GeomVertexPtr aVertex3 = selectionToVertex(selection(ANGLE_POINT3_ID())); - if (!aVertex1 || !aVertex2 || ! aVertex3) { + if (!aVertex1 || !aVertex2 || !aVertex3) { string(RESULT_ID())->setValue(""); return; } - std::shared_ptr anAngle( - new GeomAPI_Angle(aVertex1->point(), aVertex2->point(), aVertex3->point())); + std::shared_ptr anAngle(new GeomAPI_Angle( + aVertex1->point(), aVertex2->point(), aVertex3->point())); double anAngleValue = anAngle->angleDegree(); std::ostringstream anOutput; @@ -365,15 +373,17 @@ void FeaturesPlugin_Measurement::computeAngleByPoints() string(RESULT_ID())->setValue(anOutput.str()); AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); aValues->setSize(1); aValues->setValue(0, anAngleValue); } -AISObjectPtr FeaturesPlugin_Measurement::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +FeaturesPlugin_Measurement::getAISObject(AISObjectPtr thePrevious) { AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); if ((aValues->size() == 0) || (aValues->value(0) <= Precision::Confusion())) return AISObjectPtr(); @@ -400,8 +410,8 @@ AISObjectPtr FeaturesPlugin_Measurement::getAISObject(AISObjectPtr thePrevious) return anAIS; } -AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePrevious) -{ +AISObjectPtr +FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePrevious) { AISObjectPtr aAISObj; AttributeSelectionPtr aSelectedFeature = selection(EDGE_FOR_LENGTH_ID()); @@ -429,7 +439,8 @@ AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePreviou aPlane.SetLocation(aPnt1); gp_XYZ aNormal = aPlane.Axis().Direction().XYZ(); - gp_XYZ aVec(aPnt2.X() - aPnt1.X(), aPnt2.Y() - aPnt1.Y(), aPnt2.Z() - aPnt1.Z()); + gp_XYZ aVec(aPnt2.X() - aPnt1.X(), aPnt2.Y() - aPnt1.Y(), + aPnt2.Z() - aPnt1.Z()); double aDot = aNormal.Dot(aVec); if (fabs(aDot - aLength) <= Precision::Confusion()) { aPlane = gp_Pln(aPnt1, aPlane.XAxis().Direction()); @@ -438,18 +449,17 @@ AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePreviou Handle(PrsDim_LengthDimension) aDim; if (thePrevious.get()) { aAISObj = thePrevious; - Handle(AIS_InteractiveObject) aAIS = aAISObj->impl(); + Handle(AIS_InteractiveObject) aAIS = + aAISObj->impl(); aDim = Handle(PrsDim_LengthDimension)::DownCast(aAIS); if (aDim.IsNull()) { aDim = new PrsDim_LengthDimension(aTEdge, aPlane); aAISObj = AISObjectPtr(new GeomAPI_AISObject()); aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aDim)); - } - else { + } else { aDim->SetMeasuredGeometry(aTEdge, aPlane); } - } - else { + } else { aDim = new PrsDim_LengthDimension(aTEdge, aPlane); aAISObj = AISObjectPtr(new GeomAPI_AISObject()); aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aDim)); @@ -460,8 +470,8 @@ AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePreviou return aAISObj; } -AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevious) -{ +AISObjectPtr +FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevious) { AISObjectPtr aAISObj; AttributeSelectionPtr aFirstFeature = selection(DISTANCE_FROM_OBJECT_ID()); @@ -479,8 +489,8 @@ AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevi } if (aShape1 && aShape2) { - const TopoDS_Shape& aShp1 = aShape1->impl(); - const TopoDS_Shape& aShp2 = aShape2->impl(); + const TopoDS_Shape &aShp1 = aShape1->impl(); + const TopoDS_Shape &aShp2 = aShape2->impl(); BRepExtrema_DistShapeShape aDist(aShp1, aShp2); aDist.Perform(); if (aDist.IsDone()) { @@ -492,7 +502,8 @@ AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevi aPlane.SetLocation(aPnt1); gp_XYZ aNormal = aPlane.Axis().Direction().XYZ(); - gp_XYZ aVec(aPnt2.X() - aPnt1.X(), aPnt2.Y() - aPnt1.Y(), aPnt2.Z() - aPnt1.Z()); + gp_XYZ aVec(aPnt2.X() - aPnt1.X(), aPnt2.Y() - aPnt1.Y(), + aPnt2.Z() - aPnt1.Z()); double aDot = aNormal.Dot(aVec); if (fabs(aDot - aDistance) <= Precision::Confusion()) { aPlane = gp_Pln(aPnt1, aPlane.XAxis().Direction()); @@ -501,19 +512,18 @@ AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevi Handle(PrsDim_LengthDimension) aDim; if (thePrevious.get()) { aAISObj = thePrevious; - Handle(AIS_InteractiveObject) aAIS = aAISObj->impl(); + Handle(AIS_InteractiveObject) aAIS = + aAISObj->impl(); aDim = Handle(PrsDim_LengthDimension)::DownCast(aAIS); if (aDim.IsNull()) { aDim = new PrsDim_LengthDimension(aPnt1, aPnt2, aPlane); aAISObj = AISObjectPtr(new GeomAPI_AISObject()); aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aDim)); - } - else { + } else { aDim->SetMeasuredGeometry(aPnt1, aPnt2, aPlane); aDim->SetFlyout(aDistance / 3.); } - } - else { + } else { aAISObj = AISObjectPtr(new GeomAPI_AISObject()); aDim = new PrsDim_LengthDimension(aPnt1, aPnt2, aPlane); aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aDim)); @@ -526,8 +536,8 @@ AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevi return aAISObj; } -AISObjectPtr FeaturesPlugin_Measurement::radiusDimension(AISObjectPtr thePrevious) -{ +AISObjectPtr +FeaturesPlugin_Measurement::radiusDimension(AISObjectPtr thePrevious) { AISObjectPtr aAISObj; AttributeSelectionPtr aSelectedFeature = selection(CIRCULAR_OBJECT_ID()); @@ -541,8 +551,10 @@ AISObjectPtr FeaturesPlugin_Measurement::radiusDimension(AISObjectPtr thePreviou TopoDS_Shape aShp = aShape->impl(); if (thePrevious.get()) { aAISObj = thePrevious; - Handle(AIS_InteractiveObject) aAIS = aAISObj->impl(); - Handle(PrsDim_RadiusDimension) aDim = Handle(PrsDim_RadiusDimension)::DownCast(aAIS); + Handle(AIS_InteractiveObject) aAIS = + aAISObj->impl(); + Handle(PrsDim_RadiusDimension) aDim = + Handle(PrsDim_RadiusDimension)::DownCast(aAIS); if (aDim.IsNull()) { aDim = new PrsDim_RadiusDimension(aShp); aAISObj = AISObjectPtr(new GeomAPI_AISObject()); @@ -558,8 +570,8 @@ AISObjectPtr FeaturesPlugin_Measurement::radiusDimension(AISObjectPtr thePreviou return aAISObj; } -AISObjectPtr FeaturesPlugin_Measurement::angleDimension(AISObjectPtr thePrevious) -{ +AISObjectPtr +FeaturesPlugin_Measurement::angleDimension(AISObjectPtr thePrevious) { AISObjectPtr aAISObj; AttributeSelectionPtr aFirstFeature = selection(ANGLE_FROM_EDGE_ID()); GeomShapePtr aShape1; @@ -590,7 +602,8 @@ AISObjectPtr FeaturesPlugin_Measurement::angleDimension(AISObjectPtr thePrevious Handle(PrsDim_AngleDimension) aDim; if (thePrevious.get()) { aAISObj = thePrevious; - Handle(AIS_InteractiveObject) aAIS = aAISObj->impl(); + Handle(AIS_InteractiveObject) aAIS = + aAISObj->impl(); aDim = Handle(PrsDim_AngleDimension)::DownCast(aAIS); if (aDim.IsNull()) { aDim = new PrsDim_AngleDimension(aTEdge1, aTEdge2); @@ -607,8 +620,8 @@ AISObjectPtr FeaturesPlugin_Measurement::angleDimension(AISObjectPtr thePrevious return aAISObj; } -AISObjectPtr FeaturesPlugin_Measurement::angleByPointsDimension(AISObjectPtr thePrevious) -{ +AISObjectPtr +FeaturesPlugin_Measurement::angleByPointsDimension(AISObjectPtr thePrevious) { AISObjectPtr aAISObj; GeomVertexPtr aVertex1 = selectionToVertex(selection(ANGLE_POINT1_ID())); GeomVertexPtr aVertex2 = selectionToVertex(selection(ANGLE_POINT2_ID())); @@ -623,14 +636,16 @@ AISObjectPtr FeaturesPlugin_Measurement::angleByPointsDimension(AISObjectPtr the gp_Pnt aPnt3(aPoint3->impl()); if (aPnt1.IsEqual(aPnt2, Precision::Confusion()) || - aPnt1.IsEqual(aPnt3, Precision::Confusion()) || - aPnt2.IsEqual(aPnt3, Precision::Confusion())) + aPnt1.IsEqual(aPnt3, Precision::Confusion()) || + aPnt2.IsEqual(aPnt3, Precision::Confusion())) return thePrevious; if (thePrevious.get()) { aAISObj = thePrevious; - Handle(AIS_InteractiveObject) aAIS = aAISObj->impl(); - Handle(PrsDim_AngleDimension) aDim = Handle(PrsDim_AngleDimension)::DownCast(aAIS); + Handle(AIS_InteractiveObject) aAIS = + aAISObj->impl(); + Handle(PrsDim_AngleDimension) aDim = + Handle(PrsDim_AngleDimension)::DownCast(aAIS); if (aDim.IsNull()) { aDim = new PrsDim_AngleDimension(aPnt1, aPnt2, aPnt3); aAISObj = AISObjectPtr(new GeomAPI_AISObject()); @@ -638,7 +653,8 @@ AISObjectPtr FeaturesPlugin_Measurement::angleByPointsDimension(AISObjectPtr the } else aDim->SetMeasuredGeometry(aPnt1, aPnt2, aPnt3); } else { - Handle(PrsDim_AngleDimension) aDim = new PrsDim_AngleDimension(aPnt1, aPnt2, aPnt3); + Handle(PrsDim_AngleDimension) aDim = + new PrsDim_AngleDimension(aPnt1, aPnt2, aPnt3); aAISObj = AISObjectPtr(new GeomAPI_AISObject()); aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aDim)); } @@ -646,15 +662,17 @@ AISObjectPtr FeaturesPlugin_Measurement::angleByPointsDimension(AISObjectPtr the return aAISObj; } - -void FeaturesPlugin_Measurement::setupDimension(AISObjectPtr theDim) -{ +void FeaturesPlugin_Measurement::setupDimension(AISObjectPtr theDim) { if (theDim.get()) { - Handle(AIS_InteractiveObject) aAIS = theDim->impl(); + Handle(AIS_InteractiveObject) aAIS = + theDim->impl(); Handle(PrsDim_Dimension) aDim = Handle(PrsDim_Dimension)::DownCast(aAIS); - int aSize = Config_PropManager::integer("Visualization", "dimension_arrow_size"); - int aTextSize = Config_PropManager::integer("Visualization", "dimension_value_size"); - std::string aFont = Config_PropManager::string("Visualization", "dimension_font"); + int aSize = + Config_PropManager::integer("Visualization", "dimension_arrow_size"); + int aTextSize = + Config_PropManager::integer("Visualization", "dimension_value_size"); + std::string aFont = + Config_PropManager::string("Visualization", "dimension_font"); Handle(Prs3d_DimensionAspect) anAspect = aDim->DimensionAspect(); #if OCC_VERSION_LARGE >= 0x07070000 @@ -675,7 +693,8 @@ void FeaturesPlugin_Measurement::setupDimension(AISObjectPtr theDim) aDim->SetDimensionAspect(anAspect); aDim->SetZLayer(Graphic3d_ZLayerId_Top); - std::vector aColor = Config_PropManager::color("Visualization", "sketch_dimension_color"); + std::vector aColor = + Config_PropManager::color("Visualization", "sketch_dimension_color"); theDim->setColor(aColor[0], aColor[1], aColor[2]); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.h b/src/FeaturesPlugin/FeaturesPlugin_Measurement.h index e742f56b2..3f976b371 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Measurement_H_ @@ -36,146 +37,122 @@ /// * radius of arc or cylindrical faces, /// * angle between edges. class FeaturesPlugin_Measurement : public ModelAPI_Feature, - public GeomAPI_IPresentable, - public GeomAPI_IScreenParams -{ + public GeomAPI_IPresentable, + public GeomAPI_IScreenParams { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Measurement"); return MY_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Attribute name for measurement method. - inline static const std::string& MEASURE_KIND() - { + inline static const std::string &MEASURE_KIND() { static const std::string MY_MEASURE_KIND_ID("MeasureKind"); return MY_MEASURE_KIND_ID; } /// Attribute name for length measure. - inline static const std::string& MEASURE_LENGTH() - { + inline static const std::string &MEASURE_LENGTH() { static const std::string MY_MEASURE_ID("Length"); return MY_MEASURE_ID; } /// Attribute name for distance measure. - inline static const std::string& MEASURE_DISTANCE() - { + inline static const std::string &MEASURE_DISTANCE() { static const std::string MY_MEASURE_ID("Distance"); return MY_MEASURE_ID; } /// Attribute name for distance measure. - inline static const std::string& MEASURE_PROXIMITY() - { + inline static const std::string &MEASURE_PROXIMITY() { static const std::string MY_MEASURE_ID("Proximity"); return MY_MEASURE_ID; } /// Attribute name for radius measure. - inline static const std::string& MEASURE_RADIUS() - { + inline static const std::string &MEASURE_RADIUS() { static const std::string MY_MEASURE_ID("Radius"); return MY_MEASURE_ID; } /// Attribute name for angle measure. - inline static const std::string& MEASURE_ANGLE() - { + inline static const std::string &MEASURE_ANGLE() { static const std::string MY_MEASURE_ID("Angle"); return MY_MEASURE_ID; } /// Attribute name for angle measurement by 3 points. - inline static const std::string& MEASURE_ANGLE_POINTS() - { + inline static const std::string &MEASURE_ANGLE_POINTS() { static const std::string MY_MEASURE_ID("AngleBy3Points"); return MY_MEASURE_ID; } - /// Attribute name of edge selected for length calculation. - inline static const std::string& EDGE_FOR_LENGTH_ID() - { + inline static const std::string &EDGE_FOR_LENGTH_ID() { static const std::string MY_EDGE_FOR_LENGTH_ID("edge_for_length"); return MY_EDGE_FOR_LENGTH_ID; } /// Attribute name of first shape selected for distance calculation. - inline static const std::string& DISTANCE_FROM_OBJECT_ID() - { + inline static const std::string &DISTANCE_FROM_OBJECT_ID() { static const std::string MY_DISTANCE_FROM_OBJECT_ID("distance_from"); return MY_DISTANCE_FROM_OBJECT_ID; } /// Attribute name of second shape selected for distance calculation. - inline static const std::string& DISTANCE_TO_OBJECT_ID() - { + inline static const std::string &DISTANCE_TO_OBJECT_ID() { static const std::string MY_DISTANCE_TO_OBJECT_ID("distance_to"); return MY_DISTANCE_TO_OBJECT_ID; } // Attribute name of edge or face selected to calculate radius. - inline static const std::string& CIRCULAR_OBJECT_ID() - { + inline static const std::string &CIRCULAR_OBJECT_ID() { static const std::string MY_CIRCULAR_OBJECT_ID("circular"); return MY_CIRCULAR_OBJECT_ID; } /// Attribute name of first edge selected for angle calculation. - inline static const std::string& ANGLE_FROM_EDGE_ID() - { + inline static const std::string &ANGLE_FROM_EDGE_ID() { static const std::string MY_ANGLE_FROM_EDGE_ID("angle_from"); return MY_ANGLE_FROM_EDGE_ID; } /// Attribute name of second shape selected for angle calculation. - inline static const std::string& ANGLE_TO_EDGE_ID() - { + inline static const std::string &ANGLE_TO_EDGE_ID() { static const std::string MY_ANGLE_TO_EDGE_ID("angle_to"); return MY_ANGLE_TO_EDGE_ID; } /// Attribute name of first point selected for angle calculation. - inline static const std::string& ANGLE_POINT1_ID() - { + inline static const std::string &ANGLE_POINT1_ID() { static const std::string MY_ANGLE_POINT1_ID("angle_point_1"); return MY_ANGLE_POINT1_ID; } /// Attribute name of second point (apex) selected for angle calculation. - inline static const std::string& ANGLE_POINT2_ID() - { + inline static const std::string &ANGLE_POINT2_ID() { static const std::string MY_ANGLE_POINT2_ID("angle_point_2"); return MY_ANGLE_POINT2_ID; } /// Attribute name of third point selected for angle calculation. - inline static const std::string& ANGLE_POINT3_ID() - { + inline static const std::string &ANGLE_POINT3_ID() { static const std::string MY_ANGLE_POINT3_ID("angle_point_3"); return MY_ANGLE_POINT3_ID; } /// Attribute name for result. - inline static const std::string& RESULT_ID() - { + inline static const std::string &RESULT_ID() { static const std::string MY_RESULT_ID("result"); return MY_RESULT_ID; } /// Attribute name for values of result. - inline static const std::string& RESULT_VALUES_ID() - { + inline static const std::string &RESULT_VALUES_ID() { static const std::string MY_RESULT_VALUES_ID("result_values"); return MY_RESULT_VALUES_ID; } @@ -183,20 +160,22 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. virtual bool isMacro() const { return true; } /** Returns the AIS preview - * \param thePrevious - defines a presentation if it was created previously - */ - FEATURESPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + * \param thePrevious - defines a presentation if it was created previously + */ + FEATURESPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Set current screen plane /// \param theScreenPlane the screen plane @@ -206,9 +185,7 @@ public: /// Set current view scale /// \param theScale the view scale - virtual void setViewScale(double theScale) { - mySceenScale = theScale; - } + virtual void setViewScale(double theScale) { mySceenScale = theScale; } /// Use plugin manager for features creation FeaturesPlugin_Measurement(); @@ -218,7 +195,8 @@ private: void computeLength(); /// Compute minimal distance between pair of shapes void computeDistance(); - /// Compute proximity (maximum of all minimal distances between pair of shapes) + /// Compute proximity (maximum of all minimal distances between pair of + /// shapes) void computeProximity(); /// Compute radius of circular edge, cylindrical surface or sphere. void computeRadius(); @@ -251,7 +229,7 @@ private: void setupDimension(AISObjectPtr theDim); GeomPlanePtr myScreenPlane; //< a plane of current screen - double mySceenScale; //< a scale of current view + double mySceenScale; //< a scale of current view }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp index 5130d8293..05a812878 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: FeaturesPlugin_MultiRotation.cpp @@ -46,23 +47,20 @@ #include #include -#include #include +#include static const std::string MULTIROTATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() -{ -} +FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() {} //================================================================================================= -void FeaturesPlugin_MultiRotation::initAttributes() -{ +void FeaturesPlugin_MultiRotation::initAttributes() { AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID(), ModelAPI_AttributeSelection::typeId()); @@ -89,10 +87,10 @@ void FeaturesPlugin_MultiRotation::initAttributes() } //================================================================================================= -void FeaturesPlugin_MultiRotation::execute() -{ +void FeaturesPlugin_MultiRotation::execute() { #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS - std::string useRadialDir = string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value(); + std::string useRadialDir = + string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value(); if (useRadialDir.empty()) { performRotation1D(); } else { @@ -104,12 +102,11 @@ void FeaturesPlugin_MultiRotation::execute() } //================================================================================================= -bool FeaturesPlugin_MultiRotation::paramsOfRotation(std::shared_ptr& theAxis, - double& theAngle, - int& theQuantity) -{ - //Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; +bool FeaturesPlugin_MultiRotation::paramsOfRotation( + std::shared_ptr &theAxis, double &theAngle, int &theQuantity) { + // Getting axis. + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; AttributeSelectionPtr anObjRef = selection(AXIS_ANGULAR_ID()); GeomShapePtr aShape = anObjRef->value(); if (!aShape.get() && anObjRef->context().get()) @@ -132,20 +129,23 @@ bool FeaturesPlugin_MultiRotation::paramsOfRotation(std::shared_ptr return false; } - theAxis.reset(new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); + theAxis.reset( + new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); // Getting number of copies. - theQuantity = integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value(); + theQuantity = + integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value(); if (theQuantity <= 0) { std::string aFeatureError = "Multirotation builder "; - aFeatureError += ":: the number of copies for the angular direction is null or negative."; + aFeatureError += ":: the number of copies for the angular direction is " + "null or negative."; setError(aFeatureError); return false; } // Getting angle std::string useAngularStep = - string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->value(); + string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->value(); if (!useAngularStep.empty()) theAngle = real(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID())->value(); else @@ -154,8 +154,7 @@ bool FeaturesPlugin_MultiRotation::paramsOfRotation(std::shared_ptr } //================================================================================================= -void FeaturesPlugin_MultiRotation::performRotation1D() -{ +void FeaturesPlugin_MultiRotation::performRotation1D() { bool isKeepSubShapes = data()->version() == MULTIROTATION_VERSION_1; // Getting objects. @@ -168,8 +167,8 @@ void FeaturesPlugin_MultiRotation::performRotation1D() GeomAPI_ShapeHierarchy anObjects; std::list aParts; ResultPtr aTextureSource; - if (!FeaturesPlugin_Tools::shapesFromSelectionList - (anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + if (!FeaturesPlugin_Tools::shapesFromSelectionList( + anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; // Parameters of rotation. @@ -179,23 +178,26 @@ void FeaturesPlugin_MultiRotation::performRotation1D() if (!paramsOfRotation(anAxis, anAngle, nbCopies)) return; - std::string anError; int aResultIndex = 0; // Moving each part. - for (std::list::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) { - ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aPRes); + for (std::list::iterator aPRes = aParts.begin(); + aPRes != aParts.end(); ++aPRes) { + ResultPartPtr anOrigin = + std::dynamic_pointer_cast(*aPRes); std::shared_ptr aTrsf(new GeomAPI_Trsf()); for (int i = 0; i < nbCopies; ++i) { aTrsf->setRotation(anAxis, i * anAngle); - ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); + ResultPartPtr aResultPart = + document()->copyPart(anOrigin, data(), aResultIndex); aResultPart->setTrsf(anOrigin, aTrsf); setResult(aResultPart, aResultIndex++); } } // Collect transformations for each object in a part. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeSet); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeSet); for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) { std::shared_ptr aBaseShape = *anObjectsIt; @@ -206,7 +208,8 @@ void FeaturesPlugin_MultiRotation::performRotation1D() new GeomAlgoAPI_Rotation(aBaseShape, anAxis, i * anAngle)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationnAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationnAlgo, + getKind(), anError)) { setError(anError); break; } @@ -214,18 +217,21 @@ void FeaturesPlugin_MultiRotation::performRotation1D() aMakeShapeList->appendAlgo(aRotationnAlgo); } - GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); + GeomShapePtr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); anObjects.markModified(aBaseShape, aCompound); } // Build results of the operation. - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Rotated"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Rotated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); @@ -237,21 +243,21 @@ void FeaturesPlugin_MultiRotation::performRotation1D() //================================================================================================= #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS -void FeaturesPlugin_MultiRotation::performRotation2D() -{ +void FeaturesPlugin_MultiRotation::performRotation2D() { // Getting objects. ListOfShape anObjects; std::list aContextes; AttributeSelectionListPtr anObjectsSelList = - selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID()); + selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID()); if (anObjectsSelList->size() == 0) { return; } - for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + anObjectsIndex++) { std::shared_ptr anObjectAttr = - anObjectsSelList->value(anObjectsIndex); + anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); - if(!anObject.get()) { // may be for not-activated parts + if (!anObject.get()) { // may be for not-activated parts return; } anObjects.push_back(anObject); @@ -265,14 +271,14 @@ void FeaturesPlugin_MultiRotation::performRotation2D() if (!paramsOfRotation(anAxis, anAngle, nbCopies)) return; - // Getting number of copies int he radial direction. int nbRadial = - integer(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID())->value(); + integer(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID())->value(); - if (nbRadial <=0) { + if (nbRadial <= 0) { std::string aFeatureError = "Multirotation builder "; - aFeatureError+=":: the number of copies for the radial direction is null or negative."; + aFeatureError += + ":: the number of copies for the radial direction is null or negative."; setError(aFeatureError); return; } @@ -283,21 +289,23 @@ void FeaturesPlugin_MultiRotation::performRotation2D() // Moving each object. int aResultIndex = 0; std::list::iterator aContext = aContextes.begin(); - for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); - anObjectsIt++, aContext++) { + for (ListOfShape::iterator anObjectsIt = anObjects.begin(); + anObjectsIt != anObjects.end(); anObjectsIt++, aContext++) { std::shared_ptr aBaseShape = *anObjectsIt; - bool isPart = aContext->get() && (*aContext)->groupName() == ModelAPI_ResultPart::group(); + bool isPart = aContext->get() && + (*aContext)->groupName() == ModelAPI_ResultPart::group(); std::shared_ptr aDir = - GeomAlgoAPI_ShapeTools::buildDirFromAxisAndShape(aBaseShape, anAxis); + GeomAlgoAPI_ShapeTools::buildDirFromAxisAndShape(aBaseShape, anAxis); double x = aDir->x(); double y = aDir->y(); double z = aDir->z(); - double norm = sqrt(x*x+y*y+z*z); + double norm = sqrt(x * x + y * y + z * z); // Setting result. if (isPart) { - /*ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aContext); + /*ResultPartPtr anOrigin = + std::dynamic_pointer_cast(*aContext); std::shared_ptr aTrsf(new GeomAPI_Trsf()); for (int j=0; jsetTranslation(dx, dy, dz); - ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); - aResultPart->setTrsf(*aContext, aTrsf); + ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), + aResultIndex); aResultPart->setTrsf(*aContext, aTrsf); setResult(aResultPart, aResultIndex); aResultIndex++; } }*/ } else { ListOfShape aListOfShape; - std::list > aListOfTranslationAlgo; - std::list > aListOfRotationAlgo; - for (int j=0; j> + aListOfTranslationAlgo; + std::list> aListOfRotationAlgo; + for (int j = 0; j < nbRadial; j++) { // Translation - double dx = j*aStep*x/norm; - double dy = j*aStep*y/norm; - double dz = j*aStep*z/norm; + double dx = j * aStep * x / norm; + double dy = j * aStep * y / norm; + double dz = j * aStep * z / norm; std::shared_ptr aTranslationAlgo( - new GeomAlgoAPI_Translation(aBaseShape, dx, dy, dz)); + new GeomAlgoAPI_Translation(aBaseShape, dx, dy, dz)); if (!aTranslationAlgo->check()) { setError(aTranslationAlgo->getError()); @@ -332,42 +341,50 @@ void FeaturesPlugin_MultiRotation::performRotation2D() // Checking that the algorithm worked properly. if (!aTranslationAlgo->isDone()) { - static const std::string aFeatureError = "Error : Multirotation algorithm failed."; + static const std::string aFeatureError = + "Error : Multirotation algorithm failed."; setError(aFeatureError); break; } if (aTranslationAlgo->shape()->isNull()) { - static const std::string aShapeError = "Error : Resulting shape is null."; + static const std::string aShapeError = + "Error : Resulting shape is null."; setError(aShapeError); break; } if (!aTranslationAlgo->isValid()) { - static const std::string aFeatureError = "Error : Resulting shape in not valid."; + static const std::string aFeatureError = + "Error : Resulting shape in not valid."; setError(aFeatureError); break; } aListOfShape.push_back(aTranslationAlgo->shape()); aListOfTranslationAlgo.push_back(aTranslationAlgo); - for (int i=1; i aRotationnAlgo( - new GeomAlgoAPI_Rotation(aTranslationAlgo->shape(), anAxis, i*anAngle)); + new GeomAlgoAPI_Rotation(aTranslationAlgo->shape(), anAxis, + i * anAngle)); if (!aRotationnAlgo->check()) { setError(aTranslationAlgo->getError()); break; } - aRotationnAlgo->build();// Checking that the algorithm worked properly. + aRotationnAlgo + ->build(); // Checking that the algorithm worked properly. if (!aRotationnAlgo->isDone()) { - static const std::string aFeatureError = "Error : Multirotation algorithm failed."; + static const std::string aFeatureError = + "Error : Multirotation algorithm failed."; setError(aFeatureError); break; } if (aRotationnAlgo->shape()->isNull()) { - static const std::string aShapeError = "Error : Resulting shape is null."; + static const std::string aShapeError = + "Error : Resulting shape is null."; setError(aShapeError); break; } if (!aRotationnAlgo->isValid()) { - static const std::string aFeatureError = "Error : Resulting shape in not valid."; + static const std::string aFeatureError = + "Error : Resulting shape in not valid."; setError(aFeatureError); break; } @@ -376,7 +393,7 @@ void FeaturesPlugin_MultiRotation::performRotation2D() } } std::shared_ptr aCompound = - GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); + GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); aResultBody->storeModified(aBaseShape, aCompound); @@ -393,43 +410,47 @@ void FeaturesPlugin_MultiRotation::performRotation2D() //================================================================================================= void FeaturesPlugin_MultiRotation::loadNamingDS2( - std::list > theListOfTranslationAlgo, + std::list> + theListOfTranslationAlgo, std::shared_ptr theResultBody, - std::shared_ptr theBaseShape) -{ - for (std::list >::const_iterator anIt = - theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) { + std::shared_ptr theBaseShape) { + for (std::list>::const_iterator + anIt = theListOfTranslationAlgo.begin(); + anIt != theListOfTranslationAlgo.cend(); ++anIt) { // naming of faces - theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, "Rotated_Face"); + theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, + "Rotated_Face"); // naming of edges - theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, "Rotated_Edge"); + theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, + "Rotated_Edge"); // naming of vertex - theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::VERTEX, "Rotated_Vertex"); + theResultBody->loadModifiedShapes(*anIt, theBaseShape, + GeomAPI_Shape::VERTEX, "Rotated_Vertex"); } } //================================================================================================= void FeaturesPlugin_MultiRotation::loadNamingDS3( - std::list > theListOfRotationAlgo, + std::list> theListOfRotationAlgo, std::shared_ptr theResultBody, - std::shared_ptr theBaseShape, int nb) -{ - int anIndex = nb+1; + std::shared_ptr theBaseShape, int nb) { + int anIndex = nb + 1; std::string aRotatedName; - for (std::list >::const_iterator anIt = - theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) { + for (std::list>::const_iterator anIt = + theListOfRotationAlgo.begin(); + anIt != theListOfRotationAlgo.cend(); ++anIt) { // naming of faces int numFace = 1; GeomAPI_ShapeExplorer anExp((*anIt)->shape(), GeomAPI_Shape::FACE); - for(; anExp.more(); anExp.next()) { - aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex); - aRotatedName = aRotatedName + "_" + std::to_string((long long) numFace); - theResultBody->generated(anExp.current(), aRotatedName); - ++numFace; + for (; anExp.more(); anExp.next()) { + aRotatedName = "Rotated_Face_" + std::to_string((long long)anIndex); + aRotatedName = aRotatedName + "_" + std::to_string((long long)numFace); + theResultBody->generated(anExp.current(), aRotatedName); + ++numFace; } ++anIndex; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h index 757e59f9a..681c27bec 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: FeaturesPlugin_MultiRotation.h @@ -34,78 +35,67 @@ /** \class FeaturesPlugin_MultiRotation * \ingroup Plugins * \brief Feature that rotaes object around an axis an number of times. - * The 2D version also makes translated copies of the object and performs the rotation - * on these as well. + * The 2D version also makes translated copies of the object and + * performs the rotation on these as well. */ -class FeaturesPlugin_MultiRotation : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_MultiRotation : public ModelAPI_Feature { +public: /// Multi-rotation kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_MULTIROTATION_ID("AngularCopy"); return MY_MULTIROTATION_ID; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name of the angular direction. - inline static const std::string& AXIS_ANGULAR_ID() - { + inline static const std::string &AXIS_ANGULAR_ID() { static const std::string MY_AXIS_ANGULAR_ID("axis_angular"); return MY_AXIS_ANGULAR_ID; } /// Attribute name for use angular step. - inline static const std::string& USE_ANGULAR_STEP_ID() - { + inline static const std::string &USE_ANGULAR_STEP_ID() { static const std::string MY_USE_ANGULAR_STEP_ID("use_step_angular"); return MY_USE_ANGULAR_STEP_ID; } /// Attribute name of step for the angular. - inline static const std::string& STEP_ANGULAR_ID() - { + inline static const std::string &STEP_ANGULAR_ID() { static const std::string MY_STEP_ANGULAR_ID("step_angular"); return MY_STEP_ANGULAR_ID; } /// Attribute name of number of copies for angular. - inline static const std::string& NB_COPIES_ANGULAR_ID() - { + inline static const std::string &NB_COPIES_ANGULAR_ID() { static const std::string MY_NB_COPIES_ANGULAR_ID("nb_angular"); return MY_NB_COPIES_ANGULAR_ID; } /// Attribute name for use radial dir. - inline static const std::string& USE_RADIAL_DIR_ID() - { + inline static const std::string &USE_RADIAL_DIR_ID() { static const std::string MY_USE_RADIAL_DIR_ID("use_radial_dir"); return MY_USE_RADIAL_DIR_ID; } /// Attribute name of radial step. - inline static const std::string& STEP_RADIAL_ID() - { + inline static const std::string &STEP_RADIAL_ID() { static const std::string MY_STEP_RADIAL_ID("step_radial"); return MY_STEP_RADIAL_ID; } /// Attribute name of number of copies for radial. - inline static const std::string& NB_COPIES_RADIAL_ID() - { + inline static const std::string &NB_COPIES_RADIAL_ID() { static const std::string MY_NB_COPIES_RADIAL_ID("nb_radial"); return MY_NB_COPIES_RADIAL_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID(); return MY_KIND; } @@ -113,7 +103,8 @@ class FeaturesPlugin_MultiRotation : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -122,7 +113,8 @@ class FeaturesPlugin_MultiRotation : public ModelAPI_Feature private: /// Fill axis, number of copies and angle of the rotation. /// \returns \c false in case of errors. - bool paramsOfRotation(std::shared_ptr& theAxis, double& theAngle, int& theQuantity); + bool paramsOfRotation(std::shared_ptr &theAxis, double &theAngle, + int &theQuantity); /// Perform the multi rotation in one direction. void performRotation1D(); @@ -131,13 +123,15 @@ private: /// Perform the multi rotation in two directions. void performRotation2D(); - void loadNamingDS2(std::list > theListOfTranslationAlgo, - std::shared_ptr theResultBody, - std::shared_ptr theBaseShape); + void loadNamingDS2(std::list> + theListOfTranslationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape); - void loadNamingDS3(std::list > theListOfRotationAlgo, - std::shared_ptr theResultBody, - std::shared_ptr theBaseShape, int nb); + void loadNamingDS3( + std::list> theListOfRotationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape, int nb); #endif }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp index 7c1537c95..f1b7c02d9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -44,24 +45,23 @@ static const std::string MULTITRANSLATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_MultiTranslation::FeaturesPlugin_MultiTranslation() -{ -} +FeaturesPlugin_MultiTranslation::FeaturesPlugin_MultiTranslation() {} //================================================================================================= -void FeaturesPlugin_MultiTranslation::initAttributes() -{ +void FeaturesPlugin_MultiTranslation::initAttributes() { AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID(), - ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute( + FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID(), - ModelAPI_AttributeInteger::typeId()); + data()->addAttribute( + FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID(), + ModelAPI_AttributeInteger::typeId()); data()->addAttribute(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID(), ModelAPI_AttributeString::typeId()); @@ -69,8 +69,9 @@ void FeaturesPlugin_MultiTranslation::initAttributes() ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FeaturesPlugin_MultiTranslation::STEP_SECOND_DIR_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID(), - ModelAPI_AttributeInteger::typeId()); + data()->addAttribute( + FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID(), + ModelAPI_AttributeInteger::typeId()); if (!aSelection->isInitialized()) { // new feature, not read from file @@ -79,8 +80,7 @@ void FeaturesPlugin_MultiTranslation::initAttributes() } //================================================================================================= -void FeaturesPlugin_MultiTranslation::execute() -{ +void FeaturesPlugin_MultiTranslation::execute() { bool isKeepSubShapes = data()->version() == MULTITRANSLATION_VERSION_1; // Getting objects. @@ -93,8 +93,8 @@ void FeaturesPlugin_MultiTranslation::execute() GeomAPI_ShapeHierarchy anObjects; std::list aParts; ResultPtr aTextureSource; - if (!FeaturesPlugin_Tools::shapesFromSelectionList - (anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + if (!FeaturesPlugin_Tools::shapesFromSelectionList( + anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; std::shared_ptr aFirstDir, aSecondDir; @@ -107,8 +107,7 @@ void FeaturesPlugin_MultiTranslation::execute() if (useSecondDir) { if (!paramsAlongDirection(1, aSecondDir, aSecondStep, aSecondNbCopies)) return; - } - else { + } else { aSecondDir = aFirstDir; // direction does not matter aSecondStep = 0.0; aSecondNbCopies = 1; @@ -117,17 +116,23 @@ void FeaturesPlugin_MultiTranslation::execute() std::string anError; int aResultIndex = 0; // Moving each part. - for (std::list::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) { - ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aPRes); + for (std::list::iterator aPRes = aParts.begin(); + aPRes != aParts.end(); ++aPRes) { + ResultPartPtr anOrigin = + std::dynamic_pointer_cast(*aPRes); std::shared_ptr aTrsf(new GeomAPI_Trsf()); for (int j = 0; j < aSecondNbCopies; j++) { for (int i = 0; i < aFirstNbCopies; i++) { - double dx = i * aFirstStep * aFirstDir->x() + j * aSecondStep * aSecondDir->x(); - double dy = i * aFirstStep * aFirstDir->y() + j * aSecondStep * aSecondDir->y(); - double dz = i * aFirstStep * aFirstDir->z() + j * aSecondStep * aSecondDir->z(); + double dx = + i * aFirstStep * aFirstDir->x() + j * aSecondStep * aSecondDir->x(); + double dy = + i * aFirstStep * aFirstDir->y() + j * aSecondStep * aSecondDir->y(); + double dz = + i * aFirstStep * aFirstDir->z() + j * aSecondStep * aSecondDir->z(); aTrsf->setTranslation(dx, dy, dz); - ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); + ResultPartPtr aResultPart = + document()->copyPart(anOrigin, data(), aResultIndex); aResultPart->setTrsf(anOrigin, aTrsf); setResult(aResultPart, aResultIndex); aResultIndex++; @@ -136,7 +141,8 @@ void FeaturesPlugin_MultiTranslation::execute() } // Collect transformations for each object in a part. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeSet); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeSet); for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) { std::shared_ptr aBaseShape = *anObjectsIt; @@ -144,15 +150,18 @@ void FeaturesPlugin_MultiTranslation::execute() for (int j = 0; j < aSecondNbCopies; j++) { for (int i = 0; i < aFirstNbCopies; i++) { - double dx = i * aFirstStep * aFirstDir->x() + j * aSecondStep * aSecondDir->x(); - double dy = i * aFirstStep * aFirstDir->y() + j * aSecondStep * aSecondDir->y(); - double dz = i * aFirstStep * aFirstDir->z() + j * aSecondStep * aSecondDir->z(); + double dx = + i * aFirstStep * aFirstDir->x() + j * aSecondStep * aSecondDir->x(); + double dy = + i * aFirstStep * aFirstDir->y() + j * aSecondStep * aSecondDir->y(); + double dz = + i * aFirstStep * aFirstDir->z() + j * aSecondStep * aSecondDir->z(); std::shared_ptr aTranslationAlgo( new GeomAlgoAPI_Translation(aBaseShape, dx, dy, dz)); // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( - aTranslationAlgo, getKind(), anError)) { + aTranslationAlgo, getKind(), anError)) { setError(anError); break; } @@ -160,18 +169,21 @@ void FeaturesPlugin_MultiTranslation::execute() aMakeShapeList->appendAlgo(aTranslationAlgo); } } - GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); + GeomShapePtr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); anObjects.markModified(aBaseShape, aCompound); } // Build results of the operation. - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Translated"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Translated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); @@ -182,18 +194,19 @@ void FeaturesPlugin_MultiTranslation::execute() } //================================================================================================= -bool FeaturesPlugin_MultiTranslation::paramsAlongDirection(const int theIndex, - std::shared_ptr& theDir, - double& theDistance, - int& theQuantity) -{ - static std::string THE_AXIS_DIR[2] = { AXIS_FIRST_DIR_ID(), AXIS_SECOND_DIR_ID() }; - static std::string THE_STEP[2] = { STEP_FIRST_DIR_ID(), STEP_SECOND_DIR_ID() }; - static std::string THE_COPIES[2] = { NB_COPIES_FIRST_DIR_ID(), NB_COPIES_SECOND_DIR_ID() }; - static std::string THE_INDEX_ID[2] = { "first", "second" }; - - //Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; +bool FeaturesPlugin_MultiTranslation::paramsAlongDirection( + const int theIndex, std::shared_ptr &theDir, + double &theDistance, int &theQuantity) { + static std::string THE_AXIS_DIR[2] = {AXIS_FIRST_DIR_ID(), + AXIS_SECOND_DIR_ID()}; + static std::string THE_STEP[2] = {STEP_FIRST_DIR_ID(), STEP_SECOND_DIR_ID()}; + static std::string THE_COPIES[2] = {NB_COPIES_FIRST_DIR_ID(), + NB_COPIES_SECOND_DIR_ID()}; + static std::string THE_INDEX_ID[2] = {"first", "second"}; + + // Getting axis. + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; AttributeSelectionPtr anObjRef = selection(THE_AXIS_DIR[theIndex]); GeomShapePtr aShape = anObjRef->value(); if (!aShape.get() && anObjRef->context().get()) @@ -220,7 +233,8 @@ bool FeaturesPlugin_MultiTranslation::paramsAlongDirection(const int theIndex, theDistance = real(THE_STEP[theIndex])->value(); theQuantity = integer(THE_COPIES[theIndex])->value(); if (theQuantity <= 0) { - std::string aFeatureError = "Multitranslation builder :: the number of copies for the "; + std::string aFeatureError = + "Multitranslation builder :: the number of copies for the "; aFeatureError += THE_INDEX_ID[theIndex] + " direction is null or negative."; setError(aFeatureError); return false; diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h index 1f1d311b8..444326679 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_MULTITRANSLATION_H_ @@ -28,78 +29,67 @@ class GeomAPI_Dir; /** \class FeaturesPlugin_MultiTranslation * \ingroup Plugins - * \brief Feature for movement objects along one or two axes an arbitary number of times, - * making a copy every time. + * \brief Feature for movement objects along one or two axes an arbitary number + * of times, making a copy every time. */ -class FeaturesPlugin_MultiTranslation : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_MultiTranslation : public ModelAPI_Feature { +public: /// Multi-translation kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_MULTITRANSLATION_ID("LinearCopy"); return MY_MULTITRANSLATION_ID; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name of a first direction. - inline static const std::string& AXIS_FIRST_DIR_ID() - { + inline static const std::string &AXIS_FIRST_DIR_ID() { static const std::string MY_AXIS_FIRST_DIR_ID("axis_first_dir"); return MY_AXIS_FIRST_DIR_ID; } /// Attribute name of step for the first direction. - inline static const std::string& STEP_FIRST_DIR_ID() - { + inline static const std::string &STEP_FIRST_DIR_ID() { static const std::string MY_STEP_FIRST_DIR_ID("step_first_dir"); return MY_STEP_FIRST_DIR_ID; } /// Attribute name of number of copies for the first direction. - inline static const std::string& NB_COPIES_FIRST_DIR_ID() - { + inline static const std::string &NB_COPIES_FIRST_DIR_ID() { static const std::string MY_NB_COPIES_FIRST_DIR_ID("nb_first_dir"); return MY_NB_COPIES_FIRST_DIR_ID; } /// Attribute name for use second dir. - inline static const std::string& USE_SECOND_DIR_ID() - { + inline static const std::string &USE_SECOND_DIR_ID() { static const std::string MY_USE_SECOND_DIR_ID("use_second_dir"); return MY_USE_SECOND_DIR_ID; } /// Attribute name of a second direction. - inline static const std::string& AXIS_SECOND_DIR_ID() - { + inline static const std::string &AXIS_SECOND_DIR_ID() { static const std::string MY_AXIS_SECOND_DIR_ID("axis_second_dir"); return MY_AXIS_SECOND_DIR_ID; } /// Attribute name of step for the second direction. - inline static const std::string& STEP_SECOND_DIR_ID() - { + inline static const std::string &STEP_SECOND_DIR_ID() { static const std::string MY_STEP_SECOND_DIR_ID("step_second_dir"); return MY_STEP_SECOND_DIR_ID; } /// Attribute name of number of copies for the second direction. - inline static const std::string& NB_COPIES_SECOND_DIR_ID() - { + inline static const std::string &NB_COPIES_SECOND_DIR_ID() { static const std::string MY_NB_COPIES_SECOND_DIR_ID("nb_second_dir"); return MY_NB_COPIES_SECOND_DIR_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_MultiTranslation::ID(); return MY_KIND; } @@ -107,7 +97,8 @@ class FeaturesPlugin_MultiTranslation : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -117,9 +108,8 @@ private: /// Fill axis, number of copies and distance for the given direction. /// \returns \c false in case of errors. bool paramsAlongDirection(const int theIndex, - std::shared_ptr& theDir, - double& theDistance, - int& theQuantity); + std::shared_ptr &theDir, + double &theDistance, int &theQuantity); }; -#endif // FEATURESPLUGIN_MULTITRANSLATION_H_ \ No newline at end of file +#endif // FEATURESPLUGIN_MULTITRANSLATION_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp index 012a489a8..899045aac 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp @@ -14,54 +14,53 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_NormalToFace.h" +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include //================================================================================================= -FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() -{ -} +FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() {} //================================================================================================= -void FeaturesPlugin_NormalToFace::initAttributes() -{ +void FeaturesPlugin_NormalToFace::initAttributes() { // attribute for object selected - data()->addAttribute(FACE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(VERTEX_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FACE_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(VERTEX_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); // attributes for result message and values data()->addAttribute(VERTEX_OPTION_ID(), ModelAPI_AttributeString::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERTEX_SELECTED_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), VERTEX_SELECTED_ID()); } //================================================================================================= -void FeaturesPlugin_NormalToFace::attributeChanged(const std::string& /*theID*/) -{ -} +void FeaturesPlugin_NormalToFace::attributeChanged( + const std::string & /*theID*/) {} //================================================================================================= -void FeaturesPlugin_NormalToFace::execute() -{ +void FeaturesPlugin_NormalToFace::execute() { AttributeSelectionPtr aSelectionFace = selection(FACE_SELECTED_ID()); AttributeSelectionPtr aSelectionPoint = selection(VERTEX_SELECTED_ID()); @@ -73,7 +72,7 @@ void FeaturesPlugin_NormalToFace::execute() aShapePoint = aSelectionPoint->value(); if (!aShapePoint && aSelectionPoint->context()) aShapePoint = aSelectionPoint->context()->shape(); - } + } } if (aSelectionFace && aSelectionFace->isInitialized()) { @@ -85,11 +84,9 @@ void FeaturesPlugin_NormalToFace::execute() if (aShape) { std::string aError; std::shared_ptr theNormal(new GeomAPI_Edge); - if (!GeomAlgoAPI_NormalToFace::normal(aShape, - aShapePoint, - theNormal, + if (!GeomAlgoAPI_NormalToFace::normal(aShape, aShapePoint, theNormal, aError)) - setError("Error in bounding box calculation :" + aError); + setError("Error in bounding box calculation :" + aError); GeomDirPtr theDir; std::shared_ptr aPnt = theNormal->lastPoint(); @@ -101,8 +98,7 @@ void FeaturesPlugin_NormalToFace::execute() aPnt->translate(theDir, 100); std::shared_ptr anEdge = - GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), - aPnt); + GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), aPnt); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); @@ -110,5 +106,3 @@ void FeaturesPlugin_NormalToFace::execute() setResult(aConstr); } } - - diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h index bc2211b2c..cbd8cb459 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_NormalToFace_H_ @@ -29,56 +30,48 @@ /// \class FeaturesPlugin_NormalToFace /// \ingroup Plugins /// \brief Persistence feature to construct normal to face -class FeaturesPlugin_NormalToFace : public ModelAPI_Feature -{ +class FeaturesPlugin_NormalToFace : public ModelAPI_Feature { public: /// Normal to face kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Normal"); return MY_ID; } /// Attribute name for face selected. - inline static const std::string& FACE_SELECTED_ID() - { + inline static const std::string &FACE_SELECTED_ID() { static const std::string MY_FACE_ID("face"); return MY_FACE_ID; } /// Attribute name for vertex selected. - inline static const std::string& VERTEX_SELECTED_ID() - { + inline static const std::string &VERTEX_SELECTED_ID() { static const std::string MY_VERTEX_SELECTED_ID("vertex"); return MY_VERTEX_SELECTED_ID; } /// Attribute name of vertex option. - inline static const std::string& VERTEX_OPTION_ID() - { + inline static const std::string &VERTEX_OPTION_ID() { static const std::string MY_VERTEX_OPTION_ID("vertex_option"); return MY_VERTEX_OPTION_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation FeaturesPlugin_NormalToFace(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp index 4981f8356..cc379b87c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Partition.h" @@ -49,37 +50,33 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================= -FeaturesPlugin_Partition::FeaturesPlugin_Partition() -{ -} +FeaturesPlugin_Partition::FeaturesPlugin_Partition() {} //================================================================================================= -void FeaturesPlugin_Partition::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void FeaturesPlugin_Partition::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + boolean(USE_FUZZY_ID()) + ->setValue(false); // Do NOT use the fuzzy parameter by default. real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); - + initVersion(BOP_VERSION_9_4(), selectionList(BASE_OBJECTS_ID())); } //================================================================================================= -void FeaturesPlugin_Partition::execute() -{ +void FeaturesPlugin_Partition::execute() { GeomAPI_ShapeHierarchy anObjects; ListOfShape aPlanes; // Getting objects. processAttribute(BASE_OBJECTS_ID(), anObjects, aPlanes); - if(anObjects.empty()) { + if (anObjects.empty()) { static const std::string aFeatureError = "Error: No objects for partition."; setError(aFeatureError); return; @@ -87,7 +84,8 @@ void FeaturesPlugin_Partition::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); @@ -95,24 +93,28 @@ void FeaturesPlugin_Partition::execute() aBaseObjects.insert(aBaseObjects.end(), aPlanes.begin(), aPlanes.end()); // resize planes to the bounding box of operated shapes - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); resizePlanes(anObjects.objects(), aPlanes, aMakeShapeList); // cut unused solids of composolids from the objects of partition ListOfShape aTargetObjects, anUnusedSubs; std::string aError; - if (!cutSubs(anObjects, aTargetObjects, anUnusedSubs, aFuzzy, aMakeShapeList, aError)) { + if (!cutSubs(anObjects, aTargetObjects, anUnusedSubs, aFuzzy, aMakeShapeList, + aError)) { setError(aError); return; } - aBaseObjects.insert(aBaseObjects.end(), anUnusedSubs.begin(), anUnusedSubs.end()); + aBaseObjects.insert(aBaseObjects.end(), anUnusedSubs.begin(), + anUnusedSubs.end()); // perform partition first time to split target solids by planes std::shared_ptr aPartitionAlgo( new GeomAlgoAPI_Partition(aTargetObjects, aPlanes, aFuzzy)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), aError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), + aError)) { setError(aError); return; } @@ -124,12 +126,15 @@ void FeaturesPlugin_Partition::execute() // second pass of a partition to split shared faces of compsolids aTargetObjects.clear(); aTargetObjects.push_back(aResultShape); - aTargetObjects.insert(aTargetObjects.end(), anUnusedSubs.begin(), anUnusedSubs.end()); + aTargetObjects.insert(aTargetObjects.end(), anUnusedSubs.begin(), + anUnusedSubs.end()); - aPartitionAlgo.reset(new GeomAlgoAPI_Partition(aTargetObjects, ListOfShape())); + aPartitionAlgo.reset( + new GeomAlgoAPI_Partition(aTargetObjects, ListOfShape())); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), aError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, + getKind(), aError)) { setError(aError); return; } @@ -142,17 +147,18 @@ void FeaturesPlugin_Partition::execute() if (data()->version().empty()) { // default behaviors of Partition - if(aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) { - for(GeomAPI_ShapeIterator anIt(aResultShape); anIt.more(); anIt.next()) { - storeResult(aBaseObjects, aPlanes, anIt.current(), aMakeShapeList, aResultIndex); + if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) { + for (GeomAPI_ShapeIterator anIt(aResultShape); anIt.more(); anIt.next()) { + storeResult(aBaseObjects, aPlanes, anIt.current(), aMakeShapeList, + aResultIndex); ++aResultIndex; } } else { - storeResult(aBaseObjects, aPlanes, aResultShape, aMakeShapeList, aResultIndex); + storeResult(aBaseObjects, aPlanes, aResultShape, aMakeShapeList, + aResultIndex); ++aResultIndex; } - } - else { + } else { // merge hierarchies of compounds containing objects and tools GeomShapePtr aFirstShape = aResultShape; GeomAPI_ShapeIterator anIt; @@ -162,8 +168,8 @@ void FeaturesPlugin_Partition::execute() anIt.next(); } - GeomShapePtr aResultCompound = - keepUnusedSubsOfCompound(aFirstShape, anObjects, GeomAPI_ShapeHierarchy(), aMakeShapeList); + GeomShapePtr aResultCompound = keepUnusedSubsOfCompound( + aFirstShape, anObjects, GeomAPI_ShapeHierarchy(), aMakeShapeList); if (anIt.more()) { if (aResultCompound->shapeType() != GeomAPI_Shape::COMPOUND) { @@ -172,13 +178,15 @@ void FeaturesPlugin_Partition::execute() aShapes.push_back(aResultCompound); aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); } - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder); for (; anIt.more(); anIt.next()) aBuilder->add(aResultCompound, anIt.current()); aMakeShapeList->appendAlgo(aBuilder); } - storeResult(aBaseObjects, aPlanes, aResultCompound, aMakeShapeList, aResultIndex); + storeResult(aBaseObjects, aPlanes, aResultCompound, aMakeShapeList, + aResultIndex); ++aResultIndex; } @@ -188,17 +196,16 @@ void FeaturesPlugin_Partition::execute() //================================================================================================= void FeaturesPlugin_Partition::storeResult( - ListOfShape& theObjects, ListOfShape& thePlanes, - const GeomShapePtr theResultShape, - const std::shared_ptr theMakeShape, - const int theIndex) -{ + ListOfShape &theObjects, ListOfShape &thePlanes, + const GeomShapePtr theResultShape, + const std::shared_ptr theMakeShape, + const int theIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theIndex); // if result is same as one of the base object, no modification was performed - for(ListOfShape::const_iterator anObj = theObjects.cbegin(); anObj != theObjects.cend(); ++anObj) - { + for (ListOfShape::const_iterator anObj = theObjects.cbegin(); + anObj != theObjects.cend(); ++anObj) { if (anObj->get() && (*anObj)->isSame(theResultShape)) { aResultBody->store(theResultShape, false); setResult(aResultBody, theIndex); @@ -208,12 +215,11 @@ void FeaturesPlugin_Partition::storeResult( aResultBody->storeModified(theObjects, theResultShape, theMakeShape); - std::shared_ptr aMapOfSubShapes = theMakeShape->mapOfSubShapes(); + std::shared_ptr aMapOfSubShapes = + theMakeShape->mapOfSubShapes(); theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end()); for (ListOfShape::const_iterator anIt = theObjects.cbegin(); - anIt != theObjects.cend(); - ++anIt) - { + anIt != theObjects.cend(); ++anIt) { GeomShapePtr aShape = *anIt; aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::EDGE); aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE); @@ -223,20 +229,18 @@ void FeaturesPlugin_Partition::storeResult( setResult(aResultBody, theIndex); } - //================================================================================================= -static bool cutSubs(ListOfShape& theSubsToCut, - const ListOfShape& theTools, - const double theFuzzy, - std::shared_ptr& theMakeShapeList, - std::string& theError) -{ +static bool +cutSubs(ListOfShape &theSubsToCut, const ListOfShape &theTools, + const double theFuzzy, + std::shared_ptr &theMakeShapeList, + std::string &theError) { if (theSubsToCut.empty() || theTools.empty()) return true; // cut from current list of solids - std::shared_ptr aCutAlgo( - new GeomAlgoAPI_Boolean(theSubsToCut, theTools, GeomAlgoAPI_Tools::BOOL_CUT, theFuzzy)); + std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean( + theSubsToCut, theTools, GeomAlgoAPI_Tools::BOOL_CUT, theFuzzy)); if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, "", theError)) return false; theMakeShapeList->appendAlgo(aCutAlgo); @@ -244,20 +248,18 @@ static bool cutSubs(ListOfShape& theSubsToCut, // update list of un-selected objects of the partition GeomAPI_Shape::ShapeType aType = theSubsToCut.front()->shapeType(); theSubsToCut.clear(); - for (GeomAPI_ShapeExplorer anExp(aCutAlgo->shape(), aType); anExp.more(); anExp.next()) + for (GeomAPI_ShapeExplorer anExp(aCutAlgo->shape(), aType); anExp.more(); + anExp.next()) theSubsToCut.push_back(anExp.current()); return true; } //================================================================================================= bool FeaturesPlugin_Partition::cutSubs( - GeomAPI_ShapeHierarchy& theHierarchy, - ListOfShape& theUsed, - ListOfShape& theNotUsed, - const double theFuzzy, - std::shared_ptr& theMakeShapeList, - std::string& theError) -{ + GeomAPI_ShapeHierarchy &theHierarchy, ListOfShape &theUsed, + ListOfShape &theNotUsed, const double theFuzzy, + std::shared_ptr &theMakeShapeList, + std::string &theError) { theUsed.clear(); theNotUsed.clear(); @@ -267,11 +269,11 @@ bool FeaturesPlugin_Partition::cutSubs( // find the list of unused subs of the first argument or use itself ListOfShape aToolsForUsed, aToolsForUnused; GeomShapePtr aFirstArgument = theHierarchy.parent(*anIt, false); - if (aFirstArgument && aFirstArgument->shapeType() == GeomAPI_Shape::COMPSOLID) { + if (aFirstArgument && + aFirstArgument->shapeType() == GeomAPI_Shape::COMPSOLID) { theHierarchy.splitCompound(aFirstArgument, theUsed, aToolsForUsed); theNotUsed = aToolsForUsed; - } - else { + } else { aFirstArgument = *anIt; theUsed.push_back(aFirstArgument); } @@ -284,14 +286,16 @@ bool FeaturesPlugin_Partition::cutSubs( GeomShapePtr aParent = theHierarchy.parent(*anIt, false); if (aParent && aParent->shapeType() == GeomAPI_Shape::COMPSOLID) { - aParent = theHierarchy.parent(*anIt); // get parent once again to mark its subs as processed + aParent = theHierarchy.parent( + *anIt); // get parent once again to mark its subs as processed theHierarchy.splitCompound(aParent, aUsed, aNotUsed); - } - else + } else aUsed.push_back(*anIt); - isOk = ::cutSubs(aUsed, aToolsForUsed, theFuzzy, theMakeShapeList, theError) - && ::cutSubs(aNotUsed, aToolsForUnused, theFuzzy, theMakeShapeList, theError); + isOk = + ::cutSubs(aUsed, aToolsForUsed, theFuzzy, theMakeShapeList, theError) && + ::cutSubs(aNotUsed, aToolsForUnused, theFuzzy, theMakeShapeList, + theError); if (isOk) { theUsed.insert(theUsed.end(), aUsed.begin(), aUsed.end()); theNotUsed.insert(theNotUsed.end(), aNotUsed.begin(), aNotUsed.end()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.h b/src/FeaturesPlugin/FeaturesPlugin_Partition.h index d7807436e..cc8ef67b7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Partition_H_ @@ -27,42 +28,37 @@ /// \class FeaturesPlugin_Partition /// \ingroup Plugins -/// \brief Feature for applying of Partition operations on Shapes. Partition makes conjunctional -/// faces of solids as shared. The result of partitions is a compsolid. -class FeaturesPlugin_Partition : public FeaturesPlugin_VersionedBoolean -{ +/// \brief Feature for applying of Partition operations on Shapes. Partition +/// makes conjunctional faces of solids as shared. The result of partitions is a +/// compsolid. +class FeaturesPlugin_Partition : public FeaturesPlugin_VersionedBoolean { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Partition"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of use fuzzy parameter. - inline static const std::string& USE_FUZZY_ID() - { + inline static const std::string &USE_FUZZY_ID() { static const std::string MY_USE_FUZZY_ID("use_fuzzy"); return MY_USE_FUZZY_ID; } /// Attribute name of fuzzy parameter. - inline static const std::string& FUZZY_PARAM_ID() - { + inline static const std::string &FUZZY_PARAM_ID() { static const std::string MY_FUZZY_PARAM_ID("fuzzy_param"); return MY_FUZZY_PARAM_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Partition::ID(); return MY_KIND; } @@ -70,7 +66,8 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation @@ -78,21 +75,19 @@ public: private: /// Stores result of generation. - void storeResult(ListOfShape& theObjects, - ListOfShape& thePlanes, + void storeResult(ListOfShape &theObjects, ListOfShape &thePlanes, const GeomShapePtr theResultShape, const std::shared_ptr theMakeShape, const int theIndex = 0); - /// Cut all of unused subs of compsolids by the full compsolid of the first selected object, - /// and vice versa, cut all objects of Partition by not used subs of the first selected object. - /// Store results of operation to the separated lists of shapes. - bool cutSubs(GeomAPI_ShapeHierarchy& theHierarchy, - ListOfShape& theUsed, - ListOfShape& theNotUsed, - const double theFuzzy, - std::shared_ptr& theMakeShapeList, - std::string& theError); + /// Cut all of unused subs of compsolids by the full compsolid of the first + /// selected object, and vice versa, cut all objects of Partition by not used + /// subs of the first selected object. Store results of operation to the + /// separated lists of shapes. + bool cutSubs(GeomAPI_ShapeHierarchy &theHierarchy, ListOfShape &theUsed, + ListOfShape &theNotUsed, const double theFuzzy, + std::shared_ptr &theMakeShapeList, + std::string &theError); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp index be5eb1fc3..68bc727c4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Pipe.h" @@ -40,87 +41,92 @@ static void storeSubShape(ResultBodyPtr theResultBody, const GeomShapePtr theShape, const GeomAPI_Shape::ShapeType theType, - const std::string theName, - int& theShapeIndex); + const std::string theName, int &theShapeIndex); //================================================================================================== -FeaturesPlugin_Pipe::FeaturesPlugin_Pipe() -{ -} +FeaturesPlugin_Pipe::FeaturesPlugin_Pipe() {} //================================================================================================== -void FeaturesPlugin_Pipe::initAttributes() -{ +void FeaturesPlugin_Pipe::initAttributes() { data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(PATH_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(BINORMAL_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(LOCATIONS_ID(), ModelAPI_AttributeSelectionList::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), LOCATIONS_ID()); + data()->addAttribute(LOCATIONS_ID(), + ModelAPI_AttributeSelectionList::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + LOCATIONS_ID()); } //================================================================================================== -void FeaturesPlugin_Pipe::execute() -{ +void FeaturesPlugin_Pipe::execute() { // Getting creation method. std::string aCreationMethod = string(CREATION_METHOD())->value(); // Getting base objects. ListOfShape aBaseShapesList, aBaseFacesList; std::map aSketchWiresMap; - AttributeSelectionListPtr aBaseObjectsSelectionList = selectionList(BASE_OBJECTS_ID()); - if(!aBaseObjectsSelectionList.get()) { + AttributeSelectionListPtr aBaseObjectsSelectionList = + selectionList(BASE_OBJECTS_ID()); + if (!aBaseObjectsSelectionList.get()) { setError("Error: Could not get base objects selection list."); return; } - if(aBaseObjectsSelectionList->size() == 0) { + if (aBaseObjectsSelectionList->size() == 0) { setError("Error: Base objects list is empty."); return; } - for(int anIndex = 0; anIndex < aBaseObjectsSelectionList->size(); anIndex++) { - AttributeSelectionPtr aBaseObjectSelection = aBaseObjectsSelectionList->value(anIndex); - if(!aBaseObjectSelection.get()) { + for (int anIndex = 0; anIndex < aBaseObjectsSelectionList->size(); + anIndex++) { + AttributeSelectionPtr aBaseObjectSelection = + aBaseObjectsSelectionList->value(anIndex); + if (!aBaseObjectSelection.get()) { setError("Error: One of the selected base objects is empty."); return; } std::shared_ptr aBaseShape = aBaseObjectSelection->value(); - if(aBaseShape.get() && !aBaseShape->isNull()) { + if (aBaseShape.get() && !aBaseShape->isNull()) { GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType(); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aBaseObjectSelection->context()); - if(aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) && + std::dynamic_pointer_cast( + aBaseObjectSelection->context()); + if (aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) && aST == GeomAPI_Shape::WIRE) { // It is a wire on the sketch, store it to make face later. aSketchWiresMap[aConstruction].push_back(aBaseShape); continue; } else { - aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) : - aBaseShapesList.push_back(aBaseShape); + aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) + : aBaseShapesList.push_back(aBaseShape); } } else { // This may be the whole sketch result selected, check and get faces. ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aBaseObjectSelection->context()); - if(!aConstruction.get()) { + std::dynamic_pointer_cast( + aBaseObjectSelection->context()); + if (!aConstruction.get()) { setError("Error: One of selected sketches does not have results."); return; } int aFacesNum = aConstruction->facesNum(); - if(aFacesNum == 0) { + if (aFacesNum == 0) { // Probably it can be construction. aBaseShape = aConstruction->shape(); - if(aBaseShape.get() && !aBaseShape->isNull()) { - aBaseShape->shapeType() == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) : - aBaseShapesList.push_back(aBaseShape); + if (aBaseShape.get() && !aBaseShape->isNull()) { + aBaseShape->shapeType() == GeomAPI_Shape::FACE + ? aBaseFacesList.push_back(aBaseShape) + : aBaseShapesList.push_back(aBaseShape); } } else { - for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { + for (int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { std::shared_ptr aBaseFace = - std::dynamic_pointer_cast(aConstruction->face(aFaceIndex)); - if(!aBaseFace.get() || aBaseFace->isNull()) { + std::dynamic_pointer_cast( + aConstruction->face(aFaceIndex)); + if (!aBaseFace.get() || aBaseFace->isNull()) { setError("Error: One of the faces on selected sketch is Null."); return; } @@ -131,59 +137,62 @@ void FeaturesPlugin_Pipe::execute() } // Make faces from sketch wires. - for(std::map::const_iterator anIt = aSketchWiresMap.cbegin(); - anIt != aSketchWiresMap.cend(); ++anIt) { + for (std::map::const_iterator anIt = + aSketchWiresMap.cbegin(); + anIt != aSketchWiresMap.cend(); ++anIt) { const std::shared_ptr aSketchPlanarEdges = - std::dynamic_pointer_cast((*anIt).first->shape()); - const ListOfShape& aWiresList = (*anIt).second; + std::dynamic_pointer_cast((*anIt).first->shape()); + const ListOfShape &aWiresList = (*anIt).second; ListOfShape aFaces; GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aSketchPlanarEdges->origin(), aSketchPlanarEdges->norm(), - aWiresList, - aFaces); + aWiresList, aFaces); aBaseFacesList.insert(aBaseFacesList.end(), aFaces.begin(), aFaces.end()); } // Searching faces with common edges. - if(aCreationMethod == CREATION_METHOD_SIMPLE()) { + if (aCreationMethod == CREATION_METHOD_SIMPLE()) { std::shared_ptr aFacesCompound = - GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList); - GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL, aBaseShapesList); + GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList); + GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL, + aBaseShapesList); } else { - aBaseShapesList.insert(aBaseShapesList.end(), aBaseFacesList.begin(), aBaseFacesList.end()); + aBaseShapesList.insert(aBaseShapesList.end(), aBaseFacesList.begin(), + aBaseFacesList.end()); } // Getting path. AttributeSelectionPtr aPathSelection = selection(PATH_OBJECT_ID()); - if(!aPathSelection.get()) { + if (!aPathSelection.get()) { setError("Error: Path selection is empty."); return; } std::shared_ptr aPathShape = - std::dynamic_pointer_cast(aPathSelection->value()); - if(!aPathShape.get() && aPathSelection->context().get()) { + std::dynamic_pointer_cast(aPathSelection->value()); + if (!aPathShape.get() && aPathSelection->context().get()) { // Probably it is a construction. aPathShape = aPathSelection->context()->shape(); } - if(!aPathShape.get() || aPathShape->isNull()) { + if (!aPathShape.get() || aPathShape->isNull()) { setError("Error: Path shape is null."); return; } // Getting Bi-Normal std::shared_ptr aBiNormal; - if(aCreationMethod == CREATION_METHOD_BINORMAL()) { + if (aCreationMethod == CREATION_METHOD_BINORMAL()) { AttributeSelectionPtr aBiNormalSelection = selection(BINORMAL_ID()); - if(!aBiNormalSelection.get()) { + if (!aBiNormalSelection.get()) { setError("Error: Bi-Normal selection is empty."); return; } - aBiNormal = std::dynamic_pointer_cast(aBiNormalSelection->value()); - if(!aBiNormal.get() && aBiNormalSelection->context().get()) { + aBiNormal = + std::dynamic_pointer_cast(aBiNormalSelection->value()); + if (!aBiNormal.get() && aBiNormalSelection->context().get()) { // Probably it is a construction. aBiNormal = aBiNormalSelection->context()->shape(); } - if(!aBiNormal.get() || aBiNormal->isNull()) { + if (!aBiNormal.get() || aBiNormal->isNull()) { setError("Error: Bi-Normal shape is null."); return; } @@ -191,24 +200,28 @@ void FeaturesPlugin_Pipe::execute() // Getting locations. ListOfShape aLocations; - if(aCreationMethod == CREATION_METHOD_LOCATIONS()) { - AttributeSelectionListPtr aLocationsSelectionList = selectionList(LOCATIONS_ID()); - if(!aLocationsSelectionList.get()) { + if (aCreationMethod == CREATION_METHOD_LOCATIONS()) { + AttributeSelectionListPtr aLocationsSelectionList = + selectionList(LOCATIONS_ID()); + if (!aLocationsSelectionList.get()) { setError("Error: Could not get locations selection list."); return; } - for(int anIndex = 0; anIndex < aLocationsSelectionList->size(); anIndex++) { - AttributeSelectionPtr aLocationSelection = aLocationsSelectionList->value(anIndex); - if(!aLocationSelection.get()) { + for (int anIndex = 0; anIndex < aLocationsSelectionList->size(); + anIndex++) { + AttributeSelectionPtr aLocationSelection = + aLocationsSelectionList->value(anIndex); + if (!aLocationSelection.get()) { setError("Error: One of the selected location is empty."); return; } - std::shared_ptr aLocationShape = aLocationSelection->value(); - if(!aLocationShape.get() && aLocationSelection->context().get()) { + std::shared_ptr aLocationShape = + aLocationSelection->value(); + if (!aLocationShape.get() && aLocationSelection->context().get()) { // Probably it is a construction. aLocationShape = aLocationSelection->context()->shape(); } - if(!aLocationShape.get() || aLocationShape->isNull()) { + if (!aLocationShape.get() || aLocationShape->isNull()) { setError("Error: One of the selected location shape is null."); return; } @@ -219,20 +232,19 @@ void FeaturesPlugin_Pipe::execute() // Generating result for each object. int aResultIndex = 0; std::string anError; - if(aCreationMethod == CREATION_METHOD_SIMPLE() || + if (aCreationMethod == CREATION_METHOD_SIMPLE() || aCreationMethod == CREATION_METHOD_BINORMAL()) { - for(ListOfShape::const_iterator - anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) { + for (ListOfShape::const_iterator anIter = aBaseShapesList.cbegin(); + anIter != aBaseShapesList.cend(); anIter++) { std::shared_ptr aBaseShape = *anIter; std::shared_ptr aPipeAlgo( - aCreationMethod == CREATION_METHOD_SIMPLE() ? new GeomAlgoAPI_Pipe(aBaseShape, - aPathShape) - : new GeomAlgoAPI_Pipe(aBaseShape, - aPathShape, - aBiNormal)); + aCreationMethod == CREATION_METHOD_SIMPLE() + ? new GeomAlgoAPI_Pipe(aBaseShape, aPathShape) + : new GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), + anError)) { setError(anError); aResultIndex = 0; break; @@ -240,12 +252,12 @@ void FeaturesPlugin_Pipe::execute() storeResult(aBaseShape, aPathShape, aPipeAlgo, aResultIndex++); } - } else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) { - std::shared_ptr aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList, - aLocations, - aPathShape)); + } else if (aCreationMethod == CREATION_METHOD_LOCATIONS()) { + std::shared_ptr aPipeAlgo( + new GeomAlgoAPI_Pipe(aBaseShapesList, aLocations, aPathShape)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), + anError)) { setError(anError); removeResults(0); return; @@ -261,11 +273,11 @@ void FeaturesPlugin_Pipe::execute() } //================================================================================================== -void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBaseShape, - const std::shared_ptr thePathShape, - const std::shared_ptr thePipeAlgo, - const int theResultIndex) -{ +void FeaturesPlugin_Pipe::storeResult( + const std::shared_ptr theBaseShape, + const std::shared_ptr thePathShape, + const std::shared_ptr thePipeAlgo, + const int theResultIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); @@ -276,48 +288,51 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; - switch(aBaseShapeType) { - case GeomAPI_Shape::VERTEX: { - aShapeTypeToExplode = GeomAPI_Shape::VERTEX; - break; - } - case GeomAPI_Shape::EDGE: - case GeomAPI_Shape::WIRE: { - std::shared_ptr aV1, aV2; - GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2); - ListOfShape aV1History, aV2History; - thePipeAlgo->generated(aV1, aV1History); - thePipeAlgo->generated(aV2, aV2History); - if(!aV1History.empty()) { - aResultBody->generated(aV1, aV1History.front()); - } - if(!aV2History.empty()) { - aResultBody->generated(aV2, aV2History.front()); - } - } - case GeomAPI_Shape::FACE: - case GeomAPI_Shape::SHELL: { - aShapeTypeToExplode = GeomAPI_Shape::EDGE; - break; + switch (aBaseShapeType) { + case GeomAPI_Shape::VERTEX: { + aShapeTypeToExplode = GeomAPI_Shape::VERTEX; + break; + } + case GeomAPI_Shape::EDGE: + case GeomAPI_Shape::WIRE: { + std::shared_ptr aV1, aV2; + GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2); + ListOfShape aV1History, aV2History; + thePipeAlgo->generated(aV1, aV1History); + thePipeAlgo->generated(aV2, aV2History); + if (!aV1History.empty()) { + aResultBody->generated(aV1, aV1History.front()); } - case GeomAPI_Shape::COMPOUND: { - aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; - break; + if (!aV2History.empty()) { + aResultBody->generated(aV2, aV2History.front()); } - default: - return; // unsupported type of shape + } + case GeomAPI_Shape::FACE: + case GeomAPI_Shape::SHELL: { + aShapeTypeToExplode = GeomAPI_Shape::EDGE; + break; + } + case GeomAPI_Shape::COMPOUND: { + aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; + break; + } + default: + return; // unsupported type of shape } - if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || + if (aShapeTypeToExplode == GeomAPI_Shape::VERTEX || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX); + aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, + GeomAPI_Shape::VERTEX); } - if(aShapeTypeToExplode == GeomAPI_Shape::EDGE || + if (aShapeTypeToExplode == GeomAPI_Shape::EDGE || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE); + aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, + GeomAPI_Shape::EDGE); } if (thePathShape.get()) - aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, GeomAPI_Shape::EDGE); + aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, + GeomAPI_Shape::EDGE); // Store from shapes. storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->fromShapes(), "From_"); @@ -329,11 +344,11 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa } //================================================================================================== -void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, - const std::shared_ptr thePathShape, - const std::shared_ptr thePipeAlgo, - const int theResultIndex) -{ +void FeaturesPlugin_Pipe::storeResult( + const ListOfShape &theBaseShapes, + const std::shared_ptr thePathShape, + const std::shared_ptr thePipeAlgo, + const int theResultIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); @@ -341,115 +356,116 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo->shape()); // Store generated edges/faces. - for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); - anIter != theBaseShapes.cend(); - ++anIter) - { + for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); + anIter != theBaseShapes.cend(); ++anIter) { GeomShapePtr aBaseShape = *anIter; GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; - switch(aBaseShapeType) { - case GeomAPI_Shape::VERTEX: { - aShapeTypeToExplode = GeomAPI_Shape::VERTEX; - break; - } - case GeomAPI_Shape::EDGE: - case GeomAPI_Shape::WIRE: { - std::shared_ptr aV1, aV2; - GeomAlgoAPI_ShapeTools::findBounds(aBaseShape, aV1, aV2); - ListOfShape aV1History, aV2History; - thePipeAlgo->generated(aV1, aV1History); - thePipeAlgo->generated(aV2, aV2History); - if (!aV1History.empty()) - aResultBody->generated(aV1, aV1History.front()); - if (!aV2History.empty()) - aResultBody->generated(aV2, aV2History.front()); - } - case GeomAPI_Shape::FACE: - case GeomAPI_Shape::SHELL: { - aShapeTypeToExplode = GeomAPI_Shape::EDGE; - break; - } - default: - return; // unsupported type of shape + switch (aBaseShapeType) { + case GeomAPI_Shape::VERTEX: { + aShapeTypeToExplode = GeomAPI_Shape::VERTEX; + break; + } + case GeomAPI_Shape::EDGE: + case GeomAPI_Shape::WIRE: { + std::shared_ptr aV1, aV2; + GeomAlgoAPI_ShapeTools::findBounds(aBaseShape, aV1, aV2); + ListOfShape aV1History, aV2History; + thePipeAlgo->generated(aV1, aV1History); + thePipeAlgo->generated(aV2, aV2History); + if (!aV1History.empty()) + aResultBody->generated(aV1, aV1History.front()); + if (!aV2History.empty()) + aResultBody->generated(aV2, aV2History.front()); + } + case GeomAPI_Shape::FACE: + case GeomAPI_Shape::SHELL: { + aShapeTypeToExplode = GeomAPI_Shape::EDGE; + break; } - aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode); + default: + return; // unsupported type of shape + } + aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, + aShapeTypeToExplode); } if (thePathShape.get()) - aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, GeomAPI_Shape::EDGE); + aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, + GeomAPI_Shape::EDGE); // Store from shapes. - storeShapes(aResultBody, theBaseShapes.front()->shapeType(), thePipeAlgo->fromShapes(), "From_"); + storeShapes(aResultBody, theBaseShapes.front()->shapeType(), + thePipeAlgo->fromShapes(), "From_"); // Store to shapes. - storeShapes(aResultBody, theBaseShapes.back()->shapeType(), thePipeAlgo->toShapes(), "To_"); - + storeShapes(aResultBody, theBaseShapes.back()->shapeType(), + thePipeAlgo->toShapes(), "To_"); setResult(aResultBody, theResultIndex); } //================================================================================================== -void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody, - const GeomAPI_Shape::ShapeType theBaseShapeType, - const ListOfShape& theShapes, - const std::string theName) -{ +void FeaturesPlugin_Pipe::storeShapes( + ResultBodyPtr theResultBody, + const GeomAPI_Shape::ShapeType theBaseShapeType, + const ListOfShape &theShapes, const std::string theName) { GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE; std::string aShapeTypeStr = "Face"; - switch(theBaseShapeType) { - case GeomAPI_Shape::VERTEX: { - aShapeTypeToExplore = GeomAPI_Shape::VERTEX; - aShapeTypeStr = "Vertex"; - break; - } - case GeomAPI_Shape::EDGE: - case GeomAPI_Shape::WIRE: { - aShapeTypeToExplore = GeomAPI_Shape::EDGE; - aShapeTypeStr = "Edge"; - break; - } - case GeomAPI_Shape::FACE: - case GeomAPI_Shape::SHELL: { - aShapeTypeToExplore = GeomAPI_Shape::FACE; - aShapeTypeStr = "Face"; - break; - } - case GeomAPI_Shape::COMPOUND: { - aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; - break; - } - default: - return; // unsupported type of shape + switch (theBaseShapeType) { + case GeomAPI_Shape::VERTEX: { + aShapeTypeToExplore = GeomAPI_Shape::VERTEX; + aShapeTypeStr = "Vertex"; + break; + } + case GeomAPI_Shape::EDGE: + case GeomAPI_Shape::WIRE: { + aShapeTypeToExplore = GeomAPI_Shape::EDGE; + aShapeTypeStr = "Edge"; + break; + } + case GeomAPI_Shape::FACE: + case GeomAPI_Shape::SHELL: { + aShapeTypeToExplore = GeomAPI_Shape::FACE; + aShapeTypeStr = "Face"; + break; + } + case GeomAPI_Shape::COMPOUND: { + aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; + break; + } + default: + return; // unsupported type of shape } // Store shapes. int aShapeIndex = 1; int aFaceIndex = 1; - for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) { + for (ListOfShape::const_iterator anIt = theShapes.cbegin(); + anIt != theShapes.cend(); ++anIt) { GeomShapePtr aShape = *anIt; - if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { - std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face"); - storeSubShape(theResultBody, aShape, - aShape->shapeType(), - aName, - aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex); + if (aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { + std::string aName = + theName + + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face"); + storeSubShape(theResultBody, aShape, aShape->shapeType(), aName, + aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex + : aFaceIndex); } else { std::string aName = theName + aShapeTypeStr; - storeSubShape(theResultBody, aShape, aShapeTypeToExplore, aName, aShapeIndex); + storeSubShape(theResultBody, aShape, aShapeTypeToExplore, aName, + aShapeIndex); } } } //================================================================================================== -void storeSubShape(ResultBodyPtr theResultBody, - const GeomShapePtr theShape, +void storeSubShape(ResultBodyPtr theResultBody, const GeomShapePtr theShape, const GeomAPI_Shape::ShapeType theType, - const std::string theName, - int& theShapeIndex) -{ - for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) { + const std::string theName, int &theShapeIndex) { + for (GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); + anExp.next()) { GeomShapePtr aSubShape = anExp.current(); std::ostringstream aStr; aStr << theName << "_" << theShapeIndex++; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h index eaa50cea1..a3ee291a8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Pipe_H_ @@ -36,75 +37,64 @@ /// Edge -> Face\n /// Wire -> Shell\n /// Face -> Solid -class FeaturesPlugin_Pipe : public ModelAPI_Feature -{ +class FeaturesPlugin_Pipe : public ModelAPI_Feature { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_FEATURE_ID("Pipe"); return MY_FEATURE_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD("creation_method"); return MY_CREATION_METHOD; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_SIMPLE() - { + inline static const std::string &CREATION_METHOD_SIMPLE() { static const std::string MY_CREATION_METHOD("simple"); return MY_CREATION_METHOD; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BINORMAL() - { + inline static const std::string &CREATION_METHOD_BINORMAL() { static const std::string MY_CREATION_METHOD("binormal"); return MY_CREATION_METHOD; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_LOCATIONS() - { + inline static const std::string &CREATION_METHOD_LOCATIONS() { static const std::string MY_CREATION_METHOD("locations"); return MY_CREATION_METHOD; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of path object. - inline static const std::string& PATH_OBJECT_ID() - { + inline static const std::string &PATH_OBJECT_ID() { static const std::string MY_PATH_OBJECT_ID("path_object"); return MY_PATH_OBJECT_ID; } /// Attribute name of Bi-Normal. - inline static const std::string& BINORMAL_ID() - { + inline static const std::string &BINORMAL_ID() { static const std::string MY_BINORMAL_ID("binormal"); return MY_BINORMAL_ID; } /// Attribute name of locations. - inline static const std::string& LOCATIONS_ID() - { + inline static const std::string &LOCATIONS_ID() { static const std::string MY_LOCATIONS_ID("locations_objects"); return MY_LOCATIONS_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Pipe::ID(); return MY_KIND; } @@ -112,7 +102,8 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation @@ -124,15 +115,14 @@ private: const std::shared_ptr thePipeAlgo, const int theResultIndex = 0); - void storeResult(const ListOfShape& theBaseShapes, + void storeResult(const ListOfShape &theBaseShapes, const std::shared_ptr thePathShape, const std::shared_ptr thePipeAlgo, const int theResultIndex = 0); void storeShapes(ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theBaseShapeType, - const ListOfShape& theShapes, - const std::string theName); + const ListOfShape &theShapes, const std::string theName); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index faac26a9d..8fa1b744b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Placement.h" -#include -#include -#include -#include #include +#include #include #include +#include +#include +#include #include #include @@ -36,22 +37,20 @@ #include #include -#include #include +#include #include static const std::string PLACEMENT_VERSION_1("v9.5"); -FeaturesPlugin_Placement::FeaturesPlugin_Placement() -{ -} +FeaturesPlugin_Placement::FeaturesPlugin_Placement() {} -void FeaturesPlugin_Placement::initAttributes() -{ +void FeaturesPlugin_Placement::initAttributes() { AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute(OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(START_SHAPE_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(END_SHAPE_ID(), ModelAPI_AttributeSelection::typeId()); @@ -64,8 +63,7 @@ void FeaturesPlugin_Placement::initAttributes() } } -void FeaturesPlugin_Placement::execute() -{ +void FeaturesPlugin_Placement::execute() { bool isKeepSubShapes = data()->version() == PLACEMENT_VERSION_1; // Getting objects. @@ -73,30 +71,31 @@ void FeaturesPlugin_Placement::execute() std::list aParts; ResultPtr aTextureSource; AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECTS_LIST_ID()); - if (!FeaturesPlugin_Tools::shapesFromSelectionList - (anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + if (!FeaturesPlugin_Tools::shapesFromSelectionList( + anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; // Verify the start shape AttributeSelectionPtr anObjRef = selection(START_SHAPE_ID()); - if(!anObjRef) { + if (!anObjRef) { return; } std::shared_ptr aStartShape = anObjRef->value(); - if(!aStartShape) { - static const std::string aSelectionError = "Error: The start shape selection is bad."; + if (!aStartShape) { + static const std::string aSelectionError = + "Error: The start shape selection is bad."; setError(aSelectionError); return; } - std::shared_ptr aStartShapeContext; ResultPtr aContextRes = anObjRef->context(); if (aContextRes.get()) { aStartShapeContext = aContextRes->shape(); } - if(!aStartShapeContext.get()) { - static const std::string aContextError = "Error: The start shape selection context is bad."; + if (!aStartShapeContext.get()) { + static const std::string aContextError = + "Error: The start shape selection context is bad."; setError(aContextError); return; } @@ -104,19 +103,21 @@ void FeaturesPlugin_Placement::execute() // Verify the end shape anObjRef = selection(END_SHAPE_ID()); std::shared_ptr anEndShape = anObjRef->value(); - if(!anEndShape) { - static const std::string aSelectionError = "Error: The end shape selection is bad."; + if (!anEndShape) { + static const std::string aSelectionError = + "Error: The end shape selection is bad."; setError(aSelectionError); return; } std::shared_ptr anEndShapeContext; aContextRes = anObjRef->context(); - if(aContextRes.get()) { + if (aContextRes.get()) { anEndShapeContext = aContextRes->shape(); } - if(!anEndShapeContext.get()) { - static const std::string aContextError = "Error: The end shape selection context is bad."; + if (!anEndShapeContext.get()) { + static const std::string aContextError = + "Error: The end shape selection context is bad."; setError(aContextError); return; } @@ -134,10 +135,12 @@ void FeaturesPlugin_Placement::execute() bool isCentering = boolean(CENTERING_ID())->value(); // Getting transformation. - GeomAlgoAPI_Placement aPlacementAlgo( - aStartShapeContext, anEndShapeContext, aStartShape, anEndShape, isReverse, isCentering, true); - if(!aPlacementAlgo.isDone()) { - static const std::string aFeatureError = "Error: Placement algorithm failed."; + GeomAlgoAPI_Placement aPlacementAlgo(aStartShapeContext, anEndShapeContext, + aStartShape, anEndShape, isReverse, + isCentering, true); + if (!aPlacementAlgo.isDone()) { + static const std::string aFeatureError = + "Error: Placement algorithm failed."; setError(aFeatureError); return; } @@ -145,25 +148,30 @@ void FeaturesPlugin_Placement::execute() int aResultIndex = 0; std::string anError; - for (std::list::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) { + for (std::list::iterator aPRes = aParts.begin(); + aPRes != aParts.end(); ++aPRes) { // Applying transformation to each part. - ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aPRes); - ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); + ResultPartPtr anOrigin = + std::dynamic_pointer_cast(*aPRes); + ResultPartPtr aResultPart = + document()->copyPart(anOrigin, data(), aResultIndex); aResultPart->setTrsf(aContextRes, aTrsf); setResult(aResultPart, aResultIndex++); } // Collect transformations for each object. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); - for(GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end(); anObjectsIt++) { + for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); + anObjectsIt != anObjects.end(); anObjectsIt++) { std::shared_ptr aBaseShape = *anObjectsIt; std::shared_ptr aTransformAlgo( new GeomAlgoAPI_Transform(aBaseShape, aTrsf)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, + getKind(), anError)) { setError(anError); break; } @@ -173,14 +181,16 @@ void FeaturesPlugin_Placement::execute() } // Build results of the operation. - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { - //LoadNamingDS + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { + // LoadNamingDS ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Placed"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Placed"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); @@ -191,18 +201,16 @@ void FeaturesPlugin_Placement::execute() } //================================================================================================== -bool FeaturesPlugin_Placement::isShapeValid(GeomShapePtr theShape) -{ +bool FeaturesPlugin_Placement::isShapeValid(GeomShapePtr theShape) { if (theShape->isCompound()) { GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE; for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) { GeomShapePtr aCurrentShape = anIt.current(); if (aShapeType == GeomAPI_Shape::SHAPE) { aShapeType = aCurrentShape->shapeType(); - } - else if (aShapeType != aCurrentShape->shapeType()) { + } else if (aShapeType != aCurrentShape->shapeType()) { static const std::string aLinearityError = - "Error: Selected compound contains shapes with different types."; + "Error: Selected compound contains shapes with different types."; setError(aLinearityError); return false; } @@ -211,19 +219,19 @@ bool FeaturesPlugin_Placement::isShapeValid(GeomShapePtr theShape) return false; } } - } - else if (theShape->isFace()) { + } else if (theShape->isFace()) { std::shared_ptr aFace(new GeomAPI_Face(theShape)); if (!aFace->isPlanar()) { - static const std::string aPlanarityError = "Error: One of selected faces is not planar."; + static const std::string aPlanarityError = + "Error: One of selected faces is not planar."; setError(aPlanarityError); return false; } - } - else if (theShape->isEdge()) { + } else if (theShape->isEdge()) { std::shared_ptr anEdge(new GeomAPI_Edge(theShape)); if (!anEdge->isLine()) { - static const std::string aLinearityError = "Error: One of selected edges is not linear."; + static const std::string aLinearityError = + "Error: One of selected edges is not linear."; setError(aLinearityError); return false; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.h b/src/FeaturesPlugin/FeaturesPlugin_Placement.h index 0fc53d7a6..d2040e198 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.h @@ -14,74 +14,69 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Placement_H_ #define FeaturesPlugin_Placement_H_ #include "FeaturesPlugin.h" -#include #include #include +#include class ModelAPI_ResultBody; class GeomAPI_Shape; /**\class FeaturesPlugin_Placement * \ingroup Plugins - * \brief Feature for applying of placement operation: relative movement of Solid. + * \brief Feature for applying of placement operation: relative movement of + * Solid. * - * Locates the selected placement_attractable_object (face, edge, vertex) of the solid into - * the selected placement_base_object. Faces must be planar, edges must be linear. - * Orientation of the placed solid depends on the underlied planes of both faces. + * Locates the selected placement_attractable_object (face, edge, vertex) of the + * solid into the selected placement_base_object. Faces must be planar, edges + * must be linear. Orientation of the placed solid depends on the underlied + * planes of both faces. */ -class FeaturesPlugin_Placement : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_Placement : public ModelAPI_Feature { +public: /// Placement kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_PLACEMENT_ID("Placement"); return MY_PLACEMENT_ID; } - /// attribute name of references sketch entities list, it should contain a sketch result or - /// a pair a sketch result to sketch face - inline static const std::string& OBJECTS_LIST_ID() - { + /// attribute name of references sketch entities list, it should contain a + /// sketch result or a pair a sketch result to sketch face + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("placement_objects_list"); return MY_OBJECTS_LIST_ID; } /// attribute name of referenced object - inline static const std::string& START_SHAPE_ID() - { + inline static const std::string &START_SHAPE_ID() { static const std::string MY_START_SHAPE_ID("placement_start_shape"); return MY_START_SHAPE_ID; } /// attribute name of attractable face - inline static const std::string& END_SHAPE_ID() - { + inline static const std::string &END_SHAPE_ID() { static const std::string MY_END_SHAPE_ID("placement_end_shape"); return MY_END_SHAPE_ID; } /// attribute name of flag of reverse direction - inline static const std::string& REVERSE_ID() - { + inline static const std::string &REVERSE_ID() { static const std::string MY_REVERSE_ID("placement_reverse_direction"); return MY_REVERSE_ID; } /// attribute name of flag of centering position - inline static const std::string& CENTERING_ID() - { + inline static const std::string &CENTERING_ID() { static const std::string MY_CENTERING_ID("placement_centering"); return MY_CENTERING_ID; } /// Returns the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Placement::ID(); return MY_KIND; } @@ -89,11 +84,13 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation FeaturesPlugin_Placement(); + private: /// Checks validity of passed shape. bool isShapeValid(GeomShapePtr theShape); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index 1b4ef82ad..e7301e47d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -14,42 +14,47 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include +#include #include +#include #include -#include #include -#include #include #include +#include #include #include #include #include #include #include +#include #include #include #include +#include #include #include #include #include +#include #include -#include #include #include #include #include #include -#include #include #include +#include #include +#include #include #include #include @@ -61,10 +66,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -75,20 +76,21 @@ #include // the only created instance of this plugin -static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin(); +static FeaturesPlugin_Plugin *MY_FEATURES_INSTANCE = + new FeaturesPlugin_Plugin(); -FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() -{ +FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("FeaturesPlugin_ValidatorTransform", new FeaturesPlugin_ValidatorTransform); aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher", new FeaturesPlugin_ValidatorCompositeLauncher); aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration", new FeaturesPlugin_ValidatorBaseForGeneration); - aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects", - new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects", + new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects); aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations", new FeaturesPlugin_ValidatorPipeLocations); aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocationsNumber", @@ -97,16 +99,19 @@ FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() new FeaturesPlugin_ValidatorLoftSameTypeShape); aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir", new FeaturesPlugin_ValidatorExtrusionDir); - aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionBoundary", - new FeaturesPlugin_ValidatorExtrusionBoundaryFace); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorExtrusionBoundary", + new FeaturesPlugin_ValidatorExtrusionBoundaryFace); aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection", new FeaturesPlugin_ValidatorBooleanSelection); aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection", new FeaturesPlugin_ValidatorPartitionSelection); - aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection", - new FeaturesPlugin_ValidatorRemoveSubShapesSelection); - aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult", - new FeaturesPlugin_ValidatorRemoveSubShapesResult); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorRemoveSubShapesSelection", + new FeaturesPlugin_ValidatorRemoveSubShapesSelection); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorRemoveSubShapesResult", + new FeaturesPlugin_ValidatorRemoveSubShapesResult); aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath", new FeaturesPlugin_ValidatorPipePath); aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection", @@ -123,18 +128,21 @@ FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() new FeaturesPlugin_ValidatorCircular); aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments", new FeaturesPlugin_ValidatorBooleanArguments); - aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSmashSelection", - new FeaturesPlugin_ValidatorBooleanSmashSelection); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorBooleanSmashSelection", + new FeaturesPlugin_ValidatorBooleanSmashSelection); aFactory->registerValidator("FeaturesPlugin_IntersectionSelection", new FeaturesPlugin_IntersectionSelection); aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseSelection", new FeaturesPlugin_ValidatorBooleanFuseSelection); aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseArguments", new FeaturesPlugin_ValidatorBooleanFuseArguments); - aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonSelection", - new FeaturesPlugin_ValidatorBooleanCommonSelection); - aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonArguments", - new FeaturesPlugin_ValidatorBooleanCommonArguments); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorBooleanCommonSelection", + new FeaturesPlugin_ValidatorBooleanCommonSelection); + aFactory->registerValidator( + "FeaturesPlugin_ValidatorBooleanCommonArguments", + new FeaturesPlugin_ValidatorBooleanCommonArguments); aFactory->registerValidator("FeaturesPlugin_ValidatorImportResults", new FeaturesPlugin_ValidatorImportResults); aFactory->registerValidator("FeaturesPlugin_ValidatorDefeaturingSelection", @@ -148,12 +156,11 @@ FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == FeaturesPlugin_Extrusion::ID()) { return FeaturePtr(new FeaturesPlugin_Extrusion); } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) { - return FeaturePtr(new FeaturesPlugin_Revolution); + return FeaturePtr(new FeaturesPlugin_Revolution); } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) { return FeaturePtr(new FeaturesPlugin_Rotation); } else if (theFeatureID == FeaturesPlugin_Translation::ID()) { @@ -166,7 +173,8 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new FeaturesPlugin_BooleanCommon); } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) { return FeaturePtr(new FeaturesPlugin_BooleanSmash); - } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID() || theFeatureID == "Fill") { + } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID() || + theFeatureID == "Fill") { return FeaturePtr(new FeaturesPlugin_BooleanFill); } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) { return FeaturePtr(new FeaturesPlugin_Intersection); @@ -244,7 +252,6 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new FeaturesPlugin_GroupSharedFaces); } - // feature of such kind is not found return FeaturePtr(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.h b/src/FeaturesPlugin/FeaturesPlugin_Plugin.h index d683f2a72..76aed2eac 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.h @@ -14,27 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Plugin_H_ #define FeaturesPlugin_Plugin_H_ #include "FeaturesPlugin.h" -#include #include +#include /**\class FeaturesPlugin_Plugin * \ingroup Plugins * \brief The main class for management the 3D features as plugin. */ -class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin : public ModelAPI_Plugin -{ - public: +class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin : public ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); - public: +public: /// Default constructor FeaturesPlugin_Plugin(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp index 7ff470b9a..085d7ac0b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp @@ -14,45 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_PointCloudOnFace.h" +#include +#include +#include #include #include -#include #include +#include #include #include -#include -#include -#include #include #include //================================================================================================= -FeaturesPlugin_PointCloudOnFace::FeaturesPlugin_PointCloudOnFace() -{ -} +FeaturesPlugin_PointCloudOnFace::FeaturesPlugin_PointCloudOnFace() {} //================================================================================================= -void FeaturesPlugin_PointCloudOnFace::initAttributes() -{ +void FeaturesPlugin_PointCloudOnFace::initAttributes() { // attribute for object selected - data()->addAttribute(FACE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FACE_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(NUMBER_ID(), ModelAPI_AttributeInteger::typeId()); } //================================================================================================= -void FeaturesPlugin_PointCloudOnFace::attributeChanged(const std::string& /*theID*/) -{ -} +void FeaturesPlugin_PointCloudOnFace::attributeChanged( + const std::string & /*theID*/) {} //================================================================================================= -void FeaturesPlugin_PointCloudOnFace::execute() -{ +void FeaturesPlugin_PointCloudOnFace::execute() { AttributeSelectionPtr aSelectionFace = selection(FACE_SELECTED_ID()); @@ -70,11 +67,9 @@ void FeaturesPlugin_PointCloudOnFace::execute() if (aShape && aNbPnts >= 2) { std::string aError; std::shared_ptr aPoints(new GeomAPI_Shape); - if (!GeomAlgoAPI_PointCloudOnFace::PointCloud(aShape, - aNbPnts, - aPoints, + if (!GeomAlgoAPI_PointCloudOnFace::PointCloud(aShape, aNbPnts, aPoints, aError)) - setError("Error in points calculation :" + aError); + setError("Error in points calculation :" + aError); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h index 897430b39..59e6c3db9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_PointCloudOnFace_H_ @@ -29,32 +30,25 @@ /// \class FeaturesPlugin_PointCloudOnFace /// \ingroup Plugins /// \brief Persistence feature to construct normal to face -class FeaturesPlugin_PointCloudOnFace : public ModelAPI_Feature -{ +class FeaturesPlugin_PointCloudOnFace : public ModelAPI_Feature { public: /// Point Cloud on face kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Point_cloud"); return MY_ID; } /// Attribute name for face selected. - inline static const std::string& FACE_SELECTED_ID() - { + inline static const std::string &FACE_SELECTED_ID() { static const std::string MY_FACE_ID("face"); return MY_FACE_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Attribute name of number of points in the point cloud. - inline static const std::string& NUMBER_ID() - { + inline static const std::string &NUMBER_ID() { static const std::string MY_NUMBER_OF_POINTS_ID("number_of_points"); return MY_NUMBER_OF_POINTS_ID; } @@ -62,16 +56,16 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation FeaturesPlugin_PointCloudOnFace(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp index 5f2116628..b77ed10a1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp @@ -14,13 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_PointCoordinates.h" -#include #include +#include #include #include @@ -37,14 +38,12 @@ #include #include -FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() -{ -} +FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() {} -void FeaturesPlugin_PointCoordinates::initAttributes() -{ +void FeaturesPlugin_PointCoordinates::initAttributes() { // attribute for point selected - data()->addAttribute(POINT_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(POINT_SELECTED_ID(), + ModelAPI_AttributeSelection::typeId()); // attribute for x, y and z coordinates data()->addAttribute(X_COORD_ID(), ModelAPI_AttributeString::typeId()); @@ -52,16 +51,15 @@ void FeaturesPlugin_PointCoordinates::initAttributes() data()->addAttribute(Z_COORD_ID(), ModelAPI_AttributeString::typeId()); // attributes for result message and values - data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + data()->addAttribute(RESULT_VALUES_ID(), + ModelAPI_AttributeDoubleArray::typeId()); data()->realArray(RESULT_VALUES_ID())->setSize(3); } -void FeaturesPlugin_PointCoordinates::execute() -{ -} +void FeaturesPlugin_PointCoordinates::execute() {} -void FeaturesPlugin_PointCoordinates::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_PointCoordinates::attributeChanged( + const std::string &theID) { if (theID == POINT_SELECTED_ID()) { AttributeSelectionPtr aSelection = selection(POINT_SELECTED_ID()); GeomShapePtr aShape; @@ -73,7 +71,8 @@ void FeaturesPlugin_PointCoordinates::attributeChanged(const std::string& theID) } AttributeDoubleArrayPtr aValues = - std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::dynamic_pointer_cast( + attribute(RESULT_VALUES_ID())); std::stringstream streamx; std::stringstream streamy; std::stringstream streamz; @@ -87,9 +86,8 @@ void FeaturesPlugin_PointCoordinates::attributeChanged(const std::string& theID) aValues->setValue(2, aPoint->z()); } - string(X_COORD_ID() )->setValue( "X = " + streamx.str() ); - string(Y_COORD_ID() )->setValue( "Y = " + streamy.str() ); - string(Z_COORD_ID() )->setValue( "Z = " + streamz.str() ); + string(X_COORD_ID())->setValue("X = " + streamx.str()); + string(Y_COORD_ID())->setValue("Y = " + streamy.str()); + string(Z_COORD_ID())->setValue("Z = " + streamz.str()); } - } diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h index 6cd3454fd..6c74ae210 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_PointCoordinates_H_ @@ -30,72 +31,62 @@ /// \ingroup Plugins /// \brief Feature to view point coordinates. -class FeaturesPlugin_PointCoordinates : public ModelAPI_Feature -{ +class FeaturesPlugin_PointCoordinates : public ModelAPI_Feature { public: - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("PointCoordinates"); return MY_ID; } /// Attribute name for point selected. - inline static const std::string& POINT_SELECTED_ID() - { + inline static const std::string &POINT_SELECTED_ID() { static const std::string MY_POINT_SELECTED_ID("point_selected"); return MY_POINT_SELECTED_ID; } /// Attribute name for x coordinate. - inline static const std::string& X_COORD_ID() - { + inline static const std::string &X_COORD_ID() { static const std::string MY_X_COORD_ID("xcoordinate"); return MY_X_COORD_ID; } /// Attribute name for y coordinate. - inline static const std::string& Y_COORD_ID() - { + inline static const std::string &Y_COORD_ID() { static const std::string MY_Y_COORD_ID("ycoordinate"); return MY_Y_COORD_ID; } /// Attribute name for z coordinate. - inline static const std::string& Z_COORD_ID() - { + inline static const std::string &Z_COORD_ID() { static const std::string MY_Z_COORD_ID("zcoordinate"); return MY_Z_COORD_ID; } /// Attribute name for values of result. - inline static const std::string& RESULT_VALUES_ID() - { + inline static const std::string &RESULT_VALUES_ID() { static const std::string MY_RESULT_VALUES_ID("result_values"); return MY_RESULT_VALUES_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// Use plugin manager for features creation FeaturesPlugin_PointCoordinates(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp index 13cf8799e..c2a2eac4e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp @@ -14,34 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Recover.h" -#include -#include -#include -#include +#include +#include #include +#include +#include #include -#include -#include +#include +#include #include #include +#include #include -#include -#include +#include FeaturesPlugin_Recover::FeaturesPlugin_Recover() - : myClearListOnTypeChange(true) -{ -} + : myClearListOnTypeChange(true) {} -void FeaturesPlugin_Recover::initAttributes() -{ +void FeaturesPlugin_Recover::initAttributes() { data()->addAttribute(BASE_FEATURE(), ModelAPI_AttributeReference::typeId()); - data()->addAttribute(RECOVERED_ENTITIES(), ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(RECOVERED_ENTITIES(), + ModelAPI_AttributeRefList::typeId()); data()->addAttribute(METHOD(), ModelAPI_AttributeString::typeId()); if (!string(METHOD())->isInitialized()) { @@ -51,15 +50,15 @@ void FeaturesPlugin_Recover::initAttributes() data()->blockSendAttributeUpdated(false, false); myClearListOnTypeChange = true; } - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), METHOD()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + METHOD()); } -void FeaturesPlugin_Recover::execute() -{ +void FeaturesPlugin_Recover::execute() { std::string anError; int aResultIndex = 0; AttributeRefListPtr aRecovered = reflist(RECOVERED_ENTITIES()); - for(int anIndex = aRecovered->size() - 1; anIndex >= 0; anIndex--) { + for (int anIndex = aRecovered->size() - 1; anIndex >= 0; anIndex--) { ObjectPtr anObj = aRecovered->object(anIndex); if (!anObj.get()) continue; @@ -73,14 +72,15 @@ void FeaturesPlugin_Recover::execute() // Copy shape. std::shared_ptr aCopyAlgo(new GeomAlgoAPI_Copy(aShape)); // Check that algo is done. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), + anError)) { setError(anError); return; } // Store result. ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - aResultBody->store(aCopyAlgo->shape());//, aCopyAlgo.shape()); + aResultBody->store(aCopyAlgo->shape()); //, aCopyAlgo.shape()); aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX); aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::EDGE); @@ -93,8 +93,7 @@ void FeaturesPlugin_Recover::execute() removeResults(aResultIndex); } -void FeaturesPlugin_Recover::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_Recover::attributeChanged(const std::string &theID) { if (theID == METHOD() && myClearListOnTypeChange) reflist(RECOVERED_ENTITIES())->clear(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.h b/src/FeaturesPlugin/FeaturesPlugin_Recover.h index 31ce82b14..b1d728a5a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.h @@ -14,76 +14,71 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_RECOVER_H_ #define FEATURESPLUGIN_RECOVER_H_ #include "FeaturesPlugin.h" -#include #include +#include /**\class FeaturesPlugin_Recover * \ingroup Plugins * \brief Feature for display of concealed attributes of some feature. */ -class FeaturesPlugin_Recover : public ModelAPI_Feature -{ - /// List of already registered unconcealed pairs of unconcealed result and feature that caused - /// concealment. If attributes of this feature were changed, this list helps to synchronise - /// the current state with validators. - std::set > myRegistered; - /// The last stored Base to unregister Unconcealed when even attributes are already erased. +class FeaturesPlugin_Recover : public ModelAPI_Feature { + /// List of already registered unconcealed pairs of unconcealed result and + /// feature that caused concealment. If attributes of this feature were + /// changed, this list helps to synchronise the current state with validators. + std::set> myRegistered; + /// The last stored Base to unregister Unconcealed when even attributes are + /// already erased. FeaturePtr myCurrentBase; /// previous state of persistent flag bool myPersistent; /// necessity to clean recovered list while changing the type of recover bool myClearListOnTypeChange; - public: + +public: /// Extrusion kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_RECOVER_ID("Recover"); return MY_RECOVER_ID; } /// Attribute name of base feature. - inline static const std::string& BASE_FEATURE() - { + inline static const std::string &BASE_FEATURE() { static const std::string MY_BASE_FEATURE("base_feature"); return MY_BASE_FEATURE; } /// Attribute name of recovered results list. - inline static const std::string& RECOVERED_ENTITIES() - { + inline static const std::string &RECOVERED_ENTITIES() { static const std::string MY_RECOVERED_ENTITIES_ID("recovered"); return MY_RECOVERED_ENTITIES_ID; } /// Attribute name of the type of recover. - inline static const std::string& METHOD() - { + inline static const std::string &METHOD() { static const std::string MY_METHOD_ID("method"); return MY_METHOD_ID; } /// Value of default method, recovering concealed objects only. - inline static const std::string& METHOD_DEFAULT() - { + inline static const std::string &METHOD_DEFAULT() { static const std::string MY_METHOD_ID("default"); return MY_METHOD_ID; } /// Value of method, recovering parent compounds of concealed objects. - inline static const std::string& METHOD_COMPOUND() - { + inline static const std::string &METHOD_COMPOUND() { static const std::string MY_METHOD_ID("compound"); return MY_METHOD_ID; } /// Returns the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Recover::ID(); return MY_KIND; } @@ -91,16 +86,16 @@ class FeaturesPlugin_Recover : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation FeaturesPlugin_Recover(); - }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp index b9f9926ec..33559729c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_RemoveResults.h" @@ -22,12 +23,9 @@ #include //================================================================================================== -FeaturesPlugin_RemoveResults::FeaturesPlugin_RemoveResults() -{ -} +FeaturesPlugin_RemoveResults::FeaturesPlugin_RemoveResults() {} //================================================================================================== -void FeaturesPlugin_RemoveResults::initAttributes() -{ +void FeaturesPlugin_RemoveResults::initAttributes() { data()->addAttribute(RESULTS_ID(), ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h index 5ca5500d6..9abdda408 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_RemoveResults_H_ @@ -27,41 +28,38 @@ /// \class FeaturesPlugin_RemoveResults /// \ingroup Plugins /// \brief AN internal, hidden feature for results removal. -class FeaturesPlugin_RemoveResults : public ModelAPI_Feature -{ +class FeaturesPlugin_RemoveResults : public ModelAPI_Feature { public: /// Use plugin manager for features creation FeaturesPlugin_RemoveResults(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("RemoveResults"); return MY_ID; } /// Attribute name of removed shapes selector. - inline static const std::string& RESULTS_ID() - { + inline static const std::string &RESULTS_ID() { static const std::string MY_BASE_SHAPE_ID("results"); return MY_BASE_SHAPE_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_RemoveResults::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Does nothing, has no results. FEATURESPLUGIN_EXPORT virtual void execute() {} /// Hidden from the user. - FEATURESPLUGIN_EXPORT virtual bool isInHistory() {return false;} + FEATURESPLUGIN_EXPORT virtual bool isInHistory() { return false; } }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp index e1820d2af..247d71325 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_RemoveSubShapes.h" @@ -27,52 +28,51 @@ #include #include -#include #include +#include #include +#include #include #include -#include - //================================================================================================== FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() -: myChangedInCode(false) -{ -} + : myChangedInCode(false) {} //================================================================================================== -void FeaturesPlugin_RemoveSubShapes::initAttributes() -{ +void FeaturesPlugin_RemoveSubShapes::initAttributes() { data()->addAttribute(BASE_SHAPE_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(SUBSHAPES_TO_KEEP_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(SUBSHAPES_TO_KEEP_ID(), + ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(SUBSHAPES_TO_REMOVE_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(SUBSHAPES_TO_REMOVE_ID(), + ModelAPI_AttributeSelectionList::typeId()); } -void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_RemoveSubShapes::attributeChanged( + const std::string &theID) { ModelAPI_Feature::attributeChanged(theID); - if (myChangedInCode) return; + if (myChangedInCode) + return; AttributeSelectionPtr aShapeAttrSelection = selection(BASE_SHAPE_ID()); - AttributeSelectionListPtr aSubShapesToKeepAttrList = selectionList(SUBSHAPES_TO_KEEP_ID()); - AttributeSelectionListPtr aSubShapesToRemoveAttrList = selectionList(SUBSHAPES_TO_REMOVE_ID()); - if (!aShapeAttrSelection.get() - || !aSubShapesToKeepAttrList.get() - || !aSubShapesToRemoveAttrList.get()) - { + AttributeSelectionListPtr aSubShapesToKeepAttrList = + selectionList(SUBSHAPES_TO_KEEP_ID()); + AttributeSelectionListPtr aSubShapesToRemoveAttrList = + selectionList(SUBSHAPES_TO_REMOVE_ID()); + if (!aShapeAttrSelection.get() || !aSubShapesToKeepAttrList.get() || + !aSubShapesToRemoveAttrList.get()) { return; } ResultPtr aContext = aShapeAttrSelection->context(); ResultBodyPtr aResultBody = - std::dynamic_pointer_cast(aContext); + std::dynamic_pointer_cast(aContext); if (!aResultBody.get()) { aSubShapesToKeepAttrList->clear(); aSubShapesToRemoveAttrList->clear(); @@ -81,17 +81,17 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) const bool isHasSubs = ModelAPI_Tools::hasSubResults(aResultBody); GeomShapePtr aBaseShape = aShapeAttrSelection->value(); - if(!aBaseShape.get()) { + if (!aBaseShape.get()) { aBaseShape = aContext->shape(); } myChangedInCode = true; if (theID == BASE_SHAPE_ID() || theID == SUBSHAPES_TO_KEEP_ID() || - theID == SUBSHAPES_TO_REMOVE_ID()) { + theID == SUBSHAPES_TO_REMOVE_ID()) { std::list anAllSubs; ModelAPI_Tools::allSubs(aResultBody, anAllSubs); - if(theID == BASE_SHAPE_ID()) { + if (theID == BASE_SHAPE_ID()) { aSubShapesToKeepAttrList->clear(); aSubShapesToRemoveAttrList->clear(); @@ -99,27 +99,27 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) return; } - std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); + std::list aSubShapes = + GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); ListOfShape::const_iterator anIt = aSubShapes.cbegin(); - for (; anIt != aSubShapes.cend(); ++anIt) - { + for (; anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; - if(!isHasSubs) { + if (!isHasSubs) { aSubShapesToKeepAttrList->append(aContext, aSubShape); } else { std::list::iterator aSubsIt = anAllSubs.begin(); - for(; aSubsIt != anAllSubs.end(); aSubsIt++) { - ResultBodyPtr aSub = std::dynamic_pointer_cast(*aSubsIt); - if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) { + for (; aSubsIt != anAllSubs.end(); aSubsIt++) { + ResultBodyPtr aSub = + std::dynamic_pointer_cast(*aSubsIt); + if (aSub && aSub->shape().get() && + aSub->shape()->isSubShape(aSubShape)) { aSubShapesToKeepAttrList->append(aSub, aSubShape); break; } } } } - } - else if (theID == SUBSHAPES_TO_KEEP_ID()) - { + } else if (theID == SUBSHAPES_TO_KEEP_ID()) { aSubShapesToRemoveAttrList->clear(); if (!aBaseShape.get()) { @@ -130,38 +130,38 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) // optimization: collect selection attribute values into a map const int aSubsToKeepNb = aSubShapesToKeepAttrList->size(); GeomAPI_DataMapOfShapeShape aSubShapesToKeep; - for(anIndex = 0; anIndex < aSubsToKeepNb; ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aSubShapesToKeepAttrList->value(anIndex); + for (anIndex = 0; anIndex < aSubsToKeepNb; ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesToKeepAttrList->value(anIndex); GeomShapePtr aSubShapeToKeep = anAttrSelectionInList->value(); if (aSubShapeToKeep.get()) aSubShapesToKeep.bind(aSubShapeToKeep, aSubShapeToKeep); } - std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); + std::list aSubShapes = + GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); ListOfShape::const_iterator anIt = aSubShapes.cbegin(); - for (; anIt != aSubShapes.cend(); ++anIt) - { + for (; anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; if (aSubShapesToKeep.isBound(aSubShape)) continue; - if(!isHasSubs) { + if (!isHasSubs) { aSubShapesToRemoveAttrList->append(aContext, aSubShape); - } - else { + } else { std::list::iterator aSubsIt = anAllSubs.begin(); for (; aSubsIt != anAllSubs.end(); aSubsIt++) { - ResultBodyPtr aSub = std::dynamic_pointer_cast(*aSubsIt); - if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) { + ResultBodyPtr aSub = + std::dynamic_pointer_cast(*aSubsIt); + if (aSub && aSub->shape().get() && + aSub->shape()->isSubShape(aSubShape)) { aSubShapesToRemoveAttrList->append(aSub, aSubShape); break; } } } } - } - else if (theID == SUBSHAPES_TO_REMOVE_ID()) - { + } else if (theID == SUBSHAPES_TO_REMOVE_ID()) { aSubShapesToKeepAttrList->clear(); if (!aBaseShape.get()) { @@ -171,30 +171,31 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) int anIndex; const int aSubsToRemoveNb = aSubShapesToRemoveAttrList->size(); GeomAPI_DataMapOfShapeShape aSubShapesToRemove; - for(anIndex = 0; anIndex < aSubsToRemoveNb; ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aSubShapesToRemoveAttrList->value(anIndex); + for (anIndex = 0; anIndex < aSubsToRemoveNb; ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesToRemoveAttrList->value(anIndex); GeomShapePtr aSubShapeToRemove = anAttrSelectionInList->value(); if (aSubShapeToRemove.get()) aSubShapesToRemove.bind(aSubShapeToRemove, aSubShapeToRemove); } - - std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); + std::list aSubShapes = + GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); ListOfShape::const_iterator anIt = aSubShapes.cbegin(); - for (; anIt != aSubShapes.cend(); ++anIt) - { + for (; anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; if (aSubShapesToRemove.isBound(aSubShape)) continue; if (!isHasSubs) { aSubShapesToKeepAttrList->append(aContext, aSubShape); - } - else { + } else { std::list::iterator aSubsIt = anAllSubs.begin(); for (; aSubsIt != anAllSubs.end(); aSubsIt++) { - ResultBodyPtr aSub = std::dynamic_pointer_cast(*aSubsIt); - if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) { + ResultBodyPtr aSub = + std::dynamic_pointer_cast(*aSubsIt); + if (aSub && aSub->shape().get() && + aSub->shape()->isSubShape(aSubShape)) { aSubShapesToKeepAttrList->append(aSub, aSubShape); break; } @@ -208,12 +209,12 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) } //================================================================================================== -void FeaturesPlugin_RemoveSubShapes::execute() -{ +void FeaturesPlugin_RemoveSubShapes::execute() { // Get base shape and sub-shapes list. AttributeSelectionPtr aShapeAttrSelection = selection(BASE_SHAPE_ID()); - AttributeSelectionListPtr aSubShapesAttrList = selectionList(SUBSHAPES_TO_KEEP_ID()); - if(!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) { + AttributeSelectionListPtr aSubShapesAttrList = + selectionList(SUBSHAPES_TO_KEEP_ID()); + if (!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) { return; } @@ -222,39 +223,45 @@ void FeaturesPlugin_RemoveSubShapes::execute() GeomShapePtr aResultShape; int aSubsNb = aSubShapesAttrList->size(); - if(aSubsNb > 1) { - if(!aBaseShape.get()) { + if (aSubsNb > 1) { + if (!aBaseShape.get()) { return; } aResultShape = aBaseShape->emptyCopied(); // Copy sub-shapes from list to new shape. - for(int anIndex = 0; anIndex < aSubsNb; ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); + for (int anIndex = 0; anIndex < aSubsNb; ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesAttrList->value(anIndex); GeomShapePtr aShapeToAdd = anAttrSelectionInList->value(); GeomAlgoAPI_ShapeBuilder::add(aResultShape, aShapeToAdd); } - } else if(aSubsNb == 1) { + } else if (aSubsNb == 1) { AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(0); aResultShape = anAttrSelectionInList->value(); } // deleted and copied must be jointed to one list which keeps all the history - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); // find all removed shapes - std::shared_ptr aDeletedSubs(new GeomAlgoAPI_MakeShapeCustom); + std::shared_ptr aDeletedSubs( + new GeomAlgoAPI_MakeShapeCustom); std::set aTypes; // types that where removed aTypes.insert(GeomAPI_Shape::FACE); - std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt) { + std::list aSubShapes = + GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); + for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); + anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; if (!aSubShape.get() || aSubShape->isNull()) continue; int anIndex; - for(anIndex = 0; anIndex < aSubsNb; ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); + for (anIndex = 0; anIndex < aSubsNb; ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesAttrList->value(anIndex); GeomShapePtr aLeftShape = anAttrSelectionInList->value(); if (aSubShape->isEqual(aLeftShape)) { break; // found in a left-list @@ -265,7 +272,7 @@ void FeaturesPlugin_RemoveSubShapes::execute() aTypes.insert(aSubShape->shapeType()); if (aSubShape->shapeType() != GeomAPI_Shape::FACE) { GeomAPI_ShapeExplorer aFaces(aSubShape, GeomAPI_Shape::FACE); - for(; aFaces.more(); aFaces.next()) + for (; aFaces.more(); aFaces.next()) aDeletedSubs->addDeleted(aFaces.current()); } } @@ -294,20 +301,15 @@ void FeaturesPlugin_RemoveSubShapes::execute() anOldShapes.push_back(aBaseShape); aResultBody->storeModified(anOldShapes, aResultShape, aMakeShapeList); for (std::set::iterator aTypeIter = aTypes.begin(); - aTypeIter != aTypes.end(); - ++aTypeIter) - { + aTypeIter != aTypes.end(); ++aTypeIter) { aResultBody->loadDeletedShapes(aMakeShapeList, aBaseShape, *aTypeIter); } - aResultBody->loadModifiedShapes(aMakeShapeList, - aBaseShape, + aResultBody->loadModifiedShapes(aMakeShapeList, aBaseShape, GeomAPI_Shape::FACE); - aResultBody->loadModifiedShapes(aMakeShapeList, - aBaseShape, + aResultBody->loadModifiedShapes(aMakeShapeList, aBaseShape, GeomAPI_Shape::EDGE); - aResultBody->loadModifiedShapes(aMakeShapeList, - aBaseShape, + aResultBody->loadModifiedShapes(aMakeShapeList, aBaseShape, GeomAPI_Shape::VERTEX); setResult(aResultBody); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h index 0add0f92a..2d736a8c3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_RemoveSubShapes_H_ @@ -26,76 +27,68 @@ /// \class FeaturesPlugin_RemoveSubShapes /// \ingroup Plugins -/// \brief Feature for removing sub-shapes from collections(wire, shell, compsolid, compound). -class FeaturesPlugin_RemoveSubShapes: public ModelAPI_Feature -{ +/// \brief Feature for removing sub-shapes from collections(wire, shell, +/// compsolid, compound). +class FeaturesPlugin_RemoveSubShapes : public ModelAPI_Feature { public: /// Use plugin manager for features creation FeaturesPlugin_RemoveSubShapes(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Remove_SubShapes"); return MY_ID; } /// Attribute name of base shape. - inline static const std::string& BASE_SHAPE_ID() - { + inline static const std::string &BASE_SHAPE_ID() { static const std::string MY_BASE_SHAPE_ID("base_shape"); return MY_BASE_SHAPE_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("creation_method"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_KEEP_SUBSHAPES() - { + inline static const std::string &CREATION_METHOD_BY_KEEP_SUBSHAPES() { static const std::string MY_CREATION_METHOD_ID("by_keep_subshapes"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_REMOVE_SUBSHAPES() - { + inline static const std::string &CREATION_METHOD_BY_REMOVE_SUBSHAPES() { static const std::string MY_CREATION_METHOD_ID("by_remove_subshapes"); return MY_CREATION_METHOD_ID; } /// Attribute name of sub-shapes to keep. - inline static const std::string& SUBSHAPES_TO_KEEP_ID() - { + inline static const std::string &SUBSHAPES_TO_KEEP_ID() { static const std::string MY_SUBSHAPES_ID("subshapes_to_keep"); return MY_SUBSHAPES_ID; } /// Attribute name of sub-shapes to remove. - inline static const std::string& SUBSHAPES_TO_REMOVE_ID() - { + inline static const std::string &SUBSHAPES_TO_REMOVE_ID() { static const std::string MY_SUBSHAPES_ID("subshapes_to_remove"); return MY_SUBSHAPES_ID; } - /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_RemoveSubShapes::ID(); return MY_KIND; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object. /// \param[in] theID identifier of changed attribute. - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp index 414305719..e79e62e65 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Revolution.h" @@ -33,13 +34,10 @@ #include //================================================================================================= -FeaturesPlugin_Revolution::FeaturesPlugin_Revolution() -{ -} +FeaturesPlugin_Revolution::FeaturesPlugin_Revolution() {} //================================================================================================= -void FeaturesPlugin_Revolution::initAttributes() -{ +void FeaturesPlugin_Revolution::initAttributes() { initCompositeSketchAttribtues(InitBaseObjectsList); data()->addAttribute(AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -55,20 +53,21 @@ void FeaturesPlugin_Revolution::initAttributes() data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), FROM_OBJECT_ID()); initCompositeSketchAttribtues(InitSketchLauncher); } //================================================================================================= -void FeaturesPlugin_Revolution::execute() -{ +void FeaturesPlugin_Revolution::execute() { ListOfShape aBaseShapesList; ListOfMakeShape aMakeShapesList; // Make revolutions. - if(!makeRevolutions(aBaseShapesList, aMakeShapesList)) { + if (!makeRevolutions(aBaseShapesList, aMakeShapesList)) { return; } @@ -76,8 +75,9 @@ void FeaturesPlugin_Revolution::execute() int aResultIndex = 0; ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin(); ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin(); - for(; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); - ++aBaseIt, ++anAlgoIt) { + for (; + aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); + ++aBaseIt, ++anAlgoIt) { storeResult(*aBaseIt, *anAlgoIt, aResultIndex++); } @@ -85,16 +85,16 @@ void FeaturesPlugin_Revolution::execute() } //================================================================================================= -bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes) -{ +bool FeaturesPlugin_Revolution::makeRevolutions( + ListOfShape &theBaseShapes, ListOfMakeShape &theMakeShapes) { theMakeShapes.clear(); // Getting base shapes. getBaseShapes(theBaseShapes); // Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; AttributeSelectionPtr aSelection = selection(AXIS_OBJECT_ID()); GeomShapePtr aShape = aSelection->value(); if (!aShape.get()) { @@ -108,30 +108,25 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, } GeomEdgePtr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); - } - else - { + } else { setError(aSelectionError); return false; } std::shared_ptr anAxis; - if(anEdge.get()) { - if(anEdge->isLine()) { - anAxis = std::shared_ptr(new GeomAPI_Ax1(anEdge->line()->location(), - anEdge->line()->direction())); + if (anEdge.get()) { + if (anEdge->isLine()) { + anAxis = std::shared_ptr(new GeomAPI_Ax1( + anEdge->line()->location(), anEdge->line()->direction())); } } - if(!anAxis.get()) { + if (!anAxis.get()) { return false; } @@ -142,10 +137,12 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, if (string(CREATION_METHOD())->value() == CREATION_METHOD_BY_ANGLES()) { aToAngle = real(TO_ANGLE_ID())->value(); aFromAngle = real(FROM_ANGLE_ID())->value(); - } else if (string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { + } else if (string(CREATION_METHOD())->value() == + CREATION_METHOD_BY_PLANES()) { aToAngle = real(TO_OFFSET_ID())->value(); aFromAngle = real(FROM_OFFSET_ID())->value(); - } else if (string(CREATION_METHOD())->value() == CREATION_METHOD_THROUGH_ALL()) { + } else if (string(CREATION_METHOD())->value() == + CREATION_METHOD_THROUGH_ALL()) { aToAngle = 360.0; aFromAngle = 0.0; } else { @@ -155,11 +152,11 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, GeomShapePtr aToShape; GeomShapePtr aFromShape; - if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { + if (string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { aSelection = selection(TO_OBJECT_ID()); - if(aSelection.get()) { + if (aSelection.get()) { aToShape = std::dynamic_pointer_cast(aSelection->value()); - if(!aToShape.get() && aSelection->context().get()) { + if (!aToShape.get() && aSelection->context().get()) { aToShape = aSelection->context()->shape(); } if (aToShape.get() && aToShape->isCompound()) { @@ -168,9 +165,10 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, } } aSelection = selection(FROM_OBJECT_ID()); - if(aSelection.get()) { - aFromShape = std::dynamic_pointer_cast(aSelection->value()); - if(!aFromShape.get() && aSelection->context().get()) { + if (aSelection.get()) { + aFromShape = + std::dynamic_pointer_cast(aSelection->value()); + if (!aFromShape.get() && aSelection->context().get()) { aFromShape = aSelection->context()->shape(); } if (aFromShape.get() && aFromShape->isCompound()) { @@ -182,15 +180,15 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, // Generating result for each base shape. std::string anError; - for(ListOfShape::const_iterator - anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) { + for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); + anIter != theBaseShapes.cend(); anIter++) { GeomShapePtr aBaseShape = *anIter; - std::shared_ptr aRevolAlgo(new GeomAlgoAPI_Revolution( - aBaseShape, anAxis, - aToShape, aToAngle, - aFromShape, aFromAngle)); - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRevolAlgo, getKind(), anError)) { + std::shared_ptr aRevolAlgo( + new GeomAlgoAPI_Revolution(aBaseShape, anAxis, aToShape, aToAngle, + aFromShape, aFromAngle)); + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRevolAlgo, getKind(), + anError)) { setError(anError); return false; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h index a745adaf8..8dfa69099 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Revolution_H_ @@ -31,96 +32,82 @@ /// \brief Feature for creation of revolution from the planar face. /// Revolution creates the lateral faces based on edges of the base face and /// the start and end faces and/or start and end angles. -class FeaturesPlugin_Revolution: public FeaturesPlugin_CompositeSketch -{ +class FeaturesPlugin_Revolution : public FeaturesPlugin_CompositeSketch { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Revolution"); return MY_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_THROUGH_ALL() - { + inline static const std::string &CREATION_METHOD_THROUGH_ALL() { static const std::string MY_CREATION_METHOD_THROUGH_ALL("ThroughAll"); return MY_CREATION_METHOD_THROUGH_ALL; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_ANGLES() - { + inline static const std::string &CREATION_METHOD_BY_ANGLES() { static const std::string MY_CREATION_METHOD_BY_ANGLES("ByAngles"); return MY_CREATION_METHOD_BY_ANGLES; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_PLANES() - { + inline static const std::string &CREATION_METHOD_BY_PLANES() { static const std::string MY_CREATION_METHOD_BY_PLANES("ByPlanesAndOffsets"); return MY_CREATION_METHOD_BY_PLANES; } /// Attribute name of an revolution axis. - inline static const std::string& AXIS_OBJECT_ID() - { + inline static const std::string &AXIS_OBJECT_ID() { static const std::string MY_AXIS_OBJECT_ID("axis_object"); return MY_AXIS_OBJECT_ID; } /// Attribute name of revolution to angle. - inline static const std::string& TO_ANGLE_ID() - { + inline static const std::string &TO_ANGLE_ID() { static const std::string MY_TO_ANGLE_ID("to_angle"); return MY_TO_ANGLE_ID; } /// Attribute name of revolution from angle. - inline static const std::string& FROM_ANGLE_ID() - { + inline static const std::string &FROM_ANGLE_ID() { static const std::string MY_FROM_ANGLE_ID("from_angle"); return MY_FROM_ANGLE_ID; } /// Attribute name of an object to which the revolution grows. - inline static const std::string& TO_OBJECT_ID() - { + inline static const std::string &TO_OBJECT_ID() { static const std::string MY_TO_OBJECT_ID("to_object"); return MY_TO_OBJECT_ID; } /// Attribute name of revolution offset. - inline static const std::string& TO_OFFSET_ID() - { + inline static const std::string &TO_OFFSET_ID() { static const std::string MY_TO_OFFSET_ID("to_offset"); return MY_TO_OFFSET_ID; } /// Attribute name of an object from which the revolution grows. - inline static const std::string& FROM_OBJECT_ID() - { + inline static const std::string &FROM_OBJECT_ID() { static const std::string MY_FROM_OBJECT_ID("from_object"); return MY_FROM_OBJECT_ID; } /// Attribute name of revolution offset. - inline static const std::string& FROM_OFFSET_ID() - { + inline static const std::string &FROM_OFFSET_ID() { static const std::string MY_FROM_OFFSET_ID("from_offset"); return MY_FROM_OFFSET_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Revolution::ID(); return MY_KIND; } @@ -128,19 +115,20 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. FeaturesPlugin_Revolution(); - protected: +protected: /// Generates revolutions. /// \param[out] theBaseShapes list of base shapes. /// \param[out] theMakeShapes list of according algos. /// \return false in case one of algo failed. - bool makeRevolutions(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes); + bool makeRevolutions(ListOfShape &theBaseShapes, + ListOfMakeShape &theMakeShapes); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp index 34b979133..b7c1961c5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp @@ -14,30 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_RevolutionBoolean.h" //================================================================================================= -void FeaturesPlugin_RevolutionBoolean::initAttributes() -{ +void FeaturesPlugin_RevolutionBoolean::initAttributes() { FeaturesPlugin_Revolution::initAttributes(); initBooleanAttributes(); } //================================================================================================= -bool FeaturesPlugin_RevolutionBoolean::makeGeneration(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes) -{ +bool FeaturesPlugin_RevolutionBoolean::makeGeneration( + ListOfShape &theBaseShapes, ListOfMakeShape &theMakeShapes) { return makeRevolutions(theBaseShapes, theMakeShapes); } //================================================================================================= -void FeaturesPlugin_RevolutionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape) -{ - FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape); +void FeaturesPlugin_RevolutionBoolean::storeGenerationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape) { + FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, + theMakeShape); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h index a054f8888..cf9badf99 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h @@ -14,36 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_RevolutionBoolean_H_ #define FeaturesPlugin_RevolutionBoolean_H_ -#include "FeaturesPlugin_Revolution.h" #include "FeaturesPlugin_CompositeBoolean.h" +#include "FeaturesPlugin_Revolution.h" /// \class FeaturesPlugin_RevolutionBoolean /// \ingroup Plugins /// \brief Interface for the composite revolution feature. -class FeaturesPlugin_RevolutionBoolean : public FeaturesPlugin_Revolution, - public FeaturesPlugin_CompositeBoolean -{ +class FeaturesPlugin_RevolutionBoolean + : public FeaturesPlugin_Revolution, + public FeaturesPlugin_CompositeBoolean { public: - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); protected: FeaturesPlugin_RevolutionBoolean(){}; // Creates revolutions. - bool makeGeneration(ListOfShape& theBaseShapes, - ListOfMakeShape& theMakeShapes); + bool makeGeneration(ListOfShape &theBaseShapes, + ListOfMakeShape &theMakeShapes); /// Stores generation history. - void storeGenerationHistory(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape); + void storeGenerationHistory( + ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, + const std::shared_ptr theMakeShape); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp index 1741e93bb..7d2ea6d98 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp @@ -14,20 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_RevolutionCut.h" //================================================================================================= -FeaturesPlugin_RevolutionCut::FeaturesPlugin_RevolutionCut() -{ +FeaturesPlugin_RevolutionCut::FeaturesPlugin_RevolutionCut() { myFeature = this; myOperationType = BOOL_CUT; } //================================================================================================= -void FeaturesPlugin_RevolutionCut::execute() -{ - executeCompositeBoolean(); -} +void FeaturesPlugin_RevolutionCut::execute() { executeCompositeBoolean(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h index 20d5f9475..db77a0adb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_RevolutionCut_H_ @@ -24,24 +25,22 @@ /// \class FeaturesPlugin_RevolutionCut /// \ingroup Plugins -/// \brief This feature allows to create sketch, revol faces from this sketch and +/// \brief This feature allows to create sketch, revol faces from this sketch +/// and /// cut result from other objects in a single operation. -class FeaturesPlugin_RevolutionCut : public FeaturesPlugin_RevolutionBoolean -{ +class FeaturesPlugin_RevolutionCut : public FeaturesPlugin_RevolutionBoolean { public: /// Use plugin manager for features creation. FeaturesPlugin_RevolutionCut(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_REVOLUTION_ID("RevolutionCut"); return MY_REVOLUTION_ID; } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_RevolutionCut::ID(); return MY_KIND; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp index bee4549a0..7adfd38c5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp @@ -14,20 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_RevolutionFuse.h" //================================================================================================= -FeaturesPlugin_RevolutionFuse::FeaturesPlugin_RevolutionFuse() -{ +FeaturesPlugin_RevolutionFuse::FeaturesPlugin_RevolutionFuse() { myFeature = this; myOperationType = BOOL_FUSE; } //================================================================================================= -void FeaturesPlugin_RevolutionFuse::execute() -{ - executeCompositeBoolean(); -} +void FeaturesPlugin_RevolutionFuse::execute() { executeCompositeBoolean(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h index bba2780ea..2f6baf22e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_RevolutionFuse_H_ @@ -24,24 +25,22 @@ /// \class FeaturesPlugin_RevolutionFuse /// \ingroup Plugins -/// \brief This feature allows to create sketch, revol faces from this sketch and +/// \brief This feature allows to create sketch, revol faces from this sketch +/// and /// fuse result with other objects in a single operation. -class FeaturesPlugin_RevolutionFuse : public FeaturesPlugin_RevolutionBoolean -{ - public: +class FeaturesPlugin_RevolutionFuse : public FeaturesPlugin_RevolutionBoolean { +public: /// Use plugin manager for features creation. FeaturesPlugin_RevolutionFuse(); - /// Feature kind. - inline static const std::string& ID() - { + /// Feature kind. + inline static const std::string &ID() { static const std::string MY_REVOLUTION_ID("RevolutionFuse"); return MY_REVOLUTION_ID; } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_RevolutionFuse::ID(); return MY_KIND; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp index 0c5b49762..a5f030b35 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -34,8 +35,8 @@ #include #include #include -#include #include +#include #include #include @@ -43,23 +44,22 @@ static const std::string ROTATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() -{ -} +FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() {} //================================================================================================= -void FeaturesPlugin_Rotation::initAttributes() -{ +void FeaturesPlugin_Rotation::initAttributes() { data()->addAttribute(FeaturesPlugin_Rotation::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), + ModelAPI_AttributeDouble::typeId()); data()->addAttribute(FeaturesPlugin_Rotation::CENTER_POINT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -75,9 +75,9 @@ void FeaturesPlugin_Rotation::initAttributes() } //================================================================================================= -void FeaturesPlugin_Rotation::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(FeaturesPlugin_Rotation::CREATION_METHOD()); +void FeaturesPlugin_Rotation::execute() { + AttributeStringPtr aMethodTypeAttr = + string(FeaturesPlugin_Rotation::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); GeomTrsfPtr aTrsf; @@ -90,10 +90,10 @@ void FeaturesPlugin_Rotation::execute() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Rotation::rotationByAxisAndAngle() -{ - //Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; +GeomTrsfPtr FeaturesPlugin_Rotation::rotationByAxisAndAngle() { + // Getting axis. + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID()); GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { @@ -107,24 +107,20 @@ GeomTrsfPtr FeaturesPlugin_Rotation::rotationByAxisAndAngle() } GeomEdgePtr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - if (!anEdge.get()) - { + if (!anEdge.get()) { setError(aSelectionError); return GeomTrsfPtr(); } - std::shared_ptr anAxis (new GeomAPI_Ax1(anEdge->line()->location(), - anEdge->line()->direction())); + std::shared_ptr anAxis( + new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); double anAngle = real(FeaturesPlugin_Rotation::ANGLE_ID())->value(); GeomTrsfPtr aTrsf(new GeomAPI_Trsf()); @@ -133,20 +129,18 @@ GeomTrsfPtr FeaturesPlugin_Rotation::rotationByAxisAndAngle() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Rotation::rotationByThreePoints() -{ +GeomTrsfPtr FeaturesPlugin_Rotation::rotationByThreePoints() { // Getting the center point and two points (start and end) std::shared_ptr aCenterPoint; std::shared_ptr aStartPoint; std::shared_ptr anEndPoint; std::shared_ptr aCenterRef = - selection(FeaturesPlugin_Rotation::CENTER_POINT_ID()); + selection(FeaturesPlugin_Rotation::CENTER_POINT_ID()); std::shared_ptr aStartPointRef = - selection(FeaturesPlugin_Rotation::START_POINT_ID()); + selection(FeaturesPlugin_Rotation::START_POINT_ID()); std::shared_ptr anEndPointRef = - selection(FeaturesPlugin_Rotation::END_POINT_ID()); - if ((aCenterRef.get() != NULL) && - (aStartPointRef.get() != NULL) && + selection(FeaturesPlugin_Rotation::END_POINT_ID()); + if ((aCenterRef.get() != NULL) && (aStartPointRef.get() != NULL) && (anEndPointRef.get() != NULL)) { GeomShapePtr aCenterShape = aCenterRef->value(); if (!aCenterShape.get() && aCenterRef->context().get()) @@ -173,8 +167,7 @@ GeomTrsfPtr FeaturesPlugin_Rotation::rotationByThreePoints() } //================================================================================================= -void FeaturesPlugin_Rotation::performRotation(const GeomTrsfPtr& theTrsf) -{ +void FeaturesPlugin_Rotation::performRotation(const GeomTrsfPtr &theTrsf) { if (!theTrsf) { setError("Invalid transformation."); return; @@ -188,29 +181,34 @@ void FeaturesPlugin_Rotation::performRotation(const GeomTrsfPtr& theTrsf) ResultPtr aTextureSource; AttributeSelectionListPtr anObjSelList = selectionList(OBJECTS_LIST_ID()); if (!FeaturesPlugin_Tools::shapesFromSelectionList( - anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; std::string anError; int aResultIndex = 0; // Rotating each part. - for (std::list::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) { - ResultPartPtr anOriginal = std::dynamic_pointer_cast(*aPRes); - ResultPartPtr aResultPart = document()->copyPart(anOriginal, data(), aResultIndex); + for (std::list::iterator aPRes = aParts.begin(); + aPRes != aParts.end(); ++aPRes) { + ResultPartPtr anOriginal = + std::dynamic_pointer_cast(*aPRes); + ResultPartPtr aResultPart = + document()->copyPart(anOriginal, data(), aResultIndex); aResultPart->setTrsf(anOriginal, theTrsf); setResult(aResultPart, aResultIndex++); } // Collect transformations for each object in a part. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); - for(GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end(); ++anObjectsIt) { + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); + for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); + anObjectsIt != anObjects.end(); ++anObjectsIt) { std::shared_ptr aBaseShape = *anObjectsIt; std::shared_ptr aRotationAlgo( new GeomAlgoAPI_Transform(aBaseShape, theTrsf)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, + getKind(), anError)) { setError(anError); break; } @@ -220,13 +218,15 @@ void FeaturesPlugin_Rotation::performRotation(const GeomTrsfPtr& theTrsf) } // Build results of the rotation. - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Rotated"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Rotated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h index e0aa6180d..a21998b37 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Rotation_H_ @@ -29,82 +30,70 @@ class GeomAPI_Trsf; /// \class FeaturesPlugin_Rotation /// \ingroup Plugins /// \brief Feature for rotation objects around the axis. -class FeaturesPlugin_Rotation : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_Rotation : public ModelAPI_Feature { +public: /// Rotation kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ROTATION_ID("Rotation"); return MY_ROTATION_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByAxisAndAngle". - inline static const std::string& CREATION_METHOD_BY_ANGLE() - { + inline static const std::string &CREATION_METHOD_BY_ANGLE() { static const std::string MY_CREATION_METHOD_ID("ByAxisAndAngle"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByThreePoints". - inline static const std::string& CREATION_METHOD_BY_THREE_POINTS() - { + inline static const std::string &CREATION_METHOD_BY_THREE_POINTS() { static const std::string MY_CREATION_METHOD_ID("ByThreePoints"); return MY_CREATION_METHOD_ID; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name of an axis. - inline static const std::string& AXIS_OBJECT_ID() - { + inline static const std::string &AXIS_OBJECT_ID() { static const std::string MY_AXIS_OBJECT_ID("axis_object"); return MY_AXIS_OBJECT_ID; } /// Attribute name of angle. - inline static const std::string& ANGLE_ID() - { + inline static const std::string &ANGLE_ID() { static const std::string MY_ANGLE_ID("angle"); return MY_ANGLE_ID; } /// Attribute name of a center point. - inline static const std::string& CENTER_POINT_ID() - { + inline static const std::string &CENTER_POINT_ID() { static const std::string MY_CENTER_POINT_ID("center_point"); return MY_CENTER_POINT_ID; } /// Attribute name of a center point. - inline static const std::string& START_POINT_ID() - { + inline static const std::string &START_POINT_ID() { static const std::string MY_START_POINT_ID("start_point"); return MY_START_POINT_ID; } /// Attribute name of a center point. - inline static const std::string& END_POINT_ID() - { + inline static const std::string &END_POINT_ID() { static const std::string MY_END_POINT_ID("end_point"); return MY_END_POINT_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Rotation::ID(); return MY_KIND; } @@ -112,7 +101,8 @@ class FeaturesPlugin_Rotation : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -126,7 +116,7 @@ private: std::shared_ptr rotationByThreePoints(); /// Perform the transformation - void performRotation(const std::shared_ptr& theTrsf); + void performRotation(const std::shared_ptr &theTrsf); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp index e967da7c2..f62a42a9e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -36,21 +37,18 @@ static const std::string SCALE_VERSION_1("v9.5"); - //================================================================================================= -FeaturesPlugin_Scale::FeaturesPlugin_Scale() -{ -} +FeaturesPlugin_Scale::FeaturesPlugin_Scale() {} //================================================================================================= -void FeaturesPlugin_Scale::initAttributes() -{ +void FeaturesPlugin_Scale::initAttributes() { data()->addAttribute(FeaturesPlugin_Scale::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_Scale::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_Scale::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(FeaturesPlugin_Scale::CENTER_POINT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -72,22 +70,21 @@ void FeaturesPlugin_Scale::initAttributes() } //================================================================================================= -void FeaturesPlugin_Scale::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(FeaturesPlugin_Scale::CREATION_METHOD()); +void FeaturesPlugin_Scale::execute() { + AttributeStringPtr aMethodTypeAttr = + string(FeaturesPlugin_Scale::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); if (aMethodType == FeaturesPlugin_Scale::CREATION_METHOD_BY_FACTOR()) { performScaleByFactor(); - } - else if (aMethodType == FeaturesPlugin_Scale::CREATION_METHOD_BY_DIMENSIONS()) { + } else if (aMethodType == + FeaturesPlugin_Scale::CREATION_METHOD_BY_DIMENSIONS()) { performScaleByDimensions(); } } //================================================================================================= -void FeaturesPlugin_Scale::performScaleByFactor() -{ +void FeaturesPlugin_Scale::performScaleByFactor() { bool isKeepSubShapes = data()->version() == SCALE_VERSION_1; // Getting objects. @@ -96,13 +93,13 @@ void FeaturesPlugin_Scale::performScaleByFactor() ResultPtr aTextureSource; AttributeSelectionListPtr anObjSelList = selectionList(OBJECTS_LIST_ID()); if (!FeaturesPlugin_Tools::shapesFromSelectionList( - anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; // Getting the center point std::shared_ptr aCenterPoint; std::shared_ptr anObjRef = - selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); + selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); if (anObjRef.get() != NULL) { GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { @@ -118,7 +115,8 @@ void FeaturesPlugin_Scale::performScaleByFactor() // Collect transformation for each object std::string anError; - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); ++anObjectsIt) { std::shared_ptr aBaseShape = *anObjectsIt; @@ -126,7 +124,8 @@ void FeaturesPlugin_Scale::performScaleByFactor() new GeomAlgoAPI_Scale(aBaseShape, aCenterPoint, aScaleFactor)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), + anError)) { setError(anError); break; } @@ -137,13 +136,15 @@ void FeaturesPlugin_Scale::performScaleByFactor() // Build results of the scaling int aResultIndex = 0; - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Scaled"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Scaled"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); @@ -154,8 +155,7 @@ void FeaturesPlugin_Scale::performScaleByFactor() } //================================================================================================= -void FeaturesPlugin_Scale::performScaleByDimensions() -{ +void FeaturesPlugin_Scale::performScaleByDimensions() { bool isKeepSubShapes = data()->version() == SCALE_VERSION_1; // Getting objects. @@ -164,13 +164,13 @@ void FeaturesPlugin_Scale::performScaleByDimensions() ResultPtr aTextureSource; AttributeSelectionListPtr anObjSelList = selectionList(OBJECTS_LIST_ID()); if (!FeaturesPlugin_Tools::shapesFromSelectionList( - anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; // Getting the center point std::shared_ptr aCenterPoint; std::shared_ptr anObjRef = - selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); + selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); if (anObjRef.get() != NULL) { GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { @@ -182,24 +182,26 @@ void FeaturesPlugin_Scale::performScaleByDimensions() } // Getting dimensions - double aScaleFactorX = real(FeaturesPlugin_Scale::SCALE_FACTOR_X_ID())->value(); - double aScaleFactorY = real(FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID())->value(); - double aScaleFactorZ = real(FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID())->value(); + double aScaleFactorX = + real(FeaturesPlugin_Scale::SCALE_FACTOR_X_ID())->value(); + double aScaleFactorY = + real(FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID())->value(); + double aScaleFactorZ = + real(FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID())->value(); // Collect transformation for each object std::string anError; - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); ++anObjectsIt) { std::shared_ptr aBaseShape = *anObjectsIt; - std::shared_ptr aScaleAlgo(new GeomAlgoAPI_Scale(aBaseShape, - aCenterPoint, - aScaleFactorX, - aScaleFactorY, - aScaleFactorZ)); + std::shared_ptr aScaleAlgo(new GeomAlgoAPI_Scale( + aBaseShape, aCenterPoint, aScaleFactorX, aScaleFactorY, aScaleFactorZ)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), + anError)) { setError(anError); break; } @@ -210,13 +212,15 @@ void FeaturesPlugin_Scale::performScaleByDimensions() // Build results of the scaling int aResultIndex = 0; - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Scaled"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Scaled"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.h b/src/FeaturesPlugin/FeaturesPlugin_Scale.h index a686da29b..f51363387 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_SCALE_H_ @@ -28,82 +29,70 @@ * \ingroup Plugins * \brief Feature for changing the scale of an object. */ -class FeaturesPlugin_Scale : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_Scale : public ModelAPI_Feature { +public: /// Scale kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SCALE_ID("Scale"); return MY_SCALE_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByFactor". - inline static const std::string& CREATION_METHOD_BY_FACTOR() - { + inline static const std::string &CREATION_METHOD_BY_FACTOR() { static const std::string MY_CREATION_METHOD_ID("ByFactor"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByFactor". - inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() - { + inline static const std::string &CREATION_METHOD_BY_DIMENSIONS() { static const std::string MY_CREATION_METHOD_ID("ByDimensions"); return MY_CREATION_METHOD_ID; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name of center point. - inline static const std::string& CENTER_POINT_ID() - { + inline static const std::string &CENTER_POINT_ID() { static const std::string MY_CENTER_POINT_ID("center_point"); return MY_CENTER_POINT_ID; } /// Attribute name of scale factor. - inline static const std::string& SCALE_FACTOR_ID() - { + inline static const std::string &SCALE_FACTOR_ID() { static const std::string MY_SCALE_FACTOR_ID("scale_factor"); return MY_SCALE_FACTOR_ID; } /// Attribute name of scale factor in X. - inline static const std::string& SCALE_FACTOR_X_ID() - { + inline static const std::string &SCALE_FACTOR_X_ID() { static const std::string MY_SCALE_FACTOR_X_ID("scale_factor_x"); return MY_SCALE_FACTOR_X_ID; } /// Attribute name of scale factor in Y. - inline static const std::string& SCALE_FACTOR_Y_ID() - { + inline static const std::string &SCALE_FACTOR_Y_ID() { static const std::string MY_SCALE_FACTOR_Y_ID("scale_factor_y"); return MY_SCALE_FACTOR_Y_ID; } /// Attribute name of scale factor in Z. - inline static const std::string& SCALE_FACTOR_Z_ID() - { + inline static const std::string &SCALE_FACTOR_Z_ID() { static const std::string MY_SCALE_FACTOR_Z_ID("scale_factor_z"); return MY_SCALE_FACTOR_Z_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Scale::ID(); return MY_KIND; } @@ -111,7 +100,8 @@ class FeaturesPlugin_Scale : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -125,4 +115,4 @@ private: void performScaleByDimensions(); }; -#endif // FEATURESPLUGIN_SCALE_H_ \ No newline at end of file +#endif // FEATURESPLUGIN_SCALE_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp b/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp index fb830f62a..d22910403 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -29,48 +30,47 @@ #include #include - - //================================================================================================= -FeaturesPlugin_Sewing::FeaturesPlugin_Sewing() -{ -} +FeaturesPlugin_Sewing::FeaturesPlugin_Sewing() {} //================================================================================================= -void FeaturesPlugin_Sewing::initAttributes() -{ - data()->addAttribute(OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(ALLOW_NON_MANIFOLD_ID(), ModelAPI_AttributeBoolean::typeId()); +void FeaturesPlugin_Sewing::initAttributes() { + data()->addAttribute(OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(ALLOW_NON_MANIFOLD_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(TOLERANCE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(ALWAYS_CREATE_RESULT_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(ALWAYS_CREATE_RESULT_ID(), + ModelAPI_AttributeBoolean::typeId()); } //================================================================================================= -void FeaturesPlugin_Sewing::execute() -{ +void FeaturesPlugin_Sewing::execute() { // Collect all base shapes ListOfShape aShapes; getOriginalShapes(OBJECTS_LIST_ID(), aShapes); // Get all other feature arguments - bool isAllowNonManifold = boolean(FeaturesPlugin_Sewing::ALLOW_NON_MANIFOLD_ID())->value(); - bool isAlwaysCreateResult = boolean(FeaturesPlugin_Sewing::ALWAYS_CREATE_RESULT_ID())->value(); + bool isAllowNonManifold = + boolean(FeaturesPlugin_Sewing::ALLOW_NON_MANIFOLD_ID())->value(); + bool isAlwaysCreateResult = + boolean(FeaturesPlugin_Sewing::ALWAYS_CREATE_RESULT_ID())->value(); double aTolerance = real(FeaturesPlugin_Sewing::TOLERANCE_ID())->value(); - std::shared_ptr aSewingAlgo(new GeomAlgoAPI_Sewing(aShapes, isAllowNonManifold, aTolerance)); + std::shared_ptr aSewingAlgo( + new GeomAlgoAPI_Sewing(aShapes, isAllowNonManifold, aTolerance)); std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSewingAlgo, getKind(), anError)) - { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSewingAlgo, getKind(), + anError)) { setError(anError); return; } - + // Store result. GeomShapePtr aResult = aSewingAlgo->shape(); - if (!isSewn(aShapes, aResult) && !isAlwaysCreateResult) - { + if (!isSewn(aShapes, aResult) && !isAlwaysCreateResult) { static const std::string anError = "Error: No faces were sewn."; setError(anError); return; @@ -84,18 +84,15 @@ void FeaturesPlugin_Sewing::execute() } //================================================================================================= -void FeaturesPlugin_Sewing::getOriginalShapes(const std::string& theAttributeName, - ListOfShape& theShapes) -{ +void FeaturesPlugin_Sewing::getOriginalShapes( + const std::string &theAttributeName, ListOfShape &theShapes) { // Collect all selections into a single list of shapes AttributeSelectionListPtr aSelectionList = selectionList(theAttributeName); - for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) - { + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); GeomShapePtr aContext = aSelection->context()->shape(); - if (!aShape.get()) - { + if (!aShape.get()) { aShape = aContext; } theShapes.push_back(aShape); @@ -103,46 +100,39 @@ void FeaturesPlugin_Sewing::getOriginalShapes(const std::string& theAttributeNam } //================================================================================================= -bool FeaturesPlugin_Sewing::isSewn(const ListOfShape& theInputs, - const GeomShapePtr theResult) -{ +bool FeaturesPlugin_Sewing::isSewn(const ListOfShape &theInputs, + const GeomShapePtr theResult) { // Consider the list of input shapes the same as the result, if // * both arguments have the same number of shells // * the total number of faces in these shells did NOT change. int nbInputShells = 0, nbInputFaces = 0; for (ListOfShape::const_iterator anIt = theInputs.cbegin(); - anIt != theInputs.cend(); - ++anIt) - { + anIt != theInputs.cend(); ++anIt) { GeomShapePtr aShape = *anIt; - if (aShape.get()) - { - if (aShape->isShell()) nbInputShells++; + if (aShape.get()) { + if (aShape->isShell()) + nbInputShells++; nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size(); } } int nbResultShells = 0, nbResultFaces = 0; - if (theResult->isCompound()) - { + if (theResult->isCompound()) { ListOfShape shells = theResult->subShapes(GeomAPI_Shape::SHELL, true); nbResultShells = shells.size(); for (ListOfShape::const_iterator anIt = shells.cbegin(); - anIt != shells.cend(); - ++anIt) - { + anIt != shells.cend(); ++anIt) { GeomShapePtr aShape = *anIt; - if (aShape.get() && aShape->isShell()) - { + if (aShape.get() && aShape->isShell()) { nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size(); } } - } - else if (theResult->isShell()) - { + } else if (theResult->isShell()) { nbResultShells = 1; nbResultFaces = theResult->subShapes(GeomAPI_Shape::FACE, true).size(); } - return ((nbInputShells == 0 && nbResultShells > 0) || (nbResultShells < nbInputShells) || (nbResultShells == nbInputShells && nbResultFaces > nbInputFaces)); + return ((nbInputShells == 0 && nbResultShells > 0) || + (nbResultShells < nbInputShells) || + (nbResultShells == nbInputShells && nbResultFaces > nbInputFaces)); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Sewing.h b/src/FeaturesPlugin/FeaturesPlugin_Sewing.h index 15b026d89..9a7647405 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Sewing.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Sewing.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_SEWING_H_ @@ -22,60 +23,53 @@ #include -#include #include - +#include /** \class FeaturesPlugin_Sewing * \ingroup Plugins * \brief Feature to perform sewing operation on objects. */ -class FeaturesPlugin_Sewing : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_Sewing : public ModelAPI_Feature { +public: /// Sewing kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SEWING_ID("Sewing"); return MY_SEWING_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Sewing::ID(); return MY_KIND; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name for non-manifold state. - inline static const std::string& ALLOW_NON_MANIFOLD_ID() - { + inline static const std::string &ALLOW_NON_MANIFOLD_ID() { static const std::string MY_ALLOW_NON_MANIFOLD_ID("allow_non_manifold"); return MY_ALLOW_NON_MANIFOLD_ID; } /// Attribute name for tolerance. - inline static const std::string& TOLERANCE_ID() - { + inline static const std::string &TOLERANCE_ID() { static const std::string MY_TOLERANCE_ID("tolerance"); return MY_TOLERANCE_ID; } /// Attribute name for result creation state. - inline static const std::string& ALWAYS_CREATE_RESULT_ID() - { + inline static const std::string &ALWAYS_CREATE_RESULT_ID() { static const std::string MY_ALWAYS_CREATE_RESULT_ID("always_create_result"); return MY_ALWAYS_CREATE_RESULT_ID; } - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Performs the algorithm and stores results in the data structure. @@ -87,12 +81,11 @@ public: private: /// Retrieve all shapes from the selection list - void getOriginalShapes(const std::string& theAttributeName, - ListOfShape& theShapes); + void getOriginalShapes(const std::string &theAttributeName, + ListOfShape &theShapes); /// Check, whether the result is sewn or not - bool isSewn(const ListOfShape& theInputs, - const GeomShapePtr theResult); + bool isSewn(const ListOfShape &theInputs, const GeomShapePtr theResult); }; #endif // FEATURESPLUGIN_SEWING_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp index 36b4fafac..6ce3e7b10 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_SharedFaces.h" @@ -33,15 +34,13 @@ #include //================================================================================================= -FeaturesPlugin_SharedFaces::FeaturesPlugin_SharedFaces() -{ -} +FeaturesPlugin_SharedFaces::FeaturesPlugin_SharedFaces() {} //================================================================================================= -void FeaturesPlugin_SharedFaces::initAttributes() -{ +void FeaturesPlugin_SharedFaces::initAttributes() { data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(LIST_FACES_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(LIST_FACES_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(NUMBER_FACES_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId()); @@ -49,42 +48,39 @@ void FeaturesPlugin_SharedFaces::initAttributes() data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), GROUP_NAME_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + GROUP_NAME_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + COMPUTE_ID()); data()->boolean(COMPUTE_ID())->setValue(true); } //================================================================================================= -AttributePtr FeaturesPlugin_SharedFaces::attributIsCompute() -{ +AttributePtr FeaturesPlugin_SharedFaces::attributIsCompute() { return attribute(COMPUTE_ID()); } //================================================================================================= -AttributePtr FeaturesPlugin_SharedFaces::attributObject() -{ +AttributePtr FeaturesPlugin_SharedFaces::attributObject() { return attribute(OBJECT_ID()); } //================================================================================================= -AttributePtr FeaturesPlugin_SharedFaces::attributListFaces() -{ +AttributePtr FeaturesPlugin_SharedFaces::attributListFaces() { return attribute(LIST_FACES_ID()); } //================================================================================================= -AttributePtr FeaturesPlugin_SharedFaces::attributNumberFaces() -{ +AttributePtr FeaturesPlugin_SharedFaces::attributNumberFaces() { return attribute(NUMBER_FACES_ID()); } //================================================================================================= -void FeaturesPlugin_SharedFaces::execute() -{ +void FeaturesPlugin_SharedFaces::execute() { if (boolean(CREATE_GROUP_ID())->value()) { - if (string(GROUP_NAME_ID())->value() != "" - && selectionList(LIST_FACES_ID())->isInitialized()) { + if (string(GROUP_NAME_ID())->value() != "" && + selectionList(LIST_FACES_ID())->isInitialized()) { if (lastResult().get()) { eraseResultFromList(lastResult()); @@ -101,7 +97,7 @@ void FeaturesPlugin_SharedFaces::execute() if (myCreateGroupFeature.get()) { myCreateGroupFeature->eraseResults(); SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); aDoc->removeFeature(myCreateGroupFeature); myCreateGroupFeature.reset(); } @@ -116,31 +112,33 @@ void FeaturesPlugin_SharedFaces::execute() AttributeSelectionPtr aCompSolidAttr = selection(OBJECT_ID()); ResultPtr aResult = aCompSolidAttr->context(); - double aTranparency = integer(TRANSPARENCY_ID())->value()/100.0; + double aTranparency = integer(TRANSPARENCY_ID())->value() / 100.0; ModelAPI_Tools::setTransparency(aResult, aTranparency); - ResultBodyPtr aResultBody = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aResultBody = + std::dynamic_pointer_cast(aResult); std::list allRes; ModelAPI_Tools::allSubs(aResultBody, allRes); std::list::iterator aRes; - for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) { + for (aRes = allRes.begin(); aRes != allRes.end(); aRes++) { ModelAPI_Tools::setTransparency(*aRes, aTranparency); } } // Update the number of shared faces AttributeSelectionListPtr aFacesListAttr = - std::dynamic_pointer_cast (attributListFaces()); + std::dynamic_pointer_cast( + attributListFaces()); AttributeStringPtr aNumberFacesAttr = - std::dynamic_pointer_cast (attributNumberFaces()); + std::dynamic_pointer_cast( + attributNumberFaces()); std::stringstream aLabel; aLabel << aFacesListAttr->size(); aNumberFacesAttr->setValue(aLabel.str()); } //================================================================================================= -void FeaturesPlugin_SharedFaces::attributeChanged(const std::string& theID) -{ +void FeaturesPlugin_SharedFaces::attributeChanged(const std::string &theID) { if (theID == OBJECT_ID()) { updateFaces(); if (myCreateGroupFeature.get()) @@ -148,38 +146,41 @@ void FeaturesPlugin_SharedFaces::attributeChanged(const std::string& theID) } } - //================================================================================================= -void FeaturesPlugin_SharedFaces::createGroup() -{ +void FeaturesPlugin_SharedFaces::createGroup() { SessionPtr aSession = ModelAPI_Session::get(); - DocumentPtr aDoc = aSession->activeDocument(); + DocumentPtr aDoc = aSession->activeDocument(); if (aDoc.get()) { - myCreateGroupFeature = aDoc->addFeature(FeaturesPlugin_GroupSharedFaces::ID()); + myCreateGroupFeature = + aDoc->addFeature(FeaturesPlugin_GroupSharedFaces::ID()); } } //================================================================================================= -void FeaturesPlugin_SharedFaces::updateGroup() -{ - myCreateGroupFeature->boolean(FeaturesPlugin_GroupSharedFaces::COMPUTE_ID())->setValue(false); - myCreateGroupFeature->string(FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID()) +void FeaturesPlugin_SharedFaces::updateGroup() { + myCreateGroupFeature->boolean(FeaturesPlugin_GroupSharedFaces::COMPUTE_ID()) + ->setValue(false); + myCreateGroupFeature->string(FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID()) ->setValue(string(GROUP_NAME_ID())->value()); - myCreateGroupFeature->selection(FeaturesPlugin_GroupSharedFaces::OBJECT_ID()) - ->setValue(selection(OBJECT_ID())->context(), selection(OBJECT_ID())->value()); - AttributeSelectionListPtr aFacesFeatures = - std::dynamic_pointer_cast - (myCreateGroupFeature->attribute(LIST_FACES_ID())); - - AttributeSelectionListPtr aFaces = - std::dynamic_pointer_cast(attribute(LIST_FACES_ID())); - aFaces->copyTo(aFacesFeatures); - - myCreateGroupFeature->integer(FeaturesPlugin_GroupSharedFaces::TRANSPARENCY_ID()) - ->setValue( integer(TRANSPARENCY_ID())->value()); - myCreateGroupFeature->execute(); - myCreateGroupFeature->boolean(FeaturesPlugin_GroupSharedFaces::COMPUTE_ID())->setValue(true); + myCreateGroupFeature->selection(FeaturesPlugin_GroupSharedFaces::OBJECT_ID()) + ->setValue(selection(OBJECT_ID())->context(), + selection(OBJECT_ID())->value()); + AttributeSelectionListPtr aFacesFeatures = + std::dynamic_pointer_cast( + myCreateGroupFeature->attribute(LIST_FACES_ID())); + + AttributeSelectionListPtr aFaces = + std::dynamic_pointer_cast( + attribute(LIST_FACES_ID())); + aFaces->copyTo(aFacesFeatures); + + myCreateGroupFeature + ->integer(FeaturesPlugin_GroupSharedFaces::TRANSPARENCY_ID()) + ->setValue(integer(TRANSPARENCY_ID())->value()); + myCreateGroupFeature->execute(); + myCreateGroupFeature->boolean(FeaturesPlugin_GroupSharedFaces::COMPUTE_ID()) + ->setValue(true); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h index 2ccadef25..79a7972f2 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_SharedFaces_H_ @@ -26,80 +27,69 @@ /// \ingroup Plugins /// \brief Feature to check the shared faces of compsolid or compound -class FeaturesPlugin_SharedFaces : public FeaturesPlugin_CommonSharedFaces -{ +class FeaturesPlugin_SharedFaces : public FeaturesPlugin_CommonSharedFaces { public: /// Shared faces kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Shared_faces_macro"); return MY_ID; } /// Attribute name for object selected. - inline static const std::string& OBJECT_ID() - { + inline static const std::string &OBJECT_ID() { static const std::string MY_OBJECT_ID("main_object"); return MY_OBJECT_ID; } /// Attribute name for number of faces. - inline static const std::string& NUMBER_FACES_ID() - { + inline static const std::string &NUMBER_FACES_ID() { static const std::string MY_NUMBER_FACES_ID("number_shared_faces"); return MY_NUMBER_FACES_ID; } /// Attribute name for z coodinate. - inline static const std::string& LIST_FACES_ID() - { + inline static const std::string &LIST_FACES_ID() { static const std::string MY_LIST_FACES_ID("group_list"); return MY_LIST_FACES_ID; } /// Attribute name for transparency. - inline static const std::string& TRANSPARENCY_ID() - { + inline static const std::string &TRANSPARENCY_ID() { static const std::string MY_TRANSPARENCY_ID("transparency"); return MY_TRANSPARENCY_ID; } /// Attribute name for checkbox create group. - inline static const std::string& CREATE_GROUP_ID() - { + inline static const std::string &CREATE_GROUP_ID() { static const std::string MY_CREATE_GROUP_ID("create_group"); return MY_CREATE_GROUP_ID; } /// Attribute name for indicate to launch the algo. - inline static const std::string& COMPUTE_ID() - { + inline static const std::string &COMPUTE_ID() { static const std::string MY_COMPUTE_ID("compute"); return MY_COMPUTE_ID; } /// Attribute name for group name. - inline static const std::string& GROUP_NAME_ID() - { + inline static const std::string &GROUP_NAME_ID() { static const std::string MY_GROUP_NAME_ID("group_name"); return MY_GROUP_NAME_ID; } /// \return the kind of a feature. - virtual const std::string& getKind() - { - return ID(); - } + virtual const std::string &getKind() { return ID(); } /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp index 87886d787..8c29205c7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include -#include #include +#include #include +#include #include #include @@ -48,19 +49,17 @@ static const std::string SYMMETRY_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry() -{ -} +FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry() {} //================================================================================================= -void FeaturesPlugin_Symmetry::initAttributes() -{ +void FeaturesPlugin_Symmetry::initAttributes() { data()->addAttribute(FeaturesPlugin_Symmetry::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_Symmetry::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_Symmetry::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(FeaturesPlugin_Symmetry::POINT_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -81,9 +80,9 @@ void FeaturesPlugin_Symmetry::initAttributes() } //================================================================================================= -void FeaturesPlugin_Symmetry::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(FeaturesPlugin_Symmetry::CREATION_METHOD()); +void FeaturesPlugin_Symmetry::execute() { + AttributeStringPtr aMethodTypeAttr = + string(FeaturesPlugin_Symmetry::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); GeomTrsfPtr aTrsf; @@ -98,11 +97,11 @@ void FeaturesPlugin_Symmetry::execute() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPoint() -{ - //Getting point. +GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPoint() { + // Getting point. std::shared_ptr aPoint; - AttributeSelectionPtr anObjRef = selection(FeaturesPlugin_Symmetry::POINT_OBJECT_ID()); + AttributeSelectionPtr anObjRef = + selection(FeaturesPlugin_Symmetry::POINT_OBJECT_ID()); if (anObjRef.get() != NULL) { GeomShapePtr aShape1 = anObjRef->value(); if (!aShape1.get()) { @@ -119,10 +118,10 @@ GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPoint() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByAxis() -{ - //Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; +GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByAxis() { + // Getting axis. + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID()); GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { @@ -136,34 +135,30 @@ GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByAxis() } GeomEdgePtr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - if (!anEdge.get()) - { + if (!anEdge.get()) { setError(aSelectionError); return GeomTrsfPtr(); } - std::shared_ptr anAxis (new GeomAPI_Ax1(anEdge->line()->location(), - anEdge->line()->direction())); + std::shared_ptr anAxis( + new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); GeomTrsfPtr aTrsf(new GeomAPI_Trsf); aTrsf->setSymmetry(anAxis); return aTrsf; } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPlane() -{ - //Getting plane. - static const std::string aSelectionError = "Error: The plane shape selection is bad."; +GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPlane() { + // Getting plane. + static const std::string aSelectionError = + "Error: The plane shape selection is bad."; AttributeSelectionPtr anObjRef = selection(PLANE_OBJECT_ID()); GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { @@ -177,24 +172,20 @@ GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPlane() } GeomFacePtr aFace; - if (aShape->isFace()) - { + if (aShape->isFace()) { aFace = aShape->face(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); aFace = anIt.current()->face(); } - if (!aFace.get()) - { + if (!aFace.get()) { setError(aSelectionError); return GeomTrsfPtr(); } - std::shared_ptr aPlane(new GeomAPI_Ax2(aFace->getPlane()->location(), - aFace->getPlane()->direction())); + std::shared_ptr aPlane(new GeomAPI_Ax2( + aFace->getPlane()->location(), aFace->getPlane()->direction())); GeomTrsfPtr aTrsf(new GeomAPI_Trsf); aTrsf->setSymmetry(aPlane); return aTrsf; @@ -202,15 +193,15 @@ GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPlane() //================================================================================================= void FeaturesPlugin_Symmetry::buildResult( - const std::shared_ptr& theAlgo, - const std::list >& theOriginalShapes, - std::shared_ptr theTargetShape, int& theResultIndex, - const ResultPtr& theTextureSource) -{ + const std::shared_ptr &theAlgo, + const std::list> &theOriginalShapes, + std::shared_ptr theTargetShape, int &theResultIndex, + const ResultPtr &theTextureSource) { // Store and name the result. ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(), - theAlgo, theTargetShape, "Symmetried"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, + ListOfShape(), theAlgo, theTargetShape, + "Symmetried"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(theTextureSource, aResultBody); setResult(aResultBody, theResultIndex++); @@ -219,34 +210,34 @@ void FeaturesPlugin_Symmetry::buildResult( //================================================================================================= void FeaturesPlugin_Symmetry::buildResult(ResultPartPtr theOriginal, std::shared_ptr theTrsf, - int& theResultIndex) -{ + int &theResultIndex) { if (boolean(KEEP_ORIGINAL_RESULT())->value()) { std::shared_ptr anIdentity(new GeomAPI_Trsf()); - ResultPartPtr aCopy = document()->copyPart(theOriginal, data(), theResultIndex); + ResultPartPtr aCopy = + document()->copyPart(theOriginal, data(), theResultIndex); aCopy->setTrsf(theOriginal, anIdentity); setResult(aCopy, theResultIndex++); } - ResultPartPtr aResultPart = document()->copyPart(theOriginal, data(), theResultIndex); + ResultPartPtr aResultPart = + document()->copyPart(theOriginal, data(), theResultIndex); aResultPart->setTrsf(theOriginal, theTrsf); setResult(aResultPart, theResultIndex++); } //================================================================================================= -static bool performShapeSymmetry(std::shared_ptr& theAlgoList, - GeomAPI_ShapeHierarchy& theHierarchy, - GeomShapePtr theBaseShape, - GeomTrsfPtr theTrsf, - bool isKeepOriginalResult, - const std::string& theFeatureKind, - std::string& theError) -{ +static bool +performShapeSymmetry(std::shared_ptr &theAlgoList, + GeomAPI_ShapeHierarchy &theHierarchy, + GeomShapePtr theBaseShape, GeomTrsfPtr theTrsf, + bool isKeepOriginalResult, + const std::string &theFeatureKind, std::string &theError) { std::shared_ptr aSymmetryAlgo( new GeomAlgoAPI_Transform(theBaseShape, theTrsf)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, theFeatureKind, theError)) + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, + theFeatureKind, theError)) return false; theAlgoList->appendAlgo(aSymmetryAlgo); @@ -255,23 +246,23 @@ static bool performShapeSymmetry(std::shared_ptr& the GeomShapePtr aCompound; if (isKeepOriginalResult) { ListOfShape aShapes; - // add a copy of a base shape otherwise selection of this base shape is bad (2592) - std::shared_ptr aCopyAlgo(new GeomAlgoAPI_Copy(theBaseShape)); + // add a copy of a base shape otherwise selection of this base shape is bad + // (2592) + std::shared_ptr aCopyAlgo( + new GeomAlgoAPI_Copy(theBaseShape)); aShapes.push_back(aCopyAlgo->shape()); theAlgoList->appendAlgo(aCopyAlgo); aShapes.push_back(aSymmetryAlgo->shape()); aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); - } - else + } else aCompound = aSymmetryAlgo->shape(); theHierarchy.markModified(theBaseShape, aCompound); return true; } -void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf) -{ +void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf) { if (!theTrsf) { setError("Invalid transformation."); return; @@ -286,19 +277,22 @@ void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf) ResultPtr aTextureSource; AttributeSelectionListPtr anObjSelList = selectionList(OBJECTS_LIST_ID()); if (!FeaturesPlugin_Tools::shapesFromSelectionList( - anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; std::string anError; int aResultIndex = 0; // Symmetrying parts. - for (std::list::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) { - ResultPartPtr anOriginal = std::dynamic_pointer_cast(*aPRes); + for (std::list::iterator aPRes = aParts.begin(); + aPRes != aParts.end(); ++aPRes) { + ResultPartPtr anOriginal = + std::dynamic_pointer_cast(*aPRes); buildResult(anOriginal, theTrsf, aResultIndex); } // Collect transformations for each object in a part. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); ++anObjectsIt) { std::shared_ptr aBaseShape = *anObjectsIt; @@ -310,11 +304,13 @@ void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf) } // Build results of the rotation. - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) - buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex, aTextureSource); + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) + buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex, + aTextureSource); // Remove the rest results if there were produced in the previous pass. removeResults(aResultIndex); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h index cc2a7fc0d..85a1d3592 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FEATURESPLUGIN_SYMMETRY_H_ @@ -30,84 +31,73 @@ class GeomAlgoAPI_MakeShapeList; /** \class FeaturesPlugin_Symmetry * \ingroup Plugins - * \brief Feature that performs reflection with respect to a point, axis, or plane. + * \brief Feature that performs reflection with respect to a point, axis, or + * plane. */ -class FeaturesPlugin_Symmetry : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_Symmetry : public ModelAPI_Feature { +public: /// Symmetry kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SYMMETRY_ID("Symmetry"); return MY_SYMMETRY_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByPoint". - inline static const std::string& CREATION_METHOD_BY_POINT() - { + inline static const std::string &CREATION_METHOD_BY_POINT() { static const std::string MY_CREATION_METHOD_ID("ByPoint"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByAxis". - inline static const std::string& CREATION_METHOD_BY_AXIS() - { + inline static const std::string &CREATION_METHOD_BY_AXIS() { static const std::string MY_CREATION_METHOD_ID("ByAxis"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByPlane". - inline static const std::string& CREATION_METHOD_BY_PLANE() - { + inline static const std::string &CREATION_METHOD_BY_PLANE() { static const std::string MY_CREATION_METHOD_ID("ByPlane"); return MY_CREATION_METHOD_ID; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name of a point. - inline static const std::string& POINT_OBJECT_ID() - { + inline static const std::string &POINT_OBJECT_ID() { static const std::string MY_POINT_OBJECT_ID("point_object"); return MY_POINT_OBJECT_ID; } /// Attribute name of an axis. - inline static const std::string& AXIS_OBJECT_ID() - { + inline static const std::string &AXIS_OBJECT_ID() { static const std::string MY_AXIS_OBJECT_ID("axis_object"); return MY_AXIS_OBJECT_ID; } /// Attribute name of a plane. - inline static const std::string& PLANE_OBJECT_ID() - { + inline static const std::string &PLANE_OBJECT_ID() { static const std::string MY_PLANE_OBJECT_ID("plane_object"); return MY_PLANE_OBJECT_ID; } /// Attribute name of keeping original shape. - inline static const std::string& KEEP_ORIGINAL_RESULT() - { + inline static const std::string &KEEP_ORIGINAL_RESULT() { static const std::string MY_KEEP_ORIGINAL_RESULT_ID("keep_original"); return MY_KEEP_ORIGINAL_RESULT_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Symmetry::ID(); return MY_KIND; } @@ -115,7 +105,8 @@ class FeaturesPlugin_Symmetry : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -135,16 +126,15 @@ private: void performSymmetry(std::shared_ptr theTrsf); /// Create new result on given shapes and the index of result - void buildResult(const std::shared_ptr& theAlgo, - const std::list >& theOriginalShapes, - std::shared_ptr theTargetShape, - int& theResultIndex, - const ResultPtr& theTextureSource); + void buildResult( + const std::shared_ptr &theAlgo, + const std::list> &theOriginalShapes, + std::shared_ptr theTargetShape, int &theResultIndex, + const ResultPtr &theTextureSource); /// Create new result for the given part and transformation void buildResult(std::shared_ptr theOriginal, - std::shared_ptr theTrsf, - int& theResultIndex); + std::shared_ptr theTrsf, int &theResultIndex); }; #endif // FEATURESPLUGIN_SYMMETRY_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp index 44958e9c8..ecd01451d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Tools.h" @@ -34,77 +35,80 @@ #include //================================================================================================== -bool FeaturesPlugin_Tools::getShape(const AttributeSelectionListPtr theSelectionList, - const bool theShareTopology, - ListOfShape& theShapesList, - std::string& theError) -{ +bool FeaturesPlugin_Tools::getShape( + const AttributeSelectionListPtr theSelectionList, + const bool theShareTopology, ListOfShape &theShapesList, + std::string &theError) { theShapesList.clear(); ListOfShape aBaseFacesList; std::map aSketchWiresMap; - if(!theSelectionList.get()) { + if (!theSelectionList.get()) { theError = "Error: Could not get base objects selection list."; return false; } - if(theSelectionList->size() == 0) { + if (theSelectionList->size() == 0) { theError = "Error: Base objects list is empty."; return false; } - for(int anIndex = 0; anIndex < theSelectionList->size(); anIndex++) { - AttributeSelectionPtr aBaseObjectSelection = theSelectionList->value(anIndex); - if(!aBaseObjectSelection.get()) { + for (int anIndex = 0; anIndex < theSelectionList->size(); anIndex++) { + AttributeSelectionPtr aBaseObjectSelection = + theSelectionList->value(anIndex); + if (!aBaseObjectSelection.get()) { theError = "Error: Selected base object is empty."; return false; } GeomShapePtr aBaseShape = aBaseObjectSelection->value(); - if(aBaseShape.get() && !aBaseShape->isNull()) { + if (aBaseShape.get() && !aBaseShape->isNull()) { GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType(); - if(aST == GeomAPI_Shape::SOLID || aST == GeomAPI_Shape::COMPSOLID) { + if (aST == GeomAPI_Shape::SOLID || aST == GeomAPI_Shape::COMPSOLID) { theError = "Error: Selected shapes has unsupported type."; return false; } ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aBaseObjectSelection->context()); - if(aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) && + std::dynamic_pointer_cast( + aBaseObjectSelection->context()); + if (aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) && aST == GeomAPI_Shape::WIRE) { // It is a wire on the sketch, store it to make face later. aSketchWiresMap[aConstruction].push_back(aBaseShape); continue; } else { - aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) : - theShapesList.push_back(aBaseShape); + aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) + : theShapesList.push_back(aBaseShape); } } else { // This may be the whole sketch result selected, check and get faces. ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aBaseObjectSelection->context()); - if(!aConstruction.get()) { + std::dynamic_pointer_cast( + aBaseObjectSelection->context()); + if (!aConstruction.get()) { theError = "Error: Selected sketches does not have results."; return false; } GeomValidators_ShapeType::TypeOfShape aSelType = - GeomValidators_ShapeType::shapeType(theSelectionList->selectionType()); + GeomValidators_ShapeType::shapeType( + theSelectionList->selectionType()); int aFacesNum = 0; if (aSelType != GeomValidators_ShapeType::Vertex && aSelType != GeomValidators_ShapeType::Edge) aFacesNum = aConstruction->facesNum(); - if(aFacesNum == 0) { + if (aFacesNum == 0) { // Probably it can be construction. aBaseShape = aConstruction->shape(); - if(aBaseShape.get() && !aBaseShape->isNull()) { + if (aBaseShape.get() && !aBaseShape->isNull()) { GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType(); - if(aST == GeomAPI_Shape::SOLID || aST == GeomAPI_Shape::COMPSOLID) { + if (aST == GeomAPI_Shape::SOLID || aST == GeomAPI_Shape::COMPSOLID) { theError = "Error: Selected shapes has unsupported type."; return false; } - aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) : - theShapesList.push_back(aBaseShape); + aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) + : theShapesList.push_back(aBaseShape); } } else { - for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { + for (int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { GeomShapePtr aBaseFace = aConstruction->face(aFaceIndex); - if(!aBaseFace.get() || aBaseFace->isNull()) { + if (!aBaseFace.get() || aBaseFace->isNull()) { theError = "Error: One of the faces on selected sketch is null."; return false; } @@ -115,25 +119,28 @@ bool FeaturesPlugin_Tools::getShape(const AttributeSelectionListPtr theSelection } // Make faces from sketch wires. - for(std::map::const_iterator anIt = aSketchWiresMap.cbegin(); - anIt != aSketchWiresMap.cend(); ++anIt) { + for (std::map::const_iterator anIt = + aSketchWiresMap.cbegin(); + anIt != aSketchWiresMap.cend(); ++anIt) { const std::shared_ptr aSketchPlanarEdges = std::dynamic_pointer_cast((*anIt).first->shape()); - const ListOfShape& aWiresList = (*anIt).second; + const ListOfShape &aWiresList = (*anIt).second; ListOfShape aFaces; GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aSketchPlanarEdges->origin(), aSketchPlanarEdges->norm(), - aWiresList, - aFaces); + aWiresList, aFaces); aBaseFacesList.insert(aBaseFacesList.end(), aFaces.begin(), aFaces.end()); } // Searching faces with common edges. - if(theShareTopology && aBaseFacesList.size() > 1) { - GeomShapePtr aFacesCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList); - GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL, theShapesList); + if (theShareTopology && aBaseFacesList.size() > 1) { + GeomShapePtr aFacesCompound = + GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList); + GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL, + theShapesList); } else { - theShapesList.insert(theShapesList.end(), aBaseFacesList.begin(), aBaseFacesList.end()); + theShapesList.insert(theShapesList.end(), aBaseFacesList.begin(), + aBaseFacesList.end()); } return true; } @@ -141,10 +148,8 @@ bool FeaturesPlugin_Tools::getShape(const AttributeSelectionListPtr theSelection //================================================================================================== bool FeaturesPlugin_Tools::shapesFromSelectionList( const std::shared_ptr theSelectionList, - const bool theStoreFullHierarchy, - GeomAPI_ShapeHierarchy& theHierarchy, - std::list& theParts, ResultPtr& theTextureSource) -{ + const bool theStoreFullHierarchy, GeomAPI_ShapeHierarchy &theHierarchy, + std::list &theParts, ResultPtr &theTextureSource) { int aSize = theSelectionList->size(); if (aSize == 1) { auto anObjectAttr = theSelectionList->value(0); @@ -152,8 +157,7 @@ bool FeaturesPlugin_Tools::shapesFromSelectionList( FeaturePtr aFeature = anObjectAttr->contextFeature(); if (aFeature.get() && aFeature->results().size() == 1) { theTextureSource = aFeature->firstResult(); - } - else { + } else { if (!aFeature.get()) { auto aResult = anObjectAttr->context(); if (aResult.get()) { @@ -164,7 +168,8 @@ bool FeaturesPlugin_Tools::shapesFromSelectionList( } } for (int anObjectsIndex = 0; anObjectsIndex < aSize; anObjectsIndex++) { - AttributeSelectionPtr anObjectAttr = theSelectionList->value(anObjectsIndex); + AttributeSelectionPtr anObjectAttr = + theSelectionList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if (!anObject.get()) { // may be for not-activated parts return false; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Tools.h b/src/FeaturesPlugin/FeaturesPlugin_Tools.h index c4a71bd97..9d24c105d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Tools.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Tools.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Tools_H_ #define FeaturesPlugin_Tools_H_ -#include #include +#include #include #include @@ -29,18 +30,17 @@ class FeaturesPlugin_Tools { public: /// Obtain shapes from the selection list attribute. - static bool getShape(const std::shared_ptr theSelectionList, - const bool theShareTopology, - ListOfShape& theShapesList, - std::string& theError); + static bool getShape( + const std::shared_ptr theSelectionList, + const bool theShareTopology, ListOfShape &theShapesList, + std::string &theError); - /// Collect shapes from the attribute and fill the hierarchy or a list of parts + /// Collect shapes from the attribute and fill the hierarchy or a list of + /// parts static bool shapesFromSelectionList( const std::shared_ptr theSelectionList, - const bool theStoreFullHierarchy, - GeomAPI_ShapeHierarchy& theHierarchy, - std::list& theParts, - ResultPtr& theTextureSource); + const bool theStoreFullHierarchy, GeomAPI_ShapeHierarchy &theHierarchy, + std::list &theParts, ResultPtr &theTextureSource); }; #endif /* FeaturesPlugin_Tools_H_ */ diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp index 8eaaf904f..0d4381f74 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -31,8 +32,8 @@ #include #include #include -#include #include +#include #include #include @@ -45,19 +46,17 @@ static const std::string TRANSLATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Translation::FeaturesPlugin_Translation() -{ -} +FeaturesPlugin_Translation::FeaturesPlugin_Translation() {} //================================================================================================= -void FeaturesPlugin_Translation::initAttributes() -{ +void FeaturesPlugin_Translation::initAttributes() { data()->addAttribute(FeaturesPlugin_Translation::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); AttributeSelectionListPtr aSelection = - std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_Translation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + std::dynamic_pointer_cast( + data()->addAttribute(FeaturesPlugin_Translation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); data()->addAttribute(FeaturesPlugin_Translation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); @@ -83,9 +82,9 @@ void FeaturesPlugin_Translation::initAttributes() } //================================================================================================= -void FeaturesPlugin_Translation::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(FeaturesPlugin_Translation::CREATION_METHOD()); +void FeaturesPlugin_Translation::execute() { + AttributeStringPtr aMethodTypeAttr = + string(FeaturesPlugin_Translation::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); GeomTrsfPtr aTrsf; @@ -100,10 +99,10 @@ void FeaturesPlugin_Translation::execute() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Translation::translationByAxisAndDistance() -{ - //Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; +GeomTrsfPtr FeaturesPlugin_Translation::translationByAxisAndDistance() { + // Getting axis. + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID()); GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { @@ -117,24 +116,20 @@ GeomTrsfPtr FeaturesPlugin_Translation::translationByAxisAndDistance() } GeomEdgePtr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - if (!anEdge.get()) - { + if (!anEdge.get()) { setError(aSelectionError); return GeomTrsfPtr(); } - std::shared_ptr anAxis(new GeomAPI_Ax1(anEdge->line()->location(), - anEdge->line()->direction())); + std::shared_ptr anAxis( + new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); // Getting distance. double aDistance = real(FeaturesPlugin_Translation::DISTANCE_ID())->value(); @@ -145,8 +140,7 @@ GeomTrsfPtr FeaturesPlugin_Translation::translationByAxisAndDistance() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Translation::translationByDimensions() -{ +GeomTrsfPtr FeaturesPlugin_Translation::translationByDimensions() { // Getting dimensions in X, in Y and in Z double aDX = real(FeaturesPlugin_Translation::DX_ID())->value(); double aDY = real(FeaturesPlugin_Translation::DY_ID())->value(); @@ -158,16 +152,18 @@ GeomTrsfPtr FeaturesPlugin_Translation::translationByDimensions() } //================================================================================================= -GeomTrsfPtr FeaturesPlugin_Translation::translationByTwoPoints() -{ +GeomTrsfPtr FeaturesPlugin_Translation::translationByTwoPoints() { // Getting the start point and the end point - AttributeSelectionPtr aRef1 = data()->selection(FeaturesPlugin_Translation::START_POINT_ID()); - AttributeSelectionPtr aRef2 = data()->selection(FeaturesPlugin_Translation::END_POINT_ID()); + AttributeSelectionPtr aRef1 = + data()->selection(FeaturesPlugin_Translation::START_POINT_ID()); + AttributeSelectionPtr aRef2 = + data()->selection(FeaturesPlugin_Translation::END_POINT_ID()); std::shared_ptr aFirstPoint; std::shared_ptr aSecondPoint; if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { GeomShapePtr aShape1 = aRef1->value(); - if (!aShape1.get()) //If we can't get the points directly, try getting them from the context + if (!aShape1.get()) // If we can't get the points directly, try getting them + // from the context aShape1 = aRef1->context()->shape(); GeomShapePtr aShape2 = aRef2->value(); if (!aShape2.get()) @@ -186,8 +182,8 @@ GeomTrsfPtr FeaturesPlugin_Translation::translationByTwoPoints() } //================================================================================================= -void FeaturesPlugin_Translation::performTranslation(const GeomTrsfPtr& theTrsf) -{ +void FeaturesPlugin_Translation::performTranslation( + const GeomTrsfPtr &theTrsf) { if (!theTrsf) { setError("Invalid transformation."); return; @@ -200,31 +196,36 @@ void FeaturesPlugin_Translation::performTranslation(const GeomTrsfPtr& theTrsf) std::list aParts; ResultPtr aTextureSource; AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECTS_LIST_ID()); - if (!FeaturesPlugin_Tools::shapesFromSelectionList - (anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) + if (!FeaturesPlugin_Tools::shapesFromSelectionList( + anObjectsSelList, isKeepSubShapes, anObjects, aParts, aTextureSource)) return; std::string anError; int aResultIndex = 0; // Moving each part. - for (std::list::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) { - ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aPRes); - ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); + for (std::list::iterator aPRes = aParts.begin(); + aPRes != aParts.end(); ++aPRes) { + ResultPartPtr anOrigin = + std::dynamic_pointer_cast(*aPRes); + ResultPartPtr aResultPart = + document()->copyPart(anOrigin, data(), aResultIndex); aResultPart->setTrsf(anOrigin, theTrsf); setResult(aResultPart, aResultIndex++); } // Collect transformations for each object in a part. - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end(); anObjectsIt++) { + anObjectsIt != anObjects.end(); anObjectsIt++) { std::shared_ptr aBaseShape = *anObjectsIt; std::shared_ptr aTransformAlgo( new GeomAlgoAPI_Transform(aBaseShape, theTrsf)); // Checking that the algorithm worked properly. - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, + getKind(), anError)) { setError(anError); break; } @@ -234,14 +235,16 @@ void FeaturesPlugin_Translation::performTranslation(const GeomTrsfPtr& theTrsf) } // Build results of the operation. - const ListOfShape& anOriginalShapes = anObjects.objects(); + const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { - //LoadNamingDS + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { + // LoadNamingDS ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(), - aMakeShapeList, *anIt, "Translated"); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, + ListOfShape(), aMakeShapeList, *anIt, + "Translated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); setResult(aResultBody, aResultIndex++); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.h b/src/FeaturesPlugin/FeaturesPlugin_Translation.h index b919ea360..fac9d3f50 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Translation_H_ @@ -29,103 +30,88 @@ class GeomAPI_Trsf; /// \class FeaturesPlugin_Translation /// \ingroup Plugins /// \brief Feature for translation objects along the axis. -class FeaturesPlugin_Translation : public ModelAPI_Feature -{ - public: +class FeaturesPlugin_Translation : public ModelAPI_Feature { +public: /// Translation kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_TRANSLATION_ID("Translation"); return MY_TRANSLATION_ID; } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByAxisAndDistance". - inline static const std::string& CREATION_METHOD_BY_DISTANCE() - { + inline static const std::string &CREATION_METHOD_BY_DISTANCE() { static const std::string MY_CREATION_METHOD_ID("ByAxisAndDistance"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByDimensions". - inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() - { + inline static const std::string &CREATION_METHOD_BY_DIMENSIONS() { static const std::string MY_CREATION_METHOD_ID("ByDimensions"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method "ByTwoPoints". - inline static const std::string& CREATION_METHOD_BY_TWO_POINTS() - { + inline static const std::string &CREATION_METHOD_BY_TWO_POINTS() { static const std::string MY_CREATION_METHOD_ID("ByTwoPoints"); return MY_CREATION_METHOD_ID; } /// Attribute name of referenced objects. - inline static const std::string& OBJECTS_LIST_ID() - { + inline static const std::string &OBJECTS_LIST_ID() { static const std::string MY_OBJECTS_LIST_ID("main_objects"); return MY_OBJECTS_LIST_ID; } /// Attribute name of an axis. - inline static const std::string& AXIS_OBJECT_ID() - { + inline static const std::string &AXIS_OBJECT_ID() { static const std::string MY_AXIS_OBJECT_ID("axis_object"); return MY_AXIS_OBJECT_ID; } /// Attribute name of distance. - inline static const std::string& DISTANCE_ID() - { + inline static const std::string &DISTANCE_ID() { static const std::string MY_DISTANCE_ID("distance"); return MY_DISTANCE_ID; } /// Attribute name of dimension in X. - inline static const std::string& DX_ID() - { + inline static const std::string &DX_ID() { static const std::string MY_DX_ID("dx"); return MY_DX_ID; } /// Attribute name of dimension in Y. - inline static const std::string& DY_ID() - { + inline static const std::string &DY_ID() { static const std::string MY_DY_ID("dy"); return MY_DY_ID; } /// Attribute name of dimension in Z. - inline static const std::string& DZ_ID() - { + inline static const std::string &DZ_ID() { static const std::string MY_DZ_ID("dz"); return MY_DZ_ID; } /// Attribute name of start point. - inline static const std::string& START_POINT_ID() - { + inline static const std::string &START_POINT_ID() { static const std::string MY_START_POINT_ID("start_point"); return MY_START_POINT_ID; } /// Attribute name of end point. - inline static const std::string& END_POINT_ID() - { + inline static const std::string &END_POINT_ID() { static const std::string MY_END_POINT_ID("end_point"); return MY_END_POINT_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Translation::ID(); return MY_KIND; } @@ -133,7 +119,8 @@ class FeaturesPlugin_Translation : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. @@ -150,7 +137,7 @@ private: std::shared_ptr translationByTwoPoints(); /// Perform the translation - void performTranslation(const std::shared_ptr& theTrsf); + void performTranslation(const std::shared_ptr &theTrsf); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp index c5e7b0b7a..96aad491a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Union.h" @@ -35,31 +36,27 @@ #include #include - static const double DEFAULT_FUZZY = 1.e-5; - //================================================================================================= -FeaturesPlugin_Union::FeaturesPlugin_Union() -{ -} +FeaturesPlugin_Union::FeaturesPlugin_Union() {} //================================================================================================= -void FeaturesPlugin_Union::initAttributes() -{ - data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); +void FeaturesPlugin_Union::initAttributes() { + data()->addAttribute(BASE_OBJECTS_ID(), + ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + boolean(USE_FUZZY_ID()) + ->setValue(false); // Do NOT use the fuzzy parameter by default. real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(BOP_VERSION_9_4(), selectionList(BASE_OBJECTS_ID())); } //================================================================================================= -void FeaturesPlugin_Union::execute() -{ +void FeaturesPlugin_Union::execute() { GeomAPI_ShapeHierarchy anObjects; ListOfShape anEmptyList; @@ -67,14 +64,15 @@ void FeaturesPlugin_Union::execute() if (!processAttribute(BASE_OBJECTS_ID(), anObjects, anEmptyList)) return; - if(anObjects.objects().size() < 2) { + if (anObjects.objects().size() < 2) { setError("Error: Not enough objects for operation. Should be at least 2."); return; } // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the + // boolean operation! bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); @@ -83,13 +81,13 @@ void FeaturesPlugin_Union::execute() std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; - GeomShapePtr aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(ListOfShape()); + GeomShapePtr aResultCompound = + GeomAlgoAPI_CompoundBuilder::compound(ListOfShape()); // Fuse objects. bool isOk = true; for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin(); - anObjectsIt != anObjects.end() && isOk; - ++anObjectsIt) { + anObjectsIt != anObjects.end() && isOk; ++anObjectsIt) { GeomShapePtr anObject = *anObjectsIt; GeomShapePtr aParent = anObjects.parent(anObject, false); @@ -97,24 +95,23 @@ void FeaturesPlugin_Union::execute() // get parent once again to mark it and the subs as processed aParent = anObjects.parent(anObject); // compsolid handling - isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_FUSE, - anObjects, aParent, anEmptyList, anEmptyList, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, + isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_FUSE, anObjects, aParent, + anEmptyList, anEmptyList, aFuzzy, aResultIndex, + aResultBaseAlgoList, aResultShapesList, aResultCompound); } else { // process object as is - isOk = processObject(GeomAlgoAPI_Tools::BOOL_FUSE, - anObject, anEmptyList, anEmptyList, - aFuzzy, - aResultIndex, aResultBaseAlgoList, aResultShapesList, - aResultCompound); + isOk = + processObject(GeomAlgoAPI_Tools::BOOL_FUSE, anObject, anEmptyList, + anEmptyList, aFuzzy, aResultIndex, aResultBaseAlgoList, + aResultShapesList, aResultCompound); } } - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); - for (std::vector::iterator - aRBAIt = aResultBaseAlgoList.begin(); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); + for (std::vector::iterator aRBAIt = + aResultBaseAlgoList.begin(); aRBAIt != aResultBaseAlgoList.end(); ++aRBAIt) { aMakeShapeList->appendAlgo(aRBAIt->makeShape); } @@ -128,28 +125,32 @@ void FeaturesPlugin_Union::execute() aCIt.next(); if (aCIt.more()) aShape = aResultCompound; - } - else { + } else { // merge hierarchies of compounds containing objects and tools - aShape = keepUnusedSubsOfCompound(aCIt.current(), anObjects, GeomAPI_ShapeHierarchy(), - aMakeShapeList); + aShape = keepUnusedSubsOfCompound(aCIt.current(), anObjects, + GeomAPI_ShapeHierarchy(), aMakeShapeList); for (aCIt.next(); aCIt.more(); aCIt.next()) { - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder); aBuilder->add(aShape, aCIt.current()); aMakeShapeList->appendAlgo(aBuilder); } } // Store result and naming. - std::shared_ptr aResultBody = document()->createBody(data()); + std::shared_ptr aResultBody = + document()->createBody(data()); ListOfShape anObjectsList = anObjects.objects(); aResultBody->storeModified(anObjectsList.front(), aShape); - for(ListOfShape::const_iterator anIter = anObjectsList.begin(); - anIter != anObjectsList.end(); ++anIter) { - aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::EDGE); - aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::FACE); - //aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag); + for (ListOfShape::const_iterator anIter = anObjectsList.begin(); + anIter != anObjectsList.end(); ++anIter) { + aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, + GeomAPI_Shape::EDGE); + aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, + GeomAPI_Shape::FACE); + // aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, + // GeomAPI_Shape::FACE, aDeletedTag); } setResult(aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.h b/src/FeaturesPlugin/FeaturesPlugin_Union.h index d1ba5279d..8039ccd1e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Union_H_ @@ -24,42 +25,37 @@ /// \class FeaturesPlugin_Union /// \ingroup Plugins -/// \brief Feature for applying of Union operations on Shapes. Union removes shared shapes from +/// \brief Feature for applying of Union operations on Shapes. Union removes +/// shared shapes from /// several shapes and combines them into one. -class FeaturesPlugin_Union : public FeaturesPlugin_VersionedBoolean -{ +class FeaturesPlugin_Union : public FeaturesPlugin_VersionedBoolean { public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_ID("Union"); return MY_ID; } /// Attribute name of base objects. - inline static const std::string& BASE_OBJECTS_ID() - { + inline static const std::string &BASE_OBJECTS_ID() { static const std::string MY_BASE_OBJECTS_ID("base_objects"); return MY_BASE_OBJECTS_ID; } /// Attribute name of use fuzzy parameter. - inline static const std::string& USE_FUZZY_ID() - { + inline static const std::string &USE_FUZZY_ID() { static const std::string MY_USE_FUZZY_ID("use_fuzzy"); return MY_USE_FUZZY_ID; } /// Attribute name of fuzzy parameter. - inline static const std::string& FUZZY_PARAM_ID() - { + inline static const std::string &FUZZY_PARAM_ID() { static const std::string MY_FUZZY_PARAM_ID("fuzzy_param"); return MY_FUZZY_PARAM_ID; } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() - { + FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = FeaturesPlugin_Union::ID(); return MY_KIND; } @@ -67,7 +63,8 @@ public: /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes FEATURESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation diff --git a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp index d27817df0..ff23c86f8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_ValidatorTransform.h" @@ -22,27 +23,27 @@ #include #include -#include #include +#include #include #include -bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorTransform::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { bool aValid = true; std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType != ModelAPI_AttributeSelectionList::typeId()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); DocumentPtr aDocument = theAttribute->owner()->document(); SessionPtr aMgr = ModelAPI_Session::get(); @@ -50,14 +51,16 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute bool isCheckCompsolid = !theAttribute->owner()->data()->version().empty(); std::string anErrorGroupName; - for(int i = 0; i < aCurSelList->size() && aValid; i++) { - std::shared_ptr aSelAttribute = aCurSelList->value(i); + for (int i = 0; i < aCurSelList->size() && aValid; i++) { + std::shared_ptr aSelAttribute = + aCurSelList->value(i); ResultPtr aResult = aSelAttribute->context(); if (!aResult) { // this could be a whole feature selected FeaturePtr aFeature = aSelAttribute->contextFeature(); if (aFeature.get() && aFeature->results().size() > 0) { - if (aFeature->firstResult()->groupName() != ModelAPI_ResultBody::group()) { + if (aFeature->firstResult()->groupName() != + ModelAPI_ResultBody::group()) { anErrorGroupName = aFeature->firstResult()->groupName(); aValid = false; break; @@ -69,7 +72,8 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute } if (isPartSetDocument) // PartSet document: Result Part is valid aValid = aResult->groupName() == ModelAPI_ResultPart::group(); - else { // Part document: Result CompSolid is valid, but the solid in compsolid is forbidden + else { // Part document: Result CompSolid is valid, but the solid in + // compsolid is forbidden aValid = aResult->groupName() == ModelAPI_ResultBody::group(); if (aValid && isCheckCompsolid) { ResultBodyPtr aComp = ModelAPI_Tools::bodyOwner(aResult); @@ -83,8 +87,9 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute anErrorGroupName = aResult->groupName(); } if (!aValid) { - std::string aResultGroupName = isPartSetDocument ? ModelAPI_ResultPart::group() - : ModelAPI_ResultBody::group(); + std::string aResultGroupName = isPartSetDocument + ? ModelAPI_ResultPart::group() + : ModelAPI_ResultBody::group(); theError = "Objects from the %1 group can be selected in the %2 document, " "but an objects from the %3 group is selected."; theError.arg(aResultGroupName).arg(aDocument->kind()).arg(anErrorGroupName); diff --git a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h index 77093550d..39f291250 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_ValidatorTransform_H @@ -26,17 +27,16 @@ * \ingroup Validators * \brief A validator of selection */ -class FeaturesPlugin_ValidatorTransform : public ModelAPI_AttributeValidator -{ - public: +class FeaturesPlugin_ValidatorTransform : public ModelAPI_AttributeValidator { +public: /** \return true if attribute is valid * \param theAttribute the checked attribute * \param theArguments arguments of the attribute * \param theError error message */ - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 838f446c8..97e0800d0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_Validators.h" #include "FeaturesPlugin_Boolean.h" -#include "FeaturesPlugin_BooleanFuse.h" #include "FeaturesPlugin_BooleanCommon.h" +#include "FeaturesPlugin_BooleanFuse.h" #include "FeaturesPlugin_BooleanSmash.h" #include "FeaturesPlugin_CompositeBoolean.h" #include "FeaturesPlugin_Extrusion.h" @@ -33,10 +34,10 @@ #include #include #include +#include +#include #include #include -#include -#include #include #include #include @@ -67,31 +68,32 @@ #include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif //================================================================================================== -bool FeaturesPlugin_ValidatorPipePath::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorPipePath::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionPtr aPathAttrSelection = - std::dynamic_pointer_cast(theAttribute); - if(!aPathAttrSelection.get()) { -// LCOV_EXCL_START - theError = "Error: This validator can only work with path selector in \"Pipe\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!aPathAttrSelection.get()) { + // LCOV_EXCL_START + theError = "Error: This validator can only work with path selector in " + "\"Pipe\" feature."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } GeomShapePtr aPathShape = aPathAttrSelection->value(); ResultPtr aContext = aPathAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { theError = "Error: Empty context."; return false; } GeomShapePtr aContextShape = aContext->shape(); - if(aPathShape.get() && aPathShape->shapeType() == GeomAPI_Shape::WIRE && + if (aPathShape.get() && aPathShape->shapeType() == GeomAPI_Shape::WIRE && !aPathShape->isEqual(aContextShape)) { theError = "Error: Local selection of wires not allowed."; return false; @@ -101,28 +103,29 @@ bool FeaturesPlugin_ValidatorPipePath::isValid(const AttributePtr& theAttribute, } //================================================================================================== -bool FeaturesPlugin_ValidatorPipeLocations::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorPipeLocations::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!anAttrSelectionList.get()) { -// LCOV_EXCL_START - theError = - "Error: This validator can only work with selection list attributes in \"Pipe\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!anAttrSelectionList.get()) { + // LCOV_EXCL_START + theError = "Error: This validator can only work with selection list " + "attributes in \"Pipe\" feature."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::shared_ptr aFeature = - std::dynamic_pointer_cast(theAttribute->owner()); + std::dynamic_pointer_cast(theAttribute->owner()); - AttributeSelectionPtr aPathSelection = aFeature->selection(FeaturesPlugin_Pipe::PATH_OBJECT_ID()); + AttributeSelectionPtr aPathSelection = + aFeature->selection(FeaturesPlugin_Pipe::PATH_OBJECT_ID()); if (!aPathSelection.get()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Path not selected."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } GeomShapePtr aPathShape = aPathSelection->value(); @@ -179,47 +182,49 @@ bool FeaturesPlugin_ValidatorPipeLocations::isValid(const AttributePtr& theAttri //================================================================================================== // LCOV_EXCL_START bool FeaturesPlugin_ValidatorPipeLocationsNumber::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { static const std::string aCreationMethodID = "creation_method"; static const std::string aBaseObjectsID = "base_objects"; static const std::string aLocationsID = "locations_objects"; - if(theFeature->getKind() != "Pipe") { + if (theFeature->getKind() != "Pipe") { theError = "Error: Feature \"%1\" does not supported by this validator."; theError.arg(theFeature->getKind()); return false; } - AttributeStringPtr aCreationMethodAttr = theFeature->string(aCreationMethodID); - if(!aCreationMethodAttr.get()) { + AttributeStringPtr aCreationMethodAttr = + theFeature->string(aCreationMethodID); + if (!aCreationMethodAttr.get()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aCreationMethodID); return false; } - if(aCreationMethodAttr->value() != "locations") { + if (aCreationMethodAttr->value() != "locations") { return true; } - AttributeSelectionListPtr aBaseObjectsSelectionList = theFeature->selectionList(aBaseObjectsID); - if(!aBaseObjectsSelectionList.get()) { + AttributeSelectionListPtr aBaseObjectsSelectionList = + theFeature->selectionList(aBaseObjectsID); + if (!aBaseObjectsSelectionList.get()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aBaseObjectsID); return false; } - AttributeSelectionListPtr aLocationsSelectionList = theFeature->selectionList(aLocationsID); - if(!aLocationsSelectionList.get()) { + AttributeSelectionListPtr aLocationsSelectionList = + theFeature->selectionList(aLocationsID); + if (!aLocationsSelectionList.get()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aBaseObjectsID); return false; } - if(aLocationsSelectionList->size() > 0 && - aLocationsSelectionList->size() != aBaseObjectsSelectionList->size()) { + if (aLocationsSelectionList->size() > 0 && + aLocationsSelectionList->size() != aBaseObjectsSelectionList->size()) { theError = "Error: Number of locations should be the same as base objects."; return false; } @@ -230,10 +235,9 @@ bool FeaturesPlugin_ValidatorPipeLocationsNumber::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorLoftSameTypeShape::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { static const std::string aFirstObjetcID = "first_object"; static const std::string aSecondObjetcID = "second_object"; @@ -243,25 +247,27 @@ bool FeaturesPlugin_ValidatorLoftSameTypeShape::isValid( return false; } - AttributeSelectionPtr aFirstObjectsSelection = theFeature->selection(aFirstObjetcID); - if ( !aFirstObjectsSelection->isInitialized()) { + AttributeSelectionPtr aFirstObjectsSelection = + theFeature->selection(aFirstObjetcID); + if (!aFirstObjectsSelection->isInitialized()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aFirstObjetcID); return false; } - AttributeSelectionPtr aSecondObjectsSelection = theFeature->selection(aSecondObjetcID); + AttributeSelectionPtr aSecondObjectsSelection = + theFeature->selection(aSecondObjetcID); if (!aSecondObjectsSelection->isInitialized()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aSecondObjetcID); return false; } - GeomShapePtr aFirstShape = aFirstObjectsSelection->value(); + GeomShapePtr aFirstShape = aFirstObjectsSelection->value(); if (!aFirstShape.get()) { aFirstShape = aFirstObjectsSelection->context()->shape(); } - GeomShapePtr aSecondShape = aSecondObjectsSelection->value(); + GeomShapePtr aSecondShape = aSecondObjectsSelection->value(); if (!aSecondShape.get()) { aSecondShape = aSecondObjectsSelection->context()->shape(); } @@ -271,7 +277,7 @@ bool FeaturesPlugin_ValidatorLoftSameTypeShape::isValid( return false; } - if (aFirstShape->shapeType()!=aSecondShape->shapeType()) { + if (aFirstShape->shapeType() != aSecondShape->shapeType()) { theError = "Error: the shapes have different type"; return false; } @@ -280,20 +286,20 @@ bool FeaturesPlugin_ValidatorLoftSameTypeShape::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START - if(theArguments.empty()) { +bool FeaturesPlugin_ValidatorBaseForGeneration::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START + if (theArguments.empty()) { theError = "Error: Validator parameters is empty."; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP // Checking attribute. - if(!isValidAttribute(theAttribute, theArguments, theError)) { - if(theError.empty()) { + if (!isValidAttribute(theAttribute, theArguments, theError)) { + if (theError.empty()) { theError = "Error: Attribute contains unacceptable shape."; } return false; @@ -301,24 +307,26 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA GeomAPI_DataMapOfShapeShape aSelectedWiresFromObjects; std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aListAttr = - std::dynamic_pointer_cast(theAttribute); - for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { + std::dynamic_pointer_cast( + theAttribute); + for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { AttributeSelectionPtr aSelectionAttr = aListAttr->value(anIndex); ResultPtr aContext = aSelectionAttr->context(); - if(!aContext.get() && !aSelectionAttr->contextFeature().get()) { + if (!aContext.get() && !aSelectionAttr->contextFeature().get()) { theError = "Error: Empty context."; return false; } ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); - if(!aResultConstruction.get()) { + std::dynamic_pointer_cast(aContext); + if (!aResultConstruction.get()) { // It is not a result construction. - // If shape is compound check that it contains only faces, edges or vertices. + // If shape is compound check that it contains only faces, edges or + // vertices. GeomShapePtr aShape = aSelectionAttr->value(); - if(!aShape.get()) { + if (!aShape.get()) { if (aContext.get()) { aShape = aContext->shape(); } else { @@ -327,12 +335,13 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA } } - if(aShape->shapeType() == GeomAPI_Shape::COMPOUND) { - for(GeomAPI_ShapeIterator anIt(aShape); anIt.more(); anIt.next()) { + if (aShape->shapeType() == GeomAPI_Shape::COMPOUND) { + for (GeomAPI_ShapeIterator anIt(aShape); anIt.more(); anIt.next()) { GeomShapePtr aSubShape = anIt.current(); if (aSubShape->shapeType() > GeomAPI_Shape::VERTEX || aSubShape->shapeType() < GeomAPI_Shape::FACE) { - theError = "Error: Compound should contain only faces, edges or vertices."; + theError = "Error: Compound should contain only faces, edges or " + "vertices."; return false; } } @@ -343,21 +352,22 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA GeomShapePtr aShape = aSelectionAttr->value(); GeomShapePtr aContextShape = aResultConstruction->shape(); - if(!aShape.get()) { + if (!aShape.get()) { // Whole sketch selected. continue; } else { // Object from sketch selected. - for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::WIRE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::WIRE); + anExp.more(); anExp.next()) { GeomShapePtr aWire = anExp.current(); - if(aWire->orientation() != GeomAPI_Shape::FORWARD) { + if (aWire->orientation() != GeomAPI_Shape::FORWARD) { theError = "Error: Wire with wrong orientation selected."; return false; } - if(aSelectedWiresFromObjects.isBound(aWire)) { - theError = - "Error: Objects with this wire already selected. Don't allow to select this object."; + if (aSelectedWiresFromObjects.isBound(aWire)) { + theError = "Error: Objects with this wire already selected. Don't " + "allow to select this object."; return false; } @@ -372,28 +382,28 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA //================================================================================================== bool FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { const std::string aBaseObjectsID = theArguments.front(); - AttributeSelectionListPtr aListAttr = theFeature->selectionList(aBaseObjectsID); - if(!aListAttr.get()) { -// LCOV_EXCL_START + AttributeSelectionListPtr aListAttr = + theFeature->selectionList(aBaseObjectsID); + if (!aListAttr.get()) { + // LCOV_EXCL_START theError = "Error: Could not get \"%1\" attribute."; theError.arg(aBaseObjectsID); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::set aSelectedSketches; std::set aSelectedSketchesFromObjects; - for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { AttributeSelectionPtr aSelectionAttr = aListAttr->value(anIndex); ResultPtr aContext = aSelectionAttr->context(); - if(!aContext.get()) { + if (!aContext.get()) { FeaturePtr aFeature = aSelectionAttr->contextFeature(); if (!aFeature.get() || aFeature->results().empty()) { theError = "Error: Empty context."; @@ -404,15 +414,15 @@ bool FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects::isValid( } ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); - if(!aResultConstruction.get()) { + std::dynamic_pointer_cast(aContext); + if (!aResultConstruction.get()) { // It is not a result construction. continue; } GeomShapePtr aShape = aSelectionAttr->value(); GeomShapePtr aContextShape = aResultConstruction->shape(); - if(!aShape.get()) { + if (!aShape.get()) { // Whole sketch selected. aSelectedSketches.insert(aResultConstruction); } else { @@ -421,14 +431,14 @@ bool FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects::isValid( } } - - for(std::set::const_iterator anIt = aSelectedSketches.cbegin(); - anIt != aSelectedSketches.cend(); - ++anIt) { + for (std::set::const_iterator anIt = + aSelectedSketches.cbegin(); + anIt != aSelectedSketches.cend(); ++anIt) { ResultConstructionPtr aResultConstruction = *anIt; - if(aSelectedSketchesFromObjects.find(aResultConstruction) != + if (aSelectedSketchesFromObjects.find(aResultConstruction) != aSelectedSketchesFromObjects.cend()) { - theError = "Sketch and objects from it can not be selected at the same time."; + theError = + "Sketch and objects from it can not be selected at the same time."; return false; } } @@ -437,23 +447,24 @@ bool FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - if(!theAttribute.get()) { -// LCOV_EXCL_START +bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + if (!theAttribute.get()) { + // LCOV_EXCL_START theError = "Error: Empty attribute."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); - const std::string& aVersion = theAttribute->owner()->data()->version(); + const std::string &aVersion = theAttribute->owner()->data()->version(); std::string aSelType; if (!aVersion.empty()) aSelType = aListAttr->selectionType(); @@ -479,29 +490,30 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute break; } - for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { + for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { // If at least one attribute is invalid, the result is false. - if(!isValidAttribute(aListAttr->value(anIndex), anApplicableTypes, theError)) { + if (!isValidAttribute(aListAttr->value(anIndex), anApplicableTypes, + theError)) { return false; } } - } else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { // Getting context. AttributeSelectionPtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttr->context(); - if(!aContext.get() && !anAttr->contextFeature().get()) { + if (!aContext.get() && !anAttr->contextFeature().get()) { theError = "Error: Attribute have empty context."; return false; } GeomShapePtr aShape = anAttr->value(); GeomShapePtr aContextShape; - if(!aShape.get() && aContext.get()) { + if (!aShape.get() && aContext.get()) { aContextShape = aContext->shape(); aShape = aContextShape; } - if(!aShape.get()) { + if (!aShape.get()) { theError = "Error: Empty shape selected"; return false; } @@ -511,18 +523,19 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute aContext = anAttr->contextFeature()->firstResult(); } if (aContext.get()) - aConstruction = std::dynamic_pointer_cast(aContext); - if(aConstruction.get()) { + aConstruction = + std::dynamic_pointer_cast(aContext); + if (aConstruction.get()) { // Construction selected. Check that it is not infinite. - if(aConstruction->isInfinite() && !aConstruction->shape()->isVertex()) { + if (aConstruction->isInfinite() && !aConstruction->shape()->isVertex()) { theError = "Error: Infinite constructions is not allowed as base."; return false; } aContextShape = aContext->shape(); - if(aShape->isEqual(aContextShape)) { + if (aShape->isEqual(aContextShape)) { // Whole construction selected. Check that it has faces. - if((theArguments.front() == "face" && aConstruction->facesNum() > 0) || + if ((theArguments.front() == "face" && aConstruction->facesNum() > 0) || theArguments.front() == "edge") { return true; } @@ -530,30 +543,33 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute // CUT operation supports only FACE or WIRE as a tool base std::shared_ptr aComposite = std::dynamic_pointer_cast( - ModelAPI_Feature::feature(theAttribute->owner())); - if (aComposite && - aComposite->operationType() == FeaturesPlugin_CompositeBoolean::BOOL_CUT) { + ModelAPI_Feature::feature(theAttribute->owner())); + if (aComposite && aComposite->operationType() == + FeaturesPlugin_CompositeBoolean::BOOL_CUT) { return aShape->shapeType() == GeomAPI_Shape::WIRE || aShape->shapeType() == GeomAPI_Shape::FACE; } } } - if(!aConstruction && aContextShape.get() && !aShape->isEqual(aContextShape)) { + if (!aConstruction && aContextShape.get() && + !aShape->isEqual(aContextShape)) { // Local selection on body does not allowed. - theError = - "Error: Selected shape is in the local selection. Only global selection is allowed."; + theError = "Error: Selected shape is in the local selection. Only global " + "selection is allowed."; return false; } // Check that object is a shape with allowed type. GeomValidators_ShapeType aShapeTypeValidator; - if(!aShapeTypeValidator.isValid(anAttr, theArguments, theError)) { - theError = "Error: Selected shape has unacceptable type. Acceptable types are: faces or " + if (!aShapeTypeValidator.isValid(anAttr, theArguments, theError)) { + theError = "Error: Selected shape has unacceptable type. Acceptable " + "types are: faces or " "wires on sketch, whole sketch (if it has at least one face), " "and whole objects with shape types: %1"; std::string anArgumentString; - for(auto anIt = theArguments.cbegin(); anIt != theArguments.cend(); ++anIt) { + for (auto anIt = theArguments.cbegin(); anIt != theArguments.cend(); + ++anIt) { if (!anArgumentString.empty()) anArgumentString += ", "; anArgumentString += *anIt; @@ -563,11 +579,11 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute } } else { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Attribute \"%1\" does not supported by this validator."; theError.arg(anAttributeType); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } return true; @@ -575,10 +591,10 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute //================================================================================================== // LCOV_EXCL_START -bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorCompositeLauncher::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { theError = "Error: The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -589,7 +605,8 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA theError.arg(theAttribute->attributeType()); return false; } - // first argument is for the base attribute, second - for skipping feature kind + // first argument is for the base attribute, second - for skipping feature + // kind std::list::const_iterator anIt = theArguments.begin(); std::string aBaseAttributeId = *anIt; FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); @@ -599,13 +616,14 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA theError.arg(theAttribute->attributeType()); return false; } - if (aBaseAttribute->isInitialized()) // when base list of composite feature is already filled, + if (aBaseAttribute->isInitialized()) // when base list of composite feature is + // already filled, // this validator is not necessary anymore return true; anIt++; std::string aFeatureAttributeKind = *anIt; - GeomValidators_FeatureKind* aValidator = new GeomValidators_FeatureKind(); + GeomValidators_FeatureKind *aValidator = new GeomValidators_FeatureKind(); // check whether the selection is on the sketch std::list anArguments; anArguments.push_back(aFeatureAttributeKind); @@ -613,7 +631,7 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA bool aFeatureKind = aValidator->isValid(theAttribute, theArguments, theError); bool aPlanarFace = false; // check if selection has Face selected - GeomValidators_ShapeType* aShapeType = new GeomValidators_ShapeType(); + GeomValidators_ShapeType *aShapeType = new GeomValidators_ShapeType(); anArguments.clear(); anArguments.push_back("face"); aPlanarFace = aShapeType->isValid(theAttribute, anArguments, theError); @@ -625,15 +643,15 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA //================================================================================================== bool FeaturesPlugin_ValidatorExtrusionDir::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - if(theArguments.size() != 2) { -// LCOV_EXCL_START - theError = "Error: Validator should be used with 2 parameters for extrusion."; + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + if (theArguments.size() != 2) { + // LCOV_EXCL_START + theError = + "Error: Validator should be used with 2 parameters for extrusion."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::list::const_iterator anArgsIt = theArguments.begin(); @@ -643,18 +661,18 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( GeomShapePtr aDirShape; AttributeSelectionPtr aSelAttr = theFeature->selection(*anArgsIt); - if(aSelAttr.get()) { + if (aSelAttr.get()) { aDirShape = aSelAttr->value(); - if(!aDirShape.get()) { + if (!aDirShape.get()) { ResultPtr aContext = aSelAttr->context(); - if(!aContext.get()) { + if (!aContext.get()) { FeaturePtr aFeature = aSelAttr->contextFeature(); if (aFeature.get() && !aFeature->results().empty()) { aContext = aFeature->firstResult(); } } - if(aContext.get()) { + if (aContext.get()) { aDirShape = aContext->shape(); } @@ -665,12 +683,14 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( } } - if(!aDirShape.get() || aDirShape->isNull() || - aDirShape->shapeType() != GeomAPI_Shape::EDGE) { + if (!aDirShape.get() || aDirShape->isNull() || + aDirShape->shapeType() != GeomAPI_Shape::EDGE) { // Check that dir can be empty. - if(!isShapesCanBeEmpty(aCheckAttribute, theError)) { - theError = "Error: Base objects list contains vertex or edge, so attribute \"%1\" " - "can not be used with default value. Select direction for extrusion."; + if (!isShapesCanBeEmpty(aCheckAttribute, theError)) { + theError = + "Error: Base objects list contains vertex or edge, so attribute " + "\"%1\" " + "can not be used with default value. Select direction for extrusion."; theError.arg(*anArgsIt); return false; } else { @@ -682,30 +702,31 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( // If faces selected check that direction not parallel with them. AttributeSelectionListPtr aListAttr = - std::dynamic_pointer_cast(aCheckAttribute); - for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { + std::dynamic_pointer_cast( + aCheckAttribute); + for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { AttributeSelectionPtr anAttr = aListAttr->value(anIndex); GeomShapePtr aShapeInList = anAttr->value(); - if(!aShapeInList.get()) { + if (!aShapeInList.get()) { aShapeInList = anAttr->context()->shape(); } bool isParallel = true; - if(aShapeInList->shapeType() == GeomAPI_Shape::FACE || - aShapeInList->shapeType() == GeomAPI_Shape::SHELL) { - for(GeomAPI_ShapeExplorer - anExp(aShapeInList, GeomAPI_Shape::FACE); anExp.more(); anExp.next()) { + if (aShapeInList->shapeType() == GeomAPI_Shape::FACE || + aShapeInList->shapeType() == GeomAPI_Shape::SHELL) { + for (GeomAPI_ShapeExplorer anExp(aShapeInList, GeomAPI_Shape::FACE); + anExp.more(); anExp.next()) { std::shared_ptr aFace(new GeomAPI_Face(anExp.current())); isParallel = GeomAlgoAPI_ShapeTools::isParallel(aDirEdge, aFace); - if(isParallel) { + if (isParallel) { break; } } - } else if(aShapeInList->shapeType() == GeomAPI_Shape::COMPOUND) { + } else if (aShapeInList->shapeType() == GeomAPI_Shape::COMPOUND) { std::shared_ptr aPlanarEdges = - std::dynamic_pointer_cast(aShapeInList); - if(aPlanarEdges.get()) { + std::dynamic_pointer_cast(aShapeInList); + if (aPlanarEdges.get()) { std::shared_ptr aSketchDir = aPlanarEdges->norm(); - if(aDirEdge->isLine()) { + if (aDirEdge->isLine()) { std::shared_ptr aDir = aDirEdge->line()->direction(); isParallel = fabs(aSketchDir->angle(aDir) - M_PI / 2.0) < 10e-7; } else { @@ -717,9 +738,9 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( } else { isParallel = false; } - if(isParallel) { - theError = - "Error: Direction is parallel to one of the selected face or face on selected shell."; + if (isParallel) { + theError = "Error: Direction is parallel to one of the selected face or " + "face on selected shell."; return false; } } @@ -728,46 +749,45 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty(const AttributePtr& theAttribute, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START - if(!theAttribute.get()) { +bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty( + const AttributePtr &theAttribute, Events_InfoMessage &theError) const { + // LCOV_EXCL_START + if (!theAttribute.get()) { return true; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aListAttr = - std::dynamic_pointer_cast(theAttribute); - for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { + std::dynamic_pointer_cast( + theAttribute); + for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { // If at least one attribute is invalid, the result is false. - if(!isShapesCanBeEmpty(aListAttr->value(anIndex), theError)) { + if (!isShapesCanBeEmpty(aListAttr->value(anIndex), theError)) { return false; } } - } else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { // Getting context. AttributeSelectionPtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttr->context(); - if(!aContext.get() && !anAttr->contextFeature().get()) { + if (!aContext.get() && !anAttr->contextFeature().get()) { return false; } GeomShapePtr aShape = anAttr->value(); - if(!aShape.get() && aContext.get()) { + if (!aShape.get() && aContext.get()) { GeomShapePtr aContextShape = aContext->shape(); aShape = aContextShape; } - if(!aShape.get()) { + if (!aShape.get()) { return false; } - if(aShape->shapeType() == GeomAPI_Shape::VERTEX || - aShape->shapeType() == GeomAPI_Shape::EDGE || - !aShape->isPlanar()) { + if (aShape->shapeType() == GeomAPI_Shape::VERTEX || + aShape->shapeType() == GeomAPI_Shape::EDGE || !aShape->isPlanar()) { return false; } } else { @@ -779,10 +799,9 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty(const AttributePtr //================================================================================================== bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); // Collect all necessary attributes and try to build prism @@ -792,7 +811,8 @@ bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( aFeature->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID()); ListOfShape aBaseShapeList; std::string anError; - if (!FeaturesPlugin_Tools::getShape(aBaseShapeAttr, true, aBaseShapeList, anError)) { + if (!FeaturesPlugin_Tools::getShape(aBaseShapeAttr, true, aBaseShapeList, + anError)) { theError = anError; return false; } @@ -849,18 +869,20 @@ bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( } } - double aToSize = aFeature->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID())->value(); - double aFromSize = aFeature->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID())->value(); + double aToSize = + aFeature->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID())->value(); + double aFromSize = + aFeature->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID())->value(); // check extrusion - for (ListOfShape::iterator anIt = aBaseShapeList.begin(); anIt != aBaseShapeList.end(); anIt++) { + for (ListOfShape::iterator anIt = aBaseShapeList.begin(); + anIt != aBaseShapeList.end(); anIt++) { std::shared_ptr aBaseShape = *anIt; - std::shared_ptr aPrismAlgo( - new GeomAlgoAPI_Prism(aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize)); - bool isFailed = GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, - FeaturesPlugin_Extrusion::ID(), - anError); + std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism( + aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize)); + bool isFailed = GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( + aPrismAlgo, FeaturesPlugin_Extrusion::ID(), anError); if (isFailed) { theError = anError; return false; @@ -871,31 +893,32 @@ bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorBooleanSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!anAttrSelectionList.get()) { -// LCOV_EXCL_START - theError = - "Error: This validator can only work with selection list attributes in \"Boolean\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!anAttrSelectionList.get()) { + // LCOV_EXCL_START + theError = "Error: This validator can only work with selection list " + "attributes in \"Boolean\" feature."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::shared_ptr aFeature = - std::dynamic_pointer_cast(theAttribute->owner()); - FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType(); + std::dynamic_pointer_cast(theAttribute->owner()); + FeaturesPlugin_Boolean::OperationType anOperationType = + aFeature->operationType(); - for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); - if(!anAttrSelection.get()) { + if (!anAttrSelection.get()) { theError = "Error: Empty attribute selection."; return false; } ResultPtr aContext = anAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { FeaturePtr aContFeat = anAttrSelection->contextFeature(); if (!aContFeat.get() || !aContFeat->results().size()) { theError = "Error: Empty selection context."; @@ -903,20 +926,20 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt } } ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); - if(aResultConstruction.get()) { - if (anOperationType != FeaturesPlugin_Boolean::BOOL_FILL - || theAttribute->id() != FeaturesPlugin_Boolean::TOOL_LIST_ID()) { + std::dynamic_pointer_cast(aContext); + if (aResultConstruction.get()) { + if (anOperationType != FeaturesPlugin_Boolean::BOOL_FILL || + theAttribute->id() != FeaturesPlugin_Boolean::TOOL_LIST_ID()) { theError = "Error: Result construction not allowed for selection."; return false; } } std::shared_ptr aShape = anAttrSelection->value(); - if(!aShape.get() && aContext.get()) { + if (!aShape.get() && aContext.get()) { GeomShapePtr aContextShape = aContext->shape(); aShape = aContextShape; } - if(!aShape.get()) { + if (!aShape.get()) { theError = "Error: Empty shape."; return false; } @@ -927,15 +950,14 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt GeomAPI_Shape::ShapeType aShapeType = aShape->shapeType(); std::set anAllowedTypes; - if(anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) { + if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) { anAllowedTypes.insert(GeomAPI_Shape::EDGE); anAllowedTypes.insert(GeomAPI_Shape::FACE); anAllowedTypes.insert(GeomAPI_Shape::SOLID); anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID); anAllowedTypes.insert(GeomAPI_Shape::COMPOUND); - } else if (anOperationType == FeaturesPlugin_Boolean::BOOL_FILL - || anOperationType == FeaturesPlugin_Boolean::BOOL_CUT) - { + } else if (anOperationType == FeaturesPlugin_Boolean::BOOL_FILL || + anOperationType == FeaturesPlugin_Boolean::BOOL_CUT) { anAllowedTypes.insert(GeomAPI_Shape::VERTEX); anAllowedTypes.insert(GeomAPI_Shape::EDGE); anAllowedTypes.insert(GeomAPI_Shape::WIRE); @@ -950,46 +972,47 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt anAllowedTypes.insert(GeomAPI_Shape::COMPOUND); } - if(anAllowedTypes.find(aShapeType) == anAllowedTypes.end() - || (aResultConstruction.get() && aShapeType != GeomAPI_Shape::FACE)) { + if (anAllowedTypes.find(aShapeType) == anAllowedTypes.end() || + (aResultConstruction.get() && aShapeType != GeomAPI_Shape::FACE)) { theError = "Error: Selected shape has the wrong type."; return false; } - } return true; } //================================================================================================== -bool FeaturesPlugin_ValidatorFilletSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorFilletSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!anAttrSelectionList.get()) { -// LCOV_EXCL_START - theError = - "Error: This validator can only work with selection list attributes in \"Fillet\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!anAttrSelectionList.get()) { + // LCOV_EXCL_START + theError = "Error: This validator can only work with selection list " + "attributes in \"Fillet\" feature."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); // Check all selected entities are sub-shapes of single solid GeomShapePtr aBaseSolid; - for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); - if(!anAttrSelection.get()) { + if (!anAttrSelection.get()) { theError = "Error: Empty attribute selection."; return false; } ResultPtr aContext = anAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { FeaturePtr aContFeat = anAttrSelection->contextFeature(); if (!aContFeat.get() || !aContFeat->results().size() || - aContFeat->firstResult()->groupName() != ModelAPI_ResultBody::group()) { + aContFeat->firstResult()->groupName() != + ModelAPI_ResultBody::group()) { theError = "Error: Empty selection context."; return false; } @@ -1003,7 +1026,8 @@ bool FeaturesPlugin_ValidatorFilletSelection::isValid(const AttributePtr& theAtt ResultBodyPtr aContextOwner = ModelAPI_Tools::bodyOwner(aContext, true); GeomShapePtr anOwner = aContext->shape(); - GeomShapePtr aTopLevelOwner = aContextOwner.get() ? aContextOwner->shape() : anOwner; + GeomShapePtr aTopLevelOwner = + aContextOwner.get() ? aContextOwner->shape() : anOwner; if (!anOwner) { theError = "Error: wrong feature is selected."; @@ -1027,28 +1051,26 @@ bool FeaturesPlugin_ValidatorFilletSelection::isValid(const AttributePtr& theAtt return true; } - //================================================================================================== -bool FeaturesPlugin_ValidatorFillet1DSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorFillet1DSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!anAttrSelectionList.get()) { // LCOV_EXCL_START - theError = - "Error: This validator can only work with selection list attributes in \"Fillet\" feature."; + theError = "Error: This validator can only work with selection list " + "attributes in \"Fillet\" feature."; return false; // LCOV_EXCL_STOP } // Validate wires selection - if (!theArguments.empty() && - theArguments.front() == "wire") { + if (!theArguments.empty() && theArguments.front() == "wire") { for (int ind = 0; ind < anAttrSelectionList->size(); ++ind) { AttributeSelectionPtr aCurSel = anAttrSelectionList->value(ind); - //GeomShapePtr aContext = aCurSel->context()->shape(); + // GeomShapePtr aContext = aCurSel->context()->shape(); GeomShapePtr aWire = aCurSel->value(); if (aWire->shapeType() != GeomAPI_Shape::WIRE) { theError = "Selected shape is not a wire"; @@ -1066,8 +1088,10 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid(const AttributePtr& theA AttributeSelectionPtr aCurSel = anAttrSelectionList->value(ind); GeomShapePtr aContext = aCurSel->context()->shape(); GeomShapePtr aVertex = aCurSel->value(); - // check wire already processed, if not, store all vertices and edges, sharing them - std::map::iterator aProcessed = aWireSubshapes.find(aContext); + // check wire already processed, if not, store all vertices and edges, + // sharing them + std::map::iterator aProcessed = + aWireSubshapes.find(aContext); if (aProcessed == aWireSubshapes.end()) { if (aContext->shapeType() != GeomAPI_Shape::WIRE) { theError = "Selected vertex is not a wire corner"; @@ -1079,7 +1103,7 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid(const AttributePtr& theA } GeomAlgoAPI_MapShapesAndAncestors aMapVE(aContext, GeomAPI_Shape::VERTEX, - GeomAPI_Shape::EDGE); + GeomAPI_Shape::EDGE); aWireSubshapes[aContext] = aMapVE.map(); aProcessed = aWireSubshapes.find(aContext); } @@ -1089,8 +1113,7 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid(const AttributePtr& theA if (aFound == aProcessed->second.end()) { theError = "Selected vertex does not exist in the wire"; return true; - } - else if (aFound->second.size() != 2) { + } else if (aFound->second.size() != 2) { theError = "Vertex should be shared between 2 edges exactly"; return false; } @@ -1116,50 +1139,55 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid(const AttributePtr& theA } //================================================================================================== -bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorPartitionSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!anAttrSelectionList.get()) { -// LCOV_EXCL_START - theError = "Error: This validator can only work with selection list in \"Partition\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!anAttrSelectionList.get()) { + // LCOV_EXCL_START + theError = "Error: This validator can only work with selection list in " + "\"Partition\" feature."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } - for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelectAttr = anAttrSelectionList->value(anIndex); - //GeomValidators_BodyShapes aBodyValidator; - //if(aBodyValidator.isValid(aSelectAttr, theArguments, theError)) { - // continue; - //} + // GeomValidators_BodyShapes aBodyValidator; + // if(aBodyValidator.isValid(aSelectAttr, theArguments, theError)) { + // continue; + // } GeomValidators_FeatureKind aFeatureKindValidator; - if(aFeatureKindValidator.isValid(aSelectAttr, theArguments, theError)) { + if (aFeatureKindValidator.isValid(aSelectAttr, theArguments, theError)) { continue; } ResultPtr aContext = aSelectAttr->context(); ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); - if(aResultConstruction.get()) { - theError = "Error: Only body shapes and construction planes are allowed for selection."; + std::dynamic_pointer_cast(aContext); + if (aResultConstruction.get()) { + theError = "Error: Only body shapes and construction planes are allowed " + "for selection."; return false; } - ResultBodyPtr aResultBody = std::dynamic_pointer_cast(aContext); - if(aResultBody.get()) { + ResultBodyPtr aResultBody = + std::dynamic_pointer_cast(aContext); + if (aResultBody.get()) { continue; } FeaturePtr aResultFeature = aSelectAttr->contextFeature(); - if(aResultFeature.get()) { + if (aResultFeature.get()) { bool aOkRes = false; - std::list::const_iterator aFRes = aResultFeature->results().cbegin(); - for(; aFRes != aResultFeature->results().cend() && !aOkRes; aFRes++) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(*aFRes); + std::list::const_iterator aFRes = + aResultFeature->results().cbegin(); + for (; aFRes != aResultFeature->results().cend() && !aOkRes; aFRes++) { + ResultBodyPtr aBody = + std::dynamic_pointer_cast(*aFRes); if (aBody.get() && !aBody->isDisabled()) aOkRes = true; } @@ -1167,7 +1195,8 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& the continue; } - theError = "Error: Only body shapes and construction planes are allowed for selection."; + theError = "Error: Only body shapes and construction planes are allowed " + "for selection."; return false; } @@ -1176,60 +1205,64 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& the } //================================================================================================== -bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr aSubShapesAttrList = - std::dynamic_pointer_cast(theAttribute); - if(!aSubShapesAttrList.get()) { -// LCOV_EXCL_START - theError = - "Error: This validator can only work with selection list in \"Remove Sub-Shapes\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!aSubShapesAttrList.get()) { + // LCOV_EXCL_START + theError = "Error: This validator can only work with selection list in " + "\"Remove Sub-Shapes\" feature."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } static const std::string aBaseShapeID = "base_shape"; - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeSelectionPtr aShapeAttrSelection = aFeature->selection(aBaseShapeID); - if(!aShapeAttrSelection.get()) { -// LCOV_EXCL_START + if (!aShapeAttrSelection.get()) { + // LCOV_EXCL_START theError = "Error: Could not get \"%1\" attribute."; theError.arg(aBaseShapeID); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } GeomShapePtr aBaseShape = aShapeAttrSelection->value(); ResultPtr aContext = aShapeAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { theError = "Error: Empty context."; return false; } - if(!aBaseShape.get()) { + if (!aBaseShape.get()) { aBaseShape = aContext->shape(); } - if(!aBaseShape.get()) { + if (!aBaseShape.get()) { theError = "Error: Empty base shape."; return false; } - std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - for(int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { + std::list aSubShapes = + GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); + for (int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { bool isSameFound = false; - AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesAttrList->value(anIndex); GeomShapePtr aShapeToAdd = anAttrSelectionInList->value(); - for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt) - { + for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); + anIt != aSubShapes.cend(); ++anIt) { if ((*anIt)->isEqual(aShapeToAdd)) { isSameFound = true; break; } } if (!isSameFound) { - theError = "Error: Only sub-shapes of selected shape is allowed for selection."; + theError = + "Error: Only sub-shapes of selected shape is allowed for selection."; return false; } } @@ -1239,38 +1272,39 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(const AttributePt //================================================================================================== bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { static const std::string aBaseShapeID = "base_shape"; static const std::string aSubShapesID = "subshapes_to_keep"; -// LCOV_EXCL_START - if(theFeature->getKind() != "Remove_SubShapes") { + // LCOV_EXCL_START + if (theFeature->getKind() != "Remove_SubShapes") { theError = "Error: Feature \"%1\" does not supported by this validator."; theError.arg(theFeature->getKind()); return false; } - AttributeSelectionPtr aShapeAttrSelection = theFeature->selection(aBaseShapeID); - if(!aShapeAttrSelection.get()) { + AttributeSelectionPtr aShapeAttrSelection = + theFeature->selection(aBaseShapeID); + if (!aShapeAttrSelection.get()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aBaseShapeID); return false; } - AttributeSelectionListPtr aSubShapesAttrList = theFeature->selectionList(aSubShapesID); - if(!aSubShapesAttrList.get()) { + AttributeSelectionListPtr aSubShapesAttrList = + theFeature->selectionList(aSubShapesID); + if (!aSubShapesAttrList.get()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(aSubShapesID); return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP // Copy base shape. GeomShapePtr aBaseShape = aShapeAttrSelection->value(); - if(!aBaseShape.get()) { + if (!aBaseShape.get()) { theError = "Error: Base shape is empty."; return false; } @@ -1282,14 +1316,15 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid( } // Copy sub-shapes from list to new shape. - for(int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); + for (int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aSubShapesAttrList->value(anIndex); GeomShapePtr aShapeToAdd = anAttrSelectionInList->value(); GeomAlgoAPI_ShapeBuilder::add(aResultShape, aShapeToAdd); } // Check new shape. - if(!GeomAlgoAPI_ShapeTools::isShapeValid(aResultShape)) { + if (!GeomAlgoAPI_ShapeTools::isShapeValid(aResultShape)) { theError = "Error: Resulting shape is not valid."; return false; } @@ -1299,20 +1334,22 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid( //================================================================================================== // LCOV_EXCL_START -bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorUnionSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr aBaseObjectsAttrList = - std::dynamic_pointer_cast(theAttribute); - if(!aBaseObjectsAttrList.get()) { - theError = "Error: This validator can only work with selection list in \"%1\" feature."; + std::dynamic_pointer_cast(theAttribute); + if (!aBaseObjectsAttrList.get()) { + theError = "Error: This validator can only work with selection list in " + "\"%1\" feature."; theError.arg(FeaturesPlugin_Union::ID()); return false; } - for(int anIndex = 0; anIndex < aBaseObjectsAttrList->size(); ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aBaseObjectsAttrList->value(anIndex); + for (int anIndex = 0; anIndex < aBaseObjectsAttrList->size(); ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aBaseObjectsAttrList->value(anIndex); ResultPtr aContext = anAttrSelectionInList->context(); if (!aContext.get()) { theError = "Error: selection is invalid."; @@ -1320,26 +1357,27 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr } ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aContext); - if(aConstruction.get()) { + std::dynamic_pointer_cast(aContext); + if (aConstruction.get()) { theError = "Error: Result construction not allowed for selection."; return false; } GeomShapePtr aShape = anAttrSelectionInList->value(); GeomShapePtr aContextShape = aContext->shape(); - if (aShape.get() && aContextShape.get() && !aContextShape->isEqual(aShape)) { + if (aShape.get() && aContextShape.get() && + !aContextShape->isEqual(aShape)) { theError = "Error: Local selection not allowed."; return false; } ResultBodyPtr aResult = - std::dynamic_pointer_cast(aContext); - if(!aResult.get()) { + std::dynamic_pointer_cast(aContext); + if (!aResult.get()) { continue; } - if(aResult->numberOfSubs() > 0) { + if (aResult->numberOfSubs() > 0) { theError = "Error: Whole compsolids not allowed for selection."; return false; } @@ -1351,13 +1389,12 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr //================================================================================================== bool FeaturesPlugin_ValidatorUnionArguments::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START // Check feature kind. - if(theFeature->getKind() != FeaturesPlugin_Union::ID()) { + if (theFeature->getKind() != FeaturesPlugin_Union::ID()) { theError = "Error: This validator supports only \"%1\" feature."; theError.arg(FeaturesPlugin_Union::ID()); return false; @@ -1365,34 +1402,38 @@ bool FeaturesPlugin_ValidatorUnionArguments::isValid( // Get base objects attribute list. AttributeSelectionListPtr aBaseObejctsAttrList = - theFeature->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); - if(!aBaseObejctsAttrList.get()) { + theFeature->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); + if (!aBaseObejctsAttrList.get()) { theError = "Error: Could not get \"%1\" attribute."; theError.arg(FeaturesPlugin_Union::BASE_OBJECTS_ID()); return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP // Get all shapes. GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::COMPSOLID; ListOfShape aBaseShapesList; - for(int anIndex = 0; anIndex < aBaseObejctsAttrList->size(); ++anIndex) { - AttributeSelectionPtr anAttrSelectionInList = aBaseObejctsAttrList->value(anIndex); + for (int anIndex = 0; anIndex < aBaseObejctsAttrList->size(); ++anIndex) { + AttributeSelectionPtr anAttrSelectionInList = + aBaseObejctsAttrList->value(anIndex); GeomShapePtr aShape = anAttrSelectionInList->value(); if (!aShape.get()) { continue; } aBaseShapesList.push_back(aShape); - aType = aShape->shapeType() == GeomAPI_Shape::FACE ? GeomAPI_Shape::SHELL : - GeomAPI_Shape::COMPSOLID; + aType = aShape->shapeType() == GeomAPI_Shape::FACE + ? GeomAPI_Shape::SHELL + : GeomAPI_Shape::COMPSOLID; } // Make compound and find connected. - GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseShapesList); + GeomShapePtr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aBaseShapesList); ListOfShape aResults; GeomAlgoAPI_ShapeTools::combineShapes(aCompound, aType, aResults); - if(aResults.size() > 1 || (aResults.size() == 1 && aResults.front()->shapeType() > aType)) { + if (aResults.size() > 1 || + (aResults.size() == 1 && aResults.front()->shapeType() > aType)) { theError = "Error: Not all shapes have shared topology."; return false; } @@ -1400,32 +1441,33 @@ bool FeaturesPlugin_ValidatorUnionArguments::isValid( return true; } -bool FeaturesPlugin_ValidatorConcealedResult::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorConcealedResult::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } - AttributeReferencePtr aRefAttribute = std::dynamic_pointer_cast - (theAttribute); + AttributeReferencePtr aRefAttribute = + std::dynamic_pointer_cast(theAttribute); ObjectPtr aRefObject = aRefAttribute->value(); if (!aRefObject.get()) { theError = "Error: Empty feature."; return false; } - FeaturePtr aRefFeature = std::dynamic_pointer_cast(aRefObject); + FeaturePtr aRefFeature = + std::dynamic_pointer_cast(aRefObject); if (!aRefFeature.get()) { theError = "Error: Empty feature."; return false; } - std::list > aResults; + std::list> aResults; ModelAPI_Tools::getConcealedResults(aRefFeature, aResults); size_t aConcealedResults = aResults.size(); @@ -1435,7 +1477,7 @@ bool FeaturesPlugin_ValidatorConcealedResult::isValid(const AttributePtr& theAtt std::string aRecoveredList = *anIt; if (!aRecoveredList.empty()) { std::shared_ptr aParameterList = - theAttribute->owner()->data()->reflist(aRecoveredList); + theAttribute->owner()->data()->reflist(aRecoveredList); if (aParameterList.get()) aConcealedResults = aParameterList->size(); } @@ -1447,15 +1489,16 @@ bool FeaturesPlugin_ValidatorConcealedResult::isValid(const AttributePtr& theAtt return theError.empty(); } -bool FeaturesPlugin_ValidatorCircular::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorCircular::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { static std::list aEdgeArg(1, "circle"); static std::list aFaceArg(1, "cylinder"); Events_InfoMessage aError; - bool isValid = GeomValidators_ShapeType().isValid(theAttribute, aEdgeArg, aError); + bool isValid = + GeomValidators_ShapeType().isValid(theAttribute, aEdgeArg, aError); if (!isValid) { isValid = GeomValidators_Face().isValid(theAttribute, aFaceArg, aError); if (!isValid) @@ -1466,49 +1509,40 @@ bool FeaturesPlugin_ValidatorCircular::isValid(const AttributePtr& theAttribute, //================================================================================================= bool FeaturesPlugin_ValidatorBooleanArguments::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START - if (theArguments.size() != 2) - { + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START + if (theArguments.size() != 2) { theError = "Wrong number of arguments (expected 2)."; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP - int anObjectsToolsNb[2] = { 0, 0 }; + int anObjectsToolsNb[2] = {0, 0}; - std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anIt = theArguments.begin(), + aLast = theArguments.end(); bool isAllInSameCompSolid = true; ResultBodyPtr aCompSolid; - for (int* anArgNbIt = anObjectsToolsNb; anIt != aLast; ++anIt, ++anArgNbIt) { + for (int *anArgNbIt = anObjectsToolsNb; anIt != aLast; ++anIt, ++anArgNbIt) { AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt); - if (anAttrSelList) - { + if (anAttrSelList) { *anArgNbIt = anAttrSelList->size(); if (isAllInSameCompSolid) { - for (int anIndex = 0; anIndex < *anArgNbIt; ++anIndex) - { + for (int anIndex = 0; anIndex < *anArgNbIt; ++anIndex) { AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex); ResultPtr aContext = anAttr->context(); ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext); - if (aResCompSolidPtr.get()) - { - if (aCompSolid.get()) - { + if (aResCompSolidPtr.get()) { + if (aCompSolid.get()) { isAllInSameCompSolid = aCompSolid == aResCompSolidPtr; - } - else - { + } else { aCompSolid = aResCompSolidPtr; } - } - else - { + } else { isAllInSameCompSolid = false; break; } @@ -1518,25 +1552,21 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid( } std::shared_ptr aFeature = - std::dynamic_pointer_cast(theFeature); - FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType(); + std::dynamic_pointer_cast(theFeature); + FeaturesPlugin_Boolean::OperationType anOperationType = + aFeature->operationType(); - if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) - { + if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) { // Fuse operation - if (anObjectsToolsNb[0] + anObjectsToolsNb[1] < 2) - { + if (anObjectsToolsNb[0] + anObjectsToolsNb[1] < 2) { theError = "Not enough arguments for Fuse operation."; return false; - } - else if (isAllInSameCompSolid) - { - theError = "Operations only between sub-shapes of the same shape not allowed."; + } else if (isAllInSameCompSolid) { + theError = + "Operations only between sub-shapes of the same shape not allowed."; return false; } - } - else - { + } else { if (anObjectsToolsNb[0] < 1) // check number of objects { theError = "Objects not selected."; @@ -1547,9 +1577,9 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid( theError = "Tools not selected."; return false; } - if (isAllInSameCompSolid) - { - theError = "Operations only between sub-shapes of the same shape not allowed."; + if (isAllInSameCompSolid) { + theError = + "Operations only between sub-shapes of the same shape not allowed."; return false; } } @@ -1559,11 +1589,9 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid( //================================================================================================= // LCOV_EXCL_START -bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory(std::string theFeature, - std::string theAttribute) -{ - if (theAttribute == "main_objects" || theAttribute == "tool_objects") - { +bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory( + std::string theFeature, std::string theAttribute) { + if (theAttribute == "main_objects" || theAttribute == "tool_objects") { return true; } @@ -1573,30 +1601,29 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory(std::string theFe //================================================================================================== bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::shared_ptr aFeature = - std::dynamic_pointer_cast(theAttribute->owner()); + std::dynamic_pointer_cast( + theAttribute->owner()); AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!aFeature.get() || !anAttrSelectionList.get()) { -// LCOV_EXCL_START - theError = - "Error: Validator used in wrong feature or attribute"; + // LCOV_EXCL_START + theError = "Error: Validator used in wrong feature or attribute"; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } AttributeSelectionListPtr anOtherAttrSelectionList; if (theAttribute->id() == FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID()) { anOtherAttrSelectionList = - aFeature->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID()); + aFeature->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID()); } else { anOtherAttrSelectionList = - aFeature->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID()); + aFeature->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID()); } GeomAPI_Shape::ShapeType aSelectedShapesType = GeomAPI_Shape::SHAPE; @@ -1604,7 +1631,8 @@ bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid( GeomPlanePtr aFacesPln; for (int anIndex = 0; anIndex < anOtherAttrSelectionList->size(); ++anIndex) { - AttributeSelectionPtr anAttrSelection = anOtherAttrSelectionList->value(anIndex); + AttributeSelectionPtr anAttrSelection = + anOtherAttrSelectionList->value(anIndex); if (anAttrSelection->contextFeature().get()) { theError = "Error: Features not allowed for selection."; @@ -1649,16 +1677,17 @@ bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid( } ResultPtr aContext = anAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { FeaturePtr aContFeat = anAttrSelection->contextFeature(); if (!aContFeat.get() || !aContFeat->results().size() || - aContFeat->firstResult()->groupName() != ModelAPI_ResultBody::group()) { + aContFeat->firstResult()->groupName() != + ModelAPI_ResultBody::group()) { theError = "Error: Empty selection context."; return false; } } ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); + std::dynamic_pointer_cast(aContext); if (aResultConstruction.get()) { theError = "Error: Result construction not allowed for selection."; return false; @@ -1719,17 +1748,18 @@ bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid( //================================================================================================== // LCOV_EXCL_START -bool FeaturesPlugin_IntersectionSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_IntersectionSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (!theAttribute.get()) { theError = "Error: empty selection."; return false; } - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); for (int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); if (!anAttrSelection.get()) { @@ -1742,7 +1772,8 @@ bool FeaturesPlugin_IntersectionSelection::isValid(const AttributePtr& theAttrib } else { aFeature = anAttrSelection->contextFeature(); if (!aFeature.get() || !aFeature->results().size() || - aFeature->firstResult()->groupName() != ModelAPI_ResultBody::group()) { + aFeature->firstResult()->groupName() != + ModelAPI_ResultBody::group()) { theError = "Error: Empty selection context."; return false; } @@ -1752,8 +1783,7 @@ bool FeaturesPlugin_IntersectionSelection::isValid(const AttributePtr& theAttrib return false; } std::string aFeatureKind = aFeature->getKind(); - if (aFeatureKind == "Sketch" || - aFeatureKind == "Plane" || + if (aFeatureKind == "Sketch" || aFeatureKind == "Plane" || aFeatureKind == "Axis") { theError = "Error: %1 shape is not allowed for selection."; theError.arg(aFeatureKind); @@ -1792,15 +1822,14 @@ bool FeaturesPlugin_IntersectionSelection::isValid(const AttributePtr& theAttrib //================================================================================================== // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanFuseSelection::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!anAttrSelectionList.get()) { - theError = - "Error: This validator can only work with selection list attributes in \"Boolean\" feature."; + theError = "Error: This validator can only work with selection list " + "attributes in \"Boolean\" feature."; return false; } @@ -1811,16 +1840,17 @@ bool FeaturesPlugin_ValidatorBooleanFuseSelection::isValid( return false; } ResultPtr aContext = anAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { FeaturePtr aContFeat = anAttrSelection->contextFeature(); if (!aContFeat.get() || !aContFeat->results().size() || - aContFeat->firstResult()->groupName() != ModelAPI_ResultBody::group()) { + aContFeat->firstResult()->groupName() != + ModelAPI_ResultBody::group()) { theError = "Error: Empty selection context."; return false; } } ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); + std::dynamic_pointer_cast(aContext); if (aResultConstruction.get()) { theError = "Error: Result construction not allowed for selection."; return false; @@ -1846,19 +1876,18 @@ bool FeaturesPlugin_ValidatorBooleanFuseSelection::isValid( //================================================================================================= bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START if (theArguments.size() != 2) { theError = "Wrong number of arguments (expected 2)."; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP std::shared_ptr aFeature = - std::dynamic_pointer_cast(theFeature); + std::dynamic_pointer_cast(theFeature); int anObjectsNb = 0, aToolsNb = 0; @@ -1888,8 +1917,8 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( } anIt++; - if (aFeature->string(FeaturesPlugin_BooleanFuse::CREATION_METHOD())->value() - == FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED()) { + if (aFeature->string(FeaturesPlugin_BooleanFuse::CREATION_METHOD()) + ->value() == FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED()) { anAttrSelList = theFeature->selectionList(*anIt); if (anAttrSelList) { aToolsNb = anAttrSelList->size(); @@ -1924,9 +1953,7 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( //================================================================================================= // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanFuseArguments::isNotObligatory( - std::string theFeature, - std::string theAttribute) -{ + std::string theFeature, std::string theAttribute) { if (theAttribute == "main_objects" || theAttribute == "tool_objects") { return true; } @@ -1938,15 +1965,14 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isNotObligatory( //================================================================================================== // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!anAttrSelectionList.get()) { - theError = - "Error: This validator can only work with selection list attributes in \"Boolean\" feature."; + theError = "Error: This validator can only work with selection list " + "attributes in \"Boolean\" feature."; return false; } @@ -1962,7 +1988,7 @@ bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid( return false; } ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); + std::dynamic_pointer_cast(aContext); if (aResultConstruction.get()) { if (theAttribute->id() != FeaturesPlugin_BooleanCommon::TOOL_LIST_ID()) { theError = "Error: Result construction not allowed for selection."; @@ -1986,7 +2012,8 @@ bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid( return false; } - if (aResultConstruction.get() && aShape->shapeType() != GeomAPI_Shape::FACE) { + if (aResultConstruction.get() && + aShape->shapeType() != GeomAPI_Shape::FACE) { theError = "Error: Result construction should be plane."; return false; } @@ -1998,19 +2025,18 @@ bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid( //================================================================================================= bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theArguments.size() != 2) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Wrong number of arguments (expected 2)."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } std::shared_ptr aFeature = - std::dynamic_pointer_cast(theFeature); + std::dynamic_pointer_cast(theFeature); int anObjectsNb = 0, aToolsNb = 0; @@ -2023,8 +2049,9 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( anObjectsNb = anAttrSelList->size(); } - bool isSimpleMode = aFeature->string(FeaturesPlugin_BooleanCommon::CREATION_METHOD())->value() - == FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(); + bool isSimpleMode = + aFeature->string(FeaturesPlugin_BooleanCommon::CREATION_METHOD()) + ->value() == FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(); if (!isSimpleMode) { anAttrSelList = theFeature->selectionList(*anIt); @@ -2033,8 +2060,8 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( } } - if ((isSimpleMode && anObjectsNb < 2) - || (!isSimpleMode && (anObjectsNb == 0 || aToolsNb == 0))) { + if ((isSimpleMode && anObjectsNb < 2) || + (!isSimpleMode && (anObjectsNb == 0 || aToolsNb == 0))) { theError = "Not enough arguments for Common operation."; return false; } @@ -2044,24 +2071,22 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( //================================================================================================= // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanCommonArguments::isNotObligatory( - std::string theFeature, - std::string theAttribute) -{ + std::string theFeature, std::string theAttribute) { return false; } // LCOV_EXCL_STOP //================================================================================================== bool FeaturesPlugin_ValidatorDefeaturingSelection::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); if (!anAttrSelectionList.get()) { // LCOV_EXCL_START - theError = "Error: This validator can only work with selection list attributes."; + theError = + "Error: This validator can only work with selection list attributes."; return false; // LCOV_EXCL_STOP } @@ -2099,14 +2124,15 @@ bool FeaturesPlugin_ValidatorDefeaturingSelection::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorSewingSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorSewingSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); if (!anAttrSelectionList.get()) { - theError = "Error: This validator can only work with selection list attributes."; + theError = + "Error: This validator can only work with selection list attributes."; return false; } @@ -2144,21 +2170,21 @@ bool FeaturesPlugin_ValidatorSewingSelection::isValid(const AttributePtr& theAtt theError = "Error: Selected shape has the wrong type."; return false; } - } return true; } //================================================================================================== -bool FeaturesPlugin_ValidatorGlueFacesSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool FeaturesPlugin_ValidatorGlueFacesSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); if (!anAttrSelectionList.get()) { - theError = "Error: This validator can only work with selection list attributes."; + theError = + "Error: This validator can only work with selection list attributes."; return false; } @@ -2196,7 +2222,6 @@ bool FeaturesPlugin_ValidatorGlueFacesSelection::isValid(const AttributePtr& the theError = "Error: Selected shape has the wrong type."; return false; } - } return true; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index 2a49e530a..f86f56bb3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Validators_H_ @@ -26,476 +27,481 @@ /// \class FeaturesPlugin_ValidatorPipePath /// \ingroup Validators /// \brief A validator for selection pipe path. -class FeaturesPlugin_ValidatorPipePath: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorPipePath : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorPipeLocations /// \ingroup Validators /// \brief A validator for selection pipe locations. -class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorPipeLocations + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorPipeLocationsNumber /// \ingroup Validators /// \brief Validator for the pipe locations. -class FeaturesPlugin_ValidatorPipeLocationsNumber: public ModelAPI_FeatureValidator -{ - public: - //! \return true if number of selected locations the same as number of selected bases, or empty. - //! \param theFeature the checked feature - //! \param theArguments arguments of the feature (not used) - //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; +class FeaturesPlugin_ValidatorPipeLocationsNumber + : public ModelAPI_FeatureValidator { +public: + //! \return true if number of selected locations the same as number of + //! selected bases, or empty. \param theFeature the checked feature \param + //! theArguments arguments of the feature (not used) \param theError error + //! message + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorLoftSameTypeShape /// \ingroup Validators /// \brief Validator for the same type of shape. -class FeaturesPlugin_ValidatorLoftSameTypeShape: public ModelAPI_FeatureValidator -{ - public: +class FeaturesPlugin_ValidatorLoftSameTypeShape + : public ModelAPI_FeatureValidator { +public: //! \return true if the type of selected are the same //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorBaseForGeneration /// \ingroup Validators -/// \brief A validator for selection base for generation. Allows to select faces on sketch, -/// whole sketch (if it has at least one face), and following objects: vertex, edge, wire, face. -class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator -{ +/// \brief A validator for selection base for generation. Allows to select faces +/// on sketch, whole sketch (if it has at least one face), and following +/// objects: vertex, edge, wire, face. +class FeaturesPlugin_ValidatorBaseForGeneration + : public ModelAPI_AttributeValidator { public: - //! \return true if attribute has selection type listed in the parameter arguments. - //! \param[in] theAttribute the checked attribute. - //! \param[in] theArguments arguments of the attribute. - //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + //! \return true if attribute has selection type listed in the parameter + //! arguments. \param[in] theAttribute the checked attribute. \param[in] + //! theArguments arguments of the attribute. \param[out] theError error + //! message. + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; private: - bool isValidAttribute(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + bool isValidAttribute(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects /// \ingroup Validators -/// \brief Validator for the base objects for generation. Checks that sketch and it objects +/// \brief Validator for the base objects for generation. Checks that sketch and +/// it objects /// are not selected at the same time. -class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects: - public ModelAPI_FeatureValidator -{ - public: +class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects + : public ModelAPI_FeatureValidator { +public: //! \return true if sketch and it objects not selected at the same time. //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorCompositeLauncher /// \ingroup Validators /// \brief A validator for selection at composite feature start -class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorCompositeLauncher + : public ModelAPI_AttributeValidator { public: - //! \return true if attribute has selection type listed in the parameter arguments. - //! \param[in] theAttribute the checked attribute. - //! \param[in] theArguments arguments of the attribute. - //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + //! \return true if attribute has selection type listed in the parameter + //! arguments. \param[in] theAttribute the checked attribute. \param[in] + //! theArguments arguments of the attribute. \param[out] theError error + //! message. + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorExtrusionDir /// \ingroup Validators -/// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are +/// \brief A validator for extrusion direction attribute. Allows it to be empty +/// if base objects are /// planar and do not contain vertices and edges. -class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator -{ +class FeaturesPlugin_ValidatorExtrusionDir : public ModelAPI_FeatureValidator { public: //! \return true if attribute listed in the parameter arguments are planar. //! \param[in] theFeature the checked feature. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; private: - bool isShapesCanBeEmpty(const AttributePtr& theAttribute, - Events_InfoMessage& theError) const; + bool isShapesCanBeEmpty(const AttributePtr &theAttribute, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorExtrusionBoundaryFace /// \ingroup Validators /// \brief A validator for extrusion from/to face attribute. -class FeaturesPlugin_ValidatorExtrusionBoundaryFace: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorExtrusionBoundaryFace + : public ModelAPI_AttributeValidator { public: //! \return true if attribute listed in the parameter arguments are planar. //! \param[in] theFeature the checked feature. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorBooleanSelection /// \ingroup Validators /// \brief Validates selection for boolean operation. -class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorBooleanSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for boolean operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorFilletSelection /// \ingroup Validators /// \brief Validates selection for fillet operation. -class FeaturesPlugin_ValidatorFilletSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorFilletSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for boolean operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorFillet1DSelection /// \ingroup Validators /// \brief Validates selection for 1d-fillet operation. -class FeaturesPlugin_ValidatorFillet1DSelection : public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorFillet1DSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for fillet on wire (vertex is a sharp corner). /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorPartitionSelection /// \ingroup Validators /// \brief Validates selection for partition. -class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorPartitionSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection /// \ingroup Validators /// \brief Validates selection for "Remove Sub-Shapes" feature. -class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorRemoveSubShapesSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult /// \ingroup Validators /// \brief Validator for the Remove Sub-Shapes feature. -class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator -{ - public: +class FeaturesPlugin_ValidatorRemoveSubShapesResult + : public ModelAPI_FeatureValidator { +public: //! \return true if result is valid shape. //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorUnionSelection /// \ingroup Validators /// \brief Validates selection for "Union" feature. -class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorUnionSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorUnionArguments /// \ingroup Validators /// \brief Validator for the "Union" feature. -class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator -{ - public: +class FeaturesPlugin_ValidatorUnionArguments + : public ModelAPI_FeatureValidator { +public: //! \return true if result is valid shape. //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorConcealedResult /// \ingroup Validators /// \brief Validator for the "Recover" feature. -class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator -{ - public: +class FeaturesPlugin_ValidatorConcealedResult + : public ModelAPI_AttributeValidator { +public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorCircular /// \ingroup Validators /// \brief Verifies the selected object is circular edge or cylindrical face -class FeaturesPlugin_ValidatorCircular : public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorCircular : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /** \class FeaturesPlugin_ValidatorBooleanArguments -* \ingroup Validators -* \brief Validates that boolean operation have enough arguments. -*/ -class FeaturesPlugin_ValidatorBooleanArguments: public ModelAPI_FeatureValidator -{ + * \ingroup Validators + * \brief Validates that boolean operation have enough arguments. + */ +class FeaturesPlugin_ValidatorBooleanArguments + : public ModelAPI_FeatureValidator { public: /** \brief Returns true if feature and/or attributes are valid. - * \param[in] theFeature the validated feature. - * \param[in] theArguments the arguments in the configuration file for this validator. - * \param[out] theError error message. - * \returns true if feature is valid. - */ - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; - - /// \return true if the attribute in feature is not obligatory for the feature execution. - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + * \param[in] theFeature the validated feature. + * \param[in] theArguments the arguments in the configuration file for this + * validator. \param[out] theError error message. \returns true if feature is + * valid. + */ + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; + + /// \return true if the attribute in feature is not obligatory for the feature + /// execution. + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; /// \class FeaturesPlugin_ValidatorBooleanSmashSelection /// \ingroup Validators /// \brief Verifies the selected object for boolean smash feature -class FeaturesPlugin_ValidatorBooleanSmashSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorBooleanSmashSelection + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_IntersectionSelection /// \ingroup Validators /// \brief Verifies the selected object for intersection feature -class FeaturesPlugin_IntersectionSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_IntersectionSelection + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorBooleanFuseSelection /// \ingroup Validators /// \brief Verifies the selected object for boolean fuse feature -class FeaturesPlugin_ValidatorBooleanFuseSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorBooleanFuseSelection + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /** \class FeaturesPlugin_ValidatorBooleanFuseArguments -* \ingroup Validators -* \brief Validates that boolean operation have enough arguments. -*/ -class FeaturesPlugin_ValidatorBooleanFuseArguments: public ModelAPI_FeatureValidator -{ + * \ingroup Validators + * \brief Validates that boolean operation have enough arguments. + */ +class FeaturesPlugin_ValidatorBooleanFuseArguments + : public ModelAPI_FeatureValidator { public: /** \brief Returns true if feature and/or attributes are valid. - * \param[in] theFeature the validated feature. - * \param[in] theArguments the arguments in the configuration file for this validator. - * \param[out] theError error message. - * \returns true if feature is valid. - */ - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; - - /// \return true if the attribute in feature is not obligatory for the feature execution. - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + * \param[in] theFeature the validated feature. + * \param[in] theArguments the arguments in the configuration file for this + * validator. \param[out] theError error message. \returns true if feature is + * valid. + */ + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; + + /// \return true if the attribute in feature is not obligatory for the feature + /// execution. + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; /// \class FeaturesPlugin_ValidatorBooleanCommonSelection /// \ingroup Validators /// \brief Verifies the selected object for boolean common feature -class FeaturesPlugin_ValidatorBooleanCommonSelection: public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorBooleanCommonSelection + : public ModelAPI_AttributeValidator { public: //! \return True if the attribute is valid. //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /** \class FeaturesPlugin_ValidatorBooleanCommonArguments -* \ingroup Validators -* \brief Validates that boolean operation have enough arguments. -*/ -class FeaturesPlugin_ValidatorBooleanCommonArguments: public ModelAPI_FeatureValidator -{ + * \ingroup Validators + * \brief Validates that boolean operation have enough arguments. + */ +class FeaturesPlugin_ValidatorBooleanCommonArguments + : public ModelAPI_FeatureValidator { public: /** \brief Returns true if feature and/or attributes are valid. - * \param[in] theFeature the validated feature. - * \param[in] theArguments the arguments in the configuration file for this validator. - * \param[out] theError error message. - * \returns true if feature is valid. - */ - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; - - /// \return true if the attribute in feature is not obligatory for the feature execution. - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + * \param[in] theFeature the validated feature. + * \param[in] theArguments the arguments in the configuration file for this + * validator. \param[out] theError error message. \returns true if feature is + * valid. + */ + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; + + /// \return true if the attribute in feature is not obligatory for the feature + /// execution. + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; /// \class FeaturesPlugin_ValidatorDefeaturingSelection /// \ingroup Validators /// \brief Validates selection for fillet operation. -class FeaturesPlugin_ValidatorDefeaturingSelection : public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorDefeaturingSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for boolean operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorSewingSelection /// \ingroup Validators /// \brief Validates selection for sewing operation. -class FeaturesPlugin_ValidatorSewingSelection : public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorSewingSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for sewing operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /// \class FeaturesPlugin_ValidatorGlueFacesSelection /// \ingroup Validators /// \brief Validates selection for glue faces operation. -class FeaturesPlugin_ValidatorGlueFacesSelection : public ModelAPI_AttributeValidator -{ +class FeaturesPlugin_ValidatorGlueFacesSelection + : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is acceptable for glue faces operation. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp index 73a7a4b64..012534451 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp @@ -14,21 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_VersionedBoolean.h" +#include +#include +#include #include #include -#include -#include #include -#include #include -#include #include +#include +#include +#include +#include #include #include #include @@ -39,21 +43,15 @@ #include #include #include -#include -#include -#include #include #include - //================================================================================================= static void performBoolean(const GeomAlgoAPI_Tools::BOPType theBooleanType, - GeomMakeShapePtr& theBooleanAlgo, - const ListOfShape& theObjects, - const ListOfShape& theTools, - const double theFuzzy) -{ + GeomMakeShapePtr &theBooleanAlgo, + const ListOfShape &theObjects, + const ListOfShape &theTools, const double theFuzzy) { if (theBooleanType == GeomAlgoAPI_Tools::BOOL_PARTITION) theBooleanAlgo.reset(new GeomAlgoAPI_Partition(theObjects, theTools)); else { @@ -65,26 +63,26 @@ static void performBoolean(const GeomAlgoAPI_Tools::BOPType theBooleanType, ListOfShape anObjects = theObjects; ListOfShape aTools; aTools.splice(aTools.begin(), anObjects, anObjects.begin()); - theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(anObjects, aTools, theBooleanType, theFuzzy)); + theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(anObjects, aTools, + theBooleanType, theFuzzy)); } - } - else - theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(theObjects, theTools, theBooleanType, theFuzzy)); + } else + theBooleanAlgo.reset(new GeomAlgoAPI_Boolean(theObjects, theTools, + theBooleanType, theFuzzy)); } } //================================================================================================= -void FeaturesPlugin_VersionedBoolean::initVersion(const std::string& theVersion, - const AttributePtr theObjectsAttr, - const AttributePtr theToolsAttr) -{ +void FeaturesPlugin_VersionedBoolean::initVersion( + const std::string &theVersion, const AttributePtr theObjectsAttr, + const AttributePtr theToolsAttr) { AttributeIntegerPtr anOldVersionAttr = integer("version"); - if (anOldVersionAttr && anOldVersionAttr->isInitialized() && data()->version().empty()) { + if (anOldVersionAttr && anOldVersionAttr->isInitialized() && + data()->version().empty()) { // move value to the common version interface in ModelAPI_Data data()->setVersion(BOP_VERSION_9_4()); - } - else if ((!theObjectsAttr || !theObjectsAttr->isInitialized()) && - (!theToolsAttr || !theToolsAttr->isInitialized())) { + } else if ((!theObjectsAttr || !theObjectsAttr->isInitialized()) && + (!theToolsAttr || !theToolsAttr->isInitialized())) { // this is a newly created feature (not read from file), // so, initialize the latest version data()->setVersion(theVersion); @@ -92,13 +90,14 @@ void FeaturesPlugin_VersionedBoolean::initVersion(const std::string& theVersion, } //================================================================================================= -bool FeaturesPlugin_VersionedBoolean::processAttribute(const std::string& theAttributeName, - GeomAPI_ShapeHierarchy& theObjects, - ListOfShape& thePlanesList) -{ +bool FeaturesPlugin_VersionedBoolean::processAttribute( + const std::string &theAttributeName, GeomAPI_ShapeHierarchy &theObjects, + ListOfShape &thePlanesList) { AttributeSelectionListPtr anObjectsSelList = selectionList(theAttributeName); - for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + anObjectsIndex++) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); GeomShapePtr anObject = anObjectAttr->value(); if (!anObject.get()) { // It could be a construction plane. @@ -122,18 +121,14 @@ bool FeaturesPlugin_VersionedBoolean::processAttribute(const std::string& theAtt //================================================================================================= bool FeaturesPlugin_VersionedBoolean::processObject( const GeomAlgoAPI_Tools::BOPType theBooleanType, - const GeomShapePtr& theObject, - const ListOfShape& theTools, - const ListOfShape& thePlanes, - const double theFuzzy, - int& theResultIndex, - std::vector& theResultBaseAlgoList, - ListOfShape& theResultShapesList, - GeomShapePtr theResultCompound) -{ + const GeomShapePtr &theObject, const ListOfShape &theTools, + const ListOfShape &thePlanes, const double theFuzzy, int &theResultIndex, + std::vector &theResultBaseAlgoList, + ListOfShape &theResultShapesList, GeomShapePtr theResultCompound) { ListOfShape aListWithObject; aListWithObject.push_back(theObject); - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); std::shared_ptr aBoolAlgo; GeomShapePtr aResShape; @@ -141,19 +136,20 @@ bool FeaturesPlugin_VersionedBoolean::processObject( ListOfShape aToolsWithPlanes = theTools; ListOfShape aPlanesCopy = thePlanes; resizePlanes(aListWithObject, aPlanesCopy, aMakeShapeList); - aToolsWithPlanes.insert(aToolsWithPlanes.end(), aPlanesCopy.begin(), aPlanesCopy.end()); + aToolsWithPlanes.insert(aToolsWithPlanes.end(), aPlanesCopy.begin(), + aPlanesCopy.end()); if (theBooleanType == GeomAlgoAPI_Tools::BOOL_PARTITION) - aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes, theFuzzy)); + aBoolAlgo.reset( + new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes, theFuzzy)); else - aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject, - aToolsWithPlanes, - theBooleanType, - theFuzzy)); + aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject, aToolsWithPlanes, + theBooleanType, theFuzzy)); // Checking that the algorithm worked properly. std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), + anError)) { setError(anError); return false; } @@ -179,29 +175,27 @@ bool FeaturesPlugin_VersionedBoolean::processObject( std::shared_ptr aResultBody; if (theResultCompound) { // store BOP result to the compound - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder); aBuilder->add(theResultCompound, aResShape); aMakeShapeList->appendAlgo(aBuilder); - } - else { // create a separate ResultBody + } else { // create a separate ResultBody aResultBody = document()->createBody(data(), theResultIndex); - // tools should be added to the list to fulfill the correct history of modification - aListWithObject.insert(aListWithObject.end(), theTools.begin(), theTools.end()); + // tools should be added to the list to fulfill the correct history of + // modification + aListWithObject.insert(aListWithObject.end(), theTools.begin(), + theTools.end()); ListOfShape aUsedTools = theTools; aUsedTools.insert(aUsedTools.end(), thePlanes.begin(), thePlanes.end()); - ModelAPI_Tools::loadModifiedShapes(aResultBody, - aListWithObject, - aUsedTools, - aMakeShapeList, - aResShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, aListWithObject, + aUsedTools, aMakeShapeList, aResShape); setResult(aResultBody, theResultIndex); ++theResultIndex; } - ModelAPI_Tools::ResultBaseAlgo aRBA; aRBA.resultBody = aResultBody; aRBA.baseShape = theObject; @@ -215,34 +209,34 @@ bool FeaturesPlugin_VersionedBoolean::processObject( //================================================================================================= bool FeaturesPlugin_VersionedBoolean::processCompsolid( const GeomAlgoAPI_Tools::BOPType theBooleanType, - GeomAPI_ShapeHierarchy& theCompsolidHierarchy, - const GeomShapePtr& theCompsolid, - const ListOfShape& theTools, - const ListOfShape& thePlanes, - const double theFuzzy, - int& theResultIndex, - std::vector& theResultBaseAlgoList, - ListOfShape& theResultShapesList, - GeomShapePtr theResultCompound) -{ + GeomAPI_ShapeHierarchy &theCompsolidHierarchy, + const GeomShapePtr &theCompsolid, const ListOfShape &theTools, + const ListOfShape &thePlanes, const double theFuzzy, int &theResultIndex, + std::vector &theResultBaseAlgoList, + ListOfShape &theResultShapesList, GeomShapePtr theResultCompound) { ListOfShape aUsedInOperationSolids; ListOfShape aNotUsedSolids; - theCompsolidHierarchy.splitCompound(theCompsolid, aUsedInOperationSolids, aNotUsedSolids); + theCompsolidHierarchy.splitCompound(theCompsolid, aUsedInOperationSolids, + aNotUsedSolids); - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); // Resize planes. ListOfShape aToolsWithPlanes = theTools; ListOfShape aPlanesCopy = thePlanes; resizePlanes(aUsedInOperationSolids, aPlanesCopy, aMakeShapeList); - aToolsWithPlanes.insert(aToolsWithPlanes.end(), aPlanesCopy.begin(), aPlanesCopy.end()); + aToolsWithPlanes.insert(aToolsWithPlanes.end(), aPlanesCopy.begin(), + aPlanesCopy.end()); std::shared_ptr aBoolAlgo; - performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationSolids, aToolsWithPlanes, theFuzzy); + performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationSolids, + aToolsWithPlanes, theFuzzy); // Checking that the algorithm worked properly. std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), + anError)) { setError(anError); return false; } @@ -269,31 +263,30 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid( } GeomAPI_ShapeIterator aShapeIt(aResultShape); - if (aShapeIt.more() || aResultShape->shapeType() == GeomAPI_Shape::VERTEX) - { + if (aShapeIt.more() || aResultShape->shapeType() == GeomAPI_Shape::VERTEX) { std::shared_ptr aResultBody; if (theResultCompound) { // store BOP result to the compound - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder); aBuilder->add(theResultCompound, aResultShape); aMakeShapeList->appendAlgo(aBuilder); - } - else { // create a separate ResultBody + } else { // create a separate ResultBody aResultBody = document()->createBody(data(), theResultIndex); ListOfShape aCompSolidList; aCompSolidList.push_back(theCompsolid); - // tools should be added to the list to fulfill the correct history of modification - aCompSolidList.insert(aCompSolidList.end(), theTools.begin(), theTools.end()); + // tools should be added to the list to fulfill the correct history of + // modification + aCompSolidList.insert(aCompSolidList.end(), theTools.begin(), + theTools.end()); ListOfShape aUsedTools = theTools; aUsedTools.insert(aUsedTools.end(), thePlanes.begin(), thePlanes.end()); - ModelAPI_Tools::loadModifiedShapes(aResultBody, - aCompSolidList, - aUsedTools, - aMakeShapeList, - aResultShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, aCompSolidList, + aUsedTools, aMakeShapeList, + aResultShape); setResult(aResultBody, theResultIndex); ++theResultIndex; } @@ -311,31 +304,31 @@ bool FeaturesPlugin_VersionedBoolean::processCompsolid( //================================================================================================= bool FeaturesPlugin_VersionedBoolean::processCompound( const GeomAlgoAPI_Tools::BOPType theBooleanType, - GeomAPI_ShapeHierarchy& theCompoundHierarchy, - const GeomShapePtr& theCompound, - const ListOfShape& theTools, - const double theFuzzy, - int& theResultIndex, - std::vector& theResultBaseAlgoList, - ListOfShape& theResultShapesList, - GeomShapePtr theResultCompound) -{ + GeomAPI_ShapeHierarchy &theCompoundHierarchy, + const GeomShapePtr &theCompound, const ListOfShape &theTools, + const double theFuzzy, int &theResultIndex, + std::vector &theResultBaseAlgoList, + ListOfShape &theResultShapesList, GeomShapePtr theResultCompound) { ListOfShape aUsedInOperationShapes; ListOfShape aNotUsedShapes; - theCompoundHierarchy.splitCompound(theCompound, aUsedInOperationShapes, aNotUsedShapes); + theCompoundHierarchy.splitCompound(theCompound, aUsedInOperationShapes, + aNotUsedShapes); if (theResultCompound) { // Not necessary to keep all subs of the current compound, // all unused solids are already stored in the result compound. aNotUsedShapes.clear(); } - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList()); std::shared_ptr aBoolAlgo; - performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationShapes, theTools, theFuzzy); + performBoolean(theBooleanType, aBoolAlgo, aUsedInOperationShapes, theTools, + theFuzzy); // Checking that the algorithm worked properly. std::string anError; - if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) { + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), + anError)) { setError(anError); return false; } @@ -349,18 +342,17 @@ bool FeaturesPlugin_VersionedBoolean::processCompound( ListOfShape aShapesForResult = aNotUsedShapes; if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) { - for (GeomAPI_ShapeIterator aResultIt(aResultShape); aResultIt.more(); aResultIt.next()) { + for (GeomAPI_ShapeIterator aResultIt(aResultShape); aResultIt.more(); + aResultIt.next()) { aShapesForResult.push_back(aResultIt.current()); } - } - else { + } else { aShapesForResult.push_back(aResultShape); } if (aShapesForResult.size() == 1) { aResultShape = aShapesForResult.front(); - } - else { + } else { aResultShape = GeomAlgoAPI_CompoundBuilder::compound(aShapesForResult); } } @@ -370,20 +362,17 @@ bool FeaturesPlugin_VersionedBoolean::processCompound( std::shared_ptr aResultBody; if (theResultCompound) { // store BOP result to the compound - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder); aBuilder->add(theResultCompound, aResultShape); aMakeShapeList->appendAlgo(aBuilder); - } - else { // create a separate ResultBody + } else { // create a separate ResultBody aResultBody = document()->createBody(data(), theResultIndex); ListOfShape aCompoundList; aCompoundList.push_back(theCompound); - ModelAPI_Tools::loadModifiedShapes(aResultBody, - aCompoundList, - theTools, - aMakeShapeList, - aResultShape); + ModelAPI_Tools::loadModifiedShapes(aResultBody, aCompoundList, theTools, + aMakeShapeList, aResultShape); setResult(aResultBody, theResultIndex); ++theResultIndex; } @@ -400,11 +389,10 @@ bool FeaturesPlugin_VersionedBoolean::processCompound( //================================================================================================== GeomShapePtr FeaturesPlugin_VersionedBoolean::keepUnusedSubsOfCompound( - const GeomShapePtr& theResult, - const GeomAPI_ShapeHierarchy& theObjectsHierarchy, - const GeomAPI_ShapeHierarchy& theToolsHierarchy, - std::shared_ptr theMakeShapeList) -{ + const GeomShapePtr &theResult, + const GeomAPI_ShapeHierarchy &theObjectsHierarchy, + const GeomAPI_ShapeHierarchy &theToolsHierarchy, + std::shared_ptr theMakeShapeList) { ListOfShape aCompounds; theObjectsHierarchy.compoundsOfUnusedObjects(aCompounds); theToolsHierarchy.compoundsOfUnusedObjects(aCompounds); @@ -413,7 +401,8 @@ GeomShapePtr FeaturesPlugin_VersionedBoolean::keepUnusedSubsOfCompound( if (!aCompounds.empty()) { aResultShape = GeomAlgoAPI_CompoundBuilder::compound(aCompounds); if (theResult) { - std::shared_ptr aBuilder(new GeomAlgoAPI_ShapeBuilder); + std::shared_ptr aBuilder( + new GeomAlgoAPI_ShapeBuilder); aBuilder->add(aResultShape, theResult); theMakeShapeList->appendAlgo(aBuilder); } @@ -423,21 +412,22 @@ GeomShapePtr FeaturesPlugin_VersionedBoolean::keepUnusedSubsOfCompound( //================================================================================================= void FeaturesPlugin_VersionedBoolean::resizePlanes( - const ListOfShape& theObjects, - ListOfShape& thePlanes, - std::shared_ptr& theMakeShapeList) -{ + const ListOfShape &theObjects, ListOfShape &thePlanes, + std::shared_ptr &theMakeShapeList) { if (thePlanes.empty()) return; - std::list > aBoundingPoints = + std::list> aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(theObjects, 1.0); // Resize planes to fit in bounding box - for (ListOfShape::iterator anIt = thePlanes.begin(); anIt != thePlanes.end(); ++anIt) { + for (ListOfShape::iterator anIt = thePlanes.begin(); anIt != thePlanes.end(); + ++anIt) { GeomShapePtr aPlane = *anIt; - GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints); - std::shared_ptr aMkShCustom(new GeomAlgoAPI_MakeShapeCustom); + GeomShapePtr aTool = + GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints); + std::shared_ptr aMkShCustom( + new GeomAlgoAPI_MakeShapeCustom); aMkShCustom->addModified(aPlane, aTool); theMakeShapeList->appendAlgo(aMkShCustom); *anIt = aTool; diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h index 120e82c3e..d53f13c10 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_VersionedBoolean_H_ @@ -36,11 +37,9 @@ class GeomAlgoAPI_MakeShapeList; /// \class FeaturesPlugin_VersionedBoolean /// \ingroup Plugins /// \brief Feature controls a version of Boolean operations. -class FeaturesPlugin_VersionedBoolean : public ModelAPI_Feature -{ +class FeaturesPlugin_VersionedBoolean : public ModelAPI_Feature { protected: - static const std::string& BOP_VERSION_9_4() - { + static const std::string &BOP_VERSION_9_4() { static const std::string VERSION("v9.4"); return VERSION; } @@ -51,72 +50,68 @@ protected: /// Initialize version field of the Boolean feature. /// The version is initialized for newly created features, /// not read from previously stored document. - void initVersion(const std::string& theVersion, - const std::shared_ptr theObjectsAttr - = std::shared_ptr(), - const std::shared_ptr theToolsAttr - = std::shared_ptr()); + void initVersion(const std::string &theVersion, + const std::shared_ptr theObjectsAttr = + std::shared_ptr(), + const std::shared_ptr theToolsAttr = + std::shared_ptr()); /// Process SelectionList attribute and fill the objects hierarchy. - bool processAttribute(const std::string& theAttributeName, - GeomAPI_ShapeHierarchy& theObjects, - ListOfShape& thePlanesList); + bool processAttribute(const std::string &theAttributeName, + GeomAPI_ShapeHierarchy &theObjects, + ListOfShape &thePlanesList); /// Perform Boolean operation of the object with the tools. /// In case of theResultCompound is not empty, the result of Boolean operation /// is added to this compound, and corresponding ResultBody is not generated. /// \return \c false if something went wrong - bool processObject(const GeomAlgoAPI_Tools::BOPType theBooleanType, - const GeomShapePtr& theObject, - const ListOfShape& theTools, - const ListOfShape& thePlanes, - const double theFuzzy, - int& theResultIndex, - std::vector& theResultBaseAlgoList, - ListOfShape& theResultShapesList, - GeomShapePtr theResulCompound = GeomShapePtr()); + bool processObject( + const GeomAlgoAPI_Tools::BOPType theBooleanType, + const GeomShapePtr &theObject, const ListOfShape &theTools, + const ListOfShape &thePlanes, const double theFuzzy, int &theResultIndex, + std::vector &theResultBaseAlgoList, + ListOfShape &theResultShapesList, + GeomShapePtr theResulCompound = GeomShapePtr()); /// Perform Boolean operation of the Compsolid with the tools /// In case of theResultCompound is not empty, the result of Boolean operation /// is added to this compound, and corresponding ResultBody is not generated. /// \return \c false if something went wrong - bool processCompsolid(const GeomAlgoAPI_Tools::BOPType theBooleanType, - GeomAPI_ShapeHierarchy& theCompsolidHierarchy, - const GeomShapePtr& theCompsolid, - const ListOfShape& theTools, - const ListOfShape& thePlanes, - const double theFuzzy, - int& theResultIndex, - std::vector& theResultBaseAlgoList, - ListOfShape& theResultShapesList, - GeomShapePtr theResulCompound = GeomShapePtr()); + bool processCompsolid( + const GeomAlgoAPI_Tools::BOPType theBooleanType, + GeomAPI_ShapeHierarchy &theCompsolidHierarchy, + const GeomShapePtr &theCompsolid, const ListOfShape &theTools, + const ListOfShape &thePlanes, const double theFuzzy, int &theResultIndex, + std::vector &theResultBaseAlgoList, + ListOfShape &theResultShapesList, + GeomShapePtr theResulCompound = GeomShapePtr()); /// Perform Boolean operation of the Compound with the tools /// In case of theResultCompound is not empty, the result of Boolean operation /// is added to this compound, and corresponding ResultBody is not generated. /// \return \c false if something went wrong - bool processCompound(const GeomAlgoAPI_Tools::BOPType theBooleanType, - GeomAPI_ShapeHierarchy& theCompoundHierarchy, - const GeomShapePtr& theCompound, - const ListOfShape& theTools, - const double theFuzzy, - int& theResultIndex, - std::vector& theResultBaseAlgoList, - ListOfShape& theResultShapesList, - GeomShapePtr theResulCompound = GeomShapePtr()); + bool processCompound( + const GeomAlgoAPI_Tools::BOPType theBooleanType, + GeomAPI_ShapeHierarchy &theCompoundHierarchy, + const GeomShapePtr &theCompound, const ListOfShape &theTools, + const double theFuzzy, int &theResultIndex, + std::vector &theResultBaseAlgoList, + ListOfShape &theResultShapesList, + GeomShapePtr theResulCompound = GeomShapePtr()); - /// Resize planes to fit them to the bounding box of the given lins of objects. - static void resizePlanes(const ListOfShape& theObjects, - ListOfShape& thePlanes, - std::shared_ptr& theMakeShapeList); + /// Resize planes to fit them to the bounding box of the given lins of + /// objects. + static void + resizePlanes(const ListOfShape &theObjects, ListOfShape &thePlanes, + std::shared_ptr &theMakeShapeList); /// Process unused sub-shapes of compounds. /// Keep the compound hierarchy, but merge top-level compounds /// into a single compound and add the result of the FUSE operation. GeomShapePtr keepUnusedSubsOfCompound( - const GeomShapePtr& theResult, - const GeomAPI_ShapeHierarchy& theObjectsHierarchy, - const GeomAPI_ShapeHierarchy& theToolsHierarchy, + const GeomShapePtr &theResult, + const GeomAPI_ShapeHierarchy &theObjectsHierarchy, + const GeomAPI_ShapeHierarchy &theToolsHierarchy, std::shared_ptr theMakeShapeList); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp index f06d62add..ab2dc3547 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FeaturesPlugin_VersionedChFi.h" @@ -26,41 +27,37 @@ #include - static const std::string CHAMFERFILLET_VERSION_1("v9.5"); - // Obtain all sub-shapes from the shape and append them to the list -static void collectSubs(const GeomShapePtr& theShape, - ListOfShape& theSubs, - const GeomAPI_Shape::ShapeType theShapeType) -{ +static void collectSubs(const GeomShapePtr &theShape, ListOfShape &theSubs, + const GeomAPI_Shape::ShapeType theShapeType) { GeomAPI_ShapeExplorer anExp(theShape, theShapeType); for (; anExp.more(); anExp.next()) { GeomShapePtr aShape = anExp.current(); - // Store all shapes with FORWARD orientation to avoid duplication of shared edges/vertices + // Store all shapes with FORWARD orientation to avoid duplication of shared + // edges/vertices aShape->setOrientation(GeomAPI_Shape::FORWARD); theSubs.push_back(aShape); } } - -void FeaturesPlugin_VersionedChFi::initVersion(const AttributePtr& theObjectsAttr) -{ +void FeaturesPlugin_VersionedChFi::initVersion( + const AttributePtr &theObjectsAttr) { if (!theObjectsAttr->isInitialized()) { // new feature, not read from file data()->setVersion(CHAMFERFILLET_VERSION_1); } } -void FeaturesPlugin_VersionedChFi::execute() -{ +void FeaturesPlugin_VersionedChFi::execute() { GeomAPI_ShapeHierarchy anObjectHierarchy; if (!processAttribute(objectsAttribute(), anObjectHierarchy)) return; // Perform the operation - std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList); + std::shared_ptr aMakeShapeList( + new GeomAlgoAPI_MakeShapeList); int aResultIndex = 0; std::string anError; @@ -69,9 +66,10 @@ void FeaturesPlugin_VersionedChFi::execute() for (GeomAPI_ShapeHierarchy::iterator anIt = anObjectHierarchy.begin(); anIt != anObjectHierarchy.end(); ++anIt) { GeomShapePtr aSolid = anObjectHierarchy.parent(*anIt); - const ListOfShape& aSubs = anObjectHierarchy.objects(aSolid); + const ListOfShape &aSubs = anObjectHierarchy.objects(aSolid); - std::shared_ptr anAlgo = performOperation(aSolid, aSubs); + std::shared_ptr anAlgo = + performOperation(aSolid, aSubs); if (!anAlgo) return; // something gone wrong @@ -83,38 +81,42 @@ void FeaturesPlugin_VersionedChFi::execute() } // Build results of the operaion. - const std::string& aPrefix = modifiedShapePrefix(); + const std::string &aPrefix = modifiedShapePrefix(); ListOfShape aTopLevel; anObjectHierarchy.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) { + for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); + ++anIt) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalSolids, ListOfShape(), - aMakeShapeList, *anIt, aPrefix); + ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalSolids, + ListOfShape(), aMakeShapeList, *anIt, + aPrefix); setResult(aResultBody, aResultIndex++); - for (ListOfShape::iterator aEIt = anEdges.begin(); aEIt != anEdges.end(); ++aEIt) { + for (ListOfShape::iterator aEIt = anEdges.begin(); aEIt != anEdges.end(); + ++aEIt) { GeomShapePtr aBase = *aEIt; // Store new faces generated from edges and vertices - aResultBody->loadGeneratedShapes(aMakeShapeList, aBase, GeomAPI_Shape::EDGE, aPrefix, true); + aResultBody->loadGeneratedShapes(aMakeShapeList, aBase, + GeomAPI_Shape::EDGE, aPrefix, true); } - ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), anOriginalSolids, - aMakeShapeList, *anIt); + ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), + anOriginalSolids, aMakeShapeList, *anIt); } removeResults(aResultIndex); } - -bool FeaturesPlugin_VersionedChFi::processAttribute(const AttributePtr& theAttribute, - GeomAPI_ShapeHierarchy& theObjects) -{ +bool FeaturesPlugin_VersionedChFi::processAttribute( + const AttributePtr &theAttribute, GeomAPI_ShapeHierarchy &theObjects) { bool isStoreFullHierarchy = data()->version() == CHAMFERFILLET_VERSION_1; AttributeSelectionListPtr anObjectsSelList = std::dynamic_pointer_cast(theAttribute); - for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); ++anObjectsIndex) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex); + for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); + ++anObjectsIndex) { + AttributeSelectionPtr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); GeomShapePtr anObject = anObjectAttr->value(); if (!anObject) return false; @@ -123,7 +125,8 @@ bool FeaturesPlugin_VersionedChFi::processAttribute(const AttributePtr& theAttri GeomShapePtr aParent; if (aContext.get()) { ResultBodyPtr aCtxOwner = ModelAPI_Tools::bodyOwner(aContext); - if (aCtxOwner && aCtxOwner->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) + if (aCtxOwner && + aCtxOwner->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) aContext = aCtxOwner; aParent = aContext->shape(); if (!aParent) @@ -143,7 +146,8 @@ bool FeaturesPlugin_VersionedChFi::processAttribute(const AttributePtr& theAttri ListOfShape anEdges; collectSubs(aParent, anEdges, GeomAPI_Shape::EDGE); - for (ListOfShape::iterator anIt = anEdges.begin(); anIt != anEdges.end(); ++anIt) { + for (ListOfShape::iterator anIt = anEdges.begin(); + anIt != anEdges.end(); ++anIt) { theObjects.addObject(*anIt); theObjects.addParent(*anIt, aParent); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h index d317bb6ab..1134289fb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_VersionedChFi_H_ @@ -33,8 +34,7 @@ class GeomAlgoAPI_MakeShape; /// \ingroup Plugins /// \brief Base feature for the Fillet and the Chamfer operations /// which supports versioning. -class FeaturesPlugin_VersionedChFi : public ModelAPI_Feature -{ +class FeaturesPlugin_VersionedChFi : public ModelAPI_Feature { public: /// Performs the fillet algorithm and stores it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); @@ -43,21 +43,23 @@ protected: FeaturesPlugin_VersionedChFi() {} /// Intialize the version for the newly created feature. - void initVersion(const std::shared_ptr& theObjectsAttr); + void initVersion(const std::shared_ptr &theObjectsAttr); /// Process SelectionList attribute and fill the objects hierarchy. - bool processAttribute(const std::shared_ptr& theAttribute, - GeomAPI_ShapeHierarchy& theObjects); + bool processAttribute(const std::shared_ptr &theAttribute, + GeomAPI_ShapeHierarchy &theObjects); /// Return attribute storing the selected objects of the operation. virtual std::shared_ptr objectsAttribute() = 0; /// Return name of modified shape prefix name - virtual const std::string& modifiedShapePrefix() const = 0; + virtual const std::string &modifiedShapePrefix() const = 0; - /// Run chamfer/fillet operation and returns the modification algorithm if succeed. + /// Run chamfer/fillet operation and returns the modification algorithm if + /// succeed. virtual std::shared_ptr - performOperation(const GeomShapePtr& theSolid, const ListOfShape& theEdges) = 0; + performOperation(const GeomShapePtr &theSolid, + const ListOfShape &theEdges) = 0; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index a01ffc9bc..b401aab9b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -2467,7 +2467,7 @@ Erreur : le contexte est vide. - + Smash @@ -5553,7 +5553,7 @@ Shared faces Faces partagées - + List of faces : Liste des faces : @@ -5611,7 +5611,7 @@ Shared faces Faces partagées - + List of faces : Liste des faces : diff --git a/src/FeaturesPlugin/data/PLANFISS_bug1868.brep b/src/FeaturesPlugin/data/PLANFISS_bug1868.brep index 994569e00..f9d9c7c33 100644 --- a/src/FeaturesPlugin/data/PLANFISS_bug1868.brep +++ b/src/FeaturesPlugin/data/PLANFISS_bug1868.brep @@ -3,52 +3,52 @@ DBRep_DrawableShape CASCADE Topology V1, (c) Matra-Datavision Locations 6 1 - 1 0 0 3.5 - 0 1.11022302462516e-16 -1 -1.66533453693773e-16 - 0 1 1.11022302462516e-16 -1.5 + 1 0 0 3.5 + 0 1.11022302462516e-16 -1 -1.66533453693773e-16 + 0 1 1.11022302462516e-16 -1.5 1 --0.707106781186547 0.707106781186548 -1.0837636805769e-16 940.133154714881 --0.707106781186548 -0.707106781186547 3.46370982828774e-16 1349.86684528512 -1.68287605990514e-16 3.21554935538437e-16 1 9.33150041612651e-14 +-0.707106781186547 0.707106781186548 -1.0837636805769e-16 940.133154714881 +-0.707106781186548 -0.707106781186547 3.46370982828774e-16 1349.86684528512 +1.68287605990514e-16 3.21554935538437e-16 1 9.33150041612651e-14 2 1 1 2 1 0 2 2 -1 1 -1 0 1 - 1 0 0 -7 - 0 1 0 0 - 0 0 1 3 + 1 0 0 -7 + 0 1 0 0 + 0 0 1 3 1 - 1 0 0 -3 - 0 1 0 0 - 0 0 1 3 + 1 0 0 -3 + 0 1 0 0 + 0 0 1 3 Curve2ds 2 -7 0 0 3 7 5 -3.0066938551374576 -3.0554024673217413 -3.0060947189734581 -2.8291599606297599 -3.0004890039187662 -0.41579128122162023 -2.9997116981051439 1.9999999999359943 -3.000489003919113 4.4157912811311686 -3.0060947189735359 6.8291599606195419 -3.0066938551375624 7.0554024673219349 +7 0 0 3 7 5 -3.0066938551374576 -3.0554024673217413 -3.0060947189734581 -2.8291599606297599 -3.0004890039187662 -0.41579128122162023 -2.9997116981051439 1.9999999999359943 -3.000489003919113 4.4157912811311686 -3.0060947189735359 6.8291599606195419 -3.0066938551375624 7.0554024673219349 0 4 0.2052151489021832 1 0.49999999999378325 1 0.79478485108541164 1 1 4 -7 0 0 3 7 5 0.78804636055627808 4.7123889803846897 0.78792784651751024 4.7123889803846897 0.78666363761634184 4.7123889803846897 0.78539816339748192 4.7123889803846897 0.78413268917860202 4.7123889803846897 0.78286848027739186 4.7123889803846897 0.78274996623861859 4.7123889803846897 +7 0 0 3 7 5 0.78804636055627808 4.7123889803846897 0.78792784651751024 4.7123889803846897 0.78666363761634184 4.7123889803846897 0.78539816339748192 4.7123889803846897 0.78413268917860202 4.7123889803846897 0.78286848027739186 4.7123889803846897 0.78274996623861859 4.7123889803846897 0 4 0.2052151489021832 1 0.49999999999378325 1 0.79478485108541164 1 1 4 Curves 4 2 -5.5 1.5 0 -0 -1 -0 0 0 1 -1 0 0 3 -1 -1.5 1.5 3 -1 0 0 -7 0 0 3 7 5 943.71259735151102 1353.4368213810296 9.2489376456425218e-14 943.55219608759205 1353.2772674235996 9.2527324128535532e-14 941.84172288975083 1351.5747219040154 9.2932283980014878e-14 940.13295085470099 1349.8670491453893 9.3338668063054002e-14 938.42527809604871 1348.1582771103128 9.3745379442578809e-14 936.72273257640768 1346.4478039124149 9.4152699665973083e-14 936.56317861897014 1346.2874026484888 9.4190899613513505e-14 +1 -1.5 1.5 3 -1 0 0 +7 0 0 3 7 5 943.71259735151102 1353.4368213810296 9.2489376456425218e-14 943.55219608759205 1353.2772674235996 9.2527324128535532e-14 941.84172288975083 1351.5747219040154 9.2932283980014878e-14 940.13295085470099 1349.8670491453893 9.3338668063054002e-14 938.42527809604871 1348.1582771103128 9.3745379442578809e-14 936.72273257640768 1346.4478039124149 9.4152699665973083e-14 936.56317861897014 1346.2874026484888 9.4190899613513505e-14 0 4 0.2052151489021832 1 0.49999999999378325 1 0.79478485108541164 1 1 4 2 -1.5 1.5 0 0 1 0 0 -0 1 1 0 -0 3 Polygon3D 0 PolygonOnTriangulations 4 -24 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 -p 0.00335068426093912 1 0 0.0683903907094314 0.136780781418863 0.205171172128294 0.273561562837726 0.341951953547157 0.410342344256589 0.47873273496602 0.547123125675451 0.615513516384883 0.683903907094314 0.752294297803746 0.820684688513177 0.889075079222609 0.95746546993204 1.02585586064147 1.0942462513509 1.16263664206033 1.23102703276977 1.2994174234792 1.36780781418863 1.43619820489806 1.50458859560749 1.57297898631692 -2 25 1 -p 0.00335068426093912 1 0 4 -4 2 27 28 26 -p 0.00335068426093912 1 0.0137320228697731 0.445970224763194 0.716119100946582 0.98626797712997 -24 25 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 26 -p 0.00335068426093912 1 0 0.0683903907094341 0.136780781418868 0.205171172128302 0.273561562837737 0.341951953547171 0.410342344256605 0.478732734966039 0.547123125675473 0.615513516384907 0.683903907094341 0.752294297803775 0.820684688513209 0.889075079222644 0.957465469932078 1.02585586064151 1.09424625135095 1.16263664206038 1.23102703276981 1.29941742347925 1.36780781418868 1.43619820489812 1.50458859560755 1.57297898631698 +24 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 +p 0.00335068426093912 1 0 0.0683903907094314 0.136780781418863 0.205171172128294 0.273561562837726 0.341951953547157 0.410342344256589 0.47873273496602 0.547123125675451 0.615513516384883 0.683903907094314 0.752294297803746 0.820684688513177 0.889075079222609 0.95746546993204 1.02585586064147 1.0942462513509 1.16263664206033 1.23102703276977 1.2994174234792 1.36780781418863 1.43619820489806 1.50458859560749 1.57297898631692 +2 25 1 +p 0.00335068426093912 1 0 4 +4 2 27 28 26 +p 0.00335068426093912 1 0.0137320228697731 0.445970224763194 0.716119100946582 0.98626797712997 +24 25 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 26 +p 0.00335068426093912 1 0 0.0683903907094341 0.136780781418868 0.205171172128302 0.273561562837737 0.341951953547171 0.410342344256605 0.478732734966039 0.547123125675473 0.615513516384907 0.683903907094341 0.752294297803775 0.820684688513209 0.889075079222644 0.957465469932078 1.02585586064151 1.09424625135095 1.16263664206038 1.23102703276981 1.29941742347925 1.36780781418868 1.43619820489812 1.50458859560755 1.57297898631698 Surfaces 2 -1 -5.5 1.5 3 0 1 0 0 -0 1 1 0 -0 -7 2290 0 0 0 0 -1 +1 -5.5 1.5 3 0 1 0 0 -0 1 1 0 -0 +7 2290 0 0 0 0 -1 8 3.1415926535897931 6.2831853071795862 2 0 0 0 0 1 0 3.3306690738754696e-16 0 -1 -1 0 -3.3306690738754696e-16 381 Triangulations 1 51 50 1 2.94982503200078e-16 -939.426047933694 1353.40237919105 9.2370555648813e-14 943.673313684198 1353.3977440217 9.25332064102743e-14 939.575971827796 1353.54238501571 9.2370555648813e-14 939.735112833754 1353.6718181845 9.2370555648813e-14 939.902726900083 1353.79007354265 9.2148511043888e-14 940.078030360161 1353.89659819634 9.2148511043888e-14 940.260203596199 1353.99089409781 9.2148511043888e-14 940.4483948713 1354.07252037383 9.2148511043888e-14 940.64172431169 1354.14109538706 9.2148511043888e-14 940.839288020501 1354.19629852031 9.2370555648813e-14 941.040162303871 1354.23787167562 9.2370555648813e-14 941.243407989599 1354.26562048089 9.2148511043888e-14 941.448074818178 1354.27941519873 9.2148511043888e-14 941.653205885657 1354.279191333 9.2148511043888e-14 941.857842117571 1354.26494993037 9.2148511043888e-14 942.061026753022 1354.23675757542 9.2148511043888e-14 942.261809817938 1354.19474607933 9.2370555648813e-14 942.459252566603 1354.13911186359 9.2370555648813e-14 942.652431870696 1354.0701150417 9.2370555648813e-14 942.840444535298 1353.98807820296 9.2370555648813e-14 943.022411521715 1353.89338490428 9.2370555648813e-14 943.197482057355 1353.78647787686 9.2370555648813e-14 943.364837613449 1353.66785695625 9.25926002537381e-14 943.523695732019 1353.53807674541 9.25926002537381e-14 936.597620808948 1350.57395206631 9.30366894635881e-14 936.602255978305 1346.3266863158 9.42090634558256e-14 940.48291088197 1350.21654738554 9.32555031584132e-14 938.653843128418 1348.38604576829 9.36911955176587e-14 936.45761498429 1350.4240281722 9.30366894635881e-14 936.328181815497 1350.26488716625 9.30366894635881e-14 936.209926457354 1350.09727309992 9.30366894635881e-14 936.103401803655 1349.92196963984 9.30366894635881e-14 936.009105902193 1349.7397964038 9.32587340685131e-14 935.927479626173 1349.5516051287 9.32587340685131e-14 935.858904612944 1349.35827568831 9.32587340685131e-14 935.803701479685 1349.1607119795 9.34807786734382e-14 935.762128324383 1348.95983769613 9.34807786734382e-14 935.734379519113 1348.7565920104 9.34807786734382e-14 935.720584801274 1348.55192518182 9.34807786734382e-14 935.720808667001 1348.34679411434 9.37028232783632e-14 935.73505006963 1348.14215788243 9.37028232783632e-14 935.76324242458 1347.93897324698 9.37028232783632e-14 935.805253920675 1347.73819018206 9.39248678832882e-14 935.860888136408 1347.5407474334 9.39248678832882e-14 935.9298849583 1347.3475681293 9.39248678832882e-14 936.011921797039 1347.1595554647 9.39248678832882e-14 936.106615095721 1346.97758847828 9.39248678832882e-14 936.21352212314 1346.80251794264 9.39248678832882e-14 936.332143043746 1346.63516238655 9.41469124882133e-14 936.461923254585 1346.47630426798 9.41469124882133e-14 939.074810848235 1350.92518915802 9.30366894635881e-14 0 0 -3.00654797336688 -2.99999285399872 -0.0070131341603199 -0.205011270202809 -0.0280197472736301 -0.409064026044181 -0.0629216245427489 -0.611204234622391 -0.111555584935858 -0.810486805002824 -0.17369424412697 -1.00598000691758 -0.249047077613794 -1.19676982699836 -0.337261779042602 -1.38196424217543 -0.437925907389382 -1.56069739026255 -0.550568815295992 -1.7321336182288 -0.674663849545539 -1.89547138922973 -0.809630813388824 -2.04994703013106 -0.954838679209431 -2.19483830200337 -1.10960853884462 -2.32946777689448 -1.27321677776801 -2.4532060050915 -1.44489845829341 -2.56547445806438 -1.62385089598193 -2.66574823333135 -1.80923741253101 -2.75355850859994 -2.00019124759931 -2.82849473370943 -2.19581961127767 -2.89020655012638 -2.39520785825941 -2.93840542901892 -2.59742376419385 -2.97286602025104 -2.80152188422921 -2.99342720598968 0 4 -3.00655149142941 6.99999284515707 -3.00003823090744 1.50540831588663 -3.00105212564983 4.09311463420153 -0.00701313416031946 4.20501127020301 -0.0280197472736314 4.40906402604439 -0.0629216245427533 4.61120423462261 -0.111555584935865 4.81048680500305 -0.173694244126982 5.00598000691781 -0.249047077613813 5.1967698269986 -0.337261779042627 5.38196424217568 -0.437925907389414 5.5606973902628 -0.550568815296033 5.73213361822905 -0.67466384954559 5.89547138922999 -0.809630813388885 6.04994703013132 -0.954838679209501 6.19483830200364 -1.1096085388447 6.32946777689474 -1.2732167777681 6.45320600509176 -1.44489845829352 6.56547445806464 -1.62385089598204 6.6657482333316 -1.80923741253114 6.75355850860019 -2.00019124759945 6.82849473370967 -2.19581961127781 6.89020655012661 -2.39520785825957 6.93840542901915 -2.59742376419401 6.97286602025125 -2.80152188422939 6.99342720598989 -1.50327574571471 1.99999999557918 5 27 6 37 28 36 4 27 5 41 42 28 3 27 4 38 28 37 1 27 3 40 41 28 39 28 38 39 40 28 51 27 1 51 25 28 51 1 25 51 28 27 50 26 28 29 28 25 49 50 28 30 28 29 48 49 28 31 28 30 47 48 28 32 28 31 46 47 28 27 10 9 33 28 32 27 11 10 27 12 11 27 13 12 27 14 13 27 15 14 45 46 28 27 16 15 27 17 16 27 18 17 27 19 18 27 20 19 34 28 33 27 21 20 27 22 21 27 23 22 27 24 23 44 45 28 27 2 24 35 28 34 8 27 9 43 44 28 7 27 8 36 28 35 6 27 7 42 43 28 +939.426047933694 1353.40237919105 9.2370555648813e-14 943.673313684198 1353.3977440217 9.25332064102743e-14 939.575971827796 1353.54238501571 9.2370555648813e-14 939.735112833754 1353.6718181845 9.2370555648813e-14 939.902726900083 1353.79007354265 9.2148511043888e-14 940.078030360161 1353.89659819634 9.2148511043888e-14 940.260203596199 1353.99089409781 9.2148511043888e-14 940.4483948713 1354.07252037383 9.2148511043888e-14 940.64172431169 1354.14109538706 9.2148511043888e-14 940.839288020501 1354.19629852031 9.2370555648813e-14 941.040162303871 1354.23787167562 9.2370555648813e-14 941.243407989599 1354.26562048089 9.2148511043888e-14 941.448074818178 1354.27941519873 9.2148511043888e-14 941.653205885657 1354.279191333 9.2148511043888e-14 941.857842117571 1354.26494993037 9.2148511043888e-14 942.061026753022 1354.23675757542 9.2148511043888e-14 942.261809817938 1354.19474607933 9.2370555648813e-14 942.459252566603 1354.13911186359 9.2370555648813e-14 942.652431870696 1354.0701150417 9.2370555648813e-14 942.840444535298 1353.98807820296 9.2370555648813e-14 943.022411521715 1353.89338490428 9.2370555648813e-14 943.197482057355 1353.78647787686 9.2370555648813e-14 943.364837613449 1353.66785695625 9.25926002537381e-14 943.523695732019 1353.53807674541 9.25926002537381e-14 936.597620808948 1350.57395206631 9.30366894635881e-14 936.602255978305 1346.3266863158 9.42090634558256e-14 940.48291088197 1350.21654738554 9.32555031584132e-14 938.653843128418 1348.38604576829 9.36911955176587e-14 936.45761498429 1350.4240281722 9.30366894635881e-14 936.328181815497 1350.26488716625 9.30366894635881e-14 936.209926457354 1350.09727309992 9.30366894635881e-14 936.103401803655 1349.92196963984 9.30366894635881e-14 936.009105902193 1349.7397964038 9.32587340685131e-14 935.927479626173 1349.5516051287 9.32587340685131e-14 935.858904612944 1349.35827568831 9.32587340685131e-14 935.803701479685 1349.1607119795 9.34807786734382e-14 935.762128324383 1348.95983769613 9.34807786734382e-14 935.734379519113 1348.7565920104 9.34807786734382e-14 935.720584801274 1348.55192518182 9.34807786734382e-14 935.720808667001 1348.34679411434 9.37028232783632e-14 935.73505006963 1348.14215788243 9.37028232783632e-14 935.76324242458 1347.93897324698 9.37028232783632e-14 935.805253920675 1347.73819018206 9.39248678832882e-14 935.860888136408 1347.5407474334 9.39248678832882e-14 935.9298849583 1347.3475681293 9.39248678832882e-14 936.011921797039 1347.1595554647 9.39248678832882e-14 936.106615095721 1346.97758847828 9.39248678832882e-14 936.21352212314 1346.80251794264 9.39248678832882e-14 936.332143043746 1346.63516238655 9.41469124882133e-14 936.461923254585 1346.47630426798 9.41469124882133e-14 939.074810848235 1350.92518915802 9.30366894635881e-14 0 0 -3.00654797336688 -2.99999285399872 -0.0070131341603199 -0.205011270202809 -0.0280197472736301 -0.409064026044181 -0.0629216245427489 -0.611204234622391 -0.111555584935858 -0.810486805002824 -0.17369424412697 -1.00598000691758 -0.249047077613794 -1.19676982699836 -0.337261779042602 -1.38196424217543 -0.437925907389382 -1.56069739026255 -0.550568815295992 -1.7321336182288 -0.674663849545539 -1.89547138922973 -0.809630813388824 -2.04994703013106 -0.954838679209431 -2.19483830200337 -1.10960853884462 -2.32946777689448 -1.27321677776801 -2.4532060050915 -1.44489845829341 -2.56547445806438 -1.62385089598193 -2.66574823333135 -1.80923741253101 -2.75355850859994 -2.00019124759931 -2.82849473370943 -2.19581961127767 -2.89020655012638 -2.39520785825941 -2.93840542901892 -2.59742376419385 -2.97286602025104 -2.80152188422921 -2.99342720598968 0 4 -3.00655149142941 6.99999284515707 -3.00003823090744 1.50540831588663 -3.00105212564983 4.09311463420153 -0.00701313416031946 4.20501127020301 -0.0280197472736314 4.40906402604439 -0.0629216245427533 4.61120423462261 -0.111555584935865 4.81048680500305 -0.173694244126982 5.00598000691781 -0.249047077613813 5.1967698269986 -0.337261779042627 5.38196424217568 -0.437925907389414 5.5606973902628 -0.550568815296033 5.73213361822905 -0.67466384954559 5.89547138922999 -0.809630813388885 6.04994703013132 -0.954838679209501 6.19483830200364 -1.1096085388447 6.32946777689474 -1.2732167777681 6.45320600509176 -1.44489845829352 6.56547445806464 -1.62385089598204 6.6657482333316 -1.80923741253114 6.75355850860019 -2.00019124759945 6.82849473370967 -2.19581961127781 6.89020655012661 -2.39520785825957 6.93840542901915 -2.59742376419401 6.97286602025125 -2.80152188422939 6.99342720598989 -1.50327574571471 1.99999999557918 5 27 6 37 28 36 4 27 5 41 42 28 3 27 4 38 28 37 1 27 3 40 41 28 39 28 38 39 40 28 51 27 1 51 25 28 51 1 25 51 28 27 50 26 28 29 28 25 49 50 28 30 28 29 48 49 28 31 28 30 47 48 28 32 28 31 46 47 28 27 10 9 33 28 32 27 11 10 27 12 11 27 13 12 27 14 13 27 15 14 45 46 28 27 16 15 27 17 16 27 18 17 27 19 18 27 20 19 34 28 33 27 21 20 27 22 21 27 23 22 27 24 23 44 45 28 27 2 24 35 28 34 8 27 9 43 44 28 7 27 8 36 28 35 6 27 7 42 43 28 TShapes 9 Ve @@ -116,4 +116,4 @@ Fa 0111000 +2 0 * -+1 0 \ No newline at end of file ++1 0 diff --git a/src/FeaturesPlugin/data/face_peau_bug1868.brep b/src/FeaturesPlugin/data/face_peau_bug1868.brep index c71c17a90..0575e6f58 100644 --- a/src/FeaturesPlugin/data/face_peau_bug1868.brep +++ b/src/FeaturesPlugin/data/face_peau_bug1868.brep @@ -3,59 +3,59 @@ DBRep_DrawableShape CASCADE Topology V1, (c) Matra-Datavision Locations 8 1 - -1 0 1.22460635382238e-16 0 - 0 1 0 0 --1.22460635382238e-16 0 -1 0 + -1 0 1.22460635382238e-16 0 + 0 1 0 0 +-1.22460635382238e-16 0 -1 0 1 -3.33066907387547e-16 0 1 0 - 0 1 0 0 - -1 0 3.33066907387547e-16 0 +3.33066907387547e-16 0 1 0 + 0 1 0 0 + -1 0 3.33066907387547e-16 0 2 1 1 2 1 0 1 -1.11022302462516e-16 1 0 2290 - -1 1.11022302462516e-16 0 2290 - 0 0 1 0 +1.11022302462516e-16 1 0 2290 + -1 1.11022302462516e-16 0 2290 + 0 0 1 0 2 1 1 2 1 4 1 0 2 2 1 4 1 0 2 2 -1 0 2 4 -1 2 -1 0 Curve2ds 9 -1 0 3.1415926535897931 1 0 -1 0 30.5 1 0 -1 0 3.1415926535897931 1 0 -1 0 30.5 1 0 -1 0 0 1 0 -1 0 6.2831853071795862 1 0 +1 0 3.1415926535897931 1 0 +1 0 30.5 1 0 +1 0 3.1415926535897931 1 0 +1 0 30.5 1 0 +1 0 0 1 0 +1 0 6.2831853071795862 1 0 2 0 0 -1 0 0 1 381 -1 0 0 0 1 -1 1.5707963267948966 0 0 1 +1 0 0 0 1 +1 1.5707963267948966 0 0 1 Curves 3 2 2290 0 381 0 0 -1 -1 0 0 0 1 0 2290 2 2290 0 -381 0 0 -1 -1 0 0 0 1 0 2290 2 0 0 0 0 1 0 1 0 0 0 0 -1 381 Polygon3D 0 PolygonOnTriangulations 4 -40 1 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 2 -p 0.91600000008 1 0 0.0402768288921768 0.0805536577843537 0.12083048667653 0.161107315568707 0.201384144460884 0.241660973353061 0.281937802245238 0.322214631137415 0.362491460029591 0.402768288921768 0.443045117813945 0.483321946706122 0.523598775598299 0.563875604490476 0.604152433382652 0.644429262274829 0.684706091167006 0.724982920059183 0.76525974895136 0.805536577843537 0.845813406735714 0.886090235627891 0.926367064520067 0.966643893412244 1.00692072230442 1.0471975511966 1.08747438008877 1.12775120898095 1.16802803787313 1.20830486676531 1.24858169565748 1.28885852454966 1.32913535344184 1.36941218233401 1.40968901122619 1.44996584011837 1.49024266901054 1.53051949790272 1.5707963267949 -40 41 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 79 80 42 -p 0.91600000008 1 0 0.0402768288921768 0.0805536577843537 0.12083048667653 0.161107315568707 0.201384144460884 0.241660973353061 0.281937802245238 0.322214631137415 0.362491460029591 0.402768288921768 0.443045117813945 0.483321946706122 0.523598775598299 0.563875604490476 0.604152433382652 0.644429262274829 0.684706091167006 0.724982920059183 0.76525974895136 0.805536577843537 0.845813406735714 0.886090235627891 0.926367064520067 0.966643893412244 1.00692072230442 1.0471975511966 1.08747438008877 1.12775120898095 1.16802803787313 1.20830486676531 1.24858169565748 1.28885852454966 1.32913535344184 1.36941218233401 1.40968901122619 1.44996584011837 1.49024266901054 1.53051949790272 1.5707963267949 -33 2 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 42 -p 0.91600000008 1 3.14159265358979 3.23976742401447 3.33794219443916 3.43611696486384 3.53429173528852 3.6324665057132 3.73064127613788 3.82881604656256 3.92699081698724 4.02516558741192 4.1233403578366 4.22151512826128 4.31968989868597 4.41786466911065 4.51603943953533 4.61421420996001 4.71238898038469 4.81056375080937 4.90873852123405 5.00691329165873 5.10508806208341 5.20326283250809 5.30143760293277 5.39961237335745 5.49778714378213 5.59596191420681 5.69413668463149 5.79231145505618 5.89048622548086 5.98866099590554 6.08683576633022 6.1850105367549 6.28318530717959 -33 1 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 41 -p 0.91600000008 1 3.14159265358979 3.23976742401447 3.33794219443916 3.43611696486384 3.53429173528852 3.6324665057132 3.73064127613788 3.82881604656256 3.92699081698724 4.02516558741192 4.1233403578366 4.22151512826128 4.31968989868597 4.41786466911065 4.51603943953533 4.61421420996001 4.71238898038469 4.81056375080937 4.90873852123405 5.00691329165873 5.10508806208341 5.20326283250809 5.30143760293277 5.39961237335745 5.49778714378213 5.59596191420681 5.69413668463149 5.79231145505618 5.89048622548086 5.98866099590554 6.08683576633022 6.1850105367549 6.28318530717959 +40 1 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 2 +p 0.91600000008 1 0 0.0402768288921768 0.0805536577843537 0.12083048667653 0.161107315568707 0.201384144460884 0.241660973353061 0.281937802245238 0.322214631137415 0.362491460029591 0.402768288921768 0.443045117813945 0.483321946706122 0.523598775598299 0.563875604490476 0.604152433382652 0.644429262274829 0.684706091167006 0.724982920059183 0.76525974895136 0.805536577843537 0.845813406735714 0.886090235627891 0.926367064520067 0.966643893412244 1.00692072230442 1.0471975511966 1.08747438008877 1.12775120898095 1.16802803787313 1.20830486676531 1.24858169565748 1.28885852454966 1.32913535344184 1.36941218233401 1.40968901122619 1.44996584011837 1.49024266901054 1.53051949790272 1.5707963267949 +40 41 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 79 80 42 +p 0.91600000008 1 0 0.0402768288921768 0.0805536577843537 0.12083048667653 0.161107315568707 0.201384144460884 0.241660973353061 0.281937802245238 0.322214631137415 0.362491460029591 0.402768288921768 0.443045117813945 0.483321946706122 0.523598775598299 0.563875604490476 0.604152433382652 0.644429262274829 0.684706091167006 0.724982920059183 0.76525974895136 0.805536577843537 0.845813406735714 0.886090235627891 0.926367064520067 0.966643893412244 1.00692072230442 1.0471975511966 1.08747438008877 1.12775120898095 1.16802803787313 1.20830486676531 1.24858169565748 1.28885852454966 1.32913535344184 1.36941218233401 1.40968901122619 1.44996584011837 1.49024266901054 1.53051949790272 1.5707963267949 +33 2 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 42 +p 0.91600000008 1 3.14159265358979 3.23976742401447 3.33794219443916 3.43611696486384 3.53429173528852 3.6324665057132 3.73064127613788 3.82881604656256 3.92699081698724 4.02516558741192 4.1233403578366 4.22151512826128 4.31968989868597 4.41786466911065 4.51603943953533 4.61421420996001 4.71238898038469 4.81056375080937 4.90873852123405 5.00691329165873 5.10508806208341 5.20326283250809 5.30143760293277 5.39961237335745 5.49778714378213 5.59596191420681 5.69413668463149 5.79231145505618 5.89048622548086 5.98866099590554 6.08683576633022 6.1850105367549 6.28318530717959 +33 1 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 41 +p 0.91600000008 1 3.14159265358979 3.23976742401447 3.33794219443916 3.43611696486384 3.53429173528852 3.6324665057132 3.73064127613788 3.82881604656256 3.92699081698724 4.02516558741192 4.1233403578366 4.22151512826128 4.31968989868597 4.41786466911065 4.51603943953533 4.61421420996001 4.71238898038469 4.81056375080937 4.90873852123405 5.00691329165873 5.10508806208341 5.20326283250809 5.30143760293277 5.39961237335745 5.49778714378213 5.59596191420681 5.69413668463149 5.79231145505618 5.89048622548086 5.98866099590554 6.08683576633022 6.1850105367549 6.28318530717959 Surfaces 5 -7 2290 0 0 0 0 -1 +7 2290 0 0 0 0 -1 8 3.1415926535897931 6.2831853071795862 2 0 0 0 0 1 0 3.3306690738754696e-16 0 -1 -1 0 -3.3306690738754696e-16 381 -7 2290 0 0 0 0 -1 +7 2290 0 0 0 0 -1 8 0 3.1415926535897931 2 0 0 0 0 1 0 3.3306690738754696e-16 0 -1 -1 0 -3.3306690738754696e-16 381 2 2290 0 350.5 -0 -0 1 -1 0 0 0 1 0 2290 2 2290 0 -350.5 0 0 -1 -1 0 0 0 1 0 2290 -1 0 0 0 0 1 0 -1 -0 -0 0 0 -1 +1 0 0 0 0 1 0 -1 -0 -0 0 0 -1 Triangulations 1 948 1752 1 0.644585842074808 --1.73555993795288e-13 0 381 2290 2290 381 1.85719418710551 92.2090028505607 381 7.42576437265916 184.268442361302 381 16.6966783154562 276.02899778469 381 29.6548985591794 367.341833164271 381 46.279406823207 458.058838747142 381 66.5432380943407 548.032871218507 381 90.4135243641572 637.117992368676 381 117.851547941037 725.169705805372 381 148.8128042504 812.045191327406 381 183.247074021293 897.603536579572 381 221.098504742225 981.705965612994 381 262.305701254149 1064.21606398023 381 306.801825333635 1145 381 354.51470410471 1223.92674183266 381 405.366947103527 1300.86827001435 381 459.276071805982 1375.69978510497 381 516.154637414671 1448.29991011341 381 575.910386688179 1518.55088737142 381 638.446395582665 1586.33876953698 381 703.661230463018 1651.55360441734 381 771.449112628579 1714.08961331182 381 841.700089886587 1773.84536258533 381 914.300214895029 1830.72392819402 381 989.131729985654 1884.63305289647 381 1066.07325816734 1935.48529589529 381 1145 1983.19817466636 381 1225.78393601977 2027.69429874585 381 1308.29403438701 2068.90149525778 381 1392.39646342043 2106.75292597871 381 1477.95480867259 2141.1871957496 381 1564.83029419463 2172.14845205896 381 1652.88200763132 2199.58647563584 381 1741.96712878149 2223.45676190566 381 1831.94116125286 2243.72059317679 381 1922.65816683573 2260.34510144082 381 2013.97100221531 2273.30332168454 381 2105.7315576387 2282.57423562734 381 2197.79099714944 2288.14280581289 381 1.26898491714655e-13 0 -381 2290 2290 -381 1.85719418710551 92.2090028505607 -381 7.42576437265916 184.268442361302 -381 16.6966783154562 276.02899778469 -381 29.6548985591794 367.341833164271 -381 46.279406823207 458.058838747142 -381 66.5432380943407 548.032871218507 -381 90.4135243641572 637.117992368676 -381 117.851547941037 725.169705805372 -381 148.8128042504 812.045191327406 -381 183.247074021293 897.603536579572 -381 221.098504742225 981.705965612994 -381 262.305701254149 1064.21606398023 -381 306.801825333635 1145 -381 354.51470410471 1223.92674183266 -381 405.366947103527 1300.86827001435 -381 459.276071805982 1375.69978510497 -381 516.154637414671 1448.29991011341 -381 575.910386688179 1518.55088737142 -381 638.446395582665 1586.33876953698 -381 703.661230463018 1651.55360441734 -381 771.449112628579 1714.08961331182 -381 841.700089886587 1773.84536258533 -381 914.300214895029 1830.72392819402 -381 989.131729985654 1884.63305289647 -381 1066.07325816734 1935.48529589529 -381 1145 1983.19817466636 -381 1225.78393601977 2027.69429874585 -381 1308.29403438701 2068.90149525778 -381 1392.39646342043 2106.75292597871 -381 1477.95480867259 2141.1871957496 -381 1564.83029419463 2172.14845205896 -381 1652.88200763132 2199.58647563584 -381 1741.96712878149 2223.45676190566 -381 1831.94116125286 2243.72059317679 -381 1922.65816683573 2260.34510144082 -381 2013.97100221531 2273.30332168454 -381 2105.7315576387 2282.57423562734 -381 2197.79099714944 2288.14280581289 -381 37.3445304655625 0 379.165380862107 74.3294126881448 0 373.679191833631 110.59846203395 0 364.594267913972 145.802387731099 0 351.9981018868 179.602156730705 0 336.012001716723 211.672258780468 0 316.78992228727 241.703841266349 0 294.516982731203 269.407683632075 0 269.407683632075 294.516982731203 0 241.703841266349 316.78992228727 0 211.672258780469 336.012001716723 0 179.602156730705 351.9981018868 0 145.8023877311 364.594267913971 0 110.598462033951 373.679191833631 0 74.3294126881455 379.165380862107 0 37.3445304655633 381 0 8.736767006471e-13 379.165380862107 0 -37.3445304655616 373.679191833631 0 -74.3294126881438 364.594267913972 0 -110.598462033949 351.998101886801 0 -145.802387731098 336.012001716724 0 -179.602156730704 316.789922287271 0 -211.672258780467 294.516982731204 0 -241.703841266348 269.407683632076 0 -269.407683632073 241.703841266351 0 -294.516982731201 211.67225878047 0 -316.789922287269 179.602156730707 0 -336.012001716722 145.802387731101 0 -351.998101886799 110.598462033953 0 -364.594267913971 74.3294126881475 0 -373.67919183363 37.3445304655654 0 -379.165380862107 2290 2252.65546953444 379.165380862107 2290 2215.67058731186 373.679191833631 2290 2179.40153796605 364.594267913972 2290 2144.1976122689 351.9981018868 2290 2110.39784326929 336.012001716723 2290 2078.32774121953 316.78992228727 2290 2048.29615873365 294.516982731203 2290 2020.59231636793 269.407683632075 2290 1995.4830172688 241.703841266349 2290 1973.21007771273 211.672258780469 2290 1953.98799828328 179.602156730705 2290 1938.0018981132 145.8023877311 2290 1925.40573208603 110.598462033951 2290 1916.32080816637 74.3294126881455 2290 1910.83461913789 37.3445304655633 2290 1909 8.736767006471e-13 2290 1910.83461913789 -37.3445304655616 2290 1916.32080816637 -74.3294126881438 2290 1925.40573208603 -110.598462033949 2290 1938.0018981132 -145.802387731098 2290 1953.98799828328 -179.602156730704 2290 1973.21007771273 -211.672258780467 2290 1995.4830172688 -241.703841266348 2290 2020.59231636792 -269.407683632073 2290 2048.29615873365 -294.516982731201 2290 2078.32774121953 -316.789922287269 2290 2110.39784326929 -336.012001716722 2290 2144.1976122689 -351.998101886799 2290 2179.40153796605 -364.594267913971 2290 2215.67058731185 -373.67919183363 2290 2252.65546953443 -379.165380862107 1800.91232914861 1952.54743192163 -261.458064027986 1713.96168056775 1898.94385058741 -227.51742343876 1807.83230237768 1924.92135021348 -227.51742343876 1387.37506907458 1688.69247096195 66.1599556911012 1305.60210812986 1642.36866077423 66.1599556911012 1300.34913496681 1651.13271702641 109.272031662926 1382.55845520572 1697.70372170098 109.272031662926 247.365489300779 100.34819874105 -291.862932828329 374.439896793223 905.992454919547 -340.474035963219 367.741987799834 796.225339033655 -318.320856148327 409.126357387429 889.586980858145 -318.320856148327 294.706311806842 826.477706567039 -358.02288851943 332.29233010807 810.909068031068 -340.474035963219 1308.24647497398 1637.95680123222 22.1531798148923 839.640622285915 1600.2249770181 -358.02288851943 762.868325651687 1527.13167434831 -358.02288851943 791.635418636589 1498.36458136341 -340.474035963219 2102.82209807589 1900.44913103066 22.1531798148922 2009.79694301894 1888.97557248959 22.1531798148923 2102.31793178039 1905.5680173325 66.1599556911012 279.55394828162 98.7668811523874 -261.458064027986 299.293218655982 941.534186703704 370.730095690913 255.492219315464 842.720715513121 370.730095690913 259.84923102184 960.189803475346 378.42381429968 732.855158628323 1557.14484137168 -370.730095690912 866.961529697537 1570.08100090662 -340.474035963219 1589.05447937367 1959.01149386646 318.320856148329 1479.09093196893 1957.70766989193 340.47403596322 1576.12786982955 1995.13894732538 340.47403596322 1493.77466096635 1922.25801220017 318.320856148329 866.961529697536 1570.08100090662 340.47403596322 791.635418636587 1498.36458136341 340.47403596322 839.640622285914 1600.2249770181 358.022888519431 1548.12294369475 2073.40747257955 -370.730095690912 1447.27928448688 2034.50778068453 -370.730095690912 1562.42224290579 2033.44360850689 -358.02288851943 417.04869366033 372.553178330847 -22.1531798148902 401.024427510413 280.203056981058 -22.1531798148902 417.04869366033 372.553178330847 22.1531798148923 1907.61432221938 1922.38261912983 -190.499999999998 1813.74807822663 1901.30424916987 -190.499999999998 1818.57965597551 1882.01550956766 -150.906390860917 689.416010985615 1069.47602965507 -109.272031662924 638.867282973588 989.650865033194 -109.272031662924 697.91175937181 1063.79935207028 -66.1599556910992 394.793592515869 678.115695669767 261.458064027988 363.802891522487 584.305504830706 261.458064027988 332.963309151077 593.660589866908 291.862932828331 1911.49362652827 1902.88003937575 -150.906390860917 1212.10504377707 1613.18380303131 -150.906390860917 1143.27526715353 1546.17931397822 -109.272031662924 1220.52397034493 1600.58398901439 -109.272031662924 391.056149412585 576.038319432249 227.517423438762 837.702954492288 1316.28531577079 190.5 774.865250690497 1243.43895400581 190.5 756.044964308267 1258.88436387703 227.517423438762 2195.54443271938 1922.68724178054 109.272031662926 1134.24823798066 1558.35085382034 -150.906390860917 364.450190037901 688.972738680533 291.862932828331 790.236299092902 1230.82426058915 150.906390860919 2194.80087749905 1937.82265599524 150.906390860919 1460.47485389725 1753.88356255385 150.906390860919 1375.41506580904 1711.06806327636 150.906390860919 819.663208310651 1332.63558865234 227.517423438762 1451.97306713974 1771.85908037436 190.5 315.164321799966 194.504337345719 -227.51742343876 307.999222381796 97.3694544450168 -227.51742343876 339.393827982857 192.117939279115 -190.499999999998 2101.31641717366 1915.73656578032 109.272031662926 1674.88458817955 2027.76376028118 -340.474035963219 1576.12786982955 1995.13894732537 -340.474035963219 1589.05447937367 1959.01149386645 -318.320856148327 486.38465605175 964.052486312057 -291.862932828329 441.253376289662 874.392032562995 -291.862932828329 1686.02293693576 1991.04554525488 -318.320856148327 432.595558031156 465.255592514604 66.1599556911012 412.003873133698 373.556655524805 66.1599556911012 401.982454623748 375.550039605121 109.272031662926 970.057810075313 1608.35421199555 -318.320856148327 892.72953757239 1541.65038540336 -318.320856148327 992.603613644904 1580.88207085879 -291.862932828329 470.386490682652 860.613095643098 -261.458064027986 514.806577943211 948.860652555947 -261.458064027986 422.68402147955 467.738303176241 109.272031662926 367.741987799832 796.225339033656 318.320856148329 330.988506133544 700.945520626331 318.320856148329 294.861052674624 713.872130170456 340.47403596322 892.980121080684 1702.27364777968 370.730095690913 781.833986344935 1664.0047712481 378.42381429968 865.299482553125 1736.00260341603 378.42381429968 811.136283741688 1631.6746681724 370.730095690913 1663.07499092373 2066.69478505911 358.022888519431 1548.12294369475 2073.40747257955 370.730095690913 1650.75384971202 2107.31214426408 370.730095690913 1562.42224290578 2033.44360850689 358.022888519431 2007.54295690571 1904.17071259444 -109.272031662924 1914.44996039488 1888.01754537625 -109.272031662924 2009.04221216785 1894.06355460111 -66.1599556910992 756.159081496366 1137.57395510262 -22.1531798148902 702.188551704674 1060.94169079464 22.1531798148923 756.159081496366 1137.57395510262 22.1531798148922 1793.08173930623 1983.80889893132 -291.862932828329 1696.33941013309 1957.03669084892 -291.862932828329 1705.6944951693 1926.19710847751 -261.458064027986 332.292330108068 810.909068031068 340.47403596322 370.839635503615 284.680547912026 -150.906390860917 359.18273579965 190.168901977333 -150.906390860917 374.263434219676 188.683582826338 -109.272031662924 385.829287405564 282.457043094294 -109.272031662924 702.188551704674 1060.94169079464 -22.1531798148902 1305.60210812986 1642.36866077423 -66.1599556910992 1226.20064792972 1592.08824062819 -66.1599556910992 215.180355963744 859.418436037934 -378.42381429968 175.509903160867 756.576654311944 -378.42381429968 255.492219315466 842.72071551312 -370.730095690912 1229.05830920536 1587.81144829533 -22.1531798148902 1308.24647497398 1637.95680123222 -22.1531798148902 866.685518994028 1423.31448100597 261.458064027988 798.561232200713 1351.76130496029 261.458064027988 774.682394189262 1373.40382219143 291.862932828331 843.897392075855 1446.10260792415 291.862932828331 433.382960448072 563.198621676959 150.906390860919 407.98449043234 471.420344024494 150.906390860919 414.354529260931 568.970833171829 190.5 2102.82209807589 1900.44913103066 -22.1531798148902 2009.79694301894 1888.97557248959 -22.1531798148902 1530.60641664212 1833.33828812169 227.517423438762 1441.56349341725 1793.86827482838 227.517423438762 1519.70775359796 1859.64998825464 261.458064027988 1533.42334568806 2114.49009683913 -378.42381429968 1430.58156396207 2074.81964403626 -378.42381429968 211.869139128205 102.092022603342 -318.320856148327 587.931011355439 1020.18089132887 -227.51742343876 539.923324263299 935.435471949009 -227.51742343876 608.813908874112 1007.66416424773 -190.499999999998 1902.86450840409 1946.26154570368 -227.51742343876 809.848669786784 1214.72880392282 66.1599556911012 743.820686021777 1146.72473284647 109.272031662926 801.950242454627 1221.21087571522 109.272031662926 752.027659539979 1140.63802645346 66.1599556911012 337.663069382515 923.386598853846 358.022888519431 294.70631180684 826.47770656704 358.022888519431 1090.93435819337 1616.75286000101 -261.458064027986 1013.04838246935 1555.97004796637 -261.458064027986 1031.11563612298 1533.95503569173 -227.51742343876 1107.89962359611 1593.87784765454 -227.51742343876 1744.32274161935 2178.46572916969 378.42381429968 2196.04579393428 1912.4817998021 66.1599556911012 1638.08778684257 2149.06655779127 378.42381429968 412.003873133698 373.556655524805 -66.1599556910992 395.936445398895 280.957787832148 -66.1599556910992 1663.07499092373 2066.6947850591 -358.02288851943 1389.79977097584 1684.15617276687 22.1531798148922 337.663069382517 923.386598853845 -358.02288851943 892.729537572388 1541.65038540336 318.320856148329 818.767411999891 1471.23258800011 318.320856148329 2005.31945208798 1919.16036449639 -150.906390860917 421.60837110255 668.521214475671 227.517423438762 811.13628374169 1631.6746681724 -370.730095690912 286.821879756773 197.295824237122 -261.458064027986 676.816196968693 1077.89495622293 -150.906390860917 625.869548837438 997.441407064533 -150.906390860917 852.436514125411 1302.93159570773 150.906390860919 1601.02726131947 1925.5498099621 291.862932828331 1784.44642814492 2018.28299352979 -318.320856148327 1507.37490818021 1889.42411092483 291.862932828331 309.408917102613 1058.64798957349 378.42381429968 2102.31793178039 1905.5680173325 -66.1599556910992 1201.05771976543 1629.71729180915 -190.499999999998 1122.40296111176 1574.32236079008 -190.499999999998 455.041916325151 980.805529727131 -318.320856148327 437.585063558378 464.005786442232 22.1531798148923 919.906961697533 1669.4631975551 358.022888519431 400.575889075169 782.625091819792 291.862932828331 1466.95388160854 1740.18480940868 109.272031662926 945.715865076894 1638.01495779579 -340.474035963219 1897.30841816603 1974.19389757929 -261.458064027986 752.027659539979 1140.63802645346 -66.1599556910992 351.170199020514 287.59823319707 -190.499999999998 2196.29818109342 1907.34434115539 22.1531798148923 1674.88458817955 2027.76376028118 340.47403596322 447.88411608517 558.799744205972 109.272031662926 1650.75384971202 2107.31214426407 -370.730095690912 2002.40176680293 1938.82980097949 -190.499999999998 886.823622430507 1403.17637756949 227.517423438762 173.544925006565 103.974770513029 -340.474035963219 563.503261646085 1034.82232104641 -261.458064027986 1300.34913496681 1651.13271702641 -109.272031662924 374.439896793221 905.992454919548 340.47403596322 952.197207096871 1803.81825325647 378.42381429968 1775.12317343438 2055.50351272734 -340.474035963219 1539.92351159151 1810.84483113298 190.5 813.824768409331 1211.46570411305 22.1531798148923 401.982454623749 375.550039605121 -109.272031662924 1071.73659101447 1642.63805252922 -291.862932828329 299.293218655985 941.534186703703 -370.730095690912 2101.31641717366 1915.73656578032 -109.272031662924 444.531901917881 660.319043997216 190.5 1891.02118809429 2005.80193761506 -291.862932828329 916.596177808566 1515.31760581074 291.862932828331 1754.92475569668 2136.14011641432 370.730095690913 2196.29818109342 1907.34434115539 -22.1531798148902 660.282708190846 1088.94228023457 -190.499999999998 1389.79977097584 1684.15617276687 -22.1531798148902 254.749784760911 200.454649881868 -291.862932828329 1638.08778684257 2149.06655779127 -378.42381429968 347.890004998079 1038.07941956986 370.730095690913 781.833986344937 1664.00477124809 -378.42381429968 702.001794163384 1587.99820583662 -378.42381429968 863.664641091168 1292.75501461893 109.272031662926 1998.82935773881 1962.9130266579 -227.51742343876 421.20221555025 998.893226628558 -340.474035963219 437.585063558378 464.005786442232 -22.1531798148902 1611.88430433023 1895.20640748413 261.458064027988 430.350011745356 770.29224640204 261.458064027988 1765.23805620069 2094.96711285302 -358.02288851943 1187.53139441577 1649.96086827514 -227.51742343876 2099.83109802267 1930.81726420035 -150.906390860917 945.715865076892 1638.01495779579 340.47403596322 1471.32253253851 1730.94807307514 66.1599556911012 327.086973342096 291.170642261187 -227.51742343876 457.661892918731 555.833688030458 66.1599556911012 743.820686021778 1146.72473284647 -109.272031662924 1884.08784218993 2040.65822129257 -318.320856148327 919.906961697535 1669.4631975551 -358.02288851943 2196.04579393428 1912.4817998021 -66.1599556910992 132.911116187283 105.970981534455 -358.02288851943 904.039369082904 1385.9606309171 190.5 1994.65053559981 1991.08435721873 -261.458064027986 535.861003155457 1051.39045318057 -291.862932828329 409.126357387427 889.586980858146 318.320856148329 1686.02293693576 1991.04554525488 318.320856148329 978.189501672486 1768.77170106789 370.730095690913 1292.55859293547 1664.13045116256 -150.906390860917 387.119960624246 378.506373471728 -150.906390860917 1754.92475569668 2136.14011641432 -370.730095690912 1547.53304072024 1792.4738027071 150.906390860919 813.824768409331 1211.46570411305 -22.1531798148902 463.254183532531 653.620104519432 150.906390860919 259.849231021843 960.189803475345 -378.42381429968 2097.88206072089 1950.60617201714 -190.499999999998 219.381756878036 203.938096582028 -318.320856148327 938.238695039712 1491.43876779929 261.458064027988 1876.60214206229 2078.29137717049 -340.474035963219 1050.56593892705 1671.18337241585 -318.320856148327 385.323177628565 1018.0709719449 358.022888519431 640.039131724859 1102.46860558423 -227.51742343876 2195.54443271938 1922.68724178054 -109.272031662924 1765.23805620069 2094.96711285303 358.022888519431 1989.92181178663 2022.96282374358 -291.862932828329 432.595558031156 465.255592514604 -66.1599556910992 871.235494234017 1285.89319330585 66.1599556911012 1387.37506907458 1688.69247096195 -66.1599556910992 385.323177628568 1018.0709719449 -358.02288851943 456.661711878309 759.393583357877 227.517423438762 1744.32274161935 2178.46572916968 -378.42381429968 970.057810075312 1608.35421199555 318.320856148329 2095.49566265428 1974.83567820003 -227.51742343876 298.915642781273 295.349464400196 -261.458064027986 1621.47878552433 1868.39162889745 227.517423438762 363.740020581376 1154.55579993814 378.42381429968 1868.66531896398 2118.19248137464 -358.02288851943 1171.70898807425 1673.64077278509 -261.458064027986 731.649146179664 1155.75176201934 -150.906390860917 462.5840632907 554.340563971971 22.1531798148923 2194.80087749905 1937.82265599524 -150.906390860917 1851.87228070725 2202.61678579547 378.42381429968 90.5172152279965 108.053660338024 -370.730095690912 1473.52172817765 1726.29826456667 22.1531798148922 918.099945511082 1371.90005448892 150.906390860919 505.378050009792 1069.66123216659 -318.320856148327 1984.70713417682 2058.11732465971 -318.320856148327 441.25337628966 874.392032562995 291.862932828331 892.980121080686 1702.27364777967 -370.730095690912 1696.33941013309 1957.03669084892 291.862932828331 2092.70417576288 2003.17812024323 -261.458064027986 1003.4739752444 1734.67953502148 358.022888519431 367.617380870166 382.385677780623 -190.499999999998 809.848669786784 1214.72880392282 -66.1599556910992 1860.38470481192 2159.82193992035 -370.730095690912 2193.82518358211 1957.68336193349 -190.499999999998 1282.33583575227 1681.18609112589 -190.499999999998 477.522029205436 648.514987706834 109.272031662926 957.364411347663 1470.33679168935 227.517423438762 1979.07702233935 2096.07245564922 -340.474035963219 181.196088011981 207.699056696778 -340.474035963219 1553.33209820089 1778.47363948833 109.272031662926 616.359227214907 1118.29101192575 -261.458064027986 2089.54535011813 2035.25021523909 -291.862932828329 1042.31781574641 1867.28834692899 378.42381429968 1027.70869868266 1702.00279317846 -340.474035963219 421.202215550248 998.893226628559 340.47403596322 1851.87228070725 2202.61678579547 -378.42381429968 422.68402147955 467.73830317624 -109.272031662924 2192.63054555499 1982.0007776182 -227.51742343876 875.046690752876 1282.4389261304 22.1531798148923 347.890004998082 1038.07941956986 -370.730095690912 479.155168867025 750.076488408495 190.5 1775.12317343438 2055.50351272734 340.47403596322 1973.10761387844 2136.31493867687 -358.02288851943 267.037176256419 300.078188213368 -291.862932828329 992.603613644903 1580.88207085879 291.862932828331 1382.55845520572 1697.70372170098 -109.272031662924 1629.68095600279 1845.46809808212 190.5 715.677639209924 1167.59703888824 -190.499999999998 2086.06190341797 2070.61824312196 -318.320856148327 401.165504426881 1132.12382818926 370.730095690913 2191.23311884761 2010.44605171838 -261.458064027986 928.815206539543 1361.18479346046 109.272031662926 1153.80447164356 1700.43677525301 -291.862932828329 462.5840632907 554.340563971971 -22.1531798148902 46.9365269131249 110.194642265718 -378.42381429968 472.466631857371 1089.38757706191 -340.474035963219 1966.87963480313 2178.30056319505 -370.730095690912 2082.30094330322 2108.80391198802 -340.474035963219 1860.38470481192 2159.82193992035 370.730095690913 470.38649068265 860.613095643099 261.458064027988 1027.70869868266 1702.00279317847 340.47403596322 1473.52172817765 1726.29826456667 -22.1531798148902 2189.65180125895 2042.63451069922 -291.862932828329 801.950242454627 1221.21087571522 -109.272031662924 343.73845429632 387.135491595911 -227.51742343876 487.142490800128 645.072731506566 66.1599556911012 865.299482553127 1736.00260341603 -378.42381429968 1960.47730784638 2221.46154565783 -378.42381429968 973.714684229213 1452.29704550771 190.5 140.709173827261 211.686669692432 -358.02288851943 2078.31333030757 2149.29082617274 -358.02288851943 1705.6944951693 1926.19710847751 261.458064027988 589.563224746992 1136.19552835644 -291.862932828329 455.041916325149 980.805529727132 318.320856148329 2187.90797739666 2078.1308608718 -318.320856148327 1269.81910867113 1702.06898864456 -227.51742343876 1066.55914865579 1831.00862840212 370.730095690913 1557.24226172922 1769.03366966714 66.1599556911012 2074.15299005609 2191.53146961642 -370.730095690912 407.984490432341 471.420344024494 -150.906390860917 2186.02522948697 2116.45507499344 -340.474035963219 1003.4739752444 1734.67953502148 -358.02288851943 875.046690752876 1282.4389261304 -22.1531798148902 309.408917102616 1058.64798957349 -378.42381429968 2069.87618401369 2234.95461007964 -378.42381429968 497.526197292897 742.466959279758 150.906390860919 1784.44642814492 2018.28299352979 318.320856148329 1013.04838246935 1555.97004796637 261.458064027988 2184.02901846555 2157.08888381272 -358.02288851943 231.882675340285 305.29286582318 -318.320856148327 437.571819169695 1110.30272289205 358.022888519431 1375.41506580904 1711.06806327636 -150.906390860917 2181.94633966198 2199.482784772 -370.730095690912 696.122152345458 1182.10037640389 -227.51742343876 2179.80535773428 2243.06347308688 -378.42381429968 1636.37989548057 1826.74581646747 150.906390860919 457.661892918731 555.833688030458 -66.1599556910992 936.040246644734 1353.95975335527 66.1599556911012 437.571819169697 1110.30272289205 -358.02288851943 1134.05997299351 1729.98650571362 -318.320856148327 496.131725171621 848.436506582753 227.517423438762 315.806102420706 392.691581833971 -261.458064027986 1050.56593892705 1671.18337241585 318.320856148329 1868.66531896398 2118.19248137464 358.022888519431 422.711653071005 1247.68218425359 378.42381429968 1471.32253253851 1730.94807307514 -66.1599556910992 491.985468077286 643.339886528603 22.1531798148923 790.236299092903 1230.82426058915 -150.906390860917 98.4685303835754 215.84700994391 -370.730095690912 987.06840429227 1437.56348587459 150.906390860919 1713.96168056775 1898.94385058742 227.517423438762 560.013494286381 1155.94002700649 -318.320856148327 486.384656051749 964.052486312057 291.862932828331 1255.17767895359 1726.49673835392 -261.458064027986 1090.14034267128 1795.71687754801 358.022888519431 388.695750830132 476.251921773373 -190.499999999998 1960.47730784638 2221.46154565783 378.42381429968 871.235494234017 1285.89319330585 -66.1599556910992 511.526360511667 736.667901799106 109.272031662926 1031.11563612297 1533.95503569173 227.517423438762 1559.21065305133 1764.28155264125 22.1531798148923 193.927544350784 310.922977660655 -340.474035963219 673.247139998987 1199.06564180663 -261.458064027986 978.189501672488 1768.77170106788 -370.730095690912 1793.08173930623 1983.80889893132 291.862932828331 472.466631857369 1089.38757706191 340.47403596322 1135.44420006186 1926.25997941862 378.42381429968 1366.04150297173 1728.60476589459 -190.499999999998 447.884116085171 558.799744205972 -109.272031662924 518.140919625643 838.026932860258 190.5 939.677359553672 1350.32264044633 22.1531798148923 401.165504426883 1132.12382818926 -370.730095690912 1641.48501229317 1812.47797079456 109.272031662926 284.198062384941 398.978811905716 -291.862932828329 1071.73659101447 1642.63805252922 291.862932828331 1112.74250259697 1761.89035475453 -340.474035963219 458.99137159788 1223.44085134421 370.730095690913 774.865250690498 1243.43895400581 -190.499999999998 491.985468077286 643.339886528603 -22.1531798148902 997.244985381071 1426.33535890883 109.272031662926 1876.60214206229 2078.29137717049 340.47403596322 55.0453899203567 220.123815986308 -378.42381429968 1466.95388160854 1740.18480940868 -109.272031662924 514.806577943209 948.860652555948 261.458064027988 528.109645245468 1177.25749740303 -340.474035963219 1721.02916682817 1875.64547073907 190.5 365.078649786522 482.167697622317 -227.51742343876 1112.74250259697 1761.89035475453 340.47403596322 1238.60954681943 1754.13899684454 -291.862932828329 520.966330332855 732.757738270777 66.1599556911012 863.664641091169 1292.75501461893 -109.272031662924 153.685061323131 316.892386121557 -358.02288851943 1966.87963480312 2178.30056319506 370.730095690913 1046.56104599419 1515.1347493095 190.5 1559.21065305133 1764.28155264125 -22.1531798148902 505.37805000979 1069.66123216659 318.320856148329 647.361947470782 1218.26340898553 -291.862932828329 433.382960448073 563.198621676959 -150.906390860917 952.197207096873 1803.81825325647 -378.42381429968 1157.87617181074 1888.83449557312 370.730095690913 1800.91232914861 1952.54743192163 261.458064027988 939.677359553672 1350.32264044633 -22.1531798148902 536.116437446146 829.525146102753 150.906390860919 249.341778707427 405.912157810068 -318.320856148327 1354.56452805099 1750.0766757367 -227.51742343876 363.740020581379 1154.55579993814 -378.42381429968 1090.93435819337 1616.75286000101 261.458064027988 1644.92726849343 1802.85750919987 66.1599556911012 494.283122451991 1199.85965732873 358.022888519431 487.142490800128 645.072731506566 -66.1599556910992 756.044964308268 1258.88436387703 -227.51742343876 1090.14034267128 1795.71687754801 -358.02288851943 1004.10680669415 1418.76450576598 66.1599556911012 539.923324263298 935.43547194901 227.517423438762 1884.08784218993 2040.65822129258 318.320856148329 494.283122451993 1199.85965732872 -358.02288851943 337.452568078369 489.087670851389 -261.458064027986 1460.47485389725 1753.88356255385 -150.906390860917 486.18174674353 1337.80279290313 378.42381429968 1134.05997299351 1729.98650571362 318.320856148329 1726.80137832304 1856.61703955193 150.906390860919 852.436514125412 1302.93159570773 -150.906390860917 525.718447358747 730.789346948669 22.1531798148923 111.699436804946 323.120365196877 -370.730095690912 1059.17573941085 1499.7637009071 150.906390860919 1220.33876783341 1784.62194999021 -318.320856148327 535.861003155455 1051.39045318057 291.862932828331 618.816627584155 1239.43406107295 -318.320856148327 1973.10761387844 2136.31493867687 358.022888519431 1179.69727710795 1852.42818083031 358.022888519431 1557.24226172922 1769.03366966714 -66.1599556910992 414.354529260932 568.970833171829 -190.499999999998 549.815190591318 823.046118391457 109.272031662926 936.040246644734 1353.95975335527 -66.1599556910992 211.708622829509 413.397857937712 -340.474035963219 1807.83230237768 1924.92135021348 227.517423438762 1107.89962359611 1593.87784765454 227.517423438762 1341.13934744405 1775.19342205679 -261.458064027986 734.029952033635 1276.95161753065 -261.458064027986 528.109645245466 1177.25749740303 340.47403596322 2069.87618401369 2234.95461007965 378.42381429968 1231.35201042651 1980.59108289739 378.42381429968 477.522029205437 648.514987706834 -109.272031662924 561.395234105409 923.95849702827 190.5 1646.6601134714 1798.01453192271 22.1531798148923 1007.5610738696 1414.95330924712 22.1531798148923 1066.55914865579 1831.00862840212 -370.730095690912 306.191101068679 496.918260693767 -291.862932828329 458.991371597882 1223.44085134421 -370.730095690912 1891.02118809428 2005.80193761506 291.862932828331 521.228298932115 1311.81049832751 370.730095690913 1153.80447164356 1700.43677525301 291.862932828331 525.718447358747 730.789346948669 -22.1531798148902 1451.97306713974 1771.85908037436 -190.499999999998 68.5384543421742 329.522692153617 -378.42381429968 837.702954492288 1316.28531577079 -190.499999999998 563.503261646083 1034.82232104641 261.458064027988 1068.78912428478 1488.04975754537 109.272031662926 1731.20025579403 1842.11588391483 109.272031662926 1200.61242293809 1817.53336814263 -340.474035963219 587.997206821537 1262.29130131734 -340.474035963219 391.056149412585 576.038319432249 -227.51742343876 559.05192692486 818.677467461496 66.1599556911012 1979.07702233935 2096.07245564922 340.47403596322 1200.61242293809 1817.53336814263 340.47403596322 171.807518625363 421.334681036021 -358.02288851943 928.815206539544 1361.18479346046 -109.272031662924 560.013494286379 1155.94002700649 318.320856148329 1553.3320982009 1778.47363948833 -109.272031662924 1122.40296111176 1574.32236079008 190.5 1813.74807822663 1901.30424916987 190.5 709.117929141215 1297.3963863551 -291.862932828329 463.254183532532 653.620104519432 -150.906390860917 1325.94751368794 1803.61534394825 -291.862932828329 578.931936723644 914.584934190966 150.906390860919 1251.92058043014 1942.10999500192 370.730095690913 1007.5610738696 1414.95330924712 -22.1531798148902 271.717006470213 505.553571855084 -318.320856148327 2074.15299005609 2191.53146961643 370.730095690913 46.9365269131217 110.194642265719 378.42381429968 555.320464978522 1286.5260247556 358.022888519431 422.711653071008 1247.68218425359 -378.42381429968 1646.6601134714 1798.01453192271 -22.1531798148902 1171.70898807425 1673.64077278509 261.458064027988 520.966330332856 732.757738270777 -66.1599556910992 1042.31781574641 1867.28834692899 -378.42381429968 90.5172152279938 108.053660338024 370.730095690913 819.663208310651 1332.63558865234 -227.51742343876 1897.30841816603 1974.1938975793 261.458064027988 587.931011355438 1020.18089132887 227.517423438762 1075.27119607718 1480.15133021322 66.1599556911012 132.911116187281 105.970981534455 358.022888519431 1441.56349341725 1793.86827482838 -227.51742343876 363.802891522488 584.305504830705 -261.458064027986 555.320464978524 1286.5260247556 -358.02288851943 55.0453899203535 220.123815986308 378.42381429968 1734.16631196954 1832.33810708127 66.1599556911012 553.997396583968 1424.70051744688 378.42381429968 173.544925006563 103.974770513029 340.47403596322 1220.33876783341 1784.62194999021 318.320856148329 563.701735433334 816.478271822348 22.1531798148923 1179.69727710795 1852.4281808303 -358.02288851943 918.099945511083 1371.90005448892 -150.906390860917 130.178060079649 429.615295188082 -370.730095690912 98.4685303835727 215.84700994391 370.730095690913 1134.24823798066 1558.35085382034 150.906390860919 589.56322474699 1136.19552835644 291.862932828331 1984.70713417682 2058.11732465972 318.320856148329 211.869139128202 102.092022603342 318.320856148329 1547.53304072024 1792.4738027071 -150.906390860917 444.531901917882 660.319043997215 -190.499999999998 681.645788004455 1319.94218992469 -318.320856148327 1271.9290280551 1904.67682237144 358.022888519431 592.296278299022 907.441544794277 109.272031662926 140.709173827258 211.686669692432 358.022888519431 1818.57965597551 1882.01550956766 150.906390860919 234.496487272664 514.876826565621 -340.474035963219 1004.10680669415 1418.76450576598 -66.1599556910992 68.538454342171 329.522692153618 378.42381429968 587.997206821535 1262.29130131734 340.47403596322 1309.19447027287 1834.95808367485 -318.320856148327 2078.31333030757 2149.29082617274 358.022888519431 247.365489300777 100.34819874105 291.862932828331 1187.53139441577 1649.96086827514 227.517423438762 798.561232200714 1351.76130496029 -261.458064027986 1644.92726849343 1802.85750919987 -66.1599556910992 511.526360511667 736.667901799106 -109.272031662924 181.196088011979 207.699056696778 340.47403596322 608.813908874111 1007.66416424773 190.5 1329.81019652465 2030.15076897816 378.42381429968 1078.53429588695 1476.17523159067 22.1531798148923 332.963309151079 593.660589866908 -291.862932828329 1902.86450840409 1946.26154570368 227.517423438762 111.699436804944 323.120365196877 370.730095690913 279.553948281618 98.7668811523875 261.458064027988 1429.3869043569 1819.61350931735 -261.458064027986 587.726352220325 1397.01987891932 370.730095690913 521.228298932117 1311.81049832751 -370.730095690912 1238.60954681943 1754.13899684455 291.862932828331 2179.80535773428 2243.06347308688 378.42381429968 563.701735433334 816.478271822348 -22.1531798148902 87.3832142045321 438.12771929275 -378.42381429968 904.039369082905 1385.9606309171 -190.499999999998 616.359227214906 1118.29101192575 261.458064027988 219.381756878033 203.938096582028 318.320856148329 1735.65943602803 1827.4159367093 22.1531798148923 1143.27526715353 1546.17931397822 109.272031662926 153.685061323129 316.892386121558 358.022888519431 1157.87617181074 1888.83449557312 -370.730095690912 1989.92181178663 2022.96282374358 291.862932828331 307.999222381795 97.3694544450169 227.517423438762 421.608371102551 668.52121447567 -227.51742343876 601.307529038048 902.624930925423 66.1599556911012 651.985042204212 1344.28413492311 -340.474035963219 1539.92351159151 1810.84483113297 -190.499999999998 87.3832142045294 438.12771929275 378.42381429968 195.032887146976 524.76194379931 -358.02288851943 1291.10677337144 1868.79778444975 340.47403596322 1822.26169682376 1867.31597852045 109.272031662926 997.244985381072 1426.33535890883 -109.272031662924 254.749784760909 200.454649881869 291.862932828331 618.816627584153 1239.43406107296 318.320856148329 1201.05771976543 1629.71729180916 190.5 1291.10677337144 1868.79778444975 -340.474035963219 497.526197292898 742.466959279757 -150.906390860917 625.869548837437 997.441407064533 150.906390860919 774.682394189264 1373.40382219143 -291.862932828329 193.927544350781 310.922977660656 340.47403596322 332.316638066509 96.1748164178922 190.5 1348.4658132963 1990.70678134402 370.730095690913 2082.30094330322 2108.80391198802 340.47403596322 1078.53429588695 1476.17523159067 -22.1531798148902 298.954454745124 603.977063064239 -318.320856148327 620.536802444902 1370.09303830247 358.022888519431 1641.48501229317 1812.47797079456 -109.272031662924 1907.61432221938 1922.38261912984 190.5 130.178060079646 429.615295188083 370.730095690913 486.181746743532 1337.80279290313 -378.42381429968 286.821879756772 197.295824237122 261.458064027988 559.05192692486 818.677467461496 -66.1599556910992 1415.60796743701 1848.74662371034 -291.862932828329 1255.17767895359 1726.49673835392 261.458064027988 640.039131724858 1102.46860558423 227.517423438762 2181.94633966198 2199.48278477201 370.730095690913 886.823622430508 1403.17637756949 -227.51742343876 231.882675340283 305.292865823181 318.320856148329 394.79359251587 678.115695669767 -261.458064027986 352.177344004761 95.1991225009481 150.906390860919 1149.36197354655 1537.97234046002 66.1599556911012 1735.65943602803 1827.4159367093 -22.1531798148902 625.995228751905 1508.16601365507 378.42381429968 620.536802444904 1370.09303830247 -358.02288851943 605.843827233131 900.200229024157 22.1531798148923 1135.44420006186 1926.25997941862 -378.42381429968 171.80751862536 421.334681036022 358.022888519431 1309.19447027287 1834.95808367485 318.320856148329 1994.65053559981 1991.08435721873 261.458064027988 153.859883585679 535.075244303325 -370.730095690912 647.36194747078 1218.26340898553 291.862932828331 1530.60641664212 1833.33828812169 -227.51742343876 987.068404292271 1437.56348587459 -150.906390860917 315.164321799964 194.504337345719 227.517423438762 111.534270830313 545.677258380651 378.42381429968 479.155168867026 750.076488408495 -190.499999999998 1212.10504377707 1613.18380303131 150.906390860919 267.037176256417 300.078188213368 291.862932828331 1824.7444074854 1857.40444196884 66.1599556911012 748.349614596642 1397.27046242761 -318.320856148327 638.867282973587 989.650865033195 109.272031662926 1271.9290280551 1904.67682237143 -358.02288851943 1366.61340114615 1952.33693061749 358.022888519431 367.312758219457 94.4555672806241 109.272031662926 262.236239718822 615.115411820449 -340.474035963219 2086.06190341797 2070.61824312197 318.320856148329 1075.27119607718 1480.15133021322 -66.1599556910992 651.98504220421 1344.28413492311 340.47403596322 211.708622829507 413.397857937712 340.47403596322 1636.37989548057 1826.74581646747 -150.906390860917 549.815190591318 823.046118391456 -109.272031662924 339.393827982856 192.117939279115 190.5 1269.81910867113 1702.06898864456 227.517423438762 660.282708190845 1088.94228023457 190.5 866.68551899403 1423.31448100597 -261.458064027986 1911.49362652827 1902.88003937575 150.906390860919 153.859883585676 535.075244303325 370.730095690913 1400.41301914186 1880.87364261257 -318.320856148327 1430.58156396207 2074.81964403626 378.42381429968 298.915642781272 295.349464400196 261.458064027988 364.450190037903 688.972738680533 -291.862932828329 2184.02901846555 2157.08888381272 358.022888519431 1152.42604489738 1533.84091850363 22.1531798148923 377.518200197903 93.954206065718 66.1599556911012 658.325331827599 1478.86371625831 370.730095690913 587.726352220327 1397.01987891932 -370.730095690912 1734.16631196954 1832.33810708127 -66.1599556910992 605.843827233131 900.200229024157 -22.1531798148902 1325.94751368794 1803.61534394825 291.862932828331 249.341778707425 405.912157810068 318.320856148329 111.534270830316 545.67725838065 -378.42381429968 1998.82935773881 1962.91302665791 227.517423438762 673.247139998986 1199.06564180663 261.458064027988 973.714684229214 1452.29704550771 -190.499999999998 359.182735799649 190.168901977333 150.906390860919 1519.70775359796 1859.64998825464 -261.458064027986 1220.52397034493 1600.58398901439 109.272031662926 195.032887146973 524.76194379931 358.022888519431 456.66171187831 759.393583357877 -227.51742343876 719.918999093381 1423.03847030246 -340.474035963219 647.631339225773 984.397891870143 66.1599556911012 1825.99421355777 1852.41493644162 22.1531798148923 327.086973342095 291.170642261187 227.517423438762 223.305214940898 626.925009076268 -358.02288851943 140.93344220873 651.912213157429 378.42381429968 1384.00754508045 1915.56010320678 340.47403596322 1251.92058043014 1942.10999500192 -370.730095690912 382.65565884461 93.7018189065844 22.1531798148923 681.645788004453 1319.94218992469 318.320856148329 2089.54535011813 2035.25021523909 291.862932828331 1068.78912428478 1488.04975754537 -109.272031662924 1629.68095600279 1845.46809808212 -190.499999999998 284.19806238494 398.978811905717 291.862932828331 1282.33583575227 1681.18609112589 190.5 536.116437446147 829.525146102753 -150.906390860917 676.816196968693 1077.89495622293 150.906390860919 843.897392075856 1446.10260792414 -291.862932828329 374.263434219675 188.683582826339 109.272031662926 1914.44996039488 1888.01754537625 109.272031662926 1384.00754508045 1915.56010320678 -340.474035963219 1447.27928448688 2034.50778068454 370.730095690913 330.988506133546 700.94552062633 -318.320856148327 2186.02522948697 2116.45507499344 340.47403596322 689.775022981898 1450.35937771409 358.022888519431 234.496487272661 514.876826565621 340.47403596322 1152.42604489738 1533.84091850363 -22.1531798148902 601.307529038048 902.624930925422 -66.1599556910992 351.170199020513 287.59823319707 190.5 1731.20025579403 1842.11588391483 -109.272031662924 553.99739658397 1424.70051744687 -378.42381429968 1341.13934744405 1775.19342205679 261.458064027988 182.687855735925 639.246150287985 370.730095690913 696.122152345457 1182.10037640389 227.517423438762 2002.40176680293 1938.82980097949 190.5 382.65565884461 93.7018189065844 -22.1531798148902 430.350011745358 770.29224640204 -261.458064027986 1507.37490818021 1889.42411092483 -291.862932828329 702.001794163382 1587.99820583662 378.42381429968 315.806102420704 392.691581833972 261.458064027988 957.364411347664 1470.33679168935 -227.51742343876 1226.20064792972 1592.08824062819 66.1599556911012 1825.99421355777 1852.41493644162 -22.1531798148902 652.043198767783 981.753525026019 22.1531798148923 384.431982667499 187.682068219607 66.1599556911012 689.7750229819 1450.35937771409 -358.02288851943 182.687855735927 639.246150287984 -370.730095690912 1231.35201042651 1980.59108289738 -378.42381429968 271.717006470211 505.553571855085 318.320856148329 2092.70417576288 2003.17812024323 261.458064027988 709.117929141214 1297.3963863551 291.862932828331 1400.41301914185 1880.87364261257 318.320856148329 1621.47878552433 1868.39162889745 -227.51742343876 518.140919625645 838.026932860257 -190.499999999998 1059.17573941085 1499.7637009071 -150.906390860917 370.839635503614 284.680547912026 150.906390860919 1916.4433444752 1877.9961268663 66.1599556911012 223.305214940895 626.925009076269 358.022888519431 689.416010985614 1069.47602965507 109.272031662926 1292.55859293547 1664.13045116256 150.906390860919 294.861052674626 713.872130170456 -340.474035963219 377.518200197903 93.954206065718 -66.1599556910992 1366.61340114616 1952.33693061748 -358.02288851943 818.767411999892 1471.23258800011 -318.320856148327 1463.52229343296 1995.29368819316 358.022888519431 2187.90797739666 2078.1308608718 318.320856148329 719.91899909338 1423.03847030246 340.47403596322 343.738454296319 387.135491595912 227.517423438762 175.509903160863 756.576654311945 378.42381429968 1726.80137832304 1856.61703955193 -150.906390860917 1149.36197354655 1537.97234046002 -66.1599556910992 592.296278299022 907.441544794276 -109.272031662924 715.677639209923 1167.59703888824 190.5 1354.56452805099 1750.0766757367 227.517423438762 389.550868969343 187.177901924113 22.1531798148923 2005.31945208798 1919.16036449639 150.906390860919 400.57588907517 782.625091819792 -291.862932828329 306.191101068677 496.918260693768 291.862932828331 938.238695039712 1491.43876779929 -261.458064027986 1493.77466096635 1922.25801220017 -318.320856148327 1533.42334568806 2114.49009683914 378.42381429968 385.829287405563 282.457043094294 109.272031662926 732.855158628321 1557.14484137168 370.730095690913 1824.7444074854 1857.40444196884 -66.1599556910992 652.043198767783 981.753525026019 -22.1531798148902 262.23623971882 615.11541182045 340.47403596322 1229.05830920536 1587.81144829533 22.1531798148923 140.933442208733 651.912213157428 -378.42381429968 658.325331827601 1478.86371625831 -370.730095690912 734.029952033634 1276.95161753065 261.458064027988 2095.49566265428 1974.83567820004 227.517423438762 1611.88430433023 1895.20640748413 -261.458064027986 367.312758219458 94.4555672806241 -109.272031662924 496.131725171622 848.436506582752 -227.51742343876 1415.60796743701 1848.74662371034 291.862932828331 367.617380870165 382.385677780623 190.5 1046.56104599419 1515.1347493095 -190.499999999998 697.911759371809 1063.79935207028 66.1599556911012 1917.44682166915 1872.95130633967 22.1531798148923 1348.4658132963 1990.70678134402 -370.730095690912 216.592527420449 741.87705630525 370.730095690913 389.550868969343 187.177901924113 -22.1531798148902 256.556391493111 727.577757094216 -358.02288851943 2189.65180125895 2042.63451069922 291.862932828331 748.349614596641 1397.27046242761 318.320856148329 1721.02916682817 1875.64547073907 -190.499999999998 337.452568078368 489.08767085139 261.458064027988 395.936445398894 280.957787832148 66.1599556911012 578.931936723645 914.584934190965 -150.906390860917 2007.54295690571 1904.17071259444 109.272031662926 1479.09093196893 1957.70766989193 -340.474035963219 731.649146179664 1155.75176201935 150.906390860919 298.954454745122 603.97706306424 318.320856148329 1366.04150297173 1728.60476589459 190.5 762.868325651685 1527.13167434832 358.022888519431 1822.26169682376 1867.31597852045 -109.272031662924 916.596177808567 1515.31760581074 -291.862932828329 352.177344004762 95.1991225009481 -150.906390860917 647.631339225774 984.397891870143 -66.1599556910992 387.119960624246 378.506373471728 150.906390860919 2097.88206072089 1950.60617201714 190.5 1601.02726131947 1925.5498099621 -291.862932828329 256.556391493109 727.577757094217 358.022888519431 1917.44682166915 1872.95130633967 -22.1531798148902 625.995228751907 1508.16601365506 -378.42381429968 384.431982667499 187.682068219607 -66.1599556910992 1429.3869043569 1819.61350931735 261.458064027988 1329.81019652466 2030.15076897816 -378.42381429968 365.078649786521 482.167697622318 227.517423438762 2191.23311884761 2010.44605171838 261.458064027988 215.180355963741 859.418436037936 378.42381429968 216.592527420452 741.87705630525 -370.730095690912 401.024427510413 280.203056981058 22.1531798148923 2009.04221216785 1894.06355460111 66.1599556911012 561.395234105411 923.958497028269 -190.499999999998 1463.52229343296 1995.29368819316 -358.02288851943 332.31663806651 96.1748164178921 -190.499999999998 2099.83109802267 1930.81726420035 150.906390860919 1916.4433444752 1877.9961268663 -66.1599556910992 388.695750830131 476.251921773373 190.5 2192.63054555499 1982.00077761821 227.517423438762 2193.82518358211 1957.68336193349 190.5 0 3.14159265358979 1.5707963267949 3.14159265358979 0.0402768288921768 3.14159265358979 0.0805536577843537 3.14159265358979 0.120830486676531 3.14159265358979 0.161107315568707 3.14159265358979 0.201384144460884 3.14159265358979 0.241660973353061 3.14159265358979 0.281937802245238 3.14159265358979 0.322214631137415 3.14159265358979 0.362491460029591 3.14159265358979 0.402768288921768 3.14159265358979 0.443045117813945 3.14159265358979 0.483321946706122 3.14159265358979 0.523598775598299 3.14159265358979 0.563875604490476 3.14159265358979 0.604152433382652 3.14159265358979 0.644429262274829 3.14159265358979 0.684706091167006 3.14159265358979 0.724982920059183 3.14159265358979 0.76525974895136 3.14159265358979 0.805536577843537 3.14159265358979 0.845813406735714 3.14159265358979 0.886090235627891 3.14159265358979 0.926367064520067 3.14159265358979 0.966643893412244 3.14159265358979 1.00692072230442 3.14159265358979 1.0471975511966 3.14159265358979 1.08747438008877 3.14159265358979 1.12775120898095 3.14159265358979 1.16802803787313 3.14159265358979 1.20830486676531 3.14159265358979 1.24858169565748 3.14159265358979 1.28885852454966 3.14159265358979 1.32913535344184 3.14159265358979 1.36941218233401 3.14159265358979 1.40968901122619 3.14159265358979 1.44996584011837 3.14159265358979 1.49024266901054 3.14159265358979 1.53051949790272 3.14159265358979 0 6.28318530717959 1.5707963267949 6.28318530717959 0.0402768288921768 6.28318530717959 0.0805536577843537 6.28318530717959 0.120830486676531 6.28318530717959 0.161107315568707 6.28318530717959 0.201384144460884 6.28318530717959 0.241660973353061 6.28318530717959 0.281937802245238 6.28318530717959 0.322214631137415 6.28318530717959 0.362491460029591 6.28318530717959 0.402768288921768 6.28318530717959 0.443045117813945 6.28318530717959 0.483321946706122 6.28318530717959 0.523598775598299 6.28318530717959 0.563875604490476 6.28318530717959 0.604152433382652 6.28318530717959 0.644429262274829 6.28318530717959 0.684706091167006 6.28318530717959 0.724982920059183 6.28318530717959 0.76525974895136 6.28318530717959 0.805536577843537 6.28318530717959 0.845813406735714 6.28318530717959 0.886090235627891 6.28318530717959 0.926367064520067 6.28318530717959 0.966643893412244 6.28318530717959 1.00692072230442 6.28318530717959 1.0471975511966 6.28318530717959 1.08747438008877 6.28318530717959 1.12775120898095 6.28318530717959 1.16802803787313 6.28318530717959 1.20830486676531 6.28318530717959 1.24858169565748 6.28318530717959 1.28885852454966 6.28318530717959 1.32913535344184 6.28318530717959 1.36941218233401 6.28318530717959 1.40968901122619 6.28318530717959 1.44996584011837 6.28318530717959 1.49024266901054 6.28318530717959 1.53051949790272 6.28318530717959 0 3.23976742401447 0 3.33794219443916 0 3.43611696486384 0 3.53429173528852 0 3.6324665057132 0 3.73064127613788 0 3.82881604656256 0 3.92699081698724 0 4.02516558741192 0 4.1233403578366 0 4.22151512826128 0 4.31968989868597 0 4.41786466911065 0 4.51603943953533 0 4.61421420996001 0 4.71238898038469 0 4.81056375080937 0 4.90873852123405 0 5.00691329165873 0 5.10508806208341 0 5.20326283250809 0 5.30143760293277 0 5.39961237335745 0 5.49778714378213 0 5.59596191420681 0 5.69413668463149 0 5.79231145505618 0 5.89048622548086 0 5.98866099590554 0 6.08683576633022 0 6.1850105367549 1.5707963267949 3.23976742401447 1.5707963267949 3.33794219443916 1.5707963267949 3.43611696486384 1.5707963267949 3.53429173528852 1.5707963267949 3.6324665057132 1.5707963267949 3.73064127613788 1.5707963267949 3.82881604656256 1.5707963267949 3.92699081698724 1.5707963267949 4.02516558741192 1.5707963267949 4.1233403578366 1.5707963267949 4.22151512826128 1.5707963267949 4.31968989868597 1.5707963267949 4.41786466911065 1.5707963267949 4.51603943953533 1.5707963267949 4.61421420996001 1.5707963267949 4.71238898038469 1.5707963267949 4.81056375080937 1.5707963267949 4.90873852123405 1.5707963267949 5.00691329165873 1.5707963267949 5.10508806208341 1.5707963267949 5.20326283250809 1.5707963267949 5.30143760293277 1.5707963267949 5.39961237335745 1.5707963267949 5.49778714378213 1.5707963267949 5.59596191420681 1.5707963267949 5.69413668463149 1.5707963267949 5.79231145505618 1.5707963267949 5.89048622548086 1.5707963267949 5.98866099590554 1.5707963267949 6.08683576633022 1.5707963267949 6.1850105367549 1.32535940073319 5.46869832291556 1.27627201552085 5.35234303944927 1.32535940073319 5.35234303944927 1.07992247467149 4.53785605518526 1.03083508945915 4.53785605518526 1.03083508945915 4.42150077171897 1.07992247467149 4.42150077171897 0.0490873852123405 5.58505360638185 0.441786466911065 5.81776417331443 0.392699081698724 5.70140888984814 0.441786466911065 5.70140888984814 0.392699081698724 5.93411945678071 0.392699081698724 5.81776417331443 1.03083508945915 4.65421133865154 0.834485548609789 5.93411945678071 0.785398163397449 5.93411945678071 0.785398163397449 5.81776417331443 1.47262155637022 4.65421133865154 1.42353417115788 4.65421133865154 1.47262155637022 4.53785605518526 0.0490873852123405 5.46869832291556 0.441786466911065 3.37430322052237 0.392699081698724 3.37430322052237 0.441786466911065 3.25794793705608 0.785398163397449 6.050474740247 0.834485548609789 5.81776417331443 1.22718463030851 3.72336907092124 1.17809724509617 3.60701378745495 1.22718463030851 3.60701378745495 1.17809724509617 3.72336907092124 0.834485548609789 3.60701378745495 0.785398163397449 3.60701378745495 0.834485548609789 3.49065850398866 1.22718463030851 6.050474740247 1.17809724509617 6.050474740247 1.22718463030851 5.93411945678071 0.196349540849362 4.77056662211783 0.147262155637022 4.77056662211783 0.196349540849362 4.65421133865154 1.37444678594554 5.23598775598298 1.32535940073319 5.23598775598298 1.32535940073319 5.1196324725167 0.589048622548086 5.00327718905041 0.539961237335746 5.00327718905041 0.589048622548086 4.88692190558412 0.343611696486384 3.95607963785381 0.294524311274043 3.95607963785381 0.294524311274043 3.83972435438753 1.37444678594554 5.1196324725167 0.981747704246811 5.1196324725167 0.93266031903447 5.00327718905041 0.981747704246811 5.00327718905041 0.294524311274043 4.0724349213201 0.736310778185108 4.18879020478639 0.687223392972767 4.18879020478639 0.687223392972767 4.0724349213201 1.52170894158256 4.42150077171897 0.93266031903447 5.1196324725167 0.343611696486384 3.83972435438753 0.687223392972767 4.30514548825268 1.52170894158256 4.30514548825268 1.12900985988383 4.30514548825268 1.07992247467149 4.30514548825268 0.736310778185108 4.0724349213201 1.12900985988383 4.18879020478639 0.098174770424681 5.35234303944927 0.0490873852123405 5.35234303944927 0.098174770424681 5.23598775598298 1.47262155637022 4.42150077171897 1.27627201552085 5.81776417331443 1.22718463030851 5.81776417331443 1.22718463030851 5.70140888984814 0.490873852123405 5.58505360638185 0.441786466911065 5.58505360638185 1.27627201552085 5.70140888984814 0.245436926061703 4.53785605518526 0.196349540849362 4.53785605518526 0.196349540849362 4.42150077171897 0.88357293382213 5.70140888984814 0.834485548609789 5.70140888984814 0.88357293382213 5.58505360638185 0.441786466911065 5.46869832291556 0.490873852123405 5.46869832291556 0.245436926061703 4.42150077171897 0.392699081698724 3.72336907092124 0.343611696486384 3.72336907092124 0.343611696486384 3.60701378745495 0.88357293382213 3.37430322052237 0.834485548609789 3.25794793705608 0.88357293382213 3.25794793705608 0.834485548609789 3.37430322052237 1.27627201552085 3.49065850398866 1.22718463030851 3.37430322052237 1.27627201552085 3.37430322052237 1.22718463030851 3.49065850398866 1.42353417115788 5.00327718905041 1.37444678594554 5.00327718905041 1.42353417115788 4.88692190558412 0.638136007760427 4.77056662211783 0.589048622548086 4.65421133865154 0.638136007760427 4.65421133865154 1.32535940073319 5.58505360638185 1.27627201552085 5.58505360638185 1.27627201552085 5.46869832291556 0.392699081698724 3.60701378745495 0.147262155637022 5.1196324725167 0.098174770424681 5.1196324725167 0.098174770424681 5.00327718905041 0.147262155637022 5.00327718905041 0.589048622548086 4.77056662211783 1.03083508945915 4.88692190558412 0.981747704246811 4.88692190558412 0.392699081698724 6.16683002371329 0.343611696486384 6.16683002371329 0.392699081698724 6.050474740247 0.981747704246811 4.77056662211783 1.03083508945915 4.77056662211783 0.785398163397449 3.95607963785381 0.736310778185108 3.95607963785381 0.736310778185108 3.83972435438753 0.785398163397449 3.83972435438753 0.294524311274043 4.30514548825268 0.245436926061703 4.30514548825268 0.294524311274043 4.18879020478639 1.47262155637022 4.77056662211783 1.42353417115788 4.77056662211783 1.17809724509617 4.0724349213201 1.12900985988383 4.0724349213201 1.17809724509617 3.95607963785381 1.22718463030851 6.16683002371329 1.17809724509617 6.16683002371329 0.0490873852123405 5.70140888984814 0.539961237335746 5.35234303944927 0.490873852123405 5.35234303944927 0.539961237335746 5.23598775598298 1.37444678594554 5.35234303944927 0.687223392972767 4.53785605518526 0.638136007760427 4.42150077171897 0.687223392972767 4.42150077171897 0.638136007760427 4.53785605518526 0.441786466911065 3.49065850398866 0.392699081698724 3.49065850398866 0.93266031903447 5.46869832291556 0.88357293382213 5.46869832291556 0.88357293382213 5.35234303944927 0.93266031903447 5.35234303944927 1.32535940073319 3.25794793705608 1.52170894158256 4.53785605518526 1.27627201552085 3.25794793705608 0.196349540849362 4.88692190558412 0.147262155637022 4.88692190558412 1.27627201552085 5.93411945678071 1.07992247467149 4.65421133865154 0.441786466911065 5.93411945678071 0.834485548609789 3.72336907092124 0.785398163397449 3.72336907092124 1.42353417115788 5.1196324725167 0.343611696486384 4.0724349213201 0.834485548609789 6.050474740247 0.098174770424681 5.46869832291556 0.589048622548086 5.1196324725167 0.539961237335746 5.1196324725167 0.736310778185108 4.30514548825268 1.22718463030851 3.83972435438753 1.32535940073319 5.70140888984814 1.17809724509617 3.83972435438753 0.490873852123405 3.25794793705608 1.47262155637022 4.88692190558412 0.981747704246811 5.23598775598298 0.93266031903447 5.23598775598298 0.490873852123405 5.70140888984814 0.245436926061703 4.65421133865154 0.88357293382213 3.49065850398866 0.392699081698724 3.83972435438753 1.12900985988383 4.42150077171897 0.88357293382213 5.81776417331443 1.37444678594554 5.46869832291556 0.638136007760427 4.88692190558412 0.147262155637022 5.23598775598298 1.52170894158256 4.65421133865154 1.27627201552085 3.60701378745495 0.294524311274043 4.42150077171897 1.27627201552085 6.050474740247 1.42353417115788 5.23598775598298 0.785398163397449 4.0724349213201 0.0490873852123405 5.81776417331443 0.539961237335746 5.46869832291556 1.03083508945915 5.00327718905041 0.441786466911065 3.60701378745495 0.93266031903447 3.25794793705608 1.32535940073319 5.81776417331443 1.17809724509617 4.18879020478639 0.687223392972767 4.65421133865154 0.196349540849362 5.00327718905041 0.93266031903447 5.58505360638185 0.441786466911065 6.050474740247 1.47262155637022 5.00327718905041 0.343611696486384 4.18879020478639 1.37444678594554 5.58505360638185 0.834485548609789 3.83972435438753 1.32535940073319 3.37430322052237 1.52170894158256 4.77056662211783 0.589048622548086 5.23598775598298 1.07992247467149 4.77056662211783 0.098174770424681 5.58505360638185 1.27627201552085 6.16683002371329 0.490873852123405 3.37430322052237 0.834485548609789 6.16683002371329 0.785398163397449 6.16683002371329 0.736310778185108 4.42150077171897 1.42353417115788 5.35234303944927 0.490873852123405 5.81776417331443 0.245436926061703 4.77056662211783 1.22718463030851 3.95607963785381 0.392699081698724 3.95607963785381 1.32535940073319 5.93411945678071 0.981747704246811 5.35234303944927 1.47262155637022 5.1196324725167 0.88357293382213 3.60701378745495 1.12900985988383 4.53785605518526 0.147262155637022 5.35234303944927 0.294524311274043 4.53785605518526 0.638136007760427 5.00327718905041 1.37444678594554 5.70140888984814 0.88357293382213 5.93411945678071 1.52170894158256 4.88692190558412 0.0490873852123405 5.93411945678071 0.785398163397449 4.18879020478639 1.42353417115788 5.46869832291556 0.539961237335746 5.58505360638185 0.441786466911065 3.72336907092124 1.27627201552085 3.72336907092124 0.93266031903447 3.37430322052237 1.03083508945915 5.1196324725167 0.196349540849362 5.1196324725167 1.32535940073319 6.050474740247 1.17809724509617 4.30514548825268 0.687223392972767 4.77056662211783 0.343611696486384 4.30514548825268 0.441786466911065 6.16683002371329 1.47262155637022 5.23598775598298 0.098174770424681 5.70140888984814 0.834485548609789 3.95607963785381 1.37444678594554 5.81776417331443 0.93266031903447 5.70140888984814 0.490873852123405 3.49065850398866 0.589048622548086 5.35234303944927 1.52170894158256 5.00327718905041 1.32535940073319 3.49065850398866 1.42353417115788 5.58505360638185 0.245436926061703 4.88692190558412 0.736310778185108 4.53785605518526 1.07992247467149 4.88692190558412 0.490873852123405 5.93411945678071 0.392699081698724 4.0724349213201 1.32535940073319 6.16683002371329 0.88357293382213 3.72336907092124 1.47262155637022 5.35234303944927 0.147262155637022 5.46869832291556 1.22718463030851 4.0724349213201 0.539961237335746 3.25794793705608 1.37444678594554 5.93411945678071 0.981747704246811 5.46869832291556 0.638136007760427 5.1196324725167 0.294524311274043 4.65421133865154 1.52170894158256 5.1196324725167 1.37444678594554 3.25794793705608 0.0490873852123405 6.050474740247 1.12900985988383 4.65421133865154 0.785398163397449 4.30514548825268 0.539961237335746 5.70140888984814 1.42353417115788 5.70140888984814 0.441786466911065 3.83972435438753 0.88357293382213 6.050474740247 1.27627201552085 3.83972435438753 1.47262155637022 5.46869832291556 0.93266031903447 3.49065850398866 0.196349540849362 5.23598775598298 0.687223392972767 4.88692190558412 1.37444678594554 6.050474740247 1.52170894158256 5.23598775598298 1.03083508945915 5.23598775598298 0.343611696486384 4.42150077171897 0.834485548609789 4.0724349213201 1.42353417115788 5.81776417331443 0.098174770424681 5.81776417331443 1.17809724509617 4.42150077171897 0.589048622548086 5.46869832291556 1.47262155637022 5.58505360638185 0.981747704246811 3.25794793705608 0.93266031903447 5.81776417331443 0.490873852123405 3.60701378745495 1.37444678594554 6.16683002371329 0.245436926061703 5.00327718905041 1.52170894158256 5.35234303944927 0.736310778185108 4.65421133865154 0.490873852123405 6.050474740247 0.392699081698724 4.18879020478639 1.32535940073319 3.60701378745495 1.42353417115788 5.93411945678071 0.147262155637022 5.58505360638185 0.88357293382213 3.83972435438753 1.07992247467149 5.00327718905041 1.22718463030851 4.18879020478639 0.638136007760427 5.23598775598298 1.47262155637022 5.70140888984814 0.539961237335746 3.37430322052237 1.52170894158256 5.46869832291556 0.785398163397449 4.42150077171897 0.981747704246811 5.58505360638185 0.294524311274043 4.77056662211783 0.0490873852123405 6.16683002371329 0.539961237335746 5.81776417331443 1.42353417115788 6.050474740247 1.47262155637022 5.81776417331443 1.37444678594554 3.37430322052237 0.441786466911065 3.95607963785381 0.93266031903447 3.60701378745495 1.12900985988383 4.77056662211783 1.52170894158256 5.58505360638185 0.687223392972767 5.00327718905041 0.196349540849362 5.35234303944927 0.343611696486384 4.53785605518526 0.88357293382213 6.16683002371329 1.42353417115788 6.16683002371329 0.834485548609789 4.18879020478639 0.098174770424681 5.93411945678071 1.47262155637022 5.93411945678071 1.27627201552085 3.95607963785381 0.589048622548086 5.58505360638185 0.490873852123405 3.72336907092124 1.52170894158256 5.70140888984814 1.03083508945915 5.35234303944927 0.981747704246811 3.37430322052237 1.17809724509617 4.53785605518526 1.47262155637022 6.050474740247 0.245436926061703 5.1196324725167 1.52170894158256 5.81776417331443 0.93266031903447 5.93411945678071 0.736310778185108 4.77056662211783 0.490873852123405 6.16683002371329 1.47262155637022 6.16683002371329 0.392699081698724 4.30514548825268 1.32535940073319 3.72336907092124 0.88357293382213 3.95607963785381 1.52170894158256 5.93411945678071 0.147262155637022 5.70140888984814 0.539961237335746 3.49065850398866 1.07992247467149 5.1196324725167 1.52170894158256 6.050474740247 0.638136007760427 5.35234303944927 1.52170894158256 6.16683002371329 1.22718463030851 4.30514548825268 0.294524311274043 4.88692190558412 0.785398163397449 4.53785605518526 0.539961237335746 5.93411945678071 0.981747704246811 5.70140888984814 0.441786466911065 4.0724349213201 0.196349540849362 5.46869832291556 0.93266031903447 3.72336907092124 1.37444678594554 3.49065850398866 0.589048622548086 3.25794793705608 1.12900985988383 4.88692190558412 0.343611696486384 4.65421133865154 0.687223392972767 5.1196324725167 0.098174770424681 6.050474740247 0.834485548609789 4.30514548825268 1.27627201552085 4.0724349213201 0.589048622548086 5.70140888984814 0.490873852123405 3.83972435438753 1.03083508945915 5.46869832291556 0.981747704246811 3.49065850398866 0.245436926061703 5.23598775598298 1.42353417115788 3.25794793705608 0.736310778185108 4.88692190558412 0.392699081698724 4.42150077171897 0.88357293382213 4.0724349213201 1.17809724509617 4.65421133865154 0.147262155637022 5.81776417331443 0.638136007760427 5.46869832291556 0.93266031903447 6.050474740247 1.32535940073319 3.83972435438753 0.539961237335746 3.60701378745495 1.03083508945915 3.25794793705608 1.07992247467149 5.23598775598298 0.294524311274043 5.00327718905041 0.441786466911065 4.18879020478639 0.785398163397449 4.65421133865154 0.539961237335746 6.050474740247 1.22718463030851 4.42150077171897 0.196349540849362 5.58505360638185 0.93266031903447 3.83972435438753 0.981747704246811 5.81776417331443 0.589048622548086 3.37430322052237 0.687223392972767 5.23598775598298 0.343611696486384 4.77056662211783 0.834485548609789 4.42150077171897 1.37444678594554 3.60701378745495 0.098174770424681 6.16683002371329 1.12900985988383 5.00327718905041 0.490873852123405 3.95607963785381 0.589048622548086 5.81776417331443 1.27627201552085 4.18879020478639 0.245436926061703 5.35234303944927 0.981747704246811 3.60701378745495 1.03083508945915 5.58505360638185 0.392699081698724 4.53785605518526 0.736310778185108 5.00327718905041 0.147262155637022 5.93411945678071 1.42353417115788 3.37430322052237 0.88357293382213 4.18879020478639 1.17809724509617 4.77056662211783 0.539961237335746 3.72336907092124 0.638136007760427 5.58505360638185 0.294524311274043 5.1196324725167 0.93266031903447 6.16683002371329 1.03083508945915 3.37430322052237 1.32535940073319 3.95607963785381 0.785398163397449 4.77056662211783 0.441786466911065 4.30514548825268 0.196349540849362 5.70140888984814 1.07992247467149 5.35234303944927 0.539961237335746 6.16683002371329 0.93266031903447 3.95607963785381 1.22718463030851 4.53785605518526 0.589048622548086 3.49065850398866 0.343611696486384 4.88692190558412 0.687223392972767 5.35234303944927 0.981747704246811 5.93411945678071 0.834485548609789 4.53785605518526 0.490873852123405 4.0724349213201 1.37444678594554 3.72336907092124 0.589048622548086 5.93411945678071 0.245436926061703 5.46869832291556 1.12900985988383 5.1196324725167 0.638136007760427 3.25794793705608 0.981747704246811 3.72336907092124 1.27627201552085 4.30514548825268 0.736310778185108 5.1196324725167 0.392699081698724 4.65421133865154 0.147262155637022 6.050474740247 0.88357293382213 4.30514548825268 1.03083508945915 5.70140888984814 0.539961237335746 3.83972435438753 0.638136007760427 5.70140888984814 1.42353417115788 3.49065850398866 1.03083508945915 3.49065850398866 1.17809724509617 4.88692190558412 0.294524311274043 5.23598775598298 0.441786466911065 4.42150077171897 0.785398163397449 4.88692190558412 0.196349540849362 5.81776417331443 1.32535940073319 4.0724349213201 0.93266031903447 4.0724349213201 1.07992247467149 5.46869832291556 0.687223392972767 5.46869832291556 0.589048622548086 3.60701378745495 1.47262155637022 3.25794793705608 1.07992247467149 3.25794793705608 0.343611696486384 5.00327718905041 0.490873852123405 4.18879020478639 1.22718463030851 4.65421133865154 0.834485548609789 4.65421133865154 0.981747704246811 6.050474740247 0.245436926061703 5.58505360638185 0.589048622548086 6.050474740247 1.37444678594554 3.83972435438753 0.638136007760427 3.37430322052237 0.981747704246811 3.83972435438753 0.392699081698724 4.77056662211783 1.12900985988383 5.23598775598298 0.147262155637022 6.16683002371329 0.736310778185108 5.23598775598298 0.539961237335746 3.95607963785381 0.88357293382213 4.42150077171897 1.27627201552085 4.42150077171897 1.03083508945915 5.81776417331443 0.638136007760427 5.81776417331443 0.294524311274043 5.35234303944927 0.441786466911065 4.53785605518526 1.42353417115788 3.60701378745495 1.03083508945915 3.60701378745495 0.196349540849362 5.93411945678071 0.785398163397449 5.00327718905041 0.589048622548086 3.72336907092124 1.17809724509617 5.00327718905041 0.93266031903447 4.18879020478639 1.32535940073319 4.18879020478639 0.687223392972767 5.58505360638185 0.343611696486384 5.1196324725167 1.07992247467149 5.58505360638185 0.490873852123405 4.30514548825268 1.07992247467149 3.37430322052237 0.834485548609789 4.77056662211783 0.245436926061703 5.70140888984814 1.47262155637022 3.37430322052237 0.0490873852123405 3.25794793705608 0.638136007760427 3.49065850398866 0.589048622548086 6.16683002371329 1.22718463030851 4.77056662211783 0.981747704246811 3.95607963785381 0.392699081698724 4.88692190558412 0.981747704246811 6.16683002371329 0.0490873852123405 3.37430322052237 0.736310778185108 5.35234303944927 1.37444678594554 3.95607963785381 0.539961237335746 4.0724349213201 0.88357293382213 4.53785605518526 0.0490873852123405 3.49065850398866 1.12900985988383 5.35234303944927 0.294524311274043 5.46869832291556 0.638136007760427 5.93411945678071 0.098174770424681 3.25794793705608 1.27627201552085 4.53785605518526 0.687223392972767 3.25794793705608 0.0490873852123405 3.60701378745495 1.03083508945915 3.72336907092124 0.441786466911065 4.65421133865154 1.03083508945915 5.93411945678071 0.785398163397449 5.1196324725167 0.196349540849362 6.050474740247 0.098174770424681 3.37430322052237 0.93266031903447 4.30514548825268 0.589048622548086 3.83972435438753 1.42353417115788 3.72336907092124 0.0490873852123405 3.72336907092124 1.17809724509617 5.1196324725167 0.343611696486384 5.23598775598298 0.687223392972767 5.70140888984814 1.07992247467149 3.49065850398866 0.490873852123405 4.42150077171897 0.098174770424681 3.49065850398866 1.32535940073319 4.30514548825268 0.245436926061703 5.81776417331443 0.834485548609789 4.88692190558412 0.147262155637022 3.25794793705608 0.638136007760427 3.60701378745495 1.07992247467149 5.70140888984814 1.47262155637022 3.49065850398866 0.0490873852123405 3.83972435438753 0.981747704246811 4.0724349213201 0.736310778185108 5.46869832291556 1.22718463030851 4.88692190558412 0.392699081698724 5.00327718905041 0.098174770424681 3.60701378745495 0.539961237335746 4.18879020478639 1.12900985988383 3.25794793705608 0.88357293382213 4.65421133865154 0.294524311274043 5.58505360638185 1.37444678594554 4.0724349213201 0.147262155637022 3.37430322052237 0.0490873852123405 3.95607963785381 1.12900985988383 5.46869832291556 0.687223392972767 3.37430322052237 0.638136007760427 6.050474740247 1.03083508945915 3.83972435438753 1.52170894158256 3.25794793705608 0.441786466911065 4.77056662211783 0.196349540849362 6.16683002371329 0.785398163397449 5.23598775598298 0.589048622548086 3.95607963785381 0.098174770424681 3.72336907092124 1.27627201552085 4.65421133865154 0.93266031903447 4.42150077171897 0.147262155637022 3.49065850398866 1.03083508945915 6.050474740247 1.42353417115788 3.83972435438753 0.0490873852123405 4.0724349213201 0.343611696486384 5.35234303944927 0.490873852123405 4.53785605518526 0.687223392972767 5.81776417331443 1.17809724509617 5.23598775598298 0.196349540849362 3.25794793705608 0.245436926061703 5.93411945678071 1.07992247467149 3.60701378745495 1.32535940073319 4.42150077171897 0.834485548609789 5.00327718905041 0.098174770424681 3.83972435438753 0.638136007760427 3.72336907092124 0.981747704246811 4.18879020478639 1.07992247467149 5.81776417331443 0.392699081698724 5.1196324725167 0.539961237335746 4.30514548825268 0.736310778185108 5.58505360638185 0.147262155637022 3.60701378745495 0.0490873852123405 4.18879020478639 1.12900985988383 3.37430322052237 1.47262155637022 3.60701378745495 0.88357293382213 4.77056662211783 0.294524311274043 5.70140888984814 0.687223392972767 3.49065850398866 1.22718463030851 5.00327718905041 1.37444678594554 4.18879020478639 0.196349540849362 3.37430322052237 0.638136007760427 6.16683002371329 0.098174770424681 3.95607963785381 0.441786466911065 4.88692190558412 1.12900985988383 5.58505360638185 1.03083508945915 3.95607963785381 0.589048622548086 4.0724349213201 1.52170894158256 3.37430322052237 0.785398163397449 5.35234303944927 0.147262155637022 3.72336907092124 0.343611696486384 5.46869832291556 0.0490873852123405 4.30514548825268 0.93266031903447 4.53785605518526 1.27627201552085 4.77056662211783 0.736310778185108 3.25794793705608 0.687223392972767 5.93411945678071 0.490873852123405 4.65421133865154 1.03083508945915 6.16683002371329 0.196349540849362 3.49065850398866 1.07992247467149 3.72336907092124 1.42353417115788 3.95607963785381 0.245436926061703 6.050474740247 0.638136007760427 3.83972435438753 1.17809724509617 5.35234303944927 0.834485548609789 5.1196324725167 0.098174770424681 4.0724349213201 0.245436926061703 3.25794793705608 0.392699081698724 5.23598775598298 0.981747704246811 4.30514548825268 0.147262155637022 3.83972435438753 1.32535940073319 4.53785605518526 0.736310778185108 5.70140888984814 0.539961237335746 4.42150077171897 1.07992247467149 5.93411945678071 1.12900985988383 3.49065850398866 0.0490873852123405 4.42150077171897 0.294524311274043 5.81776417331443 1.47262155637022 3.72336907092124 0.88357293382213 4.88692190558412 0.687223392972767 3.60701378745495 0.196349540849362 3.60701378745495 1.22718463030851 5.1196324725167 0.441786466911065 5.00327718905041 0.098174770424681 4.18879020478639 1.03083508945915 4.0724349213201 0.589048622548086 4.18879020478639 0.785398163397449 5.46869832291556 1.37444678594554 4.30514548825268 0.245436926061703 3.37430322052237 1.12900985988383 5.70140888984814 1.17809724509617 3.25794793705608 0.147262155637022 3.95607963785381 0.343611696486384 5.58505360638185 1.52170894158256 3.49065850398866 0.93266031903447 4.65421133865154 0.0490873852123405 4.53785605518526 0.736310778185108 3.37430322052237 0.687223392972767 6.050474740247 1.27627201552085 4.88692190558412 0.490873852123405 4.77056662211783 1.07992247467149 3.83972435438753 0.196349540849362 3.72336907092124 0.245436926061703 6.16683002371329 1.42353417115788 4.0724349213201 0.638136007760427 3.95607963785381 0.834485548609789 5.23598775598298 0.098174770424681 4.30514548825268 1.17809724509617 5.46869832291556 0.981747704246811 4.42150077171897 0.245436926061703 3.49065850398866 0.392699081698724 5.35234303944927 0.736310778185108 5.81776417331443 0.539961237335746 4.53785605518526 1.32535940073319 4.65421133865154 0.147262155637022 4.0724349213201 0.294524311274043 5.93411945678071 0.294524311274043 3.25794793705608 1.12900985988383 3.60701378745495 1.07992247467149 6.050474740247 0.0490873852123405 4.65421133865154 0.687223392972767 3.72336907092124 1.47262155637022 3.83972435438753 0.88357293382213 5.00327718905041 1.22718463030851 5.23598775598298 0.196349540849362 3.83972435438753 1.03083508945915 4.18879020478639 0.441786466911065 5.1196324725167 0.589048622548086 4.30514548825268 0.785398163397449 5.58505360638185 0.098174770424681 4.42150077171897 1.37444678594554 4.42150077171897 1.12900985988383 5.81776417331443 1.17809724509617 3.37430322052237 0.343611696486384 5.70140888984814 1.52170894158256 3.60701378745495 0.736310778185108 3.49065850398866 0.245436926061703 3.60701378745495 0.93266031903447 4.77056662211783 0.490873852123405 4.88692190558412 0.147262155637022 4.18879020478639 1.27627201552085 5.00327718905041 0.687223392972767 6.16683002371329 1.07992247467149 3.95607963785381 0.294524311274043 3.37430322052237 0.638136007760427 4.0724349213201 1.42353417115788 4.18879020478639 0.0490873852123405 4.77056662211783 0.392699081698724 5.46869832291556 1.17809724509617 5.58505360638185 0.785398163397449 3.25794793705608 0.196349540849362 3.95607963785381 0.834485548609789 5.35234303944927 0.981747704246811 4.53785605518526 1.32535940073319 4.77056662211783 0.539961237335746 4.65421133865154 0.098174770424681 4.53785605518526 0.736310778185108 5.93411945678071 0.294524311274043 6.050474740247 1.07992247467149 6.16683002371329 0.245436926061703 3.72336907092124 1.47262155637022 3.95607963785381 0.687223392972767 3.83972435438753 1.12900985988383 3.72336907092124 1.22718463030851 5.35234303944927 0.441786466911065 5.23598775598298 0.88357293382213 5.1196324725167 0.147262155637022 4.30514548825268 1.37444678594554 4.53785605518526 0.294524311274043 3.49065850398866 0.589048622548086 4.42150077171897 1.03083508945915 4.30514548825268 0.343611696486384 5.81776417331443 0.0490873852123405 4.88692190558412 1.12900985988383 5.93411945678071 0.785398163397449 5.70140888984814 1.17809724509617 3.49065850398866 1.52170894158256 3.72336907092124 0.736310778185108 3.60701378745495 0.196349540849362 4.0724349213201 0.343611696486384 3.25794793705608 1.27627201552085 5.1196324725167 0.93266031903447 4.88692190558412 0.490873852123405 5.00327718905041 0.638136007760427 4.18879020478639 1.07992247467149 4.0724349213201 0.098174770424681 4.65421133865154 1.42353417115788 4.30514548825268 0.392699081698724 5.58505360638185 0.245436926061703 3.83972435438753 0.834485548609789 5.46869832291556 1.17809724509617 5.70140888984814 1.22718463030851 3.25794793705608 0.147262155637022 4.42150077171897 0.785398163397449 3.37430322052237 1.32535940073319 4.88692190558412 0.539961237335746 4.77056662211783 0.294524311274043 3.60701378745495 0.981747704246811 4.65421133865154 0.294524311274043 6.16683002371329 0.736310778185108 6.050474740247 0.687223392972767 3.95607963785381 1.47262155637022 4.0724349213201 1.22718463030851 5.46869832291556 0.0490873852123405 5.00327718905041 0.441786466911065 5.35234303944927 1.12900985988383 3.83972435438753 0.196349540849362 4.18879020478639 0.88357293382213 5.23598775598298 0.589048622548086 4.53785605518526 1.37444678594554 4.65421133865154 1.12900985988383 6.050474740247 0.343611696486384 3.37430322052237 0.098174770424681 4.77056662211783 0.343611696486384 5.93411945678071 1.52170894158256 3.83972435438753 0.736310778185108 3.72336907092124 1.27627201552085 5.23598775598298 0.245436926061703 3.95607963785381 0.147262155637022 4.53785605518526 0.490873852123405 5.1196324725167 1.42353417115788 4.42150077171897 1.17809724509617 5.81776417331443 0.638136007760427 4.30514548825268 0.294524311274043 3.72336907092124 1.07992247467149 4.18879020478639 0.785398163397449 3.49065850398866 1.32535940073319 5.00327718905041 0.834485548609789 5.58505360638185 0.0490873852123405 5.1196324725167 0.539961237335746 4.88692190558412 0.196349540849362 4.30514548825268 1.47262155637022 4.18879020478639 1.22718463030851 5.58505360638185 0.343611696486384 3.49065850398866 1.37444678594554 4.77056662211783 0.736310778185108 6.16683002371329 0.098174770424681 4.88692190558412 1.12900985988383 3.95607963785381 1.12900985988383 6.16683002371329 0.245436926061703 4.0724349213201 1.52170894158256 3.95607963785381 0.392699081698724 3.25794793705608 0.343611696486384 6.050474740247 0.147262155637022 4.65421133865154 1.42353417115788 4.53785605518526 0.490873852123405 5.23598775598298 1.17809724509617 5.93411945678071 0.0490873852123405 5.23598775598298 1.47262155637022 4.30514548825268 1.37444678594554 4.88692190558412 0.245436926061703 4.18879020478639 1.52170894158256 4.0724349213201 1.52170894158256 4.18879020478639 143 144 145 146 147 148 146 148 149 150 105 104 151 152 153 151 154 155 146 156 147 157 158 159 151 155 152 160 161 162 150 104 163 3 81 1 164 165 166 157 167 158 157 159 168 169 170 171 169 172 170 173 174 175 176 177 178 179 180 181 182 183 184 182 145 183 185 186 187 188 189 190 182 184 191 192 193 194 188 195 189 196 197 198 199 123 124 199 124 125 192 200 193 188 190 201 196 202 197 199 203 123 204 149 205 196 198 206 204 205 207 208 209 210 199 211 203 212 213 214 215 153 216 212 214 217 218 219 220 221 222 223 215 224 225 215 216 224 218 181 219 218 220 226 227 228 229 230 231 232 230 233 231 234 235 236 234 237 235 238 239 240 241 242 243 244 245 246 227 229 247 244 217 245 234 171 237 248 249 250 248 250 251 241 252 242 253 194 254 255 256 257 244 246 143 253 254 258 248 210 249 255 52 51 253 258 259 255 51 256 260 206 261 260 262 263 264 265 266 267 268 161 269 270 271 267 161 160 260 261 262 272 273 177 274 106 105 272 72 273 274 107 106 272 73 72 272 177 176 274 105 150 275 276 277 278 145 182 279 280 281 279 243 282 283 284 165 285 286 287 285 287 288 289 34 35 290 211 199 289 35 36 279 282 280 283 165 164 290 125 126 283 247 284 289 291 34 290 199 125 292 293 180 290 162 211 290 160 162 294 213 212 295 156 146 292 180 179 296 154 151 294 178 213 296 257 154 292 251 293 297 298 174 294 176 178 297 174 173 299 239 238 300 195 188 301 167 157 302 163 209 303 186 185 299 191 239 302 209 208 303 304 186 305 202 196 306 172 169 307 217 244 306 308 172 309 14 15 309 166 14 309 164 166 310 238 240 310 268 267 311 288 312 311 312 200 313 153 215 314 179 181 311 200 192 314 181 218 310 240 268 315 175 233 316 201 228 315 173 175 317 149 204 316 228 227 318 168 222 319 143 145 315 233 230 319 145 278 320 185 187 321 208 210 320 187 252 322 126 127 318 222 221 321 210 248 322 290 126 323 171 234 320 252 241 322 160 290 324 226 265 325 176 294 324 265 264 326 191 299 326 182 191 327 206 260 328 108 107 329 225 276 329 276 275 326 278 182 330 194 253 328 107 274 331 247 283 332 232 25 332 25 26 333 217 307 332 230 232 333 212 217 334 270 269 334 204 207 335 243 279 334 207 270 336 251 292 337 286 285 337 221 223 338 255 257 339 238 310 337 223 286 340 195 300 341 244 143 338 257 296 341 307 244 340 264 266 342 298 297 342 263 298 343 291 289 340 266 195 341 143 319 344 267 160 343 236 291 344 160 322 344 127 128 345 304 303 346 259 156 346 156 295 43 41 111 345 277 304 344 322 127 347 150 163 347 274 150 347 163 302 348 73 272 349 164 309 348 272 176 348 176 325 345 275 277 348 74 73 350 167 301 350 63 62 350 351 167 350 62 351 352 202 305 352 281 202 353 278 326 354 151 153 355 179 314 356 308 306 357 300 188 354 153 313 356 271 308 358 294 212 357 201 316 356 269 271 358 212 333 358 325 294 357 188 201 359 288 311 360 299 238 360 238 339 361 173 315 362 149 317 363 208 321 362 295 146 364 226 324 364 314 218 362 146 149 365 185 320 366 307 341 367 168 318 364 218 226 368 267 344 368 128 129 367 301 157 369 109 108 367 157 168 370 196 206 368 339 310 369 108 328 370 305 196 368 344 128 370 206 327 368 310 267 371 278 353 372 215 225 373 247 331 372 313 215 372 225 329 371 319 278 374 169 171 375 230 332 374 171 323 373 227 247 376 194 330 377 321 248 377 251 336 376 192 194 378 325 358 377 248 251 379 204 334 380 243 335 379 317 204 381 264 340 380 241 243 382 53 52 382 54 53 383 299 360 383 353 326 382 52 255 382 255 338 384 274 347 385 260 263 383 326 299 386 333 307 387 221 337 385 263 342 388 164 349 385 327 260 386 307 366 389 275 345 390 368 129 390 129 130 390 130 131 388 331 283 388 283 164 390 339 368 391 236 343 392 341 319 391 234 236 393 179 355 394 335 279 391 323 234 392 319 371 395 330 253 393 292 179 394 279 281 395 253 259 394 281 352 395 259 346 393 336 292 396 338 296 392 366 341 397 300 357 398 348 325 398 74 348 396 151 354 398 75 74 396 296 151 398 76 75 398 325 378 399 173 361 400 353 383 401 208 363 402 269 356 401 302 208 399 297 173 401 347 302 403 15 16 404 333 386 405 285 288 404 378 358 404 358 333 405 288 359 406 303 185 403 309 15 406 185 365 407 355 314 408 131 132 409 289 36 407 314 364 408 390 131 409 36 37 408 360 339 410 110 109 408 339 390 411 295 362 410 109 369 412 305 370 413 313 372 414 366 392 415 316 227 415 227 373 416 301 367 417 306 169 418 371 353 419 230 375 420 321 377 419 315 230 419 361 315 418 353 400 421 365 320 421 241 380 420 363 321 417 169 374 422 378 404 423 360 408 424 311 192 423 132 133 425 324 264 421 320 241 425 264 381 423 400 383 426 327 385 423 408 132 424 359 311 423 383 360 424 192 376 427 366 414 428 328 274 428 274 384 429 317 379 430 275 389 427 386 366 431 414 392 430 329 275 431 371 418 432 332 26 432 26 27 433 318 221 433 221 387 434 331 388 431 392 371 435 378 422 435 77 76 436 336 393 435 76 398 435 398 378 437 400 423 438 335 394 439 338 396 440 340 300 437 133 134 440 300 397 437 423 133 441 323 391 442 422 404 442 386 427 440 381 340 442 404 386 443 384 347 444 297 399 445 330 395 443 347 401 446 379 334 444 342 297 447 389 345 447 345 303 448 414 431 446 334 269 447 303 406 449 309 403 449 349 309 450 418 400 446 269 402 451 305 412 450 437 134 451 352 305 450 134 135 452 337 285 453 355 407 452 387 337 450 400 437 452 285 405 454 111 110 454 43 111 454 44 43 455 313 413 456 422 442 454 110 410 455 354 313 457 414 448 458 343 289 459 397 357 460 361 419 458 289 409 459 316 415 459 357 316 461 346 295 457 427 414 462 431 418 462 418 450 462 448 431 461 295 411 463 365 421 464 363 420 462 135 136 465 364 324 462 450 135 466 350 301 466 63 350 466 64 63 466 65 64 467 435 422 466 301 416 465 324 425 467 77 435 467 422 456 465 407 364 468 412 370 467 78 77 469 410 369 468 327 426 469 369 328 470 442 427 468 370 327 470 456 442 469 328 428 471 306 417 471 402 356 472 372 329 470 427 457 472 329 430 471 356 306 473 331 434 472 413 372 474 136 137 475 359 424 474 137 138 474 448 462 474 462 136 476 375 332 476 332 432 473 373 331 477 362 317 477 411 362 478 456 470 479 377 336 480 474 138 477 317 429 479 336 436 480 138 139 481 367 318 479 420 377 482 335 438 481 318 433 482 380 335 480 448 474 481 416 367 483 338 439 480 457 448 483 54 382 484 467 456 483 382 338 484 78 467 485 381 440 483 55 54 484 456 478 486 323 441 487 342 444 484 79 78 487 385 342 488 139 140 487 426 385 489 384 443 488 478 470 488 480 139 488 470 457 486 374 323 488 457 480 490 434 388 491 376 330 492 478 488 490 349 449 492 140 141 491 330 445 492 488 140 490 388 349 493 389 447 494 478 492 495 429 379 496 436 393 494 142 80 496 355 453 494 141 142 497 394 352 494 484 478 497 352 451 494 79 484 494 492 141 494 80 79 496 393 355 497 438 394 495 379 446 498 396 354 499 387 452 498 439 396 500 397 459 498 354 455 501 443 401 502 399 361 501 363 464 502 361 460 503 441 391 501 401 363 504 403 16 503 343 458 504 16 17 503 391 343 505 346 461 504 449 403 505 445 395 506 407 465 507 406 365 506 453 407 507 365 463 505 395 346 508 410 469 509 412 468 510 402 471 511 413 472 512 373 473 513 359 475 514 375 476 512 415 373 513 405 359 514 419 375 515 464 420 515 420 479 514 460 419 516 37 38 517 421 380 518 425 381 516 409 37 517 463 421 518 381 485 517 380 482 519 426 487 520 411 477 521 469 428 521 384 489 522 389 493 523 416 481 524 417 374 521 428 384 524 374 486 522 430 389 525 434 490 526 27 28 526 432 27 527 376 491 528 436 496 527 424 376 529 440 397 530 438 497 527 475 424 529 397 500 531 439 498 532 429 495 529 485 440 533 489 443 534 444 399 533 443 501 535 387 499 535 433 387 536 449 504 534 399 502 537 493 447 537 406 507 538 453 506 537 447 406 539 451 412 540 441 503 541 44 454 542 445 505 541 454 410 541 45 44 541 410 508 543 500 459 539 412 509 544 413 511 545 446 402 543 415 512 543 459 415 544 455 413 545 495 446 546 464 515 545 402 510 547 460 514 548 452 405 549 465 425 548 405 513 549 506 465 548 499 452 549 425 518 550 463 517 551 469 521 552 458 409 553 426 519 552 409 516 551 508 469 553 509 468 554 461 411 555 434 525 553 468 426 555 473 434 112 40 2 556 511 472 554 411 520 556 430 522 557 479 436 558 466 416 557 515 479 558 416 523 558 65 466 556 472 430 558 66 65 557 436 528 559 476 432 560 471 417 559 432 526 561 482 438 561 438 530 560 510 471 562 485 529 560 417 524 563 489 533 564 475 527 565 55 483 565 56 55 565 439 531 565 483 439 566 444 534 567 429 532 566 519 487 568 490 449 567 520 477 567 477 429 568 525 490 568 449 536 566 487 444 569 528 496 570 493 537 569 496 453 569 453 538 571 481 433 571 523 481 572 497 451 571 433 535 572 451 539 573 500 543 572 530 497 574 486 441 575 531 498 574 441 540 576 501 464 576 464 546 575 455 544 575 498 455 576 533 501 577 491 445 578 17 18 577 445 542 579 502 460 578 504 17 579 460 547 578 536 504 580 495 545 581 507 463 582 538 506 582 506 549 583 541 508 580 532 495 583 508 551 581 463 550 584 509 553 585 499 548 586 512 473 584 539 509 586 473 555 587 511 556 588 503 458 588 458 552 588 540 503 589 514 476 590 505 461 591 546 515 591 515 557 590 542 505 590 461 554 592 485 562 589 547 514 589 476 559 593 482 561 592 518 485 593 517 482 594 521 489 593 550 517 595 510 560 594 489 563 594 551 521 596 519 566 597 513 475 597 475 564 598 522 493 599 525 568 598 493 570 600 38 39 600 516 38 601 28 29 602 528 569 603 562 529 603 500 573 601 526 28 604 520 567 603 529 500 605 530 572 606 523 571 607 563 533 608 531 575 607 533 576 609 486 574 610 536 578 609 524 486 611 534 502 612 538 582 613 564 527 611 502 579 613 491 577 614 45 541 615 537 507 613 527 491 614 541 583 615 570 537 614 46 45 615 507 581 616 543 512 617 539 584 616 512 586 616 573 543 618 532 580 619 499 585 620 511 587 619 535 499 620 544 511 621 546 591 622 549 518 622 582 549 623 540 588 624 547 589 622 518 592 625 551 594 626 550 593 625 583 551 627 555 525 628 542 590 627 525 599 629 584 553 630 545 510 629 553 519 629 519 596 631 522 598 632 557 528 631 556 522 630 580 545 630 510 595 632 591 557 633 548 513 631 587 556 632 528 602 633 513 597 634 562 603 633 585 548 635 526 601 635 559 526 636 530 605 636 561 530 637 563 607 42 80 142 638 516 600 638 552 516 639 3 4 640 599 568 641 531 608 642 554 520 639 81 3 641 57 56 642 520 604 639 82 81 641 56 565 640 568 536 641 565 531 643 534 611 643 596 566 640 536 610 643 566 534 644 569 538 645 558 523 644 602 569 646 82 639 645 66 558 646 83 82 645 67 66 645 523 606 647 570 615 648 524 609 644 538 612 648 560 524 649 573 616 650 605 572 651 83 646 648 595 560 650 539 617 651 84 83 652 564 613 653 576 546 650 572 539 654 608 575 655 4 5 653 607 576 653 546 621 655 639 4 656 567 532 654 544 620 655 646 639 657 18 19 658 84 651 657 19 20 654 575 544 656 532 618 659 579 547 657 578 18 659 547 624 656 604 567 658 85 84 660 612 582 660 582 622 661 571 535 662 581 550 661 535 619 661 606 571 663 614 583 663 583 625 664 646 655 662 550 626 665 584 629 666 586 555 667 540 623 668 85 658 667 574 540 666 555 627 668 86 85 668 87 86 669 577 542 670 621 591 671 587 631 669 542 628 670 591 632 672 559 635 672 624 589 673 592 562 672 589 559 674 658 651 674 646 664 673 562 634 675 618 580 676 563 637 675 580 630 677 561 636 674 651 646 676 594 563 676 625 594 678 5 6 677 626 593 677 593 561 678 655 5 679 599 640 680 585 633 678 664 655 681 552 638 682 88 87 682 87 668 681 588 552 683 596 643 684 598 570 681 623 588 684 570 647 685 590 554 685 554 642 686 602 644 687 658 674 685 628 590 688 603 573 689 29 30 689 30 31 688 634 603 689 601 29 688 573 649 690 605 650 691 637 607 691 607 653 692 595 648 693 664 678 694 88 682 695 564 652 694 89 88 696 578 657 697 608 654 695 597 564 698 579 659 699 112 113 698 611 579 696 610 578 699 39 40 699 40 112 700 612 660 699 600 39 701 614 663 702 615 581 701 47 46 701 46 614 702 647 615 703 586 666 702 581 662 704 658 687 704 668 658 705 604 656 706 617 584 707 674 664 703 616 586 703 649 616 708 606 661 706 584 665 707 687 674 709 574 667 707 664 693 710 89 694 711 621 670 712 660 622 712 592 673 710 90 89 713 620 587 713 587 671 712 622 592 709 609 574 714 652 613 714 613 577 715 693 678 715 6 7 714 577 669 716 625 676 717 624 672 715 678 6 716 663 625 718 618 675 719 626 677 720 668 704 720 682 668 721 627 599 722 629 596 721 599 679 722 596 683 723 585 680 724 670 632 724 602 686 723 619 585 722 665 629 724 632 602 725 673 634 726 631 598 727 687 707 726 671 631 726 598 684 728 90 710 725 634 688 729 601 689 730 623 681 728 91 90 729 635 601 731 636 605 732 637 691 733 640 610 734 628 685 733 679 640 735 675 630 733 610 696 735 595 692 731 605 690 736 693 715 737 608 697 738 694 682 737 57 641 739 644 612 737 641 608 737 58 57 739 686 644 735 630 595 738 682 720 739 612 700 738 710 694 740 633 597 741 643 611 740 680 633 741 683 643 742 649 703 740 597 695 741 611 698 743 699 113 743 113 114 744 647 702 745 704 687 743 600 699 745 687 727 746 653 621 743 638 600 746 621 711 747 91 728 748 690 650 746 691 653 747 92 91 749 604 705 750 657 20 750 20 21 748 650 617 749 642 604 748 617 706 750 696 657 751 697 654 751 620 713 752 660 712 753 606 708 751 654 620 753 68 67 753 645 606 754 693 736 753 67 645 754 707 693 754 727 707 755 624 717 756 692 648 756 648 609 755 659 624 757 663 716 756 609 709 757 701 663 758 627 721 758 666 627 759 652 714 760 626 719 761 710 738 762 7 8 762 8 9 760 662 626 762 715 7 762 736 715 763 711 670 764 665 722 763 670 724 764 706 665 765 704 745 766 705 656 766 618 718 767 671 726 766 656 618 765 720 704 768 673 725 769 708 661 769 619 723 770 672 635 771 92 747 771 93 92 772 716 676 770 717 672 771 94 93 772 676 637 769 661 619 772 637 732 773 667 623 770 635 729 774 719 677 775 679 733 773 623 730 776 727 754 777 669 628 774 636 731 774 677 636 778 686 739 777 628 734 779 710 761 780 683 741 779 747 728 779 728 710 781 688 649 782 647 744 781 649 742 783 718 675 784 736 762 781 725 688 783 675 735 782 684 647 785 680 740 786 689 31 787 720 765 786 31 32 787 761 738 787 738 720 788 732 691 788 691 746 789 114 115 790 690 748 789 743 114 791 94 771 789 730 681 789 638 743 789 681 638 791 95 94 792 696 750 793 697 751 794 685 642 795 660 752 794 734 685 796 698 659 795 700 660 794 642 749 797 745 727 798 48 47 798 49 48 799 692 756 797 727 776 798 47 701 798 701 757 796 659 755 800 703 666 801 702 662 801 744 702 802 747 779 800 666 758 803 695 652 801 662 760 800 742 703 803 652 759 804 706 764 805 754 736 806 711 763 805 736 784 805 776 754 807 713 671 808 673 768 809 705 766 807 671 767 808 712 673 808 752 712 810 761 787 811 757 716 812 9 10 813 717 770 812 784 762 812 762 9 811 716 772 814 708 769 815 95 791 816 721 679 816 679 775 815 96 95 817 667 773 818 719 774 817 709 667 819 714 669 820 745 797 821 722 683 822 724 686 822 763 724 819 669 777 821 683 780 822 686 778 819 759 714 823 725 781 820 765 745 821 764 722 824 726 684 824 767 726 825 771 747 824 684 782 826 718 783 825 747 802 827 680 785 828 729 689 828 689 786 827 723 680 829 732 788 830 115 116 831 696 792 832 776 805 831 733 696 830 789 115 833 731 690 831 775 733 830 730 789 833 690 790 834 739 700 834 700 795 834 778 739 835 802 779 836 734 794 837 737 697 835 761 810 837 58 737 835 779 761 837 697 793 837 59 58 837 60 59 838 741 698 839 784 812 838 780 741 840 742 800 841 735 692 841 692 799 838 698 796 842 96 815 843 788 746 841 783 735 842 97 96 843 711 806 843 746 711 844 785 740 845 21 22 844 740 695 846 765 820 845 792 750 847 744 801 844 695 803 848 706 804 849 705 809 848 748 706 846 810 787 845 750 21 849 749 705 850 752 808 848 790 748 846 787 765 851 791 771 852 793 751 852 751 713 851 771 825 853 798 757 854 708 814 851 815 791 854 68 753 852 713 807 855 776 832 853 757 811 854 753 708 854 69 68 856 709 817 855 797 776 857 721 816 858 717 813 858 755 717 856 756 709 857 758 721 856 799 756 859 759 819 860 763 822 861 760 719 862 802 835 861 719 818 860 806 763 863 809 766 864 784 839 865 725 823 863 718 826 866 764 821 864 832 805 864 805 784 865 768 725 867 732 829 867 772 732 863 766 718 866 804 764 868 97 842 867 811 772 869 814 769 870 767 824 869 723 827 868 98 97 869 769 723 871 729 828 872 116 117 871 770 729 872 117 118 873 775 831 874 810 846 872 730 830 872 830 116 871 813 770 872 773 730 875 812 10 876 734 836 875 10 11 875 839 812 876 777 734 877 731 833 878 778 834 879 823 781 879 781 742 877 774 731 877 818 774 879 742 840 880 780 838 881 815 851 882 783 841 883 829 788 883 788 843 884 797 855 882 826 783 885 782 744 886 785 844 885 744 847 884 820 797 887 32 33 888 825 802 889 792 845 890 836 794 887 786 32 888 802 862 890 794 749 891 795 752 892 832 864 890 749 849 891 752 850 893 790 848 894 49 798 895 793 852 894 798 853 894 50 49 896 840 800 897 799 856 896 800 758 898 759 859 896 758 857 899 98 868 899 99 98 899 100 99 900 806 860 898 803 759 901 755 858 902 862 835 902 810 874 901 796 755 903 801 760 904 808 768 903 760 861 902 835 810 905 809 863 904 850 808 903 847 801 904 768 865 906 814 869 907 839 875 908 842 815 909 811 867 910 817 773 148 804 866 908 815 881 909 853 811 910 118 119 910 773 872 910 872 118 159 807 767 911 816 775 912 859 819 159 767 870 913 846 820 913 874 846 912 777 876 911 775 873 912 819 777 170 813 871 913 820 884 914 851 825 915 822 778 914 881 851 915 778 878 914 825 888 916 826 882 917 827 785 193 818 877 917 785 886 918 823 879 919 832 892 920 866 821 919 855 832 152 829 883 920 780 880 920 821 780 921 792 889 922 836 890 923 824 782 923 782 885 923 870 824 921 831 792 924 100 899 924 101 100 921 873 831 925 795 891 926 862 902 925 834 795 927 841 799 925 878 834 927 882 841 927 799 897 235 786 887 928 886 844 235 828 786 929 892 864 258 833 790 928 803 898 928 844 803 929 839 907 198 840 896 930 809 905 929 864 839 224 843 806 930 849 809 258 790 893 931 837 793 931 60 837 932 842 908 931 793 895 931 61 60 224 806 900 933 880 838 224 883 843 932 868 842 932 899 868 231 889 845 934 69 854 231 845 22 934 814 906 934 70 69 935 874 913 231 22 23 934 71 70 933 796 901 934 854 814 933 838 796 936 856 817 936 817 910 936 119 120 287 847 903 242 850 904 937 11 12 936 897 856 937 907 875 936 910 119 937 875 11 938 894 853 939 908 881 938 853 909 147 848 804 147 893 848 147 804 148 144 859 912 262 816 911 939 881 914 262 857 816 158 895 852 940 863 826 158 852 807 158 807 159 940 905 863 190 855 919 940 826 916 941 822 915 190 884 855 942 869 827 942 827 917 941 900 860 941 860 822 942 906 869 172 858 813 943 101 924 280 865 823 943 102 101 184 876 836 172 813 170 280 823 918 200 818 193 200 861 818 220 862 926 155 829 152 184 836 922 220 888 862 155 867 829 155 909 867 229 892 929 944 916 882 944 882 927 205 148 866 174 873 921 205 866 920 214 886 928 250 899 932 945 922 890 186 878 925 946 902 874 222 870 923 237 871 828 197 840 198 946 874 935 197 879 840 946 926 902 197 918 879 945 849 930 945 890 849 947 897 936 237 828 235 216 883 224 947 120 121 216 152 883 237 170 871 165 907 937 254 193 877 254 877 833 947 936 120 180 908 939 254 833 258 246 859 144 246 898 859 233 889 231 189 913 884 252 891 850 161 905 940 189 935 913 189 884 190 270 880 933 286 885 847 209 103 102 252 850 242 256 50 894 256 894 938 256 51 50 261 857 262 177 906 942 209 102 943 286 847 287 261 198 896 291 33 34 219 888 220 183 144 912 291 887 33 261 896 857 219 914 888 183 912 876 183 876 184 219 939 914 276 900 941 156 893 147 282 865 280 228 892 229 282 904 865 228 919 892 167 895 158 282 242 904 249 899 250 211 916 944 213 886 214 308 858 172 213 917 886 154 938 909 249 924 899 154 909 155 239 922 945 308 901 858 298 873 174 265 926 946 298 911 873 284 229 929 312 903 861 304 915 878 312 287 903 284 907 165 304 878 186 948 947 121 948 121 122 312 861 200 948 944 927 149 148 205 284 929 907 293 908 180 948 897 947 202 918 197 948 927 897 245 928 898 168 870 222 202 280 918 245 898 246 293 932 908 293 250 932 245 214 928 168 159 870 153 152 216 195 935 189 175 921 889 268 905 161 163 104 103 268 930 905 273 934 906 175 889 233 273 71 934 171 170 237 175 174 921 273 72 71 194 193 254 273 906 177 163 103 209 187 925 891 187 186 925 166 12 13 187 891 252 166 165 937 166 13 14 166 937 12 145 144 183 207 880 270 162 940 916 181 180 939 207 205 920 206 198 261 162 161 940 181 939 219 207 920 880 201 919 228 162 916 211 223 885 286 225 224 900 225 900 276 178 917 213 223 923 885 223 222 923 201 190 919 178 177 942 178 942 917 210 209 943 232 23 24 210 924 249 232 24 25 191 922 239 236 887 291 232 231 23 236 235 887 210 943 924 226 220 926 191 184 922 259 893 156 259 258 893 203 122 123 226 926 265 243 242 282 203 948 122 257 256 938 203 944 948 203 211 944 351 931 895 247 229 284 257 938 154 351 61 931 351 62 61 351 895 167 263 911 298 217 214 245 271 270 933 263 262 911 240 239 945 271 933 901 271 901 308 240 945 930 277 915 304 240 930 268 251 250 293 277 276 941 266 946 935 277 941 915 288 287 312 266 935 195 281 280 202 143 246 144 266 265 946 +-1.73555993795288e-13 0 381 2290 2290 381 1.85719418710551 92.2090028505607 381 7.42576437265916 184.268442361302 381 16.6966783154562 276.02899778469 381 29.6548985591794 367.341833164271 381 46.279406823207 458.058838747142 381 66.5432380943407 548.032871218507 381 90.4135243641572 637.117992368676 381 117.851547941037 725.169705805372 381 148.8128042504 812.045191327406 381 183.247074021293 897.603536579572 381 221.098504742225 981.705965612994 381 262.305701254149 1064.21606398023 381 306.801825333635 1145 381 354.51470410471 1223.92674183266 381 405.366947103527 1300.86827001435 381 459.276071805982 1375.69978510497 381 516.154637414671 1448.29991011341 381 575.910386688179 1518.55088737142 381 638.446395582665 1586.33876953698 381 703.661230463018 1651.55360441734 381 771.449112628579 1714.08961331182 381 841.700089886587 1773.84536258533 381 914.300214895029 1830.72392819402 381 989.131729985654 1884.63305289647 381 1066.07325816734 1935.48529589529 381 1145 1983.19817466636 381 1225.78393601977 2027.69429874585 381 1308.29403438701 2068.90149525778 381 1392.39646342043 2106.75292597871 381 1477.95480867259 2141.1871957496 381 1564.83029419463 2172.14845205896 381 1652.88200763132 2199.58647563584 381 1741.96712878149 2223.45676190566 381 1831.94116125286 2243.72059317679 381 1922.65816683573 2260.34510144082 381 2013.97100221531 2273.30332168454 381 2105.7315576387 2282.57423562734 381 2197.79099714944 2288.14280581289 381 1.26898491714655e-13 0 -381 2290 2290 -381 1.85719418710551 92.2090028505607 -381 7.42576437265916 184.268442361302 -381 16.6966783154562 276.02899778469 -381 29.6548985591794 367.341833164271 -381 46.279406823207 458.058838747142 -381 66.5432380943407 548.032871218507 -381 90.4135243641572 637.117992368676 -381 117.851547941037 725.169705805372 -381 148.8128042504 812.045191327406 -381 183.247074021293 897.603536579572 -381 221.098504742225 981.705965612994 -381 262.305701254149 1064.21606398023 -381 306.801825333635 1145 -381 354.51470410471 1223.92674183266 -381 405.366947103527 1300.86827001435 -381 459.276071805982 1375.69978510497 -381 516.154637414671 1448.29991011341 -381 575.910386688179 1518.55088737142 -381 638.446395582665 1586.33876953698 -381 703.661230463018 1651.55360441734 -381 771.449112628579 1714.08961331182 -381 841.700089886587 1773.84536258533 -381 914.300214895029 1830.72392819402 -381 989.131729985654 1884.63305289647 -381 1066.07325816734 1935.48529589529 -381 1145 1983.19817466636 -381 1225.78393601977 2027.69429874585 -381 1308.29403438701 2068.90149525778 -381 1392.39646342043 2106.75292597871 -381 1477.95480867259 2141.1871957496 -381 1564.83029419463 2172.14845205896 -381 1652.88200763132 2199.58647563584 -381 1741.96712878149 2223.45676190566 -381 1831.94116125286 2243.72059317679 -381 1922.65816683573 2260.34510144082 -381 2013.97100221531 2273.30332168454 -381 2105.7315576387 2282.57423562734 -381 2197.79099714944 2288.14280581289 -381 37.3445304655625 0 379.165380862107 74.3294126881448 0 373.679191833631 110.59846203395 0 364.594267913972 145.802387731099 0 351.9981018868 179.602156730705 0 336.012001716723 211.672258780468 0 316.78992228727 241.703841266349 0 294.516982731203 269.407683632075 0 269.407683632075 294.516982731203 0 241.703841266349 316.78992228727 0 211.672258780469 336.012001716723 0 179.602156730705 351.9981018868 0 145.8023877311 364.594267913971 0 110.598462033951 373.679191833631 0 74.3294126881455 379.165380862107 0 37.3445304655633 381 0 8.736767006471e-13 379.165380862107 0 -37.3445304655616 373.679191833631 0 -74.3294126881438 364.594267913972 0 -110.598462033949 351.998101886801 0 -145.802387731098 336.012001716724 0 -179.602156730704 316.789922287271 0 -211.672258780467 294.516982731204 0 -241.703841266348 269.407683632076 0 -269.407683632073 241.703841266351 0 -294.516982731201 211.67225878047 0 -316.789922287269 179.602156730707 0 -336.012001716722 145.802387731101 0 -351.998101886799 110.598462033953 0 -364.594267913971 74.3294126881475 0 -373.67919183363 37.3445304655654 0 -379.165380862107 2290 2252.65546953444 379.165380862107 2290 2215.67058731186 373.679191833631 2290 2179.40153796605 364.594267913972 2290 2144.1976122689 351.9981018868 2290 2110.39784326929 336.012001716723 2290 2078.32774121953 316.78992228727 2290 2048.29615873365 294.516982731203 2290 2020.59231636793 269.407683632075 2290 1995.4830172688 241.703841266349 2290 1973.21007771273 211.672258780469 2290 1953.98799828328 179.602156730705 2290 1938.0018981132 145.8023877311 2290 1925.40573208603 110.598462033951 2290 1916.32080816637 74.3294126881455 2290 1910.83461913789 37.3445304655633 2290 1909 8.736767006471e-13 2290 1910.83461913789 -37.3445304655616 2290 1916.32080816637 -74.3294126881438 2290 1925.40573208603 -110.598462033949 2290 1938.0018981132 -145.802387731098 2290 1953.98799828328 -179.602156730704 2290 1973.21007771273 -211.672258780467 2290 1995.4830172688 -241.703841266348 2290 2020.59231636792 -269.407683632073 2290 2048.29615873365 -294.516982731201 2290 2078.32774121953 -316.789922287269 2290 2110.39784326929 -336.012001716722 2290 2144.1976122689 -351.998101886799 2290 2179.40153796605 -364.594267913971 2290 2215.67058731185 -373.67919183363 2290 2252.65546953443 -379.165380862107 1800.91232914861 1952.54743192163 -261.458064027986 1713.96168056775 1898.94385058741 -227.51742343876 1807.83230237768 1924.92135021348 -227.51742343876 1387.37506907458 1688.69247096195 66.1599556911012 1305.60210812986 1642.36866077423 66.1599556911012 1300.34913496681 1651.13271702641 109.272031662926 1382.55845520572 1697.70372170098 109.272031662926 247.365489300779 100.34819874105 -291.862932828329 374.439896793223 905.992454919547 -340.474035963219 367.741987799834 796.225339033655 -318.320856148327 409.126357387429 889.586980858145 -318.320856148327 294.706311806842 826.477706567039 -358.02288851943 332.29233010807 810.909068031068 -340.474035963219 1308.24647497398 1637.95680123222 22.1531798148923 839.640622285915 1600.2249770181 -358.02288851943 762.868325651687 1527.13167434831 -358.02288851943 791.635418636589 1498.36458136341 -340.474035963219 2102.82209807589 1900.44913103066 22.1531798148922 2009.79694301894 1888.97557248959 22.1531798148923 2102.31793178039 1905.5680173325 66.1599556911012 279.55394828162 98.7668811523874 -261.458064027986 299.293218655982 941.534186703704 370.730095690913 255.492219315464 842.720715513121 370.730095690913 259.84923102184 960.189803475346 378.42381429968 732.855158628323 1557.14484137168 -370.730095690912 866.961529697537 1570.08100090662 -340.474035963219 1589.05447937367 1959.01149386646 318.320856148329 1479.09093196893 1957.70766989193 340.47403596322 1576.12786982955 1995.13894732538 340.47403596322 1493.77466096635 1922.25801220017 318.320856148329 866.961529697536 1570.08100090662 340.47403596322 791.635418636587 1498.36458136341 340.47403596322 839.640622285914 1600.2249770181 358.022888519431 1548.12294369475 2073.40747257955 -370.730095690912 1447.27928448688 2034.50778068453 -370.730095690912 1562.42224290579 2033.44360850689 -358.02288851943 417.04869366033 372.553178330847 -22.1531798148902 401.024427510413 280.203056981058 -22.1531798148902 417.04869366033 372.553178330847 22.1531798148923 1907.61432221938 1922.38261912983 -190.499999999998 1813.74807822663 1901.30424916987 -190.499999999998 1818.57965597551 1882.01550956766 -150.906390860917 689.416010985615 1069.47602965507 -109.272031662924 638.867282973588 989.650865033194 -109.272031662924 697.91175937181 1063.79935207028 -66.1599556910992 394.793592515869 678.115695669767 261.458064027988 363.802891522487 584.305504830706 261.458064027988 332.963309151077 593.660589866908 291.862932828331 1911.49362652827 1902.88003937575 -150.906390860917 1212.10504377707 1613.18380303131 -150.906390860917 1143.27526715353 1546.17931397822 -109.272031662924 1220.52397034493 1600.58398901439 -109.272031662924 391.056149412585 576.038319432249 227.517423438762 837.702954492288 1316.28531577079 190.5 774.865250690497 1243.43895400581 190.5 756.044964308267 1258.88436387703 227.517423438762 2195.54443271938 1922.68724178054 109.272031662926 1134.24823798066 1558.35085382034 -150.906390860917 364.450190037901 688.972738680533 291.862932828331 790.236299092902 1230.82426058915 150.906390860919 2194.80087749905 1937.82265599524 150.906390860919 1460.47485389725 1753.88356255385 150.906390860919 1375.41506580904 1711.06806327636 150.906390860919 819.663208310651 1332.63558865234 227.517423438762 1451.97306713974 1771.85908037436 190.5 315.164321799966 194.504337345719 -227.51742343876 307.999222381796 97.3694544450168 -227.51742343876 339.393827982857 192.117939279115 -190.499999999998 2101.31641717366 1915.73656578032 109.272031662926 1674.88458817955 2027.76376028118 -340.474035963219 1576.12786982955 1995.13894732537 -340.474035963219 1589.05447937367 1959.01149386645 -318.320856148327 486.38465605175 964.052486312057 -291.862932828329 441.253376289662 874.392032562995 -291.862932828329 1686.02293693576 1991.04554525488 -318.320856148327 432.595558031156 465.255592514604 66.1599556911012 412.003873133698 373.556655524805 66.1599556911012 401.982454623748 375.550039605121 109.272031662926 970.057810075313 1608.35421199555 -318.320856148327 892.72953757239 1541.65038540336 -318.320856148327 992.603613644904 1580.88207085879 -291.862932828329 470.386490682652 860.613095643098 -261.458064027986 514.806577943211 948.860652555947 -261.458064027986 422.68402147955 467.738303176241 109.272031662926 367.741987799832 796.225339033656 318.320856148329 330.988506133544 700.945520626331 318.320856148329 294.861052674624 713.872130170456 340.47403596322 892.980121080684 1702.27364777968 370.730095690913 781.833986344935 1664.0047712481 378.42381429968 865.299482553125 1736.00260341603 378.42381429968 811.136283741688 1631.6746681724 370.730095690913 1663.07499092373 2066.69478505911 358.022888519431 1548.12294369475 2073.40747257955 370.730095690913 1650.75384971202 2107.31214426408 370.730095690913 1562.42224290578 2033.44360850689 358.022888519431 2007.54295690571 1904.17071259444 -109.272031662924 1914.44996039488 1888.01754537625 -109.272031662924 2009.04221216785 1894.06355460111 -66.1599556910992 756.159081496366 1137.57395510262 -22.1531798148902 702.188551704674 1060.94169079464 22.1531798148923 756.159081496366 1137.57395510262 22.1531798148922 1793.08173930623 1983.80889893132 -291.862932828329 1696.33941013309 1957.03669084892 -291.862932828329 1705.6944951693 1926.19710847751 -261.458064027986 332.292330108068 810.909068031068 340.47403596322 370.839635503615 284.680547912026 -150.906390860917 359.18273579965 190.168901977333 -150.906390860917 374.263434219676 188.683582826338 -109.272031662924 385.829287405564 282.457043094294 -109.272031662924 702.188551704674 1060.94169079464 -22.1531798148902 1305.60210812986 1642.36866077423 -66.1599556910992 1226.20064792972 1592.08824062819 -66.1599556910992 215.180355963744 859.418436037934 -378.42381429968 175.509903160867 756.576654311944 -378.42381429968 255.492219315466 842.72071551312 -370.730095690912 1229.05830920536 1587.81144829533 -22.1531798148902 1308.24647497398 1637.95680123222 -22.1531798148902 866.685518994028 1423.31448100597 261.458064027988 798.561232200713 1351.76130496029 261.458064027988 774.682394189262 1373.40382219143 291.862932828331 843.897392075855 1446.10260792415 291.862932828331 433.382960448072 563.198621676959 150.906390860919 407.98449043234 471.420344024494 150.906390860919 414.354529260931 568.970833171829 190.5 2102.82209807589 1900.44913103066 -22.1531798148902 2009.79694301894 1888.97557248959 -22.1531798148902 1530.60641664212 1833.33828812169 227.517423438762 1441.56349341725 1793.86827482838 227.517423438762 1519.70775359796 1859.64998825464 261.458064027988 1533.42334568806 2114.49009683913 -378.42381429968 1430.58156396207 2074.81964403626 -378.42381429968 211.869139128205 102.092022603342 -318.320856148327 587.931011355439 1020.18089132887 -227.51742343876 539.923324263299 935.435471949009 -227.51742343876 608.813908874112 1007.66416424773 -190.499999999998 1902.86450840409 1946.26154570368 -227.51742343876 809.848669786784 1214.72880392282 66.1599556911012 743.820686021777 1146.72473284647 109.272031662926 801.950242454627 1221.21087571522 109.272031662926 752.027659539979 1140.63802645346 66.1599556911012 337.663069382515 923.386598853846 358.022888519431 294.70631180684 826.47770656704 358.022888519431 1090.93435819337 1616.75286000101 -261.458064027986 1013.04838246935 1555.97004796637 -261.458064027986 1031.11563612298 1533.95503569173 -227.51742343876 1107.89962359611 1593.87784765454 -227.51742343876 1744.32274161935 2178.46572916969 378.42381429968 2196.04579393428 1912.4817998021 66.1599556911012 1638.08778684257 2149.06655779127 378.42381429968 412.003873133698 373.556655524805 -66.1599556910992 395.936445398895 280.957787832148 -66.1599556910992 1663.07499092373 2066.6947850591 -358.02288851943 1389.79977097584 1684.15617276687 22.1531798148922 337.663069382517 923.386598853845 -358.02288851943 892.729537572388 1541.65038540336 318.320856148329 818.767411999891 1471.23258800011 318.320856148329 2005.31945208798 1919.16036449639 -150.906390860917 421.60837110255 668.521214475671 227.517423438762 811.13628374169 1631.6746681724 -370.730095690912 286.821879756773 197.295824237122 -261.458064027986 676.816196968693 1077.89495622293 -150.906390860917 625.869548837438 997.441407064533 -150.906390860917 852.436514125411 1302.93159570773 150.906390860919 1601.02726131947 1925.5498099621 291.862932828331 1784.44642814492 2018.28299352979 -318.320856148327 1507.37490818021 1889.42411092483 291.862932828331 309.408917102613 1058.64798957349 378.42381429968 2102.31793178039 1905.5680173325 -66.1599556910992 1201.05771976543 1629.71729180915 -190.499999999998 1122.40296111176 1574.32236079008 -190.499999999998 455.041916325151 980.805529727131 -318.320856148327 437.585063558378 464.005786442232 22.1531798148923 919.906961697533 1669.4631975551 358.022888519431 400.575889075169 782.625091819792 291.862932828331 1466.95388160854 1740.18480940868 109.272031662926 945.715865076894 1638.01495779579 -340.474035963219 1897.30841816603 1974.19389757929 -261.458064027986 752.027659539979 1140.63802645346 -66.1599556910992 351.170199020514 287.59823319707 -190.499999999998 2196.29818109342 1907.34434115539 22.1531798148923 1674.88458817955 2027.76376028118 340.47403596322 447.88411608517 558.799744205972 109.272031662926 1650.75384971202 2107.31214426407 -370.730095690912 2002.40176680293 1938.82980097949 -190.499999999998 886.823622430507 1403.17637756949 227.517423438762 173.544925006565 103.974770513029 -340.474035963219 563.503261646085 1034.82232104641 -261.458064027986 1300.34913496681 1651.13271702641 -109.272031662924 374.439896793221 905.992454919548 340.47403596322 952.197207096871 1803.81825325647 378.42381429968 1775.12317343438 2055.50351272734 -340.474035963219 1539.92351159151 1810.84483113298 190.5 813.824768409331 1211.46570411305 22.1531798148923 401.982454623749 375.550039605121 -109.272031662924 1071.73659101447 1642.63805252922 -291.862932828329 299.293218655985 941.534186703703 -370.730095690912 2101.31641717366 1915.73656578032 -109.272031662924 444.531901917881 660.319043997216 190.5 1891.02118809429 2005.80193761506 -291.862932828329 916.596177808566 1515.31760581074 291.862932828331 1754.92475569668 2136.14011641432 370.730095690913 2196.29818109342 1907.34434115539 -22.1531798148902 660.282708190846 1088.94228023457 -190.499999999998 1389.79977097584 1684.15617276687 -22.1531798148902 254.749784760911 200.454649881868 -291.862932828329 1638.08778684257 2149.06655779127 -378.42381429968 347.890004998079 1038.07941956986 370.730095690913 781.833986344937 1664.00477124809 -378.42381429968 702.001794163384 1587.99820583662 -378.42381429968 863.664641091168 1292.75501461893 109.272031662926 1998.82935773881 1962.9130266579 -227.51742343876 421.20221555025 998.893226628558 -340.474035963219 437.585063558378 464.005786442232 -22.1531798148902 1611.88430433023 1895.20640748413 261.458064027988 430.350011745356 770.29224640204 261.458064027988 1765.23805620069 2094.96711285302 -358.02288851943 1187.53139441577 1649.96086827514 -227.51742343876 2099.83109802267 1930.81726420035 -150.906390860917 945.715865076892 1638.01495779579 340.47403596322 1471.32253253851 1730.94807307514 66.1599556911012 327.086973342096 291.170642261187 -227.51742343876 457.661892918731 555.833688030458 66.1599556911012 743.820686021778 1146.72473284647 -109.272031662924 1884.08784218993 2040.65822129257 -318.320856148327 919.906961697535 1669.4631975551 -358.02288851943 2196.04579393428 1912.4817998021 -66.1599556910992 132.911116187283 105.970981534455 -358.02288851943 904.039369082904 1385.9606309171 190.5 1994.65053559981 1991.08435721873 -261.458064027986 535.861003155457 1051.39045318057 -291.862932828329 409.126357387427 889.586980858146 318.320856148329 1686.02293693576 1991.04554525488 318.320856148329 978.189501672486 1768.77170106789 370.730095690913 1292.55859293547 1664.13045116256 -150.906390860917 387.119960624246 378.506373471728 -150.906390860917 1754.92475569668 2136.14011641432 -370.730095690912 1547.53304072024 1792.4738027071 150.906390860919 813.824768409331 1211.46570411305 -22.1531798148902 463.254183532531 653.620104519432 150.906390860919 259.849231021843 960.189803475345 -378.42381429968 2097.88206072089 1950.60617201714 -190.499999999998 219.381756878036 203.938096582028 -318.320856148327 938.238695039712 1491.43876779929 261.458064027988 1876.60214206229 2078.29137717049 -340.474035963219 1050.56593892705 1671.18337241585 -318.320856148327 385.323177628565 1018.0709719449 358.022888519431 640.039131724859 1102.46860558423 -227.51742343876 2195.54443271938 1922.68724178054 -109.272031662924 1765.23805620069 2094.96711285303 358.022888519431 1989.92181178663 2022.96282374358 -291.862932828329 432.595558031156 465.255592514604 -66.1599556910992 871.235494234017 1285.89319330585 66.1599556911012 1387.37506907458 1688.69247096195 -66.1599556910992 385.323177628568 1018.0709719449 -358.02288851943 456.661711878309 759.393583357877 227.517423438762 1744.32274161935 2178.46572916968 -378.42381429968 970.057810075312 1608.35421199555 318.320856148329 2095.49566265428 1974.83567820003 -227.51742343876 298.915642781273 295.349464400196 -261.458064027986 1621.47878552433 1868.39162889745 227.517423438762 363.740020581376 1154.55579993814 378.42381429968 1868.66531896398 2118.19248137464 -358.02288851943 1171.70898807425 1673.64077278509 -261.458064027986 731.649146179664 1155.75176201934 -150.906390860917 462.5840632907 554.340563971971 22.1531798148923 2194.80087749905 1937.82265599524 -150.906390860917 1851.87228070725 2202.61678579547 378.42381429968 90.5172152279965 108.053660338024 -370.730095690912 1473.52172817765 1726.29826456667 22.1531798148922 918.099945511082 1371.90005448892 150.906390860919 505.378050009792 1069.66123216659 -318.320856148327 1984.70713417682 2058.11732465971 -318.320856148327 441.25337628966 874.392032562995 291.862932828331 892.980121080686 1702.27364777967 -370.730095690912 1696.33941013309 1957.03669084892 291.862932828331 2092.70417576288 2003.17812024323 -261.458064027986 1003.4739752444 1734.67953502148 358.022888519431 367.617380870166 382.385677780623 -190.499999999998 809.848669786784 1214.72880392282 -66.1599556910992 1860.38470481192 2159.82193992035 -370.730095690912 2193.82518358211 1957.68336193349 -190.499999999998 1282.33583575227 1681.18609112589 -190.499999999998 477.522029205436 648.514987706834 109.272031662926 957.364411347663 1470.33679168935 227.517423438762 1979.07702233935 2096.07245564922 -340.474035963219 181.196088011981 207.699056696778 -340.474035963219 1553.33209820089 1778.47363948833 109.272031662926 616.359227214907 1118.29101192575 -261.458064027986 2089.54535011813 2035.25021523909 -291.862932828329 1042.31781574641 1867.28834692899 378.42381429968 1027.70869868266 1702.00279317846 -340.474035963219 421.202215550248 998.893226628559 340.47403596322 1851.87228070725 2202.61678579547 -378.42381429968 422.68402147955 467.73830317624 -109.272031662924 2192.63054555499 1982.0007776182 -227.51742343876 875.046690752876 1282.4389261304 22.1531798148923 347.890004998082 1038.07941956986 -370.730095690912 479.155168867025 750.076488408495 190.5 1775.12317343438 2055.50351272734 340.47403596322 1973.10761387844 2136.31493867687 -358.02288851943 267.037176256419 300.078188213368 -291.862932828329 992.603613644903 1580.88207085879 291.862932828331 1382.55845520572 1697.70372170098 -109.272031662924 1629.68095600279 1845.46809808212 190.5 715.677639209924 1167.59703888824 -190.499999999998 2086.06190341797 2070.61824312196 -318.320856148327 401.165504426881 1132.12382818926 370.730095690913 2191.23311884761 2010.44605171838 -261.458064027986 928.815206539543 1361.18479346046 109.272031662926 1153.80447164356 1700.43677525301 -291.862932828329 462.5840632907 554.340563971971 -22.1531798148902 46.9365269131249 110.194642265718 -378.42381429968 472.466631857371 1089.38757706191 -340.474035963219 1966.87963480313 2178.30056319505 -370.730095690912 2082.30094330322 2108.80391198802 -340.474035963219 1860.38470481192 2159.82193992035 370.730095690913 470.38649068265 860.613095643099 261.458064027988 1027.70869868266 1702.00279317847 340.47403596322 1473.52172817765 1726.29826456667 -22.1531798148902 2189.65180125895 2042.63451069922 -291.862932828329 801.950242454627 1221.21087571522 -109.272031662924 343.73845429632 387.135491595911 -227.51742343876 487.142490800128 645.072731506566 66.1599556911012 865.299482553127 1736.00260341603 -378.42381429968 1960.47730784638 2221.46154565783 -378.42381429968 973.714684229213 1452.29704550771 190.5 140.709173827261 211.686669692432 -358.02288851943 2078.31333030757 2149.29082617274 -358.02288851943 1705.6944951693 1926.19710847751 261.458064027988 589.563224746992 1136.19552835644 -291.862932828329 455.041916325149 980.805529727132 318.320856148329 2187.90797739666 2078.1308608718 -318.320856148327 1269.81910867113 1702.06898864456 -227.51742343876 1066.55914865579 1831.00862840212 370.730095690913 1557.24226172922 1769.03366966714 66.1599556911012 2074.15299005609 2191.53146961642 -370.730095690912 407.984490432341 471.420344024494 -150.906390860917 2186.02522948697 2116.45507499344 -340.474035963219 1003.4739752444 1734.67953502148 -358.02288851943 875.046690752876 1282.4389261304 -22.1531798148902 309.408917102616 1058.64798957349 -378.42381429968 2069.87618401369 2234.95461007964 -378.42381429968 497.526197292897 742.466959279758 150.906390860919 1784.44642814492 2018.28299352979 318.320856148329 1013.04838246935 1555.97004796637 261.458064027988 2184.02901846555 2157.08888381272 -358.02288851943 231.882675340285 305.29286582318 -318.320856148327 437.571819169695 1110.30272289205 358.022888519431 1375.41506580904 1711.06806327636 -150.906390860917 2181.94633966198 2199.482784772 -370.730095690912 696.122152345458 1182.10037640389 -227.51742343876 2179.80535773428 2243.06347308688 -378.42381429968 1636.37989548057 1826.74581646747 150.906390860919 457.661892918731 555.833688030458 -66.1599556910992 936.040246644734 1353.95975335527 66.1599556911012 437.571819169697 1110.30272289205 -358.02288851943 1134.05997299351 1729.98650571362 -318.320856148327 496.131725171621 848.436506582753 227.517423438762 315.806102420706 392.691581833971 -261.458064027986 1050.56593892705 1671.18337241585 318.320856148329 1868.66531896398 2118.19248137464 358.022888519431 422.711653071005 1247.68218425359 378.42381429968 1471.32253253851 1730.94807307514 -66.1599556910992 491.985468077286 643.339886528603 22.1531798148923 790.236299092903 1230.82426058915 -150.906390860917 98.4685303835754 215.84700994391 -370.730095690912 987.06840429227 1437.56348587459 150.906390860919 1713.96168056775 1898.94385058742 227.517423438762 560.013494286381 1155.94002700649 -318.320856148327 486.384656051749 964.052486312057 291.862932828331 1255.17767895359 1726.49673835392 -261.458064027986 1090.14034267128 1795.71687754801 358.022888519431 388.695750830132 476.251921773373 -190.499999999998 1960.47730784638 2221.46154565783 378.42381429968 871.235494234017 1285.89319330585 -66.1599556910992 511.526360511667 736.667901799106 109.272031662926 1031.11563612297 1533.95503569173 227.517423438762 1559.21065305133 1764.28155264125 22.1531798148923 193.927544350784 310.922977660655 -340.474035963219 673.247139998987 1199.06564180663 -261.458064027986 978.189501672488 1768.77170106788 -370.730095690912 1793.08173930623 1983.80889893132 291.862932828331 472.466631857369 1089.38757706191 340.47403596322 1135.44420006186 1926.25997941862 378.42381429968 1366.04150297173 1728.60476589459 -190.499999999998 447.884116085171 558.799744205972 -109.272031662924 518.140919625643 838.026932860258 190.5 939.677359553672 1350.32264044633 22.1531798148923 401.165504426883 1132.12382818926 -370.730095690912 1641.48501229317 1812.47797079456 109.272031662926 284.198062384941 398.978811905716 -291.862932828329 1071.73659101447 1642.63805252922 291.862932828331 1112.74250259697 1761.89035475453 -340.474035963219 458.99137159788 1223.44085134421 370.730095690913 774.865250690498 1243.43895400581 -190.499999999998 491.985468077286 643.339886528603 -22.1531798148902 997.244985381071 1426.33535890883 109.272031662926 1876.60214206229 2078.29137717049 340.47403596322 55.0453899203567 220.123815986308 -378.42381429968 1466.95388160854 1740.18480940868 -109.272031662924 514.806577943209 948.860652555948 261.458064027988 528.109645245468 1177.25749740303 -340.474035963219 1721.02916682817 1875.64547073907 190.5 365.078649786522 482.167697622317 -227.51742343876 1112.74250259697 1761.89035475453 340.47403596322 1238.60954681943 1754.13899684454 -291.862932828329 520.966330332855 732.757738270777 66.1599556911012 863.664641091169 1292.75501461893 -109.272031662924 153.685061323131 316.892386121557 -358.02288851943 1966.87963480312 2178.30056319506 370.730095690913 1046.56104599419 1515.1347493095 190.5 1559.21065305133 1764.28155264125 -22.1531798148902 505.37805000979 1069.66123216659 318.320856148329 647.361947470782 1218.26340898553 -291.862932828329 433.382960448073 563.198621676959 -150.906390860917 952.197207096873 1803.81825325647 -378.42381429968 1157.87617181074 1888.83449557312 370.730095690913 1800.91232914861 1952.54743192163 261.458064027988 939.677359553672 1350.32264044633 -22.1531798148902 536.116437446146 829.525146102753 150.906390860919 249.341778707427 405.912157810068 -318.320856148327 1354.56452805099 1750.0766757367 -227.51742343876 363.740020581379 1154.55579993814 -378.42381429968 1090.93435819337 1616.75286000101 261.458064027988 1644.92726849343 1802.85750919987 66.1599556911012 494.283122451991 1199.85965732873 358.022888519431 487.142490800128 645.072731506566 -66.1599556910992 756.044964308268 1258.88436387703 -227.51742343876 1090.14034267128 1795.71687754801 -358.02288851943 1004.10680669415 1418.76450576598 66.1599556911012 539.923324263298 935.43547194901 227.517423438762 1884.08784218993 2040.65822129258 318.320856148329 494.283122451993 1199.85965732872 -358.02288851943 337.452568078369 489.087670851389 -261.458064027986 1460.47485389725 1753.88356255385 -150.906390860917 486.18174674353 1337.80279290313 378.42381429968 1134.05997299351 1729.98650571362 318.320856148329 1726.80137832304 1856.61703955193 150.906390860919 852.436514125412 1302.93159570773 -150.906390860917 525.718447358747 730.789346948669 22.1531798148923 111.699436804946 323.120365196877 -370.730095690912 1059.17573941085 1499.7637009071 150.906390860919 1220.33876783341 1784.62194999021 -318.320856148327 535.861003155455 1051.39045318057 291.862932828331 618.816627584155 1239.43406107295 -318.320856148327 1973.10761387844 2136.31493867687 358.022888519431 1179.69727710795 1852.42818083031 358.022888519431 1557.24226172922 1769.03366966714 -66.1599556910992 414.354529260932 568.970833171829 -190.499999999998 549.815190591318 823.046118391457 109.272031662926 936.040246644734 1353.95975335527 -66.1599556910992 211.708622829509 413.397857937712 -340.474035963219 1807.83230237768 1924.92135021348 227.517423438762 1107.89962359611 1593.87784765454 227.517423438762 1341.13934744405 1775.19342205679 -261.458064027986 734.029952033635 1276.95161753065 -261.458064027986 528.109645245466 1177.25749740303 340.47403596322 2069.87618401369 2234.95461007965 378.42381429968 1231.35201042651 1980.59108289739 378.42381429968 477.522029205437 648.514987706834 -109.272031662924 561.395234105409 923.95849702827 190.5 1646.6601134714 1798.01453192271 22.1531798148923 1007.5610738696 1414.95330924712 22.1531798148923 1066.55914865579 1831.00862840212 -370.730095690912 306.191101068679 496.918260693767 -291.862932828329 458.991371597882 1223.44085134421 -370.730095690912 1891.02118809428 2005.80193761506 291.862932828331 521.228298932115 1311.81049832751 370.730095690913 1153.80447164356 1700.43677525301 291.862932828331 525.718447358747 730.789346948669 -22.1531798148902 1451.97306713974 1771.85908037436 -190.499999999998 68.5384543421742 329.522692153617 -378.42381429968 837.702954492288 1316.28531577079 -190.499999999998 563.503261646083 1034.82232104641 261.458064027988 1068.78912428478 1488.04975754537 109.272031662926 1731.20025579403 1842.11588391483 109.272031662926 1200.61242293809 1817.53336814263 -340.474035963219 587.997206821537 1262.29130131734 -340.474035963219 391.056149412585 576.038319432249 -227.51742343876 559.05192692486 818.677467461496 66.1599556911012 1979.07702233935 2096.07245564922 340.47403596322 1200.61242293809 1817.53336814263 340.47403596322 171.807518625363 421.334681036021 -358.02288851943 928.815206539544 1361.18479346046 -109.272031662924 560.013494286379 1155.94002700649 318.320856148329 1553.3320982009 1778.47363948833 -109.272031662924 1122.40296111176 1574.32236079008 190.5 1813.74807822663 1901.30424916987 190.5 709.117929141215 1297.3963863551 -291.862932828329 463.254183532532 653.620104519432 -150.906390860917 1325.94751368794 1803.61534394825 -291.862932828329 578.931936723644 914.584934190966 150.906390860919 1251.92058043014 1942.10999500192 370.730095690913 1007.5610738696 1414.95330924712 -22.1531798148902 271.717006470213 505.553571855084 -318.320856148327 2074.15299005609 2191.53146961643 370.730095690913 46.9365269131217 110.194642265719 378.42381429968 555.320464978522 1286.5260247556 358.022888519431 422.711653071008 1247.68218425359 -378.42381429968 1646.6601134714 1798.01453192271 -22.1531798148902 1171.70898807425 1673.64077278509 261.458064027988 520.966330332856 732.757738270777 -66.1599556910992 1042.31781574641 1867.28834692899 -378.42381429968 90.5172152279938 108.053660338024 370.730095690913 819.663208310651 1332.63558865234 -227.51742343876 1897.30841816603 1974.1938975793 261.458064027988 587.931011355438 1020.18089132887 227.517423438762 1075.27119607718 1480.15133021322 66.1599556911012 132.911116187281 105.970981534455 358.022888519431 1441.56349341725 1793.86827482838 -227.51742343876 363.802891522488 584.305504830705 -261.458064027986 555.320464978524 1286.5260247556 -358.02288851943 55.0453899203535 220.123815986308 378.42381429968 1734.16631196954 1832.33810708127 66.1599556911012 553.997396583968 1424.70051744688 378.42381429968 173.544925006563 103.974770513029 340.47403596322 1220.33876783341 1784.62194999021 318.320856148329 563.701735433334 816.478271822348 22.1531798148923 1179.69727710795 1852.4281808303 -358.02288851943 918.099945511083 1371.90005448892 -150.906390860917 130.178060079649 429.615295188082 -370.730095690912 98.4685303835727 215.84700994391 370.730095690913 1134.24823798066 1558.35085382034 150.906390860919 589.56322474699 1136.19552835644 291.862932828331 1984.70713417682 2058.11732465972 318.320856148329 211.869139128202 102.092022603342 318.320856148329 1547.53304072024 1792.4738027071 -150.906390860917 444.531901917882 660.319043997215 -190.499999999998 681.645788004455 1319.94218992469 -318.320856148327 1271.9290280551 1904.67682237144 358.022888519431 592.296278299022 907.441544794277 109.272031662926 140.709173827258 211.686669692432 358.022888519431 1818.57965597551 1882.01550956766 150.906390860919 234.496487272664 514.876826565621 -340.474035963219 1004.10680669415 1418.76450576598 -66.1599556910992 68.538454342171 329.522692153618 378.42381429968 587.997206821535 1262.29130131734 340.47403596322 1309.19447027287 1834.95808367485 -318.320856148327 2078.31333030757 2149.29082617274 358.022888519431 247.365489300777 100.34819874105 291.862932828331 1187.53139441577 1649.96086827514 227.517423438762 798.561232200714 1351.76130496029 -261.458064027986 1644.92726849343 1802.85750919987 -66.1599556910992 511.526360511667 736.667901799106 -109.272031662924 181.196088011979 207.699056696778 340.47403596322 608.813908874111 1007.66416424773 190.5 1329.81019652465 2030.15076897816 378.42381429968 1078.53429588695 1476.17523159067 22.1531798148923 332.963309151079 593.660589866908 -291.862932828329 1902.86450840409 1946.26154570368 227.517423438762 111.699436804944 323.120365196877 370.730095690913 279.553948281618 98.7668811523875 261.458064027988 1429.3869043569 1819.61350931735 -261.458064027986 587.726352220325 1397.01987891932 370.730095690913 521.228298932117 1311.81049832751 -370.730095690912 1238.60954681943 1754.13899684455 291.862932828331 2179.80535773428 2243.06347308688 378.42381429968 563.701735433334 816.478271822348 -22.1531798148902 87.3832142045321 438.12771929275 -378.42381429968 904.039369082905 1385.9606309171 -190.499999999998 616.359227214906 1118.29101192575 261.458064027988 219.381756878033 203.938096582028 318.320856148329 1735.65943602803 1827.4159367093 22.1531798148923 1143.27526715353 1546.17931397822 109.272031662926 153.685061323129 316.892386121558 358.022888519431 1157.87617181074 1888.83449557312 -370.730095690912 1989.92181178663 2022.96282374358 291.862932828331 307.999222381795 97.3694544450169 227.517423438762 421.608371102551 668.52121447567 -227.51742343876 601.307529038048 902.624930925423 66.1599556911012 651.985042204212 1344.28413492311 -340.474035963219 1539.92351159151 1810.84483113297 -190.499999999998 87.3832142045294 438.12771929275 378.42381429968 195.032887146976 524.76194379931 -358.02288851943 1291.10677337144 1868.79778444975 340.47403596322 1822.26169682376 1867.31597852045 109.272031662926 997.244985381072 1426.33535890883 -109.272031662924 254.749784760909 200.454649881869 291.862932828331 618.816627584153 1239.43406107296 318.320856148329 1201.05771976543 1629.71729180916 190.5 1291.10677337144 1868.79778444975 -340.474035963219 497.526197292898 742.466959279757 -150.906390860917 625.869548837437 997.441407064533 150.906390860919 774.682394189264 1373.40382219143 -291.862932828329 193.927544350781 310.922977660656 340.47403596322 332.316638066509 96.1748164178922 190.5 1348.4658132963 1990.70678134402 370.730095690913 2082.30094330322 2108.80391198802 340.47403596322 1078.53429588695 1476.17523159067 -22.1531798148902 298.954454745124 603.977063064239 -318.320856148327 620.536802444902 1370.09303830247 358.022888519431 1641.48501229317 1812.47797079456 -109.272031662924 1907.61432221938 1922.38261912984 190.5 130.178060079646 429.615295188083 370.730095690913 486.181746743532 1337.80279290313 -378.42381429968 286.821879756772 197.295824237122 261.458064027988 559.05192692486 818.677467461496 -66.1599556910992 1415.60796743701 1848.74662371034 -291.862932828329 1255.17767895359 1726.49673835392 261.458064027988 640.039131724858 1102.46860558423 227.517423438762 2181.94633966198 2199.48278477201 370.730095690913 886.823622430508 1403.17637756949 -227.51742343876 231.882675340283 305.292865823181 318.320856148329 394.79359251587 678.115695669767 -261.458064027986 352.177344004761 95.1991225009481 150.906390860919 1149.36197354655 1537.97234046002 66.1599556911012 1735.65943602803 1827.4159367093 -22.1531798148902 625.995228751905 1508.16601365507 378.42381429968 620.536802444904 1370.09303830247 -358.02288851943 605.843827233131 900.200229024157 22.1531798148923 1135.44420006186 1926.25997941862 -378.42381429968 171.80751862536 421.334681036022 358.022888519431 1309.19447027287 1834.95808367485 318.320856148329 1994.65053559981 1991.08435721873 261.458064027988 153.859883585679 535.075244303325 -370.730095690912 647.36194747078 1218.26340898553 291.862932828331 1530.60641664212 1833.33828812169 -227.51742343876 987.068404292271 1437.56348587459 -150.906390860917 315.164321799964 194.504337345719 227.517423438762 111.534270830313 545.677258380651 378.42381429968 479.155168867026 750.076488408495 -190.499999999998 1212.10504377707 1613.18380303131 150.906390860919 267.037176256417 300.078188213368 291.862932828331 1824.7444074854 1857.40444196884 66.1599556911012 748.349614596642 1397.27046242761 -318.320856148327 638.867282973587 989.650865033195 109.272031662926 1271.9290280551 1904.67682237143 -358.02288851943 1366.61340114615 1952.33693061749 358.022888519431 367.312758219457 94.4555672806241 109.272031662926 262.236239718822 615.115411820449 -340.474035963219 2086.06190341797 2070.61824312197 318.320856148329 1075.27119607718 1480.15133021322 -66.1599556910992 651.98504220421 1344.28413492311 340.47403596322 211.708622829507 413.397857937712 340.47403596322 1636.37989548057 1826.74581646747 -150.906390860917 549.815190591318 823.046118391456 -109.272031662924 339.393827982856 192.117939279115 190.5 1269.81910867113 1702.06898864456 227.517423438762 660.282708190845 1088.94228023457 190.5 866.68551899403 1423.31448100597 -261.458064027986 1911.49362652827 1902.88003937575 150.906390860919 153.859883585676 535.075244303325 370.730095690913 1400.41301914186 1880.87364261257 -318.320856148327 1430.58156396207 2074.81964403626 378.42381429968 298.915642781272 295.349464400196 261.458064027988 364.450190037903 688.972738680533 -291.862932828329 2184.02901846555 2157.08888381272 358.022888519431 1152.42604489738 1533.84091850363 22.1531798148923 377.518200197903 93.954206065718 66.1599556911012 658.325331827599 1478.86371625831 370.730095690913 587.726352220327 1397.01987891932 -370.730095690912 1734.16631196954 1832.33810708127 -66.1599556910992 605.843827233131 900.200229024157 -22.1531798148902 1325.94751368794 1803.61534394825 291.862932828331 249.341778707425 405.912157810068 318.320856148329 111.534270830316 545.67725838065 -378.42381429968 1998.82935773881 1962.91302665791 227.517423438762 673.247139998986 1199.06564180663 261.458064027988 973.714684229214 1452.29704550771 -190.499999999998 359.182735799649 190.168901977333 150.906390860919 1519.70775359796 1859.64998825464 -261.458064027986 1220.52397034493 1600.58398901439 109.272031662926 195.032887146973 524.76194379931 358.022888519431 456.66171187831 759.393583357877 -227.51742343876 719.918999093381 1423.03847030246 -340.474035963219 647.631339225773 984.397891870143 66.1599556911012 1825.99421355777 1852.41493644162 22.1531798148923 327.086973342095 291.170642261187 227.517423438762 223.305214940898 626.925009076268 -358.02288851943 140.93344220873 651.912213157429 378.42381429968 1384.00754508045 1915.56010320678 340.47403596322 1251.92058043014 1942.10999500192 -370.730095690912 382.65565884461 93.7018189065844 22.1531798148923 681.645788004453 1319.94218992469 318.320856148329 2089.54535011813 2035.25021523909 291.862932828331 1068.78912428478 1488.04975754537 -109.272031662924 1629.68095600279 1845.46809808212 -190.499999999998 284.19806238494 398.978811905717 291.862932828331 1282.33583575227 1681.18609112589 190.5 536.116437446147 829.525146102753 -150.906390860917 676.816196968693 1077.89495622293 150.906390860919 843.897392075856 1446.10260792414 -291.862932828329 374.263434219675 188.683582826339 109.272031662926 1914.44996039488 1888.01754537625 109.272031662926 1384.00754508045 1915.56010320678 -340.474035963219 1447.27928448688 2034.50778068454 370.730095690913 330.988506133546 700.94552062633 -318.320856148327 2186.02522948697 2116.45507499344 340.47403596322 689.775022981898 1450.35937771409 358.022888519431 234.496487272661 514.876826565621 340.47403596322 1152.42604489738 1533.84091850363 -22.1531798148902 601.307529038048 902.624930925422 -66.1599556910992 351.170199020513 287.59823319707 190.5 1731.20025579403 1842.11588391483 -109.272031662924 553.99739658397 1424.70051744687 -378.42381429968 1341.13934744405 1775.19342205679 261.458064027988 182.687855735925 639.246150287985 370.730095690913 696.122152345457 1182.10037640389 227.517423438762 2002.40176680293 1938.82980097949 190.5 382.65565884461 93.7018189065844 -22.1531798148902 430.350011745358 770.29224640204 -261.458064027986 1507.37490818021 1889.42411092483 -291.862932828329 702.001794163382 1587.99820583662 378.42381429968 315.806102420704 392.691581833972 261.458064027988 957.364411347664 1470.33679168935 -227.51742343876 1226.20064792972 1592.08824062819 66.1599556911012 1825.99421355777 1852.41493644162 -22.1531798148902 652.043198767783 981.753525026019 22.1531798148923 384.431982667499 187.682068219607 66.1599556911012 689.7750229819 1450.35937771409 -358.02288851943 182.687855735927 639.246150287984 -370.730095690912 1231.35201042651 1980.59108289738 -378.42381429968 271.717006470211 505.553571855085 318.320856148329 2092.70417576288 2003.17812024323 261.458064027988 709.117929141214 1297.3963863551 291.862932828331 1400.41301914185 1880.87364261257 318.320856148329 1621.47878552433 1868.39162889745 -227.51742343876 518.140919625645 838.026932860257 -190.499999999998 1059.17573941085 1499.7637009071 -150.906390860917 370.839635503614 284.680547912026 150.906390860919 1916.4433444752 1877.9961268663 66.1599556911012 223.305214940895 626.925009076269 358.022888519431 689.416010985614 1069.47602965507 109.272031662926 1292.55859293547 1664.13045116256 150.906390860919 294.861052674626 713.872130170456 -340.474035963219 377.518200197903 93.954206065718 -66.1599556910992 1366.61340114616 1952.33693061748 -358.02288851943 818.767411999892 1471.23258800011 -318.320856148327 1463.52229343296 1995.29368819316 358.022888519431 2187.90797739666 2078.1308608718 318.320856148329 719.91899909338 1423.03847030246 340.47403596322 343.738454296319 387.135491595912 227.517423438762 175.509903160863 756.576654311945 378.42381429968 1726.80137832304 1856.61703955193 -150.906390860917 1149.36197354655 1537.97234046002 -66.1599556910992 592.296278299022 907.441544794276 -109.272031662924 715.677639209923 1167.59703888824 190.5 1354.56452805099 1750.0766757367 227.517423438762 389.550868969343 187.177901924113 22.1531798148923 2005.31945208798 1919.16036449639 150.906390860919 400.57588907517 782.625091819792 -291.862932828329 306.191101068677 496.918260693768 291.862932828331 938.238695039712 1491.43876779929 -261.458064027986 1493.77466096635 1922.25801220017 -318.320856148327 1533.42334568806 2114.49009683914 378.42381429968 385.829287405563 282.457043094294 109.272031662926 732.855158628321 1557.14484137168 370.730095690913 1824.7444074854 1857.40444196884 -66.1599556910992 652.043198767783 981.753525026019 -22.1531798148902 262.23623971882 615.11541182045 340.47403596322 1229.05830920536 1587.81144829533 22.1531798148923 140.933442208733 651.912213157428 -378.42381429968 658.325331827601 1478.86371625831 -370.730095690912 734.029952033634 1276.95161753065 261.458064027988 2095.49566265428 1974.83567820004 227.517423438762 1611.88430433023 1895.20640748413 -261.458064027986 367.312758219458 94.4555672806241 -109.272031662924 496.131725171622 848.436506582752 -227.51742343876 1415.60796743701 1848.74662371034 291.862932828331 367.617380870165 382.385677780623 190.5 1046.56104599419 1515.1347493095 -190.499999999998 697.911759371809 1063.79935207028 66.1599556911012 1917.44682166915 1872.95130633967 22.1531798148923 1348.4658132963 1990.70678134402 -370.730095690912 216.592527420449 741.87705630525 370.730095690913 389.550868969343 187.177901924113 -22.1531798148902 256.556391493111 727.577757094216 -358.02288851943 2189.65180125895 2042.63451069922 291.862932828331 748.349614596641 1397.27046242761 318.320856148329 1721.02916682817 1875.64547073907 -190.499999999998 337.452568078368 489.08767085139 261.458064027988 395.936445398894 280.957787832148 66.1599556911012 578.931936723645 914.584934190965 -150.906390860917 2007.54295690571 1904.17071259444 109.272031662926 1479.09093196893 1957.70766989193 -340.474035963219 731.649146179664 1155.75176201935 150.906390860919 298.954454745122 603.97706306424 318.320856148329 1366.04150297173 1728.60476589459 190.5 762.868325651685 1527.13167434832 358.022888519431 1822.26169682376 1867.31597852045 -109.272031662924 916.596177808567 1515.31760581074 -291.862932828329 352.177344004762 95.1991225009481 -150.906390860917 647.631339225774 984.397891870143 -66.1599556910992 387.119960624246 378.506373471728 150.906390860919 2097.88206072089 1950.60617201714 190.5 1601.02726131947 1925.5498099621 -291.862932828329 256.556391493109 727.577757094217 358.022888519431 1917.44682166915 1872.95130633967 -22.1531798148902 625.995228751907 1508.16601365506 -378.42381429968 384.431982667499 187.682068219607 -66.1599556910992 1429.3869043569 1819.61350931735 261.458064027988 1329.81019652466 2030.15076897816 -378.42381429968 365.078649786521 482.167697622318 227.517423438762 2191.23311884761 2010.44605171838 261.458064027988 215.180355963741 859.418436037936 378.42381429968 216.592527420452 741.87705630525 -370.730095690912 401.024427510413 280.203056981058 22.1531798148923 2009.04221216785 1894.06355460111 66.1599556911012 561.395234105411 923.958497028269 -190.499999999998 1463.52229343296 1995.29368819316 -358.02288851943 332.31663806651 96.1748164178921 -190.499999999998 2099.83109802267 1930.81726420035 150.906390860919 1916.4433444752 1877.9961268663 -66.1599556910992 388.695750830131 476.251921773373 190.5 2192.63054555499 1982.00077761821 227.517423438762 2193.82518358211 1957.68336193349 190.5 0 3.14159265358979 1.5707963267949 3.14159265358979 0.0402768288921768 3.14159265358979 0.0805536577843537 3.14159265358979 0.120830486676531 3.14159265358979 0.161107315568707 3.14159265358979 0.201384144460884 3.14159265358979 0.241660973353061 3.14159265358979 0.281937802245238 3.14159265358979 0.322214631137415 3.14159265358979 0.362491460029591 3.14159265358979 0.402768288921768 3.14159265358979 0.443045117813945 3.14159265358979 0.483321946706122 3.14159265358979 0.523598775598299 3.14159265358979 0.563875604490476 3.14159265358979 0.604152433382652 3.14159265358979 0.644429262274829 3.14159265358979 0.684706091167006 3.14159265358979 0.724982920059183 3.14159265358979 0.76525974895136 3.14159265358979 0.805536577843537 3.14159265358979 0.845813406735714 3.14159265358979 0.886090235627891 3.14159265358979 0.926367064520067 3.14159265358979 0.966643893412244 3.14159265358979 1.00692072230442 3.14159265358979 1.0471975511966 3.14159265358979 1.08747438008877 3.14159265358979 1.12775120898095 3.14159265358979 1.16802803787313 3.14159265358979 1.20830486676531 3.14159265358979 1.24858169565748 3.14159265358979 1.28885852454966 3.14159265358979 1.32913535344184 3.14159265358979 1.36941218233401 3.14159265358979 1.40968901122619 3.14159265358979 1.44996584011837 3.14159265358979 1.49024266901054 3.14159265358979 1.53051949790272 3.14159265358979 0 6.28318530717959 1.5707963267949 6.28318530717959 0.0402768288921768 6.28318530717959 0.0805536577843537 6.28318530717959 0.120830486676531 6.28318530717959 0.161107315568707 6.28318530717959 0.201384144460884 6.28318530717959 0.241660973353061 6.28318530717959 0.281937802245238 6.28318530717959 0.322214631137415 6.28318530717959 0.362491460029591 6.28318530717959 0.402768288921768 6.28318530717959 0.443045117813945 6.28318530717959 0.483321946706122 6.28318530717959 0.523598775598299 6.28318530717959 0.563875604490476 6.28318530717959 0.604152433382652 6.28318530717959 0.644429262274829 6.28318530717959 0.684706091167006 6.28318530717959 0.724982920059183 6.28318530717959 0.76525974895136 6.28318530717959 0.805536577843537 6.28318530717959 0.845813406735714 6.28318530717959 0.886090235627891 6.28318530717959 0.926367064520067 6.28318530717959 0.966643893412244 6.28318530717959 1.00692072230442 6.28318530717959 1.0471975511966 6.28318530717959 1.08747438008877 6.28318530717959 1.12775120898095 6.28318530717959 1.16802803787313 6.28318530717959 1.20830486676531 6.28318530717959 1.24858169565748 6.28318530717959 1.28885852454966 6.28318530717959 1.32913535344184 6.28318530717959 1.36941218233401 6.28318530717959 1.40968901122619 6.28318530717959 1.44996584011837 6.28318530717959 1.49024266901054 6.28318530717959 1.53051949790272 6.28318530717959 0 3.23976742401447 0 3.33794219443916 0 3.43611696486384 0 3.53429173528852 0 3.6324665057132 0 3.73064127613788 0 3.82881604656256 0 3.92699081698724 0 4.02516558741192 0 4.1233403578366 0 4.22151512826128 0 4.31968989868597 0 4.41786466911065 0 4.51603943953533 0 4.61421420996001 0 4.71238898038469 0 4.81056375080937 0 4.90873852123405 0 5.00691329165873 0 5.10508806208341 0 5.20326283250809 0 5.30143760293277 0 5.39961237335745 0 5.49778714378213 0 5.59596191420681 0 5.69413668463149 0 5.79231145505618 0 5.89048622548086 0 5.98866099590554 0 6.08683576633022 0 6.1850105367549 1.5707963267949 3.23976742401447 1.5707963267949 3.33794219443916 1.5707963267949 3.43611696486384 1.5707963267949 3.53429173528852 1.5707963267949 3.6324665057132 1.5707963267949 3.73064127613788 1.5707963267949 3.82881604656256 1.5707963267949 3.92699081698724 1.5707963267949 4.02516558741192 1.5707963267949 4.1233403578366 1.5707963267949 4.22151512826128 1.5707963267949 4.31968989868597 1.5707963267949 4.41786466911065 1.5707963267949 4.51603943953533 1.5707963267949 4.61421420996001 1.5707963267949 4.71238898038469 1.5707963267949 4.81056375080937 1.5707963267949 4.90873852123405 1.5707963267949 5.00691329165873 1.5707963267949 5.10508806208341 1.5707963267949 5.20326283250809 1.5707963267949 5.30143760293277 1.5707963267949 5.39961237335745 1.5707963267949 5.49778714378213 1.5707963267949 5.59596191420681 1.5707963267949 5.69413668463149 1.5707963267949 5.79231145505618 1.5707963267949 5.89048622548086 1.5707963267949 5.98866099590554 1.5707963267949 6.08683576633022 1.5707963267949 6.1850105367549 1.32535940073319 5.46869832291556 1.27627201552085 5.35234303944927 1.32535940073319 5.35234303944927 1.07992247467149 4.53785605518526 1.03083508945915 4.53785605518526 1.03083508945915 4.42150077171897 1.07992247467149 4.42150077171897 0.0490873852123405 5.58505360638185 0.441786466911065 5.81776417331443 0.392699081698724 5.70140888984814 0.441786466911065 5.70140888984814 0.392699081698724 5.93411945678071 0.392699081698724 5.81776417331443 1.03083508945915 4.65421133865154 0.834485548609789 5.93411945678071 0.785398163397449 5.93411945678071 0.785398163397449 5.81776417331443 1.47262155637022 4.65421133865154 1.42353417115788 4.65421133865154 1.47262155637022 4.53785605518526 0.0490873852123405 5.46869832291556 0.441786466911065 3.37430322052237 0.392699081698724 3.37430322052237 0.441786466911065 3.25794793705608 0.785398163397449 6.050474740247 0.834485548609789 5.81776417331443 1.22718463030851 3.72336907092124 1.17809724509617 3.60701378745495 1.22718463030851 3.60701378745495 1.17809724509617 3.72336907092124 0.834485548609789 3.60701378745495 0.785398163397449 3.60701378745495 0.834485548609789 3.49065850398866 1.22718463030851 6.050474740247 1.17809724509617 6.050474740247 1.22718463030851 5.93411945678071 0.196349540849362 4.77056662211783 0.147262155637022 4.77056662211783 0.196349540849362 4.65421133865154 1.37444678594554 5.23598775598298 1.32535940073319 5.23598775598298 1.32535940073319 5.1196324725167 0.589048622548086 5.00327718905041 0.539961237335746 5.00327718905041 0.589048622548086 4.88692190558412 0.343611696486384 3.95607963785381 0.294524311274043 3.95607963785381 0.294524311274043 3.83972435438753 1.37444678594554 5.1196324725167 0.981747704246811 5.1196324725167 0.93266031903447 5.00327718905041 0.981747704246811 5.00327718905041 0.294524311274043 4.0724349213201 0.736310778185108 4.18879020478639 0.687223392972767 4.18879020478639 0.687223392972767 4.0724349213201 1.52170894158256 4.42150077171897 0.93266031903447 5.1196324725167 0.343611696486384 3.83972435438753 0.687223392972767 4.30514548825268 1.52170894158256 4.30514548825268 1.12900985988383 4.30514548825268 1.07992247467149 4.30514548825268 0.736310778185108 4.0724349213201 1.12900985988383 4.18879020478639 0.098174770424681 5.35234303944927 0.0490873852123405 5.35234303944927 0.098174770424681 5.23598775598298 1.47262155637022 4.42150077171897 1.27627201552085 5.81776417331443 1.22718463030851 5.81776417331443 1.22718463030851 5.70140888984814 0.490873852123405 5.58505360638185 0.441786466911065 5.58505360638185 1.27627201552085 5.70140888984814 0.245436926061703 4.53785605518526 0.196349540849362 4.53785605518526 0.196349540849362 4.42150077171897 0.88357293382213 5.70140888984814 0.834485548609789 5.70140888984814 0.88357293382213 5.58505360638185 0.441786466911065 5.46869832291556 0.490873852123405 5.46869832291556 0.245436926061703 4.42150077171897 0.392699081698724 3.72336907092124 0.343611696486384 3.72336907092124 0.343611696486384 3.60701378745495 0.88357293382213 3.37430322052237 0.834485548609789 3.25794793705608 0.88357293382213 3.25794793705608 0.834485548609789 3.37430322052237 1.27627201552085 3.49065850398866 1.22718463030851 3.37430322052237 1.27627201552085 3.37430322052237 1.22718463030851 3.49065850398866 1.42353417115788 5.00327718905041 1.37444678594554 5.00327718905041 1.42353417115788 4.88692190558412 0.638136007760427 4.77056662211783 0.589048622548086 4.65421133865154 0.638136007760427 4.65421133865154 1.32535940073319 5.58505360638185 1.27627201552085 5.58505360638185 1.27627201552085 5.46869832291556 0.392699081698724 3.60701378745495 0.147262155637022 5.1196324725167 0.098174770424681 5.1196324725167 0.098174770424681 5.00327718905041 0.147262155637022 5.00327718905041 0.589048622548086 4.77056662211783 1.03083508945915 4.88692190558412 0.981747704246811 4.88692190558412 0.392699081698724 6.16683002371329 0.343611696486384 6.16683002371329 0.392699081698724 6.050474740247 0.981747704246811 4.77056662211783 1.03083508945915 4.77056662211783 0.785398163397449 3.95607963785381 0.736310778185108 3.95607963785381 0.736310778185108 3.83972435438753 0.785398163397449 3.83972435438753 0.294524311274043 4.30514548825268 0.245436926061703 4.30514548825268 0.294524311274043 4.18879020478639 1.47262155637022 4.77056662211783 1.42353417115788 4.77056662211783 1.17809724509617 4.0724349213201 1.12900985988383 4.0724349213201 1.17809724509617 3.95607963785381 1.22718463030851 6.16683002371329 1.17809724509617 6.16683002371329 0.0490873852123405 5.70140888984814 0.539961237335746 5.35234303944927 0.490873852123405 5.35234303944927 0.539961237335746 5.23598775598298 1.37444678594554 5.35234303944927 0.687223392972767 4.53785605518526 0.638136007760427 4.42150077171897 0.687223392972767 4.42150077171897 0.638136007760427 4.53785605518526 0.441786466911065 3.49065850398866 0.392699081698724 3.49065850398866 0.93266031903447 5.46869832291556 0.88357293382213 5.46869832291556 0.88357293382213 5.35234303944927 0.93266031903447 5.35234303944927 1.32535940073319 3.25794793705608 1.52170894158256 4.53785605518526 1.27627201552085 3.25794793705608 0.196349540849362 4.88692190558412 0.147262155637022 4.88692190558412 1.27627201552085 5.93411945678071 1.07992247467149 4.65421133865154 0.441786466911065 5.93411945678071 0.834485548609789 3.72336907092124 0.785398163397449 3.72336907092124 1.42353417115788 5.1196324725167 0.343611696486384 4.0724349213201 0.834485548609789 6.050474740247 0.098174770424681 5.46869832291556 0.589048622548086 5.1196324725167 0.539961237335746 5.1196324725167 0.736310778185108 4.30514548825268 1.22718463030851 3.83972435438753 1.32535940073319 5.70140888984814 1.17809724509617 3.83972435438753 0.490873852123405 3.25794793705608 1.47262155637022 4.88692190558412 0.981747704246811 5.23598775598298 0.93266031903447 5.23598775598298 0.490873852123405 5.70140888984814 0.245436926061703 4.65421133865154 0.88357293382213 3.49065850398866 0.392699081698724 3.83972435438753 1.12900985988383 4.42150077171897 0.88357293382213 5.81776417331443 1.37444678594554 5.46869832291556 0.638136007760427 4.88692190558412 0.147262155637022 5.23598775598298 1.52170894158256 4.65421133865154 1.27627201552085 3.60701378745495 0.294524311274043 4.42150077171897 1.27627201552085 6.050474740247 1.42353417115788 5.23598775598298 0.785398163397449 4.0724349213201 0.0490873852123405 5.81776417331443 0.539961237335746 5.46869832291556 1.03083508945915 5.00327718905041 0.441786466911065 3.60701378745495 0.93266031903447 3.25794793705608 1.32535940073319 5.81776417331443 1.17809724509617 4.18879020478639 0.687223392972767 4.65421133865154 0.196349540849362 5.00327718905041 0.93266031903447 5.58505360638185 0.441786466911065 6.050474740247 1.47262155637022 5.00327718905041 0.343611696486384 4.18879020478639 1.37444678594554 5.58505360638185 0.834485548609789 3.83972435438753 1.32535940073319 3.37430322052237 1.52170894158256 4.77056662211783 0.589048622548086 5.23598775598298 1.07992247467149 4.77056662211783 0.098174770424681 5.58505360638185 1.27627201552085 6.16683002371329 0.490873852123405 3.37430322052237 0.834485548609789 6.16683002371329 0.785398163397449 6.16683002371329 0.736310778185108 4.42150077171897 1.42353417115788 5.35234303944927 0.490873852123405 5.81776417331443 0.245436926061703 4.77056662211783 1.22718463030851 3.95607963785381 0.392699081698724 3.95607963785381 1.32535940073319 5.93411945678071 0.981747704246811 5.35234303944927 1.47262155637022 5.1196324725167 0.88357293382213 3.60701378745495 1.12900985988383 4.53785605518526 0.147262155637022 5.35234303944927 0.294524311274043 4.53785605518526 0.638136007760427 5.00327718905041 1.37444678594554 5.70140888984814 0.88357293382213 5.93411945678071 1.52170894158256 4.88692190558412 0.0490873852123405 5.93411945678071 0.785398163397449 4.18879020478639 1.42353417115788 5.46869832291556 0.539961237335746 5.58505360638185 0.441786466911065 3.72336907092124 1.27627201552085 3.72336907092124 0.93266031903447 3.37430322052237 1.03083508945915 5.1196324725167 0.196349540849362 5.1196324725167 1.32535940073319 6.050474740247 1.17809724509617 4.30514548825268 0.687223392972767 4.77056662211783 0.343611696486384 4.30514548825268 0.441786466911065 6.16683002371329 1.47262155637022 5.23598775598298 0.098174770424681 5.70140888984814 0.834485548609789 3.95607963785381 1.37444678594554 5.81776417331443 0.93266031903447 5.70140888984814 0.490873852123405 3.49065850398866 0.589048622548086 5.35234303944927 1.52170894158256 5.00327718905041 1.32535940073319 3.49065850398866 1.42353417115788 5.58505360638185 0.245436926061703 4.88692190558412 0.736310778185108 4.53785605518526 1.07992247467149 4.88692190558412 0.490873852123405 5.93411945678071 0.392699081698724 4.0724349213201 1.32535940073319 6.16683002371329 0.88357293382213 3.72336907092124 1.47262155637022 5.35234303944927 0.147262155637022 5.46869832291556 1.22718463030851 4.0724349213201 0.539961237335746 3.25794793705608 1.37444678594554 5.93411945678071 0.981747704246811 5.46869832291556 0.638136007760427 5.1196324725167 0.294524311274043 4.65421133865154 1.52170894158256 5.1196324725167 1.37444678594554 3.25794793705608 0.0490873852123405 6.050474740247 1.12900985988383 4.65421133865154 0.785398163397449 4.30514548825268 0.539961237335746 5.70140888984814 1.42353417115788 5.70140888984814 0.441786466911065 3.83972435438753 0.88357293382213 6.050474740247 1.27627201552085 3.83972435438753 1.47262155637022 5.46869832291556 0.93266031903447 3.49065850398866 0.196349540849362 5.23598775598298 0.687223392972767 4.88692190558412 1.37444678594554 6.050474740247 1.52170894158256 5.23598775598298 1.03083508945915 5.23598775598298 0.343611696486384 4.42150077171897 0.834485548609789 4.0724349213201 1.42353417115788 5.81776417331443 0.098174770424681 5.81776417331443 1.17809724509617 4.42150077171897 0.589048622548086 5.46869832291556 1.47262155637022 5.58505360638185 0.981747704246811 3.25794793705608 0.93266031903447 5.81776417331443 0.490873852123405 3.60701378745495 1.37444678594554 6.16683002371329 0.245436926061703 5.00327718905041 1.52170894158256 5.35234303944927 0.736310778185108 4.65421133865154 0.490873852123405 6.050474740247 0.392699081698724 4.18879020478639 1.32535940073319 3.60701378745495 1.42353417115788 5.93411945678071 0.147262155637022 5.58505360638185 0.88357293382213 3.83972435438753 1.07992247467149 5.00327718905041 1.22718463030851 4.18879020478639 0.638136007760427 5.23598775598298 1.47262155637022 5.70140888984814 0.539961237335746 3.37430322052237 1.52170894158256 5.46869832291556 0.785398163397449 4.42150077171897 0.981747704246811 5.58505360638185 0.294524311274043 4.77056662211783 0.0490873852123405 6.16683002371329 0.539961237335746 5.81776417331443 1.42353417115788 6.050474740247 1.47262155637022 5.81776417331443 1.37444678594554 3.37430322052237 0.441786466911065 3.95607963785381 0.93266031903447 3.60701378745495 1.12900985988383 4.77056662211783 1.52170894158256 5.58505360638185 0.687223392972767 5.00327718905041 0.196349540849362 5.35234303944927 0.343611696486384 4.53785605518526 0.88357293382213 6.16683002371329 1.42353417115788 6.16683002371329 0.834485548609789 4.18879020478639 0.098174770424681 5.93411945678071 1.47262155637022 5.93411945678071 1.27627201552085 3.95607963785381 0.589048622548086 5.58505360638185 0.490873852123405 3.72336907092124 1.52170894158256 5.70140888984814 1.03083508945915 5.35234303944927 0.981747704246811 3.37430322052237 1.17809724509617 4.53785605518526 1.47262155637022 6.050474740247 0.245436926061703 5.1196324725167 1.52170894158256 5.81776417331443 0.93266031903447 5.93411945678071 0.736310778185108 4.77056662211783 0.490873852123405 6.16683002371329 1.47262155637022 6.16683002371329 0.392699081698724 4.30514548825268 1.32535940073319 3.72336907092124 0.88357293382213 3.95607963785381 1.52170894158256 5.93411945678071 0.147262155637022 5.70140888984814 0.539961237335746 3.49065850398866 1.07992247467149 5.1196324725167 1.52170894158256 6.050474740247 0.638136007760427 5.35234303944927 1.52170894158256 6.16683002371329 1.22718463030851 4.30514548825268 0.294524311274043 4.88692190558412 0.785398163397449 4.53785605518526 0.539961237335746 5.93411945678071 0.981747704246811 5.70140888984814 0.441786466911065 4.0724349213201 0.196349540849362 5.46869832291556 0.93266031903447 3.72336907092124 1.37444678594554 3.49065850398866 0.589048622548086 3.25794793705608 1.12900985988383 4.88692190558412 0.343611696486384 4.65421133865154 0.687223392972767 5.1196324725167 0.098174770424681 6.050474740247 0.834485548609789 4.30514548825268 1.27627201552085 4.0724349213201 0.589048622548086 5.70140888984814 0.490873852123405 3.83972435438753 1.03083508945915 5.46869832291556 0.981747704246811 3.49065850398866 0.245436926061703 5.23598775598298 1.42353417115788 3.25794793705608 0.736310778185108 4.88692190558412 0.392699081698724 4.42150077171897 0.88357293382213 4.0724349213201 1.17809724509617 4.65421133865154 0.147262155637022 5.81776417331443 0.638136007760427 5.46869832291556 0.93266031903447 6.050474740247 1.32535940073319 3.83972435438753 0.539961237335746 3.60701378745495 1.03083508945915 3.25794793705608 1.07992247467149 5.23598775598298 0.294524311274043 5.00327718905041 0.441786466911065 4.18879020478639 0.785398163397449 4.65421133865154 0.539961237335746 6.050474740247 1.22718463030851 4.42150077171897 0.196349540849362 5.58505360638185 0.93266031903447 3.83972435438753 0.981747704246811 5.81776417331443 0.589048622548086 3.37430322052237 0.687223392972767 5.23598775598298 0.343611696486384 4.77056662211783 0.834485548609789 4.42150077171897 1.37444678594554 3.60701378745495 0.098174770424681 6.16683002371329 1.12900985988383 5.00327718905041 0.490873852123405 3.95607963785381 0.589048622548086 5.81776417331443 1.27627201552085 4.18879020478639 0.245436926061703 5.35234303944927 0.981747704246811 3.60701378745495 1.03083508945915 5.58505360638185 0.392699081698724 4.53785605518526 0.736310778185108 5.00327718905041 0.147262155637022 5.93411945678071 1.42353417115788 3.37430322052237 0.88357293382213 4.18879020478639 1.17809724509617 4.77056662211783 0.539961237335746 3.72336907092124 0.638136007760427 5.58505360638185 0.294524311274043 5.1196324725167 0.93266031903447 6.16683002371329 1.03083508945915 3.37430322052237 1.32535940073319 3.95607963785381 0.785398163397449 4.77056662211783 0.441786466911065 4.30514548825268 0.196349540849362 5.70140888984814 1.07992247467149 5.35234303944927 0.539961237335746 6.16683002371329 0.93266031903447 3.95607963785381 1.22718463030851 4.53785605518526 0.589048622548086 3.49065850398866 0.343611696486384 4.88692190558412 0.687223392972767 5.35234303944927 0.981747704246811 5.93411945678071 0.834485548609789 4.53785605518526 0.490873852123405 4.0724349213201 1.37444678594554 3.72336907092124 0.589048622548086 5.93411945678071 0.245436926061703 5.46869832291556 1.12900985988383 5.1196324725167 0.638136007760427 3.25794793705608 0.981747704246811 3.72336907092124 1.27627201552085 4.30514548825268 0.736310778185108 5.1196324725167 0.392699081698724 4.65421133865154 0.147262155637022 6.050474740247 0.88357293382213 4.30514548825268 1.03083508945915 5.70140888984814 0.539961237335746 3.83972435438753 0.638136007760427 5.70140888984814 1.42353417115788 3.49065850398866 1.03083508945915 3.49065850398866 1.17809724509617 4.88692190558412 0.294524311274043 5.23598775598298 0.441786466911065 4.42150077171897 0.785398163397449 4.88692190558412 0.196349540849362 5.81776417331443 1.32535940073319 4.0724349213201 0.93266031903447 4.0724349213201 1.07992247467149 5.46869832291556 0.687223392972767 5.46869832291556 0.589048622548086 3.60701378745495 1.47262155637022 3.25794793705608 1.07992247467149 3.25794793705608 0.343611696486384 5.00327718905041 0.490873852123405 4.18879020478639 1.22718463030851 4.65421133865154 0.834485548609789 4.65421133865154 0.981747704246811 6.050474740247 0.245436926061703 5.58505360638185 0.589048622548086 6.050474740247 1.37444678594554 3.83972435438753 0.638136007760427 3.37430322052237 0.981747704246811 3.83972435438753 0.392699081698724 4.77056662211783 1.12900985988383 5.23598775598298 0.147262155637022 6.16683002371329 0.736310778185108 5.23598775598298 0.539961237335746 3.95607963785381 0.88357293382213 4.42150077171897 1.27627201552085 4.42150077171897 1.03083508945915 5.81776417331443 0.638136007760427 5.81776417331443 0.294524311274043 5.35234303944927 0.441786466911065 4.53785605518526 1.42353417115788 3.60701378745495 1.03083508945915 3.60701378745495 0.196349540849362 5.93411945678071 0.785398163397449 5.00327718905041 0.589048622548086 3.72336907092124 1.17809724509617 5.00327718905041 0.93266031903447 4.18879020478639 1.32535940073319 4.18879020478639 0.687223392972767 5.58505360638185 0.343611696486384 5.1196324725167 1.07992247467149 5.58505360638185 0.490873852123405 4.30514548825268 1.07992247467149 3.37430322052237 0.834485548609789 4.77056662211783 0.245436926061703 5.70140888984814 1.47262155637022 3.37430322052237 0.0490873852123405 3.25794793705608 0.638136007760427 3.49065850398866 0.589048622548086 6.16683002371329 1.22718463030851 4.77056662211783 0.981747704246811 3.95607963785381 0.392699081698724 4.88692190558412 0.981747704246811 6.16683002371329 0.0490873852123405 3.37430322052237 0.736310778185108 5.35234303944927 1.37444678594554 3.95607963785381 0.539961237335746 4.0724349213201 0.88357293382213 4.53785605518526 0.0490873852123405 3.49065850398866 1.12900985988383 5.35234303944927 0.294524311274043 5.46869832291556 0.638136007760427 5.93411945678071 0.098174770424681 3.25794793705608 1.27627201552085 4.53785605518526 0.687223392972767 3.25794793705608 0.0490873852123405 3.60701378745495 1.03083508945915 3.72336907092124 0.441786466911065 4.65421133865154 1.03083508945915 5.93411945678071 0.785398163397449 5.1196324725167 0.196349540849362 6.050474740247 0.098174770424681 3.37430322052237 0.93266031903447 4.30514548825268 0.589048622548086 3.83972435438753 1.42353417115788 3.72336907092124 0.0490873852123405 3.72336907092124 1.17809724509617 5.1196324725167 0.343611696486384 5.23598775598298 0.687223392972767 5.70140888984814 1.07992247467149 3.49065850398866 0.490873852123405 4.42150077171897 0.098174770424681 3.49065850398866 1.32535940073319 4.30514548825268 0.245436926061703 5.81776417331443 0.834485548609789 4.88692190558412 0.147262155637022 3.25794793705608 0.638136007760427 3.60701378745495 1.07992247467149 5.70140888984814 1.47262155637022 3.49065850398866 0.0490873852123405 3.83972435438753 0.981747704246811 4.0724349213201 0.736310778185108 5.46869832291556 1.22718463030851 4.88692190558412 0.392699081698724 5.00327718905041 0.098174770424681 3.60701378745495 0.539961237335746 4.18879020478639 1.12900985988383 3.25794793705608 0.88357293382213 4.65421133865154 0.294524311274043 5.58505360638185 1.37444678594554 4.0724349213201 0.147262155637022 3.37430322052237 0.0490873852123405 3.95607963785381 1.12900985988383 5.46869832291556 0.687223392972767 3.37430322052237 0.638136007760427 6.050474740247 1.03083508945915 3.83972435438753 1.52170894158256 3.25794793705608 0.441786466911065 4.77056662211783 0.196349540849362 6.16683002371329 0.785398163397449 5.23598775598298 0.589048622548086 3.95607963785381 0.098174770424681 3.72336907092124 1.27627201552085 4.65421133865154 0.93266031903447 4.42150077171897 0.147262155637022 3.49065850398866 1.03083508945915 6.050474740247 1.42353417115788 3.83972435438753 0.0490873852123405 4.0724349213201 0.343611696486384 5.35234303944927 0.490873852123405 4.53785605518526 0.687223392972767 5.81776417331443 1.17809724509617 5.23598775598298 0.196349540849362 3.25794793705608 0.245436926061703 5.93411945678071 1.07992247467149 3.60701378745495 1.32535940073319 4.42150077171897 0.834485548609789 5.00327718905041 0.098174770424681 3.83972435438753 0.638136007760427 3.72336907092124 0.981747704246811 4.18879020478639 1.07992247467149 5.81776417331443 0.392699081698724 5.1196324725167 0.539961237335746 4.30514548825268 0.736310778185108 5.58505360638185 0.147262155637022 3.60701378745495 0.0490873852123405 4.18879020478639 1.12900985988383 3.37430322052237 1.47262155637022 3.60701378745495 0.88357293382213 4.77056662211783 0.294524311274043 5.70140888984814 0.687223392972767 3.49065850398866 1.22718463030851 5.00327718905041 1.37444678594554 4.18879020478639 0.196349540849362 3.37430322052237 0.638136007760427 6.16683002371329 0.098174770424681 3.95607963785381 0.441786466911065 4.88692190558412 1.12900985988383 5.58505360638185 1.03083508945915 3.95607963785381 0.589048622548086 4.0724349213201 1.52170894158256 3.37430322052237 0.785398163397449 5.35234303944927 0.147262155637022 3.72336907092124 0.343611696486384 5.46869832291556 0.0490873852123405 4.30514548825268 0.93266031903447 4.53785605518526 1.27627201552085 4.77056662211783 0.736310778185108 3.25794793705608 0.687223392972767 5.93411945678071 0.490873852123405 4.65421133865154 1.03083508945915 6.16683002371329 0.196349540849362 3.49065850398866 1.07992247467149 3.72336907092124 1.42353417115788 3.95607963785381 0.245436926061703 6.050474740247 0.638136007760427 3.83972435438753 1.17809724509617 5.35234303944927 0.834485548609789 5.1196324725167 0.098174770424681 4.0724349213201 0.245436926061703 3.25794793705608 0.392699081698724 5.23598775598298 0.981747704246811 4.30514548825268 0.147262155637022 3.83972435438753 1.32535940073319 4.53785605518526 0.736310778185108 5.70140888984814 0.539961237335746 4.42150077171897 1.07992247467149 5.93411945678071 1.12900985988383 3.49065850398866 0.0490873852123405 4.42150077171897 0.294524311274043 5.81776417331443 1.47262155637022 3.72336907092124 0.88357293382213 4.88692190558412 0.687223392972767 3.60701378745495 0.196349540849362 3.60701378745495 1.22718463030851 5.1196324725167 0.441786466911065 5.00327718905041 0.098174770424681 4.18879020478639 1.03083508945915 4.0724349213201 0.589048622548086 4.18879020478639 0.785398163397449 5.46869832291556 1.37444678594554 4.30514548825268 0.245436926061703 3.37430322052237 1.12900985988383 5.70140888984814 1.17809724509617 3.25794793705608 0.147262155637022 3.95607963785381 0.343611696486384 5.58505360638185 1.52170894158256 3.49065850398866 0.93266031903447 4.65421133865154 0.0490873852123405 4.53785605518526 0.736310778185108 3.37430322052237 0.687223392972767 6.050474740247 1.27627201552085 4.88692190558412 0.490873852123405 4.77056662211783 1.07992247467149 3.83972435438753 0.196349540849362 3.72336907092124 0.245436926061703 6.16683002371329 1.42353417115788 4.0724349213201 0.638136007760427 3.95607963785381 0.834485548609789 5.23598775598298 0.098174770424681 4.30514548825268 1.17809724509617 5.46869832291556 0.981747704246811 4.42150077171897 0.245436926061703 3.49065850398866 0.392699081698724 5.35234303944927 0.736310778185108 5.81776417331443 0.539961237335746 4.53785605518526 1.32535940073319 4.65421133865154 0.147262155637022 4.0724349213201 0.294524311274043 5.93411945678071 0.294524311274043 3.25794793705608 1.12900985988383 3.60701378745495 1.07992247467149 6.050474740247 0.0490873852123405 4.65421133865154 0.687223392972767 3.72336907092124 1.47262155637022 3.83972435438753 0.88357293382213 5.00327718905041 1.22718463030851 5.23598775598298 0.196349540849362 3.83972435438753 1.03083508945915 4.18879020478639 0.441786466911065 5.1196324725167 0.589048622548086 4.30514548825268 0.785398163397449 5.58505360638185 0.098174770424681 4.42150077171897 1.37444678594554 4.42150077171897 1.12900985988383 5.81776417331443 1.17809724509617 3.37430322052237 0.343611696486384 5.70140888984814 1.52170894158256 3.60701378745495 0.736310778185108 3.49065850398866 0.245436926061703 3.60701378745495 0.93266031903447 4.77056662211783 0.490873852123405 4.88692190558412 0.147262155637022 4.18879020478639 1.27627201552085 5.00327718905041 0.687223392972767 6.16683002371329 1.07992247467149 3.95607963785381 0.294524311274043 3.37430322052237 0.638136007760427 4.0724349213201 1.42353417115788 4.18879020478639 0.0490873852123405 4.77056662211783 0.392699081698724 5.46869832291556 1.17809724509617 5.58505360638185 0.785398163397449 3.25794793705608 0.196349540849362 3.95607963785381 0.834485548609789 5.35234303944927 0.981747704246811 4.53785605518526 1.32535940073319 4.77056662211783 0.539961237335746 4.65421133865154 0.098174770424681 4.53785605518526 0.736310778185108 5.93411945678071 0.294524311274043 6.050474740247 1.07992247467149 6.16683002371329 0.245436926061703 3.72336907092124 1.47262155637022 3.95607963785381 0.687223392972767 3.83972435438753 1.12900985988383 3.72336907092124 1.22718463030851 5.35234303944927 0.441786466911065 5.23598775598298 0.88357293382213 5.1196324725167 0.147262155637022 4.30514548825268 1.37444678594554 4.53785605518526 0.294524311274043 3.49065850398866 0.589048622548086 4.42150077171897 1.03083508945915 4.30514548825268 0.343611696486384 5.81776417331443 0.0490873852123405 4.88692190558412 1.12900985988383 5.93411945678071 0.785398163397449 5.70140888984814 1.17809724509617 3.49065850398866 1.52170894158256 3.72336907092124 0.736310778185108 3.60701378745495 0.196349540849362 4.0724349213201 0.343611696486384 3.25794793705608 1.27627201552085 5.1196324725167 0.93266031903447 4.88692190558412 0.490873852123405 5.00327718905041 0.638136007760427 4.18879020478639 1.07992247467149 4.0724349213201 0.098174770424681 4.65421133865154 1.42353417115788 4.30514548825268 0.392699081698724 5.58505360638185 0.245436926061703 3.83972435438753 0.834485548609789 5.46869832291556 1.17809724509617 5.70140888984814 1.22718463030851 3.25794793705608 0.147262155637022 4.42150077171897 0.785398163397449 3.37430322052237 1.32535940073319 4.88692190558412 0.539961237335746 4.77056662211783 0.294524311274043 3.60701378745495 0.981747704246811 4.65421133865154 0.294524311274043 6.16683002371329 0.736310778185108 6.050474740247 0.687223392972767 3.95607963785381 1.47262155637022 4.0724349213201 1.22718463030851 5.46869832291556 0.0490873852123405 5.00327718905041 0.441786466911065 5.35234303944927 1.12900985988383 3.83972435438753 0.196349540849362 4.18879020478639 0.88357293382213 5.23598775598298 0.589048622548086 4.53785605518526 1.37444678594554 4.65421133865154 1.12900985988383 6.050474740247 0.343611696486384 3.37430322052237 0.098174770424681 4.77056662211783 0.343611696486384 5.93411945678071 1.52170894158256 3.83972435438753 0.736310778185108 3.72336907092124 1.27627201552085 5.23598775598298 0.245436926061703 3.95607963785381 0.147262155637022 4.53785605518526 0.490873852123405 5.1196324725167 1.42353417115788 4.42150077171897 1.17809724509617 5.81776417331443 0.638136007760427 4.30514548825268 0.294524311274043 3.72336907092124 1.07992247467149 4.18879020478639 0.785398163397449 3.49065850398866 1.32535940073319 5.00327718905041 0.834485548609789 5.58505360638185 0.0490873852123405 5.1196324725167 0.539961237335746 4.88692190558412 0.196349540849362 4.30514548825268 1.47262155637022 4.18879020478639 1.22718463030851 5.58505360638185 0.343611696486384 3.49065850398866 1.37444678594554 4.77056662211783 0.736310778185108 6.16683002371329 0.098174770424681 4.88692190558412 1.12900985988383 3.95607963785381 1.12900985988383 6.16683002371329 0.245436926061703 4.0724349213201 1.52170894158256 3.95607963785381 0.392699081698724 3.25794793705608 0.343611696486384 6.050474740247 0.147262155637022 4.65421133865154 1.42353417115788 4.53785605518526 0.490873852123405 5.23598775598298 1.17809724509617 5.93411945678071 0.0490873852123405 5.23598775598298 1.47262155637022 4.30514548825268 1.37444678594554 4.88692190558412 0.245436926061703 4.18879020478639 1.52170894158256 4.0724349213201 1.52170894158256 4.18879020478639 143 144 145 146 147 148 146 148 149 150 105 104 151 152 153 151 154 155 146 156 147 157 158 159 151 155 152 160 161 162 150 104 163 3 81 1 164 165 166 157 167 158 157 159 168 169 170 171 169 172 170 173 174 175 176 177 178 179 180 181 182 183 184 182 145 183 185 186 187 188 189 190 182 184 191 192 193 194 188 195 189 196 197 198 199 123 124 199 124 125 192 200 193 188 190 201 196 202 197 199 203 123 204 149 205 196 198 206 204 205 207 208 209 210 199 211 203 212 213 214 215 153 216 212 214 217 218 219 220 221 222 223 215 224 225 215 216 224 218 181 219 218 220 226 227 228 229 230 231 232 230 233 231 234 235 236 234 237 235 238 239 240 241 242 243 244 245 246 227 229 247 244 217 245 234 171 237 248 249 250 248 250 251 241 252 242 253 194 254 255 256 257 244 246 143 253 254 258 248 210 249 255 52 51 253 258 259 255 51 256 260 206 261 260 262 263 264 265 266 267 268 161 269 270 271 267 161 160 260 261 262 272 273 177 274 106 105 272 72 273 274 107 106 272 73 72 272 177 176 274 105 150 275 276 277 278 145 182 279 280 281 279 243 282 283 284 165 285 286 287 285 287 288 289 34 35 290 211 199 289 35 36 279 282 280 283 165 164 290 125 126 283 247 284 289 291 34 290 199 125 292 293 180 290 162 211 290 160 162 294 213 212 295 156 146 292 180 179 296 154 151 294 178 213 296 257 154 292 251 293 297 298 174 294 176 178 297 174 173 299 239 238 300 195 188 301 167 157 302 163 209 303 186 185 299 191 239 302 209 208 303 304 186 305 202 196 306 172 169 307 217 244 306 308 172 309 14 15 309 166 14 309 164 166 310 238 240 310 268 267 311 288 312 311 312 200 313 153 215 314 179 181 311 200 192 314 181 218 310 240 268 315 175 233 316 201 228 315 173 175 317 149 204 316 228 227 318 168 222 319 143 145 315 233 230 319 145 278 320 185 187 321 208 210 320 187 252 322 126 127 318 222 221 321 210 248 322 290 126 323 171 234 320 252 241 322 160 290 324 226 265 325 176 294 324 265 264 326 191 299 326 182 191 327 206 260 328 108 107 329 225 276 329 276 275 326 278 182 330 194 253 328 107 274 331 247 283 332 232 25 332 25 26 333 217 307 332 230 232 333 212 217 334 270 269 334 204 207 335 243 279 334 207 270 336 251 292 337 286 285 337 221 223 338 255 257 339 238 310 337 223 286 340 195 300 341 244 143 338 257 296 341 307 244 340 264 266 342 298 297 342 263 298 343 291 289 340 266 195 341 143 319 344 267 160 343 236 291 344 160 322 344 127 128 345 304 303 346 259 156 346 156 295 43 41 111 345 277 304 344 322 127 347 150 163 347 274 150 347 163 302 348 73 272 349 164 309 348 272 176 348 176 325 345 275 277 348 74 73 350 167 301 350 63 62 350 351 167 350 62 351 352 202 305 352 281 202 353 278 326 354 151 153 355 179 314 356 308 306 357 300 188 354 153 313 356 271 308 358 294 212 357 201 316 356 269 271 358 212 333 358 325 294 357 188 201 359 288 311 360 299 238 360 238 339 361 173 315 362 149 317 363 208 321 362 295 146 364 226 324 364 314 218 362 146 149 365 185 320 366 307 341 367 168 318 364 218 226 368 267 344 368 128 129 367 301 157 369 109 108 367 157 168 370 196 206 368 339 310 369 108 328 370 305 196 368 344 128 370 206 327 368 310 267 371 278 353 372 215 225 373 247 331 372 313 215 372 225 329 371 319 278 374 169 171 375 230 332 374 171 323 373 227 247 376 194 330 377 321 248 377 251 336 376 192 194 378 325 358 377 248 251 379 204 334 380 243 335 379 317 204 381 264 340 380 241 243 382 53 52 382 54 53 383 299 360 383 353 326 382 52 255 382 255 338 384 274 347 385 260 263 383 326 299 386 333 307 387 221 337 385 263 342 388 164 349 385 327 260 386 307 366 389 275 345 390 368 129 390 129 130 390 130 131 388 331 283 388 283 164 390 339 368 391 236 343 392 341 319 391 234 236 393 179 355 394 335 279 391 323 234 392 319 371 395 330 253 393 292 179 394 279 281 395 253 259 394 281 352 395 259 346 393 336 292 396 338 296 392 366 341 397 300 357 398 348 325 398 74 348 396 151 354 398 75 74 396 296 151 398 76 75 398 325 378 399 173 361 400 353 383 401 208 363 402 269 356 401 302 208 399 297 173 401 347 302 403 15 16 404 333 386 405 285 288 404 378 358 404 358 333 405 288 359 406 303 185 403 309 15 406 185 365 407 355 314 408 131 132 409 289 36 407 314 364 408 390 131 409 36 37 408 360 339 410 110 109 408 339 390 411 295 362 410 109 369 412 305 370 413 313 372 414 366 392 415 316 227 415 227 373 416 301 367 417 306 169 418 371 353 419 230 375 420 321 377 419 315 230 419 361 315 418 353 400 421 365 320 421 241 380 420 363 321 417 169 374 422 378 404 423 360 408 424 311 192 423 132 133 425 324 264 421 320 241 425 264 381 423 400 383 426 327 385 423 408 132 424 359 311 423 383 360 424 192 376 427 366 414 428 328 274 428 274 384 429 317 379 430 275 389 427 386 366 431 414 392 430 329 275 431 371 418 432 332 26 432 26 27 433 318 221 433 221 387 434 331 388 431 392 371 435 378 422 435 77 76 436 336 393 435 76 398 435 398 378 437 400 423 438 335 394 439 338 396 440 340 300 437 133 134 440 300 397 437 423 133 441 323 391 442 422 404 442 386 427 440 381 340 442 404 386 443 384 347 444 297 399 445 330 395 443 347 401 446 379 334 444 342 297 447 389 345 447 345 303 448 414 431 446 334 269 447 303 406 449 309 403 449 349 309 450 418 400 446 269 402 451 305 412 450 437 134 451 352 305 450 134 135 452 337 285 453 355 407 452 387 337 450 400 437 452 285 405 454 111 110 454 43 111 454 44 43 455 313 413 456 422 442 454 110 410 455 354 313 457 414 448 458 343 289 459 397 357 460 361 419 458 289 409 459 316 415 459 357 316 461 346 295 457 427 414 462 431 418 462 418 450 462 448 431 461 295 411 463 365 421 464 363 420 462 135 136 465 364 324 462 450 135 466 350 301 466 63 350 466 64 63 466 65 64 467 435 422 466 301 416 465 324 425 467 77 435 467 422 456 465 407 364 468 412 370 467 78 77 469 410 369 468 327 426 469 369 328 470 442 427 468 370 327 470 456 442 469 328 428 471 306 417 471 402 356 472 372 329 470 427 457 472 329 430 471 356 306 473 331 434 472 413 372 474 136 137 475 359 424 474 137 138 474 448 462 474 462 136 476 375 332 476 332 432 473 373 331 477 362 317 477 411 362 478 456 470 479 377 336 480 474 138 477 317 429 479 336 436 480 138 139 481 367 318 479 420 377 482 335 438 481 318 433 482 380 335 480 448 474 481 416 367 483 338 439 480 457 448 483 54 382 484 467 456 483 382 338 484 78 467 485 381 440 483 55 54 484 456 478 486 323 441 487 342 444 484 79 78 487 385 342 488 139 140 487 426 385 489 384 443 488 478 470 488 480 139 488 470 457 486 374 323 488 457 480 490 434 388 491 376 330 492 478 488 490 349 449 492 140 141 491 330 445 492 488 140 490 388 349 493 389 447 494 478 492 495 429 379 496 436 393 494 142 80 496 355 453 494 141 142 497 394 352 494 484 478 497 352 451 494 79 484 494 492 141 494 80 79 496 393 355 497 438 394 495 379 446 498 396 354 499 387 452 498 439 396 500 397 459 498 354 455 501 443 401 502 399 361 501 363 464 502 361 460 503 441 391 501 401 363 504 403 16 503 343 458 504 16 17 503 391 343 505 346 461 504 449 403 505 445 395 506 407 465 507 406 365 506 453 407 507 365 463 505 395 346 508 410 469 509 412 468 510 402 471 511 413 472 512 373 473 513 359 475 514 375 476 512 415 373 513 405 359 514 419 375 515 464 420 515 420 479 514 460 419 516 37 38 517 421 380 518 425 381 516 409 37 517 463 421 518 381 485 517 380 482 519 426 487 520 411 477 521 469 428 521 384 489 522 389 493 523 416 481 524 417 374 521 428 384 524 374 486 522 430 389 525 434 490 526 27 28 526 432 27 527 376 491 528 436 496 527 424 376 529 440 397 530 438 497 527 475 424 529 397 500 531 439 498 532 429 495 529 485 440 533 489 443 534 444 399 533 443 501 535 387 499 535 433 387 536 449 504 534 399 502 537 493 447 537 406 507 538 453 506 537 447 406 539 451 412 540 441 503 541 44 454 542 445 505 541 454 410 541 45 44 541 410 508 543 500 459 539 412 509 544 413 511 545 446 402 543 415 512 543 459 415 544 455 413 545 495 446 546 464 515 545 402 510 547 460 514 548 452 405 549 465 425 548 405 513 549 506 465 548 499 452 549 425 518 550 463 517 551 469 521 552 458 409 553 426 519 552 409 516 551 508 469 553 509 468 554 461 411 555 434 525 553 468 426 555 473 434 112 40 2 556 511 472 554 411 520 556 430 522 557 479 436 558 466 416 557 515 479 558 416 523 558 65 466 556 472 430 558 66 65 557 436 528 559 476 432 560 471 417 559 432 526 561 482 438 561 438 530 560 510 471 562 485 529 560 417 524 563 489 533 564 475 527 565 55 483 565 56 55 565 439 531 565 483 439 566 444 534 567 429 532 566 519 487 568 490 449 567 520 477 567 477 429 568 525 490 568 449 536 566 487 444 569 528 496 570 493 537 569 496 453 569 453 538 571 481 433 571 523 481 572 497 451 571 433 535 572 451 539 573 500 543 572 530 497 574 486 441 575 531 498 574 441 540 576 501 464 576 464 546 575 455 544 575 498 455 576 533 501 577 491 445 578 17 18 577 445 542 579 502 460 578 504 17 579 460 547 578 536 504 580 495 545 581 507 463 582 538 506 582 506 549 583 541 508 580 532 495 583 508 551 581 463 550 584 509 553 585 499 548 586 512 473 584 539 509 586 473 555 587 511 556 588 503 458 588 458 552 588 540 503 589 514 476 590 505 461 591 546 515 591 515 557 590 542 505 590 461 554 592 485 562 589 547 514 589 476 559 593 482 561 592 518 485 593 517 482 594 521 489 593 550 517 595 510 560 594 489 563 594 551 521 596 519 566 597 513 475 597 475 564 598 522 493 599 525 568 598 493 570 600 38 39 600 516 38 601 28 29 602 528 569 603 562 529 603 500 573 601 526 28 604 520 567 603 529 500 605 530 572 606 523 571 607 563 533 608 531 575 607 533 576 609 486 574 610 536 578 609 524 486 611 534 502 612 538 582 613 564 527 611 502 579 613 491 577 614 45 541 615 537 507 613 527 491 614 541 583 615 570 537 614 46 45 615 507 581 616 543 512 617 539 584 616 512 586 616 573 543 618 532 580 619 499 585 620 511 587 619 535 499 620 544 511 621 546 591 622 549 518 622 582 549 623 540 588 624 547 589 622 518 592 625 551 594 626 550 593 625 583 551 627 555 525 628 542 590 627 525 599 629 584 553 630 545 510 629 553 519 629 519 596 631 522 598 632 557 528 631 556 522 630 580 545 630 510 595 632 591 557 633 548 513 631 587 556 632 528 602 633 513 597 634 562 603 633 585 548 635 526 601 635 559 526 636 530 605 636 561 530 637 563 607 42 80 142 638 516 600 638 552 516 639 3 4 640 599 568 641 531 608 642 554 520 639 81 3 641 57 56 642 520 604 639 82 81 641 56 565 640 568 536 641 565 531 643 534 611 643 596 566 640 536 610 643 566 534 644 569 538 645 558 523 644 602 569 646 82 639 645 66 558 646 83 82 645 67 66 645 523 606 647 570 615 648 524 609 644 538 612 648 560 524 649 573 616 650 605 572 651 83 646 648 595 560 650 539 617 651 84 83 652 564 613 653 576 546 650 572 539 654 608 575 655 4 5 653 607 576 653 546 621 655 639 4 656 567 532 654 544 620 655 646 639 657 18 19 658 84 651 657 19 20 654 575 544 656 532 618 659 579 547 657 578 18 659 547 624 656 604 567 658 85 84 660 612 582 660 582 622 661 571 535 662 581 550 661 535 619 661 606 571 663 614 583 663 583 625 664 646 655 662 550 626 665 584 629 666 586 555 667 540 623 668 85 658 667 574 540 666 555 627 668 86 85 668 87 86 669 577 542 670 621 591 671 587 631 669 542 628 670 591 632 672 559 635 672 624 589 673 592 562 672 589 559 674 658 651 674 646 664 673 562 634 675 618 580 676 563 637 675 580 630 677 561 636 674 651 646 676 594 563 676 625 594 678 5 6 677 626 593 677 593 561 678 655 5 679 599 640 680 585 633 678 664 655 681 552 638 682 88 87 682 87 668 681 588 552 683 596 643 684 598 570 681 623 588 684 570 647 685 590 554 685 554 642 686 602 644 687 658 674 685 628 590 688 603 573 689 29 30 689 30 31 688 634 603 689 601 29 688 573 649 690 605 650 691 637 607 691 607 653 692 595 648 693 664 678 694 88 682 695 564 652 694 89 88 696 578 657 697 608 654 695 597 564 698 579 659 699 112 113 698 611 579 696 610 578 699 39 40 699 40 112 700 612 660 699 600 39 701 614 663 702 615 581 701 47 46 701 46 614 702 647 615 703 586 666 702 581 662 704 658 687 704 668 658 705 604 656 706 617 584 707 674 664 703 616 586 703 649 616 708 606 661 706 584 665 707 687 674 709 574 667 707 664 693 710 89 694 711 621 670 712 660 622 712 592 673 710 90 89 713 620 587 713 587 671 712 622 592 709 609 574 714 652 613 714 613 577 715 693 678 715 6 7 714 577 669 716 625 676 717 624 672 715 678 6 716 663 625 718 618 675 719 626 677 720 668 704 720 682 668 721 627 599 722 629 596 721 599 679 722 596 683 723 585 680 724 670 632 724 602 686 723 619 585 722 665 629 724 632 602 725 673 634 726 631 598 727 687 707 726 671 631 726 598 684 728 90 710 725 634 688 729 601 689 730 623 681 728 91 90 729 635 601 731 636 605 732 637 691 733 640 610 734 628 685 733 679 640 735 675 630 733 610 696 735 595 692 731 605 690 736 693 715 737 608 697 738 694 682 737 57 641 739 644 612 737 641 608 737 58 57 739 686 644 735 630 595 738 682 720 739 612 700 738 710 694 740 633 597 741 643 611 740 680 633 741 683 643 742 649 703 740 597 695 741 611 698 743 699 113 743 113 114 744 647 702 745 704 687 743 600 699 745 687 727 746 653 621 743 638 600 746 621 711 747 91 728 748 690 650 746 691 653 747 92 91 749 604 705 750 657 20 750 20 21 748 650 617 749 642 604 748 617 706 750 696 657 751 697 654 751 620 713 752 660 712 753 606 708 751 654 620 753 68 67 753 645 606 754 693 736 753 67 645 754 707 693 754 727 707 755 624 717 756 692 648 756 648 609 755 659 624 757 663 716 756 609 709 757 701 663 758 627 721 758 666 627 759 652 714 760 626 719 761 710 738 762 7 8 762 8 9 760 662 626 762 715 7 762 736 715 763 711 670 764 665 722 763 670 724 764 706 665 765 704 745 766 705 656 766 618 718 767 671 726 766 656 618 765 720 704 768 673 725 769 708 661 769 619 723 770 672 635 771 92 747 771 93 92 772 716 676 770 717 672 771 94 93 772 676 637 769 661 619 772 637 732 773 667 623 770 635 729 774 719 677 775 679 733 773 623 730 776 727 754 777 669 628 774 636 731 774 677 636 778 686 739 777 628 734 779 710 761 780 683 741 779 747 728 779 728 710 781 688 649 782 647 744 781 649 742 783 718 675 784 736 762 781 725 688 783 675 735 782 684 647 785 680 740 786 689 31 787 720 765 786 31 32 787 761 738 787 738 720 788 732 691 788 691 746 789 114 115 790 690 748 789 743 114 791 94 771 789 730 681 789 638 743 789 681 638 791 95 94 792 696 750 793 697 751 794 685 642 795 660 752 794 734 685 796 698 659 795 700 660 794 642 749 797 745 727 798 48 47 798 49 48 799 692 756 797 727 776 798 47 701 798 701 757 796 659 755 800 703 666 801 702 662 801 744 702 802 747 779 800 666 758 803 695 652 801 662 760 800 742 703 803 652 759 804 706 764 805 754 736 806 711 763 805 736 784 805 776 754 807 713 671 808 673 768 809 705 766 807 671 767 808 712 673 808 752 712 810 761 787 811 757 716 812 9 10 813 717 770 812 784 762 812 762 9 811 716 772 814 708 769 815 95 791 816 721 679 816 679 775 815 96 95 817 667 773 818 719 774 817 709 667 819 714 669 820 745 797 821 722 683 822 724 686 822 763 724 819 669 777 821 683 780 822 686 778 819 759 714 823 725 781 820 765 745 821 764 722 824 726 684 824 767 726 825 771 747 824 684 782 826 718 783 825 747 802 827 680 785 828 729 689 828 689 786 827 723 680 829 732 788 830 115 116 831 696 792 832 776 805 831 733 696 830 789 115 833 731 690 831 775 733 830 730 789 833 690 790 834 739 700 834 700 795 834 778 739 835 802 779 836 734 794 837 737 697 835 761 810 837 58 737 835 779 761 837 697 793 837 59 58 837 60 59 838 741 698 839 784 812 838 780 741 840 742 800 841 735 692 841 692 799 838 698 796 842 96 815 843 788 746 841 783 735 842 97 96 843 711 806 843 746 711 844 785 740 845 21 22 844 740 695 846 765 820 845 792 750 847 744 801 844 695 803 848 706 804 849 705 809 848 748 706 846 810 787 845 750 21 849 749 705 850 752 808 848 790 748 846 787 765 851 791 771 852 793 751 852 751 713 851 771 825 853 798 757 854 708 814 851 815 791 854 68 753 852 713 807 855 776 832 853 757 811 854 753 708 854 69 68 856 709 817 855 797 776 857 721 816 858 717 813 858 755 717 856 756 709 857 758 721 856 799 756 859 759 819 860 763 822 861 760 719 862 802 835 861 719 818 860 806 763 863 809 766 864 784 839 865 725 823 863 718 826 866 764 821 864 832 805 864 805 784 865 768 725 867 732 829 867 772 732 863 766 718 866 804 764 868 97 842 867 811 772 869 814 769 870 767 824 869 723 827 868 98 97 869 769 723 871 729 828 872 116 117 871 770 729 872 117 118 873 775 831 874 810 846 872 730 830 872 830 116 871 813 770 872 773 730 875 812 10 876 734 836 875 10 11 875 839 812 876 777 734 877 731 833 878 778 834 879 823 781 879 781 742 877 774 731 877 818 774 879 742 840 880 780 838 881 815 851 882 783 841 883 829 788 883 788 843 884 797 855 882 826 783 885 782 744 886 785 844 885 744 847 884 820 797 887 32 33 888 825 802 889 792 845 890 836 794 887 786 32 888 802 862 890 794 749 891 795 752 892 832 864 890 749 849 891 752 850 893 790 848 894 49 798 895 793 852 894 798 853 894 50 49 896 840 800 897 799 856 896 800 758 898 759 859 896 758 857 899 98 868 899 99 98 899 100 99 900 806 860 898 803 759 901 755 858 902 862 835 902 810 874 901 796 755 903 801 760 904 808 768 903 760 861 902 835 810 905 809 863 904 850 808 903 847 801 904 768 865 906 814 869 907 839 875 908 842 815 909 811 867 910 817 773 148 804 866 908 815 881 909 853 811 910 118 119 910 773 872 910 872 118 159 807 767 911 816 775 912 859 819 159 767 870 913 846 820 913 874 846 912 777 876 911 775 873 912 819 777 170 813 871 913 820 884 914 851 825 915 822 778 914 881 851 915 778 878 914 825 888 916 826 882 917 827 785 193 818 877 917 785 886 918 823 879 919 832 892 920 866 821 919 855 832 152 829 883 920 780 880 920 821 780 921 792 889 922 836 890 923 824 782 923 782 885 923 870 824 921 831 792 924 100 899 924 101 100 921 873 831 925 795 891 926 862 902 925 834 795 927 841 799 925 878 834 927 882 841 927 799 897 235 786 887 928 886 844 235 828 786 929 892 864 258 833 790 928 803 898 928 844 803 929 839 907 198 840 896 930 809 905 929 864 839 224 843 806 930 849 809 258 790 893 931 837 793 931 60 837 932 842 908 931 793 895 931 61 60 224 806 900 933 880 838 224 883 843 932 868 842 932 899 868 231 889 845 934 69 854 231 845 22 934 814 906 934 70 69 935 874 913 231 22 23 934 71 70 933 796 901 934 854 814 933 838 796 936 856 817 936 817 910 936 119 120 287 847 903 242 850 904 937 11 12 936 897 856 937 907 875 936 910 119 937 875 11 938 894 853 939 908 881 938 853 909 147 848 804 147 893 848 147 804 148 144 859 912 262 816 911 939 881 914 262 857 816 158 895 852 940 863 826 158 852 807 158 807 159 940 905 863 190 855 919 940 826 916 941 822 915 190 884 855 942 869 827 942 827 917 941 900 860 941 860 822 942 906 869 172 858 813 943 101 924 280 865 823 943 102 101 184 876 836 172 813 170 280 823 918 200 818 193 200 861 818 220 862 926 155 829 152 184 836 922 220 888 862 155 867 829 155 909 867 229 892 929 944 916 882 944 882 927 205 148 866 174 873 921 205 866 920 214 886 928 250 899 932 945 922 890 186 878 925 946 902 874 222 870 923 237 871 828 197 840 198 946 874 935 197 879 840 946 926 902 197 918 879 945 849 930 945 890 849 947 897 936 237 828 235 216 883 224 947 120 121 216 152 883 237 170 871 165 907 937 254 193 877 254 877 833 947 936 120 180 908 939 254 833 258 246 859 144 246 898 859 233 889 231 189 913 884 252 891 850 161 905 940 189 935 913 189 884 190 270 880 933 286 885 847 209 103 102 252 850 242 256 50 894 256 894 938 256 51 50 261 857 262 177 906 942 209 102 943 286 847 287 261 198 896 291 33 34 219 888 220 183 144 912 291 887 33 261 896 857 219 914 888 183 912 876 183 876 184 219 939 914 276 900 941 156 893 147 282 865 280 228 892 229 282 904 865 228 919 892 167 895 158 282 242 904 249 899 250 211 916 944 213 886 214 308 858 172 213 917 886 154 938 909 249 924 899 154 909 155 239 922 945 308 901 858 298 873 174 265 926 946 298 911 873 284 229 929 312 903 861 304 915 878 312 287 903 284 907 165 304 878 186 948 947 121 948 121 122 312 861 200 948 944 927 149 148 205 284 929 907 293 908 180 948 897 947 202 918 197 948 927 897 245 928 898 168 870 222 202 280 918 245 898 246 293 932 908 293 250 932 245 214 928 168 159 870 153 152 216 195 935 189 175 921 889 268 905 161 163 104 103 268 930 905 273 934 906 175 889 233 273 71 934 171 170 237 175 174 921 273 72 71 194 193 254 273 906 177 163 103 209 187 925 891 187 186 925 166 12 13 187 891 252 166 165 937 166 13 14 166 937 12 145 144 183 207 880 270 162 940 916 181 180 939 207 205 920 206 198 261 162 161 940 181 939 219 207 920 880 201 919 228 162 916 211 223 885 286 225 224 900 225 900 276 178 917 213 223 923 885 223 222 923 201 190 919 178 177 942 178 942 917 210 209 943 232 23 24 210 924 249 232 24 25 191 922 239 236 887 291 232 231 23 236 235 887 210 943 924 226 220 926 191 184 922 259 893 156 259 258 893 203 122 123 226 926 265 243 242 282 203 948 122 257 256 938 203 944 948 203 211 944 351 931 895 247 229 284 257 938 154 351 61 931 351 62 61 351 895 167 263 911 298 217 214 245 271 270 933 263 262 911 240 239 945 271 933 901 271 901 308 240 945 930 277 915 304 240 930 268 251 250 293 277 276 941 266 946 935 277 941 915 288 287 312 266 935 195 281 280 202 143 246 144 266 265 946 TShapes 6 Ve @@ -109,4 +109,4 @@ Fa 0111000 +2 0 * --1 0 \ No newline at end of file +-1 0 diff --git a/src/FeaturesPlugin/doc/TUI_angularcopyFeature.rst b/src/FeaturesPlugin/doc/TUI_angularcopyFeature.rst index 66de92434..b72ee212f 100644 --- a/src/FeaturesPlugin/doc/TUI_angularcopyFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_angularcopyFeature.rst @@ -4,9 +4,8 @@ Create Angular copy =================== -.. literalinclude:: examples/angularcopy.py +.. literalinclude:: examples/angularcopy.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_boundingBoxFeature.rst b/src/FeaturesPlugin/doc/TUI_boundingBoxFeature.rst index bb73b2234..f220febff 100644 --- a/src/FeaturesPlugin/doc/TUI_boundingBoxFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_boundingBoxFeature.rst @@ -4,7 +4,7 @@ Create bounding box =================== -.. literalinclude:: examples/create_bounding_box.py +.. literalinclude:: examples/create_bounding_box.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_chamferDistAngle.rst b/src/FeaturesPlugin/doc/TUI_chamferDistAngle.rst index ebb4d1dfe..9ecdd8fde 100644 --- a/src/FeaturesPlugin/doc/TUI_chamferDistAngle.rst +++ b/src/FeaturesPlugin/doc/TUI_chamferDistAngle.rst @@ -4,7 +4,7 @@ Create Chamfer by a distance and an angle ========================================= -.. literalinclude:: examples/chamfer2.py +.. literalinclude:: examples/chamfer2.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_chamferDistances.rst b/src/FeaturesPlugin/doc/TUI_chamferDistances.rst index f59a219ac..5010d4d7b 100644 --- a/src/FeaturesPlugin/doc/TUI_chamferDistances.rst +++ b/src/FeaturesPlugin/doc/TUI_chamferDistances.rst @@ -4,7 +4,7 @@ Create Chamfer by distances =========================== -.. literalinclude:: examples/chamfer1.py +.. literalinclude:: examples/chamfer1.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_commonFeature.rst b/src/FeaturesPlugin/doc/TUI_commonFeature.rst index 993773fbe..44c6f67cf 100644 --- a/src/FeaturesPlugin/doc/TUI_commonFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_commonFeature.rst @@ -8,5 +8,4 @@ Create Common :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_copyFeature.rst b/src/FeaturesPlugin/doc/TUI_copyFeature.rst index 4d7bafb4d..e421d0973 100644 --- a/src/FeaturesPlugin/doc/TUI_copyFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_copyFeature.rst @@ -8,5 +8,4 @@ Create Copy :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_cutFeature.rst b/src/FeaturesPlugin/doc/TUI_cutFeature.rst index fadc784d8..a18e0fc53 100644 --- a/src/FeaturesPlugin/doc/TUI_cutFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_cutFeature.rst @@ -8,5 +8,4 @@ Create Cut :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_defeaturingFeature.rst b/src/FeaturesPlugin/doc/TUI_defeaturingFeature.rst index aafc73317..2814ab3bf 100644 --- a/src/FeaturesPlugin/doc/TUI_defeaturingFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_defeaturingFeature.rst @@ -4,9 +4,8 @@ Perform Defeaturing =================== -.. literalinclude:: examples/defeaturing.py +.. literalinclude:: examples/defeaturing.py :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_extrusionByBoundingPlanes.rst b/src/FeaturesPlugin/doc/TUI_extrusionByBoundingPlanes.rst index d34c3c806..d703a94e7 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionByBoundingPlanes.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionByBoundingPlanes.rst @@ -4,9 +4,8 @@ Create Extrusion by bounding planes =================================== -.. literalinclude:: examples/extrusion_by_bounding_planes.py +.. literalinclude:: examples/extrusion_by_bounding_planes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionBySizes.rst b/src/FeaturesPlugin/doc/TUI_extrusionBySizes.rst index a6cfeaf2b..622ec25dc 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionBySizes.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionBySizes.rst @@ -4,9 +4,8 @@ Create Extrusion by sizes ========================= -.. literalinclude:: examples/extrusion_by_sizes.py +.. literalinclude:: examples/extrusion_by_sizes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionCutByBoundingPlanes.rst b/src/FeaturesPlugin/doc/TUI_extrusionCutByBoundingPlanes.rst index 4927e4093..a4fec41ff 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionCutByBoundingPlanes.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionCutByBoundingPlanes.rst @@ -4,9 +4,8 @@ Create Extrusion Cut by bounding planes ======================================= -.. literalinclude:: examples/extrusion_cut_by_bounding_planes.py +.. literalinclude:: examples/extrusion_cut_by_bounding_planes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionCutBySizes.rst b/src/FeaturesPlugin/doc/TUI_extrusionCutBySizes.rst index 8f2cafa97..e49dd2757 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionCutBySizes.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionCutBySizes.rst @@ -4,9 +4,8 @@ Create Extrusion Cut by sizes ============================= -.. literalinclude:: examples/extrusion_cut_by_sizes.py +.. literalinclude:: examples/extrusion_cut_by_sizes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionCutThroughAll.rst b/src/FeaturesPlugin/doc/TUI_extrusionCutThroughAll.rst index c5ff730ba..ab88a312e 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionCutThroughAll.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionCutThroughAll.rst @@ -4,9 +4,8 @@ Create Extrusion Cut through all objects ======================================== -.. literalinclude:: examples/extrusion_cut_through_all.py +.. literalinclude:: examples/extrusion_cut_through_all.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionFuseByBoundingPlanes.rst b/src/FeaturesPlugin/doc/TUI_extrusionFuseByBoundingPlanes.rst index 17a255fe6..0fd4bb993 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionFuseByBoundingPlanes.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionFuseByBoundingPlanes.rst @@ -4,9 +4,8 @@ Create Extrusion Fuse by bounding planes ======================================== -.. literalinclude:: examples/extrusion_fuse_by_bounding_planes.py +.. literalinclude:: examples/extrusion_fuse_by_bounding_planes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionFuseBySizes.rst b/src/FeaturesPlugin/doc/TUI_extrusionFuseBySizes.rst index 84bdf576b..354ed10e3 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionFuseBySizes.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionFuseBySizes.rst @@ -4,9 +4,8 @@ Create Extrusion Fuse by sizes ============================== -.. literalinclude:: examples/extrusion_fuse_by_sizes.py +.. literalinclude:: examples/extrusion_fuse_by_sizes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_extrusionFuseThroughAll.rst b/src/FeaturesPlugin/doc/TUI_extrusionFuseThroughAll.rst index 98df80a3b..dbba695f7 100644 --- a/src/FeaturesPlugin/doc/TUI_extrusionFuseThroughAll.rst +++ b/src/FeaturesPlugin/doc/TUI_extrusionFuseThroughAll.rst @@ -4,9 +4,8 @@ Create Extrusion Fuse through all objects ========================================= -.. literalinclude:: examples/extrusion_fuse_through_all.py +.. literalinclude:: examples/extrusion_fuse_through_all.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_fillet1DVertices.rst b/src/FeaturesPlugin/doc/TUI_fillet1DVertices.rst index d5fbab024..68cde0d3d 100644 --- a/src/FeaturesPlugin/doc/TUI_fillet1DVertices.rst +++ b/src/FeaturesPlugin/doc/TUI_fillet1DVertices.rst @@ -4,9 +4,8 @@ Create 1D-fillet for special vertices on a wire =============================================== -.. literalinclude:: examples/fillet1d_vertices.py +.. literalinclude:: examples/fillet1d_vertices.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_fillet1DWire.rst b/src/FeaturesPlugin/doc/TUI_fillet1DWire.rst index 5ae982d43..1cca7da28 100644 --- a/src/FeaturesPlugin/doc/TUI_fillet1DWire.rst +++ b/src/FeaturesPlugin/doc/TUI_fillet1DWire.rst @@ -4,9 +4,8 @@ Create 1D-fillet on a wire ========================== -.. literalinclude:: examples/fillet1d_wire.py +.. literalinclude:: examples/fillet1d_wire.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_filletfixedFeature.rst b/src/FeaturesPlugin/doc/TUI_filletfixedFeature.rst index 8a34e1492..37a288340 100644 --- a/src/FeaturesPlugin/doc/TUI_filletfixedFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_filletfixedFeature.rst @@ -4,7 +4,7 @@ Create Fillet by fixed radius ============================= -.. literalinclude:: examples/fillet1.py +.. literalinclude:: examples/fillet1.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_filletvariableFeature.rst b/src/FeaturesPlugin/doc/TUI_filletvariableFeature.rst index 36311a584..7da7e4b64 100644 --- a/src/FeaturesPlugin/doc/TUI_filletvariableFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_filletvariableFeature.rst @@ -4,7 +4,7 @@ Create Fillet by variable radius ================================ -.. literalinclude:: examples/fillet2.py +.. literalinclude:: examples/fillet2.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_fuseFeature.rst b/src/FeaturesPlugin/doc/TUI_fuseFeature.rst index ffe84bf7a..4475c5178 100644 --- a/src/FeaturesPlugin/doc/TUI_fuseFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_fuseFeature.rst @@ -8,5 +8,4 @@ Create Fuse :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_fusefacesFeature.rst b/src/FeaturesPlugin/doc/TUI_fusefacesFeature.rst index 0a4b19d49..a49d7c79d 100644 --- a/src/FeaturesPlugin/doc/TUI_fusefacesFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_fusefacesFeature.rst @@ -4,7 +4,7 @@ Fuse Faces ========== -.. literalinclude:: examples/fuse_faces.py +.. literalinclude:: examples/fuse_faces.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_geometryCalculation.rst b/src/FeaturesPlugin/doc/TUI_geometryCalculation.rst index 43a8f06a8..4eecf2651 100644 --- a/src/FeaturesPlugin/doc/TUI_geometryCalculation.rst +++ b/src/FeaturesPlugin/doc/TUI_geometryCalculation.rst @@ -4,9 +4,8 @@ Get Geometry Calculation ======================== -.. literalinclude:: examples/geometry_calculation.py +.. literalinclude:: examples/geometry_calculation.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_glueFeatureFaces.rst b/src/FeaturesPlugin/doc/TUI_glueFeatureFaces.rst index 3be4e87e2..c45a0c861 100644 --- a/src/FeaturesPlugin/doc/TUI_glueFeatureFaces.rst +++ b/src/FeaturesPlugin/doc/TUI_glueFeatureFaces.rst @@ -4,7 +4,7 @@ Glue Faces ========== -.. literalinclude:: examples/glue_faces.py +.. literalinclude:: examples/glue_faces.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_importResultFeature.rst b/src/FeaturesPlugin/doc/TUI_importResultFeature.rst index cbcf73af9..bad37fc37 100644 --- a/src/FeaturesPlugin/doc/TUI_importResultFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_importResultFeature.rst @@ -8,5 +8,4 @@ Create Import Result :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_intersectionFeature.rst b/src/FeaturesPlugin/doc/TUI_intersectionFeature.rst index 8eb115b01..88ad75240 100644 --- a/src/FeaturesPlugin/doc/TUI_intersectionFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_intersectionFeature.rst @@ -8,5 +8,4 @@ Create Intersection :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_limitToleranceFeature.rst b/src/FeaturesPlugin/doc/TUI_limitToleranceFeature.rst index 25638c02e..400b4b19e 100644 --- a/src/FeaturesPlugin/doc/TUI_limitToleranceFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_limitToleranceFeature.rst @@ -8,5 +8,4 @@ Limit Tolerance :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_linearcopyFeature.rst b/src/FeaturesPlugin/doc/TUI_linearcopyFeature.rst index d85f2e204..bf21396ad 100644 --- a/src/FeaturesPlugin/doc/TUI_linearcopyFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_linearcopyFeature.rst @@ -4,7 +4,7 @@ Create Linear copy ================== -.. literalinclude:: examples/linearcopy.py +.. literalinclude:: examples/linearcopy.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_loftFeature.rst b/src/FeaturesPlugin/doc/TUI_loftFeature.rst index c97cf3fc9..c899d7726 100644 --- a/src/FeaturesPlugin/doc/TUI_loftFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_loftFeature.rst @@ -4,7 +4,7 @@ loft ==== -.. literalinclude:: examples/loft.py +.. literalinclude:: examples/loft.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_partitionFeature.rst b/src/FeaturesPlugin/doc/TUI_partitionFeature.rst index 976354929..7d64e5c7e 100644 --- a/src/FeaturesPlugin/doc/TUI_partitionFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_partitionFeature.rst @@ -8,5 +8,4 @@ Create Partition :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst b/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst index 10a22b6ab..6b710a5da 100644 --- a/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst @@ -4,7 +4,7 @@ Pipe by object, path and Bi-normal ================================== -.. literalinclude:: examples/pipe_binormal.py +.. literalinclude:: examples/pipe_binormal.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst b/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst index 80591e8c9..6b421d480 100644 --- a/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst @@ -4,7 +4,7 @@ Pipe by object, path and locations ================================== -.. literalinclude:: examples/pipe_locations.py +.. literalinclude:: examples/pipe_locations.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst b/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst index 77a6ba1f9..f8525d05d 100644 --- a/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst @@ -4,7 +4,7 @@ Pipe by object and path ======================= -.. literalinclude:: examples/pipe_simple.py +.. literalinclude:: examples/pipe_simple.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_placementFeature.rst b/src/FeaturesPlugin/doc/TUI_placementFeature.rst index 4f46ec6dd..1dc2c5c1e 100644 --- a/src/FeaturesPlugin/doc/TUI_placementFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_placementFeature.rst @@ -8,5 +8,4 @@ Create Placement :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_pointCoordinates.rst b/src/FeaturesPlugin/doc/TUI_pointCoordinates.rst index abc6e003a..5278adaaa 100644 --- a/src/FeaturesPlugin/doc/TUI_pointCoordinates.rst +++ b/src/FeaturesPlugin/doc/TUI_pointCoordinates.rst @@ -4,9 +4,8 @@ Get point coordinates ===================== -.. literalinclude:: examples/point_coordinates.py +.. literalinclude:: examples/point_coordinates.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_recoverCompoundFeature.rst b/src/FeaturesPlugin/doc/TUI_recoverCompoundFeature.rst index 330932f8a..e02cac85d 100644 --- a/src/FeaturesPlugin/doc/TUI_recoverCompoundFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_recoverCompoundFeature.rst @@ -8,5 +8,4 @@ Recover :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_recoverDefaultFeature.rst b/src/FeaturesPlugin/doc/TUI_recoverDefaultFeature.rst index 24b9ef630..0693bd18d 100644 --- a/src/FeaturesPlugin/doc/TUI_recoverDefaultFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_recoverDefaultFeature.rst @@ -8,5 +8,4 @@ Recover :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_removeSubShapesFeature.rst b/src/FeaturesPlugin/doc/TUI_removeSubShapesFeature.rst index 49e95a62f..17b51e29e 100644 --- a/src/FeaturesPlugin/doc/TUI_removeSubShapesFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_removeSubShapesFeature.rst @@ -8,5 +8,4 @@ Remove Sub-Shapes :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_revolutionByAngles.rst b/src/FeaturesPlugin/doc/TUI_revolutionByAngles.rst index 2ada16697..e19b4635c 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionByAngles.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionByAngles.rst @@ -4,9 +4,8 @@ Create Revolution by angles =========================== -.. literalinclude:: examples/revolution_by_angles.py +.. literalinclude:: examples/revolution_by_angles.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionByBoundingPlanes.rst b/src/FeaturesPlugin/doc/TUI_revolutionByBoundingPlanes.rst index e72ab58e8..142ac1c5f 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionByBoundingPlanes.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionByBoundingPlanes.rst @@ -4,9 +4,8 @@ Create Revolution by bounding planes ==================================== -.. literalinclude:: examples/revolution_by_bounding_planes.py +.. literalinclude:: examples/revolution_by_bounding_planes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionCutByAngles.rst b/src/FeaturesPlugin/doc/TUI_revolutionCutByAngles.rst index a9a57c409..9b7d3faa8 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionCutByAngles.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionCutByAngles.rst @@ -4,9 +4,8 @@ Create Revolution Cut by angles =============================== -.. literalinclude:: examples/revolution_cut_by_angles.py +.. literalinclude:: examples/revolution_cut_by_angles.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionCutByBoundingPlanes.rst b/src/FeaturesPlugin/doc/TUI_revolutionCutByBoundingPlanes.rst index 0cad5692d..2f8b04897 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionCutByBoundingPlanes.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionCutByBoundingPlanes.rst @@ -4,9 +4,8 @@ Create Revolution Cut by bounding planes ======================================== -.. literalinclude:: examples/revolution_cut_by_bounding_planes.py +.. literalinclude:: examples/revolution_cut_by_bounding_planes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionCutThroughAll.rst b/src/FeaturesPlugin/doc/TUI_revolutionCutThroughAll.rst index b7e158ed4..c041c1aba 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionCutThroughAll.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionCutThroughAll.rst @@ -4,9 +4,8 @@ Create Revolution Cut by 360 degrees ==================================== -.. literalinclude:: examples/revolution_cut_through_all.py +.. literalinclude:: examples/revolution_cut_through_all.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionFuseByAngles.rst b/src/FeaturesPlugin/doc/TUI_revolutionFuseByAngles.rst index aba5f2a12..e6cf14dd4 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionFuseByAngles.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionFuseByAngles.rst @@ -4,9 +4,8 @@ Create Revolution Fuse by angles ================================ -.. literalinclude:: examples/revolution_fuse_by_angles.py +.. literalinclude:: examples/revolution_fuse_by_angles.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionFuseByBoundingPlanes.rst b/src/FeaturesPlugin/doc/TUI_revolutionFuseByBoundingPlanes.rst index f70c94056..5735b61b9 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionFuseByBoundingPlanes.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionFuseByBoundingPlanes.rst @@ -4,9 +4,8 @@ Create Revolution Fuse by bounding planes ========================================= -.. literalinclude:: examples/revolution_fuse_by_bounding_planes.py +.. literalinclude:: examples/revolution_fuse_by_bounding_planes.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_revolutionFuseThroughAll.rst b/src/FeaturesPlugin/doc/TUI_revolutionFuseThroughAll.rst index 047d25d4c..1a872899b 100644 --- a/src/FeaturesPlugin/doc/TUI_revolutionFuseThroughAll.rst +++ b/src/FeaturesPlugin/doc/TUI_revolutionFuseThroughAll.rst @@ -4,9 +4,8 @@ Create Revolution Fuse by 360 degrees ===================================== -.. literalinclude:: examples/revolution_fuse_through_all.py +.. literalinclude:: examples/revolution_fuse_through_all.py :linenos: :language: python :download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst b/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst index 92f8336d7..9a4987007 100644 --- a/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst @@ -4,7 +4,7 @@ Rotation by center and points ============================= -.. literalinclude:: examples/rotation2.py +.. literalinclude:: examples/rotation2.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst b/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst index 5894faf57..a7df203d5 100644 --- a/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst @@ -4,7 +4,7 @@ Rotation by axis and angle ========================== -.. literalinclude:: examples/rotation1.py +.. literalinclude:: examples/rotation1.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst b/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst index 747c392f1..6af214aa6 100644 --- a/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst @@ -4,7 +4,7 @@ Scale by different factors along axes ===================================== -.. literalinclude:: examples/scaleXYZ.py +.. literalinclude:: examples/scaleXYZ.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst b/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst index 95a30d750..06756b780 100644 --- a/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst @@ -4,7 +4,7 @@ Scale by one common factor ========================== -.. literalinclude:: examples/scalefactor.py +.. literalinclude:: examples/scalefactor.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_sewingFeature.rst b/src/FeaturesPlugin/doc/TUI_sewingFeature.rst index 30f49113b..a26e32c48 100644 --- a/src/FeaturesPlugin/doc/TUI_sewingFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_sewingFeature.rst @@ -8,5 +8,4 @@ Create Sewing :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_sharedFacesFeature.rst b/src/FeaturesPlugin/doc/TUI_sharedFacesFeature.rst index 48e2f331c..42fb67ce0 100644 --- a/src/FeaturesPlugin/doc/TUI_sharedFacesFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_sharedFacesFeature.rst @@ -4,7 +4,7 @@ Check shared faces ================== -.. literalinclude:: examples/check_shared_faces.py +.. literalinclude:: examples/check_shared_faces.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_smashFeature.rst b/src/FeaturesPlugin/doc/TUI_smashFeature.rst index ae92c5881..c71ec3558 100644 --- a/src/FeaturesPlugin/doc/TUI_smashFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_smashFeature.rst @@ -8,5 +8,4 @@ Create Smash :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_splitFeature.rst b/src/FeaturesPlugin/doc/TUI_splitFeature.rst index 8ed72fcba..c0954b52f 100644 --- a/src/FeaturesPlugin/doc/TUI_splitFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_splitFeature.rst @@ -8,5 +8,4 @@ Create Split :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst b/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst index 7b0299109..31770bf60 100644 --- a/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst @@ -4,7 +4,7 @@ Symmetry through an Axis of symmetry ==================================== -.. literalinclude:: examples/symmetryaxis.py +.. literalinclude:: examples/symmetryaxis.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst b/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst index 426fa46ff..b11b3d95f 100644 --- a/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst @@ -4,7 +4,7 @@ Symmetry through a Plane of symmetry ==================================== -.. literalinclude:: examples/symmetryplane.py +.. literalinclude:: examples/symmetryplane.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst b/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst index 54d168b00..422056fc9 100644 --- a/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst @@ -4,7 +4,7 @@ Symmetry through a Point of symmetry ==================================== -.. literalinclude:: examples/symmetrypoint.py +.. literalinclude:: examples/symmetrypoint.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst b/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst index 6eeb238ee..f4908d0d4 100644 --- a/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst @@ -4,7 +4,7 @@ Translation by 2 points ======================= -.. literalinclude:: examples/translation2points.py +.. literalinclude:: examples/translation2points.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst b/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst index 2e3c306ee..0fb983ad8 100644 --- a/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst @@ -4,7 +4,7 @@ Translation by vector ===================== -.. literalinclude:: examples/translationDXDYDZ.py +.. literalinclude:: examples/translationDXDYDZ.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst b/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst index aa7b794d0..8b122f19d 100644 --- a/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst @@ -4,7 +4,7 @@ Translation by axis and distance ================================ -.. literalinclude:: examples/translationvector.py +.. literalinclude:: examples/translationvector.py :linenos: :language: python diff --git a/src/FeaturesPlugin/doc/TUI_unionFeature.rst b/src/FeaturesPlugin/doc/TUI_unionFeature.rst index bafb7c45f..d7d94c93a 100644 --- a/src/FeaturesPlugin/doc/TUI_unionFeature.rst +++ b/src/FeaturesPlugin/doc/TUI_unionFeature.rst @@ -8,5 +8,4 @@ Create Union :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/FeaturesPlugin/doc/angularCopyFeature.rst b/src/FeaturesPlugin/doc/angularCopyFeature.rst index f26b95c6b..414299b95 100644 --- a/src/FeaturesPlugin/doc/angularCopyFeature.rst +++ b/src/FeaturesPlugin/doc/angularCopyFeature.rst @@ -4,7 +4,7 @@ Angular copy ============ -The feature **Angular copy** makes a compound of several rotated shapes basing on the initial shape. +The feature **Angular copy** makes a compound of several rotated shapes basing on the initial shape. To create an Angular copy in the active part: @@ -45,4 +45,4 @@ Result of cylinder rotation is a compound. Angular copy -**See Also** a sample TUI Script of :ref:`tui_create_angularcopy` operation. +**See Also** a sample TUI Script of :ref:`tui_create_angularcopy` operation. diff --git a/src/FeaturesPlugin/doc/booleanArguments.rst b/src/FeaturesPlugin/doc/booleanArguments.rst index 68579bdfc..b78cb7151 100644 --- a/src/FeaturesPlugin/doc/booleanArguments.rst +++ b/src/FeaturesPlugin/doc/booleanArguments.rst @@ -39,7 +39,7 @@ First of all, the result of Boolean Operations depends on the dimension of argum *Note*: COMPOUND may consist of any shape combinations, therefore, it is present is each row. The next table aligns an operation and the dimensions of its arguments. -Construction planes (mentioned PLANE) can be used in several operations, but not included in the table above due to their infinite nature. +Construction planes (mentioned PLANE) can be used in several operations, but not included in the table above due to their infinite nature. +-------------------------+---------------------------+-------------------------+ | Operation | Dimension of objects (DO) | Dimension of tools (DT) | diff --git a/src/FeaturesPlugin/doc/boundingBoxFeature.rst b/src/FeaturesPlugin/doc/boundingBoxFeature.rst index 9a1222d73..47322fddd 100644 --- a/src/FeaturesPlugin/doc/boundingBoxFeature.rst +++ b/src/FeaturesPlugin/doc/boundingBoxFeature.rst @@ -6,16 +6,16 @@ Bounding box The **Bounding box** feature displays the bounding box of sub-elements of a geometrical object (shape). The property panel displays the coordinates of inferior (**Min**) and superior (**Max**) points. -the resulting bounding box can be created via a dedicated check-box **Create Box**. If this last is checked corresponding result and feature would be created. +the resulting bounding box can be created via a dedicated check-box **Create Box**. If this last is checked corresponding result and feature would be created. -If the check-box **Create Box** isn't checked, **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. +If the check-box **Create Box** isn't checked, **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. To display the bounding box in the active part: #. select in the Main Menu *Inspection - > Bounding box* item or #. click |boundingBox.icon| **Bounding box** button in the toolbar -Coordinates of the two points (inferior and superior) of the bounding box can be displayed for a selected object in the property panel : +Coordinates of the two points (inferior and superior) of the bounding box can be displayed for a selected object in the property panel : .. figure:: images/boundingBoxPropertyPanel.png :align: center @@ -25,15 +25,15 @@ Coordinates of the two points (inferior and superior) of the bounding box can be Input fields: -- **Object** contains object selected in 3D OCC viewer or object browser. -- **Create box** check-box allow the creation of the bounding box (result and feature). +- **Object** contains object selected in 3D OCC viewer or object browser. +- **Create box** check-box allow the creation of the bounding box (result and feature). Note, the coordinates of two points displayed can be selected. **TUI Command**: .. py:function:: model.getBoundingBox(Part_doc, shape) - + :param part: The current part object. :param object: A shape in format *model.selection("Type", shape)*. :return: Created bounding box. diff --git a/src/FeaturesPlugin/doc/chamferFeature.rst b/src/FeaturesPlugin/doc/chamferFeature.rst index 8b774a8be..96e380117 100644 --- a/src/FeaturesPlugin/doc/chamferFeature.rst +++ b/src/FeaturesPlugin/doc/chamferFeature.rst @@ -5,7 +5,7 @@ Chamfer ======= -**Chamfer** feature creates chamfers on the edges or on the faces of a shape. +**Chamfer** feature creates chamfers on the edges or on the faces of a shape. To create a Chamfer in the active part: @@ -14,13 +14,13 @@ To create a Chamfer in the active part: There are 2 types of chamfer: -.. figure:: images/chamfer_distances.png +.. figure:: images/chamfer_distances.png :align: left :height: 24px chamfer by two distances -.. figure:: images/chamfer_dist_angle.png +.. figure:: images/chamfer_dist_angle.png :align: left :height: 24px @@ -50,7 +50,7 @@ Input fields: :param part: The current part object. :param list: A list of faces and edges subject to fillet operation in format *model.selection(TYPE, shape)*. - :param boolean: A "True" flag to indicate that the type of chamfer is by two distances. + :param boolean: A "True" flag to indicate that the type of chamfer is by two distances. :param number: D1 value. :param number: D2 value. :return: Created object. @@ -80,7 +80,7 @@ Alternatively, there is a possibility to create a chamfer with a distance and an Input fields: - **Faces or/and edges** panel contains filleted faces and edges. All edges of a face are subject to fillet operation. Faces and edges are selected in 3D OCC viewer; -- **D** defines the chamfer distance; +- **D** defines the chamfer distance; - **Angle** defines the chamfer angle. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/copyFeature.rst b/src/FeaturesPlugin/doc/copyFeature.rst index 9fba4c60a..39b21a96f 100644 --- a/src/FeaturesPlugin/doc/copyFeature.rst +++ b/src/FeaturesPlugin/doc/copyFeature.rst @@ -26,7 +26,7 @@ Here it is necessary to select some objects. Only results and sub-results and th Also it is possible to increase the number of resulting copies. **Apply** button creates a copy. - + **Cancel** button cancels the operation. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/defeaturingFeature.rst b/src/FeaturesPlugin/doc/defeaturingFeature.rst index 82fa4cb86..beb53c1bf 100644 --- a/src/FeaturesPlugin/doc/defeaturingFeature.rst +++ b/src/FeaturesPlugin/doc/defeaturingFeature.rst @@ -3,7 +3,7 @@ Defeaturing =========== -**Defeaturing** operation is intended for removal of the unwanted parts or features from the model. These parts can be holes, protrusions, gaps, chamfers, fillets, etc. +**Defeaturing** operation is intended for removal of the unwanted parts or features from the model. These parts can be holes, protrusions, gaps, chamfers, fillets, etc. To create a Defeaturing in the active part: diff --git a/src/FeaturesPlugin/doc/extrusionCutFeature.rst b/src/FeaturesPlugin/doc/extrusionCutFeature.rst index e6e53562e..ec9c1c600 100644 --- a/src/FeaturesPlugin/doc/extrusionCutFeature.rst +++ b/src/FeaturesPlugin/doc/extrusionCutFeature.rst @@ -53,7 +53,7 @@ By sizes - **From size** - size for extrusion in the opposite direction. - **Cut from** - contains a list of objects to be cut by the result of extrusion. -**TUI Commands**: +**TUI Commands**: .. py:function:: model.addExtrusionCut(part, objectsToExtrude, size, objectsToCut) @@ -168,7 +168,7 @@ Through all - **Axis** - if selected, it will be the direction of extrusion, otherwise objects normals will be used. - **Cut from** - contains a list of objects to be cut by the result of extrusion. -**TUI Commands**: +**TUI Commands**: .. py:function:: model.addExtrusionCut(part, objectsToExtrude, objectsToCut) diff --git a/src/FeaturesPlugin/doc/fillet1dFeature.rst b/src/FeaturesPlugin/doc/fillet1dFeature.rst index af9eaf2ea..926cd2d52 100644 --- a/src/FeaturesPlugin/doc/fillet1dFeature.rst +++ b/src/FeaturesPlugin/doc/fillet1dFeature.rst @@ -5,8 +5,8 @@ 1D-fillet ========= -**1D-fillet** feature creates fillets on the vertices of a wire. -The fillet may be performed on sharp corners of a wire, which are shared exactly between 2 edges, and which are placed ona single plane. +**1D-fillet** feature creates fillets on the vertices of a wire. +The fillet may be performed on sharp corners of a wire, which are shared exactly between 2 edges, and which are placed ona single plane. To create a 1D-fillet in the active part: @@ -15,13 +15,13 @@ To create a 1D-fillet in the active part: There are 2 types of fillet: -.. image:: images/fillet1d_wire.png +.. image:: images/fillet1d_wire.png :align: left :height: 24px fillet all sharp corners on a wire -.. image:: images/fillet1d_points.png +.. image:: images/fillet1d_points.png :align: left :height: 24px diff --git a/src/FeaturesPlugin/doc/filletFeature.rst b/src/FeaturesPlugin/doc/filletFeature.rst index b41c2e16b..139246717 100644 --- a/src/FeaturesPlugin/doc/filletFeature.rst +++ b/src/FeaturesPlugin/doc/filletFeature.rst @@ -5,7 +5,7 @@ Fillet ====== -**Fillet** feature creates fillets on the edges of a shape. +**Fillet** feature creates fillets on the edges of a shape. To create a Fillet in the active part: @@ -14,13 +14,13 @@ To create a Fillet in the active part: There are 2 types of fillet: -.. figure:: images/fillet_fixed_radius.png +.. figure:: images/fillet_fixed_radius.png :align: left :height: 24px fillet by fixed radius -.. figure:: images/fillet_var_radius.png +.. figure:: images/fillet_var_radius.png :align: left :height: 24px @@ -77,7 +77,7 @@ Alternatively, there is a possibility to create a fillet with a variable radius. Input fields: - **Faces or/and edges** panel contains filleted faces and edges. All edges of a face are subject to fillet operation. Faces and edges are selected in 3D OCC viewer; -- **Start radius** defines the fillet radius at the start of the selected edge(s); +- **Start radius** defines the fillet radius at the start of the selected edge(s); - **End radius** defines the fillet radius at the end of the selected edge(s). **TUI Command**: diff --git a/src/FeaturesPlugin/doc/fuseFeatureFaces.rst b/src/FeaturesPlugin/doc/fuseFeatureFaces.rst index 07486db97..8a2541519 100644 --- a/src/FeaturesPlugin/doc/fuseFeatureFaces.rst +++ b/src/FeaturesPlugin/doc/fuseFeatureFaces.rst @@ -12,12 +12,12 @@ To perform **Fuse Faces** in the active part: The following property panel appears: -.. figure:: images/FuseFaces.png +.. figure:: images/FuseFaces.png :align: center **Fuse Faces** property panel -Input fields: +Input fields: - **Shape** - contains object selected in the Object Browser or in the Viewer, on which faces will be fused. diff --git a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst index 2487d5317..e8af5756b 100644 --- a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst +++ b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst @@ -7,14 +7,14 @@ The **Geometry calculation** feature displays basic properties of sub-elements o The geometry calculation displayed in the property panel are length, area and volume. -**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. +**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. To display geometry calculation in the active part: #. select in the Main Menu *Inspection - > Geometry calculation* item or #. click |GeometryCalculation.icon| **Geometry calculation** button in the toolbar -The geometry calculation can be displayed for a selected object in the property panel : +The geometry calculation can be displayed for a selected object in the property panel : .. figure:: images/geometryCalculationPropertyPanel.png :align: center @@ -23,7 +23,7 @@ The geometry calculation can be displayed for a selected object in the property Input fields: -- **Object** contains an object selected in 3D OCC viewer or object browser. +- **Object** contains an object selected in 3D OCC viewer or object browser. The geometry calculation displayed can be selected. @@ -35,4 +35,4 @@ The geometry calculation displayed can be selected. :param object: A shape in format *model.selection("type", shape)*. :return: list containing length, area and volume. -**See Also** a sample TUI Script of :ref:`tui_geometry_calculation` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_geometry_calculation` operation. diff --git a/src/FeaturesPlugin/doc/glueFeatureFaces.rst b/src/FeaturesPlugin/doc/glueFeatureFaces.rst index 2cfa0907a..af13d6d4d 100644 --- a/src/FeaturesPlugin/doc/glueFeatureFaces.rst +++ b/src/FeaturesPlugin/doc/glueFeatureFaces.rst @@ -12,12 +12,12 @@ To perform **Glue Faces** in the active part: The following property panel appears: -.. figure:: images/GlueFaces.png +.. figure:: images/GlueFaces.png :align: center **Glue Faces** property panel -Input fields: +Input fields: - **Objects** - contains a list of objects selected in the Object Browser or in the Viewer, on which faces will be glued. - **Tolerance** - sets the tolerance value to be used for the gluing operation. diff --git a/src/FeaturesPlugin/doc/importResultFeature.rst b/src/FeaturesPlugin/doc/importResultFeature.rst index a25cb09f3..ebf92519b 100644 --- a/src/FeaturesPlugin/doc/importResultFeature.rst +++ b/src/FeaturesPlugin/doc/importResultFeature.rst @@ -31,7 +31,7 @@ current Part where the import is done. Only results from the **Results** folder **Apply** button creates a copy. - + **Cancel** button cancels the operation. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/intersectionFeature.rst b/src/FeaturesPlugin/doc/intersectionFeature.rst index 20731bb07..891192e83 100644 --- a/src/FeaturesPlugin/doc/intersectionFeature.rst +++ b/src/FeaturesPlugin/doc/intersectionFeature.rst @@ -19,11 +19,11 @@ The following property panel will be opened: **Intersection operation** -**Objects** - contains a list of objects selected in the Object Browser or in the Viewer, which will be intersected. +**Objects** - contains a list of objects selected in the Object Browser or in the Viewer, which will be intersected. -**Fuzzy Parameter** - defines the additional tolerance value used to eliminate tiny results. +**Fuzzy Parameter** - defines the additional tolerance value used to eliminate tiny results. -All intersected objects should be 1- or 2-dimensional (edges, faces, shells). However, it is allowed to select +All intersected objects should be 1- or 2-dimensional (edges, faces, shells). However, it is allowed to select 3-dimensional objects, but only their shells will be taken into operation. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/linearCopyFeature.rst b/src/FeaturesPlugin/doc/linearCopyFeature.rst index cf0248392..b07767bb7 100644 --- a/src/FeaturesPlugin/doc/linearCopyFeature.rst +++ b/src/FeaturesPlugin/doc/linearCopyFeature.rst @@ -25,7 +25,7 @@ Input fields: - **Vector of translation** defines vector along which the object will be translated. Vector is edge, axis selected in 3D OCC viewer or object browser; - **Step** defines the distance between the shape copies; - **Nb. Copies** is the number of shape copies; - + - **Second direction** check-box turns on/off translation in the second direction: - **Vector of translation** defines vector along which the object will be translated. Vector is edge, axis selected in 3D OCC viewer or object browser; diff --git a/src/FeaturesPlugin/doc/measurementFeature.rst b/src/FeaturesPlugin/doc/measurementFeature.rst index daed27470..b2e4b6eb3 100644 --- a/src/FeaturesPlugin/doc/measurementFeature.rst +++ b/src/FeaturesPlugin/doc/measurementFeature.rst @@ -9,7 +9,7 @@ The measured dimension is displayed in the property panel and shown in 3D OCC vi The properties of dimension text and line, such as font, color, arrow size, etc. can be defined in the Preferences :ref:`visualization_preferences`. -**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. +**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. To start Measurement in the active part: @@ -18,42 +18,42 @@ To start Measurement in the active part: The following dimensions can be calculated: -.. figure:: images/meas_length_32x32.png +.. figure:: images/meas_length_32x32.png :align: left :height: 24px -edge length +edge length -.. figure:: images/meas_distance_32x32.png +.. figure:: images/meas_distance_32x32.png :align: left :height: 24px distance between objects -.. figure:: images/meas_radius_32x32.png +.. figure:: images/meas_radius_32x32.png :align: left :height: 24px radius -.. figure:: images/meas_angle_32x32.png +.. figure:: images/meas_angle_32x32.png :align: left :height: 24px -angle between edges +angle between edges -.. figure:: images/meas_angle3p_32x32.png +.. figure:: images/meas_angle3p_32x32.png :align: left :height: 24px -angle by 3 points +angle by 3 points -------------------------------------------------------------------------------- Edge length ----------- -The length can be measured for straight or curved edge built on two points. +The length can be measured for straight or curved edge built on two points. .. figure:: images/Measurement1.png :align: center @@ -62,14 +62,14 @@ The length can be measured for straight or curved edge built on two points. Input fields: -- **Edge** contains edge to be measured selected in 3D OCC viewer or object browser. +- **Edge** contains edge to be measured selected in 3D OCC viewer or object browser. Note, that for curved edges length is displayed only in the property panel. **TUI Command**: .. py:function:: model.measureLength(Part_doc, edge) - + :param part: The current part object. :param object: An edge in format *model.selection("EDGE", edge)*. :return: Calculated value. @@ -87,12 +87,12 @@ Distance between objects Input fields: -- **From**, **To** contain shapes between which distance is measured. Shapes are selected in 3D OCC viewer or object browser. +- **From**, **To** contain shapes between which distance is measured. Shapes are selected in 3D OCC viewer or object browser. **TUI Command**: .. py:function:: model.measureDistance(Part_doc, shape1, shape2) - + :param part: The current part object. :param object: A first edge in format *model.selection("EDGE", edge)*. :param object: A second edge in format *model.selection("EDGE", edge)*. @@ -101,7 +101,7 @@ Input fields: Radius ------ -**Radius** calculates radius for circular edge or cylindrical face. +**Radius** calculates radius for circular edge or cylindrical face. .. figure:: images/Measurement3.png :align: center @@ -110,13 +110,13 @@ Radius Input fields: -- **Object** contains shape to be measured selected in 3D OCC viewer or object browser. +- **Object** contains shape to be measured selected in 3D OCC viewer or object browser. **TUI Command**: .. py:function:: model.measureRadius(Part_doc, shape) - + :param part: The current part object. :param object: An edge in format *model.selection("TYPE", shape)*. :return: Calculated value. @@ -133,12 +133,12 @@ Angle between edges Input fields: -- **First Edge**, **Second edge** contain edges between which angle is measured. Edges are selected in 3D OCC viewer or object browser. +- **First Edge**, **Second edge** contain edges between which angle is measured. Edges are selected in 3D OCC viewer or object browser. **TUI Command**: .. py:function:: model.measureAngle(Part_doc, edge1, edge2) - + :param part: The current part object. :param object: A first edge in format *model.selection("TYPE", shape)*. :param object: A second edge in format *model.selection("TYPE", shape)*. @@ -156,15 +156,14 @@ Angle by 3 points Input fields: -- **First point**, **Second point**, **Third point** contain point between which angle is measured. Points are selected in 3D OCC viewer or object browser. +- **First point**, **Second point**, **Third point** contain point between which angle is measured. Points are selected in 3D OCC viewer or object browser. **TUI Command**: .. py:function:: model.measureAngle(Part_doc, vertex1, vertex2, vertex3) - + :param part: The current part object. :param object: A first vertex in format *model.selection("TYPE", shape)*. :param object: A second vertex in format *model.selection("TYPE", shape)*. :param object: A third vertex in format *model.selection("TYPE", shape)*. :return: Calculated value. - diff --git a/src/FeaturesPlugin/doc/normalToFaceFeature.rst b/src/FeaturesPlugin/doc/normalToFaceFeature.rst index e9da2793c..ad74ace36 100644 --- a/src/FeaturesPlugin/doc/normalToFaceFeature.rst +++ b/src/FeaturesPlugin/doc/normalToFaceFeature.rst @@ -3,11 +3,11 @@ Normal to a face ================ -The **Normal to a face** feature displays the normal to a face. A vertex can be specified to indicate the position of the normal else the center of face is used. +The **Normal to a face** feature displays the normal to a face. A vertex can be specified to indicate the position of the normal else the center of face is used. -The resulting normal can be created via a dedicated check-box **Create normal**. If this last is checked corresponding result and feature would be created. +The resulting normal can be created via a dedicated check-box **Create normal**. If this last is checked corresponding result and feature would be created. -If the check-box **Create normal** isn't checked, **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. +If the check-box **Create normal** isn't checked, **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. To display the normal to a face in the active part: @@ -24,14 +24,14 @@ The property panel is shown below. Input fields: -- **Face** contains face selected in 3D OCC viewer or object browser. -- **Vertex** contains optionnal vertex selected in 3D OCC viewer or object browser. -- **Create normal** check-box allow the creation of the normal (result and feature). +- **Face** contains face selected in 3D OCC viewer or object browser. +- **Vertex** contains optionnal vertex selected in 3D OCC viewer or object browser. +- **Create normal** check-box allow the creation of the normal (result and feature). **TUI Command**: .. py:function:: model.getNormal(Part, face) - + :param part: The current part object. :param object: A face in format *model.selection("FACE", face)*. :return: Created normal to a face in the center of the face. @@ -52,7 +52,7 @@ Result of **Normal to a face**. **TUI Command**: .. py:function:: model.getNormal(Part, face, vertex) - + :param part: The current part object. :param object: A face in format *model.selection("FACE", face)*. :param object: A vertex in format *model.selection("VERTEX", vertex)*. diff --git a/src/FeaturesPlugin/doc/partitionFeature.rst b/src/FeaturesPlugin/doc/partitionFeature.rst index 1e8f3f34d..2f0452e10 100644 --- a/src/FeaturesPlugin/doc/partitionFeature.rst +++ b/src/FeaturesPlugin/doc/partitionFeature.rst @@ -23,7 +23,7 @@ The following property panel will be opened: which will be partitioned. Constuction planes are allowed too if at least one non-construction entity is selected. -**Fuzzy Parameter** defines the additional tolerance value used to eliminate tiny results. +**Fuzzy Parameter** defines the additional tolerance value used to eliminate tiny results. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/pipeFeature.rst b/src/FeaturesPlugin/doc/pipeFeature.rst index bf71a0bd6..67ee93807 100644 --- a/src/FeaturesPlugin/doc/pipeFeature.rst +++ b/src/FeaturesPlugin/doc/pipeFeature.rst @@ -12,30 +12,30 @@ To create a Pipe in the active part: Pipe can be created in three different ways: -.. figure:: images/pipe_simple_32x32.png +.. figure:: images/pipe_simple_32x32.png :align: left :height: 24px -by object and path +by object and path -.. figure:: images/pipe_binormal_32x32.png +.. figure:: images/pipe_binormal_32x32.png :align: left :height: 24px -by object, path and Bi-normal +by object, path and Bi-normal -.. figure:: images/pipe_locations_32x32.png +.. figure:: images/pipe_locations_32x32.png :align: left :height: 24px -by object, path and locations +by object, path and locations -------------------------------------------------------------------------------- Pipe by object and path ----------------------- -Base Objects are extruded along the Path Object so that the angle between the normal vector to the base shape and the tangent to the path remain constant at any point of the given path. +Base Objects are extruded along the Path Object so that the angle between the normal vector to the base shape and the tangent to the path remain constant at any point of the given path. .. figure:: images/Pipe1.png :align: center @@ -50,7 +50,7 @@ Input fields: **TUI Command**: .. py:function:: model.addPipe(Part_doc, [shape], path) - + :param part: The current part object. :param list: A list of shapes in format *model.selection(TYPE, shape)*. :param object: A path in format *model.selection(TYPE, shape)*. @@ -71,11 +71,11 @@ Result of extrusion of an arc along another arc. Pipe by object, path and Bi-normal ---------------------------------- -The pipe is generated to preserve the constant angle between the normal vector to the base shape and the BiNormal vector at any point of the given path. +The pipe is generated to preserve the constant angle between the normal vector to the base shape and the BiNormal vector at any point of the given path. .. figure:: images/Pipe2.png :align: center - + Pipe by object, path and Bi-normal property panel Input fields: @@ -87,7 +87,7 @@ Input fields: **TUI Command**: .. py:function:: model.addPipe(Part_doc, [shape], path, binormal) - + :param part: The current part object. :param list: A list of shapes in format *model.selection(TYPE, shape)*. :param object: A path in format *model.selection(TYPE, shape)*. @@ -125,7 +125,7 @@ Input fields: **TUI Command**: .. py:function:: model.addPipe(Part_doc, [shape], path, locations) - + :param part: The current part object. :param list: A list of shapes in format *model.selection(TYPE, shape)*. :param object: A path in format *model.selection(TYPE, shape)*. diff --git a/src/FeaturesPlugin/doc/placementFeature.rst b/src/FeaturesPlugin/doc/placementFeature.rst index 76498ce8c..606a60b11 100644 --- a/src/FeaturesPlugin/doc/placementFeature.rst +++ b/src/FeaturesPlugin/doc/placementFeature.rst @@ -27,7 +27,7 @@ In this property panel, it is necessary to: **Apply** button creates the placement. - + **Cancel** button cancels the operation. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst b/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst index 84717d1aa..f64929220 100644 --- a/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst +++ b/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst @@ -7,14 +7,14 @@ The **Points coordinates** feature displays the coordinates of a selected point. The coordinates are displayed in the property panel. -**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. +**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. To display Point coordinates in the active part: #. select in the Main Menu *Inspection - > Point coordinates* item or #. click |point_coord.icon| **Points coordinates** button in the toolbar -The coordinates can be displayed for a selected point in the property panel : +The coordinates can be displayed for a selected point in the property panel : .. figure:: images/pointCoordinatesPropertyPanel.png :align: center @@ -23,7 +23,7 @@ The coordinates can be displayed for a selected point in the property panel : Input fields: -- Input field contains a point selected in 3D OCC viewer or object browser. +- Input field contains a point selected in 3D OCC viewer or object browser. Note, the coordinates displayed can be selected. @@ -35,4 +35,4 @@ Note, the coordinates displayed can be selected. :param object: A point in format *model.selection("VERTEX", shape)*. :return: list of coordinates. -**See Also** a sample TUI Script of :ref:`tui_point_coordinates` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_point_coordinates` operation. diff --git a/src/FeaturesPlugin/doc/revolutionFuseFeature.rst b/src/FeaturesPlugin/doc/revolutionFuseFeature.rst index 149ac8828..9a82905be 100644 --- a/src/FeaturesPlugin/doc/revolutionFuseFeature.rst +++ b/src/FeaturesPlugin/doc/revolutionFuseFeature.rst @@ -16,7 +16,7 @@ The following property panel will be opened: :align: center Start sketch - + There are three variants of the property panel for Revolution Fuse depending on the chosen option: .. figure:: images/revolution_by_angles.png diff --git a/src/FeaturesPlugin/doc/rotationFeature.rst b/src/FeaturesPlugin/doc/rotationFeature.rst index 34c7f3292..5fa69a7f5 100644 --- a/src/FeaturesPlugin/doc/rotationFeature.rst +++ b/src/FeaturesPlugin/doc/rotationFeature.rst @@ -13,13 +13,13 @@ To create a Rotation in the active part: Two rotation algorithms are: -.. figure:: images/rotation_axis_32x32.png +.. figure:: images/rotation_axis_32x32.png :align: left :height: 24px -by axis and angle +by axis and angle -.. figure:: images/rotation_3pt_32x32.png +.. figure:: images/rotation_3pt_32x32.png :align: left :height: 24px @@ -39,7 +39,7 @@ Input fields: - **Main objects** panel contains shapes to be rotated. Shapes are selected in 3D OCC viewer or object browser; :ref:`transformation_subshapes` - **Axis** defines the axis of rotation. The vector is an edge or axis selected in 3D OCC viewer or object browser; -- **Angle** defines the angle by which the object is rotated. +- **Angle** defines the angle by which the object is rotated. **TUI Command**: @@ -74,7 +74,7 @@ Rotation by center and points Input fields: - **Main objects** panel contains shapes to be rotated. Shapes are selected in 3D OCC viewer or object browser; :ref:`transformation_subshapes` -- **Center point**, **Start point**, **End point** define 3 points or vertices selected in 3D OCC viewer or object browser. Rotation axis will pass through the **Center point** and will be orthogonal to a plane defined by three points. Rotation Angle is the angle between two vectors directed from the **Center point** to **Start point** and **End point**. +- **Center point**, **Start point**, **End point** define 3 points or vertices selected in 3D OCC viewer or object browser. Rotation axis will pass through the **Center point** and will be orthogonal to a plane defined by three points. Rotation Angle is the angle between two vectors directed from the **Center point** to **Start point** and **End point**. **TUI Command**: diff --git a/src/FeaturesPlugin/doc/symmetryFeature.rst b/src/FeaturesPlugin/doc/symmetryFeature.rst index 267f7d8f3..23cfa01fe 100644 --- a/src/FeaturesPlugin/doc/symmetryFeature.rst +++ b/src/FeaturesPlugin/doc/symmetryFeature.rst @@ -12,23 +12,23 @@ To create a Symmetry in the active part: Symmetrical copy of an Object can be mirrored in three different ways: -.. figure:: images/symmetry_point_32x32.png +.. figure:: images/symmetry_point_32x32.png :align: left :height: 24px -through a Point of symmetry +through a Point of symmetry -.. figure:: images/symmetry_axis_32x32.png +.. figure:: images/symmetry_axis_32x32.png :align: left :height: 24px -through an Axis of symmetry +through an Axis of symmetry -.. figure:: images/symmetry_plane_32x32.png +.. figure:: images/symmetry_plane_32x32.png :align: left :height: 24px -through a Plane of symmetry +through a Plane of symmetry -------------------------------------------------------------------------------- @@ -102,7 +102,7 @@ The result of operation is a mirrored initial shape with **Create a copy** = *Fa Symmetry through an Axis of symmetry -**See Also** a sample TUI Script of :ref:`tui_symmetry_axis` operation. +**See Also** a sample TUI Script of :ref:`tui_symmetry_axis` operation. Symmetry through a Plane of symmetry ------------------------------------ @@ -138,4 +138,4 @@ The result of operation is a mirrored initial shape with **Create a copy** = *Fa Symmetry through a Plane of symmetry -**See Also** a sample TUI Script of :ref:`tui_symmetry_plane` operation. +**See Also** a sample TUI Script of :ref:`tui_symmetry_plane` operation. diff --git a/src/FeaturesPlugin/doc/transformationFeature.rst b/src/FeaturesPlugin/doc/transformationFeature.rst index 403c32f20..fc06e2a91 100644 --- a/src/FeaturesPlugin/doc/transformationFeature.rst +++ b/src/FeaturesPlugin/doc/transformationFeature.rst @@ -12,13 +12,13 @@ To create a Scale in the active part: Two Scale algorithms are: -.. figure:: images/scale_factor_32x32.png +.. figure:: images/scale_factor_32x32.png :align: left :height: 24px -by one common factor +by one common factor -.. figure:: images/scale_dimensions_32x32.png +.. figure:: images/scale_dimensions_32x32.png :align: left :height: 24px @@ -40,12 +40,12 @@ Input fields: - **Main objects** panel contains shapes to be scaled. Shapes are selected in 3D OCC viewer or object browser; :ref:`transformation_subshapes` - **Center point** defines the point relatively to which the object is scaled. Point is selected in 3D OCC viewer or object browser; -- **Scale factor** defines the multiplier of axial dimensions. If Scale Factor is negative, the object is mirrored through the Central Point. +- **Scale factor** defines the multiplier of axial dimensions. If Scale Factor is negative, the object is mirrored through the Central Point. **TUI Command**: .. py:function:: model.addScale(Part_doc, [shape], center, factor) - + :param part: The current part object. :param list: A list of shapes in format *model.selection(TYPE, shape)*. :param object: A center point in format *model.selection(TYPE, shape)*. @@ -62,7 +62,7 @@ Result of operation is transformed initial shape shown in wireframe mode togethe Scale by one common factor -**See Also** a sample TUI Script of :ref:`tui_Scale_common_factor` operation. +**See Also** a sample TUI Script of :ref:`tui_Scale_common_factor` operation. Scale by different factors along axes ------------------------------------- @@ -78,12 +78,12 @@ Input fields: - **Main objects** panel contains shapes to be scaled. Shapes are selected in 3D OCC viewer or object browser; :ref:`transformation_subshapes` - **Center point** defines the point relatively to which the object is scaled. Point is selected in 3D OCC viewer or object browser; -- **Scale factor in X**, **Scale factor in Y**, **Scale factor in Z** define the the multipliers of axial dimensions. If Scale Factor is negative, the object is mirrored through the Central Point. +- **Scale factor in X**, **Scale factor in Y**, **Scale factor in Z** define the the multipliers of axial dimensions. If Scale Factor is negative, the object is mirrored through the Central Point. **TUI Command**: .. py:function:: model.addScale(Part_doc, [shape], center, factors) - + :param part: The current part object. :param list: A list of shapes in format *model.selection(TYPE, shape)*. :param object: A center point in format *model.selection(TYPE, shape)*. diff --git a/src/FeaturesPlugin/doc/translationFeature.rst b/src/FeaturesPlugin/doc/translationFeature.rst index e36901d2e..49eb47318 100644 --- a/src/FeaturesPlugin/doc/translationFeature.rst +++ b/src/FeaturesPlugin/doc/translationFeature.rst @@ -14,19 +14,19 @@ To create a Translation in the active part: The Vector of translation can be defined in three different ways: -.. figure:: images/translation_vector_32x32.png +.. figure:: images/translation_vector_32x32.png :align: left :height: 24px by by axis and distance -.. figure:: images/translation_dxyz_32x32.png +.. figure:: images/translation_dxyz_32x32.png :align: left :height: 24px -by vector +by vector -.. figure:: images/translation_2pt_32x32.png +.. figure:: images/translation_2pt_32x32.png :align: left :height: 24px @@ -120,7 +120,7 @@ Input fields: - **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; :ref:`transformation_subshapes` - **Start point** defines start vector point as point or vertex selected in 3D OCC viewer or object browser; - **End point** defines end vector point as point or vertex selected in 3D OCC viewer or object browser; - + **TUI Command**: .. py:function:: model.addTranslation(Part_doc, [shape], point1, point2) diff --git a/src/FeaturesPlugin/doc/unionFeature.rst b/src/FeaturesPlugin/doc/unionFeature.rst index 8bb04da46..fa811161e 100644 --- a/src/FeaturesPlugin/doc/unionFeature.rst +++ b/src/FeaturesPlugin/doc/unionFeature.rst @@ -26,7 +26,7 @@ Here it is necessary to select some objects. Only faces with shared edges or sol **Fuzzy Parameter** defines the additional tolerance value used to eliminate tiny results. **Apply** button creates a union shape. - + **Cancel** button cancels the operation. **TUI Command**: diff --git a/src/FeaturesPlugin/multitranslation_widget.xml b/src/FeaturesPlugin/multitranslation_widget.xml index 658939408..1f3fea3e2 100644 --- a/src/FeaturesPlugin/multitranslation_widget.xml +++ b/src/FeaturesPlugin/multitranslation_widget.xml @@ -57,4 +57,4 @@ tooltip="Number of copies for the second direction"> - \ No newline at end of file + diff --git a/src/FeaturesPlugin/scale_widget.xml b/src/FeaturesPlugin/scale_widget.xml index c9ade559a..8a585b55e 100644 --- a/src/FeaturesPlugin/scale_widget.xml +++ b/src/FeaturesPlugin/scale_widget.xml @@ -71,4 +71,4 @@ - \ No newline at end of file + diff --git a/src/FiltersAPI/FiltersAPI.h b/src/FiltersAPI/FiltersAPI.h index 547b23189..66a1bcc97 100644 --- a/src/FiltersAPI/FiltersAPI.h +++ b/src/FiltersAPI/FiltersAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSAPI_H @@ -22,13 +23,13 @@ #if defined FILTERSAPI_EXPORTS #if defined WIN32 -#define FILTERSAPI_EXPORT __declspec( dllexport ) +#define FILTERSAPI_EXPORT __declspec(dllexport) #else #define FILTERSAPI_EXPORT #endif #else #if defined WIN32 -#define FILTERSAPI_EXPORT __declspec( dllimport ) +#define FILTERSAPI_EXPORT __declspec(dllimport) #else #define FILTERSAPI_EXPORT #endif diff --git a/src/FiltersAPI/FiltersAPI_Argument.cpp b/src/FiltersAPI/FiltersAPI_Argument.cpp index bf54fee45..b71755df1 100644 --- a/src/FiltersAPI/FiltersAPI_Argument.cpp +++ b/src/FiltersAPI/FiltersAPI_Argument.cpp @@ -14,63 +14,48 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersAPI_Argument.h" -FiltersAPI_Argument::FiltersAPI_Argument() -{ -} +FiltersAPI_Argument::FiltersAPI_Argument() {} FiltersAPI_Argument::FiltersAPI_Argument(const bool theValue) - : myBoolean(theValue) -{ -} + : myBoolean(theValue) {} FiltersAPI_Argument::FiltersAPI_Argument(const ModelHighAPI_Double theValue) - : myDouble(theValue) -{ -} + : myDouble(theValue) {} -FiltersAPI_Argument::FiltersAPI_Argument(const double& theValue) -{ +FiltersAPI_Argument::FiltersAPI_Argument(const double &theValue) { myDouble = theValue; } -FiltersAPI_Argument::FiltersAPI_Argument(const std::string& theValue) - : myValue(theValue) -{ -} +FiltersAPI_Argument::FiltersAPI_Argument(const std::string &theValue) + : myValue(theValue) {} -FiltersAPI_Argument::FiltersAPI_Argument(const ModelHighAPI_Selection& theSelection) - : mySelection(theSelection) -{ -} +FiltersAPI_Argument::FiltersAPI_Argument( + const ModelHighAPI_Selection &theSelection) + : mySelection(theSelection) {} -FiltersAPI_Argument::FiltersAPI_Argument(const AttributeSelectionPtr& theSelection) - : mySelectionAttr(theSelection) -{ -} +FiltersAPI_Argument::FiltersAPI_Argument( + const AttributeSelectionPtr &theSelection) + : mySelectionAttr(theSelection) {} -FiltersAPI_Argument::~FiltersAPI_Argument() -{ -} +FiltersAPI_Argument::~FiltersAPI_Argument() {} -void FiltersAPI_Argument::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FiltersAPI_Argument::dump(ModelHighAPI_Dumper &theDumper) const { if (mySelectionAttr) { - // write empty selection attribute, because parametrization is not supported yet + // write empty selection attribute, because parametrization is not supported + // yet theDumper << "model.selection()"; // mySelectionAttr; - } - else if (mySelection.variantType() == ModelHighAPI_Selection::VT_Empty) { - if (myDouble.value() > std::numeric_limits::lowest() ) { + } else if (mySelection.variantType() == ModelHighAPI_Selection::VT_Empty) { + if (myDouble.value() > std::numeric_limits::lowest()) { theDumper << myDouble.value(); - } - else if (myValue.empty()) { + } else if (myValue.empty()) { theDumper << myBoolean; - } - else{ + } else { theDumper << "\"" << myValue << "\""; } } diff --git a/src/FiltersAPI/FiltersAPI_Argument.h b/src/FiltersAPI/FiltersAPI_Argument.h index 079f2e1bd..f11a9cb6e 100644 --- a/src/FiltersAPI/FiltersAPI_Argument.h +++ b/src/FiltersAPI/FiltersAPI_Argument.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSAPI_ARGUMENT_H_ @@ -34,8 +35,7 @@ * \ingroup CPPHighAPI * \brief Argument of the Filter */ -class FiltersAPI_Argument -{ +class FiltersAPI_Argument { public: FILTERSAPI_EXPORT FiltersAPI_Argument(); @@ -46,32 +46,32 @@ public: FiltersAPI_Argument(const ModelHighAPI_Double theValue); FILTERSAPI_EXPORT - FiltersAPI_Argument(const double& theValue); + FiltersAPI_Argument(const double &theValue); FILTERSAPI_EXPORT - FiltersAPI_Argument(const std::string& theValue); + FiltersAPI_Argument(const std::string &theValue); FILTERSAPI_EXPORT - FiltersAPI_Argument(const ModelHighAPI_Selection& theSelection); + FiltersAPI_Argument(const ModelHighAPI_Selection &theSelection); FILTERSAPI_EXPORT - FiltersAPI_Argument(const AttributeSelectionPtr& theSelection); + FiltersAPI_Argument(const AttributeSelectionPtr &theSelection); /// Destructor FILTERSAPI_EXPORT virtual ~FiltersAPI_Argument(); const bool boolean() const { return myBoolean; } - const std::string& string() const { return myValue; } - const ModelHighAPI_Selection& selection() const { return mySelection; } - const ModelHighAPI_Double& dble() const { return myDouble; } + const std::string &string() const { return myValue; } + const ModelHighAPI_Selection &selection() const { return mySelection; } + const ModelHighAPI_Double &dble() const { return myDouble; } /// Dump wrapped feature FILTERSAPI_EXPORT - void dump(ModelHighAPI_Dumper& theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const; private: bool myBoolean; - ModelHighAPI_Double myDouble = std::numeric_limits::lowest() ; + ModelHighAPI_Double myDouble = std::numeric_limits::lowest(); std::string myValue; ModelHighAPI_Selection mySelection; AttributeSelectionPtr mySelectionAttr; diff --git a/src/FiltersAPI/FiltersAPI_Feature.cpp b/src/FiltersAPI/FiltersAPI_Feature.cpp index 1f3a7a764..a85c750c5 100644 --- a/src/FiltersAPI/FiltersAPI_Feature.cpp +++ b/src/FiltersAPI/FiltersAPI_Feature.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersAPI_Feature.h" @@ -27,47 +28,43 @@ #include FiltersAPI_Feature::FiltersAPI_Feature( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); - std::dynamic_pointer_cast(theFeature)->initAttributes(); + std::dynamic_pointer_cast(theFeature) + ->initAttributes(); } -FiltersAPI_Feature::~FiltersAPI_Feature() -{ -} +FiltersAPI_Feature::~FiltersAPI_Feature() {} -static void separateArguments(const std::list& theArguments, - std::list& theSelections, - std::list& theTextArgs, - std::list& theBoolArgs, - std::list& theDoubleArgs) -{ +static void +separateArguments(const std::list &theArguments, + std::list &theSelections, + std::list &theTextArgs, + std::list &theBoolArgs, + std::list &theDoubleArgs) { std::list::const_iterator anIt = theArguments.begin(); for (; anIt != theArguments.end(); ++anIt) { if (anIt->selection().variantType() != ModelHighAPI_Selection::VT_Empty) theSelections.push_back(anIt->selection()); else if (anIt->dble().value() > std::numeric_limits::lowest()) { theDoubleArgs.push_back(anIt->dble()); - } - else if (anIt->string().empty()) { + } else if (anIt->string().empty()) { theBoolArgs.push_back(anIt->boolean()); - } - else + } else theTextArgs.push_back(anIt->string()); } } -void FiltersAPI_Feature::setFilters(const std::list& theFilters) -{ - FiltersFeaturePtr aBase = std::dynamic_pointer_cast(feature()); +void FiltersAPI_Feature::setFilters(const std::list &theFilters) { + FiltersFeaturePtr aBase = + std::dynamic_pointer_cast(feature()); for (std::list::const_iterator anIt = theFilters.begin(); anIt != theFilters.end(); ++anIt) { std::string aFilterID = aBase->addFilter((*anIt)->name()); aBase->setReversed(aFilterID, (*anIt)->isReversed()); - const std::list& anArgs = (*anIt)->arguments(); + const std::list &anArgs = (*anIt)->arguments(); if (!anArgs.empty()) { // separate selection arguments and strings std::list aSelections; @@ -101,8 +98,7 @@ void FiltersAPI_Feature::setFilters(const std::list& theFilters) if (aString) { if (aTexts.size() == 1) fillAttribute(aTexts.front(), aString); - } - else { + } else { AttributeBooleanPtr aBoolean = std::dynamic_pointer_cast(*aFIt); if (aBoolean) { @@ -124,18 +120,19 @@ void FiltersAPI_Feature::setFilters(const std::list& theFilters) } } -void FiltersAPI_Feature::dump(ModelHighAPI_Dumper& theDumper) const -{ - FiltersFeaturePtr aBase = std::dynamic_pointer_cast(feature()); +void FiltersAPI_Feature::dump(ModelHighAPI_Dumper &theDumper) const { + FiltersFeaturePtr aBase = + std::dynamic_pointer_cast(feature()); if (!aBase) return; - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << "model.filters(" << aDocName << ", ["; - ModelAPI_FiltersFactory* aFFactory = ModelAPI_Session::get()->filters(); + ModelAPI_FiltersFactory *aFFactory = ModelAPI_Session::get()->filters(); std::list aFilters = aBase->filters(); - for (std::list::iterator aFIt = aFilters.begin(); aFIt != aFilters.end(); ++aFIt) { + for (std::list::iterator aFIt = aFilters.begin(); + aFIt != aFilters.end(); ++aFIt) { // for multiple filters get original id std::string aFilterKind = aFFactory->id(aFFactory->filter(*aFIt)); FiltersAPI_Filter aFilter(aFilterKind, aBase->filterArgs(*aFIt)); diff --git a/src/FiltersAPI/FiltersAPI_Feature.h b/src/FiltersAPI/FiltersAPI_Feature.h index 77d9a4abb..c1c846ae1 100644 --- a/src/FiltersAPI/FiltersAPI_Feature.h +++ b/src/FiltersAPI/FiltersAPI_Feature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSAPI_FEATURE_H_ @@ -34,12 +35,12 @@ class ModelAPI_Feature; * \ingroup CPPHighAPI * \brief Interface for the list of filters */ -class FiltersAPI_Feature : public ModelHighAPI_Interface -{ +class FiltersAPI_Feature : public ModelHighAPI_Interface { public: /// Constructor without values FILTERSAPI_EXPORT - explicit FiltersAPI_Feature(const std::shared_ptr & theFeature); + explicit FiltersAPI_Feature( + const std::shared_ptr &theFeature); /// Destructor FILTERSAPI_EXPORT @@ -49,11 +50,11 @@ public: /// assign list of filters FILTERSAPI_EXPORT - void setFilters(const std::list& theFilters); + void setFilters(const std::list &theFilters); /// Dump wrapped feature FILTERSAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; typedef std::shared_ptr FiltersPtr; diff --git a/src/FiltersAPI/FiltersAPI_Filter.cpp b/src/FiltersAPI/FiltersAPI_Filter.cpp index f3ae4da94..678fc3ffb 100644 --- a/src/FiltersAPI/FiltersAPI_Filter.cpp +++ b/src/FiltersAPI/FiltersAPI_Filter.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersAPI_Filter.h" @@ -28,17 +29,14 @@ #include FiltersAPI_Filter::FiltersAPI_Filter( - const std::string& theName, - const bool theRevertFilter, - const std::list& theArguments) - : myName(theName), myReversed(theRevertFilter), myFilterArguments(theArguments) -{ -} + const std::string &theName, const bool theRevertFilter, + const std::list &theArguments) + : myName(theName), myReversed(theRevertFilter), + myFilterArguments(theArguments) {} -FiltersAPI_Filter::FiltersAPI_Filter(const std::string& theName, - const std::list& theArguments) - : myName(theName) -{ +FiltersAPI_Filter::FiltersAPI_Filter( + const std::string &theName, const std::list &theArguments) + : myName(theName) { std::list::const_iterator anArgIt = theArguments.begin(); // first attribute is usually for reversing the filter AttributeBooleanPtr aBoolAttr = @@ -67,19 +65,22 @@ FiltersAPI_Filter::FiltersAPI_Filter(const std::string& theName, continue; } - AttributeStringPtr aString = std::dynamic_pointer_cast(*anArgIt); + AttributeStringPtr aString = + std::dynamic_pointer_cast(*anArgIt); if (aString) { myFilterArguments.push_back(FiltersAPI_Argument(aString->value())); continue; } - AttributeDoublePtr aDouble = std::dynamic_pointer_cast(*anArgIt); + AttributeDoublePtr aDouble = + std::dynamic_pointer_cast(*anArgIt); if (aDouble) { myFilterArguments.push_back(FiltersAPI_Argument(aDouble->value())); continue; } - AttributeBooleanPtr aBoolean = std::dynamic_pointer_cast(*anArgIt); + AttributeBooleanPtr aBoolean = + std::dynamic_pointer_cast(*anArgIt); if (aBoolean) { myFilterArguments.push_back(FiltersAPI_Argument(aBoolean->value())); continue; @@ -87,19 +88,17 @@ FiltersAPI_Filter::FiltersAPI_Filter(const std::string& theName, } } -FiltersAPI_Filter::~FiltersAPI_Filter() -{ -} +FiltersAPI_Filter::~FiltersAPI_Filter() {} -void FiltersAPI_Filter::dump(ModelHighAPI_Dumper& theDumper) const -{ +void FiltersAPI_Filter::dump(ModelHighAPI_Dumper &theDumper) const { theDumper << "model.addFilter(name = \"" << myName << "\""; if (myReversed) theDumper << ", exclude = " << myReversed; if (!myFilterArguments.empty()) { theDumper << ", args = ["; bool isFirstArg = true; - for (std::list::const_iterator anIt = myFilterArguments.begin(); + for (std::list::const_iterator anIt = + myFilterArguments.begin(); anIt != myFilterArguments.end(); ++anIt) { if (isFirstArg) isFirstArg = false; @@ -113,9 +112,7 @@ void FiltersAPI_Filter::dump(ModelHighAPI_Dumper& theDumper) const } // ================================================================================================ -FilterAPIPtr addFilter(const std::string& name, - const bool exclude, - const std::list& args) -{ +FilterAPIPtr addFilter(const std::string &name, const bool exclude, + const std::list &args) { return FilterAPIPtr(new FiltersAPI_Filter(name, exclude, args)); } diff --git a/src/FiltersAPI/FiltersAPI_Filter.h b/src/FiltersAPI/FiltersAPI_Filter.h index 8524f1745..a935ec3c2 100644 --- a/src/FiltersAPI/FiltersAPI_Filter.h +++ b/src/FiltersAPI/FiltersAPI_Filter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSAPI_FILTER_H_ @@ -32,31 +33,33 @@ class ModelAPI_Attribute; * \ingroup CPPHighAPI * \brief Interface for the Filter */ -class FiltersAPI_Filter -{ +class FiltersAPI_Filter { public: FILTERSAPI_EXPORT - FiltersAPI_Filter( - const std::string& theName, - const bool theRevertFilter = false, - const std::list& theArguments = std::list()); + FiltersAPI_Filter(const std::string &theName, + const bool theRevertFilter = false, + const std::list &theArguments = + std::list()); // Internal constructor based on filter arguments FILTERSAPI_EXPORT - FiltersAPI_Filter(const std::string& theName, - const std::list >& theArguments); + FiltersAPI_Filter( + const std::string &theName, + const std::list> &theArguments); /// Destructor FILTERSAPI_EXPORT virtual ~FiltersAPI_Filter(); - const std::string& name() const { return myName; } + const std::string &name() const { return myName; } bool isReversed() const { return myReversed; } - const std::list& arguments() const { return myFilterArguments; } + const std::list &arguments() const { + return myFilterArguments; + } /// Dump wrapped feature FILTERSAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: std::string myName; @@ -68,8 +71,8 @@ typedef std::shared_ptr FilterAPIPtr; /// Create list of filters FILTERSAPI_EXPORT FilterAPIPtr -addFilter(const std::string& name = std::string(), - const bool exclude = false, - const std::list& args = std::list()); +addFilter(const std::string &name = std::string(), const bool exclude = false, + const std::list &args = + std::list()); #endif diff --git a/src/FiltersAPI/FiltersAPI_Selection.cpp b/src/FiltersAPI/FiltersAPI_Selection.cpp index b600746da..28c91ef2b 100644 --- a/src/FiltersAPI/FiltersAPI_Selection.cpp +++ b/src/FiltersAPI/FiltersAPI_Selection.cpp @@ -14,49 +14,47 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersAPI_Selection.h" #include "GeomAPI_Edge.h" -#include "ModelAPI_Session.h" #include "ModelAPI_FiltersFactory.h" +#include "ModelAPI_Session.h" #include "ModelHighAPI_Services.h" -FiltersAPI_Selection::FiltersAPI_Selection(const FiltersPtr & theFeature) -{ +FiltersAPI_Selection::FiltersAPI_Selection(const FiltersPtr &theFeature) { myVariantType = VT_Filtering; - myFilterFeature = std::dynamic_pointer_cast(theFeature->feature()); + myFilterFeature = + std::dynamic_pointer_cast(theFeature->feature()); } -FiltersAPI_Selection::~FiltersAPI_Selection() -{ -} +FiltersAPI_Selection::~FiltersAPI_Selection() {} -FiltersFeaturePtr FiltersAPI_Selection::feature() const -{ +FiltersFeaturePtr FiltersAPI_Selection::feature() const { return myFilterFeature; } -std::list FiltersAPI_Selection::select - (const std::string theShapeType) const -{ +std::list +FiltersAPI_Selection::select(const std::string theShapeType) const { return select(GeomAPI_Shape::shapeTypeByStr(theShapeType)); } -std::list FiltersAPI_Selection::select - (const GeomAPI_Shape::ShapeType theShapeType) const -{ - // finish operation to make sure the selection is done on the current state of the history +std::list FiltersAPI_Selection::select( + const GeomAPI_Shape::ShapeType theShapeType) const { + // finish operation to make sure the selection is done on the current state of + // the history apply(); std::list aSelList; static SessionPtr aSession = ModelAPI_Session::get(); - std::list< std::pair > aResList = - aSession->filters()->select(myFilterFeature, theShapeType); + std::list> aResList = + aSession->filters()->select(myFilterFeature, theShapeType); - std::list< std::pair >::const_iterator itSelected = aResList.cbegin(); + std::list>::const_iterator itSelected = + aResList.cbegin(); for (; itSelected != aResList.cend(); itSelected++) { ResultPtr aCurRes = (*itSelected).first; GeomShapePtr aSubShape = (*itSelected).second; @@ -67,9 +65,8 @@ std::list FiltersAPI_Selection::select } // ================================================================================================ -FiltersAPI_Selection filters(const std::shared_ptr& thePart, - const std::list& theFilters) -{ +FiltersAPI_Selection filters(const std::shared_ptr &thePart, + const std::list &theFilters) { FeaturePtr aFeature = thePart->addFeature(FiltersPlugin_Selection::ID()); FiltersPtr aFiltersFeature(new FiltersAPI_Feature(aFeature)); aFiltersFeature->setFilters(theFilters); diff --git a/src/FiltersAPI/FiltersAPI_Selection.h b/src/FiltersAPI/FiltersAPI_Selection.h index 732141e3f..76b7c5ceb 100644 --- a/src/FiltersAPI/FiltersAPI_Selection.h +++ b/src/FiltersAPI/FiltersAPI_Selection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSAPI_SELECTION_H_ @@ -25,17 +26,15 @@ #include - /**\class FiltersAPI_Selection * \ingroup CPPHighAPI * \brief Interface for the selection of filters */ -class FiltersAPI_Selection : public ModelHighAPI_Selection -{ +class FiltersAPI_Selection : public ModelHighAPI_Selection { public: /// Constructor without values FILTERSAPI_EXPORT - explicit FiltersAPI_Selection(const FiltersPtr& theFeature); + explicit FiltersAPI_Selection(const FiltersPtr &theFeature); /// Destructor FILTERSAPI_EXPORT @@ -47,14 +46,16 @@ public: /// Return selected entities FILTERSAPI_EXPORT - std::list select(const std::string theShapeType) const; + std::list + select(const std::string theShapeType) const; FILTERSAPI_EXPORT - std::list select(const GeomAPI_Shape::ShapeType theShapeType) const; + std::list + select(const GeomAPI_Shape::ShapeType theShapeType) const; }; /// Create list of filters FILTERSAPI_EXPORT -FiltersAPI_Selection filters(const std::shared_ptr& thePart, - const std::list& theFilters); +FiltersAPI_Selection filters(const std::shared_ptr &thePart, + const std::list &theFilters); #endif diff --git a/src/FiltersAPI/FiltersAPI_swig.h b/src/FiltersAPI/FiltersAPI_swig.h index f6b2142e0..0b9f3e166 100644 --- a/src/FiltersAPI/FiltersAPI_swig.h +++ b/src/FiltersAPI/FiltersAPI_swig.h @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FiltersAPI_swig_H_ #define FiltersAPI_swig_H_ - #include +#include - #include "FiltersAPI.h" - #include "FiltersAPI_Argument.h" - #include "FiltersAPI_Feature.h" - #include "FiltersAPI_Filter.h" - #include "FiltersAPI_Selection.h" +#include "FiltersAPI.h" +#include "FiltersAPI_Argument.h" +#include "FiltersAPI_Feature.h" +#include "FiltersAPI_Filter.h" +#include "FiltersAPI_Selection.h" #endif // FiltersAPI_swig_H_ diff --git a/src/FiltersPlugin/FiltersPlugin.h b/src/FiltersPlugin/FiltersPlugin.h index 322096b90..4535d991a 100644 --- a/src/FiltersPlugin/FiltersPlugin.h +++ b/src/FiltersPlugin/FiltersPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERS_H @@ -22,13 +23,13 @@ #if defined FILTERS_EXPORTS #if defined WIN32 -#define FILTERS_EXPORT __declspec( dllexport ) +#define FILTERS_EXPORT __declspec(dllexport) #else #define FILTERS_EXPORT #endif #else #if defined WIN32 -#define FILTERS_EXPORT __declspec( dllimport ) +#define FILTERS_EXPORT __declspec(dllimport) #else #define FILTERS_EXPORT #endif diff --git a/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp b/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp index 244c92332..2f466d29a 100644 --- a/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp +++ b/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_BelongsTo.h" #include -bool FiltersPlugin_BelongsTo::isSupported(GeomAPI_Shape::ShapeType /*theType*/) const -{ +bool FiltersPlugin_BelongsTo::isSupported( + GeomAPI_Shape::ShapeType /*theType*/) const { return true; } -bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr &theShape, + const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr aAttr = theArgs.argument("BelongsTo"); AttributeSelectionListPtr aList = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; for (int i = 0; i < aList->size(); i++) { @@ -43,12 +44,12 @@ bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape, const ResultPtr return false; } -std::string FiltersPlugin_BelongsTo::xmlRepresentation() const -{ +std::string FiltersPlugin_BelongsTo::xmlRepresentation() const { return xmlFromFile("filter-BelongsTo.xml"); } -void FiltersPlugin_BelongsTo::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("BelongsTo", ModelAPI_AttributeSelectionList::typeId()); +void FiltersPlugin_BelongsTo::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("BelongsTo", + ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_BelongsTo.h b/src/FiltersPlugin/FiltersPlugin_BelongsTo.h index 3e29050fd..322d32bc7 100644 --- a/src/FiltersPlugin/FiltersPlugin_BelongsTo.h +++ b/src/FiltersPlugin/FiltersPlugin_BelongsTo.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_BELONGSTO_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_BelongsTo -* \ingroup DataModel -* \brief Filter for objects which are part of specified objects -*/ -class FiltersPlugin_BelongsTo : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for objects which are part of specified objects + */ +class FiltersPlugin_BelongsTo : public ModelAPI_Filter { public: FiltersPlugin_BelongsTo() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Belongs to"); return kName; } @@ -41,18 +41,17 @@ public: /// Returns true for any type because it supports all selection types virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp index 1615dfdb9..318fab8dc 100644 --- a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp +++ b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_ContinuousFaces.h" -#include -#include #include +#include +#include #include #include @@ -31,15 +32,16 @@ #include +#include #include #include -#include -typedef std::map MapShapeAndAncestors; +typedef std::map + MapShapeAndAncestors; //================================================================================================= -static void mapEdgesAndFaces(const GeomShapePtr theShape, MapShapeAndAncestors& theMap) -{ +static void mapEdgesAndFaces(const GeomShapePtr theShape, + MapShapeAndAncestors &theMap) { GeomAPI_ShapeExplorer aFExp(theShape, GeomAPI_Shape::FACE); for (; aFExp.more(); aFExp.next()) { GeomShapePtr aFace = aFExp.current(); @@ -52,14 +54,12 @@ static void mapEdgesAndFaces(const GeomShapePtr theShape, MapShapeAndAncestors& //================================================================================================= // Find all continuous faces for the given. static void cacheContinuousFace(const GeomShapePtr theFace, - const MapShapeAndAncestors& theEdgeToFaces, - SetOfShapes& theCache, - const double & theAngle) -{ + const MapShapeAndAncestors &theEdgeToFaces, + SetOfShapes &theCache, const double &theAngle) { MapShapeAndAncestors::const_iterator aFound; GeomAPI_ShapeExplorer aEExp(theFace, GeomAPI_Shape::EDGE); - for (; aEExp.more(); aEExp.next()){ + for (; aEExp.more(); aEExp.next()) { aFound = theEdgeToFaces.find(aEExp.current()); if (aFound == theEdgeToFaces.end()) continue; @@ -68,15 +68,12 @@ static void cacheContinuousFace(const GeomShapePtr theFace, anEdge = GeomEdgePtr(new GeomAPI_Edge(aEExp.current())); for (SetOfShapes::const_iterator aFIt = aFound->second.begin(); - aFIt != aFound->second.end(); ++aFIt) { + aFIt != aFound->second.end(); ++aFIt) { std::string anError = ""; if (theCache.find(*aFIt) == theCache.end()) { - GeomPointPtr aPoint = anEdge->middlePoint(); - if (GeomAlgoAPI_ShapeTools::isContinuousFaces(theFace, - *aFIt, - aPoint, - theAngle, - anError)) { + GeomPointPtr aPoint = anEdge->middlePoint(); + if (GeomAlgoAPI_ShapeTools::isContinuousFaces(theFace, *aFIt, aPoint, + theAngle, anError)) { theCache.insert(*aFIt); cacheContinuousFace(*aFIt, theEdgeToFaces, theCache, theAngle); } @@ -87,10 +84,9 @@ static void cacheContinuousFace(const GeomShapePtr theFace, //================================================================================================= static void cacheContinuousFaces(const GeomShapePtr theTopLevelShape, - const SetOfShapes& theFaces, - SetOfShapes& theCache, - const double & theAngle) -{ + const SetOfShapes &theFaces, + SetOfShapes &theCache, + const double &theAngle) { if (!theTopLevelShape || theFaces.empty()) return; @@ -102,14 +98,13 @@ static void cacheContinuousFaces(const GeomShapePtr theTopLevelShape, // keep the original face theCache.insert(*aFIt); // cache continuous face - cacheContinuousFace(*aFIt, anEdgesToFaces, theCache,theAngle); + cacheContinuousFace(*aFIt, anEdgesToFaces, theCache, theAngle); } } //================================================================================================= -static bool updateFaces(const AttributeSelectionListPtr& theList, - SetOfShapes& theFaces) -{ +static bool updateFaces(const AttributeSelectionListPtr &theList, + SetOfShapes &theFaces) { bool aNewCache = false; if ((int)theFaces.size() != theList->size()) { aNewCache = true; @@ -135,61 +130,65 @@ static bool updateFaces(const AttributeSelectionListPtr& theList, } //================================================================================================= -bool FiltersPlugin_ContinuousFaces::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_ContinuousFaces::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::FACE; } //================================================================================================= -bool FiltersPlugin_ContinuousFaces::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_ContinuousFaces::isOk( + const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr aAttr = theArgs.argument("faces"); AttributeSelectionListPtr aList = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; AttributePtr anAttr = theArgs.argument("value"); - AttributeDoublePtr aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized()) + AttributeDoublePtr aValue = + std::dynamic_pointer_cast(anAttr); + if (!aValue.get() || !anAttr->isInitialized()) return false; - double anAngle= aValue->value(); + double anAngle = aValue->value(); - bool aNewCache = updateFaces(aList, - const_cast(this)->myFaces); + bool aNewCache = updateFaces( + aList, const_cast(this)->myFaces); - if (aNewCache || fabs(myAngle - anAngle) > 1e-10 ) { - const_cast(this)->myAngle = anAngle; - const_cast(this)->myCachedShapes.clear(); + if (aNewCache || fabs(myAngle - anAngle) > 1e-10) { + const_cast(this)->myAngle = anAngle; + const_cast(this)->myCachedShapes.clear(); } if (myCachedShapes.empty()) { - for (int i = 0; i < aList->size(); i++) - { - ResultBodyPtr aBaseResult = ModelAPI_Tools::bodyOwner(aList->value(i)->context(), true); + for (int i = 0; i < aList->size(); i++) { + ResultBodyPtr aBaseResult = + ModelAPI_Tools::bodyOwner(aList->value(i)->context(), true); if (!aBaseResult.get()) { - aBaseResult = std::dynamic_pointer_cast(aList->value(i)->context()); + aBaseResult = std::dynamic_pointer_cast( + aList->value(i)->context()); if (!aBaseResult.get()) return false; } - cacheContinuousFaces(aBaseResult->shape(), - const_cast(this)->myFaces, - const_cast(this)->myCachedShapes,anAngle); + cacheContinuousFaces( + aBaseResult->shape(), + const_cast(this)->myFaces, + const_cast(this)->myCachedShapes, + anAngle); } } return myCachedShapes.find(theShape) != myCachedShapes.end(); } //================================================================================================= -std::string FiltersPlugin_ContinuousFaces::xmlRepresentation() const -{ +std::string FiltersPlugin_ContinuousFaces::xmlRepresentation() const { return xmlFromFile("filter-ContinuousFaces.xml"); } //================================================================================================= -void FiltersPlugin_ContinuousFaces::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ +void FiltersPlugin_ContinuousFaces::initAttributes( + ModelAPI_FiltersArgs &theArguments) { theArguments.initAttribute("value", ModelAPI_AttributeDouble::typeId()); - theArguments.initAttribute("faces", ModelAPI_AttributeSelectionList::typeId()); + theArguments.initAttribute("faces", + ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h index eb646e466..50bbb3adf 100644 --- a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h +++ b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_CONTINUOUSFACES_H_ @@ -30,17 +31,14 @@ typedef std::set SetOfShapes; /**\class FiltersPlugin_ContinuousFaces -* \ingroup DataModel -* \brief Filter for face with specific area -*/ -class FiltersPlugin_ContinuousFaces : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for face with specific area + */ +class FiltersPlugin_ContinuousFaces : public ModelAPI_Filter { public: - FiltersPlugin_ContinuousFaces() : ModelAPI_Filter() { - myAngle = 0.0; - } + FiltersPlugin_ContinuousFaces() : ModelAPI_Filter() { myAngle = 0.0; } - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Continuous faces"); return kName; } @@ -48,26 +46,25 @@ public: /// Returns true for face type virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; - private: - /// Original faces selected for filtering - SetOfShapes myFaces; - /// Shapes applicable for the filter - SetOfShapes myCachedShapes; - /// Angle tolerance - double myAngle; +private: + /// Original faces selected for filtering + SetOfShapes myFaces; + /// Shapes applicable for the filter + SetOfShapes myCachedShapes; + /// Angle tolerance + double myAngle; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_EdgeSize.cpp b/src/FiltersPlugin/FiltersPlugin_EdgeSize.cpp index 0e01c8707..d0d316d8c 100644 --- a/src/FiltersPlugin/FiltersPlugin_EdgeSize.cpp +++ b/src/FiltersPlugin/FiltersPlugin_EdgeSize.cpp @@ -14,13 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_EdgeSize.h" -#include #include +#include #include #include @@ -32,28 +33,29 @@ #include -#include #include +#include //================================================================================================= -bool FiltersPlugin_EdgeSize::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_EdgeSize::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::EDGE; } //================================================================================================= -bool FiltersPlugin_EdgeSize::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_EdgeSize::isOk(const GeomShapePtr &theShape, + const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr anAttr = theArgs.argument("value"); - AttributeDoublePtr aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized() ) + AttributeDoublePtr aValue = + std::dynamic_pointer_cast(anAttr); + if (!aValue.get() || !anAttr->isInitialized()) return false; double aVal = aValue->value(); anAttr = theArgs.argument("valueMax"); aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized() ) + if (!aValue.get() || !anAttr->isInitialized()) return false; double aValMax = aValue->value(); @@ -76,7 +78,8 @@ bool FiltersPlugin_EdgeSize::isOk(const GeomShapePtr& theShape, const ResultPtr& double aLength = anEdge->length(); anAttr = theArgs.argument("comparatorType"); - AttributeStringPtr aCompAttr = std::dynamic_pointer_cast(anAttr); + AttributeStringPtr aCompAttr = + std::dynamic_pointer_cast(anAttr); if (!aCompAttr) return false; std::string aCompString = aCompAttr->value(); @@ -91,26 +94,24 @@ bool FiltersPlugin_EdgeSize::isOk(const GeomShapePtr& theShape, const ResultPtr& else if (aCompString == "supEq") isOK = aLength > aVal - Precision::Confusion(); else if (aCompString == "isBetween") - isOK = aVal <= aValMax - && aLength > aVal - Precision::Confusion() - && aLength < aValMax + Precision::Confusion(); + isOK = aVal <= aValMax && aLength > aVal - Precision::Confusion() && + aLength < aValMax + Precision::Confusion(); else if (aCompString == "isStrictlyBetween") - isOK = aVal <= aValMax - && aLength > aVal + Precision::Confusion() - && aLength < aValMax - Precision::Confusion(); + isOK = aVal <= aValMax && aLength > aVal + Precision::Confusion() && + aLength < aValMax - Precision::Confusion(); return isOK; } //================================================================================================= -std::string FiltersPlugin_EdgeSize::xmlRepresentation() const -{ +std::string FiltersPlugin_EdgeSize::xmlRepresentation() const { return xmlFromFile("filter-EdgeSize.xml"); } //================================================================================================= -void FiltersPlugin_EdgeSize::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("comparatorType", ModelAPI_AttributeString::typeId()); +void FiltersPlugin_EdgeSize::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("comparatorType", + ModelAPI_AttributeString::typeId()); theArguments.initAttribute("value", ModelAPI_AttributeDouble::typeId()); theArguments.initAttribute("valueMax", ModelAPI_AttributeDouble::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_EdgeSize.h b/src/FiltersPlugin/FiltersPlugin_EdgeSize.h index af0a39a73..14cb8b4aa 100644 --- a/src/FiltersPlugin/FiltersPlugin_EdgeSize.h +++ b/src/FiltersPlugin/FiltersPlugin_EdgeSize.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_EDGESIZE_H_ @@ -26,15 +27,14 @@ #include /**\class FiltersPlugin_EdgeSize -* \ingroup DataModel -* \brief Filter for edges with specific size -*/ -class FiltersPlugin_EdgeSize : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for edges with specific size + */ +class FiltersPlugin_EdgeSize : public ModelAPI_Filter { public: FiltersPlugin_EdgeSize() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Edge size"); return kName; } @@ -42,19 +42,17 @@ public: /// Returns true for edge type virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; - + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_ExternalFaces.cpp b/src/FiltersPlugin/FiltersPlugin_ExternalFaces.cpp index e1e135708..73f93daca 100644 --- a/src/FiltersPlugin/FiltersPlugin_ExternalFaces.cpp +++ b/src/FiltersPlugin/FiltersPlugin_ExternalFaces.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_ExternalFaces.h" @@ -24,15 +25,14 @@ #include #include -bool FiltersPlugin_ExternalFaces::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_ExternalFaces::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::FACE; } -bool FiltersPlugin_ExternalFaces::isOk(const GeomShapePtr& theShape, - const ResultPtr& theResult, - const ModelAPI_FiltersArgs& /*theArgs*/) const -{ +bool FiltersPlugin_ExternalFaces::isOk( + const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs & /*theArgs*/) const { if (!theShape->isFace()) return false; @@ -53,6 +53,6 @@ bool FiltersPlugin_ExternalFaces::isOk(const GeomShapePtr& theShape, TopTools_IndexedDataMapOfShapeListOfShape aMapFS; TopExp::MapShapesAndUniqueAncestors(anOwnerShape->impl(), TopAbs_FACE, TopAbs_SOLID, aMapFS); - const TopTools_ListOfShape& aSolids = aMapFS.FindFromKey(aShape); + const TopTools_ListOfShape &aSolids = aMapFS.FindFromKey(aShape); return aSolids.Extent() <= 1; } diff --git a/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h b/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h index 84ba91cee..af6399cf9 100644 --- a/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h +++ b/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_EXTERNALFACES_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_ExternalFaces -* \ingroup DataModel -* \brief Filter for faces not shared between solids in compsolid. -*/ -class FiltersPlugin_ExternalFaces : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for faces not shared between solids in compsolid. + */ +class FiltersPlugin_ExternalFaces : public ModelAPI_Filter { public: FiltersPlugin_ExternalFaces() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("External faces"); return kName; } @@ -41,14 +41,12 @@ public: /// Returns true for any type because it supports all selection types virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theResult parent result of the shape to be checked - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, - const ResultPtr& theResult, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theResult parent result of the shape to be checked \param theArgs + /// arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_FaceSize.cpp b/src/FiltersPlugin/FiltersPlugin_FaceSize.cpp index 30dfa3b00..66ad82dfc 100644 --- a/src/FiltersPlugin/FiltersPlugin_FaceSize.cpp +++ b/src/FiltersPlugin/FiltersPlugin_FaceSize.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_FaceSize.h" -#include -#include #include +#include +#include #include #include @@ -30,28 +31,29 @@ #include -#include #include +#include //================================================================================================= -bool FiltersPlugin_FaceSize::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_FaceSize::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::FACE; } //================================================================================================= -bool FiltersPlugin_FaceSize::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_FaceSize::isOk(const GeomShapePtr &theShape, + const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr anAttr = theArgs.argument("value"); - AttributeDoublePtr aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized() ) + AttributeDoublePtr aValue = + std::dynamic_pointer_cast(anAttr); + if (!aValue.get() || !anAttr->isInitialized()) return false; double aVal = aValue->value(); anAttr = theArgs.argument("valueMax"); aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized() ) + if (!aValue.get() || !anAttr->isInitialized()) return false; double aValMax = aValue->value(); @@ -61,7 +63,8 @@ bool FiltersPlugin_FaceSize::isOk(const GeomShapePtr& theShape, const ResultPtr& double aSurfArea = GeomAlgoAPI_ShapeTools::area(theShape); anAttr = theArgs.argument("comparatorType"); - AttributeStringPtr aCompAttr = std::dynamic_pointer_cast(anAttr); + AttributeStringPtr aCompAttr = + std::dynamic_pointer_cast(anAttr); if (!aCompAttr) return false; std::string aCompString = aCompAttr->value(); @@ -76,26 +79,24 @@ bool FiltersPlugin_FaceSize::isOk(const GeomShapePtr& theShape, const ResultPtr& else if (aCompString == "supEq") isOK = aSurfArea > aVal - Precision::Confusion(); else if (aCompString == "isBetween") - isOK = aVal <= aValMax - && aSurfArea > aVal - Precision::Confusion() - && aSurfArea < aValMax + Precision::Confusion(); + isOK = aVal <= aValMax && aSurfArea > aVal - Precision::Confusion() && + aSurfArea < aValMax + Precision::Confusion(); else if (aCompString == "isStrictlyBetween") - isOK = aVal <= aValMax - && aSurfArea > aVal + Precision::Confusion() - && aSurfArea < aValMax - Precision::Confusion(); + isOK = aVal <= aValMax && aSurfArea > aVal + Precision::Confusion() && + aSurfArea < aValMax - Precision::Confusion(); return isOK; } //================================================================================================= -std::string FiltersPlugin_FaceSize::xmlRepresentation() const -{ +std::string FiltersPlugin_FaceSize::xmlRepresentation() const { return xmlFromFile("filter-FaceSize.xml"); } //================================================================================================= -void FiltersPlugin_FaceSize::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("comparatorType", ModelAPI_AttributeString::typeId()); +void FiltersPlugin_FaceSize::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("comparatorType", + ModelAPI_AttributeString::typeId()); theArguments.initAttribute("value", ModelAPI_AttributeDouble::typeId()); theArguments.initAttribute("valueMax", ModelAPI_AttributeDouble::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_FaceSize.h b/src/FiltersPlugin/FiltersPlugin_FaceSize.h index 19f56a003..6911d15a9 100644 --- a/src/FiltersPlugin/FiltersPlugin_FaceSize.h +++ b/src/FiltersPlugin/FiltersPlugin_FaceSize.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_FACESIZE_H_ @@ -25,17 +26,15 @@ #include #include - /**\class FiltersPlugin_FaceSize -* \ingroup DataModel -* \brief Filter for face with specific area -*/ -class FiltersPlugin_FaceSize : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for face with specific area + */ +class FiltersPlugin_FaceSize : public ModelAPI_Filter { public: FiltersPlugin_FaceSize() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Face size"); return kName; } @@ -43,19 +42,17 @@ public: /// Returns true for face type virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; - + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp index 569f3fd9e..ffd6807d1 100644 --- a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp +++ b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp @@ -14,13 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_FeatureEdges.h" -#include #include +#include #include #include @@ -33,15 +34,16 @@ #include +#include #include #include -#include -typedef std::map MapShapeAndAncestors; +typedef std::map + MapShapeAndAncestors; //================================================================================================= -static void mapEdgesAndFaces(const GeomShapePtr theShape, MapShapeAndAncestors& theMap) -{ +static void mapEdgesAndFaces(const GeomShapePtr theShape, + MapShapeAndAncestors &theMap) { GeomAPI_ShapeExplorer aFExp(theShape, GeomAPI_Shape::FACE); for (; aFExp.more(); aFExp.next()) { GeomShapePtr aFace = aFExp.current(); @@ -53,9 +55,7 @@ static void mapEdgesAndFaces(const GeomShapePtr theShape, MapShapeAndAncestors& //================================================================================================= static void cacheFeatureEdge(const GeomShapePtr theTopLevelShape, - SetOfShapes& theCache, - const double & theAngle) -{ + SetOfShapes &theCache, const double &theAngle) { if (!theTopLevelShape) return; @@ -71,15 +71,12 @@ static void cacheFeatureEdge(const GeomShapePtr theTopLevelShape, aFIt != aIt->second.end(); ++aFIt) { SetOfShapes::const_iterator aFIt2 = aFIt; ++aFIt2; - for (;aFIt2 != aIt->second.end(); ++aFIt2) { + for (; aFIt2 != aIt->second.end(); ++aFIt2) { std::string anError; if (theCache.find(*aFIt) == theCache.end()) { - if (theAngle < Precision::Confusion() - || !GeomAlgoAPI_ShapeTools::isContinuousFaces(*aFIt, - *aFIt2, - anEdge->middlePoint(), - theAngle, - anError)) { + if (theAngle < Precision::Confusion() || + !GeomAlgoAPI_ShapeTools::isContinuousFaces( + *aFIt, *aFIt2, anEdge->middlePoint(), theAngle, anError)) { if (anError.empty()) theCache.insert(anEdge); } @@ -90,17 +87,18 @@ static void cacheFeatureEdge(const GeomShapePtr theTopLevelShape, } //================================================================================================= -bool FiltersPlugin_FeatureEdges::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_FeatureEdges::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::EDGE; } //================================================================================================= -bool FiltersPlugin_FeatureEdges::isOk(const GeomShapePtr& theShape, const ResultPtr& theResult, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_FeatureEdges::isOk( + const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr anAttr = theArgs.argument("value"); - AttributeDoublePtr aValue = std::dynamic_pointer_cast(anAttr); + AttributeDoublePtr aValue = + std::dynamic_pointer_cast(anAttr); if (!aValue.get() || !anAttr->isInitialized()) return false; @@ -114,31 +112,32 @@ bool FiltersPlugin_FeatureEdges::isOk(const GeomShapePtr& theShape, const Result return false; } } - if (fabs(myAngle - anAngle) > 1e-10 - || !myBaseShape - || !myBaseShape->isSame(aBaseResult->shape())) { - const_cast(this)->myAngle = anAngle; - const_cast(this)->myBaseShape = aBaseResult->shape(); - const_cast(this)->myCachedShapes.clear(); + if (fabs(myAngle - anAngle) > 1e-10 || !myBaseShape || + !myBaseShape->isSame(aBaseResult->shape())) { + const_cast(this)->myAngle = anAngle; + const_cast(this)->myBaseShape = + aBaseResult->shape(); + const_cast(this)->myCachedShapes.clear(); } if (myCachedShapes.empty()) { - cacheFeatureEdge(aBaseResult->shape(), - const_cast(this)->myCachedShapes, anAngle); + cacheFeatureEdge( + aBaseResult->shape(), + const_cast(this)->myCachedShapes, + anAngle); } return myCachedShapes.find(theShape) != myCachedShapes.end(); } //================================================================================================= -std::string FiltersPlugin_FeatureEdges::xmlRepresentation() const -{ +std::string FiltersPlugin_FeatureEdges::xmlRepresentation() const { return xmlFromFile("filter-FeatureEdges.xml"); } //================================================================================================= -void FiltersPlugin_FeatureEdges::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ +void FiltersPlugin_FeatureEdges::initAttributes( + ModelAPI_FiltersArgs &theArguments) { theArguments.initAttribute("value", ModelAPI_AttributeDouble::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h index ba3972775..8d7453fab 100644 --- a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h +++ b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_FEATUREEDGES_H_ @@ -30,17 +31,14 @@ typedef std::set SetOfShapes; /**\class FiltersPlugin_FeatureEdges -* \ingroup DataModel -* \brief Filter for edges with feature angle -*/ -class FiltersPlugin_FeatureEdges : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for edges with feature angle + */ +class FiltersPlugin_FeatureEdges : public ModelAPI_Filter { public: - FiltersPlugin_FeatureEdges() : ModelAPI_Filter() { - myAngle = 0.0; - } + FiltersPlugin_FeatureEdges() : ModelAPI_Filter() { myAngle = 0.0; } - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Feature edges"); return kName; } @@ -48,26 +46,25 @@ public: /// Returns true for edge type virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; - private: - /// Shapes applicable for the filter - SetOfShapes myCachedShapes; - /// Angle tolerance - double myAngle; - /// the base shape - GeomShapePtr myBaseShape; +private: + /// Shapes applicable for the filter + SetOfShapes myCachedShapes; + /// Angle tolerance + double myAngle; + /// the base shape + GeomShapePtr myBaseShape; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_HorizontalFace.cpp b/src/FiltersPlugin/FiltersPlugin_HorizontalFace.cpp index 273bc6e2f..d2d1a7000 100644 --- a/src/FiltersPlugin/FiltersPlugin_HorizontalFace.cpp +++ b/src/FiltersPlugin/FiltersPlugin_HorizontalFace.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_HorizontalFace.h" @@ -22,19 +23,19 @@ #include #include -bool FiltersPlugin_HorizontalFace::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_HorizontalFace::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::FACE; } -bool FiltersPlugin_HorizontalFace::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& /*theArgs*/) const -{ +bool FiltersPlugin_HorizontalFace::isOk( + const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs & /*theArgs*/) const { if (!theShape->isFace() || !theShape->isPlanar()) return false; GeomFacePtr aFace(new GeomAPI_Face(theShape)); GeomPlanePtr aPlane = aFace->getPlane(); GeomDirPtr aDir = aPlane->direction(); - return aDir->isParallel(GeomDirPtr(new GeomAPI_Dir(0,0,1))); + return aDir->isParallel(GeomDirPtr(new GeomAPI_Dir(0, 0, 1))); } diff --git a/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h b/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h index a915a11bb..df3172cb2 100644 --- a/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h +++ b/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_HORIZONTALPLANE_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_HorizontalFace -* \ingroup DataModel -* \brief Filter for horizontal faces only -*/ -class FiltersPlugin_HorizontalFace : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for horizontal faces only + */ +class FiltersPlugin_HorizontalFace : public ModelAPI_Filter { public: FiltersPlugin_HorizontalFace() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Horizontal faces"); return kName; } @@ -41,12 +41,11 @@ public: /// Returns true if the given shape type is supported virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp b/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp index 2f49e3817..8c740b593 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_OnGeometry.h" #include -bool FiltersPlugin_OnGeometry::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_OnGeometry::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::EDGE || theType == GeomAPI_Shape::FACE; } -bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr &theShape, + const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr aAttr = theArgs.argument("OnGeometry"); AttributeSelectionListPtr aList = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; for (int i = 0; i < aList->size(); i++) { @@ -45,12 +46,12 @@ bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr& theShape, const ResultPt return false; } -std::string FiltersPlugin_OnGeometry::xmlRepresentation() const -{ +std::string FiltersPlugin_OnGeometry::xmlRepresentation() const { return xmlFromFile("filter-OnGeometry.xml"); } -void FiltersPlugin_OnGeometry::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("OnGeometry", ModelAPI_AttributeSelectionList::typeId()); +void FiltersPlugin_OnGeometry::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("OnGeometry", + ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_OnGeometry.h b/src/FiltersPlugin/FiltersPlugin_OnGeometry.h index e65412ba7..844e6ec57 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnGeometry.h +++ b/src/FiltersPlugin/FiltersPlugin_OnGeometry.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_ONGEOMETRY_H_ @@ -26,14 +27,14 @@ /**\class FiltersPlugin_OnGeometry * \ingroup DataModel - * \brief Filter for objects which have the same underlying geometry as specified objects + * \brief Filter for objects which have the same underlying geometry as + * specified objects */ -class FiltersPlugin_OnGeometry : public ModelAPI_Filter -{ +class FiltersPlugin_OnGeometry : public ModelAPI_Filter { public: FiltersPlugin_OnGeometry() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("On geometry"); return kName; } @@ -41,18 +42,17 @@ public: /// Returns true for any type because it supports all selection types virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnLine.cpp b/src/FiltersPlugin/FiltersPlugin_OnLine.cpp index 9060fe6b7..e906767d1 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnLine.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnLine.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_OnLine.h" @@ -26,10 +27,8 @@ #include #include - -static void convertToLines(const AttributeSelectionListPtr& theSelected, - std::list& theLines) -{ +static void convertToLines(const AttributeSelectionListPtr &theSelected, + std::list &theLines) { for (int i = 0; i < theSelected->size(); i++) { AttributeSelectionPtr aSel = theSelected->value(i); GeomShapePtr aCurShape = aSel->value(); @@ -43,18 +42,15 @@ static void convertToLines(const AttributeSelectionListPtr& theSelected, } } - -bool FiltersPlugin_OnLine::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_OnLine::isSupported(GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::EDGE || theType == GeomAPI_Shape::VERTEX; } -bool FiltersPlugin_OnLine::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_OnLine::isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr aAttr = theArgs.argument("OnLine"); AttributeSelectionListPtr aList = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; // convert selected shapes to lines @@ -63,17 +59,18 @@ bool FiltersPlugin_OnLine::isOk(const GeomShapePtr& theShape, const ResultPtr&, if (theShape->isVertex()) { GeomPointPtr aPnt = theShape->vertex()->point(); - for (std::list::iterator anIt = aLines.begin(); anIt != aLines.end(); ++anIt) { + for (std::list::iterator anIt = aLines.begin(); + anIt != aLines.end(); ++anIt) { if ((*anIt)->contains(aPnt)) return true; } - } - else if (theShape->isEdge()) { + } else if (theShape->isEdge()) { GeomEdgePtr aEdge(new GeomAPI_Edge(theShape)); if (aEdge->isLine()) { GeomPointPtr aPnt1 = aEdge->firstPoint(); GeomPointPtr aPnt2 = aEdge->lastPoint(); - for (std::list::iterator anIt = aLines.begin(); anIt != aLines.end(); ++anIt) { + for (std::list::iterator anIt = aLines.begin(); + anIt != aLines.end(); ++anIt) { if ((*anIt)->contains(aPnt1) && (*anIt)->contains(aPnt2)) return true; } @@ -82,12 +79,11 @@ bool FiltersPlugin_OnLine::isOk(const GeomShapePtr& theShape, const ResultPtr&, return false; } -std::string FiltersPlugin_OnLine::xmlRepresentation() const -{ +std::string FiltersPlugin_OnLine::xmlRepresentation() const { return xmlFromFile("filter-OnLine.xml"); } -void FiltersPlugin_OnLine::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("OnLine", ModelAPI_AttributeSelectionList::typeId()); +void FiltersPlugin_OnLine::initAttributes(ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("OnLine", + ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_OnLine.h b/src/FiltersPlugin/FiltersPlugin_OnLine.h index bbf3d37b3..492409a63 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnLine.h +++ b/src/FiltersPlugin/FiltersPlugin_OnLine.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_ONLINE_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_OnLine -* \ingroup DataModel -* \brief Filter for objects which belong to selected lines -*/ -class FiltersPlugin_OnLine : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for objects which belong to selected lines + */ +class FiltersPlugin_OnLine : public ModelAPI_Filter { public: FiltersPlugin_OnLine() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("On line"); return kName; } @@ -44,18 +44,17 @@ public: /// Returns True if the filter can be used several times within one selection virtual bool isMultiple() const { return true; } - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp b/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp index 5ecd2c883..c38fc684f 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp @@ -14,26 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_OnPlane.h" -#include -#include -#include -#include -#include -#include -#include #include +#include #include - +#include +#include +#include +#include +#include +#include #define LIN_TOLERANCE 1.e-7 -bool FiltersPlugin_OnPlane::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_OnPlane::isSupported( + GeomAPI_Shape::ShapeType theType) const { switch (theType) { case GeomAPI_Shape::SHELL: case GeomAPI_Shape::FACE: @@ -47,22 +47,21 @@ bool FiltersPlugin_OnPlane::isSupported(GeomAPI_Shape::ShapeType theType) const return false; } -GeomPlanePtr getPlane(AttributeSelectionPtr theAttr) -{ +GeomPlanePtr getPlane(AttributeSelectionPtr theAttr) { GeomShapePtr aGeom = theAttr->value(); - if (!aGeom.get()) { // construction plane, #2942 + if (!aGeom.get()) { // construction plane, #2942 aGeom = theAttr->context()->shape(); } GeomFacePtr aFace(new GeomAPI_Face(aGeom)); return aFace->getPlane(); } -bool FiltersPlugin_OnPlane::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_OnPlane::isOk(const GeomShapePtr &theShape, + const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr aAttr = theArgs.argument("OnPlane"); AttributeSelectionListPtr aList = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; if (theShape->isVertex()) { @@ -73,27 +72,25 @@ bool FiltersPlugin_OnPlane::isOk(const GeomShapePtr& theShape, const ResultPtr&, if (aPlane->distance(aPnt) < LIN_TOLERANCE) return true; } - } - else if (theShape->isEdge()) { + } else if (theShape->isEdge()) { GeomEdgePtr aEdge(new GeomAPI_Edge(theShape)); if (aEdge->isLine()) { GeomPointPtr aPnt1 = aEdge->firstPoint(); GeomPointPtr aPnt2 = aEdge->lastPoint(); for (int i = 0; i < aList->size(); i++) { GeomPlanePtr aPlane = getPlane(aList->value(i)); - if ((aPlane->distance(aPnt1) < LIN_TOLERANCE) && (aPlane->distance(aPnt2) < LIN_TOLERANCE)) + if ((aPlane->distance(aPnt1) < LIN_TOLERANCE) && + (aPlane->distance(aPnt2) < LIN_TOLERANCE)) return true; } - } - else if (aEdge->isPlanar()) { + } else if (aEdge->isPlanar()) { for (int i = 0; i < aList->size(); i++) { GeomPlanePtr aPlane = getPlane(aList->value(i)); if (aEdge->isInPlane(aPlane)) return true; } } - } - else if (theShape->isFace()) { + } else if (theShape->isFace()) { GeomFacePtr aFace(new GeomAPI_Face(theShape)); if (aFace->isPlanar()) { GeomPlanePtr aPln = aFace->getPlane(); @@ -108,12 +105,11 @@ bool FiltersPlugin_OnPlane::isOk(const GeomShapePtr& theShape, const ResultPtr&, return false; } -std::string FiltersPlugin_OnPlane::xmlRepresentation() const -{ +std::string FiltersPlugin_OnPlane::xmlRepresentation() const { return xmlFromFile("filter-OnPlane.xml"); } -void FiltersPlugin_OnPlane::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("OnPlane", ModelAPI_AttributeSelectionList::typeId()); +void FiltersPlugin_OnPlane::initAttributes(ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("OnPlane", + ModelAPI_AttributeSelectionList::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlane.h b/src/FiltersPlugin/FiltersPlugin_OnPlane.h index a8c2c4bab..f15abaca6 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlane.h +++ b/src/FiltersPlugin/FiltersPlugin_OnPlane.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_ONPLANE_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_OnPlane -* \ingroup DataModel -* \brief Filter for objects which belong to selected planes -*/ -class FiltersPlugin_OnPlane : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for objects which belong to selected planes + */ +class FiltersPlugin_OnPlane : public ModelAPI_Filter { public: FiltersPlugin_OnPlane() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("On plane"); return kName; } @@ -44,18 +44,17 @@ public: /// Returns True if the filter can be used several times within one selection virtual bool isMultiple() const { return true; } - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.cpp b/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.cpp index f786a15d6..8251f366e 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_OnPlaneSide.h" @@ -26,19 +27,19 @@ #include #include - -bool FiltersPlugin_OnPlaneSide::isSupported(GeomAPI_Shape::ShapeType /*theType*/) const -{ +bool FiltersPlugin_OnPlaneSide::isSupported( + GeomAPI_Shape::ShapeType /*theType*/) const { return true; } -bool FiltersPlugin_OnPlaneSide::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_OnPlaneSide::isOk( + const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { static const double THE_TOLERANCE = 1.e-7; AttributePtr aAttr = theArgs.argument("OnPlaneSide"); - AttributeSelectionPtr aList = std::dynamic_pointer_cast(aAttr); + AttributeSelectionPtr aList = + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; GeomShapePtr aPlanarShape = aList->value(); @@ -59,12 +60,12 @@ bool FiltersPlugin_OnPlaneSide::isOk(const GeomShapePtr& theShape, const ResultP return aVec->dot(aPlaneNorm->xyz()) > THE_TOLERANCE; } -std::string FiltersPlugin_OnPlaneSide::xmlRepresentation() const -{ +std::string FiltersPlugin_OnPlaneSide::xmlRepresentation() const { return xmlFromFile("filter-OnPlaneSide.xml"); } -void FiltersPlugin_OnPlaneSide::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("OnPlaneSide", ModelAPI_AttributeSelection::typeId()); +void FiltersPlugin_OnPlaneSide::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("OnPlaneSide", + ModelAPI_AttributeSelection::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h b/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h index 26cea1182..9aaea2017 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h +++ b/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_ONPLANESIDE_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_OnPlaneSide -* \ingroup DataModel -* \brief Filter for objects which lying on the side of selected plane -*/ -class FiltersPlugin_OnPlaneSide : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for objects which lying on the side of selected plane + */ +class FiltersPlugin_OnPlaneSide : public ModelAPI_Filter { public: FiltersPlugin_OnPlaneSide() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("On plane side"); return kName; } @@ -44,18 +44,17 @@ public: /// Returns True if the filter can be used several times within one selection virtual bool isMultiple() const { return true; } - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp b/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp index a01d9cb01..781caf85f 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_OnShapeName.h" @@ -24,36 +25,34 @@ #include #include - -bool FiltersPlugin_OnShapeName::isSupported(GeomAPI_Shape::ShapeType /*theType*/) const -{ +bool FiltersPlugin_OnShapeName::isSupported( + GeomAPI_Shape::ShapeType /*theType*/) const { return true; } //======================================================================= -bool FiltersPlugin_OnShapeName::isOk(const GeomShapePtr& theShape, const ResultPtr& theResult, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_OnShapeName::isOk( + const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const { if (!theResult) return false; AttributePtr anAttr = theArgs.argument("pattern"); - AttributeStringPtr aValue = std::dynamic_pointer_cast(anAttr); + AttributeStringPtr aValue = + std::dynamic_pointer_cast(anAttr); if (!aValue || !anAttr->isInitialized()) return false; std::regex aPattern(aValue->value()); - ResultBodyPtr aBodyRes = std::dynamic_pointer_cast(theResult); + ResultBodyPtr aBodyRes = + std::dynamic_pointer_cast(theResult); - for(; aBodyRes.get(); aBodyRes = ModelAPI_Tools::bodyOwner(aBodyRes)) - { + for (; aBodyRes.get(); aBodyRes = ModelAPI_Tools::bodyOwner(aBodyRes)) { const DataPtr data = aBodyRes->data(); - if (data.get()) - { + if (data.get()) { const std::string aResName = Locale::Convert::toString(data->name()); - if(std::regex_search(aResName, aPattern)) - { + if (std::regex_search(aResName, aPattern)) { return true; } } @@ -63,13 +62,12 @@ bool FiltersPlugin_OnShapeName::isOk(const GeomShapePtr& theShape, const ResultP } //======================================================================= -std::string FiltersPlugin_OnShapeName::xmlRepresentation() const -{ +std::string FiltersPlugin_OnShapeName::xmlRepresentation() const { return xmlFromFile("filter-OnShapeName.xml"); } //======================================================================= -void FiltersPlugin_OnShapeName::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ +void FiltersPlugin_OnShapeName::initAttributes( + ModelAPI_FiltersArgs &theArguments) { theArguments.initAttribute("pattern", ModelAPI_AttributeString::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_OnShapeName.h b/src/FiltersPlugin/FiltersPlugin_OnShapeName.h index 85556ae5b..ca1e96130 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnShapeName.h +++ b/src/FiltersPlugin/FiltersPlugin_OnShapeName.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_ONSHAPENAME_H_ @@ -25,35 +26,32 @@ #include /**\class FiltersPlugin_OnPlaneSide -* \ingroup DataModel -* \brief Filter for objects which lying on the side of selected plane -*/ -class FiltersPlugin_OnShapeName : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for objects which lying on the side of selected plane + */ +class FiltersPlugin_OnShapeName : public ModelAPI_Filter { public: - FiltersPlugin_OnShapeName() : ModelAPI_Filter() {} + FiltersPlugin_OnShapeName() : ModelAPI_Filter() {} - virtual const std::string& name() const - { - static const std::string kName("On shape name"); - return kName; - } + virtual const std::string &name() const { + static const std::string kName("On shape name"); + return kName; + } - /// Returns true for face type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + /// Returns true for face type + virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape,const ResultPtr& theResult, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const override; - /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + /// Returns XML string which represents GUI of the filter + virtual std::string xmlRepresentation() const override; - /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + /// Initializes arguments of a filter. + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp index 30117cdc9..1de71f2b5 100644 --- a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_OppositeToEdge.h" @@ -31,10 +32,11 @@ #include -typedef std::map MapShapeAndAncestors; +typedef std::map + MapShapeAndAncestors; -static void mapEdgesAndFaces(const GeomShapePtr theShape, MapShapeAndAncestors& theMap) -{ +static void mapEdgesAndFaces(const GeomShapePtr theShape, + MapShapeAndAncestors &theMap) { GeomAPI_ShapeExplorer aFExp(theShape, GeomAPI_Shape::FACE); for (; aFExp.more(); aFExp.next()) { GeomShapePtr aFace = aFExp.current(); @@ -47,8 +49,7 @@ static void mapEdgesAndFaces(const GeomShapePtr theShape, MapShapeAndAncestors& // Return edge in the quadratic face opposite to the given one. // If the face is not quadratic, returns empty shape. static GeomShapePtr oppositeEdgeInQuadFace(const GeomShapePtr theEdge, - const GeomShapePtr theFace) -{ + const GeomShapePtr theFace) { static int THE_QUAD = 4; int aNbEdges = 0; @@ -90,9 +91,8 @@ static GeomShapePtr oppositeEdgeInQuadFace(const GeomShapePtr theEdge, // Find all opposite edges for the given. static void cacheOppositeEdge(const GeomShapePtr theEdge, - const MapShapeAndAncestors& theEdgeToFaces, - SetOfShapes& theCache) -{ + const MapShapeAndAncestors &theEdgeToFaces, + SetOfShapes &theCache) { MapShapeAndAncestors::const_iterator aFound = theEdgeToFaces.find(theEdge); if (aFound == theEdgeToFaces.end()) return; @@ -109,8 +109,7 @@ static void cacheOppositeEdge(const GeomShapePtr theEdge, static void cacheOppositeEdges(const GeomShapePtr theTopLevelShape, const GeomShapePtr theEdge, - SetOfShapes& theCache) -{ + SetOfShapes &theCache) { if (!theTopLevelShape || !theEdge) return; @@ -123,47 +122,50 @@ static void cacheOppositeEdges(const GeomShapePtr theTopLevelShape, cacheOppositeEdge(theEdge, anEdgesToFaces, theCache); } - -bool FiltersPlugin_OppositeToEdge::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_OppositeToEdge::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::EDGE; } -bool FiltersPlugin_OppositeToEdge::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_OppositeToEdge::isOk( + const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr aAttr = theArgs.argument("OppositeToEdge"); - AttributeSelectionPtr aList = std::dynamic_pointer_cast(aAttr); + AttributeSelectionPtr aList = + std::dynamic_pointer_cast(aAttr); if (!aList.get()) return false; GeomShapePtr anEdge = aList->value(); if (!myOriginalEdge || !myOriginalEdge->isSame(anEdge)) { // new edge is selected, need to update the cache - const_cast(this)->myOriginalEdge = anEdge; - const_cast(this)->myCachedShapes.clear(); + const_cast(this)->myOriginalEdge = anEdge; + const_cast(this)->myCachedShapes.clear(); } if (myCachedShapes.empty()) { - ResultBodyPtr aBaseResult = ModelAPI_Tools::bodyOwner(aList->context(), true); + ResultBodyPtr aBaseResult = + ModelAPI_Tools::bodyOwner(aList->context(), true); if (!aBaseResult.get()) { - aBaseResult = std::dynamic_pointer_cast(aList->context()); + aBaseResult = + std::dynamic_pointer_cast(aList->context()); if (!aBaseResult.get()) return false; } - cacheOppositeEdges(aBaseResult->shape(), anEdge, - const_cast(this)->myCachedShapes); + cacheOppositeEdges( + aBaseResult->shape(), anEdge, + const_cast(this)->myCachedShapes); } return myCachedShapes.find(theShape) != myCachedShapes.end(); } -std::string FiltersPlugin_OppositeToEdge::xmlRepresentation() const -{ +std::string FiltersPlugin_OppositeToEdge::xmlRepresentation() const { return xmlFromFile("filter-OppositeToEdge.xml"); } -void FiltersPlugin_OppositeToEdge::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("OppositeToEdge", ModelAPI_AttributeSelection::typeId()); +void FiltersPlugin_OppositeToEdge::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("OppositeToEdge", + ModelAPI_AttributeSelection::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h index c9bac63a5..fb50b0d3d 100644 --- a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h +++ b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_OPPOSITETOEDGE_H_ @@ -30,15 +31,14 @@ typedef std::set SetOfShapes; /**\class FiltersPlugin_OppositeToEdge -* \ingroup DataModel -* \brief Filter for edges of quadrangular faces opposite to the selected edge -*/ -class FiltersPlugin_OppositeToEdge : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for edges of quadrangular faces opposite to the selected edge + */ +class FiltersPlugin_OppositeToEdge : public ModelAPI_Filter { public: FiltersPlugin_OppositeToEdge() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Opposite to an edge"); return kName; } @@ -46,18 +46,17 @@ public: /// Returns true for any type because it supports all selection types virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; private: /// Original edge selected for filtering @@ -66,4 +65,4 @@ private: SetOfShapes myCachedShapes; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_Plugin.cpp b/src/FiltersPlugin/FiltersPlugin_Plugin.cpp index 3549a00fa..7eda33392 100644 --- a/src/FiltersPlugin/FiltersPlugin_Plugin.cpp +++ b/src/FiltersPlugin/FiltersPlugin_Plugin.cpp @@ -14,9 +14,11 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // +#include "FiltersPlugin_Plugin.h" #include "FiltersPlugin_BelongsTo.h" #include "FiltersPlugin_ContinuousFaces.h" #include "FiltersPlugin_EdgeSize.h" @@ -28,28 +30,27 @@ #include "FiltersPlugin_OnLine.h" #include "FiltersPlugin_OnPlane.h" #include "FiltersPlugin_OnPlaneSide.h" +#include "FiltersPlugin_OnShapeName.h" #include "FiltersPlugin_OppositeToEdge.h" -#include "FiltersPlugin_Plugin.h" #include "FiltersPlugin_RelativeToSolid.h" #include "FiltersPlugin_Selection.h" #include "FiltersPlugin_Validators.h" #include "FiltersPlugin_VerticalFace.h" #include "FiltersPlugin_VolumeSize.h" -#include "FiltersPlugin_OnShapeName.h" #include -#include #include +#include // the only created instance of this plugin -static FiltersPlugin_Plugin* MY_VIEWFILTERS_INSTANCE = new FiltersPlugin_Plugin(); +static FiltersPlugin_Plugin *MY_VIEWFILTERS_INSTANCE = + new FiltersPlugin_Plugin(); -FiltersPlugin_Plugin::FiltersPlugin_Plugin() -{ +FiltersPlugin_Plugin::FiltersPlugin_Plugin() { // register filters SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_FiltersFactory* aFactory = aMgr->filters(); + ModelAPI_FiltersFactory *aFactory = aMgr->filters(); aFactory->registerFilter("HorizontalFaces", new FiltersPlugin_HorizontalFace); aFactory->registerFilter("VerticalFaces", new FiltersPlugin_VerticalFace); aFactory->registerFilter("BelongsTo", new FiltersPlugin_BelongsTo); @@ -58,27 +59,28 @@ FiltersPlugin_Plugin::FiltersPlugin_Plugin() aFactory->registerFilter("OnGeometry", new FiltersPlugin_OnGeometry); aFactory->registerFilter("OnPlaneSide", new FiltersPlugin_OnPlaneSide); aFactory->registerFilter("OppositeToEdge", new FiltersPlugin_OppositeToEdge); - aFactory->registerFilter("RelativeToSolid", new FiltersPlugin_RelativeToSolid); + aFactory->registerFilter("RelativeToSolid", + new FiltersPlugin_RelativeToSolid); aFactory->registerFilter("ExternalFaces", new FiltersPlugin_ExternalFaces); aFactory->registerFilter("EdgeSize", new FiltersPlugin_EdgeSize); aFactory->registerFilter("FaceSize", new FiltersPlugin_FaceSize); aFactory->registerFilter("VolumeSize", new FiltersPlugin_VolumeSize); aFactory->registerFilter("FeatureEdges", new FiltersPlugin_FeatureEdges); - aFactory->registerFilter("ContinuousFaces", new FiltersPlugin_ContinuousFaces); + aFactory->registerFilter("ContinuousFaces", + new FiltersPlugin_ContinuousFaces); aFactory->registerFilter("OnShapeName", new FiltersPlugin_OnShapeName); Config_ModuleReader::loadScript("FiltersPlugin_TopoConnectedFaces"); // register validators - ModelAPI_ValidatorsFactory* aValidators = aMgr->validators(); + ModelAPI_ValidatorsFactory *aValidators = aMgr->validators(); aValidators->registerValidator("FiltersPlugin_ShapeType", new FiltersPlugin_ShapeTypeValidator); ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr FiltersPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr FiltersPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == FiltersPlugin_Selection::ID()) return FeaturePtr(new FiltersPlugin_Selection); // feature of such kind is not found diff --git a/src/FiltersPlugin/FiltersPlugin_Plugin.h b/src/FiltersPlugin/FiltersPlugin_Plugin.h index ae4d481ac..e628f12ee 100644 --- a/src/FiltersPlugin/FiltersPlugin_Plugin.h +++ b/src/FiltersPlugin/FiltersPlugin_Plugin.h @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_PLUGIN_H_ #define FILTERSPLUGIN_PLUGIN_H_ #include "FiltersPlugin.h" -#include #include +#include /**\class GeomValidators_Plugin * \ingroup Plugins - * \brief Interface common for any plugin: allows to use plugin by the plugins manager. + * \brief Interface common for any plugin: allows to use plugin by the plugins + * manager. */ -class FILTERS_EXPORT FiltersPlugin_Plugin : public ModelAPI_Plugin -{ +class FILTERS_EXPORT FiltersPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); diff --git a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp index a4b8b8401..220c5ae4f 100644 --- a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp +++ b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_RelativeToSolid.h" @@ -26,22 +27,23 @@ #include #include - -bool FiltersPlugin_RelativeToSolid::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_RelativeToSolid::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType >= GeomAPI_Shape::SHELL; } -bool FiltersPlugin_RelativeToSolid::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_RelativeToSolid::isOk( + const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr anAttr = theArgs.argument("Solid"); - AttributeSelectionPtr aSel = std::dynamic_pointer_cast(anAttr); + AttributeSelectionPtr aSel = + std::dynamic_pointer_cast(anAttr); if (!aSel) return false; anAttr = theArgs.argument("Location"); - AttributeStringPtr aLocAttr = std::dynamic_pointer_cast(anAttr); + AttributeStringPtr aLocAttr = + std::dynamic_pointer_cast(anAttr); if (!aLocAttr) return false; std::string aLocString = aLocAttr->value(); @@ -49,7 +51,8 @@ bool FiltersPlugin_RelativeToSolid::isOk(const GeomShapePtr& theShape, const Res GeomShapePtr aSolidSelected = aSel->value(); if (!aSolidSelected && aSel->context()) aSolidSelected = aSel->context()->shape(); - GeomSolidPtr aSolid = aSolidSelected ? aSolidSelected->solid() : GeomSolidPtr(); + GeomSolidPtr aSolid = + aSolidSelected ? aSolidSelected->solid() : GeomSolidPtr(); if (!aSolid) return false; @@ -72,13 +75,12 @@ bool FiltersPlugin_RelativeToSolid::isOk(const GeomShapePtr& theShape, const Res return isOK; } -std::string FiltersPlugin_RelativeToSolid::xmlRepresentation() const -{ +std::string FiltersPlugin_RelativeToSolid::xmlRepresentation() const { return xmlFromFile("filter-RelativeToSolid.xml"); } -void FiltersPlugin_RelativeToSolid::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ +void FiltersPlugin_RelativeToSolid::initAttributes( + ModelAPI_FiltersArgs &theArguments) { theArguments.initAttribute("Solid", ModelAPI_AttributeSelection::typeId()); theArguments.initAttribute("Location", ModelAPI_AttributeString::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h index 434bf0b1c..7260cdae1 100644 --- a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h +++ b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_RELATIVETOSOLID_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_RelativeToSolid -* \ingroup DataModel -* \brief Filter for objects inside/outside/on the selected solid -*/ -class FiltersPlugin_RelativeToSolid : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for objects inside/outside/on the selected solid + */ +class FiltersPlugin_RelativeToSolid : public ModelAPI_Filter { public: FiltersPlugin_RelativeToSolid() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("On/In/Out a solid"); return kName; } @@ -44,18 +44,17 @@ public: /// Returns True if the filter can be used several times within one selection virtual bool isMultiple() const { return true; } - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_Selection.cpp b/src/FiltersPlugin/FiltersPlugin_Selection.cpp index 8d2d7b758..b20c23eda 100644 --- a/src/FiltersPlugin/FiltersPlugin_Selection.cpp +++ b/src/FiltersPlugin/FiltersPlugin_Selection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_Selection.h" @@ -28,23 +29,23 @@ // identifier of the reverse flag of a filter static const std::string kReverseAttrID(""); -std::string FiltersPlugin_Selection::addFilter(const std::string theFilterID) -{ - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); +std::string FiltersPlugin_Selection::addFilter(const std::string theFilterID) { + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); FilterPtr aFilter = aFactory->filter(theFilterID); std::string aFilterID = theFilterID; - if (aFilter->isMultiple()) { // check that there is already such filter, so, increment ID + if (aFilter->isMultiple()) { // check that there is already such filter, so, + // increment ID std::list aFilters; data()->allGroups(aFilters); - for(int anID = 0; true; anID++) { + for (int anID = 0; true; anID++) { if (anID != 0) { std::ostringstream aStream; - aStream<<"_"<::iterator aFiltersIDs = aFilters.begin(); - for(; aFiltersIDs != aFilters.end(); aFiltersIDs++) { + for (; aFiltersIDs != aFilters.end(); aFiltersIDs++) { if (*aFiltersIDs == aFilterID) break; } @@ -55,44 +56,44 @@ std::string FiltersPlugin_Selection::addFilter(const std::string theFilterID) if (aFilter.get()) { std::shared_ptr aBool = - std::dynamic_pointer_cast(data()->addFloatingAttribute( - kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), aFilterID)); + std::dynamic_pointer_cast( + data()->addFloatingAttribute(kReverseAttrID, + ModelAPI_AttributeBoolean::typeId(), + aFilterID)); aBool->setValue(false); // not reversed by default // to add attributes related to the filter ModelAPI_FiltersArgs anArgs; - anArgs.setFeature(std::dynamic_pointer_cast(data()->owner())); + anArgs.setFeature( + std::dynamic_pointer_cast(data()->owner())); anArgs.setFilter(aFilterID); aFilter->initAttributes(anArgs); } return aFilterID; } -void FiltersPlugin_Selection::removeFilter(const std::string theFilterID) -{ - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); +void FiltersPlugin_Selection::removeFilter(const std::string theFilterID) { + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); FilterPtr aFilter = aFactory->filter(theFilterID); if (aFilter.get()) { data()->removeAttributes(theFilterID); } } -std::list FiltersPlugin_Selection::filters() const -{ +std::list FiltersPlugin_Selection::filters() const { std::list aFilters; data()->allGroups(aFilters); return aFilters; } -void FiltersPlugin_Selection::setReversed(const std::string theFilterID, const bool theReversed) -{ +void FiltersPlugin_Selection::setReversed(const std::string theFilterID, + const bool theReversed) { std::string anAttrID = theFilterID + kFilterSeparator + kReverseAttrID; std::shared_ptr aBool = boolean(anAttrID); if (aBool.get()) aBool->setValue(theReversed); } -bool FiltersPlugin_Selection::isReversed(const std::string theFilterID) -{ +bool FiltersPlugin_Selection::isReversed(const std::string theFilterID) { std::string anAttrID = theFilterID + kFilterSeparator + kReverseAttrID; std::shared_ptr aBool = boolean(anAttrID); if (aBool.get()) @@ -100,27 +101,27 @@ bool FiltersPlugin_Selection::isReversed(const std::string theFilterID) return false; } -std::list FiltersPlugin_Selection::filterArgs(const std::string theFilterID) const -{ +std::list +FiltersPlugin_Selection::filterArgs(const std::string theFilterID) const { std::list aList; data()->attributesOfGroup(theFilterID, aList); return aList; } -void FiltersPlugin_Selection::setAttribute(const AttributePtr& theAttr) -{ +void FiltersPlugin_Selection::setAttribute(const AttributePtr &theAttr) { myBase = theAttr; - if (myBase.get()) { // check that the type of sub-elements is supported by all existing filters + if (myBase.get()) { // check that the type of sub-elements is supported by all + // existing filters std::shared_ptr aSelList = - std::dynamic_pointer_cast(theAttr); + std::dynamic_pointer_cast(theAttr); if (aSelList.get()) { std::string aStrType = aSelList->selectionType(); GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::shapeTypeByStr(aStrType); std::list aFilters; data()->allGroups(aFilters); - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); std::list::iterator aFIter = aFilters.begin(); - for(; aFIter != aFilters.end(); aFIter++) { + for (; aFIter != aFilters.end(); aFIter++) { FilterPtr aFilter = aFactory->filter(*aFIter); if (aFilter.get() && !aFilter->isSupported(aType)) { data()->removeAttributes(*aFIter); @@ -130,26 +131,27 @@ void FiltersPlugin_Selection::setAttribute(const AttributePtr& theAttr) } } -const AttributePtr& FiltersPlugin_Selection::baseAttribute() const -{ +const AttributePtr &FiltersPlugin_Selection::baseAttribute() const { return myBase; } -void FiltersPlugin_Selection::initAttributes() -{ - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); +void FiltersPlugin_Selection::initAttributes() { + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); std::list aFilters; data()->allGroups(aFilters); - for(std::list::iterator aFIt = aFilters.begin(); aFIt != aFilters.end(); aFIt++) { + for (std::list::iterator aFIt = aFilters.begin(); + aFIt != aFilters.end(); aFIt++) { FilterPtr aFilter = aFactory->filter(*aFIt); if (aFilter.get()) { std::shared_ptr aBool = - std::dynamic_pointer_cast(data()->addFloatingAttribute( - kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), *aFIt)); + std::dynamic_pointer_cast( + data()->addFloatingAttribute( + kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), *aFIt)); if (!aBool->isInitialized()) aBool->setValue(false); // not reversed by default ModelAPI_FiltersArgs anArgs; - anArgs.setFeature(std::dynamic_pointer_cast(data()->owner())); + anArgs.setFeature( + std::dynamic_pointer_cast(data()->owner())); anArgs.setFilter(*aFIt); aFilter->initAttributes(anArgs); } diff --git a/src/FiltersPlugin/FiltersPlugin_Selection.h b/src/FiltersPlugin/FiltersPlugin_Selection.h index 5bf9bfead..9dabee461 100644 --- a/src/FiltersPlugin/FiltersPlugin_Selection.h +++ b/src/FiltersPlugin/FiltersPlugin_Selection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_SELECTION_H_ @@ -24,28 +25,24 @@ #include /**\class FiltersPlugin_Selection -* \ingroup DataModel -* \brief An interface for working with filters in the feature. A filters feature must inherit it -* in order to allow management of filters in the feature data structure. -*/ -class FiltersPlugin_Selection : public ModelAPI_FiltersFeature -{ + * \ingroup DataModel + * \brief An interface for working with filters in the feature. A filters + * feature must inherit it in order to allow management of filters in the + * feature data structure. + */ +class FiltersPlugin_Selection : public ModelAPI_FiltersFeature { public: /// Extrusion kind - inline static const std::string& ID() { + inline static const std::string &ID() { static const std::string MY_GROUP_ID("FiltersSelection"); return MY_GROUP_ID; } /// Returns the kind of a feature - FILTERS_EXPORT virtual const std::string& getKind() { - return ID(); - } + FILTERS_EXPORT virtual const std::string &getKind() { return ID(); } /// This feature does not displayed in the data tree - virtual bool isInHistory() { - return false; - } + virtual bool isInHistory() { return false; } /// Computes a selection? FILTERS_EXPORT virtual void execute() {} @@ -60,34 +57,38 @@ public: /// Adds a filter to the feature. Also initializes arguments of this filter. /// Returns the real identifier of the filter. - FILTERS_EXPORT virtual std::string addFilter(const std::string theFilterID) override; + FILTERS_EXPORT virtual std::string + addFilter(const std::string theFilterID) override; /// Removes an existing filter from the feature. - FILTERS_EXPORT virtual void removeFilter(const std::string theFilterID) override; + FILTERS_EXPORT virtual void + removeFilter(const std::string theFilterID) override; /// Returns the list of existing filters in the feature. FILTERS_EXPORT virtual std::list filters() const override; /// Stores the reversed flag for the filter. - FILTERS_EXPORT virtual void setReversed - (const std::string theFilterID, const bool theReversed) override; + FILTERS_EXPORT virtual void setReversed(const std::string theFilterID, + const bool theReversed) override; /// Returns the reversed flag value for the filter. - FILTERS_EXPORT virtual bool isReversed(const std::string theFilterID) override; + FILTERS_EXPORT virtual bool + isReversed(const std::string theFilterID) override; /// Returns the ordered list of attributes related to the filter. FILTERS_EXPORT virtual std::list - filterArgs(const std::string theFilterID) const override; + filterArgs(const std::string theFilterID) const override; - /// Sets the attribute (not-persistent field) that contains this filters feature. - /// The filter feature may make synchronization by this method call. - FILTERS_EXPORT virtual void setAttribute(const AttributePtr& theAttr) override; + /// Sets the attribute (not-persistent field) that contains this filters + /// feature. The filter feature may make synchronization by this method call. + FILTERS_EXPORT virtual void + setAttribute(const AttributePtr &theAttr) override; - /// Returns the attribute (not-persistent field) that contains this filters feature. - FILTERS_EXPORT virtual const AttributePtr& baseAttribute() const override; + /// Returns the attribute (not-persistent field) that contains this filters + /// feature. + FILTERS_EXPORT virtual const AttributePtr &baseAttribute() const override; protected: - AttributePtr myBase; ///< the attribute related to this filter }; diff --git a/src/FiltersPlugin/FiltersPlugin_Validators.cpp b/src/FiltersPlugin/FiltersPlugin_Validators.cpp index 62eeaaa6c..7eed19425 100644 --- a/src/FiltersPlugin/FiltersPlugin_Validators.cpp +++ b/src/FiltersPlugin/FiltersPlugin_Validators.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_Validators.h" @@ -24,10 +25,10 @@ #include #include -bool FiltersPlugin_ShapeTypeValidator::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool FiltersPlugin_ShapeTypeValidator::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { if (!theAttribute) return false; FeaturePtr aFilterFeature = ModelAPI_Feature::feature(theAttribute->owner()); @@ -37,7 +38,8 @@ bool FiltersPlugin_ShapeTypeValidator::isValid(const AttributePtr& theAttribute, // iterate on groups and find the one having the current filters feature DocumentPtr aCurDoc = ModelAPI_Session::get()->activeDocument(); std::list aFeatList = aCurDoc->allFeatures(); - for (std::list::iterator anIt = aFeatList.begin(); anIt != aFeatList.end(); ++anIt) + for (std::list::iterator anIt = aFeatList.begin(); + anIt != aFeatList.end(); ++anIt) if ((*anIt)->getKind() == CollectionPlugin_Group::ID()) { AttributeSelectionListPtr aSelList = (*anIt)->selectionList(CollectionPlugin_Group::LIST_ID()); diff --git a/src/FiltersPlugin/FiltersPlugin_Validators.h b/src/FiltersPlugin/FiltersPlugin_Validators.h index c9ea730cd..80d1d20f8 100644 --- a/src/FiltersPlugin/FiltersPlugin_Validators.h +++ b/src/FiltersPlugin/FiltersPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_VALIDATORS_H_ @@ -28,17 +29,17 @@ * Validates selection of "On geometry" filter to select only * the shapes specified by the group type. */ -class FiltersPlugin_ShapeTypeValidator : public GeomValidators_ShapeType -{ +class FiltersPlugin_ShapeTypeValidator : public GeomValidators_ShapeType { public: /// \return True if the attribute is valid. It checks whether the shape is a /// body subshape. Does not allow select construction shapes. /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - FILTERS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + FILTERS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_VerticalFace.cpp b/src/FiltersPlugin/FiltersPlugin_VerticalFace.cpp index dd34f8897..b8ff27369 100644 --- a/src/FiltersPlugin/FiltersPlugin_VerticalFace.cpp +++ b/src/FiltersPlugin/FiltersPlugin_VerticalFace.cpp @@ -14,27 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_VerticalFace.h" +#include #include #include -#include #include -#include +#include #include -bool FiltersPlugin_VerticalFace::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_VerticalFace::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::FACE; } -bool FiltersPlugin_VerticalFace::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& /*theArgs*/) const -{ +bool FiltersPlugin_VerticalFace::isOk( + const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs & /*theArgs*/) const { static const double THE_TOLERANCE = 1.e-7; bool isVertical = false; @@ -47,8 +48,7 @@ bool FiltersPlugin_VerticalFace::isOk(const GeomShapePtr& theShape, const Result if (aPlane) { GeomDirPtr aDir = aPlane->direction(); isVertical = fabs(aDir->z()) <= THE_TOLERANCE; - } - else { + } else { GeomCylinderPtr aCylinder = aFace->getCylinder(); if (aCylinder) { GeomDirPtr aDir = aCylinder->axis(); diff --git a/src/FiltersPlugin/FiltersPlugin_VerticalFace.h b/src/FiltersPlugin/FiltersPlugin_VerticalFace.h index a9fe9cbaf..6c4b2d964 100644 --- a/src/FiltersPlugin/FiltersPlugin_VerticalFace.h +++ b/src/FiltersPlugin/FiltersPlugin_VerticalFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_VERTICALPLANE_H_ @@ -25,15 +26,14 @@ #include /**\class FiltersPlugin_VerticalFace -* \ingroup DataModel -* \brief Filter for vertical faces only -*/ -class FiltersPlugin_VerticalFace: public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for vertical faces only + */ +class FiltersPlugin_VerticalFace : public ModelAPI_Filter { public: FiltersPlugin_VerticalFace() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Vertical faces"); return kName; } @@ -41,12 +41,11 @@ public: /// Returns true if the given shape type is supported virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; }; -#endif \ No newline at end of file +#endif diff --git a/src/FiltersPlugin/FiltersPlugin_VolumeSize.cpp b/src/FiltersPlugin/FiltersPlugin_VolumeSize.cpp index fad0f9b10..427b6fddd 100644 --- a/src/FiltersPlugin/FiltersPlugin_VolumeSize.cpp +++ b/src/FiltersPlugin/FiltersPlugin_VolumeSize.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "FiltersPlugin_VolumeSize.h" -#include -#include #include +#include +#include #include #include @@ -30,28 +31,29 @@ #include -#include #include +#include //================================================================================================= -bool FiltersPlugin_VolumeSize::isSupported(GeomAPI_Shape::ShapeType theType) const -{ +bool FiltersPlugin_VolumeSize::isSupported( + GeomAPI_Shape::ShapeType theType) const { return theType == GeomAPI_Shape::SOLID; } //================================================================================================= -bool FiltersPlugin_VolumeSize::isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const -{ +bool FiltersPlugin_VolumeSize::isOk(const GeomShapePtr &theShape, + const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const { AttributePtr anAttr = theArgs.argument("value"); - AttributeDoublePtr aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized()) + AttributeDoublePtr aValue = + std::dynamic_pointer_cast(anAttr); + if (!aValue.get() || !anAttr->isInitialized()) return false; double aVal = aValue->value(); anAttr = theArgs.argument("valueMax"); aValue = std::dynamic_pointer_cast(anAttr); - if (!aValue.get()|| !anAttr->isInitialized()) + if (!aValue.get() || !anAttr->isInitialized()) return false; double aValMax = aValue->value(); @@ -61,7 +63,8 @@ bool FiltersPlugin_VolumeSize::isOk(const GeomShapePtr& theShape, const ResultPt double aVolume = GeomAlgoAPI_ShapeTools::volume(theShape); anAttr = theArgs.argument("comparatorType"); - AttributeStringPtr aCompAttr = std::dynamic_pointer_cast(anAttr); + AttributeStringPtr aCompAttr = + std::dynamic_pointer_cast(anAttr); if (!aCompAttr) return false; std::string aCompString = aCompAttr->value(); @@ -76,26 +79,24 @@ bool FiltersPlugin_VolumeSize::isOk(const GeomShapePtr& theShape, const ResultPt else if (aCompString == "supEq") isOK = aVolume > aVal - Precision::Confusion(); else if (aCompString == "isBetween") - isOK = aVal <= aValMax - && aVolume > aVal - Precision::Confusion() - && aVolume < aValMax + Precision::Confusion(); + isOK = aVal <= aValMax && aVolume > aVal - Precision::Confusion() && + aVolume < aValMax + Precision::Confusion(); else if (aCompString == "isStrictlyBetween") - isOK = aVal <= aValMax - && aVolume > aVal + Precision::Confusion() - && aVolume < aValMax - Precision::Confusion(); + isOK = aVal <= aValMax && aVolume > aVal + Precision::Confusion() && + aVolume < aValMax - Precision::Confusion(); return isOK; } //================================================================================================= -std::string FiltersPlugin_VolumeSize::xmlRepresentation() const -{ +std::string FiltersPlugin_VolumeSize::xmlRepresentation() const { return xmlFromFile("filter-VolumeSize.xml"); } //================================================================================================= -void FiltersPlugin_VolumeSize::initAttributes(ModelAPI_FiltersArgs& theArguments) -{ - theArguments.initAttribute("comparatorType", ModelAPI_AttributeString::typeId()); +void FiltersPlugin_VolumeSize::initAttributes( + ModelAPI_FiltersArgs &theArguments) { + theArguments.initAttribute("comparatorType", + ModelAPI_AttributeString::typeId()); theArguments.initAttribute("value", ModelAPI_AttributeDouble::typeId()); theArguments.initAttribute("valueMax", ModelAPI_AttributeDouble::typeId()); } diff --git a/src/FiltersPlugin/FiltersPlugin_VolumeSize.h b/src/FiltersPlugin/FiltersPlugin_VolumeSize.h index 281e43001..b53f4c5e0 100644 --- a/src/FiltersPlugin/FiltersPlugin_VolumeSize.h +++ b/src/FiltersPlugin/FiltersPlugin_VolumeSize.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef FILTERSPLUGIN_VOLUMESIZE_H_ @@ -25,17 +26,15 @@ #include #include - /**\class FiltersPlugin_VolumeSize -* \ingroup DataModel -* \brief Filter for solid with specific volume -*/ -class FiltersPlugin_VolumeSize : public ModelAPI_Filter -{ + * \ingroup DataModel + * \brief Filter for solid with specific volume + */ +class FiltersPlugin_VolumeSize : public ModelAPI_Filter { public: FiltersPlugin_VolumeSize() : ModelAPI_Filter() {} - virtual const std::string& name() const { + virtual const std::string &name() const { static const std::string kName("Volume size"); return kName; } @@ -43,19 +42,17 @@ public: /// Returns true for solid type virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, const ResultPtr&, - const ModelAPI_FiltersArgs& theArgs) const override; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theArgs arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter virtual std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override; - + virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/doc/FiltersPlugin.rst b/src/FiltersPlugin/doc/FiltersPlugin.rst index 0057248a1..27de30560 100644 --- a/src/FiltersPlugin/doc/FiltersPlugin.rst +++ b/src/FiltersPlugin/doc/FiltersPlugin.rst @@ -30,7 +30,7 @@ In this panel: :align: center Filters **Horizontal faces** and **On plane** added to the property panel. - + If filter is implemented as "Multiple", several instances of this filter may be added in one selection. Otherwise the added filter is removed from the "Add new filter..." list. Each filter item can be deleted with help of |delete.icon| button. A filter can be reverced with help of toggle button |plus.icon|/|minus.icon|. Also a filter could have input fields in case @@ -60,7 +60,7 @@ By default, the result of Selection feature all selectable entities from all Sha **Edge size** - **Result type:** Edge -- **Argument:** +- **Argument:** - **Comparator:** <, <=, >, >=, is between, is strictly between - **Size** or **Min size** and **Max size** - **Algorithm:** Returns all edges whose length respect comparator rules. @@ -68,7 +68,7 @@ By default, the result of Selection feature all selectable entities from all Sha **Face size** - **Result type:** Face -- **Argument:** +- **Argument:** - **Comparator:** <, <=, >, >=, is between, is strictly between - **Size** or **Min size** and **Max size** - **Algorithm:** Returns all faces whose area respect comparator rules. @@ -76,7 +76,7 @@ By default, the result of Selection feature all selectable entities from all Sha **Volume size** - **Result type:** Solid -- **Argument:** +- **Argument:** - **Comparator:** <, <=, >, >=, is between, is strictly between - **Size** or **Min size** and **Max size** - **Algorithm:** Returns all solids whose volume respect comparator rules. @@ -86,8 +86,8 @@ By default, the result of Selection feature all selectable entities from all Sha This algorithm identifies edges between two faces discontinuous with an angular tolerance. - **Result type:** Edge -- **Argument:** - - **Angle** an angular tolerance used by G1 continuity criterion for comparing the angle between the normals +- **Argument:** + - **Angle** an angular tolerance used by G1 continuity criterion for comparing the angle between the normals - **Algorithm:** Returns all edges between two discontinuous faces. **On a plane** @@ -127,9 +127,9 @@ This algorithm is based on the Propagate geompy function. It works on a model pa This algorithm identifies continuous faces with an angular tolerance given by topological propagation. - **Result type:** Face -- **Argument:** - - **Angle:** an angular tolerance used by G1 continuity criterion for comparing the angle between the normals. - - **Faces:** Faces to start the propagation. +- **Argument:** + - **Angle:** an angular tolerance used by G1 continuity criterion for comparing the angle between the normals. + - **Faces:** Faces to start the propagation. - **Algorithm:** Returns continuous faces. **On/In/Out a Solid** @@ -139,8 +139,8 @@ This algorithm reproduces the GetShapesOnShape function of geompy. - **Result type:** Vertex, Edge or Face - **Arguments:** Solid. Location according to the given Solid, as described below - **Algorithm:** - - **In:** strictly inside the solid. - - **Not In:** strictly outside the solid. + - **In:** strictly inside the solid. + - **Not In:** strictly outside the solid. - **On:** confused with the boundary of the solid - **Not On:** strictly inside or outside the solid - **In & On:** i.e. inside or confused with the boundary of the solid @@ -201,4 +201,3 @@ This algorithm finds all the faces topologically connected the argument selected - Selecting all results with names containing "Poutre", followed by a space and a digit. .. figure:: images/selection_byShapeName3.png :align: center - diff --git a/src/FiltersPlugin/filter-OnShapeName.xml b/src/FiltersPlugin/filter-OnShapeName.xml index bc4770eba..49d2fa25a 100644 --- a/src/FiltersPlugin/filter-OnShapeName.xml +++ b/src/FiltersPlugin/filter-OnShapeName.xml @@ -1,4 +1,4 @@ - \ No newline at end of file + diff --git a/src/GDMLAPI/GDMLAPI.h b/src/GDMLAPI/GDMLAPI.h index e8b42da75..927cf250c 100644 --- a/src/GDMLAPI/GDMLAPI.h +++ b/src/GDMLAPI/GDMLAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLAPI_H @@ -22,13 +23,13 @@ #if defined GDMLAPI_EXPORTS #if defined WIN32 -#define GDMLAPI_EXPORT __declspec( dllexport ) +#define GDMLAPI_EXPORT __declspec(dllexport) #else #define GDMLAPI_EXPORT #endif #else #if defined WIN32 -#define GDMLAPI_EXPORT __declspec( dllimport ) +#define GDMLAPI_EXPORT __declspec(dllimport) #else #define GDMLAPI_EXPORT #endif diff --git a/src/GDMLAPI/GDMLAPI_ConeSegment.cpp b/src/GDMLAPI/GDMLAPI_ConeSegment.cpp index f4e53999c..1bdf81186 100644 --- a/src/GDMLAPI/GDMLAPI_ConeSegment.cpp +++ b/src/GDMLAPI/GDMLAPI_ConeSegment.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GDMLAPI_ConeSegment.h" @@ -23,41 +24,34 @@ #include //================================================================================================== -GDMLAPI_ConeSegment::GDMLAPI_ConeSegment(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +GDMLAPI_ConeSegment::GDMLAPI_ConeSegment( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -GDMLAPI_ConeSegment::GDMLAPI_ConeSegment(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theRMin1, - const ModelHighAPI_Double& theRMax1, - const ModelHighAPI_Double& theRMin2, - const ModelHighAPI_Double& theRMax2, - const ModelHighAPI_Double& theZ, - const ModelHighAPI_Double& theStartPhi, - const ModelHighAPI_Double& theDeltaPhi) -: ModelHighAPI_Interface(theFeature) -{ +GDMLAPI_ConeSegment::GDMLAPI_ConeSegment( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theRMin1, const ModelHighAPI_Double &theRMax1, + const ModelHighAPI_Double &theRMin2, const ModelHighAPI_Double &theRMax2, + const ModelHighAPI_Double &theZ, const ModelHighAPI_Double &theStartPhi, + const ModelHighAPI_Double &theDeltaPhi) + : ModelHighAPI_Interface(theFeature) { if (initialize()) - setAttributes(theRMin1, theRMax1, theRMin2, theRMax2, theZ, theStartPhi, theDeltaPhi); + setAttributes(theRMin1, theRMax1, theRMin2, theRMax2, theZ, theStartPhi, + theDeltaPhi); } //================================================================================================== -GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment() -{ -} +GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment() {} //================================================================================================== -void GDMLAPI_ConeSegment::setAttributes(const ModelHighAPI_Double& theRMin1, - const ModelHighAPI_Double& theRMax1, - const ModelHighAPI_Double& theRMin2, - const ModelHighAPI_Double& theRMax2, - const ModelHighAPI_Double& theZ, - const ModelHighAPI_Double& theStartPhi, - const ModelHighAPI_Double& theDeltaPhi) -{ +void GDMLAPI_ConeSegment::setAttributes( + const ModelHighAPI_Double &theRMin1, const ModelHighAPI_Double &theRMax1, + const ModelHighAPI_Double &theRMin2, const ModelHighAPI_Double &theRMax2, + const ModelHighAPI_Double &theZ, const ModelHighAPI_Double &theStartPhi, + const ModelHighAPI_Double &theDeltaPhi) { fillAttribute(theRMin1, rmin1()); fillAttribute(theRMax1, rmax1()); fillAttribute(theRMin2, rmin2()); @@ -70,38 +64,45 @@ void GDMLAPI_ConeSegment::setAttributes(const ModelHighAPI_Double& theRMin1, } //================================================================================================== -void GDMLAPI_ConeSegment::dump(ModelHighAPI_Dumper& theDumper) const -{ +void GDMLAPI_ConeSegment::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addConeSegment(" << aDocName; - AttributeDoublePtr anAttrRMin1 = aBase->real(GDMLPlugin_ConeSegment::RMIN1_ID()); - AttributeDoublePtr anAttrRMax1 = aBase->real(GDMLPlugin_ConeSegment::RMAX1_ID()); - AttributeDoublePtr anAttrRMin2 = aBase->real(GDMLPlugin_ConeSegment::RMIN2_ID()); - AttributeDoublePtr anAttrRMax2 = aBase->real(GDMLPlugin_ConeSegment::RMAX2_ID()); + AttributeDoublePtr anAttrRMin1 = + aBase->real(GDMLPlugin_ConeSegment::RMIN1_ID()); + AttributeDoublePtr anAttrRMax1 = + aBase->real(GDMLPlugin_ConeSegment::RMAX1_ID()); + AttributeDoublePtr anAttrRMin2 = + aBase->real(GDMLPlugin_ConeSegment::RMIN2_ID()); + AttributeDoublePtr anAttrRMax2 = + aBase->real(GDMLPlugin_ConeSegment::RMAX2_ID()); AttributeDoublePtr anAttrZ = aBase->real(GDMLPlugin_ConeSegment::Z_ID()); - AttributeDoublePtr anAttrStartPhi = aBase->real(GDMLPlugin_ConeSegment::STARTPHI_ID()); - AttributeDoublePtr anAttrDeltaPhi = aBase->real(GDMLPlugin_ConeSegment::DELTAPHI_ID()); + AttributeDoublePtr anAttrStartPhi = + aBase->real(GDMLPlugin_ConeSegment::STARTPHI_ID()); + AttributeDoublePtr anAttrDeltaPhi = + aBase->real(GDMLPlugin_ConeSegment::DELTAPHI_ID()); theDumper << ", " << anAttrRMin1 << ", " << anAttrRMax1; theDumper << ", " << anAttrRMin2 << ", " << anAttrRMax2; - theDumper << ", " << anAttrZ << ", " << anAttrStartPhi << ", " << anAttrDeltaPhi; + theDumper << ", " << anAttrZ << ", " << anAttrStartPhi << ", " + << anAttrDeltaPhi; theDumper << ")" << std::endl; } //================================================================================================== -ConeSegmentPtr addConeSegment(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRMin1, - const ModelHighAPI_Double& theRMax1, - const ModelHighAPI_Double& theRMin2, - const ModelHighAPI_Double& theRMax2, - const ModelHighAPI_Double& theZ, - const ModelHighAPI_Double& theStartPhi, - const ModelHighAPI_Double& theDeltaPhi) -{ - std::shared_ptr aFeature = thePart->addFeature(GDMLAPI_ConeSegment::ID()); - return ConeSegmentPtr(new GDMLAPI_ConeSegment(aFeature, theRMin1, theRMax1, theRMin2, theRMax2, - theZ, theStartPhi, theDeltaPhi)); +ConeSegmentPtr addConeSegment(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRMin1, + const ModelHighAPI_Double &theRMax1, + const ModelHighAPI_Double &theRMin2, + const ModelHighAPI_Double &theRMax2, + const ModelHighAPI_Double &theZ, + const ModelHighAPI_Double &theStartPhi, + const ModelHighAPI_Double &theDeltaPhi) { + std::shared_ptr aFeature = + thePart->addFeature(GDMLAPI_ConeSegment::ID()); + return ConeSegmentPtr(new GDMLAPI_ConeSegment(aFeature, theRMin1, theRMax1, + theRMin2, theRMax2, theZ, + theStartPhi, theDeltaPhi)); } diff --git a/src/GDMLAPI/GDMLAPI_ConeSegment.h b/src/GDMLAPI/GDMLAPI_ConeSegment.h index 9a2800f88..fb9a7fd53 100644 --- a/src/GDMLAPI/GDMLAPI_ConeSegment.h +++ b/src/GDMLAPI/GDMLAPI_ConeSegment.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLAPI_ConeSegment_H_ @@ -32,57 +33,55 @@ class ModelHighAPI_Double; /// \class GDMLPlugin_ConeSegment /// \ingroup CPPHighAPI /// \brief Interface for primitive ConeSegment feature. -class GDMLAPI_ConeSegment: public ModelHighAPI_Interface -{ +class GDMLAPI_ConeSegment : public ModelHighAPI_Interface { public: /// Constructor without values. GDMLAPI_EXPORT - explicit GDMLAPI_ConeSegment(const std::shared_ptr& theFeature); + explicit GDMLAPI_ConeSegment( + const std::shared_ptr &theFeature); /// Constructor with values. GDMLAPI_EXPORT - explicit GDMLAPI_ConeSegment(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theRMin1, - const ModelHighAPI_Double& theRMax1, - const ModelHighAPI_Double& theRMin2, - const ModelHighAPI_Double& theRMax2, - const ModelHighAPI_Double& theZ, - const ModelHighAPI_Double& theStartPhi, - const ModelHighAPI_Double& theDeltaPhi); + explicit GDMLAPI_ConeSegment( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theRMin1, const ModelHighAPI_Double &theRMax1, + const ModelHighAPI_Double &theRMin2, const ModelHighAPI_Double &theRMax2, + const ModelHighAPI_Double &theZ, const ModelHighAPI_Double &theStartPhi, + const ModelHighAPI_Double &theDeltaPhi); /// Destructor. GDMLAPI_EXPORT virtual ~GDMLAPI_ConeSegment(); - INTERFACE_7(GDMLPlugin_ConeSegment::ID(), - rmin1, GDMLPlugin_ConeSegment::RMIN1_ID(), - ModelAPI_AttributeDouble, /** Inner radius at base of cone */, - rmax1, GDMLPlugin_ConeSegment::RMAX1_ID(), - ModelAPI_AttributeDouble, /** Outer radius at base of cone */, - rmin2, GDMLPlugin_ConeSegment::RMIN2_ID(), - ModelAPI_AttributeDouble, /** Inner radius at top of cone */, - rmax2, GDMLPlugin_ConeSegment::RMAX2_ID(), - ModelAPI_AttributeDouble, /** Outer radius at top of cone */, - z, GDMLPlugin_ConeSegment::Z_ID(), - ModelAPI_AttributeDouble, /** Height of the cone segment */, - startphi, GDMLPlugin_ConeSegment::STARTPHI_ID(), - ModelAPI_AttributeDouble, /** Start angle of the segment */, - deltaphi, GDMLPlugin_ConeSegment::DELTAPHI_ID(), - ModelAPI_AttributeDouble, /** Angle of the segment */) + INTERFACE_7(GDMLPlugin_ConeSegment::ID(), rmin1, + GDMLPlugin_ConeSegment::RMIN1_ID(), ModelAPI_AttributeDouble, + /** Inner radius at base of cone */, rmax1, + GDMLPlugin_ConeSegment::RMAX1_ID(), ModelAPI_AttributeDouble, + /** Outer radius at base of cone */, rmin2, + GDMLPlugin_ConeSegment::RMIN2_ID(), ModelAPI_AttributeDouble, + /** Inner radius at top of cone */, rmax2, + GDMLPlugin_ConeSegment::RMAX2_ID(), ModelAPI_AttributeDouble, + /** Outer radius at top of cone */, z, + GDMLPlugin_ConeSegment::Z_ID(), ModelAPI_AttributeDouble, + /** Height of the cone segment */, startphi, + GDMLPlugin_ConeSegment::STARTPHI_ID(), ModelAPI_AttributeDouble, + /** Start angle of the segment */, deltaphi, + GDMLPlugin_ConeSegment::DELTAPHI_ID(), ModelAPI_AttributeDouble, + /** Angle of the segment */) /// Set dimensions GDMLAPI_EXPORT - void setAttributes(const ModelHighAPI_Double& theRMin1, - const ModelHighAPI_Double& theRMax1, - const ModelHighAPI_Double& theRMin2, - const ModelHighAPI_Double& theRMax2, - const ModelHighAPI_Double& theZ, - const ModelHighAPI_Double& theStartPhi, - const ModelHighAPI_Double& theDeltaPhi); + void setAttributes(const ModelHighAPI_Double &theRMin1, + const ModelHighAPI_Double &theRMax1, + const ModelHighAPI_Double &theRMin2, + const ModelHighAPI_Double &theRMax2, + const ModelHighAPI_Double &theZ, + const ModelHighAPI_Double &theStartPhi, + const ModelHighAPI_Double &theDeltaPhi); /// Dump wrapped feature GDMLAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive ConeSegment object @@ -91,13 +90,13 @@ typedef std::shared_ptr ConeSegmentPtr; /// \ingroup CPPHighAPI /// \brief Create GDML ConeSegment feature. GDMLAPI_EXPORT -ConeSegmentPtr addConeSegment(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRMin1, - const ModelHighAPI_Double& theRMax1, - const ModelHighAPI_Double& theRMin2, - const ModelHighAPI_Double& theRMax2, - const ModelHighAPI_Double& theZ, - const ModelHighAPI_Double& theStartPhi, - const ModelHighAPI_Double& theDeltaPhi); +ConeSegmentPtr addConeSegment(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRMin1, + const ModelHighAPI_Double &theRMax1, + const ModelHighAPI_Double &theRMin2, + const ModelHighAPI_Double &theRMax2, + const ModelHighAPI_Double &theZ, + const ModelHighAPI_Double &theStartPhi, + const ModelHighAPI_Double &theDeltaPhi); #endif // GDMLAPI_ConeSegment_H_ diff --git a/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp b/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp index 3f80f4f19..0ea9e943d 100644 --- a/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp +++ b/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GDMLAPI_Ellipsoid.h" @@ -22,18 +23,17 @@ #include #include -GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid(const std::shared_ptr& theFeature) - : ModelHighAPI_Interface(theFeature) -{ +GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } -GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ) - : ModelHighAPI_Interface(theFeature) -{ +GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theAX, const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setSizes(theAX, theBY, theCZ); fillAttribute("", useZCut1()); @@ -41,14 +41,12 @@ GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid(const std::shared_ptr& th } } -GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ, - const ModelHighAPI_Double& theZCut1, - const ModelHighAPI_Double& theZCut2) - : ModelHighAPI_Interface(theFeature) -{ +GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theAX, const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ, const ModelHighAPI_Double &theZCut1, + const ModelHighAPI_Double &theZCut2) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setSizes(theAX, theBY, theCZ); setZCut1(theZCut1); @@ -56,14 +54,11 @@ GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid(const std::shared_ptr& th } } -GDMLAPI_Ellipsoid::~GDMLAPI_Ellipsoid() -{ -} +GDMLAPI_Ellipsoid::~GDMLAPI_Ellipsoid() {} -void GDMLAPI_Ellipsoid::setSizes(const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ) -{ +void GDMLAPI_Ellipsoid::setSizes(const ModelHighAPI_Double &theAX, + const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ) { fillAttribute(theAX, ax()); fillAttribute(theBY, by()); fillAttribute(theCZ, cz()); @@ -71,40 +66,40 @@ void GDMLAPI_Ellipsoid::setSizes(const ModelHighAPI_Double& theAX, execute(); } -void GDMLAPI_Ellipsoid::setZCut1(const ModelHighAPI_Double& theZCut1) -{ +void GDMLAPI_Ellipsoid::setZCut1(const ModelHighAPI_Double &theZCut1) { fillAttribute("true", useZCut1()); fillAttribute(theZCut1, zCut1()); execute(); } -void GDMLAPI_Ellipsoid::setZCut2(const ModelHighAPI_Double& theZCut2) -{ +void GDMLAPI_Ellipsoid::setZCut2(const ModelHighAPI_Double &theZCut2) { fillAttribute("true", useZCut2()); fillAttribute(theZCut2, zCut2()); execute(); } - //================================================================================================== -void GDMLAPI_Ellipsoid::dump(ModelHighAPI_Dumper& theDumper) const -{ +void GDMLAPI_Ellipsoid::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); AttributeDoublePtr anAttrAX = aBase->real(GDMLPlugin_Ellipsoid::AX_ID()); AttributeDoublePtr anAttrBY = aBase->real(GDMLPlugin_Ellipsoid::BY_ID()); AttributeDoublePtr anAttrCZ = aBase->real(GDMLPlugin_Ellipsoid::CZ_ID()); - theDumper << aBase << " = model.addEllipsoid(" << aDocName << ", " - << anAttrAX << ", " << anAttrBY << ", " << anAttrCZ; + theDumper << aBase << " = model.addEllipsoid(" << aDocName << ", " << anAttrAX + << ", " << anAttrBY << ", " << anAttrCZ; - AttributeStringPtr anAttrUseZCut1 = aBase->string(GDMLPlugin_Ellipsoid::USE_ZCUT1_ID()); - AttributeDoublePtr anAttrZCut1 = aBase->real(GDMLPlugin_Ellipsoid::ZCUT1_ID()); - AttributeStringPtr anAttrUseZCut2 = aBase->string(GDMLPlugin_Ellipsoid::USE_ZCUT2_ID()); - AttributeDoublePtr anAttrZCut2 = aBase->real(GDMLPlugin_Ellipsoid::ZCUT2_ID()); + AttributeStringPtr anAttrUseZCut1 = + aBase->string(GDMLPlugin_Ellipsoid::USE_ZCUT1_ID()); + AttributeDoublePtr anAttrZCut1 = + aBase->real(GDMLPlugin_Ellipsoid::ZCUT1_ID()); + AttributeStringPtr anAttrUseZCut2 = + aBase->string(GDMLPlugin_Ellipsoid::USE_ZCUT2_ID()); + AttributeDoublePtr anAttrZCut2 = + aBase->real(GDMLPlugin_Ellipsoid::ZCUT2_ID()); bool isZCut1 = !anAttrUseZCut1->value().empty(); bool isZCut2 = !anAttrUseZCut2->value().empty(); @@ -114,30 +109,32 @@ void GDMLAPI_Ellipsoid::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ")" << std::endl; if (isZCut1 && !isZCut2) - theDumper << theDumper.name(aBase) << ".setZCut1(" << anAttrZCut1 << ")" << std::endl; + theDumper << theDumper.name(aBase) << ".setZCut1(" << anAttrZCut1 << ")" + << std::endl; else if (!isZCut1 && isZCut2) - theDumper << theDumper.name(aBase) << ".setZCut2(" << anAttrZCut2 << ")" << std::endl; + theDumper << theDumper.name(aBase) << ".setZCut2(" << anAttrZCut2 << ")" + << std::endl; } } - //================================================================================================== -EllipsoidPtr addEllipsoid(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ) -{ - std::shared_ptr aFeature = thePart->addFeature(GDMLAPI_Ellipsoid::ID()); +EllipsoidPtr addEllipsoid(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theAX, + const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ) { + std::shared_ptr aFeature = + thePart->addFeature(GDMLAPI_Ellipsoid::ID()); return EllipsoidPtr(new GDMLAPI_Ellipsoid(aFeature, theAX, theBY, theCZ)); } -EllipsoidPtr addEllipsoid(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ, - const ModelHighAPI_Double& theZCut1, - const ModelHighAPI_Double& theZCut2) -{ - std::shared_ptr aFeature = thePart->addFeature(GDMLAPI_Ellipsoid::ID()); - return EllipsoidPtr(new GDMLAPI_Ellipsoid(aFeature, theAX, theBY, theCZ, theZCut1, theZCut2)); +EllipsoidPtr addEllipsoid(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theAX, + const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ, + const ModelHighAPI_Double &theZCut1, + const ModelHighAPI_Double &theZCut2) { + std::shared_ptr aFeature = + thePart->addFeature(GDMLAPI_Ellipsoid::ID()); + return EllipsoidPtr( + new GDMLAPI_Ellipsoid(aFeature, theAX, theBY, theCZ, theZCut1, theZCut2)); } diff --git a/src/GDMLAPI/GDMLAPI_Ellipsoid.h b/src/GDMLAPI/GDMLAPI_Ellipsoid.h index aa779e289..5c9048b3b 100644 --- a/src/GDMLAPI/GDMLAPI_Ellipsoid.h +++ b/src/GDMLAPI/GDMLAPI_Ellipsoid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLAPI_Ellipsoid_H_ @@ -32,73 +33,65 @@ class ModelHighAPI_Double; /// \class GDMLAPI_Ellipsoid /// \ingroup CPPHighAPI /// \brief Interface for primitive Ellipsoid feature. -class GDMLAPI_Ellipsoid: public ModelHighAPI_Interface -{ +class GDMLAPI_Ellipsoid : public ModelHighAPI_Interface { public: /// Constructor without values. GDMLAPI_EXPORT - explicit GDMLAPI_Ellipsoid(const std::shared_ptr& theFeature); + explicit GDMLAPI_Ellipsoid( + const std::shared_ptr &theFeature); /// Constructor with values. GDMLAPI_EXPORT - explicit GDMLAPI_Ellipsoid(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ); + explicit GDMLAPI_Ellipsoid( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theAX, const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ); /// Constructor with values. GDMLAPI_EXPORT - explicit GDMLAPI_Ellipsoid(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ, - const ModelHighAPI_Double& theZCut1, - const ModelHighAPI_Double& theZCut2); + explicit GDMLAPI_Ellipsoid( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theAX, const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ, const ModelHighAPI_Double &theZCut1, + const ModelHighAPI_Double &theZCut2); /// Destructor. GDMLAPI_EXPORT virtual ~GDMLAPI_Ellipsoid(); - INTERFACE_7(GDMLPlugin_Ellipsoid::ID(), - ax, GDMLPlugin_Ellipsoid::AX_ID(), - ModelAPI_AttributeDouble, - /** Ellipsoid size along X axis */, - by, GDMLPlugin_Ellipsoid::BY_ID(), - ModelAPI_AttributeDouble, - /** Ellipsoid size along Y axis */, - cz, GDMLPlugin_Ellipsoid::CZ_ID(), - ModelAPI_AttributeDouble, - /** Ellipsoid size along Z axis */, - useZCut1, GDMLPlugin_Ellipsoid::USE_ZCUT1_ID(), - ModelAPI_AttributeString, - /** First cut of the ellipsoid along Z axis */, - zCut1, GDMLPlugin_Ellipsoid::ZCUT1_ID(), - ModelAPI_AttributeDouble, - /** Position of the first cut */, - useZCut2, GDMLPlugin_Ellipsoid::USE_ZCUT2_ID(), - ModelAPI_AttributeString, - /** Second cut of the ellipsoid along Z axis */, - zCut2, GDMLPlugin_Ellipsoid::ZCUT2_ID(), - ModelAPI_AttributeDouble, - /** Position of the second cut */) + INTERFACE_7(GDMLPlugin_Ellipsoid::ID(), ax, GDMLPlugin_Ellipsoid::AX_ID(), + ModelAPI_AttributeDouble, + /** Ellipsoid size along X axis */, by, + GDMLPlugin_Ellipsoid::BY_ID(), ModelAPI_AttributeDouble, + /** Ellipsoid size along Y axis */, cz, + GDMLPlugin_Ellipsoid::CZ_ID(), ModelAPI_AttributeDouble, + /** Ellipsoid size along Z axis */, useZCut1, + GDMLPlugin_Ellipsoid::USE_ZCUT1_ID(), ModelAPI_AttributeString, + /** First cut of the ellipsoid along Z axis */, zCut1, + GDMLPlugin_Ellipsoid::ZCUT1_ID(), ModelAPI_AttributeDouble, + /** Position of the first cut */, useZCut2, + GDMLPlugin_Ellipsoid::USE_ZCUT2_ID(), ModelAPI_AttributeString, + /** Second cut of the ellipsoid along Z axis */, zCut2, + GDMLPlugin_Ellipsoid::ZCUT2_ID(), ModelAPI_AttributeDouble, + /** Position of the second cut */) /// Set dimensions GDMLAPI_EXPORT - void setSizes(const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ); + void setSizes(const ModelHighAPI_Double &theAX, + const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ); /// Set Z cut no.1 GDMLAPI_EXPORT - void setZCut1(const ModelHighAPI_Double& theZCut1); + void setZCut1(const ModelHighAPI_Double &theZCut1); /// Set Z cut no.2 GDMLAPI_EXPORT - void setZCut2(const ModelHighAPI_Double& theZCut2); + void setZCut2(const ModelHighAPI_Double &theZCut2); /// Dump wrapped feature GDMLAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Ellipsoid object @@ -107,18 +100,18 @@ typedef std::shared_ptr EllipsoidPtr; /// \ingroup CPPHighAPI /// \brief Create GDML Ellipsoid feature. GDMLAPI_EXPORT -EllipsoidPtr addEllipsoid(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ); +EllipsoidPtr addEllipsoid(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theAX, + const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ); /// \ingroup CPPHighAPI /// \brief Create GDML Ellipsoid feature. GDMLAPI_EXPORT -EllipsoidPtr addEllipsoid(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theAX, - const ModelHighAPI_Double& theBY, - const ModelHighAPI_Double& theCZ, - const ModelHighAPI_Double& theZCut1, - const ModelHighAPI_Double& theZCut2); +EllipsoidPtr addEllipsoid(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theAX, + const ModelHighAPI_Double &theBY, + const ModelHighAPI_Double &theCZ, + const ModelHighAPI_Double &theZCut1, + const ModelHighAPI_Double &theZCut2); #endif // GDMLAPI_Ellipsoid_H_ diff --git a/src/GDMLAPI/GDMLAPI_swig.h b/src/GDMLAPI/GDMLAPI_swig.h index 98003cf52..005bf8224 100644 --- a/src/GDMLAPI/GDMLAPI_swig.h +++ b/src/GDMLAPI/GDMLAPI_swig.h @@ -14,17 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLAPI_swig_H_ #define GDMLAPI_swig_H_ - #include +#include - #include "GDMLAPI.h" - #include "GDMLAPI_ConeSegment.h" - #include "GDMLAPI_Ellipsoid.h" +#include "GDMLAPI.h" +#include "GDMLAPI_ConeSegment.h" +#include "GDMLAPI_Ellipsoid.h" #endif // GDMLAPI_swig_H_ - diff --git a/src/GDMLPlugin/GDMLPlugin.h b/src/GDMLPlugin/GDMLPlugin.h index d478cc36b..ac320fb86 100644 --- a/src/GDMLPlugin/GDMLPlugin.h +++ b/src/GDMLPlugin/GDMLPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLPLUGIN_H @@ -22,13 +23,13 @@ #if defined GDMLPLUGIN_EXPORTS #if defined WIN32 -#define GDMLPLUGIN_EXPORT __declspec( dllexport ) +#define GDMLPLUGIN_EXPORT __declspec(dllexport) #else #define GDMLPLUGIN_EXPORT #endif #else #if defined WIN32 -#define GDMLPLUGIN_EXPORT __declspec( dllimport ) +#define GDMLPLUGIN_EXPORT __declspec(dllimport) #else #define GDMLPLUGIN_EXPORT #endif diff --git a/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp b/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp index e52a1a1b1..817319afd 100644 --- a/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp +++ b/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp @@ -14,35 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include +#include #include #include -#include //================================================================================================= -GDMLPlugin_ConeSegment::GDMLPlugin_ConeSegment() // Nothing to do during instantiation -{ -} +GDMLPlugin_ConeSegment::GDMLPlugin_ConeSegment() // Nothing to do during + // instantiation +{} //================================================================================================= -void GDMLPlugin_ConeSegment::initAttributes() -{ - data()->addAttribute(GDMLPlugin_ConeSegment::RMIN1_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_ConeSegment::RMAX1_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_ConeSegment::RMIN2_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_ConeSegment::RMAX2_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_ConeSegment::Z_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_ConeSegment::STARTPHI_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_ConeSegment::DELTAPHI_ID(), ModelAPI_AttributeDouble::typeId()); +void GDMLPlugin_ConeSegment::initAttributes() { + data()->addAttribute(GDMLPlugin_ConeSegment::RMIN1_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_ConeSegment::RMAX1_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_ConeSegment::RMIN2_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_ConeSegment::RMAX2_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_ConeSegment::Z_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_ConeSegment::STARTPHI_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_ConeSegment::DELTAPHI_ID(), + ModelAPI_AttributeDouble::typeId()); } //================================================================================================= -void GDMLPlugin_ConeSegment::execute() -{ +void GDMLPlugin_ConeSegment::execute() { double aRMin1 = real(GDMLPlugin_ConeSegment::RMIN1_ID())->value(); double aRMax1 = real(GDMLPlugin_ConeSegment::RMAX1_ID())->value(); double aRMin2 = real(GDMLPlugin_ConeSegment::RMIN2_ID())->value(); @@ -52,13 +58,11 @@ void GDMLPlugin_ConeSegment::execute() double aDeltaPhi = real(GDMLPlugin_ConeSegment::DELTAPHI_ID())->value(); std::shared_ptr aConeSegmentAlgo = - std::shared_ptr(new GeomAlgoAPI_ConeSegment(aRMin1, aRMax1, - aRMin2, aRMax2, - aZ, - aStartPhi, aDeltaPhi)); + std::shared_ptr(new GeomAlgoAPI_ConeSegment( + aRMin1, aRMax1, aRMin2, aRMax2, aZ, aStartPhi, aDeltaPhi)); // Check with that the arguments for aConeSegmentAlgo are correct - if (!aConeSegmentAlgo->check()){ + if (!aConeSegmentAlgo->check()) { setError(aConeSegmentAlgo->getError()); return; } @@ -66,7 +70,7 @@ void GDMLPlugin_ConeSegment::execute() aConeSegmentAlgo->build(); // Check if the creation of the cone segment went well - if(!aConeSegmentAlgo->isDone()) { + if (!aConeSegmentAlgo->isDone()) { setError(aConeSegmentAlgo->getError()); return; } @@ -76,7 +80,8 @@ void GDMLPlugin_ConeSegment::execute() } int aResultIndex = 0; - ResultBodyPtr aResultConeSegment = document()->createBody(data(), aResultIndex); + ResultBodyPtr aResultConeSegment = + document()->createBody(data(), aResultIndex); loadNamingDS(aConeSegmentAlgo, aResultConeSegment); setResult(aResultConeSegment, aResultIndex); } @@ -84,8 +89,7 @@ void GDMLPlugin_ConeSegment::execute() //================================================================================================= void GDMLPlugin_ConeSegment::loadNamingDS( std::shared_ptr theConeSegmentAlgo, - std::shared_ptr theResultConeSegment) -{ + std::shared_ptr theResultConeSegment) { // Load the result theResultConeSegment->store(theConeSegmentAlgo->shape()); @@ -93,13 +97,11 @@ void GDMLPlugin_ConeSegment::loadNamingDS( theConeSegmentAlgo->prepareNamingFaces(); // Insert to faces - std::map< std::string, std::shared_ptr > listOfFaces = - theConeSegmentAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) - { + std::map> listOfFaces = + theConeSegmentAlgo->getCreatedFaces(); + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultConeSegment->generated((*it).second, (*it).first); } } - diff --git a/src/GDMLPlugin/GDMLPlugin_ConeSegment.h b/src/GDMLPlugin/GDMLPlugin_ConeSegment.h index 3c0c4fb6f..c3c22345a 100644 --- a/src/GDMLPlugin/GDMLPlugin_ConeSegment.h +++ b/src/GDMLPlugin/GDMLPlugin_ConeSegment.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLPLUGIN_CONESEGMENT_H_ #define GDMLPLUGIN_CONESEGMENT_H_ #include -#include #include +#include class GeomAPI_Shape; class ModelAPI_ResultBody; @@ -31,61 +32,51 @@ class ModelAPI_ResultBody; * \ingroup Plugins * \brief Feature for creation of a GDML ConeSegment solid. */ -class GDMLPlugin_ConeSegment : public ModelAPI_Feature -{ - public: +class GDMLPlugin_ConeSegment : public ModelAPI_Feature { +public: /// Cone segment kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONESEGMENT_ID("ConeSegment"); return MY_CONESEGMENT_ID; } /// attribute name of the inner radius at base of cone - inline static const std::string& RMIN1_ID() - { + inline static const std::string &RMIN1_ID() { static const std::string MY_RMIN1_ID("rmin1"); return MY_RMIN1_ID; } /// attribute name of the outer radius at base of cone - inline static const std::string& RMAX1_ID() - { + inline static const std::string &RMAX1_ID() { static const std::string MY_RMAX1_ID("rmax1"); return MY_RMAX1_ID; } /// attribute name of the inner radius at top of cone - inline static const std::string& RMIN2_ID() - { + inline static const std::string &RMIN2_ID() { static const std::string MY_RMIN2_ID("rmin2"); return MY_RMIN2_ID; } /// attribute name of the outer radius at top of cone - inline static const std::string& RMAX2_ID() - { + inline static const std::string &RMAX2_ID() { static const std::string MY_RMAX2_ID("rmax2"); return MY_RMAX2_ID; } /// attribute name of the height of the cone segment - inline static const std::string& Z_ID() - { + inline static const std::string &Z_ID() { static const std::string MY_Z_ID("z"); return MY_Z_ID; } /// attribute name of the start angle of the segment - inline static const std::string& STARTPHI_ID() - { + inline static const std::string &STARTPHI_ID() { static const std::string MY_STARTPHI_ID("startphi"); return MY_STARTPHI_ID; } /// attribute name of the angle of the segment - inline static const std::string& DELTAPHI_ID() - { + inline static const std::string &DELTAPHI_ID() { static const std::string MY_DELTAPHI_ID("deltaphi"); return MY_DELTAPHI_ID; } /// Returns the kind of a feature - GDMLPLUGIN_EXPORT virtual const std::string& getKind() - { + GDMLPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = GDMLPlugin_ConeSegment::ID(); return MY_KIND; } @@ -93,17 +84,17 @@ class GDMLPlugin_ConeSegment : public ModelAPI_Feature /// Creates a new part document if needed GDMLPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes GDMLPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation GDMLPlugin_ConeSegment(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theConeSegmentAlgo, std::shared_ptr theResultConeSegment); - }; #endif // GDMLPLUGIN_CONESEGMENT_H_ diff --git a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp index 19066f21f..5136509dd 100644 --- a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp +++ b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp @@ -14,40 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include -#include #include #include +#include +#include #include //================================================================================================= -GDMLPlugin_Ellipsoid::GDMLPlugin_Ellipsoid() // Nothing to do during instantiation -{ -} +GDMLPlugin_Ellipsoid::GDMLPlugin_Ellipsoid() // Nothing to do during + // instantiation +{} //================================================================================================= -void GDMLPlugin_Ellipsoid::initAttributes() -{ - data()->addAttribute(GDMLPlugin_Ellipsoid::AX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_Ellipsoid::BY_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_Ellipsoid::CZ_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_Ellipsoid::USE_ZCUT1_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(GDMLPlugin_Ellipsoid::ZCUT1_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(GDMLPlugin_Ellipsoid::USE_ZCUT2_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(GDMLPlugin_Ellipsoid::ZCUT2_ID(), ModelAPI_AttributeDouble::typeId()); +void GDMLPlugin_Ellipsoid::initAttributes() { + data()->addAttribute(GDMLPlugin_Ellipsoid::AX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_Ellipsoid::BY_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_Ellipsoid::CZ_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_Ellipsoid::USE_ZCUT1_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(GDMLPlugin_Ellipsoid::ZCUT1_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(GDMLPlugin_Ellipsoid::USE_ZCUT2_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(GDMLPlugin_Ellipsoid::ZCUT2_ID(), + ModelAPI_AttributeDouble::typeId()); } //================================================================================================= -void GDMLPlugin_Ellipsoid::execute() -{ +void GDMLPlugin_Ellipsoid::execute() { std::shared_ptr anEllipsoidAlgo; double aAx = real(AX_ID())->value(); @@ -59,19 +65,19 @@ void GDMLPlugin_Ellipsoid::execute() double aZCut1 = 0.; if (useZCut1.empty()) { - aZCut1 = aCz /2.; + aZCut1 = aCz / 2.; } else { aZCut1 = real(ZCUT1_ID())->value(); } double aZCut2 = 0.; if (useZCut2.empty()) { - aZCut2 = aCz /2.; + aZCut2 = aCz / 2.; } else { aZCut2 = real(ZCUT2_ID())->value(); } anEllipsoidAlgo = std::shared_ptr( - new GeomAlgoAPI_Ellipsoid(aAx, aBy, aCz, aZCut1, aZCut2)); + new GeomAlgoAPI_Ellipsoid(aAx, aBy, aCz, aZCut1, aZCut2)); // Check with that the arguments for anEllipsoidAlgo are correct if (!anEllipsoidAlgo->check()) { @@ -97,13 +103,12 @@ void GDMLPlugin_Ellipsoid::execute() ResultBodyPtr aResultEllipsoid = document()->createBody(data(), aResultIndex); loadNamingDS(anEllipsoidAlgo, aResultEllipsoid); setResult(aResultEllipsoid, aResultIndex); - } //================================================================================================= -void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr theEllipsoidAlgo, - std::shared_ptr theResultEllipsoid) -{ +void GDMLPlugin_Ellipsoid::loadNamingDS( + std::shared_ptr theEllipsoidAlgo, + std::shared_ptr theResultEllipsoid) { // Load the result theResultEllipsoid->store(theEllipsoidAlgo->shape()); @@ -112,28 +117,25 @@ void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr t // Insert to faces // Naming for faces and edges - std::map< std::string, std::shared_ptr > listOfFaces = + std::map> listOfFaces = theEllipsoidAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it!=listOfFaces.end(); - ++it) - { + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultEllipsoid->generated((*it).second, (*it).first); } // Naming vertices GeomAPI_DataMapOfShapeShape aVertices; int anIndex = 1; - for (GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX); - aVertExp.more(); - aVertExp.next()) - { + for (GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), + GeomAPI_Shape::VERTEX); + aVertExp.more(); aVertExp.next()) { if (!aVertices.isBound(aVertExp.current())) { std::ostringstream aStream; - aStream<<"Vertex_"<generated(aVertExp.current(), aStream.str()); aVertices.bind(aVertExp.current(), aVertExp.current()); } } } - diff --git a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h index 468438b21..76bbd6871 100644 --- a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h +++ b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLPLUGIN_ELLIPSOID_H_ #define GDMLPLUGIN_ELLIPSOID_H_ #include -#include #include +#include class GeomAPI_Shape; class ModelAPI_ResultBody; @@ -31,61 +32,51 @@ class ModelAPI_ResultBody; * \ingroup Plugins * \brief Feature for creation of a GDML Ellipsoid solid. */ -class GDMLPlugin_Ellipsoid : public ModelAPI_Feature -{ - public: +class GDMLPlugin_Ellipsoid : public ModelAPI_Feature { +public: /// Cone segment kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONESEGMENT_ID("Ellipsoid"); return MY_CONESEGMENT_ID; } /// attribute name of the inner radius at base of cone - inline static const std::string& AX_ID() - { + inline static const std::string &AX_ID() { static const std::string MY_AX_ID("ax"); return MY_AX_ID; } /// attribute name of the outer radius at base of cone - inline static const std::string& BY_ID() - { + inline static const std::string &BY_ID() { static const std::string MY_BY_ID("by"); return MY_BY_ID; } /// attribute name of the inner radius at top of cone - inline static const std::string& CZ_ID() - { + inline static const std::string &CZ_ID() { static const std::string MY_CZ_ID("cz"); return MY_CZ_ID; } /// attribute name of the outer radius at top of cone - inline static const std::string& ZCUT1_ID() - { + inline static const std::string &ZCUT1_ID() { static const std::string MY_ZCUT1_ID("zcut1"); return MY_ZCUT1_ID; } /// attribute name of the outer radius at top of cone - inline static const std::string& USE_ZCUT1_ID() - { + inline static const std::string &USE_ZCUT1_ID() { static const std::string MY_USE_ZCUT1_ID("use_zcut1"); return MY_USE_ZCUT1_ID; } /// attribute name of the outer radius at top of cone - inline static const std::string& USE_ZCUT2_ID() - { + inline static const std::string &USE_ZCUT2_ID() { static const std::string MY_USE_ZCUT2_ID("use_zcut2"); return MY_USE_ZCUT2_ID; } /// attribute name of the outer radius at top of cone - inline static const std::string& ZCUT2_ID() - { + inline static const std::string &ZCUT2_ID() { static const std::string MY_ZCUT2_ID("zcut2"); return MY_ZCUT2_ID; } /// Returns the kind of a feature - GDMLPLUGIN_EXPORT virtual const std::string& getKind() - { + GDMLPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = GDMLPlugin_Ellipsoid::ID(); return MY_KIND; } @@ -93,17 +84,17 @@ class GDMLPlugin_Ellipsoid : public ModelAPI_Feature /// Creates a new part document if needed GDMLPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes GDMLPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation GDMLPlugin_Ellipsoid(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theEllipsoidAlgo, std::shared_ptr theResultEllipsoid); - }; #endif // GDMLPLUGIN_ELLIPSOID_H_ diff --git a/src/GDMLPlugin/GDMLPlugin_Plugin.cpp b/src/GDMLPlugin/GDMLPlugin_Plugin.cpp index 9c6ec09a7..66135a52b 100644 --- a/src/GDMLPlugin/GDMLPlugin_Plugin.cpp +++ b/src/GDMLPlugin/GDMLPlugin_Plugin.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,16 +26,14 @@ #include // the only created instance of this plugin -static GDMLPlugin_Plugin* MY_GDML_INSTANCE = new GDMLPlugin_Plugin(); +static GDMLPlugin_Plugin *MY_GDML_INSTANCE = new GDMLPlugin_Plugin(); -GDMLPlugin_Plugin::GDMLPlugin_Plugin() -{ +GDMLPlugin_Plugin::GDMLPlugin_Plugin() { // register this plugin ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr GDMLPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr GDMLPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == GDMLPlugin_ConeSegment::ID()) { return FeaturePtr(new GDMLPlugin_ConeSegment); } else if (theFeatureID == GDMLPlugin_Ellipsoid::ID()) { @@ -44,4 +43,3 @@ FeaturePtr GDMLPlugin_Plugin::createFeature(std::string theFeatureID) // feature of such kind is not found return FeaturePtr(); } - diff --git a/src/GDMLPlugin/GDMLPlugin_Plugin.h b/src/GDMLPlugin/GDMLPlugin_Plugin.h index 7c4d26436..6da72206c 100644 --- a/src/GDMLPlugin/GDMLPlugin_Plugin.h +++ b/src/GDMLPlugin/GDMLPlugin_Plugin.h @@ -14,27 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GDMLPLUGIN_PLUGIN_H_ #define GDMLPLUGIN_PLUGIN_H_ #include "GDMLPlugin.h" -#include #include +#include /**\class GDMLPlugin_Plugin * \ingroup Plugins * \brief The main class managing GDML Features as plugins. */ -class GDMLPLUGIN_EXPORT GDMLPlugin_Plugin : public ModelAPI_Plugin -{ - public: +class GDMLPLUGIN_EXPORT GDMLPlugin_Plugin : public ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); - public: +public: /// Default constructor GDMLPlugin_Plugin(); }; diff --git a/src/GDMLPlugin/doc/TUI_coneFeature.rst b/src/GDMLPlugin/doc/TUI_coneFeature.rst index d8268fc94..924fd98dc 100644 --- a/src/GDMLPlugin/doc/TUI_coneFeature.rst +++ b/src/GDMLPlugin/doc/TUI_coneFeature.rst @@ -8,5 +8,4 @@ Create Cone :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/GDMLPlugin/doc/TUI_ellipsoidFeature.rst b/src/GDMLPlugin/doc/TUI_ellipsoidFeature.rst index 54b85d6b0..7d00bab56 100644 --- a/src/GDMLPlugin/doc/TUI_ellipsoidFeature.rst +++ b/src/GDMLPlugin/doc/TUI_ellipsoidFeature.rst @@ -8,5 +8,4 @@ Create Cone :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/GDMLPlugin/doc/coneFeature.rst b/src/GDMLPlugin/doc/coneFeature.rst index 8eb04fe5f..32ade024b 100644 --- a/src/GDMLPlugin/doc/coneFeature.rst +++ b/src/GDMLPlugin/doc/coneFeature.rst @@ -12,13 +12,13 @@ To create a Cone segment in the active part: .. figure:: images/cone_btn.png :align: center - **Cone segment** button + **Cone segment** button The following property panel will be opened: .. figure:: images/Cone_panel.png :align: center - + **Cone property panel** The property panel contains an image which explains the meaning of input values: @@ -30,7 +30,7 @@ The property panel contains an image which explains the meaning of input values: - **deltaphi** - arc angle of the cone segment. **TUI Command**: *model.addConeSegment(Part_doc, rmin1, rmax1, rmin2, rmax2, z, startphi, deltaphi)* - + **Arguments**: Part + Rmin of base + Rmax of base + Rmin of top + Rmax of top + height + start angle + arc angle. Result @@ -40,7 +40,7 @@ The Result of the operation will be a SOLID. .. figure:: images/CreatedCone.png :align: center - + Cone created **See Also** a sample TUI Script of :ref:`tui_create_conesegment` operation. diff --git a/src/GDMLPlugin/doc/ellipsoidFeature.rst b/src/GDMLPlugin/doc/ellipsoidFeature.rst index a92a9ec2d..92800723b 100644 --- a/src/GDMLPlugin/doc/ellipsoidFeature.rst +++ b/src/GDMLPlugin/doc/ellipsoidFeature.rst @@ -12,13 +12,13 @@ To create an Ellipsoid in the active part: .. figure:: images/ellips_btn.png :align: center - **Ellipsoid** button + **Ellipsoid** button The following property panel will be opened: .. figure:: images/Ellipsoid.png :align: center - + **Ellipsoid property panel** The property panel contains an image, which explains the meaning of input values: @@ -30,7 +30,7 @@ The property panel contains an image, which explains the meaning of input values - **zcut2** - z-coordinate of an upper cut plane. **TUI Command**: *model.addEllipsoid(Part_doc, ax, by, cz)* - + **Arguments**: Part + ax + by + cz. Result @@ -40,7 +40,7 @@ The Result of the operation will be a SOLID. .. figure:: images/CreatedEllipsoid.png :align: center - + Ellipsoid created **See Also** a sample TUI Script of :ref:`tui_create_ellipsoid` operation. diff --git a/src/GDMLPlugin/ellipsoid_widget.xml b/src/GDMLPlugin/ellipsoid_widget.xml index cef582275..cfb30c9a8 100644 --- a/src/GDMLPlugin/ellipsoid_widget.xml +++ b/src/GDMLPlugin/ellipsoid_widget.xml @@ -17,20 +17,20 @@ step="1.0" default="40.0" tooltip="Enter the z semi axis length"> - + - - diff --git a/src/GeomAPI/CMakeLists.txt b/src/GeomAPI/CMakeLists.txt index a6826e45d..6221ec8d2 100644 --- a/src/GeomAPI/CMakeLists.txt +++ b/src/GeomAPI/CMakeLists.txt @@ -173,16 +173,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/GeomAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/GeomAPI/GeomAPI.h b/src/GeomAPI/GeomAPI.h index 704e96617..eac90aef1 100644 --- a/src/GeomAPI/GeomAPI.h +++ b/src/GeomAPI/GeomAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMAPI_H @@ -22,13 +23,13 @@ #if defined GEOMAPI_EXPORTS #if defined WIN32 -#define GEOMAPI_EXPORT __declspec( dllexport ) +#define GEOMAPI_EXPORT __declspec(dllexport) #else #define GEOMAPI_EXPORT #endif #else #if defined WIN32 -#define GEOMAPI_EXPORT __declspec( dllimport ) +#define GEOMAPI_EXPORT __declspec(dllimport) #else #define GEOMAPI_EXPORT #endif diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index 275f62444..211c1a024 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -27,60 +28,59 @@ #include #include +#include #include -#include #include -#include +#include -#include #include +#include #include #include #include +#include #include #include #include #include -#include #include const double tolerance = 1e-7; -const int CONSTRAINT_TEXT_HEIGHT = 28; /// the text height of the constraint -const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance +const int CONSTRAINT_TEXT_HEIGHT = 28; /// the text height of the constraint +const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = + 20; /// the text selection tolerance GeomAPI_AISObject::GeomAPI_AISObject() - : GeomAPI_Interface(new Handle(AIS_InteractiveObject)()) -{ -} + : GeomAPI_Interface(new Handle(AIS_InteractiveObject)()) {} -GeomAPI_AISObject::~GeomAPI_AISObject() -{ +GeomAPI_AISObject::~GeomAPI_AISObject() { if (!empty()) { // This is necessary for correct deletion of Handle entity. // Without this Handle does not decremented counter to 0 - Handle(AIS_InteractiveObject) *anAIS = implPtr(); + Handle(AIS_InteractiveObject) *anAIS = + implPtr(); anAIS->Nullify(); } } - -void GeomAPI_AISObject::createShape(std::shared_ptr theShape) -{ - const TopoDS_Shape& aTDS = - (theShape && theShape->implPtr()) ? - theShape->impl() : TopoDS_Shape(); +void GeomAPI_AISObject::createShape(std::shared_ptr theShape) { + const TopoDS_Shape &aTDS = (theShape && theShape->implPtr()) + ? theShape->impl() + : TopoDS_Shape(); Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS); if (aShapeAIS) { - // if the AIS object is displayed in the opened local context in some mode, additional - // AIS sub objects are created there. They should be rebuild for correct selecting. - // It is possible to correct it by closing local context before the shape set and opening - // after. Another workaround to thrown down the selection and reselecting the AIS. - // If there was a problem here, try the first solution with close/open local context. + // if the AIS object is displayed in the opened local context in some + // mode, additional AIS sub objects are created there. They should be + // rebuild for correct selecting. It is possible to correct it by closing + // local context before the shape set and opening after. Another + // workaround to thrown down the selection and reselecting the AIS. If + // there was a problem here, try the first solution with close/open local + // context. aShapeAIS->Set(aTDS); aShapeAIS->Redisplay(Standard_True); @@ -92,14 +92,14 @@ void GeomAPI_AISObject::createShape(std::shared_ptr theShape) if (aDrawer->HasOwnPointAspect()) aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS); else - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); aDrawer->SetIsoOnPlane(false); setImpl(new Handle(AIS_InteractiveObject)(aShape)); } } -std::shared_ptr GeomAPI_AISObject::getShape() const -{ +std::shared_ptr GeomAPI_AISObject::getShape() const { std::shared_ptr aResult; Handle(AIS_InteractiveObject) anAIS = impl(); @@ -113,11 +113,11 @@ std::shared_ptr GeomAPI_AISObject::getShape() const return aResult; } -void GeomAPI_AISObject::createDistance(std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint, - std::shared_ptr theFlyoutPoint, - std::shared_ptr thePlane, double theDistance) -{ +void GeomAPI_AISObject::createDistance( + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint, + std::shared_ptr theFlyoutPoint, + std::shared_ptr thePlane, double theDistance) { double aFlyout = 0; if (theFlyoutPoint) { double aDist = 0.0; @@ -129,9 +129,10 @@ void GeomAPI_AISObject::createDistance(std::shared_ptr theStartPoin aDist = aLine->distance(theFlyoutPoint); } - std::shared_ptr aLineDir = theEndPoint->xyz()->decreased(theStartPoint->xyz()); - std::shared_ptr aFOutDir = theFlyoutPoint->xyz()->decreased( - theStartPoint->xyz()); + std::shared_ptr aLineDir = + theEndPoint->xyz()->decreased(theStartPoint->xyz()); + std::shared_ptr aFOutDir = + theFlyoutPoint->xyz()->decreased(theStartPoint->xyz()); std::shared_ptr aNorm = thePlane->direction()->xyz(); if (aLineDir->cross(aFOutDir)->dot(aNorm) < 0) aDist = -aDist; @@ -140,10 +141,9 @@ void GeomAPI_AISObject::createDistance(std::shared_ptr theStartPoin Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) { - Handle(PrsDim_LengthDimension) aDimAIS = - new PrsDim_LengthDimension(theStartPoint->impl(), - theEndPoint->impl(), - thePlane->impl()); + Handle(PrsDim_LengthDimension) aDimAIS = new PrsDim_LengthDimension( + theStartPoint->impl(), theEndPoint->impl(), + thePlane->impl()); aDimAIS->SetCustomValue(theDistance); Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); @@ -160,9 +160,11 @@ void GeomAPI_AISObject::createDistance(std::shared_ptr theStartPoin setImpl(new Handle(AIS_InteractiveObject)(aDimAIS)); } else { // update presentation - Handle(PrsDim_LengthDimension) aDimAIS = Handle(PrsDim_LengthDimension)::DownCast(anAIS); + Handle(PrsDim_LengthDimension) aDimAIS = + Handle(PrsDim_LengthDimension)::DownCast(anAIS); if (!aDimAIS.IsNull()) { - aDimAIS->SetMeasuredGeometry(theStartPoint->impl(), theEndPoint->impl(), + aDimAIS->SetMeasuredGeometry(theStartPoint->impl(), + theEndPoint->impl(), thePlane->impl()); aDimAIS->SetCustomValue(theDistance); aDimAIS->SetFlyout(aFlyout); @@ -172,13 +174,13 @@ void GeomAPI_AISObject::createDistance(std::shared_ptr theStartPoin } } -bool GeomAPI_AISObject::isEmptyDistanceGeometry() -{ +bool GeomAPI_AISObject::isEmptyDistanceGeometry() { bool anEmpty = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { - Handle(PrsDim_LengthDimension) aDimAIS = Handle(PrsDim_LengthDimension)::DownCast(anAIS); + Handle(PrsDim_LengthDimension) aDimAIS = + Handle(PrsDim_LengthDimension)::DownCast(anAIS); if (!aDimAIS.IsNull()) { anEmpty = !aDimAIS->IsValid(); } @@ -187,10 +189,9 @@ bool GeomAPI_AISObject::isEmptyDistanceGeometry() return anEmpty; } -void GeomAPI_AISObject::createRadius(std::shared_ptr theCircle, - std::shared_ptr theFlyoutPoint, - double theRadius) -{ +void GeomAPI_AISObject::createRadius( + std::shared_ptr theCircle, + std::shared_ptr theFlyoutPoint, double theRadius) { std::shared_ptr aCenter = theCircle->center(); // TODO: a bug in AIS_RadiusDimension: @@ -198,7 +199,8 @@ void GeomAPI_AISObject::createRadius(std::shared_ptr theCircle, // But we need exactly this case... // We want to show a radius dimension starting from the circle centre and // ending at the user-defined point. - // Also, if anchor point coincides with myP2, the radius dimension is not displayed at all. + // Also, if anchor point coincides with myP2, the radius dimension is not + // displayed at all. std::shared_ptr anAnchor = theCircle->project(theFlyoutPoint); std::shared_ptr anAnchorXYZ = anAnchor->xyz(); anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz()); @@ -210,8 +212,8 @@ void GeomAPI_AISObject::createRadius(std::shared_ptr theCircle, Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) { - Handle(PrsDim_RadiusDimension) aDimAIS = new PrsDim_RadiusDimension(theCircle->impl(), - anAnchor->impl()); + Handle(PrsDim_RadiusDimension) aDimAIS = new PrsDim_RadiusDimension( + theCircle->impl(), anAnchor->impl()); aDimAIS->SetCustomValue(theRadius); Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); @@ -227,20 +229,22 @@ void GeomAPI_AISObject::createRadius(std::shared_ptr theCircle, setImpl(new Handle(AIS_InteractiveObject)(aDimAIS)); } else { // update presentation - Handle(PrsDim_RadiusDimension) aDimAIS = Handle(PrsDim_RadiusDimension)::DownCast(anAIS); + Handle(PrsDim_RadiusDimension) aDimAIS = + Handle(PrsDim_RadiusDimension)::DownCast(anAIS); if (!aDimAIS.IsNull()) { - aDimAIS->SetMeasuredGeometry(theCircle->impl(), anAnchor->impl()); + aDimAIS->SetMeasuredGeometry(theCircle->impl(), + anAnchor->impl()); aDimAIS->SetCustomValue(theRadius); aDimAIS->Redisplay(Standard_True); } } } -void GeomAPI_AISObject::createParallel(std::shared_ptr theLine1, - std::shared_ptr theLine2, - std::shared_ptr theFlyoutPoint, - std::shared_ptr thePlane) -{ +void GeomAPI_AISObject::createParallel( + std::shared_ptr theLine1, + std::shared_ptr theLine2, + std::shared_ptr theFlyoutPoint, + std::shared_ptr thePlane) { Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl()); Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) { @@ -251,7 +255,8 @@ void GeomAPI_AISObject::createParallel(std::shared_ptr theLine1, setImpl(new Handle(AIS_InteractiveObject)(aParallel)); } else { - Handle(PrsDim_ParallelRelation) aParallel = Handle(PrsDim_ParallelRelation)::DownCast(anAIS); + Handle(PrsDim_ParallelRelation) aParallel = + Handle(PrsDim_ParallelRelation)::DownCast(anAIS); if (!aParallel.IsNull()) { aParallel->SetFirstShape(theLine1->impl()); aParallel->SetSecondShape(theLine2->impl()); @@ -263,15 +268,17 @@ void GeomAPI_AISObject::createParallel(std::shared_ptr theLine1, } } -void GeomAPI_AISObject::createPerpendicular(std::shared_ptr theLine1, - std::shared_ptr theLine2, - std::shared_ptr thePlane) -{ +void GeomAPI_AISObject::createPerpendicular( + std::shared_ptr theLine1, + std::shared_ptr theLine2, + std::shared_ptr thePlane) { Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl()); Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) { - Handle(PrsDim_PerpendicularRelation) aPerpendicular = new PrsDim_PerpendicularRelation( - theLine1->impl(), theLine2->impl(), aPlane); + Handle(PrsDim_PerpendicularRelation) aPerpendicular = + new PrsDim_PerpendicularRelation(theLine1->impl(), + theLine2->impl(), + aPlane); setImpl(new Handle(AIS_InteractiveObject)(aPerpendicular)); } else { @@ -286,10 +293,8 @@ void GeomAPI_AISObject::createPerpendicular(std::shared_ptr theLi } } - void GeomAPI_AISObject::createFixed(std::shared_ptr theShape, - std::shared_ptr thePlane) -{ + std::shared_ptr thePlane) { Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl()); Handle(AIS_InteractiveObject) anAIS = impl(); TopoDS_Shape aShape = theShape->impl(); @@ -315,17 +320,16 @@ void GeomAPI_AISObject::createFixed(std::shared_ptr theShape, gp_Pnt aXYZ2(aXmax, aYmax, aZmax); double aDist = aXYZ1.Distance(aXYZ2); if (aDist > Precision::Confusion()) { - aFixPrs->SetArrowSize(aDist/8.); + aFixPrs->SetArrowSize(aDist / 8.); } } } -void GeomAPI_AISObject::setColor(const int& theColor) -{ +void GeomAPI_AISObject::setColor(const int &theColor) { Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) return; - Quantity_Color aColor((Quantity_NameOfColor) theColor); + Quantity_Color aColor((Quantity_NameOfColor)theColor); Handle(PrsDim_Dimension) aDimAIS = Handle(PrsDim_Dimension)::DownCast(anAIS); if (!aDimAIS.IsNull()) { aDimAIS->DimensionAspect()->SetCommonColor(aColor); @@ -337,8 +341,7 @@ void GeomAPI_AISObject::setColor(const int& theColor) anAIS->SetColor(aColor); } -double GeomAPI_AISObject::width() -{ +double GeomAPI_AISObject::width() { double aWidth = 0.0; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { @@ -347,8 +350,7 @@ double GeomAPI_AISObject::width() return aWidth; } -bool GeomAPI_AISObject::setWidth(const double& theWidth) -{ +bool GeomAPI_AISObject::setWidth(const double &theWidth) { bool isChanged = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { @@ -359,12 +361,12 @@ bool GeomAPI_AISObject::setWidth(const double& theWidth) return isChanged; } -bool GeomAPI_AISObject::setColor(int theR, int theG, int theB) -{ +bool GeomAPI_AISObject::setColor(int theR, int theG, int theB) { Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) return false; - Quantity_Color aColor(theR / 255., theG / 255., theB / 255., Quantity_TOC_RGB); + Quantity_Color aColor(theR / 255., theG / 255., theB / 255., + Quantity_TOC_RGB); Quantity_Color aCurrentColor; anAIS->Color(aCurrentColor); // do not set the same color to the presentation @@ -377,8 +379,7 @@ bool GeomAPI_AISObject::setColor(int theR, int theG, int theB) aDimAIS->DimensionAspect()->SetCommonColor(aColor); if (!aContext.IsNull()) aContext->Redisplay(aDimAIS, false); - } - else { + } else { if (!aContext.IsNull()) aContext->SetColor(anAIS, aColor, false); else @@ -387,21 +388,19 @@ bool GeomAPI_AISObject::setColor(int theR, int theG, int theB) return true; } -void GeomAPI_AISObject::getColor(int& theR, int& theG, int& theB) -{ +void GeomAPI_AISObject::getColor(int &theR, int &theG, int &theB) { Handle(AIS_InteractiveObject) anAIS = impl(); if (anAIS.IsNull()) return; Quantity_Color aColor; anAIS->Color(aColor); - theR = (int)(aColor.Red()*255.); - theG = (int)(aColor.Green()*255.); - theB = (int)(aColor.Blue()*255.); + theR = (int)(aColor.Red() * 255.); + theG = (int)(aColor.Green() * 255.); + theB = (int)(aColor.Blue() * 255.); } -bool GeomAPI_AISObject::setDeflection(const double theDeflection) -{ +bool GeomAPI_AISObject::setDeflection(const double theDeflection) { bool isModified = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { @@ -409,7 +408,7 @@ bool GeomAPI_AISObject::setDeflection(const double theDeflection) if (!anAISShape.IsNull()) { Standard_Real aCoefficient, aPreviousCoefficient; anAISShape->OwnDeviationCoefficient(aCoefficient, aPreviousCoefficient); - if (fabs(aCoefficient-theDeflection) > Precision::Confusion()) { + if (fabs(aCoefficient - theDeflection) > Precision::Confusion()) { isModified = true; anAISShape->SetOwnDeviationCoefficient(theDeflection); Handle(Prs3d_Drawer) aDrawer = anAISShape->DynamicHilightAttributes(); @@ -417,8 +416,9 @@ bool GeomAPI_AISObject::setDeflection(const double theDeflection) aDrawer->SetDeviationCoefficient(theDeflection); } // redisplay is necessary here to update presentation in all modes - // Standard True flag. Displayer uses Standard False flag. If it will be changed in - // displayer, redisplay here will not be necessary. But performance should be checked. + // Standard True flag. Displayer uses Standard False flag. If it will be + // changed in displayer, redisplay here will not be necessary. But + // performance should be checked. anAISShape->Redisplay(Standard_True); } } @@ -426,8 +426,7 @@ bool GeomAPI_AISObject::setDeflection(const double theDeflection) return isModified; } -double GeomAPI_AISObject::getDeflection() const -{ +double GeomAPI_AISObject::getDeflection() const { double aDeflection = -1; Handle(AIS_InteractiveObject) anAIS = impl(); @@ -438,8 +437,7 @@ double GeomAPI_AISObject::getDeflection() const return aDeflection; } -bool GeomAPI_AISObject::setTransparency(const double theTransparency) -{ +bool GeomAPI_AISObject::setTransparency(const double theTransparency) { bool isModified = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { @@ -451,8 +449,9 @@ bool GeomAPI_AISObject::setTransparency(const double theTransparency) //>SetOwnDeviationCoefficient(theTransparency); isModified = true; // redisplay is necessary here to update presentation in all modes - // Standard True flag. Displayer uses Standard False flag. If it will be changed in - // displayer, redisplay here will not be necessary. But performance should be checked. + // Standard True flag. Displayer uses Standard False flag. If it will be + // changed in displayer, redisplay here will not be necessary. But + // performance should be checked. anAISShape->Redisplay(Standard_True); } } @@ -460,8 +459,7 @@ bool GeomAPI_AISObject::setTransparency(const double theTransparency) return isModified; } -double GeomAPI_AISObject::getTransparency() const -{ +double GeomAPI_AISObject::getTransparency() const { double aTransparency = 0; Handle(AIS_InteractiveObject) anAIS = impl(); @@ -471,20 +469,19 @@ double GeomAPI_AISObject::getTransparency() const return aTransparency; } - -bool GeomAPI_AISObject::empty() const -{ - Handle(AIS_InteractiveObject) anAIS = const_cast(this) - ->impl(); +bool GeomAPI_AISObject::empty() const { + Handle(AIS_InteractiveObject) anAIS = + const_cast(this) + ->impl(); if (anAIS.IsNull()) return true; return false; } -int GeomAPI_AISObject::getShapeType() const -{ - Handle(AIS_InteractiveObject) anAIS = const_cast(this) - ->impl(); +int GeomAPI_AISObject::getShapeType() const { + Handle(AIS_InteractiveObject) anAIS = + const_cast(this) + ->impl(); if (!anAIS.IsNull()) { Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(anAIS); if (!aAISShape.IsNull()) { @@ -496,8 +493,7 @@ int GeomAPI_AISObject::getShapeType() const return -1; } -void GeomAPI_AISObject::setPointMarker(int theType, double theScale) -{ +void GeomAPI_AISObject::setPointMarker(int theType, double theScale) { Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes(); @@ -507,13 +503,13 @@ void GeomAPI_AISObject::setPointMarker(int theType, double theScale) aPA->SetScale(theScale); } else { Quantity_NameOfColor aCol = Quantity_NOC_YELLOW; - aDrawer->SetPointAspect(new Prs3d_PointAspect((Aspect_TypeOfMarker)theType, aCol, theScale)); + aDrawer->SetPointAspect( + new Prs3d_PointAspect((Aspect_TypeOfMarker)theType, aCol, theScale)); } } } -bool GeomAPI_AISObject::setLineStyle(int theStyle) -{ +bool GeomAPI_AISObject::setLineStyle(int theStyle) { bool isChanged = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { @@ -539,8 +535,7 @@ bool GeomAPI_AISObject::setLineStyle(int theStyle) return isChanged; } -bool GeomAPI_AISObject::setTransparensy(double theVal) -{ +bool GeomAPI_AISObject::setTransparensy(double theVal) { bool isChanged = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { @@ -554,5 +549,5 @@ bool GeomAPI_AISObject::setTransparensy(double theVal) anAIS->SetTransparency(theVal); } } - return isChanged; + return isChanged; } diff --git a/src/GeomAPI/GeomAPI_AISObject.h b/src/GeomAPI/GeomAPI_AISObject.h index 647f0b412..ad2150fda 100644 --- a/src/GeomAPI/GeomAPI_AISObject.h +++ b/src/GeomAPI/GeomAPI_AISObject.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_AISObject_H_ @@ -35,9 +36,8 @@ class GeomAPI_Shape; * \brief Interface for AIS_InteractiveObject */ -class GeomAPI_AISObject : public GeomAPI_Interface -{ - public: +class GeomAPI_AISObject : public GeomAPI_Interface { +public: /// \brief Creation of empty AIS object GEOMAPI_EXPORT GeomAPI_AISObject(); @@ -55,20 +55,21 @@ class GeomAPI_AISObject : public GeomAPI_Interface /** \brief Creates PrsDim_LengthDimension object * \param[in] theStartPoint first point for dimension * \param[in] theEndPoint second point for dimension - * \param[in] theFlyoutPoint the flyout of dimension relative to the measured line - * \param[in] thePlane the plane which contains all points above + * \param[in] theFlyoutPoint the flyout of dimension relative to the measured + * line \param[in] thePlane the plane which contains all points above * \param[in] theDistance value of the distance to be shown */ GEOMAPI_EXPORT void createDistance(std::shared_ptr theStartPoint, std::shared_ptr theEndPoint, std::shared_ptr theFlyoutPoint, - std::shared_ptr thePlane, double theDistance); + std::shared_ptr thePlane, + double theDistance); /** - * Returns validity of the AIS distance. It is invalid if set measured geometry is not valid, - * e.g. the distance points are equal. - * \return a boolean result + * Returns validity of the AIS distance. It is invalid if set measured + * geometry is not valid, e.g. the distance points are equal. \return a + * boolean result */ GEOMAPI_EXPORT bool isEmptyDistanceGeometry(); @@ -80,7 +81,8 @@ class GeomAPI_AISObject : public GeomAPI_Interface */ GEOMAPI_EXPORT void createRadius(std::shared_ptr theCircle, - std::shared_ptr theFlyoutPoint, double theRadius); + std::shared_ptr theFlyoutPoint, + double theRadius); /** \brief Creates PrsDim_ParallelRelation object for two lines * \param[in] theLine1 first parallel line @@ -116,7 +118,7 @@ class GeomAPI_AISObject : public GeomAPI_Interface * \param[in] theColor index of the color */ GEOMAPI_EXPORT - void setColor(const int& theColor); + void setColor(const int &theColor); /** \brief Assigns the color for the shape * \param[in] theR value of the red component @@ -133,7 +135,7 @@ class GeomAPI_AISObject : public GeomAPI_Interface * \param[in] theB value of the blue component */ GEOMAPI_EXPORT - void getColor(int& theR, int& theG, int& theB); + void getColor(int &theR, int &theG, int &theB); /** \brief Assigns the deflection to the shape * \param[in] theDeflection value of deflection @@ -165,7 +167,7 @@ class GeomAPI_AISObject : public GeomAPI_Interface /// \brief Assigns the width of the lines of shape GEOMAPI_EXPORT - bool setWidth(const double& theWidth); + bool setWidth(const double &theWidth); /// \brief Checks if the object is empty GEOMAPI_EXPORT @@ -197,4 +199,3 @@ class GeomAPI_AISObject : public GeomAPI_Interface typedef std::shared_ptr AISObjectPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Angle.cpp b/src/GeomAPI/GeomAPI_Angle.cpp index 7f00a110d..7ed47481c 100644 --- a/src/GeomAPI/GeomAPI_Angle.cpp +++ b/src/GeomAPI/GeomAPI_Angle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,8 +25,8 @@ #include #include -#include #include +#include #include #include @@ -39,62 +40,57 @@ struct AngleDirections { #define MY_ANGLE implPtr() #define PI 3.1415926535897932 - -GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr& theEdge1, - const std::shared_ptr& theEdge2, - const std::shared_ptr& thePoint) -{ +GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr &theEdge1, + const std::shared_ptr &theEdge2, + const std::shared_ptr &thePoint) { gp_Pnt aPoint = thePoint->impl(); - const TopoDS_Edge& anEdge1 = theEdge1->impl(); - const TopoDS_Edge& anEdge2 = theEdge2->impl(); + const TopoDS_Edge &anEdge1 = theEdge1->impl(); + const TopoDS_Edge &anEdge2 = theEdge2->impl(); double aF1, aL1; Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aF1, aL1); double aF2, aL2; Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aF2, aL2); - AngleDirections* anAngle = new AngleDirections; + AngleDirections *anAngle = new AngleDirections; gp_Pnt aP; GeomAPI_ProjectPointOnCurve aProj1(aPoint, aCurve1); if (aProj1.NbPoints() > 0) { aCurve1->D1(aProj1.LowerDistanceParameter(), aP, anAngle->myDir1); - if (aCurve1->Value(aF1).SquareDistance(aPoint) < aCurve1->Value(aL1).SquareDistance(aPoint)) + if (aCurve1->Value(aF1).SquareDistance(aPoint) < + aCurve1->Value(aL1).SquareDistance(aPoint)) anAngle->myDir1.Reverse(); } GeomAPI_ProjectPointOnCurve aProj2(aPoint, aCurve2); if (aProj2.NbPoints() > 0) { aCurve2->D1(aProj2.LowerDistanceParameter(), aP, anAngle->myDir2); - if (aCurve2->Value(aF2).SquareDistance(aPoint) < aCurve2->Value(aL2).SquareDistance(aPoint)) + if (aCurve2->Value(aF2).SquareDistance(aPoint) < + aCurve2->Value(aL2).SquareDistance(aPoint)) anAngle->myDir2.Reverse(); } setImpl(anAngle); } -GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -{ +GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3) { gp_Pnt aPoint1 = thePoint1->impl(); gp_Pnt aPoint2 = thePoint2->impl(); gp_Pnt aPoint3 = thePoint3->impl(); - AngleDirections* anAngle = new AngleDirections; + AngleDirections *anAngle = new AngleDirections; anAngle->myDir1.SetXYZ(aPoint1.XYZ() - aPoint2.XYZ()); anAngle->myDir2.SetXYZ(aPoint3.XYZ() - aPoint2.XYZ()); setImpl(anAngle); } -double GeomAPI_Angle::angleDegree() -{ - return angleRadian() * 180.0 / PI; -} +double GeomAPI_Angle::angleDegree() { return angleRadian() * 180.0 / PI; } -double GeomAPI_Angle::angleRadian() -{ - AngleDirections* anAngle = MY_ANGLE; +double GeomAPI_Angle::angleRadian() { + AngleDirections *anAngle = MY_ANGLE; if (anAngle->myDir1.SquareMagnitude() < Precision::SquareConfusion() || anAngle->myDir2.SquareMagnitude() < Precision::SquareConfusion()) return 0.0; diff --git a/src/GeomAPI/GeomAPI_Angle.h b/src/GeomAPI/GeomAPI_Angle.h index 2a4c391d3..c3d319031 100644 --- a/src/GeomAPI/GeomAPI_Angle.h +++ b/src/GeomAPI/GeomAPI_Angle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Angle_H_ @@ -28,20 +29,20 @@ class GeomAPI_Pnt; /// \class GeomAPI_Angle /// \ingroup DataModel /// \brief Build an angle -class GeomAPI_Angle : public GeomAPI_Interface -{ +class GeomAPI_Angle : public GeomAPI_Interface { public: /// Creation of an angle defined by two edges in the given intersection point. GEOMAPI_EXPORT - GeomAPI_Angle(const std::shared_ptr& theEdge1, - const std::shared_ptr& theEdge2, - const std::shared_ptr& thePoint); + GeomAPI_Angle(const std::shared_ptr &theEdge1, + const std::shared_ptr &theEdge2, + const std::shared_ptr &thePoint); - /// Creation of an angle defined by 3 points (the second point is an apex of an angle). + /// Creation of an angle defined by 3 points (the second point is an apex of + /// an angle). GEOMAPI_EXPORT - GeomAPI_Angle(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3); + GeomAPI_Angle(const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3); /// Returns value of the angle in degrees GEOMAPI_EXPORT double angleDegree(); diff --git a/src/GeomAPI/GeomAPI_Angle2d.cpp b/src/GeomAPI/GeomAPI_Angle2d.cpp index c6c529e58..da10b5203 100644 --- a/src/GeomAPI/GeomAPI_Angle2d.cpp +++ b/src/GeomAPI/GeomAPI_Angle2d.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -39,23 +40,22 @@ struct ThreePoints2d { #define MY_ANGLE implPtr() #define PI 3.1415926535897932 -static ThreePoints2d* newAngle(const std::shared_ptr& theCenter, - const std::shared_ptr& theFirst, - const std::shared_ptr& theSecond) -{ - ThreePoints2d* aResult = new ThreePoints2d; +static ThreePoints2d * +newAngle(const std::shared_ptr &theCenter, + const std::shared_ptr &theFirst, + const std::shared_ptr &theSecond) { + ThreePoints2d *aResult = new ThreePoints2d; aResult->myCenter = gp_Pnt2d(theCenter->x(), theCenter->y()); - aResult->myFirst = gp_Pnt2d(theFirst->x(), theFirst->y()); + aResult->myFirst = gp_Pnt2d(theFirst->x(), theFirst->y()); aResult->mySecond = gp_Pnt2d(theSecond->x(), theSecond->y()); aResult->myReversed[0] = aResult->myReversed[1] = false; return aResult; } -static ThreePoints2d* newAngle(const std::shared_ptr& theStart1, - const std::shared_ptr& theEnd1, - const std::shared_ptr& theStart2, - const std::shared_ptr& theEnd2) -{ +static ThreePoints2d *newAngle(const std::shared_ptr &theStart1, + const std::shared_ptr &theEnd1, + const std::shared_ptr &theStart2, + const std::shared_ptr &theEnd2) { std::shared_ptr aLine1(new GeomAPI_Lin2d(theStart1, theEnd1)); std::shared_ptr aLine2(new GeomAPI_Lin2d(theStart2, theEnd2)); std::shared_ptr aCenter = aLine1->intersect(aLine2); @@ -66,18 +66,23 @@ static ThreePoints2d* newAngle(const std::shared_ptr& theStart1, if (isParallel) aPoint1 = aPoint2 = theEnd1; else { - aPoint1 = theStart1->distance(aCenter) < theEnd1->distance(aCenter) ? theEnd1 : theStart1; - aPoint2 = theStart2->distance(aCenter) < theEnd2->distance(aCenter) ? theEnd2 : theStart2; + aPoint1 = theStart1->distance(aCenter) < theEnd1->distance(aCenter) + ? theEnd1 + : theStart1; + aPoint2 = theStart2->distance(aCenter) < theEnd2->distance(aCenter) + ? theEnd2 + : theStart2; } - ThreePoints2d* anAngle = newAngle(aCenter, aPoint1, aPoint2); + ThreePoints2d *anAngle = newAngle(aCenter, aPoint1, aPoint2); anAngle->myReversed[0] = aPoint1 == theStart1; anAngle->myReversed[1] = !isParallel && aPoint2 == theStart2; return anAngle; } -static ThreePoints2d* newAngle(const std::shared_ptr& theLine1, bool theReversed1, - const std::shared_ptr& theLine2, bool theReversed2) -{ +static ThreePoints2d *newAngle(const std::shared_ptr &theLine1, + bool theReversed1, + const std::shared_ptr &theLine2, + bool theReversed2) { std::shared_ptr aCenter = theLine1->intersect(theLine2); if (!aCenter) aCenter = theLine1->location(); @@ -87,67 +92,57 @@ static ThreePoints2d* newAngle(const std::shared_ptr& theLine1, b aCoeff = theReversed2 ? -1.0 : 1.0; std::shared_ptr aPoint2(new GeomAPI_Pnt2d( aCenter->xy()->added(theLine2->direction()->xy()->multiplied(aCoeff)))); - ThreePoints2d* anAngle = newAngle(aCenter, aPoint1, aPoint2); + ThreePoints2d *anAngle = newAngle(aCenter, aPoint1, aPoint2); anAngle->myReversed[0] = theReversed1; anAngle->myReversed[1] = theReversed2; return anAngle; } - - -GeomAPI_Angle2d::GeomAPI_Angle2d(const std::shared_ptr& theStartLine1, - const std::shared_ptr& theEndLine1, - const std::shared_ptr& theStartLine2, - const std::shared_ptr& theEndLine2) - : GeomAPI_Interface(newAngle(theStartLine1, theEndLine1, theStartLine2, theEndLine2)) -{ -} - -GeomAPI_Angle2d::GeomAPI_Angle2d(const std::shared_ptr& theLine1, bool theReversed1, - const std::shared_ptr& theLine2, bool theReversed2) - : GeomAPI_Interface(newAngle(theLine1, theReversed1, theLine2, theReversed2)) -{ -} - -GeomAPI_Angle2d::GeomAPI_Angle2d(const std::shared_ptr& theCenter, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2) - : GeomAPI_Interface(newAngle(theCenter, thePoint1, thePoint2)) -{ -} - -std::shared_ptr GeomAPI_Angle2d::center() -{ +GeomAPI_Angle2d::GeomAPI_Angle2d( + const std::shared_ptr &theStartLine1, + const std::shared_ptr &theEndLine1, + const std::shared_ptr &theStartLine2, + const std::shared_ptr &theEndLine2) + : GeomAPI_Interface( + newAngle(theStartLine1, theEndLine1, theStartLine2, theEndLine2)) {} + +GeomAPI_Angle2d::GeomAPI_Angle2d(const std::shared_ptr &theLine1, + bool theReversed1, + const std::shared_ptr &theLine2, + bool theReversed2) + : GeomAPI_Interface( + newAngle(theLine1, theReversed1, theLine2, theReversed2)) {} + +GeomAPI_Angle2d::GeomAPI_Angle2d( + const std::shared_ptr &theCenter, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2) + : GeomAPI_Interface(newAngle(theCenter, thePoint1, thePoint2)) {} + +std::shared_ptr GeomAPI_Angle2d::center() { gp_Pnt2d aPnt = MY_ANGLE->myCenter; return std::shared_ptr(new GeomAPI_Pnt2d(aPnt.X(), aPnt.Y())); } -std::shared_ptr GeomAPI_Angle2d::firstPoint() -{ +std::shared_ptr GeomAPI_Angle2d::firstPoint() { gp_Pnt2d aPnt = MY_ANGLE->myFirst; return std::shared_ptr(new GeomAPI_Pnt2d(aPnt.X(), aPnt.Y())); } -std::shared_ptr GeomAPI_Angle2d::secondPoint() -{ +std::shared_ptr GeomAPI_Angle2d::secondPoint() { gp_Pnt2d aPnt = MY_ANGLE->mySecond; return std::shared_ptr(new GeomAPI_Pnt2d(aPnt.X(), aPnt.Y())); } -double GeomAPI_Angle2d::angleDegree() -{ - return angleRadian() * 180.0 / PI; -} +double GeomAPI_Angle2d::angleDegree() { return angleRadian() * 180.0 / PI; } -double GeomAPI_Angle2d::angleRadian() -{ - ThreePoints2d* anAngle = MY_ANGLE; +double GeomAPI_Angle2d::angleRadian() { + ThreePoints2d *anAngle = MY_ANGLE; gp_Dir2d aDir1(anAngle->myFirst.XY() - anAngle->myCenter.XY()); gp_Dir2d aDir2(anAngle->mySecond.XY() - anAngle->myCenter.XY()); return aDir1.Angle(aDir2); } -bool GeomAPI_Angle2d::isReversed(int theIndex) -{ +bool GeomAPI_Angle2d::isReversed(int theIndex) { return MY_ANGLE->myReversed[theIndex & 0x1]; } diff --git a/src/GeomAPI/GeomAPI_Angle2d.h b/src/GeomAPI/GeomAPI_Angle2d.h index ae7b1c865..3b7ad265f 100644 --- a/src/GeomAPI/GeomAPI_Angle2d.h +++ b/src/GeomAPI/GeomAPI_Angle2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Angle2d_H_ @@ -28,24 +29,26 @@ class GeomAPI_Pnt2d; /// \class GeomAPI_Angle2d /// \ingroup DataModel /// \brief Build an angle in plane -class GeomAPI_Angle2d : public GeomAPI_Interface -{ +class GeomAPI_Angle2d : public GeomAPI_Interface { public: /// Creation of an angle defined by two lines' start, end points GEOMAPI_EXPORT - GeomAPI_Angle2d(const std::shared_ptr& theStartLine1, - const std::shared_ptr& theEndLine1, - const std::shared_ptr& theStartLine2, - const std::shared_ptr& theEndLine2); - /// Creation of an angle defined by two lines taking into account their orientation + GeomAPI_Angle2d(const std::shared_ptr &theStartLine1, + const std::shared_ptr &theEndLine1, + const std::shared_ptr &theStartLine2, + const std::shared_ptr &theEndLine2); + /// Creation of an angle defined by two lines taking into account their + /// orientation GEOMAPI_EXPORT - GeomAPI_Angle2d(const std::shared_ptr& theLine1, bool theReversed1, - const std::shared_ptr& theLine2, bool theReversed2); + GeomAPI_Angle2d(const std::shared_ptr &theLine1, + bool theReversed1, + const std::shared_ptr &theLine2, + bool theReversed2); /// Creation of an angle defined by three points GEOMAPI_EXPORT - GeomAPI_Angle2d(const std::shared_ptr& theCenter, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2); + GeomAPI_Angle2d(const std::shared_ptr &theCenter, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2); /// Returns central point of the angle GEOMAPI_EXPORT std::shared_ptr center(); @@ -66,4 +69,3 @@ public: }; #endif - diff --git a/src/GeomAPI/GeomAPI_Ax1.cpp b/src/GeomAPI/GeomAPI_Ax1.cpp index b4dc71ff5..a83518e5b 100644 --- a/src/GeomAPI/GeomAPI_Ax1.cpp +++ b/src/GeomAPI/GeomAPI_Ax1.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,58 +25,47 @@ #define MY_AX1 implPtr() //================================================================================================= -GeomAPI_Ax1::GeomAPI_Ax1() -: GeomAPI_Interface(new gp_Ax1()) -{ -} +GeomAPI_Ax1::GeomAPI_Ax1() : GeomAPI_Interface(new gp_Ax1()) {} //================================================================================================= GeomAPI_Ax1::GeomAPI_Ax1(std::shared_ptr theOrigin, std::shared_ptr theDir) -: GeomAPI_Interface(new gp_Ax1(theOrigin->impl(), - theDir->impl())) -{ -} + : GeomAPI_Interface( + new gp_Ax1(theOrigin->impl(), theDir->impl())) {} //================================================================================================= -void GeomAPI_Ax1::setOrigin(const std::shared_ptr& theOrigin) -{ +void GeomAPI_Ax1::setOrigin(const std::shared_ptr &theOrigin) { MY_AX1->SetLocation(theOrigin->impl()); } //================================================================================================= -std::shared_ptr GeomAPI_Ax1::origin() const -{ +std::shared_ptr GeomAPI_Ax1::origin() const { gp_Pnt aPnt = MY_AX1->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); } //================================================================================================= -void GeomAPI_Ax1::setDir(const std::shared_ptr& theDir) -{ +void GeomAPI_Ax1::setDir(const std::shared_ptr &theDir) { MY_AX1->SetDirection(theDir->impl()); } //================================================================================================= -std::shared_ptr GeomAPI_Ax1::dir() const -{ +std::shared_ptr GeomAPI_Ax1::dir() const { gp_Dir aDir = MY_AX1->Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } //================================================================================================= -void GeomAPI_Ax1::reverse() -{ - MY_AX1->Reverse(); -} +void GeomAPI_Ax1::reverse() { MY_AX1->Reverse(); } //================================================================================================= -std::shared_ptr GeomAPI_Ax1::reversed() -{ +std::shared_ptr GeomAPI_Ax1::reversed() { gp_Ax1 anAxis = MY_AX1->Reversed(); - std::shared_ptr aPnt( - new GeomAPI_Pnt(anAxis.Location().X(), anAxis.Location().Y(), anAxis.Location().Z())); - std::shared_ptr aDir( - new GeomAPI_Dir(anAxis.Direction().X(), anAxis.Direction().Y(), anAxis.Direction().Z())); + std::shared_ptr aPnt(new GeomAPI_Pnt( + anAxis.Location().X(), anAxis.Location().Y(), anAxis.Location().Z())); + std::shared_ptr aDir(new GeomAPI_Dir( + anAxis.Direction().X(), anAxis.Direction().Y(), anAxis.Direction().Z())); return std::shared_ptr(new GeomAPI_Ax1(aPnt, aDir)); } diff --git a/src/GeomAPI/GeomAPI_Ax1.h b/src/GeomAPI/GeomAPI_Ax1.h index 015089fe9..51e6fb34d 100644 --- a/src/GeomAPI/GeomAPI_Ax1.h +++ b/src/GeomAPI/GeomAPI_Ax1.h @@ -14,21 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMAPI_AX1_H_ #define GEOMAPI_AX1_H_ #include -#include #include +#include /** \ingroup DataModel * \brief The class represents an axis in 3D space. */ -class GeomAPI_Ax1 : public GeomAPI_Interface -{ +class GeomAPI_Ax1 : public GeomAPI_Interface { public: /// Default constructor. GEOMAPI_EXPORT @@ -44,7 +44,7 @@ public: /// Sets origin point. GEOMAPI_EXPORT - void setOrigin(const std::shared_ptr& theOrigin); + void setOrigin(const std::shared_ptr &theOrigin); /// \return the plane origin point. GEOMAPI_EXPORT @@ -52,7 +52,7 @@ public: /// Sets direction vector. GEOMAPI_EXPORT - void setDir(const std::shared_ptr& theDir); + void setDir(const std::shared_ptr &theDir); /// \return direction vector. GEOMAPI_EXPORT diff --git a/src/GeomAPI/GeomAPI_Ax2.cpp b/src/GeomAPI/GeomAPI_Ax2.cpp index 84192cc73..da1c59158 100644 --- a/src/GeomAPI/GeomAPI_Ax2.cpp +++ b/src/GeomAPI/GeomAPI_Ax2.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,51 +25,42 @@ #define MY_AX1 implPtr() //================================================================================================= -GeomAPI_Ax2::GeomAPI_Ax2() -: GeomAPI_Interface(new gp_Ax2()) -{ -} +GeomAPI_Ax2::GeomAPI_Ax2() : GeomAPI_Interface(new gp_Ax2()) {} //================================================================================================= GeomAPI_Ax2::GeomAPI_Ax2(std::shared_ptr theOrigin, std::shared_ptr theN, std::shared_ptr theVX) -: GeomAPI_Interface(new gp_Ax2(theOrigin->impl(), - theN->impl(), - theVX->impl())) -{ -} + : GeomAPI_Interface(new gp_Ax2(theOrigin->impl(), + theN->impl(), + theVX->impl())) {} //================================================================================================= GeomAPI_Ax2::GeomAPI_Ax2(std::shared_ptr theOrigin, std::shared_ptr theDir) -: GeomAPI_Interface(new gp_Ax2(theOrigin->impl(), - theDir->impl())) -{ -} + : GeomAPI_Interface( + new gp_Ax2(theOrigin->impl(), theDir->impl())) {} //================================================================================================= -void GeomAPI_Ax2::setOrigin(const std::shared_ptr& theOrigin) -{ +void GeomAPI_Ax2::setOrigin(const std::shared_ptr &theOrigin) { MY_AX1->SetLocation(theOrigin->impl()); } //================================================================================================= -std::shared_ptr GeomAPI_Ax2::origin() const -{ +std::shared_ptr GeomAPI_Ax2::origin() const { gp_Pnt aPnt = MY_AX1->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); } //================================================================================================= -void GeomAPI_Ax2::setDir(const std::shared_ptr& theDir) -{ +void GeomAPI_Ax2::setDir(const std::shared_ptr &theDir) { MY_AX1->SetDirection(theDir->impl()); } //================================================================================================= -std::shared_ptr GeomAPI_Ax2::dir() const -{ +std::shared_ptr GeomAPI_Ax2::dir() const { gp_Dir aDir = MY_AX1->Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } diff --git a/src/GeomAPI/GeomAPI_Ax2.h b/src/GeomAPI/GeomAPI_Ax2.h index 7fe3fabaf..a0bd65980 100644 --- a/src/GeomAPI/GeomAPI_Ax2.h +++ b/src/GeomAPI/GeomAPI_Ax2.h @@ -14,21 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Ax2_H_ #define GeomAPI_Ax2_H_ #include -#include #include +#include /** \ingroup DataModel * \brief The class represents an axis in 3D space. */ -class GeomAPI_Ax2 : public GeomAPI_Interface -{ +class GeomAPI_Ax2 : public GeomAPI_Interface { public: /// Default constructor. GEOMAPI_EXPORT @@ -54,7 +54,7 @@ public: /// Sets origin point. GEOMAPI_EXPORT - void setOrigin(const std::shared_ptr& theOrigin); + void setOrigin(const std::shared_ptr &theOrigin); /// \return the plane origin point. GEOMAPI_EXPORT @@ -62,7 +62,7 @@ public: /// Sets direction vector. GEOMAPI_EXPORT - void setDir(const std::shared_ptr& theDir); + void setDir(const std::shared_ptr &theDir); /// \return direction vector. GEOMAPI_EXPORT diff --git a/src/GeomAPI/GeomAPI_Ax3.cpp b/src/GeomAPI/GeomAPI_Ax3.cpp index b8281bc7e..396fd93dd 100644 --- a/src/GeomAPI/GeomAPI_Ax3.cpp +++ b/src/GeomAPI/GeomAPI_Ax3.cpp @@ -14,104 +14,97 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Ax3.h" -#include "GeomAPI_XYZ.h" #include "GeomAPI_Pnt2d.h" +#include "GeomAPI_XYZ.h" +#include +#include #include #include -#include -#include - #define MY_AX3 implPtr() - -GeomAPI_Ax3::GeomAPI_Ax3() -: GeomAPI_Interface(new gp_Ax3()) -{ -} +GeomAPI_Ax3::GeomAPI_Ax3() : GeomAPI_Interface(new gp_Ax3()) {} GeomAPI_Ax3::GeomAPI_Ax3(std::shared_ptr theOrigin, std::shared_ptr theDirX, std::shared_ptr theNorm) -: GeomAPI_Interface(new gp_Ax3(theOrigin->impl(), - theNorm->impl(), - theDirX->impl())) - { - } - -void GeomAPI_Ax3::setOrigin(const std::shared_ptr& theOrigin) -{ + : GeomAPI_Interface(new gp_Ax3(theOrigin->impl(), + theNorm->impl(), + theDirX->impl())) {} + +void GeomAPI_Ax3::setOrigin(const std::shared_ptr &theOrigin) { gp_Ax1 aAx1 = MY_AX3->Axis(); aAx1.SetLocation(theOrigin->impl()); MY_AX3->SetAxis(aAx1); } -std::shared_ptr GeomAPI_Ax3::origin() const -{ +std::shared_ptr GeomAPI_Ax3::origin() const { gp_Pnt aPnt = MY_AX3->Axis().Location(); - return std::shared_ptr(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); } -void GeomAPI_Ax3::setDirX(const std::shared_ptr& theDirX) -{ +void GeomAPI_Ax3::setDirX(const std::shared_ptr &theDirX) { MY_AX3->SetXDirection(theDirX->impl()); } -std::shared_ptr GeomAPI_Ax3::dirX() const -{ +std::shared_ptr GeomAPI_Ax3::dirX() const { gp_Dir aDir = MY_AX3->XDirection(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } -void GeomAPI_Ax3::setDirY(const std::shared_ptr& theDirY) -{ +void GeomAPI_Ax3::setDirY(const std::shared_ptr &theDirY) { MY_AX3->SetYDirection(theDirY->impl()); } -std::shared_ptr GeomAPI_Ax3::dirY() const -{ +std::shared_ptr GeomAPI_Ax3::dirY() const { gp_Dir aDir = MY_AX3->YDirection(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } -void GeomAPI_Ax3::setNormal(const std::shared_ptr& theNorm) -{ +void GeomAPI_Ax3::setNormal(const std::shared_ptr &theNorm) { gp_Ax1 aAx1 = MY_AX3->Axis(); aAx1.SetDirection(theNorm->impl()); MY_AX3->SetAxis(aAx1); } -std::shared_ptr GeomAPI_Ax3::normal() const -{ +std::shared_ptr GeomAPI_Ax3::normal() const { gp_Dir aDir = MY_AX3->Axis().Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(),aDir.Y(),aDir.Z())); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } - -std::shared_ptr GeomAPI_Ax3::to3D(double theX, double theY) const -{ +std::shared_ptr GeomAPI_Ax3::to3D(double theX, double theY) const { gp_Pnt aPnt = MY_AX3->Axis().Location(); gp_Dir aXDir = MY_AX3->XDirection(); gp_Dir aYDir = MY_AX3->YDirection(); - gp_XYZ aSum = aPnt.XYZ().Added(aXDir.XYZ().Multiplied(theX)).Added(aYDir.XYZ().Multiplied(theY)); + gp_XYZ aSum = aPnt.XYZ() + .Added(aXDir.XYZ().Multiplied(theX)) + .Added(aYDir.XYZ().Multiplied(theY)); - return std::shared_ptr(new GeomAPI_Pnt(aSum.X(), aSum.Y(), aSum.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aSum.X(), aSum.Y(), aSum.Z())); } -std::shared_ptr GeomAPI_Ax3::to2D(double theX, double theY, double theZ) const -{ +std::shared_ptr GeomAPI_Ax3::to2D(double theX, double theY, + double theZ) const { gp_Pnt anOriginPnt = MY_AX3->Axis().Location(); gp_Vec aVec(anOriginPnt, gp_Pnt(theX, theY, theZ)); gp_Dir aXDir = MY_AX3->XDirection(); gp_Dir aYDir = MY_AX3->YDirection(); - double aX = aVec.X() * aXDir.X() + aVec.Y() * aXDir.Y() + aVec.Z() * aXDir.Z(); - double aY = aVec.X() * aYDir.X() + aVec.Y() * aYDir.Y() + aVec.Z() * aYDir.Z(); + double aX = + aVec.X() * aXDir.X() + aVec.Y() * aXDir.Y() + aVec.Z() * aXDir.Z(); + double aY = + aVec.X() * aYDir.X() + aVec.Y() * aYDir.Y() + aVec.Z() * aYDir.Z(); return std::shared_ptr(new GeomAPI_Pnt2d(aX, aY)); } diff --git a/src/GeomAPI/GeomAPI_Ax3.h b/src/GeomAPI/GeomAPI_Ax3.h index b6f85d6d6..faeb57271 100644 --- a/src/GeomAPI/GeomAPI_Ax3.h +++ b/src/GeomAPI/GeomAPI_Ax3.h @@ -14,23 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMAPI_AX3_H_ #define GEOMAPI_AX3_H_ #include "GeomAPI.h" -#include "GeomAPI_Pnt.h" #include "GeomAPI_Dir.h" +#include "GeomAPI_Pnt.h" /** * \ingroup DataModel - * \brief The class represents a coordinate plane which is 2d plane with X and Y directions - * and origin - */ -class GeomAPI_Ax3 : public GeomAPI_Interface -{ + * \brief The class represents a coordinate plane which is 2d plane with X and Y + * directions and origin + */ +class GeomAPI_Ax3 : public GeomAPI_Interface { public: /// Default constructor GEOMAPI_EXPORT @@ -47,7 +47,7 @@ public: /// Sets origin point GEOMAPI_EXPORT - void setOrigin(const std::shared_ptr& theOrigin); + void setOrigin(const std::shared_ptr &theOrigin); /// Returns the plane origin point GEOMAPI_EXPORT @@ -55,7 +55,7 @@ public: /// Sets X direction vector GEOMAPI_EXPORT - void setDirX(const std::shared_ptr& theDirX); + void setDirX(const std::shared_ptr &theDirX); /// Returns X direction vector GEOMAPI_EXPORT @@ -63,7 +63,7 @@ public: /// Sets Y direction vector GEOMAPI_EXPORT - void setDirY(const std::shared_ptr& theDirY); + void setDirY(const std::shared_ptr &theDirY); /// Returns Y direction vector GEOMAPI_EXPORT @@ -71,7 +71,7 @@ public: /// Sets Z direction vector GEOMAPI_EXPORT - void setNormal(const std::shared_ptr& theNorm); + void setNormal(const std::shared_ptr &theNorm); /// Returns Z direction vector GEOMAPI_EXPORT @@ -88,12 +88,11 @@ public: /// \param theY Y coordinate /// \param theZ Z coordinate GEOMAPI_EXPORT - std::shared_ptr to2D(double theX, double theY, double theZ) const; - + std::shared_ptr to2D(double theX, double theY, + double theZ) const; }; - //! Pointer on the object typedef std::shared_ptr GeomAx3Ptr; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAPI/GeomAPI_BSpline.cpp b/src/GeomAPI/GeomAPI_BSpline.cpp index ac2e96899..66ab94153 100644 --- a/src/GeomAPI/GeomAPI_BSpline.cpp +++ b/src/GeomAPI/GeomAPI_BSpline.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -26,61 +27,52 @@ #define MY_BSPLINE (*(implPtr())) -GeomAPI_BSpline::GeomAPI_BSpline (const GeomCurvePtr& theCurve) -{ +GeomAPI_BSpline::GeomAPI_BSpline(const GeomCurvePtr &theCurve) { GeomCurvePtr anUntrimmedCurve = theCurve->basisCurve(); Handle(Geom_Curve) aCurve = anUntrimmedCurve->impl(); Handle(Geom_BSplineCurve) aBSpl = Handle(Geom_BSplineCurve)::DownCast(aCurve); if (aBSpl.IsNull()) - throw Standard_ConstructionError("GeomAPI_BSpline: Curve is not a B-spline"); + throw Standard_ConstructionError( + "GeomAPI_BSpline: Curve is not a B-spline"); setImpl(new Handle_Geom_BSplineCurve(aBSpl)); } -int GeomAPI_BSpline::degree() const -{ - return MY_BSPLINE->Degree(); -} +int GeomAPI_BSpline::degree() const { return MY_BSPLINE->Degree(); } -std::list GeomAPI_BSpline::poles() const -{ - const TColgp_Array1OfPnt& aBSplPoles = MY_BSPLINE->Poles(); +std::list GeomAPI_BSpline::poles() const { + const TColgp_Array1OfPnt &aBSplPoles = MY_BSPLINE->Poles(); std::list aPoles; - for (int anIndex = aBSplPoles.Lower(); anIndex <= aBSplPoles.Upper(); ++anIndex) { - const gp_Pnt& aPoint = aBSplPoles.Value(anIndex); - aPoles.push_back(GeomPointPtr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()))); + for (int anIndex = aBSplPoles.Lower(); anIndex <= aBSplPoles.Upper(); + ++anIndex) { + const gp_Pnt &aPoint = aBSplPoles.Value(anIndex); + aPoles.push_back( + GeomPointPtr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()))); } return aPoles; } -std::list GeomAPI_BSpline::weights() const -{ +std::list GeomAPI_BSpline::weights() const { std::list aWeights; - const TColStd_Array1OfReal* aBSplWeights = MY_BSPLINE->Weights(); + const TColStd_Array1OfReal *aBSplWeights = MY_BSPLINE->Weights(); if (aBSplWeights) aWeights.assign(aBSplWeights->begin(), aBSplWeights->end()); return aWeights; } -std::list GeomAPI_BSpline::knots() const -{ - const TColStd_Array1OfReal& aBSplKnots = MY_BSPLINE->Knots(); +std::list GeomAPI_BSpline::knots() const { + const TColStd_Array1OfReal &aBSplKnots = MY_BSPLINE->Knots(); return std::list(aBSplKnots.begin(), aBSplKnots.end()); } -std::list GeomAPI_BSpline::mults() const -{ - const TColStd_Array1OfInteger& aBSplMults = MY_BSPLINE->Multiplicities(); +std::list GeomAPI_BSpline::mults() const { + const TColStd_Array1OfInteger &aBSplMults = MY_BSPLINE->Multiplicities(); return std::list(aBSplMults.begin(), aBSplMults.end()); } -bool GeomAPI_BSpline::isPeriodic() const -{ - return MY_BSPLINE->IsPeriodic(); -} +bool GeomAPI_BSpline::isPeriodic() const { return MY_BSPLINE->IsPeriodic(); } -GeomBSplinePtr GeomAPI_BSpline::convertToBSpline (const GeomCurvePtr& theCurve) -{ +GeomBSplinePtr GeomAPI_BSpline::convertToBSpline(const GeomCurvePtr &theCurve) { GeomCurvePtr anUntrimmedCurve = theCurve->basisCurve(); Handle(Geom_Curve) aCurve = anUntrimmedCurve->impl(); Handle(Geom_BSplineCurve) aBSpl = Handle(Geom_BSplineCurve)::DownCast(aCurve); @@ -89,9 +81,10 @@ GeomBSplinePtr GeomAPI_BSpline::convertToBSpline (const GeomCurvePtr& theCurve) aBSpl = GeomConvert::CurveToBSplineCurve(aCurve); } if (aBSpl.IsNull()) - throw Standard_ConstructionError("GeomAPI_BSpline: Conversion to B-spline failed"); - GeomCurvePtr aResCurve (new GeomAPI_Curve()); + throw Standard_ConstructionError( + "GeomAPI_BSpline: Conversion to B-spline failed"); + GeomCurvePtr aResCurve(new GeomAPI_Curve()); aResCurve->setImpl(new Handle_Geom_BSplineCurve(aBSpl)); - GeomBSplinePtr aResult (new GeomAPI_BSpline(aResCurve)); + GeomBSplinePtr aResult(new GeomAPI_BSpline(aResCurve)); return aResult; } diff --git a/src/GeomAPI/GeomAPI_BSpline.h b/src/GeomAPI/GeomAPI_BSpline.h index e17b78048..e0c0e7d6f 100644 --- a/src/GeomAPI/GeomAPI_BSpline.h +++ b/src/GeomAPI/GeomAPI_BSpline.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_BSpline_H_ #define GeomAPI_BSpline_H_ -#include #include +#include #include #include @@ -36,17 +37,16 @@ typedef std::shared_ptr GeomBSplinePtr; * \ingroup DataModel * \brief B-spline in 3D */ -class GeomAPI_BSpline : public GeomAPI_Interface -{ +class GeomAPI_BSpline : public GeomAPI_Interface { public: /// Creation of B-spline defined by a curve - GEOMAPI_EXPORT GeomAPI_BSpline (const GeomCurvePtr& theCurve); + GEOMAPI_EXPORT GeomAPI_BSpline(const GeomCurvePtr &theCurve); /// Degree of B-spline curve GEOMAPI_EXPORT int degree() const; /// Poles of B-spline curve - GEOMAPI_EXPORT std::list > poles() const; + GEOMAPI_EXPORT std::list> poles() const; /// Weights of B-spline poles GEOMAPI_EXPORT std::list weights() const; @@ -61,7 +61,8 @@ public: GEOMAPI_EXPORT bool isPeriodic() const; /// Convert any curve into a B-spline curve - GEOMAPI_EXPORT static GeomBSplinePtr convertToBSpline (const GeomCurvePtr& theCurve); + GEOMAPI_EXPORT static GeomBSplinePtr + convertToBSpline(const GeomCurvePtr &theCurve); }; #endif diff --git a/src/GeomAPI/GeomAPI_BSpline2d.cpp b/src/GeomAPI/GeomAPI_BSpline2d.cpp index 32cad15b0..641861bce 100644 --- a/src/GeomAPI/GeomAPI_BSpline2d.cpp +++ b/src/GeomAPI/GeomAPI_BSpline2d.cpp @@ -14,42 +14,39 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include #include -#include #include +#include #include #include #define MY_BSPLINE (*(implPtr())) +static Handle_Geom2d_BSplineCurve * +newBSpline2d(const std::list> &thePoles, + const std::list &theWeights, const int theDegree, + const bool thePeriodic); -static Handle_Geom2d_BSplineCurve* newBSpline2d( - const std::list >& thePoles, - const std::list& theWeights, - const int theDegree, - const bool thePeriodic); - - -static Handle_Geom2d_BSplineCurve* newBSpline2d( - const std::list >& thePoles, - const std::list& theWeights, - const std::list& theKnots, - const std::list& theMults, - const int theDegree, - const bool thePeriodic) -{ +static Handle_Geom2d_BSplineCurve * +newBSpline2d(const std::list> &thePoles, + const std::list &theWeights, + const std::list &theKnots, const std::list &theMults, + const int theDegree, const bool thePeriodic) { if (theKnots.empty() || theMults.empty()) return newBSpline2d(thePoles, theWeights, theDegree, thePeriodic); int anAuxPole = 0; - if (thePeriodic && thePoles.front()->distance(thePoles.back()) < Precision::Confusion()) { - // additionally check the number of poles is greater than needed for th periodic B-spline + if (thePeriodic && + thePoles.front()->distance(thePoles.back()) < Precision::Confusion()) { + // additionally check the number of poles is greater than needed for th + // periodic B-spline int aNbPoles = 0; std::list::const_iterator it = theMults.begin(); for (++it; it != theMults.end(); ++it) @@ -70,7 +67,8 @@ static Handle_Geom2d_BSplineCurve* newBSpline2d( aPoles.SetValue(anIndex, gp_Pnt2d((*aPIt)->x(), (*aPIt)->y())); anIndex = 1; for (std::list::const_iterator aWIt = theWeights.begin(); - aWIt != theWeights.end() && anIndex <= aWeights.Upper(); ++aWIt, ++anIndex) + aWIt != theWeights.end() && anIndex <= aWeights.Upper(); + ++aWIt, ++anIndex) aWeights.SetValue(anIndex, *aWIt); anIndex = 1; for (std::list::const_iterator aKIt = theKnots.begin(); @@ -81,18 +79,16 @@ static Handle_Geom2d_BSplineCurve* newBSpline2d( aMIt != theMults.end(); ++aMIt, ++anIndex) aMults.SetValue(anIndex, *aMIt); - Handle(Geom2d_BSplineCurve) aCurve = - new Geom2d_BSplineCurve(aPoles, aWeights, aKnots, aMults, theDegree, thePeriodic); + Handle(Geom2d_BSplineCurve) aCurve = new Geom2d_BSplineCurve( + aPoles, aWeights, aKnots, aMults, theDegree, thePeriodic); return new Handle_Geom2d_BSplineCurve(aCurve); } -Handle_Geom2d_BSplineCurve* newBSpline2d( - const std::list >& thePoles, - const std::list& theWeights, - const int theDegree, - const bool thePeriodic) -{ - std::list > aPoles = thePoles; +Handle_Geom2d_BSplineCurve * +newBSpline2d(const std::list> &thePoles, + const std::list &theWeights, const int theDegree, + const bool thePeriodic) { + std::list> aPoles = thePoles; std::list aWeights = theWeights; int aMult = theDegree + 1; int aNbKnots = (int)thePoles.size() - theDegree + 1; @@ -113,7 +109,8 @@ Handle_Geom2d_BSplineCurve* newBSpline2d( double aStep = aEndParam / (aNbKnots - 1); int anIndex = 1; std::list aKnots; - for (double aKnot = aStartParam; anIndex < aNbKnots; ++anIndex, aKnot += aStep) + for (double aKnot = aStartParam; anIndex < aNbKnots; + ++anIndex, aKnot += aStep) aKnots.push_back(aKnot); aKnots.push_back(aEndParam); @@ -124,11 +121,9 @@ Handle_Geom2d_BSplineCurve* newBSpline2d( return newBSpline2d(aPoles, aWeights, aKnots, aMults, theDegree, thePeriodic); } -static Handle_Geom2d_BSplineCurve* newBSpline2d( - const std::list >& thePoles, - const std::list& theWeights, - const bool thePeriodic) -{ +static Handle_Geom2d_BSplineCurve * +newBSpline2d(const std::list> &thePoles, + const std::list &theWeights, const bool thePeriodic) { int aDegree = 3; if ((int)thePoles.size() <= aDegree) aDegree = (int)thePoles.size() - 1; @@ -137,62 +132,52 @@ static Handle_Geom2d_BSplineCurve* newBSpline2d( return newBSpline2d(thePoles, theWeights, aDegree, thePeriodic); } - -GeomAPI_BSpline2d::GeomAPI_BSpline2d(const std::list >& thePoles, - const std::list& theWeights, - const bool thePeriodic) - : GeomAPI_Interface(newBSpline2d(thePoles, theWeights, thePeriodic)) -{ +GeomAPI_BSpline2d::GeomAPI_BSpline2d( + const std::list> &thePoles, + const std::list &theWeights, const bool thePeriodic) + : GeomAPI_Interface(newBSpline2d(thePoles, theWeights, thePeriodic)) { if (isNull()) - throw Standard_ConstructionError("GeomAPI_BSpline2d: Impossible to create B-spline curve"); + throw Standard_ConstructionError( + "GeomAPI_BSpline2d: Impossible to create B-spline curve"); } -GeomAPI_BSpline2d::GeomAPI_BSpline2d(const int theDegree, - const std::list >& thePoles, - const std::list& theWeights, - const std::list& theKnots, - const std::list& theMults, - const bool thePeriodic) - : GeomAPI_Interface(newBSpline2d(thePoles, theWeights, theKnots, theMults, - theDegree, thePeriodic)) -{ +GeomAPI_BSpline2d::GeomAPI_BSpline2d( + const int theDegree, + const std::list> &thePoles, + const std::list &theWeights, const std::list &theKnots, + const std::list &theMults, const bool thePeriodic) + : GeomAPI_Interface(newBSpline2d(thePoles, theWeights, theKnots, theMults, + theDegree, thePeriodic)) { if (isNull()) - throw Standard_ConstructionError("GeomAPI_BSpline2d: Impossible to create B-spline curve"); + throw Standard_ConstructionError( + "GeomAPI_BSpline2d: Impossible to create B-spline curve"); } -bool GeomAPI_BSpline2d::isNull() const -{ - return MY_BSPLINE.IsNull(); -} +bool GeomAPI_BSpline2d::isNull() const { return MY_BSPLINE.IsNull(); } -int GeomAPI_BSpline2d::degree() const -{ - return MY_BSPLINE->Degree(); -} +int GeomAPI_BSpline2d::degree() const { return MY_BSPLINE->Degree(); } -std::list GeomAPI_BSpline2d::knots() const -{ - const TColStd_Array1OfReal& aBSplKnots = MY_BSPLINE->Knots(); +std::list GeomAPI_BSpline2d::knots() const { + const TColStd_Array1OfReal &aBSplKnots = MY_BSPLINE->Knots(); return std::list(aBSplKnots.begin(), aBSplKnots.end()); } -std::list GeomAPI_BSpline2d::mults() const -{ - const TColStd_Array1OfInteger& aBSplMults = MY_BSPLINE->Multiplicities(); +std::list GeomAPI_BSpline2d::mults() const { + const TColStd_Array1OfInteger &aBSplMults = MY_BSPLINE->Multiplicities(); return std::list(aBSplMults.begin(), aBSplMults.end()); } -const bool GeomAPI_BSpline2d::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const -{ - const gp_Pnt2d& aPoint = thePoint->impl(); - bool isOk = GeomLib_Tool::Parameter(MY_BSPLINE, aPoint, - theTolerance, theParameter) == Standard_True; +const bool +GeomAPI_BSpline2d::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { + const gp_Pnt2d &aPoint = thePoint->impl(); + bool isOk = GeomLib_Tool::Parameter(MY_BSPLINE, aPoint, theTolerance, + theParameter) == Standard_True; if (!isOk) { - // Sometimes OCCT's Extrema algorithm cannot find the parameter on B-spline curve - // (usually, if the point is near the curve extremity). - // Workaround: compute distance to each boundary point + // Sometimes OCCT's Extrema algorithm cannot find the parameter on B-spline + // curve (usually, if the point is near the curve extremity). Workaround: + // compute distance to each boundary point isOk = true; double aDistPS = aPoint.Distance(MY_BSPLINE->Poles().First()); double aDistPE = aPoint.Distance(MY_BSPLINE->Poles().Last()); @@ -206,16 +191,16 @@ const bool GeomAPI_BSpline2d::parameter(const std::shared_ptr the return isOk; } -void GeomAPI_BSpline2d::D0(const double theU, std::shared_ptr& thePoint) -{ +void GeomAPI_BSpline2d::D0(const double theU, + std::shared_ptr &thePoint) { gp_Pnt2d aPnt; MY_BSPLINE->D0(theU, aPnt); thePoint.reset(new GeomAPI_Pnt2d(aPnt.X(), aPnt.Y())); } -void GeomAPI_BSpline2d::D1(const double theU, std::shared_ptr& thePoint, - std::shared_ptr& theDerivative) -{ +void GeomAPI_BSpline2d::D1(const double theU, + std::shared_ptr &thePoint, + std::shared_ptr &theDerivative) { gp_Pnt2d aPnt; gp_Vec2d aVec; MY_BSPLINE->D1(theU, aPnt, aVec); diff --git a/src/GeomAPI/GeomAPI_BSpline2d.h b/src/GeomAPI/GeomAPI_BSpline2d.h index 7b465ec42..72c5ac783 100644 --- a/src/GeomAPI/GeomAPI_BSpline2d.h +++ b/src/GeomAPI/GeomAPI_BSpline2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_BSpline2d_H_ @@ -32,21 +33,22 @@ class GeomAPI_XY; * \ingroup DataModel * \brief B-spline curve in 2D */ -class GeomAPI_BSpline2d : public GeomAPI_Interface -{ +class GeomAPI_BSpline2d : public GeomAPI_Interface { public: /// Creation of B-spline curve defined by list of poles and weights - GEOMAPI_EXPORT GeomAPI_BSpline2d(const std::list >& thePoles, - const std::list& theWeights, - const bool thePeriodic = false); + GEOMAPI_EXPORT + GeomAPI_BSpline2d(const std::list> &thePoles, + const std::list &theWeights, + const bool thePeriodic = false); /// Creation of B-spline curve defined by list of poles and weights - GEOMAPI_EXPORT GeomAPI_BSpline2d(const int theDegree, - const std::list >& thePoles, - const std::list& theWeights, - const std::list& theKnots = std::list(), - const std::list& theMults = std::list(), - const bool thePeriodic = false); + GEOMAPI_EXPORT + GeomAPI_BSpline2d(const int theDegree, + const std::list> &thePoles, + const std::list &theWeights, + const std::list &theKnots = std::list(), + const std::list &theMults = std::list(), + const bool thePeriodic = false); /// Returns true if curve is not initialized GEOMAPI_EXPORT bool isNull() const; @@ -60,24 +62,28 @@ public: /// Multiplicities of the knots GEOMAPI_EXPORT std::list mults() const; - /// \brief Computes the parameter of a given point on a circle. The point must be + /// \brief Computes the parameter of a given point on a circle. The point must + /// be /// located either on the circle itself or relatively to the latter - /// at a distance less than the tolerance value. Return FALSE if the point - /// is beyond the tolerance limit or if computation fails. - /// Max Tolerance value is currently limited to 1.e-4 + /// at a distance less than the tolerance value. Return FALSE if the + /// point is beyond the tolerance limit or if computation fails. Max + /// Tolerance value is currently limited to 1.e-4 /// \param[in] thePoint point of origin. /// \param[in] theTolerance tolerance of computation. /// \param[out] theParameter resulting parameter. - GEOMAPI_EXPORT const bool parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const; + GEOMAPI_EXPORT const bool + parameter(const std::shared_ptr thePoint, + const double theTolerance, double &theParameter) const; /// \brief Calculate point on B-spline curve accrding to the given parameter - GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr& thePoint); + GEOMAPI_EXPORT void D0(const double theU, + std::shared_ptr &thePoint); - /// \brief Calculate point and first derivative for B-spline curve accrding to the given parameter - GEOMAPI_EXPORT void D1(const double theU, std::shared_ptr& thePoint, - std::shared_ptr& theDerivative); + /// \brief Calculate point and first derivative for B-spline curve accrding to + /// the given parameter + GEOMAPI_EXPORT void D1(const double theU, + std::shared_ptr &thePoint, + std::shared_ptr &theDerivative); }; #endif diff --git a/src/GeomAPI/GeomAPI_Box.cpp b/src/GeomAPI/GeomAPI_Box.cpp index 867e0e7ff..245c919d5 100644 --- a/src/GeomAPI/GeomAPI_Box.cpp +++ b/src/GeomAPI/GeomAPI_Box.cpp @@ -14,76 +14,56 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include -struct Box -{ +struct Box { std::shared_ptr myCoordSystem; double myWidth; double myDepth; double myHeight; - Box(const std::shared_ptr& theCoordSystem, - const double theWidth, - const double theDepth, - const double theHeight) - : myCoordSystem(theCoordSystem), - myWidth(theWidth), - myDepth(theDepth), - myHeight(theHeight) - {} + Box(const std::shared_ptr &theCoordSystem, const double theWidth, + const double theDepth, const double theHeight) + : myCoordSystem(theCoordSystem), myWidth(theWidth), myDepth(theDepth), + myHeight(theHeight) {} }; #define MY_BOX implPtr() //================================================================================================= -GeomAPI_Box::GeomAPI_Box(const std::shared_ptr& theCorner, - const double theWidth, - const double theDepth, +GeomAPI_Box::GeomAPI_Box(const std::shared_ptr &theCorner, + const double theWidth, const double theDepth, const double theHeight) - : GeomAPI_Interface(new Box(theCorner, theWidth, theDepth, theHeight)) -{ -} + : GeomAPI_Interface(new Box(theCorner, theWidth, theDepth, theHeight)) {} //================================================================================================= -std::shared_ptr GeomAPI_Box::axes() const -{ +std::shared_ptr GeomAPI_Box::axes() const { return MY_BOX->myCoordSystem; } //================================================================================================= -std::shared_ptr GeomAPI_Box::corner() const -{ +std::shared_ptr GeomAPI_Box::corner() const { return axes()->origin(); } //================================================================================================= -double GeomAPI_Box::width() const -{ - return MY_BOX->myWidth; -} +double GeomAPI_Box::width() const { return MY_BOX->myWidth; } //================================================================================================= -double GeomAPI_Box::depth() const -{ - return MY_BOX->myDepth; -} +double GeomAPI_Box::depth() const { return MY_BOX->myDepth; } //================================================================================================= -double GeomAPI_Box::height() const -{ - return MY_BOX->myHeight; -} +double GeomAPI_Box::height() const { return MY_BOX->myHeight; } //================================================================================================= -bool GeomAPI_Box::isAxesAligned() const -{ +bool GeomAPI_Box::isAxesAligned() const { return Abs(MY_BOX->myCoordSystem->dirX()->x() - 1.0) < Precision::Angular() && Abs(MY_BOX->myCoordSystem->normal()->z() - 1.0) < Precision::Angular(); } diff --git a/src/GeomAPI/GeomAPI_Box.h b/src/GeomAPI/GeomAPI_Box.h index 3bedfd78a..fd79431cb 100644 --- a/src/GeomAPI/GeomAPI_Box.h +++ b/src/GeomAPI/GeomAPI_Box.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Box_H_ @@ -30,13 +31,12 @@ class GeomAPI_Pnt; * \ingroup DataModel * \brief Box in 3D */ -class GeomAPI_Box : public GeomAPI_Interface -{ +class GeomAPI_Box : public GeomAPI_Interface { public: - /// Creation of torus defined by center point, direction, major and minor radii - GEOMAPI_EXPORT GeomAPI_Box(const std::shared_ptr& theCorner, - const double theWidth, - const double theDepth, + /// Creation of torus defined by center point, direction, major and minor + /// radii + GEOMAPI_EXPORT GeomAPI_Box(const std::shared_ptr &theCorner, + const double theWidth, const double theDepth, const double theHeight); /// Return axes of the box diff --git a/src/GeomAPI/GeomAPI_Circ.cpp b/src/GeomAPI/GeomAPI_Circ.cpp index 955cdb3f1..77d8ffb41 100644 --- a/src/GeomAPI/GeomAPI_Circ.cpp +++ b/src/GeomAPI/GeomAPI_Circ.cpp @@ -14,50 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include +#include -#include +#include #include +#include #include -#include -#include #include #include +#include #define MY_CIRC implPtr() -static gp_Circ* newCirc(const gp_Pnt& theCenter, const gp_Dir& theDir, const double theRadius) -{ +static gp_Circ *newCirc(const gp_Pnt &theCenter, const gp_Dir &theDir, + const double theRadius) { return new gp_Circ(gp_Ax2(theCenter, theDir), theRadius); } //================================================================================================= GeomAPI_Circ::GeomAPI_Circ(const std::shared_ptr theAx2, const double theRadius) -: GeomAPI_Interface(new gp_Circ(theAx2->impl(), theRadius)) -{ - -} - + : GeomAPI_Interface(new gp_Circ(theAx2->impl(), theRadius)) {} //================================================================================================= -GeomAPI_Circ::GeomAPI_Circ(const std::shared_ptr& theCenter, - const std::shared_ptr& theDir, double theRadius) - : GeomAPI_Interface(newCirc(theCenter->impl(), theDir->impl(), theRadius)) -{ -} +GeomAPI_Circ::GeomAPI_Circ(const std::shared_ptr &theCenter, + const std::shared_ptr &theDir, + double theRadius) + : GeomAPI_Interface(newCirc(theCenter->impl(), + theDir->impl(), theRadius)) {} //================================================================================================= -GeomAPI_Circ::GeomAPI_Circ(const GeomCurvePtr& theCurve) -{ +GeomAPI_Circ::GeomAPI_Circ(const GeomCurvePtr &theCurve) { GeomCurvePtr anUntrimmedCurve = theCurve->basisCurve(); Handle(Geom_Curve) aCurve = anUntrimmedCurve->impl(); Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(aCurve); @@ -67,29 +63,25 @@ GeomAPI_Circ::GeomAPI_Circ(const GeomCurvePtr& theCurve) } //================================================================================================= -const std::shared_ptr GeomAPI_Circ::center() const -{ - const gp_Pnt& aCenter = MY_CIRC->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); +const std::shared_ptr GeomAPI_Circ::center() const { + const gp_Pnt &aCenter = MY_CIRC->Location(); + return std::shared_ptr( + new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); } //================================================================================================= -double GeomAPI_Circ::radius() const -{ - return MY_CIRC->Radius(); -} +double GeomAPI_Circ::radius() const { return MY_CIRC->Radius(); } //================================================================================================= -const std::shared_ptr GeomAPI_Circ::project( - const std::shared_ptr& thePoint) const -{ +const std::shared_ptr +GeomAPI_Circ::project(const std::shared_ptr &thePoint) const { std::shared_ptr aResult; if (!MY_CIRC) - return aResult; + return aResult; Handle(Geom_Circle) aCircle = new Geom_Circle(*MY_CIRC); - const gp_Pnt& aPoint = thePoint->impl(); + const gp_Pnt &aPoint = thePoint->impl(); GeomAPI_ProjectPointOnCurve aProj(aPoint, aCircle); Standard_Integer aNbPoint = aProj.NbPoints(); @@ -111,17 +103,16 @@ const std::shared_ptr GeomAPI_Circ::project( //================================================================================================= const bool GeomAPI_Circ::parameter(const std::shared_ptr thePoint, const double theTolerance, - double& theParameter) const -{ + double &theParameter) const { Handle(Geom_Circle) aCurve = new Geom_Circle(*MY_CIRC); - return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), - theTolerance, theParameter) == Standard_True; + return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, + theParameter) == Standard_True; } //================================================================================================= -std::shared_ptr GeomAPI_Circ::normal() const -{ - const gp_Ax1& anAxis = MY_CIRC->Axis(); - const gp_Dir& aDir = anAxis.Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +std::shared_ptr GeomAPI_Circ::normal() const { + const gp_Ax1 &anAxis = MY_CIRC->Axis(); + const gp_Dir &aDir = anAxis.Direction(); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } diff --git a/src/GeomAPI/GeomAPI_Circ.h b/src/GeomAPI/GeomAPI_Circ.h index f31a094e0..73c0fade8 100644 --- a/src/GeomAPI/GeomAPI_Circ.h +++ b/src/GeomAPI/GeomAPI_Circ.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Circ_H_ #define GeomAPI_Circ_H_ -#include #include +#include #include class GeomAPI_Ax2; @@ -33,26 +34,27 @@ class GeomAPI_Dir; * \brief Circle in 3D */ -class GeomAPI_Circ : public GeomAPI_Interface -{ - public: - +class GeomAPI_Circ : public GeomAPI_Interface { +public: /** \brief Constructs a circle of radius Radius, where theAx2 locates * the circle and defines its orientation in 3D space such that:\n * - the center of the circle is the origin of theAx2;\n - * - the origin, "X Direction" and "Y Direction" of theAx2 define the plane of the circle;\n + * - the origin, "X Direction" and "Y Direction" of theAx2 define the plane + * of the circle;\n * - theAx2 is the local coordinate system of the circle.\n - * Note: It is possible to create a circle where Radius is equal to 0.0. raised if Radius < 0. + * Note: It is possible to create a circle where Radius is equal to 0.0. + * raised if Radius < 0. */ GEOMAPI_EXPORT GeomAPI_Circ(const std::shared_ptr theAx2, const double theRadius); /// Creation of circle defined by center point, direction and circle radius - GEOMAPI_EXPORT GeomAPI_Circ(const std::shared_ptr& theCenter, - const std::shared_ptr& theDir, double theRadius); + GEOMAPI_EXPORT GeomAPI_Circ(const std::shared_ptr &theCenter, + const std::shared_ptr &theDir, + double theRadius); /// Creation of circle defined by a curve - GEOMAPI_EXPORT GeomAPI_Circ(const GeomCurvePtr& theCurve); + GEOMAPI_EXPORT GeomAPI_Circ(const GeomCurvePtr &theCurve); /// Return center of the circle GEOMAPI_EXPORT const std::shared_ptr center() const; @@ -64,25 +66,23 @@ class GeomAPI_Circ : public GeomAPI_Interface GEOMAPI_EXPORT std::shared_ptr normal() const; /// Project point on circle - GEOMAPI_EXPORT const std::shared_ptr project( - const std::shared_ptr& thePoint) const; - - /** \brief Computes the parameter of a given point on a circle. The point must be - * located either on the circle itself or relatively to the latter - * at a distance less than the tolerance value. Return FALSE if the point - * is beyond the tolerance limit or if computation fails. - * Max Tolerance value is currently limited to 1.e-4 - * \param[in] thePoint point of origin. - * \param[in] theTolerance tolerance of computation. - * \param[out] theParameter resulting parameter. + GEOMAPI_EXPORT const std::shared_ptr + project(const std::shared_ptr &thePoint) const; + + /** \brief Computes the parameter of a given point on a circle. The point must + * be located either on the circle itself or relatively to the latter at a + * distance less than the tolerance value. Return FALSE if the point is beyond + * the tolerance limit or if computation fails. Max Tolerance value is + * currently limited to 1.e-4 \param[in] thePoint point of origin. \param[in] + * theTolerance tolerance of computation. \param[out] theParameter resulting + * parameter. */ - GEOMAPI_EXPORT const bool parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const; + GEOMAPI_EXPORT const bool + parameter(const std::shared_ptr thePoint, + const double theTolerance, double &theParameter) const; }; //! Pointer on the object typedef std::shared_ptr GeomCirclePtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Circ2d.cpp b/src/GeomAPI/GeomAPI_Circ2d.cpp index ff3193c3d..f88c68645 100644 --- a/src/GeomAPI/GeomAPI_Circ2d.cpp +++ b/src/GeomAPI/GeomAPI_Circ2d.cpp @@ -14,32 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include -#include -#include -#include #include +#include #include +#include +#include #define MY_CIRC2D implPtr() - -static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY, const gp_Dir2d theDir, - const double theRadius) -{ +static gp_Circ2d *newCirc2d(const double theCenterX, const double theCenterY, + const gp_Dir2d theDir, const double theRadius) { gp_Pnt2d aCenter(theCenterX, theCenterY); return new gp_Circ2d(gp_Ax2d(aCenter, theDir), theRadius); } -static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY, - const double thePointX, const double thePointY) -{ +static gp_Circ2d *newCirc2d(const double theCenterX, const double theCenterY, + const double thePointX, const double thePointY) { gp_Pnt2d aCenter(theCenterX, theCenterY); gp_Pnt2d aPoint(thePointX, thePointY); @@ -53,37 +51,31 @@ static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY, return newCirc2d(theCenterX, theCenterY, aDir, aRadius); } - -GeomAPI_Circ2d::GeomAPI_Circ2d(const double theCenterX, - const double theCenterY, +GeomAPI_Circ2d::GeomAPI_Circ2d(const double theCenterX, const double theCenterY, const double theRadius) - : GeomAPI_Interface(newCirc2d(theCenterX, theCenterY, gp::DX2d(), theRadius)) -{ -} - -GeomAPI_Circ2d::GeomAPI_Circ2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theCirclePoint) : GeomAPI_Interface( - newCirc2d(theCenter->x(), theCenter->y(), theCirclePoint->x(), theCirclePoint->y())) -{ -} - -GeomAPI_Circ2d::GeomAPI_Circ2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theDir, double theRadius) - : GeomAPI_Interface( - newCirc2d(theCenter->x(), theCenter->y(), theDir->impl(), theRadius)) -{ -} - -const std::shared_ptr GeomAPI_Circ2d::project( - const std::shared_ptr& thePoint) const -{ + newCirc2d(theCenterX, theCenterY, gp::DX2d(), theRadius)) {} + +GeomAPI_Circ2d::GeomAPI_Circ2d( + const std::shared_ptr &theCenter, + const std::shared_ptr &theCirclePoint) + : GeomAPI_Interface(newCirc2d(theCenter->x(), theCenter->y(), + theCirclePoint->x(), theCirclePoint->y())) {} + +GeomAPI_Circ2d::GeomAPI_Circ2d(const std::shared_ptr &theCenter, + const std::shared_ptr &theDir, + double theRadius) + : GeomAPI_Interface(newCirc2d(theCenter->x(), theCenter->y(), + theDir->impl(), theRadius)) {} + +const std::shared_ptr +GeomAPI_Circ2d::project(const std::shared_ptr &thePoint) const { std::shared_ptr aResult; if (!MY_CIRC2D) return aResult; - const gp_Pnt2d& aCenter = MY_CIRC2D->Location(); - const gp_Pnt2d& aPoint = thePoint->impl(); + const gp_Pnt2d &aCenter = MY_CIRC2D->Location(); + const gp_Pnt2d &aPoint = thePoint->impl(); double aDist = aCenter.Distance(aPoint); if (aDist < Precision::Confusion()) @@ -103,37 +95,35 @@ const std::shared_ptr GeomAPI_Circ2d::project( return aResult; } -const std::shared_ptr GeomAPI_Circ2d::center() const -{ +const std::shared_ptr GeomAPI_Circ2d::center() const { if (!MY_CIRC2D) return std::shared_ptr(); - const gp_Pnt2d& aCenter = MY_CIRC2D->Location(); - return std::shared_ptr(new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y())); + const gp_Pnt2d &aCenter = MY_CIRC2D->Location(); + return std::shared_ptr( + new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y())); } -double GeomAPI_Circ2d::radius() const -{ +double GeomAPI_Circ2d::radius() const { if (!MY_CIRC2D) return 0.0; return MY_CIRC2D->Radius(); } //================================================================================================= -const bool GeomAPI_Circ2d::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const -{ +const bool +GeomAPI_Circ2d::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom2d_Circle) aCurve = new Geom2d_Circle(*MY_CIRC2D); return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, theParameter) == Standard_True; } //================================================================================================= -void GeomAPI_Circ2d::D0(const double theU, std::shared_ptr& thePoint) -{ +void GeomAPI_Circ2d::D0(const double theU, + std::shared_ptr &thePoint) { Handle(Geom2d_Circle) aCurve = new Geom2d_Circle(*MY_CIRC2D); gp_Pnt2d aPnt; aCurve->D0(theU, aPnt); thePoint.reset(new GeomAPI_Pnt2d(aPnt.X(), aPnt.Y())); } - diff --git a/src/GeomAPI/GeomAPI_Circ2d.h b/src/GeomAPI/GeomAPI_Circ2d.h index 2306b87e7..d0bbd6d01 100644 --- a/src/GeomAPI/GeomAPI_Circ2d.h +++ b/src/GeomAPI/GeomAPI_Circ2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Circ2d_H_ @@ -33,22 +34,23 @@ class GeomAPI_Shape; * \brief Circle in 2D */ -class GeomAPI_Circ2d : public GeomAPI_Interface -{ +class GeomAPI_Circ2d : public GeomAPI_Interface { public: /// Creation of circle defined by center point and circle radius GEOMAPI_EXPORT - GeomAPI_Circ2d(const double theCenterX, const double theCenterY, const double theRadius); + GeomAPI_Circ2d(const double theCenterX, const double theCenterY, + const double theRadius); /// Creation of circle defined by center point and circle radius GEOMAPI_EXPORT - GeomAPI_Circ2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theCirclePoint); + GeomAPI_Circ2d(const std::shared_ptr &theCenter, + const std::shared_ptr &theCirclePoint); /// Creation of circle defined by center point, direction and circle radius GEOMAPI_EXPORT - GeomAPI_Circ2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theDir, double theRadius); + GeomAPI_Circ2d(const std::shared_ptr &theCenter, + const std::shared_ptr &theDir, + double theRadius); /// Return center of the circle GEOMAPI_EXPORT @@ -60,30 +62,29 @@ public: /// Project point on line GEOMAPI_EXPORT - const std::shared_ptr project( - const std::shared_ptr& thePoint) const; + const std::shared_ptr + project(const std::shared_ptr &thePoint) const; - /** \brief Computes the parameter of a given point on a circle. The point must be - * located either on the circle itself or relatively to the latter - * at a distance less than the tolerance value. Return FALSE if the point - * is beyond the tolerance limit or if computation fails. - * Max Tolerance value is currently limited to 1.e-4 - * \param[in] thePoint point of origin. - * \param[in] theTolerance tolerance of computation. - * \param[out] theParameter resulting parameter. + /** \brief Computes the parameter of a given point on a circle. The point must + * be located either on the circle itself or relatively to the latter at a + * distance less than the tolerance value. Return FALSE if the point is beyond + * the tolerance limit or if computation fails. Max Tolerance value is + * currently limited to 1.e-4 \param[in] thePoint point of origin. \param[in] + * theTolerance tolerance of computation. \param[out] theParameter resulting + * parameter. */ - GEOMAPI_EXPORT const bool parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const; + GEOMAPI_EXPORT const bool + parameter(const std::shared_ptr thePoint, + const double theTolerance, double &theParameter) const; /** \brief Returns in thePoint the point of parameter theU. - * P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of the circle, - * XDir the XDirection and YDir the YDirection of the circle's local coordinate system. - * \param[in] theU parameter. - * \param[out] thePoint resulting point. + * P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of + * the circle, XDir the XDirection and YDir the YDirection of the circle's + * local coordinate system. \param[in] theU parameter. \param[out] thePoint + * resulting point. */ - GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr& thePoint); + GEOMAPI_EXPORT void D0(const double theU, + std::shared_ptr &thePoint); }; #endif - diff --git a/src/GeomAPI/GeomAPI_Cone.cpp b/src/GeomAPI/GeomAPI_Cone.cpp index 110ff6ffa..8f2624c25 100644 --- a/src/GeomAPI/GeomAPI_Cone.cpp +++ b/src/GeomAPI/GeomAPI_Cone.cpp @@ -14,59 +14,53 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include -#include #include +#include #define MY_CONE implPtr() -static gp_Cone* newCone(const gp_Pnt& theApex, const gp_Dir& theAxis, - const double theSemiAngle, const double theRadius = 0.0) -{ +static gp_Cone *newCone(const gp_Pnt &theApex, const gp_Dir &theAxis, + const double theSemiAngle, + const double theRadius = 0.0) { return new gp_Cone(gp_Ax3(theApex, theAxis), theSemiAngle, theRadius); } //================================================================================================= -GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr& theApex, - const std::shared_ptr& theAxis, +GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr &theApex, + const std::shared_ptr &theAxis, const double theSemiAngle) - : GeomAPI_Interface(newCone(theApex->impl(), theAxis->impl(), theSemiAngle)), - myRadius1(Precision::Infinite()), - myRadius2(Precision::Infinite()) -{ -} + : GeomAPI_Interface(newCone(theApex->impl(), + theAxis->impl(), theSemiAngle)), + myRadius1(Precision::Infinite()), myRadius2(Precision::Infinite()) {} //================================================================================================= -GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, - const double theSemiAngle, - const double theRadius) - : GeomAPI_Interface( - newCone(theLocation->impl(), theAxis->impl(), theSemiAngle, theRadius)), - myRadius1(theRadius), - myRadius2(Precision::Infinite()) -{ -} +GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, + const double theSemiAngle, const double theRadius) + : GeomAPI_Interface(newCone(theLocation->impl(), + theAxis->impl(), theSemiAngle, + theRadius)), + myRadius1(theRadius), myRadius2(Precision::Infinite()) {} //================================================================================================= -GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, - const double theSemiAngle, - const double theRadius1, +GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, + const double theSemiAngle, const double theRadius1, const double theRadius2) - : myRadius1(theRadius1), - myRadius2(theRadius2) -{ + : myRadius1(theRadius1), myRadius2(theRadius2) { gp_Pnt aLoc = theLocation->impl(); gp_Dir aDir = theAxis->impl(); if (theRadius1 > theRadius2) { - aLoc.ChangeCoord() += aDir.XYZ() * (theRadius1 - theRadius2) / Tan(theSemiAngle); + aLoc.ChangeCoord() += + aDir.XYZ() * (theRadius1 - theRadius2) / Tan(theSemiAngle); aDir.Reverse(); myRadius1 = theRadius2; myRadius2 = theRadius1; @@ -76,47 +70,37 @@ GeomAPI_Cone::GeomAPI_Cone(const std::shared_ptr& theLocation, } //================================================================================================= -std::shared_ptr GeomAPI_Cone::apex() const -{ - const gp_Pnt& anApex = MY_CONE->Apex(); - return std::shared_ptr(new GeomAPI_Pnt(anApex.X(), anApex.Y(), anApex.Z())); +std::shared_ptr GeomAPI_Cone::apex() const { + const gp_Pnt &anApex = MY_CONE->Apex(); + return std::shared_ptr( + new GeomAPI_Pnt(anApex.X(), anApex.Y(), anApex.Z())); } //================================================================================================= -std::shared_ptr GeomAPI_Cone::location() const -{ - const gp_Pnt& aLoc = MY_CONE->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); +std::shared_ptr GeomAPI_Cone::location() const { + const gp_Pnt &aLoc = MY_CONE->Location(); + return std::shared_ptr( + new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); } //================================================================================================= -std::shared_ptr GeomAPI_Cone::axis() const -{ - const gp_Dir& anAxis = MY_CONE->Position().Direction(); - return std::shared_ptr(new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z())); +std::shared_ptr GeomAPI_Cone::axis() const { + const gp_Dir &anAxis = MY_CONE->Position().Direction(); + return std::shared_ptr( + new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z())); } //================================================================================================= -double GeomAPI_Cone::semiAngle() const -{ - return MY_CONE->SemiAngle(); -} +double GeomAPI_Cone::semiAngle() const { return MY_CONE->SemiAngle(); } //================================================================================================= -double GeomAPI_Cone::radius1() const -{ - return myRadius1; -} +double GeomAPI_Cone::radius1() const { return myRadius1; } //================================================================================================= -double GeomAPI_Cone::radius2() const -{ - return myRadius2; -} +double GeomAPI_Cone::radius2() const { return myRadius2; } //================================================================================================= -double GeomAPI_Cone::height() const -{ +double GeomAPI_Cone::height() const { if (Precision::IsInfinite(myRadius1) || Precision::IsInfinite(myRadius2)) return Precision::Infinite(); @@ -124,14 +108,14 @@ double GeomAPI_Cone::height() const } //================================================================================================= -bool GeomAPI_Cone::isSemiInfinite() const -{ - return (!Precision::IsInfinite(myRadius1) && Precision::IsInfinite(myRadius2)) || - (Precision::IsInfinite(myRadius1) && !Precision::IsInfinite(myRadius2)); +bool GeomAPI_Cone::isSemiInfinite() const { + return (!Precision::IsInfinite(myRadius1) && + Precision::IsInfinite(myRadius2)) || + (Precision::IsInfinite(myRadius1) && + !Precision::IsInfinite(myRadius2)); } //================================================================================================= -bool GeomAPI_Cone::isInfinite() const -{ +bool GeomAPI_Cone::isInfinite() const { return Precision::IsInfinite(myRadius1) && Precision::IsInfinite(myRadius2); } diff --git a/src/GeomAPI/GeomAPI_Cone.h b/src/GeomAPI/GeomAPI_Cone.h index 17da78a89..ac36550cb 100644 --- a/src/GeomAPI/GeomAPI_Cone.h +++ b/src/GeomAPI/GeomAPI_Cone.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Cone_H_ @@ -30,27 +31,26 @@ class GeomAPI_Pnt; * \ingroup DataModel * \brief Conical surface in 3D */ -class GeomAPI_Cone : public GeomAPI_Interface -{ +class GeomAPI_Cone : public GeomAPI_Interface { public: /// Creation of infinite cone defined by apex, axis and semi-angle - GEOMAPI_EXPORT GeomAPI_Cone(const std::shared_ptr& theApex, - const std::shared_ptr& theAxis, + GEOMAPI_EXPORT GeomAPI_Cone(const std::shared_ptr &theApex, + const std::shared_ptr &theAxis, const double theSemiAngle); - /// Creation of semi-infinite cone by location and radius of reference circle, axis, semi-angle - GEOMAPI_EXPORT GeomAPI_Cone(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, + /// Creation of semi-infinite cone by location and radius of reference circle, + /// axis, semi-angle + GEOMAPI_EXPORT GeomAPI_Cone(const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, const double theSemiAngle, const double theRadius); /// Creating of cone by location of reference circle, axis, semi-angle and /// radii of boundary circles - GEOMAPI_EXPORT GeomAPI_Cone(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, + GEOMAPI_EXPORT GeomAPI_Cone(const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, const double theSemiAngle, - const double theRadius1, - const double theRadius2); + const double theRadius1, const double theRadius2); /// Return apex of the cone GEOMAPI_EXPORT std::shared_ptr apex() const; @@ -64,10 +64,12 @@ public: /// Return semi-angle of the cone GEOMAPI_EXPORT double semiAngle() const; - /// Return first radius of the cone or Precision::Infinite() if the cone is infinite + /// Return first radius of the cone or Precision::Infinite() if the cone is + /// infinite GEOMAPI_EXPORT double radius1() const; - /// Return second radius of the cone or Precision::Infinite() if the cone is infinite + /// Return second radius of the cone or Precision::Infinite() if the cone is + /// infinite GEOMAPI_EXPORT double radius2() const; /// Return height of the cone diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index a524ff62d..8419719f6 100644 --- a/src/GeomAPI/GeomAPI_Curve.cpp +++ b/src/GeomAPI/GeomAPI_Curve.cpp @@ -14,37 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include +#include +#include -#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include #include -#include +#include +#include #define MY_CURVE (*(implPtr())) GeomAPI_Curve::GeomAPI_Curve() : GeomAPI_Interface(new Handle_Geom_Curve()), - myStart(-Precision::Infinite()), - myEnd(Precision::Infinite()) -{ -} + myStart(-Precision::Infinite()), myEnd(Precision::Infinite()) {} -GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr& theShape) - : GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null +GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr &theShape) + : GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null { - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); TopoDS_Edge anEdge = TopoDS::Edge(aShape); if (!anEdge.IsNull()) { Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, myStart, myEnd); @@ -54,13 +52,12 @@ GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr& theShape) } } -bool GeomAPI_Curve::isNull() const -{ +bool GeomAPI_Curve::isNull() const { return MY_CURVE.IsNull() == Standard_True; } -static bool isCurveType(const Handle(Geom_Curve)& theCurve, const Handle(Standard_Type)& theType) -{ +static bool isCurveType(const Handle(Geom_Curve) & theCurve, + const Handle(Standard_Type) & theType) { if (theCurve.IsNull()) return false; Handle(Geom_Curve) aCurve = theCurve; @@ -69,64 +66,56 @@ static bool isCurveType(const Handle(Geom_Curve)& theCurve, const Handle(Standar return aCurve->DynamicType() == theType; } -bool GeomAPI_Curve::isLine() const -{ +bool GeomAPI_Curve::isLine() const { return isCurveType(MY_CURVE, STANDARD_TYPE(Geom_Line)); } -bool GeomAPI_Curve::isCircle() const -{ +bool GeomAPI_Curve::isCircle() const { return isCurveType(MY_CURVE, STANDARD_TYPE(Geom_Circle)); } -bool GeomAPI_Curve::isEllipse() const -{ +bool GeomAPI_Curve::isEllipse() const { return isCurveType(MY_CURVE, STANDARD_TYPE(Geom_Ellipse)); } -double GeomAPI_Curve::startParam() -{ +double GeomAPI_Curve::startParam() { if (Precision::IsInfinite(myStart)) { if (isTrimmed()) { myStart = Handle(Geom_TrimmedCurve)::DownCast(MY_CURVE)->FirstParameter(); - } - else if (MY_CURVE->IsClosed() && MY_CURVE->IsPeriodic()) + } else if (MY_CURVE->IsClosed() && MY_CURVE->IsPeriodic()) myStart = 0.0; } return myStart; } -double GeomAPI_Curve::endParam() -{ +double GeomAPI_Curve::endParam() { if (Precision::IsInfinite(myEnd)) { if (isTrimmed()) { myEnd = Handle(Geom_TrimmedCurve)::DownCast(MY_CURVE)->LastParameter(); - } - else if (MY_CURVE->IsClosed() && MY_CURVE->IsPeriodic()) + } else if (MY_CURVE->IsClosed() && MY_CURVE->IsPeriodic()) myEnd = MY_CURVE->Period(); } return myEnd; } -std::shared_ptr GeomAPI_Curve::getPoint(double theParam) -{ +std::shared_ptr GeomAPI_Curve::getPoint(double theParam) { GeomAdaptor_Curve aAdaptor(MY_CURVE, myStart, myEnd); gp_Pnt aPnt = aAdaptor.Value(theParam); - return std::shared_ptr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); } -bool GeomAPI_Curve::isEqual(const std::shared_ptr& theOther) const -{ +bool GeomAPI_Curve::isEqual( + const std::shared_ptr &theOther) const { return MY_CURVE == theOther->impl(); } -bool GeomAPI_Curve::isTrimmed() const -{ - return !isNull() && MY_CURVE->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve); +bool GeomAPI_Curve::isTrimmed() const { + return !isNull() && + MY_CURVE->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve); } -GeomCurvePtr GeomAPI_Curve::basisCurve() const -{ +GeomCurvePtr GeomAPI_Curve::basisCurve() const { Handle(Geom_Curve) aCurve = MY_CURVE; if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); @@ -136,31 +125,29 @@ GeomCurvePtr GeomAPI_Curve::basisCurve() const return aNewCurve; } - -const std::shared_ptr GeomAPI_Curve::project( - const std::shared_ptr& thePoint) const -{ +const std::shared_ptr +GeomAPI_Curve::project(const std::shared_ptr &thePoint) const { std::shared_ptr aResult; if (MY_CURVE.IsNull()) return aResult; - const gp_Pnt& aPoint = thePoint->impl(); + const gp_Pnt &aPoint = thePoint->impl(); GeomAPI_ProjectPointOnCurve aProj(aPoint, MY_CURVE); Standard_Integer aNbPoint = aProj.NbPoints(); if (aNbPoint > 0) { gp_Pnt aNearest = aProj.NearestPoint(); - aResult = GeomPointPtr(new GeomAPI_Pnt(aNearest.X(), aNearest.Y(), aNearest.Z())); + aResult = + GeomPointPtr(new GeomAPI_Pnt(aNearest.X(), aNearest.Y(), aNearest.Z())); } return aResult; } // ================================================================================================ -bool GeomAPI_Curve::Comparator::operator()(const GeomCurvePtr& theCurve1, - const GeomCurvePtr& theCurve2) const -{ - const Handle(Geom_Curve)& aCurve1 = theCurve1->impl(); - const Handle(Geom_Curve)& aCurve2 = theCurve2->impl(); +bool GeomAPI_Curve::Comparator::operator()( + const GeomCurvePtr &theCurve1, const GeomCurvePtr &theCurve2) const { + const Handle(Geom_Curve) &aCurve1 = theCurve1->impl(); + const Handle(Geom_Curve) &aCurve2 = theCurve2->impl(); return aCurve1.get() < aCurve2.get(); } diff --git a/src/GeomAPI/GeomAPI_Curve.h b/src/GeomAPI/GeomAPI_Curve.h index 11775704d..a565f9194 100644 --- a/src/GeomAPI/GeomAPI_Curve.h +++ b/src/GeomAPI/GeomAPI_Curve.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Curve_H_ @@ -30,16 +31,15 @@ class GeomAPI_Pnt; * \brief Interface to the generic curve object */ -class GeomAPI_Curve : public GeomAPI_Interface -{ - public: +class GeomAPI_Curve : public GeomAPI_Interface { +public: /// Creation of empty (null) shape GEOMAPI_EXPORT GeomAPI_Curve(); /// Creates a curve from the shape (edge) GEOMAPI_EXPORT - GeomAPI_Curve(const std::shared_ptr& theShape); + GeomAPI_Curve(const std::shared_ptr &theShape); /// Returns true if curve is not initialized GEOMAPI_EXPORT @@ -47,7 +47,7 @@ class GeomAPI_Curve : public GeomAPI_Interface /// Returns \c true if curves are equal GEOMAPI_EXPORT - bool isEqual(const std::shared_ptr& theOther) const; + bool isEqual(const std::shared_ptr &theOther) const; /// Returns whether the curve is linear GEOMAPI_EXPORT @@ -83,18 +83,18 @@ class GeomAPI_Curve : public GeomAPI_Interface std::shared_ptr getPoint(double theParam); /// Project point on curve - GEOMAPI_EXPORT const std::shared_ptr project( - const std::shared_ptr& thePoint) const; + GEOMAPI_EXPORT const std::shared_ptr + project(const std::shared_ptr &thePoint) const; public: /// \brief Compare addresses of curves - class Comparator - { + class Comparator { public: - /// Return \c true if the address of the first curve is less than the address of the second + /// Return \c true if the address of the first curve is less than the + /// address of the second GEOMAPI_EXPORT - bool operator ()(const std::shared_ptr& theCurve1, - const std::shared_ptr& theCurve2) const; + bool operator()(const std::shared_ptr &theCurve1, + const std::shared_ptr &theCurve2) const; }; private: diff --git a/src/GeomAPI/GeomAPI_Cylinder.cpp b/src/GeomAPI/GeomAPI_Cylinder.cpp index 3d7397899..db0e6ca5b 100644 --- a/src/GeomAPI/GeomAPI_Cylinder.cpp +++ b/src/GeomAPI/GeomAPI_Cylinder.cpp @@ -14,81 +14,73 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include -#include #include +#include #define MY_CYL implPtr() -static gp_Cylinder* newCyl(const gp_Pnt& theLocation, const gp_Dir& theAxis, const double theRadius) -{ +static gp_Cylinder *newCyl(const gp_Pnt &theLocation, const gp_Dir &theAxis, + const double theRadius) { return new gp_Cylinder(gp_Ax3(theLocation, theAxis), theRadius); } //================================================================================================= -GeomAPI_Cylinder::GeomAPI_Cylinder(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, - const double theRadius) - : GeomAPI_Interface(newCyl(theLocation->impl(), theAxis->impl(), theRadius)), - myHeight(Precision::Infinite()) -{ -} +GeomAPI_Cylinder::GeomAPI_Cylinder( + const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, const double theRadius) + : GeomAPI_Interface(newCyl(theLocation->impl(), + theAxis->impl(), theRadius)), + myHeight(Precision::Infinite()) {} //================================================================================================= -GeomAPI_Cylinder::GeomAPI_Cylinder(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, - const double theRadius, - const double theHeight) - : GeomAPI_Interface(newCyl(theLocation->impl(), theAxis->impl(), theRadius)), - myHeight(theHeight) -{ -} +GeomAPI_Cylinder::GeomAPI_Cylinder( + const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, const double theRadius, + const double theHeight) + : GeomAPI_Interface(newCyl(theLocation->impl(), + theAxis->impl(), theRadius)), + myHeight(theHeight) {} //================================================================================================= -std::shared_ptr GeomAPI_Cylinder::location() const -{ - const gp_Pnt& aCenter = MY_CYL->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); +std::shared_ptr GeomAPI_Cylinder::location() const { + const gp_Pnt &aCenter = MY_CYL->Location(); + return std::shared_ptr( + new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); } //================================================================================================= -std::shared_ptr GeomAPI_Cylinder::axis() const -{ - const gp_Dir& anAxis = MY_CYL->Position().Direction(); - return std::shared_ptr(new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z())); +std::shared_ptr GeomAPI_Cylinder::axis() const { + const gp_Dir &anAxis = MY_CYL->Position().Direction(); + return std::shared_ptr( + new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z())); } //================================================================================================= -double GeomAPI_Cylinder::radius() const -{ - return MY_CYL->Radius(); -} +double GeomAPI_Cylinder::radius() const { return MY_CYL->Radius(); } //================================================================================================= -double GeomAPI_Cylinder::height() const -{ - return myHeight; -} +double GeomAPI_Cylinder::height() const { return myHeight; } //================================================================================================= -bool GeomAPI_Cylinder::isInfinite() const -{ +bool GeomAPI_Cylinder::isInfinite() const { return Precision::IsInfinite(myHeight); } //================================================================================================= -bool GeomAPI_Cylinder::isCoincident(const GeomCylinderPtr theCylinder, const double theTolerance) -{ +bool GeomAPI_Cylinder::isCoincident(const GeomCylinderPtr theCylinder, + const double theTolerance) { if (!theCylinder) return false; - gp_Cylinder* anOther = theCylinder->implPtr(); + gp_Cylinder *anOther = theCylinder->implPtr(); if (fabs(MY_CYL->Radius() - anOther->Radius()) < theTolerance) { gp_Dir aDir1 = MY_CYL->Position().Direction(); gp_Dir aDir2 = anOther->Position().Direction(); diff --git a/src/GeomAPI/GeomAPI_Cylinder.h b/src/GeomAPI/GeomAPI_Cylinder.h index 1c72f8b8f..16dee4ca7 100644 --- a/src/GeomAPI/GeomAPI_Cylinder.h +++ b/src/GeomAPI/GeomAPI_Cylinder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Cylinder_H_ @@ -30,19 +31,19 @@ class GeomAPI_Pnt; * \ingroup DataModel * \brief Cylindrical surface in 3D */ -class GeomAPI_Cylinder : public GeomAPI_Interface -{ +class GeomAPI_Cylinder : public GeomAPI_Interface { public: /// Creation of infinite cylinder defined by location, axis and radius - GEOMAPI_EXPORT GeomAPI_Cylinder(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, - const double theRadius); + GEOMAPI_EXPORT + GeomAPI_Cylinder(const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, + const double theRadius); /// Creation of cylinder defined by location, axis, radius and height - GEOMAPI_EXPORT GeomAPI_Cylinder(const std::shared_ptr& theLocation, - const std::shared_ptr& theAxis, - const double theRadius, - const double theHeight); + GEOMAPI_EXPORT + GeomAPI_Cylinder(const std::shared_ptr &theLocation, + const std::shared_ptr &theAxis, + const double theRadius, const double theHeight); /// Return location of the cylinder GEOMAPI_EXPORT std::shared_ptr location() const; @@ -53,15 +54,17 @@ public: /// Return radius of the cylinder GEOMAPI_EXPORT double radius() const; - /// Return height of the cylinder or Precision::Infinite() if the cylinder is infinite + /// Return height of the cylinder or Precision::Infinite() if the cylinder is + /// infinite GEOMAPI_EXPORT double height() const; /// Return \c true is the cylinder is infinite GEOMAPI_EXPORT bool isInfinite() const; /// Returns true if cylinders have same axis and radii. - GEOMAPI_EXPORT bool isCoincident(const std::shared_ptr theCylinder, - const double theTolerance = 1.e-7); + GEOMAPI_EXPORT bool + isCoincident(const std::shared_ptr theCylinder, + const double theTolerance = 1.e-7); private: double myHeight; diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp index b480d01b5..0aea27c0a 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,25 +24,26 @@ #include #include -typedef NCollection_DataMap > MAP; +typedef NCollection_DataMap> MAP; #define MY_MAP implPtr() //================================================================================================= GeomAPI_DataMapOfShapeMapOfShapes::GeomAPI_DataMapOfShapeMapOfShapes() -: GeomAPI_Interface(new NCollection_DataMap >) -{} + : GeomAPI_Interface( + new NCollection_DataMap>) {} //================================================================================================= -bool GeomAPI_DataMapOfShapeMapOfShapes::bind(const std::shared_ptr theKey, - const ListOfShape& theItems) -{ - const TopoDS_Shape& aKey = theKey->impl(); - if(MY_MAP->IsBound(aKey)) { +bool GeomAPI_DataMapOfShapeMapOfShapes::bind( + const std::shared_ptr theKey, const ListOfShape &theItems) { + const TopoDS_Shape &aKey = theKey->impl(); + if (MY_MAP->IsBound(aKey)) { MY_MAP->ChangeFind(aKey).Clear(); } - for(ListOfShape::const_iterator anIt = theItems.cbegin(); anIt != theItems.cend(); anIt++) { - const TopoDS_Shape& anItem = (*anIt)->impl(); - if(MY_MAP->IsBound(aKey)) { + for (ListOfShape::const_iterator anIt = theItems.cbegin(); + anIt != theItems.cend(); anIt++) { + const TopoDS_Shape &anItem = (*anIt)->impl(); + if (MY_MAP->IsBound(aKey)) { MY_MAP->ChangeFind(aKey).Add(anItem); } else { NCollection_Map anItems; @@ -54,12 +56,12 @@ bool GeomAPI_DataMapOfShapeMapOfShapes::bind(const std::shared_ptr theKey, - const std::shared_ptr theItem) -{ - const TopoDS_Shape& aKey = theKey->impl(); - const TopoDS_Shape& anItem = theItem->impl(); - if(MY_MAP->IsBound(aKey)) { +bool GeomAPI_DataMapOfShapeMapOfShapes::add( + const std::shared_ptr theKey, + const std::shared_ptr theItem) { + const TopoDS_Shape &aKey = theKey->impl(); + const TopoDS_Shape &anItem = theItem->impl(); + if (MY_MAP->IsBound(aKey)) { return MY_MAP->ChangeFind(aKey).Add(anItem) == Standard_True; } else { NCollection_Map anItems; @@ -69,24 +71,24 @@ bool GeomAPI_DataMapOfShapeMapOfShapes::add(const std::shared_ptr } //================================================================================================= -bool GeomAPI_DataMapOfShapeMapOfShapes::isBound(const std::shared_ptr theKey) const -{ - const TopoDS_Shape& aKey = theKey->impl(); +bool GeomAPI_DataMapOfShapeMapOfShapes::isBound( + const std::shared_ptr theKey) const { + const TopoDS_Shape &aKey = theKey->impl(); return MY_MAP->IsBound(aKey) == Standard_True; } //================================================================================================= -bool GeomAPI_DataMapOfShapeMapOfShapes::find(const std::shared_ptr theKey, - ListOfShape& theItems) const -{ - const TopoDS_Shape& aKey = theKey->impl(); +bool GeomAPI_DataMapOfShapeMapOfShapes::find( + const std::shared_ptr theKey, ListOfShape &theItems) const { + const TopoDS_Shape &aKey = theKey->impl(); - if(MY_MAP->IsBound(aKey) == Standard_False) { + if (MY_MAP->IsBound(aKey) == Standard_False) { return false; } - const NCollection_Map& aMap = MY_MAP->Find(aKey); - for(NCollection_Map::Iterator anIt(aMap); anIt.More(); anIt.Next()) { + const NCollection_Map &aMap = MY_MAP->Find(aKey); + for (NCollection_Map::Iterator anIt(aMap); anIt.More(); + anIt.Next()) { std::shared_ptr aShape(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(anIt.Value())); theItems.push_back(aShape); @@ -96,23 +98,17 @@ bool GeomAPI_DataMapOfShapeMapOfShapes::find(const std::shared_ptr theKey) -{ - const TopoDS_Shape& aKey = theKey->impl(); +bool GeomAPI_DataMapOfShapeMapOfShapes::unBind( + const std::shared_ptr theKey) { + const TopoDS_Shape &aKey = theKey->impl(); return MY_MAP->UnBind(aKey) == Standard_True; } //================================================================================================= -void GeomAPI_DataMapOfShapeMapOfShapes::clear() -{ - return MY_MAP->Clear(); -} +void GeomAPI_DataMapOfShapeMapOfShapes::clear() { return MY_MAP->Clear(); } //================================================================================================= -int GeomAPI_DataMapOfShapeMapOfShapes::size() const -{ - return MY_MAP->Size(); -} +int GeomAPI_DataMapOfShapeMapOfShapes::size() const { return MY_MAP->Size(); } // LCOV_EXCL_START @@ -120,22 +116,17 @@ int GeomAPI_DataMapOfShapeMapOfShapes::size() const // iterator implementation //================================================================================================= -class IteratorImpl : public GeomAPI_DataMapOfShapeMapOfShapes::iterator -{ +class IteratorImpl : public GeomAPI_DataMapOfShapeMapOfShapes::iterator { public: IteratorImpl() {} - IteratorImpl(const MAP::Iterator& theIterator) - : myIterator(theIterator) - {} + IteratorImpl(const MAP::Iterator &theIterator) : myIterator(theIterator) {} - IteratorImpl(const std::shared_ptr& theIterator) - { + IteratorImpl(const std::shared_ptr &theIterator) { mySelf = theIterator; } - bool operator==(const std::shared_ptr& theOther) const - { + bool operator==(const std::shared_ptr &theOther) const { if (theOther) return theOther->myIterator.IsEqual(myIterator); @@ -143,21 +134,19 @@ public: return !myIterator.More(); } - virtual iterator& operator++() - { + virtual iterator &operator++() { myIterator.Next(); return *this; } - virtual iterator operator++(int) - { - std::shared_ptr aSelf = std::dynamic_pointer_cast(mySelf); + virtual iterator operator++(int) { + std::shared_ptr aSelf = + std::dynamic_pointer_cast(mySelf); std::shared_ptr aCopy(new IteratorImpl(aSelf->myIterator)); myIterator.Next(); return IteratorImpl(aCopy); } - virtual key_type first() const - { + virtual key_type first() const { if (mySelf) return iterator::first(); @@ -166,14 +155,14 @@ public: return aShape; } - virtual mapped_type second() const - { + virtual mapped_type second() const { if (mySelf) return iterator::second(); ListOfShape anItems; - const NCollection_Map& aMap = myIterator.Value(); - for(NCollection_Map::Iterator anIt(aMap); anIt.More(); anIt.Next()) { + const NCollection_Map &aMap = myIterator.Value(); + for (NCollection_Map::Iterator anIt(aMap); anIt.More(); + anIt.Next()) { std::shared_ptr aShape(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(anIt.Value())); anItems.push_back(aShape); @@ -185,88 +174,77 @@ private: MAP::Iterator myIterator; }; - -GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator() -{ -} +GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator() {} GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator( - const GeomAPI_DataMapOfShapeMapOfShapes::iterator& theOther) - : mySelf(theOther.mySelf) -{ -} + const GeomAPI_DataMapOfShapeMapOfShapes::iterator &theOther) + : mySelf(theOther.mySelf) {} -const GeomAPI_DataMapOfShapeMapOfShapes::iterator& - GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator=( - const GeomAPI_DataMapOfShapeMapOfShapes::iterator& theOther) -{ +const GeomAPI_DataMapOfShapeMapOfShapes::iterator & +GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator=( + const GeomAPI_DataMapOfShapeMapOfShapes::iterator &theOther) { mySelf = theOther.mySelf; return *this; } -bool GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator==(const iterator& theOther) const -{ - std::shared_ptr aSelf = std::dynamic_pointer_cast(mySelf); +bool GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator==( + const iterator &theOther) const { + std::shared_ptr aSelf = + std::dynamic_pointer_cast(mySelf); std::shared_ptr aSelfOther = std::dynamic_pointer_cast(theOther.mySelf); return aSelf ? aSelf->operator==(aSelfOther) - : (aSelfOther ? aSelfOther->operator==(aSelf) : true); + : (aSelfOther ? aSelfOther->operator==(aSelf) : true); } -bool GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator!=(const iterator& theOther) const -{ +bool GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator!=( + const iterator &theOther) const { return !operator==(theOther); } -GeomAPI_DataMapOfShapeMapOfShapes::iterator& - GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator++() -{ +GeomAPI_DataMapOfShapeMapOfShapes::iterator & +GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator++() { mySelf->operator++(); return *this; } GeomAPI_DataMapOfShapeMapOfShapes::iterator - GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator++(int) -{ +GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator++(int) { return ++(*mySelf); } GeomAPI_DataMapOfShapeMapOfShapes::iterator::key_type - GeomAPI_DataMapOfShapeMapOfShapes::iterator::first() const -{ +GeomAPI_DataMapOfShapeMapOfShapes::iterator::first() const { return mySelf->first(); } GeomAPI_DataMapOfShapeMapOfShapes::iterator::mapped_type - GeomAPI_DataMapOfShapeMapOfShapes::iterator::second() const -{ +GeomAPI_DataMapOfShapeMapOfShapes::iterator::second() const { return mySelf->second(); } - - -GeomAPI_DataMapOfShapeMapOfShapes::iterator GeomAPI_DataMapOfShapeMapOfShapes::begin() -{ +GeomAPI_DataMapOfShapeMapOfShapes::iterator +GeomAPI_DataMapOfShapeMapOfShapes::begin() { MAP::Iterator anIt(*MY_MAP); std::shared_ptr anIter(new IteratorImpl(anIt)); return IteratorImpl(anIter); } -GeomAPI_DataMapOfShapeMapOfShapes::const_iterator GeomAPI_DataMapOfShapeMapOfShapes::begin() const -{ +GeomAPI_DataMapOfShapeMapOfShapes::const_iterator +GeomAPI_DataMapOfShapeMapOfShapes::begin() const { MAP::Iterator anIt(*MY_MAP); std::shared_ptr anIter(new IteratorImpl(anIt)); return IteratorImpl(anIter); } -GeomAPI_DataMapOfShapeMapOfShapes::iterator GeomAPI_DataMapOfShapeMapOfShapes::end() -{ +GeomAPI_DataMapOfShapeMapOfShapes::iterator +GeomAPI_DataMapOfShapeMapOfShapes::end() { return IteratorImpl(std::shared_ptr()); } -GeomAPI_DataMapOfShapeMapOfShapes::const_iterator GeomAPI_DataMapOfShapeMapOfShapes::end() const -{ +GeomAPI_DataMapOfShapeMapOfShapes::const_iterator +GeomAPI_DataMapOfShapeMapOfShapes::end() const { return IteratorImpl(std::shared_ptr()); } // LCOV_EXCL_STOP diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h index afc59e7c9..f59ab8a91 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_DataMapOfShapeMapOfShapes_H_ @@ -27,8 +28,7 @@ /// \class GeomAPI_DataMapOfShapeMapOfShapes /// \ingroup DataModel /// \brief DataMap of Shape - Map of Shapes defined by TopoDS_Shapes -class GeomAPI_DataMapOfShapeMapOfShapes : public GeomAPI_Interface -{ +class GeomAPI_DataMapOfShapeMapOfShapes : public GeomAPI_Interface { public: /// Constructor.Creates empty map. GEOMAPI_EXPORT GeomAPI_DataMapOfShapeMapOfShapes(); @@ -36,10 +36,11 @@ public: /// \brief Binds list of shapes to the key shape. /// \param[in] theKey key shape. /// \param[in] theItems list of shapes. - /// If shapes have duplications in list only one will be stored. + /// If shapes have duplications in list only one will be + /// stored. /// \returns true if items bound successfully. GEOMAPI_EXPORT bool bind(const std::shared_ptr theKey, - const ListOfShape& theItems); + const ListOfShape &theItems); /// \brief Adds item to the map bounded to the key. /// \param[in] theKey key shape. @@ -49,11 +50,12 @@ public: const std::shared_ptr theItem); /// \return true if theKey is stored in the map. - GEOMAPI_EXPORT bool isBound(const std::shared_ptr theKey) const; + GEOMAPI_EXPORT bool + isBound(const std::shared_ptr theKey) const; /// \return list of shapes bounded to theKey. GEOMAPI_EXPORT bool find(const std::shared_ptr theKey, - ListOfShape& theItems) const; + ListOfShape &theItems) const; /// Undinds shapes from theKey. GEOMAPI_EXPORT bool unBind(const std::shared_ptr theKey); @@ -65,23 +67,22 @@ public: GEOMAPI_EXPORT int size() const; public: - class iterator - { + class iterator { public: typedef GeomShapePtr key_type; - typedef ListOfShape mapped_type; + typedef ListOfShape mapped_type; typedef std::pair value_type; public: GEOMAPI_EXPORT iterator(); - GEOMAPI_EXPORT iterator(const iterator&); - GEOMAPI_EXPORT const iterator& operator=(const iterator&); + GEOMAPI_EXPORT iterator(const iterator &); + GEOMAPI_EXPORT const iterator &operator=(const iterator &); - GEOMAPI_EXPORT bool operator==(const iterator&) const; - GEOMAPI_EXPORT bool operator!=(const iterator&) const; + GEOMAPI_EXPORT bool operator==(const iterator &) const; + GEOMAPI_EXPORT bool operator!=(const iterator &) const; - GEOMAPI_EXPORT virtual iterator& operator++(); - GEOMAPI_EXPORT virtual iterator operator++(int); + GEOMAPI_EXPORT virtual iterator &operator++(); + GEOMAPI_EXPORT virtual iterator operator++(int); GEOMAPI_EXPORT virtual key_type first() const; GEOMAPI_EXPORT virtual mapped_type second() const; diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp index d07ed73cb..1f1bd0aaa 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp @@ -14,83 +14,83 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include -#include +#include #include +#include #include GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape() -: GeomAPI_Interface(new TopTools_DataMapOfShapeShape){} + : GeomAPI_Interface(new TopTools_DataMapOfShapeShape) {} -void GeomAPI_DataMapOfShapeShape::clear() -{ +void GeomAPI_DataMapOfShapeShape::clear() { implPtr()->Clear(); } -int GeomAPI_DataMapOfShapeShape::size() -{ +int GeomAPI_DataMapOfShapeShape::size() { return implPtr()->Extent(); } bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr theKey, - std::shared_ptr theItem) -{ + std::shared_ptr theItem) { bool flag(false); - if (implPtr()->Bind(theKey->impl(), - theItem->impl())) + if (implPtr()->Bind( + theKey->impl(), theItem->impl())) flag = true; return flag; } -void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDataMap) -{ - const TopTools_DataMapOfShapeShape& aDataMap = theDataMap.impl(); - TopTools_DataMapOfShapeShape* myDataMap = implPtr(); - for(TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) { +void GeomAPI_DataMapOfShapeShape::merge( + const GeomAPI_DataMapOfShapeShape &theDataMap) { + const TopTools_DataMapOfShapeShape &aDataMap = + theDataMap.impl(); + TopTools_DataMapOfShapeShape *myDataMap = + implPtr(); + for (TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); + anIt.More(); anIt.Next()) { myDataMap->Bind(anIt.Key(), anIt.Value()); } } -void GeomAPI_DataMapOfShapeShape:: - merge(const std::shared_ptr theDataMap) -{ - if(theDataMap.get()) { +void GeomAPI_DataMapOfShapeShape::merge( + const std::shared_ptr theDataMap) { + if (theDataMap.get()) { merge(*theDataMap.get()); } } -bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr theKey) -{ +bool GeomAPI_DataMapOfShapeShape::isBound( + std::shared_ptr theKey) { bool flag(false); - if(impl().IsBound(theKey->impl())) + if (impl().IsBound( + theKey->impl())) flag = true; return flag; } const std::shared_ptr - GeomAPI_DataMapOfShapeShape::find(std::shared_ptr theKey) -{ +GeomAPI_DataMapOfShapeShape::find(std::shared_ptr theKey) { std::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl( - new TopoDS_Shape(impl().Find(theKey->impl()))); + aShape->setImpl(new TopoDS_Shape( + impl().Find(theKey->impl()))); return aShape; } -bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr theKey) -{ +bool GeomAPI_DataMapOfShapeShape::unBind( + std::shared_ptr theKey) { bool flag(false); - if(implPtr()->UnBind(theKey->impl())) - flag = true; + if (implPtr()->UnBind( + theKey->impl())) + flag = true; return flag; } - GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape() - { +GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape() { if (!empty()) { implPtr()->Clear(); } - } +} diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h index 74548a247..c0a5e5358 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_DataMapOfShapeShape_H_ #define GeomAPI_DataMapOfShapeShape_H_ -#include #include +#include #include @@ -29,9 +30,8 @@ * \ingroup DataModel * \brief DataMap of Shape - Shape defined by TopoDS_Shapes */ -class GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface -{ - public: +class GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface { +public: /// Constructor. GEOMAPI_EXPORT GeomAPI_DataMapOfShapeShape(); @@ -44,24 +44,27 @@ class GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface GEOMAPI_EXPORT int size(); - /// Adds \a theKey to me with \a theItem. Returns True if the Key was not already in the map. + /// Adds \a theKey to me with \a theItem. Returns True if the Key was not + /// already in the map. GEOMAPI_EXPORT - bool bind (const std::shared_ptr theKey, - const std::shared_ptr theItem); + bool bind(const std::shared_ptr theKey, + const std::shared_ptr theItem); /// Merges two maps. - GEOMAPI_EXPORT void merge(const GeomAPI_DataMapOfShapeShape& theDataMap); + GEOMAPI_EXPORT void merge(const GeomAPI_DataMapOfShapeShape &theDataMap); /// Merges two maps. - GEOMAPI_EXPORT void merge(const std::shared_ptr theDataMap); + GEOMAPI_EXPORT void + merge(const std::shared_ptr theDataMap); /// \return true if theKey is stored in the map. GEOMAPI_EXPORT - bool isBound (const std::shared_ptr theKey); + bool isBound(const std::shared_ptr theKey); /// \return the Item stored with the Key in the Map. GEOMAPI_EXPORT - const std::shared_ptr find(const std::shared_ptr theKey); + const std::shared_ptr + find(const std::shared_ptr theKey); /// \brief Removes the Key from the map. /// \return true if the Key was in the Map. @@ -74,4 +77,3 @@ class GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface }; #endif - diff --git a/src/GeomAPI/GeomAPI_Dir.cpp b/src/GeomAPI/GeomAPI_Dir.cpp index 0c9af271b..ff64da18f 100644 --- a/src/GeomAPI/GeomAPI_Dir.cpp +++ b/src/GeomAPI/GeomAPI_Dir.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,60 +25,44 @@ #define MY_DIR implPtr() -GeomAPI_Dir::GeomAPI_Dir(const double theX, const double theY, const double theZ) - : GeomAPI_Interface(new gp_Dir(theX, theY, theZ)) -{ -} +GeomAPI_Dir::GeomAPI_Dir(const double theX, const double theY, + const double theZ) + : GeomAPI_Interface(new gp_Dir(theX, theY, theZ)) {} -GeomAPI_Dir::GeomAPI_Dir(const std::shared_ptr& theCoords) - : GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z())) -{ -} +GeomAPI_Dir::GeomAPI_Dir(const std::shared_ptr &theCoords) + : GeomAPI_Interface( + new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z())) {} -double GeomAPI_Dir::x() const -{ - return MY_DIR->X(); -} +double GeomAPI_Dir::x() const { return MY_DIR->X(); } -double GeomAPI_Dir::y() const -{ - return MY_DIR->Y(); -} +double GeomAPI_Dir::y() const { return MY_DIR->Y(); } -double GeomAPI_Dir::z() const -{ - return MY_DIR->Z(); -} +double GeomAPI_Dir::z() const { return MY_DIR->Z(); } -const std::shared_ptr GeomAPI_Dir::xyz() -{ - return std::shared_ptr(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z())); +const std::shared_ptr GeomAPI_Dir::xyz() { + return std::shared_ptr( + new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z())); } -void GeomAPI_Dir::reverse() -{ - MY_DIR->Reverse(); -} +void GeomAPI_Dir::reverse() { MY_DIR->Reverse(); } -double GeomAPI_Dir::dot(const std::shared_ptr& theArg) const -{ +double GeomAPI_Dir::dot(const std::shared_ptr &theArg) const { return MY_DIR->Dot(theArg->impl()); } -const std::shared_ptr GeomAPI_Dir::cross( - const std::shared_ptr& theArg) const -{ +const std::shared_ptr +GeomAPI_Dir::cross(const std::shared_ptr &theArg) const { gp_XYZ aResult = MY_DIR->XYZ().Crossed(theArg->impl().XYZ()); - return std::shared_ptr(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); + return std::shared_ptr( + new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); } -double GeomAPI_Dir::angle(const std::shared_ptr& theArg) const -{ +double GeomAPI_Dir::angle(const std::shared_ptr &theArg) const { return MY_DIR->Angle(theArg->impl()); } bool GeomAPI_Dir::isParallel(const std::shared_ptr theDir, - const double theTolerance) const -{ - return MY_DIR->IsParallel(theDir->impl(), theTolerance) == Standard_True; + const double theTolerance) const { + return MY_DIR->IsParallel(theDir->impl(), theTolerance) == + Standard_True; } diff --git a/src/GeomAPI/GeomAPI_Dir.h b/src/GeomAPI/GeomAPI_Dir.h index 4918ed5dc..4d6a027d8 100644 --- a/src/GeomAPI/GeomAPI_Dir.h +++ b/src/GeomAPI/GeomAPI_Dir.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Dir_H_ @@ -30,15 +31,14 @@ class GeomAPI_XYZ; * \brief 3D direction defined by three normalized coordinates */ -class GeomAPI_Dir : public GeomAPI_Interface -{ - public: +class GeomAPI_Dir : public GeomAPI_Interface { +public: /// Creation of direction by coordinates GEOMAPI_EXPORT GeomAPI_Dir(const double theX, const double theY, const double theZ); /// Creation of direction by coordinates GEOMAPI_EXPORT - GeomAPI_Dir(const std::shared_ptr& theCoords); + GeomAPI_Dir(const std::shared_ptr &theCoords); /// returns X coordinate GEOMAPI_EXPORT @@ -59,26 +59,24 @@ class GeomAPI_Dir : public GeomAPI_Interface /// result is a scalar product of directions GEOMAPI_EXPORT - double dot(const std::shared_ptr& theArg) const; + double dot(const std::shared_ptr &theArg) const; /// result is a cross product of two directions GEOMAPI_EXPORT - const std::shared_ptr cross(const std::shared_ptr& theArg) const; + const std::shared_ptr + cross(const std::shared_ptr &theArg) const; /// calculates angle between two directions GEOMAPI_EXPORT - double angle(const std::shared_ptr& theArg) const; + double angle(const std::shared_ptr &theArg) const; /// \return true if the angle between this unit vector and /// theDir unit vector is equal to 0 or to Pi. GEOMAPI_EXPORT bool isParallel(const std::shared_ptr theDir, const double theTolerance = 1.e-7) const; - - }; //! Pointer on the object typedef std::shared_ptr GeomDirPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Dir2d.cpp b/src/GeomAPI/GeomAPI_Dir2d.cpp index 9be1e1ce5..5da7c09a9 100644 --- a/src/GeomAPI/GeomAPI_Dir2d.cpp +++ b/src/GeomAPI/GeomAPI_Dir2d.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,46 +26,31 @@ #define MY_DIR implPtr() GeomAPI_Dir2d::GeomAPI_Dir2d(const double theX, const double theY) - : GeomAPI_Interface(new gp_Dir2d(theX, theY)) -{ -} + : GeomAPI_Interface(new gp_Dir2d(theX, theY)) {} -GeomAPI_Dir2d::GeomAPI_Dir2d(const std::shared_ptr& theCoords) - : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y())) -{ -} +GeomAPI_Dir2d::GeomAPI_Dir2d(const std::shared_ptr &theCoords) + : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y())) {} -double GeomAPI_Dir2d::x() const -{ - return MY_DIR->X(); -} +double GeomAPI_Dir2d::x() const { return MY_DIR->X(); } -double GeomAPI_Dir2d::y() const -{ - return MY_DIR->Y(); -} +double GeomAPI_Dir2d::y() const { return MY_DIR->Y(); } -const std::shared_ptr GeomAPI_Dir2d::xy() -{ +const std::shared_ptr GeomAPI_Dir2d::xy() { return std::shared_ptr(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y())); } -void GeomAPI_Dir2d::reverse() -{ - MY_DIR->Reverse(); -} +void GeomAPI_Dir2d::reverse() { MY_DIR->Reverse(); } -double GeomAPI_Dir2d::dot(const std::shared_ptr& theArg) const -{ +double GeomAPI_Dir2d::dot(const std::shared_ptr &theArg) const { return MY_DIR->Dot(theArg->impl()); } -double GeomAPI_Dir2d::cross(const std::shared_ptr& theArg) const -{ +double +GeomAPI_Dir2d::cross(const std::shared_ptr &theArg) const { return MY_DIR->XY().Crossed(theArg->impl().XY()); } -double GeomAPI_Dir2d::angle(const std::shared_ptr& theArg) const -{ +double +GeomAPI_Dir2d::angle(const std::shared_ptr &theArg) const { return MY_DIR->Angle(theArg->impl()); } diff --git a/src/GeomAPI/GeomAPI_Dir2d.h b/src/GeomAPI/GeomAPI_Dir2d.h index 875473d47..b40eca165 100644 --- a/src/GeomAPI/GeomAPI_Dir2d.h +++ b/src/GeomAPI/GeomAPI_Dir2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Dir2d_H_ @@ -30,15 +31,14 @@ class GeomAPI_XY; * \brief 2D direction defined by three normalized coordinates */ -class GeomAPI_Dir2d : public GeomAPI_Interface -{ - public: +class GeomAPI_Dir2d : public GeomAPI_Interface { +public: /// Creation of direction by coordinates GEOMAPI_EXPORT GeomAPI_Dir2d(const double theX, const double theY); /// Creation of direction by coordinates GEOMAPI_EXPORT - GeomAPI_Dir2d(const std::shared_ptr& theCoords); + GeomAPI_Dir2d(const std::shared_ptr &theCoords); /// returns X coordinate GEOMAPI_EXPORT @@ -56,18 +56,17 @@ class GeomAPI_Dir2d : public GeomAPI_Interface /// result is a scalar product of directions GEOMAPI_EXPORT - double dot(const std::shared_ptr& theArg) const; + double dot(const std::shared_ptr &theArg) const; /// result is a cross product of two directions GEOMAPI_EXPORT - double cross(const std::shared_ptr& theArg) const; + double cross(const std::shared_ptr &theArg) const; /// calculates angle between two directions GEOMAPI_EXPORT - double angle(const std::shared_ptr& theArg) const; + double angle(const std::shared_ptr &theArg) const; }; //! Pointer on the object typedef std::shared_ptr GeomDir2dPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Edge.cpp b/src/GeomAPI/GeomAPI_Edge.cpp index 1126cfdcb..87871ac0b 100644 --- a/src/GeomAPI/GeomAPI_Edge.cpp +++ b/src/GeomAPI/GeomAPI_Edge.cpp @@ -14,49 +14,49 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include #include -#include +#include #include -GeomAPI_Edge::GeomAPI_Edge() -{ - TopoDS_Edge* anEdge = new TopoDS_Edge; +GeomAPI_Edge::GeomAPI_Edge() { + TopoDS_Edge *anEdge = new TopoDS_Edge; BRep_Builder aBuilder; aBuilder.MakeEdge(*anEdge); @@ -64,17 +64,16 @@ GeomAPI_Edge::GeomAPI_Edge() setImpl(anEdge); } -GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr& theShape) -{ +GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr &theShape) { if (!theShape->isNull() && theShape->isEdge()) { setImpl(new TopoDS_Shape(theShape->impl())); } } -void GeomAPI_Edge::vertices(std::shared_ptr& theStartVertex, - std::shared_ptr& theEndVertex) const -{ - const TopoDS_Edge& anEdge = impl(); +void GeomAPI_Edge::vertices( + std::shared_ptr &theStartVertex, + std::shared_ptr &theEndVertex) const { + const TopoDS_Edge &anEdge = impl(); TopoDS_Vertex aStart, aEnd; TopExp::Vertices(anEdge, aStart, aEnd); theStartVertex.reset(new GeomAPI_Vertex); @@ -83,8 +82,7 @@ void GeomAPI_Edge::vertices(std::shared_ptr& theStartVertex, theEndVertex->setImpl(new TopoDS_Vertex(aEnd)); } -static Handle(Geom_Curve) baseCurve(const TopoDS_Edge& theEdge) -{ +static Handle(Geom_Curve) baseCurve(const TopoDS_Edge &theEdge) { double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast); while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) { @@ -94,8 +92,8 @@ static Handle(Geom_Curve) baseCurve(const TopoDS_Edge& theEdge) return aCurve; } -bool GeomAPI_Edge::isSameGeometry(const std::shared_ptr theShape) const -{ +bool GeomAPI_Edge::isSameGeometry( + const std::shared_ptr theShape) const { if (!theShape->isEdge()) return false; if (isSame(theShape)) @@ -113,11 +111,12 @@ bool GeomAPI_Edge::isSameGeometry(const std::shared_ptr theShape) return isSame; } -bool GeomAPI_Edge::isLine() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isLine() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve.IsNull()) // degenerative edge return false; if (aCurve->IsKind(STANDARD_TYPE(Geom_Line))) @@ -125,15 +124,16 @@ bool GeomAPI_Edge::isLine() const return false; } -/// extracts a circle curve from the arbitrary curve, returns null is it is different type -static Handle(Geom_Circle) circ(const Handle(Geom_Curve) theCurve) -{ +/// extracts a circle curve from the arbitrary curve, returns null is it is +/// different type +static Handle(Geom_Circle) circ(const Handle(Geom_Curve) theCurve) { Handle(Geom_Circle) aResult = Handle(Geom_Circle)::DownCast(theCurve); if (!aResult.IsNull()) return aResult; // check this may be a trimmed curve that contains circle inside - Handle(Geom_TrimmedCurve) aTrimmed = Handle(Geom_TrimmedCurve)::DownCast(theCurve); - while(!aTrimmed.IsNull()) { + Handle(Geom_TrimmedCurve) aTrimmed = + Handle(Geom_TrimmedCurve)::DownCast(theCurve); + while (!aTrimmed.IsNull()) { aResult = Handle(Geom_Circle)::DownCast(aTrimmed->BasisCurve()); if (!aResult.IsNull()) return aResult; @@ -142,37 +142,42 @@ static Handle(Geom_Circle) circ(const Handle(Geom_Curve) theCurve) return aResult; // null, not circle } -bool GeomAPI_Edge::isCircle() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isCircle() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (!circ(aCurve).IsNull()) { - // Check the difference of first and last parameters to be equal to the curve period + // Check the difference of first and last parameters to be equal to the + // curve period if (Abs(aLast - aFirst - aCurve->Period()) < Precision::PConfusion()) return true; } return false; } -bool GeomAPI_Edge::isArc() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isArc() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (!circ(aCurve).IsNull()) { - // Check the difference of first and last parameters is not equal the curve period + // Check the difference of first and last parameters is not equal the curve + // period if (Abs(aLast - aFirst - aCurve->Period()) >= Precision::PConfusion()) return true; } return false; } -bool GeomAPI_Edge::isEllipse() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isEllipse() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve.IsNull()) // degenerative edge return false; while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) @@ -180,11 +185,12 @@ bool GeomAPI_Edge::isEllipse() const return aCurve->IsKind(STANDARD_TYPE(Geom_Ellipse)); } -bool GeomAPI_Edge::isBSpline() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isBSpline() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve.IsNull()) // degenerative edge return false; while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) @@ -192,47 +198,56 @@ bool GeomAPI_Edge::isBSpline() const return aCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)); } -std::shared_ptr GeomAPI_Edge::firstPoint() -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +std::shared_ptr GeomAPI_Edge::firstPoint() { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); gp_Pnt aPoint; aCurve->D0(aFirst, aPoint); - return std::shared_ptr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); } -std::shared_ptr GeomAPI_Edge::lastPoint() -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +std::shared_ptr GeomAPI_Edge::lastPoint() { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); gp_Pnt aPoint; aCurve->D0(aLast, aPoint); - return std::shared_ptr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); } -std::shared_ptr GeomAPI_Edge::circle() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +std::shared_ptr GeomAPI_Edge::circle() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); Handle(Geom_Circle) aCirc = circ(aCurve); if (!aCirc.IsNull()) { gp_Pnt aLoc = aCirc->Location(); - std::shared_ptr aCenter(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); + std::shared_ptr aCenter( + new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); gp_Dir anAxis = aCirc->Axis().Direction(); - std::shared_ptr aDir(new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z())); - return std::shared_ptr(new GeomAPI_Circ(aCenter, aDir, aCirc->Radius())); + std::shared_ptr aDir( + new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z())); + return std::shared_ptr( + new GeomAPI_Circ(aCenter, aDir, aCirc->Radius())); } return std::shared_ptr(); // not circle } -std::shared_ptr GeomAPI_Edge::ellipse() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +std::shared_ptr GeomAPI_Edge::ellipse() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (!aCurve.IsNull()) { while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); @@ -247,11 +262,12 @@ std::shared_ptr GeomAPI_Edge::ellipse() const return std::shared_ptr(); // not ellipse } -std::shared_ptr GeomAPI_Edge::line() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +std::shared_ptr GeomAPI_Edge::line() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve) { Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(aCurve); if (aLine) { @@ -267,13 +283,12 @@ std::shared_ptr GeomAPI_Edge::line() const return std::shared_ptr(); // not circle } - -bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const -{ - if (!theEdge.get() || ! theEdge->isEdge()) +bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const { + if (!theEdge.get() || !theEdge->isEdge()) return false; - const TopoDS_Shape& aMyShape = const_cast(this)->impl(); - const TopoDS_Shape& aInShape = theEdge->impl(); + const TopoDS_Shape &aMyShape = + const_cast(this)->impl(); + const TopoDS_Shape &aInShape = theEdge->impl(); if (aMyShape.IsNull() || aInShape.IsNull()) return false; @@ -282,9 +297,11 @@ bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const return false; double aMyStart, aMyEnd; - Handle(Geom_Curve) aMyCurve = BRep_Tool::Curve(TopoDS::Edge(aMyShape), aMyStart, aMyEnd); + Handle(Geom_Curve) aMyCurve = + BRep_Tool::Curve(TopoDS::Edge(aMyShape), aMyStart, aMyEnd); double aInStart, aInEnd; - Handle(Geom_Curve) aInCurve = BRep_Tool::Curve(TopoDS::Edge(aInShape), aInStart, aInEnd); + Handle(Geom_Curve) aInCurve = + BRep_Tool::Curve(TopoDS::Edge(aInShape), aInStart, aInEnd); // Check that end point parameters are the same if ((aMyStart != aInStart) || (aMyEnd != aInEnd)) @@ -303,14 +320,13 @@ bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const gp_Pnt aInPnt2 = aInAdaptor.Value(aInEnd); if ((!aMyPnt1.IsEqual(aInPnt1, Precision::Confusion())) || - (!aMyPnt2.IsEqual(aInPnt2, Precision::Confusion()))) + (!aMyPnt2.IsEqual(aInPnt2, Precision::Confusion()))) return false; return true; } -void GeomAPI_Edge::setRange(const double& theFirst, const double& theLast) -{ +void GeomAPI_Edge::setRange(const double &theFirst, const double &theLast) { TopoDS_Edge anEdge = impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); @@ -322,18 +338,20 @@ void GeomAPI_Edge::setRange(const double& theFirst, const double& theLast) BRep_Builder().Range(anEdge, theFirst, theLast); } -void GeomAPI_Edge::getRange(double& theFirst, double& theLast) const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, theFirst, theLast); +void GeomAPI_Edge::getRange(double &theFirst, double &theLast) const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, theFirst, theLast); } // LCOV_EXCL_START -bool GeomAPI_Edge::isInPlane(std::shared_ptr thePlane) const -{ +bool GeomAPI_Edge::isInPlane(std::shared_ptr thePlane) const { double aFirst, aLast; - const TopoDS_Shape& aShape = const_cast(this)->impl(); - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve.IsNull()) return false; @@ -352,7 +370,8 @@ bool GeomAPI_Edge::isInPlane(std::shared_ptr thePlane) const Handle(Geom_Circle) aCirc = circ(aCurve); if (!aCirc.IsNull()) { gp_Pnt aCenter = aCirc->Location(); - Standard_Real aDot = aPlane.Axis().Direction().Dot(aCirc->Axis().Direction()); + Standard_Real aDot = + aPlane.Axis().Direction().Dot(aCirc->Axis().Direction()); inPlane = aPlane.SquareDistance(aCenter) < Precision::SquareConfusion() && Abs(Abs(aDot) - 1.0) < Precision::Confusion(); } else { @@ -360,21 +379,24 @@ bool GeomAPI_Edge::isInPlane(std::shared_ptr thePlane) const gp_Pnt aFirstPnt = aCurve->Value(aFirst); gp_Pnt aMidPnt = aCurve->Value((aFirst + aLast) / 2.); gp_Pnt aLastPnt = aCurve->Value(aLast); - inPlane = aPlane.SquareDistance(aFirstPnt) < Precision::SquareConfusion() && - aPlane.SquareDistance(aMidPnt) < Precision::SquareConfusion() && - aPlane.SquareDistance(aLastPnt) < Precision::SquareConfusion(); + inPlane = + aPlane.SquareDistance(aFirstPnt) < Precision::SquareConfusion() && + aPlane.SquareDistance(aMidPnt) < Precision::SquareConfusion() && + aPlane.SquareDistance(aLastPnt) < Precision::SquareConfusion(); } } return inPlane; } // LCOV_EXCL_STOP -void GeomAPI_Edge::intersectWithPlane(const std::shared_ptr thePlane, - std::list>& theResult) const -{ +void GeomAPI_Edge::intersectWithPlane( + const std::shared_ptr thePlane, + std::list> &theResult) const { double aFirst, aLast; - const TopoDS_Shape& aShape = const_cast(this)->impl(); - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (!aCurve.IsNull()) { double A, B, C, D; thePlane->coefficients(A, B, C, D); @@ -391,99 +413,96 @@ void GeomAPI_Edge::intersectWithPlane(const std::shared_ptr thePlan aIntersect.Parameters(i, A, B, C); if (aCurve->IsPeriodic()) C = ElCLib::InPeriod(C, aFirst, aFirst + aCurve->Period()); - if (C < aFirst - Precision::PConfusion() || C > aLast + Precision::PConfusion()) + if (C < aFirst - Precision::PConfusion() || + C > aLast + Precision::PConfusion()) continue; // obtain intersection point aPnt = aIntersect.Point(i); - std::shared_ptr aPntPtr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); + std::shared_ptr aPntPtr( + new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); theResult.push_back(aPntPtr); } - } - else { + } else { // find minimal distance between the plane and the curve GeomAPI_ExtremaCurveSurface anExtrema(aCurve, aPlane); double aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aShape)); - if (anExtrema.NbExtrema() > 0 && - !anExtrema.Extrema().IsParallel() && + if (anExtrema.NbExtrema() > 0 && !anExtrema.Extrema().IsParallel() && anExtrema.LowerDistance() < aTolerance) { // distance is lower than tolerance => tangent case gp_Pnt aPntC, aPntS; anExtrema.NearestPoints(aPntC, aPntS); - std::shared_ptr aPntPtr(new GeomAPI_Pnt(aPntS.X(), aPntS.Y(), aPntS.Z())); + std::shared_ptr aPntPtr( + new GeomAPI_Pnt(aPntS.X(), aPntS.Y(), aPntS.Z())); theResult.push_back(aPntPtr); } } } } -double GeomAPI_Edge::length() const -{ - const TopoDS_Edge& anEdge = TopoDS::Edge(impl()); +double GeomAPI_Edge::length() const { + const TopoDS_Edge &anEdge = TopoDS::Edge(impl()); BRepAdaptor_Curve aBRepAdaptor = BRepAdaptor_Curve(anEdge); - Adaptor3d_Curve* anAdaptor3d = &aBRepAdaptor; + Adaptor3d_Curve *anAdaptor3d = &aBRepAdaptor; return GCPnts_AbscissaPoint::Length(*anAdaptor3d); } -bool GeomAPI_Edge::isClosed() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isClosed() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull()) return false; double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve.IsNull() || !aCurve->IsPeriodic()) return false; - aLast += aLast > aFirst ? -aCurve->Period() : aCurve->Period();; + aLast += aLast > aFirst ? -aCurve->Period() : aCurve->Period(); + ; return fabs(aFirst - aLast) < 1.e-9; } -bool GeomAPI_Edge::isDegenerated() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Edge::isDegenerated() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_EDGE) return false; return BRep_Tool::Degenerated(TopoDS::Edge(aShape)); } -void GeomAPI_Edge::setFirstPointTolerance(const double theTolerance) -{ +void GeomAPI_Edge::setFirstPointTolerance(const double theTolerance) { TopoDS_Edge anEdge = impl(); TopoDS_Vertex aVFirst, aVLast; TopExp::Vertices(anEdge, aVFirst, aVLast); BRep_Builder().UpdateVertex(aVFirst, theTolerance); } -void GeomAPI_Edge::setLastPointTolerance(const double theTolerance) -{ +void GeomAPI_Edge::setLastPointTolerance(const double theTolerance) { TopoDS_Edge anEdge = impl(); TopoDS_Vertex aVFirst, aVLast; TopExp::Vertices(anEdge, aVFirst, aVLast); BRep_Builder().UpdateVertex(aVLast, theTolerance); } -double GeomAPI_Edge::firstPointTolerance() const -{ +double GeomAPI_Edge::firstPointTolerance() const { TopoDS_Edge anEdge = impl(); TopoDS_Vertex aVFirst, aVLast; TopExp::Vertices(anEdge, aVFirst, aVLast); return BRep_Tool::Tolerance(aVFirst); } -double GeomAPI_Edge::lastPointTolerance() const -{ +double GeomAPI_Edge::lastPointTolerance() const { TopoDS_Edge anEdge = impl(); TopoDS_Vertex aVFirst, aVLast; TopExp::Vertices(anEdge, aVFirst, aVLast); return BRep_Tool::Tolerance(aVLast); } -GeomPointPtr GeomAPI_Edge::middlePoint() const -{ +GeomPointPtr GeomAPI_Edge::middlePoint() const { GeomPointPtr aMiddlePoint; - const TopoDS_Edge& anEdge = impl(); + const TopoDS_Edge &anEdge = impl(); if (anEdge.IsNull()) return aMiddlePoint; double aFirst, aLast; diff --git a/src/GeomAPI/GeomAPI_Edge.h b/src/GeomAPI/GeomAPI_Edge.h index 45fceeb0f..8e9cff786 100644 --- a/src/GeomAPI/GeomAPI_Edge.h +++ b/src/GeomAPI/GeomAPI_Edge.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Edge_H_ @@ -30,29 +31,29 @@ class GeomAPI_Ellipse; class GeomAPI_Vertex; /**\class GeomAPI_Edge -* \ingroup DataModel + * \ingroup DataModel * \brief Interface to the edge object */ -class GeomAPI_Edge : public GeomAPI_Shape -{ +class GeomAPI_Edge : public GeomAPI_Shape { public: - /// Makes an undefined Edge (no geometry). + /// Makes an undefined Edge (no geometry). GEOMAPI_EXPORT - GeomAPI_Edge(); + GeomAPI_Edge(); - /// Creation of edge by the edge-shape + /// Creation of edge by the edge-shape GEOMAPI_EXPORT - GeomAPI_Edge(const std::shared_ptr& theShape); + GeomAPI_Edge(const std::shared_ptr &theShape); /// Return vertices of the edge; GEOMAPI_EXPORT - void vertices(std::shared_ptr& theStartVertex, - std::shared_ptr& theEndVertex) const; + void vertices(std::shared_ptr &theStartVertex, + std::shared_ptr &theEndVertex) const; /// Returns \c true if edges have same underlying curve GEOMAPI_EXPORT - virtual bool isSameGeometry(const std::shared_ptr theShape) const; + virtual bool + isSameGeometry(const std::shared_ptr theShape) const; /// Verifies that the edge is a line GEOMAPI_EXPORT @@ -100,22 +101,23 @@ public: /// Change parametric range of the curve GEOMAPI_EXPORT - void setRange(const double& theFirst, const double& theLast); + void setRange(const double &theFirst, const double &theLast); /// Returns range of parameter on the curve GEOMAPI_EXPORT - void getRange(double& theFirst, double& theLast) const; + void getRange(double &theFirst, double &theLast) const; /// Returns true, if the edge is fully placed in the specified plane /// \param thePlane a plane for intersection GEOMAPI_EXPORT bool isInPlane(const std::shared_ptr thePlane) const; - /// Returns list of intersection points if the edge has intersections with the given plane - /// \param thePlane a plane for intersection + /// Returns list of intersection points if the edge has intersections with the + /// given plane \param thePlane a plane for intersection GEOMAPI_EXPORT - void intersectWithPlane(const std::shared_ptr thePlane, - std::list >& theResult) const; + void + intersectWithPlane(const std::shared_ptr thePlane, + std::list> &theResult) const; /// Returns edge length. GEOMAPI_EXPORT @@ -148,4 +150,3 @@ public: typedef std::shared_ptr GeomEdgePtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Ellipse.cpp b/src/GeomAPI/GeomAPI_Ellipse.cpp index de32e5158..13a8777a5 100644 --- a/src/GeomAPI/GeomAPI_Ellipse.cpp +++ b/src/GeomAPI/GeomAPI_Ellipse.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAPI_Ellipse.cpp @@ -26,89 +27,82 @@ #include "GeomAPI_Curve.h" #include "GeomAPI_Pnt.h" -#include #include #include +#include #include #define MY_ELIPS implPtr() -GeomAPI_Ellipse::GeomAPI_Ellipse(const std::shared_ptr& theAx2, +GeomAPI_Ellipse::GeomAPI_Ellipse(const std::shared_ptr &theAx2, double theMajorRadius, double theMinorRadius) -: GeomAPI_Interface(new gp_Elips(theAx2->impl(), theMajorRadius, theMinorRadius)) -{ -} + : GeomAPI_Interface(new gp_Elips(theAx2->impl(), theMajorRadius, + theMinorRadius)) {} -GeomAPI_Ellipse::GeomAPI_Ellipse(GeomCurvePtr theCurve) -{ +GeomAPI_Ellipse::GeomAPI_Ellipse(GeomCurvePtr theCurve) { GeomCurvePtr anUntrimmedCurve = theCurve->basisCurve(); Handle(Geom_Curve) aCurve = anUntrimmedCurve->impl(); Handle(Geom_Ellipse) anEllipse = Handle(Geom_Ellipse)::DownCast(aCurve); if (anEllipse.IsNull()) - throw Standard_ConstructionError("GeomAPI_Ellipse: Curve is not an ellipse"); + throw Standard_ConstructionError( + "GeomAPI_Ellipse: Curve is not an ellipse"); setImpl(new gp_Elips(anEllipse->Elips())); } -std::shared_ptr GeomAPI_Ellipse::center() const -{ - const gp_Pnt& aCenter = MY_ELIPS->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); +std::shared_ptr GeomAPI_Ellipse::center() const { + const gp_Pnt &aCenter = MY_ELIPS->Location(); + return std::shared_ptr( + new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); } -GeomPointPtr GeomAPI_Ellipse::firstFocus() const -{ - const gp_Pnt& aFirst = MY_ELIPS->Focus1(); - return std::shared_ptr(new GeomAPI_Pnt(aFirst.X(), aFirst.Y(), aFirst.Z())); +GeomPointPtr GeomAPI_Ellipse::firstFocus() const { + const gp_Pnt &aFirst = MY_ELIPS->Focus1(); + return std::shared_ptr( + new GeomAPI_Pnt(aFirst.X(), aFirst.Y(), aFirst.Z())); } -GeomPointPtr GeomAPI_Ellipse::secondFocus() const -{ - const gp_Pnt& aSecond = MY_ELIPS->Focus2(); - return std::shared_ptr(new GeomAPI_Pnt(aSecond.X(), aSecond.Y(), aSecond.Z())); +GeomPointPtr GeomAPI_Ellipse::secondFocus() const { + const gp_Pnt &aSecond = MY_ELIPS->Focus2(); + return std::shared_ptr( + new GeomAPI_Pnt(aSecond.X(), aSecond.Y(), aSecond.Z())); } -std::shared_ptr GeomAPI_Ellipse::normal() const -{ - const gp_Ax1& anAxis = MY_ELIPS->Axis(); - const gp_Dir& aDir = anAxis.Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +std::shared_ptr GeomAPI_Ellipse::normal() const { + const gp_Ax1 &anAxis = MY_ELIPS->Axis(); + const gp_Dir &aDir = anAxis.Direction(); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } -double GeomAPI_Ellipse::minorRadius() const -{ - return MY_ELIPS->MinorRadius(); -} +double GeomAPI_Ellipse::minorRadius() const { return MY_ELIPS->MinorRadius(); } -double GeomAPI_Ellipse::majorRadius() const -{ - return MY_ELIPS->MajorRadius(); -} +double GeomAPI_Ellipse::majorRadius() const { return MY_ELIPS->MajorRadius(); } -const std::shared_ptr GeomAPI_Ellipse::project( - const std::shared_ptr& thePoint) const -{ +const std::shared_ptr +GeomAPI_Ellipse::project(const std::shared_ptr &thePoint) const { std::shared_ptr aResult; if (!MY_ELIPS) return aResult; Handle(Geom_Ellipse) aEllipse = new Geom_Ellipse(*MY_ELIPS); - const gp_Pnt& aPoint = thePoint->impl(); + const gp_Pnt &aPoint = thePoint->impl(); GeomAPI_ProjectPointOnCurve aProj(aPoint, aEllipse); Standard_Integer aNbPoint = aProj.NbPoints(); if (aNbPoint > 0) { gp_Pnt aNearest = aProj.NearestPoint(); - aResult = GeomPointPtr(new GeomAPI_Pnt(aNearest.X(), aNearest.Y(), aNearest.Z())); + aResult = + GeomPointPtr(new GeomAPI_Pnt(aNearest.X(), aNearest.Y(), aNearest.Z())); } return aResult; } -const bool GeomAPI_Ellipse::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const -{ +const bool +GeomAPI_Ellipse::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom_Ellipse) aCurve = new Geom_Ellipse(*MY_ELIPS); - return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), - theTolerance, theParameter) == Standard_True; + return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, + theParameter) == Standard_True; } diff --git a/src/GeomAPI/GeomAPI_Ellipse.h b/src/GeomAPI/GeomAPI_Ellipse.h index 5f89643bb..411fc7261 100644 --- a/src/GeomAPI/GeomAPI_Ellipse.h +++ b/src/GeomAPI/GeomAPI_Ellipse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAPI_Ellipse.h @@ -32,26 +33,26 @@ class GeomAPI_Curve; class GeomAPI_Dir; class GeomAPI_Pnt; - /**\class GeomAPI_Ellipse * \ingroup DataModel * \brief Ellipse in 3D */ -class GeomAPI_Ellipse : public GeomAPI_Interface -{ +class GeomAPI_Ellipse : public GeomAPI_Interface { public: - /// \brief Constructs an epty ellipse GEOMAPI_EXPORT GeomAPI_Ellipse() : GeomAPI_Interface() {} /** \brief Constructs an ellipse with major and minor radiuses, - * where theAx2 locates the ellipse and defines its orientation in 3D space such that:\n + * where theAx2 locates the ellipse and defines its orientation in 3D space + * such that:\n * - the center of the circle is the origin of theAx2;\n - * - the origin, "X Direction" and "Y Direction" of theAx2 define the plane of the circle;\n + * - the origin, "X Direction" and "Y Direction" of theAx2 define the plane + * of the circle;\n * - theAx2 is the local coordinate system of the circle.\n - * Note: It is possible to create a circle where Radius is equal to 0.0. raised if Radius < 0. + * Note: It is possible to create a circle where Radius is equal to 0.0. + * raised if Radius < 0. */ - GEOMAPI_EXPORT GeomAPI_Ellipse(const std::shared_ptr& theAx2, + GEOMAPI_EXPORT GeomAPI_Ellipse(const std::shared_ptr &theAx2, double theMajorRadius, double theMinorRadius); GEOMAPI_EXPORT GeomAPI_Ellipse(std::shared_ptr theCurve); @@ -75,21 +76,20 @@ public: GEOMAPI_EXPORT double majorRadius() const; /// Project point on ellipse - GEOMAPI_EXPORT const std::shared_ptr project( - const std::shared_ptr& thePoint) const; - - /** \brief Computes the parameter of a given point on an ellipse. The point must be - * located either on the circle itself or relatively to the latter - * at a distance less than the tolerance value. Return FALSE if the point - * is beyond the tolerance limit or if computation fails. - * Max Tolerance value is currently limited to 1.e-4 - * \param[in] thePoint point of origin. - * \param[in] theTolerance tolerance of computation. - * \param[out] theParameter resulting parameter. + GEOMAPI_EXPORT const std::shared_ptr + project(const std::shared_ptr &thePoint) const; + + /** \brief Computes the parameter of a given point on an ellipse. The point + * must be located either on the circle itself or relatively to the latter at + * a distance less than the tolerance value. Return FALSE if the point is + * beyond the tolerance limit or if computation fails. Max Tolerance value is + * currently limited to 1.e-4 \param[in] thePoint point of origin. \param[in] + * theTolerance tolerance of computation. \param[out] theParameter resulting + * parameter. */ - GEOMAPI_EXPORT const bool parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const; + GEOMAPI_EXPORT const bool + parameter(const std::shared_ptr thePoint, + const double theTolerance, double &theParameter) const; }; //! Pointer on the object diff --git a/src/GeomAPI/GeomAPI_Ellipse2d.cpp b/src/GeomAPI/GeomAPI_Ellipse2d.cpp index 04eb919c7..f13d6b616 100644 --- a/src/GeomAPI/GeomAPI_Ellipse2d.cpp +++ b/src/GeomAPI/GeomAPI_Ellipse2d.cpp @@ -14,38 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAPI_Ellipse2d.cpp // Created: 26 April 2017 // Author: Artem ZHIDKOV -#include #include #include +#include #include #include #include #include -#include -#include #include +#include +#include #include -#include -#include #include #include #include +#include +#include #define MY_ELLIPSE implPtr() -static gp_Elips2d* newEllipse(const gp_Pnt2d& theCenter, - const gp_Dir2d& theXAxis, +static gp_Elips2d *newEllipse(const gp_Pnt2d &theCenter, + const gp_Dir2d &theXAxis, const double theMajorRadius, - const double theMinorRadius) -{ + const double theMinorRadius) { if (theMajorRadius < theMinorRadius - Precision::Confusion()) { return newEllipse(theCenter, gp_Dir2d(-theXAxis.Y(), theXAxis.X()), theMinorRadius, theMajorRadius); @@ -55,13 +55,13 @@ static gp_Elips2d* newEllipse(const gp_Pnt2d& theCenter, return new gp_Elips2d(anAxis, theMajorRadius, theMinorRadius); } -static gp_Elips2d* newEllipse(const std::shared_ptr& theCenter, - const std::shared_ptr& theAxisPoint, - const std::shared_ptr& thePassingPoint) -{ - const gp_Pnt2d& aCenter = theCenter->impl(); - const gp_Pnt2d& anAxisPnt = theAxisPoint->impl(); - const gp_Pnt2d& aPassedPnt = thePassingPoint->impl(); +static gp_Elips2d * +newEllipse(const std::shared_ptr &theCenter, + const std::shared_ptr &theAxisPoint, + const std::shared_ptr &thePassingPoint) { + const gp_Pnt2d &aCenter = theCenter->impl(); + const gp_Pnt2d &anAxisPnt = theAxisPoint->impl(); + const gp_Pnt2d &aPassedPnt = thePassingPoint->impl(); gp_Dir2d aXAxis(anAxisPnt.XY() - aCenter.XY()); double aMajorRadius = anAxisPnt.Distance(aCenter); @@ -78,59 +78,52 @@ static gp_Elips2d* newEllipse(const std::shared_ptr& theCenter, return newEllipse(aCenter, aXAxis, aMajorRadius, aMinorRadius); } - -GeomAPI_Ellipse2d::GeomAPI_Ellipse2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theXAxis, - const double theMajorRadius, - const double theMinorRadius) - : GeomAPI_Interface(newEllipse(theCenter->impl(), theXAxis->impl(), - theMajorRadius, theMinorRadius)) -{ -} - -GeomAPI_Ellipse2d::GeomAPI_Ellipse2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theAxisPoint, - const std::shared_ptr& thePassingPoint) - : GeomAPI_Interface(newEllipse(theCenter, theAxisPoint, thePassingPoint)) -{ -} - -std::shared_ptr GeomAPI_Ellipse2d::center() const -{ - const gp_Pnt2d& aCenter = MY_ELLIPSE->Location(); - return std::shared_ptr(new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y())); +GeomAPI_Ellipse2d::GeomAPI_Ellipse2d( + const std::shared_ptr &theCenter, + const std::shared_ptr &theXAxis, const double theMajorRadius, + const double theMinorRadius) + : GeomAPI_Interface(newEllipse(theCenter->impl(), + theXAxis->impl(), theMajorRadius, + theMinorRadius)) {} + +GeomAPI_Ellipse2d::GeomAPI_Ellipse2d( + const std::shared_ptr &theCenter, + const std::shared_ptr &theAxisPoint, + const std::shared_ptr &thePassingPoint) + : GeomAPI_Interface(newEllipse(theCenter, theAxisPoint, thePassingPoint)) {} + +std::shared_ptr GeomAPI_Ellipse2d::center() const { + const gp_Pnt2d &aCenter = MY_ELLIPSE->Location(); + return std::shared_ptr( + new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y())); } -std::shared_ptr GeomAPI_Ellipse2d::firstFocus() const -{ - const gp_Pnt2d& aFirst = MY_ELLIPSE->Focus1(); - return std::shared_ptr(new GeomAPI_Pnt2d(aFirst.X(), aFirst.Y())); +std::shared_ptr GeomAPI_Ellipse2d::firstFocus() const { + const gp_Pnt2d &aFirst = MY_ELLIPSE->Focus1(); + return std::shared_ptr( + new GeomAPI_Pnt2d(aFirst.X(), aFirst.Y())); } -std::shared_ptr GeomAPI_Ellipse2d::secondFocus() const -{ - const gp_Pnt2d& aSecond = MY_ELLIPSE->Focus2(); - return std::shared_ptr(new GeomAPI_Pnt2d(aSecond.X(), aSecond.Y())); +std::shared_ptr GeomAPI_Ellipse2d::secondFocus() const { + const gp_Pnt2d &aSecond = MY_ELLIPSE->Focus2(); + return std::shared_ptr( + new GeomAPI_Pnt2d(aSecond.X(), aSecond.Y())); } -double GeomAPI_Ellipse2d::minorRadius() const -{ +double GeomAPI_Ellipse2d::minorRadius() const { return MY_ELLIPSE->MinorRadius(); } -double GeomAPI_Ellipse2d::majorRadius() const -{ +double GeomAPI_Ellipse2d::majorRadius() const { return MY_ELLIPSE->MajorRadius(); } -// theArrangePoint is used to select the nearest solution point if intersection is detected +// theArrangePoint is used to select the nearest solution point if intersection +// is detected template -static double extrema(IntAna2d_AnaIntersection* theIntersectionAlgo, - EXTREMAPTR theExtremaAlgo, - GeomPnt2dPtr theArrangePoint, - GeomPnt2dPtr& thePoint1, - GeomPnt2dPtr& thePoint2) -{ +static double extrema(IntAna2d_AnaIntersection *theIntersectionAlgo, + EXTREMAPTR theExtremaAlgo, GeomPnt2dPtr theArrangePoint, + GeomPnt2dPtr &thePoint1, GeomPnt2dPtr &thePoint2) { double aDistance = Precision::Infinite(); if (theIntersectionAlgo->IsDone() && theIntersectionAlgo->NbPoints() > 0) { gp_Pnt2d anArrangePoint(theArrangePoint->x(), theArrangePoint->y()); @@ -140,7 +133,7 @@ static double extrema(IntAna2d_AnaIntersection* theIntersectionAlgo, // get solution nearest to theArrangePoint, // if there are several point near each other, calculate average coordinates for (int i = 2; i <= theIntersectionAlgo->NbPoints(); ++i) { - const IntAna2d_IntPoint& aPnt = theIntersectionAlgo->Point(i); + const IntAna2d_IntPoint &aPnt = theIntersectionAlgo->Point(i); double aSqDist = aPnt.Value().SquareDistance(anArrangePoint); if (aSqDist - aDistance < -Precision::Confusion() * aDistance) { aDistance = aSqDist; @@ -148,7 +141,8 @@ static double extrema(IntAna2d_AnaIntersection* theIntersectionAlgo, aNbMergedPoints = 1; } else if (aSqDist - aDistance < Precision::Confusion() * aDistance) { anInterPnt.ChangeCoord() = - (anInterPnt.XY() * aNbMergedPoints + aPnt.Value().XY()) / (aNbMergedPoints + 1); + (anInterPnt.XY() * aNbMergedPoints + aPnt.Value().XY()) / + (aNbMergedPoints + 1); ++aNbMergedPoints; } } @@ -156,8 +150,7 @@ static double extrema(IntAna2d_AnaIntersection* theIntersectionAlgo, aDistance = 0.0; // curves are intersected thePoint1 = GeomPnt2dPtr(new GeomAPI_Pnt2d(anInterPnt.X(), anInterPnt.Y())); thePoint2 = GeomPnt2dPtr(new GeomAPI_Pnt2d(anInterPnt.X(), anInterPnt.Y())); - } - else if (theExtremaAlgo->IsDone() && theExtremaAlgo->NbExt() > 0) { + } else if (theExtremaAlgo->IsDone() && theExtremaAlgo->NbExt() > 0) { Extrema_POnCurv2d aP1, aP2; for (int i = 1; i <= theExtremaAlgo->NbExt(); ++i) { double aSqDist = theExtremaAlgo->SquareDistance(i); @@ -167,40 +160,48 @@ static double extrema(IntAna2d_AnaIntersection* theIntersectionAlgo, } } aDistance = Sqrt(aDistance); - thePoint1 = GeomPnt2dPtr(new GeomAPI_Pnt2d(aP1.Value().X(), aP1.Value().Y())); - thePoint2 = GeomPnt2dPtr(new GeomAPI_Pnt2d(aP2.Value().X(), aP2.Value().Y())); + thePoint1 = + GeomPnt2dPtr(new GeomAPI_Pnt2d(aP1.Value().X(), aP1.Value().Y())); + thePoint2 = + GeomPnt2dPtr(new GeomAPI_Pnt2d(aP2.Value().X(), aP2.Value().Y())); } return aDistance; } -double GeomAPI_Ellipse2d::distance(const std::shared_ptr& theLine, - std::shared_ptr& thePointOnMe, - std::shared_ptr& thePointOnLine) -{ - IntAna2d_AnaIntersection anInter(theLine->impl(), IntAna2d_Conic(*MY_ELLIPSE)); +double +GeomAPI_Ellipse2d::distance(const std::shared_ptr &theLine, + std::shared_ptr &thePointOnMe, + std::shared_ptr &thePointOnLine) { + IntAna2d_AnaIntersection anInter(theLine->impl(), + IntAna2d_Conic(*MY_ELLIPSE)); Extrema_ExtElC2d anExtema(theLine->impl(), *MY_ELLIPSE); - return extrema(&anInter, &anExtema, theLine->location(), thePointOnLine, thePointOnMe); + return extrema(&anInter, &anExtema, theLine->location(), thePointOnLine, + thePointOnMe); } -double GeomAPI_Ellipse2d::distance(const std::shared_ptr& theCircle, - std::shared_ptr& thePointOnMe, - std::shared_ptr& thePointOnCircle) -{ - IntAna2d_AnaIntersection anInter(theCircle->impl(), IntAna2d_Conic(*MY_ELLIPSE)); +double +GeomAPI_Ellipse2d::distance(const std::shared_ptr &theCircle, + std::shared_ptr &thePointOnMe, + std::shared_ptr &thePointOnCircle) { + IntAna2d_AnaIntersection anInter(theCircle->impl(), + IntAna2d_Conic(*MY_ELLIPSE)); Extrema_ExtElC2d anExtema(theCircle->impl(), *MY_ELLIPSE); - return extrema(&anInter, &anExtema, firstFocus(), thePointOnCircle, thePointOnMe); + return extrema(&anInter, &anExtema, firstFocus(), thePointOnCircle, + thePointOnMe); } -double GeomAPI_Ellipse2d::distance(const std::shared_ptr& theEllipse, - std::shared_ptr& thePointOnMe, - std::shared_ptr& thePointOnEllipse) -{ - Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(theEllipse->impl()); +double GeomAPI_Ellipse2d::distance( + const std::shared_ptr &theEllipse, + std::shared_ptr &thePointOnMe, + std::shared_ptr &thePointOnEllipse) { + Handle(Geom2d_Ellipse) anEllipse1 = + new Geom2d_Ellipse(theEllipse->impl()); Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(*MY_ELLIPSE); - IntAna2d_AnaIntersection anInter(theEllipse->impl(), IntAna2d_Conic(*MY_ELLIPSE)); - Extrema_ExtCC2d* anExtema = - new Extrema_ExtCC2d(Geom2dAdaptor_Curve(anEllipse1), Geom2dAdaptor_Curve(anEllipse2)); + IntAna2d_AnaIntersection anInter(theEllipse->impl(), + IntAna2d_Conic(*MY_ELLIPSE)); + Extrema_ExtCC2d *anExtema = new Extrema_ExtCC2d( + Geom2dAdaptor_Curve(anEllipse1), Geom2dAdaptor_Curve(anEllipse2)); double aDistance = extrema(&anInter, anExtema, theEllipse->firstFocus(), thePointOnEllipse, thePointOnMe); delete anExtema; @@ -208,15 +209,14 @@ double GeomAPI_Ellipse2d::distance(const std::shared_ptr& the } const std::shared_ptr GeomAPI_Ellipse2d::project( - const std::shared_ptr& thePoint) const -{ + const std::shared_ptr &thePoint) const { std::shared_ptr aResult; if (!MY_ELLIPSE) return aResult; Handle(Geom2d_Ellipse) aEllipse = new Geom2d_Ellipse(*MY_ELLIPSE); - const gp_Pnt2d& aPoint = thePoint->impl(); + const gp_Pnt2d &aPoint = thePoint->impl(); Geom2dAPI_ProjectPointOnCurve aProj(aPoint, aEllipse); Standard_Integer aNbPoint = aProj.NbPoints(); @@ -227,10 +227,10 @@ const std::shared_ptr GeomAPI_Ellipse2d::project( return aResult; } -const bool GeomAPI_Ellipse2d::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const -{ +const bool +GeomAPI_Ellipse2d::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom2d_Ellipse) aCurve = new Geom2d_Ellipse(*MY_ELLIPSE); return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, theParameter) == Standard_True; diff --git a/src/GeomAPI/GeomAPI_Ellipse2d.h b/src/GeomAPI/GeomAPI_Ellipse2d.h index a54b7db67..4e09994ab 100644 --- a/src/GeomAPI/GeomAPI_Ellipse2d.h +++ b/src/GeomAPI/GeomAPI_Ellipse2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAPI_Ellipse2d.h @@ -35,21 +36,21 @@ class GeomAPI_Pnt2d; * \ingroup DataModel * \brief Ellipse in 2D */ -class GeomAPI_Ellipse2d : public GeomAPI_Interface -{ +class GeomAPI_Ellipse2d : public GeomAPI_Interface { public: /// \brief Constructs ellipse by center, X-axis and given radii - GEOMAPI_EXPORT GeomAPI_Ellipse2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theXAxis, - const double theMajorRadius, - const double theMinorRadius); + GEOMAPI_EXPORT + GeomAPI_Ellipse2d(const std::shared_ptr &theCenter, + const std::shared_ptr &theXAxis, + const double theMajorRadius, const double theMinorRadius); /// \brief Constructs ellipse by center and two points lying on the ellipse: /// first of them defines an axis of the ellipse /// and another is just placed on the ellipse. - GEOMAPI_EXPORT GeomAPI_Ellipse2d(const std::shared_ptr& theCenter, - const std::shared_ptr& theAxisPoint, - const std::shared_ptr& thePassingPoint); + GEOMAPI_EXPORT + GeomAPI_Ellipse2d(const std::shared_ptr &theCenter, + const std::shared_ptr &theAxisPoint, + const std::shared_ptr &thePassingPoint); /// Returns center of the ellipse GEOMAPI_EXPORT std::shared_ptr center() const; @@ -67,39 +68,41 @@ public: GEOMAPI_EXPORT double majorRadius() const; /// Project point on ellipse - GEOMAPI_EXPORT const std::shared_ptr project( - const std::shared_ptr& thePoint) const; - - /** \brief Computes the parameter of a given point on an ellipse. The point must be - * located either on the circle itself or relatively to the latter - * at a distance less than the tolerance value. Return FALSE if the point - * is beyond the tolerance limit or if computation fails. - * Max Tolerance value is currently limited to 1.e-4 - * \param[in] thePoint point of origin. - * \param[in] theTolerance tolerance of computation. - * \param[out] theParameter resulting parameter. + GEOMAPI_EXPORT const std::shared_ptr + project(const std::shared_ptr &thePoint) const; + + /** \brief Computes the parameter of a given point on an ellipse. The point + * must be located either on the circle itself or relatively to the latter at + * a distance less than the tolerance value. Return FALSE if the point is + * beyond the tolerance limit or if computation fails. Max Tolerance value is + * currently limited to 1.e-4 \param[in] thePoint point of origin. \param[in] + * theTolerance tolerance of computation. \param[out] theParameter resulting + * parameter. */ - GEOMAPI_EXPORT const bool parameter(const std::shared_ptr thePoint, - const double theTolerance, - double& theParameter) const; + GEOMAPI_EXPORT const bool + parameter(const std::shared_ptr thePoint, + const double theTolerance, double &theParameter) const; /// Calculate minimal distance between the ellipse and a line. /// Return corresponding points on the ellipse and on the line. - GEOMAPI_EXPORT double distance(const std::shared_ptr& theLine, - std::shared_ptr& thePointOnMe, - std::shared_ptr& thePointOnLine); + GEOMAPI_EXPORT double + distance(const std::shared_ptr &theLine, + std::shared_ptr &thePointOnMe, + std::shared_ptr &thePointOnLine); /// Calculate minimal distance between the ellipse and a circle. /// Return corresponding points on the ellipse and on the circle. - GEOMAPI_EXPORT double distance(const std::shared_ptr& theCircle, - std::shared_ptr& thePointOnMe, - std::shared_ptr& thePointOnCircle); + GEOMAPI_EXPORT double + distance(const std::shared_ptr &theCircle, + std::shared_ptr &thePointOnMe, + std::shared_ptr &thePointOnCircle); /// Calculate minimal distance between two ellipses. /// Return corresponding points on the ellipses. - GEOMAPI_EXPORT double distance(const std::shared_ptr& theEllipse, - std::shared_ptr& thePointOnMe, - std::shared_ptr& thePointOnEllipse); + GEOMAPI_EXPORT double + distance(const std::shared_ptr &theEllipse, + std::shared_ptr &thePointOnMe, + std::shared_ptr &thePointOnEllipse); }; #endif diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index ae35f43f3..3a0ba894b 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -14,43 +14,44 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Face.h" +#include "GeomAPI_Cone.h" +#include "GeomAPI_Curve.h" +#include "GeomAPI_Cylinder.h" #include "GeomAPI_Dir.h" #include "GeomAPI_Pln.h" #include "GeomAPI_Pnt.h" #include "GeomAPI_Sphere.h" -#include "GeomAPI_Curve.h" -#include "GeomAPI_Cylinder.h" -#include "GeomAPI_Cone.h" #include "GeomAPI_Torus.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 @@ -63,37 +64,32 @@ #include #endif -#include -#include #include +#include +#include #include -static void optimalBounds(const TopoDS_Face& theFace, double& theUMin, double& theUMax, - double& theVMin, double& theVMax); - +static void optimalBounds(const TopoDS_Face &theFace, double &theUMin, + double &theUMax, double &theVMin, double &theVMax); -GeomAPI_Face::GeomAPI_Face() - : GeomAPI_Shape() -{ -} +GeomAPI_Face::GeomAPI_Face() : GeomAPI_Shape() {} -GeomAPI_Face::GeomAPI_Face(const std::shared_ptr& theShape) -{ +GeomAPI_Face::GeomAPI_Face(const std::shared_ptr &theShape) { if (!theShape->isNull() && theShape->isFace()) { setImpl(new TopoDS_Shape(theShape->impl())); } } -bool GeomAPI_Face::isEqual(std::shared_ptr theFace) const -{ +bool GeomAPI_Face::isEqual(std::shared_ptr theFace) const { if (!theFace.get()) return false; if (!theFace->isFace()) return false; - const TopoDS_Shape& aMyShape = const_cast(this)->impl(); - const TopoDS_Shape& aInShape = theFace->impl(); + const TopoDS_Shape &aMyShape = + const_cast(this)->impl(); + const TopoDS_Shape &aInShape = theFace->impl(); TopoDS_Face aMyFace = TopoDS::Face(aMyShape); TopoDS_Face aInFace = TopoDS::Face(aInShape); @@ -119,15 +115,16 @@ bool GeomAPI_Face::isEqual(std::shared_ptr theFace) const return false; Handle(IntTools_Context) aContext = new IntTools_Context(); - // Double check needed because BOPTools_AlgoTools::AreFacesSameDomain not very smart. - Standard_Boolean aRes = BOPTools_AlgoTools::AreFacesSameDomain(aMyFace, aInFace, aContext) - && BOPTools_AlgoTools::AreFacesSameDomain(aInFace, aMyFace, aContext); + // Double check needed because BOPTools_AlgoTools::AreFacesSameDomain not very + // smart. + Standard_Boolean aRes = + BOPTools_AlgoTools::AreFacesSameDomain(aMyFace, aInFace, aContext) && + BOPTools_AlgoTools::AreFacesSameDomain(aInFace, aMyFace, aContext); return aRes == Standard_True; } -static Handle(Geom_Surface) baseSurface(const TopoDS_Face& theFace) -{ +static Handle(Geom_Surface) baseSurface(const TopoDS_Face &theFace) { Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace); while (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { Handle(Geom_RectangularTrimmedSurface) rts = @@ -137,8 +134,8 @@ static Handle(Geom_Surface) baseSurface(const TopoDS_Face& theFace) return aSurf; } -bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) const -{ +bool GeomAPI_Face::isSameGeometry( + const std::shared_ptr theShape) const { if (!theShape->isFace()) return false; if (isSame(theShape)) @@ -161,8 +158,7 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) // case of two elementary surfaces if (anOwnSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) && - anOtherSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) - { + anOtherSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) { #if OCC_VERSION_LARGE < 0x07070000 Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(anOwnSurf); Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(anOtherSurf); @@ -182,8 +178,7 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) return false; return anIIInt.TangentFaces(); - } - catch (Standard_Failure const&) { + } catch (Standard_Failure const &) { return false; } } @@ -193,8 +188,7 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) if ((anOwnSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) || anOwnSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface))) && (anOtherSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) || - anOtherSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface)))) - { + anOtherSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface)))) { GeomCylinderPtr anOwnCyl = getCylinder(); GeomCylinderPtr anOtherCyl = anOther->getCylinder(); if (anOwnCyl && anOtherCyl) @@ -205,11 +199,13 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) anOtherSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) || (anOwnSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)) && anOtherSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)))) { - Handle(Geom_SweptSurface) anOwnSwept = Handle(Geom_SweptSurface)::DownCast(anOwnSurf); - Handle(Geom_SweptSurface) anOtherSwept = Handle(Geom_SweptSurface)::DownCast(anOtherSurf); + Handle(Geom_SweptSurface) anOwnSwept = + Handle(Geom_SweptSurface)::DownCast(anOwnSurf); + Handle(Geom_SweptSurface) anOtherSwept = + Handle(Geom_SweptSurface)::DownCast(anOtherSurf); - const gp_Dir& anOwnDir = anOwnSwept->Direction(); - const gp_Dir& anOtherDir = anOtherSwept->Direction(); + const gp_Dir &anOwnDir = anOwnSwept->Direction(); + const gp_Dir &anOtherDir = anOtherSwept->Direction(); if (anOwnDir.IsParallel(anOtherDir, Precision::Angular())) { Handle(Geom_Curve) anOwnCurve = anOwnSwept->BasisCurve(); @@ -224,44 +220,44 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) return false; } -bool GeomAPI_Face::isCylindrical() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Face::isCylindrical() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); Handle(Geom_RectangularTrimmedSurface) aTrimmed = - Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); if (!aTrimmed.IsNull()) aSurf = aTrimmed->BasisSurface(); return aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) == Standard_True; } -std::shared_ptr GeomAPI_Face::getPlane() const -{ +std::shared_ptr GeomAPI_Face::getPlane() const { std::shared_ptr aResult; TopoDS_Shape aShape = this->impl(); if (aShape.IsNull()) - return aResult; // null shape + return aResult; // null shape if (aShape.ShapeType() != TopAbs_FACE) - return aResult; // not face + return aResult; // not face TopoDS_Face aFace = TopoDS::Face(aShape); if (aFace.IsNull()) - return aResult; // not face + return aResult; // not face Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); if (aSurf.IsNull()) - return aResult; // no surface + return aResult; // no surface GeomLib_IsPlanarSurface isPlanarSurf(aSurf); gp_Pln aPln; bool isPlanar = false; if (isPlanarSurf.IsPlanar()) { aPln = isPlanarSurf.Plan(); isPlanar = true; - } - else if (aSurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) { - Handle(Geom_OffsetSurface) anOffsetSurf = Handle(Geom_OffsetSurface)::DownCast(aSurf); + } else if (aSurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) { + Handle(Geom_OffsetSurface) anOffsetSurf = + Handle(Geom_OffsetSurface)::DownCast(aSurf); Handle(Geom_Surface) aBasisSurf = anOffsetSurf->BasisSurface(); if (aBasisSurf->IsKind(STANDARD_TYPE(Geom_Plane))) { aPln = Handle(Geom_Plane)::DownCast(aBasisSurf)->Pln(); - gp_Vec aTranslation(aPln.Axis().Direction().XYZ() * anOffsetSurf->Offset()); + gp_Vec aTranslation(aPln.Axis().Direction().XYZ() * + anOffsetSurf->Offset()); aPln.Translate(aTranslation); isPlanar = true; } @@ -281,33 +277,33 @@ std::shared_ptr GeomAPI_Face::getPlane() const return aResult; } -std::shared_ptr GeomAPI_Face::getSphere() const -{ +std::shared_ptr GeomAPI_Face::getSphere() const { GeomSpherePtr aSphere; - const TopoDS_Face& aFace = TopoDS::Face(impl()); + const TopoDS_Face &aFace = TopoDS::Face(impl()); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); if (aSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { gp_Sphere aSph = Handle(Geom_SphericalSurface)::DownCast(aSurf)->Sphere(); - const gp_Pnt& aCenter = aSph.Location(); + const gp_Pnt &aCenter = aSph.Location(); double aRadius = aSph.Radius(); - GeomPointPtr aCenterPnt(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); + GeomPointPtr aCenterPnt( + new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); aSphere = GeomSpherePtr(new GeomAPI_Sphere(aCenterPnt, aRadius)); } return aSphere; } -std::shared_ptr GeomAPI_Face::getCylinder() const -{ +std::shared_ptr GeomAPI_Face::getCylinder() const { GeomCylinderPtr aCylinder; - const TopoDS_Face& aFace = TopoDS::Face(impl()); + const TopoDS_Face &aFace = TopoDS::Face(impl()); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); if (aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { - gp_Cylinder aCyl = Handle(Geom_CylindricalSurface)::DownCast(aSurf)->Cylinder(); + gp_Cylinder aCyl = + Handle(Geom_CylindricalSurface)::DownCast(aSurf)->Cylinder(); gp_Pnt aLoc = aCyl.Location(); - const gp_Dir& aDir = aCyl.Position().Direction(); + const gp_Dir &aDir = aCyl.Position().Direction(); double aRadius = aCyl.Radius(); double aUMin, aUMax, aVMin, aVMax; @@ -317,16 +313,16 @@ std::shared_ptr GeomAPI_Face::getCylinder() const aLoc.ChangeCoord() += aDir.XYZ() * aVMin; GeomPointPtr aLocation(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); - aCylinder = GeomCylinderPtr(new GeomAPI_Cylinder(aLocation, aDirection, aRadius, aHeight)); + aCylinder = GeomCylinderPtr( + new GeomAPI_Cylinder(aLocation, aDirection, aRadius, aHeight)); } return aCylinder; } -std::shared_ptr GeomAPI_Face::getCone() const -{ +std::shared_ptr GeomAPI_Face::getCone() const { GeomConePtr aCone; - const TopoDS_Face& aFace = TopoDS::Face(impl()); + const TopoDS_Face &aFace = TopoDS::Face(impl()); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); if (aSurf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) { gp_Cone aCon = Handle(Geom_ConicalSurface)::DownCast(aSurf)->Cone(); @@ -344,36 +340,36 @@ std::shared_ptr GeomAPI_Face::getCone() const GeomPointPtr aLocation(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); - aCone = GeomConePtr(new GeomAPI_Cone(aLocation, aDirection, aSemiAngle, aRadius1, aRadius2)); + aCone = GeomConePtr(new GeomAPI_Cone(aLocation, aDirection, aSemiAngle, + aRadius1, aRadius2)); } return aCone; } -std::shared_ptr GeomAPI_Face::getTorus() const -{ +std::shared_ptr GeomAPI_Face::getTorus() const { GeomTorusPtr aTorus; - const TopoDS_Face& aFace = TopoDS::Face(impl()); + const TopoDS_Face &aFace = TopoDS::Face(impl()); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); if (aSurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) { gp_Torus aTor = Handle(Geom_ToroidalSurface)::DownCast(aSurf)->Torus(); - const gp_Pnt& aLoc = aTor.Location(); - const gp_Dir& aDir = aTor.Position().Direction(); + const gp_Pnt &aLoc = aTor.Location(); + const gp_Dir &aDir = aTor.Position().Direction(); double aMajorRadius = aTor.MajorRadius(); double aMinorRadius = aTor.MinorRadius(); GeomPointPtr aCenter(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); - aTorus = GeomTorusPtr(new GeomAPI_Torus(aCenter, aDirection, aMajorRadius, aMinorRadius)); + aTorus = GeomTorusPtr( + new GeomAPI_Torus(aCenter, aDirection, aMajorRadius, aMinorRadius)); } return aTorus; } -GeomPointPtr GeomAPI_Face::middlePoint() const -{ +GeomPointPtr GeomAPI_Face::middlePoint() const { GeomPointPtr anInnerPoint; - const TopoDS_Face& aFace = impl(); + const TopoDS_Face &aFace = impl(); if (aFace.IsNull()) return anInnerPoint; @@ -389,13 +385,13 @@ GeomPointPtr GeomAPI_Face::middlePoint() const return anInnerPoint; } - // ================== Auxiliary functions ======================== -void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_Box2d& theBndBox) -{ +void optimalBounds(const TopoDS_Face &theFace, const TopoDS_Edge &theEdge, + Bnd_Box2d &theBndBox) { Standard_Real aFirst, aLast; - const Handle(Geom2d_Curve) aC2D = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast); + const Handle(Geom2d_Curve) aC2D = + BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast); if (aC2D.IsNull()) return; @@ -412,37 +408,33 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B Handle(Geom_Surface) aS = BRep_Tool::Surface(theFace, aLoc); aS->Bounds(aUmin, aUmax, aVmin, aVmax); - if (aS->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) - { + if (aS->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { const Handle(Geom_RectangularTrimmedSurface) aSt = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS); aS = aSt->BasisSurface(); } // - if (!aS->IsUPeriodic()) - { + if (!aS->IsUPeriodic()) { Standard_Boolean isUPeriodic = Standard_False; // Additional verification for U-periodicity for B-spline surfaces. - // 1. Verify that the surface is U-closed (if such flag is false). Verification uses 2 points. - // 2. Verify periodicity of surface inside UV-bounds of the edge. It uses 3 or 6 points. + // 1. Verify that the surface is U-closed (if such flag is false). + // Verification uses 2 points. + // 2. Verify periodicity of surface inside UV-bounds of the edge. It uses 3 + // or 6 points. if (aS->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface) && - (aXmin < aUmin || aXmax > aUmax)) - { + (aXmin < aUmin || aXmax > aUmax)) { Standard_Real aTol2 = 100 * Precision::SquareConfusion(); isUPeriodic = Standard_True; gp_Pnt P1, P2; // 1. Verify that the surface is U-closed - if (!aS->IsUClosed()) - { + if (!aS->IsUClosed()) { Standard_Real aVStep = aVmax - aVmin; - for (Standard_Real aV = aVmin; aV <= aVmax; aV += aVStep) - { + for (Standard_Real aV = aVmin; aV <= aVmax; aV += aVStep) { P1 = aS->Value(aUmin, aV); P2 = aS->Value(aUmax, aV); - if (P1.SquareDistance(P2) > aTol2) - { + if (P1.SquareDistance(P2) > aTol2) { isUPeriodic = Standard_False; break; } @@ -452,11 +444,10 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B if (isUPeriodic) // the flag still not changed { Standard_Real aV = (aVmin + aVmax) * 0.5; - Standard_Real aU[6]; // values of U lying out of surface boundaries + Standard_Real aU[6]; // values of U lying out of surface boundaries Standard_Real aUpp[6]; // corresponding U-values plus/minus period Standard_Integer aNbPnt = 0; - if (aXmin < aUmin) - { + if (aXmin < aUmin) { aU[0] = aXmin; aU[1] = (aXmin + aUmin) * 0.5; aU[2] = aUmin; @@ -465,8 +456,7 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B aUpp[2] = aU[2] + aUmax - aUmin; aNbPnt += 3; } - if (aXmax > aUmax) - { + if (aXmax > aUmax) { aU[aNbPnt] = aUmax; aU[aNbPnt + 1] = (aXmax + aUmax) * 0.5; aU[aNbPnt + 2] = aXmax; @@ -475,12 +465,10 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B aUpp[aNbPnt + 2] = aU[aNbPnt + 2] - aUmax + aUmin; aNbPnt += 3; } - for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++) - { + for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++) { P1 = aS->Value(aU[anInd], aV); P2 = aS->Value(aUpp[anInd], aV); - if (P1.SquareDistance(P2) > aTol2) - { + if (P1.SquareDistance(P2) > aTol2) { isUPeriodic = Standard_False; break; } @@ -488,42 +476,36 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B } } - if (!isUPeriodic) - { - if ((aXmin < aUmin) && (aUmin < aXmax)) - { + if (!isUPeriodic) { + if ((aXmin < aUmin) && (aUmin < aXmax)) { aXmin = aUmin; } - if ((aXmin < aUmax) && (aUmax < aXmax)) - { + if ((aXmin < aUmax) && (aUmax < aXmax)) { aXmax = aUmax; } } } - if (!aS->IsVPeriodic()) - { + if (!aS->IsVPeriodic()) { Standard_Boolean isVPeriodic = Standard_False; // Additional verification for V-periodicity for B-spline surfaces. - // 1. Verify that the surface is V-closed (if such flag is false). Verification uses 2 points. - // 2. Verify periodicity of surface inside UV-bounds of the edge. It uses 3 or 6 points. + // 1. Verify that the surface is V-closed (if such flag is false). + // Verification uses 2 points. + // 2. Verify periodicity of surface inside UV-bounds of the edge. It uses 3 + // or 6 points. if (aS->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface) && - (aYmin < aVmin || aYmax > aVmax)) - { + (aYmin < aVmin || aYmax > aVmax)) { Standard_Real aTol2 = 100 * Precision::SquareConfusion(); isVPeriodic = Standard_True; gp_Pnt P1, P2; // 1. Verify that the surface is V-closed - if (!aS->IsVClosed()) - { + if (!aS->IsVClosed()) { Standard_Real aUStep = aUmax - aUmin; - for (Standard_Real aU = aUmin; aU <= aUmax; aU += aUStep) - { + for (Standard_Real aU = aUmin; aU <= aUmax; aU += aUStep) { P1 = aS->Value(aU, aVmin); P2 = aS->Value(aU, aVmax); - if (P1.SquareDistance(P2) > aTol2) - { + if (P1.SquareDistance(P2) > aTol2) { isVPeriodic = Standard_False; break; } @@ -533,11 +515,10 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B if (isVPeriodic) // the flag still not changed { Standard_Real aU = (aUmin + aUmax) * 0.5; - Standard_Real aV[6]; // values of V lying out of surface boundaries + Standard_Real aV[6]; // values of V lying out of surface boundaries Standard_Real aVpp[6]; // corresponding V-values plus/minus period Standard_Integer aNbPnt = 0; - if (aYmin < aVmin) - { + if (aYmin < aVmin) { aV[0] = aYmin; aV[1] = (aYmin + aVmin) * 0.5; aV[2] = aVmin; @@ -546,8 +527,7 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B aVpp[2] = aV[2] + aVmax - aVmin; aNbPnt += 3; } - if (aYmax > aVmax) - { + if (aYmax > aVmax) { aV[aNbPnt] = aVmax; aV[aNbPnt + 1] = (aYmax + aVmax) * 0.5; aV[aNbPnt + 2] = aYmax; @@ -556,12 +536,10 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B aVpp[aNbPnt + 2] = aV[aNbPnt + 2] - aVmax + aVmin; aNbPnt += 3; } - for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++) - { + for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++) { P1 = aS->Value(aU, aV[anInd]); P2 = aS->Value(aU, aVpp[anInd]); - if (P1.SquareDistance(P2) > aTol2) - { + if (P1.SquareDistance(P2) > aTol2) { isVPeriodic = Standard_False; break; } @@ -569,14 +547,11 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B } } - if (!isVPeriodic) - { - if ((aYmin < aVmin) && (aVmin < aYmax)) - { + if (!isVPeriodic) { + if ((aYmin < aVmin) && (aVmin < aYmax)) { aYmin = aVmin; } - if ((aYmin < aVmax) && (aVmax < aYmax)) - { + if ((aYmin < aVmax) && (aVmax < aYmax)) { aYmax = aVmax; } } @@ -587,9 +562,8 @@ void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_B theBndBox.Add(aBoxS); } -void optimalBounds(const TopoDS_Face& theFace, double& theUMin, double& theUMax, - double& theVMin, double& theVMax) -{ +void optimalBounds(const TopoDS_Face &theFace, double &theUMin, double &theUMax, + double &theVMin, double &theVMax) { Bnd_Box2d aBB; for (TopExp_Explorer anExp(theFace, TopAbs_EDGE); anExp.More(); anExp.Next()) diff --git a/src/GeomAPI/GeomAPI_Face.h b/src/GeomAPI/GeomAPI_Face.h index 0409d970e..2977ef93d 100644 --- a/src/GeomAPI/GeomAPI_Face.h +++ b/src/GeomAPI/GeomAPI_Face.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Face_H_ @@ -29,11 +30,10 @@ class GeomAPI_Cone; class GeomAPI_Torus; /**\class GeomAPI_Face -* \ingroup DataModel + * \ingroup DataModel * \brief Interface to the face object */ -class GeomAPI_Face : public GeomAPI_Shape -{ +class GeomAPI_Face : public GeomAPI_Shape { public: /// Creation of empty (null) shape GEOMAPI_EXPORT @@ -41,7 +41,7 @@ public: /// Creation of face by the face-shape GEOMAPI_EXPORT - GeomAPI_Face(const std::shared_ptr& theShape); + GeomAPI_Face(const std::shared_ptr &theShape); /// Returns true if the current face is geometrically equal to the given face GEOMAPI_EXPORT @@ -49,13 +49,15 @@ public: /// Returns \c true if faces have same underlying surface GEOMAPI_EXPORT - virtual bool isSameGeometry(const std::shared_ptr theShape) const; + virtual bool + isSameGeometry(const std::shared_ptr theShape) const; /// Returns true if the face is a cylindrical face GEOMAPI_EXPORT bool isCylindrical() const; - /// Returns the base plane of the face (if it is planar) with location in the center of the face + /// Returns the base plane of the face (if it is planar) with location in the + /// center of the face GEOMAPI_EXPORT std::shared_ptr getPlane() const; @@ -79,4 +81,3 @@ public: typedef std::shared_ptr GeomFacePtr; #endif - diff --git a/src/GeomAPI/GeomAPI_ICustomPrs.cpp b/src/GeomAPI/GeomAPI_ICustomPrs.cpp index c9d1a5580..8519efdd4 100644 --- a/src/GeomAPI/GeomAPI_ICustomPrs.cpp +++ b/src/GeomAPI/GeomAPI_ICustomPrs.cpp @@ -14,12 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs() -{ - -} +GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs() {} diff --git a/src/GeomAPI/GeomAPI_ICustomPrs.h b/src/GeomAPI/GeomAPI_ICustomPrs.h index 0aa74b0d3..c33ebb2b8 100644 --- a/src/GeomAPI/GeomAPI_ICustomPrs.h +++ b/src/GeomAPI/GeomAPI_ICustomPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_ICustomPrs_H @@ -22,7 +23,6 @@ #include "GeomAPI.h" #include "GeomAPI_AISObject.h" -#include "GeomAPI_AISObject.h" #include @@ -33,8 +33,7 @@ class ModelAPI_Result; * \brief Interface of a class which can provide specific customization of * object presentation */ -class GeomAPI_ICustomPrs -{ +class GeomAPI_ICustomPrs { public: GEOMAPI_EXPORT virtual ~GeomAPI_ICustomPrs(); diff --git a/src/GeomAPI/GeomAPI_IPresentable.cpp b/src/GeomAPI/GeomAPI_IPresentable.cpp index a2b796437..5df092b54 100644 --- a/src/GeomAPI/GeomAPI_IPresentable.cpp +++ b/src/GeomAPI/GeomAPI_IPresentable.cpp @@ -14,18 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // This file is added in order to avoid a problem with // dynamic_cast of GeomAPI_IPresentable objects under // SALOME in release mode - - #include "GeomAPI_IPresentable.h" - -GeomAPI_IPresentable::~GeomAPI_IPresentable() -{ -} +GeomAPI_IPresentable::~GeomAPI_IPresentable() {} diff --git a/src/GeomAPI/GeomAPI_IPresentable.h b/src/GeomAPI/GeomAPI_IPresentable.h index ffb3895c2..8263febd5 100644 --- a/src/GeomAPI/GeomAPI_IPresentable.h +++ b/src/GeomAPI/GeomAPI_IPresentable.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_IPresentable_H_ @@ -23,11 +24,11 @@ #include "GeomAPI_AISObject.h" /** - * A class which defines an interface of object which is able to create its own presentation + * A class which defines an interface of object which is able to create its own + * presentation */ -class GeomAPI_IPresentable -{ - public: +class GeomAPI_IPresentable { +public: GEOMAPI_EXPORT virtual ~GeomAPI_IPresentable(); /** Returns the AIS preview * \param thePrevious - defines a presentation if it was created previously diff --git a/src/GeomAPI/GeomAPI_IScreenParams.h b/src/GeomAPI/GeomAPI_IScreenParams.h index 19222d434..2a5022d3f 100644 --- a/src/GeomAPI/GeomAPI_IScreenParams.h +++ b/src/GeomAPI/GeomAPI_IScreenParams.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_IScreenParams_H_ @@ -23,27 +24,26 @@ #include "GeomAPI_Pln.h" /** -* A class which defines an interface of object which has to be provided with -* current screen parameters -*/ -class GeomAPI_IScreenParams -{ + * A class which defines an interface of object which has to be provided with + * current screen parameters + */ +class GeomAPI_IScreenParams { public: virtual ~GeomAPI_IScreenParams() {} /** - * Set plane of active view screen - * \param theScreenPlane - the screen plane - */ + * Set plane of active view screen + * \param theScreenPlane - the screen plane + */ virtual void setScreenPlane(GeomPlanePtr theScreenPlane) = 0; /** - * Set a scale of active view - * \param theScale a view scale - */ + * Set a scale of active view + * \param theScale a view scale + */ virtual void setViewScale(double theScale) = 0; }; typedef std::shared_ptr GeomScreenParamsPtr; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAPI/GeomAPI_Interface.cpp b/src/GeomAPI/GeomAPI_Interface.cpp index bd6ec2b40..07e02e687 100644 --- a/src/GeomAPI/GeomAPI_Interface.cpp +++ b/src/GeomAPI/GeomAPI_Interface.cpp @@ -14,22 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -GeomAPI_Interface::GeomAPI_Interface() -{ +GeomAPI_Interface::GeomAPI_Interface() {} -} +GeomAPI_Interface::~GeomAPI_Interface() {} -GeomAPI_Interface::~GeomAPI_Interface() -{ - -} - -bool GeomAPI_Interface::empty() const -{ - return myImpl.get() == 0; -} +bool GeomAPI_Interface::empty() const { return myImpl.get() == 0; } diff --git a/src/GeomAPI/GeomAPI_Interface.h b/src/GeomAPI/GeomAPI_Interface.h index 61db0ce69..542898a61 100644 --- a/src/GeomAPI/GeomAPI_Interface.h +++ b/src/GeomAPI/GeomAPI_Interface.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Interface_H_ @@ -29,48 +30,43 @@ * \brief General base class for all interfaces in this package */ -template -void GeomAPI_deleter( void* p ) { - delete reinterpret_cast(p); +template void GeomAPI_deleter(void *p) { + delete reinterpret_cast(p); } -class GeomAPI_Interface -{ - private: - std::shared_ptr myImpl; ///< pointer to the internal impl object +class GeomAPI_Interface { +private: + std::shared_ptr myImpl; ///< pointer to the internal impl object - public: +public: /// None - constructor GEOMAPI_EXPORT GeomAPI_Interface(); /// Constructor by the impl pointer (used for internal needs) - template explicit GeomAPI_Interface(T* theImpl) - { - myImpl = std::shared_ptr(reinterpret_cast(theImpl), GeomAPI_deleter); + template explicit GeomAPI_Interface(T *theImpl) { + myImpl = std::shared_ptr(reinterpret_cast(theImpl), + GeomAPI_deleter); } /// Destructor GEOMAPI_EXPORT virtual ~GeomAPI_Interface(); /// Returns the pointer to the impl - template inline T* implPtr() - { - return reinterpret_cast(myImpl.get()); + template inline T *implPtr() { + return reinterpret_cast(myImpl.get()); } /// Returns the pointer to the impl - template inline const T* implPtr() const - { - return reinterpret_cast(myImpl.get()); + template inline const T *implPtr() const { + return reinterpret_cast(myImpl.get()); } /// Returns the reference object of the impl - template inline const T& impl() const - { - return *(reinterpret_cast(myImpl.get())); + template inline const T &impl() const { + return *(reinterpret_cast(myImpl.get())); } /// Updates the impl (deletes the old one) - template inline void setImpl(T* theImpl) - { - myImpl = std::shared_ptr(reinterpret_cast(theImpl), GeomAPI_deleter); + template inline void setImpl(T *theImpl) { + myImpl = std::shared_ptr(reinterpret_cast(theImpl), + GeomAPI_deleter); } /// Returns true if the impl is empty diff --git a/src/GeomAPI/GeomAPI_Lin.cpp b/src/GeomAPI/GeomAPI_Lin.cpp index edf81da85..7ccfa3b4f 100644 --- a/src/GeomAPI/GeomAPI_Lin.cpp +++ b/src/GeomAPI/GeomAPI_Lin.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // +#include #include #include -#include #include #include @@ -35,115 +36,108 @@ #define MY_LIN implPtr() -static gp_Lin* newLine(const double theStartX, const double theStartY, const double theStartZ, - const double theEndX, const double theEndY, const double theEndZ) -{ +static gp_Lin *newLine(const double theStartX, const double theStartY, + const double theStartZ, const double theEndX, + const double theEndY, const double theEndZ) { gp_XYZ aDir(theEndX - theStartX, theEndY - theStartY, theEndZ - theStartZ); gp_Pnt aStart(theStartX, theStartY, theStartZ); return new gp_Lin(aStart, gp_Dir(aDir)); } -GeomAPI_Lin::GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ, - const double theEndX, const double theEndY, const double theEndZ) - : GeomAPI_Interface(newLine(theStartX, theStartY, theStartZ, theEndX, theEndY, theEndZ)) -{ -} +GeomAPI_Lin::GeomAPI_Lin(const double theStartX, const double theStartY, + const double theStartZ, const double theEndX, + const double theEndY, const double theEndZ) + : GeomAPI_Interface(newLine(theStartX, theStartY, theStartZ, theEndX, + theEndY, theEndZ)) {} -GeomAPI_Lin::GeomAPI_Lin(const std::shared_ptr& theStart, - const std::shared_ptr& theEnd) - : GeomAPI_Interface( - newLine(theStart->x(), theStart->y(), theStart->z(), theEnd->x(), theEnd->y(), theEnd->z())) -{ -} +GeomAPI_Lin::GeomAPI_Lin(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd) + : GeomAPI_Interface(newLine(theStart->x(), theStart->y(), theStart->z(), + theEnd->x(), theEnd->y(), theEnd->z())) {} -GeomAPI_Lin::GeomAPI_Lin(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirection) +GeomAPI_Lin::GeomAPI_Lin(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirection) : GeomAPI_Interface(newLine(theOrigin->x(), theOrigin->y(), theOrigin->z(), theOrigin->x() + theDirection->x(), theOrigin->y() + theDirection->y(), - theOrigin->z() + theDirection->z())) -{ -} + theOrigin->z() + theDirection->z())) {} -std::shared_ptr GeomAPI_Lin::location() -{ +std::shared_ptr GeomAPI_Lin::location() { gp_Pnt aLoc = impl().Location(); - return std::shared_ptr(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); } -std::shared_ptr GeomAPI_Lin::direction() -{ - const gp_Dir& aDir = impl().Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +std::shared_ptr GeomAPI_Lin::direction() { + const gp_Dir &aDir = impl().Direction(); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } -double GeomAPI_Lin::distance(const std::shared_ptr& thePoint) const -{ +double +GeomAPI_Lin::distance(const std::shared_ptr &thePoint) const { return MY_LIN->Distance(thePoint->impl()); } -const std::shared_ptr GeomAPI_Lin::intersect( - const std::shared_ptr& theLine) const -{ +const std::shared_ptr +GeomAPI_Lin::intersect(const std::shared_ptr &theLine) const { if (MY_LIN->SquareDistance(theLine->impl()) > Precision::Confusion()) - return std::shared_ptr(); + return std::shared_ptr(); - const gp_Dir& aDir1 = MY_LIN->Direction(); - const gp_Dir& aDir2 = theLine->impl().Direction(); + const gp_Dir &aDir1 = MY_LIN->Direction(); + const gp_Dir &aDir2 = theLine->impl().Direction(); gp_Dir aCross = aDir1.Crossed(aDir2); - gp_Pln aPlane(MY_LIN->Location(), aCross); // plane containing both lines + gp_Pln aPlane(MY_LIN->Location(), aCross); // plane containing both lines gp_Lin2d aPrjLine1 = ProjLib::Project(aPlane, *MY_LIN); gp_Lin2d aPrjLine2 = ProjLib::Project(aPlane, theLine->impl()); IntAna2d_AnaIntersection anInter(aPrjLine1, aPrjLine2); if (!anInter.IsDone() || anInter.IsEmpty()) - return std::shared_ptr(); - const gp_Pnt2d& anIntPnt2d = anInter.Point(1).Value(); + return std::shared_ptr(); + const gp_Pnt2d &anIntPnt2d = anInter.Point(1).Value(); gp_Pnt aResult = ElSLib::Value(anIntPnt2d.X(), anIntPnt2d.Y(), aPlane); return std::shared_ptr( - new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z())); + new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z())); } -double GeomAPI_Lin::projParam( - const std::shared_ptr& thePoint) const -{ - const gp_XYZ& aDir = MY_LIN->Direction().XYZ(); - const gp_XYZ& aLoc = MY_LIN->Location().XYZ(); - const gp_XYZ& aPnt = thePoint->impl().XYZ(); +double +GeomAPI_Lin::projParam(const std::shared_ptr &thePoint) const { + const gp_XYZ &aDir = MY_LIN->Direction().XYZ(); + const gp_XYZ &aLoc = MY_LIN->Location().XYZ(); + const gp_XYZ &aPnt = thePoint->impl().XYZ(); return aDir.Dot(aPnt - aLoc); } -const std::shared_ptr GeomAPI_Lin::project( - const std::shared_ptr& thePoint) const -{ - const gp_XYZ& aDir = MY_LIN->Direction().XYZ(); - const gp_XYZ& aLoc = MY_LIN->Location().XYZ(); +const std::shared_ptr +GeomAPI_Lin::project(const std::shared_ptr &thePoint) const { + const gp_XYZ &aDir = MY_LIN->Direction().XYZ(); + const gp_XYZ &aLoc = MY_LIN->Location().XYZ(); double aParam = projParam(thePoint); gp_XYZ aResult = aLoc + aDir * aParam; - return std::shared_ptr(new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z())); } bool GeomAPI_Lin::contains(const std::shared_ptr thePoint, - const double theLinearTolerance) const -{ - if(!thePoint.get()) { + const double theLinearTolerance) const { + if (!thePoint.get()) { return false; } - return MY_LIN->Contains(thePoint->impl(), theLinearTolerance) == Standard_True; + return MY_LIN->Contains(thePoint->impl(), theLinearTolerance) == + Standard_True; } -bool GeomAPI_Lin::isParallel(const std::shared_ptr theLin) const -{ +bool GeomAPI_Lin::isParallel(const std::shared_ptr theLin) const { return MY_LIN->Direction().IsParallel(theLin->impl().Direction(), - Precision::Confusion()) == Standard_True; + Precision::Confusion()) == + Standard_True; } -bool GeomAPI_Lin::isCoplanar(const std::shared_ptr theLin) const -{ - if(MY_LIN->SquareDistance(theLin->impl()) > Precision::Confusion()) { +bool GeomAPI_Lin::isCoplanar(const std::shared_ptr theLin) const { + if (MY_LIN->SquareDistance(theLin->impl()) > Precision::Confusion()) { return false; } diff --git a/src/GeomAPI/GeomAPI_Lin.h b/src/GeomAPI/GeomAPI_Lin.h index 47ed6fa69..3ca8ad06c 100644 --- a/src/GeomAPI/GeomAPI_Lin.h +++ b/src/GeomAPI/GeomAPI_Lin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Lin_H_ @@ -31,21 +32,21 @@ class GeomAPI_Pnt; * \brief Line in 3D */ -class GeomAPI_Lin : public GeomAPI_Interface -{ - public: +class GeomAPI_Lin : public GeomAPI_Interface { +public: /// Creation of line defined by cordinates of start and end points GEOMAPI_EXPORT - GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ, - const double theEndX, const double theEndY, const double theEndZ); + GeomAPI_Lin(const double theStartX, const double theStartY, + const double theStartZ, const double theEndX, + const double theEndY, const double theEndZ); /// Creation of line defined by start and end points GEOMAPI_EXPORT - GeomAPI_Lin(const std::shared_ptr& theStart, - const std::shared_ptr& theEnd); + GeomAPI_Lin(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd); /// Creation of line defined by origin and direction GEOMAPI_EXPORT - GeomAPI_Lin(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirection); + GeomAPI_Lin(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirection); /// Returns point on the line (first point) GEOMAPI_EXPORT @@ -57,19 +58,19 @@ class GeomAPI_Lin : public GeomAPI_Interface /// Distance between two points GEOMAPI_EXPORT - double distance(const std::shared_ptr& thePoint) const; + double distance(const std::shared_ptr &thePoint) const; /// Intersection of two lines GEOMAPI_EXPORT - const std::shared_ptr intersect( - const std::shared_ptr& theLine) const; + const std::shared_ptr + intersect(const std::shared_ptr &theLine) const; /// Project point on line GEOMAPI_EXPORT - const std::shared_ptr project( - const std::shared_ptr& thePoint) const; + const std::shared_ptr + project(const std::shared_ptr &thePoint) const; /// Returns parameter of the point projection GEOMAPI_EXPORT - double projParam(const std::shared_ptr& thePoint) const; + double projParam(const std::shared_ptr &thePoint) const; /// \return true if this line contains thePoint, that is, /// if the distance between thePoint and this line @@ -91,4 +92,3 @@ class GeomAPI_Lin : public GeomAPI_Interface typedef std::shared_ptr GeomLinePtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Lin2d.cpp b/src/GeomAPI/GeomAPI_Lin2d.cpp index c74ed5c8b..c41fe23b5 100644 --- a/src/GeomAPI/GeomAPI_Lin2d.cpp +++ b/src/GeomAPI/GeomAPI_Lin2d.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // +#include #include #include -#include #include #include @@ -30,92 +31,82 @@ #define MY_LIN2D implPtr() -static gp_Lin2d* newLine2d(const double theStartX, const double theStartY, const double theEndX, - const double theEndY) -{ +static gp_Lin2d *newLine2d(const double theStartX, const double theStartY, + const double theEndX, const double theEndY) { gp_XY aDir(theEndX - theStartX, theEndY - theStartY); gp_Pnt2d aStart(theStartX, theStartY); return new gp_Lin2d(aStart, gp_Dir2d(aDir)); } +GeomAPI_Lin2d::GeomAPI_Lin2d(const double theStartX, const double theStartY, + const double theEndX, const double theEndY) + : GeomAPI_Interface(newLine2d(theStartX, theStartY, theEndX, theEndY)) {} -GeomAPI_Lin2d::GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX, - const double theEndY) - : GeomAPI_Interface(newLine2d(theStartX, theStartY, theEndX, theEndY)) -{ -} - -GeomAPI_Lin2d::GeomAPI_Lin2d(const std::shared_ptr& theStart, - const std::shared_ptr& theEnd) - : GeomAPI_Interface(newLine2d(theStart->x(), theStart->y(), theEnd->x(), theEnd->y())) -{ -} +GeomAPI_Lin2d::GeomAPI_Lin2d(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd) + : GeomAPI_Interface( + newLine2d(theStart->x(), theStart->y(), theEnd->x(), theEnd->y())) {} -GeomAPI_Lin2d::GeomAPI_Lin2d(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirection) +GeomAPI_Lin2d::GeomAPI_Lin2d(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirection) : GeomAPI_Interface(newLine2d(theOrigin->x(), theOrigin->y(), - theOrigin->x() + theDirection->x(), theOrigin->y() + theDirection->y())) -{ -} + theOrigin->x() + theDirection->x(), + theOrigin->y() + theDirection->y())) {} - -std::shared_ptr GeomAPI_Lin2d::location() -{ +std::shared_ptr GeomAPI_Lin2d::location() { gp_Pnt2d aLoc = impl().Location(); return std::shared_ptr(new GeomAPI_Pnt2d(aLoc.X(), aLoc.Y())); } -std::shared_ptr GeomAPI_Lin2d::direction() -{ - const gp_Dir2d& aDir = impl().Direction(); +std::shared_ptr GeomAPI_Lin2d::direction() { + const gp_Dir2d &aDir = impl().Direction(); return std::shared_ptr(new GeomAPI_Dir2d(aDir.X(), aDir.Y())); } -double GeomAPI_Lin2d::distance(const std::shared_ptr& theOther) const -{ +double +GeomAPI_Lin2d::distance(const std::shared_ptr &theOther) const { return MY_LIN2D->Distance(theOther->impl()); } -const std::shared_ptr GeomAPI_Lin2d::intersect( - const std::shared_ptr& theLine) const -{ +const std::shared_ptr +GeomAPI_Lin2d::intersect(const std::shared_ptr &theLine) const { IntAna2d_AnaIntersection anInter(*MY_LIN2D, theLine->impl()); if (!anInter.IsDone() || anInter.NbPoints() == 0) return std::shared_ptr(); - const gp_Pnt2d& aResult = anInter.Point(1).Value(); - return std::shared_ptr(new GeomAPI_Pnt2d(aResult.X(), aResult.Y())); + const gp_Pnt2d &aResult = anInter.Point(1).Value(); + return std::shared_ptr( + new GeomAPI_Pnt2d(aResult.X(), aResult.Y())); } -const std::shared_ptr GeomAPI_Lin2d::project( - const std::shared_ptr& thePoint) const -{ - const gp_XY& aDir = MY_LIN2D->Direction().XY(); - const gp_XY& aLoc = MY_LIN2D->Location().XY(); - const gp_XY& aPnt = thePoint->impl().XY(); +const std::shared_ptr +GeomAPI_Lin2d::project(const std::shared_ptr &thePoint) const { + const gp_XY &aDir = MY_LIN2D->Direction().XY(); + const gp_XY &aLoc = MY_LIN2D->Location().XY(); + const gp_XY &aPnt = thePoint->impl().XY(); double aParam = aDir.Dot(aPnt - aLoc); gp_XY aResult = aLoc + aDir * aParam; - return std::shared_ptr(new GeomAPI_Pnt2d(aResult.X(), aResult.Y())); + return std::shared_ptr( + new GeomAPI_Pnt2d(aResult.X(), aResult.Y())); } -bool GeomAPI_Lin2d::isRight(const std::shared_ptr& thePoint) const -{ - const gp_XY& aDir = MY_LIN2D->Direction().XY(); - const gp_XY& aLoc = MY_LIN2D->Location().XY(); - const gp_XY& aPnt = thePoint->impl().XY(); +bool GeomAPI_Lin2d::isRight( + const std::shared_ptr &thePoint) const { + const gp_XY &aDir = MY_LIN2D->Direction().XY(); + const gp_XY &aLoc = MY_LIN2D->Location().XY(); + const gp_XY &aPnt = thePoint->impl().XY(); return aDir.Crossed(aPnt - aLoc) > 0; } - -std::shared_ptr GeomAPI_Lin2d::shiftedLocation(double theShift) const -{ +std::shared_ptr +GeomAPI_Lin2d::shiftedLocation(double theShift) const { gp_Vec2d aVec = MY_LIN2D->Direction(); aVec = aVec.GetNormal(); aVec.Normalize(); aVec.Reverse(); aVec.Scale(theShift); gp_Lin2d aLin = MY_LIN2D->Translated(aVec); - return std::shared_ptr(new GeomAPI_Pnt2d(aLin.Location().X(), - aLin.Location().Y())); + return std::shared_ptr( + new GeomAPI_Pnt2d(aLin.Location().X(), aLin.Location().Y())); } diff --git a/src/GeomAPI/GeomAPI_Lin2d.h b/src/GeomAPI/GeomAPI_Lin2d.h index c37bf5742..a8966c771 100644 --- a/src/GeomAPI/GeomAPI_Lin2d.h +++ b/src/GeomAPI/GeomAPI_Lin2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Lin2d_H_ @@ -31,21 +32,20 @@ class GeomAPI_Pnt2d; * \brief Line in 2D */ -class GeomAPI_Lin2d : public GeomAPI_Interface -{ - public: +class GeomAPI_Lin2d : public GeomAPI_Interface { +public: /// Creation of line defined by cordinates of start and end points GEOMAPI_EXPORT - GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX, - const double theEndY); + GeomAPI_Lin2d(const double theStartX, const double theStartY, + const double theEndX, const double theEndY); /// Creation of line defined by start and end points GEOMAPI_EXPORT - GeomAPI_Lin2d(const std::shared_ptr& theStart, - const std::shared_ptr& theEnd); + GeomAPI_Lin2d(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd); /// Creation of line defined by origin and direction GEOMAPI_EXPORT - GeomAPI_Lin2d(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirection); + GeomAPI_Lin2d(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirection); /// Returns point on the line (first point) GEOMAPI_EXPORT @@ -57,28 +57,26 @@ class GeomAPI_Lin2d : public GeomAPI_Interface /// Distance between two points GEOMAPI_EXPORT - double distance(const std::shared_ptr& theOther) const; + double distance(const std::shared_ptr &theOther) const; /// Intersection of two lines GEOMAPI_EXPORT - const std::shared_ptr intersect( - const std::shared_ptr& theLine) const; + const std::shared_ptr + intersect(const std::shared_ptr &theLine) const; /// Project point on line GEOMAPI_EXPORT - const std::shared_ptr project( - const std::shared_ptr& thePoint) const; + const std::shared_ptr + project(const std::shared_ptr &thePoint) const; /// Computes the cross product of the line direction and a vector /// from the line start point to the point GEOMAPI_EXPORT - bool isRight(const std::shared_ptr& thePoint) const; + bool isRight(const std::shared_ptr &thePoint) const; /// Returns a location point shifted on theShift in perpendicular direction GEOMAPI_EXPORT std::shared_ptr shiftedLocation(double theShift) const; }; - //! Pointer on the object typedef std::shared_ptr GeomLine2dPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.cpp b/src/GeomAPI/GeomAPI_PlanarEdges.cpp index be124f526..b40ab6d9f 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.cpp +++ b/src/GeomAPI/GeomAPI_PlanarEdges.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,38 +24,35 @@ #include #include +#include +#include +#include #include #include #include -#include -#include -#include #include -GeomAPI_PlanarEdges::GeomAPI_PlanarEdges() : GeomAPI_Shape() -{ +GeomAPI_PlanarEdges::GeomAPI_PlanarEdges() : GeomAPI_Shape() { TopoDS_Compound aBigWireImpl; BRep_Builder aBuilder; aBuilder.MakeCompound(aBigWireImpl); this->setImpl(new TopoDS_Shape(aBigWireImpl)); } -void GeomAPI_PlanarEdges::addEdge(std::shared_ptr theEdge) -{ - const TopoDS_Edge& anEdge = theEdge->impl(); +void GeomAPI_PlanarEdges::addEdge(std::shared_ptr theEdge) { + const TopoDS_Edge &anEdge = theEdge->impl(); if (anEdge.ShapeType() != TopAbs_EDGE) return; - TopoDS_Shape& aWire = const_cast(impl()); + TopoDS_Shape &aWire = const_cast(impl()); BRep_Builder aBuilder; aBuilder.Add(aWire, anEdge); } -std::list > GeomAPI_PlanarEdges::getEdges() -{ - TopoDS_Shape& aShape = const_cast(impl()); +std::list> GeomAPI_PlanarEdges::getEdges() { + TopoDS_Shape &aShape = const_cast(impl()); TopExp_Explorer aWireExp(aShape, TopAbs_EDGE); - std::list > aResult; + std::list> aResult; for (; aWireExp.More(); aWireExp.Next()) { std::shared_ptr anEdge(new GeomAPI_Shape); anEdge->setImpl(new TopoDS_Shape(aWireExp.Current())); @@ -63,65 +61,54 @@ std::list > GeomAPI_PlanarEdges::getEdges() return aResult; } -bool GeomAPI_PlanarEdges::hasPlane() const { - return myPlane.get() != NULL; -} +bool GeomAPI_PlanarEdges::hasPlane() const { return myPlane.get() != NULL; } -bool GeomAPI_PlanarEdges::isVertex() const { - return false; -} +bool GeomAPI_PlanarEdges::isVertex() const { return false; } -bool GeomAPI_PlanarEdges::isEdge() const { - return false; -} +bool GeomAPI_PlanarEdges::isEdge() const { return false; } -std::shared_ptr GeomAPI_PlanarEdges::origin() const -{ +std::shared_ptr GeomAPI_PlanarEdges::origin() const { if (hasPlane()) return myPlane->origin(); return std::shared_ptr(); } -std::shared_ptr GeomAPI_PlanarEdges::dirX() const -{ +std::shared_ptr GeomAPI_PlanarEdges::dirX() const { if (hasPlane()) return myPlane->dirX(); return std::shared_ptr(); } -std::shared_ptr GeomAPI_PlanarEdges::dirY() const -{ +std::shared_ptr GeomAPI_PlanarEdges::dirY() const { if (hasPlane()) return myPlane->dirY(); return std::shared_ptr(); } -std::shared_ptr GeomAPI_PlanarEdges::norm() const -{ +std::shared_ptr GeomAPI_PlanarEdges::norm() const { if (hasPlane()) return myPlane->normal(); return std::shared_ptr(); } -bool GeomAPI_PlanarEdges::isPlanar() const -{ - return true; -} +bool GeomAPI_PlanarEdges::isPlanar() const { return true; } -void GeomAPI_PlanarEdges::setPlane(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theNorm) -{ - myPlane = std::shared_ptr(new GeomAPI_Ax3(theOrigin, theDirX, theNorm)); +void GeomAPI_PlanarEdges::setPlane( + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theNorm) { + myPlane = std::shared_ptr( + new GeomAPI_Ax3(theOrigin, theDirX, theNorm)); } -bool GeomAPI_PlanarEdges::isEqual(const std::shared_ptr theShape) const -{ +bool GeomAPI_PlanarEdges::isEqual( + const std::shared_ptr theShape) const { if (!theShape.get()) return false; - TopoDS_Shape& aMyShape = const_cast(impl()); + TopoDS_Shape &aMyShape = const_cast(impl()); TopoDS_Shape aTheShape = theShape->impl(); - if (aMyShape.ShapeType() != aTheShape.ShapeType()) // to don't confuse by the face of same edges + if (aMyShape.ShapeType() != + aTheShape.ShapeType()) // to don't confuse by the face of same edges return false; TopExp_Explorer aMyExp(aMyShape, TopAbs_EDGE); TopExp_Explorer aTheExp(aTheShape, TopAbs_EDGE); diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.h b/src/GeomAPI/GeomAPI_PlanarEdges.h index 1f9d1cabe..c19dce461 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.h +++ b/src/GeomAPI/GeomAPI_PlanarEdges.h @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMAPI_WIRE_H_ #define GEOMAPI_WIRE_H_ #include "GeomAPI.h" +#include "GeomAPI_Ax3.h" +#include "GeomAPI_Dir.h" #include "GeomAPI_Edge.h" #include "GeomAPI_Pnt.h" -#include "GeomAPI_Dir.h" -#include "GeomAPI_Ax3.h" #include @@ -36,9 +37,8 @@ * * Normally this interface corresponds to the edges of the sketch */ -class GeomAPI_PlanarEdges : public GeomAPI_Shape -{ - public: +class GeomAPI_PlanarEdges : public GeomAPI_Shape { +public: /// Creation of empty (null) shape GEOMAPI_EXPORT GeomAPI_PlanarEdges(); @@ -50,7 +50,7 @@ class GeomAPI_PlanarEdges : public GeomAPI_Shape /// Appends the edge to the set GEOMAPI_EXPORT void addEdge(std::shared_ptr theEdge); /// Returns the list of edges in this interface - GEOMAPI_EXPORT std::list > getEdges(); + GEOMAPI_EXPORT std::list> getEdges(); /// Returns True if the wire is defined in a plane GEOMAPI_EXPORT bool hasPlane() const; @@ -74,18 +74,16 @@ class GeomAPI_PlanarEdges : public GeomAPI_Shape /// \param theOrigin origin of the plane axis /// \param theDirX X direction of the plane axis /// \param theNorm normal direction of the plane axis - GEOMAPI_EXPORT void setPlane(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theNorm); + GEOMAPI_EXPORT void setPlane(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theNorm); /// Returns whether the shapes are equal GEOMAPI_EXPORT virtual bool isEqual(const std::shared_ptr theShape) const; private: - std::shared_ptr myPlane; }; #endif - diff --git a/src/GeomAPI/GeomAPI_Pln.cpp b/src/GeomAPI/GeomAPI_Pln.cpp index b21d4a9bb..c9f2ce3e6 100644 --- a/src/GeomAPI/GeomAPI_Pln.cpp +++ b/src/GeomAPI/GeomAPI_Pln.cpp @@ -14,75 +14,70 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include -#include #include #include +#include +#include #include #include #include -GeomAPI_Pln::GeomAPI_Pln(const std::shared_ptr& theAxis) -: GeomAPI_Interface(new gp_Ax3(theAxis->impl())) -{ -} +GeomAPI_Pln::GeomAPI_Pln(const std::shared_ptr &theAxis) + : GeomAPI_Interface(new gp_Ax3(theAxis->impl())) {} -GeomAPI_Pln::GeomAPI_Pln(const std::shared_ptr& thePoint, - const std::shared_ptr& theNormal) - : GeomAPI_Interface(new gp_Pln(thePoint->impl(), theNormal->impl())) -{ -} +GeomAPI_Pln::GeomAPI_Pln(const std::shared_ptr &thePoint, + const std::shared_ptr &theNormal) + : GeomAPI_Interface( + new gp_Pln(thePoint->impl(), theNormal->impl())) {} -GeomAPI_Pln::GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD) - : GeomAPI_Interface(new gp_Pln(theA, theB, theC, theD)) -{ -} +GeomAPI_Pln::GeomAPI_Pln(const double theA, const double theB, + const double theC, const double theD) + : GeomAPI_Interface(new gp_Pln(theA, theB, theC, theD)) {} -std::shared_ptr GeomAPI_Pln::location() const -{ +std::shared_ptr GeomAPI_Pln::location() const { gp_Pnt aLoc = impl().Location(); - return std::shared_ptr(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); } -std::shared_ptr GeomAPI_Pln::direction() const -{ - const gp_Dir& aDir = impl().Axis().Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +std::shared_ptr GeomAPI_Pln::direction() const { + const gp_Dir &aDir = impl().Axis().Direction(); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } -std::shared_ptr GeomAPI_Pln::xDirection() const -{ - const gp_Dir& aDir = impl().XAxis().Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +std::shared_ptr GeomAPI_Pln::xDirection() const { + const gp_Dir &aDir = impl().XAxis().Direction(); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } -void GeomAPI_Pln::coefficients(double& theA, double& theB, double& theC, double& theD) -{ +void GeomAPI_Pln::coefficients(double &theA, double &theB, double &theC, + double &theD) { impl().Coefficients(theA, theB, theC, theD); } bool GeomAPI_Pln::isCoincident(const std::shared_ptr thePlane, - const double theTolerance) -{ - if(!thePlane.get()) { + const double theTolerance) { + if (!thePlane.get()) { return false; } - const gp_Pln& aMyPln = impl(); - const gp_Pln& anOtherPln = thePlane->impl(); + const gp_Pln &aMyPln = impl(); + const gp_Pln &anOtherPln = thePlane->impl(); return (aMyPln.Contains(anOtherPln.Location(), theTolerance) && - aMyPln.Axis().IsParallel(anOtherPln.Axis(), theTolerance)); + aMyPln.Axis().IsParallel(anOtherPln.Axis(), theTolerance)); } std::shared_ptr - GeomAPI_Pln::intersect(const std::shared_ptr& theLine) const -{ +GeomAPI_Pln::intersect(const std::shared_ptr &theLine) const { std::shared_ptr aLineDir = theLine->direction()->xyz(); std::shared_ptr aLineLoc = theLine->location()->xyz(); @@ -95,12 +90,11 @@ std::shared_ptr double aParam = aNormal->dot(aLocation->decreased(aLineLoc)) / aDot; return std::shared_ptr( - new GeomAPI_Pnt(aLineLoc->added(aLineDir->multiplied(aParam)))); + new GeomAPI_Pnt(aLineLoc->added(aLineDir->multiplied(aParam)))); } std::shared_ptr - GeomAPI_Pln::project(const std::shared_ptr& thePoint) const -{ +GeomAPI_Pln::project(const std::shared_ptr &thePoint) const { std::shared_ptr aNormal = direction()->xyz(); std::shared_ptr aLocation = location()->xyz(); @@ -111,23 +105,23 @@ std::shared_ptr return std::shared_ptr(new GeomAPI_Pnt(aProjection)); } -double GeomAPI_Pln::distance(const std::shared_ptr thePlane) const -{ - const gp_Pln& aMyPln = impl(); - const gp_Pln& anOtherPln = thePlane->impl(); +double +GeomAPI_Pln::distance(const std::shared_ptr thePlane) const { + const gp_Pln &aMyPln = impl(); + const gp_Pln &anOtherPln = thePlane->impl(); return aMyPln.Distance(anOtherPln); } -double GeomAPI_Pln::distance(const std::shared_ptr thePoint) const -{ - const gp_Pln& aMyPln = impl(); - const gp_Pnt& aPnt = thePoint->impl(); +double +GeomAPI_Pln::distance(const std::shared_ptr thePoint) const { + const gp_Pln &aMyPln = impl(); + const gp_Pnt &aPnt = thePoint->impl(); return aMyPln.Distance(aPnt); } -void GeomAPI_Pln::translate(const std::shared_ptr theDir, double theDist) -{ +void GeomAPI_Pln::translate(const std::shared_ptr theDir, + double theDist) { gp_Vec aVec(theDir->impl()); aVec.Normalize(); aVec.Multiply(theDist); @@ -135,24 +129,24 @@ void GeomAPI_Pln::translate(const std::shared_ptr theDir, double th } std::shared_ptr - GeomAPI_Pln::intersect(const std::shared_ptr thePlane) const -{ +GeomAPI_Pln::intersect(const std::shared_ptr thePlane) const { std::shared_ptr aRes; - if(!thePlane.get()) { + if (!thePlane.get()) { return aRes; } - const gp_Pln& aMyPln = impl(); - const gp_Pln& anOtherPln = thePlane->impl(); + const gp_Pln &aMyPln = impl(); + const gp_Pln &anOtherPln = thePlane->impl(); - IntAna_QuadQuadGeo aQuad(aMyPln, anOtherPln, Precision::Confusion(), Precision::Confusion()); + IntAna_QuadQuadGeo aQuad(aMyPln, anOtherPln, Precision::Confusion(), + Precision::Confusion()); - if(aQuad.IsDone() != Standard_True) { + if (aQuad.IsDone() != Standard_True) { return aRes; } - if(aQuad.NbSolutions() != 1) { + if (aQuad.NbSolutions() != 1) { return aRes; } @@ -160,8 +154,10 @@ std::shared_ptr gp_Pnt aLoc = aLin.Location(); gp_Dir aDir = aLin.Direction(); - std::shared_ptr aGeomLoc(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); - std::shared_ptr aGeomDir(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); + std::shared_ptr aGeomLoc( + new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); + std::shared_ptr aGeomDir( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); aRes.reset(new GeomAPI_Lin(aGeomLoc, aGeomDir)); diff --git a/src/GeomAPI/GeomAPI_Pln.h b/src/GeomAPI/GeomAPI_Pln.h index 00dc98976..49e9780da 100644 --- a/src/GeomAPI/GeomAPI_Pln.h +++ b/src/GeomAPI/GeomAPI_Pln.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Pln_H_ #define GeomAPI_Pln_H_ -#include #include +#include class GeomAPI_Ax3; class GeomAPI_Pnt; @@ -33,21 +34,21 @@ class GeomAPI_Lin; * \brief 3D point defined by three coordinates */ -class GeomAPI_Pln : public GeomAPI_Interface -{ - public: +class GeomAPI_Pln : public GeomAPI_Interface { +public: /// Creation of plane by the axis placement GEOMAPI_EXPORT - GeomAPI_Pln(const std::shared_ptr& theAxis); + GeomAPI_Pln(const std::shared_ptr &theAxis); /// Creation of plane by the point and normal GEOMAPI_EXPORT - GeomAPI_Pln(const std::shared_ptr& thePoint, - const std::shared_ptr& theNormal); + GeomAPI_Pln(const std::shared_ptr &thePoint, + const std::shared_ptr &theNormal); /// Creation of plane by coefficients (Ax+By+Cz+D=0) GEOMAPI_EXPORT - GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD); + GeomAPI_Pln(const double theA, const double theB, const double theC, + const double theD); /// Returns a point of this plane GEOMAPI_EXPORT @@ -63,19 +64,22 @@ class GeomAPI_Pln : public GeomAPI_Interface /// Returns the plane coefficients (Ax+By+Cz+D=0) GEOMAPI_EXPORT - void coefficients(double& theA, double& theB, double& theC, double& theD); + void coefficients(double &theA, double &theB, double &theC, double &theD); /// Returns true if planes are coincident. GEOMAPI_EXPORT - bool isCoincident(const std::shared_ptr thePlane, const double theTolerance = 1.e-7); + bool isCoincident(const std::shared_ptr thePlane, + const double theTolerance = 1.e-7); /// Returns intersection point or empty if no intersections GEOMAPI_EXPORT - std::shared_ptr intersect(const std::shared_ptr& theLine) const; + std::shared_ptr + intersect(const std::shared_ptr &theLine) const; /// Returns projection of the given point onto the plane GEOMAPI_EXPORT - std::shared_ptr project(const std::shared_ptr& thePoint) const; + std::shared_ptr + project(const std::shared_ptr &thePoint) const; /// \return distance between planes. GEOMAPI_EXPORT @@ -87,15 +91,16 @@ class GeomAPI_Pln : public GeomAPI_Interface /// Translates the plane along direction theDir on distance theDist GEOMAPI_EXPORT - void translate(const std::shared_ptr theDir, const double theDist); + void translate(const std::shared_ptr theDir, + const double theDist); /// \return intersection line of two planes. Empty if they are parallel. GEOMAPI_EXPORT - std::shared_ptr intersect(const std::shared_ptr thePlane) const; + std::shared_ptr + intersect(const std::shared_ptr thePlane) const; }; //! Pointer on the object typedef std::shared_ptr GeomPlanePtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Pnt.cpp b/src/GeomAPI/GeomAPI_Pnt.cpp index 49efb738f..ef7cb5de4 100644 --- a/src/GeomAPI/GeomAPI_Pnt.cpp +++ b/src/GeomAPI/GeomAPI_Pnt.cpp @@ -14,80 +14,59 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include +#include +#include +#include #define MY_PNT implPtr() -GeomAPI_Pnt::GeomAPI_Pnt(const double theX, const double theY, const double theZ) - : GeomAPI_Interface(new gp_Pnt(theX, theY, theZ)) -{ -} +GeomAPI_Pnt::GeomAPI_Pnt(const double theX, const double theY, + const double theZ) + : GeomAPI_Interface(new gp_Pnt(theX, theY, theZ)) {} -GeomAPI_Pnt::GeomAPI_Pnt(const std::shared_ptr& theCoords) - : GeomAPI_Interface(new gp_Pnt(theCoords->x(), theCoords->y(), theCoords->z())) -{ -} +GeomAPI_Pnt::GeomAPI_Pnt(const std::shared_ptr &theCoords) + : GeomAPI_Interface( + new gp_Pnt(theCoords->x(), theCoords->y(), theCoords->z())) {} -double GeomAPI_Pnt::x() const -{ - return MY_PNT->X(); -} +double GeomAPI_Pnt::x() const { return MY_PNT->X(); } -double GeomAPI_Pnt::y() const -{ - return MY_PNT->Y(); -} +double GeomAPI_Pnt::y() const { return MY_PNT->Y(); } -double GeomAPI_Pnt::z() const -{ - return MY_PNT->Z(); -} +double GeomAPI_Pnt::z() const { return MY_PNT->Z(); } -void GeomAPI_Pnt::setX(const double theX) -{ - return MY_PNT->SetX(theX); -} +void GeomAPI_Pnt::setX(const double theX) { return MY_PNT->SetX(theX); } -void GeomAPI_Pnt::setY(const double theY) -{ - return MY_PNT->SetY(theY); -} +void GeomAPI_Pnt::setY(const double theY) { return MY_PNT->SetY(theY); } -void GeomAPI_Pnt::setZ(const double theZ) -{ - return MY_PNT->SetZ(theZ); -} +void GeomAPI_Pnt::setZ(const double theZ) { return MY_PNT->SetZ(theZ); } -const std::shared_ptr GeomAPI_Pnt::xyz() -{ - return std::shared_ptr(new GeomAPI_XYZ(MY_PNT->X(), MY_PNT->Y(), MY_PNT->Z())); +const std::shared_ptr GeomAPI_Pnt::xyz() { + return std::shared_ptr( + new GeomAPI_XYZ(MY_PNT->X(), MY_PNT->Y(), MY_PNT->Z())); } -double GeomAPI_Pnt::distance(const std::shared_ptr& theOther) const -{ +double +GeomAPI_Pnt::distance(const std::shared_ptr &theOther) const { return MY_PNT->Distance(theOther->impl()); } -bool GeomAPI_Pnt::isEqual(const std::shared_ptr& theOther) const -{ +bool GeomAPI_Pnt::isEqual(const std::shared_ptr &theOther) const { return distance(theOther) < Precision::Confusion(); } -bool GeomAPI_Pnt::isLess(const std::shared_ptr& theOther, - const double theTolerance) const -{ +bool GeomAPI_Pnt::isLess(const std::shared_ptr &theOther, + const double theTolerance) const { if (MY_PNT->X() + theTolerance < theOther->x()) return true; else if (MY_PNT->X() < theOther->x() + theTolerance) { @@ -100,28 +79,30 @@ bool GeomAPI_Pnt::isLess(const std::shared_ptr& theOther, return false; } -std::shared_ptr GeomAPI_Pnt::to2D(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, const std::shared_ptr& theDirY) -{ +std::shared_ptr +GeomAPI_Pnt::to2D(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY) { gp_Pnt anOriginPnt(theOrigin->x(), theOrigin->y(), theOrigin->z()); gp_Vec aVec(anOriginPnt, impl()); - double aX = aVec.X() * theDirX->x() + aVec.Y() * theDirX->y() + aVec.Z() * theDirX->z(); - double aY = aVec.X() * theDirY->x() + aVec.Y() * theDirY->y() + aVec.Z() * theDirY->z(); + double aX = aVec.X() * theDirX->x() + aVec.Y() * theDirX->y() + + aVec.Z() * theDirX->z(); + double aY = aVec.X() * theDirY->x() + aVec.Y() * theDirY->y() + + aVec.Z() * theDirY->z(); return std::shared_ptr(new GeomAPI_Pnt2d(aX, aY)); } - -void GeomAPI_Pnt::translate(const std::shared_ptr& theDir, double theDist) -{ +void GeomAPI_Pnt::translate(const std::shared_ptr &theDir, + double theDist) { gp_Vec aVec(theDir->impl()); aVec.Normalize(); aVec.Multiply(theDist); MY_PNT->Translate(aVec); } -std::shared_ptr GeomAPI_Pnt::to2D(const std::shared_ptr& thePln) const -{ +std::shared_ptr +GeomAPI_Pnt::to2D(const std::shared_ptr &thePln) const { double aA, aB, aC, aD; thePln->coefficients(aA, aB, aC, aD); gp_Pln aPln(aA, aB, aC, aD); @@ -130,7 +111,7 @@ std::shared_ptr GeomAPI_Pnt::to2D(const std::shared_ptr(new GeomAPI_Pnt2d(aRes.X(), aRes.Y())); } -void GeomAPI_Pnt::rotate(const std::shared_ptr& theAxis, const double theAngle) -{ +void GeomAPI_Pnt::rotate(const std::shared_ptr &theAxis, + const double theAngle) { MY_PNT->Rotate(theAxis->impl(), theAngle / 180.0 * M_PI); } diff --git a/src/GeomAPI/GeomAPI_Pnt.h b/src/GeomAPI/GeomAPI_Pnt.h index 9e2b72435..82470ed04 100644 --- a/src/GeomAPI/GeomAPI_Pnt.h +++ b/src/GeomAPI/GeomAPI_Pnt.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Pnt_H_ @@ -34,15 +35,14 @@ class GeomAPI_Pln; * \brief 3D point defined by three coordinates */ -class GeomAPI_Pnt : public GeomAPI_Interface -{ - public: +class GeomAPI_Pnt : public GeomAPI_Interface { +public: /// Creation of point by coordinates GEOMAPI_EXPORT GeomAPI_Pnt(const double theX, const double theY, const double theZ); /// Creation of point by coordinates GEOMAPI_EXPORT - GeomAPI_Pnt(const std::shared_ptr& theCoords); + GeomAPI_Pnt(const std::shared_ptr &theCoords); /// returns X coordinate GEOMAPI_EXPORT @@ -70,36 +70,42 @@ class GeomAPI_Pnt : public GeomAPI_Interface /// Distance between two points GEOMAPI_EXPORT - double distance(const std::shared_ptr& theOther) const; + double distance(const std::shared_ptr &theOther) const; - /// Returns whether the distance between two points is less then precision confusion + /// Returns whether the distance between two points is less then precision + /// confusion GEOMAPI_EXPORT - bool isEqual(const std::shared_ptr& theOther) const; + bool isEqual(const std::shared_ptr &theOther) const; /// Returns \c true, if the current point is less than theOther. /// The point is less than other, if X coordinate is less. /// In case of X's are equal, if Y is less than other. /// If Y's are equal too, compare Z's. GEOMAPI_EXPORT - bool isLess(const std::shared_ptr& theOther, + bool isLess(const std::shared_ptr &theOther, const double theTolerance = 1.e-7) const; - /// Projects a point to the plane defined by the origin and 2 axes vectors in this plane + /// Projects a point to the plane defined by the origin and 2 axes vectors in + /// this plane GEOMAPI_EXPORT - std::shared_ptr to2D(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY); + std::shared_ptr + to2D(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY); - /// Projects a point to the plane defined by the origin and 2 axes vectors in this plane + /// Projects a point to the plane defined by the origin and 2 axes vectors in + /// this plane GEOMAPI_EXPORT - std::shared_ptr to2D(const std::shared_ptr& thePln) const; + std::shared_ptr + to2D(const std::shared_ptr &thePln) const; /// Translates the point along direction theDir on distance theDist GEOMAPI_EXPORT - void translate(const std::shared_ptr& theDir, double theDist); + void translate(const std::shared_ptr &theDir, double theDist); /// Rotates the point along axis for the given angle (in degrees) - GEOMAPI_EXPORT void rotate(const std::shared_ptr& theAxis, double theAngle); + GEOMAPI_EXPORT void rotate(const std::shared_ptr &theAxis, + double theAngle); }; //! Pointer on the object diff --git a/src/GeomAPI/GeomAPI_Pnt2d.cpp b/src/GeomAPI/GeomAPI_Pnt2d.cpp index 45d7fddd1..acdf24c3e 100644 --- a/src/GeomAPI/GeomAPI_Pnt2d.cpp +++ b/src/GeomAPI/GeomAPI_Pnt2d.cpp @@ -14,72 +14,59 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include +#include #include #define MY_PNT2D implPtr() GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY) - : GeomAPI_Interface(new gp_Pnt2d(theX, theY)) -{ -} + : GeomAPI_Interface(new gp_Pnt2d(theX, theY)) {} -GeomAPI_Pnt2d::GeomAPI_Pnt2d(const std::shared_ptr& theCoords) - : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y())) -{ -} +GeomAPI_Pnt2d::GeomAPI_Pnt2d(const std::shared_ptr &theCoords) + : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y())) {} -double GeomAPI_Pnt2d::x() const -{ - return MY_PNT2D->X(); -} +double GeomAPI_Pnt2d::x() const { return MY_PNT2D->X(); } -double GeomAPI_Pnt2d::y() const -{ - return MY_PNT2D->Y(); -} +double GeomAPI_Pnt2d::y() const { return MY_PNT2D->Y(); } -void GeomAPI_Pnt2d::setX(const double theX) -{ - return MY_PNT2D->SetX(theX); -} +void GeomAPI_Pnt2d::setX(const double theX) { return MY_PNT2D->SetX(theX); } -void GeomAPI_Pnt2d::setY(const double theY) -{ - return MY_PNT2D->SetY(theY); -} +void GeomAPI_Pnt2d::setY(const double theY) { return MY_PNT2D->SetY(theY); } -std::shared_ptr GeomAPI_Pnt2d::to3D(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY) -{ - std::shared_ptr aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x())) - ->added(theDirY->xyz()->multiplied(y())); +std::shared_ptr +GeomAPI_Pnt2d::to3D(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY) { + std::shared_ptr aSum = + theOrigin->xyz() + ->added(theDirX->xyz()->multiplied(x())) + ->added(theDirY->xyz()->multiplied(y())); return std::shared_ptr(new GeomAPI_Pnt(aSum)); } -const std::shared_ptr GeomAPI_Pnt2d::xy() -{ - return std::shared_ptr(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y())); +const std::shared_ptr GeomAPI_Pnt2d::xy() { + return std::shared_ptr( + new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y())); } -double GeomAPI_Pnt2d::distance(const std::shared_ptr& theOther) const -{ +double +GeomAPI_Pnt2d::distance(const std::shared_ptr &theOther) const { return MY_PNT2D->Distance(theOther->impl()); } -bool GeomAPI_Pnt2d::isEqual(const std::shared_ptr& theOther) const -{ +bool GeomAPI_Pnt2d::isEqual( + const std::shared_ptr &theOther) const { return distance(theOther) < Precision::Confusion(); } diff --git a/src/GeomAPI/GeomAPI_Pnt2d.h b/src/GeomAPI/GeomAPI_Pnt2d.h index 0de764837..d001a0ea9 100644 --- a/src/GeomAPI/GeomAPI_Pnt2d.h +++ b/src/GeomAPI/GeomAPI_Pnt2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Pnt2d_H_ @@ -32,15 +33,14 @@ class GeomAPI_Dir; * \brief 2D point defined by two coordinates */ -class GeomAPI_Pnt2d : public GeomAPI_Interface -{ - public: +class GeomAPI_Pnt2d : public GeomAPI_Interface { +public: /// Creation of point by coordinates GEOMAPI_EXPORT GeomAPI_Pnt2d(const double theX, const double theY); /// Creation of point by coordinates GEOMAPI_EXPORT - GeomAPI_Pnt2d(const std::shared_ptr& theCoords); + GeomAPI_Pnt2d(const std::shared_ptr &theCoords); /// returns X coordinate GEOMAPI_EXPORT @@ -58,9 +58,10 @@ class GeomAPI_Pnt2d : public GeomAPI_Interface /// Returns the 3D point GEOMAPI_EXPORT - std::shared_ptr to3D(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY); + std::shared_ptr + to3D(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY); /// returns coordinates of the point GEOMAPI_EXPORT @@ -68,15 +69,15 @@ class GeomAPI_Pnt2d : public GeomAPI_Interface /// Distance between two points GEOMAPI_EXPORT - double distance(const std::shared_ptr& theOther) const; + double distance(const std::shared_ptr &theOther) const; - /// Returns whether the distance between two points is less then precision confusion + /// Returns whether the distance between two points is less then precision + /// confusion GEOMAPI_EXPORT - bool isEqual(const std::shared_ptr& theOther) const; + bool isEqual(const std::shared_ptr &theOther) const; }; //! Pointer on the object typedef std::shared_ptr GeomPnt2dPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index 5fe8500d0..087f65bc7 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -14,28 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Shape.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 @@ -46,43 +48,37 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include #include -#include #include // for std::transform +#include #include #define MY_SHAPE implPtr() -GeomAPI_Shape::GeomAPI_Shape() - : GeomAPI_Interface(new TopoDS_Shape()) -{ -} +GeomAPI_Shape::GeomAPI_Shape() : GeomAPI_Interface(new TopoDS_Shape()) {} -std::shared_ptr GeomAPI_Shape::emptyCopied() const -{ +std::shared_ptr GeomAPI_Shape::emptyCopied() const { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(MY_SHAPE->EmptyCopied())); return aShape; } -bool GeomAPI_Shape::isNull() const -{ +bool GeomAPI_Shape::isNull() const { return MY_SHAPE->IsNull() == Standard_True; } -bool GeomAPI_Shape::isEqual(const std::shared_ptr theShape) const -{ +bool GeomAPI_Shape::isEqual( + const std::shared_ptr theShape) const { if (!theShape.get()) return false; if (isNull()) @@ -93,9 +89,10 @@ bool GeomAPI_Shape::isEqual(const std::shared_ptr theShape) const return MY_SHAPE->IsEqual(theShape->impl()) == Standard_True; } -bool GeomAPI_Shape::isSame(const std::shared_ptr theShape) const -{ - bool isNullShape = !theShape.get() || theShape->isNull();; +bool GeomAPI_Shape::isSame( + const std::shared_ptr theShape) const { + bool isNullShape = !theShape.get() || theShape->isNull(); + ; if (isNull()) return isNullShape; if (isNullShape) @@ -104,8 +101,8 @@ bool GeomAPI_Shape::isSame(const std::shared_ptr theShape) const return MY_SHAPE->IsSame(theShape->impl()) == Standard_True; } -bool GeomAPI_Shape::isSameGeometry(const std::shared_ptr theShape) const -{ +bool GeomAPI_Shape::isSameGeometry( + const std::shared_ptr theShape) const { if (isFace()) return face()->isSameGeometry(theShape); else if (isEdge()) @@ -113,45 +110,45 @@ bool GeomAPI_Shape::isSameGeometry(const std::shared_ptr theShape return false; } -bool GeomAPI_Shape::isVertex() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isVertex() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX; } -bool GeomAPI_Shape::isEdge() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isEdge() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE; } -bool GeomAPI_Shape::isWire() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isWire() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_WIRE; } -bool GeomAPI_Shape::isFace() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isFace() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_FACE; } -bool GeomAPI_Shape::isShell() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isShell() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SHELL; } -bool GeomAPI_Shape::isCompound() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isCompound() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND; } -bool GeomAPI_Shape::isCollectionOfSolids() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isCollectionOfSolids() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull()) return false; @@ -167,21 +164,20 @@ bool GeomAPI_Shape::isCollectionOfSolids() const BOPTools_AlgoTools::TreatCompound(aShape, aLS, &aMFence); TopTools_ListOfShape::Iterator it(aLS); for (; it.More(); it.Next()) { - const TopoDS_Shape& aSx = it.Value(); - if (aSx.ShapeType() != TopAbs_SOLID && - aSx.ShapeType() != TopAbs_COMPSOLID) + const TopoDS_Shape &aSx = it.Value(); + if (aSx.ShapeType() != TopAbs_SOLID && aSx.ShapeType() != TopAbs_COMPSOLID) return false; } return true; } -bool GeomAPI_Shape::isCompoundOfSolids() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isCompoundOfSolids() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return false; bool isAtLeastOne = false; - for(TopoDS_Iterator aSubs(aShape); aSubs.More(); aSubs.Next()) { + for (TopoDS_Iterator aSubs(aShape); aSubs.More(); aSubs.Next()) { if (aSubs.Value().IsNull() || aSubs.Value().ShapeType() != TopAbs_SOLID) return false; isAtLeastOne = true; @@ -190,13 +186,13 @@ bool GeomAPI_Shape::isCompoundOfSolids() const } // LCOV_EXCL_START -GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return SHAPE; int aType = -1; - for(TopoDS_Iterator aSubs(aShape); aSubs.More(); aSubs.Next()) { + for (TopoDS_Iterator aSubs(aShape); aSubs.More(); aSubs.Next()) { if (!aSubs.Value().IsNull()) { if (aType == -1) aType = aSubs.Value().ShapeType(); @@ -204,16 +200,16 @@ GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const return SHAPE; } } - return (GeomAPI_Shape::ShapeType) aType; + return (GeomAPI_Shape::ShapeType)aType; } // LCOV_EXCL_STOP // adds the nopt-compound elements recursively to the list -static void addSimpleToList(const TopoDS_Shape& theShape, NCollection_List& theList) -{ +static void addSimpleToList(const TopoDS_Shape &theShape, + NCollection_List &theList) { if (!theShape.IsNull()) { if (theShape.ShapeType() == TopAbs_COMPOUND) { - for(TopoDS_Iterator aSubs(theShape); aSubs.More(); aSubs.Next()) { + for (TopoDS_Iterator aSubs(theShape); aSubs.More(); aSubs.Next()) { addSimpleToList(aSubs.Value(), theList); } } else { @@ -222,9 +218,9 @@ static void addSimpleToList(const TopoDS_Shape& theShape, NCollection_List(this)->impl(); +bool GeomAPI_Shape::isConnectedTopology() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return false; // list of simple elements that are not detected in connection to others @@ -238,25 +234,27 @@ bool GeomAPI_Shape::isConnectedTopology() const aNewConnected.Append(aNotConnected.First()); aNotConnected.RemoveFirst(); // iterate until some new element become connected - while(!aNewConnected.IsEmpty() && !aNotConnected.IsEmpty()) { + while (!aNewConnected.IsEmpty() && !aNotConnected.IsEmpty()) { NCollection_List aNew; // very new connected to new connected NCollection_List::Iterator aNotIter(aNotConnected); - while(aNotIter.More()) { - // optimization to avoid TopExp_Explorer double-cycle, collect all vertices in the list first + while (aNotIter.More()) { + // optimization to avoid TopExp_Explorer double-cycle, collect all + // vertices in the list first NCollection_List aNotVertices; - for(TopExp_Explorer anExp1(aNotIter.Value(), TopAbs_VERTEX); anExp1.More(); anExp1.Next()) { + for (TopExp_Explorer anExp1(aNotIter.Value(), TopAbs_VERTEX); + anExp1.More(); anExp1.Next()) { aNotVertices.Append(anExp1.Current()); } - bool aConnected = false; + bool aConnected = false; NCollection_List::Iterator aNewIter(aNewConnected); - for(; !aConnected && aNewIter.More(); aNewIter.Next()) { + for (; !aConnected && aNewIter.More(); aNewIter.Next()) { // checking topological connecion of aNotIter and aNewIter // (if shapes are connected, vertices are connected for sure) TopExp_Explorer anExp2(aNewIter.Value(), TopAbs_VERTEX); - for(; !aConnected && anExp2.More(); anExp2.Next()) { + for (; !aConnected && anExp2.More(); anExp2.Next()) { NCollection_List::Iterator aNotVIter(aNotVertices); - for(; aNotVIter.More(); aNotVIter.Next()) { + for (; aNotVIter.More(); aNotVIter.Next()) { if (aNotVIter.Value().IsSame(anExp2.Current())) { aConnected = true; break; @@ -278,45 +276,45 @@ bool GeomAPI_Shape::isConnectedTopology() const return aNotConnected.IsEmpty() == Standard_True; } -bool GeomAPI_Shape::isSolid() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isSolid() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SOLID; } -bool GeomAPI_Shape::isCompSolid() const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::isCompSolid() const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPSOLID; } -bool GeomAPI_Shape::isPlanar() const -{ +bool GeomAPI_Shape::isPlanar() const { TopoDS_Shape aShape = impl(); - if(aShape.IsNull()) { + if (aShape.IsNull()) { return false; } TopAbs_ShapeEnum aShapeType = aShape.ShapeType(); - if(aShapeType == TopAbs_COMPOUND) { + if (aShapeType == TopAbs_COMPOUND) { TopoDS_Iterator anIt(aShape); int aShNum = 0; - for(; anIt.More(); anIt.Next()) { + for (; anIt.More(); anIt.Next()) { ++aShNum; } - if(aShNum == 1) { + if (aShNum == 1) { anIt.Initialize(aShape); aShape = anIt.Value(); } } aShapeType = aShape.ShapeType(); - if(aShapeType == TopAbs_VERTEX) { + if (aShapeType == TopAbs_VERTEX) { return true; - } else if(aShapeType == TopAbs_FACE) { + } else if (aShapeType == TopAbs_FACE) { Handle(Geom_Surface) aSurface = BRep_Tool::Surface(TopoDS::Face(aShape)); - if(aSurface->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { + if (aSurface->DynamicType() == + STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { Handle(Geom_RectangularTrimmedSurface) aTrimSurface = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); aSurface = aTrimSurface->BasisSurface(); @@ -326,49 +324,50 @@ bool GeomAPI_Shape::isPlanar() const BRepBuilderAPI_FindPlane aFindPlane(aShape); bool isFound = aFindPlane.Found() == Standard_True; - if(!isFound) { + if (!isFound) { - auto checkEdge = [](const TopoDS_Shape& theShape){ - if(theShape.ShapeType()!= TopAbs_EDGE) + auto checkEdge = [](const TopoDS_Shape &theShape) { + if (theShape.ShapeType() != TopAbs_EDGE) return false; Standard_Real aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(theShape), aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve(TopoDS::Edge(theShape), aFirst, aLast); Handle(Standard_Type) aType = aCurve->DynamicType(); - if(aType == STANDARD_TYPE(Geom_TrimmedCurve)) { - Handle(Geom_TrimmedCurve) aTrimCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve); + if (aType == STANDARD_TYPE(Geom_TrimmedCurve)) { + Handle(Geom_TrimmedCurve) aTrimCurve = + Handle(Geom_TrimmedCurve)::DownCast(aCurve); aType = aTrimCurve->BasisCurve()->DynamicType(); } - if(aType == STANDARD_TYPE(Geom_Line) - || aType == STANDARD_TYPE(Geom_Conic) - || aType == STANDARD_TYPE(Geom_Circle) - || aType == STANDARD_TYPE(Geom_Ellipse) - || aType == STANDARD_TYPE(Geom_Hyperbola) - || aType == STANDARD_TYPE(Geom_Parabola)) { + if (aType == STANDARD_TYPE(Geom_Line) || + aType == STANDARD_TYPE(Geom_Conic) || + aType == STANDARD_TYPE(Geom_Circle) || + aType == STANDARD_TYPE(Geom_Ellipse) || + aType == STANDARD_TYPE(Geom_Hyperbola) || + aType == STANDARD_TYPE(Geom_Parabola)) { return true; } return false; }; - if(aShapeType == TopAbs_WIRE){ - //check if wire consist of only one edge + if (aShapeType == TopAbs_WIRE) { + // check if wire consist of only one edge int aNbEdges = 0; TopExp_Explorer anExp(aShape, TopAbs_EDGE); - for (TopExp_Explorer anExp(aShape, TopAbs_EDGE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aShape, TopAbs_EDGE); anExp.More(); + anExp.Next()) { aNbEdges++; - if(aNbEdges == 1){ - const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current()); + if (aNbEdges == 1) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExp.Current()); isFound = checkEdge(anEdge); - } - else{ - //if more than one edge, check is not valid + } else { + // if more than one edge, check is not valid isFound = false; break; } } - } - else if(aShapeType == TopAbs_EDGE){ + } else if (aShapeType == TopAbs_EDGE) { isFound = checkEdge(aShape); } } @@ -379,77 +378,77 @@ bool GeomAPI_Shape::isPlanar() const return false; } -std::shared_ptr GeomAPI_Shape::vertex() const -{ +std::shared_ptr GeomAPI_Shape::vertex() const { GeomVertexPtr aVertex; if (isVertex()) { - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); aVertex = GeomVertexPtr(new GeomAPI_Vertex); aVertex->setImpl(new TopoDS_Shape(aShape)); } return aVertex; } -std::shared_ptr GeomAPI_Shape::edge() const -{ +std::shared_ptr GeomAPI_Shape::edge() const { GeomEdgePtr anEdge; if (isEdge()) { - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); anEdge = GeomEdgePtr(new GeomAPI_Edge); anEdge->setImpl(new TopoDS_Shape(aShape)); } return anEdge; } -std::shared_ptr GeomAPI_Shape::wire() const -{ +std::shared_ptr GeomAPI_Shape::wire() const { GeomWirePtr aWire; if (isWire()) { - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); aWire = GeomWirePtr(new GeomAPI_Wire); aWire->setImpl(new TopoDS_Shape(aShape)); } return aWire; } -std::shared_ptr GeomAPI_Shape::face() const -{ +std::shared_ptr GeomAPI_Shape::face() const { GeomFacePtr aFace; if (isFace()) { - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); aFace = GeomFacePtr(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(aShape)); } return aFace; } -std::shared_ptr GeomAPI_Shape::shell() const -{ +std::shared_ptr GeomAPI_Shape::shell() const { GeomShellPtr aShell; if (isShell()) { - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); aShell = GeomShellPtr(new GeomAPI_Shell); aShell->setImpl(new TopoDS_Shape(aShape)); } return aShell; } -std::shared_ptr GeomAPI_Shape::solid() const -{ +std::shared_ptr GeomAPI_Shape::solid() const { GeomSolidPtr aSolid; if (isSolid()) { - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); aSolid = GeomSolidPtr(new GeomAPI_Solid); aSolid->setImpl(new TopoDS_Shape(aShape)); } return aSolid; } -std::list > -GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, const bool theOnlyUnique) const -{ +std::list> +GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, + const bool theOnlyUnique) const { ListOfShape aSubs; - const TopoDS_Shape& aShape = impl(); + const TopoDS_Shape &aShape = impl(); if (aShape.IsNull()) return aSubs; @@ -458,7 +457,7 @@ GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, const bool theOnlyUniq // process multi-level compounds if (shapeType() == COMPOUND && theSubShapeType == COMPOUND) { for (TopoDS_Iterator anIt(aShape); anIt.More(); anIt.Next()) { - const TopoDS_Shape& aCurrent = anIt.Value(); + const TopoDS_Shape &aCurrent = anIt.Value(); if (aCurrent.ShapeType() == TopAbs_COMPOUND) { if (!theOnlyUnique || alreadyThere.Add(aCurrent)) { GeomShapePtr aSub(new GeomAPI_Shape); @@ -471,8 +470,7 @@ GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, const bool theOnlyUniq GeomShapePtr aSub(new GeomAPI_Shape); aSub->setImpl(new TopoDS_Shape(aShape)); aSubs.push_back(aSub); - } - else { + } else { for (TopExp_Explorer anExp(aShape, (TopAbs_ShapeEnum)theSubShapeType); anExp.More(); anExp.Next()) { if (!theOnlyUnique || alreadyThere.Add(anExp.Current())) { @@ -485,15 +483,14 @@ GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, const bool theOnlyUniq return aSubs; } -GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeType() const -{ - const TopoDS_Shape& aShape = impl(); +GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeType() const { + const TopoDS_Shape &aShape = impl(); if (aShape.IsNull()) return GeomAPI_Shape::SHAPE; ShapeType aST = GeomAPI_Shape::SHAPE; - switch(aShape.ShapeType()) { + switch (aShape.ShapeType()) { case TopAbs_COMPOUND: aST = GeomAPI_Shape::COMPOUND; break; @@ -526,8 +523,7 @@ GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeType() const return aST; } -GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeTypeByStr(std::string theType) -{ +GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeTypeByStr(std::string theType) { std::transform(theType.begin(), theType.end(), theType.begin(), [](char c) { return static_cast(::toupper(c)); }); if (theType == "COMPOUND" || theType == "COMPOUNDS") @@ -549,96 +545,104 @@ GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeTypeByStr(std::string theType) return SHAPE; // default } -std::string GeomAPI_Shape::shapeTypeStr() const -{ +std::string GeomAPI_Shape::shapeTypeStr() const { ShapeType aShapeType = shapeType(); std::string aShapeTypeStr; - switch(aShapeType) { - case COMPOUND: { - aShapeTypeStr = "COMPOUND"; - break; - } - case COMPSOLID: { - aShapeTypeStr = "COMPSOLID"; - break; - } - case SOLID: { - aShapeTypeStr = "SOLID"; - break; - } - case SHELL: { - aShapeTypeStr = "SHELL"; - break; - } - case FACE: { - aShapeTypeStr = "FACE"; - break; - } - case WIRE: { - aShapeTypeStr = "WIRE"; - break; - } - case EDGE: { - aShapeTypeStr = "EDGE"; - break; - } - case VERTEX: { - aShapeTypeStr = "VERTEX"; - break; - } - case SHAPE: { - aShapeTypeStr = "SHAPE"; - break; - } + switch (aShapeType) { + case COMPOUND: { + aShapeTypeStr = "COMPOUND"; + break; + } + case COMPSOLID: { + aShapeTypeStr = "COMPSOLID"; + break; + } + case SOLID: { + aShapeTypeStr = "SOLID"; + break; + } + case SHELL: { + aShapeTypeStr = "SHELL"; + break; + } + case FACE: { + aShapeTypeStr = "FACE"; + break; + } + case WIRE: { + aShapeTypeStr = "WIRE"; + break; + } + case EDGE: { + aShapeTypeStr = "EDGE"; + break; + } + case VERTEX: { + aShapeTypeStr = "VERTEX"; + break; + } + case SHAPE: { + aShapeTypeStr = "SHAPE"; + break; + } } return aShapeTypeStr; } -GeomAPI_Shape::Orientation GeomAPI_Shape::orientation() const -{ +GeomAPI_Shape::Orientation GeomAPI_Shape::orientation() const { TopAbs_Orientation anOrientation = MY_SHAPE->Orientation(); - switch(anOrientation) { - case TopAbs_FORWARD: return FORWARD; - case TopAbs_REVERSED: return REVERSED; - case TopAbs_INTERNAL: return INTERNAL; - case TopAbs_EXTERNAL: return EXTERNAL; - default: return FORWARD; - } -} - -void GeomAPI_Shape::setOrientation(const GeomAPI_Shape::Orientation theOrientation) -{ - switch(theOrientation) { - case FORWARD: MY_SHAPE->Orientation(TopAbs_FORWARD); break; - case REVERSED: MY_SHAPE->Orientation(TopAbs_REVERSED); break; - case INTERNAL: MY_SHAPE->Orientation(TopAbs_INTERNAL); break; - case EXTERNAL: MY_SHAPE->Orientation(TopAbs_EXTERNAL); break; + switch (anOrientation) { + case TopAbs_FORWARD: + return FORWARD; + case TopAbs_REVERSED: + return REVERSED; + case TopAbs_INTERNAL: + return INTERNAL; + case TopAbs_EXTERNAL: + return EXTERNAL; + default: + return FORWARD; + } +} + +void GeomAPI_Shape::setOrientation( + const GeomAPI_Shape::Orientation theOrientation) { + switch (theOrientation) { + case FORWARD: + MY_SHAPE->Orientation(TopAbs_FORWARD); + break; + case REVERSED: + MY_SHAPE->Orientation(TopAbs_REVERSED); + break; + case INTERNAL: + MY_SHAPE->Orientation(TopAbs_INTERNAL); + break; + case EXTERNAL: + MY_SHAPE->Orientation(TopAbs_EXTERNAL); + break; } } -void GeomAPI_Shape::reverse() -{ - MY_SHAPE->Reverse(); -} +void GeomAPI_Shape::reverse() { MY_SHAPE->Reverse(); } bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape, - const bool theCheckOrientation) const -{ - if(!theShape.get()) { + const bool theCheckOrientation) const { + if (!theShape.get()) { return false; } - const TopoDS_Shape& aShapeToSearch = theShape->impl(); - if(aShapeToSearch.IsNull()) { + const TopoDS_Shape &aShapeToSearch = theShape->impl(); + if (aShapeToSearch.IsNull()) { return false; } - for(TopExp_Explorer anExp(*MY_SHAPE, aShapeToSearch.ShapeType()); anExp.More(); anExp.Next()) { - if(theCheckOrientation ? - aShapeToSearch.IsEqual(anExp.Current()) : aShapeToSearch.IsSame(anExp.Current())) { + for (TopExp_Explorer anExp(*MY_SHAPE, aShapeToSearch.ShapeType()); + anExp.More(); anExp.Next()) { + if (theCheckOrientation ? aShapeToSearch.IsEqual(anExp.Current()) + : aShapeToSearch.IsSame(anExp.Current())) { return true; } } @@ -646,15 +650,17 @@ bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape, return false; } -bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmin, - double& theXmax, double& theYmax, double& theZmax) const -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +bool GeomAPI_Shape::computeSize(double &theXmin, double &theYmin, + double &theZmin, double &theXmax, + double &theYmax, double &theZmax) const { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (aShape.IsNull()) return false; Bnd_Box aBndBox; - // Workaround: compute optimal bounding box for the compounds of edges/vertices, because sometimes - // the bounding box of sketch is calculated if the transformation is applied twice (issue #20167). + // Workaround: compute optimal bounding box for the compounds of + // edges/vertices, because sometimes the bounding box of sketch is calculated + // if the transformation is applied twice (issue #20167). bool isShape1D = false; if (aShape.ShapeType() == TopAbs_COMPOUND) { isShape1D = true; @@ -672,8 +678,7 @@ bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmi return true; } -GeomPointPtr GeomAPI_Shape::middlePoint() const -{ +GeomPointPtr GeomAPI_Shape::middlePoint() const { GeomPointPtr aMiddlePoint; switch (shapeType()) { @@ -696,28 +701,29 @@ GeomPointPtr GeomAPI_Shape::middlePoint() const aMiddlePoint = solid()->middlePoint(); break; default: { - // get middle point as center of the bounding box - double aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ; - computeSize(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ); - aMiddlePoint = GeomPointPtr(new GeomAPI_Pnt( - (aMinX + aMaxX) * 0.5, (aMinY + aMaxY) * 0.5, (aMinZ + aMaxZ) * 0.5)); - } + // get middle point as center of the bounding box + double aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ; + computeSize(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ); + aMiddlePoint = GeomPointPtr(new GeomAPI_Pnt( + (aMinX + aMaxX) * 0.5, (aMinY + aMaxY) * 0.5, (aMinZ + aMaxZ) * 0.5)); + } } return aMiddlePoint; } // LCOV_EXCL_START -std::string GeomAPI_Shape::getShapeStream(const bool theWithTriangulation) const -{ +std::string +GeomAPI_Shape::getShapeStream(const bool theWithTriangulation) const { std::ostringstream aStream; - const TopoDS_Shape& aShape = const_cast(this)->impl(); + const TopoDS_Shape &aShape = + const_cast(this)->impl(); if (!theWithTriangulation) { // make a copy of shape without triangulation BRepBuilderAPI_Copy aCopy(aShape, Standard_False, Standard_False); - const TopoDS_Shape& aCopyShape = aCopy.Shape(); + const TopoDS_Shape &aCopyShape = aCopy.Shape(); // make all faces unchecked to make the stream of shapes the same TopExp_Explorer aFaceExp(aCopyShape, TopAbs_FACE); - for(; aFaceExp.More(); aFaceExp.Next()) { + for (; aFaceExp.More(); aFaceExp.Next()) { aFaceExp.Current().TShape()->Checked(Standard_False); } BRepTools::Write(aCopyShape, aStream); @@ -728,10 +734,10 @@ std::string GeomAPI_Shape::getShapeStream(const bool theWithTriangulation) const } // LCOV_EXCL_STOP -GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const -{ - const TopoDS_Shape& aShape1 = const_cast(this)->impl(); - const TopoDS_Shape& aShape2 = theShape->impl(); +GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const { + const TopoDS_Shape &aShape1 = + const_cast(this)->impl(); + const TopoDS_Shape &aShape2 = theShape->impl(); BRepAlgoAPI_Section aCommon(aShape1, aShape2); if (!aCommon.IsDone()) @@ -741,9 +747,9 @@ GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const if (aResult.ShapeType() == TopAbs_COMPOUND) { NCollection_List aSubs; addSimpleToList(aResult, aSubs); - if(aSubs.Size() == 1) { + if (aSubs.Size() == 1) { aResult = aSubs.First(); - } else if(aSubs.Size() == 0) { + } else if (aSubs.Size() == 0) { return GeomShapePtr(); } } @@ -753,26 +759,26 @@ GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const return aResShape; } -bool GeomAPI_Shape::isIntersect(const GeomShapePtr theShape) const -{ - if(!theShape.get()) { +bool GeomAPI_Shape::isIntersect(const GeomShapePtr theShape) const { + if (!theShape.get()) { return false; } - const TopoDS_Shape& aShape1 = const_cast(this)->impl(); - const TopoDS_Shape& aShape2 = theShape->impl(); + const TopoDS_Shape &aShape1 = + const_cast(this)->impl(); + const TopoDS_Shape &aShape2 = theShape->impl(); BRepExtrema_DistShapeShape aDist(aShape1, aShape2); aDist.Perform(); - if(aDist.IsDone() && aDist.Value() < Precision::Confusion()) { + if (aDist.IsDone() && aDist.Value() < Precision::Confusion()) { return true; } return false; } -void GeomAPI_Shape::translate(const std::shared_ptr theDir, const double theOffset) -{ +void GeomAPI_Shape::translate(const std::shared_ptr theDir, + const double theOffset) { gp_Dir aDir = theDir->impl(); gp_Vec aTrsfVec(aDir.XYZ() * theOffset); gp_Trsf aTranslation; @@ -781,18 +787,18 @@ void GeomAPI_Shape::translate(const std::shared_ptr theDir, const d setImpl(new TopoDS_Shape(aResult)); } -void GeomAPI_Shape::move(const std::shared_ptr theTransformation) -{ +void GeomAPI_Shape::move( + const std::shared_ptr theTransformation) { TopoDS_Shape aResult = MY_SHAPE->Moved(theTransformation->impl()); setImpl(new TopoDS_Shape(aResult)); } -bool GeomAPI_Shape::isSelfIntersected(const int theLevelOfCheck) const -{ - BOPAlgo_CheckerSI aCSI; // checker of self-interferences +bool GeomAPI_Shape::isSelfIntersected(const int theLevelOfCheck) const { + BOPAlgo_CheckerSI aCSI; // checker of self-interferences aCSI.SetLevelOfCheck(theLevelOfCheck); TopTools_ListOfShape aList; - const TopoDS_Shape& aThisShape = const_cast(this)->impl(); + const TopoDS_Shape &aThisShape = + const_cast(this)->impl(); aList.Append(aThisShape); aCSI.SetArguments(aList); aCSI.Perform(); @@ -803,11 +809,11 @@ bool GeomAPI_Shape::isSelfIntersected(const int theLevelOfCheck) const return false; } -bool GeomAPI_Shape::Comparator::operator()(const std::shared_ptr& theShape1, - const std::shared_ptr& theShape2) const -{ - const TopoDS_Shape& aShape1 = theShape1->impl(); - const TopoDS_Shape& aShape2 = theShape2->impl(); +bool GeomAPI_Shape::Comparator::operator()( + const std::shared_ptr &theShape1, + const std::shared_ptr &theShape2) const { + const TopoDS_Shape &aShape1 = theShape1->impl(); + const TopoDS_Shape &aShape2 = theShape2->impl(); bool isLess = aShape1.TShape() < aShape2.TShape(); if (aShape1.TShape() == aShape2.TShape()) { Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); @@ -818,32 +824,32 @@ bool GeomAPI_Shape::Comparator::operator()(const std::shared_ptr& } bool GeomAPI_Shape::ComparatorWithOri::operator()( - const std::shared_ptr& theShape1, - const std::shared_ptr& theShape2) const -{ - const TopoDS_Shape& aShape1 = theShape1->impl(); - const TopoDS_Shape& aShape2 = theShape2->impl(); + const std::shared_ptr &theShape1, + const std::shared_ptr &theShape2) const { + const TopoDS_Shape &aShape1 = theShape1->impl(); + const TopoDS_Shape &aShape2 = theShape2->impl(); bool isLess = aShape1.TShape() < aShape2.TShape(); if (aShape1.TShape() == aShape2.TShape()) { Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast()); - isLess = (aHash1 < aHash2) || - (aHash1 == aHash2 && aShape1.Orientation() < aShape2.Orientation()); + isLess = + (aHash1 < aHash2) || + (aHash1 == aHash2 && aShape1.Orientation() < aShape2.Orientation()); } return isLess; } -int GeomAPI_Shape::Hash::operator()(const std::shared_ptr& theShape) const -{ - const TopoDS_Shape& aShape = theShape->impl(); +int GeomAPI_Shape::Hash::operator()( + const std::shared_ptr &theShape) const { + const TopoDS_Shape &aShape = theShape->impl(); return aShape.HashCode(IntegerLast()); } -bool GeomAPI_Shape::Equal::operator()(const std::shared_ptr& theShape1, - const std::shared_ptr& theShape2) const -{ - const TopoDS_Shape& aShape1 = theShape1->impl(); - const TopoDS_Shape& aShape2 = theShape2->impl(); +bool GeomAPI_Shape::Equal::operator()( + const std::shared_ptr &theShape1, + const std::shared_ptr &theShape2) const { + const TopoDS_Shape &aShape1 = theShape1->impl(); + const TopoDS_Shape &aShape2 = theShape2->impl(); Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast()); diff --git a/src/GeomAPI/GeomAPI_Shape.h b/src/GeomAPI/GeomAPI_Shape.h index 91aa17d19..d6bdc92e8 100644 --- a/src/GeomAPI/GeomAPI_Shape.h +++ b/src/GeomAPI/GeomAPI_Shape.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Shape_H_ @@ -23,8 +24,8 @@ #include "GeomAPI_Dir.h" #include -#include #include +#include class GeomAPI_Pnt; class GeomAPI_Vertex; @@ -39,30 +40,31 @@ class GeomAPI_Trsf; * \ingroup DataModel * \brief Interface to the topological shape object */ -class GeomAPI_Shape : public GeomAPI_Interface -{ +class GeomAPI_Shape : public GeomAPI_Interface { public: /// Shape type enum enum ShapeType { - COMPOUND, COMPSOLID, SOLID, SHELL, - FACE, WIRE, EDGE, VERTEX, + COMPOUND, + COMPSOLID, + SOLID, + SHELL, + FACE, + WIRE, + EDGE, + VERTEX, SHAPE }; /// Shape orientation - enum Orientation { - FORWARD, - REVERSED, - INTERNAL, - EXTERNAL - }; + enum Orientation { FORWARD, REVERSED, INTERNAL, EXTERNAL }; - public: +public: /// Creation of empty (null) shape GEOMAPI_EXPORT GeomAPI_Shape(); - /// \return a new Shape with the same Orientation and Location and a new TShape with the same + /// \return a new Shape with the same Orientation and Location and a new + /// TShape with the same /// geometry and no sub-shapes. GEOMAPI_EXPORT std::shared_ptr emptyCopied() const; @@ -80,7 +82,8 @@ public: /// Returns \c true if shapes have same underlying geometry GEOMAPI_EXPORT - virtual bool isSameGeometry(const std::shared_ptr theShape) const; + virtual bool + isSameGeometry(const std::shared_ptr theShape) const; /// Returns whether the shape is a vertex GEOMAPI_EXPORT @@ -115,7 +118,8 @@ public: GEOMAPI_EXPORT virtual bool isCollectionOfSolids() const; - /// Returns whether the shape is a compound where all elements are topologically connected + /// Returns whether the shape is a compound where all elements are + /// topologically connected GEOMAPI_EXPORT virtual bool isConnectedTopology() const; @@ -160,8 +164,9 @@ public: /// \param theOnlyUnique set it to \c true to omit subsequent /// inclusions of the same sub-shape. By default it is \c false. GEOMAPI_EXPORT - std::list< std::shared_ptr > subShapes(const ShapeType theSubShapeType, - const bool theOnlyUnique = false) const; + std::list> + subShapes(const ShapeType theSubShapeType, + const bool theOnlyUnique = false) const; /// Returns the shape type GEOMAPI_EXPORT @@ -185,15 +190,17 @@ public: /// \return true if passed shape is a sub-shape of this shape. /// \param theShape shape to search. - /// \param theCheckOrientation if false, returns true even if orientation of shape differs - GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr theShape, - const bool theCheckOrientation = true) const; + /// \param theCheckOrientation if false, returns true even if orientation of + /// shape differs + GEOMAPI_EXPORT virtual bool + isSubShape(const std::shared_ptr theShape, + const bool theCheckOrientation = true) const; /// Computes boundary dimensions of the shape /// Returns False if it is not possible GEOMAPI_EXPORT - bool computeSize(double& theXmin, double& theYmin, double& theZmin, - double& theXmax, double& theYmax, double& theZmax) const; + bool computeSize(double &theXmin, double &theYmin, double &theZmin, + double &theXmax, double &theYmax, double &theZmax) const; /// Return middle point on the shape GEOMAPI_EXPORT @@ -205,7 +212,8 @@ public: /// Returns intersection of shapes GEOMAPI_EXPORT - std::shared_ptr intersect(const std::shared_ptr theShape) const; + std::shared_ptr + intersect(const std::shared_ptr theShape) const; /// Returns true if min distance between shapes < tolerance. GEOMAPI_EXPORT @@ -213,74 +221,71 @@ public: /// Translates the shape along the direction for the given offset GEOMAPI_EXPORT - void translate(const std::shared_ptr theDir, const double theOffset); + void translate(const std::shared_ptr theDir, + const double theOffset); /// Moves the shape with the given transformation matrix. GEOMAPI_EXPORT - void move(const std::shared_ptr theTransformation); + void move(const std::shared_ptr theTransformation); /// Returns type of shapes in the compound. // If shapes are of different type then it will return SHAPE type GEOMAPI_EXPORT ShapeType typeOfCompoundShapes() const; /// Returns true if shape have self-intersections. - /// \param[in] theLevelOfCheck defines which interferences will be checked:
    - /// 0 - only V/V;
    - /// 1 - V/V and V/E;
    - /// 2 - V/V, V/E and E/E;
    - /// 3 - V/V, V/E, E/E and V/F;
    - /// 4 - V/V, V/E, E/E, V/F and E/F;
    - /// 5 - V/V, V/E, E/E, V/F, E/F and F/F;
    - /// 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;
    - /// 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;
    + /// \param[in] theLevelOfCheck defines which interferences will be + /// checked:
    0 - only V/V;
    1 - V/V and V/E;
    2 - V/V, V/E and + /// E/E;
    3 - V/V, V/E, E/E and V/F;
    4 - V/V, V/E, E/E, V/F and + /// E/F;
    5 - V/V, V/E, E/E, V/F, E/F and F/F;
    6 - V/V, V/E, E/E, V/F, + /// E/F, F/F and V/S;
    7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;
    /// 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;
    - /// 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value) + /// 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all + /// interferences (Default value) GEOMAPI_EXPORT bool isSelfIntersected(const int theLevelOfCheck = 9) const; public: /// \brief Compare addresses of shapes - class Comparator - { + class Comparator { public: - /// Return \c true if the address of the first shape is less than the address of the second + /// Return \c true if the address of the first shape is less than the + /// address of the second GEOMAPI_EXPORT - bool operator ()(const std::shared_ptr& theShape1, - const std::shared_ptr& theShape2) const; + bool operator()(const std::shared_ptr &theShape1, + const std::shared_ptr &theShape2) const; }; /// \brief Compare addresses of shapes with respect to orientation of shapes. - /// Same TShapes with opposite orientations will be treated as different. - class ComparatorWithOri - { + /// Same TShapes with opposite orientations will be treated as + /// different. + class ComparatorWithOri { public: - /// Return \c true if the address of the first shape is less than the address of the second + /// Return \c true if the address of the first shape is less than the + /// address of the second GEOMAPI_EXPORT - bool operator ()(const std::shared_ptr& theShape1, - const std::shared_ptr& theShape2) const; + bool operator()(const std::shared_ptr &theShape1, + const std::shared_ptr &theShape2) const; }; /// \brief Hash code for the shape - class Hash - { + class Hash { public: /// Return Hash value according to the address of the shape GEOMAPI_EXPORT - int operator ()(const std::shared_ptr& theShape) const; + int operator()(const std::shared_ptr &theShape) const; }; /// \brief Compare addresses of shapes - class Equal - { + class Equal { public: /// Return \c true if the address of the shapes are equal GEOMAPI_EXPORT - bool operator ()(const std::shared_ptr& theShape1, - const std::shared_ptr& theShape2) const; + bool operator()(const std::shared_ptr &theShape1, + const std::shared_ptr &theShape2) const; }; }; //! Pointer on list of shapes -typedef std::list > ListOfShape; +typedef std::list> ListOfShape; //! Pointer on attribute object typedef std::shared_ptr GeomShapePtr; diff --git a/src/GeomAPI/GeomAPI_ShapeExplorer.cpp b/src/GeomAPI/GeomAPI_ShapeExplorer.cpp index a9274eb88..5aabae77c 100644 --- a/src/GeomAPI/GeomAPI_ShapeExplorer.cpp +++ b/src/GeomAPI/GeomAPI_ShapeExplorer.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -26,15 +27,13 @@ //================================================================================================= GeomAPI_ShapeExplorer::GeomAPI_ShapeExplorer() -: GeomAPI_Interface(new TopExp_Explorer()) -{ -} + : GeomAPI_Interface(new TopExp_Explorer()) {} -// returns a type of shape to expolode, but if toFind==SHAPE, it will return the type -// of the first sub-element of compoud if theSHape is compound -static TopAbs_ShapeEnum ShapeType(const std::shared_ptr& theShape, - const GeomAPI_Shape::ShapeType toFind) -{ +// returns a type of shape to expolode, but if toFind==SHAPE, it will return the +// type of the first sub-element of compoud if theSHape is compound +static TopAbs_ShapeEnum +ShapeType(const std::shared_ptr &theShape, + const GeomAPI_Shape::ShapeType toFind) { if (toFind == GeomAPI_Shape::SHAPE) { TopoDS_Shape aShape = theShape->impl(); if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND) { @@ -48,34 +47,29 @@ static TopAbs_ShapeEnum ShapeType(const std::shared_ptr& theShape } //================================================================================================= -GeomAPI_ShapeExplorer::GeomAPI_ShapeExplorer(const std::shared_ptr& theShape, - const GeomAPI_Shape::ShapeType toFind, - const GeomAPI_Shape::ShapeType toAvoid) -: GeomAPI_Interface(new TopExp_Explorer(theShape->impl(), - ShapeType(theShape, toFind), - (TopAbs_ShapeEnum)toAvoid)) -{ -} +GeomAPI_ShapeExplorer::GeomAPI_ShapeExplorer( + const std::shared_ptr &theShape, + const GeomAPI_Shape::ShapeType toFind, + const GeomAPI_Shape::ShapeType toAvoid) + : GeomAPI_Interface(new TopExp_Explorer(theShape->impl(), + ShapeType(theShape, toFind), + (TopAbs_ShapeEnum)toAvoid)) {} //================================================================================================= -void GeomAPI_ShapeExplorer::init(const std::shared_ptr& theShape, +void GeomAPI_ShapeExplorer::init(const std::shared_ptr &theShape, const GeomAPI_Shape::ShapeType toFind, - const GeomAPI_Shape::ShapeType toAvoid) -{ - MY_EXPLORER->Init(theShape->impl(), - ShapeType(theShape, toFind), - (TopAbs_ShapeEnum)toAvoid); + const GeomAPI_Shape::ShapeType toAvoid) { + MY_EXPLORER->Init(theShape->impl(), ShapeType(theShape, toFind), + (TopAbs_ShapeEnum)toAvoid); } //================================================================================================= -bool GeomAPI_ShapeExplorer::more() const -{ +bool GeomAPI_ShapeExplorer::more() const { return MY_EXPLORER->More() == Standard_True; } //================================================================================================= -void GeomAPI_ShapeExplorer::next() -{ +void GeomAPI_ShapeExplorer::next() { try { MY_EXPLORER->Next(); } catch (Standard_NoMoreObject) { @@ -83,10 +77,9 @@ void GeomAPI_ShapeExplorer::next() } //================================================================================================= -std::shared_ptr GeomAPI_ShapeExplorer::current() -{ +std::shared_ptr GeomAPI_ShapeExplorer::current() { try { - const TopoDS_Shape& aShape = MY_EXPLORER->Current(); + const TopoDS_Shape &aShape = MY_EXPLORER->Current(); std::shared_ptr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(aShape)); return aGeomShape; @@ -96,19 +89,10 @@ std::shared_ptr GeomAPI_ShapeExplorer::current() } //================================================================================================= -void GeomAPI_ShapeExplorer::reinit() -{ - MY_EXPLORER->ReInit(); -} +void GeomAPI_ShapeExplorer::reinit() { MY_EXPLORER->ReInit(); } //================================================================================================= -int GeomAPI_ShapeExplorer::depth() const -{ - return MY_EXPLORER->Depth(); -} +int GeomAPI_ShapeExplorer::depth() const { return MY_EXPLORER->Depth(); } //================================================================================================= -void GeomAPI_ShapeExplorer::clear() -{ - MY_EXPLORER->Clear(); -} +void GeomAPI_ShapeExplorer::clear() { MY_EXPLORER->Clear(); } diff --git a/src/GeomAPI/GeomAPI_ShapeExplorer.h b/src/GeomAPI/GeomAPI_ShapeExplorer.h index b8ef7ad04..b8f5db951 100644 --- a/src/GeomAPI/GeomAPI_ShapeExplorer.h +++ b/src/GeomAPI/GeomAPI_ShapeExplorer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_ShapeExplorer_H_ @@ -27,34 +28,35 @@ * \ingroup DataModel * \brief This class is used to explore subshapes on shape. */ -class GeomAPI_ShapeExplorer : public GeomAPI_Interface -{ +class GeomAPI_ShapeExplorer : public GeomAPI_Interface { public: - /// Default constructor. Creates an empty explorer, becomes usefull after Init. + /// Default constructor. Creates an empty explorer, becomes usefull after + /// Init. GEOMAPI_EXPORT GeomAPI_ShapeExplorer(); - /** \brief Constructs an explorer to search on theShape, for shapes of type toFind, - * that are not part of a shape toAvoid. If the shape toAvoid is equal to GeomAPI_SHape::SHAPE, - * or if it is the same as, or less complex than the shape toFind it has no effect on the search. - * \param[in] theShape shape to explore. - * \param[in] toFind shape type to find. - * \param[in] toAvoid shape type to avoid. + /** \brief Constructs an explorer to search on theShape, for shapes of type + * toFind, that are not part of a shape toAvoid. If the shape toAvoid is equal + * to GeomAPI_SHape::SHAPE, or if it is the same as, or less complex than the + * shape toFind it has no effect on the search. \param[in] theShape shape to + * explore. \param[in] toFind shape type to find. \param[in] toAvoid shape + * type to avoid. */ GEOMAPI_EXPORT - GeomAPI_ShapeExplorer(const std::shared_ptr& theShape, - const GeomAPI_Shape::ShapeType toFind, - const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE); + GeomAPI_ShapeExplorer( + const std::shared_ptr &theShape, + const GeomAPI_Shape::ShapeType toFind, + const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE); - /** \brief Resets this explorer. It is initialized to search on theShape, for shapes of type toFind, - * that are not part of a shape toAvoid. If the shape toAvoid is equal to GeomAPI_SHape::SHAPE, - * or if it is the same as, or less complex than the shape toFind it has no effect on the search. - * \param[in] theShape shape to explore. - * \param[in] toFind shape type to find. - * \param[in] toAvoid shape type to avoid. + /** \brief Resets this explorer. It is initialized to search on theShape, for + * shapes of type toFind, that are not part of a shape toAvoid. If the shape + * toAvoid is equal to GeomAPI_SHape::SHAPE, or if it is the same as, or less + * complex than the shape toFind it has no effect on the search. \param[in] + * theShape shape to explore. \param[in] toFind shape type to find. \param[in] + * toAvoid shape type to avoid. */ GEOMAPI_EXPORT - void init(const std::shared_ptr& theShape, + void init(const std::shared_ptr &theShape, const GeomAPI_Shape::ShapeType toFind, const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE); @@ -76,14 +78,14 @@ public: GEOMAPI_EXPORT void reinit(); - /// \return the current depth of the exploration. 0 is the shape to explore itself. + /// \return the current depth of the exploration. 0 is the shape to explore + /// itself. GEOMAPI_EXPORT int depth() const; /// Clears the content of the explorer. It will return False on more(). GEOMAPI_EXPORT void clear(); - }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp b/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp index 7eeb3e4d6..db9152c05 100644 --- a/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp +++ b/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_ShapeHierarchy.h" @@ -24,14 +25,12 @@ #include #include -void GeomAPI_ShapeHierarchy::addObject(const GeomShapePtr& theObject) -{ +void GeomAPI_ShapeHierarchy::addObject(const GeomShapePtr &theObject) { myObjects.push_back(theObject); } -void GeomAPI_ShapeHierarchy::addParent(const GeomShapePtr& theShape, - const GeomShapePtr& theParent) -{ +void GeomAPI_ShapeHierarchy::addParent(const GeomShapePtr &theShape, + const GeomShapePtr &theParent) { myParent[theShape] = theParent; MapShapeToIndex::iterator aFound = myParentIndices.find(theParent); @@ -45,9 +44,8 @@ void GeomAPI_ShapeHierarchy::addParent(const GeomShapePtr& theShape, mySubshapes[anIndex].second.push_back(theShape); } -GeomShapePtr GeomAPI_ShapeHierarchy::parent(const GeomShapePtr& theShape, - bool theMarkProcessed) -{ +GeomShapePtr GeomAPI_ShapeHierarchy::parent(const GeomShapePtr &theShape, + bool theMarkProcessed) { MapShapeToShape::const_iterator aFound = myParent.find(theShape); GeomShapePtr aParent; if (aFound != myParent.end()) { @@ -60,9 +58,8 @@ GeomShapePtr GeomAPI_ShapeHierarchy::parent(const GeomShapePtr& theShape, return aParent; } -GeomShapePtr GeomAPI_ShapeHierarchy::root(const GeomShapePtr& theShape, - bool theMarkProcessed) -{ +GeomShapePtr GeomAPI_ShapeHierarchy::root(const GeomShapePtr &theShape, + bool theMarkProcessed) { GeomShapePtr aParent = parent(theShape, theMarkProcessed); GeomShapePtr aRoot = aParent; while (aParent) { @@ -73,32 +70,31 @@ GeomShapePtr GeomAPI_ShapeHierarchy::root(const GeomShapePtr& theShape, return aRoot; } -void GeomAPI_ShapeHierarchy::markProcessed(const GeomShapePtr& theShape) -{ +void GeomAPI_ShapeHierarchy::markProcessed(const GeomShapePtr &theShape) { myProcessedObjects.insert(theShape); // mark sub-shapes of the compound as processed too MapShapeToIndex::iterator aFoundInd = myParentIndices.find(theShape); if (aFoundInd != myParentIndices.end()) { - const ListOfShape& aSubs = mySubshapes[aFoundInd->second].second; - for (ListOfShape::const_iterator anIt = aSubs.begin(); anIt != aSubs.end(); ++anIt) + const ListOfShape &aSubs = mySubshapes[aFoundInd->second].second; + for (ListOfShape::const_iterator anIt = aSubs.begin(); anIt != aSubs.end(); + ++anIt) markProcessed(*anIt); } } -void GeomAPI_ShapeHierarchy::markProcessed(const ListOfShape& theShapes) -{ - for (ListOfShape::const_iterator anIt = theShapes.begin(); anIt != theShapes.end(); ++anIt) +void GeomAPI_ShapeHierarchy::markProcessed(const ListOfShape &theShapes) { + for (ListOfShape::const_iterator anIt = theShapes.begin(); + anIt != theShapes.end(); ++anIt) markProcessed(*anIt); } -void GeomAPI_ShapeHierarchy::markModified(const GeomShapePtr& theSource, - const GeomShapePtr& theModified) -{ +void GeomAPI_ShapeHierarchy::markModified(const GeomShapePtr &theSource, + const GeomShapePtr &theModified) { myModifiedObjects[theSource] = theModified; } -const ListOfShape& GeomAPI_ShapeHierarchy::objects(GeomShapePtr theParent) const -{ +const ListOfShape & +GeomAPI_ShapeHierarchy::objects(GeomShapePtr theParent) const { MapShapeToIndex::const_iterator aFoundIndex = myParentIndices.find(theParent); if (aFoundIndex == myParentIndices.end()) { static const ListOfShape THE_DUMMY = ListOfShape(); @@ -109,21 +105,23 @@ const ListOfShape& GeomAPI_ShapeHierarchy::objects(GeomShapePtr theParent) const } void GeomAPI_ShapeHierarchy::objectsByType( - ListOfShape& theShapesByType, - ListOfShape& theOtherShapes, + ListOfShape &theShapesByType, ListOfShape &theOtherShapes, const GeomAPI_Shape::ShapeType theMinType, - const GeomAPI_Shape::ShapeType theMaxType) const -{ + const GeomAPI_Shape::ShapeType theMaxType) const { if (theMinType > theMaxType) - return objectsByType(theShapesByType, theOtherShapes, theMaxType, theMinType); + return objectsByType(theShapesByType, theOtherShapes, theMaxType, + theMinType); // no need to select objects if whole range is specified - if (theMinType == GeomAPI_Shape::COMPOUND && theMaxType == GeomAPI_Shape::SHAPE) { - theShapesByType.insert(theShapesByType.end(), myObjects.begin(), myObjects.end()); + if (theMinType == GeomAPI_Shape::COMPOUND && + theMaxType == GeomAPI_Shape::SHAPE) { + theShapesByType.insert(theShapesByType.end(), myObjects.begin(), + myObjects.end()); return; } - for (ListOfShape::const_iterator anIt = myObjects.begin(); anIt != myObjects.end(); ++anIt) { + for (ListOfShape::const_iterator anIt = myObjects.begin(); + anIt != myObjects.end(); ++anIt) { GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType(); if (aType >= theMinType && aType <= theMaxType) theShapesByType.push_back(*anIt); @@ -132,16 +130,14 @@ void GeomAPI_ShapeHierarchy::objectsByType( } } - -void GeomAPI_ShapeHierarchy::splitCompound( - const GeomShapePtr& theCompShape, - ListOfShape& theUsed, - ListOfShape& theNotUsed) const -{ +void GeomAPI_ShapeHierarchy::splitCompound(const GeomShapePtr &theCompShape, + ListOfShape &theUsed, + ListOfShape &theNotUsed) const { theUsed.clear(); theNotUsed.clear(); - MapShapeToIndex::const_iterator aFoundIndex = myParentIndices.find(theCompShape); + MapShapeToIndex::const_iterator aFoundIndex = + myParentIndices.find(theCompShape); if (aFoundIndex == myParentIndices.end()) return; // no such shape @@ -156,14 +152,11 @@ void GeomAPI_ShapeHierarchy::splitCompound( } } -bool GeomAPI_ShapeHierarchy::empty() const -{ - return myObjects.empty(); -} +bool GeomAPI_ShapeHierarchy::empty() const { return myObjects.empty(); } -void GeomAPI_ShapeHierarchy::topLevelObjects(ListOfShape& theDestination) const -{ - GeomAPI_ShapeHierarchy* aThis = const_cast(this); +void GeomAPI_ShapeHierarchy::topLevelObjects( + ListOfShape &theDestination) const { + GeomAPI_ShapeHierarchy *aThis = const_cast(this); SetOfShape aProcessed = myProcessedObjects; aThis->myProcessedObjects.clear(); @@ -180,8 +173,7 @@ void GeomAPI_ShapeHierarchy::topLevelObjects(ListOfShape& theDestination) const // compose a compund with the modified shapes aShape = collectSubs(aRoot, SetOfShape(), myModifiedObjects); } - } - else { + } else { // check the current shape was modified MapShapeToShape::const_iterator aFound = myModifiedObjects.find(aShape); if (aFound != myModifiedObjects.end()) @@ -195,16 +187,16 @@ void GeomAPI_ShapeHierarchy::topLevelObjects(ListOfShape& theDestination) const } void GeomAPI_ShapeHierarchy::compoundsOfUnusedObjects( - ListOfShape& theDestination) const -{ + ListOfShape &theDestination) const { SetOfShape aUsedObjects = myProcessedObjects; aUsedObjects.insert(myObjects.begin(), myObjects.end()); - for (std::vector::const_iterator anIt = mySubshapes.begin(); + for (std::vector::const_iterator anIt = + mySubshapes.begin(); anIt != mySubshapes.end(); ++anIt) { MapShapeToShape::const_iterator aParent = myParent.find(anIt->first); if ((aParent == myParent.end() || !aParent->second) && - anIt->first->shapeType() == GeomAPI_Shape::COMPOUND) { + anIt->first->shapeType() == GeomAPI_Shape::COMPOUND) { // this is a top-level compound GeomShapePtr aCompound = collectSubs(anIt->first, aUsedObjects); // add to destination non-empty compounds only @@ -214,43 +206,48 @@ void GeomAPI_ShapeHierarchy::compoundsOfUnusedObjects( } } -static void addSubShape(GeomShapePtr theTarget, GeomShapePtr theSub, - const std::map& theModified) -{ +static void addSubShape( + GeomShapePtr theTarget, GeomShapePtr theSub, + const std::map + &theModified) { if (!theTarget.get() || !theSub.get()) return; - TopoDS_Shape* aShape = theTarget->implPtr(); + TopoDS_Shape *aShape = theTarget->implPtr(); - std::map::const_iterator - aFound = theModified.find(theSub); - const TopoDS_Shape& aShapeToAdd = - (aFound == theModified.end() ? theSub : aFound->second)->impl(); + std::map::const_iterator aFound = + theModified.find(theSub); + const TopoDS_Shape &aShapeToAdd = + (aFound == theModified.end() ? theSub : aFound->second) + ->impl(); static BRep_Builder aBuilder; aBuilder.Add(*aShape, aShapeToAdd); } -GeomShapePtr GeomAPI_ShapeHierarchy::collectSubs( - GeomShapePtr theTopLevelCompound, - const SetOfShape& theExcluded, - const MapShapeToShape& theModified) const -{ +GeomShapePtr +GeomAPI_ShapeHierarchy::collectSubs(GeomShapePtr theTopLevelCompound, + const SetOfShape &theExcluded, + const MapShapeToShape &theModified) const { GeomShapePtr aResult = theTopLevelCompound->emptyCopied(); bool isResultEmpty = true; - for (GeomAPI_ShapeIterator aSub(theTopLevelCompound); aSub.more(); aSub.next()) { + for (GeomAPI_ShapeIterator aSub(theTopLevelCompound); aSub.more(); + aSub.next()) { GeomShapePtr aCurrent = aSub.current(); if (theExcluded.find(aCurrent) != theExcluded.end()) continue; // already used - MapShapeToIndex::const_iterator aFoundIndex = myParentIndices.find(aCurrent); + MapShapeToIndex::const_iterator aFoundIndex = + myParentIndices.find(aCurrent); if (aCurrent->shapeType() > GeomAPI_Shape::COMPOUND || aFoundIndex == myParentIndices.end()) { bool isAddShape = true; // check compsolid is fully unused in the Boolean operation if (aCurrent->shapeType() == GeomAPI_Shape::COMPSOLID) { - for (GeomAPI_ShapeIterator anIt(aCurrent); isAddShape && anIt.more(); anIt.next()) + for (GeomAPI_ShapeIterator anIt(aCurrent); isAddShape && anIt.more(); + anIt.next()) isAddShape = theExcluded.find(anIt.current()) == theExcluded.end(); } @@ -269,21 +266,17 @@ GeomShapePtr GeomAPI_ShapeHierarchy::collectSubs( return isResultEmpty ? GeomShapePtr() : aResult; } - -GeomAPI_ShapeHierarchy::iterator GeomAPI_ShapeHierarchy::begin() -{ +GeomAPI_ShapeHierarchy::iterator GeomAPI_ShapeHierarchy::begin() { return iterator(this); } -GeomAPI_ShapeHierarchy::iterator GeomAPI_ShapeHierarchy::end() -{ +GeomAPI_ShapeHierarchy::iterator GeomAPI_ShapeHierarchy::end() { return iterator(this, false); } -GeomAPI_ShapeHierarchy::iterator::iterator( - GeomAPI_ShapeHierarchy* theHierarchy, bool isBegin) - : myHierarchy(theHierarchy) -{ +GeomAPI_ShapeHierarchy::iterator::iterator(GeomAPI_ShapeHierarchy *theHierarchy, + bool isBegin) + : myHierarchy(theHierarchy) { if (isBegin) { myObject = myHierarchy->myObjects.begin(); skipAlreadyProcessed(); @@ -291,32 +284,32 @@ GeomAPI_ShapeHierarchy::iterator::iterator( myObject = myHierarchy->myObjects.end(); } -void GeomAPI_ShapeHierarchy::iterator::skipAlreadyProcessed() -{ +void GeomAPI_ShapeHierarchy::iterator::skipAlreadyProcessed() { while (myObject != myHierarchy->myObjects.end() && - myHierarchy->myProcessedObjects.find(*myObject) != myHierarchy->myProcessedObjects.end()) + myHierarchy->myProcessedObjects.find(*myObject) != + myHierarchy->myProcessedObjects.end()) ++myObject; } -bool GeomAPI_ShapeHierarchy::iterator::operator==(const iterator& theOther) const -{ +bool GeomAPI_ShapeHierarchy::iterator::operator==( + const iterator &theOther) const { return myObject == theOther.myObject; } -bool GeomAPI_ShapeHierarchy::iterator::operator!=(const iterator& theOther) const -{ +bool GeomAPI_ShapeHierarchy::iterator::operator!=( + const iterator &theOther) const { return !operator==(theOther); } -GeomAPI_ShapeHierarchy::iterator& GeomAPI_ShapeHierarchy::iterator::operator++() -{ +GeomAPI_ShapeHierarchy::iterator & +GeomAPI_ShapeHierarchy::iterator::operator++() { ++myObject; skipAlreadyProcessed(); return *this; } -GeomAPI_ShapeHierarchy::iterator GeomAPI_ShapeHierarchy::iterator::operator++(int) -{ +GeomAPI_ShapeHierarchy::iterator +GeomAPI_ShapeHierarchy::iterator::operator++(int) { iterator aCurrent; aCurrent.myHierarchy = myHierarchy; aCurrent.myObject = myObject; @@ -327,8 +320,7 @@ GeomAPI_ShapeHierarchy::iterator GeomAPI_ShapeHierarchy::iterator::operator++(in return aCurrent; } -GeomShapePtr GeomAPI_ShapeHierarchy::iterator::operator*() const -{ +GeomShapePtr GeomAPI_ShapeHierarchy::iterator::operator*() const { myHierarchy->markProcessed(*myObject); return *myObject; } diff --git a/src/GeomAPI/GeomAPI_ShapeHierarchy.h b/src/GeomAPI/GeomAPI_ShapeHierarchy.h index 9977e7ee9..647514f53 100644 --- a/src/GeomAPI/GeomAPI_ShapeHierarchy.h +++ b/src/GeomAPI/GeomAPI_ShapeHierarchy.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_ShapeHierarchy_H_ @@ -29,20 +30,24 @@ /// \class GeomAPI_ShapeHierarchy /// \ingroup Plugins -/// \brief Storage for the hierarchy of shapes and their parents (compounds or compsolids) -class GeomAPI_ShapeHierarchy -{ +/// \brief Storage for the hierarchy of shapes and their parents (compounds or +/// compsolids) +class GeomAPI_ShapeHierarchy { typedef std::pair ShapeAndSubshapes; - typedef std::map MapShapeToShape; - typedef std::map MapShapeToIndex; + typedef std::map + MapShapeToShape; + typedef std::map + MapShapeToIndex; typedef std::set SetOfShape; ListOfShape myObjects; ///< list of objects of some operation - MapShapeToShape myParent; ///< refer a shape to compound/compsolid containing it + MapShapeToShape + myParent; ///< refer a shape to compound/compsolid containing it /// indices of compounds/compsolids to keep the order of parent shapes /// corresponding to the order of objects - MapShapeToIndex myParentIndices; - /// list of shape and its subshapes stored according to the index of parent shape + MapShapeToIndex myParentIndices; + /// list of shape and its subshapes stored according to the index of parent + /// shape std::vector mySubshapes; SetOfShape myProcessedObjects; @@ -50,80 +55,92 @@ class GeomAPI_ShapeHierarchy public: /// Add an object of the operation (low-level shape in the hierarchy) - GEOMAPI_EXPORT void addObject(const GeomShapePtr& theObject); + GEOMAPI_EXPORT void addObject(const GeomShapePtr &theObject); /// Store link between shape and its parent. - /// Has to be called by high-level algorithm, because the parent compound/compsolid - /// is usually stored as a top-level result - GEOMAPI_EXPORT void addParent(const GeomShapePtr& theShape, const GeomShapePtr& theParent); + /// Has to be called by high-level algorithm, because the parent + /// compound/compsolid is usually stored as a top-level result + GEOMAPI_EXPORT void addParent(const GeomShapePtr &theShape, + const GeomShapePtr &theParent); /// Return parent shape for the given, or empty if it is a high-level shape. - /// By default, the parent and all its subshapes are marked as processed for further skip. - GEOMAPI_EXPORT GeomShapePtr parent(const GeomShapePtr& theShape, bool theMarkProcessed = true); + /// By default, the parent and all its subshapes are marked as processed for + /// further skip. + GEOMAPI_EXPORT GeomShapePtr parent(const GeomShapePtr &theShape, + bool theMarkProcessed = true); /// Get root shape for the specified sub-shape. - /// By default, the parent and all its subshapes are marked as processed for further skip. - GEOMAPI_EXPORT GeomShapePtr root(const GeomShapePtr& theShape, bool theMarkProcessed = true); + /// By default, the parent and all its subshapes are marked as processed for + /// further skip. + GEOMAPI_EXPORT GeomShapePtr root(const GeomShapePtr &theShape, + bool theMarkProcessed = true); /// Mark the shape as already processed - GEOMAPI_EXPORT void markProcessed(const GeomShapePtr& theShape); + GEOMAPI_EXPORT void markProcessed(const GeomShapePtr &theShape); /// Mark list ofshapes as already processed - GEOMAPI_EXPORT void markProcessed(const ListOfShape& theShapes); + GEOMAPI_EXPORT void markProcessed(const ListOfShape &theShapes); /// Mark the shape as modified and store its image - GEOMAPI_EXPORT void markModified(const GeomShapePtr& theSource, const GeomShapePtr& theModified); + GEOMAPI_EXPORT void markModified(const GeomShapePtr &theSource, + const GeomShapePtr &theModified); - /// Split compound/compsolid shape for subshapes selected for operation and the others. - GEOMAPI_EXPORT void splitCompound(const GeomShapePtr& theCompShape, - ListOfShape& theUsed, - ListOfShape& theNotUsed) const; + /// Split compound/compsolid shape for subshapes selected for operation and + /// the others. + GEOMAPI_EXPORT void splitCompound(const GeomShapePtr &theCompShape, + ListOfShape &theUsed, + ListOfShape &theNotUsed) const; - /// Generates the list of top-level compounds, which exclude the objects of operation. - GEOMAPI_EXPORT void compoundsOfUnusedObjects(ListOfShape& theDestination) const; + /// Generates the list of top-level compounds, which exclude the objects of + /// operation. + GEOMAPI_EXPORT void + compoundsOfUnusedObjects(ListOfShape &theDestination) const; - /// Generates the list of top-level compounds, with modified objects of operation. - GEOMAPI_EXPORT void topLevelObjects(ListOfShape& theDestination) const; + /// Generates the list of top-level compounds, with modified objects of + /// operation. + GEOMAPI_EXPORT void topLevelObjects(ListOfShape &theDestination) const; /// Return \c true if there is no object in hierarchy GEOMAPI_EXPORT bool empty() const; /// Return list of objects - const ListOfShape& objects() const { return myObjects; } + const ListOfShape &objects() const { return myObjects; } /// Return list of low-level objects for the parent shape - GEOMAPI_EXPORT const ListOfShape& objects(GeomShapePtr theParent) const; + GEOMAPI_EXPORT const ListOfShape &objects(GeomShapePtr theParent) const; /// Separate objects of the given range of types and all other objects - GEOMAPI_EXPORT void objectsByType(ListOfShape& theShapesByType, ListOfShape& theOtherShapes, + GEOMAPI_EXPORT void objectsByType( + ListOfShape &theShapesByType, ListOfShape &theOtherShapes, const GeomAPI_Shape::ShapeType theMinType = GeomAPI_Shape::COMPOUND, const GeomAPI_Shape::ShapeType theMaxType = GeomAPI_Shape::SHAPE) const; private: /// Collect subs of a top-level compound, excluding the set of given objects /// and substitute the shapes which were modified - GeomShapePtr collectSubs(const GeomShapePtr theTopLevelCompound, - const SetOfShape& theExcluded = SetOfShape(), - const MapShapeToShape& theModified = MapShapeToShape()) const; + GeomShapePtr + collectSubs(const GeomShapePtr theTopLevelCompound, + const SetOfShape &theExcluded = SetOfShape(), + const MapShapeToShape &theModified = MapShapeToShape()) const; public: - class iterator : public std::iterator - { + class iterator + : public std::iterator { public: GEOMAPI_EXPORT iterator() {} protected: - iterator(GeomAPI_ShapeHierarchy* theHierarchy, bool isBegin = true); + iterator(GeomAPI_ShapeHierarchy *theHierarchy, bool isBegin = true); void skipAlreadyProcessed(); public: - GEOMAPI_EXPORT bool operator==(const iterator&) const; - GEOMAPI_EXPORT bool operator!=(const iterator&) const; + GEOMAPI_EXPORT bool operator==(const iterator &) const; + GEOMAPI_EXPORT bool operator!=(const iterator &) const; - GEOMAPI_EXPORT iterator& operator++(); - GEOMAPI_EXPORT iterator operator++(int); + GEOMAPI_EXPORT iterator &operator++(); + GEOMAPI_EXPORT iterator operator++(int); GEOMAPI_EXPORT GeomShapePtr operator*() const; private: - GeomAPI_ShapeHierarchy* myHierarchy; + GeomAPI_ShapeHierarchy *myHierarchy; ListOfShape::iterator myObject; friend class GeomAPI_ShapeHierarchy; diff --git a/src/GeomAPI/GeomAPI_ShapeIterator.cpp b/src/GeomAPI/GeomAPI_ShapeIterator.cpp index 2a5592b7d..39ffdecd3 100644 --- a/src/GeomAPI/GeomAPI_ShapeIterator.cpp +++ b/src/GeomAPI/GeomAPI_ShapeIterator.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_ShapeIterator.h" @@ -26,35 +27,31 @@ //================================================================================================== GeomAPI_ShapeIterator::GeomAPI_ShapeIterator() -: GeomAPI_Interface(new TopoDS_Iterator()) -{ -} + : GeomAPI_Interface(new TopoDS_Iterator()) {} //================================================================================================== -GeomAPI_ShapeIterator::GeomAPI_ShapeIterator(const std::shared_ptr theShape) -: GeomAPI_Interface(new TopoDS_Iterator()) -{ +GeomAPI_ShapeIterator::GeomAPI_ShapeIterator( + const std::shared_ptr theShape) + : GeomAPI_Interface(new TopoDS_Iterator()) { init(theShape); } //================================================================================================== -void GeomAPI_ShapeIterator::init(const std::shared_ptr theShape) -{ - if(!theShape.get()) { +void GeomAPI_ShapeIterator::init( + const std::shared_ptr theShape) { + if (!theShape.get()) { return; } MY_ITERATOR->Initialize(theShape->impl()); } //================================================================================================== -bool GeomAPI_ShapeIterator::more() const -{ +bool GeomAPI_ShapeIterator::more() const { return MY_ITERATOR->More() == Standard_True; } //================================================================================================== -void GeomAPI_ShapeIterator::next() -{ +void GeomAPI_ShapeIterator::next() { try { MY_ITERATOR->Next(); } catch (Standard_NoMoreObject) { @@ -62,10 +59,9 @@ void GeomAPI_ShapeIterator::next() } //================================================================================================== -std::shared_ptr GeomAPI_ShapeIterator::current() -{ +std::shared_ptr GeomAPI_ShapeIterator::current() { try { - const TopoDS_Shape& aShape = MY_ITERATOR->Value(); + const TopoDS_Shape &aShape = MY_ITERATOR->Value(); std::shared_ptr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(aShape)); return aGeomShape; diff --git a/src/GeomAPI/GeomAPI_ShapeIterator.h b/src/GeomAPI/GeomAPI_ShapeIterator.h index a7910e9d5..842551dab 100644 --- a/src/GeomAPI/GeomAPI_ShapeIterator.h +++ b/src/GeomAPI/GeomAPI_ShapeIterator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_ShapeIterator_H_ @@ -25,32 +26,38 @@ /// \class GeomAPI_ShapeIterator /// \ingroup DataModel -/// \brief Iterates on the underlying shape underlying a given GeomAPI_Shape object, +/// \brief Iterates on the underlying shape underlying a given GeomAPI_Shape +/// object, /// providing access -/// to its component sub-shapes. Each component shape is returned as a GeomAPI_Shape with -/// an orientation, and a compound of the original values and the relative values. -class GeomAPI_ShapeIterator : public GeomAPI_Interface -{ +/// to its component sub-shapes. Each component shape is returned as a +/// GeomAPI_Shape with an orientation, and a compound of the original +/// values and the relative values. +class GeomAPI_ShapeIterator : public GeomAPI_Interface { public: - /// Default constructor. Creates an empty iterator, becomes usefull after Init. + /// Default constructor. Creates an empty iterator, becomes usefull after + /// Init. GEOMAPI_EXPORT GeomAPI_ShapeIterator(); /// \brief Creates an iterator on theShape sub-shapes. /// \param[in] theShape shape to iterate. - GEOMAPI_EXPORT GeomAPI_ShapeIterator(const std::shared_ptr theShape); + GEOMAPI_EXPORT + GeomAPI_ShapeIterator(const std::shared_ptr theShape); /// \brief Initializes this iterator with theShape. /// \param[in] theShape shape to iterate. GEOMAPI_EXPORT void init(const std::shared_ptr theShape); - /// \return true if there is another sub-shape in the shape which this iterator is scanning. + /// \return true if there is another sub-shape in the shape which this + /// iterator is scanning. GEOMAPI_EXPORT bool more() const; - /// Moves on to the next sub-shape in the shape which this iterator is scanning. + /// Moves on to the next sub-shape in the shape which this iterator is + /// scanning. GEOMAPI_EXPORT void next(); - /// \return the current sub-shape in the shape which this iterator is scanning. + /// \return the current sub-shape in the shape which this iterator is + /// scanning. GEOMAPI_EXPORT std::shared_ptr current(); }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAPI/GeomAPI_Shell.cpp b/src/GeomAPI/GeomAPI_Shell.cpp index 0b07404d0..d6c4a25bf 100644 --- a/src/GeomAPI/GeomAPI_Shell.cpp +++ b/src/GeomAPI/GeomAPI_Shell.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Shell.h" @@ -30,8 +31,8 @@ #include "GeomAPI_Wire.h" #include "GeomAPI_XYZ.h" -#include #include +#include #include #include #include @@ -40,9 +41,8 @@ #include //================================================================================================= -GeomAPI_Shell::GeomAPI_Shell() -{ - TopoDS_Shell* aShell = new TopoDS_Shell(); +GeomAPI_Shell::GeomAPI_Shell() { + TopoDS_Shell *aShell = new TopoDS_Shell(); BRep_Builder aBuilder; aBuilder.MakeShell(*aShell); @@ -51,21 +51,20 @@ GeomAPI_Shell::GeomAPI_Shell() } //================================================================================================= -GeomAPI_Shell::GeomAPI_Shell(const std::shared_ptr& theShape) -{ +GeomAPI_Shell::GeomAPI_Shell(const std::shared_ptr &theShape) { if (!theShape->isNull() && theShape->isShell()) { setImpl(new TopoDS_Shape(theShape->impl())); } } //================================================================================================= -std::shared_ptr GeomAPI_Shell::getSphere() const -{ +std::shared_ptr GeomAPI_Shell::getSphere() const { bool isSphere = true; bool isFirstFace = true; GeomSpherePtr aSphere; - for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(anExp.Current())); @@ -78,9 +77,10 @@ std::shared_ptr GeomAPI_Shell::getSphere() const if (isFirstFace) { aSphere = aCurSphere; isFirstFace = false; - } - else if (aSphere->center()->distance(aCurSphere->center()) >= Precision::Confusion() || - Abs(aSphere->radius() - aCurSphere->radius()) >= Precision::Confusion()) { + } else if (aSphere->center()->distance(aCurSphere->center()) >= + Precision::Confusion() || + Abs(aSphere->radius() - aCurSphere->radius()) >= + Precision::Confusion()) { isSphere = false; break; } @@ -90,8 +90,7 @@ std::shared_ptr GeomAPI_Shell::getSphere() const } //================================================================================================= -std::shared_ptr GeomAPI_Shell::getCylinder() const -{ +std::shared_ptr GeomAPI_Shell::getCylinder() const { bool isCylinder = true; bool isFirstFace = true; @@ -100,7 +99,8 @@ std::shared_ptr GeomAPI_Shell::getCylinder() const double aRadius = 0.0; double aHeight = 0.0; - for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(anExp.Current())); @@ -116,15 +116,16 @@ std::shared_ptr GeomAPI_Shell::getCylinder() const aRadius = aCurCyl->radius(); aHeight = aCurCyl->height(); isFirstFace = false; - } - else { + } else { // compare radii if (Abs(aRadius - aCurCyl->radius()) >= Precision::Confusion() || - // check directions are collinear - !anAxis->isParallel(aCurCyl->axis()) || - // check current center is on the main axis - anAxis->xyz()->cross(aLocation->xyz()->decreased(aCurCyl->location()->xyz()) - )->squareModulus() >= Precision::SquareConfusion()) { + // check directions are collinear + !anAxis->isParallel(aCurCyl->axis()) || + // check current center is on the main axis + anAxis->xyz() + ->cross( + aLocation->xyz()->decreased(aCurCyl->location()->xyz())) + ->squareModulus() >= Precision::SquareConfusion()) { isCylinder = false; break; } @@ -133,8 +134,8 @@ std::shared_ptr GeomAPI_Shell::getCylinder() const double aMaxHeight = aHeight; std::shared_ptr aCurCylLoc = aCurCyl->location()->xyz(); - std::shared_ptr aCurCylLocHeight = - aCurCylLoc->added(aCurCyl->axis()->xyz()->multiplied(aCurCyl->height())); + std::shared_ptr aCurCylLocHeight = aCurCylLoc->added( + aCurCyl->axis()->xyz()->multiplied(aCurCyl->height())); std::shared_ptr anAxisXYZ = anAxis->xyz(); @@ -163,13 +164,13 @@ std::shared_ptr GeomAPI_Shell::getCylinder() const GeomCylinderPtr aCylinder; if (isCylinder) - aCylinder = GeomCylinderPtr(new GeomAPI_Cylinder(aLocation, anAxis, aRadius, aHeight)); + aCylinder = GeomCylinderPtr( + new GeomAPI_Cylinder(aLocation, anAxis, aRadius, aHeight)); return aCylinder; } //================================================================================================= -std::shared_ptr GeomAPI_Shell::getCone() const -{ +std::shared_ptr GeomAPI_Shell::getCone() const { bool isCone = true; bool isFirstFace = true; @@ -178,7 +179,8 @@ std::shared_ptr GeomAPI_Shell::getCone() const double aSemiAngle = 0.0, aTanSemiAngle = 0.0; double aHeight1 = 0.0, aHeight2 = 0.0; - for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(anExp.Current())); @@ -196,13 +198,12 @@ std::shared_ptr GeomAPI_Shell::getCone() const aHeight1 = aCurCone->radius1() / aTanSemiAngle; aHeight2 = aCurCone->radius2() / aTanSemiAngle; isFirstFace = false; - } - else { + } else { // check equal locations if (anApex->distance(aCurCone->apex()) >= Precision::Confusion() || - // check equal angles + // check equal angles Abs(aSemiAngle - aCurCone->semiAngle()) >= Precision::Confusion() || - // check directions are collinear + // check directions are collinear !anAxis->isParallel(aCurCone->axis())) { isCone = false; break; @@ -229,23 +230,24 @@ std::shared_ptr GeomAPI_Shell::getCone() const GeomConePtr aCone; if (isCone) { GeomPointPtr aLocation(new GeomAPI_Pnt( - anApex->xyz()->added(anAxis->xyz()->multiplied(aHeight1)))); + anApex->xyz()->added(anAxis->xyz()->multiplied(aHeight1)))); double aRadius1 = aHeight1 * aTanSemiAngle; double aRadius2 = aHeight2 * aTanSemiAngle; - aCone = GeomConePtr(new GeomAPI_Cone(aLocation, anAxis, aSemiAngle, aRadius1, aRadius2)); + aCone = GeomConePtr( + new GeomAPI_Cone(aLocation, anAxis, aSemiAngle, aRadius1, aRadius2)); } return aCone; } //================================================================================================= -std::shared_ptr GeomAPI_Shell::getTorus() const -{ +std::shared_ptr GeomAPI_Shell::getTorus() const { bool isTorus = true; bool isFirstFace = true; GeomTorusPtr aTorus; - for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(anExp.Current())); @@ -258,14 +260,16 @@ std::shared_ptr GeomAPI_Shell::getTorus() const if (isFirstFace) { aTorus = aCurTorus; isFirstFace = false; - } - else { + } else { // compare radii - if (Abs(aTorus->majorRadius() - aCurTorus->majorRadius()) >= Precision::Confusion() || - Abs(aTorus->minorRadius() - aCurTorus->minorRadius()) >= Precision::Confusion() || - // check equal centers - aTorus->center()->distance(aCurTorus->center()) >= Precision::SquareConfusion() || - // check directions are collinear + if (Abs(aTorus->majorRadius() - aCurTorus->majorRadius()) >= + Precision::Confusion() || + Abs(aTorus->minorRadius() - aCurTorus->minorRadius()) >= + Precision::Confusion() || + // check equal centers + aTorus->center()->distance(aCurTorus->center()) >= + Precision::SquareConfusion() || + // check directions are collinear !aTorus->direction()->isParallel(aCurTorus->direction())) { isTorus = false; break; @@ -277,10 +281,8 @@ std::shared_ptr GeomAPI_Shell::getTorus() const } //================================================================================================= -std::shared_ptr GeomAPI_Shell::getParallelepiped() const -{ - struct Plane - { +std::shared_ptr GeomAPI_Shell::getParallelepiped() const { + struct Plane { std::shared_ptr myAxes; double myWidth; double myDepth; @@ -358,9 +360,8 @@ std::shared_ptr GeomAPI_Shell::getParallelepiped() const GeomPointPtr anOrigin = aPlanes[it->first].myAxes->origin(); GeomPointPtr aNeighbor = aPlanes[it->second].myAxes->origin(); - aPlanes[it->first].myHeight = - aPlanes[it->second].myHeight = - aNormal->xyz()->dot( aNeighbor->xyz()->decreased(anOrigin->xyz()) ); + aPlanes[it->first].myHeight = aPlanes[it->second].myHeight = + aNormal->xyz()->dot(aNeighbor->xyz()->decreased(anOrigin->xyz())); } // check if the box is oriented in the main axes @@ -374,19 +375,17 @@ std::shared_ptr GeomAPI_Shell::getParallelepiped() const } // construct a box - GeomBoxPtr aBox(new GeomAPI_Box(aPlanes[anIndex].myAxes, - aPlanes[anIndex].myWidth, - aPlanes[anIndex].myDepth, - aPlanes[anIndex].myHeight)); + GeomBoxPtr aBox( + new GeomAPI_Box(aPlanes[anIndex].myAxes, aPlanes[anIndex].myWidth, + aPlanes[anIndex].myDepth, aPlanes[anIndex].myHeight)); return aBox; } //================================================================================================= -GeomPointPtr GeomAPI_Shell::middlePoint() const -{ +GeomPointPtr GeomAPI_Shell::middlePoint() const { GeomPointPtr anInnerPoint; - const TopoDS_Shell& aShell = impl(); + const TopoDS_Shell &aShell = impl(); if (aShell.IsNull()) return anInnerPoint; diff --git a/src/GeomAPI/GeomAPI_Shell.h b/src/GeomAPI/GeomAPI_Shell.h index 978ef43eb..3e74748fe 100644 --- a/src/GeomAPI/GeomAPI_Shell.h +++ b/src/GeomAPI/GeomAPI_Shell.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Shell_H_ @@ -31,14 +32,13 @@ class GeomAPI_Box; /// \class GeomAPI_Shell /// \ingroup DataModel /// \brief Interface to the shell object -class GeomAPI_Shell: public GeomAPI_Shape -{ +class GeomAPI_Shell : public GeomAPI_Shape { public: /// Makes an undefined shell. GEOMAPI_EXPORT GeomAPI_Shell(); /// Creation of shell by the shell-shape - GEOMAPI_EXPORT GeomAPI_Shell(const std::shared_ptr& theShape); + GEOMAPI_EXPORT GeomAPI_Shell(const std::shared_ptr &theShape); /// Returns sphere if the shell consists only of faces /// which are based on the same spherical surface diff --git a/src/GeomAPI/GeomAPI_Solid.cpp b/src/GeomAPI/GeomAPI_Solid.cpp index 68fa9295e..6762e9dc9 100644 --- a/src/GeomAPI/GeomAPI_Solid.cpp +++ b/src/GeomAPI/GeomAPI_Solid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Solid.h" @@ -31,29 +32,25 @@ #include "GeomAPI_Torus.h" #include "GeomAPI_XYZ.h" -#include #include +#include #include #include #include #include //================================================================================================== -GeomAPI_Solid::GeomAPI_Solid() : GeomAPI_Shape() -{ -} +GeomAPI_Solid::GeomAPI_Solid() : GeomAPI_Shape() {} //================================================================================================== -GeomAPI_Solid::GeomAPI_Solid(const std::shared_ptr& theShape) -{ +GeomAPI_Solid::GeomAPI_Solid(const std::shared_ptr &theShape) { if (!theShape->isNull() && theShape->isSolid()) { setImpl(new TopoDS_Shape(theShape->impl())); } } //================================================================================================== -std::shared_ptr GeomAPI_Solid::getSphere() const -{ +std::shared_ptr GeomAPI_Solid::getSphere() const { GeomSpherePtr aSphere; ListOfShape aShells = subShapes(SHELL); if (aShells.size() == 1) @@ -62,8 +59,7 @@ std::shared_ptr GeomAPI_Solid::getSphere() const } //================================================================================================== -std::shared_ptr GeomAPI_Solid::getCylinder() const -{ +std::shared_ptr GeomAPI_Solid::getCylinder() const { bool isCylinder = false; GeomPointPtr aLocation; @@ -73,7 +69,8 @@ std::shared_ptr GeomAPI_Solid::getCylinder() const GeomPlanePtr aCaps[2]; - for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(anExp.Current())); @@ -82,30 +79,29 @@ std::shared_ptr GeomAPI_Solid::getCylinder() const if (isCylinder) { // at least one cylindrical face is found // compare radii if (Abs(aRadius - aCurCyl->radius()) >= Precision::Confusion() || - // check directions are collinear - !anAxis->isParallel(aCurCyl->axis()) || - // check current center is on the main axis - anAxis->xyz()->cross(aLocation->xyz()->decreased(aCurCyl->location()->xyz()) - )->squareModulus() >= Precision::SquareConfusion()) { + // check directions are collinear + !anAxis->isParallel(aCurCyl->axis()) || + // check current center is on the main axis + anAxis->xyz() + ->cross( + aLocation->xyz()->decreased(aCurCyl->location()->xyz())) + ->squareModulus() >= Precision::SquareConfusion()) { isCylinder = false; break; } - } - else { // first cylinder is found + } else { // first cylinder is found aLocation = aCurCyl->location(); if (anAxis) { // the plane is found => compare directions if (!anAxis->isParallel(aCurCyl->axis())) break; - } - else + } else anAxis = aCurCyl->axis(); aRadius = aCurCyl->radius(); aHeight = aCurCyl->height(); isCylinder = true; } - } - else { + } else { // check the face is planar bool isPlaneApplicable = false; GeomPlanePtr aCurPln = aFace->getPlane(); @@ -127,10 +123,10 @@ std::shared_ptr GeomAPI_Solid::getCylinder() const } if (isPlaneApplicable) { - if (!anAxis) // no cylinder is found, store the normal as further cylinder's axis + if (!anAxis) // no cylinder is found, store the normal as further + // cylinder's axis anAxis = aCurPln->direction(); - } - else { + } else { isCylinder = false; break; } @@ -146,8 +142,10 @@ std::shared_ptr GeomAPI_Solid::getCylinder() const // intersect planes with cylinder's axis std::shared_ptr anAxisXYZ = anAxis->xyz(); std::shared_ptr aLocationXYZ = aLocation->xyz(); - double aParam0 = anAxisXYZ->dot( aCaps[0]->location()->xyz()->decreased(aLocationXYZ) ); - double aParam1 = anAxisXYZ->dot( aCaps[1]->location()->xyz()->decreased(aLocationXYZ) ); + double aParam0 = + anAxisXYZ->dot(aCaps[0]->location()->xyz()->decreased(aLocationXYZ)); + double aParam1 = + anAxisXYZ->dot(aCaps[1]->location()->xyz()->decreased(aLocationXYZ)); if (aParam0 > aParam1 + Precision::Confusion()) { double tmp = aParam0; aParam0 = aParam1; @@ -161,14 +159,14 @@ std::shared_ptr GeomAPI_Solid::getCylinder() const aHeight = aParam1 - aParam0; - aCylinder = GeomCylinderPtr(new GeomAPI_Cylinder(aLocation, anAxis, aRadius, aHeight)); + aCylinder = GeomCylinderPtr( + new GeomAPI_Cylinder(aLocation, anAxis, aRadius, aHeight)); } return aCylinder; } //================================================================================================== -std::shared_ptr GeomAPI_Solid::getCone() const -{ +std::shared_ptr GeomAPI_Solid::getCone() const { bool isCone = false; GeomPointPtr anApex; @@ -177,7 +175,8 @@ std::shared_ptr GeomAPI_Solid::getCone() const GeomPlanePtr aCaps[2]; - for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(anExp.Current())); @@ -186,28 +185,25 @@ std::shared_ptr GeomAPI_Solid::getCone() const if (isCone) { // at least one conical face is found // check equal apexes if (anApex->distance(aCurCone->apex()) >= Precision::Confusion() || - // check semi-angle + // check semi-angle Abs(aSemiAngle - aCurCone->semiAngle() >= Precision::Confusion()) || - // check axes are collinear + // check axes are collinear !anAxis->isParallel(aCurCone->axis())) { isCone = false; break; } - } - else { // first cone is found + } else { // first cone is found anApex = aCurCone->apex(); if (anAxis) { // the plane is found => compare directions if (!anAxis->isParallel(aCurCone->axis())) break; - } - else + } else anAxis = aCurCone->axis(); aSemiAngle = aCurCone->semiAngle(); isCone = true; } - } - else { + } else { // check the face is planar bool isPlaneApplicable = false; GeomPlanePtr aCurPln = aFace->getPlane(); @@ -229,10 +225,10 @@ std::shared_ptr GeomAPI_Solid::getCone() const } if (isPlaneApplicable) { - if (!anAxis) // no cone is found, store the normal as further cone's axis + if (!anAxis) // no cone is found, store the normal as further cone's + // axis anAxis = aCurPln->direction(); - } - else { + } else { isCone = false; break; } @@ -240,7 +236,8 @@ std::shared_ptr GeomAPI_Solid::getCone() const } isCone = isCone && aCaps[0] && aCaps[0]->direction()->isParallel(anAxis); - if (isCone && aCaps[1]) // cone map have only one cap, if it is bounded by the apex + if (isCone && + aCaps[1]) // cone map have only one cap, if it is bounded by the apex isCone = aCaps[1]->direction()->isParallel(anAxis); GeomConePtr aCone; @@ -248,9 +245,12 @@ std::shared_ptr GeomAPI_Solid::getCone() const // intersect planes with cone's axis std::shared_ptr anAxisXYZ = anAxis->xyz(); std::shared_ptr anApexXYZ = anApex->xyz(); - double aParam0 = anAxisXYZ->dot(aCaps[0]->location()->xyz()->decreased(anApexXYZ)); + double aParam0 = + anAxisXYZ->dot(aCaps[0]->location()->xyz()->decreased(anApexXYZ)); double aParam1 = - aCaps[1] ? anAxisXYZ->dot(aCaps[1]->location()->xyz()->decreased(anApexXYZ)) : 0.0; + aCaps[1] + ? anAxisXYZ->dot(aCaps[1]->location()->xyz()->decreased(anApexXYZ)) + : 0.0; if (aParam0 <= 0.0 && aParam1 <= 0.0) { // reverse axis to make smaller cap be the first anAxis->reverse(); @@ -264,23 +264,23 @@ std::shared_ptr GeomAPI_Solid::getCone() const } // calculate location of cone to be coincident with one of planes - GeomPointPtr aLocation(new GeomAPI_Pnt( - anApex->x() + aParam0 * anAxis->x(), - anApex->y() + aParam0 * anAxis->y(), - anApex->z() + aParam0 * anAxis->z())); + GeomPointPtr aLocation( + new GeomAPI_Pnt(anApex->x() + aParam0 * anAxis->x(), + anApex->y() + aParam0 * anAxis->y(), + anApex->z() + aParam0 * anAxis->z())); // calculate radii of caps aParam0 *= Tan(aSemiAngle); aParam1 *= Tan(aSemiAngle); - aCone = GeomConePtr(new GeomAPI_Cone(aLocation, anAxis, aSemiAngle, aParam0, aParam1)); + aCone = GeomConePtr( + new GeomAPI_Cone(aLocation, anAxis, aSemiAngle, aParam0, aParam1)); } return aCone; } //================================================================================================== -std::shared_ptr GeomAPI_Solid::getTorus() const -{ +std::shared_ptr GeomAPI_Solid::getTorus() const { GeomTorusPtr aTorus; ListOfShape aShells = subShapes(SHELL); if (aShells.size() == 1) @@ -289,8 +289,7 @@ std::shared_ptr GeomAPI_Solid::getTorus() const } //================================================================================================== -std::shared_ptr GeomAPI_Solid::getParallelepiped() const -{ +std::shared_ptr GeomAPI_Solid::getParallelepiped() const { GeomBoxPtr aBox; ListOfShape aShells = subShapes(SHELL); if (aShells.size() == 1) @@ -299,11 +298,10 @@ std::shared_ptr GeomAPI_Solid::getParallelepiped() const } //================================================================================================== -GeomPointPtr GeomAPI_Solid::middlePoint() const -{ +GeomPointPtr GeomAPI_Solid::middlePoint() const { GeomPointPtr anInnerPoint; - const TopoDS_Solid& aSolid = impl(); + const TopoDS_Solid &aSolid = impl(); if (aSolid.IsNull()) return anInnerPoint; diff --git a/src/GeomAPI/GeomAPI_Solid.h b/src/GeomAPI/GeomAPI_Solid.h index 07c76c4fa..e65b9a499 100644 --- a/src/GeomAPI/GeomAPI_Solid.h +++ b/src/GeomAPI/GeomAPI_Solid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Solid_H_ @@ -31,25 +32,24 @@ class GeomAPI_Box; /// \class GeomAPI_Solid /// \ingroup DataModel /// \brief Interface to the solid object -class GeomAPI_Solid: public GeomAPI_Shape -{ +class GeomAPI_Solid : public GeomAPI_Shape { public: /// Makes an undefined solid. GEOMAPI_EXPORT GeomAPI_Solid(); /// Creation of solid by the solid-shape - GEOMAPI_EXPORT GeomAPI_Solid(const std::shared_ptr& theShape); + GEOMAPI_EXPORT GeomAPI_Solid(const std::shared_ptr &theShape); /// Returns sphere if the solid is only bounded by faces /// which are based on the same spherical surface GEOMAPI_EXPORT std::shared_ptr getSphere() const; - /// Returns cylinder if the solid is bounded by faces based on the same cylindrical surface - /// and a pair of parallel planar faces + /// Returns cylinder if the solid is bounded by faces based on the same + /// cylindrical surface and a pair of parallel planar faces GEOMAPI_EXPORT std::shared_ptr getCylinder() const; - /// Returns cone if the solid is bounded by faces based on the same conical surface - /// and a pair of parallel planar faces + /// Returns cone if the solid is bounded by faces based on the same conical + /// surface and a pair of parallel planar faces GEOMAPI_EXPORT std::shared_ptr getCone() const; /// Returns torus if the shell solid is only bounded by faces diff --git a/src/GeomAPI/GeomAPI_Sphere.cpp b/src/GeomAPI/GeomAPI_Sphere.cpp index 3995e2f89..c8d656da2 100644 --- a/src/GeomAPI/GeomAPI_Sphere.cpp +++ b/src/GeomAPI/GeomAPI_Sphere.cpp @@ -14,36 +14,32 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #define MY_SPHERE implPtr() -static gp_Sphere* newSphere(const gp_Pnt& theCenter, const double theRadius) -{ +static gp_Sphere *newSphere(const gp_Pnt &theCenter, const double theRadius) { return new gp_Sphere(gp_Ax3(theCenter, gp::DZ()), theRadius); } //================================================================================================= -GeomAPI_Sphere::GeomAPI_Sphere(const std::shared_ptr& theCenter, double theRadius) - : GeomAPI_Interface(newSphere(theCenter->impl(), theRadius)) -{ -} +GeomAPI_Sphere::GeomAPI_Sphere(const std::shared_ptr &theCenter, + double theRadius) + : GeomAPI_Interface(newSphere(theCenter->impl(), theRadius)) {} //================================================================================================= -const std::shared_ptr GeomAPI_Sphere::center() const -{ - const gp_Pnt& aCenter = MY_SPHERE->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); +const std::shared_ptr GeomAPI_Sphere::center() const { + const gp_Pnt &aCenter = MY_SPHERE->Location(); + return std::shared_ptr( + new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); } //================================================================================================= -double GeomAPI_Sphere::radius() const -{ - return MY_SPHERE->Radius(); -} +double GeomAPI_Sphere::radius() const { return MY_SPHERE->Radius(); } diff --git a/src/GeomAPI/GeomAPI_Sphere.h b/src/GeomAPI/GeomAPI_Sphere.h index 670667325..91d18b3c1 100644 --- a/src/GeomAPI/GeomAPI_Sphere.h +++ b/src/GeomAPI/GeomAPI_Sphere.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Sphere_H_ @@ -29,12 +30,11 @@ class GeomAPI_Pnt; * \ingroup DataModel * \brief Spherical surface in 3D */ -class GeomAPI_Sphere : public GeomAPI_Interface -{ +class GeomAPI_Sphere : public GeomAPI_Interface { public: - /// Construct sphere by center and radius - GEOMAPI_EXPORT GeomAPI_Sphere(const std::shared_ptr& theCenter, double theRadius); + GEOMAPI_EXPORT GeomAPI_Sphere(const std::shared_ptr &theCenter, + double theRadius); /// Return center of the sphere GEOMAPI_EXPORT const std::shared_ptr center() const; diff --git a/src/GeomAPI/GeomAPI_Tools.cpp b/src/GeomAPI/GeomAPI_Tools.cpp index 68c56e1d7..9e824e305 100644 --- a/src/GeomAPI/GeomAPI_Tools.cpp +++ b/src/GeomAPI/GeomAPI_Tools.cpp @@ -14,19 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Tools.h" -#include "GeomAPI_Vertex.h" #include "GeomAPI_Edge.h" #include "GeomAPI_Face.h" +#include "GeomAPI_Vertex.h" #include "GeomAPI_Wire.h" //================================================================================================== -GeomShapePtr GeomAPI_Tools::getTypedShape(const GeomShapePtr& theShape) -{ +GeomShapePtr GeomAPI_Tools::getTypedShape(const GeomShapePtr &theShape) { if (!theShape.get()) return GeomShapePtr(); diff --git a/src/GeomAPI/GeomAPI_Tools.h b/src/GeomAPI/GeomAPI_Tools.h index 5c06aefc1..32763d026 100644 --- a/src/GeomAPI/GeomAPI_Tools.h +++ b/src/GeomAPI/GeomAPI_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Tools_H_ @@ -26,13 +27,13 @@ /// \class GeomAPI_Tools /// \ingroup DataModel /// \brief Provides auxiliary methods for shapes processing -class GeomAPI_Tools -{ +class GeomAPI_Tools { public: /// \brief Returns typed shape. /// \param[in] theShape the shape. /// \return shape of the corresponding type - GEOMAPI_EXPORT static GeomShapePtr getTypedShape(const GeomShapePtr& theShape); + GEOMAPI_EXPORT static GeomShapePtr + getTypedShape(const GeomShapePtr &theShape); }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAPI/GeomAPI_Torus.cpp b/src/GeomAPI/GeomAPI_Torus.cpp index 0554ef088..f1882ca78 100644 --- a/src/GeomAPI/GeomAPI_Torus.cpp +++ b/src/GeomAPI/GeomAPI_Torus.cpp @@ -14,56 +14,51 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include #include #define MY_TORUS implPtr() -static gp_Torus* newTorus(const gp_Pnt& theCenter, const gp_Dir& theDir, - const double theMajorRadius, const double theMinorRadius) -{ - return new gp_Torus(gp_Ax3(theCenter, theDir), theMajorRadius, theMinorRadius); +static gp_Torus *newTorus(const gp_Pnt &theCenter, const gp_Dir &theDir, + const double theMajorRadius, + const double theMinorRadius) { + return new gp_Torus(gp_Ax3(theCenter, theDir), theMajorRadius, + theMinorRadius); } //================================================================================================= -GeomAPI_Torus::GeomAPI_Torus(const std::shared_ptr& theCenter, - const std::shared_ptr& theDir, +GeomAPI_Torus::GeomAPI_Torus(const std::shared_ptr &theCenter, + const std::shared_ptr &theDir, const double theMajorRadius, const double theMinorRadius) - : GeomAPI_Interface( - newTorus(theCenter->impl(), theDir->impl(), theMajorRadius, theMinorRadius)) -{ -} + : GeomAPI_Interface(newTorus(theCenter->impl(), + theDir->impl(), theMajorRadius, + theMinorRadius)) {} //================================================================================================= -std::shared_ptr GeomAPI_Torus::center() const -{ - const gp_Pnt& aCenter = MY_TORUS->Location(); - return std::shared_ptr(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); +std::shared_ptr GeomAPI_Torus::center() const { + const gp_Pnt &aCenter = MY_TORUS->Location(); + return std::shared_ptr( + new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z())); } //================================================================================================= -std::shared_ptr GeomAPI_Torus::direction() const -{ - const gp_Dir& aDir = MY_TORUS->Axis().Direction(); - return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +std::shared_ptr GeomAPI_Torus::direction() const { + const gp_Dir &aDir = MY_TORUS->Axis().Direction(); + return std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); } //================================================================================================= -double GeomAPI_Torus::majorRadius() const -{ - return MY_TORUS->MajorRadius(); -} +double GeomAPI_Torus::majorRadius() const { return MY_TORUS->MajorRadius(); } //================================================================================================= -double GeomAPI_Torus::minorRadius() const -{ - return MY_TORUS->MinorRadius(); -} +double GeomAPI_Torus::minorRadius() const { return MY_TORUS->MinorRadius(); } diff --git a/src/GeomAPI/GeomAPI_Torus.h b/src/GeomAPI/GeomAPI_Torus.h index 6042c2a76..d3de2dd90 100644 --- a/src/GeomAPI/GeomAPI_Torus.h +++ b/src/GeomAPI/GeomAPI_Torus.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Torus_H_ @@ -30,12 +31,12 @@ class GeomAPI_Pnt; * \ingroup DataModel * \brief Toroidal surface in 3D */ -class GeomAPI_Torus : public GeomAPI_Interface -{ +class GeomAPI_Torus : public GeomAPI_Interface { public: - /// Creation of torus defined by center point, direction, major and minor radii - GEOMAPI_EXPORT GeomAPI_Torus(const std::shared_ptr& theCenter, - const std::shared_ptr& theDir, + /// Creation of torus defined by center point, direction, major and minor + /// radii + GEOMAPI_EXPORT GeomAPI_Torus(const std::shared_ptr &theCenter, + const std::shared_ptr &theDir, const double theMajorRadius, const double theMinorRadius); diff --git a/src/GeomAPI/GeomAPI_Trsf.cpp b/src/GeomAPI/GeomAPI_Trsf.cpp index 8114b0595..8d74c84ad 100644 --- a/src/GeomAPI/GeomAPI_Trsf.cpp +++ b/src/GeomAPI/GeomAPI_Trsf.cpp @@ -14,10 +14,11 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include #include #include @@ -32,49 +33,44 @@ #include //================================================================================================= -GeomAPI_Trsf::GeomAPI_Trsf() -: GeomAPI_Interface(new gp_Trsf()) -{ -} +GeomAPI_Trsf::GeomAPI_Trsf() : GeomAPI_Interface(new gp_Trsf()) {} //================================================================================================= -GeomAPI_Trsf::GeomAPI_Trsf(void* theTrsf) -: GeomAPI_Interface((gp_Trsf*)theTrsf) -{ -} +GeomAPI_Trsf::GeomAPI_Trsf(void *theTrsf) + : GeomAPI_Interface((gp_Trsf *)theTrsf) {} //================================================================================================= void GeomAPI_Trsf::setTranslation(const std::shared_ptr theAxis, - const double theDistance) -{ - MY_TRSF->SetTranslation(gp_Vec(theAxis->impl().Direction()) * theDistance); + const double theDistance) { + MY_TRSF->SetTranslation(gp_Vec(theAxis->impl().Direction()) * + theDistance); } //================================================================================================= -void GeomAPI_Trsf::setTranslation(const double theDx, const double theDy, const double theDz) -{ +void GeomAPI_Trsf::setTranslation(const double theDx, const double theDy, + const double theDz) { MY_TRSF->SetTranslation(gp_Vec(theDx, theDy, theDz)); } //================================================================================================= -void GeomAPI_Trsf::setTranslation(const std::shared_ptr theStartPoint, - const std::shared_ptr theEndPoint) -{ - MY_TRSF->SetTranslation(theStartPoint->impl(), theEndPoint->impl()); +void GeomAPI_Trsf::setTranslation( + const std::shared_ptr theStartPoint, + const std::shared_ptr theEndPoint) { + MY_TRSF->SetTranslation(theStartPoint->impl(), + theEndPoint->impl()); } //================================================================================================= void GeomAPI_Trsf::setRotation(const std::shared_ptr theAxis, - const double theAngle) -{ + const double theAngle) { MY_TRSF->SetRotation(theAxis->impl(), theAngle / 180.0 * M_PI); } //================================================================================================= -void GeomAPI_Trsf::setRotation(const std::shared_ptr theCenterPoint, - const std::shared_ptr theStartPoint, - const std::shared_ptr theEndPoint) -{ +void GeomAPI_Trsf::setRotation( + const std::shared_ptr theCenterPoint, + const std::shared_ptr theStartPoint, + const std::shared_ptr theEndPoint) { gp_Pnt aCenterPoint = theCenterPoint->impl(); gp_Pnt aStartPoint = theStartPoint->impl(); gp_Pnt aEndPoint = theEndPoint->impl(); @@ -84,32 +80,29 @@ void GeomAPI_Trsf::setRotation(const std::shared_ptr theCenterPoint gp_Dir aDir(aVec1 ^ aVec2); gp_Ax1 anAxis(aCenterPoint, aDir); double anAngle = aVec1.Angle(aVec2); - if (fabs(anAngle) < Precision::Angular()) anAngle += 2.*M_PI; // Taken from old GEOM code + if (fabs(anAngle) < Precision::Angular()) + anAngle += 2. * M_PI; // Taken from old GEOM code MY_TRSF->SetRotation(anAxis, anAngle); } //================================================================================================= -void GeomAPI_Trsf::setSymmetry(const std::shared_ptr thePoint) -{ +void GeomAPI_Trsf::setSymmetry(const std::shared_ptr thePoint) { MY_TRSF->SetMirror(thePoint->impl()); } //================================================================================================= -void GeomAPI_Trsf::setSymmetry(const std::shared_ptr theAxis) -{ +void GeomAPI_Trsf::setSymmetry(const std::shared_ptr theAxis) { MY_TRSF->SetMirror(theAxis->impl()); } //================================================================================================= -void GeomAPI_Trsf::setSymmetry(const std::shared_ptr thePlane) -{ +void GeomAPI_Trsf::setSymmetry(const std::shared_ptr thePlane) { MY_TRSF->SetMirror(thePlane->impl()); } //================================================================================================= -void GeomAPI_Trsf::setScale(const std::shared_ptr& theCenter, - const double theScale) -{ +void GeomAPI_Trsf::setScale(const std::shared_ptr &theCenter, + const double theScale) { MY_TRSF->SetScale(theCenter->impl(), theScale); } diff --git a/src/GeomAPI/GeomAPI_Trsf.h b/src/GeomAPI/GeomAPI_Trsf.h index fa765c2b1..0de3d7b6e 100644 --- a/src/GeomAPI/GeomAPI_Trsf.h +++ b/src/GeomAPI/GeomAPI_Trsf.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Trsf_H_ @@ -32,13 +33,12 @@ class GeomAPI_Pnt; * \brief Keep the transformation matrix coefficients */ -class GeomAPI_Trsf : public GeomAPI_Interface -{ - public: +class GeomAPI_Trsf : public GeomAPI_Interface { +public: /// Keeps no transformation, it may be set by setImpl GEOMAPI_EXPORT GeomAPI_Trsf(); /// Takes the pointer to existing transformation - GEOMAPI_EXPORT GeomAPI_Trsf(void* theTrsf); + GEOMAPI_EXPORT GeomAPI_Trsf(void *theTrsf); /** \brief Sets a translation transformation. * \param[in] theAxis translation axis. @@ -52,16 +52,16 @@ class GeomAPI_Trsf : public GeomAPI_Interface * \param[in] theDy y coordinate of the translation vector * \param[in] theDz z coordinate of the translation vector */ - GEOMAPI_EXPORT void setTranslation(const double theDx, - const double theDy, + GEOMAPI_EXPORT void setTranslation(const double theDx, const double theDy, const double theDz); /** \brief Sets a translation transformation using two points. * \param[in] theStartPoint Start point of the translation vector. * \param[in] theEndPoint End point of the translation vector. */ - GEOMAPI_EXPORT void setTranslation(const std::shared_ptr theStartPoint, - const std::shared_ptr theEndPoint); + GEOMAPI_EXPORT void + setTranslation(const std::shared_ptr theStartPoint, + const std::shared_ptr theEndPoint); /** \brief Sets a rotation transformation. * \param[in] theAxis rotation axis. @@ -75,9 +75,10 @@ class GeomAPI_Trsf : public GeomAPI_Interface * \param[in] theStartPoint start rotation point. * \param[in] theEndPoint end rotation point. */ - GEOMAPI_EXPORT void setRotation(const std::shared_ptr theCenterPoint, - const std::shared_ptr theStartPoint, - const std::shared_ptr theEndPoint); + GEOMAPI_EXPORT void + setRotation(const std::shared_ptr theCenterPoint, + const std::shared_ptr theStartPoint, + const std::shared_ptr theEndPoint); /** \brief Sets a point symmetry transformation. * \param[in] thePoint symmetry point. @@ -98,7 +99,7 @@ class GeomAPI_Trsf : public GeomAPI_Interface * \param[in] theCenter scaling origin. * \param[in] theScale scaling factor. */ - GEOMAPI_EXPORT void setScale(const std::shared_ptr& theCenter, + GEOMAPI_EXPORT void setScale(const std::shared_ptr &theCenter, const double theScale); }; @@ -106,4 +107,3 @@ class GeomAPI_Trsf : public GeomAPI_Interface typedef std::shared_ptr GeomTrsfPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Vertex.cpp b/src/GeomAPI/GeomAPI_Vertex.cpp index adb04beee..9417314ab 100644 --- a/src/GeomAPI/GeomAPI_Vertex.cpp +++ b/src/GeomAPI/GeomAPI_Vertex.cpp @@ -14,65 +14,61 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include +#include +#include -#include -#include +#include +#include +#include #include +#include +#include #include -#include -#include #include -#include -static TopoDS_Shape* buildVertex(const gp_Pnt& thePoint) -{ +static TopoDS_Shape *buildVertex(const gp_Pnt &thePoint) { TopoDS_Vertex aVertex; BRep_Builder aBuilder; aBuilder.MakeVertex(aVertex, thePoint, Precision::Confusion()); return new TopoDS_Shape(aVertex); } -GeomAPI_Vertex::GeomAPI_Vertex() - : GeomAPI_Shape() -{ -} +GeomAPI_Vertex::GeomAPI_Vertex() : GeomAPI_Shape() {} -GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr& theShape) -{ +GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr &theShape) { if (!theShape->isNull() && theShape->isVertex()) { setImpl(new TopoDS_Shape(theShape->impl())); } } -GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr& thePoint) -{ +GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr &thePoint) { setImpl(buildVertex(thePoint->impl())); } -GeomAPI_Vertex::GeomAPI_Vertex(double theX, double theY, double theZ) -{ +GeomAPI_Vertex::GeomAPI_Vertex(double theX, double theY, double theZ) { setImpl(buildVertex(gp_Pnt(theX, theY, theZ))); } -std::shared_ptr GeomAPI_Vertex::point() -{ - const TopoDS_Shape& aShape = const_cast(this)->impl(); +std::shared_ptr GeomAPI_Vertex::point() { + const TopoDS_Shape &aShape = + const_cast(this)->impl(); TopoDS_Vertex aVertex = TopoDS::Vertex(aShape); gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); - return std::shared_ptr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); } -bool GeomAPI_Vertex::isEqual(const std::shared_ptr theVert) const -{ - if (!theVert.get() || ! theVert->isVertex()) +bool GeomAPI_Vertex::isEqual( + const std::shared_ptr theVert) const { + if (!theVert.get() || !theVert->isVertex()) return false; - const TopoDS_Shape& aMyShape = const_cast(this)->impl(); - const TopoDS_Shape& aInShape = theVert->impl(); + const TopoDS_Shape &aMyShape = + const_cast(this)->impl(); + const TopoDS_Shape &aInShape = theVert->impl(); if (aMyShape.ShapeType() != aInShape.ShapeType()) return false; @@ -86,13 +82,10 @@ bool GeomAPI_Vertex::isEqual(const std::shared_ptr theVert) const return aPoint1.IsEqual(aPoint2, Precision::Confusion()) == Standard_True; } - - -bool GeomAPI_Vertex::GeometricComparator::operator()(const GeomVertexPtr& theVertex1, - const GeomVertexPtr& theVertex2) const -{ - const TopoDS_Vertex& aVertex1 = theVertex1->impl(); - const TopoDS_Vertex& aVertex2 = theVertex2->impl(); +bool GeomAPI_Vertex::GeometricComparator::operator()( + const GeomVertexPtr &theVertex1, const GeomVertexPtr &theVertex2) const { + const TopoDS_Vertex &aVertex1 = theVertex1->impl(); + const TopoDS_Vertex &aVertex2 = theVertex2->impl(); gp_Pnt aPnt1 = BRep_Tool::Pnt(aVertex1); gp_Pnt aPnt2 = BRep_Tool::Pnt(aVertex2); diff --git a/src/GeomAPI/GeomAPI_Vertex.h b/src/GeomAPI/GeomAPI_Vertex.h index ad8b9f503..a90dbdbf4 100644 --- a/src/GeomAPI/GeomAPI_Vertex.h +++ b/src/GeomAPI/GeomAPI_Vertex.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Vertex_H_ @@ -27,22 +28,21 @@ class GeomAPI_Pnt; /// \class GeomAPI_Vertex /// \ingroup DataModel /// \brief Interface to the vertex object. -class GeomAPI_Vertex: public GeomAPI_Shape -{ +class GeomAPI_Vertex : public GeomAPI_Shape { public: /// Creation of empty (null) shape. GEOMAPI_EXPORT GeomAPI_Vertex(); - /// Creation of vertex by the vertex-shape. + /// Creation of vertex by the vertex-shape. GEOMAPI_EXPORT - GeomAPI_Vertex(const std::shared_ptr& theShape); + GeomAPI_Vertex(const std::shared_ptr &theShape); /// Creation of vertex by the given point. GEOMAPI_EXPORT - GeomAPI_Vertex(const std::shared_ptr& thePoint); + GeomAPI_Vertex(const std::shared_ptr &thePoint); - /// Creation of vertex by 3d coordinates. + /// Creation of vertex by 3d coordinates. GEOMAPI_EXPORT GeomAPI_Vertex(double theX, double theY, double theZ); @@ -56,25 +56,23 @@ public: public: /// \brief Compare vertices geometrically - class GeometricComparator - { + class GeometricComparator { public: GEOMAPI_EXPORT - GeometricComparator(const double theTolerance = 1.e-7) : myTolerance(theTolerance) - {} + GeometricComparator(const double theTolerance = 1.e-7) + : myTolerance(theTolerance) {} /// Return \c true if the first vertex is less than the second GEOMAPI_EXPORT - bool operator ()(const std::shared_ptr& theVertex1, - const std::shared_ptr& theVertex2) const; + bool operator()(const std::shared_ptr &theVertex1, + const std::shared_ptr &theVertex2) const; + private: double myTolerance; }; - }; //! Pointer on the object typedef std::shared_ptr GeomVertexPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_Wire.cpp b/src/GeomAPI/GeomAPI_Wire.cpp index 1ef0fb365..d130c6266 100644 --- a/src/GeomAPI/GeomAPI_Wire.cpp +++ b/src/GeomAPI/GeomAPI_Wire.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAPI_Wire.h" #include "GeomAPI_Pnt.h" -#include #include +#include #include #include #include @@ -30,9 +31,8 @@ #include //================================================================================================== -GeomAPI_Wire::GeomAPI_Wire() -{ - TopoDS_Wire* aWire = new TopoDS_Wire(); +GeomAPI_Wire::GeomAPI_Wire() { + TopoDS_Wire *aWire = new TopoDS_Wire(); BRep_Builder aBuilder; aBuilder.MakeWire(*aWire); @@ -41,35 +41,33 @@ GeomAPI_Wire::GeomAPI_Wire() } //================================================================================================== -GeomAPI_Wire::GeomAPI_Wire(const std::shared_ptr& theShape) -{ +GeomAPI_Wire::GeomAPI_Wire(const std::shared_ptr &theShape) { if (!theShape->isNull() && theShape->isWire()) { setImpl(new TopoDS_Shape(theShape->impl())); } } //================================================================================================== -bool GeomAPI_Wire::isClosed() const -{ +bool GeomAPI_Wire::isClosed() const { return BRep_Tool::IsClosed(impl()); } //================================================================================================== -bool GeomAPI_Wire::isPolygon(std::list& thePoints) const -{ - const TopoDS_Wire& aWire = TopoDS::Wire(impl()); +bool GeomAPI_Wire::isPolygon(std::list &thePoints) const { + const TopoDS_Wire &aWire = TopoDS::Wire(impl()); bool isPolygon = true; - const Handle(Standard_Type)& aLineType = STANDARD_TYPE(Geom_Line); - for (BRepTools_WireExplorer anExp(aWire); anExp.More() && isPolygon; anExp.Next()) { - const TopoDS_Edge& anEdge = anExp.Current(); + const Handle(Standard_Type) &aLineType = STANDARD_TYPE(Geom_Line); + for (BRepTools_WireExplorer anExp(aWire); anExp.More() && isPolygon; + anExp.Next()) { + const TopoDS_Edge &anEdge = anExp.Current(); double aT1, aT2; Handle(Geom_Curve) aC3D = BRep_Tool::Curve(anEdge, aT1, aT2); if (!aC3D.IsNull() && aC3D->IsKind(aLineType)) { gp_Pnt aCorner = BRep_Tool::Pnt(anExp.CurrentVertex()); - thePoints.push_back(GeomPointPtr(new GeomAPI_Pnt(aCorner.X(), aCorner.Y(), aCorner.Z()))); - } - else + thePoints.push_back( + GeomPointPtr(new GeomAPI_Pnt(aCorner.X(), aCorner.Y(), aCorner.Z()))); + } else isPolygon = false; } @@ -79,18 +77,18 @@ bool GeomAPI_Wire::isPolygon(std::list& thePoints) const } //================================================================================================== -bool GeomAPI_Wire::isRectangle(std::list& thePoints) const -{ +bool GeomAPI_Wire::isRectangle(std::list &thePoints) const { thePoints.clear(); - const TopoDS_Wire& aWire = TopoDS::Wire(impl()); - const Handle(Standard_Type)& aLineType = STANDARD_TYPE(Geom_Line); - const Handle(Standard_Type)& aTrimmedCurveType = STANDARD_TYPE(Geom_TrimmedCurve); + const TopoDS_Wire &aWire = TopoDS::Wire(impl()); + const Handle(Standard_Type) &aLineType = STANDARD_TYPE(Geom_Line); + const Handle(Standard_Type) &aTrimmedCurveType = + STANDARD_TYPE(Geom_TrimmedCurve); gp_XYZ aPrevDir(0, 0, 0); for (BRepTools_WireExplorer anExp(aWire); anExp.More(); anExp.Next()) { - const TopoDS_Edge& anEdge = anExp.Current(); + const TopoDS_Edge &anEdge = anExp.Current(); double aT1, aT2; Handle(Geom_Curve) aC3D = BRep_Tool::Curve(anEdge, aT1, aT2); if (aC3D.IsNull()) @@ -99,9 +97,9 @@ bool GeomAPI_Wire::isRectangle(std::list& thePoints) const aC3D = Handle(Geom_TrimmedCurve)::DownCast(aC3D)->BasisCurve(); if (!aC3D.IsNull() && aC3D->IsKind(aLineType)) { gp_Pnt aCorner = BRep_Tool::Pnt(anExp.CurrentVertex()); - thePoints.push_back(GeomPointPtr(new GeomAPI_Pnt(aCorner.X(), aCorner.Y(), aCorner.Z()))); - } - else + thePoints.push_back( + GeomPointPtr(new GeomAPI_Pnt(aCorner.X(), aCorner.Y(), aCorner.Z()))); + } else return false; if (thePoints.size() > 4) @@ -125,8 +123,7 @@ bool GeomAPI_Wire::isRectangle(std::list& thePoints) const } //================================================================================================== -GeomPointPtr GeomAPI_Wire::middlePoint() const -{ +GeomPointPtr GeomAPI_Wire::middlePoint() const { // find middle edge in the wire std::list aSubs = subShapes(EDGE); size_t aNbSubs = aSubs.size(); diff --git a/src/GeomAPI/GeomAPI_Wire.h b/src/GeomAPI/GeomAPI_Wire.h index 770723112..47c6d5b57 100644 --- a/src/GeomAPI/GeomAPI_Wire.h +++ b/src/GeomAPI/GeomAPI_Wire.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_Wire_H_ @@ -27,25 +28,26 @@ class GeomAPI_Pnt; /// \class GeomAPI_Wire /// \ingroup DataModel /// \brief Interface to the wire object -class GeomAPI_Wire: public GeomAPI_Shape -{ +class GeomAPI_Wire : public GeomAPI_Shape { public: /// Makes an undefined Wire. GEOMAPI_EXPORT GeomAPI_Wire(); /// Creation of wire by the wire-shape - GEOMAPI_EXPORT GeomAPI_Wire(const std::shared_ptr& theShape); + GEOMAPI_EXPORT GeomAPI_Wire(const std::shared_ptr &theShape); /// Returns "closed" status of the wire GEOMAPI_EXPORT bool isClosed() const; /// Returns \c true if the wire is a polygon /// \param[out] thePoints vertices of the polygon - GEOMAPI_EXPORT bool isPolygon(std::list >& thePoints) const; + GEOMAPI_EXPORT bool + isPolygon(std::list> &thePoints) const; /// Returns \c true if the wire is a rectangle /// \param[out] thePoints corners of the rectangle - GEOMAPI_EXPORT bool isRectangle(std::list >& thePoints) const; + GEOMAPI_EXPORT bool + isRectangle(std::list> &thePoints) const; /// Return middle point on the wire GEOMAPI_EXPORT virtual std::shared_ptr middlePoint() const; diff --git a/src/GeomAPI/GeomAPI_WireExplorer.cpp b/src/GeomAPI/GeomAPI_WireExplorer.cpp index 5c6e30975..d02cfb5aa 100644 --- a/src/GeomAPI/GeomAPI_WireExplorer.cpp +++ b/src/GeomAPI/GeomAPI_WireExplorer.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -28,47 +29,34 @@ #define MY_EXPLORER implPtr() GeomAPI_WireExplorer::GeomAPI_WireExplorer() - : GeomAPI_Interface(new BRepTools_WireExplorer()) -{ -} + : GeomAPI_Interface(new BRepTools_WireExplorer()) {} -GeomAPI_WireExplorer::GeomAPI_WireExplorer(const GeomWirePtr& theWire) - : GeomAPI_Interface(new BRepTools_WireExplorer(theWire->impl())) -{ -} +GeomAPI_WireExplorer::GeomAPI_WireExplorer(const GeomWirePtr &theWire) + : GeomAPI_Interface( + new BRepTools_WireExplorer(theWire->impl())) {} -void GeomAPI_WireExplorer::init(const GeomWirePtr& theWire) -{ +void GeomAPI_WireExplorer::init(const GeomWirePtr &theWire) { MY_EXPLORER->Init(theWire->impl()); } -bool GeomAPI_WireExplorer::more() const -{ +bool GeomAPI_WireExplorer::more() const { return MY_EXPLORER->More() == Standard_True; } -void GeomAPI_WireExplorer::next() -{ - MY_EXPLORER->Next(); -} +void GeomAPI_WireExplorer::next() { MY_EXPLORER->Next(); } -std::shared_ptr GeomAPI_WireExplorer::current() -{ - const TopoDS_Edge& aShape = MY_EXPLORER->Current(); +std::shared_ptr GeomAPI_WireExplorer::current() { + const TopoDS_Edge &aShape = MY_EXPLORER->Current(); std::shared_ptr aGeomShape(new GeomAPI_Edge()); aGeomShape->setImpl(new TopoDS_Edge(aShape)); return aGeomShape; } -std::shared_ptr GeomAPI_WireExplorer::currentVertex() -{ - const TopoDS_Vertex& aShape = MY_EXPLORER->CurrentVertex(); +std::shared_ptr GeomAPI_WireExplorer::currentVertex() { + const TopoDS_Vertex &aShape = MY_EXPLORER->CurrentVertex(); std::shared_ptr aGeomShape(new GeomAPI_Vertex()); aGeomShape->setImpl(new TopoDS_Vertex(aShape)); return aGeomShape; } -void GeomAPI_WireExplorer::clear() -{ - MY_EXPLORER->Clear(); -} +void GeomAPI_WireExplorer::clear() { MY_EXPLORER->Clear(); } diff --git a/src/GeomAPI/GeomAPI_WireExplorer.h b/src/GeomAPI/GeomAPI_WireExplorer.h index df7bc8f68..8c2a12985 100644 --- a/src/GeomAPI/GeomAPI_WireExplorer.h +++ b/src/GeomAPI/GeomAPI_WireExplorer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_WireExplorer_H_ @@ -30,23 +31,25 @@ class GeomAPI_Wire; /** \class GeomAPI_WireExplorer * \ingroup DataModel - * \brief This class is used to explore edges of wire in the order of connectivity. + * \brief This class is used to explore edges of wire in the order of + * connectivity. */ -class GeomAPI_WireExplorer : public GeomAPI_Interface -{ +class GeomAPI_WireExplorer : public GeomAPI_Interface { public: - /// Default constructor. Creates an empty explorer, becomes usefull after Init. + /// Default constructor. Creates an empty explorer, becomes usefull after + /// Init. GEOMAPI_EXPORT GeomAPI_WireExplorer(); /** \brief Constructs an iterator on a wire. * \param[in] theWire a wire to explore. */ - GEOMAPI_EXPORT GeomAPI_WireExplorer(const std::shared_ptr& theWire); + GEOMAPI_EXPORT + GeomAPI_WireExplorer(const std::shared_ptr &theWire); /** \brief Resets this explorer. * \param[in] theWire a wire to explore. */ - GEOMAPI_EXPORT void init(const std::shared_ptr& theWire); + GEOMAPI_EXPORT void init(const std::shared_ptr &theWire); /// \return true if there are more shapes in the exploration. GEOMAPI_EXPORT bool more() const; @@ -67,4 +70,4 @@ public: GEOMAPI_EXPORT void clear(); }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAPI/GeomAPI_XY.cpp b/src/GeomAPI/GeomAPI_XY.cpp index 1fc24aece..55f9e1131 100644 --- a/src/GeomAPI/GeomAPI_XY.cpp +++ b/src/GeomAPI/GeomAPI_XY.cpp @@ -14,74 +14,56 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include -#include +#include #define MY_XY implPtr() GeomAPI_XY::GeomAPI_XY(const double theX, const double theY) - : GeomAPI_Interface(new gp_XY(theX, theY)) -{ -} + : GeomAPI_Interface(new gp_XY(theX, theY)) {} -double GeomAPI_XY::x() const -{ - return MY_XY->X(); -} +double GeomAPI_XY::x() const { return MY_XY->X(); } -double GeomAPI_XY::y() const -{ - return MY_XY->Y(); -} +double GeomAPI_XY::y() const { return MY_XY->Y(); } -void GeomAPI_XY::setX(const double theX) -{ - return MY_XY->SetX(theX); -} +void GeomAPI_XY::setX(const double theX) { return MY_XY->SetX(theX); } -void GeomAPI_XY::setY(const double theY) -{ - return MY_XY->SetY(theY); -} +void GeomAPI_XY::setY(const double theY) { return MY_XY->SetY(theY); } -const std::shared_ptr GeomAPI_XY::added(const std::shared_ptr& theArg) -{ - std::shared_ptr aResult(new GeomAPI_XY( - MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y())); +const std::shared_ptr +GeomAPI_XY::added(const std::shared_ptr &theArg) { + std::shared_ptr aResult( + new GeomAPI_XY(MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y())); return aResult; } -const std::shared_ptr GeomAPI_XY::decreased( - const std::shared_ptr& theArg) -{ - std::shared_ptr aResult(new GeomAPI_XY( - MY_XY->X() - theArg->x(), MY_XY->Y() - theArg->y())); +const std::shared_ptr +GeomAPI_XY::decreased(const std::shared_ptr &theArg) { + std::shared_ptr aResult( + new GeomAPI_XY(MY_XY->X() - theArg->x(), MY_XY->Y() - theArg->y())); return aResult; } -const std::shared_ptr GeomAPI_XY::multiplied(const double theArg) -{ - std::shared_ptr aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg)); +const std::shared_ptr GeomAPI_XY::multiplied(const double theArg) { + std::shared_ptr aResult( + new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg)); return aResult; } -double GeomAPI_XY::dot(const std::shared_ptr& theArg) const -{ +double GeomAPI_XY::dot(const std::shared_ptr &theArg) const { return MY_XY->Dot(theArg->impl()); } -double GeomAPI_XY::cross(const std::shared_ptr& theArg) const -{ +double GeomAPI_XY::cross(const std::shared_ptr &theArg) const { return MY_XY->Crossed(theArg->impl()); } -double GeomAPI_XY::distance(const std::shared_ptr& theOther) const -{ +double GeomAPI_XY::distance(const std::shared_ptr &theOther) const { gp_XY aResult(theOther->x() - x(), theOther->y() - y()); return aResult.Modulus(); } - diff --git a/src/GeomAPI/GeomAPI_XY.h b/src/GeomAPI/GeomAPI_XY.h index 1fcc7b074..489f00b3a 100644 --- a/src/GeomAPI/GeomAPI_XY.h +++ b/src/GeomAPI/GeomAPI_XY.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_XY_H_ @@ -28,9 +29,8 @@ * \brief 2 coordinates: they may represent vector or point or something else */ -class GeomAPI_XY : public GeomAPI_Interface -{ - public: +class GeomAPI_XY : public GeomAPI_Interface { +public: /// Creation by coordinates GEOMAPI_EXPORT GeomAPI_XY(const double theX, const double theY); @@ -51,25 +51,26 @@ class GeomAPI_XY : public GeomAPI_Interface /// result is sum of coordinates of this and the given argument GEOMAPI_EXPORT - const std::shared_ptr added(const std::shared_ptr& theArg); + const std::shared_ptr + added(const std::shared_ptr &theArg); /// result is difference between coordinates of this and the given argument GEOMAPI_EXPORT - const std::shared_ptr decreased(const std::shared_ptr& theArg); + const std::shared_ptr + decreased(const std::shared_ptr &theArg); /// result is coordinates multiplied by the argument GEOMAPI_EXPORT const std::shared_ptr multiplied(const double theArg); /// result is a scalar product of two triplets GEOMAPI_EXPORT - double dot(const std::shared_ptr& theArg) const; + double dot(const std::shared_ptr &theArg) const; /// result is a cross product of two triplets GEOMAPI_EXPORT - double cross(const std::shared_ptr& theArg) const; + double cross(const std::shared_ptr &theArg) const; /// Distance between two pairs GEOMAPI_EXPORT - double distance(const std::shared_ptr& theOther) const; + double distance(const std::shared_ptr &theOther) const; }; #endif - diff --git a/src/GeomAPI/GeomAPI_XYZ.cpp b/src/GeomAPI/GeomAPI_XYZ.cpp index 906d34b9f..a73f51a3e 100644 --- a/src/GeomAPI/GeomAPI_XYZ.cpp +++ b/src/GeomAPI/GeomAPI_XYZ.cpp @@ -14,92 +14,70 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include -#include +#include #define MY_XYZ implPtr() -GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ) - : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ)) -{ -} +GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, + const double theZ) + : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ)) {} -double GeomAPI_XYZ::x() const -{ - return MY_XYZ->X(); -} +double GeomAPI_XYZ::x() const { return MY_XYZ->X(); } -double GeomAPI_XYZ::y() const -{ - return MY_XYZ->Y(); -} +double GeomAPI_XYZ::y() const { return MY_XYZ->Y(); } -double GeomAPI_XYZ::z() const -{ - return MY_XYZ->Z(); -} +double GeomAPI_XYZ::z() const { return MY_XYZ->Z(); } -void GeomAPI_XYZ::setX(const double theX) -{ - return MY_XYZ->SetX(theX); -} +void GeomAPI_XYZ::setX(const double theX) { return MY_XYZ->SetX(theX); } -void GeomAPI_XYZ::setY(const double theY) -{ - return MY_XYZ->SetY(theY); -} +void GeomAPI_XYZ::setY(const double theY) { return MY_XYZ->SetY(theY); } -void GeomAPI_XYZ::setZ(const double theZ) -{ - return MY_XYZ->SetZ(theZ); -} +void GeomAPI_XYZ::setZ(const double theZ) { return MY_XYZ->SetZ(theZ); } -const std::shared_ptr GeomAPI_XYZ::added( - const std::shared_ptr& theArg) -{ - std::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(), - MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z())); +const std::shared_ptr +GeomAPI_XYZ::added(const std::shared_ptr &theArg) { + std::shared_ptr aResult( + new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(), MY_XYZ->Y() + theArg->y(), + MY_XYZ->Z() + theArg->z())); return aResult; } -const std::shared_ptr GeomAPI_XYZ::decreased( - const std::shared_ptr& theArg) -{ - std::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(), - MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z())); +const std::shared_ptr +GeomAPI_XYZ::decreased(const std::shared_ptr &theArg) { + std::shared_ptr aResult( + new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(), MY_XYZ->Y() - theArg->y(), + MY_XYZ->Z() - theArg->z())); return aResult; } -const std::shared_ptr GeomAPI_XYZ::multiplied(const double theArg) -{ - std::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg, - MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg)); +const std::shared_ptr +GeomAPI_XYZ::multiplied(const double theArg) { + std::shared_ptr aResult(new GeomAPI_XYZ( + MY_XYZ->X() * theArg, MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg)); return aResult; } -double GeomAPI_XYZ::dot(const std::shared_ptr& theArg) const -{ +double GeomAPI_XYZ::dot(const std::shared_ptr &theArg) const { return MY_XYZ->Dot(theArg->impl()); } -const std::shared_ptr GeomAPI_XYZ::cross( - const std::shared_ptr& theArg) const -{ +const std::shared_ptr +GeomAPI_XYZ::cross(const std::shared_ptr &theArg) const { gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl()); - return std::shared_ptr(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); + return std::shared_ptr( + new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); } -double GeomAPI_XYZ::distance(const std::shared_ptr& theOther) const -{ +double +GeomAPI_XYZ::distance(const std::shared_ptr &theOther) const { gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z()); return aResult.Modulus(); } -double GeomAPI_XYZ::squareModulus() const -{ - return MY_XYZ->SquareModulus(); -} +double GeomAPI_XYZ::squareModulus() const { return MY_XYZ->SquareModulus(); } diff --git a/src/GeomAPI/GeomAPI_XYZ.h b/src/GeomAPI/GeomAPI_XYZ.h index 27121397e..1f7634e26 100644 --- a/src/GeomAPI/GeomAPI_XYZ.h +++ b/src/GeomAPI/GeomAPI_XYZ.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAPI_XYZ_H_ @@ -28,9 +29,8 @@ * \brief 3 coordinates: they may represent vector or point or something else */ -class GeomAPI_XYZ : public GeomAPI_Interface -{ - public: +class GeomAPI_XYZ : public GeomAPI_Interface { +public: /// Creation by coordinates GEOMAPI_EXPORT GeomAPI_XYZ(const double theX, const double theY, const double theZ); @@ -57,24 +57,27 @@ class GeomAPI_XYZ : public GeomAPI_Interface /// result is sum of coordinates of this and the given argument GEOMAPI_EXPORT - const std::shared_ptr added(const std::shared_ptr& theArg); + const std::shared_ptr + added(const std::shared_ptr &theArg); /// result is difference between coordinates of this and the given argument GEOMAPI_EXPORT - const std::shared_ptr decreased(const std::shared_ptr& theArg); + const std::shared_ptr + decreased(const std::shared_ptr &theArg); /// result is coordinates multiplied by the argument GEOMAPI_EXPORT const std::shared_ptr multiplied(const double theArg); /// result is a scalar product of two triplets GEOMAPI_EXPORT - double dot(const std::shared_ptr& theArg) const; + double dot(const std::shared_ptr &theArg) const; /// result is a cross product of two triplets GEOMAPI_EXPORT - const std::shared_ptr cross(const std::shared_ptr& theArg) const; + const std::shared_ptr + cross(const std::shared_ptr &theArg) const; /// Distance between two triplets GEOMAPI_EXPORT - double distance(const std::shared_ptr& theOther) const; + double distance(const std::shared_ptr &theOther) const; /// Square length of triplet from the origin GEOMAPI_EXPORT double squareModulus() const; @@ -84,4 +87,3 @@ class GeomAPI_XYZ : public GeomAPI_Interface typedef std::shared_ptr GeomXYZPtr; #endif - diff --git a/src/GeomAPI/GeomAPI_swig.h b/src/GeomAPI/GeomAPI_swig.h index 17b61a2e7..d640af15a 100644 --- a/src/GeomAPI/GeomAPI_swig.h +++ b/src/GeomAPI/GeomAPI_swig.h @@ -14,73 +14,76 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_GEOMAPI_GEOMAPI_SWIG_H_ #define SRC_GEOMAPI_GEOMAPI_SWIG_H_ - #include "GeomAPI.h" - #include "GeomAPI_AISObject.h" - #include "GeomAPI_Angle.h" - #include "GeomAPI_Angle2d.h" - #include "GeomAPI_Ax1.h" - #include "GeomAPI_Ax2.h" - #include "GeomAPI_Ax3.h" - #include "GeomAPI_Box.h" - #include "GeomAPI_BSpline.h" - #include "GeomAPI_BSpline2d.h" - #include "GeomAPI_Circ.h" - #include "GeomAPI_Circ2d.h" - #include "GeomAPI_Cone.h" - #include "GeomAPI_Curve.h" - #include "GeomAPI_Cylinder.h" - #include "GeomAPI_DataMapOfShapeMapOfShapes.h" - #include "GeomAPI_DataMapOfShapeShape.h" - #include "GeomAPI_Dir.h" - #include "GeomAPI_Dir2d.h" - #include "GeomAPI_Edge.h" - #include "GeomAPI_Ellipse.h" - #include "GeomAPI_Ellipse2d.h" - #include "GeomAPI_Face.h" - #include "GeomAPI_ICustomPrs.h" - #include "GeomAPI_Interface.h" - #include "GeomAPI_IPresentable.h" - #include "GeomAPI_Lin.h" - #include "GeomAPI_Lin2d.h" - #include "GeomAPI_PlanarEdges.h" - #include "GeomAPI_Pln.h" - #include "GeomAPI_Pnt.h" - #include "GeomAPI_Pnt2d.h" - #include "GeomAPI_Shape.h" - #include "GeomAPI_ShapeExplorer.h" - #include "GeomAPI_ShapeIterator.h" - #include "GeomAPI_Shell.h" - #include "GeomAPI_Solid.h" - #include "GeomAPI_Sphere.h" - #include "GeomAPI_Torus.h" - #include "GeomAPI_Trsf.h" - #include "GeomAPI_Vertex.h" - #include "GeomAPI_Wire.h" - #include "GeomAPI_WireExplorer.h" - #include "GeomAPI_XY.h" - #include "GeomAPI_XYZ.h" +#include "GeomAPI.h" +#include "GeomAPI_AISObject.h" +#include "GeomAPI_Angle.h" +#include "GeomAPI_Angle2d.h" +#include "GeomAPI_Ax1.h" +#include "GeomAPI_Ax2.h" +#include "GeomAPI_Ax3.h" +#include "GeomAPI_BSpline.h" +#include "GeomAPI_BSpline2d.h" +#include "GeomAPI_Box.h" +#include "GeomAPI_Circ.h" +#include "GeomAPI_Circ2d.h" +#include "GeomAPI_Cone.h" +#include "GeomAPI_Curve.h" +#include "GeomAPI_Cylinder.h" +#include "GeomAPI_DataMapOfShapeMapOfShapes.h" +#include "GeomAPI_DataMapOfShapeShape.h" +#include "GeomAPI_Dir.h" +#include "GeomAPI_Dir2d.h" +#include "GeomAPI_Edge.h" +#include "GeomAPI_Ellipse.h" +#include "GeomAPI_Ellipse2d.h" +#include "GeomAPI_Face.h" +#include "GeomAPI_ICustomPrs.h" +#include "GeomAPI_IPresentable.h" +#include "GeomAPI_Interface.h" +#include "GeomAPI_Lin.h" +#include "GeomAPI_Lin2d.h" +#include "GeomAPI_PlanarEdges.h" +#include "GeomAPI_Pln.h" +#include "GeomAPI_Pnt.h" +#include "GeomAPI_Pnt2d.h" +#include "GeomAPI_Shape.h" +#include "GeomAPI_ShapeExplorer.h" +#include "GeomAPI_ShapeIterator.h" +#include "GeomAPI_Shell.h" +#include "GeomAPI_Solid.h" +#include "GeomAPI_Sphere.h" +#include "GeomAPI_Torus.h" +#include "GeomAPI_Trsf.h" +#include "GeomAPI_Vertex.h" +#include "GeomAPI_Wire.h" +#include "GeomAPI_WireExplorer.h" +#include "GeomAPI_XY.h" +#include "GeomAPI_XYZ.h" - #include - #include +#include +#include - #ifdef _MSC_VER - # pragma warning(disable: 4127) // conditional expression is constant - # pragma warning(disable: 4456) // declaration of variable hides previous local declaration - # pragma warning(disable: 4459) // declaration of variable hides global declaration - # pragma warning(disable: 4701) // potentially uninitialized local variable - # pragma warning(disable: 4703) // potentially uninitialized local pointer variable - #endif +#ifdef _MSC_VER +#pragma warning(disable : 4127) // conditional expression is constant +#pragma warning(disable : 4456) // declaration of variable hides previous local + // declaration +#pragma warning( \ + disable : 4459) // declaration of variable hides global declaration +#pragma warning(disable : 4701) // potentially uninitialized local variable +#pragma warning( \ + disable : 4703) // potentially uninitialized local pointer variable +#endif - template - std::shared_ptr shared_ptr_cast(std::shared_ptr theObject) - { - return std::dynamic_pointer_cast(theObject); - } +template +std::shared_ptr shared_ptr_cast(std::shared_ptr theObject) { + return std::dynamic_pointer_cast(theObject); +} #endif /* SRC_GEOMAPI_GEOMAPI_SWIG_H_ */ diff --git a/src/GeomAlgoAPI/CMakeLists.txt b/src/GeomAlgoAPI/CMakeLists.txt index 815f52f3d..076482673 100644 --- a/src/GeomAlgoAPI/CMakeLists.txt +++ b/src/GeomAlgoAPI/CMakeLists.txt @@ -241,4 +241,3 @@ ENDIF(WIN32) INSTALL(TARGETS _GeomAlgoAPI DESTINATION ${SHAPER_INSTALL_SWIG}) INSTALL(TARGETS GeomAlgoAPI DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG}) - diff --git a/src/GeomAlgoAPI/GeomAlgoAPI.h b/src/GeomAlgoAPI/GeomAlgoAPI.h index 9434a3d91..c25504b3b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_H @@ -22,13 +23,13 @@ #if defined GEOMALGOAPI_EXPORTS #if defined WIN32 -#define GEOMALGOAPI_EXPORT __declspec( dllexport ) +#define GEOMALGOAPI_EXPORT __declspec(dllexport) #else #define GEOMALGOAPI_EXPORT #endif #else #if defined WIN32 -#define GEOMALGOAPI_EXPORT __declspec( dllimport ) +#define GEOMALGOAPI_EXPORT __declspec(dllimport) #else #define GEOMALGOAPI_EXPORT #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp index 035961a98..e9cce2160 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -31,14 +32,12 @@ * */ //============================================================================= -bool BREPExport(const std::string& theFileName, - const std::string&, - const std::shared_ptr& theShape, - std::string& theError) -{ - #ifdef _DEBUG +bool BREPExport(const std::string &theFileName, const std::string &, + const std::shared_ptr &theShape, + std::string &theError) { +#ifdef _DEBUG std::cout << "Export BREP into file " << theFileName << std::endl; - #endif +#endif if (!theShape.get()) { theError = "BREP Export failed: An invalid argument"; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h index 1faaae619..b712b8c9f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_BREPEXPORT_H_ @@ -28,9 +29,9 @@ /// Implementation of the export BREP files algorithms GEOMALGOAPI_EXPORT -bool BREPExport(const std::string& theFileName, - const std::string& theFormatName, - const std::shared_ptr& theShape, - std::string& theError); +bool BREPExport(const std::string &theFileName, + const std::string &theFormatName, + const std::shared_ptr &theShape, + std::string &theError); #endif /* GEOMALGOAPI_BREPEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp index f4d68c234..9d205f1f2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -29,13 +30,12 @@ * */ //============================================================================= -std::shared_ptr BREPImport(const std::string& theFileName, - const std::string&, - std::string& theError) -{ - #ifdef _DEBUG +std::shared_ptr BREPImport(const std::string &theFileName, + const std::string &, + std::string &theError) { +#ifdef _DEBUG std::cout << "Import BREP from file " << theFileName << std::endl; - #endif +#endif TopoDS_Shape aShape; BRep_Builder aBuilder; BRepTools::Read(aShape, theFileName.c_str(), aBuilder); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h index 0bf419b70..7b6c33668 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_BREPIMPORT_H_ @@ -28,8 +29,8 @@ /// Implementation of the import BREP files algorithms GEOMALGOAPI_EXPORT -std::shared_ptr BREPImport(const std::string& theFileName, - const std::string& theFormatName, - std::string& theError); +std::shared_ptr BREPImport(const std::string &theFileName, + const std::string &theFormatName, + std::string &theError); #endif /* GEOMALGOAPI_BREPIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index e67193a13..9b8c02553 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Boolean.h" @@ -23,17 +24,15 @@ #include #include +#include #include #include -#include - //================================================================================================= -GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, - const GeomShapePtr theTool, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy/*= -1*/) -{ +GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean( + const GeomShapePtr theObject, const GeomShapePtr theTool, + const GeomAlgoAPI_Tools::BOPType theOperationType, + const double theFuzzy /*= -1*/) { ListOfShape aListWithObject, aListWithTool; aListWithObject.push_back(theObject); aListWithTool.push_back(theTool); @@ -41,70 +40,63 @@ GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, } //================================================================================================= -GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, - const ListOfShape& theTools, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy/*= -1*/) -{ +GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean( + const GeomShapePtr theObject, const ListOfShape &theTools, + const GeomAlgoAPI_Tools::BOPType theOperationType, + const double theFuzzy /*= -1*/) { ListOfShape aListWithObject; aListWithObject.push_back(theObject); build(aListWithObject, theTools, theOperationType, theFuzzy); } //================================================================================================= -GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const ListOfShape& theObjects, - const ListOfShape& theTools, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy/*= -1*/) -{ +GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean( + const ListOfShape &theObjects, const ListOfShape &theTools, + const GeomAlgoAPI_Tools::BOPType theOperationType, + const double theFuzzy /*= -1*/) { build(theObjects, theTools, theOperationType, theFuzzy); } - //================================================================================================= -void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, - const ListOfShape& theTools, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy) -{ +void GeomAlgoAPI_Boolean::build( + const ListOfShape &theObjects, const ListOfShape &theTools, + const GeomAlgoAPI_Tools::BOPType theOperationType, const double theFuzzy) { if (theObjects.empty() || theTools.empty()) { return; } // Getting objects. TopTools_ListOfShape anObjects; - for(ListOfShape::const_iterator - anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) - { + for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); + anObjectsIt != theObjects.end(); anObjectsIt++) { anObjects.Append((*anObjectsIt)->impl()); } // Getting tools. TopTools_ListOfShape aTools; - for(ListOfShape::const_iterator - aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) - { + for (ListOfShape::const_iterator aToolsIt = theTools.begin(); + aToolsIt != theTools.end(); aToolsIt++) { aTools.Append((*aToolsIt)->impl()); } // Creating boolean operation. - BOPAlgo_BOP* aBuilder = new BOPAlgo_BOP(); + BOPAlgo_BOP *aBuilder = new BOPAlgo_BOP(); switch (theOperationType) { - case GeomAlgoAPI_Tools::BOOL_CUT: { - aBuilder->SetOperation(BOPAlgo_CUT); - break; - } - case GeomAlgoAPI_Tools::BOOL_FUSE: { - aBuilder->SetOperation(BOPAlgo_FUSE); - break; - } - case GeomAlgoAPI_Tools::BOOL_COMMON: { - aBuilder->SetOperation(BOPAlgo_COMMON); - break; - } - default: { - return; - } + case GeomAlgoAPI_Tools::BOOL_CUT: { + aBuilder->SetOperation(BOPAlgo_CUT); + break; + } + case GeomAlgoAPI_Tools::BOOL_FUSE: { + aBuilder->SetOperation(BOPAlgo_FUSE); + break; + } + case GeomAlgoAPI_Tools::BOOL_COMMON: { + aBuilder->SetOperation(BOPAlgo_COMMON); + break; + } + default: { + return; + } } this->setImpl(aBuilder); this->setBuilderType(OCCT_BOPAlgo_Builder); @@ -127,16 +119,15 @@ void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, return; TopoDS_Shape aResult = aBuilder->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aResult)); ListOfShape aResults; - aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, - GeomAPI_Shape::COMPSOLID, - aResults); + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes( + aGeomShape, GeomAPI_Shape::COMPSOLID, aResults); aResult = aGeomShape->impl(); } @@ -154,35 +145,41 @@ static bool isHistoryType(TopAbs_ShapeEnum theType) { //================================================================================================= /// searches the corresponding result for theOld -static void searchResult(const TopoDS_Shape& theOld, const TopoDS_Shape& theResult, - BOPAlgo_BOP* theBuilder, TopTools_MapOfShape& theNews) -{ - if (theResult.ShapeType() == theOld.ShapeType()) { // check some sub-shape produces a sub-result +static void searchResult(const TopoDS_Shape &theOld, + const TopoDS_Shape &theResult, BOPAlgo_BOP *theBuilder, + TopTools_MapOfShape &theNews) { + if (theResult.ShapeType() == + theOld.ShapeType()) { // check some sub-shape produces a sub-result if (theOld.IsSame(theResult)) { theNews.Add(theResult); return; } // searching for new result by sub-shapes of aSubType type TopAbs_ShapeEnum aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1); - while(aSubType < TopAbs_VERTEX && !isHistoryType(aSubType)) + while (aSubType < TopAbs_VERTEX && !isHistoryType(aSubType)) aSubType = TopAbs_ShapeEnum(int(aSubType) + 1); if (aSubType == TopAbs_SHAPE) return; TopTools_MapOfShape aResSubs; - for(TopExp_Explorer aResExp(theResult, aSubType); aResExp.More(); aResExp.Next()) + for (TopExp_Explorer aResExp(theResult, aSubType); aResExp.More(); + aResExp.Next()) aResSubs.Add(aResExp.Current()); - for(TopExp_Explorer anExp(theOld, aSubType); anExp.More(); anExp.Next()) { - const TopTools_ListOfShape& aNewSubs = theBuilder->Modified(anExp.Current()); + for (TopExp_Explorer anExp(theOld, aSubType); anExp.More(); anExp.Next()) { + const TopTools_ListOfShape &aNewSubs = + theBuilder->Modified(anExp.Current()); // searching for this new sub in theResult - for(TopTools_ListIteratorOfListOfShape aNewSub(aNewSubs); aNewSub.More(); aNewSub.Next()) { + for (TopTools_ListIteratorOfListOfShape aNewSub(aNewSubs); aNewSub.More(); + aNewSub.Next()) { if (aResSubs.Contains(aNewSub.Value())) { theNews.Add(theResult); return; } } } - } else if (theResult.ShapeType() < theOld.ShapeType()) { // recursive search among sub-shapes - for(TopoDS_Iterator aSubResults(theResult); aSubResults.More(); aSubResults.Next()) { + } else if (theResult.ShapeType() < + theOld.ShapeType()) { // recursive search among sub-shapes + for (TopoDS_Iterator aSubResults(theResult); aSubResults.More(); + aSubResults.Next()) { searchResult(theOld, aSubResults.Value(), theBuilder, theNews); } } @@ -190,38 +187,44 @@ static void searchResult(const TopoDS_Shape& theOld, const TopoDS_Shape& theResu //================================================================================================= // check the shape is on the higher level of compound or compsolid -bool isInComp(const TopoDS_Shape& theComp, const TopoDS_Shape& theShape) { - if (theComp.ShapeType() == TopAbs_COMPOUND || theComp.ShapeType() == TopAbs_COMPSOLID) { - for(TopoDS_Iterator anIter(theComp); anIter.More(); anIter.Next()) { +bool isInComp(const TopoDS_Shape &theComp, const TopoDS_Shape &theShape) { + if (theComp.ShapeType() == TopAbs_COMPOUND || + theComp.ShapeType() == TopAbs_COMPSOLID) { + for (TopoDS_Iterator anIter(theComp); anIter.More(); anIter.Next()) { if (isInComp(anIter.Value(), theShape)) return true; } - } else return theShape.IsSame(theComp); + } else + return theShape.IsSame(theComp); return false; } //================================================================================================= /// make arguments of Fuse produce result shapes with "modified" evolution -void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape, ListOfShape& theNewShapes) -{ - BOPAlgo_BOP* aBuilder = this->implPtr(); - if (aBuilder->Operation() == BOPAlgo_FUSE) { // only for fuse and when old is and argument +void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape, + ListOfShape &theNewShapes) { + BOPAlgo_BOP *aBuilder = this->implPtr(); + if (aBuilder->Operation() == + BOPAlgo_FUSE) { // only for fuse and when old is and argument TopoDS_Shape anOld = theOldShape->impl(); - bool isOldComp = anOld.ShapeType() == TopAbs_COMPOUND || anOld.ShapeType() == TopAbs_COMPSOLID; + bool isOldComp = anOld.ShapeType() == TopAbs_COMPOUND || + anOld.ShapeType() == TopAbs_COMPSOLID; bool aFound = false; TopTools_ListIteratorOfListOfShape anIter(aBuilder->Arguments()); - for(; !aFound && anIter.More(); anIter.Next()) - aFound = anOld.IsSame(anIter.Value()) || (!isOldComp && isInComp(anIter.Value(), anOld)); - for(anIter.Initialize(aBuilder->Tools()); !aFound && anIter.More(); anIter.Next()) - aFound = anOld.IsSame(anIter.Value()) || (!isOldComp && isInComp(anIter.Value(), anOld)); + for (; !aFound && anIter.More(); anIter.Next()) + aFound = anOld.IsSame(anIter.Value()) || + (!isOldComp && isInComp(anIter.Value(), anOld)); + for (anIter.Initialize(aBuilder->Tools()); !aFound && anIter.More(); + anIter.Next()) + aFound = anOld.IsSame(anIter.Value()) || + (!isOldComp && isInComp(anIter.Value(), anOld)); if (aFound) { TopoDS_Shape aResult = aBuilder->Shape(); TopTools_MapOfShape aNewsMap; searchResult(anOld, aResult, aBuilder, aNewsMap); if (!aNewsMap.IsEmpty()) { - for(TopTools_MapIteratorOfMapOfShape aNewsIter(aNewsMap); - aNewsIter.More(); aNewsIter.Next()) - { + for (TopTools_MapIteratorOfMapOfShape aNewsIter(aNewsMap); + aNewsIter.More(); aNewsIter.Next()) { GeomShapePtr aShape(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(aNewsIter.Value())); theNewShapes.push_back(aShape); @@ -230,5 +233,6 @@ void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape, ListOfShape& } } } - GeomAlgoAPI_MakeShape::modified(theOldShape, theNewShapes); // default behavior + GeomAlgoAPI_MakeShape::modified(theOldShape, + theNewShapes); // default behavior } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h index ab7ae1577..e5181efa9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Boolean_H_ @@ -29,55 +30,55 @@ /// \class GeomAlgoAPI_Boolean /// \ingroup DataAlgo /// \brief Allows to perform of boolean operations -class GeomAlgoAPI_Boolean : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Boolean : public GeomAlgoAPI_MakeShape { public: - /// Constructor. /// \param[in] theObject the main object. /// \param[in] theTool the tool object. /// \param[in] theOperationType type of boolean operation. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is non-positive, the boolean operation will use a default + /// If the fuzzy value is non-positive, the boolean operation will + /// use a default // additional tolerance value of 1.e-5. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const GeomShapePtr theObject, - const GeomShapePtr theTool, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy = -1); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Boolean(const GeomShapePtr theObject, const GeomShapePtr theTool, + const GeomAlgoAPI_Tools::BOPType theOperationType, + const double theFuzzy = -1); /// Constructor. /// \param[in] theObject the main object. /// \param[in] theTools list of tools. /// \param[in] theOperationType type of boolean operation. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is non-positive, the boolean operation will use a default + /// If the fuzzy value is non-positive, the boolean operation will + /// use a default // additional tolerance value of 1.e-5. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const GeomShapePtr theObject, - const ListOfShape& theTools, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy = -1); - + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Boolean(const GeomShapePtr theObject, const ListOfShape &theTools, + const GeomAlgoAPI_Tools::BOPType theOperationType, + const double theFuzzy = -1); /// Constructor. /// \param[in] theObjects list of main objects. /// \param[in] theTools list of tools. /// \param[in] theOperationType type of boolean operation. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is non-positive, the boolean operation will use a default + /// If the fuzzy value is non-positive, the boolean operation will + /// use a default // additional tolerance value of 1.e-5. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const ListOfShape& theObjects, - const ListOfShape& theTools, - const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy = -1); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Boolean(const ListOfShape &theObjects, + const ListOfShape &theTools, + const GeomAlgoAPI_Tools::BOPType theOperationType, + const double theFuzzy = -1); /// Redefinition of the generic method for the Fuse problem: OCCT 30481 GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); private: /// Builds resulting shape. - void build(const ListOfShape& theObjects, - const ListOfShape& theTools, + void build(const ListOfShape &theObjects, const ListOfShape &theTools, const GeomAlgoAPI_Tools::BOPType theOperationType, const double theFuzzy); }; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.cpp index 4eea551ec..a64572184 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.cpp @@ -14,158 +14,159 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_BoundingBox.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 /** -* This function constructs and returns modified shape from the original one -* for singular cases. It is used for the method GetMinDistanceSingular. -* -* \param theShape the original shape -* \param theModifiedShape output parameter. The modified shape. -* \param theAddDist output parameter. The added distance for modified shape. -* \retval true if the shape is modified; false otherwise. -* -* \internal -*/ -Standard_Boolean ModifyShape(const TopoDS_Shape &theShape, - TopoDS_Shape &theModifiedShape, - Standard_Real &theAddDist) -{ + * This function constructs and returns modified shape from the original one + * for singular cases. It is used for the method GetMinDistanceSingular. + * + * \param theShape the original shape + * \param theModifiedShape output parameter. The modified shape. + * \param theAddDist output parameter. The added distance for modified shape. + * \retval true if the shape is modified; false otherwise. + * + * \internal + */ +Standard_Boolean ModifyShape(const TopoDS_Shape &theShape, + TopoDS_Shape &theModifiedShape, + Standard_Real &theAddDist) { TopExp_Explorer anExp; int nbf = 0; theAddDist = 0.; theModifiedShape.Nullify(); - for ( anExp.Init( theShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + for (anExp.Init(theShape, TopAbs_FACE); anExp.More(); anExp.Next()) { nbf++; theModifiedShape = anExp.Current(); } - if(nbf==1) { + if (nbf == 1) { TopoDS_Shape sh = theShape; - while(sh.ShapeType()==TopAbs_COMPOUND) { + while (sh.ShapeType() == TopAbs_COMPOUND) { TopoDS_Iterator it(sh); sh = it.Value(); } Handle(Geom_Surface) S = BRep_Tool::Surface(TopoDS::Face(theModifiedShape)); - if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) || - S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)) || - S->IsUPeriodic()) { + if (S->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) || + S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)) || S->IsUPeriodic()) { const Standard_Boolean isShell = - (sh.ShapeType()==TopAbs_SHELL || sh.ShapeType()==TopAbs_FACE); + (sh.ShapeType() == TopAbs_SHELL || sh.ShapeType() == TopAbs_FACE); if (!isShell && S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { - Handle(Geom_SphericalSurface) SS = Handle(Geom_SphericalSurface)::DownCast(S); + Handle(Geom_SphericalSurface) SS = + Handle(Geom_SphericalSurface)::DownCast(S); gp_Pnt PC = SS->Location(); - BRep_Builder B; - TopoDS_Vertex V; - B.MakeVertex(V,PC,1.e-7); - theModifiedShape = V; - theAddDist = SS->Radius(); - return Standard_True; - } - if (!isShell && S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) { - Handle(Geom_ToroidalSurface) TS = Handle(Geom_ToroidalSurface)::DownCast(S); - gp_Ax3 ax3 = TS->Position(); - Handle(Geom_Circle) C = new Geom_Circle(ax3.Ax2(),TS->MajorRadius()); - BRep_Builder B; - TopoDS_Edge E; - B.MakeEdge(E,C,1.e-7); - theModifiedShape = E; - theAddDist = TS->MinorRadius(); - return Standard_True; - } - - // non solid case or any periodic surface (Mantis 22454). - double U1,U2,V1,V2; - // changes for 0020677: EDF 1219 GEOM: MinDistance gives 0 instead of 20.88 - //S->Bounds(U1,U2,V1,V2); changed by - BRepTools::UVBounds(TopoDS::Face(theModifiedShape),U1,U2,V1,V2); - // end of changes for 020677 (dmv) - Handle(Geom_RectangularTrimmedSurface) TrS1 = - new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2); - Handle(Geom_RectangularTrimmedSurface) TrS2 = - new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2); - TopoDS_Shape aMShape; - - TopoDS_Face F1 = BRepBuilderAPI_MakeFace(TrS1, Precision::Confusion()); - TopoDS_Face F2 = BRepBuilderAPI_MakeFace(TrS2, Precision::Confusion()); - - if (isShell) { - BRep_Builder B; - B.MakeCompound(TopoDS::Compound(aMShape)); - B.Add(aMShape, F1); - B.Add(aMShape, F2); - } else { - // The original shape is a solid. - BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0); - aSewing.Add(F1); - aSewing.Add(F2); - aSewing.Perform(); - aMShape = aSewing.SewedShape(); - BRep_Builder B; - TopoDS_Solid aSolid; - B.MakeSolid(aSolid); - B.Add(aSolid, aMShape); - aMShape = aSolid; - } - - Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape; - sfs->Init(aMShape); - sfs->SetPrecision(1.e-6); - sfs->SetMaxTolerance(1.0); - sfs->Perform(); - theModifiedShape = sfs->Shape(); + BRep_Builder B; + TopoDS_Vertex V; + B.MakeVertex(V, PC, 1.e-7); + theModifiedShape = V; + theAddDist = SS->Radius(); + return Standard_True; + } + if (!isShell && S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) { + Handle(Geom_ToroidalSurface) TS = + Handle(Geom_ToroidalSurface)::DownCast(S); + gp_Ax3 ax3 = TS->Position(); + Handle(Geom_Circle) C = new Geom_Circle(ax3.Ax2(), TS->MajorRadius()); + BRep_Builder B; + TopoDS_Edge E; + B.MakeEdge(E, C, 1.e-7); + theModifiedShape = E; + theAddDist = TS->MinorRadius(); return Standard_True; } - } - theModifiedShape = theShape; - return Standard_False; + // non solid case or any periodic surface (Mantis 22454). + double U1, U2, V1, V2; + // changes for 0020677: EDF 1219 GEOM: MinDistance gives 0 instead + // of 20.88 + // S->Bounds(U1,U2,V1,V2); changed by + BRepTools::UVBounds(TopoDS::Face(theModifiedShape), U1, U2, V1, V2); + // end of changes for 020677 (dmv) + Handle(Geom_RectangularTrimmedSurface) TrS1 = + new Geom_RectangularTrimmedSurface(S, U1, (U1 + U2) / 2., V1, V2); + Handle(Geom_RectangularTrimmedSurface) TrS2 = + new Geom_RectangularTrimmedSurface(S, (U1 + U2) / 2., U2, V1, V2); + TopoDS_Shape aMShape; + + TopoDS_Face F1 = BRepBuilderAPI_MakeFace(TrS1, Precision::Confusion()); + TopoDS_Face F2 = BRepBuilderAPI_MakeFace(TrS2, Precision::Confusion()); + + if (isShell) { + BRep_Builder B; + B.MakeCompound(TopoDS::Compound(aMShape)); + B.Add(aMShape, F1); + B.Add(aMShape, F2); + } else { + // The original shape is a solid. + BRepBuilderAPI_Sewing aSewing(Precision::Confusion() * 10.0); + aSewing.Add(F1); + aSewing.Add(F2); + aSewing.Perform(); + aMShape = aSewing.SewedShape(); + BRep_Builder B; + TopoDS_Solid aSolid; + B.MakeSolid(aSolid); + B.Add(aSolid, aMShape); + aMShape = aSolid; + } + + Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape; + sfs->Init(aMShape); + sfs->SetPrecision(1.e-6); + sfs->SetMaxTolerance(1.0); + sfs->Perform(); + theModifiedShape = sfs->Shape(); + return Standard_True; + } } + theModifiedShape = theShape; + return Standard_False; +} + //======================================================================= // function : GetMinDistanceSingular //======================================================================= -double GetMinDistanceSingular(const TopoDS_Shape& aSh1, - const TopoDS_Shape& aSh2, - gp_Pnt& Ptmp1, gp_Pnt& Ptmp2) -{ - TopoDS_Shape tmpSh1; - TopoDS_Shape tmpSh2; - Standard_Real AddDist1 = 0.; - Standard_Real AddDist2 = 0.; +double GetMinDistanceSingular(const TopoDS_Shape &aSh1, + const TopoDS_Shape &aSh2, gp_Pnt &Ptmp1, + gp_Pnt &Ptmp2) { + TopoDS_Shape tmpSh1; + TopoDS_Shape tmpSh2; + Standard_Real AddDist1 = 0.; + Standard_Real AddDist2 = 0.; Standard_Boolean IsChange1 = ModifyShape(aSh1, tmpSh1, AddDist1); Standard_Boolean IsChange2 = ModifyShape(aSh2, tmpSh2, AddDist2); - if( !IsChange1 && !IsChange2 ) + if (!IsChange1 && !IsChange2) return -2.0; - BRepExtrema_DistShapeShape dst(tmpSh1,tmpSh2); + BRepExtrema_DistShapeShape dst(tmpSh1, tmpSh2); if (dst.IsDone()) { double MinDist = 1.e9; gp_Pnt PMin1, PMin2, P1, P2; @@ -179,38 +180,36 @@ double GetMinDistanceSingular(const TopoDS_Shape& aSh1, PMin2 = P2; } } - if(MinDist<1.e-7) { + if (MinDist < 1.e-7) { Ptmp1 = PMin1; Ptmp2 = PMin2; - } - else { - gp_Dir aDir(gp_Vec(PMin1,PMin2)); - if( MinDist > (AddDist1+AddDist2) ) { - Ptmp1 = gp_Pnt(PMin1.X() + aDir.X()*AddDist1, - PMin1.Y() + aDir.Y()*AddDist1, - PMin1.Z() + aDir.Z()*AddDist1); - Ptmp2 = gp_Pnt(PMin2.X() - aDir.X()*AddDist2, - PMin2.Y() - aDir.Y()*AddDist2, - PMin2.Z() - aDir.Z()*AddDist2); + } else { + gp_Dir aDir(gp_Vec(PMin1, PMin2)); + if (MinDist > (AddDist1 + AddDist2)) { + Ptmp1 = gp_Pnt(PMin1.X() + aDir.X() * AddDist1, + PMin1.Y() + aDir.Y() * AddDist1, + PMin1.Z() + aDir.Z() * AddDist1); + Ptmp2 = gp_Pnt(PMin2.X() - aDir.X() * AddDist2, + PMin2.Y() - aDir.Y() * AddDist2, + PMin2.Z() - aDir.Z() * AddDist2); return (MinDist - AddDist1 - AddDist2); - } - else { - if( AddDist1 > 0 ) { - Ptmp1 = gp_Pnt(PMin1.X() + aDir.X()*AddDist1, - PMin1.Y() + aDir.Y()*AddDist1, - PMin1.Z() + aDir.Z()*AddDist1); + } else { + if (AddDist1 > 0) { + Ptmp1 = gp_Pnt(PMin1.X() + aDir.X() * AddDist1, + PMin1.Y() + aDir.Y() * AddDist1, + PMin1.Z() + aDir.Z() * AddDist1); Ptmp2 = Ptmp1; - } - else { - Ptmp2 = gp_Pnt(PMin2.X() - aDir.X()*AddDist2, - PMin2.Y() - aDir.Y()*AddDist2, - PMin2.Z() - aDir.Z()*AddDist2); + } else { + Ptmp2 = gp_Pnt(PMin2.X() - aDir.X() * AddDist2, + PMin2.Y() - aDir.Y() * AddDist2, + PMin2.Z() - aDir.Z() * AddDist2); Ptmp1 = Ptmp2; } } } double res = MinDist - AddDist1 - AddDist2; - if(res<0.) res = 0.0; + if (res < 0.) + res = 0.0; return res; } return -2.0; @@ -219,31 +218,34 @@ double GetMinDistanceSingular(const TopoDS_Shape& aSh1, //======================================================================= // function : GetMinDistance //======================================================================= -Standard_Real GetMinDistance(const TopoDS_Shape& theShape1, - const TopoDS_Shape& theShape2, - gp_Pnt& thePnt1, gp_Pnt& thePnt2) -{ +Standard_Real GetMinDistance(const TopoDS_Shape &theShape1, + const TopoDS_Shape &theShape2, gp_Pnt &thePnt1, + gp_Pnt &thePnt2) { Standard_Real aResult = 1.e9; // Issue 0020231: A min distance bug with torus and vertex. // Make GetMinDistance() return zero if a sole VERTEX is inside any of SOLIDs // which of shapes consists of only one vertex? - TopExp_Explorer exp1(theShape1,TopAbs_VERTEX), exp2(theShape2,TopAbs_VERTEX); + TopExp_Explorer exp1(theShape1, TopAbs_VERTEX), + exp2(theShape2, TopAbs_VERTEX); TopoDS_Shape V1 = exp1.More() ? exp1.Current() : TopoDS_Shape(); TopoDS_Shape V2 = exp2.More() ? exp2.Current() : TopoDS_Shape(); - exp1.Next(); exp2.Next(); - if ( exp1.More() ) V1.Nullify(); - if ( exp2.More() ) V2.Nullify(); + exp1.Next(); + exp2.Next(); + if (exp1.More()) + V1.Nullify(); + if (exp2.More()) + V2.Nullify(); // vertex and container of solids TopoDS_Shape V = V1.IsNull() ? V2 : V1; TopoDS_Shape S = V1.IsNull() ? theShape1 : theShape2; - if ( !V.IsNull() ) { + if (!V.IsNull()) { // classify vertex against solids - gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( V ) ); - for ( exp1.Init( S, TopAbs_SOLID ); exp1.More(); exp1.Next() ) { - BRepClass3d_SolidClassifier classifier( exp1.Current(), p, 1e-6); - if ( classifier.State() == TopAbs_IN ) { + gp_Pnt p = BRep_Tool::Pnt(TopoDS::Vertex(V)); + for (exp1.Init(S, TopAbs_SOLID); exp1.More(); exp1.Next()) { + BRepClass3d_SolidClassifier classifier(exp1.Current(), p, 1e-6); + if (classifier.State() == TopAbs_IN) { thePnt1 = p; thePnt2 = p; return 0.0; @@ -253,8 +255,7 @@ Standard_Real GetMinDistance(const TopoDS_Shape& theShape1, aResult = GetMinDistanceSingular(theShape1, theShape2, thePnt1, thePnt2); - - BRepExtrema_DistShapeShape dst (theShape1, theShape2); + BRepExtrema_DistShapeShape dst(theShape1, theShape2); if (dst.IsDone()) { gp_Pnt P1, P2; @@ -277,41 +278,41 @@ Standard_Real GetMinDistance(const TopoDS_Shape& theShape1, //======================================================================= // function : PreciseBoundingBox //======================================================================= -Standard_Boolean PreciseBoundingBox(const TopoDS_Shape &theShape, Bnd_Box &theBox) -{ - if (theBox.IsVoid()) BRepBndLib::Add( theShape, theBox ); - if (theBox.IsVoid()) return Standard_False; +Standard_Boolean PreciseBoundingBox(const TopoDS_Shape &theShape, + Bnd_Box &theBox) { + if (theBox.IsVoid()) + BRepBndLib::Add(theShape, theBox); + if (theBox.IsVoid()) + return Standard_False; Standard_Real aBound[6]; theBox.Get(aBound[0], aBound[2], aBound[4], aBound[1], aBound[3], aBound[5]); Standard_Integer i; - const gp_Pnt aMid(0.5*(aBound[1] + aBound[0]), // XMid - 0.5*(aBound[3] + aBound[2]), // YMid - 0.5*(aBound[5] + aBound[4])); // ZMid - const gp_XYZ aSize(aBound[1] - aBound[0], // DX - aBound[3] - aBound[2], // DY - aBound[5] - aBound[4]); // DZ - const gp_Pnt aPnt[6] = - { + const gp_Pnt aMid(0.5 * (aBound[1] + aBound[0]), // XMid + 0.5 * (aBound[3] + aBound[2]), // YMid + 0.5 * (aBound[5] + aBound[4])); // ZMid + const gp_XYZ aSize(aBound[1] - aBound[0], // DX + aBound[3] - aBound[2], // DY + aBound[5] - aBound[4]); // DZ + const gp_Pnt aPnt[6] = { gp_Pnt(aBound[0] - (aBound[1] - aBound[0]), aMid.Y(), aMid.Z()), // XMin gp_Pnt(aBound[1] + (aBound[1] - aBound[0]), aMid.Y(), aMid.Z()), // XMax gp_Pnt(aMid.X(), aBound[2] - (aBound[3] - aBound[2]), aMid.Z()), // YMin gp_Pnt(aMid.X(), aBound[3] + (aBound[3] - aBound[2]), aMid.Z()), // YMax gp_Pnt(aMid.X(), aMid.Y(), aBound[4] - (aBound[5] - aBound[4])), // ZMin gp_Pnt(aMid.X(), aMid.Y(), aBound[5] + (aBound[5] - aBound[4])) // ZMax - }; - const gp_Dir aDir[3] = { gp::DX(), gp::DY(), gp::DZ() }; - const Standard_Real aPlnSize[3] = - { - 0.5*Max(aSize.Y(), aSize.Z()), // XMin, XMax planes - 0.5*Max(aSize.X(), aSize.Z()), // YMin, YMax planes - 0.5*Max(aSize.X(), aSize.Y()) // ZMin, ZMax planes - }; + }; + const gp_Dir aDir[3] = {gp::DX(), gp::DY(), gp::DZ()}; + const Standard_Real aPlnSize[3] = { + 0.5 * Max(aSize.Y(), aSize.Z()), // XMin, XMax planes + 0.5 * Max(aSize.X(), aSize.Z()), // YMin, YMax planes + 0.5 * Max(aSize.X(), aSize.Y()) // ZMin, ZMax planes + }; gp_Pnt aPMin[2]; for (i = 0; i < 6; i++) { - const Standard_Integer iHalf = i/2; + const Standard_Integer iHalf = i / 2; const gp_Pln aPln(aPnt[i], aDir[iHalf]); BRepBuilderAPI_MakeFace aMkFace(aPln, -aPlnSize[iHalf], aPlnSize[iHalf], -aPlnSize[iHalf], aPlnSize[iHalf]); @@ -323,7 +324,8 @@ Standard_Boolean PreciseBoundingBox(const TopoDS_Shape &theShape, Bnd_Box &theBo TopoDS_Shape aFace = aMkFace.Shape(); // Get minimal distance between planar face and shape. - Standard_Real aMinDist = GetMinDistance(aFace, theShape, aPMin[0], aPMin[1]); + Standard_Real aMinDist = + GetMinDistance(aFace, theShape, aPMin[0], aPMin[1]); if (aMinDist < 0.) { return Standard_False; @@ -334,21 +336,20 @@ Standard_Boolean PreciseBoundingBox(const TopoDS_Shape &theShape, Bnd_Box &theBo // Update Bounding box with the new values. theBox.SetVoid(); - theBox.Update(aBound[0], aBound[2], aBound[4], aBound[1], aBound[3], aBound[5]); + theBox.Update(aBound[0], aBound[2], aBound[4], aBound[1], aBound[3], + aBound[5]); return Standard_True; } //================================================================================================= -bool GetBoundingBox(const std::shared_ptr& theShape, - double& theXmin, double& theXmax, - double& theYmin, double& theYmax, - double& theZmin, double& theZmax, - std::string& theError) -{ - #ifdef _DEBUG +bool GetBoundingBox(const std::shared_ptr &theShape, + double &theXmin, double &theXmax, double &theYmin, + double &theYmax, double &theZmin, double &theZmax, + std::string &theError) { +#ifdef _DEBUG std::cout << "GetBoundingBox " << std::endl; - #endif +#endif if (!theShape.get()) { theError = "GetBoundingBox : An invalid argument"; @@ -357,11 +358,11 @@ bool GetBoundingBox(const std::shared_ptr& theShape, TopoDS_Shape aShape = theShape->impl(); - //Compute the parameters + // Compute the parameters Bnd_Box B; try { OCC_CATCH_SIGNALS; - BRepBuilderAPI_Copy aCopyTool (aShape); + BRepBuilderAPI_Copy aCopyTool(aShape); if (!aCopyTool.IsDone()) { theError = "GetBoundingBox Error: Bad shape detected"; return false; @@ -380,8 +381,7 @@ bool GetBoundingBox(const std::shared_ptr& theShape, } B.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax); - } - catch (Standard_Failure& aFail) { + } catch (Standard_Failure &aFail) { theError = aFail.GetMessageString(); return false; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.h b/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.h index 75f44fd06..51d96b9c6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BoundingBox.h @@ -14,30 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_BoundingBox_H_ #define GeomAlgoAPI_BoundingBox_H_ -#include #include +#include /// get the boundin box of theshape. - /// \param theShape the shape - /// \param thePrecise precise TRUE for precise computation; FALSE for fast one. - /// \param theXmin X min of the box - /// \param theXmax X max of the box - /// \param theYmin Y min of the box - /// \param theYmax Y max of the box - /// \param theZmin Z min of the box - /// \param theZmax Z max of the box - /// \param theError error +/// \param theShape the shape +/// \param thePrecise precise TRUE for precise computation; FALSE for fast one. +/// \param theXmin X min of the box +/// \param theXmax X max of the box +/// \param theYmin Y min of the box +/// \param theYmax Y max of the box +/// \param theZmin Z min of the box +/// \param theZmax Z max of the box +/// \param theError error GEOMALGOAPI_EXPORT -bool GetBoundingBox(const std::shared_ptr& theShape, - double& theXmin, double& theXmax, - double& theYmin, double& theYmax, - double& theZmin, double& theZmax, - std::string& theError); +bool GetBoundingBox(const std::shared_ptr &theShape, + double &theXmin, double &theXmax, double &theYmin, + double &theYmax, double &theZmin, double &theZmax, + std::string &theError); #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp index 1a2149ee7..a6d32e796 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,13 +24,11 @@ #include //================================================================================================= -GeomAlgoAPI_Box::GeomAlgoAPI_Box() -{ -} +GeomAlgoAPI_Box::GeomAlgoAPI_Box() {} //================================================================================================= -GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theDx, const double theDy, const double theDz) -{ +GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theDx, const double theDy, + const double theDz) { myDx = theDx; myDy = theDy; myDz = theDz; @@ -39,8 +38,7 @@ GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theDx, const double theDy, const d //================================================================================================= GeomAlgoAPI_Box::GeomAlgoAPI_Box(std::shared_ptr theFirstPoint, - std::shared_ptr theSecondPoint) -{ + std::shared_ptr theSecondPoint) { myFirstPoint = theFirstPoint; mySecondPoint = theSecondPoint; myMethodType = MethodType::BOX_POINTS; @@ -48,9 +46,9 @@ GeomAlgoAPI_Box::GeomAlgoAPI_Box(std::shared_ptr theFirstPoint, } //================================================================================================= -GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theOx, const double theOy, const double theOz, - const double theDx, const double theDy, const double theDz) -{ +GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theOx, const double theOy, + const double theOz, const double theDx, + const double theDy, const double theDz) { myOx = theOx; myOy = theOy; myOz = theOz; @@ -62,9 +60,9 @@ GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theOx, const double theOy, const d } //================================================================================================= -bool GeomAlgoAPI_Box::check() -{ - if (myMethodType == MethodType::BOX_DIM || myMethodType == MethodType::BOX_POINT_DIMS) { +bool GeomAlgoAPI_Box::check() { + if (myMethodType == MethodType::BOX_DIM || + myMethodType == MethodType::BOX_POINT_DIMS) { if (myDx < Precision::Confusion()) { myError = headError + " :: Dx is null or negative."; return false; @@ -91,11 +89,12 @@ bool GeomAlgoAPI_Box::check() double aDiffX = myFirstPoint->x() - mySecondPoint->x(); double aDiffY = myFirstPoint->y() - mySecondPoint->y(); double aDiffZ = myFirstPoint->z() - mySecondPoint->z(); - if (fabs(aDiffX) < Precision::Confusion() || - fabs(aDiffY) < Precision::Confusion() || - fabs(aDiffZ) < Precision::Confusion()) { + if (fabs(aDiffX) < Precision::Confusion() || + fabs(aDiffY) < Precision::Confusion() || + fabs(aDiffZ) < Precision::Confusion()) { myError = - headError + " :: the points belong both to one of the OXY, OYZ or OZX planes."; + headError + + " :: the points belong both to one of the OXY, OYZ or OZX planes."; return false; } } else { @@ -106,8 +105,7 @@ bool GeomAlgoAPI_Box::check() } //================================================================================================= -void GeomAlgoAPI_Box::build() -{ +void GeomAlgoAPI_Box::build() { if (myMethodType == MethodType::BOX_DIM) { buildWithDimensions(); } else if (myMethodType == MethodType::BOX_POINTS) { @@ -121,8 +119,7 @@ void GeomAlgoAPI_Box::build() } //================================================================================================= -void GeomAlgoAPI_Box::buildWithDimensions() -{ +void GeomAlgoAPI_Box::buildWithDimensions() { myCreatedFaces.clear(); // Construct the box @@ -152,19 +149,19 @@ void GeomAlgoAPI_Box::buildWithDimensions() } //================================================================================================= -void GeomAlgoAPI_Box::buildWithPoints() -{ +void GeomAlgoAPI_Box::buildWithPoints() { myCreatedFaces.clear(); - const gp_Pnt& aFirstPoint = myFirstPoint->impl(); - const gp_Pnt& aSecondPoint = mySecondPoint->impl(); + const gp_Pnt &aFirstPoint = myFirstPoint->impl(); + const gp_Pnt &aSecondPoint = mySecondPoint->impl(); // Construct the box - BRepPrimAPI_MakeBox *aBoxMaker = new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint); + BRepPrimAPI_MakeBox *aBoxMaker = + new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint); aBoxMaker->Build(); // Test the algorithm - if(!aBoxMaker->IsDone()) { + if (!aBoxMaker->IsDone()) { myError = headError + " :: algorithm failed."; return; } @@ -187,20 +184,19 @@ void GeomAlgoAPI_Box::buildWithPoints() } //================================================================================================= -void GeomAlgoAPI_Box::buildWithPointAndDims() -{ - // Construct points from cordinates and dimensions to use the method with two points - myFirstPoint = - std::shared_ptr(new GeomAPI_Pnt(myOx - myDx, myOy - myDy, myOz - myDz)); - mySecondPoint = - std::shared_ptr(new GeomAPI_Pnt(myOx + myDx, myOy + myDy, myOz + myDz)); +void GeomAlgoAPI_Box::buildWithPointAndDims() { + // Construct points from cordinates and dimensions to use the method with two + // points + myFirstPoint = std::shared_ptr( + new GeomAPI_Pnt(myOx - myDx, myOy - myDy, myOz - myDz)); + mySecondPoint = std::shared_ptr( + new GeomAPI_Pnt(myOx + myDx, myOy + myDy, myOz + myDz)); buildWithPoints(); } //================================================================================================= -void GeomAlgoAPI_Box::prepareNamingFaces() -{ +void GeomAlgoAPI_Box::prepareNamingFaces() { BRepPrimAPI_MakeBox aBoxMaker = impl(); std::shared_ptr aShapeFront(new GeomAPI_Shape); aShapeFront->setImpl(new TopoDS_Shape(aBoxMaker.FrontFace())); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Box.h b/src/GeomAlgoAPI/GeomAlgoAPI_Box.h index ea8a9674f..af376df82 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Box.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Box.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_BOX_H_ @@ -27,14 +28,13 @@ * \ingroup DataAlgo * \brief Allows to create Box Primitives */ -class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape { +public: /// Type of box operation enum MethodType { - BOX_DIM, ///< Box with dimensions - BOX_POINTS, ///< Box with points - BOX_POINT_DIMS, /// theFirstPoint, - std::shared_ptr theSecondPoint); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Box(std::shared_ptr theFirstPoint, + std::shared_ptr theSecondPoint); - /// Creates a box using coordinates of a point (the center of gravity) andthe dimensions. - /// \param theOx The X coordinate of the point - /// \param theOy The Y coordinate of the point - /// \param theOz The Z coordinate of the point - /// \param theDx The dimension on X - /// \param theDy The dimension on Y - /// \param theDz The dimension on Z - GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theOx, const double theOy, const double theOz, - const double theDx, const double theDy, const double theDz); + /// Creates a box using coordinates of a point (the center of gravity) andthe + /// dimensions. \param theOx The X coordinate of the point \param theOy The Y + /// coordinate of the point \param theOz The Z coordinate of the point \param + /// theDx The dimension on X \param theDy The dimension on Y \param theDz The + /// dimension on Z + GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theOx, const double theOy, + const double theOz, const double theDx, + const double theDy, const double theDz); /// Checks if data for the box construction is OK. GEOMALGOAPI_EXPORT bool check(); @@ -70,7 +71,7 @@ class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape /// Prepare the naming (redifined because it is specific for a box). GEOMALGOAPI_EXPORT void prepareNamingFaces(); - private: +private: /// Builds the box with the dimensions "Dx", "Dy" and "Dz". void buildWithDimensions(); /// Builds the box with two points @@ -84,11 +85,10 @@ class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape double myDx; /// Dimension on X to create a box. double myDy; /// Dimension on Y to create a box. double myDz; /// Dimension Z to create a box. - std::shared_ptr myFirstPoint; /// First point to create a box. + std::shared_ptr myFirstPoint; /// First point to create a box. std::shared_ptr mySecondPoint; /// Second point to create a box. - MethodType myMethodType; /// Type of method used. + MethodType myMethodType; /// Type of method used. std::string headError; /// Head of the error message according to the method }; - #endif // GEOMALGOAPI_BOX_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp index c1ff7cd38..e0278b03e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_CanonicalRecognition.h" @@ -22,13 +23,20 @@ #include // code from KERNEL_SRC/src/Basics/Basics_OCCTVersion.hxx #ifdef OCC_VERSION_SERVICEPACK -# define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) +#define OCC_VERSION_LARGE \ + (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | \ + OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) #else -# ifdef OCC_VERSION_DEVELOPMENT -# define OCC_VERSION_LARGE ((OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8)-1) -# else -# define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8) -# endif +#ifdef OCC_VERSION_DEVELOPMENT +#define OCC_VERSION_LARGE \ + ((OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | \ + OCC_VERSION_MAINTENANCE << 8) - \ + 1) +#else +#define OCC_VERSION_LARGE \ + (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | \ + OCC_VERSION_MAINTENANCE << 8) +#endif #endif #if OCC_VERSION_LARGE > 0x07050303 @@ -37,25 +45,26 @@ #include -#include -#include +#include #include #include -#include #include +#include +#include -static bool isValidDirection(const std::vector& theDir) -{ - return (theDir.size() == 3) && (gp_Vec(theDir[0], theDir[1], theDir[2]).Magnitude() > 0.); +static bool isValidDirection(const std::vector &theDir) { + return (theDir.size() == 3) && + (gp_Vec(theDir[0], theDir[1], theDir[2]).Magnitude() > 0.); } -bool GeomAlgoAPI_CanonicalRecognition::isPlane(const GeomShapePtr& theShape, double theTolerance, - std::vector& theNormal, std::vector& theOrigin) -{ +bool GeomAlgoAPI_CanonicalRecognition::isPlane(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theNormal, + std::vector &theOrigin) { if (!theShape.get()) return false; - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -64,7 +73,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isPlane(const GeomShapePtr& theShape, dou gp_Pln aPln; if (aIsValidNormal && aIsValidOrigin) { aPln = gp_Pln(gp_Pnt(theOrigin[0], theOrigin[1], theOrigin[2]), - gp_Dir(theNormal[0], theNormal[1], theNormal[2])); + gp_Dir(theNormal[0], theNormal[1], theNormal[2])); } bool aResult = false; @@ -74,8 +83,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isPlane(const GeomShapePtr& theShape, dou try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsPlane(theTolerance, aPln); - } - catch (...) { + } catch (...) { return false; } #endif @@ -97,25 +105,24 @@ bool GeomAlgoAPI_CanonicalRecognition::isPlane(const GeomShapePtr& theShape, dou return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isSphere(const GeomShapePtr& theShape, double theTolerance, - std::vector& theOrigin, double& theRadius) -{ +bool GeomAlgoAPI_CanonicalRecognition::isSphere(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theOrigin, + double &theRadius) { if (!theShape.get()) return false; - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) return false; bool aIsValidOrigin = theOrigin.size() == 3; bool aIsValidRadius = theRadius > 0; gp_Sphere aSphere; - if (aIsValidOrigin && aIsValidRadius) - { + if (aIsValidOrigin && aIsValidRadius) { aSphere.SetLocation(gp_Pnt(theOrigin[0], theOrigin[1], theOrigin[2])); aSphere.SetRadius(theRadius); - } - else + } else aSphere.SetRadius(1.0); bool aResult = false; @@ -125,8 +132,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isSphere(const GeomShapePtr& theShape, do try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsSphere(theTolerance, aSphere); - } - catch (...) { + } catch (...) { return false; } #endif @@ -142,14 +148,15 @@ bool GeomAlgoAPI_CanonicalRecognition::isSphere(const GeomShapePtr& theShape, do return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isCone(const GeomShapePtr& theShape, double theTolerance, - std::vector& theAxis, std::vector& theApex, - double& theHalfAngle) -{ +bool GeomAlgoAPI_CanonicalRecognition::isCone(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theAxis, + std::vector &theApex, + double &theHalfAngle) { if (!theShape.get()) return false; - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -157,13 +164,11 @@ bool GeomAlgoAPI_CanonicalRecognition::isCone(const GeomShapePtr& theShape, doub bool aIsValidApex = theApex.size() == 3; bool aIsValidAngle = theHalfAngle > 0; gp_Cone aCone; - if (aIsValidAxis && aIsValidApex && aIsValidAngle) - { + if (aIsValidAxis && aIsValidApex && aIsValidAngle) { gp_Pnt aLoc(theApex[0], theApex[1], theApex[2]); gp_Ax3 aAx3(aLoc, gp_Dir(theAxis[0], theAxis[1], theAxis[2])); aCone.SetPosition(aAx3); - } - else + } else aCone.SetRadius(1.0); bool aResult = false; @@ -173,8 +178,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isCone(const GeomShapePtr& theShape, doub try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsCone(theTolerance, aCone); - } - catch (...) { + } catch (...) { return false; } #endif @@ -198,14 +202,14 @@ bool GeomAlgoAPI_CanonicalRecognition::isCone(const GeomShapePtr& theShape, doub return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isCylinder(const GeomShapePtr& theShape, double theTolerance, - std::vector& theAxis, std::vector& theOrigin, - double& theRadius) -{ +bool GeomAlgoAPI_CanonicalRecognition::isCylinder( + const GeomShapePtr &theShape, double theTolerance, + std::vector &theAxis, std::vector &theOrigin, + double &theRadius) { if (!theShape.get()) return false; - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -213,14 +217,12 @@ bool GeomAlgoAPI_CanonicalRecognition::isCylinder(const GeomShapePtr& theShape, bool aIsValidOrigin = theOrigin.size() == 3; bool aIsValidRadius = theRadius > 0; gp_Cylinder aCylinder; - if (aIsValidAxis && aIsValidOrigin && aIsValidRadius) - { + if (aIsValidAxis && aIsValidOrigin && aIsValidRadius) { gp_Pnt aLoc(theOrigin[0], theOrigin[0], theOrigin[0]); gp_Ax3 aAx3(aLoc, gp_Dir(theAxis[0], theAxis[1], theAxis[2])); aCylinder.SetPosition(aAx3); aCylinder.SetRadius(theRadius); - } - else + } else aCylinder.SetRadius(1.0); bool aResult = false; @@ -230,8 +232,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isCylinder(const GeomShapePtr& theShape, try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsCylinder(theTolerance, aCylinder); - } - catch (...) { + } catch (...) { return false; } #endif @@ -255,21 +256,21 @@ bool GeomAlgoAPI_CanonicalRecognition::isCylinder(const GeomShapePtr& theShape, return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isLine(const GeomShapePtr& theEdge, double theTolerance, - std::vector& theDir, std::vector& theOrigin) -{ +bool GeomAlgoAPI_CanonicalRecognition::isLine(const GeomShapePtr &theEdge, + double theTolerance, + std::vector &theDir, + std::vector &theOrigin) { if (!theEdge.get()) return false; - const TopoDS_Shape& aShape = theEdge->impl(); + const TopoDS_Shape &aShape = theEdge->impl(); if (aShape.IsNull()) return false; bool aIsValidDir = isValidDirection(theDir); bool aIsValidOrigin = theOrigin.size() == 3; gp_Lin aLine; - if (aIsValidDir && aIsValidOrigin) - { + if (aIsValidDir && aIsValidOrigin) { aLine.SetLocation(gp_Pnt(theOrigin[0], theOrigin[1], theOrigin[2])); aLine.SetDirection(gp_Dir(theDir[0], theDir[1], theDir[2])); } @@ -281,8 +282,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isLine(const GeomShapePtr& theEdge, doubl try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsLine(theTolerance, aLine); - } - catch (...) { + } catch (...) { return false; } #endif @@ -304,14 +304,15 @@ bool GeomAlgoAPI_CanonicalRecognition::isLine(const GeomShapePtr& theEdge, doubl return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isCircle(const GeomShapePtr& theEdge, double theTolerance, - std::vector& theNormal, std::vector& theOrigin, - double& theRadius) -{ +bool GeomAlgoAPI_CanonicalRecognition::isCircle(const GeomShapePtr &theEdge, + double theTolerance, + std::vector &theNormal, + std::vector &theOrigin, + double &theRadius) { if (!theEdge.get()) return false; - const TopoDS_Shape& aShape = theEdge->impl(); + const TopoDS_Shape &aShape = theEdge->impl(); if (aShape.IsNull()) return false; @@ -319,14 +320,12 @@ bool GeomAlgoAPI_CanonicalRecognition::isCircle(const GeomShapePtr& theEdge, dou bool aIsValidOrigin = theOrigin.size() == 3; bool aIsValidRadius = theRadius > 0; gp_Circ aCircle; - if (aIsValidNormal && aIsValidOrigin && aIsValidRadius) - { + if (aIsValidNormal && aIsValidOrigin && aIsValidRadius) { gp_Ax2 aAx2(gp_Pnt(theOrigin[0], theOrigin[1], theOrigin[2]), - gp_Dir(theNormal[0], theNormal[1], theNormal[2])); + gp_Dir(theNormal[0], theNormal[1], theNormal[2])); aCircle.SetPosition(aAx2); aCircle.SetRadius(theRadius); - } - else + } else aCircle.SetRadius(1.0); bool aResult = false; @@ -336,8 +335,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isCircle(const GeomShapePtr& theEdge, dou try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsCircle(theTolerance, aCircle); - } - catch (...) { + } catch (...) { return false; } #endif @@ -359,15 +357,17 @@ bool GeomAlgoAPI_CanonicalRecognition::isCircle(const GeomShapePtr& theEdge, dou return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isEllipse(const GeomShapePtr& theEdge, double theTolerance, - std::vector& theNormal, std::vector& theDirX, - std::vector& theOrigin, - double& theMajorRadius, double& theMinorRadius) -{ +bool GeomAlgoAPI_CanonicalRecognition::isEllipse(const GeomShapePtr &theEdge, + double theTolerance, + std::vector &theNormal, + std::vector &theDirX, + std::vector &theOrigin, + double &theMajorRadius, + double &theMinorRadius) { if (!theEdge.get()) return false; - const TopoDS_Shape& aShape = theEdge->impl(); + const TopoDS_Shape &aShape = theEdge->impl(); if (aShape.IsNull()) return false; @@ -378,17 +378,17 @@ bool GeomAlgoAPI_CanonicalRecognition::isEllipse(const GeomShapePtr& theEdge, do bool aIsValidRad2 = (theMinorRadius > 0) && (theMajorRadius > theMinorRadius); gp_Elips aElips; - if (aIsValidNormal && aIsValidOrigin && aIsValidDirX && aIsValidRad1 && aIsValidRad2) - { + if (aIsValidNormal && aIsValidOrigin && aIsValidDirX && aIsValidRad1 && + aIsValidRad2) { gp_Pnt anOrigin(theOrigin[0], theOrigin[1], theOrigin[2]); gp_XYZ aNormal(theNormal[0], theNormal[1], theNormal[2]); gp_XYZ aDirX(theDirX[0], theDirX[1], theDirX[2]); Standard_Boolean isCollinear = aNormal.CrossSquareMagnitude(aDirX) < Precision::SquareConfusion(); - gp_Ax2 aAx2 = isCollinear ? gp_Ax2(anOrigin, aNormal) : gp_Ax2(anOrigin, aNormal, aDirX); + gp_Ax2 aAx2 = isCollinear ? gp_Ax2(anOrigin, aNormal) + : gp_Ax2(anOrigin, aNormal, aDirX); aElips = gp_Elips(aAx2, theMajorRadius, theMinorRadius); - } - else + } else aElips.SetMajorRadius(1.0); bool aResult = false; @@ -398,8 +398,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isEllipse(const GeomShapePtr& theEdge, do try { if (aRecognition.GetStatus() == 0) aResult = aRecognition.IsEllipse(theTolerance, aElips); - } - catch (...) { + } catch (...) { return false; } #endif @@ -431,8 +430,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isEllipse(const GeomShapePtr& theEdge, do return aResult; } -bool GeomAlgoAPI_CanonicalRecognition::isImplemented() -{ +bool GeomAlgoAPI_CanonicalRecognition::isImplemented() { #if OCC_VERSION_LARGE > 0x07050303 return true; #else diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.h b/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.h index f5439cf7e..ddcf02560 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_CanonicalRecognition_H_ @@ -25,61 +26,73 @@ #include -class GeomAlgoAPI_CanonicalRecognition -{ +class GeomAlgoAPI_CanonicalRecognition { public: /*! * \brief Check if the shape is planar */ - GEOMALGOAPI_EXPORT static bool isPlane(const GeomShapePtr& theShape, double theTolerance, - std::vector& theNormal, std::vector& theOrigin); + GEOMALGOAPI_EXPORT static bool isPlane(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theNormal, + std::vector &theOrigin); /*! * \brief Check if shape is spherical */ - GEOMALGOAPI_EXPORT static bool isSphere(const GeomShapePtr& theShape, double theTolerance, - std::vector& theOrigin, double& theRadius); + GEOMALGOAPI_EXPORT static bool isSphere(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theOrigin, + double &theRadius); /*! * \brief Check if shape is conical */ - GEOMALGOAPI_EXPORT static bool isCone(const GeomShapePtr& theShape, double theTolerance, - std::vector& theAxis, std::vector& theApex, - double& theHalfAngle); + GEOMALGOAPI_EXPORT static bool isCone(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theAxis, + std::vector &theApex, + double &theHalfAngle); /*! * \brief Check if shape is cylinder */ - GEOMALGOAPI_EXPORT static bool isCylinder(const GeomShapePtr& theShape, double theTolerance, - std::vector& theAxis, std::vector& theOrigin, - double& theRadius); + GEOMALGOAPI_EXPORT static bool isCylinder(const GeomShapePtr &theShape, + double theTolerance, + std::vector &theAxis, + std::vector &theOrigin, + double &theRadius); /*! * \brief Check if edge / wire is line */ - GEOMALGOAPI_EXPORT static bool isLine(const GeomShapePtr& theEdge, double theTolerance, - std::vector& theDir, std::vector& theOrigin); + GEOMALGOAPI_EXPORT static bool isLine(const GeomShapePtr &theEdge, + double theTolerance, + std::vector &theDir, + std::vector &theOrigin); /*! * \brief Check if edge / wire is circle */ - GEOMALGOAPI_EXPORT static bool isCircle(const GeomShapePtr& theEdge, double theTolerance, - std::vector& theNormal, std::vector& theOrigin, - double& theRadius); + GEOMALGOAPI_EXPORT static bool isCircle(const GeomShapePtr &theEdge, + double theTolerance, + std::vector &theNormal, + std::vector &theOrigin, + double &theRadius); /*! * \brief Check if edge / wire is ellipse */ - GEOMALGOAPI_EXPORT static bool isEllipse(const GeomShapePtr& theEdge, double theTolerance, - std::vector& theNormal, std::vector& theDirX, - std::vector& theOrigin, - double& theMajorRadius, double& theMinorRadius); + GEOMALGOAPI_EXPORT static bool + isEllipse(const GeomShapePtr &theEdge, double theTolerance, + std::vector &theNormal, std::vector &theDirX, + std::vector &theOrigin, double &theMajorRadius, + double &theMinorRadius); /*! - * \brief Check if the algorithm is implemented (Shaper is built with appropriate OCCT version) + * \brief Check if the algorithm is implemented (Shaper is built with + * appropriate OCCT version) */ GEOMALGOAPI_EXPORT static bool isImplemented(); - }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp index e482e088f..5a4aad84d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp @@ -14,66 +14,62 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Chamfer.h" #include "GeomAlgoAPI_DFLoader.h" -#include #include #include +#include #include #include #include #include //================================================================================================= -GeomAlgoAPI_Chamfer::GeomAlgoAPI_Chamfer(const GeomShapePtr& theBaseSolid, - const ListOfShape& theChamferShapes, - const std::map theMapEdgeFace, - const bool performDistances, - const double theVal1, - const double theVal2) -{ - build(theBaseSolid, theChamferShapes, theMapEdgeFace, performDistances, theVal1, theVal2); +GeomAlgoAPI_Chamfer::GeomAlgoAPI_Chamfer( + const GeomShapePtr &theBaseSolid, const ListOfShape &theChamferShapes, + const std::map theMapEdgeFace, + const bool performDistances, const double theVal1, const double theVal2) { + build(theBaseSolid, theChamferShapes, theMapEdgeFace, performDistances, + theVal1, theVal2); } //================================================================================================= -void GeomAlgoAPI_Chamfer::build(const GeomShapePtr& theBaseSolid, - const ListOfShape& theChamferShapes, - const std::map theMapEdgeFace, - const bool performDistances, - const double theVal1, - const double theVal2) -{ +void GeomAlgoAPI_Chamfer::build( + const GeomShapePtr &theBaseSolid, const ListOfShape &theChamferShapes, + const std::map theMapEdgeFace, + const bool performDistances, const double theVal1, const double theVal2) { TopoDS_Shape aShapeBase = theBaseSolid->impl(); TopTools_IndexedDataMapOfShapeListOfShape M; TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M); // create chamfer builder - BRepFilletAPI_MakeChamfer* aChamferBuilder = + BRepFilletAPI_MakeChamfer *aChamferBuilder = new BRepFilletAPI_MakeChamfer(aShapeBase); setImpl(aChamferBuilder); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); for (ListOfShape::const_iterator anIt = theChamferShapes.begin(); - anIt != theChamferShapes.end(); ++anIt) { + anIt != theChamferShapes.end(); ++anIt) { if ((*anIt)->isEdge()) { TopoDS_Edge E = (*anIt)->impl(); if (theMapEdgeFace.find(*anIt) != theMapEdgeFace.end()) { - //TopoDS_Face F = (theMapEdgeFace[*anIt])->impl(); + // TopoDS_Face F = (theMapEdgeFace[*anIt])->impl(); TopoDS_Face F = (theMapEdgeFace.at(*anIt))->impl(); - if (!BRepTools::IsReallyClosed(E,F) && !BRep_Tool::Degenerated(E) && - M.FindFromKey(E).Extent() == 2) { + if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E) && + M.FindFromKey(E).Extent() == 2) { if (performDistances) { - aChamferBuilder->Add(theVal1, theVal2, E, F); - } else { - aChamferBuilder->AddDA(theVal1, theVal2 * M_PI / 180., E, F); - } + aChamferBuilder->Add(theVal1, theVal2, E, F); + } else { + aChamferBuilder->AddDA(theVal1, theVal2 * M_PI / 180., E, F); } + } } else { - const TopTools_ListOfShape& aFacesList = M.FindFromKey(E); + const TopTools_ListOfShape &aFacesList = M.FindFromKey(E); TopoDS_Face F = TopoDS::Face(aFacesList.First()); if (performDistances) { aChamferBuilder->Add(theVal1, theVal2, E, F); @@ -88,7 +84,8 @@ void GeomAlgoAPI_Chamfer::build(const GeomShapePtr& theBaseSolid, aChamferBuilder->Build(); if (!aChamferBuilder->IsDone()) return; - TopoDS_Shape aResult = GeomAlgoAPI_DFLoader::refineResult(aChamferBuilder->Shape()); + TopoDS_Shape aResult = + GeomAlgoAPI_DFLoader::refineResult(aChamferBuilder->Shape()); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h index aefc20472..4edf9fc6d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Chamfer_H_ @@ -30,41 +31,41 @@ /// \class GeomAlgoAPI_Chamfer /// \ingroup DataAlgo /// \brief Perform chamfer -class GeomAlgoAPI_Chamfer : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Chamfer : public GeomAlgoAPI_MakeShape { public: /// Run chamfer operation with two distances or with a distance and an angle . /// \param theBaseSolid a changing solid /// \param theChamferShapes list of edges the chamfer is performed on - /// \param theMapEdgeFace map that associates an edge to a face when the chamfer is applied + /// \param theMapEdgeFace map that associates an edge to a face when the + /// chamfer is applied /// to a face - /// \param performDistances boolean that indicates whether the operation is performed with + /// \param performDistances boolean that indicates whether the operation is + /// performed with /// two distances or not /// \param theVal1 double D1 if performDistances is true or D /// \param theVal2 double D2 if performDistances is true or Angle - GEOMALGOAPI_EXPORT GeomAlgoAPI_Chamfer(const GeomShapePtr& theBaseSolid, - const ListOfShape& theChamferShapes, - const std::map theMapEdgeFace, - const bool performDistances, - const double theVal1, - const double theVal2); + GEOMALGOAPI_EXPORT GeomAlgoAPI_Chamfer( + const GeomShapePtr &theBaseSolid, const ListOfShape &theChamferShapes, + const std::map theMapEdgeFace, + const bool performDistances, const double theVal1, const double theVal2); private: /// Perform chamfer operation. /// \param theBaseSolid a changing solid /// \param theChamferShapes list of edges the chamfer is performed on - /// \param theMapEdgeFace map that associates an edge to a face when the chamfer is applied + /// \param theMapEdgeFace map that associates an edge to a face when the + /// chamfer is applied /// to a face - /// \param performDistances boolean that indicates whether the operation is performed with two + /// \param performDistances boolean that indicates whether the operation is + /// performed with two /// distances or not /// \param theVal1 double D1 if performDistances is true or D /// \param theVal2 double D2 if performDistances is true or Angle - GEOMALGOAPI_EXPORT void build(const GeomShapePtr& theBaseSolid, - const ListOfShape& theChamferShapes, - const std::map theMapEdgeFace, - const bool performDistances, - const double theVal1, - const double theVal2); + GEOMALGOAPI_EXPORT void + build(const GeomShapePtr &theBaseSolid, const ListOfShape &theChamferShapes, + const std::map theMapEdgeFace, + const bool performDistances, const double theVal1, + const double theVal2); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp index b07ea27f8..d28ed3eca 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include -#include #include +#include #include +#include #include #include @@ -42,9 +43,8 @@ typedef std::shared_ptr Circ2dPtr; typedef std::shared_ptr CurveAdaptorPtr; -typedef std::vector< std::shared_ptr > VectorOfGccCirc; -typedef std::vector< std::shared_ptr > VectorOfGccLine; - +typedef std::vector> VectorOfGccCirc; +typedef std::vector> VectorOfGccLine; // Provide different mechanisms to create circle: // * by passing points @@ -52,30 +52,30 @@ typedef std::vector< std::shared_ptr > VectorOfGccLine; // * by transversal line // * with specified radius // * etc. -class CircleBuilder -{ +class CircleBuilder { public: - CircleBuilder(const std::shared_ptr& theBasePlane) - : myPlane(new Geom_Plane(theBasePlane->impl())), - myRadius(0.0) - {} + CircleBuilder(const std::shared_ptr &theBasePlane) + : myPlane(new Geom_Plane(theBasePlane->impl())), myRadius(0.0) {} - void setRadius(const double theRadius) - { myRadius = theRadius; } + void setRadius(const double theRadius) { myRadius = theRadius; } - void setCenter(const std::shared_ptr& theCenter) - { myCenter = theCenter; } + void setCenter(const std::shared_ptr &theCenter) { + myCenter = theCenter; + } - void setTangentCurves(const std::vector< std::shared_ptr >& theEdges) - { - std::vector< std::shared_ptr >::const_iterator anEdgeIt; + void setTangentCurves( + const std::vector> &theEdges) { + std::vector>::const_iterator anEdgeIt; for (anEdgeIt = theEdges.begin(); anEdgeIt != theEdges.end(); ++anEdgeIt) { - const TopoDS_Edge& anEdge = TopoDS::Edge((*anEdgeIt)->impl()); + const TopoDS_Edge &anEdge = + TopoDS::Edge((*anEdgeIt)->impl()); double aFirst, aLast; TopLoc_Location aLoc; - Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface(anEdge, myPlane, aLoc, aFirst, aLast); - CurveAdaptorPtr aCurveAdaptor(new Geom2dAdaptor_Curve(aCurve, aFirst, aLast)); + Handle(Geom2d_Curve) aCurve = + BRep_Tool::CurveOnSurface(anEdge, myPlane, aLoc, aFirst, aLast); + CurveAdaptorPtr aCurveAdaptor( + new Geom2dAdaptor_Curve(aCurve, aFirst, aLast)); // sort curves (circles should become first) if (aCurveAdaptor->GetType() == GeomAbs_Circle) @@ -85,32 +85,32 @@ public: } } - void setTransversalLine(const std::shared_ptr& theLine) - { + void setTransversalLine(const std::shared_ptr &theLine) { if (!theLine) return; - const TopoDS_Edge& anEdge = TopoDS::Edge(theLine->impl()); + const TopoDS_Edge &anEdge = TopoDS::Edge(theLine->impl()); double aFirst, aLast; TopLoc_Location aLoc; - Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface(anEdge, myPlane, aLoc, aFirst, aLast); - myTransversalLine = CurveAdaptorPtr(new Geom2dAdaptor_Curve(aCurve, aFirst, aLast)); + Handle(Geom2d_Curve) aCurve = + BRep_Tool::CurveOnSurface(anEdge, myPlane, aLoc, aFirst, aLast); + myTransversalLine = + CurveAdaptorPtr(new Geom2dAdaptor_Curve(aCurve, aFirst, aLast)); } - void setPassingPoints(const std::vector< std::shared_ptr >& thePoints) - { - std::vector< std::shared_ptr >::const_iterator aPIt; + void setPassingPoints( + const std::vector> &thePoints) { + std::vector>::const_iterator aPIt; for (aPIt = thePoints.begin(); aPIt != thePoints.end(); ++aPIt) myPassingPoints.push_back((*aPIt)->impl()); } - void setClosestPoint(const std::shared_ptr& thePoint) - { myClosestPoint = thePoint; } - + void setClosestPoint(const std::shared_ptr &thePoint) { + myClosestPoint = thePoint; + } - Circ2dPtr circle() - { + Circ2dPtr circle() { Circ2dPtr aResult; if (myCenter) { if (myPassingPoints.size() == 1) @@ -148,16 +148,15 @@ public: } private: - Circ2dPtr circleByCenterAndRadius() - { - const gp_Pnt2d& aCenter = myCenter->impl(); + Circ2dPtr circleByCenterAndRadius() { + const gp_Pnt2d &aCenter = myCenter->impl(); return Circ2dPtr(new gp_Circ2d(gp_Ax2d(aCenter, gp::DX2d()), myRadius)); } - Circ2dPtr circleByCenterAndPassingPoint() - { - const gp_Pnt2d& aCenter = myCenter->impl(); - if (aCenter.SquareDistance(myPassingPoints[0]) > Precision::SquareConfusion()) { + Circ2dPtr circleByCenterAndPassingPoint() { + const gp_Pnt2d &aCenter = myCenter->impl(); + if (aCenter.SquareDistance(myPassingPoints[0]) > + Precision::SquareConfusion()) { GccAna_Circ2dTanCen aBuilder(myPassingPoints[0], aCenter); if (aBuilder.NbSolutions() > 0) return Circ2dPtr(new gp_Circ2d(aBuilder.ThisSolution(1))); @@ -165,9 +164,8 @@ private: return Circ2dPtr(); } - Circ2dPtr circleByCenterAndTangent() - { - const gp_Pnt2d& aCenter = myCenter->impl(); + Circ2dPtr circleByCenterAndTangent() { + const gp_Pnt2d &aCenter = myCenter->impl(); CurveAdaptorPtr aCurve = myTangentShapes[0]; std::shared_ptr aCircleBuilder; @@ -176,15 +174,16 @@ private: aCircleBuilder = std::shared_ptr( new GccAna_Circ2dTanCen(aCurve->Line(), aCenter)); } else if (aCurve->GetType() == GeomAbs_Circle) { - aCircleBuilder = std::shared_ptr(new GccAna_Circ2dTanCen( - GccEnt::Unqualified(aCurve->Circle()), aCenter, Precision::Confusion())); + aCircleBuilder = std::shared_ptr( + new GccAna_Circ2dTanCen(GccEnt::Unqualified(aCurve->Circle()), + aCenter, Precision::Confusion())); } return getProperCircle(aCircleBuilder); } - Circ2dPtr getProperCircle(const std::shared_ptr& theBuilder) const - { + Circ2dPtr getProperCircle( + const std::shared_ptr &theBuilder) const { if (!theBuilder) return Circ2dPtr(); @@ -210,21 +209,20 @@ private: } } - return Circ2dPtr(new gp_Circ2d(theBuilder->ThisSolution(anAppropriateSolution))); + return Circ2dPtr( + new gp_Circ2d(theBuilder->ThisSolution(anAppropriateSolution))); } - double distanceToClosestPoint(const gp_Circ2d& theCirc) const - { + double distanceToClosestPoint(const gp_Circ2d &theCirc) const { if (myClosestPoint) { - double aDist = myClosestPoint->impl().Distance(theCirc.Location()); + double aDist = + myClosestPoint->impl().Distance(theCirc.Location()); return fabs(aDist - theCirc.Radius()); } return 0.0; } - - Circ2dPtr circleByThreeTangentCurves() - { + Circ2dPtr circleByThreeTangentCurves() { VectorOfGccCirc aTgCirc; VectorOfGccLine aTgLine; convertTangentCurvesToGccEnt(aTgCirc, aTgLine); @@ -233,20 +231,24 @@ private: if (aTgCirc.size() + aTgLine.size() == 3) { switch (aTgLine.size()) { case 0: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgCirc[0], *aTgCirc[1], *aTgCirc[2], Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgCirc[0], *aTgCirc[1], *aTgCirc[2], Precision::Confusion())); break; case 1: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgCirc[0], *aTgCirc[1], *aTgLine[0], Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgCirc[0], *aTgCirc[1], *aTgLine[0], Precision::Confusion())); break; case 2: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgCirc[0], *aTgLine[0], *aTgLine[1], Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgCirc[0], *aTgLine[0], *aTgLine[1], Precision::Confusion())); break; case 3: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgLine[0], *aTgLine[1], *aTgLine[2], Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgLine[0], *aTgLine[1], *aTgLine[2], Precision::Confusion())); break; default: break; @@ -256,9 +258,8 @@ private: return getProperCircle(aCircleBuilder); } - Circ2dPtr circleByPointAndTwoTangentCurves() - { - const gp_Pnt2d& aPoint = myPassingPoints[0]; + Circ2dPtr circleByPointAndTwoTangentCurves() { + const gp_Pnt2d &aPoint = myPassingPoints[0]; VectorOfGccCirc aTgCirc; VectorOfGccLine aTgLine; @@ -268,16 +269,19 @@ private: if (aTgCirc.size() + aTgLine.size() == 2) { switch (aTgLine.size()) { case 0: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgCirc[0], *aTgCirc[1], aPoint, Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgCirc[0], *aTgCirc[1], aPoint, Precision::Confusion())); break; case 1: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgCirc[0], *aTgLine[0], aPoint, Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgCirc[0], *aTgLine[0], aPoint, Precision::Confusion())); break; case 2: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - *aTgLine[0], *aTgLine[1], aPoint, Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d3Tan( + *aTgLine[0], *aTgLine[1], aPoint, Precision::Confusion())); break; default: break; @@ -287,31 +291,29 @@ private: return getProperCircle(aCircleBuilder); } - Circ2dPtr circleByTwoPointsAndTangentCurve() - { - const gp_Pnt2d& aPoint1 = myPassingPoints[0]; - const gp_Pnt2d& aPoint2 = myPassingPoints[1]; + Circ2dPtr circleByTwoPointsAndTangentCurve() { + const gp_Pnt2d &aPoint1 = myPassingPoints[0]; + const gp_Pnt2d &aPoint2 = myPassingPoints[1]; CurveAdaptorPtr aCurve = myTangentShapes[0]; std::shared_ptr aCircleBuilder; if (aCurve) { if (aCurve->GetType() == GeomAbs_Line) { - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - GccEnt::Unqualified(aCurve->Line()), aPoint1, aPoint2, Precision::Confusion())); - } - else if (aCurve->GetType() == GeomAbs_Circle) { - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d3Tan( - GccEnt::Unqualified(aCurve->Circle()), aPoint1, aPoint2, Precision::Confusion())); + aCircleBuilder = std::shared_ptr( + new GccAna_Circ2d3Tan(GccEnt::Unqualified(aCurve->Line()), aPoint1, + aPoint2, Precision::Confusion())); + } else if (aCurve->GetType() == GeomAbs_Circle) { + aCircleBuilder = std::shared_ptr( + new GccAna_Circ2d3Tan(GccEnt::Unqualified(aCurve->Circle()), + aPoint1, aPoint2, Precision::Confusion())); } } return getProperCircle(aCircleBuilder); } - Circ2dPtr circleByThreePassingPoints() - { - GccAna_Circ2d3Tan aCircleBuilder(myPassingPoints[0], - myPassingPoints[1], + Circ2dPtr circleByThreePassingPoints() { + GccAna_Circ2d3Tan aCircleBuilder(myPassingPoints[0], myPassingPoints[1], myPassingPoints[2], Precision::Confusion()); if (aCircleBuilder.NbSolutions() > 0) @@ -319,8 +321,8 @@ private: return Circ2dPtr(); } - Circ2dPtr getProperCircle(const std::shared_ptr& theBuilder) const - { + Circ2dPtr + getProperCircle(const std::shared_ptr &theBuilder) const { if (!theBuilder) return Circ2dPtr(); @@ -357,18 +359,17 @@ private: } } - return Circ2dPtr(new gp_Circ2d(theBuilder->ThisSolution(anAppropriateSolution))); + return Circ2dPtr( + new gp_Circ2d(theBuilder->ThisSolution(anAppropriateSolution))); } - - Circ2dPtr circleByTwoPointsAndTransversalLine() - { - const gp_Pnt2d& aPoint1 = myPassingPoints[0]; - const gp_Pnt2d& aPoint2 = myPassingPoints[1]; + Circ2dPtr circleByTwoPointsAndTransversalLine() { + const gp_Pnt2d &aPoint1 = myPassingPoints[0]; + const gp_Pnt2d &aPoint2 = myPassingPoints[1]; if (myTransversalLine && myTransversalLine->GetType() == GeomAbs_Line) { - GccAna_Circ2d2TanOn aCircleBuilder(aPoint1, aPoint2, myTransversalLine->Line(), - Precision::Confusion()); + GccAna_Circ2d2TanOn aCircleBuilder( + aPoint1, aPoint2, myTransversalLine->Line(), Precision::Confusion()); if (aCircleBuilder.NbSolutions() > 0) return Circ2dPtr(new gp_Circ2d(aCircleBuilder.ThisSolution(1))); } @@ -376,9 +377,7 @@ private: return Circ2dPtr(); } - - Circ2dPtr circleByRadiusAndTwoTangentCurves() - { + Circ2dPtr circleByRadiusAndTwoTangentCurves() { VectorOfGccCirc aTgCirc; VectorOfGccLine aTgLine; convertTangentCurvesToGccEnt(aTgCirc, aTgLine); @@ -387,16 +386,19 @@ private: if (aTgCirc.size() + aTgLine.size() == 2) { switch (aTgLine.size()) { case 0: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d2TanRad( - *aTgCirc[0], *aTgCirc[1], myRadius, Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d2TanRad( + *aTgCirc[0], *aTgCirc[1], myRadius, Precision::Confusion())); break; case 1: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d2TanRad( - *aTgCirc[0], *aTgLine[0], myRadius, Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d2TanRad( + *aTgCirc[0], *aTgLine[0], myRadius, Precision::Confusion())); break; case 2: - aCircleBuilder = std::shared_ptr(new GccAna_Circ2d2TanRad( - *aTgLine[0], *aTgLine[1], myRadius, Precision::Confusion())); + aCircleBuilder = + std::shared_ptr(new GccAna_Circ2d2TanRad( + *aTgLine[0], *aTgLine[1], myRadius, Precision::Confusion())); break; default: break; @@ -406,8 +408,8 @@ private: return getProperCircle(aCircleBuilder); } - Circ2dPtr getProperCircle(const std::shared_ptr& theBuilder) const - { + Circ2dPtr getProperCircle( + const std::shared_ptr &theBuilder) const { if (!theBuilder) return Circ2dPtr(); @@ -440,13 +442,12 @@ private: } } - return Circ2dPtr(new gp_Circ2d(theBuilder->ThisSolution(anAppropriateSolution))); + return Circ2dPtr( + new gp_Circ2d(theBuilder->ThisSolution(anAppropriateSolution))); } - - void convertTangentCurvesToGccEnt(VectorOfGccCirc& theTangentCircles, - VectorOfGccLine& theTangentLines) - { + void convertTangentCurvesToGccEnt(VectorOfGccCirc &theTangentCircles, + VectorOfGccLine &theTangentLines) { theTangentCircles.reserve(3); theTangentLines.reserve(3); @@ -454,16 +455,12 @@ private: for (; anIt != myTangentShapes.end(); ++anIt) { switch ((*anIt)->GetType()) { case GeomAbs_Line: - theTangentLines.push_back( - std::shared_ptr( - new GccEnt_QualifiedLin((*anIt)->Line(), GccEnt_unqualified)) - ); + theTangentLines.push_back(std::shared_ptr( + new GccEnt_QualifiedLin((*anIt)->Line(), GccEnt_unqualified))); break; case GeomAbs_Circle: - theTangentCircles.push_back( - std::shared_ptr( - new GccEnt_QualifiedCirc((*anIt)->Circle(), GccEnt_unqualified)) - ); + theTangentCircles.push_back(std::shared_ptr( + new GccEnt_QualifiedCirc((*anIt)->Circle(), GccEnt_unqualified))); break; default: break; @@ -471,27 +468,26 @@ private: } } - - static void adjustPeriod(double& theParameter, const CurveAdaptorPtr& theCurve) - { + static void adjustPeriod(double &theParameter, + const CurveAdaptorPtr &theCurve) { if (theCurve->Curve()->IsPeriodic()) { - theParameter = ElCLib::InPeriod(theParameter, - theCurve->FirstParameter(), - theCurve->FirstParameter() + theCurve->Period()); + theParameter = + ElCLib::InPeriod(theParameter, theCurve->FirstParameter(), + theCurve->FirstParameter() + theCurve->Period()); } } // boundary parameters of curve are NOT applied - static bool isParamInCurve(double& theParameter, const CurveAdaptorPtr& theCurve) - { + static bool isParamInCurve(double &theParameter, + const CurveAdaptorPtr &theCurve) { adjustPeriod(theParameter, theCurve); return theParameter > theCurve->FirstParameter() && theParameter < theCurve->LastParameter(); } // boundary parameters of curve are applied too - static bool isParamOnCurve(double& theParameter, const CurveAdaptorPtr& theCurve) - { + static bool isParamOnCurve(double &theParameter, + const CurveAdaptorPtr &theCurve) { adjustPeriod(theParameter, theCurve); return theParameter >= theCurve->FirstParameter() && theParameter <= theCurve->LastParameter(); @@ -507,53 +503,45 @@ private: std::shared_ptr myClosestPoint; }; +GeomAlgoAPI_Circ2dBuilder::GeomAlgoAPI_Circ2dBuilder( + const std::shared_ptr &thePlane) + : myPlane(thePlane), myRadius(0.) {} - - - -GeomAlgoAPI_Circ2dBuilder::GeomAlgoAPI_Circ2dBuilder(const std::shared_ptr& thePlane) - : myPlane(thePlane), - myRadius(0.) -{ -} - -void GeomAlgoAPI_Circ2dBuilder::setRadius(const double theRadius) -{ +void GeomAlgoAPI_Circ2dBuilder::setRadius(const double theRadius) { myRadius = theRadius; } -void GeomAlgoAPI_Circ2dBuilder::setCenter(const std::shared_ptr& theCenter) -{ +void GeomAlgoAPI_Circ2dBuilder::setCenter( + const std::shared_ptr &theCenter) { myCenter = theCenter; } -void GeomAlgoAPI_Circ2dBuilder::addTangentCurve(const std::shared_ptr& theEdge) -{ +void GeomAlgoAPI_Circ2dBuilder::addTangentCurve( + const std::shared_ptr &theEdge) { if (theEdge->isEdge()) myTangentShapes.push_back(theEdge); } -void GeomAlgoAPI_Circ2dBuilder::setTransversalLine(const std::shared_ptr& theEdge) -{ +void GeomAlgoAPI_Circ2dBuilder::setTransversalLine( + const std::shared_ptr &theEdge) { if (theEdge->isEdge()) myTransversalLine = theEdge; } -void GeomAlgoAPI_Circ2dBuilder::addPassingPoint(const std::shared_ptr& thePoint) -{ +void GeomAlgoAPI_Circ2dBuilder::addPassingPoint( + const std::shared_ptr &thePoint) { myPassingPoints.push_back(thePoint); } -void GeomAlgoAPI_Circ2dBuilder::setClosestPoint(const std::shared_ptr& thePoint) -{ +void GeomAlgoAPI_Circ2dBuilder::setClosestPoint( + const std::shared_ptr &thePoint) { myClosestPoint = thePoint; } std::shared_ptr GeomAlgoAPI_Circ2dBuilder::circle( - const std::shared_ptr& theFirstPoint, - const std::shared_ptr& theSecondPoint, - const std::shared_ptr& theThirdPoint) -{ + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint, + const std::shared_ptr &theThirdPoint) { std::shared_ptr aPlane(new GeomAPI_Ax3); GeomAlgoAPI_Circ2dBuilder aBuilder(aPlane); @@ -563,8 +551,7 @@ std::shared_ptr GeomAlgoAPI_Circ2dBuilder::circle( return aBuilder.circle(); } -std::shared_ptr GeomAlgoAPI_Circ2dBuilder::circle() -{ +std::shared_ptr GeomAlgoAPI_Circ2dBuilder::circle() { CircleBuilder aCircleBuilder(myPlane); aCircleBuilder.setCenter(myCenter); aCircleBuilder.setTangentCurves(myTangentShapes); @@ -576,11 +563,13 @@ std::shared_ptr GeomAlgoAPI_Circ2dBuilder::circle() std::shared_ptr aCircle; if (aCirc2d) { - const gp_Pnt2d& aCenter = aCirc2d->Location(); - const gp_Dir2d& aXAxis = aCirc2d->Position().XDirection(); + const gp_Pnt2d &aCenter = aCirc2d->Location(); + const gp_Dir2d &aXAxis = aCirc2d->Position().XDirection(); - std::shared_ptr aCircleCenter(new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y())); - std::shared_ptr aCircleDir(new GeomAPI_Dir2d(aXAxis.X(), aXAxis.Y())); + std::shared_ptr aCircleCenter( + new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y())); + std::shared_ptr aCircleDir( + new GeomAPI_Dir2d(aXAxis.X(), aXAxis.Y())); aCircle = std::shared_ptr( new GeomAPI_Circ2d(aCircleCenter, aCircleDir, aCirc2d->Radius())); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.h index 2c9651f6d..2e9d248f3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Circ2dBuilder_H_ @@ -32,19 +33,19 @@ class GeomAPI_Shape; /// \class GeomAlgoAPI_Circ2dBuilder /// \ingroup DataAlgo -/// \brief Creates circle in 2D space satisfying combination of the following constraints: +/// \brief Creates circle in 2D space satisfying combination of the following +/// constraints: /// * center of a circle /// * passing through the point /// * tangent to a curve /// * fixed radius -class GeomAlgoAPI_Circ2dBuilder -{ +class GeomAlgoAPI_Circ2dBuilder { public: /// \brief Create a builder object. /// Constraints should be applied separately. /// \param thePlane [in] plane to project tangent curves GEOMALGOAPI_EXPORT - GeomAlgoAPI_Circ2dBuilder(const std::shared_ptr& thePlane); + GeomAlgoAPI_Circ2dBuilder(const std::shared_ptr &thePlane); /// \brief Set fixed radius of the circle GEOMALGOAPI_EXPORT @@ -52,23 +53,23 @@ public: /// \brief Set fixed center of the circle GEOMALGOAPI_EXPORT - void setCenter(const std::shared_ptr& theCenter); + void setCenter(const std::shared_ptr &theCenter); /// \brief Constrain circle to be tangent to the given edge GEOMALGOAPI_EXPORT - void addTangentCurve(const std::shared_ptr& theEdge); + void addTangentCurve(const std::shared_ptr &theEdge); /// \brief Constrain circle to be orthogonal to the given edge GEOMALGOAPI_EXPORT - void setTransversalLine(const std::shared_ptr& theEdge); + void setTransversalLine(const std::shared_ptr &theEdge); /// \brief Constrain circle to pass through the given point GEOMALGOAPI_EXPORT - void addPassingPoint(const std::shared_ptr& thePoint); + void addPassingPoint(const std::shared_ptr &thePoint); /// \brief Optional constraint to find circle closest to the given point GEOMALGOAPI_EXPORT - void setClosestPoint(const std::shared_ptr& thePoint); + void setClosestPoint(const std::shared_ptr &thePoint); /// \brief Build circle GEOMALGOAPI_EXPORT @@ -77,18 +78,18 @@ public: /// \brief Create a circle passing through three points GEOMALGOAPI_EXPORT static std::shared_ptr - circle(const std::shared_ptr& theFirstPoint, - const std::shared_ptr& theSecondPoint, - const std::shared_ptr& theThirdPoint); + circle(const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint, + const std::shared_ptr &theThirdPoint); private: - std::shared_ptr myPlane; - std::shared_ptr myCenter; - std::vector< std::shared_ptr > myPassingPoints; - std::vector< std::shared_ptr > myTangentShapes; - std::shared_ptr myTransversalLine; - std::shared_ptr myClosestPoint; - double myRadius; + std::shared_ptr myPlane; + std::shared_ptr myCenter; + std::vector> myPassingPoints; + std::vector> myTangentShapes; + std::shared_ptr myTransversalLine; + std::shared_ptr myClosestPoint; + double myRadius; }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp index db0d6fb0d..062286e21 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp @@ -14,25 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include -#include -#include +#include #include #include +#include +#include std::shared_ptr GeomAlgoAPI_CompoundBuilder::compound( - std::list > theShapes) -{ + std::list> theShapes) { BRep_Builder aBuilder; TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); - std::list >::const_iterator anIt = theShapes.begin(), aLast = - theShapes.end(); + std::list>::const_iterator anIt = theShapes + .begin(), + aLast = + theShapes.end(); for (; anIt != aLast; anIt++) { aBuilder.Add(aComp, (*anIt)->impl()); } @@ -43,12 +45,13 @@ std::shared_ptr GeomAlgoAPI_CompoundBuilder::compound( } // Returns true if transformations are equal with the given precision -static bool isEqual(const gp_Trsf& theT1, const gp_Trsf& theT2, const double thePrecision) -{ - for(int aRow = 1; aRow < 4; aRow++) { - for(int aCol = 1; aCol < 5; aCol++) { +static bool isEqual(const gp_Trsf &theT1, const gp_Trsf &theT2, + const double thePrecision) { + for (int aRow = 1; aRow < 4; aRow++) { + for (int aCol = 1; aCol < 5; aCol++) { double aDiff = theT1.Value(aRow, aCol) - theT2.Value(aRow, aCol); - if (aDiff < 0) aDiff = -aDiff; + if (aDiff < 0) + aDiff = -aDiff; if (aDiff > thePrecision) return false; } @@ -56,22 +59,23 @@ static bool isEqual(const gp_Trsf& theT1, const gp_Trsf& theT2, const double the return true; } -int GeomAlgoAPI_CompoundBuilder::id( - std::shared_ptr theContext, std::shared_ptr theSub) -{ +int GeomAlgoAPI_CompoundBuilder::id(std::shared_ptr theContext, + std::shared_ptr theSub) { int anID = 0; TopoDS_Shape aMainShape = theContext->impl(); - const TopoDS_Shape& aSubShape = theSub->impl(); + const TopoDS_Shape &aSubShape = theSub->impl(); if (!aMainShape.IsNull() && !aSubShape.IsNull()) { TopTools_IndexedMapOfShape aSubShapesMap; TopExp::MapShapes(aMainShape, aSubShapesMap); anID = aSubShapesMap.FindIndex(aSubShape); - if (anID == 0) { // try to search shape with the same location if TopLoc_Location is different + if (anID == 0) { // try to search shape with the same location if + // TopLoc_Location is different TopExp_Explorer anExp(aMainShape, aSubShape.ShapeType()); - for(; anExp.More(); anExp.Next()) { + for (; anExp.More(); anExp.Next()) { if (anExp.Current().TShape() == aSubShape.TShape()) { const TopLoc_Location aLoc1 = anExp.Current().Location(); - if (isEqual(aLoc1.Transformation(), aSubShape.Location().Transformation(), 1.e-7)) { + if (isEqual(aLoc1.Transformation(), + aSubShape.Location().Transformation(), 1.e-7)) { anID = aSubShapesMap.FindIndex(anExp.Current()); break; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h index 4a6eecd4f..8b14bf2eb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_CompoundBuilder_H_ #define GeomAlgoAPI_CompoundBuilder_H_ -#include -#include -#include #include +#include +#include +#include #include #include @@ -33,19 +34,18 @@ * \brief Allows to create face-shapes by different parameters */ -class GEOMALGOAPI_EXPORT GeomAlgoAPI_CompoundBuilder -{ - public: +class GEOMALGOAPI_EXPORT GeomAlgoAPI_CompoundBuilder { +public: /// Creates compund of the given shapes /// \param theShapes a list of shapes - static std::shared_ptr compound( - std::list > theShapes); + static std::shared_ptr + compound(std::list> theShapes); - /// Produces the integerr identifier of the shape theSub in theContext (needed for - /// groups export to old GEOM) - /// \returns zero if theSub not found in theContext - static int id( - std::shared_ptr theContext, std::shared_ptr theSub); + /// Produces the integerr identifier of the shape theSub in theContext (needed + /// for groups export to old GEOM) \returns zero if theSub not found in + /// theContext + static int id(std::shared_ptr theContext, + std::shared_ptr theSub); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp index 8ef871c02..6fc15bb91 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAlgoAPI_Cone.cpp @@ -31,8 +32,7 @@ GeomAlgoAPI_Cone::GeomAlgoAPI_Cone(std::shared_ptr theAxis, const double theBaseRadius, const double theTopRadius, - const double theHeight) -{ + const double theHeight) { myAxis = theAxis; myBaseRadius = theBaseRadius; myTopRadius = theTopRadius; @@ -40,13 +40,14 @@ GeomAlgoAPI_Cone::GeomAlgoAPI_Cone(std::shared_ptr theAxis, } //================================================================================================= -bool GeomAlgoAPI_Cone::check() -{ +bool GeomAlgoAPI_Cone::check() { if (!myAxis) { myError = "Cone builder :: axis is not valid."; return false; - } else if (myBaseRadius < Precision::Confusion() && myTopRadius < Precision::Confusion()) { - myError = "Cone builder :: base radius and top radius are negative or null."; + } else if (myBaseRadius < Precision::Confusion() && + myTopRadius < Precision::Confusion()) { + myError = + "Cone builder :: base radius and top radius are negative or null."; return false; } else if (myBaseRadius < 0.) { myError = "Cone builder :: base radius is negative."; @@ -54,7 +55,7 @@ bool GeomAlgoAPI_Cone::check() } else if (myTopRadius < 0.) { myError = "Cone builder :: top radius is negative."; return false; - } else if (fabs(myBaseRadius-myTopRadius) < Precision::Confusion()) { + } else if (fabs(myBaseRadius - myTopRadius) < Precision::Confusion()) { myError = "Cone builder :: base radius and top radius are too close."; return false; } else if (myHeight < Precision::Confusion()) { @@ -65,15 +66,14 @@ bool GeomAlgoAPI_Cone::check() } //================================================================================================= -void GeomAlgoAPI_Cone::build() -{ +void GeomAlgoAPI_Cone::build() { myCreatedFaces.clear(); - const gp_Ax2& anAxis = myAxis->impl(); + const gp_Ax2 &anAxis = myAxis->impl(); // Construct the torus BRepPrimAPI_MakeCone *aConeMaker = - new BRepPrimAPI_MakeCone(anAxis, myBaseRadius, myTopRadius, myHeight); + new BRepPrimAPI_MakeCone(anAxis, myBaseRadius, myTopRadius, myHeight); aConeMaker->Build(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h index 6f57ae1ef..52edf1171 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAlgoAPI_Cone.h @@ -32,9 +33,8 @@ * \ingroup DataAlgo * \brief Allows to create Cone Primitives */ -class GeomAlgoAPI_Cone : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Cone : public GeomAlgoAPI_MakeShape { +public: /// Creates a cone. /// \param theAxis The axis of the cone /// \param theBaseRadius The base radius of the cone @@ -51,11 +51,11 @@ class GeomAlgoAPI_Cone : public GeomAlgoAPI_MakeShape /// Builds the cone. GEOMALGOAPI_EXPORT void build(); - private: +private: std::shared_ptr myAxis; /// Axis of the cone. - double myBaseRadius; /// Base radius of the cone. - double myTopRadius; /// Top radius of the cone. - double myHeight; /// Height of the cone. + double myBaseRadius; /// Base radius of the cone. + double myTopRadius; /// Top radius of the cone. + double myHeight; /// Height of the cone. }; #endif // GEOMALGOAPI_CONE_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp index fcc279cab..c5d0d5085 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp @@ -14,34 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include +#include #include +#include #include -#include -#include #include -#include #include +#include +#include #include #include //================================================================================================= -GeomAlgoAPI_ConeSegment::GeomAlgoAPI_ConeSegment(const double theRMin1, - const double theRMax1, - const double theRMin2, - const double theRMax2, - const double theZ, - const double theStartPhi, - const double theDeltaPhi) -{ +GeomAlgoAPI_ConeSegment::GeomAlgoAPI_ConeSegment( + const double theRMin1, const double theRMax1, const double theRMin2, + const double theRMax2, const double theZ, const double theStartPhi, + const double theDeltaPhi) { myRMin1 = theRMin1; myRMax1 = theRMax1; myRMin2 = theRMin2; @@ -52,40 +49,32 @@ GeomAlgoAPI_ConeSegment::GeomAlgoAPI_ConeSegment(const double theRMin1, } //================================================================================================= -bool GeomAlgoAPI_ConeSegment::check() -{ - if (myRMin1 < 0.) - { +bool GeomAlgoAPI_ConeSegment::check() { + if (myRMin1 < 0.) { myError = "Cone Segment builder :: rmin1 is negative."; return false; } - if (myRMin2 < 0.) - { + if (myRMin2 < 0.) { myError = "Cone Segment builder :: rmin2 is negative."; return false; } - if ((myRMax1-myRMin1) < Precision::Confusion()) - { + if ((myRMax1 - myRMin1) < Precision::Confusion()) { myError = "Cone Segment builder :: rmin1 is larger than rmax1."; return false; } - if ((myRMax2-myRMin2) < Precision::Confusion()) - { + if ((myRMax2 - myRMin2) < Precision::Confusion()) { myError = "Cone Segment builder :: rmin2 is larger than rmax2."; return false; } - if (myZ < Precision::Confusion()) - { + if (myZ < Precision::Confusion()) { myError = "Cone Segment builder :: z is negative or null."; return false; } - if (myDeltaPhi < Precision::Angular() * 180./M_PI) - { + if (myDeltaPhi < Precision::Angular() * 180. / M_PI) { myError = "Cone Segment builder :: deltaphi is negative or null."; return false; } - if (myDeltaPhi > 360) - { + if (myDeltaPhi > 360) { myError = "Cone Segment builder :: deltaphi is larger than 360 degree."; return false; } @@ -93,20 +82,23 @@ bool GeomAlgoAPI_ConeSegment::check() } //================================================================================================= -void GeomAlgoAPI_ConeSegment::build() -{ +void GeomAlgoAPI_ConeSegment::build() { myCreatedFaces.clear(); - const double aStartPhiRad = myStartPhi * M_PI/180.; + const double aStartPhiRad = myStartPhi * M_PI / 180.; BRepBuilderAPI_MakeWire aWireBuilder; // Define the section from the 4 vertices - gp_Pnt aPointOuterBase(myRMax1 * cos(aStartPhiRad), myRMax1 * sin(aStartPhiRad), -myZ/2.); - gp_Pnt aPointInnerBase(myRMin1 * cos(aStartPhiRad), myRMin1 * sin(aStartPhiRad), -myZ/2.); - gp_Pnt aPointOuterTop(myRMax2 * cos(aStartPhiRad), myRMax2 * sin(aStartPhiRad), myZ/2.); - gp_Pnt aPointInnerTop(myRMin2 * cos(aStartPhiRad), myRMin2 * sin(aStartPhiRad), myZ/2.); - - if ((myRMax1 - myRMin1) >= Precision::Confusion()){ + gp_Pnt aPointOuterBase(myRMax1 * cos(aStartPhiRad), + myRMax1 * sin(aStartPhiRad), -myZ / 2.); + gp_Pnt aPointInnerBase(myRMin1 * cos(aStartPhiRad), + myRMin1 * sin(aStartPhiRad), -myZ / 2.); + gp_Pnt aPointOuterTop(myRMax2 * cos(aStartPhiRad), + myRMax2 * sin(aStartPhiRad), myZ / 2.); + gp_Pnt aPointInnerTop(myRMin2 * cos(aStartPhiRad), + myRMin2 * sin(aStartPhiRad), myZ / 2.); + + if ((myRMax1 - myRMin1) >= Precision::Confusion()) { BRepBuilderAPI_MakeEdge anEdgeBuilderBase(aPointOuterBase, aPointInnerBase); anEdgeBuilderBase.Build(); aWireBuilder.Add(anEdgeBuilderBase.Edge()); @@ -115,7 +107,7 @@ void GeomAlgoAPI_ConeSegment::build() BRepBuilderAPI_MakeEdge anEdgeBuilderOuter(aPointOuterBase, aPointOuterTop); anEdgeBuilderOuter.Build(); aWireBuilder.Add(anEdgeBuilderOuter.Edge()); - if ((myRMax2 - myRMin2) >= Precision::Confusion()){ + if ((myRMax2 - myRMin2) >= Precision::Confusion()) { BRepBuilderAPI_MakeEdge anEdgeBuilderTop(aPointOuterTop, aPointInnerTop); anEdgeBuilderTop.Build(); aWireBuilder.Add(anEdgeBuilderTop.Edge()); @@ -129,7 +121,7 @@ void GeomAlgoAPI_ConeSegment::build() BRepBuilderAPI_MakeFace aFaceBuilder(aWireBuilder.Wire()); aFaceBuilder.Build(); - if (!aFaceBuilder.IsDone()){ + if (!aFaceBuilder.IsDone()) { myError = "Cone Segment builder :: section is not valid"; return; } @@ -138,13 +130,13 @@ void GeomAlgoAPI_ConeSegment::build() gp_Dir aZDir(0., 0., 1.); gp_Pnt anOrigin(0., 0., 0.); gp_Ax1 aZAxis(anOrigin, aZDir); - BRepPrimAPI_MakeRevol* aRevolBuilder = - new BRepPrimAPI_MakeRevol(aFaceBuilder.Face(), aZAxis, myDeltaPhi * M_PI/180., Standard_True); - if(!aRevolBuilder) { + BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol( + aFaceBuilder.Face(), aZAxis, myDeltaPhi * M_PI / 180., Standard_True); + if (!aRevolBuilder) { myError = "Cone Segment builder :: section revolution did not succeed"; return; } - if(!aRevolBuilder->IsDone()) { + if (!aRevolBuilder->IsDone()) { myError = "Cone Segment builder :: section revolution did not succeed"; return; } @@ -153,7 +145,7 @@ void GeomAlgoAPI_ConeSegment::build() setBuilderType(OCCT_BRepBuilderAPI_MakeShape); std::shared_ptr aResultShape = - std::shared_ptr(new GeomAPI_Shape()); + std::shared_ptr(new GeomAPI_Shape()); aResultShape->setImpl(new TopoDS_Shape(aRevolBuilder->Shape())); // Test on the shapes diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h index 7e2bdf94b..d2b7132c3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_CONESEGMENT_H_ @@ -26,9 +27,8 @@ * \ingroup DataAlgo * \brief Allows to create Cone Segment GDML Primitives. */ -class GeomAlgoAPI_ConeSegment : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_ConeSegment : public GeomAlgoAPI_MakeShape { +public: /// Creates a cone segment using standard GDML parameters. /// \param theRMin1 Cone base inner radius. /// \param theRMax1 Cone base outer radius. @@ -37,13 +37,11 @@ class GeomAlgoAPI_ConeSegment : public GeomAlgoAPI_MakeShape /// \param theZ Cone height. /// \param theStartPhi Start angle of the cone segment. /// \param theDeltaPhi Delta angle of the cone segment. - GEOMALGOAPI_EXPORT GeomAlgoAPI_ConeSegment(const double theRMin1, - const double theRMax1, - const double theRMin2, - const double theRMax2, - const double theZ, - const double theStartPhi, - const double theDeltaPhi); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_ConeSegment(const double theRMin1, const double theRMax1, + const double theRMin2, const double theRMax2, + const double theZ, const double theStartPhi, + const double theDeltaPhi); /// Checks if the set of parameters used to define the cone segment are OK. GEOMALGOAPI_EXPORT bool check(); @@ -51,15 +49,14 @@ class GeomAlgoAPI_ConeSegment : public GeomAlgoAPI_MakeShape /// Builds the cone segment based on the parameters given in the constructor. GEOMALGOAPI_EXPORT void build(); - private: - double myRMin1; /// Cone base inner radius. - double myRMax1; /// Cone base outer radius. - double myRMin2; /// Cone top inner radius. - double myRMax2; /// Cone top outer radius. - double myZ; /// Cone height. +private: + double myRMin1; /// Cone base inner radius. + double myRMax1; /// Cone base outer radius. + double myRMin2; /// Cone top inner radius. + double myRMax2; /// Cone top outer radius. + double myZ; /// Cone height. double myStartPhi; /// Start angle of the cone segment. double myDeltaPhi; /// Delta angle of the cone segment. }; #endif // GEOMALGOAPI_CONESEGMENT_H_ - diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp index 35db74b69..bd51c4d37 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp @@ -14,37 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Copy.h" - #include //================================================================================================= -GeomAlgoAPI_Copy::GeomAlgoAPI_Copy(const std::shared_ptr theShape, - const bool theCopyGeom, - const bool theCopyMesh) -{ +GeomAlgoAPI_Copy::GeomAlgoAPI_Copy( + const std::shared_ptr theShape, const bool theCopyGeom, + const bool theCopyMesh) { build(theShape, theCopyGeom, theCopyMesh); } - //================================================================================================= void GeomAlgoAPI_Copy::build(const std::shared_ptr theShape, - const bool theCopyGeom, - const bool theCopyMesh) -{ - if(!theShape.get()) { + const bool theCopyGeom, const bool theCopyMesh) { + if (!theShape.get()) { return; } // Getting shape. - const TopoDS_Shape& aBaseShape = theShape->impl(); + const TopoDS_Shape &aBaseShape = theShape->impl(); // Creating copy. - BRepBuilderAPI_Copy* aBuilder = new BRepBuilderAPI_Copy(aBaseShape, theCopyGeom, theCopyMesh); + BRepBuilderAPI_Copy *aBuilder = + new BRepBuilderAPI_Copy(aBaseShape, theCopyGeom, theCopyMesh); this->setImpl(aBuilder); this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Copy.h b/src/GeomAlgoAPI/GeomAlgoAPI_Copy.h index e36b77e6c..75c60ff78 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Copy.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Copy.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Copy_H_ @@ -28,20 +29,18 @@ /// \class GeomAlgoAPI_Copy /// \ingroup DataAlgo /// \brief Duplication of a shape. -class GeomAlgoAPI_Copy : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Copy : public GeomAlgoAPI_MakeShape { public: - /// Constructor. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Copy(const std::shared_ptr theShape, - const bool theCopyGeom = true, - const bool theCopyMesh = false); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Copy(const std::shared_ptr theShape, + const bool theCopyGeom = true, + const bool theCopyMesh = false); private: /// Builds resulting shape. void build(const std::shared_ptr theShape, - const bool theCopyGeom = true, - const bool theCopyMesh = false); + const bool theCopyGeom = true, const bool theCopyMesh = false); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp index c24b3bc81..c902020bc 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp @@ -14,42 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_CurveBuilder.h" #include #include -#include #include +#include #include #include #include -#include -#include #include #include -#include +#include +#include #include #include #include #include #include #include +#include - -GeomEdgePtr GeomAlgoAPI_CurveBuilder::edge(const std::list& thePoints, - const bool thePeriodic, - const bool theIsToReorder, - const GeomDirPtr& theStartTangent, - const GeomDirPtr& theEndTangent) -{ +GeomEdgePtr GeomAlgoAPI_CurveBuilder::edge( + const std::list &thePoints, const bool thePeriodic, + const bool theIsToReorder, const GeomDirPtr &theStartTangent, + const GeomDirPtr &theEndTangent) { std::list aPointsCopy = thePoints; - // If the curve to be closed - remove last point if it is too close to the first one - bool isClose = aPointsCopy.front()->distance(aPointsCopy.back()) <= gp::Resolution(); + // If the curve to be closed - remove last point if it is too close to the + // first one + bool isClose = + aPointsCopy.front()->distance(aPointsCopy.back()) <= gp::Resolution(); if (isClose && thePeriodic) { aPointsCopy.pop_back(); } @@ -60,7 +60,8 @@ GeomEdgePtr GeomAlgoAPI_CurveBuilder::edge(const std::list& thePoi } // Prepare points array - Handle(TColgp_HArray1OfPnt) aPoints = new TColgp_HArray1OfPnt(1, (int)aPointsCopy.size()); + Handle(TColgp_HArray1OfPnt) aPoints = + new TColgp_HArray1OfPnt(1, (int)aPointsCopy.size()); std::list::const_iterator anIt = aPointsCopy.begin(); for (int i = 1; anIt != aPointsCopy.end(); anIt++, i++) { GeomPointPtr aPoint = *anIt; @@ -97,22 +98,22 @@ GeomEdgePtr GeomAlgoAPI_CurveBuilder::edge(const std::list& thePoi return aResultShape; } -GeomEdgePtr GeomAlgoAPI_CurveBuilder::approximate(const std::list& thePoints, - const bool thePeriodic, - const double thePrecision) -{ +GeomEdgePtr +GeomAlgoAPI_CurveBuilder::approximate(const std::list &thePoints, + const bool thePeriodic, + const double thePrecision) { // Prepare points array to be able to build a surface. // This surface is based on two sets of points: the first is an original and // the second is shifted along orthogonal direction. - // This is a workaround, because GeomAPI_PointsToBSpline algorithm cannot produce - // the periodic curve, but GeomAPI_PointsToBSplineSurface can. + // This is a workaround, because GeomAPI_PointsToBSpline algorithm cannot + // produce the periodic curve, but GeomAPI_PointsToBSplineSurface can. TColgp_Array2OfPnt aPoints(1, (int)thePoints.size(), 1, 2); gp_Pnt aPlaneBase[3]; // base points to calculate the normal direction int aNbPlanePoints = 0; gp_Dir aNormal; std::list::const_iterator anIt = thePoints.begin(); for (int i = 1; anIt != thePoints.end(); anIt++, i++) { - const gp_Pnt& aPoint = (*anIt)->impl(); + const gp_Pnt &aPoint = (*anIt)->impl(); aPoints.SetValue(i, 1, aPoint); aPoints.SetValue(i, 2, aPoint); if (aNbPlanePoints < 3) { @@ -135,9 +136,11 @@ GeomEdgePtr GeomAlgoAPI_CurveBuilder::approximate(const std::list& for (int i = aPoints.LowerRow(); i <= aPoints.UpperRow(); i++) aPoints.ChangeValue(i, 2).ChangeCoord() += aNormal.XYZ(); - // If the curve to be closed - remove last point if it is too close to the first one - bool isClose = aPoints.Value(aPoints.LowerRow(), 1).Distance( - aPoints.Value(aPoints.UpperRow(), 1)) <= gp::Resolution(); + // If the curve to be closed - remove last point if it is too close to the + // first one + bool isClose = + aPoints.Value(aPoints.LowerRow(), 1) + .Distance(aPoints.Value(aPoints.UpperRow(), 1)) <= gp::Resolution(); if (isClose && thePeriodic) { aPoints.Resize(aPoints.LowerRow(), aPoints.UpperRow() - 1, aPoints.LowerCol(), aPoints.UpperCol(), Standard_True); @@ -147,8 +150,8 @@ GeomEdgePtr GeomAlgoAPI_CurveBuilder::approximate(const std::list& static const Standard_Integer DEGREE_MIN = 3; static const Standard_Integer DEGREE_MAX = 8; GeomAPI_PointsToBSplineSurface anApprox; - anApprox.Init(aPoints, Approx_ChordLength, DEGREE_MIN, DEGREE_MAX, - GeomAbs_C2, thePrecision, thePeriodic); + anApprox.Init(aPoints, Approx_ChordLength, DEGREE_MIN, DEGREE_MAX, GeomAbs_C2, + thePrecision, thePeriodic); // Set result in form of edge TopoDS_Edge anEdge; @@ -166,8 +169,8 @@ GeomEdgePtr GeomAlgoAPI_CurveBuilder::approximate(const std::list& return aResultShape; } -void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list& thePoints) -{ +void GeomAlgoAPI_CurveBuilder::reorderPoints( + std::list &thePoints) { if (thePoints.size() < 3) { return; } @@ -185,8 +188,10 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list& thePoints) // remove duplicates std::list::iterator aRemoveIt = aNextIt++; thePoints.erase(aRemoveIt); - // update iterator showing the nearest point, because it may become invalid - aNearestIt = aPIt; ++aNearestIt; + // update iterator showing the nearest point, because it may become + // invalid + aNearestIt = aPIt; + ++aNearestIt; continue; } if (aDist < aMinDist && (aMinDist - aDist) > Precision::Confusion()) { @@ -195,7 +200,8 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list& thePoints) } ++aNextIt; } - aNextIt = aPIt; ++aNextIt; + aNextIt = aPIt; + ++aNextIt; if (aNearestIt != aNextIt) { // Keep given order of points to use it in case of equidistant candidates // .--<---<--. @@ -208,4 +214,4 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list& thePoints) thePoints.insert(aNextIt, aPointToMove); } } -} \ No newline at end of file +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.h index 7286814ad..0ab533669 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_CurveBuilder_H_ @@ -22,40 +23,40 @@ #include "GeomAlgoAPI.h" -#include #include +#include /// \class GeomAlgoAPI_CurveBuilder /// \ingroup DataAlgo /// \brief Allows to create a curve by the list of point. -class GeomAlgoAPI_CurveBuilder -{ - public: - /// \brief Creates an interpolation curve from points. - /// \param[in] thePoints list of points. - /// \param[in] thePeriodic defines whether the curve to be periodic. - /// \param[in] theIsToReorder defines whether to change the order of points to construct - /// the shortest curve. - /// \param[in] theStartTangent vector tangent to the start of curve. - /// \param[in] theEndTangent vector tangent to the end of curve. - /// \return Interpolation curve (edge). Empty in case of error or bad input. - GEOMALGOAPI_EXPORT static GeomEdgePtr edge(const std::list& thePoints, - const bool thePeriodic, - const bool theIsToReorder, - const GeomDirPtr& theStartTangent, - const GeomDirPtr& theEndTangent); +class GeomAlgoAPI_CurveBuilder { +public: + /// \brief Creates an interpolation curve from points. + /// \param[in] thePoints list of points. + /// \param[in] thePeriodic defines whether the curve to be periodic. + /// \param[in] theIsToReorder defines whether to change the order of points to + /// construct + /// the shortest curve. + /// \param[in] theStartTangent vector tangent to the start of curve. + /// \param[in] theEndTangent vector tangent to the end of curve. + /// \return Interpolation curve (edge). Empty in case of error or bad input. + GEOMALGOAPI_EXPORT static GeomEdgePtr + edge(const std::list &thePoints, const bool thePeriodic, + const bool theIsToReorder, const GeomDirPtr &theStartTangent, + const GeomDirPtr &theEndTangent); - /// \brief Approximate the given points by a curve. - /// \param[in] thePoints list of points. - /// \param[in] thePeriodic defines whether the curve to be periodic. - /// \param[in] thePrecision how close the curve should be to the points. - /// \return Apporimation curve (edge). Empty in case of error or bad input. - GEOMALGOAPI_EXPORT static GeomEdgePtr approximate(const std::list& thePoints, - const bool thePeriodic, - const double thePrecision); + /// \brief Approximate the given points by a curve. + /// \param[in] thePoints list of points. + /// \param[in] thePeriodic defines whether the curve to be periodic. + /// \param[in] thePrecision how close the curve should be to the points. + /// \return Apporimation curve (edge). Empty in case of error or bad input. + GEOMALGOAPI_EXPORT static GeomEdgePtr + approximate(const std::list &thePoints, const bool thePeriodic, + const double thePrecision); - /// \brief Reoder the list of points to get a polyline of minimal length - GEOMALGOAPI_EXPORT static void reorderPoints(std::list& thePoints); + /// \brief Reoder the list of points to get a polyline of minimal length + GEOMALGOAPI_EXPORT static void + reorderPoints(std::list &thePoints); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp index 71b619801..0c023a10d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp @@ -14,23 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include #include #include +#include +#include #include //================================================================================================= GeomAlgoAPI_Cylinder::GeomAlgoAPI_Cylinder(std::shared_ptr theAxis, const double theRadius, - const double theHeight) -{ + const double theHeight) { withAngle = false; myAxis = theAxis; myRadius = theRadius; @@ -41,8 +41,7 @@ GeomAlgoAPI_Cylinder::GeomAlgoAPI_Cylinder(std::shared_ptr theAxis, GeomAlgoAPI_Cylinder::GeomAlgoAPI_Cylinder(std::shared_ptr theAxis, const double theRadius, const double theHeight, - const double theAngle) -{ + const double theAngle) { withAngle = true; myAxis = theAxis; myRadius = theRadius; @@ -51,8 +50,7 @@ GeomAlgoAPI_Cylinder::GeomAlgoAPI_Cylinder(std::shared_ptr theAxis, } //================================================================================================= -bool GeomAlgoAPI_Cylinder::check() -{ +bool GeomAlgoAPI_Cylinder::check() { if (!myAxis) { myError = "Cylinder builder :: axis is not valid."; return false; @@ -66,7 +64,7 @@ bool GeomAlgoAPI_Cylinder::check() return false; } if (withAngle) { - if (myAngle < Precision::Angular() * 180./M_PI) { + if (myAngle < Precision::Angular() * 180. / M_PI) { myError = "Cylinder builder :: angle is negative or null."; return false; } @@ -79,18 +77,17 @@ bool GeomAlgoAPI_Cylinder::check() } //================================================================================================= -void GeomAlgoAPI_Cylinder::build() -{ +void GeomAlgoAPI_Cylinder::build() { myCreatedFaces.clear(); - const gp_Ax2& anAxis = myAxis->impl(); + const gp_Ax2 &anAxis = myAxis->impl(); // Construct the cylinder BRepPrimAPI_MakeCylinder *aCylinderMaker; if (withAngle) { - aCylinderMaker = - new BRepPrimAPI_MakeCylinder(anAxis, myRadius, myHeight, myAngle * M_PI / 180.); + aCylinderMaker = new BRepPrimAPI_MakeCylinder(anAxis, myRadius, myHeight, + myAngle * M_PI / 180.); } else { aCylinderMaker = new BRepPrimAPI_MakeCylinder(anAxis, myRadius, myHeight); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h index eb23f2dc8..ad9d00957 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_CYLINDER_H_ @@ -29,9 +30,8 @@ * \ingroup DataAlgo * \brief Allows to create Cylinder Primitives */ -class GeomAlgoAPI_Cylinder : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Cylinder : public GeomAlgoAPI_MakeShape { +public: /// Creates a cylinder. /// \param theAxis The axis of the cylinder /// \param theRadius The radius of the cylinder @@ -56,14 +56,15 @@ class GeomAlgoAPI_Cylinder : public GeomAlgoAPI_MakeShape /// Builds the cylinder. GEOMALGOAPI_EXPORT void build(); - private: - bool withAngle; /// Boolean indicating if the type of cylinder (full or portion). - std::shared_ptr myBasePoint; /// Center of the lower base of the cylinder. +private: + bool withAngle; /// Boolean indicating if the type of cylinder (full or + /// portion). + std::shared_ptr + myBasePoint; /// Center of the lower base of the cylinder. std::shared_ptr myAxis; /// Axis of the cylinder. - double myRadius; /// Radius of the cylinder. - double myHeight; /// Height of the cylinder. - double myAngle; /// Covering polar angle of the cylinder; + double myRadius; /// Radius of the cylinder. + double myHeight; /// Height of the cylinder. + double myAngle; /// Covering polar angle of the cylinder; }; - #endif // GEOMALGOAPI_CYLINDER_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp index 19e9d89ed..703679cab 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp @@ -14,31 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include #include #include +#include +#include //======================================================================= -//function : refineResult -//purpose : +// function : refineResult +// purpose : //======================================================================= -const TopoDS_Shape GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape& theResult) -{ +const TopoDS_Shape +GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape &theResult) { TopoDS_Shape aResult = theResult; const TopAbs_ShapeEnum aShType = theResult.ShapeType(); - if(aShType == TopAbs_COMPOUND || aShType == TopAbs_SHELL || aShType == TopAbs_WIRE) { + if (aShType == TopAbs_COMPOUND || aShType == TopAbs_SHELL || + aShType == TopAbs_WIRE) { Standard_Integer aSubResultsNb = 0; TopoDS_Iterator anIt(theResult); - for(; anIt.More(); anIt.Next()) { + for (; anIt.More(); anIt.Next()) { ++aSubResultsNb; } - if(aSubResultsNb == 1) { + if (aSubResultsNb == 1) { anIt.Initialize(theResult); - if(anIt.More()) { + if (anIt.More()) { aResult = anIt.Value(); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.h b/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.h index 66ea57e4f..37c5b81b5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_DFLoader_H_ @@ -26,11 +27,10 @@ * \ingroup DataAlgo * \brief Defines several static methods useful for Data Framework filling */ -class GEOMALGOAPI_EXPORT GeomAlgoAPI_DFLoader -{ - public: +class GEOMALGOAPI_EXPORT GeomAlgoAPI_DFLoader { +public: /// Refine result - static const TopoDS_Shape refineResult(const TopoDS_Shape& theShape); + static const TopoDS_Shape refineResult(const TopoDS_Shape &theShape); }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp index 5b122ec54..1ae192eac 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp @@ -14,27 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include -GeomAlgoAPI_Defeaturing::GeomAlgoAPI_Defeaturing(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFacesToRemove) -{ +GeomAlgoAPI_Defeaturing::GeomAlgoAPI_Defeaturing( + const GeomShapePtr &theBaseSolid, const ListOfShape &theFacesToRemove) { build(theBaseSolid, theFacesToRemove); } -void GeomAlgoAPI_Defeaturing::build(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFacesToRemove) -{ +void GeomAlgoAPI_Defeaturing::build(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFacesToRemove) { if (!theBaseSolid || theFacesToRemove.empty()) return; - BRepAlgoAPI_Defeaturing* aDefeaturing = new BRepAlgoAPI_Defeaturing; + BRepAlgoAPI_Defeaturing *aDefeaturing = new BRepAlgoAPI_Defeaturing; aDefeaturing->SetShape(theBaseSolid->impl()); aDefeaturing->SetRunParallel(Standard_True); @@ -49,7 +48,8 @@ void GeomAlgoAPI_Defeaturing::build(const GeomShapePtr& theBaseSolid, // build and get result aDefeaturing->Build(); - if (!aDefeaturing->IsDone() || aDefeaturing->HasErrors() || aDefeaturing->HasWarnings()) { + if (!aDefeaturing->IsDone() || aDefeaturing->HasErrors() || + aDefeaturing->HasWarnings()) { std::ostringstream errors; aDefeaturing->DumpErrors(errors); aDefeaturing->DumpWarnings(errors); @@ -64,7 +64,8 @@ void GeomAlgoAPI_Defeaturing::build(const GeomShapePtr& theBaseSolid, return; } - TopoDS_Shape aResult = GeomAlgoAPI_DFLoader::refineResult(aDefeaturing->Shape()); + TopoDS_Shape aResult = + GeomAlgoAPI_DFLoader::refineResult(aDefeaturing->Shape()); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.h b/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.h index 232d7a222..65f5373d2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Defeaturing_H_ @@ -28,19 +29,19 @@ /// \class GeomAlgoAPI_Defeaturing /// \ingroup DataAlgo /// \brief Perform Defeaturing algorithm -class GeomAlgoAPI_Defeaturing : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Defeaturing : public GeomAlgoAPI_MakeShape { public: /// Run Defeaturing operation on the solid for the given list of faces. /// \param theBaseSolid a changing solid /// \param theFacesToRemove list of faces to be removed - GEOMALGOAPI_EXPORT GeomAlgoAPI_Defeaturing(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFacesToRemove); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Defeaturing(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFacesToRemove); private: /// Perform Defeaturing operation. - void build(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFacesToRemove); + void build(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFacesToRemove); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp index f19425a48..b0eb19d30 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,29 +26,28 @@ #include #include -#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 GeomEdgePtr createLine(const gp_Pnt& theStart, const gp_Pnt& theEnd) -{ +static GeomEdgePtr createLine(const gp_Pnt &theStart, const gp_Pnt &theEnd) { GeomEdgePtr aRes; if (!theStart.IsEqual(theEnd, Precision::Confusion()) && - Abs(theStart.SquareDistance(theEnd)) < 1.e+100) { + Abs(theStart.SquareDistance(theEnd)) < 1.e+100) { BRepBuilderAPI_MakeEdge anEdgeBuilder(theStart, theEnd); TopoDS_Edge anEdge = anEdgeBuilder.Edge(); aRes = GeomEdgePtr(new GeomAPI_Edge); @@ -56,27 +56,25 @@ static GeomEdgePtr createLine(const gp_Pnt& theStart, const gp_Pnt& theEnd) return aRes; } -std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( - std::shared_ptr theStart, std::shared_ptr theEnd) -{ - const gp_Pnt& aStart = theStart->impl(); - const gp_Pnt& anEnd = theEnd->impl(); +std::shared_ptr +GeomAlgoAPI_EdgeBuilder::line(std::shared_ptr theStart, + std::shared_ptr theEnd) { + const gp_Pnt &aStart = theStart->impl(); + const gp_Pnt &anEnd = theEnd->impl(); return createLine(aStart, anEnd); } -std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( - double theDX, double theDY, double theDZ) -{ - const gp_Pnt& aStart = gp_Pnt(0, 0, 0); - const gp_Pnt& anEnd = gp_Pnt(theDX, theDY, theDZ); +std::shared_ptr +GeomAlgoAPI_EdgeBuilder::line(double theDX, double theDY, double theDZ) { + const gp_Pnt &aStart = gp_Pnt(0, 0, 0); + const gp_Pnt &anEnd = gp_Pnt(theDX, theDY, theDZ); return createLine(aStart, anEnd); } -std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( - const std::shared_ptr theLin) -{ +std::shared_ptr +GeomAlgoAPI_EdgeBuilder::line(const std::shared_ptr theLin) { GeomEdgePtr aRes; if (theLin.get()) { - const gp_Lin& aLin = theLin->impl(); + const gp_Lin &aLin = theLin->impl(); BRepBuilderAPI_MakeEdge anEdgeBuilder(aLin); TopoDS_Edge anEdge = anEdgeBuilder.Edge(); aRes = GeomEdgePtr(new GeomAPI_Edge); @@ -86,10 +84,9 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( } std::shared_ptr GeomAlgoAPI_EdgeBuilder::cylinderAxis( - std::shared_ptr theCylindricalFace) -{ + std::shared_ptr theCylindricalFace) { std::shared_ptr aResult; - const TopoDS_Shape& aShape = theCylindricalFace->impl(); + const TopoDS_Shape &aShape = theCylindricalFace->impl(); if (aShape.IsNull()) return aResult; TopoDS_Face aFace = TopoDS::Face(aShape); @@ -100,25 +97,27 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::cylinderAxis( if (aSurf.IsNull()) return aResult; Handle(Geom_RectangularTrimmedSurface) aTrimmed = - Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); if (!aTrimmed.IsNull()) aSurf = aTrimmed->BasisSurface(); - Handle(Geom_CylindricalSurface) aCyl = Handle(Geom_CylindricalSurface)::DownCast(aSurf); + Handle(Geom_CylindricalSurface) aCyl = + Handle(Geom_CylindricalSurface)::DownCast(aSurf); if (aCyl.IsNull()) return aResult; gp_Ax1 anAxis = aCyl->Axis(); - // compute the start and the end points of the resulting edge by the bounding box of the face - // (vertices projected to the axis) plus 10% + // compute the start and the end points of the resulting edge by the bounding + // box of the face (vertices projected to the axis) plus 10% Bnd_Box aFaceBnd; BRepBndLib::Add(aFace, aFaceBnd); gp_Pnt aBoxMin(aFaceBnd.CornerMin()), aBoxMax(aFaceBnd.CornerMax()); bool isFirst = true; double aParamMin = 0, aParamMax = 0; - for(int aX = 0; aX < 2; aX++) { - for(int aY = 0; aY < 2; aY++) { - for(int aZ = 0; aZ < 2; aZ++) { + for (int aX = 0; aX < 2; aX++) { + for (int aY = 0; aY < 2; aY++) { + for (int aZ = 0; aZ < 2; aZ++) { gp_XYZ aBoxVertex(aX == 0 ? aBoxMin.X() : aBoxMax.X(), - aY == 0 ? aBoxMin.Y() : aBoxMax.Y(), aZ == 0 ? aBoxMin.Z() : aBoxMax.Z()); + aY == 0 ? aBoxMin.Y() : aBoxMax.Y(), + aZ == 0 ? aBoxMin.Z() : aBoxMax.Z()); gp_XYZ aVec(aBoxVertex - anAxis.Location().XYZ()); double aProjParam = aVec.Dot(anAxis.Direction().XYZ()); if (isFirst) { @@ -136,7 +135,8 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::cylinderAxis( } // add 10% double aDelta = aParamMax - aParamMin; - if (aDelta < 1.e-4) aDelta = 1.e-4; + if (aDelta < 1.e-4) + aDelta = 1.e-4; aParamMin -= aDelta * 0.1; aParamMax += aDelta * 0.1; @@ -146,9 +146,9 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::cylinderAxis( anEnd.Transform(aLoc.Transformation()); /* gp_Pnt aStart(anAxis.Location().Transformed(aLoc.Transformation())); - // edge length is 100, "-" because cylinder of extrusion has negative direction with the cylinder - gp_Pnt anEnd(anAxis.Location().XYZ() - anAxis.Direction().XYZ() * 100.); - anEnd.Transform(aLoc.Transformation()); + // edge length is 100, "-" because cylinder of extrusion has negative + direction with the cylinder gp_Pnt anEnd(anAxis.Location().XYZ() - + anAxis.Direction().XYZ() * 100.); anEnd.Transform(aLoc.Transformation()); */ BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd); @@ -160,12 +160,12 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::cylinderAxis( return aRes; } -std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircle( - std::shared_ptr theCenter, std::shared_ptr theNormal, - double theRadius) -{ - const gp_Pnt& aCenter = theCenter->impl(); - const gp_Dir& aDir = theNormal->impl(); +std::shared_ptr +GeomAlgoAPI_EdgeBuilder::lineCircle(std::shared_ptr theCenter, + std::shared_ptr theNormal, + double theRadius) { + const gp_Pnt &aCenter = theCenter->impl(); + const gp_Dir &aDir = theNormal->impl(); gp_Circ aCircle(gp_Ax2(aCenter, aDir), theRadius); @@ -176,12 +176,11 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircle( return aRes; } -std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircle( - std::shared_ptr theCircle) -{ +std::shared_ptr +GeomAlgoAPI_EdgeBuilder::lineCircle(std::shared_ptr theCircle) { GeomEdgePtr aRes; if (theCircle.get()) { - const gp_Circ& aCirc = theCircle->impl(); + const gp_Circ &aCirc = theCircle->impl(); BRepBuilderAPI_MakeEdge anEdgeBuilder(aCirc); TopoDS_Edge anEdge = anEdgeBuilder.Edge(); aRes = GeomEdgePtr(new GeomAPI_Edge); @@ -191,13 +190,14 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircle( } std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( - std::shared_ptr theCenter, std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint, std::shared_ptr theNormal) -{ + std::shared_ptr theCenter, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint, + std::shared_ptr theNormal) { std::shared_ptr aRes; - const gp_Pnt& aCenter = theCenter->impl(); - const gp_Dir& aDir = theNormal->impl(); + const gp_Pnt &aCenter = theCenter->impl(); + const gp_Dir &aDir = theNormal->impl(); /// OCCT creates an edge on a circle with empty radius, but visualization /// is not able to process it @@ -207,8 +207,8 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( double aRadius = theCenter->distance(theStartPoint); gp_Circ aCircle(gp_Ax2(aCenter, aDir), aRadius); - const gp_Pnt& aStart = theStartPoint->impl(); - const gp_Pnt& anEndInter = theEndPoint->impl(); + const gp_Pnt &aStart = theStartPoint->impl(); + const gp_Pnt &anEndInter = theEndPoint->impl(); // project end point to a circle gp_XYZ aEndDir = anEndInter.XYZ() - aCenter.XYZ(); @@ -227,17 +227,16 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( } std::shared_ptr GeomAlgoAPI_EdgeBuilder::ellipse( - const std::shared_ptr& theCenter, - const std::shared_ptr& theNormal, - const std::shared_ptr& theMajorAxis, - const double theMajorRadius, - const double theMinorRadius) -{ - const gp_Pnt& aCenter = theCenter->impl(); - const gp_Dir& aNormal = theNormal->impl(); - const gp_Dir& aMajorAxis = theMajorAxis->impl(); - - gp_Elips anEllipse(gp_Ax2(aCenter, aNormal, aMajorAxis), theMajorRadius, theMinorRadius); + const std::shared_ptr &theCenter, + const std::shared_ptr &theNormal, + const std::shared_ptr &theMajorAxis, + const double theMajorRadius, const double theMinorRadius) { + const gp_Pnt &aCenter = theCenter->impl(); + const gp_Dir &aNormal = theNormal->impl(); + const gp_Dir &aMajorAxis = theMajorAxis->impl(); + + gp_Elips anEllipse(gp_Ax2(aCenter, aNormal, aMajorAxis), theMajorRadius, + theMinorRadius); BRepBuilderAPI_MakeEdge anEdgeBuilder(anEllipse); std::shared_ptr aRes(new GeomAPI_Edge); @@ -247,25 +246,25 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::ellipse( } std::shared_ptr GeomAlgoAPI_EdgeBuilder::ellipticArc( - const std::shared_ptr& theCenter, - const std::shared_ptr& theNormal, - const std::shared_ptr& theMajorAxis, - const double theMajorRadius, - const double theMinorRadius, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd) -{ - std::shared_ptr anAx2(new GeomAPI_Ax2(theCenter, theNormal, theMajorAxis)); + const std::shared_ptr &theCenter, + const std::shared_ptr &theNormal, + const std::shared_ptr &theMajorAxis, + const double theMajorRadius, const double theMinorRadius, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd) { + std::shared_ptr anAx2( + new GeomAPI_Ax2(theCenter, theNormal, theMajorAxis)); GeomAPI_Ellipse anEllipse(anAx2, theMajorRadius, theMinorRadius); GeomPointPtr aStartPnt = anEllipse.project(theStart); - GeomPointPtr aEndPnt = anEllipse.project(theEnd); + GeomPointPtr aEndPnt = anEllipse.project(theEnd); double aStartParam, aEndParam; anEllipse.parameter(aStartPnt, Precision::Confusion(), aStartParam); anEllipse.parameter(aEndPnt, Precision::Confusion(), aEndParam); - BRepBuilderAPI_MakeEdge anEdgeBuilder(anEllipse.impl(), aStartParam, aEndParam); + BRepBuilderAPI_MakeEdge anEdgeBuilder(anEllipse.impl(), aStartParam, + aEndParam); GeomEdgePtr aRes(new GeomAPI_Edge); TopoDS_Edge anEdge = anEdgeBuilder.Edge(); aRes->setImpl(new TopoDS_Shape(anEdge)); @@ -273,25 +272,22 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::ellipticArc( } GeomEdgePtr GeomAlgoAPI_EdgeBuilder::bsplineOnPlane( - const std::shared_ptr& thePlane, - const std::list& thePoles, - const std::list& theWeights, - const std::list& theKnots, - const std::list& theMults, - const int theDegree, - const bool thePeriodic) -{ - std::shared_ptr aBSplineCurve( - new GeomAPI_BSpline2d(theDegree, thePoles, theWeights, theKnots, theMults, thePeriodic)); + const std::shared_ptr &thePlane, + const std::list &thePoles, + const std::list &theWeights, const std::list &theKnots, + const std::list &theMults, const int theDegree, + const bool thePeriodic) { + std::shared_ptr aBSplineCurve(new GeomAPI_BSpline2d( + theDegree, thePoles, theWeights, theKnots, theMults, thePeriodic)); return bsplineOnPlane(thePlane, aBSplineCurve); } GeomEdgePtr GeomAlgoAPI_EdgeBuilder::bsplineOnPlane( - const std::shared_ptr& thePlane, - const std::shared_ptr& theCurve) -{ - Handle(Geom_Curve) aCurve3D = GeomLib::To3d(thePlane->impl().Ax2(), - theCurve->impl()); + const std::shared_ptr &thePlane, + const std::shared_ptr &theCurve) { + Handle(Geom_Curve) aCurve3D = + GeomLib::To3d(thePlane->impl().Ax2(), + theCurve->impl()); BRepBuilderAPI_MakeEdge anEdgeBuilder(aCurve3D); GeomEdgePtr aRes(new GeomAPI_Edge); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h index 465074028..1f323c59c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_EdgeBuilder_H_ #define GeomAlgoAPI_EdgeBuilder_H_ -#include -#include -#include +#include #include +#include #include -#include +#include +#include #include #include @@ -37,75 +38,77 @@ class GeomAPI_BSpline2d; * \brief Allows to create face-shapes by different parameters */ -class GEOMALGOAPI_EXPORT GeomAlgoAPI_EdgeBuilder -{ - public: +class GEOMALGOAPI_EXPORT GeomAlgoAPI_EdgeBuilder { +public: /// Creates linear edge by two points. /// \param theStart a first point of an edge /// \param theEnd an end point of an edge - static std::shared_ptr line(std::shared_ptr theStart, - std::shared_ptr theEnd); + static std::shared_ptr + line(std::shared_ptr theStart, + std::shared_ptr theEnd); /// Creates linear edge by three dimensions. /// \param theX the X dimension /// \param theY the Y dimension /// \param theZ the Z dimension - static std::shared_ptr line(double theDX, - double theDY, + static std::shared_ptr line(double theDX, double theDY, double theDZ); /// Creates linear edge by GeomAPI_Lin. /// \param theLin line. - static std::shared_ptr line(const std::shared_ptr theLin); + static std::shared_ptr + line(const std::shared_ptr theLin); - /// Creates edge - axis of the given cylindrical face. The result axis edge is infinite - static std::shared_ptr cylinderAxis( - std::shared_ptr theCylindricalFace); + /// Creates edge - axis of the given cylindrical face. The result axis edge is + /// infinite + static std::shared_ptr + cylinderAxis(std::shared_ptr theCylindricalFace); /// Creates linear edge in a form of a circle by a point and a circle radius - static std::shared_ptr lineCircle(std::shared_ptr theCenter, - std::shared_ptr theNormal, - double theRadius); + static std::shared_ptr + lineCircle(std::shared_ptr theCenter, + std::shared_ptr theNormal, double theRadius); /// Creates linear edge in a form of a circle by GeomAPI_Circle - static std::shared_ptr lineCircle(std::shared_ptr theCircle); + static std::shared_ptr + lineCircle(std::shared_ptr theCircle); /// Creates linear edge in a form of a circle arc by a three points - static std::shared_ptr lineCircleArc(std::shared_ptr theCenter, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint, - std::shared_ptr theNormal); + static std::shared_ptr + lineCircleArc(std::shared_ptr theCenter, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint, + std::shared_ptr theNormal); /// Creates elliptic edge - static std::shared_ptr ellipse(const std::shared_ptr& theCenter, - const std::shared_ptr& theNormal, - const std::shared_ptr& theMajorAxis, - const double theMajorRadius, - const double theMinorRadius); - + static std::shared_ptr + ellipse(const std::shared_ptr &theCenter, + const std::shared_ptr &theNormal, + const std::shared_ptr &theMajorAxis, + const double theMajorRadius, const double theMinorRadius); /// Creates elliptic edge - static std::shared_ptr ellipticArc( - const std::shared_ptr& theCenter, - const std::shared_ptr& theNormal, - const std::shared_ptr& theMajorAxis, - const double theMajorRadius, - const double theMinorRadius, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd); + static std::shared_ptr + ellipticArc(const std::shared_ptr &theCenter, + const std::shared_ptr &theNormal, + const std::shared_ptr &theMajorAxis, + const double theMajorRadius, const double theMinorRadius, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd); /// Creates planar B-spline edge - static GeomEdgePtr bsplineOnPlane(const std::shared_ptr& thePlane, - const std::list >& thePoles, - const std::list& theWeights, - const std::list& theKnots, - const std::list& theMults, - const int theDegree, - const bool thePeriodic); + static GeomEdgePtr + bsplineOnPlane(const std::shared_ptr &thePlane, + const std::list> &thePoles, + const std::list &theWeights, + const std::list &theKnots, + const std::list &theMults, const int theDegree, + const bool thePeriodic); /// Creates planar B-spline edge - static GeomEdgePtr bsplineOnPlane(const std::shared_ptr& thePlane, - const std::shared_ptr& theCurve); + static GeomEdgePtr + bsplineOnPlane(const std::shared_ptr &thePlane, + const std::shared_ptr &theCurve); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp index 40bc6f0be..eff6891bb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp @@ -14,21 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include #include #include -#include #include #include #include +#include #include +#include +#include +#include #include #include @@ -39,8 +40,7 @@ GeomAlgoAPI_Ellipsoid::GeomAlgoAPI_Ellipsoid(const double theAx, const double theBy, const double theCz, const double theZCut1, - const double theZCut2) -{ + const double theZCut2) { myAx = theAx; myBy = theBy; myCz = theCz; @@ -49,8 +49,7 @@ GeomAlgoAPI_Ellipsoid::GeomAlgoAPI_Ellipsoid(const double theAx, } //================================================================================================= -bool GeomAlgoAPI_Ellipsoid::check() -{ +bool GeomAlgoAPI_Ellipsoid::check() { if (myAx < Precision::Confusion()) { myError = "Ellipsoid builder :: ax is negative or null."; return false; @@ -66,7 +65,8 @@ bool GeomAlgoAPI_Ellipsoid::check() } else if (myZCut2 < 0.) { myError = "Ellipsoid builder :: zcut2 is negative."; return false; - } else if (myZCut1 < Precision::Confusion() && myZCut2 < Precision::Confusion()) { + } else if (myZCut1 < Precision::Confusion() && + myZCut2 < Precision::Confusion()) { myError = "Ellipsoid builder :: zcut1 and zcut2 are null."; return false; } @@ -75,8 +75,7 @@ bool GeomAlgoAPI_Ellipsoid::check() } //================================================================================================= -void GeomAlgoAPI_Ellipsoid::build() -{ +void GeomAlgoAPI_Ellipsoid::build() { myCreatedFaces.clear(); BRepOffsetAPI_Sewing aSewer; @@ -90,7 +89,8 @@ void GeomAlgoAPI_Ellipsoid::build() gp_Ax1 aZAxis(anOrigin, aDirZ); // Calculate the parameters needed to make the edges and the faces - // gp_Elips needs the second parameter to be greater than the third (major axis) + // gp_Elips needs the second parameter to be greater than the third (major + // axis) if (myCz < myAx) { aRefAx2 = gp_Ax2(anOrigin, aDirY, aDirX); anElips = gp_Elips(aRefAx2, myAx / 2., myCz / 2.); @@ -99,11 +99,13 @@ void GeomAlgoAPI_Ellipsoid::build() anElips = gp_Elips(aRefAx2, myCz / 2., myAx / 2.); } - double aLowPositionFactor = sqrt(1. - (myZCut1 * myZCut1 * 4. / (myCz * myCz))) / 2.; - double aHighPositionFactor = sqrt(1. - (myZCut2 * myZCut2 * 4. / (myCz * myCz))) / 2.; + double aLowPositionFactor = + sqrt(1. - (myZCut1 * myZCut1 * 4. / (myCz * myCz))) / 2.; + double aHighPositionFactor = + sqrt(1. - (myZCut2 * myZCut2 * 4. / (myCz * myCz))) / 2.; double aXEndTop = myAx * aHighPositionFactor; - double aXEndBottom = myAx * aLowPositionFactor; + double aXEndBottom = myAx * aLowPositionFactor; // Build the XZ ellipse gp_Pnt anEndPoint1(aXEndTop, 0., myZCut2); @@ -112,18 +114,17 @@ void GeomAlgoAPI_Ellipsoid::build() anElipsBuilder.Build(); TopoDS_Edge anOuterEdge = anElipsBuilder.Edge(); - // Perform a revolution based on the section to build a simple version of the outer face - // (isotropic in XY) - BRepPrimAPI_MakeRevol aRevolBuilder(anOuterEdge, aZAxis, 2. * M_PI, Standard_True); + // Perform a revolution based on the section to build a simple version of the + // outer face (isotropic in XY) + BRepPrimAPI_MakeRevol aRevolBuilder(anOuterEdge, aZAxis, 2. * M_PI, + Standard_True); if (!aRevolBuilder.IsDone()) { myError = "Ellipsoid builder :: section revolution did not succeed"; return; } gp_GTrsf aGTrsf; - gp_Mat rot (1., 0., 0., - 0., myBy / myAx, 0., - 0., 0., 1.); + gp_Mat rot(1., 0., 0., 0., myBy / myAx, 0., 0., 0., 1.); aGTrsf.SetVectorialPart(rot); @@ -144,20 +145,24 @@ void GeomAlgoAPI_Ellipsoid::build() if (myBy < myAx) { if ((myCz / 2. - myZCut1) > Precision::Confusion()) { aLowAx2 = gp_Ax2(gp_Pnt(0., 0., -myZCut1), aDirZ, aDirX); - aLowElips = gp_Elips(aLowAx2, aLowPositionFactor * myAx, aLowPositionFactor * myBy); + aLowElips = gp_Elips(aLowAx2, aLowPositionFactor * myAx, + aLowPositionFactor * myBy); } if ((myCz / 2. - myZCut2) > Precision::Confusion()) { aHighAx2 = gp_Ax2(gp_Pnt(0., 0., myZCut2), aDirZ, aDirX); - aHighElips = gp_Elips(aHighAx2, aHighPositionFactor * myAx, aHighPositionFactor * myBy); + aHighElips = gp_Elips(aHighAx2, aHighPositionFactor * myAx, + aHighPositionFactor * myBy); } } else { if ((myCz / 2. - myZCut1) > Precision::Confusion()) { aLowAx2 = gp_Ax2(gp_Pnt(0., 0., -myZCut1), aDirZ, aDirY); - aLowElips = gp_Elips(aLowAx2, aLowPositionFactor * myBy, aLowPositionFactor * myAx); + aLowElips = gp_Elips(aLowAx2, aLowPositionFactor * myBy, + aLowPositionFactor * myAx); } if ((myCz / 2. - myZCut2) > Precision::Confusion()) { aHighAx2 = gp_Ax2(gp_Pnt(0., 0., myZCut2), aDirZ, aDirY); - aHighElips = gp_Elips(aHighAx2, aHighPositionFactor * myBy, aHighPositionFactor * myAx); + aHighElips = gp_Elips(aHighAx2, aHighPositionFactor * myBy, + aHighPositionFactor * myAx); } } @@ -194,12 +199,13 @@ void GeomAlgoAPI_Ellipsoid::build() aBuilder.Add(aShell, aSewer.SewedShape()); } - BRepBuilderAPI_MakeSolid *anEllipsoidMk = new BRepBuilderAPI_MakeSolid(aShell); + BRepBuilderAPI_MakeSolid *anEllipsoidMk = + new BRepBuilderAPI_MakeSolid(aShell); anEllipsoidMk->Build(); // Store and publish the results std::shared_ptr aResultShape = - std::shared_ptr(new GeomAPI_Shape()); + std::shared_ptr(new GeomAPI_Shape()); aResultShape->setImpl(new TopoDS_Shape(anEllipsoidMk->Solid())); setShape(aResultShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h index bd1ceb316..e72762d58 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_ELLIPSOID_H_ @@ -26,9 +27,8 @@ * \ingroup DataAlgo * \brief Allows to create Ellipsoid GDML Primitives. */ -class GeomAlgoAPI_Ellipsoid : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Ellipsoid : public GeomAlgoAPI_MakeShape { +public: /// Creates a ellipsoid using standard GDML parameters. /// \param theAx X dimension of the ellipsoid. /// \param theBy Y dimension of the ellipsoid. @@ -47,13 +47,12 @@ class GeomAlgoAPI_Ellipsoid : public GeomAlgoAPI_MakeShape /// Builds the ellipsoid based on the parameters given in the constructor. GEOMALGOAPI_EXPORT void build(); - private: - double myAx; /// X dimension of the ellipsoid. - double myBy; /// Y dimension of the ellipsoid. - double myCz; /// Z dimension of the ellipsoid. +private: + double myAx; /// X dimension of the ellipsoid. + double myBy; /// Y dimension of the ellipsoid. + double myCz; /// Z dimension of the ellipsoid. double myZCut1; /// Lower z cut. double myZCut2; /// Upper z cut. }; #endif // GEOMALGOAPI_ELLIPSOID_H_ - diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp index 00c7ab0df..d07877fca 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp @@ -14,24 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include //================================================================================================= GeomAlgoAPI_Exception::GeomAlgoAPI_Exception(std::string theMessageError) -: myMessageError(theMessageError) -{ -} + : myMessageError(theMessageError) {} //================================================================================================= -GeomAlgoAPI_Exception::~GeomAlgoAPI_Exception() noexcept -{ -} +GeomAlgoAPI_Exception::~GeomAlgoAPI_Exception() noexcept {} //================================================================================================= -const char* GeomAlgoAPI_Exception::what() const noexcept -{ +const char *GeomAlgoAPI_Exception::what() const noexcept { return myMessageError.c_str(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h index 21aed8ef1..6e88d5cb1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Exception_H_ @@ -28,20 +29,18 @@ * \ingroup DataAlgo * \brief Manage exceptions */ -class GeomAlgoAPI_Exception : public std::exception -{ - public: +class GeomAlgoAPI_Exception : public std::exception { +public: /// Create an exception /// \param theMessageError Error message to be displayed GEOMALGOAPI_EXPORT GeomAlgoAPI_Exception(std::string theMessageError); /// Destroyer GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Exception() noexcept; /// Allows to collet the error - GEOMALGOAPI_EXPORT const char* what() const noexcept; + GEOMALGOAPI_EXPORT const char *what() const noexcept; private: std::string myMessageError; /// Error message to be displayed. }; - #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp index bb3544583..9b240c8a9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp @@ -14,65 +14,62 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_FaceBuilder.h" -#include #include +#include #include #include #include #include -#include #include +#include #include #include -#include #include #include +#include //================================================================================================== std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace( - const std::shared_ptr theCenter, - const std::shared_ptr theNormal, - const double theSize) -{ - const gp_Pnt& aCenter = theCenter->impl(); - const gp_Dir& aDir = theNormal->impl(); + const std::shared_ptr theCenter, + const std::shared_ptr theNormal, const double theSize) { + const gp_Pnt &aCenter = theCenter->impl(); + const gp_Dir &aDir = theNormal->impl(); gp_Pln aPlane(aCenter, aDir); // half of the size in each direction from the center - BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, -theSize / 2., theSize / 2., -theSize / 2., - theSize / 2.); + BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, -theSize / 2., theSize / 2., + -theSize / 2., theSize / 2.); std::shared_ptr aRes(new GeomAPI_Face()); aRes->setImpl(new TopoDS_Face(aFaceBuilder.Face())); return aRes; } //================================================================================================== -std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace( - const std::shared_ptr thePlane, - const double theSize) -{ +std::shared_ptr +GeomAlgoAPI_FaceBuilder::squareFace(const std::shared_ptr thePlane, + const double theSize) { // half of the size in each direction from the center - BRepBuilderAPI_MakeFace aFaceBuilder(thePlane->impl(), - -theSize / 2., theSize / 2., - -theSize / 2., theSize / 2.); + BRepBuilderAPI_MakeFace aFaceBuilder(thePlane->impl(), -theSize / 2., + theSize / 2., -theSize / 2., + theSize / 2.); std::shared_ptr aRes(new GeomAPI_Face()); - const TopoDS_Face& aFace = aFaceBuilder.Face(); + const TopoDS_Face &aFace = aFaceBuilder.Face(); aRes->setImpl(new TopoDS_Face(aFace)); return aRes; } //================================================================================================== std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace( - const std::shared_ptr theCenter, - const std::shared_ptr theNormal) -{ - const gp_Pnt& aCenter = theCenter->impl(); - const gp_Dir& aDir = theNormal->impl(); + const std::shared_ptr theCenter, + const std::shared_ptr theNormal) { + const gp_Pnt &aCenter = theCenter->impl(); + const gp_Dir &aDir = theNormal->impl(); gp_Pln aPlane(aCenter, aDir); BRepBuilderAPI_MakeFace aFaceBuilder(aPlane); std::shared_ptr aRes(new GeomAPI_Face()); @@ -82,35 +79,33 @@ std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace( //================================================================================================== std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace( - const std::shared_ptr thePlane, - const double theX, const double theY, - const double theWidth, const double theHeight) -{ + const std::shared_ptr thePlane, const double theX, + const double theY, const double theWidth, const double theHeight) { double aA, aB, aC, aD; thePlane->coefficients(aA, aB, aC, aD); gp_Pln aPlane(aA, aB, aC, aD); // half of the size in each direction from the center - BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, theX, theX + theWidth, - theY, theY + theHeight); + BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, theX, theX + theWidth, theY, + theY + theHeight); std::shared_ptr aRes(new GeomAPI_Face()); aRes->setImpl(new TopoDS_Face(aFaceBuilder.Face())); return aRes; } //================================================================================================== -std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFaceByThreeVertices( +std::shared_ptr +GeomAlgoAPI_FaceBuilder::planarFaceByThreeVertices( const std::shared_ptr theVertex1, const std::shared_ptr theVertex2, - const std::shared_ptr theVertex3) -{ + const std::shared_ptr theVertex3) { gp_Pnt aPnt1 = theVertex1->point()->impl(); gp_Pnt aPnt2 = theVertex2->point()->impl(); gp_Pnt aPnt3 = theVertex3->point()->impl(); std::shared_ptr aFace; GC_MakePlane aMakePlane(aPnt1, aPnt2, aPnt3); - if(!aMakePlane.IsDone()) { + if (!aMakePlane.IsDone()) { return aFace; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h index ee386df03..123b911ee 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_FaceBuilder_H_ @@ -33,33 +34,35 @@ class GeomAPI_Vertex; /// \class GeomAlgoAPI_FaceBuilder /// \ingroup DataAlgo /// \brief Allows to create face-shapes by different parameters -class GEOMALGOAPI_EXPORT GeomAlgoAPI_FaceBuilder -{ - public: +class GEOMALGOAPI_EXPORT GeomAlgoAPI_FaceBuilder { +public: /// Creates square planar face by given point of the center, /// normal to the plane and size of square - static std::shared_ptr squareFace(const std::shared_ptr theCenter, - const std::shared_ptr theNormal, - const double theSize); + static std::shared_ptr + squareFace(const std::shared_ptr theCenter, + const std::shared_ptr theNormal, + const double theSize); /// Creates square planar face by given point of the center, /// normal to the plane and size of square - static std::shared_ptr squareFace(const std::shared_ptr thePlane, - const double theSize); + static std::shared_ptr + squareFace(const std::shared_ptr thePlane, const double theSize); - /// Creates the planar face by given point of the center and normal to the plane. - static std::shared_ptr planarFace(const std::shared_ptr theCenter, - const std::shared_ptr theNormal); + /// Creates the planar face by given point of the center and normal to the + /// plane. + static std::shared_ptr + planarFace(const std::shared_ptr theCenter, + const std::shared_ptr theNormal); /// Creates a planar face by given plane, left lower point and size. - static std::shared_ptr planarFace(const std::shared_ptr thePlane, - const double theX, const double theY, - const double theWidth, const double theHeight); + static std::shared_ptr + planarFace(const std::shared_ptr thePlane, const double theX, + const double theY, const double theWidth, const double theHeight); /// Creates a planar face by three vertices. - static std::shared_ptr planarFaceByThreeVertices( - const std::shared_ptr theVertex1, - const std::shared_ptr theVertex2, - const std::shared_ptr theVertex3); + static std::shared_ptr + planarFaceByThreeVertices(const std::shared_ptr theVertex1, + const std::shared_ptr theVertex2, + const std::shared_ptr theVertex3); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp index f8ceeb5b9..439c04fb8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp @@ -14,44 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include //================================================================================================= -GeomAlgoAPI_Fillet::GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFilletEdges, - const double theFilletRadius) -{ +GeomAlgoAPI_Fillet::GeomAlgoAPI_Fillet(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFilletEdges, + const double theFilletRadius) { build(theBaseSolid, theFilletEdges, theFilletRadius); } //================================================================================================= -GeomAlgoAPI_Fillet::GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFilletEdges, - const double theStartRadius, - const double theEndRadius) -{ +GeomAlgoAPI_Fillet::GeomAlgoAPI_Fillet(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFilletEdges, + const double theStartRadius, + const double theEndRadius) { if (theEndRadius < 0.) return; build(theBaseSolid, theFilletEdges, theStartRadius, theEndRadius); } //================================================================================================= -void GeomAlgoAPI_Fillet::build(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFilletEdges, - const double theStartRadius, - const double theEndRadius) -{ +void GeomAlgoAPI_Fillet::build(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFilletEdges, + const double theStartRadius, + const double theEndRadius) { if (!theBaseSolid || theFilletEdges.empty() || theStartRadius < 0.) return; // create fillet builder - BRepFilletAPI_MakeFillet* aFilletBuilder = + BRepFilletAPI_MakeFillet *aFilletBuilder = new BRepFilletAPI_MakeFillet(theBaseSolid->impl()); setImpl(aFilletBuilder); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); @@ -60,7 +58,7 @@ void GeomAlgoAPI_Fillet::build(const GeomShapePtr& theBaseSolid, for (ListOfShape::const_iterator anIt = theFilletEdges.begin(); anIt != theFilletEdges.end(); ++anIt) { if ((*anIt)->isEdge()) - aFilletBuilder->Add( (*anIt)->impl() ); + aFilletBuilder->Add((*anIt)->impl()); } // assign fillet radii for each contour of filleting edges @@ -77,7 +75,8 @@ void GeomAlgoAPI_Fillet::build(const GeomShapePtr& theBaseSolid, aFilletBuilder->Build(); if (!aFilletBuilder->IsDone()) return; - TopoDS_Shape aResult = GeomAlgoAPI_DFLoader::refineResult(aFilletBuilder->Shape()); + TopoDS_Shape aResult = + GeomAlgoAPI_DFLoader::refineResult(aFilletBuilder->Shape()); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.h b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.h index 0f921f969..73166e078 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Fillet_H_ @@ -28,26 +29,25 @@ /// \class GeomAlgoAPI_Fillet /// \ingroup DataAlgo /// \brief Perform fillet -class GeomAlgoAPI_Fillet : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Fillet : public GeomAlgoAPI_MakeShape { public: /// Run fillet operation with fixed radius. /// \param theBaseSolid a changing solid /// \param theFilletEdges list of edges the fillet is performed on /// \param theFilletRadius radius of the fillet - GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFilletEdges, - const double theFilletRadius); + GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFilletEdges, + const double theFilletRadius); /// Run fillet operation with variable radius. /// \param theBaseSolid a changing solid /// \param theFilletEdges list of edges the fillet is performed on /// \param theStartRadius start radius of the fillet /// \param theEndRadius end radius of the fillet - GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFilletEdges, - const double theStartRadius, - const double theEndRadius); + GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFilletEdges, + const double theStartRadius, + const double theEndRadius); private: /// Perform fillet operation. @@ -56,10 +56,9 @@ private: /// \param theFilletEdges list of edges the fillet is performed on /// \param theStartRadius start radius of the fillet /// \param theEndRadius end radius of the fillet - void build(const GeomShapePtr& theBaseSolid, - const ListOfShape& theFilletEdges, - const double theStartRadius, - const double theEndRadius = -1.0); + void build(const GeomShapePtr &theBaseSolid, + const ListOfShape &theFilletEdges, const double theStartRadius, + const double theEndRadius = -1.0); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp index 6d0b9ad50..3f09506f3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp @@ -14,44 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include +#include #include #include #include -#include #include #include #include +#include #include #include -#include #include -#include #include +#include #include #include #include -static GeomShapePtr convert(const TopoDS_Shape& theShape) -{ +static GeomShapePtr convert(const TopoDS_Shape &theShape) { GeomShapePtr aNewShape(new GeomAPI_Shape); aNewShape->setImpl(new TopoDS_Shape(theShape)); return aNewShape; } -static void substituteNewEdge(GeomEdgePtr theEdge, - std::map& theMap) -{ - std::map::iterator anIt = theMap.begin(); +static void substituteNewEdge( + GeomEdgePtr theEdge, + std::map &theMap) { + std::map::iterator + anIt = theMap.begin(); for (; anIt != theMap.end(); ++anIt) { - for (ListOfShape::iterator aEIt = anIt->second.begin(); aEIt != anIt->second.end(); ++aEIt) + for (ListOfShape::iterator aEIt = anIt->second.begin(); + aEIt != anIt->second.end(); ++aEIt) if (theEdge->isEqual(*aEIt)) { // substitute edge and stop iteration *aEIt = theEdge; @@ -60,18 +62,15 @@ static void substituteNewEdge(GeomEdgePtr theEdge, } } - -GeomAlgoAPI_Fillet1D::GeomAlgoAPI_Fillet1D(const GeomShapePtr& theBaseWire, - const ListOfShape& theFilletVertices, - const double theFilletRadius) -{ +GeomAlgoAPI_Fillet1D::GeomAlgoAPI_Fillet1D(const GeomShapePtr &theBaseWire, + const ListOfShape &theFilletVertices, + const double theFilletRadius) { build(theBaseWire, theFilletVertices, theFilletRadius); } -void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseShape, - const ListOfShape& theFilletVertices, - const double theRadius) -{ +void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr &theBaseShape, + const ListOfShape &theFilletVertices, + const double theRadius) { if (!theBaseShape.get() || theFilletVertices.empty() || theRadius < 0.) return; @@ -82,27 +81,30 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseShape, aShape = buildWire(theBaseShape, theFilletVertices, theRadius); else if (theBaseShape->isCompound()) { std::list aShapes; - for (GeomAPI_ShapeIterator it (theBaseShape); it.more(); it.next()) { + for (GeomAPI_ShapeIterator it(theBaseShape); it.more(); it.next()) { GeomShapePtr aSubShape = it.current(); if (aSubShape->isWire()) { // get only fillet vertices of current wire ListOfShape aFilletVertices; - std::set aFilletVerticesSet - (theFilletVertices.begin(), theFilletVertices.end()); - for (GeomAPI_WireExplorer anExp(aSubShape->wire()); anExp.more(); anExp.next()) { - if (aFilletVerticesSet.find(anExp.currentVertex()) != aFilletVerticesSet.end()) + std::set aFilletVerticesSet( + theFilletVertices.begin(), theFilletVertices.end()); + for (GeomAPI_WireExplorer anExp(aSubShape->wire()); anExp.more(); + anExp.next()) { + if (aFilletVerticesSet.find(anExp.currentVertex()) != + aFilletVerticesSet.end()) aFilletVertices.push_back(anExp.currentVertex()); } - GeomShapePtr aShape_i = buildWire(aSubShape, aFilletVertices, theRadius); + GeomShapePtr aShape_i = + buildWire(aSubShape, aFilletVertices, theRadius); if (aShape_i.get() != NULL) aShapes.push_back(aShape_i); else aShapes.push_back(aSubShape); - } - else { + } else { setDone(false); - myError = "Input shape for fillet is neither a wire nor a compound of wires"; + myError = + "Input shape for fillet is neither a wire nor a compound of wires"; return; } } @@ -118,23 +120,25 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseShape, setDone(myFailedVertices.empty()); } -GeomShapePtr GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr& theBaseWire, - const ListOfShape& theFilletVertices, - const double theRadius) -{ +GeomShapePtr +GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr &theBaseWire, + const ListOfShape &theFilletVertices, + const double theRadius) { std::shared_ptr aShape; if (!theBaseWire.get() || theFilletVertices.empty() || theRadius < 0.) return aShape; - // store all edges of a base wire as modified, because they will be rebuild by ShapeFix - for (GeomAPI_WireExplorer aWExp(theBaseWire->wire()); aWExp.more(); aWExp.next()) { + // store all edges of a base wire as modified, because they will be rebuild by + // ShapeFix + for (GeomAPI_WireExplorer aWExp(theBaseWire->wire()); aWExp.more(); + aWExp.next()) { GeomShapePtr aCurrent = aWExp.current(); GeomAlgoAPI_Copy aCopy(aCurrent); myModified[aCurrent].push_back(aCopy.shape()); } GeomAlgoAPI_MapShapesAndAncestors aMapVE(theBaseWire, GeomAPI_Shape::VERTEX, - GeomAPI_Shape::EDGE); + GeomAPI_Shape::EDGE); for (ListOfShape::const_iterator aVIt = theFilletVertices.begin(); aVIt != theFilletVertices.end(); ++aVIt) { @@ -166,7 +170,8 @@ GeomShapePtr GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr& theBaseWire, TopoDS_Edge aFilletEdge; if (isOk) { GeomPointPtr aPoint = aVE->first->vertex()->point(); - aFilletEdge = aFilletBuilder.Result(aPoint->impl(), anEdge1, anEdge2); + aFilletEdge = + aFilletBuilder.Result(aPoint->impl(), anEdge1, anEdge2); isOk = !aFilletEdge.IsNull(); } @@ -198,12 +203,14 @@ GeomShapePtr GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr& theBaseWire, modified(aWExp.current(), aNewEdges); if (aNewEdges.empty()) aNewEdges.push_back(aWExp.current()); - for (ListOfShape::iterator anIt = aNewEdges.begin(); anIt != aNewEdges.end(); ++anIt) + for (ListOfShape::iterator anIt = aNewEdges.begin(); + anIt != aNewEdges.end(); ++anIt) aBuilder.Add(aNewWire, TopoDS::Edge((*anIt)->impl())); ListOfShape aNewEdges1; generated(aWExp.currentVertex(), aNewEdges1); - for (ListOfShape::iterator anIt = aNewEdges1.begin(); anIt != aNewEdges1.end(); ++anIt) + for (ListOfShape::iterator anIt = aNewEdges1.begin(); + anIt != aNewEdges1.end(); ++anIt) aBuilder.Add(aNewWire, TopoDS::Edge((*anIt)->impl())); } // fix the wire connectivity @@ -217,7 +224,8 @@ GeomShapePtr GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr& theBaseWire, return aShape; } - // update the map of modified shapes, because the edges are changed by ShapeFix + // update the map of modified shapes, because the edges are changed by + // ShapeFix for (BRepTools_WireExplorer anExp(aNewWire); anExp.More(); anExp.Next()) { GeomEdgePtr aCurrent(new GeomAPI_Edge); aCurrent->setImpl(new TopoDS_Edge(anExp.Current())); @@ -257,16 +265,14 @@ GeomShapePtr GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr& theBaseWire, } void GeomAlgoAPI_Fillet1D::generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { MapModified::iterator aFound = myGenerated.find(theOldShape); if (aFound != myGenerated.end()) theNewShapes = aFound->second; } void GeomAlgoAPI_Fillet1D::modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { MapModified::iterator aFound = myModified.find(theOldShape); if (aFound != myModified.end()) theNewShapes = aFound->second; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h index 5885bec5e..284b978b5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Fillet1D_H_ @@ -28,50 +29,51 @@ /// \class GeomAlgoAPI_Fillet1D /// \ingroup DataAlgo /// \brief Perform fillet on vertices of a wire -class GeomAlgoAPI_Fillet1D : public GeomAlgoAPI_MakeShape -{ - typedef std::map MapModified; +class GeomAlgoAPI_Fillet1D : public GeomAlgoAPI_MakeShape { + typedef std::map + MapModified; public: /// Run fillet operation on a set of vertices with fixed radius. /// \param theBaseWire a wire or a compound of wires /// \param theFilletVertices list of vertices the fillet is performed on /// \param theFilletRadius radius of the fillet - GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet1D(const GeomShapePtr& theBaseWire, - const ListOfShape& theFilletVertices, - const double theFilletRadius); + GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet1D(const GeomShapePtr &theBaseWire, + const ListOfShape &theFilletVertices, + const double theFilletRadius); /// \return the list of shapes generated from the shape \a theShape. /// \param[in] theOldShape base shape. - /// \param[out] theNewShapes shapes generated from \a theShape. Does not cleared! + /// \param[out] theNewShapes shapes generated from \a theShape. Does not + /// cleared! GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theOldShape base shape. - /// \param[out] theNewShapes shapes modified from \a theShape. Does not cleared! + /// \param[out] theNewShapes shapes modified from \a theShape. Does not + /// cleared! GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); /// \return List of failed vertices - const ListOfShape& failedVertices() const { return myFailedVertices; } + const ListOfShape &failedVertices() const { return myFailedVertices; } private: /// Perform 1d-fillet on a wire or a compound of wires /// \param theBaseShape the base wire or a compound of wires for fillet /// \param theFilletVertices list of vertices of fillet /// \param theRadius fillet radius - void build(const GeomShapePtr& theBaseShape, - const ListOfShape& theFilletVertices, - const double theRadius); + void build(const GeomShapePtr &theBaseShape, + const ListOfShape &theFilletVertices, const double theRadius); /// Perform 1d-fillet on wire /// \param theBaseWire the base wire for fillet /// \param theFilletVertices list of vertices of fillet /// \param theRadius fillet radius - GeomShapePtr buildWire(const GeomShapePtr& theBaseWire, - const ListOfShape& theFilletVertices, - const double theRadius); + GeomShapePtr buildWire(const GeomShapePtr &theBaseWire, + const ListOfShape &theFilletVertices, + const double theRadius); private: MapModified myGenerated; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp index c80cd5691..17fb451cc 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp @@ -14,31 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Filling.h" -#include #include -#include -#include -#include +#include #include #include #include #include +#include +#include +#include #include #include #include #include -static void edgesToCurves(const std::list& theEdges, - std::list& theCurves) -{ +static void edgesToCurves(const std::list &theEdges, + std::list &theCurves) { for (std::list::const_iterator anIt = theEdges.begin(); anIt != theEdges.end(); ++anIt) { - const TopoDS_Edge& anEdge = (*anIt)->impl(); + const TopoDS_Edge &anEdge = (*anIt)->impl(); if (BRep_Tool::Degenerated(anEdge)) continue; @@ -53,27 +53,19 @@ static void edgesToCurves(const std::list& theEdges, } } - GeomAlgoAPI_Filling::GeomAlgoAPI_Filling(const int theMinDegree, const int theMaxDegree, const int theNbIter, const double theTol2D, const double theTol3D) - : myMinDegree(theMinDegree), - myMaxDegree(theMaxDegree), - myNbIter(theNbIter), - myTol2D(theTol2D), - myTol3D(theTol3D) -{ -} + : myMinDegree(theMinDegree), myMaxDegree(theMaxDegree), myNbIter(theNbIter), + myTol2D(theTol2D), myTol3D(theTol3D) {} -void GeomAlgoAPI_Filling::add(const GeomEdgePtr theEdge) -{ +void GeomAlgoAPI_Filling::add(const GeomEdgePtr theEdge) { myConstraints.push_back(theEdge); } -void GeomAlgoAPI_Filling::build(bool isApproximate) -{ +void GeomAlgoAPI_Filling::build(bool isApproximate) { if (myConstraints.size() <= 1) // not enough edges return; @@ -83,8 +75,7 @@ void GeomAlgoAPI_Filling::build(bool isApproximate) buildByEdges(); } -void GeomAlgoAPI_Filling::buildByEdges() -{ +void GeomAlgoAPI_Filling::buildByEdges() { GeomFill_SectionGenerator aSection; // obtain section curves @@ -101,13 +92,15 @@ void GeomAlgoAPI_Filling::buildByEdges() // check myMaxDegree >= aCurves.size() - 1 to be able to interpolate a surface if (myMaxDegree + 1 < aNbCurves) { - myError = "Unable to interpolate surface," - " Max deg + 1 should be greater or equal than number of sections."; + myError = + "Unable to interpolate surface," + " Max deg + 1 should be greater or equal than number of sections."; return; } // perform filling by sections - GeomFill_AppSurf anAppSurf(myMinDegree, myMaxDegree, myTol3D, myTol2D, myNbIter); + GeomFill_AppSurf anAppSurf(myMinDegree, myMaxDegree, myTol3D, myTol2D, + myNbIter); anAppSurf.Perform(aLine, aSection); if (!anAppSurf.IsDone()) { myError = "Approximation algorithm failed."; @@ -118,8 +111,9 @@ void GeomAlgoAPI_Filling::buildByEdges() Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots; anAppSurf.SurfShape(UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots); Handle(Geom_BSplineSurface) GBS = new Geom_BSplineSurface( - anAppSurf.SurfPoles(), anAppSurf.SurfWeights(), anAppSurf.SurfUKnots(), anAppSurf.SurfVKnots(), - anAppSurf.SurfUMults(), anAppSurf.SurfVMults(), anAppSurf.UDegree(), anAppSurf.VDegree()); + anAppSurf.SurfPoles(), anAppSurf.SurfWeights(), anAppSurf.SurfUKnots(), + anAppSurf.SurfVKnots(), anAppSurf.SurfUMults(), anAppSurf.SurfVMults(), + anAppSurf.UDegree(), anAppSurf.VDegree()); if (GBS.IsNull()) return; @@ -132,8 +126,7 @@ void GeomAlgoAPI_Filling::buildByEdges() setDone(true); } -static Handle(Geom_Curve) removeTrim(const Handle(Geom_Curve)& theCurve) -{ +static Handle(Geom_Curve) removeTrim(const Handle(Geom_Curve) & theCurve) { Handle(Geom_Curve) aCurve = theCurve; Handle(Geom_TrimmedCurve) aTC = Handle(Geom_TrimmedCurve)::DownCast(aCurve); while (!aTC.IsNull()) { @@ -143,8 +136,7 @@ static Handle(Geom_Curve) removeTrim(const Handle(Geom_Curve)& theCurve) return aCurve; } -void GeomAlgoAPI_Filling::buildByControlPoints() -{ +void GeomAlgoAPI_Filling::buildByControlPoints() { // obtain section curves std::list aCurves; edgesToCurves(myConstraints, aCurves); @@ -153,7 +145,8 @@ void GeomAlgoAPI_Filling::buildByControlPoints() int aMaxPoles = 0; std::list::iterator anIt = aCurves.begin(); for (; anIt != aCurves.end(); ++anIt) { - Handle(Geom_BSplineCurve) aBC = Handle(Geom_BSplineCurve)::DownCast(removeTrim(*anIt)); + Handle(Geom_BSplineCurve) aBC = + Handle(Geom_BSplineCurve)::DownCast(removeTrim(*anIt)); if (!aBC.IsNull()) aMaxPoles = Max(aMaxPoles, aBC->NbPoles()); } @@ -162,7 +155,7 @@ void GeomAlgoAPI_Filling::buildByControlPoints() // size of this array: by U parameter - number of curves, // by V parameter - determ using MaxNbPoles but it's // value must be between 21(min) and 101(max) - int aNbSections = (int) aCurves.size(); + int aNbSections = (int)aCurves.size(); int aNbPntInSection = Max(21, 2 * aMaxPoles - 1); TColgp_Array2OfPnt aPoints(1, aNbSections, 1, aNbPntInSection); anIt = aCurves.begin(); @@ -175,12 +168,13 @@ void GeomAlgoAPI_Filling::buildByControlPoints() gp_Pnt aPnt; for (int j = 0; j < aNbPntInSection; j++) { aC->D0(fp + dp * j, aPnt); - aPoints.SetValue(i, j+1, aPnt); + aPoints.SetValue(i, j + 1, aPnt); } } // convert a grid of points to B-spline surface - GeomAPI_PointsToBSplineSurface aPTB(aPoints, myMinDegree, myMaxDegree, GeomAbs_C2, myTol3D); + GeomAPI_PointsToBSplineSurface aPTB(aPoints, myMinDegree, myMaxDegree, + GeomAbs_C2, myTol3D); Handle(Geom_BSplineSurface) aBS = aPTB.Surface(); if (aBS.IsNull()) return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.h b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.h index 8d6ef656f..552028945 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Filling_H_ @@ -28,17 +29,17 @@ /// \class GeomAlgoAPI_Filling /// \ingroup DataAlgo /// \brief Perform building face by the set of edges/wires -class GeomAlgoAPI_Filling : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Filling : public GeomAlgoAPI_MakeShape { public: /// \brief Construct filling operation by the parameters. GEOMALGOAPI_EXPORT GeomAlgoAPI_Filling(const int theMinDegree = 2, const int theMaxDegree = 5, - const int theNbIter = 0, + const int theNbIter = 0, const double theTol2D = 1.e-4, const double theTol3D = 1.e-4); - /// \brief Add an edge to constrain filling (the result face should pass through the edge) + /// \brief Add an edge to constrain filling (the result face should pass + /// through the edge) GEOMALGOAPI_EXPORT void add(const GeomEdgePtr theEdge); /// \brief Perform filling operation diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp index 5b3e9ad1a..21c82781f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp @@ -14,62 +14,57 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_GlueFaces.h" -#include -#include -#include #include +#include +#include +#include #include #include #include //================================================================================================== -GeomAlgoAPI_GlueFaces::GeomAlgoAPI_GlueFaces(const ListOfShape& theShapes, const double theTolerance/*=1.e-7*/, const bool theKeepNonSolids/*=true*/) -{ +GeomAlgoAPI_GlueFaces::GeomAlgoAPI_GlueFaces( + const ListOfShape &theShapes, const double theTolerance /*=1.e-7*/, + const bool theKeepNonSolids /*=true*/) { build(theShapes, theTolerance, theKeepNonSolids); } //================================================================================================== -void GeomAlgoAPI_GlueFaces::build(const ListOfShape& theShapes, const double theTolerance, const bool theKeepNonSolids) -{ - if (theShapes.empty()) - { +void GeomAlgoAPI_GlueFaces::build(const ListOfShape &theShapes, + const double theTolerance, + const bool theKeepNonSolids) { + if (theShapes.empty()) { return; } // Create a compound of all shapes in the list TopoDS_Shape aBaseShape; - if (theShapes.size() == 1) - { + if (theShapes.size() == 1) { aBaseShape = theShapes.front()->impl(); - } - else - { + } else { TopoDS_Compound aCompound; BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); ListOfShape::const_iterator anIt = theShapes.cbegin(); - for (; anIt != theShapes.cend(); ++anIt) - { - const TopoDS_Shape& aShape = (*anIt)->impl(); - if (aShape.IsNull()) break; + for (; anIt != theShapes.cend(); ++anIt) { + const TopoDS_Shape &aShape = (*anIt)->impl(); + if (aShape.IsNull()) + break; aBuilder.Add(aCompound, aShape); } - if (anIt == theShapes.cend()) - { + if (anIt == theShapes.cend()) { aBaseShape = aCompound; - } - else - { + } else { aBaseShape.Nullify(); } } - if (aBaseShape.IsNull()) - { + if (aBaseShape.IsNull()) { myError = "Shape for gluing is null"; return; } @@ -85,17 +80,14 @@ void GeomAlgoAPI_GlueFaces::build(const ListOfShape& theShapes, const double the // Detect interfered shapes aGlueAlgo.Detect(); Standard_Integer iWrnDetect = aGlueAlgo.WarningStatus(); - if (iWrnDetect == 2) - { + if (iWrnDetect == 2) { myError = "Glue Error Sticked Shapes"; return; } Standard_Integer iErr = aGlueAlgo.ErrorStatus(); - if (iErr) - { - switch (iErr) - { + if (iErr) { + switch (iErr) { case 11: myError = "GEOMAlgo_GlueDetector failed"; break; @@ -103,13 +95,12 @@ void GeomAlgoAPI_GlueFaces::build(const ListOfShape& theShapes, const double the case 14: myError = "PerformImagesToWork failed"; break; - default: - { - // description of all errors see in GEOMAlgo_Gluer2.cxx - myError = "Error in GEOMAlgo_Gluer2 with code "; - myError += std::to_string(iErr); - break; - } + default: { + // description of all errors see in GEOMAlgo_Gluer2.cxx + myError = "Error in GEOMAlgo_Gluer2 with code "; + myError += std::to_string(iErr); + break; + } } return; } @@ -117,10 +108,8 @@ void GeomAlgoAPI_GlueFaces::build(const ListOfShape& theShapes, const double the // Gluing aGlueAlgo.Perform(); iErr = aGlueAlgo.ErrorStatus(); - if (iErr) - { - switch (iErr) - { + if (iErr) { + switch (iErr) { case 11: myError = "GEOMAlgo_GlueDetector failed"; break; @@ -128,22 +117,19 @@ void GeomAlgoAPI_GlueFaces::build(const ListOfShape& theShapes, const double the case 14: myError = "PerformImagesToWork failed"; break; - default: - { - // description of all errors see in GEOMAlgo_Gluer2.cxx - myError = "Error in GEOMAlgo_Gluer2 with code "; - myError += std::to_string(iErr); - break; - } + default: { + // description of all errors see in GEOMAlgo_Gluer2.cxx + myError = "Error in GEOMAlgo_Gluer2 with code "; + myError += std::to_string(iErr); + break; + } } return; } Standard_Integer iWrn = aGlueAlgo.WarningStatus(); - if (iWrn) - { - switch (iWrn) - { + if (iWrn) { + switch (iWrn) { case 1: myError = "No shapes to glue"; break; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.h b/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.h index 1753727ad..459c5bbae 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_GlueFaces_H_ @@ -29,18 +30,20 @@ /// \ingroup DataAlgo /// \brief Allows the elimination of coincident (duplicated) faces /// from a set of separate topological elements. -class GeomAlgoAPI_GlueFaces : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_GlueFaces : public GeomAlgoAPI_MakeShape { public: /// Constructor with optional arguments /// \param[in] theShapes list of shapes. /// \param[in] theTolerance tolerance to be used for gluing operation. /// \param[in] theKeepNonSolids whether to keep non-solid shapes in the result - GEOMALGOAPI_EXPORT GeomAlgoAPI_GlueFaces(const ListOfShape& theShapes, const double theTolerance = 1.e-7, const bool theKeepNonSolids = true); + GEOMALGOAPI_EXPORT GeomAlgoAPI_GlueFaces(const ListOfShape &theShapes, + const double theTolerance = 1.e-7, + const bool theKeepNonSolids = true); private: /// Builds resulting shape. - void build(const ListOfShape& theShapes, const double theTolerance, const bool theKeepNonSolids); + void build(const ListOfShape &theShapes, const double theTolerance, + const bool theKeepNonSolids); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index d05090252..756bc6270 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -32,8 +33,8 @@ #include #include -#include #include +#include #include @@ -44,43 +45,40 @@ //============================================================================= /*! * KindOfBRep - * \return 0 if theShape contains only simple entities (wires, edges and vertices), - * 1 if theShape contains only complex entities (shells, solids and compsolids) - * 2 if theShape contains only indifferent entities (faces) - * -1 if theShape contains both simple and complex entities (and in this case it - * cannot be saved without any loss neither in BRepMode == 0 nor in BRepMode == 1) + * \return 0 if theShape contains only simple entities (wires, edges and + * vertices), 1 if theShape contains only complex entities (shells, solids and + * compsolids) 2 if theShape contains only indifferent entities (faces) -1 if + * theShape contains both simple and complex entities (and in this case it + * cannot be saved without any loss neither in BRepMode == 0 nor in + * BRepMode == 1) */ //============================================================================= -int KindOfBRep (const TopoDS_Shape& theShape) -{ +int KindOfBRep(const TopoDS_Shape &theShape) { int aKind = 2; - switch (theShape.ShapeType()) - { - case TopAbs_COMPOUND: - { - bool isSimple = false; - bool isComplex = false; - TopoDS_Iterator anIt (theShape, Standard_True, Standard_True); - for (; anIt.More(); anIt.Next()) { - TopoDS_Shape aS = anIt.Value(); - int aKindSub = KindOfBRep(aS); - if (aKindSub == 0) - isSimple = true; - else if (aKindSub == 1) - isComplex = true; - else if (aKindSub == -1) { - return -1; // heterogeneous - } + switch (theShape.ShapeType()) { + case TopAbs_COMPOUND: { + bool isSimple = false; + bool isComplex = false; + TopoDS_Iterator anIt(theShape, Standard_True, Standard_True); + for (; anIt.More(); anIt.Next()) { + TopoDS_Shape aS = anIt.Value(); + int aKindSub = KindOfBRep(aS); + if (aKindSub == 0) + isSimple = true; + else if (aKindSub == 1) + isComplex = true; + else if (aKindSub == -1) { + return -1; // heterogeneous } - if (isSimple && isComplex) - aKind = -1; // heterogeneous - else if (isSimple) - aKind = 0; - else if (isComplex) - aKind = 1; } - break; + if (isSimple && isComplex) + aKind = -1; // heterogeneous + else if (isSimple) + aKind = 0; + else if (isComplex) + aKind = 1; + } break; case TopAbs_COMPSOLID: case TopAbs_SOLID: case TopAbs_SHELL: @@ -99,14 +97,13 @@ int KindOfBRep (const TopoDS_Shape& theShape) } //============================================================================= -bool IGESExport(const std::string& theFileName, - const std::string& theFormatName, - const std::shared_ptr& theShape, - std::string& theError) -{ - #ifdef _DEBUG +bool IGESExport(const std::string &theFileName, + const std::string &theFormatName, + const std::shared_ptr &theShape, + std::string &theError) { +#ifdef _DEBUG std::cout << "Export IGES into file " << theFileName << std::endl; - #endif +#endif if (!theShape.get()) { theError = "IGES Export failed: An invalid argument"; @@ -116,25 +113,25 @@ bool IGESExport(const std::string& theFileName, // theFormatName expected "IGES-5.1", "IGES-5.3"... TCollection_AsciiString aFormatName(theFormatName.c_str()); TCollection_AsciiString aVersion = aFormatName.Token("-", 2); - #ifdef _DEBUG +#ifdef _DEBUG if (!aVersion.IsEqual("5.1") || !aVersion.IsEqual("5.3")) std::cout << "Warning: unrecognized version " << aVersion.ToCString() << ". Default version: 5.1." << std::endl; - #endif +#endif // define, whether to write only faces (5.1 IGES format) // or shells and solids also (5.3 IGES format) int aBrepMode = 0; - if( aVersion.IsEqual( "5.3" ) ) + if (aVersion.IsEqual("5.3")) aBrepMode = 1; // Mantis issue 0021350: check being exported shape, as some stand-alone // entities (edges, wires and vertices) cannot be saved in BRepMode - if( aBrepMode == 1 ) { - int aKind = KindOfBRep( theShape->impl() ); - if( aKind == -1 ) { + if (aBrepMode == 1) { + int aKind = KindOfBRep(theShape->impl()); + if (aKind == -1) { theError = "EXPORT_IGES_HETEROGENEOUS_COMPOUND"; return false; - } else if( aKind == 2 ) + } else if (aKind == 2) aBrepMode = 1; else aBrepMode = aKind; @@ -145,8 +142,8 @@ bool IGESExport(const std::string& theFileName, // initialize writer IGESControl_Controller::Init(); - IGESControl_Writer ICW( "M", aBrepMode ); // export explicitly in meters - Interface_Static::SetCVal( "xstep.cascade.unit", "M" ); + IGESControl_Writer ICW("M", aBrepMode); // export explicitly in meters + Interface_Static::SetCVal("xstep.cascade.unit", "M"); #if OCC_VERSION_LARGE >= 0x07070000 Interface_Static::SetCVal("write.iges.unit", "M"); @@ -157,10 +154,10 @@ bool IGESExport(const std::string& theFileName, // 09.03.2010 skl for bug 0020726 // change default value "Average" to "Max" - Interface_Static::SetCVal( "write.precision.mode", "Max" ); + Interface_Static::SetCVal("write.precision.mode", "Max"); // perform shape writing - if( ICW.AddShape( theShape->impl() ) ) { + if (ICW.AddShape(theShape->impl())) { ICW.ComputeModel(); return ICW.Write(theFileName.c_str()) == Standard_True; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h index 782552cb1..721faac8f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_IGESEXPORT_H_ @@ -28,9 +29,9 @@ /// Implementation of the export IGES files algorithms GEOMALGOAPI_EXPORT -bool IGESExport(const std::string& theFileName, - const std::string& theFormatName, - const std::shared_ptr& theShape, - std::string& theError); +bool IGESExport(const std::string &theFileName, + const std::string &theFormatName, + const std::shared_ptr &theShape, + std::string &theError); #endif /* GEOMALGOAPI_IGESEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp index 559585e18..0db1d2a3c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -30,52 +31,51 @@ * */ //============================================================================= -std::shared_ptr IGESImport(const std::string& theFileName, - const std::string&, - std::string& theError) -{ - #ifdef _DEBUG +std::shared_ptr IGESImport(const std::string &theFileName, + const std::string &, + std::string &theError) { +#ifdef _DEBUG std::cout << "Import IGES from file " << theFileName << std::endl; - #endif +#endif TopoDS_Shape aShape; IGESControl_Reader aReader; try { - IFSelect_ReturnStatus status = aReader.ReadFile( theFileName.c_str() ); + IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.c_str()); if (status == IFSelect_RetDone) { - #ifdef _DEBUG +#ifdef _DEBUG std::cout << "ImportIGES : all Geometry Transfer" << std::endl; - #endif +#endif aReader.ClearShapes(); aReader.TransferRoots(); - #ifdef _DEBUG - std::cout << "ImportIGES : count of shapes produced = " << aReader.NbShapes() << std::endl; - #endif +#ifdef _DEBUG + std::cout << "ImportIGES : count of shapes produced = " + << aReader.NbShapes() << std::endl; +#endif aShape = aReader.OneShape(); - } - else { + } 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: - theError = "Wrong format of the imported file. Can't import file."; - break; + 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: + theError = "Wrong format of the imported file. Can't import file."; + break; } aShape.Nullify(); } - } - catch( Standard_Failure const& anException) { + } catch (Standard_Failure const &anException) { theError = anException.GetMessageString(); aShape.Nullify(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h index d511c09ec..c829896d6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_IGESIMPORT_H_ @@ -28,8 +29,8 @@ /// Implementation of the import IGES files algorithms GEOMALGOAPI_EXPORT -std::shared_ptr IGESImport(const std::string& theFileName, - const std::string& theFormatName, - std::string& theError); +std::shared_ptr IGESImport(const std::string &theFileName, + const std::string &theFormatName, + std::string &theError); #endif /* GEOMALGOAPI_IGESIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.cpp index 7275e00a0..196b2cea4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.cpp @@ -14,17 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include #include #include #include -#include +#include #include #include #include @@ -34,55 +34,51 @@ #include #include #include +#include -std::shared_ptr ImageImport(const int width, - const int height, - std::string& theError) -{ +std::shared_ptr ImageImport(const int width, const int height, + std::string &theError) { TopoDS_Shape aResShape; - try - { + try { TopoDS_Vertex aTriVertexes[4]; - gp_Pnt aPnt1( -0.5*width, -0.5*height, 0); - gp_Pnt aPnt2( 0.5*width, -0.5*height, 0); - gp_Pnt aPnt3( 0.5*width, 0.5*height, 0 );; - gp_Pnt aPnt4( -0.5*width, 0.5*height, 0 ); + gp_Pnt aPnt1(-0.5 * width, -0.5 * height, 0); + gp_Pnt aPnt2(0.5 * width, -0.5 * height, 0); + gp_Pnt aPnt3(0.5 * width, 0.5 * height, 0); + ; + gp_Pnt aPnt4(-0.5 * width, 0.5 * height, 0); TopoDS_Face aFace; TopoDS_Wire aWire; - aTriVertexes[0] = BRepBuilderAPI_MakeVertex (aPnt1); - aTriVertexes[1] = BRepBuilderAPI_MakeVertex (aPnt2); - aTriVertexes[2] = BRepBuilderAPI_MakeVertex (aPnt3); - aTriVertexes[3] = BRepBuilderAPI_MakeVertex (aPnt4); + aTriVertexes[0] = BRepBuilderAPI_MakeVertex(aPnt1); + aTriVertexes[1] = BRepBuilderAPI_MakeVertex(aPnt2); + aTriVertexes[2] = BRepBuilderAPI_MakeVertex(aPnt3); + aTriVertexes[3] = BRepBuilderAPI_MakeVertex(aPnt4); - aWire = BRepBuilderAPI_MakePolygon (aTriVertexes[0], aTriVertexes[1], aTriVertexes[2], - aTriVertexes[3], Standard_True); + aWire = BRepBuilderAPI_MakePolygon(aTriVertexes[0], aTriVertexes[1], + aTriVertexes[2], aTriVertexes[3], + Standard_True); BRepBuilderAPI_Sewing aSewingTool; - aSewingTool.Init (1.0e-06, Standard_True); + aSewingTool.Init(1.0e-06, Standard_True); TopoDS_Compound aComp; BRep_Builder BuildTool; BuildTool.MakeCompound(aComp); - if(!aWire.IsNull()) - { - aFace = BRepBuilderAPI_MakeFace (aWire); - if (!aFace.IsNull()) - { - BuildTool.Add (aComp, aFace); + if (!aWire.IsNull()) { + aFace = BRepBuilderAPI_MakeFace(aWire); + if (!aFace.IsNull()) { + BuildTool.Add(aComp, aFace); } } - aSewingTool.Load (aComp); + aSewingTool.Load(aComp); aSewingTool.Perform(); aResShape = aSewingTool.SewedShape(); - if (aResShape.IsNull()) - { + if (aResShape.IsNull()) { aResShape = aComp; } - } - catch (Standard_Failure const& anException) { + } catch (Standard_Failure const &anException) { theError = anException.GetMessageString(); aResShape.Nullify(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.h index fc7a9a3ba..719c6d6a7 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ImageImport.h @@ -14,21 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_IMAGEIMPORT_H_ #define GEOMALGOAPI_IMAGEIMPORT_H_ -#include #include +#include #include /// Implementation of the import STL files algorithms GEOMALGOAPI_EXPORT -std::shared_ptr ImageImport(const int theWidth, - const int theHeight, - std::string& theError); +std::shared_ptr +ImageImport(const int theWidth, const int theHeight, std::string &theError); #endif /* GEOMALGOAPI_IMAGEIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp index e027b9e95..9e68bb973 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Intersection.h" @@ -24,54 +25,53 @@ #include #include - //================================================================================================== -GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(const ListOfShape& theObjects, const double theFuzzy) - : myFiller(0) -{ +GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection( + const ListOfShape &theObjects, const double theFuzzy) + : myFiller(0) { build(theObjects, theFuzzy); } //================================================================================================== GeomAlgoAPI_Intersection::~GeomAlgoAPI_Intersection() { if (myFiller) - delete (BOPAlgo_PaveFiller*)myFiller; + delete (BOPAlgo_PaveFiller *)myFiller; } //================================================================================================== -void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, const double theFuzzy) -{ +void GeomAlgoAPI_Intersection::build(const ListOfShape &theObjects, + const double theFuzzy) { if (theObjects.empty()) { return; } // Creating partition operation. - BOPAlgo_Section* anOperation = new BOPAlgo_Section; + BOPAlgo_Section *anOperation = new BOPAlgo_Section; this->setImpl(anOperation); this->setBuilderType(OCCT_BOPAlgo_Builder); // Getting objects. TopTools_ListOfShape anObjects; - for (ListOfShape::const_iterator - anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { - const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); - if(!aShape.IsNull()) { + for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); + anObjectsIt != theObjects.end(); anObjectsIt++) { + const TopoDS_Shape &aShape = (*anObjectsIt)->impl(); + if (!aShape.IsNull()) { anObjects.Append(aShape); } } - BOPAlgo_PaveFiller* aDSFiller = new BOPAlgo_PaveFiller; + BOPAlgo_PaveFiller *aDSFiller = new BOPAlgo_PaveFiller; myFiller = aDSFiller; aDSFiller->SetArguments(anObjects); aDSFiller->SetRunParallel(false); aDSFiller->SetNonDestructive(false); aDSFiller->SetGlue(BOPAlgo_GlueOff); - if (theFuzzy > 0) aDSFiller->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) + aDSFiller->SetFuzzyValue(theFuzzy); // optimization for the issue #2399 - BOPAlgo_SectionAttribute theSecAttr(Standard_True, - Standard_True, + BOPAlgo_SectionAttribute theSecAttr(Standard_True, Standard_True, Standard_True); aDSFiller->SetSectionAttribute(theSecAttr); @@ -83,16 +83,18 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, const double anOperation->SetArguments(anObjects); anOperation->SetRunParallel(false); anOperation->SetCheckInverted(true); - if (theFuzzy > 0) anOperation->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) + anOperation->SetFuzzyValue(theFuzzy); - anOperation->PerformWithFiller(*aDSFiller); // it references a filler fields, so keep the filler + anOperation->PerformWithFiller( + *aDSFiller); // it references a filler fields, so keep the filler myFiller = 0; - if(anOperation->HasErrors()) { + if (anOperation->HasErrors()) { return; } TopoDS_Shape aResult = anOperation->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h index f2d5950db..f33acee09 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Intersection_H_ @@ -28,25 +29,24 @@ /// \class GeomAlgoAPI_Intersection /// \ingroup DataAlgo /// \brief Performs the intersection operations. -class GeomAlgoAPI_Intersection : public GeomAlgoAPI_MakeShape -{ - void* myFiller; ///< store filler to avoid memory leaks +class GeomAlgoAPI_Intersection : public GeomAlgoAPI_MakeShape { + void *myFiller; ///< store filler to avoid memory leaks public: /// \brief Constructor. /// \param[in] theObjects list of objects. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is below the minimum tolerance value (1.e-7), the - /// algorithm will use the default internal fuzzy value from OCCT. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Intersection(const ListOfShape& theObjects, - const double theFuzzy = 1.e-8); + /// If the fuzzy value is below the minimum tolerance value + /// (1.e-7), the algorithm will use the default internal fuzzy + /// value from OCCT. + GEOMALGOAPI_EXPORT GeomAlgoAPI_Intersection(const ListOfShape &theObjects, + const double theFuzzy = 1.e-8); /// Destructor to erase the filler GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Intersection(); private: /// Builds resulting shape. - void build(const ListOfShape& theObjects, const double theFuzzy); - + void build(const ListOfShape &theObjects, const double theFuzzy); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp index f4d7bfd90..87019dd3f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_LimitTolerance.h" @@ -25,21 +26,22 @@ #include #include - //================================================================================================== -GeomAlgoAPI_LimitTolerance::GeomAlgoAPI_LimitTolerance(const GeomShapePtr theShape, const double theTolerance, const bool theCheckGeometry) -{ +GeomAlgoAPI_LimitTolerance::GeomAlgoAPI_LimitTolerance( + const GeomShapePtr theShape, const double theTolerance, + const bool theCheckGeometry) { build(theShape, theTolerance, theCheckGeometry); } //================================================================================================== -void GeomAlgoAPI_LimitTolerance::build(const GeomShapePtr theShape, const double theTolerance, const bool theCheckGeometry) -{ +void GeomAlgoAPI_LimitTolerance::build(const GeomShapePtr theShape, + const double theTolerance, + const bool theCheckGeometry) { if (!theShape.get()) { return; } - const TopoDS_Shape& aOriginalShape = theShape->impl(); + const TopoDS_Shape &aOriginalShape = theShape->impl(); Standard_Real aTol = theTolerance; TopAbs_ShapeEnum aType = TopAbs_SHAPE; @@ -49,19 +51,18 @@ void GeomAlgoAPI_LimitTolerance::build(const GeomShapePtr theShape, const double // 1. Make a copy to prevent the original shape changes. TopoDS_Shape aShapeCopy; { - BRepBuilderAPI_Copy aMC (aOriginalShape); + BRepBuilderAPI_Copy aMC(aOriginalShape); if (aMC.IsDone()) { aShapeCopy = aMC.Shape(); - } - else { + } else { TColStd_IndexedDataMapOfTransientTransient aMapTShapes; TNaming_CopyShape::CopyTool(aOriginalShape, aMapTShapes, aShapeCopy); } } // 2. Limit tolerance. - if (!GeomAlgoAPI_Utils::FixShapeTolerance(aShapeCopy, aType, aTol, theCheckGeometry)) - { + if (!GeomAlgoAPI_Utils::FixShapeTolerance(aShapeCopy, aType, aTol, + theCheckGeometry)) { return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.h b/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.h index eed1125bc..eb874fc7e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_LimitTolerance_H_ @@ -28,18 +29,21 @@ /// \class GeomAlgoAPI_LimitTolerance /// \ingroup DataAlgo /// \brief Allows changing the tolerance in the shape and all of its sub shapes. -class GeomAlgoAPI_LimitTolerance : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_LimitTolerance : public GeomAlgoAPI_MakeShape { public: /// @brief Constructor. /// @param[in] theShape for which tolerance should be changed /// @param[in] theTolerance the new tolerance /// @param[in] theCheckGeometry if True, also check geometry - GEOMALGOAPI_EXPORT GeomAlgoAPI_LimitTolerance(const GeomShapePtr theShape, const double theTolerance, const bool theCheckGeometry = false); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_LimitTolerance(const GeomShapePtr theShape, + const double theTolerance, + const bool theCheckGeometry = false); private: /// Builds resulting shape. - void build(const GeomShapePtr theShape, const double theTolerance, const bool theCheckGeometry); + void build(const GeomShapePtr theShape, const double theTolerance, + const bool theCheckGeometry); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp index 11de6ff2d..c4bbb2683 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include "GeomAlgoAPI_DFLoader.h" #include "GeomAlgoAPI_Loft.h" +#include "GeomAlgoAPI_DFLoader.h" #include "GeomAlgoAPI_WireBuilder.h" #include @@ -27,25 +28,24 @@ #include //================================================================================================== -GeomAlgoAPI_Loft::GeomAlgoAPI_Loft(const GeomShapePtr theFirstShape, const GeomShapePtr theSecondShape) -{ +GeomAlgoAPI_Loft::GeomAlgoAPI_Loft(const GeomShapePtr theFirstShape, + const GeomShapePtr theSecondShape) { build(theFirstShape, theSecondShape); } //================================================================================================== void GeomAlgoAPI_Loft::build(const GeomShapePtr theFirstShape, - const GeomShapePtr theSecondShape) -{ + const GeomShapePtr theSecondShape) { // Getting base shape. - if(!theFirstShape.get() || !theSecondShape.get()) { + if (!theFirstShape.get() || !theSecondShape.get()) { return; } TopoDS_Shape aFirstShape = theFirstShape->impl(); - if(aFirstShape.IsNull()) { + if (aFirstShape.IsNull()) { return; } - TopoDS_Shape aSecondShape= theSecondShape->impl(); - if(aSecondShape.IsNull()) { + TopoDS_Shape aSecondShape = theSecondShape->impl(); + if (aSecondShape.IsNull()) { return; } @@ -66,8 +66,7 @@ void GeomAlgoAPI_Loft::build(const GeomShapePtr theFirstShape, aSecondShapeOut = aSecondShape; } - if (aFirstShape.ShapeType() == TopAbs_EDGE) - { + if (aFirstShape.ShapeType() == TopAbs_EDGE) { GeomShapePtr aFirstWire, aSecondWire; ListOfShape aFirstEdge, aSecondEdge; @@ -86,22 +85,19 @@ void GeomAlgoAPI_Loft::build(const GeomShapePtr theFirstShape, } // Initialize and build - BRepOffsetAPI_ThruSections * ThruSections = - new BRepOffsetAPI_ThruSections(anIsSolid); - ThruSections->AddWire( TopoDS::Wire( aFirstShapeOut ) ); - ThruSections->AddWire( TopoDS::Wire( aSecondShapeOut) ); + BRepOffsetAPI_ThruSections *ThruSections = + new BRepOffsetAPI_ThruSections(anIsSolid); + ThruSections->AddWire(TopoDS::Wire(aFirstShapeOut)); + ThruSections->AddWire(TopoDS::Wire(aSecondShapeOut)); - try - { + try { ThruSections->Build(); - } - catch (Standard_Failure& aFail) - { + } catch (Standard_Failure &aFail) { delete ThruSections; return; } // Checking result. - if(!ThruSections->IsDone() || ThruSections->Shape().IsNull()) { + if (!ThruSections->IsDone() || ThruSections->Shape().IsNull()) { delete ThruSections; return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Loft.h b/src/GeomAlgoAPI/GeomAlgoAPI_Loft.h index d14cb3fb3..a1380bb66 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Loft.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Loft.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Loft_H_ @@ -33,19 +34,17 @@ /// 2 edges -> Face /// 2 Wire -> Shell /// 2 Face -> Solid -class GeomAlgoAPI_Loft : public GeomAlgoAPI_MakeShape -{ - public: - /// \brief Creates loft for two given shape with same type. - /// \param[in] theFirstShape the first shape. - /// \param[in] theSecondShape the second shape. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Loft(const GeomShapePtr theFirstShape, - const GeomShapePtr theSecondShape); - - private: - void build(const GeomShapePtr theFirstShape, - const GeomShapePtr theSecondShape); - +class GeomAlgoAPI_Loft : public GeomAlgoAPI_MakeShape { +public: + /// \brief Creates loft for two given shape with same type. + /// \param[in] theFirstShape the first shape. + /// \param[in] theSecondShape the second shape. + GEOMALGOAPI_EXPORT GeomAlgoAPI_Loft(const GeomShapePtr theFirstShape, + const GeomShapePtr theSecondShape); + +private: + void build(const GeomShapePtr theFirstShape, + const GeomShapePtr theSecondShape); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp index 23e1449e1..7c4c69e45 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp @@ -14,92 +14,86 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_MakeShape.h" #include -#include #include #include #include +#include #include +#include +#include #include #include -#include #include -#include -#include +#include #include #include #include // new shape -> old shapes -> index in the old shape -typedef NCollection_DataMap, TopTools_ShapeMapHasher> - MapNewToOld; -typedef - NCollection_DataMap > - HistoryMap; +typedef NCollection_DataMap< + TopoDS_Shape, + NCollection_DataMap, + TopTools_ShapeMapHasher> + MapNewToOld; +typedef NCollection_DataMap> + HistoryMap; //================================================================================================== GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape() -: myBuilderType(Unknown), - myDone(false) -{ + : myBuilderType(Unknown), myDone(false) { myHist = 0; } //================================================================================================== -GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape() -{ +GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape() { if (myHist) { - delete (HistoryMap*)myHist; + delete (HistoryMap *)myHist; } } //================================================================================================== -bool GeomAlgoAPI_MakeShape::isDone() const -{ - return myDone; -} +bool GeomAlgoAPI_MakeShape::isDone() const { return myDone; } //================================================================================================== -const GeomShapePtr GeomAlgoAPI_MakeShape::shape() const -{ - return myShape; -} +const GeomShapePtr GeomAlgoAPI_MakeShape::shape() const { return myShape; } //================================================================================================== -bool GeomAlgoAPI_MakeShape::isValid() const -{ +bool GeomAlgoAPI_MakeShape::isValid() const { BRepCheck_Analyzer aChecker(myShape->impl()); return (aChecker.IsValid() == Standard_True); } //================================================================================================== -std::shared_ptr GeomAlgoAPI_MakeShape::mapOfSubShapes() const -{ +std::shared_ptr +GeomAlgoAPI_MakeShape::mapOfSubShapes() const { return myMap; } //================================================================================================== void GeomAlgoAPI_MakeShape::generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { TopTools_ListOfShape aList; - if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { - BRepBuilderAPI_MakeShape* aMakeShape = implPtr(); + if (myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { + BRepBuilderAPI_MakeShape *aMakeShape = implPtr(); aList = aMakeShape->Generated(theOldShape->impl()); - } else if(myBuilderType == OCCT_BOPAlgo_Builder) { - BOPAlgo_Builder* aBOPBuilder = implPtr(); + } else if (myBuilderType == OCCT_BOPAlgo_Builder) { + BOPAlgo_Builder *aBOPBuilder = implPtr(); aList = aBOPBuilder->Generated(theOldShape->impl()); } - for(TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); anIt.Next()) { + for (TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); + anIt.Next()) { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(anIt.Value())); - if (!isValidForHistory(aShape)) continue; + if (!isValidForHistory(aShape)) + continue; fixOrientation(aShape); theNewShapes.push_back(aShape); } @@ -107,144 +101,148 @@ void GeomAlgoAPI_MakeShape::generated(const GeomShapePtr theOldShape, //================================================================================================== void GeomAlgoAPI_MakeShape::modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { TopTools_ListOfShape aList; - if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { - BRepBuilderAPI_MakeShape* aMakeShape = implPtr(); + if (myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { + BRepBuilderAPI_MakeShape *aMakeShape = implPtr(); try { aList = aMakeShape->Modified(theOldShape->impl()); - } catch(Standard_NoSuchObject) { + } catch (Standard_NoSuchObject) { } - } else if(myBuilderType == OCCT_BOPAlgo_Builder) { - BOPAlgo_Builder* aBOPBuilder = implPtr(); + } else if (myBuilderType == OCCT_BOPAlgo_Builder) { + BOPAlgo_Builder *aBOPBuilder = implPtr(); aList = aBOPBuilder->Modified(theOldShape->impl()); } - for(TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); anIt.Next()) { + for (TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); + anIt.Next()) { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(anIt.Value())); - if (!isValidForHistory(aShape)) continue; + if (!isValidForHistory(aShape)) + continue; fixOrientation(aShape); theNewShapes.push_back(aShape); } } //================================================================================================== -bool GeomAlgoAPI_MakeShape::isDeleted(const GeomShapePtr theOldShape) -{ +bool GeomAlgoAPI_MakeShape::isDeleted(const GeomShapePtr theOldShape) { bool isDeleted = false; - if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { - BRepBuilderAPI_MakeShape* aMakeShape = implPtr(); - isDeleted = aMakeShape->IsDeleted(theOldShape->impl()) == Standard_True; - } else if(myBuilderType == OCCT_BOPAlgo_Builder) { - BOPAlgo_Builder* aBOPBuilder = implPtr(); - isDeleted = aBOPBuilder->IsDeleted(theOldShape->impl()) == Standard_True; + if (myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { + BRepBuilderAPI_MakeShape *aMakeShape = implPtr(); + isDeleted = aMakeShape->IsDeleted(theOldShape->impl()) == + Standard_True; + } else if (myBuilderType == OCCT_BOPAlgo_Builder) { + BOPAlgo_Builder *aBOPBuilder = implPtr(); + isDeleted = aBOPBuilder->IsDeleted(theOldShape->impl()) == + Standard_True; } return isDeleted; } //================================================================================================== -void GeomAlgoAPI_MakeShape::setBuilderType(const BuilderType theBuilderType) -{ +void GeomAlgoAPI_MakeShape::setBuilderType(const BuilderType theBuilderType) { myBuilderType = theBuilderType; } //================================================================================================== -void GeomAlgoAPI_MakeShape::setDone(const bool theFlag) -{ - myDone = theFlag; -} +void GeomAlgoAPI_MakeShape::setDone(const bool theFlag) { myDone = theFlag; } //================================================================================================== -void GeomAlgoAPI_MakeShape::setShape(const GeomShapePtr theShape) -{ - if(myShape.get() && myShape->isEqual(theShape)) { +void GeomAlgoAPI_MakeShape::setShape(const GeomShapePtr theShape) { + if (myShape.get() && myShape->isEqual(theShape)) { return; } myShape = theShape; // Filling data map to keep correct orientation of sub-shapes. - if(myShape.get()) { - if(myMap.get()) { + if (myShape.get()) { + if (myMap.get()) { myMap->clear(); } else { myMap.reset(new GeomAPI_DataMapOfShapeShape); } - const TopoDS_Shape& aTopoDSShape = myShape->impl(); - for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_VERTEX); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aTopoDSShape = myShape->impl(); + for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_VERTEX); anExp.More(); + anExp.Next()) { GeomShapePtr aCurrentShape(new GeomAPI_Shape()); aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); myMap->bind(aCurrentShape, aCurrentShape); } - for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_EDGE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_EDGE); anExp.More(); + anExp.Next()) { GeomShapePtr aCurrentShape(new GeomAPI_Shape()); aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); myMap->bind(aCurrentShape, aCurrentShape); } - for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_FACE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomShapePtr aCurrentShape(new GeomAPI_Shape()); aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); myMap->bind(aCurrentShape, aCurrentShape); } } else { - if(myMap.get()) { + if (myMap.get()) { myMap->clear(); } } } //================================================================================================== -bool GeomAlgoAPI_MakeShape::isValidForHistory(const GeomShapePtr theShape) -{ - if (!theShape.get()) return false; +bool GeomAlgoAPI_MakeShape::isValidForHistory(const GeomShapePtr theShape) { + if (!theShape.get()) + return false; - const TopoDS_Shape& aShape_ = theShape->impl(); - if (aShape_.IsNull()) return false; + const TopoDS_Shape &aShape_ = theShape->impl(); + if (aShape_.IsNull()) + return false; if (aShape_.ShapeType() == TopAbs_EDGE) { TopoDS_Edge anEdge_ = TopoDS::Edge(aShape_); - if (BRep_Tool::Degenerated(anEdge_)) return false; + if (BRep_Tool::Degenerated(anEdge_)) + return false; } return true; } //================================================================================================== -void GeomAlgoAPI_MakeShape::fixOrientation(GeomShapePtr& theShape) { - if (myMap->isBound(theShape)) theShape = myMap->find(theShape); +void GeomAlgoAPI_MakeShape::fixOrientation(GeomShapePtr &theShape) { + if (myMap->isBound(theShape)) + theShape = myMap->find(theShape); } //================================================================================================== -void GeomAlgoAPI_MakeShape::initialize() -{ +void GeomAlgoAPI_MakeShape::initialize() { switch (myBuilderType) { - case OCCT_BRepBuilderAPI_MakeShape: { - myDone = implPtr()->IsDone() == Standard_True; - myShape.reset(new GeomAPI_Shape()); - myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); - break; - } - case OCCT_BOPAlgo_Builder: { - myDone = true; - myShape.reset(new GeomAPI_Shape()); - myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); - break; - } - default: - break; + case OCCT_BRepBuilderAPI_MakeShape: { + myDone = implPtr()->IsDone() == Standard_True; + myShape.reset(new GeomAPI_Shape()); + myShape->setImpl( + new TopoDS_Shape(implPtr()->Shape())); + break; + } + case OCCT_BOPAlgo_Builder: { + myDone = true; + myShape.reset(new GeomAPI_Shape()); + myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); + break; + } + default: + break; } - if(myMap.get()) { + if (myMap.get()) { myMap->clear(); } else { myMap.reset(new GeomAPI_DataMapOfShapeShape); } - const TopoDS_Shape& aTopoDSShape = myShape->impl(); - for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_FACE); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aTopoDSShape = myShape->impl(); + for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_FACE); anExp.More(); + anExp.Next()) { GeomShapePtr aCurrentShape(new GeomAPI_Shape()); aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); myMap->bind(aCurrentShape, aCurrentShape); @@ -252,21 +250,18 @@ void GeomAlgoAPI_MakeShape::initialize() myHist = 0; } - //================================================================================================== -void GeomAlgoAPI_MakeShape::prepareNamingFaces() -{ +void GeomAlgoAPI_MakeShape::prepareNamingFaces() { long long index = 1; - for(GeomAPI_ShapeExplorer anExp(shape(), GeomAPI_Shape::FACE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(shape(), GeomAPI_Shape::FACE); anExp.more(); + anExp.next()) { GeomShapePtr aFace = anExp.current(); myCreatedFaces["Face_" + std::to_string(index++)] = aFace; } } - //================================================================================================== -bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage) -{ +bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage) { // isValid() is called from this method if (!isValid()) { myError = theMessage + " :: resulting shape is not valid."; @@ -276,77 +271,81 @@ bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage) // Check the number of volumes in myShape, make sure there's one and only one. TopoDS_Shape aTopoDSShape = myShape->impl(); int aNbVolumes = 0; - for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_SOLID); anExp.More(); anExp.Next()) { - aNbVolumes ++; + for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_SOLID); anExp.More(); + anExp.Next()) { + aNbVolumes++; } if (aNbVolumes != 1) { - myError = theMessage + - " :: connexity error, the resulting shape is made of several separate solids."; + myError = theMessage + " :: connexity error, the resulting shape is made " + "of several separate solids."; return false; } - return true ; + return true; } //================================================================================================== bool GeomAlgoAPI_MakeShape::isNewShapesCollected(GeomShapePtr theWholeOld, - const int theShapeType) -{ + const int theShapeType) { if (!myHist) return false; - HistoryMap* aHist = (HistoryMap*)myHist; + HistoryMap *aHist = (HistoryMap *)myHist; if (!aHist->IsBound(theShapeType)) return false; return aHist->Find(theShapeType).IsBound(theWholeOld->impl()); } -void GeomAlgoAPI_MakeShape::collectNewShapes( - GeomShapePtr theWholeOld, const int theShapeType) -{ +void GeomAlgoAPI_MakeShape::collectNewShapes(GeomShapePtr theWholeOld, + const int theShapeType) { if (!myHist) myHist = new HistoryMap; - HistoryMap* aHist = (HistoryMap*)myHist; + HistoryMap *aHist = (HistoryMap *)myHist; if (!aHist->IsBound(theShapeType)) - aHist->Bind( - theShapeType, NCollection_DataMap()); - aHist->ChangeFind(theShapeType). // add a new in anyway - Bind(theWholeOld->impl(), MapNewToOld()); - MapNewToOld& aCurrent = - aHist->ChangeFind(theShapeType).ChangeFind(theWholeOld->impl()); + aHist->Bind(theShapeType, NCollection_DataMap()); + aHist->ChangeFind(theShapeType) + . // add a new in anyway + Bind(theWholeOld->impl(), MapNewToOld()); + MapNewToOld &aCurrent = aHist->ChangeFind(theShapeType) + .ChangeFind(theWholeOld->impl()); ListOfShape aNewList; - TopTools_MapOfShape aViewed; //avoid same shapes - GeomAPI_ShapeExplorer anExp(theWholeOld, GeomAPI_Shape::ShapeType(theShapeType)); - for(int anIndexInWholeOld = 0; anExp.more(); anExp.next(), anIndexInWholeOld++) { + TopTools_MapOfShape aViewed; // avoid same shapes + GeomAPI_ShapeExplorer anExp(theWholeOld, + GeomAPI_Shape::ShapeType(theShapeType)); + for (int anIndexInWholeOld = 0; anExp.more(); + anExp.next(), anIndexInWholeOld++) { if (!aViewed.Add(anExp.current()->impl())) continue; aNewList.clear(); modified(anExp.current(), aNewList); - for(ListOfShape::iterator aNew = aNewList.begin(); aNew != aNewList.end(); aNew++) { - const TopoDS_Shape& aNewShape = (*aNew)->impl(); + for (ListOfShape::iterator aNew = aNewList.begin(); aNew != aNewList.end(); + aNew++) { + const TopoDS_Shape &aNewShape = (*aNew)->impl(); if (!aCurrent.IsBound(aNewShape)) { aCurrent.Bind( - aNewShape, NCollection_DataMap()); + aNewShape, + NCollection_DataMap()); } - aCurrent.ChangeFind(aNewShape).Bind(anExp.current()->impl(), anIndexInWholeOld); + aCurrent.ChangeFind(aNewShape).Bind(anExp.current()->impl(), + anIndexInWholeOld); } } } -static void addAllSubs(const TopoDS_Shape& theNewShape, - MapNewToOld& theCurrent, std::map& theResMap) -{ +static void addAllSubs(const TopoDS_Shape &theNewShape, MapNewToOld &theCurrent, + std::map &theResMap) { if (theCurrent.IsBound(theNewShape)) { NCollection_DataMap::Iterator - anOldIter(theCurrent.Find(theNewShape)); - for(; anOldIter.More(); anOldIter.Next()) { + anOldIter(theCurrent.Find(theNewShape)); + for (; anOldIter.More(); anOldIter.Next()) { theResMap[anOldIter.Value()] = anOldIter.Key(); } } TopoDS_Iterator anIter(theNewShape); - for(; anIter.More(); anIter.Next()) { - //if (anIter.Value().ShapeType() != TopAbs_VERTEX) + for (; anIter.More(); anIter.Next()) { + // if (anIter.Value().ShapeType() != TopAbs_VERTEX) addAllSubs(anIter.Value(), theCurrent, theResMap); // add recursively } } @@ -354,27 +353,28 @@ static void addAllSubs(const TopoDS_Shape& theNewShape, //================================================================================================== GeomShapePtr GeomAlgoAPI_MakeShape::oldShapesForNew(GeomShapePtr theWholeOld, GeomShapePtr theNewShape, - const int theShapeType) -{ + const int theShapeType) { GeomShapePtr aResult(new GeomAPI_Shape); TopoDS_Compound aResComp; TopoDS_Builder aBuilder; aBuilder.MakeCompound(aResComp); aResult->setImpl(new TopoDS_Shape(aResComp)); - HistoryMap* aHist = (HistoryMap*)myHist; + HistoryMap *aHist = (HistoryMap *)myHist; if (!aHist->IsBound(theShapeType)) return aResult; // not found, empty compound - const TopoDS_Shape& aWholeOld = theWholeOld->impl(); + const TopoDS_Shape &aWholeOld = theWholeOld->impl(); if (!aHist->Find(theShapeType).IsBound(aWholeOld)) return aResult; // not found, empty compound - std::map aResMap; // map with all results, ordered by index in whole old - MapNewToOld& aCurrent = aHist->ChangeFind(theShapeType).ChangeFind(aWholeOld); - // we don't know what type of new shapes were produced by the old theShapeType, so, iterate all + std::map + aResMap; // map with all results, ordered by index in whole old + MapNewToOld &aCurrent = aHist->ChangeFind(theShapeType).ChangeFind(aWholeOld); + // we don't know what type of new shapes were produced by the old + // theShapeType, so, iterate all addAllSubs(theNewShape->impl(), aCurrent, aResMap); std::map::iterator anOldIter = aResMap.begin(); - for(; anOldIter != aResMap.end(); anOldIter++) { + for (; anOldIter != aResMap.end(); anOldIter++) { if (anOldIter->second.ShapeType() == (TopAbs_ShapeEnum)theShapeType) aBuilder.Add(aResComp, anOldIter->second); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index 69414e5c3..a9542e84d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MakeShape_H_ #define GeomAlgoAPI_MakeShape_H_ -#include #include +#include #include -#include #include +#include #include /// \class GeomAlgoAPI_MakeShape /// \ingroup DataAlgo /// \brief Interface to the root class of all topological shapes constructions -class GeomAlgoAPI_MakeShape : public GeomAPI_Interface -{ +class GeomAlgoAPI_MakeShape : public GeomAPI_Interface { public: /// Builder type enum enum BuilderType { @@ -51,22 +51,21 @@ public: /// \brief Constructor by builder and builder type. /// \param[in] theBuilder pointer to the builder. /// \param[in] theBuilderType builder type. - template explicit GeomAlgoAPI_MakeShape( - T* theBuilder, - const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) - : GeomAPI_Interface(theBuilder), - myBuilderType(theBuilderType) - { + template + explicit GeomAlgoAPI_MakeShape( + T *theBuilder, + const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) + : GeomAPI_Interface(theBuilder), myBuilderType(theBuilderType) { initialize(); } /// \brief Initializes internals. /// \param[in] theBuilder pointer to the builder. /// \param[in] theBuilderType builder type. - template void initialize( - T* theBuilder, - const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) - { + template + void + initialize(T *theBuilder, + const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) { setImpl(theBuilder); myBuilderType = theBuilderType; initialize(); @@ -85,19 +84,22 @@ public: GEOMALGOAPI_EXPORT bool isValid() const; /// \return map of sub-shapes of the result. To be used for History keeping. - GEOMALGOAPI_EXPORT std::shared_ptr mapOfSubShapes() const; + GEOMALGOAPI_EXPORT std::shared_ptr + mapOfSubShapes() const; /// \return the list of shapes generated from the shape \a theShape. /// \param[in] theOldShape base shape. - /// \param[out] theNewShapes shapes generated from \a theShape. Does not cleared! + /// \param[out] theNewShapes shapes generated from \a theShape. Does not + /// cleared! GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theOldShape base shape. - /// \param[out] theNewShapes shapes modified from \a theShape. Does not cleared! + /// \param[out] theNewShapes shapes modified from \a theShape. Does not + /// cleared! GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); /// \return true if theShape was deleted. /// \param[in] theOldShape base shape. @@ -110,7 +112,7 @@ public: GEOMALGOAPI_EXPORT virtual void prepareNamingFaces(); /// \return the list of created faces. - GEOMALGOAPI_EXPORT std::map< std::string, GeomShapePtr > getCreatedFaces() { + GEOMALGOAPI_EXPORT std::map getCreatedFaces() { return myCreatedFaces; } @@ -120,31 +122,31 @@ public: /// \brief Check the validity of the produced shape. GEOMALGOAPI_EXPORT bool checkValid(std::string theMessage); - /// Optimization of access the new shapes by old shapes for the limited set of needed new shapes. - /// \param theWholeOld the whole old shape - /// \param theShapeType type of the sub-shapes that is used for optimization - /// \returns true if optimization containers are already filled + /// Optimization of access the new shapes by old shapes for the limited set of + /// needed new shapes. \param theWholeOld the whole old shape \param + /// theShapeType type of the sub-shapes that is used for optimization \returns + /// true if optimization containers are already filled GEOMALGOAPI_EXPORT bool isNewShapesCollected(GeomShapePtr theWholeOld, const int theShapeType); - /// Optimization of access the new shapes by old shapes for the limited set of needed new shapes. - /// \param theWholeOld the whole old shape - /// \param theShapeType type of the sub-shapes that is used for optimization - /// \returns true if optimization containers are already filled + /// Optimization of access the new shapes by old shapes for the limited set of + /// needed new shapes. \param theWholeOld the whole old shape \param + /// theShapeType type of the sub-shapes that is used for optimization \returns + /// true if optimization containers are already filled GEOMALGOAPI_EXPORT void collectNewShapes(GeomShapePtr theWholeOld, const int theShapeType); - /// Optimization of access the new shapes by old shapes for the limited set of needed new shapes. - /// \param theWholeOld the whole old shape - /// \param theNewShape the whole new shape - /// \param theShapeType type of the old sub-shapes - /// \returns compound of all old shapes that were used for creation of the given new + /// Optimization of access the new shapes by old shapes for the limited set of + /// needed new shapes. \param theWholeOld the whole old shape \param + /// theNewShape the whole new shape \param theShapeType type of the old + /// sub-shapes \returns compound of all old shapes that were used for creation + /// of the given new GEOMALGOAPI_EXPORT GeomShapePtr oldShapesForNew(GeomShapePtr theWholeOld, GeomShapePtr theNewShape, const int theShapeType); /// Replaces \a theShape with shape from \a myMap. - GEOMALGOAPI_EXPORT void fixOrientation(GeomShapePtr& theShape); + GEOMALGOAPI_EXPORT void fixOrientation(GeomShapePtr &theShape); protected: /// \brief Sets builder type. @@ -163,25 +165,27 @@ protected: bool isValidForHistory(const GeomShapePtr theShape); protected: - /// Data map to keep correct orientation of sub-shapes. + /// Data map to keep correct orientation of sub-shapes. std::shared_ptr myMap; /// Error occurred during the execution of an algorithm. std::string myError; /// Map of created faces with their name for naming. - std::map< std::string, GeomShapePtr > myCreatedFaces; + std::map myCreatedFaces; private: /// \brief Initializes internals. void initialize(); private: - GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder. - bool myDone; ///< Builder status. + GeomAlgoAPI_MakeShape::BuilderType + myBuilderType; ///< Type of make shape builder. + bool myDone; ///< Builder status. GeomShapePtr myShape; ///< Resulting shape. - /// map that is used to keep the optimization structure for access to the history - /// kind of sub-shapes -> whole old shape -> new shape -> list of old shapes that create this new - void* myHist; + /// map that is used to keep the optimization structure for access to the + /// history kind of sub-shapes -> whole old shape -> new shape -> list of old + /// shapes that create this new + void *myHist; }; typedef std::shared_ptr GeomMakeShapePtr; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp index 59ea727c4..db4f8c1f5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp @@ -14,68 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include //================================================================================================== -GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom() -{ -} +GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom() {} //================================================================================================== -void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape) -{ +void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape) { setShape(theShape); } //================================================================================================== bool GeomAlgoAPI_MakeShapeCustom::addModified(const GeomShapePtr theOldShape, - const GeomShapePtr theNewShape) -{ - if (!isValidForHistory(theNewShape)) return false; + const GeomShapePtr theNewShape) { + if (!isValidForHistory(theNewShape)) + return false; GeomShapePtr aNewShape = theNewShape; return myModified.add(theOldShape, aNewShape); } //================================================================================================== bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const GeomShapePtr theOldShape, - const GeomShapePtr theNewShape) -{ - if (!isValidForHistory(theNewShape)) return false; + const GeomShapePtr theNewShape) { + if (!isValidForHistory(theNewShape)) + return false; GeomShapePtr aNewShape = theNewShape; return myGenerated.add(theOldShape, aNewShape); } //================================================================================================== -bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const GeomShapePtr theOldShape) -{ +bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const GeomShapePtr theOldShape) { return myDeleted.bind(theOldShape, theOldShape); } //================================================================================================== void GeomAlgoAPI_MakeShapeCustom::generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { ListOfShape aGenerated; - if(myGenerated.find(theOldShape, aGenerated)) { - theNewShapes.insert(theNewShapes.end(), aGenerated.begin(), aGenerated.end()); + if (myGenerated.find(theOldShape, aGenerated)) { + theNewShapes.insert(theNewShapes.end(), aGenerated.begin(), + aGenerated.end()); } } //================================================================================================== void GeomAlgoAPI_MakeShapeCustom::modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { ListOfShape aModified; - if(myModified.find(theOldShape, aModified)) { + if (myModified.find(theOldShape, aModified)) { theNewShapes.insert(theNewShapes.end(), aModified.begin(), aModified.end()); } } //================================================================================================== -bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const GeomShapePtr theOldShape) -{ +bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const GeomShapePtr theOldShape) { return myDeleted.isBound(theOldShape); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h index 18baf9f57..f5f27b5f3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MakeShapeCustom_H_ @@ -29,8 +30,7 @@ * \ingroup DataAlgo * \brief Interface to the root class of all topological shapes constructions */ -class GeomAlgoAPI_MakeShapeCustom : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_MakeShapeCustom : public GeomAlgoAPI_MakeShape { public: /// Default constructor GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShapeCustom(); @@ -51,11 +51,11 @@ public: /// \return the list of shapes generated from the shape theShape GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); /// \return the list of shapes modified from the shape theShape GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); /// \return whether the shape is deleted GEOMALGOAPI_EXPORT bool isDeleted(const GeomShapePtr theOldShape); @@ -63,7 +63,7 @@ public: private: GeomAPI_DataMapOfShapeMapOfShapes myGenerated; GeomAPI_DataMapOfShapeMapOfShapes myModified; - GeomAPI_DataMapOfShapeShape myDeleted; + GeomAPI_DataMapOfShapeShape myDeleted; }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp index a01b24f6a..295b3c943 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp @@ -14,32 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_MakeShapeList.h" - #include #include #include //================================================================================================== GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList() -: GeomAlgoAPI_MakeShape() -{} + : GeomAlgoAPI_MakeShape() {} //================================================================================================== -GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList(const ListOfMakeShape& theMakeShapeList) -: GeomAlgoAPI_MakeShape() -{ +GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList( + const ListOfMakeShape &theMakeShapeList) + : GeomAlgoAPI_MakeShape() { init(theMakeShapeList); } //================================================================================================== -void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape& theMakeShapeList) -{ - if(myMap.get()) { +void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape &theMakeShapeList) { + if (myMap.get()) { myMap->clear(); } else { myMap.reset(new GeomAPI_DataMapOfShapeShape); @@ -47,36 +45,32 @@ void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape& theMakeShapeList) myListOfMakeShape = theMakeShapeList; - for(ListOfMakeShape::const_iterator anIt = theMakeShapeList.cbegin(); - anIt != theMakeShapeList.cend(); ++anIt) { + for (ListOfMakeShape::const_iterator anIt = theMakeShapeList.cbegin(); + anIt != theMakeShapeList.cend(); ++anIt) { myMap->merge((*anIt)->mapOfSubShapes()); } } -const ListOfMakeShape& GeomAlgoAPI_MakeShapeList::list() const -{ +const ListOfMakeShape &GeomAlgoAPI_MakeShapeList::list() const { return myListOfMakeShape; } - //================================================================================================== void GeomAlgoAPI_MakeShapeList::appendAlgo( - const GeomMakeShapePtr theMakeShape) -{ + const GeomMakeShapePtr theMakeShape) { myListOfMakeShape.push_back(theMakeShape); - if(!myMap.get()) { + if (!myMap.get()) { myMap.reset(new GeomAPI_DataMapOfShapeShape()); } myMap->merge(theMakeShape->mapOfSubShapes()); } //================================================================================================== -const GeomShapePtr GeomAlgoAPI_MakeShapeList::shape() const -{ +const GeomShapePtr GeomAlgoAPI_MakeShapeList::shape() const { GeomShapePtr aShape = GeomAlgoAPI_MakeShape::shape(); - if(aShape.get() && !aShape->impl().IsNull()) { + if (aShape.get() && !aShape->impl().IsNull()) { return aShape; - } else if(!myListOfMakeShape.empty()) { + } else if (!myListOfMakeShape.empty()) { return myListOfMakeShape.back()->shape(); } return GeomShapePtr(); @@ -84,27 +78,22 @@ const GeomShapePtr GeomAlgoAPI_MakeShapeList::shape() const //================================================================================================== void GeomAlgoAPI_MakeShapeList::generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { result(theOldShape, theNewShapes); } //================================================================================================== void GeomAlgoAPI_MakeShapeList::modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { result(theOldShape, theNewShapes); } //================================================================================================== -bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape) -{ +bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape) { for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); - ++aBuilderIt) - { + aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { GeomMakeShapePtr aMakeShape = *aBuilderIt; - if(aMakeShape->isDeleted(theOldShape)) { + if (aMakeShape->isDeleted(theOldShape)) { return true; } } @@ -114,9 +103,8 @@ bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape) //================================================================================================== void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ - if(myListOfMakeShape.empty()) { + ListOfShape &theNewShapes) { + if (myListOfMakeShape.empty()) { return; } @@ -127,16 +115,12 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, aResultShapesMap.Add(theOldShape->impl()); aResultShapesList.Append(theOldShape->impl()); - for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); - ++aBuilderIt) - { + for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); + aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { GeomMakeShapePtr aMakeShape = *aBuilderIt; NCollection_Map aTempShapes; for (NCollection_Map::Iterator aShapeIt(anAlgoShapes); - aShapeIt.More(); - aShapeIt.Next()) - { + aShapeIt.More(); aShapeIt.Next()) { bool hasResults = false; bool anArgumentIsInResult = false; GeomShapePtr aShape(new GeomAPI_Shape); @@ -144,16 +128,14 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, ListOfShape aGeneratedShapes; aMakeShape->generated(aShape, aGeneratedShapes); for (ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin(); - anIt != aGeneratedShapes.cend(); - ++anIt) - { - const TopoDS_Shape& anItShape = (*anIt)->impl(); + anIt != aGeneratedShapes.cend(); ++anIt) { + const TopoDS_Shape &anItShape = (*anIt)->impl(); if (anItShape.IsSame(aShapeIt.Value())) { anArgumentIsInResult = true; continue; } aTempShapes.Add(anItShape); - if(aResultShapesMap.Add(anItShape) == Standard_True) { + if (aResultShapesMap.Add(anItShape) == Standard_True) { aResultShapesList.Append(anItShape); } hasResults = true; @@ -161,26 +143,25 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, ListOfShape aModifiedShapes; aMakeShape->modified(aShape, aModifiedShapes); for (ListOfShape::const_iterator anIt = aModifiedShapes.cbegin(); - anIt != aModifiedShapes.cend(); - ++anIt) - { - const TopoDS_Shape& anItShape = (*anIt)->impl(); + anIt != aModifiedShapes.cend(); ++anIt) { + const TopoDS_Shape &anItShape = (*anIt)->impl(); if (anItShape.IsSame(aShapeIt.Value())) { anArgumentIsInResult = true; continue; } aTempShapes.Add(anItShape); - if(aResultShapesMap.Add(anItShape) == Standard_True) { + if (aResultShapesMap.Add(anItShape) == Standard_True) { aResultShapesList.Append(anItShape); } hasResults = true; } - if(hasResults && !anArgumentIsInResult) { - const TopoDS_Shape& aTopoDSShape = aShapeIt.Value(); - if(aResultShapesMap.Remove(aTopoDSShape) == Standard_True) { - for(NCollection_List::Iterator - aResIt(aResultShapesList); aResIt.More(); aResIt.Next()) { - if(aTopoDSShape.IsEqual(aResIt.Value())) { + if (hasResults && !anArgumentIsInResult) { + const TopoDS_Shape &aTopoDSShape = aShapeIt.Value(); + if (aResultShapesMap.Remove(aTopoDSShape) == Standard_True) { + for (NCollection_List::Iterator aResIt( + aResultShapesList); + aResIt.More(); aResIt.Next()) { + if (aTopoDSShape.IsEqual(aResIt.Value())) { aResultShapesList.Remove(aResIt); break; } @@ -192,12 +173,11 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, } for (NCollection_List::Iterator aShapeIt(aResultShapesList); - aShapeIt.More(); - aShapeIt.Next()) - { + aShapeIt.More(); aShapeIt.Next()) { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aShapeIt.Value())); - if (!isValidForHistory(aShape)) continue; + if (!isValidForHistory(aShape)) + continue; fixOrientation(aShape); theNewShapes.push_back(aShape); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h index 2ed1af2ea..9a233264c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MakeShapeList_H_ @@ -29,12 +30,8 @@ /// \class GeomAlgoAPI_MakeShapeList /// \ingroup DataAlgo /// \brief List of topological shapes constructions -class GeomAlgoAPI_MakeShapeList : public GeomAlgoAPI_MakeShape -{ - enum OperationType { - Generated, - Modified - }; +class GeomAlgoAPI_MakeShapeList : public GeomAlgoAPI_MakeShape { + enum OperationType { Generated, Modified }; public: /// Default constructor @@ -42,14 +39,15 @@ public: /// \brief Constructor /// \param[in] theMakeShapeList list of algorithms. - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShapeList(const ListOfMakeShape& theMakeShapeList); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_MakeShapeList(const ListOfMakeShape &theMakeShapeList); /// \brief Initializes a class with new list of algorithms. /// \param[in] theMakeShapeList list of algorithms. - GEOMALGOAPI_EXPORT void init(const ListOfMakeShape& theMakeShapeList); + GEOMALGOAPI_EXPORT void init(const ListOfMakeShape &theMakeShapeList); /// \return the list reference - GEOMALGOAPI_EXPORT const ListOfMakeShape& list() const; + GEOMALGOAPI_EXPORT const ListOfMakeShape &list() const; /// \brief Adds algo to the end of list. /// \param[in] theMakeShape algo to be added. @@ -60,18 +58,17 @@ public: /// \return the list of shapes generated from the shape \a theShape GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theShape, - ListOfShape& theHistory); + ListOfShape &theHistory); /// \return the list of shapes modified from the shape \a theShape GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theShape, - ListOfShape& theHistory); + ListOfShape &theHistory); /// \return whether the shape is deleted GEOMALGOAPI_EXPORT virtual bool isDeleted(const GeomShapePtr theShape); private: - void result(const GeomShapePtr theShape, - ListOfShape& theHistory); + void result(const GeomShapePtr theShape, ListOfShape &theHistory); protected: ListOfMakeShape myListOfMakeShape; ///< List of make shape algos. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp index f68eaf98c..3bac6c51b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp @@ -14,39 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_MakeShapeSet.h" - #include #include #include //================================================================================================== GeomAlgoAPI_MakeShapeSet::GeomAlgoAPI_MakeShapeSet() -: GeomAlgoAPI_MakeShapeList() -{} + : GeomAlgoAPI_MakeShapeList() {} //================================================================================================== -GeomAlgoAPI_MakeShapeSet::GeomAlgoAPI_MakeShapeSet(const ListOfMakeShape& theMakeShapeSet) -: GeomAlgoAPI_MakeShapeList(theMakeShapeSet) -{ -} +GeomAlgoAPI_MakeShapeSet::GeomAlgoAPI_MakeShapeSet( + const ListOfMakeShape &theMakeShapeSet) + : GeomAlgoAPI_MakeShapeList(theMakeShapeSet) {} //================================================================================================== void GeomAlgoAPI_MakeShapeSet::generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { if (myListOfMakeShape.empty()) { return; } for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); - ++aBuilderIt) - { + aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { GeomMakeShapePtr aMakeShape = *aBuilderIt; aMakeShape->generated(theOldShape, theNewShapes); } @@ -54,16 +49,13 @@ void GeomAlgoAPI_MakeShapeSet::generated(const GeomShapePtr theOldShape, //================================================================================================== void GeomAlgoAPI_MakeShapeSet::modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { if (myListOfMakeShape.empty()) { return; } for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); - ++aBuilderIt) - { + aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { GeomMakeShapePtr aMakeShape = *aBuilderIt; ListOfShape aModifiedShapes; aMakeShape->modified(theOldShape, theNewShapes); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h index dfd6f293e..7f0248de9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MakeShapeSet_H_ @@ -29,23 +30,23 @@ /// \class GeomAlgoAPI_MakeShapeSet /// \ingroup DataAlgo /// \brief Set of independent topological shapes constructions -class GeomAlgoAPI_MakeShapeSet : public GeomAlgoAPI_MakeShapeList -{ +class GeomAlgoAPI_MakeShapeSet : public GeomAlgoAPI_MakeShapeList { public: /// Default constructor GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShapeSet(); /// \brief Constructor /// \param[in] theMakeShapeSet list of algorithms. - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShapeSet(const ListOfMakeShape& theMakeShapeSet); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_MakeShapeSet(const ListOfMakeShape &theMakeShapeSet); /// \return the list of shapes generated from the shape \a theShape GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theShape, - ListOfShape& theHistory); + ListOfShape &theHistory); /// \return the list of shapes modified from the shape \a theShape GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theShape, - ListOfShape& theHistory); + ListOfShape &theHistory); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.cpp index b5039726d..6cd0f6160 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.cpp @@ -14,43 +14,40 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_MakeSweep.h" //================================================================================================= -const ListOfShape& GeomAlgoAPI_MakeSweep::fromShapes() const -{ +const ListOfShape &GeomAlgoAPI_MakeSweep::fromShapes() const { return myFromShapes; } //================================================================================================= -const ListOfShape& GeomAlgoAPI_MakeSweep::toShapes() const -{ +const ListOfShape &GeomAlgoAPI_MakeSweep::toShapes() const { return myToShapes; } //================================================================================================= -void GeomAlgoAPI_MakeSweep::addFromShape(const std::shared_ptr theFace) -{ +void GeomAlgoAPI_MakeSweep::addFromShape( + const std::shared_ptr theFace) { myFromShapes.push_back(theFace); } //================================================================================================= -void GeomAlgoAPI_MakeSweep::setFromShapes(const ListOfShape& theListOfFaces) -{ +void GeomAlgoAPI_MakeSweep::setFromShapes(const ListOfShape &theListOfFaces) { myFromShapes = theListOfFaces; } //================================================================================================= -void GeomAlgoAPI_MakeSweep::addToShape(const std::shared_ptr theFace) -{ +void GeomAlgoAPI_MakeSweep::addToShape( + const std::shared_ptr theFace) { myToShapes.push_back(theFace); } //================================================================================================= -void GeomAlgoAPI_MakeSweep::setToShapes(const ListOfShape& theListOfFaces) -{ +void GeomAlgoAPI_MakeSweep::setToShapes(const ListOfShape &theListOfFaces) { myToShapes = theListOfFaces; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h index afafbc147..cf01dff06 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MakeSweep_H_ @@ -37,34 +38,35 @@ * - Shells generate Composite Solids. * You are not allowed to sweep Solids and Composite Solids. */ -class GeomAlgoAPI_MakeSweep : public GeomAlgoAPI_MakeShapeList -{ +class GeomAlgoAPI_MakeSweep : public GeomAlgoAPI_MakeShapeList { public: /// \returns the list of from shapes. - GEOMALGOAPI_EXPORT const ListOfShape& fromShapes() const; + GEOMALGOAPI_EXPORT const ListOfShape &fromShapes() const; /// \return the list of to shapes. - GEOMALGOAPI_EXPORT const ListOfShape& toShapes() const; + GEOMALGOAPI_EXPORT const ListOfShape &toShapes() const; /// \brief Adds a shape to list of from shape. /// \param[in] theShape a shape to add. - GEOMALGOAPI_EXPORT void addFromShape(const std::shared_ptr theShape); + GEOMALGOAPI_EXPORT void + addFromShape(const std::shared_ptr theShape); /// \brief Sets from shapes /// \param[in] theListOfShapes list of from shapes. - GEOMALGOAPI_EXPORT void setFromShapes(const ListOfShape& theListOfShapes); + GEOMALGOAPI_EXPORT void setFromShapes(const ListOfShape &theListOfShapes); /// \brief Adds a face to list of to shape. /// \param[in] theShape a face to add. - GEOMALGOAPI_EXPORT void addToShape(const std::shared_ptr theShape); + GEOMALGOAPI_EXPORT void + addToShape(const std::shared_ptr theShape); /// \brief Sets to shapes /// \param[in] theListOfShapes list of to shapes. - GEOMALGOAPI_EXPORT void setToShapes(const ListOfShape& theListOfShapes); + GEOMALGOAPI_EXPORT void setToShapes(const ListOfShape &theListOfShapes); protected: /// Empty constructor. - GeomAlgoAPI_MakeSweep() : GeomAlgoAPI_MakeShapeList() {}; + GeomAlgoAPI_MakeSweep() : GeomAlgoAPI_MakeShapeList(){}; private: ListOfShape myFromShapes; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp index 950d04e84..eaf08f914 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_MakeVolume.h" @@ -26,38 +27,38 @@ #include //================================================================================================= -std::shared_ptr GeomAlgoAPI_MakeVolume::make(const ListOfShape& theFaces) -{ +std::shared_ptr +GeomAlgoAPI_MakeVolume::make(const ListOfShape &theFaces) { GeomAlgoAPI_MakeVolume aMkVolAlgo(theFaces, false); GeomShapePtr aResult; - if(aMkVolAlgo.isDone() && !aMkVolAlgo.shape()->isNull() && aMkVolAlgo.isValid()) + if (aMkVolAlgo.isDone() && !aMkVolAlgo.shape()->isNull() && + aMkVolAlgo.isValid()) aResult = aMkVolAlgo.shape(); return aResult; } //================================================================================================= -GeomAlgoAPI_MakeVolume::GeomAlgoAPI_MakeVolume( - const ListOfShape& theFaces, const bool theAvoidInternal) -{ +GeomAlgoAPI_MakeVolume::GeomAlgoAPI_MakeVolume(const ListOfShape &theFaces, + const bool theAvoidInternal) { myAvoidInternal = theAvoidInternal; build(theFaces); } -static void convertToTopoDS(const ListOfShape& theShapes, TopTools_ListOfShape& theTopoDSShapes) -{ - for (ListOfShape::const_iterator anIt = theShapes.begin(); anIt != theShapes.end(); ++anIt) +static void convertToTopoDS(const ListOfShape &theShapes, + TopTools_ListOfShape &theTopoDSShapes) { + for (ListOfShape::const_iterator anIt = theShapes.begin(); + anIt != theShapes.end(); ++anIt) theTopoDSShapes.Append((*anIt)->impl()); } //================================================================================================= -void GeomAlgoAPI_MakeVolume::build(const ListOfShape& theFaces) -{ +void GeomAlgoAPI_MakeVolume::build(const ListOfShape &theFaces) { if (theFaces.empty()) { return; } // create make volume opration - BOPAlgo_MakerVolume* aVolumeMaker = new BOPAlgo_MakerVolume; + BOPAlgo_MakerVolume *aVolumeMaker = new BOPAlgo_MakerVolume; this->setImpl(aVolumeMaker); this->setBuilderType(OCCT_BOPAlgo_Builder); @@ -77,14 +78,15 @@ void GeomAlgoAPI_MakeVolume::build(const ListOfShape& theFaces) return; TopoDS_Shape aResult = aVolumeMaker->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aResult)); - aResult = GeomAlgoAPI_ShapeTools::groupSharedTopology(aGeomShape)->impl(); + aResult = GeomAlgoAPI_ShapeTools::groupSharedTopology(aGeomShape) + ->impl(); } // Setting result. - if(aResult.IsNull()) { + if (aResult.IsNull()) { return; } std::shared_ptr aShape(new GeomAPI_Shape()); @@ -95,15 +97,15 @@ void GeomAlgoAPI_MakeVolume::build(const ListOfShape& theFaces) //================================================================================================= void GeomAlgoAPI_MakeVolume::modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { if (theOldShape->shapeType() == GeomAPI_Shape::SOLID) { ListOfShape aNewShapes; // collect faces and parent shapes, if it is not done yet if (!isNewShapesCollected(theOldShape, GeomAPI_Shape::FACE)) collectNewShapes(theOldShape, GeomAPI_Shape::FACE); - for (GeomAPI_ShapeExplorer anIt(shape(), GeomAPI_Shape::SOLID); anIt.more(); anIt.next()) { + for (GeomAPI_ShapeExplorer anIt(shape(), GeomAPI_Shape::SOLID); anIt.more(); + anIt.next()) { for (GeomAPI_ShapeExplorer anExp(anIt.current(), GeomAPI_Shape::FACE); anExp.more(); anExp.next()) { GeomShapePtr anOldShapesCompound = @@ -117,7 +119,6 @@ void GeomAlgoAPI_MakeVolume::modified(const GeomShapePtr theOldShape, if (!aNewShapes.empty()) theNewShapes = aNewShapes; - } - else + } else GeomAlgoAPI_MakeShape::modified(theOldShape, theNewShapes); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h index 480f4122b..a9a7eb870 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MakeVolume_H_ @@ -28,30 +29,31 @@ /// \class GeomAlgoAPI_MakeVolume /// \ingroup DataAlgo /// \brief Perform building solid (compsolid) from a list of faces. -class GeomAlgoAPI_MakeVolume : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_MakeVolume : public GeomAlgoAPI_MakeShape { bool myAvoidInternal; // to remove internal faces from the result public: /// \brief Perform making volume. /// \param[in] theObjects list of faces. /// \return a solid or a compsolid as result of operation. - GEOMALGOAPI_EXPORT static std::shared_ptr make(const ListOfShape& theFaces); + GEOMALGOAPI_EXPORT static std::shared_ptr + make(const ListOfShape &theFaces); /// Constructor. /// \param theFaces faces that will construct a solid /// \param theAvoidInternal to remove internal faces from the result - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeVolume(const ListOfShape& theFaces, - const bool theAvoidInternal); + GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeVolume(const ListOfShape &theFaces, + const bool theAvoidInternal); /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theOldShape base shape. - /// \param[out] theNewShapes shapes modified from \a theShape. Does not cleared! + /// \param[out] theNewShapes shapes modified from \a theShape. Does not + /// cleared! GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); + ListOfShape &theNewShapes); private: /// Builds resulting shape. - void build(const ListOfShape& theFaces); + void build(const ListOfShape &theFaces); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.cpp index cdb84b79d..51c64b99b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_MapShapesAndAncestors.h" @@ -24,16 +25,14 @@ GeomAlgoAPI_MapShapesAndAncestors::GeomAlgoAPI_MapShapesAndAncestors( const std::shared_ptr theShape, const GeomAPI_Shape::ShapeType theShapeType, - const GeomAPI_Shape::ShapeType theAncestorType) -{ + const GeomAPI_Shape::ShapeType theAncestorType) { perform(theShape, theShapeType, theAncestorType); } void GeomAlgoAPI_MapShapesAndAncestors::perform( const std::shared_ptr theShape, const GeomAPI_Shape::ShapeType theShapeType, - const GeomAPI_Shape::ShapeType theAncestorType) -{ + const GeomAPI_Shape::ShapeType theAncestorType) { myMap.clear(); GeomAPI_ShapeExplorer anAncIt(theShape, theAncestorType); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h b/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h index f131c7bf4..2079b6054 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_MapShapesAndAncestors_H_ @@ -28,19 +29,20 @@ #include typedef std::set SetOfShapes; -typedef std::map MapShapeToShapes; +typedef std::map + MapShapeToShapes; /// \class GeomAlgoAPI_MapShapesAndAncestors /// \ingroup DataAlgo /// \brief Perform mapping specified types of sub-shapes of given shape -class GeomAlgoAPI_MapShapesAndAncestors -{ +class GeomAlgoAPI_MapShapesAndAncestors { public: /// \brief Perform mapping. GEOMALGOAPI_EXPORT - GeomAlgoAPI_MapShapesAndAncestors(const std::shared_ptr theShape, - const GeomAPI_Shape::ShapeType theShapeType, - const GeomAPI_Shape::ShapeType theAncestorType); + GeomAlgoAPI_MapShapesAndAncestors( + const std::shared_ptr theShape, + const GeomAPI_Shape::ShapeType theShapeType, + const GeomAPI_Shape::ShapeType theAncestorType); /// \brief Perform mapping. GEOMALGOAPI_EXPORT void perform(const std::shared_ptr theShape, @@ -48,7 +50,7 @@ public: const GeomAPI_Shape::ShapeType theAncestorType); /// \return Map of sub-shapes. - const MapShapeToShapes& map() const { return myMap; } + const MapShapeToShapes &map() const { return myMap; } private: MapShapeToShapes myMap; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp index d04f8f11e..03ed7afa4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_NExplode.h" @@ -22,10 +23,10 @@ #include #include -#include -#include #include #include +#include +#include #include #include #include @@ -35,74 +36,67 @@ #include #include -namespace NExplodeTools -{ - void dummy(gp_Pnt&) - { - // do nothing (new approach to order shapes) - } +namespace NExplodeTools { +void dummy(gp_Pnt &) { + // do nothing (new approach to order shapes) +} - void pointToDouble(gp_Pnt& thePoint) - { - // old approach to order shapes - double dMidXYZ = thePoint.X() * 999.0 + thePoint.Y() * 99.0 + thePoint.Z() * 0.9; - thePoint.SetCoord(dMidXYZ, 0.0, 0.0); - } +void pointToDouble(gp_Pnt &thePoint) { + // old approach to order shapes + double dMidXYZ = + thePoint.X() * 999.0 + thePoint.Y() * 99.0 + thePoint.Z() * 0.9; + thePoint.SetCoord(dMidXYZ, 0.0, 0.0); +} - std::pair ShapeToDouble(const GeomShapePtr& theShape, - void(*convertPoint)(gp_Pnt&)) - { - // Computing of CentreOfMass - gp_Pnt GPoint; - double Len; - - TopoDS_Shape S = theShape->impl(); - if (S.ShapeType() == TopAbs_VERTEX) { - GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S)); - Len = (double)S.Orientation(); - } - else { - GProp_GProps GPr; - if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { - BRepGProp::LinearProperties(S, GPr); - } - else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { - BRepGProp::SurfaceProperties(S, GPr); - } - else { - BRepGProp::VolumeProperties(S, GPr); - } - GPoint = GPr.CentreOfMass(); - Len = GPr.Mass(); +std::pair ShapeToDouble(const GeomShapePtr &theShape, + void (*convertPoint)(gp_Pnt &)) { + // Computing of CentreOfMass + gp_Pnt GPoint; + double Len; + + TopoDS_Shape S = theShape->impl(); + if (S.ShapeType() == TopAbs_VERTEX) { + GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S)); + Len = (double)S.Orientation(); + } else { + GProp_GProps GPr; + if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties(S, GPr); + } else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(S, GPr); + } else { + BRepGProp::VolumeProperties(S, GPr); } - - (*convertPoint)(GPoint); - GeomPointPtr aMidPoint(new GeomAPI_Pnt(GPoint.X(), GPoint.Y(), GPoint.Z())); - return std::make_pair(aMidPoint, Len); + GPoint = GPr.CentreOfMass(); + Len = GPr.Mass(); } - /*! - * \brief Sort shapes in the list by their coordinates. - */ - struct CompareShapes : public std::binary_function - { - typedef std::unordered_map, - GeomAPI_Shape::Hash, - GeomAPI_Shape::Equal > DataMapOfShapeDouble; - - CompareShapes(void(*convertPoint)(gp_Pnt&)) + (*convertPoint)(GPoint); + GeomPointPtr aMidPoint(new GeomAPI_Pnt(GPoint.X(), GPoint.Y(), GPoint.Z())); + return std::make_pair(aMidPoint, Len); +} + +/*! + * \brief Sort shapes in the list by their coordinates. + */ +struct CompareShapes + : public std::binary_function { + typedef std::unordered_map, + GeomAPI_Shape::Hash, GeomAPI_Shape::Equal> + DataMapOfShapeDouble; + + CompareShapes(void (*convertPoint)(gp_Pnt &)) : myConvertPoint(convertPoint) {} - bool operator() (const GeomShapePtr& lhs, const GeomShapePtr& rhs); + bool operator()(const GeomShapePtr &lhs, const GeomShapePtr &rhs); - DataMapOfShapeDouble myMap; - void(*myConvertPoint)(gp_Pnt&); - }; -} + DataMapOfShapeDouble myMap; + void (*myConvertPoint)(gp_Pnt &); +}; +} // namespace NExplodeTools -bool NExplodeTools::CompareShapes::operator() (const GeomShapePtr& lhs, const GeomShapePtr& rhs) -{ +bool NExplodeTools::CompareShapes::operator()(const GeomShapePtr &lhs, + const GeomShapePtr &rhs) { if (myMap.find(lhs) == myMap.end()) { myMap[lhs] = ShapeToDouble(lhs, myConvertPoint); } @@ -111,8 +105,8 @@ bool NExplodeTools::CompareShapes::operator() (const GeomShapePtr& lhs, const Ge myMap[rhs] = ShapeToDouble(rhs, myConvertPoint); } - const std::pair& val1 = myMap.at(lhs); - const std::pair& val2 = myMap.at(rhs); + const std::pair &val1 = myMap.at(lhs); + const std::pair &val2 = myMap.at(rhs); double tol = 10.0 * Precision::Confusion(); bool exchange = Standard_False; @@ -120,13 +114,11 @@ bool NExplodeTools::CompareShapes::operator() (const GeomShapePtr& lhs, const Ge // compare coordinates of center points if (val2.first->isLess(val1.first, tol)) { exchange = Standard_True; - } - else if (!val1.first->isLess(val2.first, tol)) { + } else if (!val1.first->isLess(val2.first, tol)) { double dLength = val1.second - val2.second; if (dLength >= tol) { exchange = Standard_True; - } - else if (Abs(dLength) < tol && lhs->shapeType() <= GeomAPI_Shape::FACE) { + } else if (Abs(dLength) < tol && lhs->shapeType() <= GeomAPI_Shape::FACE) { // equal values possible on shapes such as two halves of a sphere and // a membrane inside the sphere Bnd_Box box1, box2; @@ -136,37 +128,36 @@ bool NExplodeTools::CompareShapes::operator() (const GeomShapePtr& lhs, const Ge Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent(); if (dSquareExtent >= tol) { exchange = Standard_True; - } - else if (Abs(dSquareExtent) < tol) { - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, value1, value2; + } else if (Abs(dSquareExtent) < tol) { + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, value1, + value2; box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - value1 = (aXmin + aXmax)*999.0 + (aYmin + aYmax)*99.0 + (aZmin + aZmax)*0.9; + value1 = (aXmin + aXmax) * 999.0 + (aYmin + aYmax) * 99.0 + + (aZmin + aZmax) * 0.9; box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - value2 = (aXmin + aXmax)*999.0 + (aYmin + aYmax)*99.0 + (aZmin + aZmax)*0.9; + value2 = (aXmin + aXmax) * 999.0 + (aYmin + aYmax) * 99.0 + + (aZmin + aZmax) * 0.9; if (value1 - value2 >= tol) { exchange = Standard_True; - } - else { // compare adresses if shapes are geometrically equal + } else { // compare adresses if shapes are geometrically equal exchange = lhs->impl().TShape().get() > rhs->impl().TShape().get(); } } } - } - else { // compare adresses if shapes are geometrically equal + } else { // compare adresses if shapes are geometrically equal exchange = lhs->impl().TShape().get() > rhs->impl().TShape().get(); - } + } } - //return val1 < val2; + // return val1 < val2; return !exchange; } -GeomAlgoAPI_NExplode::GeomAlgoAPI_NExplode(const GeomShapePtr theContext, - const GeomAPI_Shape::ShapeType theShapeType, - const ShapeOrder theOrder) -{ +GeomAlgoAPI_NExplode::GeomAlgoAPI_NExplode( + const GeomShapePtr theContext, const GeomAPI_Shape::ShapeType theShapeType, + const ShapeOrder theOrder) { std::set aMapShape; GeomAPI_ShapeExplorer anExp(theContext, theShapeType); for (; anExp.more(); anExp.next()) { @@ -179,36 +170,33 @@ GeomAlgoAPI_NExplode::GeomAlgoAPI_NExplode(const GeomShapePtr theContext, reorder(theOrder); } -GeomAlgoAPI_NExplode::GeomAlgoAPI_NExplode(const ListOfShape& theShapes, +GeomAlgoAPI_NExplode::GeomAlgoAPI_NExplode(const ListOfShape &theShapes, const ShapeOrder theOrder) - : mySorted(theShapes.begin(), theShapes.end()) -{ + : mySorted(theShapes.begin(), theShapes.end()) { reorder(theOrder); } -int GeomAlgoAPI_NExplode::index(const GeomShapePtr theSubShape) -{ +int GeomAlgoAPI_NExplode::index(const GeomShapePtr theSubShape) { std::vector::iterator anIter = mySorted.begin(); - for(int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) { + for (int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) { if ((*anIter)->isSame(theSubShape)) return anIndex; } return 0; // not found } -GeomShapePtr GeomAlgoAPI_NExplode::shape(const int theIndex) -{ +GeomShapePtr GeomAlgoAPI_NExplode::shape(const int theIndex) { std::vector::iterator anIter = mySorted.begin(); - for(int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) { + for (int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) { if (anIndex == theIndex) return *anIter; } return GeomShapePtr(); // not found } -void GeomAlgoAPI_NExplode::reorder(const ShapeOrder theNewOrder) -{ - NExplodeTools::CompareShapes shComp( - theNewOrder == ORDER_BY_HASH_VALUE ? NExplodeTools::pointToDouble : NExplodeTools::dummy); +void GeomAlgoAPI_NExplode::reorder(const ShapeOrder theNewOrder) { + NExplodeTools::CompareShapes shComp(theNewOrder == ORDER_BY_HASH_VALUE + ? NExplodeTools::pointToDouble + : NExplodeTools::dummy); std::stable_sort(mySorted.begin(), mySorted.end(), shComp); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.h b/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.h index 962aec855..13dba6558 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_NExplode_H_ @@ -28,11 +29,11 @@ /// \class GeomAlgoAPI_NExplode /// \ingroup DataAlgo -/// \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9. -/// Algorithm is copied from GEOM module, which uses nexplode Draw command from OCCT. -/// Used for getting index of sub0shape in WeakNaming algorithm. -class GeomAlgoAPI_NExplode -{ +/// \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + +/// Z*0.9. Algorithm is copied from GEOM module, which uses nexplode Draw +/// command from OCCT. Used for getting index of sub0shape in WeakNaming +/// algorithm. +class GeomAlgoAPI_NExplode { public: /// Different orders of shape explosion enum ShapeOrder { @@ -41,22 +42,26 @@ public: }; public: - /// \brief Initializes the sorted list of shapes by the context shape and type of sub-shapes. - GEOMALGOAPI_EXPORT GeomAlgoAPI_NExplode(const GeomShapePtr theContext, - const GeomAPI_Shape::ShapeType theShapeType, - const ShapeOrder theOrder = ORDER_BY_MIDDLE_POINT); + /// \brief Initializes the sorted list of shapes by the context shape and type + /// of sub-shapes. + GEOMALGOAPI_EXPORT + GeomAlgoAPI_NExplode(const GeomShapePtr theContext, + const GeomAPI_Shape::ShapeType theShapeType, + const ShapeOrder theOrder = ORDER_BY_MIDDLE_POINT); - /// \brief Initializes the sorted list of shapes. - GEOMALGOAPI_EXPORT GeomAlgoAPI_NExplode(const ListOfShape& theShapes, - const ShapeOrder theOrder = ORDER_BY_MIDDLE_POINT); + /// \brief Initializes the sorted list of shapes. + GEOMALGOAPI_EXPORT + GeomAlgoAPI_NExplode(const ListOfShape &theShapes, + const ShapeOrder theOrder = ORDER_BY_MIDDLE_POINT); - /// Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found. - GEOMALGOAPI_EXPORT int index(const GeomShapePtr theSubShape); - /// Returns a shape by an index (started from one). Returns null if not found. - GEOMALGOAPI_EXPORT GeomShapePtr shape(const int theIndex); + /// Returns an index (started from one) of sub-shape in the sorted list. + /// Returns 0 if not found. + GEOMALGOAPI_EXPORT int index(const GeomShapePtr theSubShape); + /// Returns a shape by an index (started from one). Returns null if not found. + GEOMALGOAPI_EXPORT GeomShapePtr shape(const int theIndex); - /// Reorder the shapes - GEOMALGOAPI_EXPORT void reorder(const ShapeOrder theNewOrder); + /// Reorder the shapes + GEOMALGOAPI_EXPORT void reorder(const ShapeOrder theNewOrder); protected: std::vector mySorted; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp index 59b07da86..af095b42a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp @@ -14,140 +14,131 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include +#include #include -#include #include -#include +#include +#include +#include +#include #include #include -#include #include +#include #include -#include #include -#include -#include -#include #include +#include #include +#include +#include +#include //================================================================================================== GeomAlgoAPI_NonPlanarFace::GeomAlgoAPI_NonPlanarFace( - const ListOfShape& theEdges) -{ - build(theEdges); + const ListOfShape &theEdges) { + build(theEdges); } //================================================================================================== -void GeomAlgoAPI_NonPlanarFace::build - (const ListOfShape& theEdges) -{ - myResultFaces.clear(); - setDone(false); - if (theEdges.empty()) - { - return; +void GeomAlgoAPI_NonPlanarFace::build(const ListOfShape &theEdges) { + myResultFaces.clear(); + setDone(false); + if (theEdges.empty()) { + return; + } + + // prepare edges + Handle(TopTools_HSequenceOfShape) aSeqEdgesIn = new TopTools_HSequenceOfShape; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TopTools_MapOfShape aMapEdges; + for (auto anEdge : theEdges) { + const TopoDS_Edge &aTEdge = anEdge->impl(); + if (aMapEdges.Add(aTEdge)) { + BRepBuilderAPI_Copy aCopy(aTEdge, Standard_False, Standard_False); + const TopoDS_Shape &aCopyEdge = aCopy.Shape(); + aSeqEdgesIn->Append(aCopyEdge); } + } - //prepare edges - Handle(TopTools_HSequenceOfShape) aSeqEdgesIn = new TopTools_HSequenceOfShape; - TColStd_IndexedDataMapOfTransientTransient aMapTShapes; - TopTools_MapOfShape aMapEdges; - for (auto anEdge: theEdges) - { - const TopoDS_Edge& aTEdge = anEdge->impl(); - if (aMapEdges.Add(aTEdge)) - { - BRepBuilderAPI_Copy aCopy(aTEdge, Standard_False, Standard_False); - const TopoDS_Shape& aCopyEdge = aCopy.Shape(); - aSeqEdgesIn->Append(aCopyEdge); - } + // no edges + if (aSeqEdgesIn->IsEmpty()) { + return; + } + + // Connect edges to wires of maximum length + Handle(TopTools_HSequenceOfShape) aSeqWiresOut; + ShapeAnalysis_FreeBounds::ConnectEdgesToWires( + aSeqEdgesIn, Precision::Confusion(), Standard_False, aSeqWiresOut); + + // prepare compound result + BRep_Builder aBuilder; + TopoDS_Compound aResult; + aBuilder.MakeCompound(aResult); + + // try to construct face for each non-planar wire + for (int ind = 1; ind <= aSeqWiresOut->Length(); ind++) { + if (!aSeqWiresOut->Value(ind).Closed()) { + continue; } + TopoDS_Wire aWire = TopoDS::Wire(aSeqWiresOut->Value(ind)); - // no edges - if (aSeqEdgesIn->IsEmpty()) - { - return; + // try to construct filling surface + BRepOffsetAPI_MakeFilling aMF; + BRepTools_WireExplorer aWExp(aWire); + for (; aWExp.More(); aWExp.Next()) { + aMF.Add(TopoDS::Edge(aWExp.Current()), GeomAbs_C0); + } + aMF.Build(); + if (!aMF.IsDone()) { + return; } + // Result of filling + TopoDS_Shape aFillRes = aMF.Shape(); + Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFillRes)); + BRepBuilderAPI_MakeFace aMakeFace(aGS, aWire); + if (aMakeFace.IsDone()) { + TopoDS_Face aNewFace = aMakeFace.Face(); + Handle(ShapeFix_Face) aFix = new ShapeFix_Face(aNewFace); + aFix->Perform(); + aFix->FixOrientation(); + aNewFace = aFix->Face(); - // Connect edges to wires of maximum length - Handle(TopTools_HSequenceOfShape) aSeqWiresOut; - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(), Standard_False, aSeqWiresOut); - - // prepare compound result - BRep_Builder aBuilder; - TopoDS_Compound aResult; - aBuilder.MakeCompound(aResult); - - // try to construct face for each non-planar wire - for(int ind = 1; ind <= aSeqWiresOut->Length(); ind++) - { - if(!aSeqWiresOut->Value(ind).Closed()) - { - continue; - } - TopoDS_Wire aWire = TopoDS::Wire(aSeqWiresOut->Value(ind)); - - // try to construct filling surface - BRepOffsetAPI_MakeFilling aMF; - BRepTools_WireExplorer aWExp(aWire); - for (; aWExp.More(); aWExp.Next()) - { - aMF.Add(TopoDS::Edge(aWExp.Current()), GeomAbs_C0); - } - aMF.Build(); - if (!aMF.IsDone()) - { - return; - } - // Result of filling - TopoDS_Shape aFillRes = aMF.Shape(); - Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFillRes)); - BRepBuilderAPI_MakeFace aMakeFace(aGS, aWire); - if (aMakeFace.IsDone()) - { - TopoDS_Face aNewFace = aMakeFace.Face(); - Handle(ShapeFix_Face) aFix = new ShapeFix_Face(aNewFace); - aFix->Perform(); - aFix->FixOrientation(); - aNewFace = aFix->Face(); - - //check and fix pcurves, if necessary - TopExp_Explorer aExpE; - Standard_Real aT, aTolE, aDMax; - ShapeFix_ShapeTolerance sat; - aExpE.Init(aNewFace, TopAbs_EDGE); - for (; aExpE.More(); aExpE.Next()) - { - const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExpE.Current(); - if (!BOPTools_AlgoTools::ComputeTolerance(aNewFace, aE, aDMax, aT)) continue; - aTolE = BRep_Tool::Tolerance(aE); - if (aDMax < aTolE) continue; - - sat.LimitTolerance(aE, aDMax); - } - - // store face - aBuilder.Add(aResult, aNewFace); - std::shared_ptr aResFace(new GeomAPI_Shape); - aResFace->setImpl(new TopoDS_Face(aNewFace)); - myResultFaces.push_back(aResFace); - } + // check and fix pcurves, if necessary + TopExp_Explorer aExpE; + Standard_Real aT, aTolE, aDMax; + ShapeFix_ShapeTolerance sat; + aExpE.Init(aNewFace, TopAbs_EDGE); + for (; aExpE.More(); aExpE.Next()) { + const TopoDS_Edge &aE = *(TopoDS_Edge *)&aExpE.Current(); + if (!BOPTools_AlgoTools::ComputeTolerance(aNewFace, aE, aDMax, aT)) + continue; + aTolE = BRep_Tool::Tolerance(aE); + if (aDMax < aTolE) + continue; + + sat.LimitTolerance(aE, aDMax); + } + + // store face + aBuilder.Add(aResult, aNewFace); + std::shared_ptr aResFace(new GeomAPI_Shape); + aResFace->setImpl(new TopoDS_Face(aNewFace)); + myResultFaces.push_back(aResFace); } - - // update results - GeomShapePtr aResShape(new GeomAPI_Shape); - aResShape->setImpl(new TopoDS_Shape(aResult)); - setShape(aResShape); - setDone(true); + } + + // update results + GeomShapePtr aResShape(new GeomAPI_Shape); + aResShape->setImpl(new TopoDS_Shape(aResult)); + setShape(aResShape); + setDone(true); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.h b/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.h index 0ffb5e25a..1ff7d37a6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_NonPlanarFace_H_ @@ -27,25 +28,22 @@ * \ingroup DataAlgo * \brief Creates non planar faces */ -class GeomAlgoAPI_NonPlanarFace : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_NonPlanarFace : public GeomAlgoAPI_MakeShape { public: - - /// Creates list of faces based on the non-planar wires - /// \param theEdges list of input non-planar edges. + /// Creates list of faces based on the non-planar wires + /// \param theEdges list of input non-planar edges. GEOMALGOAPI_EXPORT - GeomAlgoAPI_NonPlanarFace(const ListOfShape& theEdges); + GeomAlgoAPI_NonPlanarFace(const ListOfShape &theEdges); - /// Return list of created faces - GEOMALGOAPI_EXPORT const ListOfShape& faces() const - { return myResultFaces; } + /// Return list of created faces + GEOMALGOAPI_EXPORT const ListOfShape &faces() const { return myResultFaces; } private: /// \brief Perform operation /// \param theEdges list of selected wires. - GEOMALGOAPI_EXPORT void build(const ListOfShape& theEdges); + GEOMALGOAPI_EXPORT void build(const ListOfShape &theEdges); - std::list > myResultFaces; + std::list> myResultFaces; }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.cpp index 22ee6e03a..7c71b9883 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_NormalToFace.h" @@ -24,38 +25,41 @@ #include #include -#include #include #include #include #include #include +#include #include -#include +#include #include #include -#include +#include #include #include - /*! - * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape. - * \param theShape The shape to get type of. - * \retval TopAbs_ShapeEnum Return type of shape for explode. - */ -TopAbs_ShapeEnum GetTypeOfSimplePart(const TopoDS_Shape& theShape) -{ +/*! + * \brief Return type of shape for explode. In case of compound it will be a + * type of its first sub shape. \param theShape The shape to get type of. + * \retval TopAbs_ShapeEnum Return type of shape for explode. + */ +TopAbs_ShapeEnum GetTypeOfSimplePart(const TopoDS_Shape &theShape) { TopAbs_ShapeEnum aType = theShape.ShapeType(); - if (aType == TopAbs_VERTEX) return TopAbs_VERTEX; - else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) return TopAbs_EDGE; - else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) return TopAbs_FACE; - else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) return TopAbs_SOLID; + if (aType == TopAbs_VERTEX) + return TopAbs_VERTEX; + else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) + return TopAbs_EDGE; + else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) + return TopAbs_FACE; + else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) + return TopAbs_SOLID; else if (aType == TopAbs_COMPOUND) { // Only the iType of the first shape in the compound is taken into account - TopoDS_Iterator It (theShape, Standard_False, Standard_False); + TopoDS_Iterator It(theShape, Standard_False, Standard_False); if (It.More()) { return GetTypeOfSimplePart(It.Value()); } @@ -63,17 +67,16 @@ TopAbs_ShapeEnum GetTypeOfSimplePart(const TopoDS_Shape& theShape) return TopAbs_SHAPE; } - /*! - * \brief Get Local Coordinate System, corresponding to the given shape. - * \param theShape The shape to get type of. - * \retval gp_Ax3 Return axis. - * - * Origin of the LCS is situated at the shape's center of mass. - * Axes of the LCS are obtained from shape's location or, - * if the shape is a planar face, from position of its plane. - */ -gp_Ax3 GetPosition(const TopoDS_Shape& theShape) -{ +/*! + * \brief Get Local Coordinate System, corresponding to the given shape. + * \param theShape The shape to get type of. + * \retval gp_Ax3 Return axis. + * + * Origin of the LCS is situated at the shape's center of mass. + * Axes of the LCS are obtained from shape's location or, + * if the shape is a planar face, from position of its plane. + */ +gp_Ax3 GetPosition(const TopoDS_Shape &theShape) { gp_Ax3 aResult; if (theShape.IsNull()) @@ -90,9 +93,9 @@ gp_Ax3 GetPosition(const TopoDS_Shape& theShape) // In case of reverse orinetation of the face invert the plane normal // (the face's normal does not mathc the plane's normal in this case) if (theShape.Orientation() == TopAbs_REVERSED) { - gp_Dir Vx = aResult.XDirection(); - gp_Dir N = aResult.Direction().Mirrored(Vx); - gp_Pnt P = aResult.Location(); + gp_Dir Vx = aResult.XDirection(); + gp_Dir N = aResult.Direction().Mirrored(Vx); + gp_Pnt P = aResult.Location(); aResult = gp_Ax3(P, N, Vx); } } @@ -129,12 +132,11 @@ gp_Ax3 GetPosition(const TopoDS_Shape& theShape) //================================================================================================= bool GeomAlgoAPI_NormalToFace::normal(GeomShapePtr theFace, GeomShapePtr thePoint, - GeomEdgePtr theNormal, - std::string& theError) -{ - #ifdef _DEBUG + GeomEdgePtr theNormal, + std::string &theError) { +#ifdef _DEBUG std::cout << "GeomAlgoAPI_NormalToFace::normal" << std::endl; - #endif +#endif if (!theFace.get()) { theError = "Face for normale calculation is null"; @@ -151,16 +153,16 @@ bool GeomAlgoAPI_NormalToFace::normal(GeomShapePtr theFace, TopoDS_Face aFace = TopoDS::Face(aShape); // Point - gp_Pnt p1 (0,0,0); + gp_Pnt p1(0, 0, 0); // Point parameters on surface double u1, u2, v1, v2; Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); - Handle(ShapeAnalysis_Surface) aSurfAna = new ShapeAnalysis_Surface (aSurf); + Handle(ShapeAnalysis_Surface) aSurfAna = new ShapeAnalysis_Surface(aSurf); gp_Ax3 aPos = GetPosition(aFace); p1 = aPos.Location(); // Set default starting point using UV bounds BRepTools::UVBounds(aFace, u1, u2, v1, v2); - gp_Pnt2d pUV ((u2 + u1) * 0.5, (v2 + v1) * 0.5); + gp_Pnt2d pUV((u2 + u1) * 0.5, (v2 + v1) * 0.5); // Change to Vertex coord if selected if (thePoint.get()) { @@ -174,18 +176,17 @@ bool GeomAlgoAPI_NormalToFace::normal(GeomShapePtr theFace, } // Normal direction - gp_Vec Vec1,Vec2; - BRepAdaptor_Surface SF (aFace); + gp_Vec Vec1, Vec2; + BRepAdaptor_Surface SF(aFace); SF.D1(pUV.X(), pUV.Y(), p1, Vec1, Vec2); if (Vec1.Magnitude() < Precision::Confusion()) { gp_Vec tmpV; gp_Pnt tmpP; - SF.D1(pUV.X(), pUV.Y()-0.1, tmpP, Vec1, tmpV); - } - else if (Vec2.Magnitude() < Precision::Confusion()) { + SF.D1(pUV.X(), pUV.Y() - 0.1, tmpP, Vec1, tmpV); + } else if (Vec2.Magnitude() < Precision::Confusion()) { gp_Vec tmpV; gp_Pnt tmpP; - SF.D1(pUV.X()-0.1, pUV.Y(), tmpP, tmpV, Vec2); + SF.D1(pUV.X() - 0.1, pUV.Y(), tmpP, tmpV, Vec2); } gp_Vec V = Vec1.Crossed(Vec2); @@ -195,7 +196,8 @@ bool GeomAlgoAPI_NormalToFace::normal(GeomShapePtr theFace, // Set length of normal vector to average radius of curvature Standard_Real radius = 0.0; - GeomLProp_SLProps aProperties (aSurf, pUV.X(), pUV.Y(), 2, Precision::Confusion()); + GeomLProp_SLProps aProperties(aSurf, pUV.X(), pUV.Y(), 2, + Precision::Confusion()); if (aProperties.IsCurvatureDefined()) { Standard_Real radius1 = Abs(aProperties.MinCurvature()); Standard_Real radius2 = Abs(aProperties.MaxCurvature()); @@ -229,12 +231,12 @@ bool GeomAlgoAPI_NormalToFace::normal(GeomShapePtr theFace, // consider the face orientation if (aFace.Orientation() == TopAbs_REVERSED || aFace.Orientation() == TopAbs_INTERNAL) { - V = - V; + V = -V; } // Edge gp_Pnt p2 = p1.Translated(V); - BRepBuilderAPI_MakeEdge aBuilder (p1, p2); + BRepBuilderAPI_MakeEdge aBuilder(p1, p2); if (!aBuilder.IsDone()) Standard_NullObject::Raise("Vector construction failed"); aShape = aBuilder.Shape(); @@ -243,4 +245,3 @@ bool GeomAlgoAPI_NormalToFace::normal(GeomShapePtr theFace, return true; } - diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.h b/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.h index 4178a12fb..7c067ce2d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NormalToFace.h @@ -14,33 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_NormalToFace_H_ #define GeomAlgoAPI_NormalToFace_H_ -#include #include #include +#include /**\class GeomAlgoAPI_NormalToFace * \ingroup DataAlgo * \brief Allows to create normal to face-shapes */ -class GeomAlgoAPI_NormalToFace -{ - public: +class GeomAlgoAPI_NormalToFace { +public: /// Get the normal to face-shapes /// \param theface the face /// \param thePoint the optional point /// \param theNormal the normal /// \param theError the error - GEOMALGOAPI_EXPORT static bool normal(GeomShapePtr theFace, - GeomShapePtr thePoint, - GeomEdgePtr theNormal, - std::string& theError); + GEOMALGOAPI_EXPORT static bool normal(GeomShapePtr theFace, + GeomShapePtr thePoint, + GeomEdgePtr theNormal, + std::string &theError); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp index f39936af2..3d0180139 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp @@ -14,37 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Offset.h" #include -#include #include +#include -#include #include +#include #include #include -GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomShapePtr& theShape, - const double theOffsetValue) -{ +GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomShapePtr &theShape, + const double theOffsetValue) { build(theShape, theOffsetValue); } -void GeomAlgoAPI_Offset::build(const GeomShapePtr& theShape, const double theOffsetValue) -{ - BRepOffsetAPI_MakeOffsetShape* anOffsetAlgo = new BRepOffsetAPI_MakeOffsetShape; +void GeomAlgoAPI_Offset::build(const GeomShapePtr &theShape, + const double theOffsetValue) { + BRepOffsetAPI_MakeOffsetShape *anOffsetAlgo = + new BRepOffsetAPI_MakeOffsetShape; anOffsetAlgo->PerformBySimple(theShape->impl(), theOffsetValue); setImpl(anOffsetAlgo); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); if (anOffsetAlgo->IsDone()) { - const TopoDS_Shape& aResult = anOffsetAlgo->Shape(); + const TopoDS_Shape &aResult = anOffsetAlgo->Shape(); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult)); setShape(aShape); @@ -53,21 +54,19 @@ void GeomAlgoAPI_Offset::build(const GeomShapePtr& theShape, const double theOff } void GeomAlgoAPI_Offset::generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes) -{ + ListOfShape &theNewShapes) { try { GeomAlgoAPI_MakeShape::generated(theOldShape, theNewShapes); - } catch(...) { + } catch (...) { // nothing is generated } } -GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomPlanePtr& thePlane, - const GeomShapePtr& theEdgeOrWire, +GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomPlanePtr &thePlane, + const GeomShapePtr &theEdgeOrWire, const double theOffsetValue, const GeomAlgoAPI_OffsetJoint theJoint, - const bool theIsApprox) -{ + const bool theIsApprox) { // 1. Make wire from edge, if need TopoDS_Wire aWire; TopoDS_Shape anEdgeOrWire = theEdgeOrWire->impl(); @@ -86,16 +85,17 @@ GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomPlanePtr& thePlane, return; // 2. Make invalid face to pass it in Offset algorithm - BRepBuilderAPI_MakeFace aFaceBuilder (thePlane->impl(), aWire); - const TopoDS_Face& aFace = aFaceBuilder.Face(); + BRepBuilderAPI_MakeFace aFaceBuilder(thePlane->impl(), aWire); + const TopoDS_Face &aFace = aFaceBuilder.Face(); // 3. Make Offset - BRepOffsetAPI_MakeOffset* aParal = new BRepOffsetAPI_MakeOffset; + BRepOffsetAPI_MakeOffset *aParal = new BRepOffsetAPI_MakeOffset; setImpl(aParal); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); // Joint type - GeomAbs_JoinType aJoin = GeomAbs_Arc; // default mode, corresponding to KeepDistance + GeomAbs_JoinType aJoin = + GeomAbs_Arc; // default mode, corresponding to KeepDistance if (theJoint == GeomAlgoAPI_OffsetJoint::Lines) aJoin = GeomAbs_Intersection; // for GeomAlgoAPI_OffsetJoint::Arcs do the same as for KeepDistance diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h index 452679c95..f6ecc206f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Offset_H_ @@ -30,7 +31,8 @@ class GeomAPI_Pln; /// \a KeepDistance Keep the distance from initial contour to the resulting one, /// creating contour from lines and arcs where it is needed /// \a Arcs On connection of straight edges, tangent arcs are created, -/// except the case of too short edges. Radius of arcs equals to the offset value. +/// except the case of too short edges. Radius of arcs equals to the offset +/// value. /// \a Lines No arcs is created on the connection of the resulting lines, /// adjacent lines are prolonged to the point of their intersection. enum class GeomAlgoAPI_OffsetJoint { KeepDistance, Arcs, Lines }; @@ -38,11 +40,10 @@ enum class GeomAlgoAPI_OffsetJoint { KeepDistance, Arcs, Lines }; /// \class GeomAlgoAPI_Offset /// \ingroup DataAlgo /// \brief Perform 3D offset for the shape -class GeomAlgoAPI_Offset : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Offset : public GeomAlgoAPI_MakeShape { public: /// \brief Construct offset. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Offset(const GeomShapePtr& theShape, + GEOMALGOAPI_EXPORT GeomAlgoAPI_Offset(const GeomShapePtr &theShape, const double theOffsetValue); /// \brief Perform the offset algorithm on the plane @@ -50,23 +51,24 @@ public: /// \param[in] theEdgesOrWire base shapes /// \param[in] theOffsetValue offset distance, it can be negative /// \param[in] theJointType type of joint of straight edges - GEOMALGOAPI_EXPORT GeomAlgoAPI_Offset - (const std::shared_ptr& thePlane, - const GeomShapePtr& theEdgeOrWire, - const double theOffsetValue, - const GeomAlgoAPI_OffsetJoint theJoint = GeomAlgoAPI_OffsetJoint::KeepDistance, - const bool theIsApprox = false); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Offset(const std::shared_ptr &thePlane, + const GeomShapePtr &theEdgeOrWire, + const double theOffsetValue, + const GeomAlgoAPI_OffsetJoint theJoint = + GeomAlgoAPI_OffsetJoint::KeepDistance, + const bool theIsApprox = false); /// \return the list of shapes generated from the shape \a theShape. /// \param[in] theOldShape base shape. - /// \param[out] theNewShapes shapes generated from \a theShape. Does not cleared! + /// \param[out] theNewShapes shapes generated from \a theShape. Does not + /// cleared! GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape, - ListOfShape& theNewShapes); - + ListOfShape &theNewShapes); private: /// \brief Perform offset operation - void build(const GeomShapePtr& theShape, const double theOffsetValue); + void build(const GeomShapePtr &theShape, const double theOffsetValue); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp index 6f689cf16..9cb8ddd1d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Partition.h" @@ -25,18 +26,18 @@ #include +#include #include #include -#include #include -#include - +#include //================================================================================================= -static bool isSubShape(const TopoDS_Shape& theShape, const TopoDS_Shape& theSubShape) -{ - for(TopExp_Explorer anExp(theShape, theSubShape.ShapeType()); anExp.More(); anExp.Next()) { - if(theSubShape.IsSame(anExp.Current())) { +static bool isSubShape(const TopoDS_Shape &theShape, + const TopoDS_Shape &theSubShape) { + for (TopExp_Explorer anExp(theShape, theSubShape.ShapeType()); anExp.More(); + anExp.Next()) { + if (theSubShape.IsSame(anExp.Current())) { return true; } } @@ -45,7 +46,8 @@ static bool isSubShape(const TopoDS_Shape& theShape, const TopoDS_Shape& theSubS } //================================================================================================= -void getHistorySupportedType(const TopoDS_Shape& theShape, TopTools_ListOfShape& theResult) { +void getHistorySupportedType(const TopoDS_Shape &theShape, + TopTools_ListOfShape &theResult) { if (BRepTools_History::IsSupportedType(theShape)) { theResult.Append(theShape); } else { @@ -56,41 +58,46 @@ void getHistorySupportedType(const TopoDS_Shape& theShape, TopTools_ListOfShape& } //================================================================================================= -// Operation is used for production of ordered sorting: generated/modified from the first argument -// must be located in hte result first, etc. THis is for the issue #2517 -static void sortCompound(TopoDS_Shape& theCompound, GEOMAlgo_Splitter* theOperation) -{ +// Operation is used for production of ordered sorting: generated/modified from +// the first argument must be located in hte result first, etc. THis is for the +// issue #2517 +static void sortCompound(TopoDS_Shape &theCompound, + GEOMAlgo_Splitter *theOperation) { TopoDS_Compound aResCompound; TopoDS_Builder aBuilder; aBuilder.MakeCompound(aResCompound); - TopTools_MapOfShape anAlreadyThere; // to avoid duplications if it was produced by two arguments + TopTools_MapOfShape anAlreadyThere; // to avoid duplications if it was + // produced by two arguments // flag to add to result also results which were not produced by any argument bool aNotProduced = true; TopTools_ListOfShape::Iterator anArgs(theOperation->Arguments()); - while(aNotProduced || anArgs.More()) { + while (aNotProduced || anArgs.More()) { // collect shapes that were produced from the current argument TopTools_MapOfShape aProducedByArg; if (anArgs.More()) { TopTools_ListOfShape allArgs; getHistorySupportedType(anArgs.Value(), allArgs); - for (TopTools_ListOfShape::Iterator argsIter(allArgs); argsIter.More(); argsIter.Next()) { + for (TopTools_ListOfShape::Iterator argsIter(allArgs); argsIter.More(); + argsIter.Next()) { // if argument was not modified, it is fully in the result aProducedByArg.Add(argsIter.Value()); - const TopTools_ListOfShape& aModified = theOperation->Modified(argsIter.Value()); - for (TopTools_ListOfShape::Iterator aModIter(aModified); aModIter.More(); aModIter.Next()) { + const TopTools_ListOfShape &aModified = + theOperation->Modified(argsIter.Value()); + for (TopTools_ListOfShape::Iterator aModIter(aModified); + aModIter.More(); aModIter.Next()) { aProducedByArg.Add(aModIter.Value()); } - const TopTools_ListOfShape& aGenerated = theOperation->Generated(argsIter.Value()); - for (TopTools_ListOfShape::Iterator aGenIter(aGenerated); aGenIter.More(); aGenIter.Next()) - { + const TopTools_ListOfShape &aGenerated = + theOperation->Generated(argsIter.Value()); + for (TopTools_ListOfShape::Iterator aGenIter(aGenerated); + aGenIter.More(); aGenIter.Next()) { aProducedByArg.Add(aGenIter.Value()); } } anArgs.Next(); - } - else { + } else { aNotProduced = false; } @@ -100,25 +107,28 @@ static void sortCompound(TopoDS_Shape& theCompound, GEOMAlgo_Splitter* theOperat if (aNotProduced) { // collect all supported type-shapes of result TopTools_ListOfShape allRes; getHistorySupportedType(anIt.Value(), allRes); - for (TopTools_ListOfShape::Iterator aResIter(allRes); aResIter.More(); aResIter.Next()) { + for (TopTools_ListOfShape::Iterator aResIter(allRes); aResIter.More(); + aResIter.Next()) { if (aProducedByArg.Contains(aResIter.Value())) { aProducedContains = true; break; } } } - if ((!aNotProduced || aProducedContains) && anAlreadyThere.Add(anIt.Value())) { + if ((!aNotProduced || aProducedContains) && + anAlreadyThere.Add(anIt.Value())) { GeomShapePtr aSub(new GeomAPI_Shape); aSub->setImpl(new TopoDS_Shape(anIt.Value())); aCombiningShapes.push_back(aSub); } } - // sort sub-shapes of compound to stabilize the sequence of the Partition's results + // sort sub-shapes of compound to stabilize the sequence of the Partition's + // results GeomAlgoAPI_SortListOfShapes::sort(aCombiningShapes); for (ListOfShape::iterator anIt = aCombiningShapes.begin(); - anIt != aCombiningShapes.end(); ++anIt) + anIt != aCombiningShapes.end(); ++anIt) aBuilder.Add(aResCompound, (*anIt)->impl()); } @@ -126,23 +136,21 @@ static void sortCompound(TopoDS_Shape& theCompound, GEOMAlgo_Splitter* theOperat } //================================================================================================= -GeomAlgoAPI_Partition::GeomAlgoAPI_Partition(const ListOfShape& theObjects, - const ListOfShape& theTools, - const double theFuzzy) -{ +GeomAlgoAPI_Partition::GeomAlgoAPI_Partition(const ListOfShape &theObjects, + const ListOfShape &theTools, + const double theFuzzy) { build(theObjects, theTools, theFuzzy); } -static void prepareShapes(const TopoDS_Shape& theShape, - TopTools_ListOfShape& theSimpleList) -{ +static void prepareShapes(const TopoDS_Shape &theShape, + TopTools_ListOfShape &theSimpleList) { if (theShape.ShapeType() != TopAbs_COMPOUND) { - theSimpleList.Append(theShape); + theSimpleList.Append(theShape); return; } // explode compound on simple shapes to allow their intersections - TopoDS_Iterator It (theShape, Standard_True, Standard_True); + TopoDS_Iterator It(theShape, Standard_True, Standard_True); for (; It.More(); It.Next()) { TopoDS_Shape curSh = It.Value(); prepareShapes(curSh, theSimpleList); @@ -150,32 +158,29 @@ static void prepareShapes(const TopoDS_Shape& theShape, } //================================================================================================= -void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, - const ListOfShape& theTools, - const double theFuzzy) -{ +void GeomAlgoAPI_Partition::build(const ListOfShape &theObjects, + const ListOfShape &theTools, + const double theFuzzy) { if (theObjects.empty()) { return; } // Creating partition operation. - GEOMAlgo_Splitter* anOperation = new GEOMAlgo_Splitter; + GEOMAlgo_Splitter *anOperation = new GEOMAlgo_Splitter; this->setImpl(anOperation); this->setBuilderType(OCCT_BOPAlgo_Builder); TopTools_MapOfShape ShapesMap; // Getting objects. - for(ListOfShape::const_iterator anObjectsIt = theObjects.begin(); - anObjectsIt != theObjects.end(); - anObjectsIt++) - { - const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); + for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); + anObjectsIt != theObjects.end(); anObjectsIt++) { + const TopoDS_Shape &aShape = (*anObjectsIt)->impl(); // #2240: decompose compounds to get the valid result TopTools_ListOfShape aSimpleShapes; prepareShapes(aShape, aSimpleShapes); TopTools_ListIteratorOfListOfShape aSimpleIter(aSimpleShapes); for (; aSimpleIter.More(); aSimpleIter.Next()) { - const TopoDS_Shape& aSimpleSh = aSimpleIter.Value(); + const TopoDS_Shape &aSimpleSh = aSimpleIter.Value(); if (ShapesMap.Add(aSimpleSh)) { anOperation->AddArgument(aSimpleSh); } @@ -183,15 +188,15 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, } // Getting tools. - for (ListOfShape::const_iterator - aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { - const TopoDS_Shape& aShape = (*aToolsIt)->impl(); + for (ListOfShape::const_iterator aToolsIt = theTools.begin(); + aToolsIt != theTools.end(); aToolsIt++) { + const TopoDS_Shape &aShape = (*aToolsIt)->impl(); // #2419: decompose compounds to get the valid result TopTools_ListOfShape aSimpleShapes; prepareShapes(aShape, aSimpleShapes); TopTools_ListIteratorOfListOfShape aSimpleIter(aSimpleShapes); for (; aSimpleIter.More(); aSimpleIter.Next()) { - const TopoDS_Shape& aSimpleSh = aSimpleIter.Value(); + const TopoDS_Shape &aSimpleSh = aSimpleIter.Value(); if (ShapesMap.Add(aSimpleSh)) { anOperation->AddTool(aSimpleSh); } @@ -202,7 +207,8 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, Standard_Boolean bRunParallel = Standard_True; anOperation->SetRunParallel(bRunParallel); - if (theFuzzy > 0) anOperation->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) + anOperation->SetFuzzyValue(theFuzzy); // Building and getting result. anOperation->Perform(); @@ -210,17 +216,15 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, return; TopoDS_Shape aResult = anOperation->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { // Exclude faces and edges which are shared as another sub-shape. NCollection_Vector aFaces; NCollection_Vector anEdges; TopoDS_Compound aTempCompound; TopoDS_Builder aBuilder; aBuilder.MakeCompound(aTempCompound); - for(TopoDS_Iterator anIt(aResult); - anIt.More(); - anIt.Next()) { - const TopoDS_Shape& aSubShape = anIt.Value(); + for (TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { + const TopoDS_Shape &aSubShape = anIt.Value(); if (aSubShape.ShapeType() == TopAbs_FACE) { aFaces.Append(aSubShape); } else if (aSubShape.ShapeType() == TopAbs_EDGE) { @@ -230,24 +234,18 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, } } - for (NCollection_Vector::Iterator anIt(aFaces); - anIt.More(); - anIt.Next()) - { - const TopoDS_Shape& aSubShape = anIt.Value(); - if (!isSubShape(aTempCompound, aSubShape)) - { + for (NCollection_Vector::Iterator anIt(aFaces); anIt.More(); + anIt.Next()) { + const TopoDS_Shape &aSubShape = anIt.Value(); + if (!isSubShape(aTempCompound, aSubShape)) { aBuilder.Add(aTempCompound, aSubShape); } } - for (NCollection_Vector::Iterator anIt(anEdges); - anIt.More(); - anIt.Next()) - { - const TopoDS_Shape& aSubShape = anIt.Value(); - if (!isSubShape(aTempCompound, aSubShape)) - { + for (NCollection_Vector::Iterator anIt(anEdges); anIt.More(); + anIt.Next()) { + const TopoDS_Shape &aSubShape = anIt.Value(); + if (!isSubShape(aTempCompound, aSubShape)) { aBuilder.Add(aTempCompound, aSubShape); } } @@ -255,17 +253,18 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, aResult = aTempCompound; } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { // sort sub-shapes of compound before creation of a compsolid sortCompound(aResult, anOperation); std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aResult)); - aResult = GeomAlgoAPI_ShapeTools::groupSharedTopology(aGeomShape)->impl(); + aResult = GeomAlgoAPI_ShapeTools::groupSharedTopology(aGeomShape) + ->impl(); } // Setting result. - if(aResult.IsNull()) { + if (aResult.IsNull()) { return; } std::shared_ptr aShape(new GeomAPI_Shape()); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.h b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.h index 72d336056..41bc05bd1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Partition_H_ @@ -28,23 +29,22 @@ /// \class GeomAlgoAPI_Partition /// \ingroup DataAlgo /// \brief Allows to perform of partition operations -class GeomAlgoAPI_Partition : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Partition : public GeomAlgoAPI_MakeShape { public: /// Constructor. /// \param[in] theObjects list of main objects. /// \param[in] theTools list of tools. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is below the minimum tolerance value (1.e-7), the - /// algorithm will use the default internal fuzzy value from OCCT. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Partition(const ListOfShape& theObjects, - const ListOfShape& theTools, + /// If the fuzzy value is below the minimum tolerance value + /// (1.e-7), the algorithm will use the default internal fuzzy + /// value from OCCT. + GEOMALGOAPI_EXPORT GeomAlgoAPI_Partition(const ListOfShape &theObjects, + const ListOfShape &theTools, const double theFuzzy = 1.e-8); private: /// Builds resulting shape. - void build(const ListOfShape& theObjects, - const ListOfShape& theTools, + void build(const ListOfShape &theObjects, const ListOfShape &theTools, const double theFuzzy); }; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp index daa83b8ae..27c82ac2d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_PaveFiller.h" @@ -27,28 +28,24 @@ #include #include - //================================================================================================= -GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape, - const bool theIsMakeCompSolids, - const double theFuzzy) -{ +GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller( + const ListOfShape &theListOfShape, const bool theIsMakeCompSolids, + const double theFuzzy) { build(theListOfShape, theIsMakeCompSolids, theFuzzy); } - //================================================================================================= -void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, +void GeomAlgoAPI_PaveFiller::build(const ListOfShape &theListOfShape, const bool theIsMakeCompSolids, - const double theFuzzy) -{ - BOPAlgo_PaveFiller* aPaveFiller = new BOPAlgo_PaveFiller; + const double theFuzzy) { + BOPAlgo_PaveFiller *aPaveFiller = new BOPAlgo_PaveFiller; TopTools_ListOfShape aListOfShape; - for(ListOfShape::const_iterator - anIt = theListOfShape.cbegin(); anIt != theListOfShape.cend(); anIt++) { - const TopoDS_Shape& aShape = (*anIt)->impl(); - if(aShape.ShapeType() == TopAbs_COMPOUND) { - for(TopoDS_Iterator anIter(aShape); anIter.More(); anIter.Next()) { + for (ListOfShape::const_iterator anIt = theListOfShape.cbegin(); + anIt != theListOfShape.cend(); anIt++) { + const TopoDS_Shape &aShape = (*anIt)->impl(); + if (aShape.ShapeType() == TopAbs_COMPOUND) { + for (TopoDS_Iterator anIter(aShape); anIter.More(); anIter.Next()) { aListOfShape.Append(anIter.Value()); } } else { @@ -56,31 +53,32 @@ void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, } } aPaveFiller->SetArguments(aListOfShape); - if (theFuzzy > 0) aPaveFiller->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) + aPaveFiller->SetFuzzyValue(theFuzzy); aPaveFiller->Perform(); if (aPaveFiller->HasErrors()) return; - BOPAlgo_Builder* aBuilder = new BOPAlgo_Builder(); + BOPAlgo_Builder *aBuilder = new BOPAlgo_Builder(); this->setImpl(aBuilder); this->setBuilderType(OCCT_BOPAlgo_Builder); aBuilder->SetArguments(aListOfShape); - if (theFuzzy > 0) aBuilder->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) + aBuilder->SetFuzzyValue(theFuzzy); aBuilder->PerformWithFiller(*aPaveFiller); if (aBuilder->HasErrors()) return; TopoDS_Shape aResult = aBuilder->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } - if(theIsMakeCompSolids && aResult.ShapeType() == TopAbs_COMPOUND) { + if (theIsMakeCompSolids && aResult.ShapeType() == TopAbs_COMPOUND) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aResult)); ListOfShape aResults; - aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, - GeomAPI_Shape::COMPSOLID, - aResults); + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes( + aGeomShape, GeomAPI_Shape::COMPSOLID, aResults); aResult = aGeomShape->impl(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h index b1ad8e78b..bb81fac7d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_PaveFiller_H_ @@ -29,22 +30,24 @@ /// \ingroup DataAlgo /// \brief Finds the common parts from the list of shapes and /// breaks it to shapes with shared subshapes. -class GeomAlgoAPI_PaveFiller : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_PaveFiller : public GeomAlgoAPI_MakeShape { public: /// \brief Constructor. /// \param[in] theListOfShape list of shape which should be splitted. - /// \param[in] theIsMakeCompSolids if true gather shapes with shared faces to compsolids. - /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is below the minimum tolerance value (1.e-7), the - /// algorithm will use the default internal fuzzy value from OCCT. - GEOMALGOAPI_EXPORT GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape, - const bool theIsMakeCompSolids = false, - const double theFuzzy = 1.e-8); + /// \param[in] theIsMakeCompSolids if true gather shapes with shared faces to + /// compsolids. \param[in] theFuzzy additional tolerance value. + /// If the fuzzy value is below the minimum tolerance value + /// (1.e-7), the algorithm will use the default internal fuzzy + /// value from OCCT. + GEOMALGOAPI_EXPORT + GeomAlgoAPI_PaveFiller(const ListOfShape &theListOfShape, + const bool theIsMakeCompSolids = false, + const double theFuzzy = 1.e-8); private: /// Builds resulting shape. - void build(const ListOfShape& theListOfShape, const bool theIsMakeCompSolids, const double theFuzzy); + void build(const ListOfShape &theListOfShape, const bool theIsMakeCompSolids, + const double theFuzzy); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp index c9cb7b671..33a26d35e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Pipe.h" @@ -26,77 +27,71 @@ #include #include -#include +#include +#include #include #include #include -#include -#include +#include #include #include -#include #include +#include #include #include #include #include -#include +#include -static bool getBase(TopoDS_Shape& theBaseOut, - TopAbs_ShapeEnum& theBaseTypeOut, +static bool getBase(TopoDS_Shape &theBaseOut, TopAbs_ShapeEnum &theBaseTypeOut, const GeomShapePtr theBaseShape); -static bool getPath(TopoDS_Wire& thePathOut, - const GeomShapePtr thePathShape); -static gp_Trsf getPathToBaseTranslation(const TopoDS_Shape& theBase, - const TopoDS_Shape& thePath); -static bool buildPipe(BRepOffsetAPI_MakePipeShell* thePipeBuilder); -static ListOfShape getListFromShape(const TopoDS_Shape& theShape); +static bool getPath(TopoDS_Wire &thePathOut, const GeomShapePtr thePathShape); +static gp_Trsf getPathToBaseTranslation(const TopoDS_Shape &theBase, + const TopoDS_Shape &thePath); +static bool buildPipe(BRepOffsetAPI_MakePipeShell *thePipeBuilder); +static ListOfShape getListFromShape(const TopoDS_Shape &theShape); //================================================================================================== GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape, - const GeomShapePtr thePathShape) -{ + const GeomShapePtr thePathShape) { build(theBaseShape, thePathShape); } //================================================================================================== GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape, const GeomShapePtr thePathShape, - const GeomShapePtr theBiNormal) -{ + const GeomShapePtr theBiNormal) { build(theBaseShape, thePathShape, theBiNormal); } //================================================================================================== -GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const ListOfShape& theBaseShapes, - const ListOfShape& theLocations, - const GeomShapePtr thePathShape) -{ +GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const ListOfShape &theBaseShapes, + const ListOfShape &theLocations, + const GeomShapePtr thePathShape) { build(theBaseShapes, theLocations, thePathShape); } //================================================================================================== void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, - const GeomShapePtr thePathShape) -{ + const GeomShapePtr thePathShape) { // Getting base shape. - if(!theBaseShape.get()) { + if (!theBaseShape.get()) { return; } TopoDS_Shape aBaseShape = theBaseShape->impl(); - if(aBaseShape.IsNull()) { + if (aBaseShape.IsNull()) { return; } TopAbs_ShapeEnum aBaseShapeType = aBaseShape.ShapeType(); - if(aBaseShapeType != TopAbs_VERTEX && aBaseShapeType != TopAbs_EDGE && - aBaseShapeType != TopAbs_WIRE && aBaseShapeType != TopAbs_FACE && - aBaseShapeType != TopAbs_SHELL && aBaseShapeType != TopAbs_COMPOUND) { + if (aBaseShapeType != TopAbs_VERTEX && aBaseShapeType != TopAbs_EDGE && + aBaseShapeType != TopAbs_WIRE && aBaseShapeType != TopAbs_FACE && + aBaseShapeType != TopAbs_SHELL && aBaseShapeType != TopAbs_COMPOUND) { return; } // Getting path. TopoDS_Wire aPathWire; - if(!getPath(aPathWire, thePathShape)) { + if (!getPath(aPathWire, thePathShape)) { return; } GeomShapePtr anOldPath(new GeomAPI_Shape), aNewPath(new GeomAPI_Shape); @@ -107,18 +102,16 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, addMovedPath(anOldPath, aNewPath); // Making pipe. - BRepOffsetAPI_MakePipe* aPipeBuilder = NULL; + BRepOffsetAPI_MakePipe *aPipeBuilder = NULL; try { aPipeBuilder = new BRepOffsetAPI_MakePipe(aPathWire, aBaseShape); - } - catch (...) { + } catch (...) { } // Checking result. bool isDone = false; static const Standard_Real TolPipeSurf = 5.e-4; - if (aPipeBuilder && - aPipeBuilder->IsDone() && + if (aPipeBuilder && aPipeBuilder->IsDone() && !aPipeBuilder->Shape().IsNull() && aPipeBuilder->ErrorOnSurface() <= TolPipeSurf) { // check result @@ -136,8 +129,8 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, delete aPipeBuilder; // Try to use Descrete Trihedron mode. - aPipeBuilder = new BRepOffsetAPI_MakePipe - (aPathWire, aBaseShape, GeomFill_IsDiscreteTrihedron, Standard_True); + aPipeBuilder = new BRepOffsetAPI_MakePipe( + aPathWire, aBaseShape, GeomFill_IsDiscreteTrihedron, Standard_True); if (!aPipeBuilder->IsDone() || aPipeBuilder->Shape().IsNull()) { myError = "Pipe algorithm has failed."; delete aPipeBuilder; @@ -175,58 +168,59 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, //================================================================================================== void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, const GeomShapePtr thePathShape, - const GeomShapePtr theBiNormal) -{ + const GeomShapePtr theBiNormal) { // Getting base shape and path. TopoDS_Shape aBaseShape; TopAbs_ShapeEnum aBaseShapeType; TopoDS_Wire aPathWire; if (!getBase(aBaseShape, aBaseShapeType, theBaseShape) || - !getPath(aPathWire, thePathShape) || - !theBiNormal.get()) { + !getPath(aPathWire, thePathShape) || !theBiNormal.get()) { return; } GeomShapePtr anOldPath(new GeomAPI_Shape), aNewPath(new GeomAPI_Shape); anOldPath->setImpl(new TopoDS_Shape(aPathWire)); - aPathWire.Move(getPathToBaseTranslation(theBaseShape->impl(), aPathWire)); + aPathWire.Move( + getPathToBaseTranslation(theBaseShape->impl(), aPathWire)); aNewPath->setImpl(new TopoDS_Shape(aPathWire)); if (!anOldPath->isSame(aNewPath)) addMovedPath(anOldPath, aNewPath); // Getting Bi-Normal. TopoDS_Shape aBiNormalShape = theBiNormal->impl(); - if(aBiNormalShape.IsNull() || aBiNormalShape.ShapeType() != TopAbs_EDGE) { + if (aBiNormalShape.IsNull() || aBiNormalShape.ShapeType() != TopAbs_EDGE) { return; } TopoDS_Edge aBiNormalEdge = TopoDS::Edge(aBiNormalShape); Standard_Real aFirst, aLast; - Handle(Geom_Curve) aBiNormalCurve = BRep_Tool::Curve(aBiNormalEdge, aFirst, aLast); + Handle(Geom_Curve) aBiNormalCurve = + BRep_Tool::Curve(aBiNormalEdge, aFirst, aLast); Handle(Geom_Line) aBiNormalLine = Handle(Geom_Line)::DownCast(aBiNormalCurve); - if(aBiNormalLine.IsNull()) { + if (aBiNormalLine.IsNull()) { return; } gp_Dir aBiNormalDir = aBiNormalLine->Lin().Direction(); // Making pipe. - BRepOffsetAPI_MakePipeShell* aPipeBuilder = new BRepOffsetAPI_MakePipeShell(aPathWire); - if(!aPipeBuilder) { + BRepOffsetAPI_MakePipeShell *aPipeBuilder = + new BRepOffsetAPI_MakePipeShell(aPathWire); + if (!aPipeBuilder) { return; } aPipeBuilder->Add(aBaseShape); aPipeBuilder->SetMode(aBiNormalDir); - if(!buildPipe(aPipeBuilder)) { + if (!buildPipe(aPipeBuilder)) { delete aPipeBuilder; return; } this->initialize(aPipeBuilder); // Checking result. - if(aBaseShapeType == TopAbs_FACE && !aPipeBuilder->MakeSolid()) { + if (aBaseShapeType == TopAbs_FACE && !aPipeBuilder->MakeSolid()) { return; } TopoDS_Shape aResult = aPipeBuilder->Shape(); - if(aResult.IsNull()) { + if (aResult.IsNull()) { return; } @@ -243,12 +237,11 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, } //================================================================================================== -void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, - const ListOfShape& theLocations, - const GeomShapePtr thePathShape) -{ - if(theBaseShapes.empty() || - (!theLocations.empty() && theLocations.size() != theBaseShapes.size())) { +void GeomAlgoAPI_Pipe::build(const ListOfShape &theBaseShapes, + const ListOfShape &theLocations, + const GeomShapePtr thePathShape) { + if (theBaseShapes.empty() || + (!theLocations.empty() && theLocations.size() != theBaseShapes.size())) { return; } @@ -274,9 +267,7 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, // Get locations after moving path shape. std::list aLocations; for (ListOfShape::const_iterator aLocIt = theLocations.cbegin(); - aLocIt != theLocations.cend(); - ++aLocIt) - { + aLocIt != theLocations.cend(); ++aLocIt) { GeomShapePtr aLocation = *aLocIt; if (!aLocation.get() || aLocation->shapeType() != GeomAPI_Shape::VERTEX) { return; @@ -284,7 +275,8 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, TopoDS_Vertex aLocationVertex = aLocation->impl(); TopoDS_Vertex aMovedVertex; - for (TopExp_Explorer anExp(aPathWire, TopAbs_VERTEX); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aPathWire, TopAbs_VERTEX); anExp.More(); + anExp.Next()) { if (anExp.Current().IsPartner(aLocationVertex)) { aMovedVertex = TopoDS::Vertex(anExp.Current()); aLocations.push_back(aMovedVertex); @@ -305,26 +297,26 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, // Making pipe. Standard_Boolean isDone = Standard_False; bool anIsSolidNeeded = false; - BRepOffsetAPI_MakePipeShell* aPipeBuilder; - for(int i = 0; i < 2; ++i) { + BRepOffsetAPI_MakePipeShell *aPipeBuilder; + for (int i = 0; i < 2; ++i) { aPipeBuilder = new BRepOffsetAPI_MakePipeShell(aPathWire); - if(!aPipeBuilder) { + if (!aPipeBuilder) { return; } ListOfShape::const_iterator aBaseIt = theBaseShapes.cbegin(); std::list::const_iterator aLocationsIt = aLocations.cbegin(); - while(aBaseIt != theBaseShapes.cend()) { + while (aBaseIt != theBaseShapes.cend()) { GeomShapePtr aBase = *aBaseIt; - if(!getBase(aBaseShape, aBaseShapeType, aBase)) { + if (!getBase(aBaseShape, aBaseShapeType, aBase)) { delete aPipeBuilder; return; } ++aBaseIt; - if(aBaseShapeType == TopAbs_FACE) { + if (aBaseShapeType == TopAbs_FACE) { anIsSolidNeeded = true; } - if(aHasLocations) { + if (aHasLocations) { aPipeBuilder->Add(aBaseShape, *aLocationsIt); ++aLocationsIt; } else { @@ -332,13 +324,13 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, } } - if(aPipeBuilder->IsReady() == Standard_False) { + if (aPipeBuilder->IsReady() == Standard_False) { delete aPipeBuilder; return; } if (i == 1) { - // Try to use Descrete Trihedron mode. + // Try to use Descrete Trihedron mode. aPipeBuilder->SetDiscreteMode(); } aPipeBuilder->Build(); @@ -358,7 +350,7 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, this->initialize(aPipeBuilder); // Checking result. - if(anIsSolidNeeded && !aPipeBuilder->MakeSolid()) { + if (anIsSolidNeeded && !aPipeBuilder->MakeSolid()) { return; } TopoDS_Shape aResult = aPipeBuilder->Shape(); @@ -373,7 +365,7 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, this->addToShape(aToShape); // Setting result. - if(aResult.IsNull()) { + if (aResult.IsNull()) { return; } aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); @@ -385,8 +377,7 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, //================================================================================================== void GeomAlgoAPI_Pipe::generated(const GeomShapePtr theShape, - ListOfShape& theHistory) -{ + ListOfShape &theHistory) { if (myMovedPath.isBound(theShape)) GeomAlgoAPI_MakeShape::generated(myMovedPath.find(theShape), theHistory); else @@ -395,26 +386,24 @@ void GeomAlgoAPI_Pipe::generated(const GeomShapePtr theShape, // Auxilary functions: //================================================================================================== -bool getBase(TopoDS_Shape& theBaseOut, - TopAbs_ShapeEnum& theBaseTypeOut, - const GeomShapePtr theBaseShape) -{ - if(!theBaseShape.get()) { +bool getBase(TopoDS_Shape &theBaseOut, TopAbs_ShapeEnum &theBaseTypeOut, + const GeomShapePtr theBaseShape) { + if (!theBaseShape.get()) { return false; } theBaseOut = theBaseShape->impl(); - if(theBaseOut.IsNull()) { + if (theBaseOut.IsNull()) { return false; } theBaseTypeOut = theBaseOut.ShapeType(); - if(theBaseTypeOut == TopAbs_VERTEX) { + if (theBaseTypeOut == TopAbs_VERTEX) { // Do nothing. - } else if(theBaseTypeOut == TopAbs_EDGE) { + } else if (theBaseTypeOut == TopAbs_EDGE) { theBaseOut = BRepBuilderAPI_MakeWire(TopoDS::Edge(theBaseOut)).Shape(); - } else if(theBaseTypeOut == TopAbs_WIRE) { + } else if (theBaseTypeOut == TopAbs_WIRE) { // Do nothing. - } else if(theBaseTypeOut == TopAbs_FACE) { + } else if (theBaseTypeOut == TopAbs_FACE) { TopExp_Explorer anExp(theBaseOut, TopAbs_WIRE); theBaseOut = anExp.Current(); } else { @@ -425,21 +414,20 @@ bool getBase(TopoDS_Shape& theBaseOut, } //================================================================================================== -bool getPath(TopoDS_Wire& thePathOut, const GeomShapePtr thePathShape) -{ - if(!thePathShape.get()) { +bool getPath(TopoDS_Wire &thePathOut, const GeomShapePtr thePathShape) { + if (!thePathShape.get()) { return false; } TopoDS_Shape aPathShape = thePathShape->impl(); - if(aPathShape.IsNull()) { + if (aPathShape.IsNull()) { return false; } TopAbs_ShapeEnum aPathShapeType = aPathShape.ShapeType(); - if(aPathShapeType == TopAbs_EDGE) { + if (aPathShapeType == TopAbs_EDGE) { TopoDS_Edge aPathEdge = TopoDS::Edge(aPathShape); thePathOut = BRepBuilderAPI_MakeWire(aPathEdge).Wire(); - } else if(aPathShapeType == TopAbs_WIRE) { + } else if (aPathShapeType == TopAbs_WIRE) { thePathOut = TopoDS::Wire(aPathShape); } else { return false; @@ -449,8 +437,8 @@ bool getPath(TopoDS_Wire& thePathOut, const GeomShapePtr thePathShape) } //================================================================================================== -gp_Trsf getPathToBaseTranslation(const TopoDS_Shape& theBase, const TopoDS_Shape& thePath) -{ +gp_Trsf getPathToBaseTranslation(const TopoDS_Shape &theBase, + const TopoDS_Shape &thePath) { gp_Trsf aTranslation; BRepExtrema_DistShapeShape aDist(theBase, thePath); @@ -474,7 +462,8 @@ gp_Trsf getPathToBaseTranslation(const TopoDS_Shape& theBase, const TopoDS_Shape double aDistToEnd = aPntBase.Distance(anEnd); double aMinDist = aPntBase.Distance(aPntPath); - static const double THE_THRESHOLD = 0.01; // threshold for distance ratio + static const double THE_THRESHOLD = + 0.01; // threshold for distance ratio double aDeltaStart = Abs(aDistToStart - aMinDist); double aDeltaEnd = Abs(aDistToEnd - aMinDist); if (aDeltaStart < THE_THRESHOLD * aDeltaEnd) @@ -492,8 +481,7 @@ gp_Trsf getPathToBaseTranslation(const TopoDS_Shape& theBase, const TopoDS_Shape } //================================================================================================== -bool buildPipe(BRepOffsetAPI_MakePipeShell* thePipeBuilder) -{ +bool buildPipe(BRepOffsetAPI_MakePipeShell *thePipeBuilder) { thePipeBuilder->Build(); Standard_Boolean isDone = thePipeBuilder->IsDone(); @@ -509,13 +497,13 @@ bool buildPipe(BRepOffsetAPI_MakePipeShell* thePipeBuilder) } //================================================================================================== -ListOfShape getListFromShape(const TopoDS_Shape& theShape) -{ +ListOfShape getListFromShape(const TopoDS_Shape &theShape) { ListOfShape aList; TopAbs_ShapeEnum aType = theShape.ShapeType(); - if(aType == TopAbs_WIRE || aType == TopAbs_SHELL || aType == TopAbs_COMPOUND) { - for(TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next()) { + if (aType == TopAbs_WIRE || aType == TopAbs_SHELL || + aType == TopAbs_COMPOUND) { + for (TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next()) { GeomShapePtr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(anIt.Value())); aList.push_back(aGeomShape); @@ -530,12 +518,12 @@ ListOfShape getListFromShape(const TopoDS_Shape& theShape) } //================================================================================================== -void GeomAlgoAPI_Pipe::addMovedPath(GeomShapePtr thePath, GeomShapePtr theMoved) -{ +void GeomAlgoAPI_Pipe::addMovedPath(GeomShapePtr thePath, + GeomShapePtr theMoved) { myMovedPath.clear(); GeomAPI_ShapeExplorer anOldExp(thePath, GeomAPI_Shape::EDGE); GeomAPI_ShapeExplorer aNewExp(theMoved, GeomAPI_Shape::EDGE); - for(; anOldExp.more(); anOldExp.next(), aNewExp.next()) { + for (; anOldExp.more(); anOldExp.next(), aNewExp.next()) { myMovedPath.bind(anOldExp.current(), aNewExp.current()); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h index c9b773599..7bbdc0dc0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Pipe_H_ @@ -34,9 +35,9 @@ /// Edge -> Face\n /// Wire -> Shell\n /// Face -> Solid -class GeomAlgoAPI_Pipe : public GeomAlgoAPI_MakeSweep -{ - GeomAPI_DataMapOfShapeShape myMovedPath; ///< map from initial path edges to the moved +class GeomAlgoAPI_Pipe : public GeomAlgoAPI_MakeSweep { + GeomAPI_DataMapOfShapeShape + myMovedPath; ///< map from initial path edges to the moved public: /// \brief Creates extrusion for the given shape along a path. /// \param[in] theBaseShape base shape(vertex, edge, wire of face). @@ -47,37 +48,34 @@ public: /// \brief Creates extrusion for the given shape along a path. /// \param[in] theBaseShape base shape(vertex, edge, wire of face). /// \param[in] thePathShape path shape(edge or wire). - /// \param[in] theBiNormal edge or wire to preserve the constant angle between the normal vector - /// to the base object and the BiNormal vector. + /// \param[in] theBiNormal edge or wire to preserve the constant angle between + /// the normal vector to the base object and the BiNormal vector. GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape, const GeomShapePtr thePathShape, const GeomShapePtr theBiNormal); /// \brief Creates extrusion for the given shape along a path. /// \param[in] theBaseShapes base shape(vertex, edge, wire of face). - /// \param[in] theLocations vertexes on the path. Should be empty or same size as theBaseShapes. - /// \param[in] thePathShape path shape(edge or wire). - /// to the base object and the BiNormal vector. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const ListOfShape& theBaseShapes, - const ListOfShape& theLocations, + /// \param[in] theLocations vertexes on the path. Should be empty or same size + /// as theBaseShapes. \param[in] thePathShape path shape(edge or wire). to the + /// base object and the BiNormal vector. + GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const ListOfShape &theBaseShapes, + const ListOfShape &theLocations, const GeomShapePtr thePathShape); /// \return the list of shapes generated from theShape. /// \param[in] theShape base shape. /// \param[out] theHistory generated shapes. GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theShape, - ListOfShape& theHistory); + ListOfShape &theHistory); private: - void build(const GeomShapePtr theBaseShape, - const GeomShapePtr thePathShape); + void build(const GeomShapePtr theBaseShape, const GeomShapePtr thePathShape); - void build(const GeomShapePtr theBaseShape, - const GeomShapePtr thePathShape, + void build(const GeomShapePtr theBaseShape, const GeomShapePtr thePathShape, const GeomShapePtr theBiNormal); - void build(const ListOfShape& theBaseShapes, - const ListOfShape& theLocations, + void build(const ListOfShape &theBaseShapes, const ListOfShape &theLocations, const GeomShapePtr thePathShape); /// keeps the information about the moved path shapes into myMovedPath field void addMovedPath(GeomShapePtr thePath, GeomShapePtr theMoved); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp index 4c297247b..e0c4c44c4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Placement.h" @@ -26,8 +27,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -35,39 +36,38 @@ #include #include #include -#include -#include #include #include +#include +#include -GeomAlgoAPI_Placement::GeomAlgoAPI_Placement(const std::shared_ptr theSourceSolid, - const std::shared_ptr theDestSolid, - const std::shared_ptr theSourceShape, - const std::shared_ptr theDestShape, - const bool theIsReverse, - const bool theIsCentering, - const bool theSimpleTransform) -{ +GeomAlgoAPI_Placement::GeomAlgoAPI_Placement( + const std::shared_ptr theSourceSolid, + const std::shared_ptr theDestSolid, + const std::shared_ptr theSourceShape, + const std::shared_ptr theDestShape, const bool theIsReverse, + const bool theIsCentering, const bool theSimpleTransform) { build(theSourceSolid, theDestSolid, theSourceShape, theDestShape, - theIsReverse, theIsCentering, theSimpleTransform); + theIsReverse, theIsCentering, theSimpleTransform); } -void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourceSolid, - const std::shared_ptr& theDestSolid, - const std::shared_ptr& theSourceShape, - const std::shared_ptr& theDestShape, - const bool theIsReverse, - const bool theIsCentering, - const bool theSimpleTransform) -{ +void GeomAlgoAPI_Placement::build( + const std::shared_ptr &theSourceSolid, + const std::shared_ptr &theDestSolid, + const std::shared_ptr &theSourceShape, + const std::shared_ptr &theDestShape, const bool theIsReverse, + const bool theIsCentering, const bool theSimpleTransform) { // Filling the parameters of the objects static const int aNbObjects = 2; - gp_Pnt aSrcDstPoints[aNbObjects]; // points on the selected objects (0 - source, 1 - destination) - gp_Vec aSrcDstNormals[aNbObjects]; // normal vectors, if planar faces are selected + gp_Pnt aSrcDstPoints[aNbObjects]; // points on the selected objects (0 - + // source, 1 - destination) + gp_Vec aSrcDstNormals[aNbObjects]; // normal vectors, if planar faces are + // selected gp_Vec aSrcDstDirections[aNbObjects]; // directions of linear edges bool hasNormal[aNbObjects]; bool hasDirection[aNbObjects]; - std::shared_ptr aShapes[aNbObjects] = {theSourceShape, theDestShape}; + std::shared_ptr aShapes[aNbObjects] = {theSourceShape, + theDestShape}; GProp_GProps aProps; static const double aPropEps = 1.e-4; @@ -92,12 +92,12 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc aSrcDstNormals[i].SetCoord(aDir->x(), aDir->y(), aDir->z()); if (!isCompound) { - BRepGProp::SurfaceProperties(aFace->impl(), aProps, aPropEps); + BRepGProp::SurfaceProperties(aFace->impl(), aProps, + aPropEps); gp_Pnt aLoc = aProps.CentreOfMass(); aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z()); } - } - else if (aShape->isEdge()) { + } else if (aShape->isEdge()) { std::shared_ptr anEdge(new GeomAPI_Edge(aShape)); std::shared_ptr aLine = anEdge->line(); std::shared_ptr aDir = aLine->direction(); @@ -106,24 +106,25 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc if (!isCompound) { std::shared_ptr aFirstPnt = anEdge->firstPoint(); std::shared_ptr aLastPnt = anEdge->lastPoint(); - std::shared_ptr aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz()) - ->multiplied(0.5); + std::shared_ptr aLoc = + aFirstPnt->xyz()->added(aLastPnt->xyz())->multiplied(0.5); aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z()); } - } - else if (aShape->isVertex()) { + } else if (aShape->isVertex()) { std::shared_ptr aVertex(new GeomAPI_Vertex(aShape)); std::shared_ptr aPnt = aVertex->point(); aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z()); } else // something goes wrong return; - hasNormal[i] = aSrcDstNormals[i].SquareMagnitude() >= Precision::SquareConfusion(); - hasDirection[i] = aSrcDstDirections[i].SquareMagnitude() >= Precision::SquareConfusion(); + hasNormal[i] = + aSrcDstNormals[i].SquareMagnitude() >= Precision::SquareConfusion(); + hasDirection[i] = + aSrcDstDirections[i].SquareMagnitude() >= Precision::SquareConfusion(); } // Initial shapes - const TopoDS_Shape& aSourceShape = theSourceSolid->impl(); - const TopoDS_Shape& aDestShape = theDestSolid->impl(); + const TopoDS_Shape &aSourceShape = theSourceSolid->impl(); + const TopoDS_Shape &aDestShape = theDestSolid->impl(); // Check the material of the solids to be on the correct side BRepClass3d_SolidClassifier aClassifier; static const double aTransStep = 10. * Precision::Confusion(); @@ -133,7 +134,7 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc aPoint.Translate(aSrcDstNormals[0] * aTransStep); aClassifier.Perform(aPoint, Precision::Confusion()); if ((aClassifier.State() == TopAbs_OUT && !theIsReverse) || - (aClassifier.State() == TopAbs_IN && theIsReverse)) + (aClassifier.State() == TopAbs_IN && theIsReverse)) aSrcDstNormals[0].Reverse(); } if (hasNormal[1]) { @@ -147,24 +148,26 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc // Calculate directions, which comply the normal, for vertices and edges if (!hasNormal[0] || !hasNormal[1]) { - if (hasNormal[0] || hasNormal[1]) { // plane with line or vertex + if (hasNormal[0] || hasNormal[1]) { // plane with line or vertex if (hasDirection[0] || hasDirection[1]) { // plane - line int anInd = hasDirection[0] ? 0 : 1; - gp_Vec aVec = aSrcDstNormals[1 - anInd].Crossed(aSrcDstDirections[anInd]); + gp_Vec aVec = + aSrcDstNormals[1 - anInd].Crossed(aSrcDstDirections[anInd]); if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // normal and direction are collinear aVec = aSrcDstNormals[1 - anInd].Crossed( - gp_Vec(aSrcDstPoints[1 - anInd], aSrcDstPoints[anInd])); + gp_Vec(aSrcDstPoints[1 - anInd], aSrcDstPoints[anInd])); if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // normal and points direction are collinear if (Abs(aSrcDstNormals[1 - anInd].Y()) >= Precision::Confusion() || - Abs(aSrcDstNormals[1 - anInd].Z()) >= Precision::Confusion()) + Abs(aSrcDstNormals[1 - anInd].Z()) >= Precision::Confusion()) aVec = gp::DX(); else aVec = gp::DY(); } } - aSrcDstNormals[anInd] = aSrcDstDirections[anInd].Crossed(aVec).Normalized(); + aSrcDstNormals[anInd] = + aSrcDstDirections[anInd].Crossed(aVec).Normalized(); } else { // plane - point int anInd = hasNormal[0] ? 1 : 0; aSrcDstNormals[anInd] = aSrcDstNormals[1 - anInd]; @@ -172,9 +175,12 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc } else { if (hasDirection[0] && hasDirection[1]) { // line - line gp_Vec aVec = aSrcDstDirections[0].Crossed(aSrcDstDirections[1]); - if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // lines are parallel - aVec = aSrcDstDirections[0].Crossed(gp_Vec(aSrcDstPoints[0], aSrcDstPoints[1])); - if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // lines are equal + if (aVec.SquareMagnitude() < + Precision::SquareConfusion()) { // lines are parallel + aVec = aSrcDstDirections[0].Crossed( + gp_Vec(aSrcDstPoints[0], aSrcDstPoints[1])); + if (aVec.SquareMagnitude() < + Precision::SquareConfusion()) { // lines are equal if (Abs(aSrcDstDirections[0].Y()) >= Precision::Confusion() || Abs(aSrcDstDirections[0].Z()) >= Precision::Confusion()) aVec = gp::DX(); @@ -186,7 +192,8 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc aSrcDstNormals[0].Normalize(); aSrcDstNormals[1] = aSrcDstDirections[1].Crossed(aVec); aSrcDstNormals[1].Normalize(); - if (aSrcDstDirections[0].Dot(aSrcDstDirections[1]) < -Precision::Confusion()) + if (aSrcDstDirections[0].Dot(aSrcDstDirections[1]) < + -Precision::Confusion()) aSrcDstNormals[1].Reverse(); } else if (!hasDirection[0] && !hasDirection[1]) { // point - point aSrcDstNormals[0] = gp_Vec(aSrcDstPoints[0], aSrcDstPoints[1]); @@ -196,14 +203,16 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc int anInd = hasDirection[0] ? 0 : 1; gp_Vec aVec(aSrcDstPoints[anInd], aSrcDstPoints[1 - anInd]); aVec.Cross(aSrcDstDirections[anInd]); - if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // point is on line + if (aVec.SquareMagnitude() < + Precision::SquareConfusion()) { // point is on line if (Abs(aSrcDstDirections[anInd].Y()) >= Precision::Confusion() || Abs(aSrcDstDirections[anInd].Z()) >= Precision::Confusion()) aVec = gp::DX(); else aVec = gp::DY(); } - aSrcDstNormals[anInd] = aSrcDstDirections[anInd].Crossed(aVec).Normalized(); + aSrcDstNormals[anInd] = + aSrcDstDirections[anInd].Crossed(aVec).Normalized(); aSrcDstNormals[1 - anInd] = aSrcDstNormals[anInd]; } } @@ -224,7 +233,7 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc gp_Vec aSrcLoc(aSrcDstPoints[0].XYZ()); gp_Vec aDstLoc(aSrcDstPoints[1].XYZ()); if (!theIsCentering) - aDstLoc = aSrcLoc + gp_Vec(aDstDir) * (aDstLoc-aSrcLoc).Dot(aDstDir); + aDstLoc = aSrcLoc + gp_Vec(aDstDir) * (aDstLoc - aSrcLoc).Dot(aDstDir); aSrcLoc.Transform(aTrsf); gp_Vec aTrans = aDstLoc - aSrcLoc; aTrsf.SetTransformation(aRot, aTrans); @@ -237,16 +246,18 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc aShape.reset(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult)); this->setShape(aShape); - this->setDone(true); // it is allways true for simple transformation generation - } else { // internal rebuild of the shape + this->setDone( + true); // it is allways true for simple transformation generation + } else { // internal rebuild of the shape // Transform the shape with copying it - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); - if(!aBuilder) { + BRepBuilderAPI_Transform *aBuilder = + new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); + if (!aBuilder) { return; } this->setImpl(aBuilder); this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - if(aBuilder->IsDone() != Standard_True) { + if (aBuilder->IsDone() != Standard_True) { return; } TopoDS_Shape aResult = aBuilder->Shape(); @@ -259,7 +270,6 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc } //================================================================================================= -std::shared_ptr GeomAlgoAPI_Placement::transformation() const -{ +std::shared_ptr GeomAlgoAPI_Placement::transformation() const { return myTrsf; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h index 27f3973bb..3f9815a24 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Placement_H_ @@ -28,44 +29,48 @@ /// \class GeomAlgoAPI_Placement /// \ingroup DataAlgo -/// \brief Creates the copied object which sub-element is placed on the given element -class GeomAlgoAPI_Placement : public GeomAlgoAPI_MakeShape -{ +/// \brief Creates the copied object which sub-element is placed on the given +/// element +class GeomAlgoAPI_Placement : public GeomAlgoAPI_MakeShape { public: - /// \brief Creates an object which is obtained from current object by transformation calculated - /// as a movement of the source object to be coincident with the destination object + /// \brief Creates an object which is obtained from current object by + /// transformation calculated + /// as a movement of the source object to be coincident with the + /// destination object /// \param[in] theSourceSolid a shape to be moved /// \param[in] theDestSolid invariant shape - /// \param[in] theSourceShape a shape on the solid to be made coincident with destination object - /// \param[in] theDestShape destination object - /// \param[in] theIsReverse indicates that the solid materials should be on the same side + /// \param[in] theSourceShape a shape on the solid to be made coincident with + /// destination object \param[in] theDestShape destination object + /// \param[in] theIsReverse indicates that the solid materials should be on + /// the same side /// against the destination plane /// \param[in] theIsCentering indicates the planes should be centered /// \param[in] theSimpleTransform makes just transformation of shape /// without changing of topology or geometry - GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(const std::shared_ptr theSourceSolid, - const std::shared_ptr theDestSolid, - const std::shared_ptr theSourceShape, - const std::shared_ptr theDestShape, - const bool theIsReverse = false, - const bool theIsCentering = false, - const bool theSimpleTransform = false); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Placement(const std::shared_ptr theSourceSolid, + const std::shared_ptr theDestSolid, + const std::shared_ptr theSourceShape, + const std::shared_ptr theDestShape, + const bool theIsReverse = false, + const bool theIsCentering = false, + const bool theSimpleTransform = false); /// Returns the simple transformation GEOMALGOAPI_EXPORT std::shared_ptr transformation() const; private: /// builds resulting shape - void build(const std::shared_ptr& theSourceSolid, - const std::shared_ptr& theDestSolid, - const std::shared_ptr& theSourceShape, - const std::shared_ptr& theDestShape, - const bool theIsReverse, - const bool theIsCentering, + void build(const std::shared_ptr &theSourceSolid, + const std::shared_ptr &theDestSolid, + const std::shared_ptr &theSourceShape, + const std::shared_ptr &theDestShape, + const bool theIsReverse, const bool theIsCentering, const bool theSimpleTransform); private: - std::shared_ptr myTrsf; ///< transformation of the shape in case theSimpleTransform + std::shared_ptr + myTrsf; ///< transformation of the shape in case theSimpleTransform }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp index 845e94236..3914bb524 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_PointBuilder.h" @@ -27,24 +28,23 @@ #include #include -#include #include +#include #include -#include -#include #include #include -#include -#include +#include +#include #include #include #include +#include +#include //================================================================================================== std::shared_ptr - GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr thePoint) -{ - const gp_Pnt& aPnt = thePoint->impl(); +GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr thePoint) { + const gp_Pnt &aPnt = thePoint->impl(); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); std::shared_ptr aRes(new GeomAPI_Vertex); @@ -53,10 +53,9 @@ std::shared_ptr } //================================================================================================== -std::shared_ptr GeomAlgoAPI_PointBuilder::vertex(const double theX, - const double theY, - const double theZ) -{ +std::shared_ptr +GeomAlgoAPI_PointBuilder::vertex(const double theX, const double theY, + const double theZ) { const gp_Pnt aPnt(theX, theY, theZ); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); @@ -66,14 +65,14 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertex(const double th } //================================================================================================== -std::shared_ptr - GeomAlgoAPI_PointBuilder::point(const std::shared_ptr theVertex) -{ +std::shared_ptr GeomAlgoAPI_PointBuilder::point( + const std::shared_ptr theVertex) { TopoDS_Shape aShape = theVertex->impl(); if ((!aShape.IsNull()) && (aShape.ShapeType() == TopAbs_VERTEX)) { TopoDS_Vertex aVertex = TopoDS::Vertex(aShape); gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); - std::shared_ptr aPnt(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); + std::shared_ptr aPnt( + new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); return aPnt; } return std::shared_ptr(); @@ -81,30 +80,27 @@ std::shared_ptr //================================================================================================== std::shared_ptr GeomAlgoAPI_PointBuilder::vertexOnEdge( - const std::shared_ptr theEdge, - const double theValue, - const bool theIsPercent, - const bool theIsReverse) -{ + const std::shared_ptr theEdge, const double theValue, + const bool theIsPercent, const bool theIsReverse) { std::shared_ptr aVertex; - if(!theEdge.get()) { + if (!theEdge.get()) { return aVertex; } double aValue = theValue; - if(theIsPercent) { + if (theIsPercent) { aValue = theEdge->length() / 100.0 * aValue; } - const TopoDS_Edge& anEdge = TopoDS::Edge(theEdge->impl()); + const TopoDS_Edge &anEdge = TopoDS::Edge(theEdge->impl()); Standard_Real aUFirst, aULast; Handle(Geom_Curve) anEdgeCurve = BRep_Tool::Curve(anEdge, aUFirst, aULast); - if(!anEdgeCurve.IsNull() ) { + if (!anEdgeCurve.IsNull()) { Handle(Geom_Curve) aReOrientedCurve = anEdgeCurve; - if(theIsReverse) { + if (theIsReverse) { aReOrientedCurve = anEdgeCurve->Reversed(); aUFirst = anEdgeCurve->ReversedParameter(aULast); } @@ -115,7 +111,7 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexOnEdge( Standard_Real aParam = anAbsPnt.Parameter(); gp_Pnt aPnt = anAdapCurve.Value(aParam); BRepBuilderAPI_MakeVertex aMkVertex(aPnt); - const TopoDS_Vertex& aShape = aMkVertex.Vertex(); + const TopoDS_Vertex &aShape = aMkVertex.Vertex(); aVertex.reset(new GeomAPI_Vertex()); aVertex->setImpl(new TopoDS_Vertex(aShape)); } @@ -125,9 +121,8 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexOnEdge( //================================================================================================== std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( - const std::shared_ptr theVertex, - const std::shared_ptr theEdge) -{ + const std::shared_ptr theVertex, + const std::shared_ptr theEdge) { std::shared_ptr aVertex; if (!theVertex.get() || !theEdge.get()) { @@ -139,7 +134,8 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl()); double aFirstOnCurve, aLastOnCurve; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve); if (aCurve.IsNull()) { return aVertex; @@ -149,7 +145,8 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( if (aProjection.NbPoints() != 0) { gp_Pnt aNearestPoint = aProjection.NearestPoint(); - aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z())); + aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), + aNearestPoint.Z())); } return aVertex; @@ -158,8 +155,7 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( //================================================================================================== std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( const std::shared_ptr theVertex, - const std::shared_ptr theFace) -{ + const std::shared_ptr theFace) { std::shared_ptr aVertex; if (theVertex.get() && theFace.get() && theFace->isPlanar()) { @@ -178,11 +174,11 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( //================================================================================================== std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByIntersection( const std::shared_ptr theEdge1, - const std::shared_ptr theEdge2) -{ + const std::shared_ptr theEdge2) { std::shared_ptr aVertex; - if (theEdge1.get() && theEdge2.get() && theEdge1->isLine() && theEdge2->isLine()) { + if (theEdge1.get() && theEdge2.get() && theEdge1->isLine() && + theEdge2->isLine()) { std::shared_ptr aLin1 = theEdge1->line(); std::shared_ptr aLin2 = theEdge2->line(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h index 53db01ac6..31810d596 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_PointBuilder_H_ @@ -32,55 +33,55 @@ class GeomAPI_Vertex; /// \class GeomAlgoAPI_PointBuilder /// \ingroup DataAlgo /// \brief Allows to create vertex-shapes by different parameters -class GEOMALGOAPI_EXPORT GeomAlgoAPI_PointBuilder -{ +class GEOMALGOAPI_EXPORT GeomAlgoAPI_PointBuilder { public: /// Creates a vertex by point - static std::shared_ptr vertex(const std::shared_ptr thePoint); + static std::shared_ptr + vertex(const std::shared_ptr thePoint); /// Creates a vertex by point coordinates - static std::shared_ptr vertex(const double theX, - const double theY, - const double theZ); + static std::shared_ptr + vertex(const double theX, const double theY, const double theZ); /// \brief Creates vertex by edge and distance on it. /// \param[in] theEdge edge. /// \param[in] theValue distance value. /// \param[in] theIsPercent if true theValue will be treated /// as a percentage of theEdge total length. - /// \param[in] theIsReverse if true the distance will be measured from the edge end point. - /// \return created vertex. - static std::shared_ptr vertexOnEdge(const std::shared_ptr theEdge, - const double theValue, - const bool theIsPercent = false, - const bool theIsReverse = false); + /// \param[in] theIsReverse if true the distance will be measured from the + /// edge end point. \return created vertex. + static std::shared_ptr + vertexOnEdge(const std::shared_ptr theEdge, + const double theValue, const bool theIsPercent = false, + const bool theIsReverse = false); /// \brief Creates vertex by projection another vertex on edge. /// \param[in] theVertex vertex to project. /// \param[in] theEdge edge for projection. /// \return created vertex. static std::shared_ptr - vertexByProjection(const std::shared_ptr theVertex, - const std::shared_ptr theEdge); + vertexByProjection(const std::shared_ptr theVertex, + const std::shared_ptr theEdge); /// \brief Creates vertex by projection another vertex on plane. /// \param[in] theVertex vertex to project. /// \param[in] theFace face for projection. Should be planar. /// \return created vertex. static std::shared_ptr - vertexByProjection(const std::shared_ptr theVertex, - const std::shared_ptr theFace); + vertexByProjection(const std::shared_ptr theVertex, + const std::shared_ptr theFace); /// \brief Creates vertex by intersection two coplanar lines. /// \param[in] theEdge1 first linear edge. /// \param[in] theEdge2 second linear edge. /// \return created vertex. static std::shared_ptr - vertexByIntersection(const std::shared_ptr theEdge1, - const std::shared_ptr theEdge2); + vertexByIntersection(const std::shared_ptr theEdge1, + const std::shared_ptr theEdge2); /// Return point by shape vertex - static std::shared_ptr point(const std::shared_ptr theVertex); + static std::shared_ptr + point(const std::shared_ptr theVertex); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp index ca7e2c36b..728a6d4d2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp @@ -14,177 +14,174 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_PointCloudOnFace.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 #include // code from KERNEL_SRC/src/Basics/Basics_OCCTVersion.hxx #ifdef OCC_VERSION_SERVICEPACK -# define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) +#define OCC_VERSION_LARGE \ + (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | \ + OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) #else -# ifdef OCC_VERSION_DEVELOPMENT -# define OCC_VERSION_LARGE ((OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8)-1) -# else -# define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8) -# endif +#ifdef OCC_VERSION_DEVELOPMENT +#define OCC_VERSION_LARGE \ + ((OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | \ + OCC_VERSION_MAINTENANCE << 8) - \ + 1) +#else +#define OCC_VERSION_LARGE \ + (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | \ + OCC_VERSION_MAINTENANCE << 8) +#endif #endif #include -Standard_Boolean comp(const std::pair& theA, - const std::pair& theB) -{ +Standard_Boolean comp(const std::pair &theA, + const std::pair &theB) { return (theA.second < theB.second); } -Standard_Boolean IsUiso (const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace) -{ - BRepAdaptor_Curve2d aBAcurve2d (theEdge, theFace); +Standard_Boolean IsUiso(const TopoDS_Edge &theEdge, + const TopoDS_Face &theFace) { + BRepAdaptor_Curve2d aBAcurve2d(theEdge, theFace); gp_Pnt2d aP2d; gp_Vec2d aVec; - aBAcurve2d.D1 (aBAcurve2d.FirstParameter(), aP2d, aVec); + aBAcurve2d.D1(aBAcurve2d.FirstParameter(), aP2d, aVec); return (Abs(aVec.Y()) > Abs(aVec.X())); } -void CorrectShell (const TopoDS_Shape& theShell, - const TopoDS_Face& theFace) -{ - BRepAdaptor_Surface aBAsurf (theFace, Standard_False); +void CorrectShell(const TopoDS_Shape &theShell, const TopoDS_Face &theFace) { + BRepAdaptor_Surface aBAsurf(theFace, Standard_False); GeomAbs_SurfaceType aType = aBAsurf.GetType(); - if (aType <= GeomAbs_Torus) //elementary surfaces + if (aType <= GeomAbs_Torus) // elementary surfaces return; TopLoc_Location anInputLoc; - const Handle(Geom_Surface)& anInputSurf = BRep_Tool::Surface (theFace, anInputLoc); + const Handle(Geom_Surface) &anInputSurf = + BRep_Tool::Surface(theFace, anInputLoc); BRep_Builder aBB; - TopoDS_Iterator anIter (theShell); - for (; anIter.More(); anIter.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (anIter.Value()); + TopoDS_Iterator anIter(theShell); + for (; anIter.More(); anIter.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(anIter.Value()); TopLoc_Location aLoc; - const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aLoc); + const Handle(Geom_Surface) &aSurf = BRep_Tool::Surface(aFace, aLoc); if (aSurf == anInputSurf) continue; - TopExp_Explorer anExplo (aFace, TopAbs_EDGE); - for (; anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); + TopExp_Explorer anExplo(aFace, TopAbs_EDGE); + for (; anExplo.More(); anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); Standard_Real aFirst, aLast; - Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (anEdge, aFace, aFirst, aLast); - aBB.UpdateEdge (anEdge, aPCurve, anInputSurf, anInputLoc, 0.); + Handle(Geom2d_Curve) aPCurve = + BRep_Tool::CurveOnSurface(anEdge, aFace, aFirst, aLast); + aBB.UpdateEdge(anEdge, aPCurve, anInputSurf, anInputLoc, 0.); } - Standard_Real aTol = BRep_Tool::Tolerance (aFace); - aBB.UpdateFace (aFace, anInputSurf, anInputLoc, aTol); + Standard_Real aTol = BRep_Tool::Tolerance(aFace); + aBB.UpdateFace(aFace, anInputSurf, anInputLoc, aTol); } } -gp_Pnt GetMidPnt2d(const TopoDS_Face& theFace, - const Standard_Boolean theIsNaturalRestrictions) -{ +gp_Pnt GetMidPnt2d(const TopoDS_Face &theFace, + const Standard_Boolean theIsNaturalRestrictions) { gp_Pnt aResPnt; - if (theIsNaturalRestrictions) - { - BRepAdaptor_Surface aBAsurf (theFace); + if (theIsNaturalRestrictions) { + BRepAdaptor_Surface aBAsurf(theFace); Standard_Real aUmin, aUmax, aVmin, aVmax; aUmin = aBAsurf.FirstUParameter(); aUmax = aBAsurf.LastUParameter(); aVmin = aBAsurf.FirstVParameter(); aVmax = aBAsurf.LastVParameter(); - aResPnt = aBAsurf.Value ((aUmin + aUmax)/2, (aVmin + aVmax)/2); - } - else - { + aResPnt = aBAsurf.Value((aUmin + aUmax) / 2, (aVmin + aVmax) / 2); + } else { const Standard_Integer aNbSamples = 4; - TopoDS_Wire aWire = BRepTools::OuterWire (theFace); + TopoDS_Wire aWire = BRepTools::OuterWire(theFace); TopTools_IndexedMapOfShape aEmap; - TopExp::MapShapes (aWire, TopAbs_EDGE, aEmap); + TopExp::MapShapes(aWire, TopAbs_EDGE, aEmap); Standard_Integer aNbPointsOnContour = aNbSamples * aEmap.Extent(); - TColgp_Array1OfPnt anArray (1, aNbPointsOnContour); + TColgp_Array1OfPnt anArray(1, aNbPointsOnContour); - BRepTools_WireExplorer aWexp (aWire, theFace); + BRepTools_WireExplorer aWexp(aWire, theFace); Standard_Integer anInd = 0; TopTools_MapOfShape aUsedEmap; - for (; aWexp.More(); aWexp.Next()) - { - const TopoDS_Edge& anEdge = aWexp.Current(); - if (!aUsedEmap.Add(anEdge)) continue; - BRepAdaptor_Curve2d aBAcurve2d (anEdge, theFace); - Standard_Real aDelta = (aBAcurve2d.LastParameter() - aBAcurve2d.FirstParameter())/aNbSamples; - for (Standard_Integer ii = 0; ii < aNbSamples; ii++) - { + for (; aWexp.More(); aWexp.Next()) { + const TopoDS_Edge &anEdge = aWexp.Current(); + if (!aUsedEmap.Add(anEdge)) + continue; + BRepAdaptor_Curve2d aBAcurve2d(anEdge, theFace); + Standard_Real aDelta = + (aBAcurve2d.LastParameter() - aBAcurve2d.FirstParameter()) / + aNbSamples; + for (Standard_Integer ii = 0; ii < aNbSamples; ii++) { Standard_Real aParam = aBAcurve2d.FirstParameter() + ii * aDelta; - gp_Pnt2d aP2d = aBAcurve2d.Value (aParam); - gp_Pnt aPnt (aP2d.X(), aP2d.Y(), 0.); - anArray (++anInd) = aPnt; + gp_Pnt2d aP2d = aBAcurve2d.Value(aParam); + gp_Pnt aPnt(aP2d.X(), aP2d.Y(), 0.); + anArray(++anInd) = aPnt; } } gp_Ax2 anAxis; Standard_Boolean anIsSingular; - GeomLib::AxeOfInertia (anArray, anAxis, anIsSingular); + GeomLib::AxeOfInertia(anArray, anAxis, anIsSingular); gp_Pnt aBaryCentre = anAxis.Location(); - gp_Pnt2d aCentre2d (aBaryCentre.X(), aBaryCentre.Y()); - BRepTopAdaptor_FClass2d aClassifier (theFace, Precision::Confusion()); - BRepAdaptor_Surface aBAsurf (theFace, Standard_False); + gp_Pnt2d aCentre2d(aBaryCentre.X(), aBaryCentre.Y()); + BRepTopAdaptor_FClass2d aClassifier(theFace, Precision::Confusion()); + BRepAdaptor_Surface aBAsurf(theFace, Standard_False); - TopAbs_State aStatus = aClassifier.Perform (aCentre2d); + TopAbs_State aStatus = aClassifier.Perform(aCentre2d); gp_Pnt2d aP2d = aCentre2d; Standard_Integer anIndVertex = 0; const Standard_Integer aNbIter = 10; - while (aStatus != TopAbs_IN && anIndVertex < aNbPointsOnContour) - { - gp_Pnt aVertexPnt = anArray (anIndVertex+1); - gp_Pnt2d aVertexP2d (aVertexPnt.X(), aVertexPnt.Y()); + while (aStatus != TopAbs_IN && anIndVertex < aNbPointsOnContour) { + gp_Pnt aVertexPnt = anArray(anIndVertex + 1); + gp_Pnt2d aVertexP2d(aVertexPnt.X(), aVertexPnt.Y()); TColgp_SequenceOfPnt2d aPseq; - aPseq.Append (aCentre2d); - aPseq.Append (aVertexP2d); - for (Standard_Integer ii = 1; ii <= aNbIter; ii++) - { - for (Standard_Integer jj = 1; jj < aPseq.Length(); jj++) - { - aP2d.SetXY ((aPseq(jj).XY() + aPseq(jj+1).XY())/2); - aStatus = aClassifier.Perform (aP2d); + aPseq.Append(aCentre2d); + aPseq.Append(aVertexP2d); + for (Standard_Integer ii = 1; ii <= aNbIter; ii++) { + for (Standard_Integer jj = 1; jj < aPseq.Length(); jj++) { + aP2d.SetXY((aPseq(jj).XY() + aPseq(jj + 1).XY()) / 2); + aStatus = aClassifier.Perform(aP2d); if (aStatus == TopAbs_IN) break; - else - { - aPseq.InsertAfter (jj, aP2d); + else { + aPseq.InsertAfter(jj, aP2d); jj++; } } @@ -193,47 +190,42 @@ gp_Pnt GetMidPnt2d(const TopoDS_Face& theFace, } anIndVertex += aNbSamples; } - aResPnt = aBAsurf.Value (aP2d.X(), aP2d.Y()); - } //case of complex boundaries + aResPnt = aBAsurf.Value(aP2d.X(), aP2d.Y()); + } // case of complex boundaries return aResPnt; } -void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, - const Standard_Real theAverageArea, - const Standard_Boolean theIsToAddFaces, - Standard_Integer& theNbExtremalFaces, - TopTools_MapOfShape& theExtremalFaces, - const std::vector> theFacesAndAreas, - const TopTools_DataMapOfShapeReal& theFaceAreaMap, - const TopTools_IndexedDataMapOfShapeListOfShape& theEFmap, - TopoDS_Shape& theRes, - TopoDS_Shape& theGlobalRes, - TopTools_MapOfShape& theRemovedFaces) -{ - BRepAdaptor_Surface aBAsurf (theInputFace, Standard_False); +void ModifyFacesForGlobalResult( + const TopoDS_Face &theInputFace, const Standard_Real theAverageArea, + const Standard_Boolean theIsToAddFaces, + Standard_Integer &theNbExtremalFaces, TopTools_MapOfShape &theExtremalFaces, + const std::vector> theFacesAndAreas, + const TopTools_DataMapOfShapeReal &theFaceAreaMap, + const TopTools_IndexedDataMapOfShapeListOfShape &theEFmap, + TopoDS_Shape &theRes, TopoDS_Shape &theGlobalRes, + TopTools_MapOfShape &theRemovedFaces) { + BRepAdaptor_Surface aBAsurf(theInputFace, Standard_False); GeomAbs_SurfaceType aType = aBAsurf.GetType(); BRep_Builder aBB; - const Standard_Integer aNbFaces = (Standard_Integer) theFacesAndAreas.size(); + const Standard_Integer aNbFaces = (Standard_Integer)theFacesAndAreas.size(); const Standard_Integer aDiff = theNbExtremalFaces - theRemovedFaces.Extent(); Standard_Integer aSum = 0; - while (aSum < aDiff) //global loop + while (aSum < aDiff) // global loop { Standard_Integer aNbFacesDone = 0, aNbFacesInTape = 0; TopoDS_Face aStartFace; - Standard_Integer aStartIndex = (theIsToAddFaces)? aNbFaces-1 : 0; - Standard_Integer anEndIndex = (theIsToAddFaces)? 0 : aNbFaces-1; - Standard_Integer aStep = (theIsToAddFaces)? -1 : 1; + Standard_Integer aStartIndex = (theIsToAddFaces) ? aNbFaces - 1 : 0; + Standard_Integer anEndIndex = (theIsToAddFaces) ? 0 : aNbFaces - 1; + Standard_Integer aStep = (theIsToAddFaces) ? -1 : 1; - for (Standard_Integer ii = aStartIndex; ii != anEndIndex; ii += aStep) - { - const TopoDS_Face& aFace = TopoDS::Face (theFacesAndAreas[ii].first); - if (!theRemovedFaces.Contains(aFace)) - { + for (Standard_Integer ii = aStartIndex; ii != anEndIndex; ii += aStep) { + const TopoDS_Face &aFace = TopoDS::Face(theFacesAndAreas[ii].first); + if (!theRemovedFaces.Contains(aFace)) { aStartFace = aFace; break; } @@ -241,87 +233,84 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, if (aStartFace.IsNull()) break; - theRemovedFaces.Add (aStartFace); + theRemovedFaces.Add(aStartFace); TopoDS_Edge aCommonEdge; TopoDS_Face aNextFace; - Standard_Real anExtremalArea = (theIsToAddFaces)? 0. : Precision::Infinite(); - for (TopExp_Explorer anExplo(aStartFace, TopAbs_EDGE); anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - const TopTools_ListOfShape& aFaceList = theEFmap.FindFromKey (anEdge); - TopTools_ListIteratorOfListOfShape anItl (aFaceList); - for (; anItl.More(); anItl.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (anItl.Value()); - if (aFace.IsSame (aStartFace) || - theRemovedFaces.Contains(aFace)) + Standard_Real anExtremalArea = + (theIsToAddFaces) ? 0. : Precision::Infinite(); + for (TopExp_Explorer anExplo(aStartFace, TopAbs_EDGE); anExplo.More(); + anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + const TopTools_ListOfShape &aFaceList = theEFmap.FindFromKey(anEdge); + TopTools_ListIteratorOfListOfShape anItl(aFaceList); + for (; anItl.More(); anItl.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(anItl.Value()); + if (aFace.IsSame(aStartFace) || theRemovedFaces.Contains(aFace)) continue; Standard_Real anArea = theFaceAreaMap(aFace); - Standard_Boolean anIsToExchange = (theIsToAddFaces)? (anArea > anExtremalArea) : (anArea < anExtremalArea); - if (anIsToExchange) - { + Standard_Boolean anIsToExchange = (theIsToAddFaces) + ? (anArea > anExtremalArea) + : (anArea < anExtremalArea); + if (anIsToExchange) { anExtremalArea = anArea; aCommonEdge = anEdge; aNextFace = aFace; } } } - if (aCommonEdge.IsNull()) //all adjacent faces are already removed + if (aCommonEdge.IsNull()) // all adjacent faces are already removed { - theExtremalFaces.Add (theFacesAndAreas[theNbExtremalFaces].first); + theExtremalFaces.Add(theFacesAndAreas[theNbExtremalFaces].first); theNbExtremalFaces++; continue; } - //Start filling the shell - aBB.Remove (theRes, aStartFace); + // Start filling the shell + aBB.Remove(theRes, aStartFace); aNbFacesDone++; TopoDS_Shell aShell; - aBB.MakeShell (aShell); + aBB.MakeShell(aShell); Standard_Real anAreaOfTape = 0.; - aBB.Add (aShell, aStartFace); + aBB.Add(aShell, aStartFace); aNbFacesInTape++; - anAreaOfTape += theFaceAreaMap (aStartFace); + anAreaOfTape += theFaceAreaMap(aStartFace); - Standard_Boolean anIsUiso = IsUiso (aCommonEdge, aStartFace); - //Find another faces on this level + Standard_Boolean anIsUiso = IsUiso(aCommonEdge, aStartFace); + // Find another faces on this level TopoDS_Face aCurrentFace = aNextFace; TopoDS_Edge aCurrentEdge = aCommonEdge; Standard_Boolean anIsFirstDirection = Standard_True; - aBB.Remove (theRes, aCurrentFace); - theRemovedFaces.Add (aCurrentFace); - if (theExtremalFaces.Contains (aCurrentFace)) - { + aBB.Remove(theRes, aCurrentFace); + theRemovedFaces.Add(aCurrentFace); + if (theExtremalFaces.Contains(aCurrentFace)) { aNbFacesDone++; } - aBB.Add (aShell, aCurrentFace); + aBB.Add(aShell, aCurrentFace); aNbFacesInTape++; - anAreaOfTape += theFaceAreaMap (aCurrentFace); + anAreaOfTape += theFaceAreaMap(aCurrentFace); Standard_Boolean anIsRound = Standard_False; - for (;;) //local loop + for (;;) // local loop { TopoDS_Edge aNextEdge; - for (TopExp_Explorer anExplo(aCurrentFace, TopAbs_EDGE); anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - if (anEdge.IsSame (aCurrentEdge)) + for (TopExp_Explorer anExplo(aCurrentFace, TopAbs_EDGE); anExplo.More(); + anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + if (anEdge.IsSame(aCurrentEdge)) continue; - const TopTools_ListOfShape& aFaceList = theEFmap.FindFromKey (anEdge); - TopTools_ListIteratorOfListOfShape anItl (aFaceList); - for (; anItl.More(); anItl.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (anItl.Value()); - if (aFace.IsSame (aCurrentFace)) + const TopTools_ListOfShape &aFaceList = theEFmap.FindFromKey(anEdge); + TopTools_ListIteratorOfListOfShape anItl(aFaceList); + for (; anItl.More(); anItl.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(anItl.Value()); + if (aFace.IsSame(aCurrentFace)) continue; - if (aFace.IsSame (aStartFace)) - { + if (aFace.IsSame(aStartFace)) { anIsRound = Standard_True; if (aType > GeomAbs_Torus) { // non-elementary surfaces // remove last face to prevent close tape creation // it is a workaround for Tulip bos #26791 // as there is a problem with closed tape on some surface types - aBB.Remove (aShell, aCurrentFace); + aBB.Remove(aShell, aCurrentFace); aNbFacesInTape--; anAreaOfTape -= theFaceAreaMap(aCurrentFace); aBB.Add(theRes, aCurrentFace); // aaajfa ??? @@ -334,8 +323,7 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, } if (theRemovedFaces.Contains(aFace)) continue; - if (anIsUiso == IsUiso (anEdge, aFace)) - { + if (anIsUiso == IsUiso(anEdge, aFace)) { aNextEdge = anEdge; aNextFace = aFace; break; @@ -344,121 +332,110 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, if (anIsRound || !aNextEdge.IsNull()) break; } - if (anIsRound) //round tape: returned to start face + if (anIsRound) // round tape: returned to start face break; - if (aNextEdge.IsNull()) - { - if (anIsFirstDirection) - { + if (aNextEdge.IsNull()) { + if (anIsFirstDirection) { aCurrentFace = aStartFace; aCurrentEdge = aCommonEdge; anIsFirstDirection = Standard_False; continue; - } - else + } else break; } - aBB.Add (aShell, aNextFace); + aBB.Add(aShell, aNextFace); aNbFacesInTape++; - anAreaOfTape += theFaceAreaMap (aNextFace); - aBB.Remove (theRes, aNextFace); - theRemovedFaces.Add (aNextFace); - if (theExtremalFaces.Contains (aNextFace)) - { + anAreaOfTape += theFaceAreaMap(aNextFace); + aBB.Remove(theRes, aNextFace); + theRemovedFaces.Add(aNextFace); + if (theExtremalFaces.Contains(aNextFace)) { aNbFacesDone++; } aCurrentEdge = aNextEdge; aNextEdge.Nullify(); aCurrentFace = aNextFace; - } //end of local loop - - //Tape is formed - Standard_Integer aNumberToSplit = (theIsToAddFaces)? aNbFacesInTape + aNbFacesDone : aNbFacesInTape - aNbFacesDone; - if (!theIsToAddFaces && aNbFacesDone > 1) - { - Standard_Integer aRealNumberToSplit = (aNumberToSplit > 0)? aNumberToSplit : 1; + } // end of local loop + + // Tape is formed + Standard_Integer aNumberToSplit = (theIsToAddFaces) + ? aNbFacesInTape + aNbFacesDone + : aNbFacesInTape - aNbFacesDone; + if (!theIsToAddFaces && aNbFacesDone > 1) { + Standard_Integer aRealNumberToSplit = + (aNumberToSplit > 0) ? aNumberToSplit : 1; Standard_Real anAverageAreaInTape = anAreaOfTape / aRealNumberToSplit; - if (anAverageAreaInTape > theAverageArea) - { - Standard_Integer aNewNumberToSplit = RealToInt(round(anAreaOfTape / theAverageArea)); - if (aNewNumberToSplit < aNbFacesInTape) - { - Standard_Integer aNumberToIncrease = aNewNumberToSplit - aNumberToSplit; + if (anAverageAreaInTape > theAverageArea) { + Standard_Integer aNewNumberToSplit = + RealToInt(round(anAreaOfTape / theAverageArea)); + if (aNewNumberToSplit < aNbFacesInTape) { + Standard_Integer aNumberToIncrease = + aNewNumberToSplit - aNumberToSplit; for (Standard_Integer jj = theNbExtremalFaces; jj < theNbExtremalFaces + aNumberToIncrease && jj < aNbFaces; jj++) - theExtremalFaces.Add (theFacesAndAreas[jj].first); + theExtremalFaces.Add(theFacesAndAreas[jj].first); theNbExtremalFaces += aNumberToIncrease; aNumberToSplit = aNewNumberToSplit; } } } - if (anIsRound && aNumberToSplit <= 1) - { + if (anIsRound && aNumberToSplit <= 1) { Standard_Integer aNumberToIncrease = 3 - aNumberToSplit; for (Standard_Integer jj = theNbExtremalFaces; - jj < theNbExtremalFaces + aNumberToIncrease && jj < aNbFaces; - jj++) - theExtremalFaces.Add (theFacesAndAreas[jj].first); + jj < theNbExtremalFaces + aNumberToIncrease && jj < aNbFaces; jj++) + theExtremalFaces.Add(theFacesAndAreas[jj].first); theNbExtremalFaces += aNumberToIncrease; aNumberToSplit = 3; } - CorrectShell (aShell, theInputFace); + CorrectShell(aShell, theInputFace); ShapeUpgrade_UnifySameDomain aUnifier; - aUnifier.Initialize (aShell, Standard_True, Standard_True); + aUnifier.Initialize(aShell, Standard_True, Standard_True); aUnifier.Build(); TopoDS_Shape aUnifiedShape = aUnifier.Shape(); - //Splitting + // Splitting TopoDS_Shape aLocalResult = aUnifiedShape; Standard_Integer aNbFacesInLocalResult = 1; - if (aNumberToSplit > 1) - { + if (aNumberToSplit > 1) { #if OCC_VERSION_LARGE < 0x07050304 aNbFacesInLocalResult = 1; #else - ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape); - aLocalTool.SetSplittingByNumber (Standard_True); + ShapeUpgrade_ShapeDivideArea aLocalTool(aUnifiedShape); + aLocalTool.SetSplittingByNumber(Standard_True); aLocalTool.MaxArea() = -1; if (anIsUiso) - aLocalTool.SetNumbersUVSplits (aNumberToSplit, 1); + aLocalTool.SetNumbersUVSplits(aNumberToSplit, 1); else - aLocalTool.SetNumbersUVSplits (1, aNumberToSplit); + aLocalTool.SetNumbersUVSplits(1, aNumberToSplit); aLocalTool.Perform(); aLocalResult = aLocalTool.Result(); aNbFacesInLocalResult = aNumberToSplit; #endif - } - else - { - if (aNumberToSplit == 0) - { + } else { + if (aNumberToSplit == 0) { if (theNbExtremalFaces < aNbFaces) { - theExtremalFaces.Add (theFacesAndAreas[theNbExtremalFaces].first); + theExtremalFaces.Add(theFacesAndAreas[theNbExtremalFaces].first); theNbExtremalFaces++; } } } - aBB.Add (theGlobalRes, aLocalResult); + aBB.Add(theGlobalRes, aLocalResult); aSum += Abs(aNbFacesInTape - aNbFacesInLocalResult); - } //end of global loop + } // end of global loop - //Second global loop + // Second global loop TopoDS_Compound aSecondComp; - aBB.MakeCompound (aSecondComp); - while (aSum < aDiff) - { + aBB.MakeCompound(aSecondComp); + while (aSum < aDiff) { TopoDS_Shape aMaxShell; Standard_Integer aMaxNbFaces = 0; - TopoDS_Iterator anIter (theGlobalRes); - for (; anIter.More(); anIter.Next()) - { - const TopoDS_Shape& aShell = anIter.Value(); + TopoDS_Iterator anIter(theGlobalRes); + for (; anIter.More(); anIter.Next()) { + const TopoDS_Shape &aShell = anIter.Value(); TopTools_IndexedMapOfShape aFaceMap; - TopExp::MapShapes (aShell, TopAbs_FACE, aFaceMap); - if (aFaceMap.Extent() > aMaxNbFaces) - { + TopExp::MapShapes(aShell, TopAbs_FACE, aFaceMap); + if (aFaceMap.Extent() > aMaxNbFaces) { aMaxNbFaces = aFaceMap.Extent(); aMaxShell = aShell; } @@ -467,64 +444,62 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, if (aMaxNbFaces == 1) break; - aBB.Remove (theGlobalRes, aMaxShell); - //Find iso + aBB.Remove(theGlobalRes, aMaxShell); + // Find iso Standard_Boolean anIsUiso = Standard_True; TopTools_IndexedDataMapOfShapeListOfShape aLocalEFmap; - TopExp::MapShapesAndAncestors (aMaxShell, TopAbs_EDGE, TopAbs_FACE, aLocalEFmap); - for (Standard_Integer jj = 1; jj <= aLocalEFmap.Extent(); jj++) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (aLocalEFmap.FindKey(jj)); - const TopTools_ListOfShape& aFaceList = aLocalEFmap(jj); - if (aFaceList.Extent() == 2) - { - const TopoDS_Face& aFace = TopoDS::Face (aFaceList.First()); - anIsUiso = IsUiso (anEdge, aFace); + TopExp::MapShapesAndAncestors(aMaxShell, TopAbs_EDGE, TopAbs_FACE, + aLocalEFmap); + for (Standard_Integer jj = 1; jj <= aLocalEFmap.Extent(); jj++) { + const TopoDS_Edge &anEdge = TopoDS::Edge(aLocalEFmap.FindKey(jj)); + const TopTools_ListOfShape &aFaceList = aLocalEFmap(jj); + if (aFaceList.Extent() == 2) { + const TopoDS_Face &aFace = TopoDS::Face(aFaceList.First()); + anIsUiso = IsUiso(anEdge, aFace); break; } } - CorrectShell (aMaxShell, theInputFace); + CorrectShell(aMaxShell, theInputFace); ShapeUpgrade_UnifySameDomain aUnifier; - aUnifier.Initialize (aMaxShell, Standard_True, Standard_True); + aUnifier.Initialize(aMaxShell, Standard_True, Standard_True); aUnifier.Build(); TopoDS_Shape aUnifiedShape = aUnifier.Shape(); TopoDS_Shape aLocalResult = aUnifiedShape; - Standard_Integer aNumberToSplit = (theIsToAddFaces)? aMaxNbFaces + (aDiff-aSum) : aMaxNbFaces - (aDiff-aSum); - if (aNumberToSplit > 1) - { + Standard_Integer aNumberToSplit = (theIsToAddFaces) + ? aMaxNbFaces + (aDiff - aSum) + : aMaxNbFaces - (aDiff - aSum); + if (aNumberToSplit > 1) { #if OCC_VERSION_LARGE < 0x07050304 aNumberToSplit = 1; #else - ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape); - aLocalTool.SetSplittingByNumber (Standard_True); + ShapeUpgrade_ShapeDivideArea aLocalTool(aUnifiedShape); + aLocalTool.SetSplittingByNumber(Standard_True); aLocalTool.MaxArea() = -1; if (anIsUiso) - aLocalTool.SetNumbersUVSplits (aNumberToSplit, 1); + aLocalTool.SetNumbersUVSplits(aNumberToSplit, 1); else - aLocalTool.SetNumbersUVSplits (1, aNumberToSplit); + aLocalTool.SetNumbersUVSplits(1, aNumberToSplit); aLocalTool.Perform(); aLocalResult = aLocalTool.Result(); #endif - } - else + } else aNumberToSplit = 1; - aBB.Add (aSecondComp, aLocalResult); + aBB.Add(aSecondComp, aLocalResult); if (theIsToAddFaces) break; aSum += aMaxNbFaces - aNumberToSplit; } - aBB.Add (theGlobalRes, aSecondComp); + aBB.Add(theGlobalRes, aSecondComp); } //================================================================================================= bool GeomAlgoAPI_PointCloudOnFace::PointCloud(GeomShapePtr theFace, - const int theNumberOfPoints, + const int theNumberOfPoints, GeomShapePtr thePoints, - std::string& theError) -{ + std::string &theError) { #ifdef _DEBUG std::cout << "GeomAlgoAPI_PointCloudOnFace::PointCloud" << std::endl; #endif @@ -546,150 +521,138 @@ bool GeomAlgoAPI_PointCloudOnFace::PointCloud(GeomShapePtr theFace, return false; } - TopoDS_Face anInputFace = TopoDS::Face (anInputShape); + TopoDS_Face anInputFace = TopoDS::Face(anInputShape); - ShapeUpgrade_ShapeDivideArea tool (anInputFace); - tool.SetSplittingByNumber (Standard_True); + ShapeUpgrade_ShapeDivideArea tool(anInputFace); + tool.SetSplittingByNumber(Standard_True); tool.NbParts() = theNumberOfPoints; tool.Perform(); TopoDS_Shape res = tool.Result(); BRep_Builder aBB; TopoDS_Compound aGlobalRes; - aBB.MakeCompound (aGlobalRes); + aBB.MakeCompound(aGlobalRes); TopTools_IndexedMapOfShape aFaceMap; - TopExp::MapShapes (res, TopAbs_FACE, aFaceMap); + TopExp::MapShapes(res, TopAbs_FACE, aFaceMap); Standard_Integer aNbFaces = aFaceMap.Extent(); TopTools_IndexedDataMapOfShapeListOfShape aEFmap; - TopExp::MapShapesAndAncestors (res, TopAbs_EDGE, TopAbs_FACE, aEFmap); + TopExp::MapShapesAndAncestors(res, TopAbs_EDGE, TopAbs_FACE, aEFmap); TopTools_MapOfShape aBiggestFaces, aSmallestFaces; Standard_Boolean aUseTriangulation = Standard_True; Standard_Boolean aSkipShared = Standard_False; - if (aNbFaces != theNumberOfPoints) - { + if (aNbFaces != theNumberOfPoints) { Standard_Real aTotalArea = 0.; - std::vector> aFacesAndAreas (aNbFaces); - for (Standard_Integer ii = 1; ii <= aNbFaces; ii++) - { + std::vector> aFacesAndAreas( + aNbFaces); + for (Standard_Integer ii = 1; ii <= aNbFaces; ii++) { GProp_GProps aProps; - BRepGProp::SurfaceProperties (aFaceMap(ii), aProps, aSkipShared, aUseTriangulation); + BRepGProp::SurfaceProperties(aFaceMap(ii), aProps, aSkipShared, + aUseTriangulation); Standard_Real anArea = aProps.Mass(); aTotalArea += anArea; - std::pair aFaceWithArea (aFaceMap(ii), anArea); - aFacesAndAreas[ii-1] = aFaceWithArea; + std::pair aFaceWithArea(aFaceMap(ii), + anArea); + aFacesAndAreas[ii - 1] = aFaceWithArea; } - std::sort (aFacesAndAreas.begin(), aFacesAndAreas.end(), comp); + std::sort(aFacesAndAreas.begin(), aFacesAndAreas.end(), comp); Standard_Real anAverageArea = aTotalArea / theNumberOfPoints; TopTools_DataMapOfShapeReal aFaceAreaMap; for (Standard_Integer ii = 0; ii < aNbFaces; ii++) - aFaceAreaMap.Bind (aFacesAndAreas[ii].first, aFacesAndAreas[ii].second); + aFaceAreaMap.Bind(aFacesAndAreas[ii].first, aFacesAndAreas[ii].second); TopTools_MapOfShape aRemovedFaces; - if (aNbFaces < theNumberOfPoints) - { + if (aNbFaces < theNumberOfPoints) { Standard_Integer aNbMissingFaces = theNumberOfPoints - aNbFaces; - for (Standard_Integer ii = aNbFaces-1; ii > aNbFaces - aNbMissingFaces - 1; ii--) - aBiggestFaces.Add (aFacesAndAreas[ii].first); - - ModifyFacesForGlobalResult (anInputFace, anAverageArea, - Standard_True, //to add faces - aNbMissingFaces, aBiggestFaces, - aFacesAndAreas, aFaceAreaMap, aEFmap, - res, aGlobalRes, - aRemovedFaces); - } - else //aNbFaces > theNumberOfPoints + for (Standard_Integer ii = aNbFaces - 1; + ii > aNbFaces - aNbMissingFaces - 1; ii--) + aBiggestFaces.Add(aFacesAndAreas[ii].first); + + ModifyFacesForGlobalResult(anInputFace, anAverageArea, + Standard_True, // to add faces + aNbMissingFaces, aBiggestFaces, aFacesAndAreas, + aFaceAreaMap, aEFmap, res, aGlobalRes, + aRemovedFaces); + } else // aNbFaces > theNumberOfPoints { Standard_Integer aNbExcessFaces = aNbFaces - theNumberOfPoints; for (Standard_Integer ii = 0; ii < aNbExcessFaces; ii++) - aSmallestFaces.Add (aFacesAndAreas[ii].first); + aSmallestFaces.Add(aFacesAndAreas[ii].first); TopTools_IndexedDataMapOfShapeListOfShape aVFmap; - TopExp::MapShapesAndAncestors (res, TopAbs_VERTEX, TopAbs_FACE, aVFmap); + TopExp::MapShapesAndAncestors(res, TopAbs_VERTEX, TopAbs_FACE, aVFmap); - //Remove smallest faces with free boundaries - for (Standard_Integer ii = 0; ii < aNbExcessFaces; ii++) - { - const TopoDS_Face& aFace = TopoDS::Face (aFacesAndAreas[ii].first); + // Remove smallest faces with free boundaries + for (Standard_Integer ii = 0; ii < aNbExcessFaces; ii++) { + const TopoDS_Face &aFace = TopoDS::Face(aFacesAndAreas[ii].first); Standard_Boolean anIsFreeBoundFound = Standard_False; - TopExp_Explorer anExplo (aFace, TopAbs_EDGE); - for (; anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - if (!BRep_Tool::Degenerated (anEdge) && - aEFmap.FindFromKey(anEdge).Extent() < 2) - { + TopExp_Explorer anExplo(aFace, TopAbs_EDGE); + for (; anExplo.More(); anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + if (!BRep_Tool::Degenerated(anEdge) && + aEFmap.FindFromKey(anEdge).Extent() < 2) { anIsFreeBoundFound = Standard_True; break; } } - if (anIsFreeBoundFound) - { + if (anIsFreeBoundFound) { Standard_Real aMaxArea = 0.; - for (anExplo.Init(aFace, TopAbs_VERTEX); anExplo.More(); anExplo.Next()) - { - const TopoDS_Shape& aVertex = anExplo.Current(); - const TopTools_ListOfShape& aFaceList = aVFmap.FindFromKey (aVertex); - TopTools_ListIteratorOfListOfShape anItl (aFaceList); - for (; anItl.More(); anItl.Next()) - { - Standard_Real anArea = aFaceAreaMap (anItl.Value()); + for (anExplo.Init(aFace, TopAbs_VERTEX); anExplo.More(); + anExplo.Next()) { + const TopoDS_Shape &aVertex = anExplo.Current(); + const TopTools_ListOfShape &aFaceList = aVFmap.FindFromKey(aVertex); + TopTools_ListIteratorOfListOfShape anItl(aFaceList); + for (; anItl.More(); anItl.Next()) { + Standard_Real anArea = aFaceAreaMap(anItl.Value()); if (anArea > aMaxArea) aMaxArea = anArea; } } - Standard_Real anArreaOfSmallestFace = aFaceAreaMap (aFace); - if (anArreaOfSmallestFace < aMaxArea / 16) - { - aBB.Remove (res, aFace); - aRemovedFaces.Add (aFace); + Standard_Real anArreaOfSmallestFace = aFaceAreaMap(aFace); + if (anArreaOfSmallestFace < aMaxArea / 16) { + aBB.Remove(res, aFace); + aRemovedFaces.Add(aFace); } } } - ModifyFacesForGlobalResult (anInputFace, anAverageArea, - Standard_False, //to decrease number of faces - aNbExcessFaces, aSmallestFaces, - aFacesAndAreas, aFaceAreaMap, aEFmap, - res, aGlobalRes, - aRemovedFaces); + ModifyFacesForGlobalResult(anInputFace, anAverageArea, + Standard_False, // to decrease number of faces + aNbExcessFaces, aSmallestFaces, aFacesAndAreas, + aFaceAreaMap, aEFmap, res, aGlobalRes, + aRemovedFaces); } } - aBB.Add (aGlobalRes, res); + aBB.Add(aGlobalRes, res); int iface = 1; TopoDS_Compound aCompound; - aBB.MakeCompound (aCompound); + aBB.MakeCompound(aCompound); for (TopExp_Explorer aGlobalExplo(aGlobalRes, TopAbs_FACE); aGlobalExplo.More(), iface <= theNumberOfPoints; - aGlobalExplo.Next(), iface++) - { - const TopoDS_Face& aFace = TopoDS::Face (aGlobalExplo.Current()); + aGlobalExplo.Next(), iface++) { + const TopoDS_Face &aFace = TopoDS::Face(aGlobalExplo.Current()); Standard_Boolean anIsNaturalRestrictions = Standard_True; - TopExp_Explorer anExplo (aFace, TopAbs_EDGE); - for (; anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - if (BRep_Tool::Degenerated (anEdge)) + TopExp_Explorer anExplo(aFace, TopAbs_EDGE); + for (; anExplo.More(); anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + if (BRep_Tool::Degenerated(anEdge)) continue; - if (!aEFmap.Contains(anEdge) || - aEFmap.FindFromKey(anEdge).Extent() < 2) - { + if (!aEFmap.Contains(anEdge) || aEFmap.FindFromKey(anEdge).Extent() < 2) { anIsNaturalRestrictions = Standard_False; break; } } - gp_Pnt aPnt = GetMidPnt2d (aFace, anIsNaturalRestrictions); - TopoDS_Vertex aVertex = BRepLib_MakeVertex (aPnt); - aBB.Add (aCompound, aVertex); + gp_Pnt aPnt = GetMidPnt2d(aFace, anIsNaturalRestrictions); + TopoDS_Vertex aVertex = BRepLib_MakeVertex(aPnt); + aBB.Add(aCompound, aVertex); } thePoints->setImpl(new TopoDS_Shape(aCompound)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.h b/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.h index 28318ab31..aef9caf9b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.h @@ -14,31 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_PointCloudOnFace_H_ #define GeomAlgoAPI_PointCloudOnFace_H_ -#include #include +#include /**\class GeomAlgoAPI_PointCloudOnFace * \ingroup DataAlgo * \brief Allows to create a cloud of points on face */ -class GeomAlgoAPI_PointCloudOnFace -{ - public: +class GeomAlgoAPI_PointCloudOnFace { +public: /// Get the set of points on face /// \param theFace the face /// \param thePoints the compound of vertices /// \param theError the error - GEOMALGOAPI_EXPORT static bool PointCloud(GeomShapePtr theFace, - const int theNumberOfPoints, - GeomShapePtr thePoints, - std::string& theError); + GEOMALGOAPI_EXPORT static bool PointCloud(GeomShapePtr theFace, + const int theNumberOfPoints, + GeomShapePtr thePoints, + std::string &theError); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index cad3f8a65..817d156e1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Prism.h" @@ -35,75 +36,74 @@ #include #include -#include -#include #include #include #include #include -#include -#include -#include #include #include +#include +#include +#include +#include +#include #include #include -#include #include #include #include #include +#include #include #include #include #include -#include - +#include /// Expand planar face to cover the bounding box if theOriginalShape is planar. /// Otherwise, return the same shape; -static GeomShapePtr buildPlanarFace(const GeomShapePtr& theOriginalShape, - const Bnd_Box& theBaseShapeBB); +static GeomShapePtr buildPlanarFace(const GeomShapePtr &theOriginalShape, + const Bnd_Box &theBaseShapeBB); /// Build offset for the given shape. /// If the offset algorithm failed, translate the shape along the direction. -static GeomShapePtr buildOffset(const GeomShapePtr& theShape, +static GeomShapePtr buildOffset(const GeomShapePtr &theShape, const double theOffset, const GeomDirPtr theDirection, - GeomAlgoAPI_MakeShapeList& theMakeShapeList); + GeomAlgoAPI_MakeShapeList &theMakeShapeList); /// Collect base faces of the prism. -static void collectPrismBases(const TopoDS_Shape& theBaseShape, - BRepPrimAPI_MakePrism& thePrismAlgo, - ListOfShape& theBoundaries, +static void collectPrismBases(const TopoDS_Shape &theBaseShape, + BRepPrimAPI_MakePrism &thePrismAlgo, + ListOfShape &theBoundaries, const GeomAPI_Shape::ShapeType theTypeToExp); -/// Collect all solids which contain boundaries but do not contain bases of prism. -static GeomShapePtr collectResults(const GeomMakeShapePtr& theOperation, - const ListOfShape& theBoundaries, - const ListOfShape& theShapesToExclude, +/// Collect all solids which contain boundaries but do not contain bases of +/// prism. +static GeomShapePtr collectResults(const GeomMakeShapePtr &theOperation, + const ListOfShape &theBoundaries, + const ListOfShape &theShapesToExclude, const GeomAPI_Shape::ShapeType theTypeToExp); -static void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo, - const TopoDS_Shape& theBase, +static void storeGenerationHistory(GeomAlgoAPI_Prism *thePrismAlgo, + const TopoDS_Shape &theBase, const TopAbs_ShapeEnum theType, - BRepPrimAPI_MakePrism* thePrismBuilder); + BRepPrimAPI_MakePrism *thePrismBuilder); -static void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo, - const TopoDS_Shape& theResult, +static void storeGenerationHistory(GeomAlgoAPI_Prism *thePrismAlgo, + const TopoDS_Shape &theResult, const TopAbs_ShapeEnum theType, - const TopoDS_Face& theToFace, - const TopoDS_Face& theFromFace); + const TopoDS_Face &theToFace, + const TopoDS_Face &theFromFace); -static GeomShapePtr toShape(const TopoDS_Shape& theShape) -{ +static GeomShapePtr toShape(const TopoDS_Shape &theShape) { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(theShape)); return aShape; } -static void changeOrientationIfNeeded(const TopoDS_Shape& theShape, gp_Vec& theNormal) -{ +static void changeOrientationIfNeeded(const TopoDS_Shape &theShape, + gp_Vec &theNormal) { TopExp_Explorer anExp(theShape, TopAbs_VERTEX); gp_Pnt aPnt0 = BRep_Tool::Pnt(TopoDS::Vertex(anExp.Current())); gp_Dir aDir01; @@ -123,7 +123,8 @@ static void changeOrientationIfNeeded(const TopoDS_Shape& theShape, gp_Vec& theN break; } } - if (anExp.More() && aNormal.XYZ().Dot(theNormal.XYZ()) < -Precision::Confusion()) { + if (anExp.More() && + aNormal.XYZ().Dot(theNormal.XYZ()) < -Precision::Confusion()) { // directions differ, reverse the normal theNormal.Reverse(); } @@ -131,39 +132,38 @@ static void changeOrientationIfNeeded(const TopoDS_Shape& theShape, gp_Vec& theN //================================================================================================== GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, - const GeomDirPtr theDirection, + const GeomDirPtr theDirection, const GeomShapePtr theToShape, - const double theToSize, + const double theToSize, const GeomShapePtr theFromShape, - const double theFromSize) -{ - if(!theBaseShape.get() || - (((!theFromShape.get() && !theToShape.get()) || - (theFromShape.get() && theToShape.get() && theFromShape->isEqual(theToShape))) - && (theFromSize == -theToSize))) { + const double theFromSize) { + if (!theBaseShape.get() || (((!theFromShape.get() && !theToShape.get()) || + (theFromShape.get() && theToShape.get() && + theFromShape->isEqual(theToShape))) && + (theFromSize == -theToSize))) { return; } // Getting base shape. - const TopoDS_Shape& aBaseShape = theBaseShape->impl(); + const TopoDS_Shape &aBaseShape = theBaseShape->impl(); GeomAPI_Shape::ShapeType aShapeTypeToExp; - switch(aBaseShape.ShapeType()) { - case TopAbs_VERTEX: - aShapeTypeToExp = GeomAPI_Shape::VERTEX; - break; - case TopAbs_EDGE: - case TopAbs_WIRE: - aShapeTypeToExp = GeomAPI_Shape::EDGE; - break; - case TopAbs_FACE: - case TopAbs_SHELL: - aShapeTypeToExp = GeomAPI_Shape::FACE; - break; - case TopAbs_COMPOUND: - aShapeTypeToExp = GeomAPI_Shape::COMPOUND; - break; - default: - return; + switch (aBaseShape.ShapeType()) { + case TopAbs_VERTEX: + aShapeTypeToExp = GeomAPI_Shape::VERTEX; + break; + case TopAbs_EDGE: + case TopAbs_WIRE: + aShapeTypeToExp = GeomAPI_Shape::EDGE; + break; + case TopAbs_FACE: + case TopAbs_SHELL: + aShapeTypeToExp = GeomAPI_Shape::FACE; + break; + case TopAbs_COMPOUND: + aShapeTypeToExp = GeomAPI_Shape::COMPOUND; + break; + default: + return; } // Getting direction. @@ -171,17 +171,18 @@ GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, std::shared_ptr aBaseLoc; std::shared_ptr aBaseDir; BRepBuilderAPI_FindPlane aFindPlane(aBaseShape); - if(aFindPlane.Found() == Standard_True) - { + if (aFindPlane.Found() == Standard_True) { bool checkOrientation = false; Handle(Geom_Plane) aPlane; - if(aBaseShape.ShapeType() == TopAbs_FACE || aBaseShape.ShapeType() == TopAbs_SHELL) { + if (aBaseShape.ShapeType() == TopAbs_FACE || + aBaseShape.ShapeType() == TopAbs_SHELL) { TopExp_Explorer anExp(aBaseShape, TopAbs_FACE); - const TopoDS_Shape& aFace = anExp.Current(); + const TopoDS_Shape &aFace = anExp.Current(); Handle(Geom_Surface) aSurface = BRep_Tool::Surface(TopoDS::Face(aFace)); - if(aSurface->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { + if (aSurface->DynamicType() == + STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { Handle(Geom_RectangularTrimmedSurface) aTrimSurface = - Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); aSurface = aTrimSurface->BasisSurface(); } if (aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)) @@ -196,33 +197,31 @@ GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, aBaseVec = aPlane->Axis().Direction(); if (checkOrientation) { - // to stabilize the result of algorithm, if base shape is a wire, compare the orientation - // of calculated plane with the normal vector got iterating on vertices + // to stabilize the result of algorithm, if base shape is a wire, compare + // the orientation of calculated plane with the normal vector got + // iterating on vertices changeOrientationIfNeeded(aBaseShape, aBaseVec); } aBaseLoc.reset(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); aBaseDir.reset(new GeomAPI_Dir(aBaseVec.X(), aBaseVec.Y(), aBaseVec.Z())); - } - else if (theDirection.get()) - { + } else if (theDirection.get()) { aBaseDir = theDirection; aBaseVec = theDirection->impl(); - } - else - { + } else { return; } - if(!aBaseLoc.get()) { + if (!aBaseLoc.get()) { gp_Pnt aLoc; gp_XYZ aDirXYZ = aBaseVec.XYZ(); Standard_Real aMinParam = Precision::Infinite(); - for(TopExp_Explorer anExp(aBaseShape, TopAbs_VERTEX); anExp.More(); anExp.Next()) { - const TopoDS_Shape& aVertex = anExp.Current(); + for (TopExp_Explorer anExp(aBaseShape, TopAbs_VERTEX); anExp.More(); + anExp.Next()) { + const TopoDS_Shape &aVertex = anExp.Current(); gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aVertex)); double aParam = aDirXYZ.Dot(aPnt.XYZ()); - if(aParam < aMinParam) { + if (aParam < aMinParam) { aMinParam = aParam; aLoc = aPnt; } @@ -232,63 +231,57 @@ GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, gp_Vec anExtVec; std::shared_ptr anExtDir; - if (theDirection.get()) - { + if (theDirection.get()) { anExtDir = theDirection; anExtVec = theDirection->impl(); - } - else - { + } else { anExtDir = aBaseDir; anExtVec = aBaseDir->impl(); } - TopoDS_Shape aResult; const bool isBoundingShapesSet = theFromShape.get() || theToShape.get(); - if(!isBoundingShapesSet) { - buildBySizes(theBaseShape, anExtDir, theToSize, theFromSize, aShapeTypeToExp); + if (!isBoundingShapesSet) { + buildBySizes(theBaseShape, anExtDir, theToSize, theFromSize, + aShapeTypeToExp); } else { - GeomShapePtr aBasePlane = GeomAlgoAPI_FaceBuilder::squareFace(aBaseLoc, aBaseDir, 100.0); + GeomShapePtr aBasePlane = + GeomAlgoAPI_FaceBuilder::squareFace(aBaseLoc, aBaseDir, 100.0); GeomShapePtr aBoundingFromShape = theFromShape ? theFromShape : aBasePlane; - GeomShapePtr aBoundingToShape = theToShape ? theToShape : aBasePlane; + GeomShapePtr aBoundingToShape = theToShape ? theToShape : aBasePlane; bool isFromShapePlanar = aBoundingFromShape->isPlanar(); - bool isToShapePlanar = aBoundingToShape->isPlanar(); + bool isToShapePlanar = aBoundingToShape->isPlanar(); // Set signs of offsets if both bounding shapes are planar if (isFromShapePlanar && isToShapePlanar) { - std::shared_ptr aFromPln = GeomAPI_Face(aBoundingFromShape).getPlane(); - std::shared_ptr aToPln = GeomAPI_Face(aBoundingToShape).getPlane(); - buildByPlanes(theBaseShape, anExtDir, - aToPln, theToSize, - aFromPln, theFromSize, - aShapeTypeToExp); - } - else { - buildByFaces(theBaseShape, anExtDir, - aBoundingToShape, theToSize, isToShapePlanar, - aBoundingFromShape, theFromSize, isFromShapePlanar, - aShapeTypeToExp); + std::shared_ptr aFromPln = + GeomAPI_Face(aBoundingFromShape).getPlane(); + std::shared_ptr aToPln = + GeomAPI_Face(aBoundingToShape).getPlane(); + buildByPlanes(theBaseShape, anExtDir, aToPln, theToSize, aFromPln, + theFromSize, aShapeTypeToExp); + } else { + buildByFaces(theBaseShape, anExtDir, aBoundingToShape, theToSize, + isToShapePlanar, aBoundingFromShape, theFromSize, + isFromShapePlanar, aShapeTypeToExp); } } } //================================================================================================== -void GeomAlgoAPI_Prism::buildBySizes(const GeomShapePtr theBaseShape, - const GeomDirPtr theDirection, - const double theToSize, - const double theFromSize, - const GeomAPI_Shape::ShapeType theTypeToExp) -{ - const TopoDS_Shape& aBaseShape = theBaseShape->impl(); +void GeomAlgoAPI_Prism::buildBySizes( + const GeomShapePtr theBaseShape, const GeomDirPtr theDirection, + const double theToSize, const double theFromSize, + const GeomAPI_Shape::ShapeType theTypeToExp) { + const TopoDS_Shape &aBaseShape = theBaseShape->impl(); gp_Vec anExtVec = theDirection->impl(); // Moving base shape. gp_Trsf aTrsf; aTrsf.SetTranslation(anExtVec * -theFromSize); - BRepBuilderAPI_Transform* aTransformBuilder = + BRepBuilderAPI_Transform *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); if (!aTransformBuilder || !aTransformBuilder->IsDone()) { return; @@ -298,8 +291,8 @@ void GeomAlgoAPI_Prism::buildBySizes(const GeomShapePtr theBaseShape TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * (theFromSize + theToSize)); + BRepPrimAPI_MakePrism *aPrismBuilder = new BRepPrimAPI_MakePrism( + aMovedBase, anExtVec * (theFromSize + theToSize)); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } @@ -308,11 +301,12 @@ void GeomAlgoAPI_Prism::buildBySizes(const GeomShapePtr theBaseShape TopoDS_Shape aResult = aPrismBuilder->Shape(); // Setting naming. - if(theTypeToExp == GeomAPI_Shape::COMPOUND) { + if (theTypeToExp == GeomAPI_Shape::COMPOUND) { storeGenerationHistory(this, aMovedBase, TopAbs_EDGE, aPrismBuilder); storeGenerationHistory(this, aMovedBase, TopAbs_FACE, aPrismBuilder); } else { - storeGenerationHistory(this, aMovedBase, (TopAbs_ShapeEnum)theTypeToExp, aPrismBuilder); + storeGenerationHistory(this, aMovedBase, (TopAbs_ShapeEnum)theTypeToExp, + aPrismBuilder); } // Setting result. @@ -324,15 +318,12 @@ void GeomAlgoAPI_Prism::buildBySizes(const GeomShapePtr theBaseShape } //================================================================================================== -void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShape, - const GeomDirPtr theDirection, - const GeomPlanePtr theToPlane, - const double theToSize, - const GeomPlanePtr theFromPlane, - const double theFromSize, - const GeomAPI_Shape::ShapeType theTypeToExp) -{ - const TopoDS_Shape& aBaseShape = theBaseShape->impl(); +void GeomAlgoAPI_Prism::buildByPlanes( + const GeomShapePtr theBaseShape, const GeomDirPtr theDirection, + const GeomPlanePtr theToPlane, const double theToSize, + const GeomPlanePtr theFromPlane, const double theFromSize, + const GeomAPI_Shape::ShapeType theTypeToExp) { + const TopoDS_Shape &aBaseShape = theBaseShape->impl(); gp_Vec anExtVec = theDirection->impl(); // Moving prism bounding faces according to "from" and "to" sizes. @@ -345,13 +336,11 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap std::shared_ptr anExtDir = theDirection->xyz(); bool aSign = aFromLoc->xyz()->dot(anExtDir) > aToLoc->xyz()->dot(anExtDir); - std::shared_ptr aFromPnt( - new GeomAPI_Pnt(aFromLoc->xyz()->added(anExtDir->multiplied( - aSign ? theFromSize : -theFromSize)))); + std::shared_ptr aFromPnt(new GeomAPI_Pnt(aFromLoc->xyz()->added( + anExtDir->multiplied(aSign ? theFromSize : -theFromSize)))); - std::shared_ptr aToPnt( - new GeomAPI_Pnt(aToLoc->xyz()->added(anExtDir->multiplied( - aSign ? -theToSize : theToSize)))); + std::shared_ptr aToPnt(new GeomAPI_Pnt(aToLoc->xyz()->added( + anExtDir->multiplied(aSign ? -theToSize : theToSize)))); // Getting bounding box for base shape. Bnd_Box aBndBox; @@ -361,9 +350,9 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()}; gp_Pnt aPoints[8]; int aNum = 0; - for(int i = 0; i < 2; i++) { - for(int j = 0; j < 2; j++) { - for(int k = 0; k < 2; k++) { + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { aPoints[aNum] = gp_Pnt(aXArr[i], aYArr[j], aZArr[k]); aNum++; } @@ -371,22 +360,24 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap } // Project points to bounding planes. Search max distance to them. - IntAna_Quadric aBndToQuadric(gp_Pln(aToPnt->impl(), aToDir->impl())); - IntAna_Quadric aBndFromQuadric(gp_Pln(aFromPnt->impl(), aFromDir->impl())); + IntAna_Quadric aBndToQuadric( + gp_Pln(aToPnt->impl(), aToDir->impl())); + IntAna_Quadric aBndFromQuadric( + gp_Pln(aFromPnt->impl(), aFromDir->impl())); Standard_Real aMaxToDist = 0, aMaxFromDist = 0; - for(int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { gp_Lin aLine(aPoints[i], anExtVec); IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric); IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric); - if(aToIntAna.NbPoints() == 0 || aFromIntAna.NbPoints() == 0) { + if (aToIntAna.NbPoints() == 0 || aFromIntAna.NbPoints() == 0) { return; } - const gp_Pnt& aPntOnToFace = aToIntAna.Point(1); - const gp_Pnt& aPntOnFromFace = aFromIntAna.Point(1); - if(aPoints[i].Distance(aPntOnToFace) > aMaxToDist) { + const gp_Pnt &aPntOnToFace = aToIntAna.Point(1); + const gp_Pnt &aPntOnFromFace = aFromIntAna.Point(1); + if (aPoints[i].Distance(aPntOnToFace) > aMaxToDist) { aMaxToDist = aPoints[i].Distance(aPntOnToFace); } - if(aPoints[i].Distance(aPntOnFromFace) > aMaxFromDist) { + if (aPoints[i].Distance(aPntOnFromFace) > aMaxFromDist) { aMaxFromDist = aPoints[i].Distance(aPntOnFromFace); } } @@ -397,22 +388,23 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Moving base shape. gp_Trsf aTrsf; aTrsf.SetTranslation(anExtVec * -aPrismLength); - BRepBuilderAPI_Transform* aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); - if(!aTransformBuilder || !aTransformBuilder->IsDone()) { + BRepBuilderAPI_Transform *aTransformBuilder = + new BRepBuilderAPI_Transform(aBaseShape, aTrsf); + if (!aTransformBuilder || !aTransformBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aTransformBuilder))); + new GeomAlgoAPI_MakeShape(aTransformBuilder))); TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); - if(!aPrismBuilder || !aPrismBuilder->IsDone()) { + BRepPrimAPI_MakePrism *aPrismBuilder = + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); + if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aPrismBuilder))); + new GeomAlgoAPI_MakeShape(aPrismBuilder))); TopoDS_Shape aResult = aPrismBuilder->Shape(); BRepBndLib::Add(aResult, aBndBox); @@ -421,71 +413,76 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap Standard_Real aBndBoxSize = aBndBox.CornerMin().Distance(aBndBox.CornerMax()); // Orienting bounding planes. - std::shared_ptr aCentreOfMass = GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape); - const gp_Pnt& aCentrePnt = aCentreOfMass->impl(); + std::shared_ptr aCentreOfMass = + GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape); + const gp_Pnt &aCentrePnt = aCentreOfMass->impl(); gp_Lin aLine(aCentrePnt, anExtVec); IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric); IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric); Standard_Real aToParameter = aToIntAna.ParamOnConic(1); Standard_Real aFromParameter = aFromIntAna.ParamOnConic(1); - if(aToParameter > aFromParameter) { + if (aToParameter > aFromParameter) { gp_Vec aVec = aToDir->impl(); - if((aVec * anExtVec) > 0) + if ((aVec * anExtVec) > 0) aToDir->setImpl(new gp_Dir(aVec.Reversed())); aVec = aFromDir->impl(); - if((aVec * anExtVec) < 0) + if ((aVec * anExtVec) < 0) aFromDir->setImpl(new gp_Dir(aVec.Reversed())); } else { gp_Vec aVec = aToDir->impl(); - if((aVec * anExtVec) < 0) + if ((aVec * anExtVec) < 0) aToDir->setImpl(new gp_Dir(aVec.Reversed())); aVec = aFromDir->impl(); - if((aVec * anExtVec) > 0) + if ((aVec * anExtVec) > 0) aFromDir->setImpl(new gp_Dir(aVec.Reversed())); } static const double THE_FACE_SIZE_COEFF = 10.0; - GeomShapePtr aBoundingFromShape = - GeomAlgoAPI_FaceBuilder::squareFace(aFromPnt, aFromDir, THE_FACE_SIZE_COEFF * aBndBoxSize); - GeomShapePtr aBoundingToShape = - GeomAlgoAPI_FaceBuilder::squareFace(aToPnt, aToDir, THE_FACE_SIZE_COEFF * aBndBoxSize); + GeomShapePtr aBoundingFromShape = GeomAlgoAPI_FaceBuilder::squareFace( + aFromPnt, aFromDir, THE_FACE_SIZE_COEFF * aBndBoxSize); + GeomShapePtr aBoundingToShape = GeomAlgoAPI_FaceBuilder::squareFace( + aToPnt, aToDir, THE_FACE_SIZE_COEFF * aBndBoxSize); // bounding planes - const TopoDS_Shape& aToShape = aBoundingToShape->impl(); - const TopoDS_Shape& aFromShape = aBoundingFromShape->impl(); - TopoDS_Face aToFace = TopoDS::Face(aToShape); + const TopoDS_Shape &aToShape = aBoundingToShape->impl(); + const TopoDS_Shape &aFromShape = aBoundingFromShape->impl(); + TopoDS_Face aToFace = TopoDS::Face(aToShape); TopoDS_Face aFromFace = TopoDS::Face(aFromShape); // Solid based on "To" bounding plane gp_Vec aNormal = aToDir->impl(); - BRepPrimAPI_MakePrism* aToPrismBuilder = + BRepPrimAPI_MakePrism *aToPrismBuilder = new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize)); if (!aToPrismBuilder || !aToPrismBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aToPrismBuilder))); + new GeomAlgoAPI_MakeShape(aToPrismBuilder))); TopoDS_Shape aToSolid = aToPrismBuilder->Shape(); // Cutting with to plane. - BRepAlgoAPI_Cut* aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); + BRepAlgoAPI_Cut *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); aToCutBuilder->Build(); - if(!aToCutBuilder->IsDone()) { + if (!aToCutBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aToCutBuilder))); + new GeomAlgoAPI_MakeShape(aToCutBuilder))); aResult = aToCutBuilder->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } - if (theTypeToExp == GeomAPI_Shape::FACE || theTypeToExp == GeomAPI_Shape::COMPOUND) { + if (theTypeToExp == GeomAPI_Shape::FACE || + theTypeToExp == GeomAPI_Shape::COMPOUND) { TopTools_ListOfShape aPrismShapes = aToPrismBuilder->Modified(aToShape); if (aPrismShapes.IsEmpty()) aPrismShapes.Append(aToShape); - for (TopTools_ListIteratorOfListOfShape anIt1(aPrismShapes); anIt1.More(); anIt1.Next()) { - const TopTools_ListOfShape& aToShapes = aToCutBuilder->Modified(anIt1.Value()); - for (TopTools_ListIteratorOfListOfShape anIt2(aToShapes); anIt2.More(); anIt2.Next()) { + for (TopTools_ListIteratorOfListOfShape anIt1(aPrismShapes); anIt1.More(); + anIt1.Next()) { + const TopTools_ListOfShape &aToShapes = + aToCutBuilder->Modified(anIt1.Value()); + for (TopTools_ListIteratorOfListOfShape anIt2(aToShapes); anIt2.More(); + anIt2.Next()) { GeomShapePtr aGeomSh = toShape(anIt2.Value()); fixOrientation(aGeomSh); this->addToShape(aGeomSh); @@ -495,38 +492,42 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Solid based on "From" bounding plane aNormal = aFromDir->impl(); - BRepPrimAPI_MakePrism* aFromPrismBuilder = + BRepPrimAPI_MakePrism *aFromPrismBuilder = new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize)); if (!aFromPrismBuilder || !aFromPrismBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aFromPrismBuilder))); + new GeomAlgoAPI_MakeShape(aFromPrismBuilder))); TopoDS_Shape aFromSolid = aFromPrismBuilder->Shape(); // Cutting with from plane. - BRepAlgoAPI_Cut* aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); + BRepAlgoAPI_Cut *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); aFromCutBuilder->Build(); - if(!aFromCutBuilder->IsDone()) { + if (!aFromCutBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aFromCutBuilder))); + new GeomAlgoAPI_MakeShape(aFromCutBuilder))); aResult = aFromCutBuilder->Shape(); TopoDS_Iterator aCheckIt(aResult); - if(!aCheckIt.More()) { + if (!aCheckIt.More()) { return; } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } - if (theTypeToExp == GeomAPI_Shape::FACE || theTypeToExp == GeomAPI_Shape::COMPOUND) { + if (theTypeToExp == GeomAPI_Shape::FACE || + theTypeToExp == GeomAPI_Shape::COMPOUND) { TopTools_ListOfShape aPrismShapes = aFromPrismBuilder->Modified(aFromShape); if (aPrismShapes.IsEmpty()) aPrismShapes.Append(aFromShape); - for (TopTools_ListIteratorOfListOfShape anIt1(aPrismShapes); anIt1.More(); anIt1.Next()) { - const TopTools_ListOfShape& aFromShapes = aFromCutBuilder->Modified(anIt1.Value()); - for (TopTools_ListIteratorOfListOfShape anIt2(aFromShapes); anIt2.More(); anIt2.Next()) { + for (TopTools_ListIteratorOfListOfShape anIt1(aPrismShapes); anIt1.More(); + anIt1.Next()) { + const TopTools_ListOfShape &aFromShapes = + aFromCutBuilder->Modified(anIt1.Value()); + for (TopTools_ListIteratorOfListOfShape anIt2(aFromShapes); anIt2.More(); + anIt2.Next()) { GeomShapePtr aGeomSh = toShape(anIt2.Value()); fixOrientation(aGeomSh); this->addFromShape(aGeomSh); @@ -535,19 +536,19 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap } // Naming for extrusion from vertex, edge. - if(theTypeToExp == GeomAPI_Shape::COMPOUND) { + if (theTypeToExp == GeomAPI_Shape::COMPOUND) { storeGenerationHistory(this, aResult, TopAbs_EDGE, aToFace, aFromFace); storeGenerationHistory(this, aResult, TopAbs_FACE, aToFace, aFromFace); } else { - storeGenerationHistory(this, aResult, (TopAbs_ShapeEnum)theTypeToExp, aToFace, aFromFace); + storeGenerationHistory(this, aResult, (TopAbs_ShapeEnum)theTypeToExp, + aToFace, aFromFace); } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { GeomShapePtr aGeomShape = toShape(aResult); ListOfShape aResults; - aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, - GeomAPI_Shape::COMPSOLID, - aResults); + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes( + aGeomShape, GeomAPI_Shape::COMPSOLID, aResults); aResult = aGeomShape->impl(); } @@ -560,22 +561,20 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap } //================================================================================================== -void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape, - const GeomDirPtr theDirection, - const GeomShapePtr theToShape, - const double theToSize, - const bool theToIsPlanar, - const GeomShapePtr theFromShape, - const double theFromSize, - const bool theFromIsPlanar, - const GeomAPI_Shape::ShapeType theTypeToExp) -{ - const TopoDS_Shape& aBaseShape = theBaseShape->impl(); +void GeomAlgoAPI_Prism::buildByFaces( + const GeomShapePtr theBaseShape, const GeomDirPtr theDirection, + const GeomShapePtr theToShape, const double theToSize, + const bool theToIsPlanar, const GeomShapePtr theFromShape, + const double theFromSize, const bool theFromIsPlanar, + const GeomAPI_Shape::ShapeType theTypeToExp) { + const TopoDS_Shape &aBaseShape = theBaseShape->impl(); gp_Vec anExtVec = theDirection->impl(); // Moving prism bounding faces according to "from" and "to" sizes. - GeomShapePtr aBoundingFromShape = buildOffset(theFromShape, -theFromSize, theDirection, *this); - GeomShapePtr aBoundingToShape = buildOffset(theToShape, theToSize, theDirection, *this); + GeomShapePtr aBoundingFromShape = + buildOffset(theFromShape, -theFromSize, theDirection, *this); + GeomShapePtr aBoundingToShape = + buildOffset(theToShape, theToSize, theDirection, *this); // Bounding box for shapes used in prism building. Bnd_Box aBndBox; @@ -587,7 +586,8 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape // Prism building. gp_Trsf aTrsf; aTrsf.SetTranslation(anExtVec * -aPrismLength); - BRepBuilderAPI_Transform* aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); + BRepBuilderAPI_Transform *aTransformBuilder = + new BRepBuilderAPI_Transform(aBaseShape, aTrsf); if (!aTransformBuilder || !aTransformBuilder->IsDone()) { return; } @@ -596,7 +596,7 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism* aPrismBuilder = + BRepPrimAPI_MakePrism *aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; @@ -613,7 +613,7 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape // Build planar faces intersecting the prism fully. BRepBndLib::Add(aResult->impl(), aBndBox); aBoundingFromShape = buildPlanarFace(aBoundingFromShape, aBndBox); - aBoundingToShape = buildPlanarFace(aBoundingToShape, aBndBox); + aBoundingToShape = buildPlanarFace(aBoundingToShape, aBndBox); // Perform partition. ListOfShape anObjects, aTools; @@ -631,14 +631,16 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape if (theFromIsPlanar) { ListOfShape anImagesFrom; aPartition->modified(aBoundingFromShape, anImagesFrom); - for (ListOfShape::iterator anIt = anImagesFrom.begin(); anIt != anImagesFrom.end(); ++anIt) + for (ListOfShape::iterator anIt = anImagesFrom.begin(); + anIt != anImagesFrom.end(); ++anIt) addFromShape(*anIt); } if (theToIsPlanar) { ListOfShape anImagesTo; aPartition->modified(aBoundingToShape, anImagesTo); - for (ListOfShape::iterator anIt = anImagesTo.begin(); anIt != anImagesTo.end(); ++anIt) + for (ListOfShape::iterator anIt = anImagesTo.begin(); + anIt != anImagesTo.end(); ++anIt) addToShape(*anIt); } @@ -648,13 +650,16 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape aResult = collectResults(aPartition, aTools, aPrismBaseFaces, theTypeToExp); if (aResult && aResult->shapeType() == GeomAPI_Shape::COMPOUND) { ListOfShape aResults; - aResult = GeomAlgoAPI_ShapeTools::combineShapes(aResult, - theTypeToExp == GeomAPI_Shape::EDGE ? GeomAPI_Shape::SHELL : GeomAPI_Shape::COMPSOLID, + aResult = GeomAlgoAPI_ShapeTools::combineShapes( + aResult, + theTypeToExp == GeomAPI_Shape::EDGE ? GeomAPI_Shape::SHELL + : GeomAPI_Shape::COMPSOLID, aResults); - if (aResults.size() > 1 && - (GeomAlgoAPI_ShapeTools::hasSharedTopology(aResults, GeomAPI_Shape::EDGE) || - GeomAlgoAPI_ShapeTools::hasSharedTopology(aResults, GeomAPI_Shape::VERTEX))) { + if (aResults.size() > 1 && (GeomAlgoAPI_ShapeTools::hasSharedTopology( + aResults, GeomAPI_Shape::EDGE) || + GeomAlgoAPI_ShapeTools::hasSharedTopology( + aResults, GeomAPI_Shape::VERTEX))) { // results shuold not have shared topology aResult = GeomShapePtr(); } @@ -666,12 +671,10 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape } } - // Auxilary functions: //================================================================================================== -GeomShapePtr buildPlanarFace(const GeomShapePtr& theOriginalShape, - const Bnd_Box& theBaseShapeBB) -{ +GeomShapePtr buildPlanarFace(const GeomShapePtr &theOriginalShape, + const Bnd_Box &theBaseShapeBB) { GeomPlanePtr aPlane = GeomAPI_Face(theOriginalShape).getPlane(); if (!aPlane) return theOriginalShape; @@ -701,11 +704,9 @@ GeomShapePtr buildPlanarFace(const GeomShapePtr& theOriginalShape, } //================================================================================================== -GeomShapePtr buildOffset(const GeomShapePtr& theShape, - const double theOffset, +GeomShapePtr buildOffset(const GeomShapePtr &theShape, const double theOffset, const GeomDirPtr theDirection, - GeomAlgoAPI_MakeShapeList& theMakeShapeList) -{ + GeomAlgoAPI_MakeShapeList &theMakeShapeList) { if (Abs(theOffset) < Precision::Confusion()) return theShape; // no need zero offset @@ -726,11 +727,10 @@ GeomShapePtr buildOffset(const GeomShapePtr& theShape, } //================================================================================================== -void collectPrismBases(const TopoDS_Shape& theBaseShape, - BRepPrimAPI_MakePrism& thePrismAlgo, - ListOfShape& theBoundaries, - const GeomAPI_Shape::ShapeType theTypeToExp) -{ +void collectPrismBases(const TopoDS_Shape &theBaseShape, + BRepPrimAPI_MakePrism &thePrismAlgo, + ListOfShape &theBoundaries, + const GeomAPI_Shape::ShapeType theTypeToExp) { for (TopExp_Explorer anExp(theBaseShape, (TopAbs_ShapeEnum)theTypeToExp); anExp.More(); anExp.Next()) { theBoundaries.push_back(toShape(thePrismAlgo.FirstShape(anExp.Current()))); @@ -741,14 +741,13 @@ void collectPrismBases(const TopoDS_Shape& theBaseShape, //================================================================================================== typedef std::set SetOfShape; -bool isShapeApplicable(const GeomShapePtr& theSolid, - const std::list& theShapesToExist, - const SetOfShape& theShapesToExclude, - const GeomAPI_Shape::ShapeType theTypeToExp) -{ +bool isShapeApplicable(const GeomShapePtr &theSolid, + const std::list &theShapesToExist, + const SetOfShape &theShapesToExclude, + const GeomAPI_Shape::ShapeType theTypeToExp) { SetOfShape aFaces; - for (GeomAPI_ShapeExplorer aFExp(theSolid, theTypeToExp); - aFExp.more(); aFExp.next()) { + for (GeomAPI_ShapeExplorer aFExp(theSolid, theTypeToExp); aFExp.more(); + aFExp.next()) { GeomShapePtr aCurrent = aFExp.current(); if (theShapesToExclude.find(aCurrent) != theShapesToExclude.end()) return false; @@ -768,10 +767,9 @@ bool isShapeApplicable(const GeomShapePtr& theSolid, return isApplicable; } -void collectModified(const GeomMakeShapePtr& theOperation, - const ListOfShape& theShapes, - std::list& theModified) -{ +void collectModified(const GeomMakeShapePtr &theOperation, + const ListOfShape &theShapes, + std::list &theModified) { for (ListOfShape::const_iterator anIt = theShapes.begin(); anIt != theShapes.end(); ++anIt) { theModified.push_back(ListOfShape()); @@ -781,11 +779,10 @@ void collectModified(const GeomMakeShapePtr& theOperation, } } -GeomShapePtr collectResults(const GeomMakeShapePtr& theOperation, - const ListOfShape& theBoundaries, - const ListOfShape& theShapesToExclude, - const GeomAPI_Shape::ShapeType theTypeToExp) -{ +GeomShapePtr collectResults(const GeomMakeShapePtr &theOperation, + const ListOfShape &theBoundaries, + const ListOfShape &theShapesToExclude, + const GeomAPI_Shape::ShapeType theTypeToExp) { ListOfShape aResults; // collect modified shapes @@ -818,8 +815,9 @@ GeomShapePtr collectResults(const GeomMakeShapePtr& theOperation, // search applicable solids GeomShapePtr anOperationResult = theOperation->shape(); for (GeomAPI_ShapeExplorer anExp(anOperationResult, aSubshapeType); - anExp.more(); anExp.next()) { - if (isShapeApplicable(anExp.current(), aModifiedBoundaries, aTabooShapes, theTypeToExp)) + anExp.more(); anExp.next()) { + if (isShapeApplicable(anExp.current(), aModifiedBoundaries, aTabooShapes, + theTypeToExp)) aResults.push_back(anExp.current()); } @@ -832,13 +830,12 @@ GeomShapePtr collectResults(const GeomMakeShapePtr& theOperation, } //================================================================================================== -void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo, - const TopoDS_Shape& theBase, +void storeGenerationHistory(GeomAlgoAPI_Prism *thePrismAlgo, + const TopoDS_Shape &theBase, const TopAbs_ShapeEnum theType, - BRepPrimAPI_MakePrism* thePrismBuilder) -{ - for(TopExp_Explorer anExp(theBase, theType); anExp.More(); anExp.Next()) { - const TopoDS_Shape& aShape = anExp.Current(); + BRepPrimAPI_MakePrism *thePrismBuilder) { + for (TopExp_Explorer anExp(theBase, theType); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aShape = anExp.Current(); GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape); aFromShape->setImpl(new TopoDS_Shape(thePrismBuilder->FirstShape(aShape))); aToShape->setImpl(new TopoDS_Shape(thePrismBuilder->LastShape(aShape))); @@ -850,42 +847,41 @@ void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo, } //================================================================================================== -void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo, - const TopoDS_Shape& theResult, +void storeGenerationHistory(GeomAlgoAPI_Prism *thePrismAlgo, + const TopoDS_Shape &theResult, const TopAbs_ShapeEnum theType, - const TopoDS_Face& theToFace, - const TopoDS_Face& theFromFace) -{ - for(TopExp_Explorer anExp(theResult, theType); anExp.More(); anExp.Next()) { - const TopoDS_Shape& aShape = anExp.Current(); + const TopoDS_Face &theToFace, + const TopoDS_Face &theFromFace) { + for (TopExp_Explorer anExp(theResult, theType); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aShape = anExp.Current(); GeomShapePtr aGeomSh(new GeomAPI_Shape()); - if(theType == TopAbs_VERTEX) { + if (theType == TopAbs_VERTEX) { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); IntTools_Context anIntTools; - if(anIntTools.IsValidPointForFace(aPnt, - theToFace, Precision::Confusion()) == Standard_True) { + if (anIntTools.IsValidPointForFace( + aPnt, theToFace, Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); thePrismAlgo->fixOrientation(aGeomSh); thePrismAlgo->addToShape(aGeomSh); } - if(anIntTools.IsValidPointForFace(aPnt, - theFromFace, Precision::Confusion()) == Standard_True) { + if (anIntTools.IsValidPointForFace( + aPnt, theFromFace, Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); thePrismAlgo->fixOrientation(aGeomSh); thePrismAlgo->addFromShape(aGeomSh); } - } else if(theType == TopAbs_EDGE) { + } else if (theType == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); BRepLib_CheckCurveOnSurface anEdgeCheck(anEdge, theToFace); anEdgeCheck.Perform(); - if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { + if (anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); thePrismAlgo->fixOrientation(aGeomSh); thePrismAlgo->addToShape(aGeomSh); } anEdgeCheck.Init(anEdge, theFromFace); anEdgeCheck.Perform(); - if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { + if (anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); thePrismAlgo->fixOrientation(aGeomSh); thePrismAlgo->addFromShape(aGeomSh); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h index 310830102..0e88dc6ab 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Prism_H_ @@ -34,53 +35,48 @@ class GeomAPI_Pln; /// \brief Allows to create the prism based on a given face and bounding planes. /// \n Note that only planar faces are allowed as bounding faces and resulting /// extrusion will be bounded by the infinite planes taken from the faces. -class GeomAlgoAPI_Prism : public GeomAlgoAPI_MakeSweep -{ +class GeomAlgoAPI_Prism : public GeomAlgoAPI_MakeSweep { public: - /// \brief Creates extrusion for the given shape along the normal for this shape. - /// \param[in] theBaseShape planar face or wire to be extruded. + /// \brief Creates extrusion for the given shape along the normal for this + /// shape. \param[in] theBaseShape planar face or wire to be extruded. /// \param[in] theDirection direction of extrusion. - /// Can be empty if theBaseShape is planar wire or face. + /// Can be empty if theBaseShape is planar wire or + /// face. /// \param[in] theToShape top bounding shape. Can be empty. /// In this case offset will be applied to the basis. /// \param[in] theToSize offset for "to" plane. /// \param[in] theFromShape bottom bounding shape. Can be empty. /// In this case offset will be applied to the basis. /// \param[in] theFromSize offset for "from" plane. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, - const std::shared_ptr theDirection, - const GeomShapePtr theToShape, - const double theToSize, - const GeomShapePtr theFromShape, - const double theFromSize); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, + const std::shared_ptr theDirection, + const GeomShapePtr theToShape, const double theToSize, + const GeomShapePtr theFromShape, const double theFromSize); private: /// Build extrusion by distances from the base shape. - void buildBySizes(const GeomShapePtr theBaseShape, + void buildBySizes(const GeomShapePtr theBaseShape, const std::shared_ptr theDirection, - const double theToSize, - const double theFromSize, - const GeomAPI_Shape::ShapeType theTypeToExp); + const double theToSize, const double theFromSize, + const GeomAPI_Shape::ShapeType theTypeToExp); /// Build extrusion from plane to plane. - void buildByPlanes(const GeomShapePtr theBaseShape, + void buildByPlanes(const GeomShapePtr theBaseShape, const std::shared_ptr theDirection, const std::shared_ptr theToPlane, - const double theToSize, + const double theToSize, const std::shared_ptr theFromPlane, - const double theFromSize, - const GeomAPI_Shape::ShapeType theTypeToExp); + const double theFromSize, + const GeomAPI_Shape::ShapeType theTypeToExp); /// Build extrusion from face to face. - void buildByFaces(const GeomShapePtr theBaseShape, + void buildByFaces(const GeomShapePtr theBaseShape, const std::shared_ptr theDirection, - const GeomShapePtr theToShape, - const double theToSize, - const bool theToIsPlanar, - const GeomShapePtr theFromShape, - const double theFromSize, - const bool theFromIsPlanar, - const GeomAPI_Shape::ShapeType theTypeToExp); + const GeomShapePtr theToShape, const double theToSize, + const bool theToIsPlanar, const GeomShapePtr theFromShape, + const double theFromSize, const bool theFromIsPlanar, + const GeomAPI_Shape::ShapeType theTypeToExp); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp index acb5c6b4e..da1d7f5b9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,38 +24,34 @@ #include #include +#include #include #include -#include #include #include #include #include -GeomAlgoAPI_Projection::GeomAlgoAPI_Projection(const GeomPlanePtr& thePlane) - : myPlane(thePlane) -{ -} +GeomAlgoAPI_Projection::GeomAlgoAPI_Projection(const GeomPlanePtr &thePlane) + : myPlane(thePlane) {} -GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomCurvePtr& theCurve) -{ +GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomCurvePtr &theCurve) { Handle(Geom_Curve) aCurve = theCurve->impl(); Handle(Geom_Plane) aPlane = new Geom_Plane(myPlane->impl()); - Handle(Geom_Curve) aProj = - GeomProjLib::ProjectOnPlane(aCurve, aPlane, aPlane->Axis().Direction(), false); + Handle(Geom_Curve) aProj = GeomProjLib::ProjectOnPlane( + aCurve, aPlane, aPlane->Axis().Direction(), false); GeomCurvePtr aProjCurve(new GeomAPI_Curve); aProjCurve->setImpl(new Handle_Geom_Curve(aProj)); return aProjCurve; } -GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomEdgePtr& theEdge) -{ +GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomEdgePtr &theEdge) { GeomCurvePtr aCurve(new GeomAPI_Curve); - const TopoDS_Shape& aShape = theEdge->impl(); + const TopoDS_Shape &aShape = theEdge->impl(); TopoDS_Edge anEdge = TopoDS::Edge(aShape); if (!anEdge.IsNull()) { double aStart, aEnd; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.h b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.h index b6a495722..dfe6e44e7 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Projection_H_ @@ -33,17 +34,19 @@ class GeomAPI_Edge; * \ingroup DataAlgo * \brief Project curve onto a plane */ -class GeomAlgoAPI_Projection -{ +class GeomAlgoAPI_Projection { public: - GEOMALGOAPI_EXPORT GeomAlgoAPI_Projection(const std::shared_ptr& thePlane); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Projection(const std::shared_ptr &thePlane); /// Project curve to the plane GEOMALGOAPI_EXPORT - std::shared_ptr project(const std::shared_ptr& theCurve); + std::shared_ptr + project(const std::shared_ptr &theCurve); /// Project edge to the plane GEOMALGOAPI_EXPORT - std::shared_ptr project(const std::shared_ptr& theEdge); + std::shared_ptr + project(const std::shared_ptr &theEdge); private: std::shared_ptr myPlane; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp index dbd5ef788..5a7b0db5d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Revolution.h" @@ -27,116 +28,115 @@ #include #include -#include -#include #include #include #include #include #include -#include -#include +#include #include #include -#include +#include +#include #include -#include -#include -#include #include +#include +#include +#include +#include #include #include +#include #include #include -#include +#include -/// \brief Constructs infinite face from thePlane, and with axis located on the same side -/// of the plane as thePoint. Modifies thePlane axis direction. +/// \brief Constructs infinite face from thePlane, and with axis located on the +/// same side of the plane as thePoint. Modifies thePlane axis direction. /// \param[in,out] thePlane plane to construct face. /// \param[in] thePoint point to locate plane axis. /// \return constructed face. -static TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint); +static TopoDS_Face makeFaceFromPlane(gp_Pln &thePlane, const gp_Pnt &thePoint); /// \return solid created from face or shell. -static TopoDS_Solid makeSolidFromShape(const TopoDS_Shape& theShape); +static TopoDS_Solid makeSolidFromShape(const TopoDS_Shape &theShape); /// \brief return centre of mass for theShape. /// \param[in] theShape shape. -static gp_Pnt centreOfMass(const TopoDS_Shape& theShape); +static gp_Pnt centreOfMass(const TopoDS_Shape &theShape); /// \brief Selects solid from theShape with closest center of mass to thePoint /// \param[in] theShape compound with solids. /// \param[in] thePoint point. /// \return solid. -static TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint); +static TopoDS_Shape findClosest(const TopoDS_Shape &theShape, + const gp_Pnt &thePoint); /// \brief Create plane by 3 points. Return empty handle if failed. -static Handle(Geom_Plane) makePlane(const gp_Pnt& theP1, const gp_Pnt& theP2, const gp_Pnt& theP3); +static Handle(Geom_Plane) + makePlane(const gp_Pnt &theP1, const gp_Pnt &theP2, const gp_Pnt &theP3); -static void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, - const TopoDS_Shape& theBase, +static void storeGenerationHistory(GeomAlgoAPI_Revolution *theRevolutionAlgo, + const TopoDS_Shape &theBase, const TopAbs_ShapeEnum theType, - BRepPrimAPI_MakeRevol* theRevolBuilder); + BRepPrimAPI_MakeRevol *theRevolBuilder); -static void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, - const TopoDS_Shape& theResult, +static void storeGenerationHistory(GeomAlgoAPI_Revolution *theRevolutionAlgo, + const TopoDS_Shape &theResult, const TopAbs_ShapeEnum theType, - const TopoDS_Shape& theToFace, - const TopoDS_Shape& theFromFace); + const TopoDS_Shape &theToFace, + const TopoDS_Shape &theFromFace); -static void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, - const TopoDS_Shape& theResult, +static void storeGenerationHistory(GeomAlgoAPI_Revolution *theRevolutionAlgo, + const TopoDS_Shape &theResult, const TopAbs_ShapeEnum theType, - const TopoDS_Shape& theRotatedBoundingFace, - const TopoDS_Shape& theModifiedBaseShape, + const TopoDS_Shape &theRotatedBoundingFace, + const TopoDS_Shape &theModifiedBaseShape, const bool theIsFromFaceSet); //================================================================================================== -GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape, - const std::shared_ptr theAxis, - const GeomShapePtr theToShape, - const double theToAngle, - const GeomShapePtr theFromShape, - const double theFromAngle) -{ - build(theBaseShape, theAxis, theToShape, theToAngle, theFromShape, theFromAngle); +GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution( + const GeomShapePtr theBaseShape, const std::shared_ptr theAxis, + const GeomShapePtr theToShape, const double theToAngle, + const GeomShapePtr theFromShape, const double theFromAngle) { + build(theBaseShape, theAxis, theToShape, theToAngle, theFromShape, + theFromAngle); } //================================================================================================== -void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseShape, - const std::shared_ptr& theAxis, - const GeomShapePtr& theToShape, - const double theToAngle, - const GeomShapePtr& theFromShape, - const double theFromAngle) -{ - if(!theBaseShape || !theAxis || - (((!theFromShape && !theToShape) || - (theFromShape && theToShape && theFromShape->isEqual(theToShape))) - && (theFromAngle == -theToAngle))) { +void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, + const std::shared_ptr &theAxis, + const GeomShapePtr &theToShape, + const double theToAngle, + const GeomShapePtr &theFromShape, + const double theFromAngle) { + if (!theBaseShape || !theAxis || + (((!theFromShape && !theToShape) || + (theFromShape && theToShape && theFromShape->isEqual(theToShape))) && + (theFromAngle == -theToAngle))) { return; } // Getting base shape. - const TopoDS_Shape& aBaseShape = theBaseShape->impl(); + const TopoDS_Shape &aBaseShape = theBaseShape->impl(); TopAbs_ShapeEnum aShapeTypeToExp; - switch(aBaseShape.ShapeType()) { - case TopAbs_VERTEX: - aShapeTypeToExp = TopAbs_VERTEX; - break; - case TopAbs_EDGE: - case TopAbs_WIRE: - aShapeTypeToExp = TopAbs_EDGE; - break; - case TopAbs_FACE: - case TopAbs_SHELL: - aShapeTypeToExp = TopAbs_FACE; - break; - case TopAbs_COMPOUND: - aShapeTypeToExp = TopAbs_COMPOUND; - break; - default: - return; + switch (aBaseShape.ShapeType()) { + case TopAbs_VERTEX: + aShapeTypeToExp = TopAbs_VERTEX; + break; + case TopAbs_EDGE: + case TopAbs_WIRE: + aShapeTypeToExp = TopAbs_EDGE; + break; + case TopAbs_FACE: + case TopAbs_SHELL: + aShapeTypeToExp = TopAbs_FACE; + break; + case TopAbs_COMPOUND: + aShapeTypeToExp = TopAbs_COMPOUND; + break; + default: + return; } // Getting axis. @@ -145,7 +145,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh // Getting base plane. Handle(Geom_Plane) aBasePlane; BRepBuilderAPI_FindPlane aFindPlane(aBaseShape); - if(aShapeTypeToExp == TopAbs_FACE && aFindPlane.Found() == Standard_True) { + if (aShapeTypeToExp == TopAbs_FACE && aFindPlane.Found() == Standard_True) { aBasePlane = aFindPlane.Plane(); } else { gp_Pnt aPnt1 = anAxis.Location(); @@ -159,84 +159,87 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aBasePlane = makePlane(aPnt1, aPnt2, aPnt3); } - if(aBasePlane.IsNull()) { - gp_Pnt aPossiblePoints[] = { aPnt1.Translated(anAxis.Direction()), centreOfMass(aBaseShape) }; + if (aBasePlane.IsNull()) { + gp_Pnt aPossiblePoints[] = {aPnt1.Translated(anAxis.Direction()), + centreOfMass(aBaseShape)}; for (auto it = std::begin(aPossiblePoints); it != std::end(aPossiblePoints) && aBasePlane.IsNull(); ++it) aBasePlane = makePlane(aPnt1, aPnt2, *it); } } - if(aShapeTypeToExp == TopAbs_FACE) { - if(aBasePlane->Axis().Angle(anAxis) < Precision::Confusion()) { + if (aShapeTypeToExp == TopAbs_FACE) { + if (aBasePlane->Axis().Angle(anAxis) < Precision::Confusion()) { return; } } - gp_Pnt aBaseCentre = GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape)->impl(); + gp_Pnt aBaseCentre = + GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape)->impl(); TopoDS_Shape aResult; - if(!theFromShape && !theToShape) { // Case 1: When only angles was set. + if (!theFromShape && !theToShape) { // Case 1: When only angles was set. // Rotating base face with the negative value of "from angle". gp_Trsf aBaseTrsf; aBaseTrsf.SetRotation(anAxis, -theFromAngle / 180.0 * M_PI); - BRepBuilderAPI_Transform* aBaseTransform = new BRepBuilderAPI_Transform(aBaseShape, - aBaseTrsf, - true); - if(!aBaseTransform) { + BRepBuilderAPI_Transform *aBaseTransform = + new BRepBuilderAPI_Transform(aBaseShape, aBaseTrsf, true); + if (!aBaseTransform) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aBaseTransform))); - if(!aBaseTransform->IsDone()) { + new GeomAlgoAPI_MakeShape(aBaseTransform))); + if (!aBaseTransform->IsDone()) { return; } TopoDS_Shape aRotatedBase = aBaseTransform->Shape(); - // Making revolution to the angle equal to the sum of "from angle" and "to angle". - BRepPrimAPI_MakeRevol* aRevolBuilder = new BRepPrimAPI_MakeRevol(aRotatedBase, - anAxis, - (theFromAngle + theToAngle) / 180 * M_PI, - Standard_True); - if(!aRevolBuilder) { + // Making revolution to the angle equal to the sum of "from angle" and "to + // angle". + BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol( + aRotatedBase, anAxis, (theFromAngle + theToAngle) / 180 * M_PI, + Standard_True); + if (!aRevolBuilder) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aRevolBuilder))); - if(!aRevolBuilder->IsDone()) { + new GeomAlgoAPI_MakeShape(aRevolBuilder))); + if (!aRevolBuilder->IsDone()) { return; } aResult = aRevolBuilder->Shape(); // Setting naming. - if(aShapeTypeToExp == TopAbs_COMPOUND) { + if (aShapeTypeToExp == TopAbs_COMPOUND) { storeGenerationHistory(this, aRotatedBase, TopAbs_EDGE, aRevolBuilder); storeGenerationHistory(this, aRotatedBase, TopAbs_FACE, aRevolBuilder); } else { - storeGenerationHistory(this, aRotatedBase, aShapeTypeToExp, aRevolBuilder); + storeGenerationHistory(this, aRotatedBase, aShapeTypeToExp, + aRevolBuilder); } - } else if(theFromShape && theToShape) { // Case 2: When both bounding planes were set. + } else if (theFromShape && + theToShape) { // Case 2: When both bounding planes were set. // Making revolution to the 360 angle. - BRepPrimAPI_MakeRevol* aRevolBuilder = - new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); - if(!aRevolBuilder) { + BRepPrimAPI_MakeRevol *aRevolBuilder = + new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); + if (!aRevolBuilder) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aRevolBuilder))); - if(!aRevolBuilder->IsDone()) { + new GeomAlgoAPI_MakeShape(aRevolBuilder))); + if (!aRevolBuilder->IsDone()) { return; } aResult = aRevolBuilder->Shape(); // Getting bounding faces. TopoDS_Face aFromFace = TopoDS::Face(theFromShape->impl()); - TopoDS_Face aToFace = TopoDS::Face(theToShape->impl()); + TopoDS_Face aToFace = TopoDS::Face(theToShape->impl()); // Getting planes from bounding face. GeomLib_IsPlanarSurface isFromPlanar(BRep_Tool::Surface(aFromFace)); GeomLib_IsPlanarSurface isToPlanar(BRep_Tool::Surface(aToFace)); - if(!isFromPlanar.IsPlanar() || !isToPlanar.IsPlanar()) { + if (!isFromPlanar.IsPlanar() || !isToPlanar.IsPlanar()) { // non-planar shapes is not supported for revolution bounding return; } @@ -245,27 +248,29 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh std::shared_ptr aGeomToFace(new GeomAPI_Face(theToShape)); gp_Pln aFromPln = aGeomFromFace->getPlane()->impl(); - gp_Pln aToPln = aGeomToFace->getPlane()->impl(); + gp_Pln aToPln = aGeomToFace->getPlane()->impl(); - // Orienting bounding planes properly so that the center of mass of the base face stays - // on the result shape after cut. + // Orienting bounding planes properly so that the center of mass of the base + // face stays on the result shape after cut. aFromFace = makeFaceFromPlane(aFromPln, aBaseCentre); - aToFace = makeFaceFromPlane(aToPln, aBaseCentre); + aToFace = makeFaceFromPlane(aToPln, aBaseCentre); // Making solids from bounding planes and putting them in compound. TopoDS_Shape aFromSolid = makeSolidFromShape(aFromFace); - TopoDS_Shape aToSolid = makeSolidFromShape(aToFace); + TopoDS_Shape aToSolid = makeSolidFromShape(aToFace); // Rotating bounding planes to the specified angle. gp_Trsf aFromTrsf; gp_Trsf aToTrsf; double aFromRotAngle = - ((aFromPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theFromAngle : - theFromAngle; + ((aFromPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) + ? -theFromAngle + : theFromAngle; double aToRotAngle = - ((aToPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theToAngle : - theToAngle; - aFromTrsf.SetRotation(anAxis,aFromRotAngle / 180.0 * M_PI); + ((aToPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) + ? -theToAngle + : theToAngle; + aFromTrsf.SetRotation(anAxis, aFromRotAngle / 180.0 * M_PI); aToTrsf.SetRotation(anAxis, aToRotAngle / 180.0 * M_PI); BRepBuilderAPI_Transform aFromTransform(aFromSolid, aFromTrsf, true); BRepBuilderAPI_Transform aToTransform(aToSolid, aToTrsf, true); @@ -275,41 +280,40 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aToSolid = aToTransform.Shape(); // Cutting revolution with from plane. - BRepAlgoAPI_Cut* aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); + BRepAlgoAPI_Cut *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); aFromCutBuilder->Build(); - if(!aFromCutBuilder->IsDone()) { + if (!aFromCutBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aFromCutBuilder))); + new GeomAlgoAPI_MakeShape(aFromCutBuilder))); aResult = aFromCutBuilder->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } // Cutting revolution with to plane. - BRepAlgoAPI_Cut* aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); + BRepAlgoAPI_Cut *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); aToCutBuilder->Build(); - if(!aToCutBuilder->IsDone()) { + if (!aToCutBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aToCutBuilder))); + new GeomAlgoAPI_MakeShape(aToCutBuilder))); aResult = aToCutBuilder->Shape(); TopoDS_Iterator aCheckIt(aResult); - if(!aCheckIt.More()) { + if (!aCheckIt.More()) { return; } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aResult)); ListOfShape aResults; - aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, - GeomAPI_Shape::COMPSOLID, - aResults); + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes( + aGeomShape, GeomAPI_Shape::COMPSOLID, aResults); aResult = aGeomShape->impl(); } @@ -318,22 +322,25 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aResult = findClosest(aResult, aBaseCentre); // Setting naming. - if(aShapeTypeToExp == TopAbs_COMPOUND) { - storeGenerationHistory(this, aResult, TopAbs_EDGE, aRotatedToFace, aRotatedFromFace); - storeGenerationHistory(this, aResult, TopAbs_FACE, aRotatedToFace, aRotatedFromFace); + if (aShapeTypeToExp == TopAbs_COMPOUND) { + storeGenerationHistory(this, aResult, TopAbs_EDGE, aRotatedToFace, + aRotatedFromFace); + storeGenerationHistory(this, aResult, TopAbs_FACE, aRotatedToFace, + aRotatedFromFace); } else { - storeGenerationHistory(this, aResult, aShapeTypeToExp, aRotatedToFace, aRotatedFromFace); + storeGenerationHistory(this, aResult, aShapeTypeToExp, aRotatedToFace, + aRotatedFromFace); } - } else { //Case 3: When only one bounding plane was set. + } else { // Case 3: When only one bounding plane was set. // Making revolution to the 360 angle. - BRepPrimAPI_MakeRevol* aRevolBuilder = - new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); - if(!aRevolBuilder) { + BRepPrimAPI_MakeRevol *aRevolBuilder = + new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); + if (!aRevolBuilder) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aRevolBuilder))); - if(!aRevolBuilder->IsDone()) { + new GeomAlgoAPI_MakeShape(aRevolBuilder))); + if (!aRevolBuilder->IsDone()) { return; } aResult = aRevolBuilder->Shape(); @@ -341,24 +348,26 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh // Getting bounding face. bool isFromFaceSet = false; std::shared_ptr aGeomBoundingFace; - if(theFromShape) { + if (theFromShape) { aGeomBoundingFace.reset(new GeomAPI_Face(theFromShape)); isFromFaceSet = true; - } else if(theToShape) { + } else if (theToShape) { aGeomBoundingFace.reset(new GeomAPI_Face(theToShape)); } - TopoDS_Face aBoundingFace = TopoDS::Face(aGeomBoundingFace->impl()); + TopoDS_Face aBoundingFace = + TopoDS::Face(aGeomBoundingFace->impl()); // Getting plane from bounding face. GeomLib_IsPlanarSurface isBoundingPlanar(BRep_Tool::Surface(aBoundingFace)); - if(!isBoundingPlanar.IsPlanar()) { // non-planar shapes is not supported for revolution bounding + if (!isBoundingPlanar.IsPlanar()) { // non-planar shapes is not supported + // for revolution bounding return; } gp_Pln aBoundingPln = aGeomBoundingFace->getPlane()->impl(); - // Orienting bounding plane properly so that the center of mass of the base face stays - // on the result shape after cut. + // Orienting bounding plane properly so that the center of mass of the base + // face stays on the result shape after cut. aBoundingFace = makeFaceFromPlane(aBoundingPln, aBaseCentre); // Making solid from bounding plane. @@ -366,38 +375,46 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh // Rotating bounding plane to the specified angle. double aBoundingRotAngle = isFromFaceSet ? theFromAngle : theToAngle; - if(aBoundingPln.Axis().IsParallel(aBasePlane->Axis(), Precision::Confusion())) { - if(isFromFaceSet) aBoundingRotAngle = -aBoundingRotAngle; + if (aBoundingPln.Axis().IsParallel(aBasePlane->Axis(), + Precision::Confusion())) { + if (isFromFaceSet) + aBoundingRotAngle = -aBoundingRotAngle; } else { - double aSign = (aBoundingPln.Axis().Direction() ^ aBasePlane->Axis().Direction()) * - anAxis.Direction(); - if((aSign <= 0 && !isFromFaceSet) || (aSign > 0 && isFromFaceSet)) { + double aSign = + (aBoundingPln.Axis().Direction() ^ aBasePlane->Axis().Direction()) * + anAxis.Direction(); + if ((aSign <= 0 && !isFromFaceSet) || (aSign > 0 && isFromFaceSet)) { aBoundingRotAngle = -aBoundingRotAngle; } } gp_Trsf aBoundingTrsf; aBoundingTrsf.SetRotation(anAxis, aBoundingRotAngle / 180.0 * M_PI); - BRepBuilderAPI_Transform aBoundingTransform(aBoundingSolid, aBoundingTrsf, true); - TopoDS_Shape aRotatedBoundingFace = aBoundingTransform.Modified(aBoundingFace).First(); + BRepBuilderAPI_Transform aBoundingTransform(aBoundingSolid, aBoundingTrsf, + true); + TopoDS_Shape aRotatedBoundingFace = + aBoundingTransform.Modified(aBoundingFace).First(); aBoundingSolid = aBoundingTransform.Shape(); // Cutting revolution with bounding plane. - BRepAlgoAPI_Cut* aBoundingCutBuilder = new BRepAlgoAPI_Cut(aResult, aBoundingSolid); + BRepAlgoAPI_Cut *aBoundingCutBuilder = + new BRepAlgoAPI_Cut(aResult, aBoundingSolid); aBoundingCutBuilder->Build(); - if(!aBoundingCutBuilder->IsDone()) { + if (!aBoundingCutBuilder->IsDone()) { return; } this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aBoundingCutBuilder))); + new GeomAlgoAPI_MakeShape(aBoundingCutBuilder))); aResult = aBoundingCutBuilder->Shape(); - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } // Setting naming. - if(aShapeTypeToExp == TopAbs_FACE || aShapeTypeToExp == TopAbs_COMPOUND) { - const TopTools_ListOfShape& aBndShapes = aBoundingCutBuilder->Modified(aBoundingFace); - for(TopTools_ListIteratorOfListOfShape anIt(aBndShapes); anIt.More(); anIt.Next()) { + if (aShapeTypeToExp == TopAbs_FACE || aShapeTypeToExp == TopAbs_COMPOUND) { + const TopTools_ListOfShape &aBndShapes = + aBoundingCutBuilder->Modified(aBoundingFace); + for (TopTools_ListIteratorOfListOfShape anIt(aBndShapes); anIt.More(); + anIt.Next()) { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(anIt.Value())); fixOrientation(aShape); @@ -405,34 +422,38 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh } } - // Try to cut with base face. If it can not be done then keep result of cut with bounding plane. + // Try to cut with base face. If it can not be done then keep result of cut + // with bounding plane. TopoDS_Shape aModifiedBaseShape; - if(aShapeTypeToExp != TopAbs_FACE) { + if (aShapeTypeToExp != TopAbs_FACE) { ListOfShape aList; GeomShapePtr aSh(new GeomAPI_Shape()); aSh->setImpl(new TopoDS_Shape(aBaseShape)); - std::shared_ptr theCenter(new GeomAPI_Pnt(aBasePlane->Location().X(), - aBasePlane->Location().Y(), - aBasePlane->Location().Z())); - std::shared_ptr theNormal(new GeomAPI_Dir(aBasePlane->Axis().Direction().X(), - aBasePlane->Axis().Direction().Y(), - aBasePlane->Axis().Direction().Z())); - GeomShapePtr aPln = GeomAlgoAPI_FaceBuilder::planarFace(theCenter, theNormal); + std::shared_ptr theCenter(new GeomAPI_Pnt( + aBasePlane->Location().X(), aBasePlane->Location().Y(), + aBasePlane->Location().Z())); + std::shared_ptr theNormal( + new GeomAPI_Dir(aBasePlane->Axis().Direction().X(), + aBasePlane->Axis().Direction().Y(), + aBasePlane->Axis().Direction().Z())); + GeomShapePtr aPln = + GeomAlgoAPI_FaceBuilder::planarFace(theCenter, theNormal); aList.push_back(aSh); - std::list > - aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(aList); + std::list> aBoundingPoints = + GeomAlgoAPI_ShapeTools::getBoundingBox(aList); aSh = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPln, aBoundingPoints); aModifiedBaseShape = aSh->impl(); } else { aModifiedBaseShape = aBaseShape; } - if(isFromFaceSet) { - if(aModifiedBaseShape.ShapeType() == TopAbs_FACE) { + if (isFromFaceSet) { + if (aModifiedBaseShape.ShapeType() == TopAbs_FACE) { aModifiedBaseShape.Orientation(TopAbs_REVERSED); } else { gp_Trsf aMirrorTrsf; aMirrorTrsf.SetMirror(aBasePlane->Position().Ax2()); - BRepBuilderAPI_Transform aMirrorTransform(aModifiedBaseShape, aMirrorTrsf, true); + BRepBuilderAPI_Transform aMirrorTransform(aModifiedBaseShape, + aMirrorTrsf, true); aModifiedBaseShape = aMirrorTransform.Shape(); } } @@ -448,37 +469,40 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aBaseSolid = aBaseTransform.Shape(); // Cutting revolution with base. - BRepAlgoAPI_Cut* aBaseCutBuilder = new BRepAlgoAPI_Cut(aResult, aBaseSolid); + BRepAlgoAPI_Cut *aBaseCutBuilder = new BRepAlgoAPI_Cut(aResult, aBaseSolid); aBaseCutBuilder->Build(); - if(aBaseCutBuilder->IsDone()) { + if (aBaseCutBuilder->IsDone()) { TopoDS_Shape aCutResult = aBaseCutBuilder->Shape(); TopoDS_Iterator aCheckIt(aCutResult); - if(aCheckIt.More()) { + if (aCheckIt.More()) { this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aBaseCutBuilder))); + new GeomAlgoAPI_MakeShape(aBaseCutBuilder))); aResult = aCutResult; - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } - if(aShapeTypeToExp == TopAbs_FACE || aShapeTypeToExp == TopAbs_COMPOUND) { - const TopTools_ListOfShape& aBsShapes = aBaseCutBuilder->Modified(aBoundingFace); - for(TopTools_ListIteratorOfListOfShape anIt(aBsShapes); anIt.More(); anIt.Next()) { + if (aShapeTypeToExp == TopAbs_FACE || + aShapeTypeToExp == TopAbs_COMPOUND) { + const TopTools_ListOfShape &aBsShapes = + aBaseCutBuilder->Modified(aBoundingFace); + for (TopTools_ListIteratorOfListOfShape anIt(aBsShapes); anIt.More(); + anIt.Next()) { GeomShapePtr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(anIt.Value())); fixOrientation(aShape); - isFromFaceSet ? this->addToShape(aShape) : this->addFromShape(aShape); + isFromFaceSet ? this->addToShape(aShape) + : this->addFromShape(aShape); } } } } - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aResult)); ListOfShape aResults; - aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, - GeomAPI_Shape::COMPSOLID, - aResults); + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes( + aGeomShape, GeomAPI_Shape::COMPSOLID, aResults); aResult = aGeomShape->impl(); } @@ -487,19 +511,20 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aResult = findClosest(aResult, aBaseCentre); // Setting naming. - if(aShapeTypeToExp == TopAbs_COMPOUND) { - storeGenerationHistory(this, aResult, TopAbs_EDGE, - aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); - storeGenerationHistory(this, aResult, TopAbs_FACE, - aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); + if (aShapeTypeToExp == TopAbs_COMPOUND) { + storeGenerationHistory(this, aResult, TopAbs_EDGE, aRotatedBoundingFace, + aModifiedBaseShape, isFromFaceSet); + storeGenerationHistory(this, aResult, TopAbs_FACE, aRotatedBoundingFace, + aModifiedBaseShape, isFromFaceSet); } else { storeGenerationHistory(this, aResult, aShapeTypeToExp, - aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); + aRotatedBoundingFace, aModifiedBaseShape, + isFromFaceSet); } } // Setting result. - if(aResult.IsNull()) { + if (aResult.IsNull()) { return; } aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); @@ -510,12 +535,12 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh } //================================================================================================== -TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint) -{ - if(!thePlane.Contains(thePoint, Precision::Confusion())) { +TopoDS_Face makeFaceFromPlane(gp_Pln &thePlane, const gp_Pnt &thePoint) { + if (!thePlane.Contains(thePoint, Precision::Confusion())) { gp_XYZ aVec = thePoint.XYZ() - thePlane.Location().XYZ(); double aSign = aVec * thePlane.Axis().Direction().XYZ(); - if(aSign < 0) thePlane.SetAxis(thePlane.Axis().Reversed()); + if (aSign < 0) + thePlane.SetAxis(thePlane.Axis().Reversed()); } BRepBuilderAPI_MakeFace aMakeFace(thePlane); @@ -525,13 +550,12 @@ TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint) } //================================================================================================== -TopoDS_Solid makeSolidFromShape(const TopoDS_Shape& theShape) -{ +TopoDS_Solid makeSolidFromShape(const TopoDS_Shape &theShape) { TopoDS_Shell aShell; TopoDS_Solid aSolid; BRep_Builder aBoundingBuilder; - if(theShape.ShapeType() == TopAbs_SHELL) { + if (theShape.ShapeType() == TopAbs_SHELL) { aShell = TopoDS::Shell(theShape); } else { aBoundingBuilder.MakeShell(aShell); @@ -544,16 +568,15 @@ TopoDS_Solid makeSolidFromShape(const TopoDS_Shape& theShape) } //================================================================================================ -gp_Pnt centreOfMass(const TopoDS_Shape& theShape) -{ +gp_Pnt centreOfMass(const TopoDS_Shape &theShape) { TopAbs_ShapeEnum aShType = theShape.ShapeType(); GProp_GProps aGProps; - if(aShType == TopAbs_EDGE || aShType == TopAbs_WIRE) { + if (aShType == TopAbs_EDGE || aShType == TopAbs_WIRE) { BRepGProp::LinearProperties(theShape, aGProps); - } else if(aShType == TopAbs_FACE || aShType == TopAbs_SHELL) { + } else if (aShType == TopAbs_FACE || aShType == TopAbs_SHELL) { BRepGProp::SurfaceProperties(theShape, aGProps); - } else if(aShType == TopAbs_SOLID || aShType == TopAbs_COMPSOLID) { + } else if (aShType == TopAbs_SOLID || aShType == TopAbs_COMPSOLID) { BRepGProp::VolumeProperties(theShape, aGProps); } @@ -561,11 +584,10 @@ gp_Pnt centreOfMass(const TopoDS_Shape& theShape) } //================================================================================================ -TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint) -{ +TopoDS_Shape findClosest(const TopoDS_Shape &theShape, const gp_Pnt &thePoint) { TopoDS_Shape aResult = theShape; - if(theShape.ShapeType() == TopAbs_COMPOUND) { + if (theShape.ShapeType() == TopAbs_COMPOUND) { double aMinDistance = Precision::Infinite(); double aCurDistance; gp_Pnt aCentr; @@ -574,7 +596,7 @@ TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint) aCentr = centreOfMass(aValue); aCurDistance = aCentr.Distance(thePoint); - if(aCurDistance < aMinDistance) { + if (aCurDistance < aMinDistance) { aMinDistance = aCurDistance; aResult = aValue; } @@ -585,8 +607,8 @@ TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint) } //================================================================================================ -Handle(Geom_Plane) makePlane(const gp_Pnt& theP1, const gp_Pnt& theP2, const gp_Pnt& theP3) -{ +Handle(Geom_Plane) + makePlane(const gp_Pnt &theP1, const gp_Pnt &theP2, const gp_Pnt &theP3) { Handle(Geom_Plane) aPlane; GC_MakePlane aMkPlane(theP1, theP2, theP3); if (aMkPlane.IsDone()) @@ -595,13 +617,12 @@ Handle(Geom_Plane) makePlane(const gp_Pnt& theP1, const gp_Pnt& theP2, const gp_ } //================================================================================================ -void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, - const TopoDS_Shape& theBase, +void storeGenerationHistory(GeomAlgoAPI_Revolution *theRevolutionAlgo, + const TopoDS_Shape &theBase, const TopAbs_ShapeEnum theType, - BRepPrimAPI_MakeRevol* theRevolBuilder) -{ - for(TopExp_Explorer anExp(theBase, theType); anExp.More(); anExp.Next()) { - const TopoDS_Shape& aShape = anExp.Current(); + BRepPrimAPI_MakeRevol *theRevolBuilder) { + for (TopExp_Explorer anExp(theBase, theType); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aShape = anExp.Current(); GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape); aFromShape->setImpl(new TopoDS_Shape(theRevolBuilder->FirstShape(aShape))); aToShape->setImpl(new TopoDS_Shape(theRevolBuilder->LastShape(aShape))); @@ -613,56 +634,60 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, } //================================================================================================ -void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, - const TopoDS_Shape& theResult, +void storeGenerationHistory(GeomAlgoAPI_Revolution *theRevolutionAlgo, + const TopoDS_Shape &theResult, const TopAbs_ShapeEnum theType, - const TopoDS_Shape& theToFace, - const TopoDS_Shape& theFromFace) -{ - for(TopExp_Explorer anExp(theResult, theType); anExp.More (); anExp.Next ()) { - const TopoDS_Shape& aShape = anExp.Current(); + const TopoDS_Shape &theToFace, + const TopoDS_Shape &theFromFace) { + for (TopExp_Explorer anExp(theResult, theType); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aShape = anExp.Current(); GeomShapePtr aGeomSh(new GeomAPI_Shape()); - if(theType == TopAbs_VERTEX) { + if (theType == TopAbs_VERTEX) { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); IntTools_Context anIntTools; - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theToFace), - Precision::Confusion()) == Standard_True) { + if (anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theToFace), + Precision::Confusion()) == + Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); theRevolutionAlgo->addToShape(aGeomSh); } - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theFromFace), - Precision::Confusion()) == Standard_True) { + if (anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theFromFace), + Precision::Confusion()) == + Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); theRevolutionAlgo->addFromShape(aGeomSh); } - } else if(theType == TopAbs_EDGE) { + } else if (theType == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); BRepLib_CheckCurveOnSurface anEdgeCheck(anEdge, TopoDS::Face(theToFace)); anEdgeCheck.Perform(); - if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { + if (anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); theRevolutionAlgo->addToShape(aGeomSh); } anEdgeCheck.Init(anEdge, TopoDS::Face(theFromFace)); anEdgeCheck.Perform(); - if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { + if (anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); theRevolutionAlgo->addFromShape(aGeomSh); } } else { - Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aShape)); - Handle(Geom_Surface) aFromSurface = BRep_Tool::Surface(TopoDS::Face(theFromFace)); - Handle(Geom_Surface) aToSurface = BRep_Tool::Surface(TopoDS::Face(theToFace)); - if(aFaceSurface == aFromSurface) { + Handle(Geom_Surface) aFaceSurface = + BRep_Tool::Surface(TopoDS::Face(aShape)); + Handle(Geom_Surface) aFromSurface = + BRep_Tool::Surface(TopoDS::Face(theFromFace)); + Handle(Geom_Surface) aToSurface = + BRep_Tool::Surface(TopoDS::Face(theToFace)); + if (aFaceSurface == aFromSurface) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); theRevolutionAlgo->addFromShape(aGeomSh); } - if(aFaceSurface == aToSurface) { + if (aFaceSurface == aToSurface) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); theRevolutionAlgo->addToShape(aGeomSh); @@ -671,67 +696,71 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, } } -void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, - const TopoDS_Shape& theResult, +void storeGenerationHistory(GeomAlgoAPI_Revolution *theRevolutionAlgo, + const TopoDS_Shape &theResult, const TopAbs_ShapeEnum theType, - const TopoDS_Shape& theRotatedBoundingFace, - const TopoDS_Shape& theModifiedBaseShape, - const bool theIsFromFaceSet) -{ - for(TopExp_Explorer anExp(theResult, theType); anExp.More (); anExp.Next ()) { - const TopoDS_Shape& aShape = anExp.Current(); + const TopoDS_Shape &theRotatedBoundingFace, + const TopoDS_Shape &theModifiedBaseShape, + const bool theIsFromFaceSet) { + for (TopExp_Explorer anExp(theResult, theType); anExp.More(); anExp.Next()) { + const TopoDS_Shape &aShape = anExp.Current(); GeomShapePtr aGeomSh(new GeomAPI_Shape()); - if(theType == TopAbs_VERTEX) { + if (theType == TopAbs_VERTEX) { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); IntTools_Context anIntTools; - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace), - Precision::Confusion()) == Standard_True) { + if (anIntTools.IsValidPointForFace( + aPnt, TopoDS::Face(theRotatedBoundingFace), + Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); - theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : - theRevolutionAlgo->addToShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) + : theRevolutionAlgo->addToShape(aGeomSh); } - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theModifiedBaseShape), - Precision::Confusion()) == Standard_True) { + if (anIntTools.IsValidPointForFace( + aPnt, TopoDS::Face(theModifiedBaseShape), + Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); - theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : - theRevolutionAlgo->addFromShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) + : theRevolutionAlgo->addFromShape(aGeomSh); } - } else if(theType == TopAbs_EDGE) { + } else if (theType == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); - BRepLib_CheckCurveOnSurface anEdgeCheck(anEdge, TopoDS::Face(theRotatedBoundingFace)); + BRepLib_CheckCurveOnSurface anEdgeCheck( + anEdge, TopoDS::Face(theRotatedBoundingFace)); anEdgeCheck.Perform(); - if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { + if (anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); - theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : - theRevolutionAlgo->addToShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) + : theRevolutionAlgo->addToShape(aGeomSh); } anEdgeCheck.Init(anEdge, TopoDS::Face(theModifiedBaseShape)); anEdgeCheck.Perform(); - if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { + if (anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); - theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : - theRevolutionAlgo->addFromShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) + : theRevolutionAlgo->addFromShape(aGeomSh); } } else { - Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aShape)); + Handle(Geom_Surface) aFaceSurface = + BRep_Tool::Surface(TopoDS::Face(aShape)); Handle(Geom_Surface) aBoundingSurface = - BRep_Tool::Surface(TopoDS::Face(theRotatedBoundingFace)); - Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(TopoDS::Face(theModifiedBaseShape)); - if(aFaceSurface == aBoundingSurface) { + BRep_Tool::Surface(TopoDS::Face(theRotatedBoundingFace)); + Handle(Geom_Surface) aBaseSurface = + BRep_Tool::Surface(TopoDS::Face(theModifiedBaseShape)); + if (aFaceSurface == aBoundingSurface) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); - theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : - theRevolutionAlgo->addToShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) + : theRevolutionAlgo->addToShape(aGeomSh); } - if(aFaceSurface == aBaseSurface) { + if (aFaceSurface == aBaseSurface) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->fixOrientation(aGeomSh); - theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : - theRevolutionAlgo->addFromShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) + : theRevolutionAlgo->addFromShape(aGeomSh); } } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h index 50b0b53a4..9b27ec6f1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Revolution_H_ @@ -28,16 +29,15 @@ /// \class GeomAlgoAPI_Revolution /// \ingroup DataAlgo -/// \brief Allows to create the revolution based on a given face, angles and bounding planes. -/// \n Note that only the planar faces are allowed as bounding faces and resulting -/// revolution will be bounded by the infinite planes taken from the faces. -/// \n If the bounding plane was specified with the angle then this plane will be rotated around -/// the axis to the value of the angle. -/// \n Note that algorithm return only one solid object. So in case when after cutting with bounding -/// planes algorithm got more than one solid it will return the closest to the center of mass of -/// the base face. -class GeomAlgoAPI_Revolution : public GeomAlgoAPI_MakeSweep -{ +/// \brief Allows to create the revolution based on a given face, angles and +/// bounding planes. \n Note that only the planar faces are allowed as bounding +/// faces and resulting revolution will be bounded by the infinite planes taken +/// from the faces. \n If the bounding plane was specified with the angle then +/// this plane will be rotated around the axis to the value of the angle. \n +/// Note that algorithm return only one solid object. So in case when after +/// cutting with bounding planes algorithm got more than one solid it will +/// return the closest to the center of mass of the base face. +class GeomAlgoAPI_Revolution : public GeomAlgoAPI_MakeSweep { public: /// \brief Creates revolution for the given shape. /// \param[in] theBaseShape face for revolution. @@ -48,21 +48,19 @@ public: /// \param[in] theFromShape from bounding shape. Can be empty. /// In this case offset will be applied to the basis. /// \param[in] theFromAngle from angle. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape, - const std::shared_ptr theAxis, - const GeomShapePtr theToShape, - const double theToAngle, - const GeomShapePtr theFromShape, - const double theFromAngle); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape, + const std::shared_ptr theAxis, + const GeomShapePtr theToShape, const double theToAngle, + const GeomShapePtr theFromShape, + const double theFromAngle); private: /// Builds resulting shape. - void build(const GeomShapePtr& theBaseShape, - const std::shared_ptr& theAxis, - const GeomShapePtr& theToShape, - const double theToAngle, - const GeomShapePtr& theFromShape, - const double theFromAngle); + void build(const GeomShapePtr &theBaseShape, + const std::shared_ptr &theAxis, + const GeomShapePtr &theToShape, const double theToAngle, + const GeomShapePtr &theFromShape, const double theFromAngle); }; -#endif \ No newline at end of file +#endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp index 9815341fd..afebe6c25 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -26,16 +27,13 @@ #include // Verify points are applicable to build the rotation transformation -static bool checkPoints(GeomPointPtr theCenterPoint, - GeomPointPtr theStartPoint, - GeomPointPtr theEndPoint, - std::string& theError); +static bool checkPoints(GeomPointPtr theCenterPoint, GeomPointPtr theStartPoint, + GeomPointPtr theEndPoint, std::string &theError); //================================================================================================= -GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - double theAngle) -{ +GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation( + std::shared_ptr theSourceShape, + std::shared_ptr theAxis, double theAngle) { if (!theAxis) { myError = "Rotation builder :: axis is not valid."; return; @@ -47,13 +45,12 @@ GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSou build(theSourceShape, aTrsf); } - //================================================================================================= -GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint) -{ +GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation( + std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint) { if (!checkPoints(theCenterPoint, theStartPoint, theEndPoint, myError)) return; @@ -64,11 +61,8 @@ GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSou } //================================================================================================= -bool checkPoints(GeomPointPtr theCenterPoint, - GeomPointPtr theStartPoint, - GeomPointPtr theEndPoint, - std::string& theError) -{ +bool checkPoints(GeomPointPtr theCenterPoint, GeomPointPtr theStartPoint, + GeomPointPtr theEndPoint, std::string &theError) { if (!theCenterPoint) { theError = "Rotation builder :: center point is not valid."; return false; @@ -104,7 +98,8 @@ bool checkPoints(GeomPointPtr theCenterPoint, vectCenterPointStartPoint->cross(vectCenterPointEndPoint); if (crossProduct->squareModulus() < Precision::SquareConfusion()) { - theError = "Rotation builder :: center point, start point and end point are on a line."; + theError = "Rotation builder :: center point, start point and end point " + "are on a line."; return false; } return true; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h index 0285ffaac..ce8816fa3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Rotation_H_ @@ -29,28 +30,30 @@ class GeomAPI_Pnt; /// \class GeomAlgoAPI_Rotation /// \ingroup DataAlgo /// \brief Creates a copy of the object by rotating it around the axis. -class GeomAlgoAPI_Rotation : public GeomAlgoAPI_Transform -{ +class GeomAlgoAPI_Rotation : public GeomAlgoAPI_Transform { public: - /// \brief Creates an object which is obtained from current object by rotating it around the axis + /// \brief Creates an object which is obtained from current object by rotating + /// it around the axis /// with the angle. /// \param[in] theSourceShape a shape to be rotated. /// \param[in] theAxis rotation axis. /// \param[in] theAngle rotation angle(in degree). - GEOMALGOAPI_EXPORT GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - double theAngle); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, double theAngle); - /// \brief Creates an object which is obtained from current object by rotating it around the axis + /// \brief Creates an object which is obtained from current object by rotating + /// it around the axis /// withe angle using the center and two points. /// \param[in] theSourceShape a shape to be rotated. /// \param[in] theCenterPoint center point. /// \param[in] theStartPoint start point. /// \param[in] theEndPoint end point. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp index 7bca188ec..e6ff52a40 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,17 +23,17 @@ #include "GeomAlgoAPI_Tools.h" #include -#include #include +#include -#include +#include +#include +#include #include +#include +#include #include #include -#include -#include -#include -#include #include @@ -44,37 +45,40 @@ struct GeomAlgoAPI_STEPAttributes { Handle(XCAFDoc_ShapeTool) myShapeTool; Handle(XCAFDoc_ColorTool) myColorTool; - GeomAlgoAPI_STEPAttributes(const TDF_Label& theMain) : myHasColor(false) - { + GeomAlgoAPI_STEPAttributes(const TDF_Label &theMain) : myHasColor(false) { myShapeTool = XCAFDoc_DocumentTool::ShapeTool(theMain); myShapeTool->SetAutoNaming(Standard_False); myColorTool = XCAFDoc_DocumentTool::ColorTool(theMain); } }; -static TDF_Label exportShape(const GeomShapePtr theShape, GeomAlgoAPI_STEPAttributes& theAttrs, - const GeomShapePtr theFatherShape, TDF_Label& theFaterID) { +static TDF_Label exportShape(const GeomShapePtr theShape, + GeomAlgoAPI_STEPAttributes &theAttrs, + const GeomShapePtr theFatherShape, + TDF_Label &theFaterID) { TopoDS_Shape aShape = theShape->impl(); TDF_Label aShapeLab; if (!theFaterID.IsNull()) { // make sub-component of father's assembly gp_Trsf aFatherTrsf; if (theFatherShape.get()) - aFatherTrsf = theFatherShape->implPtr()->Location().Transformation(); + aFatherTrsf = + theFatherShape->implPtr()->Location().Transformation(); TopLoc_Location aLocation = aFatherTrsf.Inverted() * aShape.Location(); static const TopLoc_Location anEmptyLoc; aShape.Location(anEmptyLoc); aShapeLab = theAttrs.myShapeTool->AddShape(aShape, Standard_False); - TDF_Label aRetLabel = theAttrs.myShapeTool->AddComponent(theFaterID, aShapeLab, aLocation); + TDF_Label aRetLabel = + theAttrs.myShapeTool->AddComponent(theFaterID, aShapeLab, aLocation); if (!aRetLabel.IsNull()) aRetLabel.ForgetAttribute(TDataStd_Name::GetID()); - } - else { // make a single shape + } else { // make a single shape aShapeLab = theAttrs.myShapeTool->AddShape(aShape, Standard_False); TDF_Label aRefShapeLab; if (theAttrs.myShapeTool->GetReferredShape(aShapeLab, aRefShapeLab)) aShapeLab = aRefShapeLab; } - TDataStd_Name::Set(aShapeLab, TCollection_ExtendedString(theAttrs.myName.c_str())); + TDataStd_Name::Set(aShapeLab, + TCollection_ExtendedString(theAttrs.myName.c_str())); if (theAttrs.myHasColor) { TDF_Label aColorLab = theAttrs.myColorTool->AddColor(theAttrs.myColor); theAttrs.myColorTool->SetColor(aShapeLab, aColorLab, XCAFDoc_ColorGen); @@ -83,80 +87,86 @@ static TDF_Label exportShape(const GeomShapePtr theShape, GeomAlgoAPI_STEPAttrib } /// Returns the attributes of the result: names and color -static void getAttributes(const ResultPtr& theResult, GeomAlgoAPI_STEPAttributes& theAttrs) -{ +static void getAttributes(const ResultPtr &theResult, + GeomAlgoAPI_STEPAttributes &theAttrs) { theAttrs.myName = theResult->data()->name(); - AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aColorAttr = + theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() && aColorAttr->size() > 2) { theAttrs.myHasColor = true; - theAttrs.myColor.SetValues(aColorAttr->value(0) / 255., aColorAttr->value(1) / 255., + theAttrs.myColor.SetValues(aColorAttr->value(0) / 255., + aColorAttr->value(1) / 255., aColorAttr->value(2) / 255., Quantity_TOC_RGB); - } - else + } else theAttrs.myHasColor = false; } -/// Performs the whole result export: as an assembly or a single one, but with results attributes. -static void putResult(const ResultPtr& theResult, const GeomShapePtr theFatherShape, - TDF_Label& theFaterID, GeomAlgoAPI_STEPAttributes& theAttrs) -{ +/// Performs the whole result export: as an assembly or a single one, but with +/// results attributes. +static void putResult(const ResultPtr &theResult, + const GeomShapePtr theFatherShape, TDF_Label &theFaterID, + GeomAlgoAPI_STEPAttributes &theAttrs) { GeomShapePtr aShape = theResult->shape(); if (!aShape.get() || aShape->isNull()) return; - ResultBodyPtr aBody = std::dynamic_pointer_cast(theResult); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(theResult); if (aBody.get() && aBody->numberOfSubs()) { // make an assembly getAttributes(theResult, theAttrs); - TDF_Label aBodyID = exportShape(aShape, theAttrs, theFatherShape, theFaterID); + TDF_Label aBodyID = + exportShape(aShape, theAttrs, theFatherShape, theFaterID); int aNumSubs = aBody->numberOfSubs(); for (int a = 0; a < aNumSubs; a++) { ResultBodyPtr aSub = aBody->subResult(a); if (!aSub->isDisabled()) putResult(aSub, aShape, aBodyID, theAttrs); } - } - else { // a simple shape-body + } else { // a simple shape-body getAttributes(theResult, theAttrs); exportShape(aShape, theAttrs, theFatherShape, theFaterID); } } -bool STEPExport(const std::string& theFileName, - const std::list >& theShapes, - const std::list >& theResults, - std::string& theError) -{ +bool STEPExport(const std::string &theFileName, + const std::list> &theShapes, + const std::list> &theResults, + std::string &theError) { theError = ""; // prepare XCAF document to store the whole data structure there Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF"); GeomAlgoAPI_STEPAttributes anAttrs(aDoc->Main()); - std::list >::const_iterator aShape = theShapes.cbegin(); - std::list >::const_iterator aResult = theResults.cbegin(); + std::list>::const_iterator aShape = + theShapes.cbegin(); + std::list>::const_iterator aResult = + theResults.cbegin(); for (; aShape != theShapes.cend(); aShape++, aResult++) { TDF_Label aNullLab; - if (aResult->get() && !(*aShape)->isSame((*aResult)->shape())) - { // simple sub-shape + if (aResult->get() && + !(*aShape)->isSame((*aResult)->shape())) { // simple sub-shape getAttributes(*aResult, anAttrs); exportShape(*aShape, anAttrs, GeomShapePtr(), aNullLab); - } - else { // whole result selection + } else { // whole result selection putResult(*aResult, GeomShapePtr(), aNullLab, anAttrs); } } // store the XCAF document to STEP file try { - GeomAlgoAPI_Tools::Localizer aLocalizer; // Set "C" numeric locale to save numbers correctly + GeomAlgoAPI_Tools::Localizer + aLocalizer; // Set "C" numeric locale to save numbers correctly #if OCC_VERSION_LARGE < 0x07070000 STEPCAFControl_Writer aWriter; Interface_Static::SetCVal("xstep.cascade.unit", "M"); - Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree + Interface_Static::SetIVal("write.step.nonmanifold", + 0); // 1 don't allow to export assemly tree Interface_Static::SetCVal("write.step.unit", "M"); #else STEPCAFControl_Writer aWriterTmp; Interface_Static::SetCVal("xstep.cascade.unit", "M"); - Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree + Interface_Static::SetIVal("write.step.nonmanifold", + 0); // 1 don't allow to export assemly tree Interface_Static::SetCVal("write.step.unit", "M"); STEPCAFControl_Writer aWriter; #endif @@ -166,8 +176,7 @@ bool STEPExport(const std::string& theFileName, aStatus = aWriter.Write(theFileName.c_str()); if (aStatus != IFSelect_RetDone) theError = "STEP Export failed"; - } - catch (Standard_Failure&) { + } catch (Standard_Failure &) { theError = "Exception catched in STEPExport"; } return theError.empty(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h index 36d90fc81..1d7ccbe5b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_STEPEXPORT_H_ @@ -22,20 +23,20 @@ #include -#include #include #include +#include class GeomAPI_Shape; class ModelAPI_Result; /// Implementation of the export STEP files algorithms. -/// In order to supposrt names and colors experted, theShapes list corresponds to theResults -/// list elements one by one. +/// In order to supposrt names and colors experted, theShapes list corresponds +/// to theResults list elements one by one. GEOMALGOAPI_EXPORT -bool STEPExport(const std::string& theFileName, - const std::list >& theShapes, - const std::list >& theResults, - std::string& theError); +bool STEPExport(const std::string &theFileName, + const std::list> &theShapes, + const std::list> &theResults, + std::string &theError); #endif /* GEOMALGOAPI_STEPEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp index aa44eeaf2..3ebb15201 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,8 +23,8 @@ #include #include -#include #include +#include #include #include @@ -39,11 +40,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -58,21 +59,20 @@ #include #include -#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC #include +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC //================================================================================================= -bool readUnits(STEPControl_Reader& aReader, - const bool theScalInterUnits, - std::string& theError) -{ +bool readUnits(STEPControl_Reader &aReader, const bool theScalInterUnits, + std::string &theError) { // Regard or not the model units if (!theScalInterUnits) { // set UnitFlag to units from file TColStd_SequenceOfAsciiString anUnitLengthNames; TColStd_SequenceOfAsciiString anUnitAngleNames; TColStd_SequenceOfAsciiString anUnitSolidAngleNames; - aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames); + aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, + anUnitSolidAngleNames); if (anUnitLengthNames.Length() > 0) { TCollection_AsciiString aLenUnits = anUnitLengthNames.First(); if (aLenUnits == "millimetre") @@ -88,25 +88,22 @@ bool readUnits(STEPControl_Reader& aReader, return false; } // TODO (for other units than mm, cm, m or inch) - //else if (aLenUnits == "") + // else if (aLenUnits == "") // Interface_Static::SetCVal("xstep.cascade.unit", "???"); } - } - else { - //cout<<"need re-scale a model"< STEPImport(const std::string& theFileName, - const std::string& /*theFormatName*/, +std::shared_ptr STEPImport(const std::string &theFileName, + const std::string & /*theFormatName*/, const bool theScalInterUnits, - std::string& theError) -{ + std::string &theError) { TopoDS_Shape aResShape; @@ -115,7 +112,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, STEPControl_Reader aReader; - //VSR: 16/09/09: Convert to METERS + // VSR: 16/09/09: Convert to METERS Interface_Static::SetCVal("xstep.cascade.unit", "M"); Interface_Static::SetIVal("read.step.ideas", 1); Interface_Static::SetIVal("read.step.nonmanifold", 1); @@ -131,7 +128,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, if (status == IFSelect_RetDone) { // Regard or not the model units - if( !readUnits(aReader, theScalInterUnits, theError)) { + if (!readUnits(aReader, theScalInterUnits, theError)) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; @@ -148,20 +145,19 @@ std::shared_ptr STEPImport(const std::string& theFileName, Standard_Boolean ok = aReader.TransferRoot(n); /* Collecting resulting entities */ Standard_Integer nbs = aReader.NbShapes(); - if (!ok || nbs == 0) - { + if (!ok || nbs == 0) { continue; // skip empty root } /* For a single entity */ else if (nbr == 1 && nbs == 1) { aResShape = aReader.Shape(1); - // ATTENTION: this is a workaround for mantis issue 0020442 remark 0010776 - // It should be removed after patching OCCT for bug OCC22436 + // ATTENTION: this is a workaround for mantis issue 0020442 remark + // 0010776 It should be removed after patching OCCT for bug OCC22436 // (fix for OCCT is expected in service pack next to OCCT6.3sp12) if (aResShape.ShapeType() == TopAbs_COMPOUND) { int nbSub1 = 0; TopoDS_Shape currShape; - TopoDS_Iterator It (aResShape, Standard_True, Standard_True); + TopoDS_Iterator It(aResShape, Standard_True, Standard_True); for (; It.More(); It.Next()) { nbSub1++; currShape = It.Value(); @@ -176,10 +172,9 @@ std::shared_ptr STEPImport(const std::string& theFileName, for (Standard_Integer i = 1; i <= nbs; i++) { TopoDS_Shape aShape = aReader.Shape(i); if (aShape.IsNull()) { - //return aResShape; + // return aResShape; continue; - } - else { + } else { B.Add(compound, aShape); } } @@ -188,8 +183,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, aResShape = compound; // Check if any BRep entity has been read, there must be at least a vertex - if (!TopExp_Explorer(aResShape, TopAbs_VERTEX).More()) - { + if (!TopExp_Explorer(aResShape, TopAbs_VERTEX).More()) { theError = "No geometrical data in the imported file."; std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape()); @@ -199,8 +193,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, theError = "Wrong format of the imported file. Can't import file."; aResShape.Nullify(); } - } - catch (Standard_Failure const& anException) { + } catch (Standard_Failure const &anException) { theError = anException.GetMessageString(); aResShape.Nullify(); } @@ -211,15 +204,13 @@ std::shared_ptr STEPImport(const std::string& theFileName, } //================================================================================================== -GeomShapePtr STEPImportAttributs(const std::string& theFileName, - std::shared_ptr theResultBody, - const bool theScalInterUnits, - const bool theMaterials, - const bool /*theColor*/, - std::map< std::wstring, - std::list>& theMaterialShape, - std::string& theError) -{ +GeomShapePtr STEPImportAttributs( + const std::string &theFileName, + std::shared_ptr theResultBody, + const bool theScalInterUnits, const bool theMaterials, + const bool /*theColor*/, + std::map> &theMaterialShape, + std::string &theError) { try { STEPControl_Reader aReader; @@ -236,12 +227,12 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, if (status == IFSelect_RetDone) { // Regard or not the model units - if( !readUnits(aReader, theScalInterUnits, theError)) { + if (!readUnits(aReader, theScalInterUnits, theError)) { aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; } } - } catch (Standard_Failure const& anException) { + } catch (Standard_Failure const &anException) { theError = anException.GetMessageString(); aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; @@ -258,13 +249,10 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, return aGeomShape; } - return readAttributes(aCafreader, - theResultBody, - theMaterials, - theMaterialShape, - theError); - } catch (OSD_Exception&) { - //Try to load STEP file without colors... + return readAttributes(aCafreader, theResultBody, theMaterials, + theMaterialShape, theError); + } catch (OSD_Exception &) { + // Try to load STEP file without colors... return STEPImport(theFileName, "", theScalInterUnits, theError); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h index 850089c8e..2208ff698 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_STEPIMPORT_H_ @@ -22,28 +23,26 @@ #include -#include #include +#include #include - /// Implementation of the import STEP files algorithms GEOMALGOAPI_EXPORT -std::shared_ptr STEPImport(const std::string& theFileName, - const std::string& theFormatName, +std::shared_ptr STEPImport(const std::string &theFileName, + const std::string &theFormatName, const bool theScalInterUnits, - std::string& theError); + std::string &theError); -/// Implementation of the import STEP files algorithms with Attributs (Name, Color, Materials) +/// Implementation of the import STEP files algorithms with Attributs (Name, +/// Color, Materials) GEOMALGOAPI_EXPORT -GeomShapePtr STEPImportAttributs(const std::string& theFileName, - std::shared_ptr theResultBody, - const bool theScalInterUnits, - const bool theMaterials, - const bool theColor, - std::map< std::wstring, - std::list>& theMaterialShape, - std::string& theError); +GeomShapePtr STEPImportAttributs( + const std::string &theFileName, + std::shared_ptr theResultBody, + const bool theScalInterUnits, const bool theMaterials, const bool theColor, + std::map> &theMaterialShape, + std::string &theError); #endif /* GEOMALGOAPI_STEPIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp index 6fa5b5b5b..952086e00 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -32,54 +33,54 @@ #include #include -#include #include +#include #include #include #include +#include #include -#include #include -#include +#include #include +#include #include #include +#include #include #include #include -#include -#include #include // read geometry -std::shared_ptr setGeom(const Handle(XCAFDoc_ShapeTool) &shapeTool, - const TDF_Label &theLabel, - std::string& theError); +std::shared_ptr +setGeom(const Handle(XCAFDoc_ShapeTool) & shapeTool, const TDF_Label &theLabel, + std::string &theError); /// read attributs for label -void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, - const Handle(XCAFDoc_ColorTool) &theColorTool, - const Handle(XCAFDoc_MaterialTool) &TheMaterialTool, - const TDF_Label &theLabel, - const TopLoc_Location &theLoc, - std::shared_ptr theResultBody, - std::map< std::wstring, std::list> &theMaterialShape, - bool theIsRef); +void setShapeAttributes( + const Handle(XCAFDoc_ShapeTool) & theShapeTool, + const Handle(XCAFDoc_ColorTool) & theColorTool, + const Handle(XCAFDoc_MaterialTool) & TheMaterialTool, + const TDF_Label &theLabel, const TopLoc_Location &theLoc, + std::shared_ptr theResultBody, + std::map> &theMaterialShape, + bool theIsRef); // store Materiel for theShapeLabel in the map theMaterialShape -void storeMaterial(std::shared_ptr theResultBody, - const Handle(Standard_Transient) &theEnti, - const TopTools_IndexedMapOfShape &theIndices, - const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &theShapeLabel, - std::map< std::wstring, std::list> &theMaterialShape); +void storeMaterial( + std::shared_ptr theResultBody, + const Handle(Standard_Transient) & theEnti, + const TopTools_IndexedMapOfShape &theIndices, + const Handle(Transfer_TransientProcess) & theTP, + const TDF_Label &theShapeLabel, + std::map> &theMaterialShape); //============================================================================= -TopoDS_Shape getShape(const Handle(Standard_Transient) &theEnti, - const Handle(Transfer_TransientProcess) &theTP) -{ +TopoDS_Shape getShape(const Handle(Standard_Transient) & theEnti, + const Handle(Transfer_TransientProcess) & theTP) { TopoDS_Shape aResult; Handle(Transfer_Binder) aBinder = theTP->Find(theEnti); @@ -93,29 +94,33 @@ TopoDS_Shape getShape(const Handle(Standard_Transient) &theEnti, } //============================================================================= -std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, - std::shared_ptr theResultBody, - const bool theIsMaterials, - std::map< std::wstring,std::list> &theMaterialShape, - std::string& theError) -{ +std::shared_ptr readAttributes( + STEPCAFControl_Reader &theReader, + std::shared_ptr theResultBody, + const bool theIsMaterials, + std::map> &theMaterialShape, + std::string &theError) { // dummy XCAF Application to handle the STEP XCAF Document Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication(); // XCAF Document to contain the STEP/IGES file itself Handle(TDocStd_Document) adoc; - dummy_app->NewDocument( TCollection_ExtendedString("MDTV-CAF"), adoc); + dummy_app->NewDocument(TCollection_ExtendedString("MDTV-CAF"), adoc); // transfer STEP/IGES into the document, and get the main label theReader.Transfer(adoc); TDF_Label mainLabel = adoc->Main(); - Handle_XCAFDoc_ShapeTool shapeTool = XCAFDoc_DocumentTool::ShapeTool(mainLabel); - Handle_XCAFDoc_ColorTool colorTool = XCAFDoc_DocumentTool::ColorTool(mainLabel); - Handle(XCAFDoc_MaterialTool) materialTool = XCAFDoc_DocumentTool::MaterialTool(mainLabel); + Handle_XCAFDoc_ShapeTool shapeTool = + XCAFDoc_DocumentTool::ShapeTool(mainLabel); + Handle_XCAFDoc_ColorTool colorTool = + XCAFDoc_DocumentTool::ColorTool(mainLabel); + Handle(XCAFDoc_MaterialTool) materialTool = + XCAFDoc_DocumentTool::MaterialTool(mainLabel); // traverse the labels recursively to set attributes on shapes setShapeAttributes(shapeTool, colorTool, materialTool, mainLabel, - TopLoc_Location(),theResultBody,theMaterialShape,false); + TopLoc_Location(), theResultBody, theMaterialShape, false); - std::shared_ptr ageom = setGeom(shapeTool,mainLabel,theError); + std::shared_ptr ageom = + setGeom(shapeTool, mainLabel, theError); STEPControl_Reader aReader = theReader.ChangeReader(); @@ -135,7 +140,8 @@ std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, Handle(Standard_Transient) enti = Model->Value(ie); // Store materials. - storeMaterial(theResultBody,enti, anIndices, TP, mainLabel,theMaterialShape); + storeMaterial(theResultBody, enti, anIndices, TP, mainLabel, + theMaterialShape); } } } @@ -145,10 +151,9 @@ std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, } //============================================================================= -std::shared_ptr setGeom(const Handle(XCAFDoc_ShapeTool) &theShapeTool, - const TDF_Label& /*theLabel*/, - std::string& theError) -{ +std::shared_ptr +setGeom(const Handle(XCAFDoc_ShapeTool) & theShapeTool, + const TDF_Label & /*theLabel*/, std::string &theError) { BRep_Builder aB; TopoDS_Compound aCompound; aB.MakeCompound(aCompound); @@ -159,24 +164,25 @@ std::shared_ptr setGeom(const Handle(XCAFDoc_ShapeTool) &theShape std::shared_ptr aGeomShape(new GeomAPI_Shape); if (aFrshapes.Length() == 0) { - aGeomShape->setImpl(new TopoDS_Shape()); - return aGeomShape; + aGeomShape->setImpl(new TopoDS_Shape()); + return aGeomShape; } else if (aFrshapes.Length() == 1) { TopoDS_Shape shape = theShapeTool->GetShape(aFrshapes.Value(1)); aGeomShape->setImpl(new TopoDS_Shape(shape)); return aGeomShape; } else { - for (Standard_Integer i=1; i<=aFrshapes.Length(); i++) { + for (Standard_Integer i = 1; i <= aFrshapes.Length(); i++) { TopoDS_Shape aS = theShapeTool->GetShape(aFrshapes.Value(i)); TDF_Label aLabel = theShapeTool->FindShape(aS, Standard_False); - if ( (!aLabel.IsNull()) && (theShapeTool->IsShape(aLabel)) ) { - if (theShapeTool->IsFree(aLabel) ) { + if ((!aLabel.IsNull()) && (theShapeTool->IsShape(aLabel))) { + if (theShapeTool->IsFree(aLabel)) { if (aS.IsNull()) { continue; } else { - if (aS.ShapeType() != TopAbs_SOLID && !theShapeTool->IsReference(aLabel)){ - for(TDF_ChildIterator anIt(aLabel); anIt.More(); anIt.Next()) { - aB.Add(aCompound, theShapeTool->GetShape(anIt.Value()) ); + if (aS.ShapeType() != TopAbs_SOLID && + !theShapeTool->IsReference(aLabel)) { + for (TDF_ChildIterator anIt(aLabel); anIt.More(); anIt.Next()) { + aB.Add(aCompound, theShapeTool->GetShape(anIt.Value())); } } else { aB.Add(aCompound, aS); @@ -188,7 +194,7 @@ std::shared_ptr setGeom(const Handle(XCAFDoc_ShapeTool) &theShape TopoDS_Shape aShape = aCompound; // Check if any BRep entity has been read, there must be at least a vertex - if (!TopExp_Explorer( aShape, TopAbs_VERTEX ).More()) { + if (!TopExp_Explorer(aShape, TopAbs_VERTEX).More()) { theError = "No geometrical data in the imported file."; aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; @@ -199,22 +205,22 @@ std::shared_ptr setGeom(const Handle(XCAFDoc_ShapeTool) &theShape } } //============================================================================= -void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, - const Handle(XCAFDoc_ColorTool) &theColorTool, - const Handle(XCAFDoc_MaterialTool) &theMaterialTool, - const TDF_Label &theLabel, - const TopLoc_Location &theLoc, - std::shared_ptr theResultBody, - std::map< std::wstring,std::list> &theMaterialShape, - bool theIsRef) -{ +void setShapeAttributes( + const Handle(XCAFDoc_ShapeTool) & theShapeTool, + const Handle(XCAFDoc_ColorTool) & theColorTool, + const Handle(XCAFDoc_MaterialTool) & theMaterialTool, + const TDF_Label &theLabel, const TopLoc_Location &theLoc, + std::shared_ptr theResultBody, + std::map> &theMaterialShape, + bool theIsRef) { std::wstring aShapeName; Handle(TDataStd_Name) aN; if (theLabel.FindAttribute(TDataStd_Name::GetID(), aN)) { TCollection_ExtendedString aName = aN->Get(); - aShapeName = Locale::Convert::toWString(TCollection_AsciiString(aName).ToCString()) ; + aShapeName = + Locale::Convert::toWString(TCollection_AsciiString(aName).ToCString()); } TopLoc_Location aPartLoc = theLoc; @@ -227,32 +233,34 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, } TDF_Label aRef; - if (theShapeTool->IsReference(theLabel) && theShapeTool->GetReferredShape(theLabel, aRef)) { + if (theShapeTool->IsReference(theLabel) && + theShapeTool->GetReferredShape(theLabel, aRef)) { - setShapeAttributes( theShapeTool, theColorTool, theMaterialTool, aRef, - aPartLoc,theResultBody,theMaterialShape,true); + setShapeAttributes(theShapeTool, theColorTool, theMaterialTool, aRef, + aPartLoc, theResultBody, theMaterialShape, true); } - if (theShapeTool->IsSimpleShape(theLabel) && (theIsRef || theShapeTool->IsFree(theLabel))) { + if (theShapeTool->IsSimpleShape(theLabel) && + (theIsRef || theShapeTool->IsFree(theLabel))) { TopoDS_Shape aShape = theShapeTool->GetShape(theLabel); std::shared_ptr aShapeGeom(new GeomAPI_Shape); if (!theLoc.IsIdentity()) { - aShape.Move(theLoc); + aShape.Move(theLoc); } aShapeGeom->setImpl(new TopoDS_Shape(aShape)); aShapeName = theResultBody->addShapeName(aShapeGeom, aShapeName); - aShape.Location(theIsRef ? theLoc : aPartLoc); - int aDim = - (aShape.ShapeType() == TopAbs_VERTEX) ? - 0 : - (aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE) ? - 1 : - (aShape.ShapeType() == TopAbs_FACE || - aShape.ShapeType() == TopAbs_SHELL) ? 2 :3; + int aDim = (aShape.ShapeType() == TopAbs_VERTEX) ? 0 + : (aShape.ShapeType() == TopAbs_EDGE || + aShape.ShapeType() == TopAbs_WIRE) + ? 1 + : (aShape.ShapeType() == TopAbs_FACE || + aShape.ShapeType() == TopAbs_SHELL) + ? 2 + : 3; Handle(TCollection_HAsciiString) aMatName; Handle(TCollection_HAsciiString) aMatDescription; @@ -260,9 +268,11 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, Handle(TCollection_HAsciiString) aMatDensName; Handle(TCollection_HAsciiString) aMatDensValType; - if (theMaterialTool->GetMaterial(theLabel, aMatName, aMatDescription, aMatDensity, - aMatDensName, aMatDensValType)) { - std::wstring aNameMaterial = Locale::Convert::toWString(aMatName->ToCString()); + if (theMaterialTool->GetMaterial(theLabel, aMatName, aMatDescription, + aMatDensity, aMatDensName, + aMatDensValType)) { + std::wstring aNameMaterial = + Locale::Convert::toWString(aMatName->ToCString()); theMaterialShape[aNameMaterial].push_back(aShapeName); } @@ -270,15 +280,15 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, Quantity_Color aCol; if (theColorTool->GetColor(theLabel, XCAFDoc_ColorGen, aCol)) { double r = aCol.Red(), g = aCol.Green(), b = aCol.Blue(); - std::vector ColRGB = {int(r*255),int(g*255),int(b*255)}; + std::vector ColRGB = {int(r * 255), int(g * 255), int(b * 255)}; theResultBody->addShapeColor(aShapeName, ColRGB); } else if (theColorTool->GetColor(theLabel, XCAFDoc_ColorSurf, aCol)) { double r = aCol.Red(), g = aCol.Green(), b = aCol.Blue(); - std::vector aColRGB = {int(r*255),int(g*255),int(b*255)}; + std::vector aColRGB = {int(r * 255), int(g * 255), int(b * 255)}; theResultBody->addShapeColor(aShapeName, aColRGB); } else if (theColorTool->GetColor(theLabel, XCAFDoc_ColorCurv, aCol)) { double aR = aCol.Red(), aG = aCol.Green(), aB = aCol.Blue(); - std::vector aColRGB = {int(aR*255),int(aG*255),int(aB*255)}; + std::vector aColRGB = {int(aR * 255), int(aG * 255), int(aB * 255)}; theResultBody->addShapeColor(aShapeName, aColRGB); } // check explicit coloring of boundary entities @@ -286,54 +296,57 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, TopExp_Explorer aXp2(aShape, TopAbs_FACE); while (aXp2.More()) { if (theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorGen, aCol) || - theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorSurf, aCol) || - theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorCurv, aCol)) { + theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorSurf, aCol) || + theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorCurv, aCol)) { double aR = aCol.Red(), aG = aCol.Green(), aB = aCol.Blue(); TopoDS_Face aFace = TopoDS::Face(aXp2.Current()); - std::vector aColRGB = {int(aR*255),int(aG*255),int(aB*255)}; + std::vector aColRGB = {int(aR * 255), int(aG * 255), + int(aB * 255)}; std::wstringstream aNameFace; TopoDS_Shape aShapeface = aXp2.Current(); - if (!theLoc.IsIdentity()){ - aShapeface.Move(theLoc); + if (!theLoc.IsIdentity()) { + aShapeface.Move(theLoc); } aShapeGeom->setImpl(new TopoDS_Shape(aShapeface)); theResultBody->addShapeColor( - theResultBody->addShapeName(aShapeGeom , aNameFace.str()), aColRGB); + theResultBody->addShapeName(aShapeGeom, aNameFace.str()), + aColRGB); } aXp2.Next(); } } } else { - if (!theShapeTool->IsReference(theLabel) ){ + if (!theShapeTool->IsReference(theLabel)) { TopoDS_Shape aShape = theShapeTool->GetShape(theLabel); std::shared_ptr aShapeGeom(new GeomAPI_Shape); - if (!theLoc.IsIdentity()){ - aShape.Move(theLoc); + if (!theLoc.IsIdentity()) { + aShape.Move(theLoc); } aShapeGeom->setImpl(new TopoDS_Shape(aShape)); aShapeName = theResultBody->addShapeName(aShapeGeom, aShapeName); } - for(TDF_ChildIterator anIt(theLabel); anIt.More(); anIt.Next()) { + for (TDF_ChildIterator anIt(theLabel); anIt.More(); anIt.Next()) { - setShapeAttributes( theShapeTool, theColorTool, theMaterialTool, - anIt.Value(), aPartLoc,theResultBody,theMaterialShape, theIsRef); + setShapeAttributes(theShapeTool, theColorTool, theMaterialTool, + anIt.Value(), aPartLoc, theResultBody, + theMaterialShape, theIsRef); } } } //============================================================================= -void storeMaterial( std::shared_ptr theResultBody, - const Handle(Standard_Transient) &theEnti, - const TopTools_IndexedMapOfShape &theIndices, - const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &/*theShapeLabel*/, - std::map< std::wstring, std::list> &theMaterialShape ) -{ +void storeMaterial( + std::shared_ptr theResultBody, + const Handle(Standard_Transient) & theEnti, + const TopTools_IndexedMapOfShape &theIndices, + const Handle(Transfer_TransientProcess) & theTP, + const TDF_Label & /*theShapeLabel*/, + std::map> &theMaterialShape) { // Treat Product Definition Shape only. Handle(StepRepr_ProductDefinitionShape) aPDS = - Handle(StepRepr_ProductDefinitionShape)::DownCast(theEnti); - Handle(StepBasic_ProductDefinition) aProdDef; + Handle(StepRepr_ProductDefinitionShape)::DownCast(theEnti); + Handle(StepBasic_ProductDefinition) aProdDef; if (!aPDS.IsNull()) { // Product Definition Shape ==> Product Definition @@ -342,22 +355,22 @@ void storeMaterial( std::shared_ptr theResultBody, if (!aProdDef.IsNull()) { // Product Definition ==> Property Definition - const Interface_Graph &aGraph = theTP->Graph(); - Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef); - TopoDS_Shape aShape; + const Interface_Graph &aGraph = theTP->Graph(); + Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef); + TopoDS_Shape aShape; - for(aSubs.Start(); aSubs.More(); aSubs.Next()) { + for (aSubs.Start(); aSubs.More(); aSubs.Next()) { Handle(StepRepr_PropertyDefinition) aPropD = - Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value()); + Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value()); if (!aPropD.IsNull()) { // Property Definition ==> Representation. Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD); - for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) { + for (aSubs1.Start(); aSubs1.More(); aSubs1.Next()) { Handle(StepRepr_PropertyDefinitionRepresentation) aPDR = - Handle(StepRepr_PropertyDefinitionRepresentation):: - DownCast(aSubs1.Value()); + Handle(StepRepr_PropertyDefinitionRepresentation)::DownCast( + aSubs1.Value()); if (!aPDR.IsNull()) { // Property Definition ==> Material Name. @@ -366,20 +379,21 @@ void storeMaterial( std::shared_ptr theResultBody, if (!aRepr.IsNull()) { Standard_Integer anIr; - for(anIr = 1; anIr <= aRepr->NbItems(); anIr++) { - Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(anIr); - Handle(StepRepr_DescriptiveRepresentationItem) aDRI = - Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI); + for (anIr = 1; anIr <= aRepr->NbItems(); anIr++) { + Handle(StepRepr_RepresentationItem) aRI = + aRepr->ItemsValue(anIr); + Handle(StepRepr_DescriptiveRepresentationItem) aDRI = Handle( + StepRepr_DescriptiveRepresentationItem)::DownCast(aRI); if (!aDRI.IsNull()) { // Get shape from Product Definition Handle(TCollection_HAsciiString) aMatName = aDRI->Name(); if (!aMatName.IsNull()) { - TCollection_ExtendedString - aMatNameExt (aMatName->ToCString()); + TCollection_ExtendedString aMatNameExt( + aMatName->ToCString()); if (aShape.IsNull()) { - //Get the shape. + // Get the shape. aShape = getShape(aProdDef, theTP); if (aShape.IsNull()) { return; @@ -394,12 +408,14 @@ void storeMaterial( std::shared_ptr theResultBody, TopoDS_Shape aSub = theIndices.FindKey(anISub); if (aSub.IsPartner(aShape)) { - std::shared_ptr aShapeGeom(new GeomAPI_Shape); + std::shared_ptr aShapeGeom( + new GeomAPI_Shape); aShapeGeom->setImpl(new TopoDS_Shape(aSub)); - std::wstring aNom = theResultBody->findShapeName(aShapeGeom); - std::wstring aMName= Locale::Convert::toWString(aMatName->ToCString()); + std::wstring aNom = + theResultBody->findShapeName(aShapeGeom); + std::wstring aMName = + Locale::Convert::toWString(aMatName->ToCString()); theMaterialShape[aMName].push_back(aNom); - } } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h index 37c416141..2db6a947b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_STEPIMPORTXCAF_H_ @@ -27,10 +28,10 @@ #include /// read Attributs of step file -std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, - std::shared_ptr theResultBody, - const bool theMaterials, - std::map< std::wstring,std::list> &theMaterialShape, - std::string& theError); +std::shared_ptr readAttributes( + STEPCAFControl_Reader &theReader, + std::shared_ptr theResultBody, const bool theMaterials, + std::map> &theMaterialShape, + std::string &theError); #endif /* GEOMALGOAPI_STEPIMPORTXCAF_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp index 1c742269f..4e5a1ad06 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_STLExport.h" @@ -24,64 +25,57 @@ #include // OOCT includes +#include #include +#include +#include +#include #include #include -#include -#include -#include -#include - +#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y)) +#define MAX3(X, Y, Z) (MAX2(MAX2(X, Y), Z)) -#define MAX2(X, Y) ( Abs(X) > Abs(Y) ? Abs(X) : Abs(Y) ) -#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X, Y) , Z ) ) - -bool STLExport(const std::string& theFileName, - const std::shared_ptr& theShape, - const double theDeflection, - const bool theIsRelative, - const bool theIsASCII, - std::string& theError) -{ - #ifdef _DEBUG +bool STLExport(const std::string &theFileName, + const std::shared_ptr &theShape, + const double theDeflection, const bool theIsRelative, + const bool theIsASCII, std::string &theError) { +#ifdef _DEBUG std::cout << "Export STl into file " << theFileName << std::endl; - #endif +#endif if (!theShape.get()) { theError = "STl Export failed: An invalid argument"; return false; } - try - { + try { double aDeflection = theDeflection; StlAPI_Writer aWriter; // copy source shape - BRepBuilderAPI_Copy aCopy( theShape->impl(), Standard_False ); + BRepBuilderAPI_Copy aCopy(theShape->impl(), Standard_False); TopoDS_Shape aCopyShape = aCopy.Shape(); // ASCII mode aWriter.ASCIIMode() = theIsASCII; - if ( theIsRelative ) { + if (theIsRelative) { Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; Bnd_Box aBndBox; - BRepBndLib::Add( theShape->impl(), aBndBox ); - aBndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ); - aDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * theDeflection; + BRepBndLib::Add(theShape->impl(), aBndBox); + aBndBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + aDeflection = + MAX3(aXmax - aXmin, aYmax - aYmin, aZmax - aZmin) * theDeflection; } - //Compute triangulation - BRepTools::Clean( aCopyShape ); - BRepMesh_IncrementalMesh aMesh( aCopyShape, aDeflection ); + // Compute triangulation + BRepTools::Clean(aCopyShape); + BRepMesh_IncrementalMesh aMesh(aCopyShape, aDeflection); - if (!aWriter.Write( aCopyShape, theFileName.c_str())) { + if (!aWriter.Write(aCopyShape, theFileName.c_str())) { theError = "STL Export failed"; return false; } return true; - } - catch( Standard_Failure ) - { + } catch (Standard_Failure) { theError = "Exception catched in STlExport"; } return false; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h index 0721dd01a..345691593 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_STLEXPORT_H_ @@ -28,11 +29,9 @@ /// Implementation of the export STL files algorithms GEOMALGOAPI_EXPORT -bool STLExport(const std::string& theFileName, - const std::shared_ptr& theShape, - const double theDeflection, - const bool theIsRelative, - const bool theIsASCII, - std::string& theError); +bool STLExport(const std::string &theFileName, + const std::shared_ptr &theShape, + const double theDeflection, const bool theIsRelative, + const bool theIsASCII, std::string &theError); #endif /* GEOMALGOAPI_STLEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp index dde034d0c..65b464168 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,23 +24,20 @@ #include -#include -#include -#include #include #include #include +#include +#include +#include -std::shared_ptr STLImport(const std::string& theFileName, - std::string& theError) -{ +std::shared_ptr STLImport(const std::string &theFileName, + std::string &theError) { TopoDS_Shape aResShape; StlAPI_Reader aReader; - try - { - if(!aReader.Read(aResShape, theFileName.c_str())) - { + try { + if (!aReader.Read(aResShape, theFileName.c_str())) { theError = "Can't import file."; aResShape.Nullify(); } @@ -52,15 +50,13 @@ std::shared_ptr STLImport(const std::string& theFileName, if (!aSewedShape.IsNull()) aResShape = aSewedShape; #endif - if(aResShape.ShapeType() == TopAbs_SHELL) - { + if (aResShape.ShapeType() == TopAbs_SHELL) { BRepBuilderAPI_MakeSolid soliMaker(TopoDS::Shell(aResShape)); soliMaker.Build(); - if(soliMaker.IsDone()) + if (soliMaker.IsDone()) aResShape = soliMaker.Shape(); } - } - catch (Standard_Failure const& anException) { + } catch (Standard_Failure const &anException) { theError = anException.GetMessageString(); aResShape.Nullify(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h index 9d48aeb2a..ae9334f1f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_STLIMPORT_H_ #define GEOMALGOAPI_STLPIMPORT_H_ -#include #include +#include #include /// Implementation of the import STL files algorithms GEOMALGOAPI_EXPORT -std::shared_ptr STLImport(const std::string& theFileName, - std::string& theError); +std::shared_ptr STLImport(const std::string &theFileName, + std::string &theError); #endif /* GEOMALGOAPI_STLIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp index 4ff4790f1..5658d1e57 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,10 +25,9 @@ #include //================================================================================================= -GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - double theScaleFactor) -{ +GeomAlgoAPI_Scale::GeomAlgoAPI_Scale( + std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, double theScaleFactor) { if (!theCenterPoint) { myError = "Scale builder :: center point is not valid."; return; @@ -44,12 +44,10 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr theSourceSha } //================================================================================================= -GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - double theScaleFactorX, - double theScaleFactorY, - double theScaleFactorZ) -{ +GeomAlgoAPI_Scale::GeomAlgoAPI_Scale( + std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, double theScaleFactorX, + double theScaleFactorY, double theScaleFactorZ) { if (!theCenterPoint) { myError = "Scale builder :: center point is not valid."; return; @@ -67,28 +65,25 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr theSourceSha return; } - buildByDimensions(theSourceShape, theCenterPoint, - theScaleFactorX, theScaleFactorY, theScaleFactorZ); + buildByDimensions(theSourceShape, theCenterPoint, theScaleFactorX, + theScaleFactorY, theScaleFactorZ); } //================================================================================================= -void GeomAlgoAPI_Scale::buildByDimensions(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - double theScaleFactorX, - double theScaleFactorY, - double theScaleFactorZ) -{ +void GeomAlgoAPI_Scale::buildByDimensions( + std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, double theScaleFactorX, + double theScaleFactorY, double theScaleFactorZ) { if (!theSourceShape) { myError = "Scale builder :: source shape is not valid."; return; } - const gp_Pnt& aCenterPoint = theCenterPoint->impl(); + const gp_Pnt &aCenterPoint = theCenterPoint->impl(); // Perform the rotation matrix - gp_Mat aMatRot(theScaleFactorX, 0., 0., - 0., theScaleFactorY, 0., - 0., 0., theScaleFactorZ); + gp_Mat aMatRot(theScaleFactorX, 0., 0., 0., theScaleFactorY, 0., 0., 0., + theScaleFactorZ); // Perform the tranformation gp_GTrsf aGTrsf; @@ -100,16 +95,18 @@ void GeomAlgoAPI_Scale::buildByDimensions(std::shared_ptr theSour aGTrsf = aGTrsf0P.Multiplied(aGTrsf); aGTrsf = aGTrsf.Multiplied(aGTrsfP0); - const TopoDS_Shape& aSourceShape = theSourceShape->impl(); + const TopoDS_Shape &aSourceShape = theSourceShape->impl(); - if(aSourceShape.IsNull()) { - myError = "Scale builder :: source shape does not contain any actual shape."; + if (aSourceShape.IsNull()) { + myError = + "Scale builder :: source shape does not contain any actual shape."; return; } // Transform the shape while copying it. - BRepBuilderAPI_GTransform* aBuilder = new BRepBuilderAPI_GTransform(aSourceShape, aGTrsf, true); - if(!aBuilder) { + BRepBuilderAPI_GTransform *aBuilder = + new BRepBuilderAPI_GTransform(aSourceShape, aGTrsf, true); + if (!aBuilder) { myError = "Scale builder :: transform initialization failed."; return; } @@ -117,7 +114,7 @@ void GeomAlgoAPI_Scale::buildByDimensions(std::shared_ptr theSour setImpl(aBuilder); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - if(!aBuilder->IsDone()) { + if (!aBuilder->IsDone()) { myError = "Scale builder :: algorithm failed."; return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h index c8b58b767..886601ff8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_SCALE_H_ @@ -27,39 +28,41 @@ class GeomAPI_Pnt; /// \class GeomAlgoAPI_Scale /// \ingroup DataAlgo -/// \brief Creates a copy of the object by performing a scale operation by a factor or +/// \brief Creates a copy of the object by performing a scale operation by a +/// factor or /// by dimensions. -class GeomAlgoAPI_Scale : public GeomAlgoAPI_Transform -{ +class GeomAlgoAPI_Scale : public GeomAlgoAPI_Transform { public: - /// \brief Creates an object which is obtained from current object by performing + /// \brief Creates an object which is obtained from current object by + /// performing /// a scale operation by a factor. /// \param[in] theSourceShape the shape to be moved. /// \param[in] theCenterPoint the center point. /// \param[in] theFactor the scale factor. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Scale(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - double theScaleFactor); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Scale(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + double theScaleFactor); - /// \brief Creates an object which is obtained from current object by performing + /// \brief Creates an object which is obtained from current object by + /// performing /// a scale operation by dimensions. /// \param[in] theSourceShape the shape to be moved. /// \param[in] theCenterPoint the center point. /// \param[in] theFactorX the scale factor in X. /// \param[in] theFactorY the scale factor in Y. /// \param[in] theFactorZ the scale factor in Z. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Scale(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - double theScaleFactorX, - double theScaleFactorY, - double theScaleFactorZ); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Scale(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + double theScaleFactorX, double theScaleFactorY, + double theScaleFactorZ); private: void buildByDimensions(std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - double theScaleFactorX, - double theScaleFactorY, - double theScaleFactorZ); + std::shared_ptr theCenterPoint, + double theScaleFactorX, double theScaleFactorY, + double theScaleFactorZ); }; -#endif // GEOMALGOAPI_SCALE_H_ \ No newline at end of file +#endif // GEOMALGOAPI_SCALE_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp index 6b3115c2b..197c253f5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp @@ -14,65 +14,66 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Sewing.h" -#include #include #include +#include #include #include #include //================================================================================================== -GeomAlgoAPI_Sewing::GeomAlgoAPI_Sewing(const ListOfShape& theShapes) -{ +GeomAlgoAPI_Sewing::GeomAlgoAPI_Sewing(const ListOfShape &theShapes) { myBuildShell = true; build(theShapes); } -GeomAlgoAPI_Sewing::GeomAlgoAPI_Sewing(const ListOfShape& theShapes, const bool theAllowNonManifold, const double theTolerance) -{ +GeomAlgoAPI_Sewing::GeomAlgoAPI_Sewing(const ListOfShape &theShapes, + const bool theAllowNonManifold, + const double theTolerance) { myBuildShell = false; build(theShapes, theAllowNonManifold, theTolerance); } -void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes, const bool theAllowNonManifold, const double theTolerance) -{ - if(theShapes.empty()) { +void GeomAlgoAPI_Sewing::build(const ListOfShape &theShapes, + const bool theAllowNonManifold, + const double theTolerance) { + if (theShapes.empty()) { return; } - BRepBuilderAPI_Sewing* aSewingBuilder = new BRepBuilderAPI_Sewing(); + BRepBuilderAPI_Sewing *aSewingBuilder = new BRepBuilderAPI_Sewing(); this->setImpl(aSewingBuilder); - if (!myBuildShell) - { + if (!myBuildShell) { aSewingBuilder->SetTolerance(theTolerance); aSewingBuilder->SetFaceMode(Standard_True); aSewingBuilder->SetFloatingEdgesMode(Standard_False); aSewingBuilder->SetNonManifoldMode(theAllowNonManifold); } - for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) { - const TopoDS_Shape& aShape = (*anIt)->impl(); + for (ListOfShape::const_iterator anIt = theShapes.cbegin(); + anIt != theShapes.cend(); ++anIt) { + const TopoDS_Shape &aShape = (*anIt)->impl(); aSewingBuilder->Add(aShape); } aSewingBuilder->Perform(); TopoDS_Shape aResult = aSewingBuilder->SewedShape(); - if (myBuildShell) - { + if (myBuildShell) { BRep_Builder aBuilder; - if(aResult.ShapeType() == TopAbs_COMPOUND) { + if (aResult.ShapeType() == TopAbs_COMPOUND) { TopoDS_Compound aResultCompound; aBuilder.MakeCompound(aResultCompound); - for(TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { + for (TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { const TopoDS_Shape aSubShape = anIt.Value(); - if(aSubShape.ShapeType() == TopAbs_SHELL) { + if (aSubShape.ShapeType() == TopAbs_SHELL) { aBuilder.Add(aResultCompound, aSubShape); } else if (aSubShape.ShapeType() == TopAbs_FACE) { TopoDS_Shell aShell; @@ -82,7 +83,7 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes, const bool theAllow } } aResult = aResultCompound; - } else if(aResult.ShapeType() == TopAbs_FACE) { + } else if (aResult.ShapeType() == TopAbs_FACE) { TopoDS_Shell aShell; aBuilder.MakeShell(aShell); aBuilder.Add(aShell, aResult); @@ -100,21 +101,22 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes, const bool theAllow #include void GeomAlgoAPI_Sewing::modified(const std::shared_ptr theShape, - ListOfShape& theHistory) -{ - if(!theShape.get()) { + ListOfShape &theHistory) { + if (!theShape.get()) { return; } - const TopoDS_Shape& aShape = theShape->impl(); - const BRepBuilderAPI_Sewing& aSewingBuilder = this->impl(); + const TopoDS_Shape &aShape = theShape->impl(); + const BRepBuilderAPI_Sewing &aSewingBuilder = + this->impl(); TopoDS_Shape aModifiedShape = aSewingBuilder.Modified(aShape); - if(aModifiedShape.IsEqual(aShape)) { + if (aModifiedShape.IsEqual(aShape)) { aModifiedShape = aSewingBuilder.ModifiedSubShape(aShape); } - for(TopExp_Explorer anExp(aModifiedShape, aShape.ShapeType()); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aModifiedShape, aShape.ShapeType()); anExp.More(); + anExp.Next()) { GeomShapePtr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(anExp.Current())); theHistory.push_back(aGeomShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h index 2c1e59cf2..b19cf79b5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Sewing_H_ @@ -29,31 +30,35 @@ /// \ingroup DataAlgo /// \brief Allows creation of connected topology (shells) /// from a set of separate topological elements (faces). -class GeomAlgoAPI_Sewing : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Sewing : public GeomAlgoAPI_MakeShape { public: /// Constructor (used by MakeShell). /// \param[in] theShapes list of selected shapes. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Sewing(const ListOfShape& theShapes); + GEOMALGOAPI_EXPORT GeomAlgoAPI_Sewing(const ListOfShape &theShapes); /// Constructor with additional arguments (used by Sewing feature) /// \param[in] theShapes list of selected shapes. /// \param[in] theAllowNonManifold if True, non-manifold results are allowed. /// \param[in] theTolerance tolerance value used for the sewing operation. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Sewing(const ListOfShape& theShapes, const bool theAllowNonManifold, const double theTolerance); + GEOMALGOAPI_EXPORT GeomAlgoAPI_Sewing(const ListOfShape &theShapes, + const bool theAllowNonManifold, + const double theTolerance); /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theShape base shape. /// \param[out] theHistory modified shapes. - GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr theShape, - ListOfShape& theHistory); + GEOMALGOAPI_EXPORT virtual void + modified(const std::shared_ptr theShape, + ListOfShape &theHistory); protected: - bool myBuildShell; // whether algorithm is used by MakeShell or by Sewing - + bool myBuildShell; // whether algorithm is used by MakeShell or by Sewing + private: /// Builds resulting shape. - void build(const ListOfShape& theShapes, const bool theAllowNonManifold = false, const double theTolerance = 1.e-6); + void build(const ListOfShape &theShapes, + const bool theAllowNonManifold = false, + const double theTolerance = 1.e-6); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp index 1a8ac0d1a..054261d91 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_ShapeAPI.h" @@ -36,8 +37,7 @@ #include -static GeomShapePtr runAlgo(GeomAlgoAPI_MakeShape& theAlgo) -{ +static GeomShapePtr runAlgo(GeomAlgoAPI_MakeShape &theAlgo) { if (!theAlgo.check()) throw GeomAlgoAPI_Exception(theAlgo.getError()); @@ -49,8 +49,8 @@ static GeomShapePtr runAlgo(GeomAlgoAPI_MakeShape& theAlgo) return theAlgo.shape(); } -static GeomShapePtr runAlgoAndCheckShape(GeomAlgoAPI_MakeShape& theAlgo, const std::string& theMsg) -{ +static GeomShapePtr runAlgoAndCheckShape(GeomAlgoAPI_MakeShape &theAlgo, + const std::string &theMsg) { if (!theAlgo.check()) throw GeomAlgoAPI_Exception(theAlgo.getError()); @@ -62,469 +62,452 @@ static GeomShapePtr runAlgoAndCheckShape(GeomAlgoAPI_MakeShape& theAlgo, const s return theAlgo.shape(); } -namespace GeomAlgoAPI_ShapeAPI -{ - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeBox( - const double theDx, const double theDy, - const double theDz) - { - static const std::string aMsg("Box builder with dimensions"); - GeomAlgoAPI_Box aBoxAlgo(theDx,theDy,theDz); - return runAlgoAndCheckShape(aBoxAlgo, aMsg); - } +namespace GeomAlgoAPI_ShapeAPI { +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeBox(const double theDx, const double theDy, + const double theDz) { + static const std::string aMsg("Box builder with dimensions"); + GeomAlgoAPI_Box aBoxAlgo(theDx, theDy, theDz); + return runAlgoAndCheckShape(aBoxAlgo, aMsg); +} + +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeBox(std::shared_ptr theFirstPoint, + std::shared_ptr theSecondPoint) { + static const std::string aMsg("Box builder with two points"); + GeomAlgoAPI_Box aBoxAlgo(theFirstPoint, theSecondPoint); + return runAlgoAndCheckShape(aBoxAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeBox( - std::shared_ptr theFirstPoint, - std::shared_ptr theSecondPoint) - { - static const std::string aMsg("Box builder with two points"); - GeomAlgoAPI_Box aBoxAlgo(theFirstPoint, theSecondPoint); - return runAlgoAndCheckShape(aBoxAlgo, aMsg); +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeCylinder(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, + double theRadius, double theHeight) { + // Check if the base point is OK + if (!theBasePoint) { + throw GeomAlgoAPI_Exception( + "Cylinder builder :: the base point is not valid."); + } + // Check if the edge is OK + if (!theEdge) { + throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid."); } - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCylinder( - std::shared_ptr theBasePoint, std::shared_ptr theEdge, - double theRadius, double theHeight) - { - // Check if the base point is OK - if (!theBasePoint) { - throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid."); - } - // Check if the edge is OK - if (!theEdge) { - throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid."); - } + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(theBasePoint, theEdge->line()->direction())); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(theBasePoint, - theEdge->line()->direction())); + GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight); - GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight); + static const std::string aMsg("Cylinder builder"); + return runAlgoAndCheckShape(aCylinderAlgo, aMsg); +} - static const std::string aMsg("Cylinder builder"); - return runAlgoAndCheckShape(aCylinderAlgo, aMsg); +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeCylinder(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, + double theRadius, double theHeight, + double theAngle) { + // Check if the base point is OK + if (!theBasePoint) { + throw GeomAlgoAPI_Exception( + "Cylinder builder :: the base point is not valid."); + } + // Check if the edge is OK + if (!theEdge) { + throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid."); } - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCylinder( - std::shared_ptr theBasePoint, std::shared_ptr theEdge, - double theRadius, double theHeight, double theAngle) - { - // Check if the base point is OK - if (!theBasePoint) { - throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid."); - } - // Check if the edge is OK - if (!theEdge) { - throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid."); - } + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(theBasePoint, theEdge->line()->direction())); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(theBasePoint, - theEdge->line()->direction())); + GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight, theAngle); - GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight, theAngle); + static const std::string aMsg("Cylinder portion builder"); + return runAlgoAndCheckShape(aCylinderAlgo, aMsg); +} - static const std::string aMsg("Cylinder portion builder"); - return runAlgoAndCheckShape(aCylinderAlgo, aMsg); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeCylinder(double theRadius, double theHeight) { + std::shared_ptr aBasePoint = + std::shared_ptr(new GeomAPI_Pnt(0., 0., 0.)); + std::shared_ptr aEdge = + GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(aBasePoint, aEdge->line()->direction())); + + GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight); + + static const std::string aMsg("Cylinder builder"); + return runAlgoAndCheckShape(aCylinderAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCylinder( - double theRadius, double theHeight) - { - std::shared_ptr aBasePoint = - std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); - std::shared_ptr aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(aBasePoint, - aEdge->line()->direction())); - - GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight); - - static const std::string aMsg("Cylinder builder"); - return runAlgoAndCheckShape(aCylinderAlgo, aMsg); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeCylinder(double theRadius, double theHeight, + double theAngle) { + std::shared_ptr aBasePoint = + std::shared_ptr(new GeomAPI_Pnt(0., 0., 0.)); + std::shared_ptr aEdge = + GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(aBasePoint, aEdge->line()->direction())); + + GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight, theAngle); + + static const std::string aMsg("Cylinder portion builder"); + return runAlgoAndCheckShape(aCylinderAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCylinder( - double theRadius, double theHeight, double theAngle) - { - std::shared_ptr aBasePoint = - std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); - std::shared_ptr aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(aBasePoint, - aEdge->line()->direction())); - - GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight, theAngle); - - static const std::string aMsg("Cylinder portion builder"); - return runAlgoAndCheckShape(aCylinderAlgo, aMsg); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeSphere(std::shared_ptr theCenterPoint, + double theRadius) { + static const std::string aMsg("Sphere builder"); + GeomAlgoAPI_Sphere aSphereAlgo(theCenterPoint, theRadius); + return runAlgoAndCheckShape(aSphereAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSphere( - std::shared_ptr theCenterPoint, double theRadius) - { - static const std::string aMsg("Sphere builder"); - GeomAlgoAPI_Sphere aSphereAlgo(theCenterPoint, theRadius); - return runAlgoAndCheckShape(aSphereAlgo, aMsg); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeSphere(double theRadius) { + std::shared_ptr aCenterPoint = + std::shared_ptr(new GeomAPI_Pnt(0., 0., 0.)); - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSphere(double theRadius) - { - std::shared_ptr aCenterPoint = - std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); + GeomAlgoAPI_Sphere aSphereAlgo(aCenterPoint, theRadius); - GeomAlgoAPI_Sphere aSphereAlgo(aCenterPoint, theRadius); + static const std::string aMsg("Sphere builder"); + return runAlgoAndCheckShape(aSphereAlgo, aMsg); +} - static const std::string aMsg("Sphere builder"); - return runAlgoAndCheckShape(aSphereAlgo, aMsg); +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeTorus(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, + double theRadius, double theRingRadius) { + // Check if the base point is OK + if (!theBasePoint) { + throw GeomAlgoAPI_Exception( + "Torus builder :: the base point is not valid."); + } + // Check if the edge is OK + if (!theEdge) { + throw GeomAlgoAPI_Exception("Torus builder :: the axis is not valid."); } - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTorus( - std::shared_ptr theBasePoint, - std::shared_ptr theEdge,double theRadius, double theRingRadius) - { - // Check if the base point is OK - if (!theBasePoint) { - throw GeomAlgoAPI_Exception("Torus builder :: the base point is not valid."); - } - // Check if the edge is OK - if (!theEdge) { - throw GeomAlgoAPI_Exception("Torus builder :: the axis is not valid."); - } + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(theBasePoint, theEdge->line()->direction())); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(theBasePoint, - theEdge->line()->direction())); + GeomAlgoAPI_Torus aTorusAlgo(anAxis, theRadius, theRingRadius); - GeomAlgoAPI_Torus aTorusAlgo(anAxis, theRadius, theRingRadius); + static const std::string aMsg("Torus builder"); + return runAlgoAndCheckShape(aTorusAlgo, aMsg); +} - static const std::string aMsg("Torus builder"); - return runAlgoAndCheckShape(aTorusAlgo, aMsg); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeTorus(double theRadius, double theRingRadius) { + std::shared_ptr aBasePoint = + std::shared_ptr(new GeomAPI_Pnt(0., 0., 0.)); + std::shared_ptr aEdge = + GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(aBasePoint, aEdge->line()->direction())); + + GeomAlgoAPI_Torus aTorusAlgo(anAxis, theRadius, theRingRadius); + + static const std::string aMsg("Torus builder"); + return runAlgoAndCheckShape(aTorusAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTorus(double theRadius, - double theRingRadius) - { - std::shared_ptr aBasePoint = - std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); - std::shared_ptr aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(aBasePoint, - aEdge->line()->direction())); - - GeomAlgoAPI_Torus aTorusAlgo(anAxis, theRadius, theRingRadius); - - static const std::string aMsg("Torus builder"); - return runAlgoAndCheckShape(aTorusAlgo, aMsg); +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeCone(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, + double theBaseRadius, double theTopRadius, + double theHeight) { + // Check if the base point is OK + if (!theBasePoint) { + throw GeomAlgoAPI_Exception("Cone builder :: the base point is not valid."); + } + // Check if the edge is OK + if (!theEdge) { + throw GeomAlgoAPI_Exception("Cone builder :: the axis is not valid."); } - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCone( - std::shared_ptr theBasePoint, - std::shared_ptr theEdge, - double theBaseRadius, double theTopRadius, - double theHeight) - { - // Check if the base point is OK - if (!theBasePoint) { - throw GeomAlgoAPI_Exception("Cone builder :: the base point is not valid."); - } - // Check if the edge is OK - if (!theEdge) { - throw GeomAlgoAPI_Exception("Cone builder :: the axis is not valid."); - } - - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(theBasePoint, - theEdge->line()->direction())); + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(theBasePoint, theEdge->line()->direction())); - GeomAlgoAPI_Cone aConeAlgo(anAxis, theBaseRadius, theTopRadius, theHeight); + GeomAlgoAPI_Cone aConeAlgo(anAxis, theBaseRadius, theTopRadius, theHeight); - static const std::string aMsg("Cone builder"); - return runAlgoAndCheckShape(aConeAlgo, aMsg); - } + static const std::string aMsg("Cone builder"); + return runAlgoAndCheckShape(aConeAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCone( - double theBaseRadius, double theTopRadius, - double theHeight) - { - std::shared_ptr aBasePoint = - std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); - std::shared_ptr aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); - std::shared_ptr anAxis; - anAxis = std::shared_ptr(new GeomAPI_Ax2(aBasePoint, - aEdge->line()->direction())); - - GeomAlgoAPI_Cone aConeAlgo(anAxis, theBaseRadius, theTopRadius, theHeight); - - static const std::string aMsg("Cone builder"); - return runAlgoAndCheckShape(aConeAlgo, aMsg); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeCone(double theBaseRadius, double theTopRadius, + double theHeight) { + std::shared_ptr aBasePoint = + std::shared_ptr(new GeomAPI_Pnt(0., 0., 0.)); + std::shared_ptr aEdge = + GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.); + std::shared_ptr anAxis; + anAxis = std::shared_ptr( + new GeomAPI_Ax2(aBasePoint, aEdge->line()->direction())); + + GeomAlgoAPI_Cone aConeAlgo(anAxis, theBaseRadius, theTopRadius, theHeight); + + static const std::string aMsg("Cone builder"); + return runAlgoAndCheckShape(aConeAlgo, aMsg); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theDistance) - { - GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theAxis, theDistance); - return runAlgo(aTranslationAlgo); - } + std::shared_ptr theAxis, const double theDistance) { + GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theAxis, + theDistance); + return runAlgo(aTranslationAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( - std::shared_ptr theSourceShape, - const double theDx, - const double theDy, - const double theDz) - { - GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theDx, theDy, theDz); - return runAlgo(aTranslationAlgo); - } +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( + std::shared_ptr theSourceShape, const double theDx, + const double theDy, const double theDz) { + GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theDx, theDy, theDz); + return runAlgo(aTranslationAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( std::shared_ptr theSourceShape, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint) - { - GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theStartPoint, theEndPoint); - return runAlgo(aTranslationAlgo); - } + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint) { + GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theStartPoint, + theEndPoint); + return runAlgo(aTranslationAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeRotation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeRotation( std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theAngle) - { - GeomAlgoAPI_Rotation aRotationAlgo(theSourceShape, theAxis, theAngle); - return runAlgo(aRotationAlgo); - } + std::shared_ptr theAxis, const double theAngle) { + GeomAlgoAPI_Rotation aRotationAlgo(theSourceShape, theAxis, theAngle); + return runAlgo(aRotationAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeRotation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeRotation( std::shared_ptr theSourceShape, std::shared_ptr theCenterPoint, std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint) - { - GeomAlgoAPI_Rotation aRotationAlgo(theSourceShape, theCenterPoint, theStartPoint, theEndPoint); - return runAlgo(aRotationAlgo); - } + std::shared_ptr theEndPoint) { + GeomAlgoAPI_Rotation aRotationAlgo(theSourceShape, theCenterPoint, + theStartPoint, theEndPoint); + return runAlgo(aRotationAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSymmetry( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSymmetry( std::shared_ptr theSourceShape, - std::shared_ptr thePoint) - { - GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePoint); - return runAlgo(aSymmetryAlgo); - } + std::shared_ptr thePoint) { + GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePoint); + return runAlgo(aSymmetryAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSymmetry( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSymmetry( std::shared_ptr theSourceShape, - std::shared_ptr theAxis) - { - GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, theAxis); - return runAlgo(aSymmetryAlgo); - } + std::shared_ptr theAxis) { + GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, theAxis); + return runAlgo(aSymmetryAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSymmetry( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeSymmetry( std::shared_ptr theSourceShape, - std::shared_ptr thePlane) - { - GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePlane); - return runAlgo(aSymmetryAlgo); - } + std::shared_ptr thePlane) { + GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePlane); + return runAlgo(aSymmetryAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeScale( - std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - const double theScaleFactor) - { - GeomAlgoAPI_Scale aScaleAlgo(theSourceShape, theCenterPoint, theScaleFactor); - return runAlgo(aScaleAlgo); - } +//=============================================================================================== +std::shared_ptr +GeomAlgoAPI_ShapeAPI::makeScale(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + const double theScaleFactor) { + GeomAlgoAPI_Scale aScaleAlgo(theSourceShape, theCenterPoint, theScaleFactor); + return runAlgo(aScaleAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeScale( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeScale( std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - const double theScaleFactorX, - const double theScaleFactorY, - const double theScaleFactorZ) - { - GeomAlgoAPI_Scale aScaleAlgo(theSourceShape, theCenterPoint, - theScaleFactorX, theScaleFactorY, theScaleFactorZ); - return runAlgo(aScaleAlgo); - } + std::shared_ptr theCenterPoint, const double theScaleFactorX, + const double theScaleFactorY, const double theScaleFactorZ) { + GeomAlgoAPI_Scale aScaleAlgo(theSourceShape, theCenterPoint, theScaleFactorX, + theScaleFactorY, theScaleFactorZ); + return runAlgo(aScaleAlgo); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiTranslation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiTranslation( std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theStep, - const int theNumber) - { - if (!theAxis) { - std::string aError = "Multitranslation builder "; - aError+=":: the first axis is not valid"; - throw GeomAlgoAPI_Exception(aError); - } + std::shared_ptr theAxis, const double theStep, + const int theNumber) { + if (!theAxis) { + std::string aError = "Multitranslation builder "; + aError += ":: the first axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } - if (theNumber <=0) { - std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the first direction is null or negative."; - throw GeomAlgoAPI_Exception(aError); - } + if (theNumber <= 0) { + std::string aError = "Multitranslation builder "; + aError += + ":: the number of copies for the first direction is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } - ListOfShape aListOfShape; - for (int i=0; i GeomAlgoAPI_ShapeAPI::makeMultiTranslation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiTranslation( std::shared_ptr theSourceShape, - std::shared_ptr theFirstAxis, - const double theFirstStep, - const int theFirstNumber, - std::shared_ptr theSecondAxis, - const double theSecondStep, - const int theSecondNumber) - { - if (!theFirstAxis) { - std::string aError = "Multitranslation builder "; - aError+=":: the first axis is not valid"; - throw GeomAlgoAPI_Exception(aError); - } + std::shared_ptr theFirstAxis, const double theFirstStep, + const int theFirstNumber, std::shared_ptr theSecondAxis, + const double theSecondStep, const int theSecondNumber) { + if (!theFirstAxis) { + std::string aError = "Multitranslation builder "; + aError += ":: the first axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } - if (!theSecondAxis) { - std::string aError = "Multitranslation builder "; - aError+=":: the second axis is not valid"; - throw GeomAlgoAPI_Exception(aError); - } + if (!theSecondAxis) { + std::string aError = "Multitranslation builder "; + aError += ":: the second axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } - if (theFirstNumber <=0) { - std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the first direction is null or negative."; - throw GeomAlgoAPI_Exception(aError); - } + if (theFirstNumber <= 0) { + std::string aError = "Multitranslation builder "; + aError += + ":: the number of copies for the first direction is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } - if (theSecondNumber <=0) { - std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the second direction is null or negative."; - throw GeomAlgoAPI_Exception(aError); - } + if (theSecondNumber <= 0) { + std::string aError = "Multitranslation builder "; + aError += + ":: the number of copies for the second direction is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } - // Coord theFirstAxis - double x1 = theFirstAxis->dir()->x(); - double y1 = theFirstAxis->dir()->y(); - double z1 = theFirstAxis->dir()->z(); - double norm1 = sqrt(x1*x1 + y1*y1 + z1*z1); - - // Coord theSecondAxis - double x2 = theSecondAxis->dir()->x(); - double y2 = theSecondAxis->dir()->y(); - double z2 = theSecondAxis->dir()->z(); - double norm2 = sqrt(x2*x2 + y2*y2 + z2*z2); - - ListOfShape aListOfShape; - for (int j=0; jdir()->x(); + double y1 = theFirstAxis->dir()->y(); + double z1 = theFirstAxis->dir()->z(); + double norm1 = sqrt(x1 * x1 + y1 * y1 + z1 * z1); + + // Coord theSecondAxis + double x2 = theSecondAxis->dir()->x(); + double y2 = theSecondAxis->dir()->y(); + double z2 = theSecondAxis->dir()->z(); + double norm2 = sqrt(x2 * x2 + y2 * y2 + z2 * z2); + + ListOfShape aListOfShape; + for (int j = 0; j < theSecondStep; j++) { + for (int i = 0; i < theFirstNumber; i++) { + double dx = + i * theFirstStep * x1 / norm1 + j * theSecondStep * x2 / norm2; + double dy = + i * theFirstStep * y1 / norm1 + j * theSecondStep * y2 / norm2; + double dz = + i * theFirstStep * z1 / norm1 + j * theSecondStep * z2 / norm2; + aListOfShape.push_back( + GeomAlgoAPI_ShapeAPI::makeTranslation(theSourceShape, dx, dy, dz)); } - return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); } + return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); +} - //=============================================================================================== - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiRotation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiRotation( std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const int theNumber) - { - if (!theAxis) { - std::string aError = "Multirotation builder "; - aError+=":: the axis is not valid"; - throw GeomAlgoAPI_Exception(aError); - } + std::shared_ptr theAxis, const int theNumber) { + if (!theAxis) { + std::string aError = "Multirotation builder "; + aError += ":: the axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } - if (theNumber <=0) { - std::string aError = "Multirotation builder "; - aError+=":: the number of copies is null or negative."; - throw GeomAlgoAPI_Exception(aError); - } + if (theNumber <= 0) { + std::string aError = "Multirotation builder "; + aError += ":: the number of copies is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } - double anAngle = 360./theNumber; + double anAngle = 360. / theNumber; - ListOfShape aListOfShape; - for (int i=0; i GeomAlgoAPI_ShapeAPI::makeMultiRotation( +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiRotation( std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theStep, - const int theNumber) - { - if (!theAxis) { - std::string aError = "Multirotation builder "; - aError+=":: the axis is not valid"; - throw GeomAlgoAPI_Exception(aError); - } - - if (theNumber <=0) { - std::string aError = "Multirotation builder "; - aError+=":: the number of copies is null or negative."; - throw GeomAlgoAPI_Exception(aError); - } + std::shared_ptr theAxis, const double theStep, + const int theNumber) { + if (!theAxis) { + std::string aError = "Multirotation builder "; + aError += ":: the axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } - ListOfShape aListOfShape; - for (int i=0; i GeomAlgoAPI_ShapeAPI::makeConeSegment( - const double theRMin1, const double theRMax1, - const double theRMin2, const double theRMax2, - const double theZ, - const double theStartPhi, const double theDeltaPhi) - { - GeomAlgoAPI_ConeSegment aConeSegmentAlgo(theRMin1, theRMax1, theRMin2, theRMax2, - theZ, theStartPhi, theDeltaPhi); - - static const std::string aMsg("Cone Segment builder"); - return runAlgoAndCheckShape(aConeSegmentAlgo, aMsg); + ListOfShape aListOfShape; + for (int i = 0; i < theNumber; i++) { + aListOfShape.push_back(GeomAlgoAPI_ShapeAPI::makeRotation( + theSourceShape, theAxis, i * theStep)); } + return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); +} + +//=============================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeAPI::makeConeSegment( + const double theRMin1, const double theRMax1, const double theRMin2, + const double theRMax2, const double theZ, const double theStartPhi, + const double theDeltaPhi) { + GeomAlgoAPI_ConeSegment aConeSegmentAlgo( + theRMin1, theRMax1, theRMin2, theRMax2, theZ, theStartPhi, theDeltaPhi); + + static const std::string aMsg("Cone Segment builder"); + return runAlgoAndCheckShape(aConeSegmentAlgo, aMsg); } +} // namespace GeomAlgoAPI_ShapeAPI diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h index 376f46b5f..daac67fcb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_SHAPEAPI_H @@ -32,65 +33,67 @@ #pragma warning(disable : 4290) #endif -namespace GeomAlgoAPI_ShapeAPI -{ +namespace GeomAlgoAPI_ShapeAPI { /**\class GeomAlgoAPI_ShapeAPI * \ingroup DataAlgo * \brief Allows to access the direct API */ -class GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeAPI -{ +class GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeAPI { public: /// Creates a box using the dimensions. /// \param theDx The dimension on X /// \param theDy The dimension on Y /// \param theDz The dimension on Z /// \return a shape - static std::shared_ptr makeBox(const double theDx, const double theDy, - const double theDz); + static std::shared_ptr + makeBox(const double theDx, const double theDy, const double theDz); /// Creates a box using the two points that defined a diagonal. /// \param theFirstPoint One extermity of the diagonal /// \param theSecondPoint The other extremity of the diagonal /// \return a shape - static std::shared_ptr makeBox(std::shared_ptr theFirstPoint, - std::shared_ptr theSecondPoint); + static std::shared_ptr + makeBox(std::shared_ptr theFirstPoint, + std::shared_ptr theSecondPoint); /// Creates a cylinder using a center, an axis, a radius and a height. /// \param theBasePoint The center of the lower base of the cylinder /// \param theEdge The axis of the cylinder /// \param theRadius The radius of the cylinder /// \param theHeight The heigth of the cylinder - static std::shared_ptr makeCylinder(std::shared_ptr theBasePoint, - std::shared_ptr theEdge, double theRadius, double theHeight); + static std::shared_ptr + makeCylinder(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, double theRadius, + double theHeight); - /// Creates a portion of cylinder using a center, an axis, a radius, a height and an angle. - /// \param theBasePoint The center of the lower base of the cylinder - /// \param theEdge The axis of the cylinder - /// \param theRadius The radius of the cylinder - /// \param theHeight The heigth of the cylinder - /// \param theAngle The angle defining the portion - static std::shared_ptr makeCylinder(std::shared_ptr theBasePoint, - std::shared_ptr theEdge, double theRadius, double theHeight, - double theAngle); + /// Creates a portion of cylinder using a center, an axis, a radius, a height + /// and an angle. \param theBasePoint The center of the lower base of the + /// cylinder \param theEdge The axis of the cylinder \param theRadius The + /// radius of the cylinder \param theHeight The heigth of the cylinder \param + /// theAngle The angle defining the portion + static std::shared_ptr + makeCylinder(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, double theRadius, + double theHeight, double theAngle); /// Creates a cylinder using the origin, the OZ axis, a radius and a height. /// \param theRadius The radius of the cylinder /// \param theHeight The heigth of the cylinder - static std::shared_ptr makeCylinder(double theRadius, double theHeight); + static std::shared_ptr makeCylinder(double theRadius, + double theHeight); - /// Creates a portion of cylinder using the origin, the OZ axis, a radius, a height and an angle. - /// \param theRadius The radius of the cylinder - /// \param theHeight The heigth of the cylinder - /// \param theAngle The angle defining the portion - static std::shared_ptr makeCylinder(double theRadius, double theHeight, - double theAngle); + /// Creates a portion of cylinder using the origin, the OZ axis, a radius, a + /// height and an angle. \param theRadius The radius of the cylinder \param + /// theHeight The heigth of the cylinder \param theAngle The angle defining + /// the portion + static std::shared_ptr + makeCylinder(double theRadius, double theHeight, double theAngle); /// Creates a sphere using a center and a radius. /// \param theCenterPoint The center of the sphere /// \param theRadius The radius of the sphere - static std::shared_ptr makeSphere(std::shared_ptr theCenterPoint, - double theRadius); + static std::shared_ptr + makeSphere(std::shared_ptr theCenterPoint, double theRadius); /// Creates a sphere using the origin and a radius. /// \param theRadius The radius of the sphere @@ -101,40 +104,44 @@ public: /// \param theEdge The axis of the torus /// \param theRadius The radius of the torus /// \param theRingRadius The ring radius of the torus - static std::shared_ptr makeTorus(std::shared_ptr theBasePoint, - std::shared_ptr theEdge, double theRadius, double theRingRadius); + static std::shared_ptr + makeTorus(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, double theRadius, + double theRingRadius); /// Creates a torus using a radius and a ring radius. /// \param theRadius The radius of the torus /// \param theRingRadius The ring radius of the torus - static std::shared_ptr makeTorus(double theRadius, double theRingRadius); + static std::shared_ptr makeTorus(double theRadius, + double theRingRadius); - /// Creates a cone using a base point, an axis, a base radius, a top radius and a height. - /// \param theBasePoint The center of the lower base of the cone + /// Creates a cone using a base point, an axis, a base radius, a top radius + /// and a height. \param theBasePoint The center of the lower base of the cone /// \param theEdge The axis of the cone /// \param theBaseRadius The base radius of the cone /// \param theTopRadius The top radius of the cone /// \param theHeight The height of the cone - static std::shared_ptr makeCone(std::shared_ptr theBasePoint, - std::shared_ptr theEdge, double theBaseRadius, - double theTopRadius, double theHeight); + static std::shared_ptr + makeCone(std::shared_ptr theBasePoint, + std::shared_ptr theEdge, double theBaseRadius, + double theTopRadius, double theHeight); /// Creates a cone using a base radius, a top radius and a height. /// \param theBaseRadius The base radius of the cone /// \param theTopRadius The top radius of the cone /// \param theHeight The height of the cone - static std::shared_ptr makeCone(double theBaseRadius, double theTopRadius, - double theHeight); + static std::shared_ptr + makeCone(double theBaseRadius, double theTopRadius, double theHeight); /// Performs a translation from an axis and a distance. /// \param theSourceShape Shape to be moved /// \param theAxis Movement axis /// \param theDistance Movement distance /// \return a shape - static std::shared_ptr makeTranslation( - std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theDistance); + static std::shared_ptr + makeTranslation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + const double theDistance); /// Performs a translation from dimensions. /// \param theSourceShape Shape to be moved @@ -142,31 +149,28 @@ public: /// \param theDy Movement dimension on Y /// \param theDz Movement dimension on Z /// \return a shape - static std::shared_ptr makeTranslation( - std::shared_ptr theSourceShape, - const double theDx, - const double theDy, - const double theDz); + static std::shared_ptr + makeTranslation(std::shared_ptr theSourceShape, + const double theDx, const double theDy, const double theDz); /// Performs a translation from two points. /// \param theSourceShape Shape to be moved /// \param theStartPoint Movement start point /// \param theEndPoint Movement end point /// \return a shape - static std::shared_ptr makeTranslation( - std::shared_ptr theSourceShape, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint); + static std::shared_ptr + makeTranslation(std::shared_ptr theSourceShape, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint); /// Performs a rotation from an axis and an angle. /// \param theSourceShape Shape to be rotated /// \param theAxis Movement axis /// \param theAngle Movement angle /// \return a shape - static std::shared_ptr makeRotation( - std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theAngle); + static std::shared_ptr + makeRotation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, const double theAngle); /// Performs a rotation from three points. /// \param theSourceShape Shape to be rotated @@ -174,41 +178,41 @@ public: /// \param theStartPoint Movement start point /// \param theEndPoint Movement end point /// \return a shape - static std::shared_ptr makeRotation( - std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint); + static std::shared_ptr + makeRotation(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint); /// Performs a symmetry by a point. /// \param theSourceShape Shape be symmetrized /// \param thePoint Point of symmetry - static std::shared_ptr makeSymmetry( - std::shared_ptr theSourceShape, - std::shared_ptr thePoint); + static std::shared_ptr + makeSymmetry(std::shared_ptr theSourceShape, + std::shared_ptr thePoint); /// Performs a symmetry by an axis. /// \param theSourceShape Shape be symmetrized /// \param theAxis Axis of symmetry - static std::shared_ptr makeSymmetry( - std::shared_ptr theSourceShape, - std::shared_ptr theAxis); + static std::shared_ptr + makeSymmetry(std::shared_ptr theSourceShape, + std::shared_ptr theAxis); /// Performs a symmetry by a plane. /// \param theSourceShape Shape be symmetrized /// \param thePlane Plane of symmetry - static std::shared_ptr makeSymmetry( - std::shared_ptr theSourceShape, - std::shared_ptr thePlane); + static std::shared_ptr + makeSymmetry(std::shared_ptr theSourceShape, + std::shared_ptr thePlane); /// Performs a scale by a scale factor. /// \param theSourceShape Shape be scaled /// \param theCenterPoint Point of scale /// \param theScaleFactor Factor of scale - static std::shared_ptr makeScale( - std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - const double theScaleFactor); + static std::shared_ptr + makeScale(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + const double theScaleFactor); /// Performs a scale by dimensions. /// \param theSourceShape Shape be scaled @@ -216,63 +220,52 @@ public: /// \param theScaleFactorX Factor of scale in X /// \param theScaleFactorY Factor of scale in Y /// \param theScaleFactorZ Factor of scale in Z - static std::shared_ptr makeScale( - std::shared_ptr theSourceShape, - std::shared_ptr theCenterPoint, - const double theScaleFactorX, - const double theScaleFactorY, - const double theScaleFactorZ); + static std::shared_ptr + makeScale(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + const double theScaleFactorX, const double theScaleFactorY, + const double theScaleFactorZ); - /// Performs a multi translation along one axis, at a distance and a number of times - /// \param theSourceShape Shape to be moved - /// \param theAxis Movement axis + /// Performs a multi translation along one axis, at a distance and a number of + /// times \param theSourceShape Shape to be moved \param theAxis Movement axis /// \param theStep Movement step /// \param theNumber Movement number /// \return a shape - static std::shared_ptr makeMultiTranslation( - std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theStep, - const int theNumber); + static std::shared_ptr + makeMultiTranslation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + const double theStep, const int theNumber); - /// Performs a multi translation along two axis : a different distance on each axis - /// and a different number of times for each axis - /// \param theSourceShape Shape to be moved - /// \param theFirstAxis First movement axis - /// \param theFirstStep First movement step - /// \param theFirstNumber First movement number - /// \param theSecondAxis First movement axis - /// \param theSecondStep First movement step - /// \param theSecondNumber First movement number - /// \return a shape - static std::shared_ptr makeMultiTranslation( - std::shared_ptr theSourceShape, - std::shared_ptr theFirstAxis, - const double theFirstStep, - const int theFirstNumber, - std::shared_ptr theSecondAxis, - const double theSecondStep, - const int theSecondNumber); + /// Performs a multi translation along two axis : a different distance on each + /// axis and a different number of times for each axis \param theSourceShape + /// Shape to be moved \param theFirstAxis First movement axis \param + /// theFirstStep First movement step \param theFirstNumber First movement + /// number \param theSecondAxis First movement axis \param theSecondStep First + /// movement step \param theSecondNumber First movement number \return a shape + static std::shared_ptr + makeMultiTranslation(std::shared_ptr theSourceShape, + std::shared_ptr theFirstAxis, + const double theFirstStep, const int theFirstNumber, + std::shared_ptr theSecondAxis, + const double theSecondStep, const int theSecondNumber); /// Performs a multi rotation along one axis and a number of times /// \param[in] theSourceShape Shape to be rotated /// \param[in] theAxis Axis for the rotation /// \param[in] theNumber Number of copies - static std::shared_ptr makeMultiRotation( - std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const int theNumber); + static std::shared_ptr + makeMultiRotation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, const int theNumber); /// Performs a multi rotation along one axis, at a step and a number of times /// \param theSourceShape Shape to be moved /// \param[in] theAxis Axis for the rotation /// \param[in] theStep Angle for each rotation /// \param[in] theNumber Number of copies - static std::shared_ptr makeMultiRotation( - std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - const double theStep, - const int theNumber); + static std::shared_ptr + makeMultiRotation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, const double theStep, + const int theNumber); /// Creates a cone segment using standard GDML parameters. /// \param theRMin1 Inner radius at base of cone @@ -282,14 +275,11 @@ public: /// \param theZ Height of cone segment /// \param theStartPhi Start angle of the segment /// \param theDeltaPhi Angle of the segment - static std::shared_ptr makeConeSegment( - const double theRMin1, - const double theRMax1, - const double theRMin2, - const double theRMax2, - const double theZ, - const double theStartPhi, - const double theDeltaPhi); + static std::shared_ptr + makeConeSegment(const double theRMin1, const double theRMax1, + const double theRMin2, const double theRMax2, + const double theZ, const double theStartPhi, + const double theDeltaPhi); }; -} +} // namespace GeomAlgoAPI_ShapeAPI #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp index 7bb9ec255..d7d546e5d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_ShapeBuilder.h" @@ -23,10 +24,10 @@ #include -#include #include #include #include +#include #include #include #include @@ -35,57 +36,55 @@ #include //================================================================================================== -void GeomAlgoAPI_ShapeBuilder::add(std::shared_ptr theShape, - const std::shared_ptr theShapeToAdd) -{ - if(!theShape.get() || !theShapeToAdd.get()) { +void GeomAlgoAPI_ShapeBuilder::add( + std::shared_ptr theShape, + const std::shared_ptr theShapeToAdd) { + if (!theShape.get() || !theShapeToAdd.get()) { return; } - TopoDS_Shape* aShape = theShape->implPtr(); - const TopoDS_Shape& aShapeToAdd = theShapeToAdd->impl(); + TopoDS_Shape *aShape = theShape->implPtr(); + const TopoDS_Shape &aShapeToAdd = theShapeToAdd->impl(); BRep_Builder aBuilder; aBuilder.Add(*aShape, aShapeToAdd); } - //================================================================================================== -void GeomAlgoAPI_ShapeBuilder::remove(std::shared_ptr theShape, - const std::shared_ptr theShapeToRemove) -{ - if(!theShape.get() || !theShapeToRemove.get()) { +void GeomAlgoAPI_ShapeBuilder::remove( + std::shared_ptr theShape, + const std::shared_ptr theShapeToRemove) { + if (!theShape.get() || !theShapeToRemove.get()) { return; } - TopoDS_Shape* aShape = theShape->implPtr(); - const TopoDS_Shape& aShapeToRemove = theShapeToRemove->impl(); + TopoDS_Shape *aShape = theShape->implPtr(); + const TopoDS_Shape &aShapeToRemove = theShapeToRemove->impl(); BRep_Builder aBuilder; aBuilder.Remove(*aShape, aShapeToRemove); } //================================================================================================== -GeomAlgoAPI_ShapeBuilder::GeomAlgoAPI_ShapeBuilder() -{ -} +GeomAlgoAPI_ShapeBuilder::GeomAlgoAPI_ShapeBuilder() {} //================================================================================================== -void GeomAlgoAPI_ShapeBuilder::removeInternal(const std::shared_ptr theShape) -{ +void GeomAlgoAPI_ShapeBuilder::removeInternal( + const std::shared_ptr theShape) { GeomShapePtr aResultShape; GeomAPI_Shape::ShapeType aBaseShapeType = theShape->shapeType(); - if(aBaseShapeType == GeomAPI_Shape::WIRE) { + if (aBaseShapeType == GeomAPI_Shape::WIRE) { aResultShape = theShape->emptyCopied(); - std::shared_ptr - aMakeShapeCustom(new GeomAlgoAPI_MakeShapeCustom()); - for(GeomAPI_ShapeIterator anIter(theShape); anIter.more(); anIter.next()) { + std::shared_ptr aMakeShapeCustom( + new GeomAlgoAPI_MakeShapeCustom()); + for (GeomAPI_ShapeIterator anIter(theShape); anIter.more(); anIter.next()) { GeomShapePtr aSubShape = anIter.current(); GeomShapePtr aSubShapeCopy = aSubShape->emptyCopied(); - for(GeomAPI_ShapeIterator aSubIter(aSubShape); aSubIter.more(); aSubIter.next()) { + for (GeomAPI_ShapeIterator aSubIter(aSubShape); aSubIter.more(); + aSubIter.next()) { GeomShapePtr aSubOfSubShape = aSubIter.current(); - if(aSubOfSubShape->orientation() != GeomAPI_Shape::INTERNAL) { + if (aSubOfSubShape->orientation() != GeomAPI_Shape::INTERNAL) { GeomAlgoAPI_ShapeBuilder::add(aSubShapeCopy, aSubOfSubShape); } } @@ -93,21 +92,21 @@ void GeomAlgoAPI_ShapeBuilder::removeInternal(const std::shared_ptrappendAlgo(aMakeShapeCustom); - } else if(aBaseShapeType == GeomAPI_Shape::FACE) { - const TopoDS_Shape& aBaseShape = theShape->impl(); - BRepBuilderAPI_Copy* aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); + } else if (aBaseShapeType == GeomAPI_Shape::FACE) { + const TopoDS_Shape &aBaseShape = theShape->impl(); + BRepBuilderAPI_Copy *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); this->appendAlgo(std::shared_ptr( - new GeomAlgoAPI_MakeShape(aCopyBuilder))); - if(!aCopyBuilder->IsDone()) { + new GeomAlgoAPI_MakeShape(aCopyBuilder))); + if (!aCopyBuilder->IsDone()) { return; } TopoDS_Shape aShape = aCopyBuilder->Shape(); TopoDS_Shape aShapeCopy = aShape.EmptyCopied(); BRep_Builder aBuilder; - for(TopoDS_Iterator anIt(aShape); anIt.More(); anIt.Next()) { - const TopoDS_Shape& aSubShape = anIt.Value(); - if(aSubShape.ShapeType() == TopAbs_WIRE - && aSubShape.Orientation() != TopAbs_INTERNAL) { + for (TopoDS_Iterator anIt(aShape); anIt.More(); anIt.Next()) { + const TopoDS_Shape &aSubShape = anIt.Value(); + if (aSubShape.ShapeType() == TopAbs_WIRE && + aSubShape.Orientation() != TopAbs_INTERNAL) { aBuilder.Add(aShapeCopy, aSubShape); } } @@ -120,39 +119,43 @@ void GeomAlgoAPI_ShapeBuilder::removeInternal(const std::shared_ptr theShape, - const ListOfShape& theShapesToAdd) -{ +void GeomAlgoAPI_ShapeBuilder::addInternal( + const std::shared_ptr theShape, + const ListOfShape &theShapesToAdd) { // Get base shape. - if(!theShape.get()) { + if (!theShape.get()) { return; } - const TopoDS_Shape& aBaseShape = theShape->impl(); + const TopoDS_Shape &aBaseShape = theShape->impl(); TopAbs_ShapeEnum aBaseShapeType = aBaseShape.ShapeType(); // Copy base shape. - BRepBuilderAPI_Copy* aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aCopyBuilder))); - if(!aCopyBuilder->IsDone()) { + BRepBuilderAPI_Copy *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aCopyBuilder))); + if (!aCopyBuilder->IsDone()) { return; } TopoDS_Shape aResultShape = aCopyBuilder->Shape(); // Copy sub-shapes from list to new shape. BRep_Builder aBuilder; - std::shared_ptr aMakeShapeCustom(new GeomAlgoAPI_MakeShapeCustom()); - for(ListOfShape::const_iterator - anIt = theShapesToAdd.cbegin(); anIt != theShapesToAdd.cend(); ++anIt) { + std::shared_ptr aMakeShapeCustom( + new GeomAlgoAPI_MakeShapeCustom()); + for (ListOfShape::const_iterator anIt = theShapesToAdd.cbegin(); + anIt != theShapesToAdd.cend(); ++anIt) { TopoDS_Shape aShapeToAdd = (*anIt)->impl(); TopoDS_Shape aModShapeToAdd = aShapeToAdd; aModShapeToAdd.Orientation(TopAbs_INTERNAL); - for(TopExp_Explorer aResExp(aResultShape, TopAbs_VERTEX); aResExp.More(); aResExp.Next()) { - const TopoDS_Vertex& aVertexInRes = TopoDS::Vertex(aResExp.Current()); + for (TopExp_Explorer aResExp(aResultShape, TopAbs_VERTEX); aResExp.More(); + aResExp.Next()) { + const TopoDS_Vertex &aVertexInRes = TopoDS::Vertex(aResExp.Current()); const gp_Pnt aPntInRes = BRep_Tool::Pnt(aVertexInRes); - for(TopExp_Explorer anAddExp(aShapeToAdd, TopAbs_VERTEX); anAddExp.More(); anAddExp.Next()) { - const TopoDS_Vertex& aVertexInAdd = TopoDS::Vertex(anAddExp.Current()); + for (TopExp_Explorer anAddExp(aShapeToAdd, TopAbs_VERTEX); + anAddExp.More(); anAddExp.Next()) { + const TopoDS_Vertex &aVertexInAdd = TopoDS::Vertex(anAddExp.Current()); const gp_Pnt aPntInAdd = BRep_Tool::Pnt(aVertexInAdd); - if(aPntInRes.Distance(aPntInAdd) < Precision::Confusion()) { + if (aPntInRes.Distance(aPntInAdd) < Precision::Confusion()) { BRepTools_ReShape aReShape; TopoDS_Shape aVertexInResMod = aVertexInRes; aVertexInResMod.Orientation(aVertexInAdd.Orientation()); @@ -170,15 +173,15 @@ void GeomAlgoAPI_ShapeBuilder::addInternal(const std::shared_ptr aShapeToAdd = aModShapeToAdd; TopAbs_ShapeEnum aShapeToAddType = aShapeToAdd.ShapeType(); - if(aBaseShapeType == TopAbs_WIRE) { - if(aShapeToAddType == TopAbs_VERTEX) { + if (aBaseShapeType == TopAbs_WIRE) { + if (aShapeToAddType == TopAbs_VERTEX) { // Find on which edge vertex is lie and add to this edge. - for(TopExp_Explorer - aResultExp(aResultShape, TopAbs_EDGE); aResultExp.More(); aResultExp.Next()) { + for (TopExp_Explorer aResultExp(aResultShape, TopAbs_EDGE); + aResultExp.More(); aResultExp.Next()) { TopoDS_Shape anEdge = aResultExp.Current(); BRepExtrema_DistShapeShape aDist(anEdge, aShapeToAdd); aDist.Perform(); - if(aDist.IsDone() && aDist.Value() <= Precision::Confusion()) { + if (aDist.IsDone() && aDist.Value() <= Precision::Confusion()) { aShapeToAdd.Orientation(TopAbs_INTERNAL); Standard_Boolean aFreeFlag = anEdge.Free(); anEdge.Free(Standard_True); @@ -188,8 +191,8 @@ void GeomAlgoAPI_ShapeBuilder::addInternal(const std::shared_ptr } } } - } else if(aBaseShapeType == TopAbs_FACE) { - if(aShapeToAddType == TopAbs_EDGE) { + } else if (aBaseShapeType == TopAbs_FACE) { + if (aShapeToAddType == TopAbs_EDGE) { aShapeToAdd.Orientation(TopAbs_INTERNAL); TopoDS_Wire aWire; aBuilder.MakeWire(aWire); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.h index be34d084f..ff005362f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_ShapeBuilder_H_ @@ -28,33 +29,36 @@ /// \class GeomAlgoAPI_ShapeBuilder /// \ingroup DataAlgo /// \brief Allows to add or remove subshapes from a shape. -class GeomAlgoAPI_ShapeBuilder: public GeomAlgoAPI_MakeShapeList -{ - public: - /// \brief Adds theShapeToAdd in theShape. - /// \param[in] theShape shape to modify. - /// \param[in] theShapeToAdd shape which will be added. - GEOMALGOAPI_EXPORT static void add(std::shared_ptr theShape, - const std::shared_ptr theShapeToAdd); - - /// \brief Removes theShapeToRemove in theShape. - /// \param[in] theShape shape to modify. - /// \param[in] theShapeToRemove shape which will be removed. - GEOMALGOAPI_EXPORT static void remove(std::shared_ptr theShape, - const std::shared_ptr theShapeToRemove); - - /// Creates empty builder. - GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeBuilder(); - - /// \brief Store new shape as result of removing internal shapes from theShape. - /// \param[in] theShape base shape. - GEOMALGOAPI_EXPORT void removeInternal(const std::shared_ptr theShape); - - /// \brief Store new shape as result of adding theShapesToAdd to theShape as internal shapes. - /// \param[in] theShape base shape. - /// \param[in] theShapesToAdd shapes which will be added. - GEOMALGOAPI_EXPORT void addInternal(const std::shared_ptr theShape, - const ListOfShape& theShapesToAdd); +class GeomAlgoAPI_ShapeBuilder : public GeomAlgoAPI_MakeShapeList { +public: + /// \brief Adds theShapeToAdd in theShape. + /// \param[in] theShape shape to modify. + /// \param[in] theShapeToAdd shape which will be added. + GEOMALGOAPI_EXPORT static void + add(std::shared_ptr theShape, + const std::shared_ptr theShapeToAdd); + + /// \brief Removes theShapeToRemove in theShape. + /// \param[in] theShape shape to modify. + /// \param[in] theShapeToRemove shape which will be removed. + GEOMALGOAPI_EXPORT static void + remove(std::shared_ptr theShape, + const std::shared_ptr theShapeToRemove); + + /// Creates empty builder. + GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeBuilder(); + + /// \brief Store new shape as result of removing internal shapes from + /// theShape. \param[in] theShape base shape. + GEOMALGOAPI_EXPORT void + removeInternal(const std::shared_ptr theShape); + + /// \brief Store new shape as result of adding theShapesToAdd to theShape as + /// internal shapes. \param[in] theShape base shape. \param[in] theShapesToAdd + /// shapes which will be added. + GEOMALGOAPI_EXPORT void + addInternal(const std::shared_ptr theShape, + const ListOfShape &theShapesToAdd); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp index 5579bf17e..215aac622 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp @@ -14,29 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_ShapeInfo.h" #include "GeomAlgoAPI_BoundingBox.h" +#include #include +#include +#include #include -#include #include +#include #include -#include -#include #include -#include -#include +#include #include #include -std::string GeomAlgoAPI_ShapeInfo::html(Translator* theTranslator) -{ +std::string GeomAlgoAPI_ShapeInfo::html(Translator *theTranslator) { Values aVal(TYPE_HTML); if (theTranslator) aVal.setTranslator(theTranslator); @@ -44,31 +44,27 @@ std::string GeomAlgoAPI_ShapeInfo::html(Translator* theTranslator) return aVal.html(); } -std::list GeomAlgoAPI_ShapeInfo::values() -{ +std::list GeomAlgoAPI_ShapeInfo::values() { Values aVal(TYPE_VALS); processShape(aVal); return aVal.values(); } -void GeomAlgoAPI_ShapeInfo::processShape(GeomAlgoAPI_ShapeInfo::Values& theVals) -{ +void GeomAlgoAPI_ShapeInfo::processShape( + GeomAlgoAPI_ShapeInfo::Values &theVals) { switch (myShape->shapeType()) { - case GeomAPI_Shape::VERTEX: - { + case GeomAPI_Shape::VERTEX: { GeomPointPtr aPoint = myShape->vertex()->point(); setShapeType("Vertex"); theVals.addPoint("Coordinates", myShape->vertex()->point()); break; } - case GeomAPI_Shape::EDGE: - { + case GeomAPI_Shape::EDGE: { GeomEdgePtr anEdge = myShape->edge(); processEdge(theVals, anEdge); break; } - case GeomAPI_Shape::FACE: - { + case GeomAPI_Shape::FACE: { GeomFacePtr aFace = myShape->face(); processFace(theVals, aFace); break; @@ -76,8 +72,7 @@ void GeomAlgoAPI_ShapeInfo::processShape(GeomAlgoAPI_ShapeInfo::Values& theVals) case GeomAPI_Shape::SOLID: // nearly same as SHELL if it is only one sub { ListOfShape aShells = myShape->subShapes(GeomAPI_Shape::SHELL); - if (aShells.size() == 1) - { + if (aShells.size() == 1) { GeomShapePtr aTmpShape = myShape; myShape = aShells.front(); processShape(theVals); @@ -87,22 +82,17 @@ void GeomAlgoAPI_ShapeInfo::processShape(GeomAlgoAPI_ShapeInfo::Values& theVals) setShapeType("Solid"); break; } - case GeomAPI_Shape::SHELL: - { + case GeomAPI_Shape::SHELL: { GeomShellPtr aShell = myShape->shell(); - if (GeomBoxPtr aBox = aShell->getParallelepiped()) - { + if (GeomBoxPtr aBox = aShell->getParallelepiped()) { if (aBox->isAxesAligned()) { setShapeType("Box"); - } - else { + } else { setShapeType("Rotated Box"); } - } - else { // check single face + } else { // check single face ListOfShape aFaces = myShape->subShapes(GeomAPI_Shape::FACE); - if (aFaces.size() == 1) - { + if (aFaces.size() == 1) { GeomFacePtr aFace = aFaces.front()->face(); processFace(theVals, aFace); } @@ -111,8 +101,7 @@ void GeomAlgoAPI_ShapeInfo::processShape(GeomAlgoAPI_ShapeInfo::Values& theVals) } break; } - case GeomAPI_Shape::WIRE: - { + case GeomAPI_Shape::WIRE: { theVals.addNamedValue("Closed", myShape->wire()->isClosed()); // check the wire is a polygon @@ -126,18 +115,16 @@ void GeomAlgoAPI_ShapeInfo::processShape(GeomAlgoAPI_ShapeInfo::Values& theVals) aStr << " " << (++aCornerIndex); theVals.addPoint(aStr.str().c_str(), *aPtIt); } - } - else // Common case + } else // Common case setShapeType("Wire"); break; } case GeomAPI_Shape::COMPSOLID: - case GeomAPI_Shape::COMPOUND: - { - setShapeType(myShape->shapeType() == GeomAPI_Shape::COMPSOLID ? "CompSolid" : "Compound"); + case GeomAPI_Shape::COMPOUND: { + setShapeType(myShape->shapeType() == GeomAPI_Shape::COMPSOLID ? "CompSolid" + : "Compound"); double aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - if (myShape->computeSize(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax)) - { + if (myShape->computeSize(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax)) { theVals.addGroupName("Bounding box"); GeomPointPtr aMinPoint(new GeomAPI_Pnt(aXmin, aYmin, aZmin)); theVals.addPoint("Minimal corner", aMinPoint); @@ -151,8 +138,7 @@ void GeomAlgoAPI_ShapeInfo::processShape(GeomAlgoAPI_ShapeInfo::Values& theVals) } } -void GeomAlgoAPI_ShapeInfo::processEdge(Values& theVals, GeomEdgePtr theEdge) -{ +void GeomAlgoAPI_ShapeInfo::processEdge(Values &theVals, GeomEdgePtr theEdge) { setShapeType("Edge"); // Common case if (theEdge->isDegenerated()) { theVals.addNamedValue("Degenerated", true); @@ -166,16 +152,14 @@ void GeomAlgoAPI_ShapeInfo::processEdge(Values& theVals, GeomEdgePtr theEdge) if (theEdge->isLine()) { setShapeType("Line segment"); addStartEndPoints = true; - } - else if (GeomCirclePtr aCircle = theEdge->circle()) { + } else if (GeomCirclePtr aCircle = theEdge->circle()) { addStartEndPoints = aStartPnt->distance(aEndPnt) >= Precision::Confusion(); setShapeType(addStartEndPoints ? "Arc of circle" : "Circle"); theVals.addPoint("Center", aCircle->center()); theVals.addDirection("Normal", aCircle->normal()); theVals.addGroupName("Dimensions"); theVals.addNamedValue("Radius", aCircle->radius()); - } - else if (GeomEllipsePtr anEllipse = theEdge->ellipse()) { + } else if (GeomEllipsePtr anEllipse = theEdge->ellipse()) { addStartEndPoints = aStartPnt->distance(aEndPnt) >= Precision::Confusion(); setShapeType(addStartEndPoints ? "Arc of ellipse" : "Ellipse"); theVals.addPoint("Center", anEllipse->center()); @@ -191,8 +175,7 @@ void GeomAlgoAPI_ShapeInfo::processEdge(Values& theVals, GeomEdgePtr theEdge) } } -void GeomAlgoAPI_ShapeInfo::processFace(Values& theVals, GeomFacePtr theFace) -{ +void GeomAlgoAPI_ShapeInfo::processFace(Values &theVals, GeomFacePtr theFace) { // Plane and planar face if (GeomPlanePtr aPlane = theFace->getPlane()) { bool isCommonCase = true; @@ -205,8 +188,7 @@ void GeomAlgoAPI_ShapeInfo::processFace(Values& theVals, GeomFacePtr theFace) isCommonCase = false; setShapeType("Disk"); } - } - else { + } else { // Check face bounded by a single wire which is rectangle aSubs = theFace->subShapes(GeomAPI_Shape::WIRE); if (aSubs.size() == 1) { @@ -243,8 +225,7 @@ void GeomAlgoAPI_ShapeInfo::processFace(Values& theVals, GeomFacePtr theFace) theVals.addNamedValue("Radius", aSphere->radius()); } // Cylinder - else if (GeomCylinderPtr aCylinder = theFace->getCylinder()) - { + else if (GeomCylinderPtr aCylinder = theFace->getCylinder()) { setShapeType("Cylinder"); theVals.addPoint("Position", aCylinder->location()); theVals.addDirection("Axis", aCylinder->axis()); @@ -277,20 +258,18 @@ void GeomAlgoAPI_ShapeInfo::processFace(Values& theVals, GeomFacePtr theFace) setShapeType("Face"); } -GeomAlgoAPI_ShapeInfo::Values::Values(const GeomAlgoAPI_ShapeInfo::InfoType theType) - : myType(theType) -{ - static GeomAlgoAPI_ShapeInfo::Translator* kDefaultTr = new GeomAlgoAPI_ShapeInfo::Translator; +GeomAlgoAPI_ShapeInfo::Values::Values( + const GeomAlgoAPI_ShapeInfo::InfoType theType) + : myType(theType) { + static GeomAlgoAPI_ShapeInfo::Translator *kDefaultTr = + new GeomAlgoAPI_ShapeInfo::Translator; myTr = kDefaultTr; } - -GeomAlgoAPI_ShapeInfo::Values& GeomAlgoAPI_ShapeInfo::Values::operator<< (double theValue) -{ - switch (myType) - { - case TYPE_HTML: - { +GeomAlgoAPI_ShapeInfo::Values & +GeomAlgoAPI_ShapeInfo::Values::operator<<(double theValue) { + switch (myType) { + case TYPE_HTML: { std::ostringstream aStr; aStr << theValue; myStr += aStr.str(); @@ -303,10 +282,9 @@ GeomAlgoAPI_ShapeInfo::Values& GeomAlgoAPI_ShapeInfo::Values::operator<< (double return *this; } -GeomAlgoAPI_ShapeInfo::Values& GeomAlgoAPI_ShapeInfo::Values::operator << (bool theValue) -{ - switch (myType) - { +GeomAlgoAPI_ShapeInfo::Values & +GeomAlgoAPI_ShapeInfo::Values::operator<<(bool theValue) { + switch (myType) { case TYPE_HTML: myStr += myTr->translate(theValue ? "True" : "False"); break; @@ -317,24 +295,21 @@ GeomAlgoAPI_ShapeInfo::Values& GeomAlgoAPI_ShapeInfo::Values::operator << (bool return *this; } -GeomAlgoAPI_ShapeInfo::Values& GeomAlgoAPI_ShapeInfo::Values::operator<< (const char* theStr) -{ +GeomAlgoAPI_ShapeInfo::Values & +GeomAlgoAPI_ShapeInfo::Values::operator<<(const char *theStr) { if (myType == TYPE_HTML) - myStr += myTr->translate(theStr); + myStr += myTr->translate(theStr); return *this; } -void GeomAlgoAPI_ShapeInfo::Values::addPoint(const char* theTitle, const GeomPointPtr& thePoint) -{ - switch (myType) - { - case TYPE_HTML: - { +void GeomAlgoAPI_ShapeInfo::Values::addPoint(const char *theTitle, + const GeomPointPtr &thePoint) { + switch (myType) { + case TYPE_HTML: { std::ostringstream aStr; aStr << "" << myTr->translate(theTitle) << "" - << "
    X: " << thePoint->x() - << "
    Y: " << thePoint->y() - << "
    Z: " << thePoint->z() << "
    "; + << "
    X: " << thePoint->x() << "
    Y: " << thePoint->y() + << "
    Z: " << thePoint->z() << "
    "; myStr += aStr.str(); break; } @@ -346,17 +321,14 @@ void GeomAlgoAPI_ShapeInfo::Values::addPoint(const char* theTitle, const GeomPoi } } -void GeomAlgoAPI_ShapeInfo::Values::addDirection(const char* theTitle, const GeomDirPtr& theDir) -{ - switch (myType) - { - case TYPE_HTML: - { +void GeomAlgoAPI_ShapeInfo::Values::addDirection(const char *theTitle, + const GeomDirPtr &theDir) { + switch (myType) { + case TYPE_HTML: { std::ostringstream aStr; aStr << "" << myTr->translate(theTitle) << "" - << "
    DX: " << theDir->x() - << "
    DY: " << theDir->y() - << "
    DZ: " << theDir->z() << "
    "; + << "
    DX: " << theDir->x() << "
    DY: " << theDir->y() + << "
    DZ: " << theDir->z() << "
    "; myStr += aStr.str(); break; } @@ -368,12 +340,10 @@ void GeomAlgoAPI_ShapeInfo::Values::addDirection(const char* theTitle, const Geo } } -void GeomAlgoAPI_ShapeInfo::Values::addNamedValue(const char* theName, const double theValue) -{ - switch (myType) - { - case TYPE_HTML: - { +void GeomAlgoAPI_ShapeInfo::Values::addNamedValue(const char *theName, + const double theValue) { + switch (myType) { + case TYPE_HTML: { std::ostringstream aStr; aStr << myTr->translate(theName) << ": " << theValue << "
    "; myStr += aStr.str(); @@ -385,14 +355,13 @@ void GeomAlgoAPI_ShapeInfo::Values::addNamedValue(const char* theName, const dou } } -void GeomAlgoAPI_ShapeInfo::Values::addNamedValue(const char* theName, const bool theValue) -{ - switch (myType) - { - case TYPE_HTML: - { +void GeomAlgoAPI_ShapeInfo::Values::addNamedValue(const char *theName, + const bool theValue) { + switch (myType) { + case TYPE_HTML: { std::ostringstream aStr; - aStr << myTr->translate(theName) << ": " << (theValue ? "True" : "False") << "
    "; + aStr << myTr->translate(theName) << ": " << (theValue ? "True" : "False") + << "
    "; myStr += aStr.str(); break; } @@ -402,10 +371,8 @@ void GeomAlgoAPI_ShapeInfo::Values::addNamedValue(const char* theName, const boo } } -void GeomAlgoAPI_ShapeInfo::Values::addGroupName(const char* theName) -{ - if (myType == TYPE_HTML) - { +void GeomAlgoAPI_ShapeInfo::Values::addGroupName(const char *theName) { + if (myType == TYPE_HTML) { myStr += "" + myTr->translate(theName) + "" + "
    "; } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h index e09b9b3d9..80f5cf5c1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_ShapeInfo_H_ @@ -22,17 +23,16 @@ #include "GeomAlgoAPI.h" -#include -#include -#include #include #include +#include +#include +#include #include /// Keeps values of different possible types, used in python shapeInfo. -class GeomAlgoAPI_InfoValue -{ +class GeomAlgoAPI_InfoValue { int myType; //< type stored in this Value std::string myStr; //< type 0 double myDouble; //< type 1 @@ -40,53 +40,56 @@ class GeomAlgoAPI_InfoValue public: GeomAlgoAPI_InfoValue() : myType(-1) {} // invalid case - GeomAlgoAPI_InfoValue(const char* theVal) : myType(0), myStr(theVal) {} + GeomAlgoAPI_InfoValue(const char *theVal) : myType(0), myStr(theVal) {} GeomAlgoAPI_InfoValue(const std::string theVal) : myType(0), myStr(theVal) {} GeomAlgoAPI_InfoValue(const double theVal) : myType(1), myDouble(theVal) {} GeomAlgoAPI_InfoValue(const bool theVal) : myType(2), myBool(theVal) {} - const int& type() const { return myType; } - const std::string& string() const { return myStr; } - const double& real() const { return myDouble; } - const bool& boolean() const { return myBool; } + const int &type() const { return myType; } + const std::string &string() const { return myStr; } + const double &real() const { return myDouble; } + const bool &boolean() const { return myBool; } }; /// \class GeomAlgoAPI_ShapeInfo /// \ingroup DataAlgo -/// \brief Provides information about shapes in textual (HTML for Information Panel) or +/// \brief Provides information about shapes in textual (HTML for Information +/// Panel) or /// a list of parameters order (for python "shapeInfo" command). /// /// At least the following geometrical items are supported: /// 0D: Vertex, /// 1D : Line segment, Polygon, Circle, Arc, Ellipse, Arc of ellipse, -/// 2D : Rectangle, Polygon, Disc with circular or elliptical base, Sphere, Cylinder, Cone, Torus +/// 2D : Rectangle, Polygon, Disc with circular or elliptical base, Sphere, +/// Cylinder, Cone, Torus /// -/// It is initialized by a shape and fors the needed output depending on the requested format. -class GeomAlgoAPI_ShapeInfo -{ +/// It is initialized by a shape and fors the needed output depending on the +/// requested format. +class GeomAlgoAPI_ShapeInfo { /// Keeps the shape, source of the produced information. std::shared_ptr myShape; std::string myShapeType; //< detected shape type public: - /// Initializes a parameters input by an input shape. - GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeInfo(const std::shared_ptr theShape) - : myShape(theShape) {} + GEOMALGOAPI_EXPORT + GeomAlgoAPI_ShapeInfo(const std::shared_ptr theShape) + : myShape(theShape) {} /// A translator to the current language is needed for HTML export. /// It is provided by a caller of this class. - class Translator - { + class Translator { public: Translator() {} - GEOMALGOAPI_EXPORT virtual std::string translate(const char* theSource) { return theSource; } + GEOMALGOAPI_EXPORT virtual std::string translate(const char *theSource) { + return theSource; + } }; /// Returns an HTML text of a shape info. - GEOMALGOAPI_EXPORT std::string html(Translator* theTranslator); + GEOMALGOAPI_EXPORT std::string html(Translator *theTranslator); /// Returns the detected shape type, or empty string. - GEOMALGOAPI_EXPORT const std::string& shapeType() { return myShapeType; } + GEOMALGOAPI_EXPORT const std::string &shapeType() { return myShapeType; } /// Sets the shape type void setShapeType(const std::string theType) { myShapeType = theType; } @@ -96,61 +99,57 @@ public: private: /// Possible types of export values - enum InfoType { - TYPE_HTML, - TYPE_VALS - }; + enum InfoType { TYPE_HTML, TYPE_VALS }; /// Allows to input values in a defined format, then - to export them. - class Values - { + class Values { /// A type of stored shape info. InfoType myType; /// An HTML string container. std::string myStr; - Translator* myTr; //< an external translator + Translator *myTr; //< an external translator /// A container of values: type of the value -> value std::list myVals; - public: + public: /// Initialization of an empty container, default translator Values(const InfoType theType); /// Returns HTML representation of values - const std::string& html() const { return myStr; } + const std::string &html() const { return myStr; } - void setTranslator(Translator* theTranslator) { myTr = theTranslator; } - Translator* translator() { return myTr; } + void setTranslator(Translator *theTranslator) { myTr = theTranslator; } + Translator *translator() { return myTr; } /// Returns list of values representation. - const std::list& values() const { return myVals; } + const std::list &values() const { return myVals; } /// Adds next value - Values& operator<< (double theValue); + Values &operator<<(double theValue); /// Adds next value - Values& operator<< (bool theValue); + Values &operator<<(bool theValue); /// Adds string - Values& operator<< (const char* theStr); + Values &operator<<(const char *theStr); /// Adds point coordinates - void addPoint(const char* theTitle, const GeomPointPtr& thePoint); + void addPoint(const char *theTitle, const GeomPointPtr &thePoint); /// Adds directon coordinates - void addDirection(const char* theTitle, const GeomDirPtr& thePoint); + void addDirection(const char *theTitle, const GeomDirPtr &thePoint); /// Adds named value - void addNamedValue(const char* theName, const double theValue); + void addNamedValue(const char *theName, const double theValue); /// Adds named value - void addNamedValue(const char* theName, const bool theValue); + void addNamedValue(const char *theName, const bool theValue); /// Adds a name (title) of the group - void addGroupName(const char* theName); + void addGroupName(const char *theName); }; /// Gets information from the shape - void processShape(Values& theVals); + void processShape(Values &theVals); /// Gets particual information from the edge - void processEdge(Values& theVals, GeomEdgePtr theEdge); + void processEdge(Values &theVals, GeomEdgePtr theEdge); /// Gets particual information from face - void processFace(Values& theVals, GeomFacePtr theFace); + void processFace(Values &theVals, GeomFacePtr theFace); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 3d0c3c65b..df5dd60af 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_ShapeTools.h" @@ -24,8 +25,8 @@ #include #include -#include #include +#include #include #include #include @@ -35,11 +36,9 @@ #include -#include -#include +#include #include #include -#include #include #include #include @@ -48,27 +47,28 @@ #include #include #include +#include #include #include #include #include +#include +#include #include #include #include #include -#include -#include -#include +#include +#include #include #include -#include #include +#include #include #include -#include #include #include @@ -86,12 +86,12 @@ #include #include +#include #include #include -#include -#include #include +#include #include #include @@ -100,12 +100,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include @@ -115,30 +115,24 @@ #include #include -#include +#include //================================================================================================== -static GProp_GProps props(const TopoDS_Shape& theShape) -{ +static GProp_GProps props(const TopoDS_Shape &theShape) { GProp_GProps aGProps; - if (theShape.ShapeType() == TopAbs_EDGE || theShape.ShapeType() == TopAbs_WIRE) - { + if (theShape.ShapeType() == TopAbs_EDGE || + theShape.ShapeType() == TopAbs_WIRE) { BRepGProp::LinearProperties(theShape, aGProps); - } - else if (theShape.ShapeType() == TopAbs_FACE || theShape.ShapeType() == TopAbs_SHELL) - { + } else if (theShape.ShapeType() == TopAbs_FACE || + theShape.ShapeType() == TopAbs_SHELL) { const Standard_Real anEps = 1.e-6; BRepGProp::SurfaceProperties(theShape, aGProps, anEps); - } - else if (theShape.ShapeType() == TopAbs_SOLID || theShape.ShapeType() == TopAbs_COMPSOLID) - { + } else if (theShape.ShapeType() == TopAbs_SOLID || + theShape.ShapeType() == TopAbs_COMPSOLID) { BRepGProp::VolumeProperties(theShape, aGProps); - } - else if (theShape.ShapeType() == TopAbs_COMPOUND) - { - for (TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next()) - { + } else if (theShape.ShapeType() == TopAbs_COMPOUND) { + for (TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next()) { aGProps.Add(props(anIt.Value())); } } @@ -147,34 +141,35 @@ static GProp_GProps props(const TopoDS_Shape& theShape) } //================================================================================================== -double GeomAlgoAPI_ShapeTools::length(const std::shared_ptr theShape) -{ +double +GeomAlgoAPI_ShapeTools::length(const std::shared_ptr theShape) { GProp_GProps aGProps; if (!theShape.get()) { return 0.0; } - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) { return 0.0; } BRepGProp::LinearProperties(aShape, aGProps, Standard_True); - return aGProps.Mass(); + return aGProps.Mass(); } //================================================================================================== -double GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr theShape) -{ +double +GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr theShape) { if (!theShape.get()) { return 0.0; } - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) { return 0.0; } const Standard_Real anEps = 1.e-6; double aVolume = 0.0; - for (TopExp_Explorer anExp(aShape, TopAbs_SOLID); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aShape, TopAbs_SOLID); anExp.More(); + anExp.Next()) { GProp_GProps aGProps; BRepGProp::VolumeProperties(anExp.Current(), aGProps, anEps); aVolume += aGProps.Mass(); @@ -183,13 +178,13 @@ double GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr theSh } //================================================================================================== -double GeomAlgoAPI_ShapeTools::area (const std::shared_ptr theShape) -{ +double +GeomAlgoAPI_ShapeTools::area(const std::shared_ptr theShape) { GProp_GProps aGProps; if (!theShape.get()) { return 0.0; } - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) { return 0.0; } @@ -200,22 +195,21 @@ double GeomAlgoAPI_ShapeTools::area (const std::shared_ptr theSha } //================================================================================================== -bool GeomAlgoAPI_ShapeTools::isContinuousFaces(const GeomShapePtr& theFace1, - const GeomShapePtr& theFace2, - const GeomPointPtr& thePoint, - const double & theAngle, - std::string& theError) -{ - - #ifdef _DEBUG +bool GeomAlgoAPI_ShapeTools::isContinuousFaces(const GeomShapePtr &theFace1, + const GeomShapePtr &theFace2, + const GeomPointPtr &thePoint, + const double &theAngle, + std::string &theError) { + +#ifdef _DEBUG std::cout << "isContinuousFaces " << std::endl; - #endif +#endif if (!thePoint.get()) { - theError = "isContinuousFaces : An invalid argument"; - return false; + theError = "isContinuousFaces : An invalid argument"; + return false; } - const gp_Pnt& aPoint = thePoint->impl(); + const gp_Pnt &aPoint = thePoint->impl(); // Getting base shape. if (!theFace1.get()) { @@ -271,26 +265,22 @@ bool GeomAlgoAPI_ShapeTools::isContinuousFaces(const GeomShapePtr& theFace1, } ShapeAnalysis_Surface aSAS2(aSurf2); - gp_Pnt2d aPointOnFace2= aSAS2.ValueOfUV(aPoint, Precision::Confusion()); + gp_Pnt2d aPointOnFace2 = aSAS2.ValueOfUV(aPoint, Precision::Confusion()); bool aRes = false; try { OCC_CATCH_SIGNALS; - LocalAnalysis_SurfaceContinuity aLocAnal(aSurf1, - aPointOnFace1.X(), - aPointOnFace1.Y(), - aSurf2, - aPointOnFace2.X(), - aPointOnFace2.Y(), - GeomAbs_Shape::GeomAbs_G1, // Order - 0.001, // EpsNul - 0.001, // EpsC0 - 0.001, // EpsC1 - 0.001, // EpsC2 - theAngle * M_PI / 180.0); //EpsG1 + LocalAnalysis_SurfaceContinuity aLocAnal( + aSurf1, aPointOnFace1.X(), aPointOnFace1.Y(), aSurf2, aPointOnFace2.X(), + aPointOnFace2.Y(), + GeomAbs_Shape::GeomAbs_G1, // Order + 0.001, // EpsNul + 0.001, // EpsC0 + 0.001, // EpsC1 + 0.001, // EpsC2 + theAngle * M_PI / 180.0); // EpsG1 aRes = aLocAnal.IsG1(); - } - catch (Standard_Failure const& anException) { + } catch (Standard_Failure const &anException) { theError = "LocalAnalysis_SurfaceContinuity error :"; theError += anException.GetMessageString(); } @@ -299,14 +289,13 @@ bool GeomAlgoAPI_ShapeTools::isContinuousFaces(const GeomShapePtr& theFace1, } //================================================================================================== -std::shared_ptr - GeomAlgoAPI_ShapeTools::centreOfMass(const std::shared_ptr theShape) -{ +std::shared_ptr GeomAlgoAPI_ShapeTools::centreOfMass( + const std::shared_ptr theShape) { GProp_GProps aGProps; if (!theShape) { return std::shared_ptr(); } - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); if (aShape.IsNull()) { return std::shared_ptr(); } @@ -318,17 +307,19 @@ std::shared_ptr aCentre = aGProps.CentreOfMass(); } - return std::shared_ptr(new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), aCentre.Z())); + return std::shared_ptr( + new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), aCentre.Z())); } //================================================================================================== -double GeomAlgoAPI_ShapeTools::radius(const std::shared_ptr& theCylinder) -{ +double GeomAlgoAPI_ShapeTools::radius( + const std::shared_ptr &theCylinder) { double aRadius = -1.0; if (theCylinder->isCylindrical()) { - const TopoDS_Shape& aShape = theCylinder->impl(); + const TopoDS_Shape &aShape = theCylinder->impl(); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); - Handle(Geom_CylindricalSurface) aCyl = Handle(Geom_CylindricalSurface)::DownCast(aSurf); + Handle(Geom_CylindricalSurface) aCyl = + Handle(Geom_CylindricalSurface)::DownCast(aSurf); if (!aCyl.IsNull()) aRadius = aCyl->Radius(); } @@ -338,27 +329,30 @@ double GeomAlgoAPI_ShapeTools::radius(const std::shared_ptr& theCy //================================================================================================== namespace { -auto getExtemaDistShape = [](const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2) -> BRepExtrema_DistShapeShape -{ - const TopoDS_Shape& aShape1 = theShape1->impl(); - const TopoDS_Shape& aShape2 = theShape2->impl(); +auto getExtemaDistShape = + [](const GeomShapePtr &theShape1, + const GeomShapePtr &theShape2) -> BRepExtrema_DistShapeShape { + const TopoDS_Shape &aShape1 = theShape1->impl(); + const TopoDS_Shape &aShape2 = theShape2->impl(); BRepExtrema_DistShapeShape aDist(aShape1, aShape2); aDist.Perform(); return aDist; }; -static void tessellateShape(const TopoDS_Shape& theShape) -{ +static void tessellateShape(const TopoDS_Shape &theShape) { Standard_Boolean isTessellate = Standard_False; TopLoc_Location aLoc; - for (TopExp_Explorer anExp(theShape, TopAbs_FACE); anExp.More() && !isTessellate; anExp.Next()) { - Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(TopoDS::Face(anExp.Value()), aLoc); + for (TopExp_Explorer anExp(theShape, TopAbs_FACE); + anExp.More() && !isTessellate; anExp.Next()) { + Handle(Poly_Triangulation) aTria = + BRep_Tool::Triangulation(TopoDS::Face(anExp.Value()), aLoc); isTessellate = aTria.IsNull(); } - for (TopExp_Explorer anExp(theShape, TopAbs_EDGE); anExp.More() && !isTessellate; anExp.Next()) { - Handle(Poly_Polygon3D) aPoly = BRep_Tool::Polygon3D(TopoDS::Edge(anExp.Value()), aLoc); + for (TopExp_Explorer anExp(theShape, TopAbs_EDGE); + anExp.More() && !isTessellate; anExp.Next()) { + Handle(Poly_Polygon3D) aPoly = + BRep_Tool::Polygon3D(TopoDS::Edge(anExp.Value()), aLoc); isTessellate = aPoly.IsNull(); } @@ -368,13 +362,10 @@ static void tessellateShape(const TopoDS_Shape& theShape) } } -static Standard_Real paramOnCurve(const BRepAdaptor_Curve& theCurve, - const gp_Pnt& thePoint, - const Standard_Real theTol) -{ - Extrema_ExtPC aParamSearch(thePoint, - theCurve, - theCurve.FirstParameter(), +static Standard_Real paramOnCurve(const BRepAdaptor_Curve &theCurve, + const gp_Pnt &thePoint, + const Standard_Real theTol) { + Extrema_ExtPC aParamSearch(thePoint, theCurve, theCurve.FirstParameter(), theCurve.LastParameter()); if (aParamSearch.IsDone()) { Standard_Integer anIndMin = 0, aNbExt = aParamSearch.NbExt(); @@ -391,13 +382,11 @@ static Standard_Real paramOnCurve(const BRepAdaptor_Curve& theCurve, return 0.5 * (theCurve.FirstParameter() + theCurve.LastParameter()); } -static void paramsOnSurf(const BRepAdaptor_Surface& theSurf, - const gp_Pnt& thePoint, - const Standard_Real theTol, - Standard_Real& theU, - Standard_Real& theV) -{ - Extrema_ExtPS aParamSearch(thePoint, theSurf, Precision::PConfusion(), Precision::PConfusion()); +static void paramsOnSurf(const BRepAdaptor_Surface &theSurf, + const gp_Pnt &thePoint, const Standard_Real theTol, + Standard_Real &theU, Standard_Real &theV) { + Extrema_ExtPS aParamSearch(thePoint, theSurf, Precision::PConfusion(), + Precision::PConfusion()); if (aParamSearch.IsDone()) { Standard_Integer anIndMin = 0, aNbExt = aParamSearch.NbExt(); Standard_Real aSqDistMin = RealLast(); @@ -414,16 +403,17 @@ static void paramsOnSurf(const BRepAdaptor_Surface& theSurf, theV = 0.5 * (theSurf.FirstVParameter() + theSurf.LastVParameter()); } -static Standard_Real extremaEE(const TopoDS_Edge& theEdge1, - const TopoDS_Edge& theEdge2, - const gp_Pnt& thePoint1, - const gp_Pnt& thePoint2) -{ +static Standard_Real extremaEE(const TopoDS_Edge &theEdge1, + const TopoDS_Edge &theEdge2, + const gp_Pnt &thePoint1, + const gp_Pnt &thePoint2) { BRepAdaptor_Curve aCurve1(theEdge1); BRepAdaptor_Curve aCurve2(theEdge2); - Standard_Real aU1 = paramOnCurve(aCurve1, thePoint1, BRep_Tool::Tolerance(theEdge1)); - Standard_Real aU2 = paramOnCurve(aCurve2, thePoint2, BRep_Tool::Tolerance(theEdge2)); + Standard_Real aU1 = + paramOnCurve(aCurve1, thePoint1, BRep_Tool::Tolerance(theEdge1)); + Standard_Real aU2 = + paramOnCurve(aCurve2, thePoint2, BRep_Tool::Tolerance(theEdge2)); Standard_Real aValue = -1.0; Extrema_LocateExtCC anExtr(aCurve1, aCurve2, aU1, aU2); @@ -432,24 +422,22 @@ static Standard_Real extremaEE(const TopoDS_Edge& theEdge1, return aValue; } -static Standard_Real extremaPE(const gp_Pnt& thePoint, - const TopoDS_Edge& theEdge, - gp_Pnt& thePointOnEdge) -{ - BRepAdaptor_Curve aCurve (theEdge); +static Standard_Real extremaPE(const gp_Pnt &thePoint, + const TopoDS_Edge &theEdge, + gp_Pnt &thePointOnEdge) { + BRepAdaptor_Curve aCurve(theEdge); TopLoc_Location aLoc; Standard_Real aTol = BRep_Tool::Tolerance(theEdge); - Handle(Poly_Polygon3D) aPoly = BRep_Tool::Polygon3D (theEdge, aLoc); + Handle(Poly_Polygon3D) aPoly = BRep_Tool::Polygon3D(theEdge, aLoc); if (!aPoly.IsNull()) - aTol = Max (aTol, aPoly->Deflection()); + aTol = Max(aTol, aPoly->Deflection()); - Standard_Real aParam = paramOnCurve (aCurve, thePointOnEdge, 2*aTol); + Standard_Real aParam = paramOnCurve(aCurve, thePointOnEdge, 2 * aTol); Standard_Real aValue = -1.0; - Extrema_LocateExtPC anExtr (thePoint, aCurve, aParam, Precision::PConfusion()); - if (anExtr.IsDone()) - { + Extrema_LocateExtPC anExtr(thePoint, aCurve, aParam, Precision::PConfusion()); + if (anExtr.IsDone()) { aValue = Sqrt(anExtr.SquareDistance()); Extrema_POnCurv aPointOnCurve = anExtr.Point(); @@ -457,27 +445,25 @@ static Standard_Real extremaPE(const gp_Pnt& thePoint, } return aValue; } - -static Standard_Real extremaPF(const gp_Pnt& thePoint, - const TopoDS_Face& theFace, - gp_Pnt& thePointOnFace) -{ - BRepAdaptor_Surface aSurf (theFace); + +static Standard_Real extremaPF(const gp_Pnt &thePoint, + const TopoDS_Face &theFace, + gp_Pnt &thePointOnFace) { + BRepAdaptor_Surface aSurf(theFace); TopLoc_Location aLoc; Standard_Real aTol = BRep_Tool::Tolerance(theFace); - Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation (theFace, aLoc); + Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(theFace, aLoc); if (!aTria.IsNull()) - aTol = Max (aTol, aTria->Deflection()); + aTol = Max(aTol, aTria->Deflection()); Standard_Real aU, aV; - paramsOnSurf(aSurf, thePointOnFace, 2*aTol, aU, aV); + paramsOnSurf(aSurf, thePointOnFace, 2 * aTol, aU, aV); Standard_Real aValue = -1.0; - Extrema_GenLocateExtPS anExtr (aSurf); - anExtr.Perform (thePoint, aU, aV); - if (anExtr.IsDone()) - { + Extrema_GenLocateExtPS anExtr(aSurf); + anExtr.Perform(thePoint, aU, aV); + if (anExtr.IsDone()) { aValue = Sqrt(anExtr.SquareDistance()); Extrema_POnSurf aPointOnSurf = anExtr.Point(); @@ -486,30 +472,30 @@ static Standard_Real extremaPF(const gp_Pnt& thePoint, return aValue; } -static Standard_Real extremaEF(const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace, - const gp_Pnt& thePonE, - const gp_Pnt& thePonF) -{ +static Standard_Real extremaEF(const TopoDS_Edge &theEdge, + const TopoDS_Face &theFace, + const gp_Pnt &thePonE, const gp_Pnt &thePonF) { BRepAdaptor_Curve aCurve(theEdge); BRepAdaptor_Surface aSurf(theFace); - Standard_Real aP = paramOnCurve(aCurve, thePonE, BRep_Tool::Tolerance(theEdge)); + Standard_Real aP = + paramOnCurve(aCurve, thePonE, BRep_Tool::Tolerance(theEdge)); Standard_Real aU, aV; paramsOnSurf(aSurf, thePonF, BRep_Tool::Tolerance(theFace), aU, aV); Standard_Real aValue = -1.0; - Extrema_GenLocateExtCS anExtr(aCurve, aSurf, aP, aU, aV, Precision::PConfusion(), Precision::PConfusion()); + Extrema_GenLocateExtCS anExtr(aCurve, aSurf, aP, aU, aV, + Precision::PConfusion(), + Precision::PConfusion()); if (anExtr.IsDone() && aValue > Precision::Confusion()) aValue = Sqrt(anExtr.SquareDistance()); return aValue; } -static Standard_Real extremaFF(const TopoDS_Face& theFace1, - const TopoDS_Face& theFace2, - const gp_Pnt& thePoint1, - const gp_Pnt& thePoint2) -{ +static Standard_Real extremaFF(const TopoDS_Face &theFace1, + const TopoDS_Face &theFace2, + const gp_Pnt &thePoint1, + const gp_Pnt &thePoint2) { BRepAdaptor_Surface aSurf1(theFace1); BRepAdaptor_Surface aSurf2(theFace2); @@ -519,7 +505,9 @@ static Standard_Real extremaFF(const TopoDS_Face& theFace1, paramsOnSurf(aSurf2, thePoint2, BRep_Tool::Tolerance(theFace2), aU2, aV2); Standard_Real aValue = -1.0; - Extrema_GenLocateExtSS anExtr(aSurf1, aSurf2, aU1, aV1, aU2, aV2, Precision::PConfusion(), Precision::PConfusion()); + Extrema_GenLocateExtSS anExtr(aSurf1, aSurf2, aU1, aV1, aU2, aV2, + Precision::PConfusion(), + Precision::PConfusion()); if (anExtr.IsDone() && aValue > Precision::Confusion()) aValue = Sqrt(anExtr.SquareDistance()); return aValue; @@ -527,20 +515,19 @@ static Standard_Real extremaFF(const TopoDS_Face& theFace1, } // namespace -double GeomAlgoAPI_ShapeTools::minimalDistance(const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2) -{ +double GeomAlgoAPI_ShapeTools::minimalDistance(const GeomShapePtr &theShape1, + const GeomShapePtr &theShape2) { BRepExtrema_DistShapeShape aDist = getExtemaDistShape(theShape1, theShape2); return aDist.IsDone() ? aDist.Value() : Precision::Infinite(); } -double GeomAlgoAPI_ShapeTools::minimalDistance(const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2, - std::array & fromShape1To2) -{ +double +GeomAlgoAPI_ShapeTools::minimalDistance(const GeomShapePtr &theShape1, + const GeomShapePtr &theShape2, + std::array &fromShape1To2) { BRepExtrema_DistShapeShape aDist = getExtemaDistShape(theShape1, theShape2); - const auto & pt1 = aDist.PointOnShape1(1); - const auto & pt2 = aDist.PointOnShape2(1) ; + const auto &pt1 = aDist.PointOnShape1(1); + const auto &pt2 = aDist.PointOnShape2(1); fromShape1To2[0] = pt2.X() - pt1.X(); fromShape1To2[1] = pt2.Y() - pt1.Y(); fromShape1To2[2] = pt2.Z() - pt1.Z(); @@ -548,15 +535,14 @@ double GeomAlgoAPI_ShapeTools::minimalDistance(const GeomShapePtr& theShape1, } //================================================================================================== -double GeomAlgoAPI_ShapeTools::shapeProximity(const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2) -{ +double GeomAlgoAPI_ShapeTools::shapeProximity(const GeomShapePtr &theShape1, + const GeomShapePtr &theShape2) { double aResult = -1.0; if (!theShape1.get() || !theShape2.get()) return aResult; - const TopoDS_Shape& aShape1 = theShape1->impl(); - const TopoDS_Shape& aShape2 = theShape2->impl(); + const TopoDS_Shape &aShape1 = theShape1->impl(); + const TopoDS_Shape &aShape2 = theShape2->impl(); TopAbs_ShapeEnum aType1 = aShape1.ShapeType(); TopAbs_ShapeEnum aType2 = aShape2.ShapeType(); @@ -565,7 +551,7 @@ double GeomAlgoAPI_ShapeTools::shapeProximity(const GeomShapePtr& theShape1, tessellateShape(aShape1); tessellateShape(aShape2); - BRepExtrema_ShapeProximity aDist (aShape1, aShape2); + BRepExtrema_ShapeProximity aDist(aShape1, aShape2); aDist.Perform(); if (aDist.IsDone()) { aResult = aDist.Proximity(); @@ -574,85 +560,78 @@ double GeomAlgoAPI_ShapeTools::shapeProximity(const GeomShapePtr& theShape1, gp_Pnt aPnt1 = aDist.ProximityPoint1(); gp_Pnt aPnt2 = aDist.ProximityPoint2(); - BRepExtrema_ProximityDistTool::ProxPnt_Status aStatus1 = aDist.ProxPntStatus1(); - BRepExtrema_ProximityDistTool::ProxPnt_Status aStatus2 = aDist.ProxPntStatus2(); + BRepExtrema_ProximityDistTool::ProxPnt_Status aStatus1 = + aDist.ProxPntStatus1(); + BRepExtrema_ProximityDistTool::ProxPnt_Status aStatus2 = + aDist.ProxPntStatus2(); double aValue = -1.0; - if (aType1 == TopAbs_EDGE) - { - if (aType2 == TopAbs_EDGE) - { + if (aType1 == TopAbs_EDGE) { + if (aType2 == TopAbs_EDGE) { if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { - aValue = extremaEE(TopoDS::Edge(aShape1), TopoDS::Edge(aShape2), aPnt1, aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { + aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { + aValue = extremaEE(TopoDS::Edge(aShape1), TopoDS::Edge(aShape2), + aPnt1, aPnt2); + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { aValue = extremaPE(aPnt1, TopoDS::Edge(aShape2), aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) - { + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) { aValue = extremaPE(aPnt2, TopoDS::Edge(aShape1), aPnt1); } - } - else if (aType2 == TopAbs_FACE) - { + } else if (aType2 == TopAbs_FACE) { if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { - aValue = extremaEF(TopoDS::Edge(aShape1), TopoDS::Face(aShape2), aPnt1, aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { + aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { + aValue = extremaEF(TopoDS::Edge(aShape1), TopoDS::Face(aShape2), + aPnt1, aPnt2); + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { aValue = extremaPF(aPnt1, TopoDS::Face(aShape2), aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) - { + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) { aValue = extremaPE(aPnt2, TopoDS::Edge(aShape1), aPnt1); } } - } - else if (aType1 == TopAbs_FACE) - { - if (aType2 == TopAbs_EDGE) - { + } else if (aType1 == TopAbs_FACE) { + if (aType2 == TopAbs_EDGE) { if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { - aValue = extremaEF(TopoDS::Edge(aShape2), TopoDS::Face(aShape1), aPnt2, aPnt1); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { + aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { + aValue = extremaEF(TopoDS::Edge(aShape2), TopoDS::Face(aShape1), + aPnt2, aPnt1); + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { aValue = extremaPE(aPnt1, TopoDS::Edge(aShape2), aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) - { + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) { aValue = extremaPF(aPnt2, TopoDS::Face(aShape1), aPnt1); } - } - else if (aType2 == TopAbs_FACE) - { + } else if (aType2 == TopAbs_FACE) { if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { - aValue = extremaFF(TopoDS::Face(aShape1), TopoDS::Face(aShape2), aPnt1, aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) - { + aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { + aValue = extremaFF(TopoDS::Face(aShape1), TopoDS::Face(aShape2), + aPnt1, aPnt2); + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE) { aValue = extremaPF(aPnt1, TopoDS::Face(aShape2), aPnt2); - } - else if (aStatus1 == BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && - aStatus2 == BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) - { + } else if (aStatus1 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_MIDDLE && + aStatus2 == + BRepExtrema_ProximityDistTool::ProxPnt_Status_BORDER) { aValue = extremaPF(aPnt2, TopoDS::Face(aShape1), aPnt1); } } @@ -666,10 +645,8 @@ double GeomAlgoAPI_ShapeTools::shapeProximity(const GeomShapePtr& theShape1, //================================================================================================== std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( - const std::shared_ptr theCompound, - const GeomAPI_Shape::ShapeType theType, - ListOfShape& theResuts) -{ + const std::shared_ptr theCompound, + const GeomAPI_Shape::ShapeType theType, ListOfShape &theResuts) { ListOfShape aResCombinedShapes; ListOfShape aResFreeShapes; @@ -691,16 +668,18 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( aTA = TopAbs_SOLID; } - // map from the resulting shapes to minimal index of the used shape from theCompound list + // map from the resulting shapes to minimal index of the used shape from + // theCompound list std::map anInputOrder; // map from ancestors-shapes to the index of shapes in theCompound NCollection_DataMap anAncestorsOrder; // Get free shapes. int anOrder = 0; - const TopoDS_Shape& aShapesComp = theCompound->impl(); - for (TopoDS_Iterator anIter(aShapesComp); anIter.More(); anIter.Next(), anOrder++) { - const TopoDS_Shape& aShape = anIter.Value(); + const TopoDS_Shape &aShapesComp = theCompound->impl(); + for (TopoDS_Iterator anIter(aShapesComp); anIter.More(); + anIter.Next(), anOrder++) { + const TopoDS_Shape &aShape = anIter.Value(); if (aShape.ShapeType() > aTA) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aShape)); @@ -724,42 +703,43 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( // Get all shapes with common sub-shapes and free shapes. NCollection_Map aFreeShapes; NCollection_Vector> aShapesWithCommonSubshapes; - for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator - anIter(aMapSA); anIter.More(); anIter.Next()) { - TopTools_ListOfShape& aListOfShape = anIter.ChangeValue(); + for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapSA); + anIter.More(); anIter.Next()) { + TopTools_ListOfShape &aListOfShape = anIter.ChangeValue(); if (aListOfShape.IsEmpty()) { continue; - } - else if (aListOfShape.Size() == 1) { - const TopoDS_Shape& aF = aListOfShape.First(); + } else if (aListOfShape.Size() == 1) { + const TopoDS_Shape &aF = aListOfShape.First(); aFreeShapes.Add(aF); aListOfShape.Clear(); } else { NCollection_List aTempList; NCollection_Map aTempMap; - for (TopTools_ListOfShape::Iterator aListIt(aListOfShape); aListIt.More(); aListIt.Next()) { + for (TopTools_ListOfShape::Iterator aListIt(aListOfShape); aListIt.More(); + aListIt.Next()) { aTempList.Append(aListIt.Value()); aTempMap.Add(aListIt.Value()); aFreeShapes.Remove(aListIt.Value()); } aListOfShape.Clear(); - for (NCollection_List::Iterator - aTempIter(aTempList); aTempIter.More(); aTempIter.Next()) { - const TopoDS_Shape& aTempShape = aTempIter.Value(); - for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator - anIter2(aMapSA); anIter2.More(); anIter2.Next()) { - TopTools_ListOfShape& aTempListOfShape = anIter2.ChangeValue(); + for (NCollection_List::Iterator aTempIter(aTempList); + aTempIter.More(); aTempIter.Next()) { + const TopoDS_Shape &aTempShape = aTempIter.Value(); + for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIter2( + aMapSA); + anIter2.More(); anIter2.Next()) { + TopTools_ListOfShape &aTempListOfShape = anIter2.ChangeValue(); if (aTempListOfShape.IsEmpty()) { continue; - } else if (aTempListOfShape.Size() == 1 && aTempListOfShape.First() == aTempShape) { + } else if (aTempListOfShape.Size() == 1 && + aTempListOfShape.First() == aTempShape) { aTempListOfShape.Clear(); } else if (aTempListOfShape.Size() > 1) { TopTools_ListOfShape::Iterator anIt1(aTempListOfShape); for (; anIt1.More(); anIt1.Next()) { if (anIt1.Value() == aTempShape) { TopTools_ListOfShape::Iterator anIt2(aTempListOfShape); - for (; anIt2.More(); anIt2.Next()) - { + for (; anIt2.More(); anIt2.Next()) { if (anIt2.Value() != anIt1.Value()) { if (aTempMap.Add(anIt2.Value())) { aTempList.Append(anIt2.Value()); @@ -779,20 +759,21 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( } // Combine shapes with common sub-shapes. - for (NCollection_Vector>::Iterator - anIter(aShapesWithCommonSubshapes); anIter.More(); anIter.Next()) { + for (NCollection_Vector>::Iterator anIter( + aShapesWithCommonSubshapes); + anIter.More(); anIter.Next()) { TopoDS_Shell aShell; TopoDS_CompSolid aCSolid; TopoDS_Builder aBuilder; anOrder = -1; - theType == - GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) : aBuilder.MakeShell(aShell); - NCollection_Map& aShapesMap = anIter.ChangeValue(); + theType == GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) + : aBuilder.MakeShell(aShell); + NCollection_Map &aShapesMap = anIter.ChangeValue(); for (TopExp_Explorer anExp(aShapesComp, aTA); anExp.More(); anExp.Next()) { - const TopoDS_Shape& aShape = anExp.Current(); + const TopoDS_Shape &aShape = anExp.Current(); if (aShapesMap.Contains(aShape)) { - theType == - GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) : aBuilder.Add(aShell, aShape); + theType == GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) + : aBuilder.Add(aShell, aShape); aShapesMap.Remove(aShape); int aThisOrder = anAncestorsOrder.Find(aShape); if (anOrder == -1 || aThisOrder < anOrder) @@ -800,8 +781,9 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( } } std::shared_ptr aGeomShape(new GeomAPI_Shape); - TopoDS_Shape* aSh = theType == GeomAPI_Shape::COMPSOLID ? new TopoDS_Shape(aCSolid) : - new TopoDS_Shape(aShell); + TopoDS_Shape *aSh = theType == GeomAPI_Shape::COMPSOLID + ? new TopoDS_Shape(aCSolid) + : new TopoDS_Shape(aShell); aGeomShape->setImpl(aSh); aResCombinedShapes.push_back(aGeomShape); anInputOrder[aGeomShape] = anOrder; @@ -809,7 +791,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( // Adding free shapes. for (TopExp_Explorer anExp(aShapesComp, aTA); anExp.More(); anExp.Next()) { - const TopoDS_Shape& aShape = anExp.Current(); + const TopoDS_Shape &aShape = anExp.Current(); if (aFreeShapes.Contains(aShape)) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape(aShape)); @@ -845,9 +827,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( } //================================================================================================== -static void addSimpleShapeToList(const TopoDS_Shape& theShape, - NCollection_List& theList) -{ +static void addSimpleShapeToList(const TopoDS_Shape &theShape, + NCollection_List &theList) { if (theShape.IsNull()) { return; } @@ -862,14 +843,15 @@ static void addSimpleShapeToList(const TopoDS_Shape& theShape, } //================================================================================================== -static TopoDS_Compound makeCompound(const NCollection_List theShapes) -{ +static TopoDS_Compound +makeCompound(const NCollection_List theShapes) { TopoDS_Compound aCompound; BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); - for (NCollection_List::Iterator anIt(theShapes); anIt.More(); anIt.Next()) { + for (NCollection_List::Iterator anIt(theShapes); anIt.More(); + anIt.Next()) { aBuilder.Add(aCompound, anIt.Value()); } @@ -878,8 +860,7 @@ static TopoDS_Compound makeCompound(const NCollection_List theShap //================================================================================================== std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( - const std::shared_ptr theCompound) -{ + const std::shared_ptr theCompound) { GeomShapePtr aResult = theCompound; if (!theCompound.get()) { @@ -894,20 +875,17 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( TopTools_ListOfShape allVertices; TopTools_DataMapOfShapeListOfShape aVertexShapesMap; for (NCollection_List::Iterator aShapesIt(anUngroupedShapes); - aShapesIt.More(); - aShapesIt.Next()) { - const TopoDS_Shape& aShape = aShapesIt.Value(); - for (TopExp_Explorer aShapeExp(aShape, TopAbs_VERTEX); - aShapeExp.More(); - aShapeExp.Next()) { - const TopoDS_Shape& aVertex = aShapeExp.Current(); + aShapesIt.More(); aShapesIt.Next()) { + const TopoDS_Shape &aShape = aShapesIt.Value(); + for (TopExp_Explorer aShapeExp(aShape, TopAbs_VERTEX); aShapeExp.More(); + aShapeExp.Next()) { + const TopoDS_Shape &aVertex = aShapeExp.Current(); if (!aVertexShapesMap.IsBound(aVertex)) { NCollection_List aList; aList.Append(aShape); allVertices.Append(aVertex); aVertexShapesMap.Bind(aVertex, aList); - } - else { + } else { if (!aVertexShapesMap.ChangeFind(aVertex).Contains(aShape)) { aVertexShapesMap.ChangeFind(aVertex).Append(aShape); } @@ -916,31 +894,33 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( } // Iterate over the map and group shapes. - NCollection_Vector aGroups; // groups of shapes connected by vertices + NCollection_Vector + aGroups; // groups of shapes connected by vertices while (!allVertices.IsEmpty()) { // Get first group of shapes in map, and then unbind it. - const TopoDS_Shape& aKey = allVertices.First(); + const TopoDS_Shape &aKey = allVertices.First(); TopTools_ListOfShape aConnectedShapes = aVertexShapesMap.Find(aKey); aVertexShapesMap.UnBind(aKey); allVertices.Remove(aKey); - // Iterate over shapes in this group and add to it shapes from groups in map. + // Iterate over shapes in this group and add to it shapes from groups in + // map. for (TopTools_ListOfShape::Iterator aConnectedIt(aConnectedShapes); - aConnectedIt.More(); aConnectedIt.Next()) { - const TopoDS_Shape& aConnected = aConnectedIt.Value(); + aConnectedIt.More(); aConnectedIt.Next()) { + const TopoDS_Shape &aConnected = aConnectedIt.Value(); TopTools_ListOfShape aKeysToUnbind; - for (TopTools_ListOfShape::Iterator aKeysIt(allVertices); - aKeysIt.More(); - aKeysIt.Next()) { - const TopTools_ListOfShape& anOtherConnected = aVertexShapesMap(aKeysIt.Value()); + for (TopTools_ListOfShape::Iterator aKeysIt(allVertices); aKeysIt.More(); + aKeysIt.Next()) { + const TopTools_ListOfShape &anOtherConnected = + aVertexShapesMap(aKeysIt.Value()); if (!anOtherConnected.Contains(aConnected)) { - // Other connected group does not contain shape from our connected group + // Other connected group does not contain shape from our connected + // group continue; } // Other is connected to our, so add them to our connected for (TopTools_ListOfShape::Iterator anOtherIt(anOtherConnected); - anOtherIt.More(); - anOtherIt.Next()) { - const TopoDS_Shape& aShape = anOtherIt.Value(); + anOtherIt.More(); anOtherIt.Next()) { + const TopoDS_Shape &aShape = anOtherIt.Value(); if (!aConnectedShapes.Contains(aShape)) { aConnectedShapes.Append(aShape); } @@ -950,8 +930,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( } // Unbind groups from map that we added to our group. for (TopTools_ListOfShape::Iterator aKeysIt(aKeysToUnbind); - aKeysIt.More(); - aKeysIt.Next()) { + aKeysIt.More(); aKeysIt.Next()) { aVertexShapesMap.UnBind(aKeysIt.Value()); allVertices.Remove(aKeysIt.Value()); } @@ -964,8 +943,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( if (anIt.Value().ShapeType() == aST) { aSortedGroup.Add(anIt.Value()); aConnectedShapes.Remove(anIt); - } - else { + } else { anIt.Next(); } } @@ -977,8 +955,9 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); ListOfShape aSolids; - for (NCollection_Vector::Iterator anIt(aGroups); anIt.More(); anIt.Next()) { - const TopTools_MapOfShape& aGroup = anIt.ChangeValue(); + for (NCollection_Vector::Iterator anIt(aGroups); + anIt.More(); anIt.Next()) { + const TopTools_MapOfShape &aGroup = anIt.ChangeValue(); GeomShapePtr aGeomShape(new GeomAPI_Shape()); if (aGroup.Size() == 1) { TopTools_MapOfShape::Iterator aOneShapeIter(aGroup); @@ -992,9 +971,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( anOrderedGoup.Append(anUngrouped.Value()); } aGeomShape->setImpl(new TopoDS_Shape(makeCompound(anOrderedGoup))); - aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, - GeomAPI_Shape::COMPSOLID, - aSolids); + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes( + aGeomShape, GeomAPI_Shape::COMPSOLID, aSolids); } aBuilder.Add(aCompound, aGeomShape->impl()); } @@ -1007,14 +985,16 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( } //================================================================================================== -bool GeomAlgoAPI_ShapeTools::hasSharedTopology(const ListOfShape& theShapes, - const GeomAPI_Shape::ShapeType theShapeType) -{ +bool GeomAlgoAPI_ShapeTools::hasSharedTopology( + const ListOfShape &theShapes, const GeomAPI_Shape::ShapeType theShapeType) { TopTools_IndexedMapOfShape aSubs; - for (ListOfShape::const_iterator anIt = theShapes.begin(); anIt != theShapes.end(); ++anIt) { + for (ListOfShape::const_iterator anIt = theShapes.begin(); + anIt != theShapes.end(); ++anIt) { TopTools_IndexedMapOfShape aCurSubs; - TopExp::MapShapes((*anIt)->impl(), (TopAbs_ShapeEnum)theShapeType, aCurSubs); - for (TopTools_IndexedMapOfShape::Iterator aSubIt(aCurSubs); aSubIt.More(); aSubIt.Next()) { + TopExp::MapShapes((*anIt)->impl(), + (TopAbs_ShapeEnum)theShapeType, aCurSubs); + for (TopTools_IndexedMapOfShape::Iterator aSubIt(aCurSubs); aSubIt.More(); + aSubIt.Next()) { if (aSubs.Contains(aSubIt.Value())) return true; else @@ -1025,32 +1005,34 @@ bool GeomAlgoAPI_ShapeTools::hasSharedTopology(const ListOfShape& theShapes, } //================================================================================================== -std::list > - GeomAlgoAPI_ShapeTools::getBoundingBox(const ListOfShape& theShapes, const double theEnlarge) -{ +std::list> +GeomAlgoAPI_ShapeTools::getBoundingBox(const ListOfShape &theShapes, + const double theEnlarge) { // Bounding box of all objects. Bnd_Box aBndBox; // Getting box. - for (ListOfShape::const_iterator - anObjectsIt = theShapes.begin(); anObjectsIt != theShapes.end(); anObjectsIt++) { - const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); + for (ListOfShape::const_iterator anObjectsIt = theShapes.begin(); + anObjectsIt != theShapes.end(); anObjectsIt++) { + const TopoDS_Shape &aShape = (*anObjectsIt)->impl(); BRepBndLib::Add(aShape, aBndBox); } if (theEnlarge != 0.0) { - // We enlarge bounding box just to be sure that plane will be large enough to cut all objects. + // We enlarge bounding box just to be sure that plane will be large enough + // to cut all objects. aBndBox.Enlarge(theEnlarge); } Standard_Real aXArr[2] = {aBndBox.CornerMin().X(), aBndBox.CornerMax().X()}; Standard_Real aYArr[2] = {aBndBox.CornerMin().Y(), aBndBox.CornerMax().Y()}; Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()}; - std::list > aResultPoints; + std::list> aResultPoints; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { - std::shared_ptr aPnt(new GeomAPI_Pnt(aXArr[i], aYArr[j], aZArr[k])); + std::shared_ptr aPnt( + new GeomAPI_Pnt(aXArr[i], aYArr[j], aZArr[k])); aResultPoints.push_back(aPnt); } } @@ -1061,16 +1043,15 @@ std::list > //================================================================================================== std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox( - const std::shared_ptr thePlane, - const std::list >& thePoints) -{ + const std::shared_ptr thePlane, + const std::list> &thePoints) { std::shared_ptr aResultFace; if (!thePlane.get()) { return aResultFace; } - const TopoDS_Shape& aShape = thePlane->impl(); + const TopoDS_Shape &aShape = thePlane->impl(); if (aShape.ShapeType() != TopAbs_FACE) { return aResultFace; } @@ -1090,35 +1071,42 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox( return aResultFace; } - const gp_Pln& aFacePln = isPlanar.Plan(); + const gp_Pln &aFacePln = isPlanar.Plan(); Handle(Geom_Plane) aFacePlane = new Geom_Plane(aFacePln); IntAna_Quadric aQuadric(aFacePln); Standard_Real UMin, UMax, VMin, VMax; UMin = UMax = VMin = VMax = 0; - for (std::list >::const_iterator - aPointsIt = thePoints.begin(); aPointsIt != thePoints.end(); aPointsIt++) { - const gp_Pnt& aPnt = (*aPointsIt)->impl(); + for (std::list>::const_iterator aPointsIt = + thePoints.begin(); + aPointsIt != thePoints.end(); aPointsIt++) { + const gp_Pnt &aPnt = (*aPointsIt)->impl(); gp_Lin aLin(aPnt, aFacePln.Axis().Direction()); IntAna_IntConicQuad anIntAna(aLin, aQuadric); - const gp_Pnt& aPntOnFace = anIntAna.Point(1); + const gp_Pnt &aPntOnFace = anIntAna.Point(1); Standard_Real aPntU(0), aPntV(0); - GeomLib_Tool::Parameters(aFacePlane, aPntOnFace, Precision::Confusion(), aPntU, aPntV); - if (aPntU < UMin) UMin = aPntU; - if (aPntU > UMax) UMax = aPntU; - if (aPntV < VMin) VMin = aPntV; - if (aPntV > VMax) VMax = aPntV; + GeomLib_Tool::Parameters(aFacePlane, aPntOnFace, Precision::Confusion(), + aPntU, aPntV); + if (aPntU < UMin) + UMin = aPntU; + if (aPntU > UMax) + UMax = aPntU; + if (aPntV < VMin) + VMin = aPntV; + if (aPntV > VMax) + VMax = aPntV; } aResultFace.reset(new GeomAPI_Face()); - aResultFace->setImpl(new TopoDS_Face(BRepLib_MakeFace(aFacePln, UMin, UMax, VMin, VMax).Face())); + aResultFace->setImpl(new TopoDS_Face( + BRepLib_MakeFace(aFacePln, UMin, UMax, VMin, VMax).Face())); return aResultFace; } //================================================================================================== -void GeomAlgoAPI_ShapeTools::findBounds(const std::shared_ptr theShape, - std::shared_ptr& theV1, - std::shared_ptr& theV2) -{ +void GeomAlgoAPI_ShapeTools::findBounds( + const std::shared_ptr theShape, + std::shared_ptr &theV1, + std::shared_ptr &theV2) { static GeomVertexPtr aVertex; if (!aVertex) { aVertex = GeomVertexPtr(new GeomAPI_Vertex); @@ -1129,11 +1117,12 @@ void GeomAlgoAPI_ShapeTools::findBounds(const std::shared_ptr the theV2 = aVertex; if (theShape) { - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); TopoDS_Vertex aV1, aV2; ShapeAnalysis::FindBounds(aShape, aV1, aV2); - std::shared_ptr aGeomV1(new GeomAPI_Vertex()), aGeomV2(new GeomAPI_Vertex()); + std::shared_ptr aGeomV1(new GeomAPI_Vertex()), + aGeomV2(new GeomAPI_Vertex()); aGeomV1->setImpl(new TopoDS_Vertex(aV1)); aGeomV2->setImpl(new TopoDS_Vertex(aV2)); theV1 = aGeomV1; @@ -1142,20 +1131,18 @@ void GeomAlgoAPI_ShapeTools::findBounds(const std::shared_ptr the } //================================================================================================== -void GeomAlgoAPI_ShapeTools::makeFacesWithHoles(const std::shared_ptr theOrigin, - const std::shared_ptr theDirection, - const ListOfShape& theWires, - ListOfShape& theFaces) -{ - BRepBuilderAPI_MakeFace aMKFace(gp_Pln(theOrigin->impl(), - theDirection->impl())); +void GeomAlgoAPI_ShapeTools::makeFacesWithHoles( + const std::shared_ptr theOrigin, + const std::shared_ptr theDirection, + const ListOfShape &theWires, ListOfShape &theFaces) { + BRepBuilderAPI_MakeFace aMKFace( + gp_Pln(theOrigin->impl(), theDirection->impl())); TopoDS_Face aFace = aMKFace.Face(); BRepAlgo_FaceRestrictor aFRestrictor; aFRestrictor.Init(aFace, Standard_False, Standard_True); for (ListOfShape::const_iterator anIt = theWires.cbegin(); - anIt != theWires.cend(); - ++anIt) { + anIt != theWires.cend(); ++anIt) { TopoDS_Wire aWire = TopoDS::Wire((*anIt)->impl()); aFRestrictor.Add(aWire); } @@ -1174,13 +1161,14 @@ void GeomAlgoAPI_ShapeTools::makeFacesWithHoles(const std::shared_ptr GeomAlgoAPI_ShapeTools::findPlane(const ListOfShape& theShapes) -{ +std::shared_ptr +GeomAlgoAPI_ShapeTools::findPlane(const ListOfShape &theShapes) { TopoDS_Compound aCompound; BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); - for (ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) { + for (ListOfShape::const_iterator anIt = theShapes.cbegin(); + anIt != theShapes.cend(); ++anIt) { aBuilder.Add(aCompound, (*anIt)->impl()); } BRepBuilderAPI_FindPlane aFindPlane(aCompound); @@ -1193,8 +1181,10 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::findPlane(const ListOfShape gp_Pnt aLoc = aPlane->Location(); gp_Dir aDir = aPlane->Axis().Direction(); - std::shared_ptr aGeomPnt(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); - std::shared_ptr aGeomDir(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); + std::shared_ptr aGeomPnt( + new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); + std::shared_ptr aGeomDir( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); std::shared_ptr aPln(new GeomAPI_Pln(aGeomPnt, aGeomDir)); @@ -1203,18 +1193,18 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::findPlane(const ListOfShape //================================================================================================== bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( - const std::shared_ptr theSubShape, - const std::shared_ptr theBaseShape) -{ + const std::shared_ptr theSubShape, + const std::shared_ptr theBaseShape) { if (!theSubShape.get() || !theBaseShape.get()) { return false; } - const TopoDS_Shape& aSubShape = theSubShape->impl(); - const TopoDS_Shape& aBaseShape = theBaseShape->impl(); + const TopoDS_Shape &aSubShape = theSubShape->impl(); + const TopoDS_Shape &aBaseShape = theBaseShape->impl(); if (aSubShape.ShapeType() == TopAbs_VERTEX) { - // If sub-shape is a vertex check distance to shape. If it is <= Precision::Confusion() then OK. + // If sub-shape is a vertex check distance to shape. If it is <= + // Precision::Confusion() then OK. BRepExtrema_DistShapeShape aDist(aBaseShape, aSubShape); aDist.Perform(); if (!aDist.IsDone() || aDist.Value() > Precision::Confusion()) { @@ -1236,16 +1226,19 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( ShapeAnalysis::FindBounds(anEdge, aV1, aV2); gp_Pnt aPnt1 = BRep_Tool::Pnt(aV1); gp_Pnt aPnt2 = BRep_Tool::Pnt(aV2); - for (TopExp_Explorer anExp(aBaseShape, TopAbs_EDGE); anExp.More(); anExp.Next()) { - const TopoDS_Shape& anEdgeOnFace = anExp.Current(); + for (TopExp_Explorer anExp(aBaseShape, TopAbs_EDGE); anExp.More(); + anExp.Next()) { + const TopoDS_Shape &anEdgeOnFace = anExp.Current(); BRepExtrema_DistShapeShape aDist(anEdgeOnFace, anEdge); aDist.Perform(); if (aDist.IsDone() && aDist.Value() <= Precision::Confusion()) { - // Edge intersect face bound. Check that it is not on edge begin or end. - for (Standard_Integer anIndex = 1; anIndex <= aDist.NbSolution(); ++anIndex) { + // Edge intersect face bound. Check that it is not on edge begin or + // end. + for (Standard_Integer anIndex = 1; anIndex <= aDist.NbSolution(); + ++anIndex) { gp_Pnt aPntOnSubShape = aDist.PointOnShape2(anIndex); - if (aPntOnSubShape.Distance(aPnt1) > Precision::Confusion() - && aPntOnSubShape.Distance(aPnt2) > Precision::Confusion()) { + if (aPntOnSubShape.Distance(aPnt1) > Precision::Confusion() && + aPntOnSubShape.Distance(aPnt2) > Precision::Confusion()) { return false; } } @@ -1254,12 +1247,13 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( // No intersections found. Edge is inside or outside face. Check it. BRepAdaptor_Curve aCurveAdaptor(anEdge); - gp_Pnt aPointToCheck = - aCurveAdaptor.Value((aCurveAdaptor.FirstParameter() + - aCurveAdaptor.LastParameter()) / 2.0); + gp_Pnt aPointToCheck = aCurveAdaptor.Value( + (aCurveAdaptor.FirstParameter() + aCurveAdaptor.LastParameter()) / + 2.0); Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); ShapeAnalysis_Surface aSAS(aSurface); - gp_Pnt2d aPointOnFace = aSAS.ValueOfUV(aPointToCheck, Precision::Confusion()); + gp_Pnt2d aPointOnFace = + aSAS.ValueOfUV(aPointToCheck, Precision::Confusion()); BRepTopAdaptor_FClass2d aFClass2d(aFace, Precision::Confusion()); if (aFClass2d.Perform(aPointOnFace) == TopAbs_OUT) { return false; @@ -1276,8 +1270,8 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( } //================================================================================================== -bool GeomAlgoAPI_ShapeTools::isShapeValid(const std::shared_ptr theShape) -{ +bool GeomAlgoAPI_ShapeTools::isShapeValid( + const std::shared_ptr theShape) { if (!theShape.get()) { return false; } @@ -1287,9 +1281,8 @@ bool GeomAlgoAPI_ShapeTools::isShapeValid(const std::shared_ptr t } //================================================================================================== -std::shared_ptr - GeomAlgoAPI_ShapeTools::getFaceOuterWire(const std::shared_ptr theFace) -{ +std::shared_ptr GeomAlgoAPI_ShapeTools::getFaceOuterWire( + const std::shared_ptr theFace) { GeomShapePtr anOuterWire; if (!theFace.get() || !theFace->isFace()) { @@ -1307,9 +1300,8 @@ std::shared_ptr //================================================================================================== static bool boundaryOfEdge(const std::shared_ptr theEdge, - const std::shared_ptr theVertex, - double& theParam) -{ + const std::shared_ptr theVertex, + double &theParam) { GeomPointPtr aPoint = theVertex->point(); GeomPointPtr aFirstPnt = theEdge->firstPoint(); double aFirstPntTol = theEdge->firstPointTolerance(); @@ -1329,10 +1321,10 @@ static bool boundaryOfEdge(const std::shared_ptr theEdge, return isFirst != isLast; } -bool GeomAlgoAPI_ShapeTools::isTangent(const std::shared_ptr theEdge1, - const std::shared_ptr theEdge2, - const std::shared_ptr theTgPoint) -{ +bool GeomAlgoAPI_ShapeTools::isTangent( + const std::shared_ptr theEdge1, + const std::shared_ptr theEdge2, + const std::shared_ptr theTgPoint) { double aParE1 = 0, aParE2 = 0; if (!boundaryOfEdge(theEdge1, theTgPoint, aParE1) || !boundaryOfEdge(theEdge2, theTgPoint, aParE2)) @@ -1344,70 +1336,75 @@ bool GeomAlgoAPI_ShapeTools::isTangent(const std::shared_ptr theEd } //================================================================================================== -bool GeomAlgoAPI_ShapeTools::isParallel(const std::shared_ptr theEdge, - const std::shared_ptr theFace) -{ +bool GeomAlgoAPI_ShapeTools::isParallel( + const std::shared_ptr theEdge, + const std::shared_ptr theFace) { if (!theEdge.get() || !theFace.get()) { return false; } TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl()); - TopoDS_Face aFace = TopoDS::Face(theFace->impl()); + TopoDS_Face aFace = TopoDS::Face(theFace->impl()); BRepExtrema_ExtCF anExt(anEdge, aFace); return anExt.IsParallel() == Standard_True; } //================================================================================================== -std::list > GeomAlgoAPI_ShapeTools::intersect( - const std::shared_ptr theEdge, const std::shared_ptr theFace) -{ - std::list > aResult; +std::list> +GeomAlgoAPI_ShapeTools::intersect(const std::shared_ptr theEdge, + const std::shared_ptr theFace) { + std::list> aResult; if (!theEdge.get() || !theFace.get()) { return aResult; } TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl()); double aFirstOnCurve, aLastOnCurve; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve); - TopoDS_Face aFace = TopoDS::Face(theFace->impl()); + TopoDS_Face aFace = TopoDS::Face(theFace->impl()); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); GeomAPI_IntCS anIntAlgo(aCurve, aSurf); if (!anIntAlgo.IsDone()) return aResult; // searching for points-intersection - for (int anIntNum = 1; anIntNum <= anIntAlgo.NbPoints() + anIntAlgo.NbSegments(); anIntNum++) { + for (int anIntNum = 1; + anIntNum <= anIntAlgo.NbPoints() + anIntAlgo.NbSegments(); anIntNum++) { gp_Pnt anInt; if (anIntNum <= anIntAlgo.NbPoints()) { anInt = anIntAlgo.Point(anIntNum); } else { // take the middle point on the segment of the intersection - Handle(Geom_Curve) anIntCurve = anIntAlgo.Segment(anIntNum - anIntAlgo.NbPoints()); - anIntCurve->D0((anIntCurve->FirstParameter() + anIntCurve->LastParameter()) / 2., anInt); + Handle(Geom_Curve) anIntCurve = + anIntAlgo.Segment(anIntNum - anIntAlgo.NbPoints()); + anIntCurve->D0( + (anIntCurve->FirstParameter() + anIntCurve->LastParameter()) / 2., + anInt); } aResult.push_back(std::shared_ptr( - new GeomAPI_Vertex(anInt.X(), anInt.Y(), anInt.Z()))); + new GeomAPI_Vertex(anInt.X(), anInt.Y(), anInt.Z()))); } return aResult; } //================================================================================================== -void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr& theBaseShape, - const GeomAlgoAPI_ShapeTools::PointToRefsMap& thePointsInfo, - std::set >& theShapes) -{ - // to split shape at least one point should be presented in the points container +void GeomAlgoAPI_ShapeTools::splitShape( + const std::shared_ptr &theBaseShape, + const GeomAlgoAPI_ShapeTools::PointToRefsMap &thePointsInfo, + std::set> &theShapes) { + // to split shape at least one point should be presented in the points + // container if (thePointsInfo.empty()) return; - // General Fuse to split edge by vertices + // General Fuse to split edge by vertices BOPAlgo_Builder aBOP; TopoDS_Edge aBaseEdge = theBaseShape->impl(); // Rebuild closed edge to place vertex to one of split points. // This will prevent edge to be split on same vertex. - if (BRep_Tool::IsClosed(aBaseEdge)) - { + if (BRep_Tool::IsClosed(aBaseEdge)) { Standard_Real aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast); @@ -1424,7 +1421,8 @@ void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr& th PointToRefsMap::const_iterator aPIt = thePointsInfo.begin(); for (; aPIt != thePointsInfo.end(); ++aPIt) { std::shared_ptr aPnt = aPIt->first; - TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex(gp_Pnt(aPnt->x(), aPnt->y(), aPnt->z())); + TopoDS_Vertex aV = + BRepBuilderAPI_MakeVertex(gp_Pnt(aPnt->x(), aPnt->y(), aPnt->z())); aBOP.AddArgument(aV); } @@ -1433,7 +1431,7 @@ void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr& th return; // Collect splits - const TopTools_ListOfShape& aSplits = aBOP.Modified(aBaseEdge); + const TopTools_ListOfShape &aSplits = aBOP.Modified(aBaseEdge); TopTools_ListIteratorOfListOfShape anIt(aSplits); for (; anIt.More(); anIt.Next()) { std::shared_ptr anEdge(new GeomAPI_Shape); @@ -1443,21 +1441,21 @@ void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr& th } //================================================================================================== -void GeomAlgoAPI_ShapeTools::splitShape_p(const std::shared_ptr& theBaseShape, - const std::list >& thePoints, - std::set >& theShapes) -{ +void GeomAlgoAPI_ShapeTools::splitShape_p( + const std::shared_ptr &theBaseShape, + const std::list> &thePoints, + std::set> &theShapes) { // General Fuse to split edge by vertices BOPAlgo_Builder aBOP; TopoDS_Edge aBaseEdge = theBaseShape->impl(); // Rebuild closed edge to place vertex to one of split points. // This will prevent edge to be split on seam vertex. - if (BRep_Tool::IsClosed(aBaseEdge)) - { + if (BRep_Tool::IsClosed(aBaseEdge)) { Standard_Real aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast); - std::list >::const_iterator aPIt = thePoints.begin(); + std::list>::const_iterator aPIt = + thePoints.begin(); gp_Pnt aPoint((*aPIt)->x(), (*aPIt)->y(), (*aPIt)->z()); TopAbs_Orientation anOrientation = aBaseEdge.Orientation(); @@ -1466,10 +1464,12 @@ void GeomAlgoAPI_ShapeTools::splitShape_p(const std::shared_ptr& } aBOP.AddArgument(aBaseEdge); - std::list >::const_iterator aPtIt = thePoints.begin(); + std::list>::const_iterator aPtIt = + thePoints.begin(); for (; aPtIt != thePoints.end(); ++aPtIt) { std::shared_ptr aPnt = *aPtIt; - TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex(gp_Pnt(aPnt->x(), aPnt->y(), aPnt->z())); + TopoDS_Vertex aV = + BRepBuilderAPI_MakeVertex(gp_Pnt(aPnt->x(), aPnt->y(), aPnt->z())); aBOP.AddArgument(aV); } @@ -1478,7 +1478,7 @@ void GeomAlgoAPI_ShapeTools::splitShape_p(const std::shared_ptr& return; // Collect splits - const TopTools_ListOfShape& aSplits = aBOP.Modified(aBaseEdge); + const TopTools_ListOfShape &aSplits = aBOP.Modified(aBaseEdge); TopTools_ListIteratorOfListOfShape anIt(aSplits); for (; anIt.More(); anIt.Next()) { std::shared_ptr anEdge(new GeomAPI_Shape); @@ -1489,19 +1489,20 @@ void GeomAlgoAPI_ShapeTools::splitShape_p(const std::shared_ptr& //================================================================================================== std::shared_ptr GeomAlgoAPI_ShapeTools::findShape( - const std::list >& thePoints, - const std::set >& theShapes) -{ + const std::list> &thePoints, + const std::set> &theShapes) { std::shared_ptr aResultShape; if (thePoints.size() == 2) { - std::list >::const_iterator aPntIt = thePoints.begin(); + std::list>::const_iterator aPntIt = + thePoints.begin(); std::shared_ptr aFirstPoint = *aPntIt; aPntIt++; std::shared_ptr aLastPoint = *aPntIt; - std::set >::const_iterator anIt = theShapes.begin(), - aLast = theShapes.end(); + std::set>::const_iterator + anIt = theShapes.begin(), + aLast = theShapes.end(); for (; anIt != aLast; anIt++) { GeomShapePtr aShape = *anIt; std::shared_ptr anEdge(new GeomAPI_Edge(aShape)); @@ -1510,7 +1511,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::findShape( std::shared_ptr anEdgeLastPoint = anEdge->lastPoint(); if (anEdgeFirstPoint->isEqual(aFirstPoint) && anEdgeLastPoint->isEqual(aLastPoint)) - aResultShape = aShape; + aResultShape = aShape; } } } @@ -1521,25 +1522,23 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::findShape( //================================================================================================== #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS std::shared_ptr GeomAlgoAPI_ShapeTools::buildDirFromAxisAndShape( - const std::shared_ptr theBaseShape, - const std::shared_ptr theAxis) -{ + const std::shared_ptr theBaseShape, + const std::shared_ptr theAxis) { gp_Pnt aCentreOfMassPoint = - GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape)->impl(); + GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape)->impl(); Handle(Geom_Line) aLine = new Geom_Line(theAxis->impl()); GeomAPI_ProjectPointOnCurve aPrjTool(aCentreOfMassPoint, aLine); gp_Pnt aPoint = aPrjTool.NearestPoint(); - std::shared_ptr aDir(new GeomAPI_Dir(aCentreOfMassPoint.X()-aPoint.X(), - aCentreOfMassPoint.Y()-aPoint.Y(), - aCentreOfMassPoint.Z()-aPoint.Z())); + std::shared_ptr aDir(new GeomAPI_Dir( + aCentreOfMassPoint.X() - aPoint.X(), aCentreOfMassPoint.Y() - aPoint.Y(), + aCentreOfMassPoint.Z() - aPoint.Z())); return aDir; } #endif //================================================================================================== -static TopoDS_Wire fixParametricGaps(const TopoDS_Wire& theWire) -{ +static TopoDS_Wire fixParametricGaps(const TopoDS_Wire &theWire) { TopoDS_Wire aFixedWire; Handle(Geom_Curve) aPrevCurve; double aPrevLastParam = -Precision::Infinite(); @@ -1552,7 +1551,8 @@ static TopoDS_Wire fixParametricGaps(const TopoDS_Wire& theWire) TopoDS_Edge anEdge = aWExp.Current(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); - if (aCurve == aPrevCurve && Abs(aFirst - aPrevLastParam) > Precision::Confusion()) { + if (aCurve == aPrevCurve && + Abs(aFirst - aPrevLastParam) > Precision::Confusion()) { // if parametric gap occurs, create new edge based on the copied curve aCurve = Handle(Geom_Curve)::DownCast(aCurve->Copy()); TopoDS_Vertex aV1, aV2; @@ -1574,8 +1574,7 @@ static TopoDS_Wire fixParametricGaps(const TopoDS_Wire& theWire) //================================================================================================== std::shared_ptr GeomAlgoAPI_ShapeTools::wireToEdge( - const std::shared_ptr& theWire) -{ + const std::shared_ptr &theWire) { GeomEdgePtr anEdge; if (theWire) { TopoDS_Wire aWire = theWire->impl(); @@ -1584,7 +1583,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::wireToEdge( aWExp.Next(); if (aWExp.More()) { // Workaround for the closed wire to avoid jumping of its start point: - // split this wire for two parts, convert them to edges, then compose together + // split this wire for two parts, convert them to edges, then compose + // together if (BRep_Tool::IsClosed(aWire)) { aWire = TopoDS::Wire(BRepBuilderAPI_Copy(aWire).Shape()); aWExp.Init(aWire); @@ -1595,18 +1595,22 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::wireToEdge( aSplitWire->setImpl(new TopoDS_Wire(aWire)); GeomEdgePtr aMergedEdge = wireToEdge(aSplitWire); - aWire = BRepBuilderAPI_MakeWire(aNewEdge, aMergedEdge->impl()); + aWire = + BRepBuilderAPI_MakeWire(aNewEdge, aMergedEdge->impl()); } - // Workaround: when concatenate a wire consisting of two edges based on the same B-spline - // curve (non-periodic, but having equal start and end points), first of which is placed - // at the end on the curve and second is placed at the start, this workaround copies - // second curve to avoid treating these edges as a single curve by setting trim parameters. + // Workaround: when concatenate a wire consisting of two edges based on + // the same B-spline curve (non-periodic, but having equal start and end + // points), first of which is placed at the end on the curve and second is + // placed at the start, this workaround copies second curve to avoid + // treating these edges as a single curve by setting trim parameters. aWire = fixParametricGaps(aWire); - aWire = BRepAlgo::ConcatenateWire(aWire, GeomAbs_G1); // join smooth parts of wire + aWire = BRepAlgo::ConcatenateWire( + aWire, GeomAbs_G1); // join smooth parts of wire aNewEdge = BRepAlgo::ConcatenateWireC0(aWire); // join C0 parts of wire - // Reapproximate the result edge to have the parameter equal to curvilinear abscissa. + // Reapproximate the result edge to have the parameter equal to + // curvilinear abscissa. static const int THE_MAX_DEGREE = 14; static const int THE_MAX_INTERVALS = 32; double aFirst, aLast; @@ -1616,14 +1620,16 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::wireToEdge( #else Handle(GeomAdaptor_Curve) aHCurve = new GeomAdaptor_Curve(aCurve); #endif - Approx_CurvilinearParameter anApprox(aHCurve, Precision::Confusion(), aCurve->Continuity(), - THE_MAX_DEGREE, THE_MAX_INTERVALS); + Approx_CurvilinearParameter anApprox(aHCurve, Precision::Confusion(), + aCurve->Continuity(), THE_MAX_DEGREE, + THE_MAX_INTERVALS); if (anApprox.HasResult()) { Handle(Geom_BSplineCurve) aNewCurve = anApprox.Curve3d(); TColStd_Array1OfReal aKnots = aNewCurve->Knots(); BSplCLib::Reparametrize(aFirst, aLast, aKnots); aNewCurve->SetKnots(aKnots); - BRep_Builder().UpdateEdge(aNewEdge, aNewCurve, BRep_Tool::Tolerance(aNewEdge)); + BRep_Builder().UpdateEdge(aNewEdge, aNewCurve, + BRep_Tool::Tolerance(aNewEdge)); } } anEdge = GeomEdgePtr(new GeomAPI_Edge); @@ -1633,8 +1639,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::wireToEdge( } //================================================================================================== -ListOfShape GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(const GeomShapePtr& theShape) -{ +ListOfShape +GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(const GeomShapePtr &theShape) { ListOfShape aSubShapes; if (!theShape->isCompound() && !theShape->isCompSolid() && @@ -1644,8 +1650,8 @@ ListOfShape GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(const GeomShapePtr& the for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) { GeomShapePtr aSubShape = anIt.current(); - if (aSubShape->isVertex() || aSubShape->isEdge() || - aSubShape->isFace() || aSubShape->isSolid()) { + if (aSubShape->isVertex() || aSubShape->isEdge() || aSubShape->isFace() || + aSubShape->isSolid()) { aSubShapes.push_back(aSubShape); } else { aSubShapes.splice(aSubShapes.end(), getLowLevelSubShapes(aSubShape)); @@ -1656,38 +1662,40 @@ ListOfShape GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(const GeomShapePtr& the } //================================================================================================== -static void getMinMaxPointsOnLine(const std::list >& thePoints, - const gp_Dir theDir, - double& theMin, double& theMax) -{ +static void +getMinMaxPointsOnLine(const std::list> &thePoints, + const gp_Dir theDir, double &theMin, double &theMax) { theMin = RealLast(); theMax = RealFirst(); // Project bounding points on theDir - for (std::list >::const_iterator - aPointsIt = thePoints.begin(); aPointsIt != thePoints.end(); aPointsIt++) { - const gp_Pnt& aPnt = (*aPointsIt)->impl(); - gp_Dir aPntDir (aPnt.XYZ()); - Standard_Real proj = (theDir*aPntDir) * aPnt.XYZ().Modulus(); - if (proj < theMin) theMin = proj; - if (proj > theMax) theMax = proj; + for (std::list>::const_iterator aPointsIt = + thePoints.begin(); + aPointsIt != thePoints.end(); aPointsIt++) { + const gp_Pnt &aPnt = (*aPointsIt)->impl(); + gp_Dir aPntDir(aPnt.XYZ()); + Standard_Real proj = (theDir * aPntDir) * aPnt.XYZ().Modulus(); + if (proj < theMin) + theMin = proj; + if (proj > theMax) + theMax = proj; } } //================================================================================================== -void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, - const ListOfShape& theBaseShapes, - const std::shared_ptr theDir, - double& theToSize, double& theFromSize) -{ +void GeomAlgoAPI_ShapeTools::computeThroughAll( + const ListOfShape &theObjects, const ListOfShape &theBaseShapes, + const std::shared_ptr theDir, double &theToSize, + double &theFromSize) { // Bounding box of objects - std::list > aBndObjs = + std::list> aBndObjs = GeomAlgoAPI_ShapeTools::getBoundingBox(theObjects); if (aBndObjs.size() != 8) { return; } - // the value to enlarge the bounding box of each object to make the extruded shape - // a little bit larger than overall objects to get the correct result of Boolean CUT operation + // the value to enlarge the bounding box of each object to make the extruded + // shape a little bit larger than overall objects to get the correct result of + // Boolean CUT operation double anEnlargement = 0.1 * aBndObjs.front()->distance(aBndObjs.back()); // Prism direction @@ -1696,7 +1704,7 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, gp_Dir aDir = theDir->impl(); // Bounding box of the base - std::list > aBndBases = + std::list> aBndBases = GeomAlgoAPI_ShapeTools::getBoundingBox(theBaseShapes); if (aBndBases.size() != 8) { return; @@ -1723,12 +1731,12 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, for (ListOfShape::const_iterator anIt = theBaseShapes.begin(); anIt != theBaseShapes.end(); ++anIt) { - const GeomShapePtr& aBaseShape_i = (*anIt); + const GeomShapePtr &aBaseShape_i = (*anIt); ListOfShape aBaseShapes_i; aBaseShapes_i.push_back(aBaseShape_i); // Bounding box of the base - std::list > aBndBases = + std::list> aBndBases = GeomAlgoAPI_ShapeTools::getBoundingBox(aBaseShapes_i, anEnlargement); if (aBndBases.size() != 8) { return; @@ -1737,17 +1745,20 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, // Direction (normal to aBaseShapes_i) // Code like in GeomAlgoAPI_Prism gp_Dir aDir; - const TopoDS_Shape& aBaseShape = aBaseShape_i->impl(); + const TopoDS_Shape &aBaseShape = aBaseShape_i->impl(); BRepBuilderAPI_FindPlane aFindPlane(aBaseShape); if (aFindPlane.Found() == Standard_True) { Handle(Geom_Plane) aPlane; - if (aBaseShape.ShapeType() == TopAbs_FACE || aBaseShape.ShapeType() == TopAbs_SHELL) { + if (aBaseShape.ShapeType() == TopAbs_FACE || + aBaseShape.ShapeType() == TopAbs_SHELL) { TopExp_Explorer anExp(aBaseShape, TopAbs_FACE); - const TopoDS_Shape& aFace = anExp.Current(); - Handle(Geom_Surface) aSurface = BRep_Tool::Surface(TopoDS::Face(aFace)); - if (aSurface->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { + const TopoDS_Shape &aFace = anExp.Current(); + Handle(Geom_Surface) aSurface = + BRep_Tool::Surface(TopoDS::Face(aFace)); + if (aSurface->DynamicType() == + STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { Handle(Geom_RectangularTrimmedSurface) aTrimSurface = - Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); aSurface = aTrimSurface->BasisSurface(); } if (aSurface->DynamicType() != STANDARD_TYPE(Geom_Plane)) { @@ -1776,20 +1787,22 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, double aToSize_i = upperBnd - lowBase; double aFromSize_i = upperBase - lowBnd; - if (aToSize_i > theToSize) theToSize = aToSize_i; - if (aFromSize_i > theFromSize) theFromSize = aFromSize_i; + if (aToSize_i > theToSize) + theToSize = aToSize_i; + if (aFromSize_i > theFromSize) + theFromSize = aFromSize_i; } } } -ListOfShape GeomAlgoAPI_ShapeTools::getSharedFaces(const GeomShapePtr& theShape) -{ +ListOfShape +GeomAlgoAPI_ShapeTools::getSharedFaces(const GeomShapePtr &theShape) { ListOfShape aSharedFaces; TopTools_IndexedDataMapOfShapeListOfShape aMapFS; TopExp::MapShapesAndUniqueAncestors(theShape->impl(), TopAbs_FACE, TopAbs_SOLID, aMapFS); for (Standard_Integer i = 1; i <= aMapFS.Extent(); i++) { - const TopTools_ListOfShape& ancestors = aMapFS.FindFromIndex(i); + const TopTools_ListOfShape &ancestors = aMapFS.FindFromIndex(i); if (ancestors.Size() > 1) { GeomShapePtr aFace(new GeomAPI_Shape); aFace->setImpl(new TopoDS_Shape(aMapFS.FindKey(i))); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index c65128260..9910b5baf 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_ShapeTools_H_ @@ -22,13 +23,13 @@ #include "GeomAlgoAPI.h" +#include #include #include -#include #include #include #ifdef WIN32 -#include +#include #endif class GeomAPI_Ax1; @@ -45,185 +46,201 @@ class ModelAPI_Object; /// \class GeomAlgoAPI_ShapeTools /// \ingroup DataAlgo /// \brief Useful tools for working with shapes. -class GeomAlgoAPI_ShapeTools -{ +class GeomAlgoAPI_ShapeTools { public: - /// \return the lenth of the edges of the current shape or 0.0 if it can be computed. - GEOMALGOAPI_EXPORT static double length(const std::shared_ptr theShape); + /// \return the lenth of the edges of the current shape or 0.0 if it can be + /// computed. + GEOMALGOAPI_EXPORT static double + length(const std::shared_ptr theShape); - /// \return the total volume of the solids of the current shape or 0.0 if it can be computed. - GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr theShape); + /// \return the total volume of the solids of the current shape or 0.0 if it + /// can be computed. + GEOMALGOAPI_EXPORT static double + volume(const std::shared_ptr theShape); - /// \return the total area of the faces of the current shape or 0.0 if it can be computed. - GEOMALGOAPI_EXPORT static double area(const std::shared_ptr theShape); + /// \return the total area of the faces of the current shape or 0.0 if it can + /// be computed. + GEOMALGOAPI_EXPORT static double + area(const std::shared_ptr theShape); /// indicate if two faces are continuous - /// with an angular tolerance used for G1 continuity to compare the angle between the normals - /// \param theFace1 the first face - /// \param theFace2 the second face - /// \param thePoint the point for the normal - /// \param theAngle the angular tolerance - /// \param theError error - GEOMALGOAPI_EXPORT static bool isContinuousFaces(const GeomShapePtr& theFace1, - const GeomShapePtr& theFace2, - const GeomPointPtr& thePoint, - const double & theAngle, - std::string& theError); + /// with an angular tolerance used for G1 continuity to compare the angle + /// between the normals \param theFace1 the first face \param theFace2 the + /// second face \param thePoint the point for the normal \param theAngle the + /// angular tolerance \param theError error + GEOMALGOAPI_EXPORT static bool isContinuousFaces(const GeomShapePtr &theFace1, + const GeomShapePtr &theFace2, + const GeomPointPtr &thePoint, + const double &theAngle, + std::string &theError); /// \return the center of mass of the current face. /// The coordinates returned for the center of mass /// are expressed in the absolute Cartesian coordinate system. /// (This function works only for surfaces). GEOMALGOAPI_EXPORT static std::shared_ptr - centreOfMass(const std::shared_ptr theShape); + centreOfMass(const std::shared_ptr theShape); /// \brief Obtain radius of cylindrical face. /// Return negative value if the face is not a cylinder - GEOMALGOAPI_EXPORT static double radius(const std::shared_ptr& theCylinder); + GEOMALGOAPI_EXPORT static double + radius(const std::shared_ptr &theCylinder); /// \brief Calculate minimal distance between shapes - GEOMALGOAPI_EXPORT static double minimalDistance(const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2); - GEOMALGOAPI_EXPORT static double minimalDistance(const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2, - std::array & fromShape1To2); + GEOMALGOAPI_EXPORT static double + minimalDistance(const GeomShapePtr &theShape1, const GeomShapePtr &theShape2); + GEOMALGOAPI_EXPORT static double + minimalDistance(const GeomShapePtr &theShape1, const GeomShapePtr &theShape2, + std::array &fromShape1To2); /// \brief Calculate maximal value of all possible distances between shapes. /// The shapes can be two edges or two faces only. - GEOMALGOAPI_EXPORT static double shapeProximity(const GeomShapePtr& theShape1, - const GeomShapePtr& theShape2); + GEOMALGOAPI_EXPORT static double + shapeProximity(const GeomShapePtr &theShape1, const GeomShapePtr &theShape2); - /// \brief Combines faces with common edges to shells, or solids to compsolids. - /// \param[in] theCompound compound of shapes. - /// \param[in] theType type of combine. - /// \param[out] theResults resulting shapes. - GEOMALGOAPI_EXPORT static std::shared_ptr combineShapes( - const std::shared_ptr theCompound, - const GeomAPI_Shape::ShapeType theType, ListOfShape& theResults); + /// \brief Combines faces with common edges to shells, or solids to + /// compsolids. \param[in] theCompound compound of shapes. \param[in] theType + /// type of combine. \param[out] theResults resulting shapes. + GEOMALGOAPI_EXPORT static std::shared_ptr + combineShapes(const std::shared_ptr theCompound, + const GeomAPI_Shape::ShapeType theType, + ListOfShape &theResults); /// \brief Groups shapes with shared topology to compounds. /// \param[in] theCompound compound of shapes. /// \return compound of compounds with shared topology. GEOMALGOAPI_EXPORT static std::shared_ptr - groupSharedTopology(const std::shared_ptr theCompound); + groupSharedTopology(const std::shared_ptr theCompound); /// \brief Check group of shapes has shared sub-shapes of the given type /// \param[in] theShapes list of shapes /// \param[in] theShapeType type of sub-shapes to check /// \return \c true if shared topology exists - GEOMALGOAPI_EXPORT static bool hasSharedTopology(const ListOfShape& theShapes, - const GeomAPI_Shape::ShapeType theShapeType); + GEOMALGOAPI_EXPORT static bool + hasSharedTopology(const ListOfShape &theShapes, + const GeomAPI_Shape::ShapeType theShapeType); /// \brief Calculates bounding box for theShapes /// \return list of eight points. /// \param[in] theShapes list of shapes. /// \param[in] theEnlarge enlarges bounding box size. - GEOMALGOAPI_EXPORT static - std::list > getBoundingBox(const ListOfShape& theShapes, - const double theEnlarge = 0.0); + GEOMALGOAPI_EXPORT static std::list> + getBoundingBox(const ListOfShape &theShapes, const double theEnlarge = 0.0); /// \brief Enlarges or reduces plane to fit bounding box. /// \return plane that fits to bounding box. /// \param[in] thePlane base plane. /// \param[in] thePoints bounding box points (should be eight). - GEOMALGOAPI_EXPORT static std::shared_ptr fitPlaneToBox( - const std::shared_ptr thePlane, - const std::list >& thePoints); - - /// \brief Finds the start and end vertices of theShape. theShape can be of the following type:\n - /// Vertex: theV1 and theV2 are the same and equal to theShape;\n - /// Edge : theV1 is start and theV2 is end vertex;\n - /// Wire : theV1 is start vertex of the first edge, theV2 is end vertex of the last edge. If wire - /// contains no edges theV1 and theV2 are nullified.\n - /// If none of the above theV1 and theV2 are nullified. - GEOMALGOAPI_EXPORT static void findBounds(const std::shared_ptr theShape, - std::shared_ptr& theV1, - std::shared_ptr& theV2); + GEOMALGOAPI_EXPORT static std::shared_ptr + fitPlaneToBox(const std::shared_ptr thePlane, + const std::list> &thePoints); + + /// \brief Finds the start and end vertices of theShape. theShape can be of + /// the following type:\n Vertex: theV1 and theV2 are the same and equal to + /// theShape;\n Edge : theV1 is start and theV2 is end vertex;\n Wire : theV1 + /// is start vertex of the first edge, theV2 is end vertex of the last edge. + /// If wire contains no edges theV1 and theV2 are nullified.\n If none of the + /// above theV1 and theV2 are nullified. + GEOMALGOAPI_EXPORT static void + findBounds(const std::shared_ptr theShape, + std::shared_ptr &theV1, + std::shared_ptr &theV2); /// \brief Creates faces with holes from wires. /// \param[in] theWires base wires. /// \param[out] theFaces resulting faces. - GEOMALGOAPI_EXPORT static void makeFacesWithHoles(const std::shared_ptr theOrigin, - const std::shared_ptr theDirection, - const ListOfShape& theWires, - ListOfShape& theFaces); + GEOMALGOAPI_EXPORT static void + makeFacesWithHoles(const std::shared_ptr theOrigin, + const std::shared_ptr theDirection, + const ListOfShape &theWires, ListOfShape &theFaces); /// \brief Return a plane for list of shapes if they are all planar. /// \param[in] theShapes shapes to find plane. /// \return plane where all shapes lie or empty pointer if they not planar. - GEOMALGOAPI_EXPORT static std::shared_ptr findPlane(const ListOfShape& theShapes); + GEOMALGOAPI_EXPORT static std::shared_ptr + findPlane(const ListOfShape &theShapes); /// \brief Checks that vertex/edge is inside face or vertex inside wire. /// \param[in] theSubShape shape that should be inside. /// \param[in] theBaseShape base shape. /// \return true if edge inside the face. - GEOMALGOAPI_EXPORT static bool isSubShapeInsideShape( - const std::shared_ptr theSubShape, - const std::shared_ptr theBaseShape); + GEOMALGOAPI_EXPORT static bool + isSubShapeInsideShape(const std::shared_ptr theSubShape, + const std::shared_ptr theBaseShape); /// \return true if theShape is valid. - GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr theShape); + GEOMALGOAPI_EXPORT static bool + isShapeValid(const std::shared_ptr theShape); - /// \return outer wire for face. If theShape has different type returns empty pointer. - GEOMALGOAPI_EXPORT static - std::shared_ptr getFaceOuterWire(const std::shared_ptr theFace); + /// \return outer wire for face. If theShape has different type returns empty + /// pointer. + GEOMALGOAPI_EXPORT static std::shared_ptr + getFaceOuterWire(const std::shared_ptr theFace); /// \return \c true if edges are tangent in the specified point - GEOMALGOAPI_EXPORT static bool isTangent(const std::shared_ptr theEdge1, - const std::shared_ptr theEdge2, - const std::shared_ptr theTgPoint); + GEOMALGOAPI_EXPORT static bool + isTangent(const std::shared_ptr theEdge1, + const std::shared_ptr theEdge2, + const std::shared_ptr theTgPoint); /// \return true if edge is parallel to face. - GEOMALGOAPI_EXPORT static bool isParallel(const std::shared_ptr theEdge, - const std::shared_ptr theFace); + GEOMALGOAPI_EXPORT static bool + isParallel(const std::shared_ptr theEdge, + const std::shared_ptr theFace); - /// Computes intersection point between the edge curve and a face surface (only one point, with - /// preferences to point that belongs to edge and face boundaries. - /// \returns null if there is no intersection - GEOMALGOAPI_EXPORT static std::list > intersect( - const std::shared_ptr theEdge, const std::shared_ptr theFace); + /// Computes intersection point between the edge curve and a face surface + /// (only one point, with preferences to point that belongs to edge and face + /// boundaries. \returns null if there is no intersection + GEOMALGOAPI_EXPORT static std::list> + intersect(const std::shared_ptr theEdge, + const std::shared_ptr theFace); typedef std::map, - std::pair >, - std::list > > > PointToRefsMap; + std::pair>, + std::list>>> + PointToRefsMap; /// \brief Performs the split of the shape by points. /// \param[in] theBaseShape shape that should be divided. /// \param[in] thePoints container of points to split /// \param[out] theShapes container of shapes after split - GEOMALGOAPI_EXPORT static void splitShape(const std::shared_ptr& theBaseShape, - const PointToRefsMap& thePointsInfo, - std::set >& theShapes); + GEOMALGOAPI_EXPORT static void + splitShape(const std::shared_ptr &theBaseShape, + const PointToRefsMap &thePointsInfo, + std::set> &theShapes); /// \brief Performs the split of the shape by points. /// \param[in] theBaseShape shape that should be divided. /// \param[in] thePoints container of points to split /// \param[out] theShapes container of shapes after split - GEOMALGOAPI_EXPORT static void splitShape_p(const std::shared_ptr& theBaseShape, - const std::list >& thePoints, - std::set >& theShapes); + GEOMALGOAPI_EXPORT static void + splitShape_p(const std::shared_ptr &theBaseShape, + const std::list> &thePoints, + std::set> &theShapes); - GEOMALGOAPI_EXPORT static std::shared_ptr findShape( - const std::list >& thePoints, - const std::set >& theShapes); + GEOMALGOAPI_EXPORT static std::shared_ptr + findShape(const std::list> &thePoints, + const std::set> &theShapes); #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS /// \brief Returns a direction from a shape and an axis. - /// \param[in] theBaseShape shape whose center of mass serves as the starting point of the dir. - /// \param[in] theAxis axis that serves as a direction for the dir - /// \return dir that builds from center of mass of the base shape and the axis - GEOMALGOAPI_EXPORT static std::shared_ptr buildDirFromAxisAndShape( - const std::shared_ptr theBaseShape, - const std::shared_ptr theAxis); + /// \param[in] theBaseShape shape whose center of mass serves as the starting + /// point of the dir. \param[in] theAxis axis that serves as a direction for + /// the dir \return dir that builds from center of mass of the base shape and + /// the axis + GEOMALGOAPI_EXPORT static std::shared_ptr + buildDirFromAxisAndShape(const std::shared_ptr theBaseShape, + const std::shared_ptr theAxis); #endif /// \brief Re-approximate a wire to build a single edge - GEOMALGOAPI_EXPORT static std::shared_ptr wireToEdge( - const std::shared_ptr& theWire); + GEOMALGOAPI_EXPORT static std::shared_ptr + wireToEdge(const std::shared_ptr &theWire); /// \brief Get non-composite sub-shapes of the given shape. /// \param[in] theShape shape that should be exploded /// \return list of sub-shapes (vertices, edges, faces, solids) - GEOMALGOAPI_EXPORT static ListOfShape getLowLevelSubShapes(const GeomShapePtr& theShape); + GEOMALGOAPI_EXPORT static ListOfShape + getLowLevelSubShapes(const GeomShapePtr &theShape); /// \brief Calculate prism sizes to ensure that it passes through all objects /// \param[in] theObjects objects to be joined/cutted by the prism @@ -231,15 +248,17 @@ public: /// \param[in] theDir direction of the prism /// \param[out] theToSize upper offset of the prism /// \param[out] theFromSize lower offset of the prism - GEOMALGOAPI_EXPORT static void computeThroughAll(const ListOfShape& theObjects, - const ListOfShape& theBaseShapes, - const std::shared_ptr theDir, - double& theToSize, double& theFromSize); + GEOMALGOAPI_EXPORT static void + computeThroughAll(const ListOfShape &theObjects, + const ListOfShape &theBaseShapes, + const std::shared_ptr theDir, + double &theToSize, double &theFromSize); /// \brief Get shared faces of a shape /// \param[in] theShape shape that should be exploded /// \return list of shared faces - GEOMALGOAPI_EXPORT static ListOfShape getSharedFaces(const GeomShapePtr& theShape); + GEOMALGOAPI_EXPORT static ListOfShape + getSharedFaces(const GeomShapePtr &theShape); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index 38266fe26..ab8c65317 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -14,35 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #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 TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape) -{ +static TopoDS_Vertex findStartVertex(const TopoDS_Shape &theShape) { static const double aTol = Precision::PConfusion(); TopExp_Explorer anExp(theShape, TopAbs_VERTEX); @@ -55,9 +55,11 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape) aCurrent = TopoDS::Vertex(anExp.Current()); aCurrentPnt = BRep_Tool::Pnt(aCurrent); if ((aCurrentPnt.X() > aStartPnt.X() + aTol) || - (aCurrentPnt.X() > aStartPnt.X() - aTol && aCurrentPnt.Y() > aStartPnt.Y() + aTol) || - (aCurrentPnt.X() > aStartPnt.X() - aTol && aCurrentPnt.Y() > aStartPnt.Y() - aTol && - aCurrentPnt.Z() > aStartPnt.Z() + aTol)) { + (aCurrentPnt.X() > aStartPnt.X() - aTol && + aCurrentPnt.Y() > aStartPnt.Y() + aTol) || + (aCurrentPnt.X() > aStartPnt.X() - aTol && + aCurrentPnt.Y() > aStartPnt.Y() - aTol && + aCurrentPnt.Z() > aStartPnt.Z() + aTol)) { aStart = aCurrent; aStartPnt = aCurrentPnt; } @@ -65,15 +67,16 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape) return aStart; } -static TopoDS_Vertex findStartVertex(const TopoDS_Wire& theWire, const TopoDS_Face& theFace, - const std::list >& theInitialShapes) -{ +static TopoDS_Vertex findStartVertex( + const TopoDS_Wire &theWire, const TopoDS_Face &theFace, + const std::list> &theInitialShapes) { // Try to find edge lying on the one of original edges. // First found edge will be taken as a start edge for the result wire - std::list >::const_iterator aFeatIt = theInitialShapes.begin(); + std::list>::const_iterator aFeatIt = + theInitialShapes.begin(); for (; aFeatIt != theInitialShapes.end(); aFeatIt++) { std::shared_ptr aShape(*aFeatIt); - const TopoDS_Edge& anEdge = aShape->impl(); + const TopoDS_Edge &anEdge = aShape->impl(); if (anEdge.ShapeType() != TopAbs_EDGE) continue; @@ -84,11 +87,12 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Wire& theWire, const TopoDS_Fa BRepTools_WireExplorer anExp(theWire, theFace); for (; anExp.More(); anExp.Next()) { - const TopoDS_Edge& aShapeEdge = anExp.Current(); + const TopoDS_Edge &aShapeEdge = anExp.Current(); double aF, aL; Handle(Geom_Curve) aShapeCurve = BRep_Tool::Curve(aShapeEdge, aF, aL); if (aShapeCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) - aShapeCurve = Handle(Geom_TrimmedCurve)::DownCast(aShapeCurve)->BasisCurve(); + aShapeCurve = + Handle(Geom_TrimmedCurve)::DownCast(aShapeCurve)->BasisCurve(); if (aCurve != aShapeCurve) continue; @@ -100,25 +104,26 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Wire& theWire, const TopoDS_Fa } } - // start vertex is not found, use algorithm to search vertex with the greatest coordinates + // start vertex is not found, use algorithm to search vertex with the greatest + // coordinates return findStartVertex(theWire); } // returns true if the first shape must be located earlier than the second -bool isFirst(const TopoDS_Shape& theFirst, const TopoDS_Shape& theSecond, - NCollection_DataMap >& theAreaToIndex, - const NCollection_DataMap& theCurveToIndex) -{ +bool isFirst( + const TopoDS_Shape &theFirst, const TopoDS_Shape &theSecond, + NCollection_DataMap> &theAreaToIndex, + const NCollection_DataMap &theCurveToIndex) { // fill theAreaToIndex for both shapes if needed - for(int aShapeNum = 1; aShapeNum <= 2; aShapeNum++) { + for (int aShapeNum = 1; aShapeNum <= 2; aShapeNum++) { TopoDS_Shape aShape = aShapeNum == 1 ? theFirst : theSecond; if (!theAreaToIndex.IsBound(aShape)) { // fill the list of curve indices NCollection_List aNewList; TopExp_Explorer anEdgesExp(aShape, TopAbs_EDGE); for (; anEdgesExp.More(); anEdgesExp.Next()) { double aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve( - TopoDS::Edge(anEdgesExp.Current()), aFirst, aLast); + Handle(Geom_Curve) aCurve = + BRep_Tool::Curve(TopoDS::Edge(anEdgesExp.Current()), aFirst, aLast); if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); if (theCurveToIndex.IsBound(aCurve)) { @@ -137,43 +142,54 @@ bool isFirst(const TopoDS_Shape& theFirst, const TopoDS_Shape& theSecond, } } bool isFirst; - bool aGeomCompare = !theAreaToIndex.IsBound(theFirst) || !theAreaToIndex.IsBound(theSecond); + bool aGeomCompare = + !theAreaToIndex.IsBound(theFirst) || !theAreaToIndex.IsBound(theSecond); if (!aGeomCompare) { // compare lists of indices one by one to find chich list indices are lower - NCollection_Array1::Iterator aFirstList(theAreaToIndex.ChangeFind(theFirst)); - NCollection_Array1::Iterator aSecondList(theAreaToIndex.ChangeFind(theSecond)); - for (; aFirstList.More() && aSecondList.More(); aFirstList.Next(), aSecondList.Next()) { - if (aFirstList.Value() < aSecondList.Value()) return true; - if (aFirstList.Value() > aSecondList.Value()) return false; + NCollection_Array1::Iterator aFirstList( + theAreaToIndex.ChangeFind(theFirst)); + NCollection_Array1::Iterator aSecondList( + theAreaToIndex.ChangeFind(theSecond)); + for (; aFirstList.More() && aSecondList.More(); + aFirstList.Next(), aSecondList.Next()) { + if (aFirstList.Value() < aSecondList.Value()) + return true; + if (aFirstList.Value() > aSecondList.Value()) + return false; } aGeomCompare = !aFirstList.More() && !aSecondList.More(); isFirst = !aFirstList.More(); } else { isFirst = !theAreaToIndex.IsBound(theFirst); } - // if faces are identical by curves names (circle splitted by line in seam-point), use parameters + // if faces are identical by curves names (circle splitted by line in + // seam-point), use parameters if (aGeomCompare) { GProp_GProps aGProps; BRepGProp::SurfaceProperties(theFirst, aGProps); gp_Pnt aCentre1 = aGProps.CentreOfMass(); BRepGProp::SurfaceProperties(theSecond, aGProps); gp_Pnt aCentre2 = aGProps.CentreOfMass(); - return aCentre1.X() + aCentre1.Y() + aCentre1.Z() < aCentre2.X() + aCentre2.Y() + aCentre2.Z(); + return aCentre1.X() + aCentre1.Y() + aCentre1.Z() < + aCentre2.X() + aCentre2.Y() + aCentre2.Z(); } // if in first list there is no elements left, it is the first return isFirst; } -// sorts faces (in theAreas list) to make persistent order: by initial shapes edges -static void sortAreas(TopTools_ListOfShape& theAreas, - const std::list >& theInitialShapes) -{ +// sorts faces (in theAreas list) to make persistent order: by initial shapes +// edges +static void +sortAreas(TopTools_ListOfShape &theAreas, + const std::list> &theInitialShapes) { // collect indices of all edges to operate them quickly - NCollection_DataMap aCurveToIndex; // curve -> index in initial shapes - std::list >::const_iterator aFeatIt = theInitialShapes.begin(); + NCollection_DataMap + aCurveToIndex; // curve -> index in initial shapes + std::list>::const_iterator aFeatIt = + theInitialShapes.begin(); for (int anIndex = 0; aFeatIt != theInitialShapes.end(); aFeatIt++) { std::shared_ptr aShape(*aFeatIt); - const TopoDS_Edge& anEdge = aShape->impl(); + const TopoDS_Edge &anEdge = aShape->impl(); if (anEdge.ShapeType() != TopAbs_EDGE) continue; @@ -185,13 +201,14 @@ static void sortAreas(TopTools_ListOfShape& theAreas, aCurveToIndex.Bind(aCurve, anIndex++); } // map from area to the most first indices of curves (to compare) in it - NCollection_DataMap > anAreaToIndex; + NCollection_DataMap> anAreaToIndex; // sort areas TopTools_ListOfShape::Iterator anArea1(theAreas); - for(; anArea1.More(); anArea1.Next()) { + for (; anArea1.More(); anArea1.Next()) { TopTools_ListOfShape::Iterator anArea2 = anArea1; - for(anArea2.Next(); anArea2.More(); anArea2.Next()) { - if (!isFirst(anArea1.Value(), anArea2.Value(), anAreaToIndex, aCurveToIndex)) { // exchange + for (anArea2.Next(); anArea2.More(); anArea2.Next()) { + if (!isFirst(anArea1.Value(), anArea2.Value(), anAreaToIndex, + aCurveToIndex)) { // exchange TopoDS_Shape aTmp = anArea1.Value(); anArea1.ChangeValue() = anArea2.Value(); anArea2.ChangeValue() = aTmp; @@ -201,11 +218,10 @@ static void sortAreas(TopTools_ListOfShape& theAreas, } void GeomAlgoAPI_SketchBuilder::build( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theNorm, - const std::list >& theEdges) -{ + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theNorm, + const std::list> &theEdges) { myResultFaces.clear(); setDone(false); if (theEdges.empty()) @@ -213,16 +229,18 @@ void GeomAlgoAPI_SketchBuilder::build( BRep_Builder aBuilder; // Planar face, where the sketch was built - gp_Ax3 aPlnAxes(theOrigin->impl(), theNorm->impl(), theDirX->impl()); + gp_Ax3 aPlnAxes(theOrigin->impl(), theNorm->impl(), + theDirX->impl()); Handle(Geom_Surface) aPlane(new Geom_Plane(aPlnAxes)); TopoDS_Face aPlnFace; aBuilder.MakeFace(aPlnFace, aPlane, Precision::Confusion()); - // Use General Fuse algorithm to prepare all subfaces, bounded by given list of edges - BOPAlgo_Builder* aBB = new BOPAlgo_Builder; + // Use General Fuse algorithm to prepare all subfaces, bounded by given list + // of edges + BOPAlgo_Builder *aBB = new BOPAlgo_Builder; aBB->AddArgument(aPlnFace); - // Set fuzzy value for BOP, because PlaneGCS can solve the set of constraints with - // the precision up to 5.e-5 if the sketch contains arcs. + // Set fuzzy value for BOP, because PlaneGCS can solve the set of constraints + // with the precision up to 5.e-5 if the sketch contains arcs. static const double THE_FUZZY_TOL = 5.e-5; aBB->SetFuzzyValue(THE_FUZZY_TOL); @@ -231,10 +249,11 @@ void GeomAlgoAPI_SketchBuilder::build( NCollection_List anEdges; NCollection_List::Iterator aShapeIt; - std::list >::const_iterator aFeatIt = theEdges.begin(); + std::list>::const_iterator aFeatIt = + theEdges.begin(); for (; aFeatIt != theEdges.end(); aFeatIt++) { std::shared_ptr aShape(*aFeatIt); - const TopoDS_Edge& anEdge = aShape->impl(); + const TopoDS_Edge &anEdge = aShape->impl(); if (anEdge.ShapeType() == TopAbs_EDGE) aBB->AddArgument(anEdge); } @@ -273,11 +292,13 @@ void GeomAlgoAPI_SketchBuilder::build( } // iterate on wires - for (TopTools_ListIteratorOfListOfShape aWIt(aWires); aWIt.More(); aWIt.Next()) { + for (TopTools_ListIteratorOfListOfShape aWIt(aWires); aWIt.More(); + aWIt.Next()) { TopoDS_Wire aWire = TopoDS::Wire(aWIt.Value()); // to make faces equal on different platforms, we will find - // a vertex lying on an edge with the lowest index in the list of initial edges + // a vertex lying on an edge with the lowest index in the list of initial + // edges TopoDS_Vertex aStartVertex = findStartVertex(aWire, aFace, theEdges); TopoDS_Wire aNewWire; @@ -291,7 +312,7 @@ void GeomAlgoAPI_SketchBuilder::build( if (anExp.Current().Orientation() == TopAbs_INTERNAL) continue; if (!aStartFound) { - const TopoDS_Edge& anEdge = anExp.Current(); + const TopoDS_Edge &anEdge = anExp.Current(); TopoDS_Vertex aV1, aV2; TopExp::Vertices(anEdge, aV1, aV2, Standard_True); if (aV1.IsSame(aStartVertex) == Standard_True) @@ -328,27 +349,27 @@ void GeomAlgoAPI_SketchBuilder::build( } GeomAlgoAPI_SketchBuilder::GeomAlgoAPI_SketchBuilder( - const std::shared_ptr& thePlane, - const std::list >& theEdges) -{ - build(thePlane->location(), thePlane->xDirection(), thePlane->direction(), theEdges); + const std::shared_ptr &thePlane, + const std::list> &theEdges) { + build(thePlane->location(), thePlane->xDirection(), thePlane->direction(), + theEdges); } GeomAlgoAPI_SketchBuilder::GeomAlgoAPI_SketchBuilder( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theNorm, - const std::shared_ptr& theWire) -{ + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theNorm, + const std::shared_ptr &theWire) { std::shared_ptr aWire = - std::dynamic_pointer_cast(theWire); - if(aWire) { + std::dynamic_pointer_cast(theWire); + if (aWire) { // Filter wires, return only faces. build(theOrigin, theDirX, theNorm, aWire->getEdges()); } else { // it may be only one circle - std::shared_ptr anEdge = std::dynamic_pointer_cast(theWire); + std::shared_ptr anEdge = + std::dynamic_pointer_cast(theWire); if (anEdge) { - std::list > aList; + std::list> aList; aList.push_back(anEdge); build(theOrigin, theDirX, theNorm, aList); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h index ab7b4cbdc..fefe594bb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_SketchBuilder_H_ @@ -23,8 +24,8 @@ #include #include -#include #include +#include class GeomAPI_Dir; class GeomAPI_Pln; @@ -35,8 +36,7 @@ class GeomAPI_Shape; * \ingroup DataAlgo * \brief Creates planar faces based on the list of Sketch features */ -class GeomAlgoAPI_SketchBuilder : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_SketchBuilder : public GeomAlgoAPI_MakeShape { public: /** \brief Creates list of faces based on the edges of the sketch * \param[in] thePlane plane of the sketch @@ -45,11 +45,12 @@ public: * The algorithm searches all loops of edges surrounding lesser areas. */ GEOMALGOAPI_EXPORT - GeomAlgoAPI_SketchBuilder(const std::shared_ptr& thePlane, - const std::list >& theEdges); + GeomAlgoAPI_SketchBuilder( + const std::shared_ptr &thePlane, + const std::list> &theEdges); - /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch - * \param[in] theOrigin origin point of the sketch + /** \brief Creates list of faces and unclosed wires on basis of the features + * of the sketch \param[in] theOrigin origin point of the sketch * \param[in] theDirX x-direction of the sketch * \param[in] theNorm normal of the sketch * \param[in] theWire a wire which contains all edges @@ -57,23 +58,25 @@ public: * The algorithm searches all loops of edges surrounding lesser areas. */ GEOMALGOAPI_EXPORT - GeomAlgoAPI_SketchBuilder(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theNorm, - const std::shared_ptr& theWire); + GeomAlgoAPI_SketchBuilder(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theNorm, + const std::shared_ptr &theWire); /// Return list of created faces - GEOMALGOAPI_EXPORT const std::list >& faces() const - { return myResultFaces; } + GEOMALGOAPI_EXPORT const std::list> & + faces() const { + return myResultFaces; + } private: - void build(const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theNorm, - const std::list >& theEdges); + void build(const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theNorm, + const std::list> &theEdges); private: - std::list > myResultFaces; + std::list> myResultFaces; }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp index 4e8d4178f..ca759b71c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_SolidClassifier.h" @@ -23,21 +24,19 @@ #include #include -#include #include #include #include -#include #include +#include #include +#include #include - -static GeomAlgoAPI_SolidClassifier::State stateToState(const TopAbs_State theState) -{ +static GeomAlgoAPI_SolidClassifier::State +stateToState(const TopAbs_State theState) { GeomAlgoAPI_SolidClassifier::State aResult; - switch (theState) - { + switch (theState) { case TopAbs_IN: aResult = GeomAlgoAPI_SolidClassifier::State_IN; break; @@ -55,16 +54,14 @@ static GeomAlgoAPI_SolidClassifier::State stateToState(const TopAbs_State theSta } static GeomAlgoAPI_SolidClassifier::State -classifyMiddlePoint(BRepClass3d_SolidClassifier& theClassifier, - const GeomShapePtr& theShape, - const double theTolerance) -{ +classifyMiddlePoint(BRepClass3d_SolidClassifier &theClassifier, + const GeomShapePtr &theShape, const double theTolerance) { GeomPointPtr aMiddlePoint = theShape->middlePoint(); gp_Pnt aPointOnFace = aMiddlePoint->impl(); if (theShape->shapeType() == GeomAPI_Shape::FACE) { // middle point may be out of face (within a hole), // in this case, find the nearest point on the face - const TopoDS_Face& aFace = theShape->impl(); + const TopoDS_Face &aFace = theShape->impl(); BRepClass_FaceClassifier aFaceClassifier(aFace, aPointOnFace, theTolerance); if (aFaceClassifier.State() == TopAbs_OUT) { BRepBuilderAPI_MakeVertex aVertex(aPointOnFace); @@ -78,11 +75,10 @@ classifyMiddlePoint(BRepClass3d_SolidClassifier& theClassifier, } static GeomAlgoAPI_SolidClassifier::State -classifyVertices(BRepClass3d_SolidClassifier& theClassifier, - const GeomShapePtr& theShape, - const double theTolerance) -{ - GeomAlgoAPI_SolidClassifier::State aResult = GeomAlgoAPI_SolidClassifier::State_UNKNOWN; +classifyVertices(BRepClass3d_SolidClassifier &theClassifier, + const GeomShapePtr &theShape, const double theTolerance) { + GeomAlgoAPI_SolidClassifier::State aResult = + GeomAlgoAPI_SolidClassifier::State_UNKNOWN; TopoDS_Shape aShape = theShape->impl(); for (TopExp_Explorer anExp(aShape, TopAbs_VERTEX); anExp.More() && aResult != GeomAlgoAPI_SolidClassifier::State_ALL; @@ -95,20 +91,19 @@ classifyVertices(BRepClass3d_SolidClassifier& theClassifier, } static GeomAlgoAPI_SolidClassifier::State -classifyVicinityOnEdge(BRepClass3d_SolidClassifier& theClassifier, - const TopoDS_Edge& theEdge, - const double theParameter, - const double theTolerance) -{ +classifyVicinityOnEdge(BRepClass3d_SolidClassifier &theClassifier, + const TopoDS_Edge &theEdge, const double theParameter, + const double theTolerance) { // coefficient to step out of the vicinity of theParameter static const double THE_STEP_COEFF = 2.0; BRepAdaptor_Curve aCurve(theEdge); double aParStep = aCurve.Resolution(theTolerance) * THE_STEP_COEFF; - double aParams[2] = { theParameter - aParStep, theParameter + aParStep }; + double aParams[2] = {theParameter - aParStep, theParameter + aParStep}; - GeomAlgoAPI_SolidClassifier::State aResult = GeomAlgoAPI_SolidClassifier::State_UNKNOWN; - for (double* anIt = std::begin(aParams); anIt != std::end(aParams); ++anIt) { + GeomAlgoAPI_SolidClassifier::State aResult = + GeomAlgoAPI_SolidClassifier::State_UNKNOWN; + for (double *anIt = std::begin(aParams); anIt != std::end(aParams); ++anIt) { if (*anIt < aCurve.FirstParameter()) *anIt = aCurve.FirstParameter(); else if (*anIt > aCurve.LastParameter()) @@ -122,36 +117,34 @@ classifyVicinityOnEdge(BRepClass3d_SolidClassifier& theClassifier, } static GeomAlgoAPI_SolidClassifier::State -classifyVicinityOnFace(BRepClass3d_SolidClassifier& theClassifier, - const TopoDS_Face& theFace, - const double theU, - const double theV, - const double theTolerance) -{ +classifyVicinityOnFace(BRepClass3d_SolidClassifier &theClassifier, + const TopoDS_Face &theFace, const double theU, + const double theV, const double theTolerance) { // coefficient to step out of the vicinity of parameters static const double THE_STEP_COEFF = 2.0; BRepAdaptor_Surface aSurf(theFace); double aStepU = aSurf.UResolution(theTolerance) * THE_STEP_COEFF; double aStepV = aSurf.VResolution(theTolerance) * THE_STEP_COEFF; - double aParamsU[3] = { theU - aStepU, theU, theU + aStepU }; - double aParamsV[3] = { theV - aStepV, theV, theV + aStepV }; - for (double* aU = std::begin(aParamsU); aU != std::end(aParamsU); ++aU) { + double aParamsU[3] = {theU - aStepU, theU, theU + aStepU}; + double aParamsV[3] = {theV - aStepV, theV, theV + aStepV}; + for (double *aU = std::begin(aParamsU); aU != std::end(aParamsU); ++aU) { if (*aU < aSurf.FirstUParameter()) *aU = aSurf.FirstUParameter(); else if (*aU > aSurf.LastUParameter()) *aU = aSurf.LastUParameter(); } - for (double* aV = std::begin(aParamsV); aV != std::end(aParamsV); ++aV) { + for (double *aV = std::begin(aParamsV); aV != std::end(aParamsV); ++aV) { if (*aV < aSurf.FirstVParameter()) *aV = aSurf.FirstVParameter(); else if (*aV > aSurf.LastVParameter()) *aV = aSurf.LastVParameter(); } - GeomAlgoAPI_SolidClassifier::State aResult = GeomAlgoAPI_SolidClassifier::State_UNKNOWN; - for (double* aU = std::begin(aParamsU); aU != std::end(aParamsU); ++aU) - for (double* aV = std::begin(aParamsV); aV != std::end(aParamsV); ++aV) { + GeomAlgoAPI_SolidClassifier::State aResult = + GeomAlgoAPI_SolidClassifier::State_UNKNOWN; + for (double *aU = std::begin(aParamsU); aU != std::end(aParamsU); ++aU) + for (double *aV = std::begin(aParamsV); aV != std::end(aParamsV); ++aV) { gp_Pnt aPnt = aSurf.Value(*aU, *aV); theClassifier.Perform(aPnt, theTolerance); aResult |= stateToState(theClassifier.State()); @@ -160,16 +153,16 @@ classifyVicinityOnFace(BRepClass3d_SolidClassifier& theClassifier, } static GeomAlgoAPI_SolidClassifier::State -classifyByDistance(BRepClass3d_SolidClassifier& theClassifier, - const GeomShapePtr& theSolid, - const GeomShapePtr& theShape, - const double theTolerance) -{ - GeomAlgoAPI_SolidClassifier::State aResult = GeomAlgoAPI_SolidClassifier::State_UNKNOWN; - - const TopoDS_Shape& aSolid = theSolid->impl(); - const TopoDS_Shape& aShape = theShape->impl(); - for (TopExp_Explorer anExp(aSolid, TopAbs_SHELL); anExp.More(); anExp.Next()) { +classifyByDistance(BRepClass3d_SolidClassifier &theClassifier, + const GeomShapePtr &theSolid, const GeomShapePtr &theShape, + const double theTolerance) { + GeomAlgoAPI_SolidClassifier::State aResult = + GeomAlgoAPI_SolidClassifier::State_UNKNOWN; + + const TopoDS_Shape &aSolid = theSolid->impl(); + const TopoDS_Shape &aShape = theShape->impl(); + for (TopExp_Explorer anExp(aSolid, TopAbs_SHELL); anExp.More(); + anExp.Next()) { // compare distance from the shape to the solid's shells BRepExtrema_DistShapeShape aDistance(anExp.Current(), aShape); if (aDistance.Perform() && aDistance.Value() < theTolerance) { @@ -181,14 +174,15 @@ classifyByDistance(BRepClass3d_SolidClassifier& theClassifier, double aParOnEdge; aDistance.ParOnEdgeS2(sol, aParOnEdge); - aResult |= classifyVicinityOnEdge(theClassifier, anEdge, aParOnEdge, theTolerance); - } - else if (aDistance.SupportTypeShape2(sol) == BRepExtrema_IsInFace) { + aResult |= classifyVicinityOnEdge(theClassifier, anEdge, aParOnEdge, + theTolerance); + } else if (aDistance.SupportTypeShape2(sol) == BRepExtrema_IsInFace) { TopoDS_Face aFace = TopoDS::Face(aDistance.SupportOnShape2(sol)); double aParU, aParV; aDistance.ParOnFaceS2(sol, aParU, aParV); - aResult |= classifyVicinityOnFace(theClassifier, aFace, aParU, aParV, theTolerance); + aResult |= classifyVicinityOnFace(theClassifier, aFace, aParU, aParV, + theTolerance); } } } @@ -196,13 +190,11 @@ classifyByDistance(BRepClass3d_SolidClassifier& theClassifier, return aResult; } - //================================================================================================== -GeomAlgoAPI_SolidClassifier::GeomAlgoAPI_SolidClassifier(const GeomSolidPtr theSolid, - const GeomShapePtr theShape, - const double theTolerance) - : myState(State_UNKNOWN) -{ +GeomAlgoAPI_SolidClassifier::GeomAlgoAPI_SolidClassifier( + const GeomSolidPtr theSolid, const GeomShapePtr theShape, + const double theTolerance) + : myState(State_UNKNOWN) { if (!theSolid || !theShape) return; @@ -211,7 +203,8 @@ GeomAlgoAPI_SolidClassifier::GeomAlgoAPI_SolidClassifier(const GeomSolidPtr theS myState = classifyMiddlePoint(aClassifierAlgo, theShape, theTolerance); if (!theShape->isVertex()) myState |= classifyVertices(aClassifierAlgo, theShape, theTolerance); - myState |= classifyByDistance(aClassifierAlgo, theSolid, theShape, theTolerance); + myState |= + classifyByDistance(aClassifierAlgo, theSolid, theShape, theTolerance); if (myState == State_ALL) myState = State_UNKNOWN; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h index 81bb12947..f2ac961e4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_SolidClassifier_H_ @@ -30,25 +31,25 @@ class GeomAPI_Solid; /// \class GeomAlgoAPI_SolidClassifier /// \ingroup DataAlgo /// \brief Classify shape according to the given solid. -class GeomAlgoAPI_SolidClassifier -{ +class GeomAlgoAPI_SolidClassifier { public: typedef int State; static const State State_UNKNOWN = 0x0; - static const State State_IN = 0x1; - static const State State_ON = 0x2; - static const State State_OUT = 0x4; - static const State State_ALL = State_IN & State_ON & State_OUT; + static const State State_IN = 0x1; + static const State State_ON = 0x2; + static const State State_OUT = 0x4; + static const State State_ALL = State_IN & State_ON & State_OUT; public: /// \brief Perform classification of the shape according to the solid. /// \param[in] theSolid the base solid /// \param[in] theShape the shape to classify /// \param[in] theTolerance comparison tolrence - GEOMALGOAPI_EXPORT GeomAlgoAPI_SolidClassifier(const std::shared_ptr theSolid, - const std::shared_ptr theShape, - const double theTolerance = 1.e-7); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_SolidClassifier(const std::shared_ptr theSolid, + const std::shared_ptr theShape, + const double theTolerance = 1.e-7); /// \return Classification result. State state() const { return myState; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp index e926e2f5c..aeed4a33a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp @@ -14,34 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_SortListOfShapes.h" -#include -#include -#include #include #include -#include +#include +#include +#include #include #include #include #include +#include #include #include -class CompareShapes -{ - std::map myShapes; - std::map myUVBounds; +class CompareShapes { + std::map myShapes; + std::map myUVBounds; - bool compareEdges(const GeomShapePtr& theLHS, const GeomShapePtr& theRHS) - { - const TopoDS_Edge& aLHSEdge = TopoDS::Edge(theLHS->impl()); - const TopoDS_Edge& aRHSEdge = TopoDS::Edge(theRHS->impl()); + bool compareEdges(const GeomShapePtr &theLHS, const GeomShapePtr &theRHS) { + const TopoDS_Edge &aLHSEdge = TopoDS::Edge(theLHS->impl()); + const TopoDS_Edge &aRHSEdge = TopoDS::Edge(theRHS->impl()); double aLF, aLE, aRF, aRE; Handle(Geom_Curve) aLHSCurve = BRep_Tool::Curve(aLHSEdge, aLF, aLE); @@ -60,10 +59,9 @@ class CompareShapes return compareByBoundingBox(theLHS, theRHS); } - bool compareFaces(const GeomShapePtr& theLHS, const GeomShapePtr& theRHS) - { - const TopoDS_Face& aLHSFace = TopoDS::Face(theLHS->impl()); - const TopoDS_Face& aRHSFace = TopoDS::Face(theRHS->impl()); + bool compareFaces(const GeomShapePtr &theLHS, const GeomShapePtr &theRHS) { + const TopoDS_Face &aLHSFace = TopoDS::Face(theLHS->impl()); + const TopoDS_Face &aRHSFace = TopoDS::Face(theRHS->impl()); Handle(Geom_Surface) aLHSSurf = BRep_Tool::Surface(aLHSFace); Handle(Geom_Surface) aRHSSurf = BRep_Tool::Surface(aRHSFace); @@ -77,9 +75,11 @@ class CompareShapes aLHSBox.Get(aLHSBB[0], aLHSBB[1], aLHSBB[2], aLHSBB[3]); aRHSBox.Get(aRHSBB[0], aRHSBB[1], aRHSBB[2], aRHSBB[3]); for (int anIndex = 0; anIndex < 4; ++anIndex) { - if (isLessWithTol(aLHSBB[anIndex], aRHSBB[anIndex], Precision::PConfusion())) + if (isLessWithTol(aLHSBB[anIndex], aRHSBB[anIndex], + Precision::PConfusion())) return true; - else if (isLessWithTol(aRHSBB[anIndex], aLHSBB[anIndex], Precision::PConfusion())) + else if (isLessWithTol(aRHSBB[anIndex], aLHSBB[anIndex], + Precision::PConfusion())) return false; } // equal parametric boxes @@ -89,8 +89,8 @@ class CompareShapes return compareByBoundingBox(theLHS, theRHS); } - bool compareByBoundingBox(const GeomShapePtr& theLHS, const GeomShapePtr& theRHS) - { + bool compareByBoundingBox(const GeomShapePtr &theLHS, + const GeomShapePtr &theRHS) { Bnd_Box aLHSBox = boundingBox(theLHS); Bnd_Box aRHSBox = boundingBox(theRHS); @@ -108,29 +108,28 @@ class CompareShapes return isLess(aLHSMax, aRHSMax); } - bool isLessWithTol(const double theLHS, const double theRHS, const double theTolerance) - { + bool isLessWithTol(const double theLHS, const double theRHS, + const double theTolerance) { return theLHS + theTolerance < theRHS; } - bool isLess(const gp_Pnt& theLHS, const gp_Pnt& theRHS) - { + bool isLess(const gp_Pnt &theLHS, const gp_Pnt &theRHS) { static const double aTol = 10. * Precision::Confusion(); for (int anIndex = 1; anIndex <= 3; ++anIndex) { if (isLessWithTol(theLHS.Coord(anIndex), theRHS.Coord(anIndex), aTol)) return true; - else if (isLessWithTol(theRHS.Coord(anIndex), theLHS.Coord(anIndex), aTol)) + else if (isLessWithTol(theRHS.Coord(anIndex), theLHS.Coord(anIndex), + aTol)) return false; } // equal points return false; } - Bnd_Box boundingBox(const GeomShapePtr& theShape) - { - const TopoDS_Shape& aShape = theShape->impl(); - TopoDS_TShape* aS = aShape.TShape().get(); - std::map::iterator aFound = myShapes.find(aS); + Bnd_Box boundingBox(const GeomShapePtr &theShape) { + const TopoDS_Shape &aShape = theShape->impl(); + TopoDS_TShape *aS = aShape.TShape().get(); + std::map::iterator aFound = myShapes.find(aS); if (aFound == myShapes.end()) { Bnd_Box aBB; BRepBndLib::AddOptimal(aShape, aBB, false); @@ -140,10 +139,10 @@ class CompareShapes return aFound->second; } - Bnd_Box2d boundingBoxUV(const TopoDS_Face& theFace) - { - TopoDS_TShape* aFacePtr = theFace.TShape().get(); - std::map::iterator aFound = myUVBounds.find(aFacePtr); + Bnd_Box2d boundingBoxUV(const TopoDS_Face &theFace) { + TopoDS_TShape *aFacePtr = theFace.TShape().get(); + std::map::iterator aFound = + myUVBounds.find(aFacePtr); if (aFound == myUVBounds.end()) { Bnd_Box2d aBB; BRepTools::AddUVBounds(theFace, aBB); @@ -155,8 +154,7 @@ class CompareShapes public: // Verify theLHS is less than theRHS - bool operator() (const GeomShapePtr& theLHS, const GeomShapePtr& theRHS) - { + bool operator()(const GeomShapePtr &theLHS, const GeomShapePtr &theRHS) { if (theLHS->shapeType() == theRHS->shapeType()) { // edges and faces are compared by geometric properties if (theLHS->shapeType() == GeomAPI_Shape::EDGE) @@ -172,9 +170,7 @@ public: } }; - -void GeomAlgoAPI_SortListOfShapes::sort(ListOfShape& theShapes) -{ +void GeomAlgoAPI_SortListOfShapes::sort(ListOfShape &theShapes) { CompareShapes aComparator; theShapes.sort(aComparator); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.h b/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.h index cfde0e86a..89ed8f6d2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_SortListOfShapes_H_ @@ -27,12 +28,11 @@ /// \class GeomAlgoAPI_SortListOfShapes /// \ingroup DataAlgo /// \brief Performs sorting of shapes according to geometric properties. -class GeomAlgoAPI_SortListOfShapes -{ - public: - /// \brief Sorts list of shapes in accordance with their geometric properties. - /// \param[in/out] theShapes list of shapes. - GEOMALGOAPI_EXPORT static void sort(ListOfShape& theShapes); +class GeomAlgoAPI_SortListOfShapes { +public: + /// \brief Sorts list of shapes in accordance with their geometric properties. + /// \param[in/out] theShapes list of shapes. + GEOMALGOAPI_EXPORT static void sort(ListOfShape &theShapes); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp index c6b26c5c9..774519521 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAlgoAPI_Sphere.h @@ -33,19 +34,20 @@ #include //================================================================================================= -GeomAlgoAPI_Sphere::GeomAlgoAPI_Sphere(std::shared_ptr theCenterPoint, - const double theRadius) -{ +GeomAlgoAPI_Sphere::GeomAlgoAPI_Sphere( + std::shared_ptr theCenterPoint, const double theRadius) { isRootGeo = false; myCenterPoint = theCenterPoint; myRadius = theRadius; } //================================================================================================= -GeomAlgoAPI_Sphere::GeomAlgoAPI_Sphere(const double theRMin, const double theRMax, - const double thePhiMin, const double thePhiMax, - const double theThetaMin, const double theThetaMax) -{ +GeomAlgoAPI_Sphere::GeomAlgoAPI_Sphere(const double theRMin, + const double theRMax, + const double thePhiMin, + const double thePhiMax, + const double theThetaMin, + const double theThetaMax) { isRootGeo = true; myRMin = theRMin; myRMax = theRMax; @@ -56,10 +58,9 @@ GeomAlgoAPI_Sphere::GeomAlgoAPI_Sphere(const double theRMin, const double theRMa } //================================================================================================= -bool GeomAlgoAPI_Sphere::check() -{ +bool GeomAlgoAPI_Sphere::check() { if (isRootGeo) { - if ((myRMin-myRMax) > Precision::Confusion()) { + if ((myRMin - myRMax) > Precision::Confusion()) { myError = "Sphere builder :: RMin is larger than RMax."; return false; } @@ -77,16 +78,16 @@ bool GeomAlgoAPI_Sphere::check() } //================================================================================================= -void GeomAlgoAPI_Sphere::build() -{ +void GeomAlgoAPI_Sphere::build() { myCreatedFaces.clear(); if (isRootGeo) { buildRootSphere(); } else { - const gp_Pnt& aCenterPoint = myCenterPoint->impl(); + const gp_Pnt &aCenterPoint = myCenterPoint->impl(); // Construct the sphere - BRepPrimAPI_MakeSphere *aSphereMaker = new BRepPrimAPI_MakeSphere(aCenterPoint, myRadius); + BRepPrimAPI_MakeSphere *aSphereMaker = + new BRepPrimAPI_MakeSphere(aCenterPoint, myRadius); aSphereMaker->Build(); @@ -112,8 +113,7 @@ void GeomAlgoAPI_Sphere::build() } //================================================================================================= -void GeomAlgoAPI_Sphere::buildRootSphere() -{ +void GeomAlgoAPI_Sphere::buildRootSphere() { myCreatedFaces.clear(); const double aStartPhiRad = myPhiMin * M_PI / 180.; @@ -122,24 +122,23 @@ void GeomAlgoAPI_Sphere::buildRootSphere() gp_Pnt anOrigin(0., 0., 0.); gp_Dir aNormal(-sin(aStartPhiRad), cos(aStartPhiRad), 0.); + // The section is defined by 4 points and up to 4 wires. In the rmin = 0 case, + // two of the points will actually be the origin + double aX = myRMax * sin(myThetaMin * M_PI / 180.); + double aZ = myRMax * cos(myThetaMin * M_PI / 180.); + gp_Pnt aTopOuterStart(aX * cos(aStartPhiRad), aX * sin(aStartPhiRad), aZ); - // The section is defined by 4 points and up to 4 wires. In the rmin = 0 case, two of the points - // will actually be the origin - double aX = myRMax*sin(myThetaMin * M_PI/180.); - double aZ = myRMax*cos(myThetaMin * M_PI/180.); - gp_Pnt aTopOuterStart(aX*cos(aStartPhiRad), aX*sin(aStartPhiRad), aZ); + aX = myRMax * sin((myThetaMin + myThetaMax) * M_PI / 180.); + aZ = myRMax * cos((myThetaMin + myThetaMax) * M_PI / 180.); + gp_Pnt aBaseOuterEnd(aX * cos(aStartPhiRad), aX * sin(aStartPhiRad), aZ); - aX = myRMax*sin((myThetaMin+myThetaMax) * M_PI/180.); - aZ = myRMax*cos((myThetaMin+myThetaMax) * M_PI/180.); - gp_Pnt aBaseOuterEnd(aX*cos(aStartPhiRad), aX*sin(aStartPhiRad), aZ); + aX = myRMin * sin(myThetaMin * M_PI / 180.); + aZ = myRMin * cos(myThetaMin * M_PI / 180.); + gp_Pnt aTopInnerStart(aX * cos(aStartPhiRad), aX * sin(aStartPhiRad), aZ); - aX = myRMin*sin(myThetaMin * M_PI/180.); - aZ = myRMin*cos(myThetaMin * M_PI/180.); - gp_Pnt aTopInnerStart(aX*cos(aStartPhiRad), aX*sin(aStartPhiRad), aZ); - - aX = myRMin*sin((myThetaMin+myThetaMax) * M_PI/180.); - aZ = myRMin*cos((myThetaMin+myThetaMax) * M_PI/180.); - gp_Pnt aBaseInnerEnd(aX*cos(aStartPhiRad), aX*sin(aStartPhiRad), aZ); + aX = myRMin * sin((myThetaMin + myThetaMax) * M_PI / 180.); + aZ = myRMin * cos((myThetaMin + myThetaMax) * M_PI / 180.); + gp_Pnt aBaseInnerEnd(aX * cos(aStartPhiRad), aX * sin(aStartPhiRad), aZ); // There will always be the rmax arc since rmax can't be zero gp_Circ anOuterCircle(gp_Ax2(anOrigin, aNormal), myRMax); @@ -147,21 +146,22 @@ void GeomAlgoAPI_Sphere::buildRootSphere() if (aTopOuterStart.IsEqual(aBaseOuterEnd, Precision::Confusion())) anArcOuterBuilder = BRepBuilderAPI_MakeEdge(anOuterCircle); else - anArcOuterBuilder = BRepBuilderAPI_MakeEdge(anOuterCircle, aTopOuterStart, aBaseOuterEnd); + anArcOuterBuilder = + BRepBuilderAPI_MakeEdge(anOuterCircle, aTopOuterStart, aBaseOuterEnd); anArcOuterBuilder.Build(); - // Two cases : either we need four edges (one being an arc with curvature radius rmin) or we - // need three (if rmin=0). - // In the later case the top and bottom edges intersect at the origin - // Add the edges to the wire in consecutive order (very important for the face to make sense - // topologically) - if(myRMin >= Precision::Confusion()){ + // Two cases : either we need four edges (one being an arc with curvature + // radius rmin) or we need three (if rmin=0). In the later case the top and + // bottom edges intersect at the origin Add the edges to the wire in + // consecutive order (very important for the face to make sense topologically) + if (myRMin >= Precision::Confusion()) { gp_Circ anInnerCircle(gp_Ax2(anOrigin, aNormal), myRMin); BRepBuilderAPI_MakeEdge anArcInnerBuilder; if (aTopInnerStart.IsEqual(aBaseInnerEnd, Precision::Confusion())) anArcInnerBuilder = BRepBuilderAPI_MakeEdge(anInnerCircle); else - anArcInnerBuilder = BRepBuilderAPI_MakeEdge(anInnerCircle, aTopInnerStart, aBaseInnerEnd); + anArcInnerBuilder = + BRepBuilderAPI_MakeEdge(anInnerCircle, aTopInnerStart, aBaseInnerEnd); anArcInnerBuilder.Build(); BRepBuilderAPI_MakeEdge anEdgeStartBuilder(aTopInnerStart, aTopOuterStart); @@ -173,8 +173,7 @@ void GeomAlgoAPI_Sphere::buildRootSphere() aWireBuilder.Add(anArcOuterBuilder.Edge()); aWireBuilder.Add(anEdgeEndBuilder.Edge()); aWireBuilder.Add(anArcInnerBuilder.Edge()); - } - else{ + } else { BRepBuilderAPI_MakeEdge anEdgeStartBuilder(anOrigin, aTopOuterStart); anEdgeStartBuilder.Build(); BRepBuilderAPI_MakeEdge anEdgeEndBuilder(anOrigin, aBaseOuterEnd); @@ -190,7 +189,7 @@ void GeomAlgoAPI_Sphere::buildRootSphere() BRepBuilderAPI_MakeFace aFaceBuilder(aWireBuilder.Wire()); aFaceBuilder.Build(); - if (!aFaceBuilder.IsDone()){ + if (!aFaceBuilder.IsDone()) { myError = "GDML sphere builder :: section is not valid"; return; } @@ -199,21 +198,22 @@ void GeomAlgoAPI_Sphere::buildRootSphere() gp_Dir aZDir(0., 0., 1.); gp_Ax1 aZAxis(anOrigin, aZDir); - // Build the solid using the section face we've created and a revolution builder - BRepPrimAPI_MakeRevol* aRevolBuilder = - new BRepPrimAPI_MakeRevol(aFaceBuilder.Face(), aZAxis, myPhiMax * M_PI / 180., Standard_True); - if(!aRevolBuilder) { + // Build the solid using the section face we've created and a revolution + // builder + BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol( + aFaceBuilder.Face(), aZAxis, myPhiMax * M_PI / 180., Standard_True); + if (!aRevolBuilder) { return; myError = "GDML Sphere builder :: section revolution did not succeed"; } - if(!aRevolBuilder->IsDone()) { + if (!aRevolBuilder->IsDone()) { myError = "GDML Sphere builder :: section revolution did not succeed"; return; } // Get the shape, verify it, build a GeomAPI_Shape. std::shared_ptr aResultShape = - std::shared_ptr(new GeomAPI_Shape()); + std::shared_ptr(new GeomAPI_Shape()); aResultShape->setImpl(new TopoDS_Shape(aRevolBuilder->Shape())); setShape(aResultShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h index 0cdfad086..9dacdef39 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAlgoAPI_Sphere.h @@ -32,14 +33,14 @@ * \ingroup DataAlgo * \brief Allows to create Sphere Primitives */ -class GeomAlgoAPI_Sphere : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Sphere : public GeomAlgoAPI_MakeShape { +public: /// Creates a sphere. /// \param theCenterPoint The center point of the sphere /// \param theRadius The radius of the sphere - GEOMALGOAPI_EXPORT GeomAlgoAPI_Sphere(std::shared_ptr theCenterPoint, - const double theRadius); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Sphere(std::shared_ptr theCenterPoint, + const double theRadius); /// Creates a sphere. /// \param theRMin The inner radius of the sphere /// \param theRMax The outer radius of the sphere @@ -47,9 +48,10 @@ class GeomAlgoAPI_Sphere : public GeomAlgoAPI_MakeShape /// \param thePhiMax The higher phi limit /// \param theThetaMin The lower theta limit /// \param theThetaMax The higher theta limit - GEOMALGOAPI_EXPORT GeomAlgoAPI_Sphere(const double theRMin, const double theRMax, - const double thePhiMin, const double thePhiMax, - const double theThetaMin, const double theThetaMax); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Sphere(const double theRMin, const double theRMax, + const double thePhiMin, const double thePhiMax, + const double theThetaMin, const double theThetaMax); /// Checks if data for the sphere construction is OK. GEOMALGOAPI_EXPORT bool check(); @@ -60,7 +62,7 @@ class GeomAlgoAPI_Sphere : public GeomAlgoAPI_MakeShape /// Builds the sphere. GEOMALGOAPI_EXPORT void buildRootSphere(); - private: +private: bool isRootGeo; std::shared_ptr myCenterPoint; /// Center of the sphere. double myRadius; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp index 0ddd0c91a..f63e6916b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include #include +#include //================================================================================================= -GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr thePoint) -{ +GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry( + std::shared_ptr theSourceShape, + std::shared_ptr thePoint) { if (!thePoint) { myError = "Symmetry builder :: point is not valid."; return; @@ -39,9 +40,9 @@ GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSou } //================================================================================================= -GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr theAxis) -{ +GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry( + std::shared_ptr theSourceShape, + std::shared_ptr theAxis) { if (!theAxis) { myError = "Symmetry builder :: axis is not valid."; return; @@ -54,9 +55,9 @@ GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSou } //================================================================================================= -GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr thePlane) -{ +GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry( + std::shared_ptr theSourceShape, + std::shared_ptr thePlane) { if (!thePlane) { myError = "Symmetry builder :: plane is not valid."; return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h index 97f0a8048..91290eef9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_SYMMETRY_H_ @@ -29,31 +30,37 @@ class GeomAPI_Pnt; /// \class GeomAlgoAPI_Symmetry /// \ingroup DataAlgo -/// \brief Creates a copy of the object by performing a symmetry operation by a point, +/// \brief Creates a copy of the object by performing a symmetry operation by a +/// point, /// by an axis or by a plane. -class GeomAlgoAPI_Symmetry : public GeomAlgoAPI_Transform -{ +class GeomAlgoAPI_Symmetry : public GeomAlgoAPI_Transform { public: - /// \brief Creates an object which is obtained from current object by performing + /// \brief Creates an object which is obtained from current object by + /// performing /// a symmetry operation by a point. /// \param[in] theSourceShape the shape to be moved. /// \param[in] thePoint the symmetry point. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr thePoint); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, + std::shared_ptr thePoint); - /// \brief Creates an object which is obtained from current object by performing + /// \brief Creates an object which is obtained from current object by + /// performing /// a symmetry operation by a point. /// \param[in] theSourceShape the shape to be moved. /// \param[in] theAxis the symmetry axis. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr theAxis); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, + std::shared_ptr theAxis); - /// \brief Creates an object which is obtained from current object by performing + /// \brief Creates an object which is obtained from current object by + /// performing /// a symmetry operation by a point. /// \param[in] theSourceShape the shape to be moved. /// \param[in] thePlane the symmetry plane. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr thePlane); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, + std::shared_ptr thePlane); }; #endif // GEOMALGOAPI_SYMMETRY_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.cpp index f9f986a41..230578018 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_ThroughAll.h" @@ -22,39 +23,42 @@ #include #include -#include #include +#include +#include #include #include #include -#include //================================================================================================= -GeomAlgoAPI_ThroughAll::GeomAlgoAPI_ThroughAll(std::shared_ptr thePrismAlgo, - const ListOfShape& theObjects) -: GeomAlgoAPI_Boolean(thePrismAlgo->shape(), theObjects, GeomAlgoAPI_Tools::BOOL_CUT) -{ +GeomAlgoAPI_ThroughAll::GeomAlgoAPI_ThroughAll( + std::shared_ptr thePrismAlgo, + const ListOfShape &theObjects) + : GeomAlgoAPI_Boolean(thePrismAlgo->shape(), theObjects, + GeomAlgoAPI_Tools::BOOL_CUT) { removeEnds(thePrismAlgo); } //================================================================================================= -void GeomAlgoAPI_ThroughAll::removeEnds(std::shared_ptr thePrismAlgo) -{ - GeomShapePtr aCuttedTool = shape(); // result of BOP Cut (thePrismAlgo->shape() by theObjects) +void GeomAlgoAPI_ThroughAll::removeEnds( + std::shared_ptr thePrismAlgo) { + GeomShapePtr aCuttedTool = + shape(); // result of BOP Cut (thePrismAlgo->shape() by theObjects) // Simplify the result - ListOfShape aPieces = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aCuttedTool); + ListOfShape aPieces = + GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aCuttedTool); // Get end shapes of Prism - const ListOfShape& fromShapes = thePrismAlgo->fromShapes(); - const ListOfShape& toShapes = thePrismAlgo->toShapes(); - ListOfShape endShapes (fromShapes); + const ListOfShape &fromShapes = thePrismAlgo->fromShapes(); + const ListOfShape &toShapes = thePrismAlgo->toShapes(); + ListOfShape endShapes(fromShapes); endShapes.insert(endShapes.end(), toShapes.begin(), toShapes.end()); // Throw away end pieces of cutted tools (containing endShapes) TopTools_ListOfShape listTools; - for (ListOfShape::const_iterator - anIt = aPieces.begin(); anIt != aPieces.end(); anIt++) { + for (ListOfShape::const_iterator anIt = aPieces.begin(); + anIt != aPieces.end(); anIt++) { TopoDS_Shape aPiece = (*anIt)->impl(); bool endPiece = false; @@ -62,7 +66,7 @@ void GeomAlgoAPI_ThroughAll::removeEnds(std::shared_ptr thePr aBaseIt != endShapes.end() && !endPiece; aBaseIt++) { // Check, if the piece contains aBase (one of endShapes) TopoDS_Shape aBase = (*aBaseIt)->impl(); - TopExp_Explorer anExp (aPiece, aBase.ShapeType()); + TopExp_Explorer anExp(aPiece, aBase.ShapeType()); for (; anExp.More() && !endPiece; anExp.Next()) { if (anExp.Current().IsSame(aBase)) endPiece = true; @@ -77,11 +81,12 @@ void GeomAlgoAPI_ThroughAll::removeEnds(std::shared_ptr thePr BRep_Builder aBuilder; TopoDS_Compound aCompound; aBuilder.MakeCompound(aCompound); - for (TopTools_ListOfShape::Iterator anIt(listTools); anIt.More(); anIt.Next()) { + for (TopTools_ListOfShape::Iterator anIt(listTools); anIt.More(); + anIt.Next()) { aBuilder.Add(aCompound, anIt.Value()); } - std::shared_ptr aShape (new GeomAPI_Shape()); + std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aCompound)); this->setShape(aShape); this->setDone(true); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h b/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h index 0987691d8..15092d5db 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_ThroughAll_H_ @@ -30,17 +31,16 @@ /// \class GeomAlgoAPI_ThroughAll /// \ingroup DataAlgo /// \brief Cuts a prism by all given objects, throw away end pieces -class GeomAlgoAPI_ThroughAll : public GeomAlgoAPI_Boolean -{ +class GeomAlgoAPI_ThroughAll : public GeomAlgoAPI_Boolean { public: - /// Constructor. - GEOMALGOAPI_EXPORT GeomAlgoAPI_ThroughAll (std::shared_ptr thePrismAlgo, - const ListOfShape& theObjects); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_ThroughAll(std::shared_ptr thePrismAlgo, + const ListOfShape &theObjects); private: /// Builds resulting shape. - void removeEnds (std::shared_ptr thePrismAlgo); + void removeEnds(std::shared_ptr thePrismAlgo); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp index dc13d953c..a7f814318 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Tools.h" @@ -22,25 +23,19 @@ #include -#include #include +#include using namespace GeomAlgoAPI_Tools; -Localizer::Localizer() -{ +Localizer::Localizer() { myCurLocale = std::setlocale(LC_NUMERIC, 0); std::setlocale(LC_NUMERIC, "C"); } -Localizer::~Localizer() -{ - std::setlocale(LC_NUMERIC, myCurLocale.c_str()); -} - +Localizer::~Localizer() { std::setlocale(LC_NUMERIC, myCurLocale.c_str()); } -std::string File_Tools::extension(const std::string& theFileName) -{ +std::string File_Tools::extension(const std::string &theFileName) { // retrieve the file and plugin library names TCollection_AsciiString aFileName(theFileName.c_str()); OSD_Path aPath(aFileName); @@ -53,29 +48,28 @@ std::string File_Tools::extension(const std::string& theFileName) return anExtension.ToCString(); } -std::string File_Tools::name(const std::string& theFileName) -{ +std::string File_Tools::name(const std::string &theFileName) { // retrieve the file and plugin library names TCollection_AsciiString aFileName(theFileName.c_str()); OSD_Path aPath(aFileName); return aPath.Name().ToCString(); } -std::string File_Tools::path(const std::string& theFileName) -{ - OSD_Path aPath (theFileName.c_str()); - Standard_Integer aTrekLen = - int(theFileName.size()) - aPath.Extension().Length() - aPath.Name().Length(); +std::string File_Tools::path(const std::string &theFileName) { + OSD_Path aPath(theFileName.c_str()); + Standard_Integer aTrekLen = int(theFileName.size()) - + aPath.Extension().Length() - + aPath.Name().Length(); return theFileName.substr(0, aTrekLen); } -bool AlgoError::isAlgorithmFailed(const GeomMakeShapePtr& theAlgorithm, - const std::string& theFeature, - std::string& theError) -{ +bool AlgoError::isAlgorithmFailed(const GeomMakeShapePtr &theAlgorithm, + const std::string &theFeature, + std::string &theError) { theError.clear(); if (!theAlgorithm->isDone()) { - theError = "Error: " + (theFeature.empty() ? "The" : theFeature) + " algorithm failed."; + theError = "Error: " + (theFeature.empty() ? "The" : theFeature) + + " algorithm failed."; std::string anAlgoError = theAlgorithm->getError(); if (!anAlgoError.empty()) theError += " " + anAlgoError; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h index 27d40ce72..c46c9cce9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_TOOLS_H_ @@ -40,11 +41,11 @@ enum BOPType { * \ingroup DataAlgo * \brief Localizer tool. */ -class Localizer -{ +class Localizer { public: GEOMALGOAPI_EXPORT Localizer(); GEOMALGOAPI_EXPORT ~Localizer(); + private: std::string myCurLocale; }; @@ -58,15 +59,16 @@ public: /** * Returns an extension of theFileName */ - GEOMALGOAPI_EXPORT static std::string extension(const std::string& theFileName); + GEOMALGOAPI_EXPORT static std::string + extension(const std::string &theFileName); /** * Returns a name of theFileName */ - GEOMALGOAPI_EXPORT static std::string name(const std::string& theFileName); + GEOMALGOAPI_EXPORT static std::string name(const std::string &theFileName); /** * Returns a directory path of theFileName */ - GEOMALGOAPI_EXPORT static std::string path(const std::string& theFileName); + GEOMALGOAPI_EXPORT static std::string path(const std::string &theFileName); }; /** \class AlgoError @@ -81,12 +83,11 @@ public: * \param[out] theError error string (empty if the feature succeed) * \return \c true if succeed */ - GEOMALGOAPI_EXPORT static bool isAlgorithmFailed( - const std::shared_ptr& theAlgorithm, - const std::string& theFeature, - std::string& theError); + GEOMALGOAPI_EXPORT static bool + isAlgorithmFailed(const std::shared_ptr &theAlgorithm, + const std::string &theFeature, std::string &theError); }; -} // GeomAlgoAPI_Tools +} // namespace GeomAlgoAPI_Tools #endif /* GEOMALGOAPI_TOOLS_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp index c8bb11b2c..492383ff8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAlgoAPI_Torus.cpp @@ -30,16 +31,14 @@ //================================================================================================= GeomAlgoAPI_Torus::GeomAlgoAPI_Torus(std::shared_ptr theAxis, const double theRadius, - const double theRingRadius) -{ + const double theRingRadius) { myAxis = theAxis; myRadius = theRadius; myRingRadius = theRingRadius; } //================================================================================================= -bool GeomAlgoAPI_Torus::check() -{ +bool GeomAlgoAPI_Torus::check() { if (!myAxis) { myError = "Torus builder :: axis is not valid."; return false; @@ -57,15 +56,14 @@ bool GeomAlgoAPI_Torus::check() } //================================================================================================= -void GeomAlgoAPI_Torus::build() -{ +void GeomAlgoAPI_Torus::build() { myCreatedFaces.clear(); - const gp_Ax2& anAxis = myAxis->impl(); + const gp_Ax2 &anAxis = myAxis->impl(); // Construct the torus BRepPrimAPI_MakeTorus *aTorusMaker = - new BRepPrimAPI_MakeTorus(anAxis, myRadius, myRingRadius); + new BRepPrimAPI_MakeTorus(anAxis, myRadius, myRingRadius); aTorusMaker->Build(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h index e2d1f3e27..a3833ba23 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GeomAlgoAPI_Torus.h @@ -32,9 +33,8 @@ * \ingroup DataAlgo * \brief Allows to create Torus Primitives */ -class GeomAlgoAPI_Torus : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Torus : public GeomAlgoAPI_MakeShape { +public: /// Creates a torus. /// \param theAxis The axis of the torus /// \param theRadius The radius of the torus @@ -49,10 +49,10 @@ class GeomAlgoAPI_Torus : public GeomAlgoAPI_MakeShape /// Builds the torus. GEOMALGOAPI_EXPORT void build(); - private: +private: std::shared_ptr myAxis; /// Axis of the torus. - double myRadius; /// Radius of the torus. - double myRingRadius; /// Ring radius of the torus. + double myRadius; /// Radius of the torus. + double myRingRadius; /// Ring radius of the torus. }; #endif // GEOMALGOAPI_TORUS_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp index 6f1844de8..4d82d8fbe 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Transform.h" @@ -27,30 +28,31 @@ #include //================================================================================================= -GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, - std::shared_ptr theTrsf) -{ +GeomAlgoAPI_Transform::GeomAlgoAPI_Transform( + std::shared_ptr theSourceShape, + std::shared_ptr theTrsf) { build(theSourceShape, theTrsf); } //================================================================================================= void GeomAlgoAPI_Transform::build(std::shared_ptr theSourceShape, - std::shared_ptr theTrsf) -{ + std::shared_ptr theTrsf) { if (!theSourceShape || !theTrsf) { myError = "Transformation :: incorrect input data."; return; } - const TopoDS_Shape& aSourceShape = theSourceShape->impl(); - const gp_Trsf& aTrsf = theTrsf->impl(); + const TopoDS_Shape &aSourceShape = theSourceShape->impl(); + const gp_Trsf &aTrsf = theTrsf->impl(); if (aSourceShape.IsNull()) { - myError = "Transformation :: source shape does not contain any actual shape."; + myError = + "Transformation :: source shape does not contain any actual shape."; return; } - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); + BRepBuilderAPI_Transform *aBuilder = + new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); if (!aBuilder) return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h index d34c99b23..541d58abc 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Transform_H_ @@ -29,14 +30,14 @@ /// \class GeomAlgoAPI_Transform /// \ingroup DataAlgo /// \brief Creates a copy of the object by transformating it. -class GeomAlgoAPI_Transform : public GeomAlgoAPI_MakeShape -{ +class GeomAlgoAPI_Transform : public GeomAlgoAPI_MakeShape { public: - /// \brief Creates an object which is obtained from current object by transformating it. - /// \param[in] theSourceShape a shape to be transformed. + /// \brief Creates an object which is obtained from current object by + /// transformating it. \param[in] theSourceShape a shape to be transformed. /// \param[in] theTrsf transformation. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, - std::shared_ptr theTrsf); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, + std::shared_ptr theTrsf); protected: /// \brief Default constructor (to be used in the derived classes) @@ -44,7 +45,7 @@ protected: /// Builds resulting shape. void build(std::shared_ptr theSourceShape, - std::shared_ptr theTrsf); + std::shared_ptr theTrsf); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp index 868b92137..6513038af 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,10 +26,9 @@ #include //================================================================================================= -GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - double theDistance) -{ +GeomAlgoAPI_Translation::GeomAlgoAPI_Translation( + std::shared_ptr theSourceShape, + std::shared_ptr theAxis, double theDistance) { if (!theAxis) { myError = "Translation builder :: axis is not valid."; return; @@ -41,11 +41,9 @@ GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr } //================================================================================================= -GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, - double theDx, - double theDy, - double theDz) -{ +GeomAlgoAPI_Translation::GeomAlgoAPI_Translation( + std::shared_ptr theSourceShape, double theDx, double theDy, + double theDz) { GeomTrsfPtr aTrsf(new GeomAPI_Trsf); aTrsf->setTranslation(theDx, theDy, theDz); @@ -53,10 +51,10 @@ GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr } //================================================================================================= -GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint) -{ +GeomAlgoAPI_Translation::GeomAlgoAPI_Translation( + std::shared_ptr theSourceShape, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint) { if (!theStartPoint) { myError = "Translation builder :: start point is not valid."; return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h index e5eeddaeb..ec23f79e0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Translation_H_ @@ -29,36 +30,38 @@ class GeomAPI_Pnt; /// \class GeomAlgoAPI_Translation /// \ingroup DataAlgo /// \brief Creates a copy of the object by moving it along the axis. -class GeomAlgoAPI_Translation : public GeomAlgoAPI_Transform -{ +class GeomAlgoAPI_Translation : public GeomAlgoAPI_Transform { public: - /// \brief Creates an object which is obtained from current object by moving it along the axis. - /// \param[in] theSourceShape a shape to be moved. + /// \brief Creates an object which is obtained from current object by moving + /// it along the axis. \param[in] theSourceShape a shape to be moved. /// \param[in] theAxis movement axis. /// \param[in] theDistance movement distance. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, - std::shared_ptr theAxis, - double theDistance); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + double theDistance); - /// \brief Creates an object which is obtained from current object by moving it along a vector + /// \brief Creates an object which is obtained from current object by moving + /// it along a vector /// defined by its dimensions in X, Y and Z. /// \param[in] theSourceShape the shape to be moved. /// \param[in] theDX the movement dimension in X. /// \param[in] theDY the movement dimension in Y. /// \param[in] theDZ the movement dimension in Z. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, - double theDx, - double theDy, - double theDz); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, + double theDx, double theDy, double theDz); - /// \brief Creates an object which is obtained from current object by moving it along a vector + /// \brief Creates an object which is obtained from current object by moving + /// it along a vector /// defined by two points. /// \param[in] theSourceShape the shape to be moved. /// \param[in] theStartPoint the movement start point. /// \param[in] theEndPoint the movement end point. - GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, - std::shared_ptr theStartPoint, - std::shared_ptr theEndPoint); + GEOMALGOAPI_EXPORT + GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, + std::shared_ptr theStartPoint, + std::shared_ptr theEndPoint); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp index 361125f74..804e41e8f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -30,26 +31,23 @@ #include -#include #include +#include //================================================================================================= -GeomAlgoAPI_Tube::GeomAlgoAPI_Tube() -{ -} +GeomAlgoAPI_Tube::GeomAlgoAPI_Tube() {} //================================================================================================= -GeomAlgoAPI_Tube::GeomAlgoAPI_Tube(const double theRMin, const double theRMax, const double theZ) -{ +GeomAlgoAPI_Tube::GeomAlgoAPI_Tube(const double theRMin, const double theRMax, + const double theZ) { myRMin = theRMin; myRMax = theRMax; myZ = theZ; } //================================================================================================= -bool GeomAlgoAPI_Tube::check() -{ - if ((myRMax -myRMin) < Precision::Confusion()) { +bool GeomAlgoAPI_Tube::check() { + if ((myRMax - myRMin) < Precision::Confusion()) { myError = "Tube builder :: rmin is greater then or equal to rmax."; return false; } else if (myRMin < 0.) { @@ -64,14 +62,10 @@ bool GeomAlgoAPI_Tube::check() } //================================================================================================= -void GeomAlgoAPI_Tube::build() -{ - buildTube(); -} +void GeomAlgoAPI_Tube::build() { buildTube(); } //================================================================================================= -void GeomAlgoAPI_Tube::buildTube() -{ +void GeomAlgoAPI_Tube::buildTube() { myCreatedFaces.clear(); // Construct the inner and outer circles @@ -112,16 +106,19 @@ void GeomAlgoAPI_Tube::buildTube() // Construct the tube gp_Vec aVec(aNormal); gp_Trsf aTrsf; - aTrsf.SetTranslation(aVec * -myZ/2); - BRepBuilderAPI_Transform *aTranformBuilder = new BRepBuilderAPI_Transform(aFace, aTrsf); + aTrsf.SetTranslation(aVec * -myZ / 2); + BRepBuilderAPI_Transform *aTranformBuilder = + new BRepBuilderAPI_Transform(aFace, aTrsf); if (!aTranformBuilder || !aTranformBuilder->IsDone()) { - myError = "Tube builder :: algorithm failed"; - return; + myError = "Tube builder :: algorithm failed"; + return; } TopoDS_Shape aMovedBase = aTranformBuilder->Shape(); - BRepPrimAPI_MakePrism *aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ); + BRepPrimAPI_MakePrism *aPrismBuilder = + new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ); - std::shared_ptr aShape = std::shared_ptr(new GeomAPI_Shape()); + std::shared_ptr aShape = + std::shared_ptr(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aPrismBuilder->Shape())); setShape(aShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h index e167ddfc8..7c6506658 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_TUBE_H_ @@ -26,9 +27,8 @@ * \ingroup DataAlgo * \brief Allows to create Tube Primitives */ -class GeomAlgoAPI_Tube : public GeomAlgoAPI_MakeShape -{ - public: +class GeomAlgoAPI_Tube : public GeomAlgoAPI_MakeShape { +public: GEOMALGOAPI_EXPORT GeomAlgoAPI_Tube(); /// Creates a tube. @@ -36,8 +36,7 @@ class GeomAlgoAPI_Tube : public GeomAlgoAPI_MakeShape /// \param theRMax The outside radius /// \param theZ The heigth GEOMALGOAPI_EXPORT GeomAlgoAPI_Tube(const double theRMin, - const double theRMax, - const double theZ); + const double theRMax, const double theZ); /// Checks if data for the torus construction is OK. GEOMALGOAPI_EXPORT bool check(); @@ -46,12 +45,13 @@ class GeomAlgoAPI_Tube : public GeomAlgoAPI_MakeShape GEOMALGOAPI_EXPORT void build(); private: - /// Builds the the tube with the inside radius, the outside radius and the height. + /// Builds the the tube with the inside radius, the outside radius and the + /// height. void buildTube(); double myRMin; /// inside radius to create a tube. double myRMax; /// outside radius to create a tube. - double myZ; /// height to create a tube. + double myZ; /// height to create a tube. }; #endif // GEOMALGOAPI_TUBE_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp index ee7547223..0b52f0151 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_UnifySameDomain.h" @@ -23,49 +24,47 @@ #include #include +#include #include -#include -#include +#include #include +#include +#include #include #include -#include -#include -#include +#include //================================================================================================== -GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const ListOfShape& theShapes) -{ +GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain( + const ListOfShape &theShapes) { build(theShapes); } //================================================================================================== -GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const GeomShapePtr& theShape) -{ +GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain( + const GeomShapePtr &theShape) { build(theShape, false); } //================================================================================================== -void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) -{ - if(theShapes.empty()) { +void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape &theShapes) { + if (theShapes.empty()) { return; } // Make compound. GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(theShapes); ListOfShape aResults; - GeomAlgoAPI_ShapeTools::combineShapes( - aCompound, - GeomAPI_Shape::SHELL, - aResults); + GeomAlgoAPI_ShapeTools::combineShapes(aCompound, GeomAPI_Shape::SHELL, + aResults); - if(aResults.size() > 1 || - (aResults.size() == 1 && aResults.front()->shapeType() > GeomAPI_Shape::SHELL)) { + if (aResults.size() > 1 || + (aResults.size() == 1 && + aResults.front()->shapeType() > GeomAPI_Shape::SHELL)) { return; } - const TopoDS_Shape& aShell = aResults.front()->impl(); + const TopoDS_Shape &aShell = aResults.front()->impl(); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aShell)); @@ -73,14 +72,12 @@ void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) } // calculates maximum possible tolerance on edges of shape -static Standard_Real defineLinearTolerance(const TopoDS_Shape& theShape) -{ +static Standard_Real defineLinearTolerance(const TopoDS_Shape &theShape) { Standard_Real aMaxTol = Precision::Confusion(); TopExp_Explorer Explo(theShape, TopAbs_EDGE); - for (; Explo.More(); Explo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current()); + for (; Explo.More(); Explo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(Explo.Current()); aMaxTol = Max(aMaxTol, BRep_Tool::Tolerance(anEdge)); } @@ -88,13 +85,12 @@ static Standard_Real defineLinearTolerance(const TopoDS_Shape& theShape) } //================================================================================================== -void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr& theShape, - const bool theIsToSimplifyShell) -{ - ShapeUpgrade_UnifySameDomain* aUnifyAlgo = new ShapeUpgrade_UnifySameDomain(); +void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr &theShape, + const bool theIsToSimplifyShell) { + ShapeUpgrade_UnifySameDomain *aUnifyAlgo = new ShapeUpgrade_UnifySameDomain(); this->setImpl(aUnifyAlgo); - const TopoDS_Shape& aShape = theShape->impl(); + const TopoDS_Shape &aShape = theShape->impl(); aUnifyAlgo->Initialize(aShape, Standard_True, Standard_True, Standard_True); aUnifyAlgo->SetLinearTolerance(defineLinearTolerance(aShape)); aUnifyAlgo->SetAngularTolerance(1.e-5); // for #32443 @@ -129,22 +125,25 @@ void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr& theShape, } //================================================================================================== -void GeomAlgoAPI_UnifySameDomain::modified(const std::shared_ptr theShape, - ListOfShape& theHistory) -{ - if(!theShape.get()) { +void GeomAlgoAPI_UnifySameDomain::modified( + const std::shared_ptr theShape, ListOfShape &theHistory) { + if (!theShape.get()) { return; } - const TopoDS_Shape& aShape = theShape->impl(); - const ShapeUpgrade_UnifySameDomain& aUnifyAlgo = this->impl(); + const TopoDS_Shape &aShape = theShape->impl(); + const ShapeUpgrade_UnifySameDomain &aUnifyAlgo = + this->impl(); for (int aIsModified = 0; aIsModified <= 1; aIsModified++) { - if (!aUnifyAlgo.History()->IsSupportedType(aShape)) // to avoid crash in BRepTools_History + if (!aUnifyAlgo.History()->IsSupportedType( + aShape)) // to avoid crash in BRepTools_History continue; - const TopTools_ListOfShape& aMList = aIsModified ? - aUnifyAlgo.History()->Modified(aShape) : aUnifyAlgo.History()->Generated(aShape); - for (TopTools_ListIteratorOfListOfShape aModified(aMList); aModified.More(); aModified.Next()) { + const TopTools_ListOfShape &aMList = + aIsModified ? aUnifyAlgo.History()->Modified(aShape) + : aUnifyAlgo.History()->Generated(aShape); + for (TopTools_ListIteratorOfListOfShape aModified(aMList); aModified.More(); + aModified.Next()) { for (TopExp_Explorer anExp(aModified.Value(), aShape.ShapeType()); anExp.More(); anExp.Next()) { GeomShapePtr aGeomShape(new GeomAPI_Shape()); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h index 2743e22ae..47e102a53 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_UnifySameDomain_H_ @@ -27,28 +28,29 @@ /// \class GeomAlgoAPI_UnifySameDomain /// \ingroup DataAlgo -/// \brief This tool tries to unify faces and edges of the shape which lies on the same geometry. -class GeomAlgoAPI_UnifySameDomain: public GeomAlgoAPI_MakeShape -{ +/// \brief This tool tries to unify faces and edges of the shape which lies on +/// the same geometry. +class GeomAlgoAPI_UnifySameDomain : public GeomAlgoAPI_MakeShape { public: /// Constructor. - GEOMALGOAPI_EXPORT GeomAlgoAPI_UnifySameDomain(const ListOfShape& theShapes); + GEOMALGOAPI_EXPORT GeomAlgoAPI_UnifySameDomain(const ListOfShape &theShapes); /// Constructor. - GEOMALGOAPI_EXPORT GeomAlgoAPI_UnifySameDomain(const GeomShapePtr& theShape); + GEOMALGOAPI_EXPORT GeomAlgoAPI_UnifySameDomain(const GeomShapePtr &theShape); /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theShape base shape. /// \param[out] theHistory modified shapes. - GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr theShape, - ListOfShape& theHistory); + GEOMALGOAPI_EXPORT virtual void + modified(const std::shared_ptr theShape, + ListOfShape &theHistory); private: /// Builds resulting shape from list of shapes. - void build(const ListOfShape& theShapes); + void build(const ListOfShape &theShapes); /// Builds resulting shape from the shape. - void build(const GeomShapePtr& theShape, const bool theIsToSimplifyShell); + void build(const GeomShapePtr &theShape, const bool theIsToSimplifyShell); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Utils.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Utils.cpp index b704bf31f..7569f7c5a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Utils.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Utils.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_Utils.h" @@ -24,13 +25,11 @@ #include #include - //================================================================================================== -bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape& theShape, +bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape &theShape, TopAbs_ShapeEnum theType, const double theTolerance, - const bool theCheckGeometry) -{ + const bool theCheckGeometry) { ShapeFix_ShapeTolerance aSft; aSft.LimitTolerance(theShape, theTolerance, theTolerance, theType); Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(theShape); @@ -40,24 +39,22 @@ bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape& theShape, } //================================================================================================== -bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape& theShape, +bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape &theShape, const double theTolerance, - const bool theCheckGeometry) -{ - return FixShapeTolerance(theShape, TopAbs_SHAPE, theTolerance, theCheckGeometry); + const bool theCheckGeometry) { + return FixShapeTolerance(theShape, TopAbs_SHAPE, theTolerance, + theCheckGeometry); } //================================================================================================== -bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape& theShape, - const bool theCheckGeometry) -{ +bool GeomAlgoAPI_Utils::FixShapeTolerance(TopoDS_Shape &theShape, + const bool theCheckGeometry) { return FixShapeTolerance(theShape, Precision::Confusion(), theCheckGeometry); } //================================================================================================== -bool GeomAlgoAPI_Utils::CheckShape(TopoDS_Shape& theShape, - const bool theCheckGeometry) -{ +bool GeomAlgoAPI_Utils::CheckShape(TopoDS_Shape &theShape, + const bool theCheckGeometry) { BRepCheck_Analyzer analyzer(theShape, theCheckGeometry); return analyzer.IsValid(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Utils.h b/src/GeomAlgoAPI/GeomAlgoAPI_Utils.h index 140747c59..c12848151 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Utils.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Utils.h @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_Utils_H_ @@ -28,54 +29,58 @@ #include #include +namespace GeomAlgoAPI_Utils { +/// +/// \brief Limit shape tolerance to the given value +/// +/// \param theShape shape being fixed +/// \param theType topology type which tolerance is to be limited; TopAbs_SHAPE +/// means +/// all types of topology +/// \param theTolerance expected tolerance value (1e-7 by default) +/// \param theCheckGeometry check geometry validity of result +/// \return \c true if resulting shape is valid +/// +/// \note Resulting tolerance of the shape is not mandatory equal to requested +/// value +/// as it might be changed by fixshape operation in order to get valid +/// shape where possible +/// \note By default, the result is only checked for topology validity; check of +/// geometry can be done by +/// passing \c true to \a theCheckGeometry parameter +/// +GEOMALGOAPI_EXPORT bool +FixShapeTolerance(TopoDS_Shape &theShape, const TopAbs_ShapeEnum theType, + const double theTolerance = Precision::Confusion(), + const bool theCheckGeometry = false); -namespace GeomAlgoAPI_Utils -{ - /// - /// \brief Limit shape tolerance to the given value - /// - /// \param theShape shape being fixed - /// \param theType topology type which tolerance is to be limited; TopAbs_SHAPE means - /// all types of topology - /// \param theTolerance expected tolerance value (1e-7 by default) - /// \param theCheckGeometry check geometry validity of result - /// \return \c true if resulting shape is valid - /// - /// \note Resulting tolerance of the shape is not mandatory equal to requested value - /// as it might be changed by fixshape operation in order to get valid shape where possible - /// \note By default, the result is only checked for topology validity; check of geometry can be done by - /// passing \c true to \a theCheckGeometry parameter - /// - GEOMALGOAPI_EXPORT bool FixShapeTolerance(TopoDS_Shape& theShape, - const TopAbs_ShapeEnum theType, - const double theTolerance = Precision::Confusion(), - const bool theCheckGeometry = false); +/// +/// \brief Limit shape tolerance to the given value +/// This is overloaded function, it behaves exactly as previous one +/// +GEOMALGOAPI_EXPORT bool +FixShapeTolerance(TopoDS_Shape &theShape, + const double theTolerance = Precision::Confusion(), + const bool theCheckGeometry = false); - /// - /// \brief Limit shape tolerance to the given value - /// This is overloaded function, it behaves exactly as previous one - /// - GEOMALGOAPI_EXPORT bool FixShapeTolerance(TopoDS_Shape& theShape, - const double theTolerance = Precision::Confusion(), - const bool theCheckGeometry = false); +/// +/// \brief Limit shape tolerance to the given value +/// This is overloaded function, it behaves exactly as previous one +/// +GEOMALGOAPI_EXPORT bool FixShapeTolerance(TopoDS_Shape &theShape, + const bool theCheckGeometry); - /// - /// \brief Limit shape tolerance to the given value - /// This is overloaded function, it behaves exactly as previous one - /// - GEOMALGOAPI_EXPORT bool FixShapeTolerance(TopoDS_Shape& theShape, - const bool theCheckGeometry); - - /// - /// \brief Check shape - /// - /// \param theShape input shape object - /// \param theCheckGeometry when set to \c true, causes check of underlying geometry - /// in addition to the topology - /// \return \c true if shape is valid or \c false otherwise - /// - GEOMALGOAPI_EXPORT bool CheckShape(TopoDS_Shape& theShape, - const bool theCheckGeometry = false); -} +/// +/// \brief Check shape +/// +/// \param theShape input shape object +/// \param theCheckGeometry when set to \c true, causes check of underlying +/// geometry +/// in addition to the topology +/// \return \c true if shape is valid or \c false otherwise +/// +GEOMALGOAPI_EXPORT bool CheckShape(TopoDS_Shape &theShape, + const bool theCheckGeometry = false); +} // namespace GeomAlgoAPI_Utils #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp index 9aab0b6f2..fd8d7d724 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp @@ -14,47 +14,47 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomAlgoAPI_WireBuilder.h" #include #include -#include #include +#include -#include -#include #include #include +#include +#include #include #include -#include -#include #include #include +#include +#include #include #include #include -class SetOfEdges -{ +class SetOfEdges { class DoubleCompare { public: - bool operator() (const double d1, const double d2) const { + bool operator()(const double d1, const double d2) const { return d1 + Precision::Confusion() < d2; } }; - typedef std::map, DoubleCompare> ParamMap; + typedef std::map, DoubleCompare> + ParamMap; std::map myShapes; public: - bool add(const TopoDS_Shape& theEdge) - { - const TopoDS_Edge& anEdge = TopoDS::Edge(theEdge); + bool add(const TopoDS_Shape &theEdge) { + const TopoDS_Edge &anEdge = TopoDS::Edge(theEdge); if (anEdge.IsNull()) return true; @@ -62,8 +62,8 @@ public: Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); bool isAdded = true; - std::map::iterator - aFound = myShapes.find(aCurve); + std::map::iterator aFound = + myShapes.find(aCurve); if (aFound == myShapes.end()) myShapes[aCurve][aFirst].insert(aLast); else { @@ -78,10 +78,10 @@ public: return isAdded; } - static bool isEqual(const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2) - { - const TopoDS_Edge& anEdge1 = TopoDS::Edge(theShape1); - const TopoDS_Edge& anEdge2 = TopoDS::Edge(theShape2); + static bool isEqual(const TopoDS_Shape &theShape1, + const TopoDS_Shape &theShape2) { + const TopoDS_Edge &anEdge1 = TopoDS::Edge(theShape1); + const TopoDS_Edge &anEdge2 = TopoDS::Edge(theShape2); if (anEdge1.IsNull() || anEdge2.IsNull()) return false; @@ -89,50 +89,52 @@ public: Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aFirst1, aLast1); double aFirst2, aLast2; Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aFirst2, aLast2); - return aCurve1 == aCurve2 && fabs(aFirst1 - aFirst2) < Precision::Confusion() && - fabs(aLast1 - aLast2) < Precision::Confusion(); + return aCurve1 == aCurve2 && + fabs(aFirst1 - aFirst2) < Precision::Confusion() && + fabs(aLast1 - aLast2) < Precision::Confusion(); } }; -static GeomShapePtr fromTopoDS(const TopoDS_Shape& theShape) -{ +static GeomShapePtr fromTopoDS(const TopoDS_Shape &theShape) { GeomShapePtr aResultShape(new GeomAPI_Shape()); aResultShape->setImpl(new TopoDS_Shape(theShape)); return aResultShape; } -GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, - const bool theForceOpenWire) -{ +GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape &theShapes, + const bool theForceOpenWire) { TopTools_ListOfShape aListOfEdges; SetOfEdges aProcessedEdges; ListOfShape::const_iterator anIt = theShapes.cbegin(); for (; anIt != theShapes.cend(); ++anIt) { TopoDS_Shape aShape = (*anIt)->impl(); - switch(aShape.ShapeType()) { - case TopAbs_EDGE: { - aShape.Orientation(TopAbs_FORWARD); - if (aProcessedEdges.add(aShape)) - aListOfEdges.Append(aShape); - break; - } - case TopAbs_WIRE: { - for (TopExp_Explorer anExp(aShape, TopAbs_EDGE); anExp.More(); anExp.Next()) { - TopoDS_Shape anEdge = anExp.Current(); - anEdge.Orientation(TopAbs_FORWARD); - // if the edge was already processed, remove it to keep original order of the current wire - if (!aProcessedEdges.add(anEdge)) { - for (TopTools_ListIteratorOfListOfShape aEIt(aListOfEdges); aEIt.More(); aEIt.Next()) - if (SetOfEdges::isEqual(anEdge, aEIt.Value())) { - aListOfEdges.Remove(aEIt); - break; - } - } - aListOfEdges.Append(anEdge); + switch (aShape.ShapeType()) { + case TopAbs_EDGE: { + aShape.Orientation(TopAbs_FORWARD); + if (aProcessedEdges.add(aShape)) + aListOfEdges.Append(aShape); + break; + } + case TopAbs_WIRE: { + for (TopExp_Explorer anExp(aShape, TopAbs_EDGE); anExp.More(); + anExp.Next()) { + TopoDS_Shape anEdge = anExp.Current(); + anEdge.Orientation(TopAbs_FORWARD); + // if the edge was already processed, remove it to keep original order + // of the current wire + if (!aProcessedEdges.add(anEdge)) { + for (TopTools_ListIteratorOfListOfShape aEIt(aListOfEdges); + aEIt.More(); aEIt.Next()) + if (SetOfEdges::isEqual(anEdge, aEIt.Value())) { + aListOfEdges.Remove(aEIt); + break; + } } - break; + aListOfEdges.Append(anEdge); } + break; + } default: break; } @@ -146,10 +148,10 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, TopExp::Vertices(TopoDS::Edge(aListOfEdges.First()), V1[0], V1[1]); TopoDS_Vertex V2[2]; TopExp::Vertices(TopoDS::Edge(aListOfEdges.Last()), V2[0], V2[1]); - gp_Pnt P1[2] = { BRep_Tool::Pnt(V1[0]), BRep_Tool::Pnt(V1[1]) }; - gp_Pnt P2[2] = { BRep_Tool::Pnt(V2[0]), BRep_Tool::Pnt(V2[1]) }; - double Tol1[2] = { BRep_Tool::Tolerance(V1[0]), BRep_Tool::Tolerance(V1[1]) }; - double Tol2[2] = { BRep_Tool::Tolerance(V2[0]), BRep_Tool::Tolerance(V2[1]) }; + gp_Pnt P1[2] = {BRep_Tool::Pnt(V1[0]), BRep_Tool::Pnt(V1[1])}; + gp_Pnt P2[2] = {BRep_Tool::Pnt(V2[0]), BRep_Tool::Pnt(V2[1])}; + double Tol1[2] = {BRep_Tool::Tolerance(V1[0]), BRep_Tool::Tolerance(V1[1])}; + double Tol2[2] = {BRep_Tool::Tolerance(V2[0]), BRep_Tool::Tolerance(V2[1])}; for (int i = 0; i < 2 && !isSplitWire; ++i) for (int j = 0; j < 2 && !isSplitWire; ++j) if (P1[i].Distance(P2[j]) < Max(Tol1[i], Tol2[j])) { @@ -158,7 +160,7 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, } } - BRepBuilderAPI_MakeWire* aWireBuilder = new BRepBuilderAPI_MakeWire; + BRepBuilderAPI_MakeWire *aWireBuilder = new BRepBuilderAPI_MakeWire; aWireBuilder->Add(aListOfEdges); if (aWireBuilder->Error() == BRepBuilderAPI_WireDone) { setImpl(aWireBuilder); @@ -170,7 +172,8 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, TopoDS_Wire aNewWire; BRep_Builder aBuilder; aBuilder.MakeWire(aNewWire); - for (TopExp_Explorer anExp(aWire, TopAbs_EDGE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aWire, TopAbs_EDGE); anExp.More(); + anExp.Next()) { TopoDS_Edge aNewCurrent = TopoDS::Edge(anExp.Current()); if (isSplitWire) { bool isToReshape = false; @@ -184,8 +187,7 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, if (aSplitPoint.SquareDistance(aPF) < aTolF * aTolF) { aReshape.Replace(aVF, aReshape.CopyVertex(aVF)); isToReshape = true; - } - else if (aSplitPoint.SquareDistance(aPL) < aTolL * aTolL) { + } else if (aSplitPoint.SquareDistance(aPL) < aTolL * aTolL) { aReshape.Replace(aVL, aReshape.CopyVertex(aVL)); isToReshape = true; } @@ -200,14 +202,18 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, } // store generated/modified shapes - for (TopTools_ListOfShape::Iterator aBaseIt(aListOfEdges); aBaseIt.More(); aBaseIt.Next()) { + for (TopTools_ListOfShape::Iterator aBaseIt(aListOfEdges); aBaseIt.More(); + aBaseIt.Next()) { TopoDS_Edge aBaseCurrent = TopoDS::Edge(aBaseIt.Value()); Standard_Real aFirst, aLast; - Handle(Geom_Curve) aBaseCurve = BRep_Tool::Curve(aBaseCurrent, aFirst, aLast); + Handle(Geom_Curve) aBaseCurve = + BRep_Tool::Curve(aBaseCurrent, aFirst, aLast); - for (TopExp_Explorer anExp(aWire, TopAbs_EDGE); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aWire, TopAbs_EDGE); anExp.More(); + anExp.Next()) { TopoDS_Edge aNewCurrent = TopoDS::Edge(anExp.Current()); - Handle(Geom_Curve) aNewCurve = BRep_Tool::Curve(aNewCurrent, aFirst, aLast); + Handle(Geom_Curve) aNewCurve = + BRep_Tool::Curve(aNewCurrent, aFirst, aLast); if (aBaseCurve == aNewCurve) { GeomShapePtr aBaseShape = fromTopoDS(aBaseCurrent); GeomShapePtr aNewShape = fromTopoDS(aNewCurrent); @@ -223,14 +229,12 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, } //================================================================================================= -GeomShapePtr GeomAlgoAPI_WireBuilder::wire(const ListOfShape& theShapes) -{ +GeomShapePtr GeomAlgoAPI_WireBuilder::wire(const ListOfShape &theShapes) { return GeomAlgoAPI_WireBuilder(theShapes).shape(); } //================================================================================================= -bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr& theWire) -{ +bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr &theWire) { // Collect edges. ListOfShape anEdges; @@ -245,8 +249,10 @@ bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr& theWire) for (int i = 0; anEdgesIt != anEdges.end(); ++anEdgesIt, i++) { GeomEdgePtr anEdge1(new GeomAPI_Edge(*anEdgesIt)); - std::list::const_iterator anOtherEdgesIt = std::next(anEdgesIt); - for (int j = i + 1; anOtherEdgesIt != anEdges.end(); ++anOtherEdgesIt, j++) { + std::list::const_iterator anOtherEdgesIt = + std::next(anEdgesIt); + for (int j = i + 1; anOtherEdgesIt != anEdges.end(); + ++anOtherEdgesIt, j++) { GeomEdgePtr anEdge2(new GeomAPI_Edge(*anOtherEdgesIt)); GeomShapePtr anInter = anEdge1->intersect(anEdge2); if (!anInter.get()) { @@ -259,19 +265,27 @@ bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr& theWire) GeomVertexPtr aVertex(new GeomAPI_Vertex(anInter)); GeomPointPtr aPnt = aVertex->point(); - GeomPointPtr aFirstPnt1 = anEdge1->orientation() == GeomAPI_Shape::FORWARD ? - anEdge1->firstPoint() : anEdge1->lastPoint(); - GeomPointPtr aLastPnt1 = anEdge1->orientation() == GeomAPI_Shape::FORWARD ? - anEdge1->lastPoint() : anEdge1->firstPoint(); - GeomPointPtr aFirstPnt2 = anEdge2->orientation() == GeomAPI_Shape::FORWARD ? - anEdge2->firstPoint() : anEdge2->lastPoint(); - GeomPointPtr aLastPnt2 = anEdge2->orientation() == GeomAPI_Shape::FORWARD ? - anEdge2->lastPoint() : anEdge2->firstPoint(); + GeomPointPtr aFirstPnt1 = + anEdge1->orientation() == GeomAPI_Shape::FORWARD + ? anEdge1->firstPoint() + : anEdge1->lastPoint(); + GeomPointPtr aLastPnt1 = + anEdge1->orientation() == GeomAPI_Shape::FORWARD + ? anEdge1->lastPoint() + : anEdge1->firstPoint(); + GeomPointPtr aFirstPnt2 = + anEdge2->orientation() == GeomAPI_Shape::FORWARD + ? anEdge2->firstPoint() + : anEdge2->lastPoint(); + GeomPointPtr aLastPnt2 = + anEdge2->orientation() == GeomAPI_Shape::FORWARD + ? anEdge2->lastPoint() + : anEdge2->firstPoint(); GeomPointPtr aCommonEndPnt; if (aFirstPnt1->isEqual(aLastPnt2)) { aCommonEndPnt = aFirstPnt1; - } else if(aLastPnt1->isEqual(aFirstPnt2)) { + } else if (aLastPnt1->isEqual(aFirstPnt2)) { aCommonEndPnt = aLastPnt1; } @@ -285,4 +299,4 @@ bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr& theWire) } return false; -} \ No newline at end of file +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h index a2afff6cd..7b102747a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomAlgoAPI_WireBuilder_H_ @@ -28,29 +29,29 @@ /// \class GeomAlgoAPI_WireBuilder /// \ingroup DataAlgo /// \brief Allows to create wire-shapes by different parameters. -class GeomAlgoAPI_WireBuilder : public GeomAlgoAPI_MakeShapeCustom -{ - public: - /// \brief Creates a wire from edges and wires. - /// \param[in] theShapes list of shapes. Only edges and wires allowed. - /// \param[in] theForceOpenWire indicates the necessity to split wire - /// in the first vertex if it becomes closed. - /// The edges are not to be consecutive. - /// But they are to be all connected geometrically or topologically. - GEOMALGOAPI_EXPORT GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes, - const bool theForceOpenWire = false); +class GeomAlgoAPI_WireBuilder : public GeomAlgoAPI_MakeShapeCustom { +public: + /// \brief Creates a wire from edges and wires. + /// \param[in] theShapes list of shapes. Only edges and wires allowed. + /// \param[in] theForceOpenWire indicates the necessity to split wire + /// in the first vertex if it becomes closed. + /// The edges are not to be consecutive. + /// But they are to be all connected geometrically or topologically. + GEOMALGOAPI_EXPORT + GeomAlgoAPI_WireBuilder(const ListOfShape &theShapes, + const bool theForceOpenWire = false); - /// \brief Creates a wire from edges and wires. - /// \param[in] theShapes list of shapes. Only edges and wires allowed. - /// The edges are not to be consecutive. - /// But they are to be all connected geometrically or topologically. - /// \return wire created from theShapes. Empty in case of error or bad input. - GEOMALGOAPI_EXPORT static GeomShapePtr wire(const ListOfShape& theShapes); + /// \brief Creates a wire from edges and wires. + /// \param[in] theShapes list of shapes. Only edges and wires allowed. + /// The edges are not to be consecutive. + /// But they are to be all connected geometrically or topologically. + /// \return wire created from theShapes. Empty in case of error or bad input. + GEOMALGOAPI_EXPORT static GeomShapePtr wire(const ListOfShape &theShapes); - /// \brief Checks if the wire is self-intersected. - /// \param[in] theWire the wire to be checked - /// \return true if the wire is self-intersected, otherwise - false. - GEOMALGOAPI_EXPORT static bool isSelfIntersected(const GeomShapePtr& theWire); + /// \brief Checks if the wire is self-intersected. + /// \param[in] theWire the wire to be checked + /// \return true if the wire is self-intersected, otherwise - false. + GEOMALGOAPI_EXPORT static bool isSelfIntersected(const GeomShapePtr &theWire); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp index 89f53c637..4887e84b9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,14 +24,12 @@ #include -#include #include +#include //============================================================================= -bool SetShapeToXAO(const std::shared_ptr& theShape, - XAO::Xao* theXao, - std::string& theError) -{ +bool SetShapeToXAO(const std::shared_ptr &theShape, + XAO::Xao *theXao, std::string &theError) { if (!theShape.get() || !theXao) { theError = "An invalid argument."; return false; @@ -38,10 +37,10 @@ bool SetShapeToXAO(const std::shared_ptr& theShape, TopoDS_Shape aShape = theShape->impl(); try { - XAO::BrepGeometry* aGeometry = new XAO::BrepGeometry; + XAO::BrepGeometry *aGeometry = new XAO::BrepGeometry; theXao->setGeometry(aGeometry); aGeometry->setTopoDS_Shape(aShape); - } catch (XAO::XAO_Exception& e) { + } catch (XAO::XAO_Exception &e) { theError = e.what(); return false; } @@ -53,13 +52,11 @@ bool SetShapeToXAO(const std::shared_ptr& theShape, * */ //============================================================================= -bool XAOExport(const std::string& theFileName, - XAO::Xao* theXao, - std::string& theError) -{ - #ifdef _DEBUG +bool XAOExport(const std::string &theFileName, XAO::Xao *theXao, + std::string &theError) { +#ifdef _DEBUG std::cout << "Export XAO into file " << theFileName << std::endl; - #endif +#endif if (theFileName.empty() || !theXao) { theError = "An invalid argument."; @@ -67,15 +64,17 @@ bool XAOExport(const std::string& theFileName, } try { - XAO::BrepGeometry* aGeometry = dynamic_cast(theXao->getGeometry()); + XAO::BrepGeometry *aGeometry = + dynamic_cast(theXao->getGeometry()); TopoDS_Shape aShape = aGeometry->getTopoDS_Shape(); - bool aWasFree = aShape.Free(); // make top level topology free, same as imported + bool aWasFree = + aShape.Free(); // make top level topology free, same as imported if (!aWasFree) aShape.Free(Standard_True); XAO::XaoExporter::saveToFile(theXao, theFileName, ""); if (!aWasFree) aShape.Free(Standard_False); - } catch (XAO::XAO_Exception& e) { + } catch (XAO::XAO_Exception &e) { theError = e.what(); return false; } @@ -87,10 +86,8 @@ bool XAOExport(const std::string& theFileName, * */ //============================================================================= -const std::string XAOExportMem(XAO::Xao* theXao, - std::string& theError) -{ - std::string aRetBuff (""); +const std::string XAOExportMem(XAO::Xao *theXao, std::string &theError) { + std::string aRetBuff(""); #ifdef _DEBUG std::cout << "Export XAO into memory buffer " << std::endl; @@ -102,9 +99,11 @@ const std::string XAOExportMem(XAO::Xao* theXao, } try { - XAO::BrepGeometry* aGeometry = dynamic_cast(theXao->getGeometry()); + XAO::BrepGeometry *aGeometry = + dynamic_cast(theXao->getGeometry()); TopoDS_Shape aShape = aGeometry->getTopoDS_Shape(); - bool aWasFree = aShape.Free(); // make top level topology free, same as imported + bool aWasFree = + aShape.Free(); // make top level topology free, same as imported if (!aWasFree) aShape.Free(Standard_True); @@ -112,7 +111,7 @@ const std::string XAOExportMem(XAO::Xao* theXao, if (!aWasFree) aShape.Free(Standard_False); - } catch (XAO::XAO_Exception& e) { + } catch (XAO::XAO_Exception &e) { theError = e.what(); return aRetBuff; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.h index 3ae31de6b..a4b4eab67 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_XAOEXPORT_H_ @@ -32,19 +33,16 @@ class Xao; /// Defines shape for the XAO object GEOMALGOAPI_EXPORT -bool SetShapeToXAO(const std::shared_ptr& theShape, - XAO::Xao* theXao, - std::string& theError); +bool SetShapeToXAO(const std::shared_ptr &theShape, + XAO::Xao *theXao, std::string &theError); /// Implementation of the export XAO files algorithms GEOMALGOAPI_EXPORT -bool XAOExport(const std::string& theFileName, - XAO::Xao* theXao, - std::string& theError); +bool XAOExport(const std::string &theFileName, XAO::Xao *theXao, + std::string &theError); /// Implementation of the export XAO to memory buffer (std::string) GEOMALGOAPI_EXPORT -const std::string XAOExportMem(XAO::Xao* theXao, - std::string& theError); +const std::string XAOExportMem(XAO::Xao *theXao, std::string &theError); #endif /* GEOMALGOAPI_XAOEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp index 5b2414976..927711e0c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp @@ -14,28 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include +#include //============================================================================= /*! * */ //============================================================================= -std::shared_ptr XAOImport(const std::string& theFileName, - std::string& theError, - XAO::Xao* theXao) -{ - #ifdef _DEBUG +std::shared_ptr XAOImport(const std::string &theFileName, + std::string &theError, + XAO::Xao *theXao) { +#ifdef _DEBUG std::cout << "Import XAO from file " << theFileName << std::endl; - #endif +#endif if (theFileName.empty() || !theXao) { theError = "An invalid argument."; return std::shared_ptr(); @@ -44,20 +44,22 @@ std::shared_ptr XAOImport(const std::string& theFileName, TopoDS_Shape aShape; try { if (XAO::XaoExporter::readFromFile(theFileName, theXao)) { - XAO::Geometry* aGeometry = theXao->getGeometry(); + XAO::Geometry *aGeometry = theXao->getGeometry(); XAO::Format aFormat = aGeometry->getFormat(); if (aFormat == XAO::BREP) { - if (XAO::BrepGeometry* aBrepGeometry = dynamic_cast(aGeometry)) + if (XAO::BrepGeometry *aBrepGeometry = + dynamic_cast(aGeometry)) aShape = aBrepGeometry->getTopoDS_Shape(); } else { - theError = "Unsupported XAO geometry format:" + XAO::XaoUtils::shapeFormatToString(aFormat); + theError = "Unsupported XAO geometry format:" + + XAO::XaoUtils::shapeFormatToString(aFormat); aShape.Nullify(); } } else { theError = "XAO object was not read successful"; aShape.Nullify(); } - } catch (XAO::XAO_Exception& e) { + } catch (XAO::XAO_Exception &e) { theError = e.what(); aShape.Nullify(); } @@ -72,10 +74,9 @@ std::shared_ptr XAOImport(const std::string& theFileName, * */ //============================================================================= -std::shared_ptr XAOImportMem(const std::string& theMemoryBuff, - std::string& theError, - XAO::Xao* theXao) -{ +std::shared_ptr XAOImportMem(const std::string &theMemoryBuff, + std::string &theError, + XAO::Xao *theXao) { #ifdef _DEBUG std::cout << "Import XAO from file " << theFileName << std::endl; #endif @@ -87,20 +88,22 @@ std::shared_ptr XAOImportMem(const std::string& theMemoryBuff, TopoDS_Shape aShape; try { if (XAO::XaoExporter::setXML(theMemoryBuff, theXao)) { - XAO::Geometry* aGeometry = theXao->getGeometry(); + XAO::Geometry *aGeometry = theXao->getGeometry(); XAO::Format aFormat = aGeometry->getFormat(); if (aFormat == XAO::BREP) { - if (XAO::BrepGeometry* aBrepGeometry = dynamic_cast(aGeometry)) + if (XAO::BrepGeometry *aBrepGeometry = + dynamic_cast(aGeometry)) aShape = aBrepGeometry->getTopoDS_Shape(); } else { - theError = "Unsupported XAO geometry format:" + XAO::XaoUtils::shapeFormatToString(aFormat); + theError = "Unsupported XAO geometry format:" + + XAO::XaoUtils::shapeFormatToString(aFormat); aShape.Nullify(); } } else { theError = "XAO object was not read successful"; aShape.Nullify(); } - } catch (XAO::XAO_Exception& e) { + } catch (XAO::XAO_Exception &e) { theError = e.what(); aShape.Nullify(); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.h index 986e03cef..cbd175c1a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOAPI_XAOIMPORT_H_ @@ -32,14 +33,14 @@ class Xao; /// Implementation of the import XAO files algorithms GEOMALGOAPI_EXPORT -std::shared_ptr XAOImport(const std::string& theFileName, - std::string& theError, - XAO::Xao* theXao); +std::shared_ptr XAOImport(const std::string &theFileName, + std::string &theError, + XAO::Xao *theXao); /// Implementation of the import XAO data from memory buffer GEOMALGOAPI_EXPORT -std::shared_ptr XAOImportMem(const std::string& theMemoryBuff, - std::string& theError, - XAO::Xao* theXao); +std::shared_ptr XAOImportMem(const std::string &theMemoryBuff, + std::string &theError, + XAO::Xao *theXao); #endif /* GEOMALGOAPI_XAOIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_swig.h b/src/GeomAlgoAPI/GeomAlgoAPI_swig.h index 7a708573b..08ef18916 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_swig.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_swig.h @@ -14,71 +14,75 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_GEOMALGOAPI_GEOMALGOAPI_SWIG_H_ #define SRC_GEOMALGOAPI_GEOMALGOAPI_SWIG_H_ - #include +#include - #include "GeomAlgoAPI.h" - #include "GeomAlgoAPI_MakeShape.h" - #include "GeomAlgoAPI_Boolean.h" - #include "GeomAlgoAPI_Circ2dBuilder.h" - #include "GeomAlgoAPI_CompoundBuilder.h" - #include "GeomAlgoAPI_CurveBuilder.h" - #include "GeomAlgoAPI_DFLoader.h" - #include "GeomAlgoAPI_EdgeBuilder.h" - #include "GeomAlgoAPI_FaceBuilder.h" - #include "GeomAlgoAPI_MakeShapeCustom.h" - #include "GeomAlgoAPI_MakeShapeList.h" - #include "GeomAlgoAPI_MakeSweep.h" - #include "GeomAlgoAPI_Transform.h" - #include "GeomAlgoAPI_Translation.h" - #include "GeomAlgoAPI_Placement.h" - #include "GeomAlgoAPI_PointBuilder.h" - #include "GeomAlgoAPI_Prism.h" - #include "GeomAlgoAPI_Revolution.h" - #include "GeomAlgoAPI_Rotation.h" - #include "GeomAlgoAPI_ShapeTools.h" - #include "GeomAlgoAPI_SketchBuilder.h" - #include "GeomAlgoAPI_NonPlanarFace.h" - #include "GeomAlgoAPI_BREPExport.h" - #include "GeomAlgoAPI_IGESExport.h" - #include "GeomAlgoAPI_STEPExport.h" - #include "GeomAlgoAPI_BREPImport.h" - #include "GeomAlgoAPI_IGESImport.h" - #include "GeomAlgoAPI_STEPImport.h" - #include "GeomAlgoAPI_Tools.h" - #include "GeomAlgoAPI_PaveFiller.h" - #include "GeomAlgoAPI_Intersection.h" - #include "GeomAlgoAPI_Pipe.h" - #include "GeomAlgoAPI_WireBuilder.h" - #include "GeomAlgoAPI_Sewing.h" - #include "GeomAlgoAPI_ShapeBuilder.h" - #include "GeomAlgoAPI_Exception.h" - #include "GeomAlgoAPI_ShapeAPI.h" - #include "GeomAlgoAPI_Box.h" - #include "GeomAlgoAPI_ConeSegment.h" - #include "GeomAlgoAPI_Copy.h" - #include "GeomAlgoAPI_Symmetry.h" - #include "GeomAlgoAPI_MapShapesAndAncestors.h" - #include "GeomAlgoAPI_ShapeInfo.h" - #include "GeomAlgoAPI_CanonicalRecognition.h" +#include "GeomAlgoAPI.h" +#include "GeomAlgoAPI_BREPExport.h" +#include "GeomAlgoAPI_BREPImport.h" +#include "GeomAlgoAPI_Boolean.h" +#include "GeomAlgoAPI_Box.h" +#include "GeomAlgoAPI_CanonicalRecognition.h" +#include "GeomAlgoAPI_Circ2dBuilder.h" +#include "GeomAlgoAPI_CompoundBuilder.h" +#include "GeomAlgoAPI_ConeSegment.h" +#include "GeomAlgoAPI_Copy.h" +#include "GeomAlgoAPI_CurveBuilder.h" +#include "GeomAlgoAPI_DFLoader.h" +#include "GeomAlgoAPI_EdgeBuilder.h" +#include "GeomAlgoAPI_Exception.h" +#include "GeomAlgoAPI_FaceBuilder.h" +#include "GeomAlgoAPI_IGESExport.h" +#include "GeomAlgoAPI_IGESImport.h" +#include "GeomAlgoAPI_Intersection.h" +#include "GeomAlgoAPI_MakeShape.h" +#include "GeomAlgoAPI_MakeShapeCustom.h" +#include "GeomAlgoAPI_MakeShapeList.h" +#include "GeomAlgoAPI_MakeSweep.h" +#include "GeomAlgoAPI_MapShapesAndAncestors.h" +#include "GeomAlgoAPI_NonPlanarFace.h" +#include "GeomAlgoAPI_PaveFiller.h" +#include "GeomAlgoAPI_Pipe.h" +#include "GeomAlgoAPI_Placement.h" +#include "GeomAlgoAPI_PointBuilder.h" +#include "GeomAlgoAPI_Prism.h" +#include "GeomAlgoAPI_Revolution.h" +#include "GeomAlgoAPI_Rotation.h" +#include "GeomAlgoAPI_STEPExport.h" +#include "GeomAlgoAPI_STEPImport.h" +#include "GeomAlgoAPI_Sewing.h" +#include "GeomAlgoAPI_ShapeAPI.h" +#include "GeomAlgoAPI_ShapeBuilder.h" +#include "GeomAlgoAPI_ShapeInfo.h" +#include "GeomAlgoAPI_ShapeTools.h" +#include "GeomAlgoAPI_SketchBuilder.h" +#include "GeomAlgoAPI_Symmetry.h" +#include "GeomAlgoAPI_Tools.h" +#include "GeomAlgoAPI_Transform.h" +#include "GeomAlgoAPI_Translation.h" +#include "GeomAlgoAPI_WireBuilder.h" - #include - #include - #include +#include +#include +#include - #ifdef _MSC_VER - # pragma warning(disable: 4456) // declaration of variable hides previous local declaration - # pragma warning(disable: 4459) // declaration of variable hides global declaration - # pragma warning(disable: 4701) // potentially uninitialized local variable - # pragma warning(disable: 4703) // potentially uninitialized local pointer variable - #endif +#ifdef _MSC_VER +#pragma warning(disable : 4456) // declaration of variable hides previous local + // declaration +#pragma warning( \ + disable : 4459) // declaration of variable hides global declaration +#pragma warning(disable : 4701) // potentially uninitialized local variable +#pragma warning( \ + disable : 4703) // potentially uninitialized local pointer variable +#endif #endif /* SRC_GEOMALGOAPI_GEOMALGOAPI_SWIG_H_ */ // fix for SWIG v2.0.4 -#define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) +#define SWIGPY_SLICE_ARG(obj) ((PyObject *)(obj)) diff --git a/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx b/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx index ccdaad7e4..9404795c3 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Algo.cxx @@ -27,58 +28,43 @@ // #include - //======================================================================= // function: // purpose: //======================================================================= GEOMAlgo_Algo::GEOMAlgo_Algo() - :myErrorStatus(1) - ,myWarningStatus(0) - ,myComputeInternalShapes(Standard_True) -{} + : myErrorStatus(1), myWarningStatus(0), + myComputeInternalShapes(Standard_True) {} //======================================================================= // function: ~ // purpose: //======================================================================= -GEOMAlgo_Algo::~GEOMAlgo_Algo() -{ -} +GEOMAlgo_Algo::~GEOMAlgo_Algo() {} //======================================================================= // function: CheckData // purpose: //======================================================================= -void GEOMAlgo_Algo::CheckData() -{ - myErrorStatus=0; -} +void GEOMAlgo_Algo::CheckData() { myErrorStatus = 0; } //======================================================================= // function: CheckResult // purpose: //======================================================================= -void GEOMAlgo_Algo::CheckResult() -{ - myErrorStatus=0; -} +void GEOMAlgo_Algo::CheckResult() { myErrorStatus = 0; } //======================================================================= // function: ErrorStatus // purpose: //======================================================================= -Standard_Integer GEOMAlgo_Algo::ErrorStatus()const -{ - return myErrorStatus; -} +Standard_Integer GEOMAlgo_Algo::ErrorStatus() const { return myErrorStatus; } //======================================================================= // function: WarningStatus // purpose: //======================================================================= -Standard_Integer GEOMAlgo_Algo::WarningStatus()const -{ +Standard_Integer GEOMAlgo_Algo::WarningStatus() const { return myWarningStatus; } // myErrorStatus @@ -86,10 +72,9 @@ Standard_Integer GEOMAlgo_Algo::WarningStatus()const // 1 - object is just initialized //======================================================================= -//function : ComputeInternalShapes -//purpose : +// function : ComputeInternalShapes +// purpose : //======================================================================= -void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag) -{ +void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag) { myComputeInternalShapes = theFlag; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx b/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx index e593b8f84..8625f784a 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Algo.hxx @@ -31,18 +32,16 @@ #include #include -#include -#include #include - +#include +#include //======================================================================= -//class : GEOMAlgo_Algo -//purpose : +// class : GEOMAlgo_Algo +// purpose : //======================================================================= -class GEOMAlgo_Algo -{ - public: +class GEOMAlgo_Algo { +public: GEOMALGOIMPL_EXPORT virtual void Perform() = 0; GEOMALGOIMPL_EXPORT Standard_Integer ErrorStatus() const; @@ -51,17 +50,17 @@ class GEOMAlgo_Algo //! Allows to omit of creation of internal shapes (manifold topology).
    //! Needed for the SALOME/TRIPOLI module.
    - GEOMALGOIMPL_EXPORT void ComputeInternalShapes(const Standard_Boolean theFlag) ; + GEOMALGOIMPL_EXPORT void + ComputeInternalShapes(const Standard_Boolean theFlag); protected: GEOMALGOIMPL_EXPORT GEOMAlgo_Algo(); GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Algo(); - GEOMALGOIMPL_EXPORT virtual void CheckData() ; - - GEOMALGOIMPL_EXPORT virtual void CheckResult() ; + GEOMALGOIMPL_EXPORT virtual void CheckData(); + GEOMALGOIMPL_EXPORT virtual void CheckResult(); Standard_Integer myErrorStatus; Standard_Integer myWarningStatus; diff --git a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx index 4b3b23065..17ecd2d53 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File : GEOMAlgo_AlgoTools.cxx // Created : @@ -27,22 +28,21 @@ #include +#include +#include +#include #include #include -#include -#include -#include #include #include #include -#include #include #include -#include #include +#include #include #include @@ -53,8 +53,8 @@ #include -#include #include +#include #include @@ -65,40 +65,40 @@ #include #include -#include -#include -#include #include +#include +#include +#include #include #include -#include -#include #include +#include +#include -#include -#include #include -#include #include +#include +#include +#include #include +#include +#include #include #include #include -#include -#include -#include -#include #include +#include +#include #include -#include #include +#include #include #include @@ -107,103 +107,94 @@ #include -static - void GetCount(const TopoDS_Shape& aS, - Standard_Integer& iCnt); -static - void CopySource(const TopoDS_Shape& aS, - TopTools_IndexedDataMapOfShapeShape& aMapSS, - TopoDS_Shape& aSC); +static void GetCount(const TopoDS_Shape &aS, Standard_Integer &iCnt); +static void CopySource(const TopoDS_Shape &aS, + TopTools_IndexedDataMapOfShapeShape &aMapSS, + TopoDS_Shape &aSC); -static Standard_Boolean comp(const std::pair& theA, - const std::pair& theB); +static Standard_Boolean +comp(const std::pair &theA, + const std::pair &theB); -static Standard_Boolean IsUiso (const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace); +static Standard_Boolean IsUiso(const TopoDS_Edge &theEdge, + const TopoDS_Face &theFace); -static void CorrectShell (const TopoDS_Shape& theShell, - const TopoDS_Face& theFace); +static void CorrectShell(const TopoDS_Shape &theShell, + const TopoDS_Face &theFace); -static gp_Pnt GetMidPnt2d(const TopoDS_Face& theFace, +static gp_Pnt GetMidPnt2d(const TopoDS_Face &theFace, const Standard_Boolean theIsNaturalRestrictions); -static void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, - const Standard_Real theAverageArea, - const Standard_Boolean theIsToAddFaces, - Standard_Integer& theNbExtremalFaces, - TopTools_MapOfShape& theExtremalFaces, - const std::vector> theFacesAndAreas, - const TopTools_DataMapOfShapeReal& theFaceAreaMap, - const TopTools_IndexedDataMapOfShapeListOfShape& theEFmap, - TopoDS_Shape& theRes, - TopoDS_Shape& theGlobalRes, - TopTools_MapOfShape& theRemovedFaces); +static void ModifyFacesForGlobalResult( + const TopoDS_Face &theInputFace, const Standard_Real theAverageArea, + const Standard_Boolean theIsToAddFaces, + Standard_Integer &theNbExtremalFaces, TopTools_MapOfShape &theExtremalFaces, + const std::vector> theFacesAndAreas, + const TopTools_DataMapOfShapeReal &theFaceAreaMap, + const TopTools_IndexedDataMapOfShapeListOfShape &theEFmap, + TopoDS_Shape &theRes, TopoDS_Shape &theGlobalRes, + TopTools_MapOfShape &theRemovedFaces); //======================================================================= -//function : CopyShape -//purpose : +// function : CopyShape +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC) -{ +void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape &aS, TopoDS_Shape &aSC) { TopTools_IndexedDataMapOfShapeShape aMapSS; // CopySource(aS, aMapSS, aSC); } //======================================================================= -//function : CopyShape -//purpose : +// function : CopyShape +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC, - TopTools_IndexedDataMapOfShapeShape& aMapSS) -{ +void GEOMAlgo_AlgoTools::CopyShape( + const TopoDS_Shape &aS, TopoDS_Shape &aSC, + TopTools_IndexedDataMapOfShapeShape &aMapSS) { CopySource(aS, aMapSS, aSC); } //======================================================================= -//function : CopySource -//purpose : +// function : CopySource +// purpose : //======================================================================= -void CopySource(const TopoDS_Shape& aS, - TopTools_IndexedDataMapOfShapeShape& aMapSS, - TopoDS_Shape& aSC) -{ +void CopySource(const TopoDS_Shape &aS, + TopTools_IndexedDataMapOfShapeShape &aMapSS, + TopoDS_Shape &aSC) { Standard_Boolean bFree; TopAbs_ShapeEnum aT; TopoDS_Iterator aIt; TopoDS_Shape aSF; BRep_Builder BB; // - aT=aS.ShapeType(); + aT = aS.ShapeType(); // if (aMapSS.Contains(aS)) { - aSC=aMapSS.ChangeFromKey(aS); + aSC = aMapSS.ChangeFromKey(aS); aSC.Orientation(aS.Orientation()); return; - } - else { - aSC=aS.EmptyCopied(); + } else { + aSC = aS.EmptyCopied(); aMapSS.Add(aS, aSC); } // - bFree=aSC.Free(); + bFree = aSC.Free(); aSC.Free(Standard_True); - aSF=aS; - if (aT==TopAbs_EDGE){ + aSF = aS; + if (aT == TopAbs_EDGE) { TopAbs_Orientation aOr; // - aOr=aS.Orientation(); - if(aOr==TopAbs_INTERNAL) { + aOr = aS.Orientation(); + if (aOr == TopAbs_INTERNAL) { aSF.Orientation(TopAbs_FORWARD); } } aIt.Initialize(aSF); - for (; aIt.More(); aIt.Next()) { + for (; aIt.More(); aIt.Next()) { TopoDS_Shape aSCx; // - const TopoDS_Shape& aSx=aIt.Value(); + const TopoDS_Shape &aSx = aIt.Value(); // - CopySource (aSx, aMapSS, aSCx); + CopySource(aSx, aMapSS, aSCx); // aSCx.Orientation(aSx.Orientation()); BB.Add(aSC, aSCx); @@ -211,37 +202,32 @@ void CopySource(const TopoDS_Shape& aS, aSC.Free(bFree); } //======================================================================= -//function : FaceNormal -//purpose : +// function : FaceNormal +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF, - const Standard_Real U, - const Standard_Real V, - gp_Vec& aN) -{ - gp_Pnt aPnt ; +void GEOMAlgo_AlgoTools::FaceNormal(const TopoDS_Face &aF, + const Standard_Real U, + const Standard_Real V, gp_Vec &aN) { + gp_Pnt aPnt; gp_Vec aD1U, aD1V; Handle(Geom_Surface) aSurface; - aSurface=BRep_Tool::Surface(aF); - aSurface->D1 (U, V, aPnt, aD1U, aD1V); - aN=aD1U.Crossed(aD1V); - aN.Normalize(); - if (aF.Orientation() == TopAbs_REVERSED){ + aSurface = BRep_Tool::Surface(aF); + aSurface->D1(U, V, aPnt, aD1U, aD1V); + aN = aD1U.Crossed(aD1V); + aN.Normalize(); + if (aF.Orientation() == TopAbs_REVERSED) { aN.Reverse(); } return; } //======================================================================= -//function : BuildPCurveForEdgeOnFace -//purpose : +// function : BuildPCurveForEdgeOnFace +// purpose : //======================================================================= -Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace - (const TopoDS_Edge& aEold, - const TopoDS_Edge& aEnew, - const TopoDS_Face& aF, - const Handle(IntTools_Context)& aCtx) -{ +Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace( + const TopoDS_Edge &aEold, const TopoDS_Edge &aEnew, const TopoDS_Face &aF, + const Handle(IntTools_Context) & aCtx) { Standard_Boolean bIsClosed, bUClosed, bHasOld; Standard_Integer iRet, aNbPoints; Standard_Real aTS, aTS1, aTS2, aT, aT1, aT2, aScPr, aTol; @@ -253,9 +239,10 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace Handle(Geom_Surface) aS; TopoDS_Edge aES; // - iRet=0; + iRet = 0; // - bHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol); + bHasOld = + BOPTools_AlgoTools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol); if (bHasOld) { return iRet; } @@ -272,60 +259,60 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace } // BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aEnew, aF); - aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2); - if (aC2D.IsNull()){ - iRet=1; + aC2D = BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2); + if (aC2D.IsNull()) { + iRet = 1; return iRet; } // - bIsClosed=BRep_Tool::IsClosed(aEold, aF); + bIsClosed = BRep_Tool::IsClosed(aEold, aF); if (!bIsClosed) { return iRet; } // - aTol=1.e-7; + aTol = 1.e-7; // // 1. bUClosed - direction of closeness // - aES=aEold; + aES = aEold; aES.Orientation(TopAbs_FORWARD); - aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2); + aC2DS1 = BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2); // aES.Orientation(TopAbs_REVERSED); - aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2); + aC2DS2 = BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2); // - aTS=IntTools_Tools::IntermediatePoint(aTS1, aTS2); + aTS = IntTools_Tools::IntermediatePoint(aTS1, aTS2); // aC2DS1->D1(aTS, aP2DS1, aV2DS1); aC2DS2->D1(aTS, aP2DS2, aV2DS2); // gp_Vec2d aV2DS12(aP2DS1, aP2DS2); gp_Dir2d aD2DS12(aV2DS12); - const gp_Dir2d& aD2DX=gp::DX2d(); + const gp_Dir2d &aD2DX = gp::DX2d(); // - aScPr=aD2DS12*aD2DX; - bUClosed=Standard_True; + aScPr = aD2DS12 * aD2DX; + bUClosed = Standard_True; if (fabs(aScPr) < aTol) { - bUClosed=!bUClosed; + bUClosed = !bUClosed; } // // 2. aP2D - point on curve aC2D, that corresponds to aP2DS1 aP2DS1.Coord(aUS1, aVS1); aP2DS2.Coord(aUS2, aVS2); // - aS=BRep_Tool::Surface(aF); + aS = BRep_Tool::Surface(aF); aS->D0(aUS1, aVS1, aP); // - GeomAPI_ProjectPointOnCurve& aProjPC=aCtx->ProjPC(aEnew); + GeomAPI_ProjectPointOnCurve &aProjPC = aCtx->ProjPC(aEnew); // aProjPC.Perform(aP); - aNbPoints=aProjPC.NbPoints(); + aNbPoints = aProjPC.NbPoints(); if (!aNbPoints) { - iRet=2; + iRet = 2; return iRet; } // - aT=aProjPC.LowerDistanceParameter(); + aT = aProjPC.LowerDistanceParameter(); // // 3. Build the second 2D curve @@ -338,17 +325,16 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace aC2D->D1(aT, aP2D, aV2D); aP2D.Coord(aU, aV); // - aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy()); + aC2Dnew = Handle(Geom2d_Curve)::DownCast(aC2D->Copy()); aC2DTnew = new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2); // - aV2DT=aV2DS12; - if (!bUClosed) { // V Closed - if (fabs(aV-aVS2)Translate(aV2DT); // // 4 Order the 2D curves - bRevOrder=Standard_False; - aScPr=aV2D*aV2DS1; - if(aScPr<0.) { - bRevOrder=!bRevOrder; + bRevOrder = Standard_False; + aScPr = aV2D * aV2DS1; + if (aScPr < 0.) { + bRevOrder = !bRevOrder; } // // 5. Update the edge - aTol=BRep_Tool::Tolerance(aEnew); + aTol = BRep_Tool::Tolerance(aEnew); if (!bRevOrder) { aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol); - } - else { - aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol); + } else { + aBB.UpdateEdge(aEnew, aC2DTnew, aC2D, aF, aTol); } // return iRet; @@ -379,325 +364,289 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace // purpose: //======================================================================= void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType, - TopoDS_Shape& theC) -{ + TopoDS_Shape &theC) { BRep_Builder aBB; // - switch(theType) { - case TopAbs_COMPOUND:{ - TopoDS_Compound aC; - aBB.MakeCompound(aC); - theC=aC; - } - break; - // - case TopAbs_COMPSOLID:{ - TopoDS_CompSolid aCS; - aBB.MakeCompSolid(aCS); - theC=aCS; - } - break; - // - case TopAbs_SOLID:{ - TopoDS_Solid aSolid; - aBB.MakeSolid(aSolid); - theC=aSolid; - } - break; - // - // - case TopAbs_SHELL:{ - TopoDS_Shell aShell; - aBB.MakeShell(aShell); - theC=aShell; - } - break; - // - case TopAbs_WIRE: { - TopoDS_Wire aWire; - aBB.MakeWire(aWire); - theC=aWire; - } - break; - // - default: - break; + switch (theType) { + case TopAbs_COMPOUND: { + TopoDS_Compound aC; + aBB.MakeCompound(aC); + theC = aC; + } break; + // + case TopAbs_COMPSOLID: { + TopoDS_CompSolid aCS; + aBB.MakeCompSolid(aCS); + theC = aCS; + } break; + // + case TopAbs_SOLID: { + TopoDS_Solid aSolid; + aBB.MakeSolid(aSolid); + theC = aSolid; + } break; + // + // + case TopAbs_SHELL: { + TopoDS_Shell aShell; + aBB.MakeShell(aShell); + theC = aShell; + } break; + // + case TopAbs_WIRE: { + TopoDS_Wire aWire; + aBB.MakeWire(aWire); + theC = aWire; + } break; + // + default: + break; } } //======================================================================= -//function : IsUPeriodic -//purpose : +// function : IsUPeriodic +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_AlgoTools::IsUPeriodic(const Handle(Geom_Surface) &aS) -{ +Standard_Boolean GEOMAlgo_AlgoTools::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); + aType = aGAS.GetType(); + bRet = (aType == GeomAbs_Cylinder || aType == GeomAbs_Cone || + aType == GeomAbs_Sphere); // return bRet; } //======================================================================= -//function : RefinePCurveForEdgeOnFace -//purpose : +// function : RefinePCurveForEdgeOnFace +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aUMin, - const Standard_Real aUMax) -{ +void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge &aE, + const TopoDS_Face &aF, + const Standard_Real aUMin, + const Standard_Real aUMax) { Standard_Real aT1, aT2, aTx, aUx, aTol; gp_Pnt2d aP2D; Handle(Geom_Surface) aS; Handle(Geom2d_Curve) aC2D; BRep_Builder aBB; // - aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2); + aC2D = BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2); if (!aC2D.IsNull()) { if (BRep_Tool::IsClosed(aE, aF)) { return; } - aTx=IntTools_Tools::IntermediatePoint(aT1, aT2); + aTx = IntTools_Tools::IntermediatePoint(aT1, aT2); aC2D->D0(aTx, aP2D); - aUx=aP2D.X(); + aUx = aP2D.X(); if (aUx < aUMin || aUx > aUMax) { // need to rebuild Handle(Geom2d_Curve) aC2Dx; // - aTol=BRep_Tool::Tolerance(aE); + aTol = BRep_Tool::Tolerance(aE); aBB.UpdateEdge(aE, aC2Dx, aF, aTol); } } } //======================================================================= -//function :IsSplitToReverse -//purpose : +// function :IsSplitToReverse +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse - (const TopoDS_Edge& aEF1, - const TopoDS_Edge& aEF2, - const Handle(IntTools_Context)& aContext) -{ +Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse( + const TopoDS_Edge &aEF1, const TopoDS_Edge &aEF2, + const Handle(IntTools_Context) & aContext) { Standard_Boolean aFlag; Standard_Real aT1, aT2, aScPr, a, b; gp_Vec aV1, aV2; gp_Pnt aP; - - - Handle(Geom_Curve)aC1=BRep_Tool::Curve(aEF1, a, b); - aT1=IntTools_Tools::IntermediatePoint(a, b); + + Handle(Geom_Curve) aC1 = BRep_Tool::Curve(aEF1, a, b); + aT1 = IntTools_Tools::IntermediatePoint(a, b); aC1->D0(aT1, aP); - aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF1, aT1, aV1); + aFlag = BOPTools_AlgoTools2D::EdgeTangent(aEF1, aT1, aV1); - if(!aFlag) { + if (!aFlag) { return Standard_False; } gp_Dir aDT1(aV1); // - aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2); - if(!aFlag) { + aFlag = aContext->ProjectPointOnEdge(aP, aEF2, aT2); + if (!aFlag) { return Standard_False; } // - aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF2, aT2, aV2); - if(!aFlag) { + aFlag = BOPTools_AlgoTools2D::EdgeTangent(aEF2, aT2, aV2); + if (!aFlag) { return Standard_False; } gp_Dir aDT2(aV2); - aScPr=aDT1*aDT2; + aScPr = aDT1 * aDT2; - return (aScPr<0.); + return (aScPr < 0.); } - //======================================================================= -//function : ProjectPointOnShape -//purpose : +// function : ProjectPointOnShape +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape - (const gp_Pnt& aP1, - const TopoDS_Shape& aS, - gp_Pnt& aP2, - const Handle(IntTools_Context)& aCtx) -{ +Standard_Boolean +GEOMAlgo_AlgoTools::ProjectPointOnShape(const gp_Pnt &aP1, + const TopoDS_Shape &aS, gp_Pnt &aP2, + const Handle(IntTools_Context) & aCtx) { Standard_Boolean bIsDone = Standard_False; Standard_Real aT2; TopAbs_ShapeEnum aType; // aType = aS.ShapeType(); - switch (aType) - { - case TopAbs_EDGE: - { - const TopoDS_Edge& aE2 = TopoDS::Edge(aS); - // - if (BRep_Tool::Degenerated(aE2)) { // jfa - return Standard_True; - } - else { - Standard_Real f, l; - Handle(Geom_Curve) aC3D = BRep_Tool::Curve (aE2, f, l); - if (aC3D.IsNull()) { - return Standard_True; - } - bIsDone = aCtx->ProjectPointOnEdge(aP1, aE2, aT2); - } - if (!bIsDone) { - return bIsDone; - } - // - GEOMAlgo_AlgoTools::PointOnEdge(aE2, aT2, aP2); - } - break; - // - case TopAbs_FACE: - { - const TopoDS_Face& aF2 = TopoDS::Face(aS); - GeomAPI_ProjectPointOnSurf& aProj = aCtx->ProjPS(aF2); - // - aProj.Perform(aP1); - bIsDone = aProj.IsDone(); - if (!bIsDone) { - return bIsDone; - } - // - aP2 = aProj.NearestPoint(); + switch (aType) { + case TopAbs_EDGE: { + const TopoDS_Edge &aE2 = TopoDS::Edge(aS); + // + if (BRep_Tool::Degenerated(aE2)) { // jfa + return Standard_True; + } else { + Standard_Real f, l; + Handle(Geom_Curve) aC3D = BRep_Tool::Curve(aE2, f, l); + if (aC3D.IsNull()) { + return Standard_True; } - break; - // - default: - break; // Err + bIsDone = aCtx->ProjectPointOnEdge(aP1, aE2, aT2); + } + if (!bIsDone) { + return bIsDone; } + // + GEOMAlgo_AlgoTools::PointOnEdge(aE2, aT2, aP2); + } break; + // + case TopAbs_FACE: { + const TopoDS_Face &aF2 = TopoDS::Face(aS); + GeomAPI_ProjectPointOnSurf &aProj = aCtx->ProjPS(aF2); + // + aProj.Perform(aP1); + bIsDone = aProj.IsDone(); + if (!bIsDone) { + return bIsDone; + } + // + aP2 = aProj.NearestPoint(); + } break; + // + default: + break; // Err + } return bIsDone; } //======================================================================= -//function : PointOnEdge -//purpose : +// function : PointOnEdge +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, - gp_Pnt& aP3D) -{ +void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge &aE, gp_Pnt &aP3D) { Standard_Real aTx, aT1, aT2; // BRep_Tool::Curve(aE, aT1, aT2); - aTx=IntTools_Tools::IntermediatePoint(aT1, aT2); + aTx = IntTools_Tools::IntermediatePoint(aT1, aT2); GEOMAlgo_AlgoTools::PointOnEdge(aE, aTx, aP3D); } //======================================================================= -//function : PointOnEdge -//purpose : +// function : PointOnEdge +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, - const Standard_Real aT, - gp_Pnt& aP3D) -{ +void GEOMAlgo_AlgoTools::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 = BRep_Tool::Curve(aE, aT1, aT2); aC3D->D0(aT, aP3D); } //======================================================================= -//function : PointOnFace -//purpose : +// function : PointOnFace +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF, - const Standard_Real aU, - const Standard_Real aV, - gp_Pnt& aP3D) -{ +void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face &aF, + const Standard_Real aU, + const Standard_Real aV, gp_Pnt &aP3D) { Handle(Geom_Surface) aS; // - aS=BRep_Tool::Surface(aF); + aS = BRep_Tool::Surface(aF); aS->D0(aU, aV, aP3D); } //======================================================================= -//function : PointOnFace -//purpose : +// function : PointOnFace +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF, - gp_Pnt& aP3D) -{ +void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face &aF, gp_Pnt &aP3D) { Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax; // BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); // - aU=IntTools_Tools::IntermediatePoint(aUMin, aUMax); - aV=IntTools_Tools::IntermediatePoint(aVMin, aVMax); + aU = IntTools_Tools::IntermediatePoint(aUMin, aUMax); + aV = IntTools_Tools::IntermediatePoint(aVMin, aVMax); // GEOMAlgo_AlgoTools::PointOnFace(aF, aU, aV, aP3D); } //======================================================================= -//function : PointOnShape -//purpose : +// function : PointOnShape +// purpose : //======================================================================= -void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS, - gp_Pnt& aP3D) -{ +void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape &aS, gp_Pnt &aP3D) { TopAbs_ShapeEnum aType; // - aP3D.SetCoord(99.,99.,99.); - aType=aS.ShapeType(); - switch(aType) { - case TopAbs_EDGE: { - const TopoDS_Edge& aE=TopoDS::Edge(aS); - GEOMAlgo_AlgoTools::PointOnEdge(aE, aP3D); - } - break; - // - case TopAbs_FACE: { - const TopoDS_Face& aF=TopoDS::Face(aS); - GEOMAlgo_AlgoTools::PointOnFace(aF, aP3D); - } - break; - // - default: - break; // Err + aP3D.SetCoord(99., 99., 99.); + aType = aS.ShapeType(); + switch (aType) { + case TopAbs_EDGE: { + const TopoDS_Edge &aE = TopoDS::Edge(aS); + GEOMAlgo_AlgoTools::PointOnEdge(aE, aP3D); + } break; + // + case TopAbs_FACE: { + const TopoDS_Face &aF = TopoDS::Face(aS); + GEOMAlgo_AlgoTools::PointOnFace(aF, aP3D); + } break; + // + default: + break; // Err } } //======================================================================= -//function : FindSDShapes -//purpose : +// function : FindSDShapes +// purpose : //======================================================================= -Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes - (const TopoDS_Shape& aE1, - const TopTools_ListOfShape& aLE, - const Standard_Real aTol, - TopTools_ListOfShape& aLESD, - const Handle(IntTools_Context)& aCtx) -{ +Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes( + const TopoDS_Shape &aE1, const TopTools_ListOfShape &aLE, + const Standard_Real aTol, TopTools_ListOfShape &aLESD, + const Handle(IntTools_Context) & aCtx) { Standard_Boolean bIsDone; Standard_Real aTol2, aD2; gp_Pnt aP1, aP2; TopTools_ListIteratorOfListOfShape aIt; // - aTol2=aTol*aTol; + aTol2 = aTol * aTol; GEOMAlgo_AlgoTools::PointOnShape(aE1, aP1); // aIt.Initialize(aLE); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aE2=aIt.Value(); + const TopoDS_Shape &aE2 = aIt.Value(); if (aE2.IsSame(aE1)) { - aLESD.Append(aE2); - } - else { - bIsDone=GEOMAlgo_AlgoTools::ProjectPointOnShape(aP1, aE2, aP2, aCtx); + aLESD.Append(aE2); + } else { + bIsDone = GEOMAlgo_AlgoTools::ProjectPointOnShape(aP1, aE2, aP2, aCtx); if (!bIsDone) { - //return 1; + // return 1; continue; // jfa BUG 20361 } - aD2=aP1.SquareDistance(aP2); - if(aD21); + bRet = (iCnt > 1); // return bRet; } //======================================================================= -//function : GetCount -//purpose : +// function : GetCount +// purpose : //======================================================================= -void GetCount(const TopoDS_Shape& aS, - Standard_Integer& iCnt) -{ +void GetCount(const TopoDS_Shape &aS, Standard_Integer &iCnt) { TopoDS_Iterator aIt; TopAbs_ShapeEnum aTS; // - aTS=aS.ShapeType(); + aTS = aS.ShapeType(); // - if (aTS==TopAbs_SHAPE) { + if (aTS == TopAbs_SHAPE) { return; } - if (aTS!=TopAbs_COMPOUND) { + if (aTS != TopAbs_COMPOUND) { ++iCnt; return; } // aIt.Initialize(aS); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSx=aIt.Value(); + const TopoDS_Shape &aSx = aIt.Value(); GetCount(aSx, iCnt); } } //======================================================================= -//function : PntInFace -//purpose : +// function : PntInFace +// purpose : //======================================================================= -Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF, - gp_Pnt& theP, - gp_Pnt2d& theP2D) -{ +Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face &aF, + gp_Pnt &theP, gp_Pnt2d &theP2D) { Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint; Standard_Integer iErr, aIx, aNbDomains, i; Standard_Real aUMin, aUMax, aVMin, aVMax; Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT; Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D; - gp_Dir2d aD2D (0., 1.); + gp_Dir2d aD2D(0., 1.); gp_Pnt2d aP2D; gp_Pnt aPx; Handle(Geom2d_Curve) aC2D; @@ -953,380 +890,356 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF, TopoDS_Face aFF; TopExp_Explorer aExp; // - aTolHatch2D=1.e-8; - aTolHatch3D=1.e-8; - aTotArcIntr=1.e-10; - aTolTangfIntr=1.e-10; + aTolHatch2D = 1.e-8; + aTolHatch3D = 1.e-8; + aTotArcIntr = 1.e-10; + aTolTangfIntr = 1.e-10; // Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr); - Geom2dHatch_Hatcher aHatcher(aIntr, - aTolHatch2D, aTolHatch3D, - Standard_True, Standard_False); + Geom2dHatch_Hatcher aHatcher(aIntr, aTolHatch2D, aTolHatch3D, Standard_True, + Standard_False); // - iErr=0; - aEpsT=1.e-12; + iErr = 0; + aEpsT = 1.e-12; // - aFF=aF; - aFF.Orientation (TopAbs_FORWARD); + aFF = aF; + aFF.Orientation(TopAbs_FORWARD); // - aS=BRep_Tool::Surface(aFF); + aS = BRep_Tool::Surface(aFF); BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax); // // 1 - aExp.Init (aFF, TopAbs_EDGE); - for (; aExp.More() ; aExp.Next()) { - const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current()); - aOrE=aE.Orientation(); + aExp.Init(aFF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Edge &aE = *((TopoDS_Edge *)&aExp.Current()); + aOrE = aE.Orientation(); // - aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2); - if (aC2D.IsNull() ) { - iErr=1; + aC2D = BRep_Tool::CurveOnSurface(aE, aFF, aU1, aU2); + if (aC2D.IsNull()) { + iErr = 1; return iErr; } - if (fabs(aU1-aU2) < aEpsT) { - iErr=2; + if (fabs(aU1 - aU2) < aEpsT) { + iErr = 2; return iErr; } // - aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2); + aCT2D = new Geom2d_TrimmedCurve(aC2D, aU1, aU2); aHatcher.AddElement(aCT2D, aOrE); - }// for (; aExp.More() ; aExp.Next()) { + } // for (; aExp.More() ; aExp.Next()) { // // 2 - aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax); + aUx = IntTools_Tools::IntermediatePoint(aUMin, aUMax); aP2D.SetCoord(aUx, 0.); - aL2D=new Geom2d_Line (aP2D, aD2D); + aL2D = new Geom2d_Line(aP2D, aD2D); Geom2dAdaptor_Curve aHCur(aL2D); // - aIx=aHatcher.AddHatching(aHCur) ; + aIx = aHatcher.AddHatching(aHCur); // // 3. aHatcher.Trim(); - bIsDone=aHatcher.TrimDone(aIx); + bIsDone = aHatcher.TrimDone(aIx); if (!bIsDone) { - iErr=3; + iErr = 3; return iErr; } // aHatcher.ComputeDomains(aIx); - bIsDone=aHatcher.IsDone(aIx); + bIsDone = aHatcher.IsDone(aIx); if (!bIsDone) { - iErr=4; + iErr = 4; return iErr; } // // 4. - aVx=aVMin; - aNbDomains=aHatcher.NbDomains(aIx); + aVx = aVMin; + aNbDomains = aHatcher.NbDomains(aIx); if (!aNbDomains) { - iErr=5; + iErr = 5; return iErr; } // - i=1; - const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; - bHasFirstPoint=aDomain.HasFirstPoint(); + i = 1; + const HatchGen_Domain &aDomain = aHatcher.Domain(aIx, i); + bHasFirstPoint = aDomain.HasFirstPoint(); if (!bHasFirstPoint) { - iErr=5; + iErr = 5; return iErr; } // - aV1=aDomain.FirstPoint().Parameter(); + aV1 = aDomain.FirstPoint().Parameter(); // - bHasSecondPoint=aDomain.HasSecondPoint(); + bHasSecondPoint = aDomain.HasSecondPoint(); if (!bHasSecondPoint) { - iErr=6; + iErr = 6; return iErr; } // - aV2=aDomain.SecondPoint().Parameter(); + aV2 = aDomain.SecondPoint().Parameter(); // - aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); + aVx = IntTools_Tools::IntermediatePoint(aV1, aV2); // aS->D0(aUx, aVx, aPx); // theP2D.SetCoord(aUx, aVx); - theP=aPx; + theP = aPx; // return iErr; } //======================================================================= -//function : PointCloudInFace -//purpose : +// function : PointCloudInFace +// purpose : //======================================================================= -Standard_Integer GEOMAlgo_AlgoTools::PointCloudInFace(const TopoDS_Face& theFace, - const int theNbPnts, - TopoDS_Compound& theCompound) -{ +Standard_Integer +GEOMAlgo_AlgoTools::PointCloudInFace(const TopoDS_Face &theFace, + const int theNbPnts, + TopoDS_Compound &theCompound) { #if OCC_VERSION_LARGE < 0x07050304 return -1; #else - ShapeUpgrade_ShapeDivideArea tool (theFace); - tool.SetSplittingByNumber (Standard_True); + ShapeUpgrade_ShapeDivideArea tool(theFace); + tool.SetSplittingByNumber(Standard_True); tool.NbParts() = theNbPnts; tool.Perform(); TopoDS_Shape res = tool.Result(); BRep_Builder aBB; TopoDS_Compound aGlobalRes; - aBB.MakeCompound (aGlobalRes); + aBB.MakeCompound(aGlobalRes); TopTools_IndexedMapOfShape aFaceMap; - TopExp::MapShapes (res, TopAbs_FACE, aFaceMap); + TopExp::MapShapes(res, TopAbs_FACE, aFaceMap); Standard_Integer aNbFaces = aFaceMap.Extent(); TopTools_IndexedDataMapOfShapeListOfShape aEFmap; - TopExp::MapShapesAndAncestors (res, TopAbs_EDGE, TopAbs_FACE, aEFmap); - + TopExp::MapShapesAndAncestors(res, TopAbs_EDGE, TopAbs_FACE, aEFmap); + TopTools_MapOfShape aBiggestFaces, aSmallestFaces; Standard_Boolean aUseTriangulation = Standard_True; Standard_Boolean aSkipShared = Standard_False; - if (aNbFaces != theNbPnts) - { + if (aNbFaces != theNbPnts) { Standard_Real aTotalArea = 0.; - std::vector > aFacesAndAreas (aNbFaces); - for (Standard_Integer ii = 1; ii <= aNbFaces; ii++) - { + std::vector> aFacesAndAreas( + aNbFaces); + for (Standard_Integer ii = 1; ii <= aNbFaces; ii++) { GProp_GProps aProps; - BRepGProp::SurfaceProperties (aFaceMap(ii), aProps, aSkipShared, aUseTriangulation); + BRepGProp::SurfaceProperties(aFaceMap(ii), aProps, aSkipShared, + aUseTriangulation); Standard_Real anArea = aProps.Mass(); aTotalArea += anArea; - std::pair aFaceWithArea (aFaceMap(ii), anArea); - aFacesAndAreas[ii-1] = aFaceWithArea; + std::pair aFaceWithArea(aFaceMap(ii), + anArea); + aFacesAndAreas[ii - 1] = aFaceWithArea; } - std::sort (aFacesAndAreas.begin(), aFacesAndAreas.end(), comp); + std::sort(aFacesAndAreas.begin(), aFacesAndAreas.end(), comp); Standard_Real anAverageArea = aTotalArea / theNbPnts; TopTools_DataMapOfShapeReal aFaceAreaMap; for (Standard_Integer ii = 0; ii < aNbFaces; ii++) - aFaceAreaMap.Bind (aFacesAndAreas[ii].first, aFacesAndAreas[ii].second); - + aFaceAreaMap.Bind(aFacesAndAreas[ii].first, aFacesAndAreas[ii].second); + TopTools_MapOfShape aRemovedFaces; - - if (aNbFaces < theNbPnts) - { + + if (aNbFaces < theNbPnts) { Standard_Integer aNbMissingFaces = theNbPnts - aNbFaces; - for (Standard_Integer ii = aNbFaces-1; ii > aNbFaces - aNbMissingFaces - 1; ii--) - aBiggestFaces.Add (aFacesAndAreas[ii].first); - - ModifyFacesForGlobalResult (theFace, anAverageArea, - Standard_True, //to add faces - aNbMissingFaces, aBiggestFaces, - aFacesAndAreas, aFaceAreaMap, aEFmap, - res, aGlobalRes, - aRemovedFaces); - } - else //aNbFaces > theNbPnts + for (Standard_Integer ii = aNbFaces - 1; + ii > aNbFaces - aNbMissingFaces - 1; ii--) + aBiggestFaces.Add(aFacesAndAreas[ii].first); + + ModifyFacesForGlobalResult(theFace, anAverageArea, + Standard_True, // to add faces + aNbMissingFaces, aBiggestFaces, aFacesAndAreas, + aFaceAreaMap, aEFmap, res, aGlobalRes, + aRemovedFaces); + } else // aNbFaces > theNbPnts { Standard_Integer aNbExcessFaces = aNbFaces - theNbPnts; for (Standard_Integer ii = 0; ii < aNbExcessFaces; ii++) - aSmallestFaces.Add (aFacesAndAreas[ii].first); + aSmallestFaces.Add(aFacesAndAreas[ii].first); TopTools_IndexedDataMapOfShapeListOfShape aVFmap; - TopExp::MapShapesAndAncestors (res, TopAbs_VERTEX, TopAbs_FACE, aVFmap); + TopExp::MapShapesAndAncestors(res, TopAbs_VERTEX, TopAbs_FACE, aVFmap); - //Remove smallest faces with free boundaries - for (Standard_Integer ii = 0; ii < aNbExcessFaces; ii++) - { - const TopoDS_Face& aFace = TopoDS::Face (aFacesAndAreas[ii].first); + // Remove smallest faces with free boundaries + for (Standard_Integer ii = 0; ii < aNbExcessFaces; ii++) { + const TopoDS_Face &aFace = TopoDS::Face(aFacesAndAreas[ii].first); Standard_Boolean anIsFreeBoundFound = Standard_False; - TopExp_Explorer anExplo (aFace, TopAbs_EDGE); - for (; anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - if (!BRep_Tool::Degenerated (anEdge) && - aEFmap.FindFromKey(anEdge).Extent() < 2) - { + TopExp_Explorer anExplo(aFace, TopAbs_EDGE); + for (; anExplo.More(); anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + if (!BRep_Tool::Degenerated(anEdge) && + aEFmap.FindFromKey(anEdge).Extent() < 2) { anIsFreeBoundFound = Standard_True; break; } } - if (anIsFreeBoundFound) - { + if (anIsFreeBoundFound) { Standard_Real aMaxArea = 0.; - for (anExplo.Init(aFace, TopAbs_VERTEX); anExplo.More(); anExplo.Next()) - { - const TopoDS_Shape& aVertex = anExplo.Current(); - const TopTools_ListOfShape& aFaceList = aVFmap.FindFromKey (aVertex); - TopTools_ListIteratorOfListOfShape anItl (aFaceList); - for (; anItl.More(); anItl.Next()) - { - Standard_Real anArea = aFaceAreaMap (anItl.Value()); + for (anExplo.Init(aFace, TopAbs_VERTEX); anExplo.More(); + anExplo.Next()) { + const TopoDS_Shape &aVertex = anExplo.Current(); + const TopTools_ListOfShape &aFaceList = aVFmap.FindFromKey(aVertex); + TopTools_ListIteratorOfListOfShape anItl(aFaceList); + for (; anItl.More(); anItl.Next()) { + Standard_Real anArea = aFaceAreaMap(anItl.Value()); if (anArea > aMaxArea) aMaxArea = anArea; } } - Standard_Real anArreaOfSmallestFace = aFaceAreaMap (aFace); - if (anArreaOfSmallestFace < aMaxArea / 16) - { - aBB.Remove (res, aFace); - aRemovedFaces.Add (aFace); + Standard_Real anArreaOfSmallestFace = aFaceAreaMap(aFace); + if (anArreaOfSmallestFace < aMaxArea / 16) { + aBB.Remove(res, aFace); + aRemovedFaces.Add(aFace); } } } - ModifyFacesForGlobalResult (theFace, anAverageArea, - Standard_False, //to decrease number of faces - aNbExcessFaces, aSmallestFaces, - aFacesAndAreas, aFaceAreaMap, aEFmap, - res, aGlobalRes, - aRemovedFaces); + ModifyFacesForGlobalResult(theFace, anAverageArea, + Standard_False, // to decrease number of faces + aNbExcessFaces, aSmallestFaces, aFacesAndAreas, + aFaceAreaMap, aEFmap, res, aGlobalRes, + aRemovedFaces); } } - aBB.Add (aGlobalRes, res); + aBB.Add(aGlobalRes, res); - aBB.MakeCompound (theCompound); - for (TopExp_Explorer aGlobalExplo(aGlobalRes, TopAbs_FACE); aGlobalExplo.More(); aGlobalExplo.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (aGlobalExplo.Current()); + aBB.MakeCompound(theCompound); + for (TopExp_Explorer aGlobalExplo(aGlobalRes, TopAbs_FACE); + aGlobalExplo.More(); aGlobalExplo.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(aGlobalExplo.Current()); Standard_Boolean anIsNaturalRestrictions = Standard_True; - TopExp_Explorer anExplo (aFace, TopAbs_EDGE); - for (; anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - if (BRep_Tool::Degenerated (anEdge)) + TopExp_Explorer anExplo(aFace, TopAbs_EDGE); + for (; anExplo.More(); anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + if (BRep_Tool::Degenerated(anEdge)) continue; - if (!aEFmap.Contains(anEdge) || - aEFmap.FindFromKey(anEdge).Extent() < 2) - { + if (!aEFmap.Contains(anEdge) || aEFmap.FindFromKey(anEdge).Extent() < 2) { anIsNaturalRestrictions = Standard_False; break; } } - gp_Pnt aPnt = GetMidPnt2d (aFace, anIsNaturalRestrictions); - TopoDS_Vertex aVertex = BRepLib_MakeVertex (aPnt); - aBB.Add (theCompound, aVertex); + gp_Pnt aPnt = GetMidPnt2d(aFace, anIsNaturalRestrictions); + TopoDS_Vertex aVertex = BRepLib_MakeVertex(aPnt); + aBB.Add(theCompound, aVertex); } return 0; #endif } -Standard_Boolean comp(const std::pair& theA, - const std::pair& theB) -{ +Standard_Boolean comp(const std::pair &theA, + const std::pair &theB) { return (theA.second < theB.second); } -Standard_Boolean IsUiso (const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace) -{ - BRepAdaptor_Curve2d aBAcurve2d (theEdge, theFace); +Standard_Boolean IsUiso(const TopoDS_Edge &theEdge, + const TopoDS_Face &theFace) { + BRepAdaptor_Curve2d aBAcurve2d(theEdge, theFace); gp_Pnt2d aP2d; gp_Vec2d aVec; - aBAcurve2d.D1 (aBAcurve2d.FirstParameter(), aP2d, aVec); + aBAcurve2d.D1(aBAcurve2d.FirstParameter(), aP2d, aVec); return (Abs(aVec.Y()) > Abs(aVec.X())); } -void CorrectShell (const TopoDS_Shape& theShell, - const TopoDS_Face& theFace) -{ - BRepAdaptor_Surface aBAsurf (theFace, Standard_False); +void CorrectShell(const TopoDS_Shape &theShell, const TopoDS_Face &theFace) { + BRepAdaptor_Surface aBAsurf(theFace, Standard_False); GeomAbs_SurfaceType aType = aBAsurf.GetType(); - if (aType <= GeomAbs_Torus) //elementary surfaces + if (aType <= GeomAbs_Torus) // elementary surfaces return; TopLoc_Location anInputLoc; - const Handle(Geom_Surface)& anInputSurf = BRep_Tool::Surface (theFace, anInputLoc); + const Handle(Geom_Surface) &anInputSurf = + BRep_Tool::Surface(theFace, anInputLoc); BRep_Builder aBB; - - TopoDS_Iterator anIter (theShell); - for (; anIter.More(); anIter.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (anIter.Value()); + + TopoDS_Iterator anIter(theShell); + for (; anIter.More(); anIter.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(anIter.Value()); TopLoc_Location aLoc; - const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aLoc); + const Handle(Geom_Surface) &aSurf = BRep_Tool::Surface(aFace, aLoc); if (aSurf == anInputSurf) continue; - TopExp_Explorer anExplo (aFace, TopAbs_EDGE); - for (; anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); + TopExp_Explorer anExplo(aFace, TopAbs_EDGE); + for (; anExplo.More(); anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); Standard_Real aFirst, aLast; - Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (anEdge, aFace, aFirst, aLast); - aBB.UpdateEdge (anEdge, aPCurve, anInputSurf, anInputLoc, 0.); + Handle(Geom2d_Curve) aPCurve = + BRep_Tool::CurveOnSurface(anEdge, aFace, aFirst, aLast); + aBB.UpdateEdge(anEdge, aPCurve, anInputSurf, anInputLoc, 0.); } - Standard_Real aTol = BRep_Tool::Tolerance (aFace); - aBB.UpdateFace (aFace, anInputSurf, anInputLoc, aTol); + Standard_Real aTol = BRep_Tool::Tolerance(aFace); + aBB.UpdateFace(aFace, anInputSurf, anInputLoc, aTol); } } -gp_Pnt GetMidPnt2d(const TopoDS_Face& theFace, - const Standard_Boolean theIsNaturalRestrictions) -{ +gp_Pnt GetMidPnt2d(const TopoDS_Face &theFace, + const Standard_Boolean theIsNaturalRestrictions) { gp_Pnt aResPnt; - - if (theIsNaturalRestrictions) - { - BRepAdaptor_Surface aBAsurf (theFace); + + if (theIsNaturalRestrictions) { + BRepAdaptor_Surface aBAsurf(theFace); Standard_Real aUmin, aUmax, aVmin, aVmax; aUmin = aBAsurf.FirstUParameter(); aUmax = aBAsurf.LastUParameter(); aVmin = aBAsurf.FirstVParameter(); aVmax = aBAsurf.LastVParameter(); - aResPnt = aBAsurf.Value ((aUmin + aUmax)/2, (aVmin + aVmax)/2); - } - else - { + aResPnt = aBAsurf.Value((aUmin + aUmax) / 2, (aVmin + aVmax) / 2); + } else { const Standard_Integer aNbSamples = 4; - TopoDS_Wire aWire = BRepTools::OuterWire (theFace); + TopoDS_Wire aWire = BRepTools::OuterWire(theFace); TopTools_IndexedMapOfShape aEmap; - TopExp::MapShapes (aWire, TopAbs_EDGE, aEmap); + TopExp::MapShapes(aWire, TopAbs_EDGE, aEmap); Standard_Integer aNbPointsOnContour = aNbSamples * aEmap.Extent(); - TColgp_Array1OfPnt anArray (1, aNbPointsOnContour); - - BRepTools_WireExplorer aWexp (aWire, theFace); + TColgp_Array1OfPnt anArray(1, aNbPointsOnContour); + + BRepTools_WireExplorer aWexp(aWire, theFace); Standard_Integer anInd = 0; - for (; aWexp.More(); aWexp.Next()) - { - const TopoDS_Edge& anEdge = aWexp.Current(); - BRepAdaptor_Curve2d aBAcurve2d (anEdge, theFace); - Standard_Real aDelta = (aBAcurve2d.LastParameter() - aBAcurve2d.FirstParameter())/aNbSamples; - for (Standard_Integer ii = 0; ii < aNbSamples; ii++) - { + for (; aWexp.More(); aWexp.Next()) { + const TopoDS_Edge &anEdge = aWexp.Current(); + BRepAdaptor_Curve2d aBAcurve2d(anEdge, theFace); + Standard_Real aDelta = + (aBAcurve2d.LastParameter() - aBAcurve2d.FirstParameter()) / + aNbSamples; + for (Standard_Integer ii = 0; ii < aNbSamples; ii++) { Standard_Real aParam = aBAcurve2d.FirstParameter() + ii * aDelta; - gp_Pnt2d aP2d = aBAcurve2d.Value (aParam); - gp_Pnt aPnt (aP2d.X(), aP2d.Y(), 0.); - anArray (++anInd) = aPnt; + gp_Pnt2d aP2d = aBAcurve2d.Value(aParam); + gp_Pnt aPnt(aP2d.X(), aP2d.Y(), 0.); + anArray(++anInd) = aPnt; } } - + gp_Ax2 anAxis; Standard_Boolean anIsSingular; - GeomLib::AxeOfInertia (anArray, anAxis, anIsSingular); + GeomLib::AxeOfInertia(anArray, anAxis, anIsSingular); gp_Pnt aBaryCentre = anAxis.Location(); - gp_Pnt2d aCentre2d (aBaryCentre.X(), aBaryCentre.Y()); - BRepTopAdaptor_FClass2d aClassifier (theFace, Precision::Confusion()); - BRepAdaptor_Surface aBAsurf (theFace, Standard_False); - - TopAbs_State aStatus = aClassifier.Perform (aCentre2d); + gp_Pnt2d aCentre2d(aBaryCentre.X(), aBaryCentre.Y()); + BRepTopAdaptor_FClass2d aClassifier(theFace, Precision::Confusion()); + BRepAdaptor_Surface aBAsurf(theFace, Standard_False); + + TopAbs_State aStatus = aClassifier.Perform(aCentre2d); gp_Pnt2d aP2d = aCentre2d; Standard_Integer anIndVertex = 0; const Standard_Integer aNbIter = 10; - while (aStatus != TopAbs_IN && anIndVertex < aNbPointsOnContour) - { - gp_Pnt aVertexPnt = anArray (anIndVertex+1); - gp_Pnt2d aVertexP2d (aVertexPnt.X(), aVertexPnt.Y()); + while (aStatus != TopAbs_IN && anIndVertex < aNbPointsOnContour) { + gp_Pnt aVertexPnt = anArray(anIndVertex + 1); + gp_Pnt2d aVertexP2d(aVertexPnt.X(), aVertexPnt.Y()); TColgp_SequenceOfPnt2d aPseq; - aPseq.Append (aCentre2d); - aPseq.Append (aVertexP2d); - for (Standard_Integer ii = 1; ii <= aNbIter; ii++) - { - for (Standard_Integer jj = 1; jj < aPseq.Length(); jj++) - { - aP2d.SetXY ((aPseq(jj).XY() + aPseq(jj+1).XY())/2); - aStatus = aClassifier.Perform (aP2d); + aPseq.Append(aCentre2d); + aPseq.Append(aVertexP2d); + for (Standard_Integer ii = 1; ii <= aNbIter; ii++) { + for (Standard_Integer jj = 1; jj < aPseq.Length(); jj++) { + aP2d.SetXY((aPseq(jj).XY() + aPseq(jj + 1).XY()) / 2); + aStatus = aClassifier.Perform(aP2d); if (aStatus == TopAbs_IN) break; - else - { - aPseq.InsertAfter (jj, aP2d); + else { + aPseq.InsertAfter(jj, aP2d); jj++; } } @@ -1335,44 +1248,39 @@ gp_Pnt GetMidPnt2d(const TopoDS_Face& theFace, } anIndVertex += aNbSamples; } - aResPnt = aBAsurf.Value (aP2d.X(), aP2d.Y()); - } //case of complex boundaries + aResPnt = aBAsurf.Value(aP2d.X(), aP2d.Y()); + } // case of complex boundaries return aResPnt; } -void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, - const Standard_Real theAverageArea, - const Standard_Boolean theIsToAddFaces, - Standard_Integer& theNbExtremalFaces, - TopTools_MapOfShape& theExtremalFaces, - const std::vector> theFacesAndAreas, - const TopTools_DataMapOfShapeReal& theFaceAreaMap, - const TopTools_IndexedDataMapOfShapeListOfShape& theEFmap, - TopoDS_Shape& theRes, - TopoDS_Shape& theGlobalRes, - TopTools_MapOfShape& theRemovedFaces) -{ +void ModifyFacesForGlobalResult( + const TopoDS_Face &theInputFace, const Standard_Real theAverageArea, + const Standard_Boolean theIsToAddFaces, + Standard_Integer &theNbExtremalFaces, TopTools_MapOfShape &theExtremalFaces, + const std::vector> theFacesAndAreas, + const TopTools_DataMapOfShapeReal &theFaceAreaMap, + const TopTools_IndexedDataMapOfShapeListOfShape &theEFmap, + TopoDS_Shape &theRes, TopoDS_Shape &theGlobalRes, + TopTools_MapOfShape &theRemovedFaces) { BRep_Builder aBB; - const Standard_Integer aNbFaces = (Standard_Integer) theFacesAndAreas.size(); + const Standard_Integer aNbFaces = (Standard_Integer)theFacesAndAreas.size(); const Standard_Integer aDiff = theNbExtremalFaces - theRemovedFaces.Extent(); Standard_Integer aSum = 0; - while (aSum < aDiff) //global loop + while (aSum < aDiff) // global loop { Standard_Integer aNbFacesDone = 0, aNbFacesInTape = 0; TopoDS_Face aStartFace; - - Standard_Integer aStartIndex = (theIsToAddFaces)? aNbFaces-1 : 0; - Standard_Integer anEndIndex = (theIsToAddFaces)? 0 : aNbFaces-1; - Standard_Integer aStep = (theIsToAddFaces)? -1 : 1; - - for (Standard_Integer ii = aStartIndex; ii != anEndIndex; ii += aStep) - { - const TopoDS_Face& aFace = TopoDS::Face (theFacesAndAreas[ii].first); - if (!theRemovedFaces.Contains(aFace)) - { + + Standard_Integer aStartIndex = (theIsToAddFaces) ? aNbFaces - 1 : 0; + Standard_Integer anEndIndex = (theIsToAddFaces) ? 0 : aNbFaces - 1; + Standard_Integer aStep = (theIsToAddFaces) ? -1 : 1; + + for (Standard_Integer ii = aStartIndex; ii != anEndIndex; ii += aStep) { + const TopoDS_Face &aFace = TopoDS::Face(theFacesAndAreas[ii].first); + if (!theRemovedFaces.Contains(aFace)) { aStartFace = aFace; break; } @@ -1380,88 +1288,84 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, if (aStartFace.IsNull()) break; - theRemovedFaces.Add (aStartFace); - + theRemovedFaces.Add(aStartFace); + TopoDS_Edge aCommonEdge; TopoDS_Face aNextFace; - Standard_Real anExtremalArea = (theIsToAddFaces)? 0. : Precision::Infinite(); - for (TopExp_Explorer anExplo(aStartFace, TopAbs_EDGE); anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - const TopTools_ListOfShape& aFaceList = theEFmap.FindFromKey (anEdge); - TopTools_ListIteratorOfListOfShape anItl (aFaceList); - for (; anItl.More(); anItl.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (anItl.Value()); - if (aFace.IsSame (aStartFace) || - theRemovedFaces.Contains(aFace)) + Standard_Real anExtremalArea = + (theIsToAddFaces) ? 0. : Precision::Infinite(); + for (TopExp_Explorer anExplo(aStartFace, TopAbs_EDGE); anExplo.More(); + anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + const TopTools_ListOfShape &aFaceList = theEFmap.FindFromKey(anEdge); + TopTools_ListIteratorOfListOfShape anItl(aFaceList); + for (; anItl.More(); anItl.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(anItl.Value()); + if (aFace.IsSame(aStartFace) || theRemovedFaces.Contains(aFace)) continue; Standard_Real anArea = theFaceAreaMap(aFace); - Standard_Boolean anIsToExchange = (theIsToAddFaces)? (anArea > anExtremalArea) : (anArea < anExtremalArea); - if (anIsToExchange) - { + Standard_Boolean anIsToExchange = (theIsToAddFaces) + ? (anArea > anExtremalArea) + : (anArea < anExtremalArea); + if (anIsToExchange) { anExtremalArea = anArea; aCommonEdge = anEdge; aNextFace = aFace; } } } - if (aCommonEdge.IsNull()) //all adjacent faces are already removed + if (aCommonEdge.IsNull()) // all adjacent faces are already removed { - theExtremalFaces.Add (theFacesAndAreas[theNbExtremalFaces].first); + theExtremalFaces.Add(theFacesAndAreas[theNbExtremalFaces].first); theNbExtremalFaces++; continue; } - //Start filling the shell - aBB.Remove (theRes, aStartFace); + // Start filling the shell + aBB.Remove(theRes, aStartFace); aNbFacesDone++; TopoDS_Shell aShell; - aBB.MakeShell (aShell); + aBB.MakeShell(aShell); Standard_Real anAreaOfTape = 0.; - aBB.Add (aShell, aStartFace); + aBB.Add(aShell, aStartFace); aNbFacesInTape++; - anAreaOfTape += theFaceAreaMap (aStartFace); - - Standard_Boolean anIsUiso = IsUiso (aCommonEdge, aStartFace); - //Find another faces on this level + anAreaOfTape += theFaceAreaMap(aStartFace); + + Standard_Boolean anIsUiso = IsUiso(aCommonEdge, aStartFace); + // Find another faces on this level TopoDS_Face aCurrentFace = aNextFace; TopoDS_Edge aCurrentEdge = aCommonEdge; Standard_Boolean anIsFirstDirection = Standard_True; - aBB.Remove (theRes, aCurrentFace); - theRemovedFaces.Add (aCurrentFace); - if (theExtremalFaces.Contains (aCurrentFace)) - { + aBB.Remove(theRes, aCurrentFace); + theRemovedFaces.Add(aCurrentFace); + if (theExtremalFaces.Contains(aCurrentFace)) { aNbFacesDone++; } - aBB.Add (aShell, aCurrentFace); + aBB.Add(aShell, aCurrentFace); aNbFacesInTape++; - anAreaOfTape += theFaceAreaMap (aCurrentFace); + anAreaOfTape += theFaceAreaMap(aCurrentFace); Standard_Boolean anIsRound = Standard_False; - for (;;) //local loop + for (;;) // local loop { TopoDS_Edge aNextEdge; - for (TopExp_Explorer anExplo(aCurrentFace, TopAbs_EDGE); anExplo.More(); anExplo.Next()) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current()); - if (anEdge.IsSame (aCurrentEdge)) + for (TopExp_Explorer anExplo(aCurrentFace, TopAbs_EDGE); anExplo.More(); + anExplo.Next()) { + const TopoDS_Edge &anEdge = TopoDS::Edge(anExplo.Current()); + if (anEdge.IsSame(aCurrentEdge)) continue; - const TopTools_ListOfShape& aFaceList = theEFmap.FindFromKey (anEdge); - TopTools_ListIteratorOfListOfShape anItl (aFaceList); - for (; anItl.More(); anItl.Next()) - { - const TopoDS_Face& aFace = TopoDS::Face (anItl.Value()); - if (aFace.IsSame (aCurrentFace)) + const TopTools_ListOfShape &aFaceList = theEFmap.FindFromKey(anEdge); + TopTools_ListIteratorOfListOfShape anItl(aFaceList); + for (; anItl.More(); anItl.Next()) { + const TopoDS_Face &aFace = TopoDS::Face(anItl.Value()); + if (aFace.IsSame(aCurrentFace)) continue; - if (aFace.IsSame (aStartFace)) - { + if (aFace.IsSame(aStartFace)) { anIsRound = Standard_True; break; } if (theRemovedFaces.Contains(aFace)) continue; - if (anIsUiso == IsUiso (anEdge, aFace)) - { + if (anIsUiso == IsUiso(anEdge, aFace)) { aNextEdge = anEdge; aNextFace = aFace; break; @@ -1470,116 +1374,108 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, if (anIsRound || !aNextEdge.IsNull()) break; } - if (anIsRound) //round tape: returned to start face + if (anIsRound) // round tape: returned to start face break; - if (aNextEdge.IsNull()) - { - if (anIsFirstDirection) - { + if (aNextEdge.IsNull()) { + if (anIsFirstDirection) { aCurrentFace = aStartFace; aCurrentEdge = aCommonEdge; anIsFirstDirection = Standard_False; continue; - } - else + } else break; } - - aBB.Add (aShell, aNextFace); + + aBB.Add(aShell, aNextFace); aNbFacesInTape++; - anAreaOfTape += theFaceAreaMap (aNextFace); - aBB.Remove (theRes, aNextFace); - theRemovedFaces.Add (aNextFace); - if (theExtremalFaces.Contains (aNextFace)) - { + anAreaOfTape += theFaceAreaMap(aNextFace); + aBB.Remove(theRes, aNextFace); + theRemovedFaces.Add(aNextFace); + if (theExtremalFaces.Contains(aNextFace)) { aNbFacesDone++; } aCurrentEdge = aNextEdge; aNextEdge.Nullify(); aCurrentFace = aNextFace; - } //end of local loop - - //Tape is formed - Standard_Integer aNumberToSplit = (theIsToAddFaces)? aNbFacesInTape + aNbFacesDone : aNbFacesInTape - aNbFacesDone; - if (!theIsToAddFaces && aNbFacesDone > 1) - { - Standard_Integer aRealNumberToSplit = (aNumberToSplit > 0)? aNumberToSplit : 1; + } // end of local loop + + // Tape is formed + Standard_Integer aNumberToSplit = (theIsToAddFaces) + ? aNbFacesInTape + aNbFacesDone + : aNbFacesInTape - aNbFacesDone; + if (!theIsToAddFaces && aNbFacesDone > 1) { + Standard_Integer aRealNumberToSplit = + (aNumberToSplit > 0) ? aNumberToSplit : 1; Standard_Real anAverageAreaInTape = anAreaOfTape / aRealNumberToSplit; - if (anAverageAreaInTape > theAverageArea) - { - Standard_Integer aNewNumberToSplit = RealToInt(round(anAreaOfTape / theAverageArea)); - if (aNewNumberToSplit < aNbFacesInTape) - { - Standard_Integer aNumberToIncrease = aNewNumberToSplit - aNumberToSplit; - for (Standard_Integer jj = theNbExtremalFaces; jj < theNbExtremalFaces + aNumberToIncrease; jj++) - theExtremalFaces.Add (theFacesAndAreas[jj].first); + if (anAverageAreaInTape > theAverageArea) { + Standard_Integer aNewNumberToSplit = + RealToInt(round(anAreaOfTape / theAverageArea)); + if (aNewNumberToSplit < aNbFacesInTape) { + Standard_Integer aNumberToIncrease = + aNewNumberToSplit - aNumberToSplit; + for (Standard_Integer jj = theNbExtremalFaces; + jj < theNbExtremalFaces + aNumberToIncrease; jj++) + theExtremalFaces.Add(theFacesAndAreas[jj].first); theNbExtremalFaces += aNumberToIncrease; aNumberToSplit = aNewNumberToSplit; } } } - if (anIsRound && aNumberToSplit <= 1) - { + if (anIsRound && aNumberToSplit <= 1) { Standard_Integer aNumberToIncrease = 3 - aNumberToSplit; - for (Standard_Integer jj = theNbExtremalFaces; jj < theNbExtremalFaces + aNumberToIncrease; jj++) - theExtremalFaces.Add (theFacesAndAreas[jj].first); + for (Standard_Integer jj = theNbExtremalFaces; + jj < theNbExtremalFaces + aNumberToIncrease; jj++) + theExtremalFaces.Add(theFacesAndAreas[jj].first); theNbExtremalFaces += aNumberToIncrease; aNumberToSplit = 3; } - CorrectShell (aShell, theInputFace); + CorrectShell(aShell, theInputFace); ShapeUpgrade_UnifySameDomain aUnifier; - aUnifier.Initialize (aShell, Standard_True, Standard_True); + aUnifier.Initialize(aShell, Standard_True, Standard_True); aUnifier.Build(); TopoDS_Shape aUnifiedShape = aUnifier.Shape(); - //Splitting + // Splitting TopoDS_Shape aLocalResult = aUnifiedShape; Standard_Integer aNbFacesInLocalResult; - if (aNumberToSplit > 1) - { + if (aNumberToSplit > 1) { #if OCC_VERSION_LARGE < 0x07050304 aNbFacesInLocalResult = 0; #else - ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape); - aLocalTool.SetSplittingByNumber (Standard_True); + ShapeUpgrade_ShapeDivideArea aLocalTool(aUnifiedShape); + aLocalTool.SetSplittingByNumber(Standard_True); aLocalTool.MaxArea() = -1; if (anIsUiso) - aLocalTool.SetNumbersUVSplits (aNumberToSplit, 1); + aLocalTool.SetNumbersUVSplits(aNumberToSplit, 1); else - aLocalTool.SetNumbersUVSplits (1, aNumberToSplit); + aLocalTool.SetNumbersUVSplits(1, aNumberToSplit); aLocalTool.Perform(); aLocalResult = aLocalTool.Result(); aNbFacesInLocalResult = aNumberToSplit; #endif - } - else - { + } else { aNbFacesInLocalResult = 1; - if (aNumberToSplit == 0) - { - theExtremalFaces.Add (theFacesAndAreas[theNbExtremalFaces].first); + if (aNumberToSplit == 0) { + theExtremalFaces.Add(theFacesAndAreas[theNbExtremalFaces].first); theNbExtremalFaces++; } } - aBB.Add (theGlobalRes, aLocalResult); + aBB.Add(theGlobalRes, aLocalResult); aSum += Abs(aNbFacesInTape - aNbFacesInLocalResult); - } //end of global loop + } // end of global loop - //Second global loop + // Second global loop TopoDS_Compound aSecondComp; - aBB.MakeCompound (aSecondComp); - while (aSum < aDiff) - { + aBB.MakeCompound(aSecondComp); + while (aSum < aDiff) { TopoDS_Shape aMaxShell; Standard_Integer aMaxNbFaces = 0; - TopoDS_Iterator anIter (theGlobalRes); - for (; anIter.More(); anIter.Next()) - { - const TopoDS_Shape& aShell = anIter.Value(); + TopoDS_Iterator anIter(theGlobalRes); + for (; anIter.More(); anIter.Next()) { + const TopoDS_Shape &aShell = anIter.Value(); TopTools_IndexedMapOfShape aFaceMap; - TopExp::MapShapes (aShell, TopAbs_FACE, aFaceMap); - if (aFaceMap.Extent() > aMaxNbFaces) - { + TopExp::MapShapes(aShell, TopAbs_FACE, aFaceMap); + if (aFaceMap.Extent() > aMaxNbFaces) { aMaxNbFaces = aFaceMap.Extent(); aMaxShell = aShell; } @@ -1587,55 +1483,54 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace, if (aMaxNbFaces == 1) break; - - aBB.Remove (theGlobalRes, aMaxShell); - //Find iso + + aBB.Remove(theGlobalRes, aMaxShell); + // Find iso Standard_Boolean anIsUiso = Standard_True; TopTools_IndexedDataMapOfShapeListOfShape aLocalEFmap; - TopExp::MapShapesAndAncestors (aMaxShell, TopAbs_EDGE, TopAbs_FACE, aLocalEFmap); - for (Standard_Integer jj = 1; jj <= aLocalEFmap.Extent(); jj++) - { - const TopoDS_Edge& anEdge = TopoDS::Edge (aLocalEFmap.FindKey(jj)); - const TopTools_ListOfShape& aFaceList = aLocalEFmap(jj); - if (aFaceList.Extent() == 2) - { - const TopoDS_Face& aFace = TopoDS::Face (aFaceList.First()); - anIsUiso = IsUiso (anEdge, aFace); + TopExp::MapShapesAndAncestors(aMaxShell, TopAbs_EDGE, TopAbs_FACE, + aLocalEFmap); + for (Standard_Integer jj = 1; jj <= aLocalEFmap.Extent(); jj++) { + const TopoDS_Edge &anEdge = TopoDS::Edge(aLocalEFmap.FindKey(jj)); + const TopTools_ListOfShape &aFaceList = aLocalEFmap(jj); + if (aFaceList.Extent() == 2) { + const TopoDS_Face &aFace = TopoDS::Face(aFaceList.First()); + anIsUiso = IsUiso(anEdge, aFace); break; } } - CorrectShell (aMaxShell, theInputFace); + CorrectShell(aMaxShell, theInputFace); ShapeUpgrade_UnifySameDomain aUnifier; - aUnifier.Initialize (aMaxShell, Standard_True, Standard_True); + aUnifier.Initialize(aMaxShell, Standard_True, Standard_True); aUnifier.Build(); TopoDS_Shape aUnifiedShape = aUnifier.Shape(); TopoDS_Shape aLocalResult = aUnifiedShape; - - Standard_Integer aNumberToSplit = (theIsToAddFaces)? aMaxNbFaces + (aDiff-aSum) : aMaxNbFaces - (aDiff-aSum); - if (aNumberToSplit > 1) - { + + Standard_Integer aNumberToSplit = (theIsToAddFaces) + ? aMaxNbFaces + (aDiff - aSum) + : aMaxNbFaces - (aDiff - aSum); + if (aNumberToSplit > 1) { #if OCC_VERSION_LARGE < 0x07050304 aNumberToSplit = 1; #else - ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape); - aLocalTool.SetSplittingByNumber (Standard_True); + ShapeUpgrade_ShapeDivideArea aLocalTool(aUnifiedShape); + aLocalTool.SetSplittingByNumber(Standard_True); aLocalTool.MaxArea() = -1; if (anIsUiso) - aLocalTool.SetNumbersUVSplits (aNumberToSplit, 1); + aLocalTool.SetNumbersUVSplits(aNumberToSplit, 1); else - aLocalTool.SetNumbersUVSplits (1, aNumberToSplit); + aLocalTool.SetNumbersUVSplits(1, aNumberToSplit); aLocalTool.Perform(); aLocalResult = aLocalTool.Result(); #endif - } - else + } else aNumberToSplit = 1; - aBB.Add (aSecondComp, aLocalResult); - + aBB.Add(aSecondComp, aLocalResult); + if (theIsToAddFaces) break; aSum += aMaxNbFaces - aNumberToSplit; } - aBB.Add (theGlobalRes, aSecondComp); + aBB.Add(theGlobalRes, aSecondComp); } diff --git a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.hxx b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.hxx index 95deb81a1..bbe607fd9 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File : GEOMAlgo_AlgoTools.hxx // Created : @@ -28,11 +29,11 @@ #include +#include #include -#include #include -#include #include +#include #include #include @@ -41,173 +42,159 @@ #include +#include +#include #include #include -#include -#include -#include #include -#include #include +#include #include -#include #include - +#include //! Auxiliary tools for Algorithms
    //======================================================================= -//class : GEOMAlgo_AlgoTools -//purpose : +// class : GEOMAlgo_AlgoTools +// purpose : //======================================================================= -class GEOMAlgo_AlgoTools { - public: - +class GEOMAlgo_AlgoTools { +public: GEOMALGOIMPL_EXPORT - static void FaceNormal(const TopoDS_Face& aF, - const Standard_Real U, - const Standard_Real V, - gp_Vec& aN); + static void FaceNormal(const TopoDS_Face &aF, const Standard_Real U, + const Standard_Real V, gp_Vec &aN); //! Computes a point inside the face .
    //! - 2D representation of
    //! on the surface of
    //! Returns 0 in case of success.
    GEOMALGOIMPL_EXPORT - static Standard_Integer PntInFace(const TopoDS_Face& theF, - gp_Pnt& theP, - gp_Pnt2d& theP2D); + static Standard_Integer PntInFace(const TopoDS_Face &theF, gp_Pnt &theP, + gp_Pnt2d &theP2D); //! Computes a set of points inside the face .
    //! Returns 0 in case of success.
    GEOMALGOIMPL_EXPORT - static Standard_Integer PointCloudInFace(const TopoDS_Face& theF, - const int theNbPnts, - TopoDS_Compound& theCompound); + static Standard_Integer PointCloudInFace(const TopoDS_Face &theF, + const int theNbPnts, + TopoDS_Compound &theCompound); GEOMALGOIMPL_EXPORT - static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS); - + static Standard_Boolean IsCompositeShape(const TopoDS_Shape &aS); GEOMALGOIMPL_EXPORT - static Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS); + static Standard_Boolean BuildTriangulation(const TopoDS_Shape &aS); GEOMALGOIMPL_EXPORT - static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD, - const Standard_Real aTol, - const Handle(IntTools_Context)& aCtx); + static Standard_Integer + RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape &aMSD, + const Standard_Real aTol, + const Handle(IntTools_Context) & aCtx); GEOMALGOIMPL_EXPORT - static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE, - const Standard_Real aTol, - TopTools_IndexedDataMapOfShapeListOfShape& aMEE, - const Handle(IntTools_Context)& aCtx); + static Standard_Integer + FindSDShapes(const TopTools_ListOfShape &aLE, const Standard_Real aTol, + TopTools_IndexedDataMapOfShapeListOfShape &aMEE, + const Handle(IntTools_Context) & aCtx); GEOMALGOIMPL_EXPORT - static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1, - const TopTools_ListOfShape& aLE, - const Standard_Real aTol, - TopTools_ListOfShape& aLESD, - const Handle(IntTools_Context)& aCtx); + static Standard_Integer FindSDShapes(const TopoDS_Shape &aE1, + const TopTools_ListOfShape &aLE, + const Standard_Real aTol, + TopTools_ListOfShape &aLESD, + const Handle(IntTools_Context) & aCtx); GEOMALGOIMPL_EXPORT - static void PointOnShape(const TopoDS_Shape& aS, - gp_Pnt& aP3D); + static void PointOnShape(const TopoDS_Shape &aS, gp_Pnt &aP3D); GEOMALGOIMPL_EXPORT - static void PointOnEdge(const TopoDS_Edge& aE, - gp_Pnt& aP3D); + static void PointOnEdge(const TopoDS_Edge &aE, gp_Pnt &aP3D); GEOMALGOIMPL_EXPORT - static void PointOnEdge(const TopoDS_Edge& aE, - const Standard_Real aT,gp_Pnt& aP3D); + static void PointOnEdge(const TopoDS_Edge &aE, const Standard_Real aT, + gp_Pnt &aP3D); GEOMALGOIMPL_EXPORT - static void PointOnFace(const TopoDS_Face& aF, - gp_Pnt& aP3D); + static void PointOnFace(const TopoDS_Face &aF, gp_Pnt &aP3D); GEOMALGOIMPL_EXPORT - static void PointOnFace(const TopoDS_Face& aF, - const Standard_Real aU, - const Standard_Real aV, - gp_Pnt& aP3D); + static void PointOnFace(const TopoDS_Face &aF, const Standard_Real aU, + const Standard_Real aV, gp_Pnt &aP3D); GEOMALGOIMPL_EXPORT - static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1, - const TopoDS_Shape& aS, - gp_Pnt& aP2, - const Handle(IntTools_Context)& aCtx); + static Standard_Boolean + ProjectPointOnShape(const gp_Pnt &aP1, const TopoDS_Shape &aS, gp_Pnt &aP2, + const Handle(IntTools_Context) & aCtx); GEOMALGOIMPL_EXPORT - static void CorrectTolerances(const TopoDS_Shape& aShape, - const Standard_Real aMaxTol=0.0001); + static void CorrectTolerances(const TopoDS_Shape &aShape, + const Standard_Real aMaxTol = 0.0001); GEOMALGOIMPL_EXPORT - static void CorrectPointOnCurve(const TopoDS_Shape& S, - const Standard_Real aMaxTol=0.0001); + static void CorrectPointOnCurve(const TopoDS_Shape &S, + const Standard_Real aMaxTol = 0.0001); GEOMALGOIMPL_EXPORT - static void CorrectCurveOnSurface(const TopoDS_Shape& S, - const Standard_Real aMaxTol=0.0001); - + static void CorrectCurveOnSurface(const TopoDS_Shape &S, + const Standard_Real aMaxTol = 0.0001); GEOMALGOIMPL_EXPORT - static Standard_Boolean IsSplitToReverse1(const TopoDS_Edge& aEF1, - const TopoDS_Edge& aEF2, - const Handle(IntTools_Context)& aCtx); + static Standard_Boolean + IsSplitToReverse1(const TopoDS_Edge &aEF1, const TopoDS_Edge &aEF2, + const Handle(IntTools_Context) & aCtx); GEOMALGOIMPL_EXPORT - static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aUMin, - const Standard_Real aUMax); + static void RefinePCurveForEdgeOnFace(const TopoDS_Edge &aE, + const TopoDS_Face &aF, + const Standard_Real aUMin, + const Standard_Real aUMax); GEOMALGOIMPL_EXPORT - static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS); - + static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) & aS); + GEOMALGOIMPL_EXPORT - static void MakeContainer(const TopAbs_ShapeEnum theType, - TopoDS_Shape& theC); + static void MakeContainer(const TopAbs_ShapeEnum theType, TopoDS_Shape &theC); GEOMALGOIMPL_EXPORT - static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit, - const TopoDS_Edge& theEdge, - const Handle(IntTools_Context)& theCtx); - + static Standard_Boolean + IsSplitToReverse(const TopoDS_Edge &theSplit, const TopoDS_Edge &theEdge, + const Handle(IntTools_Context) & theCtx); + GEOMALGOIMPL_EXPORT - static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theFSp, - const TopoDS_Face& theFSr, - const Handle(IntTools_Context)& theCtx); - + static Standard_Boolean + IsSplitToReverse(const TopoDS_Face &theFSp, const TopoDS_Face &theFSr, + const Handle(IntTools_Context) & theCtx); + GEOMALGOIMPL_EXPORT - static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSp, - const TopoDS_Shape& theSr, - const Handle(IntTools_Context)& theCtx); + static Standard_Boolean + IsSplitToReverse(const TopoDS_Shape &theSp, const TopoDS_Shape &theSr, + const Handle(IntTools_Context) & theCtx); GEOMALGOIMPL_EXPORT - static Standard_Integer BuildPCurveForEdgeOnFace(const TopoDS_Edge& aEold, - const TopoDS_Edge& aEnew, - const TopoDS_Face& aF, - const Handle(IntTools_Context)& aCtx); + static Standard_Integer + BuildPCurveForEdgeOnFace(const TopoDS_Edge &aEold, const TopoDS_Edge &aEnew, + const TopoDS_Face &aF, + const Handle(IntTools_Context) & aCtx); -// + // GEOMALGOIMPL_EXPORT - static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS, - GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains); + static void + FindChains(const GEOMAlgo_ListOfCoupleOfShapes &aLCS, + GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMapChains); GEOMALGOIMPL_EXPORT - static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains); + static void + FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMCV, + GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMapChains); GEOMALGOIMPL_EXPORT - static void CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC); - + static void CopyShape(const TopoDS_Shape &aS, TopoDS_Shape &aSC); + GEOMALGOIMPL_EXPORT - static void CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC, - TopTools_IndexedDataMapOfShapeShape& aMSS); + static void CopyShape(const TopoDS_Shape &aS, TopoDS_Shape &aSC, + TopTools_IndexedDataMapOfShapeShape &aMSS); }; #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools_1.cxx b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools_1.cxx index c95cc8034..e377f6d5b 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools_1.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools_1.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File : GEOMAlgo_AlgoTools_2.cxx // Created : @@ -25,45 +26,41 @@ #include -#include +#include #include +#include #include -#include #include -#include - - -static - void ProcessBlock(const TopoDS_Shape& aF, - const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - TopTools_IndexedMapOfShape& aProcessed, - TopTools_IndexedMapOfShape& aChain); +static void +ProcessBlock(const TopoDS_Shape &aF, + const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMCV, + TopTools_IndexedMapOfShape &aProcessed, + TopTools_IndexedMapOfShape &aChain); //======================================================================= // function: FindChains // purpose : //======================================================================= -void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS, - GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) -{ +void GEOMAlgo_AlgoTools::FindChains( + const GEOMAlgo_ListOfCoupleOfShapes &aLCS, + GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMapChains) { GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMCV; // aItCS.Initialize(aLCS); for (; aItCS.More(); aItCS.Next()) { - const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value(); + const GEOMAlgo_CoupleOfShapes &aCS = aItCS.Value(); // - const TopoDS_Shape& aF1=aCS.Shape1(); - const TopoDS_Shape& aF2=aCS.Shape2(); + const TopoDS_Shape &aF1 = aCS.Shape1(); + const TopoDS_Shape &aF2 = aCS.Shape2(); // // if (aMCV.Contains(aF1)) { - TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1); + TopTools_IndexedMapOfShape &aMV = aMCV.ChangeFromKey(aF1); aMV.Add(aF1); aMV.Add(aF2); - } - else { + } else { TopTools_IndexedMapOfShape aMV; aMV.Add(aF1); aMV.Add(aF2); @@ -71,11 +68,10 @@ void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS, } // if (aMCV.Contains(aF2)) { - TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2); + TopTools_IndexedMapOfShape &aMV = aMCV.ChangeFromKey(aF2); aMV.Add(aF1); aMV.Add(aF2); - } - else { + } else { TopTools_IndexedMapOfShape aMV; aMV.Add(aF1); aMV.Add(aF2); @@ -88,15 +84,15 @@ void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS, // function: FindChains // purpose : //======================================================================= -void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) -{ - Standard_Integer i, j, aNbCV, aNbV; +void GEOMAlgo_AlgoTools::FindChains( + const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMCV, + GEOMAlgo_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); + aNbCV = aMCV.Extent(); + for (i = 1; i <= aNbCV; ++i) { + const TopoDS_Shape &aF = aMCV.FindKey(i); if (aProcessed.Contains(aF)) { continue; } @@ -104,10 +100,10 @@ void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedM 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); + 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); @@ -118,11 +114,10 @@ void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedM // function: ProcessBlock // purpose: //======================================================================= -void ProcessBlock(const TopoDS_Shape& aF, - const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - TopTools_IndexedMapOfShape& aProcessed, - TopTools_IndexedMapOfShape& aChain) -{ +void ProcessBlock(const TopoDS_Shape &aF, + const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape &aMCV, + TopTools_IndexedMapOfShape &aProcessed, + TopTools_IndexedMapOfShape &aChain) { Standard_Integer j, aNbV; // if (aProcessed.Contains(aF)) { @@ -131,11 +126,10 @@ void ProcessBlock(const TopoDS_Shape& aF, 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); + 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/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx index 42478764c..6d4d0ff52 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx @@ -14,44 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_BndSphere.cxx -// Created: +// Created: // Author: Peter KURNEV // // #include //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= - GEOMAlgo_BndSphere::GEOMAlgo_BndSphere() -{ +GEOMAlgo_BndSphere::GEOMAlgo_BndSphere() { myCenter.SetCoord(0., 0., 0.); - myRadius=0.; - myGap=0.; + myRadius = 0.; + myGap = 0.; } //======================================================================= -//function : ~ -//purpose : +// function : ~ +// purpose : //======================================================================= - GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere() -{ -} +GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere() {} //======================================================================= -//function : IsOut -//purpose : +// function : IsOut +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BndSphere::IsOut(const GEOMAlgo_BndSphere& theOther)const -{ +Standard_Boolean +GEOMAlgo_BndSphere::IsOut(const GEOMAlgo_BndSphere &theOther) const { Standard_Real aD2, aT2; // - aD2=myCenter.SquareDistance(theOther.myCenter); - aT2=myRadius+myGap+theOther.myRadius+theOther.myGap; - aT2=aT2*aT2; + aD2 = myCenter.SquareDistance(theOther.myCenter); + aT2 = myRadius + myGap + theOther.myRadius + theOther.myGap; + aT2 = aT2 * aT2; // - return aD2>aT2; + return aD2 > aT2; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.hxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.hxx index 7fb6c5a98..2b868b01a 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.hxx @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_BndSphere.hxx -// Created: +// Created: // Author: Peter KURNEV // @@ -28,44 +29,43 @@ #include #include +#include #include -#include #include -#include - +#include //======================================================================= -//class : GEOMAlgo_BndSphere -//purpose : +// class : GEOMAlgo_BndSphere +// purpose : //======================================================================= -class GEOMAlgo_BndSphere { - public: - GEOMALGOIMPL_EXPORT - GEOMAlgo_BndSphere(); - - GEOMALGOIMPL_EXPORT - virtual ~GEOMAlgo_BndSphere(); - - void SetCenter(const gp_Pnt& theP); - - const gp_Pnt& Center() const; - +class GEOMAlgo_BndSphere { +public: + GEOMALGOIMPL_EXPORT + GEOMAlgo_BndSphere(); + + GEOMALGOIMPL_EXPORT + virtual ~GEOMAlgo_BndSphere(); + + void SetCenter(const gp_Pnt &theP); + + const gp_Pnt &Center() const; + void SetRadius(const Standard_Real theR); - + Standard_Real Radius() const; - + void SetGap(const Standard_Real theGap); - + Standard_Real Gap() const; - - void Add(const GEOMAlgo_BndSphere& theOther); - - GEOMALGOIMPL_EXPORT - Standard_Boolean IsOut(const GEOMAlgo_BndSphere& theOther) const; - + + void Add(const GEOMAlgo_BndSphere &theOther); + + GEOMALGOIMPL_EXPORT + Standard_Boolean IsOut(const GEOMAlgo_BndSphere &theOther) const; + Standard_Real SquareExtent() const; - protected: +protected: gp_Pnt myCenter; Standard_Real myRadius; Standard_Real myGap; diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.lxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.lxx index d39e06c38..980188ae4 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.lxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.lxx @@ -18,12 +18,12 @@ // // File: GEOMAlgo_BndSphere.lxx -// Created: +// Created: // Author: Peter KURNEV // //======================================================================= //function : SetCenter -//purpose : +//purpose : //======================================================================= inline void GEOMAlgo_BndSphere::SetCenter(const gp_Pnt& theP) // @@ -32,7 +32,7 @@ } //======================================================================= //function : Center -//purpose : +//purpose : //======================================================================= inline const gp_Pnt& GEOMAlgo_BndSphere::Center()const { @@ -40,7 +40,7 @@ } //======================================================================= //function : SetRadius -//purpose : +//purpose : //======================================================================= inline void GEOMAlgo_BndSphere::SetRadius(const Standard_Real theR) { @@ -48,7 +48,7 @@ } //======================================================================= //function : Radius -//purpose : +//purpose : //======================================================================= inline Standard_Real GEOMAlgo_BndSphere::Radius()const { @@ -56,7 +56,7 @@ } //======================================================================= //function : SetGap -//purpose : +//purpose : //======================================================================= inline void GEOMAlgo_BndSphere::SetGap(const Standard_Real theGap) { @@ -64,7 +64,7 @@ } //======================================================================= //function : Gap -//purpose : +//purpose : //======================================================================= inline Standard_Real GEOMAlgo_BndSphere::Gap()const { @@ -72,7 +72,7 @@ } //======================================================================= //function : Add -//purpose : +//purpose : //======================================================================= inline void GEOMAlgo_BndSphere::Add(const GEOMAlgo_BndSphere& theOther) { @@ -94,7 +94,7 @@ } //======================================================================= //function : SquareExtent -//purpose : +//purpose : //======================================================================= inline Standard_Real GEOMAlgo_BndSphere::SquareExtent()const { diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx index b7f0d3731..9a78c40dc 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx @@ -14,76 +14,70 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_BndSphereTree.cxx -// Created: +// Created: // Author: Peter KURNEV // // #include //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= - GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector() -{ -} +GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector() {} //======================================================================= -//function : ~ -//purpose : +// function : ~ +// purpose : //======================================================================= - GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector() -{ -} +GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector() {} //======================================================================= -//function : Reject -//purpose : +// function : Reject +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Reject (const GEOMAlgo_BndSphere& aBox) const -{ +Standard_Boolean +GEOMAlgo_BndSphereTreeSelector::Reject(const GEOMAlgo_BndSphere &aBox) const { Standard_Boolean bRet; // - bRet=myBox.IsOut(aBox); + bRet = myBox.IsOut(aBox); return bRet; } //======================================================================= -//function : Accept -//purpose : +// function : Accept +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex) -{ - Standard_Boolean bRet=Standard_False; +Standard_Boolean +GEOMAlgo_BndSphereTreeSelector::Accept(const Standard_Integer &aIndex) { + Standard_Boolean bRet = Standard_False; // if (myFence.Add(aIndex)) { myIndices.Append(aIndex); - bRet=!bRet; + bRet = !bRet; } return bRet; } //======================================================================= -//function : SetBox -//purpose : +// function : SetBox +// purpose : //======================================================================= - void GEOMAlgo_BndSphereTreeSelector::SetBox(const GEOMAlgo_BndSphere& aBox) -{ - myBox=aBox; +void GEOMAlgo_BndSphereTreeSelector::SetBox(const GEOMAlgo_BndSphere &aBox) { + myBox = aBox; } //======================================================================= -//function : Clear -//purpose : +// function : Clear +// purpose : //======================================================================= - void GEOMAlgo_BndSphereTreeSelector::Clear() -{ +void GEOMAlgo_BndSphereTreeSelector::Clear() { myFence.Clear(); myIndices.Clear(); } //======================================================================= -//function : Indices -//purpose : +// function : Indices +// purpose : //======================================================================= - const TColStd_ListOfInteger& GEOMAlgo_BndSphereTreeSelector::Indices() const -{ +const TColStd_ListOfInteger &GEOMAlgo_BndSphereTreeSelector::Indices() const { return myIndices; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx index 8d5b91fee..40720fa82 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_BndSphereTree.hxx -// Created: +// Created: // Author: Peter KURNEV // // @@ -27,29 +28,29 @@ #include -#include #include -#include +#include #include +#include +typedef NCollection_UBTree + GEOMAlgo_BndSphereTree; -typedef NCollection_UBTree GEOMAlgo_BndSphereTree; - -class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector -{ +class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector { public: GEOMALGOIMPL_EXPORT GEOMAlgo_BndSphereTreeSelector(); - GEOMALGOIMPL_EXPORT virtual Standard_Boolean Reject(const GEOMAlgo_BndSphere&) const; + GEOMALGOIMPL_EXPORT virtual Standard_Boolean + Reject(const GEOMAlgo_BndSphere &) const; GEOMALGOIMPL_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &); GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_BndSphereTreeSelector(); - + GEOMALGOIMPL_EXPORT void Clear(); - GEOMALGOIMPL_EXPORT void SetBox(const GEOMAlgo_BndSphere&); - GEOMALGOIMPL_EXPORT const TColStd_ListOfInteger& Indices() const; + GEOMALGOIMPL_EXPORT void SetBox(const GEOMAlgo_BndSphere &); + GEOMALGOIMPL_EXPORT const TColStd_ListOfInteger &Indices() const; protected: - GEOMAlgo_BndSphere myBox; - TColStd_MapOfInteger myFence; + GEOMAlgo_BndSphere myBox; + TColStd_MapOfInteger myFence; TColStd_ListOfInteger myIndices; }; diff --git a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx index e244ac9b2..afbef96c9 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_BuilderShape.cxx @@ -27,104 +28,91 @@ #include //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= - GEOMAlgo_BuilderShape::GEOMAlgo_BuilderShape() -: - GEOMAlgo_Algo() -{ - myHasDeleted=Standard_False; - myHasGenerated=Standard_False; - myHasModified=Standard_False; +GEOMAlgo_BuilderShape::GEOMAlgo_BuilderShape() : GEOMAlgo_Algo() { + myHasDeleted = Standard_False; + myHasGenerated = Standard_False; + myHasModified = Standard_False; } //======================================================================= -//function : ~ -//purpose : +// function : ~ +// purpose : //======================================================================= - GEOMAlgo_BuilderShape::~GEOMAlgo_BuilderShape() -{ -} +GEOMAlgo_BuilderShape::~GEOMAlgo_BuilderShape() {} //======================================================================= -//function : Shape -//purpose : +// function : Shape +// purpose : //======================================================================= - const TopoDS_Shape& GEOMAlgo_BuilderShape::Shape() const -{ - return myShape; -} +const TopoDS_Shape &GEOMAlgo_BuilderShape::Shape() const { return myShape; } // //======================================================================= -//function : Generated -//purpose : +// function : Generated +// purpose : //======================================================================= - const TopTools_ListOfShape& GEOMAlgo_BuilderShape::Generated(const TopoDS_Shape& ) -{ +const TopTools_ListOfShape & +GEOMAlgo_BuilderShape::Generated(const TopoDS_Shape &) { myHistShapes.Clear(); return myHistShapes; } //======================================================================= -//function : Modified -//purpose : +// function : Modified +// purpose : //======================================================================= - const TopTools_ListOfShape& GEOMAlgo_BuilderShape::Modified(const TopoDS_Shape& ) -{ +const TopTools_ListOfShape & +GEOMAlgo_BuilderShape::Modified(const TopoDS_Shape &) { myHistShapes.Clear(); return myHistShapes; } //======================================================================= -//function : IsDeleted -//purpose : +// function : IsDeleted +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BuilderShape::IsDeleted(const TopoDS_Shape& theS) -{ +Standard_Boolean GEOMAlgo_BuilderShape::IsDeleted(const TopoDS_Shape &theS) { Standard_Boolean bRet; // - bRet=!myMapShape.Contains(theS); + bRet = !myMapShape.Contains(theS); return bRet; } //======================================================================= -//function : HasDeleted -//purpose : +// function : HasDeleted +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BuilderShape::HasDeleted()const -{ +Standard_Boolean GEOMAlgo_BuilderShape::HasDeleted() const { return myHasDeleted; } //======================================================================= -//function : HasGenerated -//purpose : +// function : HasGenerated +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BuilderShape::HasGenerated()const -{ +Standard_Boolean GEOMAlgo_BuilderShape::HasGenerated() const { return myHasGenerated; } //======================================================================= -//function : HasModified -//purpose : +// function : HasModified +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_BuilderShape::HasModified()const -{ +Standard_Boolean GEOMAlgo_BuilderShape::HasModified() const { return myHasModified; } //======================================================================= -//function : PrepareHistory -//purpose : +// function : PrepareHistory +// purpose : //======================================================================= - void GEOMAlgo_BuilderShape::PrepareHistory() -{ +void GEOMAlgo_BuilderShape::PrepareHistory() { myHistShapes.Clear(); myMapShape.Clear(); - myHasDeleted=Standard_False; - myHasGenerated=Standard_False; - myHasModified=Standard_False; + myHasDeleted = Standard_False; + myHasGenerated = Standard_False; + myHasModified = Standard_False; myImagesResult.Clear(); } //======================================================================= -//function : ImagesResult -//purpose : +// function : ImagesResult +// purpose : //======================================================================= - const TopTools_IndexedDataMapOfShapeListOfShape& GEOMAlgo_BuilderShape::ImagesResult()const -{ +const TopTools_IndexedDataMapOfShapeListOfShape & +GEOMAlgo_BuilderShape::ImagesResult() const { return myImagesResult; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx index 0aaa90fcf..988dbc4c0 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_BuilderShape.hxx @@ -30,81 +31,78 @@ #include #include -#include #include +#include #include +#include #include #include -#include #include - //! Root class for algorithms that has shape as result
    //======================================================================= -//class : GEOMAlgo_BuilderShape -//purpose : +// class : GEOMAlgo_BuilderShape +// purpose : //======================================================================= -class GEOMAlgo_BuilderShape : public GEOMAlgo_Algo -{ - public: +class GEOMAlgo_BuilderShape : public GEOMAlgo_Algo { +public: //! Returns the result of algorithm
    GEOMALGOIMPL_EXPORT - const TopoDS_Shape& Shape() const; + const TopoDS_Shape &Shape() const; //! Returns the list of shapes generated from the
    //! shape theS.
    GEOMALGOIMPL_EXPORT - virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; + virtual const TopTools_ListOfShape &Generated(const TopoDS_Shape &theS); //! Returns the list of shapes modified from the
    //! shape theS.
    GEOMALGOIMPL_EXPORT - virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; + virtual const TopTools_ListOfShape &Modified(const TopoDS_Shape &theS); //! Returns true if the shape theS has been deleted.
    GEOMALGOIMPL_EXPORT - virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; + virtual Standard_Boolean IsDeleted(const TopoDS_Shape &theS); //! Returns true if the at least one shape(or sub-shape)
    //! of arguments has been deleted.
    GEOMALGOIMPL_EXPORT - Standard_Boolean HasDeleted() const; + Standard_Boolean HasDeleted() const; //! Returns true if the at least one shape(or sub-shape)
    //! of arguments has generated shapes.
    GEOMALGOIMPL_EXPORT - Standard_Boolean HasGenerated() const; + Standard_Boolean HasGenerated() const; //! Returns true if the at least one shape(or sub-shape)
    //! of arguments has modified shapes.
    GEOMALGOIMPL_EXPORT - Standard_Boolean HasModified() const; + Standard_Boolean HasModified() const; GEOMALGOIMPL_EXPORT - const TopTools_IndexedDataMapOfShapeListOfShape& ImagesResult() const; + const TopTools_IndexedDataMapOfShapeListOfShape &ImagesResult() const; protected: //! Empty constructor
    GEOMALGOIMPL_EXPORT - GEOMAlgo_BuilderShape(); + GEOMAlgo_BuilderShape(); GEOMALGOIMPL_EXPORT - virtual ~GEOMAlgo_BuilderShape(); + virtual ~GEOMAlgo_BuilderShape(); //! Prepare information for history support
    GEOMALGOIMPL_EXPORT - virtual void PrepareHistory() ; - + virtual void PrepareHistory(); - TopoDS_Shape myShape; + TopoDS_Shape myShape; TopTools_ListOfShape myHistShapes; - TopTools_MapOfShape myMapShape; - Standard_Boolean myHasDeleted; - Standard_Boolean myHasGenerated; - Standard_Boolean myHasModified; + TopTools_MapOfShape myMapShape; + Standard_Boolean myHasDeleted; + Standard_Boolean myHasGenerated; + Standard_Boolean myHasModified; TopTools_IndexedDataMapOfShapeListOfShape myImagesResult; }; diff --git a/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx b/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx index 3674128ad..32072dcaa 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_CoupleOfShapes.cxx // Created: Wed Dec 15 13:03:52 2004 @@ -26,60 +27,49 @@ // #include //======================================================================= -//function : GEOMAlgo_CoupleOfShapes -//purpose : +// function : GEOMAlgo_CoupleOfShapes +// purpose : //======================================================================= -GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() -{} +GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() {} //======================================================================= -//function : SetShapes -//purpose : +// function : SetShapes +// purpose : //======================================================================= -void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) -{ - myShape1=aS1; - myShape2=aS2; +void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape &aS1, + const TopoDS_Shape &aS2) { + myShape1 = aS1; + myShape2 = aS2; } //======================================================================= -//function : Shapes -//purpose : +// function : Shapes +// purpose : //======================================================================= -void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape& aS1, - TopoDS_Shape& aS2)const -{ - aS1=myShape1; - aS2=myShape2; +void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape &aS1, + TopoDS_Shape &aS2) const { + aS1 = myShape1; + aS2 = myShape2; } //======================================================================= -//function : SetShape1 -//purpose : +// function : SetShape1 +// purpose : //======================================================================= -void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1) -{ - myShape1=aS1; +void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape &aS1) { + myShape1 = aS1; } //======================================================================= -//function : SetShape2 -//purpose : +// function : SetShape2 +// purpose : //======================================================================= -void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2) -{ - myShape2=aS2; +void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape &aS2) { + myShape2 = aS2; } //======================================================================= -//function : Shape1 -//purpose : +// function : Shape1 +// purpose : //======================================================================= -const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const -{ - return myShape1; -} +const TopoDS_Shape &GEOMAlgo_CoupleOfShapes::Shape1() const { return myShape1; } //======================================================================= -//function : Shape2 -//purpose : +// function : Shape2 +// purpose : //======================================================================= -const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape2()const -{ - return myShape2; -} +const TopoDS_Shape &GEOMAlgo_CoupleOfShapes::Shape2() const { return myShape2; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.hxx b/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.hxx index 500963a4a..439a0ddfe 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_CoupleOfShapes.hxx // Created: Wed Dec 15 13:03:52 2004 @@ -31,34 +32,32 @@ #include #include - //======================================================================= -//class : GEOMAlgo_CoupleOfShapes -//purpose : +// class : GEOMAlgo_CoupleOfShapes +// purpose : //======================================================================= -class GEOMAlgo_CoupleOfShapes -{ - public: +class GEOMAlgo_CoupleOfShapes { +public: GEOMALGOIMPL_EXPORT - GEOMAlgo_CoupleOfShapes(); + GEOMAlgo_CoupleOfShapes(); GEOMALGOIMPL_EXPORT - void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; + void SetShapes(const TopoDS_Shape &aS1, const TopoDS_Shape &aS2); GEOMALGOIMPL_EXPORT - void SetShape1(const TopoDS_Shape& aS1) ; + void SetShape1(const TopoDS_Shape &aS1); GEOMALGOIMPL_EXPORT - void SetShape2(const TopoDS_Shape& aS2) ; + void SetShape2(const TopoDS_Shape &aS2); GEOMALGOIMPL_EXPORT - void Shapes(TopoDS_Shape& aS1,TopoDS_Shape& aS2) const; + void Shapes(TopoDS_Shape &aS1, TopoDS_Shape &aS2) const; GEOMALGOIMPL_EXPORT - const TopoDS_Shape& Shape1() const; + const TopoDS_Shape &Shape1() const; GEOMALGOIMPL_EXPORT - const TopoDS_Shape& Shape2() const; + const TopoDS_Shape &Shape2() const; protected: TopoDS_Shape myShape1; diff --git a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx index 042fef75f..0d48f6c44 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_GlueDetector.cxx @@ -28,88 +29,79 @@ #include #include -#include #include +#include #include -#include -#include -#include #include -#include +#include +#include #include -#include +#include +#include +#include #include -#include #include -#include -#include +#include #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_Integer CheckAncesstors(const TopoDS_Shape& aVSD, - const TopTools_MapOfShape& aMVSD, - const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, - const TopTools_IndexedDataMapOfShapeListOfShape& aMEV, - TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ); - +static Standard_Integer +CheckAncesstors(const TopoDS_Shape &aVSD, const TopTools_MapOfShape &aMVSD, + const TopTools_IndexedDataMapOfShapeListOfShape &aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape &aMEV, + TopTools_IndexedDataMapOfShapeListOfShape &aMEVZ); //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector() -: - GEOMAlgo_GluerAlgo(), - GEOMAlgo_Algo() -{} + : GEOMAlgo_GluerAlgo(), GEOMAlgo_Algo() {} //======================================================================= -//function : ~ -//purpose : +// function : ~ +// purpose : //======================================================================= -GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() -{} +GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() {} //======================================================================= -//function : StickedShapes -//purpose : +// function : StickedShapes +// purpose : //======================================================================= -const TopTools_IndexedDataMapOfShapeListOfShape& - GEOMAlgo_GlueDetector::StickedShapes() -{ +const TopTools_IndexedDataMapOfShapeListOfShape & +GEOMAlgo_GlueDetector::StickedShapes() { return myStickedShapes; } //======================================================================= -//function : Perform -//purpose : +// function : Perform +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::Perform() -{ - myErrorStatus=0; - myWarningStatus=0; +void GEOMAlgo_GlueDetector::Perform() { + myErrorStatus = 0; + myWarningStatus = 0; myStickedShapes.Clear(); // CheckData(); @@ -142,11 +134,10 @@ void GEOMAlgo_GlueDetector::Perform() } //======================================================================= -//function : DetectVertices -//purpose : +// function : DetectVertices +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::DetectVertices() -{ +void GEOMAlgo_GlueDetector::DetectVertices() { Standard_Integer j, i, aNbV, aNbVSD; Standard_Real aTolV; gp_Pnt aPV; @@ -161,23 +152,24 @@ void GEOMAlgo_GlueDetector::DetectVertices() GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB; GEOMAlgo_BndSphereTreeSelector aSelector; GEOMAlgo_BndSphereTree aBBTree; - NCollection_UBTreeFiller aTreeFiller(aBBTree); + NCollection_UBTreeFiller aTreeFiller( + aBBTree); // - myErrorStatus=0; + myErrorStatus = 0; // TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV); - aNbV=aMV.Extent(); + aNbV = aMV.Extent(); if (!aNbV) { - myErrorStatus=2; // no vertices in source shape + myErrorStatus = 2; // no vertices in source shape return; } // - for (i=1; i<=aNbV; ++i) { + for (i = 1; i <= aNbV; ++i) { GEOMAlgo_BndSphere aBox; // - const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i)); - aPV=BRep_Tool::Pnt(aV); - aTolV=BRep_Tool::Tolerance(aV); + const TopoDS_Vertex &aV = *((TopoDS_Vertex *)&aMV(i)); + aPV = BRep_Tool::Pnt(aV); + aTolV = BRep_Tool::Tolerance(aV); // aBox.SetGap(myTolerance); aBox.SetCenter(aPV); @@ -193,8 +185,8 @@ void GEOMAlgo_GlueDetector::DetectVertices() // //--------------------------------------------------- // Chains - for (i=1; i<=aNbV; ++i) { - const TopoDS_Shape& aV=aMV(i); + for (i = 1; i <= aNbV; ++i) { + const TopoDS_Shape &aV = aMV(i); // if (aMVProcessed.Contains(aV)) { continue; @@ -206,87 +198,87 @@ void GEOMAlgo_GlueDetector::DetectVertices() TColStd_MapIteratorOfMapOfInteger aIt1; // aMIP.Add(i); - for(;;) { - aNbIP=aMIP.Extent(); + for (;;) { + aNbIP = aMIP.Extent(); aIt1.Initialize(aMIP); - for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); + for (; aIt1.More(); aIt1.Next()) { + aIP = aIt1.Key(); if (aMIPC.Contains(aIP)) { continue; } // - const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); - const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP); + const TopoDS_Shape &aVP = aMIS.FindFromKey(aIP); + const GEOMAlgo_BndSphere &aBoxVP = aMSB.FindFromKey(aVP); // aSelector.Clear(); aSelector.SetBox(aBoxVP); // - aNbVSD=aBBTree.Select(aSelector); + aNbVSD = aBBTree.Select(aSelector); if (!aNbVSD) { - continue; // it should not be so [at least IP itself] + continue; // it should not be so [at least IP itself] } // - const TColStd_ListOfInteger& aLI=aSelector.Indices(); + const TColStd_ListOfInteger &aLI = aSelector.Indices(); aIt.Initialize(aLI); for (; aIt.More(); aIt.Next()) { - aIP1=aIt.Value(); + aIP1 = aIt.Value(); if (aMIP.Contains(aIP1)) { continue; } aMIP1.Add(aIP1); - } //for (; aIt.More(); aIt.Next()) { - }//for(; aIt1.More(); aIt1.Next()) { + } // for (; aIt.More(); aIt.Next()) { + } // for(; aIt1.More(); aIt1.Next()) { // - aNbIP1=aMIP1.Extent(); + aNbIP1 = aMIP1.Extent(); if (!aNbIP1) { break; } // aIt1.Initialize(aMIP); - for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); + for (; aIt1.More(); aIt1.Next()) { + aIP = aIt1.Key(); aMIPC.Add(aIP); } // aMIP.Clear(); aIt1.Initialize(aMIP1); - for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); + for (; aIt1.More(); aIt1.Next()) { + aIP = aIt1.Key(); aMIP.Add(aIP); } aMIP1.Clear(); - }// while(1) + } // while(1) // // Fill myImages - aNbIP=aMIPC.Extent(); + aNbIP = aMIPC.Extent(); // - if (!aNbIP) {// no SD vertices is found + if (!aNbIP) { // no SD vertices is found aMVProcessed.Add(aV); continue; } - //else { // SD vertices founded [ aMIPC ] + // else { // SD vertices founded [ aMIPC ] aIt1.Initialize(aMIPC); - for(j=0; aIt1.More(); aIt1.Next(), ++j) { - aIP=aIt1.Key(); - const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + for (j = 0; aIt1.More(); aIt1.Next(), ++j) { + aIP = aIt1.Key(); + const TopoDS_Shape &aVP = aMIS.FindFromKey(aIP); if (!j) { - aVF=aVP; + aVF = aVP; } aLVSD.Append(aVP); aMVProcessed.Add(aVP); } //} myImages.Bind(aVF, aLVSD); - }// for (i=1; i<=aNbV; ++i) { + } // for (i=1; i<=aNbV; ++i) { //------------------------------ // Origins aItIm.Initialize(myImages); for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aV=aItIm.Key(); - const TopTools_ListOfShape& aLVSD=aItIm.Value(); + 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(); + const TopoDS_Shape &aVSD = aItS.Value(); if (!myOrigins.IsBound(aVSD)) { myOrigins.Bind(aVSD, aV); } @@ -295,29 +287,22 @@ void GEOMAlgo_GlueDetector::DetectVertices() } //======================================================================= -//function : DetectFaces -//purpose : +// function : DetectFaces +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::DetectFaces() -{ - DetectShapes(TopAbs_FACE); -} +void GEOMAlgo_GlueDetector::DetectFaces() { DetectShapes(TopAbs_FACE); } //======================================================================= -//function : DetectEdges -//purpose : +// function : DetectEdges +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::DetectEdges() -{ - DetectShapes(TopAbs_EDGE); -} +void GEOMAlgo_GlueDetector::DetectEdges() { DetectShapes(TopAbs_EDGE); } //======================================================================= -//function : DetectShapes -//purpose : +// function : DetectShapes +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) -{ +void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) { Standard_Boolean bDegenerated; Standard_Integer i, aNbF, aNbSDF, iErr; TopTools_IndexedMapOfShape aMF; @@ -325,20 +310,19 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) GEOMAlgo_PassKeyShape aPKF; GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; // - myErrorStatus=0; + myErrorStatus = 0; // TopExp::MapShapes(myArgument, aType, aMF); // - aNbF=aMF.Extent(); - for (i=1; i<=aNbF; ++i) { - const TopoDS_Shape& aS=aMF(i); + aNbF = aMF.Extent(); + for (i = 1; i <= aNbF; ++i) { + const TopoDS_Shape &aS = aMF(i); // - if (aType==TopAbs_FACE) { - const TopoDS_Face& aF=*((TopoDS_Face*)&aS); + 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); + } else if (aType == TopAbs_EDGE) { + const TopoDS_Edge &aE = *((TopoDS_Edge *)&aS); EdgePassKey(aE, aPKF); } // @@ -347,10 +331,9 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) } // if (aMPKLF.Contains(aPKF)) { - TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF); + TopTools_ListOfShape &aLSDF = aMPKLF.ChangeFromKey(aPKF); aLSDF.Append(aS); - } - else { + } else { TopTools_ListOfShape aLSDF; // aLSDF.Append(aS); @@ -359,31 +342,31 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) } // check geometric coincidence if (myCheckGeometry) { - iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTolerance, myContext); + iErr = GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTolerance, myContext); if (iErr) { - myErrorStatus=200; + myErrorStatus = 200; return; } } // // Images/Origins - aNbF=aMPKLF.Extent(); - for (i=1; i<=aNbF; ++i) { - const TopTools_ListOfShape& aLSDF=aMPKLF(i); - aNbSDF=aLSDF.Extent(); + 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 + myErrorStatus = 4; // it must not be } // - if (aNbSDF==1) { + if (aNbSDF == 1) { continue; } // - const TopoDS_Shape& aS1=aLSDF.First(); + const TopoDS_Shape &aS1 = aLSDF.First(); // - if (aType==TopAbs_EDGE) { - const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1); - bDegenerated=BRep_Tool::Degenerated(aE1); + if (aType == TopAbs_EDGE) { + const TopoDS_Edge &aE1 = *((TopoDS_Edge *)&aS1); + bDegenerated = BRep_Tool::Degenerated(aE1); if (bDegenerated) { continue; } @@ -394,21 +377,20 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) // origins aItLS.Initialize(aLSDF); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aFSD=aItLS.Value(); + const TopoDS_Shape &aFSD = aItLS.Value(); if (!myOrigins.IsBound(aFSD)) { myOrigins.Bind(aFSD, aS1); } } - }// for (i=1; i<=aNbF; ++i) + } // for (i=1; i<=aNbF; ++i) } //======================================================================= -//function : FacePassKey -//purpose : +// function : FacePassKey +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF, - GEOMAlgo_PassKeyShape& aPK) -{ +void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face &aF, + GEOMAlgo_PassKeyShape &aPK) { Standard_Integer i, aNbE; TopoDS_Shape aER; TopTools_ListOfShape aLE; @@ -416,20 +398,19 @@ void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF, // TopExp::MapShapes(aF, TopAbs_EDGE, aME); // - aNbE=aME.Extent(); - for (i=1; i<=aNbE; ++i) { - const TopoDS_Shape& aE=aME(i); + aNbE = aME.Extent(); + for (i = 1; i <= aNbE; ++i) { + const TopoDS_Shape &aE = aME(i); // - const TopoDS_Edge& aEE=*((TopoDS_Edge*)&aE); + const TopoDS_Edge &aEE = *((TopoDS_Edge *)&aE); if (BRep_Tool::Degenerated(aEE)) { continue; } // if (myOrigins.IsBound(aE)) { - aER=myOrigins.Find(aE); - } - else { - aER=aE; + aER = myOrigins.Find(aE); + } else { + aER = aE; } aLE.Append(aER); } @@ -437,12 +418,11 @@ void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF, } //======================================================================= -//function : EdgePassKey -//purpose : +// function : EdgePassKey +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE, - GEOMAlgo_PassKeyShape& aPK) -{ +void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge &aE, + GEOMAlgo_PassKeyShape &aPK) { TopAbs_Orientation aOr; TopoDS_Shape aVR; TopoDS_Iterator aIt; @@ -450,14 +430,13 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE, // aIt.Initialize(aE); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aV=aIt.Value(); - aOr=aV.Orientation(); - if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) { + const TopoDS_Shape &aV = aIt.Value(); + aOr = aV.Orientation(); + if (aOr == TopAbs_FORWARD || aOr == TopAbs_REVERSED) { if (myOrigins.IsBound(aV)) { - aVR=myOrigins.Find(aV); - } - else { - aVR=aV; + aVR = myOrigins.Find(aV); + } else { + aVR = aV; } aLV.Append(aVR); } @@ -467,11 +446,10 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE, } //======================================================================= -//function : CheckDetected -//purpose : +// function : CheckDetected +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::CheckDetected() -{ +void GEOMAlgo_GlueDetector::CheckDetected() { TopoDS_Iterator aItA; TopExp_Explorer aExp; TopTools_ListOfShape aLV; @@ -484,13 +462,13 @@ void GEOMAlgo_GlueDetector::CheckDetected() // aExp.Init(myArgument, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aE=aExp.Current(); + const TopoDS_Shape &aE = aExp.Current(); // aLV.Clear(); aMFence.Clear(); aItA.Initialize(aE); for (; aItA.More(); aItA.Next()) { - const TopoDS_Shape& aV=aItA.Value(); + const TopoDS_Shape &aV = aItA.Value(); if (aMFence.Add(aV)) { aLV.Append(aV); } @@ -501,85 +479,87 @@ void GEOMAlgo_GlueDetector::CheckDetected() // 2. Checking aItIm.Initialize(myImages); for (; aItIm.More(); aItIm.Next()) { - //const TopoDS_Shape& aV=aItIm.Key(); - const TopTools_ListOfShape& aLVSD=aItIm.Value(); + // const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape &aLVSD = aItIm.Value(); CheckDetected(aLVSD, aMVE, aMEV); } } //======================================================================= -//function : CheckDetected -//purpose : +// function : CheckDetected +// purpose : //======================================================================= -void GEOMAlgo_GlueDetector::CheckDetected(const TopTools_ListOfShape& aLVSD, - const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, - const TopTools_IndexedDataMapOfShapeListOfShape& aMEV) -{ +void GEOMAlgo_GlueDetector::CheckDetected( + const TopTools_ListOfShape &aLVSD, + const TopTools_IndexedDataMapOfShapeListOfShape &aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape &aMEV) { Standard_Integer aNbVSD, iRet; TopExp_Explorer aExp, aExpA; TopTools_MapOfShape aMFence, aMVSD; TopTools_ListOfShape aLV; TopTools_ListIteratorOfListOfShape aItLS; // - myErrorStatus=0; + myErrorStatus = 0; // - aNbVSD=aLVSD.Extent(); + aNbVSD = aLVSD.Extent(); if (aNbVSD < 2) { - return ; + return; } // aItLS.Initialize(aLVSD); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aVSD=aItLS.Value(); + const TopoDS_Shape &aVSD = aItLS.Value(); aMVSD.Add(aVSD); } // aItLS.Initialize(aLVSD); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aVSD=aItLS.Value(); + const TopoDS_Shape &aVSD = aItLS.Value(); // - iRet=CheckAncesstors(aVSD, aMVSD, aMVE, aMEV, myStickedShapes); + iRet = CheckAncesstors(aVSD, aMVSD, aMVE, aMEV, myStickedShapes); if (iRet) { // Sticked shapes detected - myWarningStatus=2; + myWarningStatus = 2; } } } //======================================================================= -//function : CheckAncesstors -//purpose : +// function : CheckAncesstors +// purpose : //======================================================================= -Standard_Integer CheckAncesstors(const TopoDS_Shape& aVSD, - const TopTools_MapOfShape& aMVSD, - const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, - const TopTools_IndexedDataMapOfShapeListOfShape& aMEV, - TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ) -{ +Standard_Integer +CheckAncesstors(const TopoDS_Shape &aVSD, const TopTools_MapOfShape &aMVSD, + const TopTools_IndexedDataMapOfShapeListOfShape &aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape &aMEV, + TopTools_IndexedDataMapOfShapeListOfShape &aMEVZ) { TopTools_ListOfShape *pLE, *pLV, *pLVZ; Standard_Integer iRet, aNbVX; TopTools_ListIteratorOfListOfShape aItLE, aItLV; TopTools_MapOfShape aMFence; TopTools_ListOfShape aLVX; // - iRet=0; + iRet = 0; // - pLE=const_cast(aMVE).ChangeSeek(aVSD); + pLE = + const_cast(aMVE).ChangeSeek( + aVSD); if (!pLE) { return iRet; } aItLE.Initialize(*pLE); for (; aItLE.More(); aItLE.Next()) { - const TopoDS_Shape& aE=aItLE.Value(); + const TopoDS_Shape &aE = aItLE.Value(); // - pLV=const_cast(aMEV).ChangeSeek(aE); + pLV = const_cast(aMEV) + .ChangeSeek(aE); if (!pLV) { continue; // it should be not so } aLVX.Clear(); aItLV.Initialize(*pLV); for (; aItLV.More(); aItLV.Next()) { - const TopoDS_Shape& aV=aItLV.Value(); + const TopoDS_Shape &aV = aItLV.Value(); if (!aV.IsSame(aVSD)) { if (aMVSD.Contains(aV)) { if (aMFence.Add(aV)) { @@ -589,19 +569,18 @@ Standard_Integer CheckAncesstors(const TopoDS_Shape& aVSD, } } // - aNbVX=aLVX.Extent(); + aNbVX = aLVX.Extent(); if (!aNbVX) { continue; } // - iRet=1; + iRet = 1; // - pLVZ=aMEVZ.ChangeSeek(aE); + pLVZ = aMEVZ.ChangeSeek(aE); if (!pLVZ) { aMEVZ.Add(aE, aLVX); - } - else { - TopTools_ListOfShape& aLVZ=*pLVZ; + } else { + TopTools_ListOfShape &aLVZ = *pLVZ; aLVZ.Append(aLVX); } } diff --git a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx index d91b444ec..4a01e621b 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_GlueDetector.hxx @@ -31,29 +32,27 @@ #include -#include #include +#include -#include #include +#include #include - //======================================================================= -//function : GEOMAlgo_GlueDetector -//purpose : +// function : GEOMAlgo_GlueDetector +// purpose : //======================================================================= -class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo, - public GEOMAlgo_Algo -{ +class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo, public GEOMAlgo_Algo { public: GEOMALGOIMPL_EXPORT GEOMAlgo_GlueDetector(); GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_GlueDetector(); - GEOMALGOIMPL_EXPORT virtual void Perform() ; + GEOMALGOIMPL_EXPORT virtual void Perform(); - GEOMALGOIMPL_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes(); + GEOMALGOIMPL_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape & + StickedShapes(); protected: GEOMALGOIMPL_EXPORT void DetectVertices(); @@ -62,20 +61,20 @@ protected: GEOMALGOIMPL_EXPORT void DetectShapes(const TopAbs_ShapeEnum aType); - GEOMALGOIMPL_EXPORT void EdgePassKey(const TopoDS_Edge& aE, - GEOMAlgo_PassKeyShape& aPK); + GEOMALGOIMPL_EXPORT void EdgePassKey(const TopoDS_Edge &aE, + GEOMAlgo_PassKeyShape &aPK); - GEOMALGOIMPL_EXPORT void FacePassKey(const TopoDS_Face& aF, - GEOMAlgo_PassKeyShape& aPK); + GEOMALGOIMPL_EXPORT void FacePassKey(const TopoDS_Face &aF, + GEOMAlgo_PassKeyShape &aPK); GEOMALGOIMPL_EXPORT void CheckDetected(); // - GEOMALGOIMPL_EXPORT void CheckDetected(const TopTools_ListOfShape& aLVSD, - const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, - const TopTools_IndexedDataMapOfShapeListOfShape& aMEV); - + GEOMALGOIMPL_EXPORT void + CheckDetected(const TopTools_ListOfShape &aLVSD, + const TopTools_IndexedDataMapOfShapeListOfShape &aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape &aMEV); - protected: +protected: TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes; }; diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx index eb14f422e..efee615c8 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Gluer2.cxx @@ -32,51 +33,45 @@ #include #include +#include #include #include -#include -#include -#include -#include -#include -#include #include +#include #include +#include +#include +#include +#include #include -#include #include - +#include //======================================================================= -//function : GEOMAlgo_Gluer2 -//purpose : +// function : GEOMAlgo_Gluer2 +// purpose : //======================================================================= GEOMAlgo_Gluer2::GEOMAlgo_Gluer2() - :GEOMAlgo_GluerAlgo() - ,GEOMAlgo_BuilderShape() -{ - myTolerance=0.0001; + : GEOMAlgo_GluerAlgo(), GEOMAlgo_BuilderShape() { + myTolerance = 0.0001; } //======================================================================= -//function : ~GEOMAlgo_Gluer2 -//purpose : +// function : ~GEOMAlgo_Gluer2 +// purpose : //======================================================================= -GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() -{ -} +GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() {} //======================================================================= -//function : Clear -//purpose : +// function : Clear +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::Clear() -{ - myErrorStatus=0; - myWarningStatus=0; +void GEOMAlgo_Gluer2::Clear() { + myErrorStatus = 0; + myWarningStatus = 0; // GEOMAlgo_GluerAlgo::Clear(); // @@ -85,81 +80,78 @@ void GEOMAlgo_Gluer2::Clear() myShapesToGlue.Clear(); myImagesToWork.Clear(); myOriginsToWork.Clear(); - myKeepNonSolids=Standard_False; + myKeepNonSolids = Standard_False; myDetector.Clear(); } //======================================================================= -//function : StickedShapes -//purpose : +// function : StickedShapes +// purpose : //======================================================================= -const TopTools_IndexedDataMapOfShapeListOfShape& GEOMAlgo_Gluer2::StickedShapes() -{ +const TopTools_IndexedDataMapOfShapeListOfShape & +GEOMAlgo_Gluer2::StickedShapes() { return myDetector.StickedShapes(); } //======================================================================= -//function : SetShapesToGlue -//purpose : +// function : SetShapesToGlue +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) -{ - myShapesToGlue=aM; +void GEOMAlgo_Gluer2::SetShapesToGlue( + const TopTools_DataMapOfShapeListOfShape &aM) { + myShapesToGlue = aM; } //======================================================================= -//function : ShapesToGlue -//purpose : +// function : ShapesToGlue +// purpose : //======================================================================= -const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesToGlue() const -{ +const TopTools_DataMapOfShapeListOfShape & +GEOMAlgo_Gluer2::ShapesToGlue() const { return myShapesToGlue; } //======================================================================= -//function : SetKeepNonSolids -//purpose : +// function : SetKeepNonSolids +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::SetKeepNonSolids(const Standard_Boolean aFlag) -{ - myKeepNonSolids=aFlag; +void GEOMAlgo_Gluer2::SetKeepNonSolids(const Standard_Boolean aFlag) { + myKeepNonSolids = aFlag; } //======================================================================= -//function : KeepNonSolids -//purpose : +// function : KeepNonSolids +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids()const -{ +Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids() const { return myKeepNonSolids; } //======================================================================= -//function : ShapesDetected -//purpose : +// function : ShapesDetected +// purpose : //======================================================================= -const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesDetected() const -{ +const TopTools_DataMapOfShapeListOfShape & +GEOMAlgo_Gluer2::ShapesDetected() const { return myImagesDetected; } //======================================================================= -//function : ImagesToWork -//purpose : +// function : ImagesToWork +// purpose : //======================================================================= -const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ImagesToWork() const -{ +const TopTools_DataMapOfShapeListOfShape & +GEOMAlgo_Gluer2::ImagesToWork() const { return myImagesToWork; } //======================================================================= -//function : Perform -//purpose : +// function : Perform +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::Perform() -{ - myErrorStatus=0; - myWarningStatus=0; +void GEOMAlgo_Gluer2::Perform() { + myErrorStatus = 0; + myWarningStatus = 0; // CheckData(); if (myErrorStatus) { @@ -173,9 +165,9 @@ void GEOMAlgo_Gluer2::Perform() if (myErrorStatus) { return; } - if (myWarningStatus==1) { + if (myWarningStatus == 1) { // no shapes to glue - myShape=myArgument; + myShape = myArgument; return; } // @@ -233,126 +225,105 @@ void GEOMAlgo_Gluer2::Perform() } //======================================================================= -//function : CheckData -//purpose : +// function : CheckData +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::CheckData() -{ +void GEOMAlgo_Gluer2::CheckData() { Standard_Integer aNbSG, i; TopAbs_ShapeEnum aType, aTypeX; TopTools_ListIteratorOfListOfShape aItLS; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // - aNbSG=myShapesToGlue.Extent(); - aType=TopAbs_SHAPE; + aNbSG = myShapesToGlue.Extent(); + aType = TopAbs_SHAPE; if (aNbSG) { // Check myShapesToGlue aItDMSLS.Initialize(myShapesToGlue); for (; aItDMSLS.More(); aItDMSLS.Next()) { - const TopTools_ListOfShape& aLSG=aItDMSLS.Value(); + const TopTools_ListOfShape &aLSG = aItDMSLS.Value(); aItLS.Initialize(aLSG); - for (i=0; aItLS.More(); aItLS.Next(), ++i) { - const TopoDS_Shape& aSG=aItLS.Value(); - aTypeX=aSG.ShapeType(); + for (i = 0; aItLS.More(); aItLS.Next(), ++i) { + const TopoDS_Shape &aSG = aItLS.Value(); + aTypeX = aSG.ShapeType(); if (!i) { - aType=aTypeX; - if (!(aType==TopAbs_VERTEX || - aType==TopAbs_EDGE || - aType==TopAbs_FACE)) { - myErrorStatus=21;// non-brep shapes + aType = aTypeX; + if (!(aType == TopAbs_VERTEX || aType == TopAbs_EDGE || + aType == TopAbs_FACE)) { + myErrorStatus = 21; // non-brep shapes return; } continue; } - if (aTypeX!=aType) { - myErrorStatus=20;// non-homogeneous shapes + if (aTypeX != aType) { + myErrorStatus = 20; // non-homogeneous shapes return; } } } - }// if (aNbSG) { + } // if (aNbSG) { } //======================================================================= -//function : FillEdges -//purpose : +// function : FillEdges +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillEdges() -{ - FillBRepShapes(TopAbs_EDGE); -} +void GEOMAlgo_Gluer2::FillEdges() { FillBRepShapes(TopAbs_EDGE); } //======================================================================= -//function : FillFaces -//purpose : +// function : FillFaces +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillFaces() -{ - FillBRepShapes(TopAbs_FACE); -} +void GEOMAlgo_Gluer2::FillFaces() { FillBRepShapes(TopAbs_FACE); } //======================================================================= -//function : FillWires -//purpose : +// function : FillWires +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillWires() -{ - FillContainers(TopAbs_WIRE); -} +void GEOMAlgo_Gluer2::FillWires() { FillContainers(TopAbs_WIRE); } //======================================================================= -//function : FillShells -//purpose : +// function : FillShells +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillShells() -{ - FillContainers(TopAbs_SHELL); -} +void GEOMAlgo_Gluer2::FillShells() { FillContainers(TopAbs_SHELL); } //======================================================================= -//function : FillSolids -//purpose : +// function : FillSolids +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillSolids() -{ - FillContainers(TopAbs_SOLID); -} +void GEOMAlgo_Gluer2::FillSolids() { FillContainers(TopAbs_SOLID); } //======================================================================= -//function : FillCompSolids -//purpose : +// function : FillCompSolids +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillCompSolids() -{ - FillContainers(TopAbs_COMPSOLID); -} +void GEOMAlgo_Gluer2::FillCompSolids() { FillContainers(TopAbs_COMPSOLID); } //======================================================================= -//function : FillVertices -//purpose : +// function : FillVertices +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillVertices() -{ +void GEOMAlgo_Gluer2::FillVertices() { TopAbs_ShapeEnum aType; TopoDS_Vertex aVnew; TopTools_ListIteratorOfListOfShape aItLS; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // aItDMSLS.Initialize(myImagesToWork); for (; aItDMSLS.More(); aItDMSLS.Next()) { - const TopoDS_Shape& aSkey=aItDMSLS.Key(); - aType=aSkey.ShapeType(); - if (aType!=TopAbs_VERTEX) { + const TopoDS_Shape &aSkey = aItDMSLS.Key(); + aType = aSkey.ShapeType(); + if (aType != TopAbs_VERTEX) { continue; } // - const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + const TopTools_ListOfShape &aLSD = aItDMSLS.Value(); // GEOMAlgo_Gluer2::MakeVertex(aLSD, aVnew); // @@ -360,18 +331,17 @@ void GEOMAlgo_Gluer2::FillVertices() // aItLS.Initialize(aLSD); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aV=aItLS.Value(); + const TopoDS_Shape &aV = aItLS.Value(); myOrigins.Bind(aV, aVnew); } } } //======================================================================= -//function : FillBRepShapes -//purpose : +// function : FillBRepShapes +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType) -{ +void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType) { Standard_Boolean bHasImage, bIsToWork; Standard_Integer i, aNbE; TopoDS_Iterator aItS; @@ -380,58 +350,56 @@ void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType) TopTools_MapOfShape aMFence; TopTools_ListIteratorOfListOfShape aItLS; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // TopExp::MapShapes(myArgument, theType, aME); // - aNbE=aME.Extent(); - for (i=1; i<=aNbE; ++i) { - const TopoDS_Shape& aE=aME(i); + aNbE = aME.Extent(); + for (i = 1; i <= aNbE; ++i) { + const TopoDS_Shape &aE = aME(i); // if (!aMFence.Add(aE)) { continue; } // - bIsToWork=myOriginsToWork.IsBound(aE); - bHasImage=HasImage(aE); + bIsToWork = myOriginsToWork.IsBound(aE); + bHasImage = HasImage(aE); if (!bHasImage && !bIsToWork) { continue; } // MakeBRepShapes(aE, aEnew); // - //myImages / myOrigins + // myImages / myOrigins if (bIsToWork) { - const TopoDS_Shape& aSkey=myOriginsToWork.Find(aE); - const TopTools_ListOfShape& aLSD=myImagesToWork.Find(aSkey); + const TopoDS_Shape &aSkey = myOriginsToWork.Find(aE); + const TopTools_ListOfShape &aLSD = myImagesToWork.Find(aSkey); // myImages.Bind(aEnew, aLSD); // aItLS.Initialize(aLSD); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aEx=aItLS.Value(); + const TopoDS_Shape &aEx = aItLS.Value(); myOrigins.Bind(aEx, aEnew); // aMFence.Add(aEx); } - } - else { + } else { TopTools_ListOfShape aLSD; // aLSD.Append(aE); myImages.Bind(aEnew, aLSD); myOrigins.Bind(aE, aEnew); } - }//for (i=1; i<=aNbF; ++i) { + } // for (i=1; i<=aNbF; ++i) { } //======================================================================= -//function : FillContainers -//purpose : +// function : FillContainers +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType) -{ +void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType) { Standard_Boolean bHasImage, bToReverse; Standard_Integer i, aNbW; TopoDS_Shape aWnew, aEnew; @@ -440,20 +408,20 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType) TopTools_IndexedMapOfShape aMW; TopTools_MapOfShape aMFence; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // TopExp::MapShapes(myArgument, aType, aMW); // - aNbW=aMW.Extent(); - for (i=1; i<=aNbW; ++i) { - const TopoDS_Shape& aW=aMW(i); + aNbW = aMW.Extent(); + for (i = 1; i <= aNbW; ++i) { + const TopoDS_Shape &aW = aMW(i); // if (!aMFence.Add(aW)) { continue; } // - bHasImage=HasImage(aW); + bHasImage = HasImage(aW); if (!bHasImage) { continue; } @@ -463,67 +431,64 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType) // aItS.Initialize(aW); for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aE=aItS.Value(); + const TopoDS_Shape &aE = aItS.Value(); if (myOrigins.IsBound(aE)) { - aEnew=myOrigins.Find(aE); + aEnew = myOrigins.Find(aE); // - bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aEnew, aE, myContext); + bToReverse = BOPTools_AlgoTools::IsSplitToReverse(aEnew, aE, myContext); if (bToReverse) { aEnew.Reverse(); } // aBB.Add(aWnew, aEnew); - } - else { + } else { aBB.Add(aWnew, aE); } } // - //myImages / myOrigins + // myImages / myOrigins TopTools_ListOfShape aLSD; // aLSD.Append(aW); myImages.Bind(aWnew, aLSD); myOrigins.Bind(aW, aWnew); // - }//for (i=1; i<=aNbE; ++i) { + } // for (i=1; i<=aNbE; ++i) { } //======================================================================= -//function : FillCompounds -//purpose : +// function : FillCompounds +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillCompounds() -{ +void GEOMAlgo_Gluer2::FillCompounds() { TopAbs_ShapeEnum aType; TopoDS_Iterator aItC; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // aItC.Initialize(myArgument); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aCx=aItC.Value(); - aType=aCx.ShapeType(); - if (aType==TopAbs_COMPOUND) { + const TopoDS_Shape &aCx = aItC.Value(); + aType = aCx.ShapeType(); + if (aType == TopAbs_COMPOUND) { FillCompound(aCx); } } } //======================================================================= -//function : FillCompound -//purpose : +// function : FillCompound +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC) -{ +void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape &aC) { Standard_Boolean bHasImage; TopAbs_ShapeEnum aType; TopoDS_Shape aCnew, aCXnew; TopoDS_Iterator aItC; BRep_Builder aBB; // - bHasImage=HasImage(aC); + bHasImage = HasImage(aC); if (!bHasImage) { return; } @@ -532,24 +497,23 @@ void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC) // aItC.Initialize(aC); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aCX=aItC.Value(); - aType=aCX.ShapeType(); + const TopoDS_Shape &aCX = aItC.Value(); + aType = aCX.ShapeType(); // - if (aType==TopAbs_COMPOUND) { + if (aType == TopAbs_COMPOUND) { FillCompound(aCX); } // if (myOrigins.IsBound(aCX)) { - aCXnew=myOrigins.Find(aCX); + aCXnew = myOrigins.Find(aCX); aCXnew.Orientation(aCX.Orientation()); aBB.Add(aCnew, aCXnew); - } - else { + } else { aBB.Add(aCnew, aCX); } } // - //myImages / myOrigins + // myImages / myOrigins TopTools_ListOfShape aLSD; // aLSD.Append(aC); @@ -558,66 +522,63 @@ void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC) } //======================================================================= -//function : HasImage -//purpose : +// function : HasImage +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_Gluer2::HasImage(const TopoDS_Shape& aC) -{ +Standard_Boolean GEOMAlgo_Gluer2::HasImage(const TopoDS_Shape &aC) { Standard_Boolean bRet; TopAbs_ShapeEnum aType; TopoDS_Iterator aItC; // - bRet=Standard_False; + bRet = Standard_False; aItC.Initialize(aC); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aCx=aItC.Value(); - aType=aCx.ShapeType(); + const TopoDS_Shape &aCx = aItC.Value(); + aType = aCx.ShapeType(); // - if (aType==TopAbs_COMPOUND) { - bRet=HasImage(aCx); + if (aType == TopAbs_COMPOUND) { + bRet = HasImage(aCx); if (bRet) { return bRet; } - } - else { - bRet=myOrigins.IsBound(aCx); + } else { + bRet = myOrigins.IsBound(aCx); if (bRet) { return bRet; } } } // - bRet=myOrigins.IsBound(aC); + bRet = myOrigins.IsBound(aC); // return bRet; } //======================================================================= -//function : BuildResult -//purpose : +// function : BuildResult +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::BuildResult() -{ +void GEOMAlgo_Gluer2::BuildResult() { Standard_Boolean bHasImage; TopoDS_Shape aCnew, aCXnew; TopoDS_Iterator aItC; BRep_Builder aBB; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // - bHasImage=Standard_False; + bHasImage = Standard_False; aItC.Initialize(myArgument); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aCx=aItC.Value(); - bHasImage=HasImage(aCx); + const TopoDS_Shape &aCx = aItC.Value(); + bHasImage = HasImage(aCx); if (bHasImage) { break; } } // if (!bHasImage) { - myShape=myArgument; + myShape = myArgument; return; } // @@ -625,13 +586,12 @@ void GEOMAlgo_Gluer2::BuildResult() // aItC.Initialize(myArgument); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aCX=aItC.Value(); + const TopoDS_Shape &aCX = aItC.Value(); if (myOrigins.IsBound(aCX)) { - aCXnew=myOrigins.Find(aCX); + aCXnew = myOrigins.Find(aCX); aCXnew.Orientation(aCX.Orientation()); aBB.Add(aCnew, aCXnew); - } - else { + } else { aBB.Add(aCnew, aCX); } } @@ -645,15 +605,15 @@ void GEOMAlgo_Gluer2::BuildResult() // TopExp::MapShapes(aCnew, TopAbs_SOLID, aM); - aNb=aM.Extent(); - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aS=aM(i); + aNb = aM.Extent(); + for (i = 1; i <= aNb; ++i) { + const TopoDS_Shape &aS = aM(i); aBB.Add(aCnew1, aS); } - aCnew=aCnew1; + aCnew = aCnew1; } // - myShape=aCnew; + myShape = aCnew; } //-------------------------------------------------------- // diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx index 5f7e94035..a89e431cd 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Gluer2.hxx @@ -29,35 +30,36 @@ #include #include -#include #include +#include #include #include #include -#include #include -#include #include +#include +#include #include //======================================================================= -//class : GEOMAlgo_Gluer2 -//purpose : +// class : GEOMAlgo_Gluer2 +// purpose : //======================================================================= -class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo, - public GEOMAlgo_BuilderShape { +class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo, + public GEOMAlgo_BuilderShape { public: - GEOMALGOIMPL_EXPORT GEOMAlgo_Gluer2(); GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Gluer2(); - GEOMALGOIMPL_EXPORT void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM); + GEOMALGOIMPL_EXPORT void + SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape &aM); - GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const; + GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape & + ShapesToGlue() const; GEOMALGOIMPL_EXPORT void SetKeepNonSolids(const Standard_Boolean theFlag); @@ -71,32 +73,37 @@ public: GEOMALGOIMPL_EXPORT void Detect(); - GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesDetected() const; - - GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape& ImagesToWork() const; + GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape & + ShapesDetected() const; - GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS); + GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape & + ImagesToWork() const; - GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS); + GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape & + Generated(const TopoDS_Shape &theS); - GEOMALGOIMPL_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS); + GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape & + Modified(const TopoDS_Shape &theS); + GEOMALGOIMPL_EXPORT virtual Standard_Boolean + IsDeleted(const TopoDS_Shape &theS); - GEOMALGOIMPL_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV, - TopoDS_Vertex& theV); + GEOMALGOIMPL_EXPORT static void MakeVertex(const TopTools_ListOfShape &theLV, + TopoDS_Vertex &theV); - GEOMALGOIMPL_EXPORT static void MapBRepShapes(const TopoDS_Shape& theS, - TopTools_MapOfShape& theM); + GEOMALGOIMPL_EXPORT static void MapBRepShapes(const TopoDS_Shape &theS, + TopTools_MapOfShape &theM); - GEOMALGOIMPL_EXPORT static void MapShapes(const TopoDS_Shape& theS, - TopTools_MapOfShape& theM); + GEOMALGOIMPL_EXPORT static void MapShapes(const TopoDS_Shape &theS, + TopTools_MapOfShape &theM); -//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f - GEOMALGOIMPL_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes(); -//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t -//------------------------------------------------ + // modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f + GEOMALGOIMPL_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape & + StickedShapes(); + // modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t + //------------------------------------------------ protected: - GEOMALGOIMPL_EXPORT void PerformShapesToWork() ; + GEOMALGOIMPL_EXPORT void PerformShapesToWork(); GEOMALGOIMPL_EXPORT void FillVertices(); GEOMALGOIMPL_EXPORT void FillEdges(); @@ -111,32 +118,32 @@ protected: GEOMALGOIMPL_EXPORT void FillBRepShapes(const TopAbs_ShapeEnum theType); GEOMALGOIMPL_EXPORT void FillContainers(const TopAbs_ShapeEnum theType); - GEOMALGOIMPL_EXPORT void FillCompound(const TopoDS_Shape& theC); + GEOMALGOIMPL_EXPORT void FillCompound(const TopoDS_Shape &theC); GEOMALGOIMPL_EXPORT virtual void PrepareHistory(); - GEOMALGOIMPL_EXPORT Standard_Boolean HasImage(const TopoDS_Shape& theC); + GEOMALGOIMPL_EXPORT Standard_Boolean HasImage(const TopoDS_Shape &theC); - GEOMALGOIMPL_EXPORT void MakeBRepShapes(const TopoDS_Shape& theS, - TopoDS_Shape& theSnew); + GEOMALGOIMPL_EXPORT void MakeBRepShapes(const TopoDS_Shape &theS, + TopoDS_Shape &theSnew); - GEOMALGOIMPL_EXPORT void MakeEdge(const TopoDS_Edge& theE, - TopoDS_Edge& theEnew); + GEOMALGOIMPL_EXPORT void MakeEdge(const TopoDS_Edge &theE, + TopoDS_Edge &theEnew); - GEOMALGOIMPL_EXPORT void MakeFace(const TopoDS_Face& theF, - TopoDS_Face& theFnew); + GEOMALGOIMPL_EXPORT void MakeFace(const TopoDS_Face &theF, + TopoDS_Face &theFnew); - GEOMALGOIMPL_EXPORT void TreatPair(const GEOMAlgo_CoupleOfShapes& theCS, - GEOMAlgo_ListOfCoupleOfShapes& theLCS); + GEOMALGOIMPL_EXPORT void TreatPair(const GEOMAlgo_CoupleOfShapes &theCS, + GEOMAlgo_ListOfCoupleOfShapes &theLCS); protected: TopTools_DataMapOfShapeListOfShape myShapesToGlue; TopTools_DataMapOfShapeListOfShape myImagesDetected; - TopTools_DataMapOfShapeShape myOriginsDetected; + TopTools_DataMapOfShapeShape myOriginsDetected; TopTools_DataMapOfShapeListOfShape myImagesToWork; - TopTools_DataMapOfShapeShape myOriginsToWork; - Standard_Boolean myKeepNonSolids; - GEOMAlgo_GlueDetector myDetector; + TopTools_DataMapOfShapeShape myOriginsToWork; + Standard_Boolean myKeepNonSolids; + GEOMAlgo_GlueDetector myDetector; }; #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2_1.cxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2_1.cxx index 97a30bd35..9bac8c0a3 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2_1.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2_1.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Gluer2_1.cxx @@ -25,8 +26,8 @@ #include -#include #include +#include #include @@ -34,69 +35,64 @@ #include -#include -#include #include -#include #include #include +#include +#include +#include -#include #include +#include #include #include -#include #include #include +#include #include -#include #include - +#include //======================================================================= -//function : MakeBRepShapes -//purpose : +// function : MakeBRepShapes +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS, - TopoDS_Shape& theSnew) -{ +void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape &theS, + TopoDS_Shape &theSnew) { TopAbs_ShapeEnum aType; // - aType=theS.ShapeType(); - if (aType==TopAbs_EDGE) { + aType = theS.ShapeType(); + if (aType == TopAbs_EDGE) { TopoDS_Edge aEE, aEEnew; // - aEE=*((TopoDS_Edge*)&theS); + aEE = *((TopoDS_Edge *)&theS); MakeEdge(aEE, aEEnew); if (myErrorStatus) { return; } // - theSnew=aEEnew; - } - else if (aType==TopAbs_FACE) { + theSnew = aEEnew; + } else if (aType == TopAbs_FACE) { TopoDS_Face aFF, aFFnew; // - aFF=*((TopoDS_Face*)&theS); + aFF = *((TopoDS_Face *)&theS); MakeFace(aFF, aFFnew); if (myErrorStatus) { return; } // - theSnew=aFFnew; + theSnew = aFFnew; } } //======================================================================= -//function : MakeFace -//purpose : +// function : MakeFace +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF, - TopoDS_Face& theFnew) -{ +void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face &theF, TopoDS_Face &theFnew) { Standard_Boolean bIsToReverse, bIsUPeriodic; Standard_Integer iRet; Standard_Real aTol, aUMin, aUMax, aVMin, aVMax; @@ -110,51 +106,51 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF, TopTools_ListOfShape aLEr; TopTools_ListIteratorOfListOfShape aItLE; // - myErrorStatus=0; + myErrorStatus = 0; // - aFF=theF; + aFF = theF; aFF.Orientation(TopAbs_FORWARD); // - aTol=BRep_Tool::Tolerance(aFF); - aS=BRep_Tool::Surface(aFF, aLoc); - bIsUPeriodic=GEOMAlgo_AlgoTools::IsUPeriodic(aS); + aTol = BRep_Tool::Tolerance(aFF); + aS = BRep_Tool::Surface(aFF, aLoc); + bIsUPeriodic = GEOMAlgo_AlgoTools::IsUPeriodic(aS); BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax); // - aBB.MakeFace (aFnew, aS, aLoc, aTol); + aBB.MakeFace(aFnew, aS, aLoc, aTol); // aItW.Initialize(aFF); for (; aItW.More(); aItW.Next()) { - const TopoDS_Shape& aW=aItW.Value(); + const TopoDS_Shape &aW = aItW.Value(); // if (!myOrigins.IsBound(aW)) { aBB.Add(aFnew, aW); continue; } // - aWr=myOrigins.Find(aW); + aWr = myOrigins.Find(aW); // // clear contents of Wr aLEr.Clear(); aItE.Initialize(aWr); for (; aItE.More(); aItE.Next()) { - const TopoDS_Shape& aEr=aItE.Value(); + const TopoDS_Shape &aEr = aItE.Value(); aLEr.Append(aEr); } // aItLE.Initialize(aLEr); for (; aItLE.More(); aItLE.Next()) { - const TopoDS_Shape& aEr=aItLE.Value(); + const TopoDS_Shape &aEr = aItLE.Value(); aBB.Remove(aWr, aEr); } // // refill contents of Wr aItE.Initialize(aW); for (; aItE.More(); aItE.Next()) { - const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aItE.Value())); + const TopoDS_Edge &aE = *((TopoDS_Edge *)(&aItE.Value())); // - aEx=aE; + aEx = aE; if (myOrigins.IsBound(aE)) { - aEx=*((TopoDS_Edge*)(&myOrigins.Find(aE))); + aEx = *((TopoDS_Edge *)(&myOrigins.Find(aE))); } // if (!BRep_Tool::Degenerated(aEx)) { @@ -165,98 +161,96 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF, GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax); } // - //modified by NIZNHY-PKV Fri Feb 03 11:18:17 2012f - iRet=GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace(aE_forward, aEx, aFF, myContext); + // modified by NIZNHY-PKV Fri Feb 03 11:18:17 2012f + iRet = GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace(aE_forward, aEx, + aFF, myContext); if (iRet) { continue; } - //modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t + // modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t // - bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aEx, aE_forward, myContext); - //bIsToReverse=BOPTools_AlgoTools::IsSplitToReverse(aEx, aE, myContext); + bIsToReverse = + GEOMAlgo_AlgoTools::IsSplitToReverse(aEx, aE_forward, myContext); + // bIsToReverse=BOPTools_AlgoTools::IsSplitToReverse(aEx, aE, + // myContext); aEx.Orientation(aE.Orientation()); - + if (bIsToReverse) aEx.Reverse(); - } - else { + } else { aEx.Orientation(aE.Orientation()); } aBB.Add(aWr, aEx); - }// for (; aItE.More(); aItE.Next()) { + } // for (; aItE.More(); aItE.Next()) { // aBB.Add(aFnew, aWr); - }// for (; aItW.More(); aItW.Next()) { - theFnew=aFnew; + } // for (; aItW.More(); aItW.Next()) { + theFnew = aFnew; } //======================================================================= -//function : MakeEdge -//purpose : +// function : MakeEdge +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE, - TopoDS_Edge& aNewEdge) -{ - myErrorStatus=0; +void GEOMAlgo_Gluer2::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); + bIsDE = BRep_Tool::Degenerated(aE); // - aEx=aE; + aEx = aE; aEx.Orientation(TopAbs_FORWARD); // TopExp::Vertices(aEx, aV1, aV2); // - aT1=BRep_Tool::Parameter(aV1, aEx); - aT2=BRep_Tool::Parameter(aV2, aEx); + aT1 = BRep_Tool::Parameter(aV1, aEx); + aT2 = BRep_Tool::Parameter(aV2, aEx); // - aVR1=aV1; + aVR1 = aV1; if (myOrigins.IsBound(aV1)) { - aVR1=*((TopoDS_Vertex*)&myOrigins.Find(aV1)); + aVR1 = *((TopoDS_Vertex *)&myOrigins.Find(aV1)); } aVR1.Orientation(TopAbs_FORWARD); // - aVR2=aV2; + aVR2 = aV2; if (myOrigins.IsBound(aV2)) { - aVR2=*((TopoDS_Vertex*)&myOrigins.Find(aV2)); + aVR2 = *((TopoDS_Vertex *)&myOrigins.Find(aV2)); } aVR2.Orientation(TopAbs_REVERSED); // if (!bIsDE) { BOPTools_AlgoTools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); - } - else { + } else { Standard_Real aTol; BRep_Builder aBB; TopoDS_Edge E; // - aTol=BRep_Tool::Tolerance(aE); + aTol = BRep_Tool::Tolerance(aE); // - E=aEx; + E = aEx; E.EmptyCopy(); // - aBB.Add (E, aVR1); - aBB.Add (E, aVR2); + aBB.Add(E, aVR1); + aBB.Add(E, aVR2); aBB.Range(E, aT1, aT2); aBB.Degenerated(E, Standard_True); aBB.UpdateEdge(E, aTol); // - aNewEdge=E; + aNewEdge = E; } } //======================================================================= -//function : MakeVertex -//purpose : +// function : MakeVertex +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV, - TopoDS_Vertex& aNewVertex) -{ +void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape &aLV, + TopoDS_Vertex &aNewVertex) { Standard_Integer aNbV; Standard_Real aTolV, aD, aDmax; gp_XYZ aGC; @@ -265,59 +259,56 @@ void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV, BRep_Builder aBB; TopTools_ListIteratorOfListOfShape aIt; // - aNbV=aLV.Extent(); + aNbV = aLV.Extent(); if (!aNbV) { return; } // // center of gravity - aGC.SetCoord(0.,0.,0.); + 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(); + aVx = *((TopoDS_Vertex *)(&aIt.Value())); + aP3D = BRep_Tool::Pnt(aVx); + aGC += aP3D.XYZ(); } - aGC/=(Standard_Real)aNbV; + aGC /= (Standard_Real)aNbV; aPGC.SetXYZ(aGC); // // tolerance value - aDmax=-1.; + 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; + 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); + aBB.MakeVertex(aNewVertex, aPGC, aDmax); } //======================================================================= -//function : MapBRepShapes -//purpose : +// function : MapBRepShapes +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::MapBRepShapes(const TopoDS_Shape& aS, - TopTools_MapOfShape& aM) -{ +void GEOMAlgo_Gluer2::MapBRepShapes(const TopoDS_Shape &aS, + TopTools_MapOfShape &aM) { TopAbs_ShapeEnum aType; TopoDS_Iterator aIt; // - aType=aS.ShapeType(); - if (aType==TopAbs_VERTEX || - aType==TopAbs_EDGE || - aType==TopAbs_FACE) { + aType = aS.ShapeType(); + if (aType == TopAbs_VERTEX || aType == TopAbs_EDGE || aType == TopAbs_FACE) { aM.Add(aS); } // aIt.Initialize(aS); - for(; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSx=aIt.Value(); - aType=aSx.ShapeType(); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape &aSx = aIt.Value(); + aType = aSx.ShapeType(); GEOMAlgo_Gluer2::MapBRepShapes(aSx, aM); } } diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2_2.cxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2_2.cxx index e1032b3cb..d0a7786cb 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2_2.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2_2.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Gluer2_2.cxx // Created: @@ -35,18 +36,16 @@ #include - //======================================================================= -//function : PrepareHistory -//purpose : +// function : PrepareHistory +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::PrepareHistory() -{ +void GEOMAlgo_Gluer2::PrepareHistory() { // // 1. Clearing GEOMAlgo_BuilderShape::PrepareHistory(); // - if(myShape.IsNull()) { + if (myShape.IsNull()) { return; } // @@ -55,53 +54,51 @@ void GEOMAlgo_Gluer2::PrepareHistory() } //======================================================================= -//function : Generated -//purpose : +// function : Generated +// purpose : //======================================================================= -const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& ) -{ +const TopTools_ListOfShape &GEOMAlgo_Gluer2::Generated(const TopoDS_Shape &) { myHistShapes.Clear(); return myHistShapes; } //======================================================================= -//function : Modified -//purpose : +// function : Modified +// purpose : //======================================================================= -const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS) -{ +const TopTools_ListOfShape & +GEOMAlgo_Gluer2::Modified(const TopoDS_Shape &theS) { Standard_Boolean bIsDeleted, bHasImage, bToReverse; TopAbs_ShapeEnum aType; TopoDS_Shape aSim; // myHistShapes.Clear(); // - aType=theS.ShapeType(); - if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE || - aType==TopAbs_FACE || aType==TopAbs_SOLID)) { + aType = theS.ShapeType(); + if (!(aType == TopAbs_VERTEX || aType == TopAbs_EDGE || + aType == TopAbs_FACE || aType == TopAbs_SOLID)) { return myHistShapes; } // - bIsDeleted=IsDeleted(theS); + bIsDeleted = IsDeleted(theS); if (bIsDeleted) { return myHistShapes; } // - bHasImage=myOrigins.IsBound(theS); + bHasImage = myOrigins.IsBound(theS); if (!bHasImage) { return myHistShapes; } // - aSim=myOrigins.Find(theS); - if (aSim.IsSame(theS)){ + aSim = myOrigins.Find(theS); + if (aSim.IsSame(theS)) { return myHistShapes; } // - if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + if (aType == TopAbs_VERTEX || aType == TopAbs_SOLID) { aSim.Orientation(theS.Orientation()); - } - else { - bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext); + } else { + bToReverse = BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext); if (bToReverse) { aSim.Reverse(); } @@ -113,49 +110,47 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS) } //======================================================================= -//function : IsDeleted -//purpose : +// function : IsDeleted +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS) -{ +Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape &theS) { Standard_Boolean bRet, bContains, bHasImage; // - bRet=Standard_False; + bRet = Standard_False; // if (theS.IsNull()) { - return !bRet; //true + return !bRet; // true } // - bContains=myMapShape.Contains(theS); + bContains = myMapShape.Contains(theS); if (bContains) { - return bRet; //false + return bRet; // false } // - bHasImage=myOrigins.IsBound(theS); + bHasImage = myOrigins.IsBound(theS); if (bHasImage) { - const TopoDS_Shape& aSim=myOrigins.Find(theS); - bContains=myMapShape.Contains(aSim); + const TopoDS_Shape &aSim = myOrigins.Find(theS); + bContains = myMapShape.Contains(aSim); if (bContains) { - return bRet; //false + return bRet; // false } } // - return !bRet; //true + return !bRet; // true } //======================================================================= -//function : MapShapes -//purpose : +// function : MapShapes +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS, - TopTools_MapOfShape& theM) -{ +void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape &theS, + TopTools_MapOfShape &theM) { TopoDS_Iterator aIt; // theM.Add(theS); aIt.Initialize(theS); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSx=aIt.Value(); + const TopoDS_Shape &aSx = aIt.Value(); GEOMAlgo_Gluer2::MapShapes(aSx, theM); } } diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2_3.cxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2_3.cxx index 6a6a39a8d..305125b59 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2_3.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2_3.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_Gluer2_3.cxx @@ -27,8 +28,8 @@ #include -#include #include +#include #include @@ -37,95 +38,89 @@ #include #include +#include +#include #include -#include #include -#include -#include -#include +#include #include -#include #include +#include #include #include #include - -static void MapShapes1(const TopoDS_Shape& aS, - const TopAbs_ShapeEnum aType, - TopTools_IndexedMapOfShape& aM); - +static void MapShapes1(const TopoDS_Shape &aS, const TopAbs_ShapeEnum aType, + TopTools_IndexedMapOfShape &aM); //======================================================================= -//function : Detect -//purpose : +// function : Detect +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::Detect() -{ +void GEOMAlgo_Gluer2::Detect() { Standard_Boolean bCheckGeometry; Standard_Integer iErr; TopTools_ListIteratorOfListOfShape aItLS; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // myImagesDetected.Clear(); myOriginsDetected.Clear(); // - bCheckGeometry=Standard_True; + bCheckGeometry = Standard_True; // - //modified by NIZNHY-PKV Tue Mar 13 13:33:35 2012f + // modified by NIZNHY-PKV Tue Mar 13 13:33:35 2012f myDetector.Clear(); myDetector.SetContext(myContext); - //modified by NIZNHY-PKV Tue Mar 13 13:33:38 2012t + // modified by NIZNHY-PKV Tue Mar 13 13:33:38 2012t myDetector.SetArgument(myArgument); myDetector.SetTolerance(myTolerance); myDetector.SetCheckGeometry(bCheckGeometry); // myDetector.Perform(); - iErr=myDetector.ErrorStatus(); + iErr = myDetector.ErrorStatus(); if (iErr) { // Detector is failed - myErrorStatus=11; + myErrorStatus = 11; return; } - //modified by NIZNHY-PKV Tue Mar 13 13:40:36 2012f - iErr=myDetector.WarningStatus(); + // modified by NIZNHY-PKV Tue Mar 13 13:40:36 2012f + iErr = myDetector.WarningStatus(); if (iErr) { // Sticked shapes are detected - myWarningStatus=2; + myWarningStatus = 2; } - //modified by NIZNHY-PKV Tue Mar 13 13:40:39 2012t + // modified by NIZNHY-PKV Tue Mar 13 13:40:39 2012t // - const TopTools_DataMapOfShapeListOfShape& aImages=myDetector.Images(); + const TopTools_DataMapOfShapeListOfShape &aImages = myDetector.Images(); aItDMSLS.Initialize(aImages); for (; aItDMSLS.More(); aItDMSLS.Next()) { - const TopoDS_Shape& aSkey=aItDMSLS.Key(); - const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + const TopoDS_Shape &aSkey = aItDMSLS.Key(); + const TopTools_ListOfShape &aLSD = aItDMSLS.Value(); myImagesDetected.Bind(aSkey, aLSD); } // aItDMSLS.Initialize(myImagesDetected); for (; aItDMSLS.More(); aItDMSLS.Next()) { - const TopoDS_Shape& aSkey=aItDMSLS.Key(); - const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + const TopoDS_Shape &aSkey = aItDMSLS.Key(); + const TopTools_ListOfShape &aLSD = aItDMSLS.Value(); aItLS.Initialize(aLSD); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aSx=aItLS.Value(); + const TopoDS_Shape &aSx = aItLS.Value(); myOriginsDetected.Bind(aSx, aSkey); } } } //======================================================================= -//function : PerformShapesToWork -//purpose : +// function : PerformShapesToWork +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::PerformShapesToWork() -{ +void GEOMAlgo_Gluer2::PerformShapesToWork() { Standard_Integer aNbSG, i, j, k, aNbC, aNb, aNbSD; TopTools_ListIteratorOfListOfShape aItLS1, aItLS2; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; @@ -133,48 +128,48 @@ void GEOMAlgo_Gluer2::PerformShapesToWork() GEOMAlgo_ListOfCoupleOfShapes aLCS; GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; // - myErrorStatus=0; - myWarningStatus=0; + myErrorStatus = 0; + myWarningStatus = 0; // myImagesToWork.Clear(); myOriginsToWork.Clear(); // - aNbSD=myImagesDetected.Extent(); - if (!aNbSD) {// no shapes to glue detected - myWarningStatus=1; + aNbSD = myImagesDetected.Extent(); + if (!aNbSD) { // no shapes to glue detected + myWarningStatus = 1; return; } // - aNbSG=myShapesToGlue.Extent(); + aNbSG = myShapesToGlue.Extent(); if (!aNbSG) { // glue all possible - myImagesToWork=myImagesDetected; + myImagesToWork = myImagesDetected; // aItDMSLS.Initialize(myImagesToWork); for (; aItDMSLS.More(); aItDMSLS.Next()) { - const TopoDS_Shape& aSkey=aItDMSLS.Key(); - const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + const TopoDS_Shape &aSkey = aItDMSLS.Key(); + const TopTools_ListOfShape &aLSD = aItDMSLS.Value(); aItLS1.Initialize(aLSD); for (; aItLS1.More(); aItLS1.Next()) { - const TopoDS_Shape& aSx=aItLS1.Value(); + const TopoDS_Shape &aSx = aItLS1.Value(); myOriginsToWork.Bind(aSx, aSkey); } } return; - }// if (!aNbSG) { + } // if (!aNbSG) { // // 1. Make pairs aItDMSLS.Initialize(myShapesToGlue); - for (k=0; aItDMSLS.More(); aItDMSLS.Next(), ++k) { - //const TopoDS_Shape& aSkey=aItDMSLS.Key(); - const TopTools_ListOfShape& aLSG=aItDMSLS.Value(); + for (k = 0; aItDMSLS.More(); aItDMSLS.Next(), ++k) { + // const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape &aLSG = aItDMSLS.Value(); aItLS1.Initialize(aLSG); - for (i=0; aItLS1.More(); aItLS1.Next(), ++i) { + for (i = 0; aItLS1.More(); aItLS1.Next(), ++i) { aItLS2.Initialize(aLSG); - for (j=0; aItLS2.More(); aItLS2.Next(), ++j) { - if (j>i) { - const TopoDS_Shape& aSG1=aItLS1.Value(); - const TopoDS_Shape& aSG2=aItLS2.Value(); + for (j = 0; aItLS2.More(); aItLS2.Next(), ++j) { + if (j > i) { + const TopoDS_Shape &aSG1 = aItLS1.Value(); + const TopoDS_Shape &aSG2 = aItLS2.Value(); aCS.SetShape1(aSG1); aCS.SetShape2(aSG2); TreatPair(aCS, aLCS); @@ -190,14 +185,14 @@ void GEOMAlgo_Gluer2::PerformShapesToWork() GEOMAlgo_AlgoTools::FindChains(aLCS, aMC); // // 3. myImagesToWork, myOriginsToWork - aNbC=aMC.Extent(); - for (i=1; i<=aNbC; ++i) { - const TopoDS_Shape& aSkey=aMC.FindKey(i); - const TopTools_IndexedMapOfShape& aM=aMC(i); + aNbC = aMC.Extent(); + for (i = 1; i <= aNbC; ++i) { + const TopoDS_Shape &aSkey = aMC.FindKey(i); + const TopTools_IndexedMapOfShape &aM = aMC(i); aLSX.Clear(); - aNb=aM.Extent(); - for (j=1; j<=aNb; ++j) { - const TopoDS_Shape& aS=aM(j); + aNb = aM.Extent(); + for (j = 1; j <= aNb; ++j) { + const TopoDS_Shape &aS = aM(j); aLSX.Append(aS); myOriginsToWork.Bind(aS, aSkey); } @@ -206,12 +201,11 @@ void GEOMAlgo_Gluer2::PerformShapesToWork() } //======================================================================= -//function : TreatPair -//purpose : +// function : TreatPair +// purpose : //======================================================================= -void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS, - GEOMAlgo_ListOfCoupleOfShapes& aLCS) -{ +void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes &aCS, + GEOMAlgo_ListOfCoupleOfShapes &aLCS) { if (myErrorStatus) { return; } @@ -226,22 +220,22 @@ void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS, // // 1. Checking the pair on whether it can be glued at all // 1.1 - const TopoDS_Shape& aS1=aCS.Shape1(); + const TopoDS_Shape &aS1 = aCS.Shape1(); if (!myOriginsDetected.IsBound(aS1)) { - myErrorStatus=30; + myErrorStatus = 30; return; } - const TopoDS_Shape& aSkey1=myOriginsDetected.Find(aS1); + const TopoDS_Shape &aSkey1 = myOriginsDetected.Find(aS1); // 1.2 - const TopoDS_Shape& aS2=aCS.Shape2(); + const TopoDS_Shape &aS2 = aCS.Shape2(); if (!myOriginsDetected.IsBound(aS2)) { - myErrorStatus=30; + myErrorStatus = 30; return; } - const TopoDS_Shape& aSkey2=myOriginsDetected.Find(aS2); + const TopoDS_Shape &aSkey2 = myOriginsDetected.Find(aS2); // 1.3 if (!aSkey1.IsSame(aSkey2)) { - myErrorStatus=33; + myErrorStatus = 33; return; } // @@ -249,43 +243,42 @@ void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS, aLCS.Append(aCS); // // 3. Treatment the sub-shapes of the pair - aType=aS1.ShapeType(); - if (aType==TopAbs_VERTEX) { + aType = aS1.ShapeType(); + if (aType == TopAbs_VERTEX) { return; } - aTypeS=TopAbs_EDGE; - if (aType==aTypeS) { - aTypeS=TopAbs_VERTEX; + aTypeS = TopAbs_EDGE; + if (aType == aTypeS) { + aTypeS = TopAbs_VERTEX; } // MapShapes1(aS1, aTypeS, aMS1); MapShapes1(aS2, aTypeS, aMS2); // - aNbS1=aMS1.Extent(); - aNbS2=aMS2.Extent(); - if (aNbS1!=aNbS2) { - myErrorStatus=31; + aNbS1 = aMS1.Extent(); + aNbS2 = aMS2.Extent(); + if (aNbS1 != aNbS2) { + myErrorStatus = 31; return; } // // 1. - for (i=1; i<=aNbS1; ++i) { - const TopoDS_Shape& aSS1=aMS1(i); + for (i = 1; i <= aNbS1; ++i) { + const TopoDS_Shape &aSS1 = aMS1(i); if (aMS2.Contains(aSS1)) { continue; } // if (!myOriginsDetected.IsBound(aSS1)) { - myErrorStatus=30; + myErrorStatus = 30; return; } // - const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS1); + const TopoDS_Shape &aSkey = myOriginsDetected.Find(aSS1); if (aDMSLS.IsBound(aSkey)) { - TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey); + TopTools_ListOfShape &aLS = aDMSLS.ChangeFind(aSkey); aLS.Append(aSS1); - } - else { + } else { TopTools_ListOfShape aLS; // aLS.Append(aSS1); @@ -294,23 +287,22 @@ void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS, } // // 2. - for (i=1; i<=aNbS2; ++i) { - const TopoDS_Shape& aSS2=aMS2(i); + for (i = 1; i <= aNbS2; ++i) { + const TopoDS_Shape &aSS2 = aMS2(i); if (aMS1.Contains(aSS2)) { continue; } // if (!myOriginsDetected.IsBound(aSS2)) { - myErrorStatus=30; + myErrorStatus = 30; return; } // - const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS2); + const TopoDS_Shape &aSkey = myOriginsDetected.Find(aSS2); if (aDMSLS.IsBound(aSkey)) { - TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey); + TopTools_ListOfShape &aLS = aDMSLS.ChangeFind(aSkey); aLS.Append(aSS2); - } - else { + } else { TopTools_ListOfShape aLS; // aLS.Append(aSS2); @@ -321,16 +313,16 @@ void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS, // 3. aItDMSLS.Initialize(aDMSLS); for (; aItDMSLS.More(); aItDMSLS.Next()) { - //const TopoDS_Shape& aSkey=aItDMSLS.Key(); - const TopTools_ListOfShape& aLS=aItDMSLS.Value(); - aNbS=aLS.Extent(); - if (aNbS!=2) { - myErrorStatus=32; + // const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape &aLS = aItDMSLS.Value(); + aNbS = aLS.Extent(); + if (aNbS != 2) { + myErrorStatus = 32; return; } // - const TopoDS_Shape& aSS1=aLS.First(); - const TopoDS_Shape& aSS2=aLS.Last(); + const TopoDS_Shape &aSS1 = aLS.First(); + const TopoDS_Shape &aSS2 = aLS.Last(); aCSS.SetShape1(aSS1); aCSS.SetShape2(aSS2); TreatPair(aCSS, aLCS); @@ -338,20 +330,18 @@ void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS, } //======================================================================= -//function : MapShapes1 -//purpose : +// function : MapShapes1 +// purpose : //======================================================================= -void MapShapes1(const TopoDS_Shape& aS, - const TopAbs_ShapeEnum aType, - TopTools_IndexedMapOfShape& aM) -{ +void MapShapes1(const TopoDS_Shape &aS, const TopAbs_ShapeEnum aType, + TopTools_IndexedMapOfShape &aM) { TopExp_Explorer aExp; - aExp.Init (aS, aType); - for ( ;aExp.More(); aExp.Next()) { - const TopoDS_Shape aSx=aExp.Current(); - if (aType==TopAbs_EDGE) { - const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aSx); + aExp.Init(aS, aType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape aSx = aExp.Current(); + if (aType == TopAbs_EDGE) { + const TopoDS_Edge &aEx = *((TopoDS_Edge *)&aSx); if (BRep_Tool::Degenerated(aEx)) { continue; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx b/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx index 4d7de27bb..d50594cd1 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_GluerAlgo.cxx // Created: @@ -28,118 +29,100 @@ #include //======================================================================= -//function : GEOMAlgo_GluerAlgo -//purpose : +// function : GEOMAlgo_GluerAlgo +// purpose : //======================================================================= -GEOMAlgo_GluerAlgo::GEOMAlgo_GluerAlgo() -{ - myTolerance=0.0001; - myCheckGeometry=Standard_True; +GEOMAlgo_GluerAlgo::GEOMAlgo_GluerAlgo() { + myTolerance = 0.0001; + myCheckGeometry = Standard_True; } //======================================================================= -//function : ~GEOMAlgo_GluerAlgo -//purpose : +// function : ~GEOMAlgo_GluerAlgo +// purpose : //======================================================================= -GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo() -{ -} +GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo() {} //======================================================================= -//function : SetArgument -//purpose : +// function : SetArgument +// purpose : //======================================================================= -void GEOMAlgo_GluerAlgo::SetArgument(const TopoDS_Shape& theShape) -{ - myArgument=theShape; +void GEOMAlgo_GluerAlgo::SetArgument(const TopoDS_Shape &theShape) { + myArgument = theShape; } //======================================================================= -//function : Argument -//purpose : +// function : Argument +// purpose : //======================================================================= -const TopoDS_Shape& GEOMAlgo_GluerAlgo::Argument()const -{ - return myArgument; -} +const TopoDS_Shape &GEOMAlgo_GluerAlgo::Argument() const { return myArgument; } //======================================================================= -//function : SetTolerance -//purpose : +// function : SetTolerance +// purpose : //======================================================================= -void GEOMAlgo_GluerAlgo::SetTolerance(const Standard_Real aT) -{ - myTolerance=aT; +void GEOMAlgo_GluerAlgo::SetTolerance(const Standard_Real aT) { + myTolerance = aT; } //======================================================================= -//function : Tolerance -//purpose : +// function : Tolerance +// purpose : //======================================================================= -Standard_Real GEOMAlgo_GluerAlgo::Tolerance()const -{ - return myTolerance; -} +Standard_Real GEOMAlgo_GluerAlgo::Tolerance() const { return myTolerance; } //======================================================================= -//function : SetCheckGeometry -//purpose : +// function : SetCheckGeometry +// purpose : //======================================================================= -void GEOMAlgo_GluerAlgo::SetCheckGeometry(const Standard_Boolean aFlag) -{ - myCheckGeometry=aFlag; +void GEOMAlgo_GluerAlgo::SetCheckGeometry(const Standard_Boolean aFlag) { + myCheckGeometry = aFlag; } //======================================================================= -//function : CheckGeometry -//purpose : +// function : CheckGeometry +// purpose : //======================================================================= -Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const -{ +Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const { return myCheckGeometry; } //======================================================================= -//function : SetContext -//purpose : +// function : SetContext +// purpose : //======================================================================= -void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext) -{ - myContext=theContext; +void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context) & + theContext) { + myContext = theContext; } //======================================================================= -//function : Context -//purpose : +// function : Context +// purpose : //======================================================================= -const Handle(IntTools_Context)& GEOMAlgo_GluerAlgo::Context() -{ +const Handle(IntTools_Context) & GEOMAlgo_GluerAlgo::Context() { return myContext; } //======================================================================= -//function : Images -//purpose : +// function : Images +// purpose : //======================================================================= -const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_GluerAlgo::Images()const -{ +const TopTools_DataMapOfShapeListOfShape &GEOMAlgo_GluerAlgo::Images() const { return myImages; } //======================================================================= -//function : Origins -//purpose : +// function : Origins +// purpose : //======================================================================= -const TopTools_DataMapOfShapeShape& GEOMAlgo_GluerAlgo::Origins()const -{ +const TopTools_DataMapOfShapeShape &GEOMAlgo_GluerAlgo::Origins() const { return myOrigins; } //======================================================================= -//function : Clear -//purpose : +// function : Clear +// purpose : //======================================================================= -void GEOMAlgo_GluerAlgo::Clear() -{ +void GEOMAlgo_GluerAlgo::Clear() { myImages.Clear(); myOrigins.Clear(); } //======================================================================= -//function : Perform -//purpose : +// function : Perform +// purpose : //======================================================================= -void GEOMAlgo_GluerAlgo::Perform() -{ +void GEOMAlgo_GluerAlgo::Perform() { if (myContext.IsNull()) { - myContext=new IntTools_Context; + myContext = new IntTools_Context; } } diff --git a/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.hxx b/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.hxx index a2050ab24..82e8787b3 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_GluerAlgo.hxx // Created: @@ -29,63 +30,61 @@ #include +#include +#include #include -#include #include -#include -#include #include #include - +#include //======================================================================= -//class : GEOMAlgo_GluerAlgo -//purpose : +// class : GEOMAlgo_GluerAlgo +// purpose : //======================================================================= class GEOMAlgo_GluerAlgo { public: - GEOMALGOIMPL_EXPORT - GEOMAlgo_GluerAlgo(); + GEOMAlgo_GluerAlgo(); GEOMALGOIMPL_EXPORT - virtual ~GEOMAlgo_GluerAlgo(); + virtual ~GEOMAlgo_GluerAlgo(); GEOMALGOIMPL_EXPORT - virtual void SetArgument(const TopoDS_Shape& theShape) ; + virtual void SetArgument(const TopoDS_Shape &theShape); GEOMALGOIMPL_EXPORT - const TopoDS_Shape& Argument() const; + const TopoDS_Shape &Argument() const; GEOMALGOIMPL_EXPORT - void SetTolerance(const Standard_Real aT) ; + void SetTolerance(const Standard_Real aT); GEOMALGOIMPL_EXPORT - Standard_Real Tolerance() const; + Standard_Real Tolerance() const; GEOMALGOIMPL_EXPORT - void SetCheckGeometry(const Standard_Boolean aFlag) ; + void SetCheckGeometry(const Standard_Boolean aFlag); GEOMALGOIMPL_EXPORT - Standard_Boolean CheckGeometry() const; + Standard_Boolean CheckGeometry() const; GEOMALGOIMPL_EXPORT - virtual void Perform() ; + virtual void Perform(); GEOMALGOIMPL_EXPORT - virtual void Clear() ; + virtual void Clear(); GEOMALGOIMPL_EXPORT - void SetContext(const Handle(IntTools_Context)&) ; + void SetContext(const Handle(IntTools_Context) &); GEOMALGOIMPL_EXPORT - const Handle(IntTools_Context)& Context() ; + const Handle(IntTools_Context) & Context(); GEOMALGOIMPL_EXPORT - const TopTools_DataMapOfShapeListOfShape& Images() const; + const TopTools_DataMapOfShapeListOfShape &Images() const; GEOMALGOIMPL_EXPORT - const TopTools_DataMapOfShapeShape& Origins() const; + const TopTools_DataMapOfShapeShape &Origins() const; protected: TopoDS_Shape myArgument; diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx index 1ccb1da63..64253af36 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx @@ -14,31 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_IndexedDataMapOfIntegerShape.hxx // Created: Wed Feb 22 11:22:18 2012 // Author: // - #ifndef GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile #define GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile - - -#include #include #include +#include #define _NCollection_MapHasher #include - -typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfIntegerShape; +typedef NCollection_IndexedDataMap + GEOMAlgo_IndexedDataMapOfIntegerShape; #undef _NCollection_MapHasher - - #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx index b857fdc45..bcbe2dc4e 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx @@ -14,30 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx // Created: Wed Feb 22 11:24:27 2012 // Author: // - #ifndef GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile #define GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile #include -#include #include - +#include #define _NCollection_MapHasher #include - -typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; +typedef NCollection_IndexedDataMap + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; #undef _NCollection_MapHasher - - #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx index 8446eb73f..597c9876f 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx @@ -14,32 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx // Created: Mon Feb 20 09:17:01 2012 -// Author: +// Author: // - #ifndef GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile #define GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile -#include -#include #include +#include +#include #define _NCollection_MapHasher #include +typedef NCollection_IndexedDataMap + GEOMAlgo_IndexedDataMapOfShapeBndSphere; - -typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeBndSphere; - #undef _NCollection_MapHasher - - - #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx index b2bc68b8b..4b9da8973 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_IndexedDataMapOfIndexedMapOfInteger.hxx // Created: Mon Feb 20 09:20:07 2012 @@ -25,23 +26,20 @@ // Author: // - #ifndef GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile #define GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile - -#include -#include #include +#include +#include #define _NCollection_MapHasher #include - -typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape; +typedef NCollection_IndexedDataMap + GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape; #undef _NCollection_MapHasher - #endif - diff --git a/src/GeomAlgoImpl/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx b/src/GeomAlgoImpl/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx index e673848d3..71a7fe690 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx // Created: Wed Feb 22 08:26:34 2012 diff --git a/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx b/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx index 1cd768a53..ca4a36780 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_ListOfCoupleOfShapes.hxx @@ -25,10 +26,11 @@ #ifndef GEOMAlgo_ListOfCoupleOfShapes_HeaderFile #define GEOMAlgo_ListOfCoupleOfShapes_HeaderFile -#include #include +#include typedef NCollection_List GEOMAlgo_ListOfCoupleOfShapes; -typedef GEOMAlgo_ListOfCoupleOfShapes::Iterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; +typedef GEOMAlgo_ListOfCoupleOfShapes::Iterator + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx index 3ca56882e..cf654f03a 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_PassKeyShape.cxx @@ -27,83 +28,74 @@ // #include -#include #include +#include - -static - Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv); +static Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv); //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= - GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape() -{ - myUpper=432123; -} +GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape() { myUpper = 432123; } //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= - GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& aOther) -{ - myUpper=432123; - myNbIds=aOther.myNbIds; - mySum=aOther.mySum; - myMap=aOther.myMap; +GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape( + const GEOMAlgo_PassKeyShape &aOther) { + myUpper = 432123; + myNbIds = aOther.myNbIds; + mySum = aOther.mySum; + myMap = aOther.myMap; } //======================================================================= -//function :~ -//purpose : +// function :~ +// purpose : //======================================================================= - GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() -{ -} +GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() {} //======================================================================= -//function :Assign -//purpose : +// function :Assign +// purpose : //======================================================================= - GEOMAlgo_PassKeyShape& GEOMAlgo_PassKeyShape::Assign(const GEOMAlgo_PassKeyShape& aOther) -{ - myUpper=432123; - myNbIds=aOther.myNbIds; - mySum=aOther.mySum; - myMap=aOther.myMap; +GEOMAlgo_PassKeyShape & +GEOMAlgo_PassKeyShape::Assign(const GEOMAlgo_PassKeyShape &aOther) { + myUpper = 432123; + myNbIds = aOther.myNbIds; + mySum = aOther.mySum; + myMap = aOther.myMap; return *this; } //======================================================================= -//function :Clear -//purpose : +// function :Clear +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::Clear() -{ - myNbIds=0; - mySum=0; +void GEOMAlgo_PassKeyShape::Clear() { + myNbIds = 0; + mySum = 0; myMap.Clear(); } //======================================================================= -//function :SetShapes -//purpose : +// function :SetShapes +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1) +void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape &aS1) { Standard_Integer aHC; // Clear(); - myNbIds=1; + myNbIds = 1; myMap.Add(aS1); - aHC=aS1.HashCode(myUpper); - mySum=NormalizedId(aHC, myNbIds); + aHC = aS1.HashCode(myUpper); + mySum = NormalizedId(aHC, myNbIds); } //======================================================================= -//function :SetShapes -//purpose : +// function :SetShapes +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) -{ +void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape &aS1, + const TopoDS_Shape &aS2) { TopTools_ListOfShape aLS; // aLS.Append(aS1); @@ -111,13 +103,12 @@ static SetShapes(aLS); } //======================================================================= -//function :SetShapes -//purpose : +// function :SetShapes +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3) -{ +void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape &aS1, + const TopoDS_Shape &aS2, + const TopoDS_Shape &aS3) { TopTools_ListOfShape aLS; // aLS.Append(aS1); @@ -126,14 +117,13 @@ static SetShapes(aLS); } //======================================================================= -//function :SetShapes -//purpose : +// function :SetShapes +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3, - const TopoDS_Shape& aS4) -{ +void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape &aS1, + const TopoDS_Shape &aS2, + const TopoDS_Shape &aS3, + const TopoDS_Shape &aS4) { TopTools_ListOfShape aLS; // aLS.Append(aS1); @@ -143,52 +133,48 @@ static SetShapes(aLS); } //======================================================================= -//function :SetShapes -//purpose : +// function :SetShapes +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS) -{ +void GEOMAlgo_PassKeyShape::SetShapes(const TopTools_ListOfShape &aLS) { Standard_Integer i, aId, aIdN; TopTools_ListIteratorOfListOfShape aIt; // Clear(); aIt.Initialize(aLS); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); + const TopoDS_Shape &aS = aIt.Value(); myMap.Add(aS); } - myNbIds=myMap.Extent(); - for(i=1; i<=myNbIds; ++i) { - const TopoDS_Shape& aS=myMap(i); - aId=aS.HashCode(myUpper); - aIdN=NormalizedId(aId, myNbIds); - mySum+=aIdN; + myNbIds = myMap.Extent(); + for (i = 1; i <= myNbIds; ++i) { + const TopoDS_Shape &aS = myMap(i); + aId = aS.HashCode(myUpper); + aIdN = NormalizedId(aId, myNbIds); + mySum += aIdN; } } //======================================================================= -//function :NbIds -//purpose : +// function :NbIds +// purpose : //======================================================================= - Standard_Integer GEOMAlgo_PassKeyShape::NbIds()const -{ - return myNbIds; -} +Standard_Integer GEOMAlgo_PassKeyShape::NbIds() const { return myNbIds; } //======================================================================= -//function :IsEqual -//purpose : +// function :IsEqual +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_PassKeyShape::IsEqual(const GEOMAlgo_PassKeyShape& aOther) const -{ +Standard_Boolean +GEOMAlgo_PassKeyShape::IsEqual(const GEOMAlgo_PassKeyShape &aOther) const { Standard_Boolean bRet; Standard_Integer i; // - bRet=Standard_False; + bRet = Standard_False; // - if (myNbIds!=aOther.myNbIds) { + if (myNbIds != aOther.myNbIds) { return bRet; } - for (i=1; i<=myNbIds; ++i) { - const TopoDS_Shape& aS=myMap(i); + for (i = 1; i <= myNbIds; ++i) { + const TopoDS_Shape &aS = myMap(i); if (!aOther.myMap.Contains(aS)) { return bRet; } @@ -196,34 +182,31 @@ static return !bRet; } //======================================================================= -//function : HashCode -//purpose : +// function : HashCode +// purpose : //======================================================================= - Standard_Integer GEOMAlgo_PassKeyShape::HashCode(const Standard_Integer aUpper) const -{ +Standard_Integer +GEOMAlgo_PassKeyShape::HashCode(const Standard_Integer aUpper) const { return ::HashCode(mySum, aUpper); } //======================================================================= -//function : Dump -//purpose : +// function : Dump +// purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::Dump(const Standard_Integer)const -{ -} +void GEOMAlgo_PassKeyShape::Dump(const Standard_Integer) const {} //======================================================================= // function: NormalizedId // purpose : //======================================================================= Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv) -{ + const Standard_Integer aDiv) { Standard_Integer aMax, aTresh, aIdRet; // - aIdRet=aId; - aMax=::IntegerLast(); - aTresh=aMax/aDiv; - if (aId>aTresh) { - aIdRet=aId%aTresh; + aIdRet = aId; + aMax = ::IntegerLast(); + aTresh = aMax / aDiv; + if (aId > aTresh) { + aIdRet = aId % aTresh; } return aIdRet; } diff --git a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.hxx index 5a1630673..5b42d43c4 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.hxx @@ -18,7 +18,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_PassKeyShape.hxx @@ -32,71 +33,66 @@ #include #include -#include +#include #include +#include #include -#include -#include #include - +#include //======================================================================= -//class : GEOMAlgo_PassKeyShape -//purpose : +// class : GEOMAlgo_PassKeyShape +// purpose : //======================================================================= -class GEOMAlgo_PassKeyShape { - public: +class GEOMAlgo_PassKeyShape { +public: GEOMALGOIMPL_EXPORT - GEOMAlgo_PassKeyShape(); + GEOMAlgo_PassKeyShape(); GEOMALGOIMPL_EXPORT - virtual ~GEOMAlgo_PassKeyShape(); + virtual ~GEOMAlgo_PassKeyShape(); GEOMALGOIMPL_EXPORT - GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& Other); + GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape &Other); GEOMALGOIMPL_EXPORT - GEOMAlgo_PassKeyShape& Assign(const GEOMAlgo_PassKeyShape& Other) ; + GEOMAlgo_PassKeyShape &Assign(const GEOMAlgo_PassKeyShape &Other); - GEOMAlgo_PassKeyShape& operator =(const GEOMAlgo_PassKeyShape& Other) { + GEOMAlgo_PassKeyShape &operator=(const GEOMAlgo_PassKeyShape &Other) { return Assign(Other); } GEOMALGOIMPL_EXPORT - void SetShapes(const TopoDS_Shape& aS) ; + void SetShapes(const TopoDS_Shape &aS); GEOMALGOIMPL_EXPORT - void SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) ; + void SetShapes(const TopoDS_Shape &aS1, const TopoDS_Shape &aS2); GEOMALGOIMPL_EXPORT - void SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3) ; + void SetShapes(const TopoDS_Shape &aS1, const TopoDS_Shape &aS2, + const TopoDS_Shape &aS3); GEOMALGOIMPL_EXPORT - void SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3, - const TopoDS_Shape& aS4) ; + void SetShapes(const TopoDS_Shape &aS1, const TopoDS_Shape &aS2, + const TopoDS_Shape &aS3, const TopoDS_Shape &aS4); GEOMALGOIMPL_EXPORT - void SetShapes(const TopTools_ListOfShape& aLS) ; + void SetShapes(const TopTools_ListOfShape &aLS); GEOMALGOIMPL_EXPORT - void Clear() ; + void Clear(); GEOMALGOIMPL_EXPORT - Standard_Integer NbIds() const; + Standard_Integer NbIds() const; GEOMALGOIMPL_EXPORT - Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const; + Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape &aOther) const; GEOMALGOIMPL_EXPORT - Standard_Integer HashCode(const Standard_Integer Upper) const; + Standard_Integer HashCode(const Standard_Integer Upper) const; GEOMALGOIMPL_EXPORT - void Dump(const Standard_Integer aHex = 0) const; + void Dump(const Standard_Integer aHex = 0) const; protected: Standard_Integer myNbIds; diff --git a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.cxx b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.cxx index ec45ecea5..133e75557 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.cxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_PassKeyMapHasher.cxx @@ -28,20 +29,20 @@ #include //======================================================================= -//function : HashCode -//purpose : +// function : HashCode +// purpose : //======================================================================= - Standard_Integer GEOMAlgo_PassKeyShapeMapHasher::HashCode(const GEOMAlgo_PassKeyShape& aPK, - const Standard_Integer Upper) -{ +Standard_Integer +GEOMAlgo_PassKeyShapeMapHasher::HashCode(const GEOMAlgo_PassKeyShape &aPK, + const Standard_Integer Upper) { return aPK.HashCode(Upper); } //======================================================================= -//function :IsEqual -//purpose : +// function :IsEqual +// purpose : //======================================================================= - Standard_Boolean GEOMAlgo_PassKeyShapeMapHasher::IsEqual(const GEOMAlgo_PassKeyShape& aPK1, - const GEOMAlgo_PassKeyShape& aPK2) -{ +Standard_Boolean +GEOMAlgo_PassKeyShapeMapHasher::IsEqual(const GEOMAlgo_PassKeyShape &aPK1, + const GEOMAlgo_PassKeyShape &aPK2) { return aPK1.IsEqual(aPK2); } diff --git a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.hxx b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.hxx index 7f62b22d6..24f10fece 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShapeMapHasher.hxx @@ -17,7 +17,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: GEOMAlgo_PassKeyMapHasher.hxx @@ -30,25 +31,24 @@ #include +#include #include -#include -#include #include -#include +#include +#include //======================================================================= -//class : GEOMAlgo_PassKeyShapeMapHasher -//purpose : +// class : GEOMAlgo_PassKeyShapeMapHasher +// purpose : //======================================================================= -class GEOMAlgo_PassKeyShapeMapHasher -{ - public: +class GEOMAlgo_PassKeyShapeMapHasher { +public: GEOMALGOIMPL_EXPORT - static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey, - const Standard_Integer Upper) ; + static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape &aPKey, + const Standard_Integer Upper); GEOMALGOIMPL_EXPORT - static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1, - const GEOMAlgo_PassKeyShape& aPKey2) ; + static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape &aPKey1, + const GEOMAlgo_PassKeyShape &aPKey2); }; #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx index 1e7062383..4fe4902f9 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx @@ -14,63 +14,53 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include #include -#include #include #include +#include #include -static - void TreatCompound(const TopoDS_Shape& aC, - NCollection_List& aLSX); +static void TreatCompound(const TopoDS_Shape &aC, + NCollection_List &aLSX); //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= GEOMAlgo_Splitter::GEOMAlgo_Splitter() -: - BOPAlgo_Builder(), - myTools(myAllocator), - myMapTools(100, myAllocator) -{ - myLimit=TopAbs_SHAPE; - myLimitMode=0; + : BOPAlgo_Builder(), myTools(myAllocator), myMapTools(100, myAllocator) { + myLimit = TopAbs_SHAPE; + myLimitMode = 0; } //======================================================================= -//function : -//purpose : +// function : +// purpose : //======================================================================= -GEOMAlgo_Splitter::GEOMAlgo_Splitter - (const Handle(NCollection_BaseAllocator)& theAllocator) -: - BOPAlgo_Builder(theAllocator), - myTools(myAllocator), - myMapTools(100, myAllocator) -{ - myLimit=TopAbs_SHAPE; - myLimitMode=0; +GEOMAlgo_Splitter::GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator) & + theAllocator) + : BOPAlgo_Builder(theAllocator), myTools(myAllocator), + myMapTools(100, myAllocator) { + myLimit = TopAbs_SHAPE; + myLimitMode = 0; } //======================================================================= -//function : ~ -//purpose : +// function : ~ +// purpose : //======================================================================= -GEOMAlgo_Splitter::~GEOMAlgo_Splitter() -{ -} +GEOMAlgo_Splitter::~GEOMAlgo_Splitter() {} //======================================================================= -//function : AddTool -//purpose : +// function : AddTool +// purpose : //======================================================================= -void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape) -{ +void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape &theShape) { if (myMapTools.Add(theShape)) { myTools.Append(theShape); // @@ -78,62 +68,51 @@ void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape) } } //======================================================================= -//function : Tools -//purpose : +// function : Tools +// purpose : //======================================================================= -const NCollection_List& GEOMAlgo_Splitter::Tools()const -{ +const NCollection_List &GEOMAlgo_Splitter::Tools() const { return myTools; } //======================================================================= -//function : SetLimit -//purpose : +// function : SetLimit +// purpose : //======================================================================= -void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit) -{ - myLimit=aLimit; +void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit) { + myLimit = aLimit; } //======================================================================= -//function : Limit -//purpose : +// function : Limit +// purpose : //======================================================================= -TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const -{ - return myLimit; -} +TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit() const { return myLimit; } //======================================================================= -//function : SetLimitMode -//purpose : +// function : SetLimitMode +// purpose : //======================================================================= -void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode) -{ - myLimitMode=aMode; +void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode) { + myLimitMode = aMode; } //======================================================================= -//function : LimitMode -//purpose : +// function : LimitMode +// purpose : //======================================================================= -Standard_Integer GEOMAlgo_Splitter::LimitMode()const -{ - return myLimitMode; -} +Standard_Integer GEOMAlgo_Splitter::LimitMode() const { return myLimitMode; } //======================================================================= -//function : Clear -//purpose : +// function : Clear +// purpose : //======================================================================= -void GEOMAlgo_Splitter::Clear() -{ +void GEOMAlgo_Splitter::Clear() { myTools.Clear(); myMapTools.Clear(); - myLimit=TopAbs_SHAPE; + myLimit = TopAbs_SHAPE; BOPAlgo_Builder::Clear(); } //======================================================================= -//function : BuildResult -//purpose : +// function : BuildResult +// purpose : //======================================================================= -void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) -{ +void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) { TopAbs_ShapeEnum aType; BRep_Builder aBB; NCollection_Map aM; @@ -141,20 +120,19 @@ void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) // aIt.Initialize(myArguments); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - aType=aS.ShapeType(); - if (aType==theType && !myMapTools.Contains(aS)) { + const TopoDS_Shape &aS = aIt.Value(); + aType = aS.ShapeType(); + if (aType == theType && !myMapTools.Contains(aS)) { if (myImages.IsBound(aS)) { - const NCollection_List& aLSIm=myImages.Find(aS); + const NCollection_List &aLSIm = myImages.Find(aS); aItIm.Initialize(aLSIm); for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aSIm=aItIm.Value(); + const TopoDS_Shape &aSIm = aItIm.Value(); if (aM.Add(aSIm)) { aBB.Add(myShape, aSIm); } } - } - else { + } else { if (aM.Add(aS)) { aBB.Add(myShape, aS); } @@ -163,16 +141,16 @@ void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) } } //======================================================================= -//function : PostTreat -//purpose : +// function : PostTreat +// purpose : //======================================================================= #if OCC_VERSION_LARGE < 0x07070000 void GEOMAlgo_Splitter::PostTreat() #else -void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) +void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange &theRange) #endif { - if (myLimit!=TopAbs_SHAPE) { + if (myLimit != TopAbs_SHAPE) { Standard_Integer i, aNbS; BRep_Builder aBB; TopoDS_Compound aC; @@ -181,9 +159,9 @@ void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) aBB.MakeCompound(aC); // TopExp::MapShapes(myShape, myLimit, aMx); - aNbS=aMx.Extent(); - for (i=1; i<=aNbS; ++i) { - const TopoDS_Shape& aS=aMx(i); + aNbS = aMx.Extent(); + for (i = 1; i <= aNbS; ++i) { + const TopoDS_Shape &aS = aMx(i); aBB.Add(aC, aS); } if (myLimitMode) { @@ -191,62 +169,61 @@ void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) TopAbs_ShapeEnum aType, aTypeX; NCollection_List aLSP, aLSX; NCollection_List::Iterator aIt, aItX, aItIm; - NCollection_Map aM; + NCollection_Map aM; // - iLimit=(Standard_Integer)myLimit; + iLimit = (Standard_Integer)myLimit; // // 1. Collect the shapes to process aLSP aIt.Initialize(myArguments); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); + const TopoDS_Shape &aS = aIt.Value(); if (myMapTools.Contains(aS)) { continue; } // - aType=aS.ShapeType(); - iType=(Standard_Integer)aType; + aType = aS.ShapeType(); + iType = (Standard_Integer)aType; // - if (iType>iLimit) { + if (iType > iLimit) { aLSP.Append(aS); } // - else if (aType==TopAbs_COMPOUND) { + else if (aType == TopAbs_COMPOUND) { aLSX.Clear(); // TreatCompound(aS, aLSX); // aItX.Initialize(aLSX); for (; aItX.More(); aItX.Next()) { - const TopoDS_Shape& aSX=aItX.Value(); - aTypeX=aSX.ShapeType(); - iTypeX=(Standard_Integer)aTypeX; + const TopoDS_Shape &aSX = aItX.Value(); + aTypeX = aSX.ShapeType(); + iTypeX = (Standard_Integer)aTypeX; // - if (iTypeX>iLimit) { + if (iTypeX > iLimit) { aLSP.Append(aSX); } } } - }// for (; aIt.More(); aIt.Next()) { + } // for (; aIt.More(); aIt.Next()) { // aMx.Clear(); TopExp::MapShapes(aC, aMx); - // 2. Add them to aC + // 2. Add them to aC aIt.Initialize(aLSP); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); + const TopoDS_Shape &aS = aIt.Value(); if (myImages.IsBound(aS)) { - const NCollection_List& aLSIm=myImages.Find(aS); + const NCollection_List &aLSIm = myImages.Find(aS); aItIm.Initialize(aLSIm); for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aSIm=aItIm.Value(); + const TopoDS_Shape &aSIm = aItIm.Value(); if (aM.Add(aSIm)) { if (!aMx.Contains(aSIm)) { aBB.Add(aC, aSIm); } } } - } - else { + } else { if (aM.Add(aS)) { if (!aMx.Contains(aS)) { aBB.Add(aC, aS); @@ -254,9 +231,9 @@ void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) } } } - }// if (myLimitMode) { - myShape=aC; - }//if (myLimit!=TopAbs_SHAPE) { + } // if (myLimitMode) { + myShape = aC; + } // if (myLimit!=TopAbs_SHAPE) { // Standard_Integer aNbS; TopoDS_Iterator aIt; @@ -264,12 +241,12 @@ void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) // aIt.Initialize(myShape); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); + const TopoDS_Shape &aS = aIt.Value(); aLS.Append(aS); } - aNbS=aLS.Extent(); - if (aNbS==1) { - myShape=aLS.First(); + aNbS = aLS.Extent(); + if (aNbS == 1) { + myShape = aLS.First(); } // #if OCC_VERSION_LARGE < 0x07070000 @@ -279,39 +256,37 @@ void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) #endif } //======================================================================= -//function : TreatCompound -//purpose : +// function : TreatCompound +// purpose : //======================================================================= -void TreatCompound(const TopoDS_Shape& aC1, - NCollection_List& aLSX) -{ +void TreatCompound(const TopoDS_Shape &aC1, + NCollection_List &aLSX) { Standard_Integer aNbC1; TopAbs_ShapeEnum aType; NCollection_List aLC, aLC1; NCollection_List::Iterator aIt, aIt1; TopoDS_Iterator aItC; // - aLC.Append (aC1); - while(1) { + aLC.Append(aC1); + while (1) { aLC1.Clear(); aIt.Initialize(aLC); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aC=aIt.Value(); //C is compound + const TopoDS_Shape &aC = aIt.Value(); // C is compound // aItC.Initialize(aC); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aS=aItC.Value(); - aType=aS.ShapeType(); - if (aType==TopAbs_COMPOUND) { + const TopoDS_Shape &aS = aItC.Value(); + aType = aS.ShapeType(); + if (aType == TopAbs_COMPOUND) { aLC1.Append(aS); - } - else { + } else { aLSX.Append(aS); } } } // - aNbC1=aLC1.Extent(); + aNbC1 = aLC1.Extent(); if (!aNbC1) { break; } @@ -319,14 +294,14 @@ void TreatCompound(const TopoDS_Shape& aC1, aLC.Clear(); aIt.Initialize(aLC1); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSC=aIt.Value(); + const TopoDS_Shape &aSC = aIt.Value(); aLC.Append(aSC); } - }// while(1) + } // while(1) } // // myErrorStatus -// +// // 0 - Ok // 1 - The object is just initialized // 2 - PaveFiller is failed diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx index 79463c937..db34aad7f 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMAlgo_Splitter_HeaderFile @@ -23,9 +24,9 @@ #include #include -#include #include #include +#include #include @@ -38,74 +39,75 @@ #include //======================================================================= -//class : GEOMAlgo_Splitter -//purpose : +// class : GEOMAlgo_Splitter +// purpose : //======================================================================= /*! * \class GEOMAlgo_Splitter * \ingroup DataAlgo * A class for shapes partitioning */ - class GEOMAlgo_Splitter : public BOPAlgo_Builder -{ - public: +class GEOMAlgo_Splitter : public BOPAlgo_Builder { +public: /// Constructor GEOMALGOIMPL_EXPORT GEOMAlgo_Splitter(); /// Constructor /// \param theAllocator an allocator object - GEOMALGOIMPL_EXPORT GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator); - + GEOMALGOIMPL_EXPORT + GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator) & theAllocator); + GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Splitter(); /// Add a tool shape /// \param theShape a tool shape - GEOMALGOIMPL_EXPORT void AddTool(const TopoDS_Shape& theShape); + GEOMALGOIMPL_EXPORT void AddTool(const TopoDS_Shape &theShape); /// Returns list of tool shapes - GEOMALGOIMPL_EXPORT const NCollection_List& Tools()const; + GEOMALGOIMPL_EXPORT const NCollection_List &Tools() const; /// Set type of used shapes /// \param aLimit a shape type GEOMALGOIMPL_EXPORT void SetLimit(const TopAbs_ShapeEnum aLimit); /// Returns defined limit type - GEOMALGOIMPL_EXPORT TopAbs_ShapeEnum Limit()const; + GEOMALGOIMPL_EXPORT TopAbs_ShapeEnum Limit() const; /// Set mode (0 or 1) of limit /// \param aMode the mode value GEOMALGOIMPL_EXPORT void SetLimitMode(const Standard_Integer aMode); /// Returns mode of limit - GEOMALGOIMPL_EXPORT Standard_Integer LimitMode()const; + GEOMALGOIMPL_EXPORT Standard_Integer LimitMode() const; /// Clears all tool shapes GEOMALGOIMPL_EXPORT virtual void Clear(); - protected: - /// Build result. - /// \param theType a type of limit +protected: + /// Build result. + /// \param theType a type of limit GEOMALGOIMPL_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType); /// Post processing of the calculation #if OCC_VERSION_LARGE < 0x07070000 GEOMALGOIMPL_EXPORT virtual void PostTreat(); #else - GEOMALGOIMPL_EXPORT virtual void PostTreat(const Message_ProgressRange& theRange); + GEOMALGOIMPL_EXPORT virtual void + PostTreat(const Message_ProgressRange &theRange); #endif - - protected: - /// List of tools + +protected: + /// List of tools NCollection_List myTools; /// Map of tools NCollection_Map myMapTools; /// A limit type - TopAbs_ShapeEnum myLimit; + TopAbs_ShapeEnum myLimit; /// A limit mode - Standard_Integer myLimitMode; + Standard_Integer myLimitMode; }; #endif diff --git a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx index d8e80e686..451049894 100644 --- a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx +++ b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File : GEOMImpl_Fillet1d.cxx @@ -22,26 +23,25 @@ #include "GEOMImpl_Fillet1d.hxx" -#include #include #include +#include #include #include -#include -#include -#include #include +#include +#include #include #include #include +#include #include #include -#include #include +#include #include - /** * This function returns Standard_True if it is possible to divide edge, i.e. * if one parameter either start or end one is inside the edge. This function @@ -53,37 +53,35 @@ * \return Standard_True if it is possible to split edge; * Standard_False otherwise. */ -static Standard_Boolean IsDivideEdge(const TopoDS_Edge &theEdge, - const Standard_Real theStart, - const Standard_Real theEnd) -{ - Standard_Real aFirst; - Standard_Real aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast); - gp_Pnt aPStart = aCurve->Value(theStart); - gp_Pnt aPEnd = aCurve->Value(theEnd); - TopoDS_Vertex aVFirst = TopExp::FirstVertex(theEdge); - TopoDS_Vertex aVLast = TopExp::LastVertex(theEdge); - Standard_Real aTolFirst = BRep_Tool::Tolerance(aVFirst); - Standard_Real aTolLast = BRep_Tool::Tolerance(aVLast); - Standard_Real aTolConf = Precision::Confusion(); - gp_Pnt aPFirst = BRep_Tool::Pnt(aVFirst); - gp_Pnt aPLast = BRep_Tool::Pnt(aVLast); - Standard_Real aDistSF = aPStart.Distance(aPFirst); - Standard_Real aDistSL = aPStart.Distance(aPLast); - Standard_Real aDistEF = aPEnd.Distance(aPFirst); - Standard_Real aDistEL = aPEnd.Distance(aPLast); - Standard_Boolean isSplit = Standard_True; - - if (aDistSF <= aTolFirst + aTolConf || - aDistSL <= aTolLast + aTolConf) { - if (aDistEF <= aTolFirst + aTolConf || - aDistEL <= aTolLast + aTolConf) { +static Standard_Boolean IsDivideEdge(const TopoDS_Edge &theEdge, + const Standard_Real theStart, + const Standard_Real theEnd) { + Standard_Real aFirst; + Standard_Real aLast; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast); + gp_Pnt aPStart = aCurve->Value(theStart); + gp_Pnt aPEnd = aCurve->Value(theEnd); + TopoDS_Vertex aVFirst = TopExp::FirstVertex(theEdge); + TopoDS_Vertex aVLast = TopExp::LastVertex(theEdge); + Standard_Real aTolFirst = BRep_Tool::Tolerance(aVFirst); + Standard_Real aTolLast = BRep_Tool::Tolerance(aVLast); + Standard_Real aTolConf = Precision::Confusion(); + gp_Pnt aPFirst = BRep_Tool::Pnt(aVFirst); + gp_Pnt aPLast = BRep_Tool::Pnt(aVLast); + Standard_Real aDistSF = aPStart.Distance(aPFirst); + Standard_Real aDistSL = aPStart.Distance(aPLast); + Standard_Real aDistEF = aPEnd.Distance(aPFirst); + Standard_Real aDistEL = aPEnd.Distance(aPLast); + Standard_Boolean isSplit = Standard_True; + + if (aDistSF <= aTolFirst + aTolConf || aDistSL <= aTolLast + aTolConf) { + if (aDistEF <= aTolFirst + aTolConf || aDistEL <= aTolLast + aTolConf) { isSplit = Standard_False; - // in this case the original edge is thrown, and distance (gap) from new arc end - // to a vertex of original wire can reach (aVertexTolerance + Precision::Confusion()). - // Resulting wire is fixed (Mantis issue 0023411) in GEOMImpl_Fillet1dDriver::MakeFillet() + // in this case the original edge is thrown, and distance (gap) from new + // arc end to a vertex of original wire can reach (aVertexTolerance + + // Precision::Confusion()). Resulting wire is fixed (Mantis issue 0023411) + // in GEOMImpl_Fillet1dDriver::MakeFillet() } } @@ -95,26 +93,23 @@ static Standard_Boolean IsDivideEdge(const TopoDS_Edge &theEdge, */ //======================================================================= -//function : Constructor -//purpose : +// function : Constructor +// purpose : //======================================================================= -GEOMImpl_Fillet1d::GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1, - const TopoDS_Edge& theEdge2, - const gp_Pln& thePlane) -: myEdgesExchnged( Standard_False ) -{ +GEOMImpl_Fillet1d::GEOMImpl_Fillet1d(const TopoDS_Edge &theEdge1, + const TopoDS_Edge &theEdge2, + const gp_Pln &thePlane) + : myEdgesExchnged(Standard_False) { myPlane = new Geom_Plane(thePlane); BRepAdaptor_Curve aBAC1(theEdge1); BRepAdaptor_Curve aBAC2(theEdge2); - if (aBAC1.GetType() < aBAC2.GetType()) - { // first curve must be more complicated + if (aBAC1.GetType() < + aBAC2.GetType()) { // first curve must be more complicated myEdge1 = theEdge2; myEdge2 = theEdge1; myEdgesExchnged = Standard_True; - } - else - { + } else { myEdge1 = theEdge1; myEdge2 = theEdge2; } @@ -130,10 +125,9 @@ GEOMImpl_Fillet1d::GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1, while (myCurve2->IsPeriodic() && myStart2 >= myEnd2) myEnd2 += myCurve2->Period(); - if (aBAC1.GetType() == aBAC2.GetType()) - { - if (myEnd2 - myStart2 < myEnd1 - myStart1) - { // first curve must be parametrically shorter + if (aBAC1.GetType() == aBAC2.GetType()) { + if (myEnd2 - myStart2 < + myEnd1 - myStart1) { // first curve must be parametrically shorter TopoDS_Edge anEdge = myEdge1; myEdge1 = myEdge2; myEdge2 = anEdge; @@ -152,47 +146,45 @@ GEOMImpl_Fillet1d::GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1, } //======================================================================= -//function : isRadiusIntersected -//purpose : local function +// function : isRadiusIntersected +// purpose : local function //======================================================================= -static Standard_Boolean isRadiusIntersected(const Handle(Geom2d_Curve)& theCurve, - const gp_Pnt2d theStart, - const gp_Pnt2d theEnd, - const Standard_Boolean theStartConnected) -{ +static Standard_Boolean +isRadiusIntersected(const Handle(Geom2d_Curve) & theCurve, + const gp_Pnt2d theStart, const gp_Pnt2d theEnd, + const Standard_Boolean theStartConnected) { const Standard_Real aTol = Precision::Confusion(); const Standard_Real anAngTol = Precision::Angular(); - Handle(Geom2d_Line) aRadiusLine = new Geom2d_Line (theStart, gp_Dir2d(gp_Vec2d(theStart, theEnd))); - Geom2dAPI_InterCurveCurve anInter (theCurve, aRadiusLine, aTol); + Handle(Geom2d_Line) aRadiusLine = + new Geom2d_Line(theStart, gp_Dir2d(gp_Vec2d(theStart, theEnd))); + Geom2dAPI_InterCurveCurve anInter(theCurve, aRadiusLine, aTol); Standard_Integer a; gp_Pnt2d aPoint; - for(a = anInter.NbPoints(); a > 0; a--) - { + for (a = anInter.NbPoints(); a > 0; a--) { aPoint = anInter.Point(a); - if ( aPoint.Distance(theStart) < aTol && !theStartConnected ) + if (aPoint.Distance(theStart) < aTol && !theStartConnected) return Standard_True; if (aPoint.Distance(theEnd) < aTol * 200) return Standard_True; - if (gp_Vec2d(aPoint, theStart).IsOpposite(gp_Vec2d(aPoint, theEnd), anAngTol)) + if (gp_Vec2d(aPoint, theStart) + .IsOpposite(gp_Vec2d(aPoint, theEnd), anAngTol)) return Standard_True; } Handle(Geom2d_Curve) aCurve; - for(a = anInter.NbSegments(); a > 0; a--) - { + for (a = anInter.NbSegments(); a > 0; a--) { // Porting to DEV version of OCCT 10.02.2017 BEGIN - Standard_NotImplemented::Raise("The treatment of tangential intersection is not implemented"); + Standard_NotImplemented::Raise( + "The treatment of tangential intersection is not implemented"); // Porting to DEV version of OCCT 10.02.2017 END } return Standard_False; } - //======================================================================= -//function : fillPoint -//purpose : +// function : fillPoint +// purpose : //======================================================================= -void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint* thePoint) -{ +void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint *thePoint) { gp_Pnt2d aPoint; gp_Vec2d aVec; const Standard_Real aTol = Precision::Confusion(); @@ -200,7 +192,8 @@ void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint* thePoint) if (aVec.SquareMagnitude() < aTol) return; - gp_Vec2d aPerp(((myStartSide)?-1:1) * aVec.Y(), ((myStartSide)?1:-1) * aVec.X()); + gp_Vec2d aPerp(((myStartSide) ? -1 : 1) * aVec.Y(), + ((myStartSide) ? 1 : -1) * aVec.X()); aPerp.Normalize(); aPerp.Multiply(myRadius); gp_Pnt2d aCenter = aPoint.Translated(aPerp); @@ -216,21 +209,22 @@ void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint* thePoint) Geom2dAPI_ProjectPointOnCurve aProj(aCenter, myCurve2); Standard_Integer a, aNB = aProj.NbPoints(); - for(a = aNB; a > 0; a--) - { + for (a = aNB; a > 0; a--) { if (aPoint.Distance(aProj.Point(a)) < aTol) continue; Standard_Boolean aValid2 = aValid; if (aValid2) - aValid2 = !isRadiusIntersected(myCurve1, aCenter, aProj.Point(a), Standard_False); + aValid2 = !isRadiusIntersected(myCurve1, aCenter, aProj.Point(a), + Standard_False); // checking the right parameter Standard_Real aParam = aProj.Parameter(a); - while(myCurve2->IsPeriodic() && aParam < myStart2) + while (myCurve2->IsPeriodic() && aParam < myStart2) aParam += myCurve2->Period(); - thePoint->AddValue(aProj.Distance(a) * aProj.Distance(a) - myRadius * myRadius, + thePoint->AddValue(aProj.Distance(a) * aProj.Distance(a) - + myRadius * myRadius, (aParam >= myStart2 && aParam <= myEnd2 && aValid2)); if (fabs(fabs(aProj.Distance(a)) - myRadius) < aTol) thePoint->SetParam2(aParam); @@ -238,17 +232,18 @@ void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint* thePoint) } //======================================================================= -//function : fillDiff -//purpose : +// function : fillDiff +// purpose : //======================================================================= -void GEOMImpl_Fillet1d::fillDiff(GEOMImpl_Fillet1dPoint* thePoint, Standard_Real theDiffStep, Standard_Boolean theFront) -{ - GEOMImpl_Fillet1dPoint* aDiff = - new GEOMImpl_Fillet1dPoint(thePoint->GetParam() + (theFront?(theDiffStep):(-theDiffStep))); +void GEOMImpl_Fillet1d::fillDiff(GEOMImpl_Fillet1dPoint *thePoint, + Standard_Real theDiffStep, + Standard_Boolean theFront) { + GEOMImpl_Fillet1dPoint *aDiff = new GEOMImpl_Fillet1dPoint( + thePoint->GetParam() + (theFront ? (theDiffStep) : (-theDiffStep))); fillPoint(aDiff); - if (!thePoint->ComputeDifference(aDiff)) - { - aDiff->SetParam(thePoint->GetParam() + (theFront?(-theDiffStep):(theDiffStep))); + if (!thePoint->ComputeDifference(aDiff)) { + aDiff->SetParam(thePoint->GetParam() + + (theFront ? (-theDiffStep) : (theDiffStep))); fillPoint(aDiff); thePoint->ComputeDifference(aDiff); } @@ -256,34 +251,32 @@ void GEOMImpl_Fillet1d::fillDiff(GEOMImpl_Fillet1dPoint* thePoint, Standard_Real } //======================================================================= -//function : Perform -//purpose : +// function : Perform +// purpose : //======================================================================= -Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) -{ +Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) { myDegreeOfRecursion = 0; myResultParams.Clear(); myResultOrientation.Clear(); Standard_Integer aNBSteps = 100; Geom2dAdaptor_Curve aGAC(myCurve1); - switch (aGAC.GetType()) - { - case GeomAbs_Line: - aNBSteps = 2; - break; - case GeomAbs_Circle: - aNBSteps = 4; - break; - case GeomAbs_Ellipse: - aNBSteps = 5; - break; - case GeomAbs_BezierCurve: - case GeomAbs_BSplineCurve: - aNBSteps = 2 + aGAC.Degree() * aGAC.NbPoles(); - break; - default: // unknown: maximum - aNBSteps = 100; + switch (aGAC.GetType()) { + case GeomAbs_Line: + aNBSteps = 2; + break; + case GeomAbs_Circle: + aNBSteps = 4; + break; + case GeomAbs_Ellipse: + aNBSteps = 5; + break; + case GeomAbs_BezierCurve: + case GeomAbs_BSplineCurve: + aNBSteps = 2 + aGAC.Degree() * aGAC.NbPoles(); + break; + default: // unknown: maximum + aNBSteps = 100; } myRadius = theRadius; @@ -298,19 +291,19 @@ Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) TColStd_ListIteratorOfListOfReal anIter; // Treat intersection points. - for(i = 1; i <= aNb; i++) { + for (i = 1; i <= aNb; i++) { const IntRes2d_IntersectionPoint &aPoint = anInter.Point(i); - Standard_Real aParam = aPoint.ParamOnFirst(); + Standard_Real aParam = aPoint.ParamOnFirst(); // Adjust parameter on periodic curve. if (myCurve1->IsPeriodic()) { - aParam = ElCLib::InPeriod - (aParam, myStart1, myStart1 + myCurve1->Period()); + aParam = + ElCLib::InPeriod(aParam, myStart1, myStart1 + myCurve1->Period()); } if (aParam > myStart1 + aTol && aParam < myEnd1 - aTol) { // Add the point in the list in increasing order. - for(anIter.Initialize(aParams); anIter.More(); anIter.Next()) { + for (anIter.Initialize(aParams); anIter.More(); anIter.Next()) { if (anIter.Value() > aParam) { aParams.InsertBefore(aParam, anIter); break; @@ -326,7 +319,7 @@ Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) // Treat intersection segments. aNb = anInter.NbSegments(); - for(i = 1; i <= aNb; i++) { + for (i = 1; i <= aNb; i++) { const IntRes2d_IntersectionSegment &aSegment = anInter.Segment(i); if (aSegment.HasFirstPoint() && aSegment.HasLastPoint()) { @@ -335,16 +328,16 @@ Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) // Adjust parameters on periodic curve. if (myCurve1->IsPeriodic()) { - ElCLib::AdjustPeriodic(myStart1, myStart1 + myCurve1->Period(), - aTol, aParam1, aParam2); + ElCLib::AdjustPeriodic(myStart1, myStart1 + myCurve1->Period(), aTol, + aParam1, aParam2); } if (aParam1 > myStart1 + aTol && aParam1 < myEnd1 - aTol && aParam2 > myStart1 + aTol && aParam2 < myEnd1 - aTol) { // Add the point in the list in increasing order. - const Standard_Real aParam = 0.5*(aParam1 + aParam2); + const Standard_Real aParam = 0.5 * (aParam1 + aParam2); - for(anIter.Initialize(aParams); anIter.More(); anIter.Next()) { + for (anIter.Initialize(aParams); anIter.More(); anIter.Next()) { if (anIter.Value() > aParam) { aParams.InsertBefore(aParam, anIter); break; @@ -381,26 +374,25 @@ Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) } //======================================================================= -//function : performInterval -//purpose : +// function : performInterval +// purpose : //======================================================================= void GEOMImpl_Fillet1d::performInterval(const Standard_Real theStart, const Standard_Real theEnd, - const Standard_Integer theNBSteps) -{ + const Standard_Integer theNBSteps) { Standard_Real aParam, aStep, aDStep; aStep = (theEnd - theStart) / theNBSteps; - aDStep = aStep/1000.; + aDStep = aStep / 1000.; Standard_Integer aCycle; - for(aCycle = 2, myStartSide = Standard_False; aCycle; myStartSide = !myStartSide, aCycle--) - { + for (aCycle = 2, myStartSide = Standard_False; aCycle; + myStartSide = !myStartSide, aCycle--) { GEOMImpl_Fillet1dPoint *aLeft = NULL, *aRight = NULL; - for(aParam = theStart + aStep; aParam < theEnd || fabs(theEnd - aParam) < Precision::Confusion(); aParam += aStep) - { - if (!aLeft) - { + for (aParam = theStart + aStep; + aParam < theEnd || fabs(theEnd - aParam) < Precision::Confusion(); + aParam += aStep) { + if (!aLeft) { aLeft = new GEOMImpl_Fillet1dPoint(aParam - aStep); fillPoint(aLeft); fillDiff(aLeft, aDStep, Standard_True); @@ -421,43 +413,38 @@ void GEOMImpl_Fillet1d::performInterval(const Standard_Real theStart, } //======================================================================= -//function : processPoint -//purpose : +// function : processPoint +// purpose : //======================================================================= -Standard_Boolean GEOMImpl_Fillet1d::processPoint(GEOMImpl_Fillet1dPoint* theLeft, - GEOMImpl_Fillet1dPoint* theRight, - Standard_Real theParameter) -{ - if (theParameter >= theLeft->GetParam() && theParameter < theRight->GetParam()) - { +Standard_Boolean +GEOMImpl_Fillet1d::processPoint(GEOMImpl_Fillet1dPoint *theLeft, + GEOMImpl_Fillet1dPoint *theRight, + Standard_Real theParameter) { + if (theParameter >= theLeft->GetParam() && + theParameter < theRight->GetParam()) { Standard_Real aDX = theRight->GetParam() - theLeft->GetParam(); - if (theParameter - theLeft->GetParam() < aDX / 100.) - { + if (theParameter - theLeft->GetParam() < aDX / 100.) { theParameter = theLeft->GetParam() + aDX / 100.; } - if (theRight->GetParam() - theParameter < aDX / 100.) - { + if (theRight->GetParam() - theParameter < aDX / 100.) { theParameter = theRight->GetParam() - aDX / 100.; } // Protection on infinite loop. myDegreeOfRecursion++; Standard_Real diffx = 0.001 * aDX; - if (myDegreeOfRecursion > 1000) - { + if (myDegreeOfRecursion > 1000) { + diffx *= 10.0; + if (myDegreeOfRecursion > 10000) { diffx *= 10.0; - if (myDegreeOfRecursion > 10000) - { - diffx *= 10.0; - if (myDegreeOfRecursion > 100000) - { - return Standard_True; - } + if (myDegreeOfRecursion > 100000) { + return Standard_True; } + } } - GEOMImpl_Fillet1dPoint* aPoint1 = theLeft->Copy(); - GEOMImpl_Fillet1dPoint* aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter); + GEOMImpl_Fillet1dPoint *aPoint1 = theLeft->Copy(); + GEOMImpl_Fillet1dPoint *aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter); fillPoint(aPoint2); fillDiff(aPoint2, diffx, Standard_True); @@ -475,19 +462,17 @@ Standard_Boolean GEOMImpl_Fillet1d::processPoint(GEOMImpl_Fillet1dPoint* theLeft } //======================================================================= -//function : performNewton -//purpose : +// function : performNewton +// purpose : //======================================================================= -void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint* theLeft, - GEOMImpl_Fillet1dPoint* theRight) -{ +void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint *theLeft, + GEOMImpl_Fillet1dPoint *theRight) { Standard_Integer a; - // check the left: if this is solution store it and remove it from the list of researching points of theLeft + // check the left: if this is solution store it and remove it from the list of + // researching points of theLeft a = theLeft->HasSolution(myRadius); - if (a) - { - if (theLeft->IsValid(a)) - { + if (a) { + if (theLeft->IsValid(a)) { myResultParams.Append(theLeft->GetParam()); myResultOrientation.Append(myStartSide); } @@ -495,68 +480,66 @@ void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint* theLeft, } Standard_Real aDX = theRight->GetParam() - theLeft->GetParam(); - if ( aDX < Precision::Confusion() / 1000000.) - { + if (aDX < Precision::Confusion() / 1000000.) { a = theRight->HasSolution(myRadius); if (a) - if (theRight->IsValid(a)) - { + if (theRight->IsValid(a)) { myResultParams.Append(theRight->GetParam()); myResultOrientation.Append(myStartSide); } return; } - for(a = 1; a <= theLeft->GetNBValues(); a++) - { + for (a = 1; a <= theLeft->GetNBValues(); a++) { Standard_Integer aNear = theLeft->GetNear(a); Standard_Real aA = (theRight->GetDiff(aNear) - theLeft->GetDiff(a)) / aDX; Standard_Real aB = theLeft->GetDiff(a) - aA * theLeft->GetParam(); - Standard_Real aC = theLeft->GetValue(a) - theLeft->GetDiff(a) * theLeft->GetParam() + + Standard_Real aC = theLeft->GetValue(a) - + theLeft->GetDiff(a) * theLeft->GetParam() + aA * theLeft->GetParam() * theLeft->GetParam() / 2.0; Standard_Real aDet = aB * aB - 2.0 * aA * aC; - if ( fabs(aDet) < gp::Resolution() ) + if (fabs(aDet) < gp::Resolution()) continue; - if (fabs(aA) < Precision::Confusion()) - { // linear case - if (fabs(aB) > 10e-20) - { - Standard_Real aX0 = - aC / aB; // use extremum + if (fabs(aA) < Precision::Confusion()) { // linear case + if (fabs(aB) > 10e-20) { + Standard_Real aX0 = -aC / aB; // use extremum if (aX0 > theLeft->GetParam() && aX0 < theRight->GetParam()) processPoint(theLeft, theRight, aX0); + } else { + processPoint(theLeft, theRight, + theLeft->GetParam() + + aDX / 2.0); // linear division otherwise } - else - { - processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise - } - } - else - { - if (fabs(aB) > fabs(aDet * 1000000.)) - { // possible floating point operations accuracy errors - processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise - } - else - { - if (aDet > 0) - { // two solutions + } else { + if (fabs(aB) > + fabs( + aDet * + 1000000.)) { // possible floating point operations accuracy errors + processPoint(theLeft, theRight, + theLeft->GetParam() + + aDX / 2.0); // linear division otherwise + } else { + if (aDet > 0) { // two solutions aDet = sqrt(aDet); - Standard_Boolean aRes = processPoint(theLeft, theRight, (- aB + aDet) / aA); + Standard_Boolean aRes = + processPoint(theLeft, theRight, (-aB + aDet) / aA); if (!aRes) - aRes = processPoint(theLeft, theRight, (- aB - aDet) / aA); + aRes = processPoint(theLeft, theRight, (-aB - aDet) / aA); if (!aRes) - processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise - } - else - { - Standard_Real aX0 = - aB / aA; // use extremum + processPoint(theLeft, theRight, + theLeft->GetParam() + + aDX / 2.0); // linear division otherwise + } else { + Standard_Real aX0 = -aB / aA; // use extremum if (aX0 > theLeft->GetParam() && aX0 < theRight->GetParam()) processPoint(theLeft, theRight, aX0); else - processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise + processPoint(theLeft, theRight, + theLeft->GetParam() + + aDX / 2.0); // linear division otherwise } } } @@ -564,13 +547,12 @@ void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint* theLeft, } //======================================================================= -//function : Result -//purpose : +// function : Result +// purpose : //======================================================================= -TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, - TopoDS_Edge& theEdge1, - TopoDS_Edge& theEdge2) -{ +TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt &thePoint, + TopoDS_Edge &theEdge1, + TopoDS_Edge &theEdge2) { TopoDS_Edge aResult; gp_Pnt2d aTargetPoint2d; Standard_Real aX, aY; @@ -582,39 +564,39 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, GEOMImpl_Fillet1dPoint *aNearest; Standard_Integer a; TColStd_ListIteratorOfListOfReal anIter(myResultParams); - for(aNearest = NULL, a = 1; anIter.More(); anIter.Next(), a++) - { - myStartSide = (myResultOrientation.Value(a)) ? Standard_True : Standard_False; + for (aNearest = NULL, a = 1; anIter.More(); anIter.Next(), a++) { + myStartSide = + (myResultOrientation.Value(a)) ? Standard_True : Standard_False; GEOMImpl_Fillet1dPoint *aPoint = new GEOMImpl_Fillet1dPoint(anIter.Value()); fillPoint(aPoint); if (!aPoint->HasSolution(myRadius)) continue; - Standard_Real aP = fabs(aPoint->GetCenter().Distance(aTargetPoint2d) - myRadius); - if (!aNearest || aP < aDistance) - { + Standard_Real aP = + fabs(aPoint->GetCenter().Distance(aTargetPoint2d) - myRadius); + if (!aNearest || aP < aDistance) { aNearest = aPoint; aDistance = aP; - } - else - { + } else { delete aPoint; } - } + } if (!aNearest) - return aResult; + return aResult; // create circle edge - gp_Pnt aCenter = ElSLib::PlaneValue(aNearest->GetCenter().X(), - aNearest->GetCenter().Y(), - myPlane->Pln().Position()); - Handle(Geom_Circle) aCircle = - new Geom_Circle(gp_Ax2(aCenter, myPlane->Pln().Axis().Direction()), myRadius); + gp_Pnt aCenter = + ElSLib::PlaneValue(aNearest->GetCenter().X(), aNearest->GetCenter().Y(), + myPlane->Pln().Position()); + Handle(Geom_Circle) aCircle = new Geom_Circle( + gp_Ax2(aCenter, myPlane->Pln().Axis().Direction()), myRadius); gp_Pnt2d aPoint2d1, aPoint2d2; myCurve1->D0(aNearest->GetParam(), aPoint2d1); myCurve2->D0(aNearest->GetParam2(), aPoint2d2); - gp_Pnt aPoint1 = ElSLib::PlaneValue(aPoint2d1.X(), aPoint2d1.Y(), myPlane->Pln().Position()); - gp_Pnt aPoint2 = ElSLib::PlaneValue(aPoint2d2.X(), aPoint2d2.Y(), myPlane->Pln().Position()); + gp_Pnt aPoint1 = ElSLib::PlaneValue(aPoint2d1.X(), aPoint2d1.Y(), + myPlane->Pln().Position()); + gp_Pnt aPoint2 = ElSLib::PlaneValue(aPoint2d2.X(), aPoint2d2.Y(), + myPlane->Pln().Position()); GeomAPI_ProjectPointOnCurve aProj(thePoint, aCircle); Standard_Real aTarGetParam = aProj.LowerDistanceParameter(); @@ -623,23 +605,22 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, // Check extrema point manually, because there is a bug in Open CASCADE // in calculation of nearest point to a circle near the parameter 0.0 gp_Pnt p0 = ElCLib::Value(0.0, aCircle->Circ()); - if (p0.Distance(thePoint) < aPointOnCircle.Distance(thePoint)) - { - aTarGetParam = 0.0; - aPointOnCircle = p0; + if (p0.Distance(thePoint) < aPointOnCircle.Distance(thePoint)) { + aTarGetParam = 0.0; + aPointOnCircle = p0; } aProj.Perform(aPoint1); Standard_Real aParam1 = aProj.LowerDistanceParameter(); - aProj.Perform(aPoint2); + aProj.Perform(aPoint2); Standard_Real aParam2 = aProj.LowerDistanceParameter(); - Standard_Boolean aIsOut = ((aParam1 < aTarGetParam && aParam2 < aTarGetParam) || - (aParam1 > aTarGetParam && aParam2 > aTarGetParam)); + Standard_Boolean aIsOut = + ((aParam1 < aTarGetParam && aParam2 < aTarGetParam) || + (aParam1 > aTarGetParam && aParam2 > aTarGetParam)); if (aParam1 > aParam2) aIsOut = !aIsOut; - BRepBuilderAPI_MakeEdge aBuilder(aCircle->Circ(), - aIsOut ? aParam2 : aParam1, - aIsOut? aParam1 : aParam2); + BRepBuilderAPI_MakeEdge aBuilder(aCircle->Circ(), aIsOut ? aParam2 : aParam1, + aIsOut ? aParam1 : aParam2); aResult = aBuilder.Edge(); // divide edges @@ -655,16 +636,14 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, else anEnd = aNearest->GetParam(); - if (IsDivideEdge(myEdge1, aStart, anEnd)) - { - //Divide edge - BRepBuilderAPI_MakeEdge aDivider1(aCurve, aStart, anEnd); - if (myEdgesExchnged) - theEdge2 = aDivider1.Edge(); - else - theEdge1 = aDivider1.Edge(); - } - else { + if (IsDivideEdge(myEdge1, aStart, anEnd)) { + // Divide edge + BRepBuilderAPI_MakeEdge aDivider1(aCurve, aStart, anEnd); + if (myEdgesExchnged) + theEdge2 = aDivider1.Edge(); + else + theEdge1 = aDivider1.Edge(); + } else { // error: filleted edge becomes degenerated aResult = TopoDS_Edge(); } @@ -678,15 +657,13 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, else anEnd = aNearest->GetParam2(); - if (IsDivideEdge(myEdge2, aStart, anEnd)) - { - BRepBuilderAPI_MakeEdge aDivider2(aCurve, aStart, anEnd); - if (myEdgesExchnged) - theEdge1 = aDivider2.Edge(); - else - theEdge2 = aDivider2.Edge(); - } - else { + if (IsDivideEdge(myEdge2, aStart, anEnd)) { + BRepBuilderAPI_MakeEdge aDivider2(aCurve, aStart, anEnd); + if (myEdgesExchnged) + theEdge1 = aDivider2.Edge(); + else + theEdge2 = aDivider2.Edge(); + } else { // error: filleted edge becomes degenerated aResult = TopoDS_Edge(); } @@ -696,16 +673,14 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, } //======================================================================= -//function : AddValue -//purpose : +// function : AddValue +// purpose : //======================================================================= -void GEOMImpl_Fillet1dPoint::AddValue(Standard_Real theValue, Standard_Boolean theValid) -{ +void GEOMImpl_Fillet1dPoint::AddValue(Standard_Real theValue, + Standard_Boolean theValid) { Standard_Integer a; - for(a = 1; a <= myV.Length(); a++) - { - if (theValue < myV.Value(a)) - { + for (a = 1; a <= myV.Length(); a++) { + if (theValue < myV.Value(a)) { myV.InsertBefore(a, theValue); myValid.InsertBefore(a, (Standard_Integer)theValid); return; @@ -716,45 +691,38 @@ void GEOMImpl_Fillet1dPoint::AddValue(Standard_Real theValue, Standard_Boolean t } //======================================================================= -//function : ComputeDifference -//purpose : +// function : ComputeDifference +// purpose : //======================================================================= -Standard_Boolean GEOMImpl_Fillet1dPoint::ComputeDifference(GEOMImpl_Fillet1dPoint* thePoint) -{ +Standard_Boolean +GEOMImpl_Fillet1dPoint::ComputeDifference(GEOMImpl_Fillet1dPoint *thePoint) { Standard_Integer a; Standard_Boolean aDiffsSet = (myD.Length() != 0); Standard_Real aDX = thePoint->GetParam() - myParam, aDY = 0.0; - if (thePoint->myV.Length() == myV.Length()) - { // absolutely the same points - for(a = 1; a <= myV.Length(); a++) - { + if (thePoint->myV.Length() == myV.Length()) { // absolutely the same points + for (a = 1; a <= myV.Length(); a++) { aDY = thePoint->myV.Value(a) - myV.Value(a); - if ( aDiffsSet ) - myD.SetValue(a, fabs(aDX) > gp::Resolution() ? (aDY/aDX) : 0); + if (aDiffsSet) + myD.SetValue(a, fabs(aDX) > gp::Resolution() ? (aDY / aDX) : 0); else - myD.Append( fabs(aDX) > gp::Resolution() ? (aDY/aDX) : 0); + myD.Append(fabs(aDX) > gp::Resolution() ? (aDY / aDX) : 0); } return Standard_True; } // between the diffeerent points searching for nearest analogs Standard_Integer b; - for(a = 1; a <= myV.Length(); a++) - { - for(b = 1; b <= thePoint->myV.Length(); b++) - { + for (a = 1; a <= myV.Length(); a++) { + for (b = 1; b <= thePoint->myV.Length(); b++) { if (b == 1 || fabs(thePoint->myV.Value(b) - myV.Value(a)) < fabs(aDY)) aDY = thePoint->myV.Value(b) - myV.Value(a); } - if (aDiffsSet) - { - if ( fabs(aDX) > gp::Resolution() && fabs(aDY / aDX) < fabs(myD.Value(a))) + if (aDiffsSet) { + if (fabs(aDX) > gp::Resolution() && fabs(aDY / aDX) < fabs(myD.Value(a))) myD.SetValue(a, aDY / aDX); else myD.SetValue(a, 0); - } - else - { - myD.Append( fabs(aDX) > gp::Resolution() ? aDY/aDX : 0); + } else { + myD.Append(fabs(aDX) > gp::Resolution() ? aDY / aDX : 0); } } @@ -762,97 +730,79 @@ Standard_Boolean GEOMImpl_Fillet1dPoint::ComputeDifference(GEOMImpl_Fillet1dPoin } //======================================================================= -//function : FilterPoints -//purpose : +// function : FilterPoints +// purpose : //======================================================================= -void GEOMImpl_Fillet1dPoint::FilterPoints(GEOMImpl_Fillet1dPoint* thePoint) -{ +void GEOMImpl_Fillet1dPoint::FilterPoints(GEOMImpl_Fillet1dPoint *thePoint) { Standard_Integer a, b; TColStd_SequenceOfReal aDiffs; Standard_Real aY, aY2, aDX = thePoint->GetParam() - myParam; - for(a = 1; a <= myV.Length(); a++) - { + for (a = 1; a <= myV.Length(); a++) { // searching for near point from thePoint Standard_Integer aNear = 0; Standard_Real aDiff = aDX * 10000.; aY = myV.Value(a) + myD.Value(a) * aDX; - for(b = 1; b <= thePoint->myV.Length(); b++) - { - // calculate hypothesis value of the Y2 with the constant first and second derivative + for (b = 1; b <= thePoint->myV.Length(); b++) { + // calculate hypothesis value of the Y2 with the constant first and second + // derivative aY2 = aY + aDX * (thePoint->myD.Value(b) - myD.Value(a)) / 2.0; - if (aNear == 0 || fabs(aY2 - thePoint->myV.Value(b)) < fabs(aDiff)) - { + if (aNear == 0 || fabs(aY2 - thePoint->myV.Value(b)) < fabs(aDiff)) { aNear = b; aDiff = aY2 - thePoint->myV.Value(b); } - }//for b... - - if (aNear) - { - if (myV.Value(a) * thePoint->myV.Value(aNear) > 0) - {// the same sign at the same sides of the interval - if (myV.Value(a) * myD.Value(a) > 0) - { + } // for b... + + if (aNear) { + if (myV.Value(a) * thePoint->myV.Value(aNear) > + 0) { // the same sign at the same sides of the interval + if (myV.Value(a) * myD.Value(a) > 0) { if (fabs(myD.Value(a)) > Precision::Confusion()) aNear = 0; - } - else - { + } else { if (fabs(myV.Value(a)) > fabs(thePoint->myV.Value(aNear))) if (thePoint->myV.Value(aNear) * thePoint->myD.Value(aNear) < 0 && - fabs(thePoint->myD.Value(aNear)) > Precision::Confusion()) - { + fabs(thePoint->myD.Value(aNear)) > Precision::Confusion()) { aNear = 0; } } } } - if (aNear) - { - if (myV.Value(a) * thePoint->myV.Value(aNear) > 0) - { - if ((myV.Value(a) + myD.Value(a) * aDX) * myV.Value(a) > Precision::Confusion() && - (thePoint->myV.Value(aNear) + thePoint->myD.Value(aNear) * aDX) * thePoint->myV.Value(aNear) > Precision::Confusion()) - { + if (aNear) { + if (myV.Value(a) * thePoint->myV.Value(aNear) > 0) { + if ((myV.Value(a) + myD.Value(a) * aDX) * myV.Value(a) > + Precision::Confusion() && + (thePoint->myV.Value(aNear) + thePoint->myD.Value(aNear) * aDX) * + thePoint->myV.Value(aNear) > + Precision::Confusion()) { aNear = 0; } } } - if (aNear) - { - if ( fabs(aDX) < gp::Resolution() || fabs(aDiff / aDX) > 1.e+7) - { + if (aNear) { + if (fabs(aDX) < gp::Resolution() || fabs(aDiff / aDX) > 1.e+7) { aNear = 0; } } - if (aNear == 0) - { // there is no near: remove it from the list + if (aNear == 0) { // there is no near: remove it from the list myV.Remove(a); myD.Remove(a); myValid.Remove(a); a--; - } - else - { + } else { Standard_Boolean aFound = Standard_False; - for(b = 1; b <= myNear.Length(); b++) - { - if (myNear.Value(b) == aNear) - { - if (fabs(aDiffs.Value(b)) < fabs(aDiff)) - { // return this 'near' + for (b = 1; b <= myNear.Length(); b++) { + if (myNear.Value(b) == aNear) { + if (fabs(aDiffs.Value(b)) < fabs(aDiff)) { // return this 'near' aFound = Standard_True; myV.Remove(a); myD.Remove(a); myValid.Remove(a); a--; break; - } - else - { // remove the old 'near' + } else { // remove the old 'near' myV.Remove(b); myD.Remove(b); myValid.Remove(b); @@ -862,26 +812,23 @@ void GEOMImpl_Fillet1dPoint::FilterPoints(GEOMImpl_Fillet1dPoint* thePoint) break; } } - }//for b... - if (!aFound) - { + } // for b... + if (!aFound) { myNear.Append(aNear); aDiffs.Append(aDiff); } } - }//for a... + } // for a... } //======================================================================= -//function : Copy -//purpose : +// function : Copy +// purpose : //======================================================================= -GEOMImpl_Fillet1dPoint* GEOMImpl_Fillet1dPoint::Copy() -{ - GEOMImpl_Fillet1dPoint* aCopy = new GEOMImpl_Fillet1dPoint(myParam); +GEOMImpl_Fillet1dPoint *GEOMImpl_Fillet1dPoint::Copy() { + GEOMImpl_Fillet1dPoint *aCopy = new GEOMImpl_Fillet1dPoint(myParam); Standard_Integer a; - for(a = 1; a <= myV.Length(); a++) - { + for (a = 1; a <= myV.Length(); a++) { aCopy->myV.Append(myV.Value(a)); aCopy->myD.Append(myD.Value(a)); aCopy->myValid.Append(myValid.Value(a)); @@ -890,26 +837,25 @@ GEOMImpl_Fillet1dPoint* GEOMImpl_Fillet1dPoint::Copy() } //======================================================================= -//function : HasSolution -//purpose : +// function : HasSolution +// purpose : //======================================================================= -Standard_Integer GEOMImpl_Fillet1dPoint::HasSolution(const Standard_Real theRadius) -{ +Standard_Integer +GEOMImpl_Fillet1dPoint::HasSolution(const Standard_Real theRadius) { Standard_Integer a; - for(a = 1; a <= myV.Length(); a++) - { - if (fabs(sqrt(fabs(fabs(myV.Value(a)) + theRadius * theRadius)) - theRadius) < Precision::Confusion() / 10.) + for (a = 1; a <= myV.Length(); a++) { + if (fabs(sqrt(fabs(fabs(myV.Value(a)) + theRadius * theRadius)) - + theRadius) < Precision::Confusion() / 10.) return a; } return 0; } //======================================================================= -//function : RemoveSolution -//purpose : +// function : RemoveSolution +// purpose : //======================================================================= -void GEOMImpl_Fillet1dPoint::RemoveSolution(Standard_Integer theIndex) -{ +void GEOMImpl_Fillet1dPoint::RemoveSolution(Standard_Integer theIndex) { myV.Remove(theIndex); myD.Remove(theIndex); myValid.Remove(theIndex); diff --git a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.hxx b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.hxx index da81084bc..8ca4963a4 100644 --- a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.hxx +++ b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File : GEOMImpl_Fillet1d.hxx @@ -25,45 +26,47 @@ #include -#include #include +#include #include #include -#include #include +#include class GEOMImpl_Fillet1dPoint; /** -* GEOMImpl_Fillet1d is 1D fillet algorithm on two planar edges with given radius -*/ + * GEOMImpl_Fillet1d is 1D fillet algorithm on two planar edges with given + * radius + */ -class GEOMImpl_Fillet1d -{ +class GEOMImpl_Fillet1d { public: //! Constructor //! The fillet 1D algorithm is initialised by two edges and plane - Standard_EXPORT GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1, - const TopoDS_Edge& theEdge2, - const gp_Pln& thePlane); + Standard_EXPORT GEOMImpl_Fillet1d(const TopoDS_Edge &theEdge1, + const TopoDS_Edge &theEdge2, + const gp_Pln &thePlane); //! Makes fillet with given radius //! @returns Standard_True, if at least one result computed Standard_EXPORT Standard_Boolean Perform(const Standard_Real theRadius); //! Returns result fillet edge and modified edges as out parameters - Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint, TopoDS_Edge& theEdge1, TopoDS_Edge& theEdge2); + Standard_EXPORT TopoDS_Edge Result(const gp_Pnt &thePoint, + TopoDS_Edge &theEdge1, + TopoDS_Edge &theEdge2); private: //! private methods - void performInterval(const Standard_Real theStart, - const Standard_Real theEnd, + void performInterval(const Standard_Real theStart, const Standard_Real theEnd, const Standard_Integer theNBSteps); - void fillPoint(GEOMImpl_Fillet1dPoint*); - void fillDiff(GEOMImpl_Fillet1dPoint*, Standard_Real, Standard_Boolean); - void performNewton(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*); - Standard_Boolean processPoint(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*, Standard_Real); + void fillPoint(GEOMImpl_Fillet1dPoint *); + void fillDiff(GEOMImpl_Fillet1dPoint *, Standard_Real, Standard_Boolean); + void performNewton(GEOMImpl_Fillet1dPoint *, GEOMImpl_Fillet1dPoint *); + Standard_Boolean processPoint(GEOMImpl_Fillet1dPoint *, + GEOMImpl_Fillet1dPoint *, Standard_Real); private: //! private fields @@ -77,59 +80,64 @@ private: Standard_Integer myDegreeOfRecursion; }; - /** -* GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm -* to store and compare computed solutions on edges -*/ + * GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm + * to store and compare computed solutions on edges + */ -class GEOMImpl_Fillet1dPoint -{ +class GEOMImpl_Fillet1dPoint { public: //! Puiblic methods //! Constructor - Standard_EXPORT GEOMImpl_Fillet1dPoint(Standard_Real theParam) - {myParam = theParam;} + Standard_EXPORT GEOMImpl_Fillet1dPoint(Standard_Real theParam) { + myParam = theParam; + } //! Make copy of point - //!WARNING: Copies only field values: myParam, myV, myD, myValid - Standard_EXPORT GEOMImpl_Fillet1dPoint* Copy(); // warning: this is not the full copy! + //! WARNING: Copies only field values: myParam, myV, myD, myValid + Standard_EXPORT GEOMImpl_Fillet1dPoint * + Copy(); // warning: this is not the full copy! //! Set/Get parameter - Standard_EXPORT inline void SetParam(Standard_Real theParam) - {myParam = theParam;} - Standard_EXPORT inline Standard_Real GetParam() const - {return myParam;} - Standard_EXPORT inline void SetParam2(const Standard_Real theParam2) - {myParam2 = theParam2;} - Standard_EXPORT inline Standard_Real GetParam2() - { return myParam2 ; } + Standard_EXPORT inline void SetParam(Standard_Real theParam) { + myParam = theParam; + } + Standard_EXPORT inline Standard_Real GetParam() const { return myParam; } + Standard_EXPORT inline void SetParam2(const Standard_Real theParam2) { + myParam2 = theParam2; + } + Standard_EXPORT inline Standard_Real GetParam2() { return myParam2; } //! Returns validity - Standard_EXPORT inline Standard_Boolean IsValid(int theIndex) - {return (Standard_Boolean)myValid.Value(theIndex);} + Standard_EXPORT inline Standard_Boolean IsValid(int theIndex) { + return (Standard_Boolean)myValid.Value(theIndex); + } //! Get values - Standard_EXPORT inline Standard_Integer GetNBValues() {return myV.Length();} - Standard_EXPORT inline Standard_Real GetValue(Standard_Integer theIndex) - {return myV.Value(theIndex);} - Standard_EXPORT inline Standard_Real GetDiff(Standard_Integer theIndex) - {return myD.Value(theIndex);} - Standard_EXPORT inline Standard_Integer GetNear(Standard_Integer theIndex) - {return myNear.Value(theIndex);} + Standard_EXPORT inline Standard_Integer GetNBValues() { return myV.Length(); } + Standard_EXPORT inline Standard_Real GetValue(Standard_Integer theIndex) { + return myV.Value(theIndex); + } + Standard_EXPORT inline Standard_Real GetDiff(Standard_Integer theIndex) { + return myD.Value(theIndex); + } + Standard_EXPORT inline Standard_Integer GetNear(Standard_Integer theIndex) { + return myNear.Value(theIndex); + } //! Set/Get center point - Standard_EXPORT inline void SetCenter(const gp_Pnt2d thePoint) - {myCenter = thePoint;} - Standard_EXPORT inline const gp_Pnt2d GetCenter() - {return myCenter;} + Standard_EXPORT inline void SetCenter(const gp_Pnt2d thePoint) { + myCenter = thePoint; + } + Standard_EXPORT inline const gp_Pnt2d GetCenter() { return myCenter; } - Standard_EXPORT void AddValue(Standard_Real theValue, Standard_Boolean theIsValid); + Standard_EXPORT void AddValue(Standard_Real theValue, + Standard_Boolean theIsValid); //! compute difference between this and given point - Standard_EXPORT Standard_Boolean ComputeDifference(GEOMImpl_Fillet1dPoint*); - Standard_EXPORT void FilterPoints(GEOMImpl_Fillet1dPoint*); + Standard_EXPORT Standard_Boolean ComputeDifference(GEOMImpl_Fillet1dPoint *); + Standard_EXPORT void FilterPoints(GEOMImpl_Fillet1dPoint *); //! Checks if point contains solution and returns the index of it if any Standard_EXPORT Standard_Integer HasSolution(Standard_Real theRadius); diff --git a/src/GeomAlgoImpl/GeomAlgoImpl.h b/src/GeomAlgoImpl/GeomAlgoImpl.h index 4c9c290ef..b82fdf0bb 100644 --- a/src/GeomAlgoImpl/GeomAlgoImpl.h +++ b/src/GeomAlgoImpl/GeomAlgoImpl.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMALGOIMPL_H @@ -22,13 +23,13 @@ #if defined GEOMALGOIMPL_EXPORTS #if defined WIN32 -#define GEOMALGOIMPL_EXPORT __declspec( dllexport ) +#define GEOMALGOIMPL_EXPORT __declspec(dllexport) #else #define GEOMALGOIMPL_EXPORT #endif #else #if defined WIN32 -#define GEOMALGOIMPL_EXPORT __declspec( dllimport ) +#define GEOMALGOIMPL_EXPORT __declspec(dllimport) #else #define GEOMALGOIMPL_EXPORT #endif diff --git a/src/GeomData/GeomData.h b/src/GeomData/GeomData.h index 4ee0355d8..8632d0ab7 100644 --- a/src/GeomData/GeomData.h +++ b/src/GeomData/GeomData.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMDATA_H @@ -22,13 +23,13 @@ #if defined GEOMDATA_EXPORTS #if defined WIN32 -#define GEOMDATA_EXPORT __declspec( dllexport ) +#define GEOMDATA_EXPORT __declspec(dllexport) #else #define GEOMDATA_EXPORT #endif #else #if defined WIN32 -#define GEOMDATA_EXPORT __declspec( dllimport ) +#define GEOMDATA_EXPORT __declspec(dllimport) #else #define GEOMDATA_EXPORT #endif diff --git a/src/GeomData/GeomData_Dir.cpp b/src/GeomData/GeomData_Dir.cpp index 400e89d49..cc7958a83 100644 --- a/src/GeomData/GeomData_Dir.cpp +++ b/src/GeomData/GeomData_Dir.cpp @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomData_Dir.h" #include #include -#include -#include #include +#include +#include -void GeomData_Dir::setValue(const double theX, const double theY, const double theZ) -{ - if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY - || myCoords->Value(2) != theZ) { +void GeomData_Dir::setValue(const double theX, const double theY, + const double theZ) { + if (!myIsInitialized || myCoords->Value(0) != theX || + myCoords->Value(1) != theY || myCoords->Value(2) != theZ) { myCoords->SetValue(0, theX); myCoords->SetValue(1, theY); myCoords->SetValue(2, theZ); @@ -35,47 +36,34 @@ void GeomData_Dir::setValue(const double theX, const double theY, const double t } } -void GeomData_Dir::setValue(const std::shared_ptr& theDir) -{ +void GeomData_Dir::setValue(const std::shared_ptr &theDir) { setValue(theDir->x(), theDir->y(), theDir->z()); } -double GeomData_Dir::x() const -{ - return myCoords->Value(0); -} +double GeomData_Dir::x() const { return myCoords->Value(0); } -double GeomData_Dir::y() const -{ - return myCoords->Value(1); -} +double GeomData_Dir::y() const { return myCoords->Value(1); } -double GeomData_Dir::z() const -{ - return myCoords->Value(2); -} +double GeomData_Dir::z() const { return myCoords->Value(2); } -std::shared_ptr GeomData_Dir::dir() -{ - return std::shared_ptr( - new GeomAPI_Dir(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2))); +std::shared_ptr GeomData_Dir::dir() { + return std::shared_ptr(new GeomAPI_Dir( + myCoords->Value(0), myCoords->Value(1), myCoords->Value(2))); } -std::shared_ptr GeomData_Dir::xyz() -{ - return std::shared_ptr( - new GeomAPI_XYZ(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2))); +std::shared_ptr GeomData_Dir::xyz() { + return std::shared_ptr(new GeomAPI_XYZ( + myCoords->Value(0), myCoords->Value(1), myCoords->Value(2))); } -GeomData_Dir::GeomData_Dir(TDF_Label& theLabel) -{ +GeomData_Dir::GeomData_Dir(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void GeomData_Dir::reinit() -{ - myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True; +void GeomData_Dir::reinit() { + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), + myCoords) == Standard_True; if (!myIsInitialized) { // create attribute: not initialized by value yet, just zero myCoords = TDataStd_RealArray::Set(myLab, 0, 2); @@ -83,8 +71,7 @@ void GeomData_Dir::reinit() } } -void GeomData_Dir::reset() -{ +void GeomData_Dir::reset() { if (myLab.FindAttribute(TDataStd_RealArray::GetID(), myCoords)) { // invalidate values of the direction myCoords->SetValue(0, 0.0); @@ -94,17 +81,22 @@ void GeomData_Dir::reset() GeomDataAPI_Dir::reset(); } -bool GeomData_Dir::isInitialized() -{ +bool GeomData_Dir::isInitialized() { // Check once again the direction is initialized. - // Use case (bos #18905): draw a sketch, click "Change sketch plane", then abort it. - // myIsInitialized value is dropped to false, thus recheck. + // Use case (bos #18905): draw a sketch, click "Change sketch plane", then + // abort it. + // myIsInitialized value is dropped to false, thus + // recheck. // Additionally verify the values are valid. - // Use case (bos #24206): start a sketch, highlight a coordinate plane, then click anywhere - // in empty space. Sketch features in menu appears and can be selected. + // Use case (bos #24206): start a sketch, highlight a coordinate plane, then + // click anywhere + // in empty space. Sketch features in menu appears and + // can be selected. if (!myIsInitialized) { - myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True - && myCoords->Value(0) != 0.0 && myCoords->Value(1) != 0.0 && myCoords->Value(2) != 0.0; + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), + myCoords) == Standard_True && + myCoords->Value(0) != 0.0 && myCoords->Value(1) != 0.0 && + myCoords->Value(2) != 0.0; } return ModelAPI_Attribute::isInitialized(); } diff --git a/src/GeomData/GeomData_Dir.h b/src/GeomData/GeomData_Dir.h index be488e86f..f2bd302b8 100644 --- a/src/GeomData/GeomData_Dir.h +++ b/src/GeomData/GeomData_Dir.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomData_Dir_H_ @@ -22,8 +23,8 @@ #include "GeomData.h" #include "GeomDataAPI_Dir.h" -#include #include +#include #include class GeomAPI_Dir; @@ -33,15 +34,17 @@ class GeomAPI_XYZ; * \ingroup DataModel * \brief Attribute that contains direction. */ -class GeomData_Dir : public GeomDataAPI_Dir -{ +class GeomData_Dir : public GeomDataAPI_Dir { TDF_Label myLab; ///< the main label of the attribute - Handle_TDataStd_RealArray myCoords; ///< X, Y and Z doubles as real array attribute [0; 2] - public: + Handle_TDataStd_RealArray + myCoords; ///< X, Y and Z doubles as real array attribute [0; 2] +public: /// Defines the double value - GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ); + GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, + const double theZ); /// Defines the direction - GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr& theDir); + GEOMDATA_EXPORT virtual void + setValue(const std::shared_ptr &theDir); /// Returns the X double value GEOMDATA_EXPORT virtual double x() const; @@ -60,10 +63,11 @@ class GeomData_Dir : public GeomDataAPI_Dir /// Resets attribute to default state. GEOMDATA_EXPORT virtual void reset(); - protected: +protected: /// Initializes attributes - GEOMDATA_EXPORT GeomData_Dir(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + GEOMDATA_EXPORT GeomData_Dir(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/GeomData/GeomData_Point.cpp b/src/GeomData/GeomData_Point.cpp index 6e028ff1c..35945e623 100644 --- a/src/GeomData/GeomData_Point.cpp +++ b/src/GeomData/GeomData_Point.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomData_Point.h" @@ -28,22 +29,19 @@ #include -GeomData_Point::GeomData_Point() -{ - myIsInitialized = false; -} +GeomData_Point::GeomData_Point() { myIsInitialized = false; } -void GeomData_Point::reinit() -{ +void GeomData_Point::reinit() { myIsInitialized = true; for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { myExpression[aComponent]->reinit(); - myIsInitialized = myIsInitialized && myExpression[aComponent]->isInitialized(); + myIsInitialized = + myIsInitialized && myExpression[aComponent]->isInitialized(); } } -void GeomData_Point::setCalculatedValue(const double theX, const double theY, const double theZ) -{ +void GeomData_Point::setCalculatedValue(const double theX, const double theY, + const double theZ) { if (!myIsInitialized || x() != theX || y() != theY || z() != theZ) { myExpression[0]->setValue(theX); myExpression[1]->setValue(theY); @@ -52,35 +50,23 @@ void GeomData_Point::setCalculatedValue(const double theX, const double theY, co } } -void GeomData_Point::setValue(const double theX, const double theY, const double theZ) -{ - setCalculatedValue(textX().empty() ? theX : x(), - textY().empty() ? theY : y(), +void GeomData_Point::setValue(const double theX, const double theY, + const double theZ) { + setCalculatedValue(textX().empty() ? theX : x(), textY().empty() ? theY : y(), textZ().empty() ? theZ : z()); } -void GeomData_Point::setValue(const std::shared_ptr& thePoint) -{ +void GeomData_Point::setValue(const std::shared_ptr &thePoint) { setValue(thePoint->x(), thePoint->y(), thePoint->z()); } -double GeomData_Point::x() const -{ - return myExpression[0]->value(); -} +double GeomData_Point::x() const { return myExpression[0]->value(); } -double GeomData_Point::y() const -{ - return myExpression[1]->value(); -} +double GeomData_Point::y() const { return myExpression[1]->value(); } -double GeomData_Point::z() const -{ - return myExpression[2]->value(); -} +double GeomData_Point::z() const { return myExpression[2]->value(); } -void GeomData_Point::setX(const double theX) -{ +void GeomData_Point::setX(const double theX) { if (!myIsInitialized) { setCalculatedValue(theX, 0, 0); } else if (x() != theX) { @@ -90,8 +76,7 @@ void GeomData_Point::setX(const double theX) } } -void GeomData_Point::setY(const double theY) -{ +void GeomData_Point::setY(const double theY) { if (!myIsInitialized) { setCalculatedValue(0, theY, 0); } else if (y() != theY) { @@ -101,129 +86,108 @@ void GeomData_Point::setY(const double theY) } } -void GeomData_Point::setZ(const double theZ) -{ +void GeomData_Point::setZ(const double theZ) { if (!myIsInitialized) { setCalculatedValue(0, 0, theZ); - } - else if (z() != theZ) { + } else if (z() != theZ) { myExpression[2]->setValue(theZ); myExpression[2]->setText(L""); // uninitialize the text owner()->data()->sendAttributeUpdated(this); } } - -std::shared_ptr GeomData_Point::pnt() -{ +std::shared_ptr GeomData_Point::pnt() { std::shared_ptr aResult(new GeomAPI_Pnt(x(), y(), z())); return aResult; } -void GeomData_Point::setText(const std::wstring& theX, - const std::wstring& theY, - const std::wstring& theZ) -{ - if (!myIsInitialized || textX() != theX || textY() != theY || textZ() != theZ) { +void GeomData_Point::setText(const std::wstring &theX, const std::wstring &theY, + const std::wstring &theZ) { + if (!myIsInitialized || textX() != theX || textY() != theY || + textZ() != theZ) { myExpression[0]->setText(theX); myExpression[1]->setText(theY); myExpression[2]->setText(theZ); - // Send it to evaluator to convert into the double and store in the attribute + // Send it to evaluator to convert into the double and store in the + // attribute ModelAPI_AttributeEvalMessage::send(owner()->data()->attribute(id()), this); owner()->data()->sendAttributeUpdated(this); } } -void GeomData_Point::setTextX(const std::wstring& theX) -{ +void GeomData_Point::setTextX(const std::wstring &theX) { if (!myIsInitialized) { static const std::wstring aDefaultText = L"0"; setText(theX, aDefaultText, aDefaultText); - } - else if (textX() != theX) { + } else if (textX() != theX) { myExpression[0]->setText(theX); - // Send it to evaluator to convert into the double and store in the attribute + // Send it to evaluator to convert into the double and store in the + // attribute ModelAPI_AttributeEvalMessage::send(owner()->data()->attribute(id()), this); owner()->data()->sendAttributeUpdated(this); } } -void GeomData_Point::setTextY(const std::wstring& theY) -{ +void GeomData_Point::setTextY(const std::wstring &theY) { if (!myIsInitialized) { static const std::wstring aDefaultText = L"0"; setText(aDefaultText, theY, aDefaultText); - } - else if (textY() != theY) { + } else if (textY() != theY) { myExpression[1]->setText(theY); - // Send it to evaluator to convert into the double and store in the attribute + // Send it to evaluator to convert into the double and store in the + // attribute ModelAPI_AttributeEvalMessage::send(owner()->data()->attribute(id()), this); owner()->data()->sendAttributeUpdated(this); } } -void GeomData_Point::setTextZ(const std::wstring& theZ) -{ +void GeomData_Point::setTextZ(const std::wstring &theZ) { if (!myIsInitialized) { static const std::wstring aDefaultText = L"0"; setText(aDefaultText, aDefaultText, theZ); - } - else if (textZ() != theZ) { + } else if (textZ() != theZ) { myExpression[2]->setText(theZ); - // Send it to evaluator to convert into the double and store in the attribute + // Send it to evaluator to convert into the double and store in the + // attribute ModelAPI_AttributeEvalMessage::send(owner()->data()->attribute(id()), this); owner()->data()->sendAttributeUpdated(this); } } -std::wstring GeomData_Point::textX() -{ - return myExpression[0]->text(); -} -std::wstring GeomData_Point::textY() -{ - return myExpression[1]->text(); -} -std::wstring GeomData_Point::textZ() -{ - return myExpression[2]->text(); -} +std::wstring GeomData_Point::textX() { return myExpression[0]->text(); } +std::wstring GeomData_Point::textY() { return myExpression[1]->text(); } +std::wstring GeomData_Point::textZ() { return myExpression[2]->text(); } -void GeomData_Point::setExpressionInvalid(int theComponent, bool theFlag) -{ +void GeomData_Point::setExpressionInvalid(int theComponent, bool theFlag) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); if (!myIsInitialized || expressionInvalid(theComponent) != theFlag) myExpression[theComponent]->setInvalid(theFlag); } -bool GeomData_Point::expressionInvalid(int theComponent) -{ +bool GeomData_Point::expressionInvalid(int theComponent) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); return myExpression[theComponent]->isInvalid(); } -void GeomData_Point::setExpressionError(int theComponent, const std::string& theError) -{ +void GeomData_Point::setExpressionError(int theComponent, + const std::string &theError) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); if (expressionError(theComponent) != theError) myExpression[theComponent]->setError(theError); } -std::string GeomData_Point::expressionError(int theComponent) -{ +std::string GeomData_Point::expressionError(int theComponent) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); return myExpression[theComponent]->error(); } -void GeomData_Point::setUsedParameters(int theComponent, - const std::set& theUsedParameters) -{ +void GeomData_Point::setUsedParameters( + int theComponent, const std::set &theUsedParameters) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); myExpression[theComponent]->setUsedParameters(theUsedParameters); } -std::set GeomData_Point::usedParameters(int theComponent) const -{ +std::set GeomData_Point::usedParameters(int theComponent) const { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); return myExpression[theComponent]->usedParameters(); } diff --git a/src/GeomData/GeomData_Point.h b/src/GeomData/GeomData_Point.h index bf278948c..9f266d77f 100644 --- a/src/GeomData/GeomData_Point.h +++ b/src/GeomData/GeomData_Point.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomData_Point_H_ @@ -31,16 +32,18 @@ class ModelAPI_ExpressionDouble; * \ingroup DataModel * \brief Attribute that contains 3D point. */ -class GeomData_Point : public GeomDataAPI_Point -{ +class GeomData_Point : public GeomDataAPI_Point { enum { NUM_COMPONENTS = 3 }; /// Expressions for X, Y and Z std::shared_ptr myExpression[NUM_COMPONENTS]; - public: + +public: /// Defines the double value - GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ); + GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, + const double theZ); /// Defines the point - GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr& thePoint); + GEOMDATA_EXPORT virtual void + setValue(const std::shared_ptr &thePoint); /// Returns the X double value GEOMDATA_EXPORT virtual double x() const; @@ -59,19 +62,19 @@ class GeomData_Point : public GeomDataAPI_Point GEOMDATA_EXPORT virtual std::shared_ptr pnt(); /// Defines the calculated double value - GEOMDATA_EXPORT virtual - void setCalculatedValue(const double theX, const double theY, const double theZ); + GEOMDATA_EXPORT virtual void + setCalculatedValue(const double theX, const double theY, const double theZ); /// Defines the text values - GEOMDATA_EXPORT virtual void setText(const std::wstring& theX, - const std::wstring& theY, - const std::wstring& theZ); + GEOMDATA_EXPORT virtual void setText(const std::wstring &theX, + const std::wstring &theY, + const std::wstring &theZ); /// Defines the X text value - GEOMDATA_EXPORT virtual void setTextX(const std::wstring& theX); + GEOMDATA_EXPORT virtual void setTextX(const std::wstring &theX); /// Defines the Y text value - GEOMDATA_EXPORT virtual void setTextY(const std::wstring& theY); + GEOMDATA_EXPORT virtual void setTextY(const std::wstring &theY); /// Defines the Z text value - GEOMDATA_EXPORT virtual void setTextZ(const std::wstring& theZ); + GEOMDATA_EXPORT virtual void setTextZ(const std::wstring &theZ); /// Returns the X text value GEOMDATA_EXPORT virtual std::wstring textX(); @@ -87,22 +90,26 @@ class GeomData_Point : public GeomDataAPI_Point GEOMDATA_EXPORT virtual bool expressionInvalid(int); /// Allows to set expression (text) error (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError); + GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, + const std::string &theError); /// Returns an expression error GEOMDATA_EXPORT virtual std::string expressionError(int theComponent); /// Defines the used parameters - GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent, - const std::set& theUsedParameters); + GEOMDATA_EXPORT virtual void + setUsedParameters(int theComponent, + const std::set &theUsedParameters); /// Returns the used parameters - GEOMDATA_EXPORT virtual std::set usedParameters(int theComponent) const; + GEOMDATA_EXPORT virtual std::set + usedParameters(int theComponent) const; - protected: +protected: /// Initializes attributes GEOMDATA_EXPORT GeomData_Point(); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/GeomData/GeomData_Point2D.cpp b/src/GeomData/GeomData_Point2D.cpp index e5bf15230..766c1adec 100644 --- a/src/GeomData/GeomData_Point2D.cpp +++ b/src/GeomData/GeomData_Point2D.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomData_Point2D.h" @@ -28,30 +29,26 @@ #include -GeomData_Point2D::GeomData_Point2D() -{ - myIsInitialized = false; -} +GeomData_Point2D::GeomData_Point2D() { myIsInitialized = false; } -void GeomData_Point2D::reinit() -{ +void GeomData_Point2D::reinit() { myIsInitialized = true; for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { myExpression[aComponent]->reinit(); - myIsInitialized = myIsInitialized && myExpression[aComponent]->isInitialized(); + myIsInitialized = + myIsInitialized && myExpression[aComponent]->isInitialized(); } } -void GeomData_Point2D::reset() -{ +void GeomData_Point2D::reset() { myIsInitialized = false; - for(int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { + for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { myExpression[aComponent]->reset(); } } -void GeomData_Point2D::setCalculatedValue(const double theX, const double theY) -{ +void GeomData_Point2D::setCalculatedValue(const double theX, + const double theY) { if (!myIsInitialized || x() != theX || y() != theY) { myExpression[0]->setValue(theX); myExpression[1]->setValue(theY); @@ -59,91 +56,73 @@ void GeomData_Point2D::setCalculatedValue(const double theX, const double theY) } } -void GeomData_Point2D::setValue(const double theX, const double theY) -{ +void GeomData_Point2D::setValue(const double theX, const double theY) { setCalculatedValue(textX().empty() ? theX : x(), textY().empty() ? theY : y()); } -void GeomData_Point2D::setValue(const std::shared_ptr& thePoint) -{ +void GeomData_Point2D::setValue( + const std::shared_ptr &thePoint) { setValue(thePoint->x(), thePoint->y()); } -double GeomData_Point2D::x() const -{ - return myExpression[0]->value(); -} +double GeomData_Point2D::x() const { return myExpression[0]->value(); } -double GeomData_Point2D::y() const -{ - return myExpression[1]->value(); -} +double GeomData_Point2D::y() const { return myExpression[1]->value(); } -std::shared_ptr GeomData_Point2D::pnt() -{ +std::shared_ptr GeomData_Point2D::pnt() { std::shared_ptr aResult(new GeomAPI_Pnt2d(x(), y())); return aResult; } -void GeomData_Point2D::setText(const std::wstring& theX, - const std::wstring& theY) -{ +void GeomData_Point2D::setText(const std::wstring &theX, + const std::wstring &theY) { if (!myIsInitialized && theX.empty() && theY.empty()) return; // empty strings are not good initializers if (!myIsInitialized || textX() != theX || textY() != theY) { myExpression[0]->setText(theX); myExpression[1]->setText(theY); - // Send it to evaluator to convert into the double and store in the attribute + // Send it to evaluator to convert into the double and store in the + // attribute ModelAPI_AttributeEvalMessage::send(owner()->data()->attribute(id()), this); owner()->data()->sendAttributeUpdated(this); } } -std::wstring GeomData_Point2D::textX() -{ - return myExpression[0]->text(); -} -std::wstring GeomData_Point2D::textY() -{ - return myExpression[1]->text(); -} +std::wstring GeomData_Point2D::textX() { return myExpression[0]->text(); } +std::wstring GeomData_Point2D::textY() { return myExpression[1]->text(); } -void GeomData_Point2D::setExpressionInvalid(int theComponent, bool theFlag) -{ +void GeomData_Point2D::setExpressionInvalid(int theComponent, bool theFlag) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); if (!myIsInitialized || expressionInvalid(theComponent) != theFlag) myExpression[theComponent]->setInvalid(theFlag); } -bool GeomData_Point2D::expressionInvalid(int theComponent) -{ +bool GeomData_Point2D::expressionInvalid(int theComponent) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); return myExpression[theComponent]->isInvalid(); } -void GeomData_Point2D::setExpressionError(int theComponent, const std::string& theError) -{ +void GeomData_Point2D::setExpressionError(int theComponent, + const std::string &theError) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); if (expressionError(theComponent) != theError) myExpression[theComponent]->setError(theError); } -std::string GeomData_Point2D::expressionError(int theComponent) -{ +std::string GeomData_Point2D::expressionError(int theComponent) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); return myExpression[theComponent]->error(); } -void GeomData_Point2D::setUsedParameters(int theComponent, - const std::set& theUsedParameters) -{ +void GeomData_Point2D::setUsedParameters( + int theComponent, const std::set &theUsedParameters) { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); myExpression[theComponent]->setUsedParameters(theUsedParameters); } -std::set GeomData_Point2D::usedParameters(int theComponent) const -{ +std::set +GeomData_Point2D::usedParameters(int theComponent) const { assert(theComponent >= 0 && theComponent < NUM_COMPONENTS); return myExpression[theComponent]->usedParameters(); } diff --git a/src/GeomData/GeomData_Point2D.h b/src/GeomData/GeomData_Point2D.h index e60af7646..f2aa69f81 100644 --- a/src/GeomData/GeomData_Point2D.h +++ b/src/GeomData/GeomData_Point2D.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomData_Point2D_H_ @@ -32,15 +33,16 @@ class ModelAPI_ExpressionDouble; * \brief Attribute that contains 2D point. */ -class GeomData_Point2D : public GeomDataAPI_Point2D -{ +class GeomData_Point2D : public GeomDataAPI_Point2D { enum { NUM_COMPONENTS = 2 }; - std::shared_ptr myExpression[NUM_COMPONENTS]; ///< Expressions for X, Y - public: + std::shared_ptr + myExpression[NUM_COMPONENTS]; ///< Expressions for X, Y +public: /// Defines the double value GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY); /// Defines the point - GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr& thePoint); + GEOMDATA_EXPORT virtual void + setValue(const std::shared_ptr &thePoint); /// Returns the X double value GEOMDATA_EXPORT virtual double x() const; @@ -50,11 +52,12 @@ class GeomData_Point2D : public GeomDataAPI_Point2D GEOMDATA_EXPORT virtual std::shared_ptr pnt(); /// Defines the calculated double value - GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX, const double theY); + GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX, + const double theY); /// Defines the text values - GEOMDATA_EXPORT virtual void setText(const std::wstring& theX, - const std::wstring& theY); + GEOMDATA_EXPORT virtual void setText(const std::wstring &theX, + const std::wstring &theY); /// Returns the text values GEOMDATA_EXPORT virtual std::wstring textX(); @@ -67,22 +70,26 @@ class GeomData_Point2D : public GeomDataAPI_Point2D GEOMDATA_EXPORT virtual bool expressionInvalid(int); /// Allows to set expression (text) error (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError); + GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, + const std::string &theError); /// Returns an expression error GEOMDATA_EXPORT virtual std::string expressionError(int theComponent); /// Defines the used parameters - GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent, - const std::set& theUsedParameters); + GEOMDATA_EXPORT virtual void + setUsedParameters(int theComponent, + const std::set &theUsedParameters); /// Returns the used parameters - GEOMDATA_EXPORT virtual std::set usedParameters(int theComponent) const; + GEOMDATA_EXPORT virtual std::set + usedParameters(int theComponent) const; - protected: +protected: /// Initializes attributes GEOMDATA_EXPORT GeomData_Point2D(); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); /// Resets attribute to deafult state. diff --git a/src/GeomData/GeomData_Point2DArray.cpp b/src/GeomData/GeomData_Point2DArray.cpp index eefc1c077..7362fb2c1 100644 --- a/src/GeomData/GeomData_Point2DArray.cpp +++ b/src/GeomData/GeomData_Point2DArray.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomData_Point2DArray.h" @@ -28,20 +29,20 @@ #include -GeomData_Point2DArray::GeomData_Point2DArray(TDF_Label& theLabel) - : myLab(theLabel) -{ +GeomData_Point2DArray::GeomData_Point2DArray(TDF_Label &theLabel) + : myLab(theLabel) { reinit(); } -void GeomData_Point2DArray::reinit() -{ - // check the attribute could be already presented in this doc (after load document) - myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myArray) == Standard_True; +void GeomData_Point2DArray::reinit() { + // check the attribute could be already presented in this doc (after load + // document) + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myArray) == + Standard_True; } -bool GeomData_Point2DArray::assign(std::shared_ptr theOther) -{ +bool GeomData_Point2DArray::assign( + std::shared_ptr theOther) { std::shared_ptr anOther = std::dynamic_pointer_cast(theOther); if (!anOther) @@ -54,38 +55,40 @@ bool GeomData_Point2DArray::assign(std::shared_ptr the return true; } -int GeomData_Point2DArray::size() -{ +int GeomData_Point2DArray::size() { if (myArray.IsNull() || !myArray->IsValid()) { // this could be on undo and then redo creation of the attribute // in result creation it may be uninitialized - myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myArray) == Standard_True; + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), + myArray) == Standard_True; } // checking the validity because attribute (as a field) may be presented, // but without label: it is undoed return (myArray.IsNull() || !myArray->IsValid()) ? 0 : myArray->Length() / 2; } -void GeomData_Point2DArray::setSize(const int theSize) -{ +void GeomData_Point2DArray::setSize(const int theSize) { int aValuesSize = 2 * theSize; - if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet - if (aValuesSize != 0) { // if size is zero, nothing to do (null array means there is no array) + if (myArray.IsNull() || + !myArray->IsValid()) { // create array if it is not done yet + if (aValuesSize != 0) { // if size is zero, nothing to do (null array means + // there is no array) myArray = TDataStd_RealArray::Set(myLab, 0, aValuesSize - 1); owner()->data()->sendAttributeUpdated(this); } - } - else { // reset the old array + } else { // reset the old array if (aValuesSize) { - if (aValuesSize != myArray->Length()) { // old data is kept in the new array - Handle(TColStd_HArray1OfReal) aNewArray = new TColStd_HArray1OfReal(0, aValuesSize - 1); - for (int anIndex = 0; anIndex < aValuesSize && anIndex <= myArray->Upper(); ++anIndex) + if (aValuesSize != + myArray->Length()) { // old data is kept in the new array + Handle(TColStd_HArray1OfReal) aNewArray = + new TColStd_HArray1OfReal(0, aValuesSize - 1); + for (int anIndex = 0; + anIndex < aValuesSize && anIndex <= myArray->Upper(); ++anIndex) aNewArray->SetValue(anIndex, myArray->Value(anIndex)); myArray->ChangeArray(aNewArray); owner()->data()->sendAttributeUpdated(this); } - } - else { // size is zero => array must be erased + } else { // size is zero => array must be erased if (!myArray.IsNull()) { myArray.Nullify(); myLab.ForgetAttribute(TDataStd_RealArray::GetID()); @@ -95,26 +98,25 @@ void GeomData_Point2DArray::setSize(const int theSize) } } -void GeomData_Point2DArray::setPnt(const int theIndex, - const double theX, - const double theY) -{ - if (myArray->Value(2 * theIndex) != theX || myArray->Value(2 * theIndex + 1) != theY) { +void GeomData_Point2DArray::setPnt(const int theIndex, const double theX, + const double theY) { + if (myArray->Value(2 * theIndex) != theX || + myArray->Value(2 * theIndex + 1) != theY) { myArray->SetValue(2 * theIndex, theX); myArray->SetValue(2 * theIndex + 1, theY); owner()->data()->sendAttributeUpdated(this); } } -void GeomData_Point2DArray::setPnt(const int theIndex, const GeomPnt2dPtr& thePoint) -{ +void GeomData_Point2DArray::setPnt(const int theIndex, + const GeomPnt2dPtr &thePoint) { setPnt(theIndex, thePoint->x(), thePoint->y()); } -GeomPnt2dPtr GeomData_Point2DArray::pnt(const int theIndex) -{ +GeomPnt2dPtr GeomData_Point2DArray::pnt(const int theIndex) { GeomPnt2dPtr aPoint; if (theIndex >= 0 && theIndex * 2 < myArray->Length()) - aPoint.reset(new GeomAPI_Pnt2d(myArray->Value(2 * theIndex), myArray->Value(2 * theIndex + 1))); + aPoint.reset(new GeomAPI_Pnt2d(myArray->Value(2 * theIndex), + myArray->Value(2 * theIndex + 1))); return aPoint; } diff --git a/src/GeomData/GeomData_Point2DArray.h b/src/GeomData/GeomData_Point2DArray.h index 57431b86f..9d785cc4c 100644 --- a/src/GeomData/GeomData_Point2DArray.h +++ b/src/GeomData/GeomData_Point2DArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomData_Point2DArray_H_ @@ -24,22 +25,23 @@ #include -#include #include +#include /** \class GeomData_Point2DArray * \ingroup DataModel * \brief Attribute that contains an array of 2D points. */ -class GeomData_Point2DArray : public GeomDataAPI_Point2DArray -{ +class GeomData_Point2DArray : public GeomDataAPI_Point2DArray { TDF_Label myLab; ///< the main label of the attribute - Handle_TDataStd_RealArray myArray; ///< array that keeps all coordinates of the points + Handle_TDataStd_RealArray + myArray; ///< array that keeps all coordinates of the points public: /// Copy values from another array /// \return \c true if the copy was successful - GEOMDATA_EXPORT virtual bool assign(std::shared_ptr theOther); + GEOMDATA_EXPORT virtual bool + assign(std::shared_ptr theOther); /// Returns the size of the array (zero means that it is empty) GEOMDATA_EXPORT virtual int size(); @@ -48,20 +50,22 @@ public: GEOMDATA_EXPORT virtual void setSize(const int theSize); /// Defines the value of the array by index [0; size-1] - GEOMDATA_EXPORT virtual void setPnt(const int theIndex, - const double theX, const double theY); + GEOMDATA_EXPORT virtual void setPnt(const int theIndex, const double theX, + const double theY); /// Defines the value of the array by index [0; size-1] - GEOMDATA_EXPORT virtual void setPnt(const int theIndex, - const std::shared_ptr& thePoint); + GEOMDATA_EXPORT virtual void + setPnt(const int theIndex, const std::shared_ptr &thePoint); /// Returns the value by the index - GEOMDATA_EXPORT virtual std::shared_ptr pnt(const int theIndex); + GEOMDATA_EXPORT virtual std::shared_ptr + pnt(const int theIndex); protected: /// Initializes attributes - GEOMDATA_EXPORT GeomData_Point2DArray(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + GEOMDATA_EXPORT GeomData_Point2DArray(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/GeomDataAPI/CMakeLists.txt b/src/GeomDataAPI/CMakeLists.txt index c59b2a780..15c4fc40a 100644 --- a/src/GeomDataAPI/CMakeLists.txt +++ b/src/GeomDataAPI/CMakeLists.txt @@ -88,16 +88,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/GeomDataAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/GeomDataAPI/GeomDataAPI.h b/src/GeomDataAPI/GeomDataAPI.h index 4ae339ccc..e00a94705 100644 --- a/src/GeomDataAPI/GeomDataAPI.h +++ b/src/GeomDataAPI/GeomDataAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMDATAAPI_H @@ -22,13 +23,13 @@ #if defined GEOMDATAAPI_EXPORTS #if defined WIN32 -#define GEOMDATAAPI_EXPORT __declspec( dllexport ) +#define GEOMDATAAPI_EXPORT __declspec(dllexport) #else #define GEOMDATAAPI_EXPORT #endif #else #if defined WIN32 -#define GEOMDATAAPI_EXPORT __declspec( dllimport ) +#define GEOMDATAAPI_EXPORT __declspec(dllimport) #else #define GEOMDATAAPI_EXPORT #endif diff --git a/src/GeomDataAPI/GeomDataAPI_Dir.cpp b/src/GeomDataAPI/GeomDataAPI_Dir.cpp index 5c7228f2b..99273806e 100644 --- a/src/GeomDataAPI/GeomDataAPI_Dir.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Dir.cpp @@ -14,21 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -std::string GeomDataAPI_Dir::attributeType() -{ - return typeId(); -} +std::string GeomDataAPI_Dir::attributeType() { return typeId(); } -GeomDataAPI_Dir::GeomDataAPI_Dir() -{ -} +GeomDataAPI_Dir::GeomDataAPI_Dir() {} -GeomDataAPI_Dir::~GeomDataAPI_Dir() -{ - -} +GeomDataAPI_Dir::~GeomDataAPI_Dir() {} diff --git a/src/GeomDataAPI/GeomDataAPI_Dir.h b/src/GeomDataAPI/GeomDataAPI_Dir.h index 989056480..3a4dd264b 100644 --- a/src/GeomDataAPI/GeomDataAPI_Dir.h +++ b/src/GeomDataAPI/GeomDataAPI_Dir.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomDataAPI_Dir_H_ @@ -28,16 +29,16 @@ class GeomAPI_XYZ; /**\class GeomDataAPI_Dir * \ingroup DataModel - * \brief Attribute that contains 3D direction coordinates. + * \brief Attribute that contains 3D direction coordinates. */ -class GeomDataAPI_Dir : public ModelAPI_Attribute -{ - public: +class GeomDataAPI_Dir : public ModelAPI_Attribute { +public: /// Defines the double value - virtual void setValue(const double theX, const double theY, const double theZ) = 0; + virtual void setValue(const double theX, const double theY, + const double theZ) = 0; /// Defines the direction - virtual void setValue(const std::shared_ptr& theDir) = 0; + virtual void setValue(const std::shared_ptr &theDir) = 0; /// Returns the X double value virtual double x() const = 0; @@ -51,15 +52,12 @@ class GeomDataAPI_Dir : public ModelAPI_Attribute virtual std::shared_ptr xyz() = 0; /// Returns the type of this class of attributes - static std::string typeId() - { - return std::string("Dir"); - } + static std::string typeId() { return std::string("Dir"); } /// Returns the type of this class of attributes, not static method GEOMDATAAPI_EXPORT virtual std::string attributeType(); - protected: +protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Dir(); GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Dir(); diff --git a/src/GeomDataAPI/GeomDataAPI_Point.cpp b/src/GeomDataAPI/GeomDataAPI_Point.cpp index 4a0dd3a1c..7707a4460 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Point.cpp @@ -14,20 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -std::string GeomDataAPI_Point::attributeType() -{ - return typeId(); -} +std::string GeomDataAPI_Point::attributeType() { return typeId(); } -GeomDataAPI_Point::GeomDataAPI_Point() -{ -} +GeomDataAPI_Point::GeomDataAPI_Point() {} -GeomDataAPI_Point::~GeomDataAPI_Point() -{ -} +GeomDataAPI_Point::~GeomDataAPI_Point() {} diff --git a/src/GeomDataAPI/GeomDataAPI_Point.h b/src/GeomDataAPI/GeomDataAPI_Point.h index 8a24f54a1..7eae6f6c2 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point.h +++ b/src/GeomDataAPI/GeomDataAPI_Point.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomDataAPI_Point_H_ @@ -29,17 +30,17 @@ class GeomAPI_Pnt; /**\class GeomDataAPI_Point * \ingroup DataModel - * \brief Attribute that contains 3D point coordinates. + * \brief Attribute that contains 3D point coordinates. */ -class GeomDataAPI_Point : public ModelAPI_Attribute -{ - public: +class GeomDataAPI_Point : public ModelAPI_Attribute { +public: /// Defines the double value - GEOMDATAAPI_EXPORT virtual - void setValue(const double theX, const double theY, const double theZ) = 0; + GEOMDATAAPI_EXPORT virtual void setValue(const double theX, const double theY, + const double theZ) = 0; /// Defines the point - GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr& thePoint) = 0; + GEOMDATAAPI_EXPORT virtual void + setValue(const std::shared_ptr &thePoint) = 0; /// Returns the X double value GEOMDATAAPI_EXPORT virtual double x() const = 0; @@ -51,8 +52,9 @@ class GeomDataAPI_Point : public ModelAPI_Attribute GEOMDATAAPI_EXPORT virtual std::shared_ptr pnt() = 0; /// Defines the calculated double value - GEOMDATAAPI_EXPORT virtual - void setCalculatedValue(const double theX, const double theY, const double theZ) = 0; + GEOMDATAAPI_EXPORT virtual void setCalculatedValue(const double theX, + const double theY, + const double theZ) = 0; /// Defines the X coordinate value GEOMDATAAPI_EXPORT virtual void setX(const double theX) = 0; @@ -62,16 +64,16 @@ class GeomDataAPI_Point : public ModelAPI_Attribute GEOMDATAAPI_EXPORT virtual void setZ(const double theZ) = 0; /// Defines the text values - GEOMDATAAPI_EXPORT virtual void setText(const std::wstring& theX, - const std::wstring& theY, - const std::wstring& theZ) = 0; + GEOMDATAAPI_EXPORT virtual void setText(const std::wstring &theX, + const std::wstring &theY, + const std::wstring &theZ) = 0; /// Defines the X text value - GEOMDATAAPI_EXPORT virtual void setTextX(const std::wstring& theX) = 0; + GEOMDATAAPI_EXPORT virtual void setTextX(const std::wstring &theX) = 0; /// Defines the Y text value - GEOMDATAAPI_EXPORT virtual void setTextY(const std::wstring& theY) = 0; + GEOMDATAAPI_EXPORT virtual void setTextY(const std::wstring &theY) = 0; /// Defines the Z text value - GEOMDATAAPI_EXPORT virtual void setTextZ(const std::wstring& theZ) = 0; + GEOMDATAAPI_EXPORT virtual void setTextZ(const std::wstring &theZ) = 0; /// Returns the text value for X GEOMDATAAPI_EXPORT virtual std::wstring textX() = 0; @@ -81,41 +83,42 @@ class GeomDataAPI_Point : public ModelAPI_Attribute GEOMDATAAPI_EXPORT virtual std::wstring textZ() = 0; /// Point component (x,y,z) - enum PointComponent { C_X = 0, - C_Y = 1, - C_Z = 2, + enum PointComponent { + C_X = 0, + C_Y = 1, + C_Z = 2, }; /// Allows to set expression (text) as invalid (by the parameters listener) - GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, const bool theFlag) = 0; + GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, + const bool theFlag) = 0; /// Returns true if text is invalid GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0; /// Allows to set expression (text) error (by the parameters listener) - GEOMDATAAPI_EXPORT virtual - void setExpressionError(int theComponent, const std::string& theError) = 0; + GEOMDATAAPI_EXPORT virtual void + setExpressionError(int theComponent, const std::string &theError) = 0; /// Returns an expression error GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0; /// Defines the used parameters - GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent, - const std::set& theUsedParameters) = 0; + GEOMDATAAPI_EXPORT virtual void + setUsedParameters(int theComponent, + const std::set &theUsedParameters) = 0; /// Returns the used parameters - GEOMDATAAPI_EXPORT virtual std::set usedParameters(int theComponent) const = 0; + GEOMDATAAPI_EXPORT virtual std::set + usedParameters(int theComponent) const = 0; /// Returns the type of this class of attributes - static std::string typeId() - { - return std::string("Point"); - } + static std::string typeId() { return std::string("Point"); } /// Returns the type of this class of attributes, not static method GEOMDATAAPI_EXPORT virtual std::string attributeType(); - protected: +protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Point(); GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point(); diff --git a/src/GeomDataAPI/GeomDataAPI_Point2D.cpp b/src/GeomDataAPI/GeomDataAPI_Point2D.cpp index 6a14146bd..802687794 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2D.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Point2D.cpp @@ -14,42 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -void GeomDataAPI_Point2D::move(const double theDeltaX, const double theDeltaY) -{ +void GeomDataAPI_Point2D::move(const double theDeltaX, const double theDeltaY) { setValue(x() + theDeltaX, y() + theDeltaY); } -std::string GeomDataAPI_Point2D::attributeType() -{ - return typeId(); -} +std::string GeomDataAPI_Point2D::attributeType() { return typeId(); } -std::shared_ptr GeomDataAPI_Point2D::getPoint2D( - const DataPtr& theData, const std::string& theAttribute) -{ +std::shared_ptr +GeomDataAPI_Point2D::getPoint2D(const DataPtr &theData, + const std::string &theAttribute) { std::shared_ptr aPointAttr; if (!theData) return aPointAttr; - std::shared_ptr anAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute)); + std::shared_ptr anAttr = + std::dynamic_pointer_cast( + theData->attribute(theAttribute)); if (anAttr && anAttr->attr()) { aPointAttr = std::dynamic_pointer_cast(anAttr->attr()); } return aPointAttr; } +GeomDataAPI_Point2D::GeomDataAPI_Point2D() {} -GeomDataAPI_Point2D::GeomDataAPI_Point2D() -{ -} - -GeomDataAPI_Point2D::~GeomDataAPI_Point2D() -{ -} +GeomDataAPI_Point2D::~GeomDataAPI_Point2D() {} diff --git a/src/GeomDataAPI/GeomDataAPI_Point2D.h b/src/GeomDataAPI/GeomDataAPI_Point2D.h index 2916a370d..672ca1a8c 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2D.h +++ b/src/GeomDataAPI/GeomDataAPI_Point2D.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomDataAPI_Point2D_H_ @@ -33,13 +34,14 @@ class GeomAPI_Pnt2d; * \brief Attribute that contains 2D point coordinates. */ -class GeomDataAPI_Point2D : public ModelAPI_Attribute -{ - public: +class GeomDataAPI_Point2D : public ModelAPI_Attribute { +public: /// Defines the double value - GEOMDATAAPI_EXPORT virtual void setValue(const double theX, const double theY) = 0; + GEOMDATAAPI_EXPORT virtual void setValue(const double theX, + const double theY) = 0; /// Defines the point - GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr& thePoint) = 0; + GEOMDATAAPI_EXPORT virtual void + setValue(const std::shared_ptr &thePoint) = 0; /// Returns the X double value GEOMDATAAPI_EXPORT virtual double x() const = 0; @@ -49,11 +51,12 @@ class GeomDataAPI_Point2D : public ModelAPI_Attribute GEOMDATAAPI_EXPORT virtual std::shared_ptr pnt() = 0; /// Defines the calculated double value - GEOMDATAAPI_EXPORT virtual void setCalculatedValue(const double theX, const double theY) = 0; + GEOMDATAAPI_EXPORT virtual void setCalculatedValue(const double theX, + const double theY) = 0; /// Defines the text values - GEOMDATAAPI_EXPORT virtual void setText(const std::wstring& theX, - const std::wstring& theY) = 0; + GEOMDATAAPI_EXPORT virtual void setText(const std::wstring &theX, + const std::wstring &theY) = 0; /// Returns the text value for X GEOMDATAAPI_EXPORT virtual std::wstring textX() = 0; @@ -61,38 +64,39 @@ class GeomDataAPI_Point2D : public ModelAPI_Attribute GEOMDATAAPI_EXPORT virtual std::wstring textY() = 0; /// Point component (x,y) - enum PointComponent { C_X = 0, - C_Y = 1, + enum PointComponent { + C_X = 0, + C_Y = 1, }; /// Allows to set expression (text) as invalid (by the parameters listener) - GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, const bool theFlag) = 0; + GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, + const bool theFlag) = 0; /// Returns true if text is invalid GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0; /// Allows to set expression (text) error (by the parameters listener) - GEOMDATAAPI_EXPORT virtual - void setExpressionError(int theComponent, const std::string& theError) = 0; + GEOMDATAAPI_EXPORT virtual void + setExpressionError(int theComponent, const std::string &theError) = 0; /// Returns an expression error GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0; /// Defines the used parameters - GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent, - const std::set& theUsedParameters) = 0; + GEOMDATAAPI_EXPORT virtual void + setUsedParameters(int theComponent, + const std::set &theUsedParameters) = 0; /// Returns the used parameters - GEOMDATAAPI_EXPORT virtual std::set usedParameters(int theComponent) const = 0; + GEOMDATAAPI_EXPORT virtual std::set + usedParameters(int theComponent) const = 0; /// Appends the delta values to point GEOMDATAAPI_EXPORT void move(const double theDeltaX, const double theDeltaY); /// Returns the type of this class of attributes - static std::string typeId() - { - return std::string("Point2D"); - } + static std::string typeId() { return std::string("Point2D"); } /// Returns the type of this class of attributes, not static method GEOMDATAAPI_EXPORT virtual std::string attributeType(); @@ -100,10 +104,10 @@ class GeomDataAPI_Point2D : public ModelAPI_Attribute /// Returns this attribute from the data if it is possible /// \param theData a model data /// \param theAttribute an attribute index - static GEOMDATAAPI_EXPORT std::shared_ptr getPoint2D(const DataPtr& theData, - const std::string& theAttribute); + static GEOMDATAAPI_EXPORT std::shared_ptr + getPoint2D(const DataPtr &theData, const std::string &theAttribute); - protected: +protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Point2D(); GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2D(); diff --git a/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp b/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp index 106ff2c37..18acc15de 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp @@ -14,20 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -std::string GeomDataAPI_Point2DArray::attributeType() -{ - return typeId(); -} +std::string GeomDataAPI_Point2DArray::attributeType() { return typeId(); } -GeomDataAPI_Point2DArray::GeomDataAPI_Point2DArray() -{ -} +GeomDataAPI_Point2DArray::GeomDataAPI_Point2DArray() {} -GeomDataAPI_Point2DArray::~GeomDataAPI_Point2DArray() -{ -} +GeomDataAPI_Point2DArray::~GeomDataAPI_Point2DArray() {} diff --git a/src/GeomDataAPI/GeomDataAPI_Point2DArray.h b/src/GeomDataAPI/GeomDataAPI_Point2DArray.h index 70bb78a00..3ebea1385 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2DArray.h +++ b/src/GeomDataAPI/GeomDataAPI_Point2DArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomDataAPI_Point2DArray_H_ @@ -30,12 +31,12 @@ class GeomAPI_Pnt2d; * \brief Attribute that contains array of 2D point coordinates. */ -class GeomDataAPI_Point2DArray : public ModelAPI_Attribute -{ +class GeomDataAPI_Point2DArray : public ModelAPI_Attribute { public: /// Copy values from another array /// \return \c true if the copy was successful - GEOMDATAAPI_EXPORT virtual bool assign(std::shared_ptr theOther) = 0; + GEOMDATAAPI_EXPORT virtual bool + assign(std::shared_ptr theOther) = 0; /// Returns the size of the array (zero means that it is empty) GEOMDATAAPI_EXPORT virtual int size() = 0; @@ -44,21 +45,20 @@ public: GEOMDATAAPI_EXPORT virtual void setSize(const int theSize) = 0; /// Defines the value of the array by index [0; size-1] - GEOMDATAAPI_EXPORT virtual void setPnt(const int theIndex, - const double theX, const double theY) = 0; + GEOMDATAAPI_EXPORT virtual void setPnt(const int theIndex, const double theX, + const double theY) = 0; /// Defines the value of the array by index [0; size-1] - GEOMDATAAPI_EXPORT virtual void setPnt(const int theIndex, - const std::shared_ptr& thePoint) = 0; + GEOMDATAAPI_EXPORT virtual void + setPnt(const int theIndex, + const std::shared_ptr &thePoint) = 0; /// Returns the value by the index - GEOMDATAAPI_EXPORT virtual std::shared_ptr pnt(const int theIndex) = 0; + GEOMDATAAPI_EXPORT virtual std::shared_ptr + pnt(const int theIndex) = 0; /// Returns the type of this class of attributes - static std::string typeId() - { - return std::string("Point2DArray"); - } + static std::string typeId() { return std::string("Point2DArray"); } /// Returns the type of this class of attributes, not static method GEOMDATAAPI_EXPORT virtual std::string attributeType(); diff --git a/src/GeomDataAPI/GeomDataAPI_swig.h b/src/GeomDataAPI/GeomDataAPI_swig.h index c2722971c..76a53ba7d 100644 --- a/src/GeomDataAPI/GeomDataAPI_swig.h +++ b/src/GeomDataAPI/GeomDataAPI_swig.h @@ -14,29 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_GEOMDATAAPI_GEOMDATAAPI_SWIG_H_ #define SRC_GEOMDATAAPI_GEOMDATAAPI_SWIG_H_ - #include - #include - #include +#include +#include +#include - #include "GeomDataAPI.h" - #include "GeomDataAPI_Point.h" - #include "GeomDataAPI_Dir.h" - #include "GeomDataAPI_Point2D.h" - #include "GeomDataAPI_Point2DArray.h" +#include "GeomDataAPI.h" +#include "GeomDataAPI_Dir.h" +#include "GeomDataAPI_Point.h" +#include "GeomDataAPI_Point2D.h" +#include "GeomDataAPI_Point2DArray.h" - #include - #include - #include +#include +#include +#include - template std::shared_ptr castTo(std::shared_ptr theObject) - { - return std::dynamic_pointer_cast(theObject); - } +template +std::shared_ptr castTo(std::shared_ptr theObject) { + return std::dynamic_pointer_cast(theObject); +} #endif /* SRC_GEOMDATAAPI_GEOMDATAAPI_SWIG_H_ */ diff --git a/src/GeomValidators/GeomValidators.h b/src/GeomValidators/GeomValidators.h index 42e07c03a..e891c6966 100644 --- a/src/GeomValidators/GeomValidators.h +++ b/src/GeomValidators/GeomValidators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMVALIDATORS_H @@ -22,13 +23,13 @@ #if defined GEOMVALIDATORS_EXPORTS #if defined WIN32 -#define GEOMVALIDATORS_EXPORT __declspec( dllexport ) +#define GEOMVALIDATORS_EXPORT __declspec(dllexport) #else #define GEOMVALIDATORS_EXPORT #endif #else #if defined WIN32 -#define GEOMVALIDATORS_EXPORT __declspec( dllimport ) +#define GEOMVALIDATORS_EXPORT __declspec(dllimport) #else #define GEOMVALIDATORS_EXPORT #endif diff --git a/src/GeomValidators/GeomValidators_BodyShapes.cpp b/src/GeomValidators/GeomValidators_BodyShapes.cpp index 70d7bed54..e43775eff 100644 --- a/src/GeomValidators/GeomValidators_BodyShapes.cpp +++ b/src/GeomValidators/GeomValidators_BodyShapes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_BodyShapes.h" @@ -23,18 +24,18 @@ #include #include +#include #include #include -#include -bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_BodyShapes::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttrSelection = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttrSelection->context(); FeaturePtr aContextFeature = anAttrSelection->contextFeature(); if (!(aContext.get() || aContextFeature.get())) { @@ -43,7 +44,7 @@ bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, } if (aContext.get()) { ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(aContext); + std::dynamic_pointer_cast(aContext); if (aResultConstruction.get()) { theError = "Error: Result construction selected."; return false; @@ -60,7 +61,8 @@ bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, std::list::const_iterator aIt; for (aIt = aResList.cbegin(); aIt != aResList.cend(); aIt++) { ResultPtr aRes = (*aIt); - ResultBodyPtr aBody = std::dynamic_pointer_cast(aRes); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(aRes); if (aBody.get()) break; } @@ -69,23 +71,26 @@ bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, return false; } } - } else if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); // All objects should not be result constructions. - for(int anIndex = 0, aSize = anAttrSelectionList->size(); anIndex < aSize; ++anIndex) { - AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); - if(!isValid(anAttrSelection, theArguments, theError)) { + for (int anIndex = 0, aSize = anAttrSelectionList->size(); anIndex < aSize; + ++anIndex) { + AttributeSelectionPtr anAttrSelection = + anAttrSelectionList->value(anIndex); + if (!isValid(anAttrSelection, theArguments, theError)) { return false; } } } else { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Attribute \"%1\" does not supported by this validator."; theError.arg(anAttributeType); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } return true; diff --git a/src/GeomValidators/GeomValidators_BodyShapes.h b/src/GeomValidators/GeomValidators_BodyShapes.h index 124eaf9b4..0db55c9bb 100644 --- a/src/GeomValidators/GeomValidators_BodyShapes.h +++ b/src/GeomValidators/GeomValidators_BodyShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_BodyShapes_H @@ -22,23 +23,23 @@ #include -#include #include +#include /** * Generic validator for any attribute of a feature. */ -class GeomValidators_BodyShapes : public ModelAPI_AttributeValidator -{ +class GeomValidators_BodyShapes : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the shape is a /// body subshape. Does not allow select construction shapes. /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_ConstructionComposite.cpp b/src/GeomValidators/GeomValidators_ConstructionComposite.cpp index 6950b6148..353e5606c 100644 --- a/src/GeomValidators/GeomValidators_ConstructionComposite.cpp +++ b/src/GeomValidators/GeomValidators_ConstructionComposite.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_ConstructionComposite.h" @@ -22,65 +23,66 @@ #include #include "ModelAPI_AttributeSelection.h" -#include "ModelAPI_ResultConstruction.h" #include "ModelAPI_CompositeFeature.h" +#include "ModelAPI_ResultConstruction.h" -bool GeomValidators_ConstructionComposite::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool GeomValidators_ConstructionComposite::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { bool aValid = true; if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { -// LCOV_EXCL_START + // LCOV_EXCL_START aValid = false; theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return aValid; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } - AttributeSelectionPtr aSelectionAttr = std::dynamic_pointer_cast - (theAttribute); + AttributeSelectionPtr aSelectionAttr = + std::dynamic_pointer_cast(theAttribute); ResultPtr aResult = aSelectionAttr->context(); - // global selection should be ignored, the filter processes only selected sub-shapes - // that means, that the shape of the context result is equal to the shape value - ///*ResultPtr aResult = std::dynamic_pointer_cast(theSelectedObject); + // global selection should be ignored, the filter processes only selected + // sub-shapes that means, that the shape of the context result is equal to the + // shape value + ///*ResultPtr aResult = + /// std::dynamic_pointer_cast(theSelectedObject); if (!aResult.get()) { aValid = false; theError = "The result is empty"; - } - else { + } else { GeomShapePtr aShape = aSelectionAttr->value(); GeomShapePtr aShapePtr = aResult->shape(); // it is important to call isEqual of the shape of result. // It is a GeomAPI_Vertex shape for the point. The shape of the parameter is - // GeomAPI_Shape. It is important to use the realization of the isEqual method from - // GeomAPI_Vertex class + // GeomAPI_Shape. It is important to use the realization of the isEqual + // method from GeomAPI_Vertex class if (!aShape.get()) { - // an empty shape is used in attribute selection if the shape of the result is equal to - // the selected shape, so according to the upper condition, the result is true + // an empty shape is used in attribute selection if the shape of the + // result is equal to the selected shape, so according to the upper + // condition, the result is true aValid = true; - } - else { + } else { if (aShapePtr->isEqual(aShape)) { aValid = true; - } - else { + } else { ResultConstructionPtr aConstr = - std::dynamic_pointer_cast(aResult); + std::dynamic_pointer_cast(aResult); if (!aConstr.get()) { - // non-construction results should be accepted by this filter, e.g. body results + // non-construction results should be accepted by this filter, e.g. + // body results aValid = true; - } - else { - // it provides selection only on composite features, construction without composite - // feature is not selectable. + } else { + // it provides selection only on composite features, construction + // without composite feature is not selectable. FeaturePtr aFeature = ModelAPI_Feature::feature(aConstr); CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); aValid = aComposite && aComposite->numberOfSubs() > 0; if (!aValid) - theError = "Uses composite construction feature without sub-features."; + theError = + "Uses composite construction feature without sub-features."; } } } diff --git a/src/GeomValidators/GeomValidators_ConstructionComposite.h b/src/GeomValidators/GeomValidators_ConstructionComposite.h index 574354b33..f540d436a 100644 --- a/src/GeomValidators/GeomValidators_ConstructionComposite.h +++ b/src/GeomValidators/GeomValidators_ConstructionComposite.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_ConstructionComposite_H @@ -24,20 +25,21 @@ #include "ModelAPI_AttributeValidator.h" /** -* \ingroup Validators -* A validator of selection -*/ -class GeomValidators_ConstructionComposite : public ModelAPI_AttributeValidator -{ - public: - GEOMVALIDATORS_EXPORT GeomValidators_ConstructionComposite() {} + * \ingroup Validators + * A validator of selection + */ +class GeomValidators_ConstructionComposite + : public ModelAPI_AttributeValidator { +public: + GEOMVALIDATORS_EXPORT GeomValidators_ConstructionComposite() {} //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_Different.cpp b/src/GeomValidators/GeomValidators_Different.cpp index 6b7c47819..b9a7191fe 100644 --- a/src/GeomValidators/GeomValidators_Different.cpp +++ b/src/GeomValidators/GeomValidators_Different.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include +#include #include -#include #include +#include const double tolerance = 1e-7; @@ -38,14 +39,14 @@ To extend GeomValidators_Different validator with new attribute types: */ //================================================================================================= -bool isEqual(const AttributePoint2DPtr& theLeft, const AttributePoint2DPtr& theRight) -{ +bool isEqual(const AttributePoint2DPtr &theLeft, + const AttributePoint2DPtr &theRight) { return theLeft->isInitialized() && theRight->isInitialized() && - theLeft->pnt()->distance(theRight->pnt()) < tolerance; + theLeft->pnt()->distance(theRight->pnt()) < tolerance; } -bool isEqualAttributes(const AttributePtr& theLeft, const AttributePtr& theRight) -{ +bool isEqualAttributes(const AttributePtr &theLeft, + const AttributePtr &theRight) { if (theLeft->attributeType() == GeomDataAPI_Point2D::typeId() && theRight->attributeType() == GeomDataAPI_Point2D::typeId()) return isEqual(std::dynamic_pointer_cast(theLeft), @@ -59,20 +60,21 @@ bool isEqualAttributes(const AttributePtr& theLeft, const AttributePtr& theRight */ class IsEqual { AttributePtr myAttribute; + public: /// Constructor - IsEqual(const AttributePtr& theAttribute) : myAttribute(theAttribute) {} + IsEqual(const AttributePtr &theAttribute) : myAttribute(theAttribute) {} /// \return true in case if AttributePtr is equal with myAttribute - bool operator()(const AttributePtr& theAttribute) { + bool operator()(const AttributePtr &theAttribute) { return isEqualAttributes(myAttribute, theAttribute); } }; -bool GeomValidators_Different::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - std::map > anAttributesMap; +bool GeomValidators_Different::isValid( + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + std::map> anAttributesMap; // For all attributes referred by theArguments // sort it using attributeType() and store into anAttributesMap std::list::const_iterator anArgumentIt = theArguments.begin(); @@ -82,21 +84,23 @@ bool GeomValidators_Different::isValid(const std::shared_ptr& } // Search differences inside each attribute list - std::map >::const_iterator - anAttributesMapIt = anAttributesMap.begin(); + std::map>::const_iterator + anAttributesMapIt = anAttributesMap.begin(); for (; anAttributesMapIt != anAttributesMap.end(); ++anAttributesMapIt) { - const std::list& anAttributes = anAttributesMapIt->second; + const std::list &anAttributes = anAttributesMapIt->second; // for the list of attributes check that all elements are unique - std::list::const_iterator anAttributeIt = anAttributes.begin(); + std::list::const_iterator anAttributeIt = + anAttributes.begin(); if (anAttributeIt != anAttributes.end()) { - std::list::const_iterator aNextIt = anAttributeIt; ++aNextIt; + std::list::const_iterator aNextIt = anAttributeIt; + ++aNextIt; while (aNextIt != anAttributes.end()) { // if equal attribute is found then all attributes are not different std::list::const_iterator aFindIt = std::find_if(aNextIt, anAttributes.end(), IsEqual(*anAttributeIt)); if (aFindIt != anAttributes.end()) { theError = "Attributes " + (*anAttributeIt)->id() + " and " + - (*aFindIt)->id() + " are equal." ; + (*aFindIt)->id() + " are equal."; return false; } ++anAttributeIt; @@ -109,8 +113,8 @@ bool GeomValidators_Different::isValid(const std::shared_ptr& } // LCOV_EXCL_START -bool GeomValidators_Different::isNotObligatory(std::string theFeature, std::string theAttribute) -{ +bool GeomValidators_Different::isNotObligatory(std::string theFeature, + std::string theAttribute) { return true; } // LCOV_EXCL_STOP diff --git a/src/GeomValidators/GeomValidators_Different.h b/src/GeomValidators/GeomValidators_Different.h index 376499ccf..65f9a574a 100644 --- a/src/GeomValidators/GeomValidators_Different.h +++ b/src/GeomValidators/GeomValidators_Different.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_Different_H @@ -28,21 +29,21 @@ * \ingroup Validators * \brief Validates that attributes are not the same. */ -class GeomValidators_Different : public ModelAPI_FeatureValidator -{ +class GeomValidators_Different : public ModelAPI_FeatureValidator { public: /** \brief Returns true if feature and/or attributes are valid. * \param[in] theFeature the validated feature. - * \param[in] theArguments the arguments in the configuration file for this validator. - * \param[out] theError error message. - * \returns true if feature is valid. + * \param[in] theArguments the arguments in the configuration file for this + * validator. \param[out] theError error message. \returns true if feature is + * valid. */ - GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; - GEOMVALIDATORS_EXPORT virtual - bool isNotObligatory(std::string theFeature, std::string theAttribute); + GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; #endif diff --git a/src/GeomValidators/GeomValidators_DifferentShapes.cpp b/src/GeomValidators/GeomValidators_DifferentShapes.cpp index 7b9dc9589..a415393a1 100644 --- a/src/GeomValidators/GeomValidators_DifferentShapes.cpp +++ b/src/GeomValidators/GeomValidators_DifferentShapes.cpp @@ -14,25 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_DifferentShapes.h" #include +#include "ModelAPI_Object.h" #include #include -#include "ModelAPI_Object.h" #include #include //================================================================================================= -bool GeomValidators_DifferentShapes::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool GeomValidators_DifferentShapes::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { bool isValid = false; std::string anAttributeType = theAttribute->attributeType(); @@ -41,25 +42,27 @@ bool GeomValidators_DifferentShapes::isValid(const AttributePtr& theAttribute, std::list anAttrs; if (isList) { AttributeSelectionListPtr aListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); // get all selection attributes from the list for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { anAttrs.push_back(aListAttr->value(anIndex)); } isValid = checkEquals(anAttrs); - } - else { + } else { // get all feature selection attributes - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); - anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); + anAttrs = + aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); isValid = checkEqualToCurrent(anAttrs, theAttribute); } if (!isValid) { - theError = isList ? "The selection list contains equal shapes." : - "The feature uses equal shapes."; + theError = isList ? "The selection list contains equal shapes." + : "The feature uses equal shapes."; return false; } @@ -67,8 +70,8 @@ bool GeomValidators_DifferentShapes::isValid(const AttributePtr& theAttribute, } //================================================================================================= -bool GeomValidators_DifferentShapes::checkEquals(std::list& theAttributes) -{ +bool GeomValidators_DifferentShapes::checkEquals( + std::list &theAttributes) { std::list::iterator anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); anIt++) { AttributePtr anAttribute = *anIt; @@ -86,11 +89,12 @@ bool GeomValidators_DifferentShapes::checkEquals(std::list& theAtt } //================================================================================================= -bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list& theAttributes, - const AttributePtr& theCurrentAttribute) -{ +bool GeomValidators_DifferentShapes::checkEqualToCurrent( + std::list &theAttributes, + const AttributePtr &theCurrentAttribute) { AttributeSelectionPtr aSelectionAttribute = - std::dynamic_pointer_cast(theCurrentAttribute); + std::dynamic_pointer_cast( + theCurrentAttribute); GeomShapePtr aShape = aSelectionAttribute->value(); ResultPtr aResultContext = aSelectionAttribute->context(); @@ -107,9 +111,10 @@ bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list for (; anAttr != theAttributes.end(); anAttr++) { AttributePtr anAttribute = *anAttr; // take into concideration only other attributes - if (anAttribute.get() != NULL && anAttribute->id() != aCurrentAttributeId) { + if (anAttribute.get() != NULL && + anAttribute->id() != aCurrentAttributeId) { aSelectionAttribute = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); // the shape of the attribute should be not the same if (aSelectionAttribute.get() != NULL) { GeomShapePtr anAttrShape = aSelectionAttribute->value(); @@ -125,16 +130,16 @@ bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list if (aResult.get()) { // check result is in feature if (aResult->document()->feature(aResult) == aFeature) return false; - } - else { // check selection of the same features + } else { // check selection of the same features if (aFeature == aSelectionAttribute->contextFeature()) return false; } - } - else { + } else { if (!aResult.get() && aResultContext.get()) { - FeaturePtr aSelectedFeature = aSelectionAttribute->contextFeature(); - if (aResultContext->document()->feature(aResultContext) == aSelectedFeature) + FeaturePtr aSelectedFeature = + aSelectionAttribute->contextFeature(); + if (aResultContext->document()->feature(aResultContext) == + aSelectedFeature) return false; } } @@ -146,13 +151,12 @@ bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list return true; } -bool GeomValidators_DifferentShapes::isAttrShapesEqual(const AttributePtr& theAttribute, - const AttributePtr& theOtherAttribute) -{ +bool GeomValidators_DifferentShapes::isAttrShapesEqual( + const AttributePtr &theAttribute, const AttributePtr &theOtherAttribute) { AttributeSelectionPtr aSelectionAttribute = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); AttributeSelectionPtr anOtherSelectionAttribute = - std::dynamic_pointer_cast(theOtherAttribute); + std::dynamic_pointer_cast(theOtherAttribute); GeomShapePtr aShape = aSelectionAttribute->value(); if (!aShape.get()) { diff --git a/src/GeomValidators/GeomValidators_DifferentShapes.h b/src/GeomValidators/GeomValidators_DifferentShapes.h index dedb4e818..98a6fda48 100644 --- a/src/GeomValidators/GeomValidators_DifferentShapes.h +++ b/src/GeomValidators/GeomValidators_DifferentShapes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_DifferentShapes_H @@ -22,33 +23,32 @@ #include -#include #include +#include /** * Generic validator for any attribute of a feature. */ -class GeomValidators_DifferentShapes : public ModelAPI_AttributeValidator -{ +class GeomValidators_DifferentShapes : public ModelAPI_AttributeValidator { public: - /// returns True if the attribute is valid. It checks whether the feature of the attribute - /// does not contain a selection attribute filled with the same shape - /// \param[in] theAttribute an attribute to check - /// \param[in] theArguments a filter parameters - /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + /// returns True if the attribute is valid. It checks whether the feature of + /// the attribute does not contain a selection attribute filled with the same + /// shape \param[in] theAttribute an attribute to check \param[in] + /// theArguments a filter parameters \param[out] theError error message. + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; private: /// Check if the list contains equal shape selection. - static bool checkEquals(std::list& theAttributes); + static bool checkEquals(std::list &theAttributes); /// Check if the list contains shape selection equal to the given one. - static bool checkEqualToCurrent(std::list& theAttributes, - const AttributePtr& theCurrentAttribute); + static bool checkEqualToCurrent(std::list &theAttributes, + const AttributePtr &theCurrentAttribute); /// Check if shapes corresponding to the attributes are equal. - static bool isAttrShapesEqual(const AttributePtr& theAttribute, - const AttributePtr& theOtherAttribute); + static bool isAttrShapesEqual(const AttributePtr &theAttribute, + const AttributePtr &theOtherAttribute); }; #endif diff --git a/src/GeomValidators/GeomValidators_Face.cpp b/src/GeomValidators/GeomValidators_Face.cpp index ca659af4c..ecc466c66 100644 --- a/src/GeomValidators/GeomValidators_Face.cpp +++ b/src/GeomValidators/GeomValidators_Face.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_Face.h" @@ -32,8 +33,7 @@ typedef std::map FaceTypes; static FaceTypes MyFaceTypes; -GeomAbs_SurfaceType faceType(const std::string& theType) -{ +GeomAbs_SurfaceType faceType(const std::string &theType) { if (MyFaceTypes.size() == 0) { MyFaceTypes["plane"] = GeomAbs_Plane; MyFaceTypes["cylinder"] = GeomAbs_Cylinder; @@ -42,87 +42,89 @@ GeomAbs_SurfaceType faceType(const std::string& theType) if (MyFaceTypes.find(aType) != MyFaceTypes.end()) return MyFaceTypes[aType]; -// LCOV_EXCL_START - Events_InfoMessage("GeomValidators_Face", "Face type defined in XML is not implemented!").send(); + // LCOV_EXCL_START + Events_InfoMessage("GeomValidators_Face", + "Face type defined in XML is not implemented!") + .send(); return GeomAbs_Plane; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } bool isValidFace(const GeomShapePtr theShape, const GeomAbs_SurfaceType theFaceType, - Events_InfoMessage& theError) -{ + Events_InfoMessage &theError) { GeomFacePtr aGeomFace = theShape->face(); if (!aGeomFace.get()) { theError = "The shape is not a face."; - return false; + return false; } bool aValid = true; switch (theFaceType) { - case GeomAbs_Plane: { - aValid = aGeomFace->isPlanar(); - if (!aValid) theError = "The shape is not a plane."; - break; - } - case GeomAbs_Cylinder: { - aValid = aGeomFace->isCylindrical(); - if (!aValid) theError = "The shape is not a cylinder."; - break; - } - default: { - aValid = false; - theError = "The shape is not an available face."; - break; - } + case GeomAbs_Plane: { + aValid = aGeomFace->isPlanar(); + if (!aValid) + theError = "The shape is not a plane."; + break; + } + case GeomAbs_Cylinder: { + aValid = aGeomFace->isCylindrical(); + if (!aValid) + theError = "The shape is not a cylinder."; + break; + } + default: { + aValid = false; + theError = "The shape is not an available face."; + break; + } } return aValid; } -bool GeomValidators_Face::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_Face::isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType != ModelAPI_AttributeSelection::typeId()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } bool aValid = true; ObjectPtr anObject = GeomValidators_Tools::getObject(theAttribute); if (!anObject.get()) { aValid = true; // an empty face selected is valid. - } - else { + } else { AttributeSelectionPtr aSelectionAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); std::shared_ptr aGeomShape = aSelectionAttr->value(); if (!aGeomShape.get()) { // if the shape is empty, apply the validator to the shape of result aGeomShape = aSelectionAttr->context()->shape(); } - // it is necessary to check whether the shape is face in order to set in selection a value - // with any type and check the type in this validator - // It is realized to select any object in OB and filter it in this validator (sketch plane) + // it is necessary to check whether the shape is face in order to set in + // selection a value with any type and check the type in this validator It + // is realized to select any object in OB and filter it in this validator + // (sketch plane) GeomAbs_SurfaceType aFaceType = GeomAbs_Plane; if (theArguments.size() == 1) aFaceType = faceType(theArguments.front()); if (aGeomShape->isFace()) { aValid = isValidFace(aGeomShape, aFaceType, theError); - } - else if (aSelectionAttr->isGeometricalSelection() && aGeomShape->isCompound()) { - for (GeomAPI_ShapeIterator anIt(aGeomShape); anIt.more() && aValid; anIt.next()) { + } else if (aSelectionAttr->isGeometricalSelection() && + aGeomShape->isCompound()) { + for (GeomAPI_ShapeIterator anIt(aGeomShape); anIt.more() && aValid; + anIt.next()) { aValid = isValidFace(anIt.current(), aFaceType, theError); } - } - else { + } else { aValid = false; theError = "The shape is not a face."; } diff --git a/src/GeomValidators/GeomValidators_Face.h b/src/GeomValidators/GeomValidators_Face.h index bd0e997a5..45d6d93dc 100644 --- a/src/GeomValidators/GeomValidators_Face.h +++ b/src/GeomValidators/GeomValidators_Face.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_Face_H @@ -24,20 +25,20 @@ #include "ModelAPI_AttributeValidator.h" /** -* \ingroup Validators -* A validator of selection -*/ -class GeomValidators_Face : public ModelAPI_AttributeValidator -{ - public: - GEOMVALIDATORS_EXPORT GeomValidators_Face() {} + * \ingroup Validators + * A validator of selection + */ +class GeomValidators_Face : public ModelAPI_AttributeValidator { +public: + GEOMVALIDATORS_EXPORT GeomValidators_Face() {} //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_FeatureKind.cpp b/src/GeomValidators/GeomValidators_FeatureKind.cpp index 167d1e113..d94febb55 100644 --- a/src/GeomValidators/GeomValidators_FeatureKind.cpp +++ b/src/GeomValidators/GeomValidators_FeatureKind.cpp @@ -14,32 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_FeatureKind.h" #include -#include -#include #include +#include #include +#include #include #define DEBUG_EXTRUSION_INVALID_SKETCH #ifdef DEBUG_EXTRUSION_INVALID_SKETCH - #include +#include #endif -bool GeomValidators_FeatureKind::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_FeatureKind::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { bool isSketchEntities = true; std::set anEntityKinds; std::string anEntityKindsStr; - std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anIt = theArguments.begin(), + aLast = theArguments.end(); for (; anIt != aLast; anIt++) { anEntityKinds.insert(*anIt); if (!anEntityKindsStr.empty()) @@ -50,21 +52,24 @@ bool GeomValidators_FeatureKind::isValid(const AttributePtr& theAttribute, std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ObjectPtr anObject = aSelectAttr->context(); - // a context of the selection attribute is a feature result. It can be a case when the result - // of the feature is null, e.g. the feature is modified and has not been executed yet. - // The validator returns an invalid result here. The case is an extrusion built on a sketch - // feature. A new sketch element creation leads to an empty result. + // a context of the selection attribute is a feature result. It can be a + // case when the result of the feature is null, e.g. the feature is modified + // and has not been executed yet. The validator returns an invalid result + // here. The case is an extrusion built on a sketch feature. A new sketch + // element creation leads to an empty result. if (!anObject.get()) isSketchEntities = false; else { FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); - isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end(); + isSketchEntities = + anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end(); } } if (!isSketchEntities) { - theError = "It refers to feature, which kind is not in the list: " + anEntityKindsStr; + theError = "It refers to feature, which kind is not in the list: " + + anEntityKindsStr; } return isSketchEntities; diff --git a/src/GeomValidators/GeomValidators_FeatureKind.h b/src/GeomValidators/GeomValidators_FeatureKind.h index 99c774cad..e2ca50bcf 100644 --- a/src/GeomValidators/GeomValidators_FeatureKind.h +++ b/src/GeomValidators/GeomValidators_FeatureKind.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_FeatureKind_H @@ -22,23 +23,23 @@ #include -#include #include +#include /** * Generic validator for any attribute of a feature. */ -class GeomValidators_FeatureKind : public ModelAPI_AttributeValidator -{ +class GeomValidators_FeatureKind : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the shape is a /// body subshape. Does not allow select construction shapes. /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_Finite.cpp b/src/GeomValidators/GeomValidators_Finite.cpp index 177db209d..b6aa17e9b 100644 --- a/src/GeomValidators/GeomValidators_Finite.cpp +++ b/src/GeomValidators/GeomValidators_Finite.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,33 +25,35 @@ #include #include -bool GeomValidators_Finite::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool GeomValidators_Finite::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { bool aValid = true; const std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectionAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aResult = aSelectionAttr->context(); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aResult); + std::dynamic_pointer_cast(aResult); if (aConstruction.get() && aConstruction->isInfinite()) { aValid = false; theError = "Infinite result is selected."; } - } else if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) { AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); ResultPtr aResult = aSelectAttr->context(); - if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) { + if (aResult.get() && + aResult->groupName() == ModelAPI_ResultConstruction::group()) { ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aResult); + std::dynamic_pointer_cast(aResult); if (aConstruction.get() && aConstruction->isInfinite()) { aValid = false; theError = "Infinite result is selected."; @@ -60,4 +63,3 @@ bool GeomValidators_Finite::isValid(const AttributePtr& theAttribute, } return aValid; } - diff --git a/src/GeomValidators/GeomValidators_Finite.h b/src/GeomValidators/GeomValidators_Finite.h index 8d9fc7d16..a3072b4bf 100644 --- a/src/GeomValidators/GeomValidators_Finite.h +++ b/src/GeomValidators/GeomValidators_Finite.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_Finite_H @@ -24,19 +25,20 @@ #include /** -* \ingroup Validators -* A validator for finite objects. It returns false for construction infinite results. -*/ -class GeomValidators_Finite : public ModelAPI_AttributeValidator -{ + * \ingroup Validators + * A validator for finite objects. It returns false for construction infinite + * results. + */ +class GeomValidators_Finite : public ModelAPI_AttributeValidator { public: //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_GlobalSelection.cpp b/src/GeomValidators/GeomValidators_GlobalSelection.cpp index de548d67c..738475323 100644 --- a/src/GeomValidators/GeomValidators_GlobalSelection.cpp +++ b/src/GeomValidators/GeomValidators_GlobalSelection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_GlobalSelection.h" @@ -23,18 +24,18 @@ #include #include +#include #include #include -#include -bool GeomValidators_GlobalSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_GlobalSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { + if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttrSelection = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttrSelection->context(); if (!aContext.get()) { theError = "Error: Context is empty."; @@ -46,23 +47,26 @@ bool GeomValidators_GlobalSelection::isValid(const AttributePtr& theAttribute, theError = "Error: Local selection not allowed."; return false; } - } else if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); // All objects should not be result constructions. - for(int anIndex = 0, aSize = anAttrSelectionList->size(); anIndex < aSize; ++anIndex) { - AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); - if(!isValid(anAttrSelection, theArguments, theError)) { + for (int anIndex = 0, aSize = anAttrSelectionList->size(); anIndex < aSize; + ++anIndex) { + AttributeSelectionPtr anAttrSelection = + anAttrSelectionList->value(anIndex); + if (!isValid(anAttrSelection, theArguments, theError)) { return false; } } } else { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Attribute \"%1\" does not supported by this validator."; theError.arg(anAttributeType); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } return true; diff --git a/src/GeomValidators/GeomValidators_GlobalSelection.h b/src/GeomValidators/GeomValidators_GlobalSelection.h index 3bb0af027..5695a7b9d 100644 --- a/src/GeomValidators/GeomValidators_GlobalSelection.h +++ b/src/GeomValidators/GeomValidators_GlobalSelection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_GlobalSelection_H @@ -22,23 +23,23 @@ #include -#include #include +#include /** * Check the Selection/SelectionList attribute for result selected. */ -class GeomValidators_GlobalSelection : public ModelAPI_AttributeValidator -{ +class GeomValidators_GlobalSelection : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. /// It checks whether the selected object is a full result. /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_Intersected.cpp b/src/GeomValidators/GeomValidators_Intersected.cpp index 1f580ebba..8208f7d39 100644 --- a/src/GeomValidators/GeomValidators_Intersected.cpp +++ b/src/GeomValidators/GeomValidators_Intersected.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_Intersected.h" @@ -26,11 +27,11 @@ #include #include -bool GeomValidators_Intersected::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START +bool GeomValidators_Intersected::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START if (!theAttribute) { theError = "Error: empty selection."; return false; @@ -40,7 +41,7 @@ bool GeomValidators_Intersected::isValid(const AttributePtr& theAttribute, theError = "Error: compare with nothing"; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); @@ -60,12 +61,12 @@ bool GeomValidators_Intersected::isValid(const AttributePtr& theAttribute, for (std::list::const_iterator anIt = theArguments.begin(); anIt != theArguments.end() && isOk; ++anIt) { aSelection = aFeature->selection(*anIt); -// LCOV_EXCL_START + // LCOV_EXCL_START if (!aSelection) { theError = "Error: incorrect type of attribute"; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP GeomShapePtr aShape; if (aSelection) diff --git a/src/GeomValidators/GeomValidators_Intersected.h b/src/GeomValidators/GeomValidators_Intersected.h index 5589fd6f0..af010c08c 100644 --- a/src/GeomValidators/GeomValidators_Intersected.h +++ b/src/GeomValidators/GeomValidators_Intersected.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_Intersected_H @@ -22,23 +23,23 @@ #include -#include #include +#include /// \class GeomValidators_Intersected /// \ingroup Validators /// \brief Validates that selected shapes are intersected. -class GeomValidators_Intersected : public ModelAPI_AttributeValidator -{ +class GeomValidators_Intersected : public ModelAPI_AttributeValidator { public: /// \return True if the attribute is valid. It checks whether the selection /// is intersected with shape given as a name of attribute. /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_IntersectionSelection.cpp b/src/GeomValidators/GeomValidators_IntersectionSelection.cpp index fa32df230..48fbcbc2f 100644 --- a/src/GeomValidators/GeomValidators_IntersectionSelection.cpp +++ b/src/GeomValidators/GeomValidators_IntersectionSelection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_IntersectionSelection.h" @@ -27,26 +28,27 @@ #include #include -bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - if(!theAttribute.get()) { +bool GeomValidators_IntersectionSelection::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + if (!theAttribute.get()) { theError = "Error: empty selection."; return false; } - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(theAttribute); - for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { + std::dynamic_pointer_cast(theAttribute); + for (int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); - if(!anAttrSelection.get()) { + if (!anAttrSelection.get()) { theError = "Error: empty attribute selection."; return false; } FeaturePtr aFeature; ResultPtr aContext = anAttrSelection->context(); - if(!aContext.get()) { + if (!aContext.get()) { aFeature = anAttrSelection->contextFeature(); if (!aFeature.get()) { theError = "Error: Empty selection context."; @@ -56,39 +58,38 @@ bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttrib aFeature = ModelAPI_Feature::feature(aContext); } - if(!aFeature.get()) { + if (!aFeature.get()) { theError = "Error: empty feature."; return false; } std::string aFeatureKind = aFeature->getKind(); - if(aFeatureKind == "Sketch" || - aFeatureKind == "Plane" || - aFeatureKind == "Axis") { + if (aFeatureKind == "Sketch" || aFeatureKind == "Plane" || + aFeatureKind == "Axis") { theError = "Error: %1 shape is not allowed for selection."; theError.arg(aFeatureKind); return false; } std::shared_ptr aShape = anAttrSelection->value(); GeomShapePtr aContextShape = aContext->shape(); - if(!aShape.get()) { + if (!aShape.get()) { aShape = aContextShape; } - if(!aShape.get()) { + if (!aShape.get()) { theError = "Error: empty shape."; return false; } - if(!aShape->isEqual(aContextShape)) { + if (!aShape->isEqual(aContextShape)) { theError = "Error: Local selection not allowed."; return false; } int aShapeType = aShape->shapeType(); // Allow to select edges, faces and solids. - if(aShapeType != GeomAPI_Shape::EDGE && - aShapeType != GeomAPI_Shape::FACE && - aShapeType != GeomAPI_Shape::SOLID && - aShapeType != GeomAPI_Shape::COMPSOLID && - aShapeType != GeomAPI_Shape::COMPOUND) { + if (aShapeType != GeomAPI_Shape::EDGE && + aShapeType != GeomAPI_Shape::FACE && + aShapeType != GeomAPI_Shape::SOLID && + aShapeType != GeomAPI_Shape::COMPSOLID && + aShapeType != GeomAPI_Shape::COMPOUND) { theError = "Error: selected shape has the wrong type."; return false; } diff --git a/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp b/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp index 623310ef3..e7815e250 100644 --- a/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp +++ b/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,38 +25,40 @@ #include #include -#include #include +#include //================================================================================================= -bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_MinObjectsSelected::isValid( + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theArguments.size() != 2) { -// LCOV_EXCL_START - theError = - "Error: Wrong number of arguments (expected 2): selection list id and min number of objects"; + // LCOV_EXCL_START + theError = "Error: Wrong number of arguments (expected 2): selection list " + "id and min number of objects"; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } //"Interpolation" - if (theFeature->name().substr(0, 6) == L"Interp") - { - AttributeStringPtr anAttr =theFeature->string(BuildPlugin_Interpolation::CREATION_METHOD_ID()); + if (theFeature->name().substr(0, 6) == L"Interp") { + AttributeStringPtr anAttr = + theFeature->string(BuildPlugin_Interpolation::CREATION_METHOD_ID()); if (anAttr->isInitialized()) - if (anAttr->value() == BuildPlugin_Interpolation::CREATION_METHOD_ANALYTICAL_ID()) + if (anAttr->value() == + BuildPlugin_Interpolation::CREATION_METHOD_ANALYTICAL_ID()) return true; } std::string aSelectionListId = theArguments.front(); - AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(aSelectionListId); + AttributeSelectionListPtr anAttrSelList = + theFeature->selectionList(aSelectionListId); if (!anAttrSelList.get()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Could not get attribute \"%1\"."; theError.arg(aSelectionListId); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } int anObjectsNb = anAttrSelList->size(); diff --git a/src/GeomValidators/GeomValidators_MinObjectsSelected.h b/src/GeomValidators/GeomValidators_MinObjectsSelected.h index a33b0ac8c..0362c2be7 100644 --- a/src/GeomValidators/GeomValidators_MinObjectsSelected.h +++ b/src/GeomValidators/GeomValidators_MinObjectsSelected.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_MinObjectsSelected_H @@ -27,17 +28,17 @@ /// \class GeomValidators_MinObjectsSelected /// \ingroup Validators /// \brief Validates number of objects in selection list. -class GeomValidators_MinObjectsSelected : public ModelAPI_FeatureValidator -{ +class GeomValidators_MinObjectsSelected : public ModelAPI_FeatureValidator { public: /// \return true if selection list has enough objects. /// \param[in] theFeature the validated feature. - /// \param[in] theArguments the arguments in the configuration file for this validator. - /// \param[out] theError error message. - /// \returns true if feature is valid. - GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + /// \param[in] theArguments the arguments in the configuration file for this + /// validator. \param[out] theError error message. \returns true if feature is + /// valid. + GEOMVALIDATORS_EXPORT virtual bool + isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp index ac6ce686b..53e37739c 100644 --- a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp +++ b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_NotSelfIntersected.h" @@ -27,39 +28,41 @@ #include #include -bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START +bool GeomValidators_NotSelfIntersected::isValid( + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START if (theArguments.empty()) { theError = "Error: empty selection."; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP for (std::list::const_iterator anIt = theArguments.cbegin(); - anIt != theArguments.cend(); - ++anIt) - { + anIt != theArguments.cend(); ++anIt) { std::string anArgument = *anIt; AttributePtr anAttribute = theFeature->attribute(anArgument); if (!anAttribute.get()) { -// LCOV_EXCL_START - theError = std::string("Error: Feature does not contain attribute: ") + anArgument; + // LCOV_EXCL_START + theError = std::string("Error: Feature does not contain attribute: ") + + anArgument; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } - if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { + if (anAttribute->attributeType() == + ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttrSelectionList = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast( + anAttribute); for (int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) { - AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); + AttributeSelectionPtr anAttrSelection = + anAttrSelectionList->value(anIndex); if (!anAttrSelection.get()) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Error: Empty attribute selection."; return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } ResultPtr aContext = anAttrSelection->context(); if (!aContext.get()) { @@ -85,11 +88,13 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptrattributeType(); + // LCOV_EXCL_START + theError = + std::string( + "Error: validator does not support attribute with type: ") + + anAttribute->attributeType(); return false; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } } @@ -97,9 +102,8 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; - /// \return true if the attribute in feature is not obligatory for the feature execution. + /// \return true if the attribute in feature is not obligatory for the feature + /// execution. GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); }; diff --git a/src/GeomValidators/GeomValidators_Plugin.cpp b/src/GeomValidators/GeomValidators_Plugin.cpp index a79169d5b..5f25dbfc4 100644 --- a/src/GeomValidators/GeomValidators_Plugin.cpp +++ b/src/GeomValidators/GeomValidators_Plugin.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,51 +25,58 @@ #include #include #include +#include #include #include -#include -#include -#include -#include #include +#include #include +#include +#include #include #include // the only created instance of this plugin -static GeomValidators_Plugin* MY_GEOMVALIDATORS_INSTANCE = new GeomValidators_Plugin(); +static GeomValidators_Plugin *MY_GEOMVALIDATORS_INSTANCE = + new GeomValidators_Plugin(); -GeomValidators_Plugin::GeomValidators_Plugin() -{ +GeomValidators_Plugin::GeomValidators_Plugin() { // register validators SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); - aFactory->registerValidator("GeomValidators_BodyShapes", new GeomValidators_BodyShapes); + aFactory->registerValidator("GeomValidators_BodyShapes", + new GeomValidators_BodyShapes); aFactory->registerValidator("GeomValidators_ConstructionComposite", new GeomValidators_ConstructionComposite); - aFactory->registerValidator("GeomValidators_Different", new GeomValidators_Different); + aFactory->registerValidator("GeomValidators_Different", + new GeomValidators_Different); aFactory->registerValidator("GeomValidators_DifferentShapes", new GeomValidators_DifferentShapes); aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face); - aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite); - aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType); - aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset); - aFactory->registerValidator("GeomValidators_FeatureKind", new GeomValidators_FeatureKind); + aFactory->registerValidator("GeomValidators_Finite", + new GeomValidators_Finite); + aFactory->registerValidator("GeomValidators_ShapeType", + new GeomValidators_ShapeType); + aFactory->registerValidator("GeomValidators_ZeroOffset", + new GeomValidators_ZeroOffset); + aFactory->registerValidator("GeomValidators_FeatureKind", + new GeomValidators_FeatureKind); aFactory->registerValidator("GeomValidators_MinObjectsSelected", new GeomValidators_MinObjectsSelected); - aFactory->registerValidator("GeomValidators_Intersected", new GeomValidators_Intersected); + aFactory->registerValidator("GeomValidators_Intersected", + new GeomValidators_Intersected); aFactory->registerValidator("GeomValidators_NotSelfIntersected", new GeomValidators_NotSelfIntersected); - aFactory->registerValidator("GeomValidators_GlobalSelection", new GeomValidators_GlobalSelection); + aFactory->registerValidator("GeomValidators_GlobalSelection", + new GeomValidators_GlobalSelection); // Do not register this plugin because it doesn't create features - //ModelAPI_Session::get()->registerPlugin(this); + // ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr GeomValidators_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr GeomValidators_Plugin::createFeature(std::string theFeatureID) { // feature of such kind is not found return FeaturePtr(); } diff --git a/src/GeomValidators/GeomValidators_Plugin.h b/src/GeomValidators/GeomValidators_Plugin.h index e19044fc9..f7170eeef 100644 --- a/src/GeomValidators/GeomValidators_Plugin.h +++ b/src/GeomValidators/GeomValidators_Plugin.h @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GEOMVALIDATORS_PLUGIN_H_ #define GEOMVALIDATORS_PLUGIN_H_ #include -#include #include +#include /**\class GeomValidators_Plugin * \ingroup Plugins - * \brief Interface common for any plugin: allows to use plugin by the plugins manager. + * \brief Interface common for any plugin: allows to use plugin by the plugins + * manager. */ -class GEOMVALIDATORS_EXPORT GeomValidators_Plugin : public ModelAPI_Plugin -{ +class GEOMVALIDATORS_EXPORT GeomValidators_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); diff --git a/src/GeomValidators/GeomValidators_Positive.cpp b/src/GeomValidators/GeomValidators_Positive.cpp index d9ccea0d0..523501f08 100644 --- a/src/GeomValidators/GeomValidators_Positive.cpp +++ b/src/GeomValidators/GeomValidators_Positive.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_Positive.h" @@ -32,18 +33,17 @@ /// Global instance for validators factory GeomValidators_Positive MY_POSITIVE_INSTANCE; -GeomValidators_Positive::GeomValidators_Positive() -{ +GeomValidators_Positive::GeomValidators_Positive() { // this validator is registered in the factory on this library loading SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("GeomValidators_Positive", this); } -bool GeomValidators_Positive::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_Positive::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { double aMinValue = 1.e-12; if (theArguments.size() == 1) { std::list::const_iterator anIt = theArguments.begin(); diff --git a/src/GeomValidators/GeomValidators_Positive.h b/src/GeomValidators/GeomValidators_Positive.h index 98fb471eb..002e42fee 100644 --- a/src/GeomValidators/GeomValidators_Positive.h +++ b/src/GeomValidators/GeomValidators_Positive.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_ValidatorPositive_H @@ -26,19 +27,19 @@ /** * Validates that the double attribute is greater than 1.e-5 */ -class GeomValidators_Positive : public ModelAPI_AttributeValidator -{ +class GeomValidators_Positive : public ModelAPI_AttributeValidator { public: - //! Constructor for only one instance per application: will register the validator + //! Constructor for only one instance per application: will register the + //! validator GeomValidators_Positive(); //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; - + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index 98b1ba18b..eeb014060 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_ShapeType.h" @@ -24,43 +25,41 @@ #include #include -#include -#include -#include #include -#include #include +#include +#include +#include +#include #include #include -#include #include - +#include typedef std::map EdgeTypes; static EdgeTypes MyShapeTypes; GeomValidators_ShapeType::TypeOfShape - GeomValidators_ShapeType::shapeType(const std::string& theType) -{ +GeomValidators_ShapeType::shapeType(const std::string &theType) { if (MyShapeTypes.size() == 0) { - MyShapeTypes["empty"] = Empty; - MyShapeTypes["vertex"] = Vertex; - MyShapeTypes["vertices"] = Vertex; - MyShapeTypes["edge"] = Edge; - MyShapeTypes["edges"] = Edge; - MyShapeTypes["line"] = Line; - MyShapeTypes["circle"] = Circle; - MyShapeTypes["wire"] = Wire; - MyShapeTypes["face"] = Face; - MyShapeTypes["faces"] = Face; - MyShapeTypes["plane"] = Plane; - MyShapeTypes["shell"] = Shell; - MyShapeTypes["solid"] = Solid; - MyShapeTypes["solids"] = Solid; + MyShapeTypes["empty"] = Empty; + MyShapeTypes["vertex"] = Vertex; + MyShapeTypes["vertices"] = Vertex; + MyShapeTypes["edge"] = Edge; + MyShapeTypes["edges"] = Edge; + MyShapeTypes["line"] = Line; + MyShapeTypes["circle"] = Circle; + MyShapeTypes["wire"] = Wire; + MyShapeTypes["face"] = Face; + MyShapeTypes["faces"] = Face; + MyShapeTypes["plane"] = Plane; + MyShapeTypes["shell"] = Shell; + MyShapeTypes["solid"] = Solid; + MyShapeTypes["solids"] = Solid; MyShapeTypes["compsolid"] = CompSolid; - MyShapeTypes["compound"] = Compound; + MyShapeTypes["compound"] = Compound; } std::string aType = std::string(theType.c_str()); std::transform(aType.begin(), aType.end(), aType.begin(), @@ -68,20 +67,21 @@ GeomValidators_ShapeType::TypeOfShape if (MyShapeTypes.find(aType) != MyShapeTypes.end()) return MyShapeTypes[aType]; -// LCOV_EXCL_START - //Events_InfoMessage("Shape type defined in XML is not implemented!").send(); + // LCOV_EXCL_START + // Events_InfoMessage("Shape type defined in XML is not implemented!").send(); return AnyShape; -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } // LCOV_EXCL_START -std::string getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape& theType) -{ +std::string +getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape &theType) { std::string aValue = ""; if (MyShapeTypes.size() != 0) { std::map::const_iterator - anIt = MyShapeTypes.begin(), aLast = MyShapeTypes.end(); + anIt = MyShapeTypes.begin(), + aLast = MyShapeTypes.end(); for (; anIt != aLast; anIt++) if (anIt->second == theType) { aValue = anIt->first; @@ -92,13 +92,14 @@ std::string getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape& } // LCOV_EXCL_STOP -bool GeomValidators_ShapeType::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_ShapeType::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { bool aValid = false; - std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anIt = theArguments.begin(), + aLast = theArguments.end(); // returns true if the attribute satisfies at least one of given arguments for (; anIt != aLast; anIt++) { TypeOfShape aShapeType = shapeType(*anIt); @@ -128,122 +129,110 @@ bool GeomValidators_ShapeType::isValid(const AttributePtr& theAttribute, return aValid; } -bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute, - const TypeOfShape theShapeType, - Events_InfoMessage& theError) const -{ +bool GeomValidators_ShapeType::isValidAttribute( + const AttributePtr &theAttribute, const TypeOfShape theShapeType, + Events_InfoMessage &theError) const { bool aValid = true; std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); GeomShapePtr aShape = anAttr->value(); if (aShape.get()) - aValid = isValidShape(aShape, theShapeType, anAttr->isGeometricalSelection(), theError); + aValid = isValidShape(aShape, theShapeType, + anAttr->isGeometricalSelection(), theError); else { if (anAttr->context().get()) - aValid = isValidObject(anAttr->context(), - theShapeType, - anAttr->isGeometricalSelection(), - theError); + aValid = isValidObject(anAttr->context(), theShapeType, + anAttr->isGeometricalSelection(), theError); else - aValid = isValidObject(anAttr->contextFeature(), - theShapeType, - anAttr->isGeometricalSelection(), - theError); + aValid = isValidObject(anAttr->contextFeature(), theShapeType, + anAttr->isGeometricalSelection(), theError); } - } - else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) { - AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); + } else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) { + AttributeRefAttrPtr anAttr = + std::dynamic_pointer_cast(theAttribute); if (anAttr->isObject()) { - aValid = isValidObject(anAttr->object(), - theShapeType, - false, - theError); - } - else if (theShapeType == Vertex) { + aValid = isValidObject(anAttr->object(), theShapeType, false, theError); + } else if (theShapeType == Vertex) { AttributePtr aRefAttr = anAttr->attr(); - if (!aRefAttr.get()){ + if (!aRefAttr.get()) { aValid = false; theError = "It has reference to an empty attribute"; - } - else { + } else { std::string anAttrType = aRefAttr->attributeType(); aValid = anAttrType == GeomDataAPI_Point2D::typeId(); if (!aValid) { -// LCOV_EXCL_START + // LCOV_EXCL_START theError = "Shape type is \"%1\", it should be \"%2\""; theError.arg(anAttrType).arg(getShapeTypeDescription(theShapeType)); -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } } - } - else + } else aValid = false; - } - else if (anAttributeType == ModelAPI_AttributeReference::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); aValid = isValidObject(anAttr->value(), theShapeType, false, theError); - } - else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aListAttr = - std::dynamic_pointer_cast(theAttribute); - // the Empty value means that the attribute selection list is valid if it is empty + std::dynamic_pointer_cast( + theAttribute); + // the Empty value means that the attribute selection list is valid if it is + // empty if (aListAttr->size() == 0 && theShapeType == Empty) { return true; } - aValid = false; // the list should have elements if the shape type is not Empty + aValid = + false; // the list should have elements if the shape type is not Empty for (int i = 0; i < aListAttr->size(); i++) { aValid = isValidAttribute(aListAttr->value(i), theShapeType, theError); if (!aValid) // if at least one attribute is invalid, the result is false break; } - } - else { -// LCOV_EXCL_START + } else { + // LCOV_EXCL_START aValid = false; theError = "The attribute with the %1 type is not processed"; theError.arg(anAttributeType); -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP } if (aValid) theError = ""; return aValid; } -bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject, - const TypeOfShape theShapeType, - const bool theIsGeometricalSelection, - Events_InfoMessage& theError) const -{ +bool GeomValidators_ShapeType::isValidObject( + const ObjectPtr &theObject, const TypeOfShape theShapeType, + const bool theIsGeometricalSelection, Events_InfoMessage &theError) const { bool aValid = true; if (!theObject.get()) { - if(theShapeType != Empty) { + if (theShapeType != Empty) { aValid = false; theError = "The object is empty"; } - } - else { + } else { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { - if (theShapeType == Plane) - { + if (theShapeType == Plane) { ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(theObject); + std::dynamic_pointer_cast(theObject); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - const std::string& aKind = aFeature->getKind(); + const std::string &aKind = aFeature->getKind(); return aResult.get() != NULL && aKind == "Plane"; } if (!aResult.get()) { aValid = false; theError = "The result is empty"; } else { - aValid = isValidShape(aResult->shape(), theShapeType, theIsGeometricalSelection, theError); + aValid = isValidShape(aResult->shape(), theShapeType, + theIsGeometricalSelection, theError); } } else { - FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theObject); if (aFeature.get() && (theShapeType == CompSolid)) return aValid; else { @@ -255,18 +244,15 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject, return aValid; } -bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape, - const TypeOfShape theShapeType, - const bool theIsGeometricalSelection, - Events_InfoMessage& theError) const -{ +bool GeomValidators_ShapeType::isValidShape( + const GeomShapePtr theShape, const TypeOfShape theShapeType, + const bool theIsGeometricalSelection, Events_InfoMessage &theError) const { bool aValid = true; if (!theShape.get()) { aValid = false; theError = "The shape is empty"; - } - else { + } else { switch (theShapeType) { case Vertex: aValid = theShape->isVertex(); @@ -278,13 +264,13 @@ bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape, if (theIsGeometricalSelection && theShape->isCompound()) { aValid = true; for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) { - if (!anIt.current()->isEdge() || !GeomAPI_Curve(anIt.current()).isLine()) { + if (!anIt.current()->isEdge() || + !GeomAPI_Curve(anIt.current()).isLine()) { aValid = false; break; } } - } - else { + } else { aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine(); } break; diff --git a/src/GeomValidators/GeomValidators_ShapeType.h b/src/GeomValidators/GeomValidators_ShapeType.h index 23cd4cd07..0cd991c73 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.h +++ b/src/GeomValidators/GeomValidators_ShapeType.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_ShapeType_H @@ -28,17 +29,15 @@ #include /** -* \ingroup Validators -* A validator for shape types, such as vertex, line, circe or arc. -* If there are some argument parameters, this validator returns true if the attribute satisfied -* at least one argument (OR combination of arguments). -*/ -class GeomValidators_ShapeType : public ModelAPI_AttributeValidator -{ - public: + * \ingroup Validators + * A validator for shape types, such as vertex, line, circe or arc. + * If there are some argument parameters, this validator returns true if the + * attribute satisfied at least one argument (OR combination of arguments). + */ +class GeomValidators_ShapeType : public ModelAPI_AttributeValidator { +public: /// Type of shape - enum TypeOfShape - { + enum TypeOfShape { Empty, Vertex, Edge, @@ -54,19 +53,21 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator AnyShape }; - public: - GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {} +public: + GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {} //! Returns true if attribute has shape type listed in the parameter arguments //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; /// Convert string to TypeOfShape value /// \param theType a string value - GEOMVALIDATORS_EXPORT static TypeOfShape shapeType(const std::string& theType); + GEOMVALIDATORS_EXPORT static TypeOfShape + shapeType(const std::string &theType); protected: /// Returns true if the attibute's object type satisfies the argument value @@ -74,28 +75,25 @@ protected: /// \param[in] theShapeType a type of shape /// \param[out] theError error message. GEOMVALIDATORS_EXPORT - bool isValidAttribute(const AttributePtr& theAttribute, + bool isValidAttribute(const AttributePtr &theAttribute, const TypeOfShape theShapeType, - Events_InfoMessage& theError) const; + Events_InfoMessage &theError) const; /// Returns true if the attibute's object type satisfies the argument value /// \param[in] theObject a checked object /// \param[in] theShapeType a shape type /// \param[out] theError error message. - bool isValidObject(const ObjectPtr& theObject, - const TypeOfShape theShapeType, + bool isValidObject(const ObjectPtr &theObject, const TypeOfShape theShapeType, const bool theIsGeometricalSelection, - Events_InfoMessage& theError) const; + Events_InfoMessage &theError) const; /// Returns true if the attibute's object type satisfies the argument value /// \param[in] theShape a checked shape /// \param[in] theShapeType a shape type /// \param[out] theError error message. - bool isValidShape(const GeomShapePtr theShape, - const TypeOfShape theShapeType, + bool isValidShape(const GeomShapePtr theShape, const TypeOfShape theShapeType, const bool theIsGeometricalSelection, - Events_InfoMessage& theError) const; - + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_Tools.cpp b/src/GeomValidators/GeomValidators_Tools.cpp index a25a716cf..977e3ef5f 100644 --- a/src/GeomValidators/GeomValidators_Tools.cpp +++ b/src/GeomValidators/GeomValidators_Tools.cpp @@ -14,42 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_Tools.h" #include "ModelAPI_AttributeRefAttr.h" -#include "ModelAPI_AttributeSelection.h" #include "ModelAPI_AttributeReference.h" +#include "ModelAPI_AttributeSelection.h" #include namespace GeomValidators_Tools { - ObjectPtr getObject(const AttributePtr& theAttribute) - { - ObjectPtr anObject; - std::string anAttrType = theAttribute->attributeType(); - if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { - AttributeRefAttrPtr anAttr = +ObjectPtr getObject(const AttributePtr &theAttribute) { + ObjectPtr anObject; + std::string anAttrType = theAttribute->attributeType(); + if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { + AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr != NULL && anAttr->isObject()) - anObject = anAttr->object(); - } - if (anAttrType == ModelAPI_AttributeSelection::typeId()) { - AttributeSelectionPtr anAttr = + if (anAttr != NULL && anAttr->isObject()) + anObject = anAttr->object(); + } + if (anAttrType == ModelAPI_AttributeSelection::typeId()) { + AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr != NULL) - anObject = anAttr->context(); - } - if (anAttrType == ModelAPI_AttributeReference::typeId()) { - AttributeReferencePtr anAttr = + if (anAttr != NULL) + anObject = anAttr->context(); + } + if (anAttrType == ModelAPI_AttributeReference::typeId()) { + AttributeReferencePtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr.get() != NULL) - anObject = anAttr->value(); - } - return anObject; + if (anAttr.get() != NULL) + anObject = anAttr->value(); } - + return anObject; } + +} // namespace GeomValidators_Tools diff --git a/src/GeomValidators/GeomValidators_Tools.h b/src/GeomValidators/GeomValidators_Tools.h index c5a5650a2..18b918c8a 100644 --- a/src/GeomValidators/GeomValidators_Tools.h +++ b/src/GeomValidators/GeomValidators_Tools.h @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_Tools_HeaderFile #define GeomValidators_Tools_HeaderFile #include "GeomValidators.h" -#include "ModelAPI_Object.h" #include "ModelAPI_Attribute.h" +#include "ModelAPI_Object.h" #include "TopAbs_ShapeEnum.hxx" #include "TopoDS_Shape.hxx" -namespace GeomValidators_Tools -{ - // Returns the object from the attribute - /// \param theObj an object - GEOMVALIDATORS_EXPORT ObjectPtr getObject(const AttributePtr& theAttribute); +namespace GeomValidators_Tools { +// Returns the object from the attribute +/// \param theObj an object +GEOMVALIDATORS_EXPORT ObjectPtr getObject(const AttributePtr &theAttribute); -}; +}; // namespace GeomValidators_Tools #endif diff --git a/src/GeomValidators/GeomValidators_ValueOrder.cpp b/src/GeomValidators/GeomValidators_ValueOrder.cpp index 701efac65..7d5f6b362 100644 --- a/src/GeomValidators/GeomValidators_ValueOrder.cpp +++ b/src/GeomValidators/GeomValidators_ValueOrder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "GeomValidators_ValueOrder.h" @@ -28,39 +29,38 @@ #include // LCOV_EXCL_START -static double attributeValue(AttributePtr theAttr) -{ - AttributeIntegerPtr anIntAttr = std::dynamic_pointer_cast(theAttr); +static double attributeValue(AttributePtr theAttr) { + AttributeIntegerPtr anIntAttr = + std::dynamic_pointer_cast(theAttr); if (anIntAttr) return (double)anIntAttr->value(); - AttributeDoublePtr aDoubleAttr = std::dynamic_pointer_cast(theAttr); + AttributeDoublePtr aDoubleAttr = + std::dynamic_pointer_cast(theAttr); if (aDoubleAttr) return aDoubleAttr->value(); return 0.0; } -static bool isGreaterOrEqual(AttributePtr theFirstArg, AttributePtr theSecondArg) -{ - if (theFirstArg && theFirstArg->isInitialized() && - theSecondArg && theSecondArg->isInitialized()) +static bool isGreaterOrEqual(AttributePtr theFirstArg, + AttributePtr theSecondArg) { + if (theFirstArg && theFirstArg->isInitialized() && theSecondArg && + theSecondArg->isInitialized()) return attributeValue(theFirstArg) >= attributeValue(theSecondArg); return false; } -static bool isLessOrEqual(AttributePtr theFirstArg, AttributePtr theSecondArg) -{ - if (theFirstArg && theFirstArg->isInitialized() && - theSecondArg && theSecondArg->isInitialized()) +static bool isLessOrEqual(AttributePtr theFirstArg, AttributePtr theSecondArg) { + if (theFirstArg && theFirstArg->isInitialized() && theSecondArg && + theSecondArg->isInitialized()) return attributeValue(theFirstArg) <= attributeValue(theSecondArg); return false; } // Check the attributes are satisfy theCompare function -static bool isValidOrder(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError, - bool (*theCompare)(AttributePtr, AttributePtr)) -{ +static bool isValidOrder(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError, + bool (*theCompare)(AttributePtr, AttributePtr)) { std::string anAttrType = theAttribute->attributeType(); if (anAttrType != ModelAPI_AttributeDouble::typeId() && anAttrType != ModelAPI_AttributeInteger::typeId()) { @@ -94,42 +94,38 @@ static bool isValidOrder(const AttributePtr& theAttribute, } // LCOV_EXCL_STOP - /// Global instance for validators factory GeomValidators_GreaterOrEqual MY_GEQ_INSTANCE; GeomValidators_LessOrEqual MY_LEQ_INSTANCE; -GeomValidators_GreaterOrEqual::GeomValidators_GreaterOrEqual() -{ +GeomValidators_GreaterOrEqual::GeomValidators_GreaterOrEqual() { // this validator is registered in the factory on this library loading SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("GeomValidators_GreaterOrEqual", this); } // LCOV_EXCL_START -bool GeomValidators_GreaterOrEqual::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_GreaterOrEqual::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { return isValidOrder(theAttribute, theArguments, theError, &isGreaterOrEqual); } // LCOV_EXCL_STOP - -GeomValidators_LessOrEqual::GeomValidators_LessOrEqual() -{ +GeomValidators_LessOrEqual::GeomValidators_LessOrEqual() { // this validator is registered in the factory on this library loading SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("GeomValidators_LessOrEqual", this); } // LCOV_EXCL_START -bool GeomValidators_LessOrEqual::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool GeomValidators_LessOrEqual::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { return isValidOrder(theAttribute, theArguments, theError, &isLessOrEqual); } // LCOV_EXCL_STOP diff --git a/src/GeomValidators/GeomValidators_ValueOrder.h b/src/GeomValidators/GeomValidators_ValueOrder.h index 46dffec30..d49aa941d 100644 --- a/src/GeomValidators/GeomValidators_ValueOrder.h +++ b/src/GeomValidators/GeomValidators_ValueOrder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_ValueOrder_H @@ -24,39 +25,41 @@ #include /** - * Validates that the integer/double attribute is greater or equal to another attribute values + * Validates that the integer/double attribute is greater or equal to another + * attribute values */ -class GeomValidators_GreaterOrEqual : public ModelAPI_AttributeValidator -{ +class GeomValidators_GreaterOrEqual : public ModelAPI_AttributeValidator { public: - //! Constructor for only one instance per application: will register the validator + //! Constructor for only one instance per application: will register the + //! validator GeomValidators_GreaterOrEqual(); //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; - + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /** - * Validates that the integer/double attribute is less or equal to another attribute values + * Validates that the integer/double attribute is less or equal to another + * attribute values */ -class GeomValidators_LessOrEqual : public ModelAPI_AttributeValidator -{ +class GeomValidators_LessOrEqual : public ModelAPI_AttributeValidator { public: - //! Constructor for only one instance per application: will register the validator + //! Constructor for only one instance per application: will register the + //! validator GeomValidators_LessOrEqual(); //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; - + GEOMVALIDATORS_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.cpp b/src/GeomValidators/GeomValidators_ZeroOffset.cpp index 8375e1ad5..98b4c4386 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.cpp +++ b/src/GeomValidators/GeomValidators_ZeroOffset.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -29,75 +30,82 @@ #include #include -#include -#include #include #include +#include +#include //================================================================================================= -bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ -// LCOV_EXCL_START - if(theArguments.size() != 9) { +bool GeomValidators_ZeroOffset::isValid( + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + // LCOV_EXCL_START + if (theArguments.size() != 9) { theError = "Wrong number of validator arguments in xml (expected 9)."; return false; } -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP std::list::const_iterator anIt = theArguments.begin(); std::string aSelectedMethod; - if(theFeature->string(*anIt)) { + if (theFeature->string(*anIt)) { aSelectedMethod = theFeature->string(*anIt)->value(); } - if (aSelectedMethod == "ThroughAll") return true; + if (aSelectedMethod == "ThroughAll") + return true; anIt++; std::string aCreationMethod = *anIt; anIt++; ListOfShape aFacesList; - if(theFeature->selection(*anIt)) { -// LCOV_EXCL_START + if (theFeature->selection(*anIt)) { + // LCOV_EXCL_START AttributeSelectionPtr aFaceSelection = theFeature->selection(*anIt); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aFaceSelection->context()); - if(aConstruction.get()) { + std::dynamic_pointer_cast( + aFaceSelection->context()); + if (aConstruction.get()) { int aSketchFacesNum = aConstruction->facesNum(); - for(int aFaceIndex = 0; aFaceIndex < aSketchFacesNum; aFaceIndex++) { + for (int aFaceIndex = 0; aFaceIndex < aSketchFacesNum; aFaceIndex++) { std::shared_ptr aFace = - std::dynamic_pointer_cast(aConstruction->face(aFaceIndex)); - if(aFace->isFace() && aFace->isPlanar()) { + std::dynamic_pointer_cast( + aConstruction->face(aFaceIndex)); + if (aFace->isFace() && aFace->isPlanar()) { aFacesList.push_back(aFace); } } } -// LCOV_EXCL_STOP - } else if(theFeature->selectionList(*anIt)) { - AttributeSelectionListPtr aFacesSelectionList = theFeature->selectionList(*anIt); - for(int anIndex = 0; anIndex < aFacesSelectionList->size(); anIndex++) { + // LCOV_EXCL_STOP + } else if (theFeature->selectionList(*anIt)) { + AttributeSelectionListPtr aFacesSelectionList = + theFeature->selectionList(*anIt); + for (int anIndex = 0; anIndex < aFacesSelectionList->size(); anIndex++) { AttributeSelectionPtr aFaceSel = aFacesSelectionList->value(anIndex); std::shared_ptr aFaceShape = aFaceSel->value(); - if(aFaceShape.get() && !aFaceShape->isNull()) { // Getting face. - if(aFaceShape->isFace() && aFaceShape->isPlanar()) { + if (aFaceShape.get() && !aFaceShape->isNull()) { // Getting face. + if (aFaceShape->isFace() && aFaceShape->isPlanar()) { aFacesList.push_back(aFaceShape); } - } else { // This may be the whole sketch result selected, check and get faces. + } else { // This may be the whole sketch result selected, check and get + // faces. ResultPtr aContext = aFaceSel->context(); std::shared_ptr aContextShape = aContext->shape(); - if(!aContextShape.get()) { + if (!aContextShape.get()) { break; } ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aContext); - if(!aConstruction.get()) { + std::dynamic_pointer_cast(aContext); + if (!aConstruction.get()) { break; } int aFacesNum = aConstruction->facesNum(); - for(int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; aFaceIndex++) { - aFaceShape = std::dynamic_pointer_cast(aConstruction->face(aFaceIndex)); - if(aFaceShape->isFace() && aFaceShape->isPlanar()) { + for (int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; + aFaceIndex++) { + aFaceShape = std::dynamic_pointer_cast( + aConstruction->face(aFaceIndex)); + if (aFaceShape->isFace() && aFaceShape->isPlanar()) { aFacesList.push_back(aFaceShape); } } @@ -109,17 +117,17 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& double aToSize = 0.0; double aFromSize = 0.0; - if(theFeature->real(*anIt) && theFeature->real(*anIt)->isInitialized()) { + if (theFeature->real(*anIt) && theFeature->real(*anIt)->isInitialized()) { aToSize = theFeature->real(*anIt)->value(); } anIt++; - if(theFeature->real(*anIt) && theFeature->real(*anIt)->isInitialized()) { + if (theFeature->real(*anIt) && theFeature->real(*anIt)->isInitialized()) { aFromSize = theFeature->real(*anIt)->value(); } anIt++; - if(aSelectedMethod == aCreationMethod) { - if(aToSize == -aFromSize) { + if (aSelectedMethod == aCreationMethod) { + if (aToSize == -aFromSize) { theError = "ToSize = -FromSize."; return false; } else { @@ -130,11 +138,12 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& std::shared_ptr aToShape; std::shared_ptr aFromShape; - std::shared_ptr anAttrSel = theFeature->selection(*anIt); - if(anAttrSel && anAttrSel->isInitialized()) { + std::shared_ptr anAttrSel = + theFeature->selection(*anIt); + if (anAttrSel && anAttrSel->isInitialized()) { aToShape = std::dynamic_pointer_cast(anAttrSel->value()); - if(aToShape.get() == NULL && anAttrSel->context().get() != NULL) { - aToShape = anAttrSel->context()->shape(); + if (aToShape.get() == NULL && anAttrSel->context().get() != NULL) { + aToShape = anAttrSel->context()->shape(); } if (aToShape->isCompound()) { GeomAPI_ShapeIterator aSIt(aToShape); @@ -143,16 +152,17 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& } anIt++; - std::shared_ptr anAttrDouble = theFeature->real(*anIt); - if(anAttrDouble && anAttrDouble->isInitialized()) { + std::shared_ptr anAttrDouble = + theFeature->real(*anIt); + if (anAttrDouble && anAttrDouble->isInitialized()) { aToSize = anAttrDouble->value(); } anIt++; anAttrSel = theFeature->selection(*anIt); - if(anAttrSel && anAttrSel->isInitialized()) { + if (anAttrSel && anAttrSel->isInitialized()) { aFromShape = std::dynamic_pointer_cast(anAttrSel->value()); - if(aFromShape.get() == NULL && anAttrSel->context().get() != NULL) { + if (aFromShape.get() == NULL && anAttrSel->context().get() != NULL) { aFromShape = anAttrSel->context()->shape(); } if (aFromShape->isCompound()) { @@ -163,34 +173,34 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& anIt++; anAttrDouble = theFeature->real(*anIt); - if(anAttrDouble && anAttrDouble->isInitialized()) { + if (anAttrDouble && anAttrDouble->isInitialized()) { aFromSize = anAttrDouble->value(); } bool isPlanesCoincident = false; - if(!aFromShape.get() && !aToShape.get()) { + if (!aFromShape.get() && !aToShape.get()) { isPlanesCoincident = true; - } else if(aFromShape.get() && aToShape.get()) { + } else if (aFromShape.get() && aToShape.get()) { std::shared_ptr aFromFace(new GeomAPI_Face(aFromShape)); if (aFromFace->isNull()) { theError = "From face selection is invalid."; return false; } - std::shared_ptr aFromPln = aFromFace->getPlane(); + std::shared_ptr aFromPln = aFromFace->getPlane(); std::shared_ptr aToFace(new GeomAPI_Face(aToShape)); if (aToFace->isNull()) { theError = "To face selection is invalid."; return false; } - std::shared_ptr aToPln = aToFace->getPlane(); + std::shared_ptr aToPln = aToFace->getPlane(); - if(aFromPln.get()) { + if (aFromPln.get()) { isPlanesCoincident = aFromPln->isCoincident(aToPln); } } else { std::shared_ptr aFace; - if(aFromShape.get()) { + if (aFromShape.get()) { aFace.reset(new GeomAPI_Face(aFromShape)); if (aFace->isNull()) { theError = "From face selection is invalid."; @@ -204,13 +214,14 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& } } std::shared_ptr aPln = aFace->getPlane(); - if(aPln.get()) { - for(ListOfShape::const_iterator - anIter = aFacesList.cbegin(); anIter != aFacesList.cend(); anIter++) { + if (aPln.get()) { + for (ListOfShape::const_iterator anIter = aFacesList.cbegin(); + anIter != aFacesList.cend(); anIter++) { std::shared_ptr aSketchShape = *anIter; - std::shared_ptr aSketchFace(new GeomAPI_Face(aSketchShape)); - std::shared_ptr aSketchPln = aSketchFace->getPlane(); - if(aPln->isCoincident(aSketchPln)) { + std::shared_ptr aSketchFace( + new GeomAPI_Face(aSketchShape)); + std::shared_ptr aSketchPln = aSketchFace->getPlane(); + if (aPln->isCoincident(aSketchPln)) { isPlanesCoincident = true; break; } @@ -218,7 +229,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& } } - if(isPlanesCoincident && aFromSize == -aToSize) { + if (isPlanesCoincident && aFromSize == -aToSize) { theError = "FromSize = -ToSize and bounding planes are coincident."; return false; } @@ -228,9 +239,9 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& //================================================================================================= // LCOV_EXCL_START -bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, std::string theAttribute) -{ - if(theAttribute == "from_object" || theAttribute == "to_object") { +bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, + std::string theAttribute) { + if (theAttribute == "from_object" || theAttribute == "to_object") { return true; } diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.h b/src/GeomValidators/GeomValidators_ZeroOffset.h index 973faf4b1..0b1f382cb 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.h +++ b/src/GeomValidators/GeomValidators_ZeroOffset.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef GeomValidators_ZeroOffset_H @@ -28,22 +29,23 @@ * \ingroup Validators * \brief Validates that bounding planes not the same or both offsets are not 0 */ -class GeomValidators_ZeroOffset : public ModelAPI_FeatureValidator -{ +class GeomValidators_ZeroOffset : public ModelAPI_FeatureValidator { public: /** \brief Returns true if feature and/or attributes are valid. * \param[in] theFeature the validated feature. - * \param[in] theArguments the arguments in the configuration file for this validator. - * \param[out] theError error message. - * \return true if feature is valid. + * \param[in] theArguments the arguments in the configuration file for this + * validator. \param[out] theError error message. \return true if feature is + * valid. */ - GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + GEOMVALIDATORS_EXPORT virtual bool + isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; - /// \return true if the attribute in feature is not obligatory for the feature execution. - GEOMVALIDATORS_EXPORT virtual - bool isNotObligatory(std::string theFeature, std::string theAttribute); + /// \return true if the attribute in feature is not obligatory for the feature + /// execution. + GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; #endif diff --git a/src/InitializationPlugin/CMakeLists.txt b/src/InitializationPlugin/CMakeLists.txt index 7575c0459..2ab27ae65 100644 --- a/src/InitializationPlugin/CMakeLists.txt +++ b/src/InitializationPlugin/CMakeLists.txt @@ -62,4 +62,3 @@ TARGET_LINK_LIBRARIES(InitializationPlugin ${PROJECT_LIBRARIES}) INSTALL(TARGETS InitializationPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES}) #INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins) - diff --git a/src/InitializationPlugin/InitializationPlugin.h b/src/InitializationPlugin/InitializationPlugin.h index d3a16b1c8..336854da1 100644 --- a/src/InitializationPlugin/InitializationPlugin.h +++ b/src/InitializationPlugin/InitializationPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef INITIALIZATIONPLUGIN_H @@ -22,17 +23,16 @@ #if defined INITIALIZATIONPLUGIN_EXPORTS #if defined WIN32 -#define INITIALIZATIONPLUGIN_EXPORT __declspec( dllexport ) +#define INITIALIZATIONPLUGIN_EXPORT __declspec(dllexport) #else #define INITIALIZATIONPLUGIN_EXPORT #endif #else #if defined WIN32 -#define INITIALIZATIONPLUGIN_EXPORT __declspec( dllimport ) +#define INITIALIZATIONPLUGIN_EXPORT __declspec(dllimport) #else #define INITIALIZATIONPLUGIN_EXPORT #endif #endif #endif - diff --git a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp index 33552e280..8a92f0025 100644 --- a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp +++ b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -45,17 +46,16 @@ #include #include -#include +#include +#include #include #include -#include -#include +#include //================================================================================================= // Tools -std::wstring toString(double theValue) -{ +std::wstring toString(double theValue) { std::wostringstream sstream; // write value in scientific format with 16 digits, // thus, not check the dot position @@ -64,143 +64,139 @@ std::wstring toString(double theValue) return sstream.str(); } -std::set toSet(const std::list& theContainer) -{ +std::set toSet(const std::list &theContainer) { return std::set(theContainer.begin(), theContainer.end()); } //================================================================================================= -InitializationPlugin_EvalListener::InitializationPlugin_EvalListener() -{ - Events_Loop* aLoop = Events_Loop::loop(); +InitializationPlugin_EvalListener::InitializationPlugin_EvalListener() { + Events_Loop *aLoop = Events_Loop::loop(); - aLoop->registerListener(this, ModelAPI_AttributeEvalMessage::eventId(), NULL, true); - aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(), NULL, true); - aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), NULL, true); - aLoop->registerListener(this, ModelAPI_ComputePositionsMessage::eventId(), NULL, true); - aLoop->registerListener(this, ModelAPI_ImportParametersMessage::eventId(), NULL, true); + aLoop->registerListener(this, ModelAPI_AttributeEvalMessage::eventId(), NULL, + true); + aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(), NULL, + true); + aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), NULL, + true); + aLoop->registerListener(this, ModelAPI_ComputePositionsMessage::eventId(), + NULL, true); + aLoop->registerListener(this, ModelAPI_ImportParametersMessage::eventId(), + NULL, true); - myInterp = std::shared_ptr(new InitializationPlugin_PyInterp()); + myInterp = std::shared_ptr( + new InitializationPlugin_PyInterp()); myInterp->initialize(); } //================================================================================================= -InitializationPlugin_EvalListener::~InitializationPlugin_EvalListener() -{ -} +InitializationPlugin_EvalListener::~InitializationPlugin_EvalListener() {} //================================================================================================= void InitializationPlugin_EvalListener::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { if (!theMessage.get()) return; if (theMessage->eventID() == ModelAPI_AttributeEvalMessage::eventId()) { processEvaluationEvent(theMessage); - } else if (theMessage->eventID() == ModelAPI_ParameterEvalMessage::eventId()) { + } else if (theMessage->eventID() == + ModelAPI_ParameterEvalMessage::eventId()) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); FeaturePtr aParam = aMsg->parameter(); - AttributeStringPtr anExprAttr = aParam->string(ParametersPlugin_Parameter::EXPRESSION_ID()); - std::wstring anExp = anExprAttr->isUValue() ? - Locale::Convert::toWString(anExprAttr->valueU()) : - Locale::Convert::toWString(anExprAttr->value()); + AttributeStringPtr anExprAttr = + aParam->string(ParametersPlugin_Parameter::EXPRESSION_ID()); + std::wstring anExp = anExprAttr->isUValue() + ? Locale::Convert::toWString(anExprAttr->valueU()) + : Locale::Convert::toWString(anExprAttr->value()); std::string anError; - std::list > aParamsList; + std::list> aParamsList; double aResult = evaluate(aParam, anExp, anError, aParamsList, true); aMsg->setResults(aParamsList, aResult, anError); - } else if (theMessage->eventID() == ModelAPI_ComputePositionsMessage::eventId()) { + } else if (theMessage->eventID() == + ModelAPI_ComputePositionsMessage::eventId()) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); - aMsg->setPositions(myInterp->positions(aMsg->expression(), aMsg->parameter())); + std::dynamic_pointer_cast(theMessage); + aMsg->setPositions( + myInterp->positions(aMsg->expression(), aMsg->parameter())); } else if (theMessage->eventID() == ModelAPI_BuildEvalMessage::eventId()) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); FeaturePtr aParam = aMsg->parameter(); - AttributeStringPtr anVariableAttr = aParam->string(BuildPlugin_Interpolation::VARIABLE_ID()); - std::wstring anVar = anVariableAttr->isUValue() ? - Locale::Convert::toWString(anVariableAttr->valueU()) : - Locale::Convert::toWString(anVariableAttr->value()); - AttributeTablesPtr anValueAttr = aParam->tables(BuildPlugin_Interpolation::VALUE_ID()); + AttributeStringPtr anVariableAttr = + aParam->string(BuildPlugin_Interpolation::VARIABLE_ID()); + std::wstring anVar = + anVariableAttr->isUValue() + ? Locale::Convert::toWString(anVariableAttr->valueU()) + : Locale::Convert::toWString(anVariableAttr->value()); + AttributeTablesPtr anValueAttr = + aParam->tables(BuildPlugin_Interpolation::VALUE_ID()); std::string anError; - std::list > aParamsList; + std::list> aParamsList; AttributeStringPtr anExprAttr; ModelAPI_AttributeTables::Value aVal; bool anIsFirstTime = true; anExprAttr = aParam->string(BuildPlugin_Interpolation::XT_ID()); - std::wstring anExpX = anExprAttr->isUValue() ? - Locale::Convert::toWString(anExprAttr->valueU()) : - Locale::Convert::toWString(anExprAttr->value()); + std::wstring anExpX = anExprAttr->isUValue() + ? Locale::Convert::toWString(anExprAttr->valueU()) + : Locale::Convert::toWString(anExprAttr->value()); anExpX.erase(std::remove(anExpX.begin(), anExpX.end(), ' '), anExpX.end()); anExprAttr = aParam->string(BuildPlugin_Interpolation::YT_ID()); - std::wstring anExpY = anExprAttr->isUValue() ? - Locale::Convert::toWString(anExprAttr->valueU()) : - Locale::Convert::toWString(anExprAttr->value()); + std::wstring anExpY = anExprAttr->isUValue() + ? Locale::Convert::toWString(anExprAttr->valueU()) + : Locale::Convert::toWString(anExprAttr->value()); anExpY.erase(std::remove(anExpY.begin(), anExpY.end(), ' '), anExpY.end()); anExprAttr = aParam->string(BuildPlugin_Interpolation::ZT_ID()); - std::wstring anExpZ = anExprAttr->isUValue() ? - Locale::Convert::toWString(anExprAttr->valueU()) : - Locale::Convert::toWString(anExprAttr->value()); - anExpZ.erase(std::remove(anExpZ.begin(),anExpZ.end(), ' '), anExpZ.end()); + std::wstring anExpZ = anExprAttr->isUValue() + ? Locale::Convert::toWString(anExprAttr->valueU()) + : Locale::Convert::toWString(anExprAttr->value()); + anExpZ.erase(std::remove(anExpZ.begin(), anExpZ.end(), ' '), anExpZ.end()); - for (int step =0; step < anValueAttr->rows(); step++) { - aVal.myDouble = evaluate(anVar, - anValueAttr->value(step,0).myDouble, - aParam, - anExpX, - anError, - aParamsList, - anIsFirstTime); - if (!anError.empty()) break; - anValueAttr->setValue(aVal,step,1); - aVal.myDouble = evaluate(anVar, - anValueAttr->value(step,0).myDouble, - aParam, - anExpY, - anError, - aParamsList, - anIsFirstTime); - if (!anError.empty()) break; - anValueAttr->setValue(aVal,step,2); - aVal.myDouble = evaluate(anVar, - anValueAttr->value(step,0).myDouble, - aParam, - anExpZ, - anError, - aParamsList, - anIsFirstTime); - if (!anError.empty()) break; - anValueAttr->setValue(aVal,step,3); + for (int step = 0; step < anValueAttr->rows(); step++) { + aVal.myDouble = + evaluate(anVar, anValueAttr->value(step, 0).myDouble, aParam, anExpX, + anError, aParamsList, anIsFirstTime); + if (!anError.empty()) + break; + anValueAttr->setValue(aVal, step, 1); + aVal.myDouble = + evaluate(anVar, anValueAttr->value(step, 0).myDouble, aParam, anExpY, + anError, aParamsList, anIsFirstTime); + if (!anError.empty()) + break; + anValueAttr->setValue(aVal, step, 2); + aVal.myDouble = + evaluate(anVar, anValueAttr->value(step, 0).myDouble, aParam, anExpZ, + anError, aParamsList, anIsFirstTime); + if (!anError.empty()) + break; + anValueAttr->setValue(aVal, step, 3); if (anIsFirstTime) - anIsFirstTime = false; + anIsFirstTime = false; } aMsg->setResults(aParamsList, anError); - } - else if (theMessage->eventID() == ModelAPI_ImportParametersMessage::eventId()) - { + } else if (theMessage->eventID() == + ModelAPI_ImportParametersMessage::eventId()) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::string anImportScript("from salome.shaper import model;"); std::string aDocScript("doc = model.activeDocument();"); std::string anParamImpScript("model.importParameters(doc, \""); std::string aPath = aMsg->filename(); - myInterp->runString(anImportScript + aDocScript + anParamImpScript + aPath + "\")"); + myInterp->runString(anImportScript + aDocScript + anParamImpScript + aPath + + "\")"); } } //================================================================================================= -double InitializationPlugin_EvalListener::evaluate(std::wstring& theVariable, - double theValueVariable, - FeaturePtr theParameter, - const std::wstring& theExpression, - std::string& theError, - std::list >& theParamsList, - bool theIsFirstTime) -{ +double InitializationPlugin_EvalListener::evaluate( + std::wstring &theVariable, double theValueVariable, FeaturePtr theParameter, + const std::wstring &theExpression, std::string &theError, + std::list> &theParamsList, + bool theIsFirstTime) { std::list aContext; aContext.push_back(theVariable + L"=" + toString(theValueVariable)); myInterp->extendLocalContext(aContext); @@ -213,14 +209,13 @@ double InitializationPlugin_EvalListener::evaluate(std::wstring& theVariable, double aValue; ResultParameterPtr aParamRes; // If variable does not exist python interpreter will generate an error. - if (!ModelAPI_Tools::findVariable(FeaturePtr(), - *it, aValue, aParamRes, theParameter->document())) + if (!ModelAPI_Tools::findVariable(FeaturePtr(), *it, aValue, aParamRes, + theParameter->document())) continue; - if (theIsFirstTime) - { + if (theIsFirstTime) { std::list::iterator anIter = - std::find(theParamsList.begin(),theParamsList.end(), aParamRes); + std::find(theParamsList.begin(), theParamsList.end(), aParamRes); if (anIter == theParamsList.end()) theParamsList.push_back(aParamRes); } @@ -234,11 +229,11 @@ double InitializationPlugin_EvalListener::evaluate(std::wstring& theVariable, } //================================================================================================= -double InitializationPlugin_EvalListener::evaluate(FeaturePtr theParameter, - const std::wstring& theExpression, std::string& theError, - std::list >& theParamsList, - const bool theIsParameter) -{ +double InitializationPlugin_EvalListener::evaluate( + FeaturePtr theParameter, const std::wstring &theExpression, + std::string &theError, + std::list> &theParamsList, + const bool theIsParameter) { std::list anExprParams = myInterp->compile(theExpression); // find expression's params in the model std::list aContext; @@ -246,11 +241,12 @@ double InitializationPlugin_EvalListener::evaluate(FeaturePtr theParameter, for (; it != anExprParams.end(); it++) { double aValue; ResultParameterPtr aParamRes; - // If variable does not exist python interpreter will generate an error. It is OK. - // But due to the issue 1479 it should not check the history position of parameters relatively - // to feature that contains expression - if (!ModelAPI_Tools::findVariable(theIsParameter ? theParameter : FeaturePtr(), - *it, aValue, aParamRes, theParameter->document())) + // If variable does not exist python interpreter will generate an error. It + // is OK. But due to the issue 1479 it should not check the history position + // of parameters relatively to feature that contains expression + if (!ModelAPI_Tools::findVariable( + theIsParameter ? theParameter : FeaturePtr(), *it, aValue, + aParamRes, theParameter->document())) continue; if (theIsParameter) @@ -265,92 +261,91 @@ double InitializationPlugin_EvalListener::evaluate(FeaturePtr theParameter, //================================================================================================= void InitializationPlugin_EvalListener::processEvaluationEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::shared_ptr aMessage = std::dynamic_pointer_cast(theMessage); - std::list > aParamsList; - FeaturePtr aParamFeature = - std::dynamic_pointer_cast(aMessage->attribute()->owner()); - if (aMessage->attribute()->attributeType() == ModelAPI_AttributeInteger::typeId()) { + std::list> aParamsList; + FeaturePtr aParamFeature = std::dynamic_pointer_cast( + aMessage->attribute()->owner()); + if (aMessage->attribute()->attributeType() == + ModelAPI_AttributeInteger::typeId()) { AttributeIntegerPtr anAttribute = - std::dynamic_pointer_cast(aMessage->attribute()); + std::dynamic_pointer_cast( + aMessage->attribute()); std::string anError; - int aValue = (int)evaluate(aParamFeature, anAttribute->text(), anError, aParamsList); + int aValue = + (int)evaluate(aParamFeature, anAttribute->text(), anError, aParamsList); bool isValid = anError.empty(); if (isValid) anAttribute->setCalculatedValue(aValue); - anAttribute->setUsedParameters(isValid ? - toSet(myInterp->compile(anAttribute->text())) : std::set()); + anAttribute->setUsedParameters( + isValid ? toSet(myInterp->compile(anAttribute->text())) + : std::set()); anAttribute->setExpressionInvalid(!isValid); anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError); - } else if (aMessage->attribute()->attributeType() == ModelAPI_AttributeDouble::typeId()) { + } else if (aMessage->attribute()->attributeType() == + ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttribute = - std::dynamic_pointer_cast(aMessage->attribute()); + std::dynamic_pointer_cast( + aMessage->attribute()); std::string anError; - double aValue = evaluate(aParamFeature, anAttribute->text(), anError, aParamsList); + double aValue = + evaluate(aParamFeature, anAttribute->text(), anError, aParamsList); bool isValid = anError.empty(); if (isValid) anAttribute->setCalculatedValue(aValue); - anAttribute->setUsedParameters(isValid ? - toSet(myInterp->compile(anAttribute->text())) : std::set()); + anAttribute->setUsedParameters( + isValid ? toSet(myInterp->compile(anAttribute->text())) + : std::set()); anAttribute->setExpressionInvalid(!isValid); anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError); - } else if (aMessage->attribute()->attributeType() == GeomDataAPI_Point::typeId()) { + } else if (aMessage->attribute()->attributeType() == + GeomDataAPI_Point::typeId()) { AttributePointPtr anAttribute = std::dynamic_pointer_cast(aMessage->attribute()); - std::wstring aText[] = { - anAttribute->textX(), - anAttribute->textY(), - anAttribute->textZ() - }; - double aCalculatedValue[] = { - anAttribute->x(), - anAttribute->y(), - anAttribute->z() - }; + std::wstring aText[] = {anAttribute->textX(), anAttribute->textY(), + anAttribute->textZ()}; + double aCalculatedValue[] = {anAttribute->x(), anAttribute->y(), + anAttribute->z()}; for (int i = 0; i < 3; ++i) { std::string anError; double aValue = evaluate(aParamFeature, aText[i], anError, aParamsList); bool isValid = anError.empty(); - if (isValid) aCalculatedValue[i] = aValue; - anAttribute->setUsedParameters(i, - isValid ? toSet(myInterp->compile(aText[i])) : std::set()); + if (isValid) + aCalculatedValue[i] = aValue; + anAttribute->setUsedParameters(i, isValid + ? toSet(myInterp->compile(aText[i])) + : std::set()); anAttribute->setExpressionInvalid(i, !isValid); anAttribute->setExpressionError(i, aText[i].empty() ? "" : anError); } - anAttribute->setCalculatedValue(aCalculatedValue[0], - aCalculatedValue[1], + anAttribute->setCalculatedValue(aCalculatedValue[0], aCalculatedValue[1], aCalculatedValue[2]); - } else if (aMessage->attribute()->attributeType() == GeomDataAPI_Point2D::typeId()) { + } else if (aMessage->attribute()->attributeType() == + GeomDataAPI_Point2D::typeId()) { AttributePoint2DPtr anAttribute = std::dynamic_pointer_cast(aMessage->attribute()); - std::wstring aText[] = { - anAttribute->textX(), - anAttribute->textY() - }; - double aCalculatedValue[] = { - anAttribute->x(), - anAttribute->y() - }; + std::wstring aText[] = {anAttribute->textX(), anAttribute->textY()}; + double aCalculatedValue[] = {anAttribute->x(), anAttribute->y()}; for (int i = 0; i < 2; ++i) { std::string anError; double aValue = evaluate(aParamFeature, aText[i], anError, aParamsList); bool isValid = anError.empty(); - if (isValid) aCalculatedValue[i] = aValue; - anAttribute->setUsedParameters(i, - isValid ? toSet(myInterp->compile(aText[i])) : std::set()); + if (isValid) + aCalculatedValue[i] = aValue; + anAttribute->setUsedParameters(i, isValid + ? toSet(myInterp->compile(aText[i])) + : std::set()); anAttribute->setExpressionInvalid(i, !isValid); anAttribute->setExpressionError(i, aText[i].empty() ? "" : anError); } - anAttribute->setCalculatedValue(aCalculatedValue[0], - aCalculatedValue[1]); + anAttribute->setCalculatedValue(aCalculatedValue[0], aCalculatedValue[1]); } } //================================================================================================= -void InitializationPlugin_EvalListener::initDataModel() -{ - myInterp->runString("import salome_iapp;salome_iapp.register_module_in_study(\"Shaper\")"); +void InitializationPlugin_EvalListener::initDataModel() { + myInterp->runString( + "import salome_iapp;salome_iapp.register_module_in_study(\"Shaper\")"); } diff --git a/src/InitializationPlugin/InitializationPlugin_EvalListener.h b/src/InitializationPlugin/InitializationPlugin_EvalListener.h index 374a78711..fd4a9f4e9 100644 --- a/src/InitializationPlugin/InitializationPlugin_EvalListener.h +++ b/src/InitializationPlugin/InitializationPlugin_EvalListener.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_INITIALIZATIONPLUGIN_EVALLISTENER_H_ #define SRC_INITIALIZATIONPLUGIN_EVALLISTENER_H_ -#include #include +#include class ModelAPI_Attribute; class ModelAPI_Document; @@ -35,40 +36,40 @@ class InitializationPlugin_PyInterp; * \ingroup Plugins * \brief Class which process the events from the event loop. */ -class InitializationPlugin_EvalListener : public Events_Listener -{ - public: +class InitializationPlugin_EvalListener : public Events_Listener { +public: INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_EvalListener(); INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_EvalListener(); /// Reimplemented from Events_Listener::processEvent(). INITIALIZATIONPLUGIN_EXPORT - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); - // performs the python call to initialize high level data model on internal data model creation + // performs the python call to initialize high level data model on internal + // data model creation void initDataModel(); - protected: +protected: /// Evaluates theExpression and returns its value. - double evaluate(std::shared_ptr theParameter, - const std::wstring& theExpression, std::string& theError, - std::list >& theParamsList, - const bool theIsParameter = false); + double + evaluate(std::shared_ptr theParameter, + const std::wstring &theExpression, std::string &theError, + std::list> &theParamsList, + const bool theIsParameter = false); /// Evaluates theExpression with variable local and returns its value. - double evaluate(std::wstring& theVariable, - double theValueVariable, - std::shared_ptr theParameter, - const std::wstring& theExpression, - std::string& theError, - std::list >& theParamsList, - bool theIsFirstTime); - + double + evaluate(std::wstring &theVariable, double theValueVariable, + std::shared_ptr theParameter, + const std::wstring &theExpression, std::string &theError, + std::list> &theParamsList, + bool theIsFirstTime); /// Processes Evaluation event. - void processEvaluationEvent(const std::shared_ptr& theMessage); + void + processEvaluationEvent(const std::shared_ptr &theMessage); - private: +private: std::shared_ptr myInterp; }; diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp index fcd5bd56b..12e904791 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp @@ -14,60 +14,67 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include -#include #include #include -#include #include +#include +#include #include #include +#include #include -#include #include +#include #include #include // the only created instance of this plugin -static InitializationPlugin_Plugin* MY_INITIALIZATIONPLUGIN_INSTANCE = +static InitializationPlugin_Plugin *MY_INITIALIZATIONPLUGIN_INSTANCE = new InitializationPlugin_Plugin(); -InitializationPlugin_Plugin::InitializationPlugin_Plugin() : - myCreatePartOnStart(false) // by default in TUI mode part is not created on start of PartSet +InitializationPlugin_Plugin::InitializationPlugin_Plugin() + : myCreatePartOnStart(false) // by default in TUI mode part is not created + // on start of PartSet { - char* isUnitTest = getenv("SHAPER_UNIT_TEST_IN_PROGRESS"); + char *isUnitTest = getenv("SHAPER_UNIT_TEST_IN_PROGRESS"); myInitDataModel = (!isUnitTest || isUnitTest[0] != '1'); - Events_Loop* aLoop = Events_Loop::loop(); - static const Events_ID kDocCreatedEvent = ModelAPI_DocumentCreatedMessage::eventId(); + Events_Loop *aLoop = Events_Loop::loop(); + static const Events_ID kDocCreatedEvent = + ModelAPI_DocumentCreatedMessage::eventId(); aLoop->registerListener(this, kDocCreatedEvent, NULL, true); - static const Events_ID kCreatePartEvent = Events_Loop::eventByName(EVENT_CREATE_PART_ON_START); + static const Events_ID kCreatePartEvent = + Events_Loop::eventByName(EVENT_CREATE_PART_ON_START); aLoop->registerListener(this, kCreatePartEvent, NULL, true); - myEvalListener = - std::shared_ptr(new InitializationPlugin_EvalListener()); + myEvalListener = std::shared_ptr( + new InitializationPlugin_EvalListener()); } -void InitializationPlugin_Plugin::processEvent(const std::shared_ptr& theMessage) -{ - static const Events_ID kDocCreatedEvent = ModelAPI_DocumentCreatedMessage::eventId(); - static const Events_ID kCreatePartEvent = Events_Loop::eventByName(EVENT_CREATE_PART_ON_START); +void InitializationPlugin_Plugin::processEvent( + const std::shared_ptr &theMessage) { + static const Events_ID kDocCreatedEvent = + ModelAPI_DocumentCreatedMessage::eventId(); + static const Events_ID kCreatePartEvent = + Events_Loop::eventByName(EVENT_CREATE_PART_ON_START); if (theMessage->eventID() == kDocCreatedEvent) { - std::shared_ptr aMessage = std::dynamic_pointer_cast< - ModelAPI_DocumentCreatedMessage>(theMessage); + std::shared_ptr aMessage = + std::dynamic_pointer_cast(theMessage); DocumentPtr aDoc = aMessage->document(); - /// Issue 431: for the current moment create planes only in the module document, - /// Later if it is needed we may create special initial planes in Parts (may be different) + /// Issue 431: for the current moment create planes only in the module + /// document, Later if it is needed we may create special initial planes in + /// Parts (may be different) SessionPtr aMgr = ModelAPI_Session::get(); if (aDoc != aMgr->moduleDocument() || aMgr->isLoading()) return; @@ -78,10 +85,11 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptr aFeatures; aMgr->startOperation("Initialization"); - // the viewer update should be blocked in order to avoid the features blinking before they are - // hidden - std::shared_ptr aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); + // the viewer update should be blocked in order to avoid the features + // blinking before they are hidden + std::shared_ptr aMsg = + std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); Events_Loop::loop()->send(aMsg); FeaturePtr aOrigin = createPoint(aDoc, L"Origin", 0., 0., 0.); @@ -94,41 +102,47 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptrflush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); - // hides the created features, the precondition is that the feature's results have been - // already built, so the createPlane/Points method calls the execute function for the planes - std::list::const_iterator aFIter = aFeatures.begin(); + // hides the created features, the precondition is that the feature's + // results have been already built, so the createPlane/Points method calls + // the execute function for the planes + std::list::const_iterator aFIter = aFeatures.begin(); for (; aFIter != aFeatures.cend(); aFIter++) { FeaturePtr aPlane = *aFIter; - const std::list >& aResults = aPlane->results(); - std::list::const_iterator aRIter = aResults.begin(); + const std::list> &aResults = + aPlane->results(); + std::list::const_iterator aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { (*aRIter)->setDisplayed(false); } } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - aMgr->finishOperation(); // before last message flush to update the title, make it not-modified - aMgr->clearUndoRedo(); // to forbid undo of auxiliary elements and initial part + aMgr->finishOperation(); // before last message flush to update the title, + // make it not-modified + aMgr->clearUndoRedo(); // to forbid undo of auxiliary elements and initial + // part - // the viewer update should be unblocked to avoid the features blinking before they are hidden - aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); + // the viewer update should be unblocked to avoid the features blinking + // before they are hidden + aMsg = std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); Events_Loop::loop()->send(aMsg); - } - else if (theMessage->eventID() == kCreatePartEvent) - { - std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); + } else if (theMessage->eventID() == kCreatePartEvent) { + std::shared_ptr aMsg = + std::dynamic_pointer_cast(theMessage); myCreatePartOnStart = aMsg->value(); } } -FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double theX, double theY, - double theZ) -{ +FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, + double theX, double theY, + double theZ) { FeaturePtr aPlane = theDoc->addFeature("Plane"); aPlane->string("creation_method")->setValue("by_general_equation"); aPlane->real("A")->setValue(theX); @@ -143,11 +157,11 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t } else if (theZ) { aPlane->data()->setName(L"XOY"); } - // don't show automatically created feature in the features history + // don't show automatically created feature in the features history aPlane->setInHistory(aPlane, false); - // the plane should be executed in order to build the feature result immediatelly - // the results are to be hidden in the plugin + // the plane should be executed in order to build the feature result + // immediatelly the results are to be hidden in the plugin aPlane->execute(); // this flag is needed here to avoid setting it inside of the next transaction // (may cause crash on redo of the first transaction in OCAF) @@ -157,20 +171,21 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t return aPlane; } -FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const std::wstring& theName, - double theX, double theY, double theZ) -{ +FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, + const std::wstring &theName, + double theX, double theY, + double theZ) { std::shared_ptr aPoint = theDoc->addFeature("Point"); - AttributePointPtr aPointAttr = std::dynamic_pointer_cast - (aPoint->data()->attribute("point3d")); + AttributePointPtr aPointAttr = std::dynamic_pointer_cast( + aPoint->data()->attribute("point3d")); aPointAttr->setValue(theX, theY, theZ); aPoint->string("creation_method")->setValue("by_xyz"); aPoint->data()->setName(theName); // don't show automatically created feature in the features history aPoint->setInHistory(aPoint, false); - // the point should be executed in order to build the feature result immediatelly - // the results are to be hidden in the plugin + // the point should be executed in order to build the feature result + // immediatelly the results are to be hidden in the plugin aPoint->execute(); aPoint->data()->execState(ModelAPI_StateDone); aPoint->firstResult()->data()->execState(ModelAPI_StateDone); @@ -178,9 +193,10 @@ FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const st return aPoint; } -FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, FeaturePtr theOrigin, - double theX, double theY, double theZ) -{ +FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, + FeaturePtr theOrigin, + double theX, double theY, + double theZ) { std::shared_ptr aAxis = theDoc->addFeature("Axis"); aAxis->string("CreationMethod")->setValue("AxisByPointAndDirection"); @@ -198,7 +214,7 @@ FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, FeaturePt } else if (theZ != 0) { aAxis->data()->setName(L"OZ"); } - // don't show automatically created feature in the features history + // don't show automatically created feature in the features history aAxis->setInHistory(aAxis, false); aAxis->execute(); aAxis->data()->execState(ModelAPI_StateDone); @@ -207,8 +223,7 @@ FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, FeaturePt return aAxis; } -void InitializationPlugin_Plugin::createPart(DocumentPtr thePartSet) -{ +void InitializationPlugin_Plugin::createPart(DocumentPtr thePartSet) { std::shared_ptr aPart = thePartSet->addFeature("Part"); if (aPart.get()) aPart->execute(); // to initialize and activate this part document diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.h b/src/InitializationPlugin/InitializationPlugin_Plugin.h index 94a1419cb..064bc00a1 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.h +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef INITIALIZATIONPLUGIN_PLUGIN_H_ @@ -33,32 +34,32 @@ class InitializationPlugin_EvalListener; * It's aim is to fulfill the newly created documents with the "origin" * construction point (0,0,0) and base planes (x0y, z0y, x0z) */ -class InitializationPlugin_Plugin : public Events_Listener -{ - public: +class InitializationPlugin_Plugin : public Events_Listener { +public: /// Creates plug-in and registers it in the Event Loop INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_Plugin(); /// Destructs the plugin INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_Plugin() {} /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document /// from the message with origin and planes - INITIALIZATIONPLUGIN_EXPORT virtual void processEvent( - const std::shared_ptr& theMessage); + INITIALIZATIONPLUGIN_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage); - protected: +protected: /// Creates a plane by given parameters A, B, C /// \param theDoc - document to contain a "plane" feature /// \param theX - determines if X is 0 or not /// \param theY - determines if Y is 0 or not /// \param theZ - determines if Z is 0 or not - FeaturePtr createPlane(DocumentPtr theDoc, double theX, double theY, double theZ); + FeaturePtr createPlane(DocumentPtr theDoc, double theX, double theY, + double theZ); /// Creates the origin point in (0,0,0) /// \param theDoc - document to contain a "point" feature /// \param theName - name of the point /// \param theX - X coordinate /// \param theY - Y coordinate /// \param theZ - Z coordinate - FeaturePtr createPoint(DocumentPtr theDoc, const std::wstring& theName, + FeaturePtr createPoint(DocumentPtr theDoc, const std::wstring &theName, double theX, double theY, double theZ); /// Creates an axis which is started from origin point @@ -67,17 +68,16 @@ class InitializationPlugin_Plugin : public Events_Listener /// \param theX - X of direction point /// \param theY - Y of direction point /// \param theZ - Z of direction point - FeaturePtr createAxis(DocumentPtr theDoc, FeaturePtr theOrigin, - double theX, double theY, double theZ); + FeaturePtr createAxis(DocumentPtr theDoc, FeaturePtr theOrigin, double theX, + double theY, double theZ); /// Creates and activates a new part in PartSet document. void createPart(DocumentPtr thePartSet); - private: +private: std::shared_ptr myEvalListener; bool myInitDataModel; bool myCreatePartOnStart; }; #endif - diff --git a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp index ba4bbd26f..5be85434d 100644 --- a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp +++ b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp @@ -14,40 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include -#include -#include #include +#include +#include +#include InitializationPlugin_PyInterp::InitializationPlugin_PyInterp() -: PyInterp_Interp() -{ -} + : PyInterp_Interp() {} -InitializationPlugin_PyInterp::~InitializationPlugin_PyInterp() -{ -} +InitializationPlugin_PyInterp::~InitializationPlugin_PyInterp() {} -const char* aSearchCode = - "import ast\n" - "class FindName(ast.NodeVisitor):\n" - " def __init__(self, name):\n" - " self.name = name\n" - " def visit_Name(self, node):\n" - " if node.id == self.name:\n" - " positions.append((node.lineno, node.col_offset))\n" - "FindName(name).visit(ast.parse(expression))"; +const char *aSearchCode = + "import ast\n" + "class FindName(ast.NodeVisitor):\n" + " def __init__(self, name):\n" + " self.name = name\n" + " def visit_Name(self, node):\n" + " if node.id == self.name:\n" + " positions.append((node.lineno, node.col_offset))\n" + "FindName(name).visit(ast.parse(expression))"; // make the expression be correct for the python interpreter even for the // beta=alfa*2 expressions -static std::wstring adjustExpression(const std::wstring& theExpression) { +static std::wstring adjustExpression(const std::wstring &theExpression) { std::wstring anExpression = theExpression; if (!anExpression.empty() && anExpression.back() == L'=') { anExpression = anExpression.substr(0, anExpression.length() - 1); @@ -55,85 +52,88 @@ static std::wstring adjustExpression(const std::wstring& theExpression) { return anExpression; } -std::list > -InitializationPlugin_PyInterp::positions(const std::wstring& theExpression, - const std::wstring& theName) -{ +std::list> +InitializationPlugin_PyInterp::positions(const std::wstring &theExpression, + const std::wstring &theName) { PyLockWrapper lck; // Acquire GIL until the end of the method - std::list > aResult; + std::list> aResult; // prepare a context - PyObject* aContext = PyDict_New(); + PyObject *aContext = PyDict_New(); PyDict_SetItemString(aContext, "__builtins__", PyEval_GetBuiltins()); std::wstring anExpression = adjustExpression(theExpression); // extend aContext with variables - PyDict_SetItemString(aContext, "expression", + PyDict_SetItemString( + aContext, "expression", PyUnicode_FromWideChar(anExpression.c_str(), anExpression.size())); - PyDict_SetItemString(aContext, "name", PyUnicode_FromWideChar(theName.c_str(), theName.size())); + PyDict_SetItemString(aContext, "name", + PyUnicode_FromWideChar(theName.c_str(), theName.size())); PyDict_SetItemString(aContext, "positions", Py_BuildValue("[]")); // run the search code - PyObject* aExecResult = PyRun_String(aSearchCode, Py_file_input, aContext, aContext); + PyObject *aExecResult = + PyRun_String(aSearchCode, Py_file_input, aContext, aContext); Py_XDECREF(aExecResult); // receive results from context - PyObject* aPositions = PyDict_GetItemString(aContext, "positions"); + PyObject *aPositions = PyDict_GetItemString(aContext, "positions"); for (int anIndex = 0; anIndex < PyList_Size(aPositions); ++anIndex) { - PyObject* aPosition = PyList_GetItem(aPositions, anIndex); - PyObject* aLineNo = PyTuple_GetItem(aPosition, 0); - PyObject* aColOffset = PyTuple_GetItem(aPosition, 1); + PyObject *aPosition = PyList_GetItem(aPositions, anIndex); + PyObject *aLineNo = PyTuple_GetItem(aPosition, 0); + PyObject *aColOffset = PyTuple_GetItem(aPosition, 1); - aResult.push_back( - std::pair((int)PyLong_AsLong(aLineNo), - (int)PyLong_AsLong(aColOffset))); + aResult.push_back(std::pair((int)PyLong_AsLong(aLineNo), + (int)PyLong_AsLong(aColOffset))); } - // TODO(spo): after this refCount of the variable is not 0. Is there memory leak? + // TODO(spo): after this refCount of the variable is not 0. Is there memory + // leak? Py_DECREF(aContext); return aResult; } - -std::list InitializationPlugin_PyInterp::compile(const std::wstring& theExpression) -{ +std::list +InitializationPlugin_PyInterp::compile(const std::wstring &theExpression) { PyLockWrapper lck; // Acquire GIL until the end of the method std::list aResult; PyObject *aCodeopModule = PyImport_AddModule("codeop"); - if(!aCodeopModule) { // Fatal error. No way to go on. + if (!aCodeopModule) { // Fatal error. No way to go on. PyErr_Print(); return aResult; } // support "variable_name=" expression as "variable_name" std::wstring anExpression = adjustExpression(theExpression); - PyObject *aCodePyObj = - PyObject_CallMethod(aCodeopModule, (char*)"compile_command", (char*)"(s)", - Locale::Convert::toString(anExpression).c_str()); + PyObject *aCodePyObj = PyObject_CallMethod( + aCodeopModule, (char *)"compile_command", (char *)"(s)", + Locale::Convert::toString(anExpression).c_str()); - if(!aCodePyObj || aCodePyObj == Py_None || !PyCode_Check(aCodePyObj)) { + if (!aCodePyObj || aCodePyObj == Py_None || !PyCode_Check(aCodePyObj)) { Py_XDECREF(aCodePyObj); return aResult; } - PyCodeObject* aCodeObj = (PyCodeObject*) aCodePyObj; + PyCodeObject *aCodeObj = (PyCodeObject *)aCodePyObj; #if PY_VERSION_HEX >= 0x030B0000 - std::string aCodeName(PyBytes_AsString(PyObject_GetAttrString((PyObject *)(aCodeObj), "co_code"))); + std::string aCodeName(PyBytes_AsString( + PyObject_GetAttrString((PyObject *)(aCodeObj), "co_code"))); #else std::string aCodeName(PyBytes_AsString(aCodeObj->co_code)); #endif - // co_names should be tuple, but can be changed in modern versions of python (>2.7.3) - if(!PyTuple_Check(aCodeObj->co_names)) { + // co_names should be tuple, but can be changed in modern versions of python + // (>2.7.3) + if (!PyTuple_Check(aCodeObj->co_names)) { return aResult; } size_t params_size = PyTuple_Size(aCodeObj->co_names); if (params_size > 0) { for (size_t i = 0; i < params_size; i++) { - PyObject* aParamObj = PyTuple_GetItem(aCodeObj->co_names, i); - PyObject* aParamObjStr = PyObject_Str(aParamObj); + PyObject *aParamObj = PyTuple_GetItem(aCodeObj->co_names, i); + PyObject *aParamObjStr = PyObject_Str(aParamObj); Py_ssize_t aSize; std::wstring aParamName(PyUnicode_AsWideCharString(aParamObjStr, &aSize)); aResult.push_back(aParamName); @@ -144,51 +144,51 @@ std::list InitializationPlugin_PyInterp::compile(const std::wstrin return aResult; } -void InitializationPlugin_PyInterp::extendLocalContext(const std::list& theParameters) -{ +void InitializationPlugin_PyInterp::extendLocalContext( + const std::list &theParameters) { PyLockWrapper lck; // Acquire GIL until the end of the method if (theParameters.empty()) return; std::list::const_iterator it = theParameters.begin(); - for ( ; it != theParameters.cend(); it++) { + for (; it != theParameters.cend(); it++) { std::string aParamValue = Locale::Convert::toString(*it); simpleRun(aParamValue.c_str(), false); } } -void InitializationPlugin_PyInterp::clearLocalContext() -{ +void InitializationPlugin_PyInterp::clearLocalContext() { PyLockWrapper lck; PyDict_Clear(_local_context); } -double InitializationPlugin_PyInterp::evaluate(const std::wstring& theExpression, - std::string& theError) -{ +double +InitializationPlugin_PyInterp::evaluate(const std::wstring &theExpression, + std::string &theError) { // support "variable_name=" expression as "variable_name" std::wstring anExpression = adjustExpression(theExpression); PyLockWrapper lck; // Acquire GIL until the end of the method PyCompilerFlags aFlags = {CO_FUTURE_DIVISION}; aFlags.cf_flags = CO_FUTURE_DIVISION; - PyCodeObject* anExprCode = (PyCodeObject *) Py_CompileStringFlags( - Locale::Convert::toString(anExpression).c_str(), - "", Py_eval_input, &aFlags); - if(!anExprCode) { + PyCodeObject *anExprCode = (PyCodeObject *)Py_CompileStringFlags( + Locale::Convert::toString(anExpression).c_str(), "", + Py_eval_input, &aFlags); + if (!anExprCode) { theError = errorMessage(); Py_XDECREF(anExprCode); return 0.; } - PyObject* anEvalResult = PyEval_EvalCode((PyObject *)anExprCode, _global_context, _local_context); - if(!anEvalResult) { + PyObject *anEvalResult = + PyEval_EvalCode((PyObject *)anExprCode, _global_context, _local_context); + if (!anEvalResult) { theError = errorMessage(); Py_XDECREF(anExprCode); Py_XDECREF(anEvalResult); return 0.; } - PyObject* anEvalStrObj = PyObject_Str(anEvalResult); + PyObject *anEvalStrObj = PyObject_Str(anEvalResult); std::string anEvalStr(PyUnicode_AsUTF8(anEvalStrObj)); Py_XDECREF(anExprCode); Py_XDECREF(anEvalResult); @@ -200,16 +200,14 @@ double InitializationPlugin_PyInterp::evaluate(const std::wstring& theExpression std::setlocale(LC_NUMERIC, "C"); result = std::stod(anEvalStr); std::setlocale(LC_NUMERIC, aCurLocale.c_str()); - } - catch (const std::invalid_argument&) { + } catch (const std::invalid_argument &) { theError = "Unable to eval " + anEvalStr; } return result; } -std::string InitializationPlugin_PyInterp::errorMessage() -{ +std::string InitializationPlugin_PyInterp::errorMessage() { std::string aPyError; if (PyErr_Occurred()) { PyObject *pstr, *ptype, *pvalue, *ptraceback; @@ -225,14 +223,15 @@ std::string InitializationPlugin_PyInterp::errorMessage() return aPyError; } -bool InitializationPlugin_PyInterp::initContext() -{ - PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context) - if(!m){ +bool InitializationPlugin_PyInterp::initContext() { + PyObject *m = PyImport_AddModule( + "__main__"); // interpreter main module (module context) + if (!m) { PyErr_Print(); return false; } - _global_context = PyModule_GetDict(m); // get interpreter global variable context + _global_context = + PyModule_GetDict(m); // get interpreter global variable context Py_INCREF(_global_context); _local_context = PyDict_New(); Py_INCREF(_local_context); @@ -240,14 +239,12 @@ bool InitializationPlugin_PyInterp::initContext() return PyRun_SimpleString("from math import *") == 0; } -void InitializationPlugin_PyInterp::closeContext() -{ +void InitializationPlugin_PyInterp::closeContext() { Py_XDECREF(_local_context); PyInterp_Interp::closeContext(); } -bool InitializationPlugin_PyInterp::runString(std::string theString) -{ +bool InitializationPlugin_PyInterp::runString(std::string theString) { PyLockWrapper lck; // Acquire GIL until the end of the method return PyRun_SimpleString(theString.c_str()); } diff --git a/src/InitializationPlugin/InitializationPlugin_PyInterp.h b/src/InitializationPlugin/InitializationPlugin_PyInterp.h index a2934ae72..bef1710e4 100644 --- a/src/InitializationPlugin/InitializationPlugin_PyInterp.h +++ b/src/InitializationPlugin/InitializationPlugin_PyInterp.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef INITIALIZATIONPLUGIN_PYINTERP_H_ #define INITIALIZATIONPLUGIN_PYINTERP_H_ -#include #include +#include #include #include @@ -32,28 +33,30 @@ * \ingroup Plugins * \brief Helper class for using Python interpreter. */ -class INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_PyInterp : public PyInterp_Interp -{ - public: +class INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_PyInterp + : public PyInterp_Interp { +public: InitializationPlugin_PyInterp(); virtual ~InitializationPlugin_PyInterp(); /// Returns a list of positions for theName in theExpression. - std::list > positions(const std::wstring& theExpression, - const std::wstring& theName); - /// Compiles theExpression and returns a list of parameters used in theExpression. - std::list compile(const std::wstring& theExpression); + std::list> positions(const std::wstring &theExpression, + const std::wstring &theName); + /// Compiles theExpression and returns a list of parameters used in + /// theExpression. + std::list compile(const std::wstring &theExpression); /// Extends local context with the list of parameters. - void extendLocalContext(const std::list& theParameters); + void extendLocalContext(const std::list &theParameters); /// Clears local context. void clearLocalContext(); /// Evaluates theExpression and returns its value. - double evaluate(const std::wstring& theExpression, std::string& theError); + double evaluate(const std::wstring &theExpression, std::string &theError); - /// Runs the string command in the python interpreter. Returns true if no error is in result. + /// Runs the string command in the python interpreter. Returns true if no + /// error is in result. bool runString(std::string theString); - protected: +protected: /// Returns error message. std::string errorMessage(); /// Overrides PyInterp_Interp. diff --git a/src/Locale/CMakeLists.txt b/src/Locale/CMakeLists.txt index 014a80dad..22923a601 100644 --- a/src/Locale/CMakeLists.txt +++ b/src/Locale/CMakeLists.txt @@ -55,16 +55,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/Locale") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/Locale/Locale_Convert.cpp b/src/Locale/Locale_Convert.cpp index 7e7c4e82f..4eb38ac3e 100644 --- a/src/Locale/Locale_Convert.cpp +++ b/src/Locale/Locale_Convert.cpp @@ -14,33 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -namespace Locale -{ - std::string Convert::toString(const std::wstring& theWStr) - { - return boost::locale::conv::utf_to_utf(theWStr); - } - - std::string Convert::toString(const char16_t* theExtStr) - { - return boost::locale::conv::utf_to_utf(theExtStr); - } +namespace Locale { +std::string Convert::toString(const std::wstring &theWStr) { + return boost::locale::conv::utf_to_utf(theWStr); +} - std::wstring Convert::toWString(const std::string& theStr) - { - return boost::locale::conv::utf_to_utf(theStr); - } +std::string Convert::toString(const char16_t *theExtStr) { + return boost::locale::conv::utf_to_utf(theExtStr); +} - std::wstring Convert::toWString(const char16_t* theExtStr) - { - return boost::locale::conv::utf_to_utf(theExtStr); - } +std::wstring Convert::toWString(const std::string &theStr) { + return boost::locale::conv::utf_to_utf(theStr); +} +std::wstring Convert::toWString(const char16_t *theExtStr) { + return boost::locale::conv::utf_to_utf(theExtStr); } + +} // namespace Locale diff --git a/src/Locale/Locale_Convert.h b/src/Locale/Locale_Convert.h index 3c59e0406..40c12f626 100644 --- a/src/Locale/Locale_Convert.h +++ b/src/Locale/Locale_Convert.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef LOCALE_CONVERT_H @@ -24,28 +25,26 @@ #include -namespace Locale -{ - /// Convert strings - namespace Convert - { - /// Converts a wide-string to a simple (byte) string - /// \param theWStr a wide-string - LOCALE_EXPORT std::string toString(const std::wstring& theWStr); - - /// Converts an extended string to a simple (byte) string - /// \param theExtStr an extended string - LOCALE_EXPORT std::string toString(const char16_t* theExtStr); - - /// Converts a byte string to a wide-string - /// \param theStr a byte string - LOCALE_EXPORT std::wstring toWString(const std::string& theStr); - - /// Converts an extended string to a wide-string - /// \param theStr a byte string - LOCALE_EXPORT std::wstring toWString(const char16_t* theExtStr); - - } -} +namespace Locale { +/// Convert strings +namespace Convert { +/// Converts a wide-string to a simple (byte) string +/// \param theWStr a wide-string +LOCALE_EXPORT std::string toString(const std::wstring &theWStr); + +/// Converts an extended string to a simple (byte) string +/// \param theExtStr an extended string +LOCALE_EXPORT std::string toString(const char16_t *theExtStr); + +/// Converts a byte string to a wide-string +/// \param theStr a byte string +LOCALE_EXPORT std::wstring toWString(const std::string &theStr); + +/// Converts an extended string to a wide-string +/// \param theStr a byte string +LOCALE_EXPORT std::wstring toWString(const char16_t *theExtStr); + +} // namespace Convert +} // namespace Locale #endif // Locale_Convert_H diff --git a/src/Locale/Locale_def.h b/src/Locale/Locale_def.h index d62ae3562..302fad4d5 100644 --- a/src/Locale/Locale_def.h +++ b/src/Locale/Locale_def.h @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef LOCALE_DEF_H #define LOCALE_DEF_H #if defined WIN32 -# if defined LOCALE_EXPORTS -# define LOCALE_EXPORT __declspec( dllexport ) -# else -# define LOCALE_EXPORT __declspec( dllimport ) -# endif +#if defined LOCALE_EXPORTS +#define LOCALE_EXPORT __declspec(dllexport) #else -# define LOCALE_EXPORT +#define LOCALE_EXPORT __declspec(dllimport) +#endif +#else +#define LOCALE_EXPORT #endif #endif diff --git a/src/Model/Model.h b/src/Model/Model.h index ac0eb65e4..9cddea107 100644 --- a/src/Model/Model.h +++ b/src/Model/Model.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODEL_H @@ -22,13 +23,13 @@ #if defined MODEL_EXPORTS #if defined WIN32 -#define MODEL_EXPORT __declspec( dllexport ) +#define MODEL_EXPORT __declspec(dllexport) #else #define MODEL_EXPORT #endif #else #if defined WIN32 -#define MODEL_EXPORT __declspec( dllimport ) +#define MODEL_EXPORT __declspec(dllimport) #else #define MODEL_EXPORT #endif diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index 24ca317a9..f28504194 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -33,49 +34,52 @@ IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application) static Handle_Model_Application TheApplication = new Model_Application; //======================================================================= -Handle(Model_Application) Model_Application::getApplication() -{ +Handle(Model_Application) Model_Application::getApplication() { return TheApplication; } //======================================================================= -std::shared_ptr Model_Application::document(const int theDocID) -{ +std::shared_ptr +Model_Application::document(const int theDocID) { if (myDocs.find(theDocID) != myDocs.end()) return myDocs[theDocID]; return std::shared_ptr(); // not loaded, so return null } //======================================================================= -void Model_Application::createDocument(const int theDocID) -{ +void Model_Application::createDocument(const int theDocID) { static const std::string thePartSetKind("PartSet"); static const std::string thePartKind("Part"); - std::shared_ptr aNew( - new Model_Document(theDocID, theDocID == 0 ? thePartSetKind : thePartKind)); + std::shared_ptr aNew(new Model_Document( + theDocID, theDocID == 0 ? thePartSetKind : thePartKind)); myDocs[theDocID] = aNew; aNew->setThis(aNew); static Events_ID anId = ModelAPI_DocumentCreatedMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new ModelAPI_DocumentCreatedMessage(anId, this)); + std::shared_ptr aMessage = + std::shared_ptr( + new ModelAPI_DocumentCreatedMessage(anId, this)); aMessage->setDocument(aNew); Events_Loop::loop()->send(aMessage); } //======================================================================= -bool Model_Application::loadDocument(const std::wstring theDocName, const int theDocID) -{ - static const std::string thePartKind("Part"); // root document is never loaded here - std::shared_ptr aNew(new Model_Document(theDocID, thePartKind)); +bool Model_Application::loadDocument(const std::wstring theDocName, + const int theDocID) { + static const std::string thePartKind( + "Part"); // root document is never loaded here + std::shared_ptr aNew( + new Model_Document(theDocID, thePartKind)); myDocs[theDocID] = aNew; bool aRes = true; // load it if it must be loaded by demand - if (myLoadedByDemand.find(theDocName) != myLoadedByDemand.end() && !myPath.empty()) { - aRes = aNew->load(myPath.c_str(), Locale::Convert::toString(theDocName).c_str(), aNew); - myLoadedByDemand.erase(theDocName); // done, don't do it anymore - } else { // error + if (myLoadedByDemand.find(theDocName) != myLoadedByDemand.end() && + !myPath.empty()) { + aRes = aNew->load(myPath.c_str(), + Locale::Convert::toString(theDocName).c_str(), aNew); + myLoadedByDemand.erase(theDocName); // done, don't do it anymore + } else { // error aRes = false; } @@ -83,8 +87,7 @@ bool Model_Application::loadDocument(const std::wstring theDocName, const int th } //======================================================================= -void Model_Application::deleteDocument(const int theDocID) -{ +void Model_Application::deleteDocument(const int theDocID) { if (myDocs.find(theDocID) != myDocs.end()) { myDocs[theDocID]->close(true); myDocs.erase(theDocID); @@ -93,11 +96,12 @@ void Model_Application::deleteDocument(const int theDocID) } //======================================================================= -void Model_Application::deleteAllDocuments() -{ - std::map >::iterator aDoc = myDocs.begin(); - for(; aDoc != myDocs.end(); aDoc++) { - if (aDoc->second->isOpened()) // here is main document was closed before subs and closed subs +void Model_Application::deleteAllDocuments() { + std::map>::iterator aDoc = + myDocs.begin(); + for (; aDoc != myDocs.end(); aDoc++) { + if (aDoc->second->isOpened()) // here is main document was closed before + // subs and closed subs aDoc->second->close(true); } myDocs.clear(); @@ -105,72 +109,60 @@ void Model_Application::deleteAllDocuments() } //======================================================================= -bool Model_Application::hasDocument(const int theDocID) -{ +bool Model_Application::hasDocument(const int theDocID) { return myDocs.find(theDocID) != myDocs.end(); } //======================================================================= -bool Model_Application::hasRoot() -{ - return !myDocs.empty(); -} +bool Model_Application::hasRoot() { return !myDocs.empty(); } //======================================================================= -std::shared_ptr Model_Application::rootDocument() -{ +std::shared_ptr Model_Application::rootDocument() { return myDocs[0]; } //======================================================================= -void Model_Application::setLoadPath(std::string thePath) -{ - myPath = thePath; -} +void Model_Application::setLoadPath(std::string thePath) { myPath = thePath; } //======================================================================= -const std::string& Model_Application::loadPath() const -{ - return myPath; -} +const std::string &Model_Application::loadPath() const { return myPath; } //======================================================================= -void Model_Application::setLoadByDemand(std::wstring theID, const int theDocID) -{ +void Model_Application::setLoadByDemand(std::wstring theID, + const int theDocID) { myLoadedByDemand[theID] = theDocID; } //======================================================================= -bool Model_Application::isLoadByDemand(std::wstring theID, const int theDocIndex) -{ +bool Model_Application::isLoadByDemand(std::wstring theID, + const int theDocIndex) { return myLoadedByDemand.find(theID) != myLoadedByDemand.end() && - myLoadedByDemand[theID] == theDocIndex; + myLoadedByDemand[theID] == theDocIndex; } //======================================================================= -int Model_Application::generateDocumentId() -{ +int Model_Application::generateDocumentId() { int aResult; // count until the result id is unique - for(aResult = int(myDocs.size()); true; aResult++) { + for (aResult = int(myDocs.size()); true; aResult++) { if (myDocs.find(aResult) == myDocs.end()) { bool aFound = false; std::map::iterator aLBDIter = myLoadedByDemand.begin(); - for(; aLBDIter != myLoadedByDemand.end(); aLBDIter++) { + for (; aLBDIter != myLoadedByDemand.end(); aLBDIter++) { if (aLBDIter->second == aResult) { aFound = true; break; } } - if (!aFound) break; + if (!aFound) + break; } } return aResult; } //======================================================================= -Model_Application::Model_Application() -{ +Model_Application::Model_Application() { // store handle to the application to avoid nullification static Handle(Model_Application) TheKeepHandle; TheKeepHandle = this; @@ -179,18 +171,17 @@ Model_Application::Model_Application() static TCollection_ExtendedString THE_FILE_EXT("shaperpart"); Handle(PCDM_RetrievalDriver) aReader = new BinDrivers_DocumentRetrievalDriver; Handle(PCDM_StorageDriver) aWriter = new BinDrivers_DocumentStorageDriver; - TheKeepHandle->DefineFormat(THE_DOC_FORMAT, "Shaper Part document", THE_FILE_EXT, - aReader, aWriter); + TheKeepHandle->DefineFormat(THE_DOC_FORMAT, "Shaper Part document", + THE_FILE_EXT, aReader, aWriter); } //======================================================================= -void Model_Application::Formats(TColStd_SequenceOfExtendedString& theFormats) -{ - theFormats.Append(TCollection_ExtendedString("BinOcaf")); // standard binary schema +void Model_Application::Formats(TColStd_SequenceOfExtendedString &theFormats) { + theFormats.Append( + TCollection_ExtendedString("BinOcaf")); // standard binary schema } //======================================================================= -Standard_CString Model_Application::ResourcesName() -{ +Standard_CString Model_Application::ResourcesName() { return Standard_CString("Standard"); } diff --git a/src/Model/Model_Application.h b/src/Model/Model_Application.h index 7ef885508..d43a05bab 100644 --- a/src/Model/Model_Application.h +++ b/src/Model/Model_Application.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Application_H_ @@ -29,19 +30,20 @@ DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application) /**\class Model_Application * \ingroup DataModel - * \brief Realization of Open CASCADE application abstraction. Class for internal use only. + * \brief Realization of Open CASCADE application abstraction. Class for + * internal use only. * * Application supports the formats and document management. It is uses OCAF-lke * architecture and just implements specific features of the module. */ -class Model_Application : public TDocStd_Application -{ +class Model_Application : public TDocStd_Application { public: // useful methods inside of the module // CASCADE RTTI /// Definition of "Handles" usage - /// \param Model_Application is the class name that is covered by the OCCT Handle + /// \param Model_Application is the class name that is covered by the OCCT + /// Handle DEFINE_STANDARD_RTTIEXT(Model_Application, TDocStd_Application) //! Retuns the application: one per process @@ -66,12 +68,13 @@ public: //! \param theDocName name of the document file //! \param theDocID the identifier of the loaded document (to be created) //! \returns true if load is ok - MODEL_EXPORT bool loadDocument(const std::wstring theDocName, const int theDocID); + MODEL_EXPORT bool loadDocument(const std::wstring theDocName, + const int theDocID); //! Set path for the loaded by demand documents void setLoadPath(std::string thePath); //! Returns the path for the loaded by demand documents - const std::string& loadPath() const; + const std::string &loadPath() const; //! Defines that specified document must be loaded by demand void setLoadByDemand(std::wstring theID, const int theDocID); //! Returns true if specified document must be loaded by demand @@ -80,24 +83,25 @@ public: //! produces new unique identifier of the document int generateDocumentId(); - public: +public: // Redefined OCAF methods //! Return name of resource (i.e. "Standard") Standard_CString ResourcesName(); //! Return format (i.e "MDTV-Standard") //! \param theFormats sequence of allowed formats for input/output - virtual void Formats(TColStd_SequenceOfExtendedString& theFormats); + virtual void Formats(TColStd_SequenceOfExtendedString &theFormats); //! Constructor //! Use method GetInstance() method to obtain //! the static instance of the object (or derive your own application) Model_Application(); - private: +private: /// Map from identifiers to created documents of an application - std::map > myDocs; + std::map> myDocs; /// Path for the loaded by demand documents std::string myPath; - /// Path for the loaded by demand documents (and the persistent ID as the value) + /// Path for the loaded by demand documents (and the persistent ID as the + /// value) std::map myLoadedByDemand; }; diff --git a/src/Model/Model_AttributeBoolean.cpp b/src/Model/Model_AttributeBoolean.cpp index 3ed15fe3a..952b36f22 100644 --- a/src/Model/Model_AttributeBoolean.cpp +++ b/src/Model/Model_AttributeBoolean.cpp @@ -14,15 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeBoolean.h" -#include #include +#include -void Model_AttributeBoolean::setValue(bool theValue) -{ +void Model_AttributeBoolean::setValue(bool theValue) { Standard_Integer aValue = theValue ? 1 : 0; if (!myIsInitialized || myBool->Get() != aValue) { if (myBool.IsNull()) @@ -32,19 +32,18 @@ void Model_AttributeBoolean::setValue(bool theValue) } } -bool Model_AttributeBoolean::value() -{ +bool Model_AttributeBoolean::value() { return myIsInitialized && myBool->Get() == 1; } -Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel) -{ +Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeBoolean::reinit() -{ - // check the attribute could be already presented in this doc (after load document) - myIsInitialized = myLab.FindAttribute(TDataStd_Integer::GetID(), myBool) == Standard_True; +void Model_AttributeBoolean::reinit() { + // check the attribute could be already presented in this doc (after load + // document) + myIsInitialized = + myLab.FindAttribute(TDataStd_Integer::GetID(), myBool) == Standard_True; } diff --git a/src/Model/Model_AttributeBoolean.h b/src/Model/Model_AttributeBoolean.h index f76b1933c..5ae926ec8 100644 --- a/src/Model/Model_AttributeBoolean.h +++ b/src/Model/Model_AttributeBoolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeBoolean_H_ @@ -22,30 +23,30 @@ #include "Model.h" #include "ModelAPI_AttributeBoolean.h" -#include #include +#include /**\class Model_AttributeBoolean * \ingroup DataModel * \brief Attribute that contains real value with double precision. */ -class Model_AttributeBoolean : public ModelAPI_AttributeBoolean -{ - Handle_TDataStd_Integer myBool; ///< double is Real attribute +class Model_AttributeBoolean : public ModelAPI_AttributeBoolean { + Handle_TDataStd_Integer myBool; ///< double is Real attribute TDF_Label myLab; ///< if attribute is not initialized, store label here - public: +public: /// Defines the double value MODEL_EXPORT virtual void setValue(bool theValue); /// Returns the double value MODEL_EXPORT virtual bool value(); - protected: +protected: /// Initializes attibutes - Model_AttributeBoolean(TDF_Label& theLabel); + Model_AttributeBoolean(TDF_Label &theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeDocRef.cpp b/src/Model/Model_AttributeDocRef.cpp index 53d2113a5..ea0b5e94e 100644 --- a/src/Model/Model_AttributeDocRef.cpp +++ b/src/Model/Model_AttributeDocRef.cpp @@ -14,35 +14,32 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeDocRef.h" #include "Model_Application.h" -#include #include +#include -void Model_AttributeDocRef::setValue(std::shared_ptr theDoc) -{ +void Model_AttributeDocRef::setValue( + std::shared_ptr theDoc) { if (myID->Get() != theDoc->id()) { myID->Set(theDoc->id()); owner()->data()->sendAttributeUpdated(this); } } -std::shared_ptr Model_AttributeDocRef::value() -{ +std::shared_ptr Model_AttributeDocRef::value() { return Model_Application::getApplication()->document(myID->Get()); } -int Model_AttributeDocRef::docId() -{ - return myID->Get(); -} +int Model_AttributeDocRef::docId() { return myID->Get(); } -Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel) -{ - myIsInitialized = theLabel.FindAttribute(TDataStd_Integer::GetID(), myID) == Standard_True; +Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label &theLabel) { + myIsInitialized = + theLabel.FindAttribute(TDataStd_Integer::GetID(), myID) == Standard_True; if (!myIsInitialized) { int aNewID = Model_Application::getApplication()->generateDocumentId(); myID = TDataStd_Integer::Set(theLabel, aNewID); @@ -50,7 +47,7 @@ Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel) } } -void Model_AttributeDocRef::reinit() -{ - // myLab is unknown, nevertheless, lose of attribute DocRef for live feature seems impossible +void Model_AttributeDocRef::reinit() { + // myLab is unknown, nevertheless, lose of attribute DocRef for live feature + // seems impossible } diff --git a/src/Model/Model_AttributeDocRef.h b/src/Model/Model_AttributeDocRef.h index 1f68961a5..c2e02714b 100644 --- a/src/Model/Model_AttributeDocRef.h +++ b/src/Model/Model_AttributeDocRef.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeDocRef_H_ @@ -22,20 +23,19 @@ #include "Model.h" #include "ModelAPI_AttributeDocRef.h" -#include #include +#include /**\class Model_AttributeDocRef * \ingroup DataModel * \brief Attribute that contains reference to another document. */ -class Model_AttributeDocRef : public ModelAPI_AttributeDocRef -{ +class Model_AttributeDocRef : public ModelAPI_AttributeDocRef { /// persistent and unique identifier of the document in the application Handle(TDataStd_Integer) myID; - public: +public: /// Defines the document referenced from this attribute MODEL_EXPORT virtual void setValue(std::shared_ptr theDoc); @@ -45,11 +45,12 @@ class Model_AttributeDocRef : public ModelAPI_AttributeDocRef /// Returns the persisten ID of the document MODEL_EXPORT virtual int docId(); - protected: +protected: /// Initializes attibutes - Model_AttributeDocRef(TDF_Label& theLabel); + Model_AttributeDocRef(TDF_Label &theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeDouble.cpp b/src/Model/Model_AttributeDouble.cpp index 59211dbaf..879ce1de7 100644 --- a/src/Model/Model_AttributeDouble.cpp +++ b/src/Model/Model_AttributeDouble.cpp @@ -14,55 +14,47 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeDouble.h" #include #include -#include #include +#include -Model_AttributeDouble::Model_AttributeDouble(TDF_Label& theLabel) -{ +Model_AttributeDouble::Model_AttributeDouble(TDF_Label &theLabel) { TDF_Label anExpressionLab = theLabel.FindChild(1); myExpression.reset(new Model_ExpressionDouble(anExpressionLab)); myIsInitialized = myExpression->isInitialized(); } -void Model_AttributeDouble::reinit() -{ +void Model_AttributeDouble::reinit() { myExpression->reinit(); myIsInitialized = myExpression->isInitialized(); } -void Model_AttributeDouble::reset() -{ +void Model_AttributeDouble::reset() { myExpression->reset(); myIsInitialized = false; } -void Model_AttributeDouble::setCalculatedValue(const double theValue) -{ +void Model_AttributeDouble::setCalculatedValue(const double theValue) { if (!myIsInitialized || value() != theValue) { myExpression->setValue(theValue); owner()->data()->sendAttributeUpdated(this); } } -void Model_AttributeDouble::setValue(const double theValue) -{ +void Model_AttributeDouble::setValue(const double theValue) { setCalculatedValue(text().empty() ? theValue : value()); } -double Model_AttributeDouble::value() -{ - return myExpression->value(); -} +double Model_AttributeDouble::value() { return myExpression->value(); } -void Model_AttributeDouble::setText(const std::wstring& theValue) -{ +void Model_AttributeDouble::setText(const std::wstring &theValue) { if (text() != theValue) { myExpression->setText(theValue); // Send it to evaluator to convert text to double and store in the attribute @@ -71,38 +63,30 @@ void Model_AttributeDouble::setText(const std::wstring& theValue) } } -std::wstring Model_AttributeDouble::text() -{ - return myExpression->text(); -} +std::wstring Model_AttributeDouble::text() { return myExpression->text(); } -void Model_AttributeDouble::setExpressionInvalid(const bool theFlag) -{ +void Model_AttributeDouble::setExpressionInvalid(const bool theFlag) { myExpression->setInvalid(theFlag); } -bool Model_AttributeDouble::expressionInvalid() -{ +bool Model_AttributeDouble::expressionInvalid() { return myExpression->isInvalid(); } -void Model_AttributeDouble::setExpressionError(const std::string& theError) -{ +void Model_AttributeDouble::setExpressionError(const std::string &theError) { if (expressionError() != theError) myExpression->setError(theError); } -std::string Model_AttributeDouble::expressionError() -{ +std::string Model_AttributeDouble::expressionError() { return myExpression->error(); } -void Model_AttributeDouble::setUsedParameters(const std::set& theUsedParameters) -{ +void Model_AttributeDouble::setUsedParameters( + const std::set &theUsedParameters) { myExpression->setUsedParameters(theUsedParameters); } -std::set Model_AttributeDouble::usedParameters() const -{ +std::set Model_AttributeDouble::usedParameters() const { return myExpression->usedParameters(); } diff --git a/src/Model/Model_AttributeDouble.h b/src/Model/Model_AttributeDouble.h index b1dbfaa01..d1cf638e5 100644 --- a/src/Model/Model_AttributeDouble.h +++ b/src/Model/Model_AttributeDouble.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeDouble_H_ @@ -32,11 +33,10 @@ class ModelAPI_ExpressionDouble; * \brief Attribute that contains real value with double precision. */ -class Model_AttributeDouble : public ModelAPI_AttributeDouble -{ +class Model_AttributeDouble : public ModelAPI_AttributeDouble { std::shared_ptr myExpression; - public: +public: /// Defines the double value MODEL_EXPORT virtual void setValue(const double theValue); @@ -47,7 +47,7 @@ class Model_AttributeDouble : public ModelAPI_AttributeDouble MODEL_EXPORT virtual void setCalculatedValue(const double theValue); /// Defines the text value - MODEL_EXPORT virtual void setText(const std::wstring& theText); + MODEL_EXPORT virtual void setText(const std::wstring &theText); /// Returns the text value MODEL_EXPORT virtual std::wstring text(); @@ -59,21 +59,23 @@ class Model_AttributeDouble : public ModelAPI_AttributeDouble MODEL_EXPORT virtual bool expressionInvalid(); /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setExpressionError(const std::string& theError); + MODEL_EXPORT virtual void setExpressionError(const std::string &theError); /// Returns an expression error MODEL_EXPORT virtual std::string expressionError(); /// Defines the used parameters - MODEL_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters); + MODEL_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters); /// Returns the used parameters MODEL_EXPORT virtual std::set usedParameters() const; - protected: +protected: /// Initializes attributes - Model_AttributeDouble(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_AttributeDouble(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); /// Resets attribute to deafult state. diff --git a/src/Model/Model_AttributeDoubleArray.cpp b/src/Model/Model_AttributeDoubleArray.cpp index 294043493..e64bd2ccc 100644 --- a/src/Model/Model_AttributeDoubleArray.cpp +++ b/src/Model/Model_AttributeDoubleArray.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeDoubleArray.h" @@ -27,12 +28,12 @@ #include //================================================================================================== -int Model_AttributeDoubleArray::size() -{ +int Model_AttributeDoubleArray::size() { if (myArray.IsNull() || !myArray->IsValid()) { // this could be on undo and then redo creation of the attribute // in result creation it may be uninitialized - myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myArray) == Standard_True; + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), + myArray) == Standard_True; } // checking the validity because attribute (as a field) may be presented, // but without label: it is undoed @@ -40,17 +41,20 @@ int Model_AttributeDoubleArray::size() } //================================================================================================== -void Model_AttributeDoubleArray::setSize(const int theSize) -{ - if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet - if (theSize != 0) { // if size is zero, nothing to do (null array means there is no array) +void Model_AttributeDoubleArray::setSize(const int theSize) { + if (myArray.IsNull() || + !myArray->IsValid()) { // create array if it is not done yet + if (theSize != 0) { // if size is zero, nothing to do (null array means + // there is no array) myArray = TDataStd_RealArray::Set(myLab, 0, theSize - 1); owner()->data()->sendAttributeUpdated(this); } } else { // reset the old array if (theSize) { - if (theSize != myArray->Length()) { // old data is not keept, a new array is created - Handle(TColStd_HArray1OfReal) aNewArray = new TColStd_HArray1OfReal(0, theSize - 1); + if (theSize != + myArray->Length()) { // old data is not keept, a new array is created + Handle(TColStd_HArray1OfReal) aNewArray = + new TColStd_HArray1OfReal(0, theSize - 1); myArray->ChangeArray(aNewArray); owner()->data()->sendAttributeUpdated(this); } @@ -66,8 +70,7 @@ void Model_AttributeDoubleArray::setSize(const int theSize) //================================================================================================== void Model_AttributeDoubleArray::setValue(const int theIndex, - const double theValue) -{ + const double theValue) { if (myArray->Value(theIndex) != theValue) { myArray->SetValue(theIndex, theValue); owner()->data()->sendAttributeUpdated(this); @@ -75,21 +78,19 @@ void Model_AttributeDoubleArray::setValue(const int theIndex, } //================================================================================================== -double Model_AttributeDoubleArray::value(const int theIndex) -{ +double Model_AttributeDoubleArray::value(const int theIndex) { return myArray->Value(theIndex); } //================================================================================================== -Model_AttributeDoubleArray::Model_AttributeDoubleArray(TDF_Label& theLabel) -{ +Model_AttributeDoubleArray::Model_AttributeDoubleArray(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeDoubleArray::reinit() -{ - // check the attribute could be already presented in this doc (after load document) - myIsInitialized = - myLab.FindAttribute(TDataStd_RealArray::GetID(), myArray) == Standard_True; +void Model_AttributeDoubleArray::reinit() { + // check the attribute could be already presented in this doc (after load + // document) + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myArray) == + Standard_True; } diff --git a/src/Model/Model_AttributeDoubleArray.h b/src/Model/Model_AttributeDoubleArray.h index bf4187acc..112178757 100644 --- a/src/Model/Model_AttributeDoubleArray.h +++ b/src/Model/Model_AttributeDoubleArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeDoubleArray_H_ @@ -31,9 +32,9 @@ /// \class Model_AttributeDoubleArray /// \ingroup DataModel -/// \brief API for the attribute that contains several double in the array inside. -class Model_AttributeDoubleArray: public ModelAPI_AttributeDoubleArray -{ +/// \brief API for the attribute that contains several double in the array +/// inside. +class Model_AttributeDoubleArray : public ModelAPI_AttributeDoubleArray { public: /// Returns the size of the array (zero means that it is empty) MODEL_EXPORT virtual int size(); @@ -42,23 +43,24 @@ public: MODEL_EXPORT virtual void setSize(const int theSize); /// Defines the value of the array by index [0; size-1] - MODEL_EXPORT virtual void setValue(const int theIndex, - const double theValue); + MODEL_EXPORT virtual void setValue(const int theIndex, const double theValue); /// Returns the value by the index MODEL_EXPORT virtual double value(const int theIndex); protected: /// Initializes attibutes - Model_AttributeDoubleArray(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_AttributeDoubleArray(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); private: /// The OCCT array that keeps all values. Handle_TDataStd_RealArray myArray; - /// Stores the label as a field to set array if size is not null (null array is buggy in OCAF) + /// Stores the label as a field to set array if size is not null (null array + /// is buggy in OCAF) TDF_Label myLab; friend class Model_Data; diff --git a/src/Model/Model_AttributeImage.cpp b/src/Model/Model_AttributeImage.cpp index a9c213b9c..6292b29c4 100644 --- a/src/Model/Model_AttributeImage.cpp +++ b/src/Model/Model_AttributeImage.cpp @@ -14,37 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include #include #include +#include #include #include #include -#include +#include #include #include -#include +#include -void Model_AttributeImage::setTexture(const int theWidth, - const int theHeight, - const std::list& theByteArray, - const std::string& theFormat, - const bool sendUpdated) -{ - if (theWidth > 0 && theHeight > 0 && theByteArray.size() > 0) { // set new data +void Model_AttributeImage::setTexture( + const int theWidth, const int theHeight, + const std::list &theByteArray, const std::string &theFormat, + const bool sendUpdated) { + if (theWidth > 0 && theHeight > 0 && + theByteArray.size() > 0) { // set new data // Find or create attributes Handle_TDataStd_ByteArray aByteArray = - TDataStd_ByteArray::Set(myLab, 0, int(theByteArray.size()) - 1); + TDataStd_ByteArray::Set(myLab, 0, int(theByteArray.size()) - 1); Handle_TDataStd_IntegerArray aDimensions = - TDataStd_IntegerArray::Set(myLab, 0, 1); - Handle_TDataStd_Comment aFormat = TDataStd_Comment::Set(myLab, theFormat.c_str()); + TDataStd_IntegerArray::Set(myLab, 0, 1); + Handle_TDataStd_Comment aFormat = + TDataStd_Comment::Set(myLab, theFormat.c_str()); // Dimensions aDimensions->SetValue(0, theWidth); @@ -52,7 +53,7 @@ void Model_AttributeImage::setTexture(const int theWidth, // Texture Handle(TColStd_HArray1OfByte) aNewArray = - new TColStd_HArray1OfByte(0, int(theByteArray.size()) - 1); + new TColStd_HArray1OfByte(0, int(theByteArray.size()) - 1); std::list::const_iterator itBA = theByteArray.begin(); for (int j = 0; itBA != theByteArray.end(); ++itBA, ++j) { aNewArray->SetValue(j, (Standard_Byte)(*itBA)); @@ -61,8 +62,7 @@ void Model_AttributeImage::setTexture(const int theWidth, if (sendUpdated) owner()->data()->sendAttributeUpdated(this); - } - else { // size is zero => arrays must be erased + } else { // size is zero => arrays must be erased bool isForgotten1 = myLab.ForgetAttribute(TDataStd_ByteArray::GetID()); bool isForgotten2 = myLab.ForgetAttribute(TDataStd_IntegerArray::GetID()); bool isForgotten3 = myLab.ForgetAttribute(TDataStd_Comment::GetID()); @@ -72,12 +72,13 @@ void Model_AttributeImage::setTexture(const int theWidth, } } -bool Model_AttributeImage::hasTexture() -{ +bool Model_AttributeImage::hasTexture() { Handle_TDataStd_ByteArray aByteArray; Handle_TDataStd_IntegerArray aDimensions; - if (myLab.FindAttribute(TDataStd_ByteArray::GetID(), aByteArray) == Standard_True && - myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aDimensions) == Standard_True) { + if (myLab.FindAttribute(TDataStd_ByteArray::GetID(), aByteArray) == + Standard_True && + myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aDimensions) == + Standard_True) { // Dimensions if (aDimensions->Value(0) > 0 && aDimensions->Value(1) > 0) @@ -87,11 +88,9 @@ bool Model_AttributeImage::hasTexture() return false; } -bool Model_AttributeImage::texture(int& theWidth, - int& theHeight, - std::list& theByteArray, - std::string& theFormat) -{ +bool Model_AttributeImage::texture(int &theWidth, int &theHeight, + std::list &theByteArray, + std::string &theFormat) { // Init return values theWidth = 0; theHeight = 0; @@ -101,18 +100,21 @@ bool Model_AttributeImage::texture(int& theWidth, Handle_TDataStd_ByteArray aByteArray; Handle_TDataStd_IntegerArray aDimensions; Handle_TDataStd_Comment aFormat; - if (myLab.FindAttribute(TDataStd_ByteArray::GetID(), aByteArray) == Standard_True && - myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aDimensions) == Standard_True && - myLab.FindAttribute(TDataStd_Comment::GetID(), aFormat) == Standard_True) { + if (myLab.FindAttribute(TDataStd_ByteArray::GetID(), aByteArray) == + Standard_True && + myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aDimensions) == + Standard_True && + myLab.FindAttribute(TDataStd_Comment::GetID(), aFormat) == + Standard_True) { // Dimensions - theWidth = aDimensions->Value(0); + theWidth = aDimensions->Value(0); theHeight = aDimensions->Value(1); // Texture const Handle(TColStd_HArray1OfByte) byteArray = aByteArray->InternalArray(); for (int j = byteArray->Lower(); j <= byteArray->Upper(); j++) { - theByteArray.push_back((unsigned char)byteArray->Value( j )); + theByteArray.push_back((unsigned char)byteArray->Value(j)); } // Format @@ -123,25 +125,22 @@ bool Model_AttributeImage::texture(int& theWidth, return false; } -void Model_AttributeImage::copyTo(AttributeImagePtr theTarget) const -{ +void Model_AttributeImage::copyTo(AttributeImagePtr theTarget) const { std::shared_ptr aTarget = - std::dynamic_pointer_cast(theTarget); + std::dynamic_pointer_cast(theTarget); if (aTarget) { - //Model_AttributeSelectionList::copyAttrs(myLab, aTarget->myLab); - TDF_CopyLabel aCopyAlgo (myLab, aTarget->myLab); + // Model_AttributeSelectionList::copyAttrs(myLab, aTarget->myLab); + TDF_CopyLabel aCopyAlgo(myLab, aTarget->myLab); aCopyAlgo.Perform(); aTarget->reinit(); } } -Model_AttributeImage::Model_AttributeImage(TDF_Label& theLabel) -{ +Model_AttributeImage::Model_AttributeImage(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeImage::reinit() -{ +void Model_AttributeImage::reinit() { myIsInitialized = myLab.IsAttribute(TDataStd_ByteArray::GetID()); } diff --git a/src/Model/Model_AttributeImage.h b/src/Model/Model_AttributeImage.h index fe0d97328..2beff9602 100644 --- a/src/Model/Model_AttributeImage.h +++ b/src/Model/Model_AttributeImage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODEL_ATTRIBUTEIMAGE_H_ @@ -36,35 +37,33 @@ * TDataStd_String for image format. */ -class Model_AttributeImage : public ModelAPI_AttributeImage -{ +class Model_AttributeImage : public ModelAPI_AttributeImage { /// Stores the label as the only reference to all data TDF_Label myLab; - public: +public: /// Defines the value of the image attribute - MODEL_EXPORT virtual void setTexture(const int theWidth, - const int theHeight, - const std::list& theByteArray, - const std::string& theFormat, - const bool sendUpdated = true); + MODEL_EXPORT virtual void + setTexture(const int theWidth, const int theHeight, + const std::list &theByteArray, + const std::string &theFormat, const bool sendUpdated = true); /// Returns true, if texture width and height are non-zero MODEL_EXPORT virtual bool hasTexture(); /// Returns the value of the image attribute - MODEL_EXPORT virtual bool texture(int& theWidth, - int& theHeight, - std::list& theByteArray, - std::string& theFormat); + MODEL_EXPORT virtual bool texture(int &theWidth, int &theHeight, + std::list &theByteArray, + std::string &theFormat); /// Copy the image data to the destination attribute virtual void copyTo(std::shared_ptr theTarget) const; - protected: +protected: /// Initializes attibutes - Model_AttributeImage(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_AttributeImage(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeIntArray.cpp b/src/Model/Model_AttributeIntArray.cpp index 55f4b0e96..d292e928c 100644 --- a/src/Model/Model_AttributeIntArray.cpp +++ b/src/Model/Model_AttributeIntArray.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include #include #include +#include #include #include @@ -31,31 +32,33 @@ #include -int Model_AttributeIntArray::size() -{ +int Model_AttributeIntArray::size() { if (myArray.IsNull() || !myArray->IsValid()) { // this could be on undo and then redo creation of the attribute // in result creation it may be uninitialized - myIsInitialized = myLab.FindAttribute(TDataStd_IntegerArray::GetID(), myArray) == Standard_True; + myIsInitialized = myLab.FindAttribute(TDataStd_IntegerArray::GetID(), + myArray) == Standard_True; } // checking the validity because attribute (as a field) may be presented, // but without label: it is undone return (myArray.IsNull() || !myArray->IsValid()) ? 0 : myArray->Length(); } -void Model_AttributeIntArray::setSize(const int theSize, bool sendUpdated) -{ - if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet - if (theSize != 0) { // if size is zero, nothing to do (null array means there is no array) +void Model_AttributeIntArray::setSize(const int theSize, bool sendUpdated) { + if (myArray.IsNull() || + !myArray->IsValid()) { // create array if it is not done yet + if (theSize != 0) { // if size is zero, nothing to do (null array means + // there is no array) myArray = TDataStd_IntegerArray::Set(myLab, 0, theSize - 1); if (sendUpdated) owner()->data()->sendAttributeUpdated(this); } } else { // reset the old array if (theSize) { - if (theSize != myArray->Length()) { // old data is not kept, a new array is created + if (theSize != + myArray->Length()) { // old data is not kept, a new array is created Handle(TColStd_HArray1OfInteger) aNewArray = - new TColStd_HArray1OfInteger(0, theSize - 1, 0); + new TColStd_HArray1OfInteger(0, theSize - 1, 0); myArray->ChangeArray(aNewArray); if (sendUpdated) owner()->data()->sendAttributeUpdated(this); @@ -71,10 +74,8 @@ void Model_AttributeIntArray::setSize(const int theSize, bool sendUpdated) } } -void Model_AttributeIntArray::setValue(const int theIndex, - const int theValue, - bool sendUpdated) -{ +void Model_AttributeIntArray::setValue(const int theIndex, const int theValue, + bool sendUpdated) { if (!isInitialized() || myArray->Value(theIndex) != theValue) { setInitialized(); myArray->SetValue(theIndex, theValue); @@ -83,20 +84,18 @@ void Model_AttributeIntArray::setValue(const int theIndex, } } -int Model_AttributeIntArray::value(const int theIndex) -{ +int Model_AttributeIntArray::value(const int theIndex) { return myArray->Value(theIndex); } -Model_AttributeIntArray::Model_AttributeIntArray(TDF_Label& theLabel) -{ +Model_AttributeIntArray::Model_AttributeIntArray(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeIntArray::reinit() -{ - // check the attribute could be already presented in this doc (after load document) - myIsInitialized = - myLab.FindAttribute(TDataStd_IntegerArray::GetID(), myArray) == Standard_True; +void Model_AttributeIntArray::reinit() { + // check the attribute could be already presented in this doc (after load + // document) + myIsInitialized = myLab.FindAttribute(TDataStd_IntegerArray::GetID(), + myArray) == Standard_True; } diff --git a/src/Model/Model_AttributeIntArray.h b/src/Model/Model_AttributeIntArray.h index 8d509320a..dd6d19b38 100644 --- a/src/Model/Model_AttributeIntArray.h +++ b/src/Model/Model_AttributeIntArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODEL_ATTRIBUTEINTARRAY_H_ @@ -30,39 +31,38 @@ /**\class Model_AttributeIntArray * \ingroup DataModel - * \brief API for the attribute that contains several integers in the array inside. - * Used for RGB color storage for an example. By default size is one, zero-based. - * Represented as array in OCCT. Empty array means that this attribute does not exists. + * \brief API for the attribute that contains several integers in the array + * inside. Used for RGB color storage for an example. By default size is one, + * zero-based. Represented as array in OCCT. Empty array means that this + * attribute does not exists. */ -class Model_AttributeIntArray : public ModelAPI_AttributeIntArray -{ +class Model_AttributeIntArray : public ModelAPI_AttributeIntArray { /// The OCCT array that keeps all values. Handle_TDataStd_IntegerArray myArray; - /// Stores the label as a field to set array if size is not null (null array is buggy in OCAF) + /// Stores the label as a field to set array if size is not null (null array + /// is buggy in OCAF) TDF_Label myLab; - public: +public: /// Returns the size of the array (zero means that it is empty) MODEL_EXPORT virtual int size(); /// Sets the new size of the array. The previous data is erased. - MODEL_EXPORT virtual void setSize(const int theSize, - bool sendUpdated = true); + MODEL_EXPORT virtual void setSize(const int theSize, bool sendUpdated = true); /// Defines the value of the array by index [0; size-1] - MODEL_EXPORT virtual void setValue(const int theIndex, - const int theValue, + MODEL_EXPORT virtual void setValue(const int theIndex, const int theValue, bool sendUpdated = true); /// Returns the value by the index MODEL_EXPORT virtual int value(const int theIndex); - - protected: +protected: /// Initializes attibutes - Model_AttributeIntArray(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_AttributeIntArray(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeInteger.cpp b/src/Model/Model_AttributeInteger.cpp index 882af18ec..685dd96b2 100644 --- a/src/Model/Model_AttributeInteger.cpp +++ b/src/Model/Model_AttributeInteger.cpp @@ -14,89 +14,75 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include #include -#include #include +#include -Model_AttributeInteger::Model_AttributeInteger(TDF_Label& theLabel) -{ +Model_AttributeInteger::Model_AttributeInteger(TDF_Label &theLabel) { // to the same label to support the backward compatibility myExpression.reset(new Model_ExpressionInteger(theLabel)); myIsInitialized = myExpression->isInitialized(); } -void Model_AttributeInteger::reinit() -{ +void Model_AttributeInteger::reinit() { myExpression->reinit(); myIsInitialized = myExpression->isInitialized(); } -void Model_AttributeInteger::setCalculatedValue(const int theValue) -{ +void Model_AttributeInteger::setCalculatedValue(const int theValue) { if (!myIsInitialized || value() != theValue) { myExpression->setValue(theValue); owner()->data()->sendAttributeUpdated(this); } } -void Model_AttributeInteger::setValue(const int theValue) -{ +void Model_AttributeInteger::setValue(const int theValue) { setCalculatedValue(text().empty() ? theValue : value()); } -int Model_AttributeInteger::value() -{ - return myExpression->value(); -} +int Model_AttributeInteger::value() { return myExpression->value(); } -void Model_AttributeInteger::setText(const std::wstring& theValue) -{ +void Model_AttributeInteger::setText(const std::wstring &theValue) { if (text() != theValue) { myExpression->setText(theValue); - // Send it to evaluator to convert text to integer and store in the attribute + // Send it to evaluator to convert text to integer and store in the + // attribute ModelAPI_AttributeEvalMessage::send(owner()->data()->attribute(id()), this); owner()->data()->sendAttributeUpdated(this); } } -std::wstring Model_AttributeInteger::text() -{ - return myExpression->text(); -} +std::wstring Model_AttributeInteger::text() { return myExpression->text(); } -void Model_AttributeInteger::setExpressionInvalid(const bool theFlag) -{ +void Model_AttributeInteger::setExpressionInvalid(const bool theFlag) { myExpression->setInvalid(theFlag); } -bool Model_AttributeInteger::expressionInvalid() -{ +bool Model_AttributeInteger::expressionInvalid() { return myExpression->isInvalid(); } -void Model_AttributeInteger::setExpressionError(const std::string& theError) -{ +void Model_AttributeInteger::setExpressionError(const std::string &theError) { if (expressionError() != theError) myExpression->setError(theError); } -std::string Model_AttributeInteger::expressionError() -{ +std::string Model_AttributeInteger::expressionError() { return myExpression->error(); } -void Model_AttributeInteger::setUsedParameters(const std::set& theUsedParameters) -{ +void Model_AttributeInteger::setUsedParameters( + const std::set &theUsedParameters) { myExpression->setUsedParameters(theUsedParameters); } -std::set Model_AttributeInteger::usedParameters() const -{ +std::set Model_AttributeInteger::usedParameters() const { return myExpression->usedParameters(); } diff --git a/src/Model/Model_AttributeInteger.h b/src/Model/Model_AttributeInteger.h index e8b6675fd..35c6f96fa 100644 --- a/src/Model/Model_AttributeInteger.h +++ b/src/Model/Model_AttributeInteger.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODEL_ATTRIBUTEINTEGER_H_ @@ -32,9 +33,8 @@ class ModelAPI_ExpressionInteger; * \brief Attribute that contains integer. */ -class Model_AttributeInteger : public ModelAPI_AttributeInteger -{ - public: +class Model_AttributeInteger : public ModelAPI_AttributeInteger { +public: /// Defines the integer value MODEL_EXPORT virtual void setValue(const int theValue); @@ -45,7 +45,7 @@ class Model_AttributeInteger : public ModelAPI_AttributeInteger MODEL_EXPORT virtual void setCalculatedValue(const int theValue); /// Defines the text value - MODEL_EXPORT virtual void setText(const std::wstring& theText); + MODEL_EXPORT virtual void setText(const std::wstring &theText); /// Returns the text value MODEL_EXPORT virtual std::wstring text(); @@ -57,26 +57,28 @@ class Model_AttributeInteger : public ModelAPI_AttributeInteger MODEL_EXPORT virtual bool expressionInvalid(); /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setExpressionError(const std::string& theError); + MODEL_EXPORT virtual void setExpressionError(const std::string &theError); /// Returns an expression error MODEL_EXPORT virtual std::string expressionError(); /// Defines the used parameters - MODEL_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters); + MODEL_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters); /// Returns the used parameters MODEL_EXPORT virtual std::set usedParameters() const; - protected: +protected: /// Initializes attributes - Model_AttributeInteger(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_AttributeInteger(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; - private: +private: std::shared_ptr myExpression; }; diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index dd46c8e7b..dc1eb2d70 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeRefAttr.h" @@ -23,19 +24,17 @@ #include "Model_Objects.h" #include -bool Model_AttributeRefAttr::isObject() -{ - return myID->Get().Length() == 0; -} +bool Model_AttributeRefAttr::isObject() { return myID->Get().Length() == 0; } -void Model_AttributeRefAttr::setAttr(std::shared_ptr theAttr) -{ - std::shared_ptr aData = std::dynamic_pointer_cast( - theAttr->owner()->data()); +void Model_AttributeRefAttr::setAttr( + std::shared_ptr theAttr) { + std::shared_ptr aData = + std::dynamic_pointer_cast(theAttr->owner()->data()); std::string anID = aData->id(theAttr); ObjectPtr anObj = object(); - if (myIsInitialized && anObj == theAttr->owner() && myID->Get().IsEqual(anID.c_str())) - return; // nothing is changed + if (myIsInitialized && anObj == theAttr->owner() && + myID->Get().IsEqual(anID.c_str())) + return; // nothing is changed REMOVE_BACK_REF(anObj); myRef->Set(aData->label().Father()); myID->Set(aData->id(theAttr).c_str()); @@ -43,32 +42,35 @@ void Model_AttributeRefAttr::setAttr(std::shared_ptr theAttr owner()->data()->sendAttributeUpdated(this); } -std::shared_ptr Model_AttributeRefAttr::attr() -{ +std::shared_ptr Model_AttributeRefAttr::attr() { ObjectPtr anObj = object(); if (anObj && anObj->data()) { - std::shared_ptr aData = std::dynamic_pointer_cast(anObj->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(anObj->data()); return aData->attribute(TCollection_AsciiString(myID->Get()).ToCString()); } // not initialized return std::shared_ptr(); } -void Model_AttributeRefAttr::setObject(ObjectPtr theObject) -{ - // the back reference from the previous object to the attribute should be removed +void Model_AttributeRefAttr::setObject(ObjectPtr theObject) { + // the back reference from the previous object to the attribute should be + // removed ObjectPtr anObject = object(); - if (theObject.get() && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) { + if (theObject.get() && (!myIsInitialized || myID->Get().Length() != 0 || + object() != theObject)) { REMOVE_BACK_REF(anObject); - std::shared_ptr aData = std::dynamic_pointer_cast( - theObject->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); myRef->Set(aData->label().Father()); - myID->Set(""); // feature is identified by the empty ID + myID->Set(""); // feature is identified by the empty ID - // do it before the transaction finish to make just created/removed objects know dependencies - // and reference from composite feature is removed automatically - FeaturePtr anOwnerFeature = std::dynamic_pointer_cast(owner()); + // do it before the transaction finish to make just created/removed objects + // know dependencies and reference from composite feature is removed + // automatically + FeaturePtr anOwnerFeature = + std::dynamic_pointer_cast(owner()); if (anOwnerFeature.get()) { aData->addBackReference(anOwnerFeature, id(), false); } @@ -77,16 +79,15 @@ void Model_AttributeRefAttr::setObject(ObjectPtr theObject) } else if (theObject.get() == NULL) { REMOVE_BACK_REF(anObject); myRef->Set(myRef->Label()); // reference to itself means that object is null - myID->Set(""); // feature is identified by the empty ID + myID->Set(""); // feature is identified by the empty ID owner()->data()->sendAttributeUpdated(this); } } -ObjectPtr Model_AttributeRefAttr::object() -{ - if (myRef->Get() != myRef->Label()) { // initialized - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +ObjectPtr Model_AttributeRefAttr::object() { + if (myRef->Get() != myRef->Label()) { // initialized + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { TDF_Label aRefLab = myRef->Get(); return aDoc->objects()->object(aRefLab); @@ -96,27 +97,27 @@ ObjectPtr Model_AttributeRefAttr::object() return ObjectPtr(); } -bool Model_AttributeRefAttr::isInitialized() -{ - if (myRef->Get() == myRef->Label()) { // empty is not initialized: sketch parallelity +bool Model_AttributeRefAttr::isInitialized() { + if (myRef->Get() == + myRef->Label()) { // empty is not initialized: sketch parallelity return false; } return ModelAPI_AttributeRefAttr::isInitialized(); } -Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel) -{ +Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeRefAttr::reinit() -{ - myIsInitialized = myLab.FindAttribute(TDataStd_Comment::GetID(), myID) == Standard_True; +void Model_AttributeRefAttr::reinit() { + myIsInitialized = + myLab.FindAttribute(TDataStd_Comment::GetID(), myID) == Standard_True; if (!myIsInitialized) { // create attribute: not initialized by value yet myID = TDataStd_Comment::Set(myLab, ""); - myRef = TDF_Reference::Set(myLab, myLab); // not initialized: reference to itself + myRef = TDF_Reference::Set(myLab, + myLab); // not initialized: reference to itself } else { myLab.FindAttribute(TDF_Reference::GetID(), myRef); } diff --git a/src/Model/Model_AttributeRefAttr.h b/src/Model/Model_AttributeRefAttr.h index fda05d5cf..af39238f5 100644 --- a/src/Model/Model_AttributeRefAttr.h +++ b/src/Model/Model_AttributeRefAttr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeRefAttr_H_ @@ -28,22 +29,25 @@ /**\class Model_AttributeRefAttr * \ingroup DataModel - * \brief Attribute that contains reference to an attribute of a feature + * \brief Attribute that contains reference to an attribute of a feature * (located in the same document). */ -class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr -{ - Handle_TDF_Reference myRef; ///< reference to the feature label - TDF_Label myLab; ///< the main label of this attribute - ///< ID of the referenced attribute (empty if this is a reference to a feature) +class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr { + Handle_TDF_Reference myRef; ///< reference to the feature label + TDF_Label myLab; ///< the main label of this attribute + ///< ID of the referenced attribute (empty if this is a reference to a + ///< feature) Handle_TDataStd_Comment myID; - public: - /// Returns true if this attribute references to a object (not to the attribute) + +public: + /// Returns true if this attribute references to a object (not to the + /// attribute) MODEL_EXPORT virtual bool isObject(); /// Defines the reference to the attribute - MODEL_EXPORT virtual void setAttr(std::shared_ptr theAttr); + MODEL_EXPORT virtual void + setAttr(std::shared_ptr theAttr); /// Returns attribute referenced from this attribute MODEL_EXPORT virtual std::shared_ptr attr(); @@ -57,10 +61,11 @@ class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); - protected: +protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeRefAttr(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + MODEL_EXPORT Model_AttributeRefAttr(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeRefAttrList.cpp b/src/Model/Model_AttributeRefAttrList.cpp index f3f596471..8a42d38dc 100644 --- a/src/Model/Model_AttributeRefAttrList.cpp +++ b/src/Model/Model_AttributeRefAttrList.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeRefAttrList.h" @@ -25,46 +26,51 @@ #include #include -void Model_AttributeRefAttrList::append(ObjectPtr theObject) -{ +void Model_AttributeRefAttrList::append(ObjectPtr theObject) { TDF_Label aLabel; if (theObject) { - std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); aLabel = aData->label().Father(); } myRef->Append(aLabel); // store label of the object - myIDs->Append(""); // for the object store an empty string - // do it before the transaction finish to make just created/removed objects know dependencies - // and reference from composite feature is removed automatically + myIDs->Append(""); // for the object store an empty string + // do it before the transaction finish to make just created/removed objects + // know dependencies and reference from composite feature is removed + // automatically ADD_BACK_REF(theObject); owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeRefAttrList::append(AttributePtr theAttr) -{ +void Model_AttributeRefAttrList::append(AttributePtr theAttr) { std::shared_ptr aData = - std::dynamic_pointer_cast(theAttr->owner()->data()); - myRef->Append(aData->label().Father()); // store label of the object - myIDs->Append(theAttr->id().c_str()); // store the ID of the referenced attribute - // do it before the transaction finish to make just created/removed objects know dependencies - // and reference from composite feature is removed automatically + std::dynamic_pointer_cast(theAttr->owner()->data()); + myRef->Append(aData->label().Father()); // store label of the object + myIDs->Append( + theAttr->id().c_str()); // store the ID of the referenced attribute + // do it before the transaction finish to make just created/removed objects + // know dependencies and reference from composite feature is removed + // automatically ADD_BACK_REF(theAttr->owner()); owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeRefAttrList::remove(ObjectPtr theObject) -{ +void Model_AttributeRefAttrList::remove(ObjectPtr theObject) { TDF_Label aTheObjLab; if (theObject.get() != NULL) { - aTheObjLab = std::dynamic_pointer_cast(theObject->data())->label().Father(); + aTheObjLab = std::dynamic_pointer_cast(theObject->data()) + ->label() + .Father(); } std::shared_ptr aDoc = - std::dynamic_pointer_cast(owner()->document()); - // remove from the both lists by clearing the list and then appending one by one - // TODO: in OCCT 7.0 there are methods for removing by index, seems will be more optimal + std::dynamic_pointer_cast(owner()->document()); + // remove from the both lists by clearing the list and then appending one by + // one + // TODO: in OCCT 7.0 there are methods for removing by index, seems will be + // more optimal TDF_LabelList aRefList = myRef->List(); myRef->Clear(); TDataStd_ListOfExtendedString anIDList = myIDs->List(); @@ -74,11 +80,14 @@ void Model_AttributeRefAttrList::remove(ObjectPtr theObject) TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); for (; aRefIter.More(); aRefIter.Next(), anIDIter.Next()) { // append now only not removed - if (aOneisDeleted || aRefIter.Value() != aTheObjLab || !anIDIter.Value().IsEmpty() || - (aTheObjLab.IsNull() && aDoc->objects()->object(aRefIter.Value()) != NULL)) { + if (aOneisDeleted || aRefIter.Value() != aTheObjLab || + !anIDIter.Value().IsEmpty() || + (aTheObjLab.IsNull() && + aDoc->objects()->object(aRefIter.Value()) != NULL)) { myRef->Append(aRefIter.Value()); myIDs->Append(anIDIter.Value()); - } else if (aTheObjLab.IsNull() && aDoc->objects()->object(aRefIter.Value()) != NULL) { + } else if (aTheObjLab.IsNull() && + aDoc->objects()->object(aRefIter.Value()) != NULL) { aOneisDeleted = true; } } @@ -88,16 +97,19 @@ void Model_AttributeRefAttrList::remove(ObjectPtr theObject) } } -void Model_AttributeRefAttrList::remove(AttributePtr theAttr) -{ +void Model_AttributeRefAttrList::remove(AttributePtr theAttr) { TDF_Label aTheObjLab; if (theAttr->owner().get() != NULL) { - aTheObjLab = std::dynamic_pointer_cast(theAttr->owner()->data())->label().Father(); + aTheObjLab = std::dynamic_pointer_cast(theAttr->owner()->data()) + ->label() + .Father(); } std::shared_ptr aDoc = - std::dynamic_pointer_cast(owner()->document()); - // remove from the both lists by clearing the list and then appending one by one - // TODO: in OCCT 7.0 there are methods for removing by index, seems will be more optimal + std::dynamic_pointer_cast(owner()->document()); + // remove from the both lists by clearing the list and then appending one by + // one + // TODO: in OCCT 7.0 there are methods for removing by index, seems will be + // more optimal TDF_LabelList aRefList = myRef->List(); myRef->Clear(); TDataStd_ListOfExtendedString anIDList = myIDs->List(); @@ -109,7 +121,8 @@ void Model_AttributeRefAttrList::remove(AttributePtr theAttr) if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() || // append now only not removed aRefIter.Value() != aTheObjLab || // append now only not removed - (aTheObjLab.IsNull() && aDoc->objects()->object(aRefIter.Value()) != NULL)) { + (aTheObjLab.IsNull() && + aDoc->objects()->object(aRefIter.Value()) != NULL)) { myRef->Append(aRefIter.Value()); myIDs->Append(anIDIter.Value()); } else { @@ -122,69 +135,68 @@ void Model_AttributeRefAttrList::remove(AttributePtr theAttr) } } -void Model_AttributeRefAttrList::clear() -{ - std::list > anOldList = list(); +void Model_AttributeRefAttrList::clear() { + std::list> anOldList = list(); myRef->Clear(); myIDs->Clear(); - std::list >::iterator anOldIter = anOldList.begin(); - for(; anOldIter != anOldList.end(); anOldIter++) { + std::list>::iterator anOldIter = + anOldList.begin(); + for (; anOldIter != anOldList.end(); anOldIter++) { REMOVE_BACK_REF((anOldIter->first)); } owner()->data()->sendAttributeUpdated(this); } -int Model_AttributeRefAttrList::size() const -{ - return myRef->Extent(); -} +int Model_AttributeRefAttrList::size() const { return myRef->Extent(); } -bool Model_AttributeRefAttrList::isInitialized() -{ - if (size() == 0) { // empty list is not initialized list: sketch will be not valid after add/undo +bool Model_AttributeRefAttrList::isInitialized() { + if (size() == 0) { // empty list is not initialized list: sketch will be not + // valid after add/undo return false; } return ModelAPI_AttributeRefAttrList::isInitialized(); } -std::list > Model_AttributeRefAttrList::list() -{ - std::list > aResult; - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +std::list> +Model_AttributeRefAttrList::list() { + std::list> aResult; + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - const TDF_LabelList& aList = myRef->List(); - const TDataStd_ListOfExtendedString& anIDList = myIDs->List(); + const TDF_LabelList &aList = myRef->List(); + const TDataStd_ListOfExtendedString &anIDList = myIDs->List(); TDF_ListIteratorOfLabelList aLIter(aList); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); for (; aLIter.More(); aLIter.Next(), anIDIter.Next()) { ObjectPtr anObj; if (!aLIter.Value().IsNull()) { anObj = aDoc->objects()->object(aLIter.Value()); - aResult.push_back(std::pair(anObj, - anObj->data()->attribute(TCollection_AsciiString(anIDIter.Value()).ToCString()))); + aResult.push_back(std::pair( + anObj, anObj->data()->attribute( + TCollection_AsciiString(anIDIter.Value()).ToCString()))); } else { - aResult.push_back(std::pair(ObjectPtr(), AttributePtr())); + aResult.push_back( + std::pair(ObjectPtr(), AttributePtr())); } } } return aResult; } -bool Model_AttributeRefAttrList::isInList(const ObjectPtr& theObj) -{ - if(!theObj.get()) { +bool Model_AttributeRefAttrList::isInList(const ObjectPtr &theObj) { + if (!theObj.get()) { return false; } std::list aResult; - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - std::shared_ptr aData = std::dynamic_pointer_cast(theObj->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObj->data()); if (aData.get() && aData->isValid()) { TDF_Label anObjLab = aData->label().Father(); - const TDF_LabelList& aList = myRef->List(); - const TDataStd_ListOfExtendedString& anIDList = myIDs->List(); + const TDF_LabelList &aList = myRef->List(); + const TDataStd_ListOfExtendedString &anIDList = myIDs->List(); TDF_ListIteratorOfLabelList aLIter(aList); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); for (; aLIter.More(); aLIter.Next(), anIDIter.Next()) { @@ -197,25 +209,25 @@ bool Model_AttributeRefAttrList::isInList(const ObjectPtr& theObj) return false; } -bool Model_AttributeRefAttrList::isInList(const AttributePtr& theAttr) -{ +bool Model_AttributeRefAttrList::isInList(const AttributePtr &theAttr) { if (!theAttr->owner().get()) { return false; } std::list aResult; - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { std::shared_ptr aData = - std::dynamic_pointer_cast(theAttr->owner()->data()); + std::dynamic_pointer_cast(theAttr->owner()->data()); if (aData.get() && aData->isValid()) { TDF_Label anObjLab = aData->label().Father(); - const TDF_LabelList& aList = myRef->List(); - const TDataStd_ListOfExtendedString& anIDList = myIDs->List(); + const TDF_LabelList &aList = myRef->List(); + const TDataStd_ListOfExtendedString &anIDList = myIDs->List(); TDF_ListIteratorOfLabelList aLIter(aList); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); for (; aLIter.More(); aLIter.Next(), anIDIter.Next()) { - if (anIDIter.Value() == theAttr->id().c_str() && aLIter.Value().IsEqual(anObjLab)) { + if (anIDIter.Value() == theAttr->id().c_str() && + aLIter.Value().IsEqual(anObjLab)) { return true; } } @@ -224,9 +236,8 @@ bool Model_AttributeRefAttrList::isInList(const AttributePtr& theAttr) return false; } -bool Model_AttributeRefAttrList::isAttribute(const int theIndex) const -{ - const TDataStd_ListOfExtendedString& anIDList = myIDs->List(); +bool Model_AttributeRefAttrList::isAttribute(const int theIndex) const { + const TDataStd_ListOfExtendedString &anIDList = myIDs->List(); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); int anIndex = -1; for (; anIDIter.More(); anIDIter.Next()) { @@ -238,14 +249,14 @@ bool Model_AttributeRefAttrList::isAttribute(const int theIndex) const return false; } -ObjectPtr Model_AttributeRefAttrList::object(const int theIndex) const -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +ObjectPtr Model_AttributeRefAttrList::object(const int theIndex) const { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - const TDF_LabelList& aList = myRef->List(); + const TDF_LabelList &aList = myRef->List(); int anIndex = -1; - for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { + for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); + aLIter.Next()) { anIndex++; if (anIndex == theIndex) { if (aLIter.Value().IsNull()) { // null label => null sub @@ -258,14 +269,13 @@ ObjectPtr Model_AttributeRefAttrList::object(const int theIndex) const return ObjectPtr(); } -AttributePtr Model_AttributeRefAttrList::attribute(const int theIndex) const -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +AttributePtr Model_AttributeRefAttrList::attribute(const int theIndex) const { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { int anIndex = -1; - const TDF_LabelList& aList = myRef->List(); - const TDataStd_ListOfExtendedString& anIDList = myIDs->List(); + const TDF_LabelList &aList = myRef->List(); + const TDataStd_ListOfExtendedString &anIDList = myIDs->List(); TDF_ListIteratorOfLabelList aLIter(aList); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); for (; aLIter.More(); aLIter.Next(), anIDIter.Next()) { @@ -274,30 +284,35 @@ AttributePtr Model_AttributeRefAttrList::attribute(const int theIndex) const if (aLIter.Value().IsNull()) { // null label => null sub return AttributePtr(); } - return aDoc->objects()->object(aLIter.Value())->data()-> - attribute(TCollection_AsciiString(anIDIter.Value().ToExtString()).ToCString()); + return aDoc->objects() + ->object(aLIter.Value()) + ->data() + ->attribute(TCollection_AsciiString(anIDIter.Value().ToExtString()) + .ToCString()); } } } return AttributePtr(); } -void Model_AttributeRefAttrList::removeLast() -{ - // remove from the both lists by clearing the list and then appending one by one - // TODO: in OCCT 7.0 there are methods for removing by index, seems will be more optimal +void Model_AttributeRefAttrList::removeLast() { + // remove from the both lists by clearing the list and then appending one by + // one + // TODO: in OCCT 7.0 there are methods for removing by index, seems will be + // more optimal std::set aLastSet; aLastSet.insert(size() - 1); remove(aLastSet); } -void Model_AttributeRefAttrList::remove(const std::set& theIndices) -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +void Model_AttributeRefAttrList::remove(const std::set &theIndices) { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc && !myRef->IsEmpty()) { - // remove from the both lists by clearing the list and then appending one by one - // TODO: in OCCT 7.0 there are methods for removing by index, seems will be more optimal + // remove from the both lists by clearing the list and then appending one by + // one + // TODO: in OCCT 7.0 there are methods for removing by index, seems will be + // more optimal TDF_LabelList aRefList = myRef->List(); myRef->Clear(); TDataStd_ListOfExtendedString anIDList = myIDs->List(); @@ -305,7 +320,8 @@ void Model_AttributeRefAttrList::remove(const std::set& theIndices) bool aOneisDeleted = false; TDF_ListIteratorOfLabelList aRefIter(aRefList); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); - for (int anIndex = 0; aRefIter.More(); aRefIter.Next(), anIDIter.Next(), anIndex++) { + for (int anIndex = 0; aRefIter.More(); + aRefIter.Next(), anIDIter.Next(), anIndex++) { if (theIndices.find(anIndex) == theIndices.end()) { // not found myRef->Append(aRefIter.Value()); myIDs->Append(anIDIter.Value()); @@ -325,15 +341,14 @@ void Model_AttributeRefAttrList::remove(const std::set& theIndices) } } -Model_AttributeRefAttrList::Model_AttributeRefAttrList(TDF_Label& theLabel) -{ +Model_AttributeRefAttrList::Model_AttributeRefAttrList(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeRefAttrList::reinit() -{ - myIsInitialized = myLab.FindAttribute(TDataStd_ReferenceList::GetID(), myRef) == Standard_True; +void Model_AttributeRefAttrList::reinit() { + myIsInitialized = myLab.FindAttribute(TDataStd_ReferenceList::GetID(), + myRef) == Standard_True; if (!myIsInitialized) { myRef = TDataStd_ReferenceList::Set(myLab); myIDs = TDataStd_ExtStringList::Set(myLab); diff --git a/src/Model/Model_AttributeRefAttrList.h b/src/Model/Model_AttributeRefAttrList.h index 3de8356fd..81b6d2e91 100644 --- a/src/Model/Model_AttributeRefAttrList.h +++ b/src/Model/Model_AttributeRefAttrList.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeRefAttrList_H_ @@ -25,21 +26,22 @@ #include "ModelAPI_Feature.h" #include -#include #include +#include /**\class Model_AttributeRefAttrList * \ingroup DataModel - * \brief Attribute that contains list of references to features (located in the same document) - * or references to attributes of the features (list of AttributeRefAttr) + * \brief Attribute that contains list of references to features (located in the + * same document) or references to attributes of the features (list of + * AttributeRefAttr) */ -class Model_AttributeRefAttrList : public ModelAPI_AttributeRefAttrList -{ - TDF_Label myLab; ///< the main label of this attribute - Handle_TDataStd_ReferenceList myRef; ///< references to the features labels - Handle_TDataStd_ExtStringList myIDs; ///< the referenced attributes IDs (empty for just object) - public: +class Model_AttributeRefAttrList : public ModelAPI_AttributeRefAttrList { + TDF_Label myLab; ///< the main label of this attribute + Handle_TDataStd_ReferenceList myRef; ///< references to the features labels + Handle_TDataStd_ExtStringList + myIDs; ///< the referenced attributes IDs (empty for just object) +public: /// Appends the feature to the end of a list MODEL_EXPORT virtual void append(ObjectPtr theObject); /// Appends the attribute to the end of a list @@ -56,13 +58,14 @@ class Model_AttributeRefAttrList : public ModelAPI_AttributeRefAttrList /// Returns number of features in the list MODEL_EXPORT virtual int size() const; - /// Returns the list of features and attributes (if it is reference to the attribute) - MODEL_EXPORT virtual std::list > list(); + /// Returns the list of features and attributes (if it is reference to the + /// attribute) + MODEL_EXPORT virtual std::list> list(); /// Returns true if the object is in list - MODEL_EXPORT virtual bool isInList(const ObjectPtr& theObj); + MODEL_EXPORT virtual bool isInList(const ObjectPtr &theObj); /// Returns true if the attribute is in list - MODEL_EXPORT virtual bool isInList(const AttributePtr& theObj); + MODEL_EXPORT virtual bool isInList(const AttributePtr &theObj); /// Returns true if this is reference to an attribute, not just object MODEL_EXPORT virtual bool isAttribute(const int theIndex) const; @@ -79,14 +82,16 @@ class Model_AttributeRefAttrList : public ModelAPI_AttributeRefAttrList /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - MODEL_EXPORT virtual void remove(const std::set& theIndices); + MODEL_EXPORT virtual void remove(const std::set &theIndices); /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); - protected: + +protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeRefAttrList(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + MODEL_EXPORT Model_AttributeRefAttrList(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index b6b2c42f2..8337e14f3 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeRefList.h" @@ -26,22 +27,26 @@ #include #include -void Model_AttributeRefList::append(ObjectPtr theObject) -{ +void Model_AttributeRefList::append(ObjectPtr theObject) { if (owner()->document() == theObject->document()) { - std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); - myRef->Append(aData->label().Father()); // store label of the object - } else if (theObject.get() && theObject->data()->isValid()) { // reference to the other document + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); + myRef->Append(aData->label().Father()); // store label of the object + } else if (theObject.get() && + theObject->data()->isValid()) { // reference to the other document myRef->Append(myRef->Label()); - // if these attributes exist, the link is external: keep reference to access the label + // if these attributes exist, the link is external: keep reference to access + // the label std::ostringstream anIdString; // string with document Id - anIdString<document()->id(); + anIdString << theObject->document()->id(); myExtDocRef->Append(anIdString.str().c_str()); - std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); TCollection_AsciiString anEntry; TDF_Tool::Entry(aData->label().Father(), anEntry); myExtDocRef->Append(anEntry); - } else return; // something is wrong + } else + return; // something is wrong if (myHashUsed) { myHashObjects.insert(theObject); @@ -49,14 +54,14 @@ void Model_AttributeRefList::append(ObjectPtr theObject) myHashIndexNoEmpty[int(myHashIndexNoEmpty.size())] = theObject; } - // do it before the transaction finish to make just created/removed objects know dependencies - // and reference from composite feature is removed automatically + // do it before the transaction finish to make just created/removed objects + // know dependencies and reference from composite feature is removed + // automatically ADD_BACK_REF(theObject); owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeRefList::remove(ObjectPtr theObject) -{ +void Model_AttributeRefList::remove(ObjectPtr theObject) { eraseHash(); if (theObject.get() != NULL) { if (owner()->document() == theObject->document()) { @@ -67,26 +72,29 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) owner()->data()->sendAttributeUpdated(this); } else { // LCOV_EXCL_START - // create new lists because for the current moment remove one of the duplicated elements - // from the list is buggy + // create new lists because for the current moment remove one of the + // duplicated elements from the list is buggy TDF_LabelList anOldList = myRef->List(); myRef->Clear(); TDataStd_ListOfExtendedString anOldExts = myExtDocRef->List(); myExtDocRef->Clear(); std::ostringstream anIdString; // string with document Id - anIdString<document()->id(); - std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); + anIdString << theObject->document()->id(); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); TCollection_AsciiString anEntry; TDF_Tool::Entry(aData->label().Father(), anEntry); bool aFound = false; TDataStd_ListIteratorOfListOfExtendedString anExtIter(anOldExts); - for (TDF_ListIteratorOfLabelList aLIter(anOldList); aLIter.More(); aLIter.Next()) { + for (TDF_ListIteratorOfLabelList aLIter(anOldList); aLIter.More(); + aLIter.Next()) { if (aLIter.Value() == myRef->Label()) { if (anExtIter.Value() == anIdString.str().c_str()) { TDataStd_ListIteratorOfListOfExtendedString anExtIter2 = anExtIter; anExtIter2.Next(); - if (anExtIter2.Value() == anEntry) { // fully matches, so, remove(don't copy) + if (anExtIter2.Value() == + anEntry) { // fully matches, so, remove(don't copy) aFound = true; continue; } @@ -104,13 +112,14 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) } // LCOV_EXCL_STOP } - } - else { // in case of empty object remove, the first empty object is removed from the list - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); + } else { // in case of empty object remove, the first empty object is removed + // from the list + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - const TDF_LabelList& aList = myRef->List(); - for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { + const TDF_LabelList &aList = myRef->List(); + for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); + aLIter.Next()) { ObjectPtr anObj = aDoc->objects()->object(aLIter.Value()); if (anObj.get() == NULL) { myRef->Remove(aLIter.Value()); @@ -123,12 +132,11 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) } } -void Model_AttributeRefList::clear() -{ +void Model_AttributeRefList::clear() { std::list anOldList = list(); myRef->Clear(); std::list::iterator anOldIter = anOldList.begin(); - for(; anOldIter != anOldList.end(); anOldIter++) { + for (; anOldIter != anOldList.end(); anOldIter++) { REMOVE_BACK_REF((*anOldIter)); } myExtDocRef->Clear(); @@ -136,8 +144,7 @@ void Model_AttributeRefList::clear() owner()->data()->sendAttributeUpdated(this); } -int Model_AttributeRefList::size(const bool theWithEmpty) const -{ +int Model_AttributeRefList::size(const bool theWithEmpty) const { if (theWithEmpty) return myRef->Extent(); @@ -145,26 +152,28 @@ int Model_AttributeRefList::size(const bool theWithEmpty) const return int(myHashIndexNoEmpty.size()); int aResult = 0; - const TDF_LabelList& aList = myRef->List(); - for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { - if (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot()) aResult++; + const TDF_LabelList &aList = myRef->List(); + for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); + aLIter.Next()) { + if (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot()) + aResult++; } return aResult; } -bool Model_AttributeRefList::isInitialized() -{ +bool Model_AttributeRefList::isInitialized() { if (size(false) == 0) { - // empty list is not initialized list: sketch will be not valid after add/undo + // empty list is not initialized list: sketch will be not valid after + // add/undo return false; } return ModelAPI_AttributeRefList::isInitialized(); } -ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& theLIter, - TDataStd_ListIteratorOfListOfExtendedString& theExtIter, - std::shared_ptr theDoc) const -{ +ObjectPtr Model_AttributeRefList::iteratedObject( + TDF_ListIteratorOfLabelList &theLIter, + TDataStd_ListIteratorOfListOfExtendedString &theExtIter, + std::shared_ptr theDoc) const { ObjectPtr anObj; if (!theLIter.Value().IsNull() && !theLIter.Value().IsRoot()) { if (theLIter.Value() == myRef->Label()) { // external document object @@ -172,10 +181,12 @@ ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& th theExtIter.Next(); DocumentPtr aRefDoc = Model_Application::getApplication()->document(anID); if (aRefDoc.get()) { - std::shared_ptr aDR = std::dynamic_pointer_cast(aRefDoc); + std::shared_ptr aDR = + std::dynamic_pointer_cast(aRefDoc); TDF_Label aRefLab; TDF_Tool::Label(aDR->objects()->featuresLabel().Data(), - TCollection_AsciiString(theExtIter.Value()).ToCString(), aRefLab); + TCollection_AsciiString(theExtIter.Value()).ToCString(), + aRefLab); if (!aRefLab.IsNull()) { anObj = aDR->objects()->object(aRefLab); } @@ -190,28 +201,26 @@ ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& th return anObj; } -std::list Model_AttributeRefList::list() -{ +std::list Model_AttributeRefList::list() { createHash(); std::list aResult; std::map::iterator aHashIter = myHashIndex.begin(); - for(; aHashIter != myHashIndex.end(); aHashIter++) { + for (; aHashIter != myHashIndex.end(); aHashIter++) { aResult.push_back(aHashIter->second); } return aResult; } -bool Model_AttributeRefList::isInList(const ObjectPtr& theObj) -{ - if(!theObj.get()) { +bool Model_AttributeRefList::isInList(const ObjectPtr &theObj) { + if (!theObj.get()) { return false; } createHash(); return myHashObjects.count(theObj) != 0; } -ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithEmpty) -{ +ObjectPtr Model_AttributeRefList::object(const int theIndex, + const bool theWithEmpty) { createHash(); std::map::iterator aFind; if (theWithEmpty) { @@ -226,18 +235,19 @@ ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithE return aFind->second; } -void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew) -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +void Model_AttributeRefList::substitute(const ObjectPtr &theCurrent, + const ObjectPtr &theNew) { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - std::shared_ptr aData = std::dynamic_pointer_cast(theCurrent->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theCurrent->data()); if (aData.get() && aData->isValid()) { TDF_Label aCurrentLab = aData->label().Father(); TDF_Label aNewLab; if (theNew.get() && theNew->data()->isValid()) { // the new may be null std::shared_ptr aNewData = - std::dynamic_pointer_cast(theNew->data()); + std::dynamic_pointer_cast(theNew->data()); aNewLab = aNewData->label().Father(); } else { aNewLab = aCurrentLab.Root(); // root means null object @@ -254,10 +264,9 @@ void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const Objec } } -void Model_AttributeRefList::removeLast() -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +void Model_AttributeRefList::removeLast() { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc && !myRef->IsEmpty()) { ObjectPtr anObj = aDoc->objects()->object(myRef->Last()); if (anObj.get()) { @@ -269,20 +278,20 @@ void Model_AttributeRefList::removeLast() } } -void Model_AttributeRefList::remove(const std::set& theIndices) -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); +void Model_AttributeRefList::remove(const std::set &theIndices) { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc && !myRef->IsEmpty()) { // collect labels that will be removed TDF_LabelList aLabelsToRemove; TDF_ListIteratorOfLabelList aLabIter(myRef->List()); - for(int aCurrent = 0; aLabIter.More(); aLabIter.Next(), aCurrent++) { + for (int aCurrent = 0; aLabIter.More(); aLabIter.Next(), aCurrent++) { if (theIndices.find(aCurrent) != theIndices.end()) aLabelsToRemove.Append(aLabIter.Value()); } // remove labels - for(aLabIter.Initialize(aLabelsToRemove); aLabIter.More(); aLabIter.Next()) { + for (aLabIter.Initialize(aLabelsToRemove); aLabIter.More(); + aLabIter.Next()) { ObjectPtr anObj = aDoc->objects()->object(aLabIter.Value()); if (anObj.get()) { myRef->Remove(aLabIter.Value()); @@ -296,15 +305,14 @@ void Model_AttributeRefList::remove(const std::set& theIndices) } } -Model_AttributeRefList::Model_AttributeRefList(TDF_Label& theLabel) -{ +Model_AttributeRefList::Model_AttributeRefList(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeRefList::reinit() -{ - myIsInitialized = myLab.FindAttribute(TDataStd_ReferenceList::GetID(), myRef) == Standard_True; +void Model_AttributeRefList::reinit() { + myIsInitialized = myLab.FindAttribute(TDataStd_ReferenceList::GetID(), + myRef) == Standard_True; if (!myIsInitialized) { myRef = TDataStd_ReferenceList::Set(myLab); } @@ -314,17 +322,17 @@ void Model_AttributeRefList::reinit() eraseHash(); } -void Model_AttributeRefList::createHash() -{ +void Model_AttributeRefList::createHash() { if (myHashUsed) return; eraseHash(); - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - const TDF_LabelList& aList = myRef->List(); + const TDF_LabelList &aList = myRef->List(); TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List()); - for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { + for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); + aLIter.Next()) { ObjectPtr anObj = iteratedObject(aLIter, anExtIter, aDoc); myHashIndex[int(myHashIndex.size())] = anObj; if (anObj.get()) { @@ -333,12 +341,12 @@ void Model_AttributeRefList::createHash() } } } - if (!myHashObjects.empty()) // on open document with multi-rotation referenced have no results + if (!myHashObjects.empty()) // on open document with multi-rotation referenced + // have no results myHashUsed = true; } -void Model_AttributeRefList::eraseHash() -{ +void Model_AttributeRefList::eraseHash() { myHashObjects.clear(); myHashIndex.clear(); myHashIndexNoEmpty.clear(); diff --git a/src/Model/Model_AttributeRefList.h b/src/Model/Model_AttributeRefList.h index edfc2a3d4..59e418449 100644 --- a/src/Model/Model_AttributeRefList.h +++ b/src/Model/Model_AttributeRefList.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeRefList_H_ @@ -25,26 +26,28 @@ #include "ModelAPI_Feature.h" #include "Model_Document.h" -#include #include +#include /**\class Model_AttributeRefList * \ingroup DataModel - * \brief Attribute that contains list of references to features, may be located in different documents. + * \brief Attribute that contains list of references to features, may be located + * in different documents. */ -class Model_AttributeRefList : public ModelAPI_AttributeRefList -{ +class Model_AttributeRefList : public ModelAPI_AttributeRefList { TDF_Label myLab; ///< the main label of this attribute - Handle_TDataStd_ReferenceList myRef; ///< references to the features labels - /// pairs of doc ID and entries if reference is to external object, appends some in this list if - /// something in myRef is empty + Handle_TDataStd_ReferenceList myRef; ///< references to the features labels + /// pairs of doc ID and entries if reference is to external object, appends + /// some in this list if something in myRef is empty Handle_TDataStd_ExtStringList myExtDocRef; bool myHashUsed; ///< true if the hash stored is valid - std::set myHashObjects; ///< hashed information: objects existing in the list + std::set + myHashObjects; ///< hashed information: objects existing in the list std::map myHashIndex; ///< index to object in the list - std::map myHashIndexNoEmpty; ///< index to not empty object in the list + std::map + myHashIndexNoEmpty; ///< index to not empty object in the list public: /// Appends the feature to the end of a list MODEL_EXPORT virtual void append(ObjectPtr theObject); @@ -53,7 +56,8 @@ public: MODEL_EXPORT virtual void remove(ObjectPtr theObject); /// Returns number of features in the list - ///\param theWithEmpty if it is false, returns the number of not-empty referenced objects + ///\param theWithEmpty if it is false, returns the number of not-empty + /// referenced objects MODEL_EXPORT virtual int size(const bool theWithEmpty = true) const; /// Removes all references from the list @@ -63,16 +67,19 @@ public: MODEL_EXPORT virtual std::list list(); /// Returns true if the object is in list - MODEL_EXPORT virtual bool isInList(const ObjectPtr& theObj); + MODEL_EXPORT virtual bool isInList(const ObjectPtr &theObj); /// Returns the list of features ///\param theIndex zero-based index in the list - ///\param theWithEmpty if it is false, counts the not-empty referenced objects only - MODEL_EXPORT virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true); + ///\param theWithEmpty if it is false, counts the not-empty referenced objects + /// only + MODEL_EXPORT virtual ObjectPtr object(const int theIndex, + const bool theWithEmpty = true); - /// Substitutes the feature by another one. Does nothing if such object is not found. - /// Does not support the external documents objects yet. - MODEL_EXPORT virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew); + /// Substitutes the feature by another one. Does nothing if such object is not + /// found. Does not support the external documents objects yet. + MODEL_EXPORT virtual void substitute(const ObjectPtr &theCurrent, + const ObjectPtr &theNew); /// Removes the last element in the list. /// Does not support the external documents objects yet. @@ -81,7 +88,7 @@ public: /// Removes the elements from the list. /// Does not support the external documents objects yet. /// \param theIndices a list of indices of elements to be removed - MODEL_EXPORT virtual void remove(const std::set& theIndices); + MODEL_EXPORT virtual void remove(const std::set &theIndices); /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); @@ -91,14 +98,17 @@ public: protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeRefList(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + MODEL_EXPORT Model_AttributeRefList(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); /// Returns the object by iterators (theExtIter is iterated if necessary) - ObjectPtr iteratedObject(TDF_ListIteratorOfLabelList& theLIter, - TDataStd_ListIteratorOfListOfExtendedString& theExtIter, - std::shared_ptr theDoc) const; - /// Creates the hash-objects containers (does nothing if hash is already correct) + ObjectPtr + iteratedObject(TDF_ListIteratorOfLabelList &theLIter, + TDataStd_ListIteratorOfListOfExtendedString &theExtIter, + std::shared_ptr theDoc) const; + /// Creates the hash-objects containers (does nothing if hash is already + /// correct) void createHash(); friend class Model_Data; diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index 068d14331..98512382c 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeReference.h" #include "Model_Application.h" -#include "Model_Events.h" #include "Model_Data.h" +#include "Model_Events.h" #include "Model_Objects.h" #include #include -#include -#include #include +#include +#include -void Model_AttributeReference::setValue(ObjectPtr theObject) -{ +void Model_AttributeReference::setValue(ObjectPtr theObject) { // now allow to deselect in this attribute: extrusion from/to - //if(!theObject) + // if(!theObject) // return; ObjectPtr aValue = value(); if (!myIsInitialized || aValue != theObject) { @@ -40,8 +40,8 @@ void Model_AttributeReference::setValue(ObjectPtr theObject) TDF_Label anObjLab; if (theObject.get() && theObject->data()->isValid()) { - std::shared_ptr aData = std::dynamic_pointer_cast( - theObject->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); anObjLab = aData->label().Father(); // object label } // same document, use reference attribute @@ -50,42 +50,47 @@ void Model_AttributeReference::setValue(ObjectPtr theObject) if (anObjLab.IsNull()) { myRef->Set(myRef->Label()); } else { - myRef->Set(anObjLab); // references to the object label + myRef->Set(anObjLab); // references to the object label } - // remove external link attributes (if any) + // remove external link attributes (if any) myRef->Label().ForgetAttribute(TDataStd_Comment::GetID()); myRef->Label().ForgetAttribute(TDataStd_AsciiString::GetID()); - } else { // different document: store the document name (comment) and entry (string): external - // if these attributes exist, the link is external: keep reference to access the label + } else { // different document: store the document name (comment) and entry + // (string): external + // if these attributes exist, the link is external: keep reference to + // access the label std::ostringstream anIdString; // string with document Id - anIdString<document()->id(); + anIdString << theObject->document()->id(); TDataStd_Comment::Set(myRef->Label(), anIdString.str().c_str()); TCollection_AsciiString anEntry; TDF_Tool::Entry(anObjLab, anEntry); TDataStd_AsciiString::Set(myRef->Label(), anEntry); } - // do it before the transaction finish to make just created/removed objects know dependencies - // and reference from composite feature is removed automatically + // do it before the transaction finish to make just created/removed objects + // know dependencies and reference from composite feature is removed + // automatically ADD_BACK_REF(theObject); owner()->data()->sendAttributeUpdated(this); } } -ObjectPtr Model_AttributeReference::value() -{ +ObjectPtr Model_AttributeReference::value() { Handle(TDataStd_Comment) aDocID; - if (myRef->Label().FindAttribute(TDataStd_Comment::GetID(), aDocID)) { // external ref + if (myRef->Label().FindAttribute(TDataStd_Comment::GetID(), + aDocID)) { // external ref int anID = atoi(TCollection_AsciiString(aDocID->Get()).ToCString()); DocumentPtr aRefDoc = Model_Application::getApplication()->document(anID); if (aRefDoc.get()) { Handle(TDataStd_AsciiString) anEntry; - if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), anEntry)) { - std::shared_ptr aDR = std::dynamic_pointer_cast(aRefDoc); + if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), + anEntry)) { + std::shared_ptr aDR = + std::dynamic_pointer_cast(aRefDoc); if (aDR.get() && aDR->objects()) { TDF_Label aRefLab; TDF_Tool::Label(aDR->objects()->featuresLabel().Data(), - anEntry->Get().ToCString(), aRefLab); + anEntry->Get().ToCString(), aRefLab); if (!aRefLab.IsNull()) { return aDR->objects()->object(aRefLab); } @@ -94,11 +99,11 @@ ObjectPtr Model_AttributeReference::value() } } else { // internal ref if (owner().get()) { - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { TDF_Label aRefLab = myRef->Get(); - if (!aRefLab.IsNull()) { // it may happen with old document, issue #285 + if (!aRefLab.IsNull()) { // it may happen with old document, issue #285 return aDoc->objects()->object(aRefLab); } } @@ -107,43 +112,42 @@ ObjectPtr Model_AttributeReference::value() return FeaturePtr(); } -bool Model_AttributeReference::isInitialized() -{ - if (myRef->Label() == myRef->Get() && !myRef->Label().IsAttribute(TDataStd_Comment::GetID())) { +bool Model_AttributeReference::isInitialized() { + if (myRef->Label() == myRef->Get() && + !myRef->Label().IsAttribute(TDataStd_Comment::GetID())) { // empty reference is not initialized return false; } return ModelAPI_AttributeReference::isInitialized(); } -Model_AttributeReference::Model_AttributeReference(TDF_Label& theLabel) -{ +Model_AttributeReference::Model_AttributeReference(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeReference::reinit() -{ - myIsInitialized = myLab.FindAttribute(TDF_Reference::GetID(), myRef) == Standard_True; +void Model_AttributeReference::reinit() { + myIsInitialized = + myLab.FindAttribute(TDF_Reference::GetID(), myRef) == Standard_True; if (!myIsInitialized) { - myRef = TDF_Reference::Set(myLab, myLab); // not initialized references to itself + myRef = TDF_Reference::Set(myLab, + myLab); // not initialized references to itself myIsInitialized = true; } else { if (owner()) { std::shared_ptr aDoc = - std::dynamic_pointer_cast(owner()->document()); + std::dynamic_pointer_cast(owner()->document()); } } } -void Model_AttributeReference::setObject(const std::shared_ptr& theObject) -{ +void Model_AttributeReference::setObject( + const std::shared_ptr &theObject) { if (owner() != theObject) { ModelAPI_AttributeReference::setObject(theObject); - //std::shared_ptr aDoc = - // std::dynamic_pointer_cast(owner()->document()); + // std::shared_ptr aDoc = + // std::dynamic_pointer_cast(owner()->document()); } } -Model_AttributeReference::~Model_AttributeReference() -{} +Model_AttributeReference::~Model_AttributeReference() {} diff --git a/src/Model/Model_AttributeReference.h b/src/Model/Model_AttributeReference.h index 1de5c60a8..35b930e94 100644 --- a/src/Model/Model_AttributeReference.h +++ b/src/Model/Model_AttributeReference.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeReference_H_ @@ -28,14 +29,14 @@ /**\class Model_AttributeReference * \ingroup DataModel - * \brief Attribute that contains reference to feature (located in the same document). + * \brief Attribute that contains reference to feature (located in the same + * document). */ -class Model_AttributeReference : public ModelAPI_AttributeReference -{ - TDF_Label myLab; ///< the main label of this attribute - Handle_TDF_Reference myRef; ///< references to the feature label - public: +class Model_AttributeReference : public ModelAPI_AttributeReference { + TDF_Label myLab; ///< the main label of this attribute + Handle_TDF_Reference myRef; ///< references to the feature label +public: /// Defines the object referenced from this attribute MODEL_EXPORT virtual void setValue(ObjectPtr theObject); @@ -44,16 +45,17 @@ class Model_AttributeReference : public ModelAPI_AttributeReference MODEL_EXPORT ~Model_AttributeReference(); - MODEL_EXPORT virtual void setObject(const std::shared_ptr& theObject); + MODEL_EXPORT virtual void + setObject(const std::shared_ptr &theObject); /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); - protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeReference(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + MODEL_EXPORT Model_AttributeReference(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 9ee407686..9789adb83 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -14,72 +14,71 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeSelection.h" #include "Model_Application.h" -#include "Model_Events.h" #include "Model_Data.h" #include "Model_Document.h" -#include -#include -#include +#include "Model_Events.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 #include -#include #include -#include +#include +#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 DEB_NAMING 1 #ifdef DEB_NAMING #include #endif -/// added to the index in the packed map to signalize that the vertex of edge is selected -/// (multiplied by the index of the edge) +/// added to the index in the packed map to signalize that the vertex of edge is +/// selected (multiplied by the index of the edge) static const int kSTART_VERTEX_DELTA = 1000000; // identifier that there is simple reference: selection equals to context Standard_GUID kSIMPLE_REF_ID("635eacb2-a1d6-4dec-8348-471fae17cb29"); @@ -101,12 +100,13 @@ const static std::wstring kWHOLE_FEATURE = L"all-in-"; // on this label is stored: // TNaming_NamedShape - selected shape // TNaming_Naming - topological selection information (for the body) -// TDataStd_IntPackedMap - indexes of edges in composite element (for construction) -// TDataStd_Integer - type of the selected shape (for construction) -// TDF_Reference - from ReferenceAttribute, the context -bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, - const std::shared_ptr& theSubShape, const bool theTemporarily) -{ +// TDataStd_IntPackedMap - indexes of edges in composite element (for +// construction) TDataStd_Integer - type of the selected shape (for +// construction) TDF_Reference - from ReferenceAttribute, the context +bool Model_AttributeSelection::setValue( + const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily) { if (theTemporarily) { // just keep the stored without DF update myTmpContext = theContext; @@ -120,11 +120,14 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, } CenterType aType; - const std::shared_ptr& anOldShape = internalValue(aType); + const std::shared_ptr &anOldShape = internalValue(aType); bool isOldContext = theContext == myRef.value(); - bool isOldShape = isOldContext && - (theSubShape == anOldShape || (theSubShape && anOldShape && theSubShape->isEqual(anOldShape))); - if (isOldShape) return false; // shape is the same, so context is also unchanged + bool isOldShape = + isOldContext && + (theSubShape == anOldShape || + (theSubShape && anOldShape && theSubShape->isEqual(anOldShape))); + if (isOldShape) + return false; // shape is the same, so context is also unchanged bool aToUnblock = false; // update the referenced object if needed if (!isOldContext) { @@ -132,7 +135,8 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, myRef.setValue(theContext); } - // do not use naming if selected shape is result shape itself, but not sub-shape + // do not use naming if selected shape is result shape itself, but not + // sub-shape TDF_Label aSelLab = selectionLabel(); aSelLab.ForgetAttribute(kSIMPLE_REF_ID); aSelLab.ForgetAttribute(kINVALID_SELECTION); @@ -141,11 +145,13 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, aSelLab.ForgetAttribute(kELLIPSE_CENTER2); bool isDegeneratedEdge = false; - // do not use the degenerated edge as a shape, a null context and shape is used in the case + // do not use the degenerated edge as a shape, a null context and shape is + // used in the case if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) { - const TopoDS_Shape& aSubShape = theSubShape->impl(); + const TopoDS_Shape &aSubShape = theSubShape->impl(); if (aSubShape.ShapeType() == TopAbs_EDGE) - isDegeneratedEdge = BRep_Tool::Degenerated(TopoDS::Edge(aSubShape)) == Standard_True; + isDegeneratedEdge = + BRep_Tool::Degenerated(TopoDS::Edge(aSubShape)) == Standard_True; } if (!theContext.get() || isDegeneratedEdge) { aSelLab.ForgetAllAttributes(true); @@ -157,15 +163,19 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, bool isSelectBody = theContext->groupName() == ModelAPI_ResultBody::group(); if (!isSelectBody) { ResultConstructionPtr aContextConstruction = - std::dynamic_pointer_cast(theContext); - isSelectBody = aContextConstruction.get() && !aContextConstruction->isInfinite(); + std::dynamic_pointer_cast(theContext); + isSelectBody = + aContextConstruction.get() && !aContextConstruction->isInfinite(); } if (isSelectBody) { - ResultPtr aContextResult = std::dynamic_pointer_cast(theContext); + ResultPtr aContextResult = + std::dynamic_pointer_cast(theContext); GeomShapePtr aContextShape = aContextResult->shape(); - // do not select the whole shape for body:it is already must be in the data framework - // equal and null selected objects mean the same: object is equal to context, - if (aContextShape.get() && (aContextShape->isEqual(theSubShape) || !theSubShape.get())) { + // do not select the whole shape for body:it is already must be in the data + // framework equal and null selected objects mean the same: object is equal + // to context, + if (aContextShape.get() && + (aContextShape->isEqual(theSubShape) || !theSubShape.get())) { aSelLab.ForgetAllAttributes(true); TDataStd_UAttribute::Set(aSelLab, kSIMPLE_REF_ID); } else { @@ -174,22 +184,27 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, } else if (theContext->groupName() == ModelAPI_ResultConstruction::group()) { aSelLab.ForgetAllAttributes(true); // to remove old selection data std::shared_ptr aConstruction = - std::dynamic_pointer_cast(theContext); + std::dynamic_pointer_cast(theContext); std::shared_ptr aSubShape; if (theSubShape.get() && !aConstruction->shape()->isEqual(theSubShape)) aSubShape = theSubShape; // the whole context } else if (theContext->groupName() == ModelAPI_ResultPart::group()) { aSelLab.ForgetAllAttributes(true); TDataStd_UAttribute::Set(aSelLab, kPART_REF_ID); - selectPart(std::dynamic_pointer_cast(theContext), theSubShape); + selectPart(std::dynamic_pointer_cast(theContext), + theSubShape); } else if (theContext->groupName() == ModelAPI_ResultGroup::group()) { aSelLab.ForgetAllAttributes(true); TDataStd_UAttribute::Set(aSelLab, kSIMPLE_REF_ID); - } else { // check the feature context: only construction features of PartSet could be selected - FeaturePtr aFeatureContext = std::dynamic_pointer_cast(theContext); - if (aFeatureContext.get() && owner()->document() != aFeatureContext->document()) { + } else { // check the feature context: only construction features of PartSet + // could be selected + FeaturePtr aFeatureContext = + std::dynamic_pointer_cast(theContext); + if (aFeatureContext.get() && + owner()->document() != aFeatureContext->document()) { if (aFeatureContext->results().empty() || - aFeatureContext->firstResult()->groupName() != ModelAPI_ResultConstruction::group()) { + aFeatureContext->firstResult()->groupName() != + ModelAPI_ResultConstruction::group()) { aSelLab.ForgetAllAttributes(true); myRef.setValue(ObjectPtr()); if (aToUnblock) @@ -208,15 +223,14 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, } void Model_AttributeSelection::setValueCenter( - const ObjectPtr& theContext, const std::shared_ptr& theEdge, - const CenterType theCenterType, const bool theTemporarily) -{ + const ObjectPtr &theContext, const std::shared_ptr &theEdge, + const CenterType theCenterType, const bool theTemporarily) { bool anUpdated = setValue(theContext, theEdge, theTemporarily); if (theTemporarily) { myTmpCenterType = theCenterType; } else { // store in the data structure TDF_Label aSelLab = selectionLabel(); - switch(theCenterType) { + switch (theCenterType) { case CIRCLE_CENTER: if (!anUpdated) anUpdated = !aSelLab.IsAttribute(kCIRCLE_CENTER); @@ -241,11 +255,11 @@ void Model_AttributeSelection::setValueCenter( } void Model_AttributeSelection::selectValue( - const std::shared_ptr& theSource) -{ + const std::shared_ptr &theSource) { CenterType aType; std::shared_ptr aValue = - std::dynamic_pointer_cast(theSource)->internalValue(aType); + std::dynamic_pointer_cast(theSource) + ->internalValue(aType); if (!aValue.get() || aType == NOT_CENTER) { setValue(theSource->context(), aValue); } else { @@ -255,8 +269,7 @@ void Model_AttributeSelection::selectValue( } } -void Model_AttributeSelection::removeTemporaryValues() -{ +void Model_AttributeSelection::removeTemporaryValues() { if (myTmpContext.get() || myTmpSubShape.get()) { myTmpContext.reset(); myTmpSubShape.reset(); @@ -264,9 +277,10 @@ void Model_AttributeSelection::removeTemporaryValues() } // returns the center of the edge: circular or elliptic -GeomShapePtr centerByEdge(GeomShapePtr theEdge, ModelAPI_AttributeSelection::CenterType theType) -{ - if (theType != ModelAPI_AttributeSelection::NOT_CENTER && theEdge.get() != NULL) { +GeomShapePtr centerByEdge(GeomShapePtr theEdge, + ModelAPI_AttributeSelection::CenterType theType) { + if (theType != ModelAPI_AttributeSelection::NOT_CENTER && + theEdge.get() != NULL) { TopoDS_Shape aShape = theEdge->impl(); if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); @@ -276,20 +290,26 @@ GeomShapePtr centerByEdge(GeomShapePtr theEdge, ModelAPI_AttributeSelection::Cen TopoDS_Vertex aVertex; BRep_Builder aBuilder; if (theType == ModelAPI_AttributeSelection::CIRCLE_CENTER) { - while(!aCurve.IsNull() && aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) + while (!aCurve.IsNull() && + aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(aCurve); if (!aCirc.IsNull()) { - aBuilder.MakeVertex(aVertex, aCirc->Location(), Precision::Confusion()); + aBuilder.MakeVertex(aVertex, aCirc->Location(), + Precision::Confusion()); } } else { // ellipse - while(!aCurve.IsNull() && aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) + while (!aCurve.IsNull() && + aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); Handle(Geom_Ellipse) anEll = Handle(Geom_Ellipse)::DownCast(aCurve); if (!anEll.IsNull()) { - aBuilder.MakeVertex(aVertex, - theType == ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS ? - anEll->Focus1() : anEll->Focus2(), Precision::Confusion()); + aBuilder.MakeVertex( + aVertex, + theType == ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS + ? anEll->Focus1() + : anEll->Focus2(), + Precision::Confusion()); } } if (!aVertex.IsNull()) { @@ -303,8 +323,7 @@ GeomShapePtr centerByEdge(GeomShapePtr theEdge, ModelAPI_AttributeSelection::Cen return theEdge; // no vertex, so, return the initial edge } -std::shared_ptr Model_AttributeSelection::value() -{ +std::shared_ptr Model_AttributeSelection::value() { if (!myRef.isInitialized() && !myTmpContext.get() && !myTmpSubShape.get()) return std::shared_ptr(); CenterType aType = NOT_CENTER; @@ -312,26 +331,28 @@ std::shared_ptr Model_AttributeSelection::value() return centerByEdge(aResult, aType); } -std::shared_ptr Model_AttributeSelection::internalValue(CenterType& theType) -{ +std::shared_ptr +Model_AttributeSelection::internalValue(CenterType &theType) { theType = NOT_CENTER; GeomShapePtr aResult; if (myTmpContext.get() || myTmpSubShape.get()) { theType = myTmpCenterType; ResultConstructionPtr aResulConstruction = - std::dynamic_pointer_cast(myTmpContext); - if(aResulConstruction.get()) { + std::dynamic_pointer_cast(myTmpContext); + if (aResulConstruction.get()) { // it is just reference to construction. return myTmpSubShape; } FeaturePtr aFeature = - std::dynamic_pointer_cast(myTmpContext); + std::dynamic_pointer_cast(myTmpContext); if (aFeature.get()) { // it is just reference to construction. return myTmpSubShape; } - return myTmpSubShape.get() ? myTmpSubShape : - std::dynamic_pointer_cast(myTmpContext)->shape(); + return myTmpSubShape.get() + ? myTmpSubShape + : std::dynamic_pointer_cast(myTmpContext) + ->shape(); } TDF_Label aSelLab = selectionLabel(); @@ -345,31 +366,37 @@ std::shared_ptr Model_AttributeSelection::internalValue(CenterTyp else if (aSelLab.IsAttribute(kELLIPSE_CENTER2)) theType = ELLIPSE_SECOND_FOCUS; - if (myRef.isInitialized()) { - if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape + if (aSelLab.IsAttribute( + kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape ResultPtr aContext = context(); - if (!aContext.get() || aContext->groupName() == ModelAPI_ResultConstruction::group()) + if (!aContext.get() || + aContext->groupName() == ModelAPI_ResultConstruction::group()) return aResult; // empty result, for whole construction selection also return aContext->shape(); } if (aSelLab.IsAttribute(kPART_REF_ID)) { - ResultPartPtr aPart = std::dynamic_pointer_cast(context()); + ResultPartPtr aPart = + std::dynamic_pointer_cast(context()); if (!aPart.get() || !aPart->isActivated()) return std::shared_ptr(); // postponed naming needed Handle(TDataStd_Integer) anIndex; if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) { if (anIndex->Get()) { // special selection attribute was created, use it return aPart->selectionValue(anIndex->Get()); - } else { // face with name is already in the data model, so try to take it by name + } else { // face with name is already in the data model, so try to take + // it by name Handle(TDataStd_Name) aName; if (aSelLab.FindAttribute(TDataStd_Name::GetID(), aName)) { - std::wstring aSubShapeName = Locale::Convert::toWString(aName->Get().ToExtString()); + std::wstring aSubShapeName = + Locale::Convert::toWString(aName->Get().ToExtString()); std::size_t aPartEnd = aSubShapeName.find(L'/'); - if (aPartEnd != std::wstring::npos && aPartEnd != aSubShapeName.rfind(L'/')) { + if (aPartEnd != std::wstring::npos && + aPartEnd != aSubShapeName.rfind(L'/')) { std::wstring aNameInPart = aSubShapeName.substr(aPartEnd + 1); int anInd; - std::string aType; // to reuse already existing selection the type is not needed + std::string aType; // to reuse already existing selection the type + // is not needed return aPart->shapeInPart(aNameInPart, aType, anInd); } } @@ -378,17 +405,19 @@ std::shared_ptr Model_AttributeSelection::internalValue(CenterTyp } std::shared_ptr aConstr = - std::dynamic_pointer_cast(context()); + std::dynamic_pointer_cast(context()); if (aConstr) { if (aConstr->isInfinite()) return aResult; // empty result } - if (!aConstr.get()) { // for construction context, return empty result as usual even + if (!aConstr.get()) { // for construction context, return empty result as + // usual even // the whole feature is selected FeaturePtr aFeature = contextFeature(); if (aFeature.get()) { std::list allShapes; - std::list::const_iterator aRes = aFeature->results().cbegin(); + std::list::const_iterator aRes = + aFeature->results().cbegin(); for (; aRes != aFeature->results().cend(); aRes++) { if (aRes->get() && !(*aRes)->isDisabled()) { GeomShapePtr aShape = (*aRes)->shape(); @@ -401,7 +430,8 @@ std::shared_ptr Model_AttributeSelection::internalValue(CenterTyp } } else { if (contextFeature().get()) { - return aResult; // for the whole sketch feature selected return null => all faces + return aResult; // for the whole sketch feature selected return null => + // all faces } } @@ -410,39 +440,42 @@ std::shared_ptr Model_AttributeSelection::internalValue(CenterTyp TopoDS_Shape aSelShape = aSelection->Get(); aResult = std::shared_ptr(new GeomAPI_Shape); aResult->setImpl(new TopoDS_Shape(aSelShape)); - } else if (aConstr) { // simple construction element: just shape of this construction element + } else if (aConstr) { // simple construction element: just shape of this + // construction element aResult = aConstr->shape(); } } return aResult; } -bool Model_AttributeSelection::isInvalid() -{ +bool Model_AttributeSelection::isInvalid() { return selectionLabel().IsAttribute(kINVALID_SELECTION) == Standard_True; } -bool Model_AttributeSelection::isInitialized() -{ +bool Model_AttributeSelection::isInitialized() { if (myRef.isInitialized()) { TDF_Label aSelLab = selectionLabel(); // it is just reference to shape, not sub-shape - if (aSelLab.IsAttribute(kSIMPLE_REF_ID) || aSelLab.IsAttribute(kPART_REF_ID)) { + if (aSelLab.IsAttribute(kSIMPLE_REF_ID) || + aSelLab.IsAttribute(kPART_REF_ID)) { ResultPtr aContext = context(); return aContext.get() != NULL; } Handle(TNaming_NamedShape) aSelection; - if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) { + if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), + aSelection)) { return !aSelection->Get().IsNull(); - } else { // for simple construction element: just shape of this construction element + } else { // for simple construction element: just shape of this construction + // element if (myRef.value().get()) return true; - // check that this is on open of document, so, results are not initialized yet + // check that this is on open of document, so, results are not initialized + // yet TDF_Label aRefLab = myRef.myRef->Get(); if (aRefLab.IsNull() || !owner().get()) return false; std::shared_ptr aMyDoc = - std::dynamic_pointer_cast(owner()->document()); + std::dynamic_pointer_cast(owner()->document()); if (!aMyDoc.get()) return false; // check at least the feature exists @@ -452,17 +485,13 @@ bool Model_AttributeSelection::isInitialized() return false; } -Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel) -: myRef(theLabel), - myTmpCenterType(NOT_CENTER), - myParent(NULL), - myIsGeometricalSelection(false) -{ +Model_AttributeSelection::Model_AttributeSelection(TDF_Label &theLabel) + : myRef(theLabel), myTmpCenterType(NOT_CENTER), myParent(NULL), + myIsGeometricalSelection(false) { myIsInitialized = myRef.isInitialized(); } -void Model_AttributeSelection::setID(const std::string theID) -{ +void Model_AttributeSelection::setID(const std::string theID) { myRef.setID(theID); ModelAPI_AttributeSelection::setID(theID); FeaturePtr aFeature = std::dynamic_pointer_cast(owner()); @@ -471,12 +500,12 @@ void Model_AttributeSelection::setID(const std::string theID) myIsGeometricalSelection = true; // myParent->isGeometricalSelection(); } else { myIsGeometricalSelection = - ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id()); + ModelAPI_Session::get()->validators()->isGeometricalSelection( + aFeature->getKind(), id()); } } -ResultPtr Model_AttributeSelection::context() -{ +ResultPtr Model_AttributeSelection::context() { if (!myRef.isInitialized() && !myTmpContext.get() && !myTmpSubShape.get()) return ResultPtr(); @@ -487,24 +516,32 @@ ResultPtr Model_AttributeSelection::context() ResultPtr aResult = std::dynamic_pointer_cast(myRef.value()); // for parts there could be same-data result, so take the last enabled if (aResult.get()) { - if(aResult->groupName() == ModelAPI_ResultPart::group()) { + if (aResult->groupName() == ModelAPI_ResultPart::group()) { int aSize = aResult->document()->size(ModelAPI_ResultPart::group()); - for(int a = aSize - 1; a >= 0; a--) { - ObjectPtr aPart = aResult->document()->object(ModelAPI_ResultPart::group(), a); - if(aPart.get() && aPart->data() == aResult->data()) { - ResultPtr aPartResult = std::dynamic_pointer_cast(aPart); - FeaturePtr anOwnerFeature = std::dynamic_pointer_cast(owner()); - // check that this result is not this-feature result (it is forbidden to select itself) - if(anOwnerFeature.get() && anOwnerFeature->firstResult() != aPartResult) { + for (int a = aSize - 1; a >= 0; a--) { + ObjectPtr aPart = + aResult->document()->object(ModelAPI_ResultPart::group(), a); + if (aPart.get() && aPart->data() == aResult->data()) { + ResultPtr aPartResult = + std::dynamic_pointer_cast(aPart); + FeaturePtr anOwnerFeature = + std::dynamic_pointer_cast(owner()); + // check that this result is not this-feature result (it is forbidden + // to select itself) + if (anOwnerFeature.get() && + anOwnerFeature->firstResult() != aPartResult) { return aPartResult; } } } } - } else { // if feature - construction is selected, it has only one result, return this result - FeaturePtr aFeature = std::dynamic_pointer_cast(myRef.value()); + } else { // if feature - construction is selected, it has only one result, + // return this result + FeaturePtr aFeature = + std::dynamic_pointer_cast(myRef.value()); if (aFeature.get() && aFeature->results().size() == 1 && - aFeature->firstResult()->groupName() == ModelAPI_ResultConstruction::group()) + aFeature->firstResult()->groupName() == + ModelAPI_ResultConstruction::group()) return aFeature->firstResult(); } return aResult; @@ -523,16 +560,15 @@ ObjectPtr Model_AttributeSelection::contextObject() { return context(); } - -void Model_AttributeSelection::setObject(const std::shared_ptr& theObject) -{ +void Model_AttributeSelection::setObject( + const std::shared_ptr &theObject) { ModelAPI_AttributeSelection::setObject(theObject); myRef.setObject(theObject); } /// Sets the invalid flag if flag is false, or removes it if "true" /// Returns theFlag -static bool setInvalidIfFalse(TDF_Label& theLab, const bool theFlag) { +static bool setInvalidIfFalse(TDF_Label &theLab, const bool theFlag) { if (theFlag) { theLab.ForgetAttribute(kINVALID_SELECTION); } else { @@ -541,14 +577,15 @@ static bool setInvalidIfFalse(TDF_Label& theLab, const bool theFlag) { return theFlag; } -void Model_AttributeSelection::split( - ResultPtr theContext, TopoDS_Shape theNewShape, TopAbs_ShapeEnum theType) -{ +void Model_AttributeSelection::split(ResultPtr theContext, + TopoDS_Shape theNewShape, + TopAbs_ShapeEnum theType) { TopTools_ListOfShape aSubs; - for(TopoDS_Iterator anExplorer(theNewShape); anExplorer.More(); anExplorer.Next()) { + for (TopoDS_Iterator anExplorer(theNewShape); anExplorer.More(); + anExplorer.Next()) { if (!anExplorer.Value().IsNull() && - anExplorer.Value().ShapeType() == theType) { - aSubs.Append(anExplorer.Value()); + anExplorer.Value().ShapeType() == theType) { + aSubs.Append(anExplorer.Value()); } else { // invalid case; bad result shape, so, impossible to split easily aSubs.Clear(); break; @@ -559,7 +596,7 @@ void Model_AttributeSelection::split( GeomShapePtr aSubSh(new GeomAPI_Shape); aSubSh->setImpl(new TopoDS_Shape(aSub.Value())); setValue(theContext, aSubSh); - for(aSub.Next(); aSub.More(); aSub.Next()) { + for (aSub.Next(); aSub.More(); aSub.Next()) { aSubSh.reset(new GeomAPI_Shape); aSubSh->setImpl(new TopoDS_Shape(aSub.Value())); myParent->append(theContext, aSubSh); @@ -567,19 +604,21 @@ void Model_AttributeSelection::split( } } -bool Model_AttributeSelection::update() -{ +bool Model_AttributeSelection::update() { FeaturePtr aContextFeature = contextFeature(); if (aContextFeature.get()) { - owner()->data()->sendAttributeUpdated(this); // send updated if "update" called in any way + owner()->data()->sendAttributeUpdated( + this); // send updated if "update" called in any way return true; } TDF_Label aSelLab = selectionLabel(); ResultPtr aContext = context(); if (!aContext.get()) return setInvalidIfFalse(aSelLab, false); - if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape - return setInvalidIfFalse(aSelLab, aContext->shape() && !aContext->shape()->isNull()); + if (aSelLab.IsAttribute( + kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape + return setInvalidIfFalse(aSelLab, + aContext->shape() && !aContext->shape()->isNull()); } if (aSelLab.IsAttribute(kPART_REF_ID)) { // it is reference to the part object @@ -617,8 +656,10 @@ bool Model_AttributeSelection::update() !aContextShape.IsSame(aNewShape)) { TopoDS_Shape aNewS = aNewShape; // take only sub-shape of composite for checking - if (aNewS.ShapeType() == TopAbs_WIRE || aNewS.ShapeType() == TopAbs_SHELL || - aNewS.ShapeType() == TopAbs_COMPOUND || aNewS.ShapeType() == TopAbs_COMPSOLID) { + if (aNewS.ShapeType() == TopAbs_WIRE || + aNewS.ShapeType() == TopAbs_SHELL || + aNewS.ShapeType() == TopAbs_COMPOUND || + aNewS.ShapeType() == TopAbs_COMPSOLID) { TopoDS_Iterator anIter(aNewS); if (anIter.More()) aNewS = anIter.Value(); @@ -636,9 +677,10 @@ bool Model_AttributeSelection::update() } } - if (anOldShape.IsNull() || aNewShape.IsNull() || !anOldShape.IsEqual(aNewShape) || aWasInvalid) - { - // shape type should not be changed: if shape becomes compound of such shapes, then split + if (anOldShape.IsNull() || aNewShape.IsNull() || + !anOldShape.IsEqual(aNewShape) || aWasInvalid) { + // shape type should not be changed: if shape becomes compound of such + // shapes, then split if (myParent && !anOldShape.IsNull() && !aNewShape.IsNull() && anOldShape.ShapeType() != aNewShape.ShapeType() && aNewShape.ShapeType() == TopAbs_COMPOUND) { @@ -646,16 +688,18 @@ bool Model_AttributeSelection::update() } // for issue #3076 check that the new value belongs to the new context if (!aNewShape.IsNull() && !aContextShape.IsNull() && - (aNewShape.ShapeType() == TopAbs_VERTEX || aNewShape.ShapeType() == TopAbs_EDGE || + (aNewShape.ShapeType() == TopAbs_VERTEX || + aNewShape.ShapeType() == TopAbs_EDGE || aNewShape.ShapeType() == TopAbs_FACE)) { TopExp_Explorer anExp(aContextShape, aNewShape.ShapeType()); - for(; anExp.More(); anExp.Next()) { + for (; anExp.More(); anExp.Next()) { if (anExp.Current().IsSame(aNewShape)) break; } aResult = setInvalidIfFalse(aSelLab, anExp.More()); } - owner()->data()->sendAttributeUpdated(this); // send updated if shape is changed + owner()->data()->sendAttributeUpdated( + this); // send updated if shape is changed } return aResult; } @@ -663,7 +707,7 @@ bool Model_AttributeSelection::update() if (aContext->groupName() == ModelAPI_ResultConstruction::group()) { bool aResult = true; std::shared_ptr aConstructionContext = - std::dynamic_pointer_cast(aContext); + std::dynamic_pointer_cast(aContext); if (!aConstructionContext->isInfinite()) { TopoDS_Shape aContextShape = aContext->shape()->impl(); Selector_Selector aSelector(aSelLab, baseDocumentLab()); @@ -671,9 +715,11 @@ bool Model_AttributeSelection::update() aResult = aSelector.restore(aContextShape); setInvalidIfFalse(aSelLab, aResult); if (aResult && !anOldShape.IsEqual(aSelector.value())) - owner()->data()->sendAttributeUpdated(this); // send updated if shape is changed + owner()->data()->sendAttributeUpdated( + this); // send updated if shape is changed } else { - owner()->data()->sendAttributeUpdated(this); // send updated if "update" called in any way + owner()->data()->sendAttributeUpdated( + this); // send updated if "update" called in any way } return aResult; } @@ -681,8 +727,8 @@ bool Model_AttributeSelection::update() } void Model_AttributeSelection::selectBody( - const ResultPtr& theContext, const std::shared_ptr& theSubShape) -{ + const ResultPtr &theContext, + const std::shared_ptr &theSubShape) { // perform the selection TopoDS_Shape aContext; @@ -691,11 +737,13 @@ void Model_AttributeSelection::selectBody( aContext = aBody->shape()->impl(); } else { ResultPtr aResult = - std::dynamic_pointer_cast(myRef.value()); + std::dynamic_pointer_cast(myRef.value()); if (aResult) { aContext = aResult->shape()->impl(); } else { - Events_InfoMessage("Model_AttributeSelection", "A result with shape is expected").send(); + Events_InfoMessage("Model_AttributeSelection", + "A result with shape is expected") + .send(); return; } } @@ -707,26 +755,28 @@ void Model_AttributeSelection::selectBody( bool aSelectorOk = true; Selector_Selector aSelector(aSelLab, baseDocumentLab()); try { - aSelectorOk = aSelector.select(aContext, aNewSub, myIsGeometricalSelection); + aSelectorOk = + aSelector.select(aContext, aNewSub, myIsGeometricalSelection); if (aSelectorOk) { aSelectorOk = aSelector.store(aContext); } - } catch(...) { + } catch (...) { aSelectorOk = false; } if (aSelectorOk) { TopoDS_Shape aShape = aSelector.value(); - aSelectorOk = !aShape.IsNull() && aShape.ShapeType() == aNewSub.ShapeType(); + aSelectorOk = + !aShape.IsNull() && aShape.ShapeType() == aNewSub.ShapeType(); } setInvalidIfFalse(aSelLab, aSelectorOk); } } bool Model_AttributeSelection::selectPart( - const ResultPtr& theContext, const std::shared_ptr& theSubShape, - const bool theUpdate) -{ - ResultPartPtr aPart = std::dynamic_pointer_cast(theContext); + const ResultPtr &theContext, + const std::shared_ptr &theSubShape, const bool theUpdate) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(theContext); if (!aPart.get() || !aPart->isActivated()) return true; // postponed naming if (theUpdate) { @@ -745,7 +795,8 @@ bool Model_AttributeSelection::selectPart( // store the shape (in case part is not loaded it should be useful TopoDS_Shape aShape; std::wstring aName = theContext->data()->name(); - if (!theSubShape.get() || theSubShape->isNull()) {// the whole part shape is selected + if (!theSubShape.get() || + theSubShape->isNull()) { // the whole part shape is selected aShape = theContext->shape()->impl(); } else { aShape = theSubShape->impl(); @@ -760,29 +811,31 @@ bool Model_AttributeSelection::selectPart( return !aName.empty(); } -TDF_Label Model_AttributeSelection::selectionLabel() -{ +TDF_Label Model_AttributeSelection::selectionLabel() { return myRef.myRef->Label().FindChild(1); } /// prefixes of the shape names with centers defined -static std::map kCENTERS_PREFIX; +static std::map + kCENTERS_PREFIX; /// returns the map that contains all possible prefixes of the center-names -static std::map& centersMap() -{ +static std::map & +centersMap() { if (kCENTERS_PREFIX.empty()) { // fill map by initial values kCENTERS_PREFIX[ModelAPI_AttributeSelection::CIRCLE_CENTER] = L"__cc"; - kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS] = L"__eff"; - kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS] = L"__esf"; + kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS] = + L"__eff"; + kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS] = + L"__esf"; } return kCENTERS_PREFIX; } -std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefaultName) -{ +std::wstring +Model_AttributeSelection::namingName(const std::wstring &theDefaultName) { std::wstring aName(L""); - if(!this->isInitialized()) + if (!this->isInitialized()) return !theDefaultName.empty() ? theDefaultName : aName; CenterType aCenterType = NOT_CENTER; @@ -793,7 +846,8 @@ std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefault std::wstring aResName; // checking part-owner if (aContFeature->document() != owner()->document()) - aResName += Locale::Convert::toWString(aContFeature->document()->kind()) + L"/"; + aResName += + Locale::Convert::toWString(aContFeature->document()->kind()) + L"/"; // selection of a full feature if (aContFeature.get()) { return aResName + kWHOLE_FEATURE + aContFeature->name(); @@ -815,9 +869,9 @@ std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefault if (aCont->groupName() == ModelAPI_ResultPart::group()) { ResultPartPtr aPart = std::dynamic_pointer_cast(aCont); int anIndex; - std::wstring aResult = aSubSh.get() ? - aPart->data()->name() + L"/" + aPart->nameInPart(aSubSh, anIndex) - : aPart->data()->name(); + std::wstring aResult = aSubSh.get() ? aPart->data()->name() + L"/" + + aPart->nameInPart(aSubSh, anIndex) + : aPart->data()->name(); if (aCenterType != NOT_CENTER) aResult += centersMap()[aCenterType]; return aResult; @@ -825,7 +879,8 @@ std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefault // whole infinitive construction if (aCont->groupName() == ModelAPI_ResultConstruction::group()) { - ResultConstructionPtr aConstr = std::dynamic_pointer_cast(aCont); + ResultConstructionPtr aConstr = + std::dynamic_pointer_cast(aCont); if (aConstr->isInfinite()) { return contextName(aCont); } @@ -833,7 +888,8 @@ std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefault Selector_Selector aSelector(aSelLab, baseDocumentLab()); std::wstring aResult; - if (aCont->shape().get() && aSelector.restore(aCont->shape()->impl())) + if (aCont->shape().get() && + aSelector.restore(aCont->shape()->impl())) aResult = aSelector.name(this); if (aCenterType != NOT_CENTER) { aResult += centersMap()[aCenterType]; @@ -841,12 +897,13 @@ std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefault return aResult; } -// returns the center type and modifies the shape name if this name is center-name -static ModelAPI_AttributeSelection::CenterType centerTypeByName(std::wstring& theShapeName) -{ - std::map::iterator aPrefixIter = - centersMap().begin(); - for(; aPrefixIter != centersMap().end(); aPrefixIter++) { +// returns the center type and modifies the shape name if this name is +// center-name +static ModelAPI_AttributeSelection::CenterType +centerTypeByName(std::wstring &theShapeName) { + std::map::iterator + aPrefixIter = centersMap().begin(); + for (; aPrefixIter != centersMap().end(); aPrefixIter++) { std::size_t aFound = theShapeName.find(aPrefixIter->second); if (aFound != std::wstring::npos && aFound == theShapeName.size() - aPrefixIter->second.size()) { @@ -859,28 +916,33 @@ static ModelAPI_AttributeSelection::CenterType centerTypeByName(std::wstring& th // type ::= COMP | COMS | SOLD | SHEL | FACE | WIRE | EDGE | VERT void Model_AttributeSelection::selectSubShape( - const std::string& theType, const std::wstring& theSubShapeName) -{ - if(theSubShapeName.empty() || theType.empty()) return; + const std::string &theType, const std::wstring &theSubShapeName) { + if (theSubShapeName.empty() || theType.empty()) + return; std::wstring aSubShapeName = theSubShapeName; - CenterType aCenterType = theType[0] == 'v' || theType[0] == 'V' ? // only for vertex-type - centerTypeByName(aSubShapeName) : NOT_CENTER; - std::string aType = aCenterType == NOT_CENTER ? theType : "EDGE"; // search for edge now + CenterType aCenterType = theType[0] == 'v' || theType[0] == 'V' + ? // only for vertex-type + centerTypeByName(aSubShapeName) + : NOT_CENTER; + std::string aType = + aCenterType == NOT_CENTER ? theType : "EDGE"; // search for edge now static const GeomShapePtr anEmptyShape; - // first iteration is selection by name without center prefix, second - in case of problem, - // try with initial name - for(int aUseCenter = 1; aUseCenter >= 0; aUseCenter--) { + // first iteration is selection by name without center prefix, second - in + // case of problem, try with initial name + for (int aUseCenter = 1; aUseCenter >= 0; aUseCenter--) { if (aUseCenter == 0 && aCenterType != NOT_CENTER) { aSubShapeName = theSubShapeName; aCenterType = NOT_CENTER; aType = theType; - } else if (aUseCenter != 1) continue; - TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(GeomAPI_Shape::shapeTypeByStr(aType)); + } else if (aUseCenter != 1) + continue; + TopAbs_ShapeEnum aShapeType = + TopAbs_ShapeEnum(GeomAPI_Shape::shapeTypeByStr(aType)); std::shared_ptr aDoc = - std::dynamic_pointer_cast(owner()->document()); + std::dynamic_pointer_cast(owner()->document()); // check this is Part-name: 2 delimiters in the name std::size_t aPartEnd = aSubShapeName.find(L'/'); if (aPartEnd != std::wstring::npos) { @@ -889,12 +951,12 @@ void Model_AttributeSelection::selectSubShape( if (aPartName == Locale::Convert::toWString(aRootDoc->kind())) { aDoc = std::dynamic_pointer_cast(aRootDoc); aSubShapeName = aSubShapeName.substr(aPartEnd + 1); - } - else { - ObjectPtr aFound = - owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName); + } else { + ObjectPtr aFound = owner()->document()->objectByName( + ModelAPI_ResultPart::group(), aPartName); if (aFound.get()) { // found such part, so asking it for the name - ResultPartPtr aPart = std::dynamic_pointer_cast(aFound); + ResultPartPtr aPart = + std::dynamic_pointer_cast(aFound); std::wstring aNameInPart = aSubShapeName.substr(aPartEnd + 1); if (aNameInPart.empty()) { // whole part setValue(aPart, anEmptyShape); @@ -902,31 +964,36 @@ void Model_AttributeSelection::selectSubShape( } int anIndex; std::shared_ptr aSelected = - aPart->shapeInPart(aNameInPart, aType, anIndex); + aPart->shapeInPart(aNameInPart, aType, anIndex); if (aSelected.get()) { if (aCenterType != NOT_CENTER) { if (!aSelected->isEdge()) continue; - std::shared_ptr aSelectedEdge(new GeomAPI_Edge(aSelected)); + std::shared_ptr aSelectedEdge( + new GeomAPI_Edge(aSelected)); setValueCenter(aPart, aSelectedEdge, aCenterType); - } - else + } else setValue(aPart, aSelected); TDataStd_Integer::Set(selectionLabel(), anIndex); return; } - } else { // for the ImportResult feature Objects widget this may be a result in other part - // result may be hidden (like, tranlsatiomn of part) in PartSet, so iterate Part-features + } else { // for the ImportResult feature Objects widget this may be a + // result in other part + // result may be hidden (like, tranlsatiomn of part) in PartSet, so + // iterate Part-features int aNum = aRootDoc->size(ModelAPI_Feature::group()); for (int a = 0; a < aNum; a++) { FeaturePtr aFeat = std::dynamic_pointer_cast( - aRootDoc->object(ModelAPI_Feature::group(), a)); + aRootDoc->object(ModelAPI_Feature::group(), a)); if (aFeat.get() && aFeat->data() && aFeat->data()->isValid() && - aFeat->getKind() == "Part" && aFeat->results().size()) { + aFeat->getKind() == "Part" && aFeat->results().size()) { ResultPartPtr aPart = - std::dynamic_pointer_cast(aFeat->firstResult()); - if (aPart.get() && aPart->partDoc().get() && aPart->data()->name() == aPartName) { - aDoc = std::dynamic_pointer_cast(aPart->partDoc()); + std::dynamic_pointer_cast( + aFeat->firstResult()); + if (aPart.get() && aPart->partDoc().get() && + aPart->data()->name() == aPartName) { + aDoc = + std::dynamic_pointer_cast(aPart->partDoc()); aSubShapeName = aSubShapeName.substr(aPartEnd + 1); } } @@ -937,9 +1004,10 @@ void Model_AttributeSelection::selectSubShape( // check this is a whole feature context if (aSubShapeName.size() > kWHOLE_FEATURE.size() && - aSubShapeName.substr(0, kWHOLE_FEATURE.size()) == kWHOLE_FEATURE) { + aSubShapeName.substr(0, kWHOLE_FEATURE.size()) == kWHOLE_FEATURE) { std::wstring aFeatureName = aSubShapeName.substr(kWHOLE_FEATURE.size()); - ObjectPtr anObj = aDoc->objectByName(ModelAPI_Feature::group(), aFeatureName); + ObjectPtr anObj = + aDoc->objectByName(ModelAPI_Feature::group(), aFeatureName); if (anObj.get()) { setValue(anObj, anEmptyShape); return; @@ -948,11 +1016,13 @@ void Model_AttributeSelection::selectSubShape( // the whole result selection check if (aSubShapeName.find(L'/') == std::wstring::npos) { - ObjectPtr aRes = aDoc->objectByName(ModelAPI_ResultConstruction::group(), aSubShapeName); + ObjectPtr aRes = aDoc->objectByName(ModelAPI_ResultConstruction::group(), + aSubShapeName); if (!aRes.get()) { aRes = aDoc->objectByName(ModelAPI_ResultBody::group(), aSubShapeName); if (!aRes.get()) - aRes = aDoc->objectByName(ModelAPI_ResultGroup::group(), aSubShapeName); + aRes = + aDoc->objectByName(ModelAPI_ResultGroup::group(), aSubShapeName); } if (aRes.get()) { setValue(aRes, anEmptyShape); @@ -963,16 +1033,18 @@ void Model_AttributeSelection::selectSubShape( Selector_Selector aSelector(selectionLabel(), baseDocumentLab()); myRestoreDocument = aDoc; TDF_Label aContextLabel = aSelector.restoreByName( - aSubShapeName, aShapeType, this, myIsGeometricalSelection); + aSubShapeName, aShapeType, this, myIsGeometricalSelection); myRestoreDocument.reset(); if (!aContextLabel.IsNull()) { - ResultPtr aContext = aDoc->resultByLab(aContextLabel); // any label for document access + ResultPtr aContext = + aDoc->resultByLab(aContextLabel); // any label for document access if (aContext.get() && aContext->shape().get()) { TopoDS_Shape aContextShape = aContext->shape()->impl(); if (aSelector.solve(aContextShape)) { TopoDS_Shape aSelectorShape = aSelector.value(); GeomShapePtr aShapeToBeSelected(new GeomAPI_Shape); - aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelectorShape)); + aShapeToBeSelected->setImpl( + new TopoDS_Shape(aSelectorShape)); // make the context result the latest existing aContext = newestContext(aContext, aShapeToBeSelected); if (myIsGeometricalSelection || aCenterType == NOT_CENTER) { @@ -989,7 +1061,8 @@ void Model_AttributeSelection::selectSubShape( } else { // re-select center of circle/arc by context and value if (!aShapeToBeSelected->isEdge()) continue; - std::shared_ptr aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected)); + std::shared_ptr aSelectedEdge( + new GeomAPI_Edge(aShapeToBeSelected)); setValueCenter(aContext, aSelectedEdge, aCenterType); } return; @@ -1003,9 +1076,8 @@ void Model_AttributeSelection::selectSubShape( reset(); } -void Model_AttributeSelection::selectSubShape(const std::string& theType, - const GeomPointPtr& thePoint) -{ +void Model_AttributeSelection::selectSubShape(const std::string &theType, + const GeomPointPtr &thePoint) { if (theType.empty() || !thePoint) return; @@ -1023,7 +1095,8 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType, aType = GeomAPI_Shape::shapeTypeByStr(theType.substr(0, aUndersporePos)); if (aType != GeomAPI_Shape::SHAPE) { - for (std::string::const_iterator aChar = theType.begin() + aUndersporePos + 1; + for (std::string::const_iterator aChar = + theType.begin() + aUndersporePos + 1; aChar != theType.end(); ++aChar) { if (std::isdigit(*aChar)) aSelectionIndex = aSelectionIndex * 10 + (*aChar - '0'); @@ -1042,23 +1115,26 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType, SessionPtr aSession = ModelAPI_Session::get(); std::list aFeatures = aSession->moduleDocument()->allFeatures(); if (anOwner->getKind() == "ImportResult") { - // special case: feature "ImportResult" refers to the results from another parts, - // thus, it is necessary to go through the features of these parts too. + // special case: feature "ImportResult" refers to the results from another + // parts, thus, it is necessary to go through the features of these parts + // too. std::list aPartSetFeatures = aFeatures; aFeatures.clear(); for (std::list::iterator it = aPartSetFeatures.begin(); it != aPartSetFeatures.end(); ++it) { aFeatures.push_back(*it); if ((*it)->firstResult()->groupName() == ModelAPI_ResultPart::group()) { - ResultPartPtr aPart = std::dynamic_pointer_cast((*it)->firstResult()); + ResultPartPtr aPart = std::dynamic_pointer_cast( + (*it)->firstResult()); std::list aPartFeatures = aPart->partDoc()->allFeatures(); - aFeatures.insert(aFeatures.end(), aPartFeatures.begin(), aPartFeatures.end()); + aFeatures.insert(aFeatures.end(), aPartFeatures.begin(), + aPartFeatures.end()); } } - } - else if (aSession->moduleDocument() != owner()->document()) { + } else if (aSession->moduleDocument() != owner()->document()) { std::list aPartFeatures = owner()->document()->allFeatures(); - aFeatures.insert(aFeatures.end(), aPartFeatures.begin(), aPartFeatures.end()); + aFeatures.insert(aFeatures.end(), aPartFeatures.begin(), + aPartFeatures.end()); } // Process results of all features from the last to the first // to find appropriate sub-shape @@ -1068,9 +1144,10 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType, if (aParents.find(*anIt) != aParents.end()) continue; // check the feature is a part of composite feature (like sketch elements), - // then do not process it, it will be processed in scope of composite feature + // then do not process it, it will be processed in scope of composite + // feature bool isSubOfComposite = false; - const std::set& aRefs = (*anIt)->data()->refsToMe(); + const std::set &aRefs = (*anIt)->data()->refsToMe(); for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end() && !isSubOfComposite; ++aRefIt) { FeaturePtr aFeature = ModelAPI_Feature::feature((*aRefIt)->owner()); @@ -1082,17 +1159,22 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType, continue; // process results of the current feature to find appropriate sub-shape - if (ModelGeomAlgo_Shape::findSubshapeByPoint(*anIt, thePoint, aType, anAppropriate)) { - std::list::iterator anApIt = anAppropriate.begin(); - for (; aSelectionIndex > 0 && anApIt != anAppropriate.end(); --aSelectionIndex) + if (ModelGeomAlgo_Shape::findSubshapeByPoint(*anIt, thePoint, aType, + anAppropriate)) { + std::list::iterator anApIt = + anAppropriate.begin(); + for (; aSelectionIndex > 0 && anApIt != anAppropriate.end(); + --aSelectionIndex) ++anApIt; // skip this shape, because one of the previous is selected if (anApIt != anAppropriate.end()) { - if (anApIt->myCenterType == (int)ModelAPI_AttributeSelection::NOT_CENTER) + if (anApIt->myCenterType == + (int)ModelAPI_AttributeSelection::NOT_CENTER) setValue(anApIt->myResult, anApIt->mySubshape); else - setValueCenter(anApIt->myResult, anApIt->mySubshape->edge(), - (ModelAPI_AttributeSelection::CenterType)anApIt->myCenterType); + setValueCenter( + anApIt->myResult, anApIt->mySubshape->edge(), + (ModelAPI_AttributeSelection::CenterType)anApIt->myCenterType); return; } } @@ -1103,16 +1185,17 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType, reset(); } -void Model_AttributeSelection::selectSubShape(const std::string& theType, - const std::wstring& theContextName, const int theIndex) -{ +void Model_AttributeSelection::selectSubShape( + const std::string &theType, const std::wstring &theContextName, + const int theIndex) { // selection of context by name selectSubShape(theType, theContextName); ResultPtr aContext = context(); if (aContext.get()) { GeomShapePtr aContShape = aContext->shape(); if (aContShape.get()) { - GeomAlgoAPI_NExplode aNExp(aContShape, GeomAPI_Shape::shapeTypeByStr(theType)); + GeomAlgoAPI_NExplode aNExp(aContShape, + GeomAPI_Shape::shapeTypeByStr(theType)); GeomShapePtr aValue = aNExp.shape(theIndex); if (aValue.get()) setValue(aContext, aValue); @@ -1120,25 +1203,24 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType, } } -void Model_AttributeSelection::setId(int theID) -{ +void Model_AttributeSelection::setId(int theID) { std::shared_ptr aSelection; ResultPtr aContextRes = context(); // support for compsolids: - while(ModelAPI_Tools::bodyOwner(aContextRes).get()) { + while (ModelAPI_Tools::bodyOwner(aContextRes).get()) { aContextRes = ModelAPI_Tools::bodyOwner(aContextRes); } std::shared_ptr aContext = aContextRes->shape(); TopoDS_Shape aMainShape = aContext->impl(); // searching for the latest main shape - if (theID > 0 && aContext && !aContext->isNull()) - { + if (theID > 0 && aContext && !aContext->isNull()) { std::shared_ptr aDoc = - std::dynamic_pointer_cast(aContextRes->document()); + std::dynamic_pointer_cast(aContextRes->document()); if (aDoc.get()) { - Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aMainShape, aDoc->generalLabel()); + Handle(TNaming_NamedShape) aNS = + TNaming_Tool::NamedShape(aMainShape, aDoc->generalLabel()); if (!aNS.IsNull()) { aMainShape = TNaming_Tool::CurrentShape(aNS); } @@ -1146,7 +1228,7 @@ void Model_AttributeSelection::setId(int theID) TopTools_IndexedMapOfShape aSubShapesMap; TopExp::MapShapes(aMainShape, aSubShapesMap); - const TopoDS_Shape& aSelShape = aSubShapesMap.FindKey(theID); + const TopoDS_Shape &aSelShape = aSubShapesMap.FindKey(theID); std::shared_ptr aResult(new GeomAPI_Shape); aResult->setImpl(new TopoDS_Shape(aSelShape)); @@ -1157,15 +1239,16 @@ void Model_AttributeSelection::setId(int theID) setValue(aContextRes, aSelection); } -std::wstring Model_AttributeSelection::contextName(const ResultPtr& theContext) const -{ +std::wstring +Model_AttributeSelection::contextName(const ResultPtr &theContext) const { std::wstring aResult; if (owner()->document() != theContext->document()) { if (theContext->document() == ModelAPI_Session::get()->moduleDocument()) { - aResult = Locale::Convert::toWString(theContext->document()->kind()) + L"/"; + aResult = + Locale::Convert::toWString(theContext->document()->kind()) + L"/"; } else { ResultPtr aDocRes = ModelAPI_Tools::findPartResult( - ModelAPI_Session::get()->moduleDocument(), theContext->document()); + ModelAPI_Session::get()->moduleDocument(), theContext->document()); if (aDocRes.get()) { aResult = aDocRes->data()->name() + L"/"; } @@ -1175,19 +1258,20 @@ std::wstring Model_AttributeSelection::contextName(const ResultPtr& theContext) return aResult; } -void Model_AttributeSelection::computeValues( - ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape, - TopTools_ListOfShape& theShapes) -{ +void Model_AttributeSelection::computeValues(ResultPtr theOldContext, + ResultPtr theNewContext, + TopoDS_Shape theValShape, + TopTools_ListOfShape &theShapes) { bool aWasWholeContext = theValShape.IsNull(); if (aWasWholeContext) { theValShape = theOldContext->shape()->impl(); } TopAbs_ShapeEnum aValType = theValShape.ShapeType(); TopoDS_Shape aNewContShape = theNewContext->shape()->impl(); - // if a new value is unchanged in the new context, do nothing: value is correct + // if a new value is unchanged in the new context, do nothing: value is + // correct TopExp_Explorer aSubExp(aNewContShape, aValType); - for(; aSubExp.More(); aSubExp.Next()) { + for (; aSubExp.More(); aSubExp.Next()) { if (aSubExp.Current().IsSame(theValShape)) { theShapes.Append(theValShape); return; @@ -1196,37 +1280,44 @@ void Model_AttributeSelection::computeValues( // if new context becomes compsolid, the resulting sub may be in sub-solids std::list aNewToIterate; aNewToIterate.push_back(theNewContext); - ResultBodyPtr aComp = std::dynamic_pointer_cast(theNewContext); + ResultBodyPtr aComp = + std::dynamic_pointer_cast(theNewContext); if (aComp.get()) { std::list allNewContextSubs; ModelAPI_Tools::allSubs(aComp, allNewContextSubs); std::list::iterator aSub = allNewContextSubs.begin(); - for(; aSub != allNewContextSubs.end(); aSub++) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(*aSub); - if (aBody.get() && aBody->numberOfSubs() == 0) // add only lower level subs + for (; aSub != allNewContextSubs.end(); aSub++) { + ResultBodyPtr aBody = + std::dynamic_pointer_cast(*aSub); + if (aBody.get() && + aBody->numberOfSubs() == 0) // add only lower level subs aNewToIterate.push_back(aBody); } } - // first iteration: searching for the whole shape appearance (like face of the box) - // second iteration: searching for sub-shapes that contain the sub (like vertex on faces) + // first iteration: searching for the whole shape appearance (like face of the + // box) second iteration: searching for sub-shapes that contain the sub (like + // vertex on faces) int aToFindPart = 0; - TopTools_DataMapOfShapeShape aNewToOld; // map from new containers to old containers (with val) + TopTools_DataMapOfShapeShape + aNewToOld; // map from new containers to old containers (with val) TopTools_MapOfShape anOlds; // to know how many olds produced new containers - for(; aToFindPart != 2 && theShapes.IsEmpty(); aToFindPart++) { + for (; aToFindPart != 2 && theShapes.IsEmpty(); aToFindPart++) { std::list::iterator aNewContIter = aNewToIterate.begin(); - for(; aNewContIter != aNewToIterate.end(); aNewContIter++) { + for (; aNewContIter != aNewToIterate.end(); aNewContIter++) { std::shared_ptr aNewData = - std::dynamic_pointer_cast((*aNewContIter)->data()); + std::dynamic_pointer_cast((*aNewContIter)->data()); TDF_Label aNewLab = aNewData->shapeLab(); // searching for produced sub-shape fully on some label TDF_ChildIDIterator aNSIter(aNewLab, TNaming_NamedShape::GetID()); - for(; aNSIter.More(); aNSIter.Next()) { - Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value()); - for(TNaming_Iterator aPairIter(aNS); aPairIter.More(); aPairIter.Next()) { + for (; aNSIter.More(); aNSIter.Next()) { + Handle(TNaming_NamedShape) aNS = + Handle(TNaming_NamedShape)::DownCast(aNSIter.Value()); + for (TNaming_Iterator aPairIter(aNS); aPairIter.More(); + aPairIter.Next()) { if (aToFindPart == 0) { // search shape is fully inside if (aPairIter.OldShape().IsSame(theValShape)) { - if (aPairIter.NewShape().IsNull()) {// value was removed + if (aPairIter.NewShape().IsNull()) { // value was removed theShapes.Clear(); return; } @@ -1234,11 +1325,14 @@ void Model_AttributeSelection::computeValues( if (aPairIter.NewShape().ShapeType() <= aValType) theShapes.Append(aPairIter.NewShape()); } - } else if (!aPairIter.OldShape().IsNull()) { // search shape that contains this sub + } else if (!aPairIter.OldShape() + .IsNull()) { // search shape that contains this sub TopExp_Explorer anExp(aPairIter.OldShape(), aValType); - for(; anExp.More(); anExp.Next()) { - if (anExp.Current().IsSame(theValShape)) { // found a new container - if (aPairIter.NewShape().IsNull()) // skip removed high-level shape + for (; anExp.More(); anExp.Next()) { + if (anExp.Current().IsSame( + theValShape)) { // found a new container + if (aPairIter.NewShape() + .IsNull()) // skip removed high-level shape continue; aNewToOld.Bind(aPairIter.NewShape(), aPairIter.OldShape()); anOlds.Add(aPairIter.OldShape()); @@ -1251,23 +1345,26 @@ void Model_AttributeSelection::computeValues( } } if (aToFindPart == 2 && !aNewToOld.IsEmpty()) { - // also iterate the whole old shape to find not-modified shapes that contain this old + // also iterate the whole old shape to find not-modified shapes that contain + // this old TopoDS_Shape anOldContShape = theOldContext->shape()->impl(); NCollection_Map aNewTypes; // types of shapes to iterate TopTools_DataMapOfShapeShape::Iterator aNewTypeIter(aNewToOld); - for(; aNewTypeIter.More(); aNewTypeIter.Next()) { + for (; aNewTypeIter.More(); aNewTypeIter.Next()) { if (aNewTypeIter.Key().ShapeType() != aValType) aNewTypes.Add(aNewTypeIter.Key().ShapeType()); } NCollection_Map::Iterator aTypeIter(aNewTypes); - for(; aTypeIter.More(); aTypeIter.Next()) { - for(TopExp_Explorer anExp(anOldContShape, aTypeIter.Value()); anExp.More(); anExp.Next()) { + for (; aTypeIter.More(); aTypeIter.Next()) { + for (TopExp_Explorer anExp(anOldContShape, aTypeIter.Value()); + anExp.More(); anExp.Next()) { TopoDS_Shape anOld = anExp.Current(); - if (aNewToOld.IsBound(anOld) || anOlds.Contains(anOld)) // this was modified + if (aNewToOld.IsBound(anOld) || + anOlds.Contains(anOld)) // this was modified continue; TopExp_Explorer aValExp(anOld, aValType); - for(; aValExp.More(); aValExp.Next()) { - const TopoDS_Shape& anUnchanged = aValExp.Current(); + for (; aValExp.More(); aValExp.Next()) { + const TopoDS_Shape &anUnchanged = aValExp.Current(); if (anUnchanged.IsSame(theValShape)) { aNewToOld.Bind(anOld, anOld); anOlds.Add(anOld); @@ -1278,10 +1375,13 @@ void Model_AttributeSelection::computeValues( } // map of sub-shapes -> number of occurrences of these shapes in containers - NCollection_DataMap aSubs; + NCollection_DataMap + aSubs; TopTools_DataMapOfShapeShape::Iterator aContIter(aNewToOld); - for(; aContIter.More(); aContIter.Next()) { - for(aSubExp.Init(aContIter.Key(), aValType); aSubExp.More(); aSubExp.Next()) { + for (; aContIter.More(); aContIter.Next()) { + for (aSubExp.Init(aContIter.Key(), aValType); aSubExp.More(); + aSubExp.Next()) { if (!aSubs.IsBound(aSubExp.Current())) { aSubs.Bind(aSubExp.Current(), TopTools_MapOfShape()); } @@ -1289,11 +1389,12 @@ void Model_AttributeSelection::computeValues( aSubs.ChangeFind(aSubExp.Current()).Add(aContIter.Value()); } } - // if sub is appeared same times in containers as the number of old shapes that contain it + // if sub is appeared same times in containers as the number of old shapes + // that contain it int aCountInOld = anOlds.Size(); - NCollection_DataMap::Iterator - aSubsIter(aSubs); - for(; aSubsIter.More(); aSubsIter.Next()) { + NCollection_DataMap::Iterator aSubsIter(aSubs); + for (; aSubsIter.More(); aSubsIter.Next()) { if (aSubsIter.Value().Size() == aCountInOld) { TopoDS_Shape anOld = aSubsIter.Key(); // check this exists in the new shape @@ -1310,8 +1411,10 @@ void Model_AttributeSelection::computeValues( if (theShapes.IsEmpty()) { // nothing was changed if (aWasWholeContext) theShapes.Append(TopoDS_Shape()); - else { // if theValShape exists in new context, add it without changes, otherwise - nothing - for (TopExp_Explorer aNew(aNewContShape, aValType); aNew.More(); aNew.Next()){ + else { // if theValShape exists in new context, add it without changes, + // otherwise - nothing + for (TopExp_Explorer aNew(aNewContShape, aValType); aNew.More(); + aNew.Next()) { if (aNew.Current().IsSame(theValShape)) { theShapes.Append(theValShape); break; @@ -1326,15 +1429,19 @@ void Model_AttributeSelection::computeValues( anAncType = TopAbs_EDGE; TopoDS_Shape anOldContext = theOldContext->shape()->impl(); TopTools_IndexedDataMapOfShapeListOfShape anOldMap; - TopExp::MapShapesAndUniqueAncestors(anOldContext, aValType, anAncType, anOldMap); + TopExp::MapShapesAndUniqueAncestors(anOldContext, aValType, anAncType, + anOldMap); if (anOldMap.Contains(theValShape)) { int aNumInOld = anOldMap.FindFromKey(theValShape).Extent(); TopTools_IndexedDataMapOfShapeListOfShape aNewMap; - TopExp::MapShapesAndUniqueAncestors(aNewContShape, aValType, anAncType, aNewMap); + TopExp::MapShapesAndUniqueAncestors(aNewContShape, aValType, anAncType, + aNewMap); TopTools_ListOfShape aNewResults; - for(TopTools_ListOfShape::Iterator aNewSubs(theShapes); aNewSubs.More(); aNewSubs.Next()) { + for (TopTools_ListOfShape::Iterator aNewSubs(theShapes); aNewSubs.More(); + aNewSubs.Next()) { TopoDS_Shape aCand = aNewSubs.Value(); - if (aNewMap.Contains(aCand) && aNewMap.FindFromKey(aCand).Extent() == aNumInOld) + if (aNewMap.Contains(aCand) && + aNewMap.FindFromKey(aCand).Extent() == aNumInOld) aNewResults.Append(aCand); } if (!aNewResults.IsEmpty() && aNewResults.Size() < theShapes.Size()) @@ -1343,12 +1450,10 @@ void Model_AttributeSelection::computeValues( } } - void Model_AttributeSelection::concealedFeature( - const FeaturePtr theFeature, const FeaturePtr theStop, const bool theCheckCopy, - std::list& theConcealers, const ResultPtr theResultOfFeature, - const bool theCheckWholeFeature) -{ + const FeaturePtr theFeature, const FeaturePtr theStop, + const bool theCheckCopy, std::list &theConcealers, + const ResultPtr theResultOfFeature, const bool theCheckWholeFeature) { std::set alreadyProcessed; alreadyProcessed.insert(theFeature); if (theStop.get()) @@ -1359,10 +1464,10 @@ void Model_AttributeSelection::concealedFeature( ResultPtr aRoot = ModelAPI_Tools::bodyOwner(theResultOfFeature, true); aRootRes.push_back(aRoot ? aRoot : theResultOfFeature); } else { // all results of a feature - aRootRes = theFeature->results(); + aRootRes = theFeature->results(); } std::list::const_iterator aRootIter = aRootRes.cbegin(); - for(; aRootIter != aRootRes.cend(); aRootIter++) { + for (; aRootIter != aRootRes.cend(); aRootIter++) { std::list allRes; allRes.push_back((*aRootIter)->data()); ResultBodyPtr aRootBody = ModelAPI_Tools::bodyOwner(*aRootIter, true); @@ -1371,35 +1476,44 @@ void Model_AttributeSelection::concealedFeature( if (aRootBody.get()) { std::list allSub; ModelAPI_Tools::allSubs(aRootBody, allSub); - for(std::list::iterator anIt = allSub.begin(); anIt != allSub.end(); anIt++) + for (std::list::iterator anIt = allSub.begin(); + anIt != allSub.end(); anIt++) allRes.push_back((*anIt)->data()); } if (theCheckWholeFeature) allRes.push_back(theFeature->data()); - for(std::list::iterator aRIter = allRes.begin(); aRIter != allRes.end(); aRIter++) { - const std::set& aRefs = (*aRIter)->refsToMe(); + for (std::list::iterator aRIter = allRes.begin(); + aRIter != allRes.end(); aRIter++) { + const std::set &aRefs = (*aRIter)->refsToMe(); std::set::const_iterator aRef = aRefs.cbegin(); for (; aRef != aRefs.cend(); aRef++) { if (!aRef->get() || !(*aRef)->owner().get()) continue; // concealed attribute only - FeaturePtr aRefFeat = std::dynamic_pointer_cast((*aRef)->owner()); - if (alreadyProcessed.find(aRefFeat) != alreadyProcessed.end()) // optimization + FeaturePtr aRefFeat = + std::dynamic_pointer_cast((*aRef)->owner()); + if (alreadyProcessed.find(aRefFeat) != + alreadyProcessed.end()) // optimization continue; alreadyProcessed.insert(aRefFeat); - if (ModelAPI_Session::get()->validators()->isConcealed(aRefFeat->getKind(), (*aRef)->id()) - || (theCheckCopy && - std::dynamic_pointer_cast(aRefFeat).get())) - { - // for extrusion cut in python script the nested sketch reference may be concealed before - // it is nested, so, check this composite feature is valid - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); + if (ModelAPI_Session::get()->validators()->isConcealed( + aRefFeat->getKind(), (*aRef)->id()) || + (theCheckCopy && + std::dynamic_pointer_cast(aRefFeat) + .get())) { + // for extrusion cut in python script the nested sketch reference may + // be concealed before it is nested, so, check this composite feature + // is valid + static ModelAPI_ValidatorsFactory *aFactory = + ModelAPI_Session::get()->validators(); // need to be validated to update the "Apply" state if not previewed if (aFactory->validate(aRefFeat)) { if (theStop.get()) { std::shared_ptr aDoc = - std::dynamic_pointer_cast(theStop->document()); - if (!aDoc->isLaterByDep(theStop, aRefFeat)) // skip feature later than stop + std::dynamic_pointer_cast( + theStop->document()); + if (!aDoc->isLaterByDep(theStop, + aRefFeat)) // skip feature later than stop continue; } theConcealers.push_back(aRefFeat); @@ -1410,53 +1524,62 @@ void Model_AttributeSelection::concealedFeature( } } -bool Model_AttributeSelection::searchNewContext(std::shared_ptr theDoc, - const TopoDS_Shape theContShape, ResultPtr theContext, TopoDS_Shape theValShape, - TDF_Label theAccessLabel, - std::list& theResults, TopTools_ListOfShape& theValShapes) -{ - std::list aResults; // keep order, new context, null if deleted +bool Model_AttributeSelection::searchNewContext( + std::shared_ptr theDoc, const TopoDS_Shape theContShape, + ResultPtr theContext, TopoDS_Shape theValShape, TDF_Label theAccessLabel, + std::list &theResults, TopTools_ListOfShape &theValShapes) { + std::list aResults; // keep order, new context, null if deleted std::set aResultsSet; // to avoid duplicates - // iterate context and shape, but also if it is sub-shape of main shape, check also it + // iterate context and shape, but also if it is sub-shape of main shape, check + // also it TopTools_ListOfShape aContextList; aContextList.Append(theContShape); if (theContext.get()) { ResultPtr aComposite = ModelAPI_Tools::bodyOwner(theContext); - if (aComposite.get() && aComposite->shape().get() && !aComposite->shape()->isNull()) + if (aComposite.get() && aComposite->shape().get() && + !aComposite->shape()->isNull()) aContextList.Append(aComposite->shape()->impl()); } - for(TopTools_ListOfShape::Iterator aContIter(aContextList); aContIter.More(); aContIter.Next()) { - TNaming_SameShapeIterator aModifIter(aContIter.ChangeValue(), theAccessLabel); - for(; aModifIter.More(); aModifIter.Next()) { + for (TopTools_ListOfShape::Iterator aContIter(aContextList); aContIter.More(); + aContIter.Next()) { + TNaming_SameShapeIterator aModifIter(aContIter.ChangeValue(), + theAccessLabel); + for (; aModifIter.More(); aModifIter.Next()) { TDF_Label anObjLab = aModifIter.Label().Father(); - ResultPtr aModifierObj = std::dynamic_pointer_cast - (theDoc->objects()->object(anObjLab)); + ResultPtr aModifierObj = std::dynamic_pointer_cast( + theDoc->objects()->object(anObjLab)); if (!aModifierObj.get()) { - // #2241: shape may be sub-element of new object, not main (shell created from faces) + // #2241: shape may be sub-element of new object, not main (shell + // created from faces) if (!anObjLab.IsRoot()) - aModifierObj = std::dynamic_pointer_cast - (theDoc->objects()->object(anObjLab.Father())); + aModifierObj = std::dynamic_pointer_cast( + theDoc->objects()->object(anObjLab.Father())); if (!aModifierObj.get()) continue; } FeaturePtr aModifierFeat = theDoc->feature(aModifierObj); if (!aModifierFeat.get()) continue; - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); - if (aModifierFeat == aThisFeature || !theDoc->isLaterByDep(aThisFeature, aModifierFeat)) - continue; // the modifier feature is later than this, so, should not be used + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); + if (aModifierFeat == aThisFeature || + !theDoc->isLaterByDep(aThisFeature, aModifierFeat)) + continue; // the modifier feature is later than this, so, should not be + // used FeaturePtr aCurrentModifierFeat = theDoc->feature(theContext); if (aCurrentModifierFeat == aModifierFeat || - !theDoc->isLaterByDep(aModifierFeat, aCurrentModifierFeat)) + !theDoc->isLaterByDep(aModifierFeat, aCurrentModifierFeat)) continue; // the current modifier is later than the found, so, useless Handle(TNaming_NamedShape) aNewNS; aModifIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNewNS); - if (aNewNS->Evolution() == TNaming_MODIFY || aNewNS->Evolution() == TNaming_GENERATED) { + if (aNewNS->Evolution() == TNaming_MODIFY || + aNewNS->Evolution() == TNaming_GENERATED) { if (aResultsSet.find(aModifierObj) == aResultsSet.end()) { aResultsSet.insert(aModifierObj); aResults.push_back(aModifierObj); } - } else if (aNewNS->Evolution() == TNaming_DELETE) { // a shape was deleted => result is empty + } else if (aNewNS->Evolution() == + TNaming_DELETE) { // a shape was deleted => result is empty aResults.push_back(ResultPtr()); } else { // not-processed modification => don't support it continue; @@ -1464,38 +1587,46 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr } } // if there exist context composite and sub-result(s), leave only sub(s) - for(std::list::iterator aResIter = aResults.begin(); aResIter != aResults.end();) { + for (std::list::iterator aResIter = aResults.begin(); + aResIter != aResults.end();) { ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter); - for(; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent)) + for (; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent)) if (aResultsSet.count(aParent)) break; if (aParent.get()) { aResultsSet.erase(aParent); - for(std::list::iterator anIt = aResults.begin(); anIt != aResults.end(); anIt++) { + for (std::list::iterator anIt = aResults.begin(); + anIt != aResults.end(); anIt++) { if (*anIt == aParent) { aResults.erase(anIt); aResIter = aResults.begin(); // erase from set, so, restart iteration break; } } - } else aResIter++; + } else + aResIter++; } bool aStaySame = false; if (aResults.empty()) { - // check the context become concealed by operation which is earlier than this selection - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); + // check the context become concealed by operation which is earlier than + // this selection + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); FeaturePtr aContextOwner = theDoc->feature(theContext); std::list aConcealers; - concealedFeature(aContextOwner, aThisFeature, false, aConcealers, theContext); + concealedFeature(aContextOwner, aThisFeature, false, aConcealers, + theContext); std::list::iterator aConcealer = aConcealers.begin(); - for(; aConcealer != aConcealers.end(); aConcealer++) { + for (; aConcealer != aConcealers.end(); aConcealer++) { std::list aRefResults; ModelAPI_Tools::allResults(*aConcealer, aRefResults); std::list::iterator aRefIter = aRefResults.begin(); - for(; aRefIter != aRefResults.end(); aRefIter++) { - ResultBodyPtr aRefBody = std::dynamic_pointer_cast(*aRefIter); - if (!aRefBody.get() || aRefBody->numberOfSubs() != 0) // iterate only leafs + for (; aRefIter != aRefResults.end(); aRefIter++) { + ResultBodyPtr aRefBody = + std::dynamic_pointer_cast(*aRefIter); + if (!aRefBody.get() || + aRefBody->numberOfSubs() != 0) // iterate only leafs continue; GeomShapePtr aRefShape = aRefBody->shape(); if (!aRefShape.get() || aRefShape->isNull()) @@ -1506,7 +1637,8 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr } } if (aResults.empty()) - return true; // feature conceals result, return true, so the context will be removed + return true; // feature conceals result, return true, so the context + // will be removed } aStaySame = aResults.empty(); } @@ -1514,31 +1646,37 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr // check there are copies before the new results, so, make a copy std::list aCopyContext; std::list aCopyVals; - // features between the new and the old: check the "Move" interface to get a copy + // features between the new and the old: check the "Move" interface to get a + // copy FeaturePtr aRootOwner = theDoc->feature(theContext); FeaturePtr anOwner = ModelAPI_Tools::compositeOwner(aRootOwner); - for(; anOwner.get(); anOwner = ModelAPI_Tools::compositeOwner(anOwner)) + for (; anOwner.get(); anOwner = ModelAPI_Tools::compositeOwner(anOwner)) aRootOwner = anOwner; - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); - // iterate all results to find a "Copy" features between the new and one and to add the - // copy-results also to results if this attribute refers to the copied shape + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); + // iterate all results to find a "Copy" features between the new and one and + // to add the copy-results also to results if this attribute refers to the + // copied shape int anIndex = kUNDEFINED_FEATURE_INDEX; - for(FeaturePtr aFeat = theDoc->objects()->nextFeature(aRootOwner, anIndex); aFeat.get() && - aFeat != aThisFeature; aFeat = theDoc->objects()->nextFeature(aFeat, anIndex)) { + for (FeaturePtr aFeat = theDoc->objects()->nextFeature(aRootOwner, anIndex); + aFeat.get() && aFeat != aThisFeature; + aFeat = theDoc->objects()->nextFeature(aFeat, anIndex)) { std::shared_ptr aCopier = - std::dynamic_pointer_cast(aFeat); + std::dynamic_pointer_cast(aFeat); if (aCopier.get()) { GeomShapePtr aValShape(new GeomAPI_Shape); aValShape->setImpl(new TopoDS_Shape( - theValShape.IsNull() ? theContShape : theValShape)); + theValShape.IsNull() ? theContShape : theValShape)); aCopier->getCopies(theContext, aValShape, aCopyContext, aCopyVals); } } // check for the further modifications of the copy contexts and values std::list::iterator aCopyContIter = aCopyContext.begin(); std::list::iterator aCopyValIter = aCopyVals.begin(); - for(; aCopyContIter != aCopyContext.end(); aCopyContIter++, aCopyValIter++) { - ResultPtr aNewCont = std::dynamic_pointer_cast(*aCopyContIter); + for (; aCopyContIter != aCopyContext.end(); + aCopyContIter++, aCopyValIter++) { + ResultPtr aNewCont = + std::dynamic_pointer_cast(*aCopyContIter); TopoDS_Shape aNewContShape = aNewCont->shape()->impl(); GeomShapePtr aNewVal = *aCopyValIter; TopoDS_Shape aNewValShape; @@ -1547,11 +1685,11 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr std::list aNewRes; TopTools_ListOfShape aNewUpdatedVal; if (searchNewContext(theDoc, aNewContShape, aNewCont, aNewValShape, - theAccessLabel, aNewRes, aNewUpdatedVal)) { + theAccessLabel, aNewRes, aNewUpdatedVal)) { // append new results instead of the current ones std::list::iterator aNewIter = aNewRes.begin(); TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal); - for(; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { + for (; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { theResults.push_back(*aNewIter); theValShapes.Append(aNewUpdVal.Value()); } @@ -1560,7 +1698,9 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr theValShapes.Append(aNewValShape); } } - if (aStaySame && !theResults.empty()) { // no changes except copy, so, keep the origin as first + if (aStaySame && + !theResults + .empty()) { // no changes except copy, so, keep the origin as first theResults.push_front(theContext); theValShapes.Prepend(theValShape); return true; @@ -1571,7 +1711,7 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr // iterate all results to find further modifications std::list::iterator aResIter = aResults.begin(); - for(aResIter = aResults.begin(); aResIter != aResults.end(); aResIter++) { + for (aResIter = aResults.begin(); aResIter != aResults.end(); aResIter++) { if (aResIter->get() != NULL) { ResultPtr aNewResObj = *aResIter; // compute new values by two contexts: the old and the new @@ -1579,7 +1719,7 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr computeValues(theContext, aNewResObj, theValShape, aValShapes); TopTools_ListIteratorOfListOfShape aNewVal(aValShapes); - for(; aNewVal.More(); aNewVal.Next()) { + for (; aNewVal.More(); aNewVal.Next()) { std::list aNewRes; TopTools_ListOfShape aNewUpdatedVal; TopoDS_Shape aNewValSh = aNewVal.Value(); @@ -1588,12 +1728,11 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr if (theValShape.IsNull() && aNewContShape.IsSame(aNewValSh)) aNewValSh.Nullify(); if (searchNewContext(theDoc, aNewContShape, aNewResObj, aNewValSh, - theAccessLabel, aNewRes, aNewUpdatedVal)) - { + theAccessLabel, aNewRes, aNewUpdatedVal)) { // append new results instead of the current ones std::list::iterator aNewIter = aNewRes.begin(); TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal); - for(; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { + for (; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { theResults.push_back(*aNewIter); theValShapes.Append(aNewUpdVal.Value()); } @@ -1607,29 +1746,37 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr return true; // theResults must be empty: everything is deleted } -void Model_AttributeSelection::updateInHistory(bool& theRemove) -{ +void Model_AttributeSelection::updateInHistory(bool &theRemove) { static std::shared_ptr anEmptyShape; - ResultPtr aContext = std::dynamic_pointer_cast(myRef.value()); - if (!aContext.get() || (aContext->groupName() != ModelAPI_ResultBody::group() && - aContext->groupName() != ModelAPI_ResultPart::group())) { - // but check the case the whole results are allowed: whole features may be selected + ResultPtr aContext = + std::dynamic_pointer_cast(myRef.value()); + if (!aContext.get() || + (aContext->groupName() != ModelAPI_ResultBody::group() && + aContext->groupName() != ModelAPI_ResultPart::group())) { + // but check the case the whole results are allowed: whole features may be + // selected if (myParent && myParent->isWholeResultAllowed()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(myRef.value()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(myRef.value()); if (aFeature.get()) { - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); std::list aConcealers; bool aCopyPossible = myParent && myParent->isMakeCopy(); - concealedFeature(aFeature, aThisFeature, aCopyPossible, aConcealers, ResultPtr()); + concealedFeature(aFeature, aThisFeature, aCopyPossible, aConcealers, + ResultPtr()); if (aConcealers.empty()) return; // if there are copies, but no direct modification, keep the original bool aKeepOrigin = false; if (aCopyPossible) { std::list::iterator aConcealer = aConcealers.begin(); - for(aKeepOrigin = true; aConcealer != aConcealers.end(); aConcealer++) - if (!std::dynamic_pointer_cast(*aConcealer).get()) { + for (aKeepOrigin = true; aConcealer != aConcealers.end(); + aConcealer++) + if (!std::dynamic_pointer_cast( + *aConcealer) + .get()) { aKeepOrigin = false; break; } @@ -1639,69 +1786,86 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) } bool aChanged = false; std::list::iterator aConcealer = aConcealers.begin(); - for(; aConcealer != aConcealers.end(); aConcealer++) + for (; aConcealer != aConcealers.end(); aConcealer++) if (aChanged) { if (aKeepOrigin || !myParent->isInList(*aConcealer, anEmptyShape)) myParent->append(*aConcealer, anEmptyShape); } else { - if (!myParent->isInList(*aConcealer, anEmptyShape)) {// avoid addition of duplicates + if (!myParent->isInList( + *aConcealer, + anEmptyShape)) { // avoid addition of duplicates setValue(*aConcealer, anEmptyShape); aChanged = true; - } else if (aCopyPossible && *aConcealer == aFeature) {// keep origin in case of copy + } else if (aCopyPossible && + *aConcealer == aFeature) { // keep origin in case of copy aChanged = true; } } if (!aChanged) // remove this theRemove = true; - else if (!aKeepOrigin) // searching further modifications only if current changed + else if (!aKeepOrigin) // searching further modifications only if + // current changed updateInHistory(theRemove); } } - return;// only bodies and parts may be modified later in the history, skip otherwise + return; // only bodies and parts may be modified later in the history, skip + // otherwise } std::shared_ptr aDoc = - std::dynamic_pointer_cast(aContext->document()); - std::shared_ptr aContData = std::dynamic_pointer_cast(aContext->data()); + std::dynamic_pointer_cast(aContext->document()); + std::shared_ptr aContData = + std::dynamic_pointer_cast(aContext->data()); if (!aContData.get() || !aContData->isValid()) return; - TDF_Label aContLab = aContData->shapeLab(); // named shape where the selected context is located + TDF_Label aContLab = + aContData + ->shapeLab(); // named shape where the selected context is located - // checking this may be just a reference to another context (same shape), so use that label + // checking this may be just a reference to another context (same shape), so + // use that label Handle(TNaming_NamedShape) aContNS; Handle(TDF_Reference) aRefAttr; - while(!aContLab.FindAttribute(TNaming_NamedShape::GetID(), aContNS) && - aContLab.FindAttribute(TDF_Reference::GetID(), aRefAttr)) + while (!aContLab.FindAttribute(TNaming_NamedShape::GetID(), aContNS) && + aContLab.FindAttribute(TDF_Reference::GetID(), aRefAttr)) aContLab = aRefAttr->Get(); if (!aContLab.FindAttribute(TNaming_NamedShape::GetID(), aContNS)) { bool aFoundNewContext = true; ResultPtr aNewContext = aContext; - while(aFoundNewContext) { + while (aFoundNewContext) { aFoundNewContext = false; // parts have no shape in result, so, trace references using the Part info if (aNewContext->groupName() == ModelAPI_ResultPart::group()) { - ResultPartPtr aPartContext = std::dynamic_pointer_cast(aNewContext); - if (aPartContext.get()) { // searching for the up to date references to the referenced cont - const std::set& aRefs = aPartContext->data()->refsToMe(); + ResultPartPtr aPartContext = + std::dynamic_pointer_cast(aNewContext); + if (aPartContext.get()) { // searching for the up to date references to + // the referenced cont + const std::set &aRefs = + aPartContext->data()->refsToMe(); std::set::const_iterator aRef = aRefs.begin(); - for(; aRef != aRefs.end(); aRef++) { + for (; aRef != aRefs.end(); aRef++) { // to avoid detection of part changes by local selection only AttributeSelectionPtr aSel = - std::dynamic_pointer_cast(*aRef); + std::dynamic_pointer_cast(*aRef); if (aSel.get() && aSel->value().get() && !aSel->value()->isSame(aSel->context()->shape())) continue; - FeaturePtr aRefFeat = std::dynamic_pointer_cast((*aRef)->owner()); + FeaturePtr aRefFeat = + std::dynamic_pointer_cast((*aRef)->owner()); - if (aRefFeat.get() && aRefFeat != owner() && aRefFeat->firstResult().get()) { + if (aRefFeat.get() && aRefFeat != owner() && + aRefFeat->firstResult().get()) { // check the reference is concealed: #2900 - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); if (!aValidators->isConcealed(aRefFeat->getKind(), (*aRef)->id())) continue; - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); - if (!aDoc->isLaterByDep(aRefFeat, aThisFeature)) { // found better feature + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); + if (!aDoc->isLaterByDep(aRefFeat, + aThisFeature)) { // found better feature aFoundNewContext = true; aNewContext = aRefFeat->firstResult(); } @@ -1715,10 +1879,12 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) } return; } - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); FeaturePtr aCurrentModifierFeat = aDoc->feature(aContext); - // iterate the context shape modifications in order to find a feature that is upper in history - // that this one and is really modifies the referenced result to refer to it + // iterate the context shape modifications in order to find a feature that is + // upper in history that this one and is really modifies the referenced result + // to refer to it ResultPtr aModifierResFound; TNaming_Iterator aPairIter(aContNS); if (!aPairIter.More()) @@ -1735,55 +1901,63 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) std::list aNewContexts; TopTools_ListOfShape aValShapes; - if (searchNewContext(aDoc, aNewCShape, aContext, aValShape, aContLab, aNewContexts, aValShapes)) - { + if (searchNewContext(aDoc, aNewCShape, aContext, aValShape, aContLab, + aNewContexts, aValShapes)) { std::set allContexts(aNewContexts.begin(), aNewContexts.end()); std::set aSkippedContext; // if there exist context composite and sub-result(s), leave only sub(s) std::set::iterator aResIter = allContexts.begin(); - for(; aResIter != allContexts.end(); aResIter++) { + for (; aResIter != allContexts.end(); aResIter++) { ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter); - for(; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent)) + for (; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent)) if (allContexts.count(aParent)) aSkippedContext.insert(aParent); } GeomAPI_Shape::ShapeType aListShapeType = GeomAPI_Shape::SHAPE; if (myParent) { - if (myParent->selectionType() == "VERTEX" || myParent->selectionType() == "Vertices") + if (myParent->selectionType() == "VERTEX" || + myParent->selectionType() == "Vertices") aListShapeType = GeomAPI_Shape::VERTEX; - else if (myParent->selectionType() == "EDGE" || myParent->selectionType() == "Edges") + else if (myParent->selectionType() == "EDGE" || + myParent->selectionType() == "Edges") aListShapeType = GeomAPI_Shape::EDGE; - else if (myParent->selectionType() == "FACE" || myParent->selectionType() == "Faces") + else if (myParent->selectionType() == "FACE" || + myParent->selectionType() == "Faces") aListShapeType = GeomAPI_Shape::FACE; } - // issue #3031: skip topology if there is more convenient shape type presents in the - // same context as a result of this - bool isWholeResult = myParent && myParent->isWholeResultAllowed() && !aSubShape.get(); + // issue #3031: skip topology if there is more convenient shape type + // presents in the same context as a result of this + bool isWholeResult = + myParent && myParent->isWholeResultAllowed() && !aSubShape.get(); GeomAPI_Shape::ShapeType allowedType = GeomAPI_Shape::SHAPE; if (isWholeResult) { std::list::iterator aNewCont = aNewContexts.begin(); TopTools_ListIteratorOfListOfShape aNewValues(aValShapes); - for(; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) { + for (; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) { if (aNewValues.Value().IsNull()) { // only for the whole context - GeomAPI_Shape::ShapeType aShapeType = (*aNewCont)->shape()->shapeType(); + GeomAPI_Shape::ShapeType aShapeType = + (*aNewCont)->shape()->shapeType(); if (allowedType == GeomAPI_Shape::SHAPE) { // just set this one allowedType = aShapeType; } else { GeomAPI_Shape::ShapeType anAllowed = allowedType; - if (anAllowed != aShapeType) { // select the best, nearest to the origin - GeomAPI_Shape::ShapeType anOldShapeType = aContext->shape()->shapeType(); + if (anAllowed != + aShapeType) { // select the best, nearest to the origin + GeomAPI_Shape::ShapeType anOldShapeType = + aContext->shape()->shapeType(); GeomAPI_Shape::ShapeType aDeltaAllowed = - (GeomAPI_Shape::ShapeType)(anOldShapeType - anAllowed); + (GeomAPI_Shape::ShapeType)(anOldShapeType - anAllowed); if (aDeltaAllowed < 0) aDeltaAllowed = (GeomAPI_Shape::ShapeType)(-aDeltaAllowed); GeomAPI_Shape::ShapeType aDeltaThis = - (GeomAPI_Shape::ShapeType)(anOldShapeType - aShapeType); + (GeomAPI_Shape::ShapeType)(anOldShapeType - aShapeType); if (aDeltaThis < 0) aDeltaThis = (GeomAPI_Shape::ShapeType)(-aDeltaThis); - if (aDeltaThis == aDeltaAllowed) { // equal distance to context, select complicated + if (aDeltaThis == aDeltaAllowed) { // equal distance to context, + // select complicated if (anOldShapeType < anAllowed) allowedType = aShapeType; } else if (aDeltaAllowed > aDeltaThis) { // this wins @@ -1798,19 +1972,21 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) std::list::iterator aNewCont = aNewContexts.begin(); TopTools_ListIteratorOfListOfShape aNewValues(aValShapes); bool aFirst = true; // first is set to this, next are appended to parent - for(; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) { + for (; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) { if (aSkippedContext.count(*aNewCont)) continue; if (isWholeResult && aNewValues.Value().IsNull()) if (allowedType != GeomAPI_Shape::SHAPE && (*aNewCont)->shape()->shapeType() != allowedType) - continue; // there is better result exists with the better shape type (issue #3031) + continue; // there is better result exists with the better shape type + // (issue #3031) GeomShapePtr aValueShape; if (!aNewValues.Value().IsNull()) { aValueShape = std::make_shared(); - aValueShape->setImpl(new TopoDS_Shape(aNewValues.Value())); + aValueShape->setImpl( + new TopoDS_Shape(aNewValues.Value())); } // Check that list has the same type of shape selection before adding. GeomAPI_Shape::ShapeType aShapeShapeType = GeomAPI_Shape::SHAPE; @@ -1819,7 +1995,8 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) } else { aShapeShapeType = (*aNewCont)->shape()->shapeType(); } - if (aListShapeType != GeomAPI_Shape::SHAPE && aListShapeType != aShapeShapeType) { + if (aListShapeType != GeomAPI_Shape::SHAPE && + aListShapeType != aShapeShapeType) { // exception is for whole results selected if (!isWholeResult) { continue; @@ -1827,12 +2004,15 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) } ResultPtr aNewContext = *aNewCont; - if (aValueShape.get()) { // #2892 if context is higher level result, search this sub in lower - ResultBodyPtr aBodyContext = std::dynamic_pointer_cast(aNewContext); + if (aValueShape.get()) { // #2892 if context is higher level result, + // search this sub in lower + ResultBodyPtr aBodyContext = + std::dynamic_pointer_cast(aNewContext); if (aBodyContext.get() && aBodyContext->numberOfSubs() != 0) { std::list aLower; ModelAPI_Tools::allSubs(aBodyContext, aLower, true); - for(std::list::iterator aL = aLower.begin(); aL != aLower.end(); aL++) { + for (std::list::iterator aL = aLower.begin(); + aL != aLower.end(); aL++) { GeomShapePtr aLShape = (*aL)->shape(); if (aLShape.get() && !aLShape->isNull()) { if (aLShape->isSubShape(aValueShape, false)) { @@ -1845,15 +2025,18 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) } if (aFirst) { - if (!myParent || !myParent->isInList(aNewContext, aValueShape)) { // avoid duplicates + if (!myParent || + !myParent->isInList(aNewContext, aValueShape)) { // avoid duplicates setValue(aNewContext, aValueShape); aFirst = false; - } else if (aNewContext == aContext && myParent && myParent->isMakeCopy()) { + } else if (aNewContext == aContext && myParent && + myParent->isMakeCopy()) { // this may be exactly the old one, not modified in case of copy aFirst = false; } } else if (myParent) { - if (!myParent->isInList(aNewContext, aValueShape)) // avoid addition of duplicates + if (!myParent->isInList(aNewContext, + aValueShape)) // avoid addition of duplicates myParent->append(aNewContext, aValueShape); } } @@ -1869,29 +2052,33 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) } } -void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent) -{ +void Model_AttributeSelection::setParent( + Model_AttributeSelectionList *theParent) { myParent = theParent; } -std::wstring Model_AttributeSelection::contextName(const TDF_Label theSelectionLab) -{ - std::shared_ptr aDoc = myRestoreDocument.get() ? myRestoreDocument : - std::dynamic_pointer_cast(owner()->document()); +std::wstring +Model_AttributeSelection::contextName(const TDF_Label theSelectionLab) { + std::shared_ptr aDoc = + myRestoreDocument.get() + ? myRestoreDocument + : std::dynamic_pointer_cast(owner()->document()); FeaturePtr aFeatureOwner = aDoc->featureByLab(theSelectionLab); bool aBaseDocumnetUsed = false; if (!aFeatureOwner.get()) { // use module document - aDoc = std::dynamic_pointer_cast(ModelAPI_Session::get()->moduleDocument()); + aDoc = std::dynamic_pointer_cast( + ModelAPI_Session::get()->moduleDocument()); aFeatureOwner = aDoc->featureByLab(theSelectionLab); aBaseDocumnetUsed = true; } if (aFeatureOwner.get()) { - // if it is sub-element of the sketch, the context name is the name of the sketch - // searching also for result - real context + // if it is sub-element of the sketch, the context name is the name of the + // sketch searching also for result - real context ResultPtr aResult; FeaturePtr aComposite = ModelAPI_Tools::compositeOwner(aFeatureOwner); if (aComposite.get() && aComposite->results().size() == 1 && - aComposite->firstResult()->groupName() == ModelAPI_ResultConstruction::group()) { + aComposite->firstResult()->groupName() == + ModelAPI_ResultConstruction::group()) { aFeatureOwner = aComposite; aResult = aFeatureOwner->firstResult(); } else { @@ -1902,17 +2089,19 @@ std::wstring Model_AttributeSelection::contextName(const TDF_Label theSelectionL std::wstring aContextName = aResult->data()->name(); // myLab corresponds to the current time TDF_Label aCurrentLab = selectionLabel(); - while(aCurrentLab.Depth() > 3) + while (aCurrentLab.Depth() > 3) aCurrentLab = aCurrentLab.Father(); int aNumInHistoryNames = - aDoc->numberOfNameInHistory(aResult, aCurrentLab); - while(aNumInHistoryNames > 1) { // add "_" before name the needed number of times + aDoc->numberOfNameInHistory(aResult, aCurrentLab); + while (aNumInHistoryNames > + 1) { // add "_" before name the needed number of times aContextName = L"_" + aContextName; aNumInHistoryNames--; } if (aBaseDocumnetUsed) - aContextName = Locale::Convert::toWString(aDoc->kind()) + L"/" + aContextName; + aContextName = + Locale::Convert::toWString(aDoc->kind()) + L"/" + aContextName; return aContextName; } } @@ -1922,12 +2111,14 @@ std::wstring Model_AttributeSelection::contextName(const TDF_Label theSelectionL /// This method restores by the context and value name the context label and /// sub-label where the value is. Returns true if it is valid. bool Model_AttributeSelection::restoreContext(std::wstring theName, - TDF_Label& theContext, TDF_Label& theValue) -{ + TDF_Label &theContext, + TDF_Label &theValue) { static const GeomShapePtr anEmptyShape; // to store context only std::wstring aName = theName; - std::shared_ptr aDoc = myRestoreDocument.get() ? myRestoreDocument : - std::dynamic_pointer_cast(owner()->document()); + std::shared_ptr aDoc = + myRestoreDocument.get() + ? myRestoreDocument + : std::dynamic_pointer_cast(owner()->document()); // remove the sub-value part if exists std::wstring aSubShapeName = aName; @@ -1936,13 +2127,14 @@ bool Model_AttributeSelection::restoreContext(std::wstring theName, aName = aName.substr(0, n); } - if (aName.empty()) return false; + if (aName.empty()) + return false; bool anUniqueContext = false; ResultPtr aCont = aDoc->findByName(aName, aSubShapeName, anUniqueContext); if (!aCont.get() || !aCont->shape().get() || aCont->shape()->isNull()) { // name in PartSet? aDoc = std::dynamic_pointer_cast( - ModelAPI_Session::get()->moduleDocument()); + ModelAPI_Session::get()->moduleDocument()); if (theName.find(Locale::Convert::toWString(aDoc->kind())) == 0) { // remove the document identifier from name if exists aSubShapeName = theName.substr(aDoc->kind().size() + 1); @@ -1959,31 +2151,42 @@ bool Model_AttributeSelection::restoreContext(std::wstring theName, // searching the sub-shape static const ResultPtr anEmpty; - theValue = aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty); + theValue = + aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty); - // sketch sub-component shape and name is located in separated feature label, try the sub-name - if (theValue.IsNull() && aCont->groupName() == ModelAPI_ResultConstruction::group()) { + // sketch sub-component shape and name is located in separated feature label, + // try the sub-name + if (theValue.IsNull() && + aCont->groupName() == ModelAPI_ResultConstruction::group()) { std::wstring::size_type aSlash = aSubShapeName.rfind(L'/'); if (aSlash != std::wstring::npos) { std::wstring aCompName = aSubShapeName.substr(aSlash + 1); CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aDoc->feature(aCont)); + std::dynamic_pointer_cast( + aDoc->feature(aCont)); if (aComposite.get() && aComposite->numberOfSubs()) { const int aSubNum = aComposite->numberOfSubs(); for (int a = 0; a < aSubNum && theValue.IsNull(); a++) { FeaturePtr aSub = aComposite->subFeature(a); - const std::list >& aResults = aSub->results(); - std::list >::const_iterator aRes = aResults.cbegin(); + const std::list> &aResults = + aSub->results(); + std::list>::const_iterator aRes = + aResults.cbegin(); for (; aRes != aResults.cend() && theValue.IsNull(); aRes++) { if ((*aRes)->data()->name() == aCompName) { - theValue = std::dynamic_pointer_cast((*aRes)->data())->shapeLab(); + theValue = std::dynamic_pointer_cast((*aRes)->data()) + ->shapeLab(); break; - } else { // any sub-label because the sketch line may be renamed, but not sub-vertices - TDF_Label aLab = std::dynamic_pointer_cast((*aRes)->data())->shapeLab(); + } else { // any sub-label because the sketch line may be renamed, + // but not sub-vertices + TDF_Label aLab = + std::dynamic_pointer_cast((*aRes)->data()) + ->shapeLab(); TDF_ChildIDIterator aSubNames(aLab, TDataStd_Name::GetID()); - for(; aSubNames.More(); aSubNames.Next()) { - if (Handle(TDataStd_Name)::DownCast(aSubNames.Value())->Get(). - IsEqual(aCompName.c_str())) { + for (; aSubNames.More(); aSubNames.Next()) { + if (Handle(TDataStd_Name)::DownCast(aSubNames.Value()) + ->Get() + .IsEqual(aCompName.c_str())) { theValue = aSubNames.Value()->Label(); break; } @@ -1996,14 +2199,18 @@ bool Model_AttributeSelection::restoreContext(std::wstring theName, } // Fix for opened study (aDoc->myNamingNames is empty) - if (theValue.IsNull() && aCont->groupName() != ModelAPI_ResultConstruction::group()) { + if (theValue.IsNull() && + aCont->groupName() != ModelAPI_ResultConstruction::group()) { std::wstring::size_type aSlash = aSubShapeName.rfind(L'/'); if (aSlash != std::wstring::npos) { std::wstring aCompName = aSubShapeName.substr(aSlash + 1); - TDF_Label aLab = std::dynamic_pointer_cast(aCont->data())->shapeLab(); - TDF_ChildIDIterator aSubNames (aLab, TDataStd_Name::GetID()); + TDF_Label aLab = + std::dynamic_pointer_cast(aCont->data())->shapeLab(); + TDF_ChildIDIterator aSubNames(aLab, TDataStd_Name::GetID()); for (; aSubNames.More(); aSubNames.Next()) { - if (Handle(TDataStd_Name)::DownCast(aSubNames.Value())->Get().IsEqual(aCompName.c_str())) { + if (Handle(TDataStd_Name)::DownCast(aSubNames.Value()) + ->Get() + .IsEqual(aCompName.c_str())) { theValue = aSubNames.Value()->Label(); aDoc->addNamingName(theValue, aSubShapeName); break; @@ -2018,11 +2225,12 @@ bool Model_AttributeSelection::restoreContext(std::wstring theName, return true; } -bool Model_AttributeSelection::isLater( - const TDF_Label theResult1, const TDF_Label theResult2) const -{ - std::shared_ptr aDoc = myRestoreDocument.get() ? myRestoreDocument : - std::dynamic_pointer_cast(owner()->document()); +bool Model_AttributeSelection::isLater(const TDF_Label theResult1, + const TDF_Label theResult2) const { + std::shared_ptr aDoc = + myRestoreDocument.get() + ? myRestoreDocument + : std::dynamic_pointer_cast(owner()->document()); FeaturePtr aFeat1 = aDoc->featureByLab(theResult1); if (!aFeat1.get()) return false; @@ -2032,27 +2240,26 @@ bool Model_AttributeSelection::isLater( return aDoc->isLaterByDep(aFeat1, aFeat2); } -ResultPtr Model_AttributeSelection::newestContext( - const ResultPtr theCurrent, const GeomShapePtr theValue) -{ +ResultPtr Model_AttributeSelection::newestContext(const ResultPtr theCurrent, + const GeomShapePtr theValue) { ResultPtr aResult = theCurrent; GeomShapePtr aSelectedShape = theValue.get() ? theValue : theCurrent->shape(); std::shared_ptr aDoc = - std::dynamic_pointer_cast(owner()->document()); + std::dynamic_pointer_cast(owner()->document()); bool aFindNewContext = true; while (aFindNewContext && aResult.get()) { aFindNewContext = false; // try to find the last context to find the up to date shape TopoDS_Shape aConShape = aResult->shape()->impl(); if (TNaming_Tool::HasLabel(selectionLabel(), aConShape)) { - Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel()); + Handle(TNaming_NamedShape) aNS = + TNaming_Tool::NamedShape(aConShape, selectionLabel()); if (!aNS.IsNull()) { aNS = TNaming_Tool::CurrentNamedShape(aNS); - if (!aNS.IsNull() - && isLater(selectionLabel(), aNS->Label()) - && isLater(aNS->Label(), - std::dynamic_pointer_cast(aResult->data())->label())) - { + if (!aNS.IsNull() && isLater(selectionLabel(), aNS->Label()) && + isLater(aNS->Label(), + std::dynamic_pointer_cast(aResult->data()) + ->label())) { TDF_Label aLab = aNS->Label(); ResultPtr aRes = aDoc->resultByLab(aLab); if (aRes.get()) { @@ -2067,16 +2274,17 @@ ResultPtr Model_AttributeSelection::newestContext( } // TestFillWireVertex.py - sketch constructions for wire may participate too - //if (aResult->groupName() == ModelAPI_ResultBody::group()) { - // try to search newer context by the concealment references - // take references to all results: root one, any sub + // if (aResult->groupName() == ModelAPI_ResultBody::group()) { + // try to search newer context by the concealment references + // take references to all results: root one, any sub std::list allRes; ResultPtr aCompContext; ResultBodyPtr aCompBody = ModelAPI_Tools::bodyOwner(aResult, true); if (aCompBody.get()) { std::list allSub; ModelAPI_Tools::allSubs(aCompBody, allSub); - for(std::list::iterator anIt = allSub.begin(); anIt != allSub.end(); anIt++) + for (std::list::iterator anIt = allSub.begin(); + anIt != allSub.end(); anIt++) allRes.push_back((*anIt)->data()); allRes.push_back(aCompBody->data()); aCompContext = aCompBody; @@ -2086,43 +2294,52 @@ ResultPtr Model_AttributeSelection::newestContext( allRes.push_back(aResult->document()->feature(aResult)->data()); bool aFoundReferernce = false; - for (std::list::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) { + for (std::list::iterator aSub = allRes.begin(); + aSub != allRes.end(); aSub++) { DataPtr aResCont = *aSub; - ResultBodyPtr aResBody = std::dynamic_pointer_cast(aResCont->owner()); - if (aResBody.get() && aResBody->numberOfSubs() > 0 && aResBody != aCompContext) + ResultBodyPtr aResBody = + std::dynamic_pointer_cast(aResCont->owner()); + if (aResBody.get() && aResBody->numberOfSubs() > 0 && + aResBody != aCompContext) continue; // only lower and higher level subs are counted - const std::set& aRefs = aResCont->refsToMe(); + const std::set &aRefs = aResCont->refsToMe(); std::set::const_iterator aRef = aRefs.begin(); for (; !aFindNewContext && aRef != aRefs.end(); aRef++) { if (!aRef->get() || !(*aRef)->owner().get()) continue; // concealed attribute only - FeaturePtr aRefFeat = std::dynamic_pointer_cast((*aRef)->owner()); + FeaturePtr aRefFeat = + std::dynamic_pointer_cast((*aRef)->owner()); if (!ModelAPI_Session::get()->validators()->isConcealed( - aRefFeat->getKind(), (*aRef)->id())) + aRefFeat->getKind(), (*aRef)->id())) continue; // search the feature result that contains sub-shape selected - std::list > aResults; + std::list> aResults; // take all sub-results or one result std::list aRefFeatResults; ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults); std::list::iterator aRefResIter = aRefFeatResults.begin(); for (; aRefResIter != aRefFeatResults.end(); aRefResIter++) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(*aRefResIter); - if (aBody.get() && aBody->numberOfSubs() == 0) // add only lower level subs + ResultBodyPtr aBody = + std::dynamic_pointer_cast(*aRefResIter); + if (aBody.get() && + aBody->numberOfSubs() == 0) // add only lower level subs aResults.push_back(aBody); } - std::list >::iterator aResIter = aResults.begin(); + std::list>::iterator aResIter = + aResults.begin(); // searching by sub-shape for (; aResIter != aResults.end(); aResIter++) { - if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled()) + if (!aResIter->get() || !(*aResIter)->data()->isValid() || + (*aResIter)->isDisabled()) continue; aFoundReferernce = true; GeomShapePtr aShape = (*aResIter)->shape(); if (aShape.get() && aShape->isSubShape(aSelectedShape, false)) { - aResult = *aResIter; // found new context (produced from this) with same subshape + aResult = *aResIter; // found new context (produced from this) with + // same subshape aFindNewContext = true; // continue searching further break; } @@ -2135,7 +2352,8 @@ ResultPtr Model_AttributeSelection::newestContext( return theCurrent; } } - // if compsolid is context, try to take sub-solid as context: like in GUI and scripts + // if compsolid is context, try to take sub-solid as context: like in GUI and + // scripts ResultBodyPtr aComp = std::dynamic_pointer_cast(aResult); if (aComp && aComp->numberOfSubs()) { std::list allSubs; @@ -2150,33 +2368,39 @@ ResultPtr Model_AttributeSelection::newestContext( } } } - // in case sketch line was selected for wire, but wire was concealed and there is no such line - // anymore, so, actually, the sketch element was selected (which is never concealed) - if (aResult != theCurrent && theCurrent->groupName() == ModelAPI_ResultConstruction::group()) { + // in case sketch line was selected for wire, but wire was concealed and there + // is no such line anymore, so, actually, the sketch element was selected + // (which is never concealed) + if (aResult != theCurrent && + theCurrent->groupName() == ModelAPI_ResultConstruction::group()) { std::list aConcealers; FeaturePtr aResFeature = aDoc->feature(aResult); - FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); - concealedFeature(aResFeature, aThisFeature, false, aConcealers, aResult, true); + FeaturePtr aThisFeature = + std::dynamic_pointer_cast(owner()); + concealedFeature(aResFeature, aThisFeature, false, aConcealers, aResult, + true); if (aConcealers.size()) aResult = theCurrent; } return aResult; } -void Model_AttributeSelection::combineGeometrical() -{ +void Model_AttributeSelection::combineGeometrical() { if (myTmpContext.get() || myTmpSubShape.get()) return; TDF_Label aSelLab = selectionLabel(); if (aSelLab.IsAttribute(kINVALID_SELECTION) || !myRef.isInitialized()) return; - if (aSelLab.IsAttribute(kCIRCLE_CENTER) || aSelLab.IsAttribute(kELLIPSE_CENTER1) || - aSelLab.IsAttribute(kELLIPSE_CENTER2) || aSelLab.IsAttribute(kSIMPLE_REF_ID)) + if (aSelLab.IsAttribute(kCIRCLE_CENTER) || + aSelLab.IsAttribute(kELLIPSE_CENTER1) || + aSelLab.IsAttribute(kELLIPSE_CENTER2) || + aSelLab.IsAttribute(kSIMPLE_REF_ID)) return; if (aSelLab.IsAttribute(kPART_REF_ID)) { - ResultPartPtr aPart = std::dynamic_pointer_cast(context()); + ResultPartPtr aPart = + std::dynamic_pointer_cast(context()); if (!aPart.get() || !aPart->isActivated()) return; // postponed naming needed Handle(TDataStd_Integer) anIndex; @@ -2191,7 +2415,7 @@ void Model_AttributeSelection::combineGeometrical() } std::shared_ptr aConstr = - std::dynamic_pointer_cast(context()); + std::dynamic_pointer_cast(context()); if (aConstr.get()) return; FeaturePtr aFeature = contextFeature(); @@ -2205,17 +2429,16 @@ void Model_AttributeSelection::combineGeometrical() } } -TDF_Label Model_AttributeSelection::baseDocumentLab() -{ +TDF_Label Model_AttributeSelection::baseDocumentLab() { if (ModelAPI_Session::get()->moduleDocument() != owner()->document()) - return std::dynamic_pointer_cast - (ModelAPI_Session::get()->moduleDocument())->extConstructionsLabel(); + return std::dynamic_pointer_cast( + ModelAPI_Session::get()->moduleDocument()) + ->extConstructionsLabel(); static TDF_Label anEmpty; return anEmpty; } -void Model_AttributeSelection::reset() -{ +void Model_AttributeSelection::reset() { ModelAPI_AttributeSelection::reset(); myRef.reset(); } diff --git a/src/Model/Model_AttributeSelection.h b/src/Model/Model_AttributeSelection.h index 32004cd66..b6df06497 100644 --- a/src/Model/Model_AttributeSelection.h +++ b/src/Model/Model_AttributeSelection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeSelection_H_ @@ -25,28 +26,29 @@ #include #include #include -#include #include +#include class Model_AttributeSelectionList; class Model_Document; /**\class Model_AttributeSelection * \ingroup DataModel - * \brief Attribute that contains reference to the sub-shape of some result, the selected shape. + * \brief Attribute that contains reference to the sub-shape of some result, the + * selected shape. */ class Model_AttributeSelection : public ModelAPI_AttributeSelection, - public Selector_NameGenerator -{ - Model_AttributeReference myRef; ///< The reference functionality re-usage + public Selector_NameGenerator { + Model_AttributeReference myRef; ///< The reference functionality re-usage /// temporarily storages to avoid keeping in the data structure if not needed ObjectPtr myTmpContext; /// temporarily storages to avoid keeping in the data structure if not needed std::shared_ptr myTmpSubShape; /// temporarily storages to avoid keeping in the data structure if not needed CenterType myTmpCenterType; - /// Reference to the parent attribute, if any (to split selection compounds in issue 1799) - Model_AttributeSelectionList* myParent; + /// Reference to the parent attribute, if any (to split selection compounds in + /// issue 1799) + Model_AttributeSelectionList *myParent; /// current document to restore by name std::shared_ptr myRestoreDocument; @@ -56,24 +58,26 @@ class Model_AttributeSelection : public ModelAPI_AttributeSelection, public: /// Defines the result and its selected sub-shape /// \param theContext object where the sub-shape was selected - /// \param theSubShape selected sub-shape (if null, the whole context is selected) - /// \param theTemporarily if it is true, do not store and name the added in the data framework + /// \param theSubShape selected sub-shape (if null, the whole context is + /// selected) \param theTemporarily if it is true, do not store and name the + /// added in the data framework /// (used to remove immediately, without the following updates) /// \returns true if attribute was updated - MODEL_EXPORT virtual bool setValue( - const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily = false); + MODEL_EXPORT virtual bool + setValue(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false); /// Same as SetValue, but it takes an edge (on circular or elliptic curve) - /// and stores the vertex of the central point (for ellipse the first or the second focus point) + /// and stores the vertex of the central point (for ellipse the first or the + /// second focus point) MODEL_EXPORT virtual void setValueCenter( - const ObjectPtr& theContext, const std::shared_ptr& theEdge, - const CenterType theCenterType, - const bool theTemporarily = false); + const ObjectPtr &theContext, const std::shared_ptr &theEdge, + const CenterType theCenterType, const bool theTemporarily = false); /// Makes this selection attribute selects the same as in theSource selection - MODEL_EXPORT virtual void selectValue( - const std::shared_ptr& theSource); + MODEL_EXPORT virtual void + selectValue(const std::shared_ptr &theSource); /// Reset temporary stored values virtual void removeTemporaryValues(); @@ -90,29 +94,35 @@ public: MODEL_EXPORT virtual std::shared_ptr contextObject(); /// Sets the feature object - MODEL_EXPORT virtual void setObject(const std::shared_ptr& theObject); + MODEL_EXPORT virtual void + setObject(const std::shared_ptr &theObject); /// Updates the selection due to the changes in the referenced objects /// \returns false if update is failed MODEL_EXPORT virtual bool update(); /// Returns a textual string of the selection - /// \param theDefaultValue a name, which is returned if the naming name can not be obtained - MODEL_EXPORT virtual std::wstring namingName(const std::wstring& theDefaultValue = L""); + /// \param theDefaultValue a name, which is returned if the naming name can + /// not be obtained + MODEL_EXPORT virtual std::wstring + namingName(const std::wstring &theDefaultValue = L""); /// Defines the sub-shape by Id MODEL_EXPORT virtual void setId(int theID); - /// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name - MODEL_EXPORT virtual void selectSubShape(const std::string& theType, - const std::wstring& theSubShapeName); + /// Selects (i.e. creates Naming data structure) of sub-shape specified by + /// textual name + MODEL_EXPORT virtual void selectSubShape(const std::string &theType, + const std::wstring &theSubShapeName); /// Selects sub-shape by its inner point - MODEL_EXPORT virtual void selectSubShape(const std::string& theType, - const std::shared_ptr& thePoint); + MODEL_EXPORT virtual void + selectSubShape(const std::string &theType, + const std::shared_ptr &thePoint); /// Selects sub-shape by weak naming index - MODEL_EXPORT virtual void selectSubShape(const std::string& theType, - const std::wstring& theContextName, const int theIndex); + MODEL_EXPORT virtual void selectSubShape(const std::string &theType, + const std::wstring &theContextName, + const int theIndex); /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); @@ -123,25 +133,31 @@ public: /// Updates the arguments of selection if something was affected by creation /// or reorder of features upper in the history line (issue #1757) /// Returns theRemove true if this attribute must be removed (become deleted) - MODEL_EXPORT virtual void updateInHistory(bool& theRemove) override; + MODEL_EXPORT virtual void updateInHistory(bool &theRemove) override; // Implementation of the name generator method from the Selector package // This method returns the context name by the label of the sub-selected shape - MODEL_EXPORT virtual std::wstring contextName(const TDF_Label theSelectionLab) override; + MODEL_EXPORT virtual std::wstring + contextName(const TDF_Label theSelectionLab) override; /// This method restores by the context and value name the context label and /// sub-label where the value is. Returns true if it is valid. MODEL_EXPORT virtual bool restoreContext(std::wstring theName, - TDF_Label& theContext, TDF_Label& theValue) override; + TDF_Label &theContext, + TDF_Label &theValue) override; - /// Returns true if the first result is newer than the second one in the tree of features - MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2) - const override; + /// Returns true if the first result is newer than the second one in the tree + /// of features + MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1, + const TDF_Label theResult2) const override; - /// Returns the name by context. Adds the part name if the context is located in other document - MODEL_EXPORT virtual std::wstring contextName(const ResultPtr& theContext) const; + /// Returns the name by context. Adds the part name if the context is located + /// in other document + MODEL_EXPORT virtual std::wstring + contextName(const ResultPtr &theContext) const; - /// Makes the current local selection becomes all sub-shapes with same base geometry. + /// Makes the current local selection becomes all sub-shapes with same base + /// geometry. MODEL_EXPORT virtual void combineGeometrical(); /// Resets attribute to deafult state @@ -149,69 +165,78 @@ public: protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel); + MODEL_EXPORT Model_AttributeSelection(TDF_Label &theLabel); - /// Returns the selected subshape, internal method that works without knowledge - /// about special selection of circle and ellipse focuses (for that the public value - /// method calls this and makes additional processing). + /// Returns the selected subshape, internal method that works without + /// knowledge about special selection of circle and ellipse focuses (for that + /// the public value method calls this and makes additional processing). /// Returns theType type of the center, or NOT_CENTER if it is not. - std::shared_ptr internalValue(CenterType& theType); + std::shared_ptr internalValue(CenterType &theType); /// Performs the selection for the body result (TNaming selection) - virtual void selectBody( - const ResultPtr& theContext, const std::shared_ptr& theSubShape); - - /// Performs the selection for the part result (selection by name of body result inside of part) - /// \param theContext the result - owner of the selection - /// \param theSubShape selected shape - /// \param theUpdate flag that shows that it must be just update, theShape is null - /// \returns true if everything is selected correctly - virtual bool selectPart( - const ResultPtr& theContext, const std::shared_ptr& theSubShape, - const bool theUpdate = false); + virtual void selectBody(const ResultPtr &theContext, + const std::shared_ptr &theSubShape); + + /// Performs the selection for the part result (selection by name of body + /// result inside of part) \param theContext the result - owner of the + /// selection \param theSubShape selected shape \param theUpdate flag that + /// shows that it must be just update, theShape is null \returns true if + /// everything is selected correctly + virtual bool selectPart(const ResultPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theUpdate = false); /// Returns the label where TNaming_Selection results are stored - /// Note: there must be no attributes stored at the same label because Selector clears this lab + /// Note: there must be no attributes stored at the same label because + /// Selector clears this lab TDF_Label selectionLabel(); - /// Sets the ID of the attribute in Data (called from Data): here it is used for myRef ID setting + /// Sets the ID of the attribute in Data (called from Data): here it is used + /// for myRef ID setting MODEL_EXPORT virtual void setID(const std::string theID); /// Sets the parent attribute - void setParent(Model_AttributeSelectionList* theParent); + void setParent(Model_AttributeSelectionList *theParent); - /// Splits theNewShape into sub-shapes of theType type (for the list parent of this attribute) - void split(ResultPtr theContext, TopoDS_Shape theNewShape, TopAbs_ShapeEnum theType); + /// Splits theNewShape into sub-shapes of theType type (for the list parent of + /// this attribute) + void split(ResultPtr theContext, TopoDS_Shape theNewShape, + TopAbs_ShapeEnum theType); /// When group position is updated, searches the new context and new values - bool searchNewContext(std::shared_ptr theDoc, const TopoDS_Shape theContShape, - ResultPtr theContext, TopoDS_Shape theValShape, TDF_Label theAccessLabel, - std::list& theResults, TopTools_ListOfShape& theValShapes); - - /// Searches for the newest context, modification of the current, that contains theValue - ResultPtr newestContext( - const ResultPtr theCurrent, const std::shared_ptr theValue); - - /// computes theShapes list - shapes that were generated/modified/deleted the theValShape - /// during creation from new to old context - void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape, - TopTools_ListOfShape& theShapes); + bool searchNewContext(std::shared_ptr theDoc, + const TopoDS_Shape theContShape, ResultPtr theContext, + TopoDS_Shape theValShape, TDF_Label theAccessLabel, + std::list &theResults, + TopTools_ListOfShape &theValShapes); + + /// Searches for the newest context, modification of the current, that + /// contains theValue + ResultPtr newestContext(const ResultPtr theCurrent, + const std::shared_ptr theValue); + + /// computes theShapes list - shapes that were generated/modified/deleted the + /// theValShape during creation from new to old context + void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, + TopoDS_Shape theValShape, TopTools_ListOfShape &theShapes); /// Returns true if is geometrical selection. virtual bool isGeometricalSelection() const { return myIsGeometricalSelection; }; - /// Returns the module document label if this selection attribute is not in this document. - /// Returns null label otherwise. + /// Returns the module document label if this selection attribute is not in + /// this document. Returns null label otherwise. TDF_Label baseDocumentLab(); - /// Returns features that conceals theFeature and located in history before theStop - /// theResultOfFeature if not null defines exact referenced result of a feature - void concealedFeature( - const FeaturePtr theFeature, const FeaturePtr theStop, const bool theCheckCopy, - std::list& theConcealers, const ResultPtr theResultOfFeature, - const bool theCheckWholeFeature = false); + /// Returns features that conceals theFeature and located in history before + /// theStop theResultOfFeature if not null defines exact referenced result of + /// a feature + void concealedFeature(const FeaturePtr theFeature, const FeaturePtr theStop, + const bool theCheckCopy, + std::list &theConcealers, + const ResultPtr theResultOfFeature, + const bool theCheckWholeFeature = false); friend class Model_Data; friend class Model_AttributeSelectionList; diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 3977772b4..6bce6cc6f 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -14,52 +14,57 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeSelectionList.h" -#include "Model_AttributeSelection.h" #include "Model_Application.h" -#include "Model_Events.h" +#include "Model_AttributeSelection.h" #include "Model_Data.h" +#include "Model_Events.h" #include "Model_Objects.h" #include #include #include +#include +#include #include #include -#include #include -#include +#include #include -#include -#include -#include -#include -#include +#include #include #include #include -#include - -/// GUID for UAttribute that indicates the list has "To add all elements that share the same -/// topology" flag enabled -static const Standard_GUID kIS_GEOMETRICAL_SELECTION("f16987b6-e6c8-435c-99fa-03a7e0b06e83"); +#include +#include +#include +#include -/// GUID for TDataStd_ReferenceList attribute that refers the selection filters feature -static const Standard_GUID kSELECTION_FILTERS_REF("ea5b1dbf-a740-4a0b-a1b2-3c3c756e691a"); +/// GUID for UAttribute that indicates the list has "To add all elements that +/// share the same topology" flag enabled +static const Standard_GUID + kIS_GEOMETRICAL_SELECTION("f16987b6-e6c8-435c-99fa-03a7e0b06e83"); +/// GUID for TDataStd_ReferenceList attribute that refers the selection filters +/// feature +static const Standard_GUID + kSELECTION_FILTERS_REF("ea5b1dbf-a740-4a0b-a1b2-3c3c756e691a"); void Model_AttributeSelectionList::append( - const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily) -{ - // do not use the degenerated edge as a shape, a list is not incremented in this case + const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily) { + // do not use the degenerated edge as a shape, a list is not incremented in + // this case if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) { - const TopoDS_Shape& aSubShape = theSubShape->impl(); - if (aSubShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) { + const TopoDS_Shape &aSubShape = theSubShape->impl(); + if (aSubShape.ShapeType() == TopAbs_EDGE && + BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) { return; } } @@ -72,7 +77,8 @@ void Model_AttributeSelectionList::append( TDF_Label aNewLab = mySize->Label().FindChild(aNewTag); std::shared_ptr aNewAttr = - std::shared_ptr(new Model_AttributeSelection(aNewLab)); + std::shared_ptr( + new Model_AttributeSelection(aNewLab)); if (owner()) { aNewAttr->setObject(owner()); aNewAttr->setParent(this); @@ -87,31 +93,33 @@ void Model_AttributeSelectionList::append( owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeSelectionList::append( - const std::wstring& theNamingName, const std::string& theType) -{ +void Model_AttributeSelectionList::append(const std::wstring &theNamingName, + const std::string &theType) { int aNewTag = mySize->Get() + 1; TDF_Label aNewLab = mySize->Label().FindChild(aNewTag); std::shared_ptr aNewAttr = - std::shared_ptr(new Model_AttributeSelection(aNewLab)); + std::shared_ptr( + new Model_AttributeSelection(aNewLab)); if (owner()) { aNewAttr->setObject(owner()); aNewAttr->setParent(this); } aNewAttr->setID(id()); mySize->Set(aNewTag); - aNewAttr->selectSubShape(theType.empty() ? selectionType() : theType, theNamingName); + aNewAttr->selectSubShape(theType.empty() ? selectionType() : theType, + theNamingName); owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeSelectionList::append(const GeomPointPtr& thePoint, const std::string& theType) -{ +void Model_AttributeSelectionList::append(const GeomPointPtr &thePoint, + const std::string &theType) { int aNewTag = mySize->Get() + 1; TDF_Label aNewLab = mySize->Label().FindChild(aNewTag); std::shared_ptr aNewAttr = - std::shared_ptr(new Model_AttributeSelection(aNewLab)); + std::shared_ptr( + new Model_AttributeSelection(aNewLab)); if (owner()) { aNewAttr->setObject(owner()); aNewAttr->setParent(this); @@ -122,14 +130,15 @@ void Model_AttributeSelectionList::append(const GeomPointPtr& thePoint, const st owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeSelectionList::append(const std::string& theType, - const std::wstring& theContextName, const int theIndex) -{ +void Model_AttributeSelectionList::append(const std::string &theType, + const std::wstring &theContextName, + const int theIndex) { int aNewTag = mySize->Get() + 1; TDF_Label aNewLab = mySize->Label().FindChild(aNewTag); std::shared_ptr aNewAttr = - std::shared_ptr(new Model_AttributeSelection(aNewLab)); + std::shared_ptr( + new Model_AttributeSelection(aNewLab)); if (owner()) { aNewAttr->setObject(owner()); aNewAttr->setParent(this); @@ -140,21 +149,20 @@ void Model_AttributeSelectionList::append(const std::string& theType, owner()->data()->sendAttributeUpdated(this); } -void Model_AttributeSelectionList::removeTemporaryValues() -{ +void Model_AttributeSelectionList::removeTemporaryValues() { if (myTmpAttr.get()) { myTmpAttr.reset(); } } -void Model_AttributeSelectionList::removeLast() -{ +void Model_AttributeSelectionList::removeLast() { int anOldSize = mySize->Get(); if (anOldSize != 0) { mySize->Set(anOldSize - 1); TDF_Label aLab = mySize->Label().FindChild(anOldSize); std::shared_ptr aOldAttr = - std::shared_ptr(new Model_AttributeSelection(aLab)); + std::shared_ptr( + new Model_AttributeSelection(aLab)); aOldAttr->setObject(owner()); REMOVE_BACK_REF(aOldAttr->context()); aLab.ForgetAllAttributes(Standard_True); @@ -164,20 +172,19 @@ void Model_AttributeSelectionList::removeLast() } // copies named shapes: we need the implementation of this -static void CopyNS(const Handle(TNaming_NamedShape)& theFrom, - const Handle(TDF_Attribute)& theTo) -{ +static void CopyNS(const Handle(TNaming_NamedShape) & theFrom, + const Handle(TDF_Attribute) & theTo) { TDF_Label aLab = theTo->Label(); TNaming_Builder B(aLab); - // TNaming_Iterator iterates in reversed way than it was put in Builder, so, keep it in container - // and iterate from end to begin + // TNaming_Iterator iterates in reversed way than it was put in Builder, so, + // keep it in container and iterate from end to begin NCollection_List aOlds; NCollection_List aNews; NCollection_List aStatuses; - TNaming_Iterator anIt (theFrom); - for ( ;anIt.More() ; anIt.Next()) { + TNaming_Iterator anIt(theFrom); + for (; anIt.More(); anIt.Next()) { aOlds.Prepend(anIt.OldShape()); aNews.Prepend(anIt.NewShape()); aStatuses.Prepend(anIt.Evolution()); @@ -186,21 +193,21 @@ static void CopyNS(const Handle(TNaming_NamedShape)& theFrom, NCollection_List::Iterator aOldIter(aOlds); NCollection_List::Iterator aNewIter(aNews); NCollection_List::Iterator aStatIter(aStatuses); - for(; aOldIter.More(); aOldIter.Next(), aNewIter.Next(), aStatIter.Next()) { + for (; aOldIter.More(); aOldIter.Next(), aNewIter.Next(), aStatIter.Next()) { switch (aStatIter.Value()) { - case TNaming_PRIMITIVE : + case TNaming_PRIMITIVE: B.Generated(aNewIter.Value()); break; - case TNaming_GENERATED : + case TNaming_GENERATED: B.Generated(aOldIter.Value(), aNewIter.Value()); break; - case TNaming_MODIFY : + case TNaming_MODIFY: B.Modify(aOldIter.Value(), aNewIter.Value()); break; - case TNaming_DELETE : - B.Delete (aOldIter.Value()); + case TNaming_DELETE: + B.Delete(aOldIter.Value()); break; - case TNaming_SELECTED : + case TNaming_SELECTED: B.Select(aNewIter.Value(), aOldIter.Value()); break; default: @@ -212,20 +219,24 @@ static void CopyNS(const Handle(TNaming_NamedShape)& theFrom, /// makes copy of all attributes on the given label and all sub-labels static void copyAttrs(TDF_Label theSource, TDF_Label theDestination) { TDF_AttributeIterator anAttrIter(theSource); - for(; anAttrIter.More(); anAttrIter.Next()) { + for (; anAttrIter.More(); anAttrIter.Next()) { Handle(TDF_Attribute) aTargetAttr; if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) { // create a new attribute if not yet exists in the destination - aTargetAttr = anAttrIter.Value()->NewEmpty(); + aTargetAttr = anAttrIter.Value()->NewEmpty(); if (aTargetAttr->ID() != anAttrIter.Value()->ID()) aTargetAttr->SetID(anAttrIter.Value()->ID()); theDestination.AddAttribute(aTargetAttr); } - // for named shape copy exact shapes (in NamedShape Paste method the CopyTool is used) - Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(anAttrIter.Value()); + // for named shape copy exact shapes (in NamedShape Paste method the + // CopyTool is used) + Handle(TNaming_NamedShape) aNS = + Handle(TNaming_NamedShape)::DownCast(anAttrIter.Value()); if (aNS.IsNull()) { - // no special relocation, empty map, but self-relocation is on: copy references w/o changes - Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable(Standard_True); + // no special relocation, empty map, but self-relocation is on: copy + // references w/o changes + Handle(TDF_RelocationTable) aRelocTable = + new TDF_RelocationTable(Standard_True); anAttrIter.Value()->Paste(aTargetAttr, aRelocTable); } else { CopyNS(aNS, aTargetAttr); @@ -233,17 +244,17 @@ static void copyAttrs(TDF_Label theSource, TDF_Label theDestination) { } // copy the sub-labels content TDF_ChildIterator aSubLabsIter(theSource); - for(; aSubLabsIter.More(); aSubLabsIter.Next()) { - copyAttrs(aSubLabsIter.Value(), theDestination.FindChild(aSubLabsIter.Value().Tag())); + for (; aSubLabsIter.More(); aSubLabsIter.Next()) { + copyAttrs(aSubLabsIter.Value(), + theDestination.FindChild(aSubLabsIter.Value().Tag())); } } -void Model_AttributeSelectionList::remove(const std::set& theIndices) -{ +void Model_AttributeSelectionList::remove(const std::set &theIndices) { int anOldSize = mySize->Get(); int aRemoved = 0; // iterate one by one and shifting the removed indices - for(int aCurrent = 0; aCurrent < anOldSize; aCurrent++) { + for (int aCurrent = 0; aCurrent < anOldSize; aCurrent++) { if (theIndices.find(aCurrent) == theIndices.end()) { // not removed if (aRemoved) { // but must be shifted to the removed position TDF_Label aSource = mySize->Label().FindChild(aCurrent + 1); @@ -255,7 +266,8 @@ void Model_AttributeSelectionList::remove(const std::set& theIndices) } else { // this is removed, so remove everything from this label TDF_Label aLab = mySize->Label().FindChild(aCurrent + 1); std::shared_ptr aOldAttr = - std::shared_ptr(new Model_AttributeSelection(aLab)); + std::shared_ptr( + new Model_AttributeSelection(aLab)); aOldAttr->setObject(owner()); REMOVE_BACK_REF(aOldAttr->context()); aLab.ForgetAllAttributes(Standard_True); @@ -263,35 +275,35 @@ void Model_AttributeSelectionList::remove(const std::set& theIndices) aRemoved++; } } - if (aRemoved) { // remove was performed, so, update the size and this attribute + if (aRemoved) { // remove was performed, so, update the size and this + // attribute mySize->Set(anOldSize - aRemoved); owner()->data()->sendAttributeUpdated(this); } } -void Model_AttributeSelectionList::copyTo(AttributeSelectionListPtr theTarget) const -{ +void Model_AttributeSelectionList::copyTo( + AttributeSelectionListPtr theTarget) const { std::shared_ptr aTarget = - std::dynamic_pointer_cast(theTarget); + std::dynamic_pointer_cast(theTarget); if (aTarget) { copyAttrs(myLab, aTarget->myLab); aTarget->reinit(); } } -int Model_AttributeSelectionList::size() -{ - return mySize->Get(); -} +int Model_AttributeSelectionList::size() { return mySize->Get(); } // LCOV_EXCL_START -// returns true if theShape is same with theInList or is contained in it (a compound) +// returns true if theShape is same with theInList or is contained in it (a +// compound) static bool isIn(GeomShapePtr theInList, GeomShapePtr theShape) { if (theShape->isSame(theInList)) return true; if (theInList.get() && theInList->shapeType() == GeomAPI_Shape::COMPOUND) { - for(GeomAPI_ShapeIterator anIter(theInList); anIter.more(); anIter.next()) { + for (GeomAPI_ShapeIterator anIter(theInList); anIter.more(); + anIter.next()) { if (!anIter.current()->isNull() && anIter.current()->isSame(theShape)) return true; } @@ -299,27 +311,32 @@ static bool isIn(GeomShapePtr theInList, GeomShapePtr theShape) { return false; } -bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, - const std::shared_ptr& theSubShape, - const bool /*theTemporarily*/) -{ +bool Model_AttributeSelectionList::isInList( + const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool /*theTemporarily*/) { if (myIsCashed) { // the cashing is active if (theContext.get()) { - std::map > >::iterator aContext = - myCash.find(theContext); + std::map>>::iterator + aContext = myCash.find(theContext); if (aContext != myCash.end()) { // iterate shapes because "isSame" method must be called for each shape - std::list >::iterator aShapes = aContext->second.begin(); - for(; aShapes != aContext->second.end(); aShapes++) { + std::list>::iterator aShapes = + aContext->second.begin(); + for (; aShapes != aContext->second.end(); aShapes++) { if (!theSubShape.get()) { if (!aShapes->get()) return true; - ResultPtr aRes = std::dynamic_pointer_cast(aContext->first); - FeaturePtr aFeat = std::dynamic_pointer_cast(aContext->first); - if ((aRes.get() && (*aShapes)->isSame(aRes->shape())) || aFeat.get()) + ResultPtr aRes = + std::dynamic_pointer_cast(aContext->first); + FeaturePtr aFeat = + std::dynamic_pointer_cast(aContext->first); + if ((aRes.get() && (*aShapes)->isSame(aRes->shape())) || + aFeat.get()) return true; } else { - // we need to call here isSame instead of isEqual to do not check shapes orientation + // we need to call here isSame instead of isEqual to do not check + // shapes orientation if (isIn(*aShapes, theSubShape)) return true; } @@ -329,11 +346,12 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, } } // no-cash method - bool isFeature = std::dynamic_pointer_cast(theContext).get() != NULL; + bool isFeature = + std::dynamic_pointer_cast(theContext).get() != NULL; ResultPtr aRes; if (!isFeature) aRes = std::dynamic_pointer_cast(theContext); - for(int anIndex = size() - 1; anIndex >= 0; anIndex--) { + for (int anIndex = size() - 1; anIndex >= 0; anIndex--) { AttributeSelectionPtr anAttr = value(anIndex); if (anAttr.get()) { if (isFeature && anAttr->contextFeature() == theContext) @@ -345,7 +363,8 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, if (!aValue.get() || (aRes.get() && aValue->isSame(aRes->shape()))) return true; } else { - // we need to call here isSame instead of isEqual to do not check shapes orientation + // we need to call here isSame instead of isEqual to do not check + // shapes orientation if (isIn(aValue, theSubShape)) // shapes are equal return true; } @@ -356,28 +375,28 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, } // LCOV_EXCL_STOP -const std::string Model_AttributeSelectionList::selectionType() const -{ +const std::string Model_AttributeSelectionList::selectionType() const { return TCollection_AsciiString(mySelectionType->Get()).ToCString(); } -void Model_AttributeSelectionList::setSelectionType(const std::string& theType) -{ +void Model_AttributeSelectionList::setSelectionType( + const std::string &theType) { mySelectionType->Set(theType.c_str()); } std::shared_ptr - Model_AttributeSelectionList::value(const int theIndex) -{ +Model_AttributeSelectionList::value(const int theIndex) { if (myTmpAttr.get() && theIndex == size() - 1) { return myTmpAttr; } TDF_Label aLabel = mySize->Label().FindChild(theIndex + 1); // create a new attribute each time, by demand // supporting of old attributes is too slow (sync each time) and buggy on redo - // (if attribute is deleted and created, the abort updates attribute and makes the Attr invalid) + // (if attribute is deleted and created, the abort updates attribute and makes + // the Attr invalid) std::shared_ptr aNewAttr = - std::shared_ptr(new Model_AttributeSelection(aLabel)); + std::shared_ptr( + new Model_AttributeSelection(aLabel)); if (owner()) { aNewAttr->setObject(owner()); aNewAttr->setParent(this); @@ -386,16 +405,16 @@ std::shared_ptr return aNewAttr; } -void Model_AttributeSelectionList::clear() -{ +void Model_AttributeSelectionList::clear() { if (mySize->Get() != 0) { mySize->Set(0); myTmpAttr.reset(); TDF_ChildIterator aSubIter(mySize->Label()); - for(; aSubIter.More(); aSubIter.Next()) { + for (; aSubIter.More(); aSubIter.Next()) { TDF_Label aLab = aSubIter.Value(); std::shared_ptr aNewAttr = - std::shared_ptr(new Model_AttributeSelection(aLab)); + std::shared_ptr( + new Model_AttributeSelection(aLab)); if (owner()) { aNewAttr->setObject(owner()); aNewAttr->setParent(this); @@ -408,23 +427,22 @@ void Model_AttributeSelectionList::clear() } } -bool Model_AttributeSelectionList::isInitialized() -{ - if (size() == 0) { // empty list is not initialized list: sketch will be not valid after add/undo +bool Model_AttributeSelectionList::isInitialized() { + if (size() == 0) { // empty list is not initialized list: sketch will be not + // valid after add/undo return false; } return ModelAPI_AttributeSelectionList::isInitialized(); } -Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel) -: ModelAPI_AttributeSelectionList(), myLab(theLabel) -{ +Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label &theLabel) + : ModelAPI_AttributeSelectionList(), myLab(theLabel) { reinit(); } -void Model_AttributeSelectionList::reinit() -{ - myIsInitialized = myLab.FindAttribute(TDataStd_Integer::GetID(), mySize) == Standard_True; +void Model_AttributeSelectionList::reinit() { + myIsInitialized = + myLab.FindAttribute(TDataStd_Integer::GetID(), mySize) == Standard_True; if (!myIsInitialized) { mySize = TDataStd_Integer::Set(myLab, 0); mySelectionType = TDataStd_Comment::Set(myLab, ""); @@ -435,12 +453,11 @@ void Model_AttributeSelectionList::reinit() } // LCOV_EXCL_START -void Model_AttributeSelectionList::cashValues(const bool theEnabled) -{ +void Model_AttributeSelectionList::cashValues(const bool theEnabled) { myIsCashed = theEnabled; myCash.clear(); // empty list as indicator that cash is not used if (theEnabled) { - for(int anIndex = size() - 1; anIndex >= 0; anIndex--) { + for (int anIndex = size() - 1; anIndex >= 0; anIndex--) { AttributeSelectionPtr anAttr = value(anIndex); if (anAttr.get()) { myCash[anAttr->contextObject()].push_back(anAttr->value()); @@ -450,51 +467,56 @@ void Model_AttributeSelectionList::cashValues(const bool theEnabled) } // LCOV_EXCL_STOP -bool Model_AttributeSelectionList::isGeometricalSelection() const -{ +bool Model_AttributeSelectionList::isGeometricalSelection() const { return myLab.IsAttribute(kIS_GEOMETRICAL_SELECTION); } -void Model_AttributeSelectionList::setGeometricalSelection(const bool theIsGeometricalSelection) -{ +void Model_AttributeSelectionList::setGeometricalSelection( + const bool theIsGeometricalSelection) { if (isGeometricalSelection() == theIsGeometricalSelection) - return; // nothing to do + return; // nothing to do if (theIsGeometricalSelection) // store the state TDataStd_UAttribute::Set(myLab, kIS_GEOMETRICAL_SELECTION); else myLab.ForgetAttribute(kIS_GEOMETRICAL_SELECTION); - std::set anIndiciesToRemove; // Update list according to the flag - if (theIsGeometricalSelection) { // all objects with same geometry must be combined into single - std::list anAttributes; // collect attributes with geometrical compounds - for(int anIndex = 0; anIndex < size(); anIndex++) { + std::set anIndiciesToRemove; // Update list according to the flag + if (theIsGeometricalSelection) { // all objects with same geometry must be + // combined into single + std::list + anAttributes; // collect attributes with geometrical compounds + for (int anIndex = 0; anIndex < size(); anIndex++) { AttributeSelectionPtr anAttr = value(anIndex); if (!anAttr.get() || !anAttr->context().get()) continue; anAttr->combineGeometrical(); - if (!anAttr->value().get() || anAttr->value()->shapeType() != GeomAPI_Shape::COMPOUND) + if (!anAttr->value().get() || + anAttr->value()->shapeType() != GeomAPI_Shape::COMPOUND) continue; // check it is equal to some other attribute already presented in the list - std::list::iterator anAttrIter = anAttributes.begin(); - for(; anAttrIter != anAttributes.end(); anAttrIter++) { + std::list::iterator anAttrIter = + anAttributes.begin(); + for (; anAttrIter != anAttributes.end(); anAttrIter++) { if (anAttr->context() == (*anAttrIter)->context() && anAttr->namingName() == (*anAttrIter)->namingName()) { anIndiciesToRemove.insert(anIndex); break; } } - if (anAttrIter == anAttributes.end()) // not removed, so, add to the compare-list + if (anAttrIter == + anAttributes.end()) // not removed, so, add to the compare-list anAttributes.push_back(anAttr); } - } else { // all objects with same geometry must be divided into separated sub-attributes + } else { // all objects with same geometry must be divided into separated + // sub-attributes int anInitialSize = size(); - for(int anIndex = 0; anIndex < anInitialSize; anIndex++) { + for (int anIndex = 0; anIndex < anInitialSize; anIndex++) { AttributeSelectionPtr anAttr = value(anIndex); if (!anAttr.get() || !anAttr->context().get()) continue; GeomShapePtr aValue = anAttr->value(); if (!aValue.get() || aValue->shapeType() != GeomAPI_Shape::COMPOUND) continue; - for(GeomAPI_ShapeIterator anIter(aValue); anIter.more(); anIter.next()) { + for (GeomAPI_ShapeIterator anIter(aValue); anIter.more(); anIter.next()) { append(anAttr->context(), anIter.current()); } anIndiciesToRemove.insert(anIndex); @@ -506,18 +528,18 @@ void Model_AttributeSelectionList::setGeometricalSelection(const bool theIsGeome owner()->data()->sendAttributeUpdated(this); } -FiltersFeaturePtr Model_AttributeSelectionList::filters() const -{ +FiltersFeaturePtr Model_AttributeSelectionList::filters() const { Handle(TDataStd_ReferenceList) aRef; if (myLab.FindAttribute(kSELECTION_FILTERS_REF, aRef) && !aRef->IsEmpty()) { if (owner().get()) { - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(owner()->document()); if (aDoc) { - const TDF_Label& aRefLab = aRef->First(); - if (!aRefLab.IsNull()) { // it may happen with old document, issue #285 + const TDF_Label &aRefLab = aRef->First(); + if (!aRefLab.IsNull()) { // it may happen with old document, issue #285 ObjectPtr anObj = aDoc->objects()->object(aRefLab); - FiltersFeaturePtr aFeat = std::dynamic_pointer_cast(anObj); + FiltersFeaturePtr aFeat = + std::dynamic_pointer_cast(anObj); if (aFeat.get()) { aFeat->setAttribute(owner()->data()->attribute(id())); return aFeat; @@ -529,12 +551,13 @@ FiltersFeaturePtr Model_AttributeSelectionList::filters() const return FiltersFeaturePtr(); // null pointer if nothing is defined } -void Model_AttributeSelectionList::setFilters(FiltersFeaturePtr theFeature) -{ - Handle(TDataStd_ReferenceList) aRef = TDataStd_ReferenceList::Set(myLab, kSELECTION_FILTERS_REF); +void Model_AttributeSelectionList::setFilters(FiltersFeaturePtr theFeature) { + Handle(TDataStd_ReferenceList) aRef = + TDataStd_ReferenceList::Set(myLab, kSELECTION_FILTERS_REF); if (theFeature.get()) { - std::shared_ptr aData = std::dynamic_pointer_cast(theFeature->data()); - if (aData->isValid()) { + std::shared_ptr aData = + std::dynamic_pointer_cast(theFeature->data()); + if (aData->isValid()) { TDF_Label anObjLab = aData->label().Father(); // object label if (!aRef->IsEmpty()) aRef->Clear(); diff --git a/src/Model/Model_AttributeSelectionList.h b/src/Model/Model_AttributeSelectionList.h index d43a4b14f..d107ffbe9 100644 --- a/src/Model/Model_AttributeSelectionList.h +++ b/src/Model/Model_AttributeSelectionList.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeSelectionList_H_ @@ -23,10 +24,10 @@ #include "Model.h" #include "Model_AttributeSelection.h" #include -#include #include -#include +#include #include +#include /**\class Model_AttributeSelectionList * \ingroup DataModel @@ -34,38 +35,43 @@ * possibility to manage them. */ -class Model_AttributeSelectionList : public ModelAPI_AttributeSelectionList -{ - TDF_Label myLab; ///< the main label of this attribute - Handle(TDataStd_Integer) mySize; ///< Contains size of this list +class Model_AttributeSelectionList : public ModelAPI_AttributeSelectionList { + TDF_Label myLab; ///< the main label of this attribute + Handle(TDataStd_Integer) mySize; ///< Contains size of this list /// Contains current type name (same as selection attribute) Handle(TDataStd_Comment) mySelectionType; - std::shared_ptr myTmpAttr; ///< temporary attribute (the last one) - /// the cashed shapes to optimize isInList method: from context to set of shapes in this context - std::map > > myCash; + std::shared_ptr + myTmpAttr; ///< temporary attribute (the last one) + /// the cashed shapes to optimize isInList method: from context to set of + /// shapes in this context + std::map>> myCash; bool myIsCashed; ///< true if cashing is performed public: /// Adds the new reference to the end of the list /// \param theContext object where the sub-shape was selected - /// \param theSubShape selected sub-shape (if null, the whole context is selected) - /// \param theTemporarily if it is true, do not store and name the added in the data framework + /// \param theSubShape selected sub-shape (if null, the whole context is + /// selected) \param theTemporarily if it is true, do not store and name the + /// added in the data framework /// (used to remove immediately, without the following updates) - MODEL_EXPORT virtual void append( - const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily = false); - - /// Adds the new reference to the end of the list by the naming name of the selected shape - /// The type of shape is taken from the current selection type if the given is empty - MODEL_EXPORT virtual void append(const std::wstring& theNamingName, - const std::string& theType=""); - - /// Adds the new reference to the end of the list by inner point on the selected shape - MODEL_EXPORT virtual void append(const std::shared_ptr& thePoint, - const std::string& theType); + MODEL_EXPORT virtual void + append(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false); + + /// Adds the new reference to the end of the list by the naming name of the + /// selected shape The type of shape is taken from the current selection type + /// if the given is empty + MODEL_EXPORT virtual void append(const std::wstring &theNamingName, + const std::string &theType = ""); + + /// Adds the new reference to the end of the list by inner point on the + /// selected shape + MODEL_EXPORT virtual void append(const std::shared_ptr &thePoint, + const std::string &theType); /// Adds the new reference to the end of the list by weak naming index - MODEL_EXPORT virtual void append(const std::string& theType, - const std::wstring& theContextName, + MODEL_EXPORT virtual void append(const std::string &theType, + const std::wstring &theContextName, const int theIndex); /// Copy the selection list to the destination attribute @@ -79,19 +85,20 @@ public: /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - MODEL_EXPORT virtual void remove(const std::set& theIndices); + MODEL_EXPORT virtual void remove(const std::set &theIndices); /// Returns the number of selection attributes in the list MODEL_EXPORT virtual int size(); /// Returns true if the object with the shape are in list /// \param theContext object where the sub-shape was selected - /// \param theSubShape selected sub-shape (if null, the whole context is selected) - /// \param theTemporarily if it is true, it checks also the temporary added item - /// \returns true if the pair is found in the attribute - MODEL_EXPORT virtual bool isInList( - const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily = false); + /// \param theSubShape selected sub-shape (if null, the whole context is + /// selected) \param theTemporarily if it is true, it checks also the + /// temporary added item \returns true if the pair is found in the attribute + MODEL_EXPORT virtual bool + isInList(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false); /// The type of all elements selection /// \returns the index of the OCCT enumeration of the type of shape @@ -99,10 +106,11 @@ public: /// Sets the type of all elements selection /// \param theType the index of the OCCT enumeration of the type of shape - MODEL_EXPORT virtual void setSelectionType(const std::string& theType); + MODEL_EXPORT virtual void setSelectionType(const std::string &theType); /// Returns the attribute selection by the index (zero based) - MODEL_EXPORT virtual std::shared_ptr value(const int theIndex); + MODEL_EXPORT virtual std::shared_ptr + value(const int theIndex); /// Returns all attributes MODEL_EXPORT virtual void clear(); @@ -110,17 +118,20 @@ public: /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); - /// Starts or stops cashing of the values in the attribute (the cash may become invalid - /// on modification of the attribute or sub-elements, so the cash must be enabled only - /// during non-modification operations with this attribute) + /// Starts or stops cashing of the values in the attribute (the cash may + /// become invalid on modification of the attribute or sub-elements, so the + /// cash must be enabled only during non-modification operations with this + /// attribute) MODEL_EXPORT virtual void cashValues(const bool theEnabled); - MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override; + MODEL_EXPORT virtual void + setGeometricalSelection(const bool theIsGeometricalSelection) override; /// Returns true if is geometrical selection. MODEL_EXPORT virtual bool isGeometricalSelection() const override; - /// Returns a selection filters feature if it is defined for this selection list + /// Returns a selection filters feature if it is defined for this selection + /// list MODEL_EXPORT virtual FiltersFeaturePtr filters() const; /// Sets a selection filters feature if it is defined for this selection list @@ -128,13 +139,15 @@ public: protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + MODEL_EXPORT Model_AttributeSelectionList(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); - /// Tries to merge attributes in this list with the same result shape. Returns true - /// if theStart matches with some later attribute and theStart is removed from the list. - bool merge(Model_AttributeSelection* theStart); + /// Tries to merge attributes in this list with the same result shape. Returns + /// true if theStart matches with some later attribute and theStart is removed + /// from the list. + bool merge(Model_AttributeSelection *theStart); friend class Model_Data; friend class Model_AttributeSelection; diff --git a/src/Model/Model_AttributeString.cpp b/src/Model/Model_AttributeString.cpp index 6e20020fe..b62e52782 100644 --- a/src/Model/Model_AttributeString.cpp +++ b/src/Model/Model_AttributeString.cpp @@ -14,27 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include #include #include +#include -#include #include #include #include +#include #include // on myLabel if the Unicode string was stored -static const Standard_GUID kUVALUE_IDENTIFIER("04cac509-b2fc-4887-b442-d2a86f2fd7bd"); +static const Standard_GUID + kUVALUE_IDENTIFIER("04cac509-b2fc-4887-b442-d2a86f2fd7bd"); -void Model_AttributeString::setValue(const std::string& theValue) -{ +void Model_AttributeString::setValue(const std::string &theValue) { // Always assume the std::string to be a multi-byte character string // as it can contain accents or other special characters, too! TCollection_ExtendedString aValue(theValue.c_str(), true); @@ -47,8 +48,7 @@ void Model_AttributeString::setValue(const std::string& theValue) } } -void Model_AttributeString::setValue(const std::wstring& theValue) -{ +void Model_AttributeString::setValue(const std::wstring &theValue) { TCollection_ExtendedString aValue(theValue.c_str()); if (!myIsInitialized || myString->Get() != aValue) { if (myString.IsNull()) @@ -59,34 +59,32 @@ void Model_AttributeString::setValue(const std::wstring& theValue) } } -std::string Model_AttributeString::value() -{ +std::string Model_AttributeString::value() { if (myString.IsNull()) - return ""; // not initialized + return ""; // not initialized return TCollection_AsciiString(myString->Get()).ToCString(); } -char16_t* Model_AttributeString::valueU() -{ - if (myString.IsNull()) { // not initialized +char16_t *Model_AttributeString::valueU() { + if (myString.IsNull()) { // not initialized static TCollection_ExtendedString anEmpty; - return (char16_t*)(anEmpty.ToExtString()); + return (char16_t *)(anEmpty.ToExtString()); } - return (char16_t*)(myString->Get().ToExtString()); + return (char16_t *)(myString->Get().ToExtString()); } bool Model_AttributeString::isUValue() const { return !myLab.IsNull() && myLab.IsAttribute(kUVALUE_IDENTIFIER); } -Model_AttributeString::Model_AttributeString(TDF_Label& theLabel) -{ +Model_AttributeString::Model_AttributeString(TDF_Label &theLabel) { myLab = theLabel; reinit(); } -void Model_AttributeString::reinit() -{ - // check the attribute could be already presented in this doc (after load document) - myIsInitialized = myLab.FindAttribute(TDataStd_Name::GetID(), myString) == Standard_True; +void Model_AttributeString::reinit() { + // check the attribute could be already presented in this doc (after load + // document) + myIsInitialized = + myLab.FindAttribute(TDataStd_Name::GetID(), myString) == Standard_True; } diff --git a/src/Model/Model_AttributeString.h b/src/Model/Model_AttributeString.h index d0f702818..a9ce797b7 100644 --- a/src/Model/Model_AttributeString.h +++ b/src/Model/Model_AttributeString.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODEL_ATTRIBUTESTRING_H_ @@ -33,27 +34,27 @@ * \brief Attribute that contains std (null terminated) string. */ -class Model_AttributeString : public ModelAPI_AttributeString -{ +class Model_AttributeString : public ModelAPI_AttributeString { Handle_TDataStd_Name myString; ///< container of the string value TDF_Label myLab; ///< if attribute is not initialized, store label here - public: +public: /// Defines the std::string value - MODEL_EXPORT virtual void setValue(const std::string& theValue); + MODEL_EXPORT virtual void setValue(const std::string &theValue); /// Defines the std::wstring value - MODEL_EXPORT virtual void setValue(const std::wstring& theValue); + MODEL_EXPORT virtual void setValue(const std::wstring &theValue); /// Returns the std::string value MODEL_EXPORT virtual std::string value(); /// Returns a pointer to Unicode string - MODEL_EXPORT virtual char16_t* valueU(); + MODEL_EXPORT virtual char16_t *valueU(); /// Returns true if Unicode string was stored MODEL_EXPORT virtual bool isUValue() const; - protected: +protected: /// Initializes attributes - Model_AttributeString(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_AttributeString(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_Data; diff --git a/src/Model/Model_AttributeStringArray.cpp b/src/Model/Model_AttributeStringArray.cpp index 8a21c2d11..0486b7bc8 100644 --- a/src/Model/Model_AttributeStringArray.cpp +++ b/src/Model/Model_AttributeStringArray.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeStringArray.h" @@ -25,13 +26,12 @@ #include //================================================================================================== -int Model_AttributeStringArray::size() -{ +int Model_AttributeStringArray::size() { if (myArray.IsNull() || !myArray->IsValid()) { // this could be on undo and then redo creation of the attribute // in result creation it may be uninitialized - myIsInitialized = - myLab.FindAttribute(TDataStd_ExtStringArray::GetID(), myArray) == Standard_True; + myIsInitialized = myLab.FindAttribute(TDataStd_ExtStringArray::GetID(), + myArray) == Standard_True; } // checking the validity because attribute (as a field) may be presented, // but without label: it is undoed @@ -39,18 +39,20 @@ int Model_AttributeStringArray::size() } //================================================================================================== -void Model_AttributeStringArray::setSize(const int theSize) -{ - if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet - if (theSize != 0) { // if size is zero, nothing to do (null array means there is no array) +void Model_AttributeStringArray::setSize(const int theSize) { + if (myArray.IsNull() || + !myArray->IsValid()) { // create array if it is not done yet + if (theSize != 0) { // if size is zero, nothing to do (null array means + // there is no array) myArray = TDataStd_ExtStringArray::Set(myLab, 0, theSize - 1); owner()->data()->sendAttributeUpdated(this); } } else { // reset the old array if (theSize) { - if (theSize != myArray->Length()) { // old data is not keept, a new array is created + if (theSize != + myArray->Length()) { // old data is not keept, a new array is created Handle(TColStd_HArray1OfExtendedString) aNewArray = - new TColStd_HArray1OfExtendedString(0, theSize - 1); + new TColStd_HArray1OfExtendedString(0, theSize - 1); myArray->ChangeArray(aNewArray); owner()->data()->sendAttributeUpdated(this); } @@ -66,8 +68,7 @@ void Model_AttributeStringArray::setSize(const int theSize) //================================================================================================== void Model_AttributeStringArray::setValue(const int theIndex, - const std::string theValue) -{ + const std::string theValue) { if (!myArray->Value(theIndex).IsEqual(theValue.c_str())) { myArray->SetValue(theIndex, theValue.c_str()); owner()->data()->sendAttributeUpdated(this); @@ -75,15 +76,13 @@ void Model_AttributeStringArray::setValue(const int theIndex, } //================================================================================================== -std::string Model_AttributeStringArray::value(const int theIndex) -{ +std::string Model_AttributeStringArray::value(const int theIndex) { return TCollection_AsciiString(myArray->Value(theIndex)).ToCString(); } //================================================================================================== -Model_AttributeStringArray::Model_AttributeStringArray(TDF_Label& theLabel) -{ +Model_AttributeStringArray::Model_AttributeStringArray(TDF_Label &theLabel) { myLab = theLabel; - myIsInitialized = - myLab.FindAttribute(TDataStd_ExtStringArray::GetID(), myArray) == Standard_True; + myIsInitialized = myLab.FindAttribute(TDataStd_ExtStringArray::GetID(), + myArray) == Standard_True; } diff --git a/src/Model/Model_AttributeStringArray.h b/src/Model/Model_AttributeStringArray.h index a7fb01c49..6217f62df 100644 --- a/src/Model/Model_AttributeStringArray.h +++ b/src/Model/Model_AttributeStringArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeStringArray_H_ @@ -22,14 +23,14 @@ #include #include -#include #include +#include /// \class Model_AttributeStringArray /// \ingroup DataModel -/// \brief API for the attribute that contains several strings in the array inside. -class Model_AttributeStringArray: public ModelAPI_AttributeStringArray -{ +/// \brief API for the attribute that contains several strings in the array +/// inside. +class Model_AttributeStringArray : public ModelAPI_AttributeStringArray { public: /// Returns the size of the array (zero means that it is empty) MODEL_EXPORT virtual int size(); @@ -46,13 +47,14 @@ public: protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeStringArray(TDF_Label& theLabel); + MODEL_EXPORT Model_AttributeStringArray(TDF_Label &theLabel); private: /// The OCCT array that keeps all values. Handle_TDataStd_ExtStringArray myArray; - /// Stores the label as a field to set array if size is not null (null array is buggy in OCAF) + /// Stores the label as a field to set array if size is not null (null array + /// is buggy in OCAF) TDF_Label myLab; friend class Model_Data; diff --git a/src/Model/Model_AttributeTables.cpp b/src/Model/Model_AttributeTables.cpp index 9d7a6f3ca..acfea2c5e 100644 --- a/src/Model/Model_AttributeTables.cpp +++ b/src/Model/Model_AttributeTables.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeTables.h" @@ -23,42 +24,36 @@ #include #include -#include #include -#include #include +#include +#include -#include #include -#include #include +#include +#include #include // returns the array attribute GUID for the given type -#define MY_ARRAY_ID(type) \ -((type) == ModelAPI_AttributeTables::DOUBLE ? TDataStd_RealArray::GetID(): \ -((type) == ModelAPI_AttributeTables::BOOLEAN ? TDataStd_BooleanArray::GetID(): \ -((type) == ModelAPI_AttributeTables::INTEGER? TDataStd_IntegerArray::GetID(): \ -TDataStd_ExtStringArray::GetID()))) +#define MY_ARRAY_ID(type) \ + ((type) == ModelAPI_AttributeTables::DOUBLE \ + ? TDataStd_RealArray::GetID() \ + : ((type) == ModelAPI_AttributeTables::BOOLEAN \ + ? TDataStd_BooleanArray::GetID() \ + : ((type) == ModelAPI_AttributeTables::INTEGER \ + ? TDataStd_IntegerArray::GetID() \ + : TDataStd_ExtStringArray::GetID()))) -int Model_AttributeTables::rows() -{ - return myRows; -} +int Model_AttributeTables::rows() { return myRows; } -int Model_AttributeTables::columns() -{ - return myCols; -} +int Model_AttributeTables::columns() { return myCols; } -int Model_AttributeTables::tables() -{ - return myTables; -} +int Model_AttributeTables::tables() { return myTables; } -void Model_AttributeTables::setSize(const int theRows, const int theColumns, const int theTables) -{ +void Model_AttributeTables::setSize(const int theRows, const int theColumns, + const int theTables) { if (theRows != myRows || theColumns != myCols || theTables != myTables) { owner()->data()->sendAttributeUpdated(this); int aSize = myRows * myCols * myTables; @@ -70,29 +65,33 @@ void Model_AttributeTables::setSize(const int theRows, const int theColumns, con myLab.ForgetAttribute(MY_ARRAY_ID(myType)); } else { // prepare new arrays - Handle(TColStd_HArray1OfReal) anOldDouble, aNewDouble = - (myType == ModelAPI_AttributeTables::DOUBLE) ? - new TColStd_HArray1OfReal(0, aNewSize - 1) : Handle(TColStd_HArray1OfReal)(); - bool* anOldBool = 0; // an not work with internal arrays because of different indexing + Handle(TColStd_HArray1OfReal) anOldDouble, + aNewDouble = (myType == ModelAPI_AttributeTables::DOUBLE) + ? new TColStd_HArray1OfReal(0, aNewSize - 1) + : Handle(TColStd_HArray1OfReal)(); + bool *anOldBool = + 0; // an not work with internal arrays because of different indexing Handle(TDataStd_BooleanArray) aBoolArray; // an existing array - Handle(TColStd_HArray1OfInteger) anOldInt, aNewInt = - (myType == ModelAPI_AttributeTables::INTEGER) ? - new TColStd_HArray1OfInteger(0, aNewSize - 1) : Handle(TColStd_HArray1OfInteger)(); - Handle(TColStd_HArray1OfExtendedString) anOldStr, aNewStr = - (myType == ModelAPI_AttributeTables::STRING) ? - new TColStd_HArray1OfExtendedString(0, aNewSize - 1) : - Handle(TColStd_HArray1OfExtendedString)(); - if (aSize != 0) { // copy the previous values into new positions, otherwise default values + Handle(TColStd_HArray1OfInteger) anOldInt, + aNewInt = (myType == ModelAPI_AttributeTables::INTEGER) + ? new TColStd_HArray1OfInteger(0, aNewSize - 1) + : Handle(TColStd_HArray1OfInteger)(); + Handle(TColStd_HArray1OfExtendedString) anOldStr, + aNewStr = (myType == ModelAPI_AttributeTables::STRING) + ? new TColStd_HArray1OfExtendedString(0, aNewSize - 1) + : Handle(TColStd_HArray1OfExtendedString)(); + if (aSize != 0) { // copy the previous values into new positions, + // otherwise default values Handle(TDF_Attribute) anArray; myLab.FindAttribute(MY_ARRAY_ID(myType), anArray); - switch(myType) { + switch (myType) { case ModelAPI_AttributeTables::DOUBLE: anOldDouble = Handle(TDataStd_RealArray)::DownCast(anArray)->Array(); break; case ModelAPI_AttributeTables::BOOLEAN: { anOldBool = new bool[aSize]; aBoolArray = Handle(TDataStd_BooleanArray)::DownCast(anArray); - for(int a = 0; a < aSize; a++) + for (int a = 0; a < aSize; a++) anOldBool[a] = aBoolArray->Value(a); aBoolArray->Init(0, aNewSize - 1); break; @@ -101,35 +100,42 @@ void Model_AttributeTables::setSize(const int theRows, const int theColumns, con anOldInt = Handle(TDataStd_IntegerArray)::DownCast(anArray)->Array(); break; case ModelAPI_AttributeTables::STRING: - anOldStr = Handle(TDataStd_ExtStringArray)::DownCast(anArray)->Array(); + anOldStr = + Handle(TDataStd_ExtStringArray)::DownCast(anArray)->Array(); break; } } else if (myType == ModelAPI_AttributeTables::BOOLEAN) { aBoolArray = TDataStd_BooleanArray::Set(myLab, 0, aNewSize - 1); } - for(int aTable = 0; aTable < theTables; aTable++) { - for(int aColumn = 0; aColumn < theColumns; aColumn++) { - for(int aRow = 0; aRow < theRows; aRow++) { + for (int aTable = 0; aTable < theTables; aTable++) { + for (int aColumn = 0; aColumn < theColumns; aColumn++) { + for (int aRow = 0; aRow < theRows; aRow++) { int anOldIndex = 0; - int anIndex = aTable * theRows * theColumns + aRow * theColumns + aColumn; - bool aRestore = aTable < myTables && aColumn < myCols && aRow < myRows; + int anIndex = + aTable * theRows * theColumns + aRow * theColumns + aColumn; + bool aRestore = + aTable < myTables && aColumn < myCols && aRow < myRows; if (aRestore) anOldIndex = aTable * myRows * myCols + aRow * myCols + aColumn; - switch(myType) { + switch (myType) { case ModelAPI_AttributeTables::DOUBLE: { - aNewDouble->SetValue(anIndex, aRestore ? anOldDouble->Value(anOldIndex) : 0.); + aNewDouble->SetValue( + anIndex, aRestore ? anOldDouble->Value(anOldIndex) : 0.); break; } case ModelAPI_AttributeTables::BOOLEAN: { - aBoolArray->SetValue(anIndex, aRestore ? anOldBool[anOldIndex] : Standard_False); + aBoolArray->SetValue(anIndex, aRestore ? anOldBool[anOldIndex] + : Standard_False); break; } case ModelAPI_AttributeTables::INTEGER: { - aNewInt->SetValue(anIndex, aRestore ? anOldInt->Value(anOldIndex) : 0); + aNewInt->SetValue(anIndex, + aRestore ? anOldInt->Value(anOldIndex) : 0); break; } case ModelAPI_AttributeTables::STRING: { - aNewStr->SetValue(anIndex, aRestore ? anOldStr->Value(anOldIndex) : ""); + aNewStr->SetValue(anIndex, + aRestore ? anOldStr->Value(anOldIndex) : ""); break; } } @@ -137,17 +143,21 @@ void Model_AttributeTables::setSize(const int theRows, const int theColumns, con } } // store the new array - switch(myType) { + switch (myType) { case ModelAPI_AttributeTables::DOUBLE: - TDataStd_RealArray::Set(myLab, 0, aNewSize - 1)->ChangeArray(aNewDouble); + TDataStd_RealArray::Set(myLab, 0, aNewSize - 1) + ->ChangeArray(aNewDouble); break; - case ModelAPI_AttributeTables::BOOLEAN: // nothing to do: array was set in "else" of restore + case ModelAPI_AttributeTables::BOOLEAN: // nothing to do: array was set in + // "else" of restore break; case ModelAPI_AttributeTables::INTEGER: - TDataStd_IntegerArray::Set(myLab, 0, aNewSize - 1)->ChangeArray(aNewInt); + TDataStd_IntegerArray::Set(myLab, 0, aNewSize - 1) + ->ChangeArray(aNewInt); break; case ModelAPI_AttributeTables::STRING: - TDataStd_ExtStringArray::Set(myLab, 0, aNewSize - 1)->ChangeArray(aNewStr); + TDataStd_ExtStringArray::Set(myLab, 0, aNewSize - 1) + ->ChangeArray(aNewStr); break; } } @@ -164,8 +174,8 @@ void Model_AttributeTables::setSize(const int theRows, const int theColumns, con } } -void Model_AttributeTables::setType(ModelAPI_AttributeTables::ValueType theType) -{ +void Model_AttributeTables::setType( + ModelAPI_AttributeTables::ValueType theType) { if (myType != theType) { // remove the old attr int aSize = myRows * myCols * myTables; @@ -182,101 +192,107 @@ void Model_AttributeTables::setType(ModelAPI_AttributeTables::ValueType theType) } } -const ModelAPI_AttributeTables::ValueType& Model_AttributeTables::type() const -{ +const ModelAPI_AttributeTables::ValueType &Model_AttributeTables::type() const { return myType; } -void Model_AttributeTables::setValue(const ModelAPI_AttributeTables::Value theValue, - const int theRow, const int theColumn, const int theTable) -{ +void Model_AttributeTables::setValue( + const ModelAPI_AttributeTables::Value theValue, const int theRow, + const int theColumn, const int theTable) { int anIndex = theTable * myRows * myCols + theRow * myCols + theColumn; Handle(TDF_Attribute) anArray; myLab.FindAttribute(MY_ARRAY_ID(myType), anArray); - switch(myType) { + switch (myType) { case ModelAPI_AttributeTables::DOUBLE: { - Handle(TDataStd_RealArray)::DownCast(anArray)->SetValue(anIndex, theValue.myDouble); + Handle(TDataStd_RealArray)::DownCast(anArray)->SetValue(anIndex, + theValue.myDouble); break; } case ModelAPI_AttributeTables::BOOLEAN: { - Handle(TDataStd_BooleanArray)::DownCast(anArray)->SetValue(anIndex, theValue.myBool); + Handle(TDataStd_BooleanArray)::DownCast(anArray)->SetValue(anIndex, + theValue.myBool); break; } case ModelAPI_AttributeTables::INTEGER: { - Handle(TDataStd_IntegerArray)::DownCast(anArray)->SetValue(anIndex, theValue.myInt); + Handle(TDataStd_IntegerArray)::DownCast(anArray)->SetValue(anIndex, + theValue.myInt); break; } case ModelAPI_AttributeTables::STRING: { - Handle(TDataStd_ExtStringArray)::DownCast(anArray)->SetValue(anIndex, theValue.myStr.c_str()); + Handle(TDataStd_ExtStringArray)::DownCast(anArray)->SetValue( + anIndex, theValue.myStr.c_str()); break; } } owner()->data()->sendAttributeUpdated(this); } -ModelAPI_AttributeTables::Value Model_AttributeTables::value( - const int theRow, const int theColumn, const int theTable) -{ +ModelAPI_AttributeTables::Value +Model_AttributeTables::value(const int theRow, const int theColumn, + const int theTable) { ModelAPI_AttributeTables::Value aResult; int anIndex = theTable * myRows * myCols + theRow * myCols + theColumn; Handle(TDF_Attribute) anArray; myLab.FindAttribute(MY_ARRAY_ID(myType), anArray); - switch(myType) { + switch (myType) { case ModelAPI_AttributeTables::DOUBLE: { - aResult.myDouble = Handle(TDataStd_RealArray)::DownCast(anArray)->Value(anIndex); + aResult.myDouble = + Handle(TDataStd_RealArray)::DownCast(anArray)->Value(anIndex); break; } case ModelAPI_AttributeTables::BOOLEAN: { - aResult.myBool = Handle(TDataStd_BooleanArray)::DownCast(anArray)->Value(anIndex) == - Standard_True; + aResult.myBool = Handle(TDataStd_BooleanArray)::DownCast(anArray)->Value( + anIndex) == Standard_True; break; } case ModelAPI_AttributeTables::INTEGER: { - aResult.myInt = Handle(TDataStd_IntegerArray)::DownCast(anArray)->Value(anIndex); + aResult.myInt = + Handle(TDataStd_IntegerArray)::DownCast(anArray)->Value(anIndex); break; } case ModelAPI_AttributeTables::STRING: { - aResult.myStr = TCollection_AsciiString(Handle(TDataStd_ExtStringArray)::DownCast(anArray)-> - Value(anIndex)).ToCString(); + aResult.myStr = + TCollection_AsciiString( + Handle(TDataStd_ExtStringArray)::DownCast(anArray)->Value(anIndex)) + .ToCString(); break; } } return aResult; } -std::string Model_AttributeTables::valueStr( - const int theRow, const int theColumn, const int theTable) -{ +std::string Model_AttributeTables::valueStr(const int theRow, + const int theColumn, + const int theTable) { std::ostringstream aStr; - switch(myType) { + switch (myType) { case ModelAPI_AttributeTables::DOUBLE: - aStr<Append(int(Model_AttributeTables::DOUBLE)); // default diff --git a/src/Model/Model_AttributeTables.h b/src/Model/Model_AttributeTables.h index 10d9e551c..e3816214a 100644 --- a/src/Model/Model_AttributeTables.h +++ b/src/Model/Model_AttributeTables.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeTables_H_ @@ -33,14 +34,14 @@ /// \ingroup DataModel /// \brief API for the attribute that contains tables of some values type. /// -/// The type of values can be changed. But all the values in the tables must have the same one -/// type. The currently allowed types now are: Boolean, Integer, Double, String. -/// By default there is only one table, but it may be increased/decreased by adding/removing -/// tables one by one. -/// The number of rows and columns are equal in all tables. If table, row or column is added, -/// the previous values are kept unchanged. New cells are filled by zero, false or empty strings. -class Model_AttributeTables: public ModelAPI_AttributeTables -{ +/// The type of values can be changed. But all the values in the tables must +/// have the same one type. The currently allowed types now are: Boolean, +/// Integer, Double, String. By default there is only one table, but it may be +/// increased/decreased by adding/removing tables one by one. The number of rows +/// and columns are equal in all tables. If table, row or column is added, the +/// previous values are kept unchanged. New cells are filled by zero, false or +/// empty strings. +class Model_AttributeTables : public ModelAPI_AttributeTables { public: /// Returns the number of rows in the table MODEL_EXPORT virtual int rows(); @@ -49,39 +50,44 @@ public: /// Returns the number of tables MODEL_EXPORT virtual int tables(); - /// Sets the new size of the tables set. This method tries to keep old values if number of - /// rows, columns or tables is increased. - MODEL_EXPORT virtual void setSize( - const int theRows, const int theColumns, const int theTables = 1); + /// Sets the new size of the tables set. This method tries to keep old values + /// if number of rows, columns or tables is increased. + MODEL_EXPORT virtual void setSize(const int theRows, const int theColumns, + const int theTables = 1); - /// Defines the tyoe of values in the table. If it differs from the current, erases the content. + /// Defines the tyoe of values in the table. If it differs from the current, + /// erases the content. MODEL_EXPORT virtual void setType(ValueType theType); - /// Defines the tyoe of values in the table. If it differs from the current, erases the content. - MODEL_EXPORT virtual const ValueType& type() const; + /// Defines the tyoe of values in the table. If it differs from the current, + /// erases the content. + MODEL_EXPORT virtual const ValueType &type() const; /// Defines the value by the index in the tables set (indexes are zero-based). - MODEL_EXPORT virtual void setValue( - const Value theValue, const int theRow, const int theColumn, const int theTable = 0); + MODEL_EXPORT virtual void setValue(const Value theValue, const int theRow, + const int theColumn, + const int theTable = 0); /// Returns the value by the index (indexes are zero-based). - MODEL_EXPORT virtual Value value( - const int theRow, const int theColumn, const int theTable = 0); + MODEL_EXPORT virtual Value value(const int theRow, const int theColumn, + const int theTable = 0); - /// Returns the value in the format of string (usefull for the python connection) - MODEL_EXPORT virtual std::string valueStr( - const int theRow, const int theColumn, const int theTable = 0); + /// Returns the value in the format of string (usefull for the python + /// connection) + MODEL_EXPORT virtual std::string + valueStr(const int theRow, const int theColumn, const int theTable = 0); protected: /// Objects are created for features automatically - MODEL_EXPORT Model_AttributeTables(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + MODEL_EXPORT Model_AttributeTables(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); private: /// The OCCT array that keeps all values. Indexes are computed as: /// TableNum * NbRows * NbColumns + RowNum * NbColumns + ColNum - //Handle_TDF_Attribute myArray; + // Handle_TDF_Attribute myArray; - /// Container that stores properties of the tables set: type, nbtables, nbrows, nbcolumns - /// If sizes are zero, myArray IsNull and vice-versa + /// Container that stores properties of the tables set: type, nbtables, + /// nbrows, nbcolumns If sizes are zero, myArray IsNull and vice-versa Handle_TDataStd_IntegerList myProp; /// cashed main properties diff --git a/src/Model/Model_AttributeValidator.cpp b/src/Model/Model_AttributeValidator.cpp index ec4e754ae..2b7265655 100644 --- a/src/Model/Model_AttributeValidator.cpp +++ b/src/Model/Model_AttributeValidator.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_AttributeValidator.h" @@ -23,18 +24,18 @@ #include #include -#include -#include #include #include +#include +#include #include #include -bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool Model_AttributeValidator::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) { AttributeIntegerPtr anAttribue = std::dynamic_pointer_cast(theAttribute); @@ -43,8 +44,8 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, theError.arg(anAttribue->expressionError()); return false; } - } else - if (theAttribute->attributeType() == ModelAPI_AttributeDouble::typeId()) { + } else if (theAttribute->attributeType() == + ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttribue = std::dynamic_pointer_cast(theAttribute); if (!anAttribue->expressionError().empty()) { @@ -52,64 +53,72 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, theError.arg(anAttribue->expressionError()); return false; } - } else - if (theAttribute->attributeType() == GeomDataAPI_Point::typeId()) { + } else if (theAttribute->attributeType() == GeomDataAPI_Point::typeId()) { AttributePointPtr anAttribue = std::dynamic_pointer_cast(theAttribute); - const char* aComponent[] = {"X", "Y", "Z"}; + const char *aComponent[] = {"X", "Y", "Z"}; std::string anErrorMessage; for (int i = 0; i < 3; ++i) { if (!anAttribue->expressionError(i).empty()) - anErrorMessage.append("\n").append(aComponent[i]) - .append(": ").append(anAttribue->expressionError(i)); + anErrorMessage.append("\n") + .append(aComponent[i]) + .append(": ") + .append(anAttribue->expressionError(i)); } if (!anErrorMessage.empty()) { theError = "Expression error: %1"; theError.arg(anErrorMessage); return false; } - } else - if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { + } else if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { AttributePoint2DPtr anAttribue = std::dynamic_pointer_cast(theAttribute); - const char* aComponent[] = {"X", "Y"}; + const char *aComponent[] = {"X", "Y"}; std::string anErrorMessage; for (int i = 0; i < 2; ++i) { if (!anAttribue->expressionError(i).empty()) - anErrorMessage.append("\n").append(aComponent[i]) - .append(": ").append(anAttribue->expressionError(i)); + anErrorMessage.append("\n") + .append(aComponent[i]) + .append(": ") + .append(anAttribue->expressionError(i)); } if (!anErrorMessage.empty()) { theError = "Expression error: %1"; theError.arg(anErrorMessage); return false; } - } else { // #2903 : check that concealed attribute refers to already concealed result - FeaturePtr aFeat = std::dynamic_pointer_cast(theAttribute->owner()); + } else { // #2903 : check that concealed attribute refers to already concealed + // result + FeaturePtr aFeat = + std::dynamic_pointer_cast(theAttribute->owner()); std::set alreadyProcessed; // optimization - if (aFeat.get() && - ModelAPI_Session::get()->validators()->isConcealed(aFeat->getKind(), theAttribute->id())) { - std::list > > allRefs; + if (aFeat.get() && ModelAPI_Session::get()->validators()->isConcealed( + aFeat->getKind(), theAttribute->id())) { + std::list>> allRefs; aFeat->data()->referencesToObjects(allRefs); - std::list > >::iterator anIter = allRefs.begin(); - for(; anIter != allRefs.end(); anIter++) { + std::list>>::iterator anIter = + allRefs.begin(); + for (; anIter != allRefs.end(); anIter++) { if (anIter->first == theAttribute->id()) { - const std::list& aReferencedList = anIter->second; - std::list::const_iterator aRefIter = aReferencedList.cbegin(); - for(; aRefIter != aReferencedList.cend(); aRefIter++) { - const ObjectPtr& aReferenced = *aRefIter; + const std::list &aReferencedList = anIter->second; + std::list::const_iterator aRefIter = + aReferencedList.cbegin(); + for (; aRefIter != aReferencedList.cend(); aRefIter++) { + const ObjectPtr &aReferenced = *aRefIter; if (!aReferenced.get()) continue; - // get all results and feature that is referenced to see all references to them + // get all results and feature that is referenced to see all + // references to them FeaturePtr aReferencedFeature; if (aReferenced->groupName() == ModelAPI_Feature::group()) { - aReferencedFeature = std::dynamic_pointer_cast(aReferenced); + aReferencedFeature = + std::dynamic_pointer_cast(aReferenced); } else { aReferencedFeature = aReferenced->document()->feature( - std::dynamic_pointer_cast(aReferenced)); + std::dynamic_pointer_cast(aReferenced)); } if (alreadyProcessed.count(aReferencedFeature)) continue; @@ -119,8 +128,10 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, ModelAPI_Tools::allResults(aReferencedFeature, aReferencedResults); */ std::list aReferencedResults; - ResultBodyPtr aRefBody = std::dynamic_pointer_cast(aReferenced); - if (aRefBody.get()) { // take only sub-results of this result or sub-result + ResultBodyPtr aRefBody = + std::dynamic_pointer_cast(aReferenced); + if (aRefBody.get()) { // take only sub-results of this result or + // sub-result ResultBodyPtr aRoot = ModelAPI_Tools::bodyOwner(aRefBody, true); if (aRoot.get()) { ModelAPI_Tools::allSubs(aRoot, aReferencedResults, false); @@ -130,14 +141,16 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, } std::list::iterator aRefRes = aReferencedResults.begin(); - bool aCheckFeature = true; // the last iteration to check the feature - while(aRefRes != aReferencedResults.end() || aCheckFeature) { + bool aCheckFeature = + true; // the last iteration to check the feature + while (aRefRes != aReferencedResults.end() || aCheckFeature) { ObjectPtr aRefd; if (aRefRes == aReferencedResults.end()) { aRefd = aReferencedFeature; aCheckFeature = false; if (!aReferencedFeature->results().empty() && - aReferencedFeature->firstResult()->groupName() != ModelAPI_ResultBody::group()) + aReferencedFeature->firstResult()->groupName() != + ModelAPI_ResultBody::group()) break; } else { aRefd = *aRefRes; @@ -146,16 +159,21 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, } if (!aRefd->data().get() || !aRefd->data()->isValid()) continue; - const std::set& aRefsToRef = aRefd->data()->refsToMe(); + const std::set &aRefsToRef = + aRefd->data()->refsToMe(); std::set::const_iterator aRR = aRefsToRef.cbegin(); - for(; aRR != aRefsToRef.cend(); aRR++) { - FeaturePtr aRefFeat = std::dynamic_pointer_cast((*aRR)->owner()); + for (; aRR != aRefsToRef.cend(); aRR++) { + FeaturePtr aRefFeat = + std::dynamic_pointer_cast( + (*aRR)->owner()); if (!aRefFeat.get() || aRefFeat == aFeat) continue; if (ModelAPI_Session::get()->validators()->isConcealed( - aRefFeat->getKind(), (*aRR)->id())) { - // check this feature is later than another referenced to make unit tests working - //because of Test1757 and others: allow to move selection context of this to next + aRefFeat->getKind(), (*aRR)->id())) { + // check this feature is later than another referenced to make + // unit tests working + // because of Test1757 and others: allow to move selection + // context of this to next if (aFeat->document()->isLater(aFeat, aRefFeat)) { theError = "Reference to concealed object %1"; theError.arg(aRefd->data()->name()); diff --git a/src/Model/Model_AttributeValidator.h b/src/Model/Model_AttributeValidator.h index 5cb37b308..533b92e6e 100644 --- a/src/Model/Model_AttributeValidator.h +++ b/src/Model/Model_AttributeValidator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_AttributeValidator_H @@ -27,19 +28,19 @@ * \ingroup DataModel * \brief The geneneric validator for the attribute. * - * Can be redefined for some specific attributes, but by default for each attribute this validator is - * used: it checks the argument and if it contains invalid expression the attribute is invalid. + * Can be redefined for some specific attributes, but by default for each + * attribute this validator is used: it checks the argument and if it contains + * invalid expression the attribute is invalid. */ -class Model_AttributeValidator : public ModelAPI_AttributeValidator -{ +class Model_AttributeValidator : public ModelAPI_AttributeValidator { public: /// \param theAttribute the checked attribute /// \param theArguments arguments of the attribute - /// \param theError erros message produced by validator to the user if it fails - /// \returns true if attribute is valid - MODEL_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + /// \param theError erros message produced by validator to the user if it + /// fails \returns true if attribute is valid + MODEL_EXPORT virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif // Model_AttributeValidator_H diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index eaea11a1a..f37caa256 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -14,102 +14,108 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include #include #include -#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // DEB //#include //#define DEB_IMPORT 1 /// reference to the shape in external document: sting list attribute identifier -static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd"); +static const Standard_GUID + kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd"); -static const int INVALID_TAG = -1; +static const int INVALID_TAG = -1; static const int GENERATED_VERTICES_TAG = 1; -static const int GENERATED_EDGES_TAG = 2; -static const int GENERATED_FACES_TAG = 3; -static const int MODIFIED_VERTICES_TAG = 4; -static const int MODIFIED_EDGES_TAG = 5; -static const int MODIFIED_FACES_TAG = 6; -static const int DELETED_TAG = 7; -static const int PRIMITIVES_START_TAG = 11; - -static int getGenerationTag(const TopoDS_Shape& theShape) { +static const int GENERATED_EDGES_TAG = 2; +static const int GENERATED_FACES_TAG = 3; +static const int MODIFIED_VERTICES_TAG = 4; +static const int MODIFIED_EDGES_TAG = 5; +static const int MODIFIED_FACES_TAG = 6; +static const int DELETED_TAG = 7; +static const int PRIMITIVES_START_TAG = 11; + +static int getGenerationTag(const TopoDS_Shape &theShape) { TopAbs_ShapeEnum aShapeType = theShape.ShapeType(); switch (aShapeType) { - case TopAbs_VERTEX: return GENERATED_VERTICES_TAG; - case TopAbs_EDGE: return GENERATED_EDGES_TAG; - case TopAbs_FACE: return GENERATED_FACES_TAG; - default: break; // [to avoid compilation warning] + case TopAbs_VERTEX: + return GENERATED_VERTICES_TAG; + case TopAbs_EDGE: + return GENERATED_EDGES_TAG; + case TopAbs_FACE: + return GENERATED_FACES_TAG; + default: + break; // [to avoid compilation warning] } return INVALID_TAG; } -static int getModificationTag(const TopoDS_Shape& theShape) { +static int getModificationTag(const TopoDS_Shape &theShape) { TopAbs_ShapeEnum aShapeType = theShape.ShapeType(); switch (aShapeType) { - case TopAbs_VERTEX: return MODIFIED_VERTICES_TAG; - case TopAbs_EDGE: return MODIFIED_EDGES_TAG; - case TopAbs_FACE: return MODIFIED_FACES_TAG; - default: break; // [to avoid compilation warning] + case TopAbs_VERTEX: + return MODIFIED_VERTICES_TAG; + case TopAbs_EDGE: + return MODIFIED_EDGES_TAG; + case TopAbs_FACE: + return MODIFIED_FACES_TAG; + default: + break; // [to avoid compilation warning] } return INVALID_TAG; } -static bool isAlreadyStored(const TNaming_Builder* theBuilder, - const TopoDS_Shape& theOldShape, - const TopoDS_Shape& theNewShape) -{ - for (TNaming_Iterator aNamingIt(theBuilder->NamedShape()); - aNamingIt.More(); - aNamingIt.Next()) - { - if (aNamingIt.NewShape().IsSame(theNewShape) - && aNamingIt.OldShape().IsSame(theOldShape)) - { +static bool isAlreadyStored(const TNaming_Builder *theBuilder, + const TopoDS_Shape &theOldShape, + const TopoDS_Shape &theNewShape) { + for (TNaming_Iterator aNamingIt(theBuilder->NamedShape()); aNamingIt.More(); + aNamingIt.Next()) { + if (aNamingIt.NewShape().IsSame(theNewShape) && + aNamingIt.OldShape().IsSame(theOldShape)) { return true; } } @@ -117,21 +123,19 @@ static bool isAlreadyStored(const TNaming_Builder* theBuilder, return false; } -Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object* theOwner) -: ModelAPI_BodyBuilder(theOwner), - myFreePrimitiveTag(PRIMITIVES_START_TAG) -{ +Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object *theOwner) + : ModelAPI_BodyBuilder(theOwner), myFreePrimitiveTag(PRIMITIVES_START_TAG) { } /// Checks that shape is presented in the tree with not-selection evolution /// In theOriginalLabel it returns label where NS of old sub-shape is stored -static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAccess2, - TopoDS_Shape theShape, TDF_Label& theOriginalLabel) -{ +static bool isShapeInTree(const TDF_Label &theAccess1, + const TDF_Label &theAccess2, TopoDS_Shape theShape, + TDF_Label &theOriginalLabel) { bool aResult = TNaming_Tool::HasLabel(theAccess1, theShape); - if (aResult) { //check evolution and a label of this shape - for(TNaming_SameShapeIterator aShapes(theShape, theAccess1); aShapes.More(); aShapes.Next()) - { + if (aResult) { // check evolution and a label of this shape + for (TNaming_SameShapeIterator aShapes(theShape, theAccess1); + aShapes.More(); aShapes.Next()) { Handle(TNaming_NamedShape) aNS; if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) { if (aNS->Evolution() != TNaming_SELECTED) { @@ -149,9 +153,10 @@ static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAcces } /// Stores entry to the external label in the entries list at this label -static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label theThis) -{ - // store information about the external document reference to restore old shape on open +static void storeExternalReference(const TDF_Label &theExternal, + const TDF_Label theThis) { + // store information about the external document reference to restore old + // shape on open if (!theExternal.IsNull() && !theExternal.Root().IsEqual(theThis.Root())) { Handle(TDataStd_ExtStringList) anEntries; if (!theThis.FindAttribute(kEXTERNAL_SHAPE_REF, anEntries)) { @@ -161,7 +166,7 @@ static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label TDF_Tool::Entry(theExternal, anEntry); // check it already contains this entry TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List()); - for(; anIter.More(); anIter.Next()) + for (; anIter.More(); anIter.Next()) if (anIter.Value() == anEntry) break; if (!anIter.More()) { @@ -170,10 +175,10 @@ static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label } } -void Model_BodyBuilder::store(const GeomShapePtr& theShape, - const bool theIsStoreSameShapes) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_BodyBuilder::store(const GeomShapePtr &theShape, + const bool theIsStoreSameShapes) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData) { TDF_Label aShapeLab = aData->shapeLab(); // clean builders @@ -181,17 +186,18 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape, // store the new shape as primitive TNaming_Builder aBuilder(aShapeLab); if (!theShape) - return; // bad shape + return; // bad shape TopoDS_Shape aShape = theShape->impl(); if (aShape.IsNull()) - return; // null shape inside + return; // null shape inside - if(!theIsStoreSameShapes) { + if (!theIsStoreSameShapes) { Handle(TNaming_NamedShape) aNS; if (TNaming_Tool::HasLabel(aShapeLab, aShape)) aNS = TNaming_Tool::NamedShape(aShape, aShapeLab); - // the last condition is for the issue 2751 : existing shape may be found in compound-NS - if(!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) { + // the last condition is for the issue 2751 : existing shape may be found + // in compound-NS + if (!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) { // This shape is already in document, store reference instead of shape; const TDF_Label aFoundLabel = aNS->Label(); TDF_Reference::Set(aShapeLab, aFoundLabel); @@ -203,13 +209,15 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape, aBuilder.Generated(aShape); // register name aShapeLab.ForgetAttribute(TDF_Reference::GetID()); - if(!aBuilder.NamedShape()->IsEmpty()) { + if (!aBuilder.NamedShape()->IsEmpty()) { Handle(TDataStd_Name) anAttr; - if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { - std::wstring aName = Locale::Convert::toWString(anAttr->Get().ToExtString()); - if(!aName.empty()) { + if (aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), + anAttr)) { + std::wstring aName = + Locale::Convert::toWString(anAttr->Get().ToExtString()); + if (!aName.empty()) { std::shared_ptr aDoc = - std::dynamic_pointer_cast(document()); + std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); } } @@ -217,51 +225,61 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape, } } -void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape, - const GeomShapePtr& theToShape, const bool theIsCleanStored) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_BodyBuilder::storeGenerated(const GeomShapePtr &theFromShape, + const GeomShapePtr &theToShape, + const bool theIsCleanStored) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData) { // clean builders if (theIsCleanStored) clean(); - TNaming_Builder* aBuilder = builder(0); + TNaming_Builder *aBuilder = builder(0); if (!theFromShape || !theToShape) - return; // bad shape + return; // bad shape TopoDS_Shape aShapeBasis = theFromShape->impl(); if (aShapeBasis.IsNull()) - return; // null shape inside + return; // null shape inside TopoDS_Shape aShapeNew = theToShape->impl(); if (aShapeNew.IsNull()) - return; // null shape inside + return; // null shape inside - // There is no sense to write history if old shape does not exist in the document. + // There is no sense to write history if old shape does not exist in the + // document. TDF_Label anAccess2 = std::dynamic_pointer_cast( - ModelAPI_Session::get()->moduleDocument())->generalLabel(); + ModelAPI_Session::get()->moduleDocument()) + ->generalLabel(); TDF_Label anOriginalLabel; - if (!isShapeInTree(aData->shapeLab(), anAccess2, aShapeBasis, anOriginalLabel)) { - if (aBuilder->NamedShape()->Get().IsNull()) { // store as primitive if alone anyway + if (!isShapeInTree(aData->shapeLab(), anAccess2, aShapeBasis, + anOriginalLabel)) { + if (aBuilder->NamedShape() + ->Get() + .IsNull()) { // store as primitive if alone anyway aBuilder->Generated(aShapeNew); } } else { - if (aBuilder->NamedShape()->Evolution() == TNaming_PRIMITIVE) { // erase primitive before + if (aBuilder->NamedShape()->Evolution() == + TNaming_PRIMITIVE) { // erase primitive before myBuilders.erase(0); aBuilder = builder(0); } aBuilder->Generated(aShapeBasis, aShapeNew); - // store information about the external document reference to restore old shape on open + // store information about the external document reference to restore old + // shape on open storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label()); } // register name - if(!aBuilder->NamedShape()->IsEmpty()) { + if (!aBuilder->NamedShape()->IsEmpty()) { Handle(TDataStd_Name) anAttr; - if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { - std::wstring aName = Locale::Convert::toWString(anAttr->Get().ToExtString()); - if(!aName.empty()) { + if (aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), + anAttr)) { + std::wstring aName = + Locale::Convert::toWString(anAttr->Get().ToExtString()); + if (!aName.empty()) { std::shared_ptr aDoc = - std::dynamic_pointer_cast(document()); + std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder->NamedShape()->Label(), aName); } } @@ -269,13 +287,15 @@ void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape, } } -void Model_BodyBuilder::storeGenerated(const std::list& theFromShapes, - const GeomShapePtr& theToShape, const std::shared_ptr theMakeShape) -{ +void Model_BodyBuilder::storeGenerated( + const std::list &theFromShapes, + const GeomShapePtr &theToShape, + const std::shared_ptr theMakeShape) { bool aStored = false; std::list::const_iterator anOldIter = theFromShapes.cbegin(); for (; anOldIter != theFromShapes.cend(); anOldIter++) { - bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || (*anOldIter)->isWire(); + bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || + (*anOldIter)->isWire(); if (!aStore) { ListOfShape aNews; // check this old really generates theToShape theMakeShape->generated(*anOldIter, aNews); @@ -288,7 +308,7 @@ void Model_BodyBuilder::storeGenerated(const std::list& theFromSha } if (aStore) { storeGenerated(*anOldIter, theToShape, !aStored); - TNaming_Builder* aBuilder = builder(0); + TNaming_Builder *aBuilder = builder(0); aStored = !aBuilder->NamedShape()->IsEmpty(); } } @@ -298,15 +318,14 @@ void Model_BodyBuilder::storeGenerated(const std::list& theFromSha } } -static TDF_Label builderLabel(DataPtr theData, const int theTag ) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(theData); +static TDF_Label builderLabel(DataPtr theData, const int theTag) { + std::shared_ptr aData = + std::dynamic_pointer_cast(theData); return theTag == 0 ? aData->shapeLab() : aData->shapeLab().FindChild(theTag); } -TNaming_Builder* Model_BodyBuilder::builder(const int theTag) -{ - std::map::iterator aFind = myBuilders.find(theTag); +TNaming_Builder *Model_BodyBuilder::builder(const int theTag) { + std::map::iterator aFind = myBuilders.find(theTag); if (aFind == myBuilders.end()) { myBuilders[theTag] = new TNaming_Builder(builderLabel(data(), theTag)); aFind = myBuilders.find(theTag); @@ -314,34 +333,40 @@ TNaming_Builder* Model_BodyBuilder::builder(const int theTag) return aFind->second; } -void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const bool theIsCleanStored) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_BodyBuilder::storeModified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const bool theIsCleanStored) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData) { // clean builders - if (theIsCleanStored) clean(); - TNaming_Builder* aBuilder = builder(0); + if (theIsCleanStored) + clean(); + TNaming_Builder *aBuilder = builder(0); if (!theOldShape || !theNewShape) - return; // bad shape + return; // bad shape TopoDS_Shape aShapeOld = theOldShape->impl(); if (aShapeOld.IsNull()) - return; // null shape inside + return; // null shape inside TopoDS_Shape aShapeNew = theNewShape->impl(); if (aShapeNew.IsNull()) - return; // null shape inside + return; // null shape inside - // There is no sense to write history if old shape does not exist in the document. + // There is no sense to write history if old shape does not exist in the + // document. TDF_Label anAccess2 = std::dynamic_pointer_cast( - ModelAPI_Session::get()->moduleDocument())->generalLabel(); + ModelAPI_Session::get()->moduleDocument()) + ->generalLabel(); TDF_Label anOriginalLabel; TopTools_ListOfShape anOldList; - if (!isShapeInTree(aData->shapeLab(), anAccess2, aShapeOld, anOriginalLabel)) { + if (!isShapeInTree(aData->shapeLab(), anAccess2, aShapeOld, + anOriginalLabel)) { // check this could be a compund by the whole feature selection - if (aShapeOld.ShapeType() == TopAbs_COMPOUND) { - for(TopoDS_Iterator aCompIter(aShapeOld); aCompIter.More(); aCompIter.Next()) { - if (isShapeInTree(aData->shapeLab(), anAccess2, aCompIter.Value(), anOriginalLabel)) { + if (aShapeOld.ShapeType() == TopAbs_COMPOUND) { + for (TopoDS_Iterator aCompIter(aShapeOld); aCompIter.More(); + aCompIter.Next()) { + if (isShapeInTree(aData->shapeLab(), anAccess2, aCompIter.Value(), + anOriginalLabel)) { anOldList.Append(aCompIter.Value()); } else { anOldList.Clear(); @@ -353,29 +378,35 @@ void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape, anOldList.Append(aShapeOld); } if (anOldList.IsEmpty()) { - if (aBuilder->NamedShape()->Get().IsNull()) { // store as primitive if alone anyway + if (aBuilder->NamedShape() + ->Get() + .IsNull()) { // store as primitive if alone anyway aBuilder->Generated(aShapeNew); } } else { - if (aBuilder->NamedShape()->Evolution() == TNaming_PRIMITIVE) { // erase primitive before + if (aBuilder->NamedShape()->Evolution() == + TNaming_PRIMITIVE) { // erase primitive before myBuilders.erase(0); aBuilder = builder(0); } TopTools_ListIteratorOfListOfShape anOldIter(anOldList); - for(; anOldIter.More(); anOldIter.Next()) { + for (; anOldIter.More(); anOldIter.Next()) { aBuilder->Modify(anOldIter.Value(), aShapeNew); } - // store information about the external document reference to restore old shape on open + // store information about the external document reference to restore old + // shape on open storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label()); } - if(!aBuilder->NamedShape()->IsEmpty()) { + if (!aBuilder->NamedShape()->IsEmpty()) { Handle(TDataStd_Name) anAttr; - if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) { - std::wstring aName = Locale::Convert::toWString(anAttr->Get().ToExtString()); - if(!aName.empty()) { + if (aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), + anAttr)) { + std::wstring aName = + Locale::Convert::toWString(anAttr->Get().ToExtString()); + if (!aName.empty()) { std::shared_ptr aDoc = - std::dynamic_pointer_cast(document()); + std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder->NamedShape()->Label(), aName); } } @@ -383,20 +414,21 @@ void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape, } } -void Model_BodyBuilder::storeModified(const std::list& theOldShapes, - const GeomShapePtr& theNewShape, const std::shared_ptr theMakeShape) -{ +void Model_BodyBuilder::storeModified( + const std::list &theOldShapes, + const GeomShapePtr &theNewShape, + const std::shared_ptr theMakeShape) { bool aStored = false; std::list::const_iterator anOldIter = theOldShapes.cbegin(); - for(; anOldIter != theOldShapes.cend(); anOldIter++) { + for (; anOldIter != theOldShapes.cend(); anOldIter++) { // compounds may cause crash if call "modified" - bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || (*anOldIter)->isWire() || - (*anOldIter)->isCompSolid(); + bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || + (*anOldIter)->isWire() || (*anOldIter)->isCompSolid(); if (!aStore) { ListOfShape aNews; // check this old really modifies theNewShape theMakeShape->modified(*anOldIter, aNews); ListOfShape::iterator aNewIter = aNews.begin(); - for(; aNewIter != aNews.end(); aNewIter++) { + for (; aNewIter != aNews.end(); aNewIter++) { if (theNewShape->isSame(*aNewIter)) break; } @@ -404,20 +436,23 @@ void Model_BodyBuilder::storeModified(const std::list& theOldShape } if (aStore) { storeModified(*anOldIter, theNewShape, !aStored); - TNaming_Builder* aBuilder = builder(0); + TNaming_Builder *aBuilder = builder(0); aStored = !aBuilder->NamedShape()->IsEmpty(); } } if (!aStored) { - // check the new shape is already in the tree, so, no need to store primitive, just reference - std::shared_ptr aData = std::dynamic_pointer_cast(data()); + // check the new shape is already in the tree, so, no need to store + // primitive, just reference + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get()) { TDF_Label aShapeLab = aData->shapeLab(); TopoDS_Shape aShapeNew = theNewShape->impl(); Handle(TNaming_NamedShape) aNS; if (TNaming_Tool::HasLabel(aShapeLab, aShapeNew)) aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab); - // the last condition is for the issue 2751 : existing shape may be found in compound-NS + // the last condition is for the issue 2751 : existing shape may be found + // in compound-NS if (!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShapeNew)) { // This shape is already in document, store reference instead of shape; const TDF_Label aFoundLabel = aNS->Label(); @@ -432,13 +467,12 @@ void Model_BodyBuilder::storeModified(const std::list& theOldShape } } -void Model_BodyBuilder::clean() -{ +void Model_BodyBuilder::clean() { TDF_Label aLab = std::dynamic_pointer_cast(data())->shapeLab(); if (aLab.IsNull()) return; - std::map::iterator aBuilder = myBuilders.begin(); - for(; aBuilder != myBuilders.end(); aBuilder++) { + std::map::iterator aBuilder = myBuilders.begin(); + for (; aBuilder != myBuilders.end(); aBuilder++) { Handle(TNaming_NamedShape) aNS = aBuilder->second->NamedShape(); delete aBuilder->second; if (!aNS.IsNull() && !aNS->Label().IsNull()) @@ -450,44 +484,50 @@ void Model_BodyBuilder::clean() aLab.ForgetAttribute(TDF_Reference::GetID()); myFreePrimitiveTag = PRIMITIVES_START_TAG; TDF_ChildIDIterator anEntriesIter(aLab, kEXTERNAL_SHAPE_REF, true); - for(; anEntriesIter.More(); anEntriesIter.Next()) { + for (; anEntriesIter.More(); anEntriesIter.Next()) { anEntriesIter.Value()->Label().ForgetAttribute(kEXTERNAL_SHAPE_REF); } } -void Model_BodyBuilder::cleanCash() -{ - myPrimitivesNamesIndexMap.clear(); -} +void Model_BodyBuilder::cleanCash() { myPrimitivesNamesIndexMap.clear(); } -Model_BodyBuilder::~Model_BodyBuilder() -{ - clean(); -} +Model_BodyBuilder::~Model_BodyBuilder() { clean(); } -void Model_BodyBuilder::buildName(const int theTag, const std::string& theName) -{ +void Model_BodyBuilder::buildName(const int theTag, + const std::string &theName) { std::string aName = theName; std::string aPrefix = ""; switch (theTag) { - case GENERATED_VERTICES_TAG: aPrefix = aName.empty() ? "Generated_Vertex" : "GV:"; break; - case GENERATED_EDGES_TAG: aPrefix = aName.empty() ? "Generated_Edge" : "GE:"; break; - case GENERATED_FACES_TAG: aPrefix = aName.empty() ? "Generated_Face" : "GF:"; break; - case MODIFIED_VERTICES_TAG: aPrefix = aName.empty() ? "Modified_Vertex" : "MV:"; break; - case MODIFIED_EDGES_TAG: aPrefix = aName.empty() ? "Modified_Edge" : "ME:"; break; - case MODIFIED_FACES_TAG: aPrefix = aName.empty() ? "Modified_Face" : "MF:"; break; + case GENERATED_VERTICES_TAG: + aPrefix = aName.empty() ? "Generated_Vertex" : "GV:"; + break; + case GENERATED_EDGES_TAG: + aPrefix = aName.empty() ? "Generated_Edge" : "GE:"; + break; + case GENERATED_FACES_TAG: + aPrefix = aName.empty() ? "Generated_Face" : "GF:"; + break; + case MODIFIED_VERTICES_TAG: + aPrefix = aName.empty() ? "Modified_Vertex" : "MV:"; + break; + case MODIFIED_EDGES_TAG: + aPrefix = aName.empty() ? "Modified_Edge" : "ME:"; + break; + case MODIFIED_FACES_TAG: + aPrefix = aName.empty() ? "Modified_Face" : "MF:"; + break; } aName.insert(0, aPrefix); TDataStd_Name::Set(builderLabel(data(), theTag), aName.c_str()); } -bool Model_BodyBuilder::generated(const GeomShapePtr& theNewShape, - const std::string& theName, - const bool theCheckIsInResult) -{ +bool Model_BodyBuilder::generated(const GeomShapePtr &theNewShape, + const std::string &theName, + const bool theCheckIsInResult) { GeomShapePtr aResultShape = shape(); if (theCheckIsInResult) { - bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(theNewShape, false); + bool aNewShapeIsNotInResultShape = + !aResultShape->isSubShape(theNewShape, false); if (aNewShapeIsNotInResultShape) { return false; } @@ -497,15 +537,15 @@ bool Model_BodyBuilder::generated(const GeomShapePtr& theNewShape, builder(myFreePrimitiveTag)->Generated(aShape); if (!theName.empty()) { std::string aName = theName; - if (myPrimitivesNamesIndexMap.find(theName) != myPrimitivesNamesIndexMap.end()) { - IndexTags& anIndexTags = myPrimitivesNamesIndexMap.find(theName)->second; + if (myPrimitivesNamesIndexMap.find(theName) != + myPrimitivesNamesIndexMap.end()) { + IndexTags &anIndexTags = myPrimitivesNamesIndexMap.find(theName)->second; aName += "_" + std::to_string(++(anIndexTags.index)); anIndexTags.tags.push_back(myFreePrimitiveTag); if (anIndexTags.index == 2) { buildName(anIndexTags.tags.front(), theName + "_1"); } - } - else { + } else { IndexTags anIndexTags; anIndexTags.index = 1; anIndexTags.tags.push_back(myFreePrimitiveTag); @@ -518,88 +558,91 @@ bool Model_BodyBuilder::generated(const GeomShapePtr& theNewShape, return true; } -void Model_BodyBuilder::generated(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName) -{ +void Model_BodyBuilder::generated(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName) { TopoDS_Shape anOldShape = theOldShape->impl(); TopoDS_Shape aNewShape = theNewShape->impl(); TopAbs_ShapeEnum aNewShapeType = aNewShape.ShapeType(); int aTag; if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) { - // TODO: This is a workaround. New shape should be only vertex, edge or face. - TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; - aTag = aNewShapeType == TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG; - for (TopExp_Explorer anExp(aNewShape, aShapeTypeToExplore); anExp.More(); anExp.Next()) { + // TODO: This is a workaround. New shape should be only vertex, edge or + // face. + TopAbs_ShapeEnum aShapeTypeToExplore = + aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; + aTag = aNewShapeType == TopAbs_WIRE ? GENERATED_EDGES_TAG + : GENERATED_FACES_TAG; + for (TopExp_Explorer anExp(aNewShape, aShapeTypeToExplore); anExp.More(); + anExp.Next()) { builder(aTag)->Generated(anOldShape, anExp.Current()); } buildName(aTag, theName); } else { aTag = getGenerationTag(aNewShape); - if (aTag == INVALID_TAG) return; + if (aTag == INVALID_TAG) + return; builder(aTag)->Generated(anOldShape, aNewShape); buildName(aTag, theName); } } -void Model_BodyBuilder::modified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName) -{ +void Model_BodyBuilder::modified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName) { TopoDS_Shape anOldShape = theOldShape->impl(); TopoDS_Shape aNewShape = theNewShape->impl(); int aTag = getModificationTag(aNewShape); - if (aTag == INVALID_TAG) return; + if (aTag == INVALID_TAG) + return; builder(aTag)->Modify(anOldShape, aNewShape); buildName(aTag, theName); } -void Model_BodyBuilder::loadDeletedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const GeomShapePtr& theShapesToExclude) -{ +void Model_BodyBuilder::loadDeletedShapes( + const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const GeomShapePtr &theShapesToExclude) { TopTools_MapOfShape anAlreadyProcessedShapes; GeomShapePtr aResultShape = shape(); for (GeomAPI_ShapeExplorer anExp(theOldShape, theShapeTypeToExplore); - anExp.more(); - anExp.next()) - { + anExp.more(); anExp.next()) { GeomShapePtr anOldSubShape = anExp.current(); - const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl(); - if (!anAlreadyProcessedShapes.Add(anOldSubShape_) - || !theAlgo->isDeleted(anOldSubShape) - || aResultShape->isSubShape(anOldSubShape, false) - || (theShapesToExclude.get() && theShapesToExclude->isSubShape(anOldSubShape, false))) - { + const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl(); + if (!anAlreadyProcessedShapes.Add(anOldSubShape_) || + !theAlgo->isDeleted(anOldSubShape) || + aResultShape->isSubShape(anOldSubShape, false) || + (theShapesToExclude.get() && + theShapesToExclude->isSubShape(anOldSubShape, false))) { continue; } ListOfShape aNewShapes; - if (BRepTools_History::IsSupportedType(anOldSubShape_)) { // to avoid crash in #2572 + if (BRepTools_History::IsSupportedType( + anOldSubShape_)) { // to avoid crash in #2572 theAlgo->modified(anOldSubShape, aNewShapes); } - if (aNewShapes.size() == 0 - || (aNewShapes.size() == 1 && aNewShapes.front()->isSame(anOldSubShape))) { + if (aNewShapes.size() == 0 || + (aNewShapes.size() == 1 && aNewShapes.front()->isSame(anOldSubShape))) { builder(DELETED_TAG)->Delete(anOldSubShape_); } } } // Keep only the shapes with minimal shape type -static void keepTopLevelShapes(ListOfShape& theShapes, - const TopoDS_Shape& theRoot, - const GeomShapePtr& theResultShape = GeomShapePtr()) -{ +static void +keepTopLevelShapes(ListOfShape &theShapes, const TopoDS_Shape &theRoot, + const GeomShapePtr &theResultShape = GeomShapePtr()) { GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE; ListOfShape::iterator anIt = theShapes.begin(); while (anIt != theShapes.end()) { TopoDS_Shape aNewShape = (*anIt)->impl(); - bool aSkip = aNewShape.IsNull() || - (aNewShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aNewShape))); - if (aSkip || theRoot.IsSame(aNewShape) || (theResultShape && - (!theResultShape->isSubShape(*anIt, false) || theResultShape->isSame(*anIt)))) { + bool aSkip = + aNewShape.IsNull() || (aNewShape.ShapeType() == TopAbs_EDGE && + BRep_Tool::Degenerated(TopoDS::Edge(aNewShape))); + if (aSkip || theRoot.IsSame(aNewShape) || + (theResultShape && (!theResultShape->isSubShape(*anIt, false) || + theResultShape->isSame(*anIt)))) { ListOfShape::iterator aRemoveIt = anIt++; theShapes.erase(aRemoveIt); } else { @@ -619,38 +662,39 @@ static void keepTopLevelShapes(ListOfShape& theShapes, } } -void Model_BodyBuilder::loadModifiedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName) -{ +void Model_BodyBuilder::loadModifiedShapes( + const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName) { GeomShapePtr aResultShape = shape(); GeomShapePtr aShapeToExplore = theOldShape; if (theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore)) { // use optimized set of old shapes for this - GeomShapePtr aCompound = theAlgo->oldShapesForNew(theOldShape, - aResultShape, + GeomShapePtr aCompound = theAlgo->oldShapesForNew(theOldShape, aResultShape, theShapeTypeToExplore); - if (aCompound.get()) aShapeToExplore = aCompound; + if (aCompound.get()) + aShapeToExplore = aCompound; } TopTools_MapOfShape anAlreadyProcessedShapes; - std::shared_ptr aData = std::dynamic_pointer_cast(data()); - for (GeomAPI_ShapeExplorer anOldShapeExp(aShapeToExplore, theShapeTypeToExplore); - anOldShapeExp.more(); - anOldShapeExp.next()) - { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); + for (GeomAPI_ShapeExplorer anOldShapeExp(aShapeToExplore, + theShapeTypeToExplore); + anOldShapeExp.more(); anOldShapeExp.next()) { GeomShapePtr anOldSubShape = anOldShapeExp.current(); - const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl(); + const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl(); // There is no sense to write history if shape already processed // or old shape does not exist in the document. - bool anOldSubShapeAlreadyProcessed = !anAlreadyProcessedShapes.Add(anOldSubShape_); + bool anOldSubShapeAlreadyProcessed = + !anAlreadyProcessedShapes.Add(anOldSubShape_); TDF_Label anAccess2 = std::dynamic_pointer_cast( - ModelAPI_Session::get()->moduleDocument())->generalLabel(); + ModelAPI_Session::get()->moduleDocument()) + ->generalLabel(); TDF_Label anOriginalLabel; - bool anOldSubShapeNotInTree = - !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel); + bool anOldSubShapeNotInTree = !isShapeInTree( + aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel); if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) { continue; } @@ -660,63 +704,66 @@ void Model_BodyBuilder::loadModifiedShapes(const GeomMakeShapePtr& theAlgo, theAlgo->modified(anOldSubShape, aNewShapes); for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin(); - aNewShapesIt != aNewShapes.cend(); - ++aNewShapesIt) - { + aNewShapesIt != aNewShapes.cend(); ++aNewShapesIt) { GeomShapePtr aNewShape = *aNewShapesIt; - const TopoDS_Shape& aNewShape_ = aNewShape->impl(); + const TopoDS_Shape &aNewShape_ = aNewShape->impl(); bool isGenerated = anOldSubShape_.ShapeType() != aNewShape_.ShapeType(); bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape); - bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false); + bool aNewShapeIsNotInResultShape = + !aResultShape->isSubShape(aNewShape, false); if (aNewShapeIsSameAsOldShape || aNewShapeIsNotInResultShape) continue; if (aResultShape->isSame(aNewShape)) - continue; // it is stored on the root level (2241 - history propagation issue) + continue; // it is stored on the root level (2241 - history propagation + // issue) - int aTag = isGenerated ? getGenerationTag(aNewShape_) : getModificationTag(aNewShape_); - TNaming_Builder*aBuilder = builder(aTag); + int aTag = isGenerated ? getGenerationTag(aNewShape_) + : getModificationTag(aNewShape_); + TNaming_Builder *aBuilder = builder(aTag); if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue; // new shape was already stored. buildName(aTag, theName); isGenerated ? aBuilder->Generated(anOldSubShape_, aNewShape_) : aBuilder->Modify(anOldSubShape_, aNewShape_); - // store information about the external document reference to restore old shape on open + // store information about the external document reference to restore old + // shape on open storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label()); } } } -void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName, - const bool theSaveOldIfNotInTree) -{ +void Model_BodyBuilder::loadGeneratedShapes( + const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName, const bool theSaveOldIfNotInTree) { GeomShapePtr aResultShape = shape(); TopTools_MapOfShape anAlreadyProcessedShapes; - std::shared_ptr aData = std::dynamic_pointer_cast(data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); for (GeomAPI_ShapeExplorer anOldShapeExp(theOldShape, theShapeTypeToExplore); - anOldShapeExp.more(); - anOldShapeExp.next()) - { + anOldShapeExp.more(); anOldShapeExp.next()) { GeomShapePtr anOldSubShape = anOldShapeExp.current(); - const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl(); + const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl(); // There is no sense to write history if shape already processed // or old shape does not exist in the document. - bool anOldSubShapeAlreadyProcessed = !anAlreadyProcessedShapes.Add(anOldSubShape_); + bool anOldSubShapeAlreadyProcessed = + !anAlreadyProcessedShapes.Add(anOldSubShape_); TDF_Label anAccess2 = std::dynamic_pointer_cast( - ModelAPI_Session::get()->moduleDocument())->generalLabel(); + ModelAPI_Session::get()->moduleDocument()) + ->generalLabel(); TDF_Label anOriginalLabel; - bool anOldSubShapeNotInTree = - !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel); + bool anOldSubShapeNotInTree = !isShapeInTree( + aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel); if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) { - // The second condition is added due to #20170 because sub-shape must be added to real parent - // shape, not the reference. The naming name of pure reference is not registered in document. - if (theSaveOldIfNotInTree && !aData->shapeLab().IsAttribute(TDF_Reference::GetID())) { + // The second condition is added due to #20170 because sub-shape must be + // added to real parent shape, not the reference. The naming name of pure + // reference is not registered in document. + if (theSaveOldIfNotInTree && + !aData->shapeLab().IsAttribute(TDF_Reference::GetID())) { std::string aSelectionName = theName + "Selected"; generated(anOldSubShape, aSelectionName, false); } else @@ -730,14 +777,13 @@ void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, keepTopLevelShapes(aNewShapes, anOldSubShape_); for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin(); - aNewShapesIt != aNewShapes.cend(); - ++aNewShapesIt) - { + aNewShapesIt != aNewShapes.cend(); ++aNewShapesIt) { GeomShapePtr aNewShape = *aNewShapesIt; - const TopoDS_Shape& aNewShape_ = aNewShape->impl(); + const TopoDS_Shape &aNewShape_ = aNewShape->impl(); bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape); - bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false); + bool aNewShapeIsNotInResultShape = + !aResultShape->isSubShape(aNewShape, false); if (aNewShapeIsSameAsOldShape || aNewShapeIsNotInResultShape) { continue; } @@ -748,21 +794,26 @@ void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, TopAbs_ShapeEnum aNewShapeType = aNewShape_.ShapeType(); if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) { // TODO: This is a workaround. New shape should be only edge or face. - TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE - : TopAbs_FACE; - int aTag = aNewShapeType == TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG; - for (TopExp_Explorer anExp(aNewShape_, aShapeTypeToExplore); anExp.More(); anExp.Next()) { + TopAbs_ShapeEnum aShapeTypeToExplore = + aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; + int aTag = aNewShapeType == TopAbs_WIRE ? GENERATED_EDGES_TAG + : GENERATED_FACES_TAG; + for (TopExp_Explorer anExp(aNewShape_, aShapeTypeToExplore); + anExp.More(); anExp.Next()) { builder(aTag)->Generated(anOldSubShape_, anExp.Current()); - // store information about the external document reference to restore old shape on open + // store information about the external document reference to restore + // old shape on open storeExternalReference(anOriginalLabel, builderLabel(data(), aTag)); } buildName(aTag, theName); } else { int aTag = getGenerationTag(aNewShape_); - if (aTag == INVALID_TAG) return; + if (aTag == INVALID_TAG) + return; builder(aTag)->Generated(anOldSubShape_, aNewShape_); buildName(aTag, theName); - // store information about the external document reference to restore old shape on open + // store information about the external document reference to restore + // old shape on open storeExternalReference(anOriginalLabel, builderLabel(data(), aTag)); } } @@ -771,33 +822,37 @@ void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, // LCOV_EXCL_START //======================================================================= -int getDangleShapes(const TopoDS_Shape& theShapeIn, - const TopAbs_ShapeEnum theGeneratedFrom, - TopTools_DataMapOfShapeShape& theDangles) -{ +int getDangleShapes(const TopoDS_Shape &theShapeIn, + const TopAbs_ShapeEnum theGeneratedFrom, + TopTools_DataMapOfShapeShape &theDangles) { theDangles.Clear(); TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors; TopAbs_ShapeEnum GeneratedTo; - if (theGeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE; - else if (theGeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX; - else return Standard_False; - TopExp::MapShapesAndAncestors(theShapeIn, GeneratedTo, theGeneratedFrom, subShapeAndAncestors); + if (theGeneratedFrom == TopAbs_FACE) + GeneratedTo = TopAbs_EDGE; + else if (theGeneratedFrom == TopAbs_EDGE) + GeneratedTo = TopAbs_VERTEX; + else + return Standard_False; + TopExp::MapShapesAndAncestors(theShapeIn, GeneratedTo, theGeneratedFrom, + subShapeAndAncestors); for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) { - const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i); - const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i); - if (ancestors.Extent() == 1) theDangles.Bind(ancestors.First(), mayBeDangle); + const TopoDS_Shape &mayBeDangle = subShapeAndAncestors.FindKey(i); + const TopTools_ListOfShape &ancestors = + subShapeAndAncestors.FindFromIndex(i); + if (ancestors.Extent() == 1) + theDangles.Bind(ancestors.First(), mayBeDangle); } return theDangles.Extent(); } //======================================================================= -void loadGeneratedDangleShapes( - const TopoDS_Shape& theShapeIn, - const TopAbs_ShapeEnum theGeneratedFrom, - TNaming_Builder * theBuilder) -{ +void loadGeneratedDangleShapes(const TopoDS_Shape &theShapeIn, + const TopAbs_ShapeEnum theGeneratedFrom, + TNaming_Builder *theBuilder) { TopTools_DataMapOfShapeShape dangles; - if (!getDangleShapes(theShapeIn, theGeneratedFrom, dangles)) return; + if (!getDangleShapes(theShapeIn, theGeneratedFrom, dangles)) + return; TopTools_DataMapIteratorOfDataMapOfShapeShape itr(dangles); for (; itr.More(); itr.Next()) theBuilder->Generated(itr.Key(), itr.Value()); @@ -806,55 +861,64 @@ void loadGeneratedDangleShapes( //======================================================================= void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, - const std::string& theName) -{ - if(theShape->isNull()) return; + const std::string &theName) { + if (theShape->isNull()) + return; TopoDS_Shape aShape = theShape->impl(); std::string aName; if (aShape.ShapeType() == TopAbs_SOLID) { TopExp_Explorer expl(aShape, TopAbs_FACE); for (; expl.More(); expl.Next()) { builder(myFreePrimitiveTag)->Generated(expl.Current()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; } - } - else if (aShape.ShapeType() == TopAbs_SHELL || aShape.ShapeType() == TopAbs_FACE) { + } else if (aShape.ShapeType() == TopAbs_SHELL || + aShape.ShapeType() == TopAbs_FACE) { // load faces and all the free edges TopTools_IndexedMapOfShape Faces; TopExp::MapShapes(aShape, TopAbs_FACE, Faces); - if (Faces.Extent() > 1 || (aShape.ShapeType() == TopAbs_SHELL && Faces.Extent() == 1)) { + if (Faces.Extent() > 1 || + (aShape.ShapeType() == TopAbs_SHELL && Faces.Extent() == 1)) { TopExp_Explorer expl(aShape, TopAbs_FACE); for (; expl.More(); expl.Next()) { builder(myFreePrimitiveTag)->Generated(expl.Current()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; } } TopTools_IndexedDataMapOfShapeListOfShape anEdgeAndNeighbourFaces; - TopExp::MapShapesAndAncestors(aShape, TopAbs_EDGE, TopAbs_FACE, anEdgeAndNeighbourFaces); - for (Standard_Integer i = 1; i <= anEdgeAndNeighbourFaces.Extent(); i++) - { - const TopTools_ListOfShape& aLL = anEdgeAndNeighbourFaces.FindFromIndex(i); + TopExp::MapShapesAndAncestors(aShape, TopAbs_EDGE, TopAbs_FACE, + anEdgeAndNeighbourFaces); + for (Standard_Integer i = 1; i <= anEdgeAndNeighbourFaces.Extent(); i++) { + const TopTools_ListOfShape &aLL = + anEdgeAndNeighbourFaces.FindFromIndex(i); if (aLL.Extent() < 2) { - if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeAndNeighbourFaces.FindKey(i)))) + if (BRep_Tool::Degenerated( + TopoDS::Edge(anEdgeAndNeighbourFaces.FindKey(i)))) continue; - builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i)); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + builder(myFreePrimitiveTag) + ->Generated(anEdgeAndNeighbourFaces.FindKey(i)); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; } else { TopTools_ListIteratorOfListOfShape anIter(aLL); - const TopoDS_Face& aFace = TopoDS::Face(anIter.Value()); + const TopoDS_Face &aFace = TopoDS::Face(anIter.Value()); anIter.Next(); - if(aFace.IsEqual(anIter.Value())) { - builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i)); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + if (aFace.IsEqual(anIter.Value())) { + builder(myFreePrimitiveTag) + ->Generated(anEdgeAndNeighbourFaces.FindKey(i)); + TCollection_AsciiString aStr(myFreePrimitiveTag - + PRIMITIVES_START_TAG + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; @@ -869,7 +933,8 @@ void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, TopExp_Explorer expl(aShape, TopAbs_VERTEX); for (; expl.More(); expl.Next()) { builder(myFreePrimitiveTag)->Generated(expl.Current()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; @@ -878,16 +943,16 @@ void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, TopExp_Explorer expl(aShape, TopAbs_EDGE); for (; expl.More(); expl.Next()) { builder(myFreePrimitiveTag)->Generated(expl.Current()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; } // and load generated vertices. TopTools_DataMapOfShapeShape generated; - if (getDangleShapes(aShape, TopAbs_EDGE, generated)) - { - TNaming_Builder* pBuilder = builder(myFreePrimitiveTag++); + if (getDangleShapes(aShape, TopAbs_EDGE, generated)) { + TNaming_Builder *pBuilder = builder(myFreePrimitiveTag++); loadGeneratedDangleShapes(aShape, TopAbs_EDGE, pBuilder); } } @@ -895,7 +960,8 @@ void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, TopExp_Explorer expl(aShape, TopAbs_VERTEX); for (; expl.More(); expl.Next()) { builder(myFreePrimitiveTag)->Generated(expl.Current()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; @@ -904,45 +970,52 @@ void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, } //======================================================================= -int findAmbiguities(const TopoDS_Shape& theShapeIn, - TopTools_ListOfShape& theList) -{ +int findAmbiguities(const TopoDS_Shape &theShapeIn, + TopTools_ListOfShape &theList) { theList.Clear(); // edges -> ancestor faces list TopTools_IndexedDataMapOfShapeListOfShape aSubShapeAndAncestors; - TopExp::MapShapesAndAncestors(theShapeIn, TopAbs_EDGE, TopAbs_FACE, aSubShapeAndAncestors); + TopExp::MapShapesAndAncestors(theShapeIn, TopAbs_EDGE, TopAbs_FACE, + aSubShapeAndAncestors); // keeps the shapes which are already in the resulting list TopTools_MapOfShape alreadyThere; - // map from faces identifier (combination of hash-codes) to list of edges produced such ID - NCollection_DataMap > aFacesIDs; + // map from faces identifier (combination of hash-codes) to list of edges + // produced such ID + NCollection_DataMap> aFacesIDs; - TopTools_IndexedDataMapOfShapeListOfShape::Iterator anAncestorsIter(aSubShapeAndAncestors); + TopTools_IndexedDataMapOfShapeListOfShape::Iterator anAncestorsIter( + aSubShapeAndAncestors); for (; anAncestorsIter.More(); anAncestorsIter.Next()) { - const TopTools_ListOfShape& ancestors = anAncestorsIter.Value(); + const TopTools_ListOfShape &ancestors = anAncestorsIter.Value(); if (ancestors.Extent() < 2) continue; Standard_Integer anID = 0; - for(TopTools_ListIteratorOfListOfShape aFaceIt(ancestors); aFaceIt.More(); aFaceIt.Next()) { + for (TopTools_ListIteratorOfListOfShape aFaceIt(ancestors); aFaceIt.More(); + aFaceIt.Next()) { anID ^= HashCode(aFaceIt.ChangeValue(), 1990657); // Pierpont prime } - if (aFacesIDs.IsBound(anID)) { // there found same edge, check they really have same faces - const NCollection_List& aSameFaces1 = - aSubShapeAndAncestors.FindFromKey(anAncestorsIter.Key()); - NCollection_List::Iterator aSameEdge(aFacesIDs.ChangeFind(anID)); - for(; aSameEdge.More(); aSameEdge.Next()) { - const NCollection_List& aSameFaces2 = - aSubShapeAndAncestors.FindFromKey(aSameEdge.Value()); - if (aSameFaces2.Extent() != aSameFaces1.Extent()) // the number of faces is different + if (aFacesIDs.IsBound( + anID)) { // there found same edge, check they really have same faces + const NCollection_List &aSameFaces1 = + aSubShapeAndAncestors.FindFromKey(anAncestorsIter.Key()); + NCollection_List::Iterator aSameEdge( + aFacesIDs.ChangeFind(anID)); + for (; aSameEdge.More(); aSameEdge.Next()) { + const NCollection_List &aSameFaces2 = + aSubShapeAndAncestors.FindFromKey(aSameEdge.Value()); + if (aSameFaces2.Extent() != + aSameFaces1.Extent()) // the number of faces is different break; NCollection_List::Iterator aFaceIter1(aSameFaces1); - for(; aFaceIter1.More(); aFaceIter1.Next()) { + for (; aFaceIter1.More(); aFaceIter1.Next()) { NCollection_List::Iterator aFaceIter2(aSameFaces2); - for(; aFaceIter2.More(); aFaceIter2.Next()) { + for (; aFaceIter2.More(); aFaceIter2.Next()) { if (aFaceIter1.Value().IsSame(aFaceIter2.Value())) break; } - if (!aFaceIter2.More()) // aFaceIter1 contains a face, which is not in aFaceIter2 + if (!aFaceIter2.More()) // aFaceIter1 contains a face, which is not in + // aFaceIter2 break; } if (!aFaceIter1.More()) { // all the faces are same => put to the result @@ -955,14 +1028,15 @@ int findAmbiguities(const TopoDS_Shape& theShapeIn, } else { // ID is unique, just add this edge aFacesIDs.Bind(anID, NCollection_List()); } - aFacesIDs.ChangeFind(anID).Append(anAncestorsIter.Key()); // add to the list anyway + aFacesIDs.ChangeFind(anID).Append( + anAncestorsIter.Key()); // add to the list anyway } return theList.Extent(); } //======================================================================= -void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& theName) -{ +void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, + const std::string &theName) { GeomShapePtr aShapePtr = shape(); if (theShape->isNull() || !aShapePtr.get()) return; @@ -970,17 +1044,18 @@ void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& if (aShape.IsNull()) return; std::string aName; - if (aShape.ShapeType() == TopAbs_COMPOUND || aShape.ShapeType() == TopAbs_COMPSOLID) { + if (aShape.ShapeType() == TopAbs_COMPOUND || + aShape.ShapeType() == TopAbs_COMPSOLID) { TopoDS_Iterator itr(aShape); for (; itr.More(); itr.Next()) { builder(myFreePrimitiveTag)->Generated(itr.Value()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); ++myFreePrimitiveTag; if (itr.Value().ShapeType() == TopAbs_COMPOUND || - itr.Value().ShapeType() == TopAbs_COMPSOLID) - { + itr.Value().ShapeType() == TopAbs_COMPSOLID) { GeomShapePtr itrShape(new GeomAPI_Shape()); itrShape->setImpl(new TopoDS_Shape(itr.Value())); loadFirstLevel(itrShape, theName); @@ -995,21 +1070,22 @@ void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& itrShape->setImpl(new TopoDS_Shape(aShape)); loadNextLevels(itrShape, theName); } - TopTools_ListOfShape aList; - if(findAmbiguities(aShape, aList)) { + TopTools_ListOfShape aList; + if (findAmbiguities(aShape, aList)) { TopTools_ListIteratorOfListOfShape it(aList); for (; it.More(); it.Next(), ++myFreePrimitiveTag) { builder(myFreePrimitiveTag)->Generated(it.Value()); - TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); + TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + + 1); aName = theName + "_" + aStr.ToCString(); buildName(myFreePrimitiveTag, aName); } } } -GeomShapePtr Model_BodyBuilder::shape() -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +GeomShapePtr Model_BodyBuilder::shape() { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData && aData->isValid()) { TDF_Label aShapeLab = aData->shapeLab(); Handle(TDF_Reference) aRef; diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index cc543f2b7..6a3588cea 100644 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_BodyBuilder_H_ @@ -23,8 +24,8 @@ #include "Model.h" #include -#include #include +#include #include class TNaming_Builder; @@ -33,113 +34,125 @@ class TNaming_Builder; * \ingroup DataModel * \brief Extra API for the ResultBody that allows to work with naming. */ -class Model_BodyBuilder : public ModelAPI_BodyBuilder -{ - /// builders that store the naming history: one per label to allow store several shapes to one - /// label; index in vector corresponds to the label tag - std::map myBuilders; +class Model_BodyBuilder : public ModelAPI_BodyBuilder { + /// builders that store the naming history: one per label to allow store + /// several shapes to one label; index in vector corresponds to the label tag + std::map myBuilders; + public: /// Stores the shape (called by the execution method). - MODEL_EXPORT virtual void store(const GeomShapePtr& theShape, - const bool theIsStoreSameShapes = true) override; + MODEL_EXPORT virtual void + store(const GeomShapePtr &theShape, + const bool theIsStoreSameShapes = true) override; /// Stores the generated shape (called by the execution method). - MODEL_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape, - const GeomShapePtr& theToShape, - const bool theIsCleanStored = true) override; + MODEL_EXPORT virtual void + storeGenerated(const GeomShapePtr &theFromShape, + const GeomShapePtr &theToShape, + const bool theIsCleanStored = true) override; /// Stores the root generated shapes (called by the execution method). - MODEL_EXPORT virtual void storeGenerated(const std::list& theFromShapes, - const GeomShapePtr& theToShape, - const std::shared_ptr theMakeShape) override; + MODEL_EXPORT virtual void storeGenerated( + const std::list &theFromShapes, + const GeomShapePtr &theToShape, + const std::shared_ptr theMakeShape) override; /// Stores the modified shape (called by the execution method). /// \param theOldShape shape that produces result /// \param theNewShape resulting shape - /// \param theIsCleanStored erases all previous data structure of this body if true - MODEL_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const bool theIsCleanStored = true) override; + /// \param theIsCleanStored erases all previous data structure of this body if + /// true + MODEL_EXPORT virtual void + storeModified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const bool theIsCleanStored = true) override; /// Stores the root modified shape (called by the execution method). /// \param theOldShapes all shapes that produce result /// \param theNewShape resulting shape - /// \param theIsCleanStored erases all previous data structure of this body if true - MODEL_EXPORT virtual void storeModified(const std::list& theOldShapes, - const GeomShapePtr& theNewShape, - const std::shared_ptr theMakeShape) override; + /// \param theIsCleanStored erases all previous data structure of this body if + /// true + MODEL_EXPORT virtual void storeModified( + const std::list &theOldShapes, + const GeomShapePtr &theNewShape, + const std::shared_ptr theMakeShape) override; /// Returns the shape-result produced by this feature MODEL_EXPORT virtual GeomShapePtr shape(); - /// Records the subshape newShape which was generated during a topological construction. - /// As an example, consider the case of a face generated in construction of a box. - /// Returns true if it is stored correctly (the final shape contains this new sub-shape) - MODEL_EXPORT virtual bool generated(const GeomShapePtr& theNewShape, - const std::string& theName, const bool theCheckIsInResult = true) override; - - /// Records the shape newShape which was generated from the shape oldShape during a topological - /// construction. As an example, consider the case of a face generated from an edge in - /// construction of a prism. - MODEL_EXPORT virtual void generated(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName = "") override; - + /// Records the subshape newShape which was generated during a topological + /// construction. As an example, consider the case of a face generated in + /// construction of a box. Returns true if it is stored correctly (the final + /// shape contains this new sub-shape) + MODEL_EXPORT virtual bool + generated(const GeomShapePtr &theNewShape, const std::string &theName, + const bool theCheckIsInResult = true) override; + + /// Records the shape newShape which was generated from the shape oldShape + /// during a topological construction. As an example, consider the case of a + /// face generated from an edge in construction of a prism. + MODEL_EXPORT virtual void generated(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = "") override; /// Records the shape newShape which is a modification of the shape oldShape. - /// As an example, consider the case of a face split or merged in a Boolean operation. - MODEL_EXPORT virtual void modified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName = "") override; + /// As an example, consider the case of a face split or merged in a Boolean + /// operation. + MODEL_EXPORT virtual void modified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = "") override; /// load deleted shapes MODEL_EXPORT - virtual void loadDeletedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const GeomShapePtr& theShapesToExclude = GeomShapePtr()) override; + virtual void loadDeletedShapes( + const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const GeomShapePtr &theShapesToExclude = GeomShapePtr()) override; /// load and orient modified shapes MODEL_EXPORT - virtual void loadModifiedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "") override; + virtual void + loadModifiedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "") override; /// load and orient generated shapes MODEL_EXPORT - virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "", - const bool theSaveOldIfNotInTree = false) override; + virtual void + loadGeneratedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "", + const bool theSaveOldIfNotInTree = false) override; /// Loads shapes of the first level (to be used during shape import) MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, - const std::string& theName) override; + const std::string &theName) override; /// Removes the stored builders MODEL_EXPORT virtual ~Model_BodyBuilder(); /// Cleans cash related to the already stored elements MODEL_EXPORT virtual void cleanCash() override; + protected: /// Default constructor accessible only by Model_Objects - Model_BodyBuilder(ModelAPI_Object* theOwner); + Model_BodyBuilder(ModelAPI_Object *theOwner); /// Removes the stored builders void clean(); - /// Returns (creates if necessary) the builder created on the needed tag of sub-label - TNaming_Builder* builder(const int theTag); + /// Returns (creates if necessary) the builder created on the needed tag of + /// sub-label + TNaming_Builder *builder(const int theTag); private: /// Loads shapes of the next level (to be used during shape import) - void loadNextLevels(GeomShapePtr theShape, - const std::string& theName); + void loadNextLevels(GeomShapePtr theShape, const std::string &theName); /// builds name for the shape kept at the specified tag - void buildName(const int theTag, const std::string& theName); + void buildName(const int theTag, const std::string &theName); private: struct IndexTags { diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 70a0a3487..8d5234d46 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -14,26 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include #include -#include #include #include -#include +#include +#include +#include #include -#include #include -#include -#include -#include +#include +#include #include #include -#include -#include +#include +#include #include +#include #include #include #include @@ -41,37 +42,37 @@ #include #include -#include #include -#include -#include +#include #include +#include #include +#include #include #include #include +#include +#include +#include #include #include #include -#include -#include -#include #include -#include +#include #include +#include #include -#include #include // myLab contains: // TDataStd_Name - name of the object -// TDataStd_IntegerArray - state of the object execution, transaction ID of update -// TDataStd_BooleanArray - array of flags of this data: +// TDataStd_IntegerArray - state of the object execution, transaction ID of +// update TDataStd_BooleanArray - array of flags of this data: // 0 - is in history or not static const int kFlagInHistory = 0; // 1 - is displayed or not @@ -80,37 +81,39 @@ static const int kFlagDisplayed = 1; static const int kFlagDeleted = 2; // TDataStd_Integer - 0 if the name of the object is generated automatically, // otherwise the name is defined by user -static const Standard_GUID kUSER_DEFINED_NAME("9c694d18-a83c-4a56-bc9b-8020628a8244"); +static const Standard_GUID + kUSER_DEFINED_NAME("9c694d18-a83c-4a56-bc9b-8020628a8244"); // invalid data const static std::shared_ptr kInvalid(new Model_Data()); -static const Standard_GUID kGroupAttributeGroupID("df64ea4c-fc42-4bf8-ad7e-08f7a54bf1b8"); -static const Standard_GUID kGroupAttributeID("ebdcb22a-e045-455b-9a7f-cfd38d68e185"); +static const Standard_GUID + kGroupAttributeGroupID("df64ea4c-fc42-4bf8-ad7e-08f7a54bf1b8"); +static const Standard_GUID + kGroupAttributeID("ebdcb22a-e045-455b-9a7f-cfd38d68e185"); // id of attribute to store the version of the feature static const Standard_GUID kVERSION_ID("61cdb78a-1ba7-4942-976f-63bea7f4a2b1"); +Model_Data::Model_Data() + : mySendAttributeUpdated(true), myWasChangedButBlocked(false) {} -Model_Data::Model_Data() : mySendAttributeUpdated(true), myWasChangedButBlocked(false) -{ -} - -void Model_Data::setLabel(TDF_Label theLab) -{ +void Model_Data::setLabel(TDF_Label theLab) { myLab = theLab; // set or get the default flags if (!myLab.FindAttribute(TDataStd_BooleanArray::GetID(), myFlags)) { // set default values if not found myFlags = TDataStd_BooleanArray::Set(myLab, 0, 2); - myFlags->SetValue(kFlagInHistory, Standard_True); // is in history by default is true - myFlags->SetValue(kFlagDisplayed, Standard_True); // is displayed by default is true - myFlags->SetValue(kFlagDeleted, Standard_False); // is deleted by default is false + myFlags->SetValue(kFlagInHistory, + Standard_True); // is in history by default is true + myFlags->SetValue(kFlagDisplayed, + Standard_True); // is displayed by default is true + myFlags->SetValue(kFlagDeleted, + Standard_False); // is deleted by default is false } } -std::wstring Model_Data::name() -{ +std::wstring Model_Data::name() { Handle(TDataStd_Name) aName; if (shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) { #ifdef DEBUG_NAMES @@ -118,11 +121,10 @@ std::wstring Model_Data::name() #endif return Locale::Convert::toWString(aName->Get().ToExtString()); } - return L""; // not defined + return L""; // not defined } -void Model_Data::setName(const std::wstring& theName) -{ +void Model_Data::setName(const std::wstring &theName) { bool isModified = false; std::wstring anOldName = name(); Handle(TDataStd_Name) aName; @@ -135,11 +137,13 @@ void Model_Data::setName(const std::wstring& theName) aName->Set(theName.c_str()); // check the name of result is defined by user - // (name of result does not composed of the name of feature and the result index) + // (name of result does not composed of the name of feature and the result + // index) bool isUserDefined = true; ResultPtr aResult = std::dynamic_pointer_cast(myObject); if (aResult) { - std::wstring aDefaultName = ModelAPI_Tools::getDefaultName(aResult, false).first; + std::wstring aDefaultName = + ModelAPI_Tools::getDefaultName(aResult, false).first; isUserDefined = aDefaultName != theName; } if (isUserDefined) { @@ -151,21 +155,19 @@ void Model_Data::setName(const std::wstring& theName) if (mySendAttributeUpdated && isModified) ModelAPI_ObjectRenamedMessage::send(myObject, anOldName, theName, this); if (isModified && myObject && myObject->document()) { - std::dynamic_pointer_cast(myObject->document())-> - changeNamingName(anOldName, theName, shapeLab()); + std::dynamic_pointer_cast(myObject->document()) + ->changeNamingName(anOldName, theName, shapeLab()); } #ifdef DEBUG_NAMES myObject->myName = theName; #endif } -bool Model_Data::hasUserDefinedName() const -{ +bool Model_Data::hasUserDefinedName() const { return shapeLab().IsAttribute(kUSER_DEFINED_NAME); } -std::string Model_Data::version() -{ +std::string Model_Data::version() { Handle(TDataStd_Name) aVersionAttr; std::string aVersion; if (shapeLab().FindAttribute(kVERSION_ID, aVersionAttr)) @@ -173,22 +175,22 @@ std::string Model_Data::version() return aVersion; } -void Model_Data::setVersion(const std::string& theVersion) -{ +void Model_Data::setVersion(const std::string &theVersion) { Handle(TDataStd_Name) aVersionAttr; std::string aVersion; if (!shapeLab().FindAttribute(kVERSION_ID, aVersionAttr)) - aVersionAttr = TDataStd_Name::Set(shapeLab(), kVERSION_ID, TCollection_ExtendedString()); + aVersionAttr = TDataStd_Name::Set(shapeLab(), kVERSION_ID, + TCollection_ExtendedString()); aVersionAttr->Set(theVersion.c_str()); } -AttributePtr Model_Data::addAttribute( - const std::string& theID, const std::string theAttrType, const int theIndex) -{ +AttributePtr Model_Data::addAttribute(const std::string &theID, + const std::string theAttrType, + const int theIndex) { AttributePtr aResult; int anAttrIndex = theIndex == -1 ? int(myAttrs.size()) + 1 : theIndex; TDF_Label anAttrLab = myLab.FindChild(anAttrIndex); - ModelAPI_Attribute* anAttr = 0; + ModelAPI_Attribute *anAttr = 0; if (theAttrType == ModelAPI_AttributeDocRef::typeId()) { anAttr = new Model_AttributeDocRef(anAttrLab); } else if (theAttrType == Model_AttributeInteger::typeId()) { @@ -222,26 +224,33 @@ AttributePtr Model_Data::addAttribute( } else if (theAttrType == ModelAPI_AttributeImage::typeId()) { anAttr = new Model_AttributeImage(anAttrLab); } - // create also GeomData attributes here because only here the OCAF structure is known + // create also GeomData attributes here because only here the OCAF structure + // is known else if (theAttrType == GeomData_Point::typeId()) { - GeomData_Point* anAttribute = new GeomData_Point(); + GeomData_Point *anAttribute = new GeomData_Point(); bool anAllInitialized = true; - for (int aComponent = 0; aComponent < GeomData_Point::NUM_COMPONENTS; ++aComponent) { + for (int aComponent = 0; aComponent < GeomData_Point::NUM_COMPONENTS; + ++aComponent) { TDF_Label anExpressionLab = anAttrLab.FindChild(aComponent + 1); - anAttribute->myExpression[aComponent].reset(new Model_ExpressionDouble(anExpressionLab)); - anAllInitialized = anAllInitialized && anAttribute->myExpression[aComponent]->isInitialized(); + anAttribute->myExpression[aComponent].reset( + new Model_ExpressionDouble(anExpressionLab)); + anAllInitialized = anAllInitialized && + anAttribute->myExpression[aComponent]->isInitialized(); } anAttribute->myIsInitialized = anAllInitialized; anAttr = anAttribute; } else if (theAttrType == GeomData_Dir::typeId()) { anAttr = new GeomData_Dir(anAttrLab); } else if (theAttrType == GeomData_Point2D::typeId()) { - GeomData_Point2D* anAttribute = new GeomData_Point2D(); + GeomData_Point2D *anAttribute = new GeomData_Point2D(); bool anAllInitialized = true; - for (int aComponent = 0; aComponent < GeomData_Point2D::NUM_COMPONENTS; ++aComponent) { + for (int aComponent = 0; aComponent < GeomData_Point2D::NUM_COMPONENTS; + ++aComponent) { TDF_Label anExpressionLab = anAttrLab.FindChild(aComponent + 1); - anAttribute->myExpression[aComponent].reset(new Model_ExpressionDouble(anExpressionLab)); - anAllInitialized = anAllInitialized && anAttribute->myExpression[aComponent]->isInitialized(); + anAttribute->myExpression[aComponent].reset( + new Model_ExpressionDouble(anExpressionLab)); + anAllInitialized = anAllInitialized && + anAttribute->myExpression[aComponent]->isInitialized(); } anAttribute->myIsInitialized = anAllInitialized; anAttr = anAttribute; @@ -256,36 +265,44 @@ AttributePtr Model_Data::addAttribute( anAttr->setID(theID); } else { Events_InfoMessage("Model_Data", - "Can not create unknown type of attribute %1").arg(theAttrType).send(); + "Can not create unknown type of attribute %1") + .arg(theAttrType) + .send(); } return aResult; } -AttributePtr Model_Data::addFloatingAttribute( - const std::string& theID, const std::string theAttrType, const std::string& theGroup) -{ +AttributePtr Model_Data::addFloatingAttribute(const std::string &theID, + const std::string theAttrType, + const std::string &theGroup) { // compute the index of the attribute placement int anIndex; TDF_Label aLab; if (myLab.IsAttribute(TDF_TagSource::GetID())) { - // check this is re-init of attributes, so, check attribute with this name already there + // check this is re-init of attributes, so, check attribute with this name + // already there TDF_ChildIDIterator anIter(myLab, kGroupAttributeID, false); - for(; anIter.More(); anIter.Next()) { - TCollection_AsciiString aThisName(Handle(TDataStd_Name)::DownCast(anIter.Value())->Get()); + for (; anIter.More(); anIter.Next()) { + TCollection_AsciiString aThisName( + Handle(TDataStd_Name)::DownCast(anIter.Value())->Get()); if (theID == aThisName.ToCString()) { TDF_Label aChildLab = anIter.Value()->Label(); Handle(TDataStd_Name) aGName; if (aChildLab.FindAttribute(kGroupAttributeGroupID, aGName)) { TCollection_AsciiString aGroupName(aGName->Get()); if (theGroup == aGroupName.ToCString()) { - return addAttribute(theGroup + "__" + theID, theAttrType, aChildLab.Tag()); + return addAttribute(theGroup + "__" + theID, theAttrType, + aChildLab.Tag()); } } } } - aLab = myLab.NewChild(); // already exists a floating attribute, create the next + aLab = + myLab + .NewChild(); // already exists a floating attribute, create the next anIndex = aLab.Tag(); - } else { // put the first floating attribute, quite far from other standard attributes + } else { // put the first floating attribute, quite far from other standard + // attributes anIndex = int(myAttrs.size()) + 1000; TDF_TagSource::Set(myLab)->Set(anIndex); aLab = myLab.FindChild(anIndex, true); @@ -297,12 +314,14 @@ AttributePtr Model_Data::addFloatingAttribute( return addAttribute(theGroup + "__" + theID, theAttrType, anIndex); } -void Model_Data::allGroups(std::list& theGroups) -{ +void Model_Data::allGroups(std::list &theGroups) { std::set alreadyThere; - for(TDF_ChildIDIterator aGroup(myLab, kGroupAttributeGroupID); aGroup.More(); aGroup.Next()) { - Handle(TDataStd_Name) aGroupAttr = Handle(TDataStd_Name)::DownCast(aGroup.Value()); - std::string aGroupID = TCollection_AsciiString(aGroupAttr->Get()).ToCString(); + for (TDF_ChildIDIterator aGroup(myLab, kGroupAttributeGroupID); aGroup.More(); + aGroup.Next()) { + Handle(TDataStd_Name) aGroupAttr = + Handle(TDataStd_Name)::DownCast(aGroup.Value()); + std::string aGroupID = + TCollection_AsciiString(aGroupAttr->Get()).ToCString(); if (alreadyThere.find(aGroupID) == alreadyThere.end()) { theGroups.push_back(aGroupID); alreadyThere.insert(aGroupID); @@ -310,11 +329,13 @@ void Model_Data::allGroups(std::list& theGroups) } } -void Model_Data::attributesOfGroup(const std::string& theGroup, - std::list >& theAttrs) -{ - for(TDF_ChildIDIterator aGroup(myLab, kGroupAttributeGroupID); aGroup.More(); aGroup.Next()) { - Handle(TDataStd_Name) aGroupID = Handle(TDataStd_Name)::DownCast(aGroup.Value()); +void Model_Data::attributesOfGroup( + const std::string &theGroup, + std::list> &theAttrs) { + for (TDF_ChildIDIterator aGroup(myLab, kGroupAttributeGroupID); aGroup.More(); + aGroup.Next()) { + Handle(TDataStd_Name) aGroupID = + Handle(TDataStd_Name)::DownCast(aGroup.Value()); if (aGroupID->Get().IsEqual(theGroup.c_str())) { Handle(TDataStd_Name) anID; if (aGroup.Value()->Label().FindAttribute(kGroupAttributeID, anID)) { @@ -325,11 +346,13 @@ void Model_Data::attributesOfGroup(const std::string& theGroup, } } -void Model_Data::removeAttributes(const std::string& theGroup) -{ - TDF_LabelList aLabsToRemove; // collect labels that must be erased after the cycle - for(TDF_ChildIDIterator aGroup(myLab, kGroupAttributeGroupID); aGroup.More(); aGroup.Next()) { - Handle(TDataStd_Name) aGroupID = Handle(TDataStd_Name)::DownCast(aGroup.Value()); +void Model_Data::removeAttributes(const std::string &theGroup) { + TDF_LabelList + aLabsToRemove; // collect labels that must be erased after the cycle + for (TDF_ChildIDIterator aGroup(myLab, kGroupAttributeGroupID); aGroup.More(); + aGroup.Next()) { + Handle(TDataStd_Name) aGroupID = + Handle(TDataStd_Name)::DownCast(aGroup.Value()); if (aGroupID->Get().IsEqual(theGroup.c_str())) { Handle(TDataStd_Name) anID; if (!aGroup.Value()->Label().IsNull() && @@ -340,27 +363,23 @@ void Model_Data::removeAttributes(const std::string& theGroup) myAttrs.erase(anAsciiID.ToCString()); } } - for(TDF_LabelList::Iterator aLab(aLabsToRemove); aLab.More(); aLab.Next()) { + for (TDF_LabelList::Iterator aLab(aLabsToRemove); aLab.More(); aLab.Next()) { aLab.ChangeValue().ForgetAllAttributes(true); } } -void Model_Data::clearAttributes() -{ - myAttrs.clear(); -} - - +void Model_Data::clearAttributes() { myAttrs.clear(); } // macro for the generic returning of the attribute by the ID -#define GET_ATTRIBUTE_BY_ID(ATTR_TYPE, METHOD_NAME) \ - std::shared_ptr Model_Data::METHOD_NAME(const std::string& theID) { \ - std::shared_ptr aRes; \ - AttributeMap::iterator aFound = myAttrs.find(theID); \ - if (aFound != myAttrs.end()) { \ - aRes = std::dynamic_pointer_cast(aFound->second.first); \ - } \ - return aRes; \ +#define GET_ATTRIBUTE_BY_ID(ATTR_TYPE, METHOD_NAME) \ + std::shared_ptr Model_Data::METHOD_NAME( \ + const std::string &theID) { \ + std::shared_ptr aRes; \ + AttributeMap::iterator aFound = myAttrs.find(theID); \ + if (aFound != myAttrs.end()) { \ + aRes = std::dynamic_pointer_cast(aFound->second.first); \ + } \ + return aRes; \ } // implement nice getting methods for all ModelAPI attributes GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeDocRef, document); @@ -380,16 +399,16 @@ GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeDoubleArray, realArray); GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeTables, tables); GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeImage, image); -std::shared_ptr Model_Data::attribute(const std::string& theID) -{ +std::shared_ptr +Model_Data::attribute(const std::string &theID) { std::shared_ptr aResult; - if (myAttrs.find(theID) == myAttrs.end()) // no such attribute + if (myAttrs.find(theID) == myAttrs.end()) // no such attribute return aResult; return myAttrs[theID].first; } -const std::string& Model_Data::id(const std::shared_ptr& theAttr) -{ +const std::string & +Model_Data::id(const std::shared_ptr &theAttr) { AttributeMap::iterator anAttr = myAttrs.begin(); for (; anAttr != myAttrs.end(); anAttr++) { if (anAttr->second.first == theAttr) @@ -400,22 +419,19 @@ const std::string& Model_Data::id(const std::shared_ptr& the return anEmpty; } -bool Model_Data::isEqual(const std::shared_ptr& theData) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(theData); +bool Model_Data::isEqual(const std::shared_ptr &theData) { + std::shared_ptr aData = + std::dynamic_pointer_cast(theData); if (aData) - return myLab.IsEqual(aData->myLab) == Standard_True ; + return myLab.IsEqual(aData->myLab) == Standard_True; return false; } -bool Model_Data::isValid() -{ - return !myLab.IsNull() && myLab.HasAttribute(); -} +bool Model_Data::isValid() { return !myLab.IsNull() && myLab.HasAttribute(); } -std::list > Model_Data::attributes(const std::string& theType) -{ - std::list > aResult; +std::list> +Model_Data::attributes(const std::string &theType) { + std::list> aResult; AttributeMap::iterator anAttrsIter = myAttrs.begin(); for (; anAttrsIter != myAttrs.end(); anAttrsIter++) { AttributePtr anAttr = anAttrsIter->second.first; @@ -426,8 +442,7 @@ std::list > Model_Data::attributes(const std return aResult; } -std::list Model_Data::attributesIDs(const std::string& theType) -{ +std::list Model_Data::attributesIDs(const std::string &theType) { std::list aResult; AttributeMap::iterator anAttrsIter = myAttrs.begin(); for (; anAttrsIter != myAttrs.end(); anAttrsIter++) { @@ -439,42 +454,48 @@ std::list Model_Data::attributesIDs(const std::string& theType) return aResult; } -void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr) -{ +void Model_Data::sendAttributeUpdated(ModelAPI_Attribute *theAttr) { theAttr->setInitialized(); if (theAttr->isArgument()) { if (mySendAttributeUpdated) { if (myObject) { try { - myObject->attributeChanged(theAttr->id()); - } catch(...) { - if (owner().get() && owner()->data().get() && owner()->data()->isValid()) { - Events_InfoMessage("Model_Data", - "%1 has failed during the update").arg(owner()->data()->name()).send(); + myObject->attributeChanged(theAttr->id()); + } catch (...) { + if (owner().get() && owner()->data().get() && + owner()->data()->isValid()) { + Events_InfoMessage("Model_Data", "%1 has failed during the update") + .arg(owner()->data()->name()) + .send(); } } - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); } } else { // to avoid too many duplications do not add the same like the last - if (myWasChangedButBlocked.empty() || *(myWasChangedButBlocked.rbegin()) != theAttr) + if (myWasChangedButBlocked.empty() || + *(myWasChangedButBlocked.rbegin()) != theAttr) myWasChangedButBlocked.push_back(theAttr); } } else { // trim: need to redisplay or set color in the python script - if (myObject && (theAttr->attributeType() == "Point2D" || theAttr->id() == "Color" || - theAttr->id() == "Transparency" || theAttr->id() == "Deflection" || - theAttr->id() == "Iso_lines" || theAttr->id() == "Show_Iso_lines" || - theAttr->id() == "Show_Edges_direction" || theAttr->id() == "Bring_To_Front")) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + if (myObject && + (theAttr->attributeType() == "Point2D" || theAttr->id() == "Color" || + theAttr->id() == "Transparency" || theAttr->id() == "Deflection" || + theAttr->id() == "Iso_lines" || theAttr->id() == "Show_Iso_lines" || + theAttr->id() == "Show_Edges_direction" || + theAttr->id() == "Bring_To_Front")) { + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); } } } -bool Model_Data::blockSendAttributeUpdated(const bool theBlock, const bool theSendMessage) -{ +bool Model_Data::blockSendAttributeUpdated(const bool theBlock, + const bool theSendMessage) { bool aWasBlocked = !mySendAttributeUpdated; if (mySendAttributeUpdated == theBlock) { mySendAttributeUpdated = !theBlock; @@ -483,20 +504,26 @@ bool Model_Data::blockSendAttributeUpdated(const bool theBlock, const bool theSe if (theSendMessage) { // make a copy to avoid iteration on modified list // (may be cleared by attribute changed call) - std::list aWasChangedButBlocked = myWasChangedButBlocked; + std::list aWasChangedButBlocked = + myWasChangedButBlocked; myWasChangedButBlocked.clear(); - std::list::iterator aChangedIter = aWasChangedButBlocked.begin(); - for(; aChangedIter != aWasChangedButBlocked.end(); aChangedIter++) { + std::list::iterator aChangedIter = + aWasChangedButBlocked.begin(); + for (; aChangedIter != aWasChangedButBlocked.end(); aChangedIter++) { try { myObject->attributeChanged((*aChangedIter)->id()); - } catch(...) { - if (owner().get() && owner()->data().get() && owner()->data()->isValid()) { + } catch (...) { + if (owner().get() && owner()->data().get() && + owner()->data()->isValid()) { Events_InfoMessage("Model_Data", - "%1 has failed during the update").arg(owner()->data()->name()).send(); + "%1 has failed during the update") + .arg(owner()->data()->name()) + .send(); } } } - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); } else { myWasChangedButBlocked.clear(); @@ -506,21 +533,20 @@ bool Model_Data::blockSendAttributeUpdated(const bool theBlock, const bool theSe return aWasBlocked; } -void Model_Data::erase() -{ +void Model_Data::erase() { if (!myLab.IsNull()) { if (myLab.HasAttribute()) { // remove in order to clear back references in other objects - std::list > > aRefs; + std::list>> aRefs; referencesToObjects(aRefs); - std::list > >::iterator - anAttrIter = aRefs.begin(); - for(; anAttrIter != aRefs.end(); anAttrIter++) { + std::list>>::iterator + anAttrIter = aRefs.begin(); + for (; anAttrIter != aRefs.end(); anAttrIter++) { std::list::iterator aReferenced = anAttrIter->second.begin(); - for(; aReferenced != anAttrIter->second.end(); aReferenced++) { + for (; aReferenced != anAttrIter->second.end(); aReferenced++) { if (aReferenced->get() && (*aReferenced)->data()->isValid()) { std::shared_ptr aData = - std::dynamic_pointer_cast((*aReferenced)->data()); + std::dynamic_pointer_cast((*aReferenced)->data()); aData->removeBackReference(myAttrs[anAttrIter->first].first); } } @@ -533,24 +559,24 @@ void Model_Data::erase() // indexes in the state array enum StatesIndexes { - STATE_INDEX_STATE = 1, // the state type itself + STATE_INDEX_STATE = 1, // the state type itself STATE_INDEX_TRANSACTION = 2, // transaction ID }; /// Returns the label array, initializes it by default values if not exists -static Handle(TDataStd_IntegerArray) stateArray(TDF_Label& theLab) -{ +static Handle(TDataStd_IntegerArray) stateArray(TDF_Label &theLab) { Handle(TDataStd_IntegerArray) aStateArray; if (!theLab.FindAttribute(TDataStd_IntegerArray::GetID(), aStateArray)) { aStateArray = TDataStd_IntegerArray::Set(theLab, 1, 2); - aStateArray->SetValue(STATE_INDEX_STATE, ModelAPI_StateMustBeUpdated); // default state - aStateArray->SetValue(STATE_INDEX_TRANSACTION, 0); // default transaction ID (not existing) + aStateArray->SetValue(STATE_INDEX_STATE, + ModelAPI_StateMustBeUpdated); // default state + aStateArray->SetValue(STATE_INDEX_TRANSACTION, + 0); // default transaction ID (not existing) } return aStateArray; } -void Model_Data::execState(const ModelAPI_ExecState theState) -{ +void Model_Data::execState(const ModelAPI_ExecState theState) { if (theState != ModelAPI_StateNothing) { if (stateArray(myLab)->Value(STATE_INDEX_STATE) != (int)theState) { stateArray(myLab)->SetValue(STATE_INDEX_STATE, (int)theState); @@ -558,23 +584,19 @@ void Model_Data::execState(const ModelAPI_ExecState theState) } } -ModelAPI_ExecState Model_Data::execState() -{ +ModelAPI_ExecState Model_Data::execState() { return ModelAPI_ExecState(stateArray(myLab)->Value(STATE_INDEX_STATE)); } -int Model_Data::updateID() -{ +int Model_Data::updateID() { return stateArray(myLab)->Value(STATE_INDEX_TRANSACTION); } -void Model_Data::setUpdateID(const int theID) -{ +void Model_Data::setUpdateID(const int theID) { stateArray(myLab)->SetValue(STATE_INDEX_TRANSACTION, theID); } -void Model_Data::setError(const std::string& theError, bool theSend) -{ +void Model_Data::setError(const std::string &theError, bool theSend) { execState(ModelAPI_StateExecFailed); if (theSend) { Events_InfoMessage("Model_Data", theError).send(); @@ -582,13 +604,11 @@ void Model_Data::setError(const std::string& theError, bool theSend) TDataStd_AsciiString::Set(myLab, theError.c_str()); } -void Model_Data::eraseErrorString() -{ +void Model_Data::eraseErrorString() { myLab.ForgetAttribute(TDataStd_AsciiString::GetID()); } -std::string Model_Data::error() const -{ +std::string Model_Data::error() const { Handle(TDataStd_AsciiString) anErrorAttr; if (myLab.FindAttribute(TDataStd_AsciiString::GetID(), anErrorAttr)) { return std::string(anErrorAttr->Get().ToCString()); @@ -596,70 +616,73 @@ std::string Model_Data::error() const return std::string(); } -int Model_Data::featureId() const -{ +int Model_Data::featureId() const { return myLab.Father().Tag(); // tag of the feature label } -void Model_Data::removeBackReference(ObjectPtr theObject, std::string theAttrID) -{ +void Model_Data::removeBackReference(ObjectPtr theObject, + std::string theAttrID) { AttributePtr anAttribute = theObject->data()->attribute(theAttrID); removeBackReference(anAttribute); } -void Model_Data::removeBackReference(AttributePtr theAttr) -{ +void Model_Data::removeBackReference(AttributePtr theAttr) { if (myRefsToMe.find(theAttr) == myRefsToMe.end()) return; myRefsToMe.erase(theAttr); - // remove concealment immediately: on deselection it must be possible to reselect in GUI the same - FeaturePtr aFeatureOwner = std::dynamic_pointer_cast(theAttr->owner()); - if (aFeatureOwner.get() && - ModelAPI_Session::get()->validators()->isConcealed(aFeatureOwner->getKind(), theAttr->id())) { + // remove concealment immediately: on deselection it must be possible to + // reselect in GUI the same + FeaturePtr aFeatureOwner = + std::dynamic_pointer_cast(theAttr->owner()); + if (aFeatureOwner.get() && ModelAPI_Session::get()->validators()->isConcealed( + aFeatureOwner->getKind(), theAttr->id())) { updateConcealmentFlag(); } } void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID, - const bool theApplyConcealment) -{ + const bool theApplyConcealment) { addBackReference(ObjectPtr(theFeature), theAttrID); - if (theApplyConcealment && theFeature->isStable() && - ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) { - std::shared_ptr aRes = std::dynamic_pointer_cast(myObject); - // the second condition is for history upper than concealment causer, so the feature result may - // be displayed and previewed; also for avoiding of quick show/hide on history - // moving deep down + if (theApplyConcealment && theFeature->isStable() && + ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), + theAttrID)) { + std::shared_ptr aRes = + std::dynamic_pointer_cast(myObject); + // the second condition is for history upper than concealment causer, so the + // feature result may be displayed and previewed; also for avoiding of quick + // show/hide on history moving deep down if (aRes && !theFeature->isDisabled()) { aRes->setIsConcealed(true, theFeature->getKind() == "RemoveResults"); } } } -void Model_Data::addBackReference(ObjectPtr theObject, std::string theAttrID) -{ - // it is possible to add the same attribute twice: may be last time the owner was not Stable... +void Model_Data::addBackReference(ObjectPtr theObject, std::string theAttrID) { + // it is possible to add the same attribute twice: may be last time the owner + // was not Stable... AttributePtr anAttribute = theObject->data()->attribute(theAttrID); if (myRefsToMe.find(anAttribute) == myRefsToMe.end()) myRefsToMe.insert(anAttribute); } -void Model_Data::updateConcealmentFlag() -{ +void Model_Data::updateConcealmentFlag() { std::set::iterator aRefsIter = myRefsToMe.begin(); - for(; aRefsIter != myRefsToMe.end(); aRefsIter++) { + for (; aRefsIter != myRefsToMe.end(); aRefsIter++) { if (aRefsIter->get()) { - FeaturePtr aFeature = std::dynamic_pointer_cast((*aRefsIter)->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast((*aRefsIter)->owner()); if (aFeature.get() && !aFeature->isDisabled() && aFeature->isStable()) { - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); bool isCase = aValidators->isCase(aFeature, (*aRefsIter)->id()); - bool isConcealed = aValidators->isConcealed(aFeature->getKind(), (*aRefsIter)->id()); + bool isConcealed = + aValidators->isConcealed(aFeature->getKind(), (*aRefsIter)->id()); if (isCase && isConcealed) { std::shared_ptr aRes = - std::dynamic_pointer_cast(myObject); + std::dynamic_pointer_cast(myObject); if (aRes.get()) { if (aRes->groupName() != ModelAPI_ResultConstruction::group()) { aRes->setIsConcealed(true); // set concealed @@ -674,77 +697,81 @@ void Model_Data::updateConcealmentFlag() } } std::shared_ptr aRes = - std::dynamic_pointer_cast(myObject); + std::dynamic_pointer_cast(myObject); if (aRes.get()) { aRes->setIsConcealed(false); } } -std::set set_union(const std::set& theLeft, - const std::set& theRight) -{ +std::set set_union(const std::set &theLeft, + const std::set &theRight) { std::set aResult; aResult.insert(theLeft.begin(), theLeft.end()); aResult.insert(theRight.begin(), theRight.end()); return aResult; } -std::set usedParameters(const AttributePointPtr& theAttribute) -{ +std::set usedParameters(const AttributePointPtr &theAttribute) { std::set anUsedParameters; for (int aComponent = 0; aComponent < 3; ++aComponent) - anUsedParameters = set_union(anUsedParameters, theAttribute->usedParameters(aComponent)); + anUsedParameters = + set_union(anUsedParameters, theAttribute->usedParameters(aComponent)); return anUsedParameters; } -std::set usedParameters(const AttributePoint2DPtr& theAttribute) -{ +std::set usedParameters(const AttributePoint2DPtr &theAttribute) { std::set anUsedParameters; for (int aComponent = 0; aComponent < 2; ++aComponent) - anUsedParameters = set_union(anUsedParameters, theAttribute->usedParameters(aComponent)); + anUsedParameters = + set_union(anUsedParameters, theAttribute->usedParameters(aComponent)); return anUsedParameters; } -std::list findVariables(const std::set& theParameters, - const DocumentPtr& theDocument) -{ +std::list +findVariables(const std::set &theParameters, + const DocumentPtr &theDocument) { std::list aResult; std::set::const_iterator aParamIt = theParameters.cbegin(); for (; aParamIt != theParameters.cend(); ++aParamIt) { - const std::wstring& aName = *aParamIt; + const std::wstring &aName = *aParamIt; double aValue; ResultParameterPtr aParam; // theSearcher is not needed here: in expressions // of features the parameters history is not needed - if (ModelAPI_Tools::findVariable(FeaturePtr(), aName, aValue, aParam, theDocument)) + if (ModelAPI_Tools::findVariable(FeaturePtr(), aName, aValue, aParam, + theDocument)) aResult.push_back(aParam); } return aResult; } void Model_Data::referencesToObjects( - std::list > >& theRefs) -{ - static Model_ValidatorsFactory* aValidators = - static_cast(ModelAPI_Session::get()->validators()); + std::list>> &theRefs) { + static Model_ValidatorsFactory *aValidators = + static_cast( + ModelAPI_Session::get()->validators()); FeaturePtr aMyFeature = std::dynamic_pointer_cast(myObject); AttributeMap::iterator anAttrIt = myAttrs.begin(); - std::list aReferenced; // not inside of cycle to avoid excess memory management - for(; anAttrIt != myAttrs.end(); anAttrIt++) { + std::list + aReferenced; // not inside of cycle to avoid excess memory management + for (; anAttrIt != myAttrs.end(); anAttrIt++) { AttributePtr anAttr = anAttrIt->second.first; - // skip not-case attributes, that really may refer to anything not-used (issue 671) + // skip not-case attributes, that really may refer to anything not-used + // (issue 671) if (aMyFeature.get() && !aValidators->isCase(aMyFeature, anAttr->id())) continue; std::string aType = anAttr->attributeType(); if (aType == ModelAPI_AttributeReference::typeId()) { // reference to object - std::shared_ptr aRef = std::dynamic_pointer_cast< - ModelAPI_AttributeReference>(anAttr); + std::shared_ptr aRef = + std::dynamic_pointer_cast(anAttr); aReferenced.push_back(aRef->value()); - } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { // reference to attribute or object - std::shared_ptr aRef = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(anAttr); + } else if (aType == + ModelAPI_AttributeRefAttr::typeId()) { // reference to attribute + // or object + std::shared_ptr aRef = + std::dynamic_pointer_cast(anAttr); if (aRef->isObject()) { aReferenced.push_back(aRef->object()); } else { @@ -752,29 +779,35 @@ void Model_Data::referencesToObjects( if (aReferredAttr.get()) aReferenced.push_back(aReferredAttr->owner()); } - } else if (aType == ModelAPI_AttributeRefList::typeId()) { // list of references - aReferenced = std::dynamic_pointer_cast(anAttr)->list(); - } - else if (aType == ModelAPI_AttributeSelection::typeId()) { // selection attribute - std::shared_ptr aRef = std::dynamic_pointer_cast< - ModelAPI_AttributeSelection>(anAttr); + } else if (aType == + ModelAPI_AttributeRefList::typeId()) { // list of references + aReferenced = + std::dynamic_pointer_cast(anAttr)->list(); + } else if (aType == + ModelAPI_AttributeSelection::typeId()) { // selection attribute + std::shared_ptr aRef = + std::dynamic_pointer_cast(anAttr); FeaturePtr aRefFeat = aRef->contextFeature(); - if (aRefFeat.get()) { // reference to all results of the referenced feature - const std::list& allRes = aRefFeat->results(); + if (aRefFeat + .get()) { // reference to all results of the referenced feature + const std::list &allRes = aRefFeat->results(); std::list::const_iterator aRefRes = allRes.cbegin(); - for(; aRefRes != allRes.cend(); aRefRes++) { + for (; aRefRes != allRes.cend(); aRefRes++) { aReferenced.push_back(*aRefRes); } } else { aReferenced.push_back(aRef->context()); } - } else if (aType == ModelAPI_AttributeSelectionList::typeId()) { // list of selection attributes - std::shared_ptr aRef = std::dynamic_pointer_cast< - ModelAPI_AttributeSelectionList>(anAttr); - for(int a = 0, aSize = aRef->size(); a < aSize; ++a) { + } else if (aType == + ModelAPI_AttributeSelectionList::typeId()) { // list of selection + // attributes + std::shared_ptr aRef = + std::dynamic_pointer_cast(anAttr); + for (int a = 0, aSize = aRef->size(); a < aSize; ++a) { FeaturePtr aRefFeat = aRef->value(a)->contextFeature(); - if (aRefFeat.get()) { // reference to all results of the referenced feature - const std::list& allRes = aRefFeat->results(); + if (aRefFeat + .get()) { // reference to all results of the referenced feature + const std::list &allRes = aRefFeat->results(); std::list::const_iterator aRefRes = allRes.cbegin(); for (; aRefRes != allRes.cend(); aRefRes++) { aReferenced.push_back(*aRefRes); @@ -784,89 +817,94 @@ void Model_Data::referencesToObjects( } } } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - std::shared_ptr aRefAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttrList>(anAttr); - std::list > aRefs = aRefAttr->list(); - std::list >::const_iterator anIt = aRefs.begin(), - aLast = aRefs.end(); + std::shared_ptr aRefAttr = + std::dynamic_pointer_cast(anAttr); + std::list> aRefs = aRefAttr->list(); + std::list>::const_iterator + anIt = aRefs.begin(), + aLast = aRefs.end(); for (; anIt != aLast; anIt++) { aReferenced.push_back(anIt->first); } - } else if (aType == ModelAPI_AttributeInteger::typeId()) { // integer attribute + } else if (aType == + ModelAPI_AttributeInteger::typeId()) { // integer attribute AttributeIntegerPtr anAttribute = std::dynamic_pointer_cast(anAttr); std::set anUsedParameters = anAttribute->usedParameters(); std::list aParameters = - findVariables(anUsedParameters, owner()->document()); - aReferenced.insert(aReferenced.end(), aParameters.begin(), aParameters.end()); - } else if (aType == ModelAPI_AttributeDouble::typeId()) { // double attribute + findVariables(anUsedParameters, owner()->document()); + aReferenced.insert(aReferenced.end(), aParameters.begin(), + aParameters.end()); + } else if (aType == + ModelAPI_AttributeDouble::typeId()) { // double attribute AttributeDoublePtr anAttribute = std::dynamic_pointer_cast(anAttr); std::set anUsedParameters = anAttribute->usedParameters(); std::list aParameters = - findVariables(anUsedParameters, owner()->document()); - aReferenced.insert(aReferenced.end(), aParameters.begin(), aParameters.end()); + findVariables(anUsedParameters, owner()->document()); + aReferenced.insert(aReferenced.end(), aParameters.begin(), + aParameters.end()); } else if (aType == GeomDataAPI_Point::typeId()) { // point attribute AttributePointPtr anAttribute = - std::dynamic_pointer_cast(anAttr); + std::dynamic_pointer_cast(anAttr); std::set anUsedParameters = usedParameters(anAttribute); std::list aParameters = - findVariables(anUsedParameters, owner()->document()); - aReferenced.insert(aReferenced.end(), aParameters.begin(), aParameters.end()); + findVariables(anUsedParameters, owner()->document()); + aReferenced.insert(aReferenced.end(), aParameters.begin(), + aParameters.end()); } else if (aType == GeomDataAPI_Point2D::typeId()) { // point attribute AttributePoint2DPtr anAttribute = - std::dynamic_pointer_cast(anAttr); + std::dynamic_pointer_cast(anAttr); std::set anUsedParameters = usedParameters(anAttribute); std::list aParameters = - findVariables(anUsedParameters, owner()->document()); - aReferenced.insert(aReferenced.end(), aParameters.begin(), aParameters.end()); + findVariables(anUsedParameters, owner()->document()); + aReferenced.insert(aReferenced.end(), aParameters.begin(), + aParameters.end()); } else continue; // nothing to do, not reference if (!aReferenced.empty()) { - theRefs.push_back( - std::pair >(anAttrIt->first, aReferenced)); + theRefs.push_back(std::pair>( + anAttrIt->first, aReferenced)); aReferenced.clear(); } } } -void Model_Data::copyTo(std::shared_ptr theTarget) -{ - TDF_Label aTargetRoot = std::dynamic_pointer_cast(theTarget)->label(); +void Model_Data::copyTo(std::shared_ptr theTarget) { + TDF_Label aTargetRoot = + std::dynamic_pointer_cast(theTarget)->label(); Model_Tools::copyAttrs(myLab, aTargetRoot); // reinitialize Model_Attributes by TDF_Attributes set - std::shared_ptr aTData = std::dynamic_pointer_cast(theTarget); + std::shared_ptr aTData = + std::dynamic_pointer_cast(theTarget); aTData->myAttrs.clear(); theTarget->owner()->initAttributes(); // reinitialize feature attributes } -bool Model_Data::isInHistory() -{ +bool Model_Data::isInHistory() { return myFlags->Value(kFlagInHistory) == Standard_True; } -void Model_Data::setIsInHistory(const bool theFlag) -{ +void Model_Data::setIsInHistory(const bool theFlag) { return myFlags->SetValue(kFlagInHistory, theFlag); } -bool Model_Data::isDeleted() -{ +bool Model_Data::isDeleted() { return myFlags->Value(kFlagDeleted) == Standard_True; } -void Model_Data::setIsDeleted(const bool theFlag) -{ +void Model_Data::setIsDeleted(const bool theFlag) { return myFlags->SetValue(kFlagDeleted, theFlag); } -bool Model_Data::isDisplayed() -{ +bool Model_Data::isDisplayed() { if (!myObject.get() || !myObject->document().get() || // object is in valid - myFlags->Value(kFlagDisplayed) != Standard_True) // or it was not displayed before + myFlags->Value(kFlagDisplayed) != + Standard_True) // or it was not displayed before return false; - if (myObject->document()->isActive()) // for active documents it must be ok anyway + if (myObject->document() + ->isActive()) // for active documents it must be ok anyway return true; // any object from the root document except part result may be displayed if (myObject->document() == ModelAPI_Session::get()->moduleDocument() && @@ -875,35 +913,25 @@ bool Model_Data::isDisplayed() return false; } -void Model_Data::setDisplayed(const bool theDisplay) -{ +void Model_Data::setDisplayed(const bool theDisplay) { if (theDisplay != isDisplayed()) { myFlags->SetValue(kFlagDisplayed, theDisplay); - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = + ModelAPI_EventCreator::get(); aECreator->sendUpdated(myObject, EVENT_DISP); } } -std::shared_ptr Model_Data::invalidPtr() -{ - return kInvalid; -} +std::shared_ptr Model_Data::invalidPtr() { return kInvalid; } -std::shared_ptr Model_Data::invalidData() -{ - return kInvalid; -} +std::shared_ptr Model_Data::invalidData() { return kInvalid; } -std::shared_ptr Model_Data::owner() -{ - return myObject; -} +std::shared_ptr Model_Data::owner() { return myObject; } -bool Model_Data::isPrecedingAttribute(const std::string& theAttribute1, - const std::string& theAttribute2) const -{ +bool Model_Data::isPrecedingAttribute(const std::string &theAttribute1, + const std::string &theAttribute2) const { AttributeMap::const_iterator aFound1 = myAttrs.find(theAttribute1); AttributeMap::const_iterator aFound2 = myAttrs.find(theAttribute2); if (aFound2 == myAttrs.end()) diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index 9b9f7acbf..76973358f 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Data_H_ @@ -25,15 +26,15 @@ #include #include #include +#include +#include #include #include -#include -#include #include +#include +#include #include #include -#include -#include #include #include #include @@ -44,10 +45,10 @@ #include -#include #include -#include +#include #include +#include class ModelAPI_Attribute; @@ -57,11 +58,12 @@ class ModelAPI_Attribute; * to get/set attributes from the document and compute result of an operation. */ -class Model_Data : public ModelAPI_Data -{ - typedef std::map, int> > AttributeMap; +class Model_Data : public ModelAPI_Data { + typedef std::map, int>> + AttributeMap; - TDF_Label myLab; ///< label of the feature in the document + TDF_Label myLab; ///< label of the feature in the document /// All attributes of the object identified by the attribute ID /// (the attribute is stored together with its index in the feature) AttributeMap myAttrs; @@ -71,18 +73,17 @@ class Model_Data : public ModelAPI_Data /// needed here to emit signal that object changed on change of the attribute ObjectPtr myObject; - /// List of attributes referenced to owner (updated only during the transaction change) + /// List of attributes referenced to owner (updated only during the + /// transaction change) std::set myRefsToMe; /// flag that may block the "attribute updated" sending bool mySendAttributeUpdated; - /// if some attribute was changed, but mySendAttributeUpdated was false, this stores this - std::list myWasChangedButBlocked; + /// if some attribute was changed, but mySendAttributeUpdated was false, this + /// stores this + std::list myWasChangedButBlocked; /// Returns label of this feature - TDF_Label label() - { - return myLab; - } + TDF_Label label() { return myLab; } friend class Model_Document; friend class Model_Objects; @@ -99,138 +100,148 @@ class Model_Data : public ModelAPI_Data friend class Model_ResultBody; friend class Model_Tools; - public: - /// The simplest constructor. "setLabel" must be called just after to initialize correctly. +public: + /// The simplest constructor. "setLabel" must be called just after to + /// initialize correctly. Model_Data(); /// Returns the name of the feature visible by the user in the object browser MODEL_EXPORT virtual std::wstring name(); /// Defines the name of the feature visible by the user in the object browser - MODEL_EXPORT virtual void setName(const std::wstring& theName); + MODEL_EXPORT virtual void setName(const std::wstring &theName); /// Return \c true if the object has been renamed by the user MODEL_EXPORT virtual bool hasUserDefinedName() const; /// Returns version of the feature (empty string if not applicable) MODEL_EXPORT virtual std::string version(); /// Initialize the version of the feature - MODEL_EXPORT virtual void setVersion(const std::string& theVersion); + MODEL_EXPORT virtual void setVersion(const std::string &theVersion); /// Returns the attribute that references to another document - MODEL_EXPORT virtual std::shared_ptr document(const std::string& theID); + MODEL_EXPORT virtual std::shared_ptr + document(const std::string &theID); /// Returns the attribute that contains real value with double precision - MODEL_EXPORT virtual std::shared_ptr real(const std::string& theID); + MODEL_EXPORT virtual std::shared_ptr + real(const std::string &theID); /// Returns the attribute that contains double values array - MODEL_EXPORT virtual - std::shared_ptr realArray(const std::string& theID); + MODEL_EXPORT virtual std::shared_ptr + realArray(const std::string &theID); /// Returns the attribute that contains integer value MODEL_EXPORT virtual std::shared_ptr - integer(const std::string& theID); + integer(const std::string &theID); /// Returns the attribute that contains reference to a feature MODEL_EXPORT virtual std::shared_ptr - reference(const std::string& theID); + reference(const std::string &theID); /// Returns the attribute that contains selection to a shape MODEL_EXPORT virtual std::shared_ptr - selection(const std::string& theID); + selection(const std::string &theID); /// Returns the attribute that contains selection to a shape MODEL_EXPORT virtual std::shared_ptr - selectionList(const std::string& theID); + selectionList(const std::string &theID); /// Returns the attribute that contains reference to an attribute of a feature MODEL_EXPORT virtual std::shared_ptr - refattr(const std::string& theID); + refattr(const std::string &theID); /// Returns the attribute that contains list of references to features MODEL_EXPORT virtual std::shared_ptr - reflist(const std::string& theID); + reflist(const std::string &theID); /// Returns the attribute that contains list of references to features /// or reference to an attribute of a feature MODEL_EXPORT virtual std::shared_ptr - refattrlist(const std::string& theID); + refattrlist(const std::string &theID); /// Returns the attribute that contains boolean value MODEL_EXPORT virtual std::shared_ptr - boolean(const std::string& theID); + boolean(const std::string &theID); /// Returns the attribute that contains real value with double precision MODEL_EXPORT virtual std::shared_ptr - string(const std::string& theID); + string(const std::string &theID); /// Returns the attribute that contains integer values array MODEL_EXPORT virtual std::shared_ptr - intArray(const std::string& theID); + intArray(const std::string &theID); /// Returns the attribute that contains string values array MODEL_EXPORT virtual std::shared_ptr - stringArray(const std::string& theID); + stringArray(const std::string &theID); /// Returns the attribute that contains string values array MODEL_EXPORT virtual std::shared_ptr - tables(const std::string& theID); + tables(const std::string &theID); /// Returns the attribute that contains image MODEL_EXPORT virtual std::shared_ptr - image(const std::string& theID); + image(const std::string &theID); /// Returns the generic attribute by identifier /// \param theID identifier of the attribute - MODEL_EXPORT virtual std::shared_ptr attribute(const std::string& theID); + MODEL_EXPORT virtual std::shared_ptr + attribute(const std::string &theID); /// Returns all attributes of the feature of the given type /// or all attributes if "theType" is empty - MODEL_EXPORT virtual std::list > - attributes(const std::string& theType); + MODEL_EXPORT virtual std::list> + attributes(const std::string &theType); /// Returns all attributes ids of the feature of the given type /// or all attributes if "theType" is empty - MODEL_EXPORT virtual std::list attributesIDs(const std::string& theType); + MODEL_EXPORT virtual std::list + attributesIDs(const std::string &theType); /// Identifier by the id (not fast, iteration by map) /// \param theAttr attribute already created in this data - MODEL_EXPORT virtual const std::string& id(const std::shared_ptr& theAttr); + MODEL_EXPORT virtual const std::string & + id(const std::shared_ptr &theAttr); /// Returns true if data belongs to same features - MODEL_EXPORT virtual bool isEqual(const std::shared_ptr& theData); + MODEL_EXPORT virtual bool + isEqual(const std::shared_ptr &theData); /// Returns true if it is correctly connected to the data model MODEL_EXPORT virtual bool isValid(); /// Returns the label where the shape must be stored (used in ResultBody) - TDF_Label shapeLab() const - { + TDF_Label shapeLab() const { return myLab.IsNull() ? myLab : myLab.Father().FindChild(2); } - /// Initializes object by the attributes: must be called just after the object is created - /// for each attribute of the object - /// \param theID identifier of the attribute that can be referenced by this ID later - /// \param theAttrType type of the created attribute (received from the type method) - /// \param theIndex index of the attribute in the internal data structure, for not-floating + /// Initializes object by the attributes: must be called just after the object + /// is created for each attribute of the object \param theID identifier of the + /// attribute that can be referenced by this ID later \param theAttrType type + /// of the created attribute (received from the type method) \param theIndex + /// index of the attribute in the internal data structure, for not-floating /// attributes it is -1 to let it automatically be added /// \returns the just created attribute - MODEL_EXPORT virtual AttributePtr - addAttribute(const std::string& theID, const std::string theAttrType, const int theIndex = -1); + MODEL_EXPORT virtual AttributePtr addAttribute(const std::string &theID, + const std::string theAttrType, + const int theIndex = -1); /// Adds a floating attribute (that may be added/removed during the data life) - /// \param theID identifier of the attribute that can be referenced by this ID later - /// \param theAttrType type of the created attribute (received from the type method) - /// \param theGroup identifier of the group this attribute belongs to, may be an empty string + /// \param theID identifier of the attribute that can be referenced by this ID + /// later \param theAttrType type of the created attribute (received from the + /// type method) \param theGroup identifier of the group this attribute + /// belongs to, may be an empty string MODEL_EXPORT virtual AttributePtr - addFloatingAttribute(const std::string& theID, const std::string theAttrType, - const std::string& theGroup); + addFloatingAttribute(const std::string &theID, const std::string theAttrType, + const std::string &theGroup); /// Returns all groups of this data (ordered). - MODEL_EXPORT virtual void allGroups(std::list& theGroups); + MODEL_EXPORT virtual void allGroups(std::list &theGroups); /// Returns an ordered list of attributes that belong to the given group - MODEL_EXPORT virtual void attributesOfGroup(const std::string& theGroup, - std::list >& theAttrs); + MODEL_EXPORT virtual void + attributesOfGroup(const std::string &theGroup, + std::list> &theAttrs); /// Remove all attributes of the given group - MODEL_EXPORT virtual void removeAttributes(const std::string& theGroup); + MODEL_EXPORT virtual void removeAttributes(const std::string &theGroup); - /// Useful method for "set" methods of the attributes: sends an UPDATE event and - /// makes attribute initialized - MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr); + /// Useful method for "set" methods of the attributes: sends an UPDATE event + /// and makes attribute initialized + MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute *theAttr); /// Blocks sending "attribute updated" if theBlock is true /// \param theBlock allows switching on/off the blocking state /// \param theSendMessage if false, it does not send the update message /// even if something is changed - /// (normally is it used in attributeChanged because this message will be sent anyway) + /// (normally is it used in attributeChanged because this message + /// will be sent anyway) /// \returns the previous state of block - MODEL_EXPORT virtual bool blockSendAttributeUpdated( - const bool theBlock, const bool theSendMessage = true); + MODEL_EXPORT virtual bool + blockSendAttributeUpdated(const bool theBlock, + const bool theSendMessage = true); /// Puts feature to the document data sub-structure MODEL_EXPORT void setLabel(TDF_Label theLab); /// Sets the object of this data - MODEL_EXPORT virtual void setObject(ObjectPtr theObject) - { + MODEL_EXPORT virtual void setObject(ObjectPtr theObject) { myObject = theObject; } @@ -244,7 +255,8 @@ class Model_Data : public ModelAPI_Data MODEL_EXPORT virtual ModelAPI_ExecState execState(); /// Registers error during the execution, causes the ExecutionFailed state - MODEL_EXPORT virtual void setError(const std::string& theError, bool theSend = true); + MODEL_EXPORT virtual void setError(const std::string &theError, + bool theSend = true); /// Erases the error string if it is not empty void eraseErrorString(); @@ -256,42 +268,48 @@ class Model_Data : public ModelAPI_Data MODEL_EXPORT virtual int featureId() const; /// returns all objects referenced to this - MODEL_EXPORT virtual const std::set& refsToMe() {return myRefsToMe;} + MODEL_EXPORT virtual const std::set &refsToMe() { + return myRefsToMe; + } /// returns all references by attributes of this data /// \param theRefs returned list of pairs: /// id of referenced attribute and list of referenced objects MODEL_EXPORT virtual void referencesToObjects( - std::list > >& theRefs); + std::list>> &theRefs); /// Copies all attributes content into theTarget data MODEL_EXPORT virtual void copyTo(std::shared_ptr theTarget); - /// Returns the invalid data pointer (to avoid working with NULL shared pointers in swig) + /// Returns the invalid data pointer (to avoid working with NULL shared + /// pointers in swig) MODEL_EXPORT virtual std::shared_ptr invalidPtr(); /// Returns the invalid data pointer: static method static std::shared_ptr invalidData(); - /// Identifier of the transaction when object (feature or result) was updated last time. + /// Identifier of the transaction when object (feature or result) was updated + /// last time. MODEL_EXPORT virtual int updateID(); - /// Identifier of the transaction when object (feature or result) was updated last time. - /// This method is called by the updater. + /// Identifier of the transaction when object (feature or result) was updated + /// last time. This method is called by the updater. MODEL_EXPORT virtual void setUpdateID(const int theID); - /// Returns true if the given object is owner of this data (needed for correct erase of object - /// with duplicated data) + /// Returns true if the given object is owner of this data (needed for correct + /// erase of object with duplicated data) MODEL_EXPORT virtual std::shared_ptr owner(); protected: - /// Returns true if "is in history" custom behaviors is defined for the feature + /// Returns true if "is in history" custom behaviors is defined for the + /// feature MODEL_EXPORT virtual bool isInHistory(); /// Defines the custom "is in history" behavior MODEL_EXPORT virtual void setIsInHistory(const bool theFlag); - /// Returns true if the object is deleted, but some data is still kept in memory + /// Returns true if the object is deleted, but some data is still kept in + /// memory MODEL_EXPORT virtual bool isDeleted(); /// Sets true if the object is deleted, but some data is still kept in memory @@ -301,72 +319,80 @@ protected: void clearAttributes(); private: - /// Removes a back reference (with identifier which attribute references to this object) - /// \param theFeature feature referenced to this - /// \param theAttrID identifier of the attribute that is references from theFeature to this + /// Removes a back reference (with identifier which attribute references to + /// this object) \param theFeature feature referenced to this \param theAttrID + /// identifier of the attribute that is references from theFeature to this void removeBackReference(ObjectPtr theObject, std::string theAttrID); /// Removes a back reference (by the attribute) /// \param theAttr the referenced attribute void removeBackReference(AttributePtr theAttr); - /// Adds a back reference (with identifier which attribute references to this object - /// \param theFeature feature referenced to this - /// \param theAttrID identifier of the attribute that is references from theFeature to this + /// Adds a back reference (with identifier which attribute references to this + /// object \param theFeature feature referenced to this \param theAttrID + /// identifier of the attribute that is references from theFeature to this /// \param theApplyConcealment applies concealment flag changes void addBackReference(FeaturePtr theFeature, std::string theAttrID, - const bool theApplyConcealment = true); + const bool theApplyConcealment = true); /// Adds a back reference to an object /// \param theObject object referenced to this - /// \param theAttrID identifier of the attribute that is references from theFolder to this + /// \param theAttrID identifier of the attribute that is references from + /// theFolder to this void addBackReference(ObjectPtr theObject, std::string theAttrID); /// Makes the concealment flag up to date for this object-owner. MODEL_EXPORT virtual void updateConcealmentFlag(); - /// Returns true if object must be displayed in the viewer: flag is stored in the - /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps - /// the original state in the current transaction. + /// Returns true if object must be displayed in the viewer: flag is stored in + /// the data model, so on undo/redo, open/save or recreation of object by + /// history-playing it keeps the original state in the current transaction. MODEL_EXPORT virtual bool isDisplayed(); - /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" - /// signal. + /// Sets the displayed/hidden state of the object. If it is changed, sends the + /// "redisplay" signal. MODEL_EXPORT virtual void setDisplayed(const bool theDisplay); - /// Returns \c true if theAttribute1 is going earlier than theAttribute2 in the data - MODEL_EXPORT virtual bool isPrecedingAttribute(const std::string& theAttribute1, - const std::string& theAttribute2) const; - + /// Returns \c true if theAttribute1 is going earlier than theAttribute2 in + /// the data + MODEL_EXPORT virtual bool + isPrecedingAttribute(const std::string &theAttribute1, + const std::string &theAttribute2) const; }; /// Generic method to register back reference, used in referencing attributes. /// Without concealment change, it will be done later, on synchronization. -#define ADD_BACK_REF(TARGET) \ - if (TARGET.get() != NULL) { \ - std::shared_ptr aTargetData = \ - std::dynamic_pointer_cast((TARGET)->data()); \ - FeaturePtr anAttributeOwnerFeature = std::dynamic_pointer_cast(owner()); \ - if (anAttributeOwnerFeature.get()) \ - aTargetData->addBackReference(anAttributeOwnerFeature, id(), false); \ - else { \ - FolderPtr anAttributeOwnerFolder = std::dynamic_pointer_cast(owner()); \ - if (anAttributeOwnerFolder.get()) \ - aTargetData->addBackReference(ObjectPtr(anAttributeOwnerFolder), id()); \ - } \ +#define ADD_BACK_REF(TARGET) \ + if (TARGET.get() != NULL) { \ + std::shared_ptr aTargetData = \ + std::dynamic_pointer_cast((TARGET)->data()); \ + FeaturePtr anAttributeOwnerFeature = \ + std::dynamic_pointer_cast(owner()); \ + if (anAttributeOwnerFeature.get()) \ + aTargetData->addBackReference(anAttributeOwnerFeature, id(), false); \ + else { \ + FolderPtr anAttributeOwnerFolder = \ + std::dynamic_pointer_cast(owner()); \ + if (anAttributeOwnerFolder.get()) \ + aTargetData->addBackReference(ObjectPtr(anAttributeOwnerFolder), \ + id()); \ + } \ } /// Generic method to unregister back reference, used in referencing attributes. /// Without concealment change, it will be done later, on synchronization. -#define REMOVE_BACK_REF(TARGET) \ - if (TARGET.get() != NULL) { \ - std::shared_ptr aTargetData = \ - std::dynamic_pointer_cast((TARGET)->data()); \ - FeaturePtr anAttOwnerFeature = std::dynamic_pointer_cast(owner()); \ - if (anAttOwnerFeature.get()) \ - aTargetData->removeBackReference(anAttOwnerFeature, id()); \ - else { \ - FolderPtr anAttributeOwnerFolder = std::dynamic_pointer_cast(owner()); \ - if (anAttributeOwnerFolder.get()) \ - aTargetData->removeBackReference(ObjectPtr(anAttributeOwnerFolder), id()); \ - } \ +#define REMOVE_BACK_REF(TARGET) \ + if (TARGET.get() != NULL) { \ + std::shared_ptr aTargetData = \ + std::dynamic_pointer_cast((TARGET)->data()); \ + FeaturePtr anAttOwnerFeature = \ + std::dynamic_pointer_cast(owner()); \ + if (anAttOwnerFeature.get()) \ + aTargetData->removeBackReference(anAttOwnerFeature, id()); \ + else { \ + FolderPtr anAttributeOwnerFolder = \ + std::dynamic_pointer_cast(owner()); \ + if (anAttributeOwnerFolder.get()) \ + aTargetData->removeBackReference(ObjectPtr(anAttributeOwnerFolder), \ + id()); \ + } \ } #endif diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 5f8b9fe53..805644215 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -14,55 +14,55 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include #include #include -#include +#include #include -#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include #include -#include #include #include -#include #include +#include +#include #include #include @@ -82,34 +82,36 @@ #endif #ifdef WIN32 -# define _separator_ '\\' +#define _separator_ '\\' #else -# define _separator_ '/' +#define _separator_ '/' #endif -static const int UNDO_LIMIT = 1000; // number of possible undo operations (big for sketcher) +static const int UNDO_LIMIT = + 1000; // number of possible undo operations (big for sketcher) -static const int TAG_GENERAL = 1; // general properties tag +static const int TAG_GENERAL = 1; // general properties tag // general sub-labels -/// where the reference to the current feature label is located (or no attribute if null feature) +/// where the reference to the current feature label is located (or no attribute +/// if null feature) static const int TAG_CURRENT_FEATURE = 1; ///< reference to the current feature /// integer, index of the transaction + GUID for auto recomputation blocking static const int TAG_CURRENT_TRANSACTION = 2; -static const int TAG_SELECTION_FEATURE = 3; ///< integer, tag of the selection feature label -static const int TAG_NODES_STATE = 4; ///< array, tag of the Object Browser nodes states +static const int TAG_SELECTION_FEATURE = + 3; ///< integer, tag of the selection feature label +static const int TAG_NODES_STATE = + 4; ///< array, tag of the Object Browser nodes states ///< naming structures constructions selected from other document static const int TAG_EXTERNAL_CONSTRUCTIONS = 5; /// reference to the shape in external document: sting list attribute identifier -static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd"); +static const Standard_GUID + kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd"); Model_Document::Model_Document(const int theID, const std::string theKind) - : myID(theID), - myKind(theKind), - myIsActive(false), - myIsSetCurrentFeature(false) -{ + : myID(theID), myKind(theKind), myIsActive(false), + myIsSetCurrentFeature(false) { Model_Application::getApplication()->NewDocument("BinOcaf", myDoc); myObjs = new Model_Objects(myDoc->Main()); myDoc->SetUndoLimit(UNDO_LIMIT); @@ -119,60 +121,60 @@ Model_Document::Model_Document(const int theID, const std::string theKind) // in transaction for nesting correct working myDoc->NewCommand(); TDataStd_Integer::Set(myDoc->Main().Father(), 0); - // this to avoid creation of integer attribute outside the transaction after undo + // this to avoid creation of integer attribute outside the transaction after + // undo transactionID(); myDoc->CommitCommand(); } -Model_Document::~Model_Document() -{ - if (!myDoc.IsNull()) - { +Model_Document::~Model_Document() { + if (!myDoc.IsNull()) { myDoc->ClearUndos(); myDoc->ClearRedos(); } } -void Model_Document::setThis(DocumentPtr theDoc) -{ - myObjs->setOwner(theDoc); -} +void Model_Document::setThis(DocumentPtr theDoc) { myObjs->setOwner(theDoc); } -/// Returns the file name of this document by the name of directory and identifier of a document -static TCollection_ExtendedString DocFileName(const char* theDirName, const std::string& theID) -{ - TCollection_ExtendedString aPath((const Standard_CString) theDirName); +/// Returns the file name of this document by the name of directory and +/// identifier of a document +static TCollection_ExtendedString DocFileName(const char *theDirName, + const std::string &theID) { + TCollection_ExtendedString aPath((const Standard_CString)theDirName); // remove end-separators - while(aPath.Length() && - (aPath.Value(aPath.Length()) == '\\' || aPath.Value(aPath.Length()) == '/')) + while (aPath.Length() && (aPath.Value(aPath.Length()) == '\\' || + aPath.Value(aPath.Length()) == '/')) aPath.Remove(aPath.Length()); aPath += _separator_; aPath += theID.c_str(); - aPath += ".cbf"; // standard binary file extension + aPath += ".cbf"; // standard binary file extension return aPath; } -bool Model_Document::isRoot() const -{ +bool Model_Document::isRoot() const { return this == Model_Session::get()->moduleDocument().get(); } // LCOV_EXCL_START -/// Makes all modification and generation naming shapes that have old shapes corresponding to -/// shapes in a root document be equal to this root document -static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label theRootAccess) -{ - TopTools_DataMapOfShapeShape aCurrentToRoot; // shapes that must be updated: from this to root - TDF_ChildIDIterator aThisIter(theThisAccess.Root(), kEXTERNAL_SHAPE_REF, true); - for(; aThisIter.More(); aThisIter.Next()) { +/// Makes all modification and generation naming shapes that have old shapes +/// corresponding to shapes in a root document be equal to this root document +static void updateShapesFromRoot(const TDF_Label theThisAccess, + const TDF_Label theRootAccess) { + TopTools_DataMapOfShapeShape + aCurrentToRoot; // shapes that must be updated: from this to root + TDF_ChildIDIterator aThisIter(theThisAccess.Root(), kEXTERNAL_SHAPE_REF, + true); + for (; aThisIter.More(); aThisIter.Next()) { aCurrentToRoot.Clear(); Handle(TNaming_NamedShape) aNS; - if (!aThisIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) + if (!aThisIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), + aNS)) continue; - if (aNS->Evolution() != TNaming_GENERATED && aNS->Evolution() != TNaming_MODIFY) + if (aNS->Evolution() != TNaming_GENERATED && + aNS->Evolution() != TNaming_MODIFY) continue; for (TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) { - const TopoDS_Shape& anOld = aNSIter.OldShape(); + const TopoDS_Shape &anOld = aNSIter.OldShape(); if (anOld.IsNull()) continue; TNaming_OldShapeIterator aNewIter(anOld, theThisAccess); @@ -189,7 +191,7 @@ static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label // search the same shape in the root document Handle(TDataStd_ExtStringList) anEntries = - Handle(TDataStd_ExtStringList)::DownCast(aThisIter.Value()); + Handle(TDataStd_ExtStringList)::DownCast(aThisIter.Value()); TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List()); for (; anIter.More(); anIter.Next()) { TDF_Label aRootLab; @@ -216,14 +218,15 @@ static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label if (!aCurrentToRoot.IsEmpty()) { // update the whole named shape content TopTools_ListOfShape anOld, aNew; TNaming_Evolution anEvol = aNS->Evolution(); - for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) { - anOld.Prepend(aCurrentToRoot.IsBound(aNSIter.OldShape()) ? - aCurrentToRoot.Find(aNSIter.OldShape()) : aNSIter.OldShape()); + for (TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) { + anOld.Prepend(aCurrentToRoot.IsBound(aNSIter.OldShape()) + ? aCurrentToRoot.Find(aNSIter.OldShape()) + : aNSIter.OldShape()); aNew.Prepend(aNSIter.NewShape()); } TNaming_Builder aBuilder(aNS->Label()); TopTools_ListOfShape::Iterator anOldIter(anOld), aNewIter(aNew); - for(; anOldIter.More(); anOldIter.Next(), aNewIter.Next()) { + for (; anOldIter.More(); anOldIter.Next(), aNewIter.Next()) { if (anEvol == TNaming_GENERATED) { aBuilder.Generated(anOldIter.Value(), aNewIter.Value()); } else if (anEvol == TNaming_MODIFY) { @@ -236,81 +239,107 @@ static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label // LCOV_EXCL_STOP static bool loadDocument(Handle(Model_Application) theApp, - Handle(TDocStd_Document)& theDoc, - const TCollection_ExtendedString& theFilename) -{ + Handle(TDocStd_Document) & theDoc, + const TCollection_ExtendedString &theFilename) { PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus)-1; try { aStatus = theApp->Open(theFilename, theDoc); - } catch (Standard_Failure const& anException) { - Events_InfoMessage("Model_Document", - "Exception in opening of document: %1").arg(anException.GetMessageString()).send(); + } catch (Standard_Failure const &anException) { + Events_InfoMessage("Model_Document", "Exception in opening of document: %1") + .arg(anException.GetMessageString()) + .send(); return false; } bool isOk = aStatus == PCDM_RS_OK; if (!isOk) { // LCOV_EXCL_START switch (aStatus) { - case PCDM_RS_UnknownDocument: - Events_InfoMessage("Model_Document", "Can not open document").send(); - break; - case PCDM_RS_AlreadyRetrieved: - Events_InfoMessage("Model_Document", "Can not open document: already opened").send(); - break; - case PCDM_RS_AlreadyRetrievedAndModified: - Events_InfoMessage("Model_Document", - "Can not open document: already opened and modified").send(); - break; - case PCDM_RS_NoDriver: - Events_InfoMessage("Model_Document", - "Can not open document: driver library is not found").send(); - break; - case PCDM_RS_UnknownFileDriver: - Events_InfoMessage("Model_Document", - "Can not open document: unknown driver for opening").send(); - break; - case PCDM_RS_OpenError: - Events_InfoMessage("Model_Document", "Can not open document: file open error").send(); - break; - case PCDM_RS_NoVersion: - Events_InfoMessage("Model_Document", "Can not open document: invalid version").send(); - break; - case PCDM_RS_NoModel: - Events_InfoMessage("Model_Document", "Can not open document: no data model").send(); - break; - case PCDM_RS_NoDocument: - Events_InfoMessage("Model_Document", "Can not open document: no document inside").send(); - break; - case PCDM_RS_FormatFailure: - Events_InfoMessage("Model_Document", "Can not open document: format failure").send(); - break; - case PCDM_RS_TypeNotFoundInSchema: - Events_InfoMessage("Model_Document", "Can not open document: invalid object").send(); - break; - case PCDM_RS_UnrecognizedFileFormat: - Events_InfoMessage("Model_Document", - "Can not open document: unrecognized file format").send(); - break; - case PCDM_RS_MakeFailure: - Events_InfoMessage("Model_Document", "Can not open document: make failure").send(); - break; - case PCDM_RS_PermissionDenied: - Events_InfoMessage("Model_Document", "Can not open document: permission denied").send(); - break; - case PCDM_RS_DriverFailure: - Events_InfoMessage("Model_Document", "Can not open document: driver failure").send(); - break; - default: - Events_InfoMessage("Model_Document", "Can not open document: unknown error").send(); - break; + case PCDM_RS_UnknownDocument: + Events_InfoMessage("Model_Document", "Can not open document").send(); + break; + case PCDM_RS_AlreadyRetrieved: + Events_InfoMessage("Model_Document", + "Can not open document: already opened") + .send(); + break; + case PCDM_RS_AlreadyRetrievedAndModified: + Events_InfoMessage("Model_Document", + "Can not open document: already opened and modified") + .send(); + break; + case PCDM_RS_NoDriver: + Events_InfoMessage("Model_Document", + "Can not open document: driver library is not found") + .send(); + break; + case PCDM_RS_UnknownFileDriver: + Events_InfoMessage("Model_Document", + "Can not open document: unknown driver for opening") + .send(); + break; + case PCDM_RS_OpenError: + Events_InfoMessage("Model_Document", + "Can not open document: file open error") + .send(); + break; + case PCDM_RS_NoVersion: + Events_InfoMessage("Model_Document", + "Can not open document: invalid version") + .send(); + break; + case PCDM_RS_NoModel: + Events_InfoMessage("Model_Document", + "Can not open document: no data model") + .send(); + break; + case PCDM_RS_NoDocument: + Events_InfoMessage("Model_Document", + "Can not open document: no document inside") + .send(); + break; + case PCDM_RS_FormatFailure: + Events_InfoMessage("Model_Document", + "Can not open document: format failure") + .send(); + break; + case PCDM_RS_TypeNotFoundInSchema: + Events_InfoMessage("Model_Document", + "Can not open document: invalid object") + .send(); + break; + case PCDM_RS_UnrecognizedFileFormat: + Events_InfoMessage("Model_Document", + "Can not open document: unrecognized file format") + .send(); + break; + case PCDM_RS_MakeFailure: + Events_InfoMessage("Model_Document", + "Can not open document: make failure") + .send(); + break; + case PCDM_RS_PermissionDenied: + Events_InfoMessage("Model_Document", + "Can not open document: permission denied") + .send(); + break; + case PCDM_RS_DriverFailure: + Events_InfoMessage("Model_Document", + "Can not open document: driver failure") + .send(); + break; + default: + Events_InfoMessage("Model_Document", + "Can not open document: unknown error") + .send(); + break; } // LCOV_EXCL_STOP } return isOk; } -bool Model_Document::load(const char* theDirName, const char* theFileName, DocumentPtr theThis) -{ +bool Model_Document::load(const char *theDirName, const char *theFileName, + DocumentPtr theThis) { Handle(Model_Application) anApp = Model_Application::getApplication(); if (isRoot()) { anApp->setLoadPath(theDirName); @@ -320,14 +349,15 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum bool isOk = loadDocument(anApp, aLoaded, aPath); std::shared_ptr aSession = - std::dynamic_pointer_cast(Model_Session::get()); + std::dynamic_pointer_cast(Model_Session::get()); if (isOk) { // keep handle to avoid destruction of the document until myObjs works on it Handle(TDocStd_Document) anOldDoc = myDoc; myDoc = aLoaded; myDoc->SetUndoLimit(UNDO_LIMIT); - // to avoid the problem that feature is created in the current, not this, document + // to avoid the problem that feature is created in the current, not this, + // document aSession->setActiveDocument(anApp->document(myID), false); aSession->setCheckTransactions(false); if (myObjs) @@ -341,33 +371,39 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum setCurrentFeature(currentFeature(false), false); aSession->setCheckTransactions(true); aSession->setActiveDocument(aSession->moduleDocument(), false); - // this is done in Part result "activate", so no needed here. Causes not-blue active part. + // this is done in Part result "activate", so no needed here. Causes + // not-blue active part. // aSession->setActiveDocument(anApp->getDocument(myID), true); // make sub-parts as loaded by demand std::list aPartResults; myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults); std::list::iterator aPartRes = aPartResults.begin(); - for(; aPartRes != aPartResults.end(); aPartRes++) { - ResultPartPtr aPart = std::dynamic_pointer_cast(*aPartRes); + for (; aPartRes != aPartResults.end(); aPartRes++) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(*aPartRes); if (aPart.get()) - anApp->setLoadByDemand(aPart->data()->name(), - aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->docId()); + anApp->setLoadByDemand( + aPart->data()->name(), + aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->docId()); } if (!isRoot()) { - updateShapesFromRoot(myDoc->Main(), - std::dynamic_pointer_cast(aSession->moduleDocument())->generalLabel()); + updateShapesFromRoot( + myDoc->Main(), + std::dynamic_pointer_cast(aSession->moduleDocument()) + ->generalLabel()); } - } else { // open failed, but new document was created to work with it: inform the model + } else { // open failed, but new document was created to work with it: inform + // the model aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false); } return isOk; } -bool Model_Document::importPart(const char* theFileName, - std::list >& theImported, - bool theCheckOnly) -{ +bool Model_Document::importPart( + const char *theFileName, + std::list> &theImported, + bool theCheckOnly) { Handle(Model_Application) anApp = Model_Application::getApplication(); TCollection_ExtendedString aFormat; if (!anApp->Format(theFileName, aFormat)) @@ -377,18 +413,21 @@ bool Model_Document::importPart(const char* theFileName, bool isOk = loadDocument(anApp, aTempDoc, theFileName); if (isOk && theCheckOnly) { - // verify all features are applicable for the current document type (e.g. PartSet) + // verify all features are applicable for the current document type (e.g. + // PartSet) std::shared_ptr aSession = std::dynamic_pointer_cast(ModelAPI_Session::get()); - for (TDF_ChildIterator anIt(aTempDoc->Main()); anIt.More() && isOk; anIt.Next()) { + for (TDF_ChildIterator anIt(aTempDoc->Main()); anIt.More() && isOk; + anIt.Next()) { TDF_Label aCurrentLab = anIt.Value(); Handle(TDataStd_Comment) aFeatureID; TDF_Label aNewFeatuerLab; if (aCurrentLab.FindAttribute(TDataStd_Comment::GetID(), aFeatureID)) { TCollection_AsciiString anID(aFeatureID->Get()); std::string aFeatureKind(anID.ToCString()); - if (aSession->myPlugins.find(aFeatureKind) != aSession->myPlugins.end()) { - std::string& aDocKind = aSession->myPlugins[aFeatureKind].second; + if (aSession->myPlugins.find(aFeatureKind) != + aSession->myPlugins.end()) { + std::string &aDocKind = aSession->myPlugins[aFeatureKind].second; isOk = aDocKind.empty() || aDocKind == kind(); } } @@ -398,9 +437,9 @@ bool Model_Document::importPart(const char* theFileName, if (isOk && !theCheckOnly) { // copy features from the temporary document to the current Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable(); - // add to relocation table source root label to the destination label because - // sometimes there could be a reference to root (issue 3267 on import part - // with sketch with removed features) + // add to relocation table source root label to the destination label + // because sometimes there could be a reference to root (issue 3267 on + // import part with sketch with removed features) aRelocTable->SetRelocation(aTempDoc->Main().Root(), myDoc->Main().Root()); TDF_LabelList anAllNewFeatures; // Perform the copying twice for correct references: @@ -446,8 +485,7 @@ bool Model_Document::importPart(const char* theFileName, static bool saveDocument(Handle(Model_Application) theApp, Handle(TDocStd_Document) theDoc, - const TCollection_ExtendedString& theFilename) -{ + const TCollection_ExtendedString &theFilename) { PCDM_StoreStatus aStatus; try { // create the directory to save the document @@ -459,10 +497,10 @@ static bool saveDocument(Handle(Model_Application) theApp, aBaseDir.Build(OSD_Protection()); // save the document aStatus = theApp->SaveAs(theDoc, theFilename); - } - catch (Standard_Failure const& anException) { - Events_InfoMessage("Model_Document", - "Exception in saving of document: %1").arg(anException.GetMessageString()).send(); + } catch (Standard_Failure const &anException) { + Events_InfoMessage("Model_Document", "Exception in saving of document: %1") + .arg(anException.GetMessageString()) + .send(); return false; } bool isDone = aStatus == PCDM_SS_OK || aStatus == PCDM_SS_No_Obj; @@ -470,10 +508,13 @@ static bool saveDocument(Handle(Model_Application) theApp, switch (aStatus) { case PCDM_SS_DriverFailure: Events_InfoMessage("Model_Document", - "Can not save document: save driver-library failure").send(); + "Can not save document: save driver-library failure") + .send(); break; case PCDM_SS_WriteFailure: - Events_InfoMessage("Model_Document", "Can not save document: file writing failure").send(); + Events_InfoMessage("Model_Document", + "Can not save document: file writing failure") + .send(); break; case PCDM_SS_Failure: default: @@ -484,24 +525,25 @@ static bool saveDocument(Handle(Model_Application) theApp, return isDone; } -bool Model_Document::save( - const char* theDirName, const char* theFileName, std::list& theResults) -{ - // if the history line is not in the end, move it to the end before save, otherwise - // problems with results restore and (the most important) naming problems will appear - // due to change evolution to SELECTION (problems in NamedShape and Name) +bool Model_Document::save(const char *theDirName, const char *theFileName, + std::list &theResults) { + // if the history line is not in the end, move it to the end before save, + // otherwise problems with results restore and (the most important) naming + // problems will appear due to change evolution to SELECTION (problems in + // NamedShape and Name) FeaturePtr aWasCurrent; std::shared_ptr aSession = - std::dynamic_pointer_cast(Model_Session::get()); + std::dynamic_pointer_cast(Model_Session::get()); if (currentFeature(false) != lastFeature()) { aSession->setCheckTransactions(false); aWasCurrent = currentFeature(false); // if last is nested into something else, make this something else as last: - // otherwise it will look like edition of sub-element, so, the main will be disabled + // otherwise it will look like edition of sub-element, so, the main will be + // disabled FeaturePtr aLast = lastFeature(); if (aLast.get()) { CompositeFeaturePtr aMain = ModelAPI_Tools::compositeOwner(aLast); - while(aMain.get()) { + while (aMain.get()) { aLast = aMain; aMain = ModelAPI_Tools::compositeOwner(aLast); } @@ -530,45 +572,50 @@ bool Model_Document::save( } myTransactionSave = int(myTransactions.size()); - if (isDone) { // save also sub-documents if any + if (isDone) { // save also sub-documents if any theResults.push_back(TCollection_AsciiString(aPath).ToCString()); // iterate all result parts to find all loaded or not yet loaded documents std::list aPartResults; myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults); std::list::iterator aPartRes = aPartResults.begin(); - for(; aPartRes != aPartResults.end(); aPartRes++) { - ResultPartPtr aPart = std::dynamic_pointer_cast(*aPartRes); + for (; aPartRes != aPartResults.end(); aPartRes++) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(*aPartRes); if (!aPart->isActivated()) { // copy not-activated document that is not in the memory std::string aDocName = Locale::Convert::toString(aPart->data()->name()); if (!aDocName.empty()) { // just copy file - TCollection_AsciiString aSubPath(DocFileName(anApp->loadPath().c_str(), aDocName)); + TCollection_AsciiString aSubPath( + DocFileName(anApp->loadPath().c_str(), aDocName)); OSD_Path aCopyPath(aSubPath); OSD_File aFile(aCopyPath); if (aFile.Exists()) { - TCollection_AsciiString aDestinationDir(DocFileName(theDirName, aDocName)); + TCollection_AsciiString aDestinationDir( + DocFileName(theDirName, aDocName)); OSD_Path aDestination(aDestinationDir); aFile.Copy(aDestination); theResults.push_back(aDestinationDir.ToCString()); } else { Events_InfoMessage("Model_Document", - "Can not open file %1 for saving").arg(aSubPath.ToCString()).send(); + "Can not open file %1 for saving") + .arg(aSubPath.ToCString()) + .send(); } } } else { // simply save opened document std::string aDocName = Locale::Convert::toString(aPart->data()->name()); - isDone = std::dynamic_pointer_cast(aPart->partDoc())-> - save(theDirName, aDocName.c_str(), theResults); + isDone = std::dynamic_pointer_cast(aPart->partDoc()) + ->save(theDirName, aDocName.c_str(), theResults); } } } return isDone; } -bool Model_Document::save(const char* theFilename, - const std::list& theExportFeatures) const -{ +bool Model_Document::save( + const char *theFilename, + const std::list &theExportFeatures) const { Handle(Model_Application) anApp = Model_Application::getApplication(); TCollection_ExtendedString aFormat; if (!anApp->Format(theFilename, aFormat)) @@ -583,16 +630,19 @@ bool Model_Document::save(const char* theFilename, // 1. copy labels hierarchy and fill the relocation table for (; anIt != theExportFeatures.end(); ++anIt) { TDF_Label aFeatureLab = aMain.NewChild(); - std::shared_ptr aData = std::dynamic_pointer_cast((*anIt)->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast((*anIt)->data()); Model_Tools::copyLabels(aData->label().Father(), aFeatureLab, aRelocTable); } // 2. copy attributes std::set aCoordinateLabels; Model_Tools::labelsOfCoordinates(aCoordinateLabels, aRelocTable); TDF_ChildIterator aChildIt(aMain); - for (anIt = theExportFeatures.begin(); anIt != theExportFeatures.end(); ++anIt) { + for (anIt = theExportFeatures.begin(); anIt != theExportFeatures.end(); + ++anIt) { TDF_Label aFeatureLab = aChildIt.Value(); - std::shared_ptr aData = std::dynamic_pointer_cast((*anIt)->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast((*anIt)->data()); Model_Tools::copyAttrsAndKeepRefsToCoordinates( aData->label().Father(), aFeatureLab, aCoordinateLabels, aRelocTable); aChildIt.Next(); @@ -604,8 +654,7 @@ bool Model_Document::save(const char* theFilename, return isDone; } -void Model_Document::close(const bool theForever) -{ +void Model_Document::close(const bool theForever) { std::shared_ptr aPM = Model_Session::get(); if (!isRoot() && this == aPM->activeDocument().get()) { aPM->setActiveDocument(aPM->moduleDocument()); @@ -623,7 +672,8 @@ void Model_Document::close(const bool theForever) } // close for this document needs no transaction in this document - std::static_pointer_cast(Model_Session::get())->setCheckTransactions(false); + std::static_pointer_cast(Model_Session::get()) + ->setCheckTransactions(false); // close all only if it is really asked, otherwise it can be undone/redone if (theForever) { @@ -636,25 +686,29 @@ void Model_Document::close(const bool theForever) } else { setCurrentFeature(FeaturePtr(), false); // disables all features // update the OB: features are disabled (on remove of Part) - Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aDeleteEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + Events_Loop *aLoop = Events_Loop::loop(); + static Events_ID aDeleteEvent = + Events_Loop::eventByName(EVENT_OBJECT_DELETED); aLoop->flush(aDeleteEvent); } - std::static_pointer_cast(Model_Session::get())->setCheckTransactions(true); + std::static_pointer_cast(Model_Session::get()) + ->setCheckTransactions(true); } -void Model_Document::startOperation() -{ - incrementTransactionID(); // outside of transaction in order to avoid empty transactions keeping - if (myDoc->HasOpenCommand()) { // start of nested command +void Model_Document::startOperation() { + incrementTransactionID(); // outside of transaction in order to avoid empty + // transactions keeping + if (myDoc->HasOpenCommand()) { // start of nested command if (myDoc->CommitCommand()) { // commit the current: it will contain all nested after compactification - myTransactions.rbegin()->myOCAFNum++; // if has open command, the list is not empty + myTransactions.rbegin() + ->myOCAFNum++; // if has open command, the list is not empty } - myNestedNum.push_back(0); // start of nested operation with zero transactions inside yet + myNestedNum.push_back( + 0); // start of nested operation with zero transactions inside yet myDoc->OpenCommand(); - } else { // start the simple command + } else { // start the simple command myDoc->NewCommand(); } // starts a new operation @@ -669,28 +723,30 @@ void Model_Document::startOperation() subDoc(*aSubIter)->startOperation(); } -void Model_Document::compactNested() -{ +void Model_Document::compactNested() { if (!myNestedNum.empty()) { int aNumToCompact = *(myNestedNum.rbegin()); int aSumOfTransaction = 0; - for(int a = 0; a < aNumToCompact; a++) { + for (int a = 0; a < aNumToCompact; a++) { aSumOfTransaction += myTransactions.rbegin()->myOCAFNum; myTransactions.pop_back(); } - // the latest transaction is the start of lower-level operation which starts the nested + // the latest transaction is the start of lower-level operation which starts + // the nested myTransactions.rbegin()->myOCAFNum += aSumOfTransaction; myNestedNum.pop_back(); } } /// Compares the content of the given attributes, returns true if equal. -/// This method is used to avoid empty transactions when only "current" is changed -/// to some value and then comes back in this transaction, so, it compares only -/// references and Boolean and Integer Arrays for the current moment. -static bool isEqualContent(Handle(TDF_Attribute) theAttr1, Handle(TDF_Attribute) theAttr2) -{ - if (Standard_GUID::IsEqual(theAttr1->ID(), TDF_Reference::GetID())) { // reference +/// This method is used to avoid empty transactions when only "current" is +/// changed to some value and then comes back in this transaction, so, it +/// compares only references and Boolean and Integer Arrays for the current +/// moment. +static bool isEqualContent(Handle(TDF_Attribute) theAttr1, + Handle(TDF_Attribute) theAttr2) { + if (Standard_GUID::IsEqual(theAttr1->ID(), + TDF_Reference::GetID())) { // reference Handle(TDF_Reference) aRef1 = Handle(TDF_Reference)::DownCast(theAttr1); Handle(TDF_Reference) aRef2 = Handle(TDF_Reference)::DownCast(theAttr2); if (aRef1.IsNull() && aRef2.IsNull()) @@ -698,107 +754,128 @@ static bool isEqualContent(Handle(TDF_Attribute) theAttr1, Handle(TDF_Attribute) if (aRef1.IsNull() || aRef2.IsNull()) return false; return aRef1->Get().IsEqual(aRef2->Get()) == Standard_True; - } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_BooleanArray::GetID())) { - Handle(TDataStd_BooleanArray) anArr1 = Handle(TDataStd_BooleanArray)::DownCast(theAttr1); - Handle(TDataStd_BooleanArray) anArr2 = Handle(TDataStd_BooleanArray)::DownCast(theAttr2); + } else if (Standard_GUID::IsEqual(theAttr1->ID(), + TDataStd_BooleanArray::GetID())) { + Handle(TDataStd_BooleanArray) anArr1 = + Handle(TDataStd_BooleanArray)::DownCast(theAttr1); + Handle(TDataStd_BooleanArray) anArr2 = + Handle(TDataStd_BooleanArray)::DownCast(theAttr2); if (anArr1.IsNull() && anArr2.IsNull()) return true; if (anArr1.IsNull() || anArr2.IsNull()) return false; - if (anArr1->Lower() == anArr2->Lower() && anArr1->Upper() == anArr2->Upper()) { - for(int a = anArr1->Lower(); a <= anArr1->Upper(); a++) { + if (anArr1->Lower() == anArr2->Lower() && + anArr1->Upper() == anArr2->Upper()) { + for (int a = anArr1->Lower(); a <= anArr1->Upper(); a++) { if (a == 1 && // second is for display - anArr2->Label().Tag() == 1 && (anArr2->Label().Depth() == 4 || - anArr2->Label().Depth() == 6)) + anArr2->Label().Tag() == 1 && + (anArr2->Label().Depth() == 4 || anArr2->Label().Depth() == 6)) continue; if (anArr1->Value(a) != anArr2->Value(a)) return false; } return true; } - } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_IntegerArray::GetID())) { - Handle(TDataStd_IntegerArray) anArr1 = Handle(TDataStd_IntegerArray)::DownCast(theAttr1); - Handle(TDataStd_IntegerArray) anArr2 = Handle(TDataStd_IntegerArray)::DownCast(theAttr2); + } else if (Standard_GUID::IsEqual(theAttr1->ID(), + TDataStd_IntegerArray::GetID())) { + Handle(TDataStd_IntegerArray) anArr1 = + Handle(TDataStd_IntegerArray)::DownCast(theAttr1); + Handle(TDataStd_IntegerArray) anArr2 = + Handle(TDataStd_IntegerArray)::DownCast(theAttr2); if (anArr1.IsNull() && anArr2.IsNull()) return true; if (anArr1.IsNull() || anArr2.IsNull()) return false; - if (anArr1->Lower() == anArr2->Lower() && anArr1->Upper() == anArr2->Upper()) { - for(int a = anArr1->Lower(); a <= anArr1->Upper(); a++) + if (anArr1->Lower() == anArr2->Lower() && + anArr1->Upper() == anArr2->Upper()) { + for (int a = anArr1->Lower(); a <= anArr1->Upper(); a++) if (anArr1->Value(a) != anArr2->Value(a)) { // avoid the transaction ID checking if (a == 2 && anArr1->Upper() == 2 && anArr2->Label().Tag() == 1 && - (anArr2->Label().Depth() == 4 || anArr2->Label().Depth() == 6)) + (anArr2->Label().Depth() == 4 || anArr2->Label().Depth() == 6)) continue; return false; } return true; } - } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_ReferenceArray::GetID())) { - Handle(TDataStd_ReferenceArray) anArr1 = Handle(TDataStd_ReferenceArray)::DownCast(theAttr1); - Handle(TDataStd_ReferenceArray) anArr2 = Handle(TDataStd_ReferenceArray)::DownCast(theAttr2); + } else if (Standard_GUID::IsEqual(theAttr1->ID(), + TDataStd_ReferenceArray::GetID())) { + Handle(TDataStd_ReferenceArray) anArr1 = + Handle(TDataStd_ReferenceArray)::DownCast(theAttr1); + Handle(TDataStd_ReferenceArray) anArr2 = + Handle(TDataStd_ReferenceArray)::DownCast(theAttr2); if (anArr1.IsNull() && anArr2.IsNull()) return true; if (anArr1.IsNull() || anArr2.IsNull()) return false; - if (anArr1->Lower() == anArr2->Lower() && anArr1->Upper() == anArr2->Upper()) { - for(int a = anArr1->Lower(); a <= anArr1->Upper(); a++) + if (anArr1->Lower() == anArr2->Lower() && + anArr1->Upper() == anArr2->Upper()) { + for (int a = anArr1->Lower(); a <= anArr1->Upper(); a++) if (anArr1->Value(a) != anArr2->Value(a)) { // avoid the transaction ID checking if (a == 2 && anArr1->Upper() == 2 && anArr2->Label().Tag() == 1 && - (anArr2->Label().Depth() == 4 || anArr2->Label().Depth() == 6)) + (anArr2->Label().Depth() == 4 || anArr2->Label().Depth() == 6)) continue; return false; } return true; } - } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_ReferenceList::GetID())) { - Handle(TDataStd_ReferenceList) aList1 = Handle(TDataStd_ReferenceList)::DownCast(theAttr1); - Handle(TDataStd_ReferenceList) aList2= Handle(TDataStd_ReferenceList)::DownCast(theAttr2); + } else if (Standard_GUID::IsEqual(theAttr1->ID(), + TDataStd_ReferenceList::GetID())) { + Handle(TDataStd_ReferenceList) aList1 = + Handle(TDataStd_ReferenceList)::DownCast(theAttr1); + Handle(TDataStd_ReferenceList) aList2 = + Handle(TDataStd_ReferenceList)::DownCast(theAttr2); if (aList1.IsNull() && aList2.IsNull()) return true; if (aList1.IsNull() || aList2.IsNull()) return false; - const TDF_LabelList& aLList1 = aList1->List(); - const TDF_LabelList& aLList2 = aList2->List(); + const TDF_LabelList &aLList1 = aList1->List(); + const TDF_LabelList &aLList2 = aList2->List(); TDF_ListIteratorOfLabelList aLIter1(aLList1); TDF_ListIteratorOfLabelList aLIter2(aLList2); - for(; aLIter1.More() && aLIter2.More(); aLIter1.Next(), aLIter2.Next()) { + for (; aLIter1.More() && aLIter2.More(); aLIter1.Next(), aLIter2.Next()) { if (aLIter1.Value() != aLIter2.Value()) return false; } - return !aLIter1.More() && !aLIter2.More(); // both lists are with the same size + return !aLIter1.More() && + !aLIter2.More(); // both lists are with the same size } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDF_TagSource::GetID())) { return true; // it just for created and removed feature: nothing is changed } return false; } -/// Returns true if the last transaction is actually empty: modification to the same values -/// were performed only -static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) { +/// Returns true if the last transaction is actually empty: modification to the +/// same values were performed only +static bool isEmptyTransaction(const Handle(TDocStd_Document) & theDoc) { Handle(TDF_Delta) aDelta; aDelta = theDoc->GetUndos().Last(); TDF_LabelList aDeltaList; - aDelta->Labels(aDeltaList); // it clears list, so, use new one and then append to the result + aDelta->Labels(aDeltaList); // it clears list, so, use new one and then append + // to the result if (!aDeltaList.IsEmpty()) { return false; } // add also label of the modified attributes - const TDF_AttributeDeltaList& anAttrs = aDelta->AttributeDeltas(); - for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); anAttr.Next()) { - Handle(TDF_AttributeDelta)& anADelta = anAttr.Value(); - Handle(TDF_DeltaOnAddition) anAddition = Handle(TDF_DeltaOnAddition)::DownCast(anADelta); - if (anAddition.IsNull()) { // if the attribute was added, transaction is not empty + const TDF_AttributeDeltaList &anAttrs = aDelta->AttributeDeltas(); + for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); + anAttr.Next()) { + Handle(TDF_AttributeDelta) &anADelta = anAttr.Value(); + Handle(TDF_DeltaOnAddition) anAddition = + Handle(TDF_DeltaOnAddition)::DownCast(anADelta); + if (anAddition + .IsNull()) { // if the attribute was added, transaction is not empty if (!anADelta->Label().IsNull() && !anADelta->Attribute().IsNull()) { Handle(TDF_Attribute) aCurrentAttr; - if (anADelta->Label().FindAttribute(anADelta->Attribute()->ID(), aCurrentAttr)) { + if (anADelta->Label().FindAttribute(anADelta->Attribute()->ID(), + aCurrentAttr)) { if (isEqualContent(anADelta->Attribute(), aCurrentAttr)) { continue; // attribute is not changed actually } - } else - if (Standard_GUID::IsEqual(anADelta->Attribute()->ID(), TDataStd_AsciiString::GetID())) { - continue; // error message is disappeared + } else if (Standard_GUID::IsEqual(anADelta->Attribute()->ID(), + TDataStd_AsciiString::GetID())) { + continue; // error message is disappeared } } } @@ -807,11 +884,10 @@ static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) { return true; } -bool Model_Document::finishOperation() -{ +bool Model_Document::finishOperation() { bool isNestedClosed = !myDoc->HasOpenCommand() && !myNestedNum.empty(); static std::shared_ptr aSession = - std::static_pointer_cast(Model_Session::get()); + std::static_pointer_cast(Model_Session::get()); // open transaction if nested is closed to fit inside // all synchronizeBackRefs and flushed consequences @@ -820,11 +896,12 @@ bool Model_Document::finishOperation() } // do it before flashes to enable and recompute nesting features correctly if (myNestedNum.empty() || (isNestedClosed && myNestedNum.size() == 1)) { - // if all nested operations are closed, make current the higher level objects (to perform - // it in the python scripts correctly): sketch become current after creation of sub-elements + // if all nested operations are closed, make current the higher level + // objects (to perform it in the python scripts correctly): sketch become + // current after creation of sub-elements FeaturePtr aCurrent = currentFeature(false); CompositeFeaturePtr aMain, aNext = ModelAPI_Tools::compositeOwner(aCurrent); - while(aNext.get()) { + while (aNext.get()) { aMain = aNext; aNext = ModelAPI_Tools::compositeOwner(aMain); } @@ -832,11 +909,15 @@ bool Model_Document::finishOperation() setCurrentFeature(aMain, false); } myObjs->synchronizeBackRefs(); - Events_Loop* aLoop = Events_Loop::loop(); - static const Events_ID kCreatedEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); - static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); - static const Events_ID kRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const Events_ID kDeletedEvent = aLoop->eventByName(EVENT_OBJECT_DELETED); + Events_Loop *aLoop = Events_Loop::loop(); + static const Events_ID kCreatedEvent = + aLoop->eventByName(EVENT_OBJECT_CREATED); + static const Events_ID kUpdatedEvent = + aLoop->eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID kRedispEvent = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const Events_ID kDeletedEvent = + aLoop->eventByName(EVENT_OBJECT_DELETED); aLoop->flush(kCreatedEvent); aLoop->flush(kUpdatedEvent); aLoop->flush(kRedispEvent); @@ -847,19 +928,22 @@ bool Model_Document::finishOperation() myTransactions.rbegin()->myOCAFNum++; } - // this must be here just after everything is finished but before real transaction stop - // to avoid messages about modifications outside of the transaction - // and to rebuild everything after all updates and creates + // this must be here just after everything is finished but before real + // transaction stop to avoid messages about modifications outside of the + // transaction and to rebuild everything after all updates and creates if (isRoot()) { // once for root document - static std::shared_ptr aFinishMsg - (new Events_Message(Events_Loop::eventByName("FinishOperation"))); + static std::shared_ptr aFinishMsg( + new Events_Message(Events_Loop::eventByName("FinishOperation"))); Events_Loop::loop()->send(aFinishMsg); } - // for open of document with primitive box inside (finish transaction in initAttributes) + // for open of document with primitive box inside (finish transaction in + // initAttributes) bool aWasActivatedFlushes = aLoop->activateFlushes(true); - while(aLoop->hasGrouppedEvent(kCreatedEvent) || aLoop->hasGrouppedEvent(kUpdatedEvent) || - aLoop->hasGrouppedEvent(kRedispEvent) || aLoop->hasGrouppedEvent(kDeletedEvent)) { + while (aLoop->hasGrouppedEvent(kCreatedEvent) || + aLoop->hasGrouppedEvent(kUpdatedEvent) || + aLoop->hasGrouppedEvent(kRedispEvent) || + aLoop->hasGrouppedEvent(kDeletedEvent)) { aLoop->flush(kCreatedEvent); aLoop->flush(kUpdatedEvent); aLoop->flush(kRedispEvent); @@ -868,9 +952,10 @@ bool Model_Document::finishOperation() aLoop->activateFlushes(aWasActivatedFlushes); // to avoid "updated" message appearance by updater - //aLoop->clear(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + // aLoop->clear(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - // finish for all subs first: to avoid nested finishing and "isOperation" calls problems inside + // finish for all subs first: to avoid nested finishing and "isOperation" + // calls problems inside bool aResult = false; const std::set aSubs = subDocuments(); std::set::iterator aSubIter = aSubs.begin(); @@ -878,7 +963,8 @@ bool Model_Document::finishOperation() if (subDoc(*aSubIter)->finishOperation()) aResult = true; - // transaction may be empty if this document was created during this transaction (create part) + // transaction may be empty if this document was created during this + // transaction (create part) if (!myTransactions.empty() && myDoc->CommitCommand()) { // if commit is successful, just increment counters if (isEmptyTransaction(myDoc)) { // erase this transaction @@ -893,11 +979,13 @@ bool Model_Document::finishOperation() if (isNestedClosed) { compactNested(); } - if (!aResult && !myTransactions.empty() /* it can be for just created part document */) + if (!aResult && + !myTransactions.empty() /* it can be for just created part document */) aResult = myTransactions.rbegin()->myOCAFNum != 0; if (!aResult && isRoot()) { - // nothing inside in all documents, so remove this transaction from the transactions list + // nothing inside in all documents, so remove this transaction from the + // transactions list undoInternal(true, false); } // on finish clear redo in any case (issue 446) and for all subs (issue 408) @@ -911,26 +999,31 @@ bool Model_Document::finishOperation() return aResult; } -/// Returns in theDelta labels that has been modified in the latest transaction of theDoc -static void modifiedLabels(const Handle(TDocStd_Document)& theDoc, TDF_LabelList& theDelta, - const bool isRedo = false) { +/// Returns in theDelta labels that has been modified in the latest transaction +/// of theDoc +static void modifiedLabels(const Handle(TDocStd_Document) & theDoc, + TDF_LabelList &theDelta, const bool isRedo = false) { Handle(TDF_Delta) aDelta; if (isRedo) aDelta = theDoc->GetRedos().First(); else aDelta = theDoc->GetUndos().Last(); TDF_LabelList aDeltaList; - aDelta->Labels(aDeltaList); // it clears list, so, use new one and then append to the result - for(TDF_ListIteratorOfLabelList aListIter(aDeltaList); aListIter.More(); aListIter.Next()) { + aDelta->Labels(aDeltaList); // it clears list, so, use new one and then append + // to the result + for (TDF_ListIteratorOfLabelList aListIter(aDeltaList); aListIter.More(); + aListIter.Next()) { theDelta.Append(aListIter.Value()); } // add also label of the modified attributes - const TDF_AttributeDeltaList& anAttrs = aDelta->AttributeDeltas(); + const TDF_AttributeDeltaList &anAttrs = aDelta->AttributeDeltas(); /// named shape evolution also modifies integer on this label: exclude it TDF_LabelMap anExcludedInt; - for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); anAttr.Next()) { + for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); + anAttr.Next()) { if (anAttr.Value()->Attribute()->ID() == TDataStd_BooleanArray::GetID()) { - // Boolean array is used for feature auxiliary attributes only, feature args are not modified + // Boolean array is used for feature auxiliary attributes only, feature + // args are not modified continue; } if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) { @@ -943,10 +1036,10 @@ static void modifiedLabels(const Handle(TDocStd_Document)& theDoc, TDF_LabelList if (anExcludedInt.Contains(anAttr.Value()->Label())) continue; } - theDelta.Append(anAttr.Value()->Label()); + theDelta.Append(anAttr.Value()->Label()); } TDF_ListIteratorOfLabelList aDeltaIter(theDelta); - for(; aDeltaIter.More(); aDeltaIter.Next()) { + for (; aDeltaIter.More(); aDeltaIter.Next()) { if (anExcludedInt.Contains(aDeltaIter.Value())) { theDelta.Remove(aDeltaIter); if (!aDeltaIter.More()) @@ -955,18 +1048,18 @@ static void modifiedLabels(const Handle(TDocStd_Document)& theDoc, TDF_LabelList } } -void Model_Document::abortOperation() -{ +void Model_Document::abortOperation() { TDF_LabelList aDeltaLabels; // labels that are updated during "abort" - if (!myNestedNum.empty() && !myDoc->HasOpenCommand()) { // abort all what was done in nested + if (!myNestedNum.empty() && + !myDoc->HasOpenCommand()) { // abort all what was done in nested compactNested(); // store undo-delta here as undo actually does in the method later int a, aNumTransactions = myTransactions.rbegin()->myOCAFNum; - for(a = 0; a < aNumTransactions; a++) { + for (a = 0; a < aNumTransactions; a++) { modifiedLabels(myDoc, aDeltaLabels); myDoc->Undo(); } - for(a = 0; a < aNumTransactions; a++) { + for (a = 0; a < aNumTransactions; a++) { myDoc->Redo(); } @@ -979,13 +1072,13 @@ void Model_Document::abortOperation() if (!myNestedNum.empty()) (*myNestedNum.rbegin())--; // roll back the needed number of transactions - //myDoc->AbortCommand(); + // myDoc->AbortCommand(); // instead of abort, do commit and undo: to get the delta of modifications - if (myDoc->CommitCommand()) { + if (myDoc->CommitCommand()) { modifiedLabels(myDoc, aDeltaLabels); myDoc->Undo(); } - for(int a = 0; a < aNumTransactions; a++) { + for (int a = 0; a < aNumTransactions; a++) { modifiedLabels(myDoc, aDeltaLabels); myDoc->Undo(); } @@ -1000,33 +1093,32 @@ void Model_Document::abortOperation() myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot()); } -bool Model_Document::isOperation() const -{ +bool Model_Document::isOperation() const { // operation is opened for all documents: no need to check subs - return myDoc->HasOpenCommand() == Standard_True ; + return myDoc->HasOpenCommand() == Standard_True; } -bool Model_Document::isModified() -{ +bool Model_Document::isModified() { // is modified if at least one operation was committed and not undone return (int)myTransactions.size() != myTransactionSave || isOperation(); } -bool Model_Document::canUndo() -{ - // issue 406 : if transaction is opened, but nothing to undo behind, can not undo +bool Model_Document::canUndo() { + // issue 406 : if transaction is opened, but nothing to undo behind, can not + // undo int aCurrentNum = isOperation() ? 1 : 0; if (myDoc->GetAvailableUndos() > 0 && // there is something to undo in nested (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) && - myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */) + myTransactions.size() - aCurrentNum > + 0 /* for omitting the first useless transaction */) return true; // check other subs contains operation that can be undone const std::set aSubs = subDocuments(); std::set::iterator aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { std::shared_ptr aSub = subDoc(*aSubIter); - if (aSub->myObjs) {// if it was not closed before + if (aSub->myObjs) { // if it was not closed before if (aSub->canUndo()) return true; } @@ -1035,8 +1127,8 @@ bool Model_Document::canUndo() return false; } -void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchronize) -{ +void Model_Document::undoInternal(const bool theWithSubs, + const bool theSynchronize) { if (myTransactions.empty()) return; int aNumTransactions = myTransactions.rbegin()->myOCAFNum; @@ -1046,7 +1138,7 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron (*myNestedNum.rbegin())--; // roll back the needed number of transactions TDF_LabelList aDeltaLabels; - for(int a = 0; a < aNumTransactions; a++) { + for (int a = 0; a < aNumTransactions; a++) { if (theSynchronize) modifiedLabels(myDoc, aDeltaLabels); myDoc->Undo(); @@ -1063,7 +1155,8 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron subDoc(*aSubIter)->undoInternal(theWithSubs, theSynchronize); } } - // after undo of all sub-documents to avoid updates on not-modified data (issue 370) + // after undo of all sub-documents to avoid updates on not-modified data + // (issue 370) if (theSynchronize) { myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot()); // update the current features status @@ -1075,22 +1168,21 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron std::set::iterator aNewSubIter = aNewSubs.begin(); for (; aNewSubIter != aNewSubs.end(); aNewSubIter++) { // synchronize only newly appeared documents - if (!subDoc(*aNewSubIter)->myObjs || aSubs.find(*aNewSubIter) != aSubs.end()) + if (!subDoc(*aNewSubIter)->myObjs || + aSubs.find(*aNewSubIter) != aSubs.end()) continue; TDF_LabelList anEmptyDeltas; - subDoc(*aNewSubIter)->myObjs->synchronizeFeatures(anEmptyDeltas, true, false, true, true); + subDoc(*aNewSubIter) + ->myObjs->synchronizeFeatures(anEmptyDeltas, true, false, true, + true); } } } } -void Model_Document::undo() -{ - undoInternal(true, true); -} +void Model_Document::undo() { undoInternal(true, true); } -bool Model_Document::canRedo() -{ +bool Model_Document::canRedo() { if (!myRedos.empty()) return true; // check other subs contains operation that can be redone @@ -1105,15 +1197,14 @@ bool Model_Document::canRedo() return false; } -void Model_Document::redo() -{ +void Model_Document::redo() { if (!myNestedNum.empty()) (*myNestedNum.rbegin())++; int aNumRedos = myRedos.rbegin()->myOCAFNum; myTransactions.push_back(*myRedos.rbegin()); myRedos.pop_back(); TDF_LabelList aDeltaLabels; - for(int a = 0; a < aNumRedos; a++) { + for (int a = 0; a < aNumRedos; a++) { modifiedLabels(myDoc, aDeltaLabels, true); myDoc->Redo(); } @@ -1124,14 +1215,14 @@ void Model_Document::redo() for (; aSubIter != aSubs.end(); aSubIter++) subDoc(*aSubIter)->redo(); - // after redo of all sub-documents to avoid updates on not-modified data (issue 370) + // after redo of all sub-documents to avoid updates on not-modified data + // (issue 370) myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot()); // update the current features status setCurrentFeature(currentFeature(false), false); } -void Model_Document::clearUndoRedo() -{ +void Model_Document::clearUndoRedo() { myNestedNum.clear(); myTransactions.clear(); myRedos.clear(); @@ -1140,58 +1231,62 @@ void Model_Document::clearUndoRedo() myDoc->ClearRedos(); // clear for all subs const std::set aSubs = subDocuments(); - for (std::set::iterator aSubIter = aSubs.begin(); aSubIter != aSubs.end(); aSubIter++) + for (std::set::iterator aSubIter = aSubs.begin(); + aSubIter != aSubs.end(); aSubIter++) subDoc(*aSubIter)->clearUndoRedo(); } // this is used for creation of undo/redo1-list by GUI // LCOV_EXCL_START -std::list Model_Document::undoList() const -{ +std::list Model_Document::undoList() const { std::list aResult; // the number of skipped current operations (on undo they will be aborted) int aSkipCurrent = isOperation() ? 1 : 0; - std::list::const_reverse_iterator aTrIter = myTransactions.crbegin(); + std::list::const_reverse_iterator aTrIter = + myTransactions.crbegin(); int aNumUndo = int(myTransactions.size()); if (!myNestedNum.empty()) aNumUndo = *myNestedNum.rbegin(); - for( ; aNumUndo > 0; aTrIter++, aNumUndo--) { - if (aSkipCurrent == 0) aResult.push_back(aTrIter->myId); - else aSkipCurrent--; + for (; aNumUndo > 0; aTrIter++, aNumUndo--) { + if (aSkipCurrent == 0) + aResult.push_back(aTrIter->myId); + else + aSkipCurrent--; } return aResult; } -std::list Model_Document::redoList() const -{ +std::list Model_Document::redoList() const { std::list aResult; std::list::const_reverse_iterator aTrIter = myRedos.crbegin(); - for( ; aTrIter != myRedos.crend(); aTrIter++) { + for (; aTrIter != myRedos.crend(); aTrIter++) { aResult.push_back(aTrIter->myId); } return aResult; } // LCOV_EXCL_STOP -void Model_Document::operationId(const std::string& theId) -{ +void Model_Document::operationId(const std::string &theId) { myTransactions.rbegin()->myId = theId; } -FeaturePtr Model_Document::addFeature(std::string theID, const bool theMakeCurrent) -{ +FeaturePtr Model_Document::addFeature(std::string theID, + const bool theMakeCurrent) { std::shared_ptr aSession = - std::dynamic_pointer_cast(ModelAPI_Session::get()); + std::dynamic_pointer_cast(ModelAPI_Session::get()); if (!aSession->hasModuleDocument() || !myObjs) return FeaturePtr(); // this may be on close of the document FeaturePtr aFeature = aSession->createFeature(theID, this); if (!aFeature) return aFeature; aFeature->init(); - Model_Document* aDocToAdd; - if (!aFeature->documentToAdd().empty()) { // use the customized document to add + Model_Document *aDocToAdd; + if (!aFeature->documentToAdd() + .empty()) { // use the customized document to add if (aFeature->documentToAdd() != kind()) { // the root document by default - aDocToAdd = std::dynamic_pointer_cast(aSession->moduleDocument()).get(); + aDocToAdd = + std::dynamic_pointer_cast(aSession->moduleDocument()) + .get(); } else { aDocToAdd = this; } @@ -1199,65 +1294,72 @@ FeaturePtr Model_Document::addFeature(std::string theID, const bool theMakeCurre aDocToAdd = this; } if (aFeature) { - // searching for feature after which must be added the next feature: this is the current feature - // but also all sub-features of this feature + // searching for feature after which must be added the next feature: this is + // the current feature but also all sub-features of this feature FeaturePtr aCurrent = aDocToAdd->currentFeature(false); bool isModified = true; - for(CompositeFeaturePtr aComp = std::dynamic_pointer_cast(aCurrent); - aComp.get() && isModified; - aComp = std::dynamic_pointer_cast(aCurrent)) { - isModified = false; + for (CompositeFeaturePtr aComp = + std::dynamic_pointer_cast(aCurrent); + aComp.get() && isModified; + aComp = + std::dynamic_pointer_cast(aCurrent)) { + isModified = false; int aSubs = aComp->numberOfSubs(false); - for(int a = 0; a < aSubs; a++) { + for (int a = 0; a < aSubs; a++) { FeaturePtr aSub = aComp->subFeature(a, false); if (aSub && myObjs->isLater(aSub, aCurrent)) { - isModified = true; + isModified = true; aCurrent = aSub; } } } - // #2861,3029: if the parameter is added, add it after parameters existing in the list - if (aCurrent.get() && - (aFeature->getKind() == "Parameter" || aFeature->getKind() == "ParametersMgr")) { + // #2861,3029: if the parameter is added, add it after parameters existing + // in the list + if (aCurrent.get() && (aFeature->getKind() == "Parameter" || + aFeature->getKind() == "ParametersMgr")) { int anIndex = kUNDEFINED_FEATURE_INDEX; - for(FeaturePtr aNextFeat = myObjs->nextFeature(aCurrent, anIndex); - aNextFeat.get() && aNextFeat->getKind() == "Parameter"; - aNextFeat = myObjs->nextFeature(aCurrent, anIndex)) + for (FeaturePtr aNextFeat = myObjs->nextFeature(aCurrent, anIndex); + aNextFeat.get() && aNextFeat->getKind() == "Parameter"; + aNextFeat = myObjs->nextFeature(aCurrent, anIndex)) aCurrent = aNextFeat; } aDocToAdd->myObjs->addFeature(aFeature, aCurrent); - if (!aFeature->isAction()) { // do not add action to the data model - if (theMakeCurrent) // after all this feature stays in the document, so make it current + if (!aFeature->isAction()) { // do not add action to the data model + if (theMakeCurrent) // after all this feature stays in the document, so + // make it current aDocToAdd->setCurrentFeature(aFeature, false); } else { // feature must be executed - // no creation event => updater not working, problem with remove part + // no creation event => updater not working, problem with remove part aFeature->execute(); } } return aFeature; } -void Model_Document::refsToFeature(FeaturePtr theFeature, - std::set >& theRefs, const bool isSendError) -{ +void Model_Document::refsToFeature( + FeaturePtr theFeature, std::set> &theRefs, + const bool isSendError) { myObjs->refsToFeature(theFeature, theRefs, isSendError); } -void Model_Document::removeFeature(FeaturePtr theFeature) -{ +void Model_Document::removeFeature(FeaturePtr theFeature) { myObjs->removeFeature(theFeature); // fix for #2723: send signal that part is updated if (!isRoot() && isOperation()) { std::shared_ptr aRoot = - std::dynamic_pointer_cast(ModelAPI_Session::get()->moduleDocument()); + std::dynamic_pointer_cast( + ModelAPI_Session::get()->moduleDocument()); std::list allParts; aRoot->objects()->allResults(ModelAPI_ResultPart::group(), allParts); std::list::iterator aParts = allParts.begin(); - for(; aParts != allParts.end(); aParts++) { - ResultPartPtr aPart = std::dynamic_pointer_cast(*aParts); + for (; aParts != allParts.end(); aParts++) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(*aParts); if (aPart->partDoc().get() == this) { - static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - ModelAPI_EventCreator::get()->sendUpdated(aRoot->feature(aPart), anEvent); + static Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + ModelAPI_EventCreator::get()->sendUpdated(aRoot->feature(aPart), + anEvent); break; } } @@ -1275,8 +1377,8 @@ static bool isSub(const CompositeFeaturePtr theMain, const FeaturePtr theSub) { return isSub(theMain, aParent); } -void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit) -{ +void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, + const bool theSplit) { bool aCurrentUp = theMoved == currentFeature(false); if (aCurrentUp) { setCurrentFeatureUp(); @@ -1284,7 +1386,7 @@ void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, c // if user adds after high-level feature with nested, // add it after all nested (otherwise the nested will be disabled) CompositeFeaturePtr aCompositeAfter = - std::dynamic_pointer_cast(theAfterThis); + std::dynamic_pointer_cast(theAfterThis); FeaturePtr anAfterThisSub = theAfterThis; if (aCompositeAfter.get()) { FeaturePtr aSub = aCompositeAfter; @@ -1311,9 +1413,11 @@ void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, c theMoved->customAction("split"); } - if (aCurrentUp) { // make the moved feature enabled or disabled due to the real status + if (aCurrentUp) { // make the moved feature enabled or disabled due to the + // real status setCurrentFeature(currentFeature(false), false); - } else if (theAfterThis == currentFeature(false) || anAfterThisSub == currentFeature(false)) { + } else if (theAfterThis == currentFeature(false) || + anAfterThisSub == currentFeature(false)) { // must be after move to make enabled all features which are before theMoved setCurrentFeature(theMoved, true); } @@ -1321,26 +1425,25 @@ void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, c aMovedList->setMakeCopy(false); } -void Model_Document::updateHistory(const std::shared_ptr theObject) -{ +void Model_Document::updateHistory( + const std::shared_ptr theObject) { if (myObjs) myObjs->updateHistory(theObject); } -void Model_Document::updateHistory(const std::string theGroup) -{ +void Model_Document::updateHistory(const std::string theGroup) { if (myObjs) myObjs->updateHistory(theGroup); } -const std::set Model_Document::subDocuments() const -{ +const std::set Model_Document::subDocuments() const { std::set aResult; std::list aPartResults; myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults); std::list::iterator aPartRes = aPartResults.begin(); - for(; aPartRes != aPartResults.end(); aPartRes++) { - ResultPartPtr aPart = std::dynamic_pointer_cast(*aPartRes); + for (; aPartRes != aPartResults.end(); aPartRes++) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(*aPartRes); if (aPart && aPart->isActivated()) { aResult.insert(aPart->original()->partDoc()->id()); } @@ -1348,49 +1451,45 @@ const std::set Model_Document::subDocuments() const return aResult; } -std::shared_ptr Model_Document::subDoc(int theDocID) -{ +std::shared_ptr Model_Document::subDoc(int theDocID) { // just store sub-document identifier here to manage it later return std::dynamic_pointer_cast( - Model_Application::getApplication()->document(theDocID)); + Model_Application::getApplication()->document(theDocID)); } -ObjectPtr Model_Document::object(const std::string& theGroupID, +ObjectPtr Model_Document::object(const std::string &theGroupID, const int theIndex, - const bool theAllowFolder) -{ + const bool theAllowFolder) { return myObjs->object(theGroupID, theIndex, theAllowFolder); } -std::shared_ptr Model_Document::objectByName( - const std::string& theGroupID, const std::wstring& theName) -{ +std::shared_ptr +Model_Document::objectByName(const std::string &theGroupID, + const std::wstring &theName) { return myObjs->objectByName(theGroupID, theName); } const int Model_Document::index(std::shared_ptr theObject, - const bool theAllowFolder) -{ + const bool theAllowFolder) { return myObjs->index(theObject, theAllowFolder); } -int Model_Document::size(const std::string& theGroupID, const bool theAllowFolder) -{ +int Model_Document::size(const std::string &theGroupID, + const bool theAllowFolder) { if (myObjs == 0) // may be on close return 0; return myObjs->size(theGroupID, theAllowFolder); } -std::shared_ptr Model_Document::parent( - const std::shared_ptr theChild) -{ - if(myObjs == 0) // may be on close +std::shared_ptr +Model_Document::parent(const std::shared_ptr theChild) { + if (myObjs == 0) // may be on close return ObjectPtr(); return myObjs->parent(theChild); } -std::shared_ptr Model_Document::currentFeature(const bool theVisible) -{ +std::shared_ptr +Model_Document::currentFeature(const bool theVisible) { if (!myObjs) // on close document feature destruction it may call this method return std::shared_ptr(); TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE); @@ -1400,33 +1499,34 @@ std::shared_ptr Model_Document::currentFeature(const bool theV FeaturePtr aResult = myObjs->feature(aLab); if (theVisible) { // get nearest visible (in history) going up int anIndex = kUNDEFINED_FEATURE_INDEX; - while(aResult.get() && !aResult->isInHistory()) { + while (aResult.get() && !aResult->isInHistory()) { aResult = myObjs->nextFeature(aResult, anIndex, true); } } return aResult; } - return std::shared_ptr(); // null feature means the higher than first + return std::shared_ptr(); // null feature means the higher + // than first } void Model_Document::setCurrentFeature( - std::shared_ptr theCurrent, const bool theVisible) -{ + std::shared_ptr theCurrent, const bool theVisible) { if (myIsSetCurrentFeature) return; myIsSetCurrentFeature = true; // blocks the flush signals to avoid each objects visualization in the viewer // they should not be shown once after all modifications are performed - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); bool isActive = aLoop->activateFlushes(false); TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE); - CompositeFeaturePtr aMain; // main feature that may nest the new current - std::set anOwners; // composites that contain theCurrent (with any level of nesting) + CompositeFeaturePtr aMain; // main feature that may nest the new current + std::set anOwners; // composites that contain theCurrent (with any + // level of nesting) if (theCurrent.get()) { aMain = std::dynamic_pointer_cast(theCurrent); CompositeFeaturePtr anOwner = ModelAPI_Tools::compositeOwner(theCurrent); - while(anOwner.get()) { + while (anOwner.get()) { if (!aMain.get()) { aMain = anOwner; } @@ -1438,9 +1538,11 @@ void Model_Document::setCurrentFeature( if (theVisible && !theCurrent.get()) { // needed to avoid disabling of PartSet initial constructions int anIndex = kUNDEFINED_FEATURE_INDEX; - FeaturePtr aNext = - theCurrent.get() ? myObjs->nextFeature(theCurrent, anIndex, false) : myObjs->firstFeature(); - for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent, anIndex, false)) { + FeaturePtr aNext = theCurrent.get() + ? myObjs->nextFeature(theCurrent, anIndex, false) + : myObjs->firstFeature(); + for (; aNext.get(); + aNext = myObjs->nextFeature(theCurrent, anIndex, false)) { if (aNext->isInHistory()) { break; // next in history is not needed } else { // next not in history is good for making current @@ -1448,20 +1550,24 @@ void Model_Document::setCurrentFeature( } } } - if (theVisible) { // make RemoveResults feature be active even it is performed after the current + if (theVisible) { // make RemoveResults feature be active even it is performed + // after the current int anIndex = kUNDEFINED_FEATURE_INDEX; - FeaturePtr aNext = - theCurrent.get() ? myObjs->nextFeature(theCurrent, anIndex, false) : myObjs->firstFeature(); - for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent, anIndex, false)) { + FeaturePtr aNext = theCurrent.get() + ? myObjs->nextFeature(theCurrent, anIndex, false) + : myObjs->firstFeature(); + for (; aNext.get(); + aNext = myObjs->nextFeature(theCurrent, anIndex, false)) { if (aNext->isInHistory()) { break; // next in history is not needed - } else if (aNext->getKind() == "RemoveResults"){ + } else if (aNext->getKind() == "RemoveResults") { theCurrent = aNext; } } } if (theCurrent.get()) { - std::shared_ptr aData = std::static_pointer_cast(theCurrent->data()); + std::shared_ptr aData = + std::static_pointer_cast(theCurrent->data()); if (!aData.get() || !aData->isValid()) { aLoop->activateFlushes(isActive); myIsSetCurrentFeature = false; @@ -1482,30 +1588,37 @@ void Model_Document::setCurrentFeature( // (to remove results without dependencies) static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - bool aPassed = false; // flag that the current object is already passed in cycle + bool aPassed = + false; // flag that the current object is already passed in cycle FeaturePtr anIter = myObjs->lastFeature(); bool aWasChanged = false; - bool isCurrentParameter = theCurrent.get() && theCurrent->getKind() == "Parameter"; + bool isCurrentParameter = + theCurrent.get() && theCurrent->getKind() == "Parameter"; int anIndex = kUNDEFINED_FEATURE_INDEX; - for(; anIter.get(); anIter = myObjs->nextFeature(anIter, anIndex, true)) { + for (; anIter.get(); anIter = myObjs->nextFeature(anIter, anIndex, true)) { // check this before passed become enabled: the current feature is enabled! - if (anIter == theCurrent) aPassed = true; + if (anIter == theCurrent) + aPassed = true; bool aDisabledFlag = !aPassed; if (aMain.get()) { - if (isSub(aMain, anIter)) // sub-elements of not-disabled feature are not disabled + if (isSub( + aMain, + anIter)) // sub-elements of not-disabled feature are not disabled aDisabledFlag = false; else if (anOwners.find(anIter) != anOwners.end()) // disable the higher-level feature if the nested is the current - if (aMain->getKind() != "Import") // exception for the import XAO feature with Group (2430) + if (aMain->getKind() != + "Import") // exception for the import XAO feature with Group (2430) aDisabledFlag = true; } if (anIter->getKind() == "Parameter") { - // parameters are always out of the history of features, but not parameters - // due to the issue 1491 all parameters are kept enabled any time - //if (!isCurrentParameter) - aDisabledFlag = false; + // parameters are always out of the history of features, but not + // parameters due to the issue 1491 all parameters are kept enabled any + // time + // if (!isCurrentParameter) + aDisabledFlag = false; } else if (isCurrentParameter) { // if parameter is active, all other features become enabled (issue 1307) aDisabledFlag = false; @@ -1513,27 +1626,33 @@ void Model_Document::setCurrentFeature( if (anIter->setDisabled(aDisabledFlag)) { static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); - // state of feature is changed => so inform that it must be updated if it has such state + // state of feature is changed => so inform that it must be updated if it + // has such state if (!aDisabledFlag && (anIter->data()->execState() == ModelAPI_StateMustBeUpdated || anIter->data()->execState() == ModelAPI_StateInvalidArgument)) ModelAPI_EventCreator::get()->sendUpdated(anIter, anUpdateEvent); // flush is in the end of this method - ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/); + ModelAPI_EventCreator::get()->sendUpdated(anIter, + aRedispEvent /*, false*/); aWasChanged = true; } - // update for everyone concealment flag immediately: on edit feature in the middle of history + // update for everyone concealment flag immediately: on edit feature in the + // middle of history if (aWasChanged) { std::list aResults; ModelAPI_Tools::allResults(anIter, aResults); std::list::const_iterator aRes = aResults.begin(); - for(; aRes != aResults.end(); aRes++) { - if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled()) - std::dynamic_pointer_cast((*aRes)->data())->updateConcealmentFlag(); + for (; aRes != aResults.end(); aRes++) { + if ((*aRes).get() && (*aRes)->data()->isValid() && + !(*aRes)->isDisabled()) + std::dynamic_pointer_cast((*aRes)->data()) + ->updateConcealmentFlag(); } // update the concealment status for display in isConcealed of ResultBody - for(aRes = aResults.begin(); aRes != aResults.end(); aRes++) { - if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled()) + for (aRes = aResults.begin(); aRes != aResults.end(); aRes++) { + if ((*aRes).get() && (*aRes)->data()->isValid() && + !(*aRes)->isDisabled()) (*aRes)->isConcealed(); } } @@ -1546,158 +1665,147 @@ void Model_Document::setCurrentFeature( aLoop->flush(kUpdatedSel); } -void Model_Document::setCurrentFeatureUp() -{ - // on remove just go up for minimum step: highlight external objects in sketch causes - // problems if it is true: here and in "setCurrentFeature" +void Model_Document::setCurrentFeatureUp() { + // on remove just go up for minimum step: highlight external objects in sketch + // causes problems if it is true: here and in "setCurrentFeature" FeaturePtr aCurrent = currentFeature(false); if (aCurrent.get()) { // if not, do nothing because null is the upper int anIndex = kUNDEFINED_FEATURE_INDEX; FeaturePtr aPrev = myObjs->nextFeature(aCurrent, anIndex, true); - // make the higher level composite as current (sketch becomes disabled if line is enabled) + // make the higher level composite as current (sketch becomes disabled if + // line is enabled) if (aPrev.get()) { FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev); // without cycle (issue 1555): otherwise extrusion fuse // will be enabled and displayed when inside sketch if (aComp.get()) - aPrev = aComp; + aPrev = aComp; } - // do not flush: it is called only on remove, it will be flushed in the end of transaction + // do not flush: it is called only on remove, it will be flushed in the end + // of transaction setCurrentFeature(aPrev, false); } } -TDF_Label Model_Document::generalLabel() const -{ +TDF_Label Model_Document::generalLabel() const { return myDoc->Main().FindChild(TAG_GENERAL); } std::shared_ptr Model_Document::createConstruction( - const std::shared_ptr& theFeatureData, const int theIndex) -{ + const std::shared_ptr &theFeatureData, const int theIndex) { return myObjs->createConstruction(theFeatureData, theIndex); } -std::shared_ptr Model_Document::createBody( - const std::shared_ptr& theFeatureData, const int theIndex) -{ +std::shared_ptr +Model_Document::createBody(const std::shared_ptr &theFeatureData, + const int theIndex) { return myObjs->createBody(theFeatureData, theIndex); } -std::shared_ptr Model_Document::createPart( - const std::shared_ptr& theFeatureData, const int theIndex) -{ +std::shared_ptr +Model_Document::createPart(const std::shared_ptr &theFeatureData, + const int theIndex) { return myObjs->createPart(theFeatureData, theIndex); } -std::shared_ptr Model_Document::copyPart( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theFeatureData, const int theIndex) -{ +std::shared_ptr +Model_Document::copyPart(const std::shared_ptr &theOrigin, + const std::shared_ptr &theFeatureData, + const int theIndex) { return myObjs->copyPart(theOrigin, theFeatureData, theIndex); } std::shared_ptr Model_Document::createGroup( - const std::shared_ptr& theFeatureData, const int theIndex) -{ + const std::shared_ptr &theFeatureData, const int theIndex) { return myObjs->createGroup(theFeatureData, theIndex); } std::shared_ptr Model_Document::createField( - const std::shared_ptr& theFeatureData, const int theIndex) -{ + const std::shared_ptr &theFeatureData, const int theIndex) { return myObjs->createField(theFeatureData, theIndex); } std::shared_ptr Model_Document::createParameter( - const std::shared_ptr& theFeatureData, const int theIndex) -{ + const std::shared_ptr &theFeatureData, const int theIndex) { return myObjs->createParameter(theFeatureData, theIndex); } -std::shared_ptr Model_Document::addFolder( - std::shared_ptr theAddBefore) -{ +std::shared_ptr +Model_Document::addFolder(std::shared_ptr theAddBefore) { return myObjs->createFolder(theAddBefore); } -void Model_Document::removeFolder(std::shared_ptr theFolder) -{ +void Model_Document::removeFolder(std::shared_ptr theFolder) { if (theFolder) myObjs->removeFolder(theFolder); } std::shared_ptr Model_Document::findFolderAbove( - const std::list >& theFeatures) -{ + const std::list> &theFeatures) { return myObjs->findFolder(theFeatures, false); } std::shared_ptr Model_Document::findFolderBelow( - const std::list >& theFeatures) -{ + const std::list> &theFeatures) { return myObjs->findFolder(theFeatures, true); } std::shared_ptr Model_Document::findContainingFolder( - const std::shared_ptr& theFeature, - int& theIndexInFolder) -{ + const std::shared_ptr &theFeature, + int &theIndexInFolder) { return myObjs->findContainingFolder(theFeature, theIndexInFolder); } bool Model_Document::moveToFolder( - const std::list >& theFeatures, - const std::shared_ptr& theFolder) -{ + const std::list> &theFeatures, + const std::shared_ptr &theFolder) { return myObjs->moveToFolder(theFeatures, theFolder); } bool Model_Document::removeFromFolder( - const std::list >& theFeatures, - const bool theBefore) -{ + const std::list> &theFeatures, + const bool theBefore) { return myObjs->removeFromFolder(theFeatures, theBefore); } -std::shared_ptr Model_Document::feature( - const std::shared_ptr& theResult) -{ +std::shared_ptr +Model_Document::feature(const std::shared_ptr &theResult) { if (myObjs == 0) // may be on close return std::shared_ptr(); return myObjs->feature(theResult); } -FeaturePtr Model_Document::featureByLab(const TDF_Label& theLab) { +FeaturePtr Model_Document::featureByLab(const TDF_Label &theLab) { TDF_Label aCurrentLab = theLab; - while(aCurrentLab.Depth() > 3) + while (aCurrentLab.Depth() > 3) aCurrentLab = aCurrentLab.Father(); return myObjs->feature(aCurrentLab); } -ResultPtr Model_Document::resultByLab(const TDF_Label& theLab) -{ +ResultPtr Model_Document::resultByLab(const TDF_Label &theLab) { TDF_Label aCurrentLab = theLab; - while(aCurrentLab.Depth() > 3) { + while (aCurrentLab.Depth() > 3) { ObjectPtr aResultObj = myObjs->object(aCurrentLab); if (aResultObj.get()) { - return std::dynamic_pointer_cast(aResultObj); // this may be null if feature + return std::dynamic_pointer_cast( + aResultObj); // this may be null if feature } aCurrentLab = aCurrentLab.Father(); } return ResultPtr(); // not found } -void Model_Document::addNamingName(const TDF_Label theLabel, std::wstring theName) -{ - std::map >::iterator aFind = myNamingNames.find(theName); +void Model_Document::addNamingName(const TDF_Label theLabel, + std::wstring theName) { + std::map>::iterator aFind = + myNamingNames.find(theName); if (aFind != myNamingNames.end()) { // to avoid duplicate-labels // to keep correct order in spite of history line management std::list::iterator anAddAfterThis = aFind->second.end(); FeaturePtr anAddedFeature = featureByLab(theLabel); std::list::iterator aLabIter = aFind->second.begin(); - while(aLabIter != aFind->second.end()) { + while (aLabIter != aFind->second.end()) { if (theLabel.IsEqual(*aLabIter)) { std::list::iterator aTmpIter = aLabIter; aLabIter++; @@ -1714,7 +1822,8 @@ void Model_Document::addNamingName(const TDF_Label theLabel, std::wstring theNam if (anAddAfterThis != aFind->second.end()) { anAddAfterThis++; if (anAddAfterThis != aFind->second.end()) { - myNamingNames[theName].insert(anAddAfterThis, theLabel); // inserts before anAddAfterThis + myNamingNames[theName].insert( + anAddAfterThis, theLabel); // inserts before anAddAfterThis return; } } @@ -1724,26 +1833,30 @@ void Model_Document::addNamingName(const TDF_Label theLabel, std::wstring theNam void Model_Document::changeNamingName(const std::wstring theOldName, const std::wstring theNewName, - const TDF_Label& theLabel) -{ - std::map >::iterator aFind = myNamingNames.find(theOldName); + const TDF_Label &theLabel) { + std::map>::iterator aFind = + myNamingNames.find(theOldName); if (aFind != myNamingNames.end()) { std::list::iterator aLabIter = aFind->second.begin(); - for(; aLabIter != aFind->second.end(); aLabIter++) { + for (; aLabIter != aFind->second.end(); aLabIter++) { if (theLabel.IsEqual(*aLabIter)) { // found the label myNamingNames[theNewName].push_back(theLabel); - if (aFind->second.size() == 1) { // only one element, so, just change the name + if (aFind->second.size() == + 1) { // only one element, so, just change the name myNamingNames.erase(theOldName); } else { // remove from the list aFind->second.erase(aLabIter); } // check the sketch vertex name located under renamed sketch line TDF_ChildIDIterator aChild(theLabel, TDataStd_Name::GetID()); - for(; aChild.More(); aChild.Next()) { - Handle(TDataStd_Name) aSubName = Handle(TDataStd_Name)::DownCast(aChild.Value()); - std::wstring aName = Locale::Convert::toWString(aSubName->Get().ToExtString()); + for (; aChild.More(); aChild.Next()) { + Handle(TDataStd_Name) aSubName = + Handle(TDataStd_Name)::DownCast(aChild.Value()); + std::wstring aName = + Locale::Convert::toWString(aSubName->Get().ToExtString()); if (aName.find(theOldName) == 0) { // started from parent name - std::wstring aNewSubName = theNewName + aName.substr(theOldName.size()); + std::wstring aNewSubName = + theNewName + aName.substr(theOldName.size()); changeNamingName(aName, aNewSubName, aSubName->Label()); aSubName->Set(aNewSubName.c_str()); } @@ -1754,11 +1867,11 @@ void Model_Document::changeNamingName(const std::wstring theOldName, } } -// returns true if names consist of the same sub-elements but with different order. -// Sub-elements are separated by "-" symbol. First part must be "Face", second at the same place. -static bool IsExchangedName(const TCollection_ExtendedString& theName1, - const TCollection_ExtendedString& theName2) -{ +// returns true if names consist of the same sub-elements but with different +// order. Sub-elements are separated by "-" symbol. First part must be "Face", +// second at the same place. +static bool IsExchangedName(const TCollection_ExtendedString &theName1, + const TCollection_ExtendedString &theName2) { static const TCollection_ExtendedString aSepStr("-"); static const Standard_ExtString aSep = aSepStr.ToExtString(); static const TCollection_ExtendedString aWireTail("_wire"); @@ -1770,7 +1883,7 @@ static bool IsExchangedName(const TCollection_ExtendedString& theName1, NCollection_Map aSubsMap; TCollection_ExtendedString aWireSuffix; int a = 3; - for (; true ; a++) { + for (; true; a++) { TCollection_ExtendedString aToken = theName1.Token(aSep, a); if (aToken.IsEmpty()) break; @@ -1800,19 +1913,20 @@ static bool IsExchangedName(const TCollection_ExtendedString& theName1, return true; } -TDF_Label Model_Document::findNamingName(std::wstring theName, ResultPtr theContext) -{ - std::map >::iterator aFind = myNamingNames.find(theName); +TDF_Label Model_Document::findNamingName(std::wstring theName, + ResultPtr theContext) { + std::map>::iterator aFind = + myNamingNames.find(theName); if (aFind != myNamingNames.end()) { - std::list::reverse_iterator aLabIter = aFind->second.rbegin(); - for(; aLabIter != aFind->second.rend(); aLabIter++) { - if (theContext.get()) { - // context is defined and not like this, so, skip - if (theContext == myObjs->object(aLabIter->Father())) - return *aLabIter; - } + std::list::reverse_iterator aLabIter = aFind->second.rbegin(); + for (; aLabIter != aFind->second.rend(); aLabIter++) { + if (theContext.get()) { + // context is defined and not like this, so, skip + if (theContext == myObjs->object(aLabIter->Father())) + return *aLabIter; } - return *(aFind->second.rbegin()); // no more variants, so, return the last + } + return *(aFind->second.rbegin()); // no more variants, so, return the last } // not found exact name, try to find by sub-components std::wstring::size_type aSlash = theName.rfind(L'/'); @@ -1821,38 +1935,46 @@ TDF_Label Model_Document::findNamingName(std::wstring theName, ResultPtr theCont aFind = myNamingNames.find(anObjName); if (aFind != myNamingNames.end()) { TCollection_ExtendedString aSubName(theName.substr(aSlash + 1).c_str()); - // iterate all possible same-named labels starting from the last one (the recent) + // iterate all possible same-named labels starting from the last one (the + // recent) std::list::reverse_iterator aLabIter = aFind->second.rbegin(); - for(; aLabIter != aFind->second.rend(); aLabIter++) { + for (; aLabIter != aFind->second.rend(); aLabIter++) { if (theContext.get()) { // context is defined and not like this, so, skip if (theContext != myObjs->object(aLabIter->Father())) continue; } - // copy aSubName to avoid incorrect further processing after its suffix cutting + // copy aSubName to avoid incorrect further processing after its suffix + // cutting TCollection_ExtendedString aSubNameCopy(aSubName); - TDF_Label aFaceLabelWithExchangedSubs; // check also exchanged sub-elements of the name + TDF_Label aFaceLabelWithExchangedSubs; // check also exchanged + // sub-elements of the name // searching sub-labels with this name - TDF_ChildIDIterator aNamesIter(*aLabIter, TDataStd_Name::GetID(), Standard_True); - for(; aNamesIter.More(); aNamesIter.Next()) { - Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(aNamesIter.Value()); + TDF_ChildIDIterator aNamesIter(*aLabIter, TDataStd_Name::GetID(), + Standard_True); + for (; aNamesIter.More(); aNamesIter.Next()) { + Handle(TDataStd_Name) aName = + Handle(TDataStd_Name)::DownCast(aNamesIter.Value()); if (aName->Get() == aSubNameCopy) return aName->Label(); if (aName->Get().Length() == aSubNameCopy.Length() && - IsExchangedName(aName->Get(), aSubNameCopy)) + IsExchangedName(aName->Get(), aSubNameCopy)) aFaceLabelWithExchangedSubs = aName->Label(); } if (!aFaceLabelWithExchangedSubs.IsNull()) return aFaceLabelWithExchangedSubs; - // If not found child label with the exact sub-name, then try to find compound with - // such sub-name without suffix. + // If not found child label with the exact sub-name, then try to find + // compound with such sub-name without suffix. Standard_Integer aSuffixPos = aSubNameCopy.SearchFromEnd('_'); if (aSuffixPos != -1 && aSuffixPos != aSubNameCopy.Length()) { - TCollection_ExtendedString anIndexStr = aSubNameCopy.Split(aSuffixPos); + TCollection_ExtendedString anIndexStr = + aSubNameCopy.Split(aSuffixPos); aSubNameCopy.Remove(aSuffixPos); - aNamesIter.Initialize(*aLabIter, TDataStd_Name::GetID(), Standard_True); - for(; aNamesIter.More(); aNamesIter.Next()) { - Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(aNamesIter.Value()); + aNamesIter.Initialize(*aLabIter, TDataStd_Name::GetID(), + Standard_True); + for (; aNamesIter.More(); aNamesIter.Next()) { + Handle(TDataStd_Name) aName = + Handle(TDataStd_Name)::DownCast(aNamesIter.Value()); if (aName->Get() == aSubNameCopy) { return aName->Label(); } @@ -1866,7 +1988,8 @@ TDF_Label Model_Document::findNamingName(std::wstring theName, ResultPtr theCont } } } - // verify context's name is same as sub-component's and use context's label + // verify context's name is same as sub-component's and use context's + // label if (aSubName.IsEqual(anObjName.c_str())) return *(aFind->second.rbegin()); } @@ -1875,27 +1998,34 @@ TDF_Label Model_Document::findNamingName(std::wstring theName, ResultPtr theCont } bool Model_Document::isLaterByDep(FeaturePtr theThis, FeaturePtr theOther) { - // check dependencies first: if theOther depends on theThis, theThis is not later - std::list > > > aRefs; + // check dependencies first: if theOther depends on theThis, theThis is not + // later + std::list>>> + aRefs; theOther->data()->referencesToObjects(aRefs); - std::list > > >::iterator - aRefIt = aRefs.begin(); - for(; aRefIt != aRefs.end(); aRefIt++) { + std::list>>>::iterator + aRefIt = aRefs.begin(); + for (; aRefIt != aRefs.end(); aRefIt++) { std::list::iterator aRefObjIt = aRefIt->second.begin(); - for(; aRefObjIt != aRefIt->second.end(); aRefObjIt++) { + for (; aRefObjIt != aRefIt->second.end(); aRefObjIt++) { ObjectPtr aRefObj = *aRefObjIt; if (aRefObj.get()) { - FeaturePtr aRefFeat = std::dynamic_pointer_cast(aRefObj); + FeaturePtr aRefFeat = + std::dynamic_pointer_cast(aRefObj); if (!aRefFeat.get()) { // take feature of the result - aRefFeat = feature(std::dynamic_pointer_cast(aRefObj)); + aRefFeat = + feature(std::dynamic_pointer_cast(aRefObj)); } if (aRefFeat.get()) { if (aRefFeat == theThis) return false; // other references to this, so other later than this - //if (std::dynamic_pointer_cast(aRefFeat)) { - // if (!isLaterByDep(theThis, aRefFeat)) // nested composites: recursion - // return false; - //} + // if (std::dynamic_pointer_cast(aRefFeat)) + // { + // if (!isLaterByDep(theThis, aRefFeat)) // nested composites: + // recursion + // return false; + // } } } } @@ -1910,11 +2040,10 @@ bool Model_Document::isLaterByDep(FeaturePtr theThis, FeaturePtr theOther) { return myObjs->isLater(theThis, theOther); } -int Model_Document::numberOfNameInHistory( - const ObjectPtr& theNameObject, const TDF_Label& theStartFrom) -{ - std::map >::iterator aFind = - myNamingNames.find(theNameObject->data()->name()); +int Model_Document::numberOfNameInHistory(const ObjectPtr &theNameObject, + const TDF_Label &theStartFrom) { + std::map>::iterator aFind = + myNamingNames.find(theNameObject->data()->name()); if (aFind == myNamingNames.end() || aFind->second.size() < 2) { return 1; // no need to specify the name by additional identifiers } @@ -1924,22 +2053,25 @@ int Model_Document::numberOfNameInHistory( return 1; // feature that contain result with this name FeaturePtr aNameFeature; - ResultPtr aNameResult = std::dynamic_pointer_cast(theNameObject); + ResultPtr aNameResult = + std::dynamic_pointer_cast(theNameObject); if (aNameResult) aNameFeature = myObjs->feature(aNameResult); else aNameFeature = std::dynamic_pointer_cast(theNameObject); - // iterate all labels with this name to find the nearest just before or equal relative + // iterate all labels with this name to find the nearest just before or equal + // relative std::list::reverse_iterator aLabIter = aFind->second.rbegin(); - for(; aLabIter != aFind->second.rend(); aLabIter++) { + for (; aLabIter != aFind->second.rend(); aLabIter++) { FeaturePtr aLabFeat = featureByLab(*aLabIter); if (!aLabFeat.get()) continue; - if (isLaterByDep(aStart, aLabFeat)) // skip also start: its result don't used + if (isLaterByDep(aStart, + aLabFeat)) // skip also start: its result don't used break; } int aResIndex = 1; - for(; aLabIter != aFind->second.rend(); aLabIter++) { + for (; aLabIter != aFind->second.rend(); aLabIter++) { FeaturePtr aLabFeat = featureByLab(*aLabIter); if (!aLabFeat.get()) continue; @@ -1950,29 +2082,35 @@ int Model_Document::numberOfNameInHistory( return aResIndex; // strange } -ResultPtr Model_Document::findByName( - std::wstring& theName, std::wstring& theSubShapeName, bool& theUniqueContext) -{ +ResultPtr Model_Document::findByName(std::wstring &theName, + std::wstring &theSubShapeName, + bool &theUniqueContext) { int aNumInHistory = 0; std::wstring aName = theName; ResultPtr aRes = myObjs->findByName(aName); - theUniqueContext = !(aRes.get() && myNamingNames.find(aName) != myNamingNames.end()); - while(!aRes.get() && aName[0] == '_') { // this may be theContext with the history index + theUniqueContext = + !(aRes.get() && myNamingNames.find(aName) != myNamingNames.end()); + while (!aRes.get() && + aName[0] == '_') { // this may be theContext with the history index aNumInHistory++; aName = aName.substr(1); aRes = myObjs->findByName(aName); } if (aNumInHistory) { - std::map >::iterator aFind = myNamingNames.find(aName); - if (aFind != myNamingNames.end() && (int)aFind->second.size() > aNumInHistory) { + std::map>::iterator aFind = + myNamingNames.find(aName); + if (aFind != myNamingNames.end() && + (int)aFind->second.size() > aNumInHistory) { std::list::reverse_iterator aLibIt = aFind->second.rbegin(); - for(; aNumInHistory != 0; aNumInHistory--) + for (; aNumInHistory != 0; aNumInHistory--) aLibIt++; - const TDF_Label& aResultLab = *aLibIt; - aRes = std::dynamic_pointer_cast(myObjs->object(aResultLab.Father())); + const TDF_Label &aResultLab = *aLibIt; + aRes = std::dynamic_pointer_cast( + myObjs->object(aResultLab.Father())); if (aRes) { // modify the incoming names if (!theSubShapeName.empty()) - theSubShapeName = theSubShapeName.substr(theName.size() - aName.size()); + theSubShapeName = + theSubShapeName.substr(theName.size() - aName.size()); theName = aName; } } @@ -1980,32 +2118,30 @@ ResultPtr Model_Document::findByName( return aRes; } -std::list > Model_Document::allFeatures() -{ +std::list> Model_Document::allFeatures() { return myObjs->allFeatures(); } -std::list > Model_Document::allObjects() -{ +std::list> Model_Document::allObjects() { return myObjs->allObjects(); } -void Model_Document::setActive(const bool theFlag) -{ +void Model_Document::setActive(const bool theFlag) { if (theFlag != myIsActive) { myIsActive = theFlag; // redisplay all the objects of this part - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_Loop *aLoop = Events_Loop::loop(); + static Events_ID aRedispEvent = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - for(int a = size(ModelAPI_Feature::group()) - 1; a >= 0; a--) { + for (int a = size(ModelAPI_Feature::group()) - 1; a >= 0; a--) { FeaturePtr aFeature = std::dynamic_pointer_cast( - object(ModelAPI_Feature::group(), a)); + object(ModelAPI_Feature::group(), a)); if (aFeature.get() && aFeature->data()->isValid()) { std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); for (std::list::iterator aRes = aResults.begin(); - aRes != aResults.end(); aRes++) { + aRes != aResults.end(); aRes++) { ModelAPI_EventCreator::get()->sendUpdated(*aRes, aRedispEvent); } } @@ -2013,90 +2149,85 @@ void Model_Document::setActive(const bool theFlag) } } -bool Model_Document::isActive() const -{ - return myIsActive; -} +bool Model_Document::isActive() const { return myIsActive; } -int Model_Document::transactionID() -{ +int Model_Document::transactionID() { Handle(TDataStd_Integer) anIndex; - if (!generalLabel().FindChild(TAG_CURRENT_TRANSACTION). - FindAttribute(TDataStd_Integer::GetID(), anIndex)) { - anIndex = TDataStd_Integer::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), 1); + if (!generalLabel() + .FindChild(TAG_CURRENT_TRANSACTION) + .FindAttribute(TDataStd_Integer::GetID(), anIndex)) { + anIndex = TDataStd_Integer::Set( + generalLabel().FindChild(TAG_CURRENT_TRANSACTION), 1); } return anIndex->Get(); } -void Model_Document::incrementTransactionID() -{ +void Model_Document::incrementTransactionID() { int aNewVal = transactionID() + 1; - TDataStd_Integer::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), aNewVal); + TDataStd_Integer::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), + aNewVal); } -TDF_Label Model_Document::extConstructionsLabel() const -{ +TDF_Label Model_Document::extConstructionsLabel() const { return myDoc->Main().FindChild(TAG_EXTERNAL_CONSTRUCTIONS); } -bool Model_Document::isOpened() -{ - return myObjs && !myDoc.IsNull(); -} +bool Model_Document::isOpened() { return myObjs && !myDoc.IsNull(); } -int Model_Document::numInternalFeatures() -{ +int Model_Document::numInternalFeatures() { return myObjs->numInternalFeatures(); } -std::shared_ptr Model_Document::internalFeature(const int theIndex) -{ +std::shared_ptr +Model_Document::internalFeature(const int theIndex) { return myObjs->internalFeature(theIndex); } -void Model_Document::synchronizeTransactions() -{ - Model_Document* aRoot = - std::dynamic_pointer_cast(ModelAPI_Session::get()->moduleDocument()).get(); +void Model_Document::synchronizeTransactions() { + Model_Document *aRoot = std::dynamic_pointer_cast( + ModelAPI_Session::get()->moduleDocument()) + .get(); if (aRoot == this) return; // don't need to synchronize root with root std::shared_ptr aSession = - std::dynamic_pointer_cast(Model_Session::get()); - while(myRedos.size() > aRoot->myRedos.size()) { // remove redo in this + std::dynamic_pointer_cast(Model_Session::get()); + while (myRedos.size() > aRoot->myRedos.size()) { // remove redo in this aSession->setCheckTransactions(false); redo(); aSession->setCheckTransactions(true); } - /* this case can not be reproduced in any known case for the current moment, so, just comment - while(myRedos.size() < aRoot->myRedos.size()) { // add more redo in this - undoInternal(false, true); + /* this case can not be reproduced in any known case for the current moment, + so, just comment while(myRedos.size() < aRoot->myRedos.size()) { // add more + redo in this undoInternal(false, true); }*/ } -/// Feature that is used for selection in the Part document by the external request +/// Feature that is used for selection in the Part document by the external +/// request class Model_SelectionInPartFeature : public ModelAPI_Feature { public: /// Nothing to do in constructor Model_SelectionInPartFeature() : ModelAPI_Feature() {} /// Returns the unique kind of a feature - virtual const std::string& getKind() { + virtual const std::string &getKind() { static std::string MY_KIND("InternalSelectionInPartFeature"); return MY_KIND; } - /// Request for initialization of data model of the object: adding all attributes + /// Request for initialization of data model of the object: adding all + /// attributes virtual void initAttributes() { - data()->addAttribute("selection", ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute("selection", + ModelAPI_AttributeSelectionList::typeId()); } /// Nothing to do in the execution function virtual void execute() {} - }; -//! Returns the feature that is used for calculation of selection externally from the document -AttributeSelectionListPtr Model_Document::selectionInPartFeature() -{ +//! Returns the feature that is used for calculation of selection externally +//! from the document +AttributeSelectionListPtr Model_Document::selectionInPartFeature() { // return already created, otherwise create if (!mySelectionFeature.get() || !mySelectionFeature->data()->isValid()) { // create a new one @@ -2113,40 +2244,46 @@ AttributeSelectionListPtr Model_Document::selectionInPartFeature() mySelectionFeature->setDoc(myObjs->owner()); mySelectionFeature->initAttributes(); mySelectionFeature->init(); // to make it enabled and Update correctly - // this update may cause recomputation of the part after selection on it, that is not needed + // this update may cause recomputation of the part after selection on it, + // that is not needed mySelectionFeature->data()->blockSendAttributeUpdated(true); } return mySelectionFeature->selectionList("selection"); } -FeaturePtr Model_Document::lastFeature() -{ +FeaturePtr Model_Document::lastFeature() { if (myObjs) return myObjs->lastFeature(); return FeaturePtr(); } -static Handle(TNaming_NamedShape) searchForOriginalShape(TopoDS_Shape theShape, TDF_Label aMain) { +static Handle(TNaming_NamedShape) + searchForOriginalShape(TopoDS_Shape theShape, TDF_Label aMain) { Handle(TNaming_NamedShape) aResult; - while(!theShape.IsNull()) { // searching for the very initial shape that produces this one + while (!theShape.IsNull()) { // searching for the very initial shape that + // produces this one TopoDS_Shape aShape = theShape; theShape.Nullify(); // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists if (!TNaming_Tool::HasLabel(aMain, aShape)) break; - for(TNaming_SameShapeIterator anIter(aShape, aMain); anIter.More(); anIter.Next()) { + for (TNaming_SameShapeIterator anIter(aShape, aMain); anIter.More(); + anIter.Next()) { TDF_Label aNSLab = anIter.Label(); Handle(TNaming_NamedShape) aNS; if (aNSLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) { + for (TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); + aShapesIter.Next()) { if (aShapesIter.Evolution() == TNaming_SELECTED || aShapesIter.Evolution() == TNaming_DELETE) continue; // don't use the selection evolution - if (aShapesIter.NewShape().IsSame(aShape)) { // found the original shape + if (aShapesIter.NewShape().IsSame( + aShape)) { // found the original shape aResult = aNS; if (aResult->Evolution() == TNaming_MODIFY) theShape = aShapesIter.OldShape(); - // otherwise may me searching for another item of this shape with longer history + // otherwise may me searching for another item of this shape with + // longer history if (!theShape.IsNull()) break; } @@ -2159,25 +2296,27 @@ static Handle(TNaming_NamedShape) searchForOriginalShape(TopoDS_Shape theShape, std::shared_ptr Model_Document::producedByFeature( std::shared_ptr theResult, - const std::shared_ptr& theShape) -{ - ResultBodyPtr aBody = std::dynamic_pointer_cast(theResult); + const std::shared_ptr &theShape) { + ResultBodyPtr aBody = + std::dynamic_pointer_cast(theResult); if (!aBody.get()) { - return feature(theResult); // for not-body just returns the feature that produced this result + return feature(theResult); // for not-body just returns the feature that + // produced this result } // otherwise get the shape and search the very initial label for it TopoDS_Shape aShape = theShape->impl(); if (aShape.IsNull()) return FeaturePtr(); - // for compsolids and compounds all the naming is located in the main object, so, try to use - // it first + // for compsolids and compounds all the naming is located in the main object, + // so, try to use it first ResultBodyPtr aMain = ModelAPI_Tools::bodyOwner(theResult); while (aMain.get()) { // get the top-most main ResultBodyPtr aNextMain = ModelAPI_Tools::bodyOwner(aMain); if (aNextMain.get()) aMain = aNextMain; - else break; + else + break; } if (aMain.get()) { FeaturePtr aMainRes = producedByFeature(aMain, theShape); @@ -2185,18 +2324,22 @@ std::shared_ptr Model_Document::producedByFeature( return aMainRes; } - std::shared_ptr aBodyData = std::dynamic_pointer_cast(theResult->data()); + std::shared_ptr aBodyData = + std::dynamic_pointer_cast(theResult->data()); if (!aBodyData.get() || !aBodyData->isValid()) return FeaturePtr(); - TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the named shape - TopoDS_Shape aShapeContainer; // old shape of the shape that contains aShape as sub-element + TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the + // named shape + TopoDS_Shape aShapeContainer; // old shape of the shape that contains aShape + // as sub-element Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer; TDF_Label aBodyLab = aBodyData->shapeLab(); // use child and this label (the lowest priority) - TDF_ChildIDIterator aNSIter(aBodyLab, TNaming_NamedShape::GetID(), Standard_True); + TDF_ChildIDIterator aNSIter(aBodyLab, TNaming_NamedShape::GetID(), + Standard_True); bool aUseThis = !aNSIter.More(); - while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) { + while (anOldShape.IsNull() && (aNSIter.More() || aUseThis)) { Handle(TNaming_NamedShape) aNS; if (aUseThis) { if (!aBodyLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) @@ -2204,21 +2347,25 @@ std::shared_ptr Model_Document::producedByFeature( } else { aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value()); } - for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) { - if (aShapesIter.Evolution() == TNaming_SELECTED || aShapesIter.Evolution() == TNaming_DELETE) + for (TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); + aShapesIter.Next()) { + if (aShapesIter.Evolution() == TNaming_SELECTED || + aShapesIter.Evolution() == TNaming_DELETE) continue; // don't use the selection evolution if (aShapesIter.NewShape().IsSame(aShape)) { // found the original shape aCandidatInThis = aNS; if (aCandidatInThis->Evolution() == TNaming_MODIFY) anOldShape = aShapesIter.OldShape(); - // otherwise may me searching for another item of this shape with longer history + // otherwise may me searching for another item of this shape with longer + // history if (!anOldShape.IsNull()) break; } // check that the shape contains aShape as sub-shape to fill container - if (aShapesIter.NewShape().ShapeType() < aShape.ShapeType() && aCandidatContainer.IsNull()) { + if (aShapesIter.NewShape().ShapeType() < aShape.ShapeType() && + aCandidatContainer.IsNull()) { TopExp_Explorer anExp(aShapesIter.NewShape(), aShape.ShapeType()); - for(; anExp.More(); anExp.Next()) { + for (; anExp.More(); anExp.Next()) { if (aShape.IsSame(anExp.Current())) { aCandidatContainer = aNS; aShapeContainer = aShapesIter.NewShape(); @@ -2251,13 +2398,14 @@ std::shared_ptr Model_Document::producedByFeature( } } - Handle(TNaming_NamedShape) aNS = searchForOriginalShape(anOldShape, myDoc->Main()); + Handle(TNaming_NamedShape) aNS = + searchForOriginalShape(anOldShape, myDoc->Main()); if (!aNS.IsNull()) aCandidatInThis = aNS; FeaturePtr aResult; TDF_Label aResultLab = aCandidatInThis->Label(); - while(aResultLab.Depth() > 3) + while (aResultLab.Depth() > 3) aResultLab = aResultLab.Father(); FeaturePtr aFeature = myObjs->feature(aResultLab); if (aFeature.get()) { @@ -2268,49 +2416,45 @@ std::shared_ptr Model_Document::producedByFeature( return aResult; } -bool Model_Document::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const -{ +bool Model_Document::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const { return myObjs->isLater(theLater, theCurrent); } // Object Browser nodes states // LCOV_EXCL_START -void Model_Document::storeNodesState(const std::list& theStates) -{ +void Model_Document::storeNodesState(const std::list &theStates) { TDF_Label aLab = generalLabel().FindChild(TAG_NODES_STATE); aLab.ForgetAllAttributes(); if (!theStates.empty()) { Handle(TDataStd_BooleanArray) anArray = - TDataStd_BooleanArray::Set(aLab, 0, int(theStates.size()) - 1); + TDataStd_BooleanArray::Set(aLab, 0, int(theStates.size()) - 1); std::list::const_iterator aState = theStates.begin(); - for(int anIndex = 0; aState != theStates.end(); aState++, anIndex++) { + for (int anIndex = 0; aState != theStates.end(); aState++, anIndex++) { anArray->SetValue(anIndex, *aState); } } } -void Model_Document::restoreNodesState(std::list& theStates) const -{ +void Model_Document::restoreNodesState(std::list &theStates) const { TDF_Label aLab = generalLabel().FindChild(TAG_NODES_STATE); Handle(TDataStd_BooleanArray) anArray; if (aLab.FindAttribute(TDataStd_BooleanArray::GetID(), anArray)) { int anUpper = anArray->Upper(); - for(int anIndex = 0; anIndex <= anUpper; anIndex++) { + for (int anIndex = 0; anIndex <= anUpper; anIndex++) { theStates.push_back(anArray->Value(anIndex) == Standard_True); } } } // LCOV_EXCL_STOP -void Model_Document::eraseAllFeatures() -{ +void Model_Document::eraseAllFeatures() { if (myObjs) myObjs->eraseAllFeatures(); } -std::shared_ptr Model_Document::nextFeature( - std::shared_ptr theCurrent, const bool theReverse) const -{ +std::shared_ptr +Model_Document::nextFeature(std::shared_ptr theCurrent, + const bool theReverse) const { if (theCurrent.get() && myObjs) { int anIndex = kUNDEFINED_FEATURE_INDEX; return myObjs->nextFeature(theCurrent, anIndex, theReverse); @@ -2318,8 +2462,7 @@ std::shared_ptr Model_Document::nextFeature( return FeaturePtr(); // nothing by default } -void Model_Document::setExecuteFeatures(const bool theFlag) -{ +void Model_Document::setExecuteFeatures(const bool theFlag) { myExecuteFeatures = theFlag; const std::set aSubs = subDocuments(); std::set::iterator aSubIter = aSubs.begin(); @@ -2330,9 +2473,8 @@ void Model_Document::setExecuteFeatures(const bool theFlag) } } -void Model_Document::appendTransactionToPrevious() -{ - Transaction anAppended = myTransactions.back(); +void Model_Document::appendTransactionToPrevious() { + Transaction anAppended = myTransactions.back(); myTransactions.pop_back(); if (!myNestedNum.empty()) (*myNestedNum.rbegin())--; @@ -2341,24 +2483,28 @@ void Model_Document::appendTransactionToPrevious() } // propagate the same action to sub-documents const std::set aSubs = subDocuments(); - for (std::set::iterator aSubIter = aSubs.begin(); aSubIter != aSubs.end(); aSubIter++) { + for (std::set::iterator aSubIter = aSubs.begin(); + aSubIter != aSubs.end(); aSubIter++) { subDoc(*aSubIter)->appendTransactionToPrevious(); } } /// GUID for keeping information about the auto-recomputation state -static const Standard_GUID kAutoRecomputationID("8493fb74-0674-4912-a100-1cf46c7cfab3"); +static const Standard_GUID + kAutoRecomputationID("8493fb74-0674-4912-a100-1cf46c7cfab3"); -void Model_Document::setAutoRecomutationState(const bool theState) -{ +void Model_Document::setAutoRecomutationState(const bool theState) { if (theState) - generalLabel().FindChild(TAG_CURRENT_TRANSACTION).ForgetAttribute(kAutoRecomputationID); + generalLabel() + .FindChild(TAG_CURRENT_TRANSACTION) + .ForgetAttribute(kAutoRecomputationID); else - TDataStd_UAttribute::Set( - generalLabel().FindChild(TAG_CURRENT_TRANSACTION), kAutoRecomputationID); + TDataStd_UAttribute::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), + kAutoRecomputationID); } -bool Model_Document::autoRecomutationState() const -{ - return !generalLabel().FindChild(TAG_CURRENT_TRANSACTION).IsAttribute(kAutoRecomputationID); +bool Model_Document::autoRecomutationState() const { + return !generalLabel() + .FindChild(TAG_CURRENT_TRANSACTION) + .IsAttribute(kAutoRecomputationID); } diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 1dec08f14..f4aa78ed7 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Document_H_ @@ -40,46 +41,51 @@ class ModelAPI_AttributeSelectionList; * Document contains all data that must be stored/retrieved in the file. * Also it provides access to this data: open/save, transactions management etc. */ -class Model_Document : public ModelAPI_Document -{ - public: +class Model_Document : public ModelAPI_Document { +public: //! Returns the kind of the document: "PartSet", "Part", or something else. - //! This kind is used for feature buttons enable/disable depending on active document - //! (it uses workbench "document" identifier in XML configuration file for this) - MODEL_EXPORT virtual const std::string& kind() const {return myKind;} + //! This kind is used for feature buttons enable/disable depending on active + //! document (it uses workbench "document" identifier in XML configuration + //! file for this) + MODEL_EXPORT virtual const std::string &kind() const { return myKind; } //! Loads the OCAF document from the file. //! \param theDirName directory of the loaded file //! \param theFileName a name of the file to load - //! \param theThis the common shared pointer to the document to manage with it later - //! \returns true if file was loaded successfully - MODEL_EXPORT virtual bool load( - const char* theDirName, const char* theFileName, DocumentPtr theThis); + //! \param theThis the common shared pointer to the document to manage with it + //! later \returns true if file was loaded successfully + MODEL_EXPORT virtual bool load(const char *theDirName, + const char *theFileName, DocumentPtr theThis); //! Loads the OCAF document from the file into the current document. //! All the features are added after the active feature. //! \param theFileName name of the file to import //! \param theImported list of features imported from the file - //! \param theCheckOnly verify the document does not contain unappropriate features + //! \param theCheckOnly verify the document does not contain unappropriate + //! features //! (useful for import to PartSet), but do not import it //! \returns true if file was loaded successfully - MODEL_EXPORT virtual bool importPart(const char* theFileName, - std::list >& theImported, - bool theCheckOnly = false); + MODEL_EXPORT virtual bool + importPart(const char *theFileName, + std::list> &theImported, + bool theCheckOnly = false); //! Saves the OCAF document to the file. //! \param theDirName directory where the document will be saved //! \param theFileName a name of the document file to store //! \param theResults the result full file names that were stored by "save" //! \returns true if file was stored successfully - MODEL_EXPORT virtual bool save( - const char* theDirName, const char* theFileName, std::list& theResults); + MODEL_EXPORT virtual bool save(const char *theDirName, + const char *theFileName, + std::list &theResults); //! Export the list of features to the file //! \param theFilename path to save the file //! \param theExportFeatures list of features to export - MODEL_EXPORT virtual bool save(const char* theFilename, - const std::list >& theExportFeatures) const; + MODEL_EXPORT virtual bool + save(const char *theFilename, + const std::list> &theExportFeatures) + const; //! Removes document data //! \param theForever if it is false, document is just hidden @@ -89,11 +95,13 @@ class Model_Document : public ModelAPI_Document //! Starts a new operation (opens a transaction) MODEL_EXPORT virtual void startOperation(); //! Finishes the previously started operation (closes the transaction) - //! \returns true if transaction in this document is not empty and really was performed + //! \returns true if transaction in this document is not empty and really was + //! performed MODEL_EXPORT virtual bool finishOperation(); //! Aborts the operation MODEL_EXPORT virtual void abortOperation(); - //! Returns true if operation has been started, but not yet finished or aborted + //! Returns true if operation has been started, but not yet finished or + //! aborted MODEL_EXPORT virtual bool isOperation() const; //! Returns true if document was modified (since creation/opening) MODEL_EXPORT virtual bool isModified(); @@ -112,79 +120,84 @@ class Model_Document : public ModelAPI_Document //! Adds to the document the new feature of the given feature id //! \param theID creates feature and puts it in the document //! \param theMakeCurrent to make current this new feature in this document - MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID, const bool theMakeCurrent = true); + MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID, + const bool theMakeCurrent = true); //! Return a list of features, which refers to the feature //! \param theFeature a feature //! \param theRefs a list of reference features //! \param isSendError a flag whether the error message should be send MODEL_EXPORT virtual void refsToFeature(FeaturePtr theFeature, - std::set& theRefs, + std::set &theRefs, const bool isSendError = true); //! Removes the feature from the document (with result) - //! It is necessary to flush REDISPLAY signal manually after this method because - //! the method sends it, but for the performance purpose does not flush it - //! \param theFeature a removed feature + //! It is necessary to flush REDISPLAY signal manually after this method + //! because the method sends it, but for the performance purpose does not + //! flush it \param theFeature a removed feature MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature); //! Moves the feature to make it after the given one in the history. - MODEL_EXPORT virtual void moveFeature( - FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit = false); + MODEL_EXPORT virtual void moveFeature(FeaturePtr theMoved, + FeaturePtr theAfterThis, + const bool theSplit = false); //! Returns the first found object in the group by the object name //! \param theGroupID group that contains an object //! \param theName name of the object to search //! \returns null if such object is not found - MODEL_EXPORT virtual std::shared_ptr objectByName( - const std::string& theGroupID, const std::wstring& theName); + MODEL_EXPORT virtual std::shared_ptr + objectByName(const std::string &theGroupID, const std::wstring &theName); - //! Returns the object index in the group. Object must be visible. Otherwise returns -1. - //! \param theObject object of this document - //! \param theAllowFolder take into account grouping feature by folders - //! \returns index started from zero, or -1 if object is invisible or belongs to another document - MODEL_EXPORT virtual const int index(std::shared_ptr theObject, - const bool theAllowFolder = false); + //! Returns the object index in the group. Object must be visible. Otherwise + //! returns -1. \param theObject object of this document \param theAllowFolder + //! take into account grouping feature by folders \returns index started from + //! zero, or -1 if object is invisible or belongs to another document + MODEL_EXPORT virtual const int + index(std::shared_ptr theObject, + const bool theAllowFolder = false); //! Internal sub-document by ID MODEL_EXPORT virtual std::shared_ptr subDoc(int theDocID); ///! Returns the id of the document - MODEL_EXPORT virtual const int id() const - { - return myID; - } + MODEL_EXPORT virtual const int id() const { return myID; } //! Returns the feature in the group by the index (started from zero) //! \param theGroupID group that contains a feature //! \param theIndex zero-based index of feature in the group //! \param theAllowFolder take into account grouping feature by folders - MODEL_EXPORT virtual ObjectPtr object(const std::string& theGroupID, + MODEL_EXPORT virtual ObjectPtr object(const std::string &theGroupID, const int theIndex, const bool theAllowFolder = false); //! Returns the number of features in the group //! \param theGroupID group of objects //! \param theAllowFolder take into account grouping feature by folders - MODEL_EXPORT virtual int size(const std::string& theGroupID, const bool theAllowFolder = false); + MODEL_EXPORT virtual int size(const std::string &theGroupID, + const bool theAllowFolder = false); - //! Returns the parent object of this child. This may be result or feature, parent of a - //! top result. Fast method, that uses internal data structure specifics. - MODEL_EXPORT virtual std::shared_ptr parent( - const std::shared_ptr theChild); + //! Returns the parent object of this child. This may be result or feature, + //! parent of a top result. Fast method, that uses internal data structure + //! specifics. + MODEL_EXPORT virtual std::shared_ptr + parent(const std::shared_ptr theChild); //! Returns the feature that is currently edited in this document, normally //! this is the latest created feature - //! \param theVisible use visible features only: flag is true for Object Browser functionality - //! \returns null if next created feature must be the first - MODEL_EXPORT virtual std::shared_ptr currentFeature(const bool theVisible); + //! \param theVisible use visible features only: flag is true for Object + //! Browser functionality \returns null if next created feature must be the + //! first + MODEL_EXPORT virtual std::shared_ptr + currentFeature(const bool theVisible); - //! Sets the current feature: all features below will be disabled, new features - //! will be appended after this one. - //! \param theCurrent the selected feature as current: below it everything becomes disabled - //! \param theVisible use visible features only: flag is true for Object Browser functionality - MODEL_EXPORT virtual void setCurrentFeature(std::shared_ptr theCurrent, - const bool theVisible); + //! Sets the current feature: all features below will be disabled, new + //! features will be appended after this one. \param theCurrent the selected + //! feature as current: below it everything becomes disabled \param theVisible + //! use visible features only: flag is true for Object Browser functionality + MODEL_EXPORT virtual void + setCurrentFeature(std::shared_ptr theCurrent, + const bool theVisible); //! Makes the current feature one feature upper MODEL_EXPORT virtual void setCurrentFeatureUp(); @@ -192,113 +205,132 @@ class Model_Document : public ModelAPI_Document //! Returns the number of all features: in the history or not MODEL_EXPORT virtual int numInternalFeatures(); //! Returns the feature by zero-based index: features in the history or not - MODEL_EXPORT virtual std::shared_ptr internalFeature(const int theIndex); + MODEL_EXPORT virtual std::shared_ptr + internalFeature(const int theIndex); //! Performs synchronization of transactions with the module document: //! If some document is not active (by undo of activation) but in memory, - //! on activation the transactions must be synchronized because all redo-s performed - //! without this participation + //! on activation the transactions must be synchronized because all redo-s + //! performed without this participation MODEL_EXPORT virtual void synchronizeTransactions(); /// Creates construction results - MODEL_EXPORT virtual std::shared_ptr createConstruction( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + createConstruction(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a body results - MODEL_EXPORT virtual std::shared_ptr createBody( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + createBody(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a part results - MODEL_EXPORT virtual std::shared_ptr createPart( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + createPart(const std::shared_ptr &theFeatureData, + const int theIndex = 0); //! Copies a part result, keeping the reference to origin - MODEL_EXPORT virtual std::shared_ptr copyPart( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + copyPart(const std::shared_ptr &theOrigin, + const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a group result - MODEL_EXPORT virtual std::shared_ptr createGroup( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + createGroup(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a field result - MODEL_EXPORT virtual std::shared_ptr createField( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + createField(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a parameter result - MODEL_EXPORT virtual std::shared_ptr createParameter( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + MODEL_EXPORT virtual std::shared_ptr + createParameter(const std::shared_ptr &theFeatureData, + const int theIndex = 0); //! Returns a feature by result (owner of result) MODEL_EXPORT virtual std::shared_ptr - feature(const std::shared_ptr& theResult); + feature(const std::shared_ptr &theResult); //! Creates a folder (group of the features in the object browser) //! \param theAddBefore a feature, the folder is added before //! (if empty, the folder is added after the last feature) - MODEL_EXPORT virtual std::shared_ptr addFolder( - std::shared_ptr theAddBefore = std::shared_ptr()); - //! Removes the folder from the document (all features in the folder will be kept). - MODEL_EXPORT virtual void removeFolder(std::shared_ptr theFolder); + MODEL_EXPORT virtual std::shared_ptr + addFolder(std::shared_ptr theAddBefore = + std::shared_ptr()); + //! Removes the folder from the document (all features in the folder will be + //! kept). + MODEL_EXPORT virtual void + removeFolder(std::shared_ptr theFolder); //! Search a folder above the list of features applicable to store them - //! (it means the list of features stored in the folder should be consequential) - //! \return Empty pointer if there is no applicable folder + //! (it means the list of features stored in the folder should be + //! consequential) \return Empty pointer if there is no applicable folder MODEL_EXPORT virtual std::shared_ptr findFolderAbove( - const std::list >& theFeatures); + const std::list> &theFeatures); //! Search a folder below the list of features applicable to store them - //! (it means the list of features stored in the folder should be consequential) - //! \return Empty pointer if there is no applicable folder + //! (it means the list of features stored in the folder should be + //! consequential) \return Empty pointer if there is no applicable folder MODEL_EXPORT virtual std::shared_ptr findFolderBelow( - const std::list >& theFeatures); + const std::list> &theFeatures); //! Search a folder containing the given feature. //! Additionally calculates a zero-based index of the feature in this folder. //! \param theFeature feature to search - //! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level. - //! \return the folder containing the feature or empty pointer if the feature is top-level. - MODEL_EXPORT virtual std::shared_ptr findContainingFolder( - const std::shared_ptr& theFeature, - int& theIndexInFolder); - //! Add a list of features to the folder. The correctness of the adding is not performed - //! (such checks have been done in corresponding find.. method). + //! \param theIndexInFolder zero-based index in the folder or -1 if the + //! feature is top-level. \return the folder containing the feature or empty + //! pointer if the feature is top-level. + MODEL_EXPORT virtual std::shared_ptr + findContainingFolder(const std::shared_ptr &theFeature, + int &theIndexInFolder); + //! Add a list of features to the folder. The correctness of the adding is not + //! performed (such checks have been done in corresponding find.. method). //! \return \c true if the movement is successful - MODEL_EXPORT virtual bool moveToFolder( - const std::list >& theFeatures, - const std::shared_ptr& theFolder); + MODEL_EXPORT virtual bool + moveToFolder(const std::list> &theFeatures, + const std::shared_ptr &theFolder); //! Remove features from the folder //! \param theFeatures list of features to be removed - //! \param theBefore extract features before the folder (this parameter is applicable only + //! \param theBefore extract features before the folder (this parameter is + //! applicable only //! when all features in the folder are taking out, //! in other cases the direction is taken automatically) //! \return \c true if the features have been moved out MODEL_EXPORT virtual bool removeFromFolder( - const std::list >& theFeatures, + const std::list> &theFeatures, const bool theBefore = true); - ///! Returns true if parametric updater need to execute feature on recomputation - ///! On abort, undo or redo it is not necessary: results in document are updated automatically - bool executeFeatures() {return myExecuteFeatures;} + ///! Returns true if parametric updater need to execute feature on + /// recomputation ! On abort, undo or redo it is not necessary: results in + /// document are updated automatically + bool executeFeatures() { return myExecuteFeatures; } - ///! On abort, undo or redo it is not necessary: results in document are updated automatically + ///! On abort, undo or redo it is not necessary: results in document are + /// updated automatically void setExecuteFeatures(const bool theFlag); //! Registers the name of the shape for the topological naming needs void addNamingName(const TDF_Label theLabel, std::wstring theName); //! Updates the name of some object void changeNamingName(std::wstring theOldName, const std::wstring theNewName, - const TDF_Label& theLabel); + const TDF_Label &theLabel); //! Returns the label, keeper of the name for the topological naming needs TDF_Label findNamingName(std::wstring theName, ResultPtr theContext); - //! Returns the number of the name in the history relatively to the given object (by label). - //! Start from 1 (this object). - int numberOfNameInHistory(const ObjectPtr& theNameObject, const TDF_Label& theStartFrom); - //! Returns the result by name of the result (names of results must be unique, used for naming - //! selection by name. - ResultPtr findByName(std::wstring& theName, - std::wstring& theSubShapeName, - bool& theUniqueContext); - - ///! Returns all features of the document including the hidden features which are not in - ///! history. Not very fast method, for calling once, not in big cycles. - MODEL_EXPORT virtual std::list > allFeatures(); - - //! Returns all objects of the document including the hidden features which are not in - //! history. Not very fast method, for calling once, not in big cycles. - MODEL_EXPORT virtual std::list > allObjects(); - - /// Returns the global identifier of the current transaction (needed for the update algo) + //! Returns the number of the name in the history relatively to the given + //! object (by label). Start from 1 (this object). + int numberOfNameInHistory(const ObjectPtr &theNameObject, + const TDF_Label &theStartFrom); + //! Returns the result by name of the result (names of results must be unique, + //! used for naming selection by name. + ResultPtr findByName(std::wstring &theName, std::wstring &theSubShapeName, + bool &theUniqueContext); + + ///! Returns all features of the document including the hidden features which + /// are not in ! history. Not very fast method, for calling once, not in big + /// cycles. + MODEL_EXPORT virtual std::list> + allFeatures(); + + //! Returns all objects of the document including the hidden features which + //! are not in history. Not very fast method, for calling once, not in big + //! cycles. + MODEL_EXPORT virtual std::list> allObjects(); + + /// Returns the global identifier of the current transaction (needed for the + /// update algo) MODEL_EXPORT virtual int transactionID(); /// Increases the transaction ID MODEL_EXPORT virtual void incrementTransactionID(); @@ -311,26 +343,31 @@ class Model_Document : public ModelAPI_Document FeaturePtr lastFeature(); /// Returns the feature that produced the given face of the given result. - MODEL_EXPORT virtual std::shared_ptr producedByFeature( - std::shared_ptr theResult, - const std::shared_ptr& theShape); + MODEL_EXPORT virtual std::shared_ptr + producedByFeature(std::shared_ptr theResult, + const std::shared_ptr &theShape); - /// Returns true if theLater is in history of features creation later than theCurrent - MODEL_EXPORT virtual bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const; + /// Returns true if theLater is in history of features creation later than + /// theCurrent + MODEL_EXPORT virtual bool isLater(FeaturePtr theLater, + FeaturePtr theCurrent) const; - /// Just removes all features without touching the document data (to be able undo) + /// Just removes all features without touching the document data (to be able + /// undo) MODEL_EXPORT virtual void eraseAllFeatures(); - /// Returns the next (from the history point of view) feature, any: invisible or disabled - /// \param theCurrent previous to the resulting feature - /// \param theReverse if it is true, iterates in reversed order (next becomes previous) - MODEL_EXPORT virtual std::shared_ptr nextFeature( - std::shared_ptr theCurrent, const bool theReverse = false) const; + /// Returns the next (from the history point of view) feature, any: invisible + /// or disabled \param theCurrent previous to the resulting feature \param + /// theReverse if it is true, iterates in reversed order (next becomes + /// previous) + MODEL_EXPORT virtual std::shared_ptr + nextFeature(std::shared_ptr theCurrent, + const bool theReverse = false) const; //! Erases the document structure. ~Model_Document(); - protected: +protected: //! Returns (creates if needed) the general label TDF_Label generalLabel() const; @@ -338,10 +375,7 @@ class Model_Document : public ModelAPI_Document Model_Document(const int theID, const std::string theKind); //! Returns the internal OCCT document of this interface - Handle_TDocStd_Document document() - { - return myDoc; - } + Handle_TDocStd_Document document() { return myDoc; } //! performs compactification of all nested operations into one //! \returns true if resulting transaction is not empty and can be undone @@ -350,21 +384,27 @@ class Model_Document : public ModelAPI_Document //! Returns all loaded sub documents const std::set subDocuments() const; - //! The implementation of undo: with or without recursive calls in the sub-documents + //! The implementation of undo: with or without recursive calls in the + //! sub-documents void undoInternal(const bool theWithSubs, const bool theSynchronize); - //! Stores the Id of the current operation (normally is called for the root document) - void operationId(const std::string& theId); + //! Stores the Id of the current operation (normally is called for the root + //! document) + void operationId(const std::string &theId); - //! Returns the list of Ids of the operations that can be undone (called for the root document) + //! Returns the list of Ids of the operations that can be undone (called for + //! the root document) std::list undoList() const; - //! Returns the list of Ids of the operations that can be redone (called for the root document) + //! Returns the list of Ids of the operations that can be redone (called for + //! the root document) std::list redoList() const; - //! Internally makes document know that feature was removed or added in history after creation + //! Internally makes document know that feature was removed or added in + //! history after creation virtual void updateHistory(const std::shared_ptr theObject); - //! Internally makes document know that feature was removed or added in history after creation + //! Internally makes document know that feature was removed or added in + //! history after creation virtual void updateHistory(const std::string theGroup); //! Returns true if the document is root module document @@ -374,9 +414,10 @@ class Model_Document : public ModelAPI_Document void setThis(DocumentPtr theDoc); //! Returns the objects manager - Model_Objects* objects() {return myObjs;} + Model_Objects *objects() { return myObjs; } - ///! Informs the document that it becomes active and some actions must be performed + ///! Informs the document that it becomes active and some actions must be + /// performed virtual void setActive(const bool theFlag); //! Returns true if this document is currently active virtual bool isActive() const; @@ -385,26 +426,30 @@ class Model_Document : public ModelAPI_Document //! for calculation of selection externally from the document std::shared_ptr selectionInPartFeature(); - /// Stores in the document boolean flags: states of the nodes in the object browser. - /// Normally is called outside of the transaction, just before "save". - virtual void storeNodesState(const std::list& theStates); + /// Stores in the document boolean flags: states of the nodes in the object + /// browser. Normally is called outside of the transaction, just before + /// "save". + virtual void storeNodesState(const std::list &theStates); /// Returns the stored nodes states. Normally it is called just after "open". /// Appends the values to theStates list. - virtual void restoreNodesState(std::list& theStates) const; + virtual void restoreNodesState(std::list &theStates) const; - /// Label that contains structures for selection of constructions of another document + /// Label that contains structures for selection of constructions of another + /// document TDF_Label extConstructionsLabel() const; /// searches in this document feature that contains this label - FeaturePtr featureByLab(const TDF_Label& theLab); + FeaturePtr featureByLab(const TDF_Label &theLab); /// searches in this document result that contains this label - ResultPtr resultByLab(const TDF_Label& theLab); + ResultPtr resultByLab(const TDF_Label &theLab); - /// returns true if theThis is later in the features tree and dependencies than theOther + /// returns true if theThis is later in the features tree and dependencies + /// than theOther bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther); - /// appends the latest transaction to the previous one (used for AutoUpdate enabling transaction) + /// appends the latest transaction to the previous one (used for AutoUpdate + /// enabling transaction) void appendTransactionToPrevious(); /// Sets the automatic recomputation flag: true means enabled @@ -428,36 +473,40 @@ class Model_Document : public ModelAPI_Document friend class Model_BodyBuilder; friend class DFBrowser; - private: - int myID; ///< identifier of the document in the application - std::string myKind; ///< kind of the document in the application - Handle_TDocStd_Document myDoc; ///< OCAF document +private: + int myID; ///< identifier of the document in the application + std::string myKind; ///< kind of the document in the application + Handle_TDocStd_Document myDoc; ///< OCAF document Model_Objects *myObjs; ///< data manager of this document - //! counter value of transaction on the last "save" call, used for "IsModified" method + //! counter value of transaction on the last "save" call, used for + //! "IsModified" method int myTransactionSave; - //! number of nested transactions performed (list because may be nested inside of nested) - //! the list is empty if not nested transaction is performed + //! number of nested transactions performed (list because may be nested inside + //! of nested) the list is empty if not nested transaction is performed std::list myNestedNum; //! Information related to the every user-transaction struct Transaction { - int myOCAFNum; ///< number of OCAF transactions related to each "this" transaction, may be 0 + int myOCAFNum; ///< number of OCAF transactions related to each "this" + ///< transaction, may be 0 std::string myId; ///< user-identifier string of transaction //! default constructor with default Id - Transaction(): myOCAFNum(0), myId("") {} + Transaction() : myOCAFNum(0), myId("") {} }; - //! transaction indexes (related to myTransactionsAfterSave) and info about the real transactions - //! in myDocument connected to this operation (may be zero for empty transaction) + //! transaction indexes (related to myTransactionsAfterSave) and info about + //! the real transactions in myDocument connected to this operation (may be + //! zero for empty transaction) std::list myTransactions; //! list of info about transactions undone (first is oldest undone) std::list myRedos; //! Optimization for finding the shape-label by topological naming names - //! The name -> list of labels where this name is appeared (the last created name is last here) - std::map > myNamingNames; + //! The name -> list of labels where this name is appeared (the last created + //! name is last here) + std::map> myNamingNames; //! If it is true, features are not executed on update (on abort, undo, redo) bool myExecuteFeatures; @@ -466,7 +515,8 @@ class Model_Document : public ModelAPI_Document //! The selection feature, if needed FeaturePtr mySelectionFeature; - bool myIsSetCurrentFeature; ///< flag that my current feature is changed right now (recursion) + bool myIsSetCurrentFeature; ///< flag that my current feature is changed right + ///< now (recursion) }; #endif diff --git a/src/Model/Model_Events.cpp b/src/Model/Model_Events.cpp index 684b83cf1..435f0a69a 100644 --- a/src/Model/Model_Events.cpp +++ b/src/Model/Model_Events.cpp @@ -14,86 +14,81 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include /// Alone instance of the creator per application Model_EventCreator MY_CREATOR; /////////////////////// CREATOR ///////////////////////////// -void Model_EventCreator::sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent, - const bool isGroupped) const -{ +void Model_EventCreator::sendUpdated(const ObjectPtr &theObject, + const Events_ID &theEvent, + const bool isGroupped) const { std::shared_ptr aMsg( - new Model_ObjectUpdatedMessage(theObject, theEvent)); + new Model_ObjectUpdatedMessage(theObject, theEvent)); Events_Loop::loop()->send(aMsg, isGroupped); } -void Model_EventCreator::sendUpdated(const std::list& theObjects, - const Events_ID& theEvent, const bool isGroupped) const -{ +void Model_EventCreator::sendUpdated(const std::list &theObjects, + const Events_ID &theEvent, + const bool isGroupped) const { if (theObjects.empty()) return; std::list::const_iterator anObj = theObjects.cbegin(); std::shared_ptr aMsg( - new Model_ObjectUpdatedMessage(*anObj, theEvent)); - for(anObj++; anObj != theObjects.cend(); anObj++) { - std::shared_ptr aJoined( new Model_ObjectUpdatedMessage(*anObj, theEvent)); + for (anObj++; anObj != theObjects.cend(); anObj++) { + std::shared_ptr aJoined( + new Model_ObjectUpdatedMessage(*anObj, theEvent)); aMsg->Join(aJoined); } Events_Loop::loop()->send(aMsg, isGroupped); } -void Model_EventCreator::sendDeleted(const std::shared_ptr& theDoc, - const std::string& theGroup) const -{ +void Model_EventCreator::sendDeleted( + const std::shared_ptr &theDoc, + const std::string &theGroup) const { std::shared_ptr aMsg( - new Model_ObjectDeletedMessage(theDoc, theGroup)); + new Model_ObjectDeletedMessage(theDoc, theGroup)); Events_Loop::loop()->send(aMsg, true); } -void Model_EventCreator::sendReordered(const std::shared_ptr& theReordered) const -{ +void Model_EventCreator::sendReordered( + const std::shared_ptr &theReordered) const { std::shared_ptr aMsg( - new Model_OrderUpdatedMessage(theReordered)); + new Model_OrderUpdatedMessage(theReordered)); Events_Loop::loop()->send(aMsg, true); } -Model_EventCreator::Model_EventCreator() -{ - ModelAPI_EventCreator::set(this); -} +Model_EventCreator::Model_EventCreator() { ModelAPI_EventCreator::set(this); } /////////////////////// UPDATED MESSAGE ///////////////////////////// -Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage(const ObjectPtr& theObject, - const Events_ID& theEvent) - : ModelAPI_ObjectUpdatedMessage(theEvent, 0) -{ +Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage( + const ObjectPtr &theObject, const Events_ID &theEvent) + : ModelAPI_ObjectUpdatedMessage(theEvent, 0) { if (theObject) { myObjects.insert(theObject); } } -const std::set& Model_ObjectUpdatedMessage::objects() const -{ +const std::set &Model_ObjectUpdatedMessage::objects() const { return myObjects; } -std::shared_ptr Model_ObjectUpdatedMessage::newEmpty() -{ +std::shared_ptr Model_ObjectUpdatedMessage::newEmpty() { ObjectPtr anEmptyObject; return std::shared_ptr( - new Model_ObjectUpdatedMessage(anEmptyObject, eventID())); + new Model_ObjectUpdatedMessage(anEmptyObject, eventID())); } -void Model_ObjectUpdatedMessage::Join(const std::shared_ptr& theJoined) -{ +void Model_ObjectUpdatedMessage::Join( + const std::shared_ptr &theJoined) { std::shared_ptr aJoined = - std::dynamic_pointer_cast(theJoined); + std::dynamic_pointer_cast(theJoined); std::set::iterator aFIter = aJoined->myObjects.begin(); for (; aFIter != aJoined->myObjects.end(); aFIter++) { myObjects.insert(*aFIter); @@ -102,37 +97,39 @@ void Model_ObjectUpdatedMessage::Join(const std::shared_ptr /////////////////////// DELETED MESSAGE ///////////////////////////// Model_ObjectDeletedMessage::Model_ObjectDeletedMessage( - const std::shared_ptr& theDoc, const std::string& theGroup) - : ModelAPI_ObjectDeletedMessage(messageId(), 0) -{ + const std::shared_ptr &theDoc, + const std::string &theGroup) + : ModelAPI_ObjectDeletedMessage(messageId(), 0) { if (!theGroup.empty()) { myGroups.push_back( - std::pair, std::string>(theDoc, theGroup)); + std::pair, std::string>(theDoc, + theGroup)); } } -std::shared_ptr Model_ObjectDeletedMessage::newEmpty() -{ +std::shared_ptr Model_ObjectDeletedMessage::newEmpty() { static const std::shared_ptr anEmpty; - return std::shared_ptr(new Model_ObjectDeletedMessage(anEmpty, "")); + return std::shared_ptr( + new Model_ObjectDeletedMessage(anEmpty, "")); } -const Events_ID Model_ObjectDeletedMessage::messageId() -{ +const Events_ID Model_ObjectDeletedMessage::messageId() { static Events_ID MY_ID = Events_Loop::eventByName(EVENT_OBJECT_DELETED); return MY_ID; } -void Model_ObjectDeletedMessage::Join(const std::shared_ptr& theJoined) -{ +void Model_ObjectDeletedMessage::Join( + const std::shared_ptr &theJoined) { std::shared_ptr aJoined = - std::dynamic_pointer_cast(theJoined); + std::dynamic_pointer_cast(theJoined); - const std::list, std::string>>& aJGroups = - aJoined->groups(); + const std::list, std::string>> + &aJGroups = aJoined->groups(); - std::list, std::string>>::iterator aGIter; - std::list, std::string>>::const_iterator aJIter; + std::list, + std::string>>::iterator aGIter; + std::list, + std::string>>::const_iterator aJIter; for (aJIter = aJGroups.cbegin(); aJIter != aJGroups.cend(); aJIter++) { for (aGIter = myGroups.begin(); aGIter != myGroups.end(); aGIter++) { if (aGIter->first == aJIter->first && aGIter->second == aJIter->second) @@ -144,15 +141,12 @@ void Model_ObjectDeletedMessage::Join(const std::shared_ptr } /////////////////////// REORDERED MESSAGE ///////////////////////////// -Model_OrderUpdatedMessage::Model_OrderUpdatedMessage( - FeaturePtr theReordered, const void* theSender) +Model_OrderUpdatedMessage::Model_OrderUpdatedMessage(FeaturePtr theReordered, + const void *theSender) : ModelAPI_OrderUpdatedMessage(messageId(), theSender), - myReordered(theReordered) -{ -} + myReordered(theReordered) {} -const Events_ID Model_OrderUpdatedMessage::messageId() -{ +const Events_ID Model_OrderUpdatedMessage::messageId() { static Events_ID MY_ID = Events_Loop::eventByName(EVENT_ORDER_UPDATED); return MY_ID; } diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index 4cee00901..d2cf0ba8e 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Events_H_ @@ -26,65 +27,72 @@ #include /// Allows to create ModelAPI messages -class Model_EventCreator : public ModelAPI_EventCreator -{ - public: +class Model_EventCreator : public ModelAPI_EventCreator { +public: /// creates created, updated or moved messages and sends to the loop - virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent, + virtual void sendUpdated(const ObjectPtr &theObject, + const Events_ID &theEvent, const bool isGroupped = true) const; - /// creates created, updated or moved messages with the objects collection and sends to the loop - virtual void sendUpdated(const std::list& theObjects, const Events_ID& theEvent, - const bool isGroupped = true) const; + /// creates created, updated or moved messages with the objects collection and + /// sends to the loop + virtual void sendUpdated(const std::list &theObjects, + const Events_ID &theEvent, + const bool isGroupped = true) const; /// creates deleted message and sends to the loop - virtual void sendDeleted(const std::shared_ptr& theDoc, - const std::string& theGroup) const; + virtual void sendDeleted(const std::shared_ptr &theDoc, + const std::string &theGroup) const; /// creates reordered message and sends to the loop - virtual void sendReordered(const std::shared_ptr& theReordered) const; + virtual void + sendReordered(const std::shared_ptr &theReordered) const; /// must be one per application, the constructor for internal usage only Model_EventCreator(); }; -/// Message that feature was changed (used for Object Browser update): moved, updated and deleted -class Model_ObjectUpdatedMessage : public ModelAPI_ObjectUpdatedMessage -{ - std::set myObjects; ///< which feature is changed +/// Message that feature was changed (used for Object Browser update): moved, +/// updated and deleted +class Model_ObjectUpdatedMessage : public ModelAPI_ObjectUpdatedMessage { + std::set myObjects; ///< which feature is changed /// Sender is not important, all information is located in the feature. - /// Use ModelAPI for creation of this event. Used for creation, movement and edition events. - Model_ObjectUpdatedMessage(const ObjectPtr& theObject, const Events_ID& theEvent); + /// Use ModelAPI for creation of this event. Used for creation, movement and + /// edition events. + Model_ObjectUpdatedMessage(const ObjectPtr &theObject, + const Events_ID &theEvent); friend class Model_EventCreator; - public: +public: /// Returns the feature that has been updated - virtual const std::set& objects() const; + virtual const std::set &objects() const; //! Creates a new empty group (to store it in the loop before flush) virtual std::shared_ptr newEmpty(); //! Allows to join the given message with the current one - virtual void Join(const std::shared_ptr& theJoined); + virtual void Join(const std::shared_ptr &theJoined); }; /// Message that feature was deleted (used for Object Browser update) -class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage -{ - ///< group identifiers that contained the deleted feature and document where they are deleted - std::list, std::string> > myGroups; +class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage { + ///< group identifiers that contained the deleted feature and document where + ///< they are deleted + std::list, std::string>> + myGroups; /// Use ModelAPI for creation of this event. - Model_ObjectDeletedMessage(const std::shared_ptr& theDoc, - const std::string& theGroup); + Model_ObjectDeletedMessage(const std::shared_ptr &theDoc, + const std::string &theGroup); friend class Model_EventCreator; - public: + +public: /// Returns the group where the objects were deleted - virtual const std::list, std::string> >& - groups() const - { + virtual const std::list< + std::pair, std::string>> & + groups() const { return myGroups; } @@ -95,25 +103,21 @@ class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage virtual const Events_ID messageId(); /// Appends to this message the given one - virtual void Join(const std::shared_ptr& theJoined); + virtual void Join(const std::shared_ptr &theJoined); }; /// Message that feature was deleted (used for Object Browser update) -class Model_OrderUpdatedMessage : public ModelAPI_OrderUpdatedMessage -{ - std::shared_ptr myReordered; ///< the feature that was moved +class Model_OrderUpdatedMessage : public ModelAPI_OrderUpdatedMessage { + std::shared_ptr myReordered; ///< the feature that was moved /// Use ModelAPI for creation of this event. - Model_OrderUpdatedMessage(FeaturePtr theReordered, - const void* theSender = 0); + Model_OrderUpdatedMessage(FeaturePtr theReordered, const void *theSender = 0); friend class Model_EventCreator; - public: + +public: /// Returns the document that has been updated - virtual std::shared_ptr reordered() - { - return myReordered; - } + virtual std::shared_ptr reordered() { return myReordered; } /// Returns the identifier of this message virtual const Events_ID messageId(); diff --git a/src/Model/Model_Expression.cpp b/src/Model/Model_Expression.cpp index 3190795e1..f47962bad 100644 --- a/src/Model/Model_Expression.cpp +++ b/src/Model/Model_Expression.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_Expression.h" @@ -26,29 +27,27 @@ #include #include -#include #include +#include #include static Standard_GUID kInvalidGUID("caee5ce4-34b1-4b29-abcb-685287d18096"); - -Model_Expression::Model_Expression(TDF_Label& theLabel) -{ +Model_Expression::Model_Expression(TDF_Label &theLabel) { if (!theLabel.FindAttribute(TDataStd_Name::GetID(), myText)) { myText = TDataStd_Name::Set(theLabel, TCollection_ExtendedString()); } if (!theLabel.FindAttribute(TDataStd_Comment::GetID(), myError)) { myError = TDataStd_Comment::Set(theLabel, TCollection_ExtendedString()); } - if (!theLabel.FindAttribute(TDataStd_ExtStringList::GetID(), myUsedParameters)) { + if (!theLabel.FindAttribute(TDataStd_ExtStringList::GetID(), + myUsedParameters)) { myUsedParameters = TDataStd_ExtStringList::Set(theLabel); } } -void Model_Expression::setText(const std::wstring& theValue) -{ +void Model_Expression::setText(const std::wstring &theValue) { if (text() != theValue) { myText->Set(TCollection_ExtendedString(theValue.c_str())); myIsInitialized = true; // the value will be set very soon @@ -57,32 +56,28 @@ void Model_Expression::setText(const std::wstring& theValue) setError(text().empty() ? "" : "Not a double value."); } -std::wstring Model_Expression::text() const -{ +std::wstring Model_Expression::text() const { return Locale::Convert::toWString(myText->Get().ToExtString()); } -void Model_Expression::setError(const std::string& theError) -{ +void Model_Expression::setError(const std::string &theError) { if (error() != theError) myError->Set(TCollection_ExtendedString(theError.c_str())); } -std::string Model_Expression::error() -{ +std::string Model_Expression::error() { return TCollection_AsciiString(myError->Get()).ToCString(); } -void Model_Expression::setUsedParameters(const std::set& theUsedParameters) -{ +void Model_Expression::setUsedParameters( + const std::set &theUsedParameters) { myUsedParameters->Clear(); std::set::const_iterator anIt = theUsedParameters.begin(); for (; anIt != theUsedParameters.end(); ++anIt) myUsedParameters->Append(TCollection_ExtendedString(anIt->c_str())); } -std::set Model_Expression::usedParameters() const -{ +std::set Model_Expression::usedParameters() const { std::set aResult; TDataStd_ListIteratorOfListOfExtendedString aIt; for (aIt.Initialize(myUsedParameters->List()); aIt.More(); aIt.Next()) @@ -91,15 +86,13 @@ std::set Model_Expression::usedParameters() const } ///////////////// Model_ExpressionDouble ///////////// -Model_ExpressionDouble::Model_ExpressionDouble(TDF_Label& theLabel) - : Model_Expression(theLabel) -{ +Model_ExpressionDouble::Model_ExpressionDouble(TDF_Label &theLabel) + : Model_Expression(theLabel) { myLab = theLabel; reinit(); } -void Model_ExpressionDouble::reinit() -{ +void Model_ExpressionDouble::reinit() { if (!myLab.FindAttribute(TDataStd_Real::GetID(), myReal)) { myIsInitialized = false; } else { @@ -107,8 +100,7 @@ void Model_ExpressionDouble::reinit() } } -void Model_ExpressionDouble::setValue(const double theValue) -{ +void Model_ExpressionDouble::setValue(const double theValue) { if (!myIsInitialized || myReal.IsNull()) { myReal = TDataStd_Real::Set(myText->Label(), theValue); myIsInitialized = true; @@ -117,15 +109,13 @@ void Model_ExpressionDouble::setValue(const double theValue) } } -double Model_ExpressionDouble::value() -{ +double Model_ExpressionDouble::value() { if (myIsInitialized && !myReal.IsNull()) return myReal->Get(); return std::numeric_limits::max(); // error } -void Model_ExpressionDouble::setInvalid(const bool theFlag) -{ +void Model_ExpressionDouble::setInvalid(const bool theFlag) { if (theFlag) { TDataStd_UAttribute::Set(myText->Label(), kInvalidGUID); } else { @@ -133,21 +123,18 @@ void Model_ExpressionDouble::setInvalid(const bool theFlag) } } -bool Model_ExpressionDouble::isInvalid() -{ +bool Model_ExpressionDouble::isInvalid() { return myText->Label().IsAttribute(kInvalidGUID) == Standard_True; } ///////////////// Model_ExpressionInteger ///////////// -Model_ExpressionInteger::Model_ExpressionInteger(TDF_Label& theLabel) - : Model_Expression(theLabel) -{ +Model_ExpressionInteger::Model_ExpressionInteger(TDF_Label &theLabel) + : Model_Expression(theLabel) { myLab = theLabel; reinit(); } -void Model_ExpressionInteger::reinit() -{ +void Model_ExpressionInteger::reinit() { if (!myLab.FindAttribute(TDataStd_Integer::GetID(), myInteger)) { myIsInitialized = false; } else { @@ -155,8 +142,7 @@ void Model_ExpressionInteger::reinit() } } -void Model_ExpressionInteger::setValue(const int theValue) -{ +void Model_ExpressionInteger::setValue(const int theValue) { if (!myIsInitialized || myInteger.IsNull()) { myInteger = TDataStd_Integer::Set(myText->Label(), theValue); myIsInitialized = true; @@ -165,15 +151,13 @@ void Model_ExpressionInteger::setValue(const int theValue) } } -int Model_ExpressionInteger::value() -{ +int Model_ExpressionInteger::value() { if (myIsInitialized && !myInteger.IsNull()) return myInteger->Get(); return std::numeric_limits::max(); // error } -void Model_ExpressionInteger::setInvalid(const bool theFlag) -{ +void Model_ExpressionInteger::setInvalid(const bool theFlag) { if (theFlag) { TDataStd_UAttribute::Set(myText->Label(), kInvalidGUID); } else { @@ -181,7 +165,6 @@ void Model_ExpressionInteger::setInvalid(const bool theFlag) } } -bool Model_ExpressionInteger::isInvalid() -{ +bool Model_ExpressionInteger::isInvalid() { return myText->Label().IsAttribute(kInvalidGUID) == Standard_True; } diff --git a/src/Model/Model_Expression.h b/src/Model/Model_Expression.h index 0428c65b2..43d167aff 100644 --- a/src/Model/Model_Expression.h +++ b/src/Model/Model_Expression.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Expression_H_ @@ -35,49 +36,50 @@ * \ingroup DataModel * \brief Implementation of ModelAPI_Expression. */ -class Model_Expression : public virtual ModelAPI_Expression -{ - public: +class Model_Expression : public virtual ModelAPI_Expression { +public: /// Sets the text of this Expression - MODEL_EXPORT virtual void setText(const std::wstring& theText); + MODEL_EXPORT virtual void setText(const std::wstring &theText); /// Returns the text of this Expression MODEL_EXPORT virtual std::wstring text() const; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setError(const std::string& theError); + MODEL_EXPORT virtual void setError(const std::string &theError); /// Returns an expression error MODEL_EXPORT virtual std::string error(); /// Defines the used parameters (by the parameters listener) - MODEL_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters); + MODEL_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters); /// Returns the used parameters MODEL_EXPORT virtual std::set usedParameters() const; - protected: +protected: /// Initializes attributes - Model_Expression(TDF_Label& theLabel); - - Handle_TDataStd_Name myText; ///< Text representation of the attribute (may differ for parameters) - Handle_TDataStd_Comment myError; ///< Error of expression of the text attribute - Handle_TDataStd_ExtStringList myUsedParameters; ///< Parameters used in expression - TDF_Label myLab; ///< if attribute is not initialized, store label here + Model_Expression(TDF_Label &theLabel); + + Handle_TDataStd_Name myText; ///< Text representation of the attribute (may + ///< differ for parameters) + Handle_TDataStd_Comment + myError; ///< Error of expression of the text attribute + Handle_TDataStd_ExtStringList + myUsedParameters; ///< Parameters used in expression + TDF_Label myLab; ///< if attribute is not initialized, store label here }; - /**\class Model_ExpressionDouble * \ingroup DataModel * \brief Implementation of ModelAPI_ExpressionDouble. */ -class Model_ExpressionDouble : - public Model_Expression, // implementation inheritance - public ModelAPI_ExpressionDouble -{ - public: +class Model_ExpressionDouble + : public Model_Expression, // implementation inheritance + public ModelAPI_ExpressionDouble { +public: /// Sets the text of this Expression - MODEL_EXPORT virtual void setText(const std::wstring& theText) { + MODEL_EXPORT virtual void setText(const std::wstring &theText) { Model_Expression::setText(theText); }; @@ -87,7 +89,7 @@ class Model_ExpressionDouble : }; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setError(const std::string& theError) { + MODEL_EXPORT virtual void setError(const std::string &theError) { Model_Expression::setError(theError); }; @@ -97,7 +99,8 @@ class Model_ExpressionDouble : }; /// Defines the used parameters (by the parameters listener) - MODEL_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters) { + MODEL_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters) { Model_Expression::setUsedParameters(theUsedParameters); }; @@ -118,31 +121,30 @@ class Model_ExpressionDouble : /// Returns true if text is invalid MODEL_EXPORT virtual bool isInvalid(); - protected: +protected: /// Initializes attributes - Model_ExpressionDouble(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_ExpressionDouble(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_AttributeDouble; friend class Model_Data; - private: +private: Handle_TDataStd_Real myReal; ///< double is Real attribute }; - /**\class Model_ExpressionInteger * \ingroup DataModel * \brief Implementation of ModelAPI_ExpressionInteger. */ -class Model_ExpressionInteger : - public Model_Expression, // implementation inheritance - public ModelAPI_ExpressionInteger -{ - public: +class Model_ExpressionInteger + : public Model_Expression, // implementation inheritance + public ModelAPI_ExpressionInteger { +public: /// Sets the text of this Expression - MODEL_EXPORT virtual void setText(const std::wstring& theText) { + MODEL_EXPORT virtual void setText(const std::wstring &theText) { Model_Expression::setText(theText); }; @@ -152,7 +154,7 @@ class Model_ExpressionInteger : }; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setError(const std::string& theError) { + MODEL_EXPORT virtual void setError(const std::string &theError) { Model_Expression::setError(theError); }; @@ -162,7 +164,8 @@ class Model_ExpressionInteger : }; /// Defines the used parameters (by the parameters listener) - MODEL_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters) { + MODEL_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters) { Model_Expression::setUsedParameters(theUsedParameters); }; @@ -183,15 +186,16 @@ class Model_ExpressionInteger : /// Returns true if text is invalid MODEL_EXPORT virtual bool isInvalid(); - protected: +protected: /// Initializes attributes - Model_ExpressionInteger(TDF_Label& theLabel); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + Model_ExpressionInteger(TDF_Label &theLabel); + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) virtual void reinit(); friend class Model_AttributeInteger; - private: +private: Handle_TDataStd_Integer myInteger; }; diff --git a/src/Model/Model_FeatureValidator.cpp b/src/Model/Model_FeatureValidator.cpp index 2417d79d6..94b4adb8e 100644 --- a/src/Model/Model_FeatureValidator.cpp +++ b/src/Model/Model_FeatureValidator.cpp @@ -14,30 +14,32 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include #include #include #include #include #include +#include #include #include -bool Model_FeatureValidator::isValid(const std::shared_ptr& theFeature, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ - static Model_ValidatorsFactory* aValidators = - static_cast(ModelAPI_Session::get()->validators()); +bool Model_FeatureValidator::isValid( + const std::shared_ptr &theFeature, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { + static Model_ValidatorsFactory *aValidators = + static_cast( + ModelAPI_Session::get()->validators()); std::shared_ptr aData = theFeature->data(); // "Action" features has no data, but still valid. e.g "Remove Part" @@ -54,13 +56,15 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr& th if (!aValidators->isCase(theFeature, anAttr->id())) continue; // this attribute is not participated in the current case if (!anAttr->isInitialized()) { // attribute is not initialized - std::map >::const_iterator aFeatureFind = - myNotObligatory.find(theFeature->getKind()); - if (aFeatureFind == myNotObligatory.end() || // and it is obligatory for filling + std::map>::const_iterator + aFeatureFind = myNotObligatory.find(theFeature->getKind()); + if (aFeatureFind == + myNotObligatory.end() || // and it is obligatory for filling aFeatureFind->second.find(*it) == aFeatureFind->second.end()) { theError = "Attribute \"%1\" is not initialized."; theError.addParameter(anAttr->id()); - // workaround for the filters selection feature: do not append the attribute id + // workaround for the filters selection feature: do not append the + // attribute id if (std::dynamic_pointer_cast(theFeature)) theError.setContext(theFeature->getKind()); else @@ -72,14 +76,14 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr& th return true; } -void Model_FeatureValidator::registerNotObligatory(std::string theFeature, std::string theAttribute) -{ - std::set& anAttrs = myNotObligatory[theFeature]; +void Model_FeatureValidator::registerNotObligatory(std::string theFeature, + std::string theAttribute) { + std::set &anAttrs = myNotObligatory[theFeature]; anAttrs.insert(theAttribute); } -bool Model_FeatureValidator::isNotObligatory(std::string theFeature, std::string theAttribute) -{ - std::set& anAttrs = myNotObligatory[theFeature]; +bool Model_FeatureValidator::isNotObligatory(std::string theFeature, + std::string theAttribute) { + std::set &anAttrs = myNotObligatory[theFeature]; return anAttrs.find(theAttribute) != anAttrs.end(); } diff --git a/src/Model/Model_FeatureValidator.h b/src/Model/Model_FeatureValidator.h index 2882d8ceb..0beb6b868 100644 --- a/src/Model/Model_FeatureValidator.h +++ b/src/Model/Model_FeatureValidator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_FeatureValidator_H @@ -24,37 +25,41 @@ #include #include +#include #include #include -#include /**\class Model_FeatureValidator * \ingroup DataModel * \brief The geneneric validator for the whole feature. * - * Can be redefined for some specific feature, but by default for each feature this validator is - * used: it checks each argument of the feature and if one of it is not valid (and obligatory), - * the hole feature is invalid. + * Can be redefined for some specific feature, but by default for each feature + * this validator is used: it checks each argument of the feature and if one of + * it is not valid (and obligatory), the hole feature is invalid. */ -class Model_FeatureValidator : public ModelAPI_FeatureValidator -{ +class Model_FeatureValidator : public ModelAPI_FeatureValidator { // not obligatory attributes, not checked for initialization - std::map > myNotObligatory; + std::map> myNotObligatory; + public: /// Returns true if feature and/or attributes are valid /// \param theFeature the validated feature - /// \param theArguments the arguments in the configuration file for this validator - /// \param theError erros message produced by validator to the user if it fails - /// \returns true if feature is valid - MODEL_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + /// \param theArguments the arguments in the configuration file for this + /// validator \param theError erros message produced by validator to the user + /// if it fails \returns true if feature is valid + MODEL_EXPORT virtual bool + isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; /// sets not obligatory attributes, not checked for initialization - virtual void registerNotObligatory(std::string theFeature, std::string theAttribute); + virtual void registerNotObligatory(std::string theFeature, + std::string theAttribute); - /// Returns true if the attribute in feature is not obligatory for the feature execution - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + /// Returns true if the attribute in feature is not obligatory for the feature + /// execution + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; #endif diff --git a/src/Model/Model_FiltersFactory.cpp b/src/Model/Model_FiltersFactory.cpp index 3e213d04e..67adc4e9c 100644 --- a/src/Model/Model_FiltersFactory.cpp +++ b/src/Model/Model_FiltersFactory.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_FiltersFactory.h" @@ -25,18 +26,21 @@ #include "GeomAPI_Edge.h" -#include #include +#include -typedef std::unordered_map DataMapOfShapesToResults; +typedef std::unordered_map + DataMapOfShapesToResults; -void Model_FiltersFactory::registerFilter(const std::string& theID, ModelAPI_Filter* theFilter) -{ +void Model_FiltersFactory::registerFilter(const std::string &theID, + ModelAPI_Filter *theFilter) { if (myFilters.find(theID) != myFilters.end()) { - Events_InfoMessage("Model_FiltersFactory", "Filter %1 is already registered").arg(theID).send(); - } - else { + Events_InfoMessage("Model_FiltersFactory", + "Filter %1 is already registered") + .arg(theID) + .send(); + } else { myFilters[theID] = FilterPtr(theFilter); } } @@ -48,12 +52,11 @@ struct FilterArgs { }; /// Returns the filter ID without the filter index -static std::string pureFilterID(const std::string& theID) -{ +static std::string pureFilterID(const std::string &theID) { // remove from aPure "_" + number + "_" starting part if (theID.size() > 3 && theID[0] == '_') { int aNumDigits = 0; - while(theID[aNumDigits + 1] < '9' && theID[aNumDigits + 1] > '0') + while (theID[aNumDigits + 1] < '9' && theID[aNumDigits + 1] > '0') aNumDigits++; if (aNumDigits && theID[aNumDigits + 1] == '_') { return theID.substr(aNumDigits + 2); @@ -62,60 +65,53 @@ static std::string pureFilterID(const std::string& theID) return theID; } -static void fillMapOfShapesToResults(DataMapOfShapesToResults& theMap, - const ResultBodyPtr& theBodyResult, - const GeomAPI_Shape::ShapeType theShapeType) -{ +static void +fillMapOfShapesToResults(DataMapOfShapesToResults &theMap, + const ResultBodyPtr &theBodyResult, + const GeomAPI_Shape::ShapeType theShapeType) { std::stack stack; stack.push(theBodyResult); - while(!stack.empty()) - { + while (!stack.empty()) { ResultBodyPtr aCurrBodyRes = stack.top(); stack.pop(); int nbSubs = aCurrBodyRes->numberOfSubs(); - if(nbSubs == 0) - { + if (nbSubs == 0) { GeomShapePtr aShape = aCurrBodyRes->shape(); - std::list aSubShapes = aShape->subShapes(theShapeType, true); + std::list aSubShapes = + aShape->subShapes(theShapeType, true); std::list::const_iterator aShapesIt; - for (aShapesIt = aSubShapes.cbegin(); aShapesIt != aSubShapes.cend(); aShapesIt++) - { + for (aShapesIt = aSubShapes.cbegin(); aShapesIt != aSubShapes.cend(); + aShapesIt++) { GeomShapePtr aSubShape = (*aShapesIt); // degenerated edge is not valid selection if (theShapeType == GeomAPI_Shape::EDGE) if (aSubShape->edge()->isDegenerated()) continue; - - if (theMap.find(aSubShape) == theMap.end()) - { + + if (theMap.find(aSubShape) == theMap.end()) { theMap.emplace(aSubShape, aCurrBodyRes); } } - } - else - { - for (int aSubIndex = 0; aSubIndex < nbSubs; aSubIndex++) - { - stack.push(aCurrBodyRes->subResult(aSubIndex)); - } + } else { + for (int aSubIndex = 0; aSubIndex < nbSubs; aSubIndex++) { + stack.push(aCurrBodyRes->subResult(aSubIndex)); + } } } - } bool Model_FiltersFactory::isValid(FeaturePtr theFiltersFeature, - ResultPtr theResult, - GeomShapePtr theShape) -{ + ResultPtr theResult, GeomShapePtr theShape) { // check that the shape type corresponds to the attribute list type AttributePtr aBase = - std::dynamic_pointer_cast(theFiltersFeature)->baseAttribute(); + std::dynamic_pointer_cast(theFiltersFeature) + ->baseAttribute(); if (aBase.get()) { std::shared_ptr aList = - std::dynamic_pointer_cast(aBase); + std::dynamic_pointer_cast(aBase); std::string aStrType = aList->selectionType(); GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::shapeTypeByStr(aStrType); if (theShape->shapeType() != aType) @@ -127,20 +123,21 @@ bool Model_FiltersFactory::isValid(FeaturePtr theFiltersFeature, std::list aGroups; theFiltersFeature->data()->allGroups(aGroups); - for(std::list::iterator aGIter = aGroups.begin(); aGIter != aGroups.end(); aGIter++) - { + for (std::list::iterator aGIter = aGroups.begin(); + aGIter != aGroups.end(); aGIter++) { std::string aPureID = pureFilterID(*aGIter); if (myFilters.find(aPureID) == myFilters.end()) continue; - std::list > anAttrs; + std::list> anAttrs; theFiltersFeature->data()->attributesOfGroup(*aGIter, anAttrs); - std::list >::iterator anAttrIter = anAttrs.begin(); - for(; anAttrIter != anAttrs.end(); anAttrIter++) { + std::list>::iterator anAttrIter = + anAttrs.begin(); + for (; anAttrIter != anAttrs.end(); anAttrIter++) { std::string anArgID = (*anAttrIter)->id().substr((*aGIter).length() + 2); if (anArgID.empty()) { // reverse flag std::shared_ptr aReverse = - std::dynamic_pointer_cast(*anAttrIter); - FilterArgs aFArgs = { myFilters[aPureID] , aReverse->value() , *aGIter }; + std::dynamic_pointer_cast(*anAttrIter); + FilterArgs aFArgs = {myFilters[aPureID], aReverse->value(), *aGIter}; aFilters.push_back(aFArgs); } else { @@ -151,7 +148,7 @@ bool Model_FiltersFactory::isValid(FeaturePtr theFiltersFeature, // iterate filters and check shape for validity for all of them std::list::iterator aFilter = aFilters.begin(); - for(; aFilter != aFilters.end(); aFilter++) { + for (; aFilter != aFilters.end(); aFilter++) { anArgs.setFilter(aFilter->myFilterID); bool aResult = aFilter->myFilter->isOk(theShape, theResult, anArgs); @@ -164,18 +161,16 @@ bool Model_FiltersFactory::isValid(FeaturePtr theFiltersFeature, return true; } -std::list< std::pair > Model_FiltersFactory::select -(const FiltersFeaturePtr& theFilterFeature, - const GeomAPI_Shape::ShapeType theShapeType) -{ - std::list< std::pair > aResList; +std::list> +Model_FiltersFactory::select(const FiltersFeaturePtr &theFilterFeature, + const GeomAPI_Shape::ShapeType theShapeType) { + std::list> aResList; DocumentPtr aDoc = theFilterFeature->document(); int aNb = aDoc->size(ModelAPI_ResultBody::group()); ObjectPtr aObj; ResultBodyPtr aBody; - for (int i = 0; i < aNb; i++) - { + for (int i = 0; i < aNb; i++) { aObj = aDoc->object(ModelAPI_ResultBody::group(), i); aBody = std::dynamic_pointer_cast(aObj); DataMapOfShapesToResults aShapeToResMap; @@ -184,21 +179,18 @@ std::list< std::pair > Model_FiltersFactory::select GeomShapePtr aShape = aBody->shape(); std::list aSubShapes = aShape->subShapes(theShapeType, true); std::list::const_iterator aShapesIt; - for (aShapesIt = aSubShapes.cbegin(); aShapesIt != aSubShapes.cend(); aShapesIt++) - { + for (aShapesIt = aSubShapes.cbegin(); aShapesIt != aSubShapes.cend(); + aShapesIt++) { GeomShapePtr aSubShape = (*aShapesIt); // degenerated edge is not valid selection if (theShapeType == GeomAPI_Shape::EDGE) if (aSubShape->edge()->isDegenerated()) continue; - - if (aShapeToResMap.find(aSubShape) != aShapeToResMap.end()) - { + if (aShapeToResMap.find(aSubShape) != aShapeToResMap.end()) { ResultBodyPtr aResBody = aShapeToResMap[aSubShape]; - if(this->isValid(theFilterFeature, aResBody, aSubShape)) - { - std::pair aPair(aResBody, aSubShape); + if (this->isValid(theFilterFeature, aResBody, aSubShape)) { + std::pair aPair(aResBody, aSubShape); aResList.push_back(aPair); } } @@ -209,8 +201,8 @@ std::list< std::pair > Model_FiltersFactory::select /// Returns list of filters for the given shape type /// \param theType a shape type -std::list Model_FiltersFactory::filters(GeomAPI_Shape::ShapeType theType) -{ +std::list +Model_FiltersFactory::filters(GeomAPI_Shape::ShapeType theType) { std::list aResult; std::map::const_iterator anIt; std::list aTypes; @@ -222,17 +214,15 @@ std::list Model_FiltersFactory::filters(GeomAPI_Shape::ShapeType theT return aResult; } -FilterPtr Model_FiltersFactory::filter(std::string theID) -{ +FilterPtr Model_FiltersFactory::filter(std::string theID) { std::string aPureID = pureFilterID(theID); std::map::iterator aFound = myFilters.find(aPureID); return aFound == myFilters.end() ? FilterPtr() : aFound->second; } -std::string Model_FiltersFactory::id(FilterPtr theFilter) -{ +std::string Model_FiltersFactory::id(FilterPtr theFilter) { std::map::iterator anIter = myFilters.begin(); - for(; anIter != myFilters.end(); anIter++) { + for (; anIter != myFilters.end(); anIter++) { if (anIter->second == theFilter) return anIter->first; } diff --git a/src/Model/Model_FiltersFactory.h b/src/Model/Model_FiltersFactory.h index e34e1c892..ee18e6e3a 100644 --- a/src/Model/Model_FiltersFactory.h +++ b/src/Model/Model_FiltersFactory.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_FiltersFactory_H_ @@ -26,34 +27,31 @@ #include - /**\class Model_FiltersFactory -* \ingroup DataModel -* \brief Manages registering of filters -*/ -class Model_FiltersFactory : public ModelAPI_FiltersFactory -{ + * \ingroup DataModel + * \brief Manages registering of filters + */ +class Model_FiltersFactory : public ModelAPI_FiltersFactory { public: /// Register an instance of a filter - /// \param theID unique identifier of the filter, not necessary equal to the name of filter - /// \param theFilter the filter's instance - virtual void registerFilter(const std::string& theID, ModelAPI_Filter* theFilter); + /// \param theID unique identifier of the filter, not necessary equal to the + /// name of filter \param theFilter the filter's instance + virtual void registerFilter(const std::string &theID, + ModelAPI_Filter *theFilter); - /// Returns true if all filters of the Filters feature are ok for the Shape (taking into account - /// the Reversed states). - /// \param theResult parent result of the shape to check - /// \param theShape the checked shape - virtual bool isValid(FeaturePtr theFiltersFeature, - ResultPtr theResult, + /// Returns true if all filters of the Filters feature are ok for the Shape + /// (taking into account the Reversed states). \param theResult parent result + /// of the shape to check \param theShape the checked shape + virtual bool isValid(FeaturePtr theFiltersFeature, ResultPtr theResult, GeomShapePtr theShape); /// Returns list of all shapes and subshapes in the study, satisfying /// criteria of all filters of \a theFilterFeature. - /// \param theFiltersFeature feature that contains all information about the filters - /// \param theShapeType the type of sub-shapes to find - virtual std::list< std::pair > select - (const FiltersFeaturePtr& theFilterFeature, - const GeomAPI_Shape::ShapeType theShapeType); + /// \param theFiltersFeature feature that contains all information about the + /// filters \param theShapeType the type of sub-shapes to find + virtual std::list> + select(const FiltersFeaturePtr &theFilterFeature, + const GeomAPI_Shape::ShapeType theShapeType); /// Returns the filters that support the given shape type virtual std::list filters(GeomAPI_Shape::ShapeType theType); @@ -69,7 +67,8 @@ protected: Model_FiltersFactory() {} private: - std::map myFilters; ///< map from ID to registered filters + std::map + myFilters; ///< map from ID to registered filters friend class Model_Session; }; diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 41b019b9b..2bfecc411 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -14,65 +14,68 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include +#include #include -#include +#include #include +#include #include -#include -#include -#include -#include -#include - +#include +#include -#include #include +#include #include -#include -#include #include -#include -#include -#include -#include -#include #include +#include #include +#include +#include +#include +#include +#include // for TDF_Label map usage -static Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper); -static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2); +static Standard_Integer HashCode(const TDF_Label &theLab, + const Standard_Integer theUpper); +static Standard_Boolean IsEqual(const TDF_Label &theLab1, + const TDF_Label &theLab2); int kUNDEFINED_FEATURE_INDEX = -1; -static const std::string& groupNameFoldering(const std::string& theGroupID, - const bool theAllowFolder) -{ +static const std::string &groupNameFoldering(const std::string &theGroupID, + const bool theAllowFolder) { if (theAllowFolder) { - static const std::string anOutOfFolderName = std::string("__") + ModelAPI_Feature::group(); + static const std::string anOutOfFolderName = + std::string("__") + ModelAPI_Feature::group(); static const std::string aDummyName; - return theGroupID == ModelAPI_Feature::group() ? anOutOfFolderName : aDummyName; + return theGroupID == ModelAPI_Feature::group() ? anOutOfFolderName + : aDummyName; } return theGroupID; } // Check theFeature is a first or last feature in folder and return this folder -static FolderPtr inFolder(const FeaturePtr& theFeature, const std::string& theFolderAttr) -{ - const std::set& aRefs = theFeature->data()->refsToMe(); - for (std::set::iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) { +static FolderPtr inFolder(const FeaturePtr &theFeature, + const std::string &theFolderAttr) { + const std::set &aRefs = theFeature->data()->refsToMe(); + for (std::set::iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) { if ((*anIt)->id() != theFolderAttr) continue; @@ -84,24 +87,21 @@ static FolderPtr inFolder(const FeaturePtr& theFeature, const std::string& theFo return FolderPtr(); } - -static const int TAG_OBJECTS = 2; // tag of the objects sub-tree (features, results) +static const int TAG_OBJECTS = + 2; // tag of the objects sub-tree (features, results) // feature sub-labels -static const int TAG_FEATURE_ARGUMENTS = 1; ///< where the arguments are located -static const int TAG_FEATURE_RESULTS = 2; ///< where the results are located +static const int TAG_FEATURE_ARGUMENTS = 1; ///< where the arguments are located +static const int TAG_FEATURE_RESULTS = 2; ///< where the results are located /// /// 0:1:2 - where features are located /// 0:1:2:N:1 - data of the feature N /// 0:1:2:N:2:K:1 - data of the K result of the feature N -Model_Objects::Model_Objects(TDF_Label theMainLab) : myMain(theMainLab) -{ -} +Model_Objects::Model_Objects(TDF_Label theMainLab) : myMain(theMainLab) {} -void Model_Objects::setOwner(DocumentPtr theDoc) -{ +void Model_Objects::setOwner(DocumentPtr theDoc) { myDoc = theDoc; // update all fields and recreate features and result objects if needed TDF_LabelList aNoUpdated; @@ -109,17 +109,18 @@ void Model_Objects::setOwner(DocumentPtr theDoc) myHistory.clear(); } -Model_Objects::~Model_Objects() -{ +Model_Objects::~Model_Objects() { // delete all features of this document - Events_Loop* aLoop = Events_Loop::loop(); - // erase one by one to avoid access from the feature destructor itself from he map - // blocks the flush signals to avoid the temporary objects visualization in the viewer - // they should not be shown in order to do not lose highlight by erasing them + Events_Loop *aLoop = Events_Loop::loop(); + // erase one by one to avoid access from the feature destructor itself from he + // map blocks the flush signals to avoid the temporary objects visualization + // in the viewer they should not be shown in order to do not lose highlight by + // erasing them bool isActive = aLoop->activateFlushes(false); - while(!myFeatures.IsEmpty()) { - NCollection_DataMap::Iterator aFeaturesIter(myFeatures); + while (!myFeatures.IsEmpty()) { + NCollection_DataMap::Iterator aFeaturesIter( + myFeatures); FeaturePtr aFeature = aFeaturesIter.Value(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendDeleted(myDoc, ModelAPI_Feature::group()); @@ -139,27 +140,29 @@ Model_Objects::~Model_Objects() } myHistory.clear(); aLoop->activateFlushes(isActive); - // erase update, because features are destroyed and update should not performed for them anywhere + // erase update, because features are destroyed and update should not + // performed for them anywhere aLoop->eraseMessages(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->eraseMessages(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - // deleted and redisplayed is correctly performed: they know that features are destroyed + // deleted and redisplayed is correctly performed: they know that features are + // destroyed aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - } /// Appends to the array of references a new referenced label -static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced, TDF_Label& thePrevLab) -{ +static void AddToRefArray(TDF_Label &theArrayLab, TDF_Label &theReferenced, + TDF_Label &thePrevLab) { Handle(TDataStd_ReferenceArray) aRefs; if (!theArrayLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { aRefs = TDataStd_ReferenceArray::Set(theArrayLab, 0, 0); aRefs->SetValue(0, theReferenced); - } else { // extend array by one more element - Handle(TDataStd_HLabelArray1) aNewArray = new TDataStd_HLabelArray1(aRefs->Lower(), - aRefs->Upper() + 1); + } else { // extend array by one more element + Handle(TDataStd_HLabelArray1) aNewArray = + new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper() + 1); int aPassedPrev = 0; // previous feature is found and passed - if (thePrevLab.IsNull()) { // null means that inserted feature must be the first + if (thePrevLab + .IsNull()) { // null means that inserted feature must be the first aNewArray->SetValue(aRefs->Lower(), theReferenced); aPassedPrev = 1; } @@ -176,18 +179,18 @@ static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced, TDF_ } } -void Model_Objects::addFeature(FeaturePtr theFeature, const FeaturePtr theAfterThis) -{ - if (!theFeature->isAction()) { // do not add action to the data model +void Model_Objects::addFeature(FeaturePtr theFeature, + const FeaturePtr theAfterThis) { + if (!theFeature->isAction()) { // do not add action to the data model TDF_Label aFeaturesLab = featuresLabel(); TDF_Label aFeatureLab = aFeaturesLab.NewChild(); - // store feature in the features array: before "initData" because in macro features - // in initData it creates new features, appeared later than this + // store feature in the features array: before "initData" because in macro + // features in initData it creates new features, appeared later than this TDF_Label aPrevFeateureLab; FolderPtr aParentFolder; if (theAfterThis.get()) { // searching for the previous feature label std::shared_ptr aPrevData = - std::dynamic_pointer_cast(theAfterThis->data()); + std::dynamic_pointer_cast(theAfterThis->data()); if (aPrevData.get()) { aPrevFeateureLab = aPrevData->label().Father(); } @@ -222,11 +225,12 @@ void Model_Objects::addFeature(FeaturePtr theFeature, const FeaturePtr theAfterT // put feature to the end of folder if it is added while // the history line is set to the last feature from the folder if (aParentFolder) { - aParentFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID())->setValue(theFeature); + aParentFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID()) + ->setValue(theFeature); updateHistory(ModelAPI_Folder::group()); } - // event: feature is added, mist be before "initData" to update OB correctly on Duplicate: - // first new part, then the content + // event: feature is added, mist be before "initData" to update OB correctly + // on Duplicate: first new part, then the content static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent); } else { // make feature has not-null data anyway @@ -239,22 +243,23 @@ void Model_Objects::addFeature(FeaturePtr theFeature, const FeaturePtr theAfterT /// If theIndex is not -1, removes element at this index, not theReferenced. /// \returns the index of removed element static int RemoveFromRefArray(TDF_Label theArrayLab, TDF_Label theReferenced, - const int theIndex = -1) -{ - int aResult = -1; // no returned + const int theIndex = -1) { + int aResult = -1; // no returned Handle(TDataStd_ReferenceArray) aRefs; if (theArrayLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - if (aRefs->Length() == 1) { // just erase an array - if ((theIndex == -1 && aRefs->Value(0) == theReferenced) || theIndex == 0) { + if (aRefs->Length() == 1) { // just erase an array + if ((theIndex == -1 && aRefs->Value(0) == theReferenced) || + theIndex == 0) { theArrayLab.ForgetAttribute(TDataStd_ReferenceArray::GetID()); } aResult = 0; - } else { // reduce the array - Handle(TDataStd_HLabelArray1) aNewArray = new TDataStd_HLabelArray1(aRefs->Lower(), - aRefs->Upper() - 1); + } else { // reduce the array + Handle(TDataStd_HLabelArray1) aNewArray = + new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper() - 1); int aCount = aRefs->Lower(); for (int a = aCount; a <= aRefs->Upper(); a++, aCount++) { - if ((theIndex == -1 && aRefs->Value(a) == theReferenced) || theIndex == a) { + if ((theIndex == -1 && aRefs->Value(a) == theReferenced) || + theIndex == a) { aCount--; aResult = a; } else { @@ -267,9 +272,9 @@ static int RemoveFromRefArray(TDF_Label theArrayLab, TDF_Label theReferenced, return aResult; } -void Model_Objects::refsToFeature(FeaturePtr theFeature, - std::set >& theRefs, const bool isSendError) -{ +void Model_Objects::refsToFeature( + FeaturePtr theFeature, std::set> &theRefs, + const bool isSendError) { // check the feature: it must have no depended objects on it // the dependencies can be in the feature results std::list aResults; @@ -280,10 +285,12 @@ void Model_Objects::refsToFeature(FeaturePtr theFeature, std::shared_ptr aData = std::dynamic_pointer_cast(aResult->data()); if (aData.get() != NULL) { - const std::set& aRefs = aData->refsToMe(); - std::set::const_iterator aRefIt = aRefs.begin(), aRefLast = aRefs.end(); + const std::set &aRefs = aData->refsToMe(); + std::set::const_iterator aRefIt = aRefs.begin(), + aRefLast = aRefs.end(); for (; aRefIt != aRefLast; aRefIt++) { - FeaturePtr aFeature = std::dynamic_pointer_cast((*aRefIt)->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast((*aRefIt)->owner()); if (aFeature.get() != NULL) theRefs.insert(aFeature); } @@ -293,10 +300,12 @@ void Model_Objects::refsToFeature(FeaturePtr theFeature, std::shared_ptr aData = std::dynamic_pointer_cast(theFeature->data()); if (aData.get() && !aData->refsToMe().empty()) { - const std::set& aRefs = aData->refsToMe(); - std::set::const_iterator aRefIt = aRefs.begin(), aRefLast = aRefs.end(); + const std::set &aRefs = aData->refsToMe(); + std::set::const_iterator aRefIt = aRefs.begin(), + aRefLast = aRefs.end(); for (; aRefIt != aRefLast; aRefIt++) { - FeaturePtr aFeature = std::dynamic_pointer_cast((*aRefIt)->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast((*aRefIt)->owner()); if (aFeature.get() != NULL) theRefs.insert(aFeature); } @@ -304,30 +313,36 @@ void Model_Objects::refsToFeature(FeaturePtr theFeature, if (!theRefs.empty() && isSendError) { Events_InfoMessage("Model_Objects", - "Feature '%1' is used and can not be deleted").arg(theFeature->data()->name()).send(); + "Feature '%1' is used and can not be deleted") + .arg(theFeature->data()->name()) + .send(); } } -void Model_Objects::removeFeature(FeaturePtr theFeature) -{ - std::shared_ptr aData = std::static_pointer_cast(theFeature->data()); +void Model_Objects::removeFeature(FeaturePtr theFeature) { + std::shared_ptr aData = + std::static_pointer_cast(theFeature->data()); if (aData.get() && aData->isValid()) { - // checking that the sub-element of composite feature is removed: if yes, inform the owner - std::set > aRefs; + // checking that the sub-element of composite feature is removed: if yes, + // inform the owner + std::set> aRefs; refsToFeature(theFeature, aRefs, false); - std::set >::iterator aRefIter = aRefs.begin(); - for(; aRefIter != aRefs.end(); aRefIter++) { + std::set>::iterator aRefIter = + aRefs.begin(); + for (; aRefIter != aRefs.end(); aRefIter++) { std::shared_ptr aComposite = - std::dynamic_pointer_cast(*aRefIter); - if (aComposite.get() && aComposite->data()->isValid() && aComposite->isSub(theFeature)) { + std::dynamic_pointer_cast(*aRefIter); + if (aComposite.get() && aComposite->data()->isValid() && + aComposite->isSub(theFeature)) { aComposite->removeFeature(theFeature); } } // remove feature from folder removeFromFolder(std::list(1, theFeature)); - // this must be before erase since theFeature erasing removes all information about - // the feature results and groups of results - // To reproduce: create sketch, extrusion, remove sketch => constructions tree is not updated + // this must be before erase since theFeature erasing removes all + // information about the feature results and groups of results To reproduce: + // create sketch, extrusion, remove sketch => constructions tree is not + // updated clearHistory(theFeature); // erase fields theFeature->erase(); @@ -336,36 +351,37 @@ void Model_Objects::removeFeature(FeaturePtr theFeature) if (myFeatures.IsBound(aFeatureLabel)) myFeatures.UnBind(aFeatureLabel); - static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID EVENT_DISP = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP); // erase all attributes under the label of feature aFeatureLabel.ForgetAllAttributes(); // remove it from the references array RemoveFromRefArray(featuresLabel(), aFeatureLabel); // event: feature is deleted - ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), ModelAPI_Feature::group()); + ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), + ModelAPI_Feature::group()); updateHistory(ModelAPI_Feature::group()); } } -void Model_Objects::eraseAllFeatures() -{ - static Events_ID kDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* kCreator = ModelAPI_EventCreator::get(); +void Model_Objects::eraseAllFeatures() { + static Events_ID kDispEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator *kCreator = ModelAPI_EventCreator::get(); // make all features invalid (like deleted) NCollection_DataMap::Iterator aFIter(myFeatures); - for(; aFIter.More(); aFIter.Next()) { + for (; aFIter.More(); aFIter.Next()) { FeaturePtr aFeature = aFIter.Value(); std::list aResList; ModelAPI_Tools::allResults(aFeature, aResList); std::list::iterator aRIter = aResList.begin(); - for(; aRIter != aResList.end(); aRIter++) { + for (; aRIter != aResList.end(); aRIter++) { ResultPtr aRes = *aRIter; if (aRes && aRes->data()->isValid()) { kCreator->sendDeleted(myDoc, aRes->groupName()); kCreator->sendUpdated(aRes, kDispEvent); aRes->setData(aRes->data()->invalidPtr()); - } } kCreator->sendUpdated(aFeature, kDispEvent); @@ -376,25 +392,30 @@ void Model_Objects::eraseAllFeatures() myHistory.clear(); } -void Model_Objects::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis) -{ +void Model_Objects::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis) { TDF_Label aFeaturesLab = featuresLabel(); Handle(TDataStd_ReferenceArray) aRefs; if (!aFeaturesLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) return; - TDF_Label anAfterLab, aMovedLab = - std::dynamic_pointer_cast(theMoved->data())->label().Father(); + TDF_Label anAfterLab, + aMovedLab = std::dynamic_pointer_cast(theMoved->data()) + ->label() + .Father(); if (theAfterThis.get()) - anAfterLab = std::dynamic_pointer_cast(theAfterThis->data())->label().Father(); + anAfterLab = std::dynamic_pointer_cast(theAfterThis->data()) + ->label() + .Father(); - // check whether some folder refers to the moved feature by start or end: if yes, remove from it + // check whether some folder refers to the moved feature by start or end: if + // yes, remove from it removeFromFolder(std::list(1, theMoved)); Handle(TDataStd_HLabelArray1) aNewArray = - new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper()); + new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper()); int aPassedMovedFrom = 0; // the previous feature location is found and passed - int aPassedMovedTo = 0; // the feature is added and this location is passed - if (!theAfterThis.get()) { // null means that inserted feature must be the first + int aPassedMovedTo = 0; // the feature is added and this location is passed + if (!theAfterThis + .get()) { // null means that inserted feature must be the first aNewArray->SetValue(aRefs->Lower(), aMovedLab); aPassedMovedTo = 1; } @@ -408,15 +429,17 @@ void Model_Objects::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis) aPassedMovedFrom++; } else { // just copy one if (a - aPassedMovedFrom + aPassedMovedTo <= aRefs->Upper()) - aNewArray->SetValue(a - aPassedMovedFrom + aPassedMovedTo, aRefs->Value(a)); + aNewArray->SetValue(a - aPassedMovedFrom + aPassedMovedTo, + aRefs->Value(a)); } } - if (!aPassedMovedFrom || !aPassedMovedTo) {// not found: unknown situation + if (!aPassedMovedFrom || !aPassedMovedTo) { // not found: unknown situation if (!aPassedMovedFrom) { static std::string aMovedFromError("The moved feature is not found"); Events_InfoMessage("Model_Objects", aMovedFromError).send(); } else { - static std::string aMovedToError("The 'after' feature for movement is not found"); + static std::string aMovedToError( + "The 'after' feature for movement is not found"); Events_InfoMessage("Model_Objects", aMovedToError).send(); } return; @@ -426,33 +449,35 @@ void Model_Objects::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis) // update the feature and the history clearHistory(theMoved); // make sure all (selection) attributes of moved feature will be updated - static Events_ID kUpdateSelection = Events_Loop::loop()->eventByName(EVENT_UPDATE_SELECTION); + static Events_ID kUpdateSelection = + Events_Loop::loop()->eventByName(EVENT_UPDATE_SELECTION); ModelAPI_EventCreator::get()->sendUpdated(theMoved, kUpdateSelection, false); ModelAPI_EventCreator::get()->sendReordered(theMoved); } -void Model_Objects::clearHistory(ObjectPtr theObj) -{ +void Model_Objects::clearHistory(ObjectPtr theObj) { if (theObj.get()) { const std::string aGroup = theObj->groupName(); updateHistory(aGroup); - if (theObj->groupName() == ModelAPI_Feature::group()) { // clear results group of the feature + if (theObj->groupName() == + ModelAPI_Feature::group()) { // clear results group of the feature FeaturePtr aFeature = std::dynamic_pointer_cast(theObj); std::string aResultGroup = featureResultGroup(aFeature); if (!aResultGroup.empty()) { - std::map >::iterator aHIter = - myHistory.find(aResultGroup); + std::map>::iterator aHIter = + myHistory.find(aResultGroup); if (aHIter != myHistory.end()) - myHistory.erase(aHIter); // erase from map => this means that it is not synchronized + myHistory.erase(aHIter); // erase from map => this means that it is + // not synchronized } } } } -void Model_Objects::createHistory(const std::string& theGroupID) -{ - std::map >::iterator aHIter = myHistory.find(theGroupID); +void Model_Objects::createHistory(const std::string &theGroupID) { + std::map>::iterator aHIter = + myHistory.find(theGroupID); if (aHIter == myHistory.end()) { std::vector aResult; std::vector aResultOutOfFolder; @@ -461,8 +486,9 @@ void Model_Objects::createHistory(const std::string& theGroupID) bool isFeature = theGroupID == ModelAPI_Feature::group(); bool isFolder = theGroupID == ModelAPI_Folder::group(); Handle(TDataStd_ReferenceArray) aRefs; - if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { + if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), + aRefs)) { + for (int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { FeaturePtr aFeature = feature(aRefs->Value(a)); if (aFeature.get()) { // if feature is in sub-component, remove it from history: @@ -475,30 +501,36 @@ void Model_Objects::createHistory(const std::string& theGroupID) if (aLastFeatureInFolder.get() == NULL) aResultOutOfFolder.push_back(aFeature); } - } else if (!aFeature->isDisabled()) { // iterate all results of not-disabled feature + } else if (!aFeature->isDisabled()) { // iterate all results of + // not-disabled feature // construction results of sub-features should not be in the tree if (!isSub || theGroupID != ModelAPI_ResultConstruction::group()) { - // do not use reference to the list here since results can be changed by "isConcealed" - const std::list > aResults = aFeature->results(); - std::list >::const_iterator - aRIter = aResults.begin(); + // do not use reference to the list here since results can be + // changed by "isConcealed" + const std::list> aResults = + aFeature->results(); + std::list>::const_iterator + aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; - if (aRes->groupName() != theGroupID) break; // feature have only same group results - if (!aRes->isDisabled() && aRes->isInHistory() && !aRes->isConcealed()) { + if (aRes->groupName() != theGroupID) + break; // feature have only same group results + if (!aRes->isDisabled() && aRes->isInHistory() && + !aRes->isConcealed()) { aResult.push_back(*aRIter); } } } } - // the feature closes the folder, so the next features will be treated as out-of-folder + // the feature closes the folder, so the next features will be treated + // as out-of-folder if (aLastFeatureInFolder.get() && aLastFeatureInFolder == aFeature) aLastFeatureInFolder = FeaturePtr(); } else { // it may be a folder - const ObjectPtr& aFolder = folder(aRefs->Value(a)); + const ObjectPtr &aFolder = folder(aRefs->Value(a)); if (aFolder.get()) { // store folder information for the Features group only if (isFeature || isFolder) { @@ -511,65 +543,69 @@ void Model_Objects::createHistory(const std::string& theGroupID) AttributeReferencePtr aLastFeatAttr = aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID()); if (aLastFeatAttr) - aLastFeatureInFolder = ModelAPI_Feature::feature(aLastFeatAttr->value()); + aLastFeatureInFolder = + ModelAPI_Feature::feature(aLastFeatAttr->value()); } } } } - // to be sure that isConcealed did not update the history (issue 1089) during the iteration + // to be sure that isConcealed did not update the history (issue 1089) + // during the iteration if (myHistory.find(theGroupID) == myHistory.end()) { myHistory[theGroupID] = aResult; // store the features placed out of any folder - const std::string& anOutOfFolderGroupID = groupNameFoldering(theGroupID, true); + const std::string &anOutOfFolderGroupID = + groupNameFoldering(theGroupID, true); if (!anOutOfFolderGroupID.empty()) myHistory[anOutOfFolderGroupID] = aResultOutOfFolder; } } } -void Model_Objects::updateHistory(const std::shared_ptr theObject) -{ +void Model_Objects::updateHistory( + const std::shared_ptr theObject) { clearHistory(theObject); } -void Model_Objects::updateHistory(const std::string theGroup) -{ - std::map >::iterator aHIter = myHistory.find(theGroup); +void Model_Objects::updateHistory(const std::string theGroup) { + std::map>::iterator aHIter = + myHistory.find(theGroup); if (aHIter != myHistory.end()) { - myHistory.erase(aHIter); // erase from map => this means that it is not synchronized + myHistory.erase( + aHIter); // erase from map => this means that it is not synchronized // erase history for the group of objects placed out of any folder - const std::string& anOutOfFolderGroupID = groupNameFoldering(theGroup, true); + const std::string &anOutOfFolderGroupID = + groupNameFoldering(theGroup, true); if (!anOutOfFolderGroupID.empty()) myHistory.erase(anOutOfFolderGroupID); } } -const ObjectPtr& Model_Objects::folder(TDF_Label theLabel) const -{ +const ObjectPtr &Model_Objects::folder(TDF_Label theLabel) const { if (myFolders.IsBound(theLabel)) return myFolders.Find(theLabel); static ObjectPtr anEmptyResult; return anEmptyResult; } -FeaturePtr Model_Objects::feature(TDF_Label theLabel) const -{ +FeaturePtr Model_Objects::feature(TDF_Label theLabel) const { if (myFeatures.IsBound(theLabel)) return myFeatures.Find(theLabel); - return FeaturePtr(); // not found + return FeaturePtr(); // not found } -ObjectPtr Model_Objects::object(TDF_Label theLabel) -{ +ObjectPtr Model_Objects::object(TDF_Label theLabel) { // try feature by label FeaturePtr aFeature = feature(theLabel); if (aFeature.get()) return feature(theLabel); - TDF_Label aFeatureLabel = theLabel; // let's suppose it is result of this feature - TDF_LabelList aSubLabs; // sub - labels from higher level to lower level of result - while(!aFeature.get() && aFeatureLabel.Depth() > 1) { + TDF_Label aFeatureLabel = + theLabel; // let's suppose it is result of this feature + TDF_LabelList + aSubLabs; // sub - labels from higher level to lower level of result + while (!aFeature.get() && aFeatureLabel.Depth() > 1) { aSubLabs.Prepend(aFeatureLabel); aFeatureLabel = aFeatureLabel.Father().Father(); aFeature = feature(aFeatureLabel); @@ -577,18 +613,20 @@ ObjectPtr Model_Objects::object(TDF_Label theLabel) if (aFeature.get()) { ResultPtr aCurrentResult; // searching for results then sub-results label by label - for(TDF_ListIteratorOfLabelList aSubLab(aSubLabs); aSubLab.More(); aSubLab.Next()) { + for (TDF_ListIteratorOfLabelList aSubLab(aSubLabs); aSubLab.More(); + aSubLab.Next()) { if (aCurrentResult.get()) { // iterate sub-results of result - ResultBodyPtr anOwner = std::dynamic_pointer_cast(aCurrentResult); + ResultBodyPtr anOwner = + std::dynamic_pointer_cast(aCurrentResult); if (!anOwner) return ObjectPtr(); // only Body can have sub-results int a, aNumSubs = anOwner->numberOfSubs(); - for(a = 0; a < aNumSubs; a++) { + for (a = 0; a < aNumSubs; a++) { ResultPtr aSub = anOwner->subResult(a); if (aSub.get()) { - std::shared_ptr aSubData = std::dynamic_pointer_cast( - aSub->data()); - const TDF_Label& aSubLabVal = aSubLab.ChangeValue(); + std::shared_ptr aSubData = + std::dynamic_pointer_cast(aSub->data()); + const TDF_Label &aSubLabVal = aSubLab.ChangeValue(); if (aSubData->label().Father().IsEqual(aSubLabVal)) { aCurrentResult = aSub; break; @@ -598,56 +636,61 @@ ObjectPtr Model_Objects::object(TDF_Label theLabel) if (a == aNumSubs) // not found an appropriate sub-result of result return ObjectPtr(); } else { // iterate results of feature - const std::list& aResults = aFeature->results(); - std::list >::const_iterator aRIter = aResults.cbegin(); - for(; aRIter != aResults.cend(); aRIter++) { + const std::list &aResults = aFeature->results(); + std::list>::const_iterator aRIter = + aResults.cbegin(); + for (; aRIter != aResults.cend(); aRIter++) { std::shared_ptr aResData = - std::dynamic_pointer_cast((*aRIter)->data()); + std::dynamic_pointer_cast((*aRIter)->data()); if (aResData->label().Father().IsEqual(aSubLab.ChangeValue())) { aCurrentResult = *aRIter; break; } } - if (aRIter == aResults.cend()) // not found an appropriate result of feature + if (aRIter == + aResults.cend()) // not found an appropriate result of feature return ObjectPtr(); } } return aCurrentResult; } - return ObjectPtr(); // not found + return ObjectPtr(); // not found } -ObjectPtr Model_Objects::object(const std::string& theGroupID, - const int theIndex, - const bool theAllowFolder) -{ +ObjectPtr Model_Objects::object(const std::string &theGroupID, + const int theIndex, const bool theAllowFolder) { if (theIndex == -1) return ObjectPtr(); createHistory(theGroupID); - const std::string& aGroupID = groupNameFoldering(theGroupID, theAllowFolder); - return aGroupID.empty() ? myHistory[theGroupID][theIndex] : myHistory[aGroupID][theIndex]; + const std::string &aGroupID = groupNameFoldering(theGroupID, theAllowFolder); + return aGroupID.empty() ? myHistory[theGroupID][theIndex] + : myHistory[aGroupID][theIndex]; } -std::shared_ptr Model_Objects::objectByName( - const std::string& theGroupID, const std::wstring& theName) -{ +std::shared_ptr +Model_Objects::objectByName(const std::string &theGroupID, + const std::wstring &theName) { createHistory(theGroupID); - if (theGroupID == ModelAPI_Feature::group()) { // searching among features (in history or not) - std::list > allObjs = allFeatures(); + if (theGroupID == ModelAPI_Feature::group()) { // searching among features (in + // history or not) + std::list> allObjs = allFeatures(); // from the end to find the latest result with such name - std::list >::reverse_iterator anObjIter = allObjs.rbegin(); - for(; anObjIter != allObjs.rend(); anObjIter++) { + std::list>::reverse_iterator anObjIter = + allObjs.rbegin(); + for (; anObjIter != allObjs.rend(); anObjIter++) { if ((*anObjIter)->data()->name() == theName) return *anObjIter; } } else { // searching among results (concealed or not) - std::list > allObjs = allFeatures(); + std::list> allObjs = allFeatures(); // from the end to find the latest result with such name - std::list >::reverse_iterator anObjIter = allObjs.rbegin(); - for(; anObjIter != allObjs.rend(); anObjIter++) { + std::list>::reverse_iterator anObjIter = + allObjs.rbegin(); + for (; anObjIter != allObjs.rend(); anObjIter++) { std::list allRes; ModelAPI_Tools::allResults(*anObjIter, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { if (aRes->get() && (*aRes)->groupName() == theGroupID) { if ((*aRes)->data()->name() == theName) return *aRes; @@ -660,8 +703,7 @@ std::shared_ptr Model_Objects::objectByName( } const int Model_Objects::index(std::shared_ptr theObject, - const bool theAllowFolder) -{ + const bool theAllowFolder) { std::string aGroup = theObject->groupName(); // treat folder as feature if (aGroup == ModelAPI_Folder::group()) @@ -672,9 +714,10 @@ const int Model_Objects::index(std::shared_ptr theObject, if (theAllowFolder && !groupNameFoldering(aGroup, theAllowFolder).empty()) aGroup = groupNameFoldering(aGroup, theAllowFolder); - std::vector& allObjs = myHistory[aGroup]; - std::vector::iterator anObjIter = allObjs.begin(); // iterate to search object - for(int anIndex = 0; anObjIter != allObjs.end(); anObjIter++, anIndex++) { + std::vector &allObjs = myHistory[aGroup]; + std::vector::iterator anObjIter = + allObjs.begin(); // iterate to search object + for (int anIndex = 0; anObjIter != allObjs.end(); anObjIter++, anIndex++) { if ((*anObjIter) == theObject) return anIndex; } @@ -682,18 +725,19 @@ const int Model_Objects::index(std::shared_ptr theObject, return -1; } -int Model_Objects::size(const std::string& theGroupID, const bool theAllowFolder) -{ +int Model_Objects::size(const std::string &theGroupID, + const bool theAllowFolder) { createHistory(theGroupID); - const std::string& aGroupID = groupNameFoldering(theGroupID, theAllowFolder); - return aGroupID.empty() ? int(myHistory[theGroupID].size()) : int(myHistory[aGroupID].size()); + const std::string &aGroupID = groupNameFoldering(theGroupID, theAllowFolder); + return aGroupID.empty() ? int(myHistory[theGroupID].size()) + : int(myHistory[aGroupID].size()); } -std::shared_ptr Model_Objects::parent( - const std::shared_ptr theChild) -{ +std::shared_ptr +Model_Objects::parent(const std::shared_ptr theChild) { if (theChild.get()) { - std::shared_ptr aData = std::dynamic_pointer_cast(theChild->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theChild->data()); TDF_Label aLab = aData->label(); if (!aLab.IsNull() && aLab.Depth() > 2) { ObjectPtr anObj = object(aLab.Father().Father().Father()); @@ -703,23 +747,26 @@ std::shared_ptr Model_Objects::parent( return ObjectPtr(); } - -void Model_Objects::allResults(const std::string& theGroupID, std::list& theResults) -{ +void Model_Objects::allResults(const std::string &theGroupID, + std::list &theResults) { // iterate the array of references and get feature by feature from the array Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { + for (int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { FeaturePtr aFeature = feature(aRefs->Value(a)); if (aFeature.get()) { - const std::list >& aResults = aFeature->results(); - std::list >::const_iterator aRIter = aResults.begin(); + const std::list> &aResults = + aFeature->results(); + std::list>::const_iterator aRIter = + aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; - if (aRes->groupName() != theGroupID) break; // feature have only same group results - // iterate also concealed: ALL RESULTS (for translation parts undo/redo management) - //if (aRes->isInHistory() && !aRes->isConcealed()) { - theResults.push_back(*aRIter); + if (aRes->groupName() != theGroupID) + break; // feature have only same group results + // iterate also concealed: ALL RESULTS (for translation parts + // undo/redo management) + // if (aRes->isInHistory() && !aRes->isConcealed()) { + theResults.push_back(*aRIter); //} } } @@ -727,24 +774,21 @@ void Model_Objects::allResults(const std::string& theGroupID, std::listdata()->name().empty()) - return; // not needed, name is already defined - std::wstring aName; // result + return; // not needed, name is already defined + std::wstring aName; // result // first count all features of such kind to start with index = count + 1 int aNumObjects = -1; // this feature is already in this map NCollection_DataMap::Iterator aFIter(myFeatures); @@ -757,14 +801,13 @@ void Model_Objects::setUniqueName(FeaturePtr theFeature) // generate candidate name aName = composeName(theFeature->getKind(), aNumObjects + 1); // check this is unique, if not, increase index by 1 - for(aNumObjects++; allNames.find(aName) != allNames.end(); aNumObjects++) { + for (aNumObjects++; allNames.find(aName) != allNames.end(); aNumObjects++) { aName = composeName(theFeature->getKind(), aNumObjects + 1); } theFeature->data()->setName(aName); } -void Model_Objects::setUniqueName(FolderPtr theFolder) -{ +void Model_Objects::setUniqueName(FolderPtr theFolder) { if (!theFolder->name().empty()) return; // name is already defined @@ -785,8 +828,8 @@ void Model_Objects::setUniqueName(FolderPtr theFolder) theFolder->data()->setName(aName); } -void Model_Objects::initData(ObjectPtr theObj, TDF_Label theLab, const int theTag) -{ +void Model_Objects::initData(ObjectPtr theObj, TDF_Label theLab, + const int theTag) { std::shared_ptr aData(new Model_Data); aData->setLabel(theLab.FindChild(theTag)); aData->setObject(theObj); @@ -794,8 +837,9 @@ void Model_Objects::initData(ObjectPtr theObj, TDF_Label theLab, const int theTa theObj->setData(aData); FeaturePtr aFeature = std::dynamic_pointer_cast(theObj); if (aFeature.get()) { - setUniqueName(aFeature); // must be before "initAttributes" because duplicate part uses name - } else { // is it a folder? + setUniqueName(aFeature); // must be before "initAttributes" because + // duplicate part uses name + } else { // is it a folder? FolderPtr aFolder = std::dynamic_pointer_cast(theObj); if (aFolder) setUniqueName(aFolder); @@ -803,16 +847,21 @@ void Model_Objects::initData(ObjectPtr theObj, TDF_Label theLab, const int theTa theObj->initAttributes(); } -void Model_Objects::synchronizeFeatures( - const TDF_LabelList& theUpdated, const bool theUpdateReferences, - const bool theExecuteFeatures, const bool theOpen, const bool theFlush) -{ - Model_Document* anOwner = std::dynamic_pointer_cast(myDoc).get(); - if (!anOwner) // this may happen on creation of document: nothing there, so nothing to synchronize +void Model_Objects::synchronizeFeatures(const TDF_LabelList &theUpdated, + const bool theUpdateReferences, + const bool theExecuteFeatures, + const bool theOpen, + const bool theFlush) { + Model_Document *anOwner = + std::dynamic_pointer_cast(myDoc).get(); + if (!anOwner) // this may happen on creation of document: nothing there, so + // nothing to synchronize return; - // after all updates, sends a message that groups of features were created or updated - Events_Loop* aLoop = Events_Loop::loop(); - //static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + // after all updates, sends a message that groups of features were created or + // updated + Events_Loop *aLoop = Events_Loop::loop(); + // static Events_ID aDispEvent = + // aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); static Events_ID aCreateEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); @@ -823,9 +872,9 @@ void Model_Objects::synchronizeFeatures( // collect all updated labels map TDF_LabelMap anUpdatedMap; TDF_ListIteratorOfLabelList anUpdatedIter(theUpdated); - for(; anUpdatedIter.More(); anUpdatedIter.Next()) { - TDF_Label& aFeatureLab = anUpdatedIter.Value(); - while(aFeatureLab.Depth() > 3) + for (; anUpdatedIter.More(); anUpdatedIter.Next()) { + TDF_Label &aFeatureLab = anUpdatedIter.Value(); + while (aFeatureLab.Depth() > 3) aFeatureLab = aFeatureLab.Father(); if (myFeatures.IsBound(aFeatureLab) || myFolders.IsBound(aFeatureLab)) anUpdatedMap.Add(aFeatureLab); @@ -836,22 +885,29 @@ void Model_Objects::synchronizeFeatures( TDF_ChildIDIterator aLabIter(featuresLabel(), TDataStd_Comment::GetID()); for (; aLabIter.More(); aLabIter.Next()) { TDF_Label aFeatureLabel = aLabIter.Value()->Label(); - if (!myFeatures.IsBound(aFeatureLabel) && !myFolders.IsBound(aFeatureLabel)) { + if (!myFeatures.IsBound(aFeatureLabel) && + !myFolders.IsBound(aFeatureLabel)) { // a new feature or folder is inserted - std::string aFeatureID = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast( - aLabIter.Value())->Get()).ToCString(); + std::string aFeatureID = + TCollection_AsciiString( + Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get()) + .ToCString(); bool isFolder = aFeatureID == ModelAPI_Folder::ID(); std::shared_ptr aSession = std::dynamic_pointer_cast(ModelAPI_Session::get()); // create a feature - ObjectPtr aFeature = isFolder ? ObjectPtr(new ModelAPI_Folder) - : ObjectPtr(aSession->createFeature(aFeatureID, anOwner)); + ObjectPtr aFeature = + isFolder ? ObjectPtr(new ModelAPI_Folder) + : ObjectPtr(aSession->createFeature(aFeatureID, anOwner)); if (!aFeature.get()) { - // something is wrong, most probably, the opened document has invalid structure - Events_InfoMessage("Model_Objects", "Invalid type of object in the document").send(); + // something is wrong, most probably, the opened document has invalid + // structure + Events_InfoMessage("Model_Objects", + "Invalid type of object in the document") + .send(); aLabIter.Value()->Label().ForgetAllAttributes(); continue; } @@ -860,43 +916,49 @@ void Model_Objects::synchronizeFeatures( if (isFolder) myFolders.Bind(aFeatureLabel, aFeature); else - myFeatures.Bind(aFeatureLabel, std::dynamic_pointer_cast(aFeature)); + myFeatures.Bind(aFeatureLabel, + std::dynamic_pointer_cast(aFeature)); aNewFeatures.insert(aFeature); initData(aFeature, aFeatureLabel, TAG_FEATURE_ARGUMENTS); updateHistory(aFeature); // event: model is updated ModelAPI_EventCreator::get()->sendUpdated(aFeature, aCreateEvent); - } else { // nothing is changed, both iterators are incremented + } else { // nothing is changed, both iterators are incremented ObjectPtr anObject; FeaturePtr aFeature; if (myFeatures.Find(aFeatureLabel, aFeature)) { aKeptFeatures.insert(aFeature); anObject = aFeature; - } else - if (myFolders.Find(aFeatureLabel, anObject)) - aKeptFeatures.insert(anObject); + } else if (myFolders.Find(aFeatureLabel, anObject)) + aKeptFeatures.insert(anObject); if (anUpdatedMap.Contains(aFeatureLabel)) { - if (!theOpen) { // on abort/undo/redo reinitialize attributes if something is changed - FiltersFeaturePtr aFilter = std::dynamic_pointer_cast(anObject); - if (aFilter.get()) { // for filters attributes may be added/removed on undo/redo - std::dynamic_pointer_cast(aFilter->data())->clearAttributes(); + if (!theOpen) { // on abort/undo/redo reinitialize attributes if + // something is changed + FiltersFeaturePtr aFilter = + std::dynamic_pointer_cast(anObject); + if (aFilter.get()) { // for filters attributes may be added/removed on + // undo/redo + std::dynamic_pointer_cast(aFilter->data()) + ->clearAttributes(); aFilter->initAttributes(); } else { - std::list > anAttrs = - anObject->data()->attributes(""); - std::list >::iterator anAttr = anAttrs.begin(); - for(; anAttr != anAttrs.end(); anAttr++) + std::list> anAttrs = + anObject->data()->attributes(""); + std::list>::iterator anAttr = + anAttrs.begin(); + for (; anAttr != anAttrs.end(); anAttr++) (*anAttr)->reinit(); // if feature contains results, re-init them too if (aFeature.get()) { std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); std::list::iterator aResIter = aResults.begin(); - for(; aResIter != aResults.end(); aResIter++) { + for (; aResIter != aResults.end(); aResIter++) { anAttrs = (*aResIter)->data()->attributes(""); - for(anAttr = anAttrs.begin(); anAttr != anAttrs.end(); anAttr++) + for (anAttr = anAttrs.begin(); anAttr != anAttrs.end(); + anAttr++) (*anAttr)->reinit(); } } @@ -905,8 +967,10 @@ void Model_Objects::synchronizeFeatures( ModelAPI_EventCreator::get()->sendUpdated(anObject, anUpdateEvent); if (aFeature && aFeature->getKind() == "Parameter") { // if parameters are changed, update the results (issue 937) - const std::list >& aResults = aFeature->results(); - std::list >::const_iterator aRIter = aResults.begin(); + const std::list> &aResults = + aFeature->results(); + std::list>::const_iterator aRIter = + aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { std::shared_ptr aRes = *aRIter; if (aRes->data()->isValid() && !aRes->isDisabled()) { @@ -921,24 +985,26 @@ void Model_Objects::synchronizeFeatures( // check all features are checked: if not => it was removed NCollection_DataMap::Iterator aFIter(myFeatures); while (aFIter.More()) { - if (aKeptFeatures.find(aFIter.Value()) == aKeptFeatures.end() - && aNewFeatures.find(aFIter.Value()) == aNewFeatures.end()) { - FeaturePtr aFeature = aFIter.Value(); - // event: model is updated - //if (aFeature->isInHistory()) { - ModelAPI_EventCreator::get()->sendDeleted(myDoc, ModelAPI_Feature::group()); - //} - // results of this feature must be redisplayed (hided) - // redisplay also removed feature (used for sketch and AISObject) - ModelAPI_EventCreator::get()->sendUpdated(aFeature, aRedispEvent); - updateHistory(aFeature); - aFeature->erase(); - - // unbind after the "erase" call: on abort sketch - // is removes sub-objects that corrupts aFIter - myFeatures.UnBind(aFIter.Key()); - // reinitialize iterator because unbind may corrupt the previous order in the map - aFIter.Initialize(myFeatures); + if (aKeptFeatures.find(aFIter.Value()) == aKeptFeatures.end() && + aNewFeatures.find(aFIter.Value()) == aNewFeatures.end()) { + FeaturePtr aFeature = aFIter.Value(); + // event: model is updated + // if (aFeature->isInHistory()) { + ModelAPI_EventCreator::get()->sendDeleted(myDoc, + ModelAPI_Feature::group()); + //} + // results of this feature must be redisplayed (hided) + // redisplay also removed feature (used for sketch and AISObject) + ModelAPI_EventCreator::get()->sendUpdated(aFeature, aRedispEvent); + updateHistory(aFeature); + aFeature->erase(); + + // unbind after the "erase" call: on abort sketch + // is removes sub-objects that corrupts aFIter + myFeatures.UnBind(aFIter.Key()); + // reinitialize iterator because unbind may corrupt the previous order in + // the map + aFIter.Initialize(myFeatures); } else aFIter.Next(); } @@ -948,7 +1014,8 @@ void Model_Objects::synchronizeFeatures( ObjectPtr aCurObj = aFldIt.Value(); if (aKeptFeatures.find(aCurObj) == aKeptFeatures.end() && aNewFeatures.find(aCurObj) == aNewFeatures.end()) { - ModelAPI_EventCreator::get()->sendDeleted(myDoc, ModelAPI_Folder::group()); + ModelAPI_EventCreator::get()->sendDeleted(myDoc, + ModelAPI_Folder::group()); // results of this feature must be redisplayed (hided) // redisplay also removed feature (used for sketch and AISObject) ModelAPI_EventCreator::get()->sendUpdated(aCurObj, aRedispEvent); @@ -958,7 +1025,8 @@ void Model_Objects::synchronizeFeatures( // unbind after the "erase" call: on abort sketch // is removes sub-objects that corrupts aFIter myFolders.UnBind(aFldIt.Key()); - // reinitialize iterator because unbind may corrupt the previous order in the map + // reinitialize iterator because unbind may corrupt the previous order in + // the map aFldIt.Initialize(myFolders); } } @@ -970,11 +1038,12 @@ void Model_Objects::synchronizeFeatures( // they may be connected, like sketch and sub elements) // After synchronization of back references because sketch // must be set in sub-elements before "execute" by updateResults - std::set aProcessed; // composites must be updated after their subs (issue 360) + std::set + aProcessed; // composites must be updated after their subs (issue 360) TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID()); for (; aLabIter2.More(); aLabIter2.Next()) { TDF_Label aFeatureLabel = aLabIter2.Value()->Label(); - if (myFeatures.IsBound(aFeatureLabel)) { // a new feature is inserted + if (myFeatures.IsBound(aFeatureLabel)) { // a new feature is inserted FeaturePtr aFeature = myFeatures.Find(aFeatureLabel); updateResults(aFeature, aProcessed); } @@ -998,7 +1067,8 @@ void Model_Objects::synchronizeFeatures( // delete should be emitted before create to reacts to aborted feature aLoop->flush(aCreateEvent); aLoop->flush(anUpdateEvent); - aLoop->flush(aCreateEvent); // after update of features, there could be results created + aLoop->flush(aCreateEvent); // after update of features, there could be + // results created aLoop->flush(aDeleteEvent); // or deleted aLoop->flush(aRedispEvent); aLoop->flush(aToHideEvent); @@ -1007,49 +1077,58 @@ void Model_Objects::synchronizeFeatures( anOwner->setExecuteFeatures(true); } -/// synchronizes back references for the given object basing on the collected data -void Model_Objects::synchronizeBackRefsForObject(const std::set& theNewRefs, - ObjectPtr theObject) -{ +/// synchronizes back references for the given object basing on the collected +/// data +void Model_Objects::synchronizeBackRefsForObject( + const std::set &theNewRefs, ObjectPtr theObject) { if (!theObject.get() || !theObject->data()->isValid()) return; // invalid - std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(theObject->data()); // iterate new list to compare with current std::set::iterator aNewIter = theNewRefs.begin(); - for(; aNewIter != theNewRefs.end(); aNewIter++) { + for (; aNewIter != theNewRefs.end(); aNewIter++) { // for the Model_AttributeRefList erase cash (issue #2819) std::shared_ptr aRefList = - std::dynamic_pointer_cast(*aNewIter); + std::dynamic_pointer_cast(*aNewIter); if (aRefList) aRefList->eraseHash(); if (aData->refsToMe().find(*aNewIter) == aData->refsToMe().end()) { - FeaturePtr aRefFeat = std::dynamic_pointer_cast((*aNewIter)->owner()); + FeaturePtr aRefFeat = + std::dynamic_pointer_cast((*aNewIter)->owner()); if (aRefFeat) aData->addBackReference(aRefFeat, (*aNewIter)->id()); else // add back reference to a folder aData->addBackReference((*aNewIter)->owner(), (*aNewIter)->id()); } } - if (theNewRefs.size() != aData->refsToMe().size()) { // some back ref must be removed + if (theNewRefs.size() != + aData->refsToMe().size()) { // some back ref must be removed std::set::iterator aCurrentIter = aData->refsToMe().begin(); - while(aCurrentIter != aData->refsToMe().end()) { + while (aCurrentIter != aData->refsToMe().end()) { if (theNewRefs.find(*aCurrentIter) == theNewRefs.end()) { // for external references from other documents this system // is not working: refs are collected from // different Model_Objects, so before remove check this // external object exists and still referenced bool aLeaveIt = false; - if ((*aCurrentIter)->owner().get() && (*aCurrentIter)->owner()->document() != myDoc && - (*aCurrentIter)->owner()->data().get() && (*aCurrentIter)->owner()->data()->isValid()) { - std::list > > > aRefs; + if ((*aCurrentIter)->owner().get() && + (*aCurrentIter)->owner()->document() != myDoc && + (*aCurrentIter)->owner()->data().get() && + (*aCurrentIter)->owner()->data()->isValid()) { + std::list>>> + aRefs; (*aCurrentIter)->owner()->data()->referencesToObjects(aRefs); - std::list >>>::iterator - aRefIter = aRefs.begin(); - for(; aRefIter != aRefs.end(); aRefIter++) { + std::list>>>:: + iterator aRefIter = aRefs.begin(); + for (; aRefIter != aRefs.end(); aRefIter++) { if ((*aCurrentIter)->id() == aRefIter->first) { - std::list >::iterator anOIt; - for(anOIt = aRefIter->second.begin(); anOIt != aRefIter->second.end(); anOIt++) { + std::list>::iterator anOIt; + for (anOIt = aRefIter->second.begin(); + anOIt != aRefIter->second.end(); anOIt++) { if (*anOIt == theObject) { aLeaveIt = true; } @@ -1059,14 +1138,17 @@ void Model_Objects::synchronizeBackRefsForObject(const std::set& t } if (!aLeaveIt) { aData->removeBackReference(*aCurrentIter); - aCurrentIter = aData->refsToMe().begin(); // reinitialize iteration after delete - } else aCurrentIter++; - } else aCurrentIter++; + aCurrentIter = + aData->refsToMe().begin(); // reinitialize iteration after delete + } else + aCurrentIter++; + } else + aCurrentIter++; } } // for the last feature in the folder, check if it is a sub-feature, // then refer the folder to a top-level parent composite feature - const std::set& aRefs = aData->refsToMe(); + const std::set &aRefs = aData->refsToMe(); std::set::iterator anIt = aRefs.begin(); for (; anIt != aRefs.end(); ++anIt) if ((*anIt)->id() == ModelAPI_Folder::LAST_FEATURE_ID()) @@ -1075,7 +1157,8 @@ void Model_Objects::synchronizeBackRefsForObject(const std::set& t FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature) { CompositeFeaturePtr aParent; - CompositeFeaturePtr aGrandParent = ModelAPI_Tools::compositeOwner(aFeature); + CompositeFeaturePtr aGrandParent = + ModelAPI_Tools::compositeOwner(aFeature); do { aParent = aGrandParent; if (aGrandParent) @@ -1086,28 +1169,33 @@ void Model_Objects::synchronizeBackRefsForObject(const std::set& t // remove reference from the current feature aData->removeBackReference(aFolder, ModelAPI_Folder::LAST_FEATURE_ID()); // set reference to a top-level parent - aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID())->setValue(aParent); + aFolder->data() + ->reference(ModelAPI_Folder::LAST_FEATURE_ID()) + ->setValue(aParent); std::shared_ptr aParentData = std::dynamic_pointer_cast(aParent->data()); - aParentData->addBackReference(aFolder, ModelAPI_Folder::LAST_FEATURE_ID()); + aParentData->addBackReference(aFolder, + ModelAPI_Folder::LAST_FEATURE_ID()); } } } aData->updateConcealmentFlag(); } -static void collectReferences(std::shared_ptr theData, - std::map >& theRefs) -{ +static void +collectReferences(std::shared_ptr theData, + std::map> &theRefs) { if (theData.get()) { - std::list > > aRefs; + std::list>> aRefs; theData->referencesToObjects(aRefs); - std::list > >::iterator aRefsIt = aRefs.begin(); - for(; aRefsIt != aRefs.end(); aRefsIt++) { + std::list>>::iterator aRefsIt = + aRefs.begin(); + for (; aRefsIt != aRefs.end(); aRefsIt++) { std::list::iterator aRefTo = aRefsIt->second.begin(); - for(; aRefTo != aRefsIt->second.end(); aRefTo++) { + for (; aRefTo != aRefsIt->second.end(); aRefTo++) { if (*aRefTo) { - std::map >::iterator aFound = theRefs.find(*aRefTo); + std::map>::iterator aFound = + theRefs.find(*aRefTo); if (aFound == theRefs.end()) { theRefs[*aRefTo] = std::set(); aFound = theRefs.find(*aRefTo); @@ -1119,28 +1207,30 @@ static void collectReferences(std::shared_ptr theData, } } -void Model_Objects::synchronizeBackRefs() -{ - // collect all back references in the separated container: to update everything at once, - // without additional Concealment switching on and off: only the final modification +void Model_Objects::synchronizeBackRefs() { + // collect all back references in the separated container: to update + // everything at once, without additional Concealment switching on and off: + // only the final modification // referenced (slave) objects to referencing attributes - std::map > allRefs; + std::map> allRefs; NCollection_DataMap::Iterator aFeatures(myFeatures); - for(; aFeatures.More(); aFeatures.Next()) { + for (; aFeatures.More(); aFeatures.Next()) { FeaturePtr aFeature = aFeatures.Value(); collectReferences(aFeature->data(), allRefs); } NCollection_DataMap::Iterator aFolders(myFolders); - for(; aFolders.More(); aFolders.Next()) { + for (; aFolders.More(); aFolders.Next()) { ObjectPtr aFolder = aFolders.Value(); collectReferences(aFolder->data(), allRefs); } - // second iteration: just compare back-references with existing in features and results - for(aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) { + // second iteration: just compare back-references with existing in features + // and results + for (aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) { FeaturePtr aFeature = aFeatures.Value(); static std::set anEmpty; - std::map >::iterator aFound = allRefs.find(aFeature); + std::map>::iterator aFound = + allRefs.find(aFeature); if (aFound == allRefs.end()) { // not found => erase all back references synchronizeBackRefsForObject(anEmpty, aFeature); } else { @@ -1151,7 +1241,7 @@ void Model_Objects::synchronizeBackRefs() std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); std::list::iterator aRIter = aResults.begin(); - for(; aRIter != aResults.cend(); aRIter++) { + for (; aRIter != aResults.cend(); aRIter++) { aFound = allRefs.find(*aRIter); if (aFound == allRefs.end()) { // not found => erase all back references synchronizeBackRefsForObject(anEmpty, *aRIter); @@ -1161,50 +1251,58 @@ void Model_Objects::synchronizeBackRefs() } } } - for(aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) { + for (aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) { FeaturePtr aFeature = aFeatures.Value(); std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); // update the concealment status for display in isConcealed of ResultBody std::list::iterator aRIter = aResults.begin(); - for(; aRIter != aResults.cend(); aRIter++) { + for (; aRIter != aResults.cend(); aRIter++) { (*aRIter)->isConcealed(); } } - // the rest all refs means that feature references to the external document feature: - // process also them - std::map >::iterator anExtIter = allRefs.begin(); - for(; anExtIter != allRefs.end(); anExtIter++) { + // the rest all refs means that feature references to the external document + // feature: process also them + std::map>::iterator anExtIter = + allRefs.begin(); + for (; anExtIter != allRefs.end(); anExtIter++) { synchronizeBackRefsForObject(anExtIter->second, anExtIter->first); } } -TDF_Label Model_Objects::resultLabel( - const std::shared_ptr& theFeatureData, const int theResultIndex) -{ - const std::shared_ptr& aData = - std::dynamic_pointer_cast(theFeatureData); - return aData->label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1); +TDF_Label +Model_Objects::resultLabel(const std::shared_ptr &theFeatureData, + const int theResultIndex) { + const std::shared_ptr &aData = + std::dynamic_pointer_cast(theFeatureData); + return aData->label() + .Father() + .FindChild(TAG_FEATURE_RESULTS) + .FindChild(theResultIndex + 1); } -bool Model_Objects::hasCustomName(DataPtr theFeatureData, - ResultPtr theResult, +bool Model_Objects::hasCustomName(DataPtr theFeatureData, ResultPtr theResult, int /*theResultIndex*/, - std::wstring& theParentName) const -{ - ResultBodyPtr aBodyRes = std::dynamic_pointer_cast(theFeatureData->owner()); + std::wstring &theParentName) const { + ResultBodyPtr aBodyRes = + std::dynamic_pointer_cast(theFeatureData->owner()); if (aBodyRes) { - // only for top-results (works for the cases when results are not yet added to the feature) + // only for top-results (works for the cases when results are not yet added + // to the feature) FeaturePtr anOwner = ModelAPI_Feature::feature(theResult); // names of sub-solids in CompSolid should be default (for example, - // result of boolean operation 'Boolean_1' is a CompSolid which is renamed to 'MyBOOL', - // however, sub-elements of 'MyBOOL' should be named 'Boolean_1_1', 'Boolean_1_2' etc.) - if (std::dynamic_pointer_cast(aBodyRes->data())->label().Depth() == 6) { + // result of boolean operation 'Boolean_1' is a CompSolid which is renamed + // to 'MyBOOL', however, sub-elements of 'MyBOOL' should be named + // 'Boolean_1_1', 'Boolean_1_2' etc.) + if (std::dynamic_pointer_cast(aBodyRes->data()) + ->label() + .Depth() == 6) { std::wostringstream aDefaultName; - // compute default name of CompSolid (name of feature + index of CompSolid's result) + // compute default name of CompSolid (name of feature + index of + // CompSolid's result) int aBodyResultIndex = 0; - const std::list& aResults = anOwner->results(); + const std::list &aResults = anOwner->results(); std::list::const_iterator anIt = aResults.begin(); for (; anIt != aResults.end(); ++anIt, ++aBodyResultIndex) if (aBodyRes == *anIt) @@ -1212,13 +1310,15 @@ bool Model_Objects::hasCustomName(DataPtr theFeatureData, aDefaultName << anOwner->name(); aDefaultName << "_" << (aBodyResultIndex + 1); theParentName = aDefaultName.str(); - } else { // just name of the parent result if it is deeper than just a sub-result + } else { // just name of the parent result if it is deeper than just a + // sub-result theParentName = aBodyRes->data()->name(); } return false; } - std::pair aName = ModelAPI_Tools::getDefaultName(theResult); + std::pair aName = + ModelAPI_Tools::getDefaultName(theResult); if (aName.second) theParentName = aName.first; return aName.second; @@ -1227,27 +1327,29 @@ bool Model_Objects::hasCustomName(DataPtr theFeatureData, void Model_Objects::storeResult(std::shared_ptr theFeatureData, std::shared_ptr theResult, const int theResultIndex, - const std::wstring& theNameShape) -{ + const std::wstring &theNameShape) { theResult->init(); theResult->setDoc(myDoc); - initData(theResult, resultLabel(theFeatureData, theResultIndex), TAG_FEATURE_ARGUMENTS); + initData(theResult, resultLabel(theFeatureData, theResultIndex), + TAG_FEATURE_ARGUMENTS); if (theResult->data()->name().empty()) { // if was not initialized, generate event and set a name std::wstring aNewName = theFeatureData->name(); if (hasCustomName(theFeatureData, theResult, theResultIndex, aNewName)) { - // if the name of result is user-defined, then, at first time, assign name of the result - // by empty string to be sure that corresponding flag in the data model is set + // if the name of result is user-defined, then, at first time, assign name + // of the result by empty string to be sure that corresponding flag in the + // data model is set theResult->data()->setName(L""); } else { std::wstringstream aName; - if ( theNameShape != L"" ){ + if (theNameShape != L"") { aName << theNameShape; } else { aName << aNewName; // if there are several results (issue #899: any number of result), // add unique prefix starting from second - if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group()) + if (theResultIndex > 0 || + theResult->groupName() == ModelAPI_ResultBody::group()) aName << "_" << theResultIndex + 1; } aNewName = aName.str(); @@ -1257,27 +1359,27 @@ void Model_Objects::storeResult(std::shared_ptr theFeatureData, } std::shared_ptr Model_Objects::createConstruction( - const std::shared_ptr& theFeatureData, const int theIndex) -{ + const std::shared_ptr &theFeatureData, const int theIndex) { TDF_Label aLab = resultLabel(theFeatureData, theIndex); TDataStd_Comment::Set(aLab, ModelAPI_ResultConstruction::group().c_str()); ObjectPtr anOldObject = object(aLab); std::shared_ptr aResult; if (anOldObject.get()) { - aResult = std::dynamic_pointer_cast(anOldObject); + aResult = + std::dynamic_pointer_cast(anOldObject); } if (!aResult.get()) { - aResult = std::shared_ptr(new Model_ResultConstruction); + aResult = std::shared_ptr( + new Model_ResultConstruction); storeResult(theFeatureData, aResult, theIndex); } return aResult; } -std::shared_ptr Model_Objects::createBody( - const std::shared_ptr& theFeatureData, - const int theIndex, - const std::wstring& theNameShape) -{ +std::shared_ptr +Model_Objects::createBody(const std::shared_ptr &theFeatureData, + const int theIndex, + const std::wstring &theNameShape) { TDF_Label aLab = resultLabel(theFeatureData, theIndex); TDataStd_Comment::Set(aLab, ModelAPI_ResultBody::group().c_str()); ObjectPtr anOldObject = object(aLab); @@ -1292,9 +1394,9 @@ std::shared_ptr Model_Objects::createBody( return aResult; } -std::shared_ptr Model_Objects::createPart( - const std::shared_ptr& theFeatureData, const int theIndex) -{ +std::shared_ptr +Model_Objects::createPart(const std::shared_ptr &theFeatureData, + const int theIndex) { TDF_Label aLab = resultLabel(theFeatureData, theIndex); TDataStd_Comment::Set(aLab, ModelAPI_ResultPart::group().c_str()); ObjectPtr anOldObject = object(aLab); @@ -1309,18 +1411,21 @@ std::shared_ptr Model_Objects::createPart( return aResult; } -std::shared_ptr Model_Objects::copyPart( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theFeatureData, const int theIndex) -{ - std::shared_ptr aResult = createPart(theFeatureData, theIndex); - aResult->data()->reference(Model_ResultPart::BASE_REF_ID())->setValue(theOrigin); +std::shared_ptr +Model_Objects::copyPart(const std::shared_ptr &theOrigin, + const std::shared_ptr &theFeatureData, + const int theIndex) { + std::shared_ptr aResult = + createPart(theFeatureData, theIndex); + aResult->data() + ->reference(Model_ResultPart::BASE_REF_ID()) + ->setValue(theOrigin); return aResult; } -std::shared_ptr Model_Objects::createGroup( - const std::shared_ptr& theFeatureData, const int theIndex) -{ +std::shared_ptr +Model_Objects::createGroup(const std::shared_ptr &theFeatureData, + const int theIndex) { TDF_Label aLab = resultLabel(theFeatureData, theIndex); TDataStd_Comment::Set(aLab, ModelAPI_ResultGroup::group().c_str()); ObjectPtr anOldObject = object(aLab); @@ -1329,15 +1434,16 @@ std::shared_ptr Model_Objects::createGroup( aResult = std::dynamic_pointer_cast(anOldObject); } if (!aResult.get()) { - aResult = std::shared_ptr(new Model_ResultGroup(theFeatureData)); + aResult = std::shared_ptr( + new Model_ResultGroup(theFeatureData)); storeResult(theFeatureData, aResult, theIndex); } return aResult; } -std::shared_ptr Model_Objects::createField( - const std::shared_ptr& theFeatureData, const int theIndex) -{ +std::shared_ptr +Model_Objects::createField(const std::shared_ptr &theFeatureData, + const int theIndex) { TDF_Label aLab = resultLabel(theFeatureData, theIndex); TDataStd_Comment::Set(aLab, ModelAPI_ResultField::group().c_str()); ObjectPtr anOldObject = object(aLab); @@ -1346,15 +1452,15 @@ std::shared_ptr Model_Objects::createField( aResult = std::dynamic_pointer_cast(anOldObject); } if (!aResult.get()) { - aResult = std::shared_ptr(new Model_ResultField(theFeatureData)); + aResult = std::shared_ptr( + new Model_ResultField(theFeatureData)); storeResult(theFeatureData, aResult, theIndex); } return aResult; } std::shared_ptr Model_Objects::createParameter( - const std::shared_ptr& theFeatureData, const int theIndex) -{ + const std::shared_ptr &theFeatureData, const int theIndex) { TDF_Label aLab = resultLabel(theFeatureData, theIndex); TDataStd_Comment::Set(aLab, ModelAPI_ResultParameter::group().c_str()); ObjectPtr anOldObject = object(aLab); @@ -1363,23 +1469,23 @@ std::shared_ptr Model_Objects::createParameter( aResult = std::dynamic_pointer_cast(anOldObject); } if (!aResult.get()) { - aResult = std::shared_ptr(new Model_ResultParameter); + aResult = + std::shared_ptr(new Model_ResultParameter); storeResult(theFeatureData, aResult, theIndex); } return aResult; } std::shared_ptr Model_Objects::createFolder( - const std::shared_ptr& theBeforeThis) -{ + const std::shared_ptr &theBeforeThis) { FolderPtr aFolder(new ModelAPI_Folder); if (!aFolder) return aFolder; TDF_Label aFeaturesLab = featuresLabel(); TDF_Label aFolderLab = aFeaturesLab.NewChild(); - // store feature in the features array: before "initData" because in macro features - // in initData it creates new features, appeared later than this + // store feature in the features array: before "initData" because in macro + // features in initData it creates new features, appeared later than this TDF_Label aPrevFeatureLab; if (theBeforeThis.get()) { // searching for the previous feature label std::shared_ptr aPrevData = @@ -1405,21 +1511,22 @@ std::shared_ptr Model_Objects::createFolder( // must be after binding to the map because of "Box" macro feature that // creates other features in "initData" initData(aFolder, aFolderLab, TAG_FEATURE_ARGUMENTS); - // event: folder is added, must be before "initData" to update OB correctly on Duplicate: - // first new part, then the content + // event: folder is added, must be before "initData" to update OB correctly on + // Duplicate: first new part, then the content static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); ModelAPI_EventCreator::get()->sendUpdated(aFolder, anEvent); return aFolder; } -void Model_Objects::removeFolder(std::shared_ptr theFolder) -{ - std::shared_ptr aData = std::static_pointer_cast(theFolder->data()); +void Model_Objects::removeFolder(std::shared_ptr theFolder) { + std::shared_ptr aData = + std::static_pointer_cast(theFolder->data()); if (!aData.get() || !aData->isValid()) return; - // this must be before erase since theFolder erasing removes all information about it + // this must be before erase since theFolder erasing removes all information + // about it clearHistory(theFolder); // erase fields theFolder->erase(); @@ -1428,21 +1535,23 @@ void Model_Objects::removeFolder(std::shared_ptr theFolder) if (myFolders.IsBound(aFolderLabel)) myFolders.UnBind(aFolderLabel); - static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID EVENT_DISP = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(theFolder, EVENT_DISP); // erase all attributes under the label of feature aFolderLabel.ForgetAllAttributes(); // remove it from the references array RemoveFromRefArray(featuresLabel(), aFolderLabel); // event: feature is deleted - ModelAPI_EventCreator::get()->sendDeleted(theFolder->document(), ModelAPI_Folder::group()); + ModelAPI_EventCreator::get()->sendDeleted(theFolder->document(), + ModelAPI_Folder::group()); updateHistory(ModelAPI_Folder::group()); updateHistory(ModelAPI_Feature::group()); } // Returns one of the limiting features of the list -static FeaturePtr limitingFeature(std::list& theFeatures, const bool isLast) -{ +static FeaturePtr limitingFeature(std::list &theFeatures, + const bool isLast) { FeaturePtr aFeature; if (isLast) { aFeature = theFeatures.back(); @@ -1454,17 +1563,16 @@ static FeaturePtr limitingFeature(std::list& theFeatures, const bool return aFeature; } -// Verify the feature is sub-element in composite feature or it is not used in the history -static bool isSkippedFeature(FeaturePtr theFeature) -{ +// Verify the feature is sub-element in composite feature or it is not used in +// the history +static bool isSkippedFeature(FeaturePtr theFeature) { bool isSub = ModelAPI_Tools::compositeOwner(theFeature).get() != NULL; return isSub || (theFeature && !theFeature->isInHistory()); } std::shared_ptr Model_Objects::findFolder( - const std::list >& theFeatures, - const bool theBelow) -{ + const std::list> &theFeatures, + const bool theBelow) { if (theFeatures.empty()) return FolderPtr(); // nothing to move @@ -1473,8 +1581,9 @@ std::shared_ptr Model_Objects::findFolder( if (!aFeaturesLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) return FolderPtr(); // no reference array (something is wrong) - std::list > aFeatures = theFeatures; - std::shared_ptr aLimitingFeature = limitingFeature(aFeatures, theBelow); + std::list> aFeatures = theFeatures; + std::shared_ptr aLimitingFeature = + limitingFeature(aFeatures, theBelow); std::shared_ptr aData = std::static_pointer_cast(aLimitingFeature->data()); @@ -1485,25 +1594,30 @@ std::shared_ptr Model_Objects::findFolder( TDF_Label aFirstFeatureLabel = aData->label().Father(); // find a folder above the features and - // check the given features represent a sequential list of objects following the folder + // check the given features represent a sequential list of objects following + // the folder FolderPtr aFoundFolder; TDF_Label aLastFeatureInFolder; int aRefIndex = aRefs->Lower(); - for(; aRefIndex <= aRefs->Upper(); ++aRefIndex) { // iterate all existing features + for (; aRefIndex <= aRefs->Upper(); + ++aRefIndex) { // iterate all existing features TDF_Label aCurLabel = aRefs->Value(aRefIndex); if (IsEqual(aCurLabel, aFirstFeatureLabel)) break; // no need to continue searching - // searching the folder below, just continue to search last feature from the list + // searching the folder below, just continue to search last feature from the + // list if (theBelow) continue; - // issue #18733: check for the last feature in folder before checking the sub-feature, + // issue #18733: check for the last feature in folder before checking the + // sub-feature, // because the folder may end by the feature which is // neither a sub-feature nor a feature in history. if (!aLastFeatureInFolder.IsNull()) { if (IsEqual(aCurLabel, aLastFeatureInFolder)) - aLastFeatureInFolder.Nullify(); // the last feature in the folder is achieved + aLastFeatureInFolder + .Nullify(); // the last feature in the folder is achieved continue; } @@ -1512,7 +1626,7 @@ std::shared_ptr Model_Objects::findFolder( if (isSkippedFeature(aCurFeature)) continue; - const ObjectPtr& aFolderObj = folder(aCurLabel); + const ObjectPtr &aFolderObj = folder(aCurLabel); if (aFolderObj.get()) { aFoundFolder = std::dynamic_pointer_cast(aFolderObj); AttributeReferencePtr aLastFeatAttr = @@ -1542,14 +1656,15 @@ std::shared_ptr Model_Objects::findFolder( aFoundFolder = std::dynamic_pointer_cast(folder(aLabel)); } - if (!aLastFeatureInFolder.IsNull() || // the last feature of the folder above is not found + if (!aLastFeatureInFolder + .IsNull() || // the last feature of the folder above is not found !aFoundFolder) return FolderPtr(); // check the given features are sequential list int aStep = theBelow ? -1 : 1; - for (aRefIndex += aStep; - !aFeatures.empty() && aRefIndex >= aRefs->Lower() && aRefIndex <= aRefs->Upper(); + for (aRefIndex += aStep; !aFeatures.empty() && aRefIndex >= aRefs->Lower() && + aRefIndex <= aRefs->Upper(); aRefIndex += aStep) { TDF_Label aCurLabel = aRefs->Value(aRefIndex); // if feature is in sub-component, skip it @@ -1566,9 +1681,8 @@ std::shared_ptr Model_Objects::findFolder( } bool Model_Objects::moveToFolder( - const std::list >& theFeatures, - const std::shared_ptr& theFolder) -{ + const std::list> &theFeatures, + const std::shared_ptr &theFolder) { if (theFeatures.empty() || !theFolder) return false; @@ -1590,7 +1704,7 @@ bool Model_Objects::moveToFolder( AttributeReferencePtr aLastFeatAttr = theFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID()); bool initFirstAttr = !aFirstFeatAttr->value().get(); - bool initLastAttr = !aLastFeatAttr->value().get(); + bool initLastAttr = !aLastFeatAttr->value().get(); // check the folder is below the list of features bool isFolderBelow = false; @@ -1598,7 +1712,8 @@ bool Model_Objects::moveToFolder( Handle(TDataStd_ReferenceArray) aRefs; if (!aFeaturesLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) return false; // no reference array (something is wrong) - for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); ++aRefIndex) { + for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); + ++aRefIndex) { TDF_Label aCurLabel = aRefs->Value(aRefIndex); if (aCurLabel == aFolderLabel) break; // folder is above the features @@ -1614,7 +1729,8 @@ bool Model_Objects::moveToFolder( return false; TDF_Label aPrevFeatureLabel = aData->label().Father(); // label of the feature before the first feature in the list - for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); ++aRefIndex) + for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); + ++aRefIndex) if (aPrevFeatureLabel == aRefs->Value(aRefIndex)) { if (aRefIndex == aRefs->Lower()) aPrevFeatureLabel.Nullify(); @@ -1642,13 +1758,14 @@ bool Model_Objects::moveToFolder( return true; } -static FolderPtr isExtractionCorrect(const FolderPtr& theFirstFeatureFolder, - const FolderPtr& theLastFeatureFolder, - bool& isExtractBefore) -{ +static FolderPtr isExtractionCorrect(const FolderPtr &theFirstFeatureFolder, + const FolderPtr &theLastFeatureFolder, + bool &isExtractBefore) { if (theFirstFeatureFolder.get()) { if (theLastFeatureFolder.get()) - return theFirstFeatureFolder == theLastFeatureFolder ? theFirstFeatureFolder : FolderPtr(); + return theFirstFeatureFolder == theLastFeatureFolder + ? theFirstFeatureFolder + : FolderPtr(); else isExtractBefore = true; return theFirstFeatureFolder; @@ -1661,20 +1778,19 @@ static FolderPtr isExtractionCorrect(const FolderPtr& theFirstFeatureFolder, } bool Model_Objects::removeFromFolder( - const std::list >& theFeatures, - const bool theBefore) -{ + const std::list> &theFeatures, + const bool theBefore) { if (theFeatures.empty()) return false; FolderPtr aFirstFeatureFolder = inFolder(theFeatures.front(), ModelAPI_Folder::FIRST_FEATURE_ID()); FolderPtr aLastFeatureFolder = - inFolder(theFeatures.back(), ModelAPI_Folder::LAST_FEATURE_ID()); + inFolder(theFeatures.back(), ModelAPI_Folder::LAST_FEATURE_ID()); bool isExtractBeforeFolder = theBefore; - FolderPtr aFoundFolder = - isExtractionCorrect(aFirstFeatureFolder, aLastFeatureFolder, isExtractBeforeFolder); + FolderPtr aFoundFolder = isExtractionCorrect( + aFirstFeatureFolder, aLastFeatureFolder, isExtractBeforeFolder); if (!aFoundFolder) return false; // list of features cannot be extracted @@ -1682,11 +1798,14 @@ bool Model_Objects::removeFromFolder( ObjectPtr aFolderStartFeature; ObjectPtr aFolderEndFeature; if (aFirstFeatureFolder != aLastFeatureFolder) { - aFolderStartFeature = aFoundFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID())->value(); - aFolderEndFeature = aFoundFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID())->value(); + aFolderStartFeature = + aFoundFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID())->value(); + aFolderEndFeature = + aFoundFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID())->value(); } - FeaturePtr aFeatureToFind = isExtractBeforeFolder ? theFeatures.back() : theFeatures.front(); + FeaturePtr aFeatureToFind = + isExtractBeforeFolder ? theFeatures.back() : theFeatures.front(); std::shared_ptr aData = std::static_pointer_cast(aFeatureToFind->data()); if (!aData || !aData->isValid()) @@ -1713,12 +1832,14 @@ bool Model_Objects::removeFromFolder( FeaturePtr aNewStartFeature; do { // skip all features placed in the composite features aPrevFeatureLabel = aRefs->Value(aRefIndex++); - aNewStartFeature = - aRefIndex <= aRefs->Upper() ? feature(aRefs->Value(aRefIndex)) : FeaturePtr(); + aNewStartFeature = aRefIndex <= aRefs->Upper() + ? feature(aRefs->Value(aRefIndex)) + : FeaturePtr(); } while (aNewStartFeature && isSkippedFeature(aNewStartFeature)); aFolderStartFeature = aNewStartFeature; } - // move the folder in the list of references after the last feature from the list + // move the folder in the list of references after the last feature from the + // list RemoveFromRefArray(aFeaturesLab, aFolderLabel); AddToRefArray(aFeaturesLab, aFolderLabel, aPrevFeatureLabel); } else { @@ -1727,23 +1848,26 @@ bool Model_Objects::removeFromFolder( FeaturePtr aNewEndFeature; do { // skip all features placed in the composite features --aRefIndex; - aNewEndFeature = - aRefIndex >= aRefs->Lower() ? feature(aRefs->Value(aRefIndex)) : FeaturePtr(); + aNewEndFeature = aRefIndex >= aRefs->Lower() + ? feature(aRefs->Value(aRefIndex)) + : FeaturePtr(); } while (aNewEndFeature && isSkippedFeature(aNewEndFeature)); aFolderEndFeature = aNewEndFeature; } } // update folder references - aFoundFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID())->setValue(aFolderStartFeature); - aFoundFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID())->setValue(aFolderEndFeature); + aFoundFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID()) + ->setValue(aFolderStartFeature); + aFoundFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID()) + ->setValue(aFolderEndFeature); updateHistory(ModelAPI_Feature::group()); return true; } -FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& theIndexInFolder) -{ +FolderPtr Model_Objects::findContainingFolder(const FeaturePtr &theFeature, + int &theIndexInFolder) { // search the label in the list of references TDF_Label aFeaturesLab = featuresLabel(); Handle(TDataStd_ReferenceArray) aRefs; @@ -1760,7 +1884,8 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& FolderPtr aFoundFolder; TDF_Label aLastFeatureLabel; - for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); ++aRefIndex) { + for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); + ++aRefIndex) { TDF_Label aCurLabel = aRefs->Value(aRefIndex); if (aFoundFolder) @@ -1772,7 +1897,8 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& theIndexInFolder = -1; return FolderPtr(); } - // decrease the index of the feature in the folder by the number of skipped features + // decrease the index of the feature in the folder by the number of + // skipped features for (int anIndex = theIndexInFolder - 1; anIndex > 0; anIndex--) { aCurLabel = aRefs->Value(aRefIndex - anIndex); if (isSkippedFeature(feature(aCurLabel))) @@ -1784,7 +1910,7 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& if (!aFoundFolder) { // if the current label refers to a folder, feel all necessary data - const ObjectPtr& aFolderObj = folder(aCurLabel); + const ObjectPtr &aFolderObj = folder(aCurLabel); if (aFolderObj.get()) { aFoundFolder = std::dynamic_pointer_cast(aFolderObj); theIndexInFolder = -1; @@ -1792,7 +1918,8 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& AttributeReferencePtr aLastRef = aFoundFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID()); if (aLastRef->value()) { - aData = std::static_pointer_cast(aLastRef->value()->data()); + aData = + std::static_pointer_cast(aLastRef->value()->data()); if (aData && aData->isValid()) aLastFeatureLabel = aData->label().Father(); } else // folder is empty @@ -1810,15 +1937,15 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& return FolderPtr(); } - -std::shared_ptr Model_Objects::feature( - const std::shared_ptr& theResult) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(theResult->data()); +std::shared_ptr +Model_Objects::feature(const std::shared_ptr &theResult) { + std::shared_ptr aData = + std::dynamic_pointer_cast(theResult->data()); if (aData.get() && aData->isValid()) { TDF_Label aFeatureLab = aData->label().Father().Father().Father(); FeaturePtr aFeature = feature(aFeatureLab); - while(!aFeature.get() && aFeatureLab.Depth() > 1) { // this may be sub-result of result + while (!aFeature.get() && + aFeatureLab.Depth() > 1) { // this may be sub-result of result aFeatureLab = aFeatureLab.Father().Father(); aFeature = feature(aFeatureLab); } @@ -1827,8 +1954,7 @@ std::shared_ptr Model_Objects::feature( return FeaturePtr(); } -std::string Model_Objects::featureResultGroup(FeaturePtr theFeature) -{ +std::string Model_Objects::featureResultGroup(FeaturePtr theFeature) { if (theFeature->data()->isValid()) { TDF_ChildIterator aLabIter(resultLabel(theFeature->data(), 0).Father()); if (aLabIter.More()) { @@ -1843,36 +1969,44 @@ std::string Model_Objects::featureResultGroup(FeaturePtr theFeature) return anEmpty; // not found } -void Model_Objects::updateResults(FeaturePtr theFeature, std::set& theProcessed) -{ +void Model_Objects::updateResults(FeaturePtr theFeature, + std::set &theProcessed) { if (theProcessed.find(theFeature) != theProcessed.end()) return; theProcessed.insert(theFeature); - // for composites update subs recursively (sketch elements results are needed for the sketch) - CompositeFeaturePtr aComp = std::dynamic_pointer_cast(theFeature); - if (aComp.get() && aComp->getKind() != "Part") { // don't go inside of parts sub-features + // for composites update subs recursively (sketch elements results are needed + // for the sketch) + CompositeFeaturePtr aComp = + std::dynamic_pointer_cast(theFeature); + if (aComp.get() && + aComp->getKind() != "Part") { // don't go inside of parts sub-features // update subs of composites first int aSubNum = aComp->numberOfSubs(); - for(int a = 0; a < aSubNum; a++) { + for (int a = 0; a < aSubNum; a++) { FeaturePtr aSub = aComp->subFeature(a); updateResults(aComp->subFeature(a), theProcessed); } } // it may be on undo - if (!theFeature->data() || !theFeature->data()->isValid() || theFeature->isDisabled()) + if (!theFeature->data() || !theFeature->data()->isValid() || + theFeature->isDisabled()) return; // check the existing results and remove them if there is nothing on the label - std::list::const_iterator aResIter = theFeature->results().cbegin(); - while(aResIter != theFeature->results().cend()) { + std::list::const_iterator aResIter = + theFeature->results().cbegin(); + while (aResIter != theFeature->results().cend()) { ResultPtr aBody = std::dynamic_pointer_cast(*aResIter); if (aBody.get()) { - std::shared_ptr aData = std::dynamic_pointer_cast(aBody->data()); - if (!aData.get() || !aData->isValid() || (!aBody->isDisabled() && aData->isDeleted())) { + std::shared_ptr aData = + std::dynamic_pointer_cast(aBody->data()); + if (!aData.get() || !aData->isValid() || + (!aBody->isDisabled() && aData->isDeleted())) { // found a disappeared result => remove it theFeature->eraseResultFromList(aBody); - // start iterate from beginning because iterator is corrupted by removing + // start iterate from beginning because iterator is corrupted by + // removing aResIter = theFeature->results().cbegin(); continue; } @@ -1882,7 +2016,7 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t // check that results are presented on all labels int aResSize = int(theFeature->results().size()); TDF_ChildIterator aLabIter(resultLabel(theFeature->data(), 0).Father()); - for(; aLabIter.More(); aLabIter.Next()) { + for (; aLabIter.More(); aLabIter.Next()) { // here must be GUID of the feature int aResIndex = aLabIter.Value().Tag() - 1; ResultPtr aNewBody; @@ -1893,23 +2027,30 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) { aNewBody = createBody(theFeature->data(), aResIndex); } else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) { - if (aResIndex <= (int)theFeature->results().size()) {// to avoid crash if previous execute + if (aResIndex <= (int)theFeature->results() + .size()) { // to avoid crash if previous execute // for index = 0 erases result - std::shared_ptr aNewP = createPart(theFeature->data(), aResIndex); + std::shared_ptr aNewP = + createPart(theFeature->data(), aResIndex); if (!aNewP->data()->isDeleted()) { theFeature->setResult(aNewP, aResIndex); if (!aNewP->partDoc().get()) - // create the part result: it is better to restore the previous result if possible + // create the part result: it is better to restore the previous + // result if possible theFeature->execute(); } } - } else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) { - ResultConstructionPtr aConstr = createConstruction(theFeature->data(), aResIndex); + } else if (aGroup->Get() == + ModelAPI_ResultConstruction::group().c_str()) { + ResultConstructionPtr aConstr = + createConstruction(theFeature->data(), aResIndex); if (!aConstr->data()->isDeleted()) { if (!aConstr->updateShape()) - theFeature->execute(); // not stored shape in the data structure, execute to have it + theFeature->execute(); // not stored shape in the data structure, + // execute to have it else - theFeature->setResult(aConstr, aResIndex); // result is ready without execution + theFeature->setResult( + aConstr, aResIndex); // result is ready without execution } } else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) { aNewBody = createGroup(theFeature->data(), aResIndex); @@ -1920,8 +2061,10 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t } else if (aGroup->Get() == ModelAPI_ResultParameter::group().c_str()) { theFeature->attributeChanged("expression"); // just produce a value } else { - Events_InfoMessage("Model_Objects", "Unknown type of result is found in the document:") - .arg(TCollection_AsciiString(aGroup->Get()).ToCString()).send(); + Events_InfoMessage("Model_Objects", + "Unknown type of result is found in the document:") + .arg(TCollection_AsciiString(aGroup->Get()).ToCString()) + .send(); } } if (aNewBody && !aNewBody->data()->isDeleted()) { @@ -1931,15 +2074,18 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t } if (aResSize > 0) { // check there exist a body that must be updated std::list::const_iterator aRes = theFeature->results().cbegin(); - for (; aResSize && aRes != theFeature->results().cend(); aRes++, aResSize++) { + for (; aResSize && aRes != theFeature->results().cend(); + aRes++, aResSize++) { if ((*aRes)->data()->isValid()) { if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(*aRes); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(*aRes); aBody->updateSubs(aBody->shape(), false); - } else if ((*aRes)->groupName() == ModelAPI_ResultConstruction::group()) { + } else if ((*aRes)->groupName() == + ModelAPI_ResultConstruction::group()) { // update the cashed myShape presented in construction ResultConstructionPtr aConstr = - std::dynamic_pointer_cast(*aRes); + std::dynamic_pointer_cast(*aRes); aConstr->updateShape(); } } @@ -1947,13 +2093,12 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t } } -ResultPtr Model_Objects::findByName(const std::wstring theName) -{ +ResultPtr Model_Objects::findByName(const std::wstring theName) { ResultPtr aResult; FeaturePtr aResFeature; // keep feature to return the latest one NCollection_DataMap::Iterator anObjIter(myFeatures); - for(; anObjIter.More(); anObjIter.Next()) { - FeaturePtr& aFeature = anObjIter.ChangeValue(); + for (; anObjIter.More(); anObjIter.Next()) { + FeaturePtr &aFeature = anObjIter.ChangeValue(); if (!aFeature.get() || aFeature->isDisabled()) // may be on close continue; std::list allResults; @@ -1961,10 +2106,10 @@ ResultPtr Model_Objects::findByName(const std::wstring theName) std::list::iterator aRIter = allResults.begin(); for (; aRIter != allResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; - if (aRes.get() && aRes->data() && aRes->data()->isValid() && !aRes->isDisabled() && - aRes->data()->name() == theName) - { - if (!aResult.get() || isLater(aFeature, aResFeature)) { // select the latest + if (aRes.get() && aRes->data() && aRes->data()->isValid() && + !aRes->isDisabled() && aRes->data()->name() == theName) { + if (!aResult.get() || + isLater(aFeature, aResFeature)) { // select the latest aResult = aRes; aResFeature = aFeature; } @@ -1974,12 +2119,14 @@ ResultPtr Model_Objects::findByName(const std::wstring theName) return aResult; } -TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, int& theIndex, const bool theReverse) -{ +TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, int &theIndex, + const bool theReverse) { Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - int aStart = theIndex == kUNDEFINED_FEATURE_INDEX ? aRefs->Lower() : theIndex; - for(int a = aStart; a <= aRefs->Upper(); a++) { // iterate all existing features + int aStart = + theIndex == kUNDEFINED_FEATURE_INDEX ? aRefs->Lower() : theIndex; + for (int a = aStart; a <= aRefs->Upper(); + a++) { // iterate all existing features TDF_Label aCurLab = aRefs->Value(a); if (aCurLab.IsEqual(theCurrent)) { a += theReverse ? -1 : 1; @@ -1994,9 +2141,10 @@ TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, int& theIndex, const bo return TDF_Label(); } -FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, int& theIndex, const bool theReverse) -{ - std::shared_ptr aData = std::static_pointer_cast(theCurrent->data()); +FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, int &theIndex, + const bool theReverse) { + std::shared_ptr aData = + std::static_pointer_cast(theCurrent->data()); if (aData.get() && aData->isValid()) { TDF_Label aFeatureLabel = aData->label().Father(); do { @@ -2013,8 +2161,7 @@ FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, int& theIndex, cons return FeaturePtr(); // not found, last, or something is wrong } -FeaturePtr Model_Objects::firstFeature() -{ +FeaturePtr Model_Objects::firstFeature() { Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { return feature(aRefs->Value(aRefs->Lower())); @@ -2022,40 +2169,46 @@ FeaturePtr Model_Objects::firstFeature() return FeaturePtr(); // no features at all } -FeaturePtr Model_Objects::lastFeature() -{ +FeaturePtr Model_Objects::lastFeature() { Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - // comment this because of #2674 - features are removed from array on deactivation of Part + // comment this because of #2674 - features are removed from array on + // deactivation of Part /*FeaturePtr aLast = feature(aRefs->Value(aRefs->Upper())); - if (!aLast.get() && aRefs->Length() != 0) { // erase the invalid feature from the array - RemoveFromRefArray(featuresLabel(), aRefs->Value(aRefs->Upper())); - return lastFeature(); // try once again, after the last was removed + if (!aLast.get() && aRefs->Length() != 0) { // erase the invalid feature + from the array RemoveFromRefArray(featuresLabel(), + aRefs->Value(aRefs->Upper())); return lastFeature(); // try once again, + after the last was removed }*/ return feature(aRefs->Value(aRefs->Upper())); } return FeaturePtr(); // no features at all } -bool Model_Objects::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const -{ +bool Model_Objects::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const { if (theLater->getKind() == "InternalSelectionInPartFeature") return true; - std::shared_ptr aLaterD = std::static_pointer_cast(theLater->data()); - std::shared_ptr aCurrentD = std::static_pointer_cast(theCurrent->data()); - if (aLaterD.get() && aLaterD->isValid() && aCurrentD.get() && aCurrentD->isValid()) { + std::shared_ptr aLaterD = + std::static_pointer_cast(theLater->data()); + std::shared_ptr aCurrentD = + std::static_pointer_cast(theCurrent->data()); + if (aLaterD.get() && aLaterD->isValid() && aCurrentD.get() && + aCurrentD->isValid()) { TDF_Label aLaterL = aLaterD->label().Father(); TDF_Label aCurrentL = aCurrentD->label().Father(); int aLaterI = -1, aCurentI = -1; // not found yet state Handle(TDataStd_ReferenceArray) aRefs; - if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { // iterate all existing features + if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), + aRefs)) { + for (int a = aRefs->Lower(); a <= aRefs->Upper(); + a++) { // iterate all existing features TDF_Label aCurLab = aRefs->Value(a); if (aCurLab.IsEqual(aLaterL)) { aLaterI = a; } else if (aCurLab.IsEqual(aCurrentL)) { aCurentI = a; - } else continue; + } else + continue; if (aLaterI != -1 && aCurentI != -1) // both are found return aLaterI > aCurentI; } @@ -2064,12 +2217,11 @@ bool Model_Objects::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const return false; // not found, or something is wrong } -std::list > Model_Objects::allObjects() -{ - std::list > aResult; +std::list> Model_Objects::allObjects() { + std::list> aResult; Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { + for (int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { ObjectPtr anObject = object(aRefs->Value(a)); if (!anObject.get()) // is it a folder? anObject = folder(aRefs->Value(a)); @@ -2080,12 +2232,11 @@ std::list > Model_Objects::allObjects() return aResult; } -std::list > Model_Objects::allFeatures() -{ - std::list > aResult; +std::list> Model_Objects::allFeatures() { + std::list> aResult; Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { - for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { + for (int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { FeaturePtr aFeature = feature(aRefs->Value(a)); if (aFeature.get()) aResult.push_back(aFeature); @@ -2094,8 +2245,7 @@ std::list > Model_Objects::allFeatures() return aResult; } -int Model_Objects::numInternalFeatures() -{ +int Model_Objects::numInternalFeatures() { Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { return aRefs->Upper() - aRefs->Lower() + 1; @@ -2103,8 +2253,8 @@ int Model_Objects::numInternalFeatures() return 0; // invalid } -std::shared_ptr Model_Objects::internalFeature(const int theIndex) -{ +std::shared_ptr +Model_Objects::internalFeature(const int theIndex) { Handle(TDataStd_ReferenceArray) aRefs; if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { return feature(aRefs->Value(aRefs->Lower() + theIndex)); @@ -2112,11 +2262,10 @@ std::shared_ptr Model_Objects::internalFeature(const int theIn return FeaturePtr(); // invalid } -Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper) -{ +Standard_Integer HashCode(const TDF_Label &theLab, + const Standard_Integer theUpper) { return TDF_LabelMapHasher::HashCode(theLab, theUpper); } -Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2) -{ +Standard_Boolean IsEqual(const TDF_Label &theLab1, const TDF_Label &theLab2) { return TDF_LabelMapHasher::IsEqual(theLab1, theLab2); } diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index 627d3900e..c38a3013c 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Objects_H_ @@ -38,13 +39,12 @@ extern int kUNDEFINED_FEATURE_INDEX; /**\class Model_Objects * \ingroup DataModel - * \brief Manager of objects of the document. Normally one this class corresponds to - * one document and just helper to manage objects (ModelAPI_Objects) inside of the document - * on the level of data storage. + * \brief Manager of objects of the document. Normally one this class + * corresponds to one document and just helper to manage objects + * (ModelAPI_Objects) inside of the document on the level of data storage. */ -class Model_Objects -{ - public: +class Model_Objects { +public: //! Registers the feature in the data structure //! \param theFeature feature that must be added to the data structure //! \param theAfterThis the feature will be added after this feature; @@ -55,8 +55,7 @@ class Model_Objects //! \param theFeature a feature //! \param theRefs a list of reference features //! \param isSendError a flag whether the error message should be send - void refsToFeature(FeaturePtr theFeature, - std::set& theRefs, + void refsToFeature(FeaturePtr theFeature, std::set &theRefs, const bool isSendError = true); //! Removes the feature from the document (with result) @@ -78,17 +77,16 @@ class Model_Objects //! \param theGroupID group that contains an object //! \param theName name of the object to search //! \returns null if such object is not found - std::shared_ptr objectByName( - const std::string& theGroupID, const std::wstring& theName); + std::shared_ptr objectByName(const std::string &theGroupID, + const std::wstring &theName); //! Returns the result by the result name ResultPtr findByName(const std::wstring theName); - - //! Returns the object index in the group. Object must be visible. Otherwise returns -1. - //! \param theObject object of this document - //! \param theAllowFolder take into account grouping feature by folders - //! \returns index started from zero, or -1 if object is invisible or belongs to another document + //! Returns the object index in the group. Object must be visible. Otherwise + //! returns -1. \param theObject object of this document \param theAllowFolder + //! take into account grouping feature by folders \returns index started from + //! zero, or -1 if object is invisible or belongs to another document const int index(std::shared_ptr theObject, const bool theAllowFolder = false); @@ -96,22 +94,24 @@ class Model_Objects //! \param theGroupID group that contains a feature //! \param theIndex zero-based index of feature in the group //! \param theAllowFolder take into account grouping feature by folders - ObjectPtr object(const std::string& theGroupID, - const int theIndex, + ObjectPtr object(const std::string &theGroupID, const int theIndex, const bool theAllowFolder = false); //! Returns the number of features in the group //! \param theGroupID group of objects //! \param theAllowFolder take into account grouping feature by folders - int size(const std::string& theGroupID, const bool theAllowFolder = false); + int size(const std::string &theGroupID, const bool theAllowFolder = false); - //! Returns the parent object of this child. This may be result or feature, parent of a - //! top result. Fast method, that uses internal data structure specifics. - std::shared_ptr parent(const std::shared_ptr theChild); + //! Returns the parent object of this child. This may be result or feature, + //! parent of a top result. Fast method, that uses internal data structure + //! specifics. + std::shared_ptr + parent(const std::shared_ptr theChild); //! Returns all (and disabled) results of the given type. //! Not fast method (iterates all features). - void allResults(const std::string& theGroupID, std::list& theResults); + void allResults(const std::string &theGroupID, + std::list &theResults); //! Returns the number of all features: in the history or not int numInternalFeatures(); @@ -119,98 +119,111 @@ class Model_Objects std::shared_ptr internalFeature(const int theIndex); /// Creates a construction result - std::shared_ptr createConstruction( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + std::shared_ptr + createConstruction(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a body result - std::shared_ptr createBody( - const std::shared_ptr& theFeatureData, const int theIndex = 0, - const std::wstring& theNameShape = L""); + std::shared_ptr + createBody(const std::shared_ptr &theFeatureData, + const int theIndex = 0, const std::wstring &theNameShape = L""); /// Creates a part result - std::shared_ptr createPart( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + std::shared_ptr + createPart(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Copies a part result, keeping the reference to origin - std::shared_ptr copyPart( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theFeatureData, const int theIndex = 0); + std::shared_ptr + copyPart(const std::shared_ptr &theOrigin, + const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a group result - std::shared_ptr createGroup( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + std::shared_ptr + createGroup(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a field result - std::shared_ptr createField( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + std::shared_ptr + createField(const std::shared_ptr &theFeatureData, + const int theIndex = 0); /// Creates a parameter result - std::shared_ptr createParameter( - const std::shared_ptr& theFeatureData, const int theIndex = 0); + std::shared_ptr + createParameter(const std::shared_ptr &theFeatureData, + const int theIndex = 0); //! Returns a feature by result (owner of result) std::shared_ptr - feature(const std::shared_ptr& theResult); + feature(const std::shared_ptr &theResult); /// Creates a folder (group of the features in the object browser) - std::shared_ptr createFolder( - const std::shared_ptr& theBeforeThis); - //! Removes the folder from the document (all features in the folder will be kept). + std::shared_ptr + createFolder(const std::shared_ptr &theBeforeThis); + //! Removes the folder from the document (all features in the folder will be + //! kept). void removeFolder(std::shared_ptr theFolder); //! Search a folder applicable for the list of features - //! (it means the list of features stored in the folder should be consequential) - //! \param theFeatures list of features to be added to folder - //! \param theBelow search the folder below the features (if \c false, search above) - //! \return Empty pointer if there is no applicable folder - std::shared_ptr findFolder( - const std::list >& theFeatures, - const bool theBelow); + //! (it means the list of features stored in the folder should be + //! consequential) \param theFeatures list of features to be added to folder + //! \param theBelow search the folder below the features (if \c false, + //! search above) \return Empty pointer if there is no applicable folder + std::shared_ptr + findFolder(const std::list> &theFeatures, + const bool theBelow); //! Search a folder containing the given feature. //! Additionally calculates a zero-based index of the feature in this folder. //! \param theFeature feature to search - //! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level. - //! \return the folder containing the feature or empty pointer if the feature is top-level. - std::shared_ptr findContainingFolder( - const std::shared_ptr& theFeature, - int& theIndexInFolder); - //! Add a list of features to the folder. The correctness of the adding is not performed - //! (such checks have been done in corresponding find.. method). + //! \param theIndexInFolder zero-based index in the folder or -1 if the + //! feature is top-level. \return the folder containing the feature or empty + //! pointer if the feature is top-level. + std::shared_ptr + findContainingFolder(const std::shared_ptr &theFeature, + int &theIndexInFolder); + //! Add a list of features to the folder. The correctness of the adding is not + //! performed (such checks have been done in corresponding find.. method). //! \return \c true if the movement is successful - bool moveToFolder(const std::list >& theFeatures, - const std::shared_ptr& theFolder); + bool + moveToFolder(const std::list> &theFeatures, + const std::shared_ptr &theFolder); //! Remove features from the folder //! \param theFeatures list of features to be removed - //! \param theBefore extract features before the folder (this parameter is applicable only + //! \param theBefore extract features before the folder (this parameter is + //! applicable only //! when all features in the folder are taking out, //! in other cases the direction is taken automatically) //! \return \c true if the features have been moved out - bool removeFromFolder(const std::list >& theFeatures, - const bool theBefore = true); + bool removeFromFolder( + const std::list> &theFeatures, + const bool theBefore = true); //! Sets the owner of this manager void setOwner(DocumentPtr theDoc); //! Returns the owner of this manager - DocumentPtr owner() {return myDoc;} + DocumentPtr owner() { return myDoc; } //! Deletes all managed features with emitting of corresponded signal virtual ~Model_Objects(); - protected: - +protected: //! Returns (creates if needed) the features label TDF_Label featuresLabel() const; - //! Initializes feature with a unique name in this group (unique name is generated as - //! feature type + "_" + index + //! Initializes feature with a unique name in this group (unique name is + //! generated as feature type + "_" + index void setUniqueName(FeaturePtr theFeature); //! Initializes the folder with an unique name ("Folder_" + index) void setUniqueName(FolderPtr theFolder); //! Synchronizes myFeatures list with the updated document - //! \param theUpdated list of labels that are marked as modified, so features must be also - //! \param theUpdateReferences causes the update of back-references - //! \param theExecuteFeatures requires re-execute modified persistent features + //! \param theUpdated list of labels that are marked as modified, so features + //! must be also \param theUpdateReferences causes the update of + //! back-references \param theExecuteFeatures requires re-execute modified + //! persistent features //! (not needed on undo/redo/abort/open) - //! \param theOpen - on open nothing must be re-executed, except not persistent results - //! \param theFlush makes flush all events in the end of all modifications of this method - void synchronizeFeatures(const TDF_LabelList& theUpdated, const bool theUpdateReferences, - const bool theOpen, const bool theExecuteFeatures, const bool theFlush); + //! \param theOpen - on open nothing must be re-executed, except not + //! persistent results \param theFlush makes flush all events in the end of + //! all modifications of this method + void synchronizeFeatures(const TDF_LabelList &theUpdated, + const bool theUpdateReferences, const bool theOpen, + const bool theExecuteFeatures, const bool theFlush); //! Synchronizes the BackReferences list in Data of Features and Results void synchronizeBackRefs(); @@ -225,78 +238,93 @@ class Model_Objects void storeResult(std::shared_ptr theFeatureData, std::shared_ptr theResult, const int theResultIndex = 0, - const std::wstring& theNameShape = L""); + const std::wstring &theNameShape = L""); - //! returns the label of result by index; creates this label if it was not created before - TDF_Label resultLabel(const std::shared_ptr& theFeatureData, + //! returns the label of result by index; creates this label if it was not + //! created before + TDF_Label resultLabel(const std::shared_ptr &theFeatureData, const int theResultIndex); //! Updates the results list of the feature basing on the current data tree - //! theProcessed is used to avoid update twice (since the function is recursive) - void updateResults(FeaturePtr theFeature, std::set& theProcessed); + //! theProcessed is used to avoid update twice (since the function is + //! recursive) + void updateResults(FeaturePtr theFeature, std::set &theProcessed); - /// Internally makes document know that feature was removed or added in history after creation + /// Internally makes document know that feature was removed or added in + /// history after creation void updateHistory(const std::shared_ptr theObject); - /// Internally makes document know that feature was removed or added in history after creation + /// Internally makes document know that feature was removed or added in + /// history after creation void updateHistory(const std::string theGroup); /// Clears the history arrays related to this object void clearHistory(ObjectPtr theObj); /// Creates the history: up to date with the current state - void createHistory(const std::string& theGroupID); - - /// Returns the next (from the history point of view) feature, any: invisible or disabled - /// \param theCurrent previous to the resulting feature - /// \param theReverse if it is true, iterates in reversed order (next becomes previous) - /// \param theIndex may be used for optimization: index of theCurrent in references array - FeaturePtr nextFeature(FeaturePtr theCurrent, int& theIndex, const bool theReverse = false); - /// Returns to the first (from the history point of view) feature, any: invisible or disabled + void createHistory(const std::string &theGroupID); + + /// Returns the next (from the history point of view) feature, any: invisible + /// or disabled \param theCurrent previous to the resulting feature \param + /// theReverse if it is true, iterates in reversed order (next becomes + /// previous) \param theIndex may be used for optimization: index of + /// theCurrent in references array + FeaturePtr nextFeature(FeaturePtr theCurrent, int &theIndex, + const bool theReverse = false); + /// Returns to the first (from the history point of view) feature, any: + /// invisible or disabled FeaturePtr firstFeature(); - /// Returns to the last (from the history point of view) feature, any: invisible or disabled + /// Returns to the last (from the history point of view) feature, any: + /// invisible or disabled FeaturePtr lastFeature(); - /// Returns true if theLater is in history of features creation later than theCurrent + /// Returns true if theLater is in history of features creation later than + /// theCurrent bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const; /// Returns the next or previous label /// \param theCurrent given label - /// \param theReverse if it is true, iterates in reversed order (next becomes previous) - TDF_Label nextLabel(TDF_Label theCurrent, int& theIndex, const bool theReverse = false); + /// \param theReverse if it is true, iterates in reversed order (next becomes + /// previous) + TDF_Label nextLabel(TDF_Label theCurrent, int &theIndex, + const bool theReverse = false); - /// Returns the result group identifier of the given feature (for this at least one result must - /// be created before) + /// Returns the result group identifier of the given feature (for this at + /// least one result must be created before) std::string featureResultGroup(FeaturePtr theFeature); - //! Returns all features of the document including the hidden features which are not in - //! history. Not very fast method, for calling once, not in big cycles. - std::list > allFeatures(); + //! Returns all features of the document including the hidden features which + //! are not in history. Not very fast method, for calling once, not in big + //! cycles. + std::list> allFeatures(); - //! Returns all objects of the document including the hidden features which are not in - //! history. Not very fast method, for calling once, not in big cycles. - std::list > allObjects(); + //! Returns all objects of the document including the hidden features which + //! are not in history. Not very fast method, for calling once, not in big + //! cycles. + std::list> allObjects(); - //! synchronizes back references for the given object basing on the collected data + //! synchronizes back references for the given object basing on the collected + //! data void synchronizeBackRefsForObject( - const std::set>& theNewRefs, ObjectPtr theObject); + const std::set> &theNewRefs, + ObjectPtr theObject); - /// Just removes all features without touching the document data (to be able undo) + /// Just removes all features without touching the document data (to be able + /// undo) virtual void eraseAllFeatures(); // Check whether the predefined-image of the result had user-defined name. // If yes, return this name. - bool hasCustomName(DataPtr theFeatureData, - ResultPtr theResult, - int theResultIndex, - std::wstring& theParentName) const; + bool hasCustomName(DataPtr theFeatureData, ResultPtr theResult, + int theResultIndex, std::wstring &theParentName) const; /// Return object representing a folder or empty pointer - const ObjectPtr& folder(TDF_Label theLabel) const; + const ObjectPtr &folder(TDF_Label theLabel) const; - private: +private: TDF_Label myMain; ///< main label of the data storage - DocumentPtr myDoc; ///< document, owner of this objects manager: needed for events creation + DocumentPtr myDoc; ///< document, owner of this objects manager: needed for + ///< events creation /// All managed features (not only in history of OB) /// For optimization mapped by labels @@ -305,9 +333,10 @@ class Model_Objects /// Managed folders NCollection_DataMap myFolders; - /// Map from group id to the array that contains all objects located in history. - /// Each array is updated by demand from scratch, by browsing all the features in the history. - std::map > myHistory; + /// Map from group id to the array that contains all objects located in + /// history. Each array is updated by demand from scratch, by browsing all the + /// features in the history. + std::map> myHistory; friend class Model_Document; friend class Model_Session; diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 85759ff40..56d6f2692 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -14,66 +14,64 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include +#include #include #include -#include +#include // if this attribute exists, the shape is connected topology Standard_GUID kIsConnectedTopology("e51392e0-3a4d-405d-8e36-bbfe19858ef5"); // if this attribute exists, the connected topology flag must be recomputed Standard_GUID kUpdateConnectedTopology("01ef7a45-0bec-4266-b0b4-4aa570921818"); -Model_ResultBody::Model_ResultBody() : ModelAPI_ResultBody() -{ +Model_ResultBody::Model_ResultBody() : ModelAPI_ResultBody() { myBuilder = new Model_BodyBuilder(this); myLastConcealed = false; updateSubs(shape()); // in case of open, etc. } -Model_ResultBody::~Model_ResultBody() -{ +Model_ResultBody::~Model_ResultBody() { updateSubs(std::shared_ptr()); // erase sub-results delete myBuilder; } -void Model_ResultBody::initAttributes() -{ +void Model_ResultBody::initAttributes() { ModelAPI_Result::initAttributes(); - // append the image attribute. It is empty, the attribute will be filled by a request - data()->addAttribute(IMAGE_ID(), ModelAPI_AttributeImage::typeId())->setIsArgument(false); + // append the image attribute. It is empty, the attribute will be filled by a + // request + data() + ->addAttribute(IMAGE_ID(), ModelAPI_AttributeImage::typeId()) + ->setIsArgument(false); } -bool Model_ResultBody::generated(const GeomShapePtr& theNewShape, - const std::string& theName, const bool theCheckIsInResult) -{ +bool Model_ResultBody::generated(const GeomShapePtr &theNewShape, + const std::string &theName, + const bool theCheckIsInResult) { bool aResult = false; if (mySubs.size()) { // consists of subs for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); - ++aSubIter) - { - const ResultBodyPtr& aSub = *aSubIter; + aSubIter != mySubs.cend(); ++aSubIter) { + const ResultBodyPtr &aSub = *aSubIter; if (aSub->generated(theNewShape, theName, theCheckIsInResult)) aResult = true; } @@ -84,53 +82,50 @@ bool Model_ResultBody::generated(const GeomShapePtr& theNewShape, return aResult; } -void Model_ResultBody::loadGeneratedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName, - const bool theSaveOldIfNotInTree) -{ +void Model_ResultBody::loadGeneratedShapes( + const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName, const bool theSaveOldIfNotInTree) { if (mySubs.size()) { // consists of subs for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); - ++aSubIter) - { - const ResultBodyPtr& aSub = *aSubIter; - aSub->loadGeneratedShapes( - theAlgo, theOldShape, theShapeTypeToExplore, theName, theSaveOldIfNotInTree); + aSubIter != mySubs.cend(); ++aSubIter) { + const ResultBodyPtr &aSub = *aSubIter; + aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, + theName, theSaveOldIfNotInTree); } } else { // do for this directly - myBuilder->loadGeneratedShapes( - theAlgo, theOldShape, theShapeTypeToExplore, theName, theSaveOldIfNotInTree); + myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, + theName, theSaveOldIfNotInTree); } } -void Model_ResultBody::loadModifiedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName) -{ +void Model_ResultBody::loadModifiedShapes( + const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName) { if (mySubs.size()) { // consists of subs // optimization of getting of new shapes for specific sub-result if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore)) theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore); std::vector::const_iterator aSubIter = mySubs.cbegin(); - for(; aSubIter != mySubs.cend(); aSubIter++) { - (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName); + for (; aSubIter != mySubs.cend(); aSubIter++) { + (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, + theShapeTypeToExplore, theName); } } else { // do for this directly - myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName); + myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, + theName); } } -void Model_ResultBody::loadFirstLevel(GeomShapePtr theShape, const std::string& theName) -{ +void Model_ResultBody::loadFirstLevel(GeomShapePtr theShape, + const std::string &theName) { if (mySubs.size()) { // consists of subs for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); - ++aSubIter) - { - const ResultBodyPtr& aSub = *aSubIter; + aSubIter != mySubs.cend(); ++aSubIter) { + const ResultBodyPtr &aSub = *aSubIter; aSub->loadFirstLevel(theShape, theName); } } else { // do for this directly @@ -138,20 +133,18 @@ void Model_ResultBody::loadFirstLevel(GeomShapePtr theShape, const std::string& } } -int Model_ResultBody::numberOfSubs(bool /*forTree*/) const -{ +int Model_ResultBody::numberOfSubs(bool /*forTree*/) const { return int(mySubs.size()); } -ResultBodyPtr Model_ResultBody::subResult(const int theIndex, bool /*forTree*/) const -{ +ResultBodyPtr Model_ResultBody::subResult(const int theIndex, + bool /*forTree*/) const { if (theIndex >= int(mySubs.size())) return ResultBodyPtr(); return mySubs.at(theIndex); } -bool Model_ResultBody::isSub(ObjectPtr theResult, int& theIndex) const -{ +bool Model_ResultBody::isSub(ObjectPtr theResult, int &theIndex) const { std::map::const_iterator aFound = mySubsMap.find(theResult); if (aFound != mySubsMap.end()) { theIndex = aFound->second; @@ -160,44 +153,41 @@ bool Model_ResultBody::isSub(ObjectPtr theResult, int& theIndex) const return false; } -void Model_ResultBody::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void Model_ResultBody::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "result_body_color"; theDefault = DEFAULT_COLOR(); } -bool Model_ResultBody::setDisabled(std::shared_ptr theThis, const bool theFlag) -{ +bool Model_ResultBody::setDisabled(std::shared_ptr theThis, + const bool theFlag) { bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag); - if (aChanged) { // state is changed, so modifications are needed + if (aChanged) { // state is changed, so modifications are needed updateSubs(shape(), false); // to set disabled/enabled } return aChanged; } -bool Model_ResultBody::isConcealed() -{ - return myLastConcealed; -} +bool Model_ResultBody::isConcealed() { return myLastConcealed; } -void Model_ResultBody::setIsConcealed(const bool theValue, const bool theForced) -{ +void Model_ResultBody::setIsConcealed(const bool theValue, + const bool theForced) { if (ModelAPI_ResultBody::isConcealed() != theValue) { ModelAPI_ResultBody::setIsConcealed(theValue, theForced); updateConcealment(); } } -// recursively check all subs for concealment flag, returns true if everybody have "flag" state, -// in theAll returns results with "flag" state -static bool checkAllSubs(ResultBodyPtr theParent, bool theFlag, std::list& theAll) -{ +// recursively check all subs for concealment flag, returns true if everybody +// have "flag" state, in theAll returns results with "flag" state +static bool checkAllSubs(ResultBodyPtr theParent, bool theFlag, + std::list &theAll) { if (theParent->isConcealed() != theFlag) theAll.push_back(theParent); bool aResult = theParent->ModelAPI_ResultBody::isConcealed() == theFlag; - for(int a = 0; a < theParent->numberOfSubs(); a++) { + for (int a = 0; a < theParent->numberOfSubs(); a++) { bool aSubRes = checkAllSubs(theParent->subResult(a), theFlag, theAll); if (theFlag) aResult = aResult || aSubRes; // concealed: one makes concealed everyone @@ -207,35 +197,39 @@ static bool checkAllSubs(ResultBodyPtr theParent, bool theFlag, std::list(data()->owner()); + // check the whole tree of results: if one is concealed, everybody are + // concealed + ResultBodyPtr anOwner = + std::dynamic_pointer_cast(data()->owner()); if (!anOwner.get()) return; // "this" is invalid ResultBodyPtr aParent = ModelAPI_Tools::bodyOwner(anOwner); - while(aParent.get()) { + while (aParent.get()) { anOwner = aParent; aParent = ModelAPI_Tools::bodyOwner(anOwner); } // iterate all results and collect all results whose state may be updated std::list anUpdated; bool aNewFlag = !myLastConcealed; - if (checkAllSubs(anOwner, aNewFlag, anUpdated)) { // state of everyone must be updated + if (checkAllSubs(anOwner, aNewFlag, + anUpdated)) { // state of everyone must be updated std::list::iterator aRes = anUpdated.begin(); - for(; aRes != anUpdated.end(); aRes++) { + for (; aRes != anUpdated.end(); aRes++) { bool aLastConcealed = (*aRes)->isConcealed(); if (aNewFlag != aLastConcealed) { - std::dynamic_pointer_cast(*aRes)->myLastConcealed = aNewFlag; + std::dynamic_pointer_cast(*aRes)->myLastConcealed = + aNewFlag; if (aNewFlag) { // become concealed, behaves like removed ModelAPI_EventCreator::get()->sendDeleted(document(), groupName()); } else { // become not-concealed, behaves like created - static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); + static Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_CREATED); ModelAPI_EventCreator::get()->sendUpdated(*aRes, anEvent); } static Events_ID EVENT_DISP = // must be redisplayed in any case - Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(*aRes, EVENT_DISP); } } @@ -243,47 +237,49 @@ void Model_ResultBody::updateConcealment() } } -void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector& color) { +void Model_ResultBody::addShapeColor(const std::wstring &theName, + std::vector &color) { if (myColorsShape.find(theName) == myColorsShape.end()) - myColorsShape[ theName ] = color; + myColorsShape[theName] = color; } -std::wstring Model_ResultBody::addShapeName(std::shared_ptr theshape, - const std::wstring& theName ){ +std::wstring +Model_ResultBody::addShapeName(std::shared_ptr theshape, + const std::wstring &theName) { int indice = 1; std::wstringstream aName; aName << theName; - while(myNamesShape.find(aName.str()) != myNamesShape.end() ){ + while (myNamesShape.find(aName.str()) != myNamesShape.end()) { aName.str(L""); aName << theName << L"__" << indice; indice++; } - myNamesShape[ aName.str() ] = theshape; + myNamesShape[aName.str()] = theshape; return aName.str(); } -std::wstring Model_ResultBody::findShapeName(std::shared_ptr theShape){ +std::wstring +Model_ResultBody::findShapeName(std::shared_ptr theShape) { - TopoDS_Shape aShape = theShape->impl(); - for (std::map< std::wstring, std::shared_ptr >::iterator it = - myNamesShape.begin(); - it != myNamesShape.end(); - ++it) - { + TopoDS_Shape aShape = theShape->impl(); + for (std::map>::iterator it = + myNamesShape.begin(); + it != myNamesShape.end(); ++it) { TopoDS_Shape curSelectedShape = (*it).second->impl(); - if ((aShape.IsSame(curSelectedShape))) { + if ((aShape.IsSame(curSelectedShape))) { return (*it).first; } } - return L"material not found" ; + return L"material not found"; } -const std::vector& Model_ResultBody::findShapeColor(const std::wstring& theShapeName) -{ - std::map >::iterator aColor = myColorsShape.find(theShapeName); +const std::vector & +Model_ResultBody::findShapeColor(const std::wstring &theShapeName) { + std::map>::iterator aColor = + myColorsShape.find(theShapeName); if (aColor != myColorsShape.end()) return aColor->second; static std::vector anEmptyVector; @@ -291,25 +287,24 @@ const std::vector& Model_ResultBody::findShapeColor(const std::wstring& the } void Model_ResultBody::setShapeName( - std::map< std::wstring, std::shared_ptr>& theShapeName, - std::map< std::wstring, std::vector>& theColorsShape) -{ + std::map> &theShapeName, + std::map> &theColorsShape) { myNamesShape = theShapeName; myColorsShape = theColorsShape; } -void Model_ResultBody::clearShapeNameAndColor(){ +void Model_ResultBody::clearShapeNameAndColor() { myNamesShape.clear(); myColorsShape.clear(); } -void Model_ResultBody::updateSubs(const std::shared_ptr& theThisShape, - const bool theShapeChanged) -{ - static Events_Loop* aLoop = Events_Loop::loop(); +void Model_ResultBody::updateSubs( + const std::shared_ptr &theThisShape, + const bool theShapeChanged) { + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); static Events_ID EVENT_UPD = aLoop->eventByName(EVENT_OBJECT_UPDATED); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); // erase flag that topology is connected: the shape is new if (theShapeChanged && data().get()) { TDF_Label aDataLab = std::dynamic_pointer_cast(data())->label(); @@ -318,45 +313,49 @@ void Model_ResultBody::updateSubs(const std::shared_ptr& theThisS isConnectedTopology(); // to store this flag in transaction, #2630 } } - // iterate all sub-solids of compsolid to make sub-results synchronized with them + // iterate all sub-solids of compsolid to make sub-results synchronized with + // them TopoDS_Shape aThisShape; - if (theThisShape.get()) aThisShape = theThisShape->impl(); + if (theThisShape.get()) + aThisShape = theThisShape->impl(); if (!aThisShape.IsNull() && (aThisShape.ShapeType() == TopAbs_COMPSOLID || - aThisShape.ShapeType() == TopAbs_COMPOUND)) { + aThisShape.ShapeType() == TopAbs_COMPOUND)) { bool aWasEmpty = mySubs.empty(); - Model_Objects* anObjects = std::dynamic_pointer_cast(document())->objects(); + Model_Objects *anObjects = + std::dynamic_pointer_cast(document())->objects(); unsigned int aSubIndex = 0; TopoDS_Iterator aShapesIter(aThisShape); - for(; aShapesIter.More(); aShapesIter.Next(), aSubIndex++) { + for (; aShapesIter.More(); aShapesIter.Next(), aSubIndex++) { std::shared_ptr aShape(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(aShapesIter.Value())); ResultBodyPtr aSub; - if (mySubs.size() <= aSubIndex) { // it is needed to create a new sub-result + if (mySubs.size() <= + aSubIndex) { // it is needed to create a new sub-result std::wstring thenameshape = L""; // find shape name read - for (std::map< std::wstring, std::shared_ptr >::iterator it = - myNamesShape.begin(); - it != myNamesShape.end(); - ++it) - { - TopoDS_Shape curSelectedShape = (*it).second->impl(); - if (!(aShapesIter.Value().IsSame(curSelectedShape))) continue; - thenameshape = (*it).first; - break; + for (std::map>::iterator + it = myNamesShape.begin(); + it != myNamesShape.end(); ++it) { + TopoDS_Shape curSelectedShape = (*it).second->impl(); + if (!(aShapesIter.Value().IsSame(curSelectedShape))) + continue; + thenameshape = (*it).first; + break; } - aSub = anObjects->createBody(this->data(), aSubIndex,thenameshape); - //finf color read - std::map< std::wstring, std::vector>::iterator itColor = - myColorsShape.find(thenameshape); - if (itColor != myColorsShape.end()){ - ModelAPI_Tools::setColor(aSub,(*itColor).second); + aSub = anObjects->createBody(this->data(), aSubIndex, thenameshape); + // finf color read + std::map>::iterator itColor = + myColorsShape.find(thenameshape); + if (itColor != myColorsShape.end()) { + ModelAPI_Tools::setColor(aSub, (*itColor).second); } - aSub->setShapeName(myNamesShape,myColorsShape); + aSub->setShapeName(myNamesShape, myColorsShape); mySubs.push_back(aSub); mySubsMap[aSub] = int(mySubs.size() - 1); if (isConcealed()) { // for issue #2579 note7 aSub->ModelAPI_ResultBody::setIsConcealed(true); - std::dynamic_pointer_cast(aSub)->updateConcealment(); + std::dynamic_pointer_cast(aSub) + ->updateConcealment(); } } else { // just update shape of this result @@ -367,8 +366,8 @@ void Model_ResultBody::updateSubs(const std::shared_ptr& theThisS if (myAlgo.get()) { std::list anOldForSub; computeOldForSub(aShape, myOlds, anOldForSub); - myIsGenerated ? aSub->storeGenerated(anOldForSub, aShape, myAlgo) : - aSub->storeModified(anOldForSub, aShape, myAlgo); + myIsGenerated ? aSub->storeGenerated(anOldForSub, aShape, myAlgo) + : aSub->storeModified(anOldForSub, aShape, myAlgo); } else { aSub->store(aShape, false); } @@ -378,41 +377,47 @@ void Model_ResultBody::updateSubs(const std::shared_ptr& theThisS aSub->setDisabled(aSub, isDisabled()); } // erase left, unused results - while(mySubs.size() > aSubIndex) { + while (mySubs.size() > aSubIndex) { ResultBodyPtr anErased = *(mySubs.rbegin()); if (anErased->ModelAPI_ResultBody::isConcealed()) { anErased->ModelAPI_ResultBody::setIsConcealed(false); - std::dynamic_pointer_cast(anErased)->updateConcealment(); + std::dynamic_pointer_cast(anErased) + ->updateConcealment(); } anErased->setDisabled(anErased, true); mySubsMap.erase(anErased); mySubs.pop_back(); } if (aWasEmpty) { // erase all subs - // redisplay this because result with and without subs are displayed differently + // redisplay this because result with and without subs are displayed + // differently aECreator->sendUpdated(data()->owner(), EVENT_DISP); } cleanCash(); } else if (!mySubs.empty()) { // erase all subs - while(!mySubs.empty()) { + while (!mySubs.empty()) { ResultBodyPtr anErased = *(mySubs.rbegin()); if (anErased->ModelAPI_ResultBody::isConcealed()) { anErased->ModelAPI_ResultBody::setIsConcealed(false); - std::dynamic_pointer_cast(anErased)->updateConcealment(); + std::dynamic_pointer_cast(anErased) + ->updateConcealment(); } - anErased->setDisabled(anErased, true); // even if it is invalid (to erase subs on abort/undo) + anErased->setDisabled( + anErased, + true); // even if it is invalid (to erase subs on abort/undo) mySubs.pop_back(); } mySubsMap.clear(); - // redisplay this because result with and without subs are displayed differently + // redisplay this because result with and without subs are displayed + // differently aECreator->sendUpdated(data()->owner(), EVENT_DISP); } } void Model_ResultBody::updateSubs( - const GeomShapePtr& theThisShape, const std::list& theOlds, - const std::shared_ptr theMakeShape, const bool isGenerated) -{ + const GeomShapePtr &theThisShape, const std::list &theOlds, + const std::shared_ptr theMakeShape, + const bool isGenerated) { myAlgo = theMakeShape; myOlds = theOlds; myIsGenerated = isGenerated; @@ -425,8 +430,7 @@ void Model_ResultBody::updateSubs( myHistoryCash.Clear(); } -bool Model_ResultBody::isConnectedTopology() -{ +bool Model_ResultBody::isConnectedTopology() { TDF_Label aDataLab = std::dynamic_pointer_cast(data())->label(); if (!aDataLab.IsNull()) { if (aDataLab.IsAttribute(kUpdateConnectedTopology)) { // recompute state @@ -443,40 +447,39 @@ bool Model_ResultBody::isConnectedTopology() return false; // invalid case } -void Model_ResultBody::cleanCash() -{ +void Model_ResultBody::cleanCash() { myBuilder->cleanCash(); for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); ++aSubIter) - { - const ResultBodyPtr& aSub = *aSubIter; + aSubIter != mySubs.cend(); ++aSubIter) { + const ResultBodyPtr &aSub = *aSubIter; aSub->cleanCash(); } } -bool Model_ResultBody::hasTexture() -{ +bool Model_ResultBody::hasTexture() { AttributeImagePtr anImageAttr = - data()->image(ModelAPI_ResultBody::IMAGE_ID()); + data()->image(ModelAPI_ResultBody::IMAGE_ID()); if (anImageAttr.get()) { return anImageAttr->hasTexture(); } return false; } -// adds to the theSubSubs map all sub-shapes of theSub if it is compound of compsolid -static void collectSubs( - const GeomShapePtr theSub, TopTools_MapOfShape& theSubSubs, const bool theOneLevelMore) -{ +// adds to the theSubSubs map all sub-shapes of theSub if it is compound of +// compsolid +static void collectSubs(const GeomShapePtr theSub, + TopTools_MapOfShape &theSubSubs, + const bool theOneLevelMore) { if (theSub->isNull()) return; - if (theSubSubs.Add(theSub->impl())) { + if (theSubSubs.Add(theSub->impl())) { bool aIsComp = theSub->isCompound() || theSub->isCompSolid(); if (aIsComp) { - for(GeomAPI_ShapeIterator anIter(theSub); anIter.more(); anIter.next()) + for (GeomAPI_ShapeIterator anIter(theSub); anIter.more(); anIter.next()) collectSubs(anIter.current(), theSubSubs, theOneLevelMore); } else if (theOneLevelMore) { - GeomAPI_Shape::ShapeType aSubType = GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1); + GeomAPI_Shape::ShapeType aSubType = + GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1); if (aSubType == GeomAPI_Shape::SHAPE) return; if (aSubType == GeomAPI_Shape::SHELL) @@ -484,17 +487,19 @@ static void collectSubs( if (aSubType == GeomAPI_Shape::WIRE) aSubType = GeomAPI_Shape::EDGE; - for(GeomAPI_ShapeExplorer anExp(theSub, aSubType); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(theSub, aSubType); anExp.more(); + anExp.next()) { collectSubs(anExp.current(), theSubSubs, false); } } } } -void Model_ResultBody::computeOldForSub(const GeomShapePtr& theSub, - const std::list& theAllOlds, std::list& theOldForSub) -{ - // the old can be also used for sub-shape of theSub; collect all subs of compound or compsolid +void Model_ResultBody::computeOldForSub( + const GeomShapePtr &theSub, const std::list &theAllOlds, + std::list &theOldForSub) { + // the old can be also used for sub-shape of theSub; collect all subs of + // compound or compsolid TopTools_MapOfShape aSubSubs; collectSubs(theSub, aSubSubs, false); @@ -504,44 +509,54 @@ void Model_ResultBody::computeOldForSub(const GeomShapePtr& theSub, TopTools_MapOfShape anOldSubs; // iterate one level more (for intersection of solids this is face) collectSubs(*aRootOlds, anOldSubs, true); - for (TopTools_MapOfShape::Iterator anOldIter(anOldSubs); anOldIter.More(); anOldIter.Next()) { + for (TopTools_MapOfShape::Iterator anOldIter(anOldSubs); anOldIter.More(); + anOldIter.Next()) { TopoDS_Shape anOldShape = anOldIter.Value(); - if (anOldShape.ShapeType() == TopAbs_COMPOUND || anOldShape.ShapeType() == TopAbs_SHELL || - anOldShape.ShapeType() == TopAbs_WIRE || anOldShape.ShapeType() == TopAbs_COMPSOLID) - continue; // container old-shapes are not supported by the history, may cause crash + if (anOldShape.ShapeType() == TopAbs_COMPOUND || + anOldShape.ShapeType() == TopAbs_SHELL || + anOldShape.ShapeType() == TopAbs_WIRE || + anOldShape.ShapeType() == TopAbs_COMPSOLID) + continue; // container old-shapes are not supported by the history, may + // cause crash GeomShapePtr anOldSub(new GeomAPI_Shape); anOldSub->setImpl(new TopoDS_Shape(anOldShape)); ListOfShape aNews; if (myHistoryCash.IsBound(anOldShape)) { - const TopTools_ListOfShape& aList = myHistoryCash.Find(anOldShape); - for(TopTools_ListIteratorOfListOfShape anIter(aList); anIter.More(); anIter.Next()) { + const TopTools_ListOfShape &aList = myHistoryCash.Find(anOldShape); + for (TopTools_ListIteratorOfListOfShape anIter(aList); anIter.More(); + anIter.Next()) { GeomShapePtr aShape(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(anIter.Value())); aNews.push_back(aShape); } } else { - myIsGenerated ? myAlgo->generated(anOldSub, aNews) : myAlgo->modified(anOldSub, aNews); - // MakeShape may return alone old shape if there is no history information for this input + myIsGenerated ? myAlgo->generated(anOldSub, aNews) + : myAlgo->modified(anOldSub, aNews); + // MakeShape may return alone old shape if there is no history + // information for this input if (aNews.size() == 1 && aNews.front()->isEqual(anOldSub)) aNews.clear(); // store result in the history TopTools_ListOfShape aList; - for (ListOfShape::iterator aNewIter = aNews.begin(); aNewIter != aNews.end(); aNewIter++) { + for (ListOfShape::iterator aNewIter = aNews.begin(); + aNewIter != aNews.end(); aNewIter++) { aList.Append((*aNewIter)->impl()); } myHistoryCash.Bind(anOldShape, aList); } - for (ListOfShape::iterator aNewIter = aNews.begin(); aNewIter != aNews.end(); aNewIter++) { + for (ListOfShape::iterator aNewIter = aNews.begin(); + aNewIter != aNews.end(); aNewIter++) { if (aSubSubs.Contains((*aNewIter)->impl())) { // check list already contains this sub std::list::iterator aResIter = theOldForSub.begin(); - for(; aResIter != theOldForSub.end(); aResIter++) + for (; aResIter != theOldForSub.end(); aResIter++) if ((*aResIter)->isSame(anOldSub)) break; if (aResIter == theOldForSub.end()) - theOldForSub.push_back(anOldSub); // found old used for new theSubShape creation + theOldForSub.push_back( + anOldSub); // found old used for new theSubShape creation break; } } diff --git a/src/Model/Model_ResultBody.h b/src/Model/Model_ResultBody.h index b00fb22d2..9dca0ced9 100644 --- a/src/Model/Model_ResultBody.h +++ b/src/Model/Model_ResultBody.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_ResultBody_H_ @@ -22,93 +23,105 @@ #include "Model.h" #include -#include #include +#include #include /**\class Model_ResultBody -* \ingroup DataModel -* \brief The body (shape) result of a feature. -* -* Provides a shape that may be displayed in the viewer. -* May provide really huge results, so, working with this kind -* of result must be optimized. -* Also provides a container of sub-body result in case it is compound or compsolid. -*/ -class Model_ResultBody : public ModelAPI_ResultBody -{ + * \ingroup DataModel + * \brief The body (shape) result of a feature. + * + * Provides a shape that may be displayed in the viewer. + * May provide really huge results, so, working with this kind + * of result must be optimized. + * Also provides a container of sub-body result in case it is compound or + * compsolid. + */ +class Model_ResultBody : public ModelAPI_ResultBody { /// Sub-bodies if this is compsolid or compound: zero-based index to subs std::vector mySubs; - /// Also keep map of result to index in mySubs to facilitate speed of access from OB + /// Also keep map of result to index in mySubs to facilitate speed of access + /// from OB std::map mySubsMap; - /// Keeps the last state of the concealment flag in order to update it when needed. + /// Keeps the last state of the concealment flag in order to update it when + /// needed. bool myLastConcealed; /// History information for update subs std::shared_ptr myAlgo; /// All old shapes used for the root result construction std::list myOlds; - /// Information about the kind of the history information: modified or generated + /// Information about the kind of the history information: modified or + /// generated bool myIsGenerated; /// Map from old shape to list of new shapes, cash for computeOldForSub method TopTools_DataMapOfShapeListOfShape myHistoryCash; public: - /// Removes the stored builders MODEL_EXPORT virtual ~Model_ResultBody(); - /// Request for initialization of data model of the result body: adding all attributes + /// Request for initialization of data model of the result body: adding all + /// attributes virtual void initAttributes(); - /// Records the subshape newShape which was generated during a topological construction. - /// As an example, consider the case of a face generated in construction of a box. - MODEL_EXPORT virtual bool generated(const GeomShapePtr& theNewShape, - const std::string& theName, const bool theCheckIsInResult = true) override; + /// Records the subshape newShape which was generated during a topological + /// construction. As an example, consider the case of a face generated in + /// construction of a box. + MODEL_EXPORT virtual bool + generated(const GeomShapePtr &theNewShape, const std::string &theName, + const bool theCheckIsInResult = true) override; /// load generated shapes MODEL_EXPORT - virtual void loadGeneratedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "", - const bool theSaveOldIfNotInTree = false) override; + virtual void + loadGeneratedShapes(const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "", + const bool theSaveOldIfNotInTree = false) override; /// load modified shapes for sub-objects MODEL_EXPORT - virtual void loadModifiedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "") override; + virtual void + loadModifiedShapes(const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "") override; /// load shapes of the first level (to be used during shape import) - MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, const std::string& theName); + MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, + const std::string &theName); /// Returns the number of sub-elements MODEL_EXPORT virtual int numberOfSubs(bool forTree = false) const; /// Returns the sub-result by zero-base index MODEL_EXPORT virtual ResultBodyPtr subResult(const int theIndex, - bool forTree = false) const; + bool forTree = false) const; /// Returns true if feature or result belong to this composite feature as subs /// Returns theIndex - zero based index of sub if found - MODEL_EXPORT virtual bool isSub(ObjectPtr theObject, int& theIndex) const; + MODEL_EXPORT virtual bool isSub(ObjectPtr theObject, int &theIndex) const; - /// Returns the parameters of color definition in the resources configuration manager - MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + /// Returns the parameters of color definition in the resources configuration + /// manager + MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); - /// Disables the result body: keeps the resulting shape as selection, but erases the underlaying - /// naming data structure if theFlag if false. Or restores every thing on theFlag is true. - MODEL_EXPORT virtual bool setDisabled(std::shared_ptr theThis, - const bool theFlag); + /// Disables the result body: keeps the resulting shape as selection, but + /// erases the underlaying naming data structure if theFlag if false. Or + /// restores every thing on theFlag is true. + MODEL_EXPORT virtual bool + setDisabled(std::shared_ptr theThis, const bool theFlag); /// The compsolid is concealed if at least one of the sub is concealed MODEL_EXPORT virtual bool isConcealed(); /// Sets all subs as concealed in the data tree (referenced by other objects) - MODEL_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false); + MODEL_EXPORT virtual void setIsConcealed(const bool theValue, + const bool theForced = false); /// Returns true is the topology is connected. MODEL_EXPORT virtual bool isConnectedTopology(); @@ -121,41 +134,46 @@ public: /// Find the imported color by the construction name of a shape. /// Returns empty vector if not found. - MODEL_EXPORT virtual const std::vector& findShapeColor(const std::wstring& theShapeName); + MODEL_EXPORT virtual const std::vector & + findShapeColor(const std::wstring &theShapeName); protected: /// Makes a body on the given feature Model_ResultBody(); /// Updates the sub-bodies if shape of this object is composite-solid - void updateSubs(const std::shared_ptr& theThisShape, + void updateSubs(const std::shared_ptr &theThisShape, const bool theShapeChanged = true); /// Updates the sub-bodies in accordance to the algorithm history information - void updateSubs( - const GeomShapePtr& theThisShape, const std::list& theOlds, - const std::shared_ptr theMakeShape, const bool isGenerated); + void updateSubs(const GeomShapePtr &theThisShape, + const std::list &theOlds, + const std::shared_ptr theMakeShape, + const bool isGenerated); - /// Checks the state of children and parents to send events of creation/erase when needed + /// Checks the state of children and parents to send events of creation/erase + /// when needed void updateConcealment(); /// Adds to theOldForSub only old shapes that where used for theSub creation - void computeOldForSub(const GeomShapePtr& theSub, - const std::list& theAllOlds, std::list& theOldForSub); + void computeOldForSub(const GeomShapePtr &theSub, + const std::list &theAllOlds, + std::list &theOldForSub); friend class Model_Objects; /// Add shape Name for read shape in step file - std::wstring addShapeName(std::shared_ptr,const std::wstring& theName) override; + std::wstring addShapeName(std::shared_ptr, + const std::wstring &theName) override; /// Add color for shape Name read shape in step file - void addShapeColor( const std::wstring& theName,std::vector& color) override; + void addShapeColor(const std::wstring &theName, + std::vector &color) override; /// Set the map of name and color read shape in step file - void setShapeName(std::map< std::wstring, - std::shared_ptr>& theShapeName, - std::map< std::wstring, - std::vector>& theColorsShape) override; + void setShapeName( + std::map> &theShapeName, + std::map> &theColorsShape) override; /// Find the name of shape read in step file std::wstring findShapeName(std::shared_ptr theShape) override; @@ -164,11 +182,10 @@ protected: void clearShapeNameAndColor() override; /// map with the name read in step file and shape - std::map< std::wstring, std::shared_ptr > myNamesShape; + std::map> myNamesShape; /// map from the construction name to the imported color - std::map< std::wstring, std::vector> myColorsShape; - + std::map> myColorsShape; }; #endif diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 6307b4130..029179a32 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -14,41 +14,43 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include -#include -#include -#include +#include #include #include -#include -#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include #include #include #include -#include +#include +#include +#include +#include #include #include -#include #include -#include -#include -#include +#include #include -typedef NCollection_IndexedDataMap MapFaceToEdgeIndices; +typedef NCollection_IndexedDataMap + MapFaceToEdgeIndices; /// Convert each edge of sketch to corresponding integer value /// \param[in] theComposite sketch feature @@ -56,19 +58,19 @@ typedef NCollection_IndexedDataMap MapFaceTo /// \param[out] theEdgesIndices indexed edge /// \param[out] theEdgesNames indexed name for edge static void indexingSketchEdges( - const CompositeFeaturePtr& theComposite, - NCollection_DataMap& theCurvesIndices, - NCollection_DataMap& theEdgesIndices, - std::map& theEdgesNames); + const CompositeFeaturePtr &theComposite, + NCollection_DataMap &theCurvesIndices, + NCollection_DataMap &theEdgesIndices, + std::map &theEdgesNames); /// Convert each face to the list of indices of its edges /// \param[in] theFaces list of faces to proceed /// \param[in] theCurvesIndices index of each curve /// \param[out] theFaceEdges map face to indices of its edges static void faceToEdgeIndices( - const ListOfShape& theFaces, - const NCollection_DataMap& theCurvesIndices, - MapFaceToEdgeIndices& theFaceEdges); + const ListOfShape &theFaces, + const NCollection_DataMap &theCurvesIndices, + MapFaceToEdgeIndices &theFaceEdges); /// Assign faces to tags for the specified label /// \param theDocument current document @@ -80,50 +82,48 @@ static void faceToEdgeIndices( /// \param theFaceEdges indices of edges for each face /// \param theEdgesIndices indices of edges /// \param theEdgesNames named of edges -static void storeFacesOnLabel(std::shared_ptr& theDocument, - TDF_Label& theShapeLabel, - const std::wstring& theName, - const TopoDS_Shape& theShape, - NCollection_DataMap& theFacesOrder, - NCollection_List& theUnorderedFaces, - const MapFaceToEdgeIndices& theFaceEdges, - const NCollection_DataMap& theEdgesIndices, - const std::map& theEdgesNames); - +static void +storeFacesOnLabel(std::shared_ptr &theDocument, + TDF_Label &theShapeLabel, const std::wstring &theName, + const TopoDS_Shape &theShape, + NCollection_DataMap &theFacesOrder, + NCollection_List &theUnorderedFaces, + const MapFaceToEdgeIndices &theFaceEdges, + const NCollection_DataMap &theEdgesIndices, + const std::map &theEdgesNames); // identifier of the infinite result Standard_GUID kIS_INFINITE("dea8cc5a-53f2-49c1-94e8-a947bed20a9f"); // identifier of the result not in history Standard_GUID kIS_IN_HISTORY("a9aec01c-805e-44d1-b5d2-a63f06522f8a"); -void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void Model_ResultConstruction::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = RESULT_COLOR_NAME(); theDefault = DEFAULT_COLOR(); } -void Model_ResultConstruction::setShape(std::shared_ptr theShape) -{ +void Model_ResultConstruction::setShape( + std::shared_ptr theShape) { if (myShape != theShape) { storeShape(theShape); if (!theShape.get() || !theShape->isEqual(myShape)) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent); } myShape = theShape; } } -std::shared_ptr Model_ResultConstruction::shape() -{ +std::shared_ptr Model_ResultConstruction::shape() { return myShape; } -static std::wstring shortName( - std::shared_ptr& theConstr) -{ +static std::wstring +shortName(std::shared_ptr &theConstr) { std::wstring aName = theConstr->data()->name(); // remove "-", "/" and "&" command-symbols aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end()); @@ -133,16 +133,16 @@ static std::wstring shortName( // they are used as markers of start/end/forward/reversed indicators static const std::wstring aSyms(L"sefr"); std::wstring::iterator aSuffix = aName.end() - 1; - while(aSyms.find(*aSuffix) != std::wstring::npos) { + while (aSyms.find(*aSuffix) != std::wstring::npos) { --aSuffix; } aName.erase(aSuffix + 1, aName.end()); return aName; } -bool Model_ResultConstruction::updateShape() -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +bool Model_ResultConstruction::updateShape() { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData && aData->isValid()) { TDF_Label aShapeLab = aData->shapeLab(); Handle(TNaming_NamedShape) aNS; @@ -151,16 +151,20 @@ bool Model_ResultConstruction::updateShape() if (!aShape.IsNull()) { if (aShape.ShapeType() == TopAbs_COMPOUND) { // restore the sketch planar edges object - std::shared_ptr aBigWire(new GeomAPI_PlanarEdges); + std::shared_ptr aBigWire( + new GeomAPI_PlanarEdges); aBigWire->setImpl(new TopoDS_Shape(aShape)); - FeaturePtr aSketch = - document()->feature(std::dynamic_pointer_cast(data()->owner())); + FeaturePtr aSketch = document()->feature( + std::dynamic_pointer_cast(data()->owner())); std::shared_ptr anOrigin = - std::dynamic_pointer_cast(aSketch->data()->attribute("Origin")); + std::dynamic_pointer_cast( + aSketch->data()->attribute("Origin")); std::shared_ptr aDirX = - std::dynamic_pointer_cast(aSketch->data()->attribute("DirX")); + std::dynamic_pointer_cast( + aSketch->data()->attribute("DirX")); std::shared_ptr aNorm = - std::dynamic_pointer_cast(aSketch->data()->attribute("Norm")); + std::dynamic_pointer_cast( + aSketch->data()->attribute("Norm")); if (anOrigin.get() && aDirX.get() && aNorm.get()) { aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir()); myShape = aBigWire; @@ -170,7 +174,8 @@ bool Model_ResultConstruction::updateShape() // just restore shape GeomShapePtr aGShape(new GeomAPI_Shape); aGShape->setImpl(new TopoDS_Shape(aShape)); - myShape = GeomAPI_Tools::getTypedShape(aGShape); // restore the sketch sub-components + myShape = GeomAPI_Tools::getTypedShape( + aGShape); // restore the sketch sub-components return true; } } @@ -178,22 +183,21 @@ bool Model_ResultConstruction::updateShape() return false; } -Model_ResultConstruction::Model_ResultConstruction() -{ -} +Model_ResultConstruction::Model_ResultConstruction() {} -bool Model_ResultConstruction::isInHistory() -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +bool Model_ResultConstruction::isInHistory() { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get() && aData->isValid()) { - return !aData->label().IsAttribute(kIS_IN_HISTORY); // by default no attribute, but in history + return !aData->label().IsAttribute( + kIS_IN_HISTORY); // by default no attribute, but in history } - return true; // unknown case + return true; // unknown case } -void Model_ResultConstruction::setIsInHistory(const bool isInHistory) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_ResultConstruction::setIsInHistory(const bool isInHistory) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get() && aData->isValid()) { if (!isInHistory) TDataStd_UAttribute::Set(aData->label(), kIS_IN_HISTORY); @@ -202,18 +206,18 @@ void Model_ResultConstruction::setIsInHistory(const bool isInHistory) } } -bool Model_ResultConstruction::isInfinite() -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +bool Model_ResultConstruction::isInfinite() { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get() && aData->isValid()) { return aData->label().IsAttribute(kIS_INFINITE); } - return false; // unknown case + return false; // unknown case } -void Model_ResultConstruction::setInfinite(const bool theInfinite) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_ResultConstruction::setInfinite(const bool theInfinite) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get() && aData->isValid()) { if (theInfinite) TDataStd_UAttribute::Set(aData->label(), kIS_INFINITE); @@ -222,10 +226,10 @@ void Model_ResultConstruction::setInfinite(const bool theInfinite) } } -int Model_ResultConstruction::facesNum(const bool /*theUpdateNaming*/) -{ +int Model_ResultConstruction::facesNum(const bool /*theUpdateNaming*/) { int aResult = 0; - std::shared_ptr aData = std::dynamic_pointer_cast(data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get() && aData->isValid()) { TDF_Label aShapeLab = aData->shapeLab(); TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID()); @@ -236,18 +240,20 @@ int Model_ResultConstruction::facesNum(const bool /*theUpdateNaming*/) return aResult; } -std::shared_ptr Model_ResultConstruction::face(const int theIndex) -{ +std::shared_ptr +Model_ResultConstruction::face(const int theIndex) { std::shared_ptr aResult; int anIndex = 0; - std::shared_ptr aData = std::dynamic_pointer_cast(data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData.get() && aData->isValid()) { TDF_Label aShapeLab = aData->shapeLab(); TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID()); for (; anOldIter.More(); anOldIter.Next()) { if (anIndex == theIndex) { Handle(TNaming_NamedShape) aNS; - anOldIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS); + anOldIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), + aNS); aResult.reset(new GeomAPI_Face); aResult->setImpl(new TopoDS_Shape(aNS->Get())); break; @@ -258,17 +264,18 @@ std::shared_ptr Model_ResultConstruction::face(const int theIndex) return aResult; } -void Model_ResultConstruction::setIsConcealed(const bool theValue, const bool theForced) -{ +void Model_ResultConstruction::setIsConcealed(const bool theValue, + const bool theForced) { // the construction element may be concealed only by "delete" feature if (!theValue || theForced) { ModelAPI_ResultConstruction::setIsConcealed(theValue, theForced); } } -void Model_ResultConstruction::storeShape(std::shared_ptr theShape) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_ResultConstruction::storeShape( + std::shared_ptr theShape) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData && aData->isValid()) { std::wstring aMyName = data()->name(); TDF_Label aShapeLab = aData->shapeLab(); @@ -278,26 +285,27 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap return; } std::shared_ptr aMyDoc = - std::dynamic_pointer_cast(document()); - const TopoDS_Shape& aShape = theShape->impl(); + std::dynamic_pointer_cast(document()); + const TopoDS_Shape &aShape = theShape->impl(); if (isInfinite() || aShape.ShapeType() == TopAbs_VERTEX) { aShapeLab.ForgetAllAttributes(); // clear all previously stored TNaming_Builder aBuilder(aShapeLab); aBuilder.Generated(aShape); TDataStd_Name::Set(aShapeLab, aMyName.c_str()); aMyDoc->addNamingName(aShapeLab, aMyName); - } else if (aShape.ShapeType() == TopAbs_EDGE) { // store sub-vertices on sub-labels + } else if (aShape.ShapeType() == + TopAbs_EDGE) { // store sub-vertices on sub-labels aShapeLab.ForgetAllAttributes(); // clear all previously stored TNaming_Builder aBuilder(aShapeLab); aBuilder.Generated(aShape); TopExp_Explorer anExp(aShape, TopAbs_VERTEX); - for(int anIndex = 1; anExp.More(); anExp.Next(), anIndex++) { + for (int anIndex = 1; anExp.More(); anExp.Next(), anIndex++) { TDF_Label aSubLab = aShapeLab.FindChild(anIndex); TNaming_Builder aSubBuilder(aSubLab); aSubBuilder.Generated(anExp.Current()); - std::wstring aVertexName = aMyName + L"_" + - (anIndex == 1 ? L"StartVertex" : L"EndVertex"); + std::wstring aVertexName = + aMyName + L"_" + (anIndex == 1 ? L"StartVertex" : L"EndVertex"); TDataStd_Name::Set(aSubLab, aVertexName.c_str()); aMyDoc->addNamingName(aSubLab, aVertexName); } @@ -305,58 +313,65 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap aMyDoc->addNamingName(aShapeLab, aMyName); } else { // this is probably sketch, so, work with it as with composite std::shared_ptr aWirePtr = - std::dynamic_pointer_cast(theShape); + std::dynamic_pointer_cast(theShape); if (!aWirePtr.get()) return; // unknown case - ResultPtr aThisPtr = std::dynamic_pointer_cast(data()->owner()); + ResultPtr aThisPtr = + std::dynamic_pointer_cast(data()->owner()); FeaturePtr aThisFeature = aMyDoc->feature(aThisPtr); CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aThisFeature); + std::dynamic_pointer_cast(aThisFeature); if (!aComposite || aComposite->numberOfSubs() == 0) return; // unknown case // collect indices of curves of current composite NCollection_DataMap aCurvesIndices; NCollection_DataMap anEdgeIndices; - std::map aComponentsNames; // names of components that lay on index - indexingSketchEdges(aComposite, aCurvesIndices, anEdgeIndices, aComponentsNames); - - GeomAlgoAPI_SketchBuilder aSketchBuilder(aWirePtr->origin(), aWirePtr->dirX(), - aWirePtr->norm(), aWirePtr); - const ListOfShape& aFaces = aSketchBuilder.faces(); - // order is important to store faces in the same order if sketch is created from scratch + std::map + aComponentsNames; // names of components that lay on index + indexingSketchEdges(aComposite, aCurvesIndices, anEdgeIndices, + aComponentsNames); + + GeomAlgoAPI_SketchBuilder aSketchBuilder( + aWirePtr->origin(), aWirePtr->dirX(), aWirePtr->norm(), aWirePtr); + const ListOfShape &aFaces = aSketchBuilder.faces(); + // order is important to store faces in the same order if sketch is + // created from scratch MapFaceToEdgeIndices aNewIndices; // edges indices faceToEdgeIndices(aFaces, aCurvesIndices, aNewIndices); - NCollection_DataMap aFacesOrder; // faces -> tag where they must be set - NCollection_List anUnorderedFaces; // faces that may be located at any index + NCollection_DataMap + aFacesOrder; // faces -> tag where they must be set + NCollection_List + anUnorderedFaces; // faces that may be located at any index // searching for the best new candidate to old location MapFaceToEdgeIndices::Iterator aNewIter(aNewIndices); for (; aNewIter.More(); aNewIter.Next()) { double aBestFound = 0, aBestNotFound = 1.e+100; int aBestTag = 0; - const TColStd_ListOfInteger& aNewInd = aNewIter.Value(); + const TColStd_ListOfInteger &aNewInd = aNewIter.Value(); // old faces indices where they where located - TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID()); + TDF_ChildIDIterator anOldIter(aShapeLab, + TDataStd_IntPackedMap::GetID()); for (; anOldIter.More(); anOldIter.Next()) { int aTag = anOldIter.Value()->Label().Tag(); if (aFacesOrder.IsBound(aTag)) continue; // already found a best candidate Handle(TDataStd_IntPackedMap) anOldIndices = - Handle(TDataStd_IntPackedMap)::DownCast(anOldIter.Value()); + Handle(TDataStd_IntPackedMap)::DownCast(anOldIter.Value()); double aFound = 0, aNotFound = 0; TColStd_ListOfInteger::Iterator aNewIndIter(aNewInd); for (; aNewIndIter.More(); aNewIndIter.Next()) { if (anOldIndices->Contains(aNewIndIter.Value())) { aFound += 1.; - } - else if (anOldIndices->Contains(-aNewIndIter.Value())) { // different orientation + } else if (anOldIndices->Contains( + -aNewIndIter.Value())) { // different orientation aFound += 0.001; - } - else { + } else { aNotFound += 1.; } } - if (aNotFound <= aBestNotFound) { // less and equal to find better "found": #2859 + if (aNotFound <= + aBestNotFound) { // less and equal to find better "found": #2859 if (aFound > aBestFound) { aBestNotFound = aNotFound; aBestFound = aFound; @@ -370,15 +385,17 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap anUnorderedFaces.Append(aNewIter.Key()); } } - storeFacesOnLabel(aMyDoc, aShapeLab, aMyName, aShape, aFacesOrder, anUnorderedFaces, - aNewIndices, anEdgeIndices, aComponentsNames); + storeFacesOnLabel(aMyDoc, aShapeLab, aMyName, aShape, aFacesOrder, + anUnorderedFaces, aNewIndices, anEdgeIndices, + aComponentsNames); } } } -void Model_ResultConstruction::setFacesOrder(const std::list& theFaces) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_ResultConstruction::setFacesOrder( + const std::list &theFaces) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData && aData->isValid()) { std::wstring aMyName = data()->name(); TDF_Label aShapeLab = aData->shapeLab(); @@ -389,24 +406,29 @@ void Model_ResultConstruction::setFacesOrder(const std::list& theFa } std::shared_ptr aMyDoc = std::dynamic_pointer_cast(document()); - const TopoDS_Shape& aShape = aResShape->impl(); + const TopoDS_Shape &aShape = aResShape->impl(); if (aShape.ShapeType() != TopAbs_VERTEX && aShape.ShapeType() != TopAbs_EDGE) { - ResultPtr aThisPtr = std::dynamic_pointer_cast(data()->owner()); + ResultPtr aThisPtr = + std::dynamic_pointer_cast(data()->owner()); FeaturePtr aThisFeature = aMyDoc->feature(aThisPtr); CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aThisFeature); + std::dynamic_pointer_cast(aThisFeature); if (!aComposite || aComposite->numberOfSubs() == 0) return; // unknown case // collect indices of curves of current composite NCollection_DataMap aCurvesIndices; NCollection_DataMap anEdgeIndices; - std::map aComponentsNames; // names of components that lay on index - indexingSketchEdges(aComposite, aCurvesIndices, anEdgeIndices, aComponentsNames); + std::map + aComponentsNames; // names of components that lay on index + indexingSketchEdges(aComposite, aCurvesIndices, anEdgeIndices, + aComponentsNames); ListOfShape aFaces; - NCollection_DataMap aFacesOrder; // faces -> tag where they must be set - NCollection_List anUnorderedFaces; // unordered faces are empty in this case + NCollection_DataMap + aFacesOrder; // faces -> tag where they must be set + NCollection_List + anUnorderedFaces; // unordered faces are empty in this case int aTagId = 0; for (std::list::const_iterator aFIt = theFaces.begin(); aFIt != theFaces.end(); ++aFIt) { @@ -417,38 +439,39 @@ void Model_ResultConstruction::setFacesOrder(const std::list& theFa MapFaceToEdgeIndices aNewIndices; // edges indices faceToEdgeIndices(aFaces, aCurvesIndices, aNewIndices); - storeFacesOnLabel(aMyDoc, aShapeLab, aMyName, aShape, aFacesOrder, anUnorderedFaces, - aNewIndices, anEdgeIndices, aComponentsNames); + storeFacesOnLabel(aMyDoc, aShapeLab, aMyName, aShape, aFacesOrder, + anUnorderedFaces, aNewIndices, anEdgeIndices, + aComponentsNames); } } } -// ========================== Auxiliary functions ========================================= - -void storeFacesOnLabel(std::shared_ptr& theDocument, - TDF_Label& theShapeLabel, - const std::wstring& theName, - const TopoDS_Shape& theShape, - NCollection_DataMap& theFacesOrder, - NCollection_List& theUnorderedFaces, - const MapFaceToEdgeIndices& theFaceEdges, - const NCollection_DataMap& theEdgesIndices, - const std::map& theEdgesNames) -{ +// ========================== Auxiliary functions +// ========================================= + +void storeFacesOnLabel( + std::shared_ptr &theDocument, TDF_Label &theShapeLabel, + const std::wstring &theName, const TopoDS_Shape &theShape, + NCollection_DataMap &theFacesOrder, + NCollection_List &theUnorderedFaces, + const MapFaceToEdgeIndices &theFaceEdges, + const NCollection_DataMap &theEdgesIndices, + const std::map &theEdgesNames) { theShapeLabel.ForgetAllAttributes(); // clear all previously stored TDataStd_Name::Set(theShapeLabel, theName.c_str()); // restore name forgotten - TNaming_Builder aBuilder(theShapeLabel); // store the compound to get it ready on open of document + TNaming_Builder aBuilder( + theShapeLabel); // store the compound to get it ready on open of document aBuilder.Generated(theShape); theDocument->addNamingName(theShapeLabel, theName); // set new faces to the labels NCollection_List::Iterator anUnordered(theUnorderedFaces); - for (int aCurrentTag = 1; !theFacesOrder.IsEmpty() || anUnordered.More(); aCurrentTag++) { + for (int aCurrentTag = 1; !theFacesOrder.IsEmpty() || anUnordered.More(); + aCurrentTag++) { TopoDS_Face aFaceToPut; if (theFacesOrder.IsBound(aCurrentTag)) { aFaceToPut = theFacesOrder.Find(aCurrentTag); theFacesOrder.UnBind(aCurrentTag); - } - else if (anUnordered.More()) { + } else if (anUnordered.More()) { aFaceToPut = anUnordered.Value(); anUnordered.Next(); } @@ -457,7 +480,8 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, continue; TopTools_MapOfShape aFaceEdges; - for (TopExp_Explorer anEdges(aFaceToPut, TopAbs_EDGE); anEdges.More(); anEdges.Next()) + for (TopExp_Explorer anEdges(aFaceToPut, TopAbs_EDGE); anEdges.More(); + anEdges.Next()) aFaceEdges.Add(anEdges.Current()); TDF_Label aLab = theShapeLabel.FindChild(aCurrentTag); @@ -465,49 +489,56 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, aFaceBuilder.Generated(aFaceToPut); // store also indices of the new face edges Handle(TDataStd_IntPackedMap) aNewMap = TDataStd_IntPackedMap::Set(aLab); - const TColStd_ListOfInteger& aNewInd = theFaceEdges.FindFromKey(aFaceToPut); + const TColStd_ListOfInteger &aNewInd = theFaceEdges.FindFromKey(aFaceToPut); std::wstringstream aName; - aName<<"Face"; + aName << "Face"; TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE); TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0; - for(TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More(); anIter.Next()) { + for (TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More(); + anIter.Next()) { int anIndex = anIter.Value(); int aModIndex = anIndex > 0 ? anIndex : -anIndex; aNewMap->Add(anIndex); - aName<<"-"<second; + aName << "-" << theEdgesNames.find(aModIndex)->second; if (anIter.Value() > 0) - aName<<"f"; + aName << "f"; else - aName<<"r"; - // collect all edges of the face which are modified in sub-label of the face + aName << "r"; + // collect all edges of the face which are modified in sub-label of the + // face if (theEdgesIndices.IsBound(aModIndex) && !aFaceEdges.Contains(theEdgesIndices.Find(aModIndex))) { if (!anEdgesBuilder) { TDF_Label anEdgesLabel = aLab.FindChild(1); anEdgesBuilder = new TNaming_Builder(anEdgesLabel); std::ostringstream aSubName; - // tag is needed for Test1922 to distinguish sub-edges of different faces - aSubName<<"SubEdge_"<Modify(theEdgesIndices.Find(aModIndex), aPutEdges.Current()); + anEdgesBuilder->Modify(theEdgesIndices.Find(aModIndex), + aPutEdges.Current()); } - // put also modified vertices, otherwise vertex of original edge has no history + // put also modified vertices, otherwise vertex of original edge has no + // history if (theEdgesIndices.IsBound(aModIndex)) { - TopExp_Explorer aVExpOld(theEdgesIndices.Find(aModIndex), TopAbs_VERTEX); + TopExp_Explorer aVExpOld(theEdgesIndices.Find(aModIndex), + TopAbs_VERTEX); TopExp_Explorer aVExpNew(aPutEdges.Current(), TopAbs_VERTEX); - for(; aVExpNew.More() && aVExpOld.More(); aVExpNew.Next(), aVExpOld.Next()) { + for (; aVExpNew.More() && aVExpOld.More(); + aVExpNew.Next(), aVExpOld.Next()) { if (!aVExpOld.Current().IsSame(aVExpNew.Current())) { if (!aVerticesBuilder) { TDF_Label aVertLabel = aLab.FindChild(2); aVerticesBuilder = new TNaming_Builder(aVertLabel); std::ostringstream aSubName; - // tag is needed for Test1922 to distinguish sub-edges of different faces - aSubName<<"SubVertex_"<Modify(aVExpOld.Current(), aVExpNew.Current()); - } } } @@ -519,16 +550,18 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, delete aVerticesBuilder; TDataStd_Name::Set(aLab, TCollection_ExtendedString(aName.str().c_str())); theDocument->addNamingName(aLab, aName.str()); - // put also wires to sub-labels to correctly select them instead of collection by edges + // put also wires to sub-labels to correctly select them instead of + // collection by edges int aWireTag = 3; // first tag is for SubEdge-s, second - for vertices - for(TopExp_Explorer aWires(aFaceToPut, TopAbs_WIRE); aWires.More(); aWires.Next()) { + for (TopExp_Explorer aWires(aFaceToPut, TopAbs_WIRE); aWires.More(); + aWires.Next()) { TDF_Label aWireLab = aLab.FindChild(aWireTag); TNaming_Builder aWireBuilder(aWireLab); aWireBuilder.Generated(aWires.Current()); std::wostringstream aWireName; - aWireName< 3) - aWireName<<"_"<addNamingName(aWireLab, aWireName.str()); aWireTag++; @@ -536,21 +569,24 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, } } -void indexingSketchEdges(const CompositeFeaturePtr& theComposite, - NCollection_DataMap& theCurvesIndices, - NCollection_DataMap& theEdgesIndices, - std::map& theEdgesNames) -{ +void indexingSketchEdges( + const CompositeFeaturePtr &theComposite, + NCollection_DataMap &theCurvesIndices, + NCollection_DataMap &theEdgesIndices, + std::map &theEdgesNames) { const int aSubNum = theComposite->numberOfSubs(); for (int a = 0; a < aSubNum; a++) { FeaturePtr aSub = theComposite->subFeature(a); - const std::list >& aResults = aSub->results(); - std::list >::const_iterator aRes = aResults.cbegin(); + const std::list> &aResults = + aSub->results(); + std::list>::const_iterator aRes = + aResults.cbegin(); for (; aRes != aResults.cend(); aRes++) { ResultConstructionPtr aConstr = - std::dynamic_pointer_cast(*aRes); + std::dynamic_pointer_cast(*aRes); if (aConstr->shape() && aConstr->shape()->isEdge()) { - TopoDS_Edge anEdge = TopoDS::Edge(aConstr->shape()->impl()); + TopoDS_Edge anEdge = + TopoDS::Edge(aConstr->shape()->impl()); Standard_Real aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); theCurvesIndices.Bind(aCurve, a); @@ -561,11 +597,12 @@ void indexingSketchEdges(const CompositeFeaturePtr& theComposite, } } -void faceToEdgeIndices(const ListOfShape& theFaces, - const NCollection_DataMap& theCurvesIndices, - MapFaceToEdgeIndices& theFaceEdges) -{ - std::list >::const_iterator aFIter = theFaces.begin(); +void faceToEdgeIndices( + const ListOfShape &theFaces, + const NCollection_DataMap &theCurvesIndices, + MapFaceToEdgeIndices &theFaceEdges) { + std::list>::const_iterator aFIter = + theFaces.begin(); for (; aFIter != theFaces.end(); aFIter++) { std::shared_ptr aFace(new GeomAPI_Face(*aFIter)); // put them to a label, trying to keep the same faces on the same labels @@ -573,7 +610,8 @@ void faceToEdgeIndices(const ListOfShape& theFaces, TopoDS_Face aTopoFace = TopoDS::Face(aFace->impl()); theFaceEdges.Add(aTopoFace, TColStd_ListOfInteger()); // keep new indices of sub-elements used in this face - for (TopExp_Explorer anEdges(aTopoFace, TopAbs_EDGE); anEdges.More(); anEdges.Next()) { + for (TopExp_Explorer anEdges(aTopoFace, TopAbs_EDGE); anEdges.More(); + anEdges.Next()) { TopoDS_Edge anEdge = TopoDS::Edge(anEdges.Current()); Standard_Real aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); diff --git a/src/Model/Model_ResultConstruction.h b/src/Model/Model_ResultConstruction.h index 34ec270a9..018935347 100644 --- a/src/Model/Model_ResultConstruction.h +++ b/src/Model/Model_ResultConstruction.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_ResultConstruction_H_ @@ -34,14 +35,15 @@ class TDF_Label; * Provides a shape that may be displayed in the viewer. * Intermediate, light result that in many cases produces a result on the fly. */ -class Model_ResultConstruction : public ModelAPI_ResultConstruction -{ - std::shared_ptr myOwner; ///< owner of this result - std::shared_ptr myShape; ///< shape of this result created "on the fly" - public: +class Model_ResultConstruction : public ModelAPI_ResultConstruction { + std::shared_ptr myOwner; ///< owner of this result + std::shared_ptr + myShape; ///< shape of this result created "on the fly" +public: /// Retuns the parameters of color definition in the resources config manager - MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// By default object is displayed in the object browser. MODEL_EXPORT virtual bool isInHistory(); @@ -53,31 +55,36 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction /// Sets the flag that it must be displayed in history (default is true) MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory); - /// if the construction result may be used as faces, this method returns not zero number of faces - /// \param theUpdateNaming is false of keeping the naming structure untouched (on load) + /// if the construction result may be used as faces, this method returns not + /// zero number of faces \param theUpdateNaming is false of keeping the naming + /// structure untouched (on load) MODEL_EXPORT virtual int facesNum(const bool theUpdateNaming = true); - /// if the construction result may be used as faces, this method returns face by zero based index + /// if the construction result may be used as faces, this method returns face + /// by zero based index MODEL_EXPORT virtual std::shared_ptr face(const int theIndex); /// Change the order of faces MODEL_EXPORT - virtual void setFacesOrder(const std::list >& theFaces); + virtual void + setFacesOrder(const std::list> &theFaces); /// By default object is not infinite. MODEL_EXPORT virtual bool isInfinite(); /// Sets the flag that it is infinite MODEL_EXPORT virtual void setInfinite(const bool theInfinite); /// The construction element may be concealed only by "delete" feature - MODEL_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false); + MODEL_EXPORT virtual void setIsConcealed(const bool theValue, + const bool theForced = false); - /// Updates the shape taking the current value from the data structure, returns true - /// if update has been correctly done + /// Updates the shape taking the current value from the data structure, + /// returns true if update has been correctly done MODEL_EXPORT virtual bool updateShape(); - protected: +protected: /// Makes a body on the given feature Model_ResultConstruction(); - /// Stores shape in the data structure to allow identification it by the naming + /// Stores shape in the data structure to allow identification it by the + /// naming void storeShape(std::shared_ptr theShape); friend class Model_Objects; diff --git a/src/Model/Model_ResultField.cpp b/src/Model/Model_ResultField.cpp index 21afaed30..ea5c5c4e7 100644 --- a/src/Model/Model_ResultField.cpp +++ b/src/Model/Model_ResultField.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include -#include -#include #include #include +#include +#include #include #include @@ -32,50 +33,49 @@ #include -Model_ResultField::Model_ResultField(std::shared_ptr theOwnerData) -{ +Model_ResultField::Model_ResultField( + std::shared_ptr theOwnerData) { myOwnerData = theOwnerData; } -Model_ResultField::~Model_ResultField() -{ - while(mySteps.size() > 0) { - //delete mySteps.back(); +Model_ResultField::~Model_ResultField() { + while (mySteps.size() > 0) { + // delete mySteps.back(); mySteps.pop_back(); } } // LCOV_EXCL_START -void Model_ResultField::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void Model_ResultField::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "result_field_color"; theDefault = DEFAULT_COLOR(); } // LCOV_EXCL_STOP -std::shared_ptr Model_ResultField::shape() -{ +std::shared_ptr Model_ResultField::shape() { std::shared_ptr aResult; if (myOwnerData) { AttributeSelectionListPtr aList = myOwnerData->selectionList("selected"); if (aList) { - std::list > aSubs; + std::list> aSubs; if (aList->selectionType() == "part") { // all result bodies of the part std::shared_ptr aDoc = - std::dynamic_pointer_cast(document()); + std::dynamic_pointer_cast(document()); if (!aDoc.get()) return aResult; FeaturePtr aThisFeature = document()->feature( - std::dynamic_pointer_cast(data()->owner())); + std::dynamic_pointer_cast(data()->owner())); int aResults = document()->size(ModelAPI_ResultBody::group()); - for(int a = 0; a < aResults; a++) { + for (int a = 0; a < aResults; a++) { ResultBodyPtr aBody = std::dynamic_pointer_cast( - document()->object(ModelAPI_ResultBody::group(), a)); + document()->object(ModelAPI_ResultBody::group(), a)); if (!aBody.get()) continue; - // check that only results that were created before this field are used + // check that only results that were created before this field are + // used FeaturePtr aResultFeature = document()->feature(aBody); if (!aResultFeature.get()) continue; @@ -87,7 +87,7 @@ std::shared_ptr Model_ResultField::shape() aSubs.push_back(aShape); } } else { - for(int a = aList->size() - 1; a >= 0; a--) { + for (int a = aList->size() - 1; a >= 0; a--) { std::shared_ptr aSelection = aList->value(a)->value(); if (aSelection && !aSelection->isNull()) { aSubs.push_front(aSelection); @@ -103,24 +103,22 @@ std::shared_ptr Model_ResultField::shape() return aResult; } -void Model_ResultField::updateSteps() -{ +void Model_ResultField::updateSteps() { // Update Array of steps int aNbSteps = stepsSize(); if ((int)mySteps.size() != aNbSteps) { - while((int)mySteps.size() > aNbSteps) { - //delete mySteps.back(); + while ((int)mySteps.size() > aNbSteps) { + // delete mySteps.back(); mySteps.pop_back(); } - while((int)mySteps.size() < aNbSteps) { - mySteps.push_back(FieldStepPtr(new Model_ResultField::Model_FieldStep(this, - (int)mySteps.size()))); + while ((int)mySteps.size() < aNbSteps) { + mySteps.push_back(FieldStepPtr( + new Model_ResultField::Model_FieldStep(this, (int)mySteps.size()))); } } } -int Model_ResultField::stepsSize() const -{ +int Model_ResultField::stepsSize() const { if (myOwnerData) { AttributeIntArrayPtr aArray = myOwnerData->intArray("stamps"); if (aArray.get()) { @@ -130,8 +128,7 @@ int Model_ResultField::stepsSize() const return 0; } -std::string Model_ResultField::textLine(int theLine) const -{ +std::string Model_ResultField::textLine(int theLine) const { if (myOwnerData) { AttributeIntArrayPtr aArray = myOwnerData->intArray("stamps"); if (aArray.get()) { @@ -147,8 +144,8 @@ std::string Model_ResultField::textLine(int theLine) const // used by GUI only // LCOV_EXCL_START -std::shared_ptr Model_ResultField::step(int theId) const -{ +std::shared_ptr +Model_ResultField::step(int theId) const { if (theId < (int)mySteps.size()) { return mySteps[theId]; } @@ -157,8 +154,9 @@ std::shared_ptr Model_ResultField::ste std::wstring Model_ResultField::Model_FieldStep::name() { std::wostringstream aStream; - aStream<data()->name()<textLine(myId)); + aStream << myParent->data()->name() << std::endl; + aStream << "Step " << (myId + 1) << " " + << Locale::Convert::toWString(myParent->textLine(myId)); return aStream.str(); } // LCOV_EXCL_STOP diff --git a/src/Model/Model_ResultField.h b/src/Model/Model_ResultField.h index 885667bc1..74fdde6a5 100644 --- a/src/Model/Model_ResultField.h +++ b/src/Model/Model_ResultField.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_ResultField_H_ @@ -30,38 +31,40 @@ * * Provides a compound of selected elements, without storage, one the fly. */ -class Model_ResultField : public ModelAPI_ResultField -{ - std::shared_ptr myOwnerData; ///< data of owner of this result +class Model_ResultField : public ModelAPI_ResultField { + std::shared_ptr myOwnerData; ///< data of owner of this result public: - - class Model_FieldStep : public ModelAPI_ResultField::ModelAPI_FieldStep - { + class Model_FieldStep : public ModelAPI_ResultField::ModelAPI_FieldStep { public: - Model_FieldStep(ModelAPI_ResultField* theParent, int theId) - : ModelAPI_ResultField::ModelAPI_FieldStep(), myParent(theParent), myId(theId) - { - setData(myParent->data()); // it is not needed to have special data for the temporary - // step object, but data must be "valid" for GUI checks + Model_FieldStep(ModelAPI_ResultField *theParent, int theId) + : ModelAPI_ResultField::ModelAPI_FieldStep(), myParent(theParent), + myId(theId) { + setData(myParent->data()); // it is not needed to have special data for + // the temporary step object, but data must be + // "valid" for GUI checks }; - virtual ModelAPI_ResultField* field() const { return myParent; } + virtual ModelAPI_ResultField *field() const { return myParent; } virtual int id() const { return myId; } - virtual std::shared_ptr document() const { return myParent->document(); } + virtual std::shared_ptr document() const { + return myParent->document(); + } /// Returns a GUI name of this step virtual std::wstring name(); private: - ModelAPI_ResultField* myParent; + ModelAPI_ResultField *myParent; int myId; }; - /// Returns the parameters of color definition in the resources configuration manager - MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + /// Returns the parameters of color definition in the resources configuration + /// manager + MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Returns the compound of selected entities MODEL_EXPORT virtual std::shared_ptr shape(); @@ -76,7 +79,7 @@ public: /// Returns step object /// \param theId an id of the object MODEL_EXPORT virtual std::shared_ptr - step(int theId) const; + step(int theId) const; /// Removes the stored builders MODEL_EXPORT virtual ~Model_ResultField(); @@ -91,7 +94,6 @@ protected: friend class Model_Objects; private: - std::vector mySteps; }; diff --git a/src/Model/Model_ResultGroup.cpp b/src/Model/Model_ResultGroup.cpp index 91513f7eb..efa8d5c6a 100644 --- a/src/Model/Model_ResultGroup.cpp +++ b/src/Model/Model_ResultGroup.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include -#include #include +#include #include @@ -32,24 +33,24 @@ #include #include -Model_ResultGroup::Model_ResultGroup(std::shared_ptr theOwnerData) -{ +Model_ResultGroup::Model_ResultGroup( + std::shared_ptr theOwnerData) { myOwnerData = theOwnerData; } -void Model_ResultGroup::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void Model_ResultGroup::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "result_group_color"; theDefault = DEFAULT_COLOR(); } -std::shared_ptr Model_ResultGroup::shape() -{ +std::shared_ptr Model_ResultGroup::shape() { std::shared_ptr aResult; // obtain stored shape - std::shared_ptr aData = std::dynamic_pointer_cast(data()); + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData && aData->isValid()) { TDF_Label aShapeLab = aData->shapeLab(); Handle(TDF_Reference) aRef; @@ -70,22 +71,25 @@ std::shared_ptr Model_ResultGroup::shape() AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list"); if (aList) { GeomAPI_DataMapOfShapeShape aShapesMap; // to avoid shapes duplication - std::list > aSubs; - for(int a = aList->size() - 1; a >= 0; a--) { + std::list> aSubs; + for (int a = aList->size() - 1; a >= 0; a--) { std::shared_ptr aSelection = aList->value(a)->value(); - if (aList->isWholeResultAllowed()) { // whole result selection, explode to sub-shapes + if (aList->isWholeResultAllowed()) { // whole result selection, explode + // to sub-shapes if (!aSelection.get() || aSelection->isNull()) { ResultPtr aContext = aList->value(a)->context(); if (aContext) aSelection = aContext->shape(); } if (aSelection && !aSelection->isNull()) { - GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::shapeTypeByStr(aList->selectionType()); + GeomAPI_Shape::ShapeType aType = + GeomAPI_Shape::shapeTypeByStr(aList->selectionType()); if (aType == aSelection->shapeType()) { if (aShapesMap.bind(aSelection, aSelection)) aSubs.push_back(aSelection); } else { - for(GeomAPI_ShapeExplorer anExp(aSelection, aType); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aSelection, aType); anExp.more(); + anExp.next()) { if (aShapesMap.bind(anExp.current(), anExp.current())) aSubs.push_back(anExp.current()); } @@ -106,19 +110,19 @@ std::shared_ptr Model_ResultGroup::shape() return aResult; } -void Model_ResultGroup::store(const GeomShapePtr& theShape) -{ - std::shared_ptr aData = std::dynamic_pointer_cast(data()); +void Model_ResultGroup::store(const GeomShapePtr &theShape) { + std::shared_ptr aData = + std::dynamic_pointer_cast(data()); if (aData) { TDF_Label aShapeLab = aData->shapeLab(); aShapeLab.ForgetAttribute(TDF_Reference::GetID()); aShapeLab.ForgetAttribute(TNaming_NamedShape::GetID()); if (!theShape) - return; // bad shape + return; // bad shape TopoDS_Shape aShape = theShape->impl(); if (aShape.IsNull()) - return; // null shape inside + return; // null shape inside // store the new shape as primitive TNaming_Builder aBuilder(aShapeLab); diff --git a/src/Model/Model_ResultGroup.h b/src/Model/Model_ResultGroup.h index 63acb4f29..13af70272 100644 --- a/src/Model/Model_ResultGroup.h +++ b/src/Model/Model_ResultGroup.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_ResultGroup_H_ @@ -29,14 +30,13 @@ * * Provides a compound of selected elements, without storage, one the fly. */ -class Model_ResultGroup : public ModelAPI_ResultGroup -{ - std::shared_ptr myOwnerData; ///< data of owner of this result +class Model_ResultGroup : public ModelAPI_ResultGroup { + std::shared_ptr myOwnerData; ///< data of owner of this result public: - /// Retuns the parameters of color definition in the resources config manager - MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Returns the compound of selected entities MODEL_EXPORT virtual std::shared_ptr shape(); @@ -44,7 +44,7 @@ public: /// \brief Stores the result of operation made on groups. /// Cleans the storage if empty shape is given. /// param[in] theShape shape to store. - MODEL_EXPORT virtual void store(const GeomShapePtr& theShape); + MODEL_EXPORT virtual void store(const GeomShapePtr &theShape); /// Removes the stored builders MODEL_EXPORT virtual ~Model_ResultGroup() {} diff --git a/src/Model/Model_ResultParameter.cpp b/src/Model/Model_ResultParameter.cpp index 527e91aab..2ca252ef5 100644 --- a/src/Model/Model_ResultParameter.cpp +++ b/src/Model/Model_ResultParameter.cpp @@ -14,24 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_ResultParameter.h" #include #include -Model_ResultParameter::~Model_ResultParameter() -{ +Model_ResultParameter::~Model_ResultParameter() {} -} - -void Model_ResultParameter::initAttributes() -{ +void Model_ResultParameter::initAttributes() { data()->addAttribute(ModelAPI_ResultParameter::VALUE(), ModelAPI_AttributeDouble::typeId()); } -Model_ResultParameter::Model_ResultParameter() -{ -} +Model_ResultParameter::Model_ResultParameter() {} diff --git a/src/Model/Model_ResultParameter.h b/src/Model/Model_ResultParameter.h index 9f081937e..a9fcddbb9 100644 --- a/src/Model/Model_ResultParameter.h +++ b/src/Model/Model_ResultParameter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODEL_RESULTPARAMETER_H_ @@ -28,15 +29,15 @@ /**\class Model_ResultParameter * \ingroup DataModel - * \brief Result of parameter expression. Contains only double value computed result attribute. + * \brief Result of parameter expression. Contains only double value computed + * result attribute. */ -class Model_ResultParameter : public ModelAPI_ResultParameter -{ - public: +class Model_ResultParameter : public ModelAPI_ResultParameter { +public: MODEL_EXPORT virtual ~Model_ResultParameter(); MODEL_EXPORT virtual void initAttributes(); - protected: +protected: Model_ResultParameter(); friend class Model_Objects; diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 6f459abc3..84bcea884 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -14,26 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include +#include #include -#include -#include -#include +#include #include -#include #include -#include -#include -#include -#include +#include +#include #include +#include +#include +#include #include +#include +#include +#include #include @@ -41,36 +42,39 @@ #include -#include -#include -#include -#include #include +#include +#include +#include #include +#include #include -#define baseRef() \ - std::dynamic_pointer_cast(data()->reference(BASE_REF_ID())->value()) +#define baseRef() \ + std::dynamic_pointer_cast( \ + data()->reference(BASE_REF_ID())->value()) -void Model_ResultPart::initAttributes() -{ - // append the color attribute. It is empty, the attribute will be filled by a request - AttributeDocRefPtr aDocRef = std::dynamic_pointer_cast( - data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::typeId())); +void Model_ResultPart::initAttributes() { + // append the color attribute. It is empty, the attribute will be filled by a + // request + AttributeDocRefPtr aDocRef = + std::dynamic_pointer_cast( + data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::typeId())); data()->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId()); data()->addAttribute(BASE_REF_ID(), ModelAPI_AttributeReference::typeId()); data()->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ISO_LINES_ID(), ModelAPI_AttributeIntArray::typeId()); - if (aDocRef->isInitialized() && // initialized immediately means already exist and will be loaded + if (aDocRef->isInitialized() && // initialized immediately means already exist + // and will be loaded !Model_Application::getApplication()->hasDocument(aDocRef->docId())) - Model_Application::getApplication()->setLoadByDemand(data()->name(), aDocRef->docId()); + Model_Application::getApplication()->setLoadByDemand(data()->name(), + aDocRef->docId()); } -std::shared_ptr Model_ResultPart::partDoc() -{ +std::shared_ptr Model_ResultPart::partDoc() { if (myTrsf.get() && baseRef().get()) { // the second condition is due to #2035 return baseRef()->partDoc(); } @@ -80,32 +84,36 @@ std::shared_ptr Model_ResultPart::partDoc() return aRes; } -Model_ResultPart::Model_ResultPart() -{ -} +Model_ResultPart::Model_ResultPart() {} -void Model_ResultPart::activate() -{ +void Model_ResultPart::activate() { if (myTrsf.get()) { baseRef()->activate(); return; } - std::shared_ptr aDocRef = data()->document(DOC_REF()); + std::shared_ptr aDocRef = + data()->document(DOC_REF()); - // activation may cause changes in current features in document, so it must be in transaction + // activation may cause changes in current features in document, so it must be + // in transaction bool isNewTransaction = false; SessionPtr aMgr = ModelAPI_Session::get(); if (!aMgr->isOperation()) { - // open transaction even document is not created to set current docs in setActiveDocument - std::string aMsg = "Activation " + Locale::Convert::toString(data()->name()); + // open transaction even document is not created to set current docs in + // setActiveDocument + std::string aMsg = + "Activation " + Locale::Convert::toString(data()->name()); aMgr->startOperation(aMsg); isNewTransaction = true; } - if (!aDocRef->value().get()) { // create (or open) a document if it is not yet created + if (!aDocRef->value() + .get()) { // create (or open) a document if it is not yet created Handle(Model_Application) anApp = Model_Application::getApplication(); if (anApp->isLoadByDemand(data()->name(), aDocRef->docId())) { - anApp->loadDocument(data()->name(), aDocRef->docId()); // if it is just new part, load fails + anApp->loadDocument( + data()->name(), + aDocRef->docId()); // if it is just new part, load fails } else { anApp->createDocument(aDocRef->docId()); } @@ -123,64 +131,65 @@ void Model_ResultPart::activate() } } - -void Model_ResultPart::loadPart() -{ - std::shared_ptr aDocRef = data()->document(DOC_REF()); - if (!aDocRef->value().get()) { // create (or open) a document if it is not yet created +void Model_ResultPart::loadPart() { + std::shared_ptr aDocRef = + data()->document(DOC_REF()); + if (!aDocRef->value() + .get()) { // create (or open) a document if it is not yet created Handle(Model_Application) anApp = Model_Application::getApplication(); if (anApp->isLoadByDemand(data()->name(), aDocRef->docId())) { - anApp->loadDocument(data()->name(), aDocRef->docId()); // if it is just new part, load fails - } - else { + anApp->loadDocument( + data()->name(), + aDocRef->docId()); // if it is just new part, load fails + } else { anApp->createDocument(aDocRef->docId()); } } } - -std::shared_ptr Model_ResultPart::original() -{ - if (myTrsf.get() && baseRef().get()) { // the second condition is due to #2035 +std::shared_ptr Model_ResultPart::original() { + if (myTrsf.get() && baseRef().get()) { // the second condition is due to #2035 return baseRef()->original(); } return std::dynamic_pointer_cast(data()->owner()); } -bool Model_ResultPart::isActivated() -{ +bool Model_ResultPart::isActivated() { if (myTrsf.get()) { if (!baseRef().get()) // may be on close return false; return baseRef()->isActivated(); } - std::shared_ptr aDocRef = data()->document(DOC_REF()); + std::shared_ptr aDocRef = + data()->document(DOC_REF()); return aDocRef->value().get() != NULL; } bool Model_ResultPart::setDisabled(std::shared_ptr theThis, - const bool theFlag) -{ + const bool theFlag) { if (ModelAPI_ResultPart::setDisabled(theThis, theFlag)) { if (!myTrsf.get()) { // disable of base result part DocumentPtr aDoc = Model_ResultPart::partDoc(); if (aDoc.get() && aDoc->isOpened()) { - // make the current feature the last in any case: to update shapes before deactivation too + // make the current feature the last in any case: to update shapes + // before deactivation too int aSize = aDoc->size(ModelAPI_Feature::group()); FeaturePtr aLastFeature; if (aSize) - aLastFeature = std::dynamic_pointer_cast(aDoc->object( - ModelAPI_Feature::group(), aSize - 1)); + aLastFeature = std::dynamic_pointer_cast( + aDoc->object(ModelAPI_Feature::group(), aSize - 1)); aDoc->setCurrentFeature(aLastFeature, false); if (theFlag) { // disable, so make all features disabled too - // update the shape just before the deactivation: it will be used outside of part + // update the shape just before the deactivation: it will be used + // outside of part updateShape(); shape(); aDoc->setCurrentFeature(FeaturePtr(), false); - // in order to update OB sub-elements of document before the document closing - Events_Loop* aLoop = Events_Loop::loop(); + // in order to update OB sub-elements of document before the document + // closing + Events_Loop *aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); @@ -192,8 +201,8 @@ bool Model_ResultPart::setDisabled(std::shared_ptr theThis, return false; } -static GeomShapePtr transformShape(const GeomShapePtr theShape, const gp_Trsf& theTrsf) -{ +static GeomShapePtr transformShape(const GeomShapePtr theShape, + const gp_Trsf &theTrsf) { GeomShapePtr aResult(new GeomAPI_Shape); if (theTrsf.ScaleFactor() > 0) { // just update the location of the shape in case of affine transformation @@ -206,8 +215,7 @@ static GeomShapePtr transformShape(const GeomShapePtr theShape, const gp_Trsf& t #endif aResult->setImpl(new TopoDS_Shape(aShape)); } - } - else { + } else { // all other transformations will modify the shape GeomTrsfPtr aTrsf = std::make_shared(new gp_Trsf(theTrsf)); GeomAlgoAPI_Transform aTransform(theShape, aTrsf); @@ -216,13 +224,14 @@ static GeomShapePtr transformShape(const GeomShapePtr theShape, const gp_Trsf& t return aResult; } -std::shared_ptr Model_ResultPart::shape() -{ +std::shared_ptr Model_ResultPart::shape() { std::shared_ptr aResult(new GeomAPI_Shape); if (myShape.IsNull()) { // shape is not produced yet, create it SessionPtr aMgr = ModelAPI_Session::get(); - bool aToSendUpdate = aMgr->isOperation(); // inside of operation may send an update event - if (myTrsf.get()) { // get shape of the base result and apply the transformation + bool aToSendUpdate = + aMgr->isOperation(); // inside of operation may send an update event + if (myTrsf.get()) { // get shape of the base result and apply the + // transformation ResultPtr anOrigResult = baseRef(); std::shared_ptr anOrigShape = anOrigResult->shape(); if (anOrigShape.get()) { @@ -230,21 +239,24 @@ std::shared_ptr Model_ResultPart::shape() myShape = aResult->impl(); } if (!myShape.IsNull() && aToSendUpdate) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent); } return aResult; } else { DocumentPtr aDoc = Model_ResultPart::partDoc(); if (aDoc.get() && aDoc->isOpened()) { - const std::string& aBodyGroup = ModelAPI_ResultBody::group(); + const std::string &aBodyGroup = ModelAPI_ResultBody::group(); TopoDS_Compound aResultComp; BRep_Builder aBuilder; aBuilder.MakeCompound(aResultComp); int aNumSubs = 0; - for(int a = aDoc->size(aBodyGroup) - 1; a >= 0; a--) { - ResultPtr aBody = std::dynamic_pointer_cast(aDoc->object(aBodyGroup, a)); - // "object" method filters out disabled and concealed anyway, so don't check + for (int a = aDoc->size(aBodyGroup) - 1; a >= 0; a--) { + ResultPtr aBody = std::dynamic_pointer_cast( + aDoc->object(aBodyGroup, a)); + // "object" method filters out disabled and concealed anyway, so don't + // check if (aBody.get() && aBody->data()->isValid() && aBody->shape().get()) { TopoDS_Shape aShape = *(aBody->shape()->implPtr()); if (!aShape.IsNull()) { @@ -259,7 +271,8 @@ std::shared_ptr Model_ResultPart::shape() } } if (!myShape.IsNull() && aToSendUpdate) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent); } } @@ -270,9 +283,9 @@ std::shared_ptr Model_ResultPart::shape() } // Returns true is transformation matrices are equal -static bool IsEqualTrsf(gp_Trsf& theT1, gp_Trsf theT2) { - for(int aRow = 1; aRow < 4; aRow++) { - for(int aCol = 1; aCol < 5; aCol++) { +static bool IsEqualTrsf(gp_Trsf &theT1, gp_Trsf theT2) { + for (int aRow = 1; aRow < 4; aRow++) { + for (int aCol = 1; aCol < 5; aCol++) { double aDiff = theT1.Value(aRow, aCol) - theT2.Value(aRow, aCol); if (Abs(aDiff) > 1.e-9) return false; @@ -281,12 +294,13 @@ static bool IsEqualTrsf(gp_Trsf& theT1, gp_Trsf theT2) { return true; } -std::wstring Model_ResultPart::nameInPart(const std::shared_ptr& theShape, - int& theIndex) -{ +std::wstring +Model_ResultPart::nameInPart(const std::shared_ptr &theShape, + int &theIndex) { theIndex = 0; // not initialized - if (myTrsf.get()) { // if this is moved copy of part => return the name of original shape + if (myTrsf.get()) { // if this is moved copy of part => return the name of + // original shape ResultPartPtr anOrigResult = baseRef(); // searching in the origin the shape equal to the given but with myTrsf TopoDS_Shape aSelection = theShape->impl(); @@ -294,14 +308,15 @@ std::wstring Model_ResultPart::nameInPart(const std::shared_ptr& TopoDS_Shape anOrigMain = anOrigResult->shape()->impl(); if (!aSelection.IsNull() && !anOrigMain.IsNull()) { TopExp_Explorer anExp(anOrigMain, aSelection.ShapeType()); - for(; anExp.More(); anExp.Next()) { + for (; anExp.More(); anExp.Next()) { if (anExp.Current().IsPartner(aSelection)) { #if OCC_VERSION_LARGE < 0x07070000 TopoDS_Shape anOrigMoved = anExp.Current().Moved(*(myTrsf.get())); #else - TopoDS_Shape anOrigMoved = anExp.Current().Moved(*(myTrsf.get()), Standard_False); + TopoDS_Shape anOrigMoved = + anExp.Current().Moved(*(myTrsf.get()), Standard_False); #endif - //if (anOrigMoved.IsSame(aSelection)) { + // if (anOrigMoved.IsSame(aSelection)) { if (IsEqualTrsf(aSelTrsf, anOrigMoved.Location().Transformation())) { std::shared_ptr anOrigSel(new GeomAPI_Shape); anOrigSel->setImpl(new TopoDS_Shape(anExp.Current())); @@ -319,7 +334,8 @@ std::wstring Model_ResultPart::nameInPart(const std::shared_ptr& return L""; // getting an access to the document of part - std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(partDoc()); if (!aDoc.get()) // the part document is not presented for the moment return L""; MAYBE_UNUSED TDF_Label anAccessLabel = aDoc->generalLabel(); @@ -328,13 +344,15 @@ std::wstring Model_ResultPart::nameInPart(const std::shared_ptr& std::wstring aName; // for this the context result is needed ResultPtr aContext; - const std::string& aBodyGroup = ModelAPI_ResultBody::group(); - for(int a = aDoc->size(aBodyGroup) - 1; a >= 0; a--) { - ResultPtr aBody = std::dynamic_pointer_cast(aDoc->object(aBodyGroup, a)); + const std::string &aBodyGroup = ModelAPI_ResultBody::group(); + for (int a = aDoc->size(aBodyGroup) - 1; a >= 0; a--) { + ResultPtr aBody = + std::dynamic_pointer_cast(aDoc->object(aBodyGroup, a)); if (aBody.get() && aBody->shape().get() && !aBody->isDisabled()) { TopoDS_Shape aBodyShape = *(aBody->shape()->implPtr()); // check is body contain the selected sub-shape - for(TopExp_Explorer anExp(aBodyShape, aShape.ShapeType()); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aBodyShape, aShape.ShapeType()); anExp.More(); + anExp.Next()) { if (aShape.IsSame(anExp.Current())) { aContext = aBody; break; @@ -352,9 +370,9 @@ std::wstring Model_ResultPart::nameInPart(const std::shared_ptr& return aName; } -bool Model_ResultPart::updateInPart(const int theIndex) -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); +bool Model_ResultPart::updateInPart(const int theIndex) { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(partDoc()); if (aDoc.get()) { AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature(); AttributeSelectionPtr aThisAttr = aSelAttr->value(theIndex - 1); @@ -378,9 +396,10 @@ gp_Trsf Model_ResultPart::sumTrsf() { return aResult; } -bool Model_ResultPart::combineGeometrical(const int theIndex, std::wstring& theNewName) -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); +bool Model_ResultPart::combineGeometrical(const int theIndex, + std::wstring &theNewName) { + std::shared_ptr aDoc = + std::dynamic_pointer_cast(partDoc()); if (aDoc.get()) { AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature(); AttributeSelectionPtr aThisAttr = aSelAttr->value(theIndex - 1); @@ -396,19 +415,20 @@ bool Model_ResultPart::combineGeometrical(const int theIndex, std::wstring& theN return false; // something is wrong } -std::shared_ptr Model_ResultPart::shapeInPart( - const std::wstring& theName, const std::string& theType, int& theIndex) -{ +std::shared_ptr +Model_ResultPart::shapeInPart(const std::wstring &theName, + const std::string &theType, int &theIndex) { theIndex = 0; // not found yet std::shared_ptr aResult; - std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(partDoc()); if (!aDoc.get()) // the part document is not presented for the moment return aResult; AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature(); // check this selection is already there: reuse it int aSize = aSelAttr->size(); - for(int a = 0; a < aSize; a++) { + for (int a = 0; a < aSize; a++) { if (aSelAttr->value(a)->namingName() == theName) { theIndex = a; return aSelAttr->value(a)->value(); @@ -423,17 +443,19 @@ std::shared_ptr Model_ResultPart::shapeInPart( #if OCC_VERSION_LARGE < 0x07070000 TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf); #else - TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf, Standard_False); + TopoDS_Shape anOrigMoved = + aResult->impl().Moved(aSumTrsf, Standard_False); #endif aResult->setImpl(new TopoDS_Shape(anOrigMoved)); } return aResult; } -std::shared_ptr Model_ResultPart::selectionValue(const int theIndex) -{ +std::shared_ptr +Model_ResultPart::selectionValue(const int theIndex) { std::shared_ptr aResult; - std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(partDoc()); if (!aDoc.get()) // the part document is not presented for the moment return aResult; @@ -444,42 +466,43 @@ std::shared_ptr Model_ResultPart::selectionValue(const int theInd #if OCC_VERSION_LARGE < 0x07070000 TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf); #else - TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf, Standard_False); + TopoDS_Shape anOrigMoved = + aResult->impl().Moved(aSumTrsf, Standard_False); #endif aResult->setImpl(new TopoDS_Shape(anOrigMoved)); } return aResult; } -void Model_ResultPart::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void Model_ResultPart::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "result_part_color"; theDefault = DEFAULT_COLOR(); } -void Model_ResultPart::updateShape() -{ +void Model_ResultPart::updateShape() { myShape.Nullify(); myTrsf.reset(); } -void Model_ResultPart::setTrsf(std::shared_ptr theThis, - const std::shared_ptr& theTransformation) -{ +void Model_ResultPart::setTrsf( + std::shared_ptr theThis, + const std::shared_ptr &theTransformation) { updateShape(); if (theTransformation.get()) { - myTrsf = std::shared_ptr(new gp_Trsf(theTransformation->impl())); + myTrsf = std::shared_ptr( + new gp_Trsf(theTransformation->impl())); } // the result must be explicitly updated - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - ModelAPI_EventCreator::get()->sendUpdated(theThis, EVENT_DISP); // flush is in preview-update + ModelAPI_EventCreator::get()->sendUpdated( + theThis, EVENT_DISP); // flush is in preview-update } -std::shared_ptr Model_ResultPart::summaryTrsf() -{ +std::shared_ptr Model_ResultPart::summaryTrsf() { GeomTrsfPtr aResult(new GeomAPI_Trsf); aResult->setImpl(new gp_Trsf(sumTrsf())); return aResult; diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index 019e34831..8158a0fdf 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_ResultPart_H_ @@ -32,68 +33,72 @@ * This result leaves without feature: no parametricity for this element, * only add/remove, undo/redo. */ -class Model_ResultPart : public ModelAPI_ResultPart -{ +class Model_ResultPart : public ModelAPI_ResultPart { /// shape of this part created from bodies (updated only of Part deactivation) TopoDS_Shape myShape; /// if it is just copy of original shape, keep just transformation std::shared_ptr myTrsf; - public: - /// the reference to the base result document, may be null if this is the root, - /// others make sequence of references - inline static const std::string& BASE_REF_ID() - { +public: + /// the reference to the base result document, may be null if this is the + /// root, others make sequence of references + inline static const std::string &BASE_REF_ID() { static const std::string MY_BASE_REF("BaseReference"); return MY_BASE_REF; } - /// Request for initialization of data model of the result: adding all attributes + /// Request for initialization of data model of the result: adding all + /// attributes virtual void initAttributes(); /// Returns the part-document of this result MODEL_EXPORT virtual std::shared_ptr partDoc(); - /// Returns the original part result: for transformation features results this is - /// the original Part feature result + /// Returns the original part result: for transformation features results this + /// is the original Part feature result MODEL_EXPORT virtual std::shared_ptr original(); /// Sets this document as current and if it is not loaded yet, loads it MODEL_EXPORT virtual void activate(); /// disable all feature of the part on disable of the part result - MODEL_EXPORT virtual bool setDisabled(std::shared_ptr theThis, - const bool theFlag); + MODEL_EXPORT virtual bool + setDisabled(std::shared_ptr theThis, const bool theFlag); /// Result shape of part document is compound of bodies inside of this part MODEL_EXPORT virtual std::shared_ptr shape(); /// Returns the name of the shape inside of the part /// \param theShape selected shape in this document - /// \param theIndex is returned as one-based index if selection was required, "0" otherwise - /// \returns empty name is selection is not correct - MODEL_EXPORT virtual std::wstring nameInPart(const std::shared_ptr& theShape, - int& theIndex); + /// \param theIndex is returned as one-based index if selection was required, + /// "0" otherwise \returns empty name is selection is not correct + MODEL_EXPORT virtual std::wstring + nameInPart(const std::shared_ptr &theShape, int &theIndex); /// Updates the selection inside of the part by the selection index MODEL_EXPORT virtual bool updateInPart(const int theIndex); /// Returns the shape by the name in the part - MODEL_EXPORT virtual std::shared_ptr shapeInPart( - const std::wstring& theName, const std::string& theType, int& theIndex); + MODEL_EXPORT virtual std::shared_ptr + shapeInPart(const std::wstring &theName, const std::string &theType, + int &theIndex); /// Updates the selection inside of the part as a geometrical selection - MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName); + MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, + std::wstring &theNewName); /// Updates the shape-result of the part (called on Part feature execution) MODEL_EXPORT virtual void updateShape(); /// Applies the additional transformation of the part - MODEL_EXPORT virtual void setTrsf(std::shared_ptr theThis, - const std::shared_ptr& theTransformation); + MODEL_EXPORT virtual void + setTrsf(std::shared_ptr theThis, + const std::shared_ptr &theTransformation); /// Returns the summary transformations of all references to the origin MODEL_EXPORT virtual std::shared_ptr summaryTrsf(); /// Returns the parameters of color definition in the resources config manager - MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Returns the shape selected in the selection index - MODEL_EXPORT virtual std::shared_ptr selectionValue(const int theIndex); + MODEL_EXPORT virtual std::shared_ptr + selectionValue(const int theIndex); /// Loading the part from file MODEL_EXPORT virtual void loadPart(); @@ -102,7 +107,8 @@ protected: /// makes a result on a temporary feature (an action) Model_ResultPart(); - /// returns sum of transformations of the whole sequence of transformation-parts + /// returns sum of transformations of the whole sequence of + /// transformation-parts gp_Trsf sumTrsf(); /// Returns true if document is activated (loaded into the memory) diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index b80cdd8ea..f03ea6c3e 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -14,37 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include #include +#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include #include #include +#include #include #include #include -#include #include #include @@ -52,52 +53,53 @@ #include -static Model_Session* myImpl = new Model_Session(); +static Model_Session *myImpl = new Model_Session(); // to redirect all calls to the root document #define ROOT_DOC std::dynamic_pointer_cast(moduleDocument()) -bool Model_Session::load(const char* theFileName) -{ +bool Model_Session::load(const char *theFileName) { myIsLoading = true; bool aRes = ROOT_DOC->load(theFileName, "root", ROOT_DOC); myIsLoading = false; return aRes; } -bool Model_Session::save(const char* theFileName, std::list& theResults) -{ +bool Model_Session::save(const char *theFileName, + std::list &theResults) { return ROOT_DOC->save(theFileName, "root", theResults); } -void Model_Session::closeAll() -{ +void Model_Session::closeAll() { Model_Application::getApplication()->deleteAllDocuments(); - static const Events_ID aDocsCloseEvent = Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED); + static const Events_ID aDocsCloseEvent = + Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED); myCurrentDoc = NULL; - static std::shared_ptr aMsg(new Events_Message(aDocsCloseEvent)); + static std::shared_ptr aMsg( + new Events_Message(aDocsCloseEvent)); Events_Loop::loop()->send(aMsg); Events_Loop::loop()->flush(aDocsCloseEvent); } -void Model_Session::startOperation(const std::string& theId, const bool theAttachedToNested) -{ +void Model_Session::startOperation(const std::string &theId, + const bool theAttachedToNested) { myOperationAttachedToNext.push_back(theAttachedToNested); ROOT_DOC->startOperation(); ROOT_DOC->operationId(theId); - static std::shared_ptr aStartedMsg - (new Events_Message(Events_Loop::eventByName("StartOperation"))); + static std::shared_ptr aStartedMsg( + new Events_Message(Events_Loop::eventByName("StartOperation"))); Events_Loop::loop()->send(aStartedMsg); - // remove all useless documents that has been closed: on start of operation undo/redo is cleared - // MPV: this code is dangerous now because it may close the document that is activated right now - // but not in the list of the opened documents yet (create, delete, undo, activate Part) - // later this must be updated by correct usage of uniques IDs of documents, not names of results - //std::list > aUsedDocs = allOpenedDocuments(); - //Model_Application::getApplication()->removeUselessDocuments(aUsedDocs); + // remove all useless documents that has been closed: on start of operation + // undo/redo is cleared MPV: this code is dangerous now because it may close + // the document that is activated right now but not in the list of the opened + // documents yet (create, delete, undo, activate Part) later this must be + // updated by correct usage of uniques IDs of documents, not names of results + // std::list > aUsedDocs = + // allOpenedDocuments(); + // Model_Application::getApplication()->removeUselessDocuments(aUsedDocs); } -void Model_Session::finishOperation() -{ +void Model_Session::finishOperation() { setCheckTransactions(false); ROOT_DOC->finishOperation(); if (!myOperationAttachedToNext.empty()) { @@ -111,8 +113,7 @@ void Model_Session::finishOperation() setCheckTransactions(true); } -void Model_Session::abortOperation() -{ +void Model_Session::abortOperation() { setCheckTransactions(false); ROOT_DOC->abortOperation(); if (!myOperationAttachedToNext.empty()) { @@ -124,74 +125,53 @@ void Model_Session::abortOperation() myOperationAttachedToNext.pop_back(); } setCheckTransactions(true); - // here the update mechanism may work after abort, so, suppress the warnings about - // modifications outside of the transactions + // here the update mechanism may work after abort, so, suppress the warnings + // about modifications outside of the transactions bool aWasCheck = myCheckTransactions; myCheckTransactions = false; - static std::shared_ptr anAbortMsg - (new Events_Message(Events_Loop::eventByName("AbortOperation"))); + static std::shared_ptr anAbortMsg( + new Events_Message(Events_Loop::eventByName("AbortOperation"))); Events_Loop::loop()->send(anAbortMsg); myCheckTransactions = true; myCheckTransactions = aWasCheck; } -bool Model_Session::isOperation() -{ - return ROOT_DOC->isOperation(); -} +bool Model_Session::isOperation() { return ROOT_DOC->isOperation(); } -bool Model_Session::isModified() -{ - return ROOT_DOC->isModified(); -} +bool Model_Session::isModified() { return ROOT_DOC->isModified(); } -bool Model_Session::canUndo() -{ - return ROOT_DOC->canUndo(); -} +bool Model_Session::canUndo() { return ROOT_DOC->canUndo(); } -void Model_Session::undo() -{ +void Model_Session::undo() { setCheckTransactions(false); ROOT_DOC->undo(); setCheckTransactions(true); } -bool Model_Session::canRedo() -{ - return ROOT_DOC->canRedo(); -} +bool Model_Session::canRedo() { return ROOT_DOC->canRedo(); } -void Model_Session::redo() -{ +void Model_Session::redo() { setCheckTransactions(false); ROOT_DOC->redo(); setCheckTransactions(true); } //! Returns stack of performed operations -std::list Model_Session::undoList() -{ +std::list Model_Session::undoList() { return ROOT_DOC->undoList(); } //! Returns stack of rolled back operations -std::list Model_Session::redoList() -{ +std::list Model_Session::redoList() { return ROOT_DOC->redoList(); } -void Model_Session::clearUndoRedo() -{ - return ROOT_DOC->clearUndoRedo(); -} +void Model_Session::clearUndoRedo() { return ROOT_DOC->clearUndoRedo(); } -bool Model_Session::checkLicense(const std::string& thePluginName) -{ +bool Model_Session::checkLicense(const std::string &thePluginName) { return getPlugin(thePluginName); } -ModelAPI_Plugin* Model_Session::getPlugin(const std::string& thePluginName) -{ +ModelAPI_Plugin *Model_Session::getPlugin(const std::string &thePluginName) { if (myPluginObjs.find(thePluginName) == myPluginObjs.end()) { // before load the used plugins if (myUsePlugins.find(thePluginName) != myUsePlugins.end()) { @@ -207,14 +187,16 @@ ModelAPI_Plugin* Model_Session::getPlugin(const std::string& thePluginName) Config_ModuleReader::loadPlugin(thePluginName); } if (myPluginObjs.find(thePluginName) == myPluginObjs.end()) { - Events_InfoMessage("Model_Session", "Can not load plugin '%1'").arg(thePluginName).send(); + Events_InfoMessage("Model_Session", "Can not load plugin '%1'") + .arg(thePluginName) + .send(); return NULL; } return myPluginObjs[thePluginName]; } -FeaturePtr Model_Session::createFeature(std::string theFeatureID, Model_Document* theDocOwner) -{ +FeaturePtr Model_Session::createFeature(std::string theFeatureID, + Model_Document *theDocOwner) { if (this != myImpl) { return myImpl->createFeature(theFeatureID, theDocOwner); } @@ -223,34 +205,42 @@ FeaturePtr Model_Session::createFeature(std::string theFeatureID, Model_Document LoadPluginsInfo(); if (myPlugins.find(theFeatureID) != myPlugins.end()) { - std::pair& aPlugin = myPlugins[theFeatureID]; // plugin and doc kind + std::pair &aPlugin = + myPlugins[theFeatureID]; // plugin and doc kind if (!aPlugin.second.empty() && aPlugin.second != theDocOwner->kind()) { - Events_InfoMessage("Model_Session", - "Feature '%1' can be created only in document '%2' by the XML definition") - .arg(theFeatureID).arg(aPlugin.second).send(); + Events_InfoMessage("Model_Session", "Feature '%1' can be created only in " + "document '%2' by the XML definition") + .arg(theFeatureID) + .arg(aPlugin.second) + .send(); return FeaturePtr(); } - ModelAPI_Plugin* aPluginObj = getPlugin(aPlugin.first); + ModelAPI_Plugin *aPluginObj = getPlugin(aPlugin.first); if (aPluginObj) { FeaturePtr aCreated = aPluginObj->createFeature(theFeatureID); if (!aCreated) { - Events_InfoMessage("Model_Session", "Can not initialize feature '%1' in plugin '%2'") - .arg(theFeatureID).arg(aPlugin.first).send(); + Events_InfoMessage("Model_Session", + "Can not initialize feature '%1' in plugin '%2'") + .arg(theFeatureID) + .arg(aPlugin.first) + .send(); } return aCreated; } else { - Events_InfoMessage("Model_Session", "Can not load plugin '%1'").arg(aPlugin.first).send(); + Events_InfoMessage("Model_Session", "Can not load plugin '%1'") + .arg(aPlugin.first) + .send(); } } else { - Events_InfoMessage("Model_Session", - "Feature '%1' not found in any plugin").arg(theFeatureID).send(); + Events_InfoMessage("Model_Session", "Feature '%1' not found in any plugin") + .arg(theFeatureID) + .send(); } - return FeaturePtr(); // return nothing + return FeaturePtr(); // return nothing } -std::shared_ptr Model_Session::moduleDocument() -{ +std::shared_ptr Model_Session::moduleDocument() { Handle(Model_Application) anApp = Model_Application::getApplication(); bool aFirstCall = !anApp->hasRoot(); if (aFirstCall) { @@ -258,35 +248,36 @@ std::shared_ptr Model_Session::moduleDocument() // even before the first "createFeature" call (in unit tests) LoadPluginsInfo(); - // creation of the root document is always outside of the transaction, so, avoid checking it + // creation of the root document is always outside of the transaction, so, + // avoid checking it setCheckTransactions(false); anApp->createDocument(0); // 0 is a root ID - // creation of the root document is always outside of the transaction, so, avoid checking it + // creation of the root document is always outside of the transaction, so, + // avoid checking it setCheckTransactions(true); - if (!myCurrentDoc || !Model_Application::getApplication()->hasDocument(myCurrentDoc->id())) { + if (!myCurrentDoc || + !Model_Application::getApplication()->hasDocument(myCurrentDoc->id())) { myCurrentDoc = moduleDocument(); static std::shared_ptr aMsg( - new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED))); + new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED))); Events_Loop::loop()->send(aMsg); } } return anApp->rootDocument(); } -std::shared_ptr Model_Session::document(int theDocID) -{ +std::shared_ptr Model_Session::document(int theDocID) { return std::shared_ptr( Model_Application::getApplication()->document(theDocID)); } -bool Model_Session::hasModuleDocument() -{ +bool Model_Session::hasModuleDocument() { return Model_Application::getApplication()->hasRoot(); } -std::shared_ptr Model_Session::activeDocument() -{ - if (!myCurrentDoc || !Model_Application::getApplication()->hasDocument(myCurrentDoc->id())) { +std::shared_ptr Model_Session::activeDocument() { + if (!myCurrentDoc || + !Model_Application::getApplication()->hasDocument(myCurrentDoc->id())) { return moduleDocument(); } return myCurrentDoc; @@ -295,12 +286,14 @@ std::shared_ptr Model_Session::activeDocument() /// makes the last feature in the document as the current static void makeCurrentLast(std::shared_ptr theDoc) { if (theDoc.get()) { - FeaturePtr aLast = std::dynamic_pointer_cast(theDoc)->lastFeature(); + FeaturePtr aLast = + std::dynamic_pointer_cast(theDoc)->lastFeature(); // if last is nested into something else, make this something else as last: - // otherwise it will look like edition of sub-element, so, the main will be disabled + // otherwise it will look like edition of sub-element, so, the main will be + // disabled if (aLast.get()) { CompositeFeaturePtr aMain = ModelAPI_Tools::compositeOwner(aLast); - while(aMain.get()) { + while (aMain.get()) { aLast = aMain; aMain = ModelAPI_Tools::compositeOwner(aLast); } @@ -309,9 +302,8 @@ static void makeCurrentLast(std::shared_ptr theDoc) { } } -void Model_Session::setActiveDocument( - std::shared_ptr theDoc, bool theSendSignal) -{ +void Model_Session::setActiveDocument(std::shared_ptr theDoc, + bool theSendSignal) { if (myCurrentDoc != theDoc) { if (myCurrentDoc.get()) myCurrentDoc->setActive(false); @@ -321,78 +313,95 @@ void Model_Session::setActiveDocument( std::shared_ptr aPrevious = myCurrentDoc; myCurrentDoc = theDoc; if (theDoc.get() && theSendSignal) { - // this must be before the synchronization call because features in PartSet lower than this - // part feature must be disabled and don't recomputed anymore (issue 1156, - // translation feature is failed on activation of Part 2) - if (isOperation()) { // do it only in transaction, not on opening of document + // this must be before the synchronization call because features in + // PartSet lower than this part feature must be disabled and don't + // recomputed anymore (issue 1156, translation feature is failed on + // activation of Part 2) + if (isOperation()) { // do it only in transaction, not on opening of + // document DocumentPtr aRoot = moduleDocument(); if (myCurrentDoc != aRoot) { - FeaturePtr aPartFeat = ModelAPI_Tools::findPartFeature(aRoot, myCurrentDoc); + FeaturePtr aPartFeat = + ModelAPI_Tools::findPartFeature(aRoot, myCurrentDoc); if (aPartFeat.get()) { aRoot->setCurrentFeature(aPartFeat, false); } } } - // synchronize the document: it may be just opened or opened but removed before - std::shared_ptr aDoc = std::dynamic_pointer_cast(theDoc); + // synchronize the document: it may be just opened or opened but removed + // before + std::shared_ptr aDoc = + std::dynamic_pointer_cast(theDoc); if (aDoc.get()) { bool aWasChecked = myCheckTransactions; setCheckTransactions(false); TDF_LabelList anEmptyUpdated; - aDoc->objects()->synchronizeFeatures(anEmptyUpdated, true, true, false, true); + aDoc->objects()->synchronizeFeatures(anEmptyUpdated, true, true, false, + true); if (aWasChecked) - setCheckTransactions(true); + setCheckTransactions(true); } static std::shared_ptr aMsg( new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED))); Events_Loop::loop()->send(aMsg); } - // make the current state correct and synchronized in the module and sub-documents - if (isOperation()) { // do it only in transaction, not on opening of document + // make the current state correct and synchronized in the module and + // sub-documents + if (isOperation()) { // do it only in transaction, not on opening of + // document if (myCurrentDoc == moduleDocument()) { - // make the current feature the latest in root, in previous root current become also last + // make the current feature the latest in root, in previous root current + // become also last makeCurrentLast(aPrevious); makeCurrentLast(myCurrentDoc); } else { - // make the current feature the latest in sub, root current feature becomes this sub + // make the current feature the latest in sub, root current feature + // becomes this sub makeCurrentLast(myCurrentDoc); } } } } -std::list > Model_Session::allOpenedDocuments() -{ - std::list > aResult; +std::list> +Model_Session::allOpenedDocuments() { + std::list> aResult; aResult.push_back(moduleDocument()); // add subs recursively - std::list >::iterator aDocIt = aResult.begin(); - for(; aDocIt != aResult.end(); aDocIt++) { + std::list>::iterator aDocIt = + aResult.begin(); + for (; aDocIt != aResult.end(); aDocIt++) { DocumentPtr anAPIDoc = *aDocIt; - std::shared_ptr aDoc = std::dynamic_pointer_cast(anAPIDoc); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(anAPIDoc); if (aDoc) { const std::set aSubs = aDoc->subDocuments(); std::set::const_iterator aSubIter = aSubs.cbegin(); - for(; aSubIter != aSubs.cend(); aSubIter++) { - aResult.push_back(Model_Application::getApplication()->document(*aSubIter)); + for (; aSubIter != aSubs.cend(); aSubIter++) { + aResult.push_back( + Model_Application::getApplication()->document(*aSubIter)); } } } return aResult; } -bool Model_Session::isLoadByDemand(const std::wstring theDocID, const int theDocIndex) -{ - return Model_Application::getApplication()->isLoadByDemand(theDocID, theDocIndex); +bool Model_Session::isLoadByDemand(const std::wstring theDocID, + const int theDocIndex) { + return Model_Application::getApplication()->isLoadByDemand(theDocID, + theDocIndex); } -std::shared_ptr Model_Session::copy( - std::shared_ptr theSource, const int theDestID) -{ - std::shared_ptr aNew = Model_Application::getApplication()->document(theDestID); +std::shared_ptr +Model_Session::copy(std::shared_ptr theSource, + const int theDestID) { + std::shared_ptr aNew = + Model_Application::getApplication()->document(theDestID); // make a copy of all labels - TDF_Label aSourceRoot = std::dynamic_pointer_cast(theSource)->document()->Main() - .Father(); + TDF_Label aSourceRoot = std::dynamic_pointer_cast(theSource) + ->document() + ->Main() + .Father(); TDF_Label aTargetRoot = aNew->document()->Main().Father(); Handle(TDF_DataSet) aDS = new TDF_DataSet; aDS->AddLabel(aSourceRoot); @@ -402,35 +411,36 @@ std::shared_ptr Model_Session::copy( TDF_CopyTool::Copy(aDS, aRT); // TODO: remove after fix in OCCT. - // All named shapes are stored in reversed order, so to fix this we reverse them back. - for(TDF_ChildIDIterator aChildIter(aTargetRoot, TNaming_NamedShape::GetID(), true); - aChildIter.More(); - aChildIter.Next()) { + // All named shapes are stored in reversed order, so to fix this we reverse + // them back. + for (TDF_ChildIDIterator aChildIter(aTargetRoot, TNaming_NamedShape::GetID(), + true); + aChildIter.More(); aChildIter.Next()) { Handle(TNaming_NamedShape) aNamedShape = - Handle(TNaming_NamedShape)::DownCast(aChildIter.Value()); + Handle(TNaming_NamedShape)::DownCast(aChildIter.Value()); if (aNamedShape.IsNull()) { continue; } TopoDS_Shape aShape = aNamedShape->Get(); - if(aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) { + if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) { continue; } TNaming_Evolution anEvol = aNamedShape->Evolution(); - std::list > aShapePairs; // to store old and new shapes - for(TNaming_Iterator anIter(aNamedShape); anIter.More(); anIter.Next()) { - aShapePairs.push_back( - std::pair(anIter.OldShape(), anIter.NewShape())); + std::list> + aShapePairs; // to store old and new shapes + for (TNaming_Iterator anIter(aNamedShape); anIter.More(); anIter.Next()) { + aShapePairs.push_back(std::pair( + anIter.OldShape(), anIter.NewShape())); } // Add in reverse order. TDF_Label aLabel = aNamedShape->Label(); TNaming_Builder aBuilder(aLabel); - for(std::list >::iterator aPairsIter = - aShapePairs.begin(); - aPairsIter != aShapePairs.end(); - aPairsIter++) { + for (std::list>::iterator aPairsIter = + aShapePairs.begin(); + aPairsIter != aShapePairs.end(); aPairsIter++) { if (anEvol == TNaming_GENERATED) { aBuilder.Generated(aPairsIter->first, aPairsIter->second); } else if (anEvol == TNaming_MODIFY) { @@ -450,57 +460,68 @@ std::shared_ptr Model_Session::copy( return aNew; } -Model_Session::Model_Session() -{ +Model_Session::Model_Session() { myPluginsInfoLoaded = false; myCheckTransactions = true; myIsLoading = false; ModelAPI_Session::setSession(std::shared_ptr(this)); // register the configuration reading listener - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); static const Events_ID kFeatureEvent = - Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT()); + Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT()); aLoop->registerListener(this, kFeatureEvent); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED), 0, true); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED), 0, true); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED), 0, true); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_VALIDATOR_LOADED)); - aLoop->registerListener(this, Events_Loop::eventByName(Config_PluginMessage::EVENT_ID())); -} - -void Model_Session::processEvent(const std::shared_ptr& theMessage) -{ + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED), + 0, true); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED), + 0, true); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED), + 0, true); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_VALIDATOR_LOADED)); + aLoop->registerListener( + this, Events_Loop::eventByName(Config_PluginMessage::EVENT_ID())); +} + +void Model_Session::processEvent( + const std::shared_ptr &theMessage) { static const Events_ID kFeatureEvent = - Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT()); - static const Events_ID kValidatorEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED); - static const Events_ID kPluginEvent = Events_Loop::eventByName(Config_PluginMessage::EVENT_ID()); + Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT()); + static const Events_ID kValidatorEvent = + Events_Loop::eventByName(EVENT_VALIDATOR_LOADED); + static const Events_ID kPluginEvent = + Events_Loop::eventByName(Config_PluginMessage::EVENT_ID()); if (theMessage->eventID() == kFeatureEvent) { const std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMsg) { // process the plugin info, load plugin if (myPlugins.find(aMsg->id()) == myPlugins.end()) { myPlugins[aMsg->id()] = std::pair( - aMsg->pluginLibrary(), aMsg->documentKind()); + aMsg->pluginLibrary(), aMsg->documentKind()); } } else { const std::shared_ptr aMsgAttr = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMsgAttr) { if (!aMsgAttr->isObligatory()) { - validators()->registerNotObligatory(aMsgAttr->featureId(), aMsgAttr->attributeId()); + validators()->registerNotObligatory(aMsgAttr->featureId(), + aMsgAttr->attributeId()); } - if(aMsgAttr->isConcealment()) { - validators()->registerConcealment(aMsgAttr->featureId(), aMsgAttr->attributeId()); + if (aMsgAttr->isConcealment()) { + validators()->registerConcealment(aMsgAttr->featureId(), + aMsgAttr->attributeId()); } - if(aMsgAttr->isMainArgument()) { - validators()->registerMainArgument(aMsgAttr->featureId(), aMsgAttr->attributeId()); + if (aMsgAttr->isMainArgument()) { + validators()->registerMainArgument(aMsgAttr->featureId(), + aMsgAttr->attributeId()); } - const std::list >& aCases = aMsgAttr->getCases(); + const std::list> &aCases = + aMsgAttr->getCases(); if (!aCases.empty()) { - validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(), aCases); + validators()->registerCase(aMsgAttr->featureId(), + aMsgAttr->attributeId(), aCases); } if (aMsgAttr->isGeometricalSelection()) { validators()->registerGeometricalSelection(aMsgAttr->featureId(), @@ -512,40 +533,45 @@ void Model_Session::processEvent(const std::shared_ptr& theMessa myPluginsInfoLoaded = true; } else if (theMessage->eventID() == kValidatorEvent) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMsg) { - if (aMsg->attributeId().empty()) { // feature validator - validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->parameters()); - } else { // attribute validator - validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->attributeId(), + if (aMsg->attributeId().empty()) { // feature validator + validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->parameters()); + } else { // attribute validator + validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), + aMsg->attributeId(), aMsg->parameters()); } } - } else if (theMessage->eventID() == kPluginEvent) { // plugin is started to load + } else if (theMessage->eventID() == + kPluginEvent) { // plugin is started to load std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMsg.get()) { myCurrentPluginName = aMsg->pluginId(); if (!aMsg->uses().empty()) { myUsePlugins[myCurrentPluginName] = aMsg->uses(); } } - } else { // create/update/delete + } else { // create/update/delete if (myCheckTransactions && !isOperation()) { // check it is done in real opened document: 2958 bool aIsActual = true; - static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + static const Events_ID kDeletedEvent = + Events_Loop::eventByName(EVENT_OBJECT_DELETED); if (theMessage->eventID() == kDeletedEvent) { aIsActual = false; std::shared_ptr aDeleted = - std::dynamic_pointer_cast(theMessage); - std::list > allOpened = - Model_Session::allOpenedDocuments(); - std::list, std::string>>::const_iterator - aGIter = aDeleted->groups().cbegin(); + std::dynamic_pointer_cast( + theMessage); + std::list> allOpened = + Model_Session::allOpenedDocuments(); + std::list, std::string>>:: + const_iterator aGIter = aDeleted->groups().cbegin(); for (; !aIsActual && aGIter != aDeleted->groups().cend(); aGIter++) { - std::list >::iterator anOpened = allOpened.begin(); - for(; anOpened != allOpened.end(); anOpened++) { + std::list>::iterator anOpened = + allOpened.begin(); + for (; anOpened != allOpened.end(); anOpened++) { if (aGIter->first == *anOpened) { aIsActual = true; break; @@ -555,38 +581,46 @@ void Model_Session::processEvent(const std::shared_ptr& theMessa } if (aIsActual) - Events_InfoMessage("Model_Session", - "Modification of data structure outside of the transaction").send(); + Events_InfoMessage( + "Model_Session", + "Modification of data structure outside of the transaction") + .send(); } - // if part is deleted, make the root as the current document (on undo of Parts creations) - static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + // if part is deleted, make the root as the current document (on undo of + // Parts creations) + static const Events_ID kDeletedEvent = + Events_Loop::eventByName(EVENT_OBJECT_DELETED); if (theMessage->eventID() == kDeletedEvent) { std::shared_ptr aDeleted = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); - std::list, std::string>>::const_iterator - aGIter = aDeleted->groups().cbegin(); + std::list, std::string>>:: + const_iterator aGIter = aDeleted->groups().cbegin(); for (; aGIter != aDeleted->groups().cend(); aGIter++) { if (aGIter->second == ModelAPI_ResultPart::group()) break; } - if (aGIter != aDeleted->groups().cend()) - { - // check that the current feature of the session is still the active Part (even disabled) + if (aGIter != aDeleted->groups().cend()) { + // check that the current feature of the session is still the active + // Part (even disabled) bool aFound = false; FeaturePtr aCurrentPart = moduleDocument()->currentFeature(true); if (aCurrentPart.get()) { - const std::list >& aResList = aCurrentPart->results(); - std::list >::const_iterator aRes = aResList.begin(); - for(; !aFound && aRes != aResList.end(); aRes++) { - ResultPartPtr aPRes = std::dynamic_pointer_cast(*aRes); - if (aPRes.get() && aPRes->isActivated() && aPRes->partDoc() == activeDocument()) { + const std::list> &aResList = + aCurrentPart->results(); + std::list>::const_iterator aRes = + aResList.begin(); + for (; !aFound && aRes != aResList.end(); aRes++) { + ResultPartPtr aPRes = + std::dynamic_pointer_cast(*aRes); + if (aPRes.get() && aPRes->isActivated() && + aPRes->partDoc() == activeDocument()) { aFound = true; - } } } - if (!aFound) { // if not, the part was removed, so activate the module document + if (!aFound) { // if not, the part was removed, so activate the module + // document if (myCurrentDoc.get()) setActiveDocument(moduleDocument()); } @@ -595,96 +629,92 @@ void Model_Session::processEvent(const std::shared_ptr& theMessa } } -void Model_Session::LoadPluginsInfo() -{ - if (myPluginsInfoLoaded) // nothing to do +void Model_Session::LoadPluginsInfo() { + if (myPluginsInfoLoaded) // nothing to do return; // Read plugins information from XML files Config_ModuleReader aModuleReader(Config_FeatureMessage::MODEL_EVENT()); aModuleReader.readAll(); std::set aFiles = aModuleReader.modulePluginFiles(); std::set::iterator it = aFiles.begin(); - for ( ; it != aFiles.end(); it++ ) { - Config_ValidatorReader aValidatorReader (*it); + for (; it != aFiles.end(); it++) { + Config_ValidatorReader aValidatorReader(*it); aValidatorReader.readAll(); }; - } -void Model_Session::registerPlugin(ModelAPI_Plugin* thePlugin) -{ +void Model_Session::registerPlugin(ModelAPI_Plugin *thePlugin) { myPluginObjs[myCurrentPluginName] = thePlugin; - static Events_ID EVENT_LOAD = Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED); + static Events_ID EVENT_LOAD = + Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED); ModelAPI_EventCreator::get()->sendUpdated(ObjectPtr(), EVENT_LOAD, false); // If the plugin has an ability to process GUI events, register it - Events_Listener* aListener = dynamic_cast(thePlugin); + Events_Listener *aListener = dynamic_cast(thePlugin); if (aListener) { - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aStateRequestEventId = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_REQUEST); aLoop->registerListener(aListener, aStateRequestEventId); } } -ModelAPI_ValidatorsFactory* Model_Session::validators() -{ - static Model_ValidatorsFactory* aFactory = new Model_ValidatorsFactory; +ModelAPI_ValidatorsFactory *Model_Session::validators() { + static Model_ValidatorsFactory *aFactory = new Model_ValidatorsFactory; return aFactory; } -ModelAPI_FiltersFactory* Model_Session::filters() -{ - static Model_FiltersFactory* aFactory = new Model_FiltersFactory; +ModelAPI_FiltersFactory *Model_Session::filters() { + static Model_FiltersFactory *aFactory = new Model_FiltersFactory; return aFactory; } -int Model_Session::transactionID() -{ - return ROOT_DOC->transactionID(); -} +int Model_Session::transactionID() { return ROOT_DOC->transactionID(); } -bool Model_Session::isAutoUpdateBlocked() -{ +bool Model_Session::isAutoUpdateBlocked() { Handle(Model_Application) anApp = Model_Application::getApplication(); - if (!anApp->hasRoot()) // when document is not yet created, do not create it by such simple call + if (!anApp->hasRoot()) // when document is not yet created, do not create it + // by such simple call return false; return !ROOT_DOC->autoRecomutationState(); } -void Model_Session::blockAutoUpdate(const bool theBlock) -{ +void Model_Session::blockAutoUpdate(const bool theBlock) { bool aCurrentState = isAutoUpdateBlocked(); if (aCurrentState != theBlock) { - // if there is no operation, start it to avoid modifications outside of transaction + // if there is no operation, start it to avoid modifications outside of + // transaction bool isOperation = this->isOperation(); if (!isOperation) startOperation("Auto update"); ROOT_DOC->setAutoRecomutationState(!theBlock); - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); if (theBlock) { - static const Events_ID kAutoOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE); + static const Events_ID kAutoOff = + aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE); std::shared_ptr aMsg(new Events_Message(kAutoOff)); aLoop->send(aMsg); } else { - // if there is no operation, start it to avoid modifications outside of transaction + // if there is no operation, start it to avoid modifications outside of + // transaction isOperation = this->isOperation(); if (!isOperation) startOperation("Auto update enabling"); - static const Events_ID kAutoOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE); + static const Events_ID kAutoOn = + aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE); std::shared_ptr aMsg(new Events_Message(kAutoOn)); aLoop->send(aMsg); } if (!isOperation) { finishOperation(); - // append this transaction to the previous one: don't need this separated operation in list + // append this transaction to the previous one: don't need this separated + // operation in list ROOT_DOC->appendTransactionToPrevious(); } } } #ifdef TINSPECTOR -Handle(TDocStd_Application) Model_Session::application() -{ +Handle(TDocStd_Application) Model_Session::application() { return Model_Application::getApplication(); } #endif diff --git a/src/Model/Model_Session.h b/src/Model/Model_Session.h index c74f95286..91b78956b 100644 --- a/src/Model/Model_Session.h +++ b/src/Model/Model_Session.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Session_H_ #define Model_Session_H_ #include "Model.h" -#include #include +#include #include #include @@ -36,18 +37,21 @@ class Model_Document; /**\class Model_Session * \ingroup DataModel * \brief Object that knows (from the initial XML file) which - * plugin contains which feature, loads and stores reference to loaded plugins by - * the feature functionality request. + * plugin contains which feature, loads and stores reference to loaded plugins + * by the feature functionality request. */ -class Model_Session : public ModelAPI_Session, public Events_Listener -{ - bool myPluginsInfoLoaded; ///< it true if plugins information is loaded +class Model_Session : public ModelAPI_Session, public Events_Listener { + bool myPluginsInfoLoaded; ///< it true if plugins information is loaded /// map of feature IDs to plugin name and document kind - std::map > myPlugins; - std::map myPluginObjs; ///< instances of the already plugins - std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently - std::shared_ptr myCurrentDoc; ///< current working document - ///< map from plugin id to plugins which are used by it (must be loaded before this one) + std::map> myPlugins; + std::map + myPluginObjs; ///< instances of the already plugins + std::string + myCurrentPluginName; ///< name of the plugin that must be loaded currently + std::shared_ptr + myCurrentDoc; ///< current working document + ///< map from plugin id to plugins which are used by it + ///< (must be loaded before this one) std::map myUsePlugins; /// if true, generates error if document is updated outside of transaction @@ -55,18 +59,19 @@ class Model_Session : public ModelAPI_Session, public Events_Listener /// if true, the current operation must be committed twice, /// with nested (list for any nesting depth) std::list myOperationAttachedToNext; - public: +public: //! Loads the OCAF document from the file. //! \param theFileName full name of the file to load //! \returns true if file was loaded successfully - MODEL_EXPORT virtual bool load(const char* theFileName); + MODEL_EXPORT virtual bool load(const char *theFileName); //! Saves the OCAF document to the file. //! \param theFileName full name of the file to store //! \param theResults the result full file names that were stored by "save" //! \returns true if file was stored successfully - MODEL_EXPORT virtual bool save(const char* theFileName, std::list& theResults); + MODEL_EXPORT virtual bool save(const char *theFileName, + std::list &theResults); //! Closes all documents MODEL_EXPORT virtual void closeAll(); @@ -74,15 +79,19 @@ class Model_Session : public ModelAPI_Session, public Events_Listener //! Starts a new operation (opens a transaction) //! \param theId string-identifier of the started transaction //! \param theAttachedToNested if it is true, - //! it means that this transaction is attached to the nested - //! where it is located and will be committed on the next commit with the nested - MODEL_EXPORT virtual void startOperation( - const std::string& theId = "", const bool theAttachedToNested = false); + //! it means that this transaction is attached to + //! the nested + //! where it is located and will be committed on the next commit with + //! the nested + MODEL_EXPORT virtual void + startOperation(const std::string &theId = "", + const bool theAttachedToNested = false); //! Finishes the previously started operation (closes the transaction) MODEL_EXPORT virtual void finishOperation(); //! Aborts the operation MODEL_EXPORT virtual void abortOperation(); - //! Returns true if operation has been started, but not yet finished or aborted + //! Returns true if operation has been started, but not yet finished or + //! aborted MODEL_EXPORT virtual bool isOperation(); //! Returns true if document was modified (since creation/opening) MODEL_EXPORT virtual bool isModified(); @@ -102,11 +111,14 @@ class Model_Session : public ModelAPI_Session, public Events_Listener //! Clears undo and redo lists of all documents in the session MODEL_EXPORT virtual void clearUndoRedo(); - /// Returns the root document of the application (that may contains sub-documents) + /// Returns the root document of the application (that may contains + /// sub-documents) MODEL_EXPORT virtual std::shared_ptr moduleDocument(); - /// Returns the document by ID, loads if not loaded yet. Returns null if no such document. - MODEL_EXPORT virtual std::shared_ptr document(int theDocID); + /// Returns the document by ID, loads if not loaded yet. Returns null if no + /// such document. + MODEL_EXPORT virtual std::shared_ptr + document(int theDocID); /// Return true if root document has been already created MODEL_EXPORT virtual bool hasModuleDocument(); @@ -115,49 +127,52 @@ class Model_Session : public ModelAPI_Session, public Events_Listener MODEL_EXPORT virtual std::shared_ptr activeDocument(); /// Defines the current document that used for current work in the application - MODEL_EXPORT virtual void setActiveDocument( - std::shared_ptr theDoc, bool theSendSignal = true); + MODEL_EXPORT virtual void + setActiveDocument(std::shared_ptr theDoc, + bool theSendSignal = true); /// Returns all the opened documents of the session (without postponed) - MODEL_EXPORT virtual std::list > allOpenedDocuments(); + MODEL_EXPORT virtual std::list> + allOpenedDocuments(); /// Returns true if document is not loaded yet - MODEL_EXPORT virtual bool isLoadByDemand(const std::wstring theDocID, const int theDocIndex); + MODEL_EXPORT virtual bool isLoadByDemand(const std::wstring theDocID, + const int theDocIndex); /// Registers the plugin that creates features. - /// It is obligatory for each plugin to call this function on loading to be found by - /// the plugin manager on call of the feature) - MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin* thePlugin); + /// It is obligatory for each plugin to call this function on loading to be + /// found by the plugin manager on call of the feature) + MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin *thePlugin); /// Verifies the license for the plugin is valid - MODEL_EXPORT virtual bool checkLicense(const std::string& thePluginName); + MODEL_EXPORT virtual bool checkLicense(const std::string &thePluginName); /// Processes the configuration file reading - MODEL_EXPORT virtual void processEvent(const std::shared_ptr& theMessage); + MODEL_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage); /// Copies the document to the new one - MODEL_EXPORT virtual std::shared_ptr copy( - std::shared_ptr theSource, const int theDestID); + MODEL_EXPORT virtual std::shared_ptr + copy(std::shared_ptr theSource, const int theDestID); /// Returns the validators factory: the only one instance per application - MODEL_EXPORT virtual ModelAPI_ValidatorsFactory* validators(); + MODEL_EXPORT virtual ModelAPI_ValidatorsFactory *validators(); /// Returns the filters factory: the only one instance per application - MODEL_EXPORT virtual ModelAPI_FiltersFactory* filters(); + MODEL_EXPORT virtual ModelAPI_FiltersFactory *filters(); /// Sets the flag to check modifications outside the transaction or not - void setCheckTransactions(const bool theCheck) - { + void setCheckTransactions(const bool theCheck) { myCheckTransactions = theCheck; } /// Is called only once, on startup of the application Model_Session(); - /// Returns the global identifier of the current transaction (needed for the update algo) + /// Returns the global identifier of the current transaction (needed for the + /// update algo) MODEL_EXPORT virtual int transactionID(); - /// Returns true if auto-update in the application is blocked MODEL_EXPORT virtual bool isAutoUpdateBlocked(); @@ -168,15 +183,16 @@ class Model_Session : public ModelAPI_Session, public Events_Listener MODEL_EXPORT virtual Handle(TDocStd_Application) application(); #endif - protected: +protected: /// Loads (if not done yet) the information about the features and plugins void LoadPluginsInfo(); /// Creates the feature object using plugins functionality - FeaturePtr createFeature(std::string theFeatureID, Model_Document* theDocOwner); + FeaturePtr createFeature(std::string theFeatureID, + Model_Document *theDocOwner); /// Get the plugin by name. If it is not loaded, load plugin. - ModelAPI_Plugin* getPlugin(const std::string& thePluginName); + ModelAPI_Plugin *getPlugin(const std::string &thePluginName); friend class Model_Document; friend class Model_Objects; diff --git a/src/Model/Model_Tools.cpp b/src/Model/Model_Tools.cpp index 4ddead221..cd8415328 100644 --- a/src/Model/Model_Tools.cpp +++ b/src/Model/Model_Tools.cpp @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include @@ -31,8 +32,8 @@ #include -#include #include +#include #include #include @@ -41,8 +42,7 @@ #include void Model_Tools::copyLabels(TDF_Label theSource, TDF_Label theDestination, - Handle(TDF_RelocationTable) theRelocTable) -{ + Handle(TDF_RelocationTable) theRelocTable) { theRelocTable->SetRelocation(theSource, theDestination); // copy the sub-labels hierarchy TDF_ChildIterator aSubLabsIter(theSource); @@ -54,47 +54,49 @@ void Model_Tools::copyLabels(TDF_Label theSource, TDF_Label theDestination, } void Model_Tools::copyAttrs(TDF_Label theSource, TDF_Label theDestination, - Handle(TDF_RelocationTable) theRelocTable) -{ + Handle(TDF_RelocationTable) theRelocTable) { TDF_AttributeIterator anAttrIter(theSource); - for(; anAttrIter.More(); anAttrIter.Next()) { + for (; anAttrIter.More(); anAttrIter.Next()) { Handle(TDF_Attribute) aTargetAttr; if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) { // create a new attribute if not yet exists in the destination - aTargetAttr = anAttrIter.Value()->NewEmpty(); + aTargetAttr = anAttrIter.Value()->NewEmpty(); if (aTargetAttr->ID() != anAttrIter.Value()->ID()) aTargetAttr->SetID(anAttrIter.Value()->ID()); theDestination.AddAttribute(aTargetAttr); } - // no special relocation, empty map, but self-relocation is on: copy references w/o changes + // no special relocation, empty map, but self-relocation is on: copy + // references w/o changes Handle(TDF_RelocationTable) aRelocTable = - theRelocTable.IsNull() ? new TDF_RelocationTable(Standard_True) : theRelocTable; + theRelocTable.IsNull() ? new TDF_RelocationTable(Standard_True) + : theRelocTable; anAttrIter.Value()->Paste(aTargetAttr, aRelocTable); - // an exception: if a source reference refers itself, a copy must also refer itself + // an exception: if a source reference refers itself, a copy must also refer + // itself if (aTargetAttr->ID() == TDF_Reference::GetID()) { - Handle(TDF_Reference) aTargetRef = Handle(TDF_Reference)::DownCast(aTargetAttr); + Handle(TDF_Reference) aTargetRef = + Handle(TDF_Reference)::DownCast(aTargetAttr); if (aTargetRef->Get().IsEqual(anAttrIter.Value()->Label())) aTargetRef->Set(aTargetRef->Label()); } } // copy the sub-labels content TDF_ChildIterator aSubLabsIter(theSource); - for(; aSubLabsIter.More(); aSubLabsIter.Next()) { + for (; aSubLabsIter.More(); aSubLabsIter.Next()) { copyAttrs(aSubLabsIter.Value(), theDestination.FindChild(aSubLabsIter.Value().Tag()), theRelocTable); } } -static TCollection_AsciiString labelToString(TDF_Label theLabel) -{ +static TCollection_AsciiString labelToString(TDF_Label theLabel) { TCollection_AsciiString aLabString; TDF_Tool::Entry(theLabel, aLabString); return aLabString; } -static void makeExternalReference(TDF_Label theDestination, TDF_Label theReferred) -{ +static void makeExternalReference(TDF_Label theDestination, + TDF_Label theReferred) { Handle(TDF_Attribute) aReference, aComment, aString; theDestination.FindAttribute(TDF_Reference::GetID(), aReference); // create new attributes if not yet exists in the destination @@ -107,45 +109,46 @@ static void makeExternalReference(TDF_Label theDestination, TDF_Label theReferre theDestination.AddAttribute(aString); } // reference to itself - Handle(TDF_Reference)::DownCast(aReference)->Set(theDestination, theDestination); + Handle(TDF_Reference)::DownCast(aReference) + ->Set(theDestination, theDestination); // ID of the document std::ostringstream aDocIdStr; aDocIdStr << ModelAPI_Session::get()->moduleDocument()->id(); Handle(TDataStd_Comment)::DownCast(aComment)->Set(aDocIdStr.str().c_str()); // value of referred label - Handle(TDataStd_AsciiString)::DownCast(aString)->Set(labelToString(theReferred)); + Handle(TDataStd_AsciiString)::DownCast(aString)->Set( + labelToString(theReferred)); } void Model_Tools::copyAttrsAndKeepRefsToCoordinates( - TDF_Label theSource, - TDF_Label theDestination, - const std::set& theCoordinateLabels, - Handle(TDF_RelocationTable) theRelocTable) -{ + TDF_Label theSource, TDF_Label theDestination, + const std::set &theCoordinateLabels, + Handle(TDF_RelocationTable) theRelocTable) { TDF_AttributeIterator anAttrIter(theSource); - for(; anAttrIter.More(); anAttrIter.Next()) { + for (; anAttrIter.More(); anAttrIter.Next()) { Handle(TDF_Attribute) aTargetAttr; if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) { // create a new attribute if not yet exists in the destination - aTargetAttr = anAttrIter.Value()->NewEmpty(); + aTargetAttr = anAttrIter.Value()->NewEmpty(); if (aTargetAttr->ID() != anAttrIter.Value()->ID()) aTargetAttr->SetID(anAttrIter.Value()->ID()); theDestination.AddAttribute(aTargetAttr); } anAttrIter.Value()->Paste(aTargetAttr, theRelocTable); if (aTargetAttr->ID() == TDF_Reference::GetID()) { - Handle(TDF_Reference) aTargetRef = Handle(TDF_Reference)::DownCast(aTargetAttr); + Handle(TDF_Reference) aTargetRef = + Handle(TDF_Reference)::DownCast(aTargetAttr); if (aTargetRef->Get().IsNull()) { // may be refer to a cartesian coordinate entity - Handle(TDF_Reference) aSourceRef = Handle(TDF_Reference)::DownCast(anAttrIter.Value()); + Handle(TDF_Reference) aSourceRef = + Handle(TDF_Reference)::DownCast(anAttrIter.Value()); if (!aSourceRef.IsNull() && !aSourceRef->Get().IsNull()) { std::set::const_iterator aFound = theCoordinateLabels.find(labelToString(aSourceRef->Get())); if (aFound != theCoordinateLabels.end()) makeExternalReference(theDestination, aSourceRef->Get()); } - } - else if (aTargetRef->Get().IsEqual(anAttrIter.Value()->Label())) { + } else if (aTargetRef->Get().IsEqual(anAttrIter.Value()->Label())) { // a source reference refers itself, a copy must also refer itself aTargetRef->Set(aTargetRef->Label()); } @@ -153,19 +156,21 @@ void Model_Tools::copyAttrsAndKeepRefsToCoordinates( } // copy the sub-labels content TDF_ChildIterator aSubLabsIter(theSource); - for(; aSubLabsIter.More(); aSubLabsIter.Next()) { + for (; aSubLabsIter.More(); aSubLabsIter.Next()) { copyAttrsAndKeepRefsToCoordinates( - aSubLabsIter.Value(), theDestination.FindChild(aSubLabsIter.Value().Tag()), + aSubLabsIter.Value(), + theDestination.FindChild(aSubLabsIter.Value().Tag()), theCoordinateLabels, theRelocTable); } } -void Model_Tools::labelsOfCoordinates(std::set& theCoordinateLabels, - Handle(TDF_RelocationTable) theRelocTable) -{ +void Model_Tools::labelsOfCoordinates( + std::set &theCoordinateLabels, + Handle(TDF_RelocationTable) theRelocTable) { DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument(); std::list aFeatures = aPartSet->allFeatures(); - for (std::list::iterator aFIt = aFeatures.begin(); aFIt != aFeatures.end(); ++aFIt) { + for (std::list::iterator aFIt = aFeatures.begin(); + aFIt != aFeatures.end(); ++aFIt) { FeaturePtr aCurFeat = *aFIt; if (!aCurFeat->isInHistory() && (aCurFeat->getKind() == ConstructionPlugin_Point::ID() || @@ -177,7 +182,8 @@ void Model_Tools::labelsOfCoordinates(std::set& theCoor std::dynamic_pointer_cast(aResult->data()); TDF_Label aLab = aResData->label().Father(); theCoordinateLabels.insert(labelToString(aLab)); - // set relocation to empty, references will be set correctly while copying attributes + // set relocation to empty, references will be set correctly while + // copying attributes theRelocTable->SetRelocation(aLab, TDF_Label()); } } diff --git a/src/Model/Model_Tools.h b/src/Model/Model_Tools.h index bac982d6a..045b62b86 100644 --- a/src/Model/Model_Tools.h +++ b/src/Model/Model_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Tools_H_ @@ -29,8 +30,7 @@ #include /// A collection of methods useful for different parts of data model. -class Model_Tools -{ +class Model_Tools { public: /// makes copy of label and all its sub-labels without copying the attributes; /// and feel the relocation table @@ -39,18 +39,20 @@ public: /// makes copy of all attributes on the given label and all sub-labels static void copyAttrs(TDF_Label theSource, TDF_Label theDestination, - Handle(TDF_RelocationTable) theRelocTable = Handle(TDF_RelocationTable)()); + Handle(TDF_RelocationTable) + theRelocTable = Handle(TDF_RelocationTable)()); /// makes copy of all attributes on the given label and all sub-labels, /// but keep references to the Origin, coordinate axes and coordinate planes - static void copyAttrsAndKeepRefsToCoordinates(TDF_Label theSource, TDF_Label theDestination, - const std::set& theCoordinateLabels, + static void copyAttrsAndKeepRefsToCoordinates( + TDF_Label theSource, TDF_Label theDestination, + const std::set &theCoordinateLabels, Handle(TDF_RelocationTable) theRelocTable); /// collect labels of coordinate planes, axes, and origin - static void labelsOfCoordinates( - std::set& theCoordinateLabels, - Handle(TDF_RelocationTable) theRelocTable); + static void + labelsOfCoordinates(std::set &theCoordinateLabels, + Handle(TDF_RelocationTable) theRelocTable); }; #endif diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index aa0fb4cf7..f677ab2d3 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -14,55 +14,58 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include #include #include +#include +#include +#include +#include +#include #include +#include +#include #include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -Model_Update MY_UPDATER_INSTANCE; /// the only one instance initialized on load of the library +Model_Update MY_UPDATER_INSTANCE; /// the only one instance initialized on load + /// of the library //#define DEB_UPDATE #ifdef DEB_UPDATE #include #endif -Model_Update::Model_Update() -{ - Events_Loop* aLoop = Events_Loop::loop(); - static const Events_ID kChangedEvent = aLoop->eventByName("PreferenceChanged"); +Model_Update::Model_Update() { + Events_Loop *aLoop = Events_Loop::loop(); + static const Events_ID kChangedEvent = + aLoop->eventByName("PreferenceChanged"); aLoop->registerListener(this, kChangedEvent); - static const Events_ID kCreatedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED); + static const Events_ID kCreatedEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED); aLoop->registerListener(this, kCreatedEvent); - static const Events_ID kUpdatedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID kUpdatedEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); aLoop->registerListener(this, kUpdatedEvent); static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation"); aLoop->registerListener(this, kOpFinishEvent); @@ -70,20 +73,27 @@ Model_Update::Model_Update() aLoop->registerListener(this, kOpAbortEvent); static const Events_ID kOpStartEvent = aLoop->eventByName("StartOperation"); aLoop->registerListener(this, kOpStartEvent); - static const Events_ID kStabilityEvent = aLoop->eventByName(EVENT_STABILITY_CHANGED); + static const Events_ID kStabilityEvent = + aLoop->eventByName(EVENT_STABILITY_CHANGED); aLoop->registerListener(this, kStabilityEvent); - static const Events_ID kPreviewBlockedEvent = aLoop->eventByName(EVENT_PREVIEW_BLOCKED); + static const Events_ID kPreviewBlockedEvent = + aLoop->eventByName(EVENT_PREVIEW_BLOCKED); aLoop->registerListener(this, kPreviewBlockedEvent); - static const Events_ID kPreviewRequestedEvent = aLoop->eventByName(EVENT_PREVIEW_REQUESTED); + static const Events_ID kPreviewRequestedEvent = + aLoop->eventByName(EVENT_PREVIEW_REQUESTED); aLoop->registerListener(this, kPreviewRequestedEvent); - static const Events_ID kReorderEvent = aLoop->eventByName(EVENT_ORDER_UPDATED); + static const Events_ID kReorderEvent = + aLoop->eventByName(EVENT_ORDER_UPDATED); aLoop->registerListener(this, kReorderEvent); - static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION); + static const Events_ID kUpdatedSel = + aLoop->eventByName(EVENT_UPDATE_SELECTION); aLoop->registerListener(this, kUpdatedSel); - static const Events_ID kAutoRecomp = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE); + static const Events_ID kAutoRecomp = + aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE); aLoop->registerListener(this, kAutoRecomp); - // Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true"; + // Config_PropManager::findProp("Model update", "automatic_rebuild")->value() + // == "true"; myIsParamUpdated = false; myIsFinish = false; myIsProcessed = false; @@ -96,17 +106,19 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { if (!theFeature->data()->isValid()) return false; // delete an extrusion created on the sketch - - bool isNotExecuted = theFeature->isPersistentResult() && - !std::dynamic_pointer_cast((theFeature)->document())->executeFeatures(); + bool isNotExecuted = + theFeature->isPersistentResult() && + !std::dynamic_pointer_cast((theFeature)->document()) + ->executeFeatures(); if (isNotExecuted) { - redisplayWithResults(theFeature, ModelAPI_StateNothing, false); // redisplay even not executed - if (!theReason.get()) // no reason => no construction reason + redisplayWithResults(theFeature, ModelAPI_StateNothing, + false); // redisplay even not executed + if (!theReason.get()) // no reason => no construction reason return false; if (myNotPersistentRefs.find(theFeature) == myNotPersistentRefs.end()) { myNotPersistentRefs[theFeature].insert(theReason); } else { - std::set > aNewSet; + std::set> aNewSet; aNewSet.insert(theReason); myNotPersistentRefs[theFeature] = aNewSet; } @@ -118,28 +130,34 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { if (theReason.get()) myProcessOnFinish[theFeature].insert(theReason); else if (myProcessOnFinish.find(theFeature) == myProcessOnFinish.end()) - myProcessOnFinish[theFeature] = std::set >(); + myProcessOnFinish[theFeature] = + std::set>(); #ifdef DEB_UPDATE - std::wcout<name()<name() + << std::endl; #endif - // keeps the currently updated features to avoid infinitive cycling here: where feature on - // "updateArguments" sends "updated" (in selection attribute) and goes here again + // keeps the currently updated features to avoid infinitive cycling here: + // where feature on "updateArguments" sends "updated" (in selection + // attribute) and goes here again static std::set aCurrentlyUpdated; if (aCurrentlyUpdated.find(theFeature) == aCurrentlyUpdated.end()) { aCurrentlyUpdated.insert(theFeature); updateArguments(theFeature); aCurrentlyUpdated.erase(theFeature); } - // make it without conditions otherwise the apply button may have a bad state + // make it without conditions otherwise the apply button may have a bad + // state theFeature->data()->execState(ModelAPI_StateDone); - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); - // need to be validated to update the "Apply" state if not previewed + static ModelAPI_ValidatorsFactory *aFactory = + ModelAPI_Session::get()->validators(); + // need to be validated to update the "Apply" state if not previewed aFactory->validate(theFeature); // to redisplay split's arguments presentation, even result is not computed if (!theFeature->isPreviewNeeded()) { - static Events_Loop* aLoop = Events_Loop::loop(); - static const Events_ID kRedisplayEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_Loop *aLoop = Events_Loop::loop(); + static const Events_ID kRedisplayEvent = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(theFeature, kRedisplayEvent); aLoop->flush(kRedisplayEvent); } @@ -150,8 +168,8 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { if (myModified.find(theFeature) != myModified.end()) { if (theReason.get()) { #ifdef DEB_UPDATE - //std::cout<<"*** Add already modified " - // <name()<<" reason "<name()<name()<<" reason "<name()<isDisabled(); if (!aIsDisabled) { - std::set > aNewSet; + std::set> aNewSet; if (theFeature->data()->execState() == ModelAPI_StateMustBeUpdated || - theFeature->data()->execState() == ModelAPI_StateInvalidArgument || // issue 1519 + theFeature->data()->execState() == + ModelAPI_StateInvalidArgument || // issue 1519 theFeature->data()->execState() == ModelAPI_StateExecFailed) { // do not forget that in this case all were the reasons aNewSet.insert(theFeature); @@ -173,29 +192,35 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { myModified[theFeature] = aNewSet; #ifdef DEB_UPDATE if (theReason.get()) { - //std::cout<<"*** Add modified "<name() - // <<" reason "<name()<name() + // <<" reason "<name()<name()<name()<data()->execState() == ModelAPI_StateDone || - theFeature->data()->execState() == ModelAPI_StateExecFailed) // fix issue 1819 + theFeature->data()->execState() == + ModelAPI_StateExecFailed) // fix issue 1819 theFeature->data()->execState(ModelAPI_StateMustBeUpdated); else - return true; // do not need iteration deeply if it is already marked as modified or so + return true; // do not need iteration deeply if it is already marked as + // modified or so #ifdef DEB_UPDATE - //std::cout<<"*** Set modified state "<name()<name()< aRefSet; - const std::set >& aRefs = theFeature->data()->refsToMe(); - std::set >::const_iterator aRefIter = aRefs.cbegin(); - for(; aRefIter != aRefs.cend(); aRefIter++) { + const std::set> &aRefs = + theFeature->data()->refsToMe(); + std::set>::const_iterator aRefIter = + aRefs.cbegin(); + for (; aRefIter != aRefs.cend(); aRefIter++) { if ((*aRefIter)->isArgument()) { - FeaturePtr aReferenced = std::dynamic_pointer_cast((*aRefIter)->owner()); + FeaturePtr aReferenced = + std::dynamic_pointer_cast((*aRefIter)->owner()); if (aReferenced.get()) { aRefSet.insert(aReferenced); } @@ -205,12 +230,15 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { std::list allResults; // list of this feature and results ModelAPI_Tools::allResults(theFeature, allResults); std::list::iterator aRes = allResults.begin(); - for(; aRes != allResults.end(); aRes++) { - const std::set >& aResRefs = (*aRes)->data()->refsToMe(); - std::set >::const_iterator aRIter = aResRefs.cbegin(); - for(; aRIter != aResRefs.cend(); aRIter++) { + for (; aRes != allResults.end(); aRes++) { + const std::set> &aResRefs = + (*aRes)->data()->refsToMe(); + std::set>::const_iterator aRIter = + aResRefs.cbegin(); + for (; aRIter != aResRefs.cend(); aRIter++) { if ((*aRIter)->isArgument()) { - FeaturePtr aReferenced = std::dynamic_pointer_cast((*aRIter)->owner()); + FeaturePtr aReferenced = + std::dynamic_pointer_cast((*aRIter)->owner()); if (aReferenced.get()) { aRefSet.insert(aReferenced); } @@ -220,52 +248,69 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { // also add part feature that contains this feature to the modified if (theFeature->document()->kind() != "PartSet") { FeaturePtr aPart = ModelAPI_Tools::findPartFeature( - ModelAPI_Session::get()->moduleDocument(), theFeature->document()); + ModelAPI_Session::get()->moduleDocument(), theFeature->document()); if (aPart.get()) aRefSet.insert(aPart); } - for(std::set::iterator aRef = aRefSet.begin(); aRef != aRefSet.end(); aRef++) + for (std::set::iterator aRef = aRefSet.begin(); + aRef != aRefSet.end(); aRef++) addModified(*aRef, theFeature); return true; } -void Model_Update::processEvent(const std::shared_ptr& theMessage) -{ - static Events_Loop* aLoop = Events_Loop::loop(); - //static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); - static const Events_ID kCreatedEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); - static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); +void Model_Update::processEvent( + const std::shared_ptr &theMessage) { + static Events_Loop *aLoop = Events_Loop::loop(); + // static ModelAPI_ValidatorsFactory* aFactory = + // ModelAPI_Session::get()->validators(); + static const Events_ID kCreatedEvent = + aLoop->eventByName(EVENT_OBJECT_CREATED); + static const Events_ID kUpdatedEvent = + aLoop->eventByName(EVENT_OBJECT_UPDATED); static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation"); static const Events_ID kOpAbortEvent = aLoop->eventByName("AbortOperation"); static const Events_ID kOpStartEvent = aLoop->eventByName("StartOperation"); - static const Events_ID kStabilityEvent = aLoop->eventByName(EVENT_STABILITY_CHANGED); - static const Events_ID kPreviewBlockedEvent = aLoop->eventByName(EVENT_PREVIEW_BLOCKED); - static const Events_ID kPreviewRequestedEvent = aLoop->eventByName(EVENT_PREVIEW_REQUESTED); - static const Events_ID kReorderEvent = aLoop->eventByName(EVENT_ORDER_UPDATED); - static const Events_ID kRedisplayEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION); + static const Events_ID kStabilityEvent = + aLoop->eventByName(EVENT_STABILITY_CHANGED); + static const Events_ID kPreviewBlockedEvent = + aLoop->eventByName(EVENT_PREVIEW_BLOCKED); + static const Events_ID kPreviewRequestedEvent = + aLoop->eventByName(EVENT_PREVIEW_REQUESTED); + static const Events_ID kReorderEvent = + aLoop->eventByName(EVENT_ORDER_UPDATED); + static const Events_ID kRedisplayEvent = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const Events_ID kUpdatedSel = + aLoop->eventByName(EVENT_UPDATE_SELECTION); #ifdef DEB_UPDATE - std::cout<<"****** Event "<eventID().eventText()<eventID().eventText() + << std::endl; #endif // check the automatic update flag on any event bool aNewAutomaticState = ModelAPI_Session::get()->isAutoUpdateBlocked(); if (myUpdateBlocked != aNewAutomaticState) { myUpdateBlocked = aNewAutomaticState; - if (!myUpdateBlocked) { // process all modified features, even if preview is blocked - bool aPreviewBlockedState = myIsPreviewBlocked; // to update the selected arguments + if (!myUpdateBlocked) { // process all modified features, even if preview is + // blocked + bool aPreviewBlockedState = + myIsPreviewBlocked; // to update the selected arguments myIsPreviewBlocked = false; - // iterate everything and add features in state "MustBeUpdated" into modified - std::list > allDocs = - ModelAPI_Session::get()->allOpenedDocuments(); - std::list >::iterator aDoc = allDocs.begin(); - for(; aDoc != allDocs.end(); aDoc++) { - std::list > allFeats = (*aDoc)->allFeatures(); - std::list >::iterator aFeat = allFeats.begin(); - for(; aFeat != allFeats.end(); aFeat++) { + // iterate everything and add features in state "MustBeUpdated" into + // modified + std::list> allDocs = + ModelAPI_Session::get()->allOpenedDocuments(); + std::list>::iterator aDoc = + allDocs.begin(); + for (; aDoc != allDocs.end(); aDoc++) { + std::list> allFeats = + (*aDoc)->allFeatures(); + std::list>::iterator aFeat = + allFeats.begin(); + for (; aFeat != allFeats.end(); aFeat++) { if ((*aFeat)->data()->isValid() && - (*aFeat)->data()->execState() == ModelAPI_StateMustBeUpdated) { + (*aFeat)->data()->execState() == ModelAPI_StateMustBeUpdated) { addModified(*aFeat, FeaturePtr()); } } @@ -304,17 +349,19 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag if (theMessage->eventID() == kCreatedEvent) { std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); - const std::set& anObjs = aMsg->objects(); + const std::set &anObjs = aMsg->objects(); std::set::const_iterator anObjIter = anObjs.cbegin(); std::list aFeatures, aResults; - for(; anObjIter != anObjs.cend(); anObjIter++) { - if (std::dynamic_pointer_cast((*anObjIter)->document())->executeFeatures()) { + for (; anObjIter != anObjs.cend(); anObjIter++) { + if (std::dynamic_pointer_cast((*anObjIter)->document()) + ->executeFeatures()) { if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) { // results creation means enabling, not update aFeatures.push_back(*anObjIter); } else { aResults.push_back(*anObjIter); - ResultPartPtr aPart = std::dynamic_pointer_cast(*anObjIter); + ResultPartPtr aPart = + std::dynamic_pointer_cast(*anObjIter); if (aPart.get() && aPart->data().get() && aPart->data()->isValid()) { aPart->shape(); // to update the shape on creation of the result } @@ -328,37 +375,44 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag if (theMessage->eventID() == kUpdatedEvent) { std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); - const std::set& anObjs = aMsg->objects(); + const std::set &anObjs = aMsg->objects(); std::set::const_iterator anObjIter = anObjs.cbegin(); - bool aSomeModified = false; // check that features not changed: only redisplay is needed - for(; anObjIter != anObjs.cend(); anObjIter++) { + bool aSomeModified = + false; // check that features not changed: only redisplay is needed + for (; anObjIter != anObjs.cend(); anObjIter++) { if (!(*anObjIter)->data()->isValid()) continue; #ifdef DEB_UPDATE - std::wcout<>> in event updated "<groupName()) - <data()->name()<>> in event updated " + << Locale::Convert::toWString((*anObjIter)->groupName()) + << L" " << (*anObjIter)->data()->name() << std::endl; #endif if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) { myIsParamUpdated = true; } // on undo/redo, abort do not update persistent features - FeaturePtr anUpdated = std::dynamic_pointer_cast(*anObjIter); + FeaturePtr anUpdated = + std::dynamic_pointer_cast(*anObjIter); if (anUpdated.get()) { if (addModified(anUpdated, FeaturePtr())) aSomeModified = true; } else { - // process the updated result as update of features that refers to this result - const std::set >& - aRefs = (*anObjIter)->data()->refsToMe(); - std::set >::const_iterator aRefIter = aRefs.cbegin(); + // process the updated result as update of features that refers to this + // result + const std::set> &aRefs = + (*anObjIter)->data()->refsToMe(); + std::set>::const_iterator aRefIter = + aRefs.cbegin(); FeaturePtr aReason; - ResultPtr aReasonResult = std::dynamic_pointer_cast(*anObjIter); + ResultPtr aReasonResult = + std::dynamic_pointer_cast(*anObjIter); if (aReasonResult.get()) aReason = (*anObjIter)->document()->feature(aReasonResult); - for(; aRefIter != aRefs.cend(); aRefIter++) { + for (; aRefIter != aRefs.cend(); aRefIter++) { if (!(*aRefIter)->owner()->data()->isValid()) continue; - anUpdated = std::dynamic_pointer_cast((*aRefIter)->owner()); + anUpdated = + std::dynamic_pointer_cast((*aRefIter)->owner()); if (anUpdated.get()) { if (addModified(anUpdated, aReason)) aSomeModified = true; @@ -368,32 +422,37 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag } // this event is for solver update, not here, do not react immediately if (aSomeModified) { - processFeatures(); + processFeatures(); } - } else if (theMessage->eventID() == kOpFinishEvent || theMessage->eventID() == kOpAbortEvent || - theMessage->eventID() == kOpStartEvent) { + } else if (theMessage->eventID() == kOpFinishEvent || + theMessage->eventID() == kOpAbortEvent || + theMessage->eventID() == kOpStartEvent) { myIsPreviewBlocked = false; - if (theMessage->eventID() == kOpFinishEvent) {// if update is blocked, skip + if (theMessage->eventID() == kOpFinishEvent) { // if update is blocked, skip myIsFinish = true; // add features that wait for finish as modified - std::map, std::set > >:: - iterator aFeature = myProcessOnFinish.begin(); - for(; aFeature != myProcessOnFinish.end(); aFeature++) { - if (aFeature->first->data()->isValid()) {// there may be already removed while wait + std::map, + std::set>>::iterator aFeature = + myProcessOnFinish.begin(); + for (; aFeature != myProcessOnFinish.end(); aFeature++) { + if (aFeature->first->data() + ->isValid()) { // there may be already removed while wait if (aFeature->second.empty()) { addModified(aFeature->first, FeaturePtr()); continue; } - std::set >::iterator aReasons; - for(aReasons = aFeature->second.begin(); aReasons != aFeature->second.end(); aReasons++){ + std::set>::iterator aReasons; + for (aReasons = aFeature->second.begin(); + aReasons != aFeature->second.end(); aReasons++) { addModified(aFeature->first, *aReasons); } } } myIsFinish = false; } - // processed features must be only on finish, so clear anyway (to avoid re-import on load) + // processed features must be only on finish, so clear anyway (to avoid + // re-import on load) myProcessOnFinish.clear(); // #2156: current must be sketch, left after the macro execution @@ -408,14 +467,17 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag if (anActiveDoc.get() && aCurrent.get() && aCurrent->data()->isValid()) { if (anActiveDoc->currentFeature(false) != aCurrent && - ModelAPI_Tools::compositeOwner(anActiveDoc->currentFeature(false)) == aCurrent) - anActiveDoc->setCurrentFeature(aCurrent, false); // #2156 make the current feature back + ModelAPI_Tools::compositeOwner(anActiveDoc->currentFeature(false)) == + aCurrent) + anActiveDoc->setCurrentFeature( + aCurrent, false); // #2156 make the current feature back } // remove all macros before clearing all created std::set::iterator anUpdatedIter = myWaitForFinish.begin(); - while(anUpdatedIter != myWaitForFinish.end()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(*anUpdatedIter); + while (anUpdatedIter != myWaitForFinish.end()) { + FeaturePtr aFeature = + std::dynamic_pointer_cast(*anUpdatedIter); if (aFeature.get()) { // remove macro on finish if (aFeature->isMacro()) { @@ -439,62 +501,75 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag Events_Loop::loop()->flush(kRedisplayEvent); // in the end of transaction everything is updated, so clear the old objects - //myIsParamUpdated = false; // to avoid problems in sprocket.py parameter update + // myIsParamUpdated = false; // to avoid problems in sprocket.py parameter + // update myWaitForFinish.clear(); } else if (theMessage->eventID() == kReorderEvent) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMsg->reordered().get()) - addModified(aMsg->reordered(), aMsg->reordered()); // to update all attributes + addModified(aMsg->reordered(), + aMsg->reordered()); // to update all attributes } } -void Model_Update::processFeatures(const bool theFlushRedisplay) -{ - // perform update of everything if it is not performed right now or any preview is blocked +void Model_Update::processFeatures(const bool theFlushRedisplay) { + // perform update of everything if it is not performed right now or any + // preview is blocked if (!myIsProcessed && !myIsPreviewBlocked) { myIsProcessed = true; - #ifdef DEB_UPDATE - std::cout<<"****** Start processing"<first); } myIsProcessed = false; - // to update the object browser if something is updated/created during executions - static Events_Loop* aLoop = Events_Loop::loop(); - static const Events_ID kCreatedEvent= aLoop->eventByName(EVENT_OBJECT_CREATED); + // to update the object browser if something is updated/created during + // executions + static Events_Loop *aLoop = Events_Loop::loop(); + static const Events_ID kCreatedEvent = + aLoop->eventByName(EVENT_OBJECT_CREATED); aLoop->flush(kCreatedEvent); - static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID kUpdatedEvent = + aLoop->eventByName(EVENT_OBJECT_UPDATED); aLoop->flush(kUpdatedEvent); // flush to update display if (theFlushRedisplay) { - static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID EVENT_DISP = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); aLoop->flush(EVENT_DISP); } - #ifdef DEB_UPDATE - std::cout<<"****** End processing"<& theReasons) { - std::list > > > aDeps; +static void allReasons(FeaturePtr theFeature, + std::set &theReasons) { + std::list>>> + aDeps; theFeature->data()->referencesToObjects(aDeps); - std::list > > >::iterator - anAttrsIter = aDeps.begin(); - for(; anAttrsIter != aDeps.end(); anAttrsIter++) { + std::list>>>::iterator + anAttrsIter = aDeps.begin(); + for (; anAttrsIter != aDeps.end(); anAttrsIter++) { if (theFeature->attribute(anAttrsIter->first)->isArgument()) { - std::list >::iterator aDepIter = anAttrsIter->second.begin(); - for(; aDepIter != anAttrsIter->second.end(); aDepIter++) { - FeaturePtr aDepFeat = std::dynamic_pointer_cast(*aDepIter); - if (!aDepFeat.get()) { // so, it depends on the result and process the feature owner of it - ResultPtr aDepRes = std::dynamic_pointer_cast(*aDepIter); + std::list>::iterator aDepIter = + anAttrsIter->second.begin(); + for (; aDepIter != anAttrsIter->second.end(); aDepIter++) { + FeaturePtr aDepFeat = + std::dynamic_pointer_cast(*aDepIter); + if (!aDepFeat.get()) { // so, it depends on the result and process the + // feature owner of it + ResultPtr aDepRes = + std::dynamic_pointer_cast(*aDepIter); if (aDepRes.get()) { aDepFeat = (*aDepIter)->document()->feature(aDepRes); } @@ -506,10 +581,12 @@ static void allReasons(FeaturePtr theFeature, std::set& theReasons) } } if (theFeature->getKind() == "Part") { - // part is not depended on its subs directly, but subs must be iterated anyway - CompositeFeaturePtr aPart = std::dynamic_pointer_cast(theFeature); + // part is not depended on its subs directly, but subs must be iterated + // anyway + CompositeFeaturePtr aPart = + std::dynamic_pointer_cast(theFeature); int aNum = aPart->numberOfSubs(); - for(int a = 0; a < aNum; a++) { + for (int a = 0; a < aNum; a++) { FeaturePtr aSub = aPart->subFeature(a); if (aSub.get() && aSub->data()->isValid()) { theReasons.insert(aSub); @@ -518,28 +595,32 @@ static void allReasons(FeaturePtr theFeature, std::set& theReasons) } } -bool Model_Update::processFeature(FeaturePtr theFeature) -{ - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); +bool Model_Update::processFeature(FeaturePtr theFeature) { + static ModelAPI_ValidatorsFactory *aFactory = + ModelAPI_Session::get()->validators(); - if (!theFeature->data()->isValid()) { // deleted feature, just remove from all containers + if (!theFeature->data() + ->isValid()) { // deleted feature, just remove from all containers if (myModified.find(theFeature) != myModified.end()) myModified.erase(theFeature); return false; } if (theFeature->isPersistentResult()) { - if (!std::dynamic_pointer_cast((theFeature)->document())->executeFeatures()) + if (!std::dynamic_pointer_cast((theFeature)->document()) + ->executeFeatures()) return false; } // check this feature is not yet checked or processed bool aIsModified = myModified.find(theFeature) != myModified.end(); - if (!aIsModified && myIsFinish) { // get info about the modification for features without preview + if (!aIsModified && myIsFinish) { // get info about the modification for + // features without preview if (theFeature->data()->execState() == ModelAPI_StateMustBeUpdated) { aIsModified = true; - std::set > aNewSet; - // contains itself, so, we don't know which was the reason and the reason is any + std::set> aNewSet; + // contains itself, so, we don't know which was the reason and the reason + // is any aNewSet.insert(theFeature); myModified[theFeature] = aNewSet; } @@ -550,9 +631,12 @@ bool Model_Update::processFeature(FeaturePtr theFeature) } else if (aIsModified) { int aCount = myProcessed[theFeature]; if (aCount > 100) { - // too many repetition of processing (in VS it may crash on 330 with stack overflow) + // too many repetition of processing (in VS it may crash on 330 with stack + // overflow) Events_InfoMessage("Model_Update", - "Feature '%1' is updated in infinitive loop").arg(theFeature->data()->name()).send(); + "Feature '%1' is updated in infinitive loop") + .arg(theFeature->data()->name()) + .send(); // to stop iteration myModified.clear(); return false; @@ -561,51 +645,57 @@ bool Model_Update::processFeature(FeaturePtr theFeature) } #ifdef DEB_UPDATE - std::wcout<name()<name() << std::endl; #endif // update the sketch plane before the sketch sub-elements are recomputed - // (otherwise sketch will update plane, modify subs, after executed, but with old subs edges) - if (aIsModified && theFeature->getKind() == "Sketch") { + // (otherwise sketch will update plane, modify subs, after executed, but with + // old subs edges) + if (aIsModified && theFeature->getKind() == "Sketch") { #ifdef DEB_UPDATE - std::wcout << L"****** Update sketch args " << theFeature->name() << std::endl; + std::wcout << L"****** Update sketch args " << theFeature->name() + << std::endl; #endif - AttributeSelectionPtr anExtSel = theFeature->selection("External"); - if (anExtSel.get()) { - ResultPtr aContext = anExtSel->context(); - if (aContext.get() && aContext->document().get()) { - FeaturePtr anExtBase = aContext->document()->feature(aContext); - if (anExtBase.get()) { - processFeature(anExtBase); - } - std::shared_ptr anOrigin = - std::dynamic_pointer_cast(theFeature->attribute("Origin")); - double anOX = anOrigin->x(), anOY = anOrigin->y(), anOZ = anOrigin->z(); - std::shared_ptr aDir = - std::dynamic_pointer_cast(theFeature->attribute("DirX")); - double aDX = aDir->x(), aDY = aDir->y(), aDZ = aDir->z(); - std::shared_ptr aNorm = - std::dynamic_pointer_cast(theFeature->attribute("Norm")); - double aNX = aNorm->x(), aNY = aNorm->y(), aNZ = aNorm->z(); - // update sketch plane - updateArguments(theFeature); - theFeature->attributeChanged("External"); // to recompute origin, direction and normal - // check it is updated, so all must be changed - if (anOrigin->x() != anOX || anOrigin->y() != anOY || anOrigin->z() != anOZ || - aDir->x() != aDX || aDir->y() != aDY || aDir->z() != aDZ || - aNorm->x() != aNX || aNorm->y() != aNY || aNorm->z() != aNZ) - { - std::set aWholeR; - allReasons(theFeature, aWholeR); - std::set::iterator aRIter = aWholeR.begin(); - for (; aRIter != aWholeR.end(); aRIter++) { - if ((*aRIter)->data()->selection("External").get()) - (*aRIter)->attributeChanged("External"); - } + AttributeSelectionPtr anExtSel = theFeature->selection("External"); + if (anExtSel.get()) { + ResultPtr aContext = anExtSel->context(); + if (aContext.get() && aContext->document().get()) { + FeaturePtr anExtBase = aContext->document()->feature(aContext); + if (anExtBase.get()) { + processFeature(anExtBase); + } + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + theFeature->attribute("Origin")); + double anOX = anOrigin->x(), anOY = anOrigin->y(), anOZ = anOrigin->z(); + std::shared_ptr aDir = + std::dynamic_pointer_cast( + theFeature->attribute("DirX")); + double aDX = aDir->x(), aDY = aDir->y(), aDZ = aDir->z(); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + theFeature->attribute("Norm")); + double aNX = aNorm->x(), aNY = aNorm->y(), aNZ = aNorm->z(); + // update sketch plane + updateArguments(theFeature); + theFeature->attributeChanged( + "External"); // to recompute origin, direction and normal + // check it is updated, so all must be changed + if (anOrigin->x() != anOX || anOrigin->y() != anOY || + anOrigin->z() != anOZ || aDir->x() != aDX || aDir->y() != aDY || + aDir->z() != aDZ || aNorm->x() != aNX || aNorm->y() != aNY || + aNorm->z() != aNZ) { + std::set aWholeR; + allReasons(theFeature, aWholeR); + std::set::iterator aRIter = aWholeR.begin(); + for (; aRIter != aWholeR.end(); aRIter++) { + if ((*aRIter)->data()->selection("External").get()) + (*aRIter)->attributeChanged("External"); } } } } + } if (!aIsModified) { // no modification is needed return false; @@ -618,35 +708,37 @@ bool Model_Update::processFeature(FeaturePtr theFeature) } bool isReferencedInvalid = false; - // check all features this feature depended on (recursive call of updateFeature) - std::set& aReasons = myModified[theFeature]; + // check all features this feature depended on (recursive call of + // updateFeature) + std::set &aReasons = myModified[theFeature]; bool allSubsUsed = aReasons.find(theFeature) != aReasons.end(); if (allSubsUsed) { - // add all subs in aReasons and temporary remove "theFeature" to avoid processing itself + // add all subs in aReasons and temporary remove "theFeature" to avoid + // processing itself allReasons(theFeature, aReasons); aReasons.erase(theFeature); } // take reasons one by one (they may be added during the feature process // (circle by the radius of sketch) std::set aProcessedReasons; - while(!aReasons.empty()) { + while (!aReasons.empty()) { FeaturePtr aReason = *(aReasons.begin()); #ifdef DEB_UPDATE - //cout<name()<<" process next reason "<name()<name()<<" process next reason "<name()<data()->isValid()) { if (processFeature(aReason)) aIsModified = true; - // check validity of aReason once again because it may be removed by dependent feature - // (e.g. by SketchPlugin_IntersectionPoint) + // check validity of aReason once again because it may be removed by + // dependent feature (e.g. by SketchPlugin_IntersectionPoint) if (!aReason->data()->isValid() || aReason->data()->execState() == ModelAPI_StateInvalidArgument) isReferencedInvalid = true; } // searching for the next not used reason aProcessedReasons.insert(aReason); - // check theFeature is still in the list of modified, because it may be removed sometimes - // while updating SketchPlugin_Ellipse + // check theFeature is still in the list of modified, because it may be + // removed sometimes while updating SketchPlugin_Ellipse if (myModified.find(theFeature) != myModified.end()) aReasons.erase(aReason); else @@ -660,25 +752,28 @@ bool Model_Update::processFeature(FeaturePtr theFeature) // do not execute the composite that contains the current bool isPostponedMain = false; - CompositeFeaturePtr aCompos = std::dynamic_pointer_cast(theFeature); + CompositeFeaturePtr aCompos = + std::dynamic_pointer_cast(theFeature); if (theFeature->getKind() == "ExtrusionSketch" && aCompos.get()) { - CompositeFeaturePtr aCurrentOwner = - ModelAPI_Tools::compositeOwner(theFeature->document()->currentFeature(false)); + CompositeFeaturePtr aCurrentOwner = ModelAPI_Tools::compositeOwner( + theFeature->document()->currentFeature(false)); isPostponedMain = aCurrentOwner.get() && aCompos->isSub(aCurrentOwner); } else if (theFeature->getKind() == "Sketch" && - std::dynamic_pointer_cast((theFeature)->document())->executeFeatures()) { + std::dynamic_pointer_cast((theFeature)->document()) + ->executeFeatures()) { // send event that sketch is prepared to be recomputed static Events_ID anID = Events_Loop::eventByName("SketchPrepared"); std::shared_ptr aMsg(new Events_Message(anID, this)); - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); // in case it is finish operation, flush for the sketch other events (#2450) aLoop->flush(aLoop->eventByName(EVENT_OBJECT_UPDATED)); aLoop->send(aMsg); - // check that sub-elements of sketch are updated => sketch must be re-processed + // check that sub-elements of sketch are updated => sketch must be + // re-processed std::set aWholeR; allReasons(theFeature, aWholeR); std::set::iterator aRIter = aWholeR.begin(); - for(; aRIter != aWholeR.end(); aRIter++) { + for (; aRIter != aWholeR.end(); aRIter++) { if (myModified.find(*aRIter) != myModified.end()) { processFeature(theFeature); return true; @@ -687,16 +782,17 @@ bool Model_Update::processFeature(FeaturePtr theFeature) } #ifdef DEB_UPDATE - std::wcout<name()<name() << std::endl; #endif // TestImport.py : after arguments are updated, theFeature may be removed if (!theFeature->data()->isValid()) return false; - // Update selection and parameters attributes first, before sub-features analysis (sketch plane). + // Update selection and parameters attributes first, before sub-features + // analysis (sketch plane). updateArguments(theFeature); - // add this feature to the processed right now to be able remove it from this list on - // update signal during this feature execution + // add this feature to the processed right now to be able remove it from this + // list on update signal during this feature execution myModified.erase(theFeature); if (myNotPersistentRefs.find(theFeature) != myNotPersistentRefs.end()) myNotPersistentRefs.erase(theFeature); @@ -705,15 +801,18 @@ bool Model_Update::processFeature(FeaturePtr theFeature) // this checking must be after the composite feature sub-elements processing: // composite feature status may depend on it's sub-elements - if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) && - theFeature->getKind() != "Part") { - // don't disable Part because it will make disabled all the features - // (performance and problems with the current feature) - #ifdef DEB_UPDATE - std::wcout<name()<data()->execState() == ModelAPI_StateInvalidArgument || + isReferencedInvalid) && + theFeature->getKind() != "Part") { + // don't disable Part because it will make disabled all the features + // (performance and problems with the current feature) +#ifdef DEB_UPDATE + std::wcout << L"Invalid args " << theFeature->name() << std::endl; +#endif theFeature->eraseResults(false); - redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated + redisplayWithResults( + theFeature, + ModelAPI_StateInvalidArgument); // result also must be updated return true; // so, feature is modified (results are erased) } @@ -723,10 +822,14 @@ bool Model_Update::processFeature(FeaturePtr theFeature) if (!isPostponedMain) { bool aDoExecute = true; if (myUpdateBlocked) { - if (!theFeature->isStable() || (theFeature->getKind().size() > 6 && - theFeature->getKind().substr(0, 6) == "Sketch")) { // automatic update sketch elements + if (!theFeature->isStable() || + (theFeature->getKind().size() > 6 && + theFeature->getKind().substr(0, 6) == + "Sketch")) { // automatic update sketch elements aDoExecute = true; - } else if (theFeature->results().size()) { // execute only not persistent results features + } else if (theFeature->results() + .size()) { // execute only not persistent results + // features aDoExecute = !theFeature->isPersistentResult(); } else { aDoExecute = aState != ModelAPI_StateInvalidArgument; @@ -740,20 +843,24 @@ bool Model_Update::processFeature(FeaturePtr theFeature) } } } else { - #ifdef DEB_UPDATE - std::wcout<name()<name() + << std::endl; +#endif theFeature->eraseResults(false); - redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated + redisplayWithResults( + theFeature, + ModelAPI_StateInvalidArgument); // result also must be updated } return true; } -void Model_Update::redisplayWithResults( - FeaturePtr theFeature, const ModelAPI_ExecState theState, bool theUpdateState) -{ +void Model_Update::redisplayWithResults(FeaturePtr theFeature, + const ModelAPI_ExecState theState, + bool theUpdateState) { // make updated and redisplay all results - static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID EVENT_DISP = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); std::list allResults; ModelAPI_Tools::allResults(theFeature, allResults); @@ -777,9 +884,10 @@ void Model_Update::redisplayWithResults( theFeature->data()->execState(theState); } -/// Updates the state by the referenced object: if something bad with it, set state for this one -ModelAPI_ExecState stateByReference(ObjectPtr theTarget, const ModelAPI_ExecState theCurrent) -{ +/// Updates the state by the referenced object: if something bad with it, set +/// state for this one +ModelAPI_ExecState stateByReference(ObjectPtr theTarget, + const ModelAPI_ExecState theCurrent) { if (theTarget) { ModelAPI_ExecState aRefState = theTarget->data()->execState(); if (aRefState == ModelAPI_StateMustBeUpdated) { @@ -793,12 +901,14 @@ ModelAPI_ExecState stateByReference(ObjectPtr theTarget, const ModelAPI_ExecStat } void Model_Update::updateArguments(FeaturePtr theFeature) { - // perform this method also for disabled features: to make "not done" state for - // features referenced to the active and modified features - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); + // perform this method also for disabled features: to make "not done" state + // for features referenced to the active and modified features + static ModelAPI_ValidatorsFactory *aFactory = + ModelAPI_Session::get()->validators(); ModelAPI_ExecState aState = theFeature->data()->execState(); - if (aState == ModelAPI_StateExecFailed) { // try again failed feature: issue 577 + if (aState == + ModelAPI_StateExecFailed) { // try again failed feature: issue 577 aState = ModelAPI_StateMustBeUpdated; } if (aState == ModelAPI_StateInvalidArgument) // a chance to be corrected @@ -807,11 +917,11 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { // Integer { std::list anAttrinbutes = - theFeature->data()->attributes(ModelAPI_AttributeInteger::typeId()); + theFeature->data()->attributes(ModelAPI_AttributeInteger::typeId()); std::list::iterator anIter = anAttrinbutes.begin(); - for(; anIter != anAttrinbutes.end(); anIter++) { + for (; anIter != anAttrinbutes.end(); anIter++) { AttributeIntegerPtr anAttribute = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (anAttribute.get() && !anAttribute->text().empty()) { if (myIsParamUpdated) { ModelAPI_AttributeEvalMessage::send(anAttribute, this); @@ -825,11 +935,11 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { // Double { std::list aDoubles = - theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId()); + theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId()); std::list::iterator aDoubleIter = aDoubles.begin(); - for(; aDoubleIter != aDoubles.end(); aDoubleIter++) { + for (; aDoubleIter != aDoubles.end(); aDoubleIter++) { AttributeDoublePtr aDouble = - std::dynamic_pointer_cast(*aDoubleIter); + std::dynamic_pointer_cast(*aDoubleIter); if (aDouble.get() && !aDouble->text().empty()) { if (myIsParamUpdated) { ModelAPI_AttributeEvalMessage::send(aDouble, this); @@ -843,19 +953,23 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { // Point { std::list anAttributes = - theFeature->data()->attributes(GeomDataAPI_Point::typeId()); + theFeature->data()->attributes(GeomDataAPI_Point::typeId()); std::list::iterator anIter = anAttributes.begin(); - for(; anIter != anAttributes.end(); anIter++) { + for (; anIter != anAttributes.end(); anIter++) { AttributePointPtr aPointAttribute = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (aPointAttribute.get() && (!aPointAttribute->textX().empty() || - !aPointAttribute->textY().empty() || !aPointAttribute->textZ().empty())) { + !aPointAttribute->textY().empty() || + !aPointAttribute->textZ().empty())) { if (myIsParamUpdated) { ModelAPI_AttributeEvalMessage::send(aPointAttribute, this); } - if ((!aPointAttribute->textX().empty() && aPointAttribute->expressionInvalid(0)) || - (!aPointAttribute->textY().empty() && aPointAttribute->expressionInvalid(1)) || - (!aPointAttribute->textZ().empty() && aPointAttribute->expressionInvalid(2))) + if ((!aPointAttribute->textX().empty() && + aPointAttribute->expressionInvalid(0)) || + (!aPointAttribute->textY().empty() && + aPointAttribute->expressionInvalid(1)) || + (!aPointAttribute->textZ().empty() && + aPointAttribute->expressionInvalid(2))) aState = ModelAPI_StateInvalidArgument; } } @@ -863,68 +977,79 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { // Point2D { std::list anAttributes = - theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list::iterator anIter = anAttributes.begin(); - for(; anIter != anAttributes.end(); anIter++) { + for (; anIter != anAttributes.end(); anIter++) { AttributePoint2DPtr aPoint2DAttribute = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (aPoint2DAttribute.get()) { if (myIsParamUpdated && (!aPoint2DAttribute->textX().empty() || - !aPoint2DAttribute->textY().empty())) { + !aPoint2DAttribute->textY().empty())) { ModelAPI_AttributeEvalMessage::send(aPoint2DAttribute, this); } - if ((!aPoint2DAttribute->textX().empty() && aPoint2DAttribute->expressionInvalid(0)) || - (!aPoint2DAttribute->textY().empty() && aPoint2DAttribute->expressionInvalid(1))) + if ((!aPoint2DAttribute->textX().empty() && + aPoint2DAttribute->expressionInvalid(0)) || + (!aPoint2DAttribute->textY().empty() && + aPoint2DAttribute->expressionInvalid(1))) aState = ModelAPI_StateInvalidArgument; } } } // update the selection attributes if any std::list aRefs = - theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); + theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); std::list::iterator aRefsIter = aRefs.begin(); for (; aRefsIter != aRefs.end(); aRefsIter++) { std::shared_ptr aSel = - std::dynamic_pointer_cast(*aRefsIter); + std::dynamic_pointer_cast(*aRefsIter); ObjectPtr aContext = aSel->context(); // update argument only if the referenced object is ready to use if (aContext.get() && !aContext->isDisabled()) { if (isReason(theFeature, aContext)) { - if (!aSel->update()) { // this must be done on execution since it may be long operation - bool isObligatory = !aFactory->isNotObligatory( - theFeature->getKind(), theFeature->data()->id(aSel)) && - aFactory->isCase(theFeature, theFeature->data()->id(aSel)); + if (!aSel->update()) { // this must be done on execution since it may be + // long operation + bool isObligatory = + !aFactory->isNotObligatory(theFeature->getKind(), + theFeature->data()->id(aSel)) && + aFactory->isCase(theFeature, theFeature->data()->id(aSel)); if (isObligatory || - // #24260 : sketch plane was selected, but selection becomes wrong, make it invalid - (theFeature->getKind() == "Sketch" && aSel->id() == "External")) + // #24260 : sketch plane was selected, but selection becomes + // wrong, make it invalid + (theFeature->getKind() == "Sketch" && aSel->id() == "External")) aState = ModelAPI_StateInvalidArgument; } } } else if (aContext.get()) { - // here it may be not obligatory, but if the reference is wrong, it should not be correct - bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel)); + // here it may be not obligatory, but if the reference is wrong, it should + // not be correct + bool isObligatory = + aFactory->isCase(theFeature, theFeature->data()->id(aSel)); if (isObligatory) aState = ModelAPI_StateInvalidArgument; } else if (aSel->isInitialized()) { - // #19703 : if sketch plane was selected, but after context disappears, it must become invalid + // #19703 : if sketch plane was selected, but after context disappears, it + // must become invalid aSel->update(); if (aSel->isInvalid()) { - aState = ModelAPI_StateInvalidArgument; + aState = ModelAPI_StateInvalidArgument; } } } // update the selection list attributes if any - aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); + aRefs = + theFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) { std::shared_ptr aSel = - std::dynamic_pointer_cast(*aRefsIter); + std::dynamic_pointer_cast(*aRefsIter); // #19071 : avoid sending of update event in cycle bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true); - // list to keep the shared pointers while update is blocked (in messages raw poiters are used) + // list to keep the shared pointers while update is blocked (in messages raw + // poiters are used) std::list anAttrList; - for(int a = aSel->size() - 1; a >= 0; a--) { + for (int a = aSel->size() - 1; a >= 0; a--) { std::shared_ptr aSelAttr = - std::dynamic_pointer_cast(aSel->value(a)); + std::dynamic_pointer_cast( + aSel->value(a)); if (aSelAttr) { ObjectPtr aContext = aSelAttr->context(); // update argument only if the referenced object is ready to use @@ -932,16 +1057,19 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { if (isReason(theFeature, aContext)) { anAttrList.push_back(aSelAttr); if (!aSelAttr->update()) { - bool isObligatory = !aFactory->isNotObligatory( - theFeature->getKind(), theFeature->data()->id(aSel)) && - aFactory->isCase(theFeature, theFeature->data()->id(aSel)); + bool isObligatory = + !aFactory->isNotObligatory(theFeature->getKind(), + theFeature->data()->id(aSel)) && + aFactory->isCase(theFeature, theFeature->data()->id(aSel)); if (isObligatory) aState = ModelAPI_StateInvalidArgument; } } } else if (aContext.get()) { - // here it may be not obligatory, but if the reference is wrong, it should not be correct - bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel)); + // here it may be not obligatory, but if the reference is wrong, it + // should not be correct + bool isObligatory = + aFactory->isCase(theFeature, theFeature->data()->id(aSel)); if (isObligatory) aState = ModelAPI_StateInvalidArgument; } @@ -955,17 +1083,19 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { theFeature->data()->execState(aState); } -bool Model_Update::isReason(std::shared_ptr& theFeature, - std::shared_ptr theReason) -{ - std::map, std::set > > - ::iterator aReasonsIt = myModified.find(theFeature); +bool Model_Update::isReason(std::shared_ptr &theFeature, + std::shared_ptr theReason) { + std::map, + std::set>>::iterator aReasonsIt = + myModified.find(theFeature); if (aReasonsIt != myModified.end()) { if (aReasonsIt->second.find(theFeature) != aReasonsIt->second.end()) return true; // any is reason if it contains itself - FeaturePtr aReasFeat = std::dynamic_pointer_cast(theReason); + FeaturePtr aReasFeat = + std::dynamic_pointer_cast(theReason); if (!aReasFeat.get()) { // try to get feature of this result - ResultPtr aReasRes = std::dynamic_pointer_cast(theReason); + ResultPtr aReasRes = + std::dynamic_pointer_cast(theReason); if (aReasRes.get()) aReasFeat = theReason->document()->feature(aReasRes); } @@ -973,12 +1103,15 @@ bool Model_Update::isReason(std::shared_ptr& theFeature, return true; } // another try: postponed modification by not-persistences - std::map, std::set > > - ::iterator aNotPersist = myNotPersistentRefs.find(theFeature); + std::map, + std::set>>::iterator aNotPersist = + myNotPersistentRefs.find(theFeature); if (aNotPersist != myNotPersistentRefs.end()) { - FeaturePtr aReasFeat = std::dynamic_pointer_cast(theReason); + FeaturePtr aReasFeat = + std::dynamic_pointer_cast(theReason); if (!aReasFeat.get()) { // try to get feature of this result - ResultPtr aReasRes = std::dynamic_pointer_cast(theReason); + ResultPtr aReasRes = + std::dynamic_pointer_cast(theReason); if (aReasRes.get()) aReasFeat = theReason->document()->feature(aReasRes); } @@ -986,14 +1119,14 @@ bool Model_Update::isReason(std::shared_ptr& theFeature, return true; } - // this case only for not-previewed items update state, nothing is changed in args for it + // this case only for not-previewed items update state, nothing is changed in + // args for it return false; } -void Model_Update::executeFeature(FeaturePtr theFeature) -{ +void Model_Update::executeFeature(FeaturePtr theFeature) { #ifdef DEB_UPDATE - std::wcout<name()<name() << std::endl; #endif // execute in try-catch to avoid internal problems of the feature ModelAPI_ExecState aState = ModelAPI_StateDone; @@ -1005,12 +1138,15 @@ void Model_Update::executeFeature(FeaturePtr theFeature) } else { aState = ModelAPI_StateDone; } - } catch(...) { + } catch (...) { aState = ModelAPI_StateExecFailed; Events_InfoMessage("Model_Update", - "Feature %1 has failed during the execution").arg(theFeature->getKind()).send(); + "Feature %1 has failed during the execution") + .arg(theFeature->getKind()) + .send(); } - // The macro feature has to be deleted in any case even its execution is failed + // The macro feature has to be deleted in any case even its execution is + // failed myWaitForFinish.insert(theFeature); if (aState != ModelAPI_StateDone) { theFeature->eraseResults(false); @@ -1021,44 +1157,51 @@ void Model_Update::executeFeature(FeaturePtr theFeature) // it is called on GUI edit of feature start // LCOV_EXCL_START -void Model_Update::updateStability(void* theSender) -{ - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); +void Model_Update::updateStability(void *theSender) { + static ModelAPI_ValidatorsFactory *aFactory = + ModelAPI_Session::get()->validators(); if (theSender) { bool added = false; // object may be was crated - ModelAPI_Object* aSender = static_cast(theSender); + ModelAPI_Object *aSender = static_cast(theSender); if (aSender && aSender->document()) { FeaturePtr aFeatureSender = - std::dynamic_pointer_cast(aSender->data()->owner()); + std::dynamic_pointer_cast(aSender->data()->owner()); if (aFeatureSender.get()) { - Model_Objects* aDocObjects = - std::dynamic_pointer_cast(aSender->document())->objects(); + Model_Objects *aDocObjects = + std::dynamic_pointer_cast(aSender->document()) + ->objects(); if (aDocObjects) { - //aDocObjects->synchronizeBackRefs(); - // remove or add all concealment refs from this feature - std::list > > aRefs; + // aDocObjects->synchronizeBackRefs(); + // remove or add all concealment refs from this feature + std::list>> aRefs; aSender->data()->referencesToObjects(aRefs); - std::list > >::iterator - aRefIt = aRefs.begin(); - for(; aRefIt != aRefs.end(); aRefIt++) { - if (!aFactory->isConcealed(aFeatureSender->getKind(), aRefIt->first)) + std::list>>::iterator + aRefIt = aRefs.begin(); + for (; aRefIt != aRefs.end(); aRefIt++) { + if (!aFactory->isConcealed(aFeatureSender->getKind(), + aRefIt->first)) // take into account only concealed references - // (do not remove the sketch constraint and the edge on constraint edit) + // (do not remove the sketch constraint and the edge on constraint + // edit) continue; - std::list& aRefFeaturesList = aRefIt->second; - std::list::iterator aReferenced = aRefFeaturesList.begin(); - for(; aReferenced != aRefFeaturesList.end(); aReferenced++) { - // stability is only on results: feature to feature reference mean nested + std::list &aRefFeaturesList = aRefIt->second; + std::list::iterator aReferenced = + aRefFeaturesList.begin(); + for (; aReferenced != aRefFeaturesList.end(); aReferenced++) { + // stability is only on results: feature to feature reference mean + // nested // features, that will remove nesting references if (aReferenced->get() && (*aReferenced)->data()->isValid() && - (*aReferenced)->groupName() != ModelAPI_Feature::group()) { + (*aReferenced)->groupName() != ModelAPI_Feature::group()) { std::shared_ptr aData = - std::dynamic_pointer_cast((*aReferenced)->data()); + std::dynamic_pointer_cast( + (*aReferenced)->data()); if (aFeatureSender->isStable()) { aData->addBackReference(aFeatureSender, aRefIt->first); } else { aData->removeBackReference(aFeatureSender, aRefIt->first); - added = true; // remove of concealment may be caused creation of some result + added = true; // remove of concealment may be caused creation + // of some result } } } @@ -1067,7 +1210,7 @@ void Model_Update::updateStability(void* theSender) } } if (added) { - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID kEventCreated = aLoop->eventByName(EVENT_OBJECT_CREATED); aLoop->flush(kEventCreated); } @@ -1075,28 +1218,32 @@ void Model_Update::updateStability(void* theSender) } // LCOV_EXCL_STOP -void Model_Update::updateSelection(const std::set >& theObjects) -{ - std::set >::iterator anObj = theObjects.begin(); - for(; anObj != theObjects.end(); anObj++) { +void Model_Update::updateSelection( + const std::set> &theObjects) { + std::set>::iterator anObj = + theObjects.begin(); + for (; anObj != theObjects.end(); anObj++) { std::list aRefs = - (*anObj)->data()->attributes(ModelAPI_AttributeSelection::typeId()); + (*anObj)->data()->attributes(ModelAPI_AttributeSelection::typeId()); std::list::iterator aRefsIter = aRefs.begin(); for (; aRefsIter != aRefs.end(); aRefsIter++) { AttributeSelectionPtr aSel = - std::dynamic_pointer_cast(*aRefsIter); + std::dynamic_pointer_cast(*aRefsIter); bool aRemove = false; aSel->updateInHistory(aRemove); } // update the selection list attributes if any - aRefs = (*anObj)->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); + aRefs = + (*anObj)->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) { std::set aRemoveSet; std::shared_ptr aSel = - std::dynamic_pointer_cast(*aRefsIter); - for(int a = aSel->size() - 1; a >= 0; a--) { + std::dynamic_pointer_cast( + *aRefsIter); + for (int a = aSel->size() - 1; a >= 0; a--) { AttributeSelectionPtr aSelAttr = - std::dynamic_pointer_cast(aSel->value(a)); + std::dynamic_pointer_cast( + aSel->value(a)); if (aSelAttr.get()) { bool aRemove = false; aSelAttr->updateInHistory(aRemove); diff --git a/src/Model/Model_Update.h b/src/Model/Model_Update.h index 416416d0f..0944946fc 100644 --- a/src/Model/Model_Update.h +++ b/src/Model/Model_Update.h @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Update_H_ #define Model_Update_H_ +#include "Events_Listener.h" #include "Model.h" #include -#include "Events_Listener.h" +#include #include #include -#include class ModelAPI_Object; class ModelAPI_Feature; @@ -36,65 +37,79 @@ class Model_Objects; * \ingroup DataModel * \brief Updates the results of features when it is needed. */ -class Model_Update : public Events_Listener -{ +class Model_Update : public Events_Listener { /// Features and results that were modified and not yet processed. /// The second set is the objects that causes this object is modified - std::map, std::set > > - myModified; + std::map, + std::set>> + myModified; /// Features which arguments were modified by not-persistent changes. /// So, these referencing arguments must be updated /// due to these features info also before execution). - std::map, std::set > > - myNotPersistentRefs; - /// features that must be additionally processed after execution of finish operation - std::set > myWaitForFinish; - /// to know that some parameter was changed during this operation (to enable update expressions) + std::map, + std::set>> + myNotPersistentRefs; + /// features that must be additionally processed after execution of finish + /// operation + std::set> myWaitForFinish; + /// to know that some parameter was changed during this operation (to enable + /// update expressions) bool myIsParamUpdated; - /// to execute features on finish if preview is needed only on finish operation + /// to execute features on finish if preview is needed only on finish + /// operation bool myIsFinish; /// try if processing is currently performed bool myIsProcessed; - /// map that contains features that must be executed only on finish of the operation - /// the value in map is the set of reasons - std::map, std::set > > - myProcessOnFinish; - /// to avoid infinitive cycling: feature -> count of the processing periods during this update - std::map, int > myProcessed; - /// if preview in the property panel is blocked any update is postponed until end of operation + /// map that contains features that must be executed only on finish of the + /// operation the value in map is the set of reasons + std::map, + std::set>> + myProcessOnFinish; + /// to avoid infinitive cycling: feature -> count of the processing periods + /// during this update + std::map, int> myProcessed; + /// if preview in the property panel is blocked any update is postponed until + /// end of operation bool myIsPreviewBlocked; - /// disables any update if it is true, even on start/finish operation, undo, etc. + /// disables any update if it is true, even on start/finish operation, undo, + /// etc. bool myUpdateBlocked; - public: +public: /// Is called only once, on startup of the application Model_Update(); /// Processes the feature argument update: executes the results - MODEL_EXPORT virtual void processEvent(const std::shared_ptr& theMessage); + MODEL_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage); protected: - /// Appends the new modified feature to the myModified, clears myProcessed if needed - /// Returns true if some feature really was marked as modified + /// Appends the new modified feature to the myModified, clears myProcessed if + /// needed Returns true if some feature really was marked as modified /// theReason is the object that causes modification of this feature - /// returns true if something reallsy was added to the modified and must be processed - bool addModified( - std::shared_ptr theFeature, std::shared_ptr theReason); + /// returns true if something reallsy was added to the modified and must be + /// processed + bool addModified(std::shared_ptr theFeature, + std::shared_ptr theReason); - /// Recoursively checks and updates features if needed (calls the execute method) - /// Returns true if feature was updated. + /// Recoursively checks and updates features if needed (calls the execute + /// method) Returns true if feature was updated. bool processFeature(std::shared_ptr theFeature); - /// Updates the selection and parametrical arguments before the later feature analysis - /// Returns true if something really was updated + /// Updates the selection and parametrical arguments before the later feature + /// analysis Returns true if something really was updated void updateArguments(std::shared_ptr theFeature); - /// Sends the redisplay events for feature and results, updates the updated status + /// Sends the redisplay events for feature and results, updates the updated + /// status void redisplayWithResults(std::shared_ptr theFeature, - const ModelAPI_ExecState theState, bool theUpdateState = true); + const ModelAPI_ExecState theState, + bool theUpdateState = true); - /// On operation start/end/abort the "Just" fileds must be cleared and processed in the right way - //! \param theFlushRedisplay a boolean value if the redisplay signal should be flushed + /// On operation start/end/abort the "Just" fileds must be cleared and + /// processed in the right way + //! \param theFlushRedisplay a boolean value if the redisplay signal should be + //! flushed void processFeatures(const bool theFlushRedisplay = true); /// Performs the feature execution @@ -102,17 +117,18 @@ protected: void executeFeature(std::shared_ptr theFeature); /// Updates the properties of object because of stability state changes - void updateStability(void* theSender); + void updateStability(void *theSender); /// Returns true if theFeature modification was caused by theReason /// (may be feature of result of this feature) - bool isReason( - std::shared_ptr& theFeature, std::shared_ptr theReason); - - /// Updates a selection attributes for the features that possible were affected by creation - /// or reorder of features upper in the history line (issue #1757) - void updateSelection(const std::set >& theObjects); - + bool isReason(std::shared_ptr &theFeature, + std::shared_ptr theReason); + + /// Updates a selection attributes for the features that possible were + /// affected by creation or reorder of features upper in the history line + /// (issue #1757) + void + updateSelection(const std::set> &theObjects); }; #endif diff --git a/src/Model/Model_Validator.cpp b/src/Model/Model_Validator.cpp index 60e7ec9d4..4936128c1 100644 --- a/src/Model/Model_Validator.cpp +++ b/src/Model/Model_Validator.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Model_Validator.h" @@ -33,69 +34,66 @@ #include -void Model_ValidatorsFactory::registerValidator(const std::string& theID, - ModelAPI_Validator* theValidator) -{ +void Model_ValidatorsFactory::registerValidator( + const std::string &theID, ModelAPI_Validator *theValidator) { if (myIDs.find(theID) != myIDs.end()) { - Events_InfoMessage("Model_Validator", "Validator %1 is already registered").arg(theID).send(); + Events_InfoMessage("Model_Validator", "Validator %1 is already registered") + .arg(theID) + .send(); } else { myIDs[theID] = theValidator; } } -void Model_ValidatorsFactory::assignValidator(const std::string& theID, - const std::string& theFeatureID) -{ +void Model_ValidatorsFactory::assignValidator(const std::string &theID, + const std::string &theFeatureID) { if (myFeatures.find(theFeatureID) == myFeatures.end()) { myFeatures[theFeatureID] = AttrValidators(); } if (myFeatures[theFeatureID].find(theID) != myFeatures[theFeatureID].end()) { - //Events_Error::send(std::string("Validator ") + theID + - // " for feature " + theFeatureID + "is already registered"); + // Events_Error::send(std::string("Validator ") + theID + + // " for feature " + theFeatureID + "is already registered"); } else { myFeatures[theFeatureID][theID] = std::list(); } } -void Model_ValidatorsFactory::assignValidator(const std::string& theID, - const std::string& theFeatureID, - const std::list& theArguments) -{ +void Model_ValidatorsFactory::assignValidator( + const std::string &theID, const std::string &theFeatureID, + const std::list &theArguments) { if (myFeatures.find(theFeatureID) == myFeatures.end()) { myFeatures[theFeatureID] = AttrValidators(); } if (myFeatures[theFeatureID].find(theID) != myFeatures[theFeatureID].end()) { - //Events_Error::send(std::string("Validator ") + theID + - // " for feature " + theFeatureID + "is already registered"); + // Events_Error::send(std::string("Validator ") + theID + + // " for feature " + theFeatureID + "is already registered"); } else { myFeatures[theFeatureID][theID] = theArguments; } } -void Model_ValidatorsFactory::assignValidator(const std::string& theID, - const std::string& theFeatureID, - const std::string& theAttrID, - const std::list& theArguments) -{ +void Model_ValidatorsFactory::assignValidator( + const std::string &theID, const std::string &theFeatureID, + const std::string &theAttrID, const std::list &theArguments) { // create feature-structures if not exist - std::map >::iterator aFeature = myAttrs.find( - theFeatureID); + std::map>::iterator + aFeature = myAttrs.find(theFeatureID); if (aFeature == myAttrs.end()) { myAttrs[theFeatureID] = std::map(); aFeature = myAttrs.find(theFeatureID); } // add attr-structure if not exist, or generate error if already exist - std::map::iterator anAttr = aFeature->second.find(theAttrID); + std::map::iterator anAttr = + aFeature->second.find(theAttrID); if (anAttr == aFeature->second.end()) { aFeature->second[theAttrID] = AttrValidators(); } aFeature->second[theAttrID][theID] = theArguments; } -void Model_ValidatorsFactory::validators(const std::string& theFeatureID, - Validators& theValidators) const -{ +void Model_ValidatorsFactory::validators(const std::string &theFeatureID, + Validators &theValidators) const { std::map::const_iterator aFeatureIt = myFeatures.find(theFeatureID); if (aFeatureIt != myFeatures.cend()) { @@ -103,32 +101,36 @@ void Model_ValidatorsFactory::validators(const std::string& theFeatureID, for (; aValidatorsIt != aFeatureIt->second.cend(); aValidatorsIt++) { if (!validator(aValidatorsIt->first)) { Events_InfoMessage("Model_Validator", "Validator %1 was not registered") - .arg(aValidatorsIt->first).send(); + .arg(aValidatorsIt->first) + .send(); } else { - theValidators.push_back(std::make_pair(aValidatorsIt->first, aValidatorsIt->second)); + theValidators.push_back( + std::make_pair(aValidatorsIt->first, aValidatorsIt->second)); } } } addDefaultValidators(theValidators); } -void Model_ValidatorsFactory::validators(const std::string& theFeatureID, - const std::string& theAttrID, - Validators& theValidators) const -{ - std::map >::const_iterator aFeatureIt = - myAttrs.find(theFeatureID); +void Model_ValidatorsFactory::validators(const std::string &theFeatureID, + const std::string &theAttrID, + Validators &theValidators) const { + std::map>::const_iterator + aFeatureIt = myAttrs.find(theFeatureID); if (aFeatureIt != myAttrs.cend()) { std::map::const_iterator anAttrIt = - aFeatureIt->second.find(theAttrID); + aFeatureIt->second.find(theAttrID); if (anAttrIt != aFeatureIt->second.end()) { AttrValidators::const_iterator aValidatorsIt = anAttrIt->second.cbegin(); for (; aValidatorsIt != anAttrIt->second.cend(); aValidatorsIt++) { if (!validator(aValidatorsIt->first)) { - Events_InfoMessage("Model_Validator", "Validator %1 was not registered") - .arg(aValidatorsIt->first).send(); + Events_InfoMessage("Model_Validator", + "Validator %1 was not registered") + .arg(aValidatorsIt->first) + .send(); } else { - theValidators.push_back(std::make_pair(aValidatorsIt->first, aValidatorsIt->second)); + theValidators.push_back( + std::make_pair(aValidatorsIt->first, aValidatorsIt->second)); } } } @@ -137,45 +139,47 @@ void Model_ValidatorsFactory::validators(const std::string& theFeatureID, } Model_ValidatorsFactory::Model_ValidatorsFactory() - : ModelAPI_ValidatorsFactory() -{ + : ModelAPI_ValidatorsFactory() { registerValidator("Model_FeatureValidator", new Model_FeatureValidator); registerValidator("Model_AttributeValidator", new Model_AttributeValidator); } -const ModelAPI_Validator* Model_ValidatorsFactory::validator(const std::string& theID) const -{ - std::map::const_iterator aIt = myIDs.find(theID); +const ModelAPI_Validator * +Model_ValidatorsFactory::validator(const std::string &theID) const { + std::map::const_iterator aIt = + myIDs.find(theID); if (aIt != myIDs.end()) { return aIt->second; } return NULL; } -void Model_ValidatorsFactory::addDefaultValidators(Validators& theValidators) const -{ +void Model_ValidatorsFactory::addDefaultValidators( + Validators &theValidators) const { const static std::string kDefaultId = "Model_FeatureValidator"; if (!validator(kDefaultId)) return; theValidators.push_back(std::make_pair(kDefaultId, std::list())); } -void Model_ValidatorsFactory::addDefaultAttributeValidators(Validators& theValidators) const -{ +void Model_ValidatorsFactory::addDefaultAttributeValidators( + Validators &theValidators) const { const static std::string kDefaultId = "Model_AttributeValidator"; if (!validator(kDefaultId)) return; theValidators.push_back(std::make_pair(kDefaultId, std::list())); } -bool Model_ValidatorsFactory::validate(const std::shared_ptr& theFeature) const -{ - std::shared_ptr aData = std::dynamic_pointer_cast(theFeature->data()); +bool Model_ValidatorsFactory::validate( + const std::shared_ptr &theFeature) const { + std::shared_ptr aData = + std::dynamic_pointer_cast(theFeature->data()); if (aData.get() && aData->isValid()) { if (aData->execState() == ModelAPI_StateDone) aData->eraseErrorString(); // no error => erase the information string } else { - return false; // feature is broken, already not presented in the data structure + return false; // feature is broken, already not presented in the data + // structure } // check feature validators first @@ -184,11 +188,12 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& if (!aValidators.empty()) { Validators::const_iterator aValidatorIt = aValidators.cbegin(); - for(; aValidatorIt != aValidators.cend(); aValidatorIt++) { - const std::string& aValidatorID = aValidatorIt->first; - const std::list& anArguments = aValidatorIt->second; - const ModelAPI_FeatureValidator* aFValidator = - dynamic_cast(validator(aValidatorID)); + for (; aValidatorIt != aValidators.cend(); aValidatorIt++) { + const std::string &aValidatorID = aValidatorIt->first; + const std::list &anArguments = aValidatorIt->second; + const ModelAPI_FeatureValidator *aFValidator = + dynamic_cast( + validator(aValidatorID)); if (aFValidator) { Events_InfoMessage anError; if (!aFValidator->isValid(theFeature, anArguments, anError)) { @@ -197,7 +202,8 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& if (anError.context().empty()) { anError.setContext(theFeature->getKind() + ":" + aValidatorID); } - theFeature->setError(Config_Translator::translate(anError), false, false); + theFeature->setError(Config_Translator::translate(anError), false, + false); theFeature->data()->execState(ModelAPI_StateInvalidArgument); return false; } @@ -210,7 +216,7 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& std::list aLtAttributes = aData->attributesIDs(kAllTypes); std::list::const_iterator anAttrIt = aLtAttributes.cbegin(); for (; anAttrIt != aLtAttributes.cend(); anAttrIt++) { - const std::string& anAttributeID = *anAttrIt; + const std::string &anAttributeID = *anAttrIt; AttributePtr anAttribute = theFeature->data()->attribute(anAttributeID); std::string aValidatorID; @@ -219,7 +225,8 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& if (anError.empty()) anError = "Unknown error."; if (anError.context().empty()) { - anError.setContext(theFeature->getKind() + ":" + anAttributeID + ":" + aValidatorID); + anError.setContext(theFeature->getKind() + ":" + anAttributeID + ":" + + aValidatorID); } theFeature->setError(Config_Translator::translate(anError), false, false); theFeature->data()->execState(ModelAPI_StateInvalidArgument); @@ -230,10 +237,9 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& return true; } -bool Model_ValidatorsFactory::validate(const std::shared_ptr& theAttribute, - std::string& theValidator, - Events_InfoMessage& theError) const -{ +bool Model_ValidatorsFactory::validate( + const std::shared_ptr &theAttribute, + std::string &theValidator, Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (!aFeature.get()) { theValidator = "Model_ValidatorsFactory"; @@ -242,7 +248,8 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr } // skip not-case attributes, that really may be invalid (issue 671) - if (!const_cast(this)->isCase(aFeature, theAttribute->id())) + if (!const_cast(this)->isCase(aFeature, + theAttribute->id())) return true; Validators aValidators; @@ -250,10 +257,11 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr Validators::iterator aValidatorIt = aValidators.begin(); for (; aValidatorIt != aValidators.end(); ++aValidatorIt) { - const std::string& aValidatorID = aValidatorIt->first; - const std::list& anArguments = aValidatorIt->second; - const ModelAPI_AttributeValidator* anAttrValidator = - dynamic_cast(validator(aValidatorID)); + const std::string &aValidatorID = aValidatorIt->first; + const std::list &anArguments = aValidatorIt->second; + const ModelAPI_AttributeValidator *anAttrValidator = + dynamic_cast( + validator(aValidatorID)); if (!anAttrValidator) continue; if (!anAttrValidator->isValid(theAttribute, anArguments, theError)) { @@ -266,24 +274,27 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr } void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, - std::string theAttribute) -{ + std::string theAttribute) { const static std::string kDefaultId = "Model_FeatureValidator"; - std::map::const_iterator it = myIDs.find(kDefaultId); + std::map::const_iterator it = + myIDs.find(kDefaultId); if (it != myIDs.end()) { - Model_FeatureValidator* aValidator = dynamic_cast(it->second); + Model_FeatureValidator *aValidator = + dynamic_cast(it->second); if (aValidator) { aValidator->registerNotObligatory(theFeature, theAttribute); } } } -bool Model_ValidatorsFactory::isNotObligatory(std::string theFeature, std::string theAttribute) -{ +bool Model_ValidatorsFactory::isNotObligatory(std::string theFeature, + std::string theAttribute) { const static std::string kDefaultId = "Model_FeatureValidator"; - std::map::const_iterator it = myIDs.find(kDefaultId); + std::map::const_iterator it = + myIDs.find(kDefaultId); if (it != myIDs.end()) { - Model_FeatureValidator* aValidator = dynamic_cast(it->second); + Model_FeatureValidator *aValidator = + dynamic_cast(it->second); if (aValidator) { return aValidator->isNotObligatory(theFeature, theAttribute); } @@ -291,9 +302,10 @@ bool Model_ValidatorsFactory::isNotObligatory(std::string theFeature, std::strin return false; // default } -void Model_ValidatorsFactory::registerConcealment(std::string theFeature, std::string theAttribute) -{ - std::map >::iterator aFind = myConcealed.find(theFeature); +void Model_ValidatorsFactory::registerConcealment(std::string theFeature, + std::string theAttribute) { + std::map>::iterator aFind = + myConcealed.find(theFeature); if (aFind == myConcealed.end()) { std::set aNewSet; aNewSet.insert(theAttribute); @@ -303,32 +315,38 @@ void Model_ValidatorsFactory::registerConcealment(std::string theFeature, std::s } } -bool Model_ValidatorsFactory::isConcealed(std::string theFeature, std::string theAttribute) -{ - std::map >::iterator aFind = myConcealed.find(theFeature); - return aFind != myConcealed.end() && aFind->second.find(theAttribute) != aFind->second.end(); +bool Model_ValidatorsFactory::isConcealed(std::string theFeature, + std::string theAttribute) { + std::map>::iterator aFind = + myConcealed.find(theFeature); + return aFind != myConcealed.end() && + aFind->second.find(theAttribute) != aFind->second.end(); } -void Model_ValidatorsFactory::registerCase(std::string theFeature, std::string theAttribute, - const std::list >& theCases) -{ - std::map > > > - ::iterator aFindFeature = myCases.find(theFeature); +void Model_ValidatorsFactory::registerCase( + std::string theFeature, std::string theAttribute, + const std::list> &theCases) { + std::map>>>::iterator + aFindFeature = myCases.find(theFeature); if (aFindFeature == myCases.end()) { - myCases[theFeature] = std::map > >(); + myCases[theFeature] = + std::map>>(); aFindFeature = myCases.find(theFeature); } - std::map > >::iterator aFindAttrID = - aFindFeature->second.find(theAttribute); + std::map>>::iterator + aFindAttrID = aFindFeature->second.find(theAttribute); if (aFindAttrID == aFindFeature->second.end()) { aFindFeature->second[theAttribute] = - std::map >(); + std::map>(); aFindAttrID = aFindFeature->second.find(theAttribute); } - std::list >::const_iterator aCasesIt = theCases.begin(), - aCasesLast = theCases.end(); - std::map > aFindCases = aFindAttrID->second; + std::list>::const_iterator + aCasesIt = theCases.begin(), + aCasesLast = theCases.end(); + std::map> aFindCases = aFindAttrID->second; for (; aCasesIt != aCasesLast; aCasesIt++) { std::pair aCasePair = *aCasesIt; std::string aSwitch = aCasePair.first; @@ -339,64 +357,68 @@ void Model_ValidatorsFactory::registerCase(std::string theFeature, std::string t } } -bool Model_ValidatorsFactory::isCase(FeaturePtr theFeature, std::string theAttribute) -{ +bool Model_ValidatorsFactory::isCase(FeaturePtr theFeature, + std::string theAttribute) { bool anInCase = true; - std::map > > > - ::iterator aFindFeature = myCases.find(theFeature->getKind()); + std::map>>>::iterator + aFindFeature = myCases.find(theFeature->getKind()); if (aFindFeature != myCases.end()) { - std::map > >::iterator - aFindAttrID = aFindFeature->second.find(theAttribute); + std::map>>::iterator + aFindAttrID = aFindFeature->second.find(theAttribute); if (aFindAttrID != aFindFeature->second.end()) { - std::map >::iterator - aCasesIt = aFindAttrID->second.begin(), aCasesLast = aFindAttrID->second.end(); + std::map>::iterator + aCasesIt = aFindAttrID->second.begin(), + aCasesLast = aFindAttrID->second.end(); for (; aCasesIt != aCasesLast && anInCase; aCasesIt++) { // the the switch-attribute that contains the case value AttributeStringPtr aSwitch = theFeature->string(aCasesIt->first); if (aSwitch.get()) { // the second has the case identifier - anInCase = aCasesIt->second.find(aSwitch->value()) != aCasesIt->second.end(); + anInCase = + aCasesIt->second.find(aSwitch->value()) != aCasesIt->second.end(); } } } } - return anInCase; // if no additional conditions, this attribute is the case to be validated + return anInCase; // if no additional conditions, this attribute is the case to + // be validated } void Model_ValidatorsFactory::registerMainArgument(std::string theFeature, - std::string theAttribute) -{ - std::map::iterator aFound = myMainArgument.find(theFeature); + std::string theAttribute) { + std::map::iterator aFound = + myMainArgument.find(theFeature); if (aFound == myMainArgument.end()) myMainArgument[theFeature] = theAttribute; } -bool Model_ValidatorsFactory::isMainArgument(std::string theFeature, std::string theAttribute) -{ - std::map::iterator aFound = myMainArgument.find(theFeature); +bool Model_ValidatorsFactory::isMainArgument(std::string theFeature, + std::string theAttribute) { + std::map::iterator aFound = + myMainArgument.find(theFeature); return aFound != myMainArgument.end() && aFound->second == theAttribute; } -void Model_ValidatorsFactory::registerGeometricalSelection(std::string theFeature, - std::string theAttribute) -{ - std::map >::iterator aFind = - myGeometricalSelection.find(theFeature); +void Model_ValidatorsFactory::registerGeometricalSelection( + std::string theFeature, std::string theAttribute) { + std::map>::iterator aFind = + myGeometricalSelection.find(theFeature); if (aFind == myGeometricalSelection.end()) { std::set aNewSet; aNewSet.insert(theAttribute); myGeometricalSelection[theFeature] = aNewSet; - } - else { + } else { aFind->second.insert(theAttribute); } } bool Model_ValidatorsFactory::isGeometricalSelection(std::string theFeature, - std::string theAttribute) -{ - std::map >::iterator aFind = - myGeometricalSelection.find(theFeature); - return aFind != myGeometricalSelection.end() - && aFind->second.find(theAttribute) != aFind->second.end(); + std::string theAttribute) { + std::map>::iterator aFind = + myGeometricalSelection.find(theFeature); + return aFind != myGeometricalSelection.end() && + aFind->second.find(theAttribute) != aFind->second.end(); } diff --git a/src/Model/Model_Validator.h b/src/Model/Model_Validator.h index 7d4685574..a9d1978fc 100644 --- a/src/Model/Model_Validator.h +++ b/src/Model/Model_Validator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Model_Validator_H_ @@ -29,7 +30,7 @@ * \ingroup DataModel * \brief Manages the registered validators * - * Allows to get a validator by the feature identifier and + * Allows to get a validator by the feature identifier and * the attribute identifier (if attribute is validated). * All accessible validators mustbe registered by the ID string first. * The instance of this factory can be get in the Session. @@ -37,104 +38,119 @@ * All the needed information is provided to the validator as an argument, * this allows to work with them independently from the feature specific object. */ -class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory -{ - private: - std::map myIDs; ///< map from ID to registered validator +class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory { +private: + std::map + myIDs; ///< map from ID to registered validator /// validators IDs to list of arguments - typedef std::map > AttrValidators; + typedef std::map> AttrValidators; /// validators IDs by feature ID std::map myFeatures; /// validators IDs and arguments by feature and attribute IDs - std::map > myAttrs; - /// Stores the registered attributes that leads to the concealment of referenced objects in - /// data tree. Map from feature kind to set of attribute IDs. - std::map > myConcealed; - /// Stores the registered attributes must be checked only if the particular case is activated - /// Map from feature kind to map of attribute IDs to pair - // (switchId (ID of the attribute) and case Ids (possible values of the switch attribute)) - std::map > > > myCases; + std::map> myAttrs; + /// Stores the registered attributes that leads to the concealment of + /// referenced objects in data tree. Map from feature kind to set of attribute + /// IDs. + std::map> myConcealed; + /// Stores the registered attributes must be checked only if the particular + /// case is activated Map from feature kind to map of attribute IDs to pair + // (switchId (ID of the attribute) and case Ids (possible values of the switch + // attribute)) + std::map>>> + myCases; /// Stores main attribute for each feature std::map myMainArgument; - std::map > myGeometricalSelection; + std::map> myGeometricalSelection; - public: +public: /// Registers the instance of the validator by the ID - MODEL_EXPORT virtual void registerValidator(const std::string& theID, - ModelAPI_Validator* theValidator); + MODEL_EXPORT virtual void registerValidator(const std::string &theID, + ModelAPI_Validator *theValidator); /// Assigns validator to the feature - MODEL_EXPORT virtual void assignValidator(const std::string& theID, - const std::string& theFeatureID); + MODEL_EXPORT virtual void assignValidator(const std::string &theID, + const std::string &theFeatureID); /// Assigns validator to the feature with arguments of the validator - MODEL_EXPORT virtual void assignValidator(const std::string& theID, - const std::string& theFeatureID, - const std::list& theArguments); + MODEL_EXPORT virtual void + assignValidator(const std::string &theID, const std::string &theFeatureID, + const std::list &theArguments); /// Assigns validator to the attribute of the feature - MODEL_EXPORT virtual void assignValidator(const std::string& theID, - const std::string& theFeatureID, - const std::string& theAttrID, - const std::list& theArguments); + MODEL_EXPORT virtual void + assignValidator(const std::string &theID, const std::string &theFeatureID, + const std::string &theAttrID, + const std::list &theArguments); /// Provides a validator for the feature, returns NULL if no validator - MODEL_EXPORT virtual void validators(const std::string& theFeatureID, - Validators& theResult) const; + MODEL_EXPORT virtual void validators(const std::string &theFeatureID, + Validators &theResult) const; /// Provides a validator for the attribute, returns NULL if no validator - MODEL_EXPORT virtual void validators(const std::string& theFeatureID, - const std::string& theAttrID, Validators& theResult) const; + MODEL_EXPORT virtual void validators(const std::string &theFeatureID, + const std::string &theAttrID, + Validators &theResult) const; /// Returns registered validator by its Id - MODEL_EXPORT virtual const ModelAPI_Validator* validator(const std::string& theID) const; + MODEL_EXPORT virtual const ModelAPI_Validator * + validator(const std::string &theID) const; /// Returns true if feature and all its attributes are valid. - MODEL_EXPORT virtual bool validate(const std::shared_ptr& theFeature) const; + MODEL_EXPORT virtual bool + validate(const std::shared_ptr &theFeature) const; /// Returns true if the attribute is valid. - MODEL_EXPORT virtual bool validate(const std::shared_ptr& theAttribute, - std::string& theValidator, Events_InfoMessage& theError) const; + MODEL_EXPORT virtual bool + validate(const std::shared_ptr &theAttribute, + std::string &theValidator, Events_InfoMessage &theError) const; - /// register that this attribute in feature is not obligatory for the feature execution - /// so, it is not needed for the standard validation mechanism - virtual void registerNotObligatory(std::string theFeature, std::string theAttribute); + /// register that this attribute in feature is not obligatory for the feature + /// execution so, it is not needed for the standard validation mechanism + virtual void registerNotObligatory(std::string theFeature, + std::string theAttribute); - /// Returns true if the attribute in feature is not obligatory for the feature execution - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + /// Returns true if the attribute in feature is not obligatory for the feature + /// execution + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); /// register that this attribute conceals in the object browser /// all referenced features after execution - virtual void registerConcealment(std::string theFeature, std::string theAttribute); + virtual void registerConcealment(std::string theFeature, + std::string theAttribute); - /// Returns true that it was registered that attribute conceals the referenced result + /// Returns true that it was registered that attribute conceals the referenced + /// result virtual bool isConcealed(std::string theFeature, std::string theAttribute); /// register the case-attribute (\a myCases set definition) - virtual void registerCase(std::string theFeature, std::string theAttribute, - const std::list >& theCases); + virtual void + registerCase(std::string theFeature, std::string theAttribute, + const std::list> &theCases); /// Returns true if the attribute must be checked (the case is selected) virtual bool isCase(FeaturePtr theFeature, std::string theAttribute); /// Register the attribute as a main argument of the feature - virtual void registerMainArgument(std::string theFeature, std::string theAttribute); + virtual void registerMainArgument(std::string theFeature, + std::string theAttribute); /// Returns true is the attribute is a main argument of the feature virtual bool isMainArgument(std::string theFeature, std::string theAttribute); /// Register the selection attribute as geometrical selection - virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute); + virtual void registerGeometricalSelection(std::string theFeature, + std::string theAttribute); /// Returns true if the attribute is a geometrical selection - virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute); - + virtual bool isGeometricalSelection(std::string theFeature, + std::string theAttribute); protected: /// Adds the defualt validators that are usefull for all features. - void addDefaultValidators(Validators& theValidators) const; + void addDefaultValidators(Validators &theValidators) const; /// Adds the defualt validators that are usefull for all attributes. - void addDefaultAttributeValidators(Validators& theValidators) const; + void addDefaultAttributeValidators(Validators &theValidators) const; /// Get instance from Session Model_ValidatorsFactory(); diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index aeae1ae9d..dfe5031b3 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -174,16 +174,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ModelAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ModelAPI/ModelAPI.h b/src/ModelAPI/ModelAPI.h index 7c06e09dd..f5831b59f 100644 --- a/src/ModelAPI/ModelAPI.h +++ b/src/ModelAPI/ModelAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_H @@ -22,13 +23,13 @@ #if defined MODELAPI_EXPORTS #if defined WIN32 -#define MODELAPI_EXPORT __declspec( dllexport ) +#define MODELAPI_EXPORT __declspec(dllexport) #else #define MODELAPI_EXPORT #endif #else #if defined WIN32 -#define MODELAPI_EXPORT __declspec( dllimport ) +#define MODELAPI_EXPORT __declspec(dllimport) #else #define MODELAPI_EXPORT #endif diff --git a/src/ModelAPI/ModelAPI_Attribute.cpp b/src/ModelAPI/ModelAPI_Attribute.cpp index ab9d54eb1..21c65674b 100644 --- a/src/ModelAPI/ModelAPI_Attribute.cpp +++ b/src/ModelAPI/ModelAPI_Attribute.cpp @@ -14,41 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -ModelAPI_Attribute::~ModelAPI_Attribute() -{ -} +ModelAPI_Attribute::~ModelAPI_Attribute() {} - /// Sets the owner of this attribute -void ModelAPI_Attribute::setObject(const std::shared_ptr& theObject) -{ +/// Sets the owner of this attribute +void ModelAPI_Attribute::setObject( + const std::shared_ptr &theObject) { myObject = theObject; } - /// Returns the owner of this attribute -const std::shared_ptr& ModelAPI_Attribute::owner() const -{ +/// Returns the owner of this attribute +const std::shared_ptr &ModelAPI_Attribute::owner() const { return myObject; } - /// Returns true if attribute was initialized by some value -bool ModelAPI_Attribute::isInitialized() -{ - return myIsInitialized; -} +/// Returns true if attribute was initialized by some value +bool ModelAPI_Attribute::isInitialized() { return myIsInitialized; } -void ModelAPI_Attribute::setInitialized() -{ +void ModelAPI_Attribute::setInitialized() { if (!mySetInitializedBlocked) myIsInitialized = true; } -bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock) -{ +bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock) { bool aBlocked = mySetInitializedBlocked; mySetInitializedBlocked = theBlock; @@ -56,50 +49,32 @@ bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock) return aBlocked; } -void ModelAPI_Attribute::setIsArgument(const bool theFlag) -{ +void ModelAPI_Attribute::setIsArgument(const bool theFlag) { myIsArgument = theFlag; } -bool ModelAPI_Attribute::isArgument() -{ - return myIsArgument; -} +bool ModelAPI_Attribute::isArgument() { return myIsArgument; } -bool ModelAPI_Attribute::setImmutable(const bool theFlag) -{ +bool ModelAPI_Attribute::setImmutable(const bool theFlag) { bool aResult = myIsImmutable; myIsImmutable = theFlag; return aResult; } -bool ModelAPI_Attribute::isImmutable() -{ - return myIsImmutable; -} +bool ModelAPI_Attribute::isImmutable() { return myIsImmutable; } -const std::string& ModelAPI_Attribute::id() const -{ - return myID; -} +const std::string &ModelAPI_Attribute::id() const { return myID; } -ModelAPI_Attribute::ModelAPI_Attribute() -{ +ModelAPI_Attribute::ModelAPI_Attribute() { mySetInitializedBlocked = false; myIsInitialized = false; myIsArgument = true; myIsImmutable = false; } - /// Sets the ID of the attribute in Data (called from Data) -void ModelAPI_Attribute::setID(const std::string theID) -{ - myID = theID; -} +/// Sets the ID of the attribute in Data (called from Data) +void ModelAPI_Attribute::setID(const std::string theID) { myID = theID; } void ModelAPI_Attribute::reinit() {} -void ModelAPI_Attribute::reset() -{ - myIsInitialized = false; -} +void ModelAPI_Attribute::reset() { myIsInitialized = false; } diff --git a/src/ModelAPI/ModelAPI_Attribute.h b/src/ModelAPI/ModelAPI_Attribute.h index 9ee118984..0d45487d0 100644 --- a/src/ModelAPI/ModelAPI_Attribute.h +++ b/src/ModelAPI/ModelAPI_Attribute.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Attribute_H_ #define ModelAPI_Attribute_H_ #include "ModelAPI.h" -#include #include +#include class ModelAPI_Object; @@ -30,20 +31,20 @@ class ModelAPI_Object; * \ingroup DataModel * \brief Generic attribute of the Object. */ -class ModelAPI_Attribute -{ - ///< needed here to emit signal that feature changed on change of the attribute +class ModelAPI_Attribute { + ///< needed here to emit signal that feature changed on change of the + ///< attribute std::shared_ptr myObject; std::string myID; ///< identifier of this attribute in Data class - protected: +protected: // accessible from the attributes - bool myIsInitialized; ///< is some value assigned to this attribute + bool myIsInitialized; ///< is some value assigned to this attribute bool mySetInitializedBlocked; ///< is initialized blocked - bool myIsArgument; ///< is this attribute used as an argument for execution - bool myIsImmutable; ///< is this attribute can be changed programmatically (e.g. by constraint) - - public: + bool myIsArgument; ///< is this attribute used as an argument for execution + bool myIsImmutable; ///< is this attribute can be changed programmatically + ///< (e.g. by constraint) +public: /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType() = 0; @@ -51,10 +52,11 @@ class ModelAPI_Attribute MODELAPI_EXPORT virtual ~ModelAPI_Attribute(); /// Sets the owner of this attribute - MODELAPI_EXPORT virtual void setObject(const std::shared_ptr& theObject); + MODELAPI_EXPORT virtual void + setObject(const std::shared_ptr &theObject); /// Returns the owner of this attribute - MODELAPI_EXPORT const std::shared_ptr& owner() const; + MODELAPI_EXPORT const std::shared_ptr &owner() const; /// Returns true if attribute was initialized by some value MODELAPI_EXPORT virtual bool isInitialized(); @@ -75,28 +77,29 @@ class ModelAPI_Attribute /// Returns true if attribute causes the result change MODELAPI_EXPORT bool isArgument(); - /// Immutable argument can not be changed programmatically (e.g. by constraint) - /// By default it is false. - /// Returns the previous state of the attribute's immutability. + /// Immutable argument can not be changed programmatically (e.g. by + /// constraint) By default it is false. Returns the previous state of the + /// attribute's immutability. MODELAPI_EXPORT bool setImmutable(const bool theFlag); /// Returns true if can not be changed programmatically MODELAPI_EXPORT bool isImmutable(); /// ID of the attribute in Data - MODELAPI_EXPORT const std::string& id() const; + MODELAPI_EXPORT const std::string &id() const; /// Resets attribute to deafult state. MODELAPI_EXPORT virtual void reset(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_Attribute(); /// Sets the ID of the attribute in Data (called from Data) MODELAPI_EXPORT virtual void setID(const std::string theID); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) MODELAPI_EXPORT virtual void reinit(); friend class Model_Data; diff --git a/src/ModelAPI/ModelAPI_AttributeBoolean.cpp b/src/ModelAPI/ModelAPI_AttributeBoolean.cpp index 141a2d94b..14bf5d7ff 100644 --- a/src/ModelAPI/ModelAPI_AttributeBoolean.cpp +++ b/src/ModelAPI/ModelAPI_AttributeBoolean.cpp @@ -14,21 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeBoolean.h" -std::string ModelAPI_AttributeBoolean::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeBoolean::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeBoolean::~ModelAPI_AttributeBoolean() -{ -} +ModelAPI_AttributeBoolean::~ModelAPI_AttributeBoolean() {} -ModelAPI_AttributeBoolean::ModelAPI_AttributeBoolean() -{ -} +ModelAPI_AttributeBoolean::ModelAPI_AttributeBoolean() {} diff --git a/src/ModelAPI/ModelAPI_AttributeBoolean.h b/src/ModelAPI/ModelAPI_AttributeBoolean.h index 0c17b3549..e26322177 100644 --- a/src/ModelAPI/ModelAPI_AttributeBoolean.h +++ b/src/ModelAPI/ModelAPI_AttributeBoolean.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_ATTRIBUTEBOOLEAN_H_ @@ -27,9 +28,8 @@ * \brief Attribute that contains boolean value. */ -class ModelAPI_AttributeBoolean : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeBoolean : public ModelAPI_Attribute { +public: /// Defines the double value MODELAPI_EXPORT virtual void setValue(bool theValue) = 0; @@ -37,10 +37,7 @@ class ModelAPI_AttributeBoolean : public ModelAPI_Attribute MODELAPI_EXPORT virtual bool value() = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "Boolean"; - } + MODELAPI_EXPORT static std::string typeId() { return "Boolean"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -48,7 +45,7 @@ class ModelAPI_AttributeBoolean : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeBoolean(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeBoolean(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeDocRef.cpp b/src/ModelAPI/ModelAPI_AttributeDocRef.cpp index ec5bf4c28..fc5ada929 100644 --- a/src/ModelAPI/ModelAPI_AttributeDocRef.cpp +++ b/src/ModelAPI/ModelAPI_AttributeDocRef.cpp @@ -14,20 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeDocRef.h" -std::string ModelAPI_AttributeDocRef::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeDocRef::attributeType() { return typeId(); } -ModelAPI_AttributeDocRef::~ModelAPI_AttributeDocRef() -{ -} +ModelAPI_AttributeDocRef::~ModelAPI_AttributeDocRef() {} -ModelAPI_AttributeDocRef::ModelAPI_AttributeDocRef() -{ -} +ModelAPI_AttributeDocRef::ModelAPI_AttributeDocRef() {} diff --git a/src/ModelAPI/ModelAPI_AttributeDocRef.h b/src/ModelAPI/ModelAPI_AttributeDocRef.h index 45c75ad5e..b91d527b7 100644 --- a/src/ModelAPI/ModelAPI_AttributeDocRef.h +++ b/src/ModelAPI/ModelAPI_AttributeDocRef.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeDocRef_H_ @@ -28,11 +29,11 @@ * \brief Attribute that contains reference to another document. */ -class ModelAPI_AttributeDocRef : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeDocRef : public ModelAPI_Attribute { +public: /// Defines the document referenced from this attribute - MODELAPI_EXPORT virtual void setValue(std::shared_ptr theDoc) = 0; + MODELAPI_EXPORT virtual void + setValue(std::shared_ptr theDoc) = 0; /// Returns document referenced from this attribute MODELAPI_EXPORT virtual std::shared_ptr value() = 0; @@ -41,10 +42,7 @@ class ModelAPI_AttributeDocRef : public ModelAPI_Attribute MODELAPI_EXPORT virtual int docId() = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "DocRef"; - } + MODELAPI_EXPORT static std::string typeId() { return "DocRef"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -52,7 +50,7 @@ class ModelAPI_AttributeDocRef : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeDocRef(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeDocRef(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeDouble.cpp b/src/ModelAPI/ModelAPI_AttributeDouble.cpp index 88489e114..424185b77 100644 --- a/src/ModelAPI/ModelAPI_AttributeDouble.cpp +++ b/src/ModelAPI/ModelAPI_AttributeDouble.cpp @@ -14,20 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeDouble.h" -std::string ModelAPI_AttributeDouble::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeDouble::attributeType() { return typeId(); } -ModelAPI_AttributeDouble::~ModelAPI_AttributeDouble() -{ -} +ModelAPI_AttributeDouble::~ModelAPI_AttributeDouble() {} -ModelAPI_AttributeDouble::ModelAPI_AttributeDouble() -{ -} +ModelAPI_AttributeDouble::ModelAPI_AttributeDouble() {} diff --git a/src/ModelAPI/ModelAPI_AttributeDouble.h b/src/ModelAPI/ModelAPI_AttributeDouble.h index 8c1f0c8fa..6572b61e5 100644 --- a/src/ModelAPI/ModelAPI_AttributeDouble.h +++ b/src/ModelAPI/ModelAPI_AttributeDouble.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeDouble_H_ @@ -30,9 +31,8 @@ * \brief Attribute that contains real value with double precision. */ -class ModelAPI_AttributeDouble : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeDouble : public ModelAPI_Attribute { +public: /// Defines the double value MODELAPI_EXPORT virtual void setValue(const double theValue) = 0; @@ -43,7 +43,7 @@ class ModelAPI_AttributeDouble : public ModelAPI_Attribute MODELAPI_EXPORT virtual void setCalculatedValue(const double theValue) = 0; /// Defines the text value - MODELAPI_EXPORT virtual void setText(const std::wstring& theText) = 0; + MODELAPI_EXPORT virtual void setText(const std::wstring &theText) = 0; /// Returns the text value MODELAPI_EXPORT virtual std::wstring text() = 0; @@ -55,23 +55,21 @@ class ModelAPI_AttributeDouble : public ModelAPI_Attribute MODELAPI_EXPORT virtual bool expressionInvalid() = 0; /// Allows to set expression (text) error (by the parameters listener) - MODELAPI_EXPORT virtual void setExpressionError(const std::string& theError) = 0; + MODELAPI_EXPORT virtual void + setExpressionError(const std::string &theError) = 0; /// Returns an expression error MODELAPI_EXPORT virtual std::string expressionError() = 0; /// Defines the used parameters - MODELAPI_EXPORT virtual - void setUsedParameters(const std::set& theUsedParameters) = 0; + MODELAPI_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters) = 0; /// Returns the used parameters MODELAPI_EXPORT virtual std::set usedParameters() const = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "Double"; - } + MODELAPI_EXPORT static std::string typeId() { return "Double"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -79,7 +77,7 @@ class ModelAPI_AttributeDouble : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeDouble(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeDouble(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp b/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp index a83d8ce12..8759d75a7 100644 --- a/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp +++ b/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp @@ -14,23 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeDoubleArray.h" //================================================================================================== -std::string ModelAPI_AttributeDoubleArray::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeDoubleArray::attributeType() { return typeId(); } //================================================================================================== -ModelAPI_AttributeDoubleArray::~ModelAPI_AttributeDoubleArray() -{ -} +ModelAPI_AttributeDoubleArray::~ModelAPI_AttributeDoubleArray() {} //================================================================================================== -ModelAPI_AttributeDoubleArray::ModelAPI_AttributeDoubleArray() -{ -} +ModelAPI_AttributeDoubleArray::ModelAPI_AttributeDoubleArray() {} diff --git a/src/ModelAPI/ModelAPI_AttributeDoubleArray.h b/src/ModelAPI/ModelAPI_AttributeDoubleArray.h index 136c326f1..de965308e 100644 --- a/src/ModelAPI/ModelAPI_AttributeDoubleArray.h +++ b/src/ModelAPI/ModelAPI_AttributeDoubleArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeDoubleArray_H_ @@ -27,9 +28,9 @@ /// \class ModelAPI_AttributeDoubleArray /// \ingroup DataModel -/// \brief API for the attribute that contains several double in the array inside. -class ModelAPI_AttributeDoubleArray: public ModelAPI_Attribute -{ +/// \brief API for the attribute that contains several double in the array +/// inside. +class ModelAPI_AttributeDoubleArray : public ModelAPI_Attribute { public: /// Returns the size of the array (zero means that it is empty) MODELAPI_EXPORT virtual int size() = 0; @@ -45,10 +46,7 @@ public: MODELAPI_EXPORT virtual double value(const int theIndex) = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "DoubleArray"; - } + MODELAPI_EXPORT static std::string typeId() { return "DoubleArray"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); diff --git a/src/ModelAPI/ModelAPI_AttributeImage.cpp b/src/ModelAPI/ModelAPI_AttributeImage.cpp index 6f508417b..ba4bb3d26 100644 --- a/src/ModelAPI/ModelAPI_AttributeImage.cpp +++ b/src/ModelAPI/ModelAPI_AttributeImage.cpp @@ -14,22 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include - -std::string ModelAPI_AttributeImage::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeImage::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeImage::~ModelAPI_AttributeImage() -{ -} +ModelAPI_AttributeImage::~ModelAPI_AttributeImage() {} -ModelAPI_AttributeImage::ModelAPI_AttributeImage() -{ -} +ModelAPI_AttributeImage::ModelAPI_AttributeImage() {} diff --git a/src/ModelAPI/ModelAPI_AttributeImage.h b/src/ModelAPI/ModelAPI_AttributeImage.h index 5e4d4e9d1..c21dfd070 100644 --- a/src/ModelAPI/ModelAPI_AttributeImage.h +++ b/src/ModelAPI/ModelAPI_AttributeImage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeImage_H_ @@ -23,9 +24,8 @@ #include #include -#include #include - +#include /**\class ModelAPI_AttributeImage * \ingroup DataModel @@ -33,33 +33,28 @@ * Used for images storage for an example. By default size is one, zero-based. */ -class ModelAPI_AttributeImage : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeImage : public ModelAPI_Attribute { +public: /// Defines the value of the image attribute - MODELAPI_EXPORT virtual void setTexture(const int theWidth, - const int theHeight, - const std::list& theByteArray, - const std::string& theFormat, - const bool sendUpdated = true) = 0; + MODELAPI_EXPORT virtual void + setTexture(const int theWidth, const int theHeight, + const std::list &theByteArray, + const std::string &theFormat, const bool sendUpdated = true) = 0; /// Returns true, if texture width and height are non-zero MODELAPI_EXPORT virtual bool hasTexture() = 0; /// Returns the value of the image attribute - MODELAPI_EXPORT virtual bool texture(int& theWidth, - int& theHeight, - std::list& theByteArray, - std::string& theFormat) = 0; + MODELAPI_EXPORT virtual bool texture(int &theWidth, int &theHeight, + std::list &theByteArray, + std::string &theFormat) = 0; /// Copy the image data to the destination attribute - virtual void copyTo(std::shared_ptr theTarget) const = 0; + virtual void + copyTo(std::shared_ptr theTarget) const = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "Image"; - } + MODELAPI_EXPORT static std::string typeId() { return "Image"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -67,7 +62,7 @@ class ModelAPI_AttributeImage : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeImage(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeImage(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeIntArray.cpp b/src/ModelAPI/ModelAPI_AttributeIntArray.cpp index 64d64897b..d81e16f7a 100644 --- a/src/ModelAPI/ModelAPI_AttributeIntArray.cpp +++ b/src/ModelAPI/ModelAPI_AttributeIntArray.cpp @@ -14,22 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include - -std::string ModelAPI_AttributeIntArray::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeIntArray::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeIntArray::~ModelAPI_AttributeIntArray() -{ -} +ModelAPI_AttributeIntArray::~ModelAPI_AttributeIntArray() {} -ModelAPI_AttributeIntArray::ModelAPI_AttributeIntArray() -{ -} +ModelAPI_AttributeIntArray::ModelAPI_AttributeIntArray() {} diff --git a/src/ModelAPI/ModelAPI_AttributeIntArray.h b/src/ModelAPI/ModelAPI_AttributeIntArray.h index baeaf3fec..e5b535520 100644 --- a/src/ModelAPI/ModelAPI_AttributeIntArray.h +++ b/src/ModelAPI/ModelAPI_AttributeIntArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeIntArray_H_ @@ -25,17 +26,15 @@ #include - /**\class ModelAPI_AttributeIntArray * \ingroup DataModel - * \brief API for the attribute that contains several integers in the array inside. - * Used for RGB color storage for an example. By default size is one, zero-based. + * \brief API for the attribute that contains several integers in the array + * inside. Used for RGB color storage for an example. By default size is one, + * zero-based. */ -class ModelAPI_AttributeIntArray : public ModelAPI_Attribute -{ - public: - +class ModelAPI_AttributeIntArray : public ModelAPI_Attribute { +public: /// Returns the size of the array (zero means that it is empty) MODELAPI_EXPORT virtual int size() = 0; @@ -44,18 +43,14 @@ class ModelAPI_AttributeIntArray : public ModelAPI_Attribute bool sendUpdated = true) = 0; /// Defines the value of the array by index [0; size-1] - MODELAPI_EXPORT virtual void setValue(const int theIndex, - const int theValue, + MODELAPI_EXPORT virtual void setValue(const int theIndex, const int theValue, bool sendUpdated = true) = 0; /// Returns the value by the index MODELAPI_EXPORT virtual int value(const int theIndex) = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "IntArray"; - } + MODELAPI_EXPORT static std::string typeId() { return "IntArray"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -63,7 +58,7 @@ class ModelAPI_AttributeIntArray : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeIntArray(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeIntArray(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeInteger.cpp b/src/ModelAPI/ModelAPI_AttributeInteger.cpp index 8cf0351eb..2ca07542c 100644 --- a/src/ModelAPI/ModelAPI_AttributeInteger.cpp +++ b/src/ModelAPI/ModelAPI_AttributeInteger.cpp @@ -14,22 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include - -std::string ModelAPI_AttributeInteger::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeInteger::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeInteger::~ModelAPI_AttributeInteger() -{ -} +ModelAPI_AttributeInteger::~ModelAPI_AttributeInteger() {} -ModelAPI_AttributeInteger::ModelAPI_AttributeInteger() -{ -} +ModelAPI_AttributeInteger::ModelAPI_AttributeInteger() {} diff --git a/src/ModelAPI/ModelAPI_AttributeInteger.h b/src/ModelAPI/ModelAPI_AttributeInteger.h index 15a0d3bf8..94e995f02 100644 --- a/src/ModelAPI/ModelAPI_AttributeInteger.h +++ b/src/ModelAPI/ModelAPI_AttributeInteger.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_ATTRIBUTEINTEGER_H_ @@ -30,9 +31,8 @@ * \brief API for the attribute that contains integer (int). */ -class ModelAPI_AttributeInteger : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeInteger : public ModelAPI_Attribute { +public: /// Defines the integer value MODELAPI_EXPORT virtual void setValue(const int theValue) = 0; @@ -43,7 +43,7 @@ class ModelAPI_AttributeInteger : public ModelAPI_Attribute MODELAPI_EXPORT virtual void setCalculatedValue(const int theValue) = 0; /// Defines the text value - MODELAPI_EXPORT virtual void setText(const std::wstring& theText) = 0; + MODELAPI_EXPORT virtual void setText(const std::wstring &theText) = 0; /// Returns the text value MODELAPI_EXPORT virtual std::wstring text() = 0; @@ -55,23 +55,21 @@ class ModelAPI_AttributeInteger : public ModelAPI_Attribute MODELAPI_EXPORT virtual bool expressionInvalid() = 0; /// Allows to set expression (text) error (by the parameters listener) - MODELAPI_EXPORT virtual void setExpressionError(const std::string& theError) = 0; + MODELAPI_EXPORT virtual void + setExpressionError(const std::string &theError) = 0; /// Returns an expression error MODELAPI_EXPORT virtual std::string expressionError() = 0; /// Defines the used parameters - MODELAPI_EXPORT virtual - void setUsedParameters(const std::set& theUsedParameters) = 0; + MODELAPI_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters) = 0; /// Returns the used parameters MODELAPI_EXPORT virtual std::set usedParameters() const = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "Integer"; - } + MODELAPI_EXPORT static std::string typeId() { return "Integer"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -79,7 +77,7 @@ class ModelAPI_AttributeInteger : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeInteger(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeInteger(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp b/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp index 8ab06a60b..471aa09cd 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp +++ b/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp @@ -14,21 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeRefAttr.h" +std::string ModelAPI_AttributeRefAttr::attributeType() { return typeId(); } -std::string ModelAPI_AttributeRefAttr::attributeType() -{ - return typeId(); -} +ModelAPI_AttributeRefAttr::~ModelAPI_AttributeRefAttr() {} -ModelAPI_AttributeRefAttr::~ModelAPI_AttributeRefAttr() -{ -} - -ModelAPI_AttributeRefAttr::ModelAPI_AttributeRefAttr() -{ -} +ModelAPI_AttributeRefAttr::ModelAPI_AttributeRefAttr() {} diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttr.h b/src/ModelAPI/ModelAPI_AttributeRefAttr.h index ed3a761bc..255291fe2 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttr.h +++ b/src/ModelAPI/ModelAPI_AttributeRefAttr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeRefAttr_H_ @@ -25,14 +26,14 @@ /**\class ModelAPI_AttributeRefAttr * \ingroup DataModel - * \brief Attribute that contains reference to an attribute of a feature or reference to - * a feature (switchable) + * \brief Attribute that contains reference to an attribute of a feature or + * reference to a feature (switchable) */ -class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute -{ - public: - /// Returns true if this attribute references to a object (not to the attribute) +class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute { +public: + /// Returns true if this attribute references to a object (not to the + /// attribute) MODELAPI_EXPORT virtual bool isObject() = 0; /// Defines the reference to the attribute @@ -48,10 +49,7 @@ class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute MODELAPI_EXPORT virtual ObjectPtr object() = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "RefAttr"; - } + MODELAPI_EXPORT static std::string typeId() { return "RefAttr"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -59,7 +57,7 @@ class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttr(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeRefAttr(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp b/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp index 8bc563a84..2385e4176 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp @@ -14,22 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeRefAttrList.h" -std::string ModelAPI_AttributeRefAttrList::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeRefAttrList::attributeType() { return typeId(); } -ModelAPI_AttributeRefAttrList::~ModelAPI_AttributeRefAttrList() -{ - -} - -ModelAPI_AttributeRefAttrList::ModelAPI_AttributeRefAttrList() -{ -} +ModelAPI_AttributeRefAttrList::~ModelAPI_AttributeRefAttrList() {} +ModelAPI_AttributeRefAttrList::ModelAPI_AttributeRefAttrList() {} diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttrList.h b/src/ModelAPI/ModelAPI_AttributeRefAttrList.h index b37971abb..cdfc68b53 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttrList.h +++ b/src/ModelAPI/ModelAPI_AttributeRefAttrList.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeRefAttrList_H_ @@ -26,18 +27,15 @@ /**\class ModelAPI_AttributeRefAttrList * \ingroup DataModel - * \brief Attribute that contains list of references to features (located in the same document) - * or references to attributes of the features (list of AttributeRefAttr) + * \brief Attribute that contains list of references to features (located in the + * same document) or references to attributes of the features (list of + * AttributeRefAttr) */ -class ModelAPI_AttributeRefAttrList : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeRefAttrList : public ModelAPI_Attribute { +public: /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "RefAttrList"; - } + MODELAPI_EXPORT static std::string typeId() { return "RefAttrList"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -58,13 +56,14 @@ class ModelAPI_AttributeRefAttrList : public ModelAPI_Attribute /// Returns number of features in the list virtual int size() const = 0; - /// Returns the list of features and attributes (if it is reference to the attribute) - virtual std::list > list() = 0; + /// Returns the list of features and attributes (if it is reference to the + /// attribute) + virtual std::list> list() = 0; /// Returns true if the object is in list - virtual bool isInList(const ObjectPtr& theObj) = 0; + virtual bool isInList(const ObjectPtr &theObj) = 0; /// Returns true if the attribute is in list - virtual bool isInList(const AttributePtr& theObj) = 0; + virtual bool isInList(const AttributePtr &theObj) = 0; /// Returns true if this is reference to an attribute, not just object virtual bool isAttribute(const int theIndex) const = 0; @@ -81,13 +80,13 @@ class ModelAPI_AttributeRefAttrList : public ModelAPI_Attribute /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - virtual void remove(const std::set& theIndices) = 0; + virtual void remove(const std::set &theIndices) = 0; MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttrList(); - protected: + +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeRefAttrList(); - }; typedef std::shared_ptr AttributeRefAttrListPtr; diff --git a/src/ModelAPI/ModelAPI_AttributeRefList.cpp b/src/ModelAPI/ModelAPI_AttributeRefList.cpp index 974363f1c..1b68a29f8 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeRefList.cpp @@ -14,22 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeRefList.h" -std::string ModelAPI_AttributeRefList::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeRefList::attributeType() { return typeId(); } -ModelAPI_AttributeRefList::~ModelAPI_AttributeRefList() -{ - -} - -ModelAPI_AttributeRefList::ModelAPI_AttributeRefList() -{ -} +ModelAPI_AttributeRefList::~ModelAPI_AttributeRefList() {} +ModelAPI_AttributeRefList::ModelAPI_AttributeRefList() {} diff --git a/src/ModelAPI/ModelAPI_AttributeRefList.h b/src/ModelAPI/ModelAPI_AttributeRefList.h index feaa7e1c1..e487e39ae 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefList.h +++ b/src/ModelAPI/ModelAPI_AttributeRefList.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeRefList_H_ @@ -26,17 +27,14 @@ /**\class ModelAPI_AttributeRefList * \ingroup DataModel - * \brief Attribute that contains list of references to features (located in the same document). + * \brief Attribute that contains list of references to features (located in the + * same document). */ -class ModelAPI_AttributeRefList : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeRefList : public ModelAPI_Attribute { +public: /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "RefList"; - } + MODELAPI_EXPORT static std::string typeId() { return "RefList"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -51,35 +49,40 @@ class ModelAPI_AttributeRefList : public ModelAPI_Attribute virtual void clear() = 0; /// Returns number of features in the list - ///\param theWithEmpty if it is false, returns the number of not-empty referenced objects + ///\param theWithEmpty if it is false, returns the number of not-empty + /// referenced objects virtual int size(const bool theWithEmpty = true) const = 0; /// Returns the list of features virtual std::list list() = 0; /// Returns true if the object is in list - virtual bool isInList(const ObjectPtr& theObj) = 0; + virtual bool isInList(const ObjectPtr &theObj) = 0; /// Returns the referenced object by the zero-based index ///\param theIndex zero-based index in the list - ///\param theWithEmpty if it is false, counts the not-empty referenced objects only - virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) = 0; + ///\param theWithEmpty if it is false, counts the not-empty referenced objects + /// only + virtual ObjectPtr object(const int theIndex, + const bool theWithEmpty = true) = 0; - /// Substitutes the object by another one. Does nothing if such object is not found. - virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew) = 0; + /// Substitutes the object by another one. Does nothing if such object is not + /// found. + virtual void substitute(const ObjectPtr &theCurrent, + const ObjectPtr &theNew) = 0; /// Removes the last element in the list. virtual void removeLast() = 0; /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - virtual void remove(const std::set& theIndices) = 0; + virtual void remove(const std::set &theIndices) = 0; MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefList(); - protected: + +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeRefList(); - }; typedef std::shared_ptr AttributeRefListPtr; diff --git a/src/ModelAPI/ModelAPI_AttributeReference.cpp b/src/ModelAPI/ModelAPI_AttributeReference.cpp index d0e6c8ed8..409b53347 100644 --- a/src/ModelAPI/ModelAPI_AttributeReference.cpp +++ b/src/ModelAPI/ModelAPI_AttributeReference.cpp @@ -14,20 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeReference.h" -std::string ModelAPI_AttributeReference::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeReference::attributeType() { return typeId(); } -ModelAPI_AttributeReference::~ModelAPI_AttributeReference() -{ -} +ModelAPI_AttributeReference::~ModelAPI_AttributeReference() {} -ModelAPI_AttributeReference::ModelAPI_AttributeReference() -{ -} +ModelAPI_AttributeReference::ModelAPI_AttributeReference() {} diff --git a/src/ModelAPI/ModelAPI_AttributeReference.h b/src/ModelAPI/ModelAPI_AttributeReference.h index f872c772e..126f160f2 100644 --- a/src/ModelAPI/ModelAPI_AttributeReference.h +++ b/src/ModelAPI/ModelAPI_AttributeReference.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeReference_H_ @@ -25,12 +26,12 @@ /**\class ModelAPI_AttributeReference * \ingroup DataModel - * \brief Attribute that contains reference to feature (located in the same document). + * \brief Attribute that contains reference to feature (located in the same + * document). */ -class ModelAPI_AttributeReference : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeReference : public ModelAPI_Attribute { +public: /// Defines the object referenced from this attribute MODELAPI_EXPORT virtual void setValue(ObjectPtr theObject) = 0; @@ -38,10 +39,7 @@ class ModelAPI_AttributeReference : public ModelAPI_Attribute MODELAPI_EXPORT virtual ObjectPtr value() = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "Reference"; - } + MODELAPI_EXPORT static std::string typeId() { return "Reference"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -49,7 +47,7 @@ class ModelAPI_AttributeReference : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeReference(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeReference(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeSelection.cpp b/src/ModelAPI/ModelAPI_AttributeSelection.cpp index 97d8418a9..a2ad8d951 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelection.cpp +++ b/src/ModelAPI/ModelAPI_AttributeSelection.cpp @@ -14,21 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeSelection.h" +std::string ModelAPI_AttributeSelection::attributeType() { return typeId(); } -std::string ModelAPI_AttributeSelection::attributeType() -{ - return typeId(); -} +ModelAPI_AttributeSelection::~ModelAPI_AttributeSelection() {} -ModelAPI_AttributeSelection::~ModelAPI_AttributeSelection() -{ -} - -ModelAPI_AttributeSelection::ModelAPI_AttributeSelection() -{ -} +ModelAPI_AttributeSelection::ModelAPI_AttributeSelection() {} diff --git a/src/ModelAPI/ModelAPI_AttributeSelection.h b/src/ModelAPI/ModelAPI_AttributeSelection.h index 9a0c58d67..5d6b0aeb4 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelection.h +++ b/src/ModelAPI/ModelAPI_AttributeSelection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeSelection_H_ @@ -28,40 +29,42 @@ class GeomAPI_Pnt; /**\class ModelAPI_AttributeSelection * \ingroup DataModel - * \brief Attribute that contains reference to the sub-shape of some result, the selected shape. + * \brief Attribute that contains reference to the sub-shape of some result, the + * selected shape. */ -class ModelAPI_AttributeSelection : public ModelAPI_Attribute -{ - public: - /// Type of the center of the circular of elliptic edge - enum CenterType { - NOT_CENTER, ///< this is not a center - CIRCLE_CENTER, ///< center of the circle - ELLIPSE_FIRST_FOCUS, ///< first focus point of the ellipse - ELLIPSE_SECOND_FOCUS, ///< second focus point of the ellipse - }; +class ModelAPI_AttributeSelection : public ModelAPI_Attribute { +public: + /// Type of the center of the circular of elliptic edge + enum CenterType { + NOT_CENTER, ///< this is not a center + CIRCLE_CENTER, ///< center of the circle + ELLIPSE_FIRST_FOCUS, ///< first focus point of the ellipse + ELLIPSE_SECOND_FOCUS, ///< second focus point of the ellipse + }; /// Defines the result and its selected sub-shape /// \param theContext object where the sub-shape was selected - /// \param theSubShape selected sub-shape (if null, the whole context is selected) - /// \param theTemporarily if it is true, do not store and name the added in the data framework + /// \param theSubShape selected sub-shape (if null, the whole context is + /// selected) \param theTemporarily if it is true, do not store and name the + /// added in the data framework /// (used to remove immediately, without the following updates) /// \returns true if attribute was updated - virtual bool setValue( - const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily = false) = 0; + virtual bool setValue(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false) = 0; /// Same as SetValue, but it takes an edge (on circular or elliptic curve) - /// and stores the vertex of the central point (for ellipse the first or the second focus point) - virtual void setValueCenter( - const ObjectPtr& theContext, const std::shared_ptr& theEdge, - const CenterType theCenterType, - const bool theTemporarily = false) = 0; + /// and stores the vertex of the central point (for ellipse the first or the + /// second focus point) + virtual void setValueCenter(const ObjectPtr &theContext, + const std::shared_ptr &theEdge, + const CenterType theCenterType, + const bool theTemporarily = false) = 0; /// Makes this selection attribute selects the same as in theSource selection virtual void selectValue( - const std::shared_ptr& theSource) = 0; + const std::shared_ptr &theSource) = 0; /// Reset temporary stored values virtual void removeTemporaryValues() = 0; @@ -82,31 +85,32 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute virtual bool update() = 0; /// Returns the type of this class of attributes - static std::string typeId() - { - return "Selection"; - } + static std::string typeId() { return "Selection"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); /// Returns a textual string of the selection - /// \param theDefaultValue a value, which is used if the naming name can not be obtained - virtual std::wstring namingName(const std::wstring& theDefaultValue = L"") = 0; + /// \param theDefaultValue a value, which is used if the naming name can not + /// be obtained + virtual std::wstring + namingName(const std::wstring &theDefaultValue = L"") = 0; /// Defines an id of the selection virtual void setId(int theID) = 0; /// Selects sub-shape by the textual Name - virtual void selectSubShape(const std::string& theType, const std::wstring& theSubShapeName) = 0; + virtual void selectSubShape(const std::string &theType, + const std::wstring &theSubShapeName) = 0; /// Selects sub-shape by its inner point - virtual void selectSubShape(const std::string& theType, - const std::shared_ptr& thePoint) = 0; + virtual void selectSubShape(const std::string &theType, + const std::shared_ptr &thePoint) = 0; /// Selects sub-shape by weak naming index - virtual void selectSubShape(const std::string& theType, - const std::wstring& theContextName, const int theIndex) = 0; + virtual void selectSubShape(const std::string &theType, + const std::wstring &theContextName, + const int theIndex) = 0; /// Returns true if recompute of selection become impossible virtual bool isInvalid() = 0; @@ -117,18 +121,21 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection(); - /// Returns the name by context. Adds the part name if the context is located in other document - MODELAPI_EXPORT virtual std::wstring contextName(const ResultPtr& theContext) const = 0; + /// Returns the name by context. Adds the part name if the context is located + /// in other document + MODELAPI_EXPORT virtual std::wstring + contextName(const ResultPtr &theContext) const = 0; - /// Makes the current local selection becomes all sub-shapes with same base geometry. + /// Makes the current local selection becomes all sub-shapes with same base + /// geometry. MODELAPI_EXPORT virtual void combineGeometrical() = 0; /// Updates the arguments of selection if something was affected by creation /// or reorder of features upper in the history line. /// Returns theRemove true if this attribute must be removed (become deleted) - MODELAPI_EXPORT virtual void updateInHistory(bool& theRemove) = 0; + MODELAPI_EXPORT virtual void updateInHistory(bool &theRemove) = 0; - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeSelection(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp b/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp index 320a59be8..c52dfc3c4 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp @@ -14,16 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeSelectionList.h" -std::string ModelAPI_AttributeSelectionList::attributeType() -{ +std::string ModelAPI_AttributeSelectionList::attributeType() { return typeId(); } -ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() -{ -} +ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() {} diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.h b/src/ModelAPI/ModelAPI_AttributeSelectionList.h index 80ee75f46..9d43979c1 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.h +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeSelectionList_H_ #define ModelAPI_AttributeSelectionList_H_ #include "ModelAPI_AttributeSelection.h" -#include #include +#include class GeomAPI_Pnt; class GeomAPI_Shape; @@ -33,39 +34,45 @@ class GeomAPI_Shape; * possibility to manage them. */ -class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute -{ - /// Flag that indicates that the whole result selection is allowed while the selection type - /// may be sub-objects, so, it is the same as all sub-shapes are selected (#3005). It is "false" - /// by default. +class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute { + /// Flag that indicates that the whole result selection is allowed while the + /// selection type may be sub-objects, so, it is the same as all sub-shapes + /// are selected (#3005). It is "false" by default. bool myIsWholeResultAllowed; /// Flag that indicates that update in history must check the copy-features /// and make a copy of selection for them. bool myMakeCopy; + public: /// Adds the new reference to the end of the list /// \param theContext object where the sub-shape was selected - /// \param theSubShape selected sub-shape (if null, the whole context is selected) - /// \param theTemporarily if it is true, do not store and name the added in the data framework + /// \param theSubShape selected sub-shape (if null, the whole context is + /// selected) \param theTemporarily if it is true, do not store and name the + /// added in the data framework /// (used to remove immediately, without the following updates) - virtual void append(const ObjectPtr& theContext, - const std::shared_ptr& theSubShape, + virtual void append(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, const bool theTemporarily = false) = 0; - /// Adds the new reference to the end of the list by the naming name of the selected shape - /// The type of shape is taken from the current selection type if the given is empty - virtual void append(const std::wstring& theNamingName, const std::string& theType = "") = 0; + /// Adds the new reference to the end of the list by the naming name of the + /// selected shape The type of shape is taken from the current selection type + /// if the given is empty + virtual void append(const std::wstring &theNamingName, + const std::string &theType = "") = 0; - /// Adds the new reference to the end of the list by inner point on the selected shape - virtual void append(const std::shared_ptr& thePoint, - const std::string& theType) = 0; + /// Adds the new reference to the end of the list by inner point on the + /// selected shape + virtual void append(const std::shared_ptr &thePoint, + const std::string &theType) = 0; /// Adds the new reference to the end of the list by weak naming index - virtual void append(const std::string& theType, const std::wstring& theContextName, + virtual void append(const std::string &theType, + const std::wstring &theContextName, const int theIndex) = 0; /// Copy the selection list to the destination attribute - virtual void copyTo(std::shared_ptr theTarget) const = 0; + virtual void + copyTo(std::shared_ptr theTarget) const = 0; /// Reset temporary stored values virtual void removeTemporaryValues() = 0; @@ -75,19 +82,19 @@ public: /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - virtual void remove(const std::set& theIndices) = 0; + virtual void remove(const std::set &theIndices) = 0; /// Returns the number of selection attributes in the list virtual int size() = 0; /// Returns true if the object with the shape are in list /// \param theContext object where the sub-shape was selected - /// \param theSubShape selected sub-shape (if null, the whole context is selected) - /// \param theTemporarily if it is true, it checks also the temporary added item - /// \returns true if the pair is found in the attribute - virtual bool isInList( - const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily = false) = 0; + /// \param theSubShape selected sub-shape (if null, the whole context is + /// selected) \param theTemporarily if it is true, it checks also the + /// temporary added item \returns true if the pair is found in the attribute + virtual bool isInList(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false) = 0; /// The type of all elements selection /// \returns the index of the enumeration of the type of shape @@ -95,29 +102,29 @@ public: /// Sets the type of all elements selection /// \param theType the index of the enumeration of the type of shape - virtual void setSelectionType(const std::string& theType) = 0; + virtual void setSelectionType(const std::string &theType) = 0; /// Returns the attribute selection by the index (zero based) - virtual std::shared_ptr value(const int theIndex) = 0; + virtual std::shared_ptr + value(const int theIndex) = 0; /// Removes all attributes of the list. virtual void clear() = 0; - /// Starts or stops cashing of the values in the attribute (the cash may become invalid - /// on modification of the attribute or sub-elements, so the cash must be enabled only - /// during non-modification operations with this attribute) + /// Starts or stops cashing of the values in the attribute (the cash may + /// become invalid on modification of the attribute or sub-elements, so the + /// cash must be enabled only during non-modification operations with this + /// attribute) virtual void cashValues(const bool theEnabled) = 0; - virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0; + virtual void + setGeometricalSelection(const bool theIsGeometricalSelection) = 0; /// Returns true if is geometrical selection. virtual bool isGeometricalSelection() const = 0; /// Returns the type of this class of attributes - static std::string typeId() - { - return "SelectionList"; - } + static std::string typeId() { return "SelectionList"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -125,40 +132,43 @@ public: /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelectionList(); - /// Returns a selection filters feature if it is defined for this selection list + /// Returns a selection filters feature if it is defined for this selection + /// list MODELAPI_EXPORT virtual FiltersFeaturePtr filters() const = 0; /// Sets a selection filters feature if it is defined for this selection list MODELAPI_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature) = 0; - /// Returns true if the whole result selection corresponds to selection of all sub-shapes. + /// Returns true if the whole result selection corresponds to selection of all + /// sub-shapes. MODELAPI_EXPORT virtual const bool isWholeResultAllowed() const { return myIsWholeResultAllowed; } - /// Sets whether the whole result selection corresponds to selection of all sub-shapes. - MODELAPI_EXPORT virtual void setWholeResultAllowed(const bool theFlag) { + /// Sets whether the whole result selection corresponds to selection of all + /// sub-shapes. + MODELAPI_EXPORT virtual void setWholeResultAllowed(const bool theFlag) { myIsWholeResultAllowed = theFlag; } /// Returns true if a copy features must be used in update in history. - MODELAPI_EXPORT virtual const bool isMakeCopy() const { - return myMakeCopy; - } + MODELAPI_EXPORT virtual const bool isMakeCopy() const { return myMakeCopy; } /// Sets true if a copy features must be used in update in history. - MODELAPI_EXPORT virtual void setMakeCopy(const bool theFlag) { + MODELAPI_EXPORT virtual void setMakeCopy(const bool theFlag) { myMakeCopy = theFlag; } protected: /// Default constructor - MODELAPI_EXPORT ModelAPI_AttributeSelectionList() : ModelAPI_Attribute() - {myIsWholeResultAllowed = false; myMakeCopy = false;} - + MODELAPI_EXPORT ModelAPI_AttributeSelectionList() : ModelAPI_Attribute() { + myIsWholeResultAllowed = false; + myMakeCopy = false; + } }; //! Pointer on double attribute -typedef std::shared_ptr AttributeSelectionListPtr; +typedef std::shared_ptr + AttributeSelectionListPtr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeString.cpp b/src/ModelAPI/ModelAPI_AttributeString.cpp index c265db81d..163c464c8 100644 --- a/src/ModelAPI/ModelAPI_AttributeString.cpp +++ b/src/ModelAPI/ModelAPI_AttributeString.cpp @@ -14,20 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeString.h" -std::string ModelAPI_AttributeString::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeString::attributeType() { return typeId(); } -ModelAPI_AttributeString::~ModelAPI_AttributeString() -{ -} +ModelAPI_AttributeString::~ModelAPI_AttributeString() {} -ModelAPI_AttributeString::ModelAPI_AttributeString() -{ -} +ModelAPI_AttributeString::ModelAPI_AttributeString() {} diff --git a/src/ModelAPI/ModelAPI_AttributeString.h b/src/ModelAPI/ModelAPI_AttributeString.h index 1b6f65de8..bfda520e0 100644 --- a/src/ModelAPI/ModelAPI_AttributeString.h +++ b/src/ModelAPI/ModelAPI_AttributeString.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_ATTRIBUTESTRING_H_ @@ -29,25 +30,21 @@ * \brief API for the attribute that contains std (null terminated) string. */ -class ModelAPI_AttributeString : public ModelAPI_Attribute -{ - public: +class ModelAPI_AttributeString : public ModelAPI_Attribute { +public: /// Defines the string value - MODELAPI_EXPORT virtual void setValue(const std::string& theValue) = 0; + MODELAPI_EXPORT virtual void setValue(const std::string &theValue) = 0; /// Defines the wstring value - MODELAPI_EXPORT virtual void setValue(const std::wstring& theValue) = 0; + MODELAPI_EXPORT virtual void setValue(const std::wstring &theValue) = 0; /// Returns the string value MODELAPI_EXPORT virtual std::string value() = 0; /// Returns a pointer to Unicode string - MODELAPI_EXPORT virtual char16_t* valueU() = 0; + MODELAPI_EXPORT virtual char16_t *valueU() = 0; MODELAPI_EXPORT virtual bool isUValue() const = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "String"; - } + MODELAPI_EXPORT static std::string typeId() { return "String"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); @@ -55,7 +52,7 @@ class ModelAPI_AttributeString : public ModelAPI_Attribute /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeString(); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeString(); }; diff --git a/src/ModelAPI/ModelAPI_AttributeStringArray.cpp b/src/ModelAPI/ModelAPI_AttributeStringArray.cpp index 54fed4e2b..cb5bbb62d 100644 --- a/src/ModelAPI/ModelAPI_AttributeStringArray.cpp +++ b/src/ModelAPI/ModelAPI_AttributeStringArray.cpp @@ -14,23 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeStringArray.h" //================================================================================================== -std::string ModelAPI_AttributeStringArray::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeStringArray::attributeType() { return typeId(); } //================================================================================================== -ModelAPI_AttributeStringArray::~ModelAPI_AttributeStringArray() -{ -} +ModelAPI_AttributeStringArray::~ModelAPI_AttributeStringArray() {} //================================================================================================== -ModelAPI_AttributeStringArray::ModelAPI_AttributeStringArray() -{ -} +ModelAPI_AttributeStringArray::ModelAPI_AttributeStringArray() {} diff --git a/src/ModelAPI/ModelAPI_AttributeStringArray.h b/src/ModelAPI/ModelAPI_AttributeStringArray.h index f8f7c2093..8e580c28a 100644 --- a/src/ModelAPI/ModelAPI_AttributeStringArray.h +++ b/src/ModelAPI/ModelAPI_AttributeStringArray.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeStringArray_H_ @@ -27,9 +28,9 @@ /// \class ModelAPI_AttributeStringArray /// \ingroup DataModel -/// \brief API for the attribute that contains several strings in the array inside. -class ModelAPI_AttributeStringArray: public ModelAPI_Attribute -{ +/// \brief API for the attribute that contains several strings in the array +/// inside. +class ModelAPI_AttributeStringArray : public ModelAPI_Attribute { public: /// Returns the size of the array (zero means that it is empty) MODELAPI_EXPORT virtual int size() = 0; @@ -45,10 +46,7 @@ public: MODELAPI_EXPORT virtual std::string value(const int theIndex) = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "StringArray"; - } + MODELAPI_EXPORT static std::string typeId() { return "StringArray"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); diff --git a/src/ModelAPI/ModelAPI_AttributeTables.cpp b/src/ModelAPI/ModelAPI_AttributeTables.cpp index beccd2f9d..39ea4c6ab 100644 --- a/src/ModelAPI/ModelAPI_AttributeTables.cpp +++ b/src/ModelAPI/ModelAPI_AttributeTables.cpp @@ -14,23 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_AttributeTables.h" //================================================================================================== -std::string ModelAPI_AttributeTables::attributeType() -{ - return typeId(); -} +std::string ModelAPI_AttributeTables::attributeType() { return typeId(); } //================================================================================================== -ModelAPI_AttributeTables::~ModelAPI_AttributeTables() -{ -} +ModelAPI_AttributeTables::~ModelAPI_AttributeTables() {} //================================================================================================== -ModelAPI_AttributeTables::ModelAPI_AttributeTables() -{ -} +ModelAPI_AttributeTables::ModelAPI_AttributeTables() {} diff --git a/src/ModelAPI/ModelAPI_AttributeTables.h b/src/ModelAPI/ModelAPI_AttributeTables.h index fcc16e4ba..b196ca0f9 100644 --- a/src/ModelAPI/ModelAPI_AttributeTables.h +++ b/src/ModelAPI/ModelAPI_AttributeTables.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeTables_H_ @@ -29,22 +30,17 @@ /// \ingroup DataModel /// \brief API for the attribute that contains tables of some values type. /// -/// The type of values can be changed. But all the values in the tables must have the same one -/// type. The currently allowed types now are: Boolean, Integer, Double, String. -/// By default there is only one table, but it may be increased/decreased by adding/removing -/// tables one by one. -/// The number of rows and columns are equal in all tables. If table, row or column is added, -/// the previous values are kept unchanged. New cells are filled by zero, false or empty strings. -class ModelAPI_AttributeTables: public ModelAPI_Attribute -{ +/// The type of values can be changed. But all the values in the tables must +/// have the same one type. The currently allowed types now are: Boolean, +/// Integer, Double, String. By default there is only one table, but it may be +/// increased/decreased by adding/removing tables one by one. The number of rows +/// and columns are equal in all tables. If table, row or column is added, the +/// previous values are kept unchanged. New cells are filled by zero, false or +/// empty strings. +class ModelAPI_AttributeTables : public ModelAPI_Attribute { public: /// Type of the value in the table - enum ValueType { - BOOLEAN, - INTEGER, - DOUBLE, - STRING - }; + enum ValueType { BOOLEAN, INTEGER, DOUBLE, STRING }; struct Value { bool myBool; @@ -60,31 +56,32 @@ public: /// Returns the number of tables MODELAPI_EXPORT virtual int tables() = 0; - /// Sets the new size of the tables set. This method tries to keep old values if number of - /// rows, columns or tables is increased. - MODELAPI_EXPORT virtual void setSize( - const int theRows, const int theColumns, const int theTables = 1) = 0; + /// Sets the new size of the tables set. This method tries to keep old values + /// if number of rows, columns or tables is increased. + MODELAPI_EXPORT virtual void setSize(const int theRows, const int theColumns, + const int theTables = 1) = 0; - /// Defines the tyoe of values in the table. If it differs from the current, erases the content. + /// Defines the tyoe of values in the table. If it differs from the current, + /// erases the content. MODELAPI_EXPORT virtual void setType(ValueType theType) = 0; - /// Defines the tyoe of values in the table. If it differs from the current, erases the content. - MODELAPI_EXPORT virtual const ValueType& type() const = 0; + /// Defines the tyoe of values in the table. If it differs from the current, + /// erases the content. + MODELAPI_EXPORT virtual const ValueType &type() const = 0; /// Defines the value by the index in the tables set (indexes are zero-based). - MODELAPI_EXPORT virtual void setValue( - const Value theValue, const int theRow, const int theColumn, const int theTable = 0) = 0; + MODELAPI_EXPORT virtual void setValue(const Value theValue, const int theRow, + const int theColumn, + const int theTable = 0) = 0; /// Returns the value by the index (indexes are zero-based). - MODELAPI_EXPORT virtual Value value( - const int theRow, const int theColumn, const int theTable = 0) = 0; + MODELAPI_EXPORT virtual Value value(const int theRow, const int theColumn, + const int theTable = 0) = 0; - /// Returns the value in the format of string (usefull for the python connection) - MODELAPI_EXPORT virtual std::string valueStr( - const int theRow, const int theColumn, const int theTable = 0) = 0; + /// Returns the value in the format of string (usefull for the python + /// connection) + MODELAPI_EXPORT virtual std::string + valueStr(const int theRow, const int theColumn, const int theTable = 0) = 0; /// Returns the type of this class of attributes - MODELAPI_EXPORT static std::string typeId() - { - return "Tables"; - } + MODELAPI_EXPORT static std::string typeId() { return "Tables"; } /// Returns the type of this class of attributes, not static method MODELAPI_EXPORT virtual std::string attributeType(); /// To virtually destroy the fields of successors diff --git a/src/ModelAPI/ModelAPI_AttributeValidator.cpp b/src/ModelAPI/ModelAPI_AttributeValidator.cpp index 33547f5f1..2517dc826 100644 --- a/src/ModelAPI/ModelAPI_AttributeValidator.cpp +++ b/src/ModelAPI/ModelAPI_AttributeValidator.cpp @@ -14,12 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -ModelAPI_AttributeValidator::~ModelAPI_AttributeValidator() -{ - -} +ModelAPI_AttributeValidator::~ModelAPI_AttributeValidator() {} diff --git a/src/ModelAPI/ModelAPI_AttributeValidator.h b/src/ModelAPI/ModelAPI_AttributeValidator.h index 9eddf0959..73c51d4f4 100644 --- a/src/ModelAPI/ModelAPI_AttributeValidator.h +++ b/src/ModelAPI/ModelAPI_AttributeValidator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_AttributeValidator_H @@ -27,16 +28,15 @@ /** * Generic validator for any attribute of a feature. */ -class ModelAPI_AttributeValidator : public ModelAPI_Validator -{ +class ModelAPI_AttributeValidator : public ModelAPI_Validator { public: //! \returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError the error string message if validation fails - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const = 0; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const = 0; MODELAPI_EXPORT ~ModelAPI_AttributeValidator(); }; diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.cpp b/src/ModelAPI/ModelAPI_BodyBuilder.cpp index c3517cc84..7751a8cd1 100644 --- a/src/ModelAPI/ModelAPI_BodyBuilder.cpp +++ b/src/ModelAPI/ModelAPI_BodyBuilder.cpp @@ -14,23 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_BodyBuilder.h" #include "ModelAPI_Object.h" -ModelAPI_BodyBuilder::ModelAPI_BodyBuilder(ModelAPI_Object* theOwner) -: myOwner(theOwner) -{ -} +ModelAPI_BodyBuilder::ModelAPI_BodyBuilder(ModelAPI_Object *theOwner) + : myOwner(theOwner) {} -std::shared_ptr ModelAPI_BodyBuilder::data() const -{ +std::shared_ptr ModelAPI_BodyBuilder::data() const { return myOwner->data(); } -std::shared_ptr ModelAPI_BodyBuilder::document() const -{ +std::shared_ptr ModelAPI_BodyBuilder::document() const { return myOwner->document(); } diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index 05b2f68a4..afa7463e6 100644 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_BodyBuilder_H_ #define ModelAPI_BodyBuilder_H_ -#include +#include #include #include -#include +#include #include #include @@ -32,80 +33,89 @@ class ModelAPI_Document; class ModelAPI_Object; /**\class ModelAPI_BodyBuilder -* \ingroup DataModel + * \ingroup DataModel * \brief Extra API for the ResultBody that allows to work with naming. -*/ -class ModelAPI_BodyBuilder -{ + */ +class ModelAPI_BodyBuilder { public: - MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {}; + MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder(){}; /// Stores the shape (called by the execution method). - virtual void store(const GeomShapePtr& theShape, + virtual void store(const GeomShapePtr &theShape, const bool theIsStoreSameShapes = true) = 0; /// Stores the generated shape (called by the execution method). - virtual void storeGenerated(const GeomShapePtr& theFromShape, - const GeomShapePtr& theToShape, + virtual void storeGenerated(const GeomShapePtr &theFromShape, + const GeomShapePtr &theToShape, const bool theIsCleanStored = true) = 0; /// Stores the root generated shapes (called by the execution method). - virtual void storeGenerated(const std::list& theFromShapes, - const GeomShapePtr& theToShape, const std::shared_ptr theMakeShape) = 0; + virtual void + storeGenerated(const std::list &theFromShapes, + const GeomShapePtr &theToShape, + const std::shared_ptr theMakeShape) = 0; /// Stores the modified shape (called by the execution method). - virtual void storeModified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, + virtual void storeModified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, const bool theIsCleanStored = true) = 0; /// Stores the root modified shapes (called by the execution method). - virtual void storeModified(const std::list& theOldShapes, - const GeomShapePtr& theNewShape, const std::shared_ptr theMakeShape)=0; + virtual void + storeModified(const std::list &theOldShapes, + const GeomShapePtr &theNewShape, + const std::shared_ptr theMakeShape) = 0; /// Returns the shape-result produced by this feature virtual GeomShapePtr shape() = 0; - /// Records the subshape newShape which was generated during a topological construction. - /// As an example, consider the case of a face generated in construction of a box. - /// Returns true if it is stored correctly (the final shape contains this new sub-shape) - virtual bool generated(const GeomShapePtr& theNewShape, - const std::string& theName, const bool theCheckIsInResult = true) = 0; - - /// Records the shape newShape which was generated from the shape oldShape during a topological - /// construction. As an example, consider the case of a face generated from an edge in - /// construction of a prism. - virtual void generated(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName = "") = 0; + /// Records the subshape newShape which was generated during a topological + /// construction. As an example, consider the case of a face generated in + /// construction of a box. Returns true if it is stored correctly (the final + /// shape contains this new sub-shape) + virtual bool generated(const GeomShapePtr &theNewShape, + const std::string &theName, + const bool theCheckIsInResult = true) = 0; + + /// Records the shape newShape which was generated from the shape oldShape + /// during a topological construction. As an example, consider the case of a + /// face generated from an edge in construction of a prism. + virtual void generated(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = "") = 0; /// Records the shape newShape which is a modification of the shape oldShape. - /// As an example, consider the case of a face split or merged in a Boolean operation. - virtual void modified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName = "") = 0; + /// As an example, consider the case of a face split or merged in a Boolean + /// operation. + virtual void modified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = "") = 0; /// load deleted shapes - virtual void loadDeletedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const GeomShapePtr& theShapesToAvoid = GeomShapePtr()) = 0; + virtual void + loadDeletedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const GeomShapePtr &theShapesToAvoid = GeomShapePtr()) = 0; /// load and orient modified shapes - virtual void loadModifiedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "") = 0; + virtual void + loadModifiedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "") = 0; /// load and orient generated shapes - virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "", - const bool theSaveOldIfNotInTree = false) = 0; + virtual void + loadGeneratedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "", + const bool theSaveOldIfNotInTree = false) = 0; /// load shapes of the first level (to be used during shape import) virtual void loadFirstLevel(GeomShapePtr theShape, - const std::string& theName) = 0; + const std::string &theName) = 0; /// Cleans cash related to the already stored elements MODELAPI_EXPORT virtual void cleanCash() = 0; @@ -119,9 +129,9 @@ protected: protected: /// Default constructor accessible only from Model_Object - MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner); + MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object *theOwner); - ModelAPI_Object* myOwner; ///< the owner object this builder belongs to + ModelAPI_Object *myOwner; ///< the owner object this builder belongs to }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.cpp b/src/ModelAPI/ModelAPI_CompositeFeature.cpp index c948e9e85..9b8e8aa37 100644 --- a/src/ModelAPI/ModelAPI_CompositeFeature.cpp +++ b/src/ModelAPI/ModelAPI_CompositeFeature.cpp @@ -14,24 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() -{ +ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() {} -} - -void ModelAPI_CompositeFeature::erase() -{ +void ModelAPI_CompositeFeature::erase() { // erase all sub-features if (data()->isValid()) { - for(int a = numberOfSubs(); a > 0; a--) { + for (int a = numberOfSubs(); a > 0; a--) { FeaturePtr aFeature = subFeature(a - 1); if (aFeature.get()) { - // subs are referenced from sketch, but must be removed for sure, so not checkings + // subs are referenced from sketch, but must be removed for sure, so not + // checkings aFeature->document()->removeFeature(aFeature); } } diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.h b/src/ModelAPI/ModelAPI_CompositeFeature.h index c10f497e1..b8113b10e 100644 --- a/src/ModelAPI/ModelAPI_CompositeFeature.h +++ b/src/ModelAPI/ModelAPI_CompositeFeature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_COMPOSITEFEATURE_H_ @@ -29,8 +30,7 @@ * with edges inside. It just allows to add a feature to this feature only * instead of adding in both document and this feature. */ -class ModelAPI_CompositeFeature : public ModelAPI_Feature -{ +class ModelAPI_CompositeFeature : public ModelAPI_Feature { public: MODELAPI_EXPORT virtual ~ModelAPI_CompositeFeature(); @@ -41,17 +41,19 @@ public: virtual int numberOfSubs(bool forTree = false) const = 0; /// Returns the sub-feature by zero-base index - virtual std::shared_ptr subFeature(const int theIndex, - bool forTree = false) = 0; + virtual std::shared_ptr + subFeature(const int theIndex, bool forTree = false) = 0; - /// Returns the sub-feature unique identifier in this composite feature by zero-base index + /// Returns the sub-feature unique identifier in this composite feature by + /// zero-base index virtual int subFeatureId(const int theIndex) const = 0; /// Returns true if feature or result belong to this composite feature as subs virtual bool isSub(ObjectPtr theObject) const = 0; - /// This method to inform that sub-feature is removed and must be removed from the internal data - /// structures of the owner (the remove from the document will be done outside just after) + /// This method to inform that sub-feature is removed and must be removed from + /// the internal data structures of the owner (the remove from the document + /// will be done outside just after) virtual void removeFeature(std::shared_ptr theFeature) = 0; /// in addition removes all subs diff --git a/src/ModelAPI/ModelAPI_Data.cpp b/src/ModelAPI/ModelAPI_Data.cpp index a398ad839..b766fa491 100644 --- a/src/ModelAPI/ModelAPI_Data.cpp +++ b/src/ModelAPI/ModelAPI_Data.cpp @@ -14,15 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -ModelAPI_Data::~ModelAPI_Data() -{ -} +ModelAPI_Data::~ModelAPI_Data() {} -ModelAPI_Data::ModelAPI_Data() -{ -} +ModelAPI_Data::ModelAPI_Data() {} diff --git a/src/ModelAPI/ModelAPI_Data.h b/src/ModelAPI/ModelAPI_Data.h index 148ecaa17..7e5809f1a 100644 --- a/src/ModelAPI/ModelAPI_Data.h +++ b/src/ModelAPI/ModelAPI_Data.h @@ -14,21 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Data_H_ #define ModelAPI_Data_H_ #ifdef _WINDOWS // to avoid too long decorated name warning -#pragma warning( disable : 4503 ) +#pragma warning(disable : 4503) #endif #include "ModelAPI.h" -#include #include -#include #include +#include +#include class ModelAPI_Attribute; class ModelAPI_AttributeDocRef; @@ -56,10 +57,14 @@ class GeomAPI_Shape; /// Enumeration that contains the execution status of the Object enum ModelAPI_ExecState { ModelAPI_StateDone, ///< execution was performed and result is up to date - ModelAPI_StateMustBeUpdated, ///< execution must be performed to obtain the up to date result - ModelAPI_StateExecFailed, ///< execution was failed (results are deleted in this case) - ModelAPI_StateInvalidArgument, ///< execution was not performed (results are deleted in this case) - ModelAPI_StateNothing ///< internal state that actually means that nothing must be changed + ModelAPI_StateMustBeUpdated, ///< execution must be performed to obtain the up + ///< to date result + ModelAPI_StateExecFailed, ///< execution was failed (results are deleted in + ///< this case) + ModelAPI_StateInvalidArgument, ///< execution was not performed (results are + ///< deleted in this case) + ModelAPI_StateNothing ///< internal state that actually means that nothing + ///< must be changed }; /**\class ModelAPI_Data @@ -68,112 +73,130 @@ enum ModelAPI_ExecState { * to get/set attributes from the document and compute result of an operation. */ -class MODELAPI_EXPORT ModelAPI_Data -{ - public: - +class MODELAPI_EXPORT ModelAPI_Data { +public: /// Returns the name of the feature visible by the user in the object browser virtual std::wstring name() = 0; /// Defines the name of the feature visible by the user in the object browser - virtual void setName(const std::wstring& theName) = 0; + virtual void setName(const std::wstring &theName) = 0; /// Return \c true if the object has been renamed by the user virtual bool hasUserDefinedName() const = 0; /// Returns version of the feature (empty string if not applicable) virtual std::string version() = 0; /// Initialize the version of the feature - virtual void setVersion(const std::string& theVersion) = 0; + virtual void setVersion(const std::string &theVersion) = 0; /// Returns the attribute that references to another document - virtual std::shared_ptr document(const std::string& theID) = 0; + virtual std::shared_ptr + document(const std::string &theID) = 0; /// Returns the attribute that contains real value with double precision - virtual std::shared_ptr real(const std::string& theID) = 0; + virtual std::shared_ptr + real(const std::string &theID) = 0; /// Returns the attribute that contains double values array - virtual std::shared_ptr realArray(const std::string& theID) = 0; + virtual std::shared_ptr + realArray(const std::string &theID) = 0; /// Returns the attribute that contains integer value - virtual std::shared_ptr integer(const std::string& theID) = 0; + virtual std::shared_ptr + integer(const std::string &theID) = 0; /// Returns the attribute that contains reference to a feature - virtual std::shared_ptr reference(const std::string& theID) = 0; + virtual std::shared_ptr + reference(const std::string &theID) = 0; /// Returns the attribute that contains selection to a shape - virtual std::shared_ptr selection(const std::string& theID) = 0; + virtual std::shared_ptr + selection(const std::string &theID) = 0; /// Returns the attribute that contains selection to a shape virtual std::shared_ptr - selectionList(const std::string& theID) = 0; + selectionList(const std::string &theID) = 0; /// Returns the attribute that contains reference to an attribute of a feature - virtual std::shared_ptr refattr(const std::string& theID) = 0; + virtual std::shared_ptr + refattr(const std::string &theID) = 0; /// Returns the attribute that contains list of references to features - virtual std::shared_ptr reflist(const std::string& theID) = 0; - /// Returns the attribute that contains list of references to features or reference to - /// an attribute of a feature - virtual std::shared_ptr refattrlist(const std::string& theID) = 0; + virtual std::shared_ptr + reflist(const std::string &theID) = 0; + /// Returns the attribute that contains list of references to features or + /// reference to an attribute of a feature + virtual std::shared_ptr + refattrlist(const std::string &theID) = 0; /// Returns the attribute that contains boolean value - virtual std::shared_ptr boolean(const std::string& theID) = 0; + virtual std::shared_ptr + boolean(const std::string &theID) = 0; /// Returns the attribute that contains boolean value - virtual std::shared_ptr string(const std::string& theID) = 0; + virtual std::shared_ptr + string(const std::string &theID) = 0; /// Returns the attribute that contains integer values array - virtual std::shared_ptr intArray(const std::string& theID) = 0; + virtual std::shared_ptr + intArray(const std::string &theID) = 0; /// Returns the attribute that contains string values array - virtual std::shared_ptr stringArray(const std::string& theID) = 0; + virtual std::shared_ptr + stringArray(const std::string &theID) = 0; /// Returns the attribute that contains image - virtual std::shared_ptr image(const std::string& theID) = 0; + virtual std::shared_ptr + image(const std::string &theID) = 0; /// Returns the attribute that contains tables - virtual std::shared_ptr tables(const std::string& theID) = 0; + virtual std::shared_ptr + tables(const std::string &theID) = 0; /// Returns the generic attribute by identifier /// \param theID identifier of the attribute - virtual std::shared_ptr attribute(const std::string& theID) = 0; + virtual std::shared_ptr + attribute(const std::string &theID) = 0; /// Returns all attributes of the feature of the given type /// or all attributes if "theType" is empty - virtual std::list > - attributes(const std::string& theType) = 0; + virtual std::list> + attributes(const std::string &theType) = 0; /// Returns all attributes ids of the feature of the given type /// or all attributes if "theType" is empty - virtual std::list attributesIDs(const std::string& theType) = 0; + virtual std::list attributesIDs(const std::string &theType) = 0; /// Identifier by the id (not fast, iteration by map) /// \param theAttr attribute already created in this data - virtual const std::string& id(const std::shared_ptr& theAttr) = 0; + virtual const std::string & + id(const std::shared_ptr &theAttr) = 0; /// Returns true if data belongs to same features - virtual bool isEqual(const std::shared_ptr& theData) = 0; + virtual bool isEqual(const std::shared_ptr &theData) = 0; /// Returns true if it is correctly connected to the data model virtual bool isValid() = 0; - /// Initializes object by the attributes: must be called just after the object is created - /// for each attribute of the object - /// \param theID identifier of the attribute that can be referenced by this ID later - /// \param theAttrType type of the created attribute (received from the type method) - /// \param theIndex index of the attribute in the internal data structure, for not-floating + /// Initializes object by the attributes: must be called just after the object + /// is created for each attribute of the object \param theID identifier of the + /// attribute that can be referenced by this ID later \param theAttrType type + /// of the created attribute (received from the type method) \param theIndex + /// index of the attribute in the internal data structure, for not-floating /// attributes it is -1 to let it automatically be added /// \returns the just created attribute - virtual std::shared_ptr addAttribute( - const std::string& theID, const std::string theAttrType, const int theIndex = -1) = 0; + virtual std::shared_ptr + addAttribute(const std::string &theID, const std::string theAttrType, + const int theIndex = -1) = 0; /// Adds a floating attribute (that may be added/removed during the data life) - /// \param theID identifier of the attribute that can be referenced by this ID later - /// \param theAttrType type of the created attribute (received from the type method) - /// \param theGroup identifier of the group this attribute belongs to, may be an empty string + /// \param theID identifier of the attribute that can be referenced by this ID + /// later \param theAttrType type of the created attribute (received from the + /// type method) \param theGroup identifier of the group this attribute + /// belongs to, may be an empty string virtual std::shared_ptr - addFloatingAttribute(const std::string& theID, const std::string theAttrType, - const std::string& theGroup) = 0; + addFloatingAttribute(const std::string &theID, const std::string theAttrType, + const std::string &theGroup) = 0; /// Returns all groups of this data (ordered). - virtual void allGroups(std::list& theGroups) = 0; + virtual void allGroups(std::list &theGroups) = 0; /// Returns an ordered list of attributes that belong to the given group - virtual void attributesOfGroup(const std::string& theGroup, - std::list >& theAttrs) = 0; + virtual void attributesOfGroup( + const std::string &theGroup, + std::list> &theAttrs) = 0; /// Remove all attributes of the given group - virtual void removeAttributes(const std::string& theGroup) = 0; + virtual void removeAttributes(const std::string &theGroup) = 0; - /// Useful method for "set" methods of the attributes: sends an UPDATE event and - /// makes attribute initialized - virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr) = 0; + /// Useful method for "set" methods of the attributes: sends an UPDATE event + /// and makes attribute initialized + virtual void sendAttributeUpdated(ModelAPI_Attribute *theAttr) = 0; /// Blocks sending "attribute updated" if theBlock is true - /// \param theID identifier of the attribute that can be referenced by this ID later - /// \param theAttrType type of the created attribute (received from the type method) - /// \returns the previous state of block - virtual bool blockSendAttributeUpdated( - const bool theBlock, const bool theSendMessage = true) = 0; + /// \param theID identifier of the attribute that can be referenced by this ID + /// later \param theAttrType type of the created attribute (received from the + /// type method) \returns the previous state of block + virtual bool blockSendAttributeUpdated(const bool theBlock, + const bool theSendMessage = true) = 0; /// Erases all the data from the data model virtual void erase() = 0; @@ -188,7 +211,7 @@ class MODELAPI_EXPORT ModelAPI_Data virtual ModelAPI_ExecState execState() = 0; /// Registers error during the execution, causes the ExecutionFailed state - virtual void setError(const std::string& theError, bool theSend = true) = 0; + virtual void setError(const std::string &theError, bool theSend = true) = 0; /// Returns error, arose during the execution virtual std::string error() const = 0; @@ -197,57 +220,64 @@ class MODELAPI_EXPORT ModelAPI_Data virtual int featureId() const = 0; /// returns all objects referenced to this - virtual const std::set >& refsToMe() = 0; + virtual const std::set> &refsToMe() = 0; /// returns all references by attributes of this data /// \param theRefs returned list of pairs: id of referenced attribute and /// list of referenced objects virtual void referencesToObjects( - std::list > > >& theRefs) =0; + std::list< + std::pair>>> + &theRefs) = 0; /// Copies all attributes content into theTarget data virtual void copyTo(std::shared_ptr theTarget) = 0; - /// Returns the invalid data pointer (to avoid working with NULL shared pointers in swig) + /// Returns the invalid data pointer (to avoid working with NULL shared + /// pointers in swig) virtual std::shared_ptr invalidPtr() = 0; - /// Identifier of the transaction when object (feature or result) was updated last time. + /// Identifier of the transaction when object (feature or result) was updated + /// last time. virtual int updateID() = 0; - /// Identifier of the transaction when object (feature or result) was updated last time. - /// This method is called by the updater. + /// Identifier of the transaction when object (feature or result) was updated + /// last time. This method is called by the updater. virtual void setUpdateID(const int theID) = 0; /// Returns the owner of this data virtual std::shared_ptr owner() = 0; - /// Returns true if the object is deleted, but some data is still kept in memory + /// Returns true if the object is deleted, but some data is still kept in + /// memory virtual bool isDeleted() = 0; /// Sets true if the object is deleted, but some data is still kept in memory virtual void setIsDeleted(const bool theFlag) = 0; - /// Returns \c true if theAttribute1 is going earlier than theAttribute2 in the data - virtual bool isPrecedingAttribute(const std::string& theAttribute1, - const std::string& theAttribute2) const = 0; + /// Returns \c true if theAttribute1 is going earlier than theAttribute2 in + /// the data + virtual bool isPrecedingAttribute(const std::string &theAttribute1, + const std::string &theAttribute2) const = 0; - protected: +protected: /// Objects are created for features automatically ModelAPI_Data(); - /// Returns true if "is in history" custom behaviors is defined for the feature + /// Returns true if "is in history" custom behaviors is defined for the + /// feature virtual bool isInHistory() = 0; /// Defines the custom "is in history" behavior virtual void setIsInHistory(const bool theFlag) = 0; - /// Returns true if object must be displayed in the viewer: flag is stored in the - /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps - /// the original state in the current transaction. + /// Returns true if object must be displayed in the viewer: flag is stored in + /// the data model, so on undo/redo, open/save or recreation of object by + /// history-playing it keeps the original state in the current transaction. virtual bool isDisplayed() = 0; - /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" - /// signal. + /// Sets the displayed/hidden state of the object. If it is changed, sends the + /// "redisplay" signal. virtual void setDisplayed(const bool theDisplay) = 0; friend class ModelAPI_Object; diff --git a/src/ModelAPI/ModelAPI_Document.cpp b/src/ModelAPI/ModelAPI_Document.cpp index e2b5fb0c1..2011de1d8 100644 --- a/src/ModelAPI/ModelAPI_Document.cpp +++ b/src/ModelAPI/ModelAPI_Document.cpp @@ -14,16 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -ModelAPI_Document::~ModelAPI_Document() -{ -} +ModelAPI_Document::~ModelAPI_Document() {} /// Only for SWIG wrapping it is here -ModelAPI_Document::ModelAPI_Document() -{ -} +ModelAPI_Document::ModelAPI_Document() {} diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 216ab09f8..6ea7dd63e 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Document_H_ @@ -23,11 +24,11 @@ #include "ModelAPI.h" #include "ModelAPI_Entity.h" -#include -#include -#include #include +#include #include +#include +#include class ModelAPI_Feature; class ModelAPI_Folder; @@ -48,13 +49,13 @@ class GeomAPI_Shape; * Document contains all data that must be stored/retrieved in the file. * Also it provides access to this data: open/save, transactions management etc. */ -class ModelAPI_Document: public ModelAPI_Entity -{ +class ModelAPI_Document : public ModelAPI_Entity { public: //! Returns the kind of the document: "PartSet", "Part", or something else. - //! This kind is used for feature buttons enable/disable depending on active document - //! (it uses workbench "document" identifier in XML configuration file for this) - virtual const std::string& kind() const = 0; + //! This kind is used for feature buttons enable/disable depending on active + //! document (it uses workbench "document" identifier in XML configuration + //! file for this) + virtual const std::string &kind() const = 0; //! Removes document data //! \param theForever if it is false, document is just hidden @@ -62,18 +63,20 @@ public: virtual void close(const bool theForever = false) = 0; //! Adds to the document the new feature of the given feature id - //! \param theID creates feature and puts it in the document (if it is not action) - //! \param theMakeCurrent to make current this new feature in this document - virtual std::shared_ptr addFeature(std::string theID, - const bool theMakeCurrent = true) = 0; + //! \param theID creates feature and puts it in the document (if it is not + //! action) \param theMakeCurrent to make current this new feature in this + //! document + virtual std::shared_ptr + addFeature(std::string theID, const bool theMakeCurrent = true) = 0; //! Return a list of features, which refers to the feature //! \param theFeature a feature //! \param theRefs a list of features //! \param isSendError a flag whether the error message should be send - virtual void refsToFeature(std::shared_ptr theFeature, - std::set >& theRefs, - const bool isSendError = true) = 0; + virtual void + refsToFeature(std::shared_ptr theFeature, + std::set> &theRefs, + const bool isSendError = true) = 0; //! Removes the feature from the document //! \param theFeature a feature to be removed @@ -91,139 +94,160 @@ public: //! \param theGroupID group that contains an object //! \param theIndex zero-based index of feature in the group //! \param theAllowFolder take into account grouping feature by folders - virtual std::shared_ptr object(const std::string& theGroupID, - const int theIndex, - const bool theAllowFolder = false) = 0; + virtual std::shared_ptr + object(const std::string &theGroupID, const int theIndex, + const bool theAllowFolder = false) = 0; //! Returns the first found object in the group by the object name //! \param theGroupID group that contains an object //! \param theName name of the object to search //! \returns null if such object is not found - virtual std::shared_ptr objectByName(const std::string& theGroupID, - const std::wstring& theName) = 0; + virtual std::shared_ptr + objectByName(const std::string &theGroupID, const std::wstring &theName) = 0; - //! Returns the object index in the group. Object must be visible. Otherwise returns -1. - //! \param theObject object of this document - //! \param theAllowFolder take into account grouping feature by folders - //! \returns index started from zero, or -1 if object is invisible or belongs to another document + //! Returns the object index in the group. Object must be visible. Otherwise + //! returns -1. \param theObject object of this document \param theAllowFolder + //! take into account grouping feature by folders \returns index started from + //! zero, or -1 if object is invisible or belongs to another document virtual const int index(std::shared_ptr theObject, const bool theAllowFolder = false) = 0; //! Returns the number of objects in the group of objects //! \param theGroupID group of objects //! \param theAllowFolder take into account grouping feature by folders - virtual int size(const std::string& theGroupID, const bool theAllowFolder = false) = 0; + virtual int size(const std::string &theGroupID, + const bool theAllowFolder = false) = 0; - //! Returns the parent object of this child. This may be result or feature, parent of a - //! top result. Fast method, that uses internal data structure specifics. - virtual std::shared_ptr parent( - const std::shared_ptr theChild) = 0; + //! Returns the parent object of this child. This may be result or feature, + //! parent of a top result. Fast method, that uses internal data structure + //! specifics. + virtual std::shared_ptr + parent(const std::shared_ptr theChild) = 0; //! Returns the feature that is currently edited in this document, normally //! this is the latest created feature - //! \param theVisible use visible features only: flag is true for Object Browser functionality - //! \returns null if next created feature must be the first - virtual std::shared_ptr currentFeature(const bool theVisible) = 0; - - //! Sets the current feature: all features below will be disabled, new features - //! will be appended after this one. This method does not flushes the events appeared: - //! it will be done by the finishOperation, or direct flushes - //! \param theCurrent the selected feature as current: blow it everything become disabled - //! \param theVisible use visible features only: flag is true for Object Browser functionality + //! \param theVisible use visible features only: flag is true for Object + //! Browser functionality \returns null if next created feature must be the + //! first + virtual std::shared_ptr + currentFeature(const bool theVisible) = 0; + + //! Sets the current feature: all features below will be disabled, new + //! features will be appended after this one. This method does not flushes the + //! events appeared: it will be done by the finishOperation, or direct flushes + //! \param theCurrent the selected feature as current: blow it everything + //! become disabled \param theVisible use visible features only: flag is true + //! for Object Browser functionality virtual void setCurrentFeature(std::shared_ptr theCurrent, - const bool theVisible) = 0; + const bool theVisible) = 0; //! Makes the current feature one feature upper virtual void setCurrentFeatureUp() = 0; //! Returns the number of all features: in the history or not virtual int numInternalFeatures() = 0; //! Returns the feature by zero-based index: features in the history or not - virtual std::shared_ptr internalFeature(const int theIndex) = 0; + virtual std::shared_ptr + internalFeature(const int theIndex) = 0; //! Performs synchronization of transactions with the module document: //! If some document is not active (by undo of activation) but in memory, - //! on activation the transactions must be synchronized because all redo-s performed - //! without this participation + //! on activation the transactions must be synchronized because all redo-s + //! performed without this participation virtual void synchronizeTransactions() = 0; //! To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_Document(); //! Creates a construction result - virtual std::shared_ptr createConstruction( - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + createConstruction(const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Creates a body result - virtual std::shared_ptr createBody( - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + createBody(const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Creates a part result - virtual std::shared_ptr createPart( - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + createPart(const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Copies a part result, keeping the reference to the origin - virtual std::shared_ptr copyPart( - const std::shared_ptr& theOrigin, - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + copyPart(const std::shared_ptr &theOrigin, + const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Creates a group result - virtual std::shared_ptr createGroup( - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + createGroup(const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Creates a field result - virtual std::shared_ptr createField( - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + createField(const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Creates a parameter result - virtual std::shared_ptr createParameter( - const std::shared_ptr& theFeatureData, const int theIndex = 0) = 0; + virtual std::shared_ptr + createParameter(const std::shared_ptr &theFeatureData, + const int theIndex = 0) = 0; //! Returns a feature by result (owner of result) - virtual std::shared_ptr feature( - const std::shared_ptr& theResult) = 0; + virtual std::shared_ptr + feature(const std::shared_ptr &theResult) = 0; - //! Returns all features of the document including the hidden features which are not in - //! history. Not very fast method, for calling once, not in big cycles. - virtual std::list > allFeatures() = 0; + //! Returns all features of the document including the hidden features which + //! are not in history. Not very fast method, for calling once, not in big + //! cycles. + virtual std::list> allFeatures() = 0; - //! Returns all objects of the document including the hidden features which are not in - //! history. Not very fast method, for calling once, not in big cycles. - virtual std::list > allObjects() = 0; + //! Returns all objects of the document including the hidden features which + //! are not in history. Not very fast method, for calling once, not in big + //! cycles. + virtual std::list> allObjects() = 0; //! Creates a folder (group of the features in the object browser) //! \param theAddBefore a feature, the folder is added before //! (if empty, the folder is added after the last feature) - virtual std::shared_ptr addFolder( - std::shared_ptr theAddBefore = std::shared_ptr()) = 0; - //! Removes the folder from the document (all features in the folder will be kept). + virtual std::shared_ptr + addFolder(std::shared_ptr theAddBefore = + std::shared_ptr()) = 0; + //! Removes the folder from the document (all features in the folder will be + //! kept). virtual void removeFolder(std::shared_ptr theFolder) = 0; //! Search a folder above the list of features applicable to store them - //! (it means the list of features stored in the folder should be consequential) - //! \return Empty pointer if there is no applicable folder + //! (it means the list of features stored in the folder should be + //! consequential) \return Empty pointer if there is no applicable folder virtual std::shared_ptr findFolderAbove( - const std::list >& theFeatures) = 0; + const std::list> &theFeatures) = 0; //! Search a folder below the list of features applicable to store them - //! (it means the list of features stored in the folder should be consequential) - //! \return Empty pointer if there is no applicable folder + //! (it means the list of features stored in the folder should be + //! consequential) \return Empty pointer if there is no applicable folder virtual std::shared_ptr findFolderBelow( - const std::list >& theFeatures) = 0; + const std::list> &theFeatures) = 0; //! Search a folder containing the given feature. //! Additionally calculates a zero-based index of the feature in this folder. //! \param theFeature feature to search - //! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level. - //! \return the folder containing the feature or empty pointer if the feature is top-level. - virtual std::shared_ptr findContainingFolder( - const std::shared_ptr& theFeature, - int& theIndexInFolder) = 0; - //! Add a list of features to the folder. The correctness of the adding is not performed - //! (such checks have been done in corresponding find.. method). + //! \param theIndexInFolder zero-based index in the folder or -1 if the + //! feature is top-level. \return the folder containing the feature or empty + //! pointer if the feature is top-level. + virtual std::shared_ptr + findContainingFolder(const std::shared_ptr &theFeature, + int &theIndexInFolder) = 0; + //! Add a list of features to the folder. The correctness of the adding is not + //! performed (such checks have been done in corresponding find.. method). //! \return \c true if the movement is successful - virtual bool moveToFolder(const std::list >& theFeatures, - const std::shared_ptr& theFolder) = 0; + virtual bool + moveToFolder(const std::list> &theFeatures, + const std::shared_ptr &theFolder) = 0; //! Remove features from the folder //! \param theFeatures list of features to be removed - //! \param theBefore extract features before the folder (this parameter is applicable only + //! \param theBefore extract features before the folder (this parameter is + //! applicable only //! when all features in the folder are taking out, //! in other cases the direction is taken automatically) //! \return \c true if the features have been moved out virtual bool removeFromFolder( - const std::list >& theFeatures, + const std::list> &theFeatures, const bool theBefore = true) = 0; - //! Informs the document that it becomes active and some actions must be performed + //! Informs the document that it becomes active and some actions must be + //! performed virtual void setActive(const bool theFlag) = 0; //! Returns true if this document is currently active virtual bool isActive() const = 0; @@ -232,57 +256,71 @@ public: virtual bool isOpened() = 0; /// Returns the feature that produced the given face of the given result. - virtual std::shared_ptr producedByFeature( - std::shared_ptr theResult, - const std::shared_ptr& theShape) = 0; + virtual std::shared_ptr + producedByFeature(std::shared_ptr theResult, + const std::shared_ptr &theShape) = 0; - /// Returns true if theLater is in history of features creation later than theCurrent + /// Returns true if theLater is in history of features creation later than + /// theCurrent virtual bool isLater(std::shared_ptr theLater, std::shared_ptr theCurrent) const = 0; - //! Internally makes document know that feature was removed or added in history after creation + //! Internally makes document know that feature was removed or added in + //! history after creation MODELAPI_EXPORT virtual void updateHistory(const std::string theGroup) = 0; - /// Stores in the document boolean flags: states of the nodes in the object browser. - /// Normally is called outside of the transaction, just before "save". - MODELAPI_EXPORT virtual void storeNodesState(const std::list& theStates) = 0; + /// Stores in the document boolean flags: states of the nodes in the object + /// browser. Normally is called outside of the transaction, just before + /// "save". + MODELAPI_EXPORT virtual void + storeNodesState(const std::list &theStates) = 0; /// Returns the stored nodes states. Normally it is calls just after "open". /// Appends the values to theStates list. - MODELAPI_EXPORT virtual void restoreNodesState(std::list& theStates) const = 0; + MODELAPI_EXPORT virtual void + restoreNodesState(std::list &theStates) const = 0; - /// Just removes all features without touching the document data (to be able undo) + /// Just removes all features without touching the document data (to be able + /// undo) MODELAPI_EXPORT virtual void eraseAllFeatures() = 0; - /// Returns the next (from the history point of view) feature, any: invisible or disabled - /// \param theCurrent previous to the resulting feature - /// \param theReverse if it is true, iterates in reversed order (next becomes previous) - MODELAPI_EXPORT virtual std::shared_ptr nextFeature( - std::shared_ptr theCurrent, const bool theReverse = false) const = 0; + /// Returns the next (from the history point of view) feature, any: invisible + /// or disabled \param theCurrent previous to the resulting feature \param + /// theReverse if it is true, iterates in reversed order (next becomes + /// previous) + MODELAPI_EXPORT virtual std::shared_ptr + nextFeature(std::shared_ptr theCurrent, + const bool theReverse = false) const = 0; /// Loads the OCAF document from the file into the current document. /// All the features are added after the active feature. /// \param theFileName name of the file to import /// \param theImported list of features imported from the file - /// \param theCheckOnly verify the document does not contain unappropriate features + /// \param theCheckOnly verify the document does not contain unappropriate + /// features /// (useful for import to PartSet), but do not import it /// \returns true if file was loaded successfully - MODELAPI_EXPORT virtual bool importPart(const char* theFileName, - std::list >& theImported, - bool theCheckOnly = false) = 0; + MODELAPI_EXPORT virtual bool + importPart(const char *theFileName, + std::list> &theImported, + bool theCheckOnly = false) = 0; /// Export the list of features to the file /// \param theFilename path to save the file /// \param theExportFeatures list of features to export - MODELAPI_EXPORT virtual bool save(const char* theFilename, - const std::list >& theExportFeatures) const = 0; + MODELAPI_EXPORT virtual bool + save(const char *theFilename, + const std::list> &theExportFeatures) + const = 0; protected: //! Only for SWIG wrapping it is here MODELAPI_EXPORT ModelAPI_Document(); - //! Internally makes document know that feature was removed or added in history after creation - MODELAPI_EXPORT virtual void updateHistory(const std::shared_ptr theObject) = 0; + //! Internally makes document know that feature was removed or added in + //! history after creation + MODELAPI_EXPORT virtual void + updateHistory(const std::shared_ptr theObject) = 0; friend class ModelAPI_Object; // to add or remove from the history friend class ModelAPI_Result; // to add or remove from the history diff --git a/src/ModelAPI/ModelAPI_Entity.h b/src/ModelAPI/ModelAPI_Entity.h index 519674cff..f047adbcb 100644 --- a/src/ModelAPI/ModelAPI_Entity.h +++ b/src/ModelAPI/ModelAPI_Entity.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Entity_H_ @@ -28,8 +29,7 @@ * Provided in order to make possible distinguishing of objects and documents * by downcasting of their pointers. */ -class ModelAPI_Entity -{ +class ModelAPI_Entity { public: /// Empty function which is added for virtualiation of the interface virtual void emptyFunction() const {} @@ -37,5 +37,4 @@ public: typedef std::shared_ptr EntityPtr; - -#endif \ No newline at end of file +#endif diff --git a/src/ModelAPI/ModelAPI_EventReentrantMessage.cpp b/src/ModelAPI/ModelAPI_EventReentrantMessage.cpp index a7a8e2cb3..0a738b339 100644 --- a/src/ModelAPI/ModelAPI_EventReentrantMessage.cpp +++ b/src/ModelAPI/ModelAPI_EventReentrantMessage.cpp @@ -14,14 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include ModelAPI_EventReentrantMessage::ModelAPI_EventReentrantMessage( - const Events_ID theID, - const void* theSender) -: Events_Message(theID, theSender) -{ -} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} diff --git a/src/ModelAPI/ModelAPI_EventReentrantMessage.h b/src/ModelAPI/ModelAPI_EventReentrantMessage.h index dd343277f..73410b652 100644 --- a/src/ModelAPI/ModelAPI_EventReentrantMessage.h +++ b/src/ModelAPI/ModelAPI_EventReentrantMessage.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_EventReentrantMessage_H_ #define ModelAPI_EventReentrantMessage_H_ -#include #include +#include #include @@ -34,65 +35,77 @@ class GeomAPI_Pnt2d; /// Message that style of visualization of parameter is changed. /// It will be shown as expression or value -class ModelAPI_EventReentrantMessage : public Events_Message -{ +class ModelAPI_EventReentrantMessage : public Events_Message { public: /// Creates an empty message MODELAPI_EXPORT ModelAPI_EventReentrantMessage(const Events_ID theID, - const void* theSender); + const void *theSender); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_EventReentrantMessage() {} /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID eventId() - { - static const char * MY_EVENT_REENTRANT_MESSAGE_ID("EventReentrantMessage"); + MODELAPI_EXPORT static Events_ID eventId() { + static const char *MY_EVENT_REENTRANT_MESSAGE_ID("EventReentrantMessage"); return Events_Loop::eventByName(MY_EVENT_REENTRANT_MESSAGE_ID); } /// Fills previous feature parameter - MODELAPI_EXPORT void setCreatedFeature(const std::shared_ptr& theFeature) - { myCreatedFeature = theFeature; } + MODELAPI_EXPORT void + setCreatedFeature(const std::shared_ptr &theFeature) { + myCreatedFeature = theFeature; + } /// Returns previous feature parameter - MODELAPI_EXPORT const std::shared_ptr& createdFeature() const - { return myCreatedFeature; } + MODELAPI_EXPORT const std::shared_ptr & + createdFeature() const { + return myCreatedFeature; + } /// Fills selected object parameter /// \theObject a feature or result - MODELAPI_EXPORT void setSelectedObject(const std::shared_ptr& theObject) - { mySelectedObject = theObject; } + MODELAPI_EXPORT void + setSelectedObject(const std::shared_ptr &theObject) { + mySelectedObject = theObject; + } /// Returns selected object parameter - MODELAPI_EXPORT const std::shared_ptr& selectedObject() const - { return mySelectedObject; } + MODELAPI_EXPORT const std::shared_ptr & + selectedObject() const { + return mySelectedObject; + } /// Fills selected attribute parameter /// \theAttribute - MODELAPI_EXPORT void setSelectedAttribute - (const std::shared_ptr& theAttribute) - { mySelectedAttribute = theAttribute; } + MODELAPI_EXPORT void setSelectedAttribute( + const std::shared_ptr &theAttribute) { + mySelectedAttribute = theAttribute; + } /// Returns selected attribute parameter - MODELAPI_EXPORT const std::shared_ptr& selectedAttribute() - { return mySelectedAttribute; } + MODELAPI_EXPORT const std::shared_ptr & + selectedAttribute() { + return mySelectedAttribute; + } /// Fills clicked point /// \thePoint - MODELAPI_EXPORT void setClickedPoint(const std::shared_ptr& thePoint) - { myClickedPoint = thePoint; } + MODELAPI_EXPORT void + setClickedPoint(const std::shared_ptr &thePoint) { + myClickedPoint = thePoint; + } /// Returns clicked point - MODELAPI_EXPORT const std::shared_ptr& clickedPoint() - { return myClickedPoint; } + MODELAPI_EXPORT const std::shared_ptr &clickedPoint() { + return myClickedPoint; + } private: std::shared_ptr myCreatedFeature; ///< previous object - std::shared_ptr mySelectedObject; ///< selected object - std::shared_ptr mySelectedAttribute; ///< selected attribute + std::shared_ptr mySelectedObject; ///< selected object + std::shared_ptr + mySelectedAttribute; ///< selected attribute std::shared_ptr myClickedPoint; ///< clicked point }; typedef std::shared_ptr ReentrantMessagePtr; - #endif diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 08d2422b1..23f6c41d1 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -28,75 +29,65 @@ #include #endif -ModelAPI_ObjectUpdatedMessage::ModelAPI_ObjectUpdatedMessage(const Events_ID theID, - const void* theSender) - : Events_MessageGroup(theID, theSender) -{} +ModelAPI_ObjectUpdatedMessage::ModelAPI_ObjectUpdatedMessage( + const Events_ID theID, const void *theSender) + : Events_MessageGroup(theID, theSender) {} -ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() -{} +ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() {} -ModelAPI_ObjectDeletedMessage::ModelAPI_ObjectDeletedMessage(const Events_ID theID, - const void* theSender) - : Events_MessageGroup(theID, theSender) -{} +ModelAPI_ObjectDeletedMessage::ModelAPI_ObjectDeletedMessage( + const Events_ID theID, const void *theSender) + : Events_MessageGroup(theID, theSender) {} -ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() -{} +ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() {} -ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage(const Events_ID theID, - const void* theSender) - : Events_Message(theID, theSender) -{} +ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() -{} +ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() {} // used by GUI only // LCOV_EXCL_START -ModelAPI_FeatureStateMessage::ModelAPI_FeatureStateMessage(const Events_ID theID, - const void* theSender) - : Events_Message(theID, theSender) -{ +ModelAPI_FeatureStateMessage::ModelAPI_FeatureStateMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) { myCurrentFeature = std::shared_ptr(); } -ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() -{} +ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() {} -std::shared_ptr ModelAPI_FeatureStateMessage::feature() const -{ +std::shared_ptr +ModelAPI_FeatureStateMessage::feature() const { return myCurrentFeature; } -void ModelAPI_FeatureStateMessage::setFeature(std::shared_ptr& theFeature) -{ +void ModelAPI_FeatureStateMessage::setFeature( + std::shared_ptr &theFeature) { myCurrentFeature = theFeature; } -bool ModelAPI_FeatureStateMessage::hasState(const std::string& theKey) const -{ +bool ModelAPI_FeatureStateMessage::hasState(const std::string &theKey) const { return myFeatureState.find(theKey) != myFeatureState.end(); } -bool ModelAPI_FeatureStateMessage::state(const std::string& theFeatureId, bool theDefault) const -{ - if(hasState(theFeatureId)) { +bool ModelAPI_FeatureStateMessage::state(const std::string &theFeatureId, + bool theDefault) const { + if (hasState(theFeatureId)) { return myFeatureState.at(theFeatureId); } return theDefault; } -void ModelAPI_FeatureStateMessage::setState(const std::string& theFeatureId, bool theValue) -{ +void ModelAPI_FeatureStateMessage::setState(const std::string &theFeatureId, + bool theValue) { myFeatureState[theFeatureId] = theValue; } -std::list ModelAPI_FeatureStateMessage::features() const -{ +std::list ModelAPI_FeatureStateMessage::features() const { std::list result; std::map::const_iterator it = myFeatureState.begin(); - for( ; it != myFeatureState.end(); ++it) { + for (; it != myFeatureState.end(); ++it) { result.push_back(it->first); } return result; @@ -104,335 +95,259 @@ std::list ModelAPI_FeatureStateMessage::features() const // LCOV_EXCL_STOP ModelAPI_DocumentCreatedMessage::ModelAPI_DocumentCreatedMessage( - const Events_ID theID, const void* theSender) -: Events_Message(theID, theSender) -{} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() -{} +ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() {} -DocumentPtr ModelAPI_DocumentCreatedMessage::document() const -{ +DocumentPtr ModelAPI_DocumentCreatedMessage::document() const { return myDocument; } -void ModelAPI_DocumentCreatedMessage::setDocument(DocumentPtr theDocument) -{ +void ModelAPI_DocumentCreatedMessage::setDocument(DocumentPtr theDocument) { myDocument = theDocument; } ModelAPI_AttributeEvalMessage::ModelAPI_AttributeEvalMessage( - const Events_ID theID, const void* theSender) -: Events_Message(theID, theSender) -{} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() -{} +ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() {} -AttributePtr ModelAPI_AttributeEvalMessage::attribute() const -{ +AttributePtr ModelAPI_AttributeEvalMessage::attribute() const { return myAttribute; } -void ModelAPI_AttributeEvalMessage::setAttribute(AttributePtr theAttribute) -{ +void ModelAPI_AttributeEvalMessage::setAttribute(AttributePtr theAttribute) { myAttribute = theAttribute; } ModelAPI_ParameterEvalMessage::ModelAPI_ParameterEvalMessage( - const Events_ID theID, const void* theSender) - : Events_Message(theID, theSender), myIsProcessed(false) -{} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender), myIsProcessed(false) {} -ModelAPI_ParameterEvalMessage::~ModelAPI_ParameterEvalMessage() -{} +ModelAPI_ParameterEvalMessage::~ModelAPI_ParameterEvalMessage() {} -FeaturePtr ModelAPI_ParameterEvalMessage::parameter() const -{ - return myParam; -} +FeaturePtr ModelAPI_ParameterEvalMessage::parameter() const { return myParam; } -void ModelAPI_ParameterEvalMessage::setParameter(FeaturePtr theParam) -{ +void ModelAPI_ParameterEvalMessage::setParameter(FeaturePtr theParam) { myParam = theParam; } void ModelAPI_ParameterEvalMessage::setResults( - const std::list >& theParamsList, - const double theResult, const std::string& theError) -{ + const std::list> &theParamsList, + const double theResult, const std::string &theError) { myParamsList = theParamsList; myResult = theResult; myError = theError; myIsProcessed = true; } -bool ModelAPI_ParameterEvalMessage::isProcessed() -{ - return myIsProcessed; -} +bool ModelAPI_ParameterEvalMessage::isProcessed() { return myIsProcessed; } -const std::list >& - ModelAPI_ParameterEvalMessage::params() const -{ +const std::list> & +ModelAPI_ParameterEvalMessage::params() const { return myParamsList; } -const double& ModelAPI_ParameterEvalMessage::result() const -{ - return myResult; -} +const double &ModelAPI_ParameterEvalMessage::result() const { return myResult; } -const std::string& ModelAPI_ParameterEvalMessage::error() const -{ +const std::string &ModelAPI_ParameterEvalMessage::error() const { return myError; } /// Creates an empty message -ModelAPI_ImportParametersMessage::ModelAPI_ImportParametersMessage(const Events_ID theID, - const void* theSender) - :Events_Message(theID, theSender) -{ - -} +ModelAPI_ImportParametersMessage::ModelAPI_ImportParametersMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_ImportParametersMessage::~ModelAPI_ImportParametersMessage() -{ -} +ModelAPI_ImportParametersMessage::~ModelAPI_ImportParametersMessage() {} -std::string ModelAPI_ImportParametersMessage::filename() const -{ +std::string ModelAPI_ImportParametersMessage::filename() const { return myFilename; } -void ModelAPI_ImportParametersMessage::setFilename(std::string theFilename) -{ +void ModelAPI_ImportParametersMessage::setFilename(std::string theFilename) { myFilename = theFilename; } -ModelAPI_BuildEvalMessage::ModelAPI_BuildEvalMessage( - const Events_ID theID, const void* theSender) - : Events_Message(theID, theSender), myIsProcessed(false) -{} +ModelAPI_BuildEvalMessage::ModelAPI_BuildEvalMessage(const Events_ID theID, + const void *theSender) + : Events_Message(theID, theSender), myIsProcessed(false) {} -ModelAPI_BuildEvalMessage::~ModelAPI_BuildEvalMessage() -{} +ModelAPI_BuildEvalMessage::~ModelAPI_BuildEvalMessage() {} -FeaturePtr ModelAPI_BuildEvalMessage::parameter() const -{ - return myParam; -} +FeaturePtr ModelAPI_BuildEvalMessage::parameter() const { return myParam; } -void ModelAPI_BuildEvalMessage::setParameter(FeaturePtr theParam) -{ +void ModelAPI_BuildEvalMessage::setParameter(FeaturePtr theParam) { myParam = theParam; } void ModelAPI_BuildEvalMessage::setResults( - const std::list >& theParamsList, - const std::string& theError) -{ + const std::list> &theParamsList, + const std::string &theError) { myParamsList = theParamsList; myError = theError; myIsProcessed = true; } -const std::list >& - ModelAPI_BuildEvalMessage::params() const -{ +const std::list> & +ModelAPI_BuildEvalMessage::params() const { return myParamsList; } -bool ModelAPI_BuildEvalMessage::isProcessed() -{ - return myIsProcessed; -} +bool ModelAPI_BuildEvalMessage::isProcessed() { return myIsProcessed; } -const std::string& ModelAPI_BuildEvalMessage::error() const -{ - return myError; -} +const std::string &ModelAPI_BuildEvalMessage::error() const { return myError; } ModelAPI_ComputePositionsMessage::ModelAPI_ComputePositionsMessage( - const Events_ID theID, const void* theSender) - : Events_Message(theID, theSender) -{} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_ComputePositionsMessage::~ModelAPI_ComputePositionsMessage() -{} +ModelAPI_ComputePositionsMessage::~ModelAPI_ComputePositionsMessage() {} -const std::wstring& ModelAPI_ComputePositionsMessage::expression() const -{ +const std::wstring &ModelAPI_ComputePositionsMessage::expression() const { return myExpression; } -const std::wstring& ModelAPI_ComputePositionsMessage::parameter() const -{ +const std::wstring &ModelAPI_ComputePositionsMessage::parameter() const { return myParamName; } -void ModelAPI_ComputePositionsMessage::set( - const std::wstring& theExpression, const std::wstring& theParameter) -{ +void ModelAPI_ComputePositionsMessage::set(const std::wstring &theExpression, + const std::wstring &theParameter) { myExpression = theExpression; myParamName = theParameter; } void ModelAPI_ComputePositionsMessage::setPositions( - const std::list >& thePositions) -{ + const std::list> &thePositions) { myPositions = thePositions; } -const std::list >& ModelAPI_ComputePositionsMessage::positions() const -{ +const std::list> & +ModelAPI_ComputePositionsMessage::positions() const { return myPositions; } +ModelAPI_ObjectRenamedMessage::ModelAPI_ObjectRenamedMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_ObjectRenamedMessage::ModelAPI_ObjectRenamedMessage(const Events_ID theID, - const void* theSender) -: Events_Message(theID, theSender) -{} - -ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() -{} +ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() {} void ModelAPI_ObjectRenamedMessage::send(ObjectPtr theObject, - const std::wstring& theOldName, - const std::wstring& theNewName, - const void* theSender) -{ + const std::wstring &theOldName, + const std::wstring &theNewName, + const void *theSender) { std::shared_ptr aMessage( - new ModelAPI_ObjectRenamedMessage(eventId(), theSender)); + new ModelAPI_ObjectRenamedMessage(eventId(), theSender)); aMessage->setObject(theObject); aMessage->setOldName(theOldName); aMessage->setNewName(theNewName); Events_Loop::loop()->send(aMessage); } -ObjectPtr ModelAPI_ObjectRenamedMessage::object() const -{ - return myObject; -} +ObjectPtr ModelAPI_ObjectRenamedMessage::object() const { return myObject; } -void ModelAPI_ObjectRenamedMessage::setObject(ObjectPtr theObject) -{ +void ModelAPI_ObjectRenamedMessage::setObject(ObjectPtr theObject) { myObject = theObject; } -std::wstring ModelAPI_ObjectRenamedMessage::oldName() const -{ +std::wstring ModelAPI_ObjectRenamedMessage::oldName() const { return myOldName; } -void ModelAPI_ObjectRenamedMessage::setOldName(const std::wstring& theOldName) -{ +void ModelAPI_ObjectRenamedMessage::setOldName(const std::wstring &theOldName) { myOldName = theOldName; } -std::wstring ModelAPI_ObjectRenamedMessage::newName() const -{ +std::wstring ModelAPI_ObjectRenamedMessage::newName() const { return myNewName; } -void ModelAPI_ObjectRenamedMessage::setNewName(const std::wstring& theNewName) -{ +void ModelAPI_ObjectRenamedMessage::setNewName(const std::wstring &theNewName) { myNewName = theNewName; } -ModelAPI_ReplaceParameterMessage::ModelAPI_ReplaceParameterMessage(const Events_ID theID, - const void* theSender) -: Events_Message(theID, theSender) -{} +ModelAPI_ReplaceParameterMessage::ModelAPI_ReplaceParameterMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() -{} +ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() {} void ModelAPI_ReplaceParameterMessage::send(ObjectPtr theObject, - const void* theSender) -{ + const void *theSender) { std::shared_ptr aMessage( new ModelAPI_ReplaceParameterMessage(eventId(), theSender)); aMessage->setObject(theObject); Events_Loop::loop()->send(aMessage); } -ObjectPtr ModelAPI_ReplaceParameterMessage::object() const -{ - return myObject; -} +ObjectPtr ModelAPI_ReplaceParameterMessage::object() const { return myObject; } -void ModelAPI_ReplaceParameterMessage::setObject(ObjectPtr theObject) -{ +void ModelAPI_ReplaceParameterMessage::setObject(ObjectPtr theObject) { myObject = theObject; } - // ===== ModelAPI_SolverFailedMessage ===== -ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID, - const void* theSender) - : Events_Message(theID, theSender), - myDOF(-1) -{} +ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender), myDOF(-1) {} -ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() -{} +ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() {} -void ModelAPI_SolverFailedMessage::setObjects(const std::set& theObjects) -{ +void ModelAPI_SolverFailedMessage::setObjects( + const std::set &theObjects) { myObjects = theObjects; } -const std::set& ModelAPI_SolverFailedMessage::objects() const -{ +const std::set &ModelAPI_SolverFailedMessage::objects() const { return myObjects; } - // ===== ModelAPI_ObjectMovedMessage ===== -ModelAPI_ObjectMovedMessage::ModelAPI_ObjectMovedMessage(const void* theSender) - : Events_Message(Events_Loop::eventByName(EVENT_OBJECT_MOVED), theSender) -{} +ModelAPI_ObjectMovedMessage::ModelAPI_ObjectMovedMessage(const void *theSender) + : Events_Message(Events_Loop::eventByName(EVENT_OBJECT_MOVED), theSender) {} -void ModelAPI_ObjectMovedMessage::setMovedObject(const ObjectPtr& theMovedObject) -{ +void ModelAPI_ObjectMovedMessage::setMovedObject( + const ObjectPtr &theMovedObject) { myMovedObject = theMovedObject; myMovedAttribute = AttributePtr(); } -void ModelAPI_ObjectMovedMessage::setMovedAttribute(const AttributePtr& theMovedAttribute, - const int thePointIndex) -{ +void ModelAPI_ObjectMovedMessage::setMovedAttribute( + const AttributePtr &theMovedAttribute, const int thePointIndex) { myMovedAttribute = theMovedAttribute; myMovedObject = ObjectPtr(); myMovedPointIndex = thePointIndex; } -void ModelAPI_ObjectMovedMessage::setOriginalPosition(double theX, double theY) -{ - myOriginalPosition = std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); +void ModelAPI_ObjectMovedMessage::setOriginalPosition(double theX, + double theY) { + myOriginalPosition = + std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); #ifdef DEBUG_OBJECT_MOVED_MESSAGE std::cout << "setOriginalPosition: " << myOriginalPosition->x() << ", " - << myOriginalPosition->y() << std::endl; + << myOriginalPosition->y() << std::endl; #endif } void ModelAPI_ObjectMovedMessage::setOriginalPosition( - const std::shared_ptr& thePoint) -{ + const std::shared_ptr &thePoint) { myOriginalPosition = thePoint; #ifdef DEBUG_OBJECT_MOVED_MESSAGE std::cout << "setOriginalPosition: " << myOriginalPosition->x() << ", " - << myOriginalPosition->y() << std::endl; + << myOriginalPosition->y() << std::endl; #endif } -void ModelAPI_ObjectMovedMessage::setCurrentPosition(double theX, double theY) -{ - myCurrentPosition = std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); +void ModelAPI_ObjectMovedMessage::setCurrentPosition(double theX, double theY) { + myCurrentPosition = + std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); #ifdef DEBUG_OBJECT_MOVED_MESSAGE - std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " << myCurrentPosition->y() + std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " + << myCurrentPosition->y() << ", myCurrentPosition - myOriginalPosition: " << myCurrentPosition->x() - myOriginalPosition->x() << ", " << myCurrentPosition->y() - myOriginalPosition->y() << std::endl; @@ -440,74 +355,62 @@ void ModelAPI_ObjectMovedMessage::setCurrentPosition(double theX, double theY) } void ModelAPI_ObjectMovedMessage::setCurrentPosition( - const std::shared_ptr& thePoint) -{ + const std::shared_ptr &thePoint) { myCurrentPosition = thePoint; #ifdef DEBUG_OBJECT_MOVED_MESSAGE - std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " << myCurrentPosition->y() + std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " + << myCurrentPosition->y() << ", myCurrentPosition - myOriginalPosition: " << myCurrentPosition->x() - myOriginalPosition->x() << ", " << myCurrentPosition->y() - myOriginalPosition->y() << std::endl; #endif } - // ===== ModelAPI_ShapesFailedMessage ===== -ModelAPI_ShapesFailedMessage::ModelAPI_ShapesFailedMessage(const Events_ID theID, - const void* theSender) - : Events_Message(theID, theSender) -{} +ModelAPI_ShapesFailedMessage::ModelAPI_ShapesFailedMessage( + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_ShapesFailedMessage::~ModelAPI_ShapesFailedMessage() -{} +ModelAPI_ShapesFailedMessage::~ModelAPI_ShapesFailedMessage() {} -void ModelAPI_ShapesFailedMessage::setShapes(const ListOfShape& theShapes) -{ +void ModelAPI_ShapesFailedMessage::setShapes(const ListOfShape &theShapes) { myShapes = theShapes; } -const ListOfShape& ModelAPI_ShapesFailedMessage::shapes() const -{ +const ListOfShape &ModelAPI_ShapesFailedMessage::shapes() const { return myShapes; } /// Creates an empty message ModelAPI_CheckConstraintsMessage::ModelAPI_CheckConstraintsMessage( - const Events_ID theID, const void* theSender) - :Events_Message(theID, theSender) -{ -} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_CheckConstraintsMessage::~ModelAPI_CheckConstraintsMessage() -{ -} +ModelAPI_CheckConstraintsMessage::~ModelAPI_CheckConstraintsMessage() {} -const std::set& ModelAPI_CheckConstraintsMessage::constraints() const -{ +const std::set & +ModelAPI_CheckConstraintsMessage::constraints() const { return myConstraints; } -void ModelAPI_CheckConstraintsMessage::setConstraints(const std::set& theConstraints) -{ +void ModelAPI_CheckConstraintsMessage::setConstraints( + const std::set &theConstraints) { myConstraints = theConstraints; } - // ===== ModelAPI_FeaturesLicenseValidMessage ===== ModelAPI_FeaturesLicenseValidMessage::ModelAPI_FeaturesLicenseValidMessage( - const Events_ID theID, const void* theSender) - : Events_Message(theID, theSender) -{} + const Events_ID theID, const void *theSender) + : Events_Message(theID, theSender) {} -ModelAPI_FeaturesLicenseValidMessage::~ModelAPI_FeaturesLicenseValidMessage() -{} +ModelAPI_FeaturesLicenseValidMessage::~ModelAPI_FeaturesLicenseValidMessage() {} -void ModelAPI_FeaturesLicenseValidMessage::setFeatures(const std::set& theFeatures) -{ +void ModelAPI_FeaturesLicenseValidMessage::setFeatures( + const std::set &theFeatures) { myFeatures = theFeatures; } -const std::set& ModelAPI_FeaturesLicenseValidMessage::features() const -{ +const std::set & +ModelAPI_FeaturesLicenseValidMessage::features() const { return myFeatures; } diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index ff4bf6582..044cf6a8e 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -14,24 +14,24 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_EVENTS_H_ #define MODELAPI_EVENTS_H_ +#include +#include #include -#include -#include #include -#include -#include +#include +#include +#include #include -#include #include -#include - +#include class ModelAPI_Document; class ModelAPI_ResultParameter; @@ -45,129 +45,158 @@ class GeomAPI_Shape; #endif /// Event ID that feature is created (comes with ModelAPI_ObjectUpdatedMessage) -MAYBE_UNUSED static const char * EVENT_OBJECT_CREATED = "ObjectCreated"; -/// Event ID that data of feature is updated (comes with Model_ObjectUpdatedMessage) -MAYBE_UNUSED static const char * EVENT_OBJECT_UPDATED = "ObjectUpdated"; -/// Event ID that data of feature is deleted (comes with Model_ObjectDeletedMessage) -MAYBE_UNUSED static const char * EVENT_OBJECT_DELETED = "ObjectDeleted"; -/// Event ID that name of feature is changed (comes with Model_ObjectRenamedMessage) -MAYBE_UNUSED static const char * EVENT_OBJECT_RENAMED = "ObjectRenamed"; -/// Event ID that data of feature is updated (comes with ModelAPI_ObjectUpdatedMessage) -MAYBE_UNUSED static const char * EVENT_OBJECT_MOVED = "ObjectsMoved"; -/// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage) -MAYBE_UNUSED static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay"; +MAYBE_UNUSED static const char *EVENT_OBJECT_CREATED = "ObjectCreated"; +/// Event ID that data of feature is updated (comes with +/// Model_ObjectUpdatedMessage) +MAYBE_UNUSED static const char *EVENT_OBJECT_UPDATED = "ObjectUpdated"; +/// Event ID that data of feature is deleted (comes with +/// Model_ObjectDeletedMessage) +MAYBE_UNUSED static const char *EVENT_OBJECT_DELETED = "ObjectDeleted"; +/// Event ID that name of feature is changed (comes with +/// Model_ObjectRenamedMessage) +MAYBE_UNUSED static const char *EVENT_OBJECT_RENAMED = "ObjectRenamed"; +/// Event ID that data of feature is updated (comes with +/// ModelAPI_ObjectUpdatedMessage) +MAYBE_UNUSED static const char *EVENT_OBJECT_MOVED = "ObjectsMoved"; +/// Event ID that visualization must be redisplayed (comes with +/// ModelAPI_ObjectUpdatedMessage) +MAYBE_UNUSED static const char *EVENT_OBJECT_TO_REDISPLAY = + "ObjectsToRedisplay"; /// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage) -MAYBE_UNUSED static const char * EVENT_PLUGIN_LOADED = "PluginLoaded"; +MAYBE_UNUSED static const char *EVENT_PLUGIN_LOADED = "PluginLoaded"; /// The active document becomes another one -MAYBE_UNUSED static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged"; +MAYBE_UNUSED static const char *EVENT_DOCUMENT_CHANGED = + "CurrentDocumentChanged"; /// All documents closed -MAYBE_UNUSED static const char * EVENT_DOCUMENTS_CLOSED = "AllDocumentsClosed"; +MAYBE_UNUSED static const char *EVENT_DOCUMENTS_CLOSED = "AllDocumentsClosed"; /// Event ID that order of objects in group is changed, /// so, tree must be fully recreated (movement of feature) -MAYBE_UNUSED static const char * EVENT_ORDER_UPDATED = "OrderUpdated"; -/// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed -MAYBE_UNUSED static const char * EVENT_UPDATE_SELECTION = "UpdateSelection"; +MAYBE_UNUSED static const char *EVENT_ORDER_UPDATED = "OrderUpdated"; +/// Event ID that the sketch is prepared and all grouped messages for the solver +/// may be flushed +MAYBE_UNUSED static const char *EVENT_UPDATE_SELECTION = "UpdateSelection"; /// Request for the enabled/disabled actions behavior for some specific features -MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest"; +MAYBE_UNUSED static const char *EVENT_FEATURE_STATE_REQUEST = + "FeatureStateRequest"; /// Reply for the enabled/disabled actions behavior for some specific features -MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; +MAYBE_UNUSED static const char *EVENT_FEATURE_STATE_RESPONSE = + "FeatureStateResponse"; /// To block the viewer updates -MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; +MAYBE_UNUSED static const char *EVENT_UPDATE_VIEWER_BLOCKED = + "UpdateViewerBlocked"; /// To unblock the viewer updates -MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; +MAYBE_UNUSED static const char *EVENT_UPDATE_VIEWER_UNBLOCKED = + "UpdateViewerUnblocked"; /// To inform that there is an empty presentation in the viewer -MAYBE_UNUSED static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation"; +MAYBE_UNUSED static const char *EVENT_EMPTY_AIS_PRESENTATION = + "EmptyAISPresentation"; /// To inform that there is an empty operation for presentation in the viewer -MAYBE_UNUSED static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation"; +MAYBE_UNUSED static const char *EVENT_EMPTY_OPERATION_PRESENTATION = + "EmptyOperationPresentation"; /// To block preview -MAYBE_UNUSED static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; +MAYBE_UNUSED static const char *EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; /// To preview the current feature in the viewer (to compute the result) -MAYBE_UNUSED static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested"; +MAYBE_UNUSED static const char *EVENT_PREVIEW_REQUESTED = "PreviewRequested"; /// To block automatic recomputation of any feature (by the GUI button press) -MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE - = "DisableAutomaticRecomputation"; -/// To unblock block automatic recomputation (default state: the GUI button unpressed) -MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE - = "EnableAutomaticRecomputation"; - -/// Event ID that solver has conflicting constraints (comes with ModelAPI_SolverFailedMessage) -MAYBE_UNUSED static const char * EVENT_SOLVER_FAILED = "SolverFailed"; +MAYBE_UNUSED static const char *EVENT_AUTOMATIC_RECOMPUTATION_DISABLE = + "DisableAutomaticRecomputation"; +/// To unblock block automatic recomputation (default state: the GUI button +/// unpressed) +MAYBE_UNUSED static const char *EVENT_AUTOMATIC_RECOMPUTATION_ENABLE = + "EnableAutomaticRecomputation"; + +/// Event ID that solver has conflicting constraints (comes with +/// ModelAPI_SolverFailedMessage) +MAYBE_UNUSED static const char *EVENT_SOLVER_FAILED = "SolverFailed"; /// Event ID that the problem in solver disappeared -MAYBE_UNUSED static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired"; +MAYBE_UNUSED static const char *EVENT_SOLVER_REPAIRED = "SolverRepaired"; /// Event Id that sketch has DoF = 0 -MAYBE_UNUSED static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted"; +MAYBE_UNUSED static const char *EVENT_SKETCH_FULLY_CONSTRAINED = + "SketchFullyConstrainted"; /// Event Id that sketch has DoF > 0 -MAYBE_UNUSED static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted"; +MAYBE_UNUSED static const char *EVENT_SKETCH_UNDER_CONSTRAINED = + "SketchUnderConstrainted"; /// Event Id that sketch has DoF < 0 -MAYBE_UNUSED static const char * EVENT_SKETCH_OVER_CONSTRAINED = "SketchOverConstrainted"; +MAYBE_UNUSED static const char *EVENT_SKETCH_OVER_CONSTRAINED = + "SketchOverConstrainted"; /// Event ID that informs that some object has changed the stability -MAYBE_UNUSED static const char * EVENT_STABILITY_CHANGED = "StabilityChanged"; +MAYBE_UNUSED static const char *EVENT_STABILITY_CHANGED = "StabilityChanged"; -/// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed -MAYBE_UNUSED static const char * EVENT_SKETCH_PREPARED = "SketchPrepared"; +/// Event ID that the sketch is prepared and all grouped messages for the solver +/// may be flushed +MAYBE_UNUSED static const char *EVENT_SKETCH_PREPARED = "SketchPrepared"; -/// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0 -MAYBE_UNUSED static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects"; +/// Event ID that provides a request for list of non-fixed objects necessary for +/// DoF = 0 +MAYBE_UNUSED static const char *EVENT_GET_DOF_OBJECTS = "GetDoFObjects"; -/// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0 -MAYBE_UNUSED static const char * EVENT_DOF_OBJECTS = "DoFObjects"; +/// Event ID that provides a request for list of non-fixed objects necessary for +/// DoF = 0 +MAYBE_UNUSED static const char *EVENT_DOF_OBJECTS = "DoFObjects"; /// Event ID that requests updates visual attributes for presentations -MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes"; +MAYBE_UNUSED static const char *EVENT_VISUAL_ATTRIBUTES = + "UpdateVisualAttributes"; /// Event ID that 1D-fillet failed (comes with ModelAPI_ShapesFailedMessage) -MAYBE_UNUSED static const char * EVENT_OPERATION_SHAPES_FAILED = "OperationShapesFailed"; +MAYBE_UNUSED static const char *EVENT_OPERATION_SHAPES_FAILED = + "OperationShapesFailed"; -MAYBE_UNUSED static const char * EVENT_CHECK_CONSTRAINTS = "CheckConstrains"; +MAYBE_UNUSED static const char *EVENT_CHECK_CONSTRAINTS = "CheckConstrains"; -MAYBE_UNUSED static const char * EVENT_REMOVE_CONSTRAINTS = "RemoveConstrains"; +MAYBE_UNUSED static const char *EVENT_REMOVE_CONSTRAINTS = "RemoveConstrains"; /// Event ID that license of specified features is checked and valid -MAYBE_UNUSED static const char * EVENT_FEATURE_LICENSE_VALID = "FeaturesLicenseValid"; +MAYBE_UNUSED static const char *EVENT_FEATURE_LICENSE_VALID = + "FeaturesLicenseValid"; /// To send preferences information: create part on init or not -MAYBE_UNUSED static const char * EVENT_CREATE_PART_ON_START = "CreatePartOnStart"; - +MAYBE_UNUSED static const char *EVENT_CREATE_PART_ON_START = + "CreatePartOnStart"; -/// Message that feature was changed (used for Object Browser update): moved, updated and deleted -class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup -{ - protected: +/// Message that feature was changed (used for Object Browser update): moved, +/// updated and deleted +class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage + : public Events_MessageGroup { +protected: /// Creates an empty message - ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender = 0); + ModelAPI_ObjectUpdatedMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor virtual ~ModelAPI_ObjectUpdatedMessage(); - public: +public: /// Returns the feature that has been updated - virtual const std::set& objects() const = 0; + virtual const std::set &objects() const = 0; //! Creates a new empty group (to store it in the loop before flush) virtual std::shared_ptr newEmpty() = 0; //! Allows to join the given message with the current one - virtual void Join(const std::shared_ptr& theJoined) = 0; + virtual void Join(const std::shared_ptr &theJoined) = 0; }; /// Message that feature was deleted (used for Object Browser update) -class MODELAPI_EXPORT ModelAPI_ObjectDeletedMessage : public Events_MessageGroup -{ +class MODELAPI_EXPORT ModelAPI_ObjectDeletedMessage + : public Events_MessageGroup { protected: /// Creates an empty message - ModelAPI_ObjectDeletedMessage(const Events_ID theID, const void* theSender = 0); + ModelAPI_ObjectDeletedMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor virtual ~ModelAPI_ObjectDeletedMessage(); public: /// Returns the groups where the objects were deleted - virtual const std::list, std::string> >& - groups() const = 0; + virtual const std::list< + std::pair, std::string>> & + groups() const = 0; /// Creates the new empty message of this kind virtual std::shared_ptr newEmpty() = 0; @@ -176,15 +205,15 @@ public: virtual const Events_ID messageId() = 0; /// Appends to this message the given one. - virtual void Join(const std::shared_ptr& theJoined) = 0; + virtual void Join(const std::shared_ptr &theJoined) = 0; }; /// Message that order changed (used for Object Browser update) -class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message -{ +class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message { protected: /// Creates a message: - ModelAPI_OrderUpdatedMessage(const Events_ID theID, const void* theSender = 0); + ModelAPI_OrderUpdatedMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor virtual ~ModelAPI_OrderUpdatedMessage(); @@ -197,54 +226,59 @@ public: }; /// Allows to create ModelAPI messages -class MODELAPI_EXPORT ModelAPI_EventCreator -{ +class MODELAPI_EXPORT ModelAPI_EventCreator { public: virtual ~ModelAPI_EventCreator() {} /// creates created, updated or moved messages and sends to the loop - virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent, + virtual void sendUpdated(const ObjectPtr &theObject, + const Events_ID &theEvent, + const bool isGroupped = true) const = 0; + /// creates created, updated or moved messages with the objects collection and + /// sends to the loop + virtual void sendUpdated(const std::list &theObjects, + const Events_ID &theEvent, const bool isGroupped = true) const = 0; - /// creates created, updated or moved messages with the objects collection and sends to the loop - virtual void sendUpdated(const std::list& theObjects, const Events_ID& theEvent, - const bool isGroupped = true) const = 0; /// creates deleted message and sends to the loop - virtual void sendDeleted(const std::shared_ptr& theDoc, - const std::string& theGroup) const = 0; + virtual void sendDeleted(const std::shared_ptr &theDoc, + const std::string &theGroup) const = 0; /// creates reordered message and sends to the loop - virtual void sendReordered(const std::shared_ptr& theReordered) const = 0; + virtual void sendReordered( + const std::shared_ptr &theReordered) const = 0; /// returns the creator instance - static const ModelAPI_EventCreator* get(); + static const ModelAPI_EventCreator *get(); /// sets the creator instance - static void set(const ModelAPI_EventCreator* theCreator); + static void set(const ModelAPI_EventCreator *theCreator); }; /// Contains the state information about the feature: is it enabled or disabled. -class ModelAPI_FeatureStateMessage : public Events_Message -{ +class ModelAPI_FeatureStateMessage : public Events_Message { public: /// Creates an empty message - MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_FeatureStateMessage(); /// Returns the feature this message is related to MODELAPI_EXPORT std::shared_ptr feature() const; /// Stores the feature this message is related to - MODELAPI_EXPORT void setFeature(std::shared_ptr& theFeature); + MODELAPI_EXPORT void + setFeature(std::shared_ptr &theFeature); // For response /// Returns true if feature has specific state - MODELAPI_EXPORT bool hasState(const std::string& theFeatureId) const; + MODELAPI_EXPORT bool hasState(const std::string &theFeatureId) const; /// Returns true if feature is enabled - MODELAPI_EXPORT bool state(const std::string& theFeatureId, bool theDefault = false) const; + MODELAPI_EXPORT bool state(const std::string &theFeatureId, + bool theDefault = false) const; /// Stores the feature state - MODELAPI_EXPORT void setState(const std::string& theFeatureId, bool theValue); + MODELAPI_EXPORT void setState(const std::string &theFeatureId, bool theValue); /// Returns all feature IDs with states MODELAPI_EXPORT std::list features() const; - private: +private: /// For Request std::shared_ptr myCurrentFeature; /// For response @@ -252,19 +286,18 @@ public: }; /// Message that document (Part, PartSet) was created -class ModelAPI_DocumentCreatedMessage : public Events_Message -{ +class ModelAPI_DocumentCreatedMessage : public Events_Message { DocumentPtr myDocument; - public: +public: /// Creates an empty message - MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_DocumentCreatedMessage(); /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID eventId() - { - static const char * MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated"); + MODELAPI_EXPORT static Events_ID eventId() { + static const char *MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated"); return Events_Loop::eventByName(MY_DOCUMENT_CREATED_EVENT_ID); } @@ -275,31 +308,32 @@ class ModelAPI_DocumentCreatedMessage : public Events_Message }; /// Message that attribute text should be evaluated in the attribute value -class ModelAPI_AttributeEvalMessage : public Events_Message -{ +class ModelAPI_AttributeEvalMessage : public Events_Message { AttributePtr myAttribute; - public: +public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char * MY_ATTRIBUTE_EVALUATION_EVENT_ID("AttributeEvaluationRequest"); - static Events_ID anId = Events_Loop::eventByName(MY_ATTRIBUTE_EVALUATION_EVENT_ID); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_ATTRIBUTE_EVALUATION_EVENT_ID( + "AttributeEvaluationRequest"); + static Events_ID anId = + Events_Loop::eventByName(MY_ATTRIBUTE_EVALUATION_EVENT_ID); return anId; } /// Useful method that creates and sends the AttributeEvalMessage event - MODELAPI_EXPORT static void send(AttributePtr theAttribute, const void* theSender) - { + MODELAPI_EXPORT static void send(AttributePtr theAttribute, + const void *theSender) { std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_AttributeEvalMessage(eventId(), theSender)); + std::shared_ptr( + new ModelAPI_AttributeEvalMessage(eventId(), theSender)); aMessage->setAttribute(theAttribute); Events_Loop::loop()->send(aMessage); } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_AttributeEvalMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_AttributeEvalMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_AttributeEvalMessage(); @@ -309,40 +343,42 @@ class ModelAPI_AttributeEvalMessage : public Events_Message MODELAPI_EXPORT void setAttribute(AttributePtr theAttribute); }; -/// Message that parameter feature expression should be evaluated: value and error producing -class ModelAPI_ParameterEvalMessage : public Events_Message -{ +/// Message that parameter feature expression should be evaluated: value and +/// error producing +class ModelAPI_ParameterEvalMessage : public Events_Message { FeaturePtr myParam; ///< parameters that should be evaluated bool myIsProcessed; ///< true if results were set /// result of processing, list of parameters in expression found - std::list > myParamsList; - double myResult; ///< result of processing, the computed value of the expression + std::list> myParamsList; + double + myResult; ///< result of processing, the computed value of the expression std::string myError; ///< error of processing, empty if there is no error - public: +public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char * MY_PARAMETER_EVALUATION_EVENT_ID("ParameterEvaluationRequest"); - static Events_ID anId = Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_PARAMETER_EVALUATION_EVENT_ID( + "ParameterEvaluationRequest"); + static Events_ID anId = + Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID); return anId; } /// Useful method that creates and sends the event. /// Returns the message, processed, with the resulting fields filled. MODELAPI_EXPORT static std::shared_ptr - send(FeaturePtr theParameter, const void* theSender) - { + send(FeaturePtr theParameter, const void *theSender) { std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_ParameterEvalMessage(eventId(), theSender)); + std::shared_ptr( + new ModelAPI_ParameterEvalMessage(eventId(), theSender)); aMessage->setParameter(theParameter); Events_Loop::loop()->send(aMessage); return aMessage; } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ParameterEvalMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_ParameterEvalMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_ParameterEvalMessage(); @@ -352,40 +388,41 @@ class ModelAPI_ParameterEvalMessage : public Events_Message MODELAPI_EXPORT void setParameter(FeaturePtr theParam); /// Sets the results of processing MODELAPI_EXPORT void setResults( - const std::list >& theParamsList, - const double theResult, const std::string& theError); + const std::list> &theParamsList, + const double theResult, const std::string &theError); /// Returns true if the expression is processed MODELAPI_EXPORT bool isProcessed(); - /// Returns the results of processing: list of parameters found in the expression - MODELAPI_EXPORT const std::list >& params() const; + /// Returns the results of processing: list of parameters found in the + /// expression + MODELAPI_EXPORT const std::list> & + params() const; /// Returns the expression result - MODELAPI_EXPORT const double& result() const; + MODELAPI_EXPORT const double &result() const; /// Returns the interpreter error (empty if no error) - MODELAPI_EXPORT const std::string& error() const; + MODELAPI_EXPORT const std::string &error() const; }; -class ModelAPI_ImportParametersMessage : public Events_Message -{ +class ModelAPI_ImportParametersMessage : public Events_Message { std::string myFilename; ///< filename where where parameters are stored - std::string myError; ///< error of processing, empty if there is no error + std::string myError; ///< error of processing, empty if there is no error public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char* MY_PARAMETER_EVALUATION_EVENT_ID("ImportParametersMessage"); - static Events_ID anId = Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_PARAMETER_EVALUATION_EVENT_ID( + "ImportParametersMessage"); + static Events_ID anId = + Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID); return anId; } /// Useful method that creates and sends the event. /// Returns the message, processed, with the resulting fields filled. MODELAPI_EXPORT static std::shared_ptr - send(std::string theParameter, const void* theSender) - { + send(std::string theParameter, const void *theSender) { std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_ImportParametersMessage(eventId(), theSender)); + std::shared_ptr( + new ModelAPI_ImportParametersMessage(eventId(), theSender)); aMessage->setFilename(theParameter); Events_Loop::loop()->send(aMessage); return aMessage; @@ -393,7 +430,7 @@ public: /// Creates an empty message MODELAPI_EXPORT ModelAPI_ImportParametersMessage(const Events_ID theID, - const void* theSender = 0); + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_ImportParametersMessage(); @@ -403,38 +440,37 @@ public: MODELAPI_EXPORT void setFilename(std::string theFilename); }; -class ModelAPI_BuildEvalMessage : public Events_Message -{ - FeaturePtr myParam; ///< parameters that should be evaluated - bool myIsProcessed; ///< true if results were set +class ModelAPI_BuildEvalMessage : public Events_Message { + FeaturePtr myParam; ///< parameters that should be evaluated + bool myIsProcessed; ///< true if results were set std::string myError; ///< error of processing, empty if there is no error /// result of processing, list of parameters in expression found - std::list > myParamsList; + std::list> myParamsList; - public: +public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char * MY_BUILD_EVALUATION_EVENT_ID("BuildEvaluationRequest"); - static Events_ID anId = Events_Loop::eventByName(MY_BUILD_EVALUATION_EVENT_ID); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_BUILD_EVALUATION_EVENT_ID("BuildEvaluationRequest"); + static Events_ID anId = + Events_Loop::eventByName(MY_BUILD_EVALUATION_EVENT_ID); return anId; } /// Useful method that creates and sends the event. /// Returns the message, processed, with the resulting fields filled. MODELAPI_EXPORT static std::shared_ptr - send(FeaturePtr theParameter, const void* theSender) - { + send(FeaturePtr theParameter, const void *theSender) { std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_BuildEvalMessage(eventId(), theSender)); + std::shared_ptr( + new ModelAPI_BuildEvalMessage(eventId(), theSender)); aMessage->setParameter(theParameter); Events_Loop::loop()->send(aMessage); return aMessage; } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_BuildEvalMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_BuildEvalMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_BuildEvalMessage(); @@ -444,88 +480,92 @@ class ModelAPI_BuildEvalMessage : public Events_Message MODELAPI_EXPORT void setParameter(FeaturePtr theParam); /// Sets the results of processing MODELAPI_EXPORT void setResults( - const std::list >& theParamsList, - const std::string& theError); - /// Returns the results of processing: list of parameters found in the expression - MODELAPI_EXPORT const std::list >& params() const; + const std::list> &theParamsList, + const std::string &theError); + /// Returns the results of processing: list of parameters found in the + /// expression + MODELAPI_EXPORT const std::list> & + params() const; /// Returns true if the expression is processed MODELAPI_EXPORT bool isProcessed(); /// Returns the interpreter error (empty if no error) - MODELAPI_EXPORT const std::string& error() const; + MODELAPI_EXPORT const std::string &error() const; }; /// Message to ask compute the positions of parameters in the expression -class ModelAPI_ComputePositionsMessage : public Events_Message -{ +class ModelAPI_ComputePositionsMessage : public Events_Message { std::wstring myExpression; ///< the expression string - std::wstring myParamName; ///< name of the parameter to be searched - std::list > myPositions; ///< computation result: start-end position indices + std::wstring myParamName; ///< name of the parameter to be searched + std::list> + myPositions; ///< computation result: start-end position indices public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char * MY_COMPUTE_POSITIOND_EVENT_ID("ComputePositionsRequest"); - static Events_ID anId = Events_Loop::eventByName(MY_COMPUTE_POSITIOND_EVENT_ID); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_COMPUTE_POSITIOND_EVENT_ID("ComputePositionsRequest"); + static Events_ID anId = + Events_Loop::eventByName(MY_COMPUTE_POSITIOND_EVENT_ID); return anId; } /// Useful method that creates and sends the AttributeEvalMessage event /// Returns the message, processed, with the resulting fields filled MODELAPI_EXPORT static std::shared_ptr - send(const std::wstring& theExpression, const std::wstring& theParameter, const void* theSender) - { + send(const std::wstring &theExpression, const std::wstring &theParameter, + const void *theSender) { std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_ComputePositionsMessage(eventId(), theSender)); + std::shared_ptr( + new ModelAPI_ComputePositionsMessage(eventId(), theSender)); aMessage->set(theExpression, theParameter); Events_Loop::loop()->send(aMessage); return aMessage; } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ComputePositionsMessage( - const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_ComputePositionsMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_ComputePositionsMessage(); /// Returns an expression stored in the message - MODELAPI_EXPORT const std::wstring& expression() const; + MODELAPI_EXPORT const std::wstring &expression() const; /// Returns a parameter name stored in the message - MODELAPI_EXPORT const std::wstring& parameter() const; + MODELAPI_EXPORT const std::wstring ¶meter() const; /// Sets an expression and parameter needed for computation - MODELAPI_EXPORT void set(const std::wstring& theExpression, const std::wstring& theParameter); + MODELAPI_EXPORT void set(const std::wstring &theExpression, + const std::wstring &theParameter); /// Sets the results of processing - MODELAPI_EXPORT void setPositions(const std::list >& thePositions); + MODELAPI_EXPORT void + setPositions(const std::list> &thePositions); /// Returns the results of processing: position start and end indices - MODELAPI_EXPORT const std::list >& positions() const; + MODELAPI_EXPORT const std::list> &positions() const; }; /// Message that the object is renamed -class ModelAPI_ObjectRenamedMessage : public Events_Message -{ +class ModelAPI_ObjectRenamedMessage : public Events_Message { ObjectPtr myObject; std::wstring myOldName; std::wstring myNewName; - public: +public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char * MY_OBJECT_RENAMED_EVENT_ID("ObjectRenamed"); - static Events_ID anId = Events_Loop::eventByName(MY_OBJECT_RENAMED_EVENT_ID); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_OBJECT_RENAMED_EVENT_ID("ObjectRenamed"); + static Events_ID anId = + Events_Loop::eventByName(MY_OBJECT_RENAMED_EVENT_ID); return anId; } /// Useful method that creates and sends the AttributeEvalMessage event MODELAPI_EXPORT static void send(ObjectPtr theObject, - const std::wstring& theOldName, - const std::wstring& theNewName, - const void* theSender); + const std::wstring &theOldName, + const std::wstring &theNewName, + const void *theSender); /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ObjectRenamedMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_ObjectRenamedMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_ObjectRenamedMessage(); @@ -536,34 +576,32 @@ class ModelAPI_ObjectRenamedMessage : public Events_Message /// Returns an old name MODELAPI_EXPORT std::wstring oldName() const; /// Sets an old name - MODELAPI_EXPORT void setOldName(const std::wstring& theOldName); + MODELAPI_EXPORT void setOldName(const std::wstring &theOldName); /// Returns a new name MODELAPI_EXPORT std::wstring newName() const; /// Sets a new name - MODELAPI_EXPORT void setNewName(const std::wstring& theNewName); + MODELAPI_EXPORT void setNewName(const std::wstring &theNewName); }; /// Message that the parameter should be replaced with its value -class ModelAPI_ReplaceParameterMessage : public Events_Message -{ +class ModelAPI_ReplaceParameterMessage : public Events_Message { ObjectPtr myObject; - public: +public: /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID& eventId() - { - static const char * MY_EVENT_ID("ReplaceParameter"); + MODELAPI_EXPORT static Events_ID &eventId() { + static const char *MY_EVENT_ID("ReplaceParameter"); static Events_ID anId = Events_Loop::eventByName(MY_EVENT_ID); return anId; } /// Useful method that creates and sends the AttributeEvalMessage event - MODELAPI_EXPORT static void send(ObjectPtr theObject, - const void* theSender); + MODELAPI_EXPORT static void send(ObjectPtr theObject, const void *theSender); /// Creates an empty message MODELAPI_EXPORT - ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void* theSender = 0); + ModelAPI_ReplaceParameterMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_ReplaceParameterMessage(); @@ -573,24 +611,25 @@ class ModelAPI_ReplaceParameterMessage : public Events_Message MODELAPI_EXPORT void setObject(ObjectPtr theObject); }; -/// Message that sends the sketch solver and sketcher GUI processes to show in the property panel -class ModelAPI_SolverFailedMessage : public Events_Message -{ +/// Message that sends the sketch solver and sketcher GUI processes to show in +/// the property panel +class ModelAPI_SolverFailedMessage : public Events_Message { public: /// Creates an message - MODELAPI_EXPORT ModelAPI_SolverFailedMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_SolverFailedMessage(const Events_ID theID, + const void *theSender = 0); /// Default destructor MODELAPI_EXPORT virtual ~ModelAPI_SolverFailedMessage(); /// Sets list of conflicting constraints - MODELAPI_EXPORT void setObjects(const std::set& theObjects); + MODELAPI_EXPORT void setObjects(const std::set &theObjects); /// Returns list of conflicting constraints - MODELAPI_EXPORT const std::set& objects() const; + MODELAPI_EXPORT const std::set &objects() const; /// Sets degrees of freedom void dof(const int theDOF) { myDOF = theDOF; } /// Returns degrees of freedom - const int& dof() const { return myDOF; } + const int &dof() const { return myDOF; } private: std::set myObjects; @@ -599,8 +638,7 @@ private: /// Message sent when feature or attribute has been moved. /// Stores the moving object/attribute, original and new positions of mouse. -class ModelAPI_ObjectMovedMessage : public Events_Message -{ +class ModelAPI_ObjectMovedMessage : public Events_Message { ObjectPtr myMovedObject; AttributePtr myMovedAttribute; int myMovedPointIndex; @@ -609,106 +647,109 @@ class ModelAPI_ObjectMovedMessage : public Events_Message std::shared_ptr myCurrentPosition; public: - MODELAPI_EXPORT ModelAPI_ObjectMovedMessage(const void* theSender = 0); - - /// Set object which is being moved (if the message already contains attribute it will be cleared) - MODELAPI_EXPORT void setMovedObject(const ObjectPtr& theMovedObject); - /// Set attribute which is being moved (if the message already contains object it will be cleared) - /// \param[in] theMovedAttribute moved attribute - /// \param[in] thePointIndex index of the point if the moved attribute is an array of points - MODELAPI_EXPORT void setMovedAttribute(const AttributePtr& theMovedAttribute, + MODELAPI_EXPORT ModelAPI_ObjectMovedMessage(const void *theSender = 0); + + /// Set object which is being moved (if the message already contains attribute + /// it will be cleared) + MODELAPI_EXPORT void setMovedObject(const ObjectPtr &theMovedObject); + /// Set attribute which is being moved (if the message already contains object + /// it will be cleared) \param[in] theMovedAttribute moved attribute + /// \param[in] thePointIndex index of the point if the moved attribute is + /// an array of points + MODELAPI_EXPORT void setMovedAttribute(const AttributePtr &theMovedAttribute, const int thePointIndex = -1); /// Return moved object - ObjectPtr movedObject() const - { return myMovedObject; } + ObjectPtr movedObject() const { return myMovedObject; } /// Return moved attribute - AttributePtr movedAttribute() const - { return myMovedAttribute; } + AttributePtr movedAttribute() const { return myMovedAttribute; } /// Return index of the moved point - int movedPointIndex() const - { return myMovedPointIndex; } + int movedPointIndex() const { return myMovedPointIndex; } /// Set original mouse position MODELAPI_EXPORT void setOriginalPosition(double theX, double theY); /// Set original mouse position - MODELAPI_EXPORT void setOriginalPosition(const std::shared_ptr& thePoint); + MODELAPI_EXPORT void + setOriginalPosition(const std::shared_ptr &thePoint); /// Return original mouse position - const std::shared_ptr& originalPosition() const - { return myOriginalPosition; } + const std::shared_ptr &originalPosition() const { + return myOriginalPosition; + } /// Set current mouse position MODELAPI_EXPORT void setCurrentPosition(double theX, double theY); /// Set current mouse position - MODELAPI_EXPORT void setCurrentPosition(const std::shared_ptr& thePoint); + MODELAPI_EXPORT void + setCurrentPosition(const std::shared_ptr &thePoint); /// Return current mouse position - const std::shared_ptr& currentPosition() const - { return myCurrentPosition; } + const std::shared_ptr ¤tPosition() const { + return myCurrentPosition; + } }; -/// Message that sends the failed vertices of 1D-fillet to highlight them in 3D viewer -class ModelAPI_ShapesFailedMessage : public Events_Message -{ +/// Message that sends the failed vertices of 1D-fillet to highlight them in 3D +/// viewer +class ModelAPI_ShapesFailedMessage : public Events_Message { public: /// Creates an message - MODELAPI_EXPORT ModelAPI_ShapesFailedMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_ShapesFailedMessage(const Events_ID theID, + const void *theSender = 0); /// Default destructor MODELAPI_EXPORT virtual ~ModelAPI_ShapesFailedMessage(); /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID eventId() - { + MODELAPI_EXPORT static Events_ID eventId() { return Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED); } /// Sets list of failed vertices - MODELAPI_EXPORT void setShapes(const std::list< std::shared_ptr >& theVertices); + MODELAPI_EXPORT void + setShapes(const std::list> &theVertices); /// Returns list of failed vertices - MODELAPI_EXPORT const std::list< std::shared_ptr >& shapes() const; + MODELAPI_EXPORT const std::list> & + shapes() const; private: - std::list< std::shared_ptr > myShapes; + std::list> myShapes; }; -///Message that sends the constraints to check or remove -class ModelAPI_CheckConstraintsMessage : public Events_Message -{ +/// Message that sends the constraints to check or remove +class ModelAPI_CheckConstraintsMessage : public Events_Message { public: /// Creates an empty message - MODELAPI_EXPORT ModelAPI_CheckConstraintsMessage( - const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT ModelAPI_CheckConstraintsMessage(const Events_ID theID, + const void *theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_CheckConstraintsMessage(); - ///Get list of constrains - MODELAPI_EXPORT const std::set& constraints() const; + /// Get list of constrains + MODELAPI_EXPORT const std::set &constraints() const; - ///Set list of constrains - MODELAPI_EXPORT void setConstraints(const std::set& theConstraints); + /// Set list of constrains + MODELAPI_EXPORT void + setConstraints(const std::set &theConstraints); private: std::set myConstraints; }; - /// Message that sends the features which license is checked and valid -class ModelAPI_FeaturesLicenseValidMessage : public Events_Message -{ +class ModelAPI_FeaturesLicenseValidMessage : public Events_Message { public: /// Creates an message MODELAPI_EXPORT - ModelAPI_FeaturesLicenseValidMessage(const Events_ID theID, const void* theSender = 0); + ModelAPI_FeaturesLicenseValidMessage(const Events_ID theID, + const void *theSender = 0); /// Default destructor MODELAPI_EXPORT virtual ~ModelAPI_FeaturesLicenseValidMessage(); /// Static. Returns EventID of the message. - MODELAPI_EXPORT static Events_ID eventId() - { + MODELAPI_EXPORT static Events_ID eventId() { return Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID); } /// Sets list of features with valid license - MODELAPI_EXPORT void setFeatures(const std::set& theFeatures); + MODELAPI_EXPORT void setFeatures(const std::set &theFeatures); /// Returns list of features with valid license - MODELAPI_EXPORT const std::set& features() const; + MODELAPI_EXPORT const std::set &features() const; private: std::set myFeatures; diff --git a/src/ModelAPI/ModelAPI_Expression.cpp b/src/ModelAPI/ModelAPI_Expression.cpp index 44c3679a5..220618c0d 100644 --- a/src/ModelAPI/ModelAPI_Expression.cpp +++ b/src/ModelAPI/ModelAPI_Expression.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Expression.h" @@ -23,44 +24,23 @@ #include -ModelAPI_Expression::ModelAPI_Expression() -{ +ModelAPI_Expression::ModelAPI_Expression() {} -} - -ModelAPI_Expression::~ModelAPI_Expression() -{ - -} - -bool ModelAPI_Expression::isInitialized() -{ - return myIsInitialized; -} +ModelAPI_Expression::~ModelAPI_Expression() {} -void ModelAPI_Expression::setInitialized() -{ - myIsInitialized = true; -} - -ModelAPI_ExpressionDouble::ModelAPI_ExpressionDouble() -{ - -} +bool ModelAPI_Expression::isInitialized() { return myIsInitialized; } -ModelAPI_ExpressionInteger::ModelAPI_ExpressionInteger() -{ +void ModelAPI_Expression::setInitialized() { myIsInitialized = true; } +ModelAPI_ExpressionDouble::ModelAPI_ExpressionDouble() {} -} +ModelAPI_ExpressionInteger::ModelAPI_ExpressionInteger() {} -bool ModelAPI_Expression::isVariable(const std::string& theString) -{ +bool ModelAPI_Expression::isVariable(const std::string &theString) { return isVariable(Locale::Convert::toWString(theString)); } -bool ModelAPI_Expression::isVariable(const std::wstring& theString) -{ +bool ModelAPI_Expression::isVariable(const std::wstring &theString) { if (theString.empty()) return false; try { @@ -68,14 +48,13 @@ bool ModelAPI_Expression::isVariable(const std::wstring& theString) if (!(iswalpha(*it) || (*it) == L'_') || it == theString.end()) return false; it++; - for ( ; it != theString.end(); ++it ) { - if(!(iswalnum(*it) || (*it) == L'_')) { + for (; it != theString.end(); ++it) { + if (!(iswalnum(*it) || (*it) == L'_')) { return false; } } - } catch(...) { + } catch (...) { return false; } return true; } - diff --git a/src/ModelAPI/ModelAPI_Expression.h b/src/ModelAPI/ModelAPI_Expression.h index a4a481b20..65d4c228f 100644 --- a/src/ModelAPI/ModelAPI_Expression.h +++ b/src/ModelAPI/ModelAPI_Expression.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Expression_H_ @@ -30,9 +31,8 @@ * \ingroup DataModel * \brief Expression for calculated values. */ -class ModelAPI_Expression -{ - public: +class ModelAPI_Expression { +public: /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_Expression(); @@ -43,7 +43,7 @@ class ModelAPI_Expression MODELAPI_EXPORT virtual void setInitialized(); /// Sets the text of this Expression - MODELAPI_EXPORT virtual void setText(const std::wstring& theText) = 0; + MODELAPI_EXPORT virtual void setText(const std::wstring &theText) = 0; /// Returns the text of this Expression MODELAPI_EXPORT virtual std::wstring text() const = 0; @@ -55,33 +55,34 @@ class ModelAPI_Expression MODELAPI_EXPORT virtual bool isInvalid() = 0; /// Allows to set expression (text) error (by the parameters listener) - MODELAPI_EXPORT virtual void setError(const std::string& theError) = 0; + MODELAPI_EXPORT virtual void setError(const std::string &theError) = 0; /// Returns an expression error MODELAPI_EXPORT virtual std::string error() = 0; /// Defines the used parameters (by the parameters listener) - MODELAPI_EXPORT virtual - void setUsedParameters(const std::set& theUsedParameters) = 0; + MODELAPI_EXPORT virtual void + setUsedParameters(const std::set &theUsedParameters) = 0; /// Returns the used parameters MODELAPI_EXPORT virtual std::set usedParameters() const = 0; - /// Returns True if the given string can be defined as a name of an expression variable - MODELAPI_EXPORT static bool isVariable(const std::string& theString); + /// Returns True if the given string can be defined as a name of an expression + /// variable + MODELAPI_EXPORT static bool isVariable(const std::string &theString); - /// Returns True if the given string can be defined as a name of an expression variable - MODELAPI_EXPORT static bool isVariable(const std::wstring& theString); + /// Returns True if the given string can be defined as a name of an expression + /// variable + MODELAPI_EXPORT static bool isVariable(const std::wstring &theString); - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_Expression(); - /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) + /// Reinitializes the internal state of the attribute (may be needed on + /// undo/redo, abort, etc) MODELAPI_EXPORT virtual void reinit() = 0; /// Resets attribute to deafult state. - MODELAPI_EXPORT virtual void reset() { - myIsInitialized = false; - }; + MODELAPI_EXPORT virtual void reset() { myIsInitialized = false; }; bool myIsInitialized; ///< is some value assigned to this attribute @@ -92,49 +93,44 @@ class ModelAPI_Expression friend class GeomData_Point2D; }; - /**\class ModelAPI_ExpressionDouble * \ingroup DataModel * \brief Expression for calculated double values. */ -class ModelAPI_ExpressionDouble : public virtual ModelAPI_Expression -{ - public: +class ModelAPI_ExpressionDouble : public virtual ModelAPI_Expression { +public: /// Defines the double value MODELAPI_EXPORT virtual void setValue(const double theValue) = 0; /// Returns the double value MODELAPI_EXPORT virtual double value() = 0; - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_ExpressionDouble(); friend class Model_Data; }; - /**\class ModelAPI_ExpressionInteger * \ingroup DataModel * \brief Expression for calculated integer values. */ -class ModelAPI_ExpressionInteger : public virtual ModelAPI_Expression -{ - public: +class ModelAPI_ExpressionInteger : public virtual ModelAPI_Expression { +public: /// Defines the integer value MODELAPI_EXPORT virtual void setValue(const int theValue) = 0; /// Returns the integer value MODELAPI_EXPORT virtual int value() = 0; - protected: +protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_ExpressionInteger(); friend class Model_Data; }; - //! Smart pointers for objects typedef std::shared_ptr ExpressionPtr; typedef std::shared_ptr ExpressionDoublePtr; diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index 21370b221..ec401c8b7 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -14,93 +14,95 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Feature.h" -#include -#include +#include +#include +#include #include #include +#include +#include +#include #include #include -#include -#include -#include -#include -void ModelAPI_Feature::setError(const std::string& theError, - bool isSend, - bool isTranslate) -{ - std::string anError = isTranslate ? Config_Translator::translate(getKind(), theError) - : theError; +void ModelAPI_Feature::setError(const std::string &theError, bool isSend, + bool isTranslate) { + std::string anError = isTranslate + ? Config_Translator::translate(getKind(), theError) + : theError; data()->setError(anError, isSend); } -const std::list >& ModelAPI_Feature::results() -{ +const std::list> &ModelAPI_Feature::results() { return myResults; } -std::shared_ptr ModelAPI_Feature::firstResult() const -{ - return myResults.empty() ? std::shared_ptr() : *(myResults.begin()); +std::shared_ptr ModelAPI_Feature::firstResult() const { + return myResults.empty() ? std::shared_ptr() + : *(myResults.begin()); } -std::shared_ptr ModelAPI_Feature::lastResult() -{ - return myResults.empty() ? std::shared_ptr() : *(myResults.rbegin()); +std::shared_ptr ModelAPI_Feature::lastResult() { + return myResults.empty() ? std::shared_ptr() + : *(myResults.rbegin()); } -void ModelAPI_Feature::setResult(const std::shared_ptr& theResult) -{ +void ModelAPI_Feature::setResult( + const std::shared_ptr &theResult) { static Events_ID EVENT_UPD = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); if (firstResult() == theResult) { // nothing to change - } else if (!myResults.empty()) { // all except first become disabled - std::list >::iterator aResIter = myResults.begin(); + } else if (!myResults.empty()) { // all except first become disabled + std::list>::iterator aResIter = + myResults.begin(); *aResIter = theResult; aECreator->sendUpdated(theResult, EVENT_UPD); - for(aResIter++; aResIter != myResults.end(); aResIter++) { + for (aResIter++; aResIter != myResults.end(); aResIter++) { (*aResIter)->setDisabled((*aResIter), true); } } else { myResults.push_back(theResult); } // in any case result becomes enabled - if (!isDisabled()) // disabled feature may be executed when it is added as not enabled (#2078) + if (!isDisabled()) // disabled feature may be executed when it is added as not + // enabled (#2078) theResult->setDisabled(theResult, false); - if (Config_PropManager::getAutoColorStatus() - && theResult->groupName() == ModelAPI_ResultGroup::group()) { - std::vector aColor; - ModelAPI_Tools::findRandomColor(aColor); - ModelAPI_Tools::setColor(theResult, aColor); - } + if (Config_PropManager::getAutoColorStatus() && + theResult->groupName() == ModelAPI_ResultGroup::group()) { + std::vector aColor; + ModelAPI_Tools::findRandomColor(aColor); + ModelAPI_Tools::setColor(theResult, aColor); + } } -void ModelAPI_Feature::setResult(const std::shared_ptr& theResult, - const int theIndex) -{ - std::list >::iterator aResIter = myResults.begin(); +void ModelAPI_Feature::setResult( + const std::shared_ptr &theResult, const int theIndex) { + std::list>::iterator aResIter = + myResults.begin(); for (int anIndex = 0; anIndex < theIndex; anIndex++) { aResIter++; } - if (aResIter == myResults.end()) { // append + if (aResIter == myResults.end()) { // append myResults.push_back(theResult); - } else { // update + } else { // update *aResIter = theResult; } theResult->setDisabled(theResult, false); } -void ModelAPI_Feature::eraseResultFromList(const std::shared_ptr& theResult) -{ - std::list >::iterator aResIter = myResults.begin(); - for(; aResIter != myResults.end(); aResIter++) { +void ModelAPI_Feature::eraseResultFromList( + const std::shared_ptr &theResult) { + std::list>::iterator aResIter = + myResults.begin(); + for (; aResIter != myResults.end(); aResIter++) { ResultPtr aRes = *aResIter; if (aRes == theResult) { std::string aGroup = aRes->groupName(); @@ -108,9 +110,11 @@ void ModelAPI_Feature::eraseResultFromList(const std::shared_ptrdata()->erase(); myResults.erase(aResIter); - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static Events_Loop *aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator *aECreator = + ModelAPI_EventCreator::get(); aECreator->sendDeleted(document(), aGroup); aECreator->sendUpdated(aRes, EVENT_DISP); break; @@ -118,18 +122,21 @@ void ModelAPI_Feature::eraseResultFromList(const std::shared_ptr >::iterator aResIter = myResults.begin(); - for(int anIndex = 0; anIndex < theSinceIndex && aResIter != myResults.end(); anIndex++) +void ModelAPI_Feature::removeResults(const int theSinceIndex, + const bool theForever, + const bool theFlush) { + std::list>::iterator aResIter = + myResults.begin(); + for (int anIndex = 0; anIndex < theSinceIndex && aResIter != myResults.end(); + anIndex++) aResIter++; std::string aGroup; - std::list >::iterator aNextIter = aResIter; - while( aNextIter != myResults.end()) { + std::list>::iterator aNextIter = aResIter; + while (aNextIter != myResults.end()) { aGroup = (*aNextIter)->groupName(); - // remove previously erased results: to enable later if needed only actual (of history change) + // remove previously erased results: to enable later if needed only actual + // (of history change) (*aNextIter)->setDisabled(*aNextIter, true); // just disable results if (theForever) { aNextIter = myResults.erase(aNextIter); @@ -139,37 +146,37 @@ void ModelAPI_Feature::removeResults( } if (!aGroup.empty() && theFlush) { // flush visualization changes - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_Loop *aLoop = Events_Loop::loop(); + static Events_ID aRedispEvent = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); aLoop->flush(aRedispEvent); static Events_ID aDelEvent = aLoop->eventByName(EVENT_OBJECT_DELETED); aLoop->flush(aDelEvent); } } -void ModelAPI_Feature::eraseResults(const bool theForever) -{ +void ModelAPI_Feature::eraseResults(const bool theForever) { removeResults(0, theForever, true); } -const std::string& ModelAPI_Feature::documentToAdd() -{ +const std::string &ModelAPI_Feature::documentToAdd() { // empty to use the current document static const std::string anEmpty; return anEmpty; } -void ModelAPI_Feature::erase() -{ - // if this is the current feature, make the upper feature as current before removing +void ModelAPI_Feature::erase() { + // if this is the current feature, make the upper feature as current before + // removing if (document().get() && document()->currentFeature(false).get() == this) { document()->setCurrentFeatureUp(); } - while (!myResults.empty()) { // remove one by one with messages + while (!myResults.empty()) { // remove one by one with messages std::shared_ptr aRes = *(myResults.begin()); aRes->setDisabled(aRes, true); // to avoid activation of the Part result - if (!myResults.empty()) {// disabling result may erase the list (on undo of Part, issue 665) + if (!myResults.empty()) { // disabling result may erase the list (on undo of + // Part, issue 665) myResults.erase(myResults.begin()); aRes->erase(); } @@ -177,14 +184,12 @@ void ModelAPI_Feature::erase() ModelAPI_Object::erase(); } -ModelAPI_Feature::~ModelAPI_Feature() -{ +ModelAPI_Feature::~ModelAPI_Feature() { if (data() && data()->isValid()) erase(); } -FeaturePtr ModelAPI_Feature::feature(ObjectPtr theObject) -{ +FeaturePtr ModelAPI_Feature::feature(ObjectPtr theObject) { FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); if (!aFeature) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); @@ -196,30 +201,28 @@ FeaturePtr ModelAPI_Feature::feature(ObjectPtr theObject) return aFeature; } -bool ModelAPI_Feature::isMacro() const -{ - return false; -} +bool ModelAPI_Feature::isMacro() const { return false; } -bool ModelAPI_Feature::setDisabled(const bool theFlag) -{ +bool ModelAPI_Feature::setDisabled(const bool theFlag) { if (myIsDisabled != theFlag) { myIsDisabled = theFlag; if (myIsDisabled) { removeResults(0, false, false); // flush will be in setCurrentFeature } else { // enable all disabled previously results - std::list >::iterator aResIter = myResults.begin(); - for(; aResIter != myResults.end(); aResIter++) { + std::list>::iterator aResIter = + myResults.begin(); + for (; aResIter != myResults.end(); aResIter++) { (*aResIter)->setDisabled(*aResIter, false); } - // update selection for the case something was updated higher in the history - // while this feature was disabled, but avoid flushing it immediately and - // wait while all the previous features update myIsDisabled flag - // (flush will be called by the document) - static Events_Loop* aLoop = Events_Loop::loop(); + // update selection for the case something was updated higher in the + // history while this feature was disabled, but avoid flushing it + // immediately and wait while all the previous features update + // myIsDisabled flag (flush will be called by the document) + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = + ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->owner(), kUpdatedSel, true); } return true; @@ -227,20 +230,17 @@ bool ModelAPI_Feature::setDisabled(const bool theFlag) return false; } -bool ModelAPI_Feature::isDisabled() -{ - return myIsDisabled; -} +bool ModelAPI_Feature::isDisabled() { return myIsDisabled; } // LCOV_EXCL_START -bool ModelAPI_Feature::setStable(const bool theFlag) -{ +bool ModelAPI_Feature::setStable(const bool theFlag) { if (myIsStable != theFlag) { myIsStable = theFlag; // send an event about the stability change (editing is started/finished) - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_STAB = aLoop->eventByName(EVENT_STABILITY_CHANGED); - std::shared_ptr aMessage(new Events_Message(EVENT_STAB, this)); + std::shared_ptr aMessage( + new Events_Message(EVENT_STAB, this)); aLoop->send(aMessage, false); return true; } @@ -248,28 +248,17 @@ bool ModelAPI_Feature::setStable(const bool theFlag) } // LCOV_EXCL_STOP -bool ModelAPI_Feature::isStable() -{ - return myIsStable; -} +bool ModelAPI_Feature::isStable() { return myIsStable; } -bool ModelAPI_Feature::isEditable() -{ - return true; -} +bool ModelAPI_Feature::isEditable() { return true; } -bool ModelAPI_Feature::customAction(const std::string& /*theActionId*/) -{ +bool ModelAPI_Feature::customAction(const std::string & /*theActionId*/) { return false; } -bool ModelAPI_Feature::isPreviewNeeded() const -{ - return true; -} +bool ModelAPI_Feature::isPreviewNeeded() const { return true; } -void ModelAPI_Feature::init() -{ +void ModelAPI_Feature::init() { myIsDisabled = false; myIsStable = true; } diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index c973d4464..d7a95c011 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Feature_H_ #define ModelAPI_Feature_H_ #include -#include #include #include +#include #include @@ -35,108 +36,107 @@ * \brief Feature function that represents the particular functionality * of this operation. Produces results by the arguments. */ -class ModelAPI_Feature : public ModelAPI_Object -{ +class ModelAPI_Feature : public ModelAPI_Object { ///< list of current results of this feature - std::list > myResults; + std::list> myResults; ///< is feature disabled or not bool myIsDisabled; ///< is feature stable (not editing) bool myIsStable; - public: +public: /// Returns the unique kind of a feature (like "Point") - virtual const std::string& getKind() = 0; + virtual const std::string &getKind() = 0; /// Returns the group identifier of all features - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Features"; return MY_GROUP; } /// Returns document this feature belongs to - virtual std::shared_ptr document() const - { + virtual std::shared_ptr document() const { return ModelAPI_Object::document(); } /// Returns the group identifier of this result - virtual std::string groupName() - { - return group(); - } + virtual std::string groupName() { return group(); } /// Computes or recomputes the results virtual void execute() = 0; - /// Computes the attribute value on the base of other attributes if the value can be computed - /// \param theAttributeId an attribute index to be computed + /// Computes the attribute value on the base of other attributes if the value + /// can be computed \param theAttributeId an attribute index to be computed /// \return a boolean value about it is computed - virtual bool compute(const std::string& /*theAttributeId*/) { return false; }; + virtual bool compute(const std::string & /*theAttributeId*/) { + return false; + }; /// Registers error during the execution, causes the ExecutionFailed state - MODELAPI_EXPORT virtual void setError(const std::string& theError, + MODELAPI_EXPORT virtual void setError(const std::string &theError, bool isSend = true, bool isTranslate = true); /// Returns error, arose during the execution - virtual std::string error() const { - return data()->error(); - } + virtual std::string error() const { return data()->error(); } /// returns the current results of the feature - MODELAPI_EXPORT const std::list >& results(); + MODELAPI_EXPORT const std::list> &results(); /// returns the first result in the list or NULL reference MODELAPI_EXPORT std::shared_ptr firstResult() const; /// returns the last result in the list or NULL reference MODELAPI_EXPORT std::shared_ptr lastResult(); /// sets the alone result - MODELAPI_EXPORT void setResult(const std::shared_ptr& theResult); - /// sets the result by index (zero based), results before this must be set before - MODELAPI_EXPORT void setResult(const std::shared_ptr& theResult, - const int theIndex); + MODELAPI_EXPORT void + setResult(const std::shared_ptr &theResult); + /// sets the result by index (zero based), results before this must be set + /// before + MODELAPI_EXPORT void + setResult(const std::shared_ptr &theResult, + const int theIndex); /// removes all results starting from the given index (zero-based) - /// \param theSinceIndex - index of the deleted result and all after also will be deleted - /// \param theForever - removes results for long period (not just because of feature disabling) - /// \param theFlush - if it is false, REDISPLAY message is not flushed + /// \param theSinceIndex - index of the deleted result and all after also will + /// be deleted \param theForever - removes results for long period (not just + /// because of feature disabling) \param theFlush - if it is false, REDISPLAY + /// message is not flushed MODELAPI_EXPORT void removeResults(const int theSinceIndex, - const bool theForever = true, const bool theFlush = true); + const bool theForever = true, + const bool theFlush = true); /// removes all results from the feature MODELAPI_EXPORT void eraseResults(const bool theForever = true); /// removes all fields from this feature: results, data, etc MODELAPI_EXPORT virtual void erase(); - /// removes the result from the list of feature (not doing in disabled): normally this - /// method is not used from features. only internally - MODELAPI_EXPORT void eraseResultFromList(const std::shared_ptr& theResult); + /// removes the result from the list of feature (not doing in disabled): + /// normally this method is not used from features. only internally + MODELAPI_EXPORT void + eraseResultFromList(const std::shared_ptr &theResult); - /// Returns true if result is persistent (stored in document) and on undo-redo, save-open - /// it is not needed to recompute it. - virtual bool isPersistentResult() {return true;} + /// Returns true if result is persistent (stored in document) and on + /// undo-redo, save-open it is not needed to recompute it. + virtual bool isPersistentResult() { return true; } /// Returns true if this feature must not be created: this is just an action - /// that is not stored in the features history and data model (like "delete part"). - virtual bool isAction() - { - return false; - } + /// that is not stored in the features history and data model (like "delete + /// part"). + virtual bool isAction() { return false; } - /// Returns true if this feature is used as macro: creates other features and then removed. - /// \returns false by default + /// Returns true if this feature is used as macro: creates other features and + /// then removed. \returns false by default MODELAPI_EXPORT virtual bool isMacro() const; - /// Returns true if preview update during the edition needed. Otherwise the update-mechanism - /// calls the \a execute function only on "apply" of the operation - /// \returns true by default + /// Returns true if preview update during the edition needed. Otherwise the + /// update-mechanism calls the \a execute function only on "apply" of the + /// operation \returns true by default MODELAPI_EXPORT virtual bool isPreviewNeeded() const; /// Must return document where the new feature must be added to - /// By default it is empty: it is added to the document this method is called to - MODELAPI_EXPORT virtual const std::string& documentToAdd(); + /// By default it is empty: it is added to the document this method is called + /// to + MODELAPI_EXPORT virtual const std::string &documentToAdd(); - /// Enables/disables the feature. The disabled feature has no results and does not participate in - /// any calculation. - /// \returns true if state is really changed + /// Enables/disables the feature. The disabled feature has no results and does + /// not participate in any calculation. \returns true if state is really + /// changed MODELAPI_EXPORT virtual bool setDisabled(const bool theFlag); /// Returns the feature is disabled or not. @@ -146,10 +146,11 @@ class ModelAPI_Feature : public ModelAPI_Object MODELAPI_EXPORT virtual ~ModelAPI_Feature(); /// Returns the feature by the object (result). - MODELAPI_EXPORT static std::shared_ptr feature(ObjectPtr theObject); + MODELAPI_EXPORT static std::shared_ptr + feature(ObjectPtr theObject); - /// Set the stable feature flag. If feature is currently editing then it is not stable. - /// \returns true if state is really changed + /// Set the stable feature flag. If feature is currently editing then it is + /// not stable. \returns true if state is really changed MODELAPI_EXPORT virtual bool setStable(const bool theFlag); /// Returns the feature is stable or not. @@ -158,97 +159,95 @@ class ModelAPI_Feature : public ModelAPI_Object /// Returns the feature is editable or not. Most of features are editable. MODELAPI_EXPORT virtual bool isEditable(); - /// Performs some custom feature specific functionality (normally called by some GUI button) - /// \param theActionId an action key - /// \return a boolean value about it is performed - MODELAPI_EXPORT virtual bool customAction(const std::string& theActionId); + /// Performs some custom feature specific functionality (normally called by + /// some GUI button) \param theActionId an action key \return a boolean value + /// about it is performed + MODELAPI_EXPORT virtual bool customAction(const std::string &theActionId); - // - // Helper methods, aliases for data()->method() - // ----------------------------------------------------------------------------------------------- + // + // Helper methods, aliases for data()->method() + // ----------------------------------------------------------------------------------------------- /// Returns the name stored in the attribute - inline std::wstring name() - { - return data()->name(); - } + inline std::wstring name() { return data()->name(); } /// Returns the Boolean attribute by the identifier - inline std::shared_ptr boolean(const std::string& theID) - { + inline std::shared_ptr + boolean(const std::string &theID) { return data()->boolean(theID); } /// Returns the document reference attribute - inline std::shared_ptr document(const std::string& theID) - { + inline std::shared_ptr + document(const std::string &theID) { return data()->document(theID); } /// Returns the real attribute by the identifier - inline std::shared_ptr real(const std::string& theID) - { + inline std::shared_ptr + real(const std::string &theID) { return data()->real(theID); } /// Returns the integer attribute by the identifier - inline std::shared_ptr integer(const std::string& theID) - { + inline std::shared_ptr + integer(const std::string &theID) { return data()->integer(theID); } /// Returns the integer array attribute by the identifier - inline std::shared_ptr intArray(const std::string& theID) - { + inline std::shared_ptr + intArray(const std::string &theID) { return data()->intArray(theID); } /// Returns the reference attribute by the identifier - inline std::shared_ptr refattr(const std::string& theID) - { + inline std::shared_ptr + refattr(const std::string &theID) { return data()->refattr(theID); } /// Returns the refattrlist attribute by the identifier - inline std::shared_ptr refattrlist(const std::string& theID) - { + inline std::shared_ptr + refattrlist(const std::string &theID) { return data()->refattrlist(theID); } /// Returns the reference attribute by the identifier - inline std::shared_ptr reference(const std::string& theID) - { + inline std::shared_ptr + reference(const std::string &theID) { return data()->reference(theID); } /// Returns the list of references attribute by the identifier - inline std::shared_ptr reflist(const std::string& theID) - { + inline std::shared_ptr + reflist(const std::string &theID) { return data()->reflist(theID); } /// Returns the shape selection attribute by the identifier - inline std::shared_ptr selection(const std::string& theID) - { + inline std::shared_ptr + selection(const std::string &theID) { return data()->selection(theID); } /// Returns the list of shape selections attribute by the identifier - inline std::shared_ptr selectionList(const std::string& theID) - { + inline std::shared_ptr + selectionList(const std::string &theID) { return data()->selectionList(theID); } /// Returns the string attribute by the identifier - inline std::shared_ptr string(const std::string& theID) - { + inline std::shared_ptr + string(const std::string &theID) { return data()->string(theID); } /// Returns the string array attribute by the identifier - inline std::shared_ptr stringArray(const std::string& theID) - { + inline std::shared_ptr + stringArray(const std::string &theID) { return data()->stringArray(theID); } /// Returns the tables attribute by the identifier - inline std::shared_ptr tables(const std::string& theID) - { + inline std::shared_ptr + tables(const std::string &theID) { return data()->tables(theID); } /// Returns the attribute by the identifier - inline std::shared_ptr attribute(const std::string& theID) - { + inline std::shared_ptr + attribute(const std::string &theID) { return data()->attribute(theID); } - protected: - /// This method is called just after creation of the object: it must initialize - /// all fields, normally initialized in the constructor + +protected: + /// This method is called just after creation of the object: it must + /// initialize all fields, normally initialized in the constructor MODELAPI_EXPORT virtual void init(); friend class Model_Document; @@ -258,8 +257,8 @@ class ModelAPI_Feature : public ModelAPI_Object //! Pointer on feature object typedef std::shared_ptr FeaturePtr; -//! An interface for performing special copy actions. To give feature which is moved (a group) -//! over this feature. +//! An interface for performing special copy actions. To give feature which is +//! moved (a group) over this feature. class ModelAPI_FeatureCopyInterface { public: virtual ~ModelAPI_FeatureCopyInterface() {} @@ -268,9 +267,10 @@ public: /// \param theContext the original context object /// \param theValue the original shape /// \param theCopies resulting copy-context will be appended here - virtual void getCopies(ObjectPtr theContext, std::shared_ptr theValue, - std::list& theCopyContext, - std::list >& theCopyVals) = 0; + virtual void + getCopies(ObjectPtr theContext, std::shared_ptr theValue, + std::list &theCopyContext, + std::list> &theCopyVals) = 0; }; #endif diff --git a/src/ModelAPI/ModelAPI_FeatureValidator.cpp b/src/ModelAPI/ModelAPI_FeatureValidator.cpp index b8a2c0470..b2fd16d26 100644 --- a/src/ModelAPI/ModelAPI_FeatureValidator.cpp +++ b/src/ModelAPI/ModelAPI_FeatureValidator.cpp @@ -14,22 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_FeatureValidator.h" -ModelAPI_FeatureValidator::ModelAPI_FeatureValidator() -{ +ModelAPI_FeatureValidator::ModelAPI_FeatureValidator() {} -} - -ModelAPI_FeatureValidator::~ModelAPI_FeatureValidator() -{ +ModelAPI_FeatureValidator::~ModelAPI_FeatureValidator() {} -} - -bool ModelAPI_FeatureValidator::isNotObligatory(std::string theFeature, std::string theAttribute) -{ +bool ModelAPI_FeatureValidator::isNotObligatory(std::string theFeature, + std::string theAttribute) { return false; -} \ No newline at end of file +} diff --git a/src/ModelAPI/ModelAPI_FeatureValidator.h b/src/ModelAPI/ModelAPI_FeatureValidator.h index eb24a450a..7f4589379 100644 --- a/src/ModelAPI/ModelAPI_FeatureValidator.h +++ b/src/ModelAPI/ModelAPI_FeatureValidator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_FeatureValidator_H @@ -27,13 +28,12 @@ * \ingroup DataModel * \brief The geneneric validator for the whole feature. * - * Can be redefined for some specific feature, but by default for each feature this validator is - * used: it checks each argument of the feature and if one of it is not valid (and obligatory), - * the hole feature is invalid. + * Can be redefined for some specific feature, but by default for each feature + * this validator is used: it checks each argument of the feature and if one of + * it is not valid (and obligatory), the hole feature is invalid. */ -class MODELAPI_EXPORT ModelAPI_FeatureValidator : public ModelAPI_Validator -{ - public: +class MODELAPI_EXPORT ModelAPI_FeatureValidator : public ModelAPI_Validator { +public: /// Default constructor ModelAPI_FeatureValidator(); /// Virtual destructor @@ -41,15 +41,17 @@ class MODELAPI_EXPORT ModelAPI_FeatureValidator : public ModelAPI_Validator /// Returns true if feature and/or attributes are valid /// \param theFeature the validated feature - /// \param theArguments list of string, feature attribute names: dependent attributes - /// \param theError the error string message if validation fails - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const = 0; + /// \param theArguments list of string, feature attribute names: dependent + /// attributes \param theError the error string message if validation fails + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const = 0; - /// Returns true if the attribute in feature is not obligatory for the feature execution. - ///Returns false by default. - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + /// Returns true if the attribute in feature is not obligatory for the feature + /// execution. + /// Returns false by default. + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; #endif diff --git a/src/ModelAPI/ModelAPI_Filter.cpp b/src/ModelAPI/ModelAPI_Filter.cpp index b9473a398..4b4173e26 100644 --- a/src/ModelAPI/ModelAPI_Filter.cpp +++ b/src/ModelAPI/ModelAPI_Filter.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Filter.h" @@ -23,8 +24,8 @@ #include -std::string ModelAPI_Filter::xmlFromFile(const std::string& theConfigFile) const -{ +std::string +ModelAPI_Filter::xmlFromFile(const std::string &theConfigFile) const { std::string aXmlRepresentation; std::string aFullPath = Config_XMLReader::findConfigFile(theConfigFile); if (!aFullPath.empty()) { diff --git a/src/ModelAPI/ModelAPI_Filter.h b/src/ModelAPI/ModelAPI_Filter.h index cfd0dc6c6..4c7b477af 100644 --- a/src/ModelAPI/ModelAPI_Filter.h +++ b/src/ModelAPI/ModelAPI_Filter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Filter_H_ @@ -25,30 +26,26 @@ #include - /**\class ModelAPI_ViewFilter -* \ingroup DataModel -* \brief A general interface class filters definition -*/ -class ModelAPI_Filter -{ + * \ingroup DataModel + * \brief A general interface class filters definition + */ +class ModelAPI_Filter { public: virtual ~ModelAPI_Filter() {} /// Returns name of the filter to represent it in GUI - virtual const std::string& name() const = 0; + virtual const std::string &name() const = 0; /// Returns true if the given shape type is supported virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const = 0; - /// This method should contain the filter logic. It returns true if the given shape - /// is accepted by the filter. - /// \param theShape the given shape - /// \param theResult parent result of the shape to be checked - /// \param theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr& theShape, - const ResultPtr& theResult, - const ModelAPI_FiltersArgs& theArgs) const = 0; + /// This method should contain the filter logic. It returns true if the given + /// shape is accepted by the filter. \param theShape the given shape \param + /// theResult parent result of the shape to be checked \param theArgs + /// arguments of the filter + virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const = 0; /// Returns True if the filter can be used several times within one filtering virtual bool isMultiple() const { return false; } @@ -57,13 +54,14 @@ public: /// By default it returns nothing (no GUI) virtual std::string xmlRepresentation() const { return ""; } - /// Initializes arguments of a filter. If a filter has no arguments, this method may be - /// not redefined. - virtual void initAttributes(ModelAPI_FiltersArgs& /*theArguments*/) {} + /// Initializes arguments of a filter. If a filter has no arguments, this + /// method may be not redefined. + virtual void initAttributes(ModelAPI_FiltersArgs & /*theArguments*/) {} /// Returns XML string which represents GUI of the filter /// by reading corresponding XML file. - MODELAPI_EXPORT virtual std::string xmlFromFile(const std::string& theConfigFile) const; + MODELAPI_EXPORT virtual std::string + xmlFromFile(const std::string &theConfigFile) const; private: bool myIsReverse; @@ -71,4 +69,4 @@ private: typedef std::shared_ptr FilterPtr; -#endif \ No newline at end of file +#endif diff --git a/src/ModelAPI/ModelAPI_FiltersArgs.h b/src/ModelAPI/ModelAPI_FiltersArgs.h index 7d7dc40cd..5c9f9be56 100644 --- a/src/ModelAPI/ModelAPI_FiltersArgs.h +++ b/src/ModelAPI/ModelAPI_FiltersArgs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_FiltersArgs_H_ @@ -31,13 +32,15 @@ static const std::string kFilterSeparator = "__"; class ModelAPI_FiltersArgs { /// a map from the FilterID+AttributeID -> attribute std::map myMap; - std::string myCurrentFilter; ///< ID of the filter that will take attributes now - FiltersFeaturePtr myFeature; ///< the feature is stored to minimize initAttribute interface + std::string + myCurrentFilter; ///< ID of the filter that will take attributes now + FiltersFeaturePtr + myFeature; ///< the feature is stored to minimize initAttribute interface public: ModelAPI_FiltersArgs() {} /// Sets the current filter ID - void setFilter(const std::string& theFilterID) { + void setFilter(const std::string &theFilterID) { myCurrentFilter = theFilterID; } @@ -52,16 +55,17 @@ public: } /// returns the argument of the current filter by the argument id - AttributePtr argument(const std::string& theID) const { + AttributePtr argument(const std::string &theID) const { return myMap.find(myCurrentFilter + kFilterSeparator + theID)->second; } /// adds an attribute of the filter - std::shared_ptr initAttribute( - const std::string& theID, const std::string theAttrType) { - AttributePtr aR = myFeature->data()->addFloatingAttribute(theID, theAttrType, myCurrentFilter); + std::shared_ptr + initAttribute(const std::string &theID, const std::string theAttrType) { + AttributePtr aR = myFeature->data()->addFloatingAttribute( + theID, theAttrType, myCurrentFilter); aR->setIsArgument(false); // to avoid parametric update return aR; } }; -#endif \ No newline at end of file +#endif diff --git a/src/ModelAPI/ModelAPI_FiltersFactory.h b/src/ModelAPI/ModelAPI_FiltersFactory.h index 8198c7db4..6c863848d 100644 --- a/src/ModelAPI/ModelAPI_FiltersFactory.h +++ b/src/ModelAPI/ModelAPI_FiltersFactory.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_FiltersFactory_H_ @@ -26,37 +27,34 @@ #include - /**\class ModelAPI_FiltersFactory -* \ingroup DataModel -* \brief Manages registering of filters -*/ -class ModelAPI_FiltersFactory -{ + * \ingroup DataModel + * \brief Manages registering of filters + */ +class ModelAPI_FiltersFactory { public: virtual ~ModelAPI_FiltersFactory() {} /// Register an instance of a filter - /// \param theID unique identifier of the filter, not necessary equal to the name of filter - /// \param theFilter the filter's instance - virtual void registerFilter(const std::string& theID, ModelAPI_Filter* theFilter) = 0; + /// \param theID unique identifier of the filter, not necessary equal to the + /// name of filter \param theFilter the filter's instance + virtual void registerFilter(const std::string &theID, + ModelAPI_Filter *theFilter) = 0; - /// Returns true if all filters of the Filters feature are ok for the Shape (taking into account - /// the Reversed states). - /// \param theFiltersFeature feature that contains all information about the filters - /// \param theResult parent result of the shape to check - /// \param theShape the checked shape - virtual bool isValid(FeaturePtr theFiltersFeature, - ResultPtr theResult, + /// Returns true if all filters of the Filters feature are ok for the Shape + /// (taking into account the Reversed states). \param theFiltersFeature + /// feature that contains all information about the filters \param theResult + /// parent result of the shape to check \param theShape the checked shape + virtual bool isValid(FeaturePtr theFiltersFeature, ResultPtr theResult, GeomShapePtr theShape) = 0; /// Returns list of all shapes and subshapes in the study, satisfying /// criteria of all filters of \a theFilterFeature. - /// \param theFiltersFeature feature that contains all information about the filters - /// \param theShapeType the type of sub-shapes to find - virtual std::list< std::pair > select - (const FiltersFeaturePtr& theFilterFeature, - const GeomAPI_Shape::ShapeType theShapeType) = 0; + /// \param theFiltersFeature feature that contains all information about the + /// filters \param theShapeType the type of sub-shapes to find + virtual std::list> + select(const FiltersFeaturePtr &theFilterFeature, + const GeomAPI_Shape::ShapeType theShapeType) = 0; /// Returns the filters that support the given shape type virtual std::list filters(GeomAPI_Shape::ShapeType theType) = 0; diff --git a/src/ModelAPI/ModelAPI_FiltersFeature.h b/src/ModelAPI/ModelAPI_FiltersFeature.h index fce4225cb..acd4120d5 100644 --- a/src/ModelAPI/ModelAPI_FiltersFeature.h +++ b/src/ModelAPI/ModelAPI_FiltersFeature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_FiltersFeature_H_ @@ -23,14 +24,13 @@ #include "ModelAPI_Attribute.h" #include "ModelAPI_Feature.h" - /**\class ModelAPI_FiltersFeature -* \ingroup DataModel -* \brief An interface for working with filters in the feature. A filters feature must inherit it -* in order to allow management of filters in the feature data structure. -*/ -class ModelAPI_FiltersFeature: public ModelAPI_Feature -{ + * \ingroup DataModel + * \brief An interface for working with filters in the feature. A filters + * feature must inherit it in order to allow management of filters in the + * feature data structure. + */ +class ModelAPI_FiltersFeature : public ModelAPI_Feature { public: /// Adds a filter to the feature. Also initializes arguments of this filter. /// Returns the real identifier of the filter. @@ -43,22 +43,25 @@ public: virtual std::list filters() const = 0; /// Stores the reversed flag for the filter. - virtual void setReversed(const std::string theFilterID, const bool theReversed) = 0; + virtual void setReversed(const std::string theFilterID, + const bool theReversed) = 0; /// Returns the reversed flag value for the filter. virtual bool isReversed(const std::string theFilterID) = 0; /// Returns the ordered list of attributes related to the filter. - virtual std::list filterArgs(const std::string theFilterID) const = 0; + virtual std::list + filterArgs(const std::string theFilterID) const = 0; - /// Sets the attribute (not-persistent field) that contains this filters feature. - /// The filter feature may make synchronization by this method call. - virtual void setAttribute(const AttributePtr& theAttr) = 0; + /// Sets the attribute (not-persistent field) that contains this filters + /// feature. The filter feature may make synchronization by this method call. + virtual void setAttribute(const AttributePtr &theAttr) = 0; - /// Returns the attribute (not-persistent field) that contains this filters feature. - virtual const AttributePtr& baseAttribute() const = 0; + /// Returns the attribute (not-persistent field) that contains this filters + /// feature. + virtual const AttributePtr &baseAttribute() const = 0; }; typedef std::shared_ptr FiltersFeaturePtr; -#endif \ No newline at end of file +#endif diff --git a/src/ModelAPI/ModelAPI_Folder.cpp b/src/ModelAPI/ModelAPI_Folder.cpp index aca532a02..16e5eb0db 100644 --- a/src/ModelAPI/ModelAPI_Folder.cpp +++ b/src/ModelAPI/ModelAPI_Folder.cpp @@ -14,43 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Folder.h" #include -ModelAPI_Folder::ModelAPI_Folder() -{ -} +ModelAPI_Folder::ModelAPI_Folder() {} -ModelAPI_Folder::~ModelAPI_Folder() -{ -} +ModelAPI_Folder::~ModelAPI_Folder() {} -void ModelAPI_Folder::init() -{ -} +void ModelAPI_Folder::init() {} -void ModelAPI_Folder::initAttributes() -{ - data()->addAttribute(FIRST_FEATURE_ID(), ModelAPI_AttributeReference::typeId()); - data()->addAttribute(LAST_FEATURE_ID(), ModelAPI_AttributeReference::typeId()); +void ModelAPI_Folder::initAttributes() { + data()->addAttribute(FIRST_FEATURE_ID(), + ModelAPI_AttributeReference::typeId()); + data()->addAttribute(LAST_FEATURE_ID(), + ModelAPI_AttributeReference::typeId()); } -void ModelAPI_Folder::execute() -{ -} +void ModelAPI_Folder::execute() {} -std::shared_ptr ModelAPI_Folder::lastVisibleFeature() -{ +std::shared_ptr ModelAPI_Folder::lastVisibleFeature() { FeaturePtr aResult; AttributeReferencePtr aLastFeatAttr = data()->reference(LAST_FEATURE_ID()); if (!aLastFeatAttr.get()) return aResult; aResult = ModelAPI_Feature::feature(aLastFeatAttr->value()); - while(aResult.get() && !aResult->isInHistory()) { // searching for previous feature + while (aResult.get() && + !aResult->isInHistory()) { // searching for previous feature aResult = aResult->document()->nextFeature(aResult, true); } return aResult; diff --git a/src/ModelAPI/ModelAPI_Folder.h b/src/ModelAPI/ModelAPI_Folder.h index 76b0a2242..a85b1c00a 100644 --- a/src/ModelAPI/ModelAPI_Folder.h +++ b/src/ModelAPI/ModelAPI_Folder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Folder_H_ @@ -27,68 +28,57 @@ * \ingroup DataModel * \brief Folder feature (groups the features). */ -class ModelAPI_Folder : public ModelAPI_Object -{ +class ModelAPI_Folder : public ModelAPI_Object { public: MODELAPI_EXPORT ModelAPI_Folder(); /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_Folder(); /// Folder feature ID - static const std::string& ID() - { + static const std::string &ID() { static const std::string MY_FOLDER_ID("Folder"); return MY_FOLDER_ID; } /// Returns the group identifier of all features - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Folders"; return MY_GROUP; } /// Returns the group identifier of this result - virtual std::string groupName() - { - return group(); - } + virtual std::string groupName() { return group(); } /// Attribute referring first feature in the folder - static const std::string& FIRST_FEATURE_ID() - { + static const std::string &FIRST_FEATURE_ID() { static const std::string MY_FIRST_FEATURE_ID("first_feature"); return MY_FIRST_FEATURE_ID; } /// Attribute referring last feature in the folder - static const std::string& LAST_FEATURE_ID() - { + static const std::string &LAST_FEATURE_ID() { static const std::string MY_LAST_FEATURE_ID("last_feature"); return MY_LAST_FEATURE_ID; } - /// Request for initialization of data model of the object: adding all attributes + /// Request for initialization of data model of the object: adding all + /// attributes MODELAPI_EXPORT virtual void initAttributes(); /// Computes or recomputes the results MODELAPI_EXPORT virtual void execute(); /// Returns the feature is disabled or not. - virtual bool isDisabled() - { return false; } + virtual bool isDisabled() { return false; } // // Helper methods, aliases for data()->method() // ----------------------------------------------------------------------------------------------- /// Returns the name stored in the attribute - inline std::wstring name() - { - return data()->name(); - } + inline std::wstring name() { return data()->name(); } /// Returns the reference attribute by the identifier - inline std::shared_ptr reference(const std::string& theID) - { + inline std::shared_ptr + reference(const std::string &theID) { return data()->reference(theID); } @@ -97,8 +87,8 @@ public: MODELAPI_EXPORT std::shared_ptr lastVisibleFeature(); protected: - /// This method is called just after creation of the object: it must initialize - /// all fields, normally initialized in the constructor + /// This method is called just after creation of the object: it must + /// initialize all fields, normally initialized in the constructor MODELAPI_EXPORT virtual void init(); }; diff --git a/src/ModelAPI/ModelAPI_IReentrant.cpp b/src/ModelAPI/ModelAPI_IReentrant.cpp index f8041f117..a61aa7b5e 100644 --- a/src/ModelAPI/ModelAPI_IReentrant.cpp +++ b/src/ModelAPI/ModelAPI_IReentrant.cpp @@ -14,11 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -ModelAPI_IReentrant::~ModelAPI_IReentrant() -{ -} +ModelAPI_IReentrant::~ModelAPI_IReentrant() {} diff --git a/src/ModelAPI/ModelAPI_IReentrant.h b/src/ModelAPI/ModelAPI_IReentrant.h index bf192486e..890d609e8 100644 --- a/src/ModelAPI/ModelAPI_IReentrant.h +++ b/src/ModelAPI/ModelAPI_IReentrant.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_IReentrant_H @@ -22,8 +23,8 @@ #include "ModelAPI.h" -#include #include +#include class Events_Message; @@ -31,15 +32,15 @@ class Events_Message; * \ingroup DataModel * \brief Interface of a class which can process specific messages */ -class ModelAPI_IReentrant -{ +class ModelAPI_IReentrant { public: MODELAPI_EXPORT virtual ~ModelAPI_IReentrant(); /// Apply information of the message to current object. /// \param theMessage a container of information /// \return a next active attribute name - virtual std::string processEvent(const std::shared_ptr& theMessage) = 0; + virtual std::string + processEvent(const std::shared_ptr &theMessage) = 0; }; typedef std::shared_ptr ModelReentrantPtr; diff --git a/src/ModelAPI/ModelAPI_Object.cpp b/src/ModelAPI/ModelAPI_Object.cpp index 371b72ff3..2fd020206 100644 --- a/src/ModelAPI/ModelAPI_Object.cpp +++ b/src/ModelAPI/ModelAPI_Object.cpp @@ -14,17 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Object.h" -#include "ModelAPI_Document.h" #include "ModelAPI_Data.h" +#include "ModelAPI_Document.h" #include "ModelAPI_Events.h" #include -bool ModelAPI_Object::isInHistory() -{ +bool ModelAPI_Object::isInHistory() { if (myData->isValid()) { return myData->isInHistory(); } @@ -32,8 +32,7 @@ bool ModelAPI_Object::isInHistory() } void ModelAPI_Object::setInHistory( - const std::shared_ptr theObject, const bool theFlag) -{ + const std::shared_ptr theObject, const bool theFlag) { if (isInHistory() != theFlag) { if (myData->isValid()) { myData->setIsInHistory(theFlag); @@ -42,56 +41,39 @@ void ModelAPI_Object::setInHistory( } } -std::shared_ptr ModelAPI_Object::data() const -{ - return myData; -} +std::shared_ptr ModelAPI_Object::data() const { return myData; } -bool ModelAPI_Object::isSame(const std::shared_ptr& theObject) -{ +bool ModelAPI_Object::isSame( + const std::shared_ptr &theObject) { return theObject.get() == this; } -std::shared_ptr ModelAPI_Object::document() const -{ +std::shared_ptr ModelAPI_Object::document() const { return myDoc; } -void ModelAPI_Object::attributeChanged(const std::string& /*theID*/) -{ -} +void ModelAPI_Object::attributeChanged(const std::string & /*theID*/) {} -ModelAPI_Object::ModelAPI_Object() -{ -} +ModelAPI_Object::ModelAPI_Object() {} -ModelAPI_Object::~ModelAPI_Object() -{ -} +ModelAPI_Object::~ModelAPI_Object() {} -void ModelAPI_Object::setData(std::shared_ptr theData) -{ +void ModelAPI_Object::setData(std::shared_ptr theData) { myData = theData; } -void ModelAPI_Object::setDoc(std::shared_ptr theDoc) -{ +void ModelAPI_Object::setDoc(std::shared_ptr theDoc) { myDoc = theDoc; } -void ModelAPI_Object::erase() -{ +void ModelAPI_Object::erase() { if (myData->isValid() && myData != myData->invalidPtr()) myData->erase(); setData(myData->invalidPtr()); } -bool ModelAPI_Object::isDisplayed() -{ - return myData->isDisplayed(); -} +bool ModelAPI_Object::isDisplayed() { return myData->isDisplayed(); } -void ModelAPI_Object::setDisplayed(const bool theDisplay) -{ +void ModelAPI_Object::setDisplayed(const bool theDisplay) { myData->setDisplayed(theDisplay); } diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 46c3f34f8..2f3c45215 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Object_H_ @@ -29,7 +30,8 @@ class ModelAPI_Data; class ModelAPI_Document; -// sometimes it is useful for debug to see name of each object (bad for memory and performance) +// sometimes it is useful for debug to see name of each object (bad for memory +// and performance) //#define DEBUG_NAMES /**\class ModelAPI_Object @@ -37,15 +39,15 @@ class ModelAPI_Document; * \brief Represents any object in the data model and in the object browser. * * It may be feature or result of the feature. User just may set name for it - * or change this name later. Generic class for Feature, Body, Parameter and other - * objects related to the features and their results. Contains attributes of this - * object in the "Data". + * or change this name later. Generic class for Feature, Body, Parameter and + * other objects related to the features and their results. Contains attributes + * of this object in the "Data". */ -class ModelAPI_Object: public ModelAPI_Entity -{ - std::shared_ptr myData; ///< manager of the data model of a feature - std::shared_ptr myDoc; ///< document this object belongs to - public: +class ModelAPI_Object : public ModelAPI_Entity { + std::shared_ptr + myData; ///< manager of the data model of a feature + std::shared_ptr myDoc; ///< document this object belongs to +public: #ifdef DEBUG_NAMES std::wstring myName; // name of this object #endif @@ -55,14 +57,16 @@ class ModelAPI_Object: public ModelAPI_Entity /// Makes object presented or not in the history of the created objects /// \param theObject is shared pointer to "this" /// \param theFlag is boolean value: to add or remove from the history - MODELAPI_EXPORT virtual void setInHistory( - const std::shared_ptr theObject, const bool theFlag); + MODELAPI_EXPORT virtual void + setInHistory(const std::shared_ptr theObject, + const bool theFlag); /// Returns the data manager of this object: attributes MODELAPI_EXPORT virtual std::shared_ptr data() const; /// Returns true if object refers to the same data model instance - MODELAPI_EXPORT virtual bool isSame(const std::shared_ptr& theObject); + MODELAPI_EXPORT virtual bool + isSame(const std::shared_ptr &theObject); /// Returns document this feature belongs to MODELAPI_EXPORT virtual std::shared_ptr document() const; @@ -70,20 +74,21 @@ class ModelAPI_Object: public ModelAPI_Entity /// Returns the group identifier of this object virtual std::string groupName() = 0; - /// Request for initialization of data model of the object: adding all attributes + /// Request for initialization of data model of the object: adding all + /// attributes virtual void initAttributes() = 0; /// Returns the feature is disabled or not. virtual bool isDisabled() = 0; /// Returns the parameters of color definition in the resources config manager - virtual void colorConfigInfo(std::string& /*theSection*/, - std::string& /*theName*/, - std::string& /*theDefault*/) {} + virtual void colorConfigInfo(std::string & /*theSection*/, + std::string & /*theName*/, + std::string & /*theDefault*/) {} /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID); + MODELAPI_EXPORT virtual void attributeChanged(const std::string &theID); /// Initializes the default states of the object MODELAPI_EXPORT ModelAPI_Object(); @@ -91,30 +96,28 @@ class ModelAPI_Object: public ModelAPI_Entity /// To use virtuality for destructors MODELAPI_EXPORT virtual ~ModelAPI_Object(); - /// Returns true if object must be displayed in the viewer: flag is stored in the - /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps - /// the original state in the current transaction. + /// Returns true if object must be displayed in the viewer: flag is stored in + /// the data model, so on undo/redo, open/save or recreation of object by + /// history-playing it keeps the original state in the current transaction. MODELAPI_EXPORT virtual bool isDisplayed(); - /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" - /// signal. + /// Sets the displayed/hidden state of the object. If it is changed, sends the + /// "redisplay" signal. MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); - MODELAPI_EXPORT virtual bool hasTexture() - { - return false; - } + MODELAPI_EXPORT virtual bool hasTexture() { return false; } - protected: - /// This method is called just after creation of the object: it must initialize - /// all fields, normally initialized in the constructor +protected: + /// This method is called just after creation of the object: it must + /// initialize all fields, normally initialized in the constructor MODELAPI_EXPORT virtual void init() = 0; /// Sets the data manager of an object (document does) MODELAPI_EXPORT virtual void setData(std::shared_ptr theData); /// Sets the data manager of an object (document does) - MODELAPI_EXPORT virtual void setDoc(std::shared_ptr theDoc); + MODELAPI_EXPORT virtual void + setDoc(std::shared_ptr theDoc); /// removes all fields from this feature MODELAPI_EXPORT virtual void erase(); @@ -122,7 +125,6 @@ class ModelAPI_Object: public ModelAPI_Entity friend class Model_Objects; friend class ModelAPI_Feature; friend class Model_Document; - }; typedef std::shared_ptr ObjectPtr; diff --git a/src/ModelAPI/ModelAPI_Plugin.cpp b/src/ModelAPI/ModelAPI_Plugin.cpp index 3e0ffaf9c..fc74d5358 100644 --- a/src/ModelAPI/ModelAPI_Plugin.cpp +++ b/src/ModelAPI/ModelAPI_Plugin.cpp @@ -14,12 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Plugin.h" -ModelAPI_Plugin::~ModelAPI_Plugin() -{ - -} +ModelAPI_Plugin::~ModelAPI_Plugin() {} diff --git a/src/ModelAPI/ModelAPI_Plugin.h b/src/ModelAPI/ModelAPI_Plugin.h index 6b7aa5958..20faa0a2c 100644 --- a/src/ModelAPI/ModelAPI_Plugin.h +++ b/src/ModelAPI/ModelAPI_Plugin.h @@ -14,27 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Plugin_H_ #define ModelAPI_Plugin_H_ #include "ModelAPI.h" -#include #include +#include class ModelAPI_Feature; /**\class ModelAPI_Plugin * \ingroup DataModel - * \brief Interface common for any plugin: allows to use plugin by the plugins manager. + * \brief Interface common for any plugin: allows to use plugin by the plugins + * manager. */ -class MODELAPI_EXPORT ModelAPI_Plugin -{ - public: +class MODELAPI_EXPORT ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID - virtual std::shared_ptr createFeature(std::string theFeatureID) = 0; + virtual std::shared_ptr + createFeature(std::string theFeatureID) = 0; /// To virtually destroy the fields of successors virtual ~ModelAPI_Plugin(); diff --git a/src/ModelAPI/ModelAPI_Result.cpp b/src/ModelAPI/ModelAPI_Result.cpp index c0b171631..134374fa5 100644 --- a/src/ModelAPI/ModelAPI_Result.cpp +++ b/src/ModelAPI/ModelAPI_Result.cpp @@ -14,109 +14,122 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_Result.h" -#include -#include #include -#include -#include #include +#include +#include +#include +#include #include -ModelAPI_Result::~ModelAPI_Result() -{ -} +ModelAPI_Result::~ModelAPI_Result() {} -void ModelAPI_Result::initAttributes() -{ - // append the color attribute. It is empty, the attribute will be filled by a request +void ModelAPI_Result::initAttributes() { + // append the color attribute. It is empty, the attribute will be filled by a + // request DataPtr aData = data(); - aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId())->setIsArgument(false); - aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false); - aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false); - aData->addAttribute(ISO_LINES_ID(), ModelAPI_AttributeIntArray::typeId())->setIsArgument(false); - aData->addAttribute(SHOW_ISO_LINES_ID(), ModelAPI_AttributeBoolean::typeId())->setIsArgument(false); - aData->addAttribute(SHOW_EDGES_DIRECTION_ID(), ModelAPI_AttributeBoolean::typeId())->setIsArgument(false); - // Add the "Bring To Front" attribute to the Result base class, as we may support it in the future - // for all type of results. Actually, only ResultGroups are supported. - aData->addAttribute(BRING_TO_FRONT_ID(), ModelAPI_AttributeBoolean::typeId())->setIsArgument(false); + aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId()) + ->setIsArgument(false); + aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId()) + ->setIsArgument(false); + aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId()) + ->setIsArgument(false); + aData->addAttribute(ISO_LINES_ID(), ModelAPI_AttributeIntArray::typeId()) + ->setIsArgument(false); + aData->addAttribute(SHOW_ISO_LINES_ID(), ModelAPI_AttributeBoolean::typeId()) + ->setIsArgument(false); + aData + ->addAttribute(SHOW_EDGES_DIRECTION_ID(), + ModelAPI_AttributeBoolean::typeId()) + ->setIsArgument(false); + // Add the "Bring To Front" attribute to the Result base class, as we may + // support it in the future for all type of results. Actually, only + // ResultGroups are supported. + aData->addAttribute(BRING_TO_FRONT_ID(), ModelAPI_AttributeBoolean::typeId()) + ->setIsArgument(false); } -bool ModelAPI_Result::setDisabled(std::shared_ptr theThis, const bool theFlag) -{ +bool ModelAPI_Result::setDisabled(std::shared_ptr theThis, + const bool theFlag) { if (myIsDisabled != theFlag) { myIsDisabled = theFlag; if (data()->isValid()) - data()->setIsDeleted(theFlag); // store it in data model (to get back on undo/redo, etc) - // this must be before "updated" message send to have history updated for OB update - document()->updateHistory(groupName()); // to update the history cash data in the document + data()->setIsDeleted( + theFlag); // store it in data model (to get back on undo/redo, etc) + // this must be before "updated" message send to have history updated for OB + // update + document()->updateHistory( + groupName()); // to update the history cash data in the document // generate related events - static Events_Loop* aLoop = Events_Loop::loop(); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static Events_Loop *aLoop = Events_Loop::loop(); + static const ModelAPI_EventCreator *aECreator = + ModelAPI_EventCreator::get(); if (myIsDisabled) { // disabled result looks like removed aECreator->sendDeleted(document(), groupName()); } else { // un-disabled equals to created static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); - aECreator->sendUpdated(theThis, anEvent /*, false*/); // flush is in setCurrentFeature + aECreator->sendUpdated( + theThis, anEvent /*, false*/); // flush is in setCurrentFeature } static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - aECreator->sendUpdated(theThis, EVENT_DISP/*, false*/); // flush is in setCurrentFeature + aECreator->sendUpdated( + theThis, EVENT_DISP /*, false*/); // flush is in setCurrentFeature return true; } return false; } -bool ModelAPI_Result::isDisabled() -{ +bool ModelAPI_Result::isDisabled() { if (data()->isValid() && myIsDisabled != data()->isDeleted()) - setDisabled(std::dynamic_pointer_cast( - data()->owner()), data()->isDeleted()); // restore from the data model the correct value + setDisabled( + std::dynamic_pointer_cast(data()->owner()), + data()->isDeleted()); // restore from the data model the correct value return myIsDisabled; } -bool ModelAPI_Result::isConcealed() -{ - return myIsConcealed; -} +bool ModelAPI_Result::isConcealed() { return myIsConcealed; } -void ModelAPI_Result::setIsConcealed(const bool theValue, const bool /*theForced*/) -{ +void ModelAPI_Result::setIsConcealed(const bool theValue, + const bool /*theForced*/) { if (myIsConcealed != theValue) { myIsConcealed = theValue; if (document().get()) { // can be on creation of result - document()->updateHistory(groupName()); // to update the history cash data in the document + document()->updateHistory( + groupName()); // to update the history cash data in the document if (myIsConcealed) { ModelAPI_EventCreator::get()->sendDeleted(document(), groupName()); - static Events_ID kDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID kDispEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), kDispEvent); } else { - static Events_ID kEventCreated = Events_Loop::eventByName(EVENT_OBJECT_CREATED); - ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), kEventCreated); + static Events_ID kEventCreated = + Events_Loop::eventByName(EVENT_OBJECT_CREATED); + ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), + kEventCreated); } } } } - -std::shared_ptr ModelAPI_Result::shape() -{ +std::shared_ptr ModelAPI_Result::shape() { return std::shared_ptr(); } -void ModelAPI_Result::attributeChanged(const std::string& theID) -{ - static Events_Loop* aLoop = Events_Loop::loop(); +void ModelAPI_Result::attributeChanged(const std::string &theID) { + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->attribute(theID)->owner(), EVENT_DISP); } -void ModelAPI_Result::init() -{ - myIsDisabled = true; // by default it is not initialized and false to be after created +void ModelAPI_Result::init() { + myIsDisabled = + true; // by default it is not initialized and false to be after created myIsConcealed = false; } diff --git a/src/ModelAPI/ModelAPI_Result.h b/src/ModelAPI/ModelAPI_Result.h index 319b17da4..07ff3e4d3 100644 --- a/src/ModelAPI/ModelAPI_Result.h +++ b/src/ModelAPI/ModelAPI_Result.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Result_H_ @@ -31,89 +32,86 @@ class ModelAPI_Feature; * * A generic class that . */ -class ModelAPI_Result : public ModelAPI_Object -{ - bool myIsConcealed; ///< the result is concealed from the data tree (referenced by other objects) - protected: - bool myIsDisabled; ///< the result is disabled: removed for the user, but keeps the general info - public: - +class ModelAPI_Result : public ModelAPI_Object { + bool myIsConcealed; ///< the result is concealed from the data tree + ///< (referenced by other objects) +protected: + bool myIsDisabled; ///< the result is disabled: removed for the user, but + ///< keeps the general info +public: /// Reference to the color of the result. - /// The integer array is used. It contains three values for red, green and blue values. - /// The values are in [0, 255] range - inline static const std::string& COLOR_ID() - { + /// The integer array is used. It contains three values for red, green and + /// blue values. The values are in [0, 255] range + inline static const std::string &COLOR_ID() { static const std::string MY_COLOR_ID("Color"); return MY_COLOR_ID; } /// Reference to the deflection of the result. /// The double value is used. The value is in [0, 1] range - inline static const std::string& DEFLECTION_ID() - { + inline static const std::string &DEFLECTION_ID() { static const std::string MY_DEFLECTION_ID("Deflection"); return MY_DEFLECTION_ID; } /// Reference to the transparency of the result. /// The double value is used. The value is in [0, 1] range - inline static const std::string& TRANSPARENCY_ID() - { + inline static const std::string &TRANSPARENCY_ID() { static const std::string MY_TRANSPARENCY_ID("Transparency"); return MY_TRANSPARENCY_ID; } /// Reference to the transparency of the result. /// The double value is used. The value is in [0, 1] range - inline static const std::string& ISO_LINES_ID() - { + inline static const std::string &ISO_LINES_ID() { static const std::string MY_ISO_LINES_ID("Iso_lines"); return MY_ISO_LINES_ID; } /// Reference to the transparency of the result. /// The double value is used. The value is in [0, 1] range - inline static const std::string& SHOW_ISO_LINES_ID() - { + inline static const std::string &SHOW_ISO_LINES_ID() { static const std::string MY_SHOW_ISO_LINES_ID("Show_Iso_lines"); return MY_SHOW_ISO_LINES_ID; } /// Reference to the transparency of the result. /// The double value is used. The value is in [0, 1] range - inline static const std::string& SHOW_EDGES_DIRECTION_ID() - { + inline static const std::string &SHOW_EDGES_DIRECTION_ID() { static const std::string MY_SHOW_EDGES_DIRECTION_ID("Show_Edges_direction"); return MY_SHOW_EDGES_DIRECTION_ID; } /// Reference to the BringToFront flag of the result. /// The bool value is used. - inline static const std::string& BRING_TO_FRONT_ID() - { + inline static const std::string &BRING_TO_FRONT_ID() { static const std::string MY_BRING_TO_FRONT_ID("Bring_To_Front"); return MY_BRING_TO_FRONT_ID; } - /// Returns true if the result is concealed from the data tree (referenced by other objects) + /// Returns true if the result is concealed from the data tree (referenced by + /// other objects) MODELAPI_EXPORT virtual bool isConcealed(); - /// Sets the result as concealed in the data tree (referenced by other objects) - MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false); + /// Sets the result as concealed in the data tree (referenced by other + /// objects) + MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue, + const bool theForced = false); - /// Enables/disables the result. The disabled result does not participate in any calculation - /// and visualization: like it was removed. But it keeps the general parameters: colors, - /// visibility, etc. - /// \param theThis pointer to this object, needed to generate all events if it is necessary - /// \param theFlag makes disabled if it is true - /// \returns true if state is really changed - MODELAPI_EXPORT virtual bool setDisabled(std::shared_ptr theThis, - const bool theFlag); + /// Enables/disables the result. The disabled result does not participate in + /// any calculation and visualization: like it was removed. But it keeps the + /// general parameters: colors, visibility, etc. \param theThis pointer to + /// this object, needed to generate all events if it is necessary \param + /// theFlag makes disabled if it is true \returns true if state is really + /// changed + MODELAPI_EXPORT virtual bool + setDisabled(std::shared_ptr theThis, const bool theFlag); /// Returns the result is disabled or not. MODELAPI_EXPORT virtual bool isDisabled(); - /// Request for initialization of data model of the result: adding all attributes + /// Request for initialization of data model of the result: adding all + /// attributes MODELAPI_EXPORT virtual void initAttributes(); /// To virtually destroy the fields of successors @@ -123,15 +121,16 @@ class ModelAPI_Result : public ModelAPI_Object MODELAPI_EXPORT virtual std::shared_ptr shape(); /// On change of attribute of the result update presentation of this result: - /// for the current moment there are only presentation attributes assigned to results - MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID); + /// for the current moment there are only presentation attributes assigned to + /// results + MODELAPI_EXPORT virtual void attributeChanged(const std::string &theID); protected: - /// This method is called just after creation of the object: it must initialize - /// all fields, normally initialized in the constructor + /// This method is called just after creation of the object: it must + /// initialize all fields, normally initialized in the constructor MODELAPI_EXPORT virtual void init(); -friend class Model_Objects; + friend class Model_Objects; }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index 59138ab9e..9a83bcc52 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -14,142 +14,125 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_ResultBody.h" -#include #include +#include #include -ModelAPI_ResultBody::ModelAPI_ResultBody() - : myBuilder(0) -{ +ModelAPI_ResultBody::ModelAPI_ResultBody() : myBuilder(0) { myConnect = ConnectionNotComputed; } -ModelAPI_ResultBody::~ModelAPI_ResultBody() -{ -} +ModelAPI_ResultBody::~ModelAPI_ResultBody() {} -std::string ModelAPI_ResultBody::groupName() -{ - return group(); -} +std::string ModelAPI_ResultBody::groupName() { return group(); } -void ModelAPI_ResultBody::store(const GeomShapePtr& theShape, - const bool theIsStoreSameShapes) -{ +void ModelAPI_ResultBody::store(const GeomShapePtr &theShape, + const bool theIsStoreSameShapes) { myBuilder->store(theShape, theIsStoreSameShapes); myConnect = ConnectionNotComputed; - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->owner(), aRedispEvent); updateSubs(theShape); } -void ModelAPI_ResultBody::storeGenerated(const GeomShapePtr& theFromShape, - const GeomShapePtr& theToShape) -{ +void ModelAPI_ResultBody::storeGenerated(const GeomShapePtr &theFromShape, + const GeomShapePtr &theToShape) { myBuilder->storeGenerated(theFromShape, theToShape); myConnect = ConnectionNotComputed; - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->owner(), aRedispEvent); updateSubs(theToShape); } void ModelAPI_ResultBody::storeGenerated( - const std::list& theFromShapes, const GeomShapePtr& theToShape, - const std::shared_ptr theMakeShape) -{ + const std::list &theFromShapes, + const GeomShapePtr &theToShape, + const std::shared_ptr theMakeShape) { myBuilder->storeGenerated(theFromShapes, theToShape, theMakeShape); myConnect = ConnectionNotComputed; - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->owner(), aRedispEvent); updateSubs(theToShape, theFromShapes, theMakeShape, true); } -void ModelAPI_ResultBody::storeModified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const bool theIsCleanStored) -{ +void ModelAPI_ResultBody::storeModified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const bool theIsCleanStored) { myBuilder->storeModified(theOldShape, theNewShape, theIsCleanStored); myConnect = ConnectionNotComputed; - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->owner(), aRedispEvent); updateSubs(theNewShape); } void ModelAPI_ResultBody::storeModified( - const std::list& theOldShapes, const GeomShapePtr& theNewShape, - const std::shared_ptr theMakeShape) -{ + const std::list &theOldShapes, + const GeomShapePtr &theNewShape, + const std::shared_ptr theMakeShape) { myBuilder->storeModified(theOldShapes, theNewShape, theMakeShape); myConnect = ConnectionNotComputed; - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aECreator->sendUpdated(data()->owner(), aRedispEvent); updateSubs(theNewShape, theOldShapes, theMakeShape, false); } -GeomShapePtr ModelAPI_ResultBody::shape() -{ - return myBuilder->shape(); -} +GeomShapePtr ModelAPI_ResultBody::shape() { return myBuilder->shape(); } -void ModelAPI_ResultBody::generated(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName) -{ +void ModelAPI_ResultBody::generated(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName) { myBuilder->generated(theOldShape, theNewShape, theName); } -void ModelAPI_ResultBody::modified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName) -{ +void ModelAPI_ResultBody::modified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName) { myBuilder->modified(theOldShape, theNewShape, theName); } - -void ModelAPI_ResultBody::loadDeletedShapes(const GeomMakeShapePtr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const GeomShapePtr& theShapesToExclude) -{ - myBuilder->loadDeletedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theShapesToExclude); +void ModelAPI_ResultBody::loadDeletedShapes( + const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const GeomShapePtr &theShapesToExclude) { + myBuilder->loadDeletedShapes(theAlgo, theOldShape, theShapeTypeToExplore, + theShapesToExclude); } // LCOV_EXCL_START -bool ModelAPI_ResultBody::isConnectedTopology() -{ +bool ModelAPI_ResultBody::isConnectedTopology() { if (myConnect == ConnectionNotComputed) { myConnect = shape()->isConnectedTopology() ? IsConnected : IsNotConnected; } return myConnect == IsConnected; } -void ModelAPI_ResultBody::setDisplayed(const bool theDisplay) -{ +void ModelAPI_ResultBody::setDisplayed(const bool theDisplay) { ModelAPI_Result::setDisplayed(theDisplay); for (int i = 0; i < numberOfSubs(); i++) subResult(i)->setDisplayed(theDisplay); diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index eb9735024..9812df1f1 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -14,35 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_ResultBody_H_ #define ModelAPI_ResultBody_H_ #include "ModelAPI_Result.h" -#include #include -#include +#include #include +#include #include class ModelAPI_BodyBuilder; class GeomAlgoAPI_MakeShape; /**\class ModelAPI_ResultBody -* \ingroup DataModel -* \brief The body (shape) result of a feature. -* -* Provides a shape that may be displayed in the viewer. -* May provide really huge results, so, working with this kind -* of result must be optimized. -* Also provides a container of sub-body result in case it is compound or compsolid. -*/ -class ModelAPI_ResultBody : public ModelAPI_Result -{ + * \ingroup DataModel + * \brief The body (shape) result of a feature. + * + * Provides a shape that may be displayed in the viewer. + * May provide really huge results, so, working with this kind + * of result must be optimized. + * Also provides a container of sub-body result in case it is compound or + * compsolid. + */ +class ModelAPI_ResultBody : public ModelAPI_Result { public: - /// Internal enumeration for storage the information of connected topology flag + /// Internal enumeration for storage the information of connected topology + /// flag enum ConnectedTopologyFlag { ConnectionNotComputed, ///< not yet computed IsConnected, ///< the topology is connected @@ -53,14 +55,14 @@ protected: /// Keeps (not persistently) the connected topology flag ConnectedTopologyFlag myConnect; - ModelAPI_BodyBuilder* myBuilder; ///< provides the body processing in naming shape + ModelAPI_BodyBuilder + *myBuilder; ///< provides the body processing in naming shape public: MODELAPI_EXPORT virtual ~ModelAPI_ResultBody(); /// Reference to the image attribute of the result body. - inline static const std::string& IMAGE_ID() - { + inline static const std::string &IMAGE_ID() { static const std::string MY_IMAGE_ID("Image"); return MY_IMAGE_ID; } @@ -69,109 +71,114 @@ public: MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Bodies"; return MY_GROUP; } /// default color for a result body - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string RESULT_BODY_COLOR("200,200,230"); return RESULT_BODY_COLOR; } /// default deflection for a result body - inline static const std::string DEFAULT_DEFLECTION() - { - return "0.0001"; - } + inline static const std::string DEFAULT_DEFLECTION() { return "0.0001"; } /// Returns the number of sub-elements MODELAPI_EXPORT virtual int numberOfSubs(bool forTree = false) const = 0; /// Returns the sub-result by zero-base index - MODELAPI_EXPORT virtual std::shared_ptr subResult( - const int theIndex, bool forTree = false) const = 0; + MODELAPI_EXPORT virtual std::shared_ptr + subResult(const int theIndex, bool forTree = false) const = 0; /// Returns true if theResult belong to this composite result as sub. /// Returns theIndex - zero based index of sub if found - MODELAPI_EXPORT virtual bool isSub(ObjectPtr theResult, int& theIndex) const = 0; + MODELAPI_EXPORT virtual bool isSub(ObjectPtr theResult, + int &theIndex) const = 0; /// \brief Stores the shape (called by the execution method). /// param[in] theShape shape to store. /// param[in] theIsStoreSameShapes if false stores reference to the same shape /// if it is already in document. - MODELAPI_EXPORT virtual void store(const GeomShapePtr& theShape, + MODELAPI_EXPORT virtual void store(const GeomShapePtr &theShape, const bool theIsStoreSameShapes = true); /// Stores the generated shape (called by the execution method). - MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape, - const GeomShapePtr& theToShape); + MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr &theFromShape, + const GeomShapePtr &theToShape); /// Stores the root modified shapes (called by the execution method). - MODELAPI_EXPORT virtual void storeGenerated( - const std::list& theFromShapes, const GeomShapePtr& theToShape, - const std::shared_ptr theMakeShape); + MODELAPI_EXPORT virtual void + storeGenerated(const std::list &theFromShapes, + const GeomShapePtr &theToShape, + const std::shared_ptr theMakeShape); /// Stores the modified shape (called by the execution method). - MODELAPI_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const bool theIsCleanStored = true); + MODELAPI_EXPORT virtual void + storeModified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const bool theIsCleanStored = true); /// Stores the root modified shapes (called by the execution method). - MODELAPI_EXPORT virtual void storeModified( - const std::list& theOldShapes, const GeomShapePtr& theNewShape, - const std::shared_ptr theMakeShape); + MODELAPI_EXPORT virtual void + storeModified(const std::list &theOldShapes, + const GeomShapePtr &theNewShape, + const std::shared_ptr theMakeShape); /// Returns the shape-result produced by this feature MODELAPI_EXPORT virtual GeomShapePtr shape(); - /// Records the subshape newShape which was generated during a topological construction. - /// As an example, consider the case of a face generated in construction of a box. - /// Returns true if it is stored correctly (the final shape contains this new sub-shape) - MODELAPI_EXPORT virtual bool generated(const GeomShapePtr& theNewShape, - const std::string& theName, const bool theCheckIsInResult = true) = 0; - - /// Records the shape newShape which was generated from the shape oldShape during a topological - /// construction. As an example, consider the case of a face generated from an edge in - /// construction of a prism. - MODELAPI_EXPORT virtual void generated(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName = ""); + /// Records the subshape newShape which was generated during a topological + /// construction. As an example, consider the case of a face generated in + /// construction of a box. Returns true if it is stored correctly (the final + /// shape contains this new sub-shape) + MODELAPI_EXPORT virtual bool + generated(const GeomShapePtr &theNewShape, const std::string &theName, + const bool theCheckIsInResult = true) = 0; + + /// Records the shape newShape which was generated from the shape oldShape + /// during a topological construction. As an example, consider the case of a + /// face generated from an edge in construction of a prism. + MODELAPI_EXPORT virtual void generated(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = ""); /// Records the shape newShape which is a modification of the shape oldShape. - /// As an example, consider the case of a face split or merged in a Boolean operation. - MODELAPI_EXPORT virtual void modified(const GeomShapePtr& theOldShape, - const GeomShapePtr& theNewShape, - const std::string& theName = ""); + /// As an example, consider the case of a face split or merged in a Boolean + /// operation. + MODELAPI_EXPORT virtual void modified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = ""); /// load deleted shapes MODELAPI_EXPORT - virtual void loadDeletedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const GeomShapePtr& theShapesToExclude = GeomShapePtr()); + virtual void + loadDeletedShapes(const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const GeomShapePtr &theShapesToExclude = GeomShapePtr()); /// load and orient modified shapes MODELAPI_EXPORT - virtual void loadModifiedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "") = 0; + virtual void + loadModifiedShapes(const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "") = 0; /// load and orient generated shapes MODELAPI_EXPORT - virtual void loadGeneratedShapes(const std::shared_ptr& theAlgo, - const GeomShapePtr& theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "", - const bool theSaveOldIfNotInTree = false) = 0; + virtual void + loadGeneratedShapes(const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "", + const bool theSaveOldIfNotInTree = false) = 0; /// load shapes of the first level (to be used during shape import) MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, - const std::string& theName) = 0; + const std::string &theName) = 0; /// Returns true is the topology is connected. MODELAPI_EXPORT virtual bool isConnectedTopology() = 0; @@ -181,46 +188,48 @@ public: MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); /// Updates the sub-bodies if shape of this object is compsolid or compound - MODELAPI_EXPORT virtual void updateSubs(const GeomShapePtr& theThisShape, - const bool theShapeChanged = true) = 0; + MODELAPI_EXPORT virtual void + updateSubs(const GeomShapePtr &theThisShape, + const bool theShapeChanged = true) = 0; /// Updates the sub-bodies in accordance to the algorithm history information - MODELAPI_EXPORT virtual void updateSubs( - const GeomShapePtr& theThisShape, const std::list& theOlds, - const std::shared_ptr theMakeShape, const bool isGenerated) = 0; + MODELAPI_EXPORT virtual void + updateSubs(const GeomShapePtr &theThisShape, + const std::list &theOlds, + const std::shared_ptr theMakeShape, + const bool isGenerated) = 0; /// Cleans cash related to the already stored elements MODELAPI_EXPORT virtual void cleanCash() = 0; /// Add shape Name for read shape in step file - MODELAPI_EXPORT virtual std::wstring addShapeName - (std::shared_ptr, const std::wstring& theName) = 0; + MODELAPI_EXPORT virtual std::wstring + addShapeName(std::shared_ptr, const std::wstring &theName) = 0; /// Add color for shape Name read shape in step file - MODELAPI_EXPORT virtual void addShapeColor - (const std::wstring& theName, std::vector& theColor) = 0; + MODELAPI_EXPORT virtual void addShapeColor(const std::wstring &theName, + std::vector &theColor) = 0; /// Set the map of name and color read shape in step file - MODELAPI_EXPORT virtual void setShapeName - (std::map< std::wstring, std::shared_ptr > &theShapeName, - std::map< std::wstring, std::vector> & theColorsShape) = 0; + MODELAPI_EXPORT virtual void setShapeName( + std::map> &theShapeName, + std::map> &theColorsShape) = 0; /// Clear the map of name and color read shape in step file MODELAPI_EXPORT virtual void clearShapeNameAndColor() = 0; /// Find the name of shape read in step file - MODELAPI_EXPORT virtual std::wstring findShapeName(std::shared_ptr theShape) = 0; + MODELAPI_EXPORT virtual std::wstring + findShapeName(std::shared_ptr theShape) = 0; /// Find the imported color by the construction name of a shape. /// Returns empty vector if not found. - MODELAPI_EXPORT virtual const std::vector& findShapeColor( - const std::wstring& theShapeName) = 0; - + MODELAPI_EXPORT virtual const std::vector & + findShapeColor(const std::wstring &theShapeName) = 0; protected: /// Default constructor accessible only from Model_Objects MODELAPI_EXPORT ModelAPI_ResultBody(); - }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.cpp b/src/ModelAPI/ModelAPI_ResultConstruction.cpp index c731a2833..38fc3cc00 100644 --- a/src/ModelAPI/ModelAPI_ResultConstruction.cpp +++ b/src/ModelAPI/ModelAPI_ResultConstruction.cpp @@ -14,13 +14,11 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_ResultConstruction.h" #include -std::string ModelAPI_ResultConstruction::groupName() -{ - return group(); -} +std::string ModelAPI_ResultConstruction::groupName() { return group(); } diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.h b/src/ModelAPI/ModelAPI_ResultConstruction.h index 75593bdea..07a3ccb08 100644 --- a/src/ModelAPI/ModelAPI_ResultConstruction.h +++ b/src/ModelAPI/ModelAPI_ResultConstruction.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_ResultConstruction_H_ #define ModelAPI_ResultConstruction_H_ #include "ModelAPI_Result.h" -#include #include +#include #include @@ -33,56 +34,52 @@ * Provides a shape that may be displayed in the viewer. * Intermediate, light result that in many cases produces a result on the fly. */ -class ModelAPI_ResultConstruction : public ModelAPI_Result -{ - public: +class ModelAPI_ResultConstruction : public ModelAPI_Result { +public: /// Returns the group identifier of this result MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Construction"; return MY_GROUP; } /// default color for a result construction - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string RESULT_CONSTRUCTION_COLOR("120,120,120"); return RESULT_CONSTRUCTION_COLOR; } /// default color for a result construction - inline static const std::string& RESULT_COLOR_NAME() - { + inline static const std::string &RESULT_COLOR_NAME() { static const std::string COLOR_NAME("result_construction_color"); return COLOR_NAME; } /// default deflection for a result construction - inline static const std::string DEFAULT_DEFLECTION() - { - return "0.00001"; - } + inline static const std::string DEFAULT_DEFLECTION() { return "0.00001"; } /// Sets the result virtual void setShape(std::shared_ptr theShape) = 0; - /// Updates the shape taking the current value from the data structure, returns true - /// if update has been correctly done + /// Updates the shape taking the current value from the data structure, + /// returns true if update has been correctly done virtual bool updateShape() = 0; /// Sets the flag that it must be displayed in history (default is true) virtual void setIsInHistory(const bool isInHistory) = 0; - /// if the construction result may be used as faces, this method returns not zero number of faces - /// \param theUpdateNaming is false of keeping the naming structure untouched (on load) + /// if the construction result may be used as faces, this method returns not + /// zero number of faces \param theUpdateNaming is false of keeping the naming + /// structure untouched (on load) virtual int facesNum(const bool theUpdateNaming = true) = 0; - /// if the construction result may be used as faces, this method returns face by zero based index + /// if the construction result may be used as faces, this method returns face + /// by zero based index virtual std::shared_ptr face(const int theIndex) = 0; /// Change the order of faces - virtual void setFacesOrder(const std::list >& theFaces) = 0; + virtual void + setFacesOrder(const std::list> &theFaces) = 0; /// By default object is not infinite. virtual bool isInfinite() = 0; diff --git a/src/ModelAPI/ModelAPI_ResultField.cpp b/src/ModelAPI/ModelAPI_ResultField.cpp index d0a5c88b7..f391e416e 100644 --- a/src/ModelAPI/ModelAPI_ResultField.cpp +++ b/src/ModelAPI/ModelAPI_ResultField.cpp @@ -14,34 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_ResultField.h" #include "ModelAPI_Events.h" #include -ModelAPI_ResultField::~ModelAPI_ResultField() -{ +ModelAPI_ResultField::~ModelAPI_ResultField() {} -} - -std::string ModelAPI_ResultField::groupName() -{ - return group(); -} +std::string ModelAPI_ResultField::groupName() { return group(); } // LCOV_EXCL_START -void ModelAPI_ResultField::ModelAPI_FieldStep::setDisplayed(const bool theDisplay) -{ +void ModelAPI_ResultField::ModelAPI_FieldStep::setDisplayed( + const bool theDisplay) { if (myIsDisplayed != theDisplay) { myIsDisplayed = theDisplay; - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); - ModelAPI_ResultField* aField = field(); + static const ModelAPI_EventCreator *aECreator = + ModelAPI_EventCreator::get(); + ModelAPI_ResultField *aField = field(); if (aField) { - aECreator->sendUpdated(aField->step(id()), EVENT_DISP); // updated pointer to this + aECreator->sendUpdated(aField->step(id()), + EVENT_DISP); // updated pointer to this if (myIsDisplayed) { for (int i = 0; i < aField->stepsSize(); i++) if (i != id()) @@ -52,9 +49,7 @@ void ModelAPI_ResultField::ModelAPI_FieldStep::setDisplayed(const bool theDispla } } - -void ModelAPI_ResultField::setDisplayed(const bool theDisplay) -{ +void ModelAPI_ResultField::setDisplayed(const bool theDisplay) { ModelAPI_Result::setDisplayed(theDisplay); if (isDisplayed()) { for (int i = 0; i < stepsSize(); i++) diff --git a/src/ModelAPI/ModelAPI_ResultField.h b/src/ModelAPI/ModelAPI_ResultField.h index 46a8fc275..c8dde9e2e 100644 --- a/src/ModelAPI/ModelAPI_ResultField.h +++ b/src/ModelAPI/ModelAPI_ResultField.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_ResultField_H_ @@ -31,20 +32,16 @@ * * Provides a compound of selected elements, without storage, one the fly. */ -class ModelAPI_ResultField : public ModelAPI_Result -{ +class ModelAPI_ResultField : public ModelAPI_Result { public: - - class ModelAPI_FieldStep : public ModelAPI_Object - { + class ModelAPI_FieldStep : public ModelAPI_Object { public: - virtual ModelAPI_ResultField* field() const = 0; + virtual ModelAPI_ResultField *field() const = 0; virtual int id() const = 0; /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "FieldRersultStep"; return MY_GROUP; } @@ -52,27 +49,28 @@ public: /// Returns the group identifier of this object virtual std::string groupName() { return group(); } - /// Request for initialization of data model of the object: adding all attributes + /// Request for initialization of data model of the object: adding all + /// attributes virtual void initAttributes() {} /// Returns the feature is disabled or not. virtual bool isDisabled() { return false; } - /// Returns true if object must be displayed in the viewer: flag is stored in the - /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps - /// the original state in the current transaction. + /// Returns true if object must be displayed in the viewer: flag is stored + /// in the data model, so on undo/redo, open/save or recreation of object by + /// history-playing it keeps the original state in the current transaction. virtual bool isDisplayed() { return myIsDisplayed; } - /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" - /// signal. + /// Sets the displayed/hidden state of the object. If it is changed, sends + /// the "redisplay" signal. MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); /// Returns a GUI name of this step MODELAPI_EXPORT virtual std::wstring name() = 0; protected: - /// This method is called just after creation of the object: it must initialize - /// all fields, normally initialized in the constructor + /// This method is called just after creation of the object: it must + /// initialize all fields, normally initialized in the constructor MODELAPI_EXPORT virtual void init() {} private: @@ -84,15 +82,13 @@ public: MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Fields"; return MY_GROUP; } /// default color for a result body - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string RESULT_GROUP_COLOR("150,150,180"); return RESULT_GROUP_COLOR; } @@ -106,10 +102,11 @@ public: /// Returns step object /// \param theId an id of the object - virtual std::shared_ptr step(int theId) const = 0; + virtual std::shared_ptr + step(int theId) const = 0; - /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" - /// signal. + /// Sets the displayed/hidden state of the object. If it is changed, sends the + /// "redisplay" signal. MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); /// To refresh the steps of a field diff --git a/src/ModelAPI/ModelAPI_ResultGroup.cpp b/src/ModelAPI/ModelAPI_ResultGroup.cpp index 7e9594bc9..a8299236b 100644 --- a/src/ModelAPI/ModelAPI_ResultGroup.cpp +++ b/src/ModelAPI/ModelAPI_ResultGroup.cpp @@ -14,18 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_ResultGroup.h" -ModelAPI_ResultGroup::~ModelAPI_ResultGroup() -{ - -} - -std::string ModelAPI_ResultGroup::groupName() -{ - return group(); -} +ModelAPI_ResultGroup::~ModelAPI_ResultGroup() {} +std::string ModelAPI_ResultGroup::groupName() { return group(); } diff --git a/src/ModelAPI/ModelAPI_ResultGroup.h b/src/ModelAPI/ModelAPI_ResultGroup.h index 4b4278db0..8ebfcdcb8 100644 --- a/src/ModelAPI/ModelAPI_ResultGroup.h +++ b/src/ModelAPI/ModelAPI_ResultGroup.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_ResultGroup_H_ @@ -31,23 +32,20 @@ * * Provides a compound of selected elements, without storage, one the fly. */ -class ModelAPI_ResultGroup : public ModelAPI_Result -{ +class ModelAPI_ResultGroup : public ModelAPI_Result { public: MODELAPI_EXPORT virtual ~ModelAPI_ResultGroup(); /// Returns the group identifier of this result MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Groups"; return MY_GROUP; } /// default color for a result body - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string RESULT_GROUP_COLOR("150,150,180"); return RESULT_GROUP_COLOR; } @@ -55,8 +53,7 @@ public: /// \brief Stores the result of operation made on groups. /// Cleans the storage if empty shape is given. /// param[in] theShape shape to store. - MODELAPI_EXPORT virtual void store(const GeomShapePtr& /*theShape*/) - {} + MODELAPI_EXPORT virtual void store(const GeomShapePtr & /*theShape*/) {} }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_ResultParameter.cpp b/src/ModelAPI/ModelAPI_ResultParameter.cpp index 178aa2dfa..82f40ccab 100644 --- a/src/ModelAPI/ModelAPI_ResultParameter.cpp +++ b/src/ModelAPI/ModelAPI_ResultParameter.cpp @@ -14,11 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelAPI_ResultParameter.h" -ModelAPI_ResultParameter::~ModelAPI_ResultParameter() -{ -} +ModelAPI_ResultParameter::~ModelAPI_ResultParameter() {} diff --git a/src/ModelAPI/ModelAPI_ResultParameter.h b/src/ModelAPI/ModelAPI_ResultParameter.h index a7adbb7fe..c122a14ae 100644 --- a/src/ModelAPI/ModelAPI_ResultParameter.h +++ b/src/ModelAPI/ModelAPI_ResultParameter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELAPI_RESULTPARAMETER_H_ @@ -30,31 +31,24 @@ * Provides a shape that may be displayed in the viewer. * Intermediate, light result that in many cases produces a result on the fly. */ -class ModelAPI_ResultParameter : public ModelAPI_Result -{ - public: +class ModelAPI_ResultParameter : public ModelAPI_Result { +public: /// Returns the group identifier of this result - virtual std::string groupName() - { - return group(); - } + virtual std::string groupName() { return group(); } /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Parameters"; return MY_GROUP; } /// The computed value attribute Id - inline static const std::string& VALUE() - { + inline static const std::string &VALUE() { static const std::string MY_VALUE_ID("Value"); return MY_VALUE_ID; } /// The computational error attribute Id - inline static const std::string& STATE() - { + inline static const std::string &STATE() { static const std::string MY_VALUE_ID("State"); return MY_VALUE_ID; } @@ -64,7 +58,6 @@ class ModelAPI_ResultParameter : public ModelAPI_Result /// Destructor MODELAPI_EXPORT ~ModelAPI_ResultParameter(); - }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_ResultPart.cpp b/src/ModelAPI/ModelAPI_ResultPart.cpp index 951624733..d123054a2 100644 --- a/src/ModelAPI/ModelAPI_ResultPart.cpp +++ b/src/ModelAPI/ModelAPI_ResultPart.cpp @@ -14,14 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -std::string ModelAPI_ResultPart::groupName() -{ +std::string ModelAPI_ResultPart::groupName() { return ModelAPI_ResultPart::group(); } diff --git a/src/ModelAPI/ModelAPI_ResultPart.h b/src/ModelAPI/ModelAPI_ResultPart.h index 00a894386..35a1efec7 100644 --- a/src/ModelAPI/ModelAPI_ResultPart.h +++ b/src/ModelAPI/ModelAPI_ResultPart.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_ResultPart_H_ @@ -32,29 +33,25 @@ class GeomAPI_Trsf; * This result leaves without feature: no parametricity for this element, * only add/remove, undo/redo. */ -class ModelAPI_ResultPart : public ModelAPI_Result -{ - public: +class ModelAPI_ResultPart : public ModelAPI_Result { +public: /// Returns the group identifier of this result MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - inline static std::string group() - { + inline static std::string group() { static std::string MY_GROUP = "Parts"; return MY_GROUP; } /// part document reference attribute - inline static const std::string& DOC_REF() - { + inline static const std::string &DOC_REF() { static const std::string MY_DOC_REF("PartDocument"); return MY_DOC_REF; } /// default color for a result body - inline static const std::string& DEFAULT_COLOR() - { + inline static const std::string &DEFAULT_COLOR() { static const std::string RESULT_BODY_COLOR("96,157,255"); return RESULT_BODY_COLOR; } @@ -62,8 +59,8 @@ class ModelAPI_ResultPart : public ModelAPI_Result /// Returns the part-document of this result virtual std::shared_ptr partDoc() = 0; - /// Returns the original part result: for transformation features results this is - /// the original Part feature result + /// Returns the original part result: for transformation features results this + /// is the original Part feature result virtual std::shared_ptr original() = 0; /// Sets this document as current and if it is not loaded yet, loads it @@ -73,24 +70,27 @@ class ModelAPI_ResultPart : public ModelAPI_Result virtual bool isActivated() = 0; /// Returns the name of the shape inside of the part - virtual std::wstring nameInPart(const std::shared_ptr& theShape, - int& theIndex) = 0; + virtual std::wstring + nameInPart(const std::shared_ptr &theShape, int &theIndex) = 0; /// Updates the selection inside of the part by the selection index virtual bool updateInPart(const int theIndex) = 0; /// Applies the additional transformation of the part - virtual void setTrsf(std::shared_ptr theThis, - const std::shared_ptr& theTransformation) = 0; + virtual void + setTrsf(std::shared_ptr theThis, + const std::shared_ptr &theTransformation) = 0; /// Returns the summary transformations of all references to the origin virtual std::shared_ptr summaryTrsf() = 0; /// Returns the shape by the name in the part - virtual std::shared_ptr shapeInPart( - const std::wstring& theName, const std::string& theType, int& theIndex) = 0; + virtual std::shared_ptr + shapeInPart(const std::wstring &theName, const std::string &theType, + int &theIndex) = 0; /// Updates the selection inside of the part as a geometrical selection - virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName) = 0; + virtual bool combineGeometrical(const int theIndex, + std::wstring &theNewName) = 0; /// Returns the shape selected in the selection index virtual std::shared_ptr selectionValue(const int theIndex) = 0; diff --git a/src/ModelAPI/ModelAPI_Session.cpp b/src/ModelAPI/ModelAPI_Session.cpp index 646379e30..b5da3a738 100644 --- a/src/ModelAPI/ModelAPI_Session.cpp +++ b/src/ModelAPI/ModelAPI_Session.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -26,23 +27,22 @@ // to avoid unresolved ModelAPI_Data() #include // to avoid unresolved ModelAPI_Plugin() -#include #include +#include #include #include -#include #include -#include -#include #include #include -#include +#include #include #include +#include #include -#include +#include #include #include +#include #include #include @@ -60,45 +60,43 @@ /// Manager that will be initialized from Model package, one per application std::shared_ptr MY_MANAGER; -void ModelAPI_Session::setSession(std::shared_ptr theManager) -{ +void ModelAPI_Session::setSession( + std::shared_ptr theManager) { MY_MANAGER = theManager; } -std::shared_ptr ModelAPI_Session::get() -{ - if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI +std::shared_ptr ModelAPI_Session::get() { + if (!MY_MANAGER) { // import Model library that implements this interface of + // ModelAPI Config_ModuleReader::loadLibrary("Model"); - Config_PropManager::registerProp("Visualization", "body_deflection", - "Body deflection coefficient", - Config_Prop::Double, - ModelAPI_ResultBody::DEFAULT_DEFLECTION()); - - Config_PropManager::registerProp("Visualization", "construction_deflection", - "Construction deflection coefficient", - Config_Prop::Double, - ModelAPI_ResultConstruction::DEFAULT_DEFLECTION()); + Config_PropManager::registerProp( + "Visualization", "body_deflection", "Body deflection coefficient", + Config_Prop::Double, ModelAPI_ResultBody::DEFAULT_DEFLECTION()); - Config_PropManager::registerProp("Visualization", "shaper_default_transparency", - "Default transparency (%)", Config_Prop::IntSpin, "0", "0", "100"); + Config_PropManager::registerProp( + "Visualization", "construction_deflection", + "Construction deflection coefficient", Config_Prop::Double, + ModelAPI_ResultConstruction::DEFAULT_DEFLECTION()); + Config_PropManager::registerProp( + "Visualization", "shaper_default_transparency", + "Default transparency (%)", Config_Prop::IntSpin, "0", "0", "100"); } return MY_MANAGER; } /// instance of the events creator, one pre application -const ModelAPI_EventCreator* MY_API_CREATOR = 0; +const ModelAPI_EventCreator *MY_API_CREATOR = 0; -const ModelAPI_EventCreator* ModelAPI_EventCreator::get() -{ - if (!MY_API_CREATOR) { // import Model library that implements this interface of ModelAPI +const ModelAPI_EventCreator *ModelAPI_EventCreator::get() { + if (!MY_API_CREATOR) { // import Model library that implements this interface + // of ModelAPI Config_ModuleReader::loadLibrary("Model"); } return MY_API_CREATOR; } -void ModelAPI_EventCreator::set(const ModelAPI_EventCreator* theCreator) -{ +void ModelAPI_EventCreator::set(const ModelAPI_EventCreator *theCreator) { MY_API_CREATOR = theCreator; } diff --git a/src/ModelAPI/ModelAPI_Session.h b/src/ModelAPI/ModelAPI_Session.h index 566158c60..2da1c16c7 100644 --- a/src/ModelAPI/ModelAPI_Session.h +++ b/src/ModelAPI/ModelAPI_Session.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Session_H_ #define ModelAPI_Session_H_ #include "ModelAPI.h" -#include #include #include +#include class ModelAPI_Feature; class ModelAPI_Plugin; @@ -34,32 +35,34 @@ class ModelAPI_FiltersFactory; /**\class ModelAPI_Session * \ingroup DataModel * \brief Object that knows (from the initial XML file) which - * plugin contains which feature, loads and stores reference to loaded plugins by - * the feature functionality request. + * plugin contains which feature, loads and stores reference to loaded plugins + * by the feature functionality request. */ -class MODELAPI_EXPORT ModelAPI_Session -{ +class MODELAPI_EXPORT ModelAPI_Session { protected: bool myIsLoading; ///< keeps the state of the loading of the document - public: - /// Returns the real implementation (the alone instance per application) of the plugin manager +public: + /// Returns the real implementation (the alone instance per application) of + /// the plugin manager static std::shared_ptr get(); //! Loads the OCAF document from the file. //! \param theFileName full name of the file to load //! \returns true if file was loaded successfully - virtual bool load(const char* theFileName) = 0; + virtual bool load(const char *theFileName) = 0; - //! Returns true if a loading process is performed (so, no need to react on a new part creation) + //! Returns true if a loading process is performed (so, no need to react on a + //! new part creation) virtual bool isLoading() { return myIsLoading; }; //! Saves the OCAF document to the file. //! \param theFileName full name of the file to store //! \param theResults the result full file names that were stored by "save" //! \returns true if file was stored successfully - virtual bool save(const char* theFileName, std::list& theResults) = 0; + virtual bool save(const char *theFileName, + std::list &theResults) = 0; //! Closes all documents virtual void closeAll() = 0; @@ -68,14 +71,16 @@ protected: //! \param theId of operation for history (optional) //! \param theAttachedToNested if it is true, //! it means that this transaction is attached to the nested - //! where it is located and will be committed on the next commit with the nested - virtual void startOperation( - const std::string& theId = "", const bool theAttachedToNested = false) = 0; + //! where it is located and will be committed on the next commit with + //! the nested + virtual void startOperation(const std::string &theId = "", + const bool theAttachedToNested = false) = 0; //! Finishes the previously started operation (closes the transaction) virtual void finishOperation() = 0; //! Aborts the operation virtual void abortOperation() = 0; - //! Returns true if operation has been started, but not yet finished or aborted + //! Returns true if operation has been started, but not yet finished or + //! aborted virtual bool isOperation() = 0; //! Returns true if document was modified (since creation/opening) virtual bool isModified() = 0; @@ -96,14 +101,15 @@ protected: virtual void clearUndoRedo() = 0; /// Registers the plugin that creates features. - /// It is obligatory for each plugin to call this function on loading to be found by - /// the plugin manager on call of the feature) - virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0; + /// It is obligatory for each plugin to call this function on loading to be + /// found by the plugin manager on call of the feature) + virtual void registerPlugin(ModelAPI_Plugin *thePlugin) = 0; /// Verifies the license for the plugin is valid - virtual bool checkLicense(const std::string& thePluginName) = 0; + virtual bool checkLicense(const std::string &thePluginName) = 0; - /// Returns the root document of the application (that may contains sub-documents) + /// Returns the root document of the application (that may contains + /// sub-documents) virtual std::shared_ptr moduleDocument() = 0; /// Returns the document by ID. Returns null if no such document. @@ -116,31 +122,32 @@ protected: virtual std::shared_ptr activeDocument() = 0; /// Defines the current document that used for current work in the application - virtual void setActiveDocument( - std::shared_ptr theDoc, bool theSendSignal = true) = 0; + virtual void setActiveDocument(std::shared_ptr theDoc, + bool theSendSignal = true) = 0; /// Returns all the opened documents of the session (without postponed) - virtual std::list > allOpenedDocuments() = 0; + virtual std::list> + allOpenedDocuments() = 0; /// Returns true if document is not loaded yet - virtual bool isLoadByDemand(const std::wstring theDocID, const int theDocIndex) = 0; + virtual bool isLoadByDemand(const std::wstring theDocID, + const int theDocIndex) = 0; /// Copies the document to the new one with the given id - virtual std::shared_ptr copy( - std::shared_ptr theSource, const int theDestID) =0; + virtual std::shared_ptr + copy(std::shared_ptr theSource, const int theDestID) = 0; /// Returns the validators factory: the only one instance per application - virtual ModelAPI_ValidatorsFactory* validators() = 0; + virtual ModelAPI_ValidatorsFactory *validators() = 0; /// Returns the filters factory: the only one instance per application - virtual ModelAPI_FiltersFactory* filters() = 0; + virtual ModelAPI_FiltersFactory *filters() = 0; /// To virtually destroy the fields of successors - virtual ~ModelAPI_Session() - { - } + virtual ~ModelAPI_Session() {} - /// Returns the global identifier of the current transaction (needed for the update algo) + /// Returns the global identifier of the current transaction (needed for the + /// update algo) virtual int transactionID() = 0; /// Returns true if auto-update in the application is blocked @@ -149,7 +156,7 @@ protected: /// Set state of the auto-update of features result in the application virtual void blockAutoUpdate(const bool theBlock) = 0; - protected: +protected: /// Sets the session interface implementation (once per application launch) static void setSession(std::shared_ptr theManager); }; diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 45bcad650..8185da429 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -14,9 +14,11 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // +#include "ModelAPI_Tools.h" #include #include #include @@ -33,25 +35,24 @@ #include #include #include -#include "ModelAPI_Tools.h" #include #include #include #include -#include +#include #include #include -#include +#include #include +#include #include #include #include #include #include -#include #define RECURSE_TOP_LEVEL 50 @@ -61,32 +62,32 @@ #ifdef DEBUG_REMOVE_FEATURES_RECURSE #include -std::string getFeatureInfo(FeaturePtr theFeature) -{ +std::string getFeatureInfo(FeaturePtr theFeature) { if (!theFeature.get()) return ""; - //std::ostringstream aPtrStr; - //aPtrStr << "[" << theFeature.get() << "] "; - std::string aFeatureInfo = /*aPtrStr.str() + */theFeature->name(); + // std::ostringstream aPtrStr; + // aPtrStr << "[" << theFeature.get() << "] "; + std::string aFeatureInfo = /*aPtrStr.str() + */ theFeature->name(); CompositeFeaturePtr aComposite = ModelAPI_Tools::compositeOwner(theFeature); if (aComposite.get()) { - aFeatureInfo = aFeatureInfo + "[in " + aComposite->name() + "]"; + aFeatureInfo = aFeatureInfo + "[in " + aComposite->name() + "]"; } return aFeatureInfo; } #endif #ifdef DEBUG_REMOVE_FEATURES -void printMapInfo(const std::map >& theMainList, - const std::string& thePrefix) -{ - std::map >::const_iterator aMainIt = theMainList.begin(), - aMainLast = theMainList.end(); +void printMapInfo(const std::map> &theMainList, + const std::string &thePrefix) { + std::map>::const_iterator + aMainIt = theMainList.begin(), + aMainLast = theMainList.end(); std::string anInfo; for (; aMainIt != aMainLast; aMainIt++) { FeaturePtr aMainListFeature = aMainIt->first; std::set aMainRefList = aMainIt->second; - std::set::const_iterator anIt = aMainRefList.begin(), aLast = aMainRefList.end(); + std::set::const_iterator anIt = aMainRefList.begin(), + aLast = aMainRefList.end(); std::string aRefsInfo; for (; anIt != aLast; anIt++) { aRefsInfo += (*anIt)->name().c_str(); @@ -94,15 +95,16 @@ void printMapInfo(const std::map >& theMainList aRefsInfo += ", "; } if (!aRefsInfo.empty()) { - anInfo = anInfo + aMainListFeature->name().c_str() + ": " + aRefsInfo + "\n"; + anInfo = + anInfo + aMainListFeature->name().c_str() + ": " + aRefsInfo + "\n"; } } - std::cout << thePrefix.c_str() << " [feature: references to]: \n" << anInfo.c_str() << std::endl; + std::cout << thePrefix.c_str() << " [feature: references to]: \n" + << anInfo.c_str() << std::endl; } -void printListInfo(const std::set& theMainList, - const std::string& thePrefix) -{ +void printListInfo(const std::set &theMainList, + const std::string &thePrefix) { std::set::const_iterator aMainIt = theMainList.begin(), aMainLast = theMainList.end(); std::string anInfo; @@ -118,28 +120,32 @@ void printListInfo(const std::set& theMainList, namespace ModelAPI_Tools { -std::shared_ptr shape(const ResultPtr& theResult) -{ +std::shared_ptr shape(const ResultPtr &theResult) { return theResult->shape(); } // LCOV_EXCL_START -const char* toString(ModelAPI_ExecState theExecState) -{ +const char *toString(ModelAPI_ExecState theExecState) { switch (theExecState) { - case ModelAPI_StateDone: return "Done"; - case ModelAPI_StateMustBeUpdated: return "Must be updated"; - case ModelAPI_StateExecFailed: return "Execution failed"; - case ModelAPI_StateInvalidArgument: return "Invalid argument"; - case ModelAPI_StateNothing: return "Empty state"; - default: return "Unknown ExecState."; + case ModelAPI_StateDone: + return "Done"; + case ModelAPI_StateMustBeUpdated: + return "Must be updated"; + case ModelAPI_StateExecFailed: + return "Execution failed"; + case ModelAPI_StateInvalidArgument: + return "Invalid argument"; + case ModelAPI_StateNothing: + return "Empty state"; + default: + return "Unknown ExecState."; } } -std::string getFeatureError(const FeaturePtr& theFeature) -{ +std::string getFeatureError(const FeaturePtr &theFeature) { std::string anError; - if (!theFeature.get() || !theFeature->data()->isValid() || theFeature->isAction()) + if (!theFeature.get() || !theFeature->data()->isValid() || + theFeature->isAction()) return anError; // to be removed later, this error should be got from the feature @@ -150,8 +156,9 @@ std::string getFeatureError(const FeaturePtr& theFeature) // set error indication anError = theFeature->error(); if (anError.empty()) { - bool isDone = ( theFeature->data()->execState() == ModelAPI_StateDone - || theFeature->data()->execState() == ModelAPI_StateMustBeUpdated ); + bool isDone = + (theFeature->data()->execState() == ModelAPI_StateDone || + theFeature->data()->execState() == ModelAPI_StateMustBeUpdated); if (!isDone) { anError = toString(theFeature->data()->execState()); // If the feature is Composite and error is StateInvalidArgument, @@ -159,24 +166,28 @@ std::string getFeatureError(const FeaturePtr& theFeature) // it is not clear what is the reason of the invalid argument. if (theFeature->data()->execState() == ModelAPI_StateInvalidArgument) { CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(theFeature); + std::dynamic_pointer_cast(theFeature); if (aComposite) { bool aHasSubError = false; for (int i = 0, aSize = aComposite->numberOfSubs(); i < aSize; i++) { FeaturePtr aSubFeature = aComposite->subFeature(i); std::string aSubFeatureError = getFeatureError(aSubFeature); if (!aSubFeatureError.empty()) { - anError = anError + " in " + aSubFeature->getKind() + ".\n" + aSubFeatureError; + anError = anError + " in " + aSubFeature->getKind() + ".\n" + + aSubFeatureError; aHasSubError = true; break; } } - if (!aHasSubError) { // #24260: error not in the sub-features, but in the argument + if (!aHasSubError) { // #24260: error not in the sub-features, but in + // the argument if (aComposite->getKind() == "Sketch" && aComposite->selection("External")->isInvalid()) { std::string aMsg = "The sketch base plane is invalid, "; - aMsg += "please push 'Change sketch plane' button to reselect it."; - anError = Config_Translator::translate(aComposite->getKind(), aMsg); + aMsg += + "please push 'Change sketch plane' button to reselect it."; + anError = + Config_Translator::translate(aComposite->getKind(), aMsg); } } } @@ -188,9 +199,9 @@ std::string getFeatureError(const FeaturePtr& theFeature) } // LCOV_EXCL_STOP -ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup, - const std::wstring& theName) -{ +ObjectPtr objectByName(const DocumentPtr &theDocument, + const std::string &theGroup, + const std::wstring &theName) { for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) { ObjectPtr anObject = theDocument->object(theGroup, anIndex); if (anObject->data()->name() == theName) @@ -202,12 +213,11 @@ ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGro //================================================================================================== void loadModifiedShapes(ResultBodyPtr theResultBody, - const ListOfShape& theBaseShapes, - const ListOfShape& theTools, - const GeomMakeShapePtr& theMakeShape, + const ListOfShape &theBaseShapes, + const ListOfShape &theTools, + const GeomMakeShapePtr &theMakeShape, const GeomShapePtr theResultShape, - const std::string& theNamePrefix) -{ + const std::string &theNamePrefix) { theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape); ListOfShape aShapes = theBaseShapes; @@ -215,51 +225,43 @@ void loadModifiedShapes(ResultBodyPtr theResultBody, for (; aToolIter != theTools.cend(); aToolIter++) aShapes.push_back(*aToolIter); - for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter) - { - theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX, theNamePrefix); - theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE, theNamePrefix); - theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE, theNamePrefix); + for (ListOfShape::const_iterator anIter = aShapes.begin(); + anIter != aShapes.end(); ++anIter) { + theResultBody->loadModifiedShapes(theMakeShape, *anIter, + GeomAPI_Shape::VERTEX, theNamePrefix); + theResultBody->loadModifiedShapes(theMakeShape, *anIter, + GeomAPI_Shape::EDGE, theNamePrefix); + theResultBody->loadModifiedShapes(theMakeShape, *anIter, + GeomAPI_Shape::FACE, theNamePrefix); } } //================================================================================================== void loadModifiedShapes(ResultBodyPtr theResultBody, - const GeomShapePtr& theBaseShape, - const GeomMakeShapePtr& theMakeShape, - const std::string theName) -{ + const GeomShapePtr &theBaseShape, + const GeomMakeShapePtr &theMakeShape, + const std::string theName) { switch (theBaseShape->shapeType()) { case GeomAPI_Shape::COMPOUND: { - for (GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next()) - { - loadModifiedShapes(theResultBody, - anIt.current(), - theMakeShape, - theName); + for (GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next()) { + loadModifiedShapes(theResultBody, anIt.current(), theMakeShape, theName); } break; } case GeomAPI_Shape::COMPSOLID: case GeomAPI_Shape::SOLID: case GeomAPI_Shape::SHELL: { - theResultBody->loadModifiedShapes(theMakeShape, - theBaseShape, - GeomAPI_Shape::FACE, - theName); + theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::FACE, theName); } case GeomAPI_Shape::FACE: case GeomAPI_Shape::WIRE: { - theResultBody->loadModifiedShapes(theMakeShape, - theBaseShape, - GeomAPI_Shape::EDGE, - theName); + theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::EDGE, theName); } case GeomAPI_Shape::EDGE: { - theResultBody->loadModifiedShapes(theMakeShape, - theBaseShape, - GeomAPI_Shape::VERTEX, - theName); + theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, + GeomAPI_Shape::VERTEX, theName); } default: // [to avoid compilation warning] break; @@ -268,61 +270,49 @@ void loadModifiedShapes(ResultBodyPtr theResultBody, //================================================================================================== void loadDeletedShapes(ResultBodyPtr theResultBody, - const GeomShapePtr theBaseShape, - const ListOfShape& theTools, - const GeomMakeShapePtr& theMakeShape, - const GeomShapePtr theResultShapesCompound) -{ + const GeomShapePtr theBaseShape, + const ListOfShape &theTools, + const GeomMakeShapePtr &theMakeShape, + const GeomShapePtr theResultShapesCompound) { ListOfShape aShapes = theTools; if (theBaseShape.get()) aShapes.push_front(theBaseShape); - for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++) - { - theResultBody->loadDeletedShapes(theMakeShape, - *anIter, - GeomAPI_Shape::VERTEX, - theResultShapesCompound); - theResultBody->loadDeletedShapes(theMakeShape, - *anIter, - GeomAPI_Shape::EDGE, - theResultShapesCompound); - theResultBody->loadDeletedShapes(theMakeShape, - *anIter, - GeomAPI_Shape::FACE, - theResultShapesCompound); - // store information about deleted solids because of unittest TestBooleanCommon_SolidsHistory - // on OCCT 7.4.0 : common produces modified compsolid, so, move to the end for removed solids - // starts to produce whole compsolid - theResultBody->loadDeletedShapes(theMakeShape, - *anIter, - GeomAPI_Shape::SOLID, - theResultShapesCompound); + for (ListOfShape::const_iterator anIter = aShapes.begin(); + anIter != aShapes.end(); anIter++) { + theResultBody->loadDeletedShapes( + theMakeShape, *anIter, GeomAPI_Shape::VERTEX, theResultShapesCompound); + theResultBody->loadDeletedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE, + theResultShapesCompound); + theResultBody->loadDeletedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE, + theResultShapesCompound); + // store information about deleted solids because of unittest + // TestBooleanCommon_SolidsHistory on OCCT 7.4.0 : common produces modified + // compsolid, so, move to the end for removed solids starts to produce whole + // compsolid + theResultBody->loadDeletedShapes( + theMakeShape, *anIter, GeomAPI_Shape::SOLID, theResultShapesCompound); } } //================================================================================================== -void loadDeletedShapes(std::vector& theResultBaseAlgoList, - const ListOfShape& theTools, - const GeomShapePtr theResultShapesCompound) -{ - for (std::vector::iterator anIt = theResultBaseAlgoList.begin(); - anIt != theResultBaseAlgoList.end(); - ++anIt) - { - ResultBaseAlgo& aRCA = *anIt; - loadDeletedShapes(aRCA.resultBody, - aRCA.baseShape, - theTools, - aRCA.makeShape, - theResultShapesCompound); +void loadDeletedShapes(std::vector &theResultBaseAlgoList, + const ListOfShape &theTools, + const GeomShapePtr theResultShapesCompound) { + for (std::vector::iterator anIt = + theResultBaseAlgoList.begin(); + anIt != theResultBaseAlgoList.end(); ++anIt) { + ResultBaseAlgo &aRCA = *anIt; + loadDeletedShapes(aRCA.resultBody, aRCA.baseShape, theTools, aRCA.makeShape, + theResultShapesCompound); } } -bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher, - const std::wstring& theName, double& outValue, ResultParameterPtr& theParam) -{ - ObjectPtr aParamObj = objectByName(theDocument, ModelAPI_ResultParameter::group(), theName); +bool findVariable(const DocumentPtr &theDocument, FeaturePtr theSearcher, + const std::wstring &theName, double &outValue, + ResultParameterPtr &theParam) { + ObjectPtr aParamObj = + objectByName(theDocument, ModelAPI_ResultParameter::group(), theName); theParam = std::dynamic_pointer_cast(aParamObj); if (!theParam.get()) return false; @@ -330,68 +320,75 @@ bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher, if (theSearcher.get()) { FeaturePtr aParamFeat = theDocument->feature(theParam); - if (aParamFeat == theSearcher || theDocument->isLater(aParamFeat, theSearcher)) + if (aParamFeat == theSearcher || + theDocument->isLater(aParamFeat, theSearcher)) return false; } - AttributeDoublePtr aValueAttribute = theParam->data()->real(ModelAPI_ResultParameter::VALUE()); + AttributeDoublePtr aValueAttribute = + theParam->data()->real(ModelAPI_ResultParameter::VALUE()); outValue = aValueAttribute->value(); return true; } -bool findVariable(FeaturePtr theSearcher, const std::wstring& theName, double& outValue, - ResultParameterPtr& theParam, const DocumentPtr& theDocument) -{ +bool findVariable(FeaturePtr theSearcher, const std::wstring &theName, + double &outValue, ResultParameterPtr &theParam, + const DocumentPtr &theDocument) { SessionPtr aSession = ModelAPI_Session::get(); std::list aDocList; - DocumentPtr aDocument = theDocument.get() ? theDocument : aSession->activeDocument(); + DocumentPtr aDocument = + theDocument.get() ? theDocument : aSession->activeDocument(); if (findVariable(aDocument, theSearcher, theName, outValue, theParam)) return true; DocumentPtr aRootDocument = aSession->moduleDocument(); if (aDocument != aRootDocument) { - // any parameters in PartSet is okindependently on the Part position (issu #1504) + // any parameters in PartSet is okindependently on the Part position (issu + // #1504) if (findVariable(aRootDocument, FeaturePtr(), theName, outValue, theParam)) return true; } return false; } -static void cacheSubresults(const ResultBodyPtr& theTopLevelResult, - std::set& theCashedResults) -{ +static void cacheSubresults(const ResultBodyPtr &theTopLevelResult, + std::set &theCashedResults) { std::list aResults; ModelAPI_Tools::allSubs(theTopLevelResult, aResults, false); - for (std::list::iterator aR = aResults.begin(); aR != aResults.end(); ++aR) { + for (std::list::iterator aR = aResults.begin(); + aR != aResults.end(); ++aR) { theCashedResults.insert(*aR); } } bool isInResults(AttributeSelectionListPtr theSelection, - const std::list& theResults, - std::set& theCashedResults) -{ + const std::list &theResults, + std::set &theCashedResults) { // collect all results into a cashed set if (theCashedResults.empty()) { std::list::const_iterator aRes = theResults.cbegin(); - for(; aRes != theResults.cend(); aRes++) { + for (; aRes != theResults.cend(); aRes++) { if (theCashedResults.count(*aRes)) continue; else theCashedResults.insert(*aRes); if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) { - ResultBodyPtr aResBody = std::dynamic_pointer_cast(*aRes); + ResultBodyPtr aResBody = + std::dynamic_pointer_cast(*aRes); cacheSubresults(aResBody, theCashedResults); - } else if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { // all results of the part - ResultPartPtr aResPart = std::dynamic_pointer_cast(*aRes); + } else if ((*aRes)->groupName() == + ModelAPI_ResultPart::group()) { // all results of the part + ResultPartPtr aResPart = + std::dynamic_pointer_cast(*aRes); DocumentPtr aPartDoc = aResPart->partDoc(); - if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible + if (!aPartDoc.get() || + !aPartDoc->isOpened()) { // document is not accessible return false; } int aBodyCount = aPartDoc->size(ModelAPI_ResultBody::group()); for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) { ResultBodyPtr aResBody = - std::dynamic_pointer_cast( - aPartDoc->object(ModelAPI_ResultBody::group(), aBodyIndex)); + std::dynamic_pointer_cast( + aPartDoc->object(ModelAPI_ResultBody::group(), aBodyIndex)); if (aResBody.get()) { theCashedResults.insert(aResBody); cacheSubresults(aResBody, theCashedResults); @@ -401,39 +398,43 @@ bool isInResults(AttributeSelectionListPtr theSelection, } } // if context is in results, return true - for(int a = 0; a < theSelection->size(); a++) { + for (int a = 0; a < theSelection->size(); a++) { AttributeSelectionPtr anAttr = theSelection->value(a); ResultPtr aContext = anAttr->context(); // check is it group selected for groups BOP - if (aContext.get() && aContext->groupName() == ModelAPI_ResultGroup::group()) { - // it is impossible by used results check which result is used in this group result, - // so check the results shapes is it in results of this document or not + if (aContext.get() && + aContext->groupName() == ModelAPI_ResultGroup::group()) { + // it is impossible by used results check which result is used in this + // group result, so check the results shapes is it in results of this + // document or not FeaturePtr aSelFeature = - std::dynamic_pointer_cast(theSelection->owner()); + std::dynamic_pointer_cast(theSelection->owner()); if (!aSelFeature.get() || aSelFeature->results().empty()) continue; GeomShapePtr aGroupResShape = aSelFeature->firstResult()->shape(); std::set::iterator allResultsIter = theCashedResults.begin(); - for(; allResultsIter != theCashedResults.end(); allResultsIter++) { + for (; allResultsIter != theCashedResults.end(); allResultsIter++) { GeomShapePtr aResultShape = (*allResultsIter)->shape(); GeomAPI_Shape::ShapeType aType = - GeomAPI_Shape::shapeTypeByStr(theSelection->selectionType()); + GeomAPI_Shape::shapeTypeByStr(theSelection->selectionType()); GeomAPI_ShapeExplorer aGroupResExp(aGroupResShape, aType); - for(; aGroupResExp.more(); aGroupResExp.next()) { + for (; aGroupResExp.more(); aGroupResExp.next()) { if (aResultShape->isSubShape(aGroupResExp.current(), false)) - return true; // at least one shape of the group is in the used results + return true; // at least one shape of the group is in the used + // results } } } - ResultBodyPtr aSelected = std::dynamic_pointer_cast(anAttr->context()); + ResultBodyPtr aSelected = + std::dynamic_pointer_cast(anAttr->context()); if (!aSelected.get()) { // try to get selected feature and all its results FeaturePtr aContextFeature = anAttr->contextFeature(); if (aContextFeature.get() && !aContextFeature->results().empty()) { - const std::list& allResluts = aContextFeature->results(); + const std::list &allResluts = aContextFeature->results(); std::list::const_iterator aResIter = allResluts.cbegin(); - for(; aResIter != allResluts.cend(); aResIter++) { + for (; aResIter != allResluts.cend(); aResIter++) { if (aResIter->get() && theCashedResults.count(*aResIter)) return true; } @@ -444,15 +445,17 @@ bool isInResults(AttributeSelectionListPtr theSelection, return false; } -ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub) -{ +ResultPtr findPartResult(const DocumentPtr &theMain, + const DocumentPtr &theSub) { // to optimize and avoid of crash on partset document close // (don't touch the sub-document structure) if (theMain != theSub) { for (int a = theMain->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) { ResultPartPtr aPart = std::dynamic_pointer_cast( theMain->object(ModelAPI_ResultPart::group(), a)); - if (aPart && aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value() == theSub) { + if (aPart && + aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value() == + theSub) { return aPart; } } @@ -460,25 +463,30 @@ ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub) return ResultPtr(); } -FeaturePtr findPartFeature(const DocumentPtr& theMain, const DocumentPtr& theSub) -{ +FeaturePtr findPartFeature(const DocumentPtr &theMain, + const DocumentPtr &theSub) { // to optimize and avoid of crash on partset document close // (don't touch the sub-document structure) if (theMain != theSub) { - // iteration from top to bottom to avoid finding the movement documents before the original + // iteration from top to bottom to avoid finding the movement documents + // before the original int aSize = theMain->size(ModelAPI_Feature::group()); for (int a = 0; a < aSize; a++) { FeaturePtr aPartFeat = std::dynamic_pointer_cast( theMain->object(ModelAPI_Feature::group(), a)); if (aPartFeat.get()) { - const std::list >& aResList = aPartFeat->results(); - std::list >::const_iterator aRes = aResList.begin(); - for(; aRes != aResList.end(); aRes++) { - ResultPartPtr aPart = std::dynamic_pointer_cast(*aRes); + const std::list> &aResList = + aPartFeat->results(); + std::list>::const_iterator aRes = + aResList.begin(); + for (; aRes != aResList.end(); aRes++) { + ResultPartPtr aPart = + std::dynamic_pointer_cast(*aRes); if (aPart.get()) { if (aPart->isActivated() && aPart->partDoc() == theSub) return aPartFeat; - } else break; // if the first is not Part, others are also not + } else + break; // if the first is not Part, others are also not } } } @@ -486,14 +494,16 @@ FeaturePtr findPartFeature(const DocumentPtr& theMain, const DocumentPtr& theSub return FeaturePtr(); } -CompositeFeaturePtr compositeOwner(const FeaturePtr& theFeature) -{ +CompositeFeaturePtr compositeOwner(const FeaturePtr &theFeature) { if (theFeature.get() && theFeature->data() && theFeature->data()->isValid()) { - const std::set >& aRefs = theFeature->data()->refsToMe(); - std::set >::const_iterator aRefIter = aRefs.begin(); - for(; aRefIter != aRefs.end(); aRefIter++) { - CompositeFeaturePtr aComp = std::dynamic_pointer_cast - ((*aRefIter)->owner()); + const std::set> &aRefs = + theFeature->data()->refsToMe(); + std::set>::const_iterator aRefIter = + aRefs.begin(); + for (; aRefIter != aRefs.end(); aRefIter++) { + CompositeFeaturePtr aComp = + std::dynamic_pointer_cast( + (*aRefIter)->owner()); if (aComp.get() && aComp->data()->isValid() && aComp->isSub(theFeature)) return aComp; } @@ -501,13 +511,13 @@ CompositeFeaturePtr compositeOwner(const FeaturePtr& theFeature) return CompositeFeaturePtr(); // not found } -ResultBodyPtr bodyOwner(const ResultPtr& theSub, const bool theRoot) -{ +ResultBodyPtr bodyOwner(const ResultPtr &theSub, const bool theRoot) { if (theSub.get()) { ObjectPtr aParent = theSub->document()->parent(theSub); if (aParent.get()) { if (theRoot) { // try to find parent of parent - ResultPtr aResultParent = std::dynamic_pointer_cast(aParent); + ResultPtr aResultParent = + std::dynamic_pointer_cast(aParent); ResultBodyPtr aGrandParent = bodyOwner(aResultParent, true); if (aGrandParent.get()) aParent = aGrandParent; @@ -518,28 +528,29 @@ ResultBodyPtr bodyOwner(const ResultPtr& theSub, const bool theRoot) return ResultBodyPtr(); // not found } -int bodyIndex(const ResultPtr& theSub) -{ +int bodyIndex(const ResultPtr &theSub) { int anIndex = -1; ResultBodyPtr aParent = bodyOwner(theSub); if (aParent.get()) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(theSub); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(theSub); if (aBody.get() && aParent->isSub(aBody, anIndex)) return anIndex; } return anIndex; // not found } -bool hasSubResults(const ResultPtr& theResult) -{ - ResultBodyPtr aCompSolid = std::dynamic_pointer_cast(theResult); +bool hasSubResults(const ResultPtr &theResult) { + ResultBodyPtr aCompSolid = + std::dynamic_pointer_cast(theResult); return aCompSolid.get() && aCompSolid->numberOfSubs() > 0; } -void allSubs(const ResultBodyPtr& theResult, std::list& theResults, +void allSubs(const ResultBodyPtr &theResult, std::list &theResults, const bool theLowerOnly) { // iterate sub-bodies of compsolid - ResultBodyPtr aComp = std::dynamic_pointer_cast(theResult); + ResultBodyPtr aComp = + std::dynamic_pointer_cast(theResult); if (aComp.get()) { int aNumSub = aComp->numberOfSubs(); for (int a = 0; a < aNumSub; a++) { @@ -551,22 +562,23 @@ void allSubs(const ResultBodyPtr& theResult, std::list& theResults, } } -void allResults(const FeaturePtr& theFeature, std::list& theResults) -{ +void allResults(const FeaturePtr &theFeature, + std::list &theResults) { if (!theFeature.get()) // safety: for empty feature no results return; - const std::list >& aResults = theFeature->results(); + const std::list> &aResults = + theFeature->results(); std::list::const_iterator aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { theResults.push_back(*aRIter); - ResultBodyPtr aResult = std::dynamic_pointer_cast(*aRIter); + ResultBodyPtr aResult = + std::dynamic_pointer_cast(*aRIter); allSubs(aResult, theResults); } } //****************************************************************** -bool allDocumentsActivated(std::wstring& theNotActivatedNames) -{ +bool allDocumentsActivated(std::wstring &theNotActivatedNames) { theNotActivatedNames = L""; bool anAllPartActivated = true; @@ -574,7 +586,8 @@ bool allDocumentsActivated(std::wstring& theNotActivatedNames) int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); for (int i = 0; i < aSize; i++) { ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i); - ResultPartPtr aPart = std::dynamic_pointer_cast(aObject); + ResultPartPtr aPart = + std::dynamic_pointer_cast(aObject); if (!aPart->isActivated()) { anAllPartActivated = false; if (!theNotActivatedNames.empty()) @@ -585,17 +598,17 @@ bool allDocumentsActivated(std::wstring& theNotActivatedNames) return anAllPartActivated; } -bool removeFeaturesAndReferences(const std::set& theFeatures, +bool removeFeaturesAndReferences(const std::set &theFeatures, const bool /*theFlushRedisplay*/, const bool theUseComposite, - const bool theUseRecursion) -{ + const bool theUseRecursion) { #ifdef DEBUG_REMOVE_FEATURES printListInfo(theFeatures, "selection: "); #endif - std::map > aReferences; - ModelAPI_Tools::findAllReferences(theFeatures, aReferences, theUseComposite, theUseRecursion); + std::map> aReferences; + ModelAPI_Tools::findAllReferences(theFeatures, aReferences, theUseComposite, + theUseRecursion); #ifdef DEBUG_REMOVE_FEATURES printMapInfo(aReferences, "allDependencies: "); #endif @@ -617,9 +630,8 @@ bool removeFeaturesAndReferences(const std::set& theFeatures, } //*********************************************************************** -bool removeFeatures(const std::set& theFeatures, - const bool theFlushRedisplay) -{ +bool removeFeatures(const std::set &theFeatures, + const bool theFlushRedisplay) { bool isDone = false; std::set::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); @@ -636,28 +648,29 @@ bool removeFeatures(const std::set& theFeatures, // the redisplay signal should be flushed in order to erase // the feature presentation in the viewer // if should be done after removeFeature() of document - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } return true; } //*********************************************************************** -// Fills the references list by all references of the feature from the references map. -// This is a recusive method to find references by next found feature in the map of references. -// \param theFeature a feature to find references -// \param theReferencesMap a map of references -// \param theReferences an out container of references -void addRefsToFeature(const FeaturePtr& theFeature, - const std::map >& theReferencesMap, - int theRecLevel, - std::set& theReferences) -{ +// Fills the references list by all references of the feature from the +// references map. This is a recusive method to find references by next found +// feature in the map of references. \param theFeature a feature to find +// references \param theReferencesMap a map of references \param theReferences +// an out container of references +void addRefsToFeature( + const FeaturePtr &theFeature, + const std::map> &theReferencesMap, + int theRecLevel, std::set &theReferences) { if (theRecLevel > RECURSE_TOP_LEVEL) return; theRecLevel++; if (theReferencesMap.find(theFeature) == theReferencesMap.end()) - return; // this feature is not in the selection list, so exists without references to it + return; // this feature is not in the selection list, so exists without + // references to it std::set aMainReferences = theReferencesMap.at(theFeature); std::set::const_iterator anIt = aMainReferences.begin(), @@ -665,43 +678,44 @@ void addRefsToFeature(const FeaturePtr& theFeature, for (; anIt != aLast; anIt++) { FeaturePtr aRefFeature = *anIt; if (theReferences.find(aRefFeature) == theReferences.end()) { - addRefsToFeature(aRefFeature, theReferencesMap, theRecLevel, theReferences); + addRefsToFeature(aRefFeature, theReferencesMap, theRecLevel, + theReferences); theReferences.insert(aRefFeature); } } } -// For each feature from the feature list it searches references to the feature and append them -// to the references map. This is a recusive method. -// \param theFeature a feature to find references -// \param theReferencesMap a map of references -// \param theReferences an out container of references -void findReferences(const std::set& theFeatures, - std::map >& theReferences, - const bool theUseComposite, const bool theUseRecursion, int theRecLevel) -{ +// For each feature from the feature list it searches references to the feature +// and append them to the references map. This is a recusive method. \param +// theFeature a feature to find references \param theReferencesMap a map of +// references \param theReferences an out container of references +void findReferences(const std::set &theFeatures, + std::map> &theReferences, + const bool theUseComposite, const bool theUseRecursion, + int theRecLevel) { if (theRecLevel > RECURSE_TOP_LEVEL) return; theRecLevel++; std::set::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature.get() && theReferences.find(aFeature) == theReferences.end()) { DocumentPtr aSelFeatureDoc = aFeature->document(); std::set aSelRefFeatures; - aSelFeatureDoc->refsToFeature(aFeature, aSelRefFeatures, false/*do not emit signals*/); + aSelFeatureDoc->refsToFeature(aFeature, aSelRefFeatures, + false /*do not emit signals*/); if (theUseComposite) { // do not filter selection theReferences[aFeature] = aSelRefFeatures; - } - else { // filter references to skip composition features of the current feature + } else { // filter references to skip composition features of the current + // feature std::set aFilteredFeatures; std::set::const_iterator aRefIt = aSelRefFeatures.begin(), aRefLast = aSelRefFeatures.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aCFeature = *aRefIt; CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aCFeature); + std::dynamic_pointer_cast(aCFeature); if (aComposite.get() && aComposite->isSub(aFeature)) continue; /// composite of the current feature should be skipped aFilteredFeatures.insert(aCFeature); @@ -713,19 +727,18 @@ void findReferences(const std::set& theFeatures, findReferences(aSelRefFeatures, theReferences, theUseComposite, theUseRecursion, theRecLevel); #else - findReferences(theReferences[aFeature], theReferences, theUseComposite, theUseRecursion, - theRecLevel); + findReferences(theReferences[aFeature], theReferences, theUseComposite, + theUseRecursion, theRecLevel); #endif } } } } -void findAllReferences(const std::set& theFeatures, - std::map >& theReferences, - const bool theUseComposite, - const bool theUseRecursion) -{ +void findAllReferences( + const std::set &theFeatures, + std::map> &theReferences, + const bool theUseComposite, const bool theUseRecursion) { // For dependencies, find main_list: // sk_1(ext_1, vertex_1) // ext_1(bool_1, sk_3) @@ -735,9 +748,10 @@ void findAllReferences(const std::set& theFeatures, // sk_3() // Information: bool_1 is not selected, ext_2(bool_2) exists // find all referenced features - std::map > aMainList; + std::map> aMainList; int aRecLevel = 0; - findReferences(theFeatures, aMainList, theUseComposite, theUseRecursion, aRecLevel); + findReferences(theFeatures, aMainList, theUseComposite, theUseRecursion, + aRecLevel); #ifdef DEBUG_REMOVE_FEATURES printMapInfo(aMainList, "firstDependencies"); @@ -749,19 +763,21 @@ void findAllReferences(const std::set& theFeatures, // sk_2(ext_2) + (bool_1) // ext_2(bool_1) // sk_3() - std::map >::const_iterator aMainIt = aMainList.begin(), - aMainLast = aMainList.end(); + std::map>::const_iterator + aMainIt = aMainList.begin(), + aMainLast = aMainList.end(); for (; aMainIt != aMainLast; aMainIt++) { FeaturePtr aMainListFeature = aMainIt->first; - //std::string aName = aMainListFeature->name(); + // std::string aName = aMainListFeature->name(); std::set aMainRefList = aMainIt->second; #ifdef DEBUG_REMOVE_FEATURES_RECURSE char aBuf[50]; int n = sprintf(aBuf, "%d", aMainRefList.size()); std::string aSize(aBuf); - std::cout << "_findAllReferences for the Feature: " << getFeatureInfo(aMainListFeature) + std::cout << "_findAllReferences for the Feature: " + << getFeatureInfo(aMainListFeature) << ", references size = " << aSize << std::endl; #endif std::set::const_iterator anIt = aMainRefList.begin(), @@ -775,13 +791,13 @@ void findAllReferences(const std::set& theFeatures, std::cout << " Ref: " << getFeatureInfo(aFeature) << std::endl; #endif aRecLevel++; - addRefsToFeature(aFeature, aMainList, - aRecLevel, aResultRefList/*aMainRefList*/); + addRefsToFeature(aFeature, aMainList, aRecLevel, + aResultRefList /*aMainRefList*/); } theReferences[aMainListFeature] = aResultRefList; } #ifdef DEBUG_REMOVE_FEATURES_RECURSE - std::cout << std::endl; + std::cout << std::endl; #endif #ifdef DEBUG_REMOVE_FEATURES @@ -789,10 +805,10 @@ void findAllReferences(const std::set& theFeatures, #endif } -void findRefsToFeatures(const std::set& theFeatures, - const std::map >& theReferences, - std::set& theFeaturesRefsTo) -{ +void findRefsToFeatures( + const std::set &theFeatures, + const std::map> &theReferences, + std::set &theFeaturesRefsTo) { std::set::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { @@ -800,61 +816,71 @@ void findRefsToFeatures(const std::set& theFeatures, if (theReferences.find(aFeature) == theReferences.end()) continue; std::set aRefList = theReferences.at(aFeature); - std::set::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end(); + std::set::const_iterator aRefIt = aRefList.begin(), + aRefLast = aRefList.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aRefFeature); + std::dynamic_pointer_cast(aRefFeature); if (aComposite.get() && aComposite->isSub(aFeature)) continue; /// composite of the current feature should not be removed - if (theFeatures.find(aRefFeature) == theFeatures.end() && // it is not selected - theFeaturesRefsTo.find(aRefFeature) == theFeaturesRefsTo.end()) // it is not added + if (theFeatures.find(aRefFeature) == + theFeatures.end() && // it is not selected + theFeaturesRefsTo.find(aRefFeature) == + theFeaturesRefsTo.end()) // it is not added theFeaturesRefsTo.insert(aRefFeature); } } } -void getConcealedResults(const FeaturePtr& theFeature, - std::list >& theResults) -{ +void getConcealedResults( + const FeaturePtr &theFeature, + std::list> &theResults) { SessionPtr aSession = ModelAPI_Session::get(); - std::list > > > aRefs; + std::list>>> + aRefs; theFeature->data()->referencesToObjects(aRefs); - std::list > >::const_iterator - anIt = aRefs.begin(), aLast = aRefs.end(); + std::list>>::const_iterator + anIt = aRefs.begin(), + aLast = aRefs.end(); std::set alreadyThere; // to avoid duplications for (; anIt != aLast; anIt++) { - if (!aSession->validators()->isConcealed(theFeature->getKind(), anIt->first)) + if (!aSession->validators()->isConcealed(theFeature->getKind(), + anIt->first)) continue; // use only concealed attributes std::list anObjects = (*anIt).second; - std::list::const_iterator anOIt = anObjects.begin(), anOLast = anObjects.end(); + std::list::const_iterator anOIt = anObjects.begin(), + anOLast = anObjects.end(); for (; anOIt != anOLast; anOIt++) { ResultPtr aResult = std::dynamic_pointer_cast(*anOIt); if (aResult && aResult->isConcealed()) { - if (alreadyThere.find(aResult) == alreadyThere.end()) // issue 1712, avoid duplicates + if (alreadyThere.find(aResult) == + alreadyThere.end()) // issue 1712, avoid duplicates alreadyThere.insert(aResult); - else continue; + else + continue; theResults.push_back(aResult); } } } } -std::pair getDefaultName(const std::shared_ptr& theResult, - const bool theInherited, - const bool theRecursive) -{ - typedef std::list< std::pair < std::string, std::list > > ListOfReferences; +std::pair +getDefaultName(const std::shared_ptr &theResult, + const bool theInherited, const bool theRecursive) { + typedef std::list>> + ListOfReferences; SessionPtr aSession = ModelAPI_Session::get(); ResultBodyPtr anOwnerRes = bodyOwner(theResult); if (anOwnerRes) { // names of sub-solids in CompSolid should be default (for example, - // result of boolean operation 'Boolean_1_1' is a CompSolid which is renamed to 'MyBOOL', - // however, sub-elements of 'MyBOOL' should be named 'Boolean_1_1_1', 'Boolean_1_1_2' etc.) + // result of boolean operation 'Boolean_1_1' is a CompSolid which is renamed + // to 'MyBOOL', however, sub-elements of 'MyBOOL' should be named + // 'Boolean_1_1_1', 'Boolean_1_1_2' etc.) std::wostringstream aDefaultName; aDefaultName << getDefaultName(anOwnerRes).first; aDefaultName << "_" << (bodyIndex(theResult) + 1); @@ -872,17 +898,22 @@ std::pair getDefaultName(const std::shared_ptrvalidators()->isConcealed(anOwner->getKind(), aRefIt->first); - bool isMainArg = isConcealed && - aSession->validators()->isMainArgument(anOwner->getKind(), aRefIt->first); + bool isConcealed = aSession->validators()->isConcealed(anOwner->getKind(), + aRefIt->first); + bool isMainArg = isConcealed && aSession->validators()->isMainArgument( + anOwner->getKind(), aRefIt->first); if (isConcealed) { // check the referred object is a Body - // (for example, ExtrusionCut has a sketch as a first attribute which is concealing) - bool isBody = aRefIt->second.size() > 1 || (aRefIt->second.size() == 1 && - aRefIt->second.front().get() && - aRefIt->second.front()->groupName() == ModelAPI_ResultBody::group()); - if (isBody && (isMainArg || aFoundRef == aReferences.end() || - aData->isPrecedingAttribute(aRefIt->first, aFoundRef->first))) + // (for example, ExtrusionCut has a sketch as a first attribute which is + // concealing) + bool isBody = + aRefIt->second.size() > 1 || + (aRefIt->second.size() == 1 && aRefIt->second.front().get() && + aRefIt->second.front()->groupName() == + ModelAPI_ResultBody::group()); + if (isBody && + (isMainArg || aFoundRef == aReferences.end() || + aData->isPrecedingAttribute(aRefIt->first, aFoundRef->first))) aFoundRef = aRefIt; if (isMainArg) @@ -892,10 +923,10 @@ std::pair getDefaultName(const std::shared_ptr& anOwnerResults = anOwner->results(); + const std::list &anOwnerResults = anOwner->results(); std::list::const_iterator aResIt = anOwnerResults.cbegin(); - for(; aResIt != anOwnerResults.cend(); aResIt++) { - if(*aResIt == theResult) + for (; aResIt != anOwnerResults.cend(); aResIt++) { + if (*aResIt == theResult) break; anIndexInOwner++; } @@ -924,20 +955,23 @@ std::pair getDefaultName(const std::shared_ptrget() && (*anObjIt)->groupName() == ModelAPI_ResultBody::group()) { + if (anObjIt->get() && + (*anObjIt)->groupName() == ModelAPI_ResultBody::group()) { // check the result is part of CompSolid ResultPtr anObjRes = std::dynamic_pointer_cast(*anObjIt); ResultBodyPtr aParentBody = ModelAPI_Tools::bodyOwner(anObjRes); if (aParentBody) anObjRes = aParentBody; - // return name of reference result only if it has been renamed by the user, - // in other case compose a default name + // return name of reference result only if it has been renamed by the + // user, in other case compose a default name if (anObjRes->data()->hasUserDefinedName() || - (theRecursive && anObjRes->data()->name() != getDefaultName(anObjRes).first)) { + (theRecursive && + anObjRes->data()->name() != getDefaultName(anObjRes).first)) { std::wstringstream aName; aName << anObjRes->data()->name(); - std::map::iterator aFound = aNbRefToObject.find(anObjRes); + std::map::iterator aFound = + aNbRefToObject.find(anObjRes); if (aFound != aNbRefToObject.end()) { // to generate unique name, add suffix if there are several results // referring to the same shape @@ -953,21 +987,22 @@ std::pair getDefaultName(const std::shared_ptrname(); // if there are several results (issue #899: any number of result), // add unique prefix starting from second - if (anIndexInOwner > 0 || theResult->groupName() == ModelAPI_ResultBody::group()) + if (anIndexInOwner > 0 || + theResult->groupName() == ModelAPI_ResultBody::group()) aDefaultName << "_" << anIndexInOwner + 1; return std::pair(aDefaultName.str(), false); } -std::set getParents(const FeaturePtr& theFeature) -{ +std::set getParents(const FeaturePtr &theFeature) { std::set aParents; - for (FeaturePtr aCurFeat = theFeature; aCurFeat; ) { + for (FeaturePtr aCurFeat = theFeature; aCurFeat;) { CompositeFeaturePtr aFoundComposite; - const std::set& aRefs = aCurFeat->data()->refsToMe(); + const std::set &aRefs = aCurFeat->data()->refsToMe(); for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) { + anIt != aRefs.end(); ++anIt) { FeaturePtr aF = ModelAPI_Feature::feature((*anIt)->owner()); - aFoundComposite = std::dynamic_pointer_cast(aF); + aFoundComposite = + std::dynamic_pointer_cast(aF); if (aFoundComposite && aFoundComposite->isSub(aCurFeat)) break; else @@ -977,15 +1012,16 @@ std::set getParents(const FeaturePtr& theFeature) if (aFoundComposite) { aParents.insert(aFoundComposite); aCurFeat = aFoundComposite; - } - else { + } else { // add the part containing high-level feature SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aPartSetDoc = aSession->moduleDocument(); std::list aPartSetFeatures = aPartSetDoc->allFeatures(); - for (std::list::const_iterator anIt = aPartSetFeatures.begin(); - anIt != aPartSetFeatures.end(); ++anIt) { - aFoundComposite = std::dynamic_pointer_cast(*anIt); + for (std::list::const_iterator anIt = + aPartSetFeatures.begin(); + anIt != aPartSetFeatures.end(); ++anIt) { + aFoundComposite = + std::dynamic_pointer_cast(*anIt); if (aFoundComposite && aFoundComposite->isSub(aCurFeat)) { aParents.insert(aFoundComposite); break; @@ -998,10 +1034,9 @@ std::set getParents(const FeaturePtr& theFeature) return aParents; } -void fillShapeHierarchy(const GeomShapePtr& theShape, - const ResultPtr& theContext, - GeomAPI_ShapeHierarchy& theHierarchy) -{ +void fillShapeHierarchy(const GeomShapePtr &theShape, + const ResultPtr &theContext, + GeomAPI_ShapeHierarchy &theHierarchy) { ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(theContext); if (aResCompSolidPtr.get()) { std::shared_ptr aContextShape = aResCompSolidPtr->shape(); @@ -1012,25 +1047,24 @@ void fillShapeHierarchy(const GeomShapePtr& theShape, } } - -void removeResults(const std::list& theResults) -{ +void removeResults(const std::list &theResults) { // collect all documents where the results must be removed - std::map > aDocs; + std::map> aDocs; std::list::const_iterator aResIter = theResults.cbegin(); - for(; aResIter != theResults.cend(); aResIter++) { + for (; aResIter != theResults.cend(); aResIter++) { DocumentPtr aDoc = (*aResIter)->document(); if (!aDocs.count(aDoc)) aDocs[aDoc] = std::list(); aDocs[aDoc].push_back(*aResIter); } // create a "remove" feature in each doc - std::map >::iterator aDoc = aDocs.begin(); - for(; aDoc != aDocs.end(); aDoc++) { + std::map>::iterator aDoc = aDocs.begin(); + for (; aDoc != aDocs.end(); aDoc++) { FeaturePtr aRemove = aDoc->first->addFeature("RemoveResults"); if (aRemove) { - for(aResIter = aDoc->second.cbegin(); aResIter != aDoc->second.cend(); aResIter++) + for (aResIter = aDoc->second.cbegin(); aResIter != aDoc->second.cend(); + aResIter++) aRemove->selectionList("results")->append(*aResIter, GeomShapePtr()); } } @@ -1040,27 +1074,29 @@ void removeResults(const std::list& theResults) // LCOV_EXCL_START //************************************************************** -void setDeflection(ResultPtr theResult, const double theDeflection) -{ +void setDeflection(ResultPtr theResult, const double theDeflection) { if (!theResult.get()) return; - AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); + AttributeDoublePtr aDeflectionAttr = + theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); if (aDeflectionAttr.get() != NULL) { aDeflectionAttr->setValue(theDeflection); } } -double getDeflection(const std::shared_ptr& theResult) -{ +double getDeflection(const std::shared_ptr &theResult) { double aDeflection = -1; // get deflection from the attribute of the result if (theResult.get() != NULL && - theResult->data()->attribute(ModelAPI_Result::DEFLECTION_ID()).get() != NULL) { - AttributeDoublePtr aDoubleAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); + theResult->data()->attribute(ModelAPI_Result::DEFLECTION_ID()).get() != + NULL) { + AttributeDoublePtr aDoubleAttr = + theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); if (aDoubleAttr.get() && aDoubleAttr->isInitialized()) { double aValue = aDoubleAttr->value(); - if (aValue > 0) /// zero value should not be used as a deflection(previous studies) + if (aValue > + 0) /// zero value should not be used as a deflection(previous studies) aDeflection = aDoubleAttr->value(); } } @@ -1068,12 +1104,12 @@ double getDeflection(const std::shared_ptr& theResult) } //****************************************************** -void setColor(ResultPtr theResult, const std::vector& theColor) -{ +void setColor(ResultPtr theResult, const std::vector &theColor) { if (!theResult.get()) return; - AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aColorAttr = + theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() != NULL) { if (!aColorAttr->size()) { aColorAttr->setSize(3); @@ -1084,13 +1120,14 @@ void setColor(ResultPtr theResult, const std::vector& theColor) } } -void getColor(const std::shared_ptr& theResult, std::vector& theColor) -{ +void getColor(const std::shared_ptr &theResult, + std::vector &theColor) { theColor.clear(); // get color from the attribute of the result if (theResult.get() != NULL && - theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { - AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { + AttributeIntArrayPtr aColorAttr = + theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() && aColorAttr->size()) { theColor.push_back(aColorAttr->value(0)); theColor.push_back(aColorAttr->value(1)); @@ -1100,9 +1137,8 @@ void getColor(const std::shared_ptr& theResult, std::vector& theResult, - bool& isVisible, std::vector& theNbLines) -{ +void getIsoLines(const std::shared_ptr &theResult, + bool &isVisible, std::vector &theNbLines) { theNbLines.clear(); isVisible = false; if (!theResult.get()) @@ -1110,10 +1146,10 @@ void getIsoLines(const std::shared_ptr& theResult, if (theResult->groupName() == ModelAPI_ResultConstruction::group()) { theNbLines.push_back(0); theNbLines.push_back(0); - } - else { + } else { // get color from the attribute of the result - AttributeIntArrayPtr aAttr = theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); + AttributeIntArrayPtr aAttr = + theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); if (aAttr.get()) { if (aAttr->size()) { theNbLines.push_back(aAttr->value(0)); @@ -1121,7 +1157,7 @@ void getIsoLines(const std::shared_ptr& theResult, } } AttributeBooleanPtr aBoolAttr = - theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); + theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); if (aBoolAttr.get()) { isVisible = aBoolAttr->value(); } @@ -1129,12 +1165,12 @@ void getIsoLines(const std::shared_ptr& theResult, } //****************************************************** -void setIsoLines(ResultPtr theResult, const std::vector& theIso) -{ +void setIsoLines(ResultPtr theResult, const std::vector &theIso) { if (!theResult.get()) return; - AttributeIntArrayPtr aAttr = theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); + AttributeIntArrayPtr aAttr = + theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); if (aAttr.get() != NULL) { if (!aAttr->size()) { aAttr->setSize(2); @@ -1145,24 +1181,24 @@ void setIsoLines(ResultPtr theResult, const std::vector& theIso) } //****************************************************** -void showIsoLines(std::shared_ptr theResult, bool theShow) -{ +void showIsoLines(std::shared_ptr theResult, bool theShow) { if (!theResult.get()) return; - AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); + AttributeBooleanPtr aAttr = + theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); if (aAttr.get() != NULL) { aAttr->setValue(theShow); } } //****************************************************** -bool isShownIsoLines(std::shared_ptr theResult) -{ +bool isShownIsoLines(std::shared_ptr theResult) { if (!theResult.get()) return false; - AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); + AttributeBooleanPtr aAttr = + theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); if (aAttr.get() != NULL) { return aAttr->value(); } @@ -1170,24 +1206,25 @@ bool isShownIsoLines(std::shared_ptr theResult) } //****************************************************** -void showEdgesDirection(std::shared_ptr theResult, bool theShow) -{ +void showEdgesDirection(std::shared_ptr theResult, + bool theShow) { if (!theResult.get()) return; - AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID()); + AttributeBooleanPtr aAttr = + theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID()); if (aAttr.get() != NULL) { aAttr->setValue(theShow); } } //****************************************************** -bool isShowEdgesDirection(std::shared_ptr theResult) -{ +bool isShowEdgesDirection(std::shared_ptr theResult) { if (!theResult.get()) return false; - AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID()); + AttributeBooleanPtr aAttr = + theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID()); if (aAttr.get() != NULL) { return aAttr->value(); } @@ -1195,24 +1232,24 @@ bool isShowEdgesDirection(std::shared_ptr theResult) } //****************************************************** -void bringToFront(std::shared_ptr theResult, bool theFlag) -{ +void bringToFront(std::shared_ptr theResult, bool theFlag) { if (!theResult.get()) return; - AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID()); + AttributeBooleanPtr aAttr = + theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID()); if (aAttr.get() != NULL) { aAttr->setValue(theFlag); } } //****************************************************** -bool isBringToFront(std::shared_ptr theResult) -{ +bool isBringToFront(std::shared_ptr theResult) { if (!theResult.get()) return false; - AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID()); + AttributeBooleanPtr aAttr = + theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID()); if (aAttr.get() != NULL) { return aAttr->value(); } @@ -1220,24 +1257,25 @@ bool isBringToFront(std::shared_ptr theResult) } //************************************************************** -void setTransparency(ResultPtr theResult, double theTransparency) -{ +void setTransparency(ResultPtr theResult, double theTransparency) { if (!theResult.get()) return; - AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + AttributeDoublePtr anAttribute = + theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); if (anAttribute.get() != NULL) { anAttribute->setValue(theTransparency); } } -double getTransparency(const std::shared_ptr& theResult) -{ +double getTransparency(const std::shared_ptr &theResult) { double aTransparency = -1; // get transparency from the attribute of the result if (theResult.get() != NULL && - theResult->data()->attribute(ModelAPI_Result::TRANSPARENCY_ID()).get() != NULL) { - AttributeDoublePtr aDoubleAttr = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + theResult->data()->attribute(ModelAPI_Result::TRANSPARENCY_ID()).get() != + NULL) { + AttributeDoublePtr aDoubleAttr = + theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); if (aDoubleAttr.get() && aDoubleAttr->isInitialized()) { aTransparency = aDoubleAttr->value(); } @@ -1245,123 +1283,146 @@ double getTransparency(const std::shared_ptr& theResult) return aTransparency; } -void copyVisualizationAttrs( - std::shared_ptr theSource, std::shared_ptr theDest) -{ +void copyVisualizationAttrs(std::shared_ptr theSource, + std::shared_ptr theDest) { // color - AttributeIntArrayPtr aSourceColor = theSource->data()->intArray(ModelAPI_Result::COLOR_ID()); - if (aSourceColor.get() && aSourceColor->isInitialized() && aSourceColor->size()) { - AttributeIntArrayPtr aDestColor = theDest->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aSourceColor = + theSource->data()->intArray(ModelAPI_Result::COLOR_ID()); + if (aSourceColor.get() && aSourceColor->isInitialized() && + aSourceColor->size()) { + AttributeIntArrayPtr aDestColor = + theDest->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aDestColor.get()) { aDestColor->setSize(aSourceColor->size()); - for(int a = 0; a < aSourceColor->size(); a++) + for (int a = 0; a < aSourceColor->size(); a++) aDestColor->setValue(a, aSourceColor->value(a)); } } // Iso-lines - AttributeIntArrayPtr aSource = theSource->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); + AttributeIntArrayPtr aSource = + theSource->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); if (aSource.get() && aSource->isInitialized() && aSource->size()) { - AttributeIntArrayPtr aDest = theDest->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); + AttributeIntArrayPtr aDest = + theDest->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); if (aDest.get()) { aDest->setSize(aSource->size()); - for(int a = 0; a < aSource->size(); a++) + for (int a = 0; a < aSource->size(); a++) aDest->setValue(a, aSource->value(a)); } } // deflection - AttributeDoublePtr aSourceDefl = theSource->data()->real(ModelAPI_Result::DEFLECTION_ID()); + AttributeDoublePtr aSourceDefl = + theSource->data()->real(ModelAPI_Result::DEFLECTION_ID()); if (aSourceDefl.get() && aSourceDefl->isInitialized()) { - AttributeDoublePtr aDestDefl = theDest->data()->real(ModelAPI_Result::DEFLECTION_ID()); + AttributeDoublePtr aDestDefl = + theDest->data()->real(ModelAPI_Result::DEFLECTION_ID()); if (aDestDefl.get()) { aDestDefl->setValue(aSourceDefl->value()); } } // transparency - AttributeDoublePtr aSourceTransp = theSource->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + AttributeDoublePtr aSourceTransp = + theSource->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); if (aSourceTransp.get() && aSourceTransp->isInitialized()) { - AttributeDoublePtr aDestTransp = theDest->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + AttributeDoublePtr aDestTransp = + theDest->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); if (aDestTransp.get()) { aDestTransp->setValue(aSourceTransp->value()); } } } - -void copyImageAttribute (std::shared_ptr theSource, - std::shared_ptr theDest) -{ +void copyImageAttribute(std::shared_ptr theSource, + std::shared_ptr theDest) { if (!theSource.get() || !theDest.get()) return; // images allowed only for ResultBody - ResultBodyPtr aSourceBody = std::dynamic_pointer_cast(theSource); - ResultBodyPtr aDestBody = std::dynamic_pointer_cast(theDest); + ResultBodyPtr aSourceBody = + std::dynamic_pointer_cast(theSource); + ResultBodyPtr aDestBody = + std::dynamic_pointer_cast(theDest); if (!aSourceBody.get() || !aDestBody.get()) return; AttributeImagePtr aSourceImage = - theSource->data()->image(ModelAPI_ResultBody::IMAGE_ID()); + theSource->data()->image(ModelAPI_ResultBody::IMAGE_ID()); if (aSourceImage.get() && aSourceImage->hasTexture()) { AttributeImagePtr aDestImage = - theDest->data()->image(ModelAPI_ResultBody::IMAGE_ID()); + theDest->data()->image(ModelAPI_ResultBody::IMAGE_ID()); if (aDestImage.get()) { aSourceImage->copyTo(aDestImage); } } } -std::list referencedFeatures( - std::shared_ptr theTarget, const std::string& theFeatureKind, - const bool theSortResults) -{ - std::set aResSet; // collect in the set initially to avoid duplicates +std::list +referencedFeatures(std::shared_ptr theTarget, + const std::string &theFeatureKind, + const bool theSortResults) { + std::set + aResSet; // collect in the set initially to avoid duplicates std::list allSubRes; allSubRes.push_back(theTarget); - ResultBodyPtr aBody = std::dynamic_pointer_cast(theTarget); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(theTarget); if (aBody.get()) allSubs(aBody, allSubRes); std::list::iterator aSub = allSubRes.begin(); - for(; aSub != allSubRes.end(); aSub++) { - const std::set& aRefs = (*aSub)->data()->refsToMe(); + for (; aSub != allSubRes.end(); aSub++) { + const std::set &aRefs = (*aSub)->data()->refsToMe(); std::set::const_iterator aRef = aRefs.cbegin(); - for(; aRef != aRefs.cend(); aRef++) { - FeaturePtr aFeat = std::dynamic_pointer_cast((*aRef)->owner()); - if (aFeat.get() && (theFeatureKind.empty() || aFeat->getKind() == theFeatureKind)) + for (; aRef != aRefs.cend(); aRef++) { + FeaturePtr aFeat = + std::dynamic_pointer_cast((*aRef)->owner()); + if (aFeat.get() && + (theFeatureKind.empty() || aFeat->getKind() == theFeatureKind)) aResSet.insert(aFeat); } } // add also feature of the target that may be referenced as a whole FeaturePtr aTargetFeature = theTarget->document()->feature(theTarget); - const std::set& aRefs = aTargetFeature->data()->refsToMe(); + const std::set &aRefs = aTargetFeature->data()->refsToMe(); std::set::const_iterator aRef = aRefs.cbegin(); - for(; aRef != aRefs.cend(); aRef++) { - FeaturePtr aFeat = std::dynamic_pointer_cast((*aRef)->owner()); - if (aFeat.get() && (theFeatureKind.empty() || aFeat->getKind() == theFeatureKind)) + for (; aRef != aRefs.cend(); aRef++) { + FeaturePtr aFeat = + std::dynamic_pointer_cast((*aRef)->owner()); + if (aFeat.get() && + (theFeatureKind.empty() || aFeat->getKind() == theFeatureKind)) aResSet.insert(aFeat); } - // check also Group-operations that may refer to groups - add them for theFeatureKind "Group" + // check also Group-operations that may refer to groups - add them for + // theFeatureKind "Group" if (theFeatureKind == "Group") { std::set aGroupOperations; - for(bool aNeedIterate = true; aNeedIterate; ) { + for (bool aNeedIterate = true; aNeedIterate;) { std::set::iterator aResIter = aResSet.begin(); - for(; aResIter != aResSet.end(); aResIter++) { - std::list::const_iterator aGroupRes = (*aResIter)->results().cbegin(); - for(; aGroupRes != (*aResIter)->results().cend(); aGroupRes++) { - const std::set& aGroupRefs = (*aGroupRes)->data()->refsToMe(); + for (; aResIter != aResSet.end(); aResIter++) { + std::list::const_iterator aGroupRes = + (*aResIter)->results().cbegin(); + for (; aGroupRes != (*aResIter)->results().cend(); aGroupRes++) { + const std::set &aGroupRefs = + (*aGroupRes)->data()->refsToMe(); std::set::const_iterator aRefIt = aGroupRefs.cbegin(); - for(; aRefIt != aGroupRefs.cend(); aRefIt++) { - FeaturePtr aFeat = std::dynamic_pointer_cast((*aRefIt)->owner()); - if (aFeat.get() && !aGroupOperations.count(aFeat) && !aFeat->results().empty() && - aFeat->firstResult()->groupName() == ModelAPI_ResultGroup::group()) { - // iterate results of this group operation because it may be without theTarget shape + for (; aRefIt != aGroupRefs.cend(); aRefIt++) { + FeaturePtr aFeat = + std::dynamic_pointer_cast((*aRefIt)->owner()); + if (aFeat.get() && !aGroupOperations.count(aFeat) && + !aFeat->results().empty() && + aFeat->firstResult()->groupName() == + ModelAPI_ResultGroup::group()) { + // iterate results of this group operation because it may be + // without theTarget shape GeomShapePtr aTargetShape = theTarget->shape(); bool anIsIn = false; - std::list::const_iterator anOpRes = aFeat->results().cbegin(); - for(; anOpRes != aFeat->results().cend() && !anIsIn; anOpRes++) { + std::list::const_iterator anOpRes = + aFeat->results().cbegin(); + for (; anOpRes != aFeat->results().cend() && !anIsIn; anOpRes++) { GeomShapePtr anOpShape = (*anOpRes)->shape(); if (!anOpShape.get() || anOpShape->isNull()) continue; - for(GeomAPI_ShapeIterator aSubIt(anOpShape); aSubIt.more(); aSubIt.next()) { + for (GeomAPI_ShapeIterator aSubIt(anOpShape); aSubIt.more(); + aSubIt.next()) { if (aTargetShape->isSubShape(aSubIt.current(), false)) { anIsIn = true; break; @@ -1374,10 +1435,11 @@ std::list referencedFeatures( } } } - // insert all new group operations into result and if they are, check for next dependencies + // insert all new group operations into result and if they are, check for + // next dependencies aNeedIterate = false; std::set::iterator aGroupOpIter = aGroupOperations.begin(); - for(; aGroupOpIter != aGroupOperations.end(); aGroupOpIter++) { + for (; aGroupOpIter != aGroupOperations.end(); aGroupOpIter++) { if (aResSet.find(*aGroupOpIter) == aResSet.end()) { aResSet.insert(*aGroupOpIter); aNeedIterate = true; @@ -1388,10 +1450,10 @@ std::list referencedFeatures( std::list aResList; std::set::iterator aResIter = aResSet.begin(); - for(; aResIter != aResSet.end(); aResIter++) { + for (; aResIter != aResSet.end(); aResIter++) { if (theSortResults) { // sort results by creation-order std::list::iterator aListIter = aResList.begin(); - for(; aListIter != aResList.end(); aListIter++) { + for (; aListIter != aResList.end(); aListIter++) { if ((*aResIter)->document()->isLater(*aListIter, *aResIter)) break; } @@ -1399,71 +1461,76 @@ std::list referencedFeatures( aResList.push_back(*aResIter); else aResList.insert(aListIter, *aResIter); - } else //just push to the end unsorted + } else // just push to the end unsorted aResList.push_back(*aResIter); } return aResList; } -void setValues(std::vector& theRGB, const int theRed, const int theGreen, const int theBlue) -{ +void setValues(std::vector &theRGB, const int theRed, const int theGreen, + const int theBlue) { theRGB.push_back(theRed); theRGB.push_back(theGreen); theRGB.push_back(theBlue); } -std::vector HSVtoRGB(int theH, int theS, int theV) -{ +std::vector HSVtoRGB(int theH, int theS, int theV) { std::vector aRGB; - if (theH < 0 || theH > 360 || - theS < 0 || theS > 100 || - theV < 0 || theV > 100) + if (theH < 0 || theH > 360 || theS < 0 || theS > 100 || theV < 0 || + theV > 100) return aRGB; - int aHi = (int)theH/60; + int aHi = (int)theH / 60; double aV = theV; - double aVmin = (100 - theS)*theV/100; - double anA = (theV - aVmin)* (theH % 60) / 60; + double aVmin = (100 - theS) * theV / 100; + double anA = (theV - aVmin) * (theH % 60) / 60; double aVinc = aVmin + anA; double aVdec = theV - anA; - double aPercentToValue = 255./100; - int aV_int = (int)(aV*aPercentToValue); - int aVinc_int = (int)(aVinc*aPercentToValue); - int aVmin_int = (int)(aVmin*aPercentToValue); - int aVdec_int = (int)(aVdec*aPercentToValue); - - switch(aHi) { - case 0: setValues(aRGB, aV_int, aVinc_int, aVmin_int); break; - case 1: setValues(aRGB, aVdec_int, aV_int, aVmin_int); break; - case 2: setValues(aRGB, aVmin_int, aV_int, aVinc_int); break; - case 3: setValues(aRGB, aVmin_int, aVdec_int, aV_int); break; - case 4: setValues(aRGB, aVinc_int, aVmin_int, aV_int); break; - case 5: setValues(aRGB, aV_int, aVmin_int, aVdec_int); break; - default: break; + double aPercentToValue = 255. / 100; + int aV_int = (int)(aV * aPercentToValue); + int aVinc_int = (int)(aVinc * aPercentToValue); + int aVmin_int = (int)(aVmin * aPercentToValue); + int aVdec_int = (int)(aVdec * aPercentToValue); + + switch (aHi) { + case 0: + setValues(aRGB, aV_int, aVinc_int, aVmin_int); + break; + case 1: + setValues(aRGB, aVdec_int, aV_int, aVmin_int); + break; + case 2: + setValues(aRGB, aVmin_int, aV_int, aVinc_int); + break; + case 3: + setValues(aRGB, aVmin_int, aVdec_int, aV_int); + break; + case 4: + setValues(aRGB, aVinc_int, aVmin_int, aV_int); + break; + case 5: + setValues(aRGB, aV_int, aVmin_int, aVdec_int); + break; + default: + break; } return aRGB; } std::array, 10> myColorTab = { - std::vector {255, 0, 0}, - std::vector {0, 255, 0}, - std::vector {0, 0, 255}, - std::vector {255, 255, 0}, - std::vector {0, 255, 255}, - std::vector {255, 0, 255}, - std::vector {255, 94, 0}, - std::vector {132, 255, 0}, - std::vector {132, 0, 255}, - std::vector {0, 0, 0}, + std::vector{255, 0, 0}, std::vector{0, 255, 0}, + std::vector{0, 0, 255}, std::vector{255, 255, 0}, + std::vector{0, 255, 255}, std::vector{255, 0, 255}, + std::vector{255, 94, 0}, std::vector{132, 255, 0}, + std::vector{132, 0, 255}, std::vector{0, 0, 0}, }; -void findRandomColor(std::vector& theValues, bool theReset) -{ +void findRandomColor(std::vector &theValues, bool theReset) { static size_t i = 0; static std::vector> usedGeneratedColor; // True when disabling auto-color - if ( theReset ) { + if (theReset) { i = 0; return; } @@ -1472,78 +1539,82 @@ void findRandomColor(std::vector& theValues, bool theReset) if (i < myColorTab.size()) { theValues = myColorTab[i++]; } else { - int timeout = 0; - std::vector aHSVColor; - std::vector aRGBColor; - do { - aHSVColor = {rand() % 360 , rand() % (100 - 50 + 1) + 50, rand() % (100 - 50 + 1) + 50}; - aRGBColor = HSVtoRGB(aHSVColor[0], aHSVColor[1], aHSVColor[2]); - timeout++; - } while ( - timeout < 20 && - std::find(usedGeneratedColor.begin(), usedGeneratedColor.end(), aHSVColor) - != usedGeneratedColor.end() && - std::find(myColorTab.begin(), myColorTab.end(), aRGBColor) != myColorTab.end()); - usedGeneratedColor.push_back(aHSVColor); - theValues = aRGBColor; + int timeout = 0; + std::vector aHSVColor; + std::vector aRGBColor; + do { + aHSVColor = {rand() % 360, rand() % (100 - 50 + 1) + 50, + rand() % (100 - 50 + 1) + 50}; + aRGBColor = HSVtoRGB(aHSVColor[0], aHSVColor[1], aHSVColor[2]); + timeout++; + } while (timeout < 20 && + std::find(usedGeneratedColor.begin(), usedGeneratedColor.end(), + aHSVColor) != usedGeneratedColor.end() && + std::find(myColorTab.begin(), myColorTab.end(), aRGBColor) != + myColorTab.end()); + usedGeneratedColor.push_back(aHSVColor); + theValues = aRGBColor; } } // LCOV_EXCL_STOP /// Returns name of the higher level feature (Part or feature of PartSet). -static FeaturePtr topOwner(const FeaturePtr& theFeature) -{ +static FeaturePtr topOwner(const FeaturePtr &theFeature) { FeaturePtr anOwner = theFeature; - while (anOwner.get()) - { + while (anOwner.get()) { FeaturePtr aNextOwner = compositeOwner(anOwner); if (aNextOwner.get()) anOwner = aNextOwner; else break; } - if (anOwner->document() != ModelAPI_Session::get()->moduleDocument()) // the part-owner name - anOwner = findPartFeature(ModelAPI_Session::get()->moduleDocument(), anOwner->document()); + if (anOwner->document() != + ModelAPI_Session::get()->moduleDocument()) // the part-owner name + anOwner = findPartFeature(ModelAPI_Session::get()->moduleDocument(), + anOwner->document()); return anOwner; } -std::wstring validateMovement(const FeaturePtr& theAfter, const std::list theMoved) -{ +std::wstring validateMovement(const FeaturePtr &theAfter, + const std::list theMoved) { std::wstring aResult; if (theMoved.empty()) return aResult; // nothing to move, nothing to check, ok - DocumentPtr aDoc = theAfter.get() ? theAfter->document() : (*(theMoved.cbegin()))->document(); - std::set aMoved(theMoved.begin(), theMoved.end()); // fast access to moved - std::set aPassed, aPassedMoved; // all features and all moved before the current one + DocumentPtr aDoc = theAfter.get() ? theAfter->document() + : (*(theMoved.cbegin()))->document(); + std::set aMoved(theMoved.begin(), + theMoved.end()); // fast access to moved + std::set aPassed, + aPassedMoved; // all features and all moved before the current one std::set aPassedAfter; // all passed features after theAfter - bool anAfterIsPassed = theAfter.get() == 0; // flag that iterator already passed theAfter + bool anAfterIsPassed = + theAfter.get() == 0; // flag that iterator already passed theAfter std::list allFeat = aDoc->allFeatures(); - for (std::list::iterator aFeat = allFeat.begin(); aFeat != allFeat.end(); aFeat++) - { - if (!anAfterIsPassed) - { + for (std::list::iterator aFeat = allFeat.begin(); + aFeat != allFeat.end(); aFeat++) { + if (!anAfterIsPassed) { if (aMoved.count(*aFeat)) aPassedMoved.insert(*aFeat); else // check aPassedMoved are not referenced by the current feature aPassed.insert(*aFeat); anAfterIsPassed = *aFeat == theAfter; - if (anAfterIsPassed && !aPassedMoved.empty()) - { // check dependencies of moved relatively to the passed - std::map > aReferences; + if (anAfterIsPassed && + !aPassedMoved.empty()) { // check dependencies of moved relatively to + // the passed + std::map> aReferences; findAllReferences(aPassedMoved, aReferences); - std::map >::iterator aRefIter = aReferences.begin(); - for (; aRefIter != aReferences.end(); aRefIter++) - { - if (aPassed.count(aRefIter->first)) - { + std::map>::iterator aRefIter = + aReferences.begin(); + for (; aRefIter != aReferences.end(); aRefIter++) { + if (aPassed.count(aRefIter->first)) { aResult += topOwner(aRefIter->first)->name() + L" -> "; - // iterate all passed moved to check is it referenced by described feature or not + // iterate all passed moved to check is it referenced by described + // feature or not std::set::iterator aMovedIter = aPassedMoved.begin(); - for (; aMovedIter != aPassedMoved.end(); aMovedIter++) - { - std::map > aPassedRefs; + for (; aMovedIter != aPassedMoved.end(); aMovedIter++) { + std::map> aPassedRefs; std::set aMovedOne; aMovedOne.insert(*aMovedIter); findAllReferences(aMovedOne, aPassedRefs); @@ -1554,48 +1625,49 @@ std::wstring validateMovement(const FeaturePtr& theAfter, const std::list > aReferences; + if (aMoved.count(*aFeat)) { // check dependencies of moved relatively to + // ones after theAfter + std::map> aReferences; findAllReferences(aPassedAfter, aReferences); bool aFoundRef = aReferences.find(*aFeat) != aReferences.end(); - if (!aFoundRef && !(*aFeat)->results().empty()) // reference may be a feature in moved part + if (!aFoundRef && !(*aFeat)->results().empty()) // reference may be a + // feature in moved part { ResultPartPtr aFeatPart = - std::dynamic_pointer_cast((*aFeat)->firstResult()); - if (aFeatPart.get() && aFeatPart->partDoc().get()) - { - std::map >::iterator aRef = aReferences.begin(); + std::dynamic_pointer_cast( + (*aFeat)->firstResult()); + if (aFeatPart.get() && aFeatPart->partDoc().get()) { + std::map>::iterator aRef = + aReferences.begin(); for (; aRef != aReferences.end() && !aFoundRef; aRef++) aFoundRef = aRef->first->document() == aFeatPart->partDoc(); } } - if (aFoundRef) - { + if (aFoundRef) { aResult += topOwner(*aFeat)->name() + L" -> "; - std::set aReferencedCount; // to avoid duplicates in the displayed references - // iterate all passed after theAfter to check refers it described feature or not + std::set aReferencedCount; // to avoid duplicates in the + // displayed references + // iterate all passed after theAfter to check refers it described + // feature or not FeaturePtr aFeatTop = topOwner(*aFeat); std::set::iterator aPassedIter = aPassedAfter.begin(); - for (; aPassedIter != aPassedAfter.end(); aPassedIter++) - { + for (; aPassedIter != aPassedAfter.end(); aPassedIter++) { FeaturePtr aPassedTop = topOwner(*aPassedIter); if (aReferencedCount.count(aPassedTop)) continue; - std::map > aPassedRefs; + std::map> aPassedRefs; std::set aPassedOne; aPassedOne.insert(*aPassedIter); findAllReferences(aPassedOne, aPassedRefs); - std::map >::iterator aPRIter = aPassedRefs.begin(); - for (; aPRIter != aPassedRefs.end(); aPRIter++) - { + std::map>::iterator aPRIter = + aPassedRefs.begin(); + for (; aPRIter != aPassedRefs.end(); aPRIter++) { FeaturePtr aPRTop = topOwner(aPRIter->first); if (aPRIter->first == *aFeat || aPRIter->first == aFeatTop || - aPRTop == *aFeat || aPRTop == aFeatTop) - { + aPRTop == *aFeat || aPRTop == aFeatTop) { aResult += aPassedTop->name() + L" "; aReferencedCount.insert(aPassedTop); break; @@ -1604,12 +1676,10 @@ std::wstring validateMovement(const FeaturePtr& theAfter, const std::list -#include +#include #include +#include #include -#include +#include namespace ModelAPI_Tools { /// Returns shape from the given Result object -MODELAPI_EXPORT std::shared_ptr shape( - const std::shared_ptr& theResult); +MODELAPI_EXPORT std::shared_ptr +shape(const std::shared_ptr &theResult); -/*! Returns the feature error generated according to feature error and exec state - * \param theFeature a feature - * \return error value or empty string +/*! Returns the feature error generated according to feature error and exec + * state \param theFeature a feature \return error value or empty string */ -MODELAPI_EXPORT std::string getFeatureError(const std::shared_ptr& theFeature); +MODELAPI_EXPORT std::string +getFeatureError(const std::shared_ptr &theFeature); struct ResultBaseAlgo { std::shared_ptr resultBody; @@ -57,79 +58,86 @@ struct ResultBaseAlgo { std::shared_ptr makeShape; }; -MODELAPI_EXPORT void loadModifiedShapes(std::shared_ptr theResultBody, - const std::list>& theBaseShapes, - const std::list>& theTools, - const std::shared_ptr& theMakeShape, - const std::shared_ptr theResultShape, - const std::string& theNamePrefix = ""); - -MODELAPI_EXPORT void loadModifiedShapes(std::shared_ptr theResultBody, - const std::shared_ptr& theBaseShape, - const std::shared_ptr& theMakeShape, - const std::string theName); +MODELAPI_EXPORT void loadModifiedShapes( + std::shared_ptr theResultBody, + const std::list> &theBaseShapes, + const std::list> &theTools, + const std::shared_ptr &theMakeShape, + const std::shared_ptr theResultShape, + const std::string &theNamePrefix = ""); + +MODELAPI_EXPORT void +loadModifiedShapes(std::shared_ptr theResultBody, + const std::shared_ptr &theBaseShape, + const std::shared_ptr &theMakeShape, + const std::string theName); /// Stores deleted shapes. -MODELAPI_EXPORT void loadDeletedShapes(std::shared_ptr theResultBody, - const std::shared_ptr theBaseShape, - const std::list>& theTools, - const std::shared_ptr& theMakeShape, - const std::shared_ptr theResultShapesCompound); +MODELAPI_EXPORT void +loadDeletedShapes(std::shared_ptr theResultBody, + const std::shared_ptr theBaseShape, + const std::list> &theTools, + const std::shared_ptr &theMakeShape, + const std::shared_ptr theResultShapesCompound); /// Stores deleted shapes. -MODELAPI_EXPORT void loadDeletedShapes(std::vector& theResultBaseAlgoList, - const std::list>& theTools, - const std::shared_ptr theResultShapesCompound); +MODELAPI_EXPORT void +loadDeletedShapes(std::vector &theResultBaseAlgoList, + const std::list> &theTools, + const std::shared_ptr theResultShapesCompound); /*! * Searches for variable with name \param theName in \param theDocument. * If found, set it value in the \param outValue and returns true. * theSearcher must be located later in the history than the found variable. */ -MODELAPI_EXPORT bool findVariable(const std::shared_ptr& theDocument, - std::shared_ptr theSearcher, - const std::wstring& theName, double& outValue, - std::shared_ptr& theParam); +MODELAPI_EXPORT bool +findVariable(const std::shared_ptr &theDocument, + std::shared_ptr theSearcher, + const std::wstring &theName, double &outValue, + std::shared_ptr &theParam); /*! - * Searches for variable with name \param theName in the active document (Part), when - * in the root document (PartSet). If found, set it value in the \param outValue - * and returns true. If \param theDocument is empty active document is used. - * theSearcher must be located later in the history than the found variable. + * Searches for variable with name \param theName in the active document (Part), + * when in the root document (PartSet). If found, set it value in the \param + * outValue and returns true. If \param theDocument is empty active document is + * used. theSearcher must be located later in the history than the found + * variable. */ -MODELAPI_EXPORT bool findVariable(std::shared_ptr theSearcher, - const std::wstring& theName, - double& outValue, std::shared_ptr& theParam, - const std::shared_ptr& theDocument = std::shared_ptr()); +MODELAPI_EXPORT bool +findVariable(std::shared_ptr theSearcher, + const std::wstring &theName, double &outValue, + std::shared_ptr &theParam, + const std::shared_ptr &theDocument = + std::shared_ptr()); /*! * Searches for Part result that contains the reference to the given document. * The result must be presented in the tree. * \param theMain document that contains the searched feature - * \param theSub document that is searched, the resulting feature references to it - * \returns null if not found + * \param theSub document that is searched, the resulting feature references to + * it \returns null if not found */ -MODELAPI_EXPORT std::shared_ptr findPartResult( - const std::shared_ptr& theMain, - const std::shared_ptr& theSub); +MODELAPI_EXPORT std::shared_ptr +findPartResult(const std::shared_ptr &theMain, + const std::shared_ptr &theSub); /*! - * Searches for Part the feature that contains in result the reference to the given document. - * The result may be disabled. - * \param theMain document that contains the searched feature - * \param theSub document that is searched, the resulting feature references to it - * \returns null if not found + * Searches for Part the feature that contains in result the reference to the + * given document. The result may be disabled. \param theMain document that + * contains the searched feature \param theSub document that is searched, the + * resulting feature references to it \returns null if not found */ -MODELAPI_EXPORT std::shared_ptr findPartFeature( - const std::shared_ptr& theMain, - const std::shared_ptr& theSub); +MODELAPI_EXPORT std::shared_ptr +findPartFeature(const std::shared_ptr &theMain, + const std::shared_ptr &theSub); /*! * Returns the composite feature - parent of this feature. * \param theFeature the sub-element of composite * \returns null if it is not sub-element of composite */ -MODELAPI_EXPORT std::shared_ptr compositeOwner( - const std::shared_ptr& theFeature); +MODELAPI_EXPORT std::shared_ptr +compositeOwner(const std::shared_ptr &theFeature); /*! * Returns the result - parent of this result. @@ -138,250 +146,270 @@ MODELAPI_EXPORT std::shared_ptr compositeOwner( * \returns null if it is not sub-element of composite */ MODELAPI_EXPORT std::shared_ptr - bodyOwner(const std::shared_ptr& theSub, const bool theRoot = false); +bodyOwner(const std::shared_ptr &theSub, + const bool theRoot = false); /*! - * Returns index of this result in parent (if parent exists, returned by bodyOwner) - * \returns zero-base index, or -1 if not found + * Returns index of this result in parent (if parent exists, returned by + * bodyOwner) \returns zero-base index, or -1 if not found */ -MODELAPI_EXPORT int bodyIndex(const std::shared_ptr& theSub); +MODELAPI_EXPORT int bodyIndex(const std::shared_ptr &theSub); /*! -* Returns true if the result contains a not empty list of sub results. -* It processes result compsolid. -* \param theResult a result object -* \returns boolean value -*/ -MODELAPI_EXPORT bool hasSubResults(const std::shared_ptr& theResult); + * Returns true if the result contains a not empty list of sub results. + * It processes result compsolid. + * \param theResult a result object + * \returns boolean value + */ +MODELAPI_EXPORT bool +hasSubResults(const std::shared_ptr &theResult); /*! -* collects recursively all subs of the given result -*/ -MODELAPI_EXPORT void allSubs(const std::shared_ptr& theResult, - std::list >& theResults, - const bool theLowerOnly = false); + * collects recursively all subs of the given result + */ +MODELAPI_EXPORT void +allSubs(const std::shared_ptr &theResult, + std::list> &theResults, + const bool theLowerOnly = false); /*! -* Adds the results of the given feature to theResults list: including disabled and sub-results -*/ -MODELAPI_EXPORT void allResults(const std::shared_ptr& theFeature, - std::list >& theResults); + * Adds the results of the given feature to theResults list: including disabled + * and sub-results + */ +MODELAPI_EXPORT void +allResults(const std::shared_ptr &theFeature, + std::list> &theResults); /*! Returns true if there are no parts in the document, which are not activated \param theNotActivatedNames out string which contains not activated names \return a boolean value */ -MODELAPI_EXPORT bool allDocumentsActivated(std::wstring& theNotActivatedNames); +MODELAPI_EXPORT bool allDocumentsActivated(std::wstring &theNotActivatedNames); /*! Removes features from the document -* \param theFeatures a list of features to be removed -* \param theFlushRedisplay a boolean value if the redisplay signal should be flushed -* \return true if at least one feature is removed -*/ + * \param theFeatures a list of features to be removed + * \param theFlushRedisplay a boolean value if the redisplay signal should be + * flushed \return true if at least one feature is removed + */ MODELAPI_EXPORT bool removeFeaturesAndReferences( - const std::set >& theFeatures, - const bool theFlushRedisplay = false, - const bool theUseComposite = false, - const bool theUseRecursion = true); + const std::set> &theFeatures, + const bool theFlushRedisplay = false, const bool theUseComposite = false, + const bool theUseRecursion = true); /*! Removes features from the document -* \param theFeatures a list of features to be removed -* \param theFlushRedisplay a boolean value if the redisplay signal should be flushed -* \return true if at least one feature is removed -*/ -MODELAPI_EXPORT bool removeFeatures( - const std::set >& theFeatures, - const bool theFlushRedisplay); + * \param theFeatures a list of features to be removed + * \param theFlushRedisplay a boolean value if the redisplay signal should be + * flushed \return true if at least one feature is removed + */ +MODELAPI_EXPORT bool +removeFeatures(const std::set> &theFeatures, + const bool theFlushRedisplay); /*! Build a map of references for the given set of features * \param theFeatures a list of features * \param theReferences a map of all references to the features -* \param theUseComposite state if the composite features of the reference should be in the map -* \param theUseRecursion state if references for features out of the sources feature - list are put into the result container. E.g. if theFeatures contains "Sketch_2", map will - contain references to this feature also. +* \param theUseComposite state if the composite features of the reference should +be in the map +* \param theUseRecursion state if references for features out of the sources +feature list are put into the result container. E.g. if theFeatures contains +"Sketch_2", map will contain references to this feature also. */ MODELAPI_EXPORT void findAllReferences( - const std::set >& theFeatures, - std::map, - std::set > >& theReferences, - const bool theUseComposite = true, - const bool theUseRecursion = true); + const std::set> &theFeatures, + std::map, + std::set>> &theReferences, + const bool theUseComposite = true, const bool theUseRecursion = true); /*! In the map of references find all features referenced to the source feature -* \param theFeatures a list of features to find references -* \param theReferences a map of all references to the features -* \param theFeaturesRefsTo an out list of referenced features -*/ + * \param theFeatures a list of features to find references + * \param theReferences a map of all references to the features + * \param theFeaturesRefsTo an out list of referenced features + */ MODELAPI_EXPORT void findRefsToFeatures( - const std::set >& aFeatures, - const std::map, - std::set > >& aReferences, - std::set >& aFeaturesRefsTo); + const std::set> &aFeatures, + const std::map, + std::set>> &aReferences, + std::set> &aFeaturesRefsTo); /*! Finds referenced of the feature to objects and collects concealed results. -* \param theFeatures a model feature -* \param theResults container for concealed results. It has no duplications -*/ -MODELAPI_EXPORT void getConcealedResults(const std::shared_ptr& theFeature, - std::list >& theResults); - -/*! Return the default name of the result according the features it depends or name of the feature. - * Return also whether the name is get from the concealing result of parent object - * (means that concealing result has user-defined name). - * \param[in] theRecursive recursively check the concealed results if they have user-defined names + * \param theFeatures a model feature + * \param theResults container for concealed results. It has no duplications */ -MODELAPI_EXPORT std::pair getDefaultName( - const std::shared_ptr& theResult, - const bool theInherited = true, - const bool theRecursive = false); +MODELAPI_EXPORT void +getConcealedResults(const std::shared_ptr &theFeature, + std::list> &theResults); + +/*! Return the default name of the result according the features it depends or + * name of the feature. Return also whether the name is get from the concealing + * result of parent object (means that concealing result has user-defined name). + * \param[in] theRecursive recursively check the concealed results if they have + * user-defined names + */ +MODELAPI_EXPORT std::pair +getDefaultName(const std::shared_ptr &theResult, + const bool theInherited = true, const bool theRecursive = false); /*! Collect all parents for the given feature, including the Part */ -MODELAPI_EXPORT std::set > - getParents(const std::shared_ptr& theFeature); +MODELAPI_EXPORT std::set> +getParents(const std::shared_ptr &theFeature); /*! Store shape and its parent shape to the hierarchy data structure * \param[in] theShape the shape to store * \param[in] theContext the result (parent shape) for the given shape * \param[out] theHierarchy container for shape hierarchy */ -MODELAPI_EXPORT void fillShapeHierarchy( - const std::shared_ptr& theShape, - const std::shared_ptr& theContext, - GeomAPI_ShapeHierarchy& theHierarchy); +MODELAPI_EXPORT void +fillShapeHierarchy(const std::shared_ptr &theShape, + const std::shared_ptr &theContext, + GeomAPI_ShapeHierarchy &theHierarchy); /*! Creates a remove result features with the given results -*/ -MODELAPI_EXPORT void removeResults(const std::list >& theResults); + */ +MODELAPI_EXPORT void +removeResults(const std::list> &theResults); /*! Returns current deflection in the given result -* \param theResult a result object -* \return a deflection value or -1 if it was not defined -*/ -MODELAPI_EXPORT double getDeflection(const std::shared_ptr& theResult); + * \param theResult a result object + * \return a deflection value or -1 if it was not defined + */ +MODELAPI_EXPORT double +getDeflection(const std::shared_ptr &theResult); /*! Sets the deflection value -* \param theResult a result object -* \param a deflection value -*/ + * \param theResult a result object + * \param a deflection value + */ MODELAPI_EXPORT void setDeflection(std::shared_ptr theResult, - const double theDeflection); + const double theDeflection); /*! Returns current color of the current result -* \param[in] theResult a result object -* \param[out] theColor a color values if it is defined -*/ -MODELAPI_EXPORT void getColor(const std::shared_ptr& theResult, - std::vector& theColor); + * \param[in] theResult a result object + * \param[out] theColor a color values if it is defined + */ +MODELAPI_EXPORT void getColor(const std::shared_ptr &theResult, + std::vector &theColor); /*! Set color of the result -* \param[in] theResult a result object -* \param[in] theColor a color values -*/ + * \param[in] theResult a result object + * \param[in] theColor a color values + */ MODELAPI_EXPORT void setColor(std::shared_ptr theResult, - const std::vector& theColor); + const std::vector &theColor); /*! Returns number of iso-lines of the current result -* \param[in] theResult a result object -* \param[out] theNbLines values of iso-lines -*/ -MODELAPI_EXPORT void getIsoLines(const std::shared_ptr& theResult, - bool& isVisible, std::vector& theNbLines); + * \param[in] theResult a result object + * \param[out] theNbLines values of iso-lines + */ +MODELAPI_EXPORT void +getIsoLines(const std::shared_ptr &theResult, bool &isVisible, + std::vector &theNbLines); /*! Set number of iso-lines of the result -* \param[in] theResult a result object -* \param[in] theIso nb iso-lines -*/ + * \param[in] theResult a result object + * \param[in] theIso nb iso-lines + */ MODELAPI_EXPORT void setIsoLines(std::shared_ptr theResult, - const std::vector& theIso); + const std::vector &theIso); /*! Set visibility of Iso lines -* \param[in] theResult a result object -* \param[in] theShow is a visibility flag -*/ -MODELAPI_EXPORT void showIsoLines(std::shared_ptr theResult, bool theShow); + * \param[in] theResult a result object + * \param[in] theShow is a visibility flag + */ +MODELAPI_EXPORT void showIsoLines(std::shared_ptr theResult, + bool theShow); -MODELAPI_EXPORT bool isShownIsoLines(std::shared_ptr theResult); +MODELAPI_EXPORT bool +isShownIsoLines(std::shared_ptr theResult); /*! Set visibility of edges direction -* \param[in] theResult a result object -* \param[in] theShow is a visibility flag -*/ -MODELAPI_EXPORT void showEdgesDirection(std::shared_ptr theResult, bool theShow); + * \param[in] theResult a result object + * \param[in] theShow is a visibility flag + */ +MODELAPI_EXPORT void +showEdgesDirection(std::shared_ptr theResult, bool theShow); -MODELAPI_EXPORT bool isShowEdgesDirection(std::shared_ptr theResult); +MODELAPI_EXPORT bool +isShowEdgesDirection(std::shared_ptr theResult); /*! Set flag to bring result in front of other results -* \param[in] theResult a result object -* \param[in] theFlag is a flag -*/ -MODELAPI_EXPORT void bringToFront(std::shared_ptr theResult, bool theFlag); + * \param[in] theResult a result object + * \param[in] theFlag is a flag + */ +MODELAPI_EXPORT void bringToFront(std::shared_ptr theResult, + bool theFlag); MODELAPI_EXPORT bool isBringToFront(std::shared_ptr theResult); /*! Returns current transparency in the given result -* \param theResult a result object -* \return a transparency value or -1 if it was not defined -*/ -MODELAPI_EXPORT double getTransparency(const std::shared_ptr& theResult); + * \param theResult a result object + * \return a transparency value or -1 if it was not defined + */ +MODELAPI_EXPORT double +getTransparency(const std::shared_ptr &theResult); /*! Set transparency for the given result -* \param theResult a result object -* \param a transparency value -*/ + * \param theResult a result object + * \param a transparency value + */ MODELAPI_EXPORT void setTransparency(std::shared_ptr theResult, - double theTransparency); - + double theTransparency); /*! Copies all visualization attributes from one result to another. -* \param theSource a result that contains the copied attributes -* \param theDest a destination result that takes the visualization attributes -*/ -MODELAPI_EXPORT void copyVisualizationAttrs(std::shared_ptr theSource, - std::shared_ptr theDest); + * \param theSource a result that contains the copied attributes + * \param theDest a destination result that takes the visualization attributes + */ +MODELAPI_EXPORT void +copyVisualizationAttrs(std::shared_ptr theSource, + std::shared_ptr theDest); /*! Copies image attribute from one result to another. -* \param theSource a result that contains the image data -* \param theDest a destination result that takes the image data -*/ -MODELAPI_EXPORT void copyImageAttribute(std::shared_ptr theSource, - std::shared_ptr theDest); - -/*! Produces list of features that reference to the given target (directly or through sub-results) -* \param theTarget the referenced result -* \param theFeatureKind the resulting features filter: the feature kind or all for the empty string -* \param theSortResults to sort the resulting list of features by the features creation order -*/ -MODELAPI_EXPORT std::list > referencedFeatures( - std::shared_ptr theTarget, const std::string& theFeatureKind, - const bool theSortResults); + * \param theSource a result that contains the image data + * \param theDest a destination result that takes the image data + */ +MODELAPI_EXPORT void +copyImageAttribute(std::shared_ptr theSource, + std::shared_ptr theDest); + +/*! Produces list of features that reference to the given target (directly or + * through sub-results) \param theTarget the referenced result \param + * theFeatureKind the resulting features filter: the feature kind or all for the + * empty string \param theSortResults to sort the resulting list of features by + * the features creation order + */ +MODELAPI_EXPORT std::list> +referencedFeatures(std::shared_ptr theTarget, + const std::string &theFeatureKind, + const bool theSortResults); /*! * Returns true if something in selection is presented in the results list */ MODELAPI_EXPORT bool isInResults(AttributeSelectionListPtr theSelection, - const std::list& theResults, - std::set& theCashedResults); + const std::list &theResults, + std::set &theCashedResults); /*! Returns a container with the current color value. -* These are tree int values for RGB definition. -* It returns the next random color. -* \param theValues vector of values -* \param theReset flag to call when disabling Auto-color -*/ -MODELAPI_EXPORT void findRandomColor(std::vector& theValues, bool theReset = false); + * These are tree int values for RGB definition. + * It returns the next random color. + * \param theValues vector of values + * \param theReset flag to call when disabling Auto-color + */ +MODELAPI_EXPORT void findRandomColor(std::vector &theValues, + bool theReset = false); /*! -* Checks the movement of features possibility. The feature cannot appear before the feature -* depended on it. Used in drag and drop part features. -* \param theAfter feature after which the moved features are placed, or null for the first place -* \param theMoved ordered list of the moved features -* \returns string with error text, dependencies that do not allow make movement or empty string -*/ -MODELAPI_EXPORT std::wstring validateMovement( - const FeaturePtr& theAfter, const std::list theMoved); + * Checks the movement of features possibility. The feature cannot appear before + * the feature depended on it. Used in drag and drop part features. \param + * theAfter feature after which the moved features are placed, or null for the + * first place \param theMoved ordered list of the moved features \returns + * string with error text, dependencies that do not allow make movement or empty + * string + */ +MODELAPI_EXPORT std::wstring +validateMovement(const FeaturePtr &theAfter, + const std::list theMoved); -} +} // namespace ModelAPI_Tools #endif diff --git a/src/ModelAPI/ModelAPI_Validator.h b/src/ModelAPI/ModelAPI_Validator.h index 89a7331d6..d9596e6aa 100644 --- a/src/ModelAPI/ModelAPI_Validator.h +++ b/src/ModelAPI/ModelAPI_Validator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelAPI_Validator_H_ @@ -22,15 +23,16 @@ #include #include -#include #include +#include class ModelAPI_Feature; class Events_InfoMessage; /**\class ModelAPI_Validator * \ingroup DataModel - * \brief Allows to validate the attribute value of a feature or the whole feature. + * \brief Allows to validate the attribute value of a feature or the whole + * feature. * * This object is assigned by the name * in the XML file to the specific attribute or to the whole feature. @@ -39,13 +41,10 @@ class Events_InfoMessage; * Validators must be registered in the validators factory to be * correctly identified by the XML string-ID. */ -class MODELAPI_EXPORT ModelAPI_Validator -{ - public: +class MODELAPI_EXPORT ModelAPI_Validator { +public: // Make virtual destructor in order to make the class polymorphic - virtual ~ModelAPI_Validator() - { - } + virtual ~ModelAPI_Validator() {} }; typedef std::shared_ptr ValidatorPtr; @@ -54,7 +53,7 @@ typedef std::shared_ptr ValidatorPtr; * \ingroup DataModel * \brief Manages the registered validators * - * Allows to get a validator by the feature identifier and + * Allows to get a validator by the feature identifier and * the attribute identifier (if attribute is validated). * All accessible validators mustbe registered by the ID string first. * The instance of this factory can be get in the Session. @@ -62,84 +61,100 @@ typedef std::shared_ptr ValidatorPtr; * All the needed information is provided to the validator as an argument, * this allows to work with them independently from the feature specific object. */ -class MODELAPI_EXPORT ModelAPI_ValidatorsFactory -{ - public: - virtual ~ModelAPI_ValidatorsFactory() {} +class MODELAPI_EXPORT ModelAPI_ValidatorsFactory { +public: + virtual ~ModelAPI_ValidatorsFactory() {} /// Registers the instance of the validator by the ID - virtual void registerValidator(const std::string& theID, ModelAPI_Validator* theValidator) = 0; + virtual void registerValidator(const std::string &theID, + ModelAPI_Validator *theValidator) = 0; /// Assigns validator to the feature - virtual void assignValidator(const std::string& theID, const std::string& theFeatureID) = 0; + virtual void assignValidator(const std::string &theID, + const std::string &theFeatureID) = 0; /// Assigns validator to the feature with arguments of the validator - virtual void assignValidator(const std::string& theID, - const std::string& theFeatureID, - const std::list& theArguments) = 0; + virtual void assignValidator(const std::string &theID, + const std::string &theFeatureID, + const std::list &theArguments) = 0; /// Assigns validator to the attribute of the feature - virtual void assignValidator(const std::string& theID, const std::string& theFeatureID, - const std::string& theAttrID, - const std::list& theArguments) = 0; + virtual void assignValidator(const std::string &theID, + const std::string &theFeatureID, + const std::string &theAttrID, + const std::list &theArguments) = 0; /// Validators is a list of pairs - typedef std::list > > Validators; + typedef std::list>> Validators; /// Provides a validator for the feature, returns NULL if no validator - virtual void validators(const std::string& theFeatureID, - Validators& theResult) const = 0; + virtual void validators(const std::string &theFeatureID, + Validators &theResult) const = 0; /// Provides a validator for the attribute, returns NULL if no validator - virtual void validators(const std::string& theFeatureID, const std::string& theAttrID, - Validators& theResult) const = 0; + virtual void validators(const std::string &theFeatureID, + const std::string &theAttrID, + Validators &theResult) const = 0; /// Returns registered validator by its Id - virtual const ModelAPI_Validator* validator(const std::string& theID) const = 0; + virtual const ModelAPI_Validator * + validator(const std::string &theID) const = 0; /// Returns true if feature and all its attributes are valid. - virtual bool validate(const std::shared_ptr& theFeature) const = 0; + virtual bool + validate(const std::shared_ptr &theFeature) const = 0; /// Returns true if the attribute is valid. - virtual bool validate(const std::shared_ptr& theAttribute, - std::string& theValidator, Events_InfoMessage& theError) const = 0; + virtual bool validate(const std::shared_ptr &theAttribute, + std::string &theValidator, + Events_InfoMessage &theError) const = 0; - /// register that this attribute in feature is not obligatory for the feature execution - /// so, it is not needed for the standard validation mechanism - virtual void registerNotObligatory(std::string theFeature, std::string theAttribute) = 0; + /// register that this attribute in feature is not obligatory for the feature + /// execution so, it is not needed for the standard validation mechanism + virtual void registerNotObligatory(std::string theFeature, + std::string theAttribute) = 0; - /// Returns true if the attribute in feature is not obligatory for the feature execution - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute) = 0; + /// Returns true if the attribute in feature is not obligatory for the feature + /// execution + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute) = 0; /// register that this attribute conceals in the object browser /// all referenced features after execution - virtual void registerConcealment(std::string theFeature, std::string theAttribute) = 0; + virtual void registerConcealment(std::string theFeature, + std::string theAttribute) = 0; - /// Returns true that it was registered that attribute conceals the referenced result - virtual bool isConcealed(std::string theFeature, std::string theAttribute) = 0; + /// Returns true that it was registered that attribute conceals the referenced + /// result + virtual bool isConcealed(std::string theFeature, + std::string theAttribute) = 0; /// Register the attribute as a main argument of the feature - virtual void registerMainArgument(std::string theFeature, std::string theAttribute) = 0; + virtual void registerMainArgument(std::string theFeature, + std::string theAttribute) = 0; /// Returns true is the attribute is a main argument of the feature - virtual bool isMainArgument(std::string theFeature, std::string theAttribute) = 0; + virtual bool isMainArgument(std::string theFeature, + std::string theAttribute) = 0; - /// Register the case-attribute: this attribute is checked only if its case is selected - virtual void registerCase(std::string theFeature, std::string theAttribute, - const std::list >& theCases) = 0; + /// Register the case-attribute: this attribute is checked only if its case is + /// selected + virtual void registerCase( + std::string theFeature, std::string theAttribute, + const std::list> &theCases) = 0; - /// Returns true if the attribute must be checked (the case is selected) + /// Returns true if the attribute must be checked (the case is selected) virtual bool isCase(FeaturePtr theFeature, std::string theAttribute) = 0; /// Register the selection attribute as geometrical selection - virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute) = 0; + virtual void registerGeometricalSelection(std::string theFeature, + std::string theAttribute) = 0; /// Returns true if the attribute is a geometrical selection - virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute) = 0; + virtual bool isGeometricalSelection(std::string theFeature, + std::string theAttribute) = 0; - protected: +protected: /// Get instance from Session - ModelAPI_ValidatorsFactory() - { - } + ModelAPI_ValidatorsFactory() {} }; #endif diff --git a/src/ModelAPI/ModelAPI_swig.h b/src/ModelAPI/ModelAPI_swig.h index 72430a786..bd25a766c 100644 --- a/src/ModelAPI/ModelAPI_swig.h +++ b/src/ModelAPI/ModelAPI_swig.h @@ -14,58 +14,59 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELAPI_MODELAPI_SWIG_H_ #define SRC_MODELAPI_MODELAPI_SWIG_H_ - #include +#include - #include "ModelAPI.h" - #include "ModelAPI_Entity.h" - #include "ModelAPI_Events.h" - #include "ModelAPI_Document.h" - #include "ModelAPI_Session.h" - #include "ModelAPI_Object.h" - #include "ModelAPI_Feature.h" - #include "ModelAPI_Plugin.h" - #include "ModelAPI_CompositeFeature.h" - #include "ModelAPI_Data.h" - #include "ModelAPI_Attribute.h" - #include "ModelAPI_AttributeDocRef.h" - #include "ModelAPI_AttributeDouble.h" - #include "ModelAPI_AttributeDoubleArray.h" - #include "ModelAPI_AttributeInteger.h" - #include "ModelAPI_AttributeIntArray.h" - #include "ModelAPI_AttributeString.h" - #include "ModelAPI_AttributeStringArray.h" - #include "ModelAPI_AttributeReference.h" - #include "ModelAPI_AttributeRefAttr.h" - #include "ModelAPI_AttributeSelection.h" - #include "ModelAPI_AttributeSelectionList.h" - #include "ModelAPI_AttributeTables.h" - #include "ModelAPI_AttributeValidator.h" - #include "ModelAPI_Validator.h" - #include "ModelAPI_FeatureValidator.h" - #include "ModelAPI_AttributeRefList.h" - #include "ModelAPI_AttributeRefAttrList.h" - #include "ModelAPI_AttributeBoolean.h" - #include "ModelAPI_Result.h" - #include "ModelAPI_ResultConstruction.h" - #include "ModelAPI_ResultBody.h" - #include "ModelAPI_ResultPart.h" - #include "ModelAPI_ResultParameter.h" - #include "ModelAPI_ResultGroup.h" - #include "ModelAPI_ResultField.h" - #include "ModelAPI_Tools.h" - #include "ModelAPI_Folder.h" - #include "ModelAPI_Filter.h" - #include "ModelAPI_FiltersArgs.h" - #include "ModelAPI_FiltersFactory.h" - #include "ModelAPI_FiltersFeature.h" +#include "ModelAPI.h" +#include "ModelAPI_Attribute.h" +#include "ModelAPI_AttributeBoolean.h" +#include "ModelAPI_AttributeDocRef.h" +#include "ModelAPI_AttributeDouble.h" +#include "ModelAPI_AttributeDoubleArray.h" +#include "ModelAPI_AttributeIntArray.h" +#include "ModelAPI_AttributeInteger.h" +#include "ModelAPI_AttributeRefAttr.h" +#include "ModelAPI_AttributeRefAttrList.h" +#include "ModelAPI_AttributeRefList.h" +#include "ModelAPI_AttributeReference.h" +#include "ModelAPI_AttributeSelection.h" +#include "ModelAPI_AttributeSelectionList.h" +#include "ModelAPI_AttributeString.h" +#include "ModelAPI_AttributeStringArray.h" +#include "ModelAPI_AttributeTables.h" +#include "ModelAPI_AttributeValidator.h" +#include "ModelAPI_CompositeFeature.h" +#include "ModelAPI_Data.h" +#include "ModelAPI_Document.h" +#include "ModelAPI_Entity.h" +#include "ModelAPI_Events.h" +#include "ModelAPI_Feature.h" +#include "ModelAPI_FeatureValidator.h" +#include "ModelAPI_Filter.h" +#include "ModelAPI_FiltersArgs.h" +#include "ModelAPI_FiltersFactory.h" +#include "ModelAPI_FiltersFeature.h" +#include "ModelAPI_Folder.h" +#include "ModelAPI_Object.h" +#include "ModelAPI_Plugin.h" +#include "ModelAPI_Result.h" +#include "ModelAPI_ResultBody.h" +#include "ModelAPI_ResultConstruction.h" +#include "ModelAPI_ResultField.h" +#include "ModelAPI_ResultGroup.h" +#include "ModelAPI_ResultParameter.h" +#include "ModelAPI_ResultPart.h" +#include "ModelAPI_Session.h" +#include "ModelAPI_Tools.h" +#include "ModelAPI_Validator.h" - #include - #include +#include +#include #endif /* SRC_MODELAPI_MODELAPI_SWIG_H_ */ diff --git a/src/ModelGeomAlgo/CMakeLists.txt b/src/ModelGeomAlgo/CMakeLists.txt index 43f2c38aa..0ba92ab32 100644 --- a/src/ModelGeomAlgo/CMakeLists.txt +++ b/src/ModelGeomAlgo/CMakeLists.txt @@ -95,16 +95,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ModelGeomAlgo") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ModelGeomAlgo/ModelGeomAlgo.h b/src/ModelGeomAlgo/ModelGeomAlgo.h index ef6aeb152..8ddaf3ab5 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo.h +++ b/src/ModelGeomAlgo/ModelGeomAlgo.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELGEOMALGO_H @@ -22,13 +23,13 @@ #if defined MODELGEOMALGO_EXPORTS #if defined WIN32 -#define MODELGEOMALGO_EXPORT __declspec( dllexport ) +#define MODELGEOMALGO_EXPORT __declspec(dllexport) #else #define MODELGEOMALGO_EXPORT #endif #else #if defined WIN32 -#define MODELGEOMALGO_EXPORT __declspec( dllimport ) +#define MODELGEOMALGO_EXPORT __declspec(dllimport) #else #define MODELGEOMALGO_EXPORT #endif diff --git a/src/ModelGeomAlgo/ModelGeomAlgo.i b/src/ModelGeomAlgo/ModelGeomAlgo.i index f7ce63868..0f7332286 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo.i +++ b/src/ModelGeomAlgo/ModelGeomAlgo.i @@ -53,4 +53,3 @@ // all supported interfaces %include "ModelGeomAlgo_Point2D.h" - diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp index b95062144..068ee0c7e 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelGeomAlgo_Point2D.h" -#include -#include #include #include +#include +#include #include #include @@ -32,14 +33,14 @@ #include #include -#include -#include -#include +#include #include #include #include -#include +#include +#include #include +#include //#define DEBUG_POINT_INSIDE_SHAPE #ifdef DEBUG_POINT_INSIDE_SHAPE @@ -51,65 +52,70 @@ #endif std::shared_ptr ModelGeomAlgo_Point2D::getPointOfRefAttr( - ModelAPI_Feature* theFeature, - const std::string& theAttribute, - const std::string& theObjectFeatureKind, - const std::string& theObjectFeatureAttribute) -{ + ModelAPI_Feature *theFeature, const std::string &theAttribute, + const std::string &theObjectFeatureKind, + const std::string &theObjectFeatureAttribute) { std::shared_ptr aPointAttr; /// essential check as it is called in openGl thread - if (!theFeature || !theFeature->data().get() || !theFeature->data()->isValid()) + if (!theFeature || !theFeature->data().get() || + !theFeature->data()->isValid()) return std::shared_ptr(); FeaturePtr aFeature; - std::shared_ptr anAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(theFeature->data()->attribute(theAttribute)); - if(anAttr.get() && anAttr->isInitialized()) { + std::shared_ptr anAttr = + std::dynamic_pointer_cast( + theFeature->data()->attribute(theAttribute)); + if (anAttr.get() && anAttr->isInitialized()) { aFeature = ModelAPI_Feature::feature(anAttr->object()); if (aFeature.get()) { bool aFeatureOfObjectKind = !theObjectFeatureKind.empty() && !theObjectFeatureAttribute.empty() && aFeature->getKind() == theObjectFeatureKind; - if(aFeatureOfObjectKind) - aPointAttr = std::dynamic_pointer_cast( - aFeature->data()->attribute(theObjectFeatureAttribute)); + if (aFeatureOfObjectKind) + aPointAttr = std::dynamic_pointer_cast( + aFeature->data()->attribute(theObjectFeatureAttribute)); else if (anAttr->attr()) - aPointAttr = std::dynamic_pointer_cast(anAttr->attr()); + aPointAttr = + std::dynamic_pointer_cast(anAttr->attr()); } } return aPointAttr; } void ModelGeomAlgo_Point2D::getPointsOfReference( - const std::shared_ptr& theObject, - const std::string& theReferenceFeatureKind, - std::set >& theAttributes, - const std::string& theObjectFeatureKind, - const std::string& theObjectFeatureAttribute, - const bool isSkipFeatureAttributes) -{ + const std::shared_ptr &theObject, + const std::string &theReferenceFeatureKind, + std::set> &theAttributes, + const std::string &theObjectFeatureKind, + const std::string &theObjectFeatureAttribute, + const bool isSkipFeatureAttributes) { // find by feature FeaturePtr aSourceFeature = ModelAPI_Feature::feature(theObject); - const std::set& aRefsList = theObject->data()->refsToMe(); + const std::set &aRefsList = theObject->data()->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aRefFeature = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aRefFeature = + std::dynamic_pointer_cast(aAttr->owner()); if (aRefFeature->getKind() == theReferenceFeatureKind) { std::list anAttributes = - aRefFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); - std::list::iterator anIter = anAttributes.begin(), aLast = anAttributes.end(); + aRefFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); + std::list::iterator anIter = anAttributes.begin(), + aLast = anAttributes.end(); bool isSkippedAttribute = false; if (isSkipFeatureAttributes) { - for(anIter = anAttributes.begin(); anIter != aLast && !isSkippedAttribute; anIter++) { + for (anIter = anAttributes.begin(); + anIter != aLast && !isSkippedAttribute; anIter++) { AttributeRefAttrPtr aRefAttribute = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (aRefAttribute.get() && !aRefAttribute->isObject()) { std::shared_ptr aPointAttr = - std::dynamic_pointer_cast(aRefAttribute->attr()); - FeaturePtr anAttributeFeature = ModelAPI_Feature::feature(aPointAttr->owner()); + std::dynamic_pointer_cast( + aRefAttribute->attr()); + FeaturePtr anAttributeFeature = + ModelAPI_Feature::feature(aPointAttr->owner()); isSkippedAttribute = aSourceFeature == anAttributeFeature; } } @@ -119,12 +125,14 @@ void ModelGeomAlgo_Point2D::getPointsOfReference( // it searches the first point of AttributeRefAtt std::shared_ptr aPointAttr; - for(anIter = anAttributes.begin(); anIter != aLast && !aPointAttr.get(); anIter++) { + for (anIter = anAttributes.begin(); anIter != aLast && !aPointAttr.get(); + anIter++) { AttributeRefAttrPtr aRefAttribute = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (aRefAttribute.get()) { aPointAttr = getPointOfRefAttr(aRefFeature.get(), aRefAttribute->id(), - theObjectFeatureKind, theObjectFeatureAttribute); + theObjectFeatureKind, + theObjectFeatureAttribute); } } if (aPointAttr.get()) { @@ -135,112 +143,121 @@ void ModelGeomAlgo_Point2D::getPointsOfReference( // find by results FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); if (aFeature.get()) { - const std::list > aResults = aFeature->results(); - std::list >::const_iterator aRIter = aResults.begin(); + const std::list> aResults = + aFeature->results(); + std::list>::const_iterator aRIter = + aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aResult = *aRIter; - getPointsOfReference(aResult, theReferenceFeatureKind, theAttributes, theObjectFeatureKind, - theObjectFeatureAttribute); + getPointsOfReference(aResult, theReferenceFeatureKind, theAttributes, + theObjectFeatureKind, theObjectFeatureAttribute); } } } -void appendPoint(const std::shared_ptr& thePoint, - const std::shared_ptr& theResult, - ModelGeomAlgo_Point2D::PointToRefsMap& thePointToAttributeOrObject) -{ +void appendPoint( + const std::shared_ptr &thePoint, + const std::shared_ptr &theResult, + ModelGeomAlgo_Point2D::PointToRefsMap &thePointToAttributeOrObject) { bool aPointFound = false; FeaturePtr aPointFeature = ModelAPI_Feature::feature(theResult); // check if the given point is already in the container in attribute list - for (ModelGeomAlgo_Point2D::PointToRefsMap::const_iterator - anIt = thePointToAttributeOrObject.begin(); - anIt != thePointToAttributeOrObject.end() && !aPointFound; anIt++) { + for (ModelGeomAlgo_Point2D::PointToRefsMap::const_iterator anIt = + thePointToAttributeOrObject.begin(); + anIt != thePointToAttributeOrObject.end() && !aPointFound; anIt++) { std::shared_ptr aPoint = anIt->first; if (aPoint->isEqual(thePoint)) { - std::list > anAttributes = anIt->second.first; - for (std::list::const_iterator anAttrIt = anAttributes.begin(); - anAttrIt != anAttributes.end() && !aPointFound; anAttrIt++) { + std::list> anAttributes = + anIt->second.first; + for (std::list::const_iterator anAttrIt = + anAttributes.begin(); + anAttrIt != anAttributes.end() && !aPointFound; anAttrIt++) { AttributePtr anAttribute = *anAttrIt; - aPointFound = ModelAPI_Feature::feature(anAttribute->owner()) == aPointFeature; + aPointFound = + ModelAPI_Feature::feature(anAttribute->owner()) == aPointFeature; } } } if (!aPointFound) { - if (thePointToAttributeOrObject.find(thePoint) != thePointToAttributeOrObject.end()) + if (thePointToAttributeOrObject.find(thePoint) != + thePointToAttributeOrObject.end()) thePointToAttributeOrObject.at(thePoint).second.push_back(theResult); else { - std::list > anAttributes; - std::list > anObjects; + std::list> anAttributes; + std::list> anObjects; anObjects.push_back(theResult); - thePointToAttributeOrObject[thePoint] = std::make_pair(anAttributes, anObjects); + thePointToAttributeOrObject[thePoint] = + std::make_pair(anAttributes, anObjects); } #ifdef DEBUG_POINT_INSIDE_SHAPE - std::cout << "["<< thePoint->x() << ", " << thePoint->y() << "," << thePoint->z() << "]"; + std::cout << "[" << thePoint->x() << ", " << thePoint->y() << "," + << thePoint->z() << "]"; #endif } } -void appendShapePoints(const GeomShapePtr& theShape, - const std::shared_ptr& theResult, - ModelGeomAlgo_Point2D::PointToRefsMap& thePointToAttributeOrObject) -{ +void appendShapePoints( + const GeomShapePtr &theShape, + const std::shared_ptr &theResult, + ModelGeomAlgo_Point2D::PointToRefsMap &thePointToAttributeOrObject) { if (!theShape.get()) return; switch (theShape->shapeType()) { - case GeomAPI_Shape::VERTEX: { - std::shared_ptr aVertex = + case GeomAPI_Shape::VERTEX: { + std::shared_ptr aVertex = std::shared_ptr(new GeomAPI_Vertex(theShape)); - std::shared_ptr aPnt = aVertex->point(); - appendPoint(aPnt, theResult, thePointToAttributeOrObject); - } - break; - case GeomAPI_Shape::EDGE: { - std::shared_ptr anEdge = + std::shared_ptr aPnt = aVertex->point(); + appendPoint(aPnt, theResult, thePointToAttributeOrObject); + } break; + case GeomAPI_Shape::EDGE: { + std::shared_ptr anEdge = std::shared_ptr(new GeomAPI_Edge(theShape)); - appendPoint(anEdge->firstPoint(), theResult, thePointToAttributeOrObject); - appendPoint(anEdge->lastPoint(), theResult, thePointToAttributeOrObject); - } - break; - case GeomAPI_Shape::COMPOUND: { - for(GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) { - appendShapePoints(anIt.current(), theResult, thePointToAttributeOrObject); - } + appendPoint(anEdge->firstPoint(), theResult, thePointToAttributeOrObject); + appendPoint(anEdge->lastPoint(), theResult, thePointToAttributeOrObject); + } break; + case GeomAPI_Shape::COMPOUND: { + for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) { + appendShapePoints(anIt.current(), theResult, thePointToAttributeOrObject); } + } break; + default: break; - default: break; } } void ModelGeomAlgo_Point2D::getPointsIntersectedShape( - const std::shared_ptr& theBaseFeature, - const std::list >& theFeatures, - PointToRefsMap& thePointToAttributeOrObject) -{ + const std::shared_ptr &theBaseFeature, + const std::list> &theFeatures, + PointToRefsMap &thePointToAttributeOrObject) { #ifdef DEBUG_POINT_INSIDE_SHAPE std::cout << "ModelGeomAlgo_Point2D::getPointsIntersectedShape" << std::endl; #endif GeomShapePtr aFeatureShape; { std::set anEdgeShapes; - ModelGeomAlgo_Shape::shapesOfType(theBaseFeature, GeomAPI_Shape::EDGE, anEdgeShapes); + ModelGeomAlgo_Shape::shapesOfType(theBaseFeature, GeomAPI_Shape::EDGE, + anEdgeShapes); if (anEdgeShapes.empty()) return; aFeatureShape = (*anEdgeShapes.begin())->shape(); } - std::list >::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + std::list>::const_iterator + anIt = theFeatures.begin(), + aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature.get() == theBaseFeature.get()) continue; if (aFeature.get()) { std::set anEdgeShapes; - ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeShapes); + ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::EDGE, + anEdgeShapes); if (anEdgeShapes.empty()) - ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::VERTEX, anEdgeShapes); + ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::VERTEX, + anEdgeShapes); if (anEdgeShapes.empty()) continue; @@ -251,21 +268,23 @@ void ModelGeomAlgo_Point2D::getPointsIntersectedShape( #ifdef DEBUG_POINT_INSIDE_SHAPE int aPrevSize = thePointToAttributeOrObject.size(); #endif - appendShapePoints(aShapeOfIntersection, aResult, thePointToAttributeOrObject); + appendShapePoints(aShapeOfIntersection, aResult, + thePointToAttributeOrObject); #ifdef DEBUG_POINT_INSIDE_SHAPE if (aPrevSize != thePointToAttributeOrObject.size()) std::cout << " <- appendShapePoints" - << thePointToAttributeOrObject.size() - aPrevSize << std::endl; + << thePointToAttributeOrObject.size() - aPrevSize + << std::endl; #endif } } } -std::list > ModelGeomAlgo_Point2D::getSetOfPntIntersectedShape( - const std::shared_ptr& theBaseFeature, - const std::list >& theFeatures) -{ - std::list > aPoints; +std::list> +ModelGeomAlgo_Point2D::getSetOfPntIntersectedShape( + const std::shared_ptr &theBaseFeature, + const std::list> &theFeatures) { + std::list> aPoints; PointToRefsMap aRefsMap; getPointsIntersectedShape(theBaseFeature, theFeatures, aRefsMap); @@ -278,63 +297,67 @@ std::list > ModelGeomAlgo_Point2D::getSetOfPntInter } void ModelGeomAlgo_Point2D::getPointsInsideShape( - const std::shared_ptr theBaseShape, - const std::set >& theAttributes, - const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY, - PointToRefsMap& thePointToAttributeOrObject) -{ + const std::shared_ptr theBaseShape, + const std::set> &theAttributes, + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY, + PointToRefsMap &thePointToAttributeOrObject) { #ifdef DEBUG_POINT_INSIDE_SHAPE std::cout << "ModelGeomAlgo_Point2D::getPointsInsideShape:" << std::endl; #endif - std::set >::const_iterator anIt = theAttributes.begin(), - aLast = theAttributes.end(); + std::set>::const_iterator + anIt = theAttributes.begin(), + aLast = theAttributes.end(); for (; anIt != aLast; anIt++) { std::shared_ptr anAttribute = *anIt; std::shared_ptr aPnt2d = anAttribute->pnt(); - std::shared_ptr aPoint = aPnt2d->to3D(theOrigin, theDirX, theDirY); + std::shared_ptr aPoint = + aPnt2d->to3D(theOrigin, theDirX, theDirY); std::shared_ptr aProjectedPoint; if (isInnerPointOnEdge(theBaseShape, aPoint, aProjectedPoint)) { - if (thePointToAttributeOrObject.find(aProjectedPoint) != thePointToAttributeOrObject.end()) - thePointToAttributeOrObject.at(aProjectedPoint).first.push_back(anAttribute); + if (thePointToAttributeOrObject.find(aProjectedPoint) != + thePointToAttributeOrObject.end()) + thePointToAttributeOrObject.at(aProjectedPoint) + .first.push_back(anAttribute); else { - std::list > anAttributes; - std::list > anObjects; + std::list> anAttributes; + std::list> anObjects; anAttributes.push_back(anAttribute); - thePointToAttributeOrObject[aProjectedPoint] = std::make_pair(anAttributes, anObjects); + thePointToAttributeOrObject[aProjectedPoint] = + std::make_pair(anAttributes, anObjects); } #ifdef DEBUG_POINT_INSIDE_SHAPE - std::cout << " " << anAttribute->owner()->data()->name() << ": " << anAttribute->id() - << "[" << aPoint->x() << ", " << aPoint->y() << ", " << aPoint->z() << "]" - << std::endl; + std::cout << " " << anAttribute->owner()->data()->name() << ": " + << anAttribute->id() << "[" << aPoint->x() << ", " + << aPoint->y() << ", " << aPoint->z() << "]" << std::endl; #endif - } - else { + } else { #ifdef DEBUG_POINT_INSIDE_SHAPE - std::cout << " " << anAttribute->owner()->data()->name() << ": " << anAttribute->id() - << "OUT of shape" << std::endl; + std::cout << " " << anAttribute->owner()->data()->name() << ": " + << anAttribute->id() << "OUT of shape" << std::endl; #endif } } } void ModelGeomAlgo_Point2D::getPointsInsideShape_p( - const std::shared_ptr theBaseShape, - const std::set >& theAttributes, - const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY, - std::list >& thePoints, - std::map, - std::shared_ptr >& theAttributeToPoint) -{ - std::set >::const_iterator anIt = theAttributes.begin(), - aLast = theAttributes.end(); + const std::shared_ptr theBaseShape, + const std::set> &theAttributes, + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY, + std::list> &thePoints, + std::map, std::shared_ptr> + &theAttributeToPoint) { + std::set>::const_iterator + anIt = theAttributes.begin(), + aLast = theAttributes.end(); for (; anIt != aLast; anIt++) { std::shared_ptr anAttribute = *anIt; std::shared_ptr aPnt2d = anAttribute->pnt(); - std::shared_ptr aPoint = aPnt2d->to3D(theOrigin, theDirX, theDirY); + std::shared_ptr aPoint = + aPnt2d->to3D(theOrigin, theDirX, theDirY); std::shared_ptr aProjectedPoint; if (isInnerPointOnEdge(theBaseShape, aPoint, aProjectedPoint)) { thePoints.push_back(aProjectedPoint); @@ -343,47 +366,49 @@ void ModelGeomAlgo_Point2D::getPointsInsideShape_p( } } -bool ModelGeomAlgo_Point2D::isPointOnEdge(const std::shared_ptr theBaseShape, - const std::shared_ptr& thePoint, - std::shared_ptr& theProjectedPoint) -{ +bool ModelGeomAlgo_Point2D::isPointOnEdge( + const std::shared_ptr theBaseShape, + const std::shared_ptr &thePoint, + std::shared_ptr &theProjectedPoint) { bool isInside = false; if (theBaseShape->shapeType() == GeomAPI_Shape::EDGE) { GeomCurvePtr aCurve(new GeomAPI_Curve(theBaseShape->edge())); theProjectedPoint = aCurve->project(thePoint); if (theProjectedPoint.get()) { - std::shared_ptr aVertexShape(new GeomAPI_Vertex(theProjectedPoint->x(), - theProjectedPoint->y(), theProjectedPoint->z())); - isInside = GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(aVertexShape, theBaseShape); + std::shared_ptr aVertexShape( + new GeomAPI_Vertex(theProjectedPoint->x(), theProjectedPoint->y(), + theProjectedPoint->z())); + isInside = GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(aVertexShape, + theBaseShape); } } return isInside; } - -bool ModelGeomAlgo_Point2D::isInnerPointOnEdge(const std::shared_ptr theBaseShape, - const std::shared_ptr& thePoint, - std::shared_ptr& theProjectedPoint) -{ +bool ModelGeomAlgo_Point2D::isInnerPointOnEdge( + const std::shared_ptr theBaseShape, + const std::shared_ptr &thePoint, + std::shared_ptr &theProjectedPoint) { bool isInside = isPointOnEdge(theBaseShape, thePoint, theProjectedPoint); if (isInside) { std::shared_ptr anEdge(new GeomAPI_Edge(theBaseShape)); if (!anEdge->isClosed()) { // check the point is not on the boundary GeomVertexPtr aVertex(new GeomAPI_Vertex(theProjectedPoint->x(), - theProjectedPoint->y(), theProjectedPoint->z())); + theProjectedPoint->y(), + theProjectedPoint->z())); GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); for (; anExp.more(); anExp.next()) { GeomVertexPtr aCurV = anExp.current()->vertex(); - isInside = !GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(aVertex, aCurV); + isInside = + !GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(aVertex, aCurV); } } } return isInside; } -std::string doubleToString(double theValue) -{ +std::string doubleToString(double theValue) { std::string aValueStr; char aBuf[50]; sprintf(aBuf, "%g", theValue); @@ -393,41 +418,41 @@ std::string doubleToString(double theValue) #ifdef _DEBUG std::string ModelGeomAlgo_Point2D::getPontAttributesInfo( - const std::shared_ptr& theFeature, - const std::set >& theAttributesOnly) -{ + const std::shared_ptr &theFeature, + const std::set> &theAttributesOnly) { std::string anInfo; - std::list anAttrs = theFeature->data()->attributes( - GeomDataAPI_Point2D::typeId()); - std::list::const_iterator anIt = anAttrs.begin(), aLast = anAttrs.end(); + std::list anAttrs = + theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + std::list::const_iterator anIt = anAttrs.begin(), + aLast = anAttrs.end(); - for(; anIt != aLast; anIt++) { + for (; anIt != aLast; anIt++) { AttributePtr anAttribute = *anIt; - if (anAttribute.get() && (theAttributesOnly.empty() || - theAttributesOnly.find(anAttribute) != theAttributesOnly.end())) { - if (!anInfo.empty()) { - anInfo.append(", "); - anInfo.append("\n"); - } - anInfo.append(" " + getPointAttributeInfo(anAttribute)); + if (anAttribute.get() && + (theAttributesOnly.empty() || + theAttributesOnly.find(anAttribute) != theAttributesOnly.end())) { + if (!anInfo.empty()) { + anInfo.append(", "); + anInfo.append("\n"); + } + anInfo.append(" " + getPointAttributeInfo(anAttribute)); } } return anInfo; } std::string ModelGeomAlgo_Point2D::getPointAttributeInfo( - const std::shared_ptr& theAttribute) -{ + const std::shared_ptr &theAttribute) { std::string anInfo; std::string aValue = "not defined"; std::string aType = theAttribute->attributeType(); if (aType == GeomDataAPI_Point2D::typeId()) { std::shared_ptr aPoint = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aPoint.get() && aPoint->isInitialized()) { - aValue = std::string("(" + doubleToString(aPoint->x()) + ", "+ - doubleToString(aPoint->y()) + ")"); + aValue = std::string("(" + doubleToString(aPoint->x()) + ", " + + doubleToString(aPoint->y()) + ")"); } } anInfo.append(theAttribute->id() + ": " + aValue); diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h index 41113d6d3..12da07c15 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelGeomAlgo_Point2D_H #define ModelGeomAlgo_Point2D_H -#include "ModelGeomAlgo.h" #include "ModelAPI_Feature.h" +#include "ModelGeomAlgo.h" class ModelAPI_Feature; class ModelAPI_Object; @@ -31,129 +32,131 @@ class GeomAPI_Dir; class GeomDataAPI_Point2D; +#include #include -#include #include -#include - +#include -class ModelGeomAlgo_Point2D -{ +class ModelGeomAlgo_Point2D { public: /// Searches Point2D attribute of reference of the attribute of given feature /// \param theFeature a feature to obtain AttributeRefAttr /// \param theAttribute a name of AttributeRefAttr on the given feature - /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search - /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search - /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes - /// \returns found point attribute or NULL - static MODELGEOMALGO_EXPORT std::shared_ptr getPointOfRefAttr( - ModelAPI_Feature* theFeature, - const std::string& theAttribute, - const std::string& theObjectFeatureKind = "", - const std::string& theObjectFeatureAttribute = ""); - - /// Fills container of point 2D attributes, which refer to the feature through the references - /// features with the given kind - /// \param theObject an object where references should be searched (e.g. a sketch line or result) - /// \param theReferenceFeatureKind a kind of the feature to be processed + /// \param theObjectFeatureKind a feature kind in object of attribute that + /// satisfies the search \param theObjectFeatureAttribute a feature attribute + /// in object that satisfies the search \param isSkipFeatureAttributes a + /// boolean value if coincidences to the feature attributes \returns found + /// point attribute or NULL + static MODELGEOMALGO_EXPORT std::shared_ptr + getPointOfRefAttr(ModelAPI_Feature *theFeature, + const std::string &theAttribute, + const std::string &theObjectFeatureKind = "", + const std::string &theObjectFeatureAttribute = ""); + + /// Fills container of point 2D attributes, which refer to the feature through + /// the references features with the given kind \param theObject an object + /// where references should be searched (e.g. a sketch line or result) \param + /// theReferenceFeatureKind a kind of the feature to be processed /// (e.g. coincidence constraint) /// \param theAttributes a container of found point 2D attributes - /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search - /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search - /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes - /// should be skipped + /// \param theObjectFeatureKind a feature kind in object of attribute that + /// satisfies the search \param theObjectFeatureAttribute a feature attribute + /// in object that satisfies the search \param isSkipFeatureAttributes a + /// boolean value if coincidences to the feature attributes should be skipped /// \returns found point attribute or NULL - static MODELGEOMALGO_EXPORT - void getPointsOfReference(const std::shared_ptr& theObject, - const std::string& theReferenceFeatureKind, - std::set >& theAttributes, - const std::string& theObjectFeatureKind = "", - const std::string& theObjectFeatureAttribute = "", - const bool isSkipFeatureAttributes = true); - - /// Find points of intersection between the shape of the feature and all features in the sketch - /// \param theBaseFeature a feature: line, arc or circle that will be intersected - /// \param theFeatures a container of features to intersect with the base feature - /// \param thePoints a container of 3D points belong to the shape - /// \param theObjectToPoint a container of object to point + static MODELGEOMALGO_EXPORT void getPointsOfReference( + const std::shared_ptr &theObject, + const std::string &theReferenceFeatureKind, + std::set> &theAttributes, + const std::string &theObjectFeatureKind = "", + const std::string &theObjectFeatureAttribute = "", + const bool isSkipFeatureAttributes = true); + + /// Find points of intersection between the shape of the feature and all + /// features in the sketch \param theBaseFeature a feature: line, arc or + /// circle that will be intersected \param theFeatures a container of features + /// to intersect with the base feature \param thePoints a container of 3D + /// points belong to the shape \param theObjectToPoint a container of object + /// to point typedef std::map, - std::pair >, - std::list > > > PointToRefsMap; + std::pair>, + std::list>>> + PointToRefsMap; static MODELGEOMALGO_EXPORT void getPointsIntersectedShape( - const std::shared_ptr& theBaseFeature, - const std::list >& theFeatures, - PointToRefsMap& thePointToAttributeOrObject); + const std::shared_ptr &theBaseFeature, + const std::list> &theFeatures, + PointToRefsMap &thePointToAttributeOrObject); - static MODELGEOMALGO_EXPORT std::list > getSetOfPntIntersectedShape( - const std::shared_ptr& theBaseFeature, - const std::list >& theFeatures); + static MODELGEOMALGO_EXPORT std::list> + getSetOfPntIntersectedShape( + const std::shared_ptr &theBaseFeature, + const std::list> &theFeatures); /// Removes attributes which points are out of the base shape /// \param theBaseShape a shape of check /// \param theAttributes a container of point 2D attributes - /// \param theOrigin origin of a plane to generate 3D point by 2D attribute point - /// \param theDirX plane X direction to generate 3D point by 2D attribute point - /// \param theDirY plane X direction to generate 3D point by 2D attribute point - /// \param thePoints a container of 3D points belong to the shape - /// \param theAttributeToPoint a container of attribute to point + /// \param theOrigin origin of a plane to generate 3D point by 2D attribute + /// point \param theDirX plane X direction to generate 3D point by 2D + /// attribute point \param theDirY plane X direction to generate 3D point by + /// 2D attribute point \param thePoints a container of 3D points belong to the + /// shape \param theAttributeToPoint a container of attribute to point static MODELGEOMALGO_EXPORT void getPointsInsideShape( - const std::shared_ptr theBaseShape, - const std::set >& theAttributes, - const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY, - PointToRefsMap& thePointToAttributeOrObject); + const std::shared_ptr theBaseShape, + const std::set> &theAttributes, + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY, + PointToRefsMap &thePointToAttributeOrObject); /// Removes attributes which points are out of the base shape /// \param theBaseShape a shape of check /// \param theAttributes a container of point 2D attributes - /// \param theOrigin origin of a plane to generate 3D point by 2D attribute point - /// \param theDirX plane X direction to generate 3D point by 2D attribute point - /// \param theDirY plane X direction to generate 3D point by 2D attribute point - /// \param thePoints a container of 3D points belong to the shape - /// \param theAttributeToPoint a container of attribute to point + /// \param theOrigin origin of a plane to generate 3D point by 2D attribute + /// point \param theDirX plane X direction to generate 3D point by 2D + /// attribute point \param theDirY plane X direction to generate 3D point by + /// 2D attribute point \param thePoints a container of 3D points belong to the + /// shape \param theAttributeToPoint a container of attribute to point static MODELGEOMALGO_EXPORT void getPointsInsideShape_p( - const std::shared_ptr theBaseShape, - const std::set >& theAttributes, - const std::shared_ptr& theOrigin, - const std::shared_ptr& theDirX, - const std::shared_ptr& theDirY, - std::list >& thePoints, - std::map, - std::shared_ptr >& theAttributeToPoint); + const std::shared_ptr theBaseShape, + const std::set> &theAttributes, + const std::shared_ptr &theOrigin, + const std::shared_ptr &theDirX, + const std::shared_ptr &theDirY, + std::list> &thePoints, + std::map, + std::shared_ptr> &theAttributeToPoint); /// Finds projected point to the given shape line /// \param theBaseShape a shape of check /// \param thePoint [in] a point to project /// \param theProjectedPoint [out] a projected point - static MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr theBaseShape, - const std::shared_ptr& thePoint, - std::shared_ptr& theProjectedPoint); - - /// Finds projected point to the given shape, which does not placed on the shape boundaries - /// \param theBaseShape a shape of check - /// \param thePoint [in] a point to project - /// \param theProjectedPoint [out] a projected point - static MODELGEOMALGO_EXPORT bool isInnerPointOnEdge( - const std::shared_ptr theBaseShape, - const std::shared_ptr& thePoint, - std::shared_ptr& theProjectedPoint); + static MODELGEOMALGO_EXPORT bool + isPointOnEdge(const std::shared_ptr theBaseShape, + const std::shared_ptr &thePoint, + std::shared_ptr &theProjectedPoint); + + /// Finds projected point to the given shape, which does not placed on the + /// shape boundaries \param theBaseShape a shape of check \param thePoint [in] + /// a point to project \param theProjectedPoint [out] a projected point + static MODELGEOMALGO_EXPORT bool + isInnerPointOnEdge(const std::shared_ptr theBaseShape, + const std::shared_ptr &thePoint, + std::shared_ptr &theProjectedPoint); #ifdef _DEBUG /// Return feature name, kind and point values united in a string info /// \param theFeature an investigated feature - /// \param theAttributesOnly a container of necessary attributes, if empty, all - /// \return string value + /// \param theAttributesOnly a container of necessary attributes, if empty, + /// all \return string value static MODELGEOMALGO_EXPORT std::string getPontAttributesInfo( - const std::shared_ptr& theFeature, - const std::set >& theAttributesOnly); + const std::shared_ptr &theFeature, + const std::set> &theAttributesOnly); /// Return point attribute string info /// \param theAttribute an investigated attribute /// \return string value static MODELGEOMALGO_EXPORT std::string getPointAttributeInfo( - const std::shared_ptr& theAttribute); + const std::shared_ptr &theAttribute); #endif }; diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp index 182e0f40d..e3a8e11a8 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -35,295 +36,302 @@ #include - #ifdef WIN32 #pragma warning(disable : 4996) // for sprintf #endif -namespace ModelGeomAlgo_Shape -{ - void shapesOfType(const FeaturePtr& theFeature, - const GeomAPI_Shape::ShapeType& theType, - std::set& theShapeResults) - { - theShapeResults.clear(); - std::list aResults = theFeature->results(); - std::list::const_iterator aRIter = aResults.cbegin(); - for (; aRIter != aResults.cend(); aRIter++) { - ResultPtr aResult = *aRIter; - GeomShapePtr aShape = aResult->shape(); - if (aShape.get() && aShape->shapeType() == theType) - theShapeResults.insert(aResult); - } +namespace ModelGeomAlgo_Shape { +void shapesOfType(const FeaturePtr &theFeature, + const GeomAPI_Shape::ShapeType &theType, + std::set &theShapeResults) { + theShapeResults.clear(); + std::list aResults = theFeature->results(); + std::list::const_iterator aRIter = aResults.cbegin(); + for (; aRIter != aResults.cend(); aRIter++) { + ResultPtr aResult = *aRIter; + GeomShapePtr aShape = aResult->shape(); + if (aShape.get() && aShape->shapeType() == theType) + theShapeResults.insert(aResult); } +} - // Check the point is within shape's bounding box - static bool isPointWithinBB(const GeomPointPtr& thePoint, - const GeomShapePtr& theShape, - const double theTolerance) - { - double aXMin, aXMax, aYMin, aYMax, aZMin, aZMax; - return theShape->computeSize(aXMin, aYMin, aZMin, aXMax, aYMax, aZMax) && - thePoint->x() >= aXMin - theTolerance && thePoint->x() <= aXMax + theTolerance && - thePoint->y() >= aYMin - theTolerance && thePoint->y() <= aYMax + theTolerance && - thePoint->z() >= aZMin - theTolerance && thePoint->z() <= aZMax + theTolerance; - } +// Check the point is within shape's bounding box +static bool isPointWithinBB(const GeomPointPtr &thePoint, + const GeomShapePtr &theShape, + const double theTolerance) { + double aXMin, aXMax, aYMin, aYMax, aZMin, aZMax; + return theShape->computeSize(aXMin, aYMin, aZMin, aXMax, aYMax, aZMax) && + thePoint->x() >= aXMin - theTolerance && + thePoint->x() <= aXMax + theTolerance && + thePoint->y() >= aYMin - theTolerance && + thePoint->y() <= aYMax + theTolerance && + thePoint->z() >= aZMin - theTolerance && + thePoint->z() <= aZMax + theTolerance; +} - // Select sub-shape of the given type, which contains the given point - static std::list findSubShape(const GeomShapePtr& theShape, - const GeomAPI_Shape::ShapeType& theType, - const GeomPointPtr& thePoint, - const double theTolerance) - { - std::list aFoundSubs; - std::list aSubs = theShape->subShapes(theType); - for (std::list::const_iterator aSubIt = aSubs.begin(); - aSubIt != aSubs.end(); ++aSubIt) { - GeomPointPtr aMiddlePoint = (*aSubIt)->middlePoint(); - if (!aMiddlePoint) - continue; +// Select sub-shape of the given type, which contains the given point +static std::list +findSubShape(const GeomShapePtr &theShape, + const GeomAPI_Shape::ShapeType &theType, + const GeomPointPtr &thePoint, const double theTolerance) { + std::list aFoundSubs; + std::list aSubs = theShape->subShapes(theType); + for (std::list::const_iterator aSubIt = aSubs.begin(); + aSubIt != aSubs.end(); ++aSubIt) { + GeomPointPtr aMiddlePoint = (*aSubIt)->middlePoint(); + if (!aMiddlePoint) + continue; - double aDistance = aMiddlePoint->distance(thePoint); - bool isFound = aDistance < theTolerance; - // issue #19019: special workaround for faces, because if the face contains B-spline contour, - // the middle point is calculated with respect to its poles, but not a curve itself. - // Thus, in some operations (like BOP) the curve may have different number of poles - // from time to time, as a result, the face parametric boundaries are floating - // as well as the middle point. - // The workaround is to find a distance from the picking point to the face, if the distance - // between the picking point and the middle point on the face is small to some extend. - static const double THE_THRESHOLD = 100.; - if (!isFound && aDistance < THE_THRESHOLD * theTolerance && (*aSubIt)->isFace()) { - GeomVertexPtr aVertex(new GeomAPI_Vertex(thePoint)); - aDistance = GeomAlgoAPI_ShapeTools::minimalDistance(aVertex, *aSubIt); - isFound = aDistance < theTolerance; - } - if (isFound) - aFoundSubs.push_back(*aSubIt); + double aDistance = aMiddlePoint->distance(thePoint); + bool isFound = aDistance < theTolerance; + // issue #19019: special workaround for faces, because if the face contains + // B-spline contour, the middle point is calculated with respect to its + // poles, but not a curve itself. Thus, in some operations (like BOP) the + // curve may have different number of poles from time to time, as a result, + // the face parametric boundaries are floating as well as the middle point. + // The workaround is to find a distance from the picking point to the face, + // if the distance between the picking point and the middle point on the + // face is small to some extend. + static const double THE_THRESHOLD = 100.; + if (!isFound && aDistance < THE_THRESHOLD * theTolerance && + (*aSubIt)->isFace()) { + GeomVertexPtr aVertex(new GeomAPI_Vertex(thePoint)); + aDistance = GeomAlgoAPI_ShapeTools::minimalDistance(aVertex, *aSubIt); + isFound = aDistance < theTolerance; } - return aFoundSubs; + if (isFound) + aFoundSubs.push_back(*aSubIt); } + return aFoundSubs; +} - // Find circular/elliptic edge, which center/focus coincide with the given point - static GeomShapePtr findEdgeByCenter(const GeomShapePtr& theBaseShape, - const GeomPointPtr& theCenter, - const double theTolerance, - int& theCenterType) - { - theCenterType = (int)ModelAPI_AttributeSelection::NOT_CENTER; - std::list anEdges = theBaseShape->subShapes(GeomAPI_Shape::EDGE); - for (std::list::const_iterator anIt = anEdges.begin(); - anIt != anEdges.end(); ++anIt) { - GeomEdgePtr anEdge = (*anIt)->edge(); - if (!anEdge) - continue; +// Find circular/elliptic edge, which center/focus coincide with the given point +static GeomShapePtr findEdgeByCenter(const GeomShapePtr &theBaseShape, + const GeomPointPtr &theCenter, + const double theTolerance, + int &theCenterType) { + theCenterType = (int)ModelAPI_AttributeSelection::NOT_CENTER; + std::list anEdges = + theBaseShape->subShapes(GeomAPI_Shape::EDGE); + for (std::list::const_iterator anIt = anEdges.begin(); + anIt != anEdges.end(); ++anIt) { + GeomEdgePtr anEdge = (*anIt)->edge(); + if (!anEdge) + continue; - if (anEdge->isCircle() || anEdge->isArc()) { - GeomCirclePtr aCircle = anEdge->circle(); - if (aCircle->center()->distance(theCenter) < theTolerance) { - theCenterType = (int)ModelAPI_AttributeSelection::CIRCLE_CENTER; - return *anIt; - } + if (anEdge->isCircle() || anEdge->isArc()) { + GeomCirclePtr aCircle = anEdge->circle(); + if (aCircle->center()->distance(theCenter) < theTolerance) { + theCenterType = (int)ModelAPI_AttributeSelection::CIRCLE_CENTER; + return *anIt; } - else if (anEdge->isEllipse()) { - GeomEllipsePtr anEllipse = anEdge->ellipse(); - if (anEllipse->firstFocus()->distance(theCenter) < theTolerance) - theCenterType = (int)ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS; - else if (anEllipse->secondFocus()->distance(theCenter) < theTolerance) - theCenterType = (int)ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS; + } else if (anEdge->isEllipse()) { + GeomEllipsePtr anEllipse = anEdge->ellipse(); + if (anEllipse->firstFocus()->distance(theCenter) < theTolerance) + theCenterType = (int)ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS; + else if (anEllipse->secondFocus()->distance(theCenter) < theTolerance) + theCenterType = (int)ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS; - if (theCenterType != (int)ModelAPI_AttributeSelection::NOT_CENTER) - return *anIt; - } + if (theCenterType != (int)ModelAPI_AttributeSelection::NOT_CENTER) + return *anIt; } - - // not found - return GeomShapePtr(); } - static void appendSubshapeOfResult(std::list& theList, - const ResultPtr& theResult, - const GeomShapePtr& theSubshape, - int theCenterType = (int)ModelAPI_AttributeSelection::NOT_CENTER) - { - SubshapeOfResult aSR; - aSR.myResult = theResult; - aSR.mySubshape = theSubshape; - aSR.myCenterType = theCenterType; - // compound subshapes from other compounds should be processed as whole results - if (aSR.mySubshape && aSR.mySubshape->shapeType() <= GeomAPI_Shape::COMPSOLID) { - if (theResult->shape()->isEqual(theSubshape)) - aSR.mySubshape = GeomShapePtr(); - else { - ResultBodyPtr aResult = std::dynamic_pointer_cast(theResult); - for (int i = 0; aResult && i < aResult->numberOfSubs(); ++i) { - ResultBodyPtr aSub = aResult->subResult(i); - if (aSub->shape()->isEqual(theSubshape)) { - aSR.myResult = aSub; - aSR.mySubshape = GeomShapePtr(); - break; - } + // not found + return GeomShapePtr(); +} + +static void appendSubshapeOfResult( + std::list &theList, const ResultPtr &theResult, + const GeomShapePtr &theSubshape, + int theCenterType = (int)ModelAPI_AttributeSelection::NOT_CENTER) { + SubshapeOfResult aSR; + aSR.myResult = theResult; + aSR.mySubshape = theSubshape; + aSR.myCenterType = theCenterType; + // compound subshapes from other compounds should be processed as whole + // results + if (aSR.mySubshape && + aSR.mySubshape->shapeType() <= GeomAPI_Shape::COMPSOLID) { + if (theResult->shape()->isEqual(theSubshape)) + aSR.mySubshape = GeomShapePtr(); + else { + ResultBodyPtr aResult = + std::dynamic_pointer_cast(theResult); + for (int i = 0; aResult && i < aResult->numberOfSubs(); ++i) { + ResultBodyPtr aSub = aResult->subResult(i); + if (aSub->shape()->isEqual(theSubshape)) { + aSR.myResult = aSub; + aSR.mySubshape = GeomShapePtr(); + break; } } } - theList.push_back(aSR); } + theList.push_back(aSR); +} - static void appendSubshapeOfResult(std::list& theList, - const ResultPtr& theResult, - const std::list& theSubshape) - { - for (std::list::const_iterator anIt = theSubshape.begin(); - anIt != theSubshape.end(); ++anIt) - appendSubshapeOfResult(theList, theResult, *anIt); - } +static void appendSubshapeOfResult(std::list &theList, + const ResultPtr &theResult, + const std::list &theSubshape) { + for (std::list::const_iterator anIt = theSubshape.begin(); + anIt != theSubshape.end(); ++anIt) + appendSubshapeOfResult(theList, theResult, *anIt); +} - static bool findSubshapeInCompsolid(const ResultBodyPtr& theCompsolid, - const std::shared_ptr& thePoint, - const GeomAPI_Shape::ShapeType& theShapeType, - const double theTolerance, - std::list& theSelected) - { - bool isSubshapeFound = false; - int aNbSolids = theCompsolid->numberOfSubs(); - for (int i = 0; i < aNbSolids; ++i) { - ResultPtr aSubResult = theCompsolid->subResult(i); +static bool +findSubshapeInCompsolid(const ResultBodyPtr &theCompsolid, + const std::shared_ptr &thePoint, + const GeomAPI_Shape::ShapeType &theShapeType, + const double theTolerance, + std::list &theSelected) { + bool isSubshapeFound = false; + int aNbSolids = theCompsolid->numberOfSubs(); + for (int i = 0; i < aNbSolids; ++i) { + ResultPtr aSubResult = theCompsolid->subResult(i); - // process subs of compsolid - ResultBodyPtr aSubCompSolid = std::dynamic_pointer_cast(aSubResult); - if (theShapeType != GeomAPI_Shape::COMPSOLID && - aSubCompSolid && aSubCompSolid->numberOfSubs() > 0) { - isSubshapeFound = findSubshapeInCompsolid(aSubCompSolid, - thePoint, theShapeType, theTolerance, theSelected); - } - else { - GeomShapePtr aSubSolid = aSubResult->shape(); - if (aSubSolid && isPointWithinBB(thePoint, aSubSolid, theTolerance)) { - std::list aSubshapes = - findSubShape(aSubSolid, theShapeType, thePoint, theTolerance); - if (!aSubshapes.empty()) { - appendSubshapeOfResult(theSelected, aSubResult, aSubshapes); - isSubshapeFound = true; - } + // process subs of compsolid + ResultBodyPtr aSubCompSolid = + std::dynamic_pointer_cast(aSubResult); + if (theShapeType != GeomAPI_Shape::COMPSOLID && aSubCompSolid && + aSubCompSolid->numberOfSubs() > 0) { + isSubshapeFound = findSubshapeInCompsolid( + aSubCompSolid, thePoint, theShapeType, theTolerance, theSelected); + } else { + GeomShapePtr aSubSolid = aSubResult->shape(); + if (aSubSolid && isPointWithinBB(thePoint, aSubSolid, theTolerance)) { + std::list aSubshapes = + findSubShape(aSubSolid, theShapeType, thePoint, theTolerance); + if (!aSubshapes.empty()) { + appendSubshapeOfResult(theSelected, aSubResult, aSubshapes); + isSubshapeFound = true; } } } - return isSubshapeFound; } + return isSubshapeFound; +} - bool findSubshapeByPoint(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint, - const GeomAPI_Shape::ShapeType& theShapeType, - std::list& theSelected) - { - static const double TOLERANCE = 1.5e-6; +bool findSubshapeByPoint(const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint, + const GeomAPI_Shape::ShapeType &theShapeType, + std::list &theSelected) { + static const double TOLERANCE = 1.5e-6; - theSelected.clear(); + theSelected.clear(); - const std::list& aResults = theFeature->results(); - for (std::list::const_iterator aResIt = aResults.begin(); - aResIt != aResults.end(); ++aResIt) { - bool isSubshapeFound = false; - GeomShapePtr aCurShape = (*aResIt)->shape(); - // first of all, check the point is within bounding box of the result - if (!aCurShape || !isPointWithinBB(thePoint, aCurShape, TOLERANCE)) - continue; - // now, process all sub-shapes of the given type and check their inner points, - // but skip the case the selected type is COMPOUND and the shape is a list of sketch edges - // (it will be processed later) - std::shared_ptr aSketchEdges = - std::dynamic_pointer_cast(aCurShape); - if (theShapeType != GeomAPI_Shape::COMPOUND || !aSketchEdges) { - ResultBodyPtr aCompSolid = std::dynamic_pointer_cast(*aResIt); - if (aCompSolid) { - isSubshapeFound = findSubshapeInCompsolid(aCompSolid, - thePoint, theShapeType, TOLERANCE, theSelected); - } + const std::list &aResults = theFeature->results(); + for (std::list::const_iterator aResIt = aResults.begin(); + aResIt != aResults.end(); ++aResIt) { + bool isSubshapeFound = false; + GeomShapePtr aCurShape = (*aResIt)->shape(); + // first of all, check the point is within bounding box of the result + if (!aCurShape || !isPointWithinBB(thePoint, aCurShape, TOLERANCE)) + continue; + // now, process all sub-shapes of the given type and check their inner + // points, but skip the case the selected type is COMPOUND and the shape is + // a list of sketch edges (it will be processed later) + std::shared_ptr aSketchEdges = + std::dynamic_pointer_cast(aCurShape); + if (theShapeType != GeomAPI_Shape::COMPOUND || !aSketchEdges) { + ResultBodyPtr aCompSolid = + std::dynamic_pointer_cast(*aResIt); + if (aCompSolid) { + isSubshapeFound = findSubshapeInCompsolid( + aCompSolid, thePoint, theShapeType, TOLERANCE, theSelected); + } - if (!isSubshapeFound) { - std::list aSubshapes = - findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); - if (!aSubshapes.empty()) { - appendSubshapeOfResult(theSelected, *aResIt, aSubshapes); - isSubshapeFound = true; - } + if (!isSubshapeFound) { + std::list aSubshapes = + findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); + if (!aSubshapes.empty()) { + appendSubshapeOfResult(theSelected, *aResIt, aSubshapes); + isSubshapeFound = true; } } - if (isSubshapeFound) - continue; + } + if (isSubshapeFound) + continue; - // special case for ResultConstruction if the FACE is selected - ResultConstructionPtr aResConstr = - std::dynamic_pointer_cast(*aResIt); - if (aResConstr && theShapeType >= GeomAPI_Shape::FACE) { - int aNbFaces = aResConstr->facesNum(); - for (int aFaceInd = 0; aFaceInd < aNbFaces; ++aFaceInd) { - GeomFacePtr aCurFace = aResConstr->face(aFaceInd); - // check the point is within bounding box of the face - if (!isPointWithinBB(thePoint, aCurFace, TOLERANCE)) - continue; - std::list aSubshapes = - findSubShape(aCurFace, theShapeType, thePoint, TOLERANCE); - if (!aSubshapes.empty()) { - appendSubshapeOfResult(theSelected, *aResIt, aSubshapes); - isSubshapeFound = true; - } + // special case for ResultConstruction if the FACE is selected + ResultConstructionPtr aResConstr = + std::dynamic_pointer_cast(*aResIt); + if (aResConstr && theShapeType >= GeomAPI_Shape::FACE) { + int aNbFaces = aResConstr->facesNum(); + for (int aFaceInd = 0; aFaceInd < aNbFaces; ++aFaceInd) { + GeomFacePtr aCurFace = aResConstr->face(aFaceInd); + // check the point is within bounding box of the face + if (!isPointWithinBB(thePoint, aCurFace, TOLERANCE)) + continue; + std::list aSubshapes = + findSubShape(aCurFace, theShapeType, thePoint, TOLERANCE); + if (!aSubshapes.empty()) { + appendSubshapeOfResult(theSelected, *aResIt, aSubshapes); + isSubshapeFound = true; } } - if (isSubshapeFound) - continue; + } + if (isSubshapeFound) + continue; - // next special case: the full sketch is selected - // the selection type is a COMPOUND - if (aSketchEdges && theShapeType == GeomAPI_Shape::COMPOUND && - aSketchEdges->middlePoint()->distance(thePoint) < TOLERANCE) { - // select whole result - appendSubshapeOfResult(theSelected, *aResIt, GeomShapePtr()); - continue; - } + // next special case: the full sketch is selected + // the selection type is a COMPOUND + if (aSketchEdges && theShapeType == GeomAPI_Shape::COMPOUND && + aSketchEdges->middlePoint()->distance(thePoint) < TOLERANCE) { + // select whole result + appendSubshapeOfResult(theSelected, *aResIt, GeomShapePtr()); + continue; + } - // another special case: the center of circle or the focus of ellipse is selected; - // return the corresponding edge and a status of the center - if (theShapeType == GeomAPI_Shape::VERTEX) { - int aCenterType; - GeomShapePtr aSubshape = findEdgeByCenter(aCurShape, thePoint, TOLERANCE, aCenterType); - if (aSubshape) { - appendSubshapeOfResult(theSelected, *aResIt, aSubshape, aCenterType); - continue; - } + // another special case: the center of circle or the focus of ellipse is + // selected; return the corresponding edge and a status of the center + if (theShapeType == GeomAPI_Shape::VERTEX) { + int aCenterType; + GeomShapePtr aSubshape = + findEdgeByCenter(aCurShape, thePoint, TOLERANCE, aCenterType); + if (aSubshape) { + appendSubshapeOfResult(theSelected, *aResIt, aSubshape, aCenterType); + continue; } } + } - bool processSketch = theSelected.empty() || (theSelected.size() == 1 && - theSelected.front().myCenterType != (int)ModelAPI_AttributeSelection::NOT_CENTER); - // one more special case: the selected entity is a separated sketch point - // or an auxiliary sketch edge; they are not included into the sketch result; - // thus, it is necessary to pass through the sketch sub-features and find selected. - if (processSketch && !aResults.empty() && - (theShapeType == GeomAPI_Shape::VERTEX || theShapeType == GeomAPI_Shape::EDGE)) { - CompositeFeaturePtr aCF = std::dynamic_pointer_cast(theFeature); - std::shared_ptr aSketchEdges = - std::dynamic_pointer_cast(aResults.front()->shape()); + bool processSketch = + theSelected.empty() || (theSelected.size() == 1 && + theSelected.front().myCenterType != + (int)ModelAPI_AttributeSelection::NOT_CENTER); + // one more special case: the selected entity is a separated sketch point + // or an auxiliary sketch edge; they are not included into the sketch result; + // thus, it is necessary to pass through the sketch sub-features and find + // selected. + if (processSketch && !aResults.empty() && + (theShapeType == GeomAPI_Shape::VERTEX || + theShapeType == GeomAPI_Shape::EDGE)) { + CompositeFeaturePtr aCF = + std::dynamic_pointer_cast(theFeature); + std::shared_ptr aSketchEdges = + std::dynamic_pointer_cast( + aResults.front()->shape()); - if (aSketchEdges && aCF) { - int aNbSubs = aCF->numberOfSubs(); - for (int aSubInd = 0; aSubInd < aNbSubs; ++aSubInd) { - FeaturePtr aSub = aCF->subFeature(aSubInd); - const std::list& aSubResults = aSub->results(); - for (std::list::const_iterator aSRIt = aSubResults.begin(); - aSRIt != aSubResults.end(); ++aSRIt) { - GeomShapePtr aCurShape = (*aSRIt)->shape(); - std::list aSubshapes = - findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); - if (!aSubshapes.empty()) { - appendSubshapeOfResult(theSelected, aResults.front(), aSubshapes); - break; - } + if (aSketchEdges && aCF) { + int aNbSubs = aCF->numberOfSubs(); + for (int aSubInd = 0; aSubInd < aNbSubs; ++aSubInd) { + FeaturePtr aSub = aCF->subFeature(aSubInd); + const std::list &aSubResults = aSub->results(); + for (std::list::const_iterator aSRIt = aSubResults.begin(); + aSRIt != aSubResults.end(); ++aSRIt) { + GeomShapePtr aCurShape = (*aSRIt)->shape(); + std::list aSubshapes = + findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); + if (!aSubshapes.empty()) { + appendSubshapeOfResult(theSelected, aResults.front(), aSubshapes); + break; } } } } - - return !theSelected.empty(); } + + return !theSelected.empty(); +} } // namespace ModelGeomAlgo_Shape diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.h b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.h index 20676c60a..22dfc9ca8 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.h +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelGeomAlgo_Shape_H #define ModelGeomAlgo_Shape_H -#include "ModelGeomAlgo.h" #include "GeomAPI_Shape.h" +#include "ModelGeomAlgo.h" #include @@ -30,35 +31,36 @@ class ModelAPI_Result; namespace ModelGeomAlgo_Shape { - /// Searches Shape results of the feature satisfied the given shape type - /// \param theFeature a feature to obtain AttributeRefAttr - /// \param theType shape type - /// \param theShapeResults a list of results - MODELGEOMALGO_EXPORT void shapesOfType( - const std::shared_ptr& theFeature, - const GeomAPI_Shape::ShapeType& theType, - std::set >& theShapeResults); +/// Searches Shape results of the feature satisfied the given shape type +/// \param theFeature a feature to obtain AttributeRefAttr +/// \param theType shape type +/// \param theShapeResults a list of results +MODELGEOMALGO_EXPORT void +shapesOfType(const std::shared_ptr &theFeature, + const GeomAPI_Shape::ShapeType &theType, + std::set> &theShapeResults); - struct SubshapeOfResult - { - std::shared_ptr myResult; - std::shared_ptr mySubshape; - int myCenterType; - }; +struct SubshapeOfResult { + std::shared_ptr myResult; + std::shared_ptr mySubshape; + int myCenterType; +}; - /// Searches a sub-shape in the results of the given features, - /// which contains the given point. - /// \param[in] theFeature feature, which results are being processed - /// \param[in] thePoint selected point which identifies the shape - /// \param[in] theShapeType type of the selected shape - /// \param[out] theSelected applicable result, sub-shape of the found result and - /// type of the point if it is a center of circle or a focus of ellipse - /// \return \c true if the result and its applicable sub-shape are found - MODELGEOMALGO_EXPORT bool findSubshapeByPoint( - const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint, - const GeomAPI_Shape::ShapeType& theShapeType, - std::list& theSelected); -} +/// Searches a sub-shape in the results of the given features, +/// which contains the given point. +/// \param[in] theFeature feature, which results are being processed +/// \param[in] thePoint selected point which identifies the shape +/// \param[in] theShapeType type of the selected shape +/// \param[out] theSelected applicable result, sub-shape of the found result +/// and +/// type of the point if it is a center of circle or a +/// focus of ellipse +/// \return \c true if the result and its applicable sub-shape are found +MODELGEOMALGO_EXPORT bool +findSubshapeByPoint(const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint, + const GeomAPI_Shape::ShapeType &theShapeType, + std::list &theSelected); +} // namespace ModelGeomAlgo_Shape #endif diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_swig.h b/src/ModelGeomAlgo/ModelGeomAlgo_swig.h index 65965682e..4235a6198 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_swig.h +++ b/src/ModelGeomAlgo/ModelGeomAlgo_swig.h @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELGEOMALGO_MODELGEOMALGO_SWIG_H_ #define SRC_MODELGEOMALGO_MODELGEOMALGO_SWIG_H_ - #include - #include - #include +#include +#include +#include - #include "ModelGeomAlgo.h" - #include "ModelGeomAlgo_Point2D.h" +#include "ModelGeomAlgo.h" +#include "ModelGeomAlgo_Point2D.h" - #include - #include +#include +#include #endif /* SRC_MODELGEOMALGO_MODELGEOMALGO_SWIG_H_ */ diff --git a/src/ModelHighAPI/CMakeLists.txt b/src/ModelHighAPI/CMakeLists.txt index 36e675c25..55d8d6118 100644 --- a/src/ModelHighAPI/CMakeLists.txt +++ b/src/ModelHighAPI/CMakeLists.txt @@ -122,16 +122,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ModelHighAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ModelHighAPI/ModelHighAPI.h b/src/ModelHighAPI/ModelHighAPI.h index 4e2a2612c..a49b770ec 100644 --- a/src/ModelHighAPI/ModelHighAPI.h +++ b/src/ModelHighAPI/ModelHighAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODELHIGHAPI_H @@ -22,13 +23,13 @@ #if defined MODELHIGHAPI_EXPORTS #if defined WIN32 -#define MODELHIGHAPI_EXPORT __declspec( dllexport ) +#define MODELHIGHAPI_EXPORT __declspec(dllexport) #else #define MODELHIGHAPI_EXPORT #endif #else #if defined WIN32 -#define MODELHIGHAPI_EXPORT __declspec( dllimport ) +#define MODELHIGHAPI_EXPORT __declspec(dllimport) #else #define MODELHIGHAPI_EXPORT #endif diff --git a/src/ModelHighAPI/ModelHighAPI_Double.cpp b/src/ModelHighAPI/ModelHighAPI_Double.cpp index fa450101b..f7aa0a45b 100644 --- a/src/ModelHighAPI/ModelHighAPI_Double.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Double.cpp @@ -14,48 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Double.h" -#include #include +#include #include //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- ModelHighAPI_Double::ModelHighAPI_Double(double theValue) -: myVariantType(VT_DOUBLE) -, myDouble(theValue) -{ -} + : myVariantType(VT_DOUBLE), myDouble(theValue) {} -ModelHighAPI_Double::ModelHighAPI_Double(const std::wstring & theValue) -: myVariantType(VT_STRING) -, myString(theValue) -{ -} +ModelHighAPI_Double::ModelHighAPI_Double(const std::wstring &theValue) + : myVariantType(VT_STRING), myString(theValue) {} -ModelHighAPI_Double::ModelHighAPI_Double(const wchar_t * theValue) -: myVariantType(VT_STRING) -, myString(theValue) -{ -} +ModelHighAPI_Double::ModelHighAPI_Double(const wchar_t *theValue) + : myVariantType(VT_STRING), myString(theValue) {} -ModelHighAPI_Double::~ModelHighAPI_Double() -{ -} +ModelHighAPI_Double::~ModelHighAPI_Double() {} -double ModelHighAPI_Double::value() const -{ +double ModelHighAPI_Double::value() const { // needed for array of double, which supports no text return myDouble; } -std::wstring ModelHighAPI_Double::string() const -{ +std::wstring ModelHighAPI_Double::string() const { if (myVariantType == VT_STRING) return myString; @@ -66,30 +54,40 @@ std::wstring ModelHighAPI_Double::string() const //-------------------------------------------------------------------------------------- void ModelHighAPI_Double::fillAttribute( - const std::shared_ptr & theAttribute) const -{ - switch(myVariantType) { - case VT_DOUBLE: theAttribute->setValue(myDouble); return; - case VT_STRING: theAttribute->setText(myString); return; + const std::shared_ptr &theAttribute) const { + switch (myVariantType) { + case VT_DOUBLE: + theAttribute->setValue(myDouble); + return; + case VT_STRING: + theAttribute->setText(myString); + return; } } void ModelHighAPI_Double::fillAttribute( - const std::shared_ptr & thePoint, - const ModelHighAPI_Double & theX, - const ModelHighAPI_Double & theY, - const ModelHighAPI_Double & theZ) const -{ + const std::shared_ptr &thePoint, + const ModelHighAPI_Double &theX, const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ) const { switch (theX.myVariantType) { - case VT_DOUBLE: thePoint->setX(theX.myDouble); break; - case VT_STRING: thePoint->setTextX(theX.myString); + case VT_DOUBLE: + thePoint->setX(theX.myDouble); + break; + case VT_STRING: + thePoint->setTextX(theX.myString); } switch (theY.myVariantType) { - case VT_DOUBLE: thePoint->setY(theY.myDouble); break; - case VT_STRING: thePoint->setTextY(theY.myString); + case VT_DOUBLE: + thePoint->setY(theY.myDouble); + break; + case VT_STRING: + thePoint->setTextY(theY.myString); } switch (theZ.myVariantType) { - case VT_DOUBLE: thePoint->setZ(theZ.myDouble); break; - case VT_STRING: thePoint->setTextZ(theZ.myString); + case VT_DOUBLE: + thePoint->setZ(theZ.myDouble); + break; + case VT_STRING: + thePoint->setTextZ(theZ.myString); } } diff --git a/src/ModelHighAPI/ModelHighAPI_Double.h b/src/ModelHighAPI/ModelHighAPI_Double.h index be36487e0..bcd78e78d 100644 --- a/src/ModelHighAPI/ModelHighAPI_Double.h +++ b/src/ModelHighAPI/ModelHighAPI_Double.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_DOUBLE_H_ @@ -33,32 +34,32 @@ class GeomDataAPI_Point; * \ingroup CPPHighAPI * \brief Class for filling ModelAPI_AttributeDouble */ -class ModelHighAPI_Double -{ +class ModelHighAPI_Double { public: /// Constructor for double MODELHIGHAPI_EXPORT ModelHighAPI_Double(double theValue = 0.); /// Constructor for std::string MODELHIGHAPI_EXPORT - ModelHighAPI_Double(const std::wstring & theValue); + ModelHighAPI_Double(const std::wstring &theValue); /// Constructor for char * MODELHIGHAPI_EXPORT - ModelHighAPI_Double(const wchar_t * theValue); + ModelHighAPI_Double(const wchar_t *theValue); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Double(); /// Fill attribute values MODELHIGHAPI_EXPORT - virtual void fillAttribute(const std::shared_ptr & theAttribute) const; + virtual void fillAttribute( + const std::shared_ptr &theAttribute) const; /// Sets the zero-based coordinates of a point - MODELHIGHAPI_EXPORT virtual void fillAttribute( - const std::shared_ptr & thePoint, - const ModelHighAPI_Double & theX, - const ModelHighAPI_Double & theY, - const ModelHighAPI_Double & theZ) const; + MODELHIGHAPI_EXPORT virtual void + fillAttribute(const std::shared_ptr &thePoint, + const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ) const; /// Value of the attribute MODELHIGHAPI_EXPORT double value() const; diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 9d97527d7..4aa82da04 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Dumper.h" @@ -22,9 +23,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -46,8 +47,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -70,30 +71,31 @@ #include -#include -#include #include #include +#include +#include // =========== Implementation of storage of dumped data =========== static const int THE_DUMP_PRECISION = 16; -class ModelHighAPI_Dumper::DumpStorageBuffer : public ModelHighAPI_Dumper::DumpStorage -{ +class ModelHighAPI_Dumper::DumpStorageBuffer + : public ModelHighAPI_Dumper::DumpStorage { public: - void addStorage(const ModelHighAPI_Dumper::DumpStoragePtr& theStorage) - { myStorageArray.push_back(theStorage); } + void addStorage(const ModelHighAPI_Dumper::DumpStoragePtr &theStorage) { + myStorageArray.push_back(theStorage); + } void clear() { myStorageArray.clear(); } - bool isBufferEmpty() - { - return myStorageArray.empty() || myStorageArray.front()->buffer().str().empty(); + bool isBufferEmpty() { + return myStorageArray.empty() || + myStorageArray.front()->buffer().str().empty(); } - void mergeBuffer() - { - std::list::iterator anIt = myStorageArray.begin(); + void mergeBuffer() { + std::list::iterator anIt = + myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) { // avoid multiple empty lines std::string aBuf = (*anIt)->buffer().str(); @@ -106,70 +108,62 @@ public: } } - void write(const std::string& theValue) - { + void write(const std::string &theValue) { if (myStorageArray.empty()) addStorage(DumpStoragePtr(new DumpStorage)); - std::list::iterator anIt = myStorageArray.begin(); + std::list::iterator anIt = + myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->buffer() << theValue; } - DumpStorageBuffer& operator<<(const char theChar) - { + DumpStorageBuffer &operator<<(const char theChar) { std::ostringstream out; out << theChar; write(out.str()); return *this; } - DumpStorageBuffer& operator<<(const char* theString) - { + DumpStorageBuffer &operator<<(const char *theString) { write(theString); return *this; } - DumpStorageBuffer& operator<<(const std::string& theString) - { + DumpStorageBuffer &operator<<(const std::string &theString) { write(theString); return *this; } - DumpStorageBuffer& operator<<(const bool theValue) - { + DumpStorageBuffer &operator<<(const bool theValue) { std::ostringstream out; out << theValue; write(out.str()); return *this; } - DumpStorageBuffer& operator<<(const int theValue) - { + DumpStorageBuffer &operator<<(const int theValue) { std::ostringstream out; out << theValue; write(out.str()); return *this; } - DumpStorageBuffer& operator<<(const double theValue) - { + DumpStorageBuffer &operator<<(const double theValue) { std::ostringstream out; out << std::setprecision(THE_DUMP_PRECISION) << theValue; write(out.str()); return *this; } /// Dump std::endl - friend - DumpStorageBuffer& operator<<(DumpStorageBuffer& theBuffer, - std::basic_ostream& (*)(std::basic_ostream&)) - { + friend DumpStorageBuffer & + operator<<(DumpStorageBuffer &theBuffer, + std::basic_ostream &(*)(std::basic_ostream &)) { theBuffer.write("\n"); return theBuffer; } - void dumpArray(int theSize, double* theValues, std::string* theTexts) - { + void dumpArray(int theSize, double *theValues, std::string *theTexts) { std::ostringstream anOutput; anOutput << std::setprecision(THE_DUMP_PRECISION); for (int i = 0; i < theSize; ++i) { @@ -183,41 +177,45 @@ public: write(anOutput.str()); } - virtual void write(const std::shared_ptr& theAttrSelect) - { + virtual void + write(const std::shared_ptr &theAttrSelect) { if (myStorageArray.empty()) addStorage(DumpStoragePtr(new DumpStorage)); - std::list::iterator anIt = myStorageArray.begin(); + std::list::iterator anIt = + myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->write(theAttrSelect); } - virtual void reserveBuffer() - { - std::list::iterator anIt = myStorageArray.begin(); + virtual void reserveBuffer() { + std::list::iterator anIt = + myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->reserveBuffer(); } - virtual void restoreReservedBuffer() - { - std::list::iterator anIt = myStorageArray.begin(); + virtual void restoreReservedBuffer() { + std::list::iterator anIt = + myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->restoreReservedBuffer(); } - virtual bool exportTo(const std::string& theFilename, const ModulesSet& theUsedModules) - { + virtual bool exportTo(const std::string &theFilename, + const ModulesSet &theUsedModules) { static const std::string THE_EXT = ".py"; std::string aFilenameBase = theFilename; if (aFilenameBase.rfind(THE_EXT) == aFilenameBase.size() - THE_EXT.size()) - aFilenameBase = aFilenameBase.substr(0, aFilenameBase.size() - THE_EXT.size()); + aFilenameBase = + aFilenameBase.substr(0, aFilenameBase.size() - THE_EXT.size()); bool isOk = true; - std::list::iterator anIt = myStorageArray.begin(); + std::list::iterator anIt = + myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) { - std::string aFilename = aFilenameBase + (*anIt)->myFilenameSuffix + THE_EXT; + std::string aFilename = + aFilenameBase + (*anIt)->myFilenameSuffix + THE_EXT; isOk = (*anIt)->exportTo(aFilename, theUsedModules) && isOk; } return isOk; @@ -227,18 +225,16 @@ private: std::list myStorageArray; }; - -ModelHighAPI_Dumper::DumpStorage::DumpStorage(const DumpStorage& theOther) - : myFilenameSuffix(theOther.myFilenameSuffix), - myDumpBufferHideout(theOther.myDumpBufferHideout) -{ +ModelHighAPI_Dumper::DumpStorage::DumpStorage(const DumpStorage &theOther) + : myFilenameSuffix(theOther.myFilenameSuffix), + myDumpBufferHideout(theOther.myDumpBufferHideout) { myFullDump.str(theOther.myFullDump.str()); myDumpBuffer.str(theOther.myDumpBuffer.str()); } -const ModelHighAPI_Dumper::DumpStorage& -ModelHighAPI_Dumper::DumpStorage::operator=(const ModelHighAPI_Dumper::DumpStorage& theOther) -{ +const ModelHighAPI_Dumper::DumpStorage & +ModelHighAPI_Dumper::DumpStorage::operator=( + const ModelHighAPI_Dumper::DumpStorage &theOther) { myFilenameSuffix = theOther.myFilenameSuffix; myFullDump.str(theOther.myFullDump.str()); myDumpBuffer.str(theOther.myDumpBuffer.str()); @@ -246,28 +242,25 @@ ModelHighAPI_Dumper::DumpStorage::operator=(const ModelHighAPI_Dumper::DumpStora return *this; } -void ModelHighAPI_Dumper::DumpStorage::reserveBuffer() -{ +void ModelHighAPI_Dumper::DumpStorage::reserveBuffer() { myDumpBufferHideout.push(myDumpBuffer.str()); myDumpBuffer.str(""); } -void ModelHighAPI_Dumper::DumpStorage::restoreReservedBuffer() -{ +void ModelHighAPI_Dumper::DumpStorage::restoreReservedBuffer() { myDumpBuffer << myDumpBufferHideout.top(); myDumpBufferHideout.pop(); } -bool ModelHighAPI_Dumper::DumpStorage::exportTo(const std::string& theFilename, - const ModulesSet& theUsedModules) -{ +bool ModelHighAPI_Dumper::DumpStorage::exportTo( + const std::string &theFilename, const ModulesSet &theUsedModules) { std::ofstream aFile(theFilename.c_str(), std::ofstream::out); if (!aFile.is_open()) return false; // standard header imported modules for (ModulesSet::const_iterator aModIt = theUsedModules.begin(); - aModIt != theUsedModules.end(); ++aModIt) { + aModIt != theUsedModules.end(); ++aModIt) { aFile << "from " << *aModIt << " import *" << std::endl; } if (!theUsedModules.empty()) @@ -287,18 +280,17 @@ bool ModelHighAPI_Dumper::DumpStorage::exportTo(const std::string& theFilename, return true; } -static void getShapeAndContext(const AttributeSelectionPtr& theAttrSelect, - GeomShapePtr& theShape, ResultPtr& theContext) -{ +static void getShapeAndContext(const AttributeSelectionPtr &theAttrSelect, + GeomShapePtr &theShape, ResultPtr &theContext) { if (theAttrSelect->isInitialized()) { theShape = theAttrSelect->value(); theContext = theAttrSelect->context(); if (!theShape.get()) theShape = theContext->shape(); - if (theAttrSelect->isGeometricalSelection() && - theShape.get() && theShape->shapeType() == GeomAPI_Shape::COMPOUND && - theContext.get() && !theShape->isEqual(theContext->shape()) && + if (theAttrSelect->isGeometricalSelection() && theShape.get() && + theShape->shapeType() == GeomAPI_Shape::COMPOUND && theContext.get() && + !theShape->isEqual(theContext->shape()) && theContext->groupName() != ModelAPI_ResultPart::group() && theContext->groupName() != ModelAPI_ResultGroup::group()) { GeomAPI_ShapeIterator anIt(theShape); @@ -307,8 +299,8 @@ static void getShapeAndContext(const AttributeSelectionPtr& theAttrSelect, } } -void ModelHighAPI_Dumper::DumpStorage::write(const AttributeSelectionPtr& theAttrSelect) -{ +void ModelHighAPI_Dumper::DumpStorage::write( + const AttributeSelectionPtr &theAttrSelect) { myDumpBuffer << "model.selection("; GeomShapePtr aShape; @@ -317,25 +309,26 @@ void ModelHighAPI_Dumper::DumpStorage::write(const AttributeSelectionPtr& theAtt if (aShape.get()) { myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \"" - << Locale::Convert::toString(theAttrSelect->namingName()) << "\""; + << Locale::Convert::toString(theAttrSelect->namingName()) + << "\""; } myDumpBuffer << ")"; } -static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, - const ResultPtr& theResult, - const GeomShapePtr& theShape, - const FeaturePtr& theStartFeature, - const FeaturePtr& theEndFeature) -{ +static int possibleSelectionsByPoint(const GeomPointPtr &thePoint, + const ResultPtr &theResult, + const GeomShapePtr &theShape, + const FeaturePtr &theStartFeature, + const FeaturePtr &theEndFeature) { DocumentPtr aDoc1 = theStartFeature->document(); DocumentPtr aDoc2 = theEndFeature->document(); std::list aFeatures = aDoc1->allFeatures(); if (aDoc1 != aDoc2) { // Find the position of the part, where its features should be inserted. - // It will avoid checking of appropriate elements in partSet after the current part. + // It will avoid checking of appropriate elements in partSet after the + // current part. std::list::iterator aFIt = aFeatures.begin(); for (; aFIt != aFeatures.end(); ++aFIt) { ResultPartPtr aPartRes = @@ -345,14 +338,16 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, } std::list anAdditionalFeatures = aDoc2->allFeatures(); - aFeatures.insert(aFIt, anAdditionalFeatures.begin(), anAdditionalFeatures.end()); + aFeatures.insert(aFIt, anAdditionalFeatures.begin(), + anAdditionalFeatures.end()); } CompositeFeaturePtr aLastCompositeFeature; std::list::const_iterator aFIt = aFeatures.begin(); while (aFIt != aFeatures.end() && *aFIt != theStartFeature) { - CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast(*aFIt); + CompositeFeaturePtr aCompFeat = + std::dynamic_pointer_cast(*aFIt); if (aCompFeat) aLastCompositeFeature = aCompFeat; ++aFIt; @@ -361,17 +356,19 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, // collect the list of composite features, containing the last feature; // these features should be excluded from searching, // because the feature cannot select sub-shapes from its parent - std::set aEndFeatureParents = ModelAPI_Tools::getParents(theEndFeature); + std::set aEndFeatureParents = + ModelAPI_Tools::getParents(theEndFeature); int aNbPossibleSelections = 0; for (; aFIt != aFeatures.end() && *aFIt != theEndFeature; ++aFIt) { bool isSkipFeature = false; if (aLastCompositeFeature && aLastCompositeFeature->isSub(*aFIt)) isSkipFeature = true; - CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast(*aFIt); + CompositeFeaturePtr aCompFeat = + std::dynamic_pointer_cast(*aFIt); if (aCompFeat) { - ResultPartPtr aPartRes = - std::dynamic_pointer_cast(aCompFeat->firstResult()); + ResultPartPtr aPartRes = std::dynamic_pointer_cast( + aCompFeat->firstResult()); if (!aPartRes) aLastCompositeFeature = aCompFeat; if (aEndFeatureParents.find(aCompFeat) != aEndFeatureParents.end()) { @@ -384,11 +381,12 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, continue; std::list anApproproate; - if (ModelGeomAlgo_Shape::findSubshapeByPoint(*aFIt, thePoint, theShape->shapeType(), - anApproproate)) { + if (ModelGeomAlgo_Shape::findSubshapeByPoint( + *aFIt, thePoint, theShape->shapeType(), anApproproate)) { bool isContinue = true; - std::list > aCenters; - std::list::iterator anApIt = anApproproate.begin(); + std::list> aCenters; + std::list::iterator anApIt = + anApproproate.begin(); for (; anApIt != anApproproate.end() && isContinue; ++anApIt) { ++aNbPossibleSelections; @@ -398,7 +396,8 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, aCurShape = anApIt->myResult->shape(); if (anApIt->myResult->isSame(theResult)) { - if (anApIt->myCenterType == (int)ModelAPI_AttributeSelection::NOT_CENTER) + if (anApIt->myCenterType == + (int)ModelAPI_AttributeSelection::NOT_CENTER) isContinue = !aCurShape->isSame(theShape); else if (theShape->isVertex() && aCurShape->isEdge()) { GeomEdgePtr aCurEdge = aCurShape->edge(); @@ -406,26 +405,27 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, GeomPointPtr aCenter; switch (anApIt->myCenterType) { case (int)ModelAPI_AttributeSelection::CIRCLE_CENTER: { - GeomCirclePtr aCirc = aCurEdge->circle(); - if (aCirc) - aCenter = aCirc->center(); - break; - } + GeomCirclePtr aCirc = aCurEdge->circle(); + if (aCirc) + aCenter = aCirc->center(); + break; + } case (int)ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS: { - GeomEllipsePtr anEllipse = aCurEdge->ellipse(); - if (anEllipse) - aCenter = anEllipse->firstFocus(); - break; - } + GeomEllipsePtr anEllipse = aCurEdge->ellipse(); + if (anEllipse) + aCenter = anEllipse->firstFocus(); + break; + } case (int)ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS: { - GeomEllipsePtr anEllipse = aCurEdge->ellipse(); - if (anEllipse) - aCenter = anEllipse->secondFocus(); - break; - } + GeomEllipsePtr anEllipse = aCurEdge->ellipse(); + if (anEllipse) + aCenter = anEllipse->secondFocus(); + break; + } } if (aCenter && aCenter->distance(aVertex->point()) < 1.e-7) - aCenters.push_back(std::pair(aCurShape, aNbPossibleSelections)); + aCenters.push_back(std::pair( + aCurShape, aNbPossibleSelections)); } } } @@ -438,8 +438,8 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint, return aNbPossibleSelections; } -void ModelHighAPI_Dumper::DumpStorageGeom::write(const AttributeSelectionPtr& theAttrSelect) -{ +void ModelHighAPI_Dumper::DumpStorageGeom::write( + const AttributeSelectionPtr &theAttrSelect) { GeomShapePtr aShape; ResultPtr aContext; getShapeAndContext(theAttrSelect, aShape, aContext); @@ -456,15 +456,16 @@ void ModelHighAPI_Dumper::DumpStorageGeom::write(const AttributeSelectionPtr& th // check the selected item is a ResultPart; // in this case it is necessary to get shape with full transformation // for correct calculation of the middle point - ResultPartPtr aResPart = - std::dynamic_pointer_cast(theAttrSelect->context()); + ResultPartPtr aResPart = std::dynamic_pointer_cast( + theAttrSelect->context()); if (aResPart && aShape->shapeType() == GeomAPI_Shape::COMPOUND) aShape = aResPart->shape(); GeomPointPtr aMiddlePoint = aShape->middlePoint(); // calculate number of features, which could be selected by the same point FeaturePtr anOwner = ModelAPI_Feature::feature(theAttrSelect->owner()); - int aNbPossibleSelections = possibleSelectionsByPoint(aMiddlePoint, - theAttrSelect->context(), aShape, aSelectedFeature, anOwner); + int aNbPossibleSelections = + possibleSelectionsByPoint(aMiddlePoint, theAttrSelect->context(), + aShape, aSelectedFeature, anOwner); // produce the index if the number of applicable features is greater than 1 std::string anIndex; @@ -474,19 +475,16 @@ void ModelHighAPI_Dumper::DumpStorageGeom::write(const AttributeSelectionPtr& th anIndex = anOutput.str(); } - myDumpBuffer << std::setprecision(THE_DUMP_PRECISION) - << anIndex << "\", (" - << aMiddlePoint->x() << ", " - << aMiddlePoint->y() << ", " + myDumpBuffer << std::setprecision(THE_DUMP_PRECISION) << anIndex << "\", (" + << aMiddlePoint->x() << ", " << aMiddlePoint->y() << ", " << aMiddlePoint->z() << ")"; myDumpBuffer << ")"; - } - else + } else DumpStorage::write(theAttrSelect); } -void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& theAttrSelect) -{ +void ModelHighAPI_Dumper::DumpStorageWeak::write( + const AttributeSelectionPtr &theAttrSelect) { GeomShapePtr aShape; ResultPtr aContext; getShapeAndContext(theAttrSelect, aShape, aContext); @@ -498,7 +496,8 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& th int anIndex = aNExplode.index(aShape); if (anIndex != 0) { // found a week-naming index, so, export it myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \"" - << Locale::Convert::toString(theAttrSelect->contextName(aContext)) + << Locale::Convert::toString( + theAttrSelect->contextName(aContext)) << "\", " << anIndex << ")"; aStandardDump = false; } @@ -508,40 +507,28 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& th } // ====================================================================== - static int gCompositeStackDepth = 0; -ModelHighAPI_Dumper* ModelHighAPI_Dumper::mySelf = 0; +ModelHighAPI_Dumper *ModelHighAPI_Dumper::mySelf = 0; ModelHighAPI_Dumper::ModelHighAPI_Dumper() - : myDumpStorage(new DumpStorageBuffer), - myDumpPostponedInProgress(false) -{ -} + : myDumpStorage(new DumpStorageBuffer), myDumpPostponedInProgress(false) {} -ModelHighAPI_Dumper::~ModelHighAPI_Dumper() -{ - delete myDumpStorage; -} +ModelHighAPI_Dumper::~ModelHighAPI_Dumper() { delete myDumpStorage; } -void ModelHighAPI_Dumper::setInstance(ModelHighAPI_Dumper* theDumper) -{ +void ModelHighAPI_Dumper::setInstance(ModelHighAPI_Dumper *theDumper) { if (mySelf == 0) mySelf = theDumper; } -ModelHighAPI_Dumper* ModelHighAPI_Dumper::getInstance() -{ - return mySelf; -} +ModelHighAPI_Dumper *ModelHighAPI_Dumper::getInstance() { return mySelf; } -void ModelHighAPI_Dumper::addCustomStorage(const ModelHighAPI_Dumper::DumpStoragePtr& theStorage) -{ +void ModelHighAPI_Dumper::addCustomStorage( + const ModelHighAPI_Dumper::DumpStoragePtr &theStorage) { myDumpStorage->addStorage(theStorage); } -void ModelHighAPI_Dumper::clearCustomStorage() -{ +void ModelHighAPI_Dumper::clearCustomStorage() { myDumpStorage->clear(); myNames.clear(); @@ -553,14 +540,10 @@ void ModelHighAPI_Dumper::clearCustomStorage() clearNotDumped(); } -void ModelHighAPI_Dumper::clearNotDumped() -{ - myNotDumpedEntities.clear(); -} +void ModelHighAPI_Dumper::clearNotDumped() { myNotDumpedEntities.clear(); } // Convert string to integer. If the string is not a number, return -1 -static int toInt(const std::string& theString) -{ +static int toInt(const std::string &theString) { std::string::const_iterator aChar = theString.begin(); for (; aChar != theString.end(); ++aChar) if (!std::isdigit(*aChar)) @@ -570,11 +553,10 @@ static int toInt(const std::string& theString) return std::stoi(theString); } -const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, +const std::string &ModelHighAPI_Dumper::name(const EntityPtr &theEntity, bool theSaveNotDumped, bool theUseEntityName, - bool theSetIsDumped) -{ + bool theSetIsDumped) { EntityNameMap::iterator aFound = myNames.find(theEntity); if (aFound != myNames.end()) { // Set dumped flag for postponed constraints which are without names @@ -604,16 +586,18 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, ObjectPtr anObject = std::dynamic_pointer_cast(theEntity); if (anObject) { DocumentPtr aDoc = anObject->document(); - std::pair& aNbFeatures = myFeatureCount[aDoc][aKind]; + std::pair &aNbFeatures = myFeatureCount[aDoc][aKind]; aNbFeatures.first += 1; size_t anIndex = aName.find(aKind); - if (anIndex == 0 && aName[aKind.length()] == '_') { // name starts with "FeatureKind_" + if (anIndex == 0 && + aName[aKind.length()] == '_') { // name starts with "FeatureKind_" std::string anIdStr = aName.substr(aKind.length() + 1); int anId = toInt(anIdStr); - // Check number of already registered objects of such kind. Index of current object - // should be the same to identify feature's name as automatically generated. + // Check number of already registered objects of such kind. Index of + // current object should be the same to identify feature's name as + // automatically generated. if (aNbFeatures.first == anId && aNbFeatures.second < anId) { // name is not user-defined isDefaultName = true; @@ -621,8 +605,9 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, // check there are postponed features of this kind, // dump their names, because the sequence of features may be changed for (std::list::const_iterator aPpIt = myPostponed.begin(); - aPpIt != myPostponed.end(); ++aPpIt) { - FeaturePtr aCurFeature = std::dynamic_pointer_cast(*aPpIt); + aPpIt != myPostponed.end(); ++aPpIt) { + FeaturePtr aCurFeature = + std::dynamic_pointer_cast(*aPpIt); if (aCurFeature && aCurFeature->getKind() == aKind) { myNames[*aPpIt].myIsDefault = false; isDefaultName = false; @@ -641,8 +626,8 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, int aFullIndex = 0; NbFeaturesMap::const_iterator aFIt = myFeatureCount.begin(); for (; aFIt != myFeatureCount.end(); ++aFIt) { - std::map >::const_iterator aFoundKind = - aFIt->second.find(aKind); + std::map>::const_iterator aFoundKind = + aFIt->second.find(aKind); if (aFoundKind != aFIt->second.end()) aFullIndex += aFoundKind->second.first; } @@ -663,13 +648,14 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, return myNames[theEntity].myCurrentName; } -const std::string& ModelHighAPI_Dumper::parentName(const FeaturePtr& theEntity) -{ - const std::set& aRefs = theEntity->data()->refsToMe(); +const std::string & +ModelHighAPI_Dumper::parentName(const FeaturePtr &theEntity) { + const std::set &aRefs = theEntity->data()->refsToMe(); std::set::const_iterator aRefIt = aRefs.begin(); for (; aRefIt != aRefs.end(); ++aRefIt) { - CompositeFeaturePtr anOwner = std::dynamic_pointer_cast( - ModelAPI_Feature::feature((*aRefIt)->owner())); + CompositeFeaturePtr anOwner = + std::dynamic_pointer_cast( + ModelAPI_Feature::feature((*aRefIt)->owner())); if (anOwner) return name(anOwner); } @@ -678,64 +664,68 @@ const std::string& ModelHighAPI_Dumper::parentName(const FeaturePtr& theEntity) return DUMMY; } -void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature) -{ +void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr &theFeature) { // Default name of the feature bool isFeatureDefaultName = myNames[theFeature].myIsDefault; // Save only names of results which is not correspond to default feature name std::list allRes; ModelAPI_Tools::allResults(theFeature, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - std::pair aName = ModelAPI_Tools::getDefaultName(*aRes, true, true); + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { + std::pair aName = + ModelAPI_Tools::getDefaultName(*aRes, true, true); std::string aDefaultName = Locale::Convert::toString(aName.first); std::string aResName = Locale::Convert::toString((*aRes)->data()->name()); bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName); - myNames[*aRes] = - EntityName(aResName, (isUserDefined ? aResName : std::string()), !isUserDefined); + myNames[*aRes] = EntityName( + aResName, (isUserDefined ? aResName : std::string()), !isUserDefined); } } -bool ModelHighAPI_Dumper::process(const std::shared_ptr& theDoc, - const std::string& theFileName) -{ +bool ModelHighAPI_Dumper::process( + const std::shared_ptr &theDoc, + const std::string &theFileName) { // dump top level document feature static const std::string aDocName("partSet"); myNames[theDoc] = EntityName(aDocName, std::string(), true); *this << aDocName << " = model.moduleDocument()" << std::endl; // dump subfeatures and store result to file - bool isOk = process(theDoc) && myDumpStorage->exportTo(theFileName, myModules); + bool isOk = + process(theDoc) && myDumpStorage->exportTo(theFileName, myModules); return isOk; } -bool ModelHighAPI_Dumper::process(const std::shared_ptr& theDoc) -{ +bool ModelHighAPI_Dumper::process( + const std::shared_ptr &theDoc) { bool isOk = true; std::list anObjects = theDoc->allObjects(); std::list::const_iterator anObjIt = anObjects.begin(); // firstly, dump all parameters - for (; anObjIt != anObjects.end(); ++ anObjIt) { + for (; anObjIt != anObjects.end(); ++anObjIt) { FeaturePtr aFeature = std::dynamic_pointer_cast(*anObjIt); if (aFeature) dumpParameter(aFeature); } // dump all other features for (anObjIt = anObjects.begin(); anObjIt != anObjects.end(); ++anObjIt) { - CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast(*anObjIt); + CompositeFeaturePtr aCompFeat = + std::dynamic_pointer_cast(*anObjIt); if (aCompFeat) { // iteratively process composite features, - // if the composite feature is the last in the document, no need to dump "model.do()" action + // if the composite feature is the last in the document, no need to dump + // "model.do()" action std::list::const_iterator aNext = anObjIt; isOk = process(aCompFeat, false, ++aNext != anObjects.end()) && isOk; - } - else if (!isDumped(EntityPtr(*anObjIt))) { + } else if (!isDumped(EntityPtr(*anObjIt))) { // dump folder FolderPtr aFolder = std::dynamic_pointer_cast(*anObjIt); if (aFolder) dumpFolder(aFolder); else { - FeaturePtr aFeature = std::dynamic_pointer_cast(*anObjIt); + FeaturePtr aFeature = + std::dynamic_pointer_cast(*anObjIt); if (aFeature) // dump common feature dumpFeature(aFeature); } @@ -746,9 +736,9 @@ bool ModelHighAPI_Dumper::process(const std::shared_ptr& theD return isOk; } -bool ModelHighAPI_Dumper::process(const std::shared_ptr& theComposite, - bool isForce, bool isDumpModelDo) -{ +bool ModelHighAPI_Dumper::process( + const std::shared_ptr &theComposite, + bool isForce, bool isDumpModelDo) { // increase composite features stack ++gCompositeStackDepth; // dump composite itself @@ -764,15 +754,15 @@ bool ModelHighAPI_Dumper::process(const std::shared_ptr(theComposite->lastResult()); + ResultPartPtr aPartResult = std::dynamic_pointer_cast( + theComposite->lastResult()); if (!aPartResult) return false; DocumentPtr aSubDoc = aPartResult->partDoc(); if (!aSubDoc) return false; // set name of document - const std::string& aPartName = myNames[theComposite].myCurrentName; + const std::string &aPartName = myNames[theComposite].myCurrentName; std::string aDocName = aPartName + "_doc"; myNames[aSubDoc] = EntityName(aDocName, std::string(), true); @@ -795,9 +785,8 @@ bool ModelHighAPI_Dumper::process(const std::shared_ptr& theComposite, - bool theDumpModelDo) -{ + const std::shared_ptr &theComposite, + bool theDumpModelDo) { bool isOk = true; // dump all sub-features; bool isSubDumped = false; @@ -808,21 +797,24 @@ bool ModelHighAPI_Dumper::processSubs( continue; isSubDumped = true; - CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast(aFeature); + CompositeFeaturePtr aCompFeat = + std::dynamic_pointer_cast(aFeature); if (aCompFeat) // iteratively process composite features isOk = process(aCompFeat) && isOk; else dumpFeature(aFeature, true); } - bool isDumpSetName = !myEntitiesStack.empty() && + bool isDumpSetName = + !myEntitiesStack.empty() && myEntitiesStack.top().myEntity == EntityPtr(theComposite); bool isForceModelDo = isSubDumped && isDumpSetName && - (myEntitiesStack.top().myUserName || !myEntitiesStack.top().myResults.empty()); - // It is necessary for the sketch to create its result when complete (command "model.do()"). - // This option is set by flat theDumpModelDo. - // However, nested sketches are rebuilt by parent feature, so, they do not need - // explicit call of "model.do()". This will be controlled by the depth of the stack. + (myEntitiesStack.top().myUserName || + !myEntitiesStack.top().myResults.empty()); + // It is necessary for the sketch to create its result when complete (command + // "model.do()"). This option is set by flat theDumpModelDo. However, nested + // sketches are rebuilt by parent feature, so, they do not need explicit call + // of "model.do()". This will be controlled by the depth of the stack. if (isForceModelDo || (theDumpModelDo && gCompositeStackDepth <= 1)) *this << "model.do()" << std::endl; @@ -832,15 +824,13 @@ bool ModelHighAPI_Dumper::processSubs( return isOk; } -void ModelHighAPI_Dumper::postpone(const EntityPtr& theEntity) -{ +void ModelHighAPI_Dumper::postpone(const EntityPtr &theEntity) { // keep the name name(theEntity, false); myPostponed.push_back(theEntity); } -void ModelHighAPI_Dumper::dumpPostponed(bool theDumpFolders) -{ +void ModelHighAPI_Dumper::dumpPostponed(bool theDumpFolders) { if (myDumpPostponedInProgress) return; @@ -859,8 +849,7 @@ void ModelHighAPI_Dumper::dumpPostponed(bool theDumpFolders) dumpFolder(aFolder); else myPostponed.push_back(*anIt); - } - else { + } else { FeaturePtr aFeature = std::dynamic_pointer_cast(*anIt); if (aFeature) dumpFeature(aFeature, true); @@ -869,16 +858,16 @@ void ModelHighAPI_Dumper::dumpPostponed(bool theDumpFolders) myDumpPostponedInProgress = false; } -void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor(const std::string theSubFeatureGet, - const FeaturePtr& theSubFeature) -{ +void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor( + const std::string theSubFeatureGet, const FeaturePtr &theSubFeature) { name(theSubFeature, false); myNames[theSubFeature] = - EntityName(theSubFeatureGet, Locale::Convert::toString(theSubFeature->name()), false); + EntityName(theSubFeatureGet, + Locale::Convert::toString(theSubFeature->name()), false); // store results if they have user-defined names or colors std::list aResultsWithNameOrColor; - const std::list& aResults = theSubFeature->results(); + const std::list &aResults = theSubFeature->results(); std::list::const_iterator aResIt = aResults.begin(); for (; aResIt != aResults.end(); ++aResIt) { std::string aResName = Locale::Convert::toString((*aResIt)->data()->name()); @@ -887,24 +876,23 @@ void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor(const std::string theSubFea } // store just dumped entity to stack - myEntitiesStack.push(LastDumpedEntity(theSubFeature, true, aResultsWithNameOrColor)); + myEntitiesStack.push( + LastDumpedEntity(theSubFeature, true, aResultsWithNameOrColor)); dumpEntitySetName(); } -void ModelHighAPI_Dumper::importModule(const std::string& theModuleName) -{ +void ModelHighAPI_Dumper::importModule(const std::string &theModuleName) { myModules.insert(theModuleName); } -void ModelHighAPI_Dumper::dumpEntitySetName() -{ - const LastDumpedEntity& aLastDumped = myEntitiesStack.top(); +void ModelHighAPI_Dumper::dumpEntitySetName() { + const LastDumpedEntity &aLastDumped = myEntitiesStack.top(); bool isBufferEmpty = myDumpStorage->isBufferEmpty(); // dump "setName" for the entity if (aLastDumped.myUserName) { - EntityName& anEntityNames = myNames[aLastDumped.myEntity]; + EntityName &anEntityNames = myNames[aLastDumped.myEntity]; if (!anEntityNames.myIsDefault) *myDumpStorage << anEntityNames.myCurrentName << ".setName(\"" << anEntityNames.myUserName << "\")\n"; @@ -917,7 +905,7 @@ void ModelHighAPI_Dumper::dumpEntitySetName() std::list::const_iterator aResEnd = aLastDumped.myResults.end(); for (; aResIt != aResEnd; ++aResIt) { // set result name - EntityName& anEntityNames = myNames[*aResIt]; + EntityName &anEntityNames = myNames[*aResIt]; if (!anEntityNames.myIsDefault) { *this << *aResIt; *myDumpStorage << ".setName(\"" << anEntityNames.myUserName << "\")\n"; @@ -927,29 +915,32 @@ void ModelHighAPI_Dumper::dumpEntitySetName() } // set result color if (!isDefaultColor(*aResIt)) { - AttributeIntArrayPtr aColor = (*aResIt)->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aColor = + (*aResIt)->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColor && aColor->isInitialized()) { *this << *aResIt; - *myDumpStorage << ".setColor(" << aColor->value(0) << ", " << aColor->value(1) - << ", " << aColor->value(2) << ")\n"; + *myDumpStorage << ".setColor(" << aColor->value(0) << ", " + << aColor->value(1) << ", " << aColor->value(2) << ")\n"; } } // set result deflection if (!isDefaultDeflection(*aResIt)) { AttributeDoublePtr aDeflectionAttr = - (*aResIt)->data()->real(ModelAPI_Result::DEFLECTION_ID()); - if(aDeflectionAttr.get() && aDeflectionAttr->isInitialized()) { + (*aResIt)->data()->real(ModelAPI_Result::DEFLECTION_ID()); + if (aDeflectionAttr.get() && aDeflectionAttr->isInitialized()) { *this << *aResIt; - *myDumpStorage << ".setDeflection(" << aDeflectionAttr->value() << ")\n"; + *myDumpStorage << ".setDeflection(" << aDeflectionAttr->value() + << ")\n"; } } // set result transparency if (!isDefaultTransparency(*aResIt)) { AttributeDoublePtr aTransparencyAttr = - (*aResIt)->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); - if(aTransparencyAttr.get() && aTransparencyAttr->isInitialized()) { + (*aResIt)->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + if (aTransparencyAttr.get() && aTransparencyAttr->isInitialized()) { *this << *aResIt; - *myDumpStorage << ".setTransparency(" << aTransparencyAttr->value() << ")\n"; + *myDumpStorage << ".setTransparency(" << aTransparencyAttr->value() + << ")\n"; } } } @@ -962,16 +953,15 @@ void ModelHighAPI_Dumper::dumpEntitySetName() myDumpStorage->mergeBuffer(); } -bool ModelHighAPI_Dumper::isDumped(const EntityPtr& theEntity) const -{ +bool ModelHighAPI_Dumper::isDumped(const EntityPtr &theEntity) const { EntityNameMap::const_iterator aFound = myNames.find(theEntity); FeaturePtr aFeature = std::dynamic_pointer_cast(theEntity); return (aFound != myNames.end() && aFound->second.myIsDumped) || myFeaturesToSkip.find(aFeature) != myFeaturesToSkip.end(); } -bool ModelHighAPI_Dumper::isDumped(const AttributeRefAttrPtr& theRefAttr) const -{ +bool ModelHighAPI_Dumper::isDumped( + const AttributeRefAttrPtr &theRefAttr) const { FeaturePtr aFeature; if (theRefAttr->isObject()) aFeature = ModelAPI_Feature::feature(theRefAttr->object()); @@ -980,8 +970,8 @@ bool ModelHighAPI_Dumper::isDumped(const AttributeRefAttrPtr& theRefAttr) const return aFeature && isDumped(EntityPtr(aFeature)); } -bool ModelHighAPI_Dumper::isDumped(const AttributeRefListPtr& theRefList) const -{ +bool ModelHighAPI_Dumper::isDumped( + const AttributeRefListPtr &theRefList) const { std::list aRefs = theRefList->list(); std::list::iterator anIt = aRefs.begin(); for (; anIt != aRefs.end(); ++anIt) { @@ -993,8 +983,7 @@ bool ModelHighAPI_Dumper::isDumped(const AttributeRefListPtr& theRefList) const } size_t ModelHighAPI_Dumper::indexOfFirstNotDumped( - const std::shared_ptr& theRefList) const -{ + const std::shared_ptr &theRefList) const { size_t anIndex = 0; std::list anObjects = theRefList->list(); for (std::list::const_iterator anIt = anObjects.begin(); @@ -1004,16 +993,15 @@ size_t ModelHighAPI_Dumper::indexOfFirstNotDumped( return anIndex; } -static bool isSketchSub(const FeaturePtr& theFeature) -{ +static bool isSketchSub(const FeaturePtr &theFeature) { static const std::string SKETCH("Sketch"); CompositeFeaturePtr anOwner = ModelAPI_Tools::compositeOwner(theFeature); return anOwner && anOwner->getKind() == SKETCH; } -bool ModelHighAPI_Dumper::isDefaultColor(const ResultPtr& theResult) const -{ - AttributeIntArrayPtr aColor = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); +bool ModelHighAPI_Dumper::isDefaultColor(const ResultPtr &theResult) const { + AttributeIntArrayPtr aColor = + theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (!aColor || !aColor->isInitialized()) return true; @@ -1031,15 +1019,17 @@ bool ModelHighAPI_Dumper::isDefaultColor(const ResultPtr& theResult) const // dump current color std::ostringstream aColorInfo; - aColorInfo << aColor->value(0) << "," << aColor->value(1) << "," << aColor->value(2); + aColorInfo << aColor->value(0) << "," << aColor->value(1) << "," + << aColor->value(2); return aDefault == aColorInfo.str(); } -bool ModelHighAPI_Dumper::isDefaultDeflection(const ResultPtr& theResult) const -{ - AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); - if(!aDeflectionAttr || !aDeflectionAttr->isInitialized()) { +bool ModelHighAPI_Dumper::isDefaultDeflection( + const ResultPtr &theResult) const { + AttributeDoublePtr aDeflectionAttr = + theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); + if (!aDeflectionAttr || !aDeflectionAttr->isInitialized()) { return true; } @@ -1053,134 +1043,125 @@ bool ModelHighAPI_Dumper::isDefaultDeflection(const ResultPtr& theResult) const else if (aResultGroup == ModelAPI_ResultBody::group()) { GeomShapePtr aGeomShape = theResult->shape(); if (aGeomShape.get()) { - // if the shape could not be exploded on faces, it contains only wires, edges, and vertices - // correction of deviation for them should not influence to the application performance + // if the shape could not be exploded on faces, it contains only wires, + // edges, and vertices correction of deviation for them should not + // influence to the application performance GeomAPI_ShapeExplorer anExp(aGeomShape, GeomAPI_Shape::FACE); isConstruction = !anExp.more(); } } if (isConstruction) - aDefault = Config_PropManager::real("Visualization", "construction_deflection"); + aDefault = + Config_PropManager::real("Visualization", "construction_deflection"); else aDefault = Config_PropManager::real("Visualization", "body_deflection"); return fabs(aCurrent - aDefault) < 1.e-12; } -bool ModelHighAPI_Dumper::isDefaultTransparency(const ResultPtr& theResult) const -{ - AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); - if(!anAttribute || !anAttribute->isInitialized()) { +bool ModelHighAPI_Dumper::isDefaultTransparency( + const ResultPtr &theResult) const { + AttributeDoublePtr anAttribute = + theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + if (!anAttribute || !anAttribute->isInitialized()) { return true; } return fabs(anAttribute->value()) < 1.e-12; } -bool ModelHighAPI_Dumper::dumpCommentBeforeFeature(const FeaturePtr& theFeature) const -{ +bool ModelHighAPI_Dumper::dumpCommentBeforeFeature( + const FeaturePtr &theFeature) const { // currently, the comment should not be dumped only before the filters - FiltersFeaturePtr aFilters = std::dynamic_pointer_cast(theFeature); + FiltersFeaturePtr aFilters = + std::dynamic_pointer_cast(theFeature); if (aFilters) return false; // all other features should be commented before the dump return !isDumped(theFeature); } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const char theChar) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<(const char theChar) { *myDumpStorage << theChar; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const char* theString) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<(const char *theString) { *myDumpStorage << theString; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::string& theString) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const std::string &theString) { *myDumpStorage << theString; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::wstring& theString) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const std::wstring &theString) { *myDumpStorage << Locale::Convert::toString(theString); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const bool theValue) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<(const bool theValue) { *myDumpStorage << (theValue ? "True" : "False"); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const int theValue) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<(const int theValue) { *myDumpStorage << theValue; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const double theValue) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<(const double theValue) { *myDumpStorage << theValue; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::shared_ptr& thePoint) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const std::shared_ptr &thePoint) { importModule("GeomAPI"); - *myDumpStorage << "GeomAPI_Pnt(" << thePoint->x() << ", " - << thePoint->y() << ", " << thePoint->z() << ")"; + *myDumpStorage << "GeomAPI_Pnt(" << thePoint->x() << ", " << thePoint->y() + << ", " << thePoint->z() << ")"; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::shared_ptr& theDir) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const std::shared_ptr &theDir) { importModule("GeomAPI"); - *myDumpStorage << "GeomAPI_Dir(" << theDir->x() << ", " - << theDir->y() << ", " << theDir->z() << ")"; + *myDumpStorage << "GeomAPI_Dir(" << theDir->x() << ", " << theDir->y() << ", " + << theDir->z() << ")"; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theDir) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theDir) { *myDumpStorage << theDir->x() << ", " << theDir->y() << ", " << theDir->z(); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& thePoint) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &thePoint) { static const int aSize = 3; double aValues[aSize] = {thePoint->x(), thePoint->y(), thePoint->z()}; - std::string aTexts[aSize] = { - Locale::Convert::toString(thePoint->textX()), - Locale::Convert::toString(thePoint->textY()), - Locale::Convert::toString(thePoint->textZ()) - }; + std::string aTexts[aSize] = {Locale::Convert::toString(thePoint->textX()), + Locale::Convert::toString(thePoint->textY()), + Locale::Convert::toString(thePoint->textZ())}; myDumpStorage->dumpArray(aSize, aValues, aTexts); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& thePoint) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &thePoint) { static const int aSize = 2; double aValues[aSize] = {thePoint->x(), thePoint->y()}; - std::string aTexts[aSize] = { - Locale::Convert::toString(thePoint->textX()), - Locale::Convert::toString(thePoint->textY()) - }; + std::string aTexts[aSize] = {Locale::Convert::toString(thePoint->textX()), + Locale::Convert::toString(thePoint->textY())}; myDumpStorage->dumpArray(aSize, aValues, aTexts); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& thePointArray) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &thePointArray) { static const int aThreshold = 4; static bool aDumpAsIs = false; static std::string aSeparator = ""; @@ -1193,11 +1174,11 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( *myDumpStorage << "(" << aPoint->x() << ", " << aPoint->y() << ")"; for (int anIndex = 1; anIndex < aSize; ++anIndex) { aPoint = thePointArray->pnt(anIndex); - *myDumpStorage << "," << aSeparator << " (" << aPoint->x() << ", " << aPoint->y() << ")"; + *myDumpStorage << "," << aSeparator << " (" << aPoint->x() << ", " + << aPoint->y() << ")"; } *myDumpStorage << aSeparator << "]"; - } - else { + } else { // name of list FeaturePtr anOwner = ModelAPI_Feature::feature(thePointArray->owner()); std::string aListName = name(anOwner) + "_" + thePointArray->id(); @@ -1215,16 +1196,14 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theAttrBool) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theAttrBool) { *myDumpStorage << (theAttrBool->value() ? "True" : "False"); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theAttrInt) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theAttrInt) { std::string aText = Locale::Convert::toString(theAttrInt->text()); if (aText.empty()) *myDumpStorage << theAttrInt->value(); @@ -1233,9 +1212,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theArray) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theArray) { *myDumpStorage << "["; int aSize = theArray->size(); if (aSize > 0) { @@ -1247,9 +1225,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theAttrReal) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theAttrReal) { std::string aText = Locale::Convert::toString(theAttrReal->text()); if (aText.empty()) *myDumpStorage << theAttrReal->value(); @@ -1258,9 +1235,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theArray) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theArray) { *myDumpStorage << "["; int aSize = theArray->size(); if (aSize > 0) { @@ -1272,9 +1248,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theAttrStr) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theAttrStr) { // escaping the quote signs in the string under dumping std::string aStr = theAttrStr->value(); /* @@ -1298,20 +1273,21 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const FolderPtr& theFolder) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const FolderPtr &theFolder) { *myDumpStorage << name(theFolder); // add dumped folder to a stack if (!myNames[theFolder].myIsDumped && - (myEntitiesStack.empty() || myEntitiesStack.top().myEntity != theFolder)) - myEntitiesStack.push(LastDumpedEntity(theFolder, !myNames[theFolder].myIsDefault)); + (myEntitiesStack.empty() || myEntitiesStack.top().myEntity != theFolder)) + myEntitiesStack.push( + LastDumpedEntity(theFolder, !myNames[theFolder].myIsDefault)); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const FeaturePtr& theEntity) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const FeaturePtr &theEntity) { *myDumpStorage << name(theEntity); if (!myNames[theEntity].myIsDumped) { @@ -1320,15 +1296,16 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const FeaturePtr& theEntity std::list aResultsWithNameOrColor; std::list allRes; ModelAPI_Tools::allResults(theEntity, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - if(!myNames[*aRes].myIsDefault || !isDefaultColor(*aRes) || - !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes)) + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { + if (!myNames[*aRes].myIsDefault || !isDefaultColor(*aRes) || + !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes)) aResultsWithNameOrColor.push_back(*aRes); } // store just dumped entity to stack if (myEntitiesStack.empty() || myEntitiesStack.top().myEntity != theEntity) - myEntitiesStack.push( - LastDumpedEntity(theEntity, isUserDefinedName, aResultsWithNameOrColor)); + myEntitiesStack.push(LastDumpedEntity(theEntity, isUserDefinedName, + aResultsWithNameOrColor)); } // remove entity from the list of not dumped items @@ -1336,19 +1313,21 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const FeaturePtr& theEntity return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ResultPtr& theResult) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const ResultPtr &theResult) { // iterate in the structure of sub-results to the parent ResultPtr aCurRes = theResult; FeaturePtr aFeature = ModelAPI_Feature::feature(theResult); - std::list anIndices; // indexes of results in the parent result, starting from topmost - while(aCurRes.get()) { + std::list anIndices; // indexes of results in the parent result, starting + // from topmost + while (aCurRes.get()) { ResultBodyPtr aParent = ModelAPI_Tools::bodyOwner(aCurRes); if (aParent) { anIndices.push_front(ModelAPI_Tools::bodyIndex(aCurRes)); } else { // index of the result in the feature std::list::const_iterator aRes = aFeature->results().cbegin(); - for(int anIndex = 0; aRes != aFeature->results().cend(); aRes++, anIndex++) { + for (int anIndex = 0; aRes != aFeature->results().cend(); + aRes++, anIndex++) { if (*aRes == aCurRes) { anIndices.push_front(anIndex); break; @@ -1359,12 +1338,12 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ResultPtr& theResult) } *myDumpStorage << name(aFeature); - for (std::list::iterator anI = anIndices.begin(); anI != anIndices.end(); anI++) { + for (std::list::iterator anI = anIndices.begin(); anI != anIndices.end(); + anI++) { if (anI == anIndices.begin()) { - if(*anI == 0) { + if (*anI == 0) { *myDumpStorage << ".result()"; - } - else { + } else { *myDumpStorage << ".results()[" << *anI << "]"; } } else { @@ -1375,8 +1354,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ResultPtr& theResult) return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::list& theResults) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const std::list &theResults) { *this << "["; for (std::list::const_iterator anIt = theResults.begin(); anIt != theResults.end(); ++anIt) { @@ -1388,16 +1367,16 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::list& return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ObjectPtr& theObject) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const ObjectPtr &theObject) { FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); - if(aFeature.get()) { + if (aFeature.get()) { *myDumpStorage << name(aFeature); return *this; } ResultPtr aResult = std::dynamic_pointer_cast(theObject); - if(aResult.get()) { + if (aResult.get()) { *this << aResult; return *this; } @@ -1405,13 +1384,14 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ObjectPtr& theObject) return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const AttributePtr& theAttr) -{ +ModelHighAPI_Dumper & +ModelHighAPI_Dumper::operator<<(const AttributePtr &theAttr) { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttr->owner()); std::string aWrapperPrefix, aWrapperSuffix; - // Check the attribute belongs to copied (in multi-translation or multi-rotation) feature. - // In this case we need to cast explicitly feature to appropriate type. + // Check the attribute belongs to copied (in multi-translation or + // multi-rotation) feature. In this case we need to cast explicitly feature to + // appropriate type. AttributeBooleanPtr isCopy = anOwner->boolean("Copy"); AttributeReferencePtr hasParent = anOwner->reference("ParentFeature"); if ((isCopy.get() && isCopy->value()) || (hasParent && hasParent->value())) { @@ -1420,14 +1400,13 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const AttributePtr& theAttr importModule("SketchAPI"); } - *myDumpStorage << aWrapperPrefix << name(anOwner) << aWrapperSuffix - << "." << attributeGetter(anOwner, theAttr->id()) << "()"; + *myDumpStorage << aWrapperPrefix << name(anOwner) << aWrapperSuffix << "." + << attributeGetter(anOwner, theAttr->id()) << "()"; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theRefAttr) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theRefAttr) { if (theRefAttr->isObject()) *this << theRefAttr->object(); else @@ -1435,13 +1414,13 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theRefAttrList) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theRefAttrList) { *myDumpStorage << "["; - std::list > aList = theRefAttrList->list(); + std::list> aList = theRefAttrList->list(); bool isAdded = false; - std::list >::const_iterator anIt = aList.begin(); + std::list>::const_iterator anIt = + aList.begin(); for (; anIt != aList.end(); ++anIt) { if (isAdded) *myDumpStorage << ", "; @@ -1450,22 +1429,20 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( if (anIt->first) *this << anIt->first; else if (anIt->second) - * this << anIt->second; + *this << anIt->second; } *myDumpStorage << "]"; return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theReference) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theReference) { *this << theReference->value(); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theRefList) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theRefList) { static const int aThreshold = 2; static bool aDumpAsIs = false; // if number of elements in the list if greater than a threshold, @@ -1479,7 +1456,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( if (!(*anIt)) continue; if (!isDumped(ModelAPI_Feature::feature(*anIt))) - break; // stop if the object is not dumped yet (parent feature should be postponed) + break; // stop if the object is not dumped yet (parent feature should be + // postponed) if (isAdded) *myDumpStorage << ", "; @@ -1505,16 +1483,14 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theAttrSelect) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theAttrSelect) { myDumpStorage->write(theAttrSelect); return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theAttrSelList) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theAttrSelList) { static const int aThreshold = 2; static int aNbSpaces = 0; // if number of elements in the list if greater than a threshold, @@ -1527,20 +1503,20 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( bool isAdded = false; - for(int anIndex = 0; anIndex < theAttrSelList->size(); ++anIndex) { + for (int anIndex = 0; anIndex < theAttrSelList->size(); ++anIndex) { AttributeSelectionPtr anAttribute = theAttrSelList->value(anIndex); aShape = anAttribute->value(); - if(!aShape.get()) { + if (!aShape.get()) { ResultPtr aContext = anAttribute->context(); if (aContext.get()) aShape = aContext->shape(); } - if(!aShape.get()) { + if (!aShape.get()) { continue; } - if(isAdded) { + if (isAdded) { // print each attribute on separate line with the appropriate shift if (aNbSpaces > 0) { std::string aSpaces(aNbSpaces + 1, ' '); @@ -1590,12 +1566,11 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( - const std::shared_ptr& theArray) -{ +ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( + const std::shared_ptr &theArray) { std::ostringstream aBuffer; aBuffer << "["; - for(int anIndex = 0; anIndex < theArray->size(); ++anIndex) { + for (int anIndex = 0; anIndex < theArray->size(); ++anIndex) { if (anIndex != 0) aBuffer << ", "; @@ -1607,15 +1582,12 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( return *this; } -void ModelHighAPI_Dumper::newline() -{ - *this << std::endl; -} +void ModelHighAPI_Dumper::newline() { *this << std::endl; } /// Dump std::endl -ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper, - std::basic_ostream& (*theEndl)(std::basic_ostream&)) -{ +ModelHighAPI_Dumper & +operator<<(ModelHighAPI_Dumper &theDumper, + std::basic_ostream &(*theEndl)(std::basic_ostream &)) { *theDumper.myDumpStorage << theEndl; if (!theDumper.myEntitiesStack.empty()) { @@ -1625,12 +1597,15 @@ ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper, isCopy = false; // Name for composite feature is dumped when all sub-entities are dumped // (see method ModelHighAPI_Dumper::processSubs). - const ModelHighAPI_Dumper::LastDumpedEntity& aLastDumped = theDumper.myEntitiesStack.top(); + const ModelHighAPI_Dumper::LastDumpedEntity &aLastDumped = + theDumper.myEntitiesStack.top(); CompositeFeaturePtr aComposite = - std::dynamic_pointer_cast(aLastDumped.myEntity); + std::dynamic_pointer_cast( + aLastDumped.myEntity); if (!aComposite) { theDumper.dumpEntitySetName(); - FeaturePtr aFeature = std::dynamic_pointer_cast(aLastDumped.myEntity); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aLastDumped.myEntity); if (aFeature) { AttributeBooleanPtr aCopyAttr = aFeature->boolean("Copy"); isCopy = aCopyAttr.get() && aCopyAttr->value(); @@ -1655,13 +1630,12 @@ ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper, theDumper.dumpFeature(aFeature, true); // dump the Projection feature which produces this "Copy" entity AttributeBooleanPtr aCopyAttr = aFeature->boolean("Copy"); - if (aCopyAttr.get() && aCopyAttr->value()) - { - const std::set& aRefs = aFeature->data()->refsToMe(); + if (aCopyAttr.get() && aCopyAttr->value()) { + const std::set &aRefs = aFeature->data()->refsToMe(); std::set::iterator aRefIt = aRefs.begin(); for (; aRefIt != aRefs.end(); ++aRefIt) - if ((*aRefIt)->id() == "ProjectedFeature") - { // process projection only + if ((*aRefIt)->id() == + "ProjectedFeature") { // process projection only FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); if (anOwner && !theDumper.isDumped(EntityPtr(anOwner))) theDumper.dumpFeature(anOwner, true); @@ -1680,27 +1654,28 @@ ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper, return theDumper; } - -void ModelHighAPI_Dumper::exportVariables() const -{ +void ModelHighAPI_Dumper::exportVariables() const { DocumentPtr aRoot = ModelAPI_Session::get()->moduleDocument(); EntityNameMap::const_iterator aNameIter = myNames.cbegin(); - for(; aNameIter != myNames.end(); aNameIter++) { - FeaturePtr aFeature = std::dynamic_pointer_cast(aNameIter->first); + for (; aNameIter != myNames.end(); aNameIter++) { + FeaturePtr aFeature = + std::dynamic_pointer_cast(aNameIter->first); if (aFeature.get() && aFeature->document() != aRoot) { - FeaturePtr aPartFeat = ModelAPI_Tools::findPartFeature(aRoot, aFeature->document()); + FeaturePtr aPartFeat = + ModelAPI_Tools::findPartFeature(aRoot, aFeature->document()); if (aPartFeat.get()) { int aFeatureId = aFeature->data()->featureId(); int aPartId = aPartFeat->data()->featureId(); std::ostringstream anEntryStr; - anEntryStr<second.myCurrentName); size_t aSize = aFeature->results().size(); - if (aSize > 1) { // additional entries for features with more than one result - for(size_t a = 1; a < aSize; a++) { + if (aSize > + 1) { // additional entries for features with more than one result + for (size_t a = 1; a < aSize; a++) { std::ostringstream aResEntryStr; - aResEntryStr<second.myCurrentName); } diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.h b/src/ModelHighAPI/ModelHighAPI_Dumper.h index 86ab43b6e..8f23e0067 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.h +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModelHighAPI_Dumper_H_ @@ -61,52 +62,58 @@ class ModelAPI_Object; class ModelAPI_Result; typedef std::shared_ptr DocumentPtr; -typedef std::shared_ptr EntityPtr; -typedef std::shared_ptr FeaturePtr; -typedef std::shared_ptr FolderPtr; -typedef std::shared_ptr ResultPtr; +typedef std::shared_ptr EntityPtr; +typedef std::shared_ptr FeaturePtr; +typedef std::shared_ptr FolderPtr; +typedef std::shared_ptr ResultPtr; -typedef std::set ModulesSet; -typedef std::map > > NbFeaturesMap; +typedef std::set ModulesSet; +typedef std::map>> + NbFeaturesMap; /**\class ModelHighAPI_Dumper * \ingroup CPPHighAPI * \brief Dump engine for the model * - * The dumper can be customized by the set of storages (DumpStorage), for example to identify - * dumped selected objects by their geometrical properties. By default, the dump is executed to - * store original names of the selected shapes. + * The dumper can be customized by the set of storages (DumpStorage), for + * example to identify dumped selected objects by their geometrical properties. + * By default, the dump is executed to store original names of the selected + * shapes. */ -class ModelHighAPI_Dumper -{ +class ModelHighAPI_Dumper { public: /** \class DumpStorage * \ingroup CPPHighAPI - * \brief Storage for the dumped data. Process selection attributes to be dumped by naming. + * \brief Storage for the dumped data. Process selection attributes to be + * dumped by naming. */ - class DumpStorage - { + class DumpStorage { public: DumpStorage() {} - MODELHIGHAPI_EXPORT DumpStorage(const DumpStorage& theOther); - MODELHIGHAPI_EXPORT const DumpStorage& operator=(const DumpStorage& theOther); + MODELHIGHAPI_EXPORT DumpStorage(const DumpStorage &theOther); + MODELHIGHAPI_EXPORT const DumpStorage & + operator=(const DumpStorage &theOther); virtual ~DumpStorage() {} - void setFilenameSuffix(const std::string& theSuffix) { myFilenameSuffix = theSuffix; } + void setFilenameSuffix(const std::string &theSuffix) { + myFilenameSuffix = theSuffix; + } protected: - std::ostringstream& buffer() { return myDumpBuffer; } - std::ostringstream& fullDump() { return myFullDump; } + std::ostringstream &buffer() { return myDumpBuffer; } + std::ostringstream &fullDump() { return myFullDump; } MODELHIGHAPI_EXPORT virtual void reserveBuffer(); MODELHIGHAPI_EXPORT virtual void restoreReservedBuffer(); MODELHIGHAPI_EXPORT - virtual void write(const std::shared_ptr& theAttrSelect); + virtual void + write(const std::shared_ptr &theAttrSelect); MODELHIGHAPI_EXPORT - virtual bool exportTo(const std::string& theFilename, const ModulesSet& theUsedModules); + virtual bool exportTo(const std::string &theFilename, + const ModulesSet &theUsedModules); private: std::string myFilenameSuffix; @@ -123,22 +130,22 @@ public: * \ingroup CPPHighAPI * \brief Process selection attributes to be dumped by geometric properties. */ - class DumpStorageGeom : public DumpStorage - { + class DumpStorageGeom : public DumpStorage { protected: MODELHIGHAPI_EXPORT - virtual void write(const std::shared_ptr& theAttrSelect); + virtual void + write(const std::shared_ptr &theAttrSelect); }; /** \class DumpStorageWeak * \ingroup CPPHighAPI * \brief Process selection attributes to be dumped by weak naming. */ - class DumpStorageWeak : public DumpStorage - { + class DumpStorageWeak : public DumpStorage { protected: MODELHIGHAPI_EXPORT - virtual void write(const std::shared_ptr& theAttrSelect); + virtual void + write(const std::shared_ptr &theAttrSelect); }; public: @@ -148,11 +155,11 @@ public: /// Sets instance of a dumper MODELHIGHAPI_EXPORT - static void setInstance(ModelHighAPI_Dumper* theDumper); + static void setInstance(ModelHighAPI_Dumper *theDumper); /// Returns instance of a dumper MODELHIGHAPI_EXPORT - static ModelHighAPI_Dumper* getInstance(); + static ModelHighAPI_Dumper *getInstance(); /// Destructor MODELHIGHAPI_EXPORT @@ -160,101 +167,107 @@ public: /// Add custom storage to collect corresponding dump MODELHIGHAPI_EXPORT - void addCustomStorage(const DumpStoragePtr& theStorage); + void addCustomStorage(const DumpStoragePtr &theStorage); /// Clear custom storages list MODELHIGHAPI_EXPORT void clearCustomStorage(); /// Dump given document into the file /// \return \c true, if succeed MODELHIGHAPI_EXPORT - bool process(const std::shared_ptr& theDoc, const std::string& theFileName); + bool process(const std::shared_ptr &theDoc, + const std::string &theFileName); /// Keep path to the true dumping directory. /// It is used to store image files or any other external files /// \param theDumpDir path to the true dumping directory MODELHIGHAPI_EXPORT - void setDumpDir(const std::string& theDumpDir) { myDumpDir = theDumpDir; } + void setDumpDir(const std::string &theDumpDir) { myDumpDir = theDumpDir; } /// Return path to the true dumping directory MODELHIGHAPI_EXPORT std::string getDumpDir() const { return myDumpDir; } /// Add module to list of imported modules /// \param theModuleName name of the module to be imported MODELHIGHAPI_EXPORT - void importModule(const std::string& theModuleName); + void importModule(const std::string &theModuleName); /// Returns name of specified entity /// \param theEntity [in] named entity /// \param theSaveNotDumped [in] - /// if \c true, the entity should be stored as not dumped (will be dumped automatically) + /// if \c true, the entity should be stored as not dumped (will be dumped + /// automatically) /// \param theUseEntityName [in] - /// if \c true, the entity name should be used "as is" without changing default name + /// if \c true, the entity name should be used "as is" without changing + /// default name /// \return name of the entity MODELHIGHAPI_EXPORT - const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true, - bool theUseEntityName = false, bool theSetIsDumped = false); + const std::string &name(const EntityPtr &theEntity, + bool theSaveNotDumped = true, + bool theUseEntityName = false, + bool theSetIsDumped = false); /// Returns name of parent composite feature for specified entity MODELHIGHAPI_EXPORT - const std::string& parentName(const FeaturePtr& theFeature); + const std::string &parentName(const FeaturePtr &theFeature); /// Dump parameter feature only - virtual void dumpParameter(const FeaturePtr& theFeature) = 0; + virtual void dumpParameter(const FeaturePtr &theFeature) = 0; /// Dump given feature - virtual void dumpFeature(const FeaturePtr& theFeature, const bool theForce = false) = 0; + virtual void dumpFeature(const FeaturePtr &theFeature, + const bool theForce = false) = 0; /// Dump folder - virtual void dumpFolder(const FolderPtr& theFolder) = 0; + virtual void dumpFolder(const FolderPtr &theFolder) = 0; /// Set feature postponed until all its dependencies are not dumped. /// The name of the feature is stored anyway. MODELHIGHAPI_EXPORT - void postpone(const EntityPtr& theEntity); + void postpone(const EntityPtr &theEntity); /// Set a feature that should not be dumped anyway MODELHIGHAPI_EXPORT - void doNotDumpFeature(const FeaturePtr& theFeature) - { myFeaturesToSkip.insert(theFeature); } + void doNotDumpFeature(const FeaturePtr &theFeature) { + myFeaturesToSkip.insert(theFeature); + } /// Dump sub-feature name and color, without dumping feature creation. /// Used for features which creates sub-features in their execute method. - /// \param theSubFeatureGet [in] method for getting sub-feature (e.g. "Feature_1.subFeature(0)") - /// \param theSubFeature [in] sub-feature + /// \param theSubFeatureGet [in] method for getting sub-feature (e.g. + /// "Feature_1.subFeature(0)") \param theSubFeature [in] sub-feature MODELHIGHAPI_EXPORT void dumpSubFeatureNameAndColor(const std::string theSubFeatureGet, - const FeaturePtr& theSubFeature); + const FeaturePtr &theSubFeature); /// Return name of getter for corresponding attribute - virtual std::string attributeGetter(const FeaturePtr& theFeature, - const std::string& theAttrName) const = 0; + virtual std::string attributeGetter(const FeaturePtr &theFeature, + const std::string &theAttrName) const = 0; /// Return name of wrapper feature - virtual std::string featureWrapper(const FeaturePtr& theFeature) const = 0; + virtual std::string featureWrapper(const FeaturePtr &theFeature) const = 0; /// Dump character MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const char theChar); + ModelHighAPI_Dumper &operator<<(const char theChar); /// Dump string MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const char* theString); + ModelHighAPI_Dumper &operator<<(const char *theString); /// Dump string MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::string& theString); + ModelHighAPI_Dumper &operator<<(const std::string &theString); /// Dump wstring MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::wstring& theString); + ModelHighAPI_Dumper &operator<<(const std::wstring &theString); /// Dump boolean MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const bool theValue); + ModelHighAPI_Dumper &operator<<(const bool theValue); /// Dump integer MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const int theValue); + ModelHighAPI_Dumper &operator<<(const int theValue); /// Dump real MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const double theValue); + ModelHighAPI_Dumper &operator<<(const double theValue); /// Dump std::endl - friend - MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper, - std::basic_ostream& (*theEndl)(std::basic_ostream&)); + friend MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(ModelHighAPI_Dumper &theDumper, + std::basic_ostream &(*theEndl)(std::basic_ostream &)); /// Print std::endl from Python MODELHIGHAPI_EXPORT void newline(); @@ -262,155 +275,173 @@ public: /// Dump GeomAPI_Pnt in the following form: /// "GeomAPI_Pnt(X, Y, Z)" MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& thePoint); + ModelHighAPI_Dumper &operator<<(const std::shared_ptr &thePoint); /// Dump GeomAPI_Dir /// "GeomAPI_Dir(X, Y, Z)" MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theDir); + ModelHighAPI_Dumper &operator<<(const std::shared_ptr &theDir); /// Dump GeomDataAPI_Dir in the following form: /// "X, Y, Z" MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theDir); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theDir); /// Dump GeomDataAPI_Point in the following form: /// "X, Y, Z" MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& thePoint); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &thePoint); /// Dump GeomDataAPI_Point2D in the following form: /// "X, Y" MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& thePoint); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &thePoint); /// Dump GeomDataAPI_Point2DArray as a list of 2D points MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& thePointArray); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &thePointArray); /// Dump AttributeBoolean MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theAttrBool); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theAttrBool); /// Dump AttributeInteger MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theAttrInt); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theAttrInt); /// Dump AttributeIntArray MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theArray); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theArray); /// Dump AttributeDouble MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theAttrReal); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theAttrReal); /// Dump AttributeDoubleArray MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theArray); + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theArray); /// Dump AttributeString MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::shared_ptr& theAttrStr); - /// Dump name of entity and remember to dump "setName" if the entity has user-defined name + ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theAttrStr); + /// Dump name of entity and remember to dump "setName" if the entity has + /// user-defined name MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const FeaturePtr& theEntity); + ModelHighAPI_Dumper &operator<<(const FeaturePtr &theEntity); /// Dump folder MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const FolderPtr& theFolder); + ModelHighAPI_Dumper &operator<<(const FolderPtr &theFolder); /// Dump result MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const ResultPtr& theResult); + ModelHighAPI_Dumper &operator<<(const ResultPtr &theResult); /// Dump a list of results MODELHIGHAPI_EXPORT - ModelHighAPI_Dumper& operator<<(const std::list& theResults); + ModelHighAPI_Dumper &operator<<(const std::list &theResults); /// Dump Attribute - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theAttr); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theAttr); /// Dump Object - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theObject); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theObject); /// Dump AttributeRefAttr - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theRefAttr); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theRefAttr); /// Dump AttributeRefAttrList as follows: /// "[obj1, obj2, obj3, ...]" - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theRefAttrList); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper &operator<<( + const std::shared_ptr &theRefAttrList); /// Dump AttributeRefList as follows: /// "[obj1, obj2, obj3, ...]" - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theRefList); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theRefList); /// Dump AttributeSelection - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theAttrSelect); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theAttrSelect); /// Dump AttributeSelectionList - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theAttrSelList); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper &operator<<( + const std::shared_ptr &theAttrSelList); /// Dump AttributeReference - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theReference); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theReference); /// Dump AttributeStringArray - MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& - operator<<(const std::shared_ptr& theArray); + MODELHIGHAPI_EXPORT ModelHighAPI_Dumper & + operator<<(const std::shared_ptr &theArray); /// clear list of not dumped entities MODELHIGHAPI_EXPORT void clearNotDumped(); /// Check the entity is already dumped MODELHIGHAPI_EXPORT - bool isDumped(const EntityPtr& theEntity) const; + bool isDumped(const EntityPtr &theEntity) const; /// Check theRefAttr is already dumped MODELHIGHAPI_EXPORT - bool isDumped(const std::shared_ptr& theRefAttr) const; + bool + isDumped(const std::shared_ptr &theRefAttr) const; /// Check all objects in theRefList are already dumped MODELHIGHAPI_EXPORT - bool isDumped(const std::shared_ptr& theRefList) const; + bool + isDumped(const std::shared_ptr &theRefList) const; /// Returns the index of the first object in the list which is not dumped yet. MODELHIGHAPI_EXPORT - size_t indexOfFirstNotDumped(const std::shared_ptr& theRefList) const; + size_t indexOfFirstNotDumped( + const std::shared_ptr &theRefList) const; - /// Export variables names to another module (calls exportVariable implemented in python) + /// Export variables names to another module (calls exportVariable implemented + /// in python) MODELHIGHAPI_EXPORT virtual void exportVariables() const; /// Export one variable name to another module (implemented in python) - MODELHIGHAPI_EXPORT virtual void exportVariable(const std::string& /*theEntry*/, - const std::string& /*theVarName*/) const {} + MODELHIGHAPI_EXPORT virtual void + exportVariable(const std::string & /*theEntry*/, + const std::string & /*theVarName*/) const {} /// Returns \c true if the special comment line to improve the readability /// should be printed before the feature of the given kind. - MODELHIGHAPI_EXPORT bool dumpCommentBeforeFeature(const FeaturePtr& theFeature) const; + MODELHIGHAPI_EXPORT bool + dumpCommentBeforeFeature(const FeaturePtr &theFeature) const; protected: /// Dump "setName" command if last entity had user-defined name MODELHIGHAPI_EXPORT void dumpEntitySetName(); private: - ModelHighAPI_Dumper(const ModelHighAPI_Dumper&); - const ModelHighAPI_Dumper& operator=(const ModelHighAPI_Dumper&); + ModelHighAPI_Dumper(const ModelHighAPI_Dumper &); + const ModelHighAPI_Dumper &operator=(const ModelHighAPI_Dumper &); /// Iterate all features in document and dump them into intermediate buffer - bool process(const std::shared_ptr& theDoc); + bool process(const std::shared_ptr &theDoc); /// Dump composite feature and all it sub-features - bool process(const std::shared_ptr& theComposite, - bool isForce = false, - bool isDumpModelDo = true); + bool process(const std::shared_ptr &theComposite, + bool isForce = false, bool isDumpModelDo = true); - /// Iterate all features in composite feature and dump them into intermediate buffer - /// \param theComposite [in] parent composite feature - /// \param theDumpModelDo [in] shows that command "model.do()" should be written at the end + /// Iterate all features in composite feature and dump them into intermediate + /// buffer \param theComposite [in] parent composite feature \param + /// theDumpModelDo [in] shows that command "model.do()" should be written at + /// the end MODELHIGHAPI_EXPORT - bool processSubs(const std::shared_ptr& theComposite, - bool theDumpModelDo = false); + bool + processSubs(const std::shared_ptr &theComposite, + bool theDumpModelDo = false); /// Stores names of results for the given feature - void saveResultNames(const FeaturePtr& theFeature); + void saveResultNames(const FeaturePtr &theFeature); /// Check the result feature has default color - bool isDefaultColor(const ResultPtr& theResult) const; + bool isDefaultColor(const ResultPtr &theResult) const; /// Check the result feature has default deflection - bool isDefaultDeflection(const ResultPtr& theResult) const; + bool isDefaultDeflection(const ResultPtr &theResult) const; /// Check the result feature has default transparency - bool isDefaultTransparency(const ResultPtr& theResult) const; + bool isDefaultTransparency(const ResultPtr &theResult) const; /// Dump postponed entities void dumpPostponed(bool theDumpFolders = false); @@ -419,49 +450,49 @@ private: struct EntityName { std::string myCurrentName; ///< default name of current feature std::string myUserName; ///< user-defined name - bool myIsDefault; ///< \c true if the name is default - bool myIsDumped; ///< shows that the names of the feature are already stored + bool myIsDefault; ///< \c true if the name is default + bool myIsDumped; ///< shows that the names of the feature are already stored EntityName() {} - EntityName(const std::string& theCurName, const std::string& theUserName, bool theDefault) - : myCurrentName(theCurName), - myUserName(theUserName), - myIsDefault(theDefault), - myIsDumped(false) - {} + EntityName(const std::string &theCurName, const std::string &theUserName, + bool theDefault) + : myCurrentName(theCurName), myUserName(theUserName), + myIsDefault(theDefault), myIsDumped(false) {} }; typedef std::map EntityNameMap; struct LastDumpedEntity { - EntityPtr myEntity; ///< last dumped entity - bool myUserName; ///< the entity hase user-defined name + EntityPtr myEntity; ///< last dumped entity + bool myUserName; ///< the entity hase user-defined name /// results of this entity, which has user-defined names or specific colors std::list myResults; - LastDumpedEntity(EntityPtr theEntity, bool theUserName, - const std::list& theResults = std::list()) - : myEntity(theEntity), myUserName(theUserName), myResults(theResults) - {} + LastDumpedEntity( + EntityPtr theEntity, bool theUserName, + const std::list &theResults = std::list()) + : myEntity(theEntity), myUserName(theUserName), myResults(theResults) {} }; typedef std::stack DumpStack; - static ModelHighAPI_Dumper* mySelf; + static ModelHighAPI_Dumper *mySelf; class DumpStorageBuffer; - DumpStorageBuffer* myDumpStorage; ///< storage of dumped data + DumpStorageBuffer *myDumpStorage; ///< storage of dumped data - ModulesSet myModules; ///< modules and entities to be imported - EntityNameMap myNames; ///< names of the entities - DumpStack myEntitiesStack; ///< stack of dumped entities + ModulesSet myModules; ///< modules and entities to be imported + EntityNameMap myNames; ///< names of the entities + DumpStack myEntitiesStack; ///< stack of dumped entities - NbFeaturesMap myFeatureCount; ///< number of features of each kind + NbFeaturesMap myFeatureCount; ///< number of features of each kind - /// features which should not be dumped (like coincidence and tangency created by tangent arc) + /// features which should not be dumped (like coincidence and tangency created + /// by tangent arc) std::set myFeaturesToSkip; - std::list myPostponed; ///< list of postponed entities (sketch constraints or folders) - bool myDumpPostponedInProgress; ///< processing postponed is in progress + std::list myPostponed; ///< list of postponed entities (sketch + ///< constraints or folders) + bool myDumpPostponedInProgress; ///< processing postponed is in progress std::string myDumpDir; diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index 3804f7087..2fe2acecf 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -14,45 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include -#include #include #include #include +#include #include #include #include #include -#include #include +#include #include #include #include #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 PRECISION 6 #define TOLERANCE (1.e-7) @@ -66,7 +67,7 @@ ModelHighAPI_FeatureStore::ModelHighAPI_FeatureStore(ObjectPtr theObject) { std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); std::list::iterator aRes = allResults.begin(); - for(; aRes != allResults.end(); aRes++) { + for (; aRes != allResults.end(); aRes++) { std::map aResDump; storeData((*aRes)->data(), aResDump); myRes.push_back(aResDump); @@ -78,7 +79,7 @@ std::string ModelHighAPI_FeatureStore::compare(ObjectPtr theObject) { std::string anError = compareData(theObject->data(), myAttrs); if (!anError.empty()) { return "Features '" + Locale::Convert::toString(theObject->data()->name()) + - "' differ:" + anError; + "' differ:" + anError; } FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); @@ -86,60 +87,68 @@ std::string ModelHighAPI_FeatureStore::compare(ObjectPtr theObject) { std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); std::list::iterator aRes = allResults.begin(); - std::list >::iterator aResIter = myRes.begin(); - for(; aRes != allResults.end() && aResIter != myRes.end(); aRes++, aResIter++) { + std::list>::iterator aResIter = + myRes.begin(); + for (; aRes != allResults.end() && aResIter != myRes.end(); + aRes++, aResIter++) { anError = compareData((*aRes)->data(), *aResIter); if (!anError.empty()) - return "Results of feature '" + Locale::Convert::toString(aFeature->name()) + - "' '" + Locale::Convert::toString((*aRes)->data()->name()) + - "' differ:" + anError; + return "Results of feature '" + + Locale::Convert::toString(aFeature->name()) + "' '" + + Locale::Convert::toString((*aRes)->data()->name()) + + "' differ:" + anError; } if (aRes != allResults.end()) { return "Current model has more results '" + - Locale::Convert::toString((*aRes)->data()->name()) + "'"; + Locale::Convert::toString((*aRes)->data()->name()) + "'"; } if (aResIter != myRes.end()) { - return "Original model had more results '" + (*aResIter)["__name__"] + "'"; + return "Original model had more results '" + (*aResIter)["__name__"] + + "'"; } } return ""; // ok } -void ModelHighAPI_FeatureStore::storeData(std::shared_ptr theData, - std::map& theAttrs) -{ +void ModelHighAPI_FeatureStore::storeData( + std::shared_ptr theData, + std::map &theAttrs) { // store name to keep also this information and output if needed theAttrs["__name__"] = Locale::Convert::toString(theData->name()); - std::list > allAttrs = theData->attributes(""); - std::list >::iterator anAttr = allAttrs.begin(); - for(; anAttr != allAttrs.end(); anAttr++) { + std::list> allAttrs = + theData->attributes(""); + std::list>::iterator anAttr = + allAttrs.begin(); + for (; anAttr != allAttrs.end(); anAttr++) { theAttrs[(*anAttr)->id()] = dumpAttr(*anAttr); } - ResultPtr aShapeOwner = std::dynamic_pointer_cast(theData->owner()); + ResultPtr aShapeOwner = + std::dynamic_pointer_cast(theData->owner()); if (aShapeOwner.get() && aShapeOwner->shape().get()) { std::shared_ptr aShape = aShapeOwner->shape(); theAttrs["__shape__"] = dumpShape(aShape); } } -std::string ModelHighAPI_FeatureStore::compareData(std::shared_ptr theData, - std::map& theAttrs) -{ +std::string ModelHighAPI_FeatureStore::compareData( + std::shared_ptr theData, + std::map &theAttrs) { std::map aThis; storeData(theData, aThis); std::map::iterator aThisIter = aThis.begin(); - for(; aThisIter != aThis.end(); aThisIter++) { + for (; aThisIter != aThis.end(); aThisIter++) { if (theAttrs.find(aThisIter->first) == theAttrs.end()) { return "original model had no attribute '" + aThisIter->first + "'"; } if (theAttrs[aThisIter->first] != aThisIter->second) { - return "attribute '" + aThisIter->first + "' is different (original != current) '" + - theAttrs[aThisIter->first] + "' != '" + aThisIter->second + "'"; + return "attribute '" + aThisIter->first + + "' is different (original != current) '" + + theAttrs[aThisIter->first] + "' != '" + aThisIter->second + "'"; } } // iterate back to find lack attribute in the current model std::map::iterator anOrigIter = theAttrs.begin(); - for(; anOrigIter != theAttrs.end(); anOrigIter++) { + for (; anOrigIter != theAttrs.end(); anOrigIter++) { if (aThis.find(anOrigIter->first) == aThis.end()) { return "current model had no attribute '" + anOrigIter->first + "'"; } @@ -147,9 +156,8 @@ std::string ModelHighAPI_FeatureStore::compareData(std::shared_ptr 0) theOutput << " "; @@ -158,9 +166,11 @@ static void dumpArray(std::ostringstream& theOutput, const double theArray[], } } -std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); - FeaturePtr aFeatOwner = std::dynamic_pointer_cast(theAttr->owner()); +std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr &theAttr) { + static ModelAPI_ValidatorsFactory *aFactory = + ModelAPI_Session::get()->validators(); + FeaturePtr aFeatOwner = + std::dynamic_pointer_cast(theAttr->owner()); if (aFeatOwner.get() && !aFactory->isCase(aFeatOwner, theAttr->id())) { return "__notcase__"; } @@ -168,7 +178,8 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { // do not check selection of the filter, // because there is neither parametric update nor dump support yet. - FiltersFeaturePtr aFilter = std::dynamic_pointer_cast(aFeatOwner); + FiltersFeaturePtr aFilter = + std::dynamic_pointer_cast(aFeatOwner); if (aFilter && (aType == ModelAPI_AttributeSelection::typeId() || aType == ModelAPI_AttributeSelectionList::typeId())) return "__filter_selection__"; @@ -182,38 +193,43 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { } else if (aType == ModelAPI_AttributeString::typeId()) { // special case for attribute "SolverError" if (theAttr->id() == "SolverError" && - std::dynamic_pointer_cast(theAttr->owner())->getKind() == "Sketch") + std::dynamic_pointer_cast(theAttr->owner()) + ->getKind() == "Sketch") return ""; } return "__notinitialized__"; } if (aType == ModelAPI_AttributeDocRef::typeId()) { - AttributeDocRefPtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributeDocRefPtr anAttr = + std::dynamic_pointer_cast(theAttr); DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument(); if (anAttr->value() != aDoc) { ResultPtr aRes = ModelAPI_Tools::findPartResult(aDoc, anAttr->value()); if (aRes.get()) { // Part result name (the same as saved file name) - aResult<< Locale::Convert::toString(aRes->data()->name()); + aResult << Locale::Convert::toString(aRes->data()->name()); } } else { - aResult<kind(); // PartSet + aResult << aDoc->kind(); // PartSet } } else if (aType == ModelAPI_AttributeInteger::typeId()) { - AttributeIntegerPtr anAttr = std::dynamic_pointer_cast(theAttr); - // do not dump a type of ConstraintAngle, because it can be changed due dumping + AttributeIntegerPtr anAttr = + std::dynamic_pointer_cast(theAttr); + // do not dump a type of ConstraintAngle, because it can be changed due + // dumping if (anAttr->id() == "AngleType" || anAttr->id() == "AngleTypePrevious") { return ""; } else if (anAttr->id() == "LocationType") { return "__notinitialized__"; } if (anAttr->text().empty()) - aResult<value(); + aResult << anAttr->value(); else aResult << Locale::Convert::toString(anAttr->text()); } else if (aType == ModelAPI_AttributeDouble::typeId()) { - AttributeDoublePtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributeDoublePtr anAttr = + std::dynamic_pointer_cast(theAttr); if (anAttr->id() == "ConstraintValue") { // do not dump a value of constraint if it is ConstraintAngle, // because this value depends on the angle type @@ -222,8 +238,8 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { return ""; } int aPrecision = PRECISION; - // Special case - precision for the arc angle. It is calculated with tolerance 1e-4, - // so the value has only 4 correct digits + // Special case - precision for the arc angle. It is calculated with + // tolerance 1e-4, so the value has only 4 correct digits if (anAttr->id() == "ArcAngle") aPrecision = 1; if (anAttr->text().empty()) { @@ -232,74 +248,81 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { } else aResult << Locale::Convert::toString(anAttr->text()); } else if (aType == ModelAPI_AttributeBoolean::typeId()) { - AttributeBooleanPtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributeBooleanPtr anAttr = + std::dynamic_pointer_cast(theAttr); // do not dump internal flags of ConstraintAngle - if (anAttr->id() == "AngleReversedLine1" || anAttr->id() == "AngleReversedLine2") { + if (anAttr->id() == "AngleReversedLine1" || + anAttr->id() == "AngleReversedLine2") { return ""; } - aResult<value(); + aResult << anAttr->value(); } else if (aType == ModelAPI_AttributeString::typeId()) { - AttributeStringPtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributeStringPtr anAttr = + std::dynamic_pointer_cast(theAttr); // do not dump solver DOF for sketch as it may be changed unexpectedly if (anAttr->id() == "SolverDOF") { return ""; } // do not dump file path for Image as it is changed after DumpPython - if (aFeatOwner->getKind() == "ImportImage" && - anAttr->id() == "file_path") { + if (aFeatOwner->getKind() == "ImportImage" && anAttr->id() == "file_path") { return ""; } - aResult<value(); + aResult << anAttr->value(); } else if (aType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttr = - std::dynamic_pointer_cast(theAttr); + std::dynamic_pointer_cast(theAttr); if (anAttr->value().get()) { - aResult<< Locale::Convert::toString(anAttr->value()->data()->name()); + aResult << Locale::Convert::toString(anAttr->value()->data()->name()); } else { - aResult<<"__empty__"; + aResult << "__empty__"; } } else if (aType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttr = - std::dynamic_pointer_cast(theAttr); + std::dynamic_pointer_cast(theAttr); if (anAttr->context().get()) - aResult<< Locale::Convert::toString(anAttr->namingName()); + aResult << Locale::Convert::toString(anAttr->namingName()); else - aResult<<"__notinitialized__"; + aResult << "__notinitialized__"; } else if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttr = - std::dynamic_pointer_cast(theAttr); - for(int a = 0; a < anAttr->size(); a++) { + std::dynamic_pointer_cast(theAttr); + for (int a = 0; a < anAttr->size(); a++) { if (a != 0) - aResult<<" "; - aResult<< Locale::Convert::toString(anAttr->value(a)->namingName()); + aResult << " "; + aResult << Locale::Convert::toString(anAttr->value(a)->namingName()); } } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr anAttr = - std::dynamic_pointer_cast(theAttr); - ObjectPtr anObj = anAttr->isObject() ? anAttr->object() : anAttr->attr()->owner(); + std::dynamic_pointer_cast(theAttr); + ObjectPtr anObj = + anAttr->isObject() ? anAttr->object() : anAttr->attr()->owner(); if (anObj.get()) { - aResult<< Locale::Convert::toString(anObj->data()->name()); + aResult << Locale::Convert::toString(anObj->data()->name()); if (!anAttr->isObject()) { - aResult<<" "<attr()->id(); + aResult << " " << anAttr->attr()->id(); } } else { - aResult<<"__empty__"; + aResult << "__empty__"; } } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr anAttr = std::dynamic_pointer_cast(theAttr); - // for sketch sub-features the empty values may be skipped and order is not important - bool isSketchFeatures = anAttr->id() == "Features" && - std::dynamic_pointer_cast(anAttr->owner())->getKind() == "Sketch"; + // for sketch sub-features the empty values may be skipped and order is not + // important + bool isSketchFeatures = + anAttr->id() == "Features" && + std::dynamic_pointer_cast(anAttr->owner()) + ->getKind() == "Sketch"; std::list aList = anAttr->list(); std::list aResList; // list of resulting strings - for(std::list::iterator aL = aList.begin(); aL != aList.end(); aL++) { + for (std::list::iterator aL = aList.begin(); aL != aList.end(); + aL++) { if (aL->get()) { if (isSketchFeatures) { // do not control construction features of an ellipse and other FeaturePtr aFeature = ModelAPI_Feature::feature(*aL); - //if (aFeature->getKind() == "SketchConstraintCoincidenceInternal") - // continue; // skip internal constraints + // if (aFeature->getKind() == "SketchConstraintCoincidenceInternal") + // continue; // skip internal constraints std::string aStr = aFeature->getKind().substr(0, 16); if (aStr == "SketchConstraint") continue; // no need to dump and check constraints @@ -311,123 +334,134 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { } if (isSketchFeatures) aResList.sort(); - for(std::list::iterator aR = aResList.begin(); aR != aResList.end(); aR++) { - aResult<<*aR<<" "; + for (std::list::iterator aR = aResList.begin(); + aR != aResList.end(); aR++) { + aResult << *aR << " "; } } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr anAttr = - std::dynamic_pointer_cast(theAttr); - std::list > aList = anAttr->list(); - std::list >::iterator aL = aList.begin(); - for(; aL != aList.end(); aL++) { + std::dynamic_pointer_cast(theAttr); + std::list> aList = anAttr->list(); + std::list>::iterator aL = aList.begin(); + for (; aL != aList.end(); aL++) { if (aL != aList.begin()) - aResult<<" "; + aResult << " "; ObjectPtr anObj = aL->second.get() ? aL->second->owner() : aL->first; if (anObj.get()) { - aResult<< Locale::Convert::toString(anObj->data()->name()); + aResult << Locale::Convert::toString(anObj->data()->name()); if (aL->second.get()) { - aResult<<" "<second->id(); + aResult << " " << aL->second->id(); } } else { - aResult<<"__empty__"; + aResult << "__empty__"; } } } else if (aType == ModelAPI_AttributeIntArray::typeId()) { if (theAttr->id() == "Color") { ResultConstructionPtr aResConstr = - std::dynamic_pointer_cast(theAttr->owner()); + std::dynamic_pointer_cast( + theAttr->owner()); if (aResConstr.get()) return "__notinitialized__"; } AttributeIntArrayPtr anAttr = - std::dynamic_pointer_cast(theAttr); - for(int a = 0; a < anAttr->size(); a++) - aResult<value(a)<<" "; + std::dynamic_pointer_cast(theAttr); + for (int a = 0; a < anAttr->size(); a++) + aResult << anAttr->value(a) << " "; } else if (aType == ModelAPI_AttributeDoubleArray::typeId()) { AttributeDoubleArrayPtr anAttr = - std::dynamic_pointer_cast(theAttr); - for(int a = 0; a < anAttr->size(); a++) - aResult<value(a)<<" "; + std::dynamic_pointer_cast(theAttr); + for (int a = 0; a < anAttr->size(); a++) + aResult << anAttr->value(a) << " "; } else if (aType == ModelAPI_AttributeStringArray::typeId()) { AttributeStringArrayPtr anAttr = - std::dynamic_pointer_cast(theAttr); - for(int a = 0; a < anAttr->size(); a++) - aResult<<"'"<value(a)<<"'"<<" "; + std::dynamic_pointer_cast(theAttr); + for (int a = 0; a < anAttr->size(); a++) + aResult << "'" << anAttr->value(a) << "'" + << " "; } else if (aType == ModelAPI_AttributeTables::typeId()) { AttributeTablesPtr anAttr = - std::dynamic_pointer_cast(theAttr); - aResult<tables()<<"x"<rows()<<"x"<columns()<<" "; - for(int aTab = 0; aTab < anAttr->tables(); aTab++) { - for(int aRow = 0; aRow < anAttr->rows(); aRow++) { - for( int aCol = 0; aCol < anAttr->columns(); aCol++) { - switch(anAttr->type()) { + std::dynamic_pointer_cast(theAttr); + aResult << anAttr->tables() << "x" << anAttr->rows() << "x" + << anAttr->columns() << " "; + for (int aTab = 0; aTab < anAttr->tables(); aTab++) { + for (int aRow = 0; aRow < anAttr->rows(); aRow++) { + for (int aCol = 0; aCol < anAttr->columns(); aCol++) { + switch (anAttr->type()) { case ModelAPI_AttributeTables::BOOLEAN: - aResult<value(aRow, aCol, aTab).myBool<<" "; + aResult << anAttr->value(aRow, aCol, aTab).myBool << " "; break; case ModelAPI_AttributeTables::INTEGER: - aResult<value(aRow, aCol, aTab).myInt<<" "; + aResult << anAttr->value(aRow, aCol, aTab).myInt << " "; break; case ModelAPI_AttributeTables::DOUBLE: - aResult<value(aRow, aCol, aTab).myDouble<<" "; + aResult << anAttr->value(aRow, aCol, aTab).myDouble << " "; break; case ModelAPI_AttributeTables::STRING: - aResult<<"'"<value(aRow, aCol, aTab).myStr.c_str()<<"' "; + aResult << "'" << anAttr->value(aRow, aCol, aTab).myStr.c_str() + << "' "; break; } } } } } else if (aType == GeomDataAPI_Point::typeId()) { - AttributePointPtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributePointPtr anAttr = + std::dynamic_pointer_cast(theAttr); double aValues[3] = {anAttr->x(), anAttr->y(), anAttr->z()}; dumpArray(aResult, aValues, 3); } else if (aType == GeomDataAPI_Dir::typeId()) { if (theAttr->id() == "DistanceDirection") return "__notcase__"; - AttributeDirPtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributeDirPtr anAttr = + std::dynamic_pointer_cast(theAttr); double aValues[3] = {anAttr->x(), anAttr->y(), anAttr->z()}; dumpArray(aResult, aValues, 3); } else if (aType == GeomDataAPI_Point2D::typeId()) { - // do not dump flyout point for constraints as it may be changed unexpectedly, - // also do not dump selection points controlled by GUI + // do not dump flyout point for constraints as it may be changed + // unexpectedly, also do not dump selection points controlled by GUI if (theAttr->id() == "ConstraintFlyoutValuePnt" || theAttr->id() == "SelectedPointA" || theAttr->id() == "SelectedPointB") return "__notinitialized__"; - AttributePoint2DPtr anAttr = std::dynamic_pointer_cast(theAttr); + AttributePoint2DPtr anAttr = + std::dynamic_pointer_cast(theAttr); double aValues[2] = {anAttr->x(), anAttr->y()}; dumpArray(aResult, aValues, 2); } else { - aResult<<"__unknownattribute__"; + aResult << "__unknownattribute__"; } return aResult.str(); } -std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr& theShape) { +std::string +ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr &theShape) { if (theShape->isNull()) { return "null"; } std::ostringstream aResult; // output the number of shapes of different types GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::COMPOUND; - for (; aType <= GeomAPI_Shape::VERTEX; aType = GeomAPI_Shape::ShapeType((int)aType + 1)) { + for (; aType <= GeomAPI_Shape::VERTEX; + aType = GeomAPI_Shape::ShapeType((int)aType + 1)) { GeomAPI_ShapeExplorer anExp(theShape, aType); if (anExp.more()) { std::string aTypeStr = anExp.current()->shapeTypeStr(); int aCount = 0; - for (; anExp.more(); anExp.next()) aCount++; - aResult << aTypeStr.c_str() << ": " << aCount << std::endl; + for (; anExp.more(); anExp.next()) + aCount++; + aResult << aTypeStr.c_str() << ": " << aCount << std::endl; } } // output the main characteristics double aVolume = GeomAlgoAPI_ShapeTools::volume(theShape); if (aVolume > 1.e-5) { - aResult<<"Volume: "; + aResult << "Volume: "; // volumes of too huge shapes write in the scientific format if (aVolume >= 1.e5) - aResult< 1.e-5) { @@ -439,10 +473,11 @@ std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr& aResult << std::fixed << std::setprecision(3); aResult << anArea << std::endl; } - std::shared_ptr aCenter = GeomAlgoAPI_ShapeTools::centreOfMass(theShape); - aResult<<"Center of mass: "; + std::shared_ptr aCenter = + GeomAlgoAPI_ShapeTools::centreOfMass(theShape); + aResult << "Center of mass: "; double aCenterVals[3] = {aCenter->x(), aCenter->y(), aCenter->z()}; dumpArray(aResult, aCenterVals, 3, 5); - aResult< #include -#include +#include #include +#include class ModelAPI_Object; class ModelAPI_Data; class GeomAPI_Shape; class ModelAPI_Attribute; -typedef std::shared_ptr ObjectPtr; +typedef std::shared_ptr ObjectPtr; typedef std::shared_ptr AttributePtr; /**\class ModelHighAPI_FeatureStore @@ -42,8 +43,9 @@ typedef std::shared_ptr AttributePtr; class ModelHighAPI_FeatureStore { /// dumps of attributes of the stored feature (id -> dump) std::map myAttrs; - /// dumps of attributes of results (list of results id -> dumps) - std::list > myRes; + /// dumps of attributes of results (list of results id -> dumps) + std::list> myRes; + public: // unused constructor for the map container needs ModelHighAPI_FeatureStore() {} @@ -55,15 +57,15 @@ public: private: /// stores the information about all attributes of data in map void storeData(std::shared_ptr theData, - std::map& theAttrs); + std::map &theAttrs); /// compares the information about all attributes of data with map /// returns not empty string with error if something is different std::string compareData(std::shared_ptr theData, - std::map& theAttrs); + std::map &theAttrs); /// dumps the attribute content to the string - std::string dumpAttr(const AttributePtr& theAttr); + std::string dumpAttr(const AttributePtr &theAttr); /// dumps the shape main charatceristics to string - std::string dumpShape(std::shared_ptr& theShape); + std::string dumpShape(std::shared_ptr &theShape); }; -#endif \ No newline at end of file +#endif diff --git a/src/ModelHighAPI/ModelHighAPI_Folder.cpp b/src/ModelHighAPI/ModelHighAPI_Folder.cpp index d61968649..3dbb194dc 100644 --- a/src/ModelHighAPI/ModelHighAPI_Folder.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Folder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Folder.h" @@ -28,19 +29,15 @@ //-------------------------------------------------------------------------------------- -ModelHighAPI_Folder::ModelHighAPI_Folder(const std::shared_ptr & theFolder) - : ModelHighAPI_Interface(FeaturePtr()), - myFolder(theFolder) -{ +ModelHighAPI_Folder::ModelHighAPI_Folder( + const std::shared_ptr &theFolder) + : ModelHighAPI_Interface(FeaturePtr()), myFolder(theFolder) { initialize(); } -ModelHighAPI_Folder::~ModelHighAPI_Folder() -{ -} +ModelHighAPI_Folder::~ModelHighAPI_Folder() {} -bool ModelHighAPI_Folder::initialize() -{ +bool ModelHighAPI_Folder::initialize() { if (!myFolder) { throwException(ID() + " exception: The folder is NULL."); return false; @@ -59,23 +56,20 @@ bool ModelHighAPI_Folder::initialize() return true; } -void ModelHighAPI_Folder::setName(const std::wstring& theName) -{ +void ModelHighAPI_Folder::setName(const std::wstring &theName) { if (myFolder && myFolder->data() && myFolder->data()->isValid()) myFolder->data()->setName(theName); } -std::wstring ModelHighAPI_Folder::name() const -{ +std::wstring ModelHighAPI_Folder::name() const { return myFolder->data()->name(); } -void ModelHighAPI_Folder::dump(ModelHighAPI_Dumper& theDumper) const -{ - const std::string& aDocName = theDumper.name(myFolder->document()); +void ModelHighAPI_Folder::dump(ModelHighAPI_Dumper &theDumper) const { + const std::string &aDocName = theDumper.name(myFolder->document()); AttributeReferencePtr aStartRef = firstFeature(); - AttributeReferencePtr aEndRef = lastFeature(); + AttributeReferencePtr aEndRef = lastFeature(); // do not dump empty folders if (!aEndRef->value()) @@ -92,22 +86,25 @@ void ModelHighAPI_Folder::dump(ModelHighAPI_Dumper& theDumper) const //-------------------------------------------------------------------------------------- -std::shared_ptr addFolder(const std::shared_ptr& theDoc) -{ +std::shared_ptr +addFolder(const std::shared_ptr &theDoc) { std::shared_ptr aFolder = theDoc->addFolder(); return std::shared_ptr(new ModelHighAPI_Folder(aFolder)); } -std::shared_ptr addFolder(const std::shared_ptr& theDoc, - const ModelHighAPI_Reference& theFirstFeature, - const ModelHighAPI_Reference& theLastFeature) -{ - std::shared_ptr aFolder = theDoc->addFolder(theFirstFeature.feature()); +std::shared_ptr +addFolder(const std::shared_ptr &theDoc, + const ModelHighAPI_Reference &theFirstFeature, + const ModelHighAPI_Reference &theLastFeature) { + std::shared_ptr aFolder = + theDoc->addFolder(theFirstFeature.feature()); - AttributeReferencePtr aFirstFeatAttr = aFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID()); + AttributeReferencePtr aFirstFeatAttr = + aFolder->reference(ModelAPI_Folder::FIRST_FEATURE_ID()); fillAttribute(theFirstFeature.feature(), aFirstFeatAttr); - AttributeReferencePtr aLastFeatAttr = aFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID()); + AttributeReferencePtr aLastFeatAttr = + aFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID()); fillAttribute(theLastFeature.feature(), aLastFeatAttr); // to update the folder state in the Object Browser @@ -116,7 +113,6 @@ std::shared_ptr addFolder(const std::shared_ptr(new ModelHighAPI_Folder(aFolder)); } -void removeFolder(std::shared_ptr& theFolder) -{ +void removeFolder(std::shared_ptr &theFolder) { theFolder->folder()->document()->removeFolder(theFolder->folder()); } diff --git a/src/ModelHighAPI/ModelHighAPI_Folder.h b/src/ModelHighAPI/ModelHighAPI_Folder.h index 7e8d71ae3..5b8a828cb 100644 --- a/src/ModelHighAPI/ModelHighAPI_Folder.h +++ b/src/ModelHighAPI/ModelHighAPI_Folder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_FOLDER_H_ @@ -35,30 +36,32 @@ class ModelHighAPI_Reference; * \ingroup CPPHighAPI * \brief Class for filling ModelAPI_Folder */ -class ModelHighAPI_Folder : public ModelHighAPI_Interface -{ +class ModelHighAPI_Folder : public ModelHighAPI_Interface { public: /// Constructor for a folder MODELHIGHAPI_EXPORT - explicit ModelHighAPI_Folder(const std::shared_ptr& theFolder); + explicit ModelHighAPI_Folder( + const std::shared_ptr &theFolder); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Folder(); static std::string ID() { return ModelAPI_Folder::ID(); } virtual std::string getID() { return ID(); } - const std::shared_ptr& folder() const {return myFolder;} + const std::shared_ptr &folder() const { return myFolder; } /// First feature reference - std::shared_ptr firstFeature() const - { return myFirstFeature; } + std::shared_ptr firstFeature() const { + return myFirstFeature; + } /// Last feature reference - std::shared_ptr lastFeature() const - { return myLastFeature; } + std::shared_ptr lastFeature() const { + return myLastFeature; + } /// Shortcut for data()->setName() MODELHIGHAPI_EXPORT - void setName(const std::wstring& theName); + void setName(const std::wstring &theName); /// Shortcut for data()->name() MODELHIGHAPI_EXPORT @@ -66,11 +69,10 @@ public: /// To update the folder state /// \param isForce start execution of feature instead of sending events - //MODELHIGHAPI_EXPORT void execute(); - + // MODELHIGHAPI_EXPORT void execute(); /// Dump wrapped feature - MODELHIGHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; + MODELHIGHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; protected: bool initialize(); @@ -87,19 +89,21 @@ private: * \brief Create empty Folder feature */ MODELHIGHAPI_EXPORT -std::shared_ptr addFolder(const std::shared_ptr& theDoc); +std::shared_ptr +addFolder(const std::shared_ptr &theDoc); /**\ingroup CPPHighAPI * \brief Create Folder feature */ MODELHIGHAPI_EXPORT -std::shared_ptr addFolder(const std::shared_ptr& theDoc, - const ModelHighAPI_Reference& theFirstFeature, - const ModelHighAPI_Reference& theLastFeature); +std::shared_ptr +addFolder(const std::shared_ptr &theDoc, + const ModelHighAPI_Reference &theFirstFeature, + const ModelHighAPI_Reference &theLastFeature); /**\ingroup CPPHighAPI -* \brief Removes Folder feature -*/ + * \brief Removes Folder feature + */ MODELHIGHAPI_EXPORT -void removeFolder(std::shared_ptr& theFolder); +void removeFolder(std::shared_ptr &theFolder); //-------------------------------------------------------------------------------------- #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_FOLDER_H_ */ diff --git a/src/ModelHighAPI/ModelHighAPI_Integer.cpp b/src/ModelHighAPI/ModelHighAPI_Integer.cpp index 545256848..e545e4429 100644 --- a/src/ModelHighAPI/ModelHighAPI_Integer.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Integer.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Integer.h" @@ -26,45 +27,35 @@ //-------------------------------------------------------------------------------------- ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue) -: myVariantType(VT_INT) -, myInt(theValue) -{ -} + : myVariantType(VT_INT), myInt(theValue) {} -ModelHighAPI_Integer::ModelHighAPI_Integer(const std::wstring & theValue) -: myVariantType(VT_STRING) -, myString(theValue) -{ -} +ModelHighAPI_Integer::ModelHighAPI_Integer(const std::wstring &theValue) + : myVariantType(VT_STRING), myString(theValue) {} -ModelHighAPI_Integer::ModelHighAPI_Integer(const wchar_t * theValue) -: myVariantType(VT_STRING) -, myString(theValue) -{ -} +ModelHighAPI_Integer::ModelHighAPI_Integer(const wchar_t *theValue) + : myVariantType(VT_STRING), myString(theValue) {} -ModelHighAPI_Integer::~ModelHighAPI_Integer() -{ -} +ModelHighAPI_Integer::~ModelHighAPI_Integer() {} //-------------------------------------------------------------------------------------- void ModelHighAPI_Integer::fillAttribute( - const std::shared_ptr & theAttribute) const -{ - switch(myVariantType) { - case VT_INT: theAttribute->setValue(myInt); return; - case VT_STRING: theAttribute->setText(myString); return; + const std::shared_ptr &theAttribute) const { + switch (myVariantType) { + case VT_INT: + theAttribute->setValue(myInt); + return; + case VT_STRING: + theAttribute->setText(myString); + return; } } -int ModelHighAPI_Integer::intValue() const -{ +int ModelHighAPI_Integer::intValue() const { // needed for array of integer, which supports no text return myInt; } -std::wstring ModelHighAPI_Integer::string() const -{ +std::wstring ModelHighAPI_Integer::string() const { if (myVariantType == VT_STRING) return myString; diff --git a/src/ModelHighAPI/ModelHighAPI_Integer.h b/src/ModelHighAPI/ModelHighAPI_Integer.h index 9bf1f3511..f443d6ea2 100644 --- a/src/ModelHighAPI/ModelHighAPI_Integer.h +++ b/src/ModelHighAPI/ModelHighAPI_Integer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_INTEGER_H_ @@ -32,25 +33,25 @@ class ModelAPI_AttributeInteger; * \ingroup CPPHighAPI * \brief Class for filling ModelAPI_AttributeInteger */ -class ModelHighAPI_Integer -{ +class ModelHighAPI_Integer { public: /// Constructor for int MODELHIGHAPI_EXPORT ModelHighAPI_Integer(int theValue = 0); /// Constructor for std::string MODELHIGHAPI_EXPORT - ModelHighAPI_Integer(const std::wstring & theValue); + ModelHighAPI_Integer(const std::wstring &theValue); /// Constructor for char * MODELHIGHAPI_EXPORT - ModelHighAPI_Integer(const wchar_t * theValue); + ModelHighAPI_Integer(const wchar_t *theValue); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Integer(); /// Fill attribute values MODELHIGHAPI_EXPORT - virtual void fillAttribute(const std::shared_ptr & theAttribute) const; + virtual void fillAttribute( + const std::shared_ptr &theAttribute) const; /// Returns a value (must be used only for attributes which support no text) MODELHIGHAPI_EXPORT virtual int intValue() const; diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 37223231d..3e306a1a8 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Interface.h" @@ -24,98 +25,86 @@ #include #include #include +#include #include #include -#include #include "ModelHighAPI_Selection.h" //-------------------------------------------------------------------------------------- ModelHighAPI_Interface::ModelHighAPI_Interface( - const std::shared_ptr & theFeature) -: myFeature(theFeature) -{ - -} - -ModelHighAPI_Interface::~ModelHighAPI_Interface() -{ + const std::shared_ptr &theFeature) + : myFeature(theFeature) {} -} +ModelHighAPI_Interface::~ModelHighAPI_Interface() {} //-------------------------------------------------------------------------------------- -std::shared_ptr ModelHighAPI_Interface::feature() const -{ +std::shared_ptr ModelHighAPI_Interface::feature() const { return myFeature; } -std::shared_ptr ModelHighAPI_Interface::subFeature(const int theIndex) const -{ +std::shared_ptr +ModelHighAPI_Interface::subFeature(const int theIndex) const { CompositeFeaturePtr aCompositeFeature = - std::dynamic_pointer_cast(myFeature); - if(!aCompositeFeature.get()) { + std::dynamic_pointer_cast(myFeature); + if (!aCompositeFeature.get()) { return InterfacePtr(); } FeaturePtr aSubFeature = aCompositeFeature->subFeature(theIndex); - if(!aSubFeature.get()) { + if (!aSubFeature.get()) { return InterfacePtr(); } return InterfacePtr(new ModelHighAPI_Interface(aSubFeature)); } -const std::string& ModelHighAPI_Interface::getKind() const -{ +const std::string &ModelHighAPI_Interface::getKind() const { return feature()->getKind(); } -void ModelHighAPI_Interface::execute(bool isForce) -{ +void ModelHighAPI_Interface::execute(bool isForce) { if (isForce) { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); FeaturePtr aFeature = feature(); - if(aFactory->validate(aFeature)) + if (aFactory->validate(aFeature)) aFeature->execute(); } - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); + // aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); } -void ModelHighAPI_Interface::setName(const std::wstring& theName) -{ +void ModelHighAPI_Interface::setName(const std::wstring &theName) { if (feature().get() && feature()->data()->isValid()) feature()->data()->setName(theName); else { - std::cout<<"Error: set name "<data()->name(); } -ModelHighAPI_Selection ModelHighAPI_Interface::result() const -{ +ModelHighAPI_Selection ModelHighAPI_Interface::result() const { std::list aResults = results(); if (aResults.empty()) return ModelHighAPI_Selection(std::shared_ptr()); return aResults.front(); } -std::list ModelHighAPI_Interface::results() const -{ - const_cast(this)->execute(); +std::list ModelHighAPI_Interface::results() const { + const_cast(this)->execute(); std::list aSelectionList; - if (feature().get()) { - std::list > aResults = feature()->results(); + if (feature().get()) { + std::list> aResults = feature()->results(); for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) { if (!(*it)->isDisabled()) aSelectionList.push_back(ModelHighAPI_Selection(*it)); @@ -125,19 +114,17 @@ std::list ModelHighAPI_Interface::results() const return aSelectionList; } -std::shared_ptr ModelHighAPI_Interface::defaultResult() const -{ - const_cast(this)->execute(); +std::shared_ptr ModelHighAPI_Interface::defaultResult() const { + const_cast(this)->execute(); return feature()->lastResult(); } -void ModelHighAPI_Interface::throwException(const std::string & theDescription) -{ +void ModelHighAPI_Interface::throwException(const std::string &theDescription) { Events_InfoMessage("ModelHighAPI_Interface", theDescription).send(); } -const std::string& ModelHighAPI_Interface::attributeGetter(const std::string& theAttrName) -{ +const std::string & +ModelHighAPI_Interface::attributeGetter(const std::string &theAttrName) { return myAttrGetter[theAttrName]; } diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index e741e55ab..5354db082 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ @@ -23,11 +24,11 @@ //-------------------------------------------------------------------------------------- #include "ModelHighAPI.h" +#include #include #include #include #include -#include //-------------------------------------------------------------------------------------- class ModelAPI_Feature; class ModelAPI_Result; @@ -38,12 +39,12 @@ class ModelHighAPI_Dumper; * \ingroup CPPHighAPI * \brief Base class for feature interfaces */ -class ModelHighAPI_Interface -{ +class ModelHighAPI_Interface { public: /// Constructor MODELHIGHAPI_EXPORT - explicit ModelHighAPI_Interface(const std::shared_ptr & theFeature); + explicit ModelHighAPI_Interface( + const std::shared_ptr &theFeature); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Interface(); @@ -52,14 +53,15 @@ public: MODELHIGHAPI_EXPORT std::shared_ptr feature() const; - /// If feature is composite return intefrace for sub-feature by zero-based index, - /// or empty pointer if feature not composite or does not have sub-feature with such index. + /// If feature is composite return intefrace for sub-feature by zero-based + /// index, or empty pointer if feature not composite or does not have + /// sub-feature with such index. MODELHIGHAPI_EXPORT std::shared_ptr subFeature(const int theIndex) const; /// Shortcut for feature()->getKind() MODELHIGHAPI_EXPORT - const std::string& getKind() const; + const std::string &getKind() const; /// Shortcut for feature()->execute() /// \param isForce start execution of feature instead of sending events @@ -68,7 +70,7 @@ public: /// Shortcut for feature()->data()->setName() MODELHIGHAPI_EXPORT - void setName(const std::wstring& theName); + void setName(const std::wstring &theName); /// Shortcut for feature()->data()->name() MODELHIGHAPI_EXPORT @@ -88,20 +90,21 @@ public: /// Throw exception to event loop MODELHIGHAPI_EXPORT - void throwException(const std::string & theDescription); + void throwException(const std::string &theDescription); /// Return name of getter for specified attribute MODELHIGHAPI_EXPORT - const std::string& attributeGetter(const std::string& theAttrName); + const std::string &attributeGetter(const std::string &theAttrName); /// Dump wrapped feature MODELHIGHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& /*theDumper*/) const {} + virtual void dump(ModelHighAPI_Dumper & /*theDumper*/) const {} protected: std::shared_ptr myFeature; ///< feature of this interface - std::map myAttrGetter; ///< names of attributes and their getters + std::map + myAttrGetter; ///< names of attributes and their getters }; //! Pointer on Interface object diff --git a/src/ModelHighAPI/ModelHighAPI_Macro.h b/src/ModelHighAPI/ModelHighAPI_Macro.h index 0581d714a..c54a5deed 100644 --- a/src/ModelHighAPI/ModelHighAPI_Macro.h +++ b/src/ModelHighAPI/ModelHighAPI_Macro.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ @@ -32,8 +33,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -48,1063 +49,881 @@ //-------------------------------------------------------------------------------------- // Used in INTERFACE_N for create variable and getter -#define DEFINE_ATTRIBUTE(NAME, TYPE, COMMENT) \ - COMMENT \ - virtual std::shared_ptr NAME() const { return VAR_NAME(NAME); } \ - protected: \ - std::shared_ptr VAR_NAME(NAME); \ - public: +#define DEFINE_ATTRIBUTE(NAME, TYPE, COMMENT) \ + COMMENT \ + virtual std::shared_ptr NAME() const { return VAR_NAME(NAME); } \ + \ +protected: \ + std::shared_ptr VAR_NAME(NAME); \ + \ +public: //-------------------------------------------------------------------------------------- // Used in INTERFACE_N inside START_INIT/END_INIT for // set variable with attribute received from feature -#define SET_ATTRIBUTE(NAME, TYPE, ATT_NAME) \ - VAR_NAME(NAME) = std::dynamic_pointer_cast(feature()->attribute(ATT_NAME)); \ - if (!VAR_NAME(NAME)) \ - return false; \ +#define SET_ATTRIBUTE(NAME, TYPE, ATT_NAME) \ + VAR_NAME(NAME) = \ + std::dynamic_pointer_cast(feature()->attribute(ATT_NAME)); \ + if (!VAR_NAME(NAME)) \ + return false; \ myAttrGetter[ATT_NAME] = TO_STRING(NAME); //-------------------------------------------------------------------------------------- -#define INTERFACE_COMMON(KIND) \ - static std::string ID() { return KIND; }\ +#define INTERFACE_COMMON(KIND) \ + static std::string ID() { return KIND; } \ virtual std::string getID() { return ID(); } //-------------------------------------------------------------------------------------- -#define START_INIT() \ - bool initialize() { \ - if (!feature()) { \ - throwException(ID() + " exception: The feature is NULL."); \ - return false; \ - } \ - if (getKind() != getID()) { \ - throwException(ID() + " exception: Wrong feature kind."); \ - return false; \ +#define START_INIT() \ + bool initialize() { \ + if (!feature()) { \ + throwException(ID() + " exception: The feature is NULL."); \ + return false; \ + } \ + if (getKind() != getID()) { \ + throwException(ID() + " exception: Wrong feature kind."); \ + return false; \ } //-------------------------------------------------------------------------------------- -#define END_INIT() \ - return true; \ +#define END_INIT() \ + return true; \ } //-------------------------------------------------------------------------------------- -#define INTERFACE_0(KIND) \ - public: \ - INTERFACE_COMMON(KIND) \ - protected: \ - START_INIT() \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_1(KIND, \ - N_0, AN_0, T_0, C_0) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_2(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_3(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_4(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_5(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_6(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_7(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_8(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_9(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_10(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_11(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_12(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_13(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_14(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - END_INIT() \ - public: -//-------------------------------------------------------------------------------------- -#define INTERFACE_15(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_16(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_18(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15, \ - N_16, AN_16, T_16, C_16, \ - N_17, AN_17, T_17, C_17) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ - DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - SET_ATTRIBUTE(N_16, T_16, AN_16) \ - SET_ATTRIBUTE(N_17, T_17, AN_17) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_20(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15, \ - N_16, AN_16, T_16, C_16, \ - N_17, AN_17, T_17, C_17, \ - N_18, AN_18, T_18, C_18, \ - N_19, AN_19, T_19, C_19) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ - DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ - DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ - DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - SET_ATTRIBUTE(N_16, T_16, AN_16) \ - SET_ATTRIBUTE(N_17, T_17, AN_17) \ - SET_ATTRIBUTE(N_18, T_18, AN_18) \ - SET_ATTRIBUTE(N_19, T_19, AN_19) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_21(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15, \ - N_16, AN_16, T_16, C_16, \ - N_17, AN_17, T_17, C_17, \ - N_18, AN_18, T_18, C_18, \ - N_19, AN_19, T_19, C_19, \ - N_20, AN_20, T_20, C_20) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ - DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ - DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ - DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ - DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - SET_ATTRIBUTE(N_16, T_16, AN_16) \ - SET_ATTRIBUTE(N_17, T_17, AN_17) \ - SET_ATTRIBUTE(N_18, T_18, AN_18) \ - SET_ATTRIBUTE(N_19, T_19, AN_19) \ - SET_ATTRIBUTE(N_20, T_20, AN_20) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_24(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15, \ - N_16, AN_16, T_16, C_16, \ - N_17, AN_17, T_17, C_17, \ - N_18, AN_18, T_18, C_18, \ - N_19, AN_19, T_19, C_19, \ - N_20, AN_20, T_20, C_20, \ - N_21, AN_21, T_21, C_21, \ - N_22, AN_22, T_22, C_22, \ - N_23, AN_23, T_23, C_23) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ - DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ - DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ - DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ - DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ - DEFINE_ATTRIBUTE(N_21, T_21, C_21) \ - DEFINE_ATTRIBUTE(N_22, T_22, C_22) \ - DEFINE_ATTRIBUTE(N_23, T_23, C_23) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - SET_ATTRIBUTE(N_16, T_16, AN_16) \ - SET_ATTRIBUTE(N_17, T_17, AN_17) \ - SET_ATTRIBUTE(N_18, T_18, AN_18) \ - SET_ATTRIBUTE(N_19, T_19, AN_19) \ - SET_ATTRIBUTE(N_20, T_20, AN_20) \ - SET_ATTRIBUTE(N_21, T_21, AN_21) \ - SET_ATTRIBUTE(N_22, T_22, AN_22) \ - SET_ATTRIBUTE(N_23, T_23, AN_23) \ - END_INIT() \ - public: - -//-------------------------------------------------------------------------------------- -#define INTERFACE_25(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15, \ - N_16, AN_16, T_16, C_16, \ - N_17, AN_17, T_17, C_17, \ - N_18, AN_18, T_18, C_18, \ - N_19, AN_19, T_19, C_19, \ - N_20, AN_20, T_20, C_20, \ - N_21, AN_21, T_21, C_21, \ - N_22, AN_22, T_22, C_22, \ - N_23, AN_23, T_23, C_23, \ - N_24, AN_24, T_24, C_24) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ - DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ - DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ - DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ - DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ - DEFINE_ATTRIBUTE(N_21, T_21, C_21) \ - DEFINE_ATTRIBUTE(N_22, T_22, C_22) \ - DEFINE_ATTRIBUTE(N_23, T_23, C_23) \ - DEFINE_ATTRIBUTE(N_24, T_24, C_24) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - SET_ATTRIBUTE(N_16, T_16, AN_16) \ - SET_ATTRIBUTE(N_17, T_17, AN_17) \ - SET_ATTRIBUTE(N_18, T_18, AN_18) \ - SET_ATTRIBUTE(N_19, T_19, AN_19) \ - SET_ATTRIBUTE(N_20, T_20, AN_20) \ - SET_ATTRIBUTE(N_21, T_21, AN_21) \ - SET_ATTRIBUTE(N_22, T_22, AN_22) \ - SET_ATTRIBUTE(N_23, T_23, AN_23) \ - SET_ATTRIBUTE(N_24, T_24, AN_24) \ - END_INIT() \ - public: - - -//-------------------------------------------------------------------------------------- -#define INTERFACE_27(KIND, \ - N_0, AN_0, T_0, C_0, \ - N_1, AN_1, T_1, C_1, \ - N_2, AN_2, T_2, C_2, \ - N_3, AN_3, T_3, C_3, \ - N_4, AN_4, T_4, C_4, \ - N_5, AN_5, T_5, C_5, \ - N_6, AN_6, T_6, C_6, \ - N_7, AN_7, T_7, C_7, \ - N_8, AN_8, T_8, C_8, \ - N_9, AN_9, T_9, C_9, \ - N_10, AN_10, T_10, C_10, \ - N_11, AN_11, T_11, C_11, \ - N_12, AN_12, T_12, C_12, \ - N_13, AN_13, T_13, C_13, \ - N_14, AN_14, T_14, C_14, \ - N_15, AN_15, T_15, C_15, \ - N_16, AN_16, T_16, C_16, \ - N_17, AN_17, T_17, C_17, \ - N_18, AN_18, T_18, C_18, \ - N_19, AN_19, T_19, C_19, \ - N_20, AN_20, T_20, C_20, \ - N_21, AN_21, T_21, C_21, \ - N_22, AN_22, T_22, C_22, \ - N_23, AN_23, T_23, C_23, \ - N_24, AN_24, T_24, C_24, \ - N_25, AN_25, T_25, C_25, \ - N_26, AN_26, T_26, C_26) \ - public: \ - INTERFACE_COMMON(KIND) \ - DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ - DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ - DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ - DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ - DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ - DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ - DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ - DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ - DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ - DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ - DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ - DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ - DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ - DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ - DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ - DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ - DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ - DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ - DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ - DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ - DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ - DEFINE_ATTRIBUTE(N_21, T_21, C_21) \ - DEFINE_ATTRIBUTE(N_22, T_22, C_22) \ - DEFINE_ATTRIBUTE(N_23, T_23, C_23) \ - DEFINE_ATTRIBUTE(N_24, T_24, C_24) \ - DEFINE_ATTRIBUTE(N_25, T_25, C_25) \ - DEFINE_ATTRIBUTE(N_26, T_26, C_26) \ - protected: \ - START_INIT() \ - SET_ATTRIBUTE(N_0, T_0, AN_0) \ - SET_ATTRIBUTE(N_1, T_1, AN_1) \ - SET_ATTRIBUTE(N_2, T_2, AN_2) \ - SET_ATTRIBUTE(N_3, T_3, AN_3) \ - SET_ATTRIBUTE(N_4, T_4, AN_4) \ - SET_ATTRIBUTE(N_5, T_5, AN_5) \ - SET_ATTRIBUTE(N_6, T_6, AN_6) \ - SET_ATTRIBUTE(N_7, T_7, AN_7) \ - SET_ATTRIBUTE(N_8, T_8, AN_8) \ - SET_ATTRIBUTE(N_9, T_9, AN_9) \ - SET_ATTRIBUTE(N_10, T_10, AN_10) \ - SET_ATTRIBUTE(N_11, T_11, AN_11) \ - SET_ATTRIBUTE(N_12, T_12, AN_12) \ - SET_ATTRIBUTE(N_13, T_13, AN_13) \ - SET_ATTRIBUTE(N_14, T_14, AN_14) \ - SET_ATTRIBUTE(N_15, T_15, AN_15) \ - SET_ATTRIBUTE(N_16, T_16, AN_16) \ - SET_ATTRIBUTE(N_17, T_17, AN_17) \ - SET_ATTRIBUTE(N_18, T_18, AN_18) \ - SET_ATTRIBUTE(N_19, T_19, AN_19) \ - SET_ATTRIBUTE(N_20, T_20, AN_20) \ - SET_ATTRIBUTE(N_21, T_21, AN_21) \ - SET_ATTRIBUTE(N_22, T_22, AN_22) \ - SET_ATTRIBUTE(N_23, T_23, AN_23) \ - SET_ATTRIBUTE(N_24, T_24, AN_24) \ - SET_ATTRIBUTE(N_25, T_25, AN_25) \ - SET_ATTRIBUTE(N_26, T_26, AN_26) \ - END_INIT() \ - public: +#define INTERFACE_0(KIND) \ +public: \ + INTERFACE_COMMON(KIND) \ +protected: \ + START_INIT() \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_1(KIND, N_0, AN_0, T_0, C_0) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_2(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_3(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_4(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2, N_3, AN_3, T_3, C_3) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_5(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_6(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, \ + AN_5, T_5, C_5) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_7(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, \ + AN_5, T_5, C_5, N_6, AN_6, T_6, C_6) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_8(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, \ + AN_5, T_5, C_5, N_6, AN_6, T_6, C_6, N_7, AN_7, T_7, C_7) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_9(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, \ + T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, \ + AN_5, T_5, C_5, N_6, AN_6, T_6, C_6, N_7, AN_7, T_7, C_7, \ + N_8, AN_8, T_8, C_8) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_10(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, \ + AN_2, T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, \ + N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, C_6, N_7, AN_7, T_7, \ + C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_11(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, \ + AN_2, T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, \ + N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, C_6, N_7, AN_7, T_7, \ + C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_12(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, \ + AN_2, T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, \ + N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, C_6, N_7, AN_7, T_7, \ + C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_13( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_14(KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, \ + AN_2, T_2, C_2, N_3, AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, \ + N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, C_6, N_7, AN_7, T_7, \ + C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, \ + T_12, C_12, N_13, AN_13, T_13, C_13) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + END_INIT() \ +public: +//-------------------------------------------------------------------------------------- +#define INTERFACE_15( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_16( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_18( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15, N_16, \ + AN_16, T_16, C_16, N_17, AN_17, T_17, C_17) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ + DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ + DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + SET_ATTRIBUTE(N_16, T_16, AN_16) \ + SET_ATTRIBUTE(N_17, T_17, AN_17) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_20( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15, N_16, \ + AN_16, T_16, C_16, N_17, AN_17, T_17, C_17, N_18, AN_18, T_18, C_18, N_19, \ + AN_19, T_19, C_19) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ + DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ + DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ + DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ + DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + SET_ATTRIBUTE(N_16, T_16, AN_16) \ + SET_ATTRIBUTE(N_17, T_17, AN_17) \ + SET_ATTRIBUTE(N_18, T_18, AN_18) \ + SET_ATTRIBUTE(N_19, T_19, AN_19) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_21( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15, N_16, \ + AN_16, T_16, C_16, N_17, AN_17, T_17, C_17, N_18, AN_18, T_18, C_18, N_19, \ + AN_19, T_19, C_19, N_20, AN_20, T_20, C_20) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ + DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ + DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ + DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ + DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ + DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + SET_ATTRIBUTE(N_16, T_16, AN_16) \ + SET_ATTRIBUTE(N_17, T_17, AN_17) \ + SET_ATTRIBUTE(N_18, T_18, AN_18) \ + SET_ATTRIBUTE(N_19, T_19, AN_19) \ + SET_ATTRIBUTE(N_20, T_20, AN_20) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_24( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15, N_16, \ + AN_16, T_16, C_16, N_17, AN_17, T_17, C_17, N_18, AN_18, T_18, C_18, N_19, \ + AN_19, T_19, C_19, N_20, AN_20, T_20, C_20, N_21, AN_21, T_21, C_21, N_22, \ + AN_22, T_22, C_22, N_23, AN_23, T_23, C_23) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ + DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ + DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ + DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ + DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ + DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ + DEFINE_ATTRIBUTE(N_21, T_21, C_21) \ + DEFINE_ATTRIBUTE(N_22, T_22, C_22) \ + DEFINE_ATTRIBUTE(N_23, T_23, C_23) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + SET_ATTRIBUTE(N_16, T_16, AN_16) \ + SET_ATTRIBUTE(N_17, T_17, AN_17) \ + SET_ATTRIBUTE(N_18, T_18, AN_18) \ + SET_ATTRIBUTE(N_19, T_19, AN_19) \ + SET_ATTRIBUTE(N_20, T_20, AN_20) \ + SET_ATTRIBUTE(N_21, T_21, AN_21) \ + SET_ATTRIBUTE(N_22, T_22, AN_22) \ + SET_ATTRIBUTE(N_23, T_23, AN_23) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_25( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15, N_16, \ + AN_16, T_16, C_16, N_17, AN_17, T_17, C_17, N_18, AN_18, T_18, C_18, N_19, \ + AN_19, T_19, C_19, N_20, AN_20, T_20, C_20, N_21, AN_21, T_21, C_21, N_22, \ + AN_22, T_22, C_22, N_23, AN_23, T_23, C_23, N_24, AN_24, T_24, C_24) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ + DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ + DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ + DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ + DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ + DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ + DEFINE_ATTRIBUTE(N_21, T_21, C_21) \ + DEFINE_ATTRIBUTE(N_22, T_22, C_22) \ + DEFINE_ATTRIBUTE(N_23, T_23, C_23) \ + DEFINE_ATTRIBUTE(N_24, T_24, C_24) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + SET_ATTRIBUTE(N_16, T_16, AN_16) \ + SET_ATTRIBUTE(N_17, T_17, AN_17) \ + SET_ATTRIBUTE(N_18, T_18, AN_18) \ + SET_ATTRIBUTE(N_19, T_19, AN_19) \ + SET_ATTRIBUTE(N_20, T_20, AN_20) \ + SET_ATTRIBUTE(N_21, T_21, AN_21) \ + SET_ATTRIBUTE(N_22, T_22, AN_22) \ + SET_ATTRIBUTE(N_23, T_23, AN_23) \ + SET_ATTRIBUTE(N_24, T_24, AN_24) \ + END_INIT() \ +public: + +//-------------------------------------------------------------------------------------- +#define INTERFACE_27( \ + KIND, N_0, AN_0, T_0, C_0, N_1, AN_1, T_1, C_1, N_2, AN_2, T_2, C_2, N_3, \ + AN_3, T_3, C_3, N_4, AN_4, T_4, C_4, N_5, AN_5, T_5, C_5, N_6, AN_6, T_6, \ + C_6, N_7, AN_7, T_7, C_7, N_8, AN_8, T_8, C_8, N_9, AN_9, T_9, C_9, N_10, \ + AN_10, T_10, C_10, N_11, AN_11, T_11, C_11, N_12, AN_12, T_12, C_12, N_13, \ + AN_13, T_13, C_13, N_14, AN_14, T_14, C_14, N_15, AN_15, T_15, C_15, N_16, \ + AN_16, T_16, C_16, N_17, AN_17, T_17, C_17, N_18, AN_18, T_18, C_18, N_19, \ + AN_19, T_19, C_19, N_20, AN_20, T_20, C_20, N_21, AN_21, T_21, C_21, N_22, \ + AN_22, T_22, C_22, N_23, AN_23, T_23, C_23, N_24, AN_24, T_24, C_24, N_25, \ + AN_25, T_25, C_25, N_26, AN_26, T_26, C_26) \ +public: \ + INTERFACE_COMMON(KIND) \ + DEFINE_ATTRIBUTE(N_0, T_0, C_0) \ + DEFINE_ATTRIBUTE(N_1, T_1, C_1) \ + DEFINE_ATTRIBUTE(N_2, T_2, C_2) \ + DEFINE_ATTRIBUTE(N_3, T_3, C_3) \ + DEFINE_ATTRIBUTE(N_4, T_4, C_4) \ + DEFINE_ATTRIBUTE(N_5, T_5, C_5) \ + DEFINE_ATTRIBUTE(N_6, T_6, C_6) \ + DEFINE_ATTRIBUTE(N_7, T_7, C_7) \ + DEFINE_ATTRIBUTE(N_8, T_8, C_8) \ + DEFINE_ATTRIBUTE(N_9, T_9, C_9) \ + DEFINE_ATTRIBUTE(N_10, T_10, C_10) \ + DEFINE_ATTRIBUTE(N_11, T_11, C_11) \ + DEFINE_ATTRIBUTE(N_12, T_12, C_12) \ + DEFINE_ATTRIBUTE(N_13, T_13, C_13) \ + DEFINE_ATTRIBUTE(N_14, T_14, C_14) \ + DEFINE_ATTRIBUTE(N_15, T_15, C_15) \ + DEFINE_ATTRIBUTE(N_16, T_16, C_16) \ + DEFINE_ATTRIBUTE(N_17, T_17, C_17) \ + DEFINE_ATTRIBUTE(N_18, T_18, C_18) \ + DEFINE_ATTRIBUTE(N_19, T_19, C_19) \ + DEFINE_ATTRIBUTE(N_20, T_20, C_20) \ + DEFINE_ATTRIBUTE(N_21, T_21, C_21) \ + DEFINE_ATTRIBUTE(N_22, T_22, C_22) \ + DEFINE_ATTRIBUTE(N_23, T_23, C_23) \ + DEFINE_ATTRIBUTE(N_24, T_24, C_24) \ + DEFINE_ATTRIBUTE(N_25, T_25, C_25) \ + DEFINE_ATTRIBUTE(N_26, T_26, C_26) \ +protected: \ + START_INIT() \ + SET_ATTRIBUTE(N_0, T_0, AN_0) \ + SET_ATTRIBUTE(N_1, T_1, AN_1) \ + SET_ATTRIBUTE(N_2, T_2, AN_2) \ + SET_ATTRIBUTE(N_3, T_3, AN_3) \ + SET_ATTRIBUTE(N_4, T_4, AN_4) \ + SET_ATTRIBUTE(N_5, T_5, AN_5) \ + SET_ATTRIBUTE(N_6, T_6, AN_6) \ + SET_ATTRIBUTE(N_7, T_7, AN_7) \ + SET_ATTRIBUTE(N_8, T_8, AN_8) \ + SET_ATTRIBUTE(N_9, T_9, AN_9) \ + SET_ATTRIBUTE(N_10, T_10, AN_10) \ + SET_ATTRIBUTE(N_11, T_11, AN_11) \ + SET_ATTRIBUTE(N_12, T_12, AN_12) \ + SET_ATTRIBUTE(N_13, T_13, AN_13) \ + SET_ATTRIBUTE(N_14, T_14, AN_14) \ + SET_ATTRIBUTE(N_15, T_15, AN_15) \ + SET_ATTRIBUTE(N_16, T_16, AN_16) \ + SET_ATTRIBUTE(N_17, T_17, AN_17) \ + SET_ATTRIBUTE(N_18, T_18, AN_18) \ + SET_ATTRIBUTE(N_19, T_19, AN_19) \ + SET_ATTRIBUTE(N_20, T_20, AN_20) \ + SET_ATTRIBUTE(N_21, T_21, AN_21) \ + SET_ATTRIBUTE(N_22, T_22, AN_22) \ + SET_ATTRIBUTE(N_23, T_23, AN_23) \ + SET_ATTRIBUTE(N_24, T_24, AN_24) \ + SET_ATTRIBUTE(N_25, T_25, AN_25) \ + SET_ATTRIBUTE(N_26, T_26, AN_26) \ + END_INIT() \ +public: //-------------------------------------------------------------------------------------- #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ */ diff --git a/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp b/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp index 08ae5b870..74c31c523 100644 --- a/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp +++ b/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp @@ -14,80 +14,76 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_RefAttr.h" +#include "ModelHighAPI_Interface.h" #include #include #include #include #include -#include "ModelHighAPI_Interface.h" //-------------------------------------------------------------------------------------- -ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() -: myVariantType(VT_OBJECT) -{ -} +ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() : myVariantType(VT_OBJECT) {} ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( - const std::shared_ptr & theValue) -: myVariantType(VT_ATTRIBUTE) -, myAttribute(theValue) -{ -} + const std::shared_ptr &theValue) + : myVariantType(VT_ATTRIBUTE), myAttribute(theValue) {} ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( - const std::shared_ptr & theValue) -: myVariantType(VT_OBJECT) -, myObject(theValue) -{ -} + const std::shared_ptr &theValue) + : myVariantType(VT_OBJECT), myObject(theValue) {} ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( - const std::shared_ptr & theValue) -: myVariantType(VT_OBJECT) -, myObject(std::shared_ptr(theValue->defaultResult())) -{ -} + const std::shared_ptr &theValue) + : myVariantType(VT_OBJECT), + myObject(std::shared_ptr(theValue->defaultResult())) {} -ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() -{ -} +ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() {} //-------------------------------------------------------------------------------------- void ModelHighAPI_RefAttr::fillAttribute( - const std::shared_ptr & theAttribute) const -{ - switch(myVariantType) { - case VT_ATTRIBUTE: theAttribute->setAttr(myAttribute); return; - case VT_OBJECT: theAttribute->setObject(myObject); return; + const std::shared_ptr &theAttribute) const { + switch (myVariantType) { + case VT_ATTRIBUTE: + theAttribute->setAttr(myAttribute); + return; + case VT_OBJECT: + theAttribute->setObject(myObject); + return; } } //-------------------------------------------------------------------------------------- void ModelHighAPI_RefAttr::appendToList( - const std::shared_ptr & theAttribute) const -{ - switch(myVariantType) { - case VT_ATTRIBUTE: theAttribute->append(myAttribute); return; - case VT_OBJECT: theAttribute->append(myObject); return; + const std::shared_ptr &theAttribute) const { + switch (myVariantType) { + case VT_ATTRIBUTE: + theAttribute->append(myAttribute); + return; + case VT_OBJECT: + theAttribute->append(myObject); + return; } } //-------------------------------------------------------------------------------------- -bool ModelHighAPI_RefAttr::isEmpty() const -{ +bool ModelHighAPI_RefAttr::isEmpty() const { return !(myAttribute || myObject); } //-------------------------------------------------------------------------------------- void ModelHighAPI_RefAttr::fillMessage( - const std::shared_ptr& theMessage) const -{ + const std::shared_ptr &theMessage) const { switch (myVariantType) { - case VT_ATTRIBUTE: theMessage->setMovedAttribute(myAttribute); return; - case VT_OBJECT: theMessage->setMovedObject(myObject); return; + case VT_ATTRIBUTE: + theMessage->setMovedAttribute(myAttribute); + return; + case VT_OBJECT: + theMessage->setMovedObject(myObject); + return; } } diff --git a/src/ModelHighAPI/ModelHighAPI_RefAttr.h b/src/ModelHighAPI/ModelHighAPI_RefAttr.h index ffe5b37e6..0577258bd 100644 --- a/src/ModelHighAPI/ModelHighAPI_RefAttr.h +++ b/src/ModelHighAPI/ModelHighAPI_RefAttr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_REFATTR_H_ @@ -37,32 +38,31 @@ class ModelHighAPI_Interface; * \ingroup CPPHighAPI * \brief Class for filling ModelAPI_AttributeRefAttr */ -class ModelHighAPI_RefAttr -{ +class ModelHighAPI_RefAttr { public: /// Default constructor MODELHIGHAPI_EXPORT ModelHighAPI_RefAttr(); /// Constructor for attribute MODELHIGHAPI_EXPORT - ModelHighAPI_RefAttr(const std::shared_ptr & theValue); + ModelHighAPI_RefAttr(const std::shared_ptr &theValue); /// Constructor for object MODELHIGHAPI_EXPORT - ModelHighAPI_RefAttr(const std::shared_ptr & theValue); + ModelHighAPI_RefAttr(const std::shared_ptr &theValue); /// Constructor for Interface (use result() for object) MODELHIGHAPI_EXPORT - ModelHighAPI_RefAttr(const std::shared_ptr & theValue); + ModelHighAPI_RefAttr(const std::shared_ptr &theValue); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_RefAttr(); /// Fill attribute values - MODELHIGHAPI_EXPORT virtual - void fillAttribute(const std::shared_ptr & theAttribute) const; + MODELHIGHAPI_EXPORT virtual void fillAttribute( + const std::shared_ptr &theAttribute) const; /// Append to list attribute - MODELHIGHAPI_EXPORT virtual - void appendToList(const std::shared_ptr & theAttribute) const; + MODELHIGHAPI_EXPORT virtual void appendToList( + const std::shared_ptr &theAttribute) const; /// Check the object is empty MODELHIGHAPI_EXPORT @@ -70,7 +70,8 @@ public: /// Fill moved message by the attribute or object MODELHIGHAPI_EXPORT - void fillMessage(const std::shared_ptr& theMessage) const; + void fillMessage( + const std::shared_ptr &theMessage) const; std::shared_ptr attr() const { return myAttribute; } std::shared_ptr object() const { return myObject; } diff --git a/src/ModelHighAPI/ModelHighAPI_Reference.cpp b/src/ModelHighAPI/ModelHighAPI_Reference.cpp index 445490e8f..a9a6b1745 100644 --- a/src/ModelHighAPI/ModelHighAPI_Reference.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Reference.cpp @@ -14,29 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Reference.h" -#include +#include "ModelHighAPI_Interface.h" #include +#include #include #include -#include "ModelHighAPI_Interface.h" //-------------------------------------------------------------------------------------- -ModelHighAPI_Reference::ModelHighAPI_Reference() -{} +ModelHighAPI_Reference::ModelHighAPI_Reference() {} ModelHighAPI_Reference::ModelHighAPI_Reference( - const std::shared_ptr & theValue) -: myObject(theValue) -{} + const std::shared_ptr &theValue) + : myObject(theValue) {} ModelHighAPI_Reference::ModelHighAPI_Reference( - const std::shared_ptr & theValue) -: myObject(std::shared_ptr(theValue->defaultResult())) -{ + const std::shared_ptr &theValue) + : myObject(std::shared_ptr(theValue->defaultResult())) { // the result is not constructed yet, forcibly do it if (!myObject) { theValue->execute(true); @@ -49,26 +47,21 @@ ModelHighAPI_Reference::ModelHighAPI_Reference( } } -ModelHighAPI_Reference::~ModelHighAPI_Reference() -{ -} +ModelHighAPI_Reference::~ModelHighAPI_Reference() {} //-------------------------------------------------------------------------------------- void ModelHighAPI_Reference::fillAttribute( - const std::shared_ptr & theAttribute) const -{ + const std::shared_ptr &theAttribute) const { theAttribute->setValue(myObject); } //-------------------------------------------------------------------------------------- void ModelHighAPI_Reference::appendToList( - const std::shared_ptr & theAttribute) const -{ + const std::shared_ptr &theAttribute) const { theAttribute->append(myObject); } //-------------------------------------------------------------------------------------- -std::shared_ptr ModelHighAPI_Reference::feature() const -{ +std::shared_ptr ModelHighAPI_Reference::feature() const { return ModelAPI_Feature::feature(myObject); } diff --git a/src/ModelHighAPI/ModelHighAPI_Reference.h b/src/ModelHighAPI/ModelHighAPI_Reference.h index ad17050f2..e2df9c34d 100644 --- a/src/ModelHighAPI/ModelHighAPI_Reference.h +++ b/src/ModelHighAPI/ModelHighAPI_Reference.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_REFERENCE_H_ @@ -37,29 +38,30 @@ class ModelHighAPI_Interface; * \ingroup CPPHighAPI * \brief Class for filling ModelAPI_AttributeReference */ -class ModelHighAPI_Reference -{ +class ModelHighAPI_Reference { public: /// Default constructor MODELHIGHAPI_EXPORT ModelHighAPI_Reference(); /// Constructor for object MODELHIGHAPI_EXPORT - ModelHighAPI_Reference(const std::shared_ptr & theValue); + ModelHighAPI_Reference(const std::shared_ptr &theValue); /// Constructor for Interface (use result() for object) MODELHIGHAPI_EXPORT - ModelHighAPI_Reference(const std::shared_ptr & theValue); + ModelHighAPI_Reference( + const std::shared_ptr &theValue); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Reference(); /// Fill attribute values - MODELHIGHAPI_EXPORT virtual - void fillAttribute(const std::shared_ptr & theAttribute) const; + MODELHIGHAPI_EXPORT virtual void fillAttribute( + const std::shared_ptr &theAttribute) const; /// Append to list attribute MODELHIGHAPI_EXPORT - virtual void appendToList(const std::shared_ptr & theAttribute) const; + virtual void appendToList( + const std::shared_ptr &theAttribute) const; /// Returns feature for this object. MODELHIGHAPI_EXPORT diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.cpp b/src/ModelHighAPI/ModelHighAPI_Selection.cpp index 4d85810f8..f271e739f 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Selection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Selection.h" @@ -31,155 +32,152 @@ //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- -ModelHighAPI_Selection::ModelHighAPI_Selection() -: myVariantType(VT_Empty) -{ -} - -ModelHighAPI_Selection::ModelHighAPI_Selection(const std::shared_ptr& theContext, - const std::shared_ptr& theSubShape) -: myVariantType(VT_ResultSubShapePair) -, myResultSubShapePair(theContext, theSubShape) -{ -} - -ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType, - const std::wstring& theSubShapeName) -: myVariantType(VT_TypeSubShapeNamePair) -, myTypeSubShapeNamePair(theType, theSubShapeName) -{ -} - -ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType, - const GeomPointPtr& theSubShapeInnerPoint) -: myVariantType(VT_TypeInnerPointPair) -, myTypeInnerPointPair(theType, theSubShapeInnerPoint) -{ -} - -ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType, - const std::list& theSubShapeInnerPoint) -: myVariantType(VT_TypeInnerPointPair) -{ - double aCoordinates[3] = { 0.0, 0.0, 0.0 }; - double* aCIt = aCoordinates; +ModelHighAPI_Selection::ModelHighAPI_Selection() : myVariantType(VT_Empty) {} + +ModelHighAPI_Selection::ModelHighAPI_Selection( + const std::shared_ptr &theContext, + const std::shared_ptr &theSubShape) + : myVariantType(VT_ResultSubShapePair), + myResultSubShapePair(theContext, theSubShape) {} + +ModelHighAPI_Selection::ModelHighAPI_Selection( + const std::string &theType, const std::wstring &theSubShapeName) + : myVariantType(VT_TypeSubShapeNamePair), + myTypeSubShapeNamePair(theType, theSubShapeName) {} + +ModelHighAPI_Selection::ModelHighAPI_Selection( + const std::string &theType, const GeomPointPtr &theSubShapeInnerPoint) + : myVariantType(VT_TypeInnerPointPair), + myTypeInnerPointPair(theType, theSubShapeInnerPoint) {} + +ModelHighAPI_Selection::ModelHighAPI_Selection( + const std::string &theType, const std::list &theSubShapeInnerPoint) + : myVariantType(VT_TypeInnerPointPair) { + double aCoordinates[3] = {0.0, 0.0, 0.0}; + double *aCIt = aCoordinates; std::list::const_iterator aPIt = theSubShapeInnerPoint.begin(); for (; aPIt != theSubShapeInnerPoint.end(); ++aPIt, ++aCIt) *aCIt = *aPIt; - GeomPointPtr anInnerPoint(new GeomAPI_Pnt(aCoordinates[0], aCoordinates[1], aCoordinates[2])); - myTypeInnerPointPair = std::pair(theType, anInnerPoint); + GeomPointPtr anInnerPoint( + new GeomAPI_Pnt(aCoordinates[0], aCoordinates[1], aCoordinates[2])); + myTypeInnerPointPair = + std::pair(theType, anInnerPoint); } -ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType, - const std::wstring& theContextName, const int theIndex) - : myVariantType(VT_WeakNamingPair), - myWeakNamingPair(theType, std::pair(theContextName, theIndex)) -{ +ModelHighAPI_Selection::ModelHighAPI_Selection( + const std::string &theType, const std::wstring &theContextName, + const int theIndex) + : myVariantType(VT_WeakNamingPair), + myWeakNamingPair(theType, + std::pair(theContextName, theIndex)) { } - -ModelHighAPI_Selection::~ModelHighAPI_Selection() -{ -} +ModelHighAPI_Selection::~ModelHighAPI_Selection() {} //-------------------------------------------------------------------------------------- void ModelHighAPI_Selection::fillAttribute( - const std::shared_ptr & theAttribute) const -{ - switch(myVariantType) { - case VT_Empty: return; - case VT_ResultSubShapePair: - theAttribute->setValue(myResultSubShapePair.first, myResultSubShapePair.second); - return; - case VT_TypeSubShapeNamePair: - theAttribute->selectSubShape(myTypeSubShapeNamePair.first, myTypeSubShapeNamePair.second); - break; - case VT_TypeInnerPointPair: - theAttribute->selectSubShape(myTypeInnerPointPair.first, myTypeInnerPointPair.second); - return; - case VT_WeakNamingPair: - theAttribute->selectSubShape( - myWeakNamingPair.first, myWeakNamingPair.second.first, myWeakNamingPair.second.second); - break; - case VT_Filtering: - break; // do nothing [to avoid compilation warning] + const std::shared_ptr &theAttribute) const { + switch (myVariantType) { + case VT_Empty: + return; + case VT_ResultSubShapePair: + theAttribute->setValue(myResultSubShapePair.first, + myResultSubShapePair.second); + return; + case VT_TypeSubShapeNamePair: + theAttribute->selectSubShape(myTypeSubShapeNamePair.first, + myTypeSubShapeNamePair.second); + break; + case VT_TypeInnerPointPair: + theAttribute->selectSubShape(myTypeInnerPointPair.first, + myTypeInnerPointPair.second); + return; + case VT_WeakNamingPair: + theAttribute->selectSubShape(myWeakNamingPair.first, + myWeakNamingPair.second.first, + myWeakNamingPair.second.second); + break; + case VT_Filtering: + break; // do nothing [to avoid compilation warning] } if (theAttribute->isInvalid()) { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); - aFeature->setError( - std::string("Error: attribute \"") + theAttribute->id() + std::string("\" is invalid.")); + aFeature->setError(std::string("Error: attribute \"") + theAttribute->id() + + std::string("\" is invalid.")); } } //-------------------------------------------------------------------------------------- void ModelHighAPI_Selection::appendToList( - const std::shared_ptr & theAttribute) const -{ - switch(myVariantType) { - case VT_Empty: return; - case VT_ResultSubShapePair: - theAttribute->append(myResultSubShapePair.first, myResultSubShapePair.second); - return; - case VT_TypeSubShapeNamePair: - // Note: the reverse order (first - type, second - sub-shape name) - theAttribute->append(myTypeSubShapeNamePair.second, myTypeSubShapeNamePair.first); - return; - case VT_TypeInnerPointPair: - // Note: the reverse order (first - type, second - selected point) - theAttribute->append(myTypeInnerPointPair.second, myTypeInnerPointPair.first); - return; - case VT_WeakNamingPair: - // Note: the reverse order (first - type, second - selected point) - theAttribute->append( - myWeakNamingPair.first, myWeakNamingPair.second.first, myWeakNamingPair.second.second); - return; - case VT_Filtering: - theAttribute->setFilters(myFilterFeature); - return; + const std::shared_ptr &theAttribute) + const { + switch (myVariantType) { + case VT_Empty: + return; + case VT_ResultSubShapePair: + theAttribute->append(myResultSubShapePair.first, + myResultSubShapePair.second); + return; + case VT_TypeSubShapeNamePair: + // Note: the reverse order (first - type, second - sub-shape name) + theAttribute->append(myTypeSubShapeNamePair.second, + myTypeSubShapeNamePair.first); + return; + case VT_TypeInnerPointPair: + // Note: the reverse order (first - type, second - selected point) + theAttribute->append(myTypeInnerPointPair.second, + myTypeInnerPointPair.first); + return; + case VT_WeakNamingPair: + // Note: the reverse order (first - type, second - selected point) + theAttribute->append(myWeakNamingPair.first, myWeakNamingPair.second.first, + myWeakNamingPair.second.second); + return; + case VT_Filtering: + theAttribute->setFilters(myFilterFeature); + return; } } //================================================================================================== -ModelHighAPI_Selection::VariantType ModelHighAPI_Selection::variantType() const -{ +ModelHighAPI_Selection::VariantType +ModelHighAPI_Selection::variantType() const { return myVariantType; } //================================================================================================== -ResultSubShapePair ModelHighAPI_Selection::resultSubShapePair() const -{ +ResultSubShapePair ModelHighAPI_Selection::resultSubShapePair() const { return myResultSubShapePair; } //================================================================================================== -TypeSubShapeNamePair ModelHighAPI_Selection::typeSubShapeNamePair() const -{ +TypeSubShapeNamePair ModelHighAPI_Selection::typeSubShapeNamePair() const { return myTypeSubShapeNamePair; } //================================================================================================== -TypeInnerPointPair ModelHighAPI_Selection::typeInnerPointPair() const -{ +TypeInnerPointPair ModelHighAPI_Selection::typeInnerPointPair() const { return myTypeInnerPointPair; } //================================================================================================== -TypeWeakNamingPair ModelHighAPI_Selection::typeWeakNamingPair() const -{ +TypeWeakNamingPair ModelHighAPI_Selection::typeWeakNamingPair() const { return myWeakNamingPair; } //================================================================================================== -std::string ModelHighAPI_Selection::shapeType() const -{ - switch(myVariantType) { +std::string ModelHighAPI_Selection::shapeType() const { + switch (myVariantType) { case VT_ResultSubShapePair: - return myResultSubShapePair.second.get() ? myResultSubShapePair.second->shapeTypeStr() : - myResultSubShapePair.first->shape()->shapeTypeStr(); - case VT_TypeSubShapeNamePair: return myTypeSubShapeNamePair.first; - case VT_TypeInnerPointPair: return myTypeInnerPointPair.first; + return myResultSubShapePair.second.get() + ? myResultSubShapePair.second->shapeTypeStr() + : myResultSubShapePair.first->shape()->shapeTypeStr(); + case VT_TypeSubShapeNamePair: + return myTypeSubShapeNamePair.first; + case VT_TypeInnerPointPair: + return myTypeInnerPointPair.first; default: break; // do nothing [to avoid compilation warning] } @@ -188,19 +186,17 @@ std::string ModelHighAPI_Selection::shapeType() const } //================================================================================================== -void ModelHighAPI_Selection::setName(const std::wstring& theName) -{ +void ModelHighAPI_Selection::setName(const std::wstring &theName) { if (myVariantType == VT_ResultSubShapePair) { std::shared_ptr aResult = myResultSubShapePair.first; - if(!aResult.get()) { + if (!aResult.get()) { return; } aResult->data()->setName(theName); } } -std::wstring ModelHighAPI_Selection::name() const -{ +std::wstring ModelHighAPI_Selection::name() const { if (myVariantType == VT_ResultSubShapePair) { std::shared_ptr aResult = myResultSubShapePair.first; if (aResult.get()) @@ -209,72 +205,71 @@ std::wstring ModelHighAPI_Selection::name() const return std::wstring(); } -void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue, bool random) -{ - if (myVariantType != VT_ResultSubShapePair || !myResultSubShapePair.first.get()) +void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue, + bool random) { + if (myVariantType != VT_ResultSubShapePair || + !myResultSubShapePair.first.get()) return; AttributeIntArrayPtr aColor = myResultSubShapePair.first->data()->intArray(ModelAPI_Result::COLOR_ID()); aColor->setSize(3); - if (random) - { + if (random) { std::vector aValues; ModelAPI_Tools::findRandomColor(aValues); for (int anIndex = 0; anIndex < 3; ++anIndex) aColor->setValue(anIndex, aValues[anIndex]); - } - else - { + } else { aColor->setValue(0, theRed); aColor->setValue(1, theGreen); aColor->setValue(2, theBlue); } } -void ModelHighAPI_Selection::setDeflection(double theValue) -{ - if (myVariantType != VT_ResultSubShapePair || !myResultSubShapePair.first.get()) +void ModelHighAPI_Selection::setDeflection(double theValue) { + if (myVariantType != VT_ResultSubShapePair || + !myResultSubShapePair.first.get()) return; - AttributeDoublePtr aDeflectionAttr = - myResultSubShapePair.first->data()->real(ModelAPI_Result::DEFLECTION_ID()); + AttributeDoublePtr aDeflectionAttr = myResultSubShapePair.first->data()->real( + ModelAPI_Result::DEFLECTION_ID()); aDeflectionAttr->setValue(theValue); } // LCOV_EXCL_START -void ModelHighAPI_Selection::setTransparency(double theValue) -{ - if (myVariantType != VT_ResultSubShapePair || !myResultSubShapePair.first.get()) +void ModelHighAPI_Selection::setTransparency(double theValue) { + if (myVariantType != VT_ResultSubShapePair || + !myResultSubShapePair.first.get()) return; AttributeDoublePtr aTransparencyAttr = - myResultSubShapePair.first->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + myResultSubShapePair.first->data()->real( + ModelAPI_Result::TRANSPARENCY_ID()); aTransparencyAttr->setValue(theValue); } // LCOV_EXCL_STOP -int ModelHighAPI_Selection::numberOfSubs() const -{ +int ModelHighAPI_Selection::numberOfSubs() const { if (myVariantType != VT_ResultSubShapePair) return 0; - ResultBodyPtr aBody = std::dynamic_pointer_cast(myResultSubShapePair.first); + ResultBodyPtr aBody = std::dynamic_pointer_cast( + myResultSubShapePair.first); if (!aBody.get()) return 0; return aBody->numberOfSubs(); } -ModelHighAPI_Selection ModelHighAPI_Selection::subResult(int theIndex) const -{ +ModelHighAPI_Selection ModelHighAPI_Selection::subResult(int theIndex) const { if (myVariantType != VT_ResultSubShapePair) return ModelHighAPI_Selection(); - ResultBodyPtr aBody = std::dynamic_pointer_cast(myResultSubShapePair.first); + ResultBodyPtr aBody = std::dynamic_pointer_cast( + myResultSubShapePair.first); if (!aBody) return ModelHighAPI_Selection(); if (theIndex >= aBody->numberOfSubs()) diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.h b/src/ModelHighAPI/ModelHighAPI_Selection.h index 248ed51e2..6404cf72d 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.h +++ b/src/ModelHighAPI/ModelHighAPI_Selection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_ @@ -35,18 +36,18 @@ class ModelAPI_AttributeSelectionList; class ModelAPI_FiltersFeature; class ModelAPI_Result; //-------------------------------------------------------------------------------------- -typedef std::pair, std::shared_ptr > - ResultSubShapePair; +typedef std::pair, + std::shared_ptr> + ResultSubShapePair; typedef std::pair TypeSubShapeNamePair; -typedef std::pair > TypeInnerPointPair; -typedef std::pair > TypeWeakNamingPair; +typedef std::pair> TypeInnerPointPair; +typedef std::pair> TypeWeakNamingPair; //-------------------------------------------------------------------------------------- /**\class ModelHighAPI_Selection * \ingroup CPPHighAPI * \brief Class for filling ModelAPI_AttributeSelection */ -class ModelHighAPI_Selection -{ +class ModelHighAPI_Selection { public: enum VariantType { VT_Empty, @@ -64,41 +65,43 @@ public: /// Constructor for result and sub-shape MODELHIGHAPI_EXPORT - ModelHighAPI_Selection(const std::shared_ptr& theContext, - const std::shared_ptr& theSubShape = - std::shared_ptr()); + ModelHighAPI_Selection(const std::shared_ptr &theContext, + const std::shared_ptr &theSubShape = + std::shared_ptr()); /// Constructor for sub-shape by the textual Name MODELHIGHAPI_EXPORT - ModelHighAPI_Selection(const std::string& theType, - const std::wstring& theSubShapeName); + ModelHighAPI_Selection(const std::string &theType, + const std::wstring &theSubShapeName); /// Constructor for sub-shape by inner point coordinates MODELHIGHAPI_EXPORT - ModelHighAPI_Selection(const std::string& theType, - const std::shared_ptr& theSubShapeInnerPoint); + ModelHighAPI_Selection( + const std::string &theType, + const std::shared_ptr &theSubShapeInnerPoint); /// Constructor for sub-shape by inner point coordinates given by a tuple MODELHIGHAPI_EXPORT - ModelHighAPI_Selection(const std::string& theType, - const std::list& theSubShapeInnerPoint); - + ModelHighAPI_Selection(const std::string &theType, + const std::list &theSubShapeInnerPoint); /// Constructor for sub-shape by weak naming identifier MODELHIGHAPI_EXPORT - ModelHighAPI_Selection(const std::string& theType, - const std::wstring& theContextName, const int theIndex); + ModelHighAPI_Selection(const std::string &theType, + const std::wstring &theContextName, + const int theIndex); /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Selection(); /// Fill attribute values - MODELHIGHAPI_EXPORT virtual - void fillAttribute(const std::shared_ptr & theAttribute) const; + MODELHIGHAPI_EXPORT virtual void fillAttribute( + const std::shared_ptr &theAttribute) const; /// Append to list attribute - MODELHIGHAPI_EXPORT virtual - void appendToList(const std::shared_ptr & theAttribute) const; + MODELHIGHAPI_EXPORT virtual void appendToList( + const std::shared_ptr &theAttribute) + const; /// \return variant type. MODELHIGHAPI_EXPORT @@ -116,9 +119,10 @@ public: MODELHIGHAPI_EXPORT virtual TypeInnerPointPair typeInnerPointPair() const; - /// \return pair of sub-shape type and pair of context name and sub-shape index. + /// \return pair of sub-shape type and pair of context name and sub-shape + /// index. MODELHIGHAPI_EXPORT - virtual TypeWeakNamingPair typeWeakNamingPair() const; + virtual TypeWeakNamingPair typeWeakNamingPair() const; /// \return shape type. MODELHIGHAPI_EXPORT @@ -126,7 +130,7 @@ public: /// Shortcut for result()->data()->setName() MODELHIGHAPI_EXPORT - void setName(const std::wstring& theName); + void setName(const std::wstring &theName); /// Shortcut for result()->data()->name() MODELHIGHAPI_EXPORT @@ -134,7 +138,8 @@ public: /// Change result's color MODELHIGHAPI_EXPORT - void setColor(int theRed = 0, int theGreen = 0, int theBlue = 0, bool random = false); + void setColor(int theRed = 0, int theGreen = 0, int theBlue = 0, + bool random = false); /// Change result's deflection MODELHIGHAPI_EXPORT diff --git a/src/ModelHighAPI/ModelHighAPI_Services.cpp b/src/ModelHighAPI/ModelHighAPI_Services.cpp index 6dcaa5ae7..5a03a740f 100644 --- a/src/ModelHighAPI/ModelHighAPI_Services.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Services.cpp @@ -14,65 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Services.h" //-------------------------------------------------------------------------------------- #include #include -#include #include -#include #include +#include #include +#include #include #include //-------------------------------------------------------------------------------------- -std::shared_ptr moduleDocument() -{ +std::shared_ptr moduleDocument() { return ModelAPI_Session::get()->moduleDocument(); } //-------------------------------------------------------------------------------------- -std::shared_ptr activeDocument() -{ +std::shared_ptr activeDocument() { return ModelAPI_Session::get()->activeDocument(); } //-------------------------------------------------------------------------------------- -std::shared_ptr defaultPlane( const std::wstring& theName ) -{ +std::shared_ptr defaultPlane(const std::wstring &theName) { std::shared_ptr o(new GeomAPI_Pnt(0, 0, 0)); std::shared_ptr n, x; if (theName == L"XOY") { - n.reset(new GeomAPI_Dir(0, 0, 1)); - x.reset(new GeomAPI_Dir(1, 0, 0)); + n.reset(new GeomAPI_Dir(0, 0, 1)); + x.reset(new GeomAPI_Dir(1, 0, 0)); } else if (theName == L"XOZ") { - n.reset(new GeomAPI_Dir(0, -1, 0)); - x.reset(new GeomAPI_Dir(1, 0, 0)); + n.reset(new GeomAPI_Dir(0, -1, 0)); + x.reset(new GeomAPI_Dir(1, 0, 0)); } else if (theName == L"YOZ") { - n.reset(new GeomAPI_Dir(1, 0, 0)); - x.reset(new GeomAPI_Dir(0, 1, 0)); + n.reset(new GeomAPI_Dir(1, 0, 0)); + x.reset(new GeomAPI_Dir(0, 1, 0)); } return std::shared_ptr(new GeomAPI_Ax3(o, x, n)); } -std::wstring defaultPlane(const std::shared_ptr& theOrigin, - const std::shared_ptr& theNormal, - const std::shared_ptr& theDirX) -{ +std::wstring defaultPlane(const std::shared_ptr &theOrigin, + const std::shared_ptr &theNormal, + const std::shared_ptr &theDirX) { static const double aTol = 1.e-10; - if (fabs(theOrigin->x()) > aTol || fabs(theOrigin->y()) > aTol || fabs(theOrigin->z()) > aTol) + if (fabs(theOrigin->x()) > aTol || fabs(theOrigin->y()) > aTol || + fabs(theOrigin->z()) > aTol) return std::wstring(); // XOY or XOZ - if (fabs(theNormal->x()) < aTol && - fabs(theDirX->x() - 1.0) < aTol && fabs(theDirX->y()) < aTol && fabs(theDirX->z()) < aTol) { + if (fabs(theNormal->x()) < aTol && fabs(theDirX->x() - 1.0) < aTol && + fabs(theDirX->y()) < aTol && fabs(theDirX->z()) < aTol) { // XOY if (fabs(theNormal->y()) < aTol && fabs(theNormal->z() - 1.0) < aTol) return std::wstring(L"XOY"); @@ -80,25 +78,23 @@ std::wstring defaultPlane(const std::shared_ptr& theOrigin, return std::wstring(L"XOZ"); } // YOZ - else if (fabs(theNormal->x() - 1.0) < aTol && - fabs(theNormal->y()) < aTol && fabs(theNormal->z()) < aTol && - fabs(theDirX->x()) < aTol && fabs(theDirX->y() - 1.0) < aTol && - fabs(theDirX->z()) < aTol) + else if (fabs(theNormal->x() - 1.0) < aTol && fabs(theNormal->y()) < aTol && + fabs(theNormal->z()) < aTol && fabs(theDirX->x()) < aTol && + fabs(theDirX->y() - 1.0) < aTol && fabs(theDirX->z()) < aTol) return std::wstring(L"YOZ"); return std::wstring(); } -std::shared_ptr standardPlane(const std::wstring & theName){ +std::shared_ptr standardPlane(const std::wstring &theName) { DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument(); // searching for the construction element return std::dynamic_pointer_cast( - aPartSet->objectByName(ModelAPI_ResultConstruction::group(), theName)); + aPartSet->objectByName(ModelAPI_ResultConstruction::group(), theName)); } //-------------------------------------------------------------------------------------- -void begin() -{ +void begin() { static int aTransactionID = 0; static int aNbTransactions = -1; int aNbUndo = (int)ModelAPI_Session::get()->undoList().size(); @@ -109,24 +105,28 @@ void begin() } std::ostringstream aTransactionName; aTransactionName << "Operation_" << aTransactionID; - - // check the first transaction and part, automatically created on start of PartSet + + // check the first transaction and part, automatically created on start of + // PartSet std::shared_ptr aSession = ModelAPI_Session::get(); - if (aSession->undoList().empty() && aSession->redoList().empty() && // no undo/redo available - aSession->moduleDocument()->size(ModelAPI_ResultPart::group()) == 1 && // only one part - aSession->moduleDocument()->size(ModelAPI_Feature::group()) == 1) // only part feature + if (aSession->undoList().empty() && + aSession->redoList().empty() && // no undo/redo available + aSession->moduleDocument()->size(ModelAPI_ResultPart::group()) == + 1 && // only one part + aSession->moduleDocument()->size(ModelAPI_Feature::group()) == + 1) // only part feature { - ResultPartPtr aPartRes = std::dynamic_pointer_cast - (aSession->moduleDocument()->object(ModelAPI_ResultPart::group(), 0)); - if (aPartRes.get() && aPartRes->isActivated()) - { + ResultPartPtr aPartRes = std::dynamic_pointer_cast( + aSession->moduleDocument()->object(ModelAPI_ResultPart::group(), 0)); + if (aPartRes.get() && aPartRes->isActivated()) { DocumentPtr aPartDoc = aPartRes->partDoc(); - if (aPartDoc.get() && aPartDoc->size(ModelAPI_Feature::group()) == 0) // no features in part + if (aPartDoc.get() && + aPartDoc->size(ModelAPI_Feature::group()) == 0) // no features in part { // remove the automtically created part aSession->startOperation("Delete automatic part"); FeaturePtr aPartFeature = std::dynamic_pointer_cast( - aSession->moduleDocument()->object(ModelAPI_Feature::group(), 0)); + aSession->moduleDocument()->object(ModelAPI_Feature::group(), 0)); aSession->setActiveDocument(aSession->moduleDocument()); aSession->moduleDocument()->removeFeature(aPartFeature); aSession->finishOperation(); @@ -138,14 +138,14 @@ void begin() aSession->startOperation(aTransactionName.str()); } -void end() -{ - // some operations make the current feature not the last one (like "galeries" change parameters) +void end() { + // some operations make the current feature not the last one (like "galeries" + // change parameters) DocumentPtr anActive = ModelAPI_Session::get()->activeDocument(); int aSize = anActive->size("Features"); if (aSize > 0) { - FeaturePtr aLastFeat = - std::dynamic_pointer_cast(anActive->object("Features", aSize - 1)); + FeaturePtr aLastFeat = std::dynamic_pointer_cast( + anActive->object("Features", aSize - 1)); anActive->setCurrentFeature(aLastFeat, true); } @@ -153,35 +153,24 @@ void end() // to update data tree in the end of dumped script execution ModelAPI_EventCreator::get()->sendReordered(FeaturePtr()); } -void apply() -{ +void apply() { auto aSession = ModelAPI_Session::get(); aSession->finishOperation(); // start the next operation begin(); } -void updateFeatures() -{ - Events_Loop* aLoop = Events_Loop::loop(); +void updateFeatures() { + Events_Loop *aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } //-------------------------------------------------------------------------------------- -void undo() -{ - ModelAPI_Session::get()->undo(); -} -void redo() -{ - ModelAPI_Session::get()->redo(); -} +void undo() { ModelAPI_Session::get()->undo(); } +void redo() { ModelAPI_Session::get()->redo(); } //-------------------------------------------------------------------------------------- -void reset() -{ - ModelAPI_Session::get()->closeAll(); -} +void reset() { ModelAPI_Session::get()->closeAll(); } //-------------------------------------------------------------------------------------- diff --git a/src/ModelHighAPI/ModelHighAPI_Services.h b/src/ModelHighAPI/ModelHighAPI_Services.h index 64efd6e6b..80515e8d6 100644 --- a/src/ModelHighAPI/ModelHighAPI_Services.h +++ b/src/ModelHighAPI/ModelHighAPI_Services.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_ @@ -38,31 +39,34 @@ std::shared_ptr moduleDocument(); /** Return the active document. * - * This document can be either the main application document (i.e. the Partset) or one of documents - * referred to by the main document (a Part). + * This document can be either the main application document (i.e. the Partset) + * or one of documents referred to by the main document (a Part). */ MODELHIGHAPI_EXPORT std::shared_ptr activeDocument(); /** Return one of the three planes defined by the global coordinate system. * - * These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0). + * These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) + * or "YOZ" (X=0). */ MODELHIGHAPI_EXPORT -std::shared_ptr defaultPlane(const std::wstring & theName); +std::shared_ptr defaultPlane(const std::wstring &theName); -/// Return name of coordinate plane ("XOY", "XOZ" or "YOZ") or empty string for other planes. +/// Return name of coordinate plane ("XOY", "XOZ" or "YOZ") or empty string for +/// other planes. MODELHIGHAPI_EXPORT -std::wstring defaultPlane(const std::shared_ptr& theOrigin, - const std::shared_ptr& theNormal, - const std::shared_ptr& theDirX); +std::wstring defaultPlane(const std::shared_ptr &theOrigin, + const std::shared_ptr &theNormal, + const std::shared_ptr &theDirX); /** Return one of the three standard results defined in PartSet document. * - * These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0). + * These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) + * or "YOZ" (X=0). */ MODELHIGHAPI_EXPORT -std::shared_ptr standardPlane(const std::wstring & theName); +std::shared_ptr standardPlane(const std::wstring &theName); /** Start a data structure transaction. * diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.cpp b/src/ModelHighAPI/ModelHighAPI_Tools.cpp index 67824fd33..2f896a5e4 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModelHighAPI_Tools.h" @@ -41,17 +42,16 @@ #include #include #include -#include #include +#include #include #include #include #include -#include +#include +#include #include #include -#include -#include //-------------------------------------------------------------------------------------- #include //-------------------------------------------------------------------------------------- @@ -70,110 +70,107 @@ #include //-------------------------------------------------------------------------------------- -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute(const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } -void fillAttribute(const std::shared_ptr & theAttribute, - double theX, double theY) -{ +void fillAttribute(const std::shared_ptr &theAttribute, + double theX, double theY) { theAttribute->setValue(theX, theY); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute(const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute(const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(bool theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + bool theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const ModelHighAPI_Double & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const ModelHighAPI_Double &theValue, + const std::shared_ptr &theAttribute) { theValue.fillAttribute(theAttribute); } -void fillAttribute(double theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + double theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const ModelHighAPI_Integer & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const ModelHighAPI_Integer &theValue, + const std::shared_ptr &theAttribute) { theValue.fillAttribute(theAttribute); } -void fillAttribute(int theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + int theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const ModelHighAPI_RefAttr & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const ModelHighAPI_RefAttr &theValue, + const std::shared_ptr &theAttribute) { theValue.fillAttribute(theAttribute); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->clear(); for (auto it = theValue.begin(); it != theValue.end(); ++it) it->appendToList(theAttribute); } //-------------------------------------------------------------------------------------- -void fillAttribute(const ModelHighAPI_Reference & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const ModelHighAPI_Reference &theValue, + const std::shared_ptr &theAttribute) { theValue.fillAttribute(theAttribute); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->clear(); for (auto it = theValue.begin(); it != theValue.end(); ++it) it->appendToList(theAttribute); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list > & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list> &theValue, + const std::shared_ptr &theAttribute) { int aSize = theAttribute->size(); // keep objects at the beginning of the list if they the same auto it = theValue.begin(); - for (int anIndex = 0; it != theValue.end() && anIndex < aSize; ++it, ++anIndex) + for (int anIndex = 0; it != theValue.end() && anIndex < aSize; + ++it, ++anIndex) if (theAttribute->object(anIndex) != *it) { // remove the tail of the list while (++anIndex <= aSize) @@ -186,9 +183,9 @@ void fillAttribute(const std::list > & theValue } MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->clear(); for (auto it = theValue.begin(); it != theValue.end(); ++it) { if (it->resultSubShapePair().first) @@ -197,20 +194,20 @@ void fillAttribute(const std::list & theValue, } //-------------------------------------------------------------------------------------- -void fillAttribute(const ModelHighAPI_Selection & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const ModelHighAPI_Selection &theValue, + const std::shared_ptr &theAttribute) { theValue.fillAttribute(theAttribute); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->clear(); - if(!theValue.empty() && theAttribute->selectionType().empty()) { - const ModelHighAPI_Selection& aSelection = theValue.front(); + if (!theValue.empty() && theAttribute->selectionType().empty()) { + const ModelHighAPI_Selection &aSelection = theValue.front(); GeomAPI_Shape::ShapeType aSelectionType = getShapeType(aSelection); theAttribute->setSelectionType(strByShapeType(aSelectionType)); } @@ -220,30 +217,30 @@ void fillAttribute(const std::list & theValue, } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::string & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::string &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::wstring & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::wstring &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const char * theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const char *theValue, + const std::shared_ptr &theAttribute) { theAttribute->setValue(theValue); } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setSize(int(theValue.size())); int anIndex = 0; @@ -252,31 +249,33 @@ void fillAttribute(const std::list & theValue, } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setSize(int(theValue.size())); int anIndex = 0; for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex) - theAttribute->setValue(anIndex, it->intValue()); // use only values, no text support in array + theAttribute->setValue( + anIndex, it->intValue()); // use only values, no text support in array } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setSize(int(theValue.size())); int anIndex = 0; for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex) - theAttribute->setValue(anIndex, it->value()); // use only values, no text support in array + theAttribute->setValue( + anIndex, it->value()); // use only values, no text support in array } //-------------------------------------------------------------------------------------- -void fillAttribute(const std::list > & theValue, - const std::shared_ptr & theAttribute) -{ +void fillAttribute( + const std::list> &theValue, + const std::shared_ptr &theAttribute) { theAttribute->setSize(int(theValue.size())); int anIndex = 0; @@ -285,47 +284,45 @@ void fillAttribute(const std::list > & theValue, } //-------------------------------------------------------------------------------------- -void fillAttribute(const ModelHighAPI_Double & theX, - const ModelHighAPI_Double & theY, - const ModelHighAPI_Double & theZ, - const std::shared_ptr & theAttribute) -{ +void fillAttribute(const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ, + const std::shared_ptr &theAttribute) { theX.fillAttribute(theAttribute, theX, theY, theZ); } //================================================================================================== -GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr) -{ +GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr) { GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE; - std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(), theShapeTypeStr.begin(), + std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(), + theShapeTypeStr.begin(), [](char c) { return static_cast(::tolower(c)); }); - if(theShapeTypeStr == "compound") { + if (theShapeTypeStr == "compound") { aShapeType = GeomAPI_Shape::COMPOUND; - } else if(theShapeTypeStr == "compsolid") { + } else if (theShapeTypeStr == "compsolid") { aShapeType = GeomAPI_Shape::COMPSOLID; - } else if(theShapeTypeStr == "solid") { + } else if (theShapeTypeStr == "solid") { aShapeType = GeomAPI_Shape::SOLID; - } else if(theShapeTypeStr == "shell") { + } else if (theShapeTypeStr == "shell") { aShapeType = GeomAPI_Shape::SHELL; - } else if(theShapeTypeStr == "face") { + } else if (theShapeTypeStr == "face") { aShapeType = GeomAPI_Shape::FACE; - } else if(theShapeTypeStr == "wire") { + } else if (theShapeTypeStr == "wire") { aShapeType = GeomAPI_Shape::WIRE; - } else if(theShapeTypeStr == "edge") { + } else if (theShapeTypeStr == "edge") { aShapeType = GeomAPI_Shape::EDGE; - } else if(theShapeTypeStr == "vertex") { + } else if (theShapeTypeStr == "vertex") { aShapeType = GeomAPI_Shape::VERTEX; - } else if(theShapeTypeStr == "shape") { + } else if (theShapeTypeStr == "shape") { aShapeType = GeomAPI_Shape::SHAPE; } return aShapeType; } -std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType) -{ +std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType) { std::string aShapeTypeStr; switch (theShapeType) { case GeomAPI_Shape::COMPOUND: @@ -360,52 +357,52 @@ std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType) } //================================================================================================== -GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection) -{ +GeomAPI_Shape::ShapeType +getShapeType(const ModelHighAPI_Selection &theSelection) { GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE; - switch(theSelection.variantType()) { - case ModelHighAPI_Selection::VT_ResultSubShapePair: { - ResultSubShapePair aPair = theSelection.resultSubShapePair(); - GeomShapePtr aShape = aPair.second; - if(!aShape.get() && aPair.first.get()) { - aShape = aPair.first->shape(); - } - if(!aShape.get()) { - return aShapeType; - } - aShapeType = aShape->shapeType(); - break; - } - case ModelHighAPI_Selection::VT_TypeSubShapeNamePair: { - TypeSubShapeNamePair aPair = theSelection.typeSubShapeNamePair(); - std::string aType = aPair.first; - aShapeType = shapeTypeByStr(aType); - break; + switch (theSelection.variantType()) { + case ModelHighAPI_Selection::VT_ResultSubShapePair: { + ResultSubShapePair aPair = theSelection.resultSubShapePair(); + GeomShapePtr aShape = aPair.second; + if (!aShape.get() && aPair.first.get()) { + aShape = aPair.first->shape(); } - case ModelHighAPI_Selection::VT_TypeInnerPointPair: { - TypeInnerPointPair aPair = theSelection.typeInnerPointPair(); - std::string aType = aPair.first; - aType = aType.substr(0, aType.find_first_of('_')); - aShapeType = shapeTypeByStr(aType); - break; + if (!aShape.get()) { + return aShapeType; } - case ModelHighAPI_Selection::VT_WeakNamingPair: { - TypeWeakNamingPair aPair = theSelection.typeWeakNamingPair(); - std::string aType = aPair.first; - aShapeType = shapeTypeByStr(aType); - break; - } - default: - break; // do nothing [to avoid compilation warning] + aShapeType = aShape->shapeType(); + break; + } + case ModelHighAPI_Selection::VT_TypeSubShapeNamePair: { + TypeSubShapeNamePair aPair = theSelection.typeSubShapeNamePair(); + std::string aType = aPair.first; + aShapeType = shapeTypeByStr(aType); + break; + } + case ModelHighAPI_Selection::VT_TypeInnerPointPair: { + TypeInnerPointPair aPair = theSelection.typeInnerPointPair(); + std::string aType = aPair.first; + aType = aType.substr(0, aType.find_first_of('_')); + aShapeType = shapeTypeByStr(aType); + break; + } + case ModelHighAPI_Selection::VT_WeakNamingPair: { + TypeWeakNamingPair aPair = theSelection.typeWeakNamingPair(); + std::string aType = aPair.first; + aShapeType = shapeTypeByStr(aType); + break; + } + default: + break; // do nothing [to avoid compilation warning] } return aShapeType; } //-------------------------------------------------------------------------------------- -ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr) -{ +ModelAPI_AttributeTables::ValueType +valueTypeByStr(const std::string &theValueTypeStr) { std::string aType = theValueTypeStr; std::transform(aType.begin(), aType.end(), aType.begin(), [](char c) { return static_cast(::tolower(c)); }); @@ -419,40 +416,51 @@ ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTy } //-------------------------------------------------------------------------------------- -std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType) -{ - switch(theType) { - case ModelAPI_AttributeTables::BOOLEAN: return "BOOLEAN"; - case ModelAPI_AttributeTables::INTEGER: return "INTEGER"; - case ModelAPI_AttributeTables::DOUBLE: return "DOUBLE"; - case ModelAPI_AttributeTables::STRING: return "STRING"; +std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType) { + switch (theType) { + case ModelAPI_AttributeTables::BOOLEAN: + return "BOOLEAN"; + case ModelAPI_AttributeTables::INTEGER: + return "INTEGER"; + case ModelAPI_AttributeTables::DOUBLE: + return "DOUBLE"; + case ModelAPI_AttributeTables::STRING: + return "STRING"; } return ""; // bad case } /// stores the features information, recursively stores sub-documents features -std::string storeFeatures(const std::wstring& theDocName, DocumentPtr theDoc, - std::map >& theStore, - const bool theCompare) // if false => store -{ - std::map >::iterator aDocFind; +std::string storeFeatures( + const std::wstring &theDocName, DocumentPtr theDoc, + std::map> + &theStore, + const bool theCompare) // if false => store +{ + std::map>::iterator + aDocFind; if (theCompare) { - aDocFind = theStore.find(theDocName); - if (aDocFind == theStore.end()) { - return "Document '" + Locale::Convert::toString(theDocName) + "' not found"; - } + aDocFind = theStore.find(theDocName); + if (aDocFind == theStore.end()) { + return "Document '" + Locale::Convert::toString(theDocName) + + "' not found"; + } } // store the model features information: iterate all features - size_t anObjectsCount = 0; // stores the number of compared features for this document to compare - std::set aProcessed; // processed features names (that are in the current document) + size_t anObjectsCount = + 0; // stores the number of compared features for this document to compare + std::set + aProcessed; // processed features names (that are in the current document) // process all objects (features and folders) std::list allObjects = theDoc->allObjects(); std::list::iterator allIter = allObjects.begin(); - for(; allIter != allObjects.end(); allIter++) { + for (; allIter != allObjects.end(); allIter++) { ObjectPtr anObject = *allIter; FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); - //if (aFeature && aFeature->getKind() == "SketchConstraintCoincidenceInternal") + // if (aFeature && aFeature->getKind() == + // "SketchConstraintCoincidenceInternal") if (aFeature) { std::string aStr = aFeature->getKind().substr(0, 16); @@ -460,21 +468,25 @@ std::string storeFeatures(const std::wstring& theDocName, DocumentPtr theDoc, continue; // no need to dump and check constraints } if (theCompare) { - std::map::iterator - anObjFind = aDocFind->second.find(anObject->data()->name()); + std::map::iterator anObjFind = + aDocFind->second.find(anObject->data()->name()); if (anObjFind == aDocFind->second.end()) { - return "Document '" + Locale::Convert::toString(theDocName) - + "' feature '" + Locale::Convert::toString(anObject->data()->name()) + "' not found"; + return "Document '" + Locale::Convert::toString(theDocName) + + "' feature '" + + Locale::Convert::toString(anObject->data()->name()) + + "' not found"; } std::string anError = anObjFind->second.compare(anObject); if (!anError.empty()) { - anError = "Document " + Locale::Convert::toString(theDocName) + " " + anError; + anError = + "Document " + Locale::Convert::toString(theDocName) + " " + anError; return anError; } anObjectsCount++; aProcessed.insert(anObject->data()->name()); } else { - theStore[theDocName][anObject->data()->name()] = ModelHighAPI_FeatureStore(anObject); + theStore[theDocName][anObject->data()->name()] = + ModelHighAPI_FeatureStore(anObject); } if (aFeature) { @@ -482,13 +494,14 @@ std::string storeFeatures(const std::wstring& theDocName, DocumentPtr theDoc, std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); std::list::iterator aRes = allResults.begin(); - for(; aRes != allResults.end(); aRes++) { + for (; aRes != allResults.end(); aRes++) { // recursively store features of sub-documents if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { - DocumentPtr aDoc = std::dynamic_pointer_cast(*aRes)->partDoc(); + DocumentPtr aDoc = + std::dynamic_pointer_cast(*aRes)->partDoc(); if (aDoc.get()) { - std::string anError = - storeFeatures((*aRes)->data()->name(), aDoc, theStore, theCompare); + std::string anError = storeFeatures((*aRes)->data()->name(), aDoc, + theStore, theCompare); if (!anError.empty()) return anError; } @@ -502,27 +515,28 @@ std::string storeFeatures(const std::wstring& theDocName, DocumentPtr theDoc, // search for disappeared feature std::wstring aLostName; std::map::iterator aLostIter; - for(aLostIter = aDocFind->second.begin(); aLostIter != aDocFind->second.end(); aLostIter++) { + for (aLostIter = aDocFind->second.begin(); + aLostIter != aDocFind->second.end(); aLostIter++) { if (aProcessed.find(aLostIter->first) == aProcessed.end()) { aLostName = aLostIter->first; } } return "For document '" + Locale::Convert::toString(theDocName) + - "' the number of features is decreased, there is no feature '" + - Locale::Convert::toString(aLostName) + "'"; + "' the number of features is decreased, there is no feature '" + + Locale::Convert::toString(aLostName) + "'"; } } return ""; // ok } //================================================================================================== -typedef std::map > Storage; +typedef std::map> + Storage; -static bool dumpToPython(SessionPtr theSession, - const std::string& theFilename, +static bool dumpToPython(SessionPtr theSession, const std::string &theFilename, const checkDumpType theSelectionType, - const std::string& theErrorMsgContext) -{ + const std::string &theErrorMsgContext) { // 2431: set PartSet as a current document theSession->setActiveDocument(theSession->moduleDocument(), true); // dump all to the python file @@ -533,11 +547,16 @@ static bool dumpToPython(SessionPtr theSession, aDump->string("file_format")->setValue("py"); std::string aTrek = GeomAlgoAPI_Tools::File_Tools::path(theFilename); aDump->string("dump_dir")->setValue(aTrek); - aDump->boolean("topological_naming")->setValue((theSelectionType & CHECK_NAMING) != 0); - aDump->boolean("geometric_selection")->setValue((theSelectionType & CHECK_GEOMETRICAL) != 0); - aDump->boolean("weak_naming")->setValue((theSelectionType & CHECK_WEAK) != 0); + aDump->boolean("topological_naming") + ->setValue((theSelectionType & CHECK_NAMING) != 0); + aDump->boolean("geometric_selection") + ->setValue((theSelectionType & CHECK_GEOMETRICAL) != 0); + aDump->boolean("weak_naming") + ->setValue((theSelectionType & CHECK_WEAK) != 0); } - bool isProblem = !aDump.get() || !aDump->error().empty(); // after "finish" dump will be removed + bool isProblem = + !aDump.get() || + !aDump->error().empty(); // after "finish" dump will be removed if (isProblem && aDump.get()) { std::cout << "Dump feature error " << aDump->error() << std::endl; Events_InfoMessage anErrorMsg(theErrorMsgContext, aDump->error()); @@ -547,11 +566,9 @@ static bool dumpToPython(SessionPtr theSession, return !isProblem; } -static bool checkDump(SessionPtr theSession, - const char* theFilename, - Storage& theStorage, - const std::string& theErrorMsgContext) -{ +static bool checkDump(SessionPtr theSession, const char *theFilename, + Storage &theStorage, + const std::string &theErrorMsgContext) { // close all before importation of the script theSession->closeAll(); @@ -559,14 +576,14 @@ static bool checkDump(SessionPtr theSession, // execute the dumped PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */ static char aReadMode[] = "r"; - FILE* PyFileObject = fopen(theFilename, aReadMode); + FILE *PyFileObject = fopen(theFilename, aReadMode); PyRun_SimpleFileEx(PyFileObject, theFilename, 1); PyGILState_Release(gstate); /* release python thread */ // compare with the stored data - std::string anError = - storeFeatures(Locale::Convert::toWString(theSession->moduleDocument()->kind()), - theSession->moduleDocument(), theStorage, true); + std::string anError = storeFeatures( + Locale::Convert::toWString(theSession->moduleDocument()->kind()), + theSession->moduleDocument(), theStorage, true); if (!anError.empty()) { std::cout << anError << std::endl; Events_InfoMessage anErrorMsg(theErrorMsgContext, anError); @@ -579,14 +596,12 @@ static bool checkDump(SessionPtr theSession, bool checkPyDump( #ifdef _DEBUG - const std::string&, const std::string&, const std::string&, + const std::string &, const std::string &, const std::string &, #else - const std::string& theFilenameNaming, - const std::string& theFilenameGeo, - const std::string& theFilenameWeak, + const std::string &theFilenameNaming, const std::string &theFilenameGeo, + const std::string &theFilenameWeak, #endif - const checkDumpType theCheckType) -{ + const checkDumpType theCheckType) { static const std::string anErrorByNaming("checkPythonDump by naming"); static const std::string anErrorByGeometry("checkPythonDump by geometry"); static const std::string anErrorByWeak("checkPythonDump by weak naming"); @@ -603,16 +618,20 @@ bool checkPyDump( SessionPtr aSession = ModelAPI_Session::get(); // dump with the specified types - std::string aFileName = theCheckType == CHECK_GEOMETRICAL ? aFileForGeometryDump : - (theCheckType == CHECK_WEAK ? aFileForWeakDump : aFileForNamingDump); + std::string aFileName = + theCheckType == CHECK_GEOMETRICAL + ? aFileForGeometryDump + : (theCheckType == CHECK_WEAK ? aFileForWeakDump + : aFileForNamingDump); if (!dumpToPython(aSession, aFileName, theCheckType, anErrorByNaming)) return false; - // map from document name to feature name to feature data - std::map > aStore; - std::string anError = - storeFeatures(Locale::Convert::toWString(aSession->moduleDocument()->kind()), - aSession->moduleDocument(), aStore, false); + // map from document name to feature name to feature data + std::map> + aStore; + std::string anError = storeFeatures( + Locale::Convert::toWString(aSession->moduleDocument()->kind()), + aSession->moduleDocument(), aStore, false); if (!anError.empty()) { Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError); anErrorMsg.send(); @@ -622,14 +641,17 @@ bool checkPyDump( bool isOk = true; if (theCheckType & CHECK_NAMING) { // check dump with the selection by names - isOk = checkDump(aSession, aFileForNamingDump.c_str(), aStore, anErrorByNaming); + isOk = checkDump(aSession, aFileForNamingDump.c_str(), aStore, + anErrorByNaming); } if (theCheckType & CHECK_GEOMETRICAL) { // check dump with the selection by geometry - isOk = isOk && checkDump(aSession, aFileForGeometryDump.c_str(), aStore, anErrorByGeometry); + isOk = isOk && checkDump(aSession, aFileForGeometryDump.c_str(), aStore, + anErrorByGeometry); } if (theCheckType & CHECK_WEAK) { - isOk = isOk && checkDump(aSession, aFileForWeakDump.c_str(), aStore, anErrorByWeak); + isOk = isOk && + checkDump(aSession, aFileForWeakDump.c_str(), aStore, anErrorByWeak); } return isOk; diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.h b/src/ModelHighAPI/ModelHighAPI_Tools.h index 357799d74..5ed161fd2 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.h +++ b/src/ModelHighAPI/ModelHighAPI_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ @@ -61,111 +62,132 @@ class ModelHighAPI_Reference; class ModelHighAPI_Selection; //-------------------------------------------------------------------------------------- MODELHIGHAPI_EXPORT -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute(const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::shared_ptr & theAttribute, +void fillAttribute(const std::shared_ptr &theAttribute, double theX, double theY); MODELHIGHAPI_EXPORT -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute(const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute(const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute); //-------------------------------------------------------------------------------------- MODELHIGHAPI_EXPORT -void fillAttribute(bool theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + bool theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const ModelHighAPI_Double & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const ModelHighAPI_Double &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(double theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + double theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const ModelHighAPI_Integer & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const ModelHighAPI_Integer &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(int theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + int theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const ModelHighAPI_RefAttr & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const ModelHighAPI_RefAttr &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const ModelHighAPI_Reference & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const ModelHighAPI_Reference &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::shared_ptr & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list > & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list> &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const ModelHighAPI_Selection & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const ModelHighAPI_Selection &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::string & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::string &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::wstring & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::wstring &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const char * theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const char *theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const std::list > & theValue, - const std::shared_ptr & theAttribute); +void fillAttribute( + const std::list> &theValue, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT -void fillAttribute(const ModelHighAPI_Double & theX, - const ModelHighAPI_Double & theY, - const ModelHighAPI_Double & theZ, - const std::shared_ptr & theAttribute); +void fillAttribute(const ModelHighAPI_Double &theX, + const ModelHighAPI_Double &theY, + const ModelHighAPI_Double &theZ, + const std::shared_ptr &theAttribute); MODELHIGHAPI_EXPORT GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr); @@ -174,19 +196,22 @@ MODELHIGHAPI_EXPORT std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType); MODELHIGHAPI_EXPORT -GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection); +GeomAPI_Shape::ShapeType +getShapeType(const ModelHighAPI_Selection &theSelection); MODELHIGHAPI_EXPORT -ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr); +ModelAPI_AttributeTables::ValueType +valueTypeByStr(const std::string &theValueTypeStr); MODELHIGHAPI_EXPORT std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType); /// Enumeration to manage the check python dump modes. enum checkDumpType { - CHECK_NAMING = 1, ///< check topological naming only + CHECK_NAMING = 1, ///< check topological naming only CHECK_GEOMETRICAL = 2, ///< check geometrical naming only - CHECK_NAMING_AND_GEOMETRICAL = 3, ///< default option, check topological and geometrical dumps + CHECK_NAMING_AND_GEOMETRICAL = + 3, ///< default option, check topological and geometrical dumps CHECK_WEAK = 4, ///< check weak naming only }; @@ -194,10 +219,10 @@ enum checkDumpType { /// model must be recreated fully, with all attributes /// \returns true if check is well done MODELHIGHAPI_EXPORT -bool checkPyDump(const std::string& theFilenameNaming, - const std::string& theFilenameGeo, - const std::string& theFilenameWeak, - const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL); +bool checkPyDump( + const std::string &theFilenameNaming, const std::string &theFilenameGeo, + const std::string &theFilenameWeak, + const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/ModelHighAPI/ModelHighAPI_swig.h b/src/ModelHighAPI/ModelHighAPI_swig.h index 9417bd964..66f04f0e3 100644 --- a/src/ModelHighAPI/ModelHighAPI_swig.h +++ b/src/ModelHighAPI/ModelHighAPI_swig.h @@ -14,35 +14,39 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SWIG_H_ #define SRC_MODELHIGHAPI_MODELHIGHAPI_SWIG_H_ - #include - #include - #include +#include +#include +#include - #include "ModelHighAPI.h" - #include "ModelHighAPI_Double.h" - #include "ModelHighAPI_Dumper.h" - #include "ModelHighAPI_Folder.h" - #include "ModelHighAPI_Integer.h" - #include "ModelHighAPI_Interface.h" - #include "ModelHighAPI_Macro.h" - #include "ModelHighAPI_RefAttr.h" - #include "ModelHighAPI_Reference.h" - #include "ModelHighAPI_Selection.h" - #include "ModelHighAPI_Services.h" - #include "ModelHighAPI_Tools.h" +#include "ModelHighAPI.h" +#include "ModelHighAPI_Double.h" +#include "ModelHighAPI_Dumper.h" +#include "ModelHighAPI_Folder.h" +#include "ModelHighAPI_Integer.h" +#include "ModelHighAPI_Interface.h" +#include "ModelHighAPI_Macro.h" +#include "ModelHighAPI_RefAttr.h" +#include "ModelHighAPI_Reference.h" +#include "ModelHighAPI_Selection.h" +#include "ModelHighAPI_Services.h" +#include "ModelHighAPI_Tools.h" - #ifdef _MSC_VER - # pragma warning(disable: 4127) // conditional expression is constant - # pragma warning(disable: 4456) // declaration of variable hides previous local declaration - # pragma warning(disable: 4459) // declaration of variable hides global declaration - # pragma warning(disable: 4701) // potentially uninitialized local variable - # pragma warning(disable: 4703) // potentially uninitialized local pointer variable - #endif +#ifdef _MSC_VER +#pragma warning(disable : 4127) // conditional expression is constant +#pragma warning(disable : 4456) // declaration of variable hides previous local + // declaration +#pragma warning( \ + disable : 4459) // declaration of variable hides global declaration +#pragma warning(disable : 4701) // potentially uninitialized local variable +#pragma warning( \ + disable : 4703) // potentially uninitialized local pointer variable +#endif #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_SWIG_H_ */ diff --git a/src/ModuleBase/ModuleBase.h b/src/ModuleBase/ModuleBase.h index 854a7ca3d..119346bff 100644 --- a/src/ModuleBase/ModuleBase.h +++ b/src/ModuleBase/ModuleBase.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_H @@ -22,16 +23,16 @@ #if defined MODULEBASE_EXPORTS #if defined WIN32 -#define MODULEBASE_EXPORT __declspec( dllexport ) +#define MODULEBASE_EXPORT __declspec(dllexport) #else #define MODULEBASE_EXPORT #endif #else #if defined WIN32 -#define MODULEBASE_EXPORT __declspec( dllimport ) +#define MODULEBASE_EXPORT __declspec(dllimport) #else #define MODULEBASE_EXPORT #endif #endif -#endif //MODULEBASE_H +#endif // MODULEBASE_H diff --git a/src/ModuleBase/ModuleBase_ActionInfo.cpp b/src/ModuleBase/ModuleBase_ActionInfo.cpp index 615fa064f..08e56f708 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.cpp +++ b/src/ModuleBase/ModuleBase_ActionInfo.cpp @@ -14,38 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include #include -ModuleBase_ActionInfo::ModuleBase_ActionInfo() -{ - initDefault(); -} +ModuleBase_ActionInfo::ModuleBase_ActionInfo() { initDefault(); } -ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QString &theText) -{ +ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QString &theText) { initDefault(); text = theText; } -ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QIcon & theIcon, const QString &theText) -{ +ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QIcon &theIcon, + const QString &theText) { initDefault(); icon = theIcon; text = theText; } -ModuleBase_ActionInfo::~ModuleBase_ActionInfo() -{ -} +ModuleBase_ActionInfo::~ModuleBase_ActionInfo() {} -void ModuleBase_ActionInfo::initFrom(QAction* theAction) -{ - // By convenience, QAction for a feature keeps feature's id as data (QVariant); +void ModuleBase_ActionInfo::initFrom(QAction *theAction) { + // By convenience, QAction for a feature keeps feature's id as data + // (QVariant); if (theAction->data().isValid()) { id = theAction->data().toString(); } @@ -63,8 +58,8 @@ void ModuleBase_ActionInfo::initFrom(QAction* theAction) font = theAction->font(); } -void ModuleBase_ActionInfo::initFrom(std::shared_ptr theMessage) -{ +void ModuleBase_ActionInfo::initFrom( + std::shared_ptr theMessage) { id = QString::fromStdString(theMessage->id()); iconFile = QString::fromStdString(theMessage->icon()); if (!iconFile.isEmpty()) { @@ -83,13 +78,12 @@ void ModuleBase_ActionInfo::initFrom(std::shared_ptr theM modal = theMessage->isModal(); } -void ModuleBase_ActionInfo::initDefault() -{ +void ModuleBase_ActionInfo::initDefault() { id = QString(); checkable = false; - checked = false; - enabled = true; - visible = true; + checked = false; + enabled = true; + visible = true; icon = QIcon(); text = QString(); iconText = QString(); diff --git a/src/ModuleBase/ModuleBase_ActionInfo.h b/src/ModuleBase/ModuleBase_ActionInfo.h index 275b68280..96eea3f06 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.h +++ b/src/ModuleBase/ModuleBase_ActionInfo.h @@ -14,47 +14,49 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_ACTIONINFO_H_ #define MODULEBASE_ACTIONINFO_H_ -#include #include +#include #include +#include #include #include -#include #include /*! * Structure to pass info about QActions, AppElements_Commands, etc. */ -struct MODULEBASE_EXPORT ModuleBase_ActionInfo -{ - QString id; //!< action's (command) id +struct MODULEBASE_EXPORT ModuleBase_ActionInfo { + QString id; //!< action's (command) id bool checkable; //!< action's checkable state - bool checked; //!< action's checked state - bool enabled; //!< action's enabled state - bool visible; //!< action's visibility state + bool checked; //!< action's checked state + bool enabled; //!< action's enabled state + bool visible; //!< action's visibility state - //! = true if the acton is a modal dialog box else property panel (==false by default) + //! = true if the acton is a modal dialog box else property panel (==false by + //! default) bool modal; - QIcon icon; //!< action's icon - QString text; //!< action's text + QIcon icon; //!< action's icon + QString text; //!< action's text QString iconText; //!< action's descriptive icon text - QString iconFile; //!< path to icon's file. Can not be initialized from QAction + QString + iconFile; //!< path to icon's file. Can not be initialized from QAction QString toolTip; //!< action's tooltip - QString toolBar; //!< A name of toolbar. By default = group of features name + QString toolBar; //!< A name of toolbar. By default = group of features name // QString statusTip; // QString whatsThis; QKeySequence shortcut; //!< action's primary shortcut key - QFont font; //!< action's text font + QFont font; //!< action's text font - public: +public: //! Default constructor, \sa initDefault ModuleBase_ActionInfo(); //! Initializes structure with default values, except text @@ -64,11 +66,11 @@ struct MODULEBASE_EXPORT ModuleBase_ActionInfo virtual ~ModuleBase_ActionInfo(); //! Fills itself with info from given \param theAction - void initFrom(QAction* theAction); + void initFrom(QAction *theAction); //! Fills itself with info from given \param theFeatureMessage void initFrom(std::shared_ptr theFeatureMessage); - protected: +protected: //! Initializes structure with default values, like QAction() void initDefault(); }; diff --git a/src/ModuleBase/ModuleBase_ActionIntParameter.h b/src/ModuleBase/ModuleBase_ActionIntParameter.h index 193f586d3..5af983fc9 100644 --- a/src/ModuleBase/ModuleBase_ActionIntParameter.h +++ b/src/ModuleBase/ModuleBase_ActionIntParameter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ActionIntParameter_H_ @@ -22,10 +23,10 @@ #include "ModuleBase_ActionParameter.h" -class ModuleBase_ActionIntParameter : public ModuleBase_ActionParameter -{ +class ModuleBase_ActionIntParameter : public ModuleBase_ActionParameter { public: - ModuleBase_ActionIntParameter(int theVal):ModuleBase_ActionParameter(), myVal(theVal) {} + ModuleBase_ActionIntParameter(int theVal) + : ModuleBase_ActionParameter(), myVal(theVal) {} int value() const { return myVal; } @@ -35,4 +36,4 @@ private: typedef std::shared_ptr ActionIntParamPtr; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_ActionParameter.h b/src/ModuleBase/ModuleBase_ActionParameter.h index f64b5e1a5..842350c7a 100644 --- a/src/ModuleBase/ModuleBase_ActionParameter.h +++ b/src/ModuleBase/ModuleBase_ActionParameter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ActionParameter_H_ @@ -22,8 +23,7 @@ #include -class ModuleBase_ActionParameter -{ +class ModuleBase_ActionParameter { public: /// Destuctor is added in order to virtualize the class virtual ~ModuleBase_ActionParameter() {} @@ -31,4 +31,4 @@ public: typedef std::shared_ptr ActionParamPtr; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_ActionType.h b/src/ModuleBase/ModuleBase_ActionType.h index 60a0787f9..23c3a6c80 100644 --- a/src/ModuleBase/ModuleBase_ActionType.h +++ b/src/ModuleBase/ModuleBase_ActionType.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ActionType_H_ @@ -23,8 +24,7 @@ /*! * Structure to describe widget processed types of actions. */ -enum ModuleBase_ActionType -{ +enum ModuleBase_ActionType { ActionEnter, ActionEscape, ActionDelete, diff --git a/src/ModuleBase/ModuleBase_ArrowPrs.cpp b/src/ModuleBase/ModuleBase_ArrowPrs.cpp index 2da61780e..91da21ab4 100644 --- a/src/ModuleBase/ModuleBase_ArrowPrs.cpp +++ b/src/ModuleBase/ModuleBase_ArrowPrs.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ArrowPrs.h" @@ -29,25 +30,19 @@ #include #include #include +#include #include #include -#include - IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ArrowPrs, AIS_InteractiveContext) - -ModuleBase_ArrowPrs::ModuleBase_ArrowPrs(const Handle(V3d_Viewer)& theViewer, - const GeomEdgePtr& theEdge) - : AIS_InteractiveContext(theViewer), - myEdge(theEdge) -{ -} +ModuleBase_ArrowPrs::ModuleBase_ArrowPrs(const Handle(V3d_Viewer) & theViewer, + const GeomEdgePtr &theEdge) + : AIS_InteractiveContext(theViewer), myEdge(theEdge) {} //******************************************************************** -void ModuleBase_ArrowPrs::DrawArrow(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) -{ +void ModuleBase_ArrowPrs::DrawArrow(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) { Handle(Prs3d_Drawer) aDrawer = myDefaultDrawer; Handle(Prs3d_ArrowAspect) anArrowAspect = aDrawer->ArrowAspect(); @@ -60,7 +55,8 @@ void ModuleBase_ArrowPrs::DrawArrow(const Handle(Prs3d_Presentation)& thePrs, TopoDS_Vertex aV1, aV2; TopoDS_Edge anEdgeE = myEdge->impl(); anEdgeE.Orientation(TopAbs_FORWARD); - if (anEdgeE.IsNull()) return; + if (anEdgeE.IsNull()) + return; TopExp::Vertices(anEdgeE, aV1, aV2); gp_Pnt aP1 = BRep_Tool::Pnt(aV1); @@ -70,7 +66,8 @@ void ModuleBase_ArrowPrs::DrawArrow(const Handle(Prs3d_Presentation)& thePrs, gp_Vec aDirVec; Handle(Geom_Curve) C = BRep_Tool::Curve(anEdgeE, fp, lp); - if (C.IsNull()) return; + if (C.IsNull()) + return; if (anEdgeE.Orientation() == TopAbs_FORWARD) C->D1(lp, aP2, aDirVec); @@ -98,11 +95,11 @@ void ModuleBase_ArrowPrs::DrawArrow(const Handle(Prs3d_Presentation)& thePrs, } //******************************************************************** -bool ModuleBase_ArrowPrs::Comparator::operator()(const std::shared_ptr& theEdge1, - const std::shared_ptr& theEdge2) const -{ - const TopoDS_Edge& aShape1 = theEdge1->impl(); - const TopoDS_Edge& aShape2 = theEdge2->impl(); +bool ModuleBase_ArrowPrs::Comparator::operator()( + const std::shared_ptr &theEdge1, + const std::shared_ptr &theEdge2) const { + const TopoDS_Edge &aShape1 = theEdge1->impl(); + const TopoDS_Edge &aShape2 = theEdge2->impl(); bool isLess = aShape1.TShape() < aShape2.TShape(); if (aShape1.TShape() == aShape2.TShape()) { Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); diff --git a/src/ModuleBase/ModuleBase_ArrowPrs.h b/src/ModuleBase/ModuleBase_ArrowPrs.h index bb29192a2..6517e0cba 100644 --- a/src/ModuleBase/ModuleBase_ArrowPrs.h +++ b/src/ModuleBase/ModuleBase_ArrowPrs.h @@ -14,59 +14,61 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ArrowPrs_H #define ModuleBase_ArrowPrs_H -#include -#include #include +#include +#include #include DEFINE_STANDARD_HANDLE(ModuleBase_ArrowPrs, AIS_InteractiveContext) /** -* \ingroup GUI -* A presentation class for displaying a direction of edge -*/ + * \ingroup GUI + * A presentation class for displaying a direction of edge + */ -class ModuleBase_ArrowPrs : public AIS_InteractiveContext -{ +class ModuleBase_ArrowPrs : public AIS_InteractiveContext { public: /// Constructor /// \param theViewer a viewer which theEdge is displaying. /// \param theEdge an edge whose direction to display. - Standard_EXPORT ModuleBase_ArrowPrs(const Handle(V3d_Viewer)& theViewer, - const GeomEdgePtr& theEdge); + Standard_EXPORT ModuleBase_ArrowPrs(const Handle(V3d_Viewer) & theViewer, + const GeomEdgePtr &theEdge); /// Returns an edge shape GeomEdgePtr Edge() const { return myEdge; } /// Draw arrow that represent direction of the edge. - Standard_EXPORT void DrawArrow(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor); + Standard_EXPORT void DrawArrow(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor); /// \brief Compare addresses of edges - class Comparator - { + class Comparator { public: - /// Return \c true if the address of the first edge is less than the address of the second + /// Return \c true if the address of the first edge is less than the address + /// of the second MODULEBASE_EXPORT - bool operator ()(const std::shared_ptr& theEdge1, - const std::shared_ptr& theEdge2) const; + bool operator()(const std::shared_ptr &theEdge1, + const std::shared_ptr &theEdge2) const; }; DEFINE_STANDARD_RTTIEXT(ModuleBase_ArrowPrs, AIS_InteractiveContext) private: - /// The edge whose direction to display. GeomEdgePtr myEdge; }; typedef std::pair EdgeDirection; -typedef std::map EdgesDirectionMap; +typedef std::map + EdgesDirectionMap; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_BRepOwner.cpp b/src/ModuleBase/ModuleBase_BRepOwner.cpp index 0bae7ff85..f91d2bbc5 100644 --- a/src/ModuleBase/ModuleBase_BRepOwner.cpp +++ b/src/ModuleBase/ModuleBase_BRepOwner.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_BRepOwner.h" diff --git a/src/ModuleBase/ModuleBase_BRepOwner.h b/src/ModuleBase/ModuleBase_BRepOwner.h index 0114b7566..a21244fe0 100644 --- a/src/ModuleBase/ModuleBase_BRepOwner.h +++ b/src/ModuleBase/ModuleBase_BRepOwner.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_BRepOwner_H @@ -30,33 +31,34 @@ DEFINE_STANDARD_HANDLE(ModuleBase_BRepOwner, StdSelect_BRepOwner) /** -* \ingroup GUI -* A redefinition of standard BRep Owner in order to provide specific selection -* of CompSolid objects. This owner is created only for selection mode TopAbs_COMPSOLID -*/ -class ModuleBase_BRepOwner: public StdSelect_BRepOwner -{ + * \ingroup GUI + * A redefinition of standard BRep Owner in order to provide specific selection + * of CompSolid objects. This owner is created only for selection mode + * TopAbs_COMPSOLID + */ +class ModuleBase_BRepOwner : public StdSelect_BRepOwner { public: /// Constructor /// \param aShape an owner shape /// \param aPriority drawig priority /// \param ComesFromDecomposition decomposition flag - ModuleBase_BRepOwner(const TopoDS_Shape& aShape, - const Standard_Integer aPriority = 0, - const Standard_Boolean ComesFromDecomposition = Standard_False) - : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {} + ModuleBase_BRepOwner( + const TopoDS_Shape &aShape, const Standard_Integer aPriority = 0, + const Standard_Boolean ComesFromDecomposition = Standard_False) + : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {} /// Highlight the presentation with the given color /// \param aPM a presentations manager /// \param theStyle a style of presentation /// \param theMode a drawing mode - virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM, - const Handle(Prs3d_Drawer)& theStyle, const Standard_Integer /*theMode*/ = 0) - { + virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager3d) & + aPM, + const Handle(Prs3d_Drawer) & theStyle, + const Standard_Integer /*theMode*/ = 0) { Selectable()->HilightOwnerWithColor(aPM, theStyle, this); } DEFINE_STANDARD_RTTIEXT(ModuleBase_BRepOwner, StdSelect_BRepOwner) }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp b/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp index db0a7920a..fab50e4e9 100644 --- a/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp +++ b/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp @@ -14,99 +14,99 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ChoiceCtrl.h" -#include "ModuleBase_Tools.h" #include "ModuleBase_IconFactory.h" +#include "ModuleBase_Tools.h" -#include -#include +#include #include #include -#include +#include +#include #include #include -const QString AStyle = "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}"; - +const QString AStyle = + "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}"; -ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget* theParent, - const QStringList& theChoiceList, - const QStringList& theIconsList, +ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget *theParent, + const QStringList &theChoiceList, + const QStringList &theIconsList, ControlType theType, Qt::Orientation theButtonsDir) - : QWidget(theParent), myType(theType) -{ - QHBoxLayout* aLayout = new QHBoxLayout(this); + : QWidget(theParent), myType(theType) { + QHBoxLayout *aLayout = new QHBoxLayout(this); aLayout->setContentsMargins(0, 0, 0, 0); switch (myType) { - case RadioButtons: - { - myButtons = new QButtonGroup(this); - myGroupBox = new QGroupBox("", this); - aLayout->addWidget(myGroupBox); - - QLayout* aBtnLayout = 0; - switch (theButtonsDir) { - case Qt::Horizontal: - aBtnLayout = new QHBoxLayout(myGroupBox); - break; - case Qt::Vertical: - aBtnLayout = new QVBoxLayout(myGroupBox); - break; + case RadioButtons: { + myButtons = new QButtonGroup(this); + myGroupBox = new QGroupBox("", this); + aLayout->addWidget(myGroupBox); + + QLayout *aBtnLayout = 0; + switch (theButtonsDir) { + case Qt::Horizontal: + aBtnLayout = new QHBoxLayout(myGroupBox); + break; + case Qt::Vertical: + aBtnLayout = new QVBoxLayout(myGroupBox); + break; + } + ModuleBase_Tools::adjustMargins(aBtnLayout); + + if (theIconsList.length() == theChoiceList.length()) { + int aId = 0; + foreach (QString aBtnTxt, theChoiceList) { + QToolButton *aBtn = new QToolButton(myGroupBox); + aBtn->setFocusPolicy(Qt::StrongFocus); + aBtn->setCheckable(true); + aBtn->setToolTip(aBtnTxt); + + QPixmap aIcon = + ModuleBase_IconFactory::loadPixmap(theIconsList.at(aId)); + aBtn->setIcon(aIcon); + aBtn->setIconSize(aIcon.size()); + aBtn->setStyleSheet(AStyle); + + aBtnLayout->addWidget(aBtn); + myButtons->addButton(aBtn, aId++); } - ModuleBase_Tools::adjustMargins(aBtnLayout); - - if (theIconsList.length() == theChoiceList.length()) { - int aId = 0; - foreach(QString aBtnTxt, theChoiceList) { - QToolButton* aBtn = new QToolButton(myGroupBox); - aBtn->setFocusPolicy(Qt::StrongFocus); - aBtn->setCheckable(true); - aBtn->setToolTip(aBtnTxt); - - QPixmap aIcon = ModuleBase_IconFactory::loadPixmap(theIconsList.at(aId)); - aBtn->setIcon(aIcon); - aBtn->setIconSize(aIcon.size()); - aBtn->setStyleSheet(AStyle); - - aBtnLayout->addWidget(aBtn); - myButtons->addButton(aBtn, aId++); - } - } else { - int aId = 0; - foreach(QString aBtnTxt, theChoiceList) { - QRadioButton* aBtn = new QRadioButton(aBtnTxt, myGroupBox); - aBtnLayout->addWidget(aBtn); - myButtons->addButton(aBtn, aId++); - } + } else { + int aId = 0; + foreach (QString aBtnTxt, theChoiceList) { + QRadioButton *aBtn = new QRadioButton(aBtnTxt, myGroupBox); + aBtnLayout->addWidget(aBtn); + myButtons->addButton(aBtn, aId++); } - connect(myButtons, SIGNAL(buttonClicked(int)), this, SIGNAL(valueChanged(int))); } - break; + connect(myButtons, SIGNAL(buttonClicked(int)), this, + SIGNAL(valueChanged(int))); + } break; case ComboBox: myLabel = new QLabel("", this); aLayout->addWidget(myLabel); - //std::string aToolstr = theData->widgetTooltip(); - //if (!aToolstr.empty()) { - // myLabel->setToolTip(QString::fromStdString(aToolstr)); - //} + // std::string aToolstr = theData->widgetTooltip(); + // if (!aToolstr.empty()) { + // myLabel->setToolTip(QString::fromStdString(aToolstr)); + // } myCombo = new QComboBox(this); aLayout->addWidget(myCombo, 1); myCombo->addItems(theChoiceList); - connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(valueChanged(int))); + connect(myCombo, SIGNAL(currentIndexChanged(int)), this, + SIGNAL(valueChanged(int))); break; } } -void ModuleBase_ChoiceCtrl::setLabel(const QString& theText) -{ +void ModuleBase_ChoiceCtrl::setLabel(const QString &theText) { switch (myType) { case RadioButtons: myGroupBox->setTitle(theText); @@ -117,14 +117,12 @@ void ModuleBase_ChoiceCtrl::setLabel(const QString& theText) } } -void ModuleBase_ChoiceCtrl::setLabelIcon(const QString& theIcon) -{ +void ModuleBase_ChoiceCtrl::setLabelIcon(const QString &theIcon) { if (myType == ComboBox) myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(theIcon)); } -void ModuleBase_ChoiceCtrl::setValue(int theVal) -{ +void ModuleBase_ChoiceCtrl::setValue(int theVal) { switch (myType) { case RadioButtons: myButtons->button(theVal)->setChecked(true); @@ -135,11 +133,10 @@ void ModuleBase_ChoiceCtrl::setValue(int theVal) } } -void ModuleBase_ChoiceCtrl::setValue(const QString& theVal) -{ +void ModuleBase_ChoiceCtrl::setValue(const QString &theVal) { switch (myType) { case RadioButtons: - foreach (QAbstractButton* aBtn, myButtons->buttons()) { + foreach (QAbstractButton *aBtn, myButtons->buttons()) { aBtn->setChecked(aBtn->toolTip() == theVal); } break; @@ -149,15 +146,12 @@ void ModuleBase_ChoiceCtrl::setValue(const QString& theVal) } } - -void ModuleBase_ChoiceCtrl::setTooltip(QString theTip) -{ +void ModuleBase_ChoiceCtrl::setTooltip(QString theTip) { if (myType == ComboBox) myLabel->setToolTip(theTip); } -int ModuleBase_ChoiceCtrl::value() const -{ +int ModuleBase_ChoiceCtrl::value() const { switch (myType) { case RadioButtons: return myButtons->checkedId(); @@ -167,8 +161,7 @@ int ModuleBase_ChoiceCtrl::value() const return -1; } -bool ModuleBase_ChoiceCtrl::focusTo() -{ +bool ModuleBase_ChoiceCtrl::focusTo() { if (myType == ComboBox) ModuleBase_Tools::setFocus(myCombo, "ModuleBase_WidgetChoice::focusTo()"); else @@ -176,24 +169,21 @@ bool ModuleBase_ChoiceCtrl::focusTo() return true; } -QList ModuleBase_ChoiceCtrl::getControls() const -{ - QList aControls; +QList ModuleBase_ChoiceCtrl::getControls() const { + QList aControls; if (myType == ComboBox) aControls.append(myCombo); return aControls; } -void ModuleBase_ChoiceCtrl::setChoiceList(const QStringList& theChoiceList) -{ +void ModuleBase_ChoiceCtrl::setChoiceList(const QStringList &theChoiceList) { if (myType == ComboBox) { myCombo->clear(); myCombo->addItems(theChoiceList); } } -QString ModuleBase_ChoiceCtrl::textValue() const -{ +QString ModuleBase_ChoiceCtrl::textValue() const { switch (myType) { case RadioButtons: return myButtons->checkedButton()->toolTip(); diff --git a/src/ModuleBase/ModuleBase_ChoiceCtrl.h b/src/ModuleBase/ModuleBase_ChoiceCtrl.h index 576391842..ebaeddd6c 100644 --- a/src/ModuleBase/ModuleBase_ChoiceCtrl.h +++ b/src/ModuleBase/ModuleBase_ChoiceCtrl.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ChoiceCtrl_H @@ -22,9 +23,9 @@ #include "ModuleBase.h" -#include -#include #include +#include +#include class QLabel; class QComboBox; @@ -32,43 +33,38 @@ class QGroupBox; class QButtonGroup; /** -* \ingroup GUI -* A Choice control. It provides a choice in several strings. -* It can be represented by several radiobuttons or by combo box. -* Radio buttons can be represented as by radiou buttons with text -* or by icons in toggle buttons. -*/ -class MODULEBASE_EXPORT ModuleBase_ChoiceCtrl: public QWidget -{ -Q_OBJECT + * \ingroup GUI + * A Choice control. It provides a choice in several strings. + * It can be represented by several radiobuttons or by combo box. + * Radio buttons can be represented as by radiou buttons with text + * or by icons in toggle buttons. + */ +class MODULEBASE_EXPORT ModuleBase_ChoiceCtrl : public QWidget { + Q_OBJECT public: - enum ControlType { - RadioButtons, - ComboBox - }; + enum ControlType { RadioButtons, ComboBox }; /** - * Constructor - * \param theParent a parent widget - * \param theChoiceList a list of choice strings - * \param theIconsList a list of icon names for radiou buttons - * \param theType a type of choice representation - * \param theButtonsDir direction of radio buttons placement - */ - ModuleBase_ChoiceCtrl(QWidget* theParent, - const QStringList& theChoiceList, - const QStringList& theIconsList, + * Constructor + * \param theParent a parent widget + * \param theChoiceList a list of choice strings + * \param theIconsList a list of icon names for radiou buttons + * \param theType a type of choice representation + * \param theButtonsDir direction of radio buttons placement + */ + ModuleBase_ChoiceCtrl(QWidget *theParent, const QStringList &theChoiceList, + const QStringList &theIconsList, ControlType theType = RadioButtons, Qt::Orientation theButtonsDir = Qt::Horizontal); /// Set label for the controls. /// It is a label for combo box and title for group of radio buttons. /// \param theText a text of the label - void setLabel(const QString& theText); + void setLabel(const QString &theText); /// Set Icon for the label. Used only for combo box. /// \param theIcon a name of icon - void setLabelIcon(const QString& theIcon); + void setLabelIcon(const QString &theIcon); /// Set value: Id of button or item of combo box. /// \param theVal a value (from 0 to number of items) @@ -76,7 +72,7 @@ public: /// Set value: text of button or item of combo box. /// \param theVal a value (one of text items) - void setValue(const QString& theVal); + void setValue(const QString &theVal); /// Set tool tip for label. Used only for combo box. void setTooltip(QString theTip); @@ -91,11 +87,11 @@ public: bool focusTo(); /// Returns controls for activation - QList getControls() const; + QList getControls() const; /// Set list of choice /// \param theChoiceList a string list of items - void setChoiceList(const QStringList& theChoiceList); + void setChoiceList(const QStringList &theChoiceList); signals: /// A signal raised on change of current value @@ -106,16 +102,16 @@ private: ControlType myType; /// A label for cmbo box - QLabel* myLabel; + QLabel *myLabel; /// A combo box represerntation of control - QComboBox* myCombo; + QComboBox *myCombo; /// A group box for radio buttons - QGroupBox* myGroupBox; + QGroupBox *myGroupBox; /// A group of buttons - QButtonGroup* myButtons; + QButtonGroup *myButtons; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_Definitions.h b/src/ModuleBase/ModuleBase_Definitions.h index 6072e999f..797f4fc4c 100644 --- a/src/ModuleBase/ModuleBase_Definitions.h +++ b/src/ModuleBase/ModuleBase_Definitions.h @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Definitions_H #define ModuleBase_Definitions_H -#include #include +#include -typedef QList QIntList; //!< list of int values -typedef QList QShortList; //!< list of short int values -typedef QList QDoubleList; //!< list of double values -typedef QList QObjectPtrList; //!< List of ModelAPI_Objects +typedef QList QIntList; //!< list of int values +typedef QList QShortList; //!< list of short int values +typedef QList QDoubleList; //!< list of double values +typedef QList QObjectPtrList; //!< List of ModelAPI_Objects #endif diff --git a/src/ModuleBase/ModuleBase_Dialog.cpp b/src/ModuleBase/ModuleBase_Dialog.cpp index 64389bebb..8f053173c 100644 --- a/src/ModuleBase/ModuleBase_Dialog.cpp +++ b/src/ModuleBase/ModuleBase_Dialog.cpp @@ -14,47 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_Dialog.h" -#include "ModuleBase_WidgetFactory.h" -#include "ModuleBase_IWorkshop.h" #include "ModuleBase_IPropertyPanel.h" -#include "ModuleBase_PageWidget.h" +#include "ModuleBase_IWorkshop.h" #include "ModuleBase_ModelDialogWidget.h" +#include "ModuleBase_PageWidget.h" #include "ModuleBase_Tools.h" +#include "ModuleBase_WidgetFactory.h" -#include -#include #include +#include +#include -#include #include +#include -#include -#include #include +#include +#include #include - -ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, - const std::string& theDescription) : - QDialog(theParent->desktop(), - Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), - myDescription(theDescription), - myWorkshop(theParent), - myActiveWidget(0) -{ +ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop *theParent, + const std::string &theDescription) + : QDialog(theParent->desktop(), Qt::Dialog | Qt::CustomizeWindowHint | + Qt::WindowTitleHint | + Qt::WindowCloseButtonHint), + myDescription(theDescription), myWorkshop(theParent), myActiveWidget(0) { Config_WidgetAPI aApi(myDescription, ""); myId = aApi.getProperty("id"); - std::shared_ptr aFeatureInfo = myWorkshop->featureInfo(myId.c_str()); + std::shared_ptr aFeatureInfo = + myWorkshop->featureInfo(myId.c_str()); myHelpPage = aFeatureInfo->helpFileName(); ModuleBase_WidgetFactory aFactory(myDescription, myWorkshop); - QString aTitle = ModuleBase_Tools::translate("ModuleBase_Dialog", - aFactory.widgetAPI()->getProperty(FEATURE_TEXT)); + QString aTitle = ModuleBase_Tools::translate( + "ModuleBase_Dialog", aFactory.widgetAPI()->getProperty(FEATURE_TEXT)); setWindowTitle(aTitle); @@ -67,44 +66,47 @@ ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - QVBoxLayout* aLayout = new QVBoxLayout(this); + QVBoxLayout *aLayout = new QVBoxLayout(this); aLayout->setContentsMargins(0, 0, 0, 0); aLayout->setSpacing(1); - ModuleBase_PageWidget* aPage = new ModuleBase_PageWidget(this); + ModuleBase_PageWidget *aPage = new ModuleBase_PageWidget(this); aLayout->addWidget(aPage); aFactory.createWidget(aPage, false); myWidgets = aFactory.getModelWidgets(); - QFrame* aFrame = new QFrame(this); + QFrame *aFrame = new QFrame(this); aFrame->setFrameStyle(QFrame::WinPanel | QFrame::Raised); aLayout->addWidget(aFrame); - QHBoxLayout* aBtnLayout = new QHBoxLayout(aFrame); + QHBoxLayout *aBtnLayout = new QHBoxLayout(aFrame); ModuleBase_Tools::adjustMargins(aBtnLayout); myButtonsBox = new QDialogButtonBox( - QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, - Qt::Horizontal, aFrame); + QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, + Qt::Horizontal, aFrame); aBtnLayout->addWidget(myButtonsBox); - myButtonsBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":pictures/button_ok.png")); - myButtonsBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":pictures/button_cancel.png")); - myButtonsBox->button(QDialogButtonBox::Help)->setIcon(QIcon(":pictures/button_help.png")); + myButtonsBox->button(QDialogButtonBox::Ok) + ->setIcon(QIcon(":pictures/button_ok.png")); + myButtonsBox->button(QDialogButtonBox::Cancel) + ->setIcon(QIcon(":pictures/button_cancel.png")); + myButtonsBox->button(QDialogButtonBox::Help) + ->setIcon(QIcon(":pictures/button_help.png")); connect(myButtonsBox, SIGNAL(accepted()), this, SLOT(accept())); connect(myButtonsBox, SIGNAL(rejected()), this, SLOT(reject())); connect(myButtonsBox, SIGNAL(helpRequested()), this, SLOT(onHelpRequest())); - foreach (ModuleBase_ModelWidget* aWidget, myWidgets) { + foreach (ModuleBase_ModelWidget *aWidget, myWidgets) { initializeWidget(aWidget); } } -void ModuleBase_Dialog::initializeWidget(ModuleBase_ModelWidget* theWidget) -{ - ModuleBase_ModelDialogWidget* aDlgWgt = dynamic_cast(theWidget); +void ModuleBase_Dialog::initializeWidget(ModuleBase_ModelWidget *theWidget) { + ModuleBase_ModelDialogWidget *aDlgWgt = + dynamic_cast(theWidget); if (aDlgWgt) aDlgWgt->setDialogButtons(myButtonsBox); @@ -112,8 +114,7 @@ void ModuleBase_Dialog::initializeWidget(ModuleBase_ModelWidget* theWidget) theWidget->restoreValue(); } -void ModuleBase_Dialog::showEvent(QShowEvent* theEvent) -{ +void ModuleBase_Dialog::showEvent(QShowEvent *theEvent) { QDialog::showEvent(theEvent); if (myWidgets.length() > 0) { myActiveWidget = myWidgets.first(); @@ -121,8 +122,7 @@ void ModuleBase_Dialog::showEvent(QShowEvent* theEvent) } } -void ModuleBase_Dialog::accept() -{ +void ModuleBase_Dialog::accept() { if (myActiveWidget) { if (!myActiveWidget->storeValue()) return; @@ -130,7 +130,6 @@ void ModuleBase_Dialog::accept() QDialog::accept(); } -void ModuleBase_Dialog::onHelpRequest() -{ +void ModuleBase_Dialog::onHelpRequest() { myWorkshop->showHelpPage(myHelpPage.c_str()); } diff --git a/src/ModuleBase/ModuleBase_Dialog.h b/src/ModuleBase/ModuleBase_Dialog.h index 056ec2179..082a1a094 100644 --- a/src/ModuleBase/ModuleBase_Dialog.h +++ b/src/ModuleBase/ModuleBase_Dialog.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Dialog_H @@ -26,39 +27,37 @@ #include #include - class ModuleBase_IWorkshop; class ModuleBase_ModelWidget; class QDialogButtonBox; - /** * \ingroup GUI * A dialog box which is used for modal dialog box feature interface */ -class ModuleBase_Dialog : public QDialog -{ +class ModuleBase_Dialog : public QDialog { Q_OBJECT public: /// Constructor /// \param theParent a workshop object instance /// \param theId an Id of a feature /// \param theDescription an XML description of the feature - ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const std::string& theDescription); + ModuleBase_Dialog(ModuleBase_IWorkshop *theParent, + const std::string &theDescription); /// Redefinition of virtual method virtual void accept(); protected: /// Redefinition of virtual method - virtual void showEvent(QShowEvent* theEvent); + virtual void showEvent(QShowEvent *theEvent); private slots: void onHelpRequest(); private: /// Initialising of the widget - void initializeWidget(ModuleBase_ModelWidget* theWidget); + void initializeWidget(ModuleBase_ModelWidget *theWidget); /// Id of the feature std::string myId; @@ -67,19 +66,19 @@ private: std::string myDescription; /// An instance of workshop object - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; /// The feature instance FeaturePtr myFeature; /// List of created widgets - QList myWidgets; + QList myWidgets; /// Pointer on active widget - ModuleBase_ModelWidget* myActiveWidget; + ModuleBase_ModelWidget *myActiveWidget; /// Buttons of the dialog - QDialogButtonBox* myButtonsBox; + QDialogButtonBox *myButtonsBox; std::string myHelpPage; }; diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp index 4d28ee798..1ab86ada1 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_DoubleSpinBox.h" #include "ModuleBase_Tools.h" -#include #include -#include #include +#include +#include #include @@ -51,14 +52,14 @@ const double PSEUDO_ZERO = 1.e-20; } \endcode - Another useful feature is possibility to use scientific notation (e.g. 1.234e+18) - for the widget text. To enable this, negative precision should be specified either - through a constructor or using setPrecision() method. + Another useful feature is possibility to use scientific notation + (e.g. 1.234e+18) for the widget text. To enable this, negative precision should + be specified either through a constructor or using setPrecision() method. - Note that "decimals" property of QDoubleSpinBox is almost completely substituted - by "myPrecision" field of ModuleBase_DoubleSpinBox class. "decimals" is still used - for proper size hint calculation and for rounding minimum and maximum bounds of - the spin box range. + Note that "decimals" property of QDoubleSpinBox is almost completely + substituted by "myPrecision" field of ModuleBase_DoubleSpinBox class. + "decimals" is still used for proper size hint calculation and for rounding + minimum and maximum bounds of the spin box range. */ /*! @@ -71,10 +72,9 @@ const double PSEUDO_ZERO = 1.e-20; \param theParent parent object \param thePrecision precision of values input */ -ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePrecision) - : QDoubleSpinBox(theParent), - myCleared(false) -{ +ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget *theParent, + int thePrecision) + : QDoubleSpinBox(theParent), myCleared(false) { setLocale(ModuleBase_Tools::doubleLocale()); // MPV 15/09/2014: this must be set before setDecimals; @@ -86,8 +86,8 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePr // by default Qt rounds boundaries to 2 decimals at setRange setDecimals(qAbs(myPrecision)); - connect(lineEdit(), SIGNAL(textChanged( const QString& )), this, - SLOT(onTextChanged( const QString& ))); + connect(lineEdit(), SIGNAL(textChanged(const QString &)), this, + SLOT(onTextChanged(const QString &))); myEnabledBaseColor = palette().color(QPalette::Active, QPalette::Base); } @@ -95,27 +95,21 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePr /*! \brief Destructor. */ -ModuleBase_DoubleSpinBox::~ModuleBase_DoubleSpinBox() -{ -} +ModuleBase_DoubleSpinBox::~ModuleBase_DoubleSpinBox() {} /*! \brief Check if spin box is in the "cleared" state. \return \c true if spin box is cleared \sa setCleared() */ -bool ModuleBase_DoubleSpinBox::isCleared() const -{ - return myCleared; -} +bool ModuleBase_DoubleSpinBox::isCleared() const { return myCleared; } /*! \brief Change "cleared" status of the spin box. \param on new "cleared" status \sa isCleared() */ -void ModuleBase_DoubleSpinBox::setCleared(const bool on) -{ +void ModuleBase_DoubleSpinBox::setCleared(const bool on) { if (myCleared == on) return; @@ -132,8 +126,7 @@ void ModuleBase_DoubleSpinBox::setCleared(const bool on) \param prec new precision value. \sa precision() */ -void ModuleBase_DoubleSpinBox::setPrecision(const int prec) -{ +void ModuleBase_DoubleSpinBox::setPrecision(const int prec) { int newPrec = qAbs(prec); int oldPrec = qAbs(myPrecision); myPrecision = prec; @@ -146,10 +139,7 @@ void ModuleBase_DoubleSpinBox::setPrecision(const int prec) \return current precision value \sa setPrecision() */ -int ModuleBase_DoubleSpinBox::getPrecision() const -{ - return myPrecision; -} +int ModuleBase_DoubleSpinBox::getPrecision() const { return myPrecision; } /*! \brief Interpret text entered by the user as a value. @@ -157,8 +147,7 @@ int ModuleBase_DoubleSpinBox::getPrecision() const \return mapped value \sa textFromValue() */ -double ModuleBase_DoubleSpinBox::valueFromText(const QString& text) const -{ +double ModuleBase_DoubleSpinBox::valueFromText(const QString &text) const { if (myPrecision < 0) return text.toDouble(); @@ -173,9 +162,9 @@ double ModuleBase_DoubleSpinBox::valueFromText(const QString& text) const \return text representation of the value \sa valueFromText() */ -QString ModuleBase_DoubleSpinBox::textFromValue(double val) const -{ - QString s = locale().toString(val, myPrecision >= 0 ? 'f' : 'g', qAbs(myPrecision)); +QString ModuleBase_DoubleSpinBox::textFromValue(double val) const { + QString s = + locale().toString(val, myPrecision >= 0 ? 'f' : 'g', qAbs(myPrecision)); return removeTrailingZeroes(s); } @@ -184,8 +173,8 @@ QString ModuleBase_DoubleSpinBox::textFromValue(double val) const \param src source string \return resulting string */ -QString ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString& src) const -{ +QString +ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString &src) const { QString delim(locale().decimalPoint()); int idx = src.lastIndexOf(delim); @@ -220,8 +209,7 @@ QString ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString& src) const \param steps number of increment/decrement steps */ -void ModuleBase_DoubleSpinBox::stepBy(int steps) -{ +void ModuleBase_DoubleSpinBox::stepBy(int steps) { myCleared = false; QDoubleSpinBox::stepBy(steps); @@ -241,8 +229,8 @@ void ModuleBase_DoubleSpinBox::stepBy(int steps) \param pos cursor position in the string \return validating operation result */ -QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) const -{ +QValidator::State ModuleBase_DoubleSpinBox::validate(QString &str, + int &pos) const { QString pref = this->prefix(); QString suff = this->suffix(); uint overhead = pref.length() + suff.length(); @@ -259,15 +247,14 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con v.setDecimals(decs); v.setBottom(minimum()); v.setTop(maximum()); - v.setNotation( - myPrecision >= 0 ? QDoubleValidator::StandardNotation : QDoubleValidator::ScientificNotation); + v.setNotation(myPrecision >= 0 ? QDoubleValidator::StandardNotation + : QDoubleValidator::ScientificNotation); if (overhead == 0) state = v.validate(str, pos); else { - if ((uint)(str.length()) >= overhead && - str.startsWith(pref) && - str.right(suff.length()) == suff) { + if ((uint)(str.length()) >= overhead && str.startsWith(pref) && + str.right(suff.length()) == suff) { QString core = str.mid(pref.length(), str.length() - overhead); int corePos = pos - pref.length(); state = v.validate(core, corePos); @@ -296,7 +283,8 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con double val = str.toDouble(&isOk); if (isOk) { QVariant propVal = property("strict_validity_check"); - if (propVal.isValid() && propVal.canConvert(QVariant::Bool) && propVal.toBool()) { + if (propVal.isValid() && propVal.canConvert(QVariant::Bool) && + propVal.toBool()) { if (val < minimum() || val > maximum()) state = QValidator::Invalid; } @@ -305,7 +293,7 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con QChar e(locale().exponential()); int epos = str.indexOf(e, 0, Qt::CaseInsensitive); if (epos != -1) { - epos++; // Skip exponential symbol itself + epos++; // Skip exponential symbol itself QString exponent = str.right(str.length() - epos); int expValue = exponent.toInt(&isOk); if (isOk && expValue < std::numeric_limits::min_exponent10) @@ -320,17 +308,16 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con /*! \brief Called when user enters the text in the spin box. */ -void ModuleBase_DoubleSpinBox::onTextChanged(const QString& ) -{ +void ModuleBase_DoubleSpinBox::onTextChanged(const QString &) { myCleared = false; } -void ModuleBase_DoubleSpinBox::setValueEnabled(const bool& theEnable) -{ +void ModuleBase_DoubleSpinBox::setValueEnabled(const bool &theEnable) { setReadOnly(!theEnable); QPalette aPal = palette(); aPal.setColor(QPalette::All, QPalette::Base, - theEnable? myEnabledBaseColor : aPal.color(QPalette::Disabled, QPalette::Base)); + theEnable ? myEnabledBaseColor + : aPal.color(QPalette::Disabled, QPalette::Base)); setPalette(aPal); } diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.h b/src/ModuleBase/ModuleBase_DoubleSpinBox.h index c28c69f71..bced28810 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.h +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_DOUBLESPINBOX_H_ @@ -30,15 +31,15 @@ class QKeyEvent; /** -* \ingroup GUI -* An extension and customization of QDoubleSpinBox class -*/ -class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox -{ -Q_OBJECT - - public: - explicit ModuleBase_DoubleSpinBox( QWidget* theParent = 0, int thePrecision = -12 ); + * \ingroup GUI + * An extension and customization of QDoubleSpinBox class + */ +class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox { + Q_OBJECT + +public: + explicit ModuleBase_DoubleSpinBox(QWidget *theParent = 0, + int thePrecision = -12); virtual ~ModuleBase_DoubleSpinBox(); /// Returns true if the control is clear @@ -57,31 +58,31 @@ Q_OBJECT virtual void stepBy(int); /// Converts value from string to double - virtual double valueFromText(const QString&) const; + virtual double valueFromText(const QString &) const; /// Convert value from double to string virtual QString textFromValue(double) const; /// Validate current value - virtual QValidator::State validate(QString&, int&) const; + virtual QValidator::State validate(QString &, int &) const; - /// Imitation of disable control value. If theEnable is false, the control becomes - /// read only and base color is disabled. - void setValueEnabled(const bool& theEnable); + /// Imitation of disable control value. If theEnable is false, the control + /// becomes read only and base color is disabled. + void setValueEnabled(const bool &theEnable); - protected slots: - /// Called on text changed - virtual void onTextChanged(const QString&); +protected slots: + /// Called on text changed + virtual void onTextChanged(const QString &); - protected: - /// Removes extra trailing zero symbols - QString removeTrailingZeroes(const QString&) const; +protected: + /// Removes extra trailing zero symbols + QString removeTrailingZeroes(const QString &) const; - private: +private: // boolen flag whether the key event is emitted. The default value is false bool myIsEmitKeyPressEvent; - /// Is clear flag + /// Is clear flag bool myCleared; /// Precision value diff --git a/src/ModuleBase/ModuleBase_Events.h b/src/ModuleBase/ModuleBase_Events.h index f67bb0ffc..17b4f2ac0 100644 --- a/src/ModuleBase/ModuleBase_Events.h +++ b/src/ModuleBase/ModuleBase_Events.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Events_H @@ -22,6 +23,7 @@ #include "ModuleBase.h" -static const char * EVENT_UPDATE_BY_WIDGET_SELECTION = "SelectionUpdatedByWidget"; +static const char *EVENT_UPDATE_BY_WIDGET_SELECTION = + "SelectionUpdatedByWidget"; #endif diff --git a/src/ModuleBase/ModuleBase_Filter.cpp b/src/ModuleBase/ModuleBase_Filter.cpp index 2b38ed7e6..e40da27b9 100644 --- a/src/ModuleBase/ModuleBase_Filter.cpp +++ b/src/ModuleBase/ModuleBase_Filter.cpp @@ -14,13 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_Filter.h" -Handle(SelectMgr_Filter) ModuleBase_Filter::getFilter() -{ +Handle(SelectMgr_Filter) ModuleBase_Filter::getFilter() { if (myFilter.IsNull()) createFilter(); diff --git a/src/ModuleBase/ModuleBase_Filter.h b/src/ModuleBase/ModuleBase_Filter.h index 4e29987b5..8da085e5c 100644 --- a/src/ModuleBase/ModuleBase_Filter.h +++ b/src/ModuleBase/ModuleBase_Filter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Filter_H @@ -30,21 +31,20 @@ * \ingroup GUI * This object is assigned by the name * in the XML file to the specific attribute or to the whole feature. - * If isOK method of the filter returns "false", it is signalized in user interface - * that the processed entity should not be selected. - * Filterss must be registered in the filters factory to be - * correctly identified by the XML string-ID. + * If isOK method of the filter returns "false", it is signalized in user + * interface that the processed entity should not be selected. Filterss must be + * registered in the filters factory to be correctly identified by the XML + * string-ID. */ -class ModuleBase_Filter -{ +class ModuleBase_Filter { public: /// Constructor MODULEBASE_EXPORT ModuleBase_Filter() {} /** - * Returns an OCC selection filter. It can be appended into the context of a viewer - * It creates a filter if it has not be created yet. - * \return the selection filter + * Returns an OCC selection filter. It can be appended into the context of a + * viewer It creates a filter if it has not be created yet. \return the + * selection filter */ MODULEBASE_EXPORT Handle(SelectMgr_Filter) getFilter(); @@ -52,7 +52,9 @@ public: * Sets the arguments to the filter. * \param theArguments a list of arguments */ - MODULEBASE_EXPORT virtual void setArguments(const std::list& theArguments) = 0; + MODULEBASE_EXPORT virtual void + setArguments(const std::list &theArguments) = 0; + protected: /** * It creates an internal instance of the OCC filter @@ -64,4 +66,4 @@ protected: Handle(SelectMgr_Filter) myFilter; }; -#endif //ModuleBase_Filter +#endif // ModuleBase_Filter diff --git a/src/ModuleBase/ModuleBase_FilterValidated.cpp b/src/ModuleBase/ModuleBase_FilterValidated.cpp index df9e46e8b..b80ce6d5f 100644 --- a/src/ModuleBase/ModuleBase_FilterValidated.cpp +++ b/src/ModuleBase/ModuleBase_FilterValidated.cpp @@ -14,36 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_FilterValidated.h" -#include "ModuleBase_IWorkshop.h" #include "ModuleBase_IViewer.h" +#include "ModuleBase_IWorkshop.h" #include #include #include #include +#include +#include #include #include -#include -#include IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter); -Standard_Boolean ModuleBase_FilterValidated:: - IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const -{ +Standard_Boolean ModuleBase_FilterValidated::IsOk( + const Handle(SelectMgr_EntityOwner) & theOwner) const { bool aValid = true; - ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->module()->currentOperation(); if (anOperation) { - ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->viewer(); Handle(AIS_InteractiveContext) aContext = aViewer->AISContext(); - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); if (aPanel) { - ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget(); + ModuleBase_ModelWidget *aCurrentWidget = aPanel->preselectionWidget(); if (!aCurrentWidget) aCurrentWidget = myWorkshop->module()->activeWidget(); if (aCurrentWidget) { @@ -51,12 +51,14 @@ Standard_Boolean ModuleBase_FilterValidated:: myWorkshop->selection()->fillPresentation(aPrs, theOwner); if (aPrs->isEmpty()) return false; - ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast - (aCurrentWidget); + ModuleBase_WidgetValidated *aWidgetValidated = + dynamic_cast(aCurrentWidget); if (aWidgetValidated) - aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs); - else{ - ModuleBase_WidgetValidator* aWidgetValidator = aCurrentWidget->widgetValidator(); + aValid = + !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs); + else { + ModuleBase_WidgetValidator *aWidgetValidator = + aCurrentWidget->widgetValidator(); if (aWidgetValidator) aValid = aWidgetValidator->isValidSelection(aPrs); } @@ -65,8 +67,10 @@ Standard_Boolean ModuleBase_FilterValidated:: } #ifdef DEBUG_FILTERS - qDebug(QString("ModuleBase_FilterValidated::IsOk = %1").arg(aValid).toStdString().c_str()); + qDebug(QString("ModuleBase_FilterValidated::IsOk = %1") + .arg(aValid) + .toStdString() + .c_str()); #endif return aValid; } - diff --git a/src/ModuleBase/ModuleBase_FilterValidated.h b/src/ModuleBase/ModuleBase_FilterValidated.h index 56c3c37f2..66e06b296 100644 --- a/src/ModuleBase/ModuleBase_FilterValidated.h +++ b/src/ModuleBase/ModuleBase_FilterValidated.h @@ -14,50 +14,50 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_FilterValidated_H #define ModuleBase_FilterValidated_H -#include #include +#include class ModuleBase_IWorkshop; //#define DEBUG_FILTERS /** -* \ingroup GUI -* \class ModuleBase_FilterValidated -* A filter which provides filtering of selection in 3d viewer. -* Installing of this filter lets to select objects which belong to -* currently active document or to global document -*/ + * \ingroup GUI + * \class ModuleBase_FilterValidated + * A filter which provides filtering of selection in 3d viewer. + * Installing of this filter lets to select objects which belong to + * currently active document or to global document + */ DEFINE_STANDARD_HANDLE(ModuleBase_FilterValidated, SelectMgr_Filter); -class ModuleBase_FilterValidated: public SelectMgr_Filter -{ +class ModuleBase_FilterValidated : public SelectMgr_Filter { public: /// Constructor /// \param theWorkshop instance of workshop interface - Standard_EXPORT ModuleBase_FilterValidated(ModuleBase_IWorkshop* theWorkshop): - SelectMgr_Filter(), myWorkshop(theWorkshop) {} + Standard_EXPORT ModuleBase_FilterValidated(ModuleBase_IWorkshop *theWorkshop) + : SelectMgr_Filter(), myWorkshop(theWorkshop) {} /** * Returns true if the owner is computed from decomposition * (it is global selection, not the sub-shapes) - * of if the selected result is a construction and the result + * of if the selected result is a construction and the result * feature is composite and has sub-elements. * \param theOwner the result of selection * \return whether the owner is selectable in the viewer - */ - Standard_EXPORT virtual - Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + */ + Standard_EXPORT virtual Standard_Boolean + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; DEFINE_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter) protected: /// Instance of workshop interface - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_IErrorMgr.cpp b/src/ModuleBase/ModuleBase_IErrorMgr.cpp index 401d9f940..f29a1203c 100644 --- a/src/ModuleBase/ModuleBase_IErrorMgr.cpp +++ b/src/ModuleBase/ModuleBase_IErrorMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IErrorMgr.h" @@ -22,27 +23,24 @@ #include "ModuleBase_IPropertyPanel.h" #include "ModuleBase_ModelWidget.h" -ModuleBase_IErrorMgr::ModuleBase_IErrorMgr(QObject* theParent /*= 0*/) - : QObject(theParent) - , myPropertyPanel(NULL) -{ +ModuleBase_IErrorMgr::ModuleBase_IErrorMgr(QObject *theParent /*= 0*/) + : QObject(theParent), myPropertyPanel(NULL) {} -} - -ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() -{ - -} +ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() {} -void ModuleBase_IErrorMgr::setPropertyPanel(ModuleBase_IPropertyPanel* theProp) -{ +void ModuleBase_IErrorMgr::setPropertyPanel( + ModuleBase_IPropertyPanel *theProp) { myPropertyPanel = theProp; if (myPropertyPanel) { - foreach(const ModuleBase_ModelWidget* aWgt, myPropertyPanel->modelWidgets()) { - connect(aWgt, SIGNAL(afterValuesChanged()), this, SLOT(onWidgetChanged())); - connect(aWgt, SIGNAL(afterValuesRestored()), this, SLOT(onWidgetChanged())); - connect(aWgt, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetChanged())); + foreach (const ModuleBase_ModelWidget *aWgt, + myPropertyPanel->modelWidgets()) { + connect(aWgt, SIGNAL(afterValuesChanged()), this, + SLOT(onWidgetChanged())); + connect(aWgt, SIGNAL(afterValuesRestored()), this, + SLOT(onWidgetChanged())); + connect(aWgt, SIGNAL(valueStateChanged(int)), this, + SLOT(onWidgetChanged())); } } } diff --git a/src/ModuleBase/ModuleBase_IErrorMgr.h b/src/ModuleBase/ModuleBase_IErrorMgr.h index c1567fa37..56087701d 100644 --- a/src/ModuleBase/ModuleBase_IErrorMgr.h +++ b/src/ModuleBase/ModuleBase_IErrorMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IErrorMgr_H @@ -34,34 +35,35 @@ class ModelAPI_Feature; * \ingroup GUI * \brief An interface to Errors manager object */ -class MODULEBASE_EXPORT ModuleBase_IErrorMgr : public QObject -{ +class MODULEBASE_EXPORT ModuleBase_IErrorMgr : public QObject { Q_OBJECT public: /// Default constructor /// \param theParent a parent object - ModuleBase_IErrorMgr(QObject* theParent = 0); + ModuleBase_IErrorMgr(QObject *theParent = 0); /// Virtual destructor virtual ~ModuleBase_IErrorMgr(); /// \brief Set property pane to the operation /// \param theProp a property panel instance - virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp); + virtual void setPropertyPanel(ModuleBase_IPropertyPanel *theProp); /// \return Currently installed property panel - ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; } + ModuleBase_IPropertyPanel *propertyPanel() const { return myPropertyPanel; } /// Update actions for the given feature /// \param theFeature a feature - virtual void updateActions(const std::shared_ptr& theFeature) = 0; + virtual void + updateActions(const std::shared_ptr &theFeature) = 0; protected slots: - /// Process values changed event for processing feature attribute validation errors. + /// Process values changed event for processing feature attribute validation + /// errors. virtual void onWidgetChanged() = 0; protected: /// Access to property panel - ModuleBase_IPropertyPanel* myPropertyPanel; + ModuleBase_IPropertyPanel *myPropertyPanel; }; -#endif // ModuleBase_IErrorMgr_H \ No newline at end of file +#endif // ModuleBase_IErrorMgr_H diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index 889449958..7a426890d 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -14,68 +14,68 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include "ModelAPI_IReentrant.h" #include "ModelAPI_EventReentrantMessage.h" +#include "ModelAPI_IReentrant.h" +#include "ModuleBase_Dialog.h" +#include "ModuleBase_IErrorMgr.h" #include "ModuleBase_IModule.h" -#include "ModuleBase_IViewer.h" -#include "ModuleBase_ViewerPrs.h" -#include "ModuleBase_Operation.h" #include "ModuleBase_IPropertyPanel.h" #include "ModuleBase_ISelection.h" +#include "ModuleBase_IViewer.h" +#include "ModuleBase_ModelWidget.h" +#include "ModuleBase_Operation.h" #include "ModuleBase_OperationDescription.h" #include "ModuleBase_OperationFeature.h" -#include "ModuleBase_ModelWidget.h" -#include "ModuleBase_WidgetFactory.h" #include "ModuleBase_PageWidget.h" -#include "ModuleBase_Dialog.h" -#include "ModuleBase_IErrorMgr.h" +#include "ModuleBase_ViewerPrs.h" +#include "ModuleBase_WidgetFactory.h" #include #include #include -#include +#include "ModelAPI_Tools.h" #include +#include #include -#include "ModelAPI_Tools.h" +#include #include #include -#include #include -#include #include -#include #include +#include +#include #include -ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent) - : QObject(theParent), myWorkshop(theParent) -{ - connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); - - - //connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)), this, - // SLOT(onMousePressed(QMouseEvent*))); - //connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)), this, - // SLOT(onMouseReleased(QMouseEvent*))); - //connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)), this, - // SLOT(onMouseMoved(QMouseEvent*))); - //connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)), this, - // SLOT(onKeyRelease(QKeyEvent*))); - //connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)), this, - // SLOT(onMouseDoubleClick(QMouseEvent*))); +ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop *theParent) + : QObject(theParent), myWorkshop(theParent) { + connect(myWorkshop, SIGNAL(selectionChanged()), this, + SLOT(onSelectionChanged())); + + // connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)), this, + // SLOT(onMousePressed(QMouseEvent*))); + // connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)), this, + // SLOT(onMouseReleased(QMouseEvent*))); + // connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)), this, + // SLOT(onMouseMoved(QMouseEvent*))); + // connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)), this, + // SLOT(onKeyRelease(QKeyEvent*))); + // connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)), this, + // SLOT(onMouseDoubleClick(QMouseEvent*))); } -ModuleBase_IModule::~ModuleBase_IModule() -{ - std::map::const_iterator aFiltersIt = - mySelectionFilters.begin(); +ModuleBase_IModule::~ModuleBase_IModule() { + std::map::const_iterator aFiltersIt = + mySelectionFilters.begin(); for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) { Handle(SelectMgr_Filter) aFilter = aFiltersIt->second; if (!aFilter.IsNull()) @@ -83,9 +83,7 @@ ModuleBase_IModule::~ModuleBase_IModule() } } - -void ModuleBase_IModule::launchModal(const QString& theCmdId) -{ +void ModuleBase_IModule::launchModal(const QString &theCmdId) { bool isCommitted; if (!myWorkshop->canStartOperation(theCmdId, isCommitted)) return; @@ -104,39 +102,42 @@ void ModuleBase_IModule::launchModal(const QString& theCmdId) myWorkshop->updateCommandStatus(); } - -void ModuleBase_IModule::launchOperation(const QString& theCmdId, - const bool& isStartAfterCommitOnly) -{ - /// selection should be obtained from workshop before ask if the operation can be started as - /// the canStartOperation method performs commit/abort of previous operation. - /// Sometimes commit/abort may cause selection clear(Sketch operation) as a result - /// it will be lost and is not used for preselection. - ModuleBase_ISelection* aSelection = myWorkshop->selection(); +void ModuleBase_IModule::launchOperation(const QString &theCmdId, + const bool &isStartAfterCommitOnly) { + /// selection should be obtained from workshop before ask if the operation can + /// be started as the canStartOperation method performs commit/abort of + /// previous operation. Sometimes commit/abort may cause selection + /// clear(Sketch operation) as a result it will be lost and is not used for + /// preselection. + ModuleBase_ISelection *aSelection = myWorkshop->selection(); QList aPreSelected = - aSelection->getSelected(ModuleBase_ISelection::AllControls); + aSelection->getSelected(ModuleBase_ISelection::AllControls); - ModuleBase_OperationFeature* aCurOperation = dynamic_cast - (myWorkshop->currentOperation()); - QString aCurOperationKind = aCurOperation ? aCurOperation->getDescription()->operationId() : ""; + ModuleBase_OperationFeature *aCurOperation = + dynamic_cast( + myWorkshop->currentOperation()); + QString aCurOperationKind = + aCurOperation ? aCurOperation->getDescription()->operationId() : ""; bool isCommitted; if (!myWorkshop->canStartOperation(theCmdId, isCommitted)) return; - /// reentrant operation(Sketch Line) should not be started if operation is aborted + /// reentrant operation(Sketch Line) should not be started if operation is + /// aborted if (isStartAfterCommitOnly && !isCommitted) return; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (createOperation(theCmdId.toStdString())); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + createOperation(theCmdId.toStdString())); if (aFOperation) { std::shared_ptr aMessage = reentrantMessage(); if (aMessage.get()) { setReentrantPreSelection(aMessage); - } - else if (canUsePreselection(aCurOperationKind, theCmdId)) { - // restore of previous opeation is absent or new launched operation has the same kind + } else if (canUsePreselection(aCurOperationKind, theCmdId)) { + // restore of previous opeation is absent or new launched operation has + // the same kind aFOperation->initSelection(aPreSelected); } workshop()->processLaunchOperation(aFOperation); @@ -144,14 +145,16 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId, if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); ModelReentrantPtr aReentrantFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aReentrantFeature.get()) { if (aMessage.get()) { - ModuleBase_IPropertyPanel* aPanel = workshop()->propertyPanel(); - std::string aPrevAttribute = aReentrantFeature->processEvent(aMessage); + ModuleBase_IPropertyPanel *aPanel = workshop()->propertyPanel(); + std::string aPrevAttribute = + aReentrantFeature->processEvent(aMessage); if (!aPrevAttribute.empty()) { workshop()->errorMgr()->updateActions(aFeature); - ModuleBase_ModelWidget* aPrevWidget = aPanel->modelWidget(aPrevAttribute); + ModuleBase_ModelWidget *aPrevWidget = + aPanel->modelWidget(aPrevAttribute); aPanel->activateNextWidget(aPrevWidget); } } @@ -160,41 +163,40 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId, } } -AISObjectPtr ModuleBase_IModule::createPresentation(const ObjectPtr& theResult) -{ +AISObjectPtr +ModuleBase_IModule::createPresentation(const ObjectPtr &theResult) { return AISObjectPtr(); } -bool ModuleBase_IModule::canBeShaded(Handle(AIS_InteractiveObject) theAIS) const -{ +bool ModuleBase_IModule::canBeShaded(Handle(AIS_InteractiveObject) + theAIS) const { return true; } -QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature) -{ +QString ModuleBase_IModule::getFeatureError(const FeaturePtr &theFeature) { // Error already translated. std::string aMsg = ModelAPI_Tools::getFeatureError(theFeature); return QString::fromUtf8(aMsg.c_str()); } -void ModuleBase_IModule::grantedOperationIds(ModuleBase_Operation* theOperation, - QStringList& theIds) const -{ -} +void ModuleBase_IModule::grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const {} -ModuleBase_Operation* ModuleBase_IModule::getNewOperation(const std::string& theFeatureId) -{ +ModuleBase_Operation * +ModuleBase_IModule::getNewOperation(const std::string &theFeatureId) { return new ModuleBase_OperationFeature(theFeatureId.c_str(), this); } -ModuleBase_Operation* ModuleBase_IModule::createOperation(const std::string& theFeatureId) -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getNewOperation(theFeatureId)); - // If the operation is launched as sub-operation of another then we have to initialize - // parent feature - ModuleBase_OperationFeature* aCurOperation = dynamic_cast - (myWorkshop->currentOperation()); +ModuleBase_Operation * +ModuleBase_IModule::createOperation(const std::string &theFeatureId) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + getNewOperation(theFeatureId)); + // If the operation is launched as sub-operation of another then we have to + // initialize parent feature + ModuleBase_OperationFeature *aCurOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (aCurOperation) { FeaturePtr aFeature = aCurOperation->feature(); CompositeFeaturePtr aCompFeature = @@ -206,14 +208,15 @@ ModuleBase_Operation* ModuleBase_IModule::createOperation(const std::string& the std::string aXmlCfg, aDescription; getXMLRepresentation(theFeatureId, aXmlCfg, aDescription); - aFOperation->getDescription()->setDescription(QString::fromStdString(aDescription)); - aFOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg)); + aFOperation->getDescription()->setDescription( + QString::fromStdString(aDescription)); + aFOperation->getDescription()->setXmlRepresentation( + QString::fromStdString(aXmlCfg)); return aFOperation; } -void ModuleBase_IModule::createFeatures() -{ +void ModuleBase_IModule::createFeatures() { registerValidators(); registerProperties(); @@ -224,11 +227,11 @@ void ModuleBase_IModule::createFeatures() myProprietaryPlugins = aXMLReader.proprietaryPlugins(); } -void ModuleBase_IModule::processProprietaryFeatures() -{ +void ModuleBase_IModule::processProprietaryFeatures() { std::set::iterator it = myFeaturesValidLicense.begin(); while (it != myFeaturesValidLicense.end()) { - std::map::iterator aFound = myProprietaryFeatures.find(*it); + std::map::iterator aFound = + myProprietaryFeatures.find(*it); if (aFound == myProprietaryFeatures.end()) ++it; else { @@ -240,39 +243,39 @@ void ModuleBase_IModule::processProprietaryFeatures() } } -void ModuleBase_IModule::loadProprietaryPlugins() -{ +void ModuleBase_IModule::loadProprietaryPlugins() { for (std::set::const_iterator itP = myProprietaryPlugins.begin(); itP != myProprietaryPlugins.end(); ++itP) { if (!ModelAPI_Session::get()->checkLicense(*itP)) - Events_InfoMessage(*itP, "License of %1 plugin is not valid or not exist!").arg(*itP).send(); + Events_InfoMessage(*itP, + "License of %1 plugin is not valid or not exist!") + .arg(*itP) + .send(); } } - -void ModuleBase_IModule::actionCreated(QAction* theFeature) -{ - connect(theFeature, SIGNAL(triggered(bool)), this, SLOT(onFeatureTriggered())); +void ModuleBase_IModule::actionCreated(QAction *theFeature) { + connect(theFeature, SIGNAL(triggered(bool)), this, + SLOT(onFeatureTriggered())); } -bool ModuleBase_IModule::canEraseObject(const ObjectPtr& theObject) const -{ +bool ModuleBase_IModule::canEraseObject(const ObjectPtr &theObject) const { return true; } -bool ModuleBase_IModule::canDisplayObject(const ObjectPtr& theObject) const -{ +bool ModuleBase_IModule::canDisplayObject(const ObjectPtr &theObject) const { return true; } -bool ModuleBase_IModule::canUsePreselection(const QString& thePreviousOperationKind, - const QString& theStartedOperationKind) -{ +bool ModuleBase_IModule::canUsePreselection( + const QString &thePreviousOperationKind, + const QString &theStartedOperationKind) { // no previous operation if (thePreviousOperationKind.isEmpty()) return true; // edit operation - if (thePreviousOperationKind.endsWith(ModuleBase_OperationFeature::EditSuffix())) + if (thePreviousOperationKind.endsWith( + ModuleBase_OperationFeature::EditSuffix())) return true; // reentrant operation @@ -282,35 +285,32 @@ bool ModuleBase_IModule::canUsePreselection(const QString& thePreviousOperationK return false; } -bool ModuleBase_IModule::canUndo() const -{ +bool ModuleBase_IModule::canUndo() const { SessionPtr aMgr = ModelAPI_Session::get(); return aMgr->hasModuleDocument() && aMgr->canUndo() && !aMgr->isOperation(); } -bool ModuleBase_IModule::canRedo() const -{ +bool ModuleBase_IModule::canRedo() const { SessionPtr aMgr = ModelAPI_Session::get(); return aMgr->hasModuleDocument() && aMgr->canRedo() && !aMgr->isOperation(); } -void ModuleBase_IModule::onFeatureTriggered() -{ - QAction* aCmd = dynamic_cast(sender()); - //Do nothing on uncheck +void ModuleBase_IModule::onFeatureTriggered() { + QAction *aCmd = dynamic_cast(sender()); + // Do nothing on uncheck if (aCmd->isCheckable() && !aCmd->isChecked()) { - ModuleBase_Operation* anOperation = myWorkshop->findStartedOperation(aCmd->data().toString()); + ModuleBase_Operation *anOperation = + myWorkshop->findStartedOperation(aCmd->data().toString()); if (myWorkshop->canStopOperation(anOperation)) { bool isCommitted; myWorkshop->stopOperation(anOperation, isCommitted); - } - else { + } else { aCmd->setChecked(true); } - } - else { + } else { QString aCmdId = aCmd->data().toString(); - std::shared_ptr aInfo = myWorkshop->featureInfo(aCmdId); + std::shared_ptr aInfo = + myWorkshop->featureInfo(aCmdId); if (aInfo.get() && aInfo->isModal()) { launchModal(aCmdId); } else { @@ -319,36 +319,35 @@ void ModuleBase_IModule::onFeatureTriggered() } } -void ModuleBase_IModule::editFeature(FeaturePtr theFeature) -{ +void ModuleBase_IModule::editFeature(FeaturePtr theFeature) { std::string aFeatureId = theFeature->getKind(); bool isCommitted; if (!myWorkshop->canStartOperation(aFeatureId.c_str(), isCommitted)) return; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (createOperation(aFeatureId)); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(createOperation(aFeatureId)); if (aFOperation) { aFOperation->setFeature(theFeature); workshop()->processLaunchOperation(aFOperation); } } -bool ModuleBase_IModule::canActivateSelection(const ObjectPtr& theObject) const -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); +bool ModuleBase_IModule::canActivateSelection( + const ObjectPtr &theObject) const { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); return !aFOperation || !aFOperation->hasObject(theObject); } -void ModuleBase_IModule::operationResumed(ModuleBase_Operation* theOperation) -{ +void ModuleBase_IModule::operationResumed(ModuleBase_Operation *theOperation) { emit resumed(theOperation); } -void ModuleBase_IModule::getXMLRepresentation(const std::string& theFeatureId, - std::string& theXmlCfg, std::string& theDescription) -{ +void ModuleBase_IModule::getXMLRepresentation(const std::string &theFeatureId, + std::string &theXmlCfg, + std::string &theDescription) { std::string aPluginFileName = myFeaturesInFiles[theFeatureId]; Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginFileName); aWdgReader.readAll(); @@ -357,14 +356,13 @@ void ModuleBase_IModule::getXMLRepresentation(const std::string& theFeatureId, theDescription = aWdgReader.featureDescription(theFeatureId); } - //****************************************************** -QIntList ModuleBase_IModule::selectionFilters() -{ +QIntList ModuleBase_IModule::selectionFilters() { QIntList aTypes; - std::map::const_iterator aFiltersIt = - mySelectionFilters.begin(); + std::map::const_iterator aFiltersIt = + mySelectionFilters.begin(); for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) aTypes.append(aFiltersIt->first); @@ -372,16 +370,17 @@ QIntList ModuleBase_IModule::selectionFilters() } //****************************************************** -void ModuleBase_IModule::registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType, - const Handle(SelectMgr_Filter)& theFilter) -{ +void ModuleBase_IModule::registerSelectionFilter( + const ModuleBase_SelectionFilterType theFilterType, + const Handle(SelectMgr_Filter) & theFilter) { mySelectionFilters[theFilterType] = theFilter; } //****************************************************** -Handle(SelectMgr_Filter) ModuleBase_IModule::selectionFilter(const int theType) -{ - ModuleBase_SelectionFilterType aType = (ModuleBase_SelectionFilterType)theType; +Handle(SelectMgr_Filter) + ModuleBase_IModule::selectionFilter(const int theType) { + ModuleBase_SelectionFilterType aType = + (ModuleBase_SelectionFilterType)theType; if (mySelectionFilters.find(aType) != mySelectionFilters.end()) return mySelectionFilters[aType]; diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index e60281374..34512cbb3 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IModule_H @@ -24,25 +25,25 @@ #include "ModuleBase_IWorkshop.h" #include -#include #include +#include -#include #include +#include #include -#include -#include -#include #include +#include +#include +#include +#include #include #include -#include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif class QAction; @@ -66,22 +67,22 @@ class AIS_InteractiveObject; * \ingroup GUI * Interface to a module */ -class MODULEBASE_EXPORT ModuleBase_IModule : public QObject -{ +class MODULEBASE_EXPORT ModuleBase_IModule : public QObject { Q_OBJECT - public: +public: /// enumeration to know which objects should be customized enum ModuleBase_CustomizeFlag { - CustomizeArguments = 0, /// references of other objects referenced to the current feature - CustomizeResults, /// results of the current feature + CustomizeArguments = + 0, /// references of other objects referenced to the current feature + CustomizeResults, /// results of the current feature CustomizeHighlightedObjects /// highlighted objects of the active widget }; - /// Constructor - /// \param theParent instance of workshop interface - ModuleBase_IModule(ModuleBase_IWorkshop* theParent); + /// Constructor + /// \param theParent instance of workshop interface + ModuleBase_IModule(ModuleBase_IWorkshop *theParent); - virtual ~ModuleBase_IModule(); + virtual ~ModuleBase_IModule(); /// Stores the current selection virtual void storeSelection() {} @@ -93,83 +94,87 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject virtual void createFeatures(); /// Called on creation of menu item in desktop - virtual void actionCreated(QAction*); + virtual void actionCreated(QAction *); /// Launching of a edit operation on the feature /// \param theFeature feature for editing virtual void editFeature(FeaturePtr theFeature); - /// Returns true if the operation can be committed. Result in default implementation is true. - /// \return boolean value + /// Returns true if the operation can be committed. Result in default + /// implementation is true. \return boolean value virtual bool canCommitOperation() const { return true; } /// Creates an operation and send it to loop /// \param theCmdId the operation name - /// \param isStartAfterCommitOnly operation is launched if there is no active operation or + /// \param isStartAfterCommitOnly operation is launched if there is no active + /// operation or /// it is committed - virtual void launchOperation(const QString& theCmdId, - const bool& isStartAfterCommitOnly); + virtual void launchOperation(const QString &theCmdId, + const bool &isStartAfterCommitOnly); /// Executes feature as a modal dialog box /// \param theCmdId the operation name - virtual void launchModal(const QString& theCmdId); + virtual void launchModal(const QString &theCmdId); /// Realizes some functionality by an operation start /// \param theOperation a started operation - virtual void operationStarted(ModuleBase_Operation* theOperation) {} + virtual void operationStarted(ModuleBase_Operation *theOperation) {} /// Realizes some functionality by an operation resume /// By default it emits operationResumed signal /// \param theOperation a resumed operation - virtual void operationResumed(ModuleBase_Operation* theOperation); + virtual void operationResumed(ModuleBase_Operation *theOperation); /// Realizes some functionality by an operation stop - virtual void operationStopped(ModuleBase_Operation* theOperation) {} + virtual void operationStopped(ModuleBase_Operation *theOperation) {} /// Realizes some functionality by an operation commit - virtual void operationCommitted(ModuleBase_Operation* theOperation) {} + virtual void operationCommitted(ModuleBase_Operation *theOperation) {} /// Realizes some functionality by an operation abort - virtual void operationAborted(ModuleBase_Operation* theOperation) {} + virtual void operationAborted(ModuleBase_Operation *theOperation) {} /// Realizes some functionality by an operation start - virtual ModuleBase_Operation* currentOperation() const = 0; + virtual ModuleBase_Operation *currentOperation() const = 0; /// Add menu items for viewer into the actions map /// \param theStdActions a map of standard actions /// \param theParent a parent widget - /// \param theMenuActions map of action/menu for the desirable index in the viewer menu - /// \return true if items are added and there is no necessity to provide standard menu - virtual bool addViewerMenu(const QMap& theStdActions, - QWidget* theParent, - QMap& theMenuActions) const - { return false; } + /// \param theMenuActions map of action/menu for the desirable index in the + /// viewer menu \return true if items are added and there is no necessity to + /// provide standard menu + virtual bool addViewerMenu(const QMap &theStdActions, + QWidget *theParent, + QMap &theMenuActions) const { + return false; + } /// Add menu items for object browser into the given menu /// \param theMenu a popup menu to be shown in the object browser - virtual void addObjectBrowserMenu(QMenu* theMenu) const {}; + virtual void addObjectBrowserMenu(QMenu *theMenu) const {}; /// Creates custom widgets for property panel /// \param theType a type of widget /// \param theParent the parent object /// \param theWidgetApi the widget configuration. /// The attribute of the model widget is obtained from - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi) - { + virtual ModuleBase_ModelWidget * + createWidgetByType(const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi) { return 0; } - /// Returns the active widget, by default it is the property panel active widget - virtual ModuleBase_ModelWidget* activeWidget() const = 0; + /// Returns the active widget, by default it is the property panel active + /// widget + virtual ModuleBase_ModelWidget *activeWidget() const = 0; /// Returns current workshop - ModuleBase_IWorkshop* workshop() const { return myWorkshop; } + ModuleBase_IWorkshop *workshop() const { return myWorkshop; } /// Call back forlast tuning of property panel before operation performance - /// It is called as on clearing of property panel as on filling with new widgets - virtual void propertyPanelDefined(ModuleBase_Operation* theOperation) {} + /// It is called as on clearing of property panel as on filling with new + /// widgets + virtual void propertyPanelDefined(ModuleBase_Operation *theOperation) {} /// Have an opportunity to create widgets for the current operation /// instead of standard creation in workshop @@ -177,49 +182,56 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// \param theXmlRepr an XML representation of the operation /// \param theWidgets a list of created widgets /// \return boolean result, false by default - virtual bool createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr, - QList& theWidgets) const { return false; } + virtual bool + createWidgets(const FeaturePtr &theFeature, const QString &theXmlRepr, + QList &theWidgets) const { + return false; + } - //! Returns True if there are available Undos and there is not an active operation + //! Returns True if there are available Undos and there is not an active + //! operation virtual bool canUndo() const; - //! Returns True if there are available Redos and there is not an active operation + //! Returns True if there are available Redos and there is not an active + //! operation virtual bool canRedo() const; /// Returns true if the action can be applyed to the object /// \param theObject a checked object - /// \param theActionId an identifier of action, to be found in the menu manager like "DELETE_CMD" - /// \return the a boolean result - virtual bool canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const = 0; - - /// Returns True if the current operation can be committed. By default it is true. - /// \return a boolean value - //virtual bool canCommitOperation() const; - - /// Returns whether the object can be erased. The default realization returns true. - /// \param theObject a model object - virtual bool canEraseObject(const ObjectPtr& theObject) const; - - /// Returns whether the object can be displayed. The default realization returns true. - /// \param theObject a model object - virtual bool canDisplayObject(const ObjectPtr& theObject) const; - - /// Returns whether the started operation may use preselection of the previous one - /// Cases are: previous operation is null, edit operation, previuos and started operations - /// kinds are the same - /// \param thePreviousOperationKind a kind of previous operation - /// \param theStartedOperationKind a kind of a started operation - virtual bool canUsePreselection(const QString& thePreviousOperationKind, - const QString& theStartedOperationKind); + /// \param theActionId an identifier of action, to be found in the menu + /// manager like "DELETE_CMD" \return the a boolean result + virtual bool canApplyAction(const ObjectPtr &theObject, + const QString &theActionId) const = 0; + + /// Returns True if the current operation can be committed. By default it is + /// true. \return a boolean value + // virtual bool canCommitOperation() const; + + /// Returns whether the object can be erased. The default realization returns + /// true. \param theObject a model object + virtual bool canEraseObject(const ObjectPtr &theObject) const; + + /// Returns whether the object can be displayed. The default realization + /// returns true. \param theObject a model object + virtual bool canDisplayObject(const ObjectPtr &theObject) const; + + /// Returns whether the started operation may use preselection of the previous + /// one Cases are: previous operation is null, edit operation, previuos and + /// started operations kinds are the same \param thePreviousOperationKind a + /// kind of previous operation \param theStartedOperationKind a kind of a + /// started operation + virtual bool canUsePreselection(const QString &thePreviousOperationKind, + const QString &theStartedOperationKind); /// Make some functionality after the objects are hidden in viewer /// \param theObjects a list of hidden objects - //virtual void processHiddenObject(const std::list& theObjects) {}; + // virtual void processHiddenObject(const std::list& theObjects) + // {}; /// Returns true if selection for the object can be activate. - /// By default a result or feature of the current operation can not be activated - /// \param theObject a model object - virtual bool canActivateSelection(const ObjectPtr& theObject) const; + /// By default a result or feature of the current operation can not be + /// activated \param theObject a model object + virtual bool canActivateSelection(const ObjectPtr &theObject) const; /// Reacts to the delete action in module /// \returns true if the action is processed @@ -233,18 +245,19 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Returns a list of modes, where the AIS objects should be activated /// \param theModes a list of modes - virtual void activeSelectionModes(QIntList& theModes) {} + virtual void activeSelectionModes(QIntList &theModes) {} /// Appends specific selection modes for the module to the list of types /// \param theModesType combination of available selection filters /// \param theModes a selection modes to be extended - virtual void moduleSelectionModes(int theModesType, QIntList& theModes) = 0; + virtual void moduleSelectionModes(int theModesType, QIntList &theModes) = 0; - /// Appends into container of filters module filters corresponded to the modes type - /// \param theFilterTypes container of available selection filters - /// \param theSelectionFilters [out] container to be extend by elements - virtual void moduleSelectionFilters(const QIntList& theFilterTypes, - SelectMgr_ListOfFilter& theSelectionFilters) = 0; + /// Appends into container of filters module filters corresponded to the modes + /// type \param theFilterTypes container of available selection filters \param + /// theSelectionFilters [out] container to be extend by elements + virtual void + moduleSelectionFilters(const QIntList &theFilterTypes, + SelectMgr_ListOfFilter &theSelectionFilters) = 0; /// Returns types of registered module selection filters /// \param theSelectionFilters [out] container of type value @@ -255,52 +268,63 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// \param theFilter instance of filter virtual Handle(SelectMgr_Filter) selectionFilter(const int theType); - /// Append selection filter into the module and type of the filter in internal container - /// \param theFilterType selection filter type - /// \param theFilter added filter - void registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType, - const Handle(SelectMgr_Filter)& theFilter); + /// Append selection filter into the module and type of the filter in internal + /// container \param theFilterType selection filter type \param theFilter + /// added filter + void + registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType, + const Handle(SelectMgr_Filter) & theFilter); /// Return true if the custom presentation is activated - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// \return boolean value - virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const - { return false; }; + /// \param theFlag a flag of level of customization, which means that only + /// part of sub-elements \return boolean value + virtual bool + isCustomPrsActivated(const ModuleBase_CustomizeFlag &theFlag) const { + return false; + }; /// Activate custom presentation for the object. Default realization is empty. /// \param theFeature a feature instance - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// \param theUpdateViewer the parameter whether the viewer should be update immediately - virtual void activateCustomPrs(const FeaturePtr& theFeature, - const ModuleBase_CustomizeFlag& theFlag, + /// \param theFlag a flag of level of customization, which means that only + /// part of sub-elements \param theUpdateViewer the parameter whether the + /// viewer should be update immediately + virtual void activateCustomPrs(const FeaturePtr &theFeature, + const ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer) {} - /// Deactivate custom presentation for the object. Default realization is empty. - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// \param theUpdateViewer the parameter whether the viewer should be update immediately - virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag, + /// Deactivate custom presentation for the object. Default realization is + /// empty. \param theFlag a flag of level of customization, which means that + /// only part of sub-elements \param theUpdateViewer the parameter whether the + /// viewer should be update immediately + virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer) {} /// Modifies the given presentation in the custom way. - //virtual bool customisePresentation(std::shared_ptr theResult, - // AISObjectPtr thePrs, - // GeomCustomPrsPtr theCustomPrs) { return false; }; - - ///// Modifies the given presentation in the custom way after usual customize is performed. - //virtual bool afterCustomisePresentation(std::shared_ptr theResult, - // AISObjectPtr thePrs, - // GeomCustomPrsPtr theCustomPrs) { return false; }; - - /// Update the object presentable properties such as color, lines width and other - /// If the object is result with the color attribute value set, it is used, - /// otherwise the customize is applyed to the object's feature if it is a custom prs - /// \param theObject an object instance - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// should be updated(e.g. only highlighted elements) - /// \param theUpdateViewer the parameter whether the viewer should be update immediately - /// \returns true if the object is modified - virtual bool customizeFeature(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) { + // virtual bool customisePresentation(std::shared_ptr + // theResult, + // AISObjectPtr thePrs, + // GeomCustomPrsPtr theCustomPrs) { return + // false; }; + + ///// Modifies the given presentation in the custom way after usual customize + /// is performed. + // virtual bool afterCustomisePresentation(std::shared_ptr + // theResult, + // AISObjectPtr thePrs, + // GeomCustomPrsPtr theCustomPrs) { return + // false; }; + + /// Update the object presentable properties such as color, lines width and + /// other If the object is result with the color attribute value set, it is + /// used, otherwise the customize is applyed to the object's feature if it is + /// a custom prs \param theObject an object instance \param theFlag a flag of + /// level of customization, which means that only part of sub-elements should + /// be updated(e.g. only highlighted elements) \param theUpdateViewer the + /// parameter whether the viewer should be update immediately \returns true if + /// the object is modified + virtual bool customizeFeature(ObjectPtr theObject, + const ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { return false; } @@ -311,28 +335,29 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Enables disabled custom mode virtual void enableCustomModes() {} - /// This method is called on object browser creation for customization of module specific features - /// \param theObjectBrowser a pinter on Object Browser widget - virtual void customizeObjectBrowser(QWidget* theObjectBrowser) {} + /// This method is called on object browser creation for customization of + /// module specific features \param theObjectBrowser a pinter on Object + /// Browser widget + virtual void customizeObjectBrowser(QWidget *theObjectBrowser) {} /// Creates a new operation /// \param theCmdId the operation name - virtual ModuleBase_Operation* createOperation(const std::string& theCmdId); + virtual ModuleBase_Operation *createOperation(const std::string &theCmdId); /// Create specific for the module presentation. The presentation has to be /// customized accordingly to the object. /// \param theResult an object for presentation /// \return created presentation or NULL(default value) - virtual AISObjectPtr createPresentation(const ObjectPtr& theResult); + virtual AISObjectPtr createPresentation(const ObjectPtr &theResult); /// Customize presentation according to objects attributes /// \param theObject an object for presentation /// \param thePrs a presentation object - virtual void customizePresentation(const ObjectPtr& theObject, const AISObjectPtr& thePrs) const - {} + virtual void customizePresentation(const ObjectPtr &theObject, + const AISObjectPtr &thePrs) const {} //! Returns data object by AIS - virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0; + virtual ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const = 0; //! Returns true if the presentation can be shown in shading mode //! \param theAIS presentation to be checked @@ -341,75 +366,85 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Update state of pop-up menu items in object browser /// \param theStdActions - a map of standard actions - virtual void updateObjectBrowserMenu(const QMap& theStdActions) {} + virtual void + updateObjectBrowserMenu(const QMap &theStdActions) {} /// Update state of pop-up menu items in viewer /// \param theStdActions - a map of standard actions - virtual void updateViewerMenu(const QMap& theStdActions) {} + virtual void updateViewerMenu(const QMap &theStdActions) { + } /// Returns true if the action should be always enabled /// \param theActionId an action index: Accept or Accept All /// \return boolean value - virtual bool isActionEnableStateFixed(const int theActionId) const { return false; } + virtual bool isActionEnableStateFixed(const int theActionId) const { + return false; + } - //! Returns the feature error if the current state of the feature in the module is not correct - //! If the feature is correct, it returns an empty value + //! Returns the feature error if the current state of the feature in the + //! module is not correct If the feature is correct, it returns an empty value //! \return string value - virtual QString getFeatureError(const FeaturePtr& theFeature); + virtual QString getFeatureError(const FeaturePtr &theFeature); /// Returns list of granted operation indices - virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const; + virtual void grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const; - /// Connects or disconnects to the value changed signal of the property panel widgets - /// \param theWidget a property contol widget - /// \param isToConnect a boolean value whether connect or disconnect - virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) {}; + /// Connects or disconnects to the value changed signal of the property panel + /// widgets \param theWidget a property contol widget \param isToConnect a + /// boolean value whether connect or disconnect + virtual void connectToPropertyPanel(ModuleBase_ModelWidget *theWidget, + const bool isToConnect){}; /// Validates the operation to change the "Apply" button state. /// \param thePreviousState the previous state of the widget - virtual void widgetStateChanged(int thePreviousState) {}; + virtual void widgetStateChanged(int thePreviousState){}; /// Returns true if the event is processed. /// \param thePreviousAttributeID an index of the previous active attribute - virtual bool processEnter(const std::string& thePreviousAttributeID) { return false; }; + virtual bool processEnter(const std::string &thePreviousAttributeID) { + return false; + }; /// Performs some GUI actions before an operation transaction is stopped /// Default realization is empty - virtual void beforeOperationStopped(ModuleBase_Operation* theOperation) {}; + virtual void beforeOperationStopped(ModuleBase_Operation *theOperation){}; /// Finds a shape by attribute if it is possible /// \param theAttribute an attribute /// \return a geom shape - virtual GeomShapePtr findShape(const AttributePtr& theAttribute) = 0; + virtual GeomShapePtr findShape(const AttributePtr &theAttribute) = 0; /// Finds an attribute by geom shape if it is possible /// \param theObject an object of the attribute /// \param theGeomShape a geom shape /// \return theAttribute - virtual AttributePtr findAttribute(const ObjectPtr& theObject, - const GeomShapePtr& theGeomShape) = 0; + virtual AttributePtr findAttribute(const ObjectPtr &theObject, + const GeomShapePtr &theGeomShape) = 0; /// Returns reentrant message if it was accepted virtual std::shared_ptr reentrantMessage() = 0; /// Put current selection into reentrant message /// \param theMessage a message of reentrant operation - virtual void setReentrantPreSelection(const std::shared_ptr& theMessage) = 0; + virtual void setReentrantPreSelection( + const std::shared_ptr &theMessage) = 0; /// Returns XML information by the feature index /// \param theFeatureId a feature id /// \param theXmlCfg XML configuration /// \param theDescription feature description - void getXMLRepresentation(const std::string& theFeatureId, std::string& theXmlCfg, - std::string& theDescription); + void getXMLRepresentation(const std::string &theFeatureId, + std::string &theXmlCfg, + std::string &theDescription); /// Returns root tree node which represents a data model - virtual ModuleBase_ITreeNode* rootNode() const = 0; + virtual ModuleBase_ITreeNode *rootNode() const = 0; signals: /// Segnal emitted when an operation is resumed /// \param theOp a resumed operation - void resumed(ModuleBase_Operation* theOp); + void resumed(ModuleBase_Operation *theOp); public slots: /// Called on call of command corresponded to a feature @@ -434,14 +469,16 @@ protected slots: virtual void onSelectionChanged() {} protected: - /// Register validators for this module + /// Register validators for this module virtual void registerValidators() {} /// Register properties of this module virtual void registerProperties() {} - /// Returns new instance of operation object (used in createOperation for customization) - virtual ModuleBase_Operation* getNewOperation(const std::string& theFeatureId); + /// Returns new instance of operation object (used in createOperation for + /// customization) + virtual ModuleBase_Operation * + getNewOperation(const std::string &theFeatureId); /// Load plugins required license void loadProprietaryPlugins(); @@ -451,7 +488,7 @@ protected: protected: /// Reference to workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; /// Map of features in XML std::map myFeaturesInFiles; @@ -462,17 +499,15 @@ protected: /// Features, which have valid license std::set myFeaturesValidLicense; - std::map mySelectionFilters; - + std::map + mySelectionFilters; }; - - //! This function must return a new module instance. extern "C" { -typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*); +typedef ModuleBase_IModule *(*CREATE_FUNC)(ModuleBase_IWorkshop *); } #define CREATE_MODULE "createModule" -#endif //ModuleBase_IModule +#endif // ModuleBase_IModule diff --git a/src/ModuleBase/ModuleBase_IPrefMgr.cpp b/src/ModuleBase/ModuleBase_IPrefMgr.cpp index 6eeb8ed9b..fc5f4fa1b 100644 --- a/src/ModuleBase/ModuleBase_IPrefMgr.cpp +++ b/src/ModuleBase/ModuleBase_IPrefMgr.cpp @@ -14,17 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IPrefMgr.h" -ModuleBase_IPrefMgr::ModuleBase_IPrefMgr() -{ +ModuleBase_IPrefMgr::ModuleBase_IPrefMgr() {} -} - -ModuleBase_IPrefMgr::~ModuleBase_IPrefMgr() -{ - -} +ModuleBase_IPrefMgr::~ModuleBase_IPrefMgr() {} diff --git a/src/ModuleBase/ModuleBase_IPrefMgr.h b/src/ModuleBase/ModuleBase_IPrefMgr.h index e4cda7298..ddf9b6163 100644 --- a/src/ModuleBase/ModuleBase_IPrefMgr.h +++ b/src/ModuleBase/ModuleBase_IPrefMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IPrefMgr_H @@ -25,45 +26,45 @@ #include #include -/** -* \ingroup GUI -* An interface class which provides incapsulation of SUIT_PreferenceMgr class instance -* It is used in order to make common interface to Preference manager in Salome -* and this application -*/ -class MODULEBASE_EXPORT ModuleBase_IPrefMgr -{ +/** + * \ingroup GUI + * An interface class which provides incapsulation of SUIT_PreferenceMgr class + * instance It is used in order to make common interface to Preference manager + * in Salome and this application + */ +class MODULEBASE_EXPORT ModuleBase_IPrefMgr { public: /// Default constructor ModuleBase_IPrefMgr(); /// Virtual destructor virtual ~ModuleBase_IPrefMgr(); - /** - * Add preference item into preference dialog box - * \param theLbl - label of the item - * \param pId - id of container item - * \param theType - type of the item - * \param theSection - resouce section name - * \param theName - name of the resource - * Returns Id of the ctreated item - */ - virtual int addPreference(const QString& theLbl, int pId, + /** + * Add preference item into preference dialog box + * \param theLbl - label of the item + * \param pId - id of container item + * \param theType - type of the item + * \param theSection - resouce section name + * \param theName - name of the resource + * Returns Id of the ctreated item + */ + virtual int addPreference(const QString &theLbl, int pId, SUIT_PreferenceMgr::PrefItemType theType, - const QString& theSection, const QString& theName ) = 0; + const QString &theSection, + const QString &theName) = 0; /** - * \brief Set property of an item - * \param thePropName the property name - * \param theValue the value of the property - * \param theId id of the property - */ - virtual void setItemProperty(const QString& thePropName, - const QVariant& theValue, + * \brief Set property of an item + * \param thePropName the property name + * \param theValue the value of the property + * \param theId id of the property + */ + virtual void setItemProperty(const QString &thePropName, + const QVariant &theValue, const int theId = -1) = 0; /// Returns incapsulated preference manager - virtual SUIT_PreferenceMgr* prefMgr() const = 0; + virtual SUIT_PreferenceMgr *prefMgr() const = 0; }; #endif diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.cpp b/src/ModuleBase/ModuleBase_IPropertyPanel.cpp index 299e2b236..03322cd91 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.cpp +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.cpp @@ -14,54 +14,57 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IPropertyPanel.h" #include "ModuleBase_ModelWidget.h" #include "ModuleBase_ToolBox.h" -#include #include +#include -ModuleBase_IPropertyPanel::ModuleBase_IPropertyPanel(QWidget* theParent) - : QDockWidget(theParent), myIsEditing(false) -{ -} +ModuleBase_IPropertyPanel::ModuleBase_IPropertyPanel(QWidget *theParent) + : QDockWidget(theParent), myIsEditing(false) {} -ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::modelWidget( - const std::string& theAttributeId) const -{ - ModuleBase_ModelWidget* aWidget = 0; - QList aWidgets = modelWidgets(); - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); - for (QList::const_iterator anIt = aWidgets.begin(); - anIt != aWidgets.end() && !aWidget; anIt++) { - ModuleBase_ModelWidget* aCurrentWidget = *anIt; +ModuleBase_ModelWidget *ModuleBase_IPropertyPanel::modelWidget( + const std::string &theAttributeId) const { + ModuleBase_ModelWidget *aWidget = 0; + QList aWidgets = modelWidgets(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); + for (QList::const_iterator anIt = aWidgets.begin(); + anIt != aWidgets.end() && !aWidget; anIt++) { + ModuleBase_ModelWidget *aCurrentWidget = *anIt; if (aCurrentWidget->attributeID() == theAttributeId && aCurrentWidget->canAcceptFocus() && - aValidators->isCase(aCurrentWidget->feature(), aCurrentWidget->attributeID())) + aValidators->isCase(aCurrentWidget->feature(), + aCurrentWidget->attributeID())) aWidget = aCurrentWidget; } return aWidget; } -ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget() -{ - return ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget(modelWidgets()); +ModuleBase_ModelWidget * +ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget() { + return ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget( + modelWidgets()); } -ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget( - const QList& theWidgets) -{ - ModuleBase_ModelWidget* aFirstWidget = 0; +ModuleBase_ModelWidget * +ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget( + const QList &theWidgets) { + ModuleBase_ModelWidget *aFirstWidget = 0; - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); - ModuleBase_ModelWidget* aWgt; - QList::const_iterator aWIt; - for (aWIt = theWidgets.begin(); aWIt != theWidgets.end() && !aFirstWidget; ++aWIt) { + ModuleBase_ModelWidget *aWgt; + QList::const_iterator aWIt; + for (aWIt = theWidgets.begin(); aWIt != theWidgets.end() && !aFirstWidget; + ++aWIt) { aWgt = (*aWIt); if (!aValidators->isCase(aWgt->feature(), aWgt->attributeID())) continue; // this attribute is not participated in the current case @@ -69,7 +72,8 @@ ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget if (!aWgt->canAcceptFocus()) continue; - /// workaround for the same attributes used in different stacked widgets(attribute types) + /// workaround for the same attributes used in different stacked + /// widgets(attribute types) if (ModuleBase_ToolBox::isOffToolBoxParent(aWgt)) continue; @@ -78,11 +82,10 @@ ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget return aFirstWidget; } -bool ModuleBase_IPropertyPanel::isModified() const -{ +bool ModuleBase_IPropertyPanel::isModified() const { bool isModified = false; - QList aWidgets = modelWidgets(); - foreach(ModuleBase_ModelWidget* aWgt, aWidgets) { + QList aWidgets = modelWidgets(); + foreach (ModuleBase_ModelWidget *aWgt, aWidgets) { bool aRes = aWgt->isModified(); isModified |= aRes; } diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index 073745c62..946c08409 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_PROPERTYPANEL_H_ @@ -28,38 +29,40 @@ class ModuleBase_ModelWidget; /** -* \ingroup GUI -* A class for Property panel object definition -*/ -class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget -{ -Q_OBJECT + * \ingroup GUI + * A class for Property panel object definition + */ +class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget { + Q_OBJECT public: /// Constructor /// \param theParent is a parent of the property panel - ModuleBase_IPropertyPanel(QWidget* theParent); + ModuleBase_IPropertyPanel(QWidget *theParent); /// Returns header widget - virtual QWidget* headerWidget() const = 0; + virtual QWidget *headerWidget() const = 0; - /// Returns currently active widget. This is a widget from internal container of widgets - /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true, - /// the method finds firstly the custom widget, after the direct active widget. - /// \param isUseCustomWidget boolean state if the custom widget might be a result - virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const = 0; + /// Returns currently active widget. This is a widget from internal container + /// of widgets (myWidgets) activated/deactivated by focus in property panel. + /// If parameter is true, the method finds firstly the custom widget, after + /// the direct active widget. \param isUseCustomWidget boolean state if the + /// custom widget might be a result + virtual ModuleBase_ModelWidget * + activeWidget(const bool isUseCustomWidget = false) const = 0; /// Returns all property panel's widget created by WidgetFactory - virtual const QList& modelWidgets() const = 0; + virtual const QList &modelWidgets() const = 0; /// Returns widget, that has the given attribute index /// \param theAttributeId an attribute from XML - virtual ModuleBase_ModelWidget* modelWidget(const std::string& theAttributeId) const; + virtual ModuleBase_ModelWidget * + modelWidget(const std::string &theAttributeId) const; /// Removes all widgets in the widget area of the property panel virtual void cleanContent() = 0; - /// Editing mode depends on mode of current operation. This value is defined by it. - /// \param isEditing state of editing mode flag + /// Editing mode depends on mode of current operation. This value is defined + /// by it. \param isEditing state of editing mode flag virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; } /// \return State of editing mode flag @@ -76,14 +79,14 @@ public: virtual bool isCancelEnabled() const = 0; /// Returns widget processed by preselection - virtual ModuleBase_ModelWidget* preselectionWidget() const = 0; + virtual ModuleBase_ModelWidget *preselectionWidget() const = 0; /// Sets widget processed by preselection - virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0; + virtual void setPreselectionWidget(ModuleBase_ModelWidget *theWidget) = 0; /// Returns the first widget, where canAcceptFocus returns true /// \return a widget or null - ModuleBase_ModelWidget* findFirstAcceptingValueWidget(); + ModuleBase_ModelWidget *findFirstAcceptingValueWidget(); /// The method is called on accepting of operation virtual void onAcceptData() = 0; @@ -93,48 +96,48 @@ public: /// Returns the first widget, where canAcceptFocus returns true /// \return a widget or null - static ModuleBase_ModelWidget* findFirstAcceptingValueWidget( - const QList& theWidgets); + static ModuleBase_ModelWidget *findFirstAcceptingValueWidget( + const QList &theWidgets); signals: - /// The signal about key release on the control, that corresponds to the attribute - /// \param theObject a sender of the event - /// \param theEvent key release event - void keyReleased(QObject* theObject, QKeyEvent* theEvent); + /// The signal about key release on the control, that corresponds to the + /// attribute \param theObject a sender of the event \param theEvent key + /// release event + void keyReleased(QObject *theObject, QKeyEvent *theEvent); /// The signal about the widget activation /// \param theWidget the activated widget - void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget); + void beforeWidgetActivated(ModuleBase_ModelWidget *theWidget); /// The signal about the widget activation /// \param theWidget the activated widget - //void widgetActivated(ModuleBase_ModelWidget* theWidget); + // void widgetActivated(ModuleBase_ModelWidget* theWidget); /// Emited when there is no next widget - /// \param thePreviousAttributeID an attribute key of the previous active widget - void noMoreWidgets(const std::string& thePreviousAttributeID); + /// \param thePreviousAttributeID an attribute key of the previous active + /// widget + void noMoreWidgets(const std::string &thePreviousAttributeID); public slots: /// Activate the next widget in the property panel /// \param theWidget a widget. The next widget should be activated - virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget) = 0; + virtual void activateNextWidget(ModuleBase_ModelWidget *theWidget) = 0; /// Activate the next from current widget in the property panel virtual void activateNextWidget() = 0; /** - * Makes the given widget active, highlights it and removes - * highlighting from the previous active widget - * \param theWidget which has to be activated - * \param theEmitSignal a flag to prohibit signal emit - */ - virtual void activateWidget(ModuleBase_ModelWidget* theWidget, + * Makes the given widget active, highlights it and removes + * highlighting from the previous active widget + * \param theWidget which has to be activated + * \param theEmitSignal a flag to prohibit signal emit + */ + virtual void activateWidget(ModuleBase_ModelWidget *theWidget, const bool theEmitSignal = true) = 0; protected: - /// Flag which shows that current operation is in editing mode bool myIsEditing; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_ISelection.cpp b/src/ModuleBase/ModuleBase_ISelection.cpp index 8b35f680c..003f2c672 100644 --- a/src/ModuleBase/ModuleBase_ISelection.cpp +++ b/src/ModuleBase/ModuleBase_ISelection.cpp @@ -14,51 +14,51 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ISelection.h" -#include "ModuleBase_ViewerPrs.h" #include "ModelAPI_Feature.h" +#include "ModuleBase_ViewerPrs.h" -#include -#include -#include #include #include +#include +#include +#include //******************************************************************** -void ModuleBase_ISelection::appendSelected(const QList theValues, - QList& theValuesTo) -{ +void ModuleBase_ISelection::appendSelected( + const QList theValues, + QList &theValuesTo) { // collect the objects from the viewer QObjectPtrList anExistedObjects; - foreach(ModuleBase_ViewerPrsPtr aPrs, theValuesTo) { + foreach (ModuleBase_ViewerPrsPtr aPrs, theValuesTo) { if (aPrs->owner() && aPrs->object()) anExistedObjects.append(aPrs->object()); } ObjectPtr anObject; - foreach(ModuleBase_ViewerPrsPtr aPrs, theValues) { + foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) { anObject = aPrs->object(); if (anObject.get() != NULL && !anExistedObjects.contains(anObject)) { theValuesTo.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); } } } //******************************************************************** -ResultPtr ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrsPtr& thePrs) -{ +ResultPtr +ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrsPtr &thePrs) { ResultPtr aResult; if (thePrs->object().get()) { ObjectPtr aObject = thePrs->object(); aResult = std::dynamic_pointer_cast(aObject); - } - else if (!thePrs->owner().IsNull()) { + } else if (!thePrs->owner().IsNull()) { ObjectPtr anObject = getSelectableObject(thePrs->owner()); aResult = std::dynamic_pointer_cast(anObject); } @@ -67,17 +67,17 @@ ResultPtr ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrsPtr& thePrs } //******************************************************************** -GeomShapePtr ModuleBase_ISelection::getShape(const ModuleBase_ViewerPrsPtr& thePrs) -{ +GeomShapePtr +ModuleBase_ISelection::getShape(const ModuleBase_ViewerPrsPtr &thePrs) { GeomShapePtr aShape; - const GeomShapePtr& aPrsShape = thePrs->shape(); + const GeomShapePtr &aPrsShape = thePrs->shape(); // if only result is selected, an empty shape is set to the model if (!aPrsShape.get() || aPrsShape->isNull()) { - } - else { + } else { aShape = aPrsShape; - // If the result object is built on the same shape, the result shape here is empty one + // If the result object is built on the same shape, the result shape here is + // empty one ResultPtr aResult = getResult(thePrs); if (aResult.get() && aShape->isEqual(aResult->shape())) aShape = GeomShapePtr(); @@ -86,48 +86,50 @@ GeomShapePtr ModuleBase_ISelection::getShape(const ModuleBase_ViewerPrsPtr& theP } //******************************************************************** -QList ModuleBase_ISelection::getViewerPrs(const QObjectPtrList& theObjects) -{ +QList +ModuleBase_ISelection::getViewerPrs(const QObjectPtrList &theObjects) { QList aSelectedPrs; - QObjectPtrList::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); + QObjectPtrList::const_iterator anIt = theObjects.begin(), + aLast = theObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (anObject.get() != NULL) { aSelectedPrs.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); } } return aSelectedPrs; } //******************************************************************** -void ModuleBase_ISelection::filterSelectionOnEqualPoints - (QList& theSelected) -{ +void ModuleBase_ISelection::filterSelectionOnEqualPoints( + QList &theSelected) { QList aCandidatesToRemove; QList::const_iterator anIt = theSelected.begin(), - aLast = theSelected.end(); + aLast = theSelected.end(); QList::const_iterator aSubIt; - std::set > aVerticesMap; + std::set> aVerticesMap; for (; anIt != aLast; anIt++) { ModuleBase_ViewerPrsPtr aPrs = *anIt; - std::shared_ptr aGeomPrsVertex = getPresentationVertex(aPrs); + std::shared_ptr aGeomPrsVertex = + getPresentationVertex(aPrs); if (aGeomPrsVertex.get()) { - const TopoDS_Vertex& aPrsVertex = aGeomPrsVertex->impl(); - std::set >::const_iterator aVIt = aVerticesMap.begin(), - aVLast = aVerticesMap.end(); + const TopoDS_Vertex &aPrsVertex = aGeomPrsVertex->impl(); + std::set>::const_iterator + aVIt = aVerticesMap.begin(), + aVLast = aVerticesMap.end(); bool aFound = false; for (; aVIt != aVLast && !aFound; aVIt++) { std::shared_ptr aGeomVertex = *aVIt; - const TopoDS_Vertex& aVertex = aGeomVertex->impl(); + const TopoDS_Vertex &aVertex = aGeomVertex->impl(); gp_Pnt aPoint1 = BRep_Tool::Pnt(aVertex); gp_Pnt aPoint2 = BRep_Tool::Pnt(aPrsVertex); - std::shared_ptr aPnt1 = std::shared_ptr - (new GeomAPI_Pnt(aPoint1.X(), aPoint1.Y(), aPoint1.Z())); - std::shared_ptr aPnt2 = std::shared_ptr - (new GeomAPI_Pnt(aPoint2.X(), aPoint2.Y(), aPoint2.Z())); + std::shared_ptr aPnt1 = std::shared_ptr( + new GeomAPI_Pnt(aPoint1.X(), aPoint1.Y(), aPoint1.Z())); + std::shared_ptr aPnt2 = std::shared_ptr( + new GeomAPI_Pnt(aPoint2.X(), aPoint2.Y(), aPoint2.Z())); aFound = aPnt1->isEqual(aPnt2); } if (aFound) { @@ -137,30 +139,31 @@ void ModuleBase_ISelection::filterSelectionOnEqualPoints aVerticesMap.insert(aGeomPrsVertex); } } - QList::const_iterator aRemIt = aCandidatesToRemove.begin(), - aRemLast = aCandidatesToRemove.end(); + QList::const_iterator aRemIt = aCandidatesToRemove + .begin(), + aRemLast = + aCandidatesToRemove.end(); for (; aRemIt != aRemLast; aRemIt++) { theSelected.removeAll(*aRemIt); } } std::shared_ptr ModuleBase_ISelection::getPresentationVertex( - const ModuleBase_ViewerPrsPtr& thePrs) -{ + const ModuleBase_ViewerPrsPtr &thePrs) { std::shared_ptr aGeomVertex; - Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); + Handle(StdSelect_BRepOwner) anOwner = + Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); if (!anOwner.IsNull() && anOwner->HasShape()) { - const TopoDS_Shape& aShape = anOwner->Shape(); + const TopoDS_Shape &aShape = anOwner->Shape(); if (aShape.ShapeType() == TopAbs_VERTEX) { - const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape); - if (!aVertex.IsNull()) { + const TopoDS_Vertex &aVertex = TopoDS::Vertex(aShape); + if (!aVertex.IsNull()) { gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); - aGeomVertex = std::shared_ptr(new GeomAPI_Vertex(aPoint.X(), aPoint.Y(), - aPoint.Z())); + aGeomVertex = std::shared_ptr( + new GeomAPI_Vertex(aPoint.X(), aPoint.Y(), aPoint.Z())); } } } return aGeomVertex; } - diff --git a/src/ModuleBase/ModuleBase_ISelection.h b/src/ModuleBase/ModuleBase_ISelection.h index c662231f2..7141c230c 100644 --- a/src/ModuleBase/ModuleBase_ISelection.h +++ b/src/ModuleBase/ModuleBase_ISelection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ISelection_H @@ -23,13 +24,13 @@ #include "ModuleBase.h" #include "ModuleBase_Definitions.h" -#include #include #include +#include -#include #include #include +#include #include #include @@ -39,9 +40,9 @@ class SelectMgr_EntityOwner; /// \ingroup GUI /// A class which provides access to selection. -/// A selection can be obtained as from a viewer as from Object browser in various forms -class MODULEBASE_EXPORT ModuleBase_ISelection -{ +/// A selection can be obtained as from a viewer as from Object browser in +/// various forms +class MODULEBASE_EXPORT ModuleBase_ISelection { public: /// Types of the selection place, where the selection is obtained enum SelectionPlace { Browser, Viewer, AllControls }; @@ -51,24 +52,26 @@ public: /// Returns a list of viewer selected presentations /// \return list of presentations virtual QList> - getSelected(const SelectionPlace& thePlace = Browser) const = 0; + getSelected(const SelectionPlace &thePlace = Browser) const = 0; - /// The values are appended to the first parameter list if the first list does not contain - /// an item with the same object - /// \param theValues a list of new values - /// \param theValuesTo a list, that will be changed - static void appendSelected(const QList> theValues, - QList>& theValuesTo); + /// The values are appended to the first parameter list if the first list does + /// not contain an item with the same object \param theValues a list of new + /// values \param theValuesTo a list, that will be changed + static void + appendSelected(const QList> theValues, + QList> &theValuesTo); /// Returns a list of viewer highlited presentations /// \return list of presentations - virtual QList> getHighlighted() const = 0; + virtual QList> + getHighlighted() const = 0; /// Fills the viewer presentation parameters by the parameters from the owner /// \param thePrs a container for selection /// \param theOwner a selection owner - virtual void fillPresentation(std::shared_ptr& thePrs, - const Handle(SelectMgr_EntityOwner)& theOwner) const = 0; + virtual void fillPresentation(std::shared_ptr &thePrs, + const Handle(SelectMgr_EntityOwner) & + theOwner) const = 0; /// Returns list of features currently selected in object browser virtual QObjectPtrList selectedObjects() const = 0; @@ -80,43 +83,43 @@ public: virtual QModelIndexList selectedIndexes() const = 0; /// Return the shape from the viewer presentation. - /// If the shape is equal to the shape of selected object, it returns an empty shape - /// \param thePrs a selected object - /// \return a shape - ResultPtr getResult(const std::shared_ptr& thePrs); + /// If the shape is equal to the shape of selected object, it returns an empty + /// shape \param thePrs a selected object \return a shape + ResultPtr getResult(const std::shared_ptr &thePrs); /// Return the shape from the viewer presentation. - /// If the shape is equal to the shape of selected object, it returns an empty shape - /// \param thePrs a selected object - /// \return a shape - GeomShapePtr getShape(const std::shared_ptr& thePrs); + /// If the shape is equal to the shape of selected object, it returns an empty + /// shape \param thePrs a selected object \return a shape + GeomShapePtr getShape(const std::shared_ptr &thePrs); /// Return the IO from the viewer presentation. /// \param thePrs a selected object /// \return an interactive object virtual Handle(AIS_InteractiveObject) - getIO(const std::shared_ptr& thePrs) = 0; + getIO(const std::shared_ptr &thePrs) = 0; /// Wraps the object list into the viewer prs list /// \param theObjects a list of objects /// \return a list of prs, where only object is not empty - static QList> getViewerPrs( - const QObjectPtrList& theObjects); + static QList> + getViewerPrs(const QObjectPtrList &theObjects); /// Removes selection items where owners have equal vertices. The first /// owner with the qual vertex stays in the list. - static void filterSelectionOnEqualPoints - (QList>& theSelected); + static void filterSelectionOnEqualPoints( + QList> &theSelected); + protected: /// Returns list of currently selected QModelIndexes - virtual ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner)& theOwner) const = 0; + virtual ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner) & + theOwner) const = 0; private: /// Find vertex shape build by a Brep owner of the presentation if it exists /// \param thePrs a viewer presentation /// \return GeomAPI wrap of vertex - static std::shared_ptr getPresentationVertex( - const std::shared_ptr& thePrs); + static std::shared_ptr + getPresentationVertex(const std::shared_ptr &thePrs); }; #endif diff --git a/src/ModuleBase/ModuleBase_ISelectionActivate.h b/src/ModuleBase/ModuleBase_ISelectionActivate.h index 3515c1ac2..dc165e23c 100644 --- a/src/ModuleBase/ModuleBase_ISelectionActivate.h +++ b/src/ModuleBase/ModuleBase_ISelectionActivate.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ISelectionActivate_H @@ -28,33 +29,34 @@ class ModuleBase_ModelWidget; - /// \ingroup GUI /// A class which provides interface of activation/deactivate selection modes /// and using selection filters. -class ModuleBase_ISelectionActivate -{ +class ModuleBase_ISelectionActivate { public: /// Constructor - ModuleBase_ISelectionActivate(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop) {} + ModuleBase_ISelectionActivate(ModuleBase_IWorkshop *theWorkshop) + : myWorkshop(theWorkshop) {} /// Destructor virtual ~ModuleBase_ISelectionActivate() {} - /// Updates active selection modes in the viewer depending on the application state + /// Updates active selection modes in the viewer depending on the application + /// state MODULEBASE_EXPORT virtual void updateSelectionModes() = 0; - /// Updates active selection filters in the viewer depending on the application state + /// Updates active selection filters in the viewer depending on the + /// application state MODULEBASE_EXPORT virtual void updateSelectionFilters() = 0; - /// Activates parameter filters in the workshop, deactivate active out of the container - /// Please find a possibility to use updateSelectionFilters instead of direct call this method. - /// \param theSelectionFilters a filtes - MODULEBASE_EXPORT virtual void activateSelectionFilters - (const SelectMgr_ListOfFilter& theSelectionFilters) = 0; + /// Activates parameter filters in the workshop, deactivate active out of the + /// container Please find a possibility to use updateSelectionFilters instead + /// of direct call this method. \param theSelectionFilters a filtes + MODULEBASE_EXPORT virtual void activateSelectionFilters( + const SelectMgr_ListOfFilter &theSelectionFilters) = 0; protected: - ModuleBase_IWorkshop* myWorkshop; ///< active workshop + ModuleBase_IWorkshop *myWorkshop; ///< active workshop }; #endif diff --git a/src/ModuleBase/ModuleBase_IStepPrs.cpp b/src/ModuleBase/ModuleBase_IStepPrs.cpp index 9371b9848..a6429a7e4 100644 --- a/src/ModuleBase/ModuleBase_IStepPrs.cpp +++ b/src/ModuleBase/ModuleBase_IStepPrs.cpp @@ -14,11 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IStepPrs.h" -ModuleBase_IStepPrs::ModuleBase_IStepPrs() -{ -} +ModuleBase_IStepPrs::ModuleBase_IStepPrs() {} diff --git a/src/ModuleBase/ModuleBase_IStepPrs.h b/src/ModuleBase/ModuleBase_IStepPrs.h index 532f8d2f4..813aef290 100644 --- a/src/ModuleBase/ModuleBase_IStepPrs.h +++ b/src/ModuleBase/ModuleBase_IStepPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IStepPrs_H @@ -23,14 +24,13 @@ #include "ModuleBase.h" #include -class MODULEBASE_EXPORT ModuleBase_IStepPrs -{ +class MODULEBASE_EXPORT ModuleBase_IStepPrs { public: ModuleBase_IStepPrs(); virtual ModelAPI_AttributeTables::ValueType dataType() const = 0; - virtual bool dataRange(double& theMin, double& theMax) const = 0; + virtual bool dataRange(double &theMin, double &theMax) const = 0; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_ITreeNode.h b/src/ModuleBase/ModuleBase_ITreeNode.h index 05469ce2c..774a7e1c1 100644 --- a/src/ModuleBase/ModuleBase_ITreeNode.h +++ b/src/ModuleBase/ModuleBase_ITreeNode.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ITreeNode_H @@ -23,35 +24,30 @@ #include "ModuleBase.h" #include "ModuleBase_Definitions.h" -#include #include +#include +#include #include #include -#include #include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif class ModuleBase_ITreeNode; class ModuleBase_IWorkshop; -typedef QList QTreeNodesList; +typedef QList QTreeNodesList; -class ModuleBase_ITreeNode -{ +class ModuleBase_ITreeNode { public: - enum VisibilityState { - NoneState, - Visible, - SemiVisible, - Hidden - }; + enum VisibilityState { NoneState, Visible, SemiVisible, Hidden }; /// Default constructor - ModuleBase_ITreeNode(ModuleBase_ITreeNode* theParent = 0) : myParent(theParent) {} + ModuleBase_ITreeNode(ModuleBase_ITreeNode *theParent = 0) + : myParent(theParent) {} virtual ~ModuleBase_ITreeNode() { deleteChildren(); } @@ -66,14 +62,13 @@ public: } /// Returns parent node of the current node - ModuleBase_ITreeNode* parent() const { return myParent; } + ModuleBase_ITreeNode *parent() const { return myParent; } /// Returns list of the node children QTreeNodesList children() const { return myChildren; } /// Returns a children node according to given row (index) - ModuleBase_ITreeNode* subNode(int theRow) const - { + ModuleBase_ITreeNode *subNode(int theRow) const { if ((theRow > -1) && (theRow < myChildren.length())) return myChildren.at(theRow); return 0; @@ -82,13 +77,13 @@ public: /// Finds a node which contains the referenced object /// \param theObj an object to find /// \param allLevels if true then all sub-trees will be processed - ModuleBase_ITreeNode* subNode(const ObjectPtr& theObj, bool allLevels = true) const - { - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + ModuleBase_ITreeNode *subNode(const ObjectPtr &theObj, + bool allLevels = true) const { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { if (aNode->object() == theObj) return aNode; if (allLevels) { - ModuleBase_ITreeNode* aSubNode = aNode->subNode(theObj, allLevels); + ModuleBase_ITreeNode *aSubNode = aNode->subNode(theObj, allLevels); if (aSubNode) return aSubNode; } @@ -99,9 +94,8 @@ public: /// Returns true if the given node is found within children /// \param theNode a node to find /// \param allLevels if true then all sub-trees will be processed - bool hasSubNode(ModuleBase_ITreeNode* theNode, bool allLevels = true) const - { - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + bool hasSubNode(ModuleBase_ITreeNode *theNode, bool allLevels = true) const { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { if (aNode == theNode) return true; if (allLevels) { @@ -115,7 +109,9 @@ public: /// Returns number of children int childrenCount() const { return myChildren.length(); } - int nodeRow(ModuleBase_ITreeNode* theNode) const { return myChildren.indexOf(theNode); } + int nodeRow(ModuleBase_ITreeNode *theNode) const { + return myChildren.indexOf(theNode); + } /// Returns object referenced by the node (can be null) virtual ObjectPtr object() const { return ObjectPtr(); } @@ -126,7 +122,7 @@ public: /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects) { + virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects) { return QTreeNodesList(); } @@ -134,31 +130,36 @@ public: /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted /// \return a list of parents where nodes were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup) - { return QTreeNodesList(); } + virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) { + return QTreeNodesList(); + } /// Returns workshop object. Has to be reimplemented in a root node - virtual ModuleBase_IWorkshop* workshop() const { return parent()->workshop(); } + virtual ModuleBase_IWorkshop *workshop() const { + return parent()->workshop(); + } - /// Returns document object of the sub-tree. Has to be reimplemented in sub-tree root object + /// Returns document object of the sub-tree. Has to be reimplemented in + /// sub-tree root object virtual DocumentPtr document() const { return parent()->document(); } - /// Returns a node which belongs to the given document and contains objects of the given group - /// \param theDoc a document - /// \param theGroup a name of objects group - /// \return a parent node if it is found - virtual ModuleBase_ITreeNode* findParent(const DocumentPtr& theDoc, QString theGroup) - { return 0; } + /// Returns a node which belongs to the given document and contains objects of + /// the given group \param theDoc a document \param theGroup a name of objects + /// group \return a parent node if it is found + virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, + QString theGroup) { + return 0; + } /// Returns root node of a data tree of the given document /// \param theDoc a document /// \return a tree node which is a root of the document structure - virtual ModuleBase_ITreeNode* findRoot(const DocumentPtr& theDoc) - { + virtual ModuleBase_ITreeNode *findRoot(const DocumentPtr &theDoc) { if (document() == theDoc) return this; - ModuleBase_ITreeNode* aRoot; - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + ModuleBase_ITreeNode *aRoot; + foreach (ModuleBase_ITreeNode *aNode, myChildren) { aRoot = aNode->findRoot(theDoc); if (aRoot) return aRoot; @@ -170,12 +171,10 @@ public: virtual VisibilityState visibilityState() const { return NoneState; } protected: - /// deletes all children nodes (called in destructor.) - virtual void deleteChildren() - { + virtual void deleteChildren() { while (myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.takeLast(); + ModuleBase_ITreeNode *aNode = myChildren.takeLast(); delete aNode; } } @@ -183,7 +182,7 @@ protected: void sortChildren() { if (myChildren.size() > 1) { int i = 0; - ModuleBase_ITreeNode* aNode = 0; + ModuleBase_ITreeNode *aNode = 0; ObjectPtr aObject; int aIdx; int aCount = 0; @@ -206,16 +205,15 @@ protected: i = 0; continue; } - } - else + } else aShift++; i++; } } } - ModuleBase_ITreeNode* myParent; //!< Parent of the node - QTreeNodesList myChildren; //!< Children of the node + ModuleBase_ITreeNode *myParent; //!< Parent of the node + QTreeNodesList myChildren; //!< Children of the node }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_IViewWindow.cpp b/src/ModuleBase/ModuleBase_IViewWindow.cpp index e9ad40311..f96270214 100644 --- a/src/ModuleBase/ModuleBase_IViewWindow.cpp +++ b/src/ModuleBase/ModuleBase_IViewWindow.cpp @@ -14,17 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IViewWindow.h" -ModuleBase_IViewWindow::ModuleBase_IViewWindow() -{ +ModuleBase_IViewWindow::ModuleBase_IViewWindow() {} -} - -ModuleBase_IViewWindow::~ModuleBase_IViewWindow() -{ - -} +ModuleBase_IViewWindow::~ModuleBase_IViewWindow() {} diff --git a/src/ModuleBase/ModuleBase_IViewWindow.h b/src/ModuleBase/ModuleBase_IViewWindow.h index 7ecdf158f..0c181184f 100644 --- a/src/ModuleBase/ModuleBase_IViewWindow.h +++ b/src/ModuleBase/ModuleBase_IViewWindow.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IViewWindow_H @@ -26,12 +27,11 @@ class QWidget; -/** -* \ingroup GUI -* Interface to ViewWindow object which contains 3d scene -*/ -class MODULEBASE_EXPORT ModuleBase_IViewWindow -{ +/** + * \ingroup GUI + * Interface to ViewWindow object which contains 3d scene + */ +class MODULEBASE_EXPORT ModuleBase_IViewWindow { public: /// Default constructor ModuleBase_IViewWindow(); @@ -42,8 +42,7 @@ public: virtual Handle(V3d_View) v3dView() const = 0; /// Returns the view window view port - virtual QWidget* viewPort() const = 0; + virtual QWidget *viewPort() const = 0; }; - -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_IViewer.cpp b/src/ModuleBase/ModuleBase_IViewer.cpp index 52ce4d99a..fe56d4ac2 100644 --- a/src/ModuleBase/ModuleBase_IViewer.cpp +++ b/src/ModuleBase/ModuleBase_IViewer.cpp @@ -14,15 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IViewer.h" Handle(Prs3d_Drawer) ModuleBase_IViewer::DefaultHighlightDrawer; -ModuleBase_IViewer::ModuleBase_IViewer(QObject* theParent) - : QObject(theParent), myIs2dMode(false), myShowHighlight(false) -{ - -} +ModuleBase_IViewer::ModuleBase_IViewer(QObject *theParent) + : QObject(theParent), myIs2dMode(false), myShowHighlight(false) {} diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index 8e00d69b8..906b649c5 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IViewer_H @@ -22,11 +23,11 @@ #include "ModuleBase.h" -#include -#include #include -#include #include +#include +#include +#include class QMouseEvent; class QKeyEvent; @@ -43,13 +44,12 @@ class AppElements_Fitter; * A Base object for definition of connector object to * Salome Viewer. Reimplemented in SHAPERGUI_SalomeViewer class */ -class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent object - ModuleBase_IViewer(QObject* theParent); +class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent object + ModuleBase_IViewer(QObject *theParent); //! Returns AIS_InteractiveContext from current OCCViewer virtual Handle(AIS_InteractiveContext) AISContext() const = 0; @@ -64,7 +64,7 @@ Q_OBJECT virtual Handle(V3d_View) activeView() const = 0; //! Returns currently active view port widget - virtual QWidget* activeViewPort() const = 0; + virtual QWidget *activeViewPort() const = 0; //! Enable or disable selection in the viewer //! \param isEnabled is enable or disable flag @@ -94,28 +94,30 @@ Q_OBJECT /// \param theY the Y projection value /// \param theZ the Z projection value /// \param theTwist the twist angle in radians - virtual void setViewProjection( double theX, double theY, double theZ, - double theTwist ) = 0; + virtual void setViewProjection(double theX, double theY, double theZ, + double theTwist) = 0; /// Add selection filter to the viewer /// \param theFilter a selection filter - virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0; + virtual void addSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) = 0; /// Remove selection filter from the viewer /// \param theFilter a selection filter - virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0; + virtual void removeSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) = 0; /// Returns true if the selection filter is set to the viewer /// \param theFilter a selection filter - virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0; + virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) = 0; /// Update current viewer virtual void update() = 0; /// Returns a scale factor of the given view /// \param theView a view object - const double Scale(const Handle(V3d_View)& theView) - { + const double Scale(const Handle(V3d_View) & theView) { if (!myWindowScale.contains(theView)) myWindowScale.insert(theView, theView->Camera()->Scale()); return myWindowScale[theView]; @@ -124,29 +126,26 @@ Q_OBJECT /// Remember a scale factor for the view object /// \param theView a view object /// \param theVal a scale factor - void SetScale(const Handle(V3d_View)& theView, const double theVal) - { myWindowScale[theView] = theVal; } + void SetScale(const Handle(V3d_View) & theView, const double theVal) { + myWindowScale[theView] = theVal; + } /// Method returns True if the viewer can process editing objects /// by mouse drugging. If this is impossible thet it has to return False. virtual bool canDragByMouse() const { return true; } /// Fit all along Z (perpendicular to display) - //virtual void Zfitall() = 0; + // virtual void Zfitall() = 0; /// Show highlight for pre-highlighted sub-shape virtual void updateHighlight() {} /// Set flag which indicates that viewer is used for 2d operations /// \param is2d a new 2d mode state - void set2dMode(bool is2d) { - myIs2dMode = is2d; - } + void set2dMode(bool is2d) { myIs2dMode = is2d; } /// Returns current state of 2d mode flag - bool is2dMode() const { - return myIs2dMode; - } + bool is2dMode() const { return myIs2dMode; } // Methods for color scale management @@ -181,97 +180,93 @@ Q_OBJECT //! Set color of text of color scale // \param theH is number of intervals - virtual void setColorScaleTextColor(const QColor& theColor) = 0; + virtual void setColorScaleTextColor(const QColor &theColor) = 0; //! Set title of color scale // \param theText is a title - virtual void setColorScaleTitle(const QString& theText) = 0; + virtual void setColorScaleTitle(const QString &theText) = 0; - //! Type for mapping from text to color to display the names lines in different colors - typedef std::list > > TextColor; + //! Type for mapping from text to color to display the names lines in + //! different colors + typedef std::list>> TextColor; //! Sets the text displayed in right-top corner of the 3D view //! \param theText the text to display, or empty string to erase presentation; //! the first item is the font name and text color //! \param theSize size of the text font - virtual void setText(const TextColor& theText, const int theSize) = 0; - + virtual void setText(const TextColor &theText, const int theSize) = 0; /// Switches On additional highlight for objects preselection - void showSelectionHighlight() { - myShowHighlight = true; - } + void showSelectionHighlight() { myShowHighlight = true; } /// Switches Off additional highlight for objects preselection - void hideSelectionHighlight() { - myShowHighlight = false; - } + void hideSelectionHighlight() { myShowHighlight = false; } #ifdef HAVE_SALOME - virtual void setFitter(OCCViewer_Fitter* theFitter) = 0; - virtual OCCViewer_Fitter* fitter() const = 0; + virtual void setFitter(OCCViewer_Fitter *theFitter) = 0; + virtual OCCViewer_Fitter *fitter() const = 0; #else - virtual void setFitter(AppElements_Fitter* theFitter) = 0; - virtual AppElements_Fitter* fitter() const = 0; + virtual void setFitter(AppElements_Fitter *theFitter) = 0; + virtual AppElements_Fitter *fitter() const = 0; #endif static Handle(Prs3d_Drawer) DefaultHighlightDrawer; - signals: /// Signal emited when last view window is closed void lastViewClosed(); /// Signal emited before view window is closed - void tryCloseView(ModuleBase_IViewWindow* theWnd); + void tryCloseView(ModuleBase_IViewWindow *theWnd); /// Signal emited on delete view window - void deleteView(ModuleBase_IViewWindow* theWnd); + void deleteView(ModuleBase_IViewWindow *theWnd); /// Signal emited on creation of view window - void viewCreated(ModuleBase_IViewWindow* theWnd); + void viewCreated(ModuleBase_IViewWindow *theWnd); /// Signal emited on key release - void activated(ModuleBase_IViewWindow* theWnd); + void activated(ModuleBase_IViewWindow *theWnd); /// Signal emited on mouse press - void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + void mousePress(ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); /// Signal emited on mouse release - void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + void mouseRelease(ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); /// Signal emited on mouse double click - void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + void mouseDoubleClick(ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); /// Signal emited on mouse move - void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + void mouseMove(ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); /// Signal emited on key press - void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); + void keyPress(ModuleBase_IViewWindow *theWnd, QKeyEvent *theEvent); /// Signal emited on key release - void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); + void keyRelease(ModuleBase_IViewWindow *theWnd, QKeyEvent *theEvent); /// Signal emited on selection changed void selectionChanged(); /// Signal emited on selection changed - void contextMenuRequested(QContextMenuEvent*); + void contextMenuRequested(QContextMenuEvent *); /// Signal emitted on transformation of view point in view window - /// \param theTransformation type of transformation (see AppElements_ViewWindow::OperationType) + /// \param theTransformation type of transformation (see + /// AppElements_ViewWindow::OperationType) void viewTransformed(int theTransformation); /// Signal emited on selection changed void trihedronVisibilityChanged(bool theState); - protected: - /// A map for storing a scale factors dependent on view object - QMap myWindowScale; +protected: + /// A map for storing a scale factors dependent on view object + QMap myWindowScale; - bool myIs2dMode; + bool myIs2dMode; - bool myShowHighlight; + bool myShowHighlight; }; #endif diff --git a/src/ModuleBase/ModuleBase_IWidgetCreator.cpp b/src/ModuleBase/ModuleBase_IWidgetCreator.cpp index f3ec10cda..fac447ce6 100644 --- a/src/ModuleBase/ModuleBase_IWidgetCreator.cpp +++ b/src/ModuleBase/ModuleBase_IWidgetCreator.cpp @@ -14,38 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IWidgetCreator.h" -ModuleBase_IWidgetCreator::ModuleBase_IWidgetCreator() -{ -} +ModuleBase_IWidgetCreator::ModuleBase_IWidgetCreator() {} -ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() -{ -} +ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() {} -QWidget* ModuleBase_IWidgetCreator::createPanelByType(const std::string& theType, - QWidget* theParent, - const FeaturePtr& theFeature, - Config_WidgetAPI* theWidgetApi) -{ +QWidget *ModuleBase_IWidgetCreator::createPanelByType( + const std::string &theType, QWidget *theParent, + const FeaturePtr &theFeature, Config_WidgetAPI *theWidgetApi) { return 0; } -ModuleBase_PageBase* ModuleBase_IWidgetCreator::createPageByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi) -{ +ModuleBase_PageBase * +ModuleBase_IWidgetCreator::createPageByType(const std::string &theType, + QWidget *theParent, + Config_WidgetAPI *theWidgetApi) { return 0; } -ModuleBase_ModelWidget* ModuleBase_IWidgetCreator::createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop) -{ +ModuleBase_ModelWidget *ModuleBase_IWidgetCreator::createWidgetByType( + const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { return 0; } diff --git a/src/ModuleBase/ModuleBase_IWidgetCreator.h b/src/ModuleBase/ModuleBase_IWidgetCreator.h index fcd402273..a2d0c5ceb 100644 --- a/src/ModuleBase/ModuleBase_IWidgetCreator.h +++ b/src/ModuleBase/ModuleBase_IWidgetCreator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IWidgetCreator_H @@ -24,12 +25,12 @@ #include "ModelAPI_Feature.h" +#include #include #include -#include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif class ModuleBase_ModelWidget; @@ -40,12 +41,11 @@ class Config_WidgetAPI; class QWidget; -/** -* \ingroup GUI -* Interface to WidgetCreator which can create specific widgets by type -*/ -class MODULEBASE_EXPORT ModuleBase_IWidgetCreator -{ +/** + * \ingroup GUI + * Interface to WidgetCreator which can create specific widgets by type + */ +class MODULEBASE_EXPORT ModuleBase_IWidgetCreator { public: /// Default constructor ModuleBase_IWidgetCreator(); @@ -56,16 +56,16 @@ public: /// Returns a container of possible page types, which this creator can process /// The default implementation is empty /// \param theTypes a list of type names - virtual void panelTypes(std::set& /*theTypes*/) {} + virtual void panelTypes(std::set & /*theTypes*/) {} /// Returns a container of possible page types, which this creator can process /// The default implementation is empty /// \param theTypes a list of type names - virtual void pageTypes(std::set& theTypes) {} + virtual void pageTypes(std::set &theTypes) {} - /// Returns a container of possible widget types, which this creator can process - /// \param theTypes a list of type names - virtual void widgetTypes(std::set& theTypes) {} + /// Returns a container of possible widget types, which this creator can + /// process \param theTypes a list of type names + virtual void widgetTypes(std::set &theTypes) {} /// Create panel control by its type. /// The default implementation is empty @@ -74,19 +74,19 @@ public: /// \param theFeature a feature modified in the panel /// \param theWidgetApi a low-level API for reading xml definitions of widget /// \return created widget or null - virtual QWidget* createPanelByType(const std::string& theType, - QWidget* theParent, - const FeaturePtr& theFeature, - Config_WidgetAPI* theWidgetApi = 0); + virtual QWidget *createPanelByType(const std::string &theType, + QWidget *theParent, + const FeaturePtr &theFeature, + Config_WidgetAPI *theWidgetApi = 0); /// Create page by its type /// The default implementation is empty /// \param theType a type /// \param theParent a parent widget /// \param theWidgetApi a low-level API for reading xml definitions of widgets - virtual ModuleBase_PageBase* createPageByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi); + virtual ModuleBase_PageBase *createPageByType(const std::string &theType, + QWidget *theParent, + Config_WidgetAPI *theWidgetApi); /// Create widget by its type /// The default implementation is empty @@ -94,13 +94,12 @@ public: /// \param theParent a parent widget /// \param theWidgetApi a low-level API for reading xml definitions of widgets /// \param theWorkshop a workshop class instance - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop); + virtual ModuleBase_ModelWidget * + createWidgetByType(const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, + ModuleBase_IWorkshop *theWorkshop); }; typedef std::shared_ptr WidgetCreatorPtr; - -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_IWorkshop.cpp b/src/ModuleBase/ModuleBase_IWorkshop.cpp index ed81c0c93..d9b3fe142 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.cpp +++ b/src/ModuleBase/ModuleBase_IWorkshop.cpp @@ -14,18 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IWorkshop.h" -ModuleBase_IWorkshop::ModuleBase_IWorkshop(QObject* theParent) -: QObject(theParent) -{ +ModuleBase_IWorkshop::ModuleBase_IWorkshop(QObject *theParent) + : QObject(theParent) { myValidatorFilter = new ModuleBase_FilterValidated(this); } -Handle(ModuleBase_FilterValidated) ModuleBase_IWorkshop::validatorFilter() -{ +Handle(ModuleBase_FilterValidated) ModuleBase_IWorkshop::validatorFilter() { return myValidatorFilter; } diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h index 2334f52d4..50b64568b 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.h +++ b/src/ModuleBase/ModuleBase_IWorkshop.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IWorkshop_H @@ -24,9 +25,9 @@ #include "ModuleBase_Definitions.h" #include -#include -#include #include +#include +#include #include @@ -44,76 +45,75 @@ class QMainWindow; * \ingroup GUI * Class which provides access to Workshop object services */ -class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent parent object - ModuleBase_IWorkshop(QObject* theParent); +class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject { + Q_OBJECT +public: + /// Constructor + /// \param theParent parent object + ModuleBase_IWorkshop(QObject *theParent); - virtual ~ModuleBase_IWorkshop() - {} + virtual ~ModuleBase_IWorkshop() {} /// Return current selection instance - virtual ModuleBase_ISelection* selection() const = 0; + virtual ModuleBase_ISelection *selection() const = 0; //! Returns instance of loaded module - virtual ModuleBase_IModule* module() const = 0; + virtual ModuleBase_IModule *module() const = 0; //! Returns current viewer - virtual ModuleBase_IViewer* viewer() const = 0; + virtual ModuleBase_IViewer *viewer() const = 0; //! Returns property panel - virtual ModuleBase_IPropertyPanel* propertyPanel() const = 0; + virtual ModuleBase_IPropertyPanel *propertyPanel() const = 0; //! Returns error manager - virtual ModuleBase_IErrorMgr* errorMgr() const = 0; + virtual ModuleBase_IErrorMgr *errorMgr() const = 0; /// A filter to process an attribute validators /// \return a filter Handle(ModuleBase_FilterValidated) validatorFilter(); /// A selection activate in 3D View handler - virtual ModuleBase_ISelectionActivate* selectionActivate() const = 0; + virtual ModuleBase_ISelectionActivate *selectionActivate() const = 0; //! Returns currently active operation - virtual ModuleBase_Operation* currentOperation() const = 0; + virtual ModuleBase_Operation *currentOperation() const = 0; //! Returns true if the operation with id theId can be started - virtual bool canStartOperation(QString theId, bool& isCommitted) = 0; + virtual bool canStartOperation(QString theId, bool &isCommitted) = 0; //! Performs the operation launch //! \param theOperation an operation to be launched - virtual void processLaunchOperation(ModuleBase_Operation* theOperation) = 0; + virtual void processLaunchOperation(ModuleBase_Operation *theOperation) = 0; //! Returns started operation by the operation identifier //! \param theId an operation id //! \return an operation instance or NULL - virtual ModuleBase_Operation* findStartedOperation(const QString& theId) = 0; + virtual ModuleBase_Operation *findStartedOperation(const QString &theId) = 0; //! Returns true if the operation with id theId can be stopped //! \param theOperation a stopped operation //! \return boolean result - virtual bool canStopOperation(ModuleBase_Operation* theOperation) = 0; + virtual bool canStopOperation(ModuleBase_Operation *theOperation) = 0; //! Commits if possible or aborts the given operation. //! \param theOperation an aborted operation - /// \param isCommitted boolean value if the operation was committed otherwise it was aborted - virtual void stopOperation(ModuleBase_Operation* theOperation, - bool& isCommitted) = 0; + /// \param isCommitted boolean value if the operation was committed otherwise + /// it was aborted + virtual void stopOperation(ModuleBase_Operation *theOperation, + bool &isCommitted) = 0; //! Returns AIS object by data object //! \param theObject a data object - virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0; + virtual AISObjectPtr findPresentation(const ObjectPtr &theObject) const = 0; //! Returns data object by AIS //! \param theAIS a presentation - virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0; + virtual ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const = 0; //! Returns true if the object is displayed //! \param theObject a data object - virtual bool isVisible(const ObjectPtr& theObject) const = 0; + virtual bool isVisible(const ObjectPtr &theObject) const = 0; //! Returns list of currently displayed objects virtual QObjectPtrList displayedObjects() const = 0; @@ -121,21 +121,23 @@ Q_OBJECT //! Select features clearing previous selection. //! If the list is empty then selection will be cleared //! \param theValues a list of presentations - virtual void setSelected(const QList>& theValues) = 0; + virtual void setSelected( + const QList> &theValues) = 0; //! Shows the message in the status bar //! \param theMessage a message - virtual void setStatusBarMessage(const QString& theMessage) = 0; + virtual void setStatusBarMessage(const QString &theMessage) = 0; - /// Update of commands status + /// Update of commands status virtual void updateCommandStatus() = 0; /// Returns feature info according to given feature ID /// \param theId a feature Id - virtual std::shared_ptr featureInfo(const QString& theId) const = 0; + virtual std::shared_ptr + featureInfo(const QString &theId) const = 0; /// Returns main window of the application - virtual QMainWindow* desktop() const = 0; + virtual QMainWindow *desktop() const = 0; /// Returns true if SHIFT is pressed /// \return boolean value @@ -143,14 +145,15 @@ Q_OBJECT virtual void deactivateCurrentSelector() = 0; - //! Temporary enable or disable viewer update. Returns previous state of updating - //! \param isEnabled new state of the viewer update + //! Temporary enable or disable viewer update. Returns previous state of + //! updating \param isEnabled new state of the viewer update virtual bool enableUpdateViewer(bool isEnabled) = 0; - //! The methods applys current defined selection modes to given AIS presentation. - //! The AIS presentation has to be already displayed. After activation viewer has to be updated - //! \param theAIS the object which has to be activated - virtual void applyCurrentSelectionModes(const AISObjectPtr& theAIS) = 0; + //! The methods applys current defined selection modes to given AIS + //! presentation. The AIS presentation has to be already displayed. After + //! activation viewer has to be updated \param theAIS the object which has to + //! be activated + virtual void applyCurrentSelectionModes(const AISObjectPtr &theAIS) = 0; //! Undo last command virtual void undo() = 0; @@ -162,7 +165,7 @@ Q_OBJECT virtual bool isCancelEnabled() const = 0; //! Show help of a current operation - virtual void showHelpPage(const QString& thePage) const = 0; + virtual void showHelpPage(const QString &thePage) const = 0; signals: /// Signal selection changed. diff --git a/src/ModuleBase/ModuleBase_IconFactory.cpp b/src/ModuleBase/ModuleBase_IconFactory.cpp index e8879260f..11188d4a0 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.cpp +++ b/src/ModuleBase/ModuleBase_IconFactory.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IconFactory.h" @@ -23,57 +24,47 @@ #include -ModuleBase_IconFactory* MYIconFactory = 0; +ModuleBase_IconFactory *MYIconFactory = 0; +ModuleBase_IconFactory::ModuleBase_IconFactory() { setFactory(this); } -ModuleBase_IconFactory::ModuleBase_IconFactory() -{ - setFactory(this); -} - -void ModuleBase_IconFactory::setFactory(ModuleBase_IconFactory* theFactory) -{ +void ModuleBase_IconFactory::setFactory(ModuleBase_IconFactory *theFactory) { if (MYIconFactory) delete MYIconFactory; MYIconFactory = theFactory; } -ModuleBase_IconFactory* ModuleBase_IconFactory::get() -{ +ModuleBase_IconFactory *ModuleBase_IconFactory::get() { if (!MYIconFactory) { MYIconFactory = new ModuleBase_IconFactory(); } return MYIconFactory; } -QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon) -{ - return QIcon(); -} +QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon) { return QIcon(); } -QIcon ModuleBase_IconFactory::loadIcon(const QString& theValue) -{ +QIcon ModuleBase_IconFactory::loadIcon(const QString &theValue) { return QIcon(loadPixmap(theValue)); } -QPixmap ModuleBase_IconFactory::loadPixmap(const QString& theValue) -{ +QPixmap ModuleBase_IconFactory::loadPixmap(const QString &theValue) { QPixmap aPixmap(theValue); if (aPixmap.isNull()) { - std::string aPath = Config_XMLReader::findConfigFile(theValue.toStdString()); + std::string aPath = + Config_XMLReader::findConfigFile(theValue.toStdString()); if (!aPath.empty()) aPixmap = QPixmap(QString::fromStdString(aPath)); } return aPixmap; } -QImage ModuleBase_IconFactory::loadImage(const QString& theValue) -{ +QImage ModuleBase_IconFactory::loadImage(const QString &theValue) { QImage anImage(theValue); if (anImage.isNull()) { - std::string aPath = Config_XMLReader::findConfigFile(theValue.toStdString()); + std::string aPath = + Config_XMLReader::findConfigFile(theValue.toStdString()); if (!aPath.empty()) anImage = QImage(QString::fromStdString(aPath)); } diff --git a/src/ModuleBase/ModuleBase_IconFactory.h b/src/ModuleBase/ModuleBase_IconFactory.h index ded603fc9..607cebfd2 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.h +++ b/src/ModuleBase/ModuleBase_IconFactory.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_IconFactory_H @@ -23,51 +24,50 @@ #include "ModuleBase.h" #include -#include #include #include +#include /**\class ModuleBase_IconFactory * \ingroup GUI - * \brief This is a class which provides icons of objects for object browser + * \brief This is a class which provides icons of objects for object browser */ -class MODULEBASE_EXPORT ModuleBase_IconFactory -{ +class MODULEBASE_EXPORT ModuleBase_IconFactory { public: virtual ~ModuleBase_IconFactory() {} /// Returns icons factory instance - static ModuleBase_IconFactory* get(); + static ModuleBase_IconFactory *get(); /// Returns Icon for the given object /// \param theObj an object virtual QIcon getIcon(ObjectPtr theObj); - /// Finds an icon for the given value. The icon is loaded: firstly from qrc file, - /// then by the icon path. If the path contains ":" , it will be treated as absolute path to - /// the icon, or relative path from the plugin library + /// Finds an icon for the given value. The icon is loaded: firstly from qrc + /// file, then by the icon path. If the path contains ":" , it will be treated + /// as absolute path to the icon, or relative path from the plugin library /// \param theValue an icon information /// \return a loaded or empty icon - static QIcon loadIcon(const QString& theValue); + static QIcon loadIcon(const QString &theValue); /// Finds a pixmap for the given value. It is loaded: firstly from qrc file, - /// then by the absolute path. If the pixmap is not loaded, it is searched in relative plugin path - /// \param theValue a pixmap information - /// \return a loaded or empty pixmap - static QPixmap loadPixmap(const QString& theValue); + /// then by the absolute path. If the pixmap is not loaded, it is searched in + /// relative plugin path \param theValue a pixmap information \return a loaded + /// or empty pixmap + static QPixmap loadPixmap(const QString &theValue); /// Finds an image for the given value. It is loaded: firstly from qrc file, - /// then by the absolute path. If the image is not loaded, it is searched in relative plugin path - /// \param theValue a image information - /// \return a loaded or empty pixmap - static QImage loadImage(const QString& theValue); + /// then by the absolute path. If the image is not loaded, it is searched in + /// relative plugin path \param theValue a image information \return a loaded + /// or empty pixmap + static QImage loadImage(const QString &theValue); protected: ModuleBase_IconFactory(); /// Set the current icons factory instance /// \param theFactory a new factory - static void setFactory(ModuleBase_IconFactory* theFactory); + static void setFactory(ModuleBase_IconFactory *theFactory); }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_IntSpinBox.cpp b/src/ModuleBase/ModuleBase_IntSpinBox.cpp index eb7b69fdf..55e8ab75f 100644 --- a/src/ModuleBase/ModuleBase_IntSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_IntSpinBox.cpp @@ -14,30 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_IntSpinBox.h" #include -ModuleBase_IntSpinBox::ModuleBase_IntSpinBox(QWidget* theParent) -: QSpinBox(theParent) -{ -} +ModuleBase_IntSpinBox::ModuleBase_IntSpinBox(QWidget *theParent) + : QSpinBox(theParent) {} -void ModuleBase_IntSpinBox::keyPressEvent(QKeyEvent *theEvent) -{ +void ModuleBase_IntSpinBox::keyPressEvent(QKeyEvent *theEvent) { switch (theEvent->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: { - // do not react to the Enter key, the property panel processes it - return; - } + case Qt::Key_Enter: + case Qt::Key_Return: { + // do not react to the Enter key, the property panel processes it + return; + } break; + default: break; - default: - break; } QSpinBox::keyPressEvent(theEvent); } - diff --git a/src/ModuleBase/ModuleBase_IntSpinBox.h b/src/ModuleBase/ModuleBase_IntSpinBox.h index abfae2f43..baa84f511 100644 --- a/src/ModuleBase/ModuleBase_IntSpinBox.h +++ b/src/ModuleBase/ModuleBase_IntSpinBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_INT_SPINBOX_H_ @@ -28,23 +29,22 @@ class QWidget; class QKeyEvent; /** - * \ingroup GUI - * Enhanced version of the Qt's int spin box. - * It allows to store modified state -*/ -class MODULEBASE_EXPORT ModuleBase_IntSpinBox : public QSpinBox -{ -Q_OBJECT + * \ingroup GUI + * Enhanced version of the Qt's int spin box. + * It allows to store modified state + */ +class MODULEBASE_EXPORT ModuleBase_IntSpinBox : public QSpinBox { + Q_OBJECT public: /// Constructor /// \param theParent a parent widget - explicit ModuleBase_IntSpinBox(QWidget* theParent = 0); - virtual ~ModuleBase_IntSpinBox() {}; + explicit ModuleBase_IntSpinBox(QWidget *theParent = 0); + virtual ~ModuleBase_IntSpinBox(){}; protected: /// Called on key press event - virtual void keyPressEvent(QKeyEvent* theEvent); + virtual void keyPressEvent(QKeyEvent *theEvent); }; #endif diff --git a/src/ModuleBase/ModuleBase_LabelValue.cpp b/src/ModuleBase/ModuleBase_LabelValue.cpp index 7f9279bb7..53596adc1 100644 --- a/src/ModuleBase/ModuleBase_LabelValue.cpp +++ b/src/ModuleBase/ModuleBase_LabelValue.cpp @@ -14,23 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include #include #include -ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget* theParent, const QString& theText, - const QString& theToolTip, const QString& theIcon, +ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget *theParent, + const QString &theText, + const QString &theToolTip, + const QString &theIcon, int thePrecision) -: QWidget(theParent), myValue(0), myPrecision(thePrecision) -{ - QHBoxLayout* aLayout = new QHBoxLayout(this); + : QWidget(theParent), myValue(0), myPrecision(thePrecision) { + QHBoxLayout *aLayout = new QHBoxLayout(this); aLayout->setContentsMargins(2, 0, 0, 0); aLayout->setSpacing(0); @@ -49,15 +51,13 @@ ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget* theParent, const QString& aLayout->addStretch(1); } -ModuleBase_LabelValue::~ModuleBase_LabelValue() -{ -} +ModuleBase_LabelValue::~ModuleBase_LabelValue() {} -void ModuleBase_LabelValue::setValue(const double theValue) -{ +void ModuleBase_LabelValue::setValue(const double theValue) { myValue = theValue; - QString aStrValue = locale().toString(theValue, myPrecision >= 0 ? 'f' : 'g', qAbs(myPrecision)); + QString aStrValue = locale().toString(theValue, myPrecision >= 0 ? 'f' : 'g', + qAbs(myPrecision)); myLabelValue->setText(aStrValue); myLabelValue->setToolTip(aStrValue); } diff --git a/src/ModuleBase/ModuleBase_LabelValue.h b/src/ModuleBase/ModuleBase_LabelValue.h index d4ed3f7f1..092f73ab2 100644 --- a/src/ModuleBase/ModuleBase_LabelValue.h +++ b/src/ModuleBase/ModuleBase_LabelValue.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_LabelValue_H @@ -27,11 +28,10 @@ class QLabel; /** -* \ingroup GUI -* Implementation of model widget for a label control -*/ -class MODULEBASE_EXPORT ModuleBase_LabelValue : public QWidget -{ + * \ingroup GUI + * Implementation of model widget for a label control + */ +class MODULEBASE_EXPORT ModuleBase_LabelValue : public QWidget { Q_OBJECT public: /// Constructor @@ -39,10 +39,9 @@ public: /// \param theText a text value /// \param theToolTip a tool tip value /// \param theIcon a icon value - ModuleBase_LabelValue(QWidget* theParent, const QString& theText, - const QString& theToolTip = "", - const QString& theIcon = "", - int thePrecision = -12); + ModuleBase_LabelValue(QWidget *theParent, const QString &theText, + const QString &theToolTip = "", + const QString &theIcon = "", int thePrecision = -12); virtual ~ModuleBase_LabelValue(); @@ -55,10 +54,10 @@ public: double value() const { return myValue; } protected: - QLabel* myLabel; ///< A label information control - QLabel* myLabelValue; ///< A label value control + QLabel *myLabel; ///< A label information control + QLabel *myLabelValue; ///< A label value control - double myValue; ///< A cashed value to avoid a string conversion + double myValue; ///< A cashed value to avoid a string conversion int myPrecision; ///< Precision value }; diff --git a/src/ModuleBase/ModuleBase_ListView.cpp b/src/ModuleBase/ModuleBase_ListView.cpp index d282a6376..3019ae31f 100644 --- a/src/ModuleBase/ModuleBase_ListView.cpp +++ b/src/ModuleBase/ModuleBase_ListView.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ListView.h" @@ -33,44 +34,46 @@ const int ATTRIBUTE_SELECTION_INDEX_ROLE = Qt::UserRole + 1; //******************************************************************** -ModuleBase_ListView::ModuleBase_ListView(QWidget* theParent, const QString& theObjectName, - const QString& theToolTip) -{ +ModuleBase_ListView::ModuleBase_ListView(QWidget *theParent, + const QString &theObjectName, + const QString &theToolTip) { myListControl = new CustomListWidget(theParent); myListControl->setObjectName(theObjectName); myListControl->setToolTip(theToolTip); myListControl->setSelectionMode(QAbstractItemView::ExtendedSelection); - myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"), - theParent, this, SLOT(onCopyItem())); + myCopyAction = + ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"), + theParent, this, SLOT(onCopyItem())); myCopyAction->setShortcut(QKeySequence::Copy); myCopyAction->setEnabled(false); myListControl->addAction(myCopyAction); - myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"), - theParent, this, SIGNAL(deleteActionClicked())); + myDeleteAction = ModuleBase_Tools::createAction( + QIcon(":pictures/delete.png"), tr("Delete"), theParent, this, + SIGNAL(deleteActionClicked())); myDeleteAction->setEnabled(false); myListControl->addAction(myDeleteAction); myListControl->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection())); + connect(myListControl, SIGNAL(itemSelectionChanged()), + SLOT(onListSelection())); connect(myListControl, SIGNAL(activated()), this, SIGNAL(listActivated())); } //******************************************************************** -void ModuleBase_ListView::addItem(const QString& theTextValue, const int theIndex) -{ - QListWidgetItem* anItem = new QListWidgetItem(theTextValue, myListControl); +void ModuleBase_ListView::addItem(const QString &theTextValue, + const int theIndex) { + QListWidgetItem *anItem = new QListWidgetItem(theTextValue, myListControl); anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, theIndex); myListControl->addItem(anItem); } //******************************************************************** -void ModuleBase_ListView::getSelectedIndices(std::set& theIndices) -{ - QList aItems = myListControl->selectedItems(); - foreach(QListWidgetItem* anItem, aItems) { +void ModuleBase_ListView::getSelectedIndices(std::set &theIndices) { + QList aItems = myListControl->selectedItems(); + foreach (QListWidgetItem *anItem, aItems) { int anIndex = anItem->data(ATTRIBUTE_SELECTION_INDEX_ROLE).toInt(); if (theIndices.find(anIndex) == theIndices.end()) theIndices.insert(anIndex); @@ -78,11 +81,10 @@ void ModuleBase_ListView::getSelectedIndices(std::set& theIndices) } //******************************************************************** -void ModuleBase_ListView::selectIndices(const std::set& theIndices) -{ +void ModuleBase_ListView::selectIndices(const std::set &theIndices) { myListControl->clearSelection(); for (int i = 0; i < myListControl->count(); i++) { - QListWidgetItem* anItem = myListControl->item(i); + QListWidgetItem *anItem = myListControl->item(i); int aId = anItem->data(ATTRIBUTE_SELECTION_INDEX_ROLE).toInt(); if (theIndices.find(aId) != theIndices.end()) { anItem->setSelected(true); @@ -91,69 +93,65 @@ void ModuleBase_ListView::selectIndices(const std::set& theIndices) } //******************************************************************** -void ModuleBase_ListView::removeSelectedItems() -{ - QList aItems = myListControl->selectedItems(); - foreach(QListWidgetItem* anItem, aItems) +void ModuleBase_ListView::removeSelectedItems() { + QList aItems = myListControl->selectedItems(); + foreach (QListWidgetItem *anItem, aItems) myListControl->takeItem(myListControl->row(anItem)); } //******************************************************************** -void ModuleBase_ListView::removeItems(std::set& theIndices) -{ - QList aItems; +void ModuleBase_ListView::removeItems(std::set &theIndices) { + QList aItems; for (int i = 0; i < myListControl->count(); i++) { - QListWidgetItem* anItem = myListControl->item(i); + QListWidgetItem *anItem = myListControl->item(i); int anIndex = anItem->data(ATTRIBUTE_SELECTION_INDEX_ROLE).toInt(); if (theIndices.find(anIndex) != theIndices.end()) aItems.append(anItem); } - foreach(QListWidgetItem* anItem, aItems) + foreach (QListWidgetItem *anItem, aItems) myListControl->takeItem(myListControl->row(anItem)); } //******************************************************************** -void ModuleBase_ListView::restoreSelection(const QModelIndexList& theIndices) -{ +void ModuleBase_ListView::restoreSelection(const QModelIndexList &theIndices) { int aRows = myListControl->model()->rowCount(); if (aRows > 0) { - foreach(QModelIndex aIndex, theIndices) { + foreach (QModelIndex aIndex, theIndices) { if (aIndex.row() < aRows) - myListControl->selectionModel()->select(aIndex, QItemSelectionModel::Select); + myListControl->selectionModel()->select(aIndex, + QItemSelectionModel::Select); else { QModelIndex aIdx = myListControl->model()->index(aRows - 1, 0); - myListControl->selectionModel()->select(aIdx, QItemSelectionModel::Select); + myListControl->selectionModel()->select(aIdx, + QItemSelectionModel::Select); } } } } //******************************************************************** -void ModuleBase_ListView::onCopyItem() -{ - QList aItems = myListControl->selectedItems(); +void ModuleBase_ListView::onCopyItem() { + QList aItems = myListControl->selectedItems(); QString aRes; - foreach(QListWidgetItem* aItem, aItems) { + foreach (QListWidgetItem *aItem, aItems) { if (!aRes.isEmpty()) aRes += "\n"; aRes += aItem->text(); } if (!aRes.isEmpty()) { - QClipboard* aClipboard = QApplication::clipboard(); + QClipboard *aClipboard = QApplication::clipboard(); aClipboard->setText(aRes); } } //******************************************************************** -void ModuleBase_ListView::onListSelection() -{ - QList aItems = myListControl->selectedItems(); +void ModuleBase_ListView::onListSelection() { + QList aItems = myListControl->selectedItems(); myCopyAction->setEnabled(!aItems.isEmpty()); myDeleteAction->setEnabled(!aItems.isEmpty()); } //******************************************************************** -bool ModuleBase_ListView::hasItem(const QString& theTextValue) const -{ +bool ModuleBase_ListView::hasItem(const QString &theTextValue) const { return myListControl->findItems(theTextValue, Qt::MatchExactly).length() > 0; } diff --git a/src/ModuleBase/ModuleBase_ListView.h b/src/ModuleBase/ModuleBase_ListView.h index 0e66fa67d..768a94f29 100644 --- a/src/ModuleBase/ModuleBase_ListView.h +++ b/src/ModuleBase/ModuleBase_ListView.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ListView_H_ @@ -22,9 +23,9 @@ #include "ModuleBase.h" +#include #include #include -#include #include #include @@ -33,33 +34,27 @@ class QAction; class QListWidget; class QWidget; - /** -* Customization of a List Widget to make it to be placed on full width of container -*/ -class CustomListWidget : public QListWidget -{ + * Customization of a List Widget to make it to be placed on full width of + * container + */ +class CustomListWidget : public QListWidget { Q_OBJECT public: /// Constructor /// \param theParent a parent widget - CustomListWidget(QWidget* theParent) - : QListWidget(theParent) - { - } + CustomListWidget(QWidget *theParent) : QListWidget(theParent) {} /// Redefinition of virtual method - virtual QSize sizeHint() const - { + virtual QSize sizeHint() const { int aHeight = 2 * QFontMetrics(font()).height(); QSize aSize = QListWidget::sizeHint(); return QSize(aSize.width(), aHeight); } /// Redefinition of virtual method - virtual QSize minimumSizeHint() const - { - int aHeight = 4/*2*/ * QFontMetrics(font()).height(); + virtual QSize minimumSizeHint() const { + int aHeight = 4 /*2*/ * QFontMetrics(font()).height(); QSize aSize = QListWidget::minimumSizeHint(); return QSize(aSize.width(), aHeight); } @@ -68,70 +63,68 @@ signals: void activated(); protected: - virtual void mouseReleaseEvent(QMouseEvent* e) { + virtual void mouseReleaseEvent(QMouseEvent *e) { QListWidget::mouseReleaseEvent(e); emit activated(); } #ifndef WIN32 // The code is necessary only for Linux because - //it can not update viewport on widget resize + // it can not update viewport on widget resize protected: - void resizeEvent(QResizeEvent* theEvent) - { + void resizeEvent(QResizeEvent *theEvent) { QListWidget::resizeEvent(theEvent); QTimer::singleShot(5, viewport(), SLOT(repaint())); } #endif }; - /** -* \ingroup GUI -* An extension of QListWidget to provide Undo/Redo functionality -*/ -class MODULEBASE_EXPORT ModuleBase_ListView : public QObject -{ -Q_OBJECT + * \ingroup GUI + * An extension of QListWidget to provide Undo/Redo functionality + */ +class MODULEBASE_EXPORT ModuleBase_ListView : public QObject { + Q_OBJECT public: /// Constructor - ModuleBase_ListView(QWidget* theParent = 0, const QString& theObjectName = QString(), - const QString& theToolTip = QString()); + ModuleBase_ListView(QWidget *theParent = 0, + const QString &theObjectName = QString(), + const QString &theToolTip = QString()); /// Destructor virtual ~ModuleBase_ListView() {} /// Returns current control /// \return list view instance - QListWidget* getControl() const { return myListControl; } + QListWidget *getControl() const { return myListControl; } - /// Adds a new list widget item to the end of the list and connect it to the given index - /// \param theTextValue value visualized in the view - /// \param theIndex an item internal index - void addItem(const QString& theTextValue, const int theIndex); + /// Adds a new list widget item to the end of the list and connect it to the + /// given index \param theTextValue value visualized in the view \param + /// theIndex an item internal index + void addItem(const QString &theTextValue, const int theIndex); /// Returns True if the control already contains an item with the given text /// \param theTextValue tex of item to find - bool hasItem(const QString& theTextValue) const; + bool hasItem(const QString &theTextValue) const; /// Returns list of internal list view item indices /// \param theIndices an output container for indices - void getSelectedIndices(std::set& theIndices); + void getSelectedIndices(std::set &theIndices); /// Selects items with indices /// \param theIndices indices - void selectIndices(const std::set& theIndices); + void selectIndices(const std::set &theIndices); /// Removes selected items from the list widget void removeSelectedItems(); /// Remove items contain parameter indices /// \param theIndices an indices - void removeItems(std::set& theIndices); + void removeItems(std::set &theIndices); /// Set selected items if possible /// \param theIndices container of indices to be selected - void restoreSelection(const QModelIndexList& theIndices); + void restoreSelection(const QModelIndexList &theIndices); /// Update enable/disable state of context menu actions void updateActionsStatus(); @@ -143,7 +136,6 @@ protected slots: /// Slot is called on selection of list of selected items void onListSelection(); - signals: /// Signal about delete action click void deleteActionClicked(); @@ -151,10 +143,11 @@ signals: void listActivated(); protected: - QListWidget* myListControl; ///< List control + QListWidget *myListControl; ///< List control - QAction* myCopyAction; ///< A copy action for pop-up menu in a list control - QAction* myDeleteAction; ///< A delete action for pop-up menu in a list control + QAction *myCopyAction; ///< A copy action for pop-up menu in a list control + QAction + *myDeleteAction; ///< A delete action for pop-up menu in a list control }; #endif diff --git a/src/ModuleBase/ModuleBase_ModelDialogWidget.h b/src/ModuleBase/ModuleBase_ModelDialogWidget.h index 273c2f7ff..90436f643 100644 --- a/src/ModuleBase/ModuleBase_ModelDialogWidget.h +++ b/src/ModuleBase/ModuleBase_ModelDialogWidget.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_MODELDIALOGWIDGET_H @@ -28,25 +29,27 @@ class QDialogButtonBox; /// \class ModuleBase_ModelDialogWidget /// \ingroup GUI /// \brief Widget for dialog. -class MODULEBASE_EXPORT ModuleBase_ModelDialogWidget : public ModuleBase_ModelWidget -{ -Q_OBJECT +class MODULEBASE_EXPORT ModuleBase_ModelDialogWidget + : public ModuleBase_ModelWidget { + Q_OBJECT public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - /// a low-level API for reading xml definitions of widgets - ModuleBase_ModelDialogWidget(QWidget* theParent, const Config_WidgetAPI* theData) : - ModuleBase_ModelWidget(theParent, theData) {} + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from a low-level API for reading xml definitions of widgets + ModuleBase_ModelDialogWidget(QWidget *theParent, + const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData) {} /// Set general buttons from dialog /// \param theButtons the dialog buttons - virtual void setDialogButtons(QDialogButtonBox* theButtons) { myOkCancelBtn = theButtons; } + virtual void setDialogButtons(QDialogButtonBox *theButtons) { + myOkCancelBtn = theButtons; + } protected: - /// Contains dialog buttons to enable/disable Ok and Cancel buttons - QDialogButtonBox* myOkCancelBtn; + QDialogButtonBox *myOkCancelBtn; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 5a3f70e5d..9a570546a 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -14,33 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ModelWidget.h" #include "ModuleBase_IPropertyPanel.h" -#include "ModuleBase_ViewerPrs.h" #include "ModuleBase_Tools.h" +#include "ModuleBase_ViewerPrs.h" #include "ModuleBase_WidgetValidator.h" #include -#include #include +#include #include #include #include #include -#include -#include #include +#include +#include #include #include -#include #include +#include #include //#define DEBUG_VALUE_STATE @@ -49,15 +50,11 @@ //#define DEBUG_ENABLE_SKETCH_INPUT_FIELDS //************************************************************** -ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, - const Config_WidgetAPI* theData) - : QWidget(theParent), - myWidgetValidator(0), - myState(Stored), - myIsEditing(false), - myIsValueStateBlocked(false), - myFlushUpdateBlocked(false) -{ +ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget *theParent, + const Config_WidgetAPI *theData) + : QWidget(theParent), myWidgetValidator(0), myState(Stored), + myIsEditing(false), myIsValueStateBlocked(false), + myFlushUpdateBlocked(false) { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::ModuleBase_ModelWidget"); #endif @@ -65,15 +62,18 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, myFeatureId = theData->featureId(); myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false); - myUseExternalParts = theData->getBooleanAttribute("allow_parts_content", false); + myUseExternalParts = + theData->getBooleanAttribute("allow_parts_content", false); myIsModifiedInEdit = theData->getProperty(ATTR_MODIFIED_IN_EDIT); - myUpdateVisualAttributes = theData->getBooleanAttribute(ATTR_VISUAL_CHANGED, false); + myUpdateVisualAttributes = + theData->getBooleanAttribute(ATTR_VISUAL_CHANGED, false); myDefaultValue = theData->getProperty(ATTR_DEFAULT); myUseReset = theData->getBooleanAttribute(ATTR_USE_RESET, true); - myIsComputedDefault = theData->getProperty(ATTR_DEFAULT) == DOUBLE_WDG_DEFAULT_COMPUTED; + myIsComputedDefault = + theData->getProperty(ATTR_DEFAULT) == DOUBLE_WDG_DEFAULT_COMPUTED; myAttributeID = theData ? theData->widgetId() : ""; myIsObligatory = theData->getBooleanAttribute(ATTR_OBLIGATORY, true); @@ -89,16 +89,14 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, } //************************************************************** -ModuleBase_ModelWidget::~ModuleBase_ModelWidget() -{ +ModuleBase_ModelWidget::~ModuleBase_ModelWidget() { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::~ModuleBase_ModelWidget"); #endif } //************************************************************** -bool ModuleBase_ModelWidget::reset() -{ +bool ModuleBase_ModelWidget::reset() { bool aResult = resetCustom(); if (aResult) setValueState(Reset); @@ -107,56 +105,53 @@ bool ModuleBase_ModelWidget::reset() } //************************************************************** -bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const -{ +bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const { return theObject->data()->attribute(attributeID())->isInitialized(); } //************************************************************** -void ModuleBase_ModelWidget::selectionModes(int& theModuleSelectionModes, QIntList& theModes) -{ +void ModuleBase_ModelWidget::selectionModes(int &theModuleSelectionModes, + QIntList &theModes) { theModuleSelectionModes = -1; if (myWidgetValidator) myWidgetValidator->selectionModes(theModuleSelectionModes, theModes); } //************************************************************** -void ModuleBase_ModelWidget::selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters) -{ +void ModuleBase_ModelWidget::selectionFilters( + QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) { if (myWidgetValidator) - myWidgetValidator->selectionFilters(theModuleSelectionFilters, theSelectionFilters); + myWidgetValidator->selectionFilters(theModuleSelectionFilters, + theSelectionFilters); } //************************************************************** -bool ModuleBase_ModelWidget::isValueEnabled() const -{ +bool ModuleBase_ModelWidget::isValueEnabled() const { bool anEnabled = true; if (myIsValueEnabled == DefinedInPreferences) { #ifdef DEBUG_ENABLE_SKETCH_INPUT_FIELDS bool aCanDisable = false; #else - //Config_PropManager::boolean(SKETCH_TAB_NAME, "disable_input_fields", "true"); + // Config_PropManager::boolean(SKETCH_TAB_NAME, "disable_input_fields", + // "true"); bool aCanDisable = true; #endif if (aCanDisable) anEnabled = false; - } - else if (myIsValueEnabled == Off) + } else if (myIsValueEnabled == Off) anEnabled = false; return anEnabled; } //************************************************************** -void ModuleBase_ModelWidget::processValueState() -{ +void ModuleBase_ModelWidget::processValueState() { if (myState == ModifiedInPP || myState == ModifiedInViewer) storeValue(); } //************************************************************** -Events_InfoMessage ModuleBase_ModelWidget::getValueStateError() const -{ +Events_InfoMessage ModuleBase_ModelWidget::getValueStateError() const { Events_InfoMessage aMessage; aMessage.setContext(context()); @@ -164,19 +159,21 @@ Events_InfoMessage ModuleBase_ModelWidget::getValueStateError() const if (aState != ModuleBase_ModelWidget::Stored) { AttributePtr anAttr = feature()->attribute(attributeID()); if (anAttr.get()) { - const std::string& anAttributeName = anAttr->id(); + const std::string &anAttributeName = anAttr->id(); switch (aState) { - case ModuleBase_ModelWidget::ModifiedInViewer: - aMessage = "Attribute \"%1\" is locked by modification value in the viewer."; - aMessage.addParameter(anAttributeName); - break; - case ModuleBase_ModelWidget::Reset: - aMessage = "Attribute \"%1\" is not initialized."; - aMessage.addParameter(anAttributeName); - break; - case ModuleBase_ModelWidget::ModifiedInPP: // Apply should be enabled in this mode - default: - break; + case ModuleBase_ModelWidget::ModifiedInViewer: + aMessage = + "Attribute \"%1\" is locked by modification value in the viewer."; + aMessage.addParameter(anAttributeName); + break; + case ModuleBase_ModelWidget::Reset: + aMessage = "Attribute \"%1\" is not initialized."; + aMessage.addParameter(anAttributeName); + break; + case ModuleBase_ModelWidget::ModifiedInPP: // Apply should be enabled in + // this mode + default: + break; } } } @@ -184,8 +181,8 @@ Events_InfoMessage ModuleBase_ModelWidget::getValueStateError() const } //************************************************************** -QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const -{ +QString +ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const { QString anError; if (!feature().get()) @@ -199,7 +196,8 @@ QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const std::string aValidatorID; Events_InfoMessage anErrorMsg; - static ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + static ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); if (!aValidators->validate(anAttribute, aValidatorID, anErrorMsg)) { if (anErrorMsg.empty()) anErrorMsg = "Unknown error."; @@ -221,42 +219,41 @@ QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const } //************************************************************** -void ModuleBase_ModelWidget::enableFocusProcessing() -{ - QList aMyControls = getControls(); - foreach(QWidget* eachControl, aMyControls) { - eachControl->setFocusPolicy(Qt::StrongFocus); - eachControl->installEventFilter(this); +void ModuleBase_ModelWidget::enableFocusProcessing() { + QList aMyControls = getControls(); + foreach (QWidget *eachControl, aMyControls) { + eachControl->setFocusPolicy(Qt::StrongFocus); + eachControl->installEventFilter(this); } } //************************************************************** -void ModuleBase_ModelWidget::setHighlighted(bool isHighlighted) -{ - QList aWidgetList = getControls(); - foreach(QWidget* aWidget, aWidgetList) { - QLabel* aLabel = qobject_cast(aWidget); +void ModuleBase_ModelWidget::setHighlighted(bool isHighlighted) { + QList aWidgetList = getControls(); + foreach (QWidget *aWidget, aWidgetList) { + QLabel *aLabel = qobject_cast(aWidget); // We won't set the effect to QLabels - it looks ugly - if(aLabel) continue; - // If effect is the installed on a different widget, setGraphicsEffect() will - // remove the effect from the widget and install it on this widget. + if (aLabel) + continue; + // If effect is the installed on a different widget, setGraphicsEffect() + // will remove the effect from the widget and install it on this widget. // That's why we create a new effect for each widget ModuleBase_Tools::setShadowEffect(aWidget, isHighlighted); } } //************************************************************** -void ModuleBase_ModelWidget::setFeature(const FeaturePtr& theFeature, const bool theToStoreValue, - const bool isUpdateFlushed) -{ - /// it is possible to give this flag as parameter in storeValue/storeCustomValue - /// after debug, it may be corrected +void ModuleBase_ModelWidget::setFeature(const FeaturePtr &theFeature, + const bool theToStoreValue, + const bool isUpdateFlushed) { + /// it is possible to give this flag as parameter in + /// storeValue/storeCustomValue after debug, it may be corrected myFlushUpdateBlocked = !isUpdateFlushed; myFeature = theFeature; if (theToStoreValue) { - /// it is possible that the attribute is filled before the operation is started, - /// e.g. by reentrant operation case some attributes are filled by values of - /// feature of previous operation, we should not lost them here + /// it is possible that the attribute is filled before the operation is + /// started, e.g. by reentrant operation case some attributes are filled by + /// values of feature of previous operation, we should not lost them here if (!theFeature->data()->attribute(attributeID())->isInitialized()) storeValue(); } @@ -264,16 +261,16 @@ void ModuleBase_ModelWidget::setFeature(const FeaturePtr& theFeature, const bool } //************************************************************** -bool ModuleBase_ModelWidget::focusTo() -{ +bool ModuleBase_ModelWidget::focusTo() { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::focusTo"); #endif - QList aControls = getControls(); - QList::const_iterator anIt = aControls.begin(), aLast = aControls.end(); + QList aControls = getControls(); + QList::const_iterator anIt = aControls.begin(), + aLast = aControls.end(); bool isFocusAccepted = false; for (; anIt != aLast && !isFocusAccepted; anIt++) { - QWidget* aWidget = *anIt; + QWidget *aWidget = *anIt; if (aWidget && aWidget->focusPolicy() != Qt::NoFocus) { ModuleBase_Tools::setFocus(aWidget, "ModuleBase_ModelWidget::focusTo()"); isFocusAccepted = true; @@ -283,14 +280,14 @@ bool ModuleBase_ModelWidget::focusTo() } //************************************************************** -void ModuleBase_ModelWidget::activate() -{ +void ModuleBase_ModelWidget::activate() { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::activate"); #endif // the control value is stored to the mode by the focus in on the widget - // we need the value is initialized in order to enable the apply button in the property panel. - // It should happens in the creation mode only because all fields are filled in the edition mode + // we need the value is initialized in order to enable the apply button in the + // property panel. It should happens in the creation mode only because all + // fields are filled in the edition mode if (!isEditingMode()) { AttributePtr anAttribute = myFeature->data()->attribute(myAttributeID); if (anAttribute.get() != NULL && !anAttribute->isInitialized()) @@ -300,8 +297,7 @@ void ModuleBase_ModelWidget::activate() } //************************************************************** -void ModuleBase_ModelWidget::deactivate() -{ +void ModuleBase_ModelWidget::deactivate() { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::deactivate"); #endif @@ -312,34 +308,30 @@ void ModuleBase_ModelWidget::deactivate() } //************************************************************** -void ModuleBase_ModelWidget::initializeValueByActivate() -{ +void ModuleBase_ModelWidget::initializeValueByActivate() { if (isComputedDefault()) { if (myFeature->compute(myAttributeID)) { restoreValue(); } - } - else { + } else { storeValue(); } } //************************************************************** -QWidget* ModuleBase_ModelWidget::getControlAcceptingFocus(const bool isFirst) -{ - QWidget* aControl = 0; +QWidget *ModuleBase_ModelWidget::getControlAcceptingFocus(const bool isFirst) { + QWidget *aControl = 0; - QList aControls = getControls(); + QList aControls = getControls(); int aSize = aControls.size(); if (isFirst) { - for (int i = 0; i < aSize && !aControl; i++) { + for (int i = 0; i < aSize && !aControl; i++) { if (aControls[i]->focusPolicy() != Qt::NoFocus) aControl = aControls[i]; } - } - else { - for (int i = aSize - 1; i >= 0 && !aControl; i--) { + } else { + for (int i = aSize - 1; i >= 0 && !aControl; i--) { if (aControls[i]->focusPolicy() != Qt::NoFocus) aControl = aControls[i]; } @@ -348,14 +340,12 @@ QWidget* ModuleBase_ModelWidget::getControlAcceptingFocus(const bool isFirst) } //************************************************************** -void ModuleBase_ModelWidget::setDefaultValue(const std::string& theValue) -{ +void ModuleBase_ModelWidget::setDefaultValue(const std::string &theValue) { myDefaultValue = theValue; } //************************************************************** -bool ModuleBase_ModelWidget::storeValue() -{ +bool ModuleBase_ModelWidget::storeValue() { setValueState(Stored); emit beforeValuesChanged(); @@ -365,13 +355,14 @@ bool ModuleBase_ModelWidget::storeValue() if (!isEditingMode() || isModifiedInEdit().empty()) isDone = storeValueCustom(); else { - /// store value in an alternative attribute if possible(attribute has the same type) + /// store value in an alternative attribute if possible(attribute has the + /// same type) std::string aWidgetAttribute = attributeID(); myAttributeID = isModifiedInEdit(); storeValueCustom(); myAttributeID = aWidgetAttribute; - // operation will be restarted but if isDone == true, PagedContainer will try to set focus - // to the current widget, but will be already deleted + // operation will be restarted but if isDone == true, PagedContainer will + // try to set focus to the current widget, but will be already deleted isDone = false; } @@ -382,31 +373,40 @@ bool ModuleBase_ModelWidget::storeValue() #ifdef DEBUG_VALUE_STATE //************************************************************** -std::string getDebugInfo(const ModuleBase_ModelWidget::ValueState& theState) -{ +std::string getDebugInfo(const ModuleBase_ModelWidget::ValueState &theState) { std::string anInfo; switch (theState) { - case ModuleBase_ModelWidget::Stored: anInfo = "Stored "; break; - case ModuleBase_ModelWidget::ModifiedInPP: anInfo = "ModifiedInPP "; break; - case ModuleBase_ModelWidget::ModifiedInViewer: anInfo = "ModifiedInViewer"; break; - case ModuleBase_ModelWidget::Reset: anInfo = "Reset "; break; - default: break; + case ModuleBase_ModelWidget::Stored: + anInfo = "Stored "; + break; + case ModuleBase_ModelWidget::ModifiedInPP: + anInfo = "ModifiedInPP "; + break; + case ModuleBase_ModelWidget::ModifiedInViewer: + anInfo = "ModifiedInViewer"; + break; + case ModuleBase_ModelWidget::Reset: + anInfo = "Reset "; + break; + default: + break; } return anInfo; } #endif //************************************************************** -ModuleBase_ModelWidget::ValueState ModuleBase_ModelWidget::setValueState - (const ModuleBase_ModelWidget::ValueState& theState) -{ +ModuleBase_ModelWidget::ValueState ModuleBase_ModelWidget::setValueState( + const ModuleBase_ModelWidget::ValueState &theState) { ValueState aState = myState; if (myState != theState && !myIsValueStateBlocked) { #ifdef DEBUG_VALUE_STATE qDebug(QString("setValueState: previous state = %1,\t new state = %2") - .arg(getDebugInfo(myState).c_str()) - .arg(getDebugInfo(theState).c_str()).toStdString().c_str()); + .arg(getDebugInfo(myState).c_str()) + .arg(getDebugInfo(theState).c_str()) + .toStdString() + .c_str()); #endif myState = theState; emit valueStateChanged(aState); @@ -415,19 +415,18 @@ ModuleBase_ModelWidget::ValueState ModuleBase_ModelWidget::setValueState } //************************************************************** -bool ModuleBase_ModelWidget::blockValueState(const bool theBlocked) -{ +bool ModuleBase_ModelWidget::blockValueState(const bool theBlocked) { bool isBlocked = myIsValueStateBlocked; myIsValueStateBlocked = theBlocked; return isBlocked; } //************************************************************** -bool ModuleBase_ModelWidget::restoreValue() -{ +bool ModuleBase_ModelWidget::restoreValue() { if (!isEnabled()) { // This code works in inspection panel - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); if (!aValidators->isCase(myFeature, attributeID())) return false; // if it is not an active case for the widget } @@ -439,14 +438,14 @@ bool ModuleBase_ModelWidget::restoreValue() } //************************************************************** -void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject) -{ +void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject) { if (!myFlushUpdateBlocked) { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::updateObject"); #endif if (myFeature.get() && myUpdateVisualAttributes) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); } ModuleBase_Tools::flushUpdated(theObject); @@ -455,92 +454,83 @@ void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject) } //************************************************************** -bool ModuleBase_ModelWidget::canProcessAction(ModuleBase_ActionType theActionType, - bool& isActionEnabled) -{ +bool ModuleBase_ModelWidget::canProcessAction( + ModuleBase_ActionType theActionType, bool &isActionEnabled) { isActionEnabled = false; switch (theActionType) { - case ActionEnter: return false; - case ActionEscape: return false; - case ActionDelete: return true; - case ActionSelection: return true; - case ActionUndo: - case ActionRedo: - default: - return false; + case ActionEnter: + return false; + case ActionEscape: + return false; + case ActionDelete: + return true; + case ActionSelection: + return true; + case ActionUndo: + case ActionRedo: + default: + return false; } } //************************************************************** bool ModuleBase_ModelWidget::processAction(ModuleBase_ActionType theActionType, - const ActionParamPtr& theParam) -{ + const ActionParamPtr &theParam) { switch (theActionType) { - case ActionEnter: - return processEnter(); - case ActionEscape: - return processEscape(); - case ActionDelete: - return processDelete(); - case ActionSelection: - processSelection(); - case ActionUndo: - case ActionRedo: - default: - return false; + case ActionEnter: + return processEnter(); + case ActionEscape: + return processEscape(); + case ActionDelete: + return processDelete(); + case ActionSelection: + processSelection(); + case ActionUndo: + case ActionRedo: + default: + return false; } } //************************************************************** -bool ModuleBase_ModelWidget::processEnter() -{ - return false; -} +bool ModuleBase_ModelWidget::processEnter() { return false; } //************************************************************** -bool ModuleBase_ModelWidget::processEscape() -{ - return false; -} +bool ModuleBase_ModelWidget::processEscape() { return false; } //************************************************************** -bool ModuleBase_ModelWidget::processDelete() -{ +bool ModuleBase_ModelWidget::processDelete() { // we consider that model objects eats delete key in order to // do nothing by for example symbol delete in line edit or spin box return true; } //************************************************************** -bool ModuleBase_ModelWidget::processSelection() -{ - return false; -} +bool ModuleBase_ModelWidget::processSelection() { return false; } //************************************************************** -bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) -{ - QWidget* aWidget = qobject_cast(theObject); +bool ModuleBase_ModelWidget::eventFilter(QObject *theObject, QEvent *theEvent) { + QWidget *aWidget = qobject_cast(theObject); if (theEvent->type() == QEvent::FocusIn) { - QFocusEvent* aFocusEvent = dynamic_cast(theEvent); + QFocusEvent *aFocusEvent = dynamic_cast(theEvent); Qt::FocusReason aReason = aFocusEvent->reason(); - bool aMouseOrKey = aReason == Qt::MouseFocusReason || - /*aReason == Qt::TabFocusReason || - //aReason == Qt::BacktabFocusReason ||*/ - aReason == Qt::OtherFocusReason; // to process widget->setFocus() + bool aMouseOrKey = + aReason == Qt::MouseFocusReason || + /*aReason == Qt::TabFocusReason || + //aReason == Qt::BacktabFocusReason ||*/ + aReason == Qt::OtherFocusReason; // to process widget->setFocus() if (aMouseOrKey && getControls().contains(aWidget)) { - //if (getControls().contains(aWidget)) { + // if (getControls().contains(aWidget)) { emitFocusInWidget(); } - } - else if (theEvent->type() == QEvent::FocusOut) { - QFocusEvent* aFocusEvent = dynamic_cast(theEvent); + } else if (theEvent->type() == QEvent::FocusOut) { + QFocusEvent *aFocusEvent = dynamic_cast(theEvent); Qt::FocusReason aReason = aFocusEvent->reason(); - bool aMouseOrKey = aReason == Qt::MouseFocusReason || - aReason == Qt::TabFocusReason || - aReason == Qt::BacktabFocusReason || - aReason == Qt::OtherFocusReason; // to process widget->setFocus() + bool aMouseOrKey = + aReason == Qt::MouseFocusReason || aReason == Qt::TabFocusReason || + aReason == Qt::BacktabFocusReason || + aReason == Qt::OtherFocusReason; // to process widget->setFocus() if (aMouseOrKey && getControls().contains(aWidget)) { if (getValueState() == ModifiedInPP) { storeValue(); @@ -553,34 +543,29 @@ bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) } //************************************************************** -void ModuleBase_ModelWidget::onWidgetValuesChanged() -{ - storeValue(); -} +void ModuleBase_ModelWidget::onWidgetValuesChanged() { storeValue(); } //************************************************************** -void ModuleBase_ModelWidget::onWidgetValuesModified() -{ +void ModuleBase_ModelWidget::onWidgetValuesModified() { setValueState(ModifiedInPP); } //************************************************************** -QString ModuleBase_ModelWidget::translate(const std::string& theStr) const -{ +QString ModuleBase_ModelWidget::translate(const std::string &theStr) const { return ModuleBase_Tools::translate(context(), theStr); } //************************************************************** -ModuleBase_ModelWidget* ModuleBase_ModelWidget::findModelWidget(ModuleBase_IPropertyPanel* theProp, - QWidget* theWidget) -{ - ModuleBase_ModelWidget* aModelWidget = 0; +ModuleBase_ModelWidget * +ModuleBase_ModelWidget::findModelWidget(ModuleBase_IPropertyPanel *theProp, + QWidget *theWidget) { + ModuleBase_ModelWidget *aModelWidget = 0; if (!theWidget) return aModelWidget; - QObject* aParent = theWidget->parent(); + QObject *aParent = theWidget->parent(); while (aParent) { - aModelWidget = qobject_cast(aParent); + aModelWidget = qobject_cast(aParent); if (aModelWidget) break; aParent = aParent->parent(); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 31a0ba737..7473f2132 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_MODELWIDGET_H #define MODULEBASE_MODELWIDGET_H +#include #include +#include +#include #include #include #include -#include -#include -#include #include @@ -35,7 +36,7 @@ #include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif class Config_WidgetAPI; @@ -48,40 +49,45 @@ class QKeyEvent; /**\class ModuleBase_ModelWidget * \ingroup GUI - * \brief An abstract custom widget class. This class realization is assumed + * \brief An abstract custom widget class. This class realization is assumed * to create some controls. * The controls values modification should send signal about values change. * * Common interface for widgets in the property panel. - * Every widget are able to save/restore data from the model and/or to contain other widgets. + * Every widget are able to save/restore data from the model and/or to contain + * other widgets. * */ -class MODULEBASE_EXPORT ModuleBase_ModelWidget : public QWidget -{ -Q_OBJECT - public: - /// State of the widget - enum ValueState { Stored, /// modification is finished and applyed to the model - ModifiedInPP, /// modification has not been finished and set to the model yet - ModifiedInViewer, /// modification performed by viewer events - Reset }; /// the value is reset - - enum EnableState { On, /// the widget value is always enabled - Off, /// the widget value is always disabled - /// the widget value enable state is defined in preferences - DefinedInPreferences }; +class MODULEBASE_EXPORT ModuleBase_ModelWidget : public QWidget { + Q_OBJECT +public: + /// State of the widget + enum ValueState { + Stored, /// modification is finished and applyed to the model + ModifiedInPP, /// modification has not been finished and set to the model + /// yet + ModifiedInViewer, /// modification performed by viewer events + Reset + }; /// the value is reset + + enum EnableState { + On, /// the widget value is always enabled + Off, /// the widget value is always disabled + /// the widget value enable state is defined in preferences + DefinedInPreferences + }; /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - /// a low-level API for reading xml definitions of widgets - ModuleBase_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from a low-level API for reading xml definitions of widgets + ModuleBase_ModelWidget(QWidget *theParent, const Config_WidgetAPI *theData); /// Destructor virtual ~ModuleBase_ModelWidget(); - /// Fills the widget with default values. It calls the resetCustom method and change - /// the widget state to Reset if the reset is performed. - /// \return true if the widget current value is reset + /// Fills the widget with default values. It calls the resetCustom method and + /// change the widget state to Reset if the reset is performed. \return true + /// if the widget current value is reset bool reset(); /// Returns the state whether the attribute of the feature is initialized @@ -90,23 +96,23 @@ Q_OBJECT bool isInitialized(ObjectPtr theObject) const; /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param [out] theModes a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param [out] theModes a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Appends into container of workshop selection filters - /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes - /// \param [out] theSelectionFilters selection filters - virtual void selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters); + /// \param [out] theModuleSelectionFilters module additional modes, -1 means + /// all default modes \param [out] theSelectionFilters selection filters + virtual void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters); /// Returns true, if default value of the widget should be computed - /// on operation's execute, like radius for circle's constraint (can not be zero) + /// on operation's execute, like radius for circle's constraint (can not be + /// zero) bool isComputedDefault() const { return myIsComputedDefault; } - /// Returns true, if default value of the widget is defined in the XML and it is not the - /// computed value - /// \return the boolean result + /// Returns true, if default value of the widget is defined in the XML and it + /// is not the computed value \return the boolean result std::string getDefaultValue() const { return myDefaultValue; } /// Returns true, if widget is internal @@ -118,10 +124,10 @@ Q_OBJECT /// \return the boolean result bool isObligatory() const { return myIsObligatory; } - /// Returns true, if the widget value is enabled and might be modified manualy. - /// It returns false if the application preferences allow having disabled value - /// and the internal state tells to disable - /// \return the boolean result + /// Returns true, if the widget value is enabled and might be modified + /// manualy. It returns false if the application preferences allow having + /// disabled value and the internal state tells to disable \return the boolean + /// result virtual bool isValueEnabled() const; /// Returns this parameter value in the xml file @@ -150,42 +156,47 @@ Q_OBJECT /// By default it returns true virtual bool canAcceptFocus() const { return true; }; - //! Returns the widget error, get it from the attribute validator and state of the widget - //! If the feature is correct, it returns an empty value - //! \param theValueStateChecked the boolean flag if the state of the widget should be checked - //! \return string value + //! Returns the widget error, get it from the attribute validator and state of + //! the widget If the feature is correct, it returns an empty value \param + //! theValueStateChecked the boolean flag if the state of the widget should be + //! checked \return string value virtual QString getError(const bool theValueStateChecked = true) const; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values - /// \param theToValidate the boolean value whether the value should be checked by filters - virtual bool setSelection(QList>& theValues, - const bool theToValidate) - { + /// \param theToValidate the boolean value whether the value should be checked + /// by filters + virtual bool + setSelection(QList> &theValues, + const bool theToValidate) { return false; } /// Returns values which should be highlighted when the whidget is active /// \param theValues a list of presentations - virtual void getHighlighted(QList>& theValues) {}; + virtual void + getHighlighted(QList> &theValues){}; /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& theValue) - { return true; } + virtual bool isValidSelectionCustom( + const std::shared_ptr &theValue) { + return true; + } - /// Returns widget validator, by default it is NULL. To be created in a child if necessary - ModuleBase_WidgetValidator* widgetValidator() { return myWidgetValidator; } + /// Returns widget validator, by default it is NULL. To be created in a child + /// if necessary + ModuleBase_WidgetValidator *widgetValidator() { return myWidgetValidator; } /// Restore value from attribute data to the widget's control. /// Emits signals before and after store /// \return True in success bool restoreValue(); - /// Saves the internal parameters to the given feature. Emits signals before and after store - /// \return True in success + /// Saves the internal parameters to the given feature. Emits signals before + /// and after store \return True in success bool storeValue(); /// Set focus to the first control of the current widget. @@ -194,7 +205,8 @@ Q_OBJECT /// \return the state whether the widget can accept the focus virtual bool focusTo(); - /// Select the internal content if it can be selected. It is empty in the default realization + /// Select the internal content if it can be selected. It is empty in the + /// default realization virtual void selectContent() {} /// The method called when widget is activated @@ -203,9 +215,11 @@ Q_OBJECT /// The method called when widget is deactivated virtual void deactivate(); - /// Opportunity to do something after the active widget of the property panel changed + /// Opportunity to do something after the active widget of the property panel + /// changed virtual void updateAfterDeactivation() {} - /// Opportunity to do something after the active widget of the property panel changed + /// Opportunity to do something after the active widget of the property panel + /// changed virtual void updateAfterActivation() {} /// The method called if widget should be activated always @@ -213,15 +227,15 @@ Q_OBJECT /// Returns list of widget controls /// \return a control list - virtual QList getControls() const = 0; + virtual QList getControls() const = 0; /// Returns the first or the last control that can accept the focus /// \param isFirst if true, the first controls is returned or the last one /// \return a control from a list of controls - QWidget* getControlAcceptingFocus(const bool isFirst); + QWidget *getControlAcceptingFocus(const bool isFirst); /// FocusIn events processing - virtual bool eventFilter(QObject* theObject, QEvent *theEvent); + virtual bool eventFilter(QObject *theObject, QEvent *theEvent); /// \brief Enables processing of focus event on all controls by the widget /// if this widget is not obligatory and set no-focus policy otherwise @@ -232,22 +246,16 @@ Q_OBJECT /// Returns the attribute name /// \returns the string value - std::string attributeID() const - { - return myAttributeID; - } + std::string attributeID() const { return myAttributeID; } /// \return Current feature - FeaturePtr feature() const - { - return myFeature; - } + FeaturePtr feature() const { return myFeature; } /// \return Context for translation virtual std::string context() const { bool isAppendAttr = true; std::string aContext = myFeatureId; - if(!aContext.empty() && !myAttributeID.empty()) { + if (!aContext.empty() && !myAttributeID.empty()) { // workaround for ModelAPI_Filter's attributes: // do not keep attribute name, because it may be changed // if the same filter is selected twice or more. @@ -264,37 +272,45 @@ Q_OBJECT /// Set feature which is processing by active operation /// \param theFeature a feature object - /// \param theToStoreValue a value about necessity to store the widget value to the feature - /// \param isUpdateFlushed a flag if update should be flushed on store value - virtual void setFeature(const FeaturePtr& theFeature, const bool theToStoreValue = false, + /// \param theToStoreValue a value about necessity to store the widget value + /// to the feature \param isUpdateFlushed a flag if update should be flushed + /// on store value + virtual void setFeature(const FeaturePtr &theFeature, + const bool theToStoreValue = false, const bool isUpdateFlushed = true); - /// Editing mode depends on mode of current operation. This value is defined by it. + /// Editing mode depends on mode of current operation. This value is defined + /// by it. virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; } /// \return Current Editing mode bool isEditingMode() const { return myIsEditing; } - /// Returns true if the action can be processed. By default it is empty and returns false. - /// \param theActionType an action type - /// \param isActionEnabled if true, the enable state of the action - virtual bool canProcessAction(ModuleBase_ActionType theActionType, bool& isActionEnabled); + /// Returns true if the action can be processed. By default it is empty and + /// returns false. \param theActionType an action type \param isActionEnabled + /// if true, the enable state of the action + virtual bool canProcessAction(ModuleBase_ActionType theActionType, + bool &isActionEnabled); - /// Returns true if the event is processed. The default implementation is empty, returns false. + /// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processAction(ModuleBase_ActionType theActionType, - const ActionParamPtr& theParam = ActionParamPtr()); - - /// Returns list of accessible actions for Undo/Redo commands. By default it returns empty list. - /// \param theActionType type of action. It can be ActionUndo or ActionRedo. - virtual QList actionsList(ModuleBase_ActionType theActionType) const - { return QList(); } + const ActionParamPtr &theParam = ActionParamPtr()); + + /// Returns list of accessible actions for Undo/Redo commands. By default it + /// returns empty list. \param theActionType type of action. It can be + /// ActionUndo or ActionRedo. + virtual QList + actionsList(ModuleBase_ActionType theActionType) const { + return QList(); + } /// Sends Update and Redisplay for the given object /// \param theObj is updating object void updateObject(ObjectPtr theObj); /// Translate passed string with widget context() - virtual QString translate(const std::string& theStr) const; + virtual QString translate(const std::string &theStr) const; /// Emit focus in widget to set this control as active in propety panel void emitFocusInWidget() { emit focusInWidget(this); } @@ -303,22 +319,23 @@ Q_OBJECT /// \param theWidget a candidate to be a child of the model widget /// \param theProp a property panel instance /// \return a model widget or NULL - static ModuleBase_ModelWidget* findModelWidget(ModuleBase_IPropertyPanel* theProp, - QWidget* theWidget); + static ModuleBase_ModelWidget * + findModelWidget(ModuleBase_IPropertyPanel *theProp, QWidget *theWidget); /// Returns True if the widget uses feature attribute. /// If not then it means that the widget do not need attribute at all. virtual bool usesAttribute() const { return true; } - /// It is called when user press Ok or OkPlus buttons in the parent property panel - /// By default this slot does nothing + /// It is called when user press Ok or OkPlus buttons in the parent property + /// panel By default this slot does nothing virtual void onFeatureAccepted() {} - /// Returns True in case if the widget contains useful information for inspection tool + /// Returns True in case if the widget contains useful information for + /// inspection tool virtual bool isInformative() const { return true; } - /// If widgets has several panels then this method has to show a page which contains information - /// for current feature. By default does nothing + /// If widgets has several panels then this method has to show a page which + /// contains information for current feature. By default does nothing virtual void showInformativePage() {} /// Returns True if data of its attribute was modified @@ -346,22 +363,22 @@ signals: /// The signal about widget values are to be restored void afterValuesRestored(); - /// The signal about key release on the control, that corresponds to the attribute - /// \param theObject a sender of the event - /// \param theEvent key release event - void keyReleased(QObject* theObject, QKeyEvent* theEvent); + /// The signal about key release on the control, that corresponds to the + /// attribute \param theObject a sender of the event \param theEvent key + /// release event + void keyReleased(QObject *theObject, QKeyEvent *theEvent); /// The signal is emitted if the enter is clicked in the control of the widget /// \param theObject a sender of the event - void enterClicked(QObject* theObject); + void enterClicked(QObject *theObject); /// The signal about the widget is get focus /// \param theWidget the model base widget - void focusInWidget(ModuleBase_ModelWidget* theWidget); + void focusInWidget(ModuleBase_ModelWidget *theWidget); /// The signal about the widget is lost focus /// \param theWidget the model base widget - void focusOutWidget(ModuleBase_ModelWidget* theWidget); + void focusOutWidget(ModuleBase_ModelWidget *theWidget); /// The signal about value state modification void valueStateChanged(int theState); @@ -372,19 +389,18 @@ signals: protected: /// Sets default value of widget. Normally, widget should fetch this value /// from the xml. However, some widgets derived widgets could define it - void setDefaultValue(const std::string& theValue); + void setDefaultValue(const std::string &theValue); /// \brief Set the attribute name /// \param theAttribute the string value with attribute name - void setAttributeID(const std::string& theAttribute) - { + void setAttributeID(const std::string &theAttribute) { myAttributeID = theAttribute; } - /// Sets the current value state. If the value is changed, the signal is emitted - /// If the current value state is Blocked, this method do nothing + /// Sets the current value state. If the value is changed, the signal is + /// emitted If the current value state is Blocked, this method do nothing /// \param theState a new state /// \return the previous value state - ValueState setValueState(const ValueState& theState); + ValueState setValueState(const ValueState &theState); /// Blocks the value state change. /// \param theBlocked a block state @@ -407,30 +423,35 @@ protected: virtual bool resetCustom() { return false; }; /// The method called when widget is activated - virtual void activateCustom() {}; + virtual void activateCustom(){}; - //// Returns true if the event is processed. The default implementation is empty, returns false. + //// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processEnter(); - //// Returns true if the event is processed. The default implementation is empty, returns false. + //// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processEscape(); - //// Returns true if the event is processed. The default implementation is empty, returns false. + //// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processDelete(); - /// Returns true if envent is processed. It applyes workshop selection for the widget attribute. + /// Returns true if envent is processed. It applyes workshop selection for the + /// widget attribute. virtual bool processSelection(); - protected slots: - /// Processing of values changed in model widget by store the current value to the feature +protected slots: + /// Processing of values changed in model widget by store the current value to + /// the feature void onWidgetValuesChanged(); /// Changes widget state. void onWidgetValuesModified(); - protected: - /// own validator, by default it is zero - ModuleBase_WidgetValidator* myWidgetValidator; +protected: + /// own validator, by default it is zero + ModuleBase_WidgetValidator *myWidgetValidator; /// The attribute name of the model feature std::string myAttributeID; @@ -442,7 +463,8 @@ protected: std::string myFeatureId; /// Flag which shows whether current widget is obligatory - /// The non-obligatory widgets should not accept the focus in the property panel + /// The non-obligatory widgets should not accept the focus in the property + /// panel bool myIsObligatory; /// Flag about value of the control is enabled (can be modified) @@ -455,7 +477,8 @@ private: /// Flag which shows that current operation is in editing mode bool myIsEditing; - /// Value should be computed on execute, like radius for circle's constraint (can not be zero) + /// Value should be computed on execute, like radius for circle's constraint + /// (can not be zero) bool myIsComputedDefault; /// the default value, which is defined in the XML for this attribute @@ -464,10 +487,12 @@ private: /// an XML internal state bool myIsInternal; - // an XML state, the value is not stored into model if the widget is in edit mode + // an XML state, the value is not stored into model if the widget is in edit + // mode std::string myIsModifiedInEdit; - /// the reset state. If it is false, the reset method of the widget is not performed + /// the reset state. If it is false, the reset method of the widget is not + /// performed bool myUseReset; /// blocked flag of modification of the value state bool myIsValueStateBlocked; @@ -476,7 +501,8 @@ private: bool myUpdateVisualAttributes; - /// A flag which indicates that current widget should have access to external parts + /// A flag which indicates that current widget should have access to external + /// parts bool myUseExternalParts; }; diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 067bf008a..a4de781c8 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -14,34 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_Operation.h" -#include "ModuleBase_OperationDescription.h" -#include "ModuleBase_ModelWidget.h" -#include "ModuleBase_ViewerPrs.h" #include "ModuleBase_IPropertyPanel.h" #include "ModuleBase_ISelection.h" #include "ModuleBase_IViewer.h" +#include "ModuleBase_ModelWidget.h" +#include "ModuleBase_OperationDescription.h" +#include "ModuleBase_ViewerPrs.h" #include -#include -#include #include #include #include -#include +#include #include -#include +#include #include +#include #include -#include -#include #include +#include +#include #include @@ -49,47 +49,32 @@ #include #endif -ModuleBase_Operation::ModuleBase_Operation(const QString& theId, QObject* theParent) - : QObject(theParent), - myIsModified(false), - myPropertyPanel(NULL), - myHideFacesVisibilityState(false) -{ +ModuleBase_Operation::ModuleBase_Operation(const QString &theId, + QObject *theParent) + : QObject(theParent), myIsModified(false), myPropertyPanel(NULL), + myHideFacesVisibilityState(false) { myDescription = new ModuleBase_OperationDescription(theId); } -ModuleBase_Operation::~ModuleBase_Operation() -{ - delete myDescription; -} +ModuleBase_Operation::~ModuleBase_Operation() { delete myDescription; } -const QStringList& ModuleBase_Operation::grantedOperationIds() const -{ +const QStringList &ModuleBase_Operation::grantedOperationIds() const { return myGrantedIds; } -void ModuleBase_Operation::setGrantedOperationIds(const QStringList& theList) -{ +void ModuleBase_Operation::setGrantedOperationIds(const QStringList &theList) { myGrantedIds = theList; } -QString ModuleBase_Operation::id() const -{ +QString ModuleBase_Operation::id() const { return getDescription()->operationId(); } -bool ModuleBase_Operation::isValid() const -{ - return true; -} +bool ModuleBase_Operation::isValid() const { return true; } -bool ModuleBase_Operation::canBeCommitted() const -{ - return isValid(); -} +bool ModuleBase_Operation::canBeCommitted() const { return isValid(); } -bool ModuleBase_Operation::start() -{ +bool ModuleBase_Operation::start() { myIsModified = false; ModelAPI_Session::get()->startOperation(id().toStdString()); @@ -100,42 +85,40 @@ bool ModuleBase_Operation::start() return true; } -void ModuleBase_Operation::postpone() -{ +void ModuleBase_Operation::postpone() { postponeOperation(); emit postponed(); } -void ModuleBase_Operation::resume() -{ +void ModuleBase_Operation::resume() { resumeOperation(); emit resumed(); } -void ModuleBase_Operation::abort() -{ - // the viewer update should be blocked in order to avoid the features blinking before they are - // hidden - //std::shared_ptr aMsg = std::shared_ptr( - // new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); - //Events_Loop::loop()->send(aMsg); +void ModuleBase_Operation::abort() { + // the viewer update should be blocked in order to avoid the features blinking + // before they are hidden + // std::shared_ptr aMsg = std::shared_ptr( + // new + // Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); + // Events_Loop::loop()->send(aMsg); ModelAPI_Session::get()->abortOperation(); emit stopped(); - // the viewer update should be unblocked in order to avoid the features blinking before they are - // hidden - //aMsg = std::shared_ptr( - // new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); - //Events_Loop::loop()->send(aMsg); + // the viewer update should be unblocked in order to avoid the features + // blinking before they are hidden + // aMsg = std::shared_ptr( + // new + // Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); + // Events_Loop::loop()->send(aMsg); emit aborted(); } -bool ModuleBase_Operation::commit() -{ +bool ModuleBase_Operation::commit() { if (canBeCommitted()) { - ModuleBase_IPropertyPanel* aPanel = propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = propertyPanel(); if (aPanel) aPanel->onAcceptData(); @@ -154,15 +137,11 @@ bool ModuleBase_Operation::commit() return false; } -void ModuleBase_Operation::onValuesChanged() -{ - myIsModified = true; -} +void ModuleBase_Operation::onValuesChanged() { myIsModified = true; } -void ModuleBase_Operation::onValueStateChanged(int /*thePreviousState*/) -{ +void ModuleBase_Operation::onValueStateChanged(int /*thePreviousState*/) { if (propertyPanel()) { - ModuleBase_ModelWidget* aWidget = propertyPanel()->activeWidget(); + ModuleBase_ModelWidget *aWidget = propertyPanel()->activeWidget(); if (aWidget) { if (aWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) myIsModified = true; @@ -170,26 +149,25 @@ void ModuleBase_Operation::onValueStateChanged(int /*thePreviousState*/) } } -void ModuleBase_Operation::setPropertyPanel(ModuleBase_IPropertyPanel* theProp) -{ +void ModuleBase_Operation::setPropertyPanel( + ModuleBase_IPropertyPanel *theProp) { myPropertyPanel = theProp; } -bool ModuleBase_Operation::isGranted(QString theId) const -{ +bool ModuleBase_Operation::isGranted(QString theId) const { return myGrantedIds.contains(theId); } -bool ModuleBase_Operation::isModified() const -{ +bool ModuleBase_Operation::isModified() const { if (myDescription->hasXmlRepresentation()) { - Config_WidgetAPI aWidgetApi(myDescription->xmlRepresentation().toStdString()); + Config_WidgetAPI aWidgetApi( + myDescription->xmlRepresentation().toStdString()); if (!aWidgetApi.getBooleanAttribute(ABORT_CONFIRMATION, true)) return false; } - //if (myPropertyPanel) - // return myPropertyPanel->isModified(); - //return false; - // Most of operation causes creation of a feature + // if (myPropertyPanel) + // return myPropertyPanel->isModified(); + // return false; + // Most of operation causes creation of a feature return true; } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 46839253c..bc088e881 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Operation_H @@ -37,46 +38,47 @@ class QKeyEvent; * \ingroup GUI * \brief Base class for all operations * - * Base class for all operations. If you perform an action it is reasonable to create - * operation intended for this. This is a base class for all operations which provides - * mechanism for correct starting operations, starting operations above already started - * ones, committing operations and so on. To create own operation it is reasonable to - * inherit it from this class and redefines virtual methods to provide own behavior - * Main virtual methods are + * Base class for all operations. If you perform an action it is reasonable to + * create operation intended for this. This is a base class for all operations + * which provides mechanism for correct starting operations, starting operations + * above already started ones, committing operations and so on. To create own + * operation it is reasonable to inherit it from this class and redefines + * virtual methods to provide own behavior Main virtual methods are * - virtual bool isReadyToStart(); * - virtual void startOperation(); * - virtual void abortOperation(); * - virtual void commitOperation(); */ -class MODULEBASE_EXPORT ModuleBase_Operation : public QObject -{ -Q_OBJECT +class MODULEBASE_EXPORT ModuleBase_Operation : public QObject { + Q_OBJECT - public: +public: /// Constructor /// \param theId the operation identifier /// \param theParent the QObject parent - ModuleBase_Operation(const QString& theId = "", QObject* theParent = 0); + ModuleBase_Operation(const QString &theId = "", QObject *theParent = 0); /// Destructor virtual ~ModuleBase_Operation(); /// Returns the operation description /// /returns the instance of the description class - ModuleBase_OperationDescription* getDescription() const { return myDescription; } + ModuleBase_OperationDescription *getDescription() const { + return myDescription; + } /// Returns list of granted operation indices - const QStringList& grantedOperationIds() const; + const QStringList &grantedOperationIds() const; - /// Sets list of operation indices, which can be started without the current operation stop - /// \param theList an ids - void setGrantedOperationIds(const QStringList& theList); + /// Sets list of operation indices, which can be started without the current + /// operation stop \param theList an ids + void setGrantedOperationIds(const QStringList &theList); - /// Must return true if this operation can be launched as nested for any current operation - /// and it is not necessary to check this operation on validity. By default - /// the operation is not granted. - /// The method has to be redefined for granted operations. + /// Must return true if this operation can be launched as nested for any + /// current operation and it is not necessary to check this operation on + /// validity. By default the operation is not granted. The method has to be + /// redefined for granted operations. virtual bool isGranted(QString theId) const; /// Returns True if data of its feature was modified during operation @@ -91,18 +93,18 @@ Q_OBJECT /// \brief Set property pane to the operation /// \param theProp a property panel instance - virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp); + virtual void setPropertyPanel(ModuleBase_IPropertyPanel *theProp); /// \return Currently installed property panel - ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; } + ModuleBase_IPropertyPanel *propertyPanel() const { return myPropertyPanel; } QString helpFileName() const { return myHelpFileName; } - void setHelpFileName(QString theName) { - myHelpFileName = theName; - } + void setHelpFileName(QString theName) { myHelpFileName = theName; } - void setHideFacesVisible(bool isVisible) { myHideFacesVisibilityState = isVisible; } + void setHideFacesVisible(bool isVisible) { + myHideFacesVisibilityState = isVisible; + } bool isHideFacesVisible() const { return myHideFacesVisibilityState; } @@ -131,48 +133,52 @@ signals: /// The operation is postponed void postponed(); - public slots: +public slots: /// Starts operation - /// Public slot. Verifies whether operation can be started and starts operation. - /// This slot is not virtual and cannot be redefined. Redefine startOperation method - /// to change behavior of operation. There is no point in using this method. It would - /// be better to inherit own operator from base one and redefine startOperation method - /// instead. - /// \return true if the start is successful + /// Public slot. Verifies whether operation can be started and starts + /// operation. This slot is not virtual and cannot be redefined. Redefine + /// startOperation method to change behavior of operation. There is no point + /// in using this method. It would be better to inherit own operator from base + /// one and redefine startOperation method instead. \return true if the start + /// is successful virtual bool start(); /// Deactivates current operation which can be resumed later. virtual void postpone(); /// Resumes operation - /// Public slot. Verifies whether operation can be started and starts operation. - /// This slot is not virtual and cannot be redefined. Redefine startOperation method - /// to change behavior of operation. There is no point in using this method. It would - /// be better to inherit own operator from base one and redefine startOperation method - /// instead. + /// Public slot. Verifies whether operation can be started and starts + /// operation. This slot is not virtual and cannot be redefined. Redefine + /// startOperation method to change behavior of operation. There is no point + /// in using this method. It would be better to inherit own operator from base + /// one and redefine startOperation method instead. virtual void resume(); /// Aborts operation - /// Public slot. Aborts operation. This slot is not virtual and cannot be redefined. - /// Redefine abortOperation method to change behavior of operation instead + /// Public slot. Aborts operation. This slot is not virtual and cannot be + /// redefined. Redefine abortOperation method to change behavior of operation + /// instead virtual void abort(); /// Commits operation - /// Public slot. Commits operation. This slot is not virtual and cannot be redefined. - /// Redefine commitOperation method to change behavior of operation instead + /// Public slot. Commits operation. This slot is not virtual and cannot be + /// redefined. Redefine commitOperation method to change behavior of operation + /// instead virtual bool commit(); /// Changes the modified flag of the operation void onValuesChanged(); - /// Changes the modified flag of the operation if the current state of the widget is modified - /// \param thePreviousState the previous vlaue state of the widget + /// Changes the modified flag of the operation if the current state of the + /// widget is modified \param thePreviousState the previous vlaue state of the + /// widget void onValueStateChanged(int thePreviousState); - protected: - /// Virtual method called when operation started (see start() method for more description) - /// Default impl calls corresponding slot and commits immediately. - virtual void startOperation() {} +protected: + /// Virtual method called when operation started (see start() method for more + /// description) Default impl calls corresponding slot and commits + /// immediately. + virtual void startOperation() {} /// Implementation of specific steps on postpone operation virtual void postponeOperation() {} @@ -180,25 +186,30 @@ signals: /// Virtual method called when operation stopped - committed or aborted. virtual void stopOperation() {} - /// Virtual method called when operation aborted (see abort() method for more description) + /// Virtual method called when operation aborted (see abort() method for more + /// description) virtual void abortOperation() {} - /// Virtual method called when operation committed (see commit() method for more description) - virtual void commitOperation() {}; + /// Virtual method called when operation committed (see commit() method for + /// more description) + virtual void commitOperation(){}; - /// Virtual method called after operation committed (see commit() method for more description) + /// Virtual method called after operation committed (see commit() method for + /// more description) virtual void afterCommitOperation() {} - /// Virtual method called after operation resume (see resume() method for more description) + /// Virtual method called after operation resume (see resume() method for more + /// description) virtual void resumeOperation() {} /// Verifies whether this operator can be commited. - /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled + /// \return Returns TRUE if current operation can be committed, e.g. all + /// parameters are filled virtual bool canBeCommitted() const; private: /// the container to have the operation description - ModuleBase_OperationDescription* myDescription; + ModuleBase_OperationDescription *myDescription; /// Modified feature flag bool myIsModified; @@ -207,7 +218,7 @@ private: QStringList myGrantedIds; /// Access to property panel - ModuleBase_IPropertyPanel* myPropertyPanel; + ModuleBase_IPropertyPanel *myPropertyPanel; QString myHelpFileName; diff --git a/src/ModuleBase/ModuleBase_OperationDescription.cpp b/src/ModuleBase/ModuleBase_OperationDescription.cpp index 15de644bf..3497a24b2 100644 --- a/src/ModuleBase/ModuleBase_OperationDescription.cpp +++ b/src/ModuleBase/ModuleBase_OperationDescription.cpp @@ -14,62 +14,56 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -ModuleBase_OperationDescription::ModuleBase_OperationDescription(const QString& theId) - : myOperationId(theId) -{ -} +ModuleBase_OperationDescription::ModuleBase_OperationDescription( + const QString &theId) + : myOperationId(theId) {} -ModuleBase_OperationDescription::~ModuleBase_OperationDescription() -{ -} +ModuleBase_OperationDescription::~ModuleBase_OperationDescription() {} -const QString& ModuleBase_OperationDescription::operationId() const -{ +const QString &ModuleBase_OperationDescription::operationId() const { return myOperationId; } -const QString& ModuleBase_OperationDescription::description() const -{ +const QString &ModuleBase_OperationDescription::description() const { return myDescription; } -void ModuleBase_OperationDescription::setDescription(const QString& theDescription) -{ +void ModuleBase_OperationDescription::setDescription( + const QString &theDescription) { myDescription = theDescription; } -/*void ModuleBase_OperationDescription::setModelWidgets(const std::string& theXmlRepresentation, - const QList& theWidgets) +/*void ModuleBase_OperationDescription::setModelWidgets(const std::string& + theXmlRepresentation, const QList& theWidgets) { myWidgets.clear(); - QList::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end(); - for (; anIt != aLast; anIt++) - myWidgets.push_back(*anIt); + QList::const_iterator anIt = theWidgets.begin(), aLast + = theWidgets.end(); for (; anIt != aLast; anIt++) myWidgets.push_back(*anIt); myXmlRepresentation = theXmlRepresentation; }*/ -/*const QList& ModuleBase_OperationDescription::modelWidgets() const +/*const QList& + ModuleBase_OperationDescription::modelWidgets() const { return myWidgets; }*/ -const QString& ModuleBase_OperationDescription::xmlRepresentation() const -{ +const QString &ModuleBase_OperationDescription::xmlRepresentation() const { return myXmlRepresentation; } -void ModuleBase_OperationDescription::setXmlRepresentation(const QString& theXMLRepresentation) -{ +void ModuleBase_OperationDescription::setXmlRepresentation( + const QString &theXMLRepresentation) { myXmlRepresentation = theXMLRepresentation; } -bool ModuleBase_OperationDescription::hasXmlRepresentation() const -{ - return /*!myWidgets.empty() || */!myXmlRepresentation.isEmpty(); +bool ModuleBase_OperationDescription::hasXmlRepresentation() const { + return /*!myWidgets.empty() || */ !myXmlRepresentation.isEmpty(); } diff --git a/src/ModuleBase/ModuleBase_OperationDescription.h b/src/ModuleBase/ModuleBase_OperationDescription.h index 7bde30c6a..71c745f2e 100644 --- a/src/ModuleBase/ModuleBase_OperationDescription.h +++ b/src/ModuleBase/ModuleBase_OperationDescription.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_OPERATIONDESCRIPTION_H @@ -23,55 +24,54 @@ #include #include +#include #include #include -#include #include -//class ModuleBase_ModelWidget; +// class ModuleBase_ModelWidget; /*! * \class ModuleBase_OperationDescription * \ingroup GUI * Description of operation from XML */ -class MODULEBASE_EXPORT ModuleBase_OperationDescription -{ - public: +class MODULEBASE_EXPORT ModuleBase_OperationDescription { +public: /// Constructor /// \param theId - the operation identifier - ModuleBase_OperationDescription(const QString& theId = ""); + ModuleBase_OperationDescription(const QString &theId = ""); /// Destructor virtual ~ModuleBase_OperationDescription(); /// Unique name of the operation /// \return string name of the operation. - const QString& operationId() const; + const QString &operationId() const; /// Returns a short description of operation (will be /// inserted in title of property panel) - const QString& description() const; + const QString &description() const; /// Sets a short description of operation (will be /// inserted in title of property panel) - void setDescription(const QString& theDescription); + void setDescription(const QString &theDescription); /// Returns XML representation of the operation's widget. /// \return XML QString - const QString& xmlRepresentation() const; + const QString &xmlRepresentation() const; /// Sets XML representation of the operation's widget. /// \param theXMLRepresentation - XML QString - void setXmlRepresentation(const QString& theXMLRepresentation); + void setXmlRepresentation(const QString &theXMLRepresentation); /// Returns true if there are no model widgets /// \return the boolean value bool hasXmlRepresentation() const; - private: +private: //!< Next fields could be extracted into a subclass; - /// the operation identifier + /// the operation identifier QString myOperationId; /// the short description of the opertaion @@ -81,4 +81,4 @@ class MODULEBASE_EXPORT ModuleBase_OperationDescription QString myXmlRepresentation; }; -#endif //ModuleBase_OperationDescription_H +#endif // ModuleBase_OperationDescription_H diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 108f1df1e..3abd14c52 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -14,30 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_OperationFeature.h" -#include "ModuleBase_OperationDescription.h" -#include "ModuleBase_ModelWidget.h" -#include "ModuleBase_ViewerPrs.h" #include "ModuleBase_IPropertyPanel.h" #include "ModuleBase_ISelection.h" #include "ModuleBase_IViewer.h" +#include "ModuleBase_ModelWidget.h" +#include "ModuleBase_OperationDescription.h" #include "ModuleBase_Tools.h" +#include "ModuleBase_ViewerPrs.h" #include -#include -#include #include #include #include -#include +#include #include -#include +#include #include #include +#include #include @@ -46,7 +46,8 @@ #include // the define to check the activated object as a sub-feature by argument of -// the operation feature. E.g. rectangle feature(operation), line(in argument) to be not activated +// the operation feature. E.g. rectangle feature(operation), line(in argument) +// to be not activated #define DEBUG_DO_NOT_ACTIVATE_SUB_FEATURE #ifdef DEBUG_DO_NOT_ACTIVATE_SUB_FEATURE #include @@ -58,28 +59,26 @@ #include #endif -ModuleBase_OperationFeature::ModuleBase_OperationFeature(const QString& theId, QObject* theParent) -: ModuleBase_Operation(theId, theParent), myIsEditing(false), myNeedToBeAborted(false), -myRestartTransactionOnResume(false) -{ -} +ModuleBase_OperationFeature::ModuleBase_OperationFeature(const QString &theId, + QObject *theParent) + : ModuleBase_Operation(theId, theParent), myIsEditing(false), + myNeedToBeAborted(false), myRestartTransactionOnResume(false) {} -ModuleBase_OperationFeature::~ModuleBase_OperationFeature() -{ +ModuleBase_OperationFeature::~ModuleBase_OperationFeature() { clearPreselection(); } -void ModuleBase_OperationFeature::setEditOperation(const bool& isEditState - /*const bool theRestartTransaction*/) -{ +void ModuleBase_OperationFeature::setEditOperation( + const bool &isEditState + /*const bool theRestartTransaction*/) { bool isCurrentEditState = isEditOperation(); if (isCurrentEditState == isEditState) return; /* // this case is obsolete as it was not approved for reentrant sketch operation - // it was implemented when isEditState did not exist and only edit operation can be set - if (theRestartTransaction) { + // it was implemented when isEditState did not exist and only edit operation + can be set if (theRestartTransaction) { // finsh previous create operation emit beforeCommitted(); SessionPtr aMgr = ModelAPI_Session::get(); @@ -99,25 +98,20 @@ void ModuleBase_OperationFeature::setEditOperation(const bool& isEditState propertyPanel()->setEditingMode(isEditOperation()); } -FeaturePtr ModuleBase_OperationFeature::feature() const -{ - return myFeature; -} +FeaturePtr ModuleBase_OperationFeature::feature() const { return myFeature; } -bool ModuleBase_OperationFeature::isValid() const -{ +bool ModuleBase_OperationFeature::isValid() const { if (!myFeature || !myFeature->data()->isValid()) return true; // rename operation if (myFeature->isAction()) return true; std::string anError = ModelAPI_Tools::getFeatureError(myFeature); - //ModuleBase_Tools::translate(myFeature->getKind(), anError); + // ModuleBase_Tools::translate(myFeature->getKind(), anError); return anError.empty(); } -void ModuleBase_OperationFeature::startOperation() -{ +void ModuleBase_OperationFeature::startOperation() { FeaturePtr aFeature = feature(); if (!aFeature.get() || !isEditOperation()) return; @@ -141,11 +135,11 @@ void ModuleBase_OperationFeature::startOperation() myVisualizedObjects.insert(aFeature); aFeature->setDisplayed(true); } - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } -void ModuleBase_OperationFeature::stopOperation() -{ +void ModuleBase_OperationFeature::stopOperation() { FeaturePtr aFeature = feature(); if (!aFeature.get() || !isEditOperation()) return; @@ -156,7 +150,8 @@ void ModuleBase_OperationFeature::stopOperation() std::list::const_iterator aIt; for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { ObjectPtr anObject = *aIt; - if (anObject.get() && myVisualizedObjects.find(anObject) != myVisualizedObjects.end()) { + if (anObject.get() && + myVisualizedObjects.find(anObject) != myVisualizedObjects.end()) { anObject->setDisplayed(false); } } @@ -164,28 +159,29 @@ void ModuleBase_OperationFeature::stopOperation() aFeature->setDisplayed(false); } if (myVisualizedObjects.size() > 0) - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } -FeaturePtr ModuleBase_OperationFeature::createFeature(const bool theFlushMessage) -{ +FeaturePtr +ModuleBase_OperationFeature::createFeature(const bool theFlushMessage) { if (myParentFeature.get()) { - myFeature = myParentFeature->addFeature(getDescription()->operationId().toStdString()); + myFeature = myParentFeature->addFeature( + getDescription()->operationId().toStdString()); } else { - std::shared_ptr aDoc = ModelAPI_Session::get()->activeDocument(); + std::shared_ptr aDoc = + ModelAPI_Session::get()->activeDocument(); myFeature = aDoc->addFeature(getDescription()->operationId().toStdString()); } return myFeature; } -void ModuleBase_OperationFeature::setFeature(FeaturePtr theFeature) -{ +void ModuleBase_OperationFeature::setFeature(FeaturePtr theFeature) { myFeature = theFeature; myIsEditing = true; } -bool ModuleBase_OperationFeature::hasObject(ObjectPtr theObj) const -{ +bool ModuleBase_OperationFeature::hasObject(ObjectPtr theObj) const { FeaturePtr aFeature = feature(); if (aFeature) { if (aFeature == theObj) @@ -200,17 +196,19 @@ bool ModuleBase_OperationFeature::hasObject(ObjectPtr theObj) const // which also should be deactivated when the operation // is active, e.g. rectangle'lines. FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObj); - std::list anAttributes = aFeature->data()->attributes( - ModelAPI_AttributeRefList::typeId()); - std::list::const_iterator - anIt = anAttributes.begin(), aLast = anAttributes.end(); + std::list anAttributes = + aFeature->data()->attributes(ModelAPI_AttributeRefList::typeId()); + std::list::const_iterator anIt = anAttributes.begin(), + aLast = anAttributes.end(); bool aFoundObject = false; for (; anIt != aLast && !aFoundObject; anIt++) { std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(*anIt); - for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFoundObject; i++) { + std::dynamic_pointer_cast(*anIt); + for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFoundObject; + i++) { ObjectPtr aCurObj = aCurSelList->object(i); - FeaturePtr aCurFeat = std::dynamic_pointer_cast(aCurObj); + FeaturePtr aCurFeat = + std::dynamic_pointer_cast(aCurObj); if (aCurFeat.get()) { aFoundObject = anObjectFeature == aCurFeat; } @@ -223,13 +221,11 @@ bool ModuleBase_OperationFeature::hasObject(ObjectPtr theObj) const return false; } -bool ModuleBase_OperationFeature::isDisplayedOnStart(ObjectPtr theObject) -{ +bool ModuleBase_OperationFeature::isDisplayedOnStart(ObjectPtr theObject) { return myVisualizedObjects.find(theObject) != myVisualizedObjects.end(); } -bool ModuleBase_OperationFeature::start() -{ +bool ModuleBase_OperationFeature::start() { #ifdef DEBUG_OPERATION_START qDebug("ModuleBase_OperationFeature::start -- begin"); #endif @@ -246,17 +242,17 @@ bool ModuleBase_OperationFeature::start() FeaturePtr aFeature = createFeature(); // if the feature is not created, there is no sense to start the operation if (aFeature.get() == NULL) { - // it is necessary to abor the operation in the session and emit the aborted signal - // in order to update commands status in the workshop, to be exact the feature action - // to be unchecked + // it is necessary to abor the operation in the session and emit the + // aborted signal in order to update commands status in the workshop, to + // be exact the feature action to be unchecked abort(); #ifdef DEBUG_OPERATION_START - qDebug("ModuleBase_OperationFeature::start -- end : IMPOSSIBLE to start"); + qDebug("ModuleBase_OperationFeature::start -- end : IMPOSSIBLE to start"); #endif return false; } } - //Already called startOperation(); + // Already called startOperation(); emit started(); #ifdef DEBUG_OPERATION_START qDebug("ModuleBase_OperationFeature::start -- end"); @@ -264,32 +260,32 @@ bool ModuleBase_OperationFeature::start() return true; } -void ModuleBase_OperationFeature::abort() -{ +void ModuleBase_OperationFeature::abort() { #ifdef DEBUG_OPERATION_START qDebug("ModuleBase_OperationFeature::abort -- begin"); #endif emit beforeAborted(); - // the viewer update should be blocked in order to avoid the features blinking before they are - // hidden - std::shared_ptr aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); + // the viewer update should be blocked in order to avoid the features blinking + // before they are hidden + std::shared_ptr aMsg = + std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); Events_Loop::loop()->send(aMsg); - if (myFeature.get()) - { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); + if (myFeature.get()) { + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); } - // the widgets of property panel should not process any events come from data mode - // after abort clicked. Some signal such as redisplay/create influence on content - // of the object browser and viewer context. Therefore it influence to the current - // selection and if the active widget listens it, the attribute value is errnoneous - // changed. - ModuleBase_IPropertyPanel* aPropertyPanel = propertyPanel(); + // the widgets of property panel should not process any events come from data + // mode after abort clicked. Some signal such as redisplay/create influence on + // content of the object browser and viewer context. Therefore it influence to + // the current selection and if the active widget listens it, the attribute + // value is errnoneous changed. + ModuleBase_IPropertyPanel *aPropertyPanel = propertyPanel(); if (aPropertyPanel) aPropertyPanel->cleanContent(); @@ -302,10 +298,10 @@ void ModuleBase_OperationFeature::abort() SessionPtr aMgr = ModelAPI_Session::get(); aMgr->abortOperation(); emit stopped(); - // the viewer update should be unblocked in order to avoid the features blinking before they are - // hidden - aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); + // the viewer update should be unblocked in order to avoid the features + // blinking before they are hidden + aMsg = std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); Events_Loop::loop()->send(aMsg); @@ -315,27 +311,27 @@ void ModuleBase_OperationFeature::abort() #endif } -bool ModuleBase_OperationFeature::commit() -{ +bool ModuleBase_OperationFeature::commit() { #ifdef DEBUG_OPERATION_START qDebug("ModuleBase_OperationFeature::commit -- begin"); #endif - ModuleBase_IPropertyPanel* aPanel = propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = propertyPanel(); if (aPanel) { - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); - if (anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) { + ModuleBase_ModelWidget *anActiveWidget = aPanel->activeWidget(); + if (anActiveWidget && anActiveWidget->getValueState() == + ModuleBase_ModelWidget::ModifiedInPP) { anActiveWidget->storeValue(); } aPanel->onAcceptData(); } if (canBeCommitted()) { emit beforeCommitted(); - // the widgets of property panel should not process any events come from data mode - // after commit clicked. Some signal such as redisplay/create influence on content - // of the object browser and viewer context. Therefore it influence to the current - // selection and if the active widget listens it, the attribute value is errnoneous - // changed. - ModuleBase_IPropertyPanel* aPropertyPanel = propertyPanel(); + // the widgets of property panel should not process any events come from + // data mode after commit clicked. Some signal such as redisplay/create + // influence on content of the object browser and viewer context. Therefore + // it influence to the current selection and if the active widget listens + // it, the attribute value is errnoneous changed. + ModuleBase_IPropertyPanel *aPropertyPanel = propertyPanel(); if (aPropertyPanel) aPropertyPanel->cleanContent(); @@ -347,14 +343,15 @@ bool ModuleBase_OperationFeature::commit() SessionPtr aMgr = ModelAPI_Session::get(); aMgr->finishOperation(); - // Finish operation has to be before stopped because stopped caused update of Object browser - // If it will be done before of cleaning of obsolete objects it will cause crash + // Finish operation has to be before stopped because stopped caused update + // of Object browser If it will be done before of cleaning of obsolete + // objects it will cause crash emit stopped(); emit committed(); afterCommitOperation(); #ifdef DEBUG_OPERATION_START - qDebug("ModuleBase_OperationFeature::commit -- end"); + qDebug("ModuleBase_OperationFeature::commit -- end"); #endif return true; } @@ -364,26 +361,27 @@ bool ModuleBase_OperationFeature::commit() return false; } -ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection( - const std::string& theGreedAttributeId) -{ - ModuleBase_ModelWidget* aWidget = 0; +ModuleBase_ModelWidget *ModuleBase_OperationFeature::activateByPreselection( + const std::string &theGreedAttributeId) { + ModuleBase_ModelWidget *aWidget = 0; if (myPreSelection.empty()) return aWidget; - ModuleBase_IPropertyPanel* aPropertyPanel = propertyPanel(); - ModuleBase_ModelWidget* aFilledWgt = 0; + ModuleBase_IPropertyPanel *aPropertyPanel = propertyPanel(); + ModuleBase_ModelWidget *aFilledWgt = 0; if (aPropertyPanel) { - const QList& aWidgets = aPropertyPanel->modelWidgets(); - QList::const_iterator aWIt; - ModuleBase_ModelWidget* aWgt = 0; + const QList &aWidgets = + aPropertyPanel->modelWidgets(); + QList::const_iterator aWIt; + ModuleBase_ModelWidget *aWgt = 0; if (!aWidgets.empty()) { // equal vertices should not be used here ModuleBase_ISelection::filterSelectionOnEqualPoints(myPreSelection); if (!theGreedAttributeId.empty()) { // set preselection to greed widget - for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) { + for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); + ++aWIt) { aWgt = (*aWIt); if (aWgt->attributeID() == theGreedAttributeId) { aPropertyPanel->setPreselectionWidget(aWgt); @@ -391,30 +389,31 @@ ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection( aPropertyPanel->setPreselectionWidget(NULL); aFilledWgt = aWgt; break; - } - else { // do not process invalid for greed widget selection + } else { // do not process invalid for greed widget selection break; } } } - } - else { + } else { // 1. apply the selection to controls - for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) { + for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); + ++aWIt) { aWgt = (*aWIt); if (!aWgt->canAcceptFocus()) continue; aPropertyPanel->setPreselectionWidget(aWgt); - if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true)) + if (myPreSelection.empty() || + !aWgt->setSelection(myPreSelection, true)) break; else aFilledWgt = aWgt; } } aPropertyPanel->setPreselectionWidget(NULL); - // in order to redisplay object in the viewer, the update/redisplay signals should be flushed - // it is better to perform it not in setSelection of each widget, but do it here, - // after the preselection is processed + // in order to redisplay object in the viewer, the update/redisplay + // signals should be flushed it is better to perform it not in + // setSelection of each widget, but do it here, after the preselection is + // processed ModuleBase_Tools::flushUpdated(myFeature); } } @@ -423,29 +422,26 @@ ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection( return aFilledWgt; } -void ModuleBase_OperationFeature::setParentFeature(CompositeFeaturePtr theParent) -{ +void ModuleBase_OperationFeature::setParentFeature( + CompositeFeaturePtr theParent) { myParentFeature = theParent; } -CompositeFeaturePtr ModuleBase_OperationFeature::parentFeature() const -{ +CompositeFeaturePtr ModuleBase_OperationFeature::parentFeature() const { return myParentFeature; } -void ModuleBase_OperationFeature::setPreviousCurrentFeature(const FeaturePtr& theFeature) -{ +void ModuleBase_OperationFeature::setPreviousCurrentFeature( + const FeaturePtr &theFeature) { myPreviousCurrentFeature = theFeature; } -FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature() -{ +FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature() { return myPreviousCurrentFeature; } void ModuleBase_OperationFeature::initSelection( - const QList& thePreSelected) -{ + const QList &thePreSelected) { QObjectPtrList aCurrentFeatureResults; // Check that the selected result are not results of operation feature @@ -458,60 +454,61 @@ void ModuleBase_OperationFeature::initSelection( aCurrentFeatureResults.append(*aIt); } - if (aCurrentFeatureResults.empty()) /// filtering of selection is not necessary + if (aCurrentFeatureResults + .empty()) /// filtering of selection is not necessary setPreselection(thePreSelected); else { // create preselection list without results of current feature QList aPreSelected; foreach (ModuleBase_ViewerPrsPtr aPrs, thePreSelected) { - if ((!aCurrentFeatureResults.contains(aPrs->object())) && (aPrs->object() != aFeature)) + if ((!aCurrentFeatureResults.contains(aPrs->object())) && + (aPrs->object() != aFeature)) aPreSelected.append(aPrs); } setPreselection(aPreSelected); } } -void ModuleBase_OperationFeature::setPreselection(const QList& theValues) -{ +void ModuleBase_OperationFeature::setPreselection( + const QList &theValues) { clearPreselection(); myPreSelection = theValues; } -void ModuleBase_OperationFeature::clearPreselection() -{ +void ModuleBase_OperationFeature::clearPreselection() { myPreSelection.clear(); } -void ModuleBase_OperationFeature::setPropertyPanel(ModuleBase_IPropertyPanel* theProp) -{ +void ModuleBase_OperationFeature::setPropertyPanel( + ModuleBase_IPropertyPanel *theProp) { ModuleBase_Operation::setPropertyPanel(theProp); theProp->setEditingMode(isEditOperation()); if (theProp) { - const QList& aWidgets = theProp->modelWidgets(); - QList::const_iterator aWIt; + const QList &aWidgets = theProp->modelWidgets(); + QList::const_iterator aWIt; for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) { - ModuleBase_ModelWidget* aWgt = (*aWIt); + ModuleBase_ModelWidget *aWgt = (*aWIt); connect(aWgt, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged())); - connect(aWgt, SIGNAL(valueStateChanged(int)), this, SLOT(onValueStateChanged(int))); + connect(aWgt, SIGNAL(valueStateChanged(int)), this, + SLOT(onValueStateChanged(int))); } } - // Do not activate widgets by default if the current operation is editing operation - // Because we don't know which widget is going to be edited. + // Do not activate widgets by default if the current operation is editing + // operation Because we don't know which widget is going to be edited. if (!isEditOperation()) { // 4. activate the first obligatory widget theProp->activateNextWidget(NULL); - } - else { - // set focus on Ok button in order to operation manager could process Enter press + } else { + // set focus on Ok button in order to operation manager could process Enter + // press if (theProp) theProp->setFocusOnOkButton(); } } -void ModuleBase_OperationFeature::resumeOperation() -{ +void ModuleBase_OperationFeature::resumeOperation() { if (myRestartTransactionOnResume) { ModelAPI_Session::get()->startOperation(this->id().toStdString(), true); myRestartTransactionOnResume = false; diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index 7fba6c45a..8a10b3270 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_OperationFeature_H @@ -23,8 +24,8 @@ #include #include -#include #include +#include #include #include @@ -45,30 +46,31 @@ class QKeyEvent; * \ingroup GUI * \brief Base class for all operations * - * Base class for all operations. If you perform an action it is reasonable to create - * operation intended for this. This is a base class for all operations which provides - * mechanism for correct starting operations, starting operations above already started - * ones, committing operations and so on. To create own operation it is reasonable to - * inherit it from this class and redefines virtual methods to provide own behavior - * Main virtual methods are + * Base class for all operations. If you perform an action it is reasonable to + * create operation intended for this. This is a base class for all operations + * which provides mechanism for correct starting operations, starting operations + * above already started ones, committing operations and so on. To create own + * operation it is reasonable to inherit it from this class and redefines + * virtual methods to provide own behavior Main virtual methods are * - virtual bool isReadyToStart(); * - virtual void startOperation(); * - virtual void abortOperation(); * - virtual void commitOperation(); */ -class MODULEBASE_EXPORT ModuleBase_OperationFeature : public ModuleBase_Operation -{ -Q_OBJECT - - public: +class MODULEBASE_EXPORT ModuleBase_OperationFeature + : public ModuleBase_Operation { + Q_OBJECT - /// Appends to operation's history id, if it is an "edit" operation (myIsEditing == true) +public: + /// Appends to operation's history id, if it is an "edit" operation + /// (myIsEditing == true) static QString EditSuffix() { return "_E"; } /// Constructor /// \param theId the operation identifier /// \param theParent the QObject parent - ModuleBase_OperationFeature(const QString& theId = "", QObject* theParent = 0); + ModuleBase_OperationFeature(const QString &theId = "", + QObject *theParent = 0); /// Destructor virtual ~ModuleBase_OperationFeature(); @@ -76,12 +78,15 @@ Q_OBJECT bool isEditOperation() const { return myIsEditing; } /// Change the operation mode from create to edit. - /// The transaction and the operation name in the model history of transaction are the same. - /// It updates the edit state in the widgets of property panel - /// \param isEditState boolean state whether the operation should become editing or creating - // \param theRestartTransaction if true, the current model transaction is committed and + /// The transaction and the operation name in the model history of transaction + /// are the same. It updates the edit state in the widgets of property panel + /// \param isEditState boolean state whether the operation should become + /// editing or creating + // \param theRestartTransaction if true, the current model transaction is + // committed and /// the new one is started - void setEditOperation(const bool& isEditState/*const bool theRestartTransaction*/); + void setEditOperation( + const bool &isEditState /*const bool theRestartTransaction*/); /// Returns the operation feature /// \return the feature @@ -94,7 +99,8 @@ Q_OBJECT /// Sets the operation feature void setFeature(FeaturePtr theFeature); - /// Returns True if the current operation works with the given object (feature or result) + /// Returns True if the current operation works with the given object (feature + /// or result) virtual bool hasObject(ObjectPtr theObj) const; /// Returns true if the object is displayed when the operation was started @@ -105,23 +111,26 @@ Q_OBJECT /// Initialisation of operation with preliminary selection /// \param thePreSelected a container of selected presentations virtual void initSelection( - const QList>& thePreSelected); + const QList> &thePreSelected); /// Fill internal map by preselection /// \param theValues a list of preselection - void setPreselection(const QList>& theValues); + void setPreselection( + const QList> &theValues); /// \brief Set property pane to the operation /// \param theProp a property panel instance - virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp); + virtual void setPropertyPanel(ModuleBase_IPropertyPanel *theProp); // \return Currently installed property panel - //ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; } + // ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; + // } /// Activates widgets by preselection if it is accepted. - /// \param theGreedAttributeId a greed attribute id if there is in the current feature - /// \return last filled widget - virtual ModuleBase_ModelWidget* activateByPreselection(const std::string& theGreedAttributeId); + /// \param theGreedAttributeId a greed attribute id if there is in the current + /// feature \return last filled widget + virtual ModuleBase_ModelWidget * + activateByPreselection(const std::string &theGreedAttributeId); /// If the operation works with feature which is sub-feature of another one /// then this variable has to be initialised by parent feature @@ -133,15 +142,15 @@ Q_OBJECT /// Stores the previous to the operation current feature /// \param theFeature a feature - void setPreviousCurrentFeature(const FeaturePtr& theFeature); + void setPreviousCurrentFeature(const FeaturePtr &theFeature); /// Returns the previous to the operation current feature /// \return theFeature a feature FeaturePtr previousCurrentFeature(); - /// Set whether the operation should be aborted. By default the state is false in operation - /// \param theState abort state - void setNeedToBeAborted(const bool theState) { myNeedToBeAborted = theState; } + /// Set whether the operation should be aborted. By default the state is false + /// in operation \param theState abort state + void setNeedToBeAborted(const bool theState) { myNeedToBeAborted = theState; } /// Returns valid state of the operation /// \return custom validity state (it is almost always true) @@ -152,46 +161,50 @@ Q_OBJECT /// By default transaction is not reopened on resuming void openTransactionOnResume() { myRestartTransactionOnResume = true; } - public slots: +public slots: /// Starts operation - /// Public slot. Verifies whether operation can be started and starts operation. - /// This slot is not virtual and cannot be redefined. Redefine startOperation method - /// to change behavior of operation. There is no point in using this method. It would - /// be better to inherit own operator from base one and redefine startOperation method - /// instead. - /// \return true if the start is successful + /// Public slot. Verifies whether operation can be started and starts + /// operation. This slot is not virtual and cannot be redefined. Redefine + /// startOperation method to change behavior of operation. There is no point + /// in using this method. It would be better to inherit own operator from base + /// one and redefine startOperation method instead. \return true if the start + /// is successful virtual bool start(); /// Aborts operation - /// Public slot. Aborts operation. This slot is not virtual and cannot be redefined. - /// Redefine abortOperation method to change behavior of operation instead + /// Public slot. Aborts operation. This slot is not virtual and cannot be + /// redefined. Redefine abortOperation method to change behavior of operation + /// instead void abort(); /// Commits operation - /// Public slot. Commits operation. This slot is not virtual and cannot be redefined. - /// Redefine commitOperation method to change behavior of operation instead + /// Public slot. Commits operation. This slot is not virtual and cannot be + /// redefined. Redefine commitOperation method to change behavior of operation + /// instead bool commit(); - protected: - /// Displays the feature/results if it is hidden. It will be hided in stopOperation +protected: + /// Displays the feature/results if it is hidden. It will be hided in + /// stopOperation virtual void startOperation(); /// Hide feature/results if they were hided on start virtual void stopOperation(); - /// Virtual method called after operation resume (see resume() method for more description) + /// Virtual method called after operation resume (see resume() method for more + /// description) virtual void resumeOperation(); /// Creates an operation new feature - /// \param theFlushMessage the flag whether the create message should be flushed - /// \returns the created feature + /// \param theFlushMessage the flag whether the create message should be + /// flushed \returns the created feature virtual FeaturePtr createFeature(const bool theFlushMessage = true); /// Removes the preselection information and clears the map of preselection void clearPreselection(); - protected: - /// The operation feature to be handled +protected: + /// The operation feature to be handled FeaturePtr myFeature; /// a list of hidden objects, whic are diplayed by operation start @@ -212,8 +225,9 @@ Q_OBJECT /// before operation feature creating CompositeFeaturePtr myParentFeature; - /// Last current feature before editing operation. It is cashed when Edit operation is started - /// in order to restore the document current feature on commit/abort this operation. + /// Last current feature before editing operation. It is cashed when Edit + /// operation is started in order to restore the document current feature on + /// commit/abort this operation. FeaturePtr myPreviousCurrentFeature; bool myRestartTransactionOnResume; diff --git a/src/ModuleBase/ModuleBase_PageBase.cpp b/src/ModuleBase/ModuleBase_PageBase.cpp index 817c313b2..f8f893e35 100644 --- a/src/ModuleBase/ModuleBase_PageBase.cpp +++ b/src/ModuleBase/ModuleBase_PageBase.cpp @@ -14,54 +14,44 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include class QWidget; -ModuleBase_PageBase::ModuleBase_PageBase() -{ - -} +ModuleBase_PageBase::ModuleBase_PageBase() {} -ModuleBase_PageBase::~ModuleBase_PageBase() -{ +ModuleBase_PageBase::~ModuleBase_PageBase() {} +QWidget *ModuleBase_PageBase::pageWidget() { + return dynamic_cast(this); } -QWidget* ModuleBase_PageBase::pageWidget() -{ - return dynamic_cast(this); -} - -void ModuleBase_PageBase::addModelWidget(ModuleBase_ModelWidget* theWidget) -{ +void ModuleBase_PageBase::addModelWidget(ModuleBase_ModelWidget *theWidget) { placeModelWidget(theWidget); myWidgetList.append(theWidget); } -void ModuleBase_PageBase::addPageWidget(ModuleBase_PageBase* thePage) -{ +void ModuleBase_PageBase::addPageWidget(ModuleBase_PageBase *thePage) { placePageWidget(thePage); } -void ModuleBase_PageBase::addWidget(QWidget* theWidget) -{ +void ModuleBase_PageBase::addWidget(QWidget *theWidget) { placeWidget(theWidget); } -void ModuleBase_PageBase::clearPage() -{ +void ModuleBase_PageBase::clearPage() { myWidgetList.clear(); QLayoutItem *aChild; while ((aChild = pageLayout()->takeAt(0)) != 0) { - if(aChild->widget()) { + if (aChild->widget()) { delete aChild->widget(); } else { delete aChild; @@ -73,52 +63,47 @@ void ModuleBase_PageBase::clearPage() // from the layout the stretch information is kept, so in the next // filling of the layout some "additional" (old) rows may be stretched // without necessity. - // In this patch we clear the stretch information specifying the default value: 0. - QGridLayout* aLayout = dynamic_cast( pageLayout() ); - if( aLayout ) - { + // In this patch we clear the stretch information specifying the default + // value: 0. + QGridLayout *aLayout = dynamic_cast(pageLayout()); + if (aLayout) { int r = aLayout->rowCount(); - for( int i=0; isetRowStretch( i, 0 ); + for (int i = 0; i < r; i++) + aLayout->setRowStretch(i, 0); } } - -bool ModuleBase_PageBase::takeFocus() -{ - if(myWidgetList.isEmpty()) +bool ModuleBase_PageBase::takeFocus() { + if (myWidgetList.isEmpty()) return false; return myWidgetList.first()->focusTo(); } -QList ModuleBase_PageBase::modelWidgets() const -{ +QList ModuleBase_PageBase::modelWidgets() const { return myWidgetList; } -void ModuleBase_PageBase::alignToTop() -{ +void ModuleBase_PageBase::alignToTop() { bool hasExpanding = false; QList aListToCheck; - ModuleBase_ModelWidget* aModelWidget; - foreach(aModelWidget, myWidgetList) { + ModuleBase_ModelWidget *aModelWidget; + foreach (aModelWidget, myWidgetList) { aListToCheck << aModelWidget->getControls(); } - foreach(QWidget* eachWidget, aListToCheck) { + foreach (QWidget *eachWidget, aListToCheck) { QSizePolicy::Policy aVPolicy = eachWidget->sizePolicy().verticalPolicy(); - if(aVPolicy & QSizePolicy::ExpandFlag) { + if (aVPolicy & QSizePolicy::ExpandFlag) { hasExpanding = true; break; } } - if(!hasExpanding) { + if (!hasExpanding) { addPageStretch(); } } -void ModuleBase_PageBase::placePageWidget(ModuleBase_PageBase* theWidget) -{ - QWidget* aWidget = dynamic_cast(theWidget); +void ModuleBase_PageBase::placePageWidget(ModuleBase_PageBase *theWidget) { + QWidget *aWidget = dynamic_cast(theWidget); placeWidget(aWidget); } diff --git a/src/ModuleBase/ModuleBase_PageBase.h b/src/ModuleBase/ModuleBase_PageBase.h index bdeb48d19..f60818600 100644 --- a/src/ModuleBase/ModuleBase_PageBase.h +++ b/src/ModuleBase/ModuleBase_PageBase.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_PAGEBASE_H_ @@ -31,45 +32,45 @@ class QWidget; * Represent a property panel's list of ModuleBase_ModelWidgets * or other pages widgets derived from ModuleBase_PageBase. */ -class MODULEBASE_EXPORT ModuleBase_PageBase -{ - public: +class MODULEBASE_EXPORT ModuleBase_PageBase { +public: /// Base constructor. ModuleBase_PageBase(); /// Base virtual destructor. virtual ~ModuleBase_PageBase(); /// Cast the page to regular QWidget - QWidget* pageWidget(); + QWidget *pageWidget(); /// Adds the given ModuleBase_ModelWidget to the page - void addModelWidget(ModuleBase_ModelWidget* theWidget); + void addModelWidget(ModuleBase_ModelWidget *theWidget); /// Adds the given ModuleBase_PageBase to the page - void addPageWidget(ModuleBase_PageBase* theWidget); + void addPageWidget(ModuleBase_PageBase *theWidget); /// Adds the given widget to the page - void addWidget(QWidget* theWidget); + void addWidget(QWidget *theWidget); /// Removes all items from page's layout void clearPage(); - /// Passes focus from page to the first ModuleBase_ModelWidget contained on the page + /// Passes focus from page to the first ModuleBase_ModelWidget contained on + /// the page bool takeFocus(); /// Returns list of ModuleBase_ModelWidgets contained on the page - QList modelWidgets() const; + QList modelWidgets() const; /// Aligns top all widgets on page void alignToTop(); - protected: +protected: /// Pure Virtual. Allows to derived class to lay out the widget properly; - virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget) = 0; + virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget) = 0; /// Pure Virtual. Allows to derived class to lay out the page properly; - virtual void placePageWidget(ModuleBase_PageBase* theWidget); + virtual void placePageWidget(ModuleBase_PageBase *theWidget); /// Pure Virtual. Allows to derived class to lay out the page properly; - virtual void placeWidget(QWidget* theWidget) = 0; + virtual void placeWidget(QWidget *theWidget) = 0; /// Pure Virtual. Returns layout of the page. - virtual QLayout* pageLayout() = 0; + virtual QLayout *pageLayout() = 0; /// Pure Virtual. Allows to derived class to insert page stretch properly. virtual void addPageStretch() = 0; - private: - QList myWidgetList; ///< list of widgets contained on the page - +private: + QList + myWidgetList; ///< list of widgets contained on the page }; #endif /* MODULEBASE_PAGEBASE_H_ */ diff --git a/src/ModuleBase/ModuleBase_PageGroupBox.cpp b/src/ModuleBase/ModuleBase_PageGroupBox.cpp index 911ee104c..55f1d62a4 100644 --- a/src/ModuleBase/ModuleBase_PageGroupBox.cpp +++ b/src/ModuleBase/ModuleBase_PageGroupBox.cpp @@ -14,49 +14,45 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include -ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget* theParent) -: QGroupBox(theParent) -{ +ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget *theParent) + : QGroupBox(theParent) { myMainLayout = new QGridLayout(this); ModuleBase_Tools::adjustMargins(myMainLayout); setLayout(myMainLayout); } -ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox() -{ -} +ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox() {} -void ModuleBase_PageGroupBox::addPageStretch() -{ -} +void ModuleBase_PageGroupBox::addPageStretch() {} -void ModuleBase_PageGroupBox::placeModelWidget(ModuleBase_ModelWidget* theWidget) -{ +void ModuleBase_PageGroupBox::placeModelWidget( + ModuleBase_ModelWidget *theWidget) { const int kCol = 0; const int kRow = myMainLayout->count(); - // it seems, that the align on left is not necessary here, but leads to widgets, which are - // not extended on full width of the parent page. The case is grouped widgets in - // the sketch translation operation - myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft); + // it seems, that the align on left is not necessary here, but leads to + // widgets, which are not extended on full width of the parent page. The case + // is grouped widgets in the sketch translation operation + myMainLayout->addWidget(theWidget, kRow, kCol, + Qt::AlignTop); // | Qt::AlignLeft); myMainLayout->setRowStretch(kRow, 0); - } -void ModuleBase_PageGroupBox::placeWidget(QWidget* theWidget) -{ +void ModuleBase_PageGroupBox::placeWidget(QWidget *theWidget) { if (!theWidget) { - #ifdef _DEBUG - std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" << std::endl; - #endif +#ifdef _DEBUG + std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" + << std::endl; +#endif return; } const int kCol = 0; @@ -65,7 +61,4 @@ void ModuleBase_PageGroupBox::placeWidget(QWidget* theWidget) myMainLayout->setRowStretch(kRow, 0); } -QLayout* ModuleBase_PageGroupBox::pageLayout() -{ - return myMainLayout; -} +QLayout *ModuleBase_PageGroupBox::pageLayout() { return myMainLayout; } diff --git a/src/ModuleBase/ModuleBase_PageGroupBox.h b/src/ModuleBase/ModuleBase_PageGroupBox.h index 15cee5102..a1de075db 100644 --- a/src/ModuleBase/ModuleBase_PageGroupBox.h +++ b/src/ModuleBase/ModuleBase_PageGroupBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_PAGEGROUPBOX_H_ @@ -29,32 +30,31 @@ class ModuleBase_ModelWidget; class QGridLayout; - /*! * \ingroup GUI * Represent a property panel's list of ModuleBase_ModelWidgets. */ -class MODULEBASE_EXPORT ModuleBase_PageGroupBox : public QGroupBox, public ModuleBase_PageBase -{ +class MODULEBASE_EXPORT ModuleBase_PageGroupBox : public QGroupBox, + public ModuleBase_PageBase { Q_OBJECT - public: +public: /// Constructs a page that looks like a QGroupBox - explicit ModuleBase_PageGroupBox(QWidget* theParent = 0); + explicit ModuleBase_PageGroupBox(QWidget *theParent = 0); /// Destructs the page virtual ~ModuleBase_PageGroupBox(); - protected: +protected: /// Adds the given widget to page's layout - virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget); + virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget); /// Adds the given page to page's layout - virtual void placeWidget(QWidget* theWidget); + virtual void placeWidget(QWidget *theWidget); /// Returns page's layout (QGridLayout) - virtual QLayout* pageLayout(); + virtual QLayout *pageLayout(); /// Adds a stretch to page's layout virtual void addPageStretch(); - private: - QGridLayout* myMainLayout; ///< page's layout +private: + QGridLayout *myMainLayout; ///< page's layout }; #endif /* MODULEBASE_PAGEGROUPBOX_H_ */ diff --git a/src/ModuleBase/ModuleBase_PageWidget.cpp b/src/ModuleBase/ModuleBase_PageWidget.cpp index e17bf6469..6b1b821ff 100644 --- a/src/ModuleBase/ModuleBase_PageWidget.cpp +++ b/src/ModuleBase/ModuleBase_PageWidget.cpp @@ -14,51 +14,43 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include #include -ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget* theParent) -: QFrame(theParent) -{ +ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget *theParent) + : QFrame(theParent) { myMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(myMainLayout); setLayout(myMainLayout); } -ModuleBase_PageWidget::~ModuleBase_PageWidget() -{ -} +ModuleBase_PageWidget::~ModuleBase_PageWidget() {} -void ModuleBase_PageWidget::addPageStretch() -{ - myMainLayout->addStretch(1); -} +void ModuleBase_PageWidget::addPageStretch() { myMainLayout->addStretch(1); } -void ModuleBase_PageWidget::placeModelWidget(ModuleBase_ModelWidget* theWidget) -{ +void ModuleBase_PageWidget::placeModelWidget( + ModuleBase_ModelWidget *theWidget) { myMainLayout->addWidget(theWidget, 0); } -void ModuleBase_PageWidget::placeWidget(QWidget* theWidget) -{ +void ModuleBase_PageWidget::placeWidget(QWidget *theWidget) { if (!theWidget) { - #ifdef _DEBUG - std::cout << "ModuleBase_PageWidget::placePageWidget: can not cast page" << std::endl; - #endif +#ifdef _DEBUG + std::cout << "ModuleBase_PageWidget::placePageWidget: can not cast page" + << std::endl; +#endif return; } myMainLayout->addWidget(theWidget, 0); } -QLayout* ModuleBase_PageWidget::pageLayout() -{ - return myMainLayout; -} +QLayout *ModuleBase_PageWidget::pageLayout() { return myMainLayout; } diff --git a/src/ModuleBase/ModuleBase_PageWidget.h b/src/ModuleBase/ModuleBase_PageWidget.h index 38d1f9546..7804e95e0 100644 --- a/src/ModuleBase/ModuleBase_PageWidget.h +++ b/src/ModuleBase/ModuleBase_PageWidget.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_PAGEWIDGET_H_ @@ -33,27 +34,27 @@ class QVBoxLayout; * \ingroup GUI * Represent a property panel's list of ModuleBase_ModelWidgets. */ -class MODULEBASE_EXPORT ModuleBase_PageWidget : public QFrame, public ModuleBase_PageBase -{ +class MODULEBASE_EXPORT ModuleBase_PageWidget : public QFrame, + public ModuleBase_PageBase { Q_OBJECT - public: +public: /// Constructs a page that looks like a QFrame - explicit ModuleBase_PageWidget(QWidget* theParent = 0); + explicit ModuleBase_PageWidget(QWidget *theParent = 0); /// Destructs the page virtual ~ModuleBase_PageWidget(); - protected: +protected: /// Adds the given widget to page's layout - virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget); + virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget); /// Adds the given page to page's layout - virtual void placeWidget(QWidget* theWidget); + virtual void placeWidget(QWidget *theWidget); /// Returns page's layout (QGridLayout) - virtual QLayout* pageLayout(); + virtual QLayout *pageLayout(); /// Adds a stretch to page's layout virtual void addPageStretch(); - private: - QVBoxLayout* myMainLayout; ///< page's layout +private: + QVBoxLayout *myMainLayout; ///< page's layout }; #endif /* MODULEBASE_PAGEWIDGET_H_ */ diff --git a/src/ModuleBase/ModuleBase_PagedContainer.cpp b/src/ModuleBase/ModuleBase_PagedContainer.cpp index 3604f7d48..8d6e8d035 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.cpp +++ b/src/ModuleBase/ModuleBase_PagedContainer.cpp @@ -14,45 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include #include #include -#include #include #include - +#include static QMap defaultValues; -ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), - myRemeberChoice(true), myIsFocusOnCurrentPage(false) -{ - // it is not obligatory to be ignored when property panel tries to activate next active widget - // but if focus is moved to this control, it can accept it. +ModuleBase_PagedContainer::ModuleBase_PagedContainer( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myRemeberChoice(true), + myIsFocusOnCurrentPage(false) { + // it is not obligatory to be ignored when property panel tries to activate + // next active widget but if focus is moved to this control, it can accept it. myIsObligatory = false; if (defaultValues.contains(myFeatureId + attributeID())) myDefValue = defaultValues[myFeatureId + attributeID()]; } -ModuleBase_PagedContainer::~ModuleBase_PagedContainer() -{ -} +ModuleBase_PagedContainer::~ModuleBase_PagedContainer() {} -int ModuleBase_PagedContainer::addPage(ModuleBase_PageBase* thePage, - const QString& /*theName*/, - const QString& theCaseId, - const QPixmap& /*theIcon*/, - const QString& /*theTooltip*/) -{ +int ModuleBase_PagedContainer::addPage(ModuleBase_PageBase *thePage, + const QString & /*theName*/, + const QString &theCaseId, + const QPixmap & /*theIcon*/, + const QString & /*theTooltip*/) { if (!myPages.count()) { setDefaultValue(theCaseId.toStdString()); } @@ -62,42 +58,38 @@ int ModuleBase_PagedContainer::addPage(ModuleBase_PageBase* thePage, return myPages.count(); } -QList ModuleBase_PagedContainer::getControls() const -{ - QList aResult; +QList ModuleBase_PagedContainer::getControls() const { + QList aResult; int anIndex = currentPageIndex(); - QList aModelWidgets = myPages[anIndex]->modelWidgets(); - foreach(ModuleBase_ModelWidget* eachModelWidget, aModelWidgets) { + QList aModelWidgets = + myPages[anIndex]->modelWidgets(); + foreach (ModuleBase_ModelWidget *eachModelWidget, aModelWidgets) { aResult << eachModelWidget->getControls(); } return aResult; } -bool ModuleBase_PagedContainer::focusTo() -{ +bool ModuleBase_PagedContainer::focusTo() { int anIndex = currentPageIndex(); if (anIndex > myPages.count()) return false; return myPages[anIndex]->takeFocus(); } -void ModuleBase_PagedContainer::setHighlighted(bool) -{ - //page containers should not be highlighted, do nothing +void ModuleBase_PagedContainer::setHighlighted(bool) { + // page containers should not be highlighted, do nothing } -void ModuleBase_PagedContainer::enableFocusProcessing() -{ +void ModuleBase_PagedContainer::enableFocusProcessing() { myIsFocusOnCurrentPage = true; } -bool ModuleBase_PagedContainer::restoreValueCustom() -{ +bool ModuleBase_PagedContainer::restoreValueCustom() { // A rare case when plugin was not loaded. - if(!myFeature) + if (!myFeature) return false; - std::string aDefVal = myRemeberChoice? myDefValue : ""; + std::string aDefVal = myRemeberChoice ? myDefValue : ""; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); @@ -110,8 +102,7 @@ bool ModuleBase_PagedContainer::restoreValueCustom() setCurrentPageIndex(idx); if (aStringAttr->value() != aCaseId.toStdString()) storeValueCustom(); - } - else { + } else { // It is added because if user edits the feature created from Python // and switches his choice // it will not be stored in the attribute while apply not pressed. @@ -122,24 +113,23 @@ bool ModuleBase_PagedContainer::restoreValueCustom() return true; } -void ModuleBase_PagedContainer::activateCustom() -{ +void ModuleBase_PagedContainer::activateCustom() { // activate current page focusTo(); } -bool ModuleBase_PagedContainer::storeValueCustom() -{ +bool ModuleBase_PagedContainer::storeValueCustom() { // A rare case when plugin was not loaded. - if(!myFeature) + if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); std::string aWidgetValue; if (!aStringAttr->isInitialized()) - aWidgetValue = myDefValue.empty()? - myCaseIds.at(currentPageIndex()).toStdString() : myDefValue; + aWidgetValue = myDefValue.empty() + ? myCaseIds.at(currentPageIndex()).toStdString() + : myDefValue; else aWidgetValue = myCaseIds.at(currentPageIndex()).toStdString(); myDefValue = aWidgetValue; @@ -149,9 +139,7 @@ bool ModuleBase_PagedContainer::storeValueCustom() return true; } - -void ModuleBase_PagedContainer::onPageChanged() -{ +void ModuleBase_PagedContainer::onPageChanged() { if (!storeValue()) return; // focus might be changed only if the value is correcly stored @@ -161,9 +149,7 @@ void ModuleBase_PagedContainer::onPageChanged() focusTo(); } -void ModuleBase_PagedContainer::onFeatureAccepted() -{ +void ModuleBase_PagedContainer::onFeatureAccepted() { if (myRemeberChoice) defaultValues[myFeatureId + attributeID()] = myDefValue; } - diff --git a/src/ModuleBase/ModuleBase_PagedContainer.h b/src/ModuleBase/ModuleBase_PagedContainer.h index cd9fd7194..1539fc9f0 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.h +++ b/src/ModuleBase/ModuleBase_PagedContainer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_PAGEDCONTAINER_H_ @@ -26,17 +27,19 @@ class ModuleBase_PageBase; /** -* \ingroup GUI -* This is an abstract interface to be used for not model container widget such as switch or tool box. -*/ -class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * This is an abstract interface to be used for not model container widget such + * as switch or tool box. + */ +class MODULEBASE_EXPORT ModuleBase_PagedContainer + : public ModuleBase_ModelWidget { Q_OBJECT - public: - /// A constructor - /// \param theParent a parent widget - /// \param theData a data of the widget - ModuleBase_PagedContainer(QWidget* theParent, const Config_WidgetAPI* theData); +public: + /// A constructor + /// \param theParent a parent widget + /// \param theData a data of the widget + ModuleBase_PagedContainer(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_PagedContainer(); /// Add a new page @@ -44,14 +47,12 @@ class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidge /// \param theName a name of the page /// \param theCaseId an Id of the page /// \param theIcon aqn Icon of the page - virtual int addPage( ModuleBase_PageBase* theWidget, - const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip); + virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip); /// Redefinition of virtual function - virtual QList getControls() const; + virtual QList getControls() const; /// Redefinition of virtual function virtual bool focusTo(); @@ -62,15 +63,16 @@ class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidge /// Redefinition of virtual function virtual void enableFocusProcessing(); - /// The slot is called when user press Ok or OkPlus buttons in the parent property panel + /// The slot is called when user press Ok or OkPlus buttons in the parent + /// property panel virtual void onFeatureAccepted(); - protected: - /// Returns index of current page +protected: + /// Returns index of current page virtual int currentPageIndex() const = 0; /// Set current page by index - virtual void setCurrentPageIndex(int ) = 0; + virtual void setCurrentPageIndex(int) = 0; /// Redefinition of virtual function virtual void activateCustom(); @@ -84,14 +86,14 @@ class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidge // A flag which let to remeber last user choice and restore it on next launch bool myRemeberChoice; - protected slots: - /// A slot called on page change +protected slots: + /// A slot called on page change void onPageChanged(); - private: +private: bool myIsFocusOnCurrentPage; QStringList myCaseIds; - QList myPages; + QList myPages; std::string myDefValue; }; diff --git a/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp index 3aaee424f..1e48a41aa 100644 --- a/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp @@ -14,42 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ParamIntSpinBox.h" -#include +#include #include #include #include -#include +#include #include +#include #include #include #include #include #include -#include -#include #include +#include - -ModuleBase_ParamIntSpinBox::ModuleBase_ParamIntSpinBox(QWidget* theParent) - : ModuleBase_IntSpinBox(theParent), - myAcceptVariables(true) -{ +ModuleBase_ParamIntSpinBox::ModuleBase_ParamIntSpinBox(QWidget *theParent) + : ModuleBase_IntSpinBox(theParent), myAcceptVariables(true) { connectSignalsAndSlots(); } /*! \brief Destructor. */ -ModuleBase_ParamIntSpinBox::~ModuleBase_ParamIntSpinBox() -{ -} +ModuleBase_ParamIntSpinBox::~ModuleBase_ParamIntSpinBox() {} /*! \brief Perform \a steps increment/decrement steps. @@ -60,8 +56,7 @@ ModuleBase_ParamIntSpinBox::~ModuleBase_ParamIntSpinBox() \param steps number of increment/decrement steps */ -void ModuleBase_ParamIntSpinBox::stepBy(int steps) -{ +void ModuleBase_ParamIntSpinBox::stepBy(int steps) { if ((!myTextValue.isEmpty()) && hasVariable()) return; @@ -71,19 +66,16 @@ void ModuleBase_ParamIntSpinBox::stepBy(int steps) /*! \brief Connect signals and slots. */ -void ModuleBase_ParamIntSpinBox::connectSignalsAndSlots() -{ - connect(this, SIGNAL(valueChanged(const QString&)), - this, SLOT(onTextChanged(const QString&))); +void ModuleBase_ParamIntSpinBox::connectSignalsAndSlots() { + connect(this, SIGNAL(valueChanged(const QString &)), this, + SLOT(onTextChanged(const QString &))); } -void ModuleBase_ParamIntSpinBox::onTextChanged(const QString& text) -{ +void ModuleBase_ParamIntSpinBox::onTextChanged(const QString &text) { myTextValue = text; } -int ModuleBase_ParamIntSpinBox::valueFromText(const QString& theText) const -{ +int ModuleBase_ParamIntSpinBox::valueFromText(const QString &theText) const { if (!hasVariable(theText)) return ModuleBase_IntSpinBox::valueFromText(theText); @@ -91,9 +83,8 @@ int ModuleBase_ParamIntSpinBox::valueFromText(const QString& theText) const return qHash(theText); } -QString ModuleBase_ParamIntSpinBox::textFromValue(int theValue) const -{ - if ((!myTextValue.isEmpty()) && hasVariable(myTextValue)){ +QString ModuleBase_ParamIntSpinBox::textFromValue(int theValue) const { + if ((!myTextValue.isEmpty()) && hasVariable(myTextValue)) { return myTextValue; } return ModuleBase_IntSpinBox::textFromValue(theValue); @@ -105,8 +96,8 @@ QString ModuleBase_ParamIntSpinBox::textFromValue(int theValue) const \param pos cursor position in the string \return validating operation result */ -QValidator::State ModuleBase_ParamIntSpinBox::validate(QString& str, int& pos) const -{ +QValidator::State ModuleBase_ParamIntSpinBox::validate(QString &str, + int &pos) const { // Trying to interpret the current input text as a numeric value if (!hasVariable(str)) return ModuleBase_IntSpinBox::validate(str, pos); @@ -124,8 +115,7 @@ QValidator::State ModuleBase_ParamIntSpinBox::validate(QString& str, int& pos) c The new value is ignored if the spinbox has a variable. */ -void ModuleBase_ParamIntSpinBox::setValue(int value) -{ +void ModuleBase_ParamIntSpinBox::setValue(int value) { if (hasVariable()) return; @@ -137,8 +127,7 @@ void ModuleBase_ParamIntSpinBox::setValue(int value) \brief This function is used to set a text for this spinbox. \param value current value */ -void ModuleBase_ParamIntSpinBox::setText(const QString& value) -{ +void ModuleBase_ParamIntSpinBox::setText(const QString &value) { myTextValue = value; lineEdit()->setText(value); } @@ -148,28 +137,24 @@ void ModuleBase_ParamIntSpinBox::setText(const QString& value) By default, variable names are enabled. \param flag If true, variable names are enabled. */ -void ModuleBase_ParamIntSpinBox::setAcceptVariables(const bool flag) -{ +void ModuleBase_ParamIntSpinBox::setAcceptVariables(const bool flag) { myAcceptVariables = flag; } /*! \brief Returns true if the spin box accepts variable names. */ -bool ModuleBase_ParamIntSpinBox::isAcceptVariables() const -{ +bool ModuleBase_ParamIntSpinBox::isAcceptVariables() const { return myAcceptVariables; } -bool ModuleBase_ParamIntSpinBox::hasVariable() const -{ +bool ModuleBase_ParamIntSpinBox::hasVariable() const { if (myTextValue.isEmpty()) return false; return hasVariable(myTextValue); } -bool ModuleBase_ParamIntSpinBox::hasVariable(const QString& theText) const -{ +bool ModuleBase_ParamIntSpinBox::hasVariable(const QString &theText) const { bool ok = false; QLocale::c().toInt(theText, &ok); return !ok; @@ -179,9 +164,9 @@ bool ModuleBase_ParamIntSpinBox::hasVariable(const QString& theText) const \brief This function is used to determine whether input is valid. \return validating operation result */ -ModuleBase_ParamIntSpinBox::State ModuleBase_ParamIntSpinBox::isValid( - const QString& theText, double& theValue) const -{ +ModuleBase_ParamIntSpinBox::State +ModuleBase_ParamIntSpinBox::isValid(const QString &theText, + double &theValue) const { if (hasVariable() && !findVariable(theText, theValue)) { bool ok = false; theValue = locale().toInt(theText, &ok); @@ -197,30 +182,28 @@ ModuleBase_ParamIntSpinBox::State ModuleBase_ParamIntSpinBox::isValid( } /*! - \brief This function is used to check that string value lies within predefined range. - \return check status + \brief This function is used to check that string value lies within predefined + range. \return check status */ -bool ModuleBase_ParamIntSpinBox::checkRange(const double theValue) const -{ +bool ModuleBase_ParamIntSpinBox::checkRange(const double theValue) const { return theValue >= minimum() && theValue <= maximum(); } /*! - \brief This function is used to determine whether input is a variable name and to get its value. - \return status of search operation + \brief This function is used to determine whether input is a variable name and + to get its value. \return status of search operation */ -bool ModuleBase_ParamIntSpinBox::findVariable(const QString& theName, - double& outValue) const -{ +bool ModuleBase_ParamIntSpinBox::findVariable(const QString &theName, + double &outValue) const { ResultParameterPtr aParam; - return ModelAPI_Tools::findVariable(FeaturePtr(), theName.toStdWString(), outValue, aParam); + return ModelAPI_Tools::findVariable(FeaturePtr(), theName.toStdWString(), + outValue, aParam); } /*! \brief This function is called when the spinbox receives show event. */ -void ModuleBase_ParamIntSpinBox::showEvent(QShowEvent* theEvent) -{ +void ModuleBase_ParamIntSpinBox::showEvent(QShowEvent *theEvent) { ModuleBase_IntSpinBox::showEvent(theEvent); if ((!myTextValue.isEmpty()) && hasVariable(myTextValue)) { setText(myTextValue); diff --git a/src/ModuleBase/ModuleBase_ParamIntSpinBox.h b/src/ModuleBase/ModuleBase_ParamIntSpinBox.h index 9ef93d734..a7c31b766 100644 --- a/src/ModuleBase/ModuleBase_ParamIntSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamIntSpinBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ParamIntSpinBox_H @@ -27,11 +28,12 @@ #include /** -* \ingroup GUI -* An extension of a double spin box which let to use parameters and expressions for value definition -*/ -class MODULEBASE_EXPORT ModuleBase_ParamIntSpinBox : public ModuleBase_IntSpinBox -{ + * \ingroup GUI + * An extension of a double spin box which let to use parameters and expressions + * for value definition + */ +class MODULEBASE_EXPORT ModuleBase_ParamIntSpinBox + : public ModuleBase_IntSpinBox { Q_OBJECT enum State { Invalid = 0, NoVariable, Incompatible, Acceptable }; @@ -46,25 +48,25 @@ public: \param theParent a parent object */ - explicit ModuleBase_ParamIntSpinBox(QWidget* theParent = 0); + explicit ModuleBase_ParamIntSpinBox(QWidget *theParent = 0); virtual ~ModuleBase_ParamIntSpinBox(); virtual void stepBy(int); /// Convert Int value from text string - virtual int valueFromText(const QString&) const; + virtual int valueFromText(const QString &) const; /// Convert text string from int value virtual QString textFromValue(int) const; /// Validate the value - virtual QValidator::State validate(QString&, int&) const; + virtual QValidator::State validate(QString &, int &) const; /// Set current int value virtual void setValue(int); /// Set current text value - virtual void setText(const QString&); + virtual void setText(const QString &); /// Set a flag about accepted variable void setAcceptVariables(const bool); @@ -75,13 +77,13 @@ public: /// Returns True if the input value contains variable bool hasVariable() const; - protected: - /// Returns True if the given text contains variable - /// \param theText a text string - bool hasVariable(const QString& theText) const; +protected: + /// Returns True if the given text contains variable + /// \param theText a text string + bool hasVariable(const QString &theText) const; /// Returns state of the control - State isValid(const QString&, double&) const; + State isValid(const QString &, double &) const; /// Returns True if the given value is within min and max of the control bool checkRange(const double) const; @@ -89,19 +91,19 @@ public: /// Finds a variable by its name. Returns true in success /// \param theName a name of variable /// \param outValue an output value of the variable - bool findVariable(const QString& theName, double& outValue) const; + bool findVariable(const QString &theName, double &outValue) const; - protected: - virtual void showEvent(QShowEvent*); +protected: + virtual void showEvent(QShowEvent *); - protected slots: - /// A slot called on text change - void onTextChanged(const QString&); +protected slots: + /// A slot called on text change + void onTextChanged(const QString &); - private: +private: void connectSignalsAndSlots(); - private: +private: QString myTextValue; bool myAcceptVariables; diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 9c9cc7613..a475885e9 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -14,28 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ParamSpinBox.h" +#include #include #include #include #include -#include -#include -#include #include +#include #include +#include -#include -#include #include +#include +#include - -bool isVariableSymbol(const QChar& theChar) { +bool isVariableSymbol(const QChar &theChar) { if (theChar.isLetterOrNumber()) return true; if (theChar == '_') @@ -43,30 +43,26 @@ bool isVariableSymbol(const QChar& theChar) { return false; } -ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget* theParent, int thePrecision) - : QAbstractSpinBox(theParent), - myIsEquation(false), - myAcceptVariables(true), - myMinimum(-DBL_MAX), - myMaximum(DBL_MAX), - mySingleStep(1) -{ +ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget *theParent, + int thePrecision) + : QAbstractSpinBox(theParent), myIsEquation(false), myAcceptVariables(true), + myMinimum(-DBL_MAX), myMaximum(DBL_MAX), mySingleStep(1) { myCompleter = new QCompleter(this); myCompleter->setWidget(lineEdit()); myCompleter->setCompletionMode(QCompleter::PopupCompletion); myCompleterModel = new QStringListModel(this); myCompleter->setModel(myCompleterModel); - connect(myCompleter, SIGNAL(highlighted(const QString&)), - this, SLOT(insertCompletion(const QString&))); + connect(myCompleter, SIGNAL(highlighted(const QString &)), this, + SLOT(insertCompletion(const QString &))); - QAbstractItemView* aPopup = myCompleter->popup(); + QAbstractItemView *aPopup = myCompleter->popup(); aPopup->installEventFilter(this); // connectSignalsAndSlots(); myEnabledBaseColor = palette().color(QPalette::Active, QPalette::Base); - connect(lineEdit(), SIGNAL(textChanged(const QString&)), - this, SLOT(onTextChanged(const QString&))); + connect(lineEdit(), SIGNAL(textChanged(const QString &)), this, + SLOT(onTextChanged(const QString &))); setLocale(QLocale::c()); @@ -76,17 +72,16 @@ ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget* theParent, int thePrec myValidator->setDecimals(thePrecision); } -void ModuleBase_ParamSpinBox::setCompletionList(QStringList& theList) -{ +void ModuleBase_ParamSpinBox::setCompletionList(QStringList &theList) { theList.removeDuplicates(); theList.sort(); myCompleterModel->setStringList(theList); - QAbstractItemView* aPopup = myCompleter->popup(); + QAbstractItemView *aPopup = myCompleter->popup(); QFontMetrics aMetric = aPopup->fontMetrics(); int aWidth = 0; QRect aRect; - foreach(QString aStr, theList) { + foreach (QString aStr, theList) { aRect = aMetric.boundingRect(aStr); if (aRect.width() > aWidth) aWidth = aRect.width(); @@ -97,10 +92,7 @@ void ModuleBase_ParamSpinBox::setCompletionList(QStringList& theList) /*! \brief Destructor. */ -ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() -{ -} - +ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() {} /*! \brief Perform \a steps increment/decrement steps. @@ -111,32 +103,29 @@ ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() \param steps number of increment/decrement steps */ -void ModuleBase_ParamSpinBox::stepBy(int steps) -{ +void ModuleBase_ParamSpinBox::stepBy(int steps) { if (hasVariable()) return; double aVal = lineEdit()->text().toDouble(); aVal += steps * mySingleStep; setValue(aVal); - //QAbstractSpinBox::stepBy(steps); + // QAbstractSpinBox::stepBy(steps); } -void ModuleBase_ParamSpinBox::onTextChanged(const QString& theText) -{ +void ModuleBase_ParamSpinBox::onTextChanged(const QString &theText) { myIsEquation = hasVariable(theText); emit textChanged(theText); } - /*! \brief This function is used to determine whether input is valid. \param str currently entered value \param pos cursor position in the string \return validating operation result */ -QValidator::State ModuleBase_ParamSpinBox::validate(QString& str, int& pos) const -{ +QValidator::State ModuleBase_ParamSpinBox::validate(QString &str, + int &pos) const { // Trying to interpret the current input text as a numeric value if (!hasVariable(str)) { /// If decimals = 0 do not accept '.' (interpret as int) @@ -154,24 +143,23 @@ QValidator::State ModuleBase_ParamSpinBox::validate(QString& str, int& pos) cons The new value is ignored if the spinbox has a variable. */ -void ModuleBase_ParamSpinBox::setValue(double value) -{ +void ModuleBase_ParamSpinBox::setValue(double value) { myIsEquation = false; double aVal = value; if (aVal < myMinimum) aVal = myMinimum; else if (aVal > myMaximum) aVal = myMaximum; - QString aText = (myValidator->decimals() == 0) ? QString::number((int)aVal) : - QString::number(aVal, 'g', decimals()); + QString aText = (myValidator->decimals() == 0) + ? QString::number((int)aVal) + : QString::number(aVal, 'g', decimals()); lineEdit()->blockSignals(true); lineEdit()->setText(aText); lineEdit()->blockSignals(false); emit textChanged(aText); } -double ModuleBase_ParamSpinBox::value() const -{ +double ModuleBase_ParamSpinBox::value() const { return lineEdit()->text().toDouble(); } @@ -179,14 +167,12 @@ double ModuleBase_ParamSpinBox::value() const \brief This function is used to set a text for this spinbox. \param value current value */ -void ModuleBase_ParamSpinBox::setText(const QString& value) -{ +void ModuleBase_ParamSpinBox::setText(const QString &value) { myIsEquation = hasVariable(value); if (myAcceptVariables && myIsEquation) { lineEdit()->setText(value); emit textChanged(value); - } - else { + } else { bool isConv = false; double aVal = value.toDouble(&isConv); if (isConv) @@ -199,8 +185,7 @@ void ModuleBase_ParamSpinBox::setText(const QString& value) By default, variable names are enabled. \param flag If true, variable names are enabled. */ -void ModuleBase_ParamSpinBox::setAcceptVariables(const bool flag) -{ +void ModuleBase_ParamSpinBox::setAcceptVariables(const bool flag) { myAcceptVariables = flag; if ((!myAcceptVariables) && myIsEquation) { setValue(0); @@ -210,25 +195,19 @@ void ModuleBase_ParamSpinBox::setAcceptVariables(const bool flag) /*! \brief Returns true if the spin box accepts variable names. */ -bool ModuleBase_ParamSpinBox::isAcceptVariables() const -{ +bool ModuleBase_ParamSpinBox::isAcceptVariables() const { return myAcceptVariables; } -bool ModuleBase_ParamSpinBox::hasVariable() const -{ - return myIsEquation; -} +bool ModuleBase_ParamSpinBox::hasVariable() const { return myIsEquation; } -bool ModuleBase_ParamSpinBox::hasVariable(const QString& theText) const -{ +bool ModuleBase_ParamSpinBox::hasVariable(const QString &theText) const { bool isDouble = false; QLocale::c().toDouble(theText, &isDouble); return !isDouble; } -void ModuleBase_ParamSpinBox::showCompletion(bool checkPrefix) -{ +void ModuleBase_ParamSpinBox::showCompletion(bool checkPrefix) { myCompletePos = lineEdit()->cursorPosition(); int aStart, aEnd; QString aPrefix; @@ -244,8 +223,7 @@ void ModuleBase_ParamSpinBox::showCompletion(bool checkPrefix) } } -void ModuleBase_ParamSpinBox::keyReleaseEvent(QKeyEvent* e) -{ +void ModuleBase_ParamSpinBox::keyReleaseEvent(QKeyEvent *e) { QString aText; switch (e->key()) { @@ -267,7 +245,8 @@ void ModuleBase_ParamSpinBox::keyReleaseEvent(QKeyEvent* e) if (e->modifiers() & Qt::ControlModifier) { showCompletion(false); } - break; default: + break; + default: aText = e->text(); if (aText.length() == 1) { QChar aChar = aText.at(0); @@ -279,17 +258,14 @@ void ModuleBase_ParamSpinBox::keyReleaseEvent(QKeyEvent* e) QAbstractSpinBox::keyReleaseEvent(e); } -bool ModuleBase_ParamSpinBox::eventFilter(QObject* theObj, QEvent* theEvent) -{ +bool ModuleBase_ParamSpinBox::eventFilter(QObject *theObj, QEvent *theEvent) { if (theEvent->type() == QEvent::KeyRelease) { - keyReleaseEvent((QKeyEvent*)theEvent); + keyReleaseEvent((QKeyEvent *)theEvent); } return QAbstractSpinBox::eventFilter(theObj, theEvent); } - -QString ModuleBase_ParamSpinBox::getPrefix(int& theStart, int& theEnd) const -{ +QString ModuleBase_ParamSpinBox::getPrefix(int &theStart, int &theEnd) const { QString aPrefix; QString aText = lineEdit()->text(); theStart = theEnd = myCompletePos; @@ -323,9 +299,7 @@ QString ModuleBase_ParamSpinBox::getPrefix(int& theStart, int& theEnd) const return aPrefix; } - -void ModuleBase_ParamSpinBox::insertCompletion(const QString& theText) -{ +void ModuleBase_ParamSpinBox::insertCompletion(const QString &theText) { QString aText = lineEdit()->text(); int aStart, aEnd; QString aPrefix = getPrefix(aStart, aEnd); @@ -341,13 +315,12 @@ void ModuleBase_ParamSpinBox::insertCompletion(const QString& theText) myIsEquation = true; } - -void ModuleBase_ParamSpinBox::setValueEnabled(bool theEnable) -{ +void ModuleBase_ParamSpinBox::setValueEnabled(bool theEnable) { setReadOnly(!theEnable); QPalette aPal = palette(); aPal.setColor(QPalette::All, QPalette::Base, - theEnable ? myEnabledBaseColor : aPal.color(QPalette::Disabled, QPalette::Base)); + theEnable ? myEnabledBaseColor + : aPal.color(QPalette::Disabled, QPalette::Base)); setPalette(aPal); } diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.h b/src/ModuleBase/ModuleBase_ParamSpinBox.h index 07ad33d71..d679f2913 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ParamSpinBox_H @@ -23,18 +24,18 @@ #include "ModuleBase.h" #include -#include #include +#include class QStringListModel; class QCompleter; /** -* \ingroup GUI -* An extension of a double spin box which let to use parameters and expressions for value definition -*/ -class MODULEBASE_EXPORT ModuleBase_ParamSpinBox : public QAbstractSpinBox -{ + * \ingroup GUI + * An extension of a double spin box which let to use parameters and expressions + * for value definition + */ +class MODULEBASE_EXPORT ModuleBase_ParamSpinBox : public QAbstractSpinBox { Q_OBJECT enum State { Invalid = 0, NoVariable, Incompatible, Acceptable }; @@ -50,25 +51,25 @@ public: \param theParent a parent object \param thePrecision a precision of values display */ - ModuleBase_ParamSpinBox( QWidget* theParent = 0, int thePrecision = 12 ); + ModuleBase_ParamSpinBox(QWidget *theParent = 0, int thePrecision = 12); /// Set list of completion strings - void setCompletionList(QStringList&); + void setCompletionList(QStringList &); virtual ~ModuleBase_ParamSpinBox(); virtual void stepBy(int); -// virtual double valueFromText(const QString&) const; -// virtual QString textFromValue (double value) const; + // virtual double valueFromText(const QString&) const; + // virtual QString textFromValue (double value) const; - virtual QValidator::State validate(QString&, int&) const; + virtual QValidator::State validate(QString &, int &) const; virtual void setValue(double); double value() const; - virtual void setText(const QString&); + virtual void setText(const QString &); QString text() const { return lineEdit()->text(); } @@ -84,8 +85,14 @@ public: double minimum() const { return myMinimum; } double maximum() const { return myMaximum; } - void setMinimum(double theMin) { myMinimum = theMin; myValidator->setBottom(theMin); } - void setMaximum(double theMax) { myMaximum = theMax; myValidator->setTop(theMax); } + void setMinimum(double theMin) { + myMinimum = theMin; + myValidator->setBottom(theMin); + } + void setMaximum(double theMax) { + myMaximum = theMax; + myValidator->setTop(theMax); + } int decimals() const { return myValidator->decimals(); } void setDecimals(int thePrecision) { myValidator->setDecimals(thePrecision); } @@ -101,56 +108,58 @@ protected: */ virtual void keyReleaseEvent(QKeyEvent *event); - virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + virtual bool eventFilter(QObject *theObj, QEvent *theEvent); - /// The virtual function is reimplemented in order to avoid extra increasing of value by StepBy - /// method - virtual void timerEvent(QTimerEvent* /*event*/) {} + /// The virtual function is reimplemented in order to avoid extra increasing + /// of value by StepBy method + virtual void timerEvent(QTimerEvent * /*event*/) {} - virtual StepEnabled stepEnabled() const { return StepUpEnabled | StepDownEnabled; } + virtual StepEnabled stepEnabled() const { + return StepUpEnabled | StepDownEnabled; + } - /// Returns True if the given text contains variable - /// \param theText a text string - bool hasVariable(const QString& theText) const; + /// Returns True if the given text contains variable + /// \param theText a text string + bool hasVariable(const QString &theText) const; -// /// Returns state of the control -// State isValid(const QString&, double&) const; -// -// /// Returns True if the given value is within min and max of the control -// bool checkRange(const double) const; -// -// /// Finds a variable by its name. Returns true in success -// /// \param theName a name of variable -// /// \param outValue an output value of the variable -// bool findVariable(const QString& theName, double& outValue) const; + // /// Returns state of the control + // State isValid(const QString&, double&) const; + // + // /// Returns True if the given value is within min and max of the control + // bool checkRange(const double) const; + // + // /// Finds a variable by its name. Returns true in success + // /// \param theName a name of variable + // /// \param outValue an output value of the variable + // bool findVariable(const QString& theName, double& outValue) const; signals: - void textChanged(const QString&); - -// protected: -// virtual void showEvent(QShowEvent*); -// -// protected slots: -// /// A slot called on text change -// void onTextChanged(const QString&); -// -// private: -// void connectSignalsAndSlots(); + void textChanged(const QString &); + + // protected: + // virtual void showEvent(QShowEvent*); + // + // protected slots: + // /// A slot called on text change + // void onTextChanged(const QString&); + // + // private: + // void connectSignalsAndSlots(); private slots: - void insertCompletion(const QString&); + void insertCompletion(const QString &); - void onTextChanged(const QString&); + void onTextChanged(const QString &); private: - QString getPrefix(int& theStart, int& theEnd) const; + QString getPrefix(int &theStart, int &theEnd) const; void showCompletion(bool checkPrefix); bool myIsEquation; bool myAcceptVariables; - QStringListModel* myCompleterModel; - QCompleter* myCompleter; + QStringListModel *myCompleterModel; + QCompleter *myCompleter; double myMinimum; double myMaximum; @@ -162,7 +171,7 @@ private: /// Cashed color of active base palette QColor myEnabledBaseColor; - QDoubleValidator* myValidator; + QDoubleValidator *myValidator; }; #endif diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index e7827fbad..c3ed71442 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_Preferences.h" @@ -24,13 +25,13 @@ #include -#include -#include #include +#include +#include -#include #include #include +#include #include #ifdef WIN32 @@ -41,10 +42,9 @@ const QString ModuleBase_Preferences::VIEWER_SECTION = "Viewer"; const QString ModuleBase_Preferences::MENU_SECTION = "Menu"; const QString ModuleBase_Preferences::GENERAL_SECTION = "General"; -SUIT_ResourceMgr* ModuleBase_Preferences::myResourceMgr = 0; +SUIT_ResourceMgr *ModuleBase_Preferences::myResourceMgr = 0; -SUIT_ResourceMgr* ModuleBase_Preferences::resourceMgr() -{ +SUIT_ResourceMgr *ModuleBase_Preferences::resourceMgr() { if (!myResourceMgr) { myResourceMgr = new SUIT_ResourceMgr("SHAPER"); myResourceMgr->setCurrentFormat("xml"); @@ -52,8 +52,7 @@ SUIT_ResourceMgr* ModuleBase_Preferences::resourceMgr() return myResourceMgr; } -bool ModuleBase_Preferences::editPreferences(ModuleBase_Prefs& theModified) -{ +bool ModuleBase_Preferences::editPreferences(ModuleBase_Prefs &theModified) { ModuleBase_PreferencesDlg aDlg(resourceMgr(), QApplication::activeWindow()); aDlg.exec(); if (aDlg.isChanged()) { @@ -64,12 +63,11 @@ bool ModuleBase_Preferences::editPreferences(ModuleBase_Prefs& theModified) return false; } -void ModuleBase_Preferences::updateConfigByResources() -{ +void ModuleBase_Preferences::updateConfigByResources() { Config_Properties aProps = Config_PropManager::getProperties(); Config_Properties::iterator aIt; for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); QString aVal = myResourceMgr->stringValue(QString(aProp->section().c_str()), QString(aProp->name().c_str())); if (!aVal.isEmpty()) { @@ -78,66 +76,63 @@ void ModuleBase_Preferences::updateConfigByResources() } } -void ModuleBase_Preferences::updateResourcesByConfig() -{ +void ModuleBase_Preferences::updateResourcesByConfig() { Config_Properties aProps = Config_PropManager::getProperties(); Config_Properties::iterator aIt; for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) { - Config_Prop* aProp = (*aIt); - myResourceMgr->setValue(QString(aProp->section().c_str()), QString(aProp->name().c_str()), + Config_Prop *aProp = (*aIt); + myResourceMgr->setValue(QString(aProp->section().c_str()), + QString(aProp->name().c_str()), QString(aProp->value().c_str())); } } -void ModuleBase_Preferences::resetConfig() -{ +void ModuleBase_Preferences::resetConfig() { Config_Properties aProps = Config_PropManager::getProperties(); Config_Properties::iterator aIt; for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); aProp->setValue(aProp->defaultValue()); } } -void ModuleBase_Preferences::loadCustomProps() -{ - if(!myResourceMgr) +void ModuleBase_Preferences::loadCustomProps() { + if (!myResourceMgr) return; QStringList aSections = myResourceMgr->sections(); - foreach (QString aSection, aSections) - { + foreach (QString aSection, aSections) { QStringList aParams = myResourceMgr->parameters(aSection); - foreach (QString aParam, aParams) - { - Config_Prop* aProp = Config_PropManager::registerProp(aSection.toStdString(), - aParam.toStdString(), "", Config_Prop::Disabled); - aProp->setValue(myResourceMgr->stringValue(aSection, aParam).toStdString()); + foreach (QString aParam, aParams) { + Config_Prop *aProp = Config_PropManager::registerProp( + aSection.toStdString(), aParam.toStdString(), "", + Config_Prop::Disabled); + aProp->setValue( + myResourceMgr->stringValue(aSection, aParam).toStdString()); } } } - -void ModuleBase_Preferences::createEditContent(ModuleBase_IPrefMgr* thePref, int thePage) -{ +void ModuleBase_Preferences::createEditContent(ModuleBase_IPrefMgr *thePref, + int thePage) { thePref->prefMgr()->setItemIcon(thePage, QIcon(":pictures/module.png")); createGeneralTab(thePref, thePage); createCustomPage(thePref, thePage); updateSketchTab(thePref, thePage); } -void ModuleBase_Preferences::resetResourcePreferences(SUIT_PreferenceMgr* thePref) -{ +void ModuleBase_Preferences::resetResourcePreferences( + SUIT_PreferenceMgr *thePref) { if (!thePref) return; QtxResourceMgr::WorkingMode aPrev = - thePref->resourceMgr()->setWorkingMode(QtxResourceMgr::IgnoreUserValues); + thePref->resourceMgr()->setWorkingMode(QtxResourceMgr::IgnoreUserValues); thePref->retrieve(); thePref->resourceMgr()->setWorkingMode(aPrev); } -void ModuleBase_Preferences::resetConfigPropPreferences(SUIT_PreferenceMgr* thePref) -{ +void ModuleBase_Preferences::resetConfigPropPreferences( + SUIT_PreferenceMgr *thePref) { resetConfig(); updateResourcesByConfig(); @@ -147,96 +142,101 @@ void ModuleBase_Preferences::resetConfigPropPreferences(SUIT_PreferenceMgr* theP QStringList aValues; QStringList aSections; for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); aValues.append(QString(aProp->name().c_str())); if (!aSections.contains(aProp->section().c_str())) aSections.append(aProp->section().c_str()); - QtxPreferenceItem* anItem = thePref->findItem(QString(aProp->title().c_str()), true); + QtxPreferenceItem *anItem = + thePref->findItem(QString(aProp->title().c_str()), true); if (anItem) anItem->retrieve(); } } -void ModuleBase_Preferences::createGeneralTab(ModuleBase_IPrefMgr* thePref, int thePageId) -{ - int generalTab = thePref->addPreference(QObject::tr("General"), thePageId, - SUIT_PreferenceMgr::Auto, QString(), QString()); +void ModuleBase_Preferences::createGeneralTab(ModuleBase_IPrefMgr *thePref, + int thePageId) { + int generalTab = + thePref->addPreference(QObject::tr("General"), thePageId, + SUIT_PreferenceMgr::Auto, QString(), QString()); thePref->setItemProperty("columns", 2, generalTab); QStringList actItemList; - actItemList << QObject::tr("Last part") - << QObject::tr("All parts") - << QObject::tr("No activation"); + actItemList << QObject::tr("Last part") << QObject::tr("All parts") + << QObject::tr("No activation"); QList actIdList; actIdList << 0 << 1 << 2; // Group related to creation of a study - int group = thePref->addPreference(QObject::tr("Creation a study"), generalTab, - SUIT_PreferenceMgr::Auto, QString(), QString()); + int group = + thePref->addPreference(QObject::tr("Creation a study"), generalTab, + SUIT_PreferenceMgr::Auto, QString(), QString()); - int actId = thePref->addPreference(QObject::tr("Create new part"), group, SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::GENERAL_SECTION, "create_init_part"); + int actId = thePref->addPreference( + QObject::tr("Create new part"), group, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::GENERAL_SECTION, "create_init_part"); // Group related to running a python script - group = thePref->addPreference(QObject::tr("Launching a python script"), generalTab, - SUIT_PreferenceMgr::Auto, QString(), QString()); + group = thePref->addPreference(QObject::tr("Launching a python script"), + generalTab, SUIT_PreferenceMgr::Auto, + QString(), QString()); QStringList visuItemList; visuItemList << QObject::tr("Last item in each folder") - << QObject::tr("All items") - << QObject::tr("No visualization"); + << QObject::tr("All items") << QObject::tr("No visualization"); QList visuIdList; visuIdList << 0 << 1 << 2; - int visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector, - ModuleBase_Preferences::GENERAL_SECTION, - "part_visualization_script"); + int visuId = thePref->addPreference( + QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector, + ModuleBase_Preferences::GENERAL_SECTION, "part_visualization_script"); thePref->setItemProperty("strings", visuItemList, visuId); thePref->setItemProperty("indexes", visuIdList, visuId); // Group related to opening a study - group = thePref->addPreference(QObject::tr("Opening a study"), generalTab, - SUIT_PreferenceMgr::Auto, QString(), QString()); + group = + thePref->addPreference(QObject::tr("Opening a study"), generalTab, + SUIT_PreferenceMgr::Auto, QString(), QString()); - actId = thePref->addPreference(QObject::tr("Activate"), group, SUIT_PreferenceMgr::Selector, - ModuleBase_Preferences::GENERAL_SECTION, - "part_activation_study"); + actId = thePref->addPreference( + QObject::tr("Activate"), group, SUIT_PreferenceMgr::Selector, + ModuleBase_Preferences::GENERAL_SECTION, "part_activation_study"); thePref->setItemProperty("strings", actItemList, actId); thePref->setItemProperty("indexes", actIdList, actId); visuItemList.clear(); visuItemList << QObject::tr("As stored in HDF") << QObject::tr("Last item in each folder") - << QObject::tr("All items") - << QObject::tr("No visualization"); + << QObject::tr("All items") << QObject::tr("No visualization"); visuIdList.clear(); visuIdList << 0 << 1 << 2 << 3; - visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector, - ModuleBase_Preferences::GENERAL_SECTION, - "part_visualization_study"); + visuId = thePref->addPreference( + QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector, + ModuleBase_Preferences::GENERAL_SECTION, "part_visualization_study"); thePref->setItemProperty("strings", visuItemList, visuId); thePref->setItemProperty("indexes", visuIdList, visuId); } -void ModuleBase_Preferences::updateSketchTab(ModuleBase_IPrefMgr* thePref, int thePageId) -{ - int sketchTab = thePref->addPreference(QObject::tr("Sketch"), thePageId, +void ModuleBase_Preferences::updateSketchTab(ModuleBase_IPrefMgr *thePref, + int thePageId) { + int sketchTab = + thePref->addPreference(QObject::tr("Sketch"), thePageId, SUIT_PreferenceMgr::Auto, QString(), QString()); int allowChange = thePref->addPreference( - QObject::tr("Allow automatic constraint substitution/remove"), - sketchTab, SUIT_PreferenceMgr::GroupBox, - "Sketch", "allow_change_constraint"); - thePref->addPreference(QObject::tr("Notify automatic constraint substitution/remove"), - allowChange, SUIT_PreferenceMgr::Bool, "Sketch", "notify_change_constraint"); + QObject::tr("Allow automatic constraint substitution/remove"), sketchTab, + SUIT_PreferenceMgr::GroupBox, "Sketch", "allow_change_constraint"); + thePref->addPreference( + QObject::tr("Notify automatic constraint substitution/remove"), + allowChange, SUIT_PreferenceMgr::Bool, "Sketch", + "notify_change_constraint"); } -void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId) -{ - SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); +void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr *thePref, + int thePageId) { + SUIT_ResourceMgr *aResMgr = ModuleBase_Preferences::resourceMgr(); // Make a Tab from each section std::list aSections = Config_PropManager::getSections(); @@ -248,7 +248,7 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int Config_Properties::const_iterator aIt; for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) { - Config_Prop* aProp = (*aIt); + Config_Prop *aProp = (*aIt); // check that the property is defined QString aSection(aProp->section().c_str()); QString aName(aProp->name().c_str()); @@ -266,12 +266,13 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int aPrefType = SUIT_PreferenceMgr::Selector; break; default: - aPrefType = (SUIT_PreferenceMgr::PrefItemType) aProp->type(); + aPrefType = (SUIT_PreferenceMgr::PrefItemType)aProp->type(); } - int anId = thePref->addPreference(QObject::tr(aProp->title().c_str()), aTab, aPrefType, - QString::fromStdString(aProp->section()), - QString::fromStdString(aProp->name())); + int anId = thePref->addPreference( + QObject::tr(aProp->title().c_str()), aTab, aPrefType, + QString::fromStdString(aProp->section()), + QString::fromStdString(aProp->name())); switch (aProp->type()) { case Config_Prop::Directory: @@ -297,19 +298,17 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePref->setItemProperty("max", aMax, anId); } break; - case Config_Prop::Cursor: - { - QList aIndicesList; - QList aIconsList; - aIndicesList << 0 << 1 << 2; - aIconsList << QPixmap(":pictures/ArrowCursor.png") << - QPixmap(":pictures/CrossCursor.png") << - QPixmap(":pictures/HandCursor.png"); - - thePref->setItemProperty("indexes", aIndicesList, anId); - thePref->setItemProperty("icons", aIconsList, anId); - } - break; + case Config_Prop::Cursor: { + QList aIndicesList; + QList aIconsList; + aIndicesList << 0 << 1 << 2; + aIconsList << QPixmap(":pictures/ArrowCursor.png") + << QPixmap(":pictures/CrossCursor.png") + << QPixmap(":pictures/HandCursor.png"); + + thePref->setItemProperty("indexes", aIndicesList, anId); + thePref->setItemProperty("icons", aIconsList, anId); + } break; default: // [to avoid compilation warnings] break; } @@ -319,45 +318,42 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int } /** -* Implementation of preferences manager interface -*/ -class ModuleBase_PrefMgr: public ModuleBase_IPrefMgr -{ + * Implementation of preferences manager interface + */ +class ModuleBase_PrefMgr : public ModuleBase_IPrefMgr { public: /// Constructor /// \param theMgr a preferences manager - ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {} + ModuleBase_PrefMgr(ModuleBase_PreferencesMgr *theMgr) : myMgr(theMgr) {} - virtual int addPreference(const QString& theLbl, int pId, + virtual int addPreference(const QString &theLbl, int pId, SUIT_PreferenceMgr::PrefItemType theType, - const QString& theSection, const QString& theName ) - { + const QString &theSection, const QString &theName) { return myMgr->addItem(theLbl, pId, theType, theSection, theName); } - virtual void setItemProperty( const QString& thePropName, const QVariant& theValue, - const int theId = -1) { + virtual void setItemProperty(const QString &thePropName, + const QVariant &theValue, const int theId = -1) { myMgr->setItemProperty(thePropName, theValue, theId); } - virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; } + virtual SUIT_PreferenceMgr *prefMgr() const { return myMgr; } private: - ModuleBase_PreferencesMgr* myMgr; + ModuleBase_PreferencesMgr *myMgr; }; //********************************************************** //********************************************************** //********************************************************** -ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, - QWidget* theParent) - : QDialog(theParent, - Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), - myIsChanged(false) -{ +ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg( + SUIT_ResourceMgr *theResurces, QWidget *theParent) + : QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | + Qt::WindowTitleHint | Qt::WindowCloseButtonHint), + myIsChanged(false) { setWindowTitle(tr("Edit preferences")); - QVBoxLayout* main = new QVBoxLayout(this); + QVBoxLayout *main = new QVBoxLayout(this); main->setMargin(5); main->setSpacing(5); @@ -367,10 +363,10 @@ ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurc setFocusProxy(myPreferences); myPreferences->setFrameStyle(QFrame::Box | QFrame::Sunken); - QDialogButtonBox* aBtnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | - QDialogButtonBox::Reset, - Qt::Horizontal, this); - QPushButton* aDefaultButton = aBtnBox->button(QDialogButtonBox::Reset); + QDialogButtonBox *aBtnBox = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Reset, + Qt::Horizontal, this); + QPushButton *aDefaultButton = aBtnBox->button(QDialogButtonBox::Reset); aDefaultButton->setText(tr("Default")); connect(aDefaultButton, SIGNAL(clicked()), this, SLOT(onDefault())); @@ -382,12 +378,9 @@ ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurc myPreferences->retrieve(); } -ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() -{ -} +ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() {} -void ModuleBase_PreferencesDlg::createEditors() -{ +void ModuleBase_PreferencesDlg::createEditors() { int aPage = myPreferences->addItem(tr("Desktop")); myPreferences->setItemIcon(aPage, QIcon(":pictures/view_prefs.png")); @@ -401,15 +394,14 @@ void ModuleBase_PreferencesDlg::createEditors() ModuleBase_Preferences::createEditContent(&aMgr, aPage); } -void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) -{ +void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) { int viewTab = myPreferences->addItem(tr("Viewer"), thePageId); QStringList gradList; - gradList << tr("Horizontal gradient") << tr("Vertical gradient") << tr("First diagonal gradient") - << tr("Second diagonal gradient") << tr("First corner gradient") - << tr("Second corner gradient") << tr("Third corner gradient") - << tr("Fourth corner gradient"); + gradList << tr("Horizontal gradient") << tr("Vertical gradient") + << tr("First diagonal gradient") << tr("Second diagonal gradient") + << tr("First corner gradient") << tr("Second corner gradient") + << tr("Third corner gradient") << tr("Fourth corner gradient"); QList idList; for (int i = 0; i < gradList.size(); i++) @@ -419,8 +411,9 @@ void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) QString aImgFiles("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)"); - int bgId = myPreferences->addItem(tr("Viewer 3d"), bgGroup, SUIT_PreferenceMgr::Background, - ModuleBase_Preferences::VIEWER_SECTION, "background"); + int bgId = myPreferences->addItem( + tr("Viewer 3d"), bgGroup, SUIT_PreferenceMgr::Background, + ModuleBase_Preferences::VIEWER_SECTION, "background"); myPreferences->setItemProperty("gradient_names", gradList, bgId); myPreferences->setItemProperty("gradient_ids", idList, bgId); myPreferences->setItemProperty("texture_enabled", true, bgId); @@ -433,81 +426,91 @@ void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) // Create other parameters group in viewer tab int selectionGroup = myPreferences->addItem(tr("Default selection"), viewTab); myPreferences->setItemProperty("columns", 3, selectionGroup); - myPreferences->addItem(tr("Faces"), selectionGroup, - SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::VIEWER_SECTION, "face-selection"); - myPreferences->addItem(tr("Edges"), selectionGroup, - SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::VIEWER_SECTION, "edge-selection"); - myPreferences->addItem(tr("Vertices"), selectionGroup, - SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection"); - - int sensitivityGroup = myPreferences->addItem(tr("Selection sensitivity"), viewTab); + myPreferences->addItem(tr("Faces"), selectionGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, + "face-selection"); + myPreferences->addItem(tr("Edges"), selectionGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, + "edge-selection"); + myPreferences->addItem( + tr("Vertices"), selectionGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection"); + + int sensitivityGroup = + myPreferences->addItem(tr("Selection sensitivity"), viewTab); myPreferences->setItemProperty("columns", 2, sensitivityGroup); - myPreferences->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, - ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity"); - myPreferences->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, - ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity"); - - int highlightGroup = myPreferences->addItem(tr("Additional highlighting"), viewTab); + myPreferences->addItem( + tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, + ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity"); + myPreferences->addItem( + tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, + ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity"); + + int highlightGroup = + myPreferences->addItem(tr("Additional highlighting"), viewTab); myPreferences->setItemProperty("columns", 2, highlightGroup); - myPreferences->addItem(tr("In 3d mode"), highlightGroup, - SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d"); - myPreferences->addItem(tr("In 2d mode"), highlightGroup, - SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d"); + myPreferences->addItem( + tr("In 3d mode"), highlightGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d"); + myPreferences->addItem( + tr("In 2d mode"), highlightGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d"); int colorScaleGroup = myPreferences->addItem(tr("Color scale"), viewTab); myPreferences->setItemProperty("columns", 4, colorScaleGroup); - int aItem = myPreferences->addItem(tr("X position"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position"); + int aItem = myPreferences->addItem( + tr("X position"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position"); myPreferences->setItemProperty("min", 0, aItem); myPreferences->setItemProperty("max", 1, aItem); - aItem = myPreferences->addItem(tr("Y position"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position"); + aItem = myPreferences->addItem( + tr("Y position"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position"); myPreferences->setItemProperty("min", 0, aItem); myPreferences->setItemProperty("max", 1, aItem); - aItem = myPreferences->addItem(tr("Width"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width"); + aItem = myPreferences->addItem( + tr("Width"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width"); myPreferences->setItemProperty("min", 0, aItem); myPreferences->setItemProperty("max", 1, aItem); - aItem = myPreferences->addItem(tr("Height"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height"); + aItem = myPreferences->addItem( + tr("Height"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height"); myPreferences->setItemProperty("min", 0, aItem); myPreferences->setItemProperty("max", 1, aItem); - aItem = myPreferences->addItem(tr("Intervals number"), colorScaleGroup, - SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals"); + aItem = myPreferences->addItem( + tr("Intervals number"), colorScaleGroup, SUIT_PreferenceMgr::Integer, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals"); myPreferences->setItemProperty("min", 0, aItem); myPreferences->setItemProperty("max", 100, aItem); - aItem = myPreferences->addItem(tr("Text height"), colorScaleGroup, - SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height"); + aItem = myPreferences->addItem( + tr("Text height"), colorScaleGroup, SUIT_PreferenceMgr::Integer, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height"); myPreferences->setItemProperty("min", 0, aItem); myPreferences->setItemProperty("max", 100, aItem); - aItem = myPreferences->addItem(tr("Text color"), colorScaleGroup, - SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color"); + aItem = myPreferences->addItem( + tr("Text color"), colorScaleGroup, SUIT_PreferenceMgr::Color, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color"); } -void ModuleBase_PreferencesDlg::createMenuPage(int thePageId) -{ +void ModuleBase_PreferencesDlg::createMenuPage(int thePageId) { int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId); int aSizeGroup = myPreferences->addItem(tr("Size"), aMenuTab); myPreferences->setItemProperty("columns", 1, aSizeGroup); - int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup, - SUIT_PreferenceMgr::IntSpin, - ModuleBase_Preferences::MENU_SECTION, - "rows_number"); + int aRowsNb = myPreferences->addItem( + tr("Number of rows"), aSizeGroup, SUIT_PreferenceMgr::IntSpin, + ModuleBase_Preferences::MENU_SECTION, "rows_number"); myPreferences->setItemProperty("min", 1, aRowsNb); myPreferences->setItemProperty("max", 6, aRowsNb); myPreferences->addItem(tr("Show Status Bar"), aSizeGroup, - SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::MENU_SECTION, - "status_bar"); + SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::MENU_SECTION, "status_bar"); } -void ModuleBase_PreferencesDlg::accept() -{ +void ModuleBase_PreferencesDlg::accept() { myPreferences->store(); myIsChanged = true; @@ -516,13 +519,11 @@ void ModuleBase_PreferencesDlg::accept() QDialog::accept(); } -void ModuleBase_PreferencesDlg::modified(ModuleBase_Prefs& theModified) const -{ +void ModuleBase_PreferencesDlg::modified(ModuleBase_Prefs &theModified) const { theModified = myPreferences->modified(); } -void ModuleBase_PreferencesDlg::onDefault() -{ +void ModuleBase_PreferencesDlg::onDefault() { // reset main resources. It throwns all resource manager items to the // initial/default state. If there is no a default state of the item, // it will be filled with an empty value. It concernerned to plugin @@ -536,8 +537,7 @@ void ModuleBase_PreferencesDlg::onDefault() ModuleBase_Preferences::resetConfigPropPreferences(myPreferences); } -void ModuleBase_PreferencesDlg::showEvent(QShowEvent* theEvent) -{ +void ModuleBase_PreferencesDlg::showEvent(QShowEvent *theEvent) { QDialog::showEvent(theEvent); adjustSize(); } @@ -545,8 +545,7 @@ void ModuleBase_PreferencesDlg::showEvent(QShowEvent* theEvent) //********************************************************** //********************************************************** //********************************************************** -void ModuleBase_PreferencesMgr::changedResources(const ResourceMap& theMap) -{ +void ModuleBase_PreferencesMgr::changedResources(const ResourceMap &theMap) { myModified.clear(); ResourceMap::ConstIterator it; QString sec, param; diff --git a/src/ModuleBase/ModuleBase_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h index a6c04754d..ff638ae48 100644 --- a/src/ModuleBase/ModuleBase_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Preferences_H @@ -23,8 +24,8 @@ #include "ModuleBase.h" #include "ModuleBase_IPrefMgr.h" -#include #include +#include class SUIT_ResourceMgr; class QWidget; @@ -38,13 +39,12 @@ typedef QList ModuleBase_Prefs; //*********************************************************************** /// \ingroup GUI /// Class for manipulation with preferences in the application -class MODULEBASE_EXPORT ModuleBase_Preferences -{ - public: - /// Name of preferences of viewer section +class MODULEBASE_EXPORT ModuleBase_Preferences { +public: + /// Name of preferences of viewer section static const QString VIEWER_SECTION; - /// Name of preferences of menu section + /// Name of preferences of menu section static const QString MENU_SECTION; /// Name of preferences of general section @@ -52,15 +52,17 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Shows a dialog box to edit preferences /// \param theModified a list of modified preferences - static bool editPreferences(ModuleBase_Prefs& theModified); + static bool editPreferences(ModuleBase_Prefs &theModified); /// Returns currently installed resource manager - static SUIT_ResourceMgr* resourceMgr(); + static SUIT_ResourceMgr *resourceMgr(); /// Sets a resource manager - /// It is used in case of necessity to define external resource manager (not SHAPER) - /// \param theMgr resource manager - static void setResourceMgr(SUIT_ResourceMgr* theMgr) { myResourceMgr = theMgr; } + /// It is used in case of necessity to define external resource manager (not + /// SHAPER) \param theMgr resource manager + static void setResourceMgr(SUIT_ResourceMgr *theMgr) { + myResourceMgr = theMgr; + } /// Updates Config_PropManager properties by module from SUIT_ResourceMgr static void updateConfigByResources(); @@ -71,16 +73,16 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Create editable content /// \param thePref interface to preference manager /// \param thePage an id of a page - static void createEditContent(ModuleBase_IPrefMgr* thePref, int thePage); + static void createEditContent(ModuleBase_IPrefMgr *thePref, int thePage); /// Retrieve preferences of resource manage to default state - static void resetResourcePreferences(SUIT_PreferenceMgr* thePref); + static void resetResourcePreferences(SUIT_PreferenceMgr *thePref); /// Retrieve preferences of config prop to default state - static void resetConfigPropPreferences(SUIT_PreferenceMgr* thePref); + static void resetConfigPropPreferences(SUIT_PreferenceMgr *thePref); /// Updates content of preferences for sketch tab - static void updateSketchTab(ModuleBase_IPrefMgr* thePref, int thePageId); + static void updateSketchTab(ModuleBase_IPrefMgr *thePref, int thePageId); private: /// Updates SUIT_ResourceMgr values by Config_PropManager properties @@ -89,94 +91,83 @@ private: /// Set default values to the Config_PropManager properties static void resetConfig(); - /// Creates a content for General tab, which defines the behavior of loading parts - /// and displaying shapes - static void createGeneralTab(ModuleBase_IPrefMgr* thePref, int thePageId); + /// Creates a content for General tab, which defines the behavior of loading + /// parts and displaying shapes + static void createGeneralTab(ModuleBase_IPrefMgr *thePref, int thePageId); /// Creates content of preferences editing widget - static void createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId); + static void createCustomPage(ModuleBase_IPrefMgr *thePref, int thePageId); - static SUIT_ResourceMgr* myResourceMgr; + static SUIT_ResourceMgr *myResourceMgr; }; //*********************************************************************** /// \ingroup GUI /// Manager of preferences -class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr -{ -Q_OBJECT - public: - /// Constructor - /// \param theResource resource manager - /// \param theParent a paren widget - ModuleBase_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent) - : SUIT_PreferenceMgr(theResource, theParent) - { - } +class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr { + Q_OBJECT +public: + /// Constructor + /// \param theResource resource manager + /// \param theParent a paren widget + ModuleBase_PreferencesMgr(QtxResourceMgr *theResource, QWidget *theParent) + : SUIT_PreferenceMgr(theResource, theParent) {} - virtual ~ModuleBase_PreferencesMgr() - { - } + virtual ~ModuleBase_PreferencesMgr() {} /// Returns True if preferences were modified - ModuleBase_Prefs modified() const - { - return myModified; - } + ModuleBase_Prefs modified() const { return myModified; } - protected: - /// Store changed resource - virtual void changedResources(const ResourceMap& theMap); +protected: + /// Store changed resource + virtual void changedResources(const ResourceMap &theMap); - private: +private: ModuleBase_Prefs myModified; }; //*********************************************************************** /// \ingroup GUI /// Dialog box for preferences editing -class MODULEBASE_EXPORT ModuleBase_PreferencesDlg : public QDialog -{ -Q_OBJECT - public: - /// Constructor - /// \param theResurces resources manager - /// \param theParent a parent widget - ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0); +class MODULEBASE_EXPORT ModuleBase_PreferencesDlg : public QDialog { + Q_OBJECT +public: + /// Constructor + /// \param theResurces resources manager + /// \param theParent a parent widget + ModuleBase_PreferencesDlg(SUIT_ResourceMgr *theResurces, + QWidget *theParent = 0); virtual ~ModuleBase_PreferencesDlg(); /// Returns True if preferences were changed - bool isChanged() const - { - return myIsChanged; - } + bool isChanged() const { return myIsChanged; } /// Returns list of modified preferences /// \param theModified output list of modified preferences - void modified(ModuleBase_Prefs& theModified) const; + void modified(ModuleBase_Prefs &theModified) const; - public slots: - /// A slot called on Ok button press +public slots: + /// A slot called on Ok button press virtual void accept(); protected: - virtual void showEvent(QShowEvent* theEvent); + virtual void showEvent(QShowEvent *theEvent); protected slots: /// A slot called on Default button press void onDefault(); - private: - /// Create editors for aplication properties - void createEditors(); +private: + /// Create editors for aplication properties + void createEditors(); - /// Create a viewer page in dialog box - void createViewerPage(int thePageId); + /// Create a viewer page in dialog box + void createViewerPage(int thePageId); - /// Create menu properties page in the dialog box - void createMenuPage(int thePageId); + /// Create menu properties page in the dialog box + void createMenuPage(int thePageId); - ModuleBase_PreferencesMgr* myPreferences; + ModuleBase_PreferencesMgr *myPreferences; bool myIsChanged; }; diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 3e976a912..983080c3b 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -14,57 +14,58 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ResultPrs.h" #include "ModuleBase_IViewer.h" -#include #include +#include +#include #include -#include -#include #include -#include +#include +#include -#include "ModuleBase_Tools.h" #include "ModuleBase_BRepOwner.h" +#include "ModuleBase_Tools.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 #if OCC_VERSION_HEX > 0x070400 #include @@ -74,16 +75,11 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape); - - //******************************************************************** ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) - : ViewerData_AISShape(TopoDS_Shape()), - myResult(theResult), - myIsSubstituted(false), - myTransparency(1), - myAdditionalSelectionPriority(0) -{ + : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), + myIsSubstituted(false), myTransparency(1), + myAdditionalSelectionPriority(0) { GeomShapePtr aShapePtr = ModelAPI_Tools::shape(theResult); TopoDS_Shape aShape = aShapePtr->impl(); @@ -91,33 +87,37 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) // until sketch faces are built and displayed. // Thus, perform discretization of such edges. if (theResult->groupName() == ModelAPI_ResultConstruction::group() && - aShape.ShapeType() == TopAbs_EDGE) { + aShape.ShapeType() == TopAbs_EDGE) { GeomEdgePtr anEdgePtr = GeomEdgePtr(new GeomAPI_Edge(aShapePtr)); if (anEdgePtr->isCircle() || anEdgePtr->isArc()) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); TopLoc_Location aLoc; Handle(Poly_Polygon3D) aPoly3D = BRep_Tool::Polygon3D(anEdge, aLoc); if (aPoly3D.IsNull()) { - double aDeflection = Config_PropManager::real("Visualization", "construction_deflection"); + double aDeflection = Config_PropManager::real( + "Visualization", "construction_deflection"); BRepMesh_IncrementalMesh(aShape, aDeflection); } } } Set(aShape); - // VSV: bos22744: The AutoHilight mode is swithced off because it produces different - // behaviour of selection for simple shape and compound. For example when selection mode - // is Vertex the shape is selected by vertex, but compound is selected by whole shape - //ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult); - //SetAutoHilight(aResOwner.get() == NULL); + // VSV: bos22744: The AutoHilight mode is swithced off because it produces + // different behaviour of selection for simple shape and compound. For example + // when selection mode is Vertex the shape is selected by vertex, but compound + // is selected by whole shape + // ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult); + // SetAutoHilight(aResOwner.get() == NULL); // Set own free boundaries aspect in order to have free // and unfree boundaries with different colors Handle(Prs3d_Drawer) aDrawer = Attributes(); aDrawer->SetUnFreeBoundaryAspect( - new Prs3d_LineAspect(Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1)); - aDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1)); - aDrawer->SetFaceBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1)); + new Prs3d_LineAspect(Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1)); + aDrawer->SetFreeBoundaryAspect( + new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1)); + aDrawer->SetFaceBoundaryAspect( + new Prs3d_LineAspect(Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1)); Quantity_Color aColor; Color(aColor); @@ -130,20 +130,22 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) aIsoValues.push_back(1); aIsoValues.push_back(1); } - } - else { + } else { aIsoValues.push_back(0); aIsoValues.push_back(0); } - myUIsoAspect = new Prs3d_IsoAspect(aColor, Aspect_TOL_SOLID, 1, aIsoValues[0]); - myVIsoAspect = new Prs3d_IsoAspect(aColor, Aspect_TOL_SOLID, 1, aIsoValues[1]); + myUIsoAspect = + new Prs3d_IsoAspect(aColor, Aspect_TOL_SOLID, 1, aIsoValues[0]); + myVIsoAspect = + new Prs3d_IsoAspect(aColor, Aspect_TOL_SOLID, 1, aIsoValues[1]); aDrawer->SetUIsoAspect(myUIsoAspect); aDrawer->SetVIsoAspect(myVIsoAspect); if (aDrawer->HasOwnPointAspect()) aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS); else - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); aDrawer = DynamicHilightAttributes(); if (aDrawer.IsNull()) { @@ -157,7 +159,8 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) myHiddenSubShapesDrawer = new AIS_ColoredDrawer(myDrawer); Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect(); - aShadingAspect->SetMaterial(Graphic3d_NOM_BRASS); //default value of context material + aShadingAspect->SetMaterial( + Graphic3d_NOM_BRASS); // default value of context material aShadingAspect->Aspect()->SetEdgeColor(Quantity_NOC_BLACK); myHiddenSubShapesDrawer->SetShadingAspect(aShadingAspect); @@ -166,31 +169,32 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) // Define colors for wireframe mode setEdgesDefaultColor(); - ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), + DynamicHilightAttributes()); ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); Attributes()->UpdatePreviousDeviationCoefficient(); } //******************************************************************** -void ModuleBase_ResultPrs::setAdditionalSelectionPriority(const int thePriority) -{ +void ModuleBase_ResultPrs::setAdditionalSelectionPriority( + const int thePriority) { myAdditionalSelectionPriority = thePriority; } //******************************************************************** -void ModuleBase_ResultPrs::SetColor (const Quantity_Color& theColor) -{ +void ModuleBase_ResultPrs::SetColor(const Quantity_Color &theColor) { ViewerData_AISShape::SetColor(theColor); - myHiddenSubShapesDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel); + myHiddenSubShapesDrawer->ShadingAspect()->SetColor(theColor, + myCurrentFacingModel); setEdgesDefaultColor(); myUIsoAspect->SetColor(theColor); myVIsoAspect->SetColor(theColor); } -void ModuleBase_ResultPrs::setEdgesDefaultColor() -{ +void ModuleBase_ResultPrs::setEdgesDefaultColor() { if (myResult.get()) { - AttributeIntArrayPtr aColorAttr = myResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aColorAttr = + myResult->data()->intArray(ModelAPI_Result::COLOR_ID()); bool aHasColor = aColorAttr.get() && aColorAttr->isInitialized(); Handle(Prs3d_Drawer) aDrawer = Attributes(); @@ -209,19 +213,18 @@ void ModuleBase_ResultPrs::setEdgesDefaultColor() } } - //******************************************************************** -void ModuleBase_ResultPrs::setSubShapeHidden(const TopoDS_ListOfShape& theShapes) -{ +void ModuleBase_ResultPrs::setSubShapeHidden( + const TopoDS_ListOfShape &theShapes) { TopoDS_Compound aCompound; BRep_Builder aBBuilder; - aBBuilder.MakeCompound (aCompound); + aBBuilder.MakeCompound(aCompound); myHiddenSubShapes = theShapes; collectSubShapes(aBBuilder, aCompound, myOriginalShape, myHiddenSubShapes); myVisibleCompound = aCompound; - aBBuilder.MakeCompound (aCompound); + aBBuilder.MakeCompound(aCompound); TopoDS_ListOfShape::Iterator aIt(myHiddenSubShapes); for (; aIt.More(); aIt.Next()) { aBBuilder.Add(aCompound, aIt.Value()); @@ -230,12 +233,13 @@ void ModuleBase_ResultPrs::setSubShapeHidden(const TopoDS_ListOfShape& theShapes } //******************************************************************** -bool ModuleBase_ResultPrs::isSubShapeHidden(const TopoDS_Shape& theShape) -{ - if (theShape.IsNull() || theShape.ShapeType() != TopAbs_FACE) // only face shape can be hidden +bool ModuleBase_ResultPrs::isSubShapeHidden(const TopoDS_Shape &theShape) { + if (theShape.IsNull() || + theShape.ShapeType() != TopAbs_FACE) // only face shape can be hidden return false; - // orientation of parameter shape(come from selection) may be wrong, check isEqual() to be sure + // orientation of parameter shape(come from selection) may be wrong, check + // isEqual() to be sure TopoDS_ListOfShape::Iterator aShapeIt(myHiddenSubShapes); for (; aShapeIt.More(); aShapeIt.Next()) { if (theShape.IsSame(aShapeIt.Value())) @@ -247,15 +251,15 @@ bool ModuleBase_ResultPrs::isSubShapeHidden(const TopoDS_Shape& theShape) //******************************************************************** bool ModuleBase_ResultPrs::hasSubShapeVisible( - const TopoDS_ListOfShape& theShapesToSkip) -{ + const TopoDS_ListOfShape &theShapesToSkip) { TopoDS_Compound aCompound; BRep_Builder aBuilder; - aBuilder.MakeCompound (aCompound); + aBuilder.MakeCompound(aCompound); TopoDS_ListOfShape aShapesToSkip; TopoDS_ListOfShape aHiddenCopy(myHiddenSubShapes); aShapesToSkip.Append(aHiddenCopy); - for (TopoDS_ListOfShape::Iterator anIt(theShapesToSkip); anIt.More(); anIt.Next()) + for (TopoDS_ListOfShape::Iterator anIt(theShapesToSkip); anIt.More(); + anIt.Next()) aShapesToSkip.Append(anIt.Value()); collectSubShapes(aBuilder, aCompound, myOriginalShape, aShapesToSkip); @@ -263,33 +267,35 @@ bool ModuleBase_ResultPrs::hasSubShapeVisible( } //******************************************************************** -bool ModuleBase_ResultPrs::setHiddenSubShapeTransparency(double theTransparency) -{ - if (myTransparency == theTransparency || theTransparency > 1 || theTransparency < 0) +bool ModuleBase_ResultPrs::setHiddenSubShapeTransparency( + double theTransparency) { + if (myTransparency == theTransparency || theTransparency > 1 || + theTransparency < 0) return false; myTransparency = theTransparency; - myHiddenSubShapesDrawer->ShadingAspect()->SetTransparency (theTransparency, myCurrentFacingModel); + myHiddenSubShapesDrawer->ShadingAspect()->SetTransparency( + theTransparency, myCurrentFacingModel); return true; } //******************************************************************** -void ModuleBase_ResultPrs::Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) -{ +void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d) & + thePresentationManager, + const Handle(Prs3d_Presentation) & + thePresentation, + const Standard_Integer theMode) { std::shared_ptr aShapePtr = myResult->shape(); bool aReadyToDisplay = aShapePtr.get(); if (aReadyToDisplay) { myOriginalShape = aShapePtr->impl(); - if (myHiddenSubShapes.IsEmpty() || myOriginalShape.ShapeType() > TopAbs_FACE ) { + if (myHiddenSubShapes.IsEmpty() || + myOriginalShape.ShapeType() > TopAbs_FACE) { if (!myOriginalShape.IsNull()) { Set(myOriginalShape); myIsSubstituted = false; } - } - else { // convert shape into SHELL + } else { // convert shape into SHELL bool isEmptyShape = BOPTools_AlgoTools3D::IsEmptyShape(myVisibleCompound); Set(myVisibleCompound); myIsSubstituted = true; @@ -300,12 +306,10 @@ void ModuleBase_ResultPrs::Compute( // change deviation coefficient to provide more precise circle try { AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); - } - catch (...) { + } catch (...) { return; } - if (myResult.get() && ModelAPI_Tools::isShowEdgesDirection(myResult)) - { + if (myResult.get() && ModelAPI_Tools::isShowEdgesDirection(myResult)) { TopExp_Explorer Exp(myshape, TopAbs_EDGE); for (; Exp.More(); Exp.Next()) { TopoDS_Edge anEdgeE = TopoDS::Edge(Exp.Current()); @@ -324,7 +328,8 @@ void ModuleBase_ResultPrs::Compute( gp_Vec aDirVec; Handle(Geom_Curve) C = BRep_Tool::Curve(anEdgeE, fp, lp); - if (C.IsNull()) continue; + if (C.IsNull()) + continue; if (anEdgeE.Orientation() == TopAbs_FORWARD) C->D1(lp, aP2, aDirVec); @@ -343,72 +348,77 @@ void ModuleBase_ResultPrs::Compute( else aDir = -aDirVec; - Prs3d_Arrow::Draw(thePresentation->CurrentGroup(), aP2, aDir, M_PI / 180.*5., aDist / 10.); + Prs3d_Arrow::Draw(thePresentation->CurrentGroup(), aP2, aDir, + M_PI / 180. * 5., aDist / 10.); } } } // visualize hidden sub-shapes transparent if (myResult.get()) { - if (myTransparency < 1 && !myHiddenSubShapes.IsEmpty()) - { - StdPrs_ShadedShape::Add(thePresentation, myHiddenCompound, myHiddenSubShapesDrawer); + if (myTransparency < 1 && !myHiddenSubShapes.IsEmpty()) { + StdPrs_ShadedShape::Add(thePresentation, myHiddenCompound, + myHiddenSubShapesDrawer); aReadyToDisplay = true; } if (!aReadyToDisplay) { Events_InfoMessage("ModuleBase_ResultPrs", - "An empty AIS presentation: ModuleBase_ResultPrs").send(); - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); + "An empty AIS presentation: ModuleBase_ResultPrs") + .send(); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); } } } //******************************************************************** -void ModuleBase_ResultPrs::collectSubShapes(BRep_Builder& theBuilder, - TopoDS_Shape& theCompound, const TopoDS_Shape& theShape, - const TopoDS_ListOfShape& theHiddenSubShapes) -{ +void ModuleBase_ResultPrs::collectSubShapes( + BRep_Builder &theBuilder, TopoDS_Shape &theCompound, + const TopoDS_Shape &theShape, + const TopoDS_ListOfShape &theHiddenSubShapes) { switch (theShape.ShapeType()) { - case TopAbs_COMPSOLID: - case TopAbs_COMPOUND: { - for (TopoDS_Iterator aChildIter (theShape); aChildIter.More(); aChildIter.Next()) - collectSubShapes(theBuilder, theCompound, aChildIter.Value(), theHiddenSubShapes); + case TopAbs_COMPSOLID: + case TopAbs_COMPOUND: { + for (TopoDS_Iterator aChildIter(theShape); aChildIter.More(); + aChildIter.Next()) + collectSubShapes(theBuilder, theCompound, aChildIter.Value(), + theHiddenSubShapes); + } break; + case TopAbs_SOLID: + case TopAbs_SHELL: { + for (TopExp_Explorer anExp(theShape, TopAbs_FACE); anExp.More(); + anExp.Next()) { + collectSubShapes(theBuilder, theCompound, anExp.Current(), + theHiddenSubShapes); } - break; - case TopAbs_SOLID: - case TopAbs_SHELL: { - for (TopExp_Explorer anExp (theShape, TopAbs_FACE); anExp.More(); anExp.Next()) { - collectSubShapes(theBuilder, theCompound, anExp.Current(), theHiddenSubShapes); - } - } - break; - case TopAbs_WIRE: { - for (TopExp_Explorer anExp (theShape, TopAbs_EDGE); anExp.More(); anExp.Next()) { - collectSubShapes(theBuilder, theCompound, anExp.Current(), theHiddenSubShapes); - } - } - break; - case TopAbs_FACE: { - if (theHiddenSubShapes.Contains(theShape)) - return; // remove hidden shape - theBuilder.Add(theCompound, theShape); + } break; + case TopAbs_WIRE: { + for (TopExp_Explorer anExp(theShape, TopAbs_EDGE); anExp.More(); + anExp.Next()) { + collectSubShapes(theBuilder, theCompound, anExp.Current(), + theHiddenSubShapes); } + } break; + case TopAbs_FACE: { + if (theHiddenSubShapes.Contains(theShape)) + return; // remove hidden shape + theBuilder.Add(theCompound, theShape); + } break; + case TopAbs_EDGE: + case TopAbs_VERTEX: { + theBuilder.Add(theCompound, theShape); + } + default: break; - case TopAbs_EDGE: - case TopAbs_VERTEX: { - theBuilder.Add(theCompound, theShape); - } - default: - break; } } //******************************************************************** -void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) -{ +void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer theMode) { if (appendVertexSelection(aSelection, theMode)) return; @@ -423,7 +433,7 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a // TODO: OCCT issue should be created for the COMPOUND processing // before it is fixed, the next workaround in necessary if (theMode == AIS_Shape::SelectionMode(TopAbs_COMPOUND)) { - const TopoDS_Shape& aShape = Shape(); + const TopoDS_Shape &aShape = Shape(); TopExp_Explorer aCompExp(aShape, TopAbs_COMPOUND); // do not activate in compound mode shapes which do not contain compounds if (!aCompExp.More()) @@ -434,18 +444,21 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a // // Limit selection area only by actual object (Shape) // ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult); // if (aCompSolid.get()) { - // std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aCompSolid); - // if (aShapePtr.get()) { + // std::shared_ptr aShapePtr = + // ModelAPI_Tools::shape(aCompSolid); if (aShapePtr.get()) { // TopoDS_Shape aShape = aShapePtr->impl(); - // int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_COMPSOLID); - // /// It is important to have priority for the shape of comp solid result less than priority + // int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, + // TopAbs_COMPSOLID); + // /// It is important to have priority for the shape of comp solid result + // less than priority // /// for the presentation shape which is a sub-result. // /// Reason is to select the sub-objects before: #1592 // aPriority = aPriority - 1; // double aDeflection = Prs3d::GetDeflection(aShape, myDrawer); - // Handle(ModuleBase_BRepOwner) aOwner = new ModuleBase_BRepOwner(aShape, aPriority); - // StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection, + // Handle(ModuleBase_BRepOwner) aOwner = new ModuleBase_BRepOwner(aShape, + // aPriority); StdSelect_BRepSelectionTool::ComputeSensitive(aShape, + // aOwner, aSelection, // aDeflection, myDrawer->HLRAngle(), 9, 500); // for (aSelection->Init(); aSelection->More(); aSelection->Next()) { @@ -461,45 +474,54 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a AIS_Shape::ComputeSelection(aSelection, theMode); if (myAdditionalSelectionPriority > 0) { - NCollection_Vector anEntities = aSelection->Entities(); - for (NCollection_Vector::Iterator anIt(anEntities); - anIt.More(); - anIt.Next()) { + NCollection_Vector anEntities = + aSelection->Entities(); + for (NCollection_Vector::Iterator anIt( + anEntities); + anIt.More(); anIt.Next()) { Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value(); - Handle(SelectBasics_EntityOwner) aBasicsOwner = anEntity->BaseSensitive()->OwnerId(); + Handle(SelectBasics_EntityOwner) aBasicsOwner = + anEntity->BaseSensitive()->OwnerId(); if (!aBasicsOwner.IsNull()) - aBasicsOwner->SetPriority(aBasicsOwner->Priority() + myAdditionalSelectionPriority); + aBasicsOwner->SetPriority(aBasicsOwner->Priority() + + myAdditionalSelectionPriority); } } } //******************************************************************** -bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer /*theMode*/) -{ +bool ModuleBase_ResultPrs::appendVertexSelection( + const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer /*theMode*/) { if (Shape().ShapeType() == TopAbs_VERTEX) { - const TopoDS_Shape& aShape = Shape(); + const TopoDS_Shape &aShape = Shape(); - int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_VERTEX); + int aPriority = + StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_VERTEX); #if OCC_VERSION_HEX > 0x070400 - double aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection(aShape, myDrawer); + double aDeflection = + StdPrs_ToolTriangulatedShape::GetDeflection(aShape, myDrawer); #else double aDeflection = Prs3d::GetDeflection(aShape, myDrawer); #endif - /// The cause of this method is the last parameter of BRep owner setting into True. - /// That means that owner should behave like it comes from decomposition. (In this case, OCCT - /// visualizes it in Ring style) OCCT version is 7.0.0 with path for SHAPER module. - Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(aShape, aPriority, Standard_True); - StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection, - aDeflection, myDrawer->DeviationAngle(), 9, 500); - - - NCollection_Vector anEntities = aSelection->Entities(); - for (NCollection_Vector::Iterator anIt(anEntities); - anIt.More(); - anIt.Next()) { + /// The cause of this method is the last parameter of BRep owner setting + /// into True. That means that owner should behave like it comes from + /// decomposition. (In this case, OCCT visualizes it in Ring style) OCCT + /// version is 7.0.0 with path for SHAPER module. + Handle(StdSelect_BRepOwner) aOwner = + new StdSelect_BRepOwner(aShape, aPriority, Standard_True); + StdSelect_BRepSelectionTool::ComputeSensitive( + aShape, aOwner, aSelection, aDeflection, myDrawer->DeviationAngle(), 9, + 500); + + NCollection_Vector anEntities = + aSelection->Entities(); + for (NCollection_Vector::Iterator anIt( + anEntities); + anIt.More(); anIt.Next()) { Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value(); - Handle(SelectMgr_EntityOwner) anOwner = anEntity->BaseSensitive()->OwnerId(); + Handle(SelectMgr_EntityOwner) anOwner = + anEntity->BaseSensitive()->OwnerId(); anOwner->SetSelectable(this); } @@ -509,9 +531,9 @@ bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selectio } //******************************************************************** -void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, - const SelectMgr_SequenceOfOwner& theOwners) -{ +void ModuleBase_ResultPrs::HilightSelected( + const Handle(PrsMgr_PresentationManager3d) & thePM, + const SelectMgr_SequenceOfOwner &theOwners) { Handle(SelectMgr_EntityOwner) anOwner; Handle(ModuleBase_BRepOwner) aCompOwner; for (int i = 1; i <= theOwners.Length(); i++) { @@ -519,10 +541,9 @@ void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManag aCompOwner = Handle(ModuleBase_BRepOwner)::DownCast(anOwner); if (aCompOwner.IsNull()) { thePM->Color(anOwner->Selectable(), GetContext()->SelectionStyle()); - } - else { + } else { TopoDS_Shape aShape = aCompOwner->Shape(); - Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM ); + Handle(Prs3d_Presentation) aSelectionPrs = GetSelectPresentation(thePM); aSelectionPrs->Clear(); StdPrs_WFShape::Add(aSelectionPrs, aShape, myDrawer); @@ -536,11 +557,12 @@ void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManag } //******************************************************************** -void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& theOwner) -{ - Handle(StdSelect_BRepOwner) aOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); +void ModuleBase_ResultPrs::HilightOwnerWithColor( + const Handle(PrsMgr_PresentationManager3d) & thePM, + const Handle(Prs3d_Drawer) & theStyle, + const Handle(SelectMgr_EntityOwner) & theOwner) { + Handle(StdSelect_BRepOwner) aOwner = + Handle(StdSelect_BRepOwner)::DownCast(theOwner); if (aOwner.IsNull()) return; @@ -548,7 +570,7 @@ void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_Presentatio if (!aShape.IsNull()) { thePM->Color(this, theStyle); - Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM ); + Handle(Prs3d_Presentation) aHilightPrs = GetHilightPresentation(thePM); aHilightPrs->Clear(); StdPrs_WFShape::Add(aHilightPrs, aShape, myDrawer); @@ -559,10 +581,8 @@ void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_Presentatio } } - //******************************************************************** -void ModuleBase_ResultPrs::updateIsoLines() -{ +void ModuleBase_ResultPrs::updateIsoLines() { std::vector aIsoValues; bool isIsoVisible; ModelAPI_Tools::getIsoLines(myResult, isIsoVisible, aIsoValues); @@ -571,13 +591,11 @@ void ModuleBase_ResultPrs::updateIsoLines() aIsoValues.push_back(1); aIsoValues.push_back(1); } - } - else { + } else { if (aIsoValues.size() == 0) { aIsoValues.push_back(0); aIsoValues.push_back(0); - } - else { + } else { aIsoValues[0] = 0; aIsoValues[1] = 0; } diff --git a/src/ModuleBase/ModuleBase_ResultPrs.h b/src/ModuleBase/ModuleBase_ResultPrs.h index 62de743b9..56dcbaa4c 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.h +++ b/src/ModuleBase/ModuleBase_ResultPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ResultPrs_H @@ -27,10 +28,10 @@ #include #include -#include +#include #include #include -#include +#include #include @@ -40,17 +41,18 @@ class AIS_InteractiveContext; DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide specific behaviour -* for wire presentations based in a one plane -*/ -class ModuleBase_ResultPrs: public ViewerData_AISShape -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * specific behaviour for wire presentations based in a one plane + */ +class ModuleBase_ResultPrs : public ViewerData_AISShape { public: enum SelectionModes { - Sel_Result = TopAbs_SHAPE + 1 /// it should be combined with Compsolid results, so it is not - /// the Shape type. It is not defined in XML as compound type - /// because this type is processed as shape with compounds inside. + Sel_Result = + TopAbs_SHAPE + + 1 /// it should be combined with Compsolid results, so it is not + /// the Shape type. It is not defined in XML as compound type + /// because this type is processed as shape with compounds inside. }; public: @@ -59,23 +61,25 @@ public: Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult); //! Method which draws selected owners ( for fast presentation draw ) - Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, - const SelectMgr_SequenceOfOwner& theOwners); + Standard_EXPORT virtual void + HilightSelected(const Handle(PrsMgr_PresentationManager3d) & thePM, + const SelectMgr_SequenceOfOwner &theOwners); //! Method which hilight an owner belonging to //! this selectable object ( for fast presentation draw ) - Standard_EXPORT virtual void HilightOwnerWithColor( - const Handle(PrsMgr_PresentationManager3d)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& theOwner); + Standard_EXPORT virtual void + HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) & thePM, + const Handle(Prs3d_Drawer) & theStyle, + const Handle(SelectMgr_EntityOwner) & theOwner); /// Returns result object Standard_EXPORT ResultPtr getResult() const { return myResult; } /// Returns selection priorities that will be added to created selection owner /// \return integer value - Standard_EXPORT int getAdditionalSelectionPriority() const - { return myAdditionalSelectionPriority; } + Standard_EXPORT int getAdditionalSelectionPriority() const { + return myAdditionalSelectionPriority; + } /// Appends a special priority for the mode of selection /// \param theSelectionMode a mode of selection, used in ComputeSelection @@ -83,34 +87,37 @@ public: Standard_EXPORT void setAdditionalSelectionPriority(const int thePriority); //! Updates color of sub shape drawer - Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor); + Standard_EXPORT virtual void SetColor(const Quantity_Color &theColor); /// Change presentation to have given shape hidden. /// It suports FACE type of the shape to be hidden. - /// If presentation type is greater than FACE, the SHELL with be shown with the FACE hidden - /// It is possible to hide more than one FACE by calling the method with given FACES - /// Visual state of the face is controlled by the second parameter - /// \param theShapes a container of shape objects - /// \returns true if the presentation is changed, or false (if for example it was hidden) - Standard_EXPORT void setSubShapeHidden(const TopoDS_ListOfShape& theShapes); + /// If presentation type is greater than FACE, the SHELL with be shown with + /// the FACE hidden It is possible to hide more than one FACE by calling the + /// method with given FACES Visual state of the face is controlled by the + /// second parameter \param theShapes a container of shape objects \returns + /// true if the presentation is changed, or false (if for example it was + /// hidden) + Standard_EXPORT void setSubShapeHidden(const TopoDS_ListOfShape &theShapes); /// Returns true if parameter shape has been hidden /// \param theShape sub-shape of the presentation shape /// \return boolean value - Standard_EXPORT bool isSubShapeHidden(const TopoDS_Shape& theShape); + Standard_EXPORT bool isSubShapeHidden(const TopoDS_Shape &theShape); /// Returns hidden sub shapes list - Standard_EXPORT const TopoDS_ListOfShape& hiddenSubShapes() const - { return myHiddenSubShapes; } - - /// Returns true if there are no hidden sub shapes or original shape has at least one not hidden - /// \param theShapesToSkip container of shape to be hidden in the presentation (faces) - /// \return boolean value - Standard_EXPORT bool hasSubShapeVisible(const TopoDS_ListOfShape& theShapesToSkip); - - /// Set transparency of hidden sub shapes: if value is 1, shapes are entirely hidden - /// \param theTransparency transparency value - /// \return false if parameter is out of [0, 1] + Standard_EXPORT const TopoDS_ListOfShape &hiddenSubShapes() const { + return myHiddenSubShapes; + } + + /// Returns true if there are no hidden sub shapes or original shape has at + /// least one not hidden \param theShapesToSkip container of shape to be + /// hidden in the presentation (faces) \return boolean value + Standard_EXPORT bool + hasSubShapeVisible(const TopoDS_ListOfShape &theShapesToSkip); + + /// Set transparency of hidden sub shapes: if value is 1, shapes are entirely + /// hidden \param theTransparency transparency value \return false if + /// parameter is out of [0, 1] Standard_EXPORT bool setHiddenSubShapeTransparency(double theTransparency); /// Returns the original shape of the presentation @@ -125,22 +132,23 @@ public: protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) ; + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer theMode); private: - /// If the shape of this presentation is Vertex, it appends custom sensitive and owners for it. - /// Owner is a usual Brep owner with "isDecomposite" in true. It is necessary to have "Ring" - /// highlight/selected marker. - /// \param theSelection a current filled selection - /// \param theMode a selection mode + /// If the shape of this presentation is Vertex, it appends custom sensitive + /// and owners for it. Owner is a usual Brep owner with "isDecomposite" in + /// true. It is necessary to have "Ring" highlight/selected marker. \param + /// theSelection a current filled selection \param theMode a selection mode /// \return true if the owner is created - bool appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection, + bool appendVertexSelection(const Handle(SelectMgr_Selection) & aSelection, const Standard_Integer theMode); /// Creates compound of vertices, edges and faces. @@ -151,8 +159,9 @@ private: /// \param theCompound the result shape /// \param theShape the processed shape /// \param theHiddenSubShapes container of shapes to be skipped (faces) - void collectSubShapes(BRep_Builder& theBuilder, TopoDS_Shape& theCompound, - const TopoDS_Shape& theShape, const TopoDS_ListOfShape& theHiddenSubShapes); + void collectSubShapes(BRep_Builder &theBuilder, TopoDS_Shape &theCompound, + const TopoDS_Shape &theShape, + const TopoDS_ListOfShape &theHiddenSubShapes); void setEdgesDefaultColor(); @@ -168,9 +177,11 @@ private: /// Container of original Shape sub shape to be hidden and not selectable TopoDS_ListOfShape myHiddenSubShapes; TopoDS_Compound myVisibleCompound; /// compound of hidden sub shapes - TopoDS_Compound myHiddenCompound; /// compound of hidden sub shapes - double myTransparency; ///< transparency of hidden shapes, where 0 - there is no transparency - Handle(AIS_ColoredDrawer) myHiddenSubShapesDrawer; ///< drawer for hidden sub shapes + TopoDS_Compound myHiddenCompound; /// compound of hidden sub shapes + double myTransparency; ///< transparency of hidden shapes, where 0 - there is + ///< no transparency + Handle(AIS_ColoredDrawer) + myHiddenSubShapesDrawer; ///< drawer for hidden sub shapes /// selection priority that will be added to the standard /// selection priority of the selection entity @@ -180,5 +191,4 @@ private: Handle(Prs3d_IsoAspect) myVIsoAspect; }; - -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_SelectionFilterType.h b/src/ModuleBase/ModuleBase_SelectionFilterType.h index f420c3763..695c52024 100644 --- a/src/ModuleBase/ModuleBase_SelectionFilterType.h +++ b/src/ModuleBase/ModuleBase_SelectionFilterType.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_SelectionFilterType_H @@ -24,10 +25,11 @@ /// Enumeration to specify module selection filters enum MODULEBASE_EXPORT ModuleBase_SelectionFilterType { - SF_GlobalFilter, /// filter for different documents, group results - SF_FilterInfinite, /// filter for infinite construction results - SF_ResultGroupNameFilter, /// filter for selection some kind of results - SF_SketchCirclePointFilter, /// filter for selection circle points on current sketch + SF_GlobalFilter, /// filter for different documents, group results + SF_FilterInfinite, /// filter for infinite construction results + SF_ResultGroupNameFilter, /// filter for selection some kind of results + SF_SketchCirclePointFilter, /// filter for selection circle points on current + /// sketch SF_SketchPlaneFilter /// filter for selection in the current sketch plane only }; diff --git a/src/ModuleBase/ModuleBase_SelectionValidator.cpp b/src/ModuleBase/ModuleBase_SelectionValidator.cpp index ff06a4c6c..d71dde72f 100644 --- a/src/ModuleBase/ModuleBase_SelectionValidator.cpp +++ b/src/ModuleBase/ModuleBase_SelectionValidator.cpp @@ -14,14 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include - -bool ModuleBase_SelectionValidator::isValid(const ModuleBase_ISelection* /*theSelection*/, - ModuleBase_Operation* /*theOperation*/) const -{ +bool ModuleBase_SelectionValidator::isValid( + const ModuleBase_ISelection * /*theSelection*/, + ModuleBase_Operation * /*theOperation*/) const { return true; } diff --git a/src/ModuleBase/ModuleBase_SelectionValidator.h b/src/ModuleBase/ModuleBase_SelectionValidator.h index 8aeabc512..b9af02869 100644 --- a/src/ModuleBase/ModuleBase_SelectionValidator.h +++ b/src/ModuleBase/ModuleBase_SelectionValidator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_SelectionValidator_H @@ -30,17 +31,17 @@ #include /** -* \ingroup Validators -* A validator of selection -*/ -class MODULEBASE_EXPORT ModuleBase_SelectionValidator : public ModelAPI_Validator -{ + * \ingroup Validators + * A validator of selection + */ +class MODULEBASE_EXPORT ModuleBase_SelectionValidator + : public ModelAPI_Validator { public: - /// Returns True if selection is valid - /// \param theSelection selection instance - /// \param theOperation - current operation (can be 0) - virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + /// Returns True if selection is valid + /// \param theSelection selection instance + /// \param theOperation - current operation (can be 0) + virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; #endif diff --git a/src/ModuleBase/ModuleBase_ToolBox.cpp b/src/ModuleBase/ModuleBase_ToolBox.cpp index 7a62ca778..399121874 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.cpp +++ b/src/ModuleBase/ModuleBase_ToolBox.cpp @@ -14,27 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include -#include #include -#include +#include #include +#include #include -const QString AStyle = "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}"; - +const QString AStyle = + "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}"; -ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget* theParent, const bool theUseFrameStyleBox) -: QFrame(theParent) -{ - QVBoxLayout* aMainLayout = new QVBoxLayout(this); +ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget *theParent, + const bool theUseFrameStyleBox) + : QFrame(theParent) { + QVBoxLayout *aMainLayout = new QVBoxLayout(this); aMainLayout->setMargin(0); aMainLayout->setSpacing(2); @@ -57,21 +58,21 @@ ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget* theParent, const bool theUseFram myButtonsLayout->setSpacing(5); myButtonsLayout->addStretch(1); - connect(myStack, SIGNAL(currentChanged(int)), this, SIGNAL(currentChanged(int))); - connect(myButtonsGroup, SIGNAL(buttonPressed(int)), this, SLOT(onButton(int))); + connect(myStack, SIGNAL(currentChanged(int)), this, + SIGNAL(currentChanged(int))); + connect(myButtonsGroup, SIGNAL(buttonPressed(int)), this, + SLOT(onButton(int))); } -ModuleBase_ToolBox::~ModuleBase_ToolBox() -{ -} +ModuleBase_ToolBox::~ModuleBase_ToolBox() {} -void ModuleBase_ToolBox::addItem(QWidget* thePage, const QString& theName, const QPixmap& theIcon) -{ +void ModuleBase_ToolBox::addItem(QWidget *thePage, const QString &theName, + const QPixmap &theIcon) { int anOldCount = myStack->count(); myStack->addWidget(thePage); - QToolButton* aButton = new QToolButton(myButtonsFrame); + QToolButton *aButton = new QToolButton(myButtonsFrame); aButton->setFocusPolicy(Qt::StrongFocus); aButton->setCheckable(true); aButton->setStyleSheet(AStyle); @@ -87,45 +88,36 @@ void ModuleBase_ToolBox::addItem(QWidget* thePage, const QString& theName, const myButtonsLayout->insertWidget(anOldCount, aButton); } -int ModuleBase_ToolBox::count() const -{ - return myStack->count(); -} +int ModuleBase_ToolBox::count() const { return myStack->count(); } -int ModuleBase_ToolBox::currentIndex() const -{ - return myStack->currentIndex(); -} +int ModuleBase_ToolBox::currentIndex() const { return myStack->currentIndex(); } -void ModuleBase_ToolBox::setCurrentIndex(const int theIndex) -{ +void ModuleBase_ToolBox::setCurrentIndex(const int theIndex) { myStack->setCurrentIndex(theIndex); myButtonsGroup->button(theIndex)->setChecked(true); } -void ModuleBase_ToolBox::onButton(int theIndex) -{ +void ModuleBase_ToolBox::onButton(int theIndex) { myStack->setCurrentIndex(theIndex); } -bool ModuleBase_ToolBox::isOffToolBoxParent(ModuleBase_ModelWidget* theWidget) -{ +bool ModuleBase_ToolBox::isOffToolBoxParent(ModuleBase_ModelWidget *theWidget) { bool isOffToolBox = false; - QList aControls = theWidget->getControls(); + QList aControls = theWidget->getControls(); if (aControls.size() > 0) { - QWidget* aFirstControl = aControls.first(); + QWidget *aFirstControl = aControls.first(); - QWidget* aWidget = aFirstControl; - QWidget* aParent = (QWidget*)aFirstControl->parent(); + QWidget *aWidget = aFirstControl; + QWidget *aParent = (QWidget *)aFirstControl->parent(); while (aParent) { - QStackedWidget* aStackedWidget = dynamic_cast(aParent); + QStackedWidget *aStackedWidget = dynamic_cast(aParent); if (aStackedWidget) { isOffToolBox = aStackedWidget->currentWidget() != aWidget; break; } aWidget = aParent; - aParent = (QWidget*)aWidget->parent(); + aParent = (QWidget *)aWidget->parent(); } } return isOffToolBox; diff --git a/src/ModuleBase/ModuleBase_ToolBox.h b/src/ModuleBase/ModuleBase_ToolBox.h index c41fd5a26..7abac5d44 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.h +++ b/src/ModuleBase/ModuleBase_ToolBox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ToolBox_H @@ -34,8 +35,7 @@ class ModuleBase_ModelWidget; * \ingroup GUI * \brief An extension of QFrame object */ -class MODULEBASE_EXPORT ModuleBase_ToolBox : public QFrame -{ +class MODULEBASE_EXPORT ModuleBase_ToolBox : public QFrame { Q_OBJECT public: @@ -43,14 +43,16 @@ public: /// \param theParent a parent widget /// \param theUseFrameStyleBox a flag if the tool box should have box covered /// buttons and current page - ModuleBase_ToolBox(QWidget* theParent, const bool theUseFrameStyleBox = false); + ModuleBase_ToolBox(QWidget *theParent, + const bool theUseFrameStyleBox = false); virtual ~ModuleBase_ToolBox(); /// Add a new item to the tool box /// \param thePage a widget of the new item /// \param theName a name of the item /// \param theIcon an icon of the item - void addItem(QWidget* thePage, const QString& theName, const QPixmap& theIcon); + void addItem(QWidget *thePage, const QString &theName, + const QPixmap &theIcon); /// \return number of items int count() const; @@ -63,10 +65,9 @@ public: void setCurrentIndex(const int theIdx); /// Found in the controls of the model widget parent in Stacked Widget - /// returns whether this controls are in the current widget of the stacked widgets - /// \param theWidget a model widget - /// \return boolean result - static bool isOffToolBoxParent(ModuleBase_ModelWidget* theWidget); + /// returns whether this controls are in the current widget of the stacked + /// widgets \param theWidget a model widget \return boolean result + static bool isOffToolBoxParent(ModuleBase_ModelWidget *theWidget); signals: /// A signal which is emited on current item changed @@ -77,9 +78,9 @@ private slots: void onButton(int); private: - QButtonGroup* myButtonsGroup; - QFrame* myButtonsFrame; - QHBoxLayout* myButtonsLayout; - QStackedWidget* myStack; + QButtonGroup *myButtonsGroup; + QFrame *myButtonsFrame; + QHBoxLayout *myButtonsLayout; + QStackedWidget *myStack; }; #endif diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 9afabf394..347fdf705 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -14,44 +14,45 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_Tools.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 @@ -63,38 +64,38 @@ #include #endif -#include -#include #include #include #include +#include +#include -#include #include #include +#include #include #include -#include #include +#include #include -#include -#include -#include +#include +#include #include +#include +#include #include #include -#include -#include +#include #include -#include +#include +#include #include +#include #include -#include -#include #include #include @@ -110,99 +111,92 @@ const double DEFAULT_DEVIATION_COEFFICIENT = 1.e-4; //#define DEBUG_SET_FOCUS #ifdef WIN32 -# define FSEP "\\" +#define FSEP "\\" #else -# define FSEP "/" +#define FSEP "/" #endif namespace ModuleBase_Tools { //****************************************************************** - //! Waits for REDISPLAY message and set the Visible flag to the entities - //! according to Preferences choice. - class ModuleBase_RedisplayListener : public Events_Listener - { - public: - static std::shared_ptr instance() - { - static std::shared_ptr - anInstance(new ModuleBase_RedisplayListener); - return anInstance; - } +//! Waits for REDISPLAY message and set the Visible flag to the entities +//! according to Preferences choice. +class ModuleBase_RedisplayListener : public Events_Listener { +public: + static std::shared_ptr instance() { + static std::shared_ptr anInstance( + new ModuleBase_RedisplayListener); + return anInstance; + } - void processEvent(const std::shared_ptr& theMessage) - { - if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)) - { + void processEvent(const std::shared_ptr &theMessage) { + if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)) { #if HAVE_SALOME - // If the python script is being loaded now, the preferences should be used - // to display the required object - SUIT_Session* aSession = SUIT_Session::session(); - if (!aSession) - return; - SUIT_Application * anApp = aSession->activeApplication(); - if (!anApp) - return; - QVariant aVar = anApp->property("IsLoadedScript"); - if (!aVar.isNull() && aVar.toBool()) { - DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); - int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); - if (aSize > 0) { - ObjectPtr anPartObject = aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); - ResultPartPtr aPart = std::dynamic_pointer_cast(anPartObject); - ModuleBase_Tools::setDisplaying(aPart, true); - } + // If the python script is being loaded now, the preferences should be + // used to display the required object + SUIT_Session *aSession = SUIT_Session::session(); + if (!aSession) + return; + SUIT_Application *anApp = aSession->activeApplication(); + if (!anApp) + return; + QVariant aVar = anApp->property("IsLoadedScript"); + if (!aVar.isNull() && aVar.toBool()) { + DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); + int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); + if (aSize > 0) { + ObjectPtr anPartObject = + aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); + ResultPartPtr aPart = + std::dynamic_pointer_cast(anPartObject); + ModuleBase_Tools::setDisplaying(aPart, true); } -#endif } +#endif } + } - private: - ModuleBase_RedisplayListener() - { - Events_Loop::loop()->registerListener(this, - Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - } - }; +private: + ModuleBase_RedisplayListener() { + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + } +}; - static std::shared_ptr - RL = ModuleBase_RedisplayListener::instance(); +static std::shared_ptr RL = + ModuleBase_RedisplayListener::instance(); //****************************************************************** -void adjustMargins(QWidget* theWidget) -{ - if(!theWidget) +void adjustMargins(QWidget *theWidget) { + if (!theWidget) return; adjustMargins(theWidget->layout()); } -void adjustMargins(QLayout* theLayout) -{ - if(!theLayout) +void adjustMargins(QLayout *theLayout) { + if (!theLayout) return; theLayout->setContentsMargins(2, 5, 2, 5); theLayout->setSpacing(4); } -void zeroMargins(QWidget* theWidget) -{ - if(!theWidget) +void zeroMargins(QWidget *theWidget) { + if (!theWidget) return; zeroMargins(theWidget->layout()); } -void zeroMargins(QLayout* theLayout) -{ - if(!theLayout) +void zeroMargins(QLayout *theLayout) { + if (!theLayout) return; theLayout->setContentsMargins(0, 0, 0, 0); theLayout->setSpacing(5); } -void activateWindow(QWidget* theWidget, const QString& theInfo) -{ +void activateWindow(QWidget *theWidget, const QString &theInfo) { if (theWidget) { theWidget->activateWindow(); theWidget->raise(); @@ -213,8 +207,7 @@ void activateWindow(QWidget* theWidget, const QString& theInfo) #endif } -void setFocus(QWidget* theWidget, const QString& theInfo) -{ +void setFocus(QWidget *theWidget, const QString &theInfo) { activateWindow(theWidget); theWidget->setFocus(); // rectangle of focus is not visible on tool button widgets @@ -224,32 +217,28 @@ void setFocus(QWidget* theWidget, const QString& theInfo) #endif } -void setShadowEffect(QWidget* theWidget, const bool isSetEffect) -{ +void setShadowEffect(QWidget *theWidget, const bool isSetEffect) { if (isSetEffect) { - QGraphicsDropShadowEffect* aGlowEffect = new QGraphicsDropShadowEffect(); + QGraphicsDropShadowEffect *aGlowEffect = new QGraphicsDropShadowEffect(); aGlowEffect->setOffset(.0); aGlowEffect->setBlurRadius(10.0); aGlowEffect->setColor(QColor(0, 170, 255)); // Light-blue color, #00AAFF theWidget->setGraphicsEffect(aGlowEffect); - } - else { - QGraphicsEffect* anEffect = theWidget->graphicsEffect(); - if(anEffect) + } else { + QGraphicsEffect *anEffect = theWidget->graphicsEffect(); + if (anEffect) anEffect->deleteLater(); theWidget->setGraphicsEffect(NULL); } } -QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon) -{ +QPixmap composite(const QString &theAdditionalIcon, const QString &theIcon) { QImage anIcon = ModuleBase_IconFactory::loadImage(theIcon); QImage anAditional(theAdditionalIcon); return composite(anAditional, anIcon); } -QPixmap composite(const QImage& theAdditionalIcon, QImage& theIcon) -{ +QPixmap composite(const QImage &theAdditionalIcon, QImage &theIcon) { if (theIcon.isNull()) return QPixmap(); @@ -262,42 +251,38 @@ QPixmap composite(const QImage& theAdditionalIcon, QImage& theIcon) int aStartWidthPos = aWidth - anAddWidth; int aStartHeightPos = aHeight - anAddHeight; - for (int i = 0; i < anAddWidth && i + aStartWidthPos < aWidth; i++) - { - for (int j = 0; j < anAddHeight && j + aStartHeightPos < aHeight; j++) - { + for (int i = 0; i < anAddWidth && i + aStartWidthPos < aWidth; i++) { + for (int j = 0; j < anAddHeight && j + aStartHeightPos < aHeight; j++) { if (qAlpha(theAdditionalIcon.pixel(i, j)) > 0) - theIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, theAdditionalIcon.pixel(i, j)); + theIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, + theAdditionalIcon.pixel(i, j)); } } return QPixmap::fromImage(theIcon); } -QPixmap lighter(const QString& theIcon, const int theLighterValue) -{ +QPixmap lighter(const QString &theIcon, const int theLighterValue) { QImage anIcon = ModuleBase_IconFactory::loadImage(theIcon); if (anIcon.isNull()) return QPixmap(); QImage aResult = ModuleBase_IconFactory::loadImage(theIcon); - for (int i = 0; i < anIcon.width(); i++) - { - for (int j = 0; j < anIcon.height(); j++) - { + for (int i = 0; i < anIcon.width(); i++) { + for (int j = 0; j < anIcon.height(); j++) { QRgb anRgb = anIcon.pixel(i, j); QColor aPixelColor(qRed(anRgb), qGreen(anRgb), qBlue(anRgb), qAlpha(aResult.pixel(i, j))); QColor aLighterColor = aPixelColor.lighter(theLighterValue); - aResult.setPixel(i, j, qRgba(aLighterColor.red(), aLighterColor.green(), - aLighterColor.blue(), aLighterColor.alpha())); + aResult.setPixel(i, j, + qRgba(aLighterColor.red(), aLighterColor.green(), + aLighterColor.blue(), aLighterColor.alpha())); } } return QPixmap::fromImage(aResult); } -void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText) -{ +void setSpinText(ModuleBase_ParamSpinBox *theSpin, const QString &theText) { if (theSpin->text() == theText) return; // In order to avoid extra text setting because it will @@ -307,8 +292,7 @@ void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText) theSpin->blockSignals(isBlocked); } -void setSpinValue(QDoubleSpinBox* theSpin, double theValue) -{ +void setSpinValue(QDoubleSpinBox *theSpin, double theValue) { if (fabs(theSpin->value() - theValue) < tolerance) return; bool isBlocked = theSpin->blockSignals(true); @@ -316,17 +300,16 @@ void setSpinValue(QDoubleSpinBox* theSpin, double theValue) theSpin->blockSignals(isBlocked); } -void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue) -{ - if (!theSpin->text().isEmpty() && fabs(theSpin->value() - theValue) < tolerance) +void setSpinValue(ModuleBase_ParamSpinBox *theSpin, double theValue) { + if (!theSpin->text().isEmpty() && + fabs(theSpin->value() - theValue) < tolerance) return; bool isBlocked = theSpin->blockSignals(true); theSpin->setValue(theValue); theSpin->blockSignals(isBlocked); } -void setSpinText(ModuleBase_ParamIntSpinBox* theSpin, const QString& theText) -{ +void setSpinText(ModuleBase_ParamIntSpinBox *theSpin, const QString &theText) { // In order to avoid extra text setting because it will // reset cursor position in control if (theSpin->text() == theText) @@ -336,8 +319,7 @@ void setSpinText(ModuleBase_ParamIntSpinBox* theSpin, const QString& theText) theSpin->blockSignals(isBlocked); } -void setSpinValue(ModuleBase_ParamIntSpinBox* theSpin, int theValue) -{ +void setSpinValue(ModuleBase_ParamIntSpinBox *theSpin, int theValue) { if (theSpin->value() == theValue) return; bool isBlocked = theSpin->blockSignals(true); @@ -345,15 +327,15 @@ void setSpinValue(ModuleBase_ParamIntSpinBox* theSpin, int theValue) theSpin->blockSignals(isBlocked); } -QAction* createAction(const QIcon& theIcon, const QString& theText, - QObject* theParent, const QObject* theReceiver, - const char* theMember, const QString& theToolTip, - const QString& theStatusTip) -{ - QAction* anAction = new QAction(theIcon, theText, theParent); +QAction *createAction(const QIcon &theIcon, const QString &theText, + QObject *theParent, const QObject *theReceiver, + const char *theMember, const QString &theToolTip, + const QString &theStatusTip) { + QAction *anAction = new QAction(theIcon, theText, theParent); anAction->setToolTip(theToolTip.isEmpty() ? theText : theToolTip); - anAction->setStatusTip(!theStatusTip.isEmpty() ? theStatusTip : - (!theToolTip.isEmpty() ? theToolTip : theText)); + anAction->setStatusTip(!theStatusTip.isEmpty() + ? theStatusTip + : (!theToolTip.isEmpty() ? theToolTip : theText)); if (theReceiver) QObject::connect(anAction, SIGNAL(triggered(bool)), theReceiver, theMember); @@ -361,16 +343,14 @@ QAction* createAction(const QIcon& theIcon, const QString& theText, } #ifdef _DEBUG -QString objectName(const ObjectPtr& theObj) -{ +QString objectName(const ObjectPtr &theObj) { if (!theObj.get()) return ""; return QString::fromStdWString(theObj->data()->name()); } -QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo) -{ +QString objectInfo(const ObjectPtr &theObj, const bool isUseAttributesInfo) { QString aFeatureStr = "feature"; if (!theObj.get()) return aFeatureStr; @@ -380,8 +360,9 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo) ResultPtr aRes = std::dynamic_pointer_cast(theObj); FeaturePtr aFeature = std::dynamic_pointer_cast(theObj); - if(aRes.get()) { - aFeatureStr.append(QString("(result%1)").arg(aPtrStr.str().c_str()).toStdString() .c_str()); + if (aRes.get()) { + aFeatureStr.append( + QString("(result%1)").arg(aPtrStr.str().c_str()).toStdString().c_str()); if (aRes->isDisabled()) aFeatureStr.append("[disabled]"); if (aRes->isConcealed()) @@ -390,23 +371,29 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo) aFeatureStr.append("[hasSubResults]"); aFeature = ModelAPI_Feature::feature(aRes); - } - else + } else aFeatureStr.append(aPtrStr.str().c_str()); if (aFeature.get()) { - aFeatureStr.append(QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str()); + aFeatureStr.append( + QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str()); if (aFeature->data()->isValid()) { - aFeatureStr.append(QString(", name=%1") - .arg(QString::fromStdWString(theObj->data()->name())).toStdString().c_str()); + aFeatureStr.append( + QString(", name=%1") + .arg(QString::fromStdWString(theObj->data()->name())) + .toStdString() + .c_str()); } if (isUseAttributesInfo) { - std::set > anAttributes; - std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(aFeature, - anAttributes).c_str(); + std::set> anAttributes; + std::string aPointsInfo = + ModelGeomAlgo_Point2D::getPontAttributesInfo(aFeature, anAttributes) + .c_str(); if (!aPointsInfo.empty()) aFeatureStr.append(QString(", attributes: %1") - .arg(aPointsInfo.c_str()).toStdString().c_str()); + .arg(aPointsInfo.c_str()) + .toStdString() + .c_str()); } } @@ -417,39 +404,40 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo) typedef QMap ShapeTypes; static ShapeTypes myShapeTypes; -int shapeType(const QString& theType) -{ +int shapeType(const QString &theType) { if (myShapeTypes.count() == 0) { - myShapeTypes["compound"] = TopAbs_COMPOUND; - myShapeTypes["compounds"] = TopAbs_COMPOUND; - myShapeTypes["compsolid"] = TopAbs_COMPSOLID; + myShapeTypes["compound"] = TopAbs_COMPOUND; + myShapeTypes["compounds"] = TopAbs_COMPOUND; + myShapeTypes["compsolid"] = TopAbs_COMPSOLID; myShapeTypes["compsolids"] = TopAbs_COMPSOLID; - myShapeTypes["solid"] = TopAbs_SOLID; - myShapeTypes["solids"] = TopAbs_SOLID; - myShapeTypes["shell"] = TopAbs_SHELL; - myShapeTypes["shells"] = TopAbs_SHELL; - myShapeTypes["face"] = TopAbs_FACE; - myShapeTypes["faces"] = TopAbs_FACE; - myShapeTypes["wire"] = TopAbs_WIRE; - myShapeTypes["wires"] = TopAbs_WIRE; - myShapeTypes["edge"] = TopAbs_EDGE; - myShapeTypes["edges"] = TopAbs_EDGE; - myShapeTypes["vertex"] = TopAbs_VERTEX; - myShapeTypes["vertices"] = TopAbs_VERTEX; - myShapeTypes["object"] = ModuleBase_ResultPrs::Sel_Result; - myShapeTypes["objects"] = ModuleBase_ResultPrs::Sel_Result; + myShapeTypes["solid"] = TopAbs_SOLID; + myShapeTypes["solids"] = TopAbs_SOLID; + myShapeTypes["shell"] = TopAbs_SHELL; + myShapeTypes["shells"] = TopAbs_SHELL; + myShapeTypes["face"] = TopAbs_FACE; + myShapeTypes["faces"] = TopAbs_FACE; + myShapeTypes["wire"] = TopAbs_WIRE; + myShapeTypes["wires"] = TopAbs_WIRE; + myShapeTypes["edge"] = TopAbs_EDGE; + myShapeTypes["edges"] = TopAbs_EDGE; + myShapeTypes["vertex"] = TopAbs_VERTEX; + myShapeTypes["vertices"] = TopAbs_VERTEX; + myShapeTypes["object"] = ModuleBase_ResultPrs::Sel_Result; + myShapeTypes["objects"] = ModuleBase_ResultPrs::Sel_Result; } QString aType = theType.toLower(); - if(myShapeTypes.contains(aType)) + if (myShapeTypes.contains(aType)) return myShapeTypes[aType]; - Events_InfoMessage("ModuleBase_Tools", "Shape type defined in XML is not implemented!").send(); + Events_InfoMessage("ModuleBase_Tools", + "Shape type defined in XML is not implemented!") + .send(); return TopAbs_SHAPE; } -void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, - bool& hasParameter, bool& hasCompositeOwner, bool& hasResultInHistory, - bool& hasFolder, bool &hasGroupsOnly) -{ +void checkObjects(const QObjectPtrList &theObjects, bool &hasResult, + bool &hasFeature, bool &hasParameter, bool &hasCompositeOwner, + bool &hasResultInHistory, bool &hasFolder, + bool &hasGroupsOnly) { hasResult = false; hasFeature = false; hasParameter = false; @@ -457,13 +445,17 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe hasResultInHistory = false; hasFolder = false; bool hasNonGroup = false; - foreach(ObjectPtr aObj, theObjects) { + foreach (ObjectPtr aObj, theObjects) { FeaturePtr aFeature = std::dynamic_pointer_cast(aObj); ResultPtr aResult = std::dynamic_pointer_cast(aObj); - ResultGroupPtr aGroup = std::dynamic_pointer_cast(aObj); + ResultGroupPtr aGroup = + std::dynamic_pointer_cast(aObj); FolderPtr aFolder = std::dynamic_pointer_cast(aObj); - ResultParameterPtr aConstruction = std::dynamic_pointer_cast(aResult); - FieldStepPtr aStep = std::dynamic_pointer_cast(aObj); + ResultParameterPtr aConstruction = + std::dynamic_pointer_cast(aResult); + FieldStepPtr aStep = + std::dynamic_pointer_cast( + aObj); hasResult |= ((aResult.get() != NULL) || (aStep.get() != NULL)); hasFeature |= (aFeature.get() != NULL); @@ -480,15 +472,15 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe hasResultInHistory = aFeature.get() && aFeature->isInHistory(); } - if (hasFeature && hasResult && hasParameter && hasCompositeOwner && hasNonGroup) + if (hasFeature && hasResult && hasParameter && hasCompositeOwner && + hasNonGroup) break; } hasGroupsOnly = !hasNonGroup; } -void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape, - const Handle(Prs3d_Drawer)& theDrawer) -{ +void setDefaultDeviationCoefficient(const TopoDS_Shape &theShape, + const Handle(Prs3d_Drawer) & theDrawer) { if (theShape.IsNull()) return; if (theDrawer.IsNull()) @@ -497,60 +489,60 @@ void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape, std::shared_ptr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(theShape)); - // if the shape could not be exploded on faces, it contains only wires, edges, and vertices - // correction of deviation for them should not influence to the application performance + // if the shape could not be exploded on faces, it contains only wires, edges, + // and vertices correction of deviation for them should not influence to the + // application performance GeomAPI_ShapeExplorer anExp(aGeomShape, GeomAPI_Shape::FACE); bool isConstruction = !anExp.more(); double aDeflection; if (isConstruction) - aDeflection = Config_PropManager::real("Visualization", "construction_deflection"); + aDeflection = + Config_PropManager::real("Visualization", "construction_deflection"); else aDeflection = Config_PropManager::real("Visualization", "body_deflection"); theDrawer->SetDeviationCoefficient(aDeflection); } -Quantity_Color color(const std::string& theSection, - const std::string& theName) -{ +Quantity_Color color(const std::string &theSection, + const std::string &theName) { std::vector aColor = Config_PropManager::color(theSection, theName); - return Quantity_Color(aColor[0] / 255., aColor[1] / 255., aColor[2] / 255., Quantity_TOC_RGB); + return Quantity_Color(aColor[0] / 255., aColor[1] / 255., aColor[2] / 255., + Quantity_TOC_RGB); } -ObjectPtr getObject(const AttributePtr& theAttribute) -{ +ObjectPtr getObject(const AttributePtr &theAttribute) { ObjectPtr anObject; std::string anAttrType = theAttribute->attributeType(); if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (anAttr != NULL && anAttr->isObject()) anObject = anAttr->object(); } if (anAttrType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (anAttr != NULL) anObject = anAttr->context(); } if (anAttrType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (anAttr.get() != NULL) anObject = anAttr->value(); } return anObject; } -TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape) -{ +TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape &theShape) { TopAbs_ShapeEnum aShapeType = theShape.ShapeType(); // for compounds check sub-shapes: it may be compound of needed type: // Booleans may produce compounds of Solids if (aShapeType == TopAbs_COMPOUND) { - for(TopoDS_Iterator aSubs(theShape); aSubs.More(); aSubs.Next()) { + for (TopoDS_Iterator aSubs(theShape); aSubs.More(); aSubs.Next()) { if (!aSubs.Value().IsNull()) { TopAbs_ShapeEnum aSubType = aSubs.Value().ShapeType(); if (aSubType == TopAbs_COMPOUND) { // compound of compound(s) @@ -559,7 +551,8 @@ TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape) } if (aShapeType == TopAbs_COMPOUND) { aShapeType = aSubType; - } else if (aShapeType != aSubType) { // compound of shapes of different types + } else if (aShapeType != + aSubType) { // compound of shapes of different types aShapeType = TopAbs_COMPOUND; break; } @@ -569,20 +562,20 @@ TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape) return aShapeType; } -TopoDS_Shape getSelectedShape(const std::shared_ptr& thePrs) -{ +TopoDS_Shape +getSelectedShape(const std::shared_ptr &thePrs) { if (thePrs->shape().get()) return thePrs->shape()->impl(); - Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); + Handle(StdSelect_BRepOwner) anOwner = + Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); if (!anOwner.IsNull()) return anOwner->Shape(); return TopoDS_Shape(); } -void getParameters(QStringList& theParameters) -{ +void getParameters(QStringList &theParameters) { theParameters.clear(); SessionPtr aSession = ModelAPI_Session::get(); @@ -594,7 +587,8 @@ void getParameters(QStringList& theParameters) aDocList.push_back(aRootDocument); } std::string aGroupId = ModelAPI_ResultParameter::group(); - for(std::list::const_iterator it = aDocList.begin(); it != aDocList.end(); ++it) { + for (std::list::const_iterator it = aDocList.begin(); + it != aDocList.end(); ++it) { DocumentPtr aDocument = *it; int aSize = aDocument->size(aGroupId); for (int i = 0; i < aSize; i++) { @@ -605,13 +599,13 @@ void getParameters(QStringList& theParameters) } } -std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop, - const FeaturePtr& theFeature) -{ +std::string findGreedAttribute(ModuleBase_IWorkshop *theWorkshop, + const FeaturePtr &theFeature) { std::string anAttributeId; std::string aXmlCfg, aDescription; - theWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, aDescription); + theWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, + aDescription); ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop); std::string anAttributeTitle; @@ -620,11 +614,9 @@ std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop, return anAttributeId; } -bool hasObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, - const std::shared_ptr& theShape, - ModuleBase_IWorkshop* theWorkshop, - const bool theTemporarily) -{ +bool hasObject(const AttributePtr &theAttribute, const ObjectPtr &theObject, + const std::shared_ptr &theShape, + ModuleBase_IWorkshop *theWorkshop, const bool theTemporarily) { bool aHasObject = false; if (!theAttribute.get()) return aHasObject; @@ -632,26 +624,26 @@ bool hasObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, std::string aType = theAttribute->attributeType(); if (aType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr aRef = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ObjectPtr aObject = aRef->value(); aHasObject = aObject && aObject->isSame(theObject); - //if (!(aObject && aObject->isSame(theObject))) { - // aRef->setValue(theObject); - //} + // if (!(aObject && aObject->isSame(theObject))) { + // aRef->setValue(theObject); + // } } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); - AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape); + AttributePtr anAttribute = + theWorkshop->module()->findAttribute(theObject, theShape); if (anAttribute.get()) { - //aRefAttr->setAttr(anAttribute); - } - else { + // aRefAttr->setAttr(anAttribute); + } else { ObjectPtr aObject = aRefAttr->object(); aHasObject = aObject && aObject->isSame(theObject); - //if (!(aObject && aObject->isSame(theObject))) { - // aRefAttr->setObject(theObject); - //} + // if (!(aObject && aObject->isSame(theObject))) { + // aRefAttr->setObject(theObject); + // } } } else if (aType == ModelAPI_AttributeSelection::typeId()) { /*AttributeSelectionPtr aSelectAttr = @@ -663,39 +655,41 @@ bool hasObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, } if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(theAttribute); - aHasObject = aSelectionListAttr->isInList(theObject, theShape, theTemporarily); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + std::dynamic_pointer_cast( + theAttribute); + aHasObject = + aSelectionListAttr->isInList(theObject, theShape, theTemporarily); + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); aHasObject = aRefListAttr->isInList(theObject); - //if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject)) - // aRefListAttr->append(theObject); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + // if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject)) + // aRefListAttr->append(theObject); + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr aRefAttrListAttr = - std::dynamic_pointer_cast(theAttribute); - AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape); + std::dynamic_pointer_cast(theAttribute); + AttributePtr anAttribute = + theWorkshop->module()->findAttribute(theObject, theShape); if (anAttribute.get()) { aHasObject = aRefAttrListAttr->isInList(anAttribute); - //if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(anAttribute)) - // aRefAttrListAttr->append(anAttribute); - } - else { + // if (!theCheckIfAttributeHasObject || + // !aRefAttrListAttr->isInList(anAttribute)) + // aRefAttrListAttr->append(anAttribute); + } else { aHasObject = aRefAttrListAttr->isInList(theObject); - //if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(theObject)) - // aRefAttrListAttr->append(theObject); + // if (!theCheckIfAttributeHasObject || + // !aRefAttrListAttr->isInList(theObject)) + // aRefAttrListAttr->append(theObject); } } return aHasObject; } -bool setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, - const GeomShapePtr& theShape, ModuleBase_IWorkshop* theWorkshop, - const bool theTemporarily, const bool theCheckIfAttributeHasObject) -{ +bool setObject(const AttributePtr &theAttribute, const ObjectPtr &theObject, + const GeomShapePtr &theShape, ModuleBase_IWorkshop *theWorkshop, + const bool theTemporarily, + const bool theCheckIfAttributeHasObject) { if (!theAttribute.get()) return false; @@ -703,16 +697,17 @@ bool setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, std::string aType = theAttribute->attributeType(); if (aType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr aRef = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ObjectPtr aObject = aRef->value(); if (!(aObject && aObject->isSame(theObject))) { aRef->setValue(theObject); } } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); - AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape); + AttributePtr anAttribute = + theWorkshop->module()->findAttribute(theObject, theShape); if (anAttribute.get()) aRefAttr->setAttr(anAttribute); else { @@ -723,39 +718,40 @@ bool setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, } } else if (aType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aSelectAttr.get() != NULL) { aSelectAttr->setValue(theObject, theShape, theTemporarily); } } if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); if (!theCheckIfAttributeHasObject || - !aSelectionListAttr->isInList(theObject, theShape, theTemporarily)) + !aSelectionListAttr->isInList(theObject, theShape, theTemporarily)) aSelectionListAttr->append(theObject, theShape, theTemporarily); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject)) { if (theObject.get()) aRefListAttr->append(theObject); else isDone = false; } - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr aRefAttrListAttr = - std::dynamic_pointer_cast(theAttribute); - AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape); + std::dynamic_pointer_cast(theAttribute); + AttributePtr anAttribute = + theWorkshop->module()->findAttribute(theObject, theShape); if (anAttribute.get()) { - if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(anAttribute)) + if (!theCheckIfAttributeHasObject || + !aRefAttrListAttr->isInList(anAttribute)) aRefAttrListAttr->append(anAttribute); - } - else { - if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(theObject)) { + } else { + if (!theCheckIfAttributeHasObject || + !aRefAttrListAttr->isInList(theObject)) { if (theObject.get()) aRefAttrListAttr->append(theObject); else @@ -766,8 +762,8 @@ bool setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, return isDone; } -GeomShapePtr getShape(const AttributePtr& theAttribute, ModuleBase_IWorkshop* theWorkshop) -{ +GeomShapePtr getShape(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop) { GeomShapePtr aShape; if (!theAttribute.get()) return aShape; @@ -776,27 +772,26 @@ GeomShapePtr getShape(const AttributePtr& theAttribute, ModuleBase_IWorkshop* th if (aType == ModelAPI_AttributeReference::typeId()) { } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aRefAttr.get() && !aRefAttr->isObject()) { AttributePtr anAttribute = aRefAttr->attr(); aShape = theWorkshop->module()->findShape(anAttribute); } } else if (aType == ModelAPI_AttributeSelection::typeId()) { - AttributeSelectionPtr aSelectAttr = std::dynamic_pointer_cast - (theAttribute); + AttributeSelectionPtr aSelectAttr = + std::dynamic_pointer_cast(theAttribute); aShape = aSelectAttr->value(); - } - else // Geom2D point processing + } else // Geom2D point processing aShape = theWorkshop->module()->findShape(theAttribute); return aShape; } -void flushUpdated(ObjectPtr theObject) -{ +void flushUpdated(ObjectPtr theObject) { blockUpdateViewer(true); - // Fix the problem of not previewed results of constraints applied. Flush Create/Delete - // (for the sketch result) to start processing of the sketch in the solver. + // Fix the problem of not previewed results of constraints applied. Flush + // Create/Delete (for the sketch result) to start processing of the sketch in + // the solver. // TODO: these flushes should be moved in a separate method provided by Model Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES)); @@ -807,58 +802,54 @@ void flushUpdated(ObjectPtr theObject) blockUpdateViewer(false); } -void blockUpdateViewer(const bool theValue) -{ - // the viewer update should be blocked in order to avoid the temporary feature content - // when the solver processes the feature, the redisplay message can be flushed - // what caused the display in the viewer preliminary states of object +void blockUpdateViewer(const bool theValue) { + // the viewer update should be blocked in order to avoid the temporary feature + // content when the solver processes the feature, the redisplay message can be + // flushed what caused the display in the viewer preliminary states of object // e.g. fillet feature, angle value change std::shared_ptr aMsg; if (theValue) { - aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); - } - else { + aMsg = std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); + } else { // the viewer update should be unblocked - aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); + aMsg = std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); } Events_Loop::loop()->send(aMsg); } -QString wrapTextByWords(const QString& theValue, QWidget* theWidget, - int theMaxLineInPixels) -{ +QString wrapTextByWords(const QString &theValue, QWidget *theWidget, + int theMaxLineInPixels) { static QFontMetrics tfm(theWidget ? theWidget->font() : QApplication::font()); static qreal phi = 2.618; QRect aBounds = tfm.boundingRect(theValue); - if(aBounds.width() <= theMaxLineInPixels) + if (aBounds.width() <= theMaxLineInPixels) return theValue; qreal s = aBounds.width() * aBounds.height(); - qreal aGoldWidth = sqrt(s*phi); + qreal aGoldWidth = sqrt(s * phi); QStringList aWords = theValue.split(" ", QString::SkipEmptyParts); QStringList aLines; int n = aWords.count(); QString aLine; for (int i = 0; i < n; i++) { - QString aLineExt = i == 0 ? aWords[i] : aLine + " " + aWords[i]; + QString aLineExt = i == 0 ? aWords[i] : aLine + " " + aWords[i]; qreal anWidthNonExt = tfm.boundingRect(aLine).width(); qreal anWidthExt = tfm.boundingRect(aLineExt).width(); - qreal aDeltaNonExt = fabs(anWidthNonExt-aGoldWidth); - qreal aDeltaExt = fabs(anWidthExt-aGoldWidth); - if(aDeltaNonExt < aDeltaExt) { + qreal aDeltaNonExt = fabs(anWidthNonExt - aGoldWidth); + qreal aDeltaExt = fabs(anWidthExt - aGoldWidth); + if (aDeltaNonExt < aDeltaExt) { // new line aLines.append(aLine); aLine = aWords[i]; - } - else + } else aLine = aLineExt; } - if(!aLine.isEmpty()) + if (!aLine.isEmpty()) aLines.append(aLine); QString aResult = aLines.join("\n"); @@ -866,8 +857,7 @@ QString wrapTextByWords(const QString& theValue, QWidget* theWidget, } //************************************************************** -QLocale doubleLocale() -{ +QLocale doubleLocale() { // VSR 01/07/2010: Disable thousands separator for spin box // (to avoid inconsistency of double-2-string and string-2-double conversion) QLocale aLocale; @@ -878,9 +868,8 @@ QLocale doubleLocale() } //************************************************************** -void refsToFeatureInFeatureDocument(const ObjectPtr& theObject, - std::set& theRefFeatures) -{ +void refsToFeatureInFeatureDocument(const ObjectPtr &theObject, + std::set &theRefFeatures) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get()) { DocumentPtr aFeatureDoc = aFeature->document(); @@ -889,7 +878,6 @@ void refsToFeatureInFeatureDocument(const ObjectPtr& theObject, } } - //************************************************************** /*bool isSubOfComposite(const ObjectPtr& theObject) { @@ -905,13 +893,15 @@ void refsToFeatureInFeatureDocument(const ObjectPtr& theObject, }*/ //************************************************************** -/*bool isSubOfComposite(const ObjectPtr& theObject, const FeaturePtr& theFeature) +/*bool isSubOfComposite(const ObjectPtr& theObject, const FeaturePtr& +theFeature) { bool isSub = false; - CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(theFeature); - if (aComposite.get()) { - isSub = aComposite->isSub(theObject); - // the recursive is possible, the parameters are sketch circle and extrusion cut. They are + CompositeFeaturePtr aComposite = +std::dynamic_pointer_cast(theFeature); if +(aComposite.get()) { isSub = aComposite->isSub(theObject); + // the recursive is possible, the parameters are sketch circle and extrusion +cut. They are // separated by composite sketch feature if (!isSub) { int aNbSubs = aComposite->numberOfSubs(); @@ -924,11 +914,11 @@ void refsToFeatureInFeatureDocument(const ObjectPtr& theObject, }*/ //************************************************************** -ResultPtr firstResult(const ObjectPtr& theObject) -{ +ResultPtr firstResult(const ObjectPtr &theObject) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (!aResult.get()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theObject); if (aFeature.get()) aResult = aFeature->firstResult(); } @@ -936,8 +926,8 @@ ResultPtr firstResult(const ObjectPtr& theObject) } //************************************************************** -bool isFeatureOfResult(const FeaturePtr& theFeature, const std::string& theGroupOfResult) -{ +bool isFeatureOfResult(const FeaturePtr &theFeature, + const std::string &theGroupOfResult) { bool isResult = false; if (!theFeature->data()->isValid()) @@ -951,12 +941,12 @@ bool isFeatureOfResult(const FeaturePtr& theFeature, const std::string& theGroup } //************************************************************** -bool hasModuleDocumentFeature(const std::set& theFeatures) -{ +bool hasModuleDocumentFeature(const std::set &theFeatures) { bool aFoundModuleDocumentObject = false; DocumentPtr aModuleDoc = ModelAPI_Session::get()->moduleDocument(); - std::set::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); + std::set::const_iterator anIt = theFeatures.begin(), + aLast = theFeatures.end(); for (; anIt != aLast && !aFoundModuleDocumentObject; anIt++) { FeaturePtr aFeature = *anIt; ResultPtr aResult = ModuleBase_Tools::firstResult(aFeature); @@ -969,19 +959,19 @@ bool hasModuleDocumentFeature(const std::set& theFeatures) } //************************************************************** -bool askToDelete(const std::set theFeatures, - const std::map >& theReferences, - QWidget* theParent, - std::set& theReferencesToDelete, - const std::string& thePrefixInfo) -{ +bool askToDelete( + const std::set theFeatures, + const std::map> &theReferences, + QWidget *theParent, std::set &theReferencesToDelete, + const std::string &thePrefixInfo) { QString aNotActivatedDocWrn; std::wstring aNotActivatedNames; if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) { if (ModuleBase_Tools::hasModuleDocumentFeature(theFeatures)) aNotActivatedDocWrn = - QObject::tr("Selected objects can be used in Part documents which are not loaded: %1.\n") - .arg(QString::fromStdWString(aNotActivatedNames)); + QObject::tr("Selected objects can be used in Part documents which " + "are not loaded: %1.\n") + .arg(QString::fromStdWString(aNotActivatedNames)); } std::set aFeaturesRefsTo; @@ -990,7 +980,8 @@ bool askToDelete(const std::set theFeatures, QStringList aPartFeatureNames; std::set::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); - // separate features to references to parameter features and references to others + // separate features to references to parameter features and references to + // others for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (theReferences.find(aFeature) == theReferences.end()) @@ -1001,19 +992,21 @@ bool askToDelete(const std::set theFeatures, std::set aRefFeatures; std::set aRefList = theReferences.at(aFeature); - std::set::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end(); + std::set::const_iterator aRefIt = aRefList.begin(), + aRefLast = aRefList.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; - if (theFeatures.find(aRefFeature) == theFeatures.end() && // it is not selected - aRefFeatures.find(aRefFeature) == aRefFeatures.end()) // it is not added + if (theFeatures.find(aRefFeature) == + theFeatures.end() && // it is not selected + aRefFeatures.find(aRefFeature) == + aRefFeatures.end()) // it is not added aRefFeatures.insert(aRefFeature); } if (isFeatureOfResult(aFeature, ModelAPI_ResultParameter::group())) { aFeaturesRefsToParameter.insert(aRefFeatures.begin(), aRefFeatures.end()); aParameterFeatures.insert(aFeature); - } - else { + } else { theReferencesToDelete.insert(aRefFeatures.begin(), aRefFeatures.end()); } } @@ -1021,7 +1014,8 @@ bool askToDelete(const std::set theFeatures, std::set aFeaturesRefsToParameterOnly; anIt = aFeaturesRefsToParameter.begin(); aLast = aFeaturesRefsToParameter.end(); - // separate features to references to parameter features and references to others + // separate features to references to parameter features and references to + // others QStringList aParamFeatureNames; for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; @@ -1037,7 +1031,8 @@ bool askToDelete(const std::set theFeatures, for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature->getKind() == "RemoveResults") - continue; // skip the remove results feature mentioning: result will be removed anyway + continue; // skip the remove results feature mentioning: result will be + // removed anyway if (isFeatureOfResult(aFeature, ModelAPI_ResultPart::group())) aPartFeatureNames.append(QString::fromStdWString(aFeature->name())); else @@ -1058,28 +1053,29 @@ bool askToDelete(const std::set theFeatures, QString aSep = ", "; if (!aPartFeatureNames.empty()) { aText += QString(QObject::tr("The following parts will be deleted: %1.\n")) - .arg(aPartFeatureNames.join(aSep)); + .arg(aPartFeatureNames.join(aSep)); } if (!aNotActivatedDocWrn.isEmpty()) aText += aNotActivatedDocWrn; if (!anOtherFeatureNames.empty()) { - const char* aMsg = "The selected features are used in some\n" + const char *aMsg = "The selected features are used in some\n" "other features, which will also be deleted.\n"; - const char* aMsgDetails = "The selected features are used" + const char *aMsgDetails = "The selected features are used" " in the following features: %1.\n"; aText += QString(QObject::tr(aMsg)); - aDetailedText += QString(QObject::tr(aMsgDetails)) - .arg(anOtherFeatureNames.join(aSep)); + aDetailedText += + QString(QObject::tr(aMsgDetails)).arg(anOtherFeatureNames.join(aSep)); } if (!aParamFeatureNames.empty()) { - const char* aMsg = "The selected parameters are used directly or through\n" + const char *aMsg = "The selected parameters are used directly or through\n" "a sequence of dependencies in some features.\n" "These features will be deleted.\n" "Or parameters could be replaced by their values.\n"; - const char* aMsgDetails = "Parameters are used in the following features: %1.\n"; + const char *aMsgDetails = + "Parameters are used in the following features: %1.\n"; aText += QString(QObject::tr(aMsg)); - aDetailedText += QString(QObject::tr(aMsgDetails)) - .arg(aParamFeatureNames.join(aSep)); + aDetailedText += + QString(QObject::tr(aMsgDetails)).arg(aParamFeatureNames.join(aSep)); aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole); } @@ -1089,7 +1085,8 @@ bool askToDelete(const std::set theFeatures, if (!aDetailedText.isEmpty()) aMessageBox.setDetailedText(aDetailedText); aMessageBox.exec(); - QMessageBox::ButtonRole aButtonRole = aMessageBox.buttonRole(aMessageBox.clickedButton()); + QMessageBox::ButtonRole aButtonRole = + aMessageBox.buttonRole(aMessageBox.clickedButton()); if (aButtonRole == QMessageBox::NoRole) return false; @@ -1097,8 +1094,7 @@ bool askToDelete(const std::set theFeatures, if (aButtonRole == QMessageBox::ActionRole) { foreach (FeaturePtr aObj, aParameterFeatures) ModelAPI_ReplaceParameterMessage::send(aObj, 0); - } - else + } else theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(), aFeaturesRefsToParameterOnly.end()); } @@ -1106,14 +1102,16 @@ bool askToDelete(const std::set theFeatures, } //************************************************************** -bool warningAboutConflict(QWidget* theParent, const std::string& theWarningText) -{ +bool warningAboutConflict(QWidget *theParent, + const std::string &theWarningText) { QMessageBox aMessageBox(theParent); aMessageBox.setWindowTitle(QObject::tr("Conflicts in constraint")); aMessageBox.setIcon(QMessageBox::Warning); - aMessageBox.setText((theWarningText + "\nConstraints will be removed or substituted").c_str()); + aMessageBox.setText( + (theWarningText + "\nConstraints will be removed or substituted") + .c_str()); - QCheckBox* aCheckBox = new QCheckBox; + QCheckBox *aCheckBox = new QCheckBox; aCheckBox->setTristate(false); aCheckBox->setText("switch off the notifications."); @@ -1123,24 +1121,25 @@ bool warningAboutConflict(QWidget* theParent, const std::string& theWarningText) aMessageBox.exec(); - if (aCheckBox->isChecked()) - { - ModuleBase_Preferences::resourceMgr()->setValue(SKETCH_TAB_NAME, - "notify_change_constraint", false); + if (aCheckBox->isChecked()) { + ModuleBase_Preferences::resourceMgr()->setValue( + SKETCH_TAB_NAME, "notify_change_constraint", false); } return true; } //************************************************************** -void convertToFeatures(const QObjectPtrList& theObjects, std::set& theFeatures) -{ - QObjectPtrList::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); - for(; anIt != aLast; anIt++) { +void convertToFeatures(const QObjectPtrList &theObjects, + std::set &theFeatures) { + QObjectPtrList::const_iterator anIt = theObjects.begin(), + aLast = theObjects.end(); + for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); // for parameter result, use the corresponded reature to be removed - if (!aFeature.get() && anObject->groupName() == ModelAPI_ResultParameter::group()) { + if (!aFeature.get() && + anObject->groupName() == ModelAPI_ResultParameter::group()) { aFeature = ModelAPI_Feature::feature(anObject); } if (aFeature.get()) @@ -1149,11 +1148,11 @@ void convertToFeatures(const QObjectPtrList& theObjects, std::set& t } //************************************************************** -void convertToFolders(const QObjectPtrList& theObjects, - std::set& theFolders) -{ - QObjectPtrList::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); - for(; anIt != aLast; anIt++) { +void convertToFolders(const QObjectPtrList &theObjects, + std::set &theFolders) { + QObjectPtrList::const_iterator anIt = theObjects.begin(), + aLast = theObjects.end(); + for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; FolderPtr aFeature = std::dynamic_pointer_cast(anObject); if (aFeature.get()) @@ -1161,48 +1160,47 @@ void convertToFolders(const QObjectPtrList& theObjects, } } - //************************************************************** -QString translate(const Events_InfoMessage& theMessage) -{ +QString translate(const Events_InfoMessage &theMessage) { QString aMessage; if (!theMessage.empty()) { std::string aStr = Config_Translator::translate(theMessage); if (!aStr.empty()) { std::string aCodec = Config_Translator::codec(theMessage); - aMessage = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()); + aMessage = + QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()); } } return aMessage; } -QString translate(const std::string& theContext, const std::string& theMessage) -{ +QString translate(const std::string &theContext, + const std::string &theMessage) { QString aMessage; if (!theMessage.empty()) { std::string aStr = Config_Translator::translate(theContext, theMessage); if (!aStr.empty()) { std::string aCodec = Config_Translator::codec(theContext); - aMessage = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()); + aMessage = + QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()); } } return aMessage; } -void setPointBallHighlighting(AIS_InteractiveObject* theAIS) -{ +void setPointBallHighlighting(AIS_InteractiveObject *theAIS) { static Handle(Image_AlienPixMap) aPixMap; - if(aPixMap.IsNull()) { + if (aPixMap.IsNull()) { // Load icon for the presentation std::string aFile; - char* anEnv = getenv("SHAPER_ROOT_DIR"); - if(anEnv) { - aFile = std::string(anEnv) + - FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; + char *anEnv = getenv("SHAPER_ROOT_DIR"); + if (anEnv) { + aFile = std::string(anEnv) + FSEP + "share" + FSEP + "salome" + FSEP + + "resources" + FSEP + "shaper"; } else { anEnv = getenv("CADBUILDER_ROOT_DIR"); if (anEnv) @@ -1213,11 +1211,13 @@ void setPointBallHighlighting(AIS_InteractiveObject* theAIS) static const std::string aMarkerName = "marker_dot.png"; aFile += aMarkerName; aPixMap = new Image_AlienPixMap(); - if(!aPixMap->Load(aFile.c_str())) { + if (!aPixMap->Load(aFile.c_str())) { // The icon for constraint is not found static const std::string aMsg = - "Error: Point market not found by path: \"" + aFile + "\". Falling back."; - //Events_InfoMessage("ModuleBase_Tools::setPointBallHighlighting", aMsg).send(); + "Error: Point market not found by path: \"" + aFile + + "\". Falling back."; + // Events_InfoMessage("ModuleBase_Tools::setPointBallHighlighting", + // aMsg).send(); } } @@ -1228,38 +1228,38 @@ void setPointBallHighlighting(AIS_InteractiveObject* theAIS) return; aDrawer = new Prs3d_Drawer(*ModuleBase_IViewer::DefaultHighlightDrawer); if (!aDrawer->HasOwnPointAspect()) { - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_BALL, Quantity_NOC_BLACK, 2.0)); + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_BALL, Quantity_NOC_BLACK, 2.0)); } } - if(aDrawer->HasOwnPointAspect()) { + if (aDrawer->HasOwnPointAspect()) { Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect(); - if(aPixMap->IsEmpty()) { + if (aPixMap->IsEmpty()) { anAspect = aPntAspect->Aspect(); anAspect->SetType(Aspect_TOM_BALL); } else { #if OCC_VERSION_LARGE < 0x07070000 - if(aPixMap->Format() == Image_PixMap::ImgGray) { - aPixMap->SetFormat (Image_PixMap::ImgAlpha); - } else if(aPixMap->Format() == Image_PixMap::ImgGrayF) { - aPixMap->SetFormat (Image_PixMap::ImgAlphaF); + if (aPixMap->Format() == Image_PixMap::ImgGray) { + aPixMap->SetFormat(Image_PixMap::ImgAlpha); + } else if (aPixMap->Format() == Image_PixMap::ImgGrayF) { + aPixMap->SetFormat(Image_PixMap::ImgAlphaF); } #else - if(aPixMap->Format() == Image_Format_Gray) { - aPixMap->SetFormat (Image_Format_Alpha); - } else if(aPixMap->Format() == Image_Format_GrayF) { - aPixMap->SetFormat (Image_Format_AlphaF); + if (aPixMap->Format() == Image_Format_Gray) { + aPixMap->SetFormat(Image_Format_Alpha); + } else if (aPixMap->Format() == Image_Format_GrayF) { + aPixMap->SetFormat(Image_Format_AlphaF); } #endif anAspect = new Graphic3d_AspectMarker3d(aPixMap); aPntAspect->SetAspect(anAspect); } aDrawer->SetPointAspect(aPntAspect); - theAIS->SetDynamicHilightAttributes(aDrawer); + theAIS->SetDynamicHilightAttributes(aDrawer); } } -FeaturePtr createParameter(const QString& theText) -{ +FeaturePtr createParameter(const QString &theText) { FeaturePtr aParameter; QStringList aList = theText.split("="); if (aList.count() != 2) { @@ -1298,8 +1298,7 @@ FeaturePtr createParameter(const QString& theText) return aParameter; } -void editParameter(FeaturePtr theParam, const QString& theText) -{ +void editParameter(FeaturePtr theParam, const QString &theText) { QStringList aList = theText.split("="); QString aParamName = aList.at(0).trimmed(); @@ -1321,8 +1320,7 @@ void editParameter(FeaturePtr theParam, const QString& theText) Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } -bool isNameExist(const QString& theName, FeaturePtr theIgnoreParameter) -{ +bool isNameExist(const QString &theName, FeaturePtr theIgnoreParameter) { SessionPtr aMgr = ModelAPI_Session::get(); std::shared_ptr aDoc = aMgr->activeDocument(); FeaturePtr aParamFeature; @@ -1331,15 +1329,15 @@ bool isNameExist(const QString& theName, FeaturePtr theIgnoreParameter) for (int i = 0; i < aNbFeatures; i++) { aParamFeature = aDoc->internalFeature(i); if (aParamFeature && aParamFeature->getKind() == "Parameter") { - if ((theIgnoreParameter != aParamFeature) && (aParamFeature->name() == aName)) + if ((theIgnoreParameter != aParamFeature) && + (aParamFeature->name() == aName)) return true; } } return false; } -FeaturePtr findParameter(const QString& theName) -{ +FeaturePtr findParameter(const QString &theName) { SessionPtr aMgr = ModelAPI_Session::get(); std::shared_ptr aDoc = aMgr->activeDocument(); FeaturePtr aParamFeature; @@ -1355,35 +1353,34 @@ FeaturePtr findParameter(const QString& theName) return FeaturePtr(); } - //******************************************************************** -std::wstring generateName(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop) -{ +std::wstring generateName(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop) { std::wstring aName; if (theAttribute.get() != NULL) { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (aFeature.get()) { std::string aXmlCfg, aDescription; - theWorkshop->module()->getXMLRepresentation(aFeature->getKind(), aXmlCfg, aDescription); + theWorkshop->module()->getXMLRepresentation(aFeature->getKind(), aXmlCfg, + aDescription); ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop); std::string anAttributeTitle; aFactory.getAttributeTitle(theAttribute->id(), anAttributeTitle); std::wstringstream aStreamName; - aStreamName << theAttribute->owner()->data()->name() << "/" << anAttributeTitle.c_str(); + aStreamName << theAttribute->owner()->data()->name() << "/" + << anAttributeTitle.c_str(); aName = aStreamName.str(); } } return aName; } -bool isSameShape(const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2) -{ +bool isSameShape(const TopoDS_Shape &theShape1, const TopoDS_Shape &theShape2) { // In case of compound we cannot rely on simple comparison method. - // If the compound is generated by Group feature then this compound is alwais new. - // So, we have to compare content of these compounds + // If the compound is generated by Group feature then this compound is alwais + // new. So, we have to compare content of these compounds if (theShape1.ShapeType() != theShape2.ShapeType()) return false; @@ -1400,19 +1397,17 @@ bool isSameShape(const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2) return true; } -qreal currentPixelRatio() -{ +qreal currentPixelRatio() { QWindowList aWnds = qApp->topLevelWindows(); if (aWnds.size() > 0) return aWnds.first()->devicePixelRatio(); return qApp->primaryScreen()->devicePixelRatio(); } - // Set displaying status to every element on group static void setDisplayingByLoop(DocumentPtr theDoc, int theSize, - std::string theGroup, bool theDisplayFromScript, int theDisplayingId) -{ + std::string theGroup, bool theDisplayFromScript, + int theDisplayingId) { for (int anIndex = theSize - 1; anIndex >= 0; --anIndex) { ObjectPtr anObject = theDoc->object(theGroup, anIndex); anObject->setDisplayed((theDisplayingId == 1 && anIndex == theSize - 1) || @@ -1420,8 +1415,7 @@ static void setDisplayingByLoop(DocumentPtr theDoc, int theSize, } } -void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) -{ +void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) { static bool isDoingDisplay = false; if (isDoingDisplay) @@ -1442,21 +1436,21 @@ void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) int aDisplayingId = -1; if (theDisplayFromScript) { - aDisplayingId = ModuleBase_Preferences::resourceMgr()->integerValue("General", - "part_visualization_script", -1); + aDisplayingId = ModuleBase_Preferences::resourceMgr()->integerValue( + "General", "part_visualization_script", -1); // Increase ID to prevert using "As stored in HDF" ++aDisplayingId; - } - else { - aDisplayingId = ModuleBase_Preferences::resourceMgr()->integerValue("General", - "part_visualization_study", -1); + } else { + aDisplayingId = ModuleBase_Preferences::resourceMgr()->integerValue( + "General", "part_visualization_study", -1); // if chosen "As stored in HDF" then don't change displaying if (aDisplayingId == 0) return; } - setDisplayingByLoop(aDoc, aConstructionSize, ModelAPI_ResultConstruction::group(), + setDisplayingByLoop(aDoc, aConstructionSize, + ModelAPI_ResultConstruction::group(), theDisplayFromScript, aDisplayingId); setDisplayingByLoop(aDoc, aGroupSize, ModelAPI_ResultGroup::group(), theDisplayFromScript, aDisplayingId); @@ -1468,5 +1462,3 @@ void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) } } // namespace ModuleBase_Tools - - diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index 32eb35804..76bd401aa 100644 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_Tools_H @@ -27,16 +28,16 @@ #include #include +#include +#include #include #include -#include -#include #include #include -#include #include +#include #include @@ -56,32 +57,33 @@ class Events_InfoMessage; namespace ModuleBase_Tools { /// Methods to adjust margins and spacings. -MODULEBASE_EXPORT void adjustMargins(QWidget* theWidget); -MODULEBASE_EXPORT void adjustMargins(QLayout* theLayout); +MODULEBASE_EXPORT void adjustMargins(QWidget *theWidget); +MODULEBASE_EXPORT void adjustMargins(QLayout *theLayout); -MODULEBASE_EXPORT void zeroMargins(QWidget* theWidget); -MODULEBASE_EXPORT void zeroMargins(QLayout* theLayout); +MODULEBASE_EXPORT void zeroMargins(QWidget *theWidget); +MODULEBASE_EXPORT void zeroMargins(QLayout *theLayout); /// Calls the same-named Qt method for the given widget. /// It sets the top-level widget containing this widget to be the active window. -/// An active window is a visible top-level window that has the keyboard input focus. -/// \param theWidget a widget to be activated -/// \param theIndo a debug information -MODULEBASE_EXPORT void activateWindow(QWidget* theWidget, const QString& theInfo = QString()); +/// An active window is a visible top-level window that has the keyboard input +/// focus. \param theWidget a widget to be activated \param theIndo a debug +/// information +MODULEBASE_EXPORT void activateWindow(QWidget *theWidget, + const QString &theInfo = QString()); /// Calls the same-named Qt method for the given widget. -/// Gives the keyboard input focus to this widget (or its focus proxy) if this widget or -/// one of its parents is the active window. -/// \param theWidget a widget to be activated -/// \param theIndo a debug information -MODULEBASE_EXPORT void setFocus(QWidget* theWidget, const QString& theInfo = QString()); - +/// Gives the keyboard input focus to this widget (or its focus proxy) if this +/// widget or one of its parents is the active window. \param theWidget a widget +/// to be activated \param theIndo a debug information +MODULEBASE_EXPORT void setFocus(QWidget *theWidget, + const QString &theInfo = QString()); /// Sets or removes the shadow effect to the widget /// \param theWidget a widget to be styled /// \param isSetEffect if true, the shadow effect is set, otherwise cleared /// \return resulting pixmap -MODULEBASE_EXPORT void setShadowEffect(QWidget* theWidget, const bool isSetEffect); +MODULEBASE_EXPORT void setShadowEffect(QWidget *theWidget, + const bool isSetEffect); /// \ingroup GUI /// Methods to modify a resource pixmap @@ -93,7 +95,8 @@ MODULEBASE_EXPORT void setShadowEffect(QWidget* theWidget, const bool isSetEffec /// \param theAdditionalIcon resource text of the additional pixmap /// \param theIcon resource text of the background pixmap /// \return resulting pixmap -MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon); +MODULEBASE_EXPORT QPixmap composite(const QString &theAdditionalIcon, + const QString &theIcon); /// Create composite pixmap. /// Pixmap \a theAdditionalIcon is drawn over pixmap \a dest with coordinates @@ -102,44 +105,51 @@ MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const QStr /// \param theAdditionalIcon additional pixmap /// \param theIcon background pixmap /// \return resulting pixmap -MODULEBASE_EXPORT QPixmap composite(const QImage& theAdditionalIcon, QImage& theIcon); +MODULEBASE_EXPORT QPixmap composite(const QImage &theAdditionalIcon, + QImage &theIcon); /// Generates the pixmap lighter than the resources pixmap. /// Pixmap \a theIcon is lighted according to the given value. -/// If the lighter value is greater than 100, this functions returns a lighter pixmap. -/// Setting lighter value to 150 returns a color that is 50% brighter. +/// If the lighter value is greater than 100, this functions returns a lighter +/// pixmap. Setting lighter value to 150 returns a color that is 50% brighter. /// If the factor is less than 100, -/// the return pixmap is darker. If the factor is 0 or negative, the return pixmap is unspecified. +/// the return pixmap is darker. If the factor is 0 or negative, the return +/// pixmap is unspecified. /// \param resource text of the pixmap /// \param theLighterValue a lighter factor /// \return resulting pixmap -MODULEBASE_EXPORT QPixmap lighter(const QString& theIcon, const int theLighterValue = 200); - -/// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged) -/// \param theSpin an X or Y coordinate widget -/// \param theValue a new value -MODULEBASE_EXPORT void setSpinValue(QDoubleSpinBox* theSpin, double theValue); - -/// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged) -/// \param theSpin an X or Y coordinate widget -/// \param theValue a new value -MODULEBASE_EXPORT void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue); - -/// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged) -/// \param theSpin an ModuleBase_ParamSpinBox that accepts text -/// \param theText a new value -MODULEBASE_EXPORT void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText); - -/// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged) -/// \param theSpin a ModuleBase_ParamIntSpinBox object -/// \param theValue a new value -MODULEBASE_EXPORT void setSpinValue(ModuleBase_ParamIntSpinBox* theSpin, int theValue); - -/// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged) -/// \param theSpin a SpinBox that accepts text -/// \param theText a new value -MODULEBASE_EXPORT void setSpinText(ModuleBase_ParamIntSpinBox* theSpin, const QString& theText); +MODULEBASE_EXPORT QPixmap lighter(const QString &theIcon, + const int theLighterValue = 200); + +/// Sets programmatically the value to the spin box without emitting any +/// signals(e.g. valueChanged) \param theSpin an X or Y coordinate widget \param +/// theValue a new value +MODULEBASE_EXPORT void setSpinValue(QDoubleSpinBox *theSpin, double theValue); + +/// Sets programmatically the value to the spin box without emitting any +/// signals(e.g. valueChanged) \param theSpin an X or Y coordinate widget \param +/// theValue a new value +MODULEBASE_EXPORT void setSpinValue(ModuleBase_ParamSpinBox *theSpin, + double theValue); + +/// Sets programmatically the value to the spin box without emitting any +/// signals(e.g. valueChanged) \param theSpin an ModuleBase_ParamSpinBox that +/// accepts text \param theText a new value +MODULEBASE_EXPORT void setSpinText(ModuleBase_ParamSpinBox *theSpin, + const QString &theText); + +/// Sets programmatically the value to the spin box without emitting any +/// signals(e.g. valueChanged) \param theSpin a ModuleBase_ParamIntSpinBox +/// object \param theValue a new value +MODULEBASE_EXPORT void setSpinValue(ModuleBase_ParamIntSpinBox *theSpin, + int theValue); + +/// Sets programmatically the value to the spin box without emitting any +/// signals(e.g. valueChanged) \param theSpin a SpinBox that accepts text \param +/// theText a new value +MODULEBASE_EXPORT void setSpinText(ModuleBase_ParamIntSpinBox *theSpin, + const QString &theText); /// Creates an action filled with the parameters /// \param theIcon an action icon @@ -148,35 +158,35 @@ MODULEBASE_EXPORT void setSpinText(ModuleBase_ParamIntSpinBox* theSpin, const QS /// \param theReceiver an object to process action triggered signal /// \param theMember a slot to process the action triggered signal /// \param theToolTip an action tool tip information, if empty the text is used -/// \param theStatusTip an action status tip information, if empty the text is used -MODULEBASE_EXPORT QAction* createAction(const QIcon& theIcon, const QString& theText, - QObject* theParent, const QObject* theReceiver = 0, - const char* theMember = "", - const QString& theToolTip = QString(), - const QString& theStatusTip = QString()); +/// \param theStatusTip an action status tip information, if empty the text is +/// used +MODULEBASE_EXPORT QAction * +createAction(const QIcon &theIcon, const QString &theText, QObject *theParent, + const QObject *theReceiver = 0, const char *theMember = "", + const QString &theToolTip = QString(), + const QString &theStatusTip = QString()); #ifdef _DEBUG /// Returns name of data of the object if it is not NULL /// \param theObj an object /// \return a string -MODULEBASE_EXPORT QString objectName(const ObjectPtr& theObj); +MODULEBASE_EXPORT QString objectName(const ObjectPtr &theObj); -/// Converts the object to the feature or a result and generate information string -/// \param theObj an object -/// \param isUseAttributesInfo a flag whether the attribute values information is used -/// \return a string -MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj, +/// Converts the object to the feature or a result and generate information +/// string \param theObj an object \param isUseAttributesInfo a flag whether the +/// attribute values information is used \return a string +MODULEBASE_EXPORT QString objectInfo(const ObjectPtr &theObj, const bool isUseAttributesInfo = false); #endif /// Converts string value (name of shape type) to shape enum value /// \param theType - string with shape type name /// \return TopAbs_ShapeEnum value -MODULEBASE_EXPORT int shapeType(const QString& theType); +MODULEBASE_EXPORT int shapeType(const QString &theType); -/// Checks whether the object is a sub result. It gets the feature of the object, -/// obtains all results of the feature and check if the object is a sub result -/// \return boolean result +/// Checks whether the object is a sub result. It gets the feature of the +/// object, obtains all results of the feature and check if the object is a sub +/// result \return boolean result MODULEBASE_EXPORT bool isSubResult(ObjectPtr theObject); /// Check types of objects which are in the given list @@ -184,96 +194,97 @@ MODULEBASE_EXPORT bool isSubResult(ObjectPtr theObject); /// \param hasResult will be set to true if list contains Result objects /// \param hasFeature will be set to true if list contains Feature objects /// \param hasParameter will be set to true if list contains Parameter objects -/// \param hasCompositeOwner will be set to true if list contains Sub-Feature objects -/// \param hasResultInHistory will be set to true if one of result is in history -/// \param hasFolder will be set to true if one of folder is in the list -MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, - bool& hasFeature, bool& hasParameter, bool& hasCompositeOwner, - bool& hasResultInHistory, bool& hasFolder, bool &hasGroupsOnly); - -/// Sets the default coeffient into the driver calculated accordingly the shape type. -/// It provides 1.e-4 for results of construction type -/// \param theResult a result object to define the deviation coefficient -/// \param theDrawer a drawer -//MODULEBASE_EXPORT void setDefaultDeviationCoefficient( -// const std::shared_ptr& theResult, -// const Handle(Prs3d_Drawer)& theDrawer); - -/// Sets the default coeffient into the driver calculated accordingly the shape type. -/// It provides 1.e-4 for a shape withe Edge shape type -/// \param theShape a shape to define the deviation coefficient, -/// \param theDrawer a drawer -MODULEBASE_EXPORT void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape, - const Handle(Prs3d_Drawer)& theDrawer); - -/// Obtains the color from the property manager and converts it to the OCCT color -/// \param theSection a property section -/// \param theName a property item name -/// \return quantity color -MODULEBASE_EXPORT Quantity_Color color(const std::string& theSection, - const std::string& theName); +/// \param hasCompositeOwner will be set to true if list contains Sub-Feature +/// objects \param hasResultInHistory will be set to true if one of result is in +/// history \param hasFolder will be set to true if one of folder is in the list +MODULEBASE_EXPORT void checkObjects(const QObjectPtrList &theObjects, + bool &hasResult, bool &hasFeature, + bool &hasParameter, bool &hasCompositeOwner, + bool &hasResultInHistory, bool &hasFolder, + bool &hasGroupsOnly); + +/// Sets the default coeffient into the driver calculated accordingly the shape +/// type. It provides 1.e-4 for results of construction type \param theResult a +/// result object to define the deviation coefficient \param theDrawer a drawer +// MODULEBASE_EXPORT void setDefaultDeviationCoefficient( +// const std::shared_ptr& theResult, +// const Handle(Prs3d_Drawer)& theDrawer); + +/// Sets the default coeffient into the driver calculated accordingly the shape +/// type. It provides 1.e-4 for a shape withe Edge shape type \param theShape a +/// shape to define the deviation coefficient, \param theDrawer a drawer +MODULEBASE_EXPORT void +setDefaultDeviationCoefficient(const TopoDS_Shape &theShape, + const Handle(Prs3d_Drawer) & theDrawer); + +/// Obtains the color from the property manager and converts it to the OCCT +/// color \param theSection a property section \param theName a property item +/// name \return quantity color +MODULEBASE_EXPORT Quantity_Color color(const std::string &theSection, + const std::string &theName); /// Returns the object from the attribute /// \param theObj an object -MODULEBASE_EXPORT ObjectPtr getObject(const AttributePtr& theAttribute); +MODULEBASE_EXPORT ObjectPtr getObject(const AttributePtr &theAttribute); /// Returns the object from the attribute /// \param theObj an object -MODULEBASE_EXPORT TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape); +MODULEBASE_EXPORT TopAbs_ShapeEnum +getCompoundSubType(const TopoDS_Shape &theShape); -/// Returns either presentation shape or shape of BREP owner if it is casted to it -/// \param thePrs selection presentation -/// \return shape -MODULEBASE_EXPORT TopoDS_Shape getSelectedShape( - const std::shared_ptr& thePrs); +/// Returns either presentation shape or shape of BREP owner if it is casted to +/// it \param thePrs selection presentation \return shape +MODULEBASE_EXPORT TopoDS_Shape +getSelectedShape(const std::shared_ptr &thePrs); /// Returns list of parameters accessible in the active part and partset /// \theParameters a list of parameter names -MODULEBASE_EXPORT void getParameters(QStringList& theParameters); +MODULEBASE_EXPORT void getParameters(QStringList &theParameters); /// Returns list of parameters accessible in the active part and partset /// \theParameters a list of parameter names -MODULEBASE_EXPORT std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop, - const FeaturePtr& theFeature); - -/// Set the object to the attribute depending on the attribute type. If it is a list, -/// the values are appended if they are not in the list yet. -/// \param theAttribute an attribute where the object and shape are set -/// \param theObject an object -/// \param theShape a shape -/// \param theWorkshop to find an attribute for the given shape for attribute reference -/// \param theTemporarily if it is true, do not store and name the added in the data framework +MODULEBASE_EXPORT std::string +findGreedAttribute(ModuleBase_IWorkshop *theWorkshop, + const FeaturePtr &theFeature); + +/// Set the object to the attribute depending on the attribute type. If it is a +/// list, the values are appended if they are not in the list yet. \param +/// theAttribute an attribute where the object and shape are set \param +/// theObject an object \param theShape a shape \param theWorkshop to find an +/// attribute for the given shape for attribute reference \param theTemporarily +/// if it is true, do not store and name the added in the data framework /// It is useful for attribute selection -MODULEBASE_EXPORT bool hasObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, - const std::shared_ptr& theShape, - ModuleBase_IWorkshop* theWorkshop, +MODULEBASE_EXPORT bool hasObject(const AttributePtr &theAttribute, + const ObjectPtr &theObject, + const std::shared_ptr &theShape, + ModuleBase_IWorkshop *theWorkshop, const bool theTemporarily); -/// Set the object to the attribute depending on the attribute type. If it is a list, -/// the values are appended if they are not in the list yet. -/// \param theAttribute an attribute where the object and shape are set -/// \param theObject an object -/// \param theShape a shape -/// \param theWorkshop to find an attribute for the given shape for attribute reference -/// \param theTemporarily if it is true, do not store and name the added in the data framework -/// \param theCheckIfAttributeHasObject if it is true, the check isInList is called +/// Set the object to the attribute depending on the attribute type. If it is a +/// list, the values are appended if they are not in the list yet. \param +/// theAttribute an attribute where the object and shape are set \param +/// theObject an object \param theShape a shape \param theWorkshop to find an +/// attribute for the given shape for attribute reference \param theTemporarily +/// if it is true, do not store and name the added in the data framework \param +/// theCheckIfAttributeHasObject if it is true, the check isInList is called /// It is useful for attribute selection /// \return true if the attribute is filled with the given parameters -MODULEBASE_EXPORT bool setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, - const std::shared_ptr& theShape, - ModuleBase_IWorkshop* theWorkshop, +MODULEBASE_EXPORT bool setObject(const AttributePtr &theAttribute, + const ObjectPtr &theObject, + const std::shared_ptr &theShape, + ModuleBase_IWorkshop *theWorkshop, const bool theTemporarily, const bool theCheckIfAttributeHasObject); -/// Returns the shape of the attribute. If the attribute is AttributeRefAttrPtr, the shape is found -/// using current module of the given workshop. -/// \param theAttribute an attribute where the shape is set -/// \param theWorkshop to find a shape for the given attribute -MODULEBASE_EXPORT std::shared_ptr getShape(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop); +/// Returns the shape of the attribute. If the attribute is AttributeRefAttrPtr, +/// the shape is found using current module of the given workshop. \param +/// theAttribute an attribute where the shape is set \param theWorkshop to find +/// a shape for the given attribute +MODULEBASE_EXPORT std::shared_ptr +getShape(const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop); -/// Flush updated signal for the object. The viewer update is blocked in the process -/// \param theObject parameter of the signal +/// Flush updated signal for the object. The viewer update is blocked in the +/// process \param theObject parameter of the signal MODULEBASE_EXPORT void flushUpdated(ObjectPtr theObject); /// Sends a message about block/unblock viewer updating @@ -284,138 +295,138 @@ MODULEBASE_EXPORT void blockUpdateViewer(const bool theValue); /// \param theValue a boolean value /// \param theWidget a widget to know the font /// \param theMaxLineInPixels a maximum line width in pixels -MODULEBASE_EXPORT QString wrapTextByWords(const QString& theValue, QWidget* theWidget, - int theMaxLineInPixels = 150); +MODULEBASE_EXPORT QString wrapTextByWords(const QString &theValue, + QWidget *theWidget, + int theMaxLineInPixels = 150); /// Generates a locale to disable thousands separator for spin box /// (to avoid inconsistency of double-2-string and string-2-double conversion) /// \return locale MODULEBASE_EXPORT QLocale doubleLocale(); -/// Returns a container of referenced feature to the current object in the object document. -/// \param theObject an object, which will be casted to a feature type -/// \param theRefFeatures an output container -void MODULEBASE_EXPORT refsToFeatureInFeatureDocument(const ObjectPtr& theObject, - std::set& theRefFeatures); - - -/// Returns true if the object if a sub child of the feature. The feature is casted to the -/// composite one. If it is possible, the sub object check happens. The method is applied -/// recursively to the feature subs. -/// \param theObject a candidate to be a sub object -/// \param theFeature a candidate to be a composite feature -/// \return a boolean value -//bool MODULEBASE_EXPORT isSubOfComposite(const ObjectPtr& theObject, const FeaturePtr& theFeature); +/// Returns a container of referenced feature to the current object in the +/// object document. \param theObject an object, which will be casted to a +/// feature type \param theRefFeatures an output container +void MODULEBASE_EXPORT refsToFeatureInFeatureDocument( + const ObjectPtr &theObject, std::set &theRefFeatures); +/// Returns true if the object if a sub child of the feature. The feature is +/// casted to the composite one. If it is possible, the sub object check +/// happens. The method is applied recursively to the feature subs. \param +/// theObject a candidate to be a sub object \param theFeature a candidate to be +/// a composite feature \return a boolean value +// bool MODULEBASE_EXPORT isSubOfComposite(const ObjectPtr& theObject, const +// FeaturePtr& theFeature); /// Returns true if the result is a sub object of some composite object /// \param theObject a result object /// \returns boolean value -//bool MODULEBASE_EXPORT isSubOfComposite(const ObjectPtr& theObject); - +// bool MODULEBASE_EXPORT isSubOfComposite(const ObjectPtr& theObject); /// Returns first result of the feature: the object itself if it is a result of /// first result of the object's feature /// \param theObject an object /// \return first result or NULL -std::shared_ptr MODULEBASE_EXPORT firstResult(const ObjectPtr& theObject); - -/// Returns true if the list contains at least one feature from the module document(PartSet) -/// The Part features are skipped. -/// \param theFeatures a list of features -/// \bool true if it is found -bool MODULEBASE_EXPORT hasModuleDocumentFeature(const std::set& theFeatures); - -/// Shows a dialog box about references. Ask whether they should be also removed. -/// \param theFeatures a list of features -/// \param theReferences a map of all references to the features -/// \param theParent a parent widget for the question message box -/// \param theReferencesToDelete an out set for references features to be removed -/// \return true if in message box answer is Yes -bool MODULEBASE_EXPORT askToDelete(const std::set aFeatures, - const std::map >& theReferences, - QWidget* theParent, - std::set& theReferencesToDelete, - const std::string& thePrefixInfo = ""); +std::shared_ptr + MODULEBASE_EXPORT firstResult(const ObjectPtr &theObject); + +/// Returns true if the list contains at least one feature from the module +/// document(PartSet) The Part features are skipped. \param theFeatures a list +/// of features \bool true if it is found +bool MODULEBASE_EXPORT +hasModuleDocumentFeature(const std::set &theFeatures); + +/// Shows a dialog box about references. Ask whether they should be also +/// removed. \param theFeatures a list of features \param theReferences a map of +/// all references to the features \param theParent a parent widget for the +/// question message box \param theReferencesToDelete an out set for references +/// features to be removed \return true if in message box answer is Yes +bool MODULEBASE_EXPORT +askToDelete(const std::set aFeatures, + const std::map> &theReferences, + QWidget *theParent, std::set &theReferencesToDelete, + const std::string &thePrefixInfo = ""); /// Shows a message box about conflicting constraints. /// \param theParent a parent widget for the message box /// \param theWarningText text describing the cause of the conflict -bool MODULEBASE_EXPORT warningAboutConflict(QWidget* theParent, const std::string& theWarningText); - -/// Converts a list of objects to set of corresponded features. If object is result, it is ignored -/// because the feature only might be removed. But if result is in a parameter group, the feature -/// of this parameter is to be removed -/// \param theObjects a list of objects -/// \param theFeatures an out container of features -void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects, - std::set& theFeatures); +bool MODULEBASE_EXPORT warningAboutConflict(QWidget *theParent, + const std::string &theWarningText); +/// Converts a list of objects to set of corresponded features. If object is +/// result, it is ignored because the feature only might be removed. But if +/// result is in a parameter group, the feature of this parameter is to be +/// removed \param theObjects a list of objects \param theFeatures an out +/// container of features +void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList &theObjects, + std::set &theFeatures); /// Converts a list of objects to set of folders. /// \param theObjects a list of objects /// \param theFeatures an out container of features -void MODULEBASE_EXPORT convertToFolders(const QObjectPtrList& theObjects, - std::set& theFolders); - +void MODULEBASE_EXPORT convertToFolders(const QObjectPtrList &theObjects, + std::set &theFolders); /// Returns translation from the given data. /// If translation is not exists then it returns a string /// from the info data without translation /// \param theMessage a message which have to be translated -QString MODULEBASE_EXPORT translate(const Events_InfoMessage& theMessage); +QString MODULEBASE_EXPORT translate(const Events_InfoMessage &theMessage); /// Returns translation from the given data. /// If translation is not exists then it returns a string /// from the info data without translation /// \param theContext context of the message (Feature Id) /// \param theMessage a message which have to be translated -QString MODULEBASE_EXPORT translate(const std::string& theContext, const std::string& theMessage); +QString MODULEBASE_EXPORT translate(const std::string &theContext, + const std::string &theMessage); /// Set Highlighting of points as a Ball shape /// \param theAIS - the presentation -void MODULEBASE_EXPORT setPointBallHighlighting(AIS_InteractiveObject* theAIS); +void MODULEBASE_EXPORT setPointBallHighlighting(AIS_InteractiveObject *theAIS); /// Creates a parameter from a given string /// \theText a text wit equation -FeaturePtr MODULEBASE_EXPORT createParameter(const QString& theText); +FeaturePtr MODULEBASE_EXPORT createParameter(const QString &theText); -/// Edits parameter replacing its name and expression according to the given string -/// \theParam a editing parameter -/// \theText a text wit equation -void MODULEBASE_EXPORT editParameter(FeaturePtr theParam, const QString& theText); +/// Edits parameter replacing its name and expression according to the given +/// string \theParam a editing parameter \theText a text wit equation +void MODULEBASE_EXPORT editParameter(FeaturePtr theParam, + const QString &theText); /// Returns True if a parameter with the given name already exists /// \theName a name of parameter -bool MODULEBASE_EXPORT isNameExist(const QString& theName, FeaturePtr theIgnoreParameter); +bool MODULEBASE_EXPORT isNameExist(const QString &theName, + FeaturePtr theIgnoreParameter); /// Find parameter by its name /// \theName a name of parameter -FeaturePtr MODULEBASE_EXPORT findParameter(const QString& theName); +FeaturePtr MODULEBASE_EXPORT findParameter(const QString &theName); /// Returns true if both shapes are the same. In case of compounds it /// compares their contents. /// \param theShape1 a first shape to compare /// \param theShape2 a second shape to compare /// \return true if both shapes are the same -bool MODULEBASE_EXPORT isSameShape(const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2); +bool MODULEBASE_EXPORT isSameShape(const TopoDS_Shape &theShape1, + const TopoDS_Shape &theShape2); //----------- Class members ------------- /// Returns a name in the next form: attribute_feature_name/attribute_id /// \param theAttribute a model attribute /// \param theWorkshop a workshop class instance /// \return string value -std::wstring MODULEBASE_EXPORT generateName(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop); +std::wstring MODULEBASE_EXPORT generateName(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop); /// Returns pixel ratio of a screen where main window is displayed qreal MODULEBASE_EXPORT currentPixelRatio(); /// Set displaying status for elements from part depending on the settings /// \param thePart a pointer of part -void MODULEBASE_EXPORT setDisplaying(std::shared_ptr thePart, - bool theDisplayFromScript = false); -} +void MODULEBASE_EXPORT +setDisplaying(std::shared_ptr thePart, + bool theDisplayFromScript = false); +} // namespace ModuleBase_Tools #endif diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 3ad46c724..1a6250ac9 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ViewerFilters.h" -#include "ModuleBase_IWorkshop.h" #include "ModuleBase_IModule.h" -#include "ModuleBase_Operation.h" #include "ModuleBase_IPropertyPanel.h" +#include "ModuleBase_IWorkshop.h" #include "ModuleBase_ModelWidget.h" +#include "ModuleBase_Operation.h" -#include #include #include +#include #include @@ -34,43 +35,42 @@ #include #ifdef BEFORE_TRIHEDRON_PATCH #include -#include #include +#include #else #include #include #include #endif -#include #include #include +#include #include #include +#include #include #include -#include #include IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter); - -//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340) +// TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340) Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk( - const Handle(SelectMgr_EntityOwner)& theOwner) const -{ + const Handle(SelectMgr_EntityOwner) & theOwner) const { bool aValid = true; - ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); - // the shapes from different documents should be provided if there is no started operation - // in order to show/hide results + ModuleBase_Operation *anOperation = myWorkshop->module()->currentOperation(); + // the shapes from different documents should be provided if there is no + // started operation in order to show/hide results if (anOperation) { aValid = Standard_False; - std::shared_ptr aAISObj = AISObjectPtr(new GeomAPI_AISObject()); + std::shared_ptr aAISObj = + AISObjectPtr(new GeomAPI_AISObject()); if (theOwner->HasSelectable()) { Handle(AIS_InteractiveObject) aAisObj = - Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); + Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); if (!aAisObj.IsNull()) { aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj)); } @@ -81,20 +81,23 @@ Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk( SessionPtr aMgr = ModelAPI_Session::get(); if (anOperation->propertyPanel()) { - ModuleBase_ModelWidget* aWidget = anOperation->propertyPanel()->activeWidget(); + ModuleBase_ModelWidget *aWidget = + anOperation->propertyPanel()->activeWidget(); if (aWidget && aWidget->canUseExternalParts()) return Standard_True; } return (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument()); - } - else { + } else { // This object is not controlled by the filter aValid = Standard_True; } } #ifdef DEBUG_FILTERS - qDebug(QString("ModuleBase_ShapeDocumentFilter::IsOk = %1").arg(aValid).toStdString().c_str()); + qDebug(QString("ModuleBase_ShapeDocumentFilter::IsOk = %1") + .arg(aValid) + .toStdString() + .c_str()); #endif return aValid; } @@ -102,38 +105,37 @@ Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk( IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter); Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( - const Handle(SelectMgr_EntityOwner)& theOwner) const -{ + const Handle(SelectMgr_EntityOwner) & theOwner) const { bool aValid = true; if (myPlane.get()) { aValid = Standard_False; - // selectable may be empty if the object is selected in Object Browser and is not visualized - // in the viewer(virtual owner is created for this case) - //if (theOwner->HasSelectable()) + // selectable may be empty if the object is selected in Object Browser and + // is not visualized in the viewer(virtual owner is created for this case) + // if (theOwner->HasSelectable()) { gp_Pln aPlane = myPlane->impl(); - Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); + Handle(StdSelect_BRepOwner) aShapeOwner = + Handle(StdSelect_BRepOwner)::DownCast(theOwner); if (!aShapeOwner.IsNull() && aShapeOwner->HasShape()) { TopoDS_Shape aShape = aShapeOwner->Shape(); TopAbs_ShapeEnum aType = aShape.ShapeType(); switch (aType) { - case TopAbs_VERTEX: - { - gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); - return aPlane.SquareDistance(aPnt) < Precision::SquareConfusion(); - } - case TopAbs_EDGE: - { - std::shared_ptr anEdge(new GeomAPI_Edge); - anEdge->setImpl(new TopoDS_Shape(aShape)); - return anEdge->isInPlane(myPlane); - } + case TopAbs_VERTEX: { + gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + return aPlane.SquareDistance(aPnt) < Precision::SquareConfusion(); + } + case TopAbs_EDGE: { + std::shared_ptr anEdge(new GeomAPI_Edge); + anEdge->setImpl(new TopoDS_Shape(aShape)); + return anEdge->isInPlane(myPlane); + } default: - // The object can be selected in Object browser and contain, for example, compound. - // The compound could not belong to any plane, so the result is false + // The object can be selected in Object browser and contain, for + // example, compound. The compound could not belong to any plane, so + // the result is false aValid = Standard_False; - break; + break; } } else { if (theOwner->HasSelectable()) { @@ -141,10 +143,12 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( Handle(SelectMgr_SelectableObject) aSelObj = theOwner->Selectable(); Handle(Standard_Type) aType = aSelObj->DynamicType(); if (aType == STANDARD_TYPE(AIS_Trihedron)) { - Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aSelObj); - Handle(AIS_TrihedronOwner) aTrOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner); + Handle(AIS_Trihedron) aTrihedron = + Handle(AIS_Trihedron)::DownCast(aSelObj); + Handle(AIS_TrihedronOwner) aTrOwner = + Handle(AIS_TrihedronOwner)::DownCast(theOwner); if (!aTrOwner.IsNull()) { - const Prs3d_DatumParts& aPart = aTrOwner->DatumPart(); + const Prs3d_DatumParts &aPart = aTrOwner->DatumPart(); if (aPart >= Prs3d_DP_XAxis && aPart <= Prs3d_DP_ZAxis) { gp_Ax2 anAxis = aTrihedron->Component()->Ax2(); gp_Dir aDir; @@ -162,7 +166,8 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( break; } gp_Lin aLine(aTrihedron->Component()->Location(), aDir); - return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); + return aPlane.Contains(aLine, Precision::Confusion(), + Precision::Angular()); } } } @@ -173,7 +178,10 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( } } #ifdef DEBUG_FILTERS - qDebug(QString("ModuleBase_ShapeDocumentFilter::IsOk = %1").arg(aValid).toStdString().c_str()); + qDebug(QString("ModuleBase_ShapeDocumentFilter::IsOk = %1") + .arg(aValid) + .toStdString() + .c_str()); #endif return aValid; } diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.h b/src/ModuleBase/ModuleBase_ViewerFilters.h index 7436b8236..714f2e7ee 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.h +++ b/src/ModuleBase/ModuleBase_ViewerFilters.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ViewerFilters_H @@ -22,56 +23,50 @@ #include -#include #include +#include #include - class ModuleBase_IWorkshop; - /** -* \class ModuleBase_ShapeDocumentFilter -* \ingroup GUI -* A filter which provides filtering of selection in 3d viewer. -* Installing of this filter lets to select objects which belong to -* currently active document or to global document -*/ + * \class ModuleBase_ShapeDocumentFilter + * \ingroup GUI + * A filter which provides filtering of selection in 3d viewer. + * Installing of this filter lets to select objects which belong to + * currently active document or to global document + */ DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter); -class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter -{ +class ModuleBase_ShapeDocumentFilter : public SelectMgr_Filter { public: /// Constructor /// \param theWorkshop instance of workshop interface Standard_EXPORT - ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(), - myWorkshop(theWorkshop) {} + ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop *theWorkshop) + : SelectMgr_Filter(), myWorkshop(theWorkshop) {} /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner - Standard_EXPORT virtual - Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + Standard_EXPORT virtual Standard_Boolean + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; /// Add an object type name to list of non selectable objects /// \param theType - a name of an object type - Standard_EXPORT void addNonSelectableType(const QString& theType) - { + Standard_EXPORT void addNonSelectableType(const QString &theType) { if (!myNonSelectableTypes.contains(theType)) myNonSelectableTypes.append(theType); } /// Removes an object type name from list of non selectable objects /// \param theType - a name of an object type - Standard_EXPORT void removeNonSelectableType(const QString& theType) - { + Standard_EXPORT void removeNonSelectableType(const QString &theType) { if (myNonSelectableTypes.contains(theType)) myNonSelectableTypes.removeAll(theType); } /// Returns list of non-selectable an object type names - Standard_EXPORT QStringList nonSelectableTypes() const - { + Standard_EXPORT QStringList nonSelectableTypes() const { return myNonSelectableTypes; } @@ -79,35 +74,37 @@ public: protected: /// Reference to workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; QStringList myNonSelectableTypes; }; /** -* \class ModuleBase_ShapeInPlaneFilter -* \ingroup GUI -* A filter which provides filtering of selection in 3d viewer. -* Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane -*/ + * \class ModuleBase_ShapeInPlaneFilter + * \ingroup GUI + * A filter which provides filtering of selection in 3d viewer. + * Installing of this filter lets to select of Vertexes and Edges which belongs + * to the given plane + */ DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter); -class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter -{ +class ModuleBase_ShapeInPlaneFilter : public SelectMgr_Filter { public: /// Constructor - Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {} + Standard_EXPORT ModuleBase_ShapeInPlaneFilter() : SelectMgr_Filter() {} /// Set working plane /// \param thePlane a plane object - void setPlane(const std::shared_ptr& thePlane) { myPlane = thePlane; } + void setPlane(const std::shared_ptr &thePlane) { + myPlane = thePlane; + } /// Returns current working plane std::shared_ptr plane() const { return myPlane; } /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner - Standard_EXPORT virtual - Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + Standard_EXPORT virtual Standard_Boolean + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter) private: diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.cpp b/src/ModuleBase/ModuleBase_ViewerPrs.cpp index 4a0c8023e..36704c114 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.cpp +++ b/src/ModuleBase/ModuleBase_ViewerPrs.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_ViewerPrs.h" @@ -23,26 +24,20 @@ #include ModuleBase_ViewerPrs::ModuleBase_ViewerPrs(ObjectPtr theResult, - const GeomShapePtr& theShape, - Handle(SelectMgr_EntityOwner) theOwner) -: myResult(theResult), - myOwner(theOwner), - myShape(theShape) -{ -} + const GeomShapePtr &theShape, + Handle(SelectMgr_EntityOwner) + theOwner) + : myResult(theResult), myOwner(theOwner), myShape(theShape) {} -ModuleBase_ViewerPrs::~ModuleBase_ViewerPrs() -{ -} +ModuleBase_ViewerPrs::~ModuleBase_ViewerPrs() {} -bool ModuleBase_ViewerPrs::isEqual(ModuleBase_ViewerPrs* thePrs) const -{ +bool ModuleBase_ViewerPrs::isEqual(ModuleBase_ViewerPrs *thePrs) const { if (!thePrs || thePrs->isEmpty()) return false; bool isEqualResult = (myResult.get() == thePrs->object().get()); bool isEqualShape = (!myShape.get() && !thePrs->shape().get()) || - (myShape.get() && myShape->isEqual(thePrs->shape())); + (myShape.get() && myShape->isEqual(thePrs->shape())); bool isEqualIO = (myInteractive == thePrs->interactive()) == Standard_True; bool isEqualOwner = myOwner.get() == thePrs->owner().get(); @@ -50,41 +45,45 @@ bool ModuleBase_ViewerPrs::isEqual(ModuleBase_ViewerPrs* thePrs) const !isEqualOwner) { /// owners are different // as we might loading object with the same shape in different modes like // "objects" and "other", it is possible that two owners are created linked - // to one shape. We should accept such ViewerPrs as equal to current in order - // to do not use the same twice - Handle(StdSelect_BRepOwner) anOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner); - Handle(StdSelect_BRepOwner) anOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); + // to one shape. We should accept such ViewerPrs as equal to current in + // order to do not use the same twice + Handle(StdSelect_BRepOwner) anOwner1 = + Handle(StdSelect_BRepOwner)::DownCast(myOwner); + Handle(StdSelect_BRepOwner) anOwner2 = + Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); if (!anOwner1.IsNull() && !anOwner2.IsNull()) - isEqualOwner = (anOwner1->Shape().IsNull() && anOwner2->Shape().IsNull()) || - anOwner1->Shape().IsEqual(anOwner2->Shape()); + isEqualOwner = + (anOwner1->Shape().IsNull() && anOwner2->Shape().IsNull()) || + anOwner1->Shape().IsEqual(anOwner2->Shape()); } - if (isEqualResult && isEqualShape && - !isEqualIO) { /// AIS are different - // check that the owner is a fictive owner for compsolid object, created in the - // ComputeSelection of ModuleBase_ResultPrs. A new owner is created there for each subsolid - // and set in the sub-solid AIS. ViewerPrs of these fictive owners are accepted as equal - // as they use the same shape and result(of compsolid) - Handle(StdSelect_BRepOwner) aCSolidOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner); + if (isEqualResult && isEqualShape && !isEqualIO) { /// AIS are different + // check that the owner is a fictive owner for compsolid object, created in + // the ComputeSelection of ModuleBase_ResultPrs. A new owner is created + // there for each subsolid and set in the sub-solid AIS. ViewerPrs of these + // fictive owners are accepted as equal as they use the same shape and + // result(of compsolid) + Handle(StdSelect_BRepOwner) aCSolidOwner1 = + Handle(StdSelect_BRepOwner)::DownCast(myOwner); Handle(StdSelect_BRepOwner) aCSolidOwner2 = - Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); + Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner()); isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull(); if (!aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull()) - isEqualOwner = (aCSolidOwner1->Shape().IsNull() && aCSolidOwner2->Shape().IsNull()) || - aCSolidOwner1->Shape().IsEqual(aCSolidOwner2->Shape()); + isEqualOwner = (aCSolidOwner1->Shape().IsNull() && + aCSolidOwner2->Shape().IsNull()) || + aCSolidOwner1->Shape().IsEqual(aCSolidOwner2->Shape()); } return isEqualResult && isEqualShape && isEqualOwner && isEqualIO; } -bool ModuleBase_ViewerPrs::operator==(const ModuleBase_ViewerPrs& thePrs) -{ +bool ModuleBase_ViewerPrs::operator==(const ModuleBase_ViewerPrs &thePrs) { if (thePrs.isEmpty()) return false; bool isEqualResult = (myResult.get() == thePrs.object().get()); bool isEqualShape = (!myShape.get() && !thePrs.shape().get()) || - (myShape.get() && myShape->isEqual(thePrs.shape())); + (myShape.get() && myShape->isEqual(thePrs.shape())); bool isEqualIO = (myInteractive == thePrs.interactive()) == Standard_True; bool isEqualOwner = myOwner.get() == thePrs.owner().get(); @@ -92,28 +91,33 @@ bool ModuleBase_ViewerPrs::operator==(const ModuleBase_ViewerPrs& thePrs) !isEqualOwner) { /// owners are different // as we might loading object with the same shape in different modes like // "objects" and "other", it is possible that two owners are created linked - // to one shape. We should accept such ViewerPrs as equal to current in order - // to do not use the same twice - Handle(StdSelect_BRepOwner) anOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner); - Handle(StdSelect_BRepOwner) anOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner()); + // to one shape. We should accept such ViewerPrs as equal to current in + // order to do not use the same twice + Handle(StdSelect_BRepOwner) anOwner1 = + Handle(StdSelect_BRepOwner)::DownCast(myOwner); + Handle(StdSelect_BRepOwner) anOwner2 = + Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner()); if (!anOwner1.IsNull() && !anOwner2.IsNull()) - isEqualOwner = (anOwner1->Shape().IsNull() && anOwner2->Shape().IsNull()) || - anOwner1->Shape().IsEqual(anOwner2->Shape()); + isEqualOwner = + (anOwner1->Shape().IsNull() && anOwner2->Shape().IsNull()) || + anOwner1->Shape().IsEqual(anOwner2->Shape()); } - if (isEqualResult && isEqualShape && - !isEqualIO) { /// AIS are different - // check that the owner is a fictive owner for compsolid object, created in the - // ComputeSelection of ModuleBase_ResultPrs. A new owner is created there for each subsolid - // and set in the sub-solid AIS. ViewerPrs of these fictive owners are accepted as equal - // as they use the same shape and result(of compsolid) - Handle(StdSelect_BRepOwner) aCSolidOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner); + if (isEqualResult && isEqualShape && !isEqualIO) { /// AIS are different + // check that the owner is a fictive owner for compsolid object, created in + // the ComputeSelection of ModuleBase_ResultPrs. A new owner is created + // there for each subsolid and set in the sub-solid AIS. ViewerPrs of these + // fictive owners are accepted as equal as they use the same shape and + // result(of compsolid) + Handle(StdSelect_BRepOwner) aCSolidOwner1 = + Handle(StdSelect_BRepOwner)::DownCast(myOwner); Handle(StdSelect_BRepOwner) aCSolidOwner2 = - Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner()); + Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner()); isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull(); if (!aCSolidOwner1.IsNull() && !aCSolidOwner1.IsNull()) - isEqualOwner = (aCSolidOwner1->Shape().IsNull() && aCSolidOwner2->Shape().IsNull()) || - aCSolidOwner1->Shape().IsEqual(aCSolidOwner2->Shape()); + isEqualOwner = (aCSolidOwner1->Shape().IsNull() && + aCSolidOwner2->Shape().IsNull()) || + aCSolidOwner1->Shape().IsEqual(aCSolidOwner2->Shape()); } return isEqualResult && isEqualShape && isEqualOwner && isEqualIO; diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.h b/src/ModuleBase/ModuleBase_ViewerPrs.h index 7357c83a2..e67ee3265 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.h +++ b/src/ModuleBase/ModuleBase_ViewerPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_ViewerPrs_H @@ -22,107 +23,96 @@ #include "ModuleBase.h" -#include -#include #include +#include +#include -#include #include +#include /**\class ModuleBase_ViewerPrs * \ingroup GUI - * \brief Presentation. Provides container to have feature, shape and/or selection owner. + * \brief Presentation. Provides container to have feature, shape and/or + * selection owner. */ -class ModuleBase_ViewerPrs -{ - public: +class ModuleBase_ViewerPrs { +public: /// Constructor /// \param theResult an object /// \param theShape a viewer shape /// \param theOwner a selection owner - MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(), - const GeomShapePtr& theShape = GeomShapePtr(), - Handle(SelectMgr_EntityOwner) theOwner = NULL); + MODULEBASE_EXPORT + ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(), + const GeomShapePtr &theShape = GeomShapePtr(), + Handle(SelectMgr_EntityOwner) theOwner = NULL); /// Destructor MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs(); /// Sets the object. /// \param theResult an object instance - MODULEBASE_EXPORT void setObject(ObjectPtr theResult) - { + MODULEBASE_EXPORT void setObject(ObjectPtr theResult) { myResult = theResult; } /// Returns the feature. /// \return a feature instance - MODULEBASE_EXPORT ObjectPtr object() const - { - return myResult; - } + MODULEBASE_EXPORT ObjectPtr object() const { return myResult; } /// Set the presentation owner /// \param theOwner an owner to set - MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner) - { + MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner) { myOwner = theOwner; } /// Returns the presentation owner /// \return an owner - MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const - { + MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const { return myOwner; } /// Sets the shape /// \param theShape a shape instance - MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape) - { + MODULEBASE_EXPORT void setShape(const GeomShapePtr &theShape) { myShape = theShape; } /// Returns the shape /// \return a shape instance - MODULEBASE_EXPORT const GeomShapePtr& shape() const - { - return myShape; - } + MODULEBASE_EXPORT const GeomShapePtr &shape() const { return myShape; } /// Set interactive object /// \param theIO an interactive object - MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO) - { + MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject) & + theIO) { myInteractive = theIO; } /// Returns interactive object if it is installed - MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const - { + MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const { return myInteractive; } /// Returns true if all presentation fields are empty /// \return boolean value - MODULEBASE_EXPORT bool isEmpty() const - { - return (!myShape.get() || myShape->isNull()) && - myOwner.IsNull() && !myResult.get(); + MODULEBASE_EXPORT bool isEmpty() const { + return (!myShape.get() || myShape->isNull()) && myOwner.IsNull() && + !myResult.get(); } - /// Returns true if all presentation fields are empty + /// Returns true if all presentation fields are empty /// \return boolean value - MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs* thePrs) const; + MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs *thePrs) const; /// Returns True if the current object is equal to the given one /// \param thePrs an object to compare - MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs); + MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs &thePrs); - private: - ObjectPtr myResult; /// the feature - Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner - GeomShapePtr myShape; /// the shape - Handle(AIS_InteractiveObject) myInteractive; /// interactive object +private: + ObjectPtr myResult; /// the feature + Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner + GeomShapePtr myShape; /// the shape + Handle(AIS_InteractiveObject) myInteractive; /// interactive object }; typedef std::shared_ptr ModuleBase_ViewerPrsPtr; diff --git a/src/ModuleBase/ModuleBase_WidgetAction.cpp b/src/ModuleBase/ModuleBase_WidgetAction.cpp index 0b81abb97..87354aeb1 100644 --- a/src/ModuleBase/ModuleBase_WidgetAction.cpp +++ b/src/ModuleBase/ModuleBase_WidgetAction.cpp @@ -14,35 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include #include -#include #include #include +#include #define DEFAULT_TOOL_TIP_WIDTH 300 -ModuleBase_WidgetAction::ModuleBase_WidgetAction(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), - myActionID(attributeID()) -{ - setAttributeID(""); // To prevent errors. Action not stored as attribtue in feature. - QHBoxLayout* aControlLay = new QHBoxLayout(this); +ModuleBase_WidgetAction::ModuleBase_WidgetAction( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myActionID(attributeID()) { + setAttributeID( + ""); // To prevent errors. Action not stored as attribtue in feature. + QHBoxLayout *aControlLay = new QHBoxLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); myButton = new QToolButton(this); QString aText = translate(theData->widgetLabel()); - QString aToolTip = ModuleBase_Tools::wrapTextByWords(translate(theData->widgetTooltip()), - myButton, - DEFAULT_TOOL_TIP_WIDTH); + QString aToolTip = ModuleBase_Tools::wrapTextByWords( + translate(theData->widgetTooltip()), myButton, DEFAULT_TOOL_TIP_WIDTH); myButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); aControlLay->addWidget(myButton); @@ -57,34 +56,21 @@ ModuleBase_WidgetAction::ModuleBase_WidgetAction(QWidget* theParent, connect(myButton, SIGNAL(clicked(bool)), this, SLOT(onActionClicked())); } -ModuleBase_WidgetAction::~ModuleBase_WidgetAction() -{ -} +ModuleBase_WidgetAction::~ModuleBase_WidgetAction() {} -bool ModuleBase_WidgetAction::focusTo() -{ - return false; -} +bool ModuleBase_WidgetAction::focusTo() { return false; } -QList ModuleBase_WidgetAction::getControls() const -{ - QList aList; +QList ModuleBase_WidgetAction::getControls() const { + QList aList; aList.append(myButton); return aList; } -bool ModuleBase_WidgetAction::storeValueCustom() -{ - return true; -} +bool ModuleBase_WidgetAction::storeValueCustom() { return true; } -bool ModuleBase_WidgetAction::restoreValueCustom() -{ - return true; -} +bool ModuleBase_WidgetAction::restoreValueCustom() { return true; } -void ModuleBase_WidgetAction::onActionClicked() -{ +void ModuleBase_WidgetAction::onActionClicked() { if (myFeature->customAction(myActionID)) updateObject(myFeature); } diff --git a/src/ModuleBase/ModuleBase_WidgetAction.h b/src/ModuleBase/ModuleBase_WidgetAction.h index 83c2011e2..298407739 100644 --- a/src/ModuleBase/ModuleBase_WidgetAction.h +++ b/src/ModuleBase/ModuleBase_WidgetAction.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetAction_H @@ -28,17 +29,18 @@ class QWidget; class QToolButton; /** -* \ingroup GUI -* Implementation of widget for feature action (tool button) -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetAction : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * Implementation of widget for feature action (tool button) + */ +class MODULEBASE_EXPORT ModuleBase_WidgetAction + : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetAction(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetAction(QWidget *theParent, const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetAction(); @@ -47,12 +49,12 @@ Q_OBJECT /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// \return Context for translation virtual std::string context() const { std::string aContext = myFeatureId; - if(!aContext.empty() && !myActionID.empty()) { + if (!aContext.empty() && !myActionID.empty()) { aContext += ":"; } aContext += myActionID; @@ -69,11 +71,12 @@ protected: virtual bool restoreValueCustom(); protected slots: - /// Listens the button click and call the customAction function of the current feature + /// Listens the button click and call the customAction function of the current + /// feature void onActionClicked(); private: - QToolButton* myButton; ///< action button + QToolButton *myButton; ///< action button std::string myActionID; ///< action index }; diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp index d859e0ca8..4be6b9038 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include @@ -29,14 +30,13 @@ #include #include -#include -#include #include +#include +#include -ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData) -{ +ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData) { QString aText = translate(theData->widgetLabel()); QString aToolTip = translate(theData->widgetTooltip()); myDefVal = theData->getBooleanAttribute(ATTR_DEFAULT, false); @@ -45,7 +45,7 @@ ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, myCheckBox->setToolTip(aToolTip); myCheckBox->setChecked(myDefVal); - QVBoxLayout* aMainLayout = new QVBoxLayout(this); + QVBoxLayout *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLayout); aMainLayout->addWidget(myCheckBox); setLayout(aMainLayout); @@ -53,29 +53,26 @@ ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, connect(myCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(valuesChanged())); } -ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() -{ -} +ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() {} -bool ModuleBase_WidgetBoolValue::storeValueCustom() -{ +bool ModuleBase_WidgetBoolValue::storeValueCustom() { DataPtr aData = myFeature->data(); - std::shared_ptr aBool = aData->boolean(attributeID()); + std::shared_ptr aBool = + aData->boolean(attributeID()); aBool->setValue(myCheckBox->isChecked()); updateObject(myFeature); return true; } -bool ModuleBase_WidgetBoolValue::restoreValueCustom() -{ +bool ModuleBase_WidgetBoolValue::restoreValueCustom() { DataPtr aData = myFeature->data(); - std::shared_ptr aRef = aData->boolean(attributeID()); + std::shared_ptr aRef = + aData->boolean(attributeID()); bool isBlocked = myCheckBox->blockSignals(true); if (aRef->isInitialized()) { myCheckBox->setChecked(aRef->value()); - } - else { + } else { myCheckBox->setChecked(myDefVal); aRef->setValue(myDefVal); } @@ -83,14 +80,10 @@ bool ModuleBase_WidgetBoolValue::restoreValueCustom() return true; } -QList ModuleBase_WidgetBoolValue::getControls() const -{ - QList aList; +QList ModuleBase_WidgetBoolValue::getControls() const { + QList aList; aList.append(myCheckBox); return aList; } -void ModuleBase_WidgetBoolValue::setHighlighted(bool) -{ - return; -} +void ModuleBase_WidgetBoolValue::setHighlighted(bool) { return; } diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.h b/src/ModuleBase/ModuleBase_WidgetBoolValue.h index 8f1f65325..fc6b2568f 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.h +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetBoolValue_H @@ -28,23 +29,25 @@ class QWidget; class QCheckBox; /** -* \ingroup GUI -* Implementation of widget for boolean input (check box) -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * Implementation of widget for boolean input (check box) + */ +class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue + : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetBoolValue(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetBoolValue(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetBoolValue(); virtual bool canAcceptFocus() const { return false; }; - virtual QList getControls() const; + virtual QList getControls() const; virtual void setHighlighted(bool isHighlighted); @@ -55,9 +58,9 @@ protected: virtual bool restoreValueCustom(); - private: - /// The check box - QCheckBox* myCheckBox; +private: + /// The check box + QCheckBox *myCheckBox; bool myDefVal; }; diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.cpp b/src/ModuleBase/ModuleBase_WidgetChoice.cpp index 4f52685f3..02db727b2 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.cpp +++ b/src/ModuleBase/ModuleBase_WidgetChoice.cpp @@ -14,34 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetChoice.h" -#include "ModuleBase_Tools.h" -#include "ModuleBase_IconFactory.h" #include "ModuleBase_ChoiceCtrl.h" +#include "ModuleBase_IconFactory.h" +#include "ModuleBase_Tools.h" +#include +#include #include #include #include -#include -#include -#include -#include -#include #include #include +#include +#include #include #include +#include static QMap defaultValues; -ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), myIsFirst(true) -{ +ModuleBase_WidgetChoice::ModuleBase_WidgetChoice( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myIsFirst(true) { myHasValue = defaultValues.contains(myFeatureId + attributeID()); if (myHasValue) myDefValue = defaultValues[myFeatureId + attributeID()]; @@ -53,7 +53,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent, std::string aTypes = theData->getProperty("string_list"); QStringList aList; - foreach(QString aType, QString(aTypes.c_str()).split(' ')) { + foreach (QString aType, QString(aTypes.c_str()).split(' ')) { aList.append(translate(aType.toStdString())); } if (aTypes.empty()) { @@ -65,7 +65,8 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent, myButtonTitles = aList; bool aHasDefaultValue; - int aDefaultVal = QString::fromStdString(getDefaultValue()).toInt(&aHasDefaultValue); + int aDefaultVal = + QString::fromStdString(getDefaultValue()).toInt(&aHasDefaultValue); // Widget type can be combobox or radiobuttons std::string aWgtType = theData->getProperty("widget_type"); @@ -74,35 +75,35 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent, std::string aWgtDir = theData->getProperty("buttons_dir"); - QHBoxLayout* aLayout = new QHBoxLayout(this); - myChoiceCtrl = new ModuleBase_ChoiceCtrl(this, aList, aIconList, - (aWgtType == "radiobuttons")? ModuleBase_ChoiceCtrl::RadioButtons : - ModuleBase_ChoiceCtrl::ComboBox, - (aWgtDir == "horizontal")? Qt::Horizontal : Qt::Vertical); + QHBoxLayout *aLayout = new QHBoxLayout(this); + myChoiceCtrl = new ModuleBase_ChoiceCtrl( + this, aList, aIconList, + (aWgtType == "radiobuttons") ? ModuleBase_ChoiceCtrl::RadioButtons + : ModuleBase_ChoiceCtrl::ComboBox, + (aWgtDir == "horizontal") ? Qt::Horizontal : Qt::Vertical); myChoiceCtrl->setLabel(aLabelText); if (!aLabelIcon.isEmpty()) myChoiceCtrl->setLabelIcon(aLabelIcon); - connect(myChoiceCtrl, SIGNAL(valueChanged(int)), this, SLOT(onCurrentIndexChanged(int))); + connect(myChoiceCtrl, SIGNAL(valueChanged(int)), this, + SLOT(onCurrentIndexChanged(int))); int aCheckedId = aHasDefaultValue ? aDefaultVal : 0; myChoiceCtrl->setValue(aCheckedId); aLayout->addWidget(myChoiceCtrl); } -ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice() -{ -} +ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice() {} -bool ModuleBase_WidgetChoice::storeValueCustom() -{ +bool ModuleBase_WidgetChoice::storeValueCustom() { DataPtr aData = myFeature->data(); - std::shared_ptr aIntAttr = aData->integer(attributeID()); + std::shared_ptr aIntAttr = + aData->integer(attributeID()); int aCase = 0; if (myIsFirst) - aCase = myHasValue? myDefValue : myChoiceCtrl->value(); + aCase = myHasValue ? myDefValue : myChoiceCtrl->value(); else aCase = myChoiceCtrl->value(); @@ -114,15 +115,16 @@ bool ModuleBase_WidgetChoice::storeValueCustom() return true; } -bool ModuleBase_WidgetChoice::restoreValueCustom() -{ +bool ModuleBase_WidgetChoice::restoreValueCustom() { DataPtr aData = myFeature->data(); - std::shared_ptr aIntAttr = aData->integer(attributeID()); + std::shared_ptr aIntAttr = + aData->integer(attributeID()); if (aIntAttr->value() != -1) { bool isBlocked = myChoiceCtrl->blockSignals(true); if (!myStringListAttribute.empty()) { - AttributeStringArrayPtr aStrAttr = aData->stringArray(myStringListAttribute); + AttributeStringArrayPtr aStrAttr = + aData->stringArray(myStringListAttribute); QStringList aChoiceList; if (aStrAttr) { for (int i = 0; i < aStrAttr->size(); i++) { @@ -137,10 +139,10 @@ bool ModuleBase_WidgetChoice::restoreValueCustom() myChoiceCtrl->blockSignals(isBlocked); emit itemSelected(this, aIntAttr->value()); myDefValue = aIntAttr->value(); - } - else { + } else { bool aHasDefaultValue; - int aDefaultVal = QString::fromStdString(getDefaultValue()).toInt(&aHasDefaultValue); + int aDefaultVal = + QString::fromStdString(getDefaultValue()).toInt(&aHasDefaultValue); int aVal = aHasDefaultValue ? aDefaultVal : 0; myChoiceCtrl->setValue(aVal); @@ -153,26 +155,20 @@ bool ModuleBase_WidgetChoice::restoreValueCustom() return true; } -bool ModuleBase_WidgetChoice::focusTo() -{ - return myChoiceCtrl->focusTo(); -} +bool ModuleBase_WidgetChoice::focusTo() { return myChoiceCtrl->focusTo(); } -QList ModuleBase_WidgetChoice::getControls() const -{ +QList ModuleBase_WidgetChoice::getControls() const { return myChoiceCtrl->getControls(); } -QString ModuleBase_WidgetChoice::getPropertyPanelTitle(int theIndex) -{ +QString ModuleBase_WidgetChoice::getPropertyPanelTitle(int theIndex) { QString aTitle; if (myButtonTitles.length() > theIndex) aTitle = myButtonTitles[theIndex]; return aTitle; } -void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex) -{ +void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex) { emit valuesChanged(); // Don't transfer focus // emit focusOutWidget(this); @@ -180,7 +176,6 @@ void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex) emit itemSelected(this, theIndex); } -void ModuleBase_WidgetChoice::onFeatureAccepted() -{ +void ModuleBase_WidgetChoice::onFeatureAccepted() { defaultValues[myFeatureId + attributeID()] = myDefValue; } diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.h b/src/ModuleBase/ModuleBase_WidgetChoice.h index 742a4cea0..76e5c0655 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.h +++ b/src/ModuleBase/ModuleBase_WidgetChoice.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetChoice_H @@ -27,31 +28,32 @@ class QWidget; class ModuleBase_ChoiceCtrl; /** -* \ingroup GUI -* Implementation of model widget for choice widget definition (combo box) -* It can be defined as following: -* \code -* -* \endcode -* Aditionally can be used: -* A key "widget_type". It can have values "combobox" or "radiobuttons". -* By default it uses "combobox". -* A key "buttons_dir" which is applicable only for "radiobuttons" mode. -* It defines direction of radiobuttons layout. it can be "vertical" or "horizontal" -* Default value is "vertical" -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetChoice : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * Implementation of model widget for choice widget definition (combo box) + * It can be defined as following: + * \code + * + * \endcode + * Aditionally can be used: + * A key "widget_type". It can have values "combobox" or "radiobuttons". + * By default it uses "combobox". + * A key "buttons_dir" which is applicable only for "radiobuttons" mode. + * It defines direction of radiobuttons layout. it can be "vertical" or + * "horizontal" Default value is "vertical" + */ +class MODULEBASE_EXPORT ModuleBase_WidgetChoice + : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetChoice(QWidget *theParent, const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetChoice(); @@ -63,21 +65,22 @@ Q_OBJECT /// Returns list of widget controls /// \return a controls list - virtual QList getControls() const; + virtual QList getControls() const; /// Returns text value for the property panel title /// \param theIndex a button index /// \return the title value QString getPropertyPanelTitle(int theIndex); - /// The slot is called when user press Ok or OkPlus buttons in the parent property panel + /// The slot is called when user press Ok or OkPlus buttons in the parent + /// property panel virtual void onFeatureAccepted(); signals: /// Segnal about selected item /// \param theWidget selected widget /// \param theIndex selected index - void itemSelected(ModuleBase_ModelWidget* theWidget, int theIndex); + void itemSelected(ModuleBase_ModelWidget *theWidget, int theIndex); protected: /// Saves the internal parameters to the given feature @@ -91,7 +94,7 @@ private slots: void onCurrentIndexChanged(int theIndex); private: - ModuleBase_ChoiceCtrl* myChoiceCtrl; + ModuleBase_ChoiceCtrl *myChoiceCtrl; // XML definition of titles QStringList myButtonTitles; diff --git a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp index 960faeb1c..2d5d6192c 100644 --- a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp +++ b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp @@ -14,44 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include +#include +#include #include #include -#include -#include #include -#include #include +#include #include #include -#include -#include -#include #include +#include +#include #include +#include #include const int DEFAULT_NAME_COLUMN_WIDTH = 200; -ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData) -{ +ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData) { myBaseShapeAttribute = theData->getProperty("base_shape_attribute"); std::string aPickParents = theData->getProperty("pick_concealed_parents"); - std::transform(aPickParents.begin(), aPickParents.end(), aPickParents.begin(), ::tolower); - myPickConcealedParents = aPickParents == "1" || aPickParents == "true" || aPickParents == "yes"; + std::transform(aPickParents.begin(), aPickParents.end(), aPickParents.begin(), + ::tolower); + myPickConcealedParents = + aPickParents == "1" || aPickParents == "true" || aPickParents == "yes"; - QGridLayout* aMainLay = new QGridLayout(this); + QGridLayout *aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); myView = new QTableWidget(this); @@ -62,32 +64,29 @@ ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects(QWidget* th myView->verticalHeader()->setVisible(false); } -ModuleBase_WidgetConcealedObjects::~ModuleBase_WidgetConcealedObjects() -{ -} +ModuleBase_WidgetConcealedObjects::~ModuleBase_WidgetConcealedObjects() {} -bool ModuleBase_WidgetConcealedObjects::storeValueCustom() -{ - if(!myFeature) +bool ModuleBase_WidgetConcealedObjects::storeValueCustom() { + if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeRefListPtr anAttributeList = aData->reflist(attributeID()); anAttributeList->clear(); for (int i = 0, aSize = myView->rowCount(); i < aSize; i++) { - QCheckBox* aButton = - dynamic_cast(myView->cellWidget(i, 0)->findChild()); + QCheckBox *aButton = dynamic_cast( + myView->cellWidget(i, 0)->findChild()); if (aButton->isChecked()) anAttributeList->append(myConcealedResults[i]); } return true; } -bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() -{ +bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() { FeaturePtr aBaseFeature; ObjectPtr anObject; if (myFeature) { - anObject = ModuleBase_Tools::getObject(myFeature->attribute(myBaseShapeAttribute)); + anObject = + ModuleBase_Tools::getObject(myFeature->attribute(myBaseShapeAttribute)); if (anObject.get() != NULL) aBaseFeature = ModelAPI_Feature::feature(anObject); } @@ -96,11 +95,12 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() myConcealedResults.clear(); myBaseFeature = aBaseFeature; if (myBaseFeature.get()) { - std::list > aResults; + std::list> aResults; std::set aParents; ModelAPI_Tools::getConcealedResults(myBaseFeature, aResults); - std::list >::const_iterator anIt = aResults.begin(), - aLast = aResults.end(); + std::list>::const_iterator + anIt = aResults.begin(), + aLast = aResults.end(); for (; anIt != aLast; anIt++) { ResultPtr aResult = *anIt; if (myPickConcealedParents) { @@ -110,8 +110,7 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() if (aParents.find(aRootParent) == aParents.end()) { aResult = aRootParent; aParents.insert(aRootParent); - } - else // do not add parent compound once again + } else // do not add parent compound once again continue; } } @@ -127,8 +126,8 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() AttributeRefListPtr anAttributeList = aData->reflist(attributeID()); for (int i = 0, aSize = myView->rowCount(); i < aSize; i++) { ResultPtr aResult = myConcealedResults[i]; - QCheckBox* aButton = - dynamic_cast(myView->cellWidget(i, 0)->findChild()); + QCheckBox *aButton = dynamic_cast( + myView->cellWidget(i, 0)->findChild()); bool isChecked = anAttributeList->isInList(aResult); bool aBlocked = aButton->blockSignals(true); @@ -138,30 +137,30 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() return true; } -QList ModuleBase_WidgetConcealedObjects::getControls() const -{ - QList result; +QList ModuleBase_WidgetConcealedObjects::getControls() const { + QList result; result << myView; return result; } void ModuleBase_WidgetConcealedObjects::addViewRow( - const std::shared_ptr& theResult) -{ + const std::shared_ptr &theResult) { int anId = myView->rowCount(); - myView->setRowCount(anId+1); + myView->setRowCount(anId + 1); - QWidget* aVisibilityWdg = new QWidget(this); - QVBoxLayout* aVisibilityLay = new QVBoxLayout(aVisibilityWdg); + QWidget *aVisibilityWdg = new QWidget(this); + QVBoxLayout *aVisibilityLay = new QVBoxLayout(aVisibilityWdg); aVisibilityLay->setContentsMargins(2, 2, 2, 2); - QCheckBox* aVisibilityBtn = new QCheckBox(aVisibilityWdg); + QCheckBox *aVisibilityBtn = new QCheckBox(aVisibilityWdg); aVisibilityLay->addWidget(aVisibilityBtn, 0, Qt::AlignHCenter); - connect(aVisibilityBtn, SIGNAL(toggled(bool)), this, SLOT(onItemToggled(bool))); + connect(aVisibilityBtn, SIGNAL(toggled(bool)), this, + SLOT(onItemToggled(bool))); aVisibilityBtn->setChecked(false); myView->setCellWidget(anId, 0, aVisibilityWdg); - myView->setItem(anId, 1, - new QTableWidgetItem(QString::fromStdWString(theResult->data()->name()))); + myView->setItem( + anId, 1, + new QTableWidgetItem(QString::fromStdWString(theResult->data()->name()))); if (anId == 1) { myView->setColumnWidth(0, myView->verticalHeader()->defaultSectionSize()); @@ -169,9 +168,7 @@ void ModuleBase_WidgetConcealedObjects::addViewRow( } } -void ModuleBase_WidgetConcealedObjects::onItemToggled(bool /*theState*/) -{ +void ModuleBase_WidgetConcealedObjects::onItemToggled(bool /*theState*/) { emit valuesChanged(); updateObject(myFeature); } - diff --git a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h index 29afee8c6..3b8547119 100644 --- a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h +++ b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETCONCEALEDOBJECTS_H_ @@ -23,9 +24,9 @@ #include #include -#include #include #include +#include class ModelAPI_Object; @@ -33,22 +34,22 @@ class QWidget; class QTableWidget; /** -* \ingroup GUI -* Implementation of model widget for table of concealed objects. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetConcealedObjects : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * Implementation of model widget for table of concealed objects. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetConcealedObjects + : public ModuleBase_ModelWidget { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object /// \param theData the widget configuration. - ModuleBase_WidgetConcealedObjects(QWidget* theParent, - const Config_WidgetAPI* theData); + ModuleBase_WidgetConcealedObjects(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetConcealedObjects(); /// Redefinition of virtual method - virtual QList getControls() const; + virtual QList getControls() const; /// The widget can not accept focus virtual bool canAcceptFocus() const { return false; }; @@ -64,7 +65,7 @@ protected: private: /// Creates a row in view /// \param theResult a result for the row - void addViewRow(const std::shared_ptr& theResult); + void addViewRow(const std::shared_ptr &theResult); private slots: /// Processes the display button click in the view. @@ -73,12 +74,15 @@ private slots: private: std::string myBaseShapeAttribute; ///< attribute of the base object - bool myPickConcealedParents; ///< select parent compsolid/compounds of concealed objects - QTableWidget* myView; ///< table view of visibility states + bool myPickConcealedParents; ///< select parent compsolid/compounds of + ///< concealed objects + QTableWidget *myView; ///< table view of visibility states - std::shared_ptr myBaseFeature; ///< backup of feature of filling the table view - /// backup of visualized in the view concealed objects, stored to avoid table rebuild by restore - std::map > myConcealedResults; + std::shared_ptr + myBaseFeature; ///< backup of feature of filling the table view + /// backup of visualized in the view concealed objects, stored to avoid table + /// rebuild by restore + std::map> myConcealedResults; }; #endif /* MODULEBASE_WIDGETCONCEALEDOBJECTS_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp index 10bb4d958..eea8bf073 100644 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include @@ -26,40 +27,41 @@ #include -/// Factory instance that will be initialized by first getting, one per application +/// Factory instance that will be initialized by first getting, one per +/// application std::shared_ptr MY_WIDGET_CREATOR_FACTORY; -std::shared_ptr ModuleBase_WidgetCreatorFactory::get() -{ +std::shared_ptr +ModuleBase_WidgetCreatorFactory::get() { if (!MY_WIDGET_CREATOR_FACTORY) { MY_WIDGET_CREATOR_FACTORY = - std::shared_ptr(new ModuleBase_WidgetCreatorFactory()); + std::shared_ptr( + new ModuleBase_WidgetCreatorFactory()); } return MY_WIDGET_CREATOR_FACTORY; } -ModuleBase_WidgetCreatorFactory::ModuleBase_WidgetCreatorFactory() -{ -} +ModuleBase_WidgetCreatorFactory::ModuleBase_WidgetCreatorFactory() {} -ModuleBase_WidgetCreatorFactory::~ModuleBase_WidgetCreatorFactory() -{ -} +ModuleBase_WidgetCreatorFactory::~ModuleBase_WidgetCreatorFactory() {} -void ModuleBase_WidgetCreatorFactory::registerCreator(const WidgetCreatorPtr& theCreator) -{ +void ModuleBase_WidgetCreatorFactory::registerCreator( + const WidgetCreatorPtr &theCreator) { std::set::const_iterator anIt, aLast; /// fill map of panels std::set aPanelTypes; theCreator->panelTypes(aPanelTypes); - for (anIt = aPanelTypes.begin(), aLast = aPanelTypes.end(); anIt != aLast; anIt++) { + for (anIt = aPanelTypes.begin(), aLast = aPanelTypes.end(); anIt != aLast; + anIt++) { std::string aKey = *anIt; if (!myPanelToCreator.contains(aKey)) myPanelToCreator[aKey] = theCreator; else { Events_InfoMessage("ModuleBase_WidgetCreatorFactory", - "The %1 panel XML definition has been already used by another widget creator") - .arg(aKey).send(); + "The %1 panel XML definition has been already used by " + "another widget creator") + .arg(aKey) + .send(); } } @@ -72,8 +74,10 @@ void ModuleBase_WidgetCreatorFactory::registerCreator(const WidgetCreatorPtr& th myCreators[aKey] = theCreator; else { Events_InfoMessage("ModuleBase_WidgetCreatorFactory", - "The %1 widget XML definition has been already used by another widget creator") - .arg(aKey).send(); + "The %1 widget XML definition has been already used " + "by another widget creator") + .arg(aKey) + .send(); } } @@ -86,40 +90,40 @@ void ModuleBase_WidgetCreatorFactory::registerCreator(const WidgetCreatorPtr& th myPageToCreator[aKey] = theCreator; else { Events_InfoMessage("ModuleBase_WidgetCreatorFactory", - "The %1 page XML definition has been already used by another widget creator") - .arg(aKey).send(); + "The %1 page XML definition has been already used by " + "another widget creator") + .arg(aKey) + .send(); } } } -bool ModuleBase_WidgetCreatorFactory::hasPanelWidget(const std::string& theType) -{ +bool ModuleBase_WidgetCreatorFactory::hasPanelWidget( + const std::string &theType) { return myPanelToCreator.contains(theType); } -QWidget* ModuleBase_WidgetCreatorFactory::createPanelByType(const std::string& theType, - QWidget* theParent, - const FeaturePtr& theFeature, - Config_WidgetAPI* myWidgetApi) -{ - QWidget* aPanel = 0; +QWidget *ModuleBase_WidgetCreatorFactory::createPanelByType( + const std::string &theType, QWidget *theParent, + const FeaturePtr &theFeature, Config_WidgetAPI *myWidgetApi) { + QWidget *aPanel = 0; if (myPanelToCreator.contains(theType)) { WidgetCreatorPtr aCreator = myPanelToCreator[theType]; - aPanel = aCreator->createPanelByType(theType, theParent, theFeature, myWidgetApi); + aPanel = aCreator->createPanelByType(theType, theParent, theFeature, + myWidgetApi); } return aPanel; } -bool ModuleBase_WidgetCreatorFactory::hasPageWidget(const std::string& theType) -{ +bool ModuleBase_WidgetCreatorFactory::hasPageWidget( + const std::string &theType) { return myPageToCreator.contains(theType); } -ModuleBase_PageBase* ModuleBase_WidgetCreatorFactory::createPageByType( - const std::string& theType, QWidget* theParent, - Config_WidgetAPI* theWidgetApi) -{ - ModuleBase_PageBase* aPage = 0; +ModuleBase_PageBase *ModuleBase_WidgetCreatorFactory::createPageByType( + const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi) { + ModuleBase_PageBase *aPage = 0; if (myPageToCreator.contains(theType)) { WidgetCreatorPtr aCreator = myPageToCreator[theType]; @@ -129,17 +133,15 @@ ModuleBase_PageBase* ModuleBase_WidgetCreatorFactory::createPageByType( return aPage; } - -ModuleBase_ModelWidget* ModuleBase_WidgetCreatorFactory::createWidgetByType( - const std::string& theType, QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop) -{ - ModuleBase_ModelWidget* aWidget = 0; +ModuleBase_ModelWidget *ModuleBase_WidgetCreatorFactory::createWidgetByType( + const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { + ModuleBase_ModelWidget *aWidget = 0; if (myCreators.contains(theType)) { WidgetCreatorPtr aCreator = myCreators[theType]; - aWidget = aCreator->createWidgetByType(theType, theParent, theWidgetApi, theWorkshop); + aWidget = aCreator->createWidgetByType(theType, theParent, theWidgetApi, + theWorkshop); } return aWidget; diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h index 8a867bc04..761cddabd 100644 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETCREATORFACTORY_H_ @@ -38,13 +39,12 @@ class ModuleBase_IWorkshop; class QWidget; /** -* \ingroup GUI -* A class for creation of widgets instances in for property panel using XML deskription of -* a feature -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory -{ - public: + * \ingroup GUI + * A class for creation of widgets instances in for property panel using XML + * deskription of a feature + */ +class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory { +public: /// Returns an singular instance of the class if it exists or create it static std::shared_ptr get(); @@ -54,12 +54,12 @@ class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory /// The creator is added to the internal container /// to be used when the createWidgetByType is called /// \param theCreator a new widget creator - void registerCreator(const WidgetCreatorPtr& theCreator); + void registerCreator(const WidgetCreatorPtr &theCreator); /// Returns true if there is a creator, which can make a panel by the type /// \param theType a type /// \return a boolean value - bool hasPanelWidget(const std::string& theType); + bool hasPanelWidget(const std::string &theType); /// Create panel by its type /// \param theType a type @@ -68,14 +68,14 @@ class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory /// \param theWidgetApi the widget configuration. /// The attribute of the model widget is obtained from XML /// \return a created panel or null - QWidget* createPanelByType(const std::string& theType, QWidget* theParent, - const FeaturePtr& theFeature, - Config_WidgetAPI* theWidgetApi = 0); + QWidget *createPanelByType(const std::string &theType, QWidget *theParent, + const FeaturePtr &theFeature, + Config_WidgetAPI *theWidgetApi = 0); /// Returns true if there is a creator, which can make a page by the type /// \param theType a type /// \return a boolean value - bool hasPageWidget(const std::string& theType); + bool hasPageWidget(const std::string &theType); /// Create page by its type /// \param theType a type @@ -83,9 +83,9 @@ class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory /// \param theWidgetApi the widget configuration. /// The attribute of the model widget is obtained from XML /// \return a created page or null - ModuleBase_PageBase* createPageByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi); + ModuleBase_PageBase *createPageByType(const std::string &theType, + QWidget *theParent, + Config_WidgetAPI *theWidgetApi); /// Create widget by its type /// \param theType a type @@ -94,10 +94,10 @@ class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory /// The attribute of the model widget is obtained from XML /// \param theWorkshop a workshop object instance /// \return a created widget or null - ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop); + ModuleBase_ModelWidget *createWidgetByType(const std::string &theType, + QWidget *theParent, + Config_WidgetAPI *theWidgetApi, + ModuleBase_IWorkshop *theWorkshop); private: /// Constructor is hidden @@ -113,6 +113,7 @@ private: QMap myCreators; }; -typedef std::shared_ptr WidgetCreatorFactoryPtr; +typedef std::shared_ptr + WidgetCreatorFactoryPtr; #endif /* MODULEBASE_WIDGETCREATORFACTORY_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index ff920c03a..01cbdd44a 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,20 +23,19 @@ #include #include +#include #include -#include -#include #include +#include +#include #include -#include +#include #include -#include -#include +#include #include #include #include -#include #include #include @@ -53,11 +53,10 @@ #include #endif -ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, - const Config_WidgetAPI* theData) - : ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) -{ - QFormLayout* aControlLay = new QFormLayout(this); +ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) { + QFormLayout *aControlLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); QString aLabelText = translate(theData->widgetLabel()); @@ -66,7 +65,8 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, if (!aLabelIcon.isEmpty()) myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); - bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + bool aAcceptVariables = + theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); mySpinBox = new ModuleBase_ParamSpinBox(this); mySpinBox->setAcceptVariables(aAcceptVariables); @@ -93,14 +93,15 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, aProp = theData->getProperty(DOUBLE_WDG_STEP); double aStepVal = QString::fromStdString(aProp).toDouble(&isOk); if (isOk) { - double aMinStep = pow(10, -1. * (double) mySpinBox->decimals()); - if(aStepVal < aMinStep){ + double aMinStep = pow(10, -1. * (double)mySpinBox->decimals()); + if (aStepVal < aMinStep) { aStepVal = aMinStep; } mySpinBox->setSingleStep(aStepVal); } - myDefaultVal = QString::fromStdString(getDefaultValue()).toDouble(&myHasDefault); + myDefaultVal = + QString::fromStdString(getDefaultValue()).toDouble(&myHasDefault); if (myHasDefault) mySpinBox->setValue(myDefaultVal); @@ -109,33 +110,32 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, myLabel->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); - // we should listen textChanged signal as valueChanged do not send when text is modified - connect(mySpinBox, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); + // we should listen textChanged signal as valueChanged do not send when text + // is modified + connect(mySpinBox, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesModified())); mySpinBox->setValueEnabled(isValueEnabled()); } -ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() -{ -} +ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() {} -void ModuleBase_WidgetDoubleValue::activateCustom() -{ +void ModuleBase_WidgetDoubleValue::activateCustom() { ModuleBase_ModelWidget::activateCustom(); QStringList aParameters; ModuleBase_Tools::getParameters(aParameters); mySpinBox->setCompletionList(aParameters); } -bool ModuleBase_WidgetDoubleValue::resetCustom() -{ +bool ModuleBase_WidgetDoubleValue::resetCustom() { bool aDone = false; if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) { aDone = false; } else { bool isOk; - double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk); - // reset the value just if there is a default value definition in the XML definition - // if the value can not be found by the default value, do nothing + double aDefValue = + QString::fromStdString(getDefaultValue()).toDouble(&isOk); + // reset the value just if there is a default value definition in the XML + // definition if the value can not be found by the default value, do nothing if (isOk) { ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue); storeValue(); @@ -145,8 +145,7 @@ bool ModuleBase_WidgetDoubleValue::resetCustom() return aDone; } -bool ModuleBase_WidgetDoubleValue::storeValueCustom() -{ +bool ModuleBase_WidgetDoubleValue::storeValueCustom() { DataPtr aData = myFeature->data(); AttributeDoublePtr aReal = aData->real(attributeID()); if (mySpinBox->hasVariable()) { @@ -168,15 +167,15 @@ bool ModuleBase_WidgetDoubleValue::storeValueCustom() ModuleBase_Tools::editParameter(myParameter, aText); } aText = aText.split('=').at(0); - } else if (myParameter.get()){ + } else if (myParameter.get()) { // Nullyfy the parameter reference without deletion of the created myParameter = FeaturePtr(); } aReal->setText(aText.toStdWString()); } else { - // it is important to set the empty text value to the attribute before set the value - // because setValue tries to calculate the attribute value according to the - // attribute current text + // it is important to set the empty text value to the attribute before set + // the value because setValue tries to calculate the attribute value + // according to the attribute current text if (aReal->expressionInvalid()) { aReal->setExpressionError(""); aReal->setExpressionInvalid(false); @@ -188,17 +187,16 @@ bool ModuleBase_WidgetDoubleValue::storeValueCustom() return true; } -bool ModuleBase_WidgetDoubleValue::restoreValueCustom() -{ +bool ModuleBase_WidgetDoubleValue::restoreValueCustom() { DataPtr aData = myFeature->data(); AttributeDoublePtr aRef = aData->real(attributeID()); std::wstring aTextRepr = aRef->text(); if (!aTextRepr.empty()) { QString aText = QString::fromStdWString(aTextRepr); ModuleBase_Tools::setSpinText(mySpinBox, aText); - } - else { - ModuleBase_Tools::setSpinValue(mySpinBox, aRef->isInitialized() ? aRef->value() : myDefaultVal); + } else { + ModuleBase_Tools::setSpinValue( + mySpinBox, aRef->isInitialized() ? aRef->value() : myDefaultVal); if (aRef->isInitialized() && aRef->expressionInvalid()) { aRef->setExpressionError(""); aRef->setExpressionInvalid(false); @@ -209,20 +207,15 @@ bool ModuleBase_WidgetDoubleValue::restoreValueCustom() return true; } -void ModuleBase_WidgetDoubleValue::selectContent() -{ - mySpinBox->selectAll(); -} +void ModuleBase_WidgetDoubleValue::selectContent() { mySpinBox->selectAll(); } -QList ModuleBase_WidgetDoubleValue::getControls() const -{ - QList aList; +QList ModuleBase_WidgetDoubleValue::getControls() const { + QList aList; aList.append(mySpinBox); return aList; } -bool ModuleBase_WidgetDoubleValue::processEnter() -{ +bool ModuleBase_WidgetDoubleValue::processEnter() { bool isModified = getValueState() == ModifiedInPP; if (isModified) { emit valuesChanged(); @@ -231,8 +224,7 @@ bool ModuleBase_WidgetDoubleValue::processEnter() return isModified; } -bool ModuleBase_WidgetDoubleValue::isModified() const -{ +bool ModuleBase_WidgetDoubleValue::isModified() const { QString aText = mySpinBox->text(); if (aText.isEmpty()) return false; @@ -244,4 +236,4 @@ bool ModuleBase_WidgetDoubleValue::isModified() const return false; } return true; -} \ No newline at end of file +} diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.h b/src/ModuleBase/ModuleBase_WidgetDoubleValue.h index f2d11c5d5..0255e7ac4 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.h +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetDoubleValue_H @@ -30,41 +31,45 @@ class QLabel; class QTimer; /** -* \ingroup GUI -* A class of property panel widget for double value input -* It can be defined with "doublevalue" keyword. For example: -* \code -* -* \endcode -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * A class of property panel widget for double value input + * It can be defined with "doublevalue" keyword. For example: + * \code + * \endcode + */ +class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue + : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetDoubleValue(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetDoubleValue(); /// The methiod called when widget is activated virtual void activateCustom(); - /// Select the internal content if it can be selected. It is empty in the default realization + /// Select the internal content if it can be selected. It is empty in the + /// default realization virtual void selectContent(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Returns True if data of its feature was modified during operation virtual bool isModified() const; - public slots: - // Delayed value chnged: when user starts typing something, - // it gives him a 0,5 second to finish typing, when sends valueChnaged() signal -// void onValueChanged(); +public slots: + // Delayed value chnged: when user starts typing something, + // it gives him a 0,5 second to finish typing, when sends valueChnaged() + // signal + // void onValueChanged(); protected: /// Returns true if the event is processed. @@ -84,10 +89,10 @@ protected: protected: /// Label of the widget - QLabel* myLabel; + QLabel *myLabel; /// Input value control - ModuleBase_ParamSpinBox* mySpinBox; + ModuleBase_ParamSpinBox *mySpinBox; FeaturePtr myParameter; diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index ced15fcde..046fecb11 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include #include #include @@ -27,68 +28,65 @@ #include #include -#include +#include #include +#include #include -#include #include #include +#include +#include #include +#include #include #include -#include -#include #include #include -#include -#include -#include +#include +#include // Dialog is redefined to avoid Escape key processing -class ModuleBase_EditorDialog : public QDialog -{ +class ModuleBase_EditorDialog : public QDialog { public: - ModuleBase_EditorDialog(QWidget* theParent, Qt::WindowFlags theFlags) - : QDialog(theParent, theFlags) - { + ModuleBase_EditorDialog(QWidget *theParent, Qt::WindowFlags theFlags) + : QDialog(theParent, theFlags) { setObjectName("ModuleBase_EditorDialog"); setMinimumWidth(100); } ~ModuleBase_EditorDialog() {} protected: - // Do nothing if key pressed because it is processing on operation manager level - virtual void keyPressEvent(QKeyEvent* theEvent) { + // Do nothing if key pressed because it is processing on operation manager + // level + virtual void keyPressEvent(QKeyEvent *theEvent) { if (theEvent->key() == Qt::Key_Escape) - return; + return; QDialog::keyPressEvent(theEvent); } }; -ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetDoubleValue(theParent, theData), - myXPosition(-1), myYPosition(-1), myEditorDialog(0) -{ -} +ModuleBase_WidgetEditor::ModuleBase_WidgetEditor( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_WidgetDoubleValue(theParent, theData), myXPosition(-1), + myYPosition(-1), myEditorDialog(0) {} -ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() -{ -} +ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() {} -bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, double theSpinMaxValue, - double& outValue, QString& outText) -{ +bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, + double theSpinMaxValue, + double &outValue, QString &outText) { bool isValueAccepted = false; - myEditorDialog = new ModuleBase_EditorDialog(QApplication::desktop(), Qt::FramelessWindowHint); + myEditorDialog = new ModuleBase_EditorDialog(QApplication::desktop(), + Qt::FramelessWindowHint); - QHBoxLayout* aLay = new QHBoxLayout(myEditorDialog); + QHBoxLayout *aLay = new QHBoxLayout(myEditorDialog); aLay->setContentsMargins(2, 2, 2, 2); - ModuleBase_ParamSpinBox* anEditor = new ModuleBase_ParamSpinBox(myEditorDialog); + ModuleBase_ParamSpinBox *anEditor = + new ModuleBase_ParamSpinBox(myEditorDialog); anEditor->setMinimum(theSpinMinValue); anEditor->setMaximum(theSpinMaxValue); @@ -126,31 +124,31 @@ bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, double theSpin return isValueAccepted; } -bool ModuleBase_WidgetEditor::focusTo() -{ +bool ModuleBase_WidgetEditor::focusTo() { showPopupEditor(); return false; } -bool ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) -{ +bool ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) { bool isValueAccepted = false; - // we need to emit the focus in event manually in order to save the widget as an active - // in the property panel before the mouse leave event happens in the viewer. The module - // ask an active widget and change the feature visualization if the widget is not the current - // one. Also we need this widget as active to provide call of processEnter() applyed - // by operation manager to the current widget. If not, the myEditorDialog will stay opened + // we need to emit the focus in event manually in order to save the widget as + // an active in the property panel before the mouse leave event happens in the + // viewer. The module ask an active widget and change the feature + // visualization if the widget is not the current one. Also we need this + // widget as active to provide call of processEnter() applyed by operation + // manager to the current widget. If not, the myEditorDialog will stay opened emitFocusInWidget(); // nds: it seems, that the envents processing is not necessary anymore // White while all events will be processed - //QApplication::processEvents(); + // QApplication::processEvents(); double aValue = mySpinBox->value(); QString aText; if (mySpinBox->hasVariable()) aText = mySpinBox->text(); - isValueAccepted = editedValue(mySpinBox->minimum(), mySpinBox->maximum(), aValue, aText); + isValueAccepted = + editedValue(mySpinBox->minimum(), mySpinBox->maximum(), aValue, aText); if (isValueAccepted) { if (aText.isEmpty()) { if (mySpinBox->hasVariable()) { @@ -166,28 +164,26 @@ bool ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) emit valuesChanged(); // the focus leaves the control automatically by the Enter/Esc event // it is processed in operation manager - //emit focusOutWidget(this); - } - else + // emit focusOutWidget(this); + } else storeValue(); } ModuleBase_Tools::setFocus(mySpinBox, "ModuleBase_WidgetEditor::editedValue"); mySpinBox->selectAll(); // enter is processed, so we need not anymore emit clicked signal - //if (theSendSignals && !myIsEditing && isValueAccepted) + // if (theSendSignals && !myIsEditing && isValueAccepted) // emit enterClicked(this); return isValueAccepted; } -void ModuleBase_WidgetEditor::setCursorPosition(const int theX, const int theY) -{ +void ModuleBase_WidgetEditor::setCursorPosition(const int theX, + const int theY) { myXPosition = theX; myYPosition = theY; } -bool ModuleBase_WidgetEditor::processEnter() -{ +bool ModuleBase_WidgetEditor::processEnter() { if (myEditorDialog) { myEditorDialog->accept(); return true; @@ -196,8 +192,7 @@ bool ModuleBase_WidgetEditor::processEnter() return ModuleBase_WidgetDoubleValue::processEnter(); } -bool ModuleBase_WidgetEditor::processEscape() -{ +bool ModuleBase_WidgetEditor::processEscape() { if (myEditorDialog) { myEditorDialog->reject(); return true; diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.h b/src/ModuleBase/ModuleBase_WidgetEditor.h index dbd603ee7..18951023f 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetEditor.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetEditor_H #define ModuleBase_WidgetEditor_H -#include #include "ModuleBase_WidgetDoubleValue.h" +#include #include #include @@ -32,20 +33,22 @@ class QLineEdit; /**\class ModuleBase_WidgetEditor * \ingroup GUI - * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls + * \brief Custom widget. An abstract class to be redefined to fill with some GUI + * controls */ -class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDoubleValue -{ -Q_OBJECT - public: +class MODULEBASE_EXPORT ModuleBase_WidgetEditor + : public ModuleBase_WidgetDoubleValue { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetEditor(QWidget *theParent, const Config_WidgetAPI *theData); /// Constructor /// \param theParent the parent object /// \param theAttribute The attribute of the model widget - ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute); + ModuleBase_WidgetEditor(QWidget *theParent, const std::string &theAttribute); /// Destructor virtual ~ModuleBase_WidgetEditor(); @@ -57,9 +60,9 @@ Q_OBJECT virtual bool focusTo(); /// Shous popup window under cursor for data editing - /// \param theSendSignals a flag whether the signals should be sent or the value - /// is to be applyed directly - /// \return true if the editor value is accepted + /// \param theSendSignals a flag whether the signals should be sent or the + /// value is to be applyed directly \return true if the editor value is + /// accepted bool showPopupEditor(const bool theSendSignals = true); /// Set current cursor position @@ -82,18 +85,18 @@ private: /// \param theOutText a result text /// \return true if the editor value is accepted bool editedValue(double theSpinMinValue, double theSpinMaxValue, - double& theOutValue, QString& theOutText); + double &theOutValue, QString &theOutText); - private: - ///< the current widget feature - FeaturePtr myFeature; +private: + ///< the current widget feature + FeaturePtr myFeature; - ///< the kinds of possible features - QStringList myFeatureKinds; + ///< the kinds of possible features + QStringList myFeatureKinds; - int myXPosition, myYPosition; + int myXPosition, myYPosition; - QDialog* myEditorDialog; + QDialog *myEditorDialog; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp index 862b19643..314cd6fce 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp @@ -14,81 +14,78 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include +#include +#include #include #include -#include #include -#include -#include +#include #include -#include +#include +#include +#include #include #include #include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include #include -#include +#include #include #include -ExpressionEditor::ExpressionEditor(QWidget* theParent) -: QPlainTextEdit(theParent), myCompletedAndSelected(false) -{ +ExpressionEditor::ExpressionEditor(QWidget *theParent) + : QPlainTextEdit(theParent), myCompletedAndSelected(false) { myCompleter = new QCompleter(this); myCompleter->setWidget(this); myCompleter->setCompletionMode(QCompleter::PopupCompletion); myCompleterModel = new QStringListModel(this); myCompleter->setModel(myCompleterModel); - // Use sorted model to accelerate completion (QCompleter will use binary search) + // Use sorted model to accelerate completion (QCompleter will use binary + // search) myCompleter->setModelSorting(QCompleter::CaseInsensitivelySortedModel); myCompleter->setCaseSensitivity(Qt::CaseInsensitive); - connect(myCompleter, SIGNAL(activated(const QString&)), - this, SLOT(insertCompletion(const QString&))); - (void) new QShortcut(QKeySequence(tr("Ctrl+Space", "Complete")), - this, SLOT(performCompletion())); + connect(myCompleter, SIGNAL(activated(const QString &)), this, + SLOT(insertCompletion(const QString &))); + (void)new QShortcut(QKeySequence(tr("Ctrl+Space", "Complete")), this, + SLOT(performCompletion())); connect(this, SIGNAL(textChanged()), this, SLOT(onTextChanged())); setTabChangesFocus(true); } -ExpressionEditor::~ExpressionEditor() -{ - -} +ExpressionEditor::~ExpressionEditor() {} -void ExpressionEditor::setCompletionList(QStringList& theList) -{ +void ExpressionEditor::setCompletionList(QStringList &theList) { theList.sort(); theList.removeDuplicates(); myCompleterModel->setStringList(theList); } -void ExpressionEditor::insertCompletion(const QString& theCompletion, bool isSingleWord) -{ +void ExpressionEditor::insertCompletion(const QString &theCompletion, + bool isSingleWord) { QTextCursor aCursor = textCursor(); - int numberOfCharsToComplete = theCompletion.length() - - myCompleter->completionPrefix().length(); + int numberOfCharsToComplete = + theCompletion.length() - myCompleter->completionPrefix().length(); int insertionPosition = aCursor.position(); aCursor.insertText(theCompletion.right(numberOfCharsToComplete)); if (isSingleWord) { @@ -99,157 +96,147 @@ void ExpressionEditor::insertCompletion(const QString& theCompletion, bool isSin setTextCursor(aCursor); } -void ExpressionEditor::performCompletion() -{ +void ExpressionEditor::performCompletion() { QTextCursor aCursor = textCursor(); aCursor.select(QTextCursor::WordUnderCursor); const QString aPrefix = aCursor.selectedText(); performCompletion(aPrefix); } -void ExpressionEditor::performCompletion(const QString& theCompletionPrefix) -{ - //populate model? +void ExpressionEditor::performCompletion(const QString &theCompletionPrefix) { + // populate model? if (theCompletionPrefix != myCompleter->completionPrefix()) { myCompleter->setCompletionPrefix(theCompletionPrefix); - myCompleter->popup()->setCurrentIndex(myCompleter->completionModel()->index(0, 0)); + myCompleter->popup()->setCurrentIndex( + myCompleter->completionModel()->index(0, 0)); } if (myCompleter->completionCount() == 1) { insertCompletion(myCompleter->currentCompletion(), true); } else { QRect aRect = cursorRect(); - aRect.setWidth(myCompleter->popup()->sizeHintForColumn(0) - + myCompleter->popup()->verticalScrollBar()->sizeHint().width()); + aRect.setWidth( + myCompleter->popup()->sizeHintForColumn(0) + + myCompleter->popup()->verticalScrollBar()->sizeHint().width()); myCompleter->complete(aRect); } } -void ExpressionEditor::keyPressEvent(QKeyEvent* theEvent) -{ +void ExpressionEditor::keyPressEvent(QKeyEvent *theEvent) { if (myCompletedAndSelected && handledCompletedAndSelected(theEvent)) return; myCompletedAndSelected = false; if (myCompleter->popup()->isVisible()) { switch (theEvent->key()) { - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Escape: - case Qt::Key_Enter: - case Qt::Key_Return: - theEvent->ignore(); + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Escape: + case Qt::Key_Enter: + case Qt::Key_Return: + theEvent->ignore(); return; - default: - myCompleter->popup()->hide(); - break; + default: + myCompleter->popup()->hide(); + break; } - } - else { + } else { switch (theEvent->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - emit keyReleased(this, theEvent); - // do not react to the Enter key, the property panel processes it - return; + case Qt::Key_Enter: + case Qt::Key_Return: + emit keyReleased(this, theEvent); + // do not react to the Enter key, the property panel processes it + return; + break; + default: break; - default: - break; } } QPlainTextEdit::keyPressEvent(theEvent); } -bool ExpressionEditor::handledCompletedAndSelected(QKeyEvent* theEvent) -{ +bool ExpressionEditor::handledCompletedAndSelected(QKeyEvent *theEvent) { myCompletedAndSelected = false; QTextCursor aCursor = textCursor(); switch (theEvent->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: aCursor.clearSelection(); break; - case Qt::Key_Escape: aCursor.removeSelectedText(); break; - default: return false; + case Qt::Key_Enter: + case Qt::Key_Return: + aCursor.clearSelection(); + break; + case Qt::Key_Escape: + aCursor.removeSelectedText(); + break; + default: + return false; } setTextCursor(aCursor); theEvent->accept(); return true; } -void ExpressionEditor::setPlaceHolderText( const QString& thePlaceHolderText ) -{ +void ExpressionEditor::setPlaceHolderText(const QString &thePlaceHolderText) { myPlaceHolderText = thePlaceHolderText; } -QString ExpressionEditor::placeHolderText() const -{ - return myPlaceHolderText; -} +QString ExpressionEditor::placeHolderText() const { return myPlaceHolderText; } -void ExpressionEditor::paintEvent( QPaintEvent* theEvent ) -{ - QPlainTextEdit::paintEvent( theEvent ); +void ExpressionEditor::paintEvent(QPaintEvent *theEvent) { + QPlainTextEdit::paintEvent(theEvent); - if( toPlainText().isEmpty() ) - { - QPainter aPainter( viewport() ); + if (toPlainText().isEmpty()) { + QPainter aPainter(viewport()); QFontMetrics aFontMetrics = fontMetrics(); QPointF offset(contentOffset()); QRect r = rect(); int m = (int)document()->documentMargin(); - QRect lineRect( r.x() + m + offset.x(), offset.y(), - r.width() - 2*m, aFontMetrics.height() ); + QRect lineRect(r.x() + m + offset.x(), offset.y(), r.width() - 2 * m, + aFontMetrics.height()); - Qt::Alignment va = QStyle::visualAlignment( layoutDirection(), Qt::AlignLeft ); - int minLB = qMax( 0, -aFontMetrics.minLeftBearing() ); + Qt::Alignment va = + QStyle::visualAlignment(layoutDirection(), Qt::AlignLeft); + int minLB = qMax(0, -aFontMetrics.minLeftBearing()); QColor aColor = palette().text().color(); - aColor.setAlpha( 128 ); + aColor.setAlpha(128); QPen anOldpen = aPainter.pen(); - aPainter.setPen( aColor ); + aPainter.setPen(aColor); lineRect.adjust(minLB, 0, 0, 0); - QString elidedText = - aFontMetrics.elidedText( myPlaceHolderText, Qt::ElideRight, lineRect.width() ); - aPainter.drawText( lineRect, va, elidedText ); - aPainter.setPen( anOldpen ); + QString elidedText = aFontMetrics.elidedText( + myPlaceHolderText, Qt::ElideRight, lineRect.width()); + aPainter.drawText(lineRect, va, elidedText); + aPainter.setPen(anOldpen); } } -void ExpressionEditor::onTextChanged() -{ - emit valueModified(); -} - +void ExpressionEditor::onTextChanged() { emit valueModified(); } -ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& thePlaceHolder ) -: ModuleBase_ModelWidget(theParent, theData) -{ - QVBoxLayout* aMainLay = new QVBoxLayout(this); +ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( + QWidget *theParent, const Config_WidgetAPI *theData, + const std::string &thePlaceHolder) + : ModuleBase_ModelWidget(theParent, theData) { + QVBoxLayout *aMainLay = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); myResultLabel = new QLabel(this); myResultLabel->setWordWrap(true); QFontMetrics fm(myResultLabel->font()); - myResultLabel->setMinimumHeight(fm.height() * 2); // set 2 line height as minimum - myResultLabel->setAlignment(Qt::AlignLeft|Qt::AlignBottom); + myResultLabel->setMinimumHeight(fm.height() * + 2); // set 2 line height as minimum + myResultLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom); aMainLay->addWidget(myResultLabel); myEditor = new ExpressionEditor(this); myEditor->setMinimumHeight(20); - myEditor->setPlaceHolderText( translate( thePlaceHolder ) ); + myEditor->setPlaceHolderText(translate(thePlaceHolder)); aMainLay->addWidget(myEditor); this->setLayout(aMainLay); connect(myEditor, SIGNAL(valueModified()), this, SIGNAL(valuesModified())); - connect(myEditor, SIGNAL(keyReleased(QObject*, QKeyEvent*)), - this, SIGNAL(keyReleased(QObject*, QKeyEvent*))); + connect(myEditor, SIGNAL(keyReleased(QObject *, QKeyEvent *)), this, + SIGNAL(keyReleased(QObject *, QKeyEvent *))); } -ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() -{ -} +ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() {} -void ModuleBase_WidgetExprEditor::activateCustom() -{ +void ModuleBase_WidgetExprEditor::activateCustom() { ModuleBase_ModelWidget::activateCustom(); QStringList aParameters; @@ -257,14 +244,11 @@ void ModuleBase_WidgetExprEditor::activateCustom() myEditor->setCompletionList(aParameters); } -void ModuleBase_WidgetExprEditor::initializeValueByActivate() -{ -} +void ModuleBase_WidgetExprEditor::initializeValueByActivate() {} -bool ModuleBase_WidgetExprEditor::storeValueCustom() -{ +bool ModuleBase_WidgetExprEditor::storeValueCustom() { // A rare case when plugin was not loaded. - if(!myFeature) + if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); @@ -278,10 +262,11 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom() std::string anErrorMessage = myFeature->string("ExpressionError")->value(); if (anErrorMessage.empty()) { ResultParameterPtr aParam = - std::dynamic_pointer_cast(myFeature->firstResult()); - if(aParam.get()) { + std::dynamic_pointer_cast( + myFeature->firstResult()); + if (aParam.get()) { AttributeDoublePtr aValueAttr = - aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + aParam->data()->real(ModelAPI_ResultParameter::VALUE()); if (aValueAttr.get()) { double aValue = aValueAttr->value(); aStateMsg = "Result: " + QString::number(aValue); @@ -294,10 +279,9 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom() return true; } -bool ModuleBase_WidgetExprEditor::restoreValueCustom() -{ +bool ModuleBase_WidgetExprEditor::restoreValueCustom() { // A rare case when plugin was not loaded. - if(!myFeature) + if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); @@ -307,7 +291,8 @@ bool ModuleBase_WidgetExprEditor::restoreValueCustom() int pos = aCursor.position(); QString aRestoredStr; if (aStringAttr->isUValue()) - aRestoredStr = QString::fromStdWString(Locale::Convert::toWString(aStringAttr->valueU())); + aRestoredStr = QString::fromStdWString( + Locale::Convert::toWString(aStringAttr->valueU())); else aRestoredStr = QString::fromStdString(aStringAttr->value()); myEditor->setPlainText(aRestoredStr); @@ -318,15 +303,13 @@ bool ModuleBase_WidgetExprEditor::restoreValueCustom() return true; } -QList ModuleBase_WidgetExprEditor::getControls() const -{ - QList result; +QList ModuleBase_WidgetExprEditor::getControls() const { + QList result; result << myEditor; return result; } -bool ModuleBase_WidgetExprEditor::processEnter() -{ +bool ModuleBase_WidgetExprEditor::processEnter() { bool isModified = getValueState() == ModifiedInPP; if (isModified) { emit valuesChanged(); @@ -335,7 +318,4 @@ bool ModuleBase_WidgetExprEditor::processEnter() return isModified; } -void ModuleBase_WidgetExprEditor::onTextChanged() -{ - emit valuesChanged(); -} +void ModuleBase_WidgetExprEditor::onTextChanged() { emit valuesChanged(); } diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.h b/src/ModuleBase/ModuleBase_WidgetExprEditor.h index 78b346c0a..e770acaf2 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETEXPREDITOR_H_ @@ -23,43 +24,45 @@ #include #include -#include #include +#include +#include #include #include -#include class QWidget; class QStringListModel; class QCompleter; /** -* \ingroup GUI -* A multi-line text editor which lets to input formula and provides a list of completion strings -*/ -class ExpressionEditor: public QPlainTextEdit -{ + * \ingroup GUI + * A multi-line text editor which lets to input formula and provides a list of + * completion strings + */ +class ExpressionEditor : public QPlainTextEdit { Q_OBJECT - public: - /// Constructor - /// \param theParent a parent widget - explicit ExpressionEditor(QWidget* theParent = 0); +public: + /// Constructor + /// \param theParent a parent widget + explicit ExpressionEditor(QWidget *theParent = 0); virtual ~ExpressionEditor(); /// Set list of completion strings - void setCompletionList(QStringList&); + void setCompletionList(QStringList &); /// Set a text which will be shown when the listr is empty - void setPlaceHolderText( const QString& ); + void setPlaceHolderText(const QString &); /// Returns placeholder list QString placeHolderText() const; - public slots: +public slots: /// Insert additional string for completion /// \param theCompletion a string to insert - /// \param isSingleWord a flag shows that inserted string is single word or not - void insertCompletion(const QString& theCompletion, bool isSingleWord = false); + /// \param isSingleWord a flag shows that inserted string is single word or + /// not + void insertCompletion(const QString &theCompletion, + bool isSingleWord = false); /// Perform completion void performCompletion(); @@ -71,56 +74,56 @@ signals: /// The signal about text change in the text editor void valueModified(); - /// The signal about key release on the control, that corresponds to the attribute - /// \param theObject a sender of the event - /// \param theEvent key release event - void keyReleased(QObject* theObject, QKeyEvent* theEvent); + /// The signal about key release on the control, that corresponds to the + /// attribute \param theObject a sender of the event \param theEvent key + /// release event + void keyReleased(QObject *theObject, QKeyEvent *theEvent); - protected: +protected: /// Perform completion by prefix /// \param theCompletionPrefix a prefix for looking for completion - void performCompletion(const QString& theCompletionPrefix); + void performCompletion(const QString &theCompletionPrefix); /// Redefinition of virtual method /// \param theEvent a key press event - virtual void keyPressEvent(QKeyEvent* theEvent); + virtual void keyPressEvent(QKeyEvent *theEvent); /// Key events processing /// theEvent a key event - bool handledCompletedAndSelected(QKeyEvent* theEvent); + bool handledCompletedAndSelected(QKeyEvent *theEvent); /// Redefinition of virtual method - virtual void paintEvent( QPaintEvent* ); + virtual void paintEvent(QPaintEvent *); private: - QStringListModel* myCompleterModel; - QCompleter* myCompleter; + QStringListModel *myCompleterModel; + QCompleter *myCompleter; bool myCompletedAndSelected; QString myPlaceHolderText; }; /** -* \ingroup GUI -* A Widget which provides an input of an expression -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetExprEditor : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * A Widget which provides an input of an expression + */ +class MODULEBASE_EXPORT ModuleBase_WidgetExprEditor + : public ModuleBase_ModelWidget { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object /// \param theData the widget configuration. /// \param thePlaceHolder a placeholder string - ModuleBase_WidgetExprEditor( QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& thePlaceHolder ); + ModuleBase_WidgetExprEditor(QWidget *theParent, + const Config_WidgetAPI *theData, + const std::string &thePlaceHolder); virtual ~ModuleBase_WidgetExprEditor(); /// The methiod called when widget is activated virtual void activateCustom(); /// Redefinition of virtual method - virtual QList getControls() const; + virtual QList getControls() const; protected slots: /// A slot for processing text changed event @@ -141,9 +144,9 @@ protected: virtual bool restoreValueCustom(); private: - /// A line edit control - QLabel* myResultLabel; - ExpressionEditor* myEditor; + /// A line edit control + QLabel *myResultLabel; + ExpressionEditor *myEditor; }; #endif /* MODULEBASE_WIDGETEXPREDITOR_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index 486b44250..84be50a58 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -14,60 +14,61 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include +#include #include -#include -#include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include #include +#include #include +#include +#include +#include +#include -#include #include +#include #include #include -#include -#include #include -#include -#include +#include +#include #include +#include #include -#include +#include #include +#include #ifdef _DEBUG #include @@ -76,28 +77,26 @@ #include #include -ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepresentation, - ModuleBase_IWorkshop* theWorkshop, - const std::string theAttributePrefix) - : myWorkshop(theWorkshop) -{ +ModuleBase_WidgetFactory::ModuleBase_WidgetFactory( + const std::string &theXmlRepresentation, ModuleBase_IWorkshop *theWorkshop, + const std::string theAttributePrefix) + : myWorkshop(theWorkshop) { myWidgetApi = new Config_WidgetAPI(theXmlRepresentation, theAttributePrefix); } -ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory() -{ - delete myWidgetApi; -} +ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory() { delete myWidgetApi; } -void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool alignToTop) -{ +void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase *thePage, + bool alignToTop) { std::string aWType = myWidgetApi->widgetType(); if (aWType == NODE_FEATURE) { - // if XML definition of the feature contains the next key, the widgets should not be created, - // but a specific panel should be made. However, to provide persistent of the panel values, - // we need to get into the panel the feature of the operation. As a result this panel should - // be created after the feature creating(create operation). The method setPanel() of this - // class is used for this. Here, we just return to avoid the widgets creation. + // if XML definition of the feature contains the next key, the widgets + // should not be created, but a specific panel should be made. However, to + // provide persistent of the panel values, we need to get into the panel the + // feature of the operation. As a result this panel should be created after + // the feature creating(create operation). The method setPanel() of this + // class is used for this. Here, we just return to avoid the widgets + // creation. std::string aPanelName = myWidgetApi->getProperty(PROPERTY_PANEL_ID); if (!aPanelName.empty()) return; @@ -106,20 +105,23 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool a if (!myWidgetApi->toChildWidget()) return; - do { //Iterate over each node + do { // Iterate over each node std::string aWdgType = myWidgetApi->widgetType(); // Create PageGroup TODO: extract if (myWidgetApi->isGroupBoxWidget() || ModuleBase_WidgetCreatorFactory::get()->hasPageWidget(aWdgType)) { - //if current widget is groupbox (container) process it's children recursively - ModuleBase_PageBase* aPage = createPageByType(aWdgType, thePage->pageWidget()); + // if current widget is groupbox (container) process it's children + // recursively + ModuleBase_PageBase *aPage = + createPageByType(aWdgType, thePage->pageWidget()); createWidget(aPage); thePage->addPageWidget(aPage); } else { // Create a ModelWidget - ModuleBase_ModelWidget* aWidget = createWidgetByType(aWdgType, thePage->pageWidget()); + ModuleBase_ModelWidget *aWidget = + createWidgetByType(aWdgType, thePage->pageWidget()); if (aWidget) { if (!myWidgetApi->getBooleanAttribute(ATTR_INTERNAL, false)) { thePage->addModelWidget(aWidget); @@ -129,23 +131,27 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool a } // Create PagedContainer TODO: extract if (myWidgetApi->isPagedWidget()) { - //If current widget is toolbox or switch-casebox then fetch all - //it's pages recursively and setup into the widget. + // If current widget is toolbox or switch-casebox then fetch all + // it's pages recursively and setup into the widget. if (myWidgetApi->toChildWidget()) { do { - if (myWidgetApi->getBooleanAttribute(ATTR_INTERNAL, false)) continue; - QString aPageName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)); + if (myWidgetApi->getBooleanAttribute(ATTR_INTERNAL, false)) + continue; + QString aPageName = + qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)); QString aTooltip = qs(myWidgetApi->getProperty(FEATURE_TOOLTIP)); QString aCaseId = qs(myWidgetApi->getProperty(_ID)); - ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget); + ModuleBase_PageBase *aPage = new ModuleBase_PageWidget(aWidget); createWidget(aPage); - if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX || aWdgType == WDG_RADIOBOX) { - ModuleBase_PagedContainer* aContainer = - qobject_cast(aWidget); - - QString anIconPath = qs( myWidgetApi->getProperty( CONTAINER_PAGE_ICON ) ); - QPixmap anIcon = ModuleBase_IconFactory::loadPixmap( anIconPath ); - aContainer->addPage( aPage, aPageName, aCaseId, anIcon, aTooltip); + if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX || + aWdgType == WDG_RADIOBOX) { + ModuleBase_PagedContainer *aContainer = + qobject_cast(aWidget); + + QString anIconPath = + qs(myWidgetApi->getProperty(CONTAINER_PAGE_ICON)); + QPixmap anIcon = ModuleBase_IconFactory::loadPixmap(anIconPath); + aContainer->addPage(aPage, aPageName, aCaseId, anIcon, aTooltip); } } while (myWidgetApi->toNextWidget()); } @@ -157,14 +163,15 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool a thePage->alignToTop(); } -void ModuleBase_WidgetFactory::createPanel(ModuleBase_PageBase* thePage, - const FeaturePtr& theFeature) -{ +void ModuleBase_WidgetFactory::createPanel(ModuleBase_PageBase *thePage, + const FeaturePtr &theFeature) { std::string aPanelName = myWidgetApi->getProperty(PROPERTY_PANEL_ID); - if (!aPanelName.empty() && ModuleBase_WidgetCreatorFactory::get()->hasPanelWidget(aPanelName)) { - QWidget* aPanel = ModuleBase_WidgetCreatorFactory::get()->createPanelByType(aPanelName, - thePage->pageWidget(), theFeature, myWidgetApi); - ModuleBase_ModelWidget* aModelWdg = dynamic_cast(aPanel); + if (!aPanelName.empty() && + ModuleBase_WidgetCreatorFactory::get()->hasPanelWidget(aPanelName)) { + QWidget *aPanel = ModuleBase_WidgetCreatorFactory::get()->createPanelByType( + aPanelName, thePage->pageWidget(), theFeature, myWidgetApi); + ModuleBase_ModelWidget *aModelWdg = + dynamic_cast(aPanel); if (aModelWdg) thePage->addModelWidget(aModelWdg); else @@ -173,21 +180,20 @@ void ModuleBase_WidgetFactory::createPanel(ModuleBase_PageBase* thePage, } } -void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, - const std::string& theWidgetId) -{ +void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase *thePage, + const std::string &theWidgetId) { bool aFound = false; moveToWidgetId(theWidgetId, aFound); if (aFound) { std::string aWdgType = myWidgetApi->widgetType(); // Create a ModelWidget - ModuleBase_ModelWidget* aWidget = createWidgetByType(aWdgType, thePage->pageWidget()); + ModuleBase_ModelWidget *aWidget = + createWidgetByType(aWdgType, thePage->pageWidget()); if (aWidget) { if (!myWidgetApi->getBooleanAttribute(ATTR_INTERNAL, false)) { thePage->addModelWidget(aWidget); - } - else { + } else { aWidget->setVisible(false); } } @@ -195,44 +201,44 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, } } -void ModuleBase_WidgetFactory::getAttributeTitle(const std::string& theAttributeId, - std::string& theTitle) -{ +void ModuleBase_WidgetFactory::getAttributeTitle( + const std::string &theAttributeId, std::string &theTitle) { bool aFound = false; moveToWidgetId(theAttributeId, aFound); if (aFound) { - theTitle = QString::fromStdString(myWidgetApi->widgetLabel()).toStdString().c_str(); + theTitle = QString::fromStdString(myWidgetApi->widgetLabel()) + .toStdString() + .c_str(); if (theTitle.empty()) theTitle = - QString::fromStdString(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)).toStdString().c_str(); - } - else + QString::fromStdString(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)) + .toStdString() + .c_str(); + } else theTitle = theAttributeId; } -void ModuleBase_WidgetFactory::getGreedAttribute(std::string& theAttributeId) -{ +void ModuleBase_WidgetFactory::getGreedAttribute(std::string &theAttributeId) { if (!theAttributeId.empty()) return; if (!myWidgetApi->toChildWidget()) return; - do { //Iterate over each node + do { // Iterate over each node std::string aWdgType = myWidgetApi->widgetType(); // Find title under PageGroup if (myWidgetApi->isGroupBoxWidget() || - ModuleBase_WidgetCreatorFactory::get()->hasPageWidget(aWdgType)) { + ModuleBase_WidgetCreatorFactory::get()->hasPageWidget(aWdgType)) { getGreedAttribute(theAttributeId); - } - else { + } else { // Find title here std::string anAttributeId = myWidgetApi->widgetId(); if (myWidgetApi->getBooleanAttribute(ATTR_GREED, false)) theAttributeId = anAttributeId; if (theAttributeId.empty() && myWidgetApi->isPagedWidget()) { - //If current widget is toolbox or switch-casebox then fetch all - //it's pages recursively and setup into the widget. + // If current widget is toolbox or switch-casebox then fetch all + // it's pages recursively and setup into the widget. if (myWidgetApi->toChildWidget()) { do { getGreedAttribute(theAttributeId); @@ -243,28 +249,27 @@ void ModuleBase_WidgetFactory::getGreedAttribute(std::string& theAttributeId) } while (theAttributeId.empty() && myWidgetApi->toNextWidget()); } -void ModuleBase_WidgetFactory::moveToWidgetId(const std::string& theWidgetId, bool& theFound) -{ +void ModuleBase_WidgetFactory::moveToWidgetId(const std::string &theWidgetId, + bool &theFound) { if (theFound) return; if (!myWidgetApi->toChildWidget()) return; - do { //Iterate over each node + do { // Iterate over each node std::string aWdgType = myWidgetApi->widgetType(); // Find title under PageGroup if (myWidgetApi->isGroupBoxWidget() || - ModuleBase_WidgetCreatorFactory::get()->hasPageWidget(aWdgType)) { + ModuleBase_WidgetCreatorFactory::get()->hasPageWidget(aWdgType)) { moveToWidgetId(theWidgetId, theFound); - } - else { + } else { // Find title here std::string anAttributeId = myWidgetApi->widgetId(); theFound = anAttributeId == theWidgetId; if (!theFound && myWidgetApi->isPagedWidget()) { - //If current widget is toolbox or switch-casebox then fetch all - //it's pages recursively and setup into the widget. + // If current widget is toolbox or switch-casebox then fetch all + // it's pages recursively and setup into the widget. if (myWidgetApi->toChildWidget()) { do { moveToWidgetId(theWidgetId, theFound); @@ -275,38 +280,38 @@ void ModuleBase_WidgetFactory::moveToWidgetId(const std::string& theWidgetId, bo } while (!theFound && myWidgetApi->toNextWidget()); } -ModuleBase_PageBase* ModuleBase_WidgetFactory::createPageByType(const std::string& theType, - QWidget* theParent) -{ - ModuleBase_PageBase* aResult = NULL; +ModuleBase_PageBase * +ModuleBase_WidgetFactory::createPageByType(const std::string &theType, + QWidget *theParent) { + ModuleBase_PageBase *aResult = NULL; if (theType == WDG_GROUP) { QString aGroupName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)); - ModuleBase_PageGroupBox* aPage = new ModuleBase_PageGroupBox(theParent); - aPage->setTitle(ModuleBase_Tools::translate( - myWidgetApi->myFeatureId, aGroupName.toStdString())); + ModuleBase_PageGroupBox *aPage = new ModuleBase_PageGroupBox(theParent); + aPage->setTitle(ModuleBase_Tools::translate(myWidgetApi->myFeatureId, + aGroupName.toStdString())); aResult = aPage; - } - else if (theType == WDG_OPTIONALBOX) { - ModuleBase_WidgetOptionalBox* aPage = new ModuleBase_WidgetOptionalBox(theParent, - myWidgetApi); + } else if (theType == WDG_OPTIONALBOX) { + ModuleBase_WidgetOptionalBox *aPage = + new ModuleBase_WidgetOptionalBox(theParent, myWidgetApi); aResult = aPage; } if (!aResult) - aResult = ModuleBase_WidgetCreatorFactory::get()->createPageByType(theType, theParent, - myWidgetApi); + aResult = ModuleBase_WidgetCreatorFactory::get()->createPageByType( + theType, theParent, myWidgetApi); - ModuleBase_ModelWidget* aWidget = dynamic_cast(aResult); + ModuleBase_ModelWidget *aWidget = + dynamic_cast(aResult); if (aWidget) myModelWidgets.append(aWidget); return aResult; } -ModuleBase_ModelWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType, - QWidget* theParent) -{ - ModuleBase_ModelWidget* result = NULL; +ModuleBase_ModelWidget * +ModuleBase_WidgetFactory::createWidgetByType(const std::string &theType, + QWidget *theParent) { + ModuleBase_ModelWidget *result = NULL; if (theType == WDG_INFO) { result = new ModuleBase_WidgetLabel(theParent, myWidgetApi); @@ -319,28 +324,34 @@ ModuleBase_ModelWidget* ModuleBase_WidgetFactory::createWidgetByType(const std:: } else if (theType == WDG_INTEGERVALUE) { result = new ModuleBase_WidgetIntValue(theParent, myWidgetApi); } else if (theType == WDG_SHAPE_SELECTOR) { - result = new ModuleBase_WidgetShapeSelector(theParent, myWorkshop, myWidgetApi); + result = + new ModuleBase_WidgetShapeSelector(theParent, myWorkshop, myWidgetApi); } else if (theType == WDG_FEATURE_SELECTOR) { - result = new ModuleBase_WidgetFeatureSelector(theParent, myWorkshop, myWidgetApi); + result = new ModuleBase_WidgetFeatureSelector(theParent, myWorkshop, + myWidgetApi); } else if (theType == WDG_BOOLVALUE) { result = new ModuleBase_WidgetBoolValue(theParent, myWidgetApi); - //} else if (theType == WDG_DOUBLEVALUE_EDITOR) { - // result = new ModuleBase_WidgetEditor(theParent, myWidgetApi); + //} else if (theType == WDG_DOUBLEVALUE_EDITOR) { + // result = new ModuleBase_WidgetEditor(theParent, myWidgetApi); } else if (theType == WDG_FILE_SELECTOR) { result = new ModuleBase_WidgetFileSelector(theParent, myWidgetApi); } else if (theType == WDG_CHOICE) { result = new ModuleBase_WidgetChoice(theParent, myWidgetApi); } else if (theType == WDG_STRINGVALUE) { - std::string aPlaceHolder = myWidgetApi->getProperty( WDG_PLACE_HOLDER ); - result = new ModuleBase_WidgetLineEdit( theParent, myWidgetApi, aPlaceHolder ); + std::string aPlaceHolder = myWidgetApi->getProperty(WDG_PLACE_HOLDER); + result = + new ModuleBase_WidgetLineEdit(theParent, myWidgetApi, aPlaceHolder); } else if (theType == WDG_NAMEVALUE) { - std::string aPlaceHolder = myWidgetApi->getProperty( WDG_PLACE_HOLDER ); - result = new ModuleBase_WidgetNameEdit( theParent, myWidgetApi, aPlaceHolder ); + std::string aPlaceHolder = myWidgetApi->getProperty(WDG_PLACE_HOLDER); + result = + new ModuleBase_WidgetNameEdit(theParent, myWidgetApi, aPlaceHolder); } else if (theType == WDG_EXPR_EDITOR) { - std::string aPlaceHolder = myWidgetApi->getProperty( WDG_PLACE_HOLDER ); - result = new ModuleBase_WidgetExprEditor( theParent, myWidgetApi, aPlaceHolder ); + std::string aPlaceHolder = myWidgetApi->getProperty(WDG_PLACE_HOLDER); + result = + new ModuleBase_WidgetExprEditor(theParent, myWidgetApi, aPlaceHolder); } else if (theType == WDG_MULTISELECTOR) { - result = new ModuleBase_WidgetMultiSelector(theParent, myWorkshop, myWidgetApi); + result = + new ModuleBase_WidgetMultiSelector(theParent, myWorkshop, myWidgetApi); } else if (theType == WDG_CONCEALED_OBJECTS_VIEW) { result = new ModuleBase_WidgetConcealedObjects(theParent, myWidgetApi); } else if (theType == WDG_TOOLBOX) { @@ -356,27 +367,29 @@ ModuleBase_ModelWidget* ModuleBase_WidgetFactory::createWidgetByType(const std:: } else if (theType == WDG_ACTION) { result = new ModuleBase_WidgetAction(theParent, myWidgetApi); } else if (theType == WDG_POINT_INPUT) { - result = new ModuleBase_WidgetPointInput(theParent, myWorkshop, myWidgetApi); + result = + new ModuleBase_WidgetPointInput(theParent, myWorkshop, myWidgetApi); } else if (theType == WDG_SELECTION_FILTERS) { - result = new ModuleBase_WidgetSelectionFilter(theParent, myWorkshop, myWidgetApi); + result = new ModuleBase_WidgetSelectionFilter(theParent, myWorkshop, + myWidgetApi); } else { - result = myWorkshop->module()->createWidgetByType(theType, theParent, myWidgetApi); + result = myWorkshop->module()->createWidgetByType(theType, theParent, + myWidgetApi); if (!result) - result = ModuleBase_WidgetCreatorFactory::get()->createWidgetByType(theType, theParent, - myWidgetApi, myWorkshop); - #ifdef _DEBUG + result = ModuleBase_WidgetCreatorFactory::get()->createWidgetByType( + theType, theParent, myWidgetApi, myWorkshop); +#ifdef _DEBUG if (!result) { - qDebug("ModuleBase_WidgetFactory::fillWidget: find bad widget type %s", theType.c_str()); + qDebug("ModuleBase_WidgetFactory::fillWidget: find bad widget type %s", + theType.c_str()); } - #endif +#endif } if (result) myModelWidgets.append(result); return result; } -QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) -{ +QString ModuleBase_WidgetFactory::qs(const std::string &theStdString) { return QString::fromStdString(theStdString); } - diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h index 5c6ce02d2..febdf2ac5 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETFACTORY_H_ @@ -23,8 +24,8 @@ #include #include -#include #include +#include class QObject; class QWidget; @@ -33,92 +34,92 @@ class ModuleBase_IWorkshop; class ModuleBase_PageBase; /** -* \ingroup GUI -* A class for creation of widgets instances in for property panel using XML deskription of -* a feature -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetFactory -{ - public: - /// Constructor - /// \param theXmlRepresentation content of XML file - /// \param theWorkshop reference to workshop instance - /// \param theAttributePrefix prefix that must be added to the attribute name - ModuleBase_WidgetFactory(const std::string& theXmlRepresentation, - ModuleBase_IWorkshop* theWorkshop, + * \ingroup GUI + * A class for creation of widgets instances in for property panel using XML + * deskription of a feature + */ +class MODULEBASE_EXPORT ModuleBase_WidgetFactory { +public: + /// Constructor + /// \param theXmlRepresentation content of XML file + /// \param theWorkshop reference to workshop instance + /// \param theAttributePrefix prefix that must be added to the attribute name + ModuleBase_WidgetFactory(const std::string &theXmlRepresentation, + ModuleBase_IWorkshop *theWorkshop, const std::string theAttributePrefix = ""); virtual ~ModuleBase_WidgetFactory(); /// Creates content widget for property panel /// \param thePage a parent page /// \param alignToTop align to top flag (true by default) - void createWidget(ModuleBase_PageBase* thePage, bool alignToTop = true); + void createWidget(ModuleBase_PageBase *thePage, bool alignToTop = true); /// Creates property panel content for the feature /// \param thePage a parent page /// \param theFeature a feature to fill the panel - void createPanel(ModuleBase_PageBase* thePage, const FeaturePtr& theFeature); + void createPanel(ModuleBase_PageBase *thePage, const FeaturePtr &theFeature); /// Creates one widget for property panel for the widget with given index /// \param thePage a parent widget /// \param theWidgetId a widget index - void createWidget(ModuleBase_PageBase* thePage, - const std::string& theWidgetId); + void createWidget(ModuleBase_PageBase *thePage, + const std::string &theWidgetId); /// Returns list of model widgets - QList getModelWidgets() const - { + QList getModelWidgets() const { return myModelWidgets; } - /// Returns the value of the title key from XML definition of the attribute in the feature - /// \param theAttributeId a value of a kind of the attribute under the feature - /// \param theTitle the result title - void getAttributeTitle(const std::string& theAttributeId, - std::string& theTitle); + /// Returns the value of the title key from XML definition of the attribute in + /// the feature \param theAttributeId a value of a kind of the attribute under + /// the feature \param theTitle the result title + void getAttributeTitle(const std::string &theAttributeId, + std::string &theTitle); - /// Returns the identifier of the first found attribute where greed field value is set and true - /// \param theAttributeId an outpup parameter with attribute - void getGreedAttribute(std::string& theAttributeId); + /// Returns the identifier of the first found attribute where greed field + /// value is set and true \param theAttributeId an outpup parameter with + /// attribute + void getGreedAttribute(std::string &theAttributeId); /// Returns widget API from XML - const Config_WidgetAPI* widgetAPI() const { return myWidgetApi; } + const Config_WidgetAPI *widgetAPI() const { return myWidgetApi; } protected: /// check if ModuleBase_Widget has expandable widgets in getControls - bool hasExpandingControls(QWidget* theParent); + bool hasExpandingControls(QWidget *theParent); /// Create page by its type /// \param theType a type /// \param theParent a parent widget - ModuleBase_PageBase* createPageByType(const std::string& theType, - QWidget* theParent); + ModuleBase_PageBase *createPageByType(const std::string &theType, + QWidget *theParent); /// Create widget by its type /// \param theType a type /// \param theParent a parent widget - ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent = NULL); + ModuleBase_ModelWidget *createWidgetByType(const std::string &theType, + QWidget *theParent = NULL); /// Convert STD string to QT string /// \param theStdString is STD string - static QString qs(const std::string& theStdString); + static QString qs(const std::string &theStdString); - /// It updates internal config api to point in the structure to given id of widget - /// The method is recusive and it stops when the found flag is true + /// It updates internal config api to point in the structure to given id of + /// widget The method is recusive and it stops when the found flag is true /// \param theWidgetId a widget id key value - /// \param theFound a flag about found windget and recursive search should be stopped - void moveToWidgetId(const std::string& theWidgetId, bool& theFound); + /// \param theFound a flag about found windget and recursive search should be + /// stopped + void moveToWidgetId(const std::string &theWidgetId, bool &theFound); - private: - /// API object for XML reading - Config_WidgetAPI* myWidgetApi; +private: + /// API object for XML reading + Config_WidgetAPI *myWidgetApi; /// Reference to workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; /// List of created model widgets - QList myModelWidgets; + QList myModelWidgets; }; #endif /* ModuleBase_WidgetFactory_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp index 4acbe1dbb..6d4781058 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp @@ -14,21 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include -#include -#include -#include #include #include -#include +#include +#include +#include #include #include +#include +#include #include #include @@ -47,28 +48,26 @@ #include -#include -#include +#include +#include +#include #include +#include #include -#include #include -#include -#include -#include +#include +#include #include #include #include - -ModuleBase_WidgetFeatureSelector::ModuleBase_WidgetFeatureSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetValidated(theParent, theWorkshop, theData) -{ - QFormLayout* aLayout = new QFormLayout(this); +ModuleBase_WidgetFeatureSelector::ModuleBase_WidgetFeatureSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetValidated(theParent, theWorkshop, theData) { + QFormLayout *aLayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aLayout); QString aLabelText = translate(theData->widgetLabel()); @@ -77,7 +76,6 @@ ModuleBase_WidgetFeatureSelector::ModuleBase_WidgetFeatureSelector(QWidget* theP if (!aLabelIcon.isEmpty()) myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); - QString aToolTip = translate(theData->widgetTooltip()); myTextLine = new QLineEdit(this); QString anObjName = QString::fromStdString(attributeID()); @@ -91,54 +89,52 @@ ModuleBase_WidgetFeatureSelector::ModuleBase_WidgetFeatureSelector(QWidget* theP } //******************************************************************** -ModuleBase_WidgetFeatureSelector::~ModuleBase_WidgetFeatureSelector() -{ -} +ModuleBase_WidgetFeatureSelector::~ModuleBase_WidgetFeatureSelector() {} //******************************************************************** -bool ModuleBase_WidgetFeatureSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetFeatureSelector::setSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { ObjectPtr anObject = ModelAPI_Feature::feature(thePrs->object()); GeomShapePtr aShape; FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); - // the last flag is to be depending on hasObject is called before. To be corrected later - return ModuleBase_Tools::setObject(attribute(), aFeature, aShape, - myWorkshop, myIsInValidate, true); + // the last flag is to be depending on hasObject is called before. To be + // corrected later + return ModuleBase_Tools::setObject(attribute(), aFeature, aShape, myWorkshop, + myIsInValidate, true); } //******************************************************************** -void ModuleBase_WidgetFeatureSelector::selectionModes(int& theModuleSelectionModes, - QIntList& theModes) -{ +void ModuleBase_WidgetFeatureSelector::selectionModes( + int &theModuleSelectionModes, QIntList &theModes) { theModuleSelectionModes = -1; theModes.push_back(ModuleBase_ResultPrs::Sel_Result); } //******************************************************************** -void ModuleBase_WidgetFeatureSelector::activateCustom() -{ +void ModuleBase_WidgetFeatureSelector::activateCustom() { // Restore selection in the viewer by the attribute selection list - // it should be postponed to have current widget as active to validate restored selection - //static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); - //ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); + // it should be postponed to have current widget as active to validate + // restored selection + // static Events_ID anEvent = + // Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); + // ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); } //******************************************************************** -bool ModuleBase_WidgetFeatureSelector::storeValueCustom() -{ +bool ModuleBase_WidgetFeatureSelector::storeValueCustom() { // the value is stored on the selection changed signal processing return true; } //******************************************************************** -bool ModuleBase_WidgetFeatureSelector::setSelection(QList& theValues, - const bool theToValidate) -{ +bool ModuleBase_WidgetFeatureSelector::setSelection( + QList &theValues, const bool theToValidate) { if (theValues.empty()) { - // In order to make reselection possible, set empty object and shape should be done - setSelectionCustom(std::shared_ptr(new ModuleBase_ViewerPrs( - ObjectPtr(), GeomShapePtr(), NULL))); + // In order to make reselection possible, set empty object and shape should + // be done + setSelectionCustom(std::shared_ptr( + new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL))); return false; } // it removes the processed value from the parameters list @@ -152,8 +148,7 @@ bool ModuleBase_WidgetFeatureSelector::setSelection(QListblockSignals(true); updateSelectionName(); this->blockSignals(isBlocked); @@ -162,26 +157,24 @@ bool ModuleBase_WidgetFeatureSelector::restoreValueCustom() } //******************************************************************** -QList ModuleBase_WidgetFeatureSelector::getControls() const -{ - QList aControls; +QList ModuleBase_WidgetFeatureSelector::getControls() const { + QList aControls; aControls.append(myTextLine); return aControls; } -void ModuleBase_WidgetFeatureSelector::updateFocus() -{ +void ModuleBase_WidgetFeatureSelector::updateFocus() { emit focusOutWidget(this); } //******************************************************************** -void ModuleBase_WidgetFeatureSelector::updateSelectionName() -{ +void ModuleBase_WidgetFeatureSelector::updateSelectionName() { DataPtr aData = myFeature->data(); if (!aData->isValid()) return; - ObjectPtr anObject = ModuleBase_Tools::getObject(myFeature->attribute(attributeID())); + ObjectPtr anObject = + ModuleBase_Tools::getObject(myFeature->attribute(attributeID())); if (anObject.get() != NULL) { std::wstring aName = anObject->data()->name(); myTextLine->setText(QString::fromStdWString(aName)); @@ -191,8 +184,8 @@ void ModuleBase_WidgetFeatureSelector::updateSelectionName() } //******************************************************************** -bool ModuleBase_WidgetFeatureSelector::isValidInFilters(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetFeatureSelector::isValidInFilters( + const ModuleBase_ViewerPrsPtr &thePrs) { bool aValid = false; ObjectPtr anObject = thePrs->object(); @@ -207,34 +200,34 @@ bool ModuleBase_WidgetFeatureSelector::isValidInFilters(const ModuleBase_ViewerP } //******************************************************************** -bool ModuleBase_WidgetFeatureSelector::processSelection() -{ - QList aSelected = myWorkshop->selection()->getSelected( - ModuleBase_ISelection::AllControls); +bool ModuleBase_WidgetFeatureSelector::processSelection() { + QList aSelected = + myWorkshop->selection()->getSelected(ModuleBase_ISelection::AllControls); - bool isDone = setSelection(aSelected, true/*false*/); + bool isDone = setSelection(aSelected, true /*false*/); updateOnSelectionChanged(isDone); return isDone; } //******************************************************************** -void ModuleBase_WidgetFeatureSelector::updateOnSelectionChanged(const bool theDone) -{ - // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in - // the same place repeatedly without mouse moved. In the case validation by filters is not - // perfromed, so an invalid object is selected. E.g. distance constraint, selection of a point. - // the 3rd click in the same point allow using this point. +void ModuleBase_WidgetFeatureSelector::updateOnSelectionChanged( + const bool theDone) { + // "false" flag should be used here, it connects to the #26658 OCC bug, when + // the user click in the same place repeatedly without mouse moved. In the + // case validation by filters is not perfromed, so an invalid object is + // selected. E.g. distance constraint, selection of a point. the 3rd click in + // the same point allow using this point. emit valuesChanged(); - // the updateObject method should be called to flush the updated sigal. The workshop listens it, - // calls validators for the feature and, as a result, updates the Apply button state. + // the updateObject method should be called to flush the updated sigal. The + // workshop listens it, calls validators for the feature and, as a result, + // updates the Apply button state. updateObject(myFeature); - // we need to forget about previous validation result as the current selection can influence on it + // we need to forget about previous validation result as the current selection + // can influence on it clearValidatedCash(); if (theDone) updateFocus(); } - - diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h index 610229b19..fef68ad53 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetFeatureSelector_H @@ -29,56 +30,56 @@ class QLabel; class QLineEdit; /** -* \ingroup GUI -* Implementation of widget for feature selection. -* This type of widget can be defined in XML file with 'feature_selector' keyword. -* For example: -* \code -* -* \endcode -* It can use following parameters: -* - id - name of object attribute -* - label - content of widget's label -* - tooltip - the witget's tooltip text -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetFeatureSelector : public ModuleBase_WidgetValidated -{ -Q_OBJECT - public: - + * \ingroup GUI + * Implementation of widget for feature selection. + * This type of widget can be defined in XML file with 'feature_selector' + * keyword. For example: \code + * \endcode + * It can use following parameters: + * - id - name of object attribute + * - label - content of widget's label + * - tooltip - the witget's tooltip text + */ +class MODULEBASE_EXPORT ModuleBase_WidgetFeatureSelector + : public ModuleBase_WidgetValidated { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetFeatureSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetFeatureSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetFeatureSelector(); /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs - /// The method is called by the current operation to process the operation preselection. - /// It is redefined to check the value validity and if it is, fill the attribute with by value - /// \param theValues the wrapped selection values - /// \param theToValidate a flag on validation of the values - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + /// The method is called by the current operation to process the operation + /// preselection. It is redefined to check the value validity and if it is, + /// fill the attribute with by value \param theValues the wrapped selection + /// values \param theToValidate a flag on validation of the values + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param theModes [out] a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param theModes [out] a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + setSelectionCustom(const std::shared_ptr &thePrs); protected: /// The method called when widget is activated @@ -99,7 +100,8 @@ protected: /// Checks whether all active viewer filters validate the presentation /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidInFilters(const std::shared_ptr& thePrs); + virtual bool + isValidInFilters(const std::shared_ptr &thePrs); /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set @@ -112,10 +114,10 @@ protected: //----------- Class members ------------- protected: /// Label of the widget - QLabel* myLabel; + QLabel *myLabel; /// Input control of the widget - QLineEdit* myTextLine; + QLineEdit *myTextLine; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp index e27932ea3..11ad36ce3 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include #include -#include #include -#include +#include #include +#include #include #include @@ -41,32 +42,30 @@ #include #include - /// Default path static QString myDefaultPath; - -ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), myFileDialog(0) -{ +ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myFileDialog(0) { myTitle = translate(theData->getProperty("title")); myType = (theData->getProperty("type") == "save") ? WFS_SAVE : WFS_OPEN; if (myDefaultPath.isNull() || myDefaultPath.isEmpty()) myDefaultPath = QString::fromStdString(theData->getProperty("path")); if (myDefaultPath.isEmpty()) - myDefaultPath = Config_PropManager::string("Plugins", "import_initial_path").c_str(); + myDefaultPath = + Config_PropManager::string("Plugins", "import_initial_path").c_str(); - QGridLayout* aMainLay = new QGridLayout(this); + QGridLayout *aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); - QLabel* aTitleLabel = new QLabel(myTitle, this); + QLabel *aTitleLabel = new QLabel(myTitle, this); aTitleLabel->setIndent(1); aMainLay->addWidget(aTitleLabel, 0, 0); myPathField = new QLineEdit(this); aMainLay->addWidget(myPathField, 1, 0); - QPushButton* aSelectPathBtn = new QPushButton("...", this); + QPushButton *aSelectPathBtn = new QPushButton("...", this); aSelectPathBtn->setToolTip(tr("Select file...")); aSelectPathBtn->setMaximumWidth(20); aSelectPathBtn->setMaximumHeight(20); @@ -76,18 +75,14 @@ ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(QWidget* theParent, aMainLay->setHorizontalSpacing(1); this->setLayout(aMainLay); - connect(myPathField, SIGNAL(textChanged(const QString&)), - this, SLOT(onPathChanged())); - connect(aSelectPathBtn, SIGNAL(clicked()), - this, SLOT(onPathSelectionBtn())); + connect(myPathField, SIGNAL(textChanged(const QString &)), this, + SLOT(onPathChanged())); + connect(aSelectPathBtn, SIGNAL(clicked()), this, SLOT(onPathSelectionBtn())); } -ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() -{ -} +ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() {} -bool ModuleBase_WidgetFileSelector::storeValueCustom() -{ +bool ModuleBase_WidgetFileSelector::storeValueCustom() { // A rare case when plugin was not loaded. if (!myFeature) return false; @@ -99,15 +94,14 @@ bool ModuleBase_WidgetFileSelector::storeValueCustom() return true; } -bool ModuleBase_WidgetFileSelector::restoreValueCustom() -{ +bool ModuleBase_WidgetFileSelector::restoreValueCustom() { // A rare case when plugin was not loaded. if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); - char16_t* aStr = aStringAttr->valueU(); + char16_t *aStr = aStringAttr->valueU(); QString aNewText = QString::fromUtf16(aStr); if (myPathField->text() != aNewText) { bool isBlocked = myPathField->blockSignals(true); @@ -118,21 +112,18 @@ bool ModuleBase_WidgetFileSelector::restoreValueCustom() return true; } -QList ModuleBase_WidgetFileSelector::getControls() const -{ - QList result; +QList ModuleBase_WidgetFileSelector::getControls() const { + QList result; result << myPathField; return result; } -bool ModuleBase_WidgetFileSelector::isCurrentPathValid() -{ +bool ModuleBase_WidgetFileSelector::isCurrentPathValid() { QFileInfo aFile(myPathField->text()); return aFile.exists(); } -bool ModuleBase_WidgetFileSelector::processEscape() -{ +bool ModuleBase_WidgetFileSelector::processEscape() { if (myFileDialog) { myFileDialog->reject(); return true; @@ -140,23 +131,21 @@ bool ModuleBase_WidgetFileSelector::processEscape() return ModuleBase_ModelWidget::processEscape(); } - -void ModuleBase_WidgetFileSelector::onPathSelectionBtn() -{ +void ModuleBase_WidgetFileSelector::onPathSelectionBtn() { QString aDefaultPath = myPathField->text().isEmpty() - ? myDefaultPath - : QFileInfo(myPathField->text()).absolutePath(); + ? myDefaultPath + : QFileInfo(myPathField->text()).absolutePath(); QString aFilter = filterString(); - // use Option prohibited native dialog using to have both lower/upper extensions of files - // satisfied to dialog filter on Linux(Calibre) Issue #2055 + // use Option prohibited native dialog using to have both lower/upper + // extensions of files satisfied to dialog filter on Linux(Calibre) Issue + // #2055 myFileDialog = new QFileDialog(this, myTitle, aDefaultPath, aFilter); myFileDialog->setNameFilter(aFilter); myFileDialog->setOptions(QFileDialog::DontUseNativeDialog); myFileDialog->setAcceptMode(myType == WFS_SAVE ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen); - if (myFileDialog->exec() == QDialog::Accepted) - { + if (myFileDialog->exec() == QDialog::Accepted) { mySelectedFilter = myFileDialog->selectedNameFilter(); QStringList aFileNames = myFileDialog->selectedFiles(); if (!aFileNames.empty()) { @@ -173,44 +162,46 @@ void ModuleBase_WidgetFileSelector::onPathSelectionBtn() myFileDialog = 0; } -void ModuleBase_WidgetFileSelector::onPathChanged() -{ +void ModuleBase_WidgetFileSelector::onPathChanged() { if (myType == WFS_OPEN && !isCurrentPathValid()) return; storeValue(); emit valuesChanged(); } -QString ModuleBase_WidgetFileSelector::formatToFilter(const QString & theFormat) -{ +QString +ModuleBase_WidgetFileSelector::formatToFilter(const QString &theFormat) { if (theFormat.isEmpty() && !theFormat.contains(":")) return QString(); QStringList aExtesionList = theFormat.section(':', 0, 0).split("|"); QString aFormat = theFormat.section(':', 1, 1); - return QString("%1 files (%2)").arg(aFormat) - .arg(QStringList(aExtesionList).replaceInStrings(QRegExp("^(.*)$"), "*.\\1").join(" ")); + return QString("%1 files (%2)") + .arg(aFormat) + .arg(QStringList(aExtesionList) + .replaceInStrings(QRegExp("^(.*)$"), "*.\\1") + .join(" ")); } -QString ModuleBase_WidgetFileSelector::filterToShortFormat(const QString & theFilter) -{ +QString +ModuleBase_WidgetFileSelector::filterToShortFormat(const QString &theFilter) { // Simplified implementation. // It relies on theFilter was made by formatToFilter() function. return theFilter.section(' ', 0, 0); } -QStringList ModuleBase_WidgetFileSelector::filterToExtensions(const QString & theFilter) -{ +QStringList +ModuleBase_WidgetFileSelector::filterToExtensions(const QString &theFilter) { // Simplified implementation. // It relies on theFilter was made by formatToFilter() function. - QStringList anExtensions = theFilter.section("(", 1, 1).section(")", 0, 0).split(" "); + QStringList anExtensions = + theFilter.section("(", 1, 1).section(")", 0, 0).split(" "); return anExtensions; } -QStringList ModuleBase_WidgetFileSelector::getValidatorFormats() const -{ +QStringList ModuleBase_WidgetFileSelector::getValidatorFormats() const { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); ModelAPI_ValidatorsFactory::Validators allValidators; aFactory->validators(myFeature->getKind(), myAttributeID, allValidators); @@ -226,12 +217,11 @@ QStringList ModuleBase_WidgetFileSelector::getValidatorFormats() const return aResult; } -QString ModuleBase_WidgetFileSelector::filterString() const -{ +QString ModuleBase_WidgetFileSelector::filterString() const { QStringList aResult; QStringList aValidatorFormats = getValidatorFormats(); - foreach(const QString & eachFormat, aValidatorFormats) { + foreach (const QString &eachFormat, aValidatorFormats) { aResult << formatToFilter(eachFormat); } if (myType == WFS_OPEN) @@ -239,19 +229,22 @@ QString ModuleBase_WidgetFileSelector::filterString() const return aResult.join(";;"); } -QString ModuleBase_WidgetFileSelector::applyExtension(const QString& theFileName, - const QString& theFilter) -{ +QString +ModuleBase_WidgetFileSelector::applyExtension(const QString &theFileName, + const QString &theFilter) { QString aResult = theFileName; bool hasExtension = false; QStringList anExtensions = filterToExtensions(theFilter); - foreach(const QString& anExtension, anExtensions) { - if (theFileName.endsWith(QString(".") + anExtension.section(".", 1, 1), Qt::CaseInsensitive)) { + foreach (const QString &anExtension, anExtensions) { + if (theFileName.endsWith(QString(".") + anExtension.section(".", 1, 1), + Qt::CaseInsensitive)) { hasExtension = true; break; } } if (!hasExtension && !anExtensions.isEmpty()) - aResult = QString("%1.%2").arg(theFileName).arg(anExtensions[0].section(".", 1, 1)); + aResult = QString("%1.%2") + .arg(theFileName) + .arg(anExtensions[0].section(".", 1, 1)); return aResult; } diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.h b/src/ModuleBase/ModuleBase_WidgetFileSelector.h index 8de9b9ecc..4fec7d84c 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETFILESELECTOR_H_ @@ -32,41 +33,43 @@ class QLineEdit; class QWidget; /** -* \ingroup GUI -* Implementation of model widget for open file widget. -* It can be defined as following: -* \code -* -* -* -* \endcode -* It can use following parameters: -* - id - name of object attribute -* - type - type of dialog. Possible values: open, save. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * Implementation of model widget for open file widget. + * It can be defined as following: + * \code + * + * + * + * \endcode + * It can use following parameters: + * - id - name of object attribute + * - type - type of dialog. Possible values: open, save. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector + : public ModuleBase_ModelWidget { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetFileSelector(QWidget* theParent, - const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetFileSelector(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetFileSelector(); - virtual QList getControls() const; + virtual QList getControls() const; /// Returns true if a file on the current path in the line edit /// exists and has supported format bool isCurrentPathValid(); public slots: - /// Processing of path selection button press + /// Processing of path selection button press void onPathSelectionBtn(); /// Processing of path changing @@ -84,13 +87,13 @@ protected: protected: /// Converts format to filter string - static QString formatToFilter(const QString & theFormat); + static QString formatToFilter(const QString &theFormat); /// Returns a short format string of theFilter string - static QString filterToShortFormat(const QString & theFilter); + static QString filterToShortFormat(const QString &theFilter); /// Returns a list of extensions from theFilter - static QStringList filterToExtensions(const QString & theFilter); + static QStringList filterToExtensions(const QString &theFilter); /// Returns list of validator formats QStringList getValidatorFormats() const; @@ -102,12 +105,13 @@ protected: /// \param theFileName a file name /// \param theFilter a file filter /// \return the file name with extension - static QString applyExtension(const QString& theFileName, const QString& theFilter); + static QString applyExtension(const QString &theFileName, + const QString &theFilter); protected: - /// A control for path input - QLineEdit* myPathField; - QFileDialog* myFileDialog; ///< started dialog + /// A control for path input + QLineEdit *myPathField; + QFileDialog *myFileDialog; ///< started dialog /// A title of open file dialog box QString myTitle; @@ -118,8 +122,8 @@ protected: /// A title of open file dialog box enum { WFS_OPEN, ///< open file - WFS_SAVE ///< save file - } myType; ///< type of dialog + WFS_SAVE ///< save file + } myType; ///< type of dialog }; #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index ee374461a..334a1c6a7 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -14,18 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include #include #include -#include -#include +#include #include -#include #include +#include #include #include @@ -33,27 +33,26 @@ #include #include -#include +#include #include #include -#include #include +#include #include #ifndef INT_MAX -#define INT_MAX 2147483647 +#define INT_MAX 2147483647 #endif #ifdef _DEBUG #include #endif -ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) -{ - QFormLayout* aControlLay = new QFormLayout(this); +ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) { + QFormLayout *aControlLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); QString aLabelText = translate(theData->widgetLabel()); @@ -99,31 +98,28 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent, myLabel->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); - connect(mySpinBox, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); + connect(mySpinBox, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesModified())); } -ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() -{ -} +ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() {} -void ModuleBase_WidgetIntValue::activateCustom() -{ +void ModuleBase_WidgetIntValue::activateCustom() { ModuleBase_ModelWidget::activateCustom(); QStringList aParameters; ModuleBase_Tools::getParameters(aParameters); mySpinBox->setCompletionList(aParameters); } -bool ModuleBase_WidgetIntValue::resetCustom() -{ +bool ModuleBase_WidgetIntValue::resetCustom() { bool aDone = false; if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) { aDone = false; } else { bool isOk; int aDefValue = QString::fromStdString(getDefaultValue()).toInt(&isOk); - // reset the value just if there is a default value definition in the XML definition - // if the value can not be found by the default value, do nothing + // reset the value just if there is a default value definition in the XML + // definition if the value can not be found by the default value, do nothing if (isOk) { ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue); storeValue(); @@ -133,8 +129,7 @@ bool ModuleBase_WidgetIntValue::resetCustom() return aDone; } -bool ModuleBase_WidgetIntValue::storeValueCustom() -{ +bool ModuleBase_WidgetIntValue::storeValueCustom() { DataPtr aData = myFeature->data(); AttributeIntegerPtr anAttribute = aData->integer(attributeID()); if (mySpinBox->hasVariable()) { @@ -162,9 +157,9 @@ bool ModuleBase_WidgetIntValue::storeValueCustom() } anAttribute->setText(aText.toStdWString()); } else { - // it is important to set the empty text value to the attribute before set the value - // because setValue tries to calculate the attribute value according to the - // attribute current text + // it is important to set the empty text value to the attribute before set + // the value because setValue tries to calculate the attribute value + // according to the attribute current text if (anAttribute->expressionInvalid()) { anAttribute->setExpressionError(""); anAttribute->setExpressionInvalid(false); @@ -176,29 +171,29 @@ bool ModuleBase_WidgetIntValue::storeValueCustom() return true; } -bool ModuleBase_WidgetIntValue::restoreValueCustom() -{ +bool ModuleBase_WidgetIntValue::restoreValueCustom() { DataPtr aData = myFeature->data(); AttributeIntegerPtr anAttribute = aData->integer(attributeID()); std::wstring aTextRepr = anAttribute->text(); if (!aTextRepr.empty()) { QString aText = QString::fromStdWString(aTextRepr); - //if (aText.endsWith('=')) { - // if (!myParameter.get()) { - // QString aName = aText.left(aText.indexOf('=')).trimmed(); - // myParameter = ModuleBase_Tools::findParameter(aName); - // } - // /// If myParameter is empty then it was not created because of an error - // if (!myParameter.get()) - // return false; + // if (aText.endsWith('=')) { + // if (!myParameter.get()) { + // QString aName = aText.left(aText.indexOf('=')).trimmed(); + // myParameter = ModuleBase_Tools::findParameter(aName); + // } + // /// If myParameter is empty then it was not created because of an error + // if (!myParameter.get()) + // return false; // AttributeStringPtr aExprAttr = myParameter->string("expression"); // aText += aExprAttr->value().c_str(); //} ModuleBase_Tools::setSpinText(mySpinBox, aText); } else { - ModuleBase_Tools::setSpinValue(mySpinBox, - anAttribute->isInitialized() ? anAttribute->value() : myDefVal); + ModuleBase_Tools::setSpinValue(mySpinBox, anAttribute->isInitialized() + ? anAttribute->value() + : myDefVal); if (anAttribute->isInitialized() && anAttribute->expressionInvalid()) { anAttribute->setExpressionError(""); anAttribute->setExpressionInvalid(false); @@ -209,20 +204,15 @@ bool ModuleBase_WidgetIntValue::restoreValueCustom() return true; } -void ModuleBase_WidgetIntValue::selectContent() -{ - mySpinBox->selectAll(); -} +void ModuleBase_WidgetIntValue::selectContent() { mySpinBox->selectAll(); } -QList ModuleBase_WidgetIntValue::getControls() const -{ - QList aList; +QList ModuleBase_WidgetIntValue::getControls() const { + QList aList; aList.append(mySpinBox); return aList; } -bool ModuleBase_WidgetIntValue::processEnter() -{ +bool ModuleBase_WidgetIntValue::processEnter() { bool isModified = getValueState() == ModifiedInPP; if (isModified) { emit valuesChanged(); @@ -231,8 +221,7 @@ bool ModuleBase_WidgetIntValue::processEnter() return isModified; } -bool ModuleBase_WidgetIntValue::isModified() const -{ +bool ModuleBase_WidgetIntValue::isModified() const { QString aText = mySpinBox->text(); if (aText.isEmpty()) return false; @@ -244,4 +233,4 @@ bool ModuleBase_WidgetIntValue::isModified() const return false; } return true; -} \ No newline at end of file +} diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.h b/src/ModuleBase/ModuleBase_WidgetIntValue.h index dcf55dca4..0724e887e 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.h +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetIntValue_H @@ -30,33 +31,36 @@ class QLabel; class QTimer; /** -* \ingroup GUI -* A class of property panel widget for integer value input -* It can be defined with "integervalue" keyword. For example: -* \code -* -* \endcode -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetIntValue : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * A class of property panel widget for integer value input + * It can be defined with "integervalue" keyword. For example: + * \code + * \endcode + */ +class MODULEBASE_EXPORT ModuleBase_WidgetIntValue + : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetIntValue(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetIntValue(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetIntValue(); /// The methiod called when widget is activated virtual void activateCustom(); - /// Select the internal content if it can be selected. It is empty in the default realization + /// Select the internal content if it can be selected. It is empty in the + /// default realization virtual void selectContent(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Returns True if data of its feature was modified during operation virtual bool isModified() const; @@ -79,10 +83,10 @@ protected: protected: /// Label of the widget - QLabel* myLabel; + QLabel *myLabel; /// Input value control - ModuleBase_ParamSpinBox* mySpinBox; + ModuleBase_ParamSpinBox *mySpinBox; FeaturePtr myParameter; diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp index baadf6037..2e0d1c3ec 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabel.cpp @@ -14,31 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetLabel.h" -#include #include +#include #include #include -#include #include +#include -#include #include +#include #include - -ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData) -{ +ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget *theParent, + const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData) { QString aText = translate(theData->getProperty("title")); - myPrefix = theData->getProperty(ATTR_LABEL); + myPrefix = theData->getProperty(ATTR_LABEL); bool aIsHtml = theData->getBooleanAttribute(ATTR_HTML_STYLE, false); @@ -52,11 +51,11 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent, } myLabel->setWordWrap(true); myLabel->setIndent(5); - myLabel->setContentsMargins(0,0,0,4); + myLabel->setContentsMargins(0, 0, 0, 4); if (aIsHtml) myLabel->setTextFormat(Qt::RichText); - QVBoxLayout* aLayout = new QVBoxLayout(this); + QVBoxLayout *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->addWidget(myLabel); setLayout(aLayout); @@ -66,29 +65,25 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent, myLabel->setStyleSheet(QString("QLabel {%1}").arg(aStyleSheet.c_str())); aStyleSheet = theData->getProperty(ATTR_IS_SELECTABLE); - if ( aStyleSheet == "true") + if (aStyleSheet == "true") myLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); } -ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel() -{ -} +ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel() {} -QList ModuleBase_WidgetLabel::getControls() const -{ - return QList(); +QList ModuleBase_WidgetLabel::getControls() const { + return QList(); } -bool ModuleBase_WidgetLabel::restoreValueCustom() -{ +bool ModuleBase_WidgetLabel::restoreValueCustom() { DataPtr aData = myFeature->data(); AttributeStringPtr aStrAttr = aData->string(attributeID()); if (aStrAttr.get()) { QString aText; if (aStrAttr.get()) { if (aStrAttr->isUValue()) { // already translated text - char16_t* aStr = aStrAttr->valueU(); - std::wstring aWStr((wchar_t*)aStr); + char16_t *aStr = aStrAttr->valueU(); + std::wstring aWStr((wchar_t *)aStr); static const int aBufSize = 1000; static char aMBStr[aBufSize]; wcstombs(aMBStr, aWStr.c_str(), aBufSize); @@ -102,14 +97,14 @@ bool ModuleBase_WidgetLabel::restoreValueCustom() if (myPrefix == "") { myLabel->setText(aText); } else { - myLabel->setText(ModuleBase_Tools::translate(myFeature->getKind(), myPrefix) + aText); + myLabel->setText( + ModuleBase_Tools::translate(myFeature->getKind(), myPrefix) + aText); } } return true; } -bool ModuleBase_WidgetLabel::focusTo() -{ +bool ModuleBase_WidgetLabel::focusTo() { restoreValue(); return false; } diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.h b/src/ModuleBase/ModuleBase_WidgetLabel.h index e6fc40fdb..3fdd2672d 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetLabel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetLabel_H @@ -26,17 +27,17 @@ class QLabel; /** -* \ingroup GUI -* Implementation of model widget for a label control -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * Implementation of model widget for a label control + */ +class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetLabel(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetLabel(QWidget *theParent, const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetLabel(); @@ -46,7 +47,7 @@ Q_OBJECT virtual bool restoreValueCustom(); - virtual QList getControls() const; + virtual QList getControls() const; /// This control doesn't accept focus virtual bool focusTo(); @@ -54,13 +55,10 @@ Q_OBJECT protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom() - { - return true; - } + virtual bool storeValueCustom() { return true; } /// A label control - QLabel* myLabel; + QLabel *myLabel; /// A prefix for label std::string myPrefix; }; diff --git a/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp b/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp index 664e83b77..e21e55cc0 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp @@ -14,13 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetLabelValue.h" -#include #include +#include #include #include @@ -28,11 +29,10 @@ #include #include -ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData) -{ - QVBoxLayout* aLayout = new QVBoxLayout(this); +ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData) { + QVBoxLayout *aLayout = new QVBoxLayout(this); aLayout->setContentsMargins(0, 0, 0, 0); aLayout->setSpacing(0); @@ -50,19 +50,15 @@ ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue(QWidget* theParent, aLayout->addWidget(myLabel); } -ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue() -{ -} +ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue() {} -QList ModuleBase_WidgetLabelValue::getControls() const -{ - QList aControls; +QList ModuleBase_WidgetLabelValue::getControls() const { + QList aControls; aControls.append(myLabel); return aControls; } -bool ModuleBase_WidgetLabelValue::restoreValueCustom() -{ +bool ModuleBase_WidgetLabelValue::restoreValueCustom() { DataPtr aData = myFeature->data(); AttributeDoublePtr anAttribute = aData->real(attributeID()); double aValue = 0; @@ -72,7 +68,4 @@ bool ModuleBase_WidgetLabelValue::restoreValueCustom() return true; } -bool ModuleBase_WidgetLabelValue::storeValueCustom() -{ - return true; -} +bool ModuleBase_WidgetLabelValue::storeValueCustom() { return true; } diff --git a/src/ModuleBase/ModuleBase_WidgetLabelValue.h b/src/ModuleBase/ModuleBase_WidgetLabelValue.h index ec23acdea..77e2c30f5 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabelValue.h +++ b/src/ModuleBase/ModuleBase_WidgetLabelValue.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetLabelValue_H @@ -26,23 +27,25 @@ class ModuleBase_LabelValue; /** -* \ingroup GUI -* Implementation of model widget for a label control -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetLabelValue : public ModuleBase_ModelWidget -{ -Q_OBJECT - public: + * \ingroup GUI + * Implementation of model widget for a label control + */ +class MODULEBASE_EXPORT ModuleBase_WidgetLabelValue + : public ModuleBase_ModelWidget { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetLabelValue(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetLabelValue(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetLabelValue(); virtual bool restoreValueCustom(); - virtual QList getControls() const; + virtual QList getControls() const; protected: /// Saves the internal parameters to the given feature @@ -53,7 +56,7 @@ protected: virtual void setHighlighted(bool isHighlighted) {} protected: - ModuleBase_LabelValue* myLabel; ///< A label control + ModuleBase_LabelValue *myLabel; ///< A label control }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp index e1afe6e7c..b59f7ea3f 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include #include @@ -34,51 +35,45 @@ #include #include #include -#include #include #include +#include #include #include /** -* Customization of Line edit control -*/ -class CustomLineEdit : public QLineEdit -{ + * Customization of Line edit control + */ +class CustomLineEdit : public QLineEdit { public: /// Constructor /// \param theParent a parent widget /// \param thePlaceHolder a string which is shown when text is empty - CustomLineEdit( QWidget* theParent, const QString& thePlaceHolder ) - : QLineEdit( theParent ), myPlaceHolder( thePlaceHolder ) - { - } + CustomLineEdit(QWidget *theParent, const QString &thePlaceHolder) + : QLineEdit(theParent), myPlaceHolder(thePlaceHolder) {} - virtual ~CustomLineEdit() - { - } + virtual ~CustomLineEdit() {} /// Redefiniotion of virtual method /// \param theEvent a paint event - virtual void paintEvent( QPaintEvent* theEvent ) - { - QLineEdit::paintEvent( theEvent ); - if( text().isEmpty() && !myPlaceHolder.isEmpty() ) - { - QPainter aPainter( this ); + virtual void paintEvent(QPaintEvent *theEvent) { + QLineEdit::paintEvent(theEvent); + if (text().isEmpty() && !myPlaceHolder.isEmpty()) { + QPainter aPainter(this); QRect aRect = rect(); int aHorMargin = 5; - aRect.adjust( aHorMargin, 0, 0, 0 ); + aRect.adjust(aHorMargin, 0, 0, 0); QColor aColor = palette().text().color(); - aColor.setAlpha( 128 ); + aColor.setAlpha(128); QPen anOldpen = aPainter.pen(); - aPainter.setPen( aColor ); + aPainter.setPen(aColor); QFontMetrics aFontMetrics = fontMetrics(); - QString elidedText = aFontMetrics.elidedText( myPlaceHolder, Qt::ElideRight, aRect.width() ); - aPainter.drawText( aRect, Qt::AlignLeft | Qt::AlignVCenter, elidedText ); - aPainter.setPen( anOldpen ); + QString elidedText = + aFontMetrics.elidedText(myPlaceHolder, Qt::ElideRight, aRect.width()); + aPainter.drawText(aRect, Qt::AlignLeft | Qt::AlignVCenter, elidedText); + aPainter.setPen(anOldpen); } } @@ -86,20 +81,19 @@ private: QString myPlaceHolder; }; -ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& thePlaceHolder ) -: ModuleBase_ModelWidget(theParent, theData) -{ - QFormLayout* aMainLay = new QFormLayout(this); +ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit( + QWidget *theParent, const Config_WidgetAPI *theData, + const std::string &thePlaceHolder) + : ModuleBase_ModelWidget(theParent, theData) { + QFormLayout *aMainLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); QString aLabelText = translate(theData->widgetLabel()); QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); - QLabel* aLabel = new QLabel(aLabelText, this); + QLabel *aLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) aLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); - myLineEdit = new CustomLineEdit( this, translate( thePlaceHolder ) ); + myLineEdit = new CustomLineEdit(this, translate(thePlaceHolder)); // Here we do not use the Qt's standard method setPlaceHolderText() since it // draws the place holder only if there is no focus on widget; // we would like to see the place holder in the case of empty text @@ -111,17 +105,15 @@ ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent, aMainLay->addRow(aLabel, myLineEdit); this->setLayout(aMainLay); - connect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); + connect(myLineEdit, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesModified())); } -ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit() -{ -} +ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit() {} -bool ModuleBase_WidgetLineEdit::storeValueCustom() -{ +bool ModuleBase_WidgetLineEdit::storeValueCustom() { // A rare case when plugin was not loaded. - if(!myFeature) + if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); @@ -131,10 +123,9 @@ bool ModuleBase_WidgetLineEdit::storeValueCustom() return true; } -bool ModuleBase_WidgetLineEdit::restoreValueCustom() -{ +bool ModuleBase_WidgetLineEdit::restoreValueCustom() { // A rare case when plugin was not loaded. - if(!myFeature) + if (!myFeature) return false; DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); @@ -142,7 +133,8 @@ bool ModuleBase_WidgetLineEdit::restoreValueCustom() bool isBlocked = myLineEdit->blockSignals(true); QString aText; if (aStringAttr->isUValue()) - aText = QString::fromStdWString(Locale::Convert::toWString(aStringAttr->valueU())); + aText = QString::fromStdWString( + Locale::Convert::toWString(aStringAttr->valueU())); else aText = QString::fromStdString(aStringAttr->value()); myLineEdit->setText(aText); @@ -151,15 +143,13 @@ bool ModuleBase_WidgetLineEdit::restoreValueCustom() return true; } -QList ModuleBase_WidgetLineEdit::getControls() const -{ - QList result; +QList ModuleBase_WidgetLineEdit::getControls() const { + QList result; result << myLineEdit; return result; } -bool ModuleBase_WidgetLineEdit::processEnter() -{ +bool ModuleBase_WidgetLineEdit::processEnter() { bool isModified = getValueState() == ModifiedInPP; if (isModified) { emit valuesChanged(); @@ -168,7 +158,6 @@ bool ModuleBase_WidgetLineEdit::processEnter() return isModified; } -bool ModuleBase_WidgetLineEdit::isModified() const -{ +bool ModuleBase_WidgetLineEdit::isModified() const { return !myLineEdit->text().isEmpty(); -} \ No newline at end of file +} diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.h b/src/ModuleBase/ModuleBase_WidgetLineEdit.h index 69148e19c..8e1526a89 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.h +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETLINEEDIT_H_ @@ -31,25 +32,24 @@ class QWidget; class QLineEdit; /** -* \ingroup GUI -* Implementation of model widget for line edit widget. -* It can be defined with "stringvalue" keyword. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetLineEdit : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * Implementation of model widget for line edit widget. + * It can be defined with "stringvalue" keyword. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetLineEdit + : public ModuleBase_ModelWidget { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object /// \param theData the widget configuration. /// \param thePlaceHolder a string of placeholder - ModuleBase_WidgetLineEdit( QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& thePlaceHolder ); + ModuleBase_WidgetLineEdit(QWidget *theParent, const Config_WidgetAPI *theData, + const std::string &thePlaceHolder); virtual ~ModuleBase_WidgetLineEdit(); /// Redefinition of virtual method - virtual QList getControls() const; + virtual QList getControls() const; /// Returns True if data of its feature was modified during operation virtual bool isModified() const; @@ -65,8 +65,8 @@ protected: /// Redefinition of virtual method virtual bool restoreValueCustom(); - /// A line edit control - QLineEdit* myLineEdit; + /// A line edit control + QLineEdit *myLineEdit; }; #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 64dc0d730..fc4d3a9b7 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,48 +23,48 @@ #include #include +#include #include #include -#include #include +#include #include #include -#include #include #include +#include #include #include #include #include -#include -#include #include +#include +#include +#include +#include #include +#include #include -#include -#include -#include #include -#include #include #include +#include +#include +#include +#include +#include #include #include #include +#include #include +#include #include -#include -#include -#include -#include #include -#include -#include -#include #include #include @@ -71,24 +72,21 @@ //#define DEBUG_UNDO_REDO #ifdef DEBUG_UNDO_REDO -void printHistoryInfo(const QString& theMethodName, int theCurrentHistoryIndex, - QList > > theSelectedHistoryValues) -{ +void printHistoryInfo(const QString &theMethodName, int theCurrentHistoryIndex, + QList>> + theSelectedHistoryValues) { QStringList aSizes; for (int i = 0; i < theSelectedHistoryValues.size(); i++) aSizes.append(QString::number(theSelectedHistoryValues[i].size())); std::cout << theMethodName.toStdString() << " current = " << theCurrentHistoryIndex - << " size(history) = " << theSelectedHistoryValues.size() - << " (" << aSizes.join(", ").toStdString() << ")" - << std::endl; + << " size(history) = " << theSelectedHistoryValues.size() << " (" + << aSizes.join(", ").toStdString() << ")" << std::endl; } #endif - -QStringList getIconsList(const QStringList& theNames) -{ +QStringList getIconsList(const QStringList &theNames) { QStringList aIcons; foreach (QString aName, theNames) { QString aUName = aName.toUpper(); @@ -108,14 +106,12 @@ QStringList getIconsList(const QStringList& theNames) /// It is used only in case if myTypeCtrl is used static QMap defaultValues; - -ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetSelector(theParent, theWorkshop, theData), - myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1), - myIsFirst(true), myFiltersWgt(0), myShowOnlyBtn(0) -{ +ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetSelector(theParent, theWorkshop, theData), + myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1), + myIsFirst(true), myFiltersWgt(0), myShowOnlyBtn(0) { std::string aPropertyTypes = theData->getProperty("shape_types"); QString aTypesStr = aPropertyTypes.c_str(); myShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts); @@ -128,7 +124,6 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen myMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(myMainLayout); - QStringList aIconsList; std::string aIcons = theData->getProperty("type_icons"); if (aIcons.size() > 0) @@ -156,28 +151,30 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen } myMainLayout->addWidget(myTypeCtrl); - // There is no sense to parameterize list of types while we can not parameterize selection mode - // if the xml definition contains one type, the controls to select a type should not be shown + // There is no sense to parameterize list of types while we can not + // parameterize selection mode if the xml definition contains one type, the + // controls to select a type should not be shown if (myShapeTypes.size() <= 1 || !myIsUseChoice) { myTypeCtrl->setVisible(false); } QString aLabelText = translate(theData->getProperty("label")); if (aLabelText.size() > 0) { - QWidget* aLabelWgt = new QWidget(this); - QHBoxLayout* aLabelLayout = new QHBoxLayout(aLabelWgt); + QWidget *aLabelWgt = new QWidget(this); + QHBoxLayout *aLabelLayout = new QHBoxLayout(aLabelWgt); aLabelLayout->setContentsMargins(0, 0, 0, 0); myMainLayout->addWidget(aLabelWgt); - QLabel* aListLabel = new QLabel(aLabelText, this); + QLabel *aListLabel = new QLabel(aLabelText, this); aLabelLayout->addWidget(aListLabel); // if the xml definition contains one type, an information label // should be shown near to the latest if (myShapeTypes.size() <= 1) { QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); if (!aLabelIcon.isEmpty()) { - QLabel* aSelectedLabel = new QLabel("", this); - aSelectedLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); + QLabel *aSelectedLabel = new QLabel("", this); + aSelectedLabel->setPixmap( + ModuleBase_IconFactory::loadPixmap(aLabelIcon)); aLabelLayout->addWidget(aSelectedLabel); aLabelLayout->addStretch(1); } @@ -187,19 +184,22 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen QString aToolTip = translate(theData->widgetTooltip()); QString anObjName = QString::fromStdString(attributeID()); myListView = new ModuleBase_ListView(this, anObjName, aToolTip); - connect(myListView->getControl(), SIGNAL(itemSelectionChanged()), SLOT(onListSelection())); + connect(myListView->getControl(), SIGNAL(itemSelectionChanged()), + SLOT(onListSelection())); connect(myListView, SIGNAL(deleteActionClicked()), SLOT(onDeleteItem())); connect(myListView, SIGNAL(listActivated()), SLOT(onListActivated())); myMainLayout->addWidget(myListView->getControl()); - connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged())); + connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, + SLOT(onSelectionTypeChanged())); myUseFilters = theData->getProperty("use_filters"); if (myUseFilters.length() > 0) { - QWidget* aFltrWgt = new QWidget(this); - QHBoxLayout* aFltrLayout = new QHBoxLayout(aFltrWgt); + QWidget *aFltrWgt = new QWidget(this); + QHBoxLayout *aFltrLayout = new QHBoxLayout(aFltrWgt); - myFiltersWgt = new ModuleBase_FilterStarter(myUseFilters, aFltrWgt, theWorkshop); + myFiltersWgt = + new ModuleBase_FilterStarter(myUseFilters, aFltrWgt, theWorkshop); aFltrLayout->addWidget(myFiltersWgt); aFltrLayout->addStretch(); @@ -215,14 +215,15 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen bool aSameTop = theData->getBooleanAttribute("same_topology", false); if (aSameTop) { - myGeomCheck = new QCheckBox(tr("Add elements that share the same topology"), this); + myGeomCheck = + new QCheckBox(tr("Add elements that share the same topology"), this); myMainLayout->addWidget(myGeomCheck); connect(myGeomCheck, SIGNAL(toggled(bool)), SLOT(onSameTopology(bool))); - } - else + } else myGeomCheck = 0; - myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true); + myIsNeutralPointClear = + theData->getBooleanAttribute("clear_in_neutral_point", true); if (myShapeTypes.size() > 1 || myIsUseChoice) { if (defaultValues.contains(myFeatureId + attributeID())) { myDefMode = defaultValues[myFeatureId + attributeID()]; @@ -231,27 +232,25 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen } } -ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector() -{ -} +ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector() {} //******************************************************************** -void ModuleBase_WidgetMultiSelector::activateCustom() -{ +void ModuleBase_WidgetMultiSelector::activateCustom() { ModuleBase_WidgetSelector::activateCustom(); - ModuleBase_IModule* aModule = myWorkshop->module(); - aModule->activateCustomPrs(myFeature, - ModuleBase_IModule::CustomizeHighlightedObjects, true); + ModuleBase_IModule *aModule = myWorkshop->module(); + aModule->activateCustomPrs( + myFeature, ModuleBase_IModule::CustomizeHighlightedObjects, true); clearSelectedHistory(); if (myAllowedObjects.length() > 0) { - Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_GlobalFilter); + Handle(SelectMgr_Filter) aFilter = + aModule->selectionFilter(SF_GlobalFilter); if (!aFilter.IsNull()) { Handle(ModuleBase_ShapeDocumentFilter) aDocFilter = - Handle(ModuleBase_ShapeDocumentFilter)::DownCast(aFilter); + Handle(ModuleBase_ShapeDocumentFilter)::DownCast(aFilter); if (!aDocFilter.IsNull()) { QStringList aSelFilters = aDocFilter->nonSelectableTypes(); - foreach(QString aType, aSelFilters) { + foreach (QString aType, aSelFilters) { if (aSelFilters.contains(aType)) { aDocFilter->removeNonSelectableType(aType); myTmpAllowed.append(aType); @@ -263,24 +262,25 @@ void ModuleBase_WidgetMultiSelector::activateCustom() } //******************************************************************** -void ModuleBase_WidgetMultiSelector::deactivate() -{ +void ModuleBase_WidgetMultiSelector::deactivate() { myWorkshop->module()->enableCustomModes(); ModuleBase_WidgetSelector::deactivate(); if (myVisibleObjects.size()) myShowOnlyBtn->setChecked(false); - myWorkshop->module()->deactivateCustomPrs(ModuleBase_IModule::CustomizeHighlightedObjects, true); + myWorkshop->module()->deactivateCustomPrs( + ModuleBase_IModule::CustomizeHighlightedObjects, true); clearSelectedHistory(); if (myTmpAllowed.length() > 0) { - ModuleBase_IModule* aModule = myWorkshop->module(); - Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_GlobalFilter); + ModuleBase_IModule *aModule = myWorkshop->module(); + Handle(SelectMgr_Filter) aFilter = + aModule->selectionFilter(SF_GlobalFilter); if (!aFilter.IsNull()) { Handle(ModuleBase_ShapeDocumentFilter) aDocFilter = - Handle(ModuleBase_ShapeDocumentFilter)::DownCast(aFilter); + Handle(ModuleBase_ShapeDocumentFilter)::DownCast(aFilter); if (!aDocFilter.IsNull()) { - foreach(QString aType, myTmpAllowed) { + foreach (QString aType, myTmpAllowed) { aDocFilter->addNonSelectableType(aType); } } @@ -290,22 +290,19 @@ void ModuleBase_WidgetMultiSelector::deactivate() } //******************************************************************** -void ModuleBase_WidgetMultiSelector::updateAfterDeactivation() -{ +void ModuleBase_WidgetMultiSelector::updateAfterDeactivation() { // restore previous Undo/Redo workshop state myWorkshop->updateCommandStatus(); } //******************************************************************** -void ModuleBase_WidgetMultiSelector::updateAfterActivation() -{ +void ModuleBase_WidgetMultiSelector::updateAfterActivation() { // fill Undo/Redo actions with current information myWorkshop->updateCommandStatus(); } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::storeValueCustom() -{ +bool ModuleBase_WidgetMultiSelector::storeValueCustom() { // the value is stored on the selection changed signal processing // A rare case when plugin was not loaded. if (!myFeature) @@ -314,7 +311,8 @@ bool ModuleBase_WidgetMultiSelector::storeValueCustom() AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + myFeature->data()->selectionList(attributeID()); if (myTypeCtrl->isVisible()) { std::string aMode = myTypeCtrl->textValue().toStdString(); if (myIsFirst && (!myDefMode.empty())) @@ -322,7 +320,8 @@ bool ModuleBase_WidgetMultiSelector::storeValueCustom() aSelectionListAttr->setSelectionType(aMode); myIsFirst = false; - } else { // no type, set the type as a first element of the list shape type when it is appeared + } else { // no type, set the type as a first element of the list shape type + // when it is appeared if (aSelectionListAttr->size()) { AttributeSelectionPtr aSel = aSelectionListAttr->value(0); GeomShapePtr aFirstVal = aSel->value(); @@ -337,14 +336,14 @@ bool ModuleBase_WidgetMultiSelector::storeValueCustom() } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::restoreValueCustom() -{ +bool ModuleBase_WidgetMultiSelector::restoreValueCustom() { // A rare case when plugin was not loaded. if (!myFeature) return false; AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); - AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + myFeature->data()->selectionList(attributeID()); std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { // Restore shape type @@ -364,15 +363,15 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom() } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::setSelection(QList& theValues, - const bool theToValidate) -{ +bool ModuleBase_WidgetMultiSelector::setSelection( + QList &theValues, const bool theToValidate) { if (myIsSetSelectionBlocked) return false; AttributeSelectionListPtr aSelectionListAttr; if (attribute()->attributeType() == ModelAPI_AttributeSelectionList::typeId()) - aSelectionListAttr = std::dynamic_pointer_cast(attribute()); + aSelectionListAttr = + std::dynamic_pointer_cast(attribute()); if (aSelectionListAttr.get()) aSelectionListAttr->cashValues(true); @@ -382,14 +381,17 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList QList anInvalidValues; QList anAttributeValues; - QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); + QList::const_iterator anIt = theValues.begin(), + aLast = theValues.end(); for (; anIt != aLast; anIt++) { ModuleBase_ViewerPrsPtr aValue = *anIt; - // do not validate and append to attribute selection presentation if it exists in the attribute + // do not validate and append to attribute selection presentation if it + // exists in the attribute ObjectPtr anObject; GeomShapePtr aShape; getGeomSelection(aValue, anObject, aShape); - if (ModuleBase_Tools::hasObject(attribute(), anObject, aShape, myWorkshop, myIsInValidate)) { + if (ModuleBase_Tools::hasObject(attribute(), anObject, aShape, myWorkshop, + myIsInValidate)) { anAttributeValues.append(aValue); continue; } @@ -404,7 +406,8 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList if ((aHasInvalidValues && anInvalidValues.contains(aValue)) || anAttributeValues.contains(aValue)) continue; - aProcessed = setSelectionCustom(aValue); /// it is not optimal as hasObject() is already checked + aProcessed = setSelectionCustom( + aValue); /// it is not optimal as hasObject() is already checked // if there is at least one set, the result is true isDone = isDone || aProcessed; } @@ -416,10 +419,11 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList } // updateObject - to update/redisplay feature // it is commented in order to perfom it outside the method - //if (isDone) { - //updateObject(myFeature); - // this emit is necessary to call store/restore method an restore type of selection - //emit valuesChanged(); + // if (isDone) { + // updateObject(myFeature); + // this emit is necessary to call store/restore method an restore type of + // selection + // emit valuesChanged(); //} if (aSelectionListAttr.get()) @@ -429,16 +433,18 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList if (!anInvalidValues.empty()) theValues.append(anInvalidValues); - if (isDone) // may be the feature's result is not displayed, but attributes should be - myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments, - true);/// hope that something is redisplayed by object updated + if (isDone) // may be the feature's result is not displayed, but attributes + // should be + myWorkshop->module()->customizeFeature( + myFeature, ModuleBase_IModule::CustomizeArguments, + true); /// hope that something is redisplayed by object updated return isDone; } //******************************************************************** -void ModuleBase_WidgetMultiSelector::getHighlighted(QList& theValues) -{ +void ModuleBase_WidgetMultiSelector::getHighlighted( + QList &theValues) { std::set anAttributeIds; getSelectedAttributeIndices(anAttributeIds); if (!anAttributeIds.empty()) @@ -446,68 +452,72 @@ void ModuleBase_WidgetMultiSelector::getHighlighted(QList 0 - : (mySelectedHistoryValues.size() > 0 && - myCurrentHistoryIndex < mySelectedHistoryValues.size() - 1); - } - break; - default: - aCanProcess = ModuleBase_WidgetSelector::canProcessAction(theActionType, isActionEnabled); + case ActionUndo: + case ActionRedo: { + aCanProcess = true; + isActionEnabled = + theActionType == ActionUndo + ? myCurrentHistoryIndex > 0 + : (mySelectedHistoryValues.size() > 0 && + myCurrentHistoryIndex < mySelectedHistoryValues.size() - 1); + } break; + default: + aCanProcess = ModuleBase_WidgetSelector::canProcessAction(theActionType, + isActionEnabled); break; } return aCanProcess; } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::processAction(ModuleBase_ActionType theActionType, - const ActionParamPtr& theParam) -{ +bool ModuleBase_WidgetMultiSelector::processAction( + ModuleBase_ActionType theActionType, const ActionParamPtr &theParam) { switch (theActionType) { - case ActionUndo: - case ActionRedo: { - ActionIntParamPtr aParam = + case ActionUndo: + case ActionRedo: { + ActionIntParamPtr aParam = std::dynamic_pointer_cast(theParam); - int aNb = aParam->value(); - if (theActionType == ActionUndo) - myCurrentHistoryIndex -= aNb; - else - myCurrentHistoryIndex += aNb; - QList aSelected = mySelectedHistoryValues[myCurrentHistoryIndex]; - // equal vertices should not be used here - ModuleBase_ISelection::filterSelectionOnEqualPoints(aSelected); - bool isDone = setSelection(aSelected, - false /*need not validate because values already was in list*/); - updateOnSelectionChanged(isDone); - - myWorkshop->updateCommandStatus(); + int aNb = aParam->value(); + if (theActionType == ActionUndo) + myCurrentHistoryIndex -= aNb; + else + myCurrentHistoryIndex += aNb; + QList aSelected = + mySelectedHistoryValues[myCurrentHistoryIndex]; + // equal vertices should not be used here + ModuleBase_ISelection::filterSelectionOnEqualPoints(aSelected); + bool isDone = setSelection( + aSelected, + false /*need not validate because values already was in list*/); + updateOnSelectionChanged(isDone); + + myWorkshop->updateCommandStatus(); #ifdef DEBUG_UNDO_REDO - printHistoryInfo(QString("processAction %1").arg(theActionType == ActionUndo ? "Undo" - : "Redo"), myCurrentHistoryIndex, mySelectedHistoryValues); + printHistoryInfo(QString("processAction %1") + .arg(theActionType == ActionUndo ? "Undo" : "Redo"), + myCurrentHistoryIndex, mySelectedHistoryValues); #endif - return true; - } - default: - return ModuleBase_ModelWidget::processAction(theActionType, theParam); + return true; + } + default: + return ModuleBase_ModelWidget::processAction(theActionType, theParam); } } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { bool aValid = ModuleBase_WidgetSelector::isValidSelectionCustom(thePrs); if (aValid) { ResultPtr aResult = myWorkshop->selection()->getResult(thePrs); if (!aResult.get()) { // In case if a feature was selected - FeaturePtr aFeature = std::dynamic_pointer_cast(thePrs->object()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(thePrs->object()); if (aFeature.get()) aResult = aFeature->firstResult(); } @@ -534,15 +544,15 @@ bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_Vie } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::processDelete() -{ +bool ModuleBase_WidgetMultiSelector::processDelete() { appendFirstSelectionInHistory(); // find attribute indices to delete std::set anAttributeIds; getSelectedAttributeIndices(anAttributeIds); - QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes(); + QModelIndexList anIndices = + myListView->getControl()->selectionModel()->selectedIndexes(); // refill attribute by the items which indices are not in the list of ids bool aDone = false; @@ -551,44 +561,45 @@ bool ModuleBase_WidgetMultiSelector::processDelete() std::string aType = anAttribute->attributeType(); aDone = !anAttributeIds.empty(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + aData->selectionList(attributeID()); aSelectionListAttr->remove(anAttributeIds); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); aRefListAttr->remove(anAttributeIds); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + AttributeRefAttrListPtr aRefAttrListAttr = + aData->refattrlist(attributeID()); aRefAttrListAttr->remove(anAttributeIds); } if (aDone) { - // update object is necessary to flush update signal. It leads to objects references map update - // and the operation presentation will not contain deleted items visualized as parameters of - // the feature. + // update object is necessary to flush update signal. It leads to objects + // references map update and the operation presentation will not contain + // deleted items visualized as parameters of the feature. updateObject(myFeature); restoreValue(); myWorkshop->setSelected(getAttributeSelection()); // may be the feature's result is not displayed, but attributes should be - myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments, - true); /// hope that something is redisplayed by object updated + myWorkshop->module()->customizeFeature( + myFeature, ModuleBase_IModule::CustomizeArguments, + true); /// hope that something is redisplayed by object updated } // Restore selection myListView->restoreSelection(anIndices); appendSelectionInHistory(); - return true/*aDone*/; // following #2438 Delete should be processed even if nothing is delete + return true /*aDone*/; // following #2438 Delete should be processed even if + // nothing is delete } //******************************************************************** -QList ModuleBase_WidgetMultiSelector::getControls() const -{ - QList result; +QList ModuleBase_WidgetMultiSelector::getControls() const { + QList result; if (myTypeCtrl->isVisible()) result << myTypeCtrl; result << myListView->getControl(); @@ -596,10 +607,10 @@ QList ModuleBase_WidgetMultiSelector::getControls() const } //******************************************************************** -void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() -{ - // Clear current selection in order to avoid updating of object browser with obsolete indexes - // which can appear because of results deletetion after changing a type of selection +void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() { + // Clear current selection in order to avoid updating of object browser with + // obsolete indexes which can appear because of results deletetion after + // changing a type of selection QString aSelectionType = myTypeCtrl->textValue(); QList aEmptyList; myWorkshop->setSelected(aEmptyList); @@ -613,36 +624,40 @@ void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + myFeature->data()->selectionList(attributeID()); aSelectionListAttr->setSelectionType(aSelectionType.toStdString()); } // clear attribute values DataPtr aData = myFeature->data(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + aData->selectionList(attributeID()); aSelectionListAttr->clear(); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); aRefListAttr->clear(); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + AttributeRefAttrListPtr aRefAttrListAttr = + aData->refattrlist(attributeID()); aRefAttrListAttr->clear(); } - // update object is necessary to flush update signal. It leads to objects references map update - // and the operation presentation will not contain deleted items visualized as parameters of - // the feature. + // update object is necessary to flush update signal. It leads to objects + // references map update and the operation presentation will not contain + // deleted items visualized as parameters of the feature. updateObject(myFeature); restoreValue(); myWorkshop->setSelected(getAttributeSelection()); // may be the feature's result is not displayed, but attributes should be // hope that something is redisplayed by object updated - myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments, false); - myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeResults, true); - // clear history should follow after set selected to do not increase history by setSelected + myWorkshop->module()->customizeFeature( + myFeature, ModuleBase_IModule::CustomizeArguments, false); + myWorkshop->module()->customizeFeature( + myFeature, ModuleBase_IModule::CustomizeResults, true); + // clear history should follow after set selected to do not increase history + // by setSelected clearSelectedHistory(); if (myWorkshop->propertyPanel()->activeWidget() != this) @@ -650,8 +665,7 @@ void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() } //******************************************************************** -bool ModuleBase_WidgetMultiSelector::processSelection() -{ +bool ModuleBase_WidgetMultiSelector::processSelection() { if (!myIsNeutralPointClear) { QList aSelected = getFilteredSelected(); // do not clear selected object @@ -659,7 +673,8 @@ bool ModuleBase_WidgetMultiSelector::processSelection() if (!getAttributeSelection().empty()) { // Restore selection in the viewer by the attribute selection list // it should be postponed to exit from the selectionChanged processing - static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); + static Events_ID anEvent = + Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); Events_Loop::loop()->flush(anEvent); return true; @@ -672,20 +687,19 @@ bool ModuleBase_WidgetMultiSelector::processSelection() return aDone; } -void ModuleBase_WidgetMultiSelector::appendFirstSelectionInHistory() -{ +void ModuleBase_WidgetMultiSelector::appendFirstSelectionInHistory() { if (mySelectedHistoryValues.empty()) { myCurrentHistoryIndex++; mySelectedHistoryValues.append(getAttributeSelection()); #ifdef DEBUG_UNDO_REDO - printHistoryInfo("appendSelectionInHistory", myCurrentHistoryIndex, mySelectedHistoryValues); + printHistoryInfo("appendSelectionInHistory", myCurrentHistoryIndex, + mySelectedHistoryValues); #endif } } -void ModuleBase_WidgetMultiSelector::appendSelectionInHistory() -{ +void ModuleBase_WidgetMultiSelector::appendSelectionInHistory() { while (myCurrentHistoryIndex != mySelectedHistoryValues.count() - 1) mySelectedHistoryValues.removeLast(); @@ -695,72 +709,73 @@ void ModuleBase_WidgetMultiSelector::appendSelectionInHistory() myWorkshop->updateCommandStatus(); #ifdef DEBUG_UNDO_REDO - printHistoryInfo("appendSelectionInHistory", myCurrentHistoryIndex, mySelectedHistoryValues); + printHistoryInfo("appendSelectionInHistory", myCurrentHistoryIndex, + mySelectedHistoryValues); #endif } -void ModuleBase_WidgetMultiSelector::clearSelectedHistory() -{ +void ModuleBase_WidgetMultiSelector::clearSelectedHistory() { mySelectedHistoryValues.clear(); myCurrentHistoryIndex = -1; myWorkshop->updateCommandStatus(); #ifdef DEBUG_UNDO_REDO - printHistoryInfo("clearSelectedHistory", myCurrentHistoryIndex, mySelectedHistoryValues); + printHistoryInfo("clearSelectedHistory", myCurrentHistoryIndex, + mySelectedHistoryValues); #endif } -void ModuleBase_WidgetMultiSelector::updateFocus() -{ +void ModuleBase_WidgetMultiSelector::updateFocus() { // Set focus to List control in order to make possible // to use Tab key for transfer the focus to next widgets - ModuleBase_Tools::setFocus(myListView->getControl(), - "ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()"); + ModuleBase_Tools::setFocus( + myListView->getControl(), + "ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()"); } //******************************************************************** -void ModuleBase_WidgetMultiSelector::updateSelectionName() -{ -} +void ModuleBase_WidgetMultiSelector::updateSelectionName() {} //******************************************************************** -void ModuleBase_WidgetMultiSelector::updateOnSelectionChanged(const bool theDone) -{ +void ModuleBase_WidgetMultiSelector::updateOnSelectionChanged( + const bool theDone) { if (myIsSetSelectionBlocked) return; ModuleBase_WidgetSelector::updateOnSelectionChanged(theDone); - // according to #2154 we need to update OB selection when selection in the viewer happens - // it is important to flush sinchronize selection signal after flush of Update/Create/Delete. - // because we need that Object Browser has been already updated when synchronize happens. + // according to #2154 we need to update OB selection when selection in the + // viewer happens it is important to flush sinchronize selection signal after + // flush of Update/Create/Delete. because we need that Object Browser has been + // already updated when synchronize happens. // Restore selection in the viewer by the attribute selection list - // it is possible that diring selection attribute filling, selection in Object Browser - // is changed(some items were removed/added) and as result, selection in the viewer - // differs from the selection come to this method. By next rows, we restore selection - // in the viewer according to content of selection attribute. Case is Edge selection in Group + // it is possible that diring selection attribute filling, selection in Object + // Browser is changed(some items were removed/added) and as result, selection + // in the viewer differs from the selection come to this method. By next rows, + // we restore selection in the viewer according to content of selection + // attribute. Case is Edge selection in Group myIsSetSelectionBlocked = true; - static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); + static Events_ID anEvent = + Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); Events_Loop::loop()->flush(anEvent); myIsSetSelectionBlocked = false; } //******************************************************************** -QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const -{ +QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const { QIntList aShapeTypes; if (myShapeTypes.length() > 1 && myIsUseChoice) { - QStringList aTypes = myTypeCtrl->textValue().split("|", QString::SkipEmptyParts); - for(QString aType: aTypes) { + QStringList aTypes = + myTypeCtrl->textValue().split("|", QString::SkipEmptyParts); + for (QString aType : aTypes) { aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); } - } - else { + } else { foreach (QString aType, myShapeTypes) { QStringList aSubTypes = aType.split("|", QString::SkipEmptyParts); - for(QString aSubType: aSubTypes) { + for (QString aSubType : aSubTypes) { aShapeTypes.append(ModuleBase_Tools::shapeType(aSubType)); } } @@ -769,13 +784,15 @@ QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const } //******************************************************************** -void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const QString& theShapeType) -{ +void ModuleBase_WidgetMultiSelector::setCurrentShapeType( + const QString &theShapeType) { int idx = 0; - GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::shapeTypeByStr(theShapeType.toStdString()); + GeomAPI_Shape::ShapeType aShapeType = + GeomAPI_Shape::shapeTypeByStr(theShapeType.toStdString()); foreach (QString aShapeTypeName, myShapeTypes) { - if(GeomAPI_Shape::shapeTypeByStr(aShapeTypeName.toStdString()) == aShapeType && - idx != myTypeCtrl->value()) { + if (GeomAPI_Shape::shapeTypeByStr(aShapeTypeName.toStdString()) == + aShapeType && + idx != myTypeCtrl->value()) { updateSelectionModesAndFilters(false); bool isBlocked = myTypeCtrl->blockSignals(true); myTypeCtrl->setValue(idx); @@ -787,47 +804,47 @@ void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const QString& theShape } } -QList ModuleBase_WidgetMultiSelector::getAttributeSelection() const -{ +QList +ModuleBase_WidgetMultiSelector::getAttributeSelection() const { QList aSelected; convertIndicesToViewerSelection(std::set(), aSelected); return aSelected; } //******************************************************************** -void ModuleBase_WidgetMultiSelector::updateSelectionList() -{ +void ModuleBase_WidgetMultiSelector::updateSelectionList() { myListView->getControl()->clear(); DataPtr aData = myFeature->data(); AttributePtr anAttribute = aData->attribute(attributeID()); std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + aData->selectionList(attributeID()); for (int i = 0; i < aSelectionListAttr->size(); i++) { AttributeSelectionPtr aAttr = aSelectionListAttr->value(i); myListView->addItem(QString::fromStdWString(aAttr->namingName()), i); } - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); for (int i = 0; i < aRefListAttr->size(); i++) { ObjectPtr anObject = aRefListAttr->object(i); if (anObject.get()) { - myListView->addItem(QString::fromStdWString(anObject->data()->name()), i); + myListView->addItem(QString::fromStdWString(anObject->data()->name()), + i); } } - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + AttributeRefAttrListPtr aRefAttrListAttr = + aData->refattrlist(attributeID()); for (int i = 0; i < aRefAttrListAttr->size(); i++) { AttributePtr anAttr = aRefAttrListAttr->attribute(i); QString aName; if (anAttr.get()) { - std::wstring anAttrName = ModuleBase_Tools::generateName(anAttr, myWorkshop); + std::wstring anAttrName = + ModuleBase_Tools::generateName(anAttr, myWorkshop); aName = QString::fromStdWString(anAttrName); - } - else { + } else { ObjectPtr anObject = aRefAttrListAttr->object(i); if (anObject.get()) { aName = QString::fromStdWString(anObject->data()->name()); @@ -842,8 +859,8 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList() } //******************************************************************** -std::string ModuleBase_WidgetMultiSelector::validatorType(const QString& theType) const -{ +std::string +ModuleBase_WidgetMultiSelector::validatorType(const QString &theType) const { std::string aType; if (theType == "Vertices") @@ -859,79 +876,80 @@ std::string ModuleBase_WidgetMultiSelector::validatorType(const QString& theType } //******************************************************************** -void ModuleBase_WidgetMultiSelector::clearSelection() -{ +void ModuleBase_WidgetMultiSelector::clearSelection() { bool isClearInNeutralPoint = myIsNeutralPointClear; myIsNeutralPointClear = true; QList anEmptyList; - // This method will call Selection changed event which will call onSelectionChanged - // To clear mySelection, myListView and storeValue() - // So, we don't need to call it + // This method will call Selection changed event which will call + // onSelectionChanged To clear mySelection, myListView and storeValue() So, we + // don't need to call it myWorkshop->setSelected(anEmptyList); myIsNeutralPointClear = isClearInNeutralPoint; } //******************************************************************** -void ModuleBase_WidgetMultiSelector::onDeleteItem() -{ - processDelete(); -} +void ModuleBase_WidgetMultiSelector::onDeleteItem() { processDelete(); } //******************************************************************** -void ModuleBase_WidgetMultiSelector::onListSelection() -{ - myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeHighlightedObjects, - true); +void ModuleBase_WidgetMultiSelector::onListSelection() { + myWorkshop->module()->customizeFeature( + myFeature, ModuleBase_IModule::CustomizeHighlightedObjects, true); } //******************************************************************** -void ModuleBase_WidgetMultiSelector::getSelectedAttributeIndices(std::set& theAttributeIds) -{ +void ModuleBase_WidgetMultiSelector::getSelectedAttributeIndices( + std::set &theAttributeIds) { myListView->getSelectedIndices(theAttributeIds); } -void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set theAttributeIds, - QList& theValues) const -{ - if(myFeature.get() == NULL) +void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection( + std::set theAttributeIds, + QList &theValues) const { + if (myFeature.get() == NULL) return; DataPtr aData = myFeature->data(); AttributePtr anAttribute = aData->attribute(attributeID()); std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + aData->selectionList(attributeID()); for (int i = 0; i < aSelectionListAttr->size(); i++) { - // filter by attribute indices only if the container is not empty otherwise return all items - if (!theAttributeIds.empty() && theAttributeIds.find(i) == theAttributeIds.end()) + // filter by attribute indices only if the container is not empty + // otherwise return all items + if (!theAttributeIds.empty() && + theAttributeIds.find(i) == theAttributeIds.end()) continue; AttributeSelectionPtr anAttr = aSelectionListAttr->value(i); ObjectPtr anObject = anAttr->contextObject(); if (anObject.get()) theValues.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL))); + new ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL))); } - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); for (int i = 0; i < aRefListAttr->size(); i++) { - // filter by attribute indices only if the container is not empty otherwise return all items - if (!theAttributeIds.empty() && theAttributeIds.find(i) == theAttributeIds.end()) + // filter by attribute indices only if the container is not empty + // otherwise return all items + if (!theAttributeIds.empty() && + theAttributeIds.find(i) == theAttributeIds.end()) continue; ObjectPtr anObject = aRefListAttr->object(i); if (anObject.get()) { theValues.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); } } - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + AttributeRefAttrListPtr aRefAttrListAttr = + aData->refattrlist(attributeID()); for (int i = 0; i < aRefAttrListAttr->size(); i++) { - // filter by attribute indices only if the container is not empty otherwise return all items - if (!theAttributeIds.empty() && theAttributeIds.find(i) == theAttributeIds.end()) + // filter by attribute indices only if the container is not empty + // otherwise return all items + if (!theAttributeIds.empty() && + theAttributeIds.find(i) == theAttributeIds.end()) continue; ObjectPtr anObject = aRefAttrListAttr->object(i); if (!anObject.get()) @@ -939,20 +957,21 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::setattribute(i); if (anAttr.get()) { - GeomShapePtr aGeomShape = ModuleBase_Tools::getShape(anAttr, myWorkshop); + GeomShapePtr aGeomShape = + ModuleBase_Tools::getShape(anAttr, myWorkshop); theValues.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, aGeomShape, NULL))); + new ModuleBase_ViewerPrs(anObject, aGeomShape, NULL))); } } } } -bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects - (QList& theValues) -{ +bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects( + QList &theValues) { bool isDone = false; - std::map > aGeomSelection = convertSelection(theValues); + std::map> aGeomSelection = + convertSelection(theValues); DataPtr aData = myFeature->data(); AttributePtr anAttribute = aData->attribute(attributeID()); std::string aType = anAttribute->attributeType(); @@ -961,7 +980,8 @@ bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects FeaturePtr aFeature; if (aType == ModelAPI_AttributeSelectionList::typeId()) { // iteration through data model to find not selected elements to remove them - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + aData->selectionList(attributeID()); for (int i = 0; i < aSelectionListAttr->size(); i++) { AttributeSelectionPtr anAttr = aSelectionListAttr->value(i); ObjectPtr aContextObject = anAttr->contextObject(); @@ -970,15 +990,15 @@ bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects if (!aFeature.get()) aShape = anAttr->value(); - bool aFound = findInSelection(aContextObject, aShape, aGeomSelection, myWorkshop); + bool aFound = + findInSelection(aContextObject, aShape, aGeomSelection, myWorkshop); if (!aFound) anIndicesToBeRemoved.insert(i); } isDone = anIndicesToBeRemoved.size() > 0; if (isDone) aSelectionListAttr->remove(anIndicesToBeRemoved); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); for (int i = 0; i < aRefListAttr->size(); i++) { ObjectPtr anObject = aRefListAttr->object(i); @@ -991,31 +1011,31 @@ bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects } isDone = anIndicesToBeRemoved.size() > 0; aRefListAttr->remove(anIndicesToBeRemoved); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { std::set anAttributes; - QList::const_iterator - anIt = theValues.begin(), aLast = theValues.end(); + QList::const_iterator anIt = theValues.begin(), + aLast = theValues.end(); ObjectPtr anObject; GeomShapePtr aShape; for (; anIt != aLast; anIt++) { ModuleBase_ViewerPrsPtr aPrs = *anIt; getGeomSelection(aPrs, anObject, aShape); - AttributePtr anAttr = myWorkshop->module()->findAttribute(anObject, aShape); + AttributePtr anAttr = + myWorkshop->module()->findAttribute(anObject, aShape); if (anAttr.get() && anAttributes.find(anAttr) == anAttributes.end()) anAttributes.insert(anAttr); } - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); + AttributeRefAttrListPtr aRefAttrListAttr = + aData->refattrlist(attributeID()); for (int i = 0; i < aRefAttrListAttr->size(); i++) { bool aFound = false; if (aRefAttrListAttr->isAttribute(i)) { AttributePtr anAttr = aRefAttrListAttr->attribute(i); aFound = anAttributes.find(anAttr) != anAttributes.end(); - } - else { - aFound = findInSelection(aRefAttrListAttr->object(i), GeomShapePtr(), aGeomSelection, - myWorkshop); + } else { + aFound = findInSelection(aRefAttrListAttr->object(i), GeomShapePtr(), + aGeomSelection, myWorkshop); } if (!aFound) anIndicesToBeRemoved.insert(i); @@ -1027,13 +1047,14 @@ bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects return isDone; } -std::map > ModuleBase_WidgetMultiSelector::convertSelection - (QList& theValues) -{ +std::map> +ModuleBase_WidgetMultiSelector::convertSelection( + QList &theValues) { // convert prs list to objects map - std::map > aGeomSelection; + std::map> aGeomSelection; std::set aShapes; - QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); + QList::const_iterator anIt = theValues.begin(), + aLast = theValues.end(); ObjectPtr anObject; GeomShapePtr aShape; GeomShapePtr anEmptyShape(new GeomAPI_Shape()); @@ -1053,15 +1074,14 @@ std::map > ModuleBase_WidgetMultiSelector::con return aGeomSelection; } -bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject, - GeomShapePtr theShape, - const std::map >& theGeomSelection, - ModuleBase_IWorkshop* theWorkshop) -{ +bool ModuleBase_WidgetMultiSelector::findInSelection( + const ObjectPtr &theObject, GeomShapePtr theShape, + const std::map> &theGeomSelection, + ModuleBase_IWorkshop *theWorkshop) { if (!theObject.get()) return false; - // issue #2154: we should not remove from list objects hidden in the viewer if selection - // was done with SHIFT button + // issue #2154: we should not remove from list objects hidden in the viewer if + // selection was done with SHIFT button if (theWorkshop->hasSHIFTPressed() && !theObject->isDisplayed()) return true; @@ -1073,17 +1093,20 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject, if (aResult.get()) aShape = aResult->shape(); } - if (theGeomSelection.find(theObject) != theGeomSelection.end()) {// found - const std::set& aShapes = theGeomSelection.at(theObject); - std::set::const_iterator anIt = aShapes.begin(), aLast = aShapes.end(); + if (theGeomSelection.find(theObject) != theGeomSelection.end()) { // found + const std::set &aShapes = theGeomSelection.at(theObject); + std::set::const_iterator anIt = aShapes.begin(), + aLast = aShapes.end(); for (; anIt != aLast && !aFound; anIt++) { GeomShapePtr aCShape = *anIt; - if (aCShape.get()) - { - // treat shape equal to context as null: 2219, keep order of shapes in list - if (aCShape->isNull()) { // in selection, shape of result is equal to selected shape + if (aCShape.get()) { + // treat shape equal to context as null: 2219, keep order of shapes in + // list + if (aCShape->isNull()) { // in selection, shape of result is equal to + // selected shape // if so, here we need to check shape of result - ResultPtr aResult = std::dynamic_pointer_cast(theObject); + ResultPtr aResult = + std::dynamic_pointer_cast(theObject); if (aResult.get()) aCShape = aResult->shape(); } @@ -1092,14 +1115,19 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject, } } - // issue #2903: (Possibility to hide faces) - check whether given shape is a hidden sub-shape - if (!aFound && theShape.get() && theWorkshop->hasSHIFTPressed() && theObject->isDisplayed()) { + // issue #2903: (Possibility to hide faces) - check whether given shape is a + // hidden sub-shape + if (!aFound && theShape.get() && theWorkshop->hasSHIFTPressed() && + theObject->isDisplayed()) { AISObjectPtr anAIS = theWorkshop->findPresentation(theObject); if (anAIS.get() != NULL) { - Handle(AIS_InteractiveObject) anAISIO = anAIS->impl(); + Handle(AIS_InteractiveObject) anAISIO = + anAIS->impl(); - Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(anAISIO); - if (!aResultPrs.IsNull() && aResultPrs->isSubShapeHidden(theShape->impl())) + Handle(ModuleBase_ResultPrs) aResultPrs = + Handle(ModuleBase_ResultPrs)::DownCast(anAISIO); + if (!aResultPrs.IsNull() && + aResultPrs->isSubShapeHidden(theShape->impl())) return true; } } @@ -1107,9 +1135,8 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject, return aFound; } -QList - ModuleBase_WidgetMultiSelector::actionsList(ModuleBase_ActionType theActionType) const -{ +QList ModuleBase_WidgetMultiSelector::actionsList( + ModuleBase_ActionType theActionType) const { QList aList; if (myCurrentHistoryIndex > -1) { int i = 0; @@ -1137,10 +1164,12 @@ QList while (i > myCurrentHistoryIndex) { aNb = mySelectedHistoryValues.at(i).count(); if (aNb == 1) { - ActionInfo aInfo(aIcon, aTit.arg(mySelectedHistoryValues.at(i).count())); + ActionInfo aInfo(aIcon, + aTit.arg(mySelectedHistoryValues.at(i).count())); aList.insert(0, aInfo); } else { - ActionInfo aInfo(aIcon, aTitle.arg(mySelectedHistoryValues.at(i).count())); + ActionInfo aInfo(aIcon, + aTitle.arg(mySelectedHistoryValues.at(i).count())); aList.insert(0, aInfo); } i--; @@ -1153,44 +1182,40 @@ QList return aList; } - -void ModuleBase_WidgetMultiSelector::onFeatureAccepted() -{ +void ModuleBase_WidgetMultiSelector::onFeatureAccepted() { defaultValues[myFeatureId + attributeID()] = myDefMode; } -void ModuleBase_WidgetMultiSelector::onListActivated() -{ - //focusTo(); +void ModuleBase_WidgetMultiSelector::onListActivated() { + // focusTo(); emitFocusInWidget(); } -void ModuleBase_WidgetMultiSelector::onSameTopology(bool theOn) -{ +void ModuleBase_WidgetMultiSelector::onSameTopology(bool theOn) { AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID()); + AttributeSelectionListPtr aSelectionListAttr = + myFeature->data()->selectionList(attributeID()); aSelectionListAttr->setGeometricalSelection(theOn); updateObject(myFeature); } } -void ModuleBase_WidgetMultiSelector::onShowOnly(bool theChecked) -{ +void ModuleBase_WidgetMultiSelector::onShowOnly(bool theChecked) { std::list aResults = myFeature->results(); - std::list::const_iterator aIt; + std::list::const_iterator aIt; if (theChecked) { myVisibleObjects = myWorkshop->displayedObjects(); for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { myVisibleObjects.removeAll(*aIt); } - myWorkshop->module()->disableCustomMode(ModuleBase_IModule::CustomizeArguments); - } - else + myWorkshop->module()->disableCustomMode( + ModuleBase_IModule::CustomizeArguments); + } else myWorkshop->module()->enableCustomModes(); - foreach(ObjectPtr aObj, myVisibleObjects) { + foreach (ObjectPtr aObj, myVisibleObjects) { aObj->setDisplayed(!theChecked); } @@ -1200,34 +1225,35 @@ void ModuleBase_WidgetMultiSelector::onShowOnly(bool theChecked) for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { (*aIt)->setDisplayed(false); } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { (*aIt)->setDisplayed(true); } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); myWorkshop->enableUpdateViewer(aOldState); myVisibleObjects.clear(); } else - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); myWorkshop->viewer()->update(); } -bool ModuleBase_WidgetMultiSelector::isModified() const -{ +bool ModuleBase_WidgetMultiSelector::isModified() const { return myListView->getControl()->count() > 0; } - -void ModuleBase_WidgetMultiSelector::setReadOnly(bool isReadOnly) -{ +void ModuleBase_WidgetMultiSelector::setReadOnly(bool isReadOnly) { ModuleBase_WidgetSelector::setReadOnly(isReadOnly); if (myShowOnlyBtn) myShowOnlyBtn->hide(); if (myFiltersWgt) { myFiltersWgt->hide(); - AttributeSelectionListPtr aAttrList = feature()->selectionList(attributeID()); + AttributeSelectionListPtr aAttrList = + feature()->selectionList(attributeID()); if (aAttrList.get()) { FiltersFeaturePtr aFilters = aAttrList->filters(); if (aFilters.get()) { @@ -1235,11 +1261,12 @@ void ModuleBase_WidgetMultiSelector::setReadOnly(bool isReadOnly) ModuleBase_WidgetSelectionFilter::AttributeId = attributeID(); std::string aXmlCfg, aDescription; - myWorkshop->module()->getXMLRepresentation(myUseFilters, aXmlCfg, aDescription); + myWorkshop->module()->getXMLRepresentation(myUseFilters, aXmlCfg, + aDescription); - ModuleBase_WidgetSelectionFilter* aWgt = - new ModuleBase_WidgetSelectionFilter(this, myWorkshop, - new Config_WidgetAPI(aDescription), true); + ModuleBase_WidgetSelectionFilter *aWgt = + new ModuleBase_WidgetSelectionFilter( + this, myWorkshop, new Config_WidgetAPI(aDescription), true); aWgt->setFeature(aFilters); aWgt->restoreValue(); myMainLayout->addWidget(aWgt); diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index a4c2f75f0..a0b4dd09c 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETMULTISELECTOR_H_ @@ -30,10 +31,10 @@ #include #include +#include +#include #include #include -#include -#include class QWidget; class QCheckBox; @@ -45,35 +46,35 @@ class ModuleBase_ChoiceCtrl; class ModuleBase_FilterStarter; /** -* \ingroup GUI -* Implementation of widget for shapes selection. This widget provides selection of several shapes. -* It can be defined in XML file as following: -* \code -* -* \endcode -* It uses following parameters: -* - id - is a name of corresponded attribute -* - tooltip - a tooltip for the widget -* - shape_types - list of expected shape types. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_WidgetSelector -{ + * \ingroup GUI + * Implementation of widget for shapes selection. This widget provides selection + * of several shapes. It can be defined in XML file as following: \code + * + * \endcode + * It uses following parameters: + * - id - is a name of corresponded attribute + * - tooltip - a tooltip for the widget + * - shape_types - list of expected shape types. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector + : public ModuleBase_WidgetSelector { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetMultiSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetMultiSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetMultiSelector(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// The methiod called when widget is deactivated virtual void deactivate(); @@ -88,32 +89,40 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Widge /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values /// \param theToValidate a validation of the values flag - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); /// Returns values which should be highlighted when the whidget is active /// \param theValues a list of presentations - virtual void getHighlighted(QList>& theValues); + virtual void + getHighlighted(QList> &theValues); - /// Returns true if the action can be processed. By default it is empty and returns false. - /// \param theActionType an action type - /// \param isActionEnabled if true, the enable state of the action - virtual bool canProcessAction(ModuleBase_ActionType theActionType, bool& isActionEnabled); + /// Returns true if the action can be processed. By default it is empty and + /// returns false. \param theActionType an action type \param isActionEnabled + /// if true, the enable state of the action + virtual bool canProcessAction(ModuleBase_ActionType theActionType, + bool &isActionEnabled); - /// Returns true if the event is processed. The default implementation is empty, returns false. + /// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processAction(ModuleBase_ActionType theActionType, - const ActionParamPtr& theParam = ActionParamPtr()); + const ActionParamPtr &theParam = ActionParamPtr()); /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + isValidSelectionCustom(const std::shared_ptr &thePrs); - /// Returns list of accessible actions for Undo/Redo commands. By default it returns empty list. - /// \param theActionType type of action. It can be ActionUndo or ActionRedo. - virtual QList actionsList(ModuleBase_ActionType theActionType) const; + /// Returns list of accessible actions for Undo/Redo commands. By default it + /// returns empty list. \param theActionType type of action. It can be + /// ActionUndo or ActionRedo. + virtual QList + actionsList(ModuleBase_ActionType theActionType) const; - /// The slot is called when user press Ok or OkPlus buttons in the parent property panel + /// The slot is called when user press Ok or OkPlus buttons in the parent + /// property panel virtual void onFeatureAccepted(); /// Returns True if data of its feature was modified during operation @@ -144,7 +153,8 @@ protected slots: void onShowOnly(bool); protected: - /// Returns true if the event is processed. The default implementation is empty, returns false. + /// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processDelete(); /// The methiod called when widget is activated @@ -182,19 +192,20 @@ protected: virtual QIntList shapeTypes() const; /// Set current shape type for selection - void setCurrentShapeType(const QString& theShapeType); + void setCurrentShapeType(const QString &theShapeType); /// Return the attribute values wrapped in a list of viewer presentations - /// \return a list of viewer presentations, which contains an attribute result and - /// a shape. If the attribute do not uses the shape, it is empty - virtual QList> getAttributeSelection() const; + /// \return a list of viewer presentations, which contains an attribute result + /// and a shape. If the attribute do not uses the shape, it is empty + virtual QList> + getAttributeSelection() const; /// Fills the list control by the attribute values void updateSelectionList(); /// Converts the XML defined type choice to the validator type /// For example, the "Edges" is converted to "edge" - std::string validatorType(const QString& theType) const; + std::string validatorType(const QString &theType) const; /// Clear selection in the viewer. The content of the widget is cleared also void clearSelection(); @@ -202,26 +213,28 @@ protected: protected: /// Returns attribute indices selected in the widget selection list /// \param theIndices a list of indices - void getSelectedAttributeIndices(std::set& theIndices); - - /// Gets the feature attribute and fill a list of viewer presentation for the attribute - /// indices. If the the container of indices is empty, it returns all objects. - /// \param theAttributeIds indices in attribute list to be returned - /// \param theValues the result presentations, filled with object and shape of an attribute item - void convertIndicesToViewerSelection(std::set theAttributeIds, - QList>& theValues) const; - - /// Iterates throgh the model attribute list and remove elements which do not present in the list - /// \param theValues the wrapped selection values - /// \return true if at least one object is removed + void getSelectedAttributeIndices(std::set &theIndices); + + /// Gets the feature attribute and fill a list of viewer presentation for the + /// attribute indices. If the the container of indices is empty, it returns + /// all objects. \param theAttributeIds indices in attribute list to be + /// returned \param theValues the result presentations, filled with object and + /// shape of an attribute item + void convertIndicesToViewerSelection( + std::set theAttributeIds, + QList> &theValues) const; + + /// Iterates throgh the model attribute list and remove elements which do not + /// present in the list \param theValues the wrapped selection values \return + /// true if at least one object is removed virtual bool removeUnusedAttributeObjects( - QList>& theValues); + QList> &theValues); /// Converts viewer presentation selection list to objects and shapes map /// \param theValues the wrapped selection values /// \return selection list - std::map > convertSelection - (QList>& theValues); + std::map> + convertSelection(QList> &theValues); /// Returns true if the object and shape present in the container /// \param theObject a model object, a set of shapes is searched by it @@ -229,20 +242,20 @@ protected: /// \param theGeomSelection a map built on selection /// \param theWorkshop a current workshop /// \return boolean result - static bool findInSelection(const ObjectPtr& theObject, - GeomShapePtr theShape, - const std::map >& theGeomSelection, - ModuleBase_IWorkshop* theWorkshop); + static bool findInSelection( + const ObjectPtr &theObject, GeomShapePtr theShape, + const std::map> &theGeomSelection, + ModuleBase_IWorkshop *theWorkshop); protected: - ModuleBase_ListView* myListView; ///< List control + ModuleBase_ListView *myListView; ///< List control bool myIsUseChoice; ///< A flag to store use_choice parameter state QStringList myShapeTypes; ///< List of Shape types defined in XML /// Control for types - ModuleBase_ChoiceCtrl* myTypeCtrl; + ModuleBase_ChoiceCtrl *myTypeCtrl; /// A flag to clear selection by click in empty place in the viewer bool myIsNeutralPointClear; @@ -251,7 +264,7 @@ protected: bool myIsSetSelectionBlocked; /// A container of selected objects - QList > > mySelectedHistoryValues; + QList>> mySelectedHistoryValues; /// Position in a container of selected values int myCurrentHistoryIndex; @@ -259,10 +272,10 @@ protected: bool myIsFirst; std::string myDefMode; - QVBoxLayout* myMainLayout; - QCheckBox* myGeomCheck; - ModuleBase_FilterStarter* myFiltersWgt; - QPushButton* myShowOnlyBtn; + QVBoxLayout *myMainLayout; + QCheckBox *myGeomCheck; + ModuleBase_FilterStarter *myFiltersWgt; + QPushButton *myShowOnlyBtn; QObjectPtrList myVisibleObjects; QStringList myAllowedObjects; diff --git a/src/ModuleBase/ModuleBase_WidgetNameEdit.cpp b/src/ModuleBase/ModuleBase_WidgetNameEdit.cpp index b1fa415ba..9d583ab53 100644 --- a/src/ModuleBase/ModuleBase_WidgetNameEdit.cpp +++ b/src/ModuleBase/ModuleBase_WidgetNameEdit.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetNameEdit.h" @@ -23,10 +24,8 @@ #include - -bool ModuleBase_WidgetNameEdit::storeValueCustom() -{ - if(!myFeature) +bool ModuleBase_WidgetNameEdit::storeValueCustom() { + if (!myFeature) return false; QString aValue = myLineEdit->text(); @@ -39,9 +38,8 @@ bool ModuleBase_WidgetNameEdit::storeValueCustom() return true; } -bool ModuleBase_WidgetNameEdit::restoreValueCustom() -{ - if(!myFeature) +bool ModuleBase_WidgetNameEdit::restoreValueCustom() { + if (!myFeature) return false; bool isBlocked = myLineEdit->blockSignals(true); @@ -49,4 +47,4 @@ bool ModuleBase_WidgetNameEdit::restoreValueCustom() myLineEdit->blockSignals(isBlocked); return true; -} \ No newline at end of file +} diff --git a/src/ModuleBase/ModuleBase_WidgetNameEdit.h b/src/ModuleBase/ModuleBase_WidgetNameEdit.h index 725a7ac7a..604de3054 100644 --- a/src/ModuleBase/ModuleBase_WidgetNameEdit.h +++ b/src/ModuleBase/ModuleBase_WidgetNameEdit.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETNAMEEDIT_H_ @@ -23,13 +24,11 @@ #include #include -class ModuleBase_WidgetNameEdit : public ModuleBase_WidgetLineEdit -{ +class ModuleBase_WidgetNameEdit : public ModuleBase_WidgetLineEdit { Q_OBJECT public: - ModuleBase_WidgetNameEdit(QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& thePlaceHolder) + ModuleBase_WidgetNameEdit(QWidget *theParent, const Config_WidgetAPI *theData, + const std::string &thePlaceHolder) : ModuleBase_WidgetLineEdit(theParent, theData, thePlaceHolder) {} /// Returns True if the widget uses feature attribute. @@ -39,7 +38,7 @@ public: virtual bool focusTo() { return false; } protected: - /// Saves the internal parameters to the given feature + /// Saves the internal parameters to the given feature /// \return True in success virtual bool storeValueCustom(); @@ -47,4 +46,4 @@ protected: virtual bool restoreValueCustom(); }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp b/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp index 32caa2305..0ef3e1f8b 100644 --- a/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp @@ -14,41 +14,32 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include -#include #include +#include -#include -#include #include #include +#include #include +#include #include -ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), - ModuleBase_PageBase(), - myOptionType(CheckBox), - myCheckBoxFrame(0), - myCheckBox(0), - myCheckBoxLayout(0), - myCheckBoxWidget(0), - myGroupBox(0), - myGroupBoxLayout(0), - myCheckGroup(0), - myCheckGroupBtn(0), - myCheckContent(0), - myCheckGroupLayout(0), - myEnableOnCheck(true) -{ +ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), ModuleBase_PageBase(), + myOptionType(CheckBox), myCheckBoxFrame(0), myCheckBox(0), + myCheckBoxLayout(0), myCheckBoxWidget(0), myGroupBox(0), + myGroupBoxLayout(0), myCheckGroup(0), myCheckGroupBtn(0), + myCheckContent(0), myCheckGroupLayout(0), myEnableOnCheck(true) { myToolTip = theData->widgetTooltip(); myGroupTitle = theData->getProperty(CONTAINER_PAGE_NAME); @@ -63,84 +54,76 @@ ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox(QWidget* theParent, ModuleBase_Tools::adjustMargins(myMainLayout); } -ModuleBase_WidgetOptionalBox::~ModuleBase_WidgetOptionalBox() -{ -} +ModuleBase_WidgetOptionalBox::~ModuleBase_WidgetOptionalBox() {} -QWidget* ModuleBase_WidgetOptionalBox::pageWidget() -{ - return myOptionType == GroupBox ? (myGroupBox? myGroupBox : myCheckGroup) : - (QWidget*)myCheckBoxFrame; +QWidget *ModuleBase_WidgetOptionalBox::pageWidget() { + return myOptionType == GroupBox ? (myGroupBox ? myGroupBox : myCheckGroup) + : (QWidget *)myCheckBoxFrame; } -QList ModuleBase_WidgetOptionalBox::getControls() const -{ - QList aControls; +QList ModuleBase_WidgetOptionalBox::getControls() const { + QList aControls; if (myOptionType == GroupBox) { if (myGroupBox) aControls.append(myGroupBox); else aControls.append(myCheckGroup); - } - else + } else aControls.append(myCheckBoxFrame); return aControls; } -void ModuleBase_WidgetOptionalBox::onPageClicked() -{ +void ModuleBase_WidgetOptionalBox::onPageClicked() { storeValue(); updateControlsVisibility(); // The widget doesn't accept a focus - //if (!isEditingMode()) + // if (!isEditingMode()) // emit focusOutWidget(this); } -void ModuleBase_WidgetOptionalBox::addPageStretch() -{ -} +void ModuleBase_WidgetOptionalBox::addPageStretch() {} -void ModuleBase_WidgetOptionalBox::placeModelWidget(ModuleBase_ModelWidget* theWidget) -{ - if(!isCheckBoxFilled() && myOptionType == CheckBox) { +void ModuleBase_WidgetOptionalBox::placeModelWidget( + ModuleBase_ModelWidget *theWidget) { + if (!isCheckBoxFilled() && myOptionType == CheckBox) { createControl(CheckBox); setOptionType(CheckBox); myCheckBoxWidget = theWidget; /// check box frame becomes filled myCheckBoxLayout->addWidget(theWidget, 1); - } - else { + } else { createControl(GroupBox); setOptionType(GroupBox); - ModuleBase_ModelWidget* aCheckBoxWidget = myCheckBoxWidget; + ModuleBase_ModelWidget *aCheckBoxWidget = myCheckBoxWidget; myCheckBoxWidget = 0; - if (aCheckBoxWidget) // move the model widget from check box frame to group box frame + if (aCheckBoxWidget) // move the model widget from check box frame to group + // box frame placeModelWidget(aCheckBoxWidget); const int kCol = 0; const int kRow = myGroupBoxLayout->count(); - // it seems, that the align on left is not necessary here, but leads to widgets, which are - // not extended on full width of the parent page. The case is grouped widgets in - // the sketch translation operation - myGroupBoxLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft); + // it seems, that the align on left is not necessary here, but leads to + // widgets, which are not extended on full width of the parent page. The + // case is grouped widgets in the sketch translation operation + myGroupBoxLayout->addWidget(theWidget, kRow, kCol, + Qt::AlignTop); // | Qt::AlignLeft); myGroupBoxLayout->setRowStretch(kRow, 0); } } -void ModuleBase_WidgetOptionalBox::placeWidget(QWidget* theWidget) -{ +void ModuleBase_WidgetOptionalBox::placeWidget(QWidget *theWidget) { createControl(GroupBox); setOptionType(GroupBox); if (isCheckBoxFilled()) placeModelWidget(myCheckBoxWidget); - if (!theWidget) { #ifdef _DEBUG - std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" << std::endl; + std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" + << std::endl; #endif return; } @@ -149,19 +132,17 @@ void ModuleBase_WidgetOptionalBox::placeWidget(QWidget* theWidget) const int kRow = myGroupBoxLayout->count(); myGroupBoxLayout->addWidget(theWidget, kRow, kCol); myGroupBoxLayout->setRowStretch(kRow, 0); - } - else { + } else { myCheckGroupLayout->addWidget(theWidget); } } -QLayout* ModuleBase_WidgetOptionalBox::pageLayout() -{ - return myOptionType == GroupBox ? myGroupBoxLayout : (QLayout*)myCheckBoxLayout; +QLayout *ModuleBase_WidgetOptionalBox::pageLayout() { + return myOptionType == GroupBox ? myGroupBoxLayout + : (QLayout *)myCheckBoxLayout; } -void ModuleBase_WidgetOptionalBox::createControl(const OptionType& theType) -{ +void ModuleBase_WidgetOptionalBox::createControl(const OptionType &theType) { if (theType == GroupBox && !myGroupBox) { // group box: more than one model widget is inside if (myHaveFrame) { @@ -179,10 +160,9 @@ void ModuleBase_WidgetOptionalBox::createControl(const OptionType& theType) // default vertical size policy is preferred myMainLayout->addWidget(myGroupBox); connect(myGroupBox, SIGNAL(clicked(bool)), this, SLOT(onPageClicked())); - } - else { + } else { myCheckGroup = new QWidget(this); - QVBoxLayout* aLayout = new QVBoxLayout(myCheckGroup); + QVBoxLayout *aLayout = new QVBoxLayout(myCheckGroup); ModuleBase_Tools::zeroMargins(aLayout); myCheckGroupBtn = new QCheckBox(translate(myGroupTitle), myCheckGroup); @@ -194,10 +174,10 @@ void ModuleBase_WidgetOptionalBox::createControl(const OptionType& theType) aLayout->addWidget(myCheckContent); myMainLayout->addWidget(myCheckGroup); - connect(myCheckGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onPageClicked())); + connect(myCheckGroupBtn, SIGNAL(toggled(bool)), this, + SLOT(onPageClicked())); } - } - else if (theType == CheckBox && !myCheckBoxFrame) { + } else if (theType == CheckBox && !myCheckBoxFrame) { myCheckBoxFrame = new QFrame(this); myMainLayout->addWidget(myCheckBoxFrame); @@ -214,8 +194,7 @@ void ModuleBase_WidgetOptionalBox::createControl(const OptionType& theType) } } -bool ModuleBase_WidgetOptionalBox::storeValueCustom() -{ +bool ModuleBase_WidgetOptionalBox::storeValueCustom() { DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); if (aStringAttr.get()) @@ -230,8 +209,7 @@ bool ModuleBase_WidgetOptionalBox::storeValueCustom() return true; } -bool ModuleBase_WidgetOptionalBox::restoreValueCustom() -{ +bool ModuleBase_WidgetOptionalBox::restoreValueCustom() { DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(attributeID()); if (aStringAttr.get()) @@ -244,8 +222,7 @@ bool ModuleBase_WidgetOptionalBox::restoreValueCustom() } void ModuleBase_WidgetOptionalBox::setOptionType( - const ModuleBase_WidgetOptionalBox::OptionType& theType) -{ + const ModuleBase_WidgetOptionalBox::OptionType &theType) { myOptionType = theType; bool isGroupBox = myOptionType == GroupBox; @@ -257,34 +234,30 @@ void ModuleBase_WidgetOptionalBox::setOptionType( myCheckGroup->setVisible(isGroupBox); } -bool ModuleBase_WidgetOptionalBox::isCheckBoxFilled() const -{ +bool ModuleBase_WidgetOptionalBox::isCheckBoxFilled() const { return myCheckBoxWidget != 0; } -bool ModuleBase_WidgetOptionalBox::getCurrentValue() const -{ +bool ModuleBase_WidgetOptionalBox::getCurrentValue() const { bool isGroupBox = myOptionType == GroupBox; - return isGroupBox ? (myGroupBox? myGroupBox->isChecked() : myCheckGroupBtn->isChecked()) : - myCheckBox->isChecked(); + return isGroupBox ? (myGroupBox ? myGroupBox->isChecked() + : myCheckGroupBtn->isChecked()) + : myCheckBox->isChecked(); } -void ModuleBase_WidgetOptionalBox::setCurrentValue(const bool& theValue) -{ +void ModuleBase_WidgetOptionalBox::setCurrentValue(const bool &theValue) { bool isGroupBox = myOptionType == GroupBox; if (isGroupBox) { if (myGroupBox) { bool isBlocked = myGroupBox->blockSignals(true); myGroupBox->setChecked(theValue); myGroupBox->blockSignals(isBlocked); - } - else { + } else { bool isBlocked = myCheckGroupBtn->blockSignals(true); myCheckGroupBtn->setChecked(theValue); myCheckGroupBtn->blockSignals(isBlocked); } - } - else { + } else { bool isBlocked = myCheckBox->blockSignals(true); myCheckBox->setChecked(theValue); myCheckBox->blockSignals(isBlocked); @@ -292,31 +265,30 @@ void ModuleBase_WidgetOptionalBox::setCurrentValue(const bool& theValue) updateControlsVisibility(); } -void ModuleBase_WidgetOptionalBox::updateControlsVisibility() -{ +void ModuleBase_WidgetOptionalBox::updateControlsVisibility() { if (myOptionType == GroupBox) { bool aChecked = toEnableWidgets(); ModuleBase_Tools::adjustMargins(myGroupBoxLayout); - QLayout* aLayout = myGroupBoxLayout ? myGroupBoxLayout : (QLayout*)myCheckGroupLayout; + QLayout *aLayout = + myGroupBoxLayout ? myGroupBoxLayout : (QLayout *)myCheckGroupLayout; int aNbSubControls = aLayout->count(); for (int i = 0; i < aNbSubControls; i++) { - QWidget* aWidget = aLayout->itemAt(i)->widget(); + QWidget *aWidget = aLayout->itemAt(i)->widget(); if (aWidget) aWidget->setEnabled(aChecked); } - } - else { + } else { myCheckBoxWidget->setEnabled(toEnableWidgets()); } } -bool ModuleBase_WidgetOptionalBox::toEnableWidgets() const -{ +bool ModuleBase_WidgetOptionalBox::toEnableWidgets() const { bool aChecked; if (myOptionType == GroupBox) - aChecked = myGroupBox ? myGroupBox->isChecked() : myCheckGroupBtn->isChecked(); + aChecked = + myGroupBox ? myGroupBox->isChecked() : myCheckGroupBtn->isChecked(); else aChecked = myCheckBox->isChecked(); diff --git a/src/ModuleBase/ModuleBase_WidgetOptionalBox.h b/src/ModuleBase/ModuleBase_WidgetOptionalBox.h index 56c37b469..de27a3a29 100644 --- a/src/ModuleBase/ModuleBase_WidgetOptionalBox.h +++ b/src/ModuleBase/ModuleBase_WidgetOptionalBox.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetOptionalBox_H_ #define ModuleBase_WidgetOptionalBox_H_ #include -#include #include +#include class QGroupBox; class QFrame; @@ -32,20 +33,24 @@ class QHBoxLayout; class QGridLayout; /** -* \ingroup GUI -* Implements a model widget for switch as a container widget. It can be defined in XML with "toolbox" keyword -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetOptionalBox : public ModuleBase_ModelWidget, - public ModuleBase_PageBase -{ + * \ingroup GUI + * Implements a model widget for switch as a container widget. It can be defined + * in XML with "toolbox" keyword + */ +class MODULEBASE_EXPORT ModuleBase_WidgetOptionalBox + : public ModuleBase_ModelWidget, + public ModuleBase_PageBase { Q_OBJECT - enum OptionType {CheckBox, GroupBox}; + enum OptionType { CheckBox, GroupBox }; + public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetOptionalBox(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetOptionalBox(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetOptionalBox(); /// Defines if it is supported to set the value in this widget @@ -54,13 +59,13 @@ public: /// Methods to be redefined from ModuleBase_PageBase: start /// Cast the page to regular QWidget - virtual QWidget* pageWidget(); + virtual QWidget *pageWidget(); /// Methods to be redefined from ModuleBase_PageBase: end /// Methods to be redefined from ModuleBase_ModelWidget: start /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Methods to be redefined from ModuleBase_ModelWidget: end protected slots: @@ -70,16 +75,15 @@ protected slots: protected: /// Methods to be redefined from ModuleBase_PageBase: start /// Adds the given widget to page's layout - virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget); + virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget); /// Adds the given page to page's layout - virtual void placeWidget(QWidget* theWidget); + virtual void placeWidget(QWidget *theWidget); /// Returns page's layout (QGridLayout) - virtual QLayout* pageLayout(); + virtual QLayout *pageLayout(); /// Adds a stretch to page's layout virtual void addPageStretch(); /// Methods to be redefined from ModuleBase_PageBase: end - /// Methods to be redefined from ModuleBase_ModelWidget: start /// Saves the internal parameters to the given feature /// \return True in success @@ -91,7 +95,7 @@ protected: private: /// Sets whether Check box or Group box is used currently /// \param theType a type of the control - void setOptionType(const OptionType& theType); + void setOptionType(const OptionType &theType); /// Returns true if the model widget is set into the check box frame /// \return boolean value @@ -99,7 +103,7 @@ private: /// Creates controls for the given type if it was not perfomed yet /// \param theType a type to create whether check box or group box controls - void createControl(const OptionType& theType); + void createControl(const OptionType &theType); /// Returns true if control is checked /// \return boolean value @@ -107,32 +111,37 @@ private: /// Returns true if control is checked /// \param theValue a new value to fill the control state - void setCurrentValue(const bool& theValue); + void setCurrentValue(const bool &theValue); - /// Makes model widget controls either disabled(for check box mode) or hidden(for group box mode) + /// Makes model widget controls either disabled(for check box mode) or + /// hidden(for group box mode) void updateControlsVisibility(); bool toEnableWidgets() const; private: - std::string myToolTip; ///< tool tip defined in XML + std::string myToolTip; ///< tool tip defined in XML std::string myGroupTitle; ///< a title for group box - OptionType myOptionType; ///< current option state - QVBoxLayout* myMainLayout; ///< the main layout + OptionType myOptionType; ///< current option state + QVBoxLayout *myMainLayout; ///< the main layout // controls to fill check box frame - QWidget* myCheckBoxFrame; ///< frame with check box, to be hidden when group box is used - QCheckBox* myCheckBox; ///< control used if only one model widget is placed inside - QHBoxLayout* myCheckBoxLayout; ///< layout of check box frame - ModuleBase_ModelWidget* myCheckBoxWidget; /// model widget, placed in the check box frame + QWidget *myCheckBoxFrame; ///< frame with check box, to be hidden when group + ///< box is used + QCheckBox + *myCheckBox; ///< control used if only one model widget is placed inside + QHBoxLayout *myCheckBoxLayout; ///< layout of check box frame + ModuleBase_ModelWidget + *myCheckBoxWidget; /// model widget, placed in the check box frame // controls to fill group box frame - QGroupBox* myGroupBox; ///< control used if more than model widget is placed inside - QGridLayout* myGroupBoxLayout; ///< page's layout - - QWidget* myCheckGroup; - QCheckBox* myCheckGroupBtn; - QWidget* myCheckContent; - QVBoxLayout* myCheckGroupLayout; + QGroupBox + *myGroupBox; ///< control used if more than model widget is placed inside + QGridLayout *myGroupBoxLayout; ///< page's layout + + QWidget *myCheckGroup; + QCheckBox *myCheckGroupBtn; + QWidget *myCheckContent; + QVBoxLayout *myCheckGroupLayout; bool myHaveFrame; bool myEnableOnCheck; diff --git a/src/ModuleBase/ModuleBase_WidgetPointInput.cpp b/src/ModuleBase/ModuleBase_WidgetPointInput.cpp index 9bb0f5b9e..848b0ef6f 100644 --- a/src/ModuleBase/ModuleBase_WidgetPointInput.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPointInput.cpp @@ -14,37 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetPointInput.h" -#include "ModuleBase_Tools.h" #include "ModuleBase_ParamSpinBox.h" +#include "ModuleBase_Tools.h" #include "ModuleBase_ViewerPrs.h" -#include #include +#include #include -#include #include +#include #include #include - #define ERR_STRING L"ERROR" -ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) - : ModuleBase_WidgetSelector(theParent, theWorkshop, theData) -{ +ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetSelector(theParent, theWorkshop, theData) { myDefaultValue[0] = 0; myDefaultValue[1] = 0; myDefaultValue[2] = 0; - bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + bool aAcceptVariables = + theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); std::string aDefValuesStr = theData->getProperty(ATTR_DEFAULT); if (!aDefValuesStr.empty()) { @@ -55,14 +55,14 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent, myDefaultValue[i] = aStrArray.at(i).toDouble(); } } - QFormLayout* aMainlayout = new QFormLayout(this); + QFormLayout *aMainlayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aMainlayout); myXSpin = new ModuleBase_ParamSpinBox(this); myXSpin->setAcceptVariables(aAcceptVariables); myXSpin->setToolTip(tr("X coordinate")); myXSpin->setValue(myDefaultValue[0]); - QLabel* aXLbl = new QLabel(this); + QLabel *aXLbl = new QLabel(this); aXLbl->setPixmap(QPixmap(":pictures/x_size.png")); aMainlayout->addRow(aXLbl, myXSpin); @@ -70,7 +70,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent, myYSpin->setAcceptVariables(aAcceptVariables); myYSpin->setToolTip(tr("Y coordinate")); myYSpin->setValue(myDefaultValue[1]); - QLabel* aYLbl = new QLabel(this); + QLabel *aYLbl = new QLabel(this); aYLbl->setPixmap(QPixmap(":pictures/y_size.png")); aMainlayout->addRow(aYLbl, myYSpin); @@ -78,33 +78,31 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent, myZSpin->setAcceptVariables(aAcceptVariables); myZSpin->setToolTip(tr("Z coordinate")); myZSpin->setValue(myDefaultValue[2]); - QLabel* aZLbl = new QLabel(this); + QLabel *aZLbl = new QLabel(this); aZLbl->setPixmap(QPixmap(":pictures/z_size.png")); aMainlayout->addRow(aZLbl, myZSpin); - connect(myXSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); - connect(myYSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); - connect(myZSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); -} - -ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput() -{ - + connect(myXSpin, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesModified())); + connect(myYSpin, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesModified())); + connect(myZSpin, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesModified())); } +ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput() {} //******************************************************************** -QList ModuleBase_WidgetPointInput::getControls() const -{ - QList aList; +QList ModuleBase_WidgetPointInput::getControls() const { + QList aList; aList.append(myXSpin); aList.append(myYSpin); aList.append(myZSpin); return aList; } -std::wstring getParmText(ModuleBase_ParamSpinBox* theSpin, FeaturePtr& theParam) -{ +std::wstring getParmText(ModuleBase_ParamSpinBox *theSpin, + FeaturePtr &theParam) { QString aText = theSpin->text(); if (aText.contains('=')) { if (!theParam.get()) { @@ -112,8 +110,7 @@ std::wstring getParmText(ModuleBase_ParamSpinBox* theSpin, FeaturePtr& theParam) if (!theParam.get()) { return ERR_STRING; } - } - else { + } else { ModuleBase_Tools::editParameter(theParam, aText); } aText = aText.split('=').at(0); @@ -122,12 +119,13 @@ std::wstring getParmText(ModuleBase_ParamSpinBox* theSpin, FeaturePtr& theParam) } //******************************************************************** -bool ModuleBase_WidgetPointInput::storeValueCustom() -{ - AttributePointPtr aAttr = std::dynamic_pointer_cast(attribute()); +bool ModuleBase_WidgetPointInput::storeValueCustom() { + AttributePointPtr aAttr = + std::dynamic_pointer_cast(attribute()); if (aAttr.get()) { if (aAttr->isInitialized()) { - if (myXSpin->hasVariable() || myYSpin->hasVariable() || myZSpin->hasVariable()) { + if (myXSpin->hasVariable() || myYSpin->hasVariable() || + myZSpin->hasVariable()) { std::wstring aXText = getParmText(myXSpin, myXParam); if (aXText == ERR_STRING) { aAttr->setExpressionError(0, "Parameter cannot be created"); @@ -164,34 +162,30 @@ bool ModuleBase_WidgetPointInput::storeValueCustom() } //******************************************************************** -bool ModuleBase_WidgetPointInput::restoreValueCustom() -{ - AttributePointPtr aAttr = std::dynamic_pointer_cast(attribute()); +bool ModuleBase_WidgetPointInput::restoreValueCustom() { + AttributePointPtr aAttr = + std::dynamic_pointer_cast(attribute()); if (aAttr.get()) { if (aAttr->isInitialized()) { std::wstring aXText = aAttr->textX(); if (aXText.empty()) { myXSpin->setValue(aAttr->x()); - } - else { + } else { myXSpin->setText(QString::fromStdWString(aXText)); } std::wstring aYText = aAttr->textY(); if (aYText.empty()) { myYSpin->setValue(aAttr->y()); - } - else { + } else { myYSpin->setText(QString::fromStdWString(aYText)); } std::wstring aZText = aAttr->textZ(); if (aZText.empty()) { myZSpin->setValue(aAttr->z()); - } - else { + } else { myZSpin->setText(QString::fromStdWString(aZText)); } - } - else { + } else { aAttr->setValue(myDefaultValue[0], myDefaultValue[1], myDefaultValue[2]); myXSpin->setValue(myDefaultValue[0]); myYSpin->setValue(myDefaultValue[1]); @@ -204,25 +198,23 @@ bool ModuleBase_WidgetPointInput::restoreValueCustom() } //******************************************************************** -void ModuleBase_WidgetPointInput::selectionModes(int& theModuleSelectionModes, QIntList& theModes) -{ +void ModuleBase_WidgetPointInput::selectionModes(int &theModuleSelectionModes, + QIntList &theModes) { theModuleSelectionModes = -1; theModes << TopAbs_VERTEX; } //******************************************************************** -QIntList ModuleBase_WidgetPointInput::shapeTypes() const -{ +QIntList ModuleBase_WidgetPointInput::shapeTypes() const { QIntList aList; aList << TopAbs_VERTEX; return aList; } //******************************************************************** -bool ModuleBase_WidgetPointInput -::setSelection(QList>& theValues, - const bool theToValidate) -{ +bool ModuleBase_WidgetPointInput ::setSelection( + QList> &theValues, + const bool theToValidate) { if (theValues.size() == 1) { GeomShapePtr aShape = theValues.first()->shape(); if (aShape.get() && aShape->isVertex()) { @@ -238,8 +230,7 @@ bool ModuleBase_WidgetPointInput } //******************************************************************** -bool ModuleBase_WidgetPointInput::processEnter() -{ +bool ModuleBase_WidgetPointInput::processEnter() { bool isModified = getValueState() == ModifiedInPP; if (isModified) { emit valuesChanged(); diff --git a/src/ModuleBase/ModuleBase_WidgetPointInput.h b/src/ModuleBase/ModuleBase_WidgetPointInput.h index 7447fbb1e..dfc04a58c 100644 --- a/src/ModuleBase/ModuleBase_WidgetPointInput.h +++ b/src/ModuleBase/ModuleBase_WidgetPointInput.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetPointInput_H @@ -25,23 +26,25 @@ class ModuleBase_ParamSpinBox; -class MODULEBASE_EXPORT ModuleBase_WidgetPointInput : public ModuleBase_WidgetSelector -{ +class MODULEBASE_EXPORT ModuleBase_WidgetPointInput + : public ModuleBase_WidgetSelector { Q_OBJECT public: /// Constructor /// \param theParent the parent object /// \param theWorkshop a current workshop - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetPointInput(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetPointInput(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); /// Destructor virtual ~ModuleBase_WidgetPointInput(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Saves the internal parameters to the given feature /// \return True in success @@ -54,14 +57,15 @@ public: virtual bool isViewerSelector() { return true; } /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param [out] theModes a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param [out] theModes a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); protected: /// Retunrs a list of possible shape types @@ -72,9 +76,9 @@ protected: virtual bool processEnter(); protected: - ModuleBase_ParamSpinBox* myXSpin; - ModuleBase_ParamSpinBox* myYSpin; - ModuleBase_ParamSpinBox* myZSpin; + ModuleBase_ParamSpinBox *myXSpin; + ModuleBase_ParamSpinBox *myYSpin; + ModuleBase_ParamSpinBox *myZSpin; FeaturePtr myXParam; FeaturePtr myYParam; @@ -83,5 +87,4 @@ protected: double myDefaultValue[3]; }; - -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp b/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp index c091a8433..7fc7ba439 100644 --- a/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp @@ -14,23 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include +#include #include -#include #include -#include +#include -ModuleBase_WidgetRadiobox::ModuleBase_WidgetRadiobox(QWidget* theParent, - const Config_WidgetAPI* theData) - : ModuleBase_PagedContainer(theParent, theData) -{ +ModuleBase_WidgetRadiobox::ModuleBase_WidgetRadiobox( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_PagedContainer(theParent, theData) { myLayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(myLayout); myGroup = new QButtonGroup(this); @@ -41,27 +41,24 @@ ModuleBase_WidgetRadiobox::ModuleBase_WidgetRadiobox(QWidget* theParent, connect(myGroup, SIGNAL(buttonToggled(int, bool)), SLOT(onPageChanged())); } -ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox() -{ -} +ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox() {} -int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase* thePage, - const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip) -{ - ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); - QWidget* aWgt = new QWidget(this); - QVBoxLayout* aLay = new QVBoxLayout(aWgt); +int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase *thePage, + const QString &theName, + const QString &theCaseId, + const QPixmap &theIcon, + const QString &theTooltip) { + ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, + theTooltip); + QWidget *aWgt = new QWidget(this); + QVBoxLayout *aLay = new QVBoxLayout(aWgt); aLay->setContentsMargins(0, 0, 0, 0); - QRadioButton* aButton; + QRadioButton *aButton; if (theIcon.isNull()) { aButton = new QRadioButton(theName, aWgt); aButton->setToolTip(translate(theTooltip.toStdString())); - } - else { + } else { aButton = new QRadioButton(aWgt); aButton->setToolTip(translate(theName.toStdString())); } @@ -69,8 +66,8 @@ int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase* thePage, aLay->addWidget(aButton); aLay->addStretch(); - //QFrame* aFrame = dynamic_cast(thePage); - QWidget* aPage = thePage->pageWidget(); + // QFrame* aFrame = dynamic_cast(thePage); + QWidget *aPage = thePage->pageWidget(); if (myVerticalAlignment) { myLayout->addRow(aWgt); myLayout->addRow(aPage); @@ -86,13 +83,11 @@ int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase* thePage, return myGroup->buttons().count(); } -int ModuleBase_WidgetRadiobox::currentPageIndex() const -{ +int ModuleBase_WidgetRadiobox::currentPageIndex() const { return myGroup->checkedId(); } -void ModuleBase_WidgetRadiobox::setCurrentPageIndex(int theIndex) -{ +void ModuleBase_WidgetRadiobox::setCurrentPageIndex(int theIndex) { bool isSignalsBlocked = myGroup->blockSignals(true); myGroup->button(theIndex)->setChecked(true); myGroup->blockSignals(isSignalsBlocked); diff --git a/src/ModuleBase/ModuleBase_WidgetRadiobox.h b/src/ModuleBase/ModuleBase_WidgetRadiobox.h index b4438bf48..78de46a32 100644 --- a/src/ModuleBase/ModuleBase_WidgetRadiobox.h +++ b/src/ModuleBase/ModuleBase_WidgetRadiobox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETRADIOBOX_H_ @@ -27,27 +28,26 @@ class QFormLayout; class QButtonGroup; class QRadioButton; -class MODULEBASE_EXPORT ModuleBase_WidgetRadiobox : public ModuleBase_PagedContainer -{ +class MODULEBASE_EXPORT ModuleBase_WidgetRadiobox + : public ModuleBase_PagedContainer { Q_OBJECT public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetRadiobox(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetRadiobox(QWidget *theParent, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetRadiobox(); - /// Add a page to the widget /// \param theWidget a page widget /// \param theName a name of page /// \param theCaseId an Id of the page /// \param theIcon an icon of the page - virtual int addPage(ModuleBase_PageBase* theWidget, - const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip); + virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip); protected: /// Implements ModuleBase_PagedContainer @@ -57,9 +57,9 @@ protected: virtual void setCurrentPageIndex(int); private: - QFormLayout* myLayout; - QButtonGroup* myGroup; + QFormLayout *myLayout; + QButtonGroup *myGroup; bool myVerticalAlignment; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp index 5ae3446f3..ccdd97e9e 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp @@ -14,48 +14,49 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetSelectionFilter.h" -#include "ModuleBase_Tools.h" -#include "ModuleBase_IWorkshop.h" -#include "ModuleBase_ISelectionActivate.h" #include "ModuleBase_IModule.h" -#include "ModuleBase_IViewer.h" #include "ModuleBase_IPropertyPanel.h" +#include "ModuleBase_ISelectionActivate.h" +#include "ModuleBase_IViewer.h" +#include "ModuleBase_IWorkshop.h" #include "ModuleBase_PageWidget.h" -#include "ModuleBase_WidgetMultiSelector.h" #include "ModuleBase_ResultPrs.h" +#include "ModuleBase_Tools.h" #include "ModuleBase_WidgetFactory.h" +#include "ModuleBase_WidgetMultiSelector.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 #ifdef WIN32 #pragma warning(disable : 4456) // for nested foreach @@ -64,9 +65,7 @@ FeaturePtr ModuleBase_WidgetSelectionFilter::SelectorFeature; std::string ModuleBase_WidgetSelectionFilter::AttributeId; - -GeomAPI_Shape::ShapeType selectionType(const QString& theType) -{ +GeomAPI_Shape::ShapeType selectionType(const QString &theType) { QString aType = theType.toUpper(); if ((aType == "VERTEX") || (aType == "VERTICES")) return GeomAPI_Shape::VERTEX; @@ -88,40 +87,38 @@ GeomAPI_Shape::ShapeType selectionType(const QString& theType) return GeomAPI_Shape::SHAPE; } - -ModuleBase_FilterStarter::ModuleBase_FilterStarter(const std::string& theFeature, - QWidget* theParent, ModuleBase_IWorkshop* theWorkshop) - : QWidget(theParent), - myFeatureName(theFeature), - myWorkshop(theWorkshop) -{ - QHBoxLayout* aMainLayout = new QHBoxLayout(this); +ModuleBase_FilterStarter::ModuleBase_FilterStarter( + const std::string &theFeature, QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop) + : QWidget(theParent), myFeatureName(theFeature), myWorkshop(theWorkshop) { + QHBoxLayout *aMainLayout = new QHBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLayout); aMainLayout->addStretch(1); - QPushButton* aLaunchBtn = new QPushButton( - ModuleBase_Tools::translate("FiltersSelection", "Selection by filters"), this); + QPushButton *aLaunchBtn = new QPushButton( + ModuleBase_Tools::translate("FiltersSelection", "Selection by filters"), + this); connect(aLaunchBtn, SIGNAL(clicked()), SLOT(onFiltersLaunch())); aMainLayout->addWidget(aLaunchBtn); } -void ModuleBase_FilterStarter::onFiltersLaunch() -{ +void ModuleBase_FilterStarter::onFiltersLaunch() { static QString aHelpFileName = QString("FiltersPlugin") + QDir::separator() + - QString("FiltersPlugin.html"); + QString("FiltersPlugin.html"); - ModuleBase_Operation* aParentOp = myWorkshop->currentOperation(); - ModuleBase_OperationFeature* aFeatureOp = dynamic_cast(aParentOp); + ModuleBase_Operation *aParentOp = myWorkshop->currentOperation(); + ModuleBase_OperationFeature *aFeatureOp = + dynamic_cast(aParentOp); if (aFeatureOp) // Open transaction on filters operation finish aFeatureOp->openTransactionOnResume(); - QWidget* aParent = parentWidget(); - ModuleBase_WidgetMultiSelector* aSelector = - dynamic_cast(aParent); + QWidget *aParent = parentWidget(); + ModuleBase_WidgetMultiSelector *aSelector = + dynamic_cast(aParent); while (!aSelector) { aParent = aParent->parentWidget(); - aSelector = dynamic_cast(aParent); + aSelector = dynamic_cast(aParent); } if (!aSelector) return; @@ -129,12 +126,13 @@ void ModuleBase_FilterStarter::onFiltersLaunch() ModuleBase_WidgetSelectionFilter::AttributeId = aSelector->attributeID(); // Launch Filters operation - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->module()->createOperation(myFeatureName)); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->module()->createOperation(myFeatureName)); AttributeSelectionListPtr aAttrList = - ModuleBase_WidgetSelectionFilter::SelectorFeature->selectionList( - ModuleBase_WidgetSelectionFilter::AttributeId); + ModuleBase_WidgetSelectionFilter::SelectorFeature->selectionList( + ModuleBase_WidgetSelectionFilter::AttributeId); FiltersFeaturePtr aFilters = aAttrList->filters(); if (aFilters.get()) aFOperation->setFeature(aFilters); @@ -146,54 +144,56 @@ void ModuleBase_FilterStarter::onFiltersLaunch() //***************************************************************************** //***************************************************************************** ModuleBase_FilterItem::ModuleBase_FilterItem( - const std::string& theFilter, ModuleBase_WidgetSelectionFilter* theParent) - : QWidget(theParent->filtersWidget()), myFilterID(theFilter), - mySelection(std::dynamic_pointer_cast(theParent->feature())) -{ + const std::string &theFilter, ModuleBase_WidgetSelectionFilter *theParent) + : QWidget(theParent->filtersWidget()), myFilterID(theFilter), + mySelection(std::dynamic_pointer_cast( + theParent->feature())) { FilterPtr aFilter = ModelAPI_Session::get()->filters()->filter(theFilter); std::string aXmlString = aFilter->xmlRepresentation(); if (aXmlString.length() == 0) addItemRow(this); else { - std::string anAttrPrefix; // this must be added to the attributes names for multiple filters + std::string anAttrPrefix; // this must be added to the attributes names for + // multiple filters std::string aFilterKind = ModelAPI_Session::get()->filters()->id(aFilter); if (theFilter != aFilterKind) { anAttrPrefix = theFilter.substr(0, theFilter.size() - aFilterKind.size()); } - ModuleBase_WidgetFactory aFactory(aXmlString, theParent->workshop(), anAttrPrefix); + ModuleBase_WidgetFactory aFactory(aXmlString, theParent->workshop(), + anAttrPrefix); Config_ValidatorReader aValidatorReader(aXmlString, true); aValidatorReader.setFeatureId(mySelection->getKind()); aValidatorReader.readAll(); - QVBoxLayout* aLayout = new QVBoxLayout(this); + QVBoxLayout *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); - QWidget* aItemRow = new QWidget(this); + QWidget *aItemRow = new QWidget(this); addItemRow(aItemRow); aLayout->addWidget(aItemRow); - ModuleBase_PageWidget* aParamsWgt = new ModuleBase_PageWidget(this); + ModuleBase_PageWidget *aParamsWgt = new ModuleBase_PageWidget(this); aParamsWgt->setFrameStyle(QFrame::Box | QFrame::Raised); aFactory.createWidget(aParamsWgt); ModuleBase_Tools::zeroMargins(aParamsWgt->layout()); myWidgets = aFactory.getModelWidgets(); - foreach(ModuleBase_ModelWidget* aWidget, myWidgets) { + foreach (ModuleBase_ModelWidget *aWidget, myWidgets) { aWidget->setFeature(theParent->feature()); - connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)), - theParent, SIGNAL(focusInWidget(ModuleBase_ModelWidget*))); - connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), - theParent, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*))); - connect(aWidget, SIGNAL(objectUpdated()), theParent, SLOT(onObjectUpdated())); + connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget *)), + theParent, SIGNAL(focusInWidget(ModuleBase_ModelWidget *))); + connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget *)), + theParent, SIGNAL(focusOutWidget(ModuleBase_ModelWidget *))); + connect(aWidget, SIGNAL(objectUpdated()), theParent, + SLOT(onObjectUpdated())); aWidget->enableFocusProcessing(); } aLayout->addWidget(aParamsWgt); } } -void ModuleBase_FilterItem::addItemRow(QWidget* theParent) -{ +void ModuleBase_FilterItem::addItemRow(QWidget *theParent) { std::string aContext = mySelection->getKind(); - QHBoxLayout* aLayout = new QHBoxLayout(theParent); + QHBoxLayout *aLayout = new QHBoxLayout(theParent); ModuleBase_Tools::zeroMargins(aLayout); // Reverse filter button @@ -206,23 +206,27 @@ void ModuleBase_FilterItem::addItemRow(QWidget* theParent) myRevBtn->setIcon(QIcon(":pictures/reverce.png")); else myRevBtn->setIcon(QIcon(":pictures/add.png")); - myRevBtn->setToolTip(ModuleBase_Tools::translate(aContext, "Reverse the filter")); + myRevBtn->setToolTip( + ModuleBase_Tools::translate(aContext, "Reverse the filter")); connect(myRevBtn, SIGNAL(toggled(bool)), SLOT(onReverse(bool))); aLayout->addWidget(myRevBtn); - const std::string& aFilterName = ModelAPI_Session::get()->filters()->filter(myFilterID)->name(); - aLayout->addWidget(new QLabel(ModuleBase_Tools::translate(aContext, aFilterName), theParent), 1); + const std::string &aFilterName = + ModelAPI_Session::get()->filters()->filter(myFilterID)->name(); + aLayout->addWidget( + new QLabel(ModuleBase_Tools::translate(aContext, aFilterName), theParent), + 1); - QToolButton* aDelBtn = new QToolButton(theParent); + QToolButton *aDelBtn = new QToolButton(theParent); aDelBtn->setIcon(QIcon(":pictures/delete.png")); aDelBtn->setAutoRaise(true); - aDelBtn->setToolTip(ModuleBase_Tools::translate(aContext, "Delete the filter")); + aDelBtn->setToolTip( + ModuleBase_Tools::translate(aContext, "Delete the filter")); connect(aDelBtn, SIGNAL(clicked(bool)), SLOT(onDelete())); aLayout->addWidget(aDelBtn); } -void ModuleBase_FilterItem::onReverse(bool theCheck) -{ +void ModuleBase_FilterItem::onReverse(bool theCheck) { mySelection->setReversed(myFilterID, theCheck); if (theCheck) myRevBtn->setIcon(QIcon(":pictures/reverce.png")); @@ -231,35 +235,31 @@ void ModuleBase_FilterItem::onReverse(bool theCheck) emit reversedItem(this); } -void ModuleBase_FilterItem::onDelete() -{ - emit deleteItem(this); -} - +void ModuleBase_FilterItem::onDelete() { emit deleteItem(this); } //***************************************************************************** //***************************************************************************** //***************************************************************************** -ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, bool theReadOnly) - : ModuleBase_ModelWidget(theParent, theData), - myWorkshop(theWorkshop), - mySelectorFeature(ModuleBase_WidgetSelectionFilter::SelectorFeature), - mySelectorAttribute(ModuleBase_WidgetSelectionFilter::AttributeId) -{ +ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData, bool theReadOnly) + : ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), + mySelectorFeature(ModuleBase_WidgetSelectionFilter::SelectorFeature), + mySelectorAttribute(ModuleBase_WidgetSelectionFilter::AttributeId) { // Clear Old selection - AttributeSelectionListPtr aAttrList = mySelectorFeature->selectionList(mySelectorAttribute); - mySelectionType = selectionType(aAttrList->selectionType().c_str()); + AttributeSelectionListPtr aAttrList = + mySelectorFeature->selectionList(mySelectorAttribute); + mySelectionType = selectionType(aAttrList->selectionType().c_str()); if (!theReadOnly) { aAttrList->clear(); } // Define widgets - QVBoxLayout* aMainLayout = new QVBoxLayout(this); + QVBoxLayout *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLayout); - QGroupBox* aFiltersGroup = new QGroupBox(translate("Filters"), this); - QVBoxLayout* aGroupLayout = new QVBoxLayout(aFiltersGroup); + QGroupBox *aFiltersGroup = new QGroupBox(translate("Filters"), this); + QVBoxLayout *aGroupLayout = new QVBoxLayout(aFiltersGroup); aGroupLayout->setContentsMargins(0, 0, 0, 0); aGroupLayout->setSpacing(0); @@ -272,7 +272,7 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theP myFiltersCombo->addItem(translate("Add new filter...")); SessionPtr aSession = ModelAPI_Session::get(); std::list allFilters = - aSession->filters()->filters((GeomAPI_Shape::ShapeType) mySelectionType); + aSession->filters()->filters((GeomAPI_Shape::ShapeType)mySelectionType); storeFilters(allFilters); QStringList aItems; std::list::const_iterator aIt; @@ -280,14 +280,15 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theP aItems.push_back(translate((*aIt)->name().c_str())); } myFiltersCombo->addItems(aItems); - connect(myFiltersCombo, SIGNAL(currentIndexChanged(int)), SLOT(onAddFilter(int))); + connect(myFiltersCombo, SIGNAL(currentIndexChanged(int)), + SLOT(onAddFilter(int))); aGroupLayout->addWidget(myFiltersCombo); aMainLayout->addWidget(aFiltersGroup); // Select Button - QWidget* aBtnWgt = new QWidget(this); - QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnWgt); + QWidget *aBtnWgt = new QWidget(this); + QHBoxLayout *aBtnLayout = new QHBoxLayout(aBtnWgt); ModuleBase_Tools::adjustMargins(aBtnLayout); aBtnLayout->addStretch(1); @@ -299,11 +300,12 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theP aMainLayout->addWidget(aBtnWgt); // Label widgets - QWidget* aLblWgt = new QWidget(this); - QHBoxLayout* aLblLayout = new QHBoxLayout(aLblWgt); + QWidget *aLblWgt = new QWidget(this); + QHBoxLayout *aLblLayout = new QHBoxLayout(aLblWgt); ModuleBase_Tools::zeroMargins(aLblLayout); - aLblLayout->addWidget(new QLabel(translate("Number of selected objects:"), aLblWgt)); + aLblLayout->addWidget( + new QLabel(translate("Number of selected objects:"), aLblWgt)); myNbLbl = new QLabel("0", aLblWgt); aLblLayout->addWidget(myNbLbl); @@ -326,8 +328,7 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theP } } -ModuleBase_WidgetSelectionFilter::~ModuleBase_WidgetSelectionFilter() -{ +ModuleBase_WidgetSelectionFilter::~ModuleBase_WidgetSelectionFilter() { myValues.clear(); if (!myPreview.IsNull()) { Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext(); @@ -341,7 +342,8 @@ ModuleBase_WidgetSelectionFilter::~ModuleBase_WidgetSelectionFilter() aShapeIO = Handle(AIS_Shape)::DownCast(*aIt); if (!aShapeIO.IsNull()) { aCtx->Display(aShapeIO, false); - std::shared_ptr anAISObj = AISObjectPtr(new GeomAPI_AISObject()); + std::shared_ptr anAISObj = + AISObjectPtr(new GeomAPI_AISObject()); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aShapeIO)); myWorkshop->applyCurrentSelectionModes(anAISObj); } @@ -355,22 +357,23 @@ ModuleBase_WidgetSelectionFilter::~ModuleBase_WidgetSelectionFilter() AttributeId = ""; } -void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex) -{ +void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex) { if (theIndex == 0) return; - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); FiltersFeaturePtr aFiltersFeature = - std::dynamic_pointer_cast(myFeature); + std::dynamic_pointer_cast(myFeature); std::string aText = myFiltersCombo->itemText(theIndex).toStdString(); std::list::iterator aIt; std::string aFilter; - std::map::const_iterator aFound = myFilters.find(aText); + std::map::const_iterator aFound = + myFilters.find(aText); if (aFound == myFilters.end()) { - std::list aFilters = aFactory->filters((GeomAPI_Shape::ShapeType) mySelectionType); + std::list aFilters = + aFactory->filters((GeomAPI_Shape::ShapeType)mySelectionType); storeFilters(aFilters); aFound = myFilters.find(aText); } @@ -380,22 +383,22 @@ void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex) aFiltersFeature->addFilter(aFilter); updateObject(myFeature); - QList aList = itemsList(); + QList aList = itemsList(); if (!aList.isEmpty() && (aList.last()->widgets().size() > 0)) aList.last()->widgets().first()->emitFocusInWidget(); else emitFocusInWidget(); } -ModuleBase_FilterItem* ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string& theFilter) -{ +ModuleBase_FilterItem * +ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string &theFilter) { if (theFilter.length() == 0) return 0; - ModuleBase_FilterItem* aItem = new ModuleBase_FilterItem(theFilter, this); - connect(aItem, SIGNAL(deleteItem(ModuleBase_FilterItem*)), - SLOT(onDeleteItem(ModuleBase_FilterItem*))); - connect(aItem, SIGNAL(reversedItem(ModuleBase_FilterItem*)), - SLOT(onReverseItem(ModuleBase_FilterItem*))); + ModuleBase_FilterItem *aItem = new ModuleBase_FilterItem(theFilter, this); + connect(aItem, SIGNAL(deleteItem(ModuleBase_FilterItem *)), + SLOT(onDeleteItem(ModuleBase_FilterItem *))); + connect(aItem, SIGNAL(reversedItem(ModuleBase_FilterItem *)), + SLOT(onReverseItem(ModuleBase_FilterItem *))); myFiltersLayout->addWidget(aItem); updateSelectBtn(); @@ -404,23 +407,24 @@ ModuleBase_FilterItem* ModuleBase_WidgetSelectionFilter::onAddFilter(const std:: return aItem; } -void ModuleBase_WidgetSelectionFilter::onDeleteItem(ModuleBase_FilterItem* theItem) -{ +void ModuleBase_WidgetSelectionFilter::onDeleteItem( + ModuleBase_FilterItem *theItem) { std::string aFilter = theItem->filter(); - QList aWidgets = theItem->widgets(); - foreach(ModuleBase_ModelWidget* aWgt, aWidgets) { + QList aWidgets = theItem->widgets(); + foreach (ModuleBase_ModelWidget *aWgt, aWidgets) { aWgt->deactivate(); } myFiltersLayout->removeWidget(theItem); theItem->deleteLater(); - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); if (!aFactory->filter(aFilter)->isMultiple()) { - //myFilters.push_back(aFilter); - myFiltersCombo->addItem(ModelAPI_Session::get()->filters()->filter(aFilter)->name().c_str()); + // myFilters.push_back(aFilter); + myFiltersCombo->addItem( + ModelAPI_Session::get()->filters()->filter(aFilter)->name().c_str()); } FiltersFeaturePtr aFiltersFeature = - std::dynamic_pointer_cast(myFeature); + std::dynamic_pointer_cast(myFeature); aFiltersFeature->removeFilter(aFilter); updateSelectBtn(); @@ -435,23 +439,21 @@ void ModuleBase_WidgetSelectionFilter::onDeleteItem(ModuleBase_FilterItem* theIt updateObject(myFeature); } - -void ModuleBase_WidgetSelectionFilter::redisplayFeature() -{ - static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); +void ModuleBase_WidgetSelectionFilter::redisplayFeature() { + static Events_ID aDispEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(myFeature, aDispEvent); Events_Loop::loop()->flush(aDispEvent); } -void ModuleBase_WidgetSelectionFilter::onReverseItem(ModuleBase_FilterItem* theItem) -{ +void ModuleBase_WidgetSelectionFilter::onReverseItem( + ModuleBase_FilterItem *theItem) { updateSelectBtn(); clearCurrentSelection(true); updateNumberSelected(); } -void ModuleBase_WidgetSelectionFilter::onSelect() -{ +void ModuleBase_WidgetSelectionFilter::onSelect() { Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext(); if (aCtx.IsNull()) return; @@ -459,22 +461,25 @@ void ModuleBase_WidgetSelectionFilter::onSelect() clearCurrentSelection(); FiltersFeaturePtr aFiltersFeature = - std::dynamic_pointer_cast(myFeature); + std::dynamic_pointer_cast(myFeature); static SessionPtr aSession = ModelAPI_Session::get(); - std::list< std::pair > aResList = - aSession->filters()->select(aFiltersFeature, (GeomAPI_Shape::ShapeType)mySelectionType); + std::list> aResList = + aSession->filters()->select(aFiltersFeature, + (GeomAPI_Shape::ShapeType)mySelectionType); BRep_Builder aBuilder; TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); - std::list< std::pair >::const_iterator itSelected = aResList.cbegin(); + std::list>::const_iterator itSelected = + aResList.cbegin(); for (; itSelected != aResList.cend(); itSelected++) { ResultPtr aCurRes = (*itSelected).first; GeomShapePtr aSubShape = (*itSelected).second; TopoDS_Shape aTShape = aSubShape->impl(); aBuilder.Add(aComp, aTShape); - ModuleBase_ViewerPrsPtr aValue (new ModuleBase_ViewerPrs(aCurRes, aSubShape)); + ModuleBase_ViewerPrsPtr aValue( + new ModuleBase_ViewerPrs(aCurRes, aSubShape)); myValues.append(aValue); } @@ -485,8 +490,8 @@ void ModuleBase_WidgetSelectionFilter::onSelect() onShowOnly(myShowBtn->isChecked()); } -void ModuleBase_WidgetSelectionFilter::updatePreview(const TopoDS_Shape& theShape) -{ +void ModuleBase_WidgetSelectionFilter::updatePreview( + const TopoDS_Shape &theShape) { Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext(); if (aCtx.IsNull()) return; @@ -500,22 +505,19 @@ void ModuleBase_WidgetSelectionFilter::updatePreview(const TopoDS_Shape& theShap aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_O_STAR); aDrawer->PointAspect()->SetColor(Quantity_NOC_BLUE1); aDrawer->PointAspect()->SetScale(2.); - } - else - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_O_STAR, Quantity_NOC_BLUE1, 2.)); + } else + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_O_STAR, Quantity_NOC_BLUE1, 2.)); myPreview->SetTransparency(); aCtx->Display(myPreview, true); aCtx->Deactivate(myPreview); - } - else { + } else { myPreview->Set(theShape); aCtx->Redisplay(myPreview, true); } } - -void ModuleBase_WidgetSelectionFilter::onShowOnly(bool theShow) -{ +void ModuleBase_WidgetSelectionFilter::onShowOnly(bool theShow) { Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext(); if (theShow) { AIS_ListOfInteractive aList; @@ -536,11 +538,11 @@ void ModuleBase_WidgetSelectionFilter::onShowOnly(bool theShow) aCtx->Erase(aShapeIO, false); isModified = true; } - } - else { + } else { if (!aCtx->IsDisplayed(aShapeIO)) { aCtx->Display(aShapeIO, false); - std::shared_ptr anAISObj = AISObjectPtr(new GeomAPI_AISObject()); + std::shared_ptr anAISObj = + AISObjectPtr(new GeomAPI_AISObject()); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aShapeIO)); myWorkshop->applyCurrentSelectionModes(anAISObj); isModified = true; @@ -552,38 +554,36 @@ void ModuleBase_WidgetSelectionFilter::onShowOnly(bool theShow) myWorkshop->viewer()->update(); } -void ModuleBase_WidgetSelectionFilter::updateSelectBtn() -{ - FiltersFeaturePtr aFiltersFeature = std::dynamic_pointer_cast(myFeature); - mySelectBtn->setEnabled(aFiltersFeature.get() && (aFiltersFeature->filters().size() > 0)); +void ModuleBase_WidgetSelectionFilter::updateSelectBtn() { + FiltersFeaturePtr aFiltersFeature = + std::dynamic_pointer_cast(myFeature); + mySelectBtn->setEnabled(aFiltersFeature.get() && + (aFiltersFeature->filters().size() > 0)); } -void ModuleBase_WidgetSelectionFilter::updateNumberSelected() -{ +void ModuleBase_WidgetSelectionFilter::updateNumberSelected() { int aNb = myValues.size(); myNbLbl->setText(QString::number(aNb)); if (aNb == 0) { - myFeature->setError(translate("Selection is empty").toStdString(), false, false); + myFeature->setError(translate("Selection is empty").toStdString(), false, + false); myShowBtn->setChecked(false); onShowOnly(false); myShowBtn->setEnabled(false); - } - else { + } else { myFeature->setError("", false, false); myFeature->data()->execState(ModelAPI_StateDone); myShowBtn->setEnabled(true); } } -QList ModuleBase_WidgetSelectionFilter::getControls() const -{ - QList aWidgets; +QList ModuleBase_WidgetSelectionFilter::getControls() const { + QList aWidgets; aWidgets.append(myFiltersCombo); return aWidgets; } -void ModuleBase_WidgetSelectionFilter::clearCurrentSelection(bool toUpdate) -{ +void ModuleBase_WidgetSelectionFilter::clearCurrentSelection(bool toUpdate) { myValues.clear(); if (!myPreview.IsNull()) { Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext(); @@ -592,8 +592,8 @@ void ModuleBase_WidgetSelectionFilter::clearCurrentSelection(bool toUpdate) } } -void replaceSubShapesByResult(QList& theResults, int theShapeType) -{ +void replaceSubShapesByResult(QList &theResults, + int theShapeType) { QMap> myResShapes; // Sort sub-shapes by result foreach (ModuleBase_ViewerPrsPtr aPrs, theResults) { @@ -609,15 +609,15 @@ void replaceSubShapesByResult(QList& theResults, int th QList aShapes; QList aToReplace; std::list aSubShapes; - foreach(ObjectPtr aObj, myResShapes.keys()) { + foreach (ObjectPtr aObj, myResShapes.keys()) { aShapes = myResShapes[aObj]; ResultPtr aRes = std::dynamic_pointer_cast(aObj); TopTools_MapOfShape aShapesMap; if (aRes.get()) { GeomShapePtr aSubShape = aRes->shape(); - const TopoDS_Shape& aShape = aSubShape->impl(); + const TopoDS_Shape &aShape = aSubShape->impl(); for (TopExp_Explorer anExp(aShape, (TopAbs_ShapeEnum)theShapeType); - anExp.More(); anExp.Next()) { + anExp.More(); anExp.Next()) { aShapesMap.Add(anExp.Current()); } } @@ -626,7 +626,7 @@ void replaceSubShapesByResult(QList& theResults, int th } // Replace the found results QList::iterator aIt; - foreach(ObjectPtr aObj, aToReplace) { + foreach (ObjectPtr aObj, aToReplace) { for (aIt = theResults.begin(); aIt != theResults.end(); aIt++) { if ((*aIt)->object() == aObj) { theResults.removeAll(*aIt); @@ -638,52 +638,51 @@ void replaceSubShapesByResult(QList& theResults, int th } } -void ModuleBase_WidgetSelectionFilter::onFeatureAccepted() -{ +void ModuleBase_WidgetSelectionFilter::onFeatureAccepted() { AttributePtr aAttr = mySelectorFeature->attribute(mySelectorAttribute); AttributeSelectionListPtr aSelListAttr = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); aSelListAttr->clear(); if (aSelListAttr->isWholeResultAllowed()) - replaceSubShapesByResult(myValues, selectionType(aSelListAttr->selectionType().c_str())); - foreach(ModuleBase_ViewerPrsPtr aPrs, myValues) { + replaceSubShapesByResult( + myValues, selectionType(aSelListAttr->selectionType().c_str())); + foreach (ModuleBase_ViewerPrsPtr aPrs, myValues) { aSelListAttr->append(aPrs->object(), aPrs->shape()); } } -bool ModuleBase_WidgetSelectionFilter::storeValueCustom() -{ - ModuleBase_ModelWidget* aActive = myWorkshop->propertyPanel()->activeWidget(); +bool ModuleBase_WidgetSelectionFilter::storeValueCustom() { + ModuleBase_ModelWidget *aActive = myWorkshop->propertyPanel()->activeWidget(); if (aActive) return aActive->storeValue(); updateObject(myFeature); return true; } -QList ModuleBase_WidgetSelectionFilter::itemsList() const -{ - return myFiltersWgt->findChildren(); +QList +ModuleBase_WidgetSelectionFilter::itemsList() const { + return myFiltersWgt->findChildren(); } - -bool ModuleBase_WidgetSelectionFilter::restoreValueCustom() -{ - ModelAPI_FiltersFactory* aFactory = ModelAPI_Session::get()->filters(); - FiltersFeaturePtr aFiltersFeature = std::dynamic_pointer_cast(myFeature); +bool ModuleBase_WidgetSelectionFilter::restoreValueCustom() { + ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); + FiltersFeaturePtr aFiltersFeature = + std::dynamic_pointer_cast(myFeature); // Init filters member of the parent attribute - AttributeSelectionListPtr aAttrList = mySelectorFeature->selectionList(mySelectorAttribute); + AttributeSelectionListPtr aAttrList = + mySelectorFeature->selectionList(mySelectorAttribute); if (aAttrList->filters() != aFiltersFeature) { aAttrList->setFilters(aFiltersFeature); } - QList aItemsList = itemsList(); + QList aItemsList = itemsList(); std::list aFilters = aFiltersFeature->filters(); std::list::const_iterator aIt; int i = 0; int aNbItems = aItemsList.size(); - ModuleBase_FilterItem* aItem = 0; + ModuleBase_FilterItem *aItem = 0; bool isBlocked = myFiltersCombo->blockSignals(true); for (aIt = aFilters.cbegin(); aIt != aFilters.cend(); aIt++, i++) { std::string aStr = (*aIt); @@ -695,8 +694,8 @@ bool ModuleBase_WidgetSelectionFilter::restoreValueCustom() if ((aId != -1) && !aFilterObj->isMultiple()) myFiltersCombo->removeItem(aId); if (aItem) { - QList aSubList = aItem->widgets(); - foreach(ModuleBase_ModelWidget* aWgt, aSubList) { + QList aSubList = aItem->widgets(); + foreach (ModuleBase_ModelWidget *aWgt, aSubList) { aWgt->restoreValue(); } } @@ -707,8 +706,8 @@ bool ModuleBase_WidgetSelectionFilter::restoreValueCustom() return true; } -QString ModuleBase_WidgetSelectionFilter::getError(const bool theValueStateChecked) const -{ +QString ModuleBase_WidgetSelectionFilter::getError( + const bool theValueStateChecked) const { QString aErrorMsg = ModuleBase_ModelWidget::getError(theValueStateChecked); if (aErrorMsg.isEmpty()) { if (myValues.size() == 0) @@ -717,16 +716,15 @@ QString ModuleBase_WidgetSelectionFilter::getError(const bool theValueStateCheck return aErrorMsg; } -void ModuleBase_WidgetSelectionFilter::onObjectUpdated() -{ +void ModuleBase_WidgetSelectionFilter::onObjectUpdated() { myShowBtn->setChecked(false); clearCurrentSelection(true); updateNumberSelected(); - QList aItemsList = itemsList(); - foreach(ModuleBase_FilterItem* aItem, aItemsList) { - QList aWidgetsList = aItem->widgets(); - foreach(ModuleBase_ModelWidget* aWidget, aWidgetsList) { + QList aItemsList = itemsList(); + foreach (ModuleBase_FilterItem *aItem, aItemsList) { + QList aWidgetsList = aItem->widgets(); + foreach (ModuleBase_ModelWidget *aWidget, aWidgetsList) { if (!aWidget->feature().get()) aWidget->setFeature(myFeature); aWidget->restoreValue(); @@ -734,14 +732,16 @@ void ModuleBase_WidgetSelectionFilter::onObjectUpdated() } updateObject(myFeature); - // Redisplay the feature on order to Customize presentations from filters with selectors - static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + // Redisplay the feature on order to Customize presentations from filters with + // selectors + static Events_ID EVENT_DISP = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(myFeature, EVENT_DISP); Events_Loop::loop()->flush(EVENT_DISP); } -void ModuleBase_WidgetSelectionFilter::storeFilters(const std::list& theFilters) -{ +void ModuleBase_WidgetSelectionFilter::storeFilters( + const std::list &theFilters) { for (std::list::const_iterator anIt = theFilters.begin(); anIt != theFilters.end(); ++anIt) { std::string aName = translate((*anIt)->name()).toStdString(); @@ -749,7 +749,7 @@ void ModuleBase_WidgetSelectionFilter::storeFilters(const std::list& } } -QString ModuleBase_WidgetSelectionFilter::translate(const std::string& theString) const -{ +QString ModuleBase_WidgetSelectionFilter::translate( + const std::string &theString) const { return ModuleBase_Tools::translate(myFeatureId, theString); } diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h index 3303fce0e..d619fe868 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetSelectionFilter_H @@ -26,12 +27,12 @@ #include -#include -#include #include +#include +#include -#include #include +#include class QLabel; class QComboBox; @@ -46,20 +47,19 @@ class ModelAPI_Filter; class ModuleBase_IWorkshop; /** -* \ingroup GUI -* An object which lets to start a Filters operation as -* a sub-operation of the current one. -*/ -class MODULEBASE_EXPORT ModuleBase_FilterStarter: public QWidget -{ + * \ingroup GUI + * An object which lets to start a Filters operation as + * a sub-operation of the current one. + */ +class MODULEBASE_EXPORT ModuleBase_FilterStarter : public QWidget { Q_OBJECT public: /// Constructor /// \param theFeature a name of feature for filtering /// \param theParent a parent widget which will get control after filtering /// \param theWorkshop a pointer on a current workshop - ModuleBase_FilterStarter(const std::string& theFeature, QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop); + ModuleBase_FilterStarter(const std::string &theFeature, QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop); /// Destructor ~ModuleBase_FilterStarter() {} @@ -73,40 +73,36 @@ private: std::string myFeatureName; /// A workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; }; - class ModuleBase_WidgetSelectionFilter; /** -* \ingroup GUI -* A widget which reperesents a one filter item in filters list -* Also it includes filter GUI if it exists -*/ -class ModuleBase_FilterItem : public QWidget -{ + * \ingroup GUI + * A widget which reperesents a one filter item in filters list + * Also it includes filter GUI if it exists + */ +class ModuleBase_FilterItem : public QWidget { Q_OBJECT public: - /// Constructor /// \param theFilter the filter ID /// \param theParent a parent widget of ModuleBase_WidgetSelectionFilter class - ModuleBase_FilterItem(const std::string& theFilter, ModuleBase_WidgetSelectionFilter* theParent); + ModuleBase_FilterItem(const std::string &theFilter, + ModuleBase_WidgetSelectionFilter *theParent); /// Returns filter Id std::string filter() const { return myFilterID; } /// Returns list of widgets which reperesent the current filter GUI - QList widgets() const { - return myWidgets; - } + QList widgets() const { return myWidgets; } signals: /// The seignal is sent on deletion of the item - void deleteItem(ModuleBase_FilterItem* theItem); + void deleteItem(ModuleBase_FilterItem *theItem); /// The seignal is sent on reversing of the item - void reversedItem(ModuleBase_FilterItem* theItem); + void reversedItem(ModuleBase_FilterItem *theItem); private slots: /// A slot to process reverse button click @@ -118,7 +114,7 @@ private slots: private: /// A function which adds standard widgets of the item - void addItemRow(QWidget* theParent); + void addItemRow(QWidget *theParent); /// Current filter Id std::string myFilterID; @@ -127,57 +123,58 @@ private: FiltersFeaturePtr mySelection; /// Reverce button - QToolButton* myRevBtn; + QToolButton *myRevBtn; /// A list of sub-widgets - QList myWidgets; + QList myWidgets; }; /** -* \ingroup GUI -* A widget for selection by filters -*/ -class ModuleBase_WidgetSelectionFilter : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * A widget for selection by filters + */ +class ModuleBase_WidgetSelectionFilter : public ModuleBase_ModelWidget { Q_OBJECT public: static FeaturePtr SelectorFeature; static std::string AttributeId; - /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - /// a low-level API for reading xml definitions of widgets - ModuleBase_WidgetSelectionFilter(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData, bool theReadOnly = false); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from a low-level API for reading xml definitions of widgets + ModuleBase_WidgetSelectionFilter(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData, + bool theReadOnly = false); /// Destructor ~ModuleBase_WidgetSelectionFilter(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; - /// It is called when user press Ok or OkPlus buttons in the parent property panel - /// By default this slot does nothing + /// It is called when user press Ok or OkPlus buttons in the parent property + /// panel By default this slot does nothing virtual void onFeatureAccepted(); /// Returns current workshop - ModuleBase_IWorkshop* workshop() const { return myWorkshop; } + ModuleBase_IWorkshop *workshop() const { return myWorkshop; } /// Returns a container widget for filter items - QWidget* filtersWidget() const { return myFiltersWgt; } + QWidget *filtersWidget() const { return myFiltersWgt; } /// Returns error string virtual QString getError(const bool theValueStateChecked = true) const; protected: - /// Saves the internal parameters to the given feature (not ussed for this widget) - /// \return True in success + /// Saves the internal parameters to the given feature (not ussed for this + /// widget) \return True in success virtual bool storeValueCustom(); - /// Restore value from attribute data to the widget's control (not ussed for this widget) + /// Restore value from attribute data to the widget's control (not ussed for + /// this widget) virtual bool restoreValueCustom(); private slots: @@ -185,10 +182,10 @@ private slots: void onAddFilter(int); /// Process deletion of a filter item - void onDeleteItem(ModuleBase_FilterItem* theItem); + void onDeleteItem(ModuleBase_FilterItem *theItem); /// Process reversion of a filter item - void onReverseItem(ModuleBase_FilterItem* theItem); + void onReverseItem(ModuleBase_FilterItem *theItem); /// Process selection void onSelect(); @@ -211,33 +208,34 @@ private: /// Update preview /// \param theShape a preview shape - void updatePreview(const TopoDS_Shape& theShape); + void updatePreview(const TopoDS_Shape &theShape); /// Call to redisplay the fiter feature void redisplayFeature(); /// Add a filter by name - ModuleBase_FilterItem* onAddFilter(const std::string& theFilter); + ModuleBase_FilterItem *onAddFilter(const std::string &theFilter); /// Return currently created filter items - QList itemsList() const; + QList itemsList() const; /// Translate a string - QString translate(const std::string& theString) const; + QString translate(const std::string &theString) const; /// Store translated names of filters and their instances - void storeFilters(const std::list >& theFilters); + void + storeFilters(const std::list> &theFilters); private: - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; - QWidget* myFiltersWgt; - QVBoxLayout* myFiltersLayout; + QWidget *myFiltersWgt; + QVBoxLayout *myFiltersLayout; - QComboBox* myFiltersCombo; - QPushButton* mySelectBtn; - QLabel* myNbLbl; - QCheckBox* myShowBtn; + QComboBox *myFiltersCombo; + QPushButton *mySelectBtn; + QLabel *myNbLbl; + QCheckBox *myShowBtn; /// Type of selection mode int mySelectionType; @@ -258,8 +256,7 @@ private: std::string mySelectorAttribute; /// Translated name and the corresponding filter - std::map > myFilters; + std::map> myFilters; }; - -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index ecae117ab..f2bcfe132 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -43,38 +44,34 @@ // Get object from group // Return true if find object -static bool getObjectFromGroup(ObjectPtr& theObject, GeomShapePtr& theShape); - -ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetValidated(theParent, theWorkshop, theData), -myIsPointsFiltering(true) -{ - QString aFiltering = QString::fromStdString(theData->getProperty("filter_points")); +static bool getObjectFromGroup(ObjectPtr &theObject, GeomShapePtr &theShape); + +ModuleBase_WidgetSelector::ModuleBase_WidgetSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetValidated(theParent, theWorkshop, theData), + myIsPointsFiltering(true) { + QString aFiltering = + QString::fromStdString(theData->getProperty("filter_points")); if (aFiltering.toLower() == "false") myIsPointsFiltering = false; } //******************************************************************** -ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() -{ -} +ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() {} //******************************************************************** -void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape) -{ - ModuleBase_ISelection* aSelection = myWorkshop->selection(); +void ModuleBase_WidgetSelector::getGeomSelection( + const ModuleBase_ViewerPrsPtr &thePrs, ObjectPtr &theObject, + GeomShapePtr &theShape) { + ModuleBase_ISelection *aSelection = myWorkshop->selection(); theObject = aSelection->getResult(thePrs); if (!theObject.get()) theObject = thePrs->object(); theShape = aSelection->getShape(thePrs); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - while (aFeature.get() && - aFeature->lastResult().get() && + while (aFeature.get() && aFeature->lastResult().get() && aFeature->lastResult()->groupName() == ModelAPI_ResultGroup::group()) { if (!getObjectFromGroup(theObject, theShape)) break; @@ -85,32 +82,33 @@ void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& } //******************************************************************** -bool ModuleBase_WidgetSelector::processSelection() -{ +bool ModuleBase_WidgetSelector::processSelection() { QList aSelected = getFilteredSelected(); // equal vertices should not be used here if (myIsPointsFiltering) ModuleBase_ISelection::filterSelectionOnEqualPoints(aSelected); - bool isDone = setSelection(aSelected, true/*false*/); + bool isDone = setSelection(aSelected, true /*false*/); updateOnSelectionChanged(isDone); return isDone; } //******************************************************************** -void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone) -{ - // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in - // the same place repeatedly without mouse moved. In the case validation by filters is not - // perfromed, so an invalid object is selected. E.g. distance constraint, selection of a point. - // the 3rd click in the same point allow using this point. +void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone) { + // "false" flag should be used here, it connects to the #26658 OCC bug, when + // the user click in the same place repeatedly without mouse moved. In the + // case validation by filters is not perfromed, so an invalid object is + // selected. E.g. distance constraint, selection of a point. the 3rd click in + // the same point allow using this point. emit valuesChanged(); - // the updateObject method should be called to flush the updated sigal. The workshop listens it, - // calls validators for the feature and, as a result, updates the Apply button state. + // the updateObject method should be called to flush the updated sigal. The + // workshop listens it, calls validators for the feature and, as a result, + // updates the Apply button state. updateObject(myFeature); - // we need to forget about previous validation result as the current selection can influence on it + // we need to forget about previous validation result as the current selection + // can influence on it clearValidatedCash(); if (theDone) @@ -118,12 +116,11 @@ void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone) } //******************************************************************** -QIntList ModuleBase_WidgetSelector::getShapeTypes() const -{ +QIntList ModuleBase_WidgetSelector::getShapeTypes() const { QIntList aShapeTypes = shapeTypes(); // this type should be mentioned in XML, poor selection otherwise if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/ - aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result/*TopAbs_SHAPE*/)) { + aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result /*TopAbs_SHAPE*/)) { // it should be selectable for both, "solids" and "objects" types aShapeTypes.append(TopAbs_COMPSOLID); } @@ -131,15 +128,14 @@ QIntList ModuleBase_WidgetSelector::getShapeTypes() const } //******************************************************************** -QList ModuleBase_WidgetSelector::getAttributeSelection() const -{ +QList +ModuleBase_WidgetSelector::getAttributeSelection() const { return QList(); } //******************************************************************** -bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape, - const ResultPtr& theResult) const -{ +bool ModuleBase_WidgetSelector::acceptSubShape( + const GeomShapePtr &theShape, const ResultPtr &theResult) const { bool aValid = false; GeomShapePtr aShape = theShape; @@ -149,9 +145,12 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape, aValid = true; return aValid; } - // when the SHAPE type is provided by XML as Object, the whole result shape should be selected. - //if (!aShape.get() && aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) { - // In case of selection of a feature aShape could be not NULL, but result has to be selected + // when the SHAPE type is provided by XML as Object, the whole result shape + // should be selected. + // if (!aShape.get() && + // aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) { + // In case of selection of a feature aShape could be not NULL, but result has + // to be selected if (aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) { aValid = true; return aValid; @@ -175,16 +174,18 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape, } } - QIntList::const_iterator anIt = aShapeTypes.begin(), aLast = aShapeTypes.end(); + QIntList::const_iterator anIt = aShapeTypes.begin(), + aLast = aShapeTypes.end(); for (; anIt != aLast && !aValid; anIt++) { TopAbs_ShapeEnum aCurrentShapeType = (TopAbs_ShapeEnum)*anIt; if (aShapeType == aCurrentShapeType) aValid = true; else if (aCurrentShapeType == TopAbs_FACE) { - // try to process the construction shape only if there is no a selected shape in the viewer + // try to process the construction shape only if there is no a selected + // shape in the viewer if (!theShape.get() && theResult.get()) { ResultConstructionPtr aCResult = - std::dynamic_pointer_cast(theResult); + std::dynamic_pointer_cast(theResult); aValid = aCResult.get() && aCResult->facesNum() > 0; } } @@ -193,15 +194,15 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape, } //******************************************************************** -void ModuleBase_WidgetSelector::selectionModes(int& theModuleSelectionModes, QIntList& theModes) -{ +void ModuleBase_WidgetSelector::selectionModes(int &theModuleSelectionModes, + QIntList &theModes) { theModuleSelectionModes = -1; theModes.append(getShapeTypes()); } //******************************************************************** -void ModuleBase_WidgetSelector::updateSelectionModesAndFilters(bool toActivate) -{ +void ModuleBase_WidgetSelector::updateSelectionModesAndFilters( + bool toActivate) { updateSelectionName(); myWorkshop->selectionActivate()->updateSelectionFilters(); @@ -212,17 +213,18 @@ void ModuleBase_WidgetSelector::updateSelectionModesAndFilters(bool toActivate) } //******************************************************************** -void ModuleBase_WidgetSelector::activateCustom() -{ +void ModuleBase_WidgetSelector::activateCustom() { // Restore selection in the viewer by the attribute selection list - // it should be postponed to have current widget as active to validate restored selection - static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); + // it should be postponed to have current widget as active to validate + // restored selection + static Events_ID anEvent = + Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); } //******************************************************************** -bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetSelector::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs); ResultPtr aResult = myWorkshop->selection()->getResult(thePrs); bool aValid = aResult.get(); @@ -239,20 +241,20 @@ bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPr } //******************************************************************** -bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetSelector::setSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { ObjectPtr anObject; GeomShapePtr aShape; getGeomSelection(thePrs, anObject, aShape); - // the last flag is to be depending on hasObject is called before. To be corrected later - return ModuleBase_Tools::setObject(attribute(), anObject, aShape, - myWorkshop, myIsInValidate, true); + // the last flag is to be depending on hasObject is called before. To be + // corrected later + return ModuleBase_Tools::setObject(attribute(), anObject, aShape, myWorkshop, + myIsInValidate, true); } //******************************************************************** -void ModuleBase_WidgetSelector::deactivate() -{ +void ModuleBase_WidgetSelector::deactivate() { ModuleBase_WidgetValidated::deactivate(); /// clear temporary cash AttributePtr anAttribute = attribute(); @@ -261,31 +263,29 @@ void ModuleBase_WidgetSelector::deactivate() std::string aType = anAttribute->attributeType(); if (anAttribute->attributeType() == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); aSelectAttr->removeTemporaryValues(); - } - else if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttribute->attributeType() == + ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); aSelectAttr->removeTemporaryValues(); } } //******************************************************************** -bool ModuleBase_WidgetSelector::isWholeResultAllowed() const -{ +bool ModuleBase_WidgetSelector::isWholeResultAllowed() const { AttributePtr anAttribute = attribute(); if (anAttribute.get()) { AttributeSelectionListPtr aSelAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); if (aSelAttr.get()) return aSelAttr->isWholeResultAllowed(); } return false; } -bool getObjectFromGroup(ObjectPtr& theObject, GeomShapePtr& theShape) -{ +bool getObjectFromGroup(ObjectPtr &theObject, GeomShapePtr &theShape) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); AttributeSelectionListPtr anAttrList = aFeature->selectionList("group_list"); diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.h b/src/ModuleBase/ModuleBase_WidgetSelector.h index fe3eb2cfe..a94b8c64b 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetSelector.h @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetSelector_H #define ModuleBase_WidgetSelector_H #include "ModuleBase.h" -#include "ModuleBase_WidgetValidated.h" #include "ModuleBase_Definitions.h" +#include "ModuleBase_WidgetValidated.h" -#include -#include #include +#include +#include class Config_WidgetAPI; class QWidget; @@ -35,28 +36,30 @@ class ModuleBase_ViewerPrs; class ModelAPI_Result; /** -* \ingroup GUI -* Implementation of widget for selection. -* This abstract interface is designed to be used for shape/multi shape selector widgets. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetSelector : public ModuleBase_WidgetValidated -{ -Q_OBJECT - public: - + * \ingroup GUI + * Implementation of widget for selection. + * This abstract interface is designed to be used for shape/multi shape selector + * widgets. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetSelector + : public ModuleBase_WidgetValidated { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetSelector(); /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param [out] theModes a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param [out] theModes a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Defines if it is supposed that the widget should interact with the viewer. virtual bool isViewerSelector() { return true; } @@ -67,24 +70,28 @@ Q_OBJECT /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + isValidSelectionCustom(const std::shared_ptr &thePrs); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + setSelectionCustom(const std::shared_ptr &thePrs); /// The methiod called when widget is deactivated virtual void deactivate(); /// Return the attribute values wrapped in a list of viewer presentations - /// \return a list of viewer presentations, which contains an attribute result and - /// a shape. If the attribute do not uses the shape, it is empty - virtual QList> getAttributeSelection() const; + /// \return a list of viewer presentations, which contains an attribute result + /// and a shape. If the attribute do not uses the shape, it is empty + virtual QList> + getAttributeSelection() const; virtual bool isWholeResultAllowed() const; protected: - /// Returns true if envent is processed. The default implementation is empty, returns false. + /// Returns true if envent is processed. The default implementation is empty, + /// returns false. virtual bool processSelection(); /// Emits model changed info, updates the current control by selection change @@ -93,7 +100,7 @@ protected: /// Update focus after the attribute value change // NDS: has body is temporary - virtual void updateFocus() {}; + virtual void updateFocus(){}; /// Retunrs a list of possible shape types /// \return a list of shapes @@ -105,27 +112,26 @@ protected: /// Computes and updates name of selected object in the widget // NDS: has body is temporary - virtual void updateSelectionName() {}; + virtual void updateSelectionName(){}; /// The methiod called when widget is activated virtual void activateCustom(); /// Returns true if selected shape corresponds to requested shape types. - /// If the widget type of shapes contains the faces item, the result is converted - /// to construction result and the method returns true if there is at least one face - /// in the construction. - /// \param theShape a shape - /// \param theResult a selected result - bool acceptSubShape(const GeomShapePtr& theShape, - const std::shared_ptr& theResult) const; + /// If the widget type of shapes contains the faces item, the result is + /// converted to construction result and the method returns true if there is + /// at least one face in the construction. \param theShape a shape \param + /// theResult a selected result + bool acceptSubShape(const GeomShapePtr &theShape, + const std::shared_ptr &theResult) const; /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void getGeomSelection(const std::shared_ptr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape); + virtual void + getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape); protected: bool myIsPointsFiltering; diff --git a/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp b/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp index ede9e5e80..ad5dd9384 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp @@ -14,53 +14,49 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include +#include +#include #include -#include -#include #include +#include +#include ModuleBase_WidgetSelectorStore::ModuleBase_WidgetSelectorStore() -: myIsObject(false), mySelectionType(""), mySelectionCount(0) -{ -} + : myIsObject(false), mySelectionType(""), mySelectionCount(0) {} -void ModuleBase_WidgetSelectorStore::storeAttributeValue(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop) -{ +void ModuleBase_WidgetSelectorStore::storeAttributeValue( + const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop) { if (!theAttribute.get()) return; std::string aType = theAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); mySelectionType = aSelectionListAttr->selectionType(); mySelectionCount = aSelectionListAttr->size(); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); mySelectionCount = aRefListAttr->size(); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr aRefAttrListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); mySelectionCount = aRefAttrListAttr->size(); - } - else { + } else { myObject = ModuleBase_Tools::getObject(theAttribute); myShape = ModuleBase_Tools::getShape(theAttribute, theWorkshop); myRefAttribute = AttributePtr(); myIsObject = false; AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aRefAttr) { myIsObject = aRefAttr->isObject(); myRefAttribute = aRefAttr->attr(); @@ -69,39 +65,38 @@ void ModuleBase_WidgetSelectorStore::storeAttributeValue(const AttributePtr& the } //******************************************************************** -void ModuleBase_WidgetSelectorStore::restoreAttributeValue(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop) -{ +void ModuleBase_WidgetSelectorStore::restoreAttributeValue( + const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop) { std::string aType = theAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast( + theAttribute); aSelectionListAttr->setSelectionType(mySelectionType); - // restore selection in the attribute. Indeed there is only one stored object + // restore selection in the attribute. Indeed there is only one stored + // object int aCountAppened = aSelectionListAttr->size() - mySelectionCount; for (int i = 0; i < aCountAppened; i++) aSelectionListAttr->removeLast(); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { + } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); // restore objects in the attribute. Indeed there is only one stored object int aCountAppened = aRefListAttr->size() - mySelectionCount; for (int i = 0; i < aCountAppened; i++) aRefListAttr->removeLast(); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr aRefAttrListAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); // restore objects in the attribute. Indeed there is only one stored object int aCountAppened = aRefAttrListAttr->size() - mySelectionCount; for (int i = 0; i < aCountAppened; i++) aRefAttrListAttr->removeLast(); - } - else { - ModuleBase_Tools::setObject(theAttribute, myObject, myShape, theWorkshop, true, true); + } else { + ModuleBase_Tools::setObject(theAttribute, myObject, myShape, theWorkshop, + true, true); AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aRefAttr) { if (!myIsObject) aRefAttr->setAttr(myRefAttribute); diff --git a/src/ModuleBase/ModuleBase_WidgetSelectorStore.h b/src/ModuleBase/ModuleBase_WidgetSelectorStore.h index aea572189..979c63172 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectorStore.h +++ b/src/ModuleBase/ModuleBase_WidgetSelectorStore.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetSelectorStore_H @@ -22,21 +23,19 @@ #include "ModuleBase.h" -#include -#include #include +#include +#include class ModuleBase_IWorkshop; /** * \ingroup GUI - Provides for an attribute backup of values. + Provides for an attribute backup of values. It is possible to store/ restore the attribute values. */ -class ModuleBase_WidgetSelectorStore -{ - public: - +class ModuleBase_WidgetSelectorStore { +public: /// Constructor MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore(); /// Destructor @@ -45,21 +44,21 @@ class ModuleBase_WidgetSelectorStore /// Creates a backup of the current values of the attribute /// \param theAttribute a model attribute which parameters are to be stored /// \param theWorkshop a current workshop - MODULEBASE_EXPORT void storeAttributeValue(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop); + MODULEBASE_EXPORT void storeAttributeValue(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop); /// Creates a backup of the current values of the attribute /// \param theAttribute a model attribute which parameters are to be restored /// \param theWorkshop a current workshop - MODULEBASE_EXPORT void restoreAttributeValue(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop); + MODULEBASE_EXPORT void + restoreAttributeValue(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop); private: - /// backup parameters of the model attribute. The class processes three types of attribute: - /// Reference, RefAttr and Selection. - /// Depending on the attribute type, only the attribute parameter - /// values are reserved in the backup - /// An attribute object + /// backup parameters of the model attribute. The class processes three types + /// of attribute: Reference, RefAttr and Selection. Depending on the attribute + /// type, only the attribute parameter values are reserved in the backup An + /// attribute object ObjectPtr myObject; /// An attribute shape GeomShapePtr myShape; @@ -71,8 +70,8 @@ private: /// Variable of selection type std::string mySelectionType; /// Variable of GeomSelection - int mySelectionCount; // number of elements in the attribute selection list when store - + int mySelectionCount; // number of elements in the attribute selection list + // when store }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 28b74b0f0..4ebc3cd4c 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include +#include #include -#include #include +#include +#include #include -#include -#include #include -#include +#include #include #include @@ -35,40 +36,39 @@ #include #include +#include #include +#include +#include #include #include #include #include #include +#include #include -#include -#include #include #include -#include -#include #include -#include #include #include #include -#include #include +#include -#include -#include +#include +#include +#include +#include #include +#include #include -#include #include -#include -#include -#include -#include +#include +#include #include #include @@ -78,12 +78,11 @@ #include #include -ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetSelector(theParent, theWorkshop, theData) -{ - QFormLayout* aLayout = new QFormLayout(this); +ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetSelector(theParent, theWorkshop, theData) { + QFormLayout *aLayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aLayout); QString aLabelText = translate(theData->widgetLabel()); @@ -92,7 +91,6 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen if (!aLabelIcon.isEmpty()) myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); - QString aToolTip = translate(theData->widgetTooltip()); myTextLine = new QLineEdit(this); QString anObjName = QString::fromStdString(attributeID()); @@ -109,25 +107,22 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen } //******************************************************************** -ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector() -{ -} +ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector() {} //******************************************************************** -bool ModuleBase_WidgetShapeSelector::storeValueCustom() -{ +bool ModuleBase_WidgetShapeSelector::storeValueCustom() { // the value is stored on the selection changed signal processing return true; } //******************************************************************** -bool ModuleBase_WidgetShapeSelector::setSelection(QList& theValues, - const bool theToValidate) -{ +bool ModuleBase_WidgetShapeSelector::setSelection( + QList &theValues, const bool theToValidate) { if (theValues.empty()) { - // In order to make reselection possible, set empty object and shape should be done - setSelectionCustom(std::shared_ptr(new ModuleBase_ViewerPrs( - ObjectPtr(), GeomShapePtr(), NULL))); + // In order to make reselection possible, set empty object and shape should + // be done + setSelectionCustom(std::shared_ptr( + new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL))); return false; } // it removes the processed value from the parameters list @@ -138,32 +133,32 @@ bool ModuleBase_WidgetShapeSelector::setSelection(QList isDone = setSelectionCustom(aValue); // updateObject - to update/redisplay feature // it is commented in order to perfom it outside the method - //updateObject(myFeature); + // updateObject(myFeature); // to storeValue() - //emit valuesChanged(); + // emit valuesChanged(); } return isDone; } //******************************************************************** -QList ModuleBase_WidgetShapeSelector::getAttributeSelection() const -{ +QList +ModuleBase_WidgetShapeSelector::getAttributeSelection() const { QList aSelected; - if(myFeature) { + if (myFeature) { DataPtr aData = myFeature->data(); AttributePtr anAttribute = myFeature->attribute(attributeID()); ObjectPtr anObject = ModuleBase_Tools::getObject(anAttribute); std::shared_ptr aShapePtr = getShape(); - ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs(anObject, aShapePtr, NULL)); + ModuleBase_ViewerPrsPtr aPrs( + new ModuleBase_ViewerPrs(anObject, aShapePtr, NULL)); aSelected.append(aPrs); } return aSelected; } //******************************************************************** -bool ModuleBase_WidgetShapeSelector::restoreValueCustom() -{ +bool ModuleBase_WidgetShapeSelector::restoreValueCustom() { bool isBlocked = this->blockSignals(true); updateSelectionName(); this->blockSignals(isBlocked); @@ -172,31 +167,27 @@ bool ModuleBase_WidgetShapeSelector::restoreValueCustom() } //******************************************************************** -QList ModuleBase_WidgetShapeSelector::getControls() const -{ - QList aControls; +QList ModuleBase_WidgetShapeSelector::getControls() const { + QList aControls; aControls.append(myTextLine); return aControls; } -void ModuleBase_WidgetShapeSelector::updateFocus() -{ +void ModuleBase_WidgetShapeSelector::updateFocus() { emit focusOutWidget(this); } //******************************************************************** -QIntList ModuleBase_WidgetShapeSelector::shapeTypes() const -{ +QIntList ModuleBase_WidgetShapeSelector::shapeTypes() const { QIntList aShapeTypes; - foreach(QString aType, myShapeTypes) { + foreach (QString aType, myShapeTypes) { aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); } return aShapeTypes; } //******************************************************************** -GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const -{ +GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const { GeomShapePtr aShape; DataPtr aData = myFeature->data(); if (aData->isValid()) { @@ -207,8 +198,7 @@ GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const } //******************************************************************** -void ModuleBase_WidgetShapeSelector::updateSelectionName() -{ +void ModuleBase_WidgetShapeSelector::updateSelectionName() { DataPtr aData = myFeature->data(); if (!aData->isValid()) return; @@ -221,18 +211,19 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName() isNameUpdated = true; } if (!isNameUpdated) { - ObjectPtr anObject = ModuleBase_Tools::getObject(myFeature->attribute(attributeID())); + ObjectPtr anObject = + ModuleBase_Tools::getObject(myFeature->attribute(attributeID())); if (anObject.get() != NULL) { std::wstring aName = anObject->data()->name(); myTextLine->setText(QString::fromStdWString(aName)); } else { AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID()); if (aRefAttr && aRefAttr->attr().get() != NULL) { - //myIsObject = aRefAttr->isObject(); - std::wstring anAttrName = ModuleBase_Tools::generateName(aRefAttr->attr(), myWorkshop); + // myIsObject = aRefAttr->isObject(); + std::wstring anAttrName = + ModuleBase_Tools::generateName(aRefAttr->attr(), myWorkshop); myTextLine->setText(QString::fromStdWString(anAttrName)); - } - else { + } else { myTextLine->setText(translate(getDefaultValue())); } } @@ -240,7 +231,6 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName() } //******************************************************************** -bool ModuleBase_WidgetShapeSelector::isModified() const -{ +bool ModuleBase_WidgetShapeSelector::isModified() const { return !myTextLine->text().isEmpty(); -} \ No newline at end of file +} diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index 162aa72dd..9032157c2 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetShapeSelector_H #define ModuleBase_WidgetShapeSelector_H #include "ModuleBase.h" -#include "ModuleBase_WidgetSelector.h" #include "ModuleBase_ViewerFilters.h" +#include "ModuleBase_WidgetSelector.h" -#include -#include #include +#include +#include #include @@ -42,62 +43,64 @@ class ModuleBase_ViewerPrs; class ModelAPI_Validator; /** -* \ingroup GUI -* Implementation of widget for shapes selection. -* This type of widget can be defined in XML file with 'shape_selector' keyword. -* For example: -* \code -* -* \endcode -* It can use following parameters: -* - id - name of object attribute -* - label - content of widget's label -* - icon - icon which can be used instead label -* - tooltip - the witget's tooltip text -* - shape_types - list of shape types for selection. -* Possible values: face, vertex, wire, edge, shell, solid -* - object_types - types of selectable objects. -* For today it supports only one type "construction" -* which corresponds to ModelAPI_ResultConstruction object type -* - concealment - hide or not hide selected object after operation -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetShapeSelector : public ModuleBase_WidgetSelector -{ -Q_OBJECT - public: - + * \ingroup GUI + * Implementation of widget for shapes selection. + * This type of widget can be defined in XML file with 'shape_selector' keyword. + * For example: + * \code + * + * \endcode + * It can use following parameters: + * - id - name of object attribute + * - label - content of widget's label + * - icon - icon which can be used instead label + * - tooltip - the witget's tooltip text + * - shape_types - list of shape types for selection. + * Possible values: face, vertex, wire, edge, shell, solid + * - object_types - types of selectable objects. + * For today it supports only one type "construction" + * which corresponds to ModelAPI_ResultConstruction object type + * - concealment - hide or not hide selected object after operation + */ +class MODULEBASE_EXPORT ModuleBase_WidgetShapeSelector + : public ModuleBase_WidgetSelector { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetShapeSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetShapeSelector(); /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs - /// The method is called by the current operation to process the operation preselection. - /// It is redefined to check the value validity and if it is, fill the attribute with by value - /// \param theValues the wrapped selection values - /// \param theToValidate a flag on validation of the values - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + /// The method is called by the current operation to process the operation + /// preselection. It is redefined to check the value validity and if it is, + /// fill the attribute with by value \param theValues the wrapped selection + /// values \param theToValidate a flag on validation of the values + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Returns True if data of its feature was modified during operation virtual bool isModified() const; - protected: +protected: /// Saves the internal parameters to the given feature /// \return True in success virtual bool storeValueCustom(); @@ -114,22 +117,23 @@ Q_OBJECT /// \return a list of shapes virtual QIntList shapeTypes() const; - /// Get the shape from the attribute if the attribute contains a shape, e.g. selection attribute - /// \return a shape + /// Get the shape from the attribute if the attribute contains a shape, e.g. + /// selection attribute \return a shape virtual GeomShapePtr getShape() const; /// Return the attribute values wrapped in a list of viewer presentations - /// \return a list of viewer presentations, which contains an attribute result and - /// a shape. If the attribute do not uses the shape, it is empty - virtual QList> getAttributeSelection() const; + /// \return a list of viewer presentations, which contains an attribute result + /// and a shape. If the attribute do not uses the shape, it is empty + virtual QList> + getAttributeSelection() const; //----------- Class members ------------- - protected: +protected: /// Label of the widget - QLabel* myLabel; + QLabel *myLabel; /// Input control of the widget - QLineEdit* myTextLine; + QLineEdit *myTextLine; /// List of accepting shapes types QStringList myShapeTypes; diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp index e912ebc62..7da2ad00c 100644 --- a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp @@ -14,13 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include #include +#include #include #include @@ -28,13 +29,12 @@ #include #include -ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_PagedContainer(theParent, theData) -{ +ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_PagedContainer(theParent, theData) { myRemeberChoice = false; - QVBoxLayout* aMainLay = new QVBoxLayout(this); - //aMainLay->setContentsMargins(2, 4, 2, 2); + QVBoxLayout *aMainLay = new QVBoxLayout(this); + // aMainLay->setContentsMargins(2, 4, 2, 2); ModuleBase_Tools::adjustMargins(aMainLay); myCombo = new QComboBox(this); myCombo->hide(); @@ -43,41 +43,38 @@ ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* theParent, aMainLay->addLayout(myPagesLayout, 1); setLayout(aMainLay); - connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onPageChanged())); - connect(myCombo, SIGNAL(activated(int)), myPagesLayout, SLOT(setCurrentIndex(int))); + connect(myCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(onPageChanged())); + connect(myCombo, SIGNAL(activated(int)), myPagesLayout, + SLOT(setCurrentIndex(int))); } -ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() -{ -} +ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() {} - -int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase* thePage, const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip) -{ - ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); +int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase *thePage, + const QString &theName, + const QString &theCaseId, + const QPixmap &theIcon, + const QString &theTooltip) { + ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, + theTooltip); myCombo->addItem(translate(theName.toStdString())); int aResultCount = myCombo->count(); if (aResultCount == 2) myCombo->show(); - QFrame* aFrame = dynamic_cast(thePage); + QFrame *aFrame = dynamic_cast(thePage); aFrame->setFrameShape(QFrame::Box); aFrame->setFrameStyle(QFrame::Sunken); myPagesLayout->addWidget(aFrame); return aResultCount; } -int ModuleBase_WidgetSwitch::currentPageIndex() const -{ +int ModuleBase_WidgetSwitch::currentPageIndex() const { int aComboIndex = myCombo->currentIndex(); return aComboIndex; } - -void ModuleBase_WidgetSwitch::setCurrentPageIndex(int theIndex) -{ +void ModuleBase_WidgetSwitch::setCurrentPageIndex(int theIndex) { bool isComboSignalsBlocked = myCombo->blockSignals(true); bool isPagesLayoutSignalsBlocked = myPagesLayout->blockSignals(true); myCombo->setCurrentIndex(theIndex); diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.h b/src/ModuleBase/ModuleBase_WidgetSwitch.h index ad5a691ae..15f5b2ba3 100644 --- a/src/ModuleBase/ModuleBase_WidgetSwitch.h +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETSWITCH_H_ @@ -27,18 +28,19 @@ class QComboBox; class QStackedLayout; /** -* \ingroup GUI -* Implements a model widget for switch as a container widget. It can be defined in XML with "switch" keyword -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public ModuleBase_PagedContainer -{ + * \ingroup GUI + * Implements a model widget for switch as a container widget. It can be defined + * in XML with "switch" keyword + */ +class MODULEBASE_EXPORT ModuleBase_WidgetSwitch + : public ModuleBase_PagedContainer { Q_OBJECT - public: - /// Constructor +public: + /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetSwitch(QWidget* theParent, - const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetSwitch(QWidget *theParent, const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetSwitch(); /// Defines if it is supported to set the value in this widget @@ -50,24 +52,22 @@ class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public ModuleBase_PagedContain /// \param theName a name of page /// \param theCaseId an Id of the page /// \param theIcon an icon of the page - virtual int addPage( ModuleBase_PageBase* theWidget, - const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip); + virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip); - protected: - /// Returns index of the current page +protected: + /// Returns index of the current page virtual int currentPageIndex() const; /// Set current page by index /// \param index index of the page virtual void setCurrentPageIndex(int index); - private: +private: /// Combo box - QComboBox* myCombo; - QStackedLayout* myPagesLayout; + QComboBox *myCombo; + QStackedLayout *myPagesLayout; }; #endif /* ModuleBase_WidgetSwitch_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetToolbox.cpp b/src/ModuleBase/ModuleBase_WidgetToolbox.cpp index aca5ec4b6..69d4063ba 100644 --- a/src/ModuleBase/ModuleBase_WidgetToolbox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetToolbox.cpp @@ -14,44 +14,45 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include -#include +#include #include +#include +#include #include -#include +#include #include #include -#include +#include -ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_PagedContainer(theParent, theData) -{ - QVBoxLayout* aMainLayout = new QVBoxLayout(this); +ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_PagedContainer(theParent, theData) { + QVBoxLayout *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aMainLayout); bool aHasContainerParent = false; - QWidget* aParent = dynamic_cast(parent()); - while(aParent && !aHasContainerParent) { - ModuleBase_PagedContainer* aPagedContainer = dynamic_cast(aParent); + QWidget *aParent = dynamic_cast(parent()); + while (aParent && !aHasContainerParent) { + ModuleBase_PagedContainer *aPagedContainer = + dynamic_cast(aParent); aHasContainerParent = aPagedContainer; - aParent = dynamic_cast(aParent->parent()); + aParent = dynamic_cast(aParent->parent()); } myToolBox = new ModuleBase_ToolBox(this, aHasContainerParent); // Dark-grey rounded tabs with button-like border #and bold font // TODO: apply style to custom widget QString css = "QToolBox::tab{background-color:#c8c8c8;" - "border-radius:5px;" - "border:1px inset;" - //"font-weight:700;" - "border-color:#fff #505050 #505050 #fff;}"; + "border-radius:5px;" + "border:1px inset;" + //"font-weight:700;" + "border-color:#fff #505050 #505050 #fff;}"; myToolBox->setStyleSheet(css); // default vertical size policy is preferred aMainLayout->addWidget(myToolBox); @@ -59,32 +60,26 @@ ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent, connect(myToolBox, SIGNAL(currentChanged(int)), this, SLOT(onPageChanged())); } -ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() -{ -} +ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() {} -int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase* thePage, - const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip) -{ - ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); - QFrame* aFrame = dynamic_cast(thePage); - myToolBox->addItem(aFrame, translate(theName.toStdString()), theIcon ); +int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase *thePage, + const QString &theName, + const QString &theCaseId, + const QPixmap &theIcon, + const QString &theTooltip) { + ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, + theTooltip); + QFrame *aFrame = dynamic_cast(thePage); + myToolBox->addItem(aFrame, translate(theName.toStdString()), theIcon); return myToolBox->count(); } -int ModuleBase_WidgetToolbox::currentPageIndex() const -{ +int ModuleBase_WidgetToolbox::currentPageIndex() const { return myToolBox->currentIndex(); } -void ModuleBase_WidgetToolbox::setCurrentPageIndex(int theIndex) -{ +void ModuleBase_WidgetToolbox::setCurrentPageIndex(int theIndex) { bool isSignalsBlocked = myToolBox->blockSignals(true); myToolBox->setCurrentIndex(theIndex); myToolBox->blockSignals(isSignalsBlocked); } - - diff --git a/src/ModuleBase/ModuleBase_WidgetToolbox.h b/src/ModuleBase/ModuleBase_WidgetToolbox.h index 22f6a9724..8511f0d08 100644 --- a/src/ModuleBase/ModuleBase_WidgetToolbox.h +++ b/src/ModuleBase/ModuleBase_WidgetToolbox.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETTOOLBOX_H_ @@ -27,17 +28,19 @@ class ModuleBase_PageBase; class ModuleBase_ToolBox; /** -* \ingroup GUI -* Implements a model widget for switch as a container widget. It can be defined in XML with "toolbox" keyword -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetToolbox : public ModuleBase_PagedContainer -{ + * \ingroup GUI + * Implements a model widget for switch as a container widget. It can be defined + * in XML with "toolbox" keyword + */ +class MODULEBASE_EXPORT ModuleBase_WidgetToolbox + : public ModuleBase_PagedContainer { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuration. The attribute of the model widget is obtained from - ModuleBase_WidgetToolbox(QWidget* theParent, const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetToolbox(QWidget *theParent, const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetToolbox(); /// Defines if it is supported to set the value in this widget @@ -49,21 +52,19 @@ class MODULEBASE_EXPORT ModuleBase_WidgetToolbox : public ModuleBase_PagedContai /// \param theName a name of page /// \param theCaseId an Id of the page /// \param theIcon an icon of the page - virtual int addPage( ModuleBase_PageBase* theWidget, - const QString& theName, - const QString& theCaseId, - const QPixmap& theIcon, - const QString& theTooltip); + virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip); - protected: +protected: /// Implements ModuleBase_PagedContainer virtual int currentPageIndex() const; /// Implements ModuleBase_PagedContainer virtual void setCurrentPageIndex(int); - private: - ModuleBase_ToolBox* myToolBox; +private: + ModuleBase_ToolBox *myToolBox; }; #endif /* MODULEBASE_WIDGETTOOLBOX_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetUndoLabel.cpp b/src/ModuleBase/ModuleBase_WidgetUndoLabel.cpp index cde8d36e6..cd3d9f5b1 100644 --- a/src/ModuleBase/ModuleBase_WidgetUndoLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetUndoLabel.cpp @@ -14,32 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ModuleBase_WidgetUndoLabel.h" #include "ModuleBase_IWorkshop.h" -#include +#include #include +#include #include -#include -ModuleBase_WidgetUndoLabel::ModuleBase_WidgetUndoLabel(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) - : ModuleBase_WidgetLabel(theParent, theData), - myWorkshop(theWorkshop) -{ +ModuleBase_WidgetUndoLabel::ModuleBase_WidgetUndoLabel( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetLabel(theParent, theData), myWorkshop(theWorkshop) { myUndoBtn = new QPushButton(tr("Undo"), this); myUndoBtn->hide(); layout()->addWidget(myUndoBtn); connect(myUndoBtn, SIGNAL(clicked(bool)), SLOT(onUndo())); } - -bool ModuleBase_WidgetUndoLabel::restoreValueCustom() -{ +bool ModuleBase_WidgetUndoLabel::restoreValueCustom() { bool aRes = ModuleBase_WidgetLabel::restoreValueCustom(); bool aError = myLabel->text().length() > 0; myUndoBtn->setVisible(aError); @@ -47,8 +44,4 @@ bool ModuleBase_WidgetUndoLabel::restoreValueCustom() return aRes; } - -void ModuleBase_WidgetUndoLabel::onUndo() -{ - myWorkshop->undo(); -} \ No newline at end of file +void ModuleBase_WidgetUndoLabel::onUndo() { myWorkshop->undo(); } diff --git a/src/ModuleBase/ModuleBase_WidgetUndoLabel.h b/src/ModuleBase/ModuleBase_WidgetUndoLabel.h index 7af7c6d2e..5f2e8bbae 100644 --- a/src/ModuleBase/ModuleBase_WidgetUndoLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetUndoLabel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetUndoLabel_H @@ -27,18 +28,20 @@ class QPushButton; class ModuleBase_IWorkshop; /** -* \ingroup GUI -* Implementation of model widget for a label control -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetUndoLabel : public ModuleBase_WidgetLabel -{ + * \ingroup GUI + * Implementation of model widget for a label control + */ +class MODULEBASE_EXPORT ModuleBase_WidgetUndoLabel + : public ModuleBase_WidgetLabel { Q_OBJECT public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetUndoLabel(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetUndoLabel(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetUndoLabel() {} @@ -48,8 +51,8 @@ private slots: void onUndo(); private: - ModuleBase_IWorkshop* myWorkshop; - QPushButton* myUndoBtn; + ModuleBase_IWorkshop *myWorkshop; + QPushButton *myUndoBtn; }; -#endif \ No newline at end of file +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index c96959489..f0a0ecff7 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -14,29 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include -#include -#include #include #include -#include +#include +#include #include +#include +#include #include -#include -#include +#include #include #include +#include #include -#include +#include -#include #include +#include #include #include @@ -45,35 +46,29 @@ //#define DEBUG_VALID_STATE -ModuleBase_WidgetValidated::ModuleBase_WidgetValidated(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), - myWorkshop(theWorkshop), myIsInValidate(false) -{ +ModuleBase_WidgetValidated::ModuleBase_WidgetValidated( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), + myIsInValidate(false) { myAttributeStore = new ModuleBase_WidgetSelectorStore(); } -ModuleBase_WidgetValidated::~ModuleBase_WidgetValidated() -{ +ModuleBase_WidgetValidated::~ModuleBase_WidgetValidated() { delete myAttributeStore; } //******************************************************************** -ObjectPtr ModuleBase_WidgetValidated::findPresentedObject(const AISObjectPtr& theAIS) const -{ +ObjectPtr ModuleBase_WidgetValidated::findPresentedObject( + const AISObjectPtr &theAIS) const { return myPresentedObject; } //******************************************************************** -void ModuleBase_WidgetValidated::deactivate() -{ - clearValidatedCash(); -} +void ModuleBase_WidgetValidated::deactivate() { clearValidatedCash(); } //******************************************************************** -void ModuleBase_WidgetValidated::clearValidatedCash() -{ +void ModuleBase_WidgetValidated::clearValidatedCash() { #ifdef DEBUG_VALID_STATE qDebug("clearValidatedCash"); #endif @@ -82,25 +77,22 @@ void ModuleBase_WidgetValidated::clearValidatedCash() } //******************************************************************** -void ModuleBase_WidgetValidated::storeAttributeValue(const AttributePtr& theAttribute) -{ +void ModuleBase_WidgetValidated::storeAttributeValue( + const AttributePtr &theAttribute) { myIsInValidate = true; myAttributeStore->storeAttributeValue(theAttribute, myWorkshop); } //******************************************************************** -void ModuleBase_WidgetValidated::restoreAttributeValue(const AttributePtr& theAttribute, - const bool theValid) -{ +void ModuleBase_WidgetValidated::restoreAttributeValue( + const AttributePtr &theAttribute, const bool theValid) { myIsInValidate = false; myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop); } - //******************************************************************** -void ModuleBase_WidgetValidated::collectSubBodies(const ResultBodyPtr& theBody, - AIS_NListOfEntityOwner& theList) -{ +void ModuleBase_WidgetValidated::collectSubBodies( + const ResultBodyPtr &theBody, AIS_NListOfEntityOwner &theList) { AISObjectPtr aIOPtr; TopoDS_Shape aTDShape; int aNb = theBody->numberOfSubs(); @@ -112,64 +104,69 @@ void ModuleBase_WidgetValidated::collectSubBodies(const ResultBodyPtr& theBody, aTDShape = aSub->shape()->impl(); aIOPtr = myWorkshop->findPresentation(aSub); if (aIOPtr.get()) { - Handle(AIS_InteractiveObject) anIO = aIOPtr->impl(); + Handle(AIS_InteractiveObject) anIO = + aIOPtr->impl(); theList.Append(new StdSelect_BRepOwner(aTDShape, anIO)); - } - else + } else theList.Append(new StdSelect_BRepOwner(aTDShape)); } } } //******************************************************************** -bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetValidated::isValidInFilters( + const ModuleBase_ViewerPrsPtr &thePrs) { bool aValid = true; AIS_NListOfEntityOwner aOwnersList; if (!thePrs->owner().IsNull()) aOwnersList.Append(thePrs->owner()); // if an owner is null, the selection happens in the Object browser. - // creates a selection owner on the base of object shape and the object AIS object + // creates a selection owner on the base of object shape and the object AIS + // object if ((aOwnersList.Size() == 0) && thePrs->object().get()) { ResultPtr aResult = myWorkshop->selection()->getResult(thePrs); GeomShapePtr aShape = aResult.get() ? aResult->shape() : GeomShapePtr(); - // some results have no shape, e.g. the parameter one. So, they should not be validated + // some results have no shape, e.g. the parameter one. So, they should not + // be validated if (aShape.get()) { const TopoDS_Shape aTDShape = aShape->impl(); - Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); + Handle(AIS_InteractiveObject) anIO = + myWorkshop->selection()->getIO(thePrs); aOwnersList.Append(new StdSelect_BRepOwner(aTDShape, anIO)); myPresentedObject = aResult; - } - else { - //FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object()); - FeaturePtr aFeature = std::dynamic_pointer_cast(thePrs->object()); + } else { + // FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(thePrs->object()); if (aFeature.get()) { // Use feature as a reference to all its results myPresentedObject = aFeature; AttributePtr anAttr = attribute(); std::string aType = anAttr->attributeType(); - // Check that results of Feature is acceptable by filters for selection attribute + // Check that results of Feature is acceptable by filters for selection + // attribute if (aType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = - std::dynamic_pointer_cast(anAttr); + std::dynamic_pointer_cast(anAttr); aSelectAttr->setValue(myPresentedObject, GeomShapePtr(), true); GeomShapePtr aShapePtr = aSelectAttr->value(); if (!aShapePtr.get() && aSelectAttr->contextFeature().get() && - aSelectAttr->contextFeature()->firstResult().get()) { + aSelectAttr->contextFeature()->firstResult().get()) { aShapePtr = aSelectAttr->contextFeature()->firstResult()->shape(); } if (aShapePtr.get()) { const TopoDS_Shape aTDShape = aShapePtr->impl(); - Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); + Handle(AIS_InteractiveObject) anIO = + myWorkshop->selection()->getIO(thePrs); aOwnersList.Append(new StdSelect_BRepOwner(aTDShape, anIO)); } - } - else { + } else { ResultPtr aFirstRes = aFeature->firstResult(); if (aFirstRes.get()) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(aFirstRes); + ResultBodyPtr aBody = + std::dynamic_pointer_cast(aFirstRes); if (aBody.get() && (aBody->numberOfSubs() > 0)) collectSubBodies(aBody, aOwnersList); else { @@ -179,10 +176,9 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& AISObjectPtr aIOPtr = myWorkshop->findPresentation(aFirstRes); if (aIOPtr.get()) { Handle(AIS_InteractiveObject) anIO = - aIOPtr->impl(); + aIOPtr->impl(); aOwnersList.Append(new StdSelect_BRepOwner(aTDShape, anIO)); - } - else + } else aOwnersList.Append(new StdSelect_BRepOwner(aTDShape)); } } @@ -191,24 +187,29 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& } } } - aValid = (aOwnersList.Size() > 0); // only results with a shape can be filtered + aValid = + (aOwnersList.Size() > 0); // only results with a shape can be filtered // checks the owner by the AIS context activated filters if (aOwnersList.Size() > 0) { - // the widget validator filter should be active, but during check by preselection - // it is not yet activated, so we need to activate/deactivate it manually + // the widget validator filter should be active, but during check by + // preselection it is not yet activated, so we need to activate/deactivate + // it manually bool isActivated = isFilterActivated(); if (!isActivated) { - QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); + QIntList aModuleSelectionFilters = + myWorkshop->module()->selectionFilters(); SelectMgr_ListOfFilter aSelectionFilters; selectionFilters(aModuleSelectionFilters, aSelectionFilters); /// after validation, the selection filters should be restored - myWorkshop->selectionActivate()->activateSelectionFilters(aSelectionFilters); + myWorkshop->selectionActivate()->activateSelectionFilters( + aSelectionFilters); } - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + Handle(AIS_InteractiveContext) aContext = + myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { - const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + const SelectMgr_ListOfFilter &aFilters = aContext->Filters(); SelectMgr_ListIteratorOfListOfFilter anIt(aFilters); AIS_NListOfEntityOwner::Iterator aOIt; for (; anIt.More() && aValid; anIt.Next()) { @@ -239,7 +240,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& std::string aType = anAttr->attributeType(); if (aType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = - std::dynamic_pointer_cast(anAttr); + std::dynamic_pointer_cast(anAttr); aSelectAttr->removeTemporaryValues(); } } @@ -247,14 +248,13 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& } //******************************************************************** -AttributePtr ModuleBase_WidgetValidated::attribute() const -{ +AttributePtr ModuleBase_WidgetValidated::attribute() const { return myFeature->attribute(attributeID()); } //******************************************************************** -bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue) -{ +bool ModuleBase_WidgetValidated::isValidSelection( + const ModuleBase_ViewerPrsPtr &theValue) { bool aValid = false; if (getValidState(theValue, aValid)) { return aValid; @@ -269,15 +269,15 @@ bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrsPtr& //******************************************************************** bool ModuleBase_WidgetValidated::isValidSelectionForAttribute( - const ModuleBase_ViewerPrsPtr& theValue, - const AttributePtr& theAttribute) -{ + const ModuleBase_ViewerPrsPtr &theValue, const AttributePtr &theAttribute) { bool aValid = false; // stores the current values of the widget attribute - bool isFlushesActived, isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked; + bool isFlushesActived, isAttributeSetInitializedBlocked, + isAttributeSendUpdatedBlocked; - blockAttribute(theAttribute, true, isFlushesActived, isAttributeSetInitializedBlocked, + blockAttribute(theAttribute, true, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); storeAttributeValue(theAttribute); @@ -291,18 +291,22 @@ bool ModuleBase_WidgetValidated::isValidSelectionForAttribute( // restores the current values of the widget attribute restoreAttributeValue(theAttribute, aValid); - blockAttribute(theAttribute, false, isFlushesActived, isAttributeSetInitializedBlocked, + blockAttribute(theAttribute, false, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); - /// NDS: The following rows are commented for issue #1452 (to be removed after debug) - /// This is not correct to perform it here because it might cause update selection and - /// the selection mechanizm will be circled: use the scenario of the bug with preselected point. - // In particular case the results are deleted and called as redisplayed inside of this - // highlight-selection, to they must be flushed as soon as possible. - // Example: selection of group-vertices subshapes with shift pressend on body. Without - // these 4 lines below the application crashes because of left presentations on - // removed results still in the viewer. - /*static Events_ID aDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); - static Events_ID aRedispEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + /// NDS: The following rows are commented for issue #1452 (to be removed after + /// debug) This is not correct to perform it here because it might cause + /// update selection and the selection mechanizm will be circled: use the + /// scenario of the bug with preselected point. + // In particular case the results are deleted and called as redisplayed inside + // of this highlight-selection, to they must be flushed as soon as possible. + // Example: selection of group-vertices subshapes with shift pressend on body. + // Without + // these 4 lines below the application crashes because of left presentations + // on removed results still in the viewer. + /*static Events_ID aDeletedEvent = + Events_Loop::eventByName(EVENT_OBJECT_DELETED); static Events_ID aRedispEvent + = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); Events_Loop::loop()->flush(aDeletedEvent); Events_Loop::loop()->flush(aRedispEvent); */ @@ -310,67 +314,63 @@ bool ModuleBase_WidgetValidated::isValidSelectionForAttribute( } //******************************************************************** -bool ModuleBase_WidgetValidated::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool ModuleBase_WidgetValidated::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { return true; } //******************************************************************** -bool ModuleBase_WidgetValidated::isValidAttribute(const AttributePtr& theAttribute) -{ +bool ModuleBase_WidgetValidated::isValidAttribute( + const AttributePtr &theAttribute) { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); std::string aValidatorID; Events_InfoMessage anError; return aFactory->validate(theAttribute, aValidatorID, anError); } //******************************************************************** -bool ModuleBase_WidgetValidated::isFilterActivated() const -{ +bool ModuleBase_WidgetValidated::isFilterActivated() const { Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter(); - ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->viewer(); return aViewer->hasSelectionFilter(aSelFilter); } //******************************************************************** -void ModuleBase_WidgetValidated::selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters) -{ +void ModuleBase_WidgetValidated::selectionFilters( + QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) { theSelectionFilters.Append(myWorkshop->validatorFilter()); } //******************************************************************** -void ModuleBase_WidgetValidated::blockAttribute(const AttributePtr& theAttribute, - const bool& theToBlock, - bool& isFlushesActived, - bool& isAttributeSetInitializedBlocked, - bool& isAttributeSendUpdatedBlocked) -{ +void ModuleBase_WidgetValidated::blockAttribute( + const AttributePtr &theAttribute, const bool &theToBlock, + bool &isFlushesActived, bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked) { blockFeatureAttribute(theAttribute, myFeature, theToBlock, isFlushesActived, - isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); + isAttributeSetInitializedBlocked, + isAttributeSendUpdatedBlocked); } //******************************************************************** -void ModuleBase_WidgetValidated::blockFeatureAttribute(const AttributePtr& theAttribute, - const FeaturePtr& theFeature, - const bool& theToBlock, - bool& isFlushesActived, - bool& isAttributeSetInitializedBlocked, - bool& isAttributeSendUpdatedBlocked) -{ - Events_Loop* aLoop = Events_Loop::loop(); +void ModuleBase_WidgetValidated::blockFeatureAttribute( + const AttributePtr &theAttribute, const FeaturePtr &theFeature, + const bool &theToBlock, bool &isFlushesActived, + bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked) { + Events_Loop *aLoop = Events_Loop::loop(); DataPtr aData = theFeature->data(); if (theToBlock) { - // blocks the flush signals to avoid the temporary objects visualization in the viewer - // they should not be shown in order to do not lose highlight by erasing them + // blocks the flush signals to avoid the temporary objects visualization in + // the viewer they should not be shown in order to do not lose highlight by + // erasing them isFlushesActived = aLoop->activateFlushes(false); isAttributeSendUpdatedBlocked = aData->blockSendAttributeUpdated(true); isAttributeSetInitializedBlocked = theAttribute->blockSetInitialized(true); - } - else { + } else { aData->blockSendAttributeUpdated(isAttributeSendUpdatedBlocked, false); theAttribute->blockSetInitialized(isAttributeSetInitializedBlocked); aLoop->activateFlushes(isFlushesActived); @@ -378,55 +378,59 @@ void ModuleBase_WidgetValidated::blockFeatureAttribute(const AttributePtr& theAt } //******************************************************************** -void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue, - const bool theValid) -{ +void ModuleBase_WidgetValidated::storeValidState( + const ModuleBase_ViewerPrsPtr &theValue, const bool theValid) { GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr(); if (aShape.get()) { if (theValid) { - const TopoDS_Shape& aTDShape = aShape->impl(); - bool aValidPrsContains = myValidPrs.IsBound(aTDShape) && - theValue.get()->isEqual(myValidPrs.Find(aTDShape).get()); + const TopoDS_Shape &aTDShape = aShape->impl(); + bool aValidPrsContains = + myValidPrs.IsBound(aTDShape) && + theValue.get()->isEqual(myValidPrs.Find(aTDShape).get()); if (!aValidPrsContains) { - #ifdef LIST_OF_VALID_PRS +#ifdef LIST_OF_VALID_PRS myValidPrs.append(theValue); - #else +#else myValidPrs.Bind(aTDShape, theValue); - #endif - // the commented code will be useful when the valid state of the presentation - // will be changable between activate/deactivate. Currently it does not happen. - //if (anInvalidPrs) - // myInvalidPrs.removeOne(theValue); +#endif + // the commented code will be useful when the valid state of the + // presentation will be changable between activate/deactivate. Currently + // it does not happen. + // if (anInvalidPrs) + // myInvalidPrs.removeOne(theValue); } - } - else { // !theValid + } else { // !theValid if (aShape.get()) { - const TopoDS_Shape& aTDShape = aShape->impl(); - bool anIValidPrsContains = myInvalidPrs.IsBound(aTDShape) && - theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get()); + const TopoDS_Shape &aTDShape = aShape->impl(); + bool anIValidPrsContains = + myInvalidPrs.IsBound(aTDShape) && + theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get()); if (!anIValidPrsContains) { - #ifdef LIST_OF_VALID_PRS +#ifdef LIST_OF_VALID_PRS myInvalidPrs.append(theValue); - #else +#else myInvalidPrs.Bind(aTDShape, theValue); - #endif - //if (!aValidPrs) - // myValidPrs.removeOne(theValue); +#endif + // if (!aValidPrs) + // myValidPrs.removeOne(theValue); } } } } - #ifdef DEBUG_VALID_STATE - qDebug(QString("storeValidState: myValidPrs.size() = %1, myInvalidPrs.size() = %2") - .arg(myValidPrs.count()) - .arg(myInvalidPrs.count()).toStdString().c_str()); - #endif +#ifdef DEBUG_VALID_STATE + qDebug( + QString( + "storeValidState: myValidPrs.size() = %1, myInvalidPrs.size() = %2") + .arg(myValidPrs.count()) + .arg(myInvalidPrs.count()) + .toStdString() + .c_str()); +#endif } //******************************************************************** -bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& theValue, - bool& theValid) -{ +bool ModuleBase_WidgetValidated::getValidState( + const ModuleBase_ViewerPrsPtr &theValue, bool &theValid) { if (!theValue.get()) return false; @@ -438,12 +442,14 @@ bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& th if (!aShape.get()) return false; - const TopoDS_Shape& aTDShape = aShape->impl(); - bool aValidPrsContains = myValidPrs.IsBound(aTDShape) && - theValue.get()->isEqual(myValidPrs.Find(aTDShape).get()); + const TopoDS_Shape &aTDShape = aShape->impl(); + bool aValidPrsContains = + myValidPrs.IsBound(aTDShape) && + theValue.get()->isEqual(myValidPrs.Find(aTDShape).get()); - bool anInvalidPrsContains = myInvalidPrs.IsBound(aTDShape) && - theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get()); + bool anInvalidPrsContains = + myInvalidPrs.IsBound(aTDShape) && + theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get()); /* bool aValidPrsContains = false, anInvalidPrsContains = false; GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr(); @@ -466,13 +472,13 @@ bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& th } //******************************************************************** -QList ModuleBase_WidgetValidated::getFilteredSelected() -{ - QList aSelected = myWorkshop->selection()->getSelected( - ModuleBase_ISelection::Viewer); +QList +ModuleBase_WidgetValidated::getFilteredSelected() { + QList aSelected = + myWorkshop->selection()->getSelected(ModuleBase_ISelection::Viewer); - QList anOBSelected = myWorkshop->selection()->getSelected( - ModuleBase_ISelection::Browser); + QList anOBSelected = + myWorkshop->selection()->getSelected(ModuleBase_ISelection::Browser); // filter the OB presentations filterPresentations(anOBSelected); if (!anOBSelected.isEmpty()) @@ -484,10 +490,10 @@ QList ModuleBase_WidgetValidated::getFilteredSelected() } //******************************************************************** -void ModuleBase_WidgetValidated::filterPresentations(QList& theValues) -{ +void ModuleBase_WidgetValidated::filterPresentations( + QList &theValues) { QList aValidatedValues; - foreach(ModuleBase_ViewerPrsPtr aPrs, theValues) { + foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) { if (isValidInFilters(aPrs)) aValidatedValues.append(aPrs); } @@ -498,26 +504,32 @@ void ModuleBase_WidgetValidated::filterPresentations(QList& theValues) -{ - std::set aFilterOut; // all objects that must be filtered out with their children +void ModuleBase_WidgetValidated::filterCompSolids( + QList &theValues) { + std::set + aFilterOut; // all objects that must be filtered out with their children QList aValidatedValues; // Collect compsolids. - QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); - for(; anIt != aLast; anIt++) { - const ModuleBase_ViewerPrsPtr& aViewerPrs = *anIt; + QList::const_iterator anIt = theValues.begin(), + aLast = theValues.end(); + for (; anIt != aLast; anIt++) { + const ModuleBase_ViewerPrsPtr &aViewerPrs = *anIt; ObjectPtr anObject = aViewerPrs->object(); ResultBodyPtr aResultCompSolid = - std::dynamic_pointer_cast(anObject); + std::dynamic_pointer_cast(anObject); if (aResultCompSolid.get()) { - for(int aSubIndex = 0; aSubIndex < aResultCompSolid->numberOfSubs(); aSubIndex++) + for (int aSubIndex = 0; aSubIndex < aResultCompSolid->numberOfSubs(); + aSubIndex++) aFilterOut.insert(aResultCompSolid->subResult(aSubIndex)); - } else { // it could be a whole feature selected, so, add all results of this feature - FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); + } else { // it could be a whole feature selected, so, add all results of + // this feature + FeaturePtr aFeature = + std::dynamic_pointer_cast(anObject); if (aFeature.get()) { - std::list::const_iterator aRes = aFeature->results().cbegin(); - for(; aRes != aFeature->results().cend(); aRes++) + std::list::const_iterator aRes = + aFeature->results().cbegin(); + for (; aRes != aFeature->results().cend(); aRes++) aFilterOut.insert(*aRes); } } @@ -525,12 +537,13 @@ void ModuleBase_WidgetValidated::filterCompSolids(QList // Filter sub-solids of compsolids. anIt = theValues.begin(); - for(; anIt != aLast; anIt++) { - const ModuleBase_ViewerPrsPtr& aViewerPrs = *anIt; + for (; anIt != aLast; anIt++) { + const ModuleBase_ViewerPrsPtr &aViewerPrs = *anIt; ObjectPtr anObject = aViewerPrs->object(); ResultPtr aResult = std::dynamic_pointer_cast(anObject); - while(aResult.get()) { - if (aFilterOut.find(aResult) != aFilterOut.end()) // skip if parent is filtered out + while (aResult.get()) { + if (aFilterOut.find(aResult) != + aFilterOut.end()) // skip if parent is filtered out break; aResult = ModelAPI_Tools::bodyOwner(aResult); // iterate all parents } diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index 0fe4c328d..901790782 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef MODULEBASE_WIDGETVALIDATED_H_ @@ -23,16 +24,16 @@ #include #include -#include #include -#include +#include #include +#include #include -#include +#include #include +#include #include -#include #include #include @@ -47,32 +48,35 @@ class Config_WidgetAPI; //#define LIST_OF_VALID_PRS /** -* \ingroup GUI -* Implementation of widget with validators and filters processing. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidget -{ + * \ingroup GUI + * Implementation of widget with validators and filters processing. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetValidated + : public ModuleBase_ModelWidget { Q_OBJECT - public: +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop a reference to workshop - /// \param theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetValidated(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + ModuleBase_WidgetValidated(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~ModuleBase_WidgetValidated(); - /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating, - /// next, the attribute's validating. It trying on the give selection to current attribute by - /// setting the value inside and calling validators. After this, the previous attribute value is + /// Checks all widget validator if the owner is valid. Firstly it checks + /// custom widget validating, next, the attribute's validating. It trying on + /// the give selection to current attribute by setting the value inside and + /// calling validators. After this, the previous attribute value is /// restored.The valid/invalid value is cashed. /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelection(const std::shared_ptr& theValue); + virtual bool + isValidSelection(const std::shared_ptr &theValue); //! Returns data object by AIS - ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const; + ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const; /// The method called when widget is deactivated virtual void deactivate(); @@ -85,46 +89,47 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg bool isFilterActivated() const; /// Appends into container of workshop selection filters - /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes - /// \param [out] selection filters - virtual void selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters); + /// \param [out] theModuleSelectionFilters module additional modes, -1 means + /// all default modes \param [out] selection filters + virtual void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters); /// Block the model flush of update and intialization of attribute /// \param theAttribute an attribute of blocking /// \param theFeature a feature /// \param theToBlock flag whether the model is blocked or unblocked - /// \param isFlushesActived out value if model is blocked, in value if model is unblocked - /// to be used to restore flush state when unblocked - /// \param isAttributeSetInitializedBlocked out value if model is blocked - /// in value if model is unblocked to be used to restore previous state when unblocked + /// \param isFlushesActived out value if model is blocked, in value if model + /// is unblocked to be used to restore flush state when unblocked \param + /// isAttributeSetInitializedBlocked out value if model is blocked in value if + /// model is unblocked to be used to restore previous state when unblocked /// \param isAttributeSendUpdatedBlocked out value if model signal is blocked - static void blockFeatureAttribute(const AttributePtr& theAttribute, - const FeaturePtr& theFeature, - const bool& theToBlock, - bool& isFlushesActived, - bool& isAttributeSetInitializedBlocked, - bool& isAttributeSendUpdatedBlocked); + static void blockFeatureAttribute(const AttributePtr &theAttribute, + const FeaturePtr &theFeature, + const bool &theToBlock, + bool &isFlushesActived, + bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked); /// Checks the current attibute in all attribute validators /// \param theAttribute an attribute to be validated /// \return true if all validators return that the attribute is valid - static bool isValidAttribute(const AttributePtr& theAttribute); + static bool isValidAttribute(const AttributePtr &theAttribute); protected: /// Checks whether all active viewer filters validate the presentation /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidInFilters(const std::shared_ptr& thePrs); - - /// Checks all attribute validators returns valid. It tries on the given selection - /// to current attribute by setting the value inside and calling validators. After this, - /// the previous attribute value is restored.The valid/invalid value is cashed. - /// \param theValue a selected presentation in the view - /// \param theAttribute the attribute - /// \return a boolean value - bool isValidSelectionForAttribute(const std::shared_ptr& theValue, - const AttributePtr& theAttribute); + virtual bool + isValidInFilters(const std::shared_ptr &thePrs); + + /// Checks all attribute validators returns valid. It tries on the given + /// selection to current attribute by setting the value inside and calling + /// validators. After this, the previous attribute value is restored.The + /// valid/invalid value is cashed. \param theValue a selected presentation in + /// the view \param theAttribute the attribute \return a boolean value + bool isValidSelectionForAttribute( + const std::shared_ptr &theValue, + const AttributePtr &theAttribute); /// Retunrs attribute, which should be validated. In default implementation, /// this is an attribute of ID @@ -135,68 +140,77 @@ protected: /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be stored - virtual void storeAttributeValue(const AttributePtr& theAttribute); + virtual void storeAttributeValue(const AttributePtr &theAttribute); /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be restored /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); + virtual void restoreAttributeValue(const AttributePtr &theAttribute, + const bool theValid); /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + isValidSelectionCustom(const std::shared_ptr &thePrs); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const std::shared_ptr& thePrs) = 0; + virtual bool + setSelectionCustom(const std::shared_ptr &thePrs) = 0; /// Returns a list of selected presentations in the viewer and object browser - /// The presentations from the object browser are filtered by the AIS context filters - /// \return a list of presentations + /// The presentations from the object browser are filtered by the AIS context + /// filters \return a list of presentations QList> getFilteredSelected(); /// Block the model flush of update and intialization of attribute /// \param theAttribute an attribute of blocking /// \param theToBlock flag whether the model is blocked or unblocked - /// \param isFlushesActived out value if model is blocked, in value if model is unblocked - /// to be used to restore flush state when unblocked - /// \param isAttributeSetInitializedBlocked out value if model is blocked - /// in value if model is unblocked to be used to restore previous state when unblocked + /// \param isFlushesActived out value if model is blocked, in value if model + /// is unblocked to be used to restore flush state when unblocked \param + /// isAttributeSetInitializedBlocked out value if model is blocked in value if + /// model is unblocked to be used to restore previous state when unblocked /// \param isAttributeSendUpdatedBlocked out value if model signal is blocked - virtual void blockAttribute(const AttributePtr& theAttribute, const bool& theToBlock, - bool& isFlushesActived, bool& isAttributeSetInitializedBlocked, - bool& isAttributeSendUpdatedBlocked); + virtual void blockAttribute(const AttributePtr &theAttribute, + const bool &theToBlock, bool &isFlushesActived, + bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked); protected: /// Gets the validity state of the presentation in an internal map. /// Returns true if the valid state of value is stored /// \param theValue a viewer presentation /// \param theValid a valid state - bool getValidState(const std::shared_ptr& theValue, bool& theValid); + bool getValidState(const std::shared_ptr &theValue, + bool &theValid); /// Store the validity state of the presentation in an internal map /// \param theValue a viewer presentation /// \param theValid a valid state - void storeValidState(const std::shared_ptr& theValue, const bool theValid); + void storeValidState(const std::shared_ptr &theValue, + const bool theValid); private: - /// Applies AIS context filters to the parameter list. The not approved presentations are - /// removed from the parameters. - /// \param theValues a list of presentations. - void filterPresentations(QList>& theValues); + /// Applies AIS context filters to the parameter list. The not approved + /// presentations are removed from the parameters. \param theValues a list of + /// presentations. + void + filterPresentations(QList> &theValues); /// Remove subshapes of compsolids if whole compsolid is present. /// \param theValues a list of presentations. - void filterCompSolids(QList>& theValues); + void + filterCompSolids(QList> &theValues); - void collectSubBodies(const ResultBodyPtr& theBody, AIS_NListOfEntityOwner& theList); + void collectSubBodies(const ResultBodyPtr &theBody, + AIS_NListOfEntityOwner &theList); protected: /// Reference to workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; /// The widget is in validation mode: store is performed, restore is not bool myIsInValidate; @@ -209,13 +223,16 @@ private: /// cash of invalid selection presentations QList> myInvalidPrs; #else - // assume that one presentation selection presentation corresponds only one shape - NCollection_DataMap > myValidPrs; - NCollection_DataMap > myInvalidPrs; + // assume that one presentation selection presentation corresponds only one + // shape + NCollection_DataMap> + myValidPrs; + NCollection_DataMap> + myInvalidPrs; #endif /// store to backup parameters of the model - ModuleBase_WidgetSelectorStore* myAttributeStore; + ModuleBase_WidgetSelectorStore *myAttributeStore; }; #endif /* MODULEBASE_WIDGETVALIDATED_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetValidator.cpp b/src/ModuleBase/ModuleBase_WidgetValidator.cpp index 196c1ba0b..d8db0faf1 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidator.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidator.cpp @@ -14,40 +14,40 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include -#include -#include #include #include +#include +#include -ModuleBase_WidgetValidator::ModuleBase_WidgetValidator(ModuleBase_ModelWidget* theModelWidget, - ModuleBase_IWorkshop* theWorkshop) - : myIsInValidate(false), myModelWidget(theModelWidget), myWorkshop(theWorkshop) -{ +ModuleBase_WidgetValidator::ModuleBase_WidgetValidator( + ModuleBase_ModelWidget *theModelWidget, ModuleBase_IWorkshop *theWorkshop) + : myIsInValidate(false), myModelWidget(theModelWidget), + myWorkshop(theWorkshop) { myAttributeStore = new ModuleBase_WidgetSelectorStore(); } -ModuleBase_WidgetValidator::~ModuleBase_WidgetValidator() -{ +ModuleBase_WidgetValidator::~ModuleBase_WidgetValidator() { delete myAttributeStore; } //******************************************************************** -void ModuleBase_WidgetValidator::selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters) -{ +void ModuleBase_WidgetValidator::selectionFilters( + QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) { theSelectionFilters.Append(myWorkshop->validatorFilter()); } //******************************************************************** -bool ModuleBase_WidgetValidator::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue) -{ +bool ModuleBase_WidgetValidator::isValidSelection( + const ModuleBase_ViewerPrsPtr &theValue) { bool aValid = false; if (getValidState(theValue, aValid)) return aValid; @@ -58,41 +58,37 @@ bool ModuleBase_WidgetValidator::isValidSelection(const ModuleBase_ViewerPrsPtr& return aValid; } -void ModuleBase_WidgetValidator::storeAttributeValue(const AttributePtr& theAttribute) -{ +void ModuleBase_WidgetValidator::storeAttributeValue( + const AttributePtr &theAttribute) { myIsInValidate = true; myAttributeStore->storeAttributeValue(theAttribute, myWorkshop); } -void ModuleBase_WidgetValidator::restoreAttributeValue(const AttributePtr& theAttribute, - const bool theValid) -{ +void ModuleBase_WidgetValidator::restoreAttributeValue( + const AttributePtr &theAttribute, const bool theValid) { myIsInValidate = false; myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop); } -bool ModuleBase_WidgetValidator::isValidAttribute(const AttributePtr& theAttribute) const -{ +bool ModuleBase_WidgetValidator::isValidAttribute( + const AttributePtr &theAttribute) const { return ModuleBase_WidgetValidated::isValidAttribute(theAttribute); } -bool ModuleBase_WidgetValidator::isFilterActivated() const -{ +bool ModuleBase_WidgetValidator::isFilterActivated() const { Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter(); - ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->viewer(); return aViewer->hasSelectionFilter(aSelFilter); } -void ModuleBase_WidgetValidator::clearValidatedCash() -{ +void ModuleBase_WidgetValidator::clearValidatedCash() { myValidPrs.clear(); myInvalidPrs.clear(); } -bool ModuleBase_WidgetValidator::getValidState(const ModuleBase_ViewerPrsPtr& theValue, - bool& theValid) -{ +bool ModuleBase_WidgetValidator::getValidState( + const ModuleBase_ViewerPrsPtr &theValue, bool &theValid) { bool aValidPrs = myValidPrs.contains(theValue); bool anInvalidPrs = myInvalidPrs.contains(theValue); @@ -105,29 +101,32 @@ bool ModuleBase_WidgetValidator::getValidState(const ModuleBase_ViewerPrsPtr& th } //******************************************************************** -void ModuleBase_WidgetValidator::storeValidState(const ModuleBase_ViewerPrsPtr& theValue, - const bool theValid) -{ +void ModuleBase_WidgetValidator::storeValidState( + const ModuleBase_ViewerPrsPtr &theValue, const bool theValid) { bool aValidPrs = myInvalidPrs.contains(theValue); bool anInvalidPrs = myInvalidPrs.contains(theValue); if (theValid) { if (!aValidPrs) myValidPrs.append(theValue); - // the commented code will be useful when the valid state of the presentation - // will be changable between activate/deactivate. Currently it does not happen. - //if (anInvalidPrs) + // the commented code will be useful when the valid state of the + // presentation will be changable between activate/deactivate. Currently it + // does not happen. + // if (anInvalidPrs) // myInvalidPrs.removeOne(theValue); - } - else { // !theValid + } else { // !theValid if (!anInvalidPrs) myInvalidPrs.append(theValue); - //if (!aValidPrs) - // myValidPrs.removeOne(theValue); + // if (!aValidPrs) + // myValidPrs.removeOne(theValue); } #ifdef DEBUG_VALID_STATE - qDebug(QString("storeValidState: myValidPrs.size() = %1, myInvalidPrs.size() = %2") - .arg(myValidPrs.count()) - .arg(myInvalidPrs.count()).toStdString().c_str()); + qDebug( + QString( + "storeValidState: myValidPrs.size() = %1, myInvalidPrs.size() = %2") + .arg(myValidPrs.count()) + .arg(myInvalidPrs.count()) + .toStdString() + .c_str()); #endif } diff --git a/src/ModuleBase/ModuleBase_WidgetValidator.h b/src/ModuleBase/ModuleBase_WidgetValidator.h index ae6615948..89d950ae0 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidator.h +++ b/src/ModuleBase/ModuleBase_WidgetValidator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ModuleBase_WidgetValidator_H_ @@ -37,59 +38,64 @@ class ModuleBase_ViewerPrs; class ModuleBase_WidgetSelectorStore; /** -* \ingroup GUI -* Implementation of widget with validators and filters processing. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetValidator -{ - public: + * \ingroup GUI + * Implementation of widget with validators and filters processing. + */ +class MODULEBASE_EXPORT ModuleBase_WidgetValidator { +public: /// Constructor /// \param theModelWidget the model widget to be validated /// \param theWorkshop the current workshop - ModuleBase_WidgetValidator(ModuleBase_ModelWidget* theModelWidget, - ModuleBase_IWorkshop* theWorkshop); + ModuleBase_WidgetValidator(ModuleBase_ModelWidget *theModelWidget, + ModuleBase_IWorkshop *theWorkshop); virtual ~ModuleBase_WidgetValidator(); /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param theModes [out] a container of modes - virtual void selectionModes(int& /*theModuleSelectionModes*/, QIntList& /*theModes*/) {} + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param theModes [out] a container of modes + virtual void selectionModes(int & /*theModuleSelectionModes*/, + QIntList & /*theModes*/) {} /// Appends into container of workshop selection filters - /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes - /// \param [out] selection filters - virtual void selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters); + /// \param [out] theModuleSelectionFilters module additional modes, -1 means + /// all default modes \param [out] selection filters + virtual void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters); /// Returns true if the validation is activated bool isInValidate() const { return myIsInValidate; } - /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating, - /// next, the attribute's validating. It trying on the give selection to current attribute by - /// setting the value inside and calling validators. After this, the previous attribute value is + /// Checks all widget validator if the owner is valid. Firstly it checks + /// custom widget validating, next, the attribute's validating. It trying on + /// the give selection to current attribute by setting the value inside and + /// calling validators. After this, the previous attribute value is /// restored.The valid/invalid value is cashed. /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelection(const std::shared_ptr& theValue); + virtual bool + isValidSelection(const std::shared_ptr &theValue); - /// Creates a backup of the current values of the attribute + /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be stored - virtual void storeAttributeValue(const std::shared_ptr& theAttribute); + virtual void + storeAttributeValue(const std::shared_ptr &theAttribute); /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be restored /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const std::shared_ptr& theAttribute, - const bool theValid); + virtual void + restoreAttributeValue(const std::shared_ptr &theAttribute, + const bool theValid); /// Checks the current attibute in all attribute validators /// \param theAttribute an attribute to be validated /// \return true if all validators return that the attribute is valid - bool isValidAttribute(const std::shared_ptr& theAttribute) const; + bool isValidAttribute( + const std::shared_ptr &theAttribute) const; //! Clear all validated cash in the widget void clearValidatedCash(); @@ -103,19 +109,22 @@ private: /// Returns true if the valid state of value is stored /// \param theValue a viewer presentation /// \param theValid a valid state - bool getValidState(const std::shared_ptr& theValue, bool& theValid); + bool getValidState(const std::shared_ptr &theValue, + bool &theValid); /// Store the validity state of the presentation in an internal map /// \param theValue a viewer presentation /// \param theValid a valid state - void storeValidState(const std::shared_ptr& theValue, const bool theValid); + void storeValidState(const std::shared_ptr &theValue, + const bool theValid); protected: bool myIsInValidate; ///< cashed if the value is processed in validation /// Reference to workshop - ModuleBase_ModelWidget* myModelWidget; ///< the current widget to be validated - ModuleBase_IWorkshop* myWorkshop; ///< the active workshop - ModuleBase_WidgetSelectorStore* myAttributeStore; ///< store/restore attribute values + ModuleBase_ModelWidget *myModelWidget; ///< the current widget to be validated + ModuleBase_IWorkshop *myWorkshop; ///< the active workshop + ModuleBase_WidgetSelectorStore + *myAttributeStore; ///< store/restore attribute values /// cash of valid selection presentations QList> myValidPrs; diff --git a/src/ParametersAPI/ParametersAPI.h b/src/ParametersAPI/ParametersAPI.h index 09422582c..c5eb806eb 100644 --- a/src/ParametersAPI/ParametersAPI.h +++ b/src/ParametersAPI/ParametersAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARAMETERSAPI_H @@ -22,13 +23,13 @@ #if defined PARAMETERSAPI_EXPORTS #if defined WIN32 -#define PARAMETERSAPI_EXPORT __declspec( dllexport ) +#define PARAMETERSAPI_EXPORT __declspec(dllexport) #else #define PARAMETERSAPI_EXPORT #endif #else #if defined WIN32 -#define PARAMETERSAPI_EXPORT __declspec( dllimport ) +#define PARAMETERSAPI_EXPORT __declspec(dllimport) #else #define PARAMETERSAPI_EXPORT #endif diff --git a/src/ParametersAPI/ParametersAPI_Parameter.cpp b/src/ParametersAPI/ParametersAPI_Parameter.cpp index d81d06f0a..ca2ecb39a 100644 --- a/src/ParametersAPI/ParametersAPI_Parameter.cpp +++ b/src/ParametersAPI/ParametersAPI_Parameter.cpp @@ -14,30 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ParametersAPI_Parameter.h" //-------------------------------------------------------------------------------------- +#include +#include #include #include -#include -#include //-------------------------------------------------------------------------------------- ParametersAPI_Parameter::ParametersAPI_Parameter( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } ParametersAPI_Parameter::ParametersAPI_Parameter( - const std::shared_ptr & theFeature, - const std::string & theName, - const std::string & theExpression, - const std::wstring & theComment) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::string &theName, const std::string &theExpression, + const std::wstring &theComment) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theName, name()); fillAttribute(theExpression, expression()); @@ -48,52 +46,51 @@ ParametersAPI_Parameter::ParametersAPI_Parameter( } } -void ParametersAPI_Parameter::setValue(const double theValue) -{ +void ParametersAPI_Parameter::setValue(const double theValue) { // convert value to the expression string std::ostringstream aValueStr; - aValueStr<(feature()->firstResult()); + ResultParameterPtr aRes = std::dynamic_pointer_cast( + feature()->firstResult()); // it may raise an exception if result is invalid return aRes->data()->real(ModelAPI_ResultParameter::VALUE())->value(); } -ParametersAPI_Parameter::~ParametersAPI_Parameter() -{ -} +ParametersAPI_Parameter::~ParametersAPI_Parameter() {} -void ParametersAPI_Parameter::dump(ModelHighAPI_Dumper& theDumper) const -{ +void ParametersAPI_Parameter::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); - const std::string& aParamName = theDumper.name(aBase, false, true); + const std::string &aDocName = theDumper.name(aBase->document()); + const std::string &aParamName = theDumper.name(aBase, false, true); - AttributeStringPtr anExpr = aBase->string(ParametersPlugin_Parameter::EXPRESSION_ID()); - AttributeStringPtr aComment = aBase->string(ParametersPlugin_Parameter::COMMENT_ID()); + AttributeStringPtr anExpr = + aBase->string(ParametersPlugin_Parameter::EXPRESSION_ID()); + AttributeStringPtr aComment = + aBase->string(ParametersPlugin_Parameter::COMMENT_ID()); - theDumper << "model.addParameter(" << aDocName << ", \"" << aParamName << "\", " << anExpr; + theDumper << "model.addParameter(" << aDocName << ", \"" << aParamName + << "\", " << anExpr; if (aComment->isInitialized() && !aComment->value().empty()) theDumper << ", " << aComment; theDumper << ")" << std::endl; } //-------------------------------------------------------------------------------------- -ParameterPtr addParameter(const std::shared_ptr & thePart, - const std::string & theName, - const std::string & theExpression, - const std::wstring & theComment) -{ - std::shared_ptr aFeature = thePart->addFeature(ParametersAPI_Parameter::ID()); - ParameterPtr aParam(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment)); +ParameterPtr addParameter(const std::shared_ptr &thePart, + const std::string &theName, + const std::string &theExpression, + const std::wstring &theComment) { + std::shared_ptr aFeature = + thePart->addFeature(ParametersAPI_Parameter::ID()); + ParameterPtr aParam(new ParametersAPI_Parameter(aFeature, theName, + theExpression, theComment)); - if (!aParam->feature()->error().empty()) - { + if (!aParam->feature()->error().empty()) { std::string anError("Error with parameter \""); anError += theName + "\": " + aParam->feature()->error(); throw anError; @@ -102,9 +99,8 @@ ParameterPtr addParameter(const std::shared_ptr & thePart, } //-------------------------------------------------------------------------------------- -void removeParameter(const std::shared_ptr & thePart, - const ParameterPtr & theParameter) -{ +void removeParameter(const std::shared_ptr &thePart, + const ParameterPtr &theParameter) { FeaturePtr aParam = theParameter->feature(); if (aParam) { ModelAPI_ReplaceParameterMessage::send(aParam, 0); diff --git a/src/ParametersAPI/ParametersAPI_Parameter.h b/src/ParametersAPI/ParametersAPI_Parameter.h index dbd3dd65e..6c2dd85ac 100644 --- a/src/ParametersAPI/ParametersAPI_Parameter.h +++ b/src/ParametersAPI/ParametersAPI_Parameter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ @@ -34,40 +35,40 @@ class ModelHighAPI_Double; * \ingroup CPPHighAPI * \brief Interface for Parameter feature */ -class ParametersAPI_Parameter : public ModelHighAPI_Interface -{ +class ParametersAPI_Parameter : public ModelHighAPI_Interface { public: /// Constructor without values PARAMETERSAPI_EXPORT - explicit ParametersAPI_Parameter(const std::shared_ptr & theFeature); + explicit ParametersAPI_Parameter( + const std::shared_ptr &theFeature); /// Constructor with values PARAMETERSAPI_EXPORT - explicit ParametersAPI_Parameter(const std::shared_ptr & theFeature, - const std::string & theName, - const std::string & theExpression, - const std::wstring & theComment = std::wstring()); + explicit ParametersAPI_Parameter( + const std::shared_ptr &theFeature, + const std::string &theName, const std::string &theExpression, + const std::wstring &theComment = std::wstring()); /// Destructor PARAMETERSAPI_EXPORT virtual ~ParametersAPI_Parameter(); - INTERFACE_3(ParametersPlugin_Parameter::ID(), - name, ParametersPlugin_Parameter::VARIABLE_ID(), - ModelAPI_AttributeString, /** Name */, - expression, ParametersPlugin_Parameter::EXPRESSION_ID(), - ModelAPI_AttributeString, /** Expression */, - comment, ParametersPlugin_Parameter::COMMENT_ID(), + INTERFACE_3(ParametersPlugin_Parameter::ID(), name, + ParametersPlugin_Parameter::VARIABLE_ID(), + ModelAPI_AttributeString, /** Name */, expression, + ParametersPlugin_Parameter::EXPRESSION_ID(), + ModelAPI_AttributeString, /** Expression */, comment, + ParametersPlugin_Parameter::COMMENT_ID(), ModelAPI_AttributeString, /** Comment */ ) - /// Just sets the numeric value to the parameter (it resets the previous expression) + /// Just sets the numeric value to the parameter (it resets the previous + /// expression) PARAMETERSAPI_EXPORT void setValue(const double theValue); /// Returns the current value of the parameter: the expression result. PARAMETERSAPI_EXPORT double value(); /// Dump wrapped feature PARAMETERSAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; - + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Parameter object @@ -77,17 +78,18 @@ typedef std::shared_ptr ParameterPtr; * \brief Create Parameter feature */ PARAMETERSAPI_EXPORT -ParameterPtr addParameter(const std::shared_ptr & thePart, - const std::string & theName, - const std::string & theExpression, - const std::wstring & theComment = std::wstring()); +ParameterPtr addParameter(const std::shared_ptr &thePart, + const std::string &theName, + const std::string &theExpression, + const std::wstring &theComment = std::wstring()); /**\ingroup CPPHighAPI - * \brief Remove Parameter feature and substitute it by the value in referred features + * \brief Remove Parameter feature and substitute it by the value in referred + * features */ PARAMETERSAPI_EXPORT -void removeParameter(const std::shared_ptr & thePart, - const ParameterPtr & theParameter); +void removeParameter(const std::shared_ptr &thePart, + const ParameterPtr &theParameter); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/ParametersAPI/ParametersAPI_swig.h b/src/ParametersAPI/ParametersAPI_swig.h index 8d0787e0b..5fed466d1 100644 --- a/src/ParametersAPI/ParametersAPI_swig.h +++ b/src/ParametersAPI/ParametersAPI_swig.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_ #define SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_ - #include +#include - #include "ParametersAPI_Parameter.h" +#include "ParametersAPI_Parameter.h" #endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_ */ diff --git a/src/ParametersPlugin/CMakeLists.txt b/src/ParametersPlugin/CMakeLists.txt index 1630d0cbe..c733240eb 100644 --- a/src/ParametersPlugin/CMakeLists.txt +++ b/src/ParametersPlugin/CMakeLists.txt @@ -125,17 +125,17 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ParametersPlugin") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) install(DIRECTORY Test/data DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/ParametersPlugin/ParametersPlugin.h b/src/ParametersPlugin/ParametersPlugin.h index dc17267ab..0cf091579 100644 --- a/src/ParametersPlugin/ParametersPlugin.h +++ b/src/ParametersPlugin/ParametersPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARAMETERSPLUGIN_H @@ -22,17 +23,16 @@ #if defined PARAMETERSPLUGIN_EXPORTS #if defined WIN32 -#define PARAMETERSPLUGIN_EXPORT __declspec( dllexport ) +#define PARAMETERSPLUGIN_EXPORT __declspec(dllexport) #else #define PARAMETERSPLUGIN_EXPORT #endif #else #if defined WIN32 -#define PARAMETERSPLUGIN_EXPORT __declspec( dllimport ) +#define PARAMETERSPLUGIN_EXPORT __declspec(dllimport) #else #define PARAMETERSPLUGIN_EXPORT #endif #endif #endif - diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index d0e4ca3ab..bb8f572ec 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -44,15 +45,14 @@ #include -#include #include #include +#include //------------------------------------------------------------------------------ // Tools -static std::wstring toStdWString(double theValue) -{ +static std::wstring toStdWString(double theValue) { std::wostringstream sstream; sstream << theValue; size_t aPos = sstream.str().find(L"."); @@ -64,31 +64,28 @@ static std::wstring toStdWString(double theValue) //------------------------------------------------------------------------------ -ParametersPlugin_EvalListener::ParametersPlugin_EvalListener() -{ - Events_Loop* aLoop = Events_Loop::loop(); +ParametersPlugin_EvalListener::ParametersPlugin_EvalListener() { + Events_Loop *aLoop = Events_Loop::loop(); - Events_ID anEvents_IDs[] = { - ModelAPI_ObjectRenamedMessage::eventId(), - ModelAPI_ReplaceParameterMessage::eventId() - }; + Events_ID anEvents_IDs[] = {ModelAPI_ObjectRenamedMessage::eventId(), + ModelAPI_ReplaceParameterMessage::eventId()}; - for (unsigned long long i = 0; i < sizeof(anEvents_IDs)/sizeof(anEvents_IDs[0]); ++i) + for (unsigned long long i = 0; + i < sizeof(anEvents_IDs) / sizeof(anEvents_IDs[0]); ++i) aLoop->registerListener(this, anEvents_IDs[i], NULL, true); } -ParametersPlugin_EvalListener::~ParametersPlugin_EvalListener() -{ -} +ParametersPlugin_EvalListener::~ParametersPlugin_EvalListener() {} void ParametersPlugin_EvalListener::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { if (!theMessage.get()) return; - const Events_ID kObjectRenamedEvent = ModelAPI_ObjectRenamedMessage::eventId(); - const Events_ID kReplaceParameterEvent = ModelAPI_ReplaceParameterMessage::eventId(); + const Events_ID kObjectRenamedEvent = + ModelAPI_ObjectRenamedMessage::eventId(); + const Events_ID kReplaceParameterEvent = + ModelAPI_ReplaceParameterMessage::eventId(); if (theMessage->eventID() == kObjectRenamedEvent) { processObjectRenamedEvent(theMessage); @@ -98,27 +95,27 @@ void ParametersPlugin_EvalListener::processEvent( } std::wstring ParametersPlugin_EvalListener::renameInPythonExpression( - const std::wstring& theExpression, - const std::wstring& theOldName, - const std::wstring& theNewName) -{ + const std::wstring &theExpression, const std::wstring &theOldName, + const std::wstring &theNewName) { std::wstring anExpressionString = theExpression; // ask interpreter to compute the positions in the expression std::shared_ptr aMsg = - ModelAPI_ComputePositionsMessage::send(theExpression, theOldName, this); - const std::list >& aPositions = aMsg->positions(); + ModelAPI_ComputePositionsMessage::send(theExpression, theOldName, this); + const std::list> &aPositions = aMsg->positions(); if (aPositions.empty()) return anExpressionString; - std::map > aLines; - std::list >::const_iterator it = aPositions.begin(); + std::map> aLines; + std::list>::const_iterator it = aPositions.begin(); for (; it != aPositions.end(); ++it) aLines[it->first].push_back(it->second); - // Start renaming from the end to keep indexes if theNewName is longer then theOldName - std::map >::const_reverse_iterator ritLine = aLines.rbegin(); + // Start renaming from the end to keep indexes if theNewName is longer then + // theOldName + std::map>::const_reverse_iterator ritLine = + aLines.rbegin(); for (; ritLine != aLines.rend(); ++ritLine) { // Calculate the start of the line (find the aLineNo occurrence of "\n" ) int aLineNo = ritLine->first - 1; @@ -126,11 +123,12 @@ std::wstring ParametersPlugin_EvalListener::renameInPythonExpression( for (int i = 0; i < aLineNo; ++i) aLineStart = anExpressionString.find(L"\n", aLineStart) + 1; - const std::list& aColOffsets = ritLine->second; + const std::list &aColOffsets = ritLine->second; std::list::const_reverse_iterator ritOffset = aColOffsets.rbegin(); for (; ritOffset != aColOffsets.rend(); ++ritOffset) { int anOffset = *ritOffset; - anExpressionString.replace(aLineStart + anOffset, theOldName.size(), theNewName); + anExpressionString.replace(aLineStart + anOffset, theOldName.size(), + theNewName); } } @@ -139,91 +137,78 @@ std::wstring ParametersPlugin_EvalListener::renameInPythonExpression( void ParametersPlugin_EvalListener::renameInParameter( std::shared_ptr theParameter, - const std::wstring& theOldName, - const std::wstring& theNewName) -{ + const std::wstring &theOldName, const std::wstring &theNewName) { std::shared_ptr anExpressionAttribute = theParameter->string(ParametersPlugin_Parameter::EXPRESSION_ID()); - std::wstring anExpressionString = anExpressionAttribute->isUValue() ? - Locale::Convert::toWString(anExpressionAttribute->valueU()) : - Locale::Convert::toWString(anExpressionAttribute->value()); - anExpressionString = renameInPythonExpression(anExpressionString, - theOldName, - theNewName); + std::wstring anExpressionString = + anExpressionAttribute->isUValue() + ? Locale::Convert::toWString(anExpressionAttribute->valueU()) + : Locale::Convert::toWString(anExpressionAttribute->value()); + anExpressionString = + renameInPythonExpression(anExpressionString, theOldName, theNewName); // Issue #588. No need for reevaluating expression. // Moreover, current history may not contain necessary parameters. - bool aWasBlocked = anExpressionAttribute->owner()->data()->blockSendAttributeUpdated(true); + bool aWasBlocked = + anExpressionAttribute->owner()->data()->blockSendAttributeUpdated(true); anExpressionAttribute->setValue(anExpressionString); - anExpressionAttribute->owner()->data()->blockSendAttributeUpdated(aWasBlocked); + anExpressionAttribute->owner()->data()->blockSendAttributeUpdated( + aWasBlocked); } void ParametersPlugin_EvalListener::renameInAttribute( std::shared_ptr theAttribute, - const std::wstring& theOldName, - const std::wstring& theNewName) -{ + const std::wstring &theOldName, const std::wstring &theNewName) { if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) { AttributeIntegerPtr anAttribute = std::dynamic_pointer_cast(theAttribute); std::wstring anExpressionString = anAttribute->text(); - anExpressionString = renameInPythonExpression(anExpressionString, - theOldName, theNewName); + anExpressionString = + renameInPythonExpression(anExpressionString, theOldName, theNewName); anAttribute->setText(anExpressionString); - } else - if (theAttribute->attributeType() == ModelAPI_AttributeDouble::typeId()) { + } else if (theAttribute->attributeType() == + ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttribute = std::dynamic_pointer_cast(theAttribute); std::wstring anExpressionString = anAttribute->text(); - anExpressionString = renameInPythonExpression(anExpressionString, - theOldName, theNewName); + anExpressionString = + renameInPythonExpression(anExpressionString, theOldName, theNewName); anAttribute->setText(anExpressionString); - } else - if (theAttribute->attributeType() == GeomDataAPI_Point::typeId()) { + } else if (theAttribute->attributeType() == GeomDataAPI_Point::typeId()) { AttributePointPtr anAttribute = std::dynamic_pointer_cast(theAttribute); std::wstring anExpressionString[3] = { - anAttribute->textX(), - anAttribute->textY(), - anAttribute->textZ() - }; + anAttribute->textX(), anAttribute->textY(), anAttribute->textZ()}; for (int i = 0; i < 3; ++i) anExpressionString[i] = renameInPythonExpression(anExpressionString[i], theOldName, theNewName); - anAttribute->setText(anExpressionString[0], - anExpressionString[1], + anAttribute->setText(anExpressionString[0], anExpressionString[1], anExpressionString[2]); - } else - if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { + } else if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { AttributePoint2DPtr anAttribute = std::dynamic_pointer_cast(theAttribute); - std::wstring anExpressionString[2] = { - anAttribute->textX(), - anAttribute->textY() - }; + std::wstring anExpressionString[2] = {anAttribute->textX(), + anAttribute->textY()}; for (int i = 0; i < 2; ++i) anExpressionString[i] = renameInPythonExpression(anExpressionString[i], theOldName, theNewName); - anAttribute->setText(anExpressionString[0], - anExpressionString[1]); + anAttribute->setText(anExpressionString[0], anExpressionString[1]); } } void ParametersPlugin_EvalListener::renameInDependents( - std::shared_ptr theResultParameter, - const std::wstring& theOldName, - const std::wstring& theNewName) -{ - std::set > anAttributes = - theResultParameter->data()->refsToMe(); - std::set >::const_iterator anAttributeIt = - anAttributes.cbegin(); + std::shared_ptr theResultParameter, + const std::wstring &theOldName, const std::wstring &theNewName) { + std::set> anAttributes = + theResultParameter->data()->refsToMe(); + std::set>::const_iterator anAttributeIt = + anAttributes.cbegin(); for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) { - const AttributePtr& anAttribute = *anAttributeIt; + const AttributePtr &anAttribute = *anAttributeIt; if (anAttribute->attributeType() == ModelAPI_AttributeRefList::typeId()) { std::shared_ptr aParameter = - std::dynamic_pointer_cast( - anAttribute->owner()); + std::dynamic_pointer_cast( + anAttribute->owner()); if (aParameter.get()) // Rename renameInParameter(aParameter, theOldName, theNewName); @@ -233,16 +218,17 @@ void ParametersPlugin_EvalListener::renameInDependents( } } -bool isValidAttribute(const AttributePtr& theAttribute) -{ +bool isValidAttribute(const AttributePtr &theAttribute) { std::string aValidator; Events_InfoMessage anError; - return ModelAPI_Session::get()->validators()->validate(theAttribute, aValidator, anError); + return ModelAPI_Session::get()->validators()->validate(theAttribute, + aValidator, anError); } -void setParameterName(ResultParameterPtr theResultParameter, const std::string& theName) -{ - bool aWasBlocked = theResultParameter->data()->blockSendAttributeUpdated(true); +void setParameterName(ResultParameterPtr theResultParameter, + const std::string &theName) { + bool aWasBlocked = + theResultParameter->data()->blockSendAttributeUpdated(true); theResultParameter->data()->setName(Locale::Convert::toWString(theName)); theResultParameter->data()->blockSendAttributeUpdated(aWasBlocked, false); @@ -253,13 +239,13 @@ void setParameterName(ResultParameterPtr theResultParameter, const std::string& std::string anOldName = Locale::Convert::toString(aParameter->name()); aWasBlocked = aParameter->data()->blockSendAttributeUpdated(true); aParameter->data()->setName(Locale::Convert::toWString(theName)); - aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->setValue(theName); + aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID()) + ->setValue(theName); aParameter->data()->blockSendAttributeUpdated(aWasBlocked); } void ParametersPlugin_EvalListener::processObjectRenamedEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::shared_ptr aMessage = std::dynamic_pointer_cast(theMessage); @@ -285,24 +271,28 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent( if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) { static const std::string aMsgContext("ParametersPlugin"); static const std::string aMsgText = - "Selected objects can be used in Part documents which are not loaded: " + - std::string("%1. Would you like to continue?"); + "Selected objects can be used in Part documents which are not " + "loaded: " + + std::string("%1. Would you like to continue?"); Events_InfoMessage aMsg(aMsgContext, aMsgText); aMsg.arg(aNotActivatedNames.c_str()); - QMessageBox::StandardButton aRes = - QMessageBox::warning(0, ModuleBase_Tools::translate(aMsgContext, "Warning"), - ModuleBase_Tools::translate(aMsg), - QMessageBox::No | QMessageBox::Yes, QMessageBox::No); + QMessageBox::StandardButton aRes = QMessageBox::warning( + 0, ModuleBase_Tools::translate(aMsgContext, "Warning"), + ModuleBase_Tools::translate(aMsg), QMessageBox::No | QMessageBox::Yes, + QMessageBox::No); if (aRes != QMessageBox::Yes) { - setParameterName(aResultParameter, Locale::Convert::toString(aMessage->oldName())); + setParameterName(aResultParameter, + Locale::Convert::toString(aMessage->oldName())); return; } } // try to update the parameter feature according the new name - setParameterName(aResultParameter, Locale::Convert::toString(aMessage->newName())); - if (!isValidAttribute(aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID()))) { - //setParameterName(aResultParameter, aMessage->oldName()); + setParameterName(aResultParameter, + Locale::Convert::toString(aMessage->newName())); + if (!isValidAttribute( + aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID()))) { + // setParameterName(aResultParameter, aMessage->oldName()); if (myOldNames.find(aParameter.get()) == myOldNames.end()) myOldNames[aParameter.get()] = aMessage->oldName(); return; @@ -312,15 +302,15 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent( if (myOldNames.find(aParameter.get()) != myOldNames.end()) { anOldName = myOldNames[aParameter.get()]; myOldNames.erase(aParameter.get()); - aParameter->execute(); // to enable result because of previously incorrect name + aParameter + ->execute(); // to enable result because of previously incorrect name } renameInDependents(aResultParameter, anOldName, aMessage->newName()); } void ParametersPlugin_EvalListener::processReplaceParameterEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::shared_ptr aMessage = std::dynamic_pointer_cast(theMessage); @@ -337,8 +327,11 @@ void ParametersPlugin_EvalListener::processReplaceParameterEvent( if (!aResultParameter.get()) return; - double aRealValue = aResultParameter->data()->real(ModelAPI_ResultParameter::VALUE())->value(); + double aRealValue = aResultParameter->data() + ->real(ModelAPI_ResultParameter::VALUE()) + ->value(); std::wstring aValue = toStdWString(aRealValue); - renameInDependents(aResultParameter, aResultParameter->data()->name(), aValue); + renameInDependents(aResultParameter, aResultParameter->data()->name(), + aValue); } diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.h b/src/ParametersPlugin/ParametersPlugin_EvalListener.h index 523f6a3f5..9d9a574d2 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.h +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_PARAMETERSPLUGIN_EVALLISTENER_H_ #define SRC_PARAMETERSPLUGIN_EVALLISTENER_H_ -#include #include +#include class ModelAPI_Attribute; class ModelAPI_Document; @@ -34,41 +35,46 @@ class ParametersPlugin_Parameter; * \ingroup Plugins * \brief Class which process the events from the event loop. */ -class ParametersPlugin_EvalListener : public Events_Listener -{ - /// map of old names, that were valid for perameres, but now parameter name is changed to invalid - /// stored not shared pointers to features to avoid memory keeping on the feature delete - std::map myOldNames; - public: +class ParametersPlugin_EvalListener : public Events_Listener { + /// map of old names, that were valid for perameres, but now parameter name is + /// changed to invalid stored not shared pointers to features to avoid memory + /// keeping on the feature delete + std::map myOldNames; + +public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener(); PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener(); /// Reimplemented from Events_Listener::processEvent(). PARAMETERSPLUGIN_EXPORT - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); - protected: +protected: /// Processes ObjectRenamed event. - void processObjectRenamedEvent(const std::shared_ptr& theMessage); + void + processObjectRenamedEvent(const std::shared_ptr &theMessage); /// Processes ReplaceParameter event. - void processReplaceParameterEvent(const std::shared_ptr& theMessage); + void processReplaceParameterEvent( + const std::shared_ptr &theMessage); /// Renames theOldName in theExpression by theNewName. - std::wstring renameInPythonExpression(const std::wstring& theExpression, - const std::wstring& theOldName, - const std::wstring& theNewName); - /// Renames theOldName in the expression attribute of theParameter by theNewName. - void renameInParameter(std::shared_ptr theParameter, - const std::wstring& theOldName, - const std::wstring& theNewName); + std::wstring renameInPythonExpression(const std::wstring &theExpression, + const std::wstring &theOldName, + const std::wstring &theNewName); + /// Renames theOldName in the expression attribute of theParameter by + /// theNewName. + void + renameInParameter(std::shared_ptr theParameter, + const std::wstring &theOldName, + const std::wstring &theNewName); /// Renames theOldName in the text fields of theAttribute by theNewName. void renameInAttribute(std::shared_ptr theAttribute, - const std::wstring& theOldName, - const std::wstring& theNewName); + const std::wstring &theOldName, + const std::wstring &theNewName); /// Renames theOldName in all dependents of theResultParameter by theNewName. - void renameInDependents(std::shared_ptr theResultParameter, - const std::wstring& theOldName, - const std::wstring& theNewName); + void renameInDependents( + std::shared_ptr theResultParameter, + const std::wstring &theOldName, const std::wstring &theNewName); }; #endif /* SRC_PARAMETERSPLUGIN_PARAMETERSPLUGIN_EVALLISTENER_H_ */ diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index 7bde10e07..9e81b1138 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,61 +24,56 @@ #include -#include -#include #include #include -#include +#include +#include +#include #include +#include #include -#include -#include #include +#include -ParametersPlugin_Parameter::ParametersPlugin_Parameter() -{ -} +ParametersPlugin_Parameter::ParametersPlugin_Parameter() {} -ParametersPlugin_Parameter::~ParametersPlugin_Parameter() -{ -} +ParametersPlugin_Parameter::~ParametersPlugin_Parameter() {} -void ParametersPlugin_Parameter::initAttributes() -{ +void ParametersPlugin_Parameter::initAttributes() { data()->addAttribute(VARIABLE_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(EXPRESSION_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(COMMENT_ID(), ModelAPI_AttributeString::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMMENT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + COMMENT_ID()); - data()->addAttribute(EXPRESSION_ERROR_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(EXPRESSION_ERROR_ID(), + ModelAPI_AttributeString::typeId()); data()->string(EXPRESSION_ERROR_ID())->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXPRESSION_ERROR_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), EXPRESSION_ERROR_ID()); data()->addAttribute(ARGUMENTS_ID(), ModelAPI_AttributeRefList::typeId()); data()->reflist(ARGUMENTS_ID())->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ARGUMENTS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + ARGUMENTS_ID()); } -bool ParametersPlugin_Parameter::isInHistory() -{ - return false; -} +bool ParametersPlugin_Parameter::isInHistory() { return false; } -void ParametersPlugin_Parameter::attributeChanged(const std::string& theID) -{ +void ParametersPlugin_Parameter::attributeChanged(const std::string &theID) { if (theID == EXPRESSION_ID()) updateExpression(); data()->execState(ModelAPI_StateMustBeUpdated); } -void ParametersPlugin_Parameter::updateName() -{ - std::wstring aName = string(VARIABLE_ID())->isUValue() ? - Locale::Convert::toWString(string(VARIABLE_ID())->valueU()) : - Locale::Convert::toWString(string(VARIABLE_ID())->value()); +void ParametersPlugin_Parameter::updateName() { + std::wstring aName = + string(VARIABLE_ID())->isUValue() + ? Locale::Convert::toWString(string(VARIABLE_ID())->valueU()) + : Locale::Convert::toWString(string(VARIABLE_ID())->value()); data()->setName(aName); ResultParameterPtr aParam = document()->createParameter(data()); @@ -85,12 +81,12 @@ void ParametersPlugin_Parameter::updateName() aParam->data()->setName(aName); setResult(aParam); - // #2474 : if parameter name now hides/shows the higher level parameter name, // update the depended expressions DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); if (aParam->document() != aRootDoc) { - std::list aNames; // collect names in the root document that must be checked + std::list + aNames; // collect names in the root document that must be checked aNames.push_back(aName); if (anOldName != aName) { aNames.push_back(anOldName); @@ -99,15 +95,16 @@ void ParametersPlugin_Parameter::updateName() for (; aNIter != aNames.end(); aNIter++) { double aValue; ResultParameterPtr aRootParam; - FeaturePtr aThis = - std::dynamic_pointer_cast(string(VARIABLE_ID())->owner()); - if (ModelAPI_Tools::findVariable(aThis, *aNIter, aValue, aRootParam, aRootDoc)) { - std::set > anAttributes = - aRootParam->data()->refsToMe(); - std::set >::const_iterator anAttributeIt = - anAttributes.cbegin(); + FeaturePtr aThis = std::dynamic_pointer_cast( + string(VARIABLE_ID())->owner()); + if (ModelAPI_Tools::findVariable(aThis, *aNIter, aValue, aRootParam, + aRootDoc)) { + std::set> anAttributes = + aRootParam->data()->refsToMe(); + std::set>::const_iterator + anAttributeIt = anAttributes.cbegin(); for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) { - const AttributePtr& anAttribute = *anAttributeIt; + const AttributePtr &anAttribute = *anAttributeIt; ModelAPI_AttributeEvalMessage::send(anAttribute, NULL); } } @@ -115,11 +112,11 @@ void ParametersPlugin_Parameter::updateName() } } -bool ParametersPlugin_Parameter::updateExpression() -{ - std::wstring anExpression = string(EXPRESSION_ID())->isUValue() ? - Locale::Convert::toWString(string(EXPRESSION_ID())->valueU()) : - Locale::Convert::toWString(string(EXPRESSION_ID())->value()); +bool ParametersPlugin_Parameter::updateExpression() { + std::wstring anExpression = + string(EXPRESSION_ID())->isUValue() + ? Locale::Convert::toWString(string(EXPRESSION_ID())->valueU()) + : Locale::Convert::toWString(string(EXPRESSION_ID())->value()); std::string outErrorMessage; double aValue = evaluate(anExpression, outErrorMessage); @@ -129,48 +126,53 @@ bool ParametersPlugin_Parameter::updateExpression() return false; ResultParameterPtr aParam = document()->createParameter(data()); - AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + AttributeDoublePtr aValueAttribute = + aParam->data()->real(ModelAPI_ResultParameter::VALUE()); aValueAttribute->setValue(aValue); setResult(aParam); return true; } -void ParametersPlugin_Parameter::execute() -{ +void ParametersPlugin_Parameter::execute() { updateName(); if (!updateExpression()) setError("Expression error.", false); } -double ParametersPlugin_Parameter::evaluate(const std::wstring& /*theExpression*/, - std::string& theError) -{ - FeaturePtr aMyPtr = std::dynamic_pointer_cast(data()->owner()); +double +ParametersPlugin_Parameter::evaluate(const std::wstring & /*theExpression*/, + std::string &theError) { + FeaturePtr aMyPtr = + std::dynamic_pointer_cast(data()->owner()); std::shared_ptr aProcessMessage = - ModelAPI_ParameterEvalMessage::send(aMyPtr, this); + ModelAPI_ParameterEvalMessage::send(aMyPtr, this); double aResult = 0; if (aProcessMessage->isProcessed()) { - const std::list& aParamsList = aProcessMessage->params(); + const std::list &aParamsList = + aProcessMessage->params(); aResult = aProcessMessage->result(); theError = aProcessMessage->error(); // compare the list of parameters to store if changed AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); bool aDifferent = aParams->size() != (int)aParamsList.size(); if (!aDifferent) { - std::list::const_iterator aNewIter = aParamsList.begin(); + std::list::const_iterator aNewIter = + aParamsList.begin(); std::list anOldList = aParams->list(); std::list::const_iterator anOldIter = anOldList.begin(); - for(; !aDifferent && aNewIter != aParamsList.end(); aNewIter++, anOldIter++) { + for (; !aDifferent && aNewIter != aParamsList.end(); + aNewIter++, anOldIter++) { if (*aNewIter != *anOldIter) aDifferent = true; } } if (aDifferent) { aParams->clear(); - std::list::const_iterator aNewIter = aParamsList.begin(); - for(; aNewIter != aParamsList.end(); aNewIter++) { + std::list::const_iterator aNewIter = + aParamsList.begin(); + for (; aNewIter != aParamsList.end(); aNewIter++) { aParams->append(*aNewIter); } } @@ -180,7 +182,4 @@ double ParametersPlugin_Parameter::evaluate(const std::wstring& /*theExpression* return aResult; } -bool ParametersPlugin_Parameter::isPreviewNeeded() const -{ - return true; -} +bool ParametersPlugin_Parameter::isPreviewNeeded() const { return true; } diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.h b/src/ParametersPlugin/ParametersPlugin_Parameter.h index 26fe95296..03ca3b052 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.h +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARAMETERSPLUGIN_PARAMETER_H_ @@ -30,52 +31,44 @@ * \ingroup Plugins * \brief Feature for parameter. */ -class ParametersPlugin_Parameter : public ModelAPI_Feature -{ - public: +class ParametersPlugin_Parameter : public ModelAPI_Feature { +public: virtual ~ParametersPlugin_Parameter(); /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_PARAMETER_ID("Parameter"); return MY_PARAMETER_ID; } /// attribute of parameter name - inline static const std::string& VARIABLE_ID() - { + inline static const std::string &VARIABLE_ID() { static const std::string MY_VARIABLE_ID("variable"); return MY_VARIABLE_ID; } /// attribute of parameter expression - inline static const std::string& EXPRESSION_ID() - { + inline static const std::string &EXPRESSION_ID() { static const std::string MY_EXPRESSION_ID("expression"); return MY_EXPRESSION_ID; } /// attribute of parameter expression error - inline static const std::string& EXPRESSION_ERROR_ID() - { + inline static const std::string &EXPRESSION_ERROR_ID() { static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError"); return MY_EXPRESSION_ERROR_ID; } /// list of references to the arguments of this expression - inline static const std::string& ARGUMENTS_ID() - { + inline static const std::string &ARGUMENTS_ID() { static const std::string MY_ARGUMENTS_ID("arguments"); return MY_ARGUMENTS_ID; } /// return comment attribute Id - inline static const std::string& COMMENT_ID() - { + inline static const std::string &COMMENT_ID() { static const std::string MY_COMMENT_ID("comment"); return MY_COMMENT_ID; } /// Returns the kind of a feature - PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind() - { + PARAMETERSPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = ParametersPlugin_Parameter::ID(); return MY_KIND; } @@ -86,21 +79,23 @@ class ParametersPlugin_Parameter : public ModelAPI_Feature /// Creates a parameter in document PARAMETERSPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PARAMETERSPLUGIN_EXPORT virtual void initAttributes(); /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false. PARAMETERSPLUGIN_EXPORT virtual bool isInHistory(); /// Reimplemented from ModelAPI_Feature::isInHistory(). - PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + PARAMETERSPLUGIN_EXPORT virtual void + attributeChanged(const std::string &theID); /// Use plugin manager for features creation ParametersPlugin_Parameter(); - protected: +protected: /// Evaluates theExpression and returns its value. - double evaluate(const std::wstring& theExpression, std::string& theError); + double evaluate(const std::wstring &theExpression, std::string &theError); /// Updates name of the parameter void updateName(); /// Updates expression of the parameter diff --git a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp index 6835352bf..c909b014e 100644 --- a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp @@ -14,27 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include "ParametersPlugin_ParametersMgr.h" - ParametersPlugin_ParametersMgr::ParametersPlugin_ParametersMgr() - : ModelAPI_Feature() -{ -} + : ModelAPI_Feature() {} -ParametersPlugin_ParametersMgr::~ParametersPlugin_ParametersMgr() -{ -} +ParametersPlugin_ParametersMgr::~ParametersPlugin_ParametersMgr() {} -void ParametersPlugin_ParametersMgr::initAttributes() -{ -} +void ParametersPlugin_ParametersMgr::initAttributes() {} -void ParametersPlugin_ParametersMgr::execute() -{ -} +void ParametersPlugin_ParametersMgr::execute() {} diff --git a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h index 0f9322065..dcb170c29 100644 --- a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h +++ b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARAMETERSPLUGIN_PARAMETERSMGR_H_ @@ -26,15 +27,14 @@ /** * \class ParametersPlugin_ParametersMgr * \ingroup Plugins - * \brief A macro feature which manages list of parameters in the current document. + * \brief A macro feature which manages list of parameters in the current + * document. */ -class ParametersPlugin_ParametersMgr : public ModelAPI_Feature -{ +class ParametersPlugin_ParametersMgr : public ModelAPI_Feature { public: /// Feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_PARAMSMGR_ID("ParametersMgr"); return MY_PARAMSMGR_ID; } @@ -45,12 +45,12 @@ public: /// Destructor virtual ~ParametersPlugin_ParametersMgr(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PARAMETERSPLUGIN_EXPORT virtual void initAttributes(); /// Returns the unique kind of a feature - PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind() - { + PARAMETERSPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = ParametersPlugin_ParametersMgr::ID(); return MY_KIND; }; @@ -64,14 +64,14 @@ public: /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } - /// Returns true if result is persistent (stored in document) and on undo-redo, save-open - /// it is not needed to recompute it. - PARAMETERSPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} + /// Returns true if result is persistent (stored in document) and on + /// undo-redo, save-open it is not needed to recompute it. + PARAMETERSPLUGIN_EXPORT virtual bool isPersistentResult() { return false; } /// Returns true if this feature must not be created: this is just an action - /// that is not stored in the features history and data model (like "delete part"). - virtual bool isInHistory() { return false; } + /// that is not stored in the features history and data model (like "delete + /// part"). + virtual bool isInHistory() { return false; } }; - -#endif \ No newline at end of file +#endif diff --git a/src/ParametersPlugin/ParametersPlugin_Plugin.cpp b/src/ParametersPlugin/ParametersPlugin_Plugin.cpp index 83f2ae4be..86acaea45 100644 --- a/src/ParametersPlugin/ParametersPlugin_Plugin.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Plugin.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include #include +#include #include #include @@ -33,30 +34,31 @@ #include // the only created instance of this plugin -static ParametersPlugin_Plugin* MY_PARAMETERSPLUGIN_INSTANCE = new ParametersPlugin_Plugin(); +static ParametersPlugin_Plugin *MY_PARAMETERSPLUGIN_INSTANCE = + new ParametersPlugin_Plugin(); -ParametersPlugin_Plugin::ParametersPlugin_Plugin() -{ +ParametersPlugin_Plugin::ParametersPlugin_Plugin() { // register this plugin - WidgetCreatorFactoryPtr aWidgetCreatorFactory = ModuleBase_WidgetCreatorFactory::get(); + WidgetCreatorFactoryPtr aWidgetCreatorFactory = + ModuleBase_WidgetCreatorFactory::get(); aWidgetCreatorFactory->registerCreator( - std::shared_ptr(new ParametersPlugin_WidgetCreator())); + std::shared_ptr( + new ParametersPlugin_WidgetCreator())); SessionPtr aSession = ModelAPI_Session::get(); aSession->registerPlugin(this); - ModelAPI_ValidatorsFactory* aFactory = aSession->validators(); + ModelAPI_ValidatorsFactory *aFactory = aSession->validators(); aFactory->registerValidator("Parameters_VariableValidator", new ParametersPlugin_VariableValidator); aFactory->registerValidator("Parameters_ExpressionValidator", new ParametersPlugin_ExpressionValidator); - myEvalListener = - std::shared_ptr(new ParametersPlugin_EvalListener()); + myEvalListener = std::shared_ptr( + new ParametersPlugin_EvalListener()); } -FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID) { // TODO: register some features if (theFeatureID == ParametersPlugin_Parameter::ID()) { return FeaturePtr(new ParametersPlugin_Parameter); @@ -66,4 +68,3 @@ FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID) } return FeaturePtr(); } - diff --git a/src/ParametersPlugin/ParametersPlugin_Plugin.h b/src/ParametersPlugin/ParametersPlugin_Plugin.h index 361a66b77..d62521f31 100644 --- a/src/ParametersPlugin/ParametersPlugin_Plugin.h +++ b/src/ParametersPlugin/ParametersPlugin_Plugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARAMETERSPLUGIN_PLUGIN_H_ @@ -23,26 +24,26 @@ #include #include -#include #include +#include /** * \class ParametersPlugin_Plugin * \ingroup Plugins - * \brief The main class for management of parameter evaluation operations as plugin. + * \brief The main class for management of parameter evaluation operations as + * plugin. */ -class ParametersPlugin_Plugin : public ModelAPI_Plugin -{ - public: +class ParametersPlugin_Plugin : public ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID - PARAMETERSPLUGIN_EXPORT virtual FeaturePtr createFeature(std::string theFeatureID); + PARAMETERSPLUGIN_EXPORT virtual FeaturePtr + createFeature(std::string theFeatureID); - public: +public: ParametersPlugin_Plugin(); - private: +private: std::shared_ptr myEvalListener; }; #endif - diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.cpp b/src/ParametersPlugin/ParametersPlugin_Validators.cpp index b511c61b9..40c3277b7 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Validators.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -26,24 +27,21 @@ #include #include +#include #include #include #include -#include -ParametersPlugin_VariableValidator::ParametersPlugin_VariableValidator() -{ -} +ParametersPlugin_VariableValidator::ParametersPlugin_VariableValidator() {} -ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator() -{ -} +ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator() {} -bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ - AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(theAttribute); +bool ParametersPlugin_VariableValidator::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { + AttributeStringPtr aStrAttr = + std::dynamic_pointer_cast(theAttribute); if (!aStrAttr->isInitialized()) { theError = "Attribute \"%1\" is not initialized."; theError.arg(aStrAttr->id()); @@ -66,16 +64,18 @@ bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribut return true; } -bool ParametersPlugin_VariableValidator::isUnique(const AttributePtr& theAttribute, - const std::string& theString) const -{ +bool ParametersPlugin_VariableValidator::isUnique( + const AttributePtr &theAttribute, const std::string &theString) const { DocumentPtr aDocument = theAttribute->owner()->document(); - for (int anIndex = 0, aSize = aDocument->size(ModelAPI_ResultParameter::group()); + for (int anIndex = 0, + aSize = aDocument->size(ModelAPI_ResultParameter::group()); anIndex < aSize; ++anIndex) { - ObjectPtr aParamObj = aDocument->object(ModelAPI_ResultParameter::group(), anIndex); + ObjectPtr aParamObj = + aDocument->object(ModelAPI_ResultParameter::group(), anIndex); if (Locale::Convert::toString(aParamObj->data()->name()) != theString) continue; - ResultParameterPtr aParam = std::dynamic_pointer_cast(aParamObj); + ResultParameterPtr aParam = + std::dynamic_pointer_cast(aParamObj); if (!aParam.get()) continue; FeaturePtr aFeature = ModelAPI_Feature::feature(aParam); @@ -86,21 +86,16 @@ bool ParametersPlugin_VariableValidator::isUnique(const AttributePtr& theAttribu return true; } -ParametersPlugin_ExpressionValidator::ParametersPlugin_ExpressionValidator() -{ - -} +ParametersPlugin_ExpressionValidator::ParametersPlugin_ExpressionValidator() {} -ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator() -{ - -} +ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator() {} -bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); +bool ParametersPlugin_ExpressionValidator::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(theAttribute); @@ -115,6 +110,7 @@ bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttrib return false; } - theError = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID())->value(); + theError = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID()) + ->value(); return theError.empty(); } diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.h b/src/ParametersPlugin/ParametersPlugin_Validators.h index f0f2f0750..233b06a3d 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.h +++ b/src/ParametersPlugin/ParametersPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ @@ -32,9 +33,8 @@ * \ingroup Validators * \brief Validator for the variable name of parameter. */ -class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator -{ - public: +class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator { +public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator(); PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator(); @@ -44,14 +44,16 @@ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator * \param theArguments arguments of the attribute * \param theError the error string message if validation fails */ - PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + PARAMETERSPLUGIN_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; - protected: - /// Returns true if theString is unique parameter name in the document of theAttribute. - PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute, - const std::string& theString) const; +protected: + /// Returns true if theString is unique parameter name in the document of + /// theAttribute. + PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr &theAttribute, + const std::string &theString) const; }; /** @@ -59,9 +61,9 @@ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator * \ingroup Validators * \brief Validator for the expression of parameter. */ -class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator -{ - public: +class ParametersPlugin_ExpressionValidator + : public ModelAPI_AttributeValidator { +public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator(); PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator(); @@ -71,10 +73,10 @@ class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator * \param theArguments arguments of the attribute * \param theError the error string message if validation fails */ - PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + PARAMETERSPLUGIN_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - #endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */ diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp index 0c91f8507..390766038 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp @@ -14,35 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include - ParametersPlugin_WidgetCreator::ParametersPlugin_WidgetCreator() - : ModuleBase_IWidgetCreator() -{ -} + : ModuleBase_IWidgetCreator() {} - -void ParametersPlugin_WidgetCreator::widgetTypes(std::set& theTypes) -{ +void ParametersPlugin_WidgetCreator::widgetTypes( + std::set &theTypes) { theTypes.clear(); theTypes.insert("parameters-manager"); } - -ModuleBase_ModelWidget* - ParametersPlugin_WidgetCreator::createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop) -{ - ModuleBase_ModelWidget* aModelWidget = 0; +ModuleBase_ModelWidget *ParametersPlugin_WidgetCreator::createWidgetByType( + const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { + ModuleBase_ModelWidget *aModelWidget = 0; if (theType == "parameters-manager") { - aModelWidget = new ParametersPlugin_WidgetParamsMgr(theParent, theWidgetApi, theWorkshop); + aModelWidget = new ParametersPlugin_WidgetParamsMgr(theParent, theWidgetApi, + theWorkshop); } return aModelWidget; } diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h index 34e1526f7..252ac89d2 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h +++ b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ParametersPlugin_WidgetCreator_H @@ -24,22 +25,21 @@ #include -#include #include +#include -/** -* \ingroup GUI -* Interface to WidgetCreator which can create specific widgets by type -*/ -class ParametersPlugin_WidgetCreator : public ModuleBase_IWidgetCreator -{ +/** + * \ingroup GUI + * Interface to WidgetCreator which can create specific widgets by type + */ +class ParametersPlugin_WidgetCreator : public ModuleBase_IWidgetCreator { public: /// Default constructor ParametersPlugin_WidgetCreator(); - /// Returns a container of possible widget types, which this creator can process - /// \param theTypes a list of type names - virtual void widgetTypes(std::set& theTypes); + /// Returns a container of possible widget types, which this creator can + /// process \param theTypes a list of type names + virtual void widgetTypes(std::set &theTypes); /// Create widget by its type /// The default implementation is empty @@ -48,10 +48,10 @@ public: /// \param theWidgetApi a low-level API for reading xml definitions of widgets /// \param theWorkshop a current workshop /// \return a created model widget or null - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* theWorkshop); + virtual ModuleBase_ModelWidget * + createWidgetByType(const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, + ModuleBase_IWorkshop *theWorkshop); }; #endif diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 9a8061a06..478f54a5d 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "ParametersPlugin_WidgetParamsMgr.h" @@ -23,84 +24,77 @@ #include -#include -#include -#include #include #include +#include +#include #include +#include +#include #include #include -#include #include #include -#include -#include #include +#include +#include -#include #include +#include +#include +#include +#include +#include #include +#include +#include #include -#include +#include #include -#include -#include #include -#include -#include -#include -#include -#include +#include #ifdef WIN32 #pragma warning(disable : 4456) // for nested foreach #endif -enum ColumnType { - Col_Name, - Col_Equation, - Col_Result, - Col_Comment -}; +enum ColumnType { Col_Name, Col_Equation, Col_Result, Col_Comment }; -const char* NoName = ""; -const char* NoValue = ""; +const char *NoName = ""; +const char *NoValue = ""; /*! * \ingroup GUI * ItemDelegate object in order to redefine items behavior */ -class ParametersPlugin_ItemDelegate : public QStyledItemDelegate -{ +class ParametersPlugin_ItemDelegate : public QStyledItemDelegate { public: /// Constructor /// \param thaParent a parent - ParametersPlugin_ItemDelegate(QObject* thaParent) : - QStyledItemDelegate(thaParent) {} + ParametersPlugin_ItemDelegate(QObject *thaParent) + : QStyledItemDelegate(thaParent) {} /// Redefinition of virtual method /// \param painter a painter object /// \param option the item options /// \param index the current index - virtual void paint(QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index ) const; + virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; /// Redefinition of virtual method /// \param parent a parent widget /// \param option the item options /// \param index the current index - virtual QWidget* createEditor(QWidget* parent, - const QStyleOptionViewItem& option, - const QModelIndex& index) const; + virtual QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; /// Returns True if the given index is editable item /// \param theIndex an item index - bool isEditable(const QModelIndex& theIndex) const; + bool isEditable(const QModelIndex &theIndex) const; /// Returns currently editing index QModelIndex editIndex() const { return myEditingIdx; } @@ -109,8 +103,8 @@ private: mutable QModelIndex myEditingIdx; }; -bool ParametersPlugin_ItemDelegate::isEditable(const QModelIndex& theIndex) const -{ +bool ParametersPlugin_ItemDelegate::isEditable( + const QModelIndex &theIndex) const { QModelIndex aParent = theIndex.parent(); if (aParent.isValid() && (aParent.row() == 0)) { if (theIndex.column() == 2) @@ -120,14 +114,13 @@ bool ParametersPlugin_ItemDelegate::isEditable(const QModelIndex& theIndex) cons return true; } -void ParametersPlugin_ItemDelegate::paint(QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index ) const -{ +void ParametersPlugin_ItemDelegate::paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const { QBrush aBrush = painter->brush(); QPen aPen = painter->pen(); - //if (!isEditable(index)) - // painter->setBrush(Qt::lightGray); + // if (!isEditable(index)) + // painter->setBrush(Qt::lightGray); if (!index.parent().isValid()) painter->setBrush(Qt::lightGray); @@ -139,18 +132,17 @@ void ParametersPlugin_ItemDelegate::paint(QPainter* painter, painter->setBrush(aBrush); } -QWidget* ParametersPlugin_ItemDelegate::createEditor(QWidget* parent, - const QStyleOptionViewItem& option, - const QModelIndex& index) const -{ +QWidget * +ParametersPlugin_ItemDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const { myEditingIdx = index; return QStyledItemDelegate::createEditor(parent, option, index); } ///////////////////////////////////////////////////////////////////////////////////////////////// -void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor, - QAbstractItemDelegate::EndEditHint theHint) -{ +void ParametersPlugin_TreeWidget::closeEditor( + QWidget *theEditor, QAbstractItemDelegate::EndEditHint theHint) { if (theHint == QAbstractItemDelegate::EditNextItem) { QModelIndex aCurrent = currentIndex(); QModelIndex aParent = model()->index(0, 0); @@ -184,12 +176,12 @@ void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor, ///////////////////////////////////////////////////////////////////////////////////////////////// -ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent, - const Config_WidgetAPI* theData, ModuleBase_IWorkshop* theWorkshop) - : ModuleBase_ModelDialogWidget(theParent, theData), - myWorkshop(theWorkshop), isUpplyBlocked(false) -{ - QVBoxLayout* aLayout = new QVBoxLayout(this); +ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr( + QWidget *theParent, const Config_WidgetAPI *theData, + ModuleBase_IWorkshop *theWorkshop) + : ModuleBase_ModelDialogWidget(theParent, theData), myWorkshop(theWorkshop), + isUpplyBlocked(false) { + QVBoxLayout *aLayout = new QVBoxLayout(this); myTable = new ParametersPlugin_TreeWidget(this); myTable->setColumnCount(4); @@ -205,31 +197,32 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theP myTable->setEditTriggers(QAbstractItemView::NoEditTriggers); myTable->setSelectionMode(QAbstractItemView::SingleSelection); - connect(myTable, SIGNAL(doubleClicked(const QModelIndex&)), - SLOT(onDoubleClick(const QModelIndex&))); + connect(myTable, SIGNAL(doubleClicked(const QModelIndex &)), + SLOT(onDoubleClick(const QModelIndex &))); connect(myTable, SIGNAL(itemSelectionChanged()), SLOT(onSelectionChanged())); myDelegate = new ParametersPlugin_ItemDelegate(myTable); - connect(myDelegate, SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)), - SLOT(onCloseEditor(QWidget*, QAbstractItemDelegate::EndEditHint))); + connect(myDelegate, + SIGNAL(closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)), + SLOT(onCloseEditor(QWidget *, QAbstractItemDelegate::EndEditHint))); myTable->setItemDelegate(myDelegate); aLayout->addWidget(myTable); // Define root nodes QStringList aNames; - aNames<setFlags(Qt::ItemIsEnabled); myTable->addTopLevelItem(myParameters); aNames.clear(); - aNames<setFlags(Qt::ItemIsEnabled); myTable->addTopLevelItem(myFeatures); - QHBoxLayout* aBtnLayout = new QHBoxLayout(this); + QHBoxLayout *aBtnLayout = new QHBoxLayout(this); myUpBtn = new QToolButton(this); myUpBtn->setArrowType(Qt::UpArrow); @@ -247,11 +240,13 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theP connect(myAddBtn, SIGNAL(clicked(bool)), SLOT(onAdd())); aBtnLayout->addWidget(myAddBtn); - QString aAddStr(Config_PropManager::string("Shortcuts", "add_parameter_shortcut").c_str()); + QString aAddStr( + Config_PropManager::string("Shortcuts", "add_parameter_shortcut") + .c_str()); if (aAddStr.isEmpty()) aAddStr = "Ctrl+A"; - QShortcut* aAddShc = new QShortcut(QKeySequence(aAddStr), myAddBtn); + QShortcut *aAddShc = new QShortcut(QKeySequence(aAddStr), myAddBtn); connect(aAddShc, SIGNAL(activated()), SLOT(onAdd())); myInsertBtn = new QPushButton(translate("Insert"), this); @@ -271,49 +266,48 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theP onSelectionChanged(); } -void ParametersPlugin_WidgetParamsMgr::setDialogButtons(QDialogButtonBox* theButtons) -{ +void ParametersPlugin_WidgetParamsMgr::setDialogButtons( + QDialogButtonBox *theButtons) { ModuleBase_ModelDialogWidget::setDialogButtons(theButtons); - QWidget* aBtnParentWgt = myOkCancelBtn->parentWidget(); - QHBoxLayout* aBtnParentLayout = dynamic_cast(aBtnParentWgt->layout()); + QWidget *aBtnParentWgt = myOkCancelBtn->parentWidget(); + QHBoxLayout *aBtnParentLayout = + dynamic_cast(aBtnParentWgt->layout()); - QPushButton* aPreviewBtn = new QPushButton(translate("See preview"), aBtnParentWgt); + QPushButton *aPreviewBtn = + new QPushButton(translate("See preview"), aBtnParentWgt); aBtnParentLayout->insertWidget(0, aPreviewBtn); aBtnParentLayout->insertStretch(1, 1); connect(aPreviewBtn, SIGNAL(clicked(bool)), SLOT(onShowPreview())); } - -QList ParametersPlugin_WidgetParamsMgr::getControls() const -{ - QList aList; +QList ParametersPlugin_WidgetParamsMgr::getControls() const { + QList aList; return aList; } -void ParametersPlugin_WidgetParamsMgr::selectItemScroll(QTreeWidgetItem* aItem) -{ +void ParametersPlugin_WidgetParamsMgr::selectItemScroll( + QTreeWidgetItem *aItem) { myTable->clearSelection(); QModelIndex aParent = myTable->model()->index(0, 0); int aChildIdx = myParameters->indexOfChild(aItem); QModelIndex aIndex = myTable->model()->index(aChildIdx, Col_Name, aParent); - myTable->selectionModel()->select(aIndex, - QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + myTable->selectionModel()->select(aIndex, QItemSelectionModel::SelectCurrent | + QItemSelectionModel::Rows); myTable->scrollToItem(aItem); } - -bool ParametersPlugin_WidgetParamsMgr::storeValueCustom() -{ +bool ParametersPlugin_WidgetParamsMgr::storeValueCustom() { ParametersPlugin_ExpressionValidator aValidator; std::list aArgs; std::string aAttrId = ParametersPlugin_Parameter::VARIABLE_ID(); Events_InfoMessage aErr; int aId = 0; - foreach(FeaturePtr aFeature, myParametersList) { + foreach (FeaturePtr aFeature, myParametersList) { if (!aValidator.isValid(aFeature->attribute(aAttrId), aArgs, aErr)) { - QMessageBox::warning(this, translate("Warning"), aErr.messageString().c_str()); + QMessageBox::warning(this, translate("Warning"), + aErr.messageString().c_str()); selectItemScroll(myParameters->child(aId)); return false; } @@ -327,13 +321,9 @@ bool ParametersPlugin_WidgetParamsMgr::storeValueCustom() return true; } -bool ParametersPlugin_WidgetParamsMgr::restoreValueCustom() -{ - return true; -} +bool ParametersPlugin_WidgetParamsMgr::restoreValueCustom() { return true; } -void ParametersPlugin_WidgetParamsMgr::activateCustom() -{ +void ParametersPlugin_WidgetParamsMgr::activateCustom() { updateParametersFeatures(); updateParametersPart(); updateFeaturesPart(); @@ -342,8 +332,7 @@ void ParametersPlugin_WidgetParamsMgr::activateCustom() myParameters->setExpanded(true); } -void ParametersPlugin_WidgetParamsMgr::updateParametersFeatures() -{ +void ParametersPlugin_WidgetParamsMgr::updateParametersFeatures() { myParametersList.clear(); FeaturePtr aFeature = feature(); DocumentPtr aDoc = aFeature->document(); @@ -352,38 +341,39 @@ void ParametersPlugin_WidgetParamsMgr::updateParametersFeatures() int aNbFeatures = aDoc->numInternalFeatures(); for (int i = 0; i < aNbFeatures; i++) { aParamFeature = aDoc->internalFeature(i); - if (aParamFeature && aParamFeature->getKind() == ParametersPlugin_Parameter::ID()) { + if (aParamFeature && + aParamFeature->getKind() == ParametersPlugin_Parameter::ID()) { myParametersList.append(aParamFeature); } } } -void ParametersPlugin_WidgetParamsMgr::updateFeaturesPart() -{ +void ParametersPlugin_WidgetParamsMgr::updateFeaturesPart() { QList aFeatureList; updateItem(myFeatures, featuresItems(myParametersList, aFeatureList)); } -void ParametersPlugin_WidgetParamsMgr::updateParametersPart() -{ +void ParametersPlugin_WidgetParamsMgr::updateParametersPart() { updateItem(myParameters, parametersItems(myParametersList)); bool aIsValid = isValid(); enableButtons(aIsValid); } - -QList ParametersPlugin_WidgetParamsMgr:: - featuresItems(const QList& theFeatures, QList& theFeatureList) const -{ +QList ParametersPlugin_WidgetParamsMgr::featuresItems( + const QList &theFeatures, + QList &theFeatureList) const { QList aItemsList; ResultParameterPtr aParam; - foreach(FeaturePtr aParameter, theFeatures) { - aParam = std::dynamic_pointer_cast(aParameter->firstResult()); - const std::set>& aRefs = aParam->data()->refsToMe(); - std::set >::const_iterator aIt; - for(aIt = aRefs.cbegin(); aIt != aRefs.cend(); aIt++) { + foreach (FeaturePtr aParameter, theFeatures) { + aParam = std::dynamic_pointer_cast( + aParameter->firstResult()); + const std::set> &aRefs = + aParam->data()->refsToMe(); + std::set>::const_iterator aIt; + for (aIt = aRefs.cbegin(); aIt != aRefs.cend(); aIt++) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aReferenced = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aReferenced = + std::dynamic_pointer_cast(aAttr->owner()); if (aReferenced.get() && (aReferenced != aParameter)) { if (aReferenced->getKind() == ParametersPlugin_Parameter::ID()) { // Find referenced feature Recursive @@ -399,34 +389,36 @@ QList ParametersPlugin_WidgetParamsMgr:: std::string aId = aAttr->attributeType(); if (aId == ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr aDouble = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); aValNames << QString::fromStdWString(aDouble->text()); aValNames << QString::number(aDouble->value()); - } - else if (aId == ModelAPI_AttributeInteger::typeId()) { + } else if (aId == ModelAPI_AttributeInteger::typeId()) { AttributeIntegerPtr aInt = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); aValNames << QString::fromStdWString(aInt->text()); aValNames << QString::number(aInt->value()); - } - else if (aId == GeomDataAPI_Point::typeId()) { + } else if (aId == GeomDataAPI_Point::typeId()) { std::shared_ptr aPnt = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); - QString aExpr = QString("%1,%2,%3").arg(QString::fromStdWString(aPnt->textX())). - arg(QString::fromStdWString(aPnt->textY())). - arg(QString::fromStdWString(aPnt->textZ())); + QString aExpr = QString("%1,%2,%3") + .arg(QString::fromStdWString(aPnt->textX())) + .arg(QString::fromStdWString(aPnt->textY())) + .arg(QString::fromStdWString(aPnt->textZ())); aValNames << aExpr; - QString aRes = QString("%1,%2,%3").arg(aPnt->x()).arg(aPnt->y()).arg(aPnt->z()); + QString aRes = QString("%1,%2,%3") + .arg(aPnt->x()) + .arg(aPnt->y()) + .arg(aPnt->z()); aValNames << aRes; - } - else if (aId == GeomDataAPI_Point2D::typeId()) { + } else if (aId == GeomDataAPI_Point2D::typeId()) { std::shared_ptr aPnt = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); - QString aExpr = QString("%1,%2").arg(QString::fromStdWString(aPnt->textX())). - arg(QString::fromStdWString(aPnt->textY())); + QString aExpr = QString("%1,%2") + .arg(QString::fromStdWString(aPnt->textX())) + .arg(QString::fromStdWString(aPnt->textY())); aValNames << aExpr; QString aRes = QString("%1,%2").arg(aPnt->x()).arg(aPnt->y()); @@ -442,104 +434,104 @@ QList ParametersPlugin_WidgetParamsMgr:: return aItemsList; } - -QList ParametersPlugin_WidgetParamsMgr:: - parametersItems(const QList& theFeatures) const -{ +QList ParametersPlugin_WidgetParamsMgr::parametersItems( + const QList &theFeatures) const { std::list aArgs; std::string aErr; QList aItemsList; - foreach(FeaturePtr aParameter, theFeatures) { + foreach (FeaturePtr aParameter, theFeatures) { ResultPtr aParam = aParameter->firstResult(); QStringList aValues; - std::string aName = aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->value(); + std::string aName = + aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->value(); if (aName.empty()) { aValues << translate(NoName); } else aValues << aName.c_str(); - std::string aExpr = aParameter->string(ParametersPlugin_Parameter::EXPRESSION_ID())->value(); + std::string aExpr = + aParameter->string(ParametersPlugin_Parameter::EXPRESSION_ID()) + ->value(); if (aName.empty()) { aValues << translate(NoValue); } else aValues << aExpr.c_str(); - aErr = aParameter->data()->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID())->value(); + aErr = aParameter->data() + ->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID()) + ->value(); if (aErr.empty()) { - AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + AttributeDoublePtr aValueAttribute = + aParam->data()->real(ModelAPI_ResultParameter::VALUE()); aValues << QString::number(aValueAttribute->value()); } else { aValues << aErr.c_str(); } - aValues << aParameter->string(ParametersPlugin_Parameter::COMMENT_ID())->value().c_str(); + aValues << aParameter->string(ParametersPlugin_Parameter::COMMENT_ID()) + ->value() + .c_str(); aItemsList.append(aValues); } return aItemsList; } - -void ParametersPlugin_WidgetParamsMgr::onDoubleClick(const QModelIndex& theIndex) -{ +void ParametersPlugin_WidgetParamsMgr::onDoubleClick( + const QModelIndex &theIndex) { if (myDelegate->isEditable(theIndex)) { myTable->setCurrentIndex(theIndex); myTable->edit(theIndex); } } -void ParametersPlugin_WidgetParamsMgr::onCloseEditor(QWidget* theEditor, - QAbstractItemDelegate::EndEditHint theHint) -{ +void ParametersPlugin_WidgetParamsMgr::onCloseEditor( + QWidget *theEditor, QAbstractItemDelegate::EndEditHint theHint) { FeaturePtr aFeature = myParametersList.at(myDelegate->editIndex().row()); - QTreeWidgetItem* aItem = myParameters->child(myDelegate->editIndex().row()); + QTreeWidgetItem *aItem = myParameters->child(myDelegate->editIndex().row()); int aColumn = myDelegate->editIndex().column(); int aRow = myDelegate->editIndex().row(); QString aText = aItem->text(aColumn); bool isModified = false; switch (aColumn) { - case Col_Name: - { - AttributeStringPtr aStringAttr = aFeature->string(ParametersPlugin_Parameter::VARIABLE_ID()); - if (!aText.isEmpty()) { - while (aText.indexOf(" ") != -1) { - aText.replace(" ", ""); - } - if (hasName(aText, aRow)) { - myMessage = translate("Name '%1' already exists.").arg(aText); - QTimer::singleShot(50, this, SLOT(sendWarning())); - return; - } - aStringAttr->setValue(aText.toStdString()); - isModified = true; + case Col_Name: { + AttributeStringPtr aStringAttr = + aFeature->string(ParametersPlugin_Parameter::VARIABLE_ID()); + if (!aText.isEmpty()) { + while (aText.indexOf(" ") != -1) { + aText.replace(" ", ""); + } + if (hasName(aText, aRow)) { + myMessage = translate("Name '%1' already exists.").arg(aText); + QTimer::singleShot(50, this, SLOT(sendWarning())); + return; } + aStringAttr->setValue(aText.toStdString()); + isModified = true; } - break; - case Col_Equation: - { - AttributeStringPtr aStringAttr = + } break; + case Col_Equation: { + AttributeStringPtr aStringAttr = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ID()); - if (!aText.isEmpty()) { - if (aText != aStringAttr->value().c_str()) { - aStringAttr->setValue(aText.toStdString()); - aFeature->execute(); - isModified = true; - } + if (!aText.isEmpty()) { + if (aText != aStringAttr->value().c_str()) { + aStringAttr->setValue(aText.toStdString()); + aFeature->execute(); + isModified = true; } } - break; - case Col_Comment: - { - AttributeStringPtr aStringAttr = aFeature->string(ParametersPlugin_Parameter::COMMENT_ID()); - aStringAttr->setValue(aText.toStdWString()); - isModified = true; - } - break; + } break; + case Col_Comment: { + AttributeStringPtr aStringAttr = + aFeature->string(ParametersPlugin_Parameter::COMMENT_ID()); + aStringAttr->setValue(aText.toStdWString()); + isModified = true; + } break; } if (!isModified) return; - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); @@ -551,11 +543,10 @@ void ParametersPlugin_WidgetParamsMgr::onCloseEditor(QWidget* theEditor, onSelectionChanged(); } -void ParametersPlugin_WidgetParamsMgr::updateItem(QTreeWidgetItem* theItem, - const QList& theFeaturesList) -{ +void ParametersPlugin_WidgetParamsMgr::updateItem( + QTreeWidgetItem *theItem, const QList &theFeaturesList) { if (theFeaturesList.count() != theItem->childCount()) { - if (theItem->childCount() < theFeaturesList.count()) { + if (theItem->childCount() < theFeaturesList.count()) { while (theItem->childCount() != theFeaturesList.count()) theItem->addChild(createNewItem(theItem)); } else { @@ -564,9 +555,9 @@ void ParametersPlugin_WidgetParamsMgr::updateItem(QTreeWidgetItem* theItem, } } int i = 0; - foreach(QStringList aFeature, theFeaturesList) { + foreach (QStringList aFeature, theFeaturesList) { int aCol = 0; - foreach(QString aText, aFeature) { + foreach (QString aText, aFeature) { if (aText.length() > 0) { theItem->child(i)->setText(aCol, aText); theItem->child(i)->setToolTip(aCol, aText); @@ -577,8 +568,7 @@ void ParametersPlugin_WidgetParamsMgr::updateItem(QTreeWidgetItem* theItem, } } -FeaturePtr ParametersPlugin_WidgetParamsMgr::createParameter() const -{ +FeaturePtr ParametersPlugin_WidgetParamsMgr::createParameter() const { SessionPtr aMgr = ModelAPI_Session::get(); std::shared_ptr aDoc = aMgr->activeDocument(); @@ -590,25 +580,23 @@ FeaturePtr ParametersPlugin_WidgetParamsMgr::createParameter() const return aFeature; } - -QTreeWidgetItem* ParametersPlugin_WidgetParamsMgr::createNewItem(QTreeWidgetItem* theParent) const -{ +QTreeWidgetItem *ParametersPlugin_WidgetParamsMgr::createNewItem( + QTreeWidgetItem *theParent) const { QStringList aValues; aValues << translate(NoName); aValues << translate(NoValue); - QTreeWidgetItem* aItem = new QTreeWidgetItem(aValues); + QTreeWidgetItem *aItem = new QTreeWidgetItem(aValues); if (theParent == myParameters) { - aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); + aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | + Qt::ItemIsEnabled); aItem->setForeground(2, Qt::darkGray); } else aItem->setFlags(Qt::NoItemFlags); return aItem; } - -void ParametersPlugin_WidgetParamsMgr::onAdd() -{ +void ParametersPlugin_WidgetParamsMgr::onAdd() { FeaturePtr aFeature = createParameter(); if (!aFeature.get()) return; @@ -616,7 +604,7 @@ void ParametersPlugin_WidgetParamsMgr::onAdd() myParametersList.append(aFeature); updateParametersPart(); - QTreeWidgetItem* aItem = myParameters->child(myParameters->childCount() - 1); + QTreeWidgetItem *aItem = myParameters->child(myParameters->childCount() - 1); myTable->scrollToItem(aItem); myTable->setCurrentItem(aItem); @@ -625,23 +613,20 @@ void ParametersPlugin_WidgetParamsMgr::onAdd() enableButtons(false); } -QTreeWidgetItem* ParametersPlugin_WidgetParamsMgr::selectedItem() const -{ - QList aItemsList = myTable->selectedItems(); +QTreeWidgetItem *ParametersPlugin_WidgetParamsMgr::selectedItem() const { + QList aItemsList = myTable->selectedItems(); if (aItemsList.count() == 0) return 0; - QTreeWidgetItem* aCurrentItem = aItemsList.first(); + QTreeWidgetItem *aCurrentItem = aItemsList.first(); if (aCurrentItem->parent() != myParameters) return 0; return aCurrentItem; } - -void ParametersPlugin_WidgetParamsMgr::onInsert() -{ - QTreeWidgetItem* aCurrentItem = selectedItem(); +void ParametersPlugin_WidgetParamsMgr::onInsert() { + QTreeWidgetItem *aCurrentItem = selectedItem(); if (!aCurrentItem) return; @@ -667,9 +652,8 @@ void ParametersPlugin_WidgetParamsMgr::onInsert() myTable->editItem(aCurrentItem); } -void ParametersPlugin_WidgetParamsMgr::onRemove() -{ - QTreeWidgetItem* aCurrentItem = selectedItem(); +void ParametersPlugin_WidgetParamsMgr::onRemove() { + QTreeWidgetItem *aCurrentItem = selectedItem(); if (!aCurrentItem) return; @@ -682,39 +666,42 @@ void ParametersPlugin_WidgetParamsMgr::onRemove() QObjectPtrList anObjects; anObjects.append(aCurFeature); - std::map > aReferences; + std::map> aReferences; std::set aFeatures; ModuleBase_Tools::convertToFeatures(anObjects, aFeatures); ModelAPI_Tools::findAllReferences(aFeatures, aReferences); std::set aFeatureRefsToDelete; - if (ModuleBase_Tools::askToDelete(aFeatures, aReferences, this, aFeatureRefsToDelete)) { + if (ModuleBase_Tools::askToDelete(aFeatures, aReferences, this, + aFeatureRefsToDelete)) { if (!aFeatureRefsToDelete.empty()) - aFeatures.insert(aFeatureRefsToDelete.begin(), aFeatureRefsToDelete.end()); + aFeatures.insert(aFeatureRefsToDelete.begin(), + aFeatureRefsToDelete.end()); ModelAPI_Tools::removeFeatures(aFeatures, false); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); updateParametersFeatures(); updateFeaturesPart(); updateParametersPart(); } } -void ParametersPlugin_WidgetParamsMgr::onImport() -{ +void ParametersPlugin_WidgetParamsMgr::onImport() { std::string aWinText("Select txt file"); std::string aFileType("Text files (*.txt);;All files (*.*)"); - QString aQPath = QFileDialog::getOpenFileName(nullptr, - aWinText.c_str(), "", + QString aQPath = QFileDialog::getOpenFileName(nullptr, aWinText.c_str(), "", aFileType.c_str()); if (aQPath.size() == 0) return; std::string aPath(aQPath.toStdString()); std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_ImportParametersMessage(ModelAPI_ImportParametersMessage::eventId())); + std::shared_ptr( + new ModelAPI_ImportParametersMessage( + ModelAPI_ImportParametersMessage::eventId())); aMessage->setFilename(aPath); Events_Loop::loop()->send(aMessage); @@ -722,9 +709,8 @@ void ParametersPlugin_WidgetParamsMgr::onImport() updateParametersPart(); } -void ParametersPlugin_WidgetParamsMgr::onUp() -{ - QTreeWidgetItem* aCurrentItem = selectedItem(); +void ParametersPlugin_WidgetParamsMgr::onUp() { + QTreeWidgetItem *aCurrentItem = selectedItem(); if (!aCurrentItem) return; @@ -742,13 +728,19 @@ void ParametersPlugin_WidgetParamsMgr::onUp() aDoc->moveFeature(aCurFeature, myParametersList.at(aCurrentPos - 2)); // add the updated also the feature that goes down - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); - static Events_ID EVENT_UPD = Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); - ModelAPI_EventCreator::get()->sendUpdated(myParametersList.at(aCurrentPos - 1), EVENT_UPD); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); + static Events_ID EVENT_UPD = + Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); + ModelAPI_EventCreator::get()->sendUpdated( + myParametersList.at(aCurrentPos - 1), EVENT_UPD); Events_Loop::loop()->flush(EVENT_UPD); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); updateParametersFeatures(); updateParametersPart(); updateFeaturesPart(); @@ -760,9 +752,8 @@ void ParametersPlugin_WidgetParamsMgr::onUp() } } -void ParametersPlugin_WidgetParamsMgr::onDown() -{ - QTreeWidgetItem* aCurrentItem = selectedItem(); +void ParametersPlugin_WidgetParamsMgr::onDown() { + QTreeWidgetItem *aCurrentItem = selectedItem(); if (!aCurrentItem) return; @@ -775,14 +766,21 @@ void ParametersPlugin_WidgetParamsMgr::onDown() std::shared_ptr aDoc = aMgr->activeDocument(); aDoc->moveFeature(aCurFeature, myParametersList.at(aCurrentPos + 1)); // add the updated also the feature that goes up - static Events_ID EVENT_UPD = Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); - ModelAPI_EventCreator::get()->sendUpdated(myParametersList.at(aCurrentPos + 1), EVENT_UPD); - - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)); - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + static Events_ID EVENT_UPD = + Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); + ModelAPI_EventCreator::get()->sendUpdated( + myParametersList.at(aCurrentPos + 1), EVENT_UPD); + + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)); + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); updateParametersFeatures(); updateParametersPart(); updateFeaturesPart(); @@ -794,11 +792,10 @@ void ParametersPlugin_WidgetParamsMgr::onDown() } } - -bool ParametersPlugin_WidgetParamsMgr::hasName(const QString& theName, int theIndex) const -{ +bool ParametersPlugin_WidgetParamsMgr::hasName(const QString &theName, + int theIndex) const { int i = 0; - foreach(FeaturePtr aFeature, myParametersList) { + foreach (FeaturePtr aFeature, myParametersList) { if ((i != theIndex) && (aFeature->data()->name() == theName.toStdWString())) return true; i++; @@ -806,34 +803,32 @@ bool ParametersPlugin_WidgetParamsMgr::hasName(const QString& theName, int theIn return false; } -void ParametersPlugin_WidgetParamsMgr::sendWarning() -{ +void ParametersPlugin_WidgetParamsMgr::sendWarning() { QMessageBox::warning(this, translate("Warning"), myMessage); - QTreeWidgetItem* aItem = myTable->currentItem(); + QTreeWidgetItem *aItem = myTable->currentItem(); if (aItem) myTable->editItem(aItem); } -void ParametersPlugin_WidgetParamsMgr::onSelectionChanged() -{ - QList aItemsList = myTable->selectedItems(); +void ParametersPlugin_WidgetParamsMgr::onSelectionChanged() { + QList aItemsList = myTable->selectedItems(); bool aIsValid = isValid(); if (aIsValid) { bool isParameter = false; - foreach(QTreeWidgetItem* aItem, aItemsList) { + foreach (QTreeWidgetItem *aItem, aItemsList) { if (aItem->parent() == myParameters) { isParameter = true; break; } } myInsertBtn->setEnabled(isParameter); - //myRemoveBtn->setEnabled(isParameter); + // myRemoveBtn->setEnabled(isParameter); myUpBtn->setEnabled(isParameter); myDownBtn->setEnabled(isParameter); myImportBtn->setEnabled(true); } else { myInsertBtn->setEnabled(false); - //myRemoveBtn->setEnabled(false); + // myRemoveBtn->setEnabled(false); myUpBtn->setEnabled(false); myDownBtn->setEnabled(false); myImportBtn->setEnabled(false); @@ -841,14 +836,13 @@ void ParametersPlugin_WidgetParamsMgr::onSelectionChanged() myRemoveBtn->setEnabled(!aItemsList.isEmpty()); } -void ParametersPlugin_WidgetParamsMgr::enableButtons(bool theEnable) -{ +void ParametersPlugin_WidgetParamsMgr::enableButtons(bool theEnable) { myAddBtn->setEnabled(theEnable); if (theEnable) onSelectionChanged(); else { myInsertBtn->setEnabled(theEnable); - //myRemoveBtn->setEnabled(theEnable); + // myRemoveBtn->setEnabled(theEnable); myUpBtn->setEnabled(theEnable); myDownBtn->setEnabled(theEnable); myImportBtn->setEnabled(theEnable); @@ -856,40 +850,37 @@ void ParametersPlugin_WidgetParamsMgr::enableButtons(bool theEnable) myOkCancelBtn->button(QDialogButtonBox::Ok)->setEnabled(theEnable); } -bool ParametersPlugin_WidgetParamsMgr::isValid() -{ - QTreeWidgetItem* aItem; - for(int i = 0; i < myParameters->childCount(); i++) { +bool ParametersPlugin_WidgetParamsMgr::isValid() { + QTreeWidgetItem *aItem; + for (int i = 0; i < myParameters->childCount(); i++) { aItem = myParameters->child(i); if ((aItem->text(Col_Name) == NoName) || (aItem->text(Col_Equation) == translate(NoValue)) || - (!ModelAPI_Expression::isVariable(aItem->text(Col_Name).toStdString())) || - (hasName(aItem->text(Col_Name), i)) ) { + (!ModelAPI_Expression::isVariable( + aItem->text(Col_Name).toStdString())) || + (hasName(aItem->text(Col_Name), i))) { return false; } } return true; } -void ParametersPlugin_WidgetParamsMgr::showEvent(QShowEvent* theEvent) -{ +void ParametersPlugin_WidgetParamsMgr::showEvent(QShowEvent *theEvent) { ModuleBase_ModelDialogWidget::showEvent(theEvent); SessionPtr aMgr = ModelAPI_Session::get(); isUpplyBlocked = aMgr->isAutoUpdateBlocked(); aMgr->blockAutoUpdate(true); - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); aLoop->flush(aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE)); } -void ParametersPlugin_WidgetParamsMgr::hideEvent(QHideEvent* theEvent) -{ +void ParametersPlugin_WidgetParamsMgr::hideEvent(QHideEvent *theEvent) { ModuleBase_ModelDialogWidget::hideEvent(theEvent); SessionPtr aMgr = ModelAPI_Session::get(); aMgr->blockAutoUpdate(isUpplyBlocked); } -void ParametersPlugin_WidgetParamsMgr::onShowPreview() -{ +void ParametersPlugin_WidgetParamsMgr::onShowPreview() { SessionPtr aMgr = ModelAPI_Session::get(); aMgr->blockAutoUpdate(false); aMgr->blockAutoUpdate(true); diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h index fe2167449..9bcf1c621 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef ParametersPlugin_WidgetParamsMgr_H_ #define ParametersPlugin_WidgetParamsMgr_H_ #include -#include #include +#include #include class QTreeWidgetItem; @@ -35,45 +36,45 @@ class ModuleBase_IWorkshop; * \ingroup GUI * Redefinition of QTreeWidget for processing of closeEditor event */ -class ParametersPlugin_TreeWidget: public QTreeWidget -{ - Q_OBJECT +class ParametersPlugin_TreeWidget : public QTreeWidget { + Q_OBJECT public: /// Constructor /// \param theParent a parent widget - ParametersPlugin_TreeWidget(QWidget* theParent = 0) : QTreeWidget(theParent) {} + ParametersPlugin_TreeWidget(QWidget *theParent = 0) + : QTreeWidget(theParent) {} protected slots: /// Redefinition of virtual method /// \param theEditor a editor widget /// \param theHint end of editing hint - virtual void closeEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint); + virtual void closeEditor(QWidget *theEditor, + QAbstractItemDelegate::EndEditHint theHint); }; - - /*! * \ingroup GUI - * Represent a content of the property panel to show/modify parameters of some feature. + * Represent a content of the property panel to show/modify parameters of some + * feature. */ -class ParametersPlugin_WidgetParamsMgr : public ModuleBase_ModelDialogWidget -{ - Q_OBJECT +class ParametersPlugin_WidgetParamsMgr : public ModuleBase_ModelDialogWidget { + Q_OBJECT public: /// Constructs a model widget - ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData, - ModuleBase_IWorkshop* theWorkshop); + ParametersPlugin_WidgetParamsMgr(QWidget *theParent, + const Config_WidgetAPI *theData, + ModuleBase_IWorkshop *theWorkshop); /// Destructs the model widget virtual ~ParametersPlugin_WidgetParamsMgr() {} /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Set general buttons from dialog /// \param theButtons the dialog buttons - virtual void setDialogButtons(QDialogButtonBox* theButtons); + virtual void setDialogButtons(QDialogButtonBox *theButtons); protected: /// Saves the internal parameters to the given feature @@ -86,19 +87,20 @@ protected: /// The method called when widget is activated virtual void activateCustom(); - virtual void showEvent(QShowEvent* theEvent); + virtual void showEvent(QShowEvent *theEvent); - virtual void hideEvent(QHideEvent* theEvent); + virtual void hideEvent(QHideEvent *theEvent); private slots: /// Slot for reaction on double click in the table (start editing) /// \param theIndex the clicked index - void onDoubleClick(const QModelIndex& theIndex); + void onDoubleClick(const QModelIndex &theIndex); /// Slot for reaction on end of cell editing /// \param theEditor the editor widget /// \param theHint end of edit type - void onCloseEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint); + void onCloseEditor(QWidget *theEditor, + QAbstractItemDelegate::EndEditHint theHint); /// Slot for reaction on add parameter void onAdd(); @@ -132,16 +134,17 @@ private: FeaturePtr createParameter() const; /// Creates a new item - QTreeWidgetItem* createNewItem(QTreeWidgetItem* theParent) const; + QTreeWidgetItem *createNewItem(QTreeWidgetItem *theParent) const; /// Returns currently selected item - QTreeWidgetItem* selectedItem() const; + QTreeWidgetItem *selectedItem() const; /// Select the given Item and scroll the table to make it visible - void selectItemScroll(QTreeWidgetItem* theItem); + void selectItemScroll(QTreeWidgetItem *theItem); /// Update values in features part - void updateItem(QTreeWidgetItem* theItem, const QList& theFeaturesList); + void updateItem(QTreeWidgetItem *theItem, + const QList &theFeaturesList); void updateFeaturesPart(); @@ -151,37 +154,37 @@ private: bool isValid(); /// Returns true if parameter with the given name already exists - bool hasName(const QString& theName, int theIndex) const; + bool hasName(const QString &theName, int theIndex) const; /// Enable or disable buttons for parameters managemnt void enableButtons(bool theEnable); - QList featuresItems(const QList& theFeatures, - QList& theFeatureList) const; - QList parametersItems(const QList& theFeatures) const; + QList featuresItems(const QList &theFeatures, + QList &theFeatureList) const; + QList + parametersItems(const QList &theFeatures) const; void updateParametersFeatures(); - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; - ParametersPlugin_TreeWidget* myTable; - QTreeWidgetItem* myFeatures; - QTreeWidgetItem* myParameters; - ParametersPlugin_ItemDelegate* myDelegate; + ParametersPlugin_TreeWidget *myTable; + QTreeWidgetItem *myFeatures; + QTreeWidgetItem *myParameters; + ParametersPlugin_ItemDelegate *myDelegate; QList myParametersList; QString myMessage; - QPushButton* myAddBtn; - QPushButton* myInsertBtn; - QPushButton* myRemoveBtn; - QPushButton* myImportBtn; - QToolButton* myUpBtn; - QToolButton* myDownBtn; + QPushButton *myAddBtn; + QPushButton *myInsertBtn; + QPushButton *myRemoveBtn; + QPushButton *myImportBtn; + QToolButton *myUpBtn; + QToolButton *myDownBtn; bool isUpplyBlocked; }; - -#endif \ No newline at end of file +#endif diff --git a/src/ParametersPlugin/Test/data/parameters.txt b/src/ParametersPlugin/Test/data/parameters.txt index ca3185fdb..8f5f7ce2b 100644 --- a/src/ParametersPlugin/Test/data/parameters.txt +++ b/src/ParametersPlugin/Test/data/parameters.txt @@ -2,4 +2,4 @@ Longueur 36. # "Longueur de la pièce" Largeur 24. # Largeur de la pièce Hauteur Longueur*Largeur A12 5. * 5. -Longueur2 36. #\"Comment\" #Comm #Comm \ No newline at end of file +Longueur2 36. #\"Comment\" #Comm #Comm diff --git a/src/ParametersPlugin/doc/ParametersPlugin.rst b/src/ParametersPlugin/doc/ParametersPlugin.rst index ad5f5ebb2..157e643ca 100644 --- a/src/ParametersPlugin/doc/ParametersPlugin.rst +++ b/src/ParametersPlugin/doc/ParametersPlugin.rst @@ -12,4 +12,3 @@ The Parameters plug-in includes the following features: parameterFeature.rst managerFeature.rst - diff --git a/src/ParametersPlugin/doc/TUI_parameterFeature.rst b/src/ParametersPlugin/doc/TUI_parameterFeature.rst index 04480ce43..d7649ba1b 100644 --- a/src/ParametersPlugin/doc/TUI_parameterFeature.rst +++ b/src/ParametersPlugin/doc/TUI_parameterFeature.rst @@ -8,6 +8,5 @@ Create Parameter :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` :download:`Download parameters file sample ` - diff --git a/src/ParametersPlugin/doc/examples/File.txt b/src/ParametersPlugin/doc/examples/File.txt index 5ab7e7825..31f96f6fe 100644 --- a/src/ParametersPlugin/doc/examples/File.txt +++ b/src/ParametersPlugin/doc/examples/File.txt @@ -1,3 +1,3 @@ Width 10.0 #Width of square Height 15.0 # Height of square -Area Width*Height # Area of square \ No newline at end of file +Area Width*Height # Area of square diff --git a/src/ParametersPlugin/doc/managerFeature.rst b/src/ParametersPlugin/doc/managerFeature.rst index fe1ed998d..f99753efc 100644 --- a/src/ParametersPlugin/doc/managerFeature.rst +++ b/src/ParametersPlugin/doc/managerFeature.rst @@ -11,7 +11,7 @@ To create/edit simultaneously a set of parameters in the active partset or part #. click |paper_roll.icon| **Parameters** button in the toolbar: The following dialog box with parameter table appears: - + .. figure:: images/parameters.png :align: center @@ -25,19 +25,19 @@ To edit a parameter, double-click on parameter in object browser. **Input fields**: - **Name** defines parameter name. Name follows the naming rules of the python language for variables; -- **Expression** allows manual input of python expression; +- **Expression** allows manual input of python expression; - **Result** evaluates expression as real number by python *eval()* function; - **Comment** contains any text. This field is optional; -- **Add** button adds a new empty string in the end of table. Default **Name** is **, **Expression** is ** +- **Add** button adds a new empty string in the end of table. Default **Name** is **, **Expression** is ** - **Insert** button adds a new empty string before the selected parameter; -- **Delete** button removes the selected parameter from the table; +- **Delete** button removes the selected parameter from the table; - **Import** button import parameters from .txt files. Parameters must be written in file in separate lines like example: **Name** **Expression** #**Comment** Sample.txt: ''Longueur 36. # Longueur de la pièce'' ''Largeur 24 #Largeur de la pièce'' ''Hauteur Longueur * Largeur'' - **Modify parameter position** button moves the selected parameter - + | |param_up| one string higher in the table, | |param_down| one string lower in the table. diff --git a/src/ParametersPlugin/doc/parameterFeature.rst b/src/ParametersPlugin/doc/parameterFeature.rst index 24e6bc06a..b416c514b 100644 --- a/src/ParametersPlugin/doc/parameterFeature.rst +++ b/src/ParametersPlugin/doc/parameterFeature.rst @@ -14,7 +14,7 @@ To create a parameter in the active partset or part: The following property panel appears. - + .. figure:: images/parameter.png :align: center @@ -51,7 +51,7 @@ Write error in Python console if: Result ------ -The created parameter and its current value are displayed in the Object Browser, in a special section **Parameters**. +The created parameter and its current value are displayed in the Object Browser, in a special section **Parameters**. .. figure:: images/object_browser_parameter.png :align: center diff --git a/src/PartSet/PartSet.h b/src/PartSet/PartSet.h index 9a0aaf94b..1cd8303d2 100644 --- a/src/PartSet/PartSet.h +++ b/src/PartSet/PartSet.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARTSET_H @@ -22,16 +23,16 @@ #if defined PARTSET_EXPORTS #if defined WIN32 -#define PARTSET_EXPORT __declspec( dllexport ) +#define PARTSET_EXPORT __declspec(dllexport) #else #define PARTSET_EXPORT #endif #else #if defined WIN32 -#define PARTSET_EXPORT __declspec( dllimport ) +#define PARTSET_EXPORT __declspec(dllimport) #else #define PARTSET_EXPORT #endif #endif -#endif //PARTSET_H +#endif // PARTSET_H diff --git a/src/PartSet/PartSet_BSplineWidget.cpp b/src/PartSet/PartSet_BSplineWidget.cpp index 61b116b23..0d5e2aced 100644 --- a/src/PartSet/PartSet_BSplineWidget.cpp +++ b/src/PartSet/PartSet_BSplineWidget.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -32,26 +33,23 @@ #include #include #include -#include #include #include - +#include static const double THE_MIN_WEIGHT = 1.e-7; -PartSet_BSplineWidget::PartSet_BSplineWidget( - QWidget* theParent, - const Config_WidgetAPI* theData) - : ModuleBase_ModelWidget(theParent, theData) -{ - QVBoxLayout* aMainLayout = new QVBoxLayout(this); +PartSet_BSplineWidget::PartSet_BSplineWidget(QWidget *theParent, + const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData) { + QVBoxLayout *aMainLayout = new QVBoxLayout(this); aMainLayout->setContentsMargins(0, 0, 0, 0); // GroupBox to keep widgets for B-spline poles and weights myPolesGroupBox = new QGroupBox(translate("Poles and weights"), this); aMainLayout->addWidget(myPolesGroupBox); - QVBoxLayout* aLayout = new QVBoxLayout(myPolesGroupBox); + QVBoxLayout *aLayout = new QVBoxLayout(myPolesGroupBox); ModuleBase_Tools::adjustMargins(aLayout); myScrollArea = new QScrollArea(myPolesGroupBox); @@ -60,13 +58,13 @@ PartSet_BSplineWidget::PartSet_BSplineWidget( myScrollArea->setFrameStyle(QFrame::NoFrame); aLayout->addWidget(myScrollArea); - QWidget* aContainer = new QWidget(myScrollArea); - QVBoxLayout* aBoxLay = new QVBoxLayout(aContainer); + QWidget *aContainer = new QWidget(myScrollArea); + QVBoxLayout *aBoxLay = new QVBoxLayout(aContainer); aBoxLay->setContentsMargins(0, 0, 0, 0); // layout of GroupBox myPolesWgt = new QWidget(aContainer); - QGridLayout* aGroupLayout = new QGridLayout(myPolesWgt); + QGridLayout *aGroupLayout = new QGridLayout(myPolesWgt); aGroupLayout->setColumnStretch(1, 1); ModuleBase_Tools::adjustMargins(aGroupLayout); @@ -76,32 +74,29 @@ PartSet_BSplineWidget::PartSet_BSplineWidget( myScrollArea->setWidget(aContainer); } -void PartSet_BSplineWidget::setFeature(const FeaturePtr& theFeature, - const bool theToStoreValue, - const bool isUpdateFlushed) -{ - ModuleBase_ModelWidget::setFeature(theFeature, theToStoreValue, isUpdateFlushed); +void PartSet_BSplineWidget::setFeature(const FeaturePtr &theFeature, + const bool theToStoreValue, + const bool isUpdateFlushed) { + ModuleBase_ModelWidget::setFeature(theFeature, theToStoreValue, + isUpdateFlushed); restoreValueCustom(); } -void PartSet_BSplineWidget::deactivate() -{ +void PartSet_BSplineWidget::deactivate() { ModuleBase_ModelWidget::deactivate(); storeValueCustom(); } - -QList PartSet_BSplineWidget::getControls() const -{ - QList aControls; +QList PartSet_BSplineWidget::getControls() const { + QList aControls; aControls.append(myScrollArea); return aControls; } -void PartSet_BSplineWidget::storePolesAndWeights() const -{ +void PartSet_BSplineWidget::storePolesAndWeights() const { std::shared_ptr aData = myFeature->data(); - AttributeDoubleArrayPtr aWeightsArray = aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); + AttributeDoubleArrayPtr aWeightsArray = + aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); std::list::const_iterator anIt = myPoles.begin(); for (int anIndex = 0; anIt != myPoles.end(); ++anIndex, ++anIt) { @@ -112,13 +107,13 @@ void PartSet_BSplineWidget::storePolesAndWeights() const } } -bool PartSet_BSplineWidget::storeValueCustom() -{ +bool PartSet_BSplineWidget::storeValueCustom() { std::shared_ptr aData = myFeature->data(); if (!aData || !aData->isValid()) // can be on abort of sketcher element return false; - AttributeDoubleArrayPtr aWeights = aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); + AttributeDoubleArrayPtr aWeights = + aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); bool isBlocked = blockSignals(true); storePolesAndWeights(); @@ -129,16 +124,17 @@ bool PartSet_BSplineWidget::storeValueCustom() return true; } -bool PartSet_BSplineWidget::restoreValueCustom() -{ +bool PartSet_BSplineWidget::restoreValueCustom() { if (!myFeature) return false; DataPtr aData = myFeature->data(); - AttributePoint2DArrayPtr aPoles = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_BSpline::POLES_ID())); - AttributeDoubleArrayPtr aWeights = aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); + AttributePoint2DArrayPtr aPoles = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_BSpline::POLES_ID())); + AttributeDoubleArrayPtr aWeights = + aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); while ((int)myPoles.size() < aPoles->size()) addPoleWidget(); @@ -156,22 +152,22 @@ bool PartSet_BSplineWidget::restoreValueCustom() return true; } -void PartSet_BSplineWidget::addPoleWidget() -{ - QGridLayout* aGroupLay = dynamic_cast(myPolesWgt->layout()); +void PartSet_BSplineWidget::addPoleWidget() { + QGridLayout *aGroupLay = dynamic_cast(myPolesWgt->layout()); int aNbPoles = (int)myPoles.size(); QString aPoleStr = translate("Pole %1").arg(aNbPoles + 1); myPoles.push_back(BSplinePoleWidgets()); - BSplinePoleWidgets& aPole = myPoles.back(); - aGroupLay->addWidget(createPoleWidget(aPole, aPoleStr, myPolesWgt), aNbPoles, 1); + BSplinePoleWidgets &aPole = myPoles.back(); + aGroupLay->addWidget(createPoleWidget(aPole, aPoleStr, myPolesWgt), aNbPoles, + 1); } -QGroupBox* PartSet_BSplineWidget::createPoleWidget(BSplinePoleWidgets& thePole, - const QString& theName, QWidget* theParent) -{ - QGroupBox* aPoleGroupBox = new QGroupBox(theName, theParent); - QGridLayout* aPoleLay = new QGridLayout(aPoleGroupBox); +QGroupBox *PartSet_BSplineWidget::createPoleWidget(BSplinePoleWidgets &thePole, + const QString &theName, + QWidget *theParent) { + QGroupBox *aPoleGroupBox = new QGroupBox(theName, theParent); + QGridLayout *aPoleLay = new QGridLayout(aPoleGroupBox); aPoleLay->setSpacing(0); ModuleBase_Tools::zeroMargins(aPoleLay); @@ -184,9 +180,10 @@ QGroupBox* PartSet_BSplineWidget::createPoleWidget(BSplinePoleWidgets& thePole, aPoleLay->addWidget(new QLabel(translate("Weight :"), aPoleGroupBox), 2, 0); aPoleLay->addWidget(thePole.myWeight, 2, 1); - // we should listen textChanged signal as valueChanged do not send when text is modified - connect(thePole.myWeight, SIGNAL(textChanged(const QString&)), - this, SIGNAL(valuesChanged())); + // we should listen textChanged signal as valueChanged do not send when text + // is modified + connect(thePole.myWeight, SIGNAL(textChanged(const QString &)), this, + SIGNAL(valuesChanged())); thePole.myAddBtn = new QToolButton(aPoleGroupBox); thePole.myAddBtn->setIcon(QIcon(":pictures/add.png")); @@ -197,10 +194,8 @@ QGroupBox* PartSet_BSplineWidget::createPoleWidget(BSplinePoleWidgets& thePole, return aPoleGroupBox; } - -void PartSet_BSplineWidget::onAddPole() -{ - QObject* aObj = sender(); +void PartSet_BSplineWidget::onAddPole() { + QObject *aObj = sender(); std::list::const_iterator aIt; int aId = 0; bool aFound = false; @@ -213,7 +208,8 @@ void PartSet_BSplineWidget::onAddPole() if (aFound) { // add a new pole after found Id std::ostringstream anActionName; - anActionName << SketchPlugin_BSplineBase::ADD_POLE_ACTION_ID() << "#" << aId; + anActionName << SketchPlugin_BSplineBase::ADD_POLE_ACTION_ID() << "#" + << aId; if (feature()->customAction(anActionName.str())) updateObject(feature()); diff --git a/src/PartSet/PartSet_BSplineWidget.h b/src/PartSet/PartSet_BSplineWidget.h index 841cae328..f9d931844 100644 --- a/src/PartSet/PartSet_BSplineWidget.h +++ b/src/PartSet/PartSet_BSplineWidget.h @@ -14,13 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_BSplineWidget_H #define PartSet_BSplineWidget_H - #include #include @@ -33,18 +33,17 @@ class QGroupBox; class QScrollArea; class QToolButton; -/** \brief Represent a content of the property panel to show/modify parameters of B-spline curve. - * \ingroup GUI +/** \brief Represent a content of the property panel to show/modify parameters + * of B-spline curve. \ingroup GUI */ -class PartSet_BSplineWidget : public ModuleBase_ModelWidget -{ -Q_OBJECT +class PartSet_BSplineWidget : public ModuleBase_ModelWidget { + Q_OBJECT public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_BSplineWidget(QWidget* theParent, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_BSplineWidget(QWidget *theParent, const Config_WidgetAPI *theData); virtual ~PartSet_BSplineWidget() {} @@ -53,13 +52,15 @@ public: /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Set feature which is processing by active operation /// \param theFeature a feature object - /// \param theToStoreValue a value about necessity to store the widget value to the feature - /// \param isUpdateFlushed a flag if update should be flushed on store value - virtual void setFeature(const FeaturePtr& theFeature, const bool theToStoreValue = false, + /// \param theToStoreValue a value about necessity to store the widget value + /// to the feature \param isUpdateFlushed a flag if update should be flushed + /// on store value + virtual void setFeature(const FeaturePtr &theFeature, + const bool theToStoreValue = false, const bool isUpdateFlushed = true); protected: @@ -81,20 +82,20 @@ private slots: private: struct BSplinePoleWidgets { - ModuleBase_LabelValue* myX; - ModuleBase_LabelValue* myY; - ModuleBase_ParamSpinBox* myWeight; - QToolButton* myAddBtn; + ModuleBase_LabelValue *myX; + ModuleBase_LabelValue *myY; + ModuleBase_ParamSpinBox *myWeight; + QToolButton *myAddBtn; }; - QGroupBox* createPoleWidget(BSplinePoleWidgets& thePole, - const QString& theName, - QWidget* theParent); + QGroupBox *createPoleWidget(BSplinePoleWidgets &thePole, + const QString &theName, QWidget *theParent); - QWidget* myPolesWgt; ///< widget to show poles and weights of B-spline curve - QGroupBox* myPolesGroupBox; - QScrollArea* myScrollArea; - std::list myPoles; ///< list of B-spline poles and their weights + QWidget *myPolesWgt; ///< widget to show poles and weights of B-spline curve + QGroupBox *myPolesGroupBox; + QScrollArea *myScrollArea; + std::list + myPoles; ///< list of B-spline poles and their weights }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_CenterPrs.cpp b/src/PartSet/PartSet_CenterPrs.cpp index 997e6620a..9de8c3a03 100644 --- a/src/PartSet/PartSet_CenterPrs.cpp +++ b/src/PartSet/PartSet_CenterPrs.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PartSet_CenterPrs.cpp @@ -23,32 +24,25 @@ #include "PartSet_CenterPrs.h" -#include +#include #include -#include -#include #include -#include - +#include +#include +#include IMPLEMENT_STANDARD_RTTIEXT(PartSet_CenterPrs, AIS_Point) - -PartSet_CenterPrs::PartSet_CenterPrs(const ObjectPtr& theObject, - const GeomEdgePtr& theEdge, - const gp_Pnt& theCenter, - ModelAPI_AttributeSelection::CenterType theType) - : AIS_Point(new Geom_CartesianPoint(theCenter)), - myObject(theObject), - myEdge(theEdge), - myCenterType(theType) -{ +PartSet_CenterPrs::PartSet_CenterPrs( + const ObjectPtr &theObject, const GeomEdgePtr &theEdge, + const gp_Pnt &theCenter, ModelAPI_AttributeSelection::CenterType theType) + : AIS_Point(new Geom_CartesianPoint(theCenter)), myObject(theObject), + myEdge(theEdge), myCenterType(theType) { SetAutoHilight(Standard_False); } -void PartSet_CenterPrs::drawPoint(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) -{ +void PartSet_CenterPrs::drawPoint(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) { Handle(Prs3d_Drawer) aDrawer = HilightAttributes(); Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect(); @@ -61,8 +55,8 @@ void PartSet_CenterPrs::drawPoint(const Handle(Prs3d_Presentation)& thePrs, Handle(Graphic3d_Group) TheGroup = thePrs->CurrentGroup(); TheGroup->SetPrimitivesAspect(PtA); - Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints (1); - aPoint->AddVertex(aPnt->X(),aPnt->Y(),aPnt->Z()); + Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints(1); + aPoint->AddVertex(aPnt->X(), aPnt->Y(), aPnt->Z()); TheGroup->AddPrimitiveArray(aPoint); PtA = new Graphic3d_AspectMarker3d(); @@ -70,13 +64,13 @@ void PartSet_CenterPrs::drawPoint(const Handle(Prs3d_Presentation)& thePrs, PtA->SetScale(5.); PtA->SetColor(theColor); TheGroup->SetPrimitivesAspect(PtA); - TheGroup->AddPrimitiveArray (aPoint); + TheGroup->AddPrimitiveArray(aPoint); } -void PartSet_CenterPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& PM, - const SelectMgr_SequenceOfOwner& /*Seq*/) -{ - Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( PM ); +void PartSet_CenterPrs::HilightSelected( + const Handle(PrsMgr_PresentationManager3d) & PM, + const SelectMgr_SequenceOfOwner & /*Seq*/) { + Handle(Prs3d_Presentation) aSelectionPrs = GetSelectPresentation(PM); aSelectionPrs->Clear(); drawPoint(aSelectionPrs, GetContext()->SelectionStyle()->Color()); @@ -86,11 +80,11 @@ void PartSet_CenterPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3 PM->Color(this, GetContext()->SelectionStyle()); } -void PartSet_CenterPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& /*theOwner*/) -{ - Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM ); +void PartSet_CenterPrs::HilightOwnerWithColor( + const Handle(PrsMgr_PresentationManager3d) & thePM, + const Handle(Prs3d_Drawer) & theStyle, const Handle(SelectMgr_EntityOwner) & + /*theOwner*/) { + Handle(Prs3d_Presentation) aHilightPrs = GetHilightPresentation(thePM); aHilightPrs->Clear(); thePM->Color(this, theStyle); diff --git a/src/PartSet/PartSet_CenterPrs.h b/src/PartSet/PartSet_CenterPrs.h index e74caa535..a52387436 100644 --- a/src/PartSet/PartSet_CenterPrs.h +++ b/src/PartSet/PartSet_CenterPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PartSet_CenterPrs.h @@ -24,33 +25,33 @@ #ifndef PartSet_CenterPrs_H #define PartSet_CenterPrs_H -#include -#include #include +#include +#include #include +#include #include #include -#include DEFINE_STANDARD_HANDLE(PartSet_CenterPrs, AIS_Point) /** -* \ingroup GUI -* A presentation class for displaying of centers of external curcular objects in a sketch -*/ -class PartSet_CenterPrs: public AIS_Point -{ + * \ingroup GUI + * A presentation class for displaying of centers of external curcular objects + * in a sketch + */ +class PartSet_CenterPrs : public AIS_Point { public: /// Constructor /// \param theObject an object with circular edge /// \param theEdge a circular edge /// \param theCenter a center point of the circular edge /// \param theType a type of the center - Standard_EXPORT PartSet_CenterPrs(const ObjectPtr& theObject, - const GeomEdgePtr& theEdge, - const gp_Pnt& theCenter, - ModelAPI_AttributeSelection::CenterType theType); + Standard_EXPORT + PartSet_CenterPrs(const ObjectPtr &theObject, const GeomEdgePtr &theEdge, + const gp_Pnt &theCenter, + ModelAPI_AttributeSelection::CenterType theType); /// Returns an Object which contains the circular edge ObjectPtr object() const { return myObject; } @@ -59,18 +60,22 @@ public: GeomEdgePtr edge() const { return myEdge; } /// Returns type of the center - ModelAPI_AttributeSelection::CenterType centerType() const { return myCenterType; } + ModelAPI_AttributeSelection::CenterType centerType() const { + return myCenterType; + } - virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& PM, - const SelectMgr_SequenceOfOwner& Seq); - virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)&, - const Handle(Prs3d_Drawer)&, - const Handle(SelectMgr_EntityOwner)&); + virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d) & PM, + const SelectMgr_SequenceOfOwner &Seq); + virtual void + HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) &, + const Handle(Prs3d_Drawer) &, + const Handle(SelectMgr_EntityOwner) &); DEFINE_STANDARD_RTTIEXT(PartSet_CenterPrs, AIS_Point) private: - void drawPoint(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor); + void drawPoint(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor); ObjectPtr myObject; GeomEdgePtr myEdge; diff --git a/src/PartSet/PartSet_Constants.h b/src/PartSet/PartSet_Constants.h index 8df2b7870..58374fb0a 100644 --- a/src/PartSet/PartSet_Constants.h +++ b/src/PartSet/PartSet_Constants.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_Constants_H @@ -25,6 +26,7 @@ /// This file contains various constants used in the PartSet module ////const int CONSTRAINT_TEXT_HEIGHT = 28; /// the text height of the constraint -////const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance +////const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection +/// tolerance #endif diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index c38e89494..670f34918 100644 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_CustomPrs.h" @@ -23,12 +24,12 @@ #include "PartSet_OverconstraintListener.h" #include "PartSet_SketcherMgr.h" +#include #include #include -#include -#include #include +#include #include #include @@ -36,8 +37,8 @@ #include #include -#include #include +#include #include #include @@ -45,13 +46,14 @@ //#define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION -PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop) - : myWorkshop(theWorkshop), myFeature(FeaturePtr()), myPresentationIsEmpty(false), - myDisabledMode(-1) -{ - Events_Loop* aLoop = Events_Loop::loop(); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED)); +PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop *theWorkshop) + : myWorkshop(theWorkshop), myFeature(FeaturePtr()), + myPresentationIsEmpty(false), myDisabledMode(-1) { + Events_Loop *aLoop = Events_Loop::loop(); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED)); initPresentation(ModuleBase_IModule::CustomizeArguments); initPresentation(ModuleBase_IModule::CustomizeResults); @@ -62,15 +64,15 @@ PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop) myIsActive[ModuleBase_IModule::CustomizeHighlightedObjects] = false; } -bool PartSet_CustomPrs::isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) -{ +bool PartSet_CustomPrs::isActive( + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag) { return myIsActive[theFlag]; } -bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature, - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ +bool PartSet_CustomPrs::activate( + const FeaturePtr &theFeature, + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { #ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION return false; #endif @@ -96,9 +98,9 @@ bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature, return isModified; } -bool PartSet_CustomPrs::deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ +bool PartSet_CustomPrs::deactivate( + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { myIsActive[theFlag] = false; erasePresentation(theFlag, theUpdateViewer); if (theFlag == ModuleBase_IModule::CustomizeResults) @@ -107,9 +109,8 @@ bool PartSet_CustomPrs::deactivate(const ModuleBase_IModule::ModuleBase_Customiz } bool PartSet_CustomPrs::displayPresentation( - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { bool isModified = false; if (myDisabledMode == theFlag) @@ -117,30 +118,36 @@ bool PartSet_CustomPrs::displayPresentation( // update the AIS objects content AISObjectPtr aPresentation = getPresentation(theFlag, true); - Handle(AIS_InteractiveObject) anAISIO = aPresentation->impl(); - Handle(PartSet_OperationPrs) anOperationPrs = Handle(PartSet_OperationPrs)::DownCast(anAISIO); + Handle(AIS_InteractiveObject) anAISIO = + aPresentation->impl(); + Handle(PartSet_OperationPrs) anOperationPrs = + Handle(PartSet_OperationPrs)::DownCast(anAISIO); - // do nothing if the feature can not be displayed [is moved from presentation, to be checked] + // do nothing if the feature can not be displayed [is moved from presentation, + // to be checked] if (!myFeature.get()) return isModified; - QMap > aFeatureShapes; + QMap> aFeatureShapes; switch (theFlag) { - case ModuleBase_IModule::CustomizeArguments: - PartSet_OperationPrs::getFeatureShapes(myFeature, myWorkshop, aFeatureShapes); - break; - case ModuleBase_IModule::CustomizeResults: - PartSet_OperationPrs::getResultShapes(myFeature, myWorkshop, aFeatureShapes); - PartSet_OperationPrs::getPresentationShapes(myFeature, myWorkshop, aFeatureShapes, false); - break; - case ModuleBase_IModule::CustomizeHighlightedObjects: - PartSet_OperationPrs::getHighlightedShapes(myWorkshop, aFeatureShapes); - break; - default: - return isModified; + case ModuleBase_IModule::CustomizeArguments: + PartSet_OperationPrs::getFeatureShapes(myFeature, myWorkshop, + aFeatureShapes); + break; + case ModuleBase_IModule::CustomizeResults: + PartSet_OperationPrs::getResultShapes(myFeature, myWorkshop, + aFeatureShapes); + PartSet_OperationPrs::getPresentationShapes(myFeature, myWorkshop, + aFeatureShapes, false); + break; + case ModuleBase_IModule::CustomizeHighlightedObjects: + PartSet_OperationPrs::getHighlightedShapes(myWorkshop, aFeatureShapes); + break; + default: + return isModified; } - NCollection_DataMap& aShapeMap = - anOperationPrs->shapesMap(); + NCollection_DataMap &aShapeMap = + anOperationPrs->shapesMap(); PartSet_OperationPrs::fillShapeList(aFeatureShapes, myWorkshop, aShapeMap); myPresentationIsEmpty = false; @@ -148,29 +155,31 @@ bool PartSet_CustomPrs::displayPresentation( bool aRedisplayed = false; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull() && !aContext->IsDisplayed(anOperationPrs)) { - // when the feature can not be visualized in the module, the operation preview should not - // be visualized also - if (anOperationPrs->hasShapes() && myWorkshop->module()->canDisplayObject(myFeature)) { + // when the feature can not be visualized in the module, the operation + // preview should not be visualized also + if (anOperationPrs->hasShapes() && + myWorkshop->module()->canDisplayObject(myFeature)) { // set color here because it can be changed in preferences Quantity_Color aShapeColor = getShapeColor(theFlag); anOperationPrs->setShapeColor(aShapeColor); - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); - XGUI_Workshop* aWorkshop = workshop(); - aRedisplayed = aWorkshop->displayer()->displayAIS(myPresentations[theFlag], - false/*load object in selection*/, 0, false); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); + XGUI_Workshop *aWorkshop = workshop(); + aRedisplayed = aWorkshop->displayer()->displayAIS( + myPresentations[theFlag], false /*load object in selection*/, 0, + false); aContext->SetZLayer(anOperationPrs, aModule->getVisualLayerId()); isModified = true; } - } - else { - // when the feature can not be visualized in the module, the operation preview should not - // be visualized also - if (!anOperationPrs->hasShapes() || !myWorkshop->module()->canDisplayObject(myFeature)) { + } else { + // when the feature can not be visualized in the module, the operation + // preview should not be visualized also + if (!anOperationPrs->hasShapes() || + !myWorkshop->module()->canDisplayObject(myFeature)) { aRedisplayed = erasePresentation(theFlag, false); isModified = true; - } - else { + } else { if (myFeature->firstResult().get()) { PartSet_Module::setTexture(aPresentation, myFeature->firstResult()); } @@ -189,23 +198,24 @@ bool PartSet_CustomPrs::displayPresentation( } bool PartSet_CustomPrs::erasePresentation( - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { bool isErased = false; - XGUI_Workshop* aWorkshop = workshop(); + XGUI_Workshop *aWorkshop = workshop(); if (myPresentations.contains(theFlag)) - isErased = aWorkshop->displayer()->eraseAIS(myPresentations[theFlag], theUpdateViewer); + isErased = aWorkshop->displayer()->eraseAIS(myPresentations[theFlag], + theUpdateViewer); return isErased; } void PartSet_CustomPrs::clearPresentation( - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) -{ + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag) { AISObjectPtr aPresentation = getPresentation(theFlag, false); if (aPresentation.get()) { - Handle(AIS_InteractiveObject) anAISIO = aPresentation->impl(); - Handle(PartSet_OperationPrs) anOperationPrs = Handle(PartSet_OperationPrs)::DownCast(anAISIO); + Handle(AIS_InteractiveObject) anAISIO = + aPresentation->impl(); + Handle(PartSet_OperationPrs) anOperationPrs = + Handle(PartSet_OperationPrs)::DownCast(anAISIO); anOperationPrs->shapesMap().Clear(); if (!anOperationPrs.IsNull()) @@ -215,9 +225,8 @@ void PartSet_CustomPrs::clearPresentation( } AISObjectPtr PartSet_CustomPrs::getPresentation( - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theToCreate) -{ + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theToCreate) { Handle(PartSet_OperationPrs) aPresentation; AISObjectPtr anOperationPrs; @@ -232,10 +241,10 @@ AISObjectPtr PartSet_CustomPrs::getPresentation( return anOperationPrs; } -bool PartSet_CustomPrs::redisplay(const ObjectPtr& theObject, - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ +bool PartSet_CustomPrs::redisplay( + const ObjectPtr &theObject, + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { #ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION return false; #endif @@ -246,18 +255,17 @@ bool PartSet_CustomPrs::redisplay(const ObjectPtr& theObject, return aRedisplayed; } -void PartSet_CustomPrs::clearPrs() -{ +void PartSet_CustomPrs::clearPrs() { clearPresentation(ModuleBase_IModule::CustomizeArguments); clearPresentation(ModuleBase_IModule::CustomizeResults); clearPresentation(ModuleBase_IModule::CustomizeHighlightedObjects); clearErrorShape(); } -void PartSet_CustomPrs::clearErrorShape() -{ +void PartSet_CustomPrs::clearErrorShape() { if (!myErrorShapes.IsNull()) { - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + Handle(AIS_InteractiveContext) aContext = + myWorkshop->viewer()->AISContext(); if (aContext->IsDisplayed(myErrorShapes)) { aContext->Remove(myErrorShapes, true); myErrorShapes.Nullify(); @@ -265,14 +273,18 @@ void PartSet_CustomPrs::clearErrorShape() } } -void PartSet_CustomPrs::processEvent(const std::shared_ptr& theMessage) -{ - if (theMessage->eventID() == Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)) - myPresentationIsEmpty = true; /// store state to analize it after display/erase is finished - else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED)) { +void PartSet_CustomPrs::processEvent( + const std::shared_ptr &theMessage) { + if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)) + myPresentationIsEmpty = + true; /// store state to analize it after display/erase is finished + else if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED)) { std::shared_ptr aErrMsg = - std::dynamic_pointer_cast(theMessage); - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + std::dynamic_pointer_cast(theMessage); + Handle(AIS_InteractiveContext) aContext = + myWorkshop->viewer()->AISContext(); ListOfShape aShapes = aErrMsg->shapes(); if (aShapes.size() > 0) { GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); @@ -281,17 +293,17 @@ void PartSet_CustomPrs::processEvent(const std::shared_ptr& theM myErrorShapes = new AIS_Shape(aErrShape); myErrorShapes->SetColor(Quantity_NOC_RED); Handle(Prs3d_Drawer) aDrawer = myErrorShapes->Attributes(); - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_RING1, Quantity_NOC_RED, 2.)); - aDrawer->SetLineAspect(new Prs3d_LineAspect(Quantity_NOC_RED, Aspect_TOL_SOLID, 2.)); + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_RING1, Quantity_NOC_RED, 2.)); + aDrawer->SetLineAspect( + new Prs3d_LineAspect(Quantity_NOC_RED, Aspect_TOL_SOLID, 2.)); aContext->Display(myErrorShapes, true); aContext->Deactivate(myErrorShapes); - } - else { + } else { myErrorShapes->Set(aErrShape); aContext->Redisplay(myErrorShapes, true); } - } - else { + } else { if (!myErrorShapes.IsNull()) { aContext->Remove(myErrorShapes, true); myErrorShapes.Nullify(); @@ -301,17 +313,16 @@ void PartSet_CustomPrs::processEvent(const std::shared_ptr& theM } void PartSet_CustomPrs::initPresentation( - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) -{ + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag) { AISObjectPtr anOperationPrs = AISObjectPtr(new GeomAPI_AISObject()); Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop); anOperationPrs->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs)); if (theFlag == ModuleBase_IModule::CustomizeArguments || theFlag == ModuleBase_IModule::CustomizeResults) { anOperationPrs->setPointMarker(5, 2.); - anOperationPrs->setWidth((theFlag == ModuleBase_IModule::CustomizeHighlightedObjects)? 2 : 1); - } - else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) + anOperationPrs->setWidth( + (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) ? 2 : 1); + } else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) anAISPrs->useAISWidth(); if (anOperationPrs.get()) @@ -319,27 +330,28 @@ void PartSet_CustomPrs::initPresentation( } Quantity_Color PartSet_CustomPrs::getShapeColor( - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) -{ + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag) { Quantity_Color aColor; - switch(theFlag) { - case ModuleBase_IModule::CustomizeArguments: - aColor = ModuleBase_Tools::color("Visualization", "operation_parameter_color"); + switch (theFlag) { + case ModuleBase_IModule::CustomizeArguments: + aColor = + ModuleBase_Tools::color("Visualization", "operation_parameter_color"); break; - case ModuleBase_IModule::CustomizeResults: - aColor = ModuleBase_Tools::color("Visualization", "operation_result_color"); + case ModuleBase_IModule::CustomizeResults: + aColor = ModuleBase_Tools::color("Visualization", "operation_result_color"); break; - case ModuleBase_IModule::CustomizeHighlightedObjects: - aColor = ModuleBase_Tools::color("Visualization", "operation_highlight_color"); + case ModuleBase_IModule::CustomizeHighlightedObjects: + aColor = + ModuleBase_Tools::color("Visualization", "operation_highlight_color"); break; - default: + default: break; } return aColor; } -XGUI_Workshop* PartSet_CustomPrs::workshop() const -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); +XGUI_Workshop *PartSet_CustomPrs::workshop() const { + XGUI_ModuleConnector *aConnector = + dynamic_cast(myWorkshop); return aConnector->workshop(); } diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index ec2ad13f6..d660920cf 100644 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_CustomPrs_H @@ -24,26 +25,26 @@ #include "PartSet_OperationPrs.h" -#include +#include #include #include -#include +#include #include -#include #include +#include #include class ModuleBase_IWorkshop; class XGUI_Workshop; /** - * This is the module custom presentation, which manage an AIS presentation, that can be filled - * by a feature and visualized in the viewer additionally to usual workshop objects. -*/ -class PartSet_CustomPrs : public Events_Listener -{ + * This is the module custom presentation, which manage an AIS presentation, + * that can be filled by a feature and visualized in the viewer additionally to + * usual workshop objects. + */ +class PartSet_CustomPrs : public Events_Listener { public: /// Returns yellow color static const std::string OPERATION_PARAMETER_COLOR() { return "255, 255, 0"; } @@ -53,49 +54,53 @@ public: static const std::string OPERATION_HIGHLIGHT_COLOR() { return "128, 0, 0"; } /// Returns color lighter than sketch feature entity : pink - static const std::string OPERATION_REMOVE_FEATURE_COLOR() { return "255, 174, 201"; } + static const std::string OPERATION_REMOVE_FEATURE_COLOR() { + return "255, 174, 201"; + } /// Returns color equal to default color of construction plugin : green static const std::string OPERATION_SKETCH_PLANE() { return "170,255,0"; } + public: /// Constructor /// \param theWorkshop a reference to workshop - PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop); - PARTSET_EXPORT virtual ~PartSet_CustomPrs() {}; + PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop *theWorkshop); + PARTSET_EXPORT virtual ~PartSet_CustomPrs(){}; /// Returns true if the presentation is active /// \param theFlag an object AIS presentation type - bool isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); - - /// Initializes the operation presentation by the parameter object and display the presentation - /// \param theObject an operation feature source to fill the presentation - /// \param theFlag an object AIS presentation type - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \returns true if the presentation is displayed - bool activate(const FeaturePtr& theObject, - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + bool isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag); + + /// Initializes the operation presentation by the parameter object and display + /// the presentation \param theObject an operation feature source to fill the + /// presentation \param theFlag an object AIS presentation type \param + /// theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \returns true if the presentation is displayed + bool activate(const FeaturePtr &theObject, + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer); - /// Initializes the operation presentation by empty object and erase the presentation - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \param theFlag an object AIS presentation type - /// \returns true if the presentation has been displayed and now it is erased - bool deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + /// Initializes the operation presentation by empty object and erase the + /// presentation \param theUpdateViewer the parameter whether the viewer + /// should be update immediatelly \param theFlag an object AIS presentation + /// type \returns true if the presentation has been displayed and now it is + /// erased + bool deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer); - /// If the presentation is active[displayed], the shapes of the presentation is recomputed - /// and the presentation is redisplayed. - /// \param theObject an object to redisplay - /// \param theFlag an object AIS presentation type - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \returns true if the presentation is redisplayed - bool redisplay(const ObjectPtr& theObject, - const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + /// If the presentation is active[displayed], the shapes of the presentation + /// is recomputed and the presentation is redisplayed. \param theObject an + /// object to redisplay \param theFlag an object AIS presentation type \param + /// theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \returns true if the presentation is redisplayed + bool redisplay(const ObjectPtr &theObject, + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer); - /// Nullify all internal presentations. For example, it can be useful when the viewer/context - /// is closed. If this is not performed and the presentation is assigned in another context, - /// it caused erroneus case because the presentation has linkage to the previous context. + /// Nullify all internal presentations. For example, it can be useful when the + /// viewer/context is closed. If this is not performed and the presentation is + /// assigned in another context, it caused erroneus case because the + /// presentation has linkage to the previous context. void clearPrs(); /// Disable displaying of custom mode @@ -108,58 +113,68 @@ public: /// Enables disabled custom mode void enableCustomModes() { myDisabledMode = -1; } - //! Redefinition of Events_Listener method to listen a moment that the presentation becomes empty - virtual void processEvent(const std::shared_ptr& theMessage); + //! Redefinition of Events_Listener method to listen a moment that the + //! presentation becomes empty + virtual void processEvent(const std::shared_ptr &theMessage); private: /// Creates the AIS operation presentation /// \param theFlag an object AIS presentation type - void initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); + void + initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag); - /// Gets an AIS presentation by the flag or create new if there is no a presentation by the flag - /// \param theFlag an object AIS presentation type + /// Gets an AIS presentation by the flag or create new if there is no a + /// presentation by the flag \param theFlag an object AIS presentation type /// \param theToCreate a flag if a new presentation should be created /// \return wrap of AIS prsentation - AISObjectPtr getPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theToCreate); + AISObjectPtr + getPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theToCreate); //! Returns workshop - XGUI_Workshop* workshop() const; + XGUI_Workshop *workshop() const; /// Displays the internal presentation in the viewer of workshop /// \param theFlag an object AIS presentation type - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \param returns whether the presentation is displayed/redisplayed - bool displayPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer); + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \param returns whether the presentation is + /// displayed/redisplayed + bool displayPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer); /// Erases the internal presentation from the viewer of workshop /// \param theFlag an object AIS presentation type - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \param returns whether the presentation is erased - bool erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer); - - /// Nullify the operation presentation. For example, it can be useful when the viewer/context - /// is closed. If this is not performed and the presentation is assigned in another context, - /// it caused erroneus case because the presentation has linkage to the previous context. - /// \param theFlag an object AIS presentation type - void clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \param returns whether the presentation is erased + bool + erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer); + + /// Nullify the operation presentation. For example, it can be useful when the + /// viewer/context is closed. If this is not performed and the presentation is + /// assigned in another context, it caused erroneus case because the + /// presentation has linkage to the previous context. \param theFlag an object + /// AIS presentation type + void clearPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag); /// Returns presentation color according to the flag /// \param theFlag an object AIS presentation type /// \return theShapeColor a color - Quantity_Color getShapeColor(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); + Quantity_Color + getShapeColor(const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag); /// Removes error shapes presentation void clearErrorShape(); private: - ModuleBase_IWorkshop* myWorkshop; /// current workshop - FeaturePtr myFeature; /// Reference to a feature object - bool myPresentationIsEmpty; /// Boolean state about empty presentation + ModuleBase_IWorkshop *myWorkshop; /// current workshop + FeaturePtr myFeature; /// Reference to a feature object + bool myPresentationIsEmpty; /// Boolean state about empty presentation /// map of presentation type to AIS object - QMap myPresentations; + QMap + myPresentations; /// State whether the presentation is activated/deactivated QMap myIsActive; diff --git a/src/PartSet/PartSet_DataModel.cpp b/src/PartSet/PartSet_DataModel.cpp index d858668a5..6fc6c98ea 100644 --- a/src/PartSet/PartSet_DataModel.cpp +++ b/src/PartSet/PartSet_DataModel.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_DataModel.h" @@ -24,18 +25,19 @@ #include -PartSet_DataModel::PartSet_DataModel() -{ -// Events_Loop* aLoop = Events_Loop::loop(); -// aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); -// aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED)); -// aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); -// aLoop->registerListener(this, Events_Loop::eventByName(EVENT_ORDER_UPDATED)); -// aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); +PartSet_DataModel::PartSet_DataModel() { + // Events_Loop* aLoop = Events_Loop::loop(); + // aLoop->registerListener(this, + // Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + // aLoop->registerListener(this, + // Events_Loop::eventByName(EVENT_OBJECT_DELETED)); + // aLoop->registerListener(this, + // Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + // aLoop->registerListener(this, + // Events_Loop::eventByName(EVENT_ORDER_UPDATED)); + // aLoop->registerListener(this, + // Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); } - -void PartSet_DataModel::processEvent(const std::shared_ptr& theMessage) -{ - -} +void PartSet_DataModel::processEvent( + const std::shared_ptr &theMessage) {} diff --git a/src/PartSet/PartSet_DataModel.h b/src/PartSet/PartSet_DataModel.h index b63ea8d08..12c1df349 100644 --- a/src/PartSet/PartSet_DataModel.h +++ b/src/PartSet/PartSet_DataModel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_DataModel_H @@ -24,22 +25,20 @@ #include - class ModuleBase_ITreeNode; -class PartSet_DataModel : public Events_Listener -{ +class PartSet_DataModel : public Events_Listener { public: PartSet_DataModel(); /// Event Listener method /// \param theMessage an event message - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); - ModuleBase_ITreeNode* root() const { return myRoot; } + ModuleBase_ITreeNode *root() const { return myRoot; } private: - ModuleBase_ITreeNode* myRoot; + ModuleBase_ITreeNode *myRoot; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.cpp b/src/PartSet/PartSet_ExternalObjectsMgr.cpp index 20d73adff..85ba3764b 100644 --- a/src/PartSet/PartSet_ExternalObjectsMgr.cpp +++ b/src/PartSet/PartSet_ExternalObjectsMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_ExternalObjectsMgr.h" @@ -22,21 +23,20 @@ #include "PartSet_CenterPrs.h" #include "PartSet_Tools.h" -#include #include +#include -#include #include +#include #include #include -PartSet_ExternalObjectsMgr::PartSet_ExternalObjectsMgr(const std::string& theExternal, - const std::string& theCanCreateExternal, - const bool theDefaultValue) -: myUseExternal(theDefaultValue), myCanCreateExternal(true) -{ +PartSet_ExternalObjectsMgr::PartSet_ExternalObjectsMgr( + const std::string &theExternal, const std::string &theCanCreateExternal, + const bool theDefaultValue) + : myUseExternal(theDefaultValue), myCanCreateExternal(true) { QString aIsExternal(theExternal.c_str()); if (!aIsExternal.isEmpty()) { QString aStr = aIsExternal.toUpper(); @@ -50,13 +50,12 @@ PartSet_ExternalObjectsMgr::PartSet_ExternalObjectsMgr(const std::string& theExt } } -bool PartSet_ExternalObjectsMgr::isValidObject(const ObjectPtr& theObject) -{ +bool PartSet_ExternalObjectsMgr::isValidObject(const ObjectPtr &theObject) { bool aValid = true; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); // Do check using of external feature std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); // Do check that we can use external feature if (aSPFeature.get() != NULL && aSPFeature->isExternal() && !useExternal()) { @@ -66,62 +65,58 @@ bool PartSet_ExternalObjectsMgr::isValidObject(const ObjectPtr& theObject) return aValid; } -ObjectPtr PartSet_ExternalObjectsMgr::externalObject(const ObjectPtr& theSelectedObject, - const GeomShapePtr& theShape, - const CompositeFeaturePtr& theSketch, - const bool theTemporary) -{ +ObjectPtr PartSet_ExternalObjectsMgr::externalObject( + const ObjectPtr &theSelectedObject, const GeomShapePtr &theShape, + const CompositeFeaturePtr &theSketch, const bool theTemporary) { ObjectPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal( - theShape->impl(), theSelectedObject, theSketch); + theShape->impl(), theSelectedObject, theSketch); if (!aSelectedObject.get()) { // Processing of external (non-sketch) object FeaturePtr aCreatedFeature; - aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape, - theSelectedObject, theSketch, theTemporary, aCreatedFeature); + aSelectedObject = PartSet_Tools::createFixedObjectByExternal( + theShape, theSelectedObject, theSketch, theTemporary, aCreatedFeature); if (aCreatedFeature.get() && theTemporary) - myExternalObjectValidated = aCreatedFeature; + myExternalObjectValidated = aCreatedFeature; } return aSelectedObject; } -ObjectPtr PartSet_ExternalObjectsMgr::externalCenterObject(const ModuleBase_ViewerPrsPtr& thePrs, - const CompositeFeaturePtr& theSketch, - const bool theTemporary) -{ +ObjectPtr PartSet_ExternalObjectsMgr::externalCenterObject( + const ModuleBase_ViewerPrsPtr &thePrs, const CompositeFeaturePtr &theSketch, + const bool theTemporary) { if (!thePrs.get() || thePrs->interactive().IsNull()) return ObjectPtr(); - Handle(PartSet_CenterPrs) aAIS = Handle(PartSet_CenterPrs)::DownCast(thePrs->interactive()); + Handle(PartSet_CenterPrs) aAIS = + Handle(PartSet_CenterPrs)::DownCast(thePrs->interactive()); if (aAIS.IsNull()) return ObjectPtr(); gp_Pnt aPntComp = aAIS->Component()->Pnt(); - GeomVertexPtr aVertPtr(new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); + GeomVertexPtr aVertPtr( + new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); TopoDS_Shape aShape = aVertPtr->impl(); - ResultPtr aSelectedObject = - PartSet_Tools::findFixedObjectByExternal(aShape, aAIS->object(), theSketch); - if (!aSelectedObject.get()) - { + ResultPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal( + aShape, aAIS->object(), theSketch); + if (!aSelectedObject.get()) { FeaturePtr aCreatedFeature; - aSelectedObject = PartSet_Tools::createFixedByExternalCenter(aAIS->object(), aAIS->edge(), - aAIS->centerType(), theSketch, theTemporary, aCreatedFeature); + aSelectedObject = PartSet_Tools::createFixedByExternalCenter( + aAIS->object(), aAIS->edge(), aAIS->centerType(), theSketch, + theTemporary, aCreatedFeature); if (aCreatedFeature.get() && theTemporary) - myExternalObjectValidated = aCreatedFeature; + myExternalObjectValidated = aCreatedFeature; } return aSelectedObject; } -void PartSet_ExternalObjectsMgr::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape, - ModuleBase_IWorkshop* theWorkshop, - const CompositeFeaturePtr& theSketch, - const bool isInValidate) -{ +void PartSet_ExternalObjectsMgr::getGeomSelection( + const ModuleBase_ViewerPrsPtr &thePrs, ObjectPtr &theObject, + GeomShapePtr &theShape, ModuleBase_IWorkshop *theWorkshop, + const CompositeFeaturePtr &theSketch, const bool isInValidate) { FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(theObject); std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aSelectedFeature); + std::dynamic_pointer_cast(aSelectedFeature); // there is no a sketch feature is selected, but the shape exists, // try to create an exernal object // TODO: unite with the same functionality in PartSet_WidgetShapeSelector @@ -138,38 +133,36 @@ void PartSet_ExternalObjectsMgr::getGeomSelection(const ModuleBase_ViewerPrsPtr& } if (aShape.get() != NULL && !aShape->isNull()) anExternalObject = - externalObject(theObject, aShape, theSketch, isInValidate); + externalObject(theObject, aShape, theSketch, isInValidate); if (!anExternalObject.get()) { - anExternalObject = externalCenterObject(thePrs, theSketch, isInValidate); + anExternalObject = + externalCenterObject(thePrs, theSketch, isInValidate); } - } - else { /// use objects of found selection + } else { /// use objects of found selection anExternalObject = theObject; anExternalShape = theShape; } } - /// the object is null if the selected feature is "external"(not sketch entity feature of the - /// current sketch) and it is not created by object manager + /// the object is null if the selected feature is "external"(not sketch + /// entity feature of the current sketch) and it is not created by object + /// manager theObject = anExternalObject; theShape = anExternalShape; } } //******************************************************************** -void PartSet_ExternalObjectsMgr::removeExternal(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - const bool theTemporary) -{ +void PartSet_ExternalObjectsMgr::removeExternal( + const CompositeFeaturePtr &theSketch, const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop, const bool theTemporary) { if (theTemporary) - removeExternalObject(myExternalObjectValidated, theSketch, theFeature, theWorkshop); + removeExternalObject(myExternalObjectValidated, theSketch, theFeature, + theWorkshop); } -void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject, - const CompositeFeaturePtr& /*theSketch*/, - const FeaturePtr& /*theFeature*/, - ModuleBase_IWorkshop* theWorkshop) -{ +void PartSet_ExternalObjectsMgr::removeExternalObject( + const ObjectPtr &theObject, const CompositeFeaturePtr & /*theSketch*/, + const FeaturePtr & /*theFeature*/, ModuleBase_IWorkshop *theWorkshop) { if (theObject.get()) { DocumentPtr aDoc = theObject->document(); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); @@ -183,8 +176,9 @@ void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject } } -XGUI_Workshop* PartSet_ExternalObjectsMgr::workshop(ModuleBase_IWorkshop* theWorkshop) -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(theWorkshop); +XGUI_Workshop * +PartSet_ExternalObjectsMgr::workshop(ModuleBase_IWorkshop *theWorkshop) { + XGUI_ModuleConnector *aConnector = + dynamic_cast(theWorkshop); return aConnector->workshop(); } diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.h b/src/PartSet/PartSet_ExternalObjectsMgr.h index 8ccbdb41b..6ac0158ba 100644 --- a/src/PartSet/PartSet_ExternalObjectsMgr.h +++ b/src/PartSet/PartSet_ExternalObjectsMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_ExternalObjectsMgr_H @@ -22,9 +23,9 @@ #include "PartSet.h" +#include #include #include -#include #include @@ -35,19 +36,19 @@ class ModuleBase_ViewerPrs; class XGUI_Workshop; /** -* \ingroup Modules -* Customosation of ModuleBase_WidgetShapeSelector in order to provide -* working with sketch specific objects. -*/ -class PARTSET_EXPORT PartSet_ExternalObjectsMgr -{ - public: + * \ingroup Modules + * Customosation of ModuleBase_WidgetShapeSelector in order to provide + * working with sketch specific objects. + */ +class PARTSET_EXPORT PartSet_ExternalObjectsMgr { +public: /// Constructor /// \param theExternal the external state - /// \param theCanCreateExternal the state if it can and should create external features - /// \param theDefaultValue the default value for the external object using - PartSet_ExternalObjectsMgr(const std::string& theExternal, - const std::string& theCanCreateExternal, + /// \param theCanCreateExternal the state if it can and should create external + /// features \param theDefaultValue the default value for the external object + /// using + PartSet_ExternalObjectsMgr(const std::string &theExternal, + const std::string &theCanCreateExternal, const bool theDefaultValue); virtual ~PartSet_ExternalObjectsMgr() {} @@ -57,70 +58,73 @@ class PARTSET_EXPORT PartSet_ExternalObjectsMgr /// Returns if new external objects can be created /// \return boolean value - bool canCreateExternal() { return myCanCreateExternal;} + bool canCreateExternal() { return myCanCreateExternal; } /// Checks validity of the given object /// \param theObject an object to check /// \return valid or not valid - bool isValidObject(const ObjectPtr& theObject); + bool isValidObject(const ObjectPtr &theObject); /// Finds or create and external object /// \param theSelectedObject an object /// \param theShape a selected shape, which is used in the selection attribute /// \param theSketch a current sketch - /// \param theTemporary the created external object is temporary, execute is not performed for it - /// \return the object - ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape, - const CompositeFeaturePtr& theSketch, const bool theTemporary = false); - - /// Finds or create and external object by selected circle center (PartSet_CenterPrs) - /// \param thePrs a selection - /// \param theSketch a current sketch - /// \param theTemporary the created external object is temporary, execute is not performed for it - /// \return the object - ObjectPtr externalCenterObject(const std::shared_ptr& thePrs, - const CompositeFeaturePtr& theSketch, - const bool theTemporary); + /// \param theTemporary the created external object is temporary, execute is + /// not performed for it \return the object + ObjectPtr externalObject(const ObjectPtr &theSelectedObject, + const GeomShapePtr &theShape, + const CompositeFeaturePtr &theSketch, + const bool theTemporary = false); + + /// Finds or create and external object by selected circle center + /// (PartSet_CenterPrs) \param thePrs a selection \param theSketch a current + /// sketch \param theTemporary the created external object is temporary, + /// execute is not performed for it \return the object + ObjectPtr + externalCenterObject(const std::shared_ptr &thePrs, + const CompositeFeaturePtr &theSketch, + const bool theTemporary); /// Returns created external object or NULL /// \return an object instance - ObjectPtr getExternalObjectValidated() const { return myExternalObjectValidated; } + ObjectPtr getExternalObjectValidated() const { + return myExternalObjectValidated; + } // Removes the external presentation from the model /// \param theSketch a current sketch /// \param theFeature a current feature /// \param theWorkshop a current workshop - /// \param theTemporary if true, a temporary external object is removed overwise all ext objects - void removeExternal(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, + /// \param theTemporary if true, a temporary external object is removed + /// overwise all ext objects + void removeExternal(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop, const bool theTemporary); /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void getGeomSelection(const std::shared_ptr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape, - ModuleBase_IWorkshop* theWorkshop, - const CompositeFeaturePtr& theSketch, - const bool isInValidate); + virtual void getGeomSelection( + const std::shared_ptr &thePrs, ObjectPtr &theObject, + GeomShapePtr &theShape, ModuleBase_IWorkshop *theWorkshop, + const CompositeFeaturePtr &theSketch, const bool isInValidate); protected: - /// Delete from the document the feature of the object. It deletes all objects, which refers to - /// the deleted one. The parameter feature is ignored even it refer to the deleted object. - /// \param theObject a removed object + /// Delete from the document the feature of the object. It deletes all + /// objects, which refers to the deleted one. The parameter feature is ignored + /// even it refer to the deleted object. \param theObject a removed object /// \param theSketch a current sketch /// \param theFeature a current feature /// \param theWorkshop a current workshop - void removeExternalObject(const ObjectPtr& theObject, - const CompositeFeaturePtr& theSketch, - const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop); + void removeExternalObject(const ObjectPtr &theObject, + const CompositeFeaturePtr &theSketch, + const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop); /// Returns the workshop - static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop); + static XGUI_Workshop *workshop(ModuleBase_IWorkshop *theWorkshop); protected: /// An external object @@ -132,4 +136,4 @@ protected: bool myCanCreateExternal; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_ExternalPointsMgr.cpp b/src/PartSet/PartSet_ExternalPointsMgr.cpp index 11350c820..95fa73ba1 100644 --- a/src/PartSet/PartSet_ExternalPointsMgr.cpp +++ b/src/PartSet/PartSet_ExternalPointsMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PartSet_ExternalPointsMgr.cpp @@ -25,9 +26,9 @@ #include "PartSet_CenterPrs.h" #include "PartSet_Tools.h" -#include #include #include +#include #include #include @@ -38,41 +39,38 @@ #include #include -#include #include -#include #include #include +#include +#include #ifdef WIN32 #pragma warning(disable : 4456) // for nested foreach #endif -PartSet_ExternalPointsMgr::PartSet_ExternalPointsMgr(ModuleBase_IWorkshop* theWorkshop, - const CompositeFeaturePtr& theSketch) - : QObject(theWorkshop), myWorkshop(theWorkshop), mySketch(theSketch) -{ - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); +PartSet_ExternalPointsMgr::PartSet_ExternalPointsMgr( + ModuleBase_IWorkshop *theWorkshop, const CompositeFeaturePtr &theSketch) + : QObject(theWorkshop), myWorkshop(theWorkshop), mySketch(theSketch) { + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); connect(aDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)), - SLOT(onDisplayObject(ObjectPtr, AISObjectPtr))); + SLOT(onDisplayObject(ObjectPtr, AISObjectPtr))); connect(aDisplayer, SIGNAL(beforeObjectErase(ObjectPtr, AISObjectPtr)), - SLOT(onEraseObject(ObjectPtr, AISObjectPtr))); + SLOT(onEraseObject(ObjectPtr, AISObjectPtr))); updateCenterPresentations(); } - -PartSet_ExternalPointsMgr::~PartSet_ExternalPointsMgr() -{ +PartSet_ExternalPointsMgr::~PartSet_ExternalPointsMgr() { if (myPresentations.isEmpty()) return; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); if (!aWorkshop) return; - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); QMapIterator aIt(myPresentations); while (aIt.hasNext()) { aIt.next(); @@ -83,17 +81,16 @@ PartSet_ExternalPointsMgr::~PartSet_ExternalPointsMgr() } } - //****************************************************** -QList> PartSet_ExternalPointsMgr::findCircularEdgesInPlane() -{ +QList> +PartSet_ExternalPointsMgr::findCircularEdgesInPlane() { QList> aResult; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); QObjectPtrList aDispObjects = aDisplayer->displayedObjects(); std::shared_ptr aPlane = plane(); - foreach(ObjectPtr aObj, aDispObjects) { + foreach (ObjectPtr aObj, aDispObjects) { if (myPresentations.contains(aObj)) continue; @@ -105,23 +102,24 @@ QList> PartSet_ExternalPointsMgr::findCirc // Do not use Fields and groups in selection in sketcher if (!aResObj.get() || - (aResObj->groupName() == ModelAPI_ResultField::group()) || - (aResObj->groupName() == ModelAPI_ResultGroup::group())) + (aResObj->groupName() == ModelAPI_ResultField::group()) || + (aResObj->groupName() == ModelAPI_ResultGroup::group())) continue; if (aResObj.get()) { GeomShapePtr aShape = aResObj->shape(); if (aShape.get()) { GeomAPI_ShapeExplorer aExplorer(aShape, GeomAPI_Shape::EDGE); - for(; aExplorer.more(); aExplorer.next()) { + for (; aExplorer.more(); aExplorer.next()) { GeomShapePtr aEdgeShape = aExplorer.current(); GeomAPI_Edge anEdge(aEdgeShape); if ((anEdge.isCircle() || anEdge.isArc() || anEdge.isEllipse()) && - anEdge.isInPlane(aPlane)) { + anEdge.isInPlane(aPlane)) { bool isContains = false; // Check that edge is not already used. - // It is possible that the same edge will be taken from different faces - foreach(std::shared_ptr aPrs, aResult) { + // It is possible that the same edge will be taken from different + // faces + foreach (std::shared_ptr aPrs, aResult) { GeomAPI_Edge aUsedEdge(aPrs->shape()); if (aUsedEdge.isEqual(aEdgeShape)) { isContains = true; @@ -129,8 +127,8 @@ QList> PartSet_ExternalPointsMgr::findCirc } } if (!isContains) { - std::shared_ptr - aPrs(new ModuleBase_ViewerPrs(aResObj, aEdgeShape)); + std::shared_ptr aPrs( + new ModuleBase_ViewerPrs(aResObj, aEdgeShape)); aResult.append(aPrs); } } @@ -141,28 +139,27 @@ QList> PartSet_ExternalPointsMgr::findCirc return aResult; } - -void PartSet_ExternalPointsMgr::updateCenterPresentations() -{ - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); +void PartSet_ExternalPointsMgr::updateCenterPresentations() { + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); // Return if there is no plane defined if (!plane().get()) { connect(aWorkshop->selector(), SIGNAL(selectionChanged()), - SLOT(onSelectionChanged())); + SLOT(onSelectionChanged())); return; } - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); - QList> aEdgesPrs = findCircularEdgesInPlane(); - foreach(std::shared_ptr aPrs, aEdgesPrs) { + QList> aEdgesPrs = + findCircularEdgesInPlane(); + foreach (std::shared_ptr aPrs, aEdgesPrs) { GeomEdgePtr aEdge(new GeomAPI_Edge(aPrs->shape())); ListOfAIS aList; if (aEdge->isArc() || aEdge->isCircle()) { GeomCirclePtr aCircle = aEdge->circle(); GeomPointPtr aCenter = aCircle->center(); Handle(PartSet_CenterPrs) aCentPrs = - new PartSet_CenterPrs(aPrs->object(), aEdge, aCenter->impl(), - ModelAPI_AttributeSelection::CIRCLE_CENTER); + new PartSet_CenterPrs(aPrs->object(), aEdge, aCenter->impl(), + ModelAPI_AttributeSelection::CIRCLE_CENTER); AISObjectPtr anAIS(new GeomAPI_AISObject()); anAIS->setImpl(new Handle(AIS_InteractiveObject)(aCentPrs)); @@ -171,12 +168,12 @@ void PartSet_ExternalPointsMgr::updateCenterPresentations() GeomEllipsePtr aEllipse = aEdge->ellipse(); GeomPointPtr aF1 = aEllipse->firstFocus(); GeomPointPtr aF2 = aEllipse->secondFocus(); - Handle(PartSet_CenterPrs) aF1Prs = - new PartSet_CenterPrs(aPrs->object(), aEdge, aF1->impl(), - ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS); - Handle(PartSet_CenterPrs) aF2Prs = - new PartSet_CenterPrs(aPrs->object(), aEdge, aF2->impl(), - ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS); + Handle(PartSet_CenterPrs) aF1Prs = new PartSet_CenterPrs( + aPrs->object(), aEdge, aF1->impl(), + ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS); + Handle(PartSet_CenterPrs) aF2Prs = new PartSet_CenterPrs( + aPrs->object(), aEdge, aF2->impl(), + ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS); AISObjectPtr anAIS1(new GeomAPI_AISObject()); anAIS1->setImpl(new Handle(AIS_InteractiveObject)(aF1Prs)); @@ -190,31 +187,30 @@ void PartSet_ExternalPointsMgr::updateCenterPresentations() myPresentations[aPrs->object()].append(aList); else myPresentations[aPrs->object()] = aList; - foreach(AISObjectPtr anAIS, aList) { + foreach (AISObjectPtr anAIS, aList) { aDisplayer->displayAIS(anAIS, false, 0, false); - aWorkshop->selectionActivate()->activateAIS(anAIS->impl(), - TopAbs_VERTEX, false); + aWorkshop->selectionActivate()->activateAIS( + anAIS->impl(), TopAbs_VERTEX, false); } } } -std::shared_ptr PartSet_ExternalPointsMgr::plane() const -{ +std::shared_ptr PartSet_ExternalPointsMgr::plane() const { return PartSet_Tools::sketchPlane(mySketch); } -void PartSet_ExternalPointsMgr::onDisplayObject(ObjectPtr theObj, AISObjectPtr theAIS) -{ +void PartSet_ExternalPointsMgr::onDisplayObject(ObjectPtr theObj, + AISObjectPtr theAIS) { updateCenterPresentations(); } -void PartSet_ExternalPointsMgr::onEraseObject(ObjectPtr theObj, AISObjectPtr theAIS) -{ +void PartSet_ExternalPointsMgr::onEraseObject(ObjectPtr theObj, + AISObjectPtr theAIS) { if (myPresentations.contains(theObj)) { - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); ListOfAIS aList = myPresentations[theObj]; - foreach(AISObjectPtr aAIS, aList) { + foreach (AISObjectPtr aAIS, aList) { aDisplayer->eraseAIS(aAIS, false); } myPresentations.remove(theObj); @@ -222,9 +218,7 @@ void PartSet_ExternalPointsMgr::onEraseObject(ObjectPtr theObj, AISObjectPtr the } } - -bool PartSet_ExternalPointsMgr::isSketchObject(const ObjectPtr& theRes) const -{ +bool PartSet_ExternalPointsMgr::isSketchObject(const ObjectPtr &theRes) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theRes); if (!aFeature.get()) return false; @@ -232,12 +226,11 @@ bool PartSet_ExternalPointsMgr::isSketchObject(const ObjectPtr& theRes) const return aComp == mySketch; } -void PartSet_ExternalPointsMgr::onSelectionChanged() -{ +void PartSet_ExternalPointsMgr::onSelectionChanged() { if (plane().get()) { - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - disconnect(aWorkshop->selector(), SIGNAL(selectionChanged()), - this, SLOT(onSelectionChanged())); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + disconnect(aWorkshop->selector(), SIGNAL(selectionChanged()), this, + SLOT(onSelectionChanged())); updateCenterPresentations(); } } diff --git a/src/PartSet/PartSet_ExternalPointsMgr.h b/src/PartSet/PartSet_ExternalPointsMgr.h index e381013b6..0ec80e172 100644 --- a/src/PartSet/PartSet_ExternalPointsMgr.h +++ b/src/PartSet/PartSet_ExternalPointsMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PartSet_ExternalPointsMgr.h @@ -24,46 +25,43 @@ #ifndef PartSet_ExternalPointsMgr_H #define PartSet_ExternalPointsMgr_H - +#include +#include #include #include -#include -#include -#include #include +#include class ModuleBase_ViewerPrs; class ModuleBase_IWorkshop; - /** -* \ingroup Modules -* A class to manage display of presentations of center points of circular -* edges outside of a current sketcher -*/ -class PartSet_ExternalPointsMgr: public QObject -{ + * \ingroup Modules + * A class to manage display of presentations of center points of circular + * edges outside of a current sketcher + */ +class PartSet_ExternalPointsMgr : public QObject { Q_OBJECT public: - PartSet_ExternalPointsMgr(ModuleBase_IWorkshop* theWorkshop, - const CompositeFeaturePtr& theSketch); + PartSet_ExternalPointsMgr(ModuleBase_IWorkshop *theWorkshop, + const CompositeFeaturePtr &theSketch); virtual ~PartSet_ExternalPointsMgr(); public slots: /** - * A slot which processes display of object - * \param theObj the displayed object - * \param theAIS its presentation - */ + * A slot which processes display of object + * \param theObj the displayed object + * \param theAIS its presentation + */ void onDisplayObject(ObjectPtr theObj, AISObjectPtr theAIS); /** - * A slot which processes erase of object - * \param theObj the displayed object - * \param theAIS its presentation - */ + * A slot which processes erase of object + * \param theObj the displayed object + * \param theAIS its presentation + */ void onEraseObject(ObjectPtr theObj, AISObjectPtr theAIS); // Called on selection changed @@ -71,10 +69,10 @@ public slots: private: /** - * Returns list of presentations which have displayed shapes with circular edges - * (circles, arcs) which are in pane of of the given sketch - * \param theSketch - the sketch - */ + * Returns list of presentations which have displayed shapes with circular + * edges (circles, arcs) which are in pane of of the given sketch \param + * theSketch - the sketch + */ QList> findCircularEdgesInPlane(); /// Creates presentations of centers @@ -84,15 +82,15 @@ private: GeomPlanePtr plane() const; /** - * Checks that the given object is an object of the current sketch - * \param theRes an object to check - * \return True if the given object is a sub-object of the current sketch - */ - bool isSketchObject(const ObjectPtr& theRes) const; + * Checks that the given object is an object of the current sketch + * \param theRes an object to check + * \return True if the given object is a sub-object of the current sketch + */ + bool isSketchObject(const ObjectPtr &theRes) const; private: /// Workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; /// Current sketch CompositeFeaturePtr mySketch; @@ -104,4 +102,4 @@ private: QMap myPresentations; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_FieldStepPrs.cpp b/src/PartSet/PartSet_FieldStepPrs.cpp index 3fb0a1fc6..f0bed4d7a 100644 --- a/src/PartSet/PartSet_FieldStepPrs.cpp +++ b/src/PartSet/PartSet_FieldStepPrs.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_FieldStepPrs.h" @@ -23,37 +24,34 @@ #include -#include #include +#include #include #include #include +#include +#include +#include +#include #include #include -#include -#include +#include #include #include -#include -#include -#include IMPLEMENT_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape); #define POINT_SIZE 8 - -void emptyDeleter(ModelAPI_ResultField* /*theF*/) -{ +void emptyDeleter(ModelAPI_ResultField * /*theF*/) { // Do nothing } PartSet_FieldStepPrs::PartSet_FieldStepPrs(FieldStepPtr theStep) -: ViewerData_AISShape(TopoDS_Shape()), myStep(theStep) -{ - ModelAPI_ResultField* aField = theStep->field(); + : ViewerData_AISShape(TopoDS_Shape()), myStep(theStep) { + ModelAPI_ResultField *aField = theStep->field(); GeomShapePtr aShapePtr = aField->shape(); TopoDS_Shape aShape = aShapePtr->impl(); Set(aShape); @@ -68,46 +66,46 @@ PartSet_FieldStepPrs::PartSet_FieldStepPrs(FieldStepPtr theStep) if (aDrawer->HasOwnPointAspect()) { aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_POINT); aDrawer->PointAspect()->SetScale(POINT_SIZE); - } - else - aDrawer->SetPointAspect( - new Prs3d_PointAspect(Aspect_TOM_POINT, Quantity_NOC_YELLOW, POINT_SIZE)); + } else + aDrawer->SetPointAspect(new Prs3d_PointAspect( + Aspect_TOM_POINT, Quantity_NOC_YELLOW, POINT_SIZE)); } SetMaterial(Graphic3d_NOM_PLASTIC); } - -ModelAPI_AttributeTables::ValueType PartSet_FieldStepPrs::dataType() const -{ +ModelAPI_AttributeTables::ValueType PartSet_FieldStepPrs::dataType() const { DataPtr aData = myFeature->data(); - AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + aData->tables(CollectionPlugin_Field::VALUES_ID()); return aTablesAttr->type(); } -bool PartSet_FieldStepPrs::dataRange(double& theMin, double& theMax) const -{ +bool PartSet_FieldStepPrs::dataRange(double &theMin, double &theMax) const { ModelAPI_AttributeTables::ValueType aType = dataType(); - if ((aType == ModelAPI_AttributeTables::DOUBLE) || (aType == ModelAPI_AttributeTables::INTEGER)) { + if ((aType == ModelAPI_AttributeTables::DOUBLE) || + (aType == ModelAPI_AttributeTables::INTEGER)) { range(theMin, theMax); return true; } return false; } -QList PartSet_FieldStepPrs::range(double& theMin, double& theMax) const -{ +QList PartSet_FieldStepPrs::range(double &theMin, + double &theMax) const { ModelAPI_AttributeTables::ValueType aType = dataType(); DataPtr aData = myFeature->data(); - AttributeSelectionListPtr aSelList = aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); + AttributeSelectionListPtr aSelList = + aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); std::string aTypeStr = aSelList->selectionType(); int aStep = myStep->id(); - AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + aData->tables(CollectionPlugin_Field::VALUES_ID()); int aRows = aTablesAttr->rows(); int aCols = aTablesAttr->columns(); QList aFieldStepData; - int aStart = (aTypeStr == "part")? 0:1; + int aStart = (aTypeStr == "part") ? 0 : 1; for (int k = aStart; k < aRows; k++) { // Do not use default values for (int j = 0; j < aCols; j++) { ModelAPI_AttributeTables::Value aVal = aTablesAttr->value(k, j, aStep); @@ -132,8 +130,7 @@ QList PartSet_FieldStepPrs::range(double& theMin, double& theMax) const aRangeMax = Max(aRangeMax, aValue); aShapeData << aValue; } - } - else { + } else { for (int aRow = 0; aRow < aRows - aStart; aRow++) { double aNorm = 0; int aBaseIndex = aRow * aCols; @@ -153,53 +150,52 @@ QList PartSet_FieldStepPrs::range(double& theMin, double& theMax) const return aShapeData; } - -void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer theMode) -{ - SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); - QColor aQColor = aResMgr->colorValue("Viewer", "scalar_bar_text_color", Qt::black); - Quantity_Color aLabelColor = Quantity_Color(aQColor.redF(), aQColor.greenF(), aQColor.blueF(), - Quantity_TOC_RGB); +void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d) & + thePrsMgr, + const Handle(Prs3d_Presentation) & thePrs, + const Standard_Integer theMode) { + SUIT_ResourceMgr *aResMgr = ModuleBase_Preferences::resourceMgr(); + QColor aQColor = + aResMgr->colorValue("Viewer", "scalar_bar_text_color", Qt::black); + Quantity_Color aLabelColor = Quantity_Color( + aQColor.redF(), aQColor.greenF(), aQColor.blueF(), Quantity_TOC_RGB); ModelAPI_AttributeTables::ValueType aType = dataType(); DataPtr aData = myFeature->data(); switch (aType) { case ModelAPI_AttributeTables::DOUBLE: - case ModelAPI_AttributeTables::INTEGER: - { + case ModelAPI_AttributeTables::INTEGER: { double aMin, aMax; QList aShapeData = range(aMin, aMax); AttributeSelectionListPtr aSelList = - aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); + aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); std::string aTypeStr = aSelList->selectionType(); if (aTypeStr == "part") { Quantity_Color aColor; if (AIS_ColorScale::FindColor(aMin, aMin, aMax, 1, aColor)) { SetColor(aColor); } - } - else { - int aNbIntertvals = aResMgr->integerValue("Viewer", "scalar_bar_nb_intervals", 20); + } else { + int aNbIntertvals = + aResMgr->integerValue("Viewer", "scalar_bar_nb_intervals", 20); for (int i = 0; i < aSelList->size(); i++) { AttributeSelectionPtr aSelection = aSelList->value(i); GeomShapePtr aShapePtr = aSelection->value(); TopoDS_Shape aShape = aShapePtr->impl(); double aValue = aShapeData.at(i); Quantity_Color aColor; - if (AIS_ColorScale::FindColor(aValue, aMin, aMax, aNbIntertvals, aColor)) + if (AIS_ColorScale::FindColor(aValue, aMin, aMax, aNbIntertvals, + aColor)) SetCustomColor(aShape, aColor); } } - } - break; - case ModelAPI_AttributeTables::BOOLEAN: - { + } break; + case ModelAPI_AttributeTables::BOOLEAN: { QList aShapeData = booleanValues(); AttributeSelectionListPtr aSelList = - aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); + aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); for (int i = 0; i < aSelList->size(); i++) { AttributeSelectionPtr aSelection = aSelList->value(i); GeomShapePtr aShapePtr = aSelection->value(); @@ -209,13 +205,11 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t if (AIS_ColorScale::FindColor(aValue, 0., 1., 2, aColor)) SetCustomColor(aShape, aColor); } - } - break; - case ModelAPI_AttributeTables::STRING: - { + } break; + case ModelAPI_AttributeTables::STRING: { QStringList aValues = strings(); AttributeSelectionListPtr aSelList = - aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); + aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); for (int i = 0; i < aSelList->size(); i++) { AttributeSelectionPtr aSelection = aSelList->value(i); @@ -223,7 +217,8 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t TopoDS_Shape aShape = aShapePtr->impl(); gp_Pnt aCenter; if (computeMassCenter(aShape, aCenter)) { - Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); + Handle(Graphic3d_AspectText3d) anAspectText3d = + new Graphic3d_AspectText3d(); anAspectText3d->SetStyle(Aspect_TOST_ANNOTATION); anAspectText3d->SetColor(aLabelColor); aGroup->SetPrimitivesAspect(anAspectText3d); @@ -236,17 +231,16 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t aGroup->AddText(aText); } } - } - break; + } break; } ViewerData_AISShape::Compute(thePrsMgr, thePrs, theMode); } -QList PartSet_FieldStepPrs::booleanValues() const -{ +QList PartSet_FieldStepPrs::booleanValues() const { DataPtr aData = myFeature->data(); int aStep = myStep->id(); - AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + aData->tables(CollectionPlugin_Field::VALUES_ID()); int aRows = aTablesAttr->rows(); int aCols = aTablesAttr->columns(); QList aFieldStepData; @@ -269,11 +263,11 @@ QList PartSet_FieldStepPrs::booleanValues() const return aShapeData; } -QStringList PartSet_FieldStepPrs::strings() const -{ +QStringList PartSet_FieldStepPrs::strings() const { DataPtr aData = myFeature->data(); int aStep = myStep->id(); - AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID()); + AttributeTablesPtr aTablesAttr = + aData->tables(CollectionPlugin_Field::VALUES_ID()); int aRows = aTablesAttr->rows(); int aCols = aTablesAttr->columns(); QStringList aFieldStepData; @@ -296,8 +290,8 @@ QStringList PartSet_FieldStepPrs::strings() const return aShapeData; } -bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pnt& theCenter) -{ +bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape &theShape, + gp_Pnt &theCenter) { theCenter.SetCoord(0, 0, 0); int aNbPoints = 0; @@ -308,9 +302,8 @@ bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pn theCenter = curve->Value(0.5 * (f + l)); aNbPoints = 1; } - } - else if (theShape.ShapeType() == TopAbs_FACE) { - const TopoDS_Face& F = TopoDS::Face(theShape); + } else if (theShape.ShapeType() == TopAbs_FACE) { + const TopoDS_Face &F = TopoDS::Face(theShape); BRepAdaptor_Surface surface(F); TopLoc_Location L; @@ -321,11 +314,11 @@ bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pn int n1, n2, n3; for (int iT = 1; iT <= triangulation->NbTriangles(); ++iT) { triangulation->Triangle(iT).Get(n1, n2, n3); - const gp_Pnt2d& uv1 = triangulation->UVNode(n1); - const gp_Pnt2d& uv2 = triangulation->UVNode(n2); - const gp_Pnt2d& uv3 = triangulation->UVNode(n3); + const gp_Pnt2d &uv1 = triangulation->UVNode(n1); + const gp_Pnt2d &uv2 = triangulation->UVNode(n2); + const gp_Pnt2d &uv3 = triangulation->UVNode(n3); double a = 0.5 * sqrt((uv1.X() - uv3.X()) * (uv2.Y() - uv1.Y()) - - (uv1.X() - uv2.X()) * (uv3.Y() - uv1.Y())); + (uv1.X() - uv2.X()) * (uv3.Y() - uv1.Y())); C += (uv1.XY() + uv2.XY() + uv3.XY()) / 3. * a; A += a; } @@ -336,8 +329,9 @@ bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pn } } if (aNbPoints == 0) { - theCenter = surface.Value(0.5 * (surface.FirstUParameter() + surface.LastUParameter()), - 0.5 * (surface.FirstVParameter() + surface.LastVParameter())); + theCenter = surface.Value( + 0.5 * (surface.FirstUParameter() + surface.LastUParameter()), + 0.5 * (surface.FirstVParameter() + surface.LastVParameter())); } aNbPoints = 1; } diff --git a/src/PartSet/PartSet_FieldStepPrs.h b/src/PartSet/PartSet_FieldStepPrs.h index a7c9bc45e..85e854cc1 100644 --- a/src/PartSet/PartSet_FieldStepPrs.h +++ b/src/PartSet/PartSet_FieldStepPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_FieldStepPrs_H @@ -23,11 +24,11 @@ #include "PartSet.h" #include -#include #include +#include -#include #include +#include #include #include @@ -35,12 +36,12 @@ DEFINE_STANDARD_HANDLE(PartSet_FieldStepPrs, ViewerData_AISShape) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide specific behaviour -* for wire presentations based in a one plane -*/ -class PartSet_FieldStepPrs : public ViewerData_AISShape, public ModuleBase_IStepPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * specific behaviour for wire presentations based in a one plane + */ +class PartSet_FieldStepPrs : public ViewerData_AISShape, + public ModuleBase_IStepPrs { public: /// Constructor /// \param theResult a result object @@ -48,21 +49,21 @@ public: ModelAPI_AttributeTables::ValueType dataType() const; - bool dataRange(double& theMin, double& theMax) const; + bool dataRange(double &theMin, double &theMax) const; DEFINE_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape) protected: //! Compute presentation considering sub-shape color map. - virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer theMode); + virtual void Compute(const Handle(PrsMgr_PresentationManager3d) & thePrsMgr, + const Handle(Prs3d_Presentation) & thePrs, + const Standard_Integer theMode); private: - QList range(double& theMin, double& theMax) const; + QList range(double &theMin, double &theMax) const; QList booleanValues() const; QStringList strings() const; - bool computeMassCenter(const TopoDS_Shape& theShape, gp_Pnt& theCenter); - + bool computeMassCenter(const TopoDS_Shape &theShape, gp_Pnt &theCenter); FieldStepPtr myStep; FeaturePtr myFeature; diff --git a/src/PartSet/PartSet_FilterInfinite.cpp b/src/PartSet/PartSet_FilterInfinite.cpp index 74ce0fa83..734df1761 100644 --- a/src/PartSet/PartSet_FilterInfinite.cpp +++ b/src/PartSet/PartSet_FilterInfinite.cpp @@ -14,44 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_FilterInfinite.h" -#include #include +#include #include #include #include #include -#include #include +#include IMPLEMENT_STANDARD_RTTIEXT(PartSet_FilterInfinite, SelectMgr_Filter); -PartSet_FilterInfinite::PartSet_FilterInfinite(ModuleBase_IWorkshop* theWorkshop) -: SelectMgr_Filter(), myWorkshop(theWorkshop) -{ -} +PartSet_FilterInfinite::PartSet_FilterInfinite( + ModuleBase_IWorkshop *theWorkshop) + : SelectMgr_Filter(), myWorkshop(theWorkshop) {} -Standard_Boolean PartSet_FilterInfinite::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const -{ +Standard_Boolean PartSet_FilterInfinite::IsOk( + const Handle(SelectMgr_EntityOwner) & theOwner) const { Standard_Boolean aValid = Standard_True; ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs()); myWorkshop->selection()->fillPresentation(aPrs, theOwner); ResultPtr aResult = myWorkshop->selection()->getResult(aPrs); // to filter infinite construction results - if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) { + if (aResult.get() && + aResult->groupName() == ModelAPI_ResultConstruction::group()) { ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aResult); + std::dynamic_pointer_cast(aResult); if (aConstruction.get() && aConstruction->isInfinite()) { - Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); + Handle(StdSelect_BRepOwner) aBRepOwner = + Handle(StdSelect_BRepOwner)::DownCast(theOwner); if (!aBRepOwner.IsNull() && aBRepOwner->HasShape()) { - const TopoDS_Shape& aShape = aBRepOwner->Shape(); + const TopoDS_Shape &aShape = aBRepOwner->Shape(); TopAbs_ShapeEnum anOwnerShapeType = aShape.ShapeType(); TopAbs_ShapeEnum aResultShapeType = TopAbs_SHAPE; @@ -71,7 +73,10 @@ Standard_Boolean PartSet_FilterInfinite::IsOk(const Handle(SelectMgr_EntityOwner } } #ifdef DEBUG_FILTERS - qDebug(QString("PartSet_FilterInfinite::IsOk = %1").arg(aValid).toStdString().c_str()); + qDebug(QString("PartSet_FilterInfinite::IsOk = %1") + .arg(aValid) + .toStdString() + .c_str()); #endif return aValid; } diff --git a/src/PartSet/PartSet_FilterInfinite.h b/src/PartSet/PartSet_FilterInfinite.h index 529715e4f..4918cb2c4 100644 --- a/src/PartSet/PartSet_FilterInfinite.h +++ b/src/PartSet/PartSet_FilterInfinite.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_FilterInfinite_H @@ -27,28 +28,27 @@ class ModuleBase_IWorkshop; /** -* \class PartSet_FilterInfinite -* \ingroup Modules -* A class which filters AIS objects with the true infinite state -*/ + * \class PartSet_FilterInfinite + * \ingroup Modules + * A class which filters AIS objects with the true infinite state + */ DEFINE_STANDARD_HANDLE(PartSet_FilterInfinite, SelectMgr_Filter); -class PartSet_FilterInfinite : public SelectMgr_Filter -{ +class PartSet_FilterInfinite : public SelectMgr_Filter { public: /// Constructor /// \param theWorkshop a pointer to workshop - PartSet_FilterInfinite(ModuleBase_IWorkshop* theWorkshop); + PartSet_FilterInfinite(ModuleBase_IWorkshop *theWorkshop); /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; DEFINE_STANDARD_RTTIEXT(PartSet_FilterInfinite, SelectMgr_Filter) protected: /// Reference to workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index 18c92c3c0..59e9cc5e0 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_Filters.h" -#include #include "ModuleBase_IModule.h" +#include #include #include -#include -#include #include +#include +#include #include #include @@ -35,21 +36,20 @@ #include #include +IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, + ModuleBase_ShapeDocumentFilter); -IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter); - -PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop) - : ModuleBase_ShapeDocumentFilter(theWorkshop) -{ +PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop *theWorkshop) + : ModuleBase_ShapeDocumentFilter(theWorkshop) { addNonSelectableType(ModelAPI_ResultField::group().c_str()); addNonSelectableType(ModelAPI_ResultGroup::group().c_str()); } - -Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const -{ +Standard_Boolean PartSet_GlobalFilter::IsOk( + const Handle(SelectMgr_EntityOwner) & theOwner) const { bool aValid = true; - std::shared_ptr aAISObj = AISObjectPtr(new GeomAPI_AISObject()); + std::shared_ptr aAISObj = + AISObjectPtr(new GeomAPI_AISObject()); Handle(AIS_InteractiveObject) aAisObj; if (theOwner->HasSelectable()) { aAisObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); @@ -58,7 +58,7 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& } } ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj); - ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->module()->currentOperation(); #ifdef HAVE_SALOME if (!aObj.get()) { @@ -76,14 +76,15 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& } #endif - // the shapes from different documents should be provided if there is no started operation - // in order to show/hide results + // the shapes from different documents should be provided if there is no + // started operation in order to show/hide results if (anOperation) { aValid = false; if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) { if (aObj) { ResultPtr aResult = std::dynamic_pointer_cast(aObj); - // result of parts belongs to PartSet document and can be selected only when PartSet + // result of parts belongs to PartSet document and can be selected only + // when PartSet // is active in order to do not select the result of the active part. if (aResult.get()) { std::string aResultGroupName = aResult->groupName(); @@ -94,12 +95,13 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& aValid = Standard_False; } else aValid = Standard_True; - } - else { // possibly this code is obsolete, as a feature object can be selected in recovery + } else { // possibly this code is obsolete, as a feature object can be + // selected in recovery // only and there can not be Group feature FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature) { - aValid = !myNonSelectableTypes.contains(aFeature->getKind().c_str()); + aValid = + !myNonSelectableTypes.contains(aFeature->getKind().c_str()); } else aValid = Standard_True; } @@ -109,25 +111,28 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& } } #ifdef DEBUG_FILTERS - qDebug(QString("PartSet_GlobalFilter::IsOk = %1").arg(aValid).toStdString().c_str()); + qDebug(QString("PartSet_GlobalFilter::IsOk = %1") + .arg(aValid) + .toStdString() + .c_str()); #endif return aValid; } IMPLEMENT_STANDARD_RTTIEXT(PartSet_ResultGroupNameFilter, SelectMgr_Filter); -void PartSet_ResultGroupNameFilter::setGroupNames(const std::set& theGroupNames) -{ +void PartSet_ResultGroupNameFilter::setGroupNames( + const std::set &theGroupNames) { myGroupNames = theGroupNames; } Standard_Boolean PartSet_ResultGroupNameFilter::IsOk( - const Handle(SelectMgr_EntityOwner)& theOwner) const -{ - std::shared_ptr aAISObj = AISObjectPtr(new GeomAPI_AISObject()); + const Handle(SelectMgr_EntityOwner) & theOwner) const { + std::shared_ptr aAISObj = + AISObjectPtr(new GeomAPI_AISObject()); if (theOwner->HasSelectable()) { Handle(AIS_InteractiveObject) aAisObj = - Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); + Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); if (!aAisObj.IsNull()) { aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj)); } @@ -137,80 +142,83 @@ Standard_Boolean PartSet_ResultGroupNameFilter::IsOk( return true; ResultPtr aResult = std::dynamic_pointer_cast(anObject); - // result of parts belongs to PartSet document and can be selected only when PartSet + // result of parts belongs to PartSet document and can be selected only when + // PartSet // is active in order to do not select the result of the active part. if (!aResult.get()) return true; - std::string aGroupName = aResult->groupName();// == ModelAPI_ResultPart::group()) { + std::string aGroupName = + aResult->groupName(); // == ModelAPI_ResultPart::group()) { if (myGroupNames.find(aGroupName) != myGroupNames.end()) return false; // the object of the filtered type is found return true; } - IMPLEMENT_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter); -Standard_Boolean - PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const -{ - ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); - if(!anOperation) { +Standard_Boolean PartSet_CirclePointFilter::IsOk( + const Handle(SelectMgr_EntityOwner) & theOwner) const { + ModuleBase_Operation *anOperation = myWorkshop->module()->currentOperation(); + if (!anOperation) { return Standard_True; } - if(theOwner->HasSelectable() == Standard_False) { + if (theOwner->HasSelectable() == Standard_False) { return Standard_True; } - Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); - if(aBrepOwner.IsNull()) { + Handle(StdSelect_BRepOwner) aBrepOwner = + Handle(StdSelect_BRepOwner)::DownCast(theOwner); + if (aBrepOwner.IsNull()) { return Standard_True; } - const TopoDS_Shape& aShape = aBrepOwner->Shape(); - if(aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) { + const TopoDS_Shape &aShape = aBrepOwner->Shape(); + if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) { return Standard_True; } Handle(ModuleBase_ResultPrs) aResultPrs = - Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable()); - if(aResultPrs.IsNull()) { + Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable()); + if (aResultPrs.IsNull()) { return Standard_True; } std::shared_ptr aGeomAISObj(new GeomAPI_AISObject()); aGeomAISObj->setImpl(new Handle(AIS_InteractiveObject)(aResultPrs)); ObjectPtr anObj = myWorkshop->findPresentedObject(aGeomAISObj); - if(!anObj.get()) { + if (!anObj.get()) { return Standard_True; } ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if(!aResult.get()) { + if (!aResult.get()) { return Standard_True; } DocumentPtr aDocument = aResult->document(); - if(!aDocument.get()) { + if (!aDocument.get()) { return Standard_True; } FeaturePtr aFeature = aDocument->feature(aResult); - if(!aFeature.get() || - ((aFeature->getKind() != "SketchCircle") && - (aFeature->getKind() != "SketchBSplinePeriodic"))) { + if (!aFeature.get() || ((aFeature->getKind() != "SketchCircle") && + (aFeature->getKind() != "SketchBSplinePeriodic"))) { return Standard_True; } const TopoDS_Shape anOwnerShape = aResultPrs->Shape(); - if(anOwnerShape.ShapeType() == TopAbs_EDGE) { + if (anOwnerShape.ShapeType() == TopAbs_EDGE) { return Standard_False; } #ifdef DEBUG_FILTERS - qDebug(QString("PartSet_ShapeDocumentFilter::IsOk = %1").arg(aValid).toStdString().c_str()); + qDebug(QString("PartSet_ShapeDocumentFilter::IsOk = %1") + .arg(aValid) + .toStdString() + .c_str()); #endif return Standard_True; diff --git a/src/PartSet/PartSet_Filters.h b/src/PartSet/PartSet_Filters.h index 0e02759bf..cffc22beb 100644 --- a/src/PartSet/PartSet_Filters.h +++ b/src/PartSet/PartSet_Filters.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_Filters_H @@ -26,22 +27,21 @@ #include /** -* \class PartSet_GlobalFilter -* \ingroup Modules -* A class which filters groups object in addition to documents (see issue #310) -*/ + * \class PartSet_GlobalFilter + * \ingroup Modules + * A class which filters groups object in addition to documents (see issue #310) + */ DEFINE_STANDARD_HANDLE(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter); -class PartSet_GlobalFilter: public ModuleBase_ShapeDocumentFilter -{ +class PartSet_GlobalFilter : public ModuleBase_ShapeDocumentFilter { public: /// Constructor /// \param theWorkshop a pointer to workshop - PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop); + PartSet_GlobalFilter(ModuleBase_IWorkshop *theWorkshop); /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; DEFINE_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter) }; @@ -50,25 +50,24 @@ public: /// \ingroup Modules /// A class which filters results with groupName() result in filter parameters DEFINE_STANDARD_HANDLE(PartSet_ResultGroupNameFilter, SelectMgr_Filter); -class PartSet_ResultGroupNameFilter: public SelectMgr_Filter -{ +class PartSet_ResultGroupNameFilter : public SelectMgr_Filter { public: /// Constructor /// \param theWorkshop a pointer to workshop - PartSet_ResultGroupNameFilter(ModuleBase_IWorkshop* theWorkshop) - : SelectMgr_Filter(), myWorkshop(theWorkshop) {} + PartSet_ResultGroupNameFilter(ModuleBase_IWorkshop *theWorkshop) + : SelectMgr_Filter(), myWorkshop(theWorkshop) {} - void setGroupNames(const std::set& theGroupNames); + void setGroupNames(const std::set &theGroupNames); /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; DEFINE_STANDARD_RTTIEXT(PartSet_ResultGroupNameFilter, SelectMgr_Filter) private: - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; std::set myGroupNames; }; @@ -77,27 +76,23 @@ private: /// \brief A filter which provide filtering of selection in 3d viewer. /// Installing of this filter disables selection of point on circle in sketch DEFINE_STANDARD_HANDLE(PartSet_CirclePointFilter, SelectMgr_Filter); -class PartSet_CirclePointFilter: public SelectMgr_Filter -{ +class PartSet_CirclePointFilter : public SelectMgr_Filter { public: - /// Constructor /// \param theWorkshop instance of workshop interface - Standard_EXPORT PartSet_CirclePointFilter(ModuleBase_IWorkshop* theWorkshop): - SelectMgr_Filter(), - myWorkshop(theWorkshop) {}; + Standard_EXPORT PartSet_CirclePointFilter(ModuleBase_IWorkshop *theWorkshop) + : SelectMgr_Filter(), myWorkshop(theWorkshop){}; /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; DEFINE_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter) private: - /// Reference to workshop - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_IconFactory.cpp b/src/PartSet/PartSet_IconFactory.cpp index 45ccd129c..dbd172584 100644 --- a/src/PartSet/PartSet_IconFactory.cpp +++ b/src/PartSet/PartSet_IconFactory.cpp @@ -14,40 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_IconFactory.h" -#include "PartSet_Tools.h" #include "PartSet_Module.h" +#include "PartSet_Tools.h" #include "XGUI_DataModel.h" -#include #include +#include #include #include +#include +#include #include #include -#include -#include #include #include QMap PartSet_IconFactory::myIcons; -PartSet_IconFactory::PartSet_IconFactory(PartSet_Module* theModule) - : ModuleBase_IconFactory(), myModule(theModule) -{ - Events_Loop::loop()->registerListener(this, - Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT())); +PartSet_IconFactory::PartSet_IconFactory(PartSet_Module *theModule) + : ModuleBase_IconFactory(), myModule(theModule) { + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT())); } - -QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) -{ +QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) { if (!theObj.get()) return QIcon(); @@ -65,14 +63,14 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) switch (aState) { case ModelAPI_StateMustBeUpdated: return ModuleBase_Tools::composite(":icons/toWork.png", anIconString); - //anIcon = ModuleBase_Tools::lighter(anIconString); + // anIcon = ModuleBase_Tools::lighter(anIconString); break; case ModelAPI_StateExecFailed: return ModuleBase_Tools::composite(":icons/isFailed.png", anIconString); break; case ModelAPI_StateInvalidArgument: - return ModuleBase_Tools::composite(":icons/exec_state_invalid_parameters.png", - anIconString); + return ModuleBase_Tools::composite( + ":icons/exec_state_invalid_parameters.png", anIconString); break; default: return loadIcon(anIconString); @@ -80,8 +78,9 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) } } - //if (theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated) - // return QIcon(":pictures/constr_object_modified.png"); + // if (theObj->data() && theObj->data()->execState() == + // ModelAPI_StateMustBeUpdated) + // return QIcon(":pictures/constr_object_modified.png"); if (aGroup == ModelAPI_ResultPart::group()) return QIcon(":pictures/part_ico.png"); @@ -96,8 +95,9 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) if ((aFirst != -1) && (aLast != -1)) { int aNbItems = aLast - aFirst + 1; if (aNbItems) { - XGUI_ObjectsBrowser* aObBrowser = myModule->getWorkshop()->objectBrowser(); - XGUI_DataTree* aTree = aObBrowser->treeView(); + XGUI_ObjectsBrowser *aObBrowser = + myModule->getWorkshop()->objectBrowser(); + XGUI_DataTree *aTree = aObBrowser->treeView(); QModelIndex aIndex = aTree->dataModel()->objectIndex(theObj, 0); if (!aTree->isExpanded(aIndex)) { DocumentPtr aDoc = theObj->document(); @@ -107,13 +107,15 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) for (int i = aFirst; i < aLast + 1; i++) { aSubObj = aDoc->object(ModelAPI_Feature::group(), i); aState = aSubObj->data()->execState(); - if ((aState == ModelAPI_StateExecFailed) || (aState == ModelAPI_StateMustBeUpdated)) { + if ((aState == ModelAPI_StateExecFailed) || + (aState == ModelAPI_StateMustBeUpdated)) { aHasWarning = true; break; } } if (aHasWarning) { - return QIcon(ModuleBase_Tools::composite(":icons/hasWarning.png", anIconString)); + return QIcon(ModuleBase_Tools::composite(":icons/hasWarning.png", + anIconString)); } } } @@ -124,52 +126,60 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) ResultPtr aResult = std::dynamic_pointer_cast(theObj); if (aResult.get()) { GeomShapePtr aShape = aResult->shape(); - if(aShape.get()) { - switch(aShape->shapeType()) { - case GeomAPI_Shape::COMPOUND: { - if (aResult->groupName() == ModelAPI_ResultGroup::group()) { - switch (aShape->typeOfCompoundShapes()) { - case GeomAPI_Shape::VERTEX: - return QIcon(":icons/group_vertex.png"); - case GeomAPI_Shape::EDGE: - return QIcon(":icons/group_edge.png"); - case GeomAPI_Shape::FACE: - return QIcon(":icons/group_face.png"); - case GeomAPI_Shape::SOLID: - return QIcon(":icons/group_solid.png"); - default: // [to avoid compilation warning] - break; - } + if (aShape.get()) { + switch (aShape->shapeType()) { + case GeomAPI_Shape::COMPOUND: { + if (aResult->groupName() == ModelAPI_ResultGroup::group()) { + switch (aShape->typeOfCompoundShapes()) { + case GeomAPI_Shape::VERTEX: + return QIcon(":icons/group_vertex.png"); + case GeomAPI_Shape::EDGE: + return QIcon(":icons/group_edge.png"); + case GeomAPI_Shape::FACE: + return QIcon(":icons/group_face.png"); + case GeomAPI_Shape::SOLID: + return QIcon(":icons/group_solid.png"); + default: // [to avoid compilation warning] + break; } - ResultBodyPtr aBody = std::dynamic_pointer_cast(aResult); - if (aBody.get() && aBody->isConnectedTopology()) - return QIcon(":pictures/compoundofsolids.png"); - return QIcon(":pictures/compound.png"); } - case GeomAPI_Shape::COMPSOLID: return QIcon(":pictures/compsolid.png"); - case GeomAPI_Shape::SOLID: return QIcon(":pictures/solid.png"); - case GeomAPI_Shape::SHELL: return QIcon(":pictures/shell.png"); - case GeomAPI_Shape::FACE: return QIcon(":pictures/face.png"); - case GeomAPI_Shape::WIRE: return QIcon(":pictures/wire.png"); - case GeomAPI_Shape::EDGE: return QIcon(":pictures/edge.png"); - case GeomAPI_Shape::VERTEX: return QIcon(":pictures/vertex.png"); - default: // [to avoid compilation warning] - break; + ResultBodyPtr aBody = + std::dynamic_pointer_cast(aResult); + if (aBody.get() && aBody->isConnectedTopology()) + return QIcon(":pictures/compoundofsolids.png"); + return QIcon(":pictures/compound.png"); + } + case GeomAPI_Shape::COMPSOLID: + return QIcon(":pictures/compsolid.png"); + case GeomAPI_Shape::SOLID: + return QIcon(":pictures/solid.png"); + case GeomAPI_Shape::SHELL: + return QIcon(":pictures/shell.png"); + case GeomAPI_Shape::FACE: + return QIcon(":pictures/face.png"); + case GeomAPI_Shape::WIRE: + return QIcon(":pictures/wire.png"); + case GeomAPI_Shape::EDGE: + return QIcon(":pictures/edge.png"); + case GeomAPI_Shape::VERTEX: + return QIcon(":pictures/vertex.png"); + default: // [to avoid compilation warning] + break; } } } return QIcon(); } -void PartSet_IconFactory::processEvent(const std::shared_ptr& theMessage) -{ +void PartSet_IconFactory::processEvent( + const std::shared_ptr &theMessage) { if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) { std::shared_ptr aFeatureMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); ActionInfo aFeatureInfo; aFeatureInfo.initFrom(aFeatureMsg); // Remember features icons myIcons[QString::fromStdString(aFeatureMsg->id())] = aFeatureInfo.iconFile; } -} \ No newline at end of file +} diff --git a/src/PartSet/PartSet_IconFactory.h b/src/PartSet/PartSet_IconFactory.h index 2363c0a88..a0d622aec 100644 --- a/src/PartSet/PartSet_IconFactory.h +++ b/src/PartSet/PartSet_IconFactory.h @@ -14,19 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_IconFactory_H #define PartSet_IconFactory_H #include "PartSet.h" -#include #include +#include #include - class PartSet_Module; /**\class PartSet_IconFactory @@ -34,11 +34,11 @@ class PartSet_Module; * \brief This is a class is redefined in order to provide * icons of objects for object browser specific for PartSetModule */ -class PARTSET_EXPORT PartSet_IconFactory : public ModuleBase_IconFactory, public Events_Listener -{ +class PARTSET_EXPORT PartSet_IconFactory : public ModuleBase_IconFactory, + public Events_Listener { public: /// Constructor - PartSet_IconFactory(PartSet_Module* theModule); + PartSet_IconFactory(PartSet_Module *theModule); /// Returns Icon for the given object /// \param theObj an object @@ -46,11 +46,11 @@ public: /// Event Listener method /// \param theMessage an event message - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); private: static QMap myIcons; - PartSet_Module* myModule; + PartSet_Module *myModule; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index b9c7e78c8..91d8b5dcb 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_MenuMgr.h" @@ -27,58 +28,54 @@ #include #include +#include #include #include -#include #include #include #include +#include #include #include -#include -#include #include +#include -#include -#include -#include #include -#include +#include +#include #include +#include #include #include +#include #include #include -#include #include +#include -#include #include -#include -#include #include +#include +#include +#include -#include #include +#include -PartSet_MenuMgr::PartSet_MenuMgr(PartSet_Module* theModule) - : QObject(theModule), myModule(theModule), myPrevId(-1) -{ +PartSet_MenuMgr::PartSet_MenuMgr(PartSet_Module *theModule) + : QObject(theModule), myModule(theModule), myPrevId(-1) { createActions(); } - -QAction* PartSet_MenuMgr::action(const QString& theId) const -{ +QAction *PartSet_MenuMgr::action(const QString &theId) const { if (myActions.contains(theId)) return myActions[theId]; return 0; } -void PartSet_MenuMgr::addAction(const QString& theId, QAction* theAction) -{ +void PartSet_MenuMgr::addAction(const QString &theId, QAction *theAction) { if (myActions.contains(theId)) qCritical("A command with Id = '%s' already defined!", qPrintable(theId)); theAction->setData(theId); @@ -86,37 +83,38 @@ void PartSet_MenuMgr::addAction(const QString& theId, QAction* theAction) myActions[theId] = theAction; } -void PartSet_MenuMgr::createActions() -{ - QAction* aAction; +void PartSet_MenuMgr::createActions() { + QAction *aAction; - QWidget* aParent = myModule->workshop()->desktop(); + QWidget *aParent = myModule->workshop()->desktop(); aAction = ModuleBase_Tools::createAction(QIcon(), tr("Auxiliary"), aParent); aAction->setCheckable(true); addAction("AUXILIARY_CMD", aAction); - aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), aParent, - this, SLOT(onActivatePart(bool))); + aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), + tr("Activate"), aParent, this, + SLOT(onActivatePart(bool))); myActions["ACTIVATE_PART_CMD"] = aAction; // Activate PartSet - aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), aParent, - this, SLOT(onActivatePartSet(bool))); + aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), + tr("Activate"), aParent, this, + SLOT(onActivatePartSet(bool))); myActions["ACTIVATE_PARTSET_CMD"] = aAction; - aAction = ModuleBase_Tools::createAction(QIcon(":icons/edit.png"), tr("Edit..."), aParent, - this, SLOT(onEdit(bool))); + aAction = + ModuleBase_Tools::createAction(QIcon(":icons/edit.png"), tr("Edit..."), + aParent, this, SLOT(onEdit(bool))); myActions["EDIT_CMD"] = aAction; - aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Load all parts"), - aParent, this, SLOT(onActivateAllParts())); + aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), + tr("Load all parts"), aParent, this, + SLOT(onActivateAllParts())); myActions["ACTIVATE_ALL_PARTS_CMD"] = aAction; } - -void PartSet_MenuMgr::onAction(bool isChecked) -{ - QAction* aAction = static_cast(sender()); +void PartSet_MenuMgr::onAction(bool isChecked) { + QAction *aAction = static_cast(sender()); QString anId = aAction->data().toString(); if (anId == "AUXILIARY_CMD") { @@ -124,34 +122,34 @@ void PartSet_MenuMgr::onAction(bool isChecked) } } -bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions, - QWidget* theParent, - QMap& theMenuActions) const -{ +bool PartSet_MenuMgr::addViewerMenu( + const QMap &theStdActions, QWidget *theParent, + QMap &theMenuActions) const { int anIndex = 0; - ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation(); + ModuleBase_Operation *anOperation = myModule->workshop()->currentOperation(); if (!PartSet_SketcherMgr::isSketchOperation(anOperation) && !myModule->sketchMgr()->isNestedSketchOperation(anOperation)) return false; myCoinsideLines.clear(); - ModuleBase_ISelection* aSelection = myModule->workshop()->selection(); + ModuleBase_ISelection *aSelection = myModule->workshop()->selection(); bool aIsDetach = false; bool hasAttribute = false; bool hasFeature = false; - QList aPrsList = aSelection->getSelected(ModuleBase_ISelection::Viewer); + QList aPrsList = + aSelection->getSelected(ModuleBase_ISelection::Viewer); if (aPrsList.size() > 1) { hasFeature = true; } else if (aPrsList.size() == 1) { ResultPtr aResult; FeaturePtr aFeature; - foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) { + foreach (ModuleBase_ViewerPrsPtr aPrs, aPrsList) { aResult = std::dynamic_pointer_cast(aPrs->object()); if (aResult.get() != NULL) { - const GeomShapePtr& aShape = aPrs->shape(); + const GeomShapePtr &aShape = aPrs->shape(); if (aShape.get() && aShape->isEqual(aResult->shape())) hasFeature = true; else @@ -162,39 +160,43 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions } } - const GeomShapePtr& aShape = aPrsList.first()->shape(); - if (aShape.get() && !aShape->isNull() && aShape->shapeType() == GeomAPI_Shape::VERTEX) { + const GeomShapePtr &aShape = aPrsList.first()->shape(); + if (aShape.get() && !aShape->isNull() && + aShape->shapeType() == GeomAPI_Shape::VERTEX) { // Find 2d coordinates FeaturePtr aSketchFea = myModule->sketchMgr()->activeSketch(); if (aSketchFea->getKind() == SketchPlugin_Sketch::ID()) { - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aTDShape)); - std::shared_ptr aPnt3d(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); - std::shared_ptr aSelPnt = PartSet_Tools::convertTo2D(aSketchFea, aPnt3d); + std::shared_ptr aPnt3d( + new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); + std::shared_ptr aSelPnt = + PartSet_Tools::convertTo2D(aSketchFea, aPnt3d); // Find coincident in these coordinates ObjectPtr aObj = aPrsList.first()->object(); - FeaturePtr aCoincident = - PartSet_Tools::findFirstCoincidence(ModelAPI_Feature::feature(aObj), aSelPnt); + FeaturePtr aCoincident = PartSet_Tools::findFirstCoincidence( + ModelAPI_Feature::feature(aObj), aSelPnt); // If we have coincidence then add Detach menu if (aCoincident.get() != NULL) { QList aCoins; mySelectedFeature = aCoincident; QList anIsAttributes; - PartSet_Tools::findCoincidences(mySelectedFeature, myCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), - anIsAttributes); - PartSet_Tools::findCoincidences(mySelectedFeature, myCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), - anIsAttributes); + PartSet_Tools::findCoincidences( + mySelectedFeature, myCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_A(), anIsAttributes); + PartSet_Tools::findCoincidences( + mySelectedFeature, myCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_B(), anIsAttributes); if (myCoinsideLines.size() > 0) { aIsDetach = true; - QMenu* aSubMenu = new QMenu(tr("Detach"), theParent); + QMenu *aSubMenu = new QMenu(tr("Detach"), theParent); theMenuActions[anIndex++] = aSubMenu->menuAction(); - QAction* aAction; + QAction *aAction; int i = 0; foreach (FeaturePtr aCoinsL, myCoinsideLines) { - QString anItemText = QString::fromStdWString(aCoinsL->data()->name()); + QString anItemText = + QString::fromStdWString(aCoinsL->data()->name()); #ifdef _DEBUG if (anIsAttributes[i]) anItemText += " [attribute]"; @@ -203,9 +205,11 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions aAction->setData(QVariant(i)); i++; } - connect(aSubMenu, SIGNAL(hovered(QAction*)), SLOT(onLineHighlighted(QAction*))); + connect(aSubMenu, SIGNAL(hovered(QAction *)), + SLOT(onLineHighlighted(QAction *))); connect(aSubMenu, SIGNAL(aboutToHide()), SLOT(onDetachMenuHide())); - connect(aSubMenu, SIGNAL(triggered(QAction*)), SLOT(onLineDetach(QAction*))); + connect(aSubMenu, SIGNAL(triggered(QAction *)), + SLOT(onLineDetach(QAction *))); } } } @@ -214,7 +218,7 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions if (!hasAttribute) { bool isAuxiliary; if (canSetAuxiliary(isAuxiliary)) { - QAction* anAction = action("AUXILIARY_CMD"); + QAction *anAction = action("AUXILIARY_CMD"); theMenuActions[anIndex++] = anAction; anAction->setChecked(isAuxiliary); } @@ -228,12 +232,13 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions return true; } -void PartSet_MenuMgr::updateViewerMenu(const QMap& theStdActions) -{ - ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation(); +void PartSet_MenuMgr::updateViewerMenu( + const QMap &theStdActions) { + ModuleBase_Operation *anOperation = myModule->workshop()->currentOperation(); - bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) || - myModule->sketchMgr()->isNestedSketchOperation(anOperation); + bool isActiveSketch = + PartSet_SketcherMgr::isSketchOperation(anOperation) || + myModule->sketchMgr()->isNestedSketchOperation(anOperation); if (isActiveSketch) { theStdActions["WIREFRAME_CMD"]->setEnabled(false); theStdActions["SHADING_CMD"]->setEnabled(false); @@ -244,9 +249,7 @@ void PartSet_MenuMgr::updateViewerMenu(const QMap& theStdActi } } - -void PartSet_MenuMgr::onLineHighlighted(QAction* theAction) -{ +void PartSet_MenuMgr::onLineHighlighted(QAction *theAction) { if (myPrevId != -1) { // Restore color for previous object setLineColor(myPrevId, myColor, false); @@ -255,15 +258,16 @@ void PartSet_MenuMgr::onLineHighlighted(QAction* theAction) myColor = setLineColor(myPrevId, Qt::white, true); } -QColor PartSet_MenuMgr::setLineColor(int theId, const QColor theColor, bool theUpdate) -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); +QColor PartSet_MenuMgr::setLineColor(int theId, const QColor theColor, + bool theUpdate) { + XGUI_ModuleConnector *aConnector = + dynamic_cast(myModule->workshop()); + XGUI_Workshop *aWorkshop = aConnector->workshop(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); FeaturePtr aLine = myCoinsideLines.at(myPrevId); std::list::const_iterator aIt; - const std::list& aResults = aLine->results(); + const std::list &aResults = aLine->results(); QColor aColor; for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { aColor = aDisplayer->setObjectColor((*aIt), theColor, false); @@ -273,17 +277,17 @@ QColor PartSet_MenuMgr::setLineColor(int theId, const QColor theColor, bool theU return aColor; } - -void addRefCoincidentFeatures(const std::set& theRefList, - std::shared_ptr& theRefPnt, - QObjectPtrList& theOutList) -{ +void addRefCoincidentFeatures(const std::set &theRefList, + std::shared_ptr &theRefPnt, + QObjectPtrList &theOutList) { std::set::const_iterator aIt; for (aIt = theRefList.cbegin(); aIt != theRefList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { - std::shared_ptr aPnt = PartSet_Tools::getCoincedencePoint(aConstrFeature); + std::shared_ptr aPnt = + PartSet_Tools::getCoincedencePoint(aConstrFeature); if (aPnt.get() == NULL) return; if (theRefPnt->isEqual(aPnt) && (!theOutList.contains(aConstrFeature))) { @@ -293,34 +297,36 @@ void addRefCoincidentFeatures(const std::set& theRefList, } } -void PartSet_MenuMgr::onLineDetach(QAction* theAction) -{ +void PartSet_MenuMgr::onLineDetach(QAction *theAction) { int aId = theAction->data().toInt(); FeaturePtr aLine = myCoinsideLines.at(aId); - std::shared_ptr aOrig = PartSet_Tools::getCoincedencePoint(mySelectedFeature); + std::shared_ptr aOrig = + PartSet_Tools::getCoincedencePoint(mySelectedFeature); if (!aOrig.get()) return; - const std::set& aRefsList = aLine->data()->refsToMe(); + const std::set &aRefsList = aLine->data()->refsToMe(); QObjectPtrList aToDelFeatures; addRefCoincidentFeatures(aRefsList, aOrig, aToDelFeatures); - const std::list& aResults = aLine->results(); + const std::list &aResults = aLine->results(); std::list::const_iterator aResIt; for (aResIt = aResults.cbegin(); aResIt != aResults.cend(); aResIt++) { ResultPtr aResult = (*aResIt); - const std::set& aRefList = aResult->data()->refsToMe(); + const std::set &aRefList = aResult->data()->refsToMe(); addRefCoincidentFeatures(aRefList, aOrig, aToDelFeatures); } if (aToDelFeatures.size() > 0) { - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - - ModuleBase_Operation* anOpAction = new ModuleBase_Operation(tr("Detach %1").arg( - QString::fromStdWString(aLine->data()->name())), myModule); - XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(myModule->workshop()); + XGUI_Workshop *aWorkshop = aConnector->workshop(); + + ModuleBase_Operation *anOpAction = new ModuleBase_Operation( + tr("Detach %1").arg(QString::fromStdWString(aLine->data()->name())), + myModule); + XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); // the active nested sketch operation should be aborted unconditionally // the Delete action should be additionally granted for the Sketch operation // in order to do not abort/commit it @@ -336,9 +342,7 @@ void PartSet_MenuMgr::onLineDetach(QAction* theAction) myCoinsideLines.clear(); } - -void PartSet_MenuMgr::onDetachMenuHide() -{ +void PartSet_MenuMgr::onDetachMenuHide() { if (myPrevId != -1) { // Restore color for previous object setLineColor(myPrevId, myColor, false); @@ -347,14 +351,13 @@ void PartSet_MenuMgr::onDetachMenuHide() myPrevId = -1; } - -void PartSet_MenuMgr::setAuxiliary(const bool isChecked) -{ - ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation(); +void PartSet_MenuMgr::setAuxiliary(const bool isChecked) { + ModuleBase_Operation *anOperation = myModule->workshop()->currentOperation(); CompositeFeaturePtr aSketch = myModule->sketchMgr()->activeSketch(); - bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) || - myModule->sketchMgr()->isNestedSketchOperation(anOperation); + bool isActiveSketch = + PartSet_SketcherMgr::isSketchOperation(anOperation) || + myModule->sketchMgr()->isNestedSketchOperation(anOperation); if (!isActiveSketch) return; @@ -362,24 +365,24 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) bool isUseTransaction = false; // 1. change auxiliary type of a created feature if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) && - PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperation); - if (aFOperation) - anObjects.append(aFOperation->feature()); - } - else { + PartSet_SketcherMgr::isEntity(anOperation->id().toStdString())) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(anOperation); + if (aFOperation) + anObjects.append(aFOperation->feature()); + } else { isUseTransaction = true; // 2. change auxiliary type of selected sketch entities - ModuleBase_ISelection* aSelection = myModule->workshop()->selection(); + ModuleBase_ISelection *aSelection = myModule->workshop()->selection(); anObjects = aSelection->selectedPresentations(); } - QAction* anAction = action("AUXILIARY_CMD"); - //SessionPtr aMgr = ModelAPI_Session::get(); - ModuleBase_Operation* anOpAction = 0; - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr(); + QAction *anAction = action("AUXILIARY_CMD"); + // SessionPtr aMgr = ModelAPI_Session::get(); + ModuleBase_Operation *anOpAction = 0; + XGUI_ModuleConnector *aConnector = + dynamic_cast(myModule->workshop()); + XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); if (isUseTransaction) { anOpAction = new ModuleBase_Operation(anAction->text(), myModule); @@ -389,23 +392,26 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) anOpMgr->startOperation(anOpAction); } - static const Events_ID anVisualEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); + static const Events_ID anVisualEvent = + Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); if (anObjects.size() > 0) { - QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); + QObjectPtrList::const_iterator anIt = anObjects.begin(), + aLast = anObjects.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); if (aFeature.get() != NULL) { std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get() != NULL) { std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); std::shared_ptr anAuxiliaryAttr = - std::dynamic_pointer_cast( - aSketchFeature->data()->attribute(anAttribute)); + std::dynamic_pointer_cast( + aSketchFeature->data()->attribute(anAttribute)); if (anAuxiliaryAttr) anAuxiliaryAttr->setValue(isChecked); - ModelAPI_EventCreator::get()->sendUpdated(aSketchFeature, anVisualEvent); + ModelAPI_EventCreator::get()->sendUpdated(aSketchFeature, + anVisualEvent); } } } @@ -417,51 +423,52 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) Events_Loop::loop()->flush(anVisualEvent); } -bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const -{ +bool PartSet_MenuMgr::canSetAuxiliary(bool &theValue) const { bool anEnabled = false; - ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation(); + ModuleBase_Operation *anOperation = myModule->workshop()->currentOperation(); CompositeFeaturePtr aSketch = myModule->sketchMgr()->activeSketch(); - bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) || - myModule->sketchMgr()->isNestedSketchOperation(anOperation); + bool isActiveSketch = + PartSet_SketcherMgr::isSketchOperation(anOperation) || + myModule->sketchMgr()->isNestedSketchOperation(anOperation); if (!isActiveSketch) return anEnabled; QObjectPtrList anObjects; // 1. change auxiliary type of a created feature if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) && - PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) { - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(anOperation); + PartSet_SketcherMgr::isEntity(anOperation->id().toStdString())) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(anOperation); if (aFOperation) anObjects.append(aFOperation->feature()); - } - else { - /// The operation should not be aborted here, because the method does not changed - /// the auxilliary state, but checks the possibility to perform this - ///if (myModule->sketchMgr()->isNestedSketchOperation(anOperation)) + } else { + /// The operation should not be aborted here, because the method does not + /// changed the auxilliary state, but checks the possibility to perform this + /// if (myModule->sketchMgr()->isNestedSketchOperation(anOperation)) /// anOperation->abort(); // 2. change auxiliary type of selected sketch entities - ModuleBase_ISelection* aSelection = myModule->workshop()->selection(); + ModuleBase_ISelection *aSelection = myModule->workshop()->selection(); anObjects = aSelection->selectedPresentations(); } bool isNotAuxiliaryFound = false; if (anObjects.size() > 0) { - QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); + QObjectPtrList::const_iterator anIt = anObjects.begin(), + aLast = anObjects.end(); for (; anIt != aLast && !isNotAuxiliaryFound; anIt++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - if ((aFeature.get() != NULL) && PartSet_SketcherMgr::isEntity(aFeature->getKind())) { + if ((aFeature.get() != NULL) && + PartSet_SketcherMgr::isEntity(aFeature->getKind())) { anEnabled = true; std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get() != NULL) { std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); std::shared_ptr anAuxiliaryAttr = - std::dynamic_pointer_cast( - aSketchFeature->data()->attribute(anAttribute)); + std::dynamic_pointer_cast( + aSketchFeature->data()->attribute(anAttribute)); if (anAuxiliaryAttr) isNotAuxiliaryFound = !anAuxiliaryAttr->value(); } @@ -472,18 +479,21 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const return anEnabled; } -void PartSet_MenuMgr::onActivatePart(bool) -{ +void PartSet_MenuMgr::onActivatePart(bool) { if (myModule->workshop()->currentOperation()) return; - QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects(); + QObjectPtrList aObjects = + myModule->workshop()->selection()->selectedObjects(); if (aObjects.size() > 0) { ObjectPtr aObj = aObjects.first(); ResultPartPtr aPart = std::dynamic_pointer_cast(aObj); if (!aPart.get()) { - FeaturePtr aPartFeature = std::dynamic_pointer_cast(aObj); - if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) { - aPart = std::dynamic_pointer_cast(aPartFeature->firstResult()); + FeaturePtr aPartFeature = + std::dynamic_pointer_cast(aObj); + if (aPartFeature.get() && + (aPartFeature->getKind() == PartSetPlugin_Part::ID())) { + aPart = std::dynamic_pointer_cast( + aPartFeature->firstResult()); } } if (aPart.get()) { @@ -493,16 +503,16 @@ void PartSet_MenuMgr::onActivatePart(bool) } } -void PartSet_MenuMgr::activatePart(ResultPartPtr thePart) const -{ +void PartSet_MenuMgr::activatePart(ResultPartPtr thePart) const { bool isFirstLoad = !thePart->partDoc().get(); ModuleBase_Tools::blockUpdateViewer(true); thePart->activate(); if (isFirstLoad) { - XGUI_Workshop* aWorkshop = myModule->getWorkshop(); - XGUI_ObjectsBrowser* aObjBrowser = aWorkshop->objectBrowser(); + XGUI_Workshop *aWorkshop = myModule->getWorkshop(); + XGUI_ObjectsBrowser *aObjBrowser = aWorkshop->objectBrowser(); ModuleBase_Tools::setDisplaying(thePart); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); aObjBrowser->onSelectionChanged(); DocumentPtr aDoc = thePart->partDoc(); std::list aStates; @@ -512,8 +522,7 @@ void PartSet_MenuMgr::activatePart(ResultPartPtr thePart) const ModuleBase_Tools::blockUpdateViewer(false); } -void PartSet_MenuMgr::onActivateAllParts() -{ +void PartSet_MenuMgr::onActivateAllParts() { SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->isOperation()) return; @@ -523,20 +532,21 @@ void PartSet_MenuMgr::onActivateAllParts() QList aPartsToLoad; for (int i = 0; i < aNbParts; i++) { ObjectPtr aObj = aDoc->object(ModelAPI_ResultPart::group(), i); - ResultPartPtr aPartRes = std::dynamic_pointer_cast(aObj); + ResultPartPtr aPartRes = + std::dynamic_pointer_cast(aObj); if (!aPartRes->partDoc().get()) aPartsToLoad.append(aPartRes); } if (!aPartsToLoad.isEmpty()) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); aMgr->startOperation("All Parts loading"); - foreach(ResultPartPtr aPartRes, aPartsToLoad) { + foreach (ResultPartPtr aPartRes, aPartsToLoad) { aPartRes->loadPart(); } aMgr->finishOperation(); - XGUI_Workshop* aWorkshop = myModule->getWorkshop(); - XGUI_ObjectsBrowser* aObjBrowser = aWorkshop->objectBrowser(); + XGUI_Workshop *aWorkshop = myModule->getWorkshop(); + XGUI_ObjectsBrowser *aObjBrowser = aWorkshop->objectBrowser(); aObjBrowser->update(); aWorkshop->viewer()->update(); aWorkshop->updateCommandStatus(); @@ -544,18 +554,17 @@ void PartSet_MenuMgr::onActivateAllParts() } } -void PartSet_MenuMgr::onActivatePartSet(bool) -{ +void PartSet_MenuMgr::onActivatePartSet(bool) { if (myModule->workshop()->currentOperation()) return; activatePartSet(); } -void PartSet_MenuMgr::activatePartSet() const -{ +void PartSet_MenuMgr::activatePartSet() const { SessionPtr aMgr = ModelAPI_Session::get(); bool isNewTransaction = !aMgr->isOperation(); - // activation may cause changes in current features in document, so it must be in transaction + // activation may cause changes in current features in document, so it must be + // in transaction if (isNewTransaction) aMgr->startOperation("Activation"); aMgr->setActiveDocument(aMgr->moduleDocument()); @@ -566,27 +575,26 @@ void PartSet_MenuMgr::activatePartSet() const myModule->workshop()->viewer()->update(); } -void PartSet_MenuMgr::grantedOperationIds(ModuleBase_Operation* theOperation, - QStringList& theIds) const -{ +void PartSet_MenuMgr::grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const { if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { theIds.append(tr("Detach")); theIds.append(tr("Auxiliary")); } } -void PartSet_MenuMgr::onEdit(bool) -{ - QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects(); +void PartSet_MenuMgr::onEdit(bool) { + QObjectPtrList aObjects = + myModule->workshop()->selection()->selectedObjects(); FeaturePtr aFeature; - foreach(ObjectPtr aObj, aObjects) { + foreach (ObjectPtr aObj, aObjects) { aFeature = std::dynamic_pointer_cast(aObj); if (aFeature.get()) break; } if (aFeature.get() == NULL) { ResultParameterPtr aParam; - foreach(ObjectPtr aObj, aObjects) { + foreach (ObjectPtr aObj, aObjects) { aParam = std::dynamic_pointer_cast(aObj); if (aParam.get()) break; @@ -598,12 +606,11 @@ void PartSet_MenuMgr::onEdit(bool) myModule->editFeature(aFeature); } -bool PartSet_MenuMgr::eventFilter(QObject* theObj, QEvent* theEvent) -{ +bool PartSet_MenuMgr::eventFilter(QObject *theObj, QEvent *theEvent) { if (theEvent->type() == QEvent::MouseButtonDblClick) { SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->activeDocument() != aMgr->moduleDocument()) activatePartSet(); } return QObject::eventFilter(theObj, theEvent); -} \ No newline at end of file +} diff --git a/src/PartSet/PartSet_MenuMgr.h b/src/PartSet/PartSet_MenuMgr.h index 870e0bed2..4c732dcdc 100644 --- a/src/PartSet/PartSet_MenuMgr.h +++ b/src/PartSet/PartSet_MenuMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_MenuMgr_H @@ -23,11 +24,11 @@ #include #include -#include +#include +#include #include +#include #include -#include -#include class ModuleBase_Operation; class PartSet_Module; @@ -35,40 +36,41 @@ class QAction; class QMenu; /** -* \ingroup Modules -* A class for management of module specific menu -*/ -class PartSet_MenuMgr: public QObject -{ + * \ingroup Modules + * A class for management of module specific menu + */ +class PartSet_MenuMgr : public QObject { Q_OBJECT public: /// Constructor /// \param theModule a parent module - PartSet_MenuMgr(PartSet_Module* theModule); - + PartSet_MenuMgr(PartSet_Module *theModule); /// Returns action according to the given ID - /// \param theId an action identifier, it should be uniqued in the bounds of the module - QAction* action(const QString& theId) const; + /// \param theId an action identifier, it should be uniqued in the bounds of + /// the module + QAction *action(const QString &theId) const; /// Add menu items for viewer into the actions map /// \param theStdActions a map of standard actions /// \param theParent a parent widget for the - /// \param theMenuActions map of action/menu for the desirable index in the viewer menu - /// \return true if items are added and there is no necessity to provide standard menu - bool addViewerMenu(const QMap& theStdActions, - QWidget* theParent, - QMap& theMenuActions) const; + /// \param theMenuActions map of action/menu for the desirable index in the + /// viewer menu \return true if items are added and there is no necessity to + /// provide standard menu + bool addViewerMenu(const QMap &theStdActions, + QWidget *theParent, + QMap &theMenuActions) const; /// Update state of pop-up menu items in viewer /// \param theStdActions - a map of standard actions - void updateViewerMenu(const QMap& theStdActions); + void updateViewerMenu(const QMap &theStdActions); /// Activates a PartSet document void activatePartSet() const; /// Returns list of granted operation indices - virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const; + virtual void grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const; /// Activates a Part document void activatePart(ResultPartPtr thePart) const; @@ -80,16 +82,16 @@ public slots: private slots: - /// A slot which is called on selection of menu item coresponding to line with coincedence - /// \param theAction an action of the selected item - void onLineHighlighted(QAction* theAction); + /// A slot which is called on selection of menu item coresponding to line with + /// coincedence \param theAction an action of the selected item + void onLineHighlighted(QAction *theAction); /// A slot which is called on hiding Detach menu void onDetachMenuHide(); /// A slot which is called on selection an Item in Detach menu /// \param theAction an action of the selected item - void onLineDetach(QAction* theAction); + void onLineDetach(QAction *theAction); /// A slot called on Part activation command void onActivatePart(bool); @@ -107,13 +109,13 @@ protected: /// Redefinition of virtual method /// \param theObj an object /// \param theEvent an event - virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + virtual bool eventFilter(QObject *theObj, QEvent *theEvent); private: /// Returns true if the current operation is sketch entity create operation /// \param theValue the current auxiliary value /// \return the boolean result - bool canSetAuxiliary(bool& theValue) const; + bool canSetAuxiliary(bool &theValue) const; /// Changes the sketcher entity construction argument value /// \param isChecked if true, the feature is a construction @@ -126,7 +128,7 @@ private: /// Add action to the internal map /// \param theId - string ID of the item /// \param theAction - action to add - void addAction(const QString& theId, QAction* theAction); + void addAction(const QString &theId, QAction *theAction); /// Set color on presentation of result listed in myCoinsideLines /// \param theId object Id in myCoinsideLines list @@ -136,10 +138,10 @@ private: QColor setLineColor(int theId, const QColor theColor, bool theUpdate); /// Reference to a parent module - PartSet_Module* myModule; + PartSet_Module *myModule; /// the popup menu actions - QMap myActions; + QMap myActions; /// List of lines coincided in a one point mutable QList myCoinsideLines; @@ -154,4 +156,4 @@ private: QColor myColor; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index f644b6a54..87ed314f7 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -14,86 +14,87 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_Module.h" -#include "PartSet_WidgetSketchLabel.h" -#include "PartSet_Validators.h" -#include "PartSet_Tools.h" +#include "PartSet_BSplineWidget.h" +#include "PartSet_CustomPrs.h" +#include "PartSet_FieldStepPrs.h" +#include "PartSet_IconFactory.h" +#include "PartSet_MenuMgr.h" +#include "PartSet_OverconstraintListener.h" #include "PartSet_PreviewPlanes.h" +#include "PartSet_ResultSketchPrs.h" +#include "PartSet_SketcherMgr.h" +#include "PartSet_SketcherReentrantMgr.h" +#include "PartSet_Tools.h" +#include "PartSet_TreeNodes.h" +#include "PartSet_Validators.h" #include "PartSet_WidgetBSplinePoints.h" -#include "PartSet_WidgetPoint2d.h" -#include "PartSet_WidgetPoint2DFlyout.h" -#include "PartSet_WidgetShapeSelector.h" -#include "PartSet_WidgetMultiSelector.h" -#include "PartSet_WidgetFeaturePointSelector.h" #include "PartSet_WidgetEditor.h" +#include "PartSet_WidgetFeaturePointSelector.h" #include "PartSet_WidgetFileSelector.h" +#include "PartSet_WidgetMultiSelector.h" +#include "PartSet_WidgetPoint2DFlyout.h" +#include "PartSet_WidgetPoint2d.h" +#include "PartSet_WidgetShapeSelector.h" #include "PartSet_WidgetSketchCreator.h" -#include "PartSet_SketcherMgr.h" -#include "PartSet_SketcherReentrantMgr.h" -#include "PartSet_ResultSketchPrs.h" -#include "PartSet_MenuMgr.h" -#include "PartSet_CustomPrs.h" -#include "PartSet_IconFactory.h" -#include "PartSet_OverconstraintListener.h" -#include "PartSet_TreeNodes.h" -#include "PartSet_FieldStepPrs.h" -#include "PartSet_BSplineWidget.h" +#include "PartSet_WidgetSketchLabel.h" -#include "PartSet_Filters.h" #include "PartSet_FilterInfinite.h" +#include "PartSet_Filters.h" #ifdef _DEBUG #include #endif -#include -#include #include +#include +#include #include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include #include -#include -#include -#include -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include +#include #include -#include -#include -#include #include -#include -#include +#include #include #include +#include +#include +#include -#include -#include #include +#include +#include +#include #include #include -#include #include #include #include @@ -108,8 +109,8 @@ #include #include -#include #include +#include #include #include #include @@ -117,39 +118,38 @@ #include #include -#include -#include #include +#include +#include #include +#include +#include #include #include -#include -#include #include +#include #include #include -#include #include #include -#include +#include -#include -#include -#include -#include #include -#include -#include #include +#include +#include +#include +#include #include +#include #include #include -#include #include +#include #include @@ -157,46 +157,48 @@ #define FEATURE_ITEM_COLOR "0,0,225" - /*!Create and return new instance of XGUI_Module*/ -extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop) -{ +extern "C" PARTSET_EXPORT ModuleBase_IModule * +createModule(ModuleBase_IWorkshop *theWshop) { return new PartSet_Module(theWshop); } //****************************************************** -PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) -: ModuleBase_IModule(theWshop), - myIsOperationIsLaunched(false), - myVisualLayerId(0), - myRoot(0) -{ +PartSet_Module::PartSet_Module(ModuleBase_IWorkshop *theWshop) + : ModuleBase_IModule(theWshop), myIsOperationIsLaunched(false), + myVisualLayerId(0), myRoot(0) { new PartSet_IconFactory(this); mySketchMgr = new PartSet_SketcherMgr(this); mySketchReentrantMgr = new PartSet_SketcherReentrantMgr(theWshop); - ModuleBase_IViewer* aViewer = theWshop->viewer(); - connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)), - this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*))); - connect(aViewer, SIGNAL(viewTransformed(int)), - SLOT(onViewTransformed(int))); - connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)), - SLOT(onViewCreated(ModuleBase_IViewWindow*))); + ModuleBase_IViewer *aViewer = theWshop->viewer(); + connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow *, QKeyEvent *)), + this, SLOT(onKeyRelease(ModuleBase_IViewWindow *, QKeyEvent *))); + connect(aViewer, SIGNAL(viewTransformed(int)), SLOT(onViewTransformed(int))); + connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow *)), + SLOT(onViewCreated(ModuleBase_IViewWindow *))); myMenuMgr = new PartSet_MenuMgr(this); myCustomPrs = new PartSet_CustomPrs(theWshop); myOverconstraintListener = new PartSet_OverconstraintListener(theWshop); - Events_Loop* aLoop = Events_Loop::loop(); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID)); - - registerSelectionFilter(SF_GlobalFilter, new PartSet_GlobalFilter(myWorkshop)); - registerSelectionFilter(SF_FilterInfinite, new PartSet_FilterInfinite(myWorkshop)); - Handle(PartSet_ResultGroupNameFilter) aCRFilter = new PartSet_ResultGroupNameFilter(myWorkshop); + Events_Loop *aLoop = Events_Loop::loop(); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID)); + + registerSelectionFilter(SF_GlobalFilter, + new PartSet_GlobalFilter(myWorkshop)); + registerSelectionFilter(SF_FilterInfinite, + new PartSet_FilterInfinite(myWorkshop)); + Handle(PartSet_ResultGroupNameFilter) aCRFilter = + new PartSet_ResultGroupNameFilter(myWorkshop); std::set aCRGroupNames; aCRGroupNames.insert(ModelAPI_ResultConstruction::group()); aCRFilter->setGroupNames(aCRGroupNames); @@ -204,100 +206,114 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) setDefaultConstraintShown(); - Config_PropManager::registerProp("Visualization", "result_body_color", "Result color", - Config_Prop::Color, ModelAPI_ResultBody::DEFAULT_COLOR()); + Config_PropManager::registerProp("Visualization", "result_body_color", + "Result color", Config_Prop::Color, + ModelAPI_ResultBody::DEFAULT_COLOR()); - Config_PropManager::registerProp("Visualization", "result_group_color", "Group color", - Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR()); + Config_PropManager::registerProp("Visualization", "result_group_color", + "Group color", Config_Prop::Color, + ModelAPI_ResultGroup::DEFAULT_COLOR()); - Config_PropManager::registerProp("Visualization", "result_construction_color", - "Construction color", - Config_Prop::Color, - ModelAPI_ResultConstruction::DEFAULT_COLOR()); + Config_PropManager::registerProp( + "Visualization", "result_construction_color", "Construction color", + Config_Prop::Color, ModelAPI_ResultConstruction::DEFAULT_COLOR()); - Config_PropManager::registerProp("Visualization", "result_part_color", "Part color", - Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR()); + Config_PropManager::registerProp("Visualization", "result_part_color", + "Part color", Config_Prop::Color, + ModelAPI_ResultPart::DEFAULT_COLOR()); - Config_PropManager::registerProp("Visualization", "result_field_color", "Field color", - Config_Prop::Color, ModelAPI_ResultField::DEFAULT_COLOR()); + Config_PropManager::registerProp("Visualization", "result_field_color", + "Field color", Config_Prop::Color, + ModelAPI_ResultField::DEFAULT_COLOR()); - Config_PropManager::registerProp("Visualization", "operation_parameter_color", - "Reference shape wireframe color in operation", Config_Prop::Color, - PartSet_CustomPrs::OPERATION_PARAMETER_COLOR()); + Config_PropManager::registerProp( + "Visualization", "operation_parameter_color", + "Reference shape wireframe color in operation", Config_Prop::Color, + PartSet_CustomPrs::OPERATION_PARAMETER_COLOR()); Config_PropManager::registerProp("Visualization", "operation_result_color", - "Result shape wireframe color in operation", Config_Prop::Color, - PartSet_CustomPrs::OPERATION_RESULT_COLOR()); - Config_PropManager::registerProp("Visualization", "operation_highlight_color", - "Multi selector item color in operation", Config_Prop::Color, - PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR()); - Config_PropManager::registerProp("Visualization", "operation_remove_feature_color", - "Color of removed feature in operation", Config_Prop::Color, - PartSet_CustomPrs::OPERATION_REMOVE_FEATURE_COLOR()); + "Result shape wireframe color in operation", + Config_Prop::Color, + PartSet_CustomPrs::OPERATION_RESULT_COLOR()); + Config_PropManager::registerProp( + "Visualization", "operation_highlight_color", + "Multi selector item color in operation", Config_Prop::Color, + PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR()); + Config_PropManager::registerProp( + "Visualization", "operation_remove_feature_color", + "Color of removed feature in operation", Config_Prop::Color, + PartSet_CustomPrs::OPERATION_REMOVE_FEATURE_COLOR()); Config_PropManager::registerProp("Visualization", "sketch_preview_plane", - "Color of sketch plane", Config_Prop::Color, - PartSet_CustomPrs::OPERATION_SKETCH_PLANE()); + "Color of sketch plane", Config_Prop::Color, + PartSet_CustomPrs::OPERATION_SKETCH_PLANE()); Config_PropManager::registerProp("Visualization", "hidden_face_transparency", "Hidden faces transparency", - Config_Prop::DblSpin, - "0.8"); + Config_Prop::DblSpin, "0.8"); std::ostringstream aStream; aStream << SketcherPrs_Tools::getDefaultArrowSize(); Config_PropManager::registerProp("Visualization", "dimension_arrow_size", - "Dimension arrow size", Config_Prop::IntSpin, aStream.str()); + "Dimension arrow size", Config_Prop::IntSpin, + aStream.str()); - Config_PropManager::registerProp("Visualization", "dimension_font", "Dimension font", - Config_Prop::String, "Times-bold"); + Config_PropManager::registerProp("Visualization", "dimension_font", + "Dimension font", Config_Prop::String, + "Times-bold"); aStream.str(""); aStream.clear(); aStream << SketcherPrs_Tools::getDefaultTextHeight(); Config_PropManager::registerProp("Visualization", "dimension_value_size", - "Dimension value size", Config_Prop::IntSpin, aStream.str()); + "Dimension value size", Config_Prop::IntSpin, + aStream.str()); Config_PropManager::registerProp("Visualization", "sketch_dimension_color", - "Dimension color", - Config_Prop::Color, SKETCH_DIMENSION_COLOR); + "Dimension color", Config_Prop::Color, + SKETCH_DIMENSION_COLOR); - Config_PropManager::registerProp("Visualization", "feature_objectbrowser_color", - "Feature items in Object Browser", - Config_Prop::Color, FEATURE_ITEM_COLOR); + Config_PropManager::registerProp("Visualization", + "feature_objectbrowser_color", + "Feature items in Object Browser", + Config_Prop::Color, FEATURE_ITEM_COLOR); Config_PropManager::registerProp("Visualization", "zoom_trihedron_arrows", - "Keep trihedron arrows view size constant", Config_Prop::Boolean, "false"); + "Keep trihedron arrows view size constant", + Config_Prop::Boolean, "false"); Config_PropManager::registerProp("Visualization", "use_auto_rotation", - "Enable automatic rotation", Config_Prop::Boolean, "false"); + "Enable automatic rotation", + Config_Prop::Boolean, "false"); Config_PropManager::registerProp("Visualization", "axis_arrow_size", - "Trihedron arrows constant size", Config_Prop::IntSpin, "10"); + "Trihedron arrows constant size", + Config_Prop::IntSpin, "10"); Config_PropManager::registerProp("Shortcuts", "add_parameter_shortcut", - "Add parameter in parameters manager dialog", - Config_Prop::Shortcut, "Ctrl+A"); + "Add parameter in parameters manager dialog", + Config_Prop::Shortcut, "Ctrl+A"); Config_PropManager::registerProp("Windows", "use_hide_faces_panel", - "Use HideFaces panel in operations", Config_Prop::Boolean, "false"); + "Use HideFaces panel in operations", + Config_Prop::Boolean, "false"); } //****************************************************** -PartSet_Module::~PartSet_Module() -{ +PartSet_Module::~PartSet_Module() { delete myCustomPrs; delete myOverconstraintListener; delete myRoot; } //****************************************************** -void PartSet_Module::createFeatures() -{ +void PartSet_Module::createFeatures() { ModuleBase_IModule::createFeatures(); - // send signal to initialization plugin about the state of the preferences: to create part or not + // send signal to initialization plugin about the state of the preferences: to + // create part or not bool aCreate = ModuleBase_Preferences::resourceMgr()->booleanValue( - ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true); - Events_MessageBool aCreateMsg(Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate); + ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true); + Events_MessageBool aCreateMsg( + Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate); aCreateMsg.send(); myRoot = new PartSet_RootNode(); @@ -305,69 +321,85 @@ void PartSet_Module::createFeatures() ModuleBase_IModule::loadProprietaryPlugins(); } - //****************************************************** -void PartSet_Module::storeSelection() -{ - // cash is used only to restore selection, so it should be filled in storeSelection and - // after applying immediatelly cleared in restoreSelection +void PartSet_Module::storeSelection() { + // cash is used only to restore selection, so it should be filled in + // storeSelection and after applying immediatelly cleared in restoreSelection myCurrentSelection.clear(); - sketchMgr()->storeSelection(PartSet_SketcherMgr::ST_SelectType, myCurrentSelection); + sketchMgr()->storeSelection(PartSet_SketcherMgr::ST_SelectType, + myCurrentSelection); } //****************************************************** -void PartSet_Module::restoreSelection() -{ - // cash is used only to restore selection, so it should be filled in storeSelection and - // after applying immediatelly cleared in restoreSelection +void PartSet_Module::restoreSelection() { + // cash is used only to restore selection, so it should be filled in + // storeSelection and after applying immediatelly cleared in restoreSelection sketchMgr()->restoreSelection(myCurrentSelection); myCurrentSelection.clear(); } //****************************************************** -void PartSet_Module::registerValidators() -{ - //Registering of validators +void PartSet_Module::registerValidators() { + // Registering of validators SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection); - aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection); - aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection); - aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection); - aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection); - aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection); - aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection); - aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection); - aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection); - aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection); - aFactory->registerValidator("PartSet_AngleSelection", new PartSet_AngleSelection); - aFactory->registerValidator("PartSet_EqualSelection", new PartSet_EqualSelection); - aFactory->registerValidator("PartSet_CollinearSelection", new PartSet_CollinearSelection); - aFactory->registerValidator("PartSet_MiddlePointSelection", new PartSet_MiddlePointSelection); - aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator); - aFactory->registerValidator("PartSet_DifferentPoints", new PartSet_DifferentPointsValidator); - aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); + aFactory->registerValidator("PartSet_DistanceSelection", + new PartSet_DistanceSelection); + aFactory->registerValidator("PartSet_LengthSelection", + new PartSet_LengthSelection); + aFactory->registerValidator("PartSet_PerpendicularSelection", + new PartSet_PerpendicularSelection); + aFactory->registerValidator("PartSet_ParallelSelection", + new PartSet_ParallelSelection); + aFactory->registerValidator("PartSet_RadiusSelection", + new PartSet_RadiusSelection); + aFactory->registerValidator("PartSet_RigidSelection", + new PartSet_RigidSelection); + aFactory->registerValidator("PartSet_CoincidentSelection", + new PartSet_CoincidentSelection); + aFactory->registerValidator("PartSet_HVDirSelection", + new PartSet_HVDirSelection); + aFactory->registerValidator("PartSet_TangentSelection", + new PartSet_TangentSelection); + aFactory->registerValidator("PartSet_FilletSelection", + new PartSet_FilletSelection); + aFactory->registerValidator("PartSet_AngleSelection", + new PartSet_AngleSelection); + aFactory->registerValidator("PartSet_EqualSelection", + new PartSet_EqualSelection); + aFactory->registerValidator("PartSet_CollinearSelection", + new PartSet_CollinearSelection); + aFactory->registerValidator("PartSet_MiddlePointSelection", + new PartSet_MiddlePointSelection); + aFactory->registerValidator("PartSet_DifferentObjects", + new PartSet_DifferentObjectsValidator); + aFactory->registerValidator("PartSet_DifferentPoints", + new PartSet_DifferentPointsValidator); + aFactory->registerValidator("PartSet_CoincidentAttr", + new PartSet_CoincidentAttr); aFactory->registerValidator("PartSet_MultyTranslationSelection", - new PartSet_MultyTranslationSelection); - aFactory->registerValidator("PartSet_SplitSelection", new PartSet_SplitSelection); - aFactory->registerValidator("PartSet_ProjectionSelection", new PartSet_ProjectionSelection); - aFactory->registerValidator("PartSet_IntersectionSelection", new PartSet_IntersectionSelection); + new PartSet_MultyTranslationSelection); + aFactory->registerValidator("PartSet_SplitSelection", + new PartSet_SplitSelection); + aFactory->registerValidator("PartSet_ProjectionSelection", + new PartSet_ProjectionSelection); + aFactory->registerValidator("PartSet_IntersectionSelection", + new PartSet_IntersectionSelection); } //****************************************************** -void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, - const bool isToConnect) -{ +void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget *theWidget, + const bool isToConnect) { mySketchMgr->connectToPropertyPanel(theWidget, isToConnect); } //****************************************************** -void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) -{ +void PartSet_Module::operationCommitted(ModuleBase_Operation *theOperation) { if (sketchMgr()->isNestedSketchOperation(theOperation)) { mySketchMgr->commitNestedSketch(theOperation); } - /// deactivate of overconstraint listener should be performed after Sketch commit (#2176) + /// deactivate of overconstraint listener should be performed after Sketch + /// commit (#2176) if (PartSet_SketcherMgr::isSketchOperation(theOperation)) overconstraintListener()->setActive(false); @@ -378,11 +410,11 @@ void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) } //****************************************************** -void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation) -{ +void PartSet_Module::operationAborted(ModuleBase_Operation *theOperation) { /// Restart sketcher operations automatically mySketchReentrantMgr->operationAborted(theOperation); - /// deactivate of overconstraint listener should be performed after Sketch abort (#2176) + /// deactivate of overconstraint listener should be performed after Sketch + /// abort (#2176) if (PartSet_SketcherMgr::isSketchOperation(theOperation)) overconstraintListener()->setActive(false); @@ -390,31 +422,32 @@ void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation) } //****************************************************** -void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); +void PartSet_Module::operationStarted(ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) { - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(workshop()); - XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(workshop()); + XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel(); - ModuleBase_ModelWidget* aFilledWidget = 0; + ModuleBase_ModelWidget *aFilledWidget = 0; bool aPostonedWidgetActivation = false; FeaturePtr aFeature = aFOperation->feature(); /// Restart sketcher operations automatically - /// it is important to call method of sketch reentrant manager before filling of PP - /// because it fills some created feature attributes, these new values should be used - /// to fill the property panel + /// it is important to call method of sketch reentrant manager before + /// filling of PP because it fills some created feature attributes, these + /// new values should be used to fill the property panel mySketchReentrantMgr->operationStarted(theOperation); aWorkshop->fillPropertyPanel(aFOperation); // filling the operation values by the current selection - // if the operation can be committed after the controls filling, the method perform should - // be stopped. Otherwise unnecessary presentations can be shown(e.g. operation prs in sketch) + // if the operation can be committed after the controls filling, the method + // perform should be stopped. Otherwise unnecessary presentations can be + // shown(e.g. operation prs in sketch) bool isOperationCommitted = false; if (!aFOperation->isEditOperation()) { - std::string aGreedAttributeId = ModuleBase_Tools::findGreedAttribute(workshop(), aFeature); + std::string aGreedAttributeId = + ModuleBase_Tools::findGreedAttribute(workshop(), aFeature); // if there is a greed attribute, automatic commit by preselection // for this feature is prohibited aFilledWidget = aFOperation->activateByPreselection(aGreedAttributeId); @@ -423,27 +456,30 @@ void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) else { if (aGreedAttributeId.empty()) { // a signal should be emitted before the next widget activation - // because, the activation of the next widget will give a focus to the widget. - // As a result the value of the widget is initialized. - // And commit may happens until the value is entered. + // because, the activation of the next widget will give a focus to the + // widget. As a result the value of the widget is initialized. And + // commit may happens until the value is entered. if (aFilledWidget) { if (mySketchReentrantMgr->canBeCommittedByPreselection()) - isOperationCommitted = mySketchMgr->operationActivatedByPreselection(); + isOperationCommitted = + mySketchMgr->operationActivatedByPreselection(); // activate the next obligatory widget if (!isOperationCommitted) aPropertyPanel->activateNextWidget(aFilledWidget); } - } - else { // there is a greed widget - const QList& aWidgets = aPropertyPanel->modelWidgets(); + } else { // there is a greed widget + const QList &aWidgets = + aPropertyPanel->modelWidgets(); std::string aFirstAttributeId = aWidgets.front()->attributeID(); - // activate next widget after greeded if it is the first widget in the panel - // else the first panel widget is already activated by operation start + // activate next widget after greeded if it is the first widget in the + // panel else the first panel widget is already activated by operation + // start if (aFirstAttributeId == aGreedAttributeId) aPostonedWidgetActivation = true; } } - } if (!isOperationCommitted) { + } + if (!isOperationCommitted) { aWorkshop->connectToPropertyPanel(true); updateSketcherOnStart(aFOperation); updatePresentationsOnStart(aFOperation); @@ -457,29 +493,31 @@ void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { anObjects.append(*aIt); } - QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); + QObjectPtrList::const_iterator anIt = anObjects.begin(), + aLast = anObjects.end(); for (; anIt != aLast; anIt++) aWorkshop->deactivateActiveObject(*anIt, false); if (anObjects.size() > 0) { - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); aDisplayer->updateViewer(); } - /// state of command actions should be updated after displayed objects modification because - /// deactivation(for example) of objects may influence on selection in the viewer - /// State of command actions may depend on selection in the viewer(e.g. Sketch) + /// state of command actions should be updated after displayed objects + /// modification because deactivation(for example) of objects may + /// influence on selection in the viewer State of command actions may + /// depend on selection in the viewer(e.g. Sketch) workshop()->updateCommandStatus(); } if (aPostonedWidgetActivation) { - // if the widget is an empty in the chain of activated widgets, the current operation - // is restarted. It should be performed after functionality of the operation starting + // if the widget is an empty in the chain of activated widgets, the + // current operation is restarted. It should be performed after + // functionality of the operation starting aPropertyPanel->activateNextWidget(aFilledWidget); } } } //****************************************************** -void PartSet_Module::updateSketcherOnStart(ModuleBase_Operation* theOperation) -{ +void PartSet_Module::updateSketcherOnStart(ModuleBase_Operation *theOperation) { if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { mySketchMgr->startSketch(theOperation); } @@ -491,67 +529,71 @@ void PartSet_Module::updateSketcherOnStart(ModuleBase_Operation* theOperation) } //****************************************************** -void PartSet_Module::updatePresentationsOnStart(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); +void PartSet_Module::updatePresentationsOnStart( + ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) { - myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, false); - myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, false); + myCustomPrs->activate(aFOperation->feature(), + ModuleBase_IModule::CustomizeArguments, false); + myCustomPrs->activate(aFOperation->feature(), + ModuleBase_IModule::CustomizeResults, false); } } //****************************************************** -void PartSet_Module::operationResumed(ModuleBase_Operation* theOperation) -{ +void PartSet_Module::operationResumed(ModuleBase_Operation *theOperation) { ModuleBase_IModule::operationResumed(theOperation); - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) { - myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, false); - myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, false); + myCustomPrs->activate(aFOperation->feature(), + ModuleBase_IModule::CustomizeArguments, false); + myCustomPrs->activate(aFOperation->feature(), + ModuleBase_IModule::CustomizeResults, false); } } //****************************************************** -void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) -{ - bool isModifiedArgs = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeArguments, false); - bool isModifiedResults = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false); +void PartSet_Module::operationStopped(ModuleBase_Operation *theOperation) { + bool isModifiedArgs = + myCustomPrs->deactivate(ModuleBase_IModule::CustomizeArguments, false); + bool isModifiedResults = + myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false); bool isModified = isModifiedArgs || isModifiedResults; if (sketchMgr()->isNestedSketchOperation(theOperation)) { mySketchMgr->stopNestedSketch(theOperation); - } - else if (PartSet_SketcherMgr::isSketchOperation(theOperation)) + } else if (PartSet_SketcherMgr::isSketchOperation(theOperation)) setDefaultConstraintShown(); - //VSV: Viewer is updated on feature update and redisplay + // VSV: Viewer is updated on feature update and redisplay if (isModified) { - XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(myWorkshop); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); aDisplayer->updateViewer(); } QMap::const_iterator - anIt = myHasConstraintShown.begin(), aLast = myHasConstraintShown.end(); + anIt = myHasConstraintShown.begin(), + aLast = myHasConstraintShown.end(); for (; anIt != aLast; anIt++) { mySketchMgr->updateBySketchParameters(anIt.key(), anIt.value()); } } //****************************************************** -ModuleBase_Operation* PartSet_Module::currentOperation() const -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); - XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr(); +ModuleBase_Operation *PartSet_Module::currentOperation() const { + XGUI_ModuleConnector *aConnector = + dynamic_cast(workshop()); + XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); return anOpMgr->currentOperation(); } //****************************************************** -bool PartSet_Module::canUndo() const -{ +bool PartSet_Module::canUndo() const { bool aCanUndo = false; SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->hasModuleDocument() && aMgr->canUndo()) { @@ -563,8 +605,7 @@ bool PartSet_Module::canUndo() const } //****************************************************** -bool PartSet_Module::canRedo() const -{ +bool PartSet_Module::canRedo() const { bool aCanRedo = false; SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->hasModuleDocument() && aMgr->canRedo()) { @@ -576,8 +617,8 @@ bool PartSet_Module::canRedo() const } //****************************************************** -bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const -{ +bool PartSet_Module::canApplyAction(const ObjectPtr &theObject, + const QString &theActionId) const { bool aValid = true; if (theActionId == "MOVE_CMD" || theActionId == "MOVE_SPLIT_CMD") { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); @@ -592,69 +633,68 @@ bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& t } //****************************************************** -bool PartSet_Module::canEraseObject(const ObjectPtr& theObject) const -{ +bool PartSet_Module::canEraseObject(const ObjectPtr &theObject) const { // the sketch manager put the restriction to the objects erase return mySketchMgr->canEraseObject(theObject); } //****************************************************** -bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const -{ +bool PartSet_Module::canDisplayObject(const ObjectPtr &theObject) const { // the sketch manager put the restriction to the objects display return mySketchMgr->canDisplayObject(theObject); } //****************************************************** -bool PartSet_Module::canUsePreselection(const QString& thePreviousOperationKind, - const QString& theStartedOperationKind) -{ - if (ModuleBase_IModule::canUsePreselection(thePreviousOperationKind, theStartedOperationKind)) +bool PartSet_Module::canUsePreselection( + const QString &thePreviousOperationKind, + const QString &theStartedOperationKind) { + if (ModuleBase_IModule::canUsePreselection(thePreviousOperationKind, + theStartedOperationKind)) return true; return mySketchMgr->isNestedSketchFeature(theStartedOperationKind); } -/*void PartSet_Module::processHiddenObject(const std::list& theObjects) +/*void PartSet_Module::processHiddenObject(const std::list& +theObjects) { mySketchMgr->processHiddenObject(theObjects); }*/ //****************************************************** -bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const -{ +bool PartSet_Module::canActivateSelection(const ObjectPtr &theObject) const { bool aCanActivate = ModuleBase_IModule::canActivateSelection(theObject); - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->currentOperation(); bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation), isNestedOp = sketchMgr()->isNestedSketchOperation(anOperation); if (isSketchOp || isNestedOp) { - // in active sketch operation it is possible to activate operation object in selection - // in the edit operation, e.g. points of the line can be moved when the line is edited - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(anOperation); - aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation()); + // in active sketch operation it is possible to activate operation object in + // selection in the edit operation, e.g. points of the line can be moved + // when the line is edited + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(anOperation); + aCanActivate = + aCanActivate || (aFOperation && aFOperation->isEditOperation()); } return aCanActivate; } //****************************************************** -bool PartSet_Module::addViewerMenu(const QMap& theStdActions, - QWidget* theParent, - QMap& theMenuActions) const -{ +bool PartSet_Module::addViewerMenu( + const QMap &theStdActions, QWidget *theParent, + QMap &theMenuActions) const { return myMenuMgr->addViewerMenu(theStdActions, theParent, theMenuActions); } //****************************************************** -void PartSet_Module::updateViewerMenu(const QMap& theStdActions) -{ +void PartSet_Module::updateViewerMenu( + const QMap &theStdActions) { myMenuMgr->updateViewerMenu(theStdActions); } //****************************************************** -bool PartSet_Module::isActionEnableStateFixed(const int theActionId) const -{ +bool PartSet_Module::isActionEnableStateFixed(const int theActionId) const { bool isEnabledFixed = false; if (theActionId == XGUI_ActionsMgr::AcceptAll && mySketchReentrantMgr->isInternalEditActive()) @@ -663,8 +703,7 @@ bool PartSet_Module::isActionEnableStateFixed(const int theActionId) const } //****************************************************** -QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature) -{ +QString PartSet_Module::getFeatureError(const FeaturePtr &theFeature) { QString anError = ModuleBase_IModule::getFeatureError(theFeature); if (anError.isEmpty()) anError = sketchMgr()->getFeatureError(theFeature); @@ -673,42 +712,42 @@ QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature) } //****************************************************** -void PartSet_Module::grantedOperationIds(ModuleBase_Operation* theOperation, - QStringList& theIds) const -{ +void PartSet_Module::grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const { myMenuMgr->grantedOperationIds(theOperation, theIds); if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { - XGUI_Workshop* aWorkshop = getWorkshop(); + XGUI_Workshop *aWorkshop = getWorkshop(); theIds.append(aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text()); } } //****************************************************** -void PartSet_Module::activeSelectionModes(QIntList& theModes) -{ +void PartSet_Module::activeSelectionModes(QIntList &theModes) { if (mySketchMgr->activeSketch().get()) - PartSet_SketcherMgr::sketchSelectionModes(mySketchMgr->activeSketch(), theModes); + PartSet_SketcherMgr::sketchSelectionModes(mySketchMgr->activeSketch(), + theModes); else theModes = XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes(); } //****************************************************** -void PartSet_Module::moduleSelectionModes(int theModesType, QIntList& theModes) -{ +void PartSet_Module::moduleSelectionModes(int theModesType, + QIntList &theModes) { customSubShapesSelectionModes(theModes); - //theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes()); - //myWorkshop->module()->activeSelectionModes(theModes); + // theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes()); + // myWorkshop->module()->activeSelectionModes(theModes); } //****************************************************** -void PartSet_Module::moduleSelectionFilters(const QIntList& theFilterTypes, - SelectMgr_ListOfFilter& theSelectionFilters) -{ +void PartSet_Module::moduleSelectionFilters( + const QIntList &theFilterTypes, + SelectMgr_ListOfFilter &theSelectionFilters) { bool isSketchActive = mySketchMgr->activeSketch().get(); - std::map::const_iterator aFiltersIt = - mySelectionFilters.begin(); + std::map::const_iterator aFiltersIt = + mySelectionFilters.begin(); for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) { int aFilterType = aFiltersIt->first; // do not add not participating filters in given parameters @@ -716,8 +755,8 @@ void PartSet_Module::moduleSelectionFilters(const QIntList& theFilterTypes, continue; // using sketch filters only if sketch operation is active - if (!isSketchActive && - mySketchMgr->sketchSelectionFilter((ModuleBase_SelectionFilterType)aFilterType)) + if (!isSketchActive && mySketchMgr->sketchSelectionFilter( + (ModuleBase_SelectionFilterType)aFilterType)) continue; // using filtering of construction results only from faces panel @@ -729,21 +768,21 @@ void PartSet_Module::moduleSelectionFilters(const QIntList& theFilterTypes, } //****************************************************** -void PartSet_Module::customSubShapesSelectionModes(QIntList& theModes) -{ +void PartSet_Module::customSubShapesSelectionModes(QIntList &theModes) { if (theModes.contains(TopAbs_FACE)) theModes.append(SketcherPrs_Tools::Sel_Sketch_Face); if (theModes.contains(TopAbs_WIRE)) theModes.append(SketcherPrs_Tools::Sel_Sketch_Wire); if (mySketchMgr->activeSketch().get()) - PartSet_SketcherMgr::sketchSelectionModes(mySketchMgr->activeSketch(), theModes); + PartSet_SketcherMgr::sketchSelectionModes(mySketchMgr->activeSketch(), + theModes); } //****************************************************** -void PartSet_Module::getGeomSelection(const std::shared_ptr& theSelected, - ObjectPtr& theObject, AttributePtr& theAttribute) -{ +void PartSet_Module::getGeomSelection( + const std::shared_ptr &theSelected, + ObjectPtr &theObject, AttributePtr &theAttribute) { ObjectPtr anObject = theSelected->object(); GeomShapePtr aShape = theSelected->shape(); @@ -753,14 +792,12 @@ void PartSet_Module::getGeomSelection(const std::shared_ptrisMouseOverWindow(); } //****************************************************** -bool PartSet_Module::isSketchNeutralPointActivated() const -{ +bool PartSet_Module::isSketchNeutralPointActivated() const { bool isNeutralPoint = true; if (sketchReentranceMgr()->isInternalEditActive()) isNeutralPoint = false; @@ -771,47 +808,46 @@ bool PartSet_Module::isSketchNeutralPointActivated() const } //****************************************************** -void PartSet_Module::closeDocument() -{ +void PartSet_Module::closeDocument() { myActivePartIndex = QModelIndex(); SketcherPrs_PositionMgr::get()->clearAll(); } //****************************************************** -void PartSet_Module::clearViewer() -{ +void PartSet_Module::clearViewer() { myCustomPrs->clearPrs(); - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); aDisplayer->deactivateSelectionFilters(false); } //****************************************************** -void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); +void PartSet_Module::propertyPanelDefined(ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (!aFOperation) return; - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = aFOperation->propertyPanel(); // we have to manually activate the sketch label in edit mode - if (PartSet_SketcherMgr::isSketchOperation(aFOperation) && (aFOperation->isEditOperation())) + if (PartSet_SketcherMgr::isSketchOperation(aFOperation) && + (aFOperation->isEditOperation())) aPanel->activateWidget(aPanel->modelWidgets().first()); } //****************************************************** -bool PartSet_Module::createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr, - QList& theWidgets) const -{ +bool PartSet_Module::createWidgets( + const FeaturePtr &theFeature, const QString &theXmlRepr, + QList &theWidgets) const { bool aProcessed = false; - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel(); if (mySketchMgr->activeSketch().get() && aPropertyPanel) { - ModuleBase_ISelection* aSelection = workshop()->selection(); - // click on a point in sketch leads here with the point is highlighted, not yet selected + ModuleBase_ISelection *aSelection = workshop()->selection(); + // click on a point in sketch leads here with the point is highlighted, not + // yet selected QList aPreselection = aSelection->getHighlighted(); if (aPreselection.size() == 1) { ModuleBase_ViewerPrsPtr aSelectedPrs = aPreselection[0]; @@ -822,18 +858,21 @@ bool PartSet_Module::createWidgets(const FeaturePtr& theFeature, const QString& // click on the digit of dimension constrain comes here // with an empty shape, so we need the check if (aFeature == theFeature && aShape.get() && !aShape->isNull()) { - // if feature has only one result and shape of result is equal to selected shape - // this attribute is not processed. It is a case of Sketch Point. + // if feature has only one result and shape of result is equal to + // selected shape this attribute is not processed. It is a case of + // Sketch Point. if (aFeature->results().size() == 1) { ResultPtr aResult = aFeature->results().front(); if (aResult.get() && aResult->shape()->isEqual(aShape)) return aProcessed; } - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); std::pair anAttribute = - PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape, mySketchMgr->activeSketch()); + PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape, + mySketchMgr->activeSketch()); if (anAttribute.first.get()) { - ModuleBase_WidgetFactory aFactory(theXmlRepr.toStdString(), workshop()); + ModuleBase_WidgetFactory aFactory(theXmlRepr.toStdString(), + workshop()); const std::string anAttributeId = anAttribute.first->id(); aFactory.createWidget(aPropertyPanel->contentWidget(), anAttributeId); @@ -851,21 +890,21 @@ bool PartSet_Module::createWidgets(const FeaturePtr& theFeature, const QString& } //****************************************************** -void PartSet_Module::onSelectionChanged() -{ - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); +void PartSet_Module::onSelectionChanged() { + ModuleBase_Operation *aOperation = myWorkshop->currentOperation(); if (!aOperation) return; bool isSketcherOp = false; - // An edit operation is enable only if the current opeation is the sketch operation + // An edit operation is enable only if the current opeation is the sketch + // operation if (mySketchMgr->activeSketch()) { if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch())) isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation); } if (isSketcherOp) { // Editing of constraints can be done on selection - ModuleBase_ISelection* aSelect = myWorkshop->selection(); + ModuleBase_ISelection *aSelect = myWorkshop->selection(); QList aSelected = aSelect->getSelected(); if (aSelected.size() == 1) { ModuleBase_ViewerPrsPtr aPrs = aSelected.first(); @@ -885,96 +924,99 @@ void PartSet_Module::onSelectionChanged() } //****************************************************** -void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); - XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr(); +void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow *theWnd, + QKeyEvent *theEvent) { + XGUI_ModuleConnector *aConnector = + dynamic_cast(workshop()); + XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); anOpMgr->onKeyReleased(theWnd->viewPort(), theEvent); } //****************************************************** -ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi) -{ - ModuleBase_IWorkshop* aWorkshop = workshop(); - ModuleBase_ModelWidget* aWgt = NULL; +ModuleBase_ModelWidget * +PartSet_Module::createWidgetByType(const std::string &theType, + QWidget *theParent, + Config_WidgetAPI *theWidgetApi) { + ModuleBase_IWorkshop *aWorkshop = workshop(); + ModuleBase_ModelWidget *aWgt = NULL; if (theType == "sketch-start-label") { - PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent, aWorkshop, - theWidgetApi, myHasConstraintShown); - connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr&)), - mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr&))); - connect(aLabelWgt, SIGNAL(showConstraintToggled(int, bool)), - mySketchMgr, SLOT(onShowConstraintsToggle(int, bool))); - connect(aLabelWgt, SIGNAL(showFreePoints(bool)), mySketchMgr, SLOT(onShowPoints(bool))); - connect(aLabelWgt, SIGNAL(autoConstraints(bool)), - sketchReentranceMgr(), SLOT(onAutoConstraints(bool))); + PartSet_WidgetSketchLabel *aLabelWgt = new PartSet_WidgetSketchLabel( + theParent, aWorkshop, theWidgetApi, myHasConstraintShown); + connect(aLabelWgt, + SIGNAL(planeSelected(const std::shared_ptr &)), + mySketchMgr, + SLOT(onPlaneSelected(const std::shared_ptr &))); + connect(aLabelWgt, SIGNAL(showConstraintToggled(int, bool)), mySketchMgr, + SLOT(onShowConstraintsToggle(int, bool))); + connect(aLabelWgt, SIGNAL(showFreePoints(bool)), mySketchMgr, + SLOT(onShowPoints(bool))); + connect(aLabelWgt, SIGNAL(autoConstraints(bool)), sketchReentranceMgr(), + SLOT(onAutoConstraints(bool))); aLabelWgt->setShowPointsState(mySketchMgr->isShowFreePointsShown()); aWgt = aLabelWgt; } else if (theType == "sketch-2dpoint_selector") { - PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop, - theWidgetApi); + PartSet_WidgetPoint2D *aPointWgt = + new PartSet_WidgetPoint2D(theParent, aWorkshop, theWidgetApi); aPointWgt->setSketch(mySketchMgr->activeSketch()); - connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected())); + connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), + SLOT(onVertexSelected())); aWgt = aPointWgt; - }else if (theType == "sketch-2dpoint_flyout_selector") { - PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop, - theWidgetApi); + } else if (theType == "sketch-2dpoint_flyout_selector") { + PartSet_WidgetPoint2DFlyout *aPointWgt = + new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop, theWidgetApi); aPointWgt->setSketch(mySketchMgr->activeSketch()); - connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected())); + connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), + SLOT(onVertexSelected())); aWgt = aPointWgt; } else if (theType == "sketch_shape_selector") { - PartSet_WidgetShapeSelector* aShapeSelectorWgt = - new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi); + PartSet_WidgetShapeSelector *aShapeSelectorWgt = + new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi); aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aShapeSelectorWgt; } else if (theType == "sketch_multi_selector") { - PartSet_WidgetMultiSelector* aShapeSelectorWgt = - new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi); + PartSet_WidgetMultiSelector *aShapeSelectorWgt = + new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi); aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aShapeSelectorWgt; - } - else if (theType == "sketch_feature_point_selector") { - PartSet_WidgetFeaturePointSelector* aPointSelectorWgt = - new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, theWidgetApi); + } else if (theType == "sketch_feature_point_selector") { + PartSet_WidgetFeaturePointSelector *aPointSelectorWgt = + new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, + theWidgetApi); aPointSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aPointSelectorWgt; - } - else if (theType == "sketch-bspline_selector") { - PartSet_WidgetBSplinePoints* aBSplineWgt = + } else if (theType == "sketch-bspline_selector") { + PartSet_WidgetBSplinePoints *aBSplineWgt = new PartSet_WidgetBSplinePoints(theParent, aWorkshop, theWidgetApi); aBSplineWgt->setSketch(mySketchMgr->activeSketch()); aWgt = aBSplineWgt; - } - else if (theType == WDG_DOUBLEVALUE_EDITOR) { + } else if (theType == WDG_DOUBLEVALUE_EDITOR) { aWgt = new PartSet_WidgetEditor(theParent, aWorkshop, theWidgetApi); } else if (theType == "export_file_selector") { aWgt = new PartSet_WidgetFileSelector(theParent, aWorkshop, theWidgetApi); } else if (theType == "sketch_launcher") { aWgt = new PartSet_WidgetSketchCreator(theParent, this, theWidgetApi); - } - else if (theType == "module_choice") { + } else if (theType == "module_choice") { aWgt = new ModuleBase_WidgetChoice(theParent, theWidgetApi); - connect(aWgt, SIGNAL(itemSelected(ModuleBase_ModelWidget*, int)), - this, SLOT(onChoiceChanged(ModuleBase_ModelWidget*, int))); + connect(aWgt, SIGNAL(itemSelected(ModuleBase_ModelWidget *, int)), this, + SLOT(onChoiceChanged(ModuleBase_ModelWidget *, int))); } else if (theType == "bspline-panel") { - PartSet_BSplineWidget* aPanel = new PartSet_BSplineWidget(theParent, theWidgetApi); - //aPanel->setFeature(theFeature); + PartSet_BSplineWidget *aPanel = + new PartSet_BSplineWidget(theParent, theWidgetApi); + // aPanel->setFeature(theFeature); aWgt = aPanel; } return aWgt; } //****************************************************** -ModuleBase_ModelWidget* PartSet_Module::activeWidget() const -{ - ModuleBase_ModelWidget* anActiveWidget = 0; +ModuleBase_ModelWidget *PartSet_Module::activeWidget() const { + ModuleBase_ModelWidget *anActiveWidget = 0; - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *aOperation = myWorkshop->currentOperation(); if (!aOperation) return anActiveWidget; - ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = aOperation->propertyPanel(); if (!aPanel) return anActiveWidget; @@ -982,52 +1024,56 @@ ModuleBase_ModelWidget* PartSet_Module::activeWidget() const } //****************************************************** -bool PartSet_Module::deleteObjects() -{ +bool PartSet_Module::deleteObjects() { bool isProcessed = false; - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_OperationMgr *anOpMgr = aWorkshop->operationMgr(); - //SessionPtr aMgr = ModelAPI_Session::get(); - // 1. check whether the delete should be processed in the module - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + // SessionPtr aMgr = ModelAPI_Session::get(); + // 1. check whether the delete should be processed in the module + ModuleBase_Operation *anOperation = myWorkshop->currentOperation(); bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation), isNestedOp = sketchMgr()->isNestedSketchOperation(anOperation); if (isSketchOp || isNestedOp) { isProcessed = true; // 2. find selected presentations - // selected objects should be collected before the current operation abort because - // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue - ModuleBase_ISelection* aSel = workshop()->selection(); + // selected objects should be collected before the current operation abort + // because the abort leads to selection lost on constraint objects. It can + // be corrected after #386 issue + ModuleBase_ISelection *aSel = workshop()->selection(); QObjectPtrList aSelectedObj = aSel->selectedPresentations(); - // if there are no selected objects in the viewer, that means that the selection in another - // place cased this method. It is necessary to return the false value to understande in above - // method that delete is not processed + // if there are no selected objects in the viewer, that means that the + // selection in another place cased this method. It is necessary to return + // the false value to understande in above method that delete is not + // processed if (aSelectedObj.count() == 0) return false; // avoid delete of the objects, which are not belong to the current sketch // in order to do not delete results of other sketches QObjectPtrList aSketchObjects; - QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end(); - for ( ; anIt != aLast; anIt++) { + QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), + aLast = aSelectedObj.end(); + for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (mySketchMgr->isObjectOfSketch(anObject)) { - // sketch feature should be used in this list because workshop deletes features only - // results are skipped + // sketch feature should be used in this list because workshop deletes + // features only results are skipped FeaturePtr aSketchFeature = ModelAPI_Feature::feature(anObject); aSketchObjects.append(aSketchFeature); } } - // if the selection contains only local selected presentations from other sketches, - // the Delete operation should not be done at all + // if the selection contains only local selected presentations from other + // sketches, the Delete operation should not be done at all if (aSketchObjects.size() == 0) return true; // 3. start operation - QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text(); - ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, this); + QString aDescription = + aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text(); + ModuleBase_Operation *anOpAction = + new ModuleBase_Operation(aDescription, this); // the active nested sketch operation should be aborted unconditionally // the Delete action should be additionally granted for the Sketch operation @@ -1038,11 +1084,11 @@ bool PartSet_Module::deleteObjects() anOpMgr->startOperation(anOpAction); - // WORKAROUND, should be done to avoid viewer highlight update after deletetion of objects - // the problem is in AIS Dimensions recompute - // if a line and the dim are removed, line is the first - // it causes the AIS recompute, where the base line is null, - // the result is empty AIS in the viewer + // WORKAROUND, should be done to avoid viewer highlight update after + // deletetion of objects the problem is in AIS Dimensions recompute if a + // line and the dim are removed, line is the first it causes the AIS + // recompute, where the base line is null, the result is empty AIS in the + // viewer XGUI_Tools::workshop(myWorkshop)->selector()->clearSelection(); // 4. delete features @@ -1056,21 +1102,17 @@ bool PartSet_Module::deleteObjects() } //****************************************************** -void PartSet_Module::editFeature(FeaturePtr theFeature) -{ +void PartSet_Module::editFeature(FeaturePtr theFeature) { storeConstraintsState(theFeature->getKind()); ModuleBase_IModule::editFeature(theFeature); } //****************************************************** -bool PartSet_Module::canCommitOperation() const -{ - return true; -} +bool PartSet_Module::canCommitOperation() const { return true; } //****************************************************** -void PartSet_Module::launchOperation(const QString& theCmdId, const bool& isStartAfterCommitOnly) -{ +void PartSet_Module::launchOperation(const QString &theCmdId, + const bool &isStartAfterCommitOnly) { myIsOperationIsLaunched = true; storeConstraintsState(theCmdId.toStdString()); updateConstraintsState(theCmdId.toStdString()); @@ -1081,42 +1123,47 @@ void PartSet_Module::launchOperation(const QString& theCmdId, const bool& isStar } //****************************************************** -void PartSet_Module::storeConstraintsState(const std::string& theFeatureKind) -{ +void PartSet_Module::storeConstraintsState(const std::string &theFeatureKind) { if (myWorkshop->currentOperation() && - myWorkshop->currentOperation()->id().toStdString() == SketchPlugin_Sketch::ID()) { - const QMap& aShownStates = - mySketchMgr->showConstraintStates(); + myWorkshop->currentOperation()->id().toStdString() == + SketchPlugin_Sketch::ID()) { + const QMap &aShownStates = + mySketchMgr->showConstraintStates(); myHasConstraintShown = aShownStates; } } //****************************************************** -void PartSet_Module::updateConstraintsState(const std::string& theFeatureKind) -{ - if (PartSet_SketcherMgr::constraintsIdList().contains(theFeatureKind.c_str()) || - PartSet_SketcherMgr::replicationsIdList().contains(theFeatureKind.c_str())) { +void PartSet_Module::updateConstraintsState(const std::string &theFeatureKind) { + if (PartSet_SketcherMgr::constraintsIdList().contains( + theFeatureKind.c_str()) || + PartSet_SketcherMgr::replicationsIdList().contains( + theFeatureKind.c_str())) { // Show constraints if a constraint was anOperation mySketchMgr->updateBySketchParameters(PartSet_Tools::Geometrical, true); mySketchMgr->updateBySketchParameters(PartSet_Tools::Dimensional, true); - mySketchMgr->updateBySketchParameters(PartSet_Tools::Expressions, - myHasConstraintShown[PartSet_Tools::Expressions]); + mySketchMgr->updateBySketchParameters( + PartSet_Tools::Expressions, + myHasConstraintShown[PartSet_Tools::Expressions]); } } //****************************************************** -void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) -{ - Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); +void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, + AISObjectPtr theAIS) { + Handle(AIS_InteractiveObject) anAIS = + theAIS->impl(); if (!anAIS.IsNull()) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get()) { bool aToUseZLayer = false; - if (PartSet_Tools::findRefsToMeFeature(aFeature,SketchPlugin_Projection::ID())) + if (PartSet_Tools::findRefsToMeFeature(aFeature, + SketchPlugin_Projection::ID())) aToUseZLayer = true; else { CompositeFeaturePtr aParent = ModelAPI_Tools::compositeOwner(aFeature); - aToUseZLayer = (aParent.get() && (aParent->getKind() == SketchPlugin_Sketch::ID())); + aToUseZLayer = (aParent.get() && + (aParent->getKind() == SketchPlugin_Sketch::ID())); } if (aToUseZLayer) { Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext(); @@ -1130,31 +1177,30 @@ void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) } //****************************************************** -void PartSet_Module::onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS) -{ +void PartSet_Module::onBeforeObjectErase(ObjectPtr theObject, + AISObjectPtr theAIS) { // this is obsolete - // it should be recomputed in order to disappear in the viewer if the corresponded object - // is erased - //if (myCustomPrs->isActive()) + // it should be recomputed in order to disappear in the viewer if the + // corresponded object is erased + // if (myCustomPrs->isActive()) // myCustomPrs->redisplay(theObject, false); } //****************************************************** -void PartSet_Module::onViewTransformed(int theTrsfType) -{ +void PartSet_Module::onViewTransformed(int theTrsfType) { // Set length of arrows constant in pixel size // if the operation is panning or rotate or panglobal then do nothing if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4)) return; - ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->viewer(); Handle(AIS_InteractiveContext) aContext = aViewer->AISContext(); if (aContext.IsNull()) return; - //Handle(V3d_View) aView = aViewer->activeView(); + // Handle(V3d_View) aView = aViewer->activeView(); - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer(); Handle(V3d_View) aView; double aScale = 0; @@ -1171,25 +1217,27 @@ void PartSet_Module::onViewTransformed(int theTrsfType) return; bool isModified = false; - ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *aCurrentOperation = myWorkshop->currentOperation(); if (aCurrentOperation && - (PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) || - sketchMgr()->isNestedSketchOperation(aCurrentOperation) || - (aCurrentOperation->id() == "Measurement"))) - { + (PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) || + sketchMgr()->isNestedSketchOperation(aCurrentOperation) || + (aCurrentOperation->id() == "Measurement"))) { double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize()); SketcherPrs_Tools::setArrowSize(aLen); const double aCurScale = aViewer->activeView()->Camera()->Scale(); aViewer->SetScale(aViewer->activeView(), aCurScale); #ifdef OPTIMIZE_PRS - QList aPrsList = aDisplayer->displayedPresentations(); - foreach(Handle(AIS_InteractiveObject) aAisObj, aPrsList) { + QList aPrsList = + aDisplayer->displayedPresentations(); + foreach (Handle(AIS_InteractiveObject) aAisObj, aPrsList) { #else QList aPrsList = aDisplayer->displayedPresentations(); - foreach(AISObjectPtr aAIS, aPrsList) { - Handle(AIS_InteractiveObject) aAisObj = aAIS->impl(); + foreach (AISObjectPtr aAIS, aPrsList) { + Handle(AIS_InteractiveObject) aAisObj = + aAIS->impl(); #endif - Handle(PrsDim_Dimension) aDim = Handle(PrsDim_Dimension)::DownCast(aAisObj); + Handle(PrsDim_Dimension) aDim = + Handle(PrsDim_Dimension)::DownCast(aAisObj); if (!aDim.IsNull()) { aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen); aContext->Redisplay(aDim, false); @@ -1202,11 +1250,13 @@ void PartSet_Module::onViewTransformed(int theTrsfType) if (Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows")) { Handle(AIS_Trihedron) aTrihedron = aViewer->trihedron(); if (!aTrihedron.IsNull()) { - double aAxLen = - aView->Convert(Config_PropManager::integer("Visualization", "axis_arrow_size")); - Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); + double aAxLen = aView->Convert( + Config_PropManager::integer("Visualization", "axis_arrow_size")); + Handle(Prs3d_DatumAspect) aDatumAspect = + aTrihedron->Attributes()->DatumAspect(); double aAxisLen = aDatumAspect->AxisLength(Prs3d_DP_XAxis); - aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen); + aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, + aAxLen / aAxisLen); aTrihedron->Attributes()->SetDatumAspect(aDatumAspect); aContext->Redisplay(aTrihedron, false); isModified = true; @@ -1217,29 +1267,29 @@ void PartSet_Module::onViewTransformed(int theTrsfType) } //****************************************************** -bool PartSet_Module::isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const -{ +bool PartSet_Module::isCustomPrsActivated( + const ModuleBase_CustomizeFlag &theFlag) const { return myCustomPrs->isActive(theFlag); } //****************************************************** -void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature, - const ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ +void PartSet_Module::activateCustomPrs(const FeaturePtr &theFeature, + const ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { myCustomPrs->activate(theFeature, theFlag, theUpdateViewer); } //****************************************************** -void PartSet_Module::deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ +void PartSet_Module::deactivateCustomPrs( + const ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer) { myCustomPrs->deactivate(theFlag, theUpdateViewer); } //****************************************************** -//bool PartSet_Module::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, -// std::shared_ptr theCustomPrs) +// bool PartSet_Module::customisePresentation(ResultPtr theResult, AISObjectPtr +// thePrs, +// std::shared_ptr +// theCustomPrs) //{ // bool aCustomized = false; // @@ -1263,52 +1313,56 @@ void PartSet_Module::deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag //} // ////****************************************************** -//bool PartSet_Module::afterCustomisePresentation(std::shared_ptr theResult, -// AISObjectPtr thePrs, -// GeomCustomPrsPtr theCustomPrs) +// bool +// PartSet_Module::afterCustomisePresentation(std::shared_ptr +// theResult, +// AISObjectPtr thePrs, +// GeomCustomPrsPtr +// theCustomPrs) //{ -// bool aCustomized = false; +// bool aCustomized = false; // -// XGUI_Workshop* aWorkshop = getWorkshop(); -// XGUI_Displayer* aDisplayer = aWorkshop->displayer(); -// ObjectPtr anObject = aDisplayer->getObject(thePrs); -// if (!anObject) -// return aCustomized; +// XGUI_Workshop* aWorkshop = getWorkshop(); +// XGUI_Displayer* aDisplayer = aWorkshop->displayer(); +// ObjectPtr anObject = aDisplayer->getObject(thePrs); +// if (!anObject) +// return aCustomized; // -// std::vector aColor; -// bool aUseCustomColor = true; -// if (aUseCustomColor) -// myOverconstraintListener->getCustomColor(anObject, aColor); -// // customize sketch symbol presentation -// Handle(AIS_InteractiveObject) anAISIO = thePrs->impl(); -// if (!anAISIO.IsNull()) { -// if (!Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO).IsNull()) { -// Handle(SketcherPrs_SymbolPrs) aPrs = Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO); -// if (!aPrs.IsNull()) { -// aPrs->SetCustomColor(aColor); -// aCustomized = true; -// } -// } else if (!Handle(SketcherPrs_Coincident)::DownCast(anAISIO).IsNull()) { -// Handle(SketcherPrs_Coincident) aPrs = Handle(SketcherPrs_Coincident)::DownCast(anAISIO); -// if (!aPrs.IsNull()) { -// aPrs->SetCustomColor(aColor); -// aCustomized = true; -// } -// } -// } -// // customize sketch dimension constraint presentation -// if (!aCustomized) { -// if (!aColor.empty()) { // otherwise presentation has the default color -// aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]); -// } -// } -// return aCustomized; -//} - -//****************************************************** -bool PartSet_Module::customizeFeature(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) -{ +// std::vector aColor; +// bool aUseCustomColor = true; +// if (aUseCustomColor) +// myOverconstraintListener->getCustomColor(anObject, aColor); +// // customize sketch symbol presentation +// Handle(AIS_InteractiveObject) anAISIO = +// thePrs->impl(); if (!anAISIO.IsNull()) { +// if (!Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO).IsNull()) { +// Handle(SketcherPrs_SymbolPrs) aPrs = +// Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO); if (!aPrs.IsNull()) { +// aPrs->SetCustomColor(aColor); +// aCustomized = true; +// } +// } else if (!Handle(SketcherPrs_Coincident)::DownCast(anAISIO).IsNull()) { +// Handle(SketcherPrs_Coincident) aPrs = +// Handle(SketcherPrs_Coincident)::DownCast(anAISIO); if (!aPrs.IsNull()) +// { +// aPrs->SetCustomColor(aColor); +// aCustomized = true; +// } +// } +// } +// // customize sketch dimension constraint presentation +// if (!aCustomized) { +// if (!aColor.empty()) { // otherwise presentation has the default color +// aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]); +// } +// } +// return aCustomized; +// } + +//****************************************************** +bool PartSet_Module::customizeFeature(ObjectPtr theObject, + const ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) { bool isRedisplayed = false; if (myCustomPrs->isActive(theFlag)) isRedisplayed = myCustomPrs->redisplay(theObject, theFlag, theUpdateViewer); @@ -1317,33 +1371,34 @@ bool PartSet_Module::customizeFeature(ObjectPtr theObject, const ModuleBase_Cust } //****************************************************** -void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser) -{ - XGUI_ObjectsBrowser* aOB = dynamic_cast(theObjectBrowser); +void PartSet_Module::customizeObjectBrowser(QWidget *theObjectBrowser) { + XGUI_ObjectsBrowser *aOB = + dynamic_cast(theObjectBrowser); if (aOB) { - QLabel* aLabel = aOB->activeDocLabel(); + QLabel *aLabel = aOB->activeDocLabel(); aLabel->installEventFilter(myMenuMgr); - connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint&)), - SLOT(onActiveDocPopup(const QPoint&))); + connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint &)), + SLOT(onActiveDocPopup(const QPoint &))); aOB->treeView()->setExpandsOnDoubleClick(false); - connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)), - SLOT(onTreeViewDoubleClick(const QModelIndex&))); + connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex &)), + SLOT(onTreeViewDoubleClick(const QModelIndex &))); - Events_Loop* aLoop = Events_Loop::loop(); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + Events_Loop *aLoop = Events_Loop::loop(); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_OBJECT_CREATED)); } } //****************************************************** -void PartSet_Module::onActiveDocPopup(const QPoint& thePnt) -{ +void PartSet_Module::onActiveDocPopup(const QPoint &thePnt) { SessionPtr aMgr = ModelAPI_Session::get(); - QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD"); + QAction *aActivatePartAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD"); - XGUI_Workshop* aWorkshop = getWorkshop(); - QLabel* aHeader = aWorkshop->objectBrowser()->activeDocLabel(); + XGUI_Workshop *aWorkshop = getWorkshop(); + QLabel *aHeader = aWorkshop->objectBrowser()->activeDocLabel(); - aActivatePartAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument())); + aActivatePartAction->setEnabled( + (aMgr->activeDocument() != aMgr->moduleDocument())); QMenu aMenu; aMenu.addAction(aActivatePartAction); @@ -1355,14 +1410,16 @@ void PartSet_Module::onActiveDocPopup(const QPoint& thePnt) bool aHaveToActivate = false; for (int i = 0; i < aNbParts; i++) { ObjectPtr aObj = aDoc->object(ModelAPI_ResultPart::group(), i); - ResultPartPtr aPartRes = std::dynamic_pointer_cast(aObj); + ResultPartPtr aPartRes = + std::dynamic_pointer_cast(aObj); if (!aPartRes->partDoc().get()) { aHaveToActivate = true; break; } } if (aHaveToActivate) { - QAction* aActivateAllPartAction = myMenuMgr->action("ACTIVATE_ALL_PARTS_CMD"); + QAction *aActivateAllPartAction = + myMenuMgr->action("ACTIVATE_ALL_PARTS_CMD"); aMenu.addAction(aActivateAllPartAction); } } @@ -1372,19 +1429,19 @@ void PartSet_Module::onActiveDocPopup(const QPoint& thePnt) } //****************************************************** -AISObjectPtr PartSet_Module::createPresentation(const ObjectPtr& theObject) -{ - Handle(AIS_InteractiveObject) anAISPrs = mySketchMgr->createPresentation(theObject); +AISObjectPtr PartSet_Module::createPresentation(const ObjectPtr &theObject) { + Handle(AIS_InteractiveObject) anAISPrs = + mySketchMgr->createPresentation(theObject); if (anAISPrs.IsNull()) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); if (aShapePtr.get() != NULL) anAISPrs = new ModuleBase_ResultPrs(aResult); - } - else { + } else { FieldStepPtr aStep = - std::dynamic_pointer_cast(theObject); + std::dynamic_pointer_cast( + theObject); if (aStep.get()) { anAISPrs = new PartSet_FieldStepPrs(aStep); } @@ -1394,7 +1451,7 @@ AISObjectPtr PartSet_Module::createPresentation(const ObjectPtr& theObject) if (!anAISPrs.IsNull()) { Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISPrs); if (!aShapePrs.IsNull()) - ModuleBase_Tools::setPointBallHighlighting((AIS_Shape*)aShapePrs.get()); + ModuleBase_Tools::setPointBallHighlighting((AIS_Shape *)aShapePrs.get()); anAIS = AISObjectPtr(new GeomAPI_AISObject()); anAIS->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs)); @@ -1404,8 +1461,7 @@ AISObjectPtr PartSet_Module::createPresentation(const ObjectPtr& theObject) } //****************************************************** -double getResultDeflection(const ResultPtr& theResult) -{ +double getResultDeflection(const ResultPtr &theResult) { double aDeflection = ModelAPI_Tools::getDeflection(theResult); if (aDeflection < 0) aDeflection = PartSet_Tools::getDefaultDeflection(theResult); @@ -1413,21 +1469,19 @@ double getResultDeflection(const ResultPtr& theResult) } //****************************************************** -double getResultTransparency(const ResultPtr& theResult) -{ +double getResultTransparency(const ResultPtr &theResult) { double aTransparency = ModelAPI_Tools::getTransparency(theResult); if (aTransparency < 0) aTransparency = PartSet_Tools::getDefaultTransparency(); return aTransparency; } -static AttributeImagePtr findImage(const ObjectPtr& theResult) -{ +static AttributeImagePtr findImage(const ObjectPtr &theResult) { AttributeImagePtr anImageAttr; if (theResult.get()) { ResultBodyPtr aResultBody = - std::dynamic_pointer_cast(theResult); + std::dynamic_pointer_cast(theResult); if (aResultBody.get()) { anImageAttr = aResultBody->data()->image(ModelAPI_ResultBody::IMAGE_ID()); if (!anImageAttr.get() || !anImageAttr->hasTexture()) { @@ -1442,11 +1496,10 @@ static AttributeImagePtr findImage(const ObjectPtr& theResult) } //****************************************************** -void PartSet_Module::setTexture(const AISObjectPtr& thePrs, - const ResultPtr& theResult) -{ +void PartSet_Module::setTexture(const AISObjectPtr &thePrs, + const ResultPtr &theResult) { ResultBodyPtr aResultBody = - std::dynamic_pointer_cast(theResult); + std::dynamic_pointer_cast(theResult); if (!aResultBody.get()) return; @@ -1459,15 +1512,15 @@ void PartSet_Module::setTexture(const AISObjectPtr& thePrs, std::list aByteList; anImageAttr->texture(aWidth, aHeight, aByteList, aFormat); - Handle(AIS_InteractiveObject) anAIS = thePrs->impl(); + Handle(AIS_InteractiveObject) anAIS = + thePrs->impl(); if (!anAIS.IsNull()) { /// set color to white and change material aspect, /// in order to keep a natural apect of the image. thePrs->setColor(255, 255, 255); - Quantity_Color myShadingColor(NCollection_Vec3(1., 1., 1.)); + Quantity_Color myShadingColor(NCollection_Vec3(1., 1., 1.)); Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS); - if (!anAISShape.IsNull()) - { + if (!anAISShape.IsNull()) { auto myDrawer = anAISShape->Attributes(); myDrawer->ShadingAspect()->SetColor(myShadingColor); @@ -1477,7 +1530,7 @@ void PartSet_Module::setTexture(const AISObjectPtr& thePrs, myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect); myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect); - //aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage()); + // aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage()); Handle(Image_PixMap) aPixmap = new Image_PixMap(); #if OCC_VERSION_LARGE < 0x07070000 aPixmap->InitTrash(Image_PixMap::ImgBGRA, aWidth, aHeight); @@ -1488,17 +1541,18 @@ void PartSet_Module::setTexture(const AISObjectPtr& thePrs, for (int aLine = 0; aLine < aHeight; ++aLine) { // convert pixels from ARGB to renderer-compatible RGBA for (int aByte = 0; aByte < aWidth; ++aByte) { - Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue(aLine, aByte); + Image_ColorBGRA &aPixmapBytes = + aPixmap->ChangeValue(aLine, aByte); - aPixmapBytes.b() = (Standard_Byte) *aByteIter++; - aPixmapBytes.g() = (Standard_Byte) *aByteIter++; - aPixmapBytes.r() = (Standard_Byte) *aByteIter++; - aPixmapBytes.a() = (Standard_Byte) *aByteIter++; + aPixmapBytes.b() = (Standard_Byte)*aByteIter++; + aPixmapBytes.g() = (Standard_Byte)*aByteIter++; + aPixmapBytes.r() = (Standard_Byte)*aByteIter++; + aPixmapBytes.a() = (Standard_Byte)*aByteIter++; } } - anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap - (new Graphic3d_Texture2Dmanual(aPixmap)); + anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap( + new Graphic3d_Texture2Dmanual(aPixmap)); anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn(); anAISShape->SetDisplayMode(AIS_Shaded); @@ -1507,24 +1561,24 @@ void PartSet_Module::setTexture(const AISObjectPtr& thePrs, } //****************************************************** -void PartSet_Module::customizePresentation(const ObjectPtr& theObject, - const AISObjectPtr& thePrs) const -{ +void PartSet_Module::customizePresentation(const ObjectPtr &theObject, + const AISObjectPtr &thePrs) const { if (mySketchMgr->isObjectOfSketch(theObject)) { mySketchMgr->customizeSketchPresentation(theObject, thePrs); - } - else { + } else { ResultPtr aResult = std::dynamic_pointer_cast(theObject); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aResult.get()) { std::vector aColor; - bool isSameDoc = (ModelAPI_Session::get()->activeDocument() == aResult->document()); + bool isSameDoc = + (ModelAPI_Session::get()->activeDocument() == aResult->document()); // Get user defined color for the object ModelAPI_Tools::getColor(aResult, aColor); if (isSameDoc) { bool isCustomized = false; if (aColor.empty() && aFeature.get()) { - GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast(aFeature); + GeomCustomPrsPtr aCustPrs = + std::dynamic_pointer_cast(aFeature); if (aCustPrs.get()) { isCustomized = aCustPrs->customisePresentation(aResult, thePrs); } @@ -1535,14 +1589,13 @@ void PartSet_Module::customizePresentation(const ObjectPtr& theObject, } thePrs->setColor(aColor[0], aColor[1], aColor[2]); } - } - else { + } else { if (aColor.empty()) { PartSet_Tools::getDefaultColor(aResult, false, aColor); } QColor aQColor(aColor[0], aColor[1], aColor[2]); - QColor aNewColor = - QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF() / 3., aQColor.valueF()); + QColor aNewColor = QColor::fromHsvF( + aQColor.hueF(), aQColor.saturationF() / 3., aQColor.valueF()); thePrs->setColor(aNewColor.red(), aNewColor.green(), aNewColor.blue()); } thePrs->setDeflection(getResultDeflection(aResult)); @@ -1552,28 +1605,28 @@ void PartSet_Module::customizePresentation(const ObjectPtr& theObject, setTexture(thePrs, aResult); } if (aFeature.get() && (aFeature->getKind() == SketchPlugin_Sketch::ID())) { - thePrs->setWidth(2); + thePrs->setWidth(2); } } } - //****************************************************** -ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const -{ +ObjectPtr +PartSet_Module::findPresentedObject(const AISObjectPtr &theAIS) const { ObjectPtr anObject; - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *aOperation = myWorkshop->currentOperation(); if (aOperation) { - /// If last line finished on vertex the lines creation sequence has to be break - ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + /// If last line finished on vertex the lines creation sequence has to be + /// break + ModuleBase_IPropertyPanel *aPanel = aOperation->propertyPanel(); if (aPanel) { - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); + ModuleBase_ModelWidget *anActiveWidget = aPanel->activeWidget(); // if there is an active widget, find the presented object in it if (!anActiveWidget) anActiveWidget = aPanel->preselectionWidget(); - ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast - (anActiveWidget); + ModuleBase_WidgetValidated *aWidgetValidated = + dynamic_cast(anActiveWidget); if (aWidgetValidated) anObject = aWidgetValidated->findPresentedObject(theAIS); } @@ -1582,11 +1635,11 @@ ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const } //****************************************************** -bool PartSet_Module::canBeShaded(Handle(AIS_InteractiveObject) theAIS) const -{ +bool PartSet_Module::canBeShaded(Handle(AIS_InteractiveObject) theAIS) const { bool aCanBeShaged = true; - Handle(PartSet_ResultSketchPrs) aPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theAIS); + Handle(PartSet_ResultSketchPrs) aPrs = + Handle(PartSet_ResultSketchPrs)::DownCast(theAIS); if (!aPrs.IsNull()) aCanBeShaged = false; @@ -1594,12 +1647,11 @@ bool PartSet_Module::canBeShaded(Handle(AIS_InteractiveObject) theAIS) const } //****************************************************** -void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const -{ +void PartSet_Module::addObjectBrowserMenu(QMenu *theMenu) const { QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects(); int aSelected = aObjects.size(); SessionPtr aMgr = ModelAPI_Session::get(); - QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD"); + QAction *aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD"); bool hasResult = false; bool hasFeature = false; @@ -1609,20 +1661,25 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const bool hasFolder = false; bool hasGroupsOnly = false; ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, - hasCompositeOwner, hasResultInHistory, hasFolder, hasGroupsOnly); + hasCompositeOwner, hasResultInHistory, + hasFolder, hasGroupsOnly); - ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation(); + ModuleBase_Operation *aCurrentOp = myWorkshop->currentOperation(); if (aSelected == 1) { ObjectPtr aObject = aObjects.first(); if (aObject) { - ResultPartPtr aPart = std::dynamic_pointer_cast(aObject); - FeaturePtr aFeature = std::dynamic_pointer_cast(aObject); - bool isPart = aPart.get() || - (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID())); + ResultPartPtr aPart = + std::dynamic_pointer_cast(aObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aObject); + bool isPart = + aPart.get() || + (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID())); if (isPart) { DocumentPtr aPartDoc; if (!aPart.get()) { - aPart = std::dynamic_pointer_cast(aFeature->firstResult()); + aPart = std::dynamic_pointer_cast( + aFeature->firstResult()); } if (aPart.get()) // this may be null is Part feature is disabled aPartDoc = aPart->partDoc(); @@ -1641,7 +1698,7 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const // disable Edit menu for groups under ImportResult feature if (aFeature->getKind() == "Group") { std::shared_ptr anOwner = - ModelAPI_Tools::compositeOwner (aFeature); + ModelAPI_Tools::compositeOwner(aFeature); if (anOwner.get() && anOwner->getKind() == "ImportResult") { isEnabled = false; } @@ -1674,40 +1731,42 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const } //****************************************************** -#define EXPAND_PARENT(OBJ) \ -QModelIndex aObjIndex = aDataModel->objectIndex(OBJ); \ -if (aObjIndex.isValid()) { \ - QModelIndex aParent = aObjIndex.parent(); \ - int aCount = aDataModel->rowCount(aParent); \ - if (aCount == 1) \ - aTreeView->setExpanded(aParent, true); \ -} +#define EXPAND_PARENT(OBJ) \ + QModelIndex aObjIndex = aDataModel->objectIndex(OBJ); \ + if (aObjIndex.isValid()) { \ + QModelIndex aParent = aObjIndex.parent(); \ + int aCount = aDataModel->rowCount(aParent); \ + if (aCount == 1) \ + aTreeView->setExpanded(aParent, true); \ + } //****************************************************** -void PartSet_Module::processEvent(const std::shared_ptr& theMessage) -{ - if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENTS_CLOSED)) { +void PartSet_Module::processEvent( + const std::shared_ptr &theMessage) { + if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_DOCUMENTS_CLOSED)) { closeDocument(); - } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) { SessionPtr aMgr = ModelAPI_Session::get(); - if (!aMgr->hasModuleDocument()) // if document is closed, do not call the document creation + if (!aMgr->hasModuleDocument()) // if document is closed, do not call the + // document creation return; // Do not change activation of parts if an operation active static QStringList aAllowActivationList; if (aAllowActivationList.isEmpty()) - aAllowActivationList << - QString(PartSetPlugin_Part::ID().c_str()) << - QString(PartSetPlugin_Duplicate::ID().c_str()) << - QString(PartSetPlugin_Remove::ID().c_str()); + aAllowActivationList << QString(PartSetPlugin_Part::ID().c_str()) + << QString(PartSetPlugin_Duplicate::ID().c_str()) + << QString(PartSetPlugin_Remove::ID().c_str()); if (myWorkshop->currentOperation() && - (!aAllowActivationList.contains(myWorkshop->currentOperation()->id()))) + (!aAllowActivationList.contains(myWorkshop->currentOperation()->id()))) return; - XGUI_Workshop* aWorkshop = getWorkshop(); + XGUI_Workshop *aWorkshop = getWorkshop(); bool needUpdate = false; - XGUI_DataTree* aTreeView = 0; + XGUI_DataTree *aTreeView = 0; if (aWorkshop->objectBrowser()) { aTreeView = aWorkshop->objectBrowser()->treeView(); - QLabel* aLabel = aWorkshop->objectBrowser()->activeDocLabel(); + QLabel *aLabel = aWorkshop->objectBrowser()->activeDocLabel(); QPalette aPalet = aLabel->palette(); DocumentPtr aActiveDoc = aMgr->activeDocument(); @@ -1718,7 +1777,7 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess if (aMgr->allOpenedDocuments().size() <= 1) myActivePartIndex = QModelIndex(); - XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); + XGUI_DataModel *aDataModel = aWorkshop->objectBrowser()->dataModel(); QModelIndex aOldActive = myActivePartIndex; myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc, 0); if (myActivePartIndex.isValid()) { @@ -1734,12 +1793,12 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess aWorkshop->updateCommandStatus(); // Update displayed objects in order to update active color - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); QObjectPtrList aObjects = aDisplayer->displayedObjects(); bool aHidden; - foreach(ObjectPtr aObj, aObjects) { + foreach (ObjectPtr aObj, aObjects) { aHidden = !aObj->data() || !aObj->data()->isValid() || - aObj->isDisabled() || (!aObj->isDisplayed()); + aObj->isDisabled() || (!aObj->isDisplayed()); if (!aHidden) { aDisplayer->redisplay(aObj, false); } @@ -1749,7 +1808,8 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess if (needUpdate) { aTreeView->viewport()->update(aTreeView->viewport()->rect()); } - } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); std::set aObjects = aUpdMsg->objects(); @@ -1760,20 +1820,22 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) { ObjectPtr aObject = (*aIt); - if ((!aResultObj.get()) && (aObject->groupName() == ModelAPI_ResultBody::group()) - && (aObject->document() != aRootDoc)) + if ((!aResultObj.get()) && + (aObject->groupName() == ModelAPI_ResultBody::group()) && + (aObject->document() != aRootDoc)) aResultObj = aObject; - if ((!aConstrObj.get()) && (aObject->groupName() == ModelAPI_ResultConstruction::group()) - && (aObject->document() != aRootDoc)) + if ((!aConstrObj.get()) && + (aObject->groupName() == ModelAPI_ResultConstruction::group()) && + (aObject->document() != aRootDoc)) aConstrObj = aObject; if (aResultObj.get() && aConstrObj.get()) break; } if (aResultObj.get() || aConstrObj.get()) { - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView(); - XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_DataTree *aTreeView = aWorkshop->objectBrowser()->treeView(); + XGUI_DataModel *aDataModel = aWorkshop->objectBrowser()->dataModel(); if (aResultObj.get()) { EXPAND_PARENT(aResultObj) @@ -1782,40 +1844,43 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess EXPAND_PARENT(aConstrObj) } } - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { CompositeFeaturePtr aSketch = mySketchMgr->activeSketch(); if (aSketch.get()) { - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->currentOperation(); if (PartSet_SketcherMgr::isSketchOperation(anOperation) && - mySketchMgr->previewSketchPlane()->isDisplayed()) - mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); + mySketchMgr->previewSketchPlane()->isDisplayed()) + mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, + myWorkshop); } - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_LICENSE_VALID)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_FEATURE_LICENSE_VALID)) { std::shared_ptr aMsg = - std::dynamic_pointer_cast(theMessage); - myFeaturesValidLicense.insert(aMsg->features().begin(), aMsg->features().end()); + std::dynamic_pointer_cast( + theMessage); + myFeaturesValidLicense.insert(aMsg->features().begin(), + aMsg->features().end()); processProprietaryFeatures(); } } //****************************************************** -void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) -{ - if (myWorkshop->currentOperation()) // Do not change activation of parts if an operation active +void PartSet_Module::onTreeViewDoubleClick(const QModelIndex &theIndex) { + if (myWorkshop->currentOperation()) // Do not change activation of parts if an + // operation active return; SessionPtr aMgr = ModelAPI_Session::get(); if (!theIndex.isValid()) { // It seems that this code is obsolete - //aMgr->setActiveDocument(aMgr->moduleDocument()); + // aMgr->setActiveDocument(aMgr->moduleDocument()); return; } if (theIndex.column() != 1) // Use only first column return; - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_DataModel *aDataModel = aWorkshop->objectBrowser()->dataModel(); // De not use non editable Indexes if ((aDataModel->flags(theIndex) & Qt::ItemIsSelectable) == 0) return; @@ -1824,18 +1889,21 @@ void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) ResultPartPtr aPart = std::dynamic_pointer_cast(aObj); if (!aPart.get()) { // Probably this is Feature FeaturePtr aPartFeature = std::dynamic_pointer_cast(aObj); - if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) { - aPart = std::dynamic_pointer_cast(aPartFeature->firstResult()); + if (aPartFeature.get() && + (aPartFeature->getKind() == PartSetPlugin_Part::ID())) { + aPart = std::dynamic_pointer_cast( + aPartFeature->firstResult()); } - if (aObj.get()) - { - if (!aPart.get() && aObj->groupName() == ModelAPI_ResultParameter::group()) - { - QObjectPtrList aSelectedObjects = aWorkshop->objectBrowser()->selectedObjects(); + if (aObj.get()) { + if (!aPart.get() && + aObj->groupName() == ModelAPI_ResultParameter::group()) { + QObjectPtrList aSelectedObjects = + aWorkshop->objectBrowser()->selectedObjects(); FeaturePtr aFeature; ResultParameterPtr aParam; - foreach(ObjectPtr aSelected, aSelectedObjects) { - aParam = std::dynamic_pointer_cast(aSelected); + foreach (ObjectPtr aSelected, aSelectedObjects) { + aParam = + std::dynamic_pointer_cast(aSelected); if (aParam.get()) break; } @@ -1857,10 +1925,9 @@ void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) } //****************************************************** -void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*) -{ - // z layer is created for all started operations in order to visualize operation AIS presentation - // over the object +void PartSet_Module::onViewCreated(ModuleBase_IViewWindow *) { + // z layer is created for all started operations in order to visualize + // operation AIS presentation over the object Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (aContext.IsNull()) return; @@ -1889,31 +1956,28 @@ void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*) } //****************************************************** -void PartSet_Module::widgetStateChanged(int thePreviousState) -{ +void PartSet_Module::widgetStateChanged(int thePreviousState) { mySketchMgr->widgetStateChanged(thePreviousState); } //****************************************************** -bool PartSet_Module::processEnter(const std::string& thePreviousAttributeID) -{ +bool PartSet_Module::processEnter(const std::string &thePreviousAttributeID) { return mySketchReentrantMgr->processEnter(thePreviousAttributeID); } //****************************************************** -void PartSet_Module::beforeOperationStopped(ModuleBase_Operation* theOperation) -{ +void PartSet_Module::beforeOperationStopped( + ModuleBase_Operation *theOperation) { if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { mySketchMgr->stopSketch(theOperation); } } //****************************************************** -GeomShapePtr PartSet_Module::findShape(const AttributePtr& theAttribute) -{ +GeomShapePtr PartSet_Module::findShape(const AttributePtr &theAttribute) { GeomShapePtr aGeomShape; - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->currentOperation(); if (anOperation && sketchMgr()->isNestedSketchOperation(anOperation)) { aGeomShape = PartSet_Tools::findShapeBy2DPoint(theAttribute, myWorkshop); } @@ -1921,14 +1985,13 @@ GeomShapePtr PartSet_Module::findShape(const AttributePtr& theAttribute) } //****************************************************** -AttributePtr PartSet_Module::findAttribute(const ObjectPtr& theObject, - const GeomShapePtr& theGeomShape) -{ +AttributePtr PartSet_Module::findAttribute(const ObjectPtr &theObject, + const GeomShapePtr &theGeomShape) { AttributePtr anAttribute; GeomShapePtr aGeomShape = theGeomShape; if (!aGeomShape.get()) { - // processing shape of result, e.g. sketch circle center is selected, this is a result - // the geom shape is empty, the shape of result should be used + // processing shape of result, e.g. sketch circle center is selected, this + // is a result the geom shape is empty, the shape of result should be used ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { aGeomShape = aResult->shape(); @@ -1938,62 +2001,58 @@ AttributePtr PartSet_Module::findAttribute(const ObjectPtr& theObject, if (aGeomShape.get()) { TopoDS_Shape aTDSShape = aGeomShape->impl(); std::pair anAttrAndIndex = - PartSet_Tools::findAttributeBy2dPoint(theObject, aTDSShape, mySketchMgr->activeSketch()); + PartSet_Tools::findAttributeBy2dPoint(theObject, aTDSShape, + mySketchMgr->activeSketch()); return anAttrAndIndex.first; } return anAttribute; } //****************************************************** -std::shared_ptr PartSet_Module::reentrantMessage() -{ +std::shared_ptr PartSet_Module::reentrantMessage() { return sketchReentranceMgr()->reentrantMessage(); } //****************************************************** -void PartSet_Module::setReentrantPreSelection(const std::shared_ptr& theMessage) -{ +void PartSet_Module::setReentrantPreSelection( + const std::shared_ptr &theMessage) { sketchReentranceMgr()->setReentrantPreSelection(theMessage); } //****************************************************** -void PartSet_Module::onChoiceChanged(ModuleBase_ModelWidget* theWidget, - int theIndex) -{ - ModuleBase_WidgetChoice* aChoiceWidget = dynamic_cast(theWidget); +void PartSet_Module::onChoiceChanged(ModuleBase_ModelWidget *theWidget, + int theIndex) { + ModuleBase_WidgetChoice *aChoiceWidget = + dynamic_cast(theWidget); if (!aChoiceWidget) return; QString aChoiceTitle = aChoiceWidget->getPropertyPanelTitle(theIndex); if (!aChoiceTitle.isEmpty()) { - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *aOperation = myWorkshop->currentOperation(); if (!aOperation) return; - ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = aOperation->propertyPanel(); if (aPanel) aPanel->setWindowTitle(aChoiceTitle); } } //****************************************************** -XGUI_Workshop* PartSet_Module::getWorkshop() const -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); +XGUI_Workshop *PartSet_Module::getWorkshop() const { + XGUI_ModuleConnector *aConnector = + dynamic_cast(workshop()); return aConnector->workshop(); } -void PartSet_Module::setDefaultConstraintShown() -{ +void PartSet_Module::setDefaultConstraintShown() { myHasConstraintShown[PartSet_Tools::Geometrical] = true; myHasConstraintShown[PartSet_Tools::Dimensional] = true; myHasConstraintShown[PartSet_Tools::Expressions] = false; } //****************************************************** -ModuleBase_ITreeNode* PartSet_Module::rootNode() const -{ - return myRoot; -} +ModuleBase_ITreeNode *PartSet_Module::rootNode() const { return myRoot; } //****************************************************** void PartSet_Module::disableCustomMode(ModuleBase_CustomizeFlag theMode) { @@ -2001,55 +2060,53 @@ void PartSet_Module::disableCustomMode(ModuleBase_CustomizeFlag theMode) { } //****************************************************** -void PartSet_Module::enableCustomModes() { - myCustomPrs->enableCustomModes(); -} +void PartSet_Module::enableCustomModes() { myCustomPrs->enableCustomModes(); } //****************************************************** -void PartSet_Module::onRemoveConflictingConstraints() -{ - const std::set& aConstraints = myOverconstraintListener->objectsToRemove(); +void PartSet_Module::onRemoveConflictingConstraints() { + const std::set &aConstraints = + myOverconstraintListener->objectsToRemove(); std::set::const_iterator anIt; - XGUI_Workshop* aWorkshop = getWorkshop(); - XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); + XGUI_Workshop *aWorkshop = getWorkshop(); + XGUI_OperationMgr *anOpMgr = aWorkshop->operationMgr(); - bool isAllowToNotify = ModuleBase_Preferences::resourceMgr()->booleanValue(SKETCH_TAB_NAME, - "notify_change_constraint"); + bool isAllowToNotify = ModuleBase_Preferences::resourceMgr()->booleanValue( + SKETCH_TAB_NAME, "notify_change_constraint"); if (isAllowToNotify) { anIt = aConstraints.begin(); std::string aText("Conflict in constraints: \n"); - for (; anIt != aConstraints.end(); anIt++) - { + for (; anIt != aConstraints.end(); anIt++) { ObjectPtr anObject = *anIt; - FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(anObject); TCollection_AsciiString aStr(aFeature->name().c_str()); std::string aName(aStr.ToCString()); aText += aName + "\n"; } - XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); - ModuleBase_Tools::warningAboutConflict(aConnector->desktop(), - aText); + XGUI_ModuleConnector *aConnector = + dynamic_cast(myWorkshop); + ModuleBase_Tools::warningAboutConflict(aConnector->desktop(), aText); } - ModuleBase_Operation* anOp = anOpMgr->currentOperation(); + ModuleBase_Operation *anOp = anOpMgr->currentOperation(); if (sketchMgr()->isNestedSketchOperation(anOp)) { std::set aFeatures; for (anIt = aConstraints.cbegin(); anIt != aConstraints.cend(); anIt++) aFeatures.insert(ModelAPI_Feature::feature(*anIt)); ModelAPI_Tools::removeFeaturesAndReferences(aFeatures); - } - else { + } else { QObjectPtrList anObjectsList; for (anIt = aConstraints.cbegin(); anIt != aConstraints.cend(); anIt++) anObjectsList.append(*anIt); - QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text(); - ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription); + QString aDescription = + aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text(); + ModuleBase_Operation *anOpAction = new ModuleBase_Operation(aDescription); anOpMgr->startOperation(anOpAction); aWorkshop->deleteFeatures(anObjectsList); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 443325093..1280117eb 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -14,34 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_Module_H #define PartSet_Module_H #include "PartSet.h" -#include "PartSet_Tools.h" #include "PartSet_OverconstraintListener.h" #include "PartSet_SketcherMgr.h" +#include "PartSet_Tools.h" -#include -#include -#include #include #include +#include +#include +#include #include //#include -#include -#include #include +#include +#include #include #include -#include #include +#include #include #include @@ -62,27 +63,28 @@ class ModelAPI_Result; class QAction; /** -* \ingroup Modules -* Implementation of Partset module -*/ -class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule, public Events_Listener -{ -Q_OBJECT - -/// Enumeration to specify the restart operation properties. -enum RestartingMode { - RM_None, /// the operation should not be restarted - RM_Forbided, /// the operation should not be restarted after there is no active widget - RM_LastFeatureUsed, /// the operation is restarted and use the previous feature - /// for own initialization - RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature -}; + * \ingroup Modules + * Implementation of Partset module + */ +class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule, + public Events_Listener { + Q_OBJECT + + /// Enumeration to specify the restart operation properties. + enum RestartingMode { + RM_None, /// the operation should not be restarted + RM_Forbided, /// the operation should not be restarted after there is no + /// active widget + RM_LastFeatureUsed, /// the operation is restarted and use the previous + /// feature for own initialization + RM_EmptyFeatureUsed /// the operation is restarted and does not use the + /// previous feature + }; public: - /// Constructor /// \param theWshop a pointer to a workshop - PartSet_Module(ModuleBase_IWorkshop* theWshop); + PartSet_Module(ModuleBase_IWorkshop *theWshop); virtual ~PartSet_Module(); // Stores the current selection @@ -92,15 +94,17 @@ public: virtual void restoreSelection(); /// Creates custom widgets for property panel - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, QWidget* theParent, - Config_WidgetAPI* theWidgetApi); + virtual ModuleBase_ModelWidget * + createWidgetByType(const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi); - /// Returns the active widget, by default it is the property panel active widget - /// If the internal edit operation is started, this is the first widget of the operation - virtual ModuleBase_ModelWidget* activeWidget() const; + /// Returns the active widget, by default it is the property panel active + /// widget If the internal edit operation is started, this is the first widget + /// of the operation + virtual ModuleBase_ModelWidget *activeWidget() const; /// Call back forlast tuning of property panel before operation performance - virtual void propertyPanelDefined(ModuleBase_Operation* theOperation); + virtual void propertyPanelDefined(ModuleBase_Operation *theOperation); /// If there is found selected attribute, widgets are created and contains /// only a widget for the attribute @@ -109,152 +113,163 @@ public: /// \param theXmlRepr an XML representation of the operation /// \param theWidgets a list of created widgets /// \return boolean result, false by default - virtual bool createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr, - QList& theWidgets) const; + virtual bool createWidgets(const FeaturePtr &theFeature, + const QString &theXmlRepr, + QList &theWidgets) const; /// Launching of a edit operation on the feature /// \param theFeature feature for editing virtual void editFeature(FeaturePtr theFeature); - /// Returns true if the operation can be committed. Result in default implementation is true. - /// \return boolean value + /// Returns true if the operation can be committed. Result in default + /// implementation is true. \return boolean value virtual bool canCommitOperation() const; /// Creates an operation and send it to loop /// \param theCmdId the operation name - /// \param isStartAfterCommitOnly operation is launched if there is no active operation or + /// \param isStartAfterCommitOnly operation is launched if there is no active + /// operation or /// it is committed - virtual void launchOperation(const QString& theCmdId, - const bool& isStartAfterCommitOnly); + virtual void launchOperation(const QString &theCmdId, + const bool &isStartAfterCommitOnly); /// Realizes some functionality by an operation start - /// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters - /// Activate the operation presentation - /// \param theOperation a started operation - virtual void operationStarted(ModuleBase_Operation* theOperation); + /// Displays all sketcher sub-Objects, hides sketcher result, appends + /// selection filters Activate the operation presentation \param theOperation + /// a started operation + virtual void operationStarted(ModuleBase_Operation *theOperation); /// Realizes some functionality by an operation resume /// Activate the operation presentation /// \param theOperation a resumed operation - virtual void operationResumed(ModuleBase_Operation* theOperation); + virtual void operationResumed(ModuleBase_Operation *theOperation); /// Realizes some functionality by an operation commit /// Restarts sketcher operation automatically of it is necessary /// \param theOperation a committed operation - virtual void operationCommitted(ModuleBase_Operation* theOperation); + virtual void operationCommitted(ModuleBase_Operation *theOperation); /// Realizes some functionality by an operation abort - /// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters - /// \param theOperation an aborted operation - virtual void operationAborted(ModuleBase_Operation* theOperation); + /// Hides all sketcher sub-Objects, displays sketcher result and removes + /// selection filters \param theOperation an aborted operation + virtual void operationAborted(ModuleBase_Operation *theOperation); /// Realizes some functionality by an operation stop - /// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters - /// \param theOperation a stopped operation - virtual void operationStopped(ModuleBase_Operation* theOperation); + /// Hides all sketcher sub-Objects, displays sketcher result and removes + /// selection filters \param theOperation a stopped operation + virtual void operationStopped(ModuleBase_Operation *theOperation); /// Returns current operation - virtual ModuleBase_Operation* currentOperation() const; + virtual ModuleBase_Operation *currentOperation() const; - /// Returns True if there are available Undos and the sketch manager allows undo - /// \return the boolean result + /// Returns True if there are available Undos and the sketch manager allows + /// undo \return the boolean result virtual bool canUndo() const; - //! Returns True if there are available Redos and the sketch manager allows redo + //! Returns True if there are available Redos and the sketch manager allows + //! redo /// \return the boolean result virtual bool canRedo() const; /// Returnas true if the action can be applyed to the object /// \param theObject a checked object - /// \param theActionId an identifier of action, to be found in the menu manager like "DELETE_CMD" - /// \return the a booean result - virtual bool canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const; + /// \param theActionId an identifier of action, to be found in the menu + /// manager like "DELETE_CMD" \return the a booean result + virtual bool canApplyAction(const ObjectPtr &theObject, + const QString &theActionId) const; - /// Returns True if the current operation can be committed. Asks the sketch manager. - /// \return a boolean value - //virtual bool canCommitOperation() const; + /// Returns True if the current operation can be committed. Asks the sketch + /// manager. \return a boolean value + // virtual bool canCommitOperation() const; - /// Returns whether the object can be erased at the bounds of the active operation. - /// The sub-objects of the current operation can not be erased + /// Returns whether the object can be erased at the bounds of the active + /// operation. The sub-objects of the current operation can not be erased /// \param theObject a model object - virtual bool canEraseObject(const ObjectPtr& theObject) const; + virtual bool canEraseObject(const ObjectPtr &theObject) const; - /// Returns whether the object can be displayed at the bounds of the active operation. - /// Display only current operation results for usual operation and ask the sketcher manager - /// if it is a sketch operation - /// \param theObject a model object - virtual bool canDisplayObject(const ObjectPtr& theObject) const; + /// Returns whether the object can be displayed at the bounds of the active + /// operation. Display only current operation results for usual operation and + /// ask the sketcher manager if it is a sketch operation \param theObject a + /// model object + virtual bool canDisplayObject(const ObjectPtr &theObject) const; - /// Returns parent result if accepted, true if the started operation is a nested operation - /// of the previous operation - /// \param thePreviousOperationKind a kind of previous operation - /// \param theStartedOperationKind a kind of a new operation - virtual bool canUsePreselection(const QString& thePreviousOperationKind, - const QString& theStartedOperationKind); + /// Returns parent result if accepted, true if the started operation is a + /// nested operation of the previous operation \param thePreviousOperationKind + /// a kind of previous operation \param theStartedOperationKind a kind of a + /// new operation + virtual bool canUsePreselection(const QString &thePreviousOperationKind, + const QString &theStartedOperationKind); /// Make some functionality after the objects are hidden in viewer /// \param theObjects a list of hidden objects - //virtual void processHiddenObject(const std::list& theObjects); + // virtual void processHiddenObject(const std::list& theObjects); /// Returns true if selection for the object can be activate. - /// For sketch operation allow the selection activation if the operation is edit, for other - /// operation uses the default result - /// \param theObject a model object - virtual bool canActivateSelection(const ObjectPtr& theObject) const; + /// For sketch operation allow the selection activation if the operation is + /// edit, for other operation uses the default result \param theObject a model + /// object + virtual bool canActivateSelection(const ObjectPtr &theObject) const; /// Add menu atems for object browser into the given menu /// \param theMenu a popup menu to be shown in the object browser - virtual void addObjectBrowserMenu(QMenu* theMenu) const; + virtual void addObjectBrowserMenu(QMenu *theMenu) const; /// Add menu items for viewer into the actions map /// \param theStdActions a map of standard actions /// \param theParent a parent widget - /// \param theMenuActions map of action/menu for the desirable index in the viewer menu - /// \return true if items are added and there is no necessity to provide standard menu - virtual bool addViewerMenu(const QMap& theStdActions, - QWidget* theParent, - QMap& theMenuActions) const; + /// \param theMenuActions map of action/menu for the desirable index in the + /// viewer menu \return true if items are added and there is no necessity to + /// provide standard menu + virtual bool addViewerMenu(const QMap &theStdActions, + QWidget *theParent, + QMap &theMenuActions) const; /// Returns a list of modes, where the AIS objects should be activated /// \param theModes a list of modes - virtual void activeSelectionModes(QIntList& theModes); + virtual void activeSelectionModes(QIntList &theModes); /// Appends specific selection modes for the module to the list of types /// \param theModesType combination of available selection filters /// \param theModes a selection modes to be extended - virtual void moduleSelectionModes(int theModesType, QIntList& theModes); - - /// Appends into container of filters module filters corresponded to the modes type - /// \param theFilterTypes container of available selection filters - /// \param theSelectionFilters [out] container to be extend by elements - virtual void moduleSelectionFilters(const QIntList& theFilterTypes, - SelectMgr_ListOfFilter& theSelectionFilters); + virtual void moduleSelectionModes(int theModesType, QIntList &theModes); + /// Appends into container of filters module filters corresponded to the modes + /// type \param theFilterTypes container of available selection filters \param + /// theSelectionFilters [out] container to be extend by elements + virtual void + moduleSelectionFilters(const QIntList &theFilterTypes, + SelectMgr_ListOfFilter &theSelectionFilters); /// Returns whether the mouse enter the viewer's window - /// \return true if items are added and there is no necessity to provide standard menu + /// \return true if items are added and there is no necessity to provide + /// standard menu bool isMouseOverWindow(); /// Returns sketch manager object - PartSet_SketcherMgr* sketchMgr() const { return mySketchMgr; } + PartSet_SketcherMgr *sketchMgr() const { return mySketchMgr; } /// Returns sketch reentrant manager - PartSet_SketcherReentrantMgr* sketchReentranceMgr() const { return mySketchReentrantMgr; } + PartSet_SketcherReentrantMgr *sketchReentranceMgr() const { + return mySketchReentrantMgr; + } /// Find object and attribute(if selected) for the given viewer selection /// \param theSelected a viewer selection /// \param theObject a selected model object /// \param theAttribute a selected model attribute - virtual void getGeomSelection(const std::shared_ptr& theSelected, - ObjectPtr& theObject, AttributePtr& theAttribute); + virtual void + getGeomSelection(const std::shared_ptr &theSelected, + ObjectPtr &theObject, AttributePtr &theAttribute); /// Returns listener of overconstraint signal /// \return the listener - PartSet_OverconstraintListener* overconstraintListener() { return myOverconstraintListener; } + PartSet_OverconstraintListener *overconstraintListener() { + return myOverconstraintListener; + } - /// Returns true if the current operation is not reentrant and the current state of the - /// application is not in launch operation mode - /// \return boolean value + /// Returns true if the current operation is not reentrant and the current + /// state of the application is not in launch operation mode \return boolean + /// value bool isSketchNeutralPointActivated() const; /// Performs functionality on closing document @@ -265,50 +280,58 @@ public: /// Event Listener method /// \param theMessage an event message - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); /// Set the object with the object results are customized /// \param theFeature a feature - void setCustomized(const FeaturePtr& theFeature); + void setCustomized(const FeaturePtr &theFeature); /// Return true if the custom presentation is activated - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// \return boolean value - virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const; + /// \param theFlag a flag of level of customization, which means that only + /// part of sub-elements \return boolean value + virtual bool + isCustomPrsActivated(const ModuleBase_CustomizeFlag &theFlag) const; /// Activate custom presentation for the object /// \param theFeature a feature instance - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// \param theUpdateViewer the parameter whether the viewer should be update immediately - virtual void activateCustomPrs(const FeaturePtr& theFeature, - const ModuleBase_CustomizeFlag& theFlag, + /// \param theFlag a flag of level of customization, which means that only + /// part of sub-elements \param theUpdateViewer the parameter whether the + /// viewer should be update immediately + virtual void activateCustomPrs(const FeaturePtr &theFeature, + const ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer); /// Deactivate custom presentation for the object - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// \param theUpdateViewer the parameter whether the viewer should be update immediately - virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag, + /// \param theFlag a flag of level of customization, which means that only + /// part of sub-elements \param theUpdateViewer the parameter whether the + /// viewer should be update immediately + virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer); /// Modifies the given presentation in the custom way. - //virtual bool customisePresentation(std::shared_ptr theResult, - // AISObjectPtr thePrs, - // std::shared_ptr theCustomPrs); - - ///// Modifies the given presentation in the custom way after usual customize is performed. - //virtual bool afterCustomisePresentation(std::shared_ptr theResult, - // AISObjectPtr thePrs, - // GeomCustomPrsPtr theCustomPrs); - - /// Update the object presentable properties such as color, lines width and other - /// If the object is result with the color attribute value set, it is used, - /// otherwise the customize is applyed to the object's feature if it is a custom prs - /// \param theObject an object instance - /// \param theFlag a flag of level of customization, which means that only part of sub-elements - /// should be updated(e.g. only highlighted elements) - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \returns true if the object is modified - virtual bool customizeFeature(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag, + // virtual bool customisePresentation(std::shared_ptr + // theResult, + // AISObjectPtr thePrs, + // std::shared_ptr + // theCustomPrs); + + ///// Modifies the given presentation in the custom way after usual customize + /// is performed. + // virtual bool afterCustomisePresentation(std::shared_ptr + // theResult, + // AISObjectPtr thePrs, + // GeomCustomPrsPtr theCustomPrs); + + /// Update the object presentable properties such as color, lines width and + /// other If the object is result with the color attribute value set, it is + /// used, otherwise the customize is applyed to the object's feature if it is + /// a custom prs \param theObject an object instance \param theFlag a flag of + /// level of customization, which means that only part of sub-elements should + /// be updated(e.g. only highlighted elements) \param theUpdateViewer the + /// parameter whether the viewer should be update immediatelly \returns true + /// if the object is modified + virtual bool customizeFeature(ObjectPtr theObject, + const ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer); /// Disable displaying of custom mode @@ -318,9 +341,10 @@ public: /// Enables disabled custom mode virtual void enableCustomModes(); - /// This method is called on object browser creation for customisation of module specific features - /// \param theObjectBrowser a pinter on Object Browser widget - virtual void customizeObjectBrowser(QWidget* theObjectBrowser); + /// This method is called on object browser creation for customisation of + /// module specific features \param theObjectBrowser a pinter on Object + /// Browser widget + virtual void customizeObjectBrowser(QWidget *theObjectBrowser); /// Returns the viewer Z layer int getVisualLayerId() const { return myVisualLayerId; } @@ -328,15 +352,16 @@ public: /// Create specific for the module presentation /// \param theResult an object for presentation /// \return created presentation or NULL(default value) - virtual AISObjectPtr createPresentation(const ObjectPtr& theResult); + virtual AISObjectPtr createPresentation(const ObjectPtr &theResult); /// Customize presentation according to objects attributes /// \param theObject an object for presentation /// \param thePrs a presentation object - virtual void customizePresentation(const ObjectPtr& theObject, const AISObjectPtr& thePrs) const; + virtual void customizePresentation(const ObjectPtr &theObject, + const AISObjectPtr &thePrs) const; //! Returns data object by AIS - virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const; + virtual ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const; //! Returns true if the presentation can be shown in shading mode //! \param theAIS presentation to be checked @@ -345,62 +370,67 @@ public: /// Update state of pop-up menu items in viewer /// \param theStdActions - a map of standard actions - virtual void updateViewerMenu(const QMap& theStdActions); + virtual void updateViewerMenu(const QMap &theStdActions); /// Returns true if the action should be always enabled /// \param theActionId an action index: Accept or Accept All /// \return boolean value virtual bool isActionEnableStateFixed(const int theActionId) const; - //! Returns the feature error if the current state of the feature in the module is not correct - //! If the feature is correct, it returns an empty value + //! Returns the feature error if the current state of the feature in the + //! module is not correct If the feature is correct, it returns an empty value //! \return string value - virtual QString getFeatureError(const FeaturePtr& theFeature); + virtual QString getFeatureError(const FeaturePtr &theFeature); /// Returns list of granted operation indices - virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const; + virtual void grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const; - /// Validates the current operation and send the state change to sketch manager - /// \param thePreviousState the previous widget value state + /// Validates the current operation and send the state change to sketch + /// manager \param thePreviousState the previous widget value state virtual void widgetStateChanged(int thePreviousState); - /// Returns true if the event is processed. It gives the reentrance manager to process the enter. - /// \param thePreviousAttributeID an index of the previous active attribute - virtual bool processEnter(const std::string& thePreviousAttributeID); + /// Returns true if the event is processed. It gives the reentrance manager to + /// process the enter. \param thePreviousAttributeID an index of the previous + /// active attribute + virtual bool processEnter(const std::string &thePreviousAttributeID); /// Performs some GUI actions before an operation transaction is stopped /// Default realization is empty - virtual void beforeOperationStopped(ModuleBase_Operation* theOperation); + virtual void beforeOperationStopped(ModuleBase_Operation *theOperation); /// Finds a shape by attribute if it is possible /// \param theAttribute an attribute /// \return a geom shape - virtual GeomShapePtr findShape(const AttributePtr& theAttribute); + virtual GeomShapePtr findShape(const AttributePtr &theAttribute); /// Finds an attribute by geom shape if it is possible /// \param theObject an object of the attribute /// \param theGeomShape a geom shape /// \return theAttribute - virtual AttributePtr findAttribute(const ObjectPtr& theObject, const GeomShapePtr& theGeomShape); + virtual AttributePtr findAttribute(const ObjectPtr &theObject, + const GeomShapePtr &theGeomShape); /// Returns reentrant message if it was accepted virtual std::shared_ptr reentrantMessage(); /// Put current selection into reentrant message /// \param theMessage a message of reentrant operation - virtual void setReentrantPreSelection(const std::shared_ptr& theMessage); + virtual void + setReentrantPreSelection(const std::shared_ptr &theMessage); /// Returns root tree node which represents a data model - virtual ModuleBase_ITreeNode* rootNode() const; + virtual ModuleBase_ITreeNode *rootNode() const; /// Returns the workshop - XGUI_Workshop* getWorkshop() const; + XGUI_Workshop *getWorkshop() const; /// Reads description of features from XML file virtual void createFeatures(); /// add texture - static void setTexture(const AISObjectPtr& thePrs, const ResultPtr& theResult); + static void setTexture(const AISObjectPtr &thePrs, + const ResultPtr &theResult); public slots: /// Slolt called on object display @@ -427,79 +457,81 @@ protected slots: /// SLOT, that is called by key release in the viewer. /// \param theWnd a view window /// \param theEvent the key event - void onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); + void onKeyRelease(ModuleBase_IViewWindow *theWnd, QKeyEvent *theEvent); /// A slot called on view window creation - void onViewCreated(ModuleBase_IViewWindow*); + void onViewCreated(ModuleBase_IViewWindow *); - /// A slot to change property panel title by choice type change if the title information - /// exists in the XML definition of this control attribute - /// \param theWidget a sender - /// \param theIndex the current choice index - void onChoiceChanged(ModuleBase_ModelWidget* theWidget, int theIndex); + /// A slot to change property panel title by choice type change if the title + /// information exists in the XML definition of this control attribute \param + /// theWidget a sender \param theIndex the current choice index + void onChoiceChanged(ModuleBase_ModelWidget *theWidget, int theIndex); protected: /// Appends specific selection modes for the module to the list of types /// \param theModes a selection modes to be extended - virtual void customSubShapesSelectionModes(QIntList& theModes); + virtual void customSubShapesSelectionModes(QIntList &theModes); - /// Sets the constraints states in internal map. If the feature kind is a dimensional constraint - /// other dimensions are shown. - /// \param theFeatureKindId a feature kind - void storeConstraintsState(const std::string& theFeatureKindId); + /// Sets the constraints states in internal map. If the feature kind is a + /// dimensional constraint other dimensions are shown. \param theFeatureKindId + /// a feature kind + void storeConstraintsState(const std::string &theFeatureKindId); - /// If the feature kind is a geometrical or dimensional constraint, set visible state for - /// all types of constraints - /// \param theFeatureKindId a feature kind - void updateConstraintsState(const std::string& theFeatureKind); + /// If the feature kind is a geometrical or dimensional constraint, set + /// visible state for all types of constraints \param theFeatureKindId a + /// feature kind + void updateConstraintsState(const std::string &theFeatureKind); /// Register validators for this module virtual void registerValidators(); - /// Connects or disconnects to the value changed signal of the property panel widgets - /// \param theWidget a property contol widget - /// \param isToConnect a boolean value whether connect or disconnect - virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect); + /// Connects or disconnects to the value changed signal of the property panel + /// widgets \param theWidget a property contol widget \param isToConnect a + /// boolean value whether connect or disconnect + virtual void connectToPropertyPanel(ModuleBase_ModelWidget *theWidget, + const bool isToConnect); - /// Updates reentrant manager state or sketcher operations for the started operation - /// \param theOperation the started operation - void updateSketcherOnStart(ModuleBase_Operation* theOperation); + /// Updates reentrant manager state or sketcher operations for the started + /// operation \param theOperation the started operation + void updateSketcherOnStart(ModuleBase_Operation *theOperation); /// Updates presetnations of results and arguments by operation start /// \param theOperation the started operation - void updatePresentationsOnStart(ModuleBase_Operation* theOperation); + void updatePresentationsOnStart(ModuleBase_Operation *theOperation); - private slots: - void onTreeViewDoubleClick(const QModelIndex&); +private slots: + void onTreeViewDoubleClick(const QModelIndex &); - void onActiveDocPopup(const QPoint&); + void onActiveDocPopup(const QPoint &); - private: +private: //! Delete features virtual bool deleteObjects(); void setDefaultConstraintShown(); private: - bool myIsOperationIsLaunched; /// state of application between launch and stop operation - - PartSet_SketcherMgr* mySketchMgr; - PartSet_SketcherReentrantMgr* mySketchReentrantMgr; - PartSet_MenuMgr* myMenuMgr; - /// A default custom presentation, which is used for references objects of started operation - PartSet_CustomPrs* myCustomPrs; - PartSet_OverconstraintListener* myOverconstraintListener; + bool myIsOperationIsLaunched; /// state of application between launch and stop + /// operation + + PartSet_SketcherMgr *mySketchMgr; + PartSet_SketcherReentrantMgr *mySketchReentrantMgr; + PartSet_MenuMgr *myMenuMgr; + /// A default custom presentation, which is used for references objects of + /// started operation + PartSet_CustomPrs *myCustomPrs; + PartSet_OverconstraintListener *myOverconstraintListener; int myVisualLayerId; /// backup of the visible state to restore them by operation stop QMap myHasConstraintShown; - /// backup of selection in the viewer, it is used only to store selection before - /// redisplay and restore it after + /// backup of selection in the viewer, it is used only to store selection + /// before redisplay and restore it after PartSet_SketcherMgr::FeatureToSelectionMap myCurrentSelection; QModelIndex myActivePartIndex; - PartSet_RootNode* myRoot; + PartSet_RootNode *myRoot; }; #endif diff --git a/src/PartSet/PartSet_MouseProcessor.h b/src/PartSet/PartSet_MouseProcessor.h index 54f809e8d..0e178e118 100644 --- a/src/PartSet/PartSet_MouseProcessor.h +++ b/src/PartSet/PartSet_MouseProcessor.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_MouseProcessor_H @@ -25,7 +26,7 @@ #include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif class ModuleBase_IViewWindow; @@ -33,37 +34,36 @@ class ModuleBase_ViewerPrs; class QMouseEvent; /** - * This is an interface to allow processing of mouse events. Implementation of necessary methods -* should be done in a child. -*/ -class PartSet_MouseProcessor -{ + * This is an interface to allow processing of mouse events. Implementation of + * necessary methods should be done in a child. + */ +class PartSet_MouseProcessor { public: /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) {} /// Processing the mouse press event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) {} /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) {} /// Processing the mouse double click event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void + mouseDoubleClick(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) {} /// Fill preselection used in mouseReleased - virtual void setPreSelection(const std::shared_ptr& thePreSelected, - ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent) {} + virtual void + setPreSelection(const std::shared_ptr &thePreSelected, + ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent) {} }; #endif diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index c6728d5c9..674958a1a 100644 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -14,35 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_OperationPrs.h" #include "PartSet_Tools.h" -#include "XGUI_Workshop.h" -#include "XGUI_ModuleConnector.h" #include "XGUI_Displayer.h" +#include "XGUI_ModuleConnector.h" #include "XGUI_Tools.h" +#include "XGUI_Workshop.h" -#include "ModuleBase_Tools.h" #include "ModuleBase_IModule.h" +#include "ModuleBase_Tools.h" #include #include #include -#include -#include #include #include +#include #include #include #include -#include -#include -#include +#include +#include #include +#include #include +#include #include #include @@ -53,12 +54,12 @@ #include -#include -#include #include #include -#include #include +#include +#include +#include //#define DEBUG_EMPTY_SHAPE //#define DEBUG_OPERATION_PRS @@ -72,49 +73,45 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape); -PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop) -: ViewerData_AISShape(TopoDS_Shape()), myWorkshop(theWorkshop), myUseAISWidth(false) -{ +PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop *theWorkshop) + : ViewerData_AISShape(TopoDS_Shape()), myWorkshop(theWorkshop), + myUseAISWidth(false) { #ifdef DEBUG_OPERATION_PRS qDebug("PartSet_OperationPrs::PartSet_OperationPrs"); #endif myShapeColor = Quantity_Color(1, 1, 1, Quantity_TOC_RGB); - // first presentation for having correct Compute until presentation with shapes are set + // first presentation for having correct Compute until presentation with + // shapes are set gp_Pnt aPnt(0.0, 0.0, 0.0); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); myShapeToPrsMap.Bind(aVertex, NULL); Handle(Prs3d_Drawer) aDrawer = Attributes(); - Handle(Prs3d_IsoAspect) aUIsoAspect = new Prs3d_IsoAspect(myShapeColor, Aspect_TOL_SOLID, 1, 0); - Handle(Prs3d_IsoAspect) aVIsoAspect = new Prs3d_IsoAspect(myShapeColor, Aspect_TOL_SOLID, 1, 0); + Handle(Prs3d_IsoAspect) aUIsoAspect = + new Prs3d_IsoAspect(myShapeColor, Aspect_TOL_SOLID, 1, 0); + Handle(Prs3d_IsoAspect) aVIsoAspect = + new Prs3d_IsoAspect(myShapeColor, Aspect_TOL_SOLID, 1, 0); aDrawer->SetUIsoAspect(aUIsoAspect); aDrawer->SetVIsoAspect(aVIsoAspect); aDrawer->SetIsoOnPlane(false); - //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); + // aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); } -bool PartSet_OperationPrs::hasShapes() -{ - return !myShapeToPrsMap.IsEmpty(); -} +bool PartSet_OperationPrs::hasShapes() { return !myShapeToPrsMap.IsEmpty(); } -void PartSet_OperationPrs::setShapeColor(const Quantity_Color& theColor) -{ +void PartSet_OperationPrs::setShapeColor(const Quantity_Color &theColor) { myShapeColor = theColor; } -void PartSet_OperationPrs::useAISWidth() -{ - myUseAISWidth = true; -} +void PartSet_OperationPrs::useAISWidth() { myUseAISWidth = true; } -void PartSet_OperationPrs::Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) -{ +void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d) & + thePresentationManager, + const Handle(Prs3d_Presentation) & + thePresentation, + const Standard_Integer theMode) { #ifdef DEBUG_OPERATION_PRS qDebug("PartSet_OperationPrs::Compute -- begin"); #endif @@ -128,15 +125,19 @@ void PartSet_OperationPrs::Compute( BRep_Builder aBuilder; TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); - for(NCollection_DataMap::Iterator - anIter(myShapeToPrsMap); anIter.More(); anIter.Next()) { - const TopoDS_Shape& aShape = anIter.Key(); + for (NCollection_DataMap::Iterator + anIter(myShapeToPrsMap); + anIter.More(); anIter.Next()) { + const TopoDS_Shape &aShape = anIter.Key(); aBuilder.Add(aComp, aShape); // change deviation coefficient to provide more precise circle - // as there is no result, the shape is processed to correct deviation. To be unified + // as there is no result, the shape is processed to correct deviation. To be + // unified ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer); - //This presentation is not used for selection, so it don't need highlighting - //ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, DynamicHilightAttributes()); + // This presentation is not used for selection, so it don't need + // highlighting ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, + // DynamicHilightAttributes()); if (myUseAISWidth) { Handle(AIS_InteractiveObject) anIO = anIter.Value(); @@ -144,24 +145,25 @@ void PartSet_OperationPrs::Compute( int aWidth = anIO->Width(); /// workaround for zero width. Else, there will be a crash if (aWidth == 0) { // width returns of TSolid shape is zero - aWidth = PartSet_Tools::getAISDefaultWidth();// default width value + aWidth = PartSet_Tools::getAISDefaultWidth(); // default width value } setWidth(aDrawer, aWidth); } } try { StdPrs_WFShape::Add(thePresentation, aShape, aDrawer); - } - catch (...) { + } catch (...) { return; } } Set(aComp); if (!aReadyToDisplay) { Events_InfoMessage("PartSet_OperationPrs", - "An empty AIS presentation: PartSet_OperationPrs").send(); - std::shared_ptr aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION))); + "An empty AIS presentation: PartSet_OperationPrs") + .send(); + std::shared_ptr aMsg = + std::shared_ptr(new Events_Message( + Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION))); Events_Loop::loop()->send(aMsg); } #ifdef DEBUG_OPERATION_PRS @@ -169,43 +171,44 @@ void PartSet_OperationPrs::Compute( #endif } -void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) -{ +void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer aMode) { // the presentation is not used in the selection } -NCollection_DataMap& PartSet_OperationPrs::shapesMap() -{ +NCollection_DataMap & +PartSet_OperationPrs::shapesMap() { return myShapeToPrsMap; } -bool isSubObject(const ObjectPtr& theObject, const FeaturePtr& theFeature) -{ +bool isSubObject(const ObjectPtr &theObject, const FeaturePtr &theFeature) { bool isSub = false; - CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(theFeature); + CompositeFeaturePtr aComposite = + std::dynamic_pointer_cast(theFeature); if (aComposite.get()) isSub = aComposite->isSub(theObject); return isSub; } -void PartSet_OperationPrs::addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape, - const FeaturePtr& theFeature, ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes) -{ +void PartSet_OperationPrs::addValue( + const ObjectPtr &theObject, const GeomShapePtr &theShape, + const FeaturePtr &theFeature, ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes) { if (theObject.get()) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { ResultBodyPtr aBodyResult = - std::dynamic_pointer_cast(theObject); + std::dynamic_pointer_cast(theObject); if (aBodyResult.get()) { if (aBodyResult->numberOfSubs() > 0) { - for(int i = 0; i < aBodyResult->numberOfSubs(); i++) { + for (int i = 0; i < aBodyResult->numberOfSubs(); i++) { ResultPtr aSubResult = aBodyResult->subResult(i); if (aSubResult.get()) { GeomShapePtr aShape; - addValue(aSubResult, aShape, theFeature, theWorkshop, theObjectShapes); + addValue(aSubResult, aShape, theFeature, theWorkshop, + theObjectShapes); } } return; @@ -216,7 +219,7 @@ void PartSet_OperationPrs::addValue(const ObjectPtr& theObject, const GeomShapeP FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get()) { AttributeBooleanPtr aCopyAttr = - aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); + aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (aCopyAttr.get()) { bool isCopy = aCopyAttr->value(); if (isCopy) @@ -238,11 +241,10 @@ void PartSet_OperationPrs::addValue(const ObjectPtr& theObject, const GeomShapeP } } -void PartSet_OperationPrs::appendShapeIfVisible(ModuleBase_IWorkshop* theWorkshop, - const ObjectPtr& theObject, - GeomShapePtr theGeomShape, - QMap >& theObjectShapes) -{ +void PartSet_OperationPrs::appendShapeIfVisible( + ModuleBase_IWorkshop *theWorkshop, const ObjectPtr &theObject, + GeomShapePtr theGeomShape, + QMap> &theObjectShapes) { if (theGeomShape.get()) { if (theObjectShapes.contains(theObject)) theObjectShapes[theObject].append(theGeomShape); @@ -254,24 +256,27 @@ void PartSet_OperationPrs::appendShapeIfVisible(ModuleBase_IWorkshop* theWorksho } else { #ifdef DEBUG_EMPTY_SHAPE qDebug(QString("Empty shape in result, result: %1") - .arg(ModuleBase_Tools::objectInfo(theObject)).toStdString().c_str()); + .arg(ModuleBase_Tools::objectInfo(theObject)) + .toStdString() + .c_str()); #endif } } -void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes) -{ +void PartSet_OperationPrs::getFeatureShapes( + const FeaturePtr &theFeature, ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes) { theObjectShapes.clear(); if (!theFeature.get()) return; - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); QList aShapes; std::list anAttributes = theFeature->data()->attributes(""); - std::list::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end(); + std::list::const_iterator anIt = anAttributes.begin(), + aLast = anAttributes.end(); for (; anIt != aLast; anIt++) { AttributePtr anAttribute = *anIt; if (!isSelectionAttribute(anAttribute)) @@ -284,9 +289,11 @@ void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, if (anAttrType == ModelAPI_AttributeSelectionList::typeId()) { std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(anAttribute); - for(int i = 0; i < aCurSelList->size(); i++) { - std::shared_ptr aSelAttribute = aCurSelList->value(i); + std::dynamic_pointer_cast( + anAttribute); + for (int i = 0; i < aCurSelList->size(); i++) { + std::shared_ptr aSelAttribute = + aCurSelList->value(i); ResultPtr aResult = aSelAttribute->context(); GeomShapePtr aShape = aSelAttribute->value(); addValue(aResult, aShape, theFeature, theWorkshop, theObjectShapes); @@ -294,38 +301,40 @@ void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, } if (anAttrType == ModelAPI_AttributeRefList::typeId()) { std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); for (int i = 0; i < aCurSelList->size(); i++) { ObjectPtr anObject = aCurSelList->object(i); - FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); - // if a feature is stored in the attribute, we should obtain the feature results - // e.g. feature rectangle uses parameters feature lines in the attribute + FeaturePtr aFeature = + std::dynamic_pointer_cast(anObject); + // if a feature is stored in the attribute, we should obtain the feature + // results e.g. feature rectangle uses parameters feature lines in the + // attribute if (aFeature.get()) { getResultShapes(aFeature, theWorkshop, theObjectShapes, false); - } - else { - ResultPtr aResult = std::dynamic_pointer_cast(anObject); + } else { + ResultPtr aResult = + std::dynamic_pointer_cast(anObject); if (aResult.get()) { GeomShapePtr aShape = aResult->shape(); if (aShape.get()) - addValue(aResult, aShape, theFeature, theWorkshop, theObjectShapes); + addValue(aResult, aShape, theFeature, theWorkshop, + theObjectShapes); } } } - } - else { + } else { ObjectPtr anObject; GeomShapePtr aShape; if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); if (aRefAttr->isObject()) { anObject = aRefAttr->object(); - } - else { + } else { AttributePtr anAttr = aRefAttr->attr(); aShape = PartSet_Tools::findShapeBy2DPoint(anAttr, theWorkshop); - // the distance point is not found if the point is selected in the 2nd time + // the distance point is not found if the point is selected in the 2nd + // time // TODO: after debug, this check can be removed if (!aShape.get()) continue; @@ -334,13 +343,13 @@ void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, } if (anAttrType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); anObject = anAttr->context(); aShape = anAttr->value(); } if (anAttrType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); anObject = anAttr->value(); } addValue(anObject, aShape, theFeature, theWorkshop, theObjectShapes); @@ -348,11 +357,10 @@ void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, } } -void PartSet_OperationPrs::getResultShapes(const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes, - const bool theListShouldBeCleared) -{ +void PartSet_OperationPrs::getResultShapes( + const FeaturePtr &theFeature, ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes, + const bool theListShouldBeCleared) { if (theListShouldBeCleared) theObjectShapes.clear(); @@ -372,20 +380,21 @@ void PartSet_OperationPrs::getResultShapes(const FeaturePtr& theFeature, } } -void PartSet_OperationPrs::getPresentationShapes(const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes, - const bool theListShouldBeCleared) -{ +void PartSet_OperationPrs::getPresentationShapes( + const FeaturePtr &theFeature, ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes, + const bool theListShouldBeCleared) { if (theListShouldBeCleared) theObjectShapes.clear(); - if (!theFeature.get() || !theFeature->data()->isValid()) // if feature is already removed + if (!theFeature.get() || + !theFeature->data()->isValid()) // if feature is already removed return; - XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); + XGUI_Displayer *aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theFeature); + GeomPresentablePtr aPrs = + std::dynamic_pointer_cast(theFeature); if (!aPrs.get()) return; @@ -393,7 +402,8 @@ void PartSet_OperationPrs::getPresentationShapes(const FeaturePtr& theFeature, if (!anAIS.get()) return; - Handle(AIS_InteractiveObject) anAISPrs = anAIS->impl(); + Handle(AIS_InteractiveObject) anAISPrs = + anAIS->impl(); if (!anAISPrs.IsNull()) { Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISPrs); if (!aShapePrs.IsNull()) { @@ -401,26 +411,27 @@ void PartSet_OperationPrs::getPresentationShapes(const FeaturePtr& theFeature, if (!aShape.IsNull()) { std::shared_ptr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(aShape)); - appendShapeIfVisible(theWorkshop, theFeature, aGeomShape, theObjectShapes); + appendShapeIfVisible(theWorkshop, theFeature, aGeomShape, + theObjectShapes); } } } } -void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes) -{ +void PartSet_OperationPrs::getHighlightedShapes( + ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes) { theObjectShapes.clear(); QList aValues; - ModuleBase_ModelWidget* anActiveWidget = theWorkshop->module()->activeWidget(); + ModuleBase_ModelWidget *anActiveWidget = + theWorkshop->module()->activeWidget(); if (anActiveWidget) anActiveWidget->getHighlighted(aValues); QList aShapes; QList::const_iterator anIIt = aValues.begin(), - aILast = aValues.end(); + aILast = aValues.end(); for (; anIIt != aILast; anIIt++) { ModuleBase_ViewerPrsPtr aPrs = *anIIt; ObjectPtr anObject = aPrs->object(); @@ -436,9 +447,8 @@ void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorksho } } - -bool PartSet_OperationPrs::isSelectionAttribute(const AttributePtr& theAttribute) -{ +bool PartSet_OperationPrs::isSelectionAttribute( + const AttributePtr &theAttribute) { std::string anAttrType = theAttribute->attributeType(); return anAttrType == ModelAPI_AttributeSelectionList::typeId() || @@ -449,29 +459,32 @@ bool PartSet_OperationPrs::isSelectionAttribute(const AttributePtr& theAttribute } void PartSet_OperationPrs::fillShapeList( - const QMap >& theFeatureShapes, - ModuleBase_IWorkshop* theWorkshop, - NCollection_DataMap& theShapeToPrsMap) -{ + const QMap> &theFeatureShapes, + ModuleBase_IWorkshop *theWorkshop, + NCollection_DataMap + &theShapeToPrsMap) { theShapeToPrsMap.Clear(); - XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); + XGUI_Displayer *aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); // create presentations on the base of the shapes - QMap >::const_iterator anIt = theFeatureShapes.begin(), - aLast = theFeatureShapes.end(); + QMap>::const_iterator + anIt = theFeatureShapes.begin(), + aLast = theFeatureShapes.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = anIt.key(); QList aShapes = anIt.value(); - QList::const_iterator aShIt = aShapes.begin(), aShLast = aShapes.end(); + QList::const_iterator aShIt = aShapes.begin(), + aShLast = aShapes.end(); for (; aShIt != aShLast; aShIt++) { GeomShapePtr aGeomShape = *aShIt; - // the shape should not be checked here on empty value because it should be checked in - // appendShapeIfVisible() on the step of filling theFeatureShapes list - // the reason is to avoid empty AIS object visualized in the viewer - //if (!aGeomShape.get()) continue; - TopoDS_Shape aShape = aGeomShape.get() ? aGeomShape->impl() : TopoDS_Shape(); + // the shape should not be checked here on empty value because it should + // be checked in appendShapeIfVisible() on the step of filling + // theFeatureShapes list the reason is to avoid empty AIS object + // visualized in the viewer + // if (!aGeomShape.get()) continue; + TopoDS_Shape aShape = + aGeomShape.get() ? aGeomShape->impl() : TopoDS_Shape(); if (aShape.IsNull()) continue; diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h index b702e25ba..7a6c782d3 100644 --- a/src/PartSet/PartSet_OperationPrs.h +++ b/src/PartSet/PartSet_OperationPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_OperationPrs_H @@ -22,26 +23,26 @@ #include "PartSet.h" -#include +#include #include +#include #include -#include #include #include -#include #include +#include -#include -#include +#include #include +#include +#include #include -#include -#include #include +#include #include @@ -51,45 +52,48 @@ class XGUI_Displayer; class SelectMgr_Selection; /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide colored presentation of -* a list of shapes. It contains a shapes where the parameter feature refers. It processes the following -* types of attributes: ModelAPI_AttributeSelectionList, ModelAPI_AttributeRefAttr, -* ModelAPI_AttributeSelection and ModelAPI_AttributeReference. -* The selection for this presentation is absent. -*/ -class PartSet_OperationPrs : public ViewerData_AISShape -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide colored + * presentation of a list of shapes. It contains a shapes where the parameter + * feature refers. It processes the following types of attributes: + * ModelAPI_AttributeSelectionList, ModelAPI_AttributeRefAttr, + * ModelAPI_AttributeSelection and ModelAPI_AttributeReference. + * The selection for this presentation is absent. + */ +class PartSet_OperationPrs : public ViewerData_AISShape { public: /// Constructor - Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop); + Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop *theWorkshop); /// Returns true if the feature contains shapes or results bool hasShapes(); /// Sets the colors for the presentation compute /// \param theColor an argument shapes color - void setShapeColor(const Quantity_Color& theColor); + void setShapeColor(const Quantity_Color &theColor); - /// Switch on using of the AIS presentation with of the shape object increased on the delta + /// Switch on using of the AIS presentation with of the shape object increased + /// on the delta void useAISWidth(); DEFINE_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) ; + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer aMode); protected: /// list of visualized shapes /// \return a map of shapes - NCollection_DataMap& shapesMap(); + NCollection_DataMap &shapesMap(); private: /// Fills the map by the feature object and shapes, which should be visuaziled @@ -98,9 +102,10 @@ private: /// \param theWorkshop a current workshop /// \param theObjectShapes an output map /// \param theObjectShape an output map of objects - static void getFeatureShapes(const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes); + static void + getFeatureShapes(const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes); /// Fills the map by the feature object and shapes, which should be visuaziled /// Gets feature attributes, collect objects to whom the attributes refer @@ -108,74 +113,78 @@ private: /// \param theWorkshop a current workshop /// \param theObjectShapes an output map /// \param theObjectShape an output map of objects - static void getResultShapes(const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes, - const bool theListShouldBeCleared = true); + static void + getResultShapes(const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes, + const bool theListShouldBeCleared = true); /// Fills the map by the feature presentation if the feature is presentable /// \param theFeature a current feature /// \param theWorkshop a current workshop /// \param theObjectShapes an output map /// \param theObjectShape an output map of objects - static void getPresentationShapes(const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes, - const bool theListShouldBeCleared = true); + static void + getPresentationShapes(const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes, + const bool theListShouldBeCleared = true); /// Fills the map by the feature object and shapes, which should be visuaziled - /// Gets the active widget, obtain the highlighted presentations if it has such and - /// fill map by object and shapes - /// \param theWorkshop a current workshop - /// \param theObjectShapes an output map of objects - static void getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes); + /// Gets the active widget, obtain the highlighted presentations if it has + /// such and fill map by object and shapes \param theWorkshop a current + /// workshop \param theObjectShapes an output map of objects + static void + getHighlightedShapes(ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes); /// Returns true if the attribute type belong to reference attribute /// \param theAttribute an attribute /// \return a boolean value - static bool isSelectionAttribute(const AttributePtr& theAttribute); + static bool isSelectionAttribute(const AttributePtr &theAttribute); - /// Appends the shape for the result into the container if the result is visible and - /// the shape is not null. - /// \param theWorkshop a current workshop + /// Appends the shape for the result into the container if the result is + /// visible and the shape is not null. \param theWorkshop a current workshop /// \param theResult an object to be appended /// \param theGeomShape a shape to be appended /// \param theObjectShapes a filled container - static void addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape, - const FeaturePtr& theFeature, ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes); + static void addValue(const ObjectPtr &theObject, const GeomShapePtr &theShape, + const FeaturePtr &theFeature, + ModuleBase_IWorkshop *theWorkshop, + QMap> &theObjectShapes); - /// Appends the shape for the result into the container if the result is visible and - /// the shape is not null. - /// \param theWorkshop a current workshop + /// Appends the shape for the result into the container if the result is + /// visible and the shape is not null. \param theWorkshop a current workshop /// \param theObject an object to be appended /// \param theGeomShape a shape to be appended /// \param theObjectShapes a filled container - static void appendShapeIfVisible(ModuleBase_IWorkshop* theWorkshop, - const ObjectPtr& theObject, - GeomShapePtr theGeomShape, - QMap >& theObjectShapes); + static void + appendShapeIfVisible(ModuleBase_IWorkshop *theWorkshop, + const ObjectPtr &theObject, GeomShapePtr theGeomShape, + QMap> &theObjectShapes); /// Fills the list of shapes by map of model objects /// \param theFeatureShape a container to find shapes /// \param theShapesMap an out container - static void fillShapeList(const QMap >& theFeatureShapes, - ModuleBase_IWorkshop* theWorkshop, - NCollection_DataMap& theShapeToPrsMap); + static void + fillShapeList(const QMap> &theFeatureShapes, + ModuleBase_IWorkshop *theWorkshop, + NCollection_DataMap + &theShapeToPrsMap); private: /// list of visualized shapes - NCollection_DataMap myShapeToPrsMap; + NCollection_DataMap + myShapeToPrsMap; - ModuleBase_IWorkshop* myWorkshop; /// current workshop - Quantity_Color myShapeColor; /// color of feature depended shapes + ModuleBase_IWorkshop *myWorkshop; /// current workshop + Quantity_Color myShapeColor; /// color of feature depended shapes - /// flag if the width of a shape object should be used for the shape visualization + /// flag if the width of a shape object should be used for the shape + /// visualization bool myUseAISWidth; friend class PartSet_CustomPrs; }; - -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index 30cfcaeda..36ad3602a 100644 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include // Attention: keep the next include here, // otherwise it causes compilation errors at least on Debian 8 @@ -35,20 +36,20 @@ #include "XGUI_Tools.h" #include "XGUI_Workshop.h" -#include "SketcherPrs_SymbolPrs.h" -#include "SketchPlugin_SketchEntity.h" -#include "SketchPlugin_MacroArcReentrantMessage.h" -#include "SketchPlugin_Sketch.h" #include "SketchPlugin_ConstraintHorizontal.h" #include "SketchPlugin_ConstraintVertical.h" +#include "SketchPlugin_MacroArcReentrantMessage.h" +#include "SketchPlugin_Sketch.h" +#include "SketchPlugin_SketchEntity.h" +#include "SketcherPrs_SymbolPrs.h" #include #include "Events_Loop.h" #include -#include #include +#include #include #include @@ -56,85 +57,97 @@ //#define DEBUG_FEATURE_OVERCONSTRAINT_LISTENER -PartSet_OverconstraintListener::PartSet_OverconstraintListener(ModuleBase_IWorkshop* theWorkshop) -: myWorkshop(theWorkshop), myIsActive(false), myIsFullyConstrained(false) -{ - Events_Loop* aLoop = Events_Loop::loop(); +PartSet_OverconstraintListener::PartSet_OverconstraintListener( + ModuleBase_IWorkshop *theWorkshop) + : myWorkshop(theWorkshop), myIsActive(false), myIsFullyConstrained(false) { + Events_Loop *aLoop = Events_Loop::loop(); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SOLVER_FAILED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SKETCH_UNDER_CONSTRAINED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SKETCH_FULLY_CONSTRAINED)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_SKETCH_UNDER_CONSTRAINED)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_SKETCH_FULLY_CONSTRAINED)); aLoop->registerListener(this, ModelAPI_EventReentrantMessage::eventId()); - aLoop->registerListener(this, SketchPlugin_MacroArcReentrantMessage::eventId()); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS)); + aLoop->registerListener(this, + SketchPlugin_MacroArcReentrantMessage::eventId()); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS)); } -void PartSet_OverconstraintListener::setActive(const bool& theActive) -{ +void PartSet_OverconstraintListener::setActive(const bool &theActive) { if (myIsActive == theActive) return; myIsActive = theActive; - myIsFullyConstrained = false; /// returned to default state, no custom color for it + myIsFullyConstrained = + false; /// returned to default state, no custom color for it if (myIsActive) { - PartSet_Module* aModule = module(); + PartSet_Module *aModule = module(); CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch(); if (aSketch.get()) { - QString aDOFMessage(aSketch->string(SketchPlugin_Sketch::SOLVER_DOF())->value().c_str()); + QString aDOFMessage( + aSketch->string(SketchPlugin_Sketch::SOLVER_DOF())->value().c_str()); if (aDOFMessage.contains('=')) { // to support old data aDOFMessage = - aDOFMessage.right(aDOFMessage.length() - aDOFMessage.lastIndexOf('=')).trimmed(); + aDOFMessage + .right(aDOFMessage.length() - aDOFMessage.lastIndexOf('=')) + .trimmed(); } myIsFullyConstrained = (aDOFMessage == "0"); } } } -void PartSet_OverconstraintListener::getCustomColor(const ObjectPtr& theObject, - std::vector& theColor) -{ +void PartSet_OverconstraintListener::getCustomColor( + const ObjectPtr &theObject, std::vector &theColor) { if (!myIsActive) return; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (myConflictingObjects.find(theObject) != myConflictingObjects.end()) { - theColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color"); + theColor = Config_PropManager::color("Visualization", + "sketch_overconstraint_color"); } if (myIsFullyConstrained) { // only entity features has custom color when sketch is fully constrained if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind()) && !PartSet_SketcherMgr::isExternalFeature(aFeature)) { - PartSet_Module* aModule = module(); + PartSet_Module *aModule = module(); CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch(); - // the given object is sub feature of the current sketch(created or edited) + // the given object is sub feature of the current sketch(created or + // edited) if (ModelAPI_Tools::compositeOwner(aFeature) == aSketch) - theColor = Config_PropManager::color("Visualization", "sketch_fully_constrained_color"); + theColor = Config_PropManager::color("Visualization", + "sketch_fully_constrained_color"); } } } -void PartSet_OverconstraintListener::processEvent(const std::shared_ptr& theMessage) -{ - // #2271 open document: if sketch has confilcting elements, solver sends message with the - // elements by opening the document. Sketch is not active, but an internal container should - // be updated. So, we should not check whether the listener is active here - //if (!myIsActive) +void PartSet_OverconstraintListener::processEvent( + const std::shared_ptr &theMessage) { + // #2271 open document: if sketch has confilcting elements, solver sends + // message with the elements by opening the document. Sketch is not active, + // but an internal container should be updated. So, we should not check + // whether the listener is active here + // if (!myIsActive) // return; #ifdef DEBUG_FEATURE_OVERCONSTRAINT_LISTENER - bool isRepaired = theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED); + bool isRepaired = + theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED); int aCount = 0; std::shared_ptr anErrorMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); QString anInfoStr; if (anErrorMsg.get()) { - const std::set& aConflictingObjects = anErrorMsg->objects(); + const std::set &aConflictingObjects = anErrorMsg->objects(); aCount = aConflictingObjects.size(); anInfoStr = getObjectsInfo(aConflictingObjects); } @@ -144,31 +157,38 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptreventID(); if (anEventID == Events_Loop::eventByName(EVENT_SOLVER_FAILED) || anEventID == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)) { std::shared_ptr anErrorMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (anErrorMsg.get()) { - const std::set& aConflictingObjects = anErrorMsg->objects(); + const std::set &aConflictingObjects = anErrorMsg->objects(); if (anEventID == Events_Loop::eventByName(EVENT_SOLVER_FAILED)) appendConflictingObjects(aConflictingObjects); else repairConflictingObjects(aConflictingObjects); } - } - else if (anEventID == Events_Loop::eventByName(EVENT_SKETCH_UNDER_CONSTRAINED) || - anEventID == Events_Loop::eventByName(EVENT_SKETCH_FULLY_CONSTRAINED)) { + } else if (anEventID == + Events_Loop::eventByName(EVENT_SKETCH_UNDER_CONSTRAINED) || + anEventID == + Events_Loop::eventByName(EVENT_SKETCH_FULLY_CONSTRAINED)) { bool aPrevFullyConstrained = myIsFullyConstrained; - myIsFullyConstrained = anEventID == Events_Loop::eventByName(EVENT_SKETCH_FULLY_CONSTRAINED); + myIsFullyConstrained = + anEventID == Events_Loop::eventByName(EVENT_SKETCH_FULLY_CONSTRAINED); if (aPrevFullyConstrained != myIsFullyConstrained) { std::set aModifiedObjects; - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch(); // check the sketch in the message and the active sketch are the same @@ -186,7 +206,8 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptrnumberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { FeaturePtr aFeature = aSketch->subFeature(i); - aModifiedObjects.insert(aFeature); // is necessary to redisplay presentations + aModifiedObjects.insert( + aFeature); // is necessary to redisplay presentations std::list aResults = aFeature->results(); for (std::list::const_iterator aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { @@ -196,21 +217,22 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptroperationMgr()->currentOperation(); + ModuleBase_Operation *anOperation = + XGUI_Tools::workshop(myWorkshop)->operationMgr()->currentOperation(); if (anOperation) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(anOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); // data valid is necessary if the feature has been already deleted @@ -220,36 +242,40 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptrsender()) { - ModelAPI_Object* aSender = static_cast(theMessage->sender()); + ModelAPI_Object *aSender = + static_cast(theMessage->sender()); if (aSender) { - FeaturePtr aFeatureSender = - std::dynamic_pointer_cast(aSender->data()->owner()); - if (aFeatureSender.get() && aFeatureSender->data()->name() == aCurrentFeatureName) { - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); - PartSet_SketcherReentrantMgr* aReentrantMgr = aModule->sketchReentranceMgr(); + FeaturePtr aFeatureSender = std::dynamic_pointer_cast( + aSender->data()->owner()); + if (aFeatureSender.get() && + aFeatureSender->data()->name() == aCurrentFeatureName) { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); + PartSet_SketcherReentrantMgr *aReentrantMgr = + aModule->sketchReentranceMgr(); aReentrantMgr->setReentrantMessage(theMessage); } } } - } - else if (anEventID == Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS)) { + } else if (anEventID == Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS)) { std::shared_ptr aConstraintsMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aConstraintsMsg.get()) { myObjectsToRemove = aConstraintsMsg->constraints(); std::set::const_iterator anIt = myObjectsToRemove.begin(); - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); - for (; anIt != myObjectsToRemove.end(); ) - { + for (; anIt != myObjectsToRemove.end();) { ObjectPtr anObject = *anIt; - FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(anObject); std::string aType = aFeature->getKind(); if ((aType == SketchPlugin_ConstraintHorizontal::ID() || aType == SketchPlugin_ConstraintVertical::ID()) && - !aModule->sketchReentranceMgr()->isLastAutoConstraint(*anIt)) + !aModule->sketchReentranceMgr()->isLastAutoConstraint(*anIt)) anIt = myObjectsToRemove.erase(anIt); else anIt++; @@ -264,30 +290,33 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptr& theConflictingObjects) -{ - bool isAllowToChange = ModuleBase_Preferences::resourceMgr()->booleanValue(SKETCH_TAB_NAME, - "allow_change_constraint"); + const std::set &theConflictingObjects) { + bool isAllowToChange = ModuleBase_Preferences::resourceMgr()->booleanValue( + SKETCH_TAB_NAME, "allow_change_constraint"); if (isAllowToChange) { std::set aModifiedObjects; - // set error state for new objects and append them in the internal map of objects - std::set::const_iterator - anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end(); + // set error state for new objects and append them in the internal map of + // objects + std::set::const_iterator anIt = theConflictingObjects.begin(), + aLast = theConflictingObjects.end(); int aCountOfSimilarConstraints = 0; for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; - if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found + if (myConflictingObjects.find(anObject) == + myConflictingObjects.end()) { // it is not found aModifiedObjects.insert(anObject); myConflictingObjects.insert(anObject); - } - else + } else ++aCountOfSimilarConstraints; } @@ -295,9 +324,9 @@ bool PartSet_OverconstraintListener::appendConflictingObjects( return false; std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_CheckConstraintsMessage( - Events_Loop::eventByName(EVENT_CHECK_CONSTRAINTS))); + std::shared_ptr( + new ModelAPI_CheckConstraintsMessage( + Events_Loop::eventByName(EVENT_CHECK_CONSTRAINTS))); aMessage->setConstraints(theConflictingObjects); Events_Loop::loop()->send(aMessage); @@ -305,21 +334,21 @@ bool PartSet_OverconstraintListener::appendConflictingObjects( if (isUpdated) redisplayObjects(aModifiedObjects); return isUpdated; - } - else + } else return false; } bool PartSet_OverconstraintListener::repairConflictingObjects( - const std::set& theConflictingObjects) -{ + const std::set &theConflictingObjects) { std::set aModifiedObjects; // erase error state of absent current objects in the parameter list std::set::const_iterator anIt, aLast; - for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end(); + for (anIt = theConflictingObjects.begin(), + aLast = theConflictingObjects.end(); anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; - if (theConflictingObjects.find(anObject) != theConflictingObjects.end()) { // it is found + if (theConflictingObjects.find(anObject) != + theConflictingObjects.end()) { // it is found myConflictingObjects.erase(anObject); aModifiedObjects.insert(anObject); } @@ -332,15 +361,15 @@ bool PartSet_OverconstraintListener::repairConflictingObjects( } void PartSet_OverconstraintListener::redisplayObjects( - const std::set& theObjects) -{ - static Events_Loop* aLoop = Events_Loop::loop(); + const std::set &theObjects) { + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_VISUAL_ATTRIBUTES); static Events_ID EVENT_REDISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); - std::set::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); + std::set::const_iterator anIt = theObjects.begin(), + aLast = theObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr aObj = *anIt; aECreator->sendUpdated(aObj, EVENT_DISP); @@ -350,14 +379,13 @@ void PartSet_OverconstraintListener::redisplayObjects( aLoop->flush(EVENT_REDISP); } -PartSet_Module* PartSet_OverconstraintListener::module() const -{ - return dynamic_cast(myWorkshop->module()); +PartSet_Module *PartSet_OverconstraintListener::module() const { + return dynamic_cast(myWorkshop->module()); } #ifdef _DEBUG -QString PartSet_OverconstraintListener::getObjectsInfo(const std::set& theObjects) -{ +QString PartSet_OverconstraintListener::getObjectsInfo( + const std::set &theObjects) { std::set::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); QStringList anInfo; diff --git a/src/PartSet/PartSet_OverconstraintListener.h b/src/PartSet/PartSet_OverconstraintListener.h index c4078244d..d049299f6 100644 --- a/src/PartSet/PartSet_OverconstraintListener.h +++ b/src/PartSet/PartSet_OverconstraintListener.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_OverconstraintListener_H @@ -28,82 +29,78 @@ class PartSet_Module; #include -#include #include +#include /** -* \ingroup GUI -* A class for processing overconstraint situation. It contains is a list of sketch constraints with -* conflicts. -*/ -class PartSet_OverconstraintListener : public Events_Listener -{ + * \ingroup GUI + * A class for processing overconstraint situation. It contains is a list of + * sketch constraints with conflicts. + */ +class PartSet_OverconstraintListener : public Events_Listener { public: /// Constructor - /// \param theWorkshop a current workshop to obtain AIS presentation from displayer - PartSet_OverconstraintListener(ModuleBase_IWorkshop* theWorkshop); + /// \param theWorkshop a current workshop to obtain AIS presentation from + /// displayer + PartSet_OverconstraintListener(ModuleBase_IWorkshop *theWorkshop); - virtual ~PartSet_OverconstraintListener() {}; + virtual ~PartSet_OverconstraintListener(){}; - /// If active state is changed, update fully defined state and sketch sub-entities color - /// \param theActive a state - void setActive(const bool& theActive); + /// If active state is changed, update fully defined state and sketch + /// sub-entities color \param theActive a state + void setActive(const bool &theActive); - /// Returns true if the object belongs to internal container of conflicting objects - /// \param theObject an object to be checked - /// \param theColor the output container to be filled in [red, green, blue] values - /// \return boolean result - void getCustomColor(const ObjectPtr& theObject, std::vector& theColor); + /// Returns true if the object belongs to internal container of conflicting + /// objects \param theObject an object to be checked \param theColor the + /// output container to be filled in [red, green, blue] values \return boolean + /// result + void getCustomColor(const ObjectPtr &theObject, std::vector &theColor); /// Redefinition of Events_Listener method - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); - - bool isConflictingObject(const ObjectPtr& theObject) const - { + bool isConflictingObject(const ObjectPtr &theObject) const { return (myConflictingObjects.find(theObject) != myConflictingObjects.end()); } - const std::set& conflictingObjects() const - { + const std::set &conflictingObjects() const { return myConflictingObjects; } - const std::set& objectsToRemove() const - { + const std::set &objectsToRemove() const { return myObjectsToRemove; } bool isFullyConstrained() const { return myIsFullyConstrained; } protected: - /// Append objects to the internal container of conflicting object, redisplay necessary objects - /// \param theObjects a list of new conflicting objects + /// Append objects to the internal container of conflicting object, redisplay + /// necessary objects \param theObjects a list of new conflicting objects /// \return boolean value whether the list differs from the internal list - bool appendConflictingObjects(const std::set& theObjects); + bool appendConflictingObjects(const std::set &theObjects); - /// Removes objects from internal container of conflicting object, redisplay necessary objects - /// \param theObjects a list of repaired objects - /// \return boolean value whether the list differs from the internal list - bool repairConflictingObjects(const std::set& theObjects); + /// Removes objects from internal container of conflicting object, redisplay + /// necessary objects \param theObjects a list of repaired objects \return + /// boolean value whether the list differs from the internal list + bool repairConflictingObjects(const std::set &theObjects); /// Sends update object signal for each object in the container and flush it. /// \param theObjects a list of object to be redisplayed - void redisplayObjects(const std::set& theObjects); + void redisplayObjects(const std::set &theObjects); private: /// Returns module - PartSet_Module* module() const; + PartSet_Module *module() const; #ifdef _DEBUG /// Unite objects in one string information /// \param theObjects a list of objects /// \return a string info - static QString getObjectsInfo(const std::set& theObjects); + static QString getObjectsInfo(const std::set &theObjects); #endif private: - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; bool myIsActive; /// state if sketch is active std::set myConflictingObjects; std::set myObjectsToRemove; diff --git a/src/PartSet/PartSet_PreviewPlanes.cpp b/src/PartSet/PartSet_PreviewPlanes.cpp index 2fca7204f..c9e4955eb 100644 --- a/src/PartSet/PartSet_PreviewPlanes.cpp +++ b/src/PartSet/PartSet_PreviewPlanes.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_PreviewPlanes.h" @@ -25,8 +26,8 @@ #include #include -#include #include +#include #include #include @@ -34,24 +35,21 @@ #include -PartSet_PreviewPlanes::PartSet_PreviewPlanes() - : myPreviewDisplayed(false) -{ -} +PartSet_PreviewPlanes::PartSet_PreviewPlanes() : myPreviewDisplayed(false) {} -bool PartSet_PreviewPlanes::hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop) -{ +bool PartSet_PreviewPlanes::hasVisualizedBodies( + ModuleBase_IWorkshop *theWorkshop) { bool aBodyIsVisualized = false; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(theWorkshop); - XGUI_Displayer* aDisp = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(theWorkshop); + XGUI_Displayer *aDisp = aWorkshop->displayer(); QObjectPtrList aDisplayed = aDisp->displayedObjects(); foreach (ObjectPtr anObj, aDisplayed) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); // result constructions should not be taken as a body if (aResult.get() != NULL && - ((aResult->groupName() == ModelAPI_ResultBody::group()) || - ((aResult->groupName() == ModelAPI_ResultPart::group()))) ) { + ((aResult->groupName() == ModelAPI_ResultBody::group()) || + ((aResult->groupName() == ModelAPI_ResultPart::group())))) { GeomShapePtr aShape = aResult->shape(); if (aShape.get()) { // vertices, edges should not be taken as a body @@ -64,20 +62,20 @@ bool PartSet_PreviewPlanes::hasVisualizedBodies(ModuleBase_IWorkshop* theWorksho return aBodyIsVisualized; } -bool PartSet_PreviewPlanes::hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop) -{ +bool PartSet_PreviewPlanes::hasVisualizedSketch( + ModuleBase_IWorkshop *theWorkshop) { bool aSketchIsVisualized = false; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(theWorkshop); - XGUI_Displayer* aDisp = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(theWorkshop); + XGUI_Displayer *aDisp = aWorkshop->displayer(); QObjectPtrList aDisplayed = aDisp->displayedObjects(); foreach (ObjectPtr anObj, aDisplayed) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() != NULL) { FeaturePtr aFeature = ModelAPI_Feature::feature(aResult); if (aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID()) { - ResultConstructionPtr aCResult = std::dynamic_pointer_cast - (aResult); + ResultConstructionPtr aCResult = + std::dynamic_pointer_cast(aResult); if (aCResult.get() && aCResult->facesNum() > 0) { aSketchIsVisualized = true; break; @@ -89,17 +87,17 @@ bool PartSet_PreviewPlanes::hasVisualizedSketch(ModuleBase_IWorkshop* theWorksho return aSketchIsVisualized; } -bool PartSet_PreviewPlanes::isPreviewShape(std::shared_ptr theShape) -{ +bool PartSet_PreviewPlanes::isPreviewShape( + std::shared_ptr theShape) { return (myYZPlane->getShape()->isEqual(theShape) || myXZPlane->getShape()->isEqual(theShape) || myXYPlane->getShape()->isEqual(theShape)); } -void PartSet_PreviewPlanes::erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop) -{ +void PartSet_PreviewPlanes::erasePreviewPlanes( + ModuleBase_IWorkshop *theWorkshop) { if (myPreviewDisplayed) { - XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); + XGUI_Displayer *aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); aDisp->eraseAIS(myYZPlane, false); aDisp->eraseAIS(myXZPlane, false); aDisp->eraseAIS(myXYPlane, false); @@ -107,8 +105,8 @@ void PartSet_PreviewPlanes::erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop } } -void PartSet_PreviewPlanes::showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop) -{ +void PartSet_PreviewPlanes::showPreviewPlanes( + ModuleBase_IWorkshop *theWorkshop) { if (myPreviewDisplayed) return; @@ -138,23 +136,22 @@ void PartSet_PreviewPlanes::showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop) myXZPlane = createPreviewPlane(anOrigin, aXZDir, aG); myXYPlane = createPreviewPlane(anOrigin, aXYDir, aB); } - XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); + XGUI_Displayer *aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); aDisp->displayAIS(myYZPlane, true, 0, false); aDisp->displayAIS(myXZPlane, true, 0, false); aDisp->displayAIS(myXYPlane, true, 0, false); myPreviewDisplayed = true; } -AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr theOrigin, - std::shared_ptr theNorm, - const int theRGB[3]) -{ +AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane( + std::shared_ptr theOrigin, + std::shared_ptr theNorm, const int theRGB[3]) { double aSize = Config_PropManager::real(SKETCH_TAB_NAME, "planes_size"); if (aSize <= Precision::Confusion()) - aSize = 200; // Set default value + aSize = 200; // Set default value std::shared_ptr aFace = - GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize); + GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize); AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject()); aAIS->createShape(aFace); aAIS->setWidth(Config_PropManager::real(SKETCH_TAB_NAME, "planes_thickness")); diff --git a/src/PartSet/PartSet_PreviewPlanes.h b/src/PartSet/PartSet_PreviewPlanes.h index 826a31a8f..afff952f4 100644 --- a/src/PartSet/PartSet_PreviewPlanes.h +++ b/src/PartSet/PartSet_PreviewPlanes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_PreviewPlanes_H @@ -22,34 +23,33 @@ #include -#include -#include #include +#include +#include class ModuleBase_IWorkshop; /** -* \class PartSet_PreviewPlanes -* \ingroup Modules -* A class to show/hide sketch preview planes -*/ -class PartSet_PreviewPlanes -{ + * \class PartSet_PreviewPlanes + * \ingroup Modules + * A class to show/hide sketch preview planes + */ +class PartSet_PreviewPlanes { public: /// Constructor PartSet_PreviewPlanes(); - ~PartSet_PreviewPlanes() {}; + ~PartSet_PreviewPlanes(){}; /// Returns true if there is body visualized in the viewer /// \param theWorkshop the application workshop /// \return boolean value - static bool hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop); + static bool hasVisualizedBodies(ModuleBase_IWorkshop *theWorkshop); /// Returns true if there is at least one Sketch visualized in the viewer /// \param theWorkshop the application workshop /// \return boolean value - static bool hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop); + static bool hasVisualizedSketch(ModuleBase_IWorkshop *theWorkshop); /// Returns if the preview was displayed /// \return boolean value @@ -62,17 +62,17 @@ public: /// Erase preview planes /// \param theWorkshop the application workshop - void erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop); + void erasePreviewPlanes(ModuleBase_IWorkshop *theWorkshop); /// Show preview planes /// \param theWorkshop the application workshop - void showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop); + void showPreviewPlanes(ModuleBase_IWorkshop *theWorkshop); private: - /// Create preview of planes for sketch plane selection - /// \param theOrigin an origin of the plane - /// \param theNorm a normal vector of the plane - /// \param theRGB a color of plane presentation [r, g, b] array + /// Create preview of planes for sketch plane selection + /// \param theOrigin an origin of the plane + /// \param theNorm a normal vector of the plane + /// \param theRGB a color of plane presentation [r, g, b] array AISObjectPtr createPreviewPlane(std::shared_ptr theOrigin, std::shared_ptr theNorm, const int theRGB[3]); @@ -85,4 +85,4 @@ private: AISObjectPtr myXYPlane; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index 8cfb60457..13f8e3d88 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_PreviewSketchPlane.h" @@ -22,16 +23,16 @@ #include +#include #include #include -#include #include #include #include -#include #include +#include #include #include @@ -43,54 +44,51 @@ #include PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane() - : myPreviewIsDisplayed(false), mySizeOfView(0), myIsUseSizeOfView(false) -{ -} + : myPreviewIsDisplayed(false), mySizeOfView(0), myIsUseSizeOfView(false) {} -void PartSet_PreviewSketchPlane::eraseSketchPlane(ModuleBase_IWorkshop* theWorkshop, - const bool isClearPlane) -{ +void PartSet_PreviewSketchPlane::eraseSketchPlane( + ModuleBase_IWorkshop *theWorkshop, const bool isClearPlane) { if (myPreviewIsDisplayed) { - XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); + XGUI_Displayer *aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); aDisp->eraseAIS(myPlane, false); myPreviewIsDisplayed = false; } - if (isClearPlane) clearPlanePreview(); + if (isClearPlane) + clearPlanePreview(); } -void PartSet_PreviewSketchPlane::displaySketchPlane(ModuleBase_IWorkshop* theWorkshop) -{ +void PartSet_PreviewSketchPlane::displaySketchPlane( + ModuleBase_IWorkshop *theWorkshop) { if (myPlane.get() && (!myPreviewIsDisplayed)) { - XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); - aDisp->displayAIS(myPlane, false/*load object in selection*/, 1/*shaded*/, false); + XGUI_Displayer *aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); + aDisp->displayAIS(myPlane, false /*load object in selection*/, 1 /*shaded*/, + false); myPreviewIsDisplayed = true; } } - -void PartSet_PreviewSketchPlane::clearPlanePreview() -{ +void PartSet_PreviewSketchPlane::clearPlanePreview() { myPlane = std::shared_ptr(); myShape = std::shared_ptr(); } - -void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& theSketch, - ModuleBase_IWorkshop* theWorkshop) -{ +void PartSet_PreviewSketchPlane::createSketchPlane( + const CompositeFeaturePtr &theSketch, ModuleBase_IWorkshop *theWorkshop) { // plane is visualized only if sketch plane is filled if (!PartSet_Tools::sketchPlane(theSketch).get()) return; - AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast - (theSketch->data()->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); + AttributeSelectionPtr aSelAttr = + std::dynamic_pointer_cast( + theSketch->data()->attribute( + SketchPlugin_SketchEntity::EXTERNAL_ID())); if (!aSelAttr) return; if (myShape.get() && myShape->isSame(aSelAttr->value()) && myPlane.get()) return; - XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); + XGUI_Displayer *aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); if (myPreviewIsDisplayed) { aDisp->eraseAIS(myPlane, false); } @@ -98,27 +96,32 @@ void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& th // Create Preview // selected linear face parameters myShape = aSelAttr->value(); - // this case is needed by constructing sketch on a plane, where result shape is equal - // to context result, therefore value() returns NULL and we should use shape of context. + // this case is needed by constructing sketch on a plane, where result shape + // is equal to context result, therefore value() returns NULL and we should + // use shape of context. if (!myShape.get() && aSelAttr->context().get()) myShape = aSelAttr->context()->shape(); if (!myShape.get()) { // Create Preview for default planes - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - - double aFaceSize = myIsUseSizeOfView ? mySizeOfView - : Config_PropManager::real(SKETCH_TAB_NAME, "planes_size"); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + + double aFaceSize = + myIsUseSizeOfView + ? mySizeOfView + : Config_PropManager::real(SKETCH_TAB_NAME, "planes_size"); if (aFaceSize <= Precision::Confusion()) - aFaceSize = 200; // Set default value + aFaceSize = 200; // Set default value myShape = GeomAlgoAPI_FaceBuilder::squareFace( - myViewCentralPoint.get() ? myViewCentralPoint : anOrigin->pnt(), aNormal->dir(), aFaceSize); - } - else if (myIsUseSizeOfView && (mySizeOfView > 0)) { + myViewCentralPoint.get() ? myViewCentralPoint : anOrigin->pnt(), + aNormal->dir(), aFaceSize); + } else if (myIsUseSizeOfView && (mySizeOfView > 0)) { std::shared_ptr aFace(new GeomAPI_Face(myShape)); std::shared_ptr aPlane = aFace->getPlane(); if (aPlane.get()) { @@ -130,18 +133,19 @@ void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& th aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero)); std::shared_ptr anOrigPnt(new GeomAPI_Pnt(aCoords)); myShape = GeomAlgoAPI_FaceBuilder::squareFace( - myViewCentralPoint.get() ? myViewCentralPoint : anOrigPnt, aNormDir, mySizeOfView); + myViewCentralPoint.get() ? myViewCentralPoint : anOrigPnt, aNormDir, + mySizeOfView); } } myPlane = createPreviewPlane(); - aDisp->displayAIS(myPlane, false/*load object in selection*/, 1/*shaded*/, false); + aDisp->displayAIS(myPlane, false /*load object in selection*/, 1 /*shaded*/, + false); myPreviewIsDisplayed = true; } double maximumSize(double theXmin, double theYmin, double theZmin, - double theXmax, double theYmax, double theZmax) -{ + double theXmax, double theYmax, double theZmax) { double aSize = fabs(theXmax - theXmin); double aSizeToCompare = fabs(theYmax - theYmin); if (aSizeToCompare > aSize) @@ -154,18 +158,20 @@ double maximumSize(double theXmin, double theYmin, double theZmin, } bool PartSet_PreviewSketchPlane::getDefaultSizeOfView( - const CompositeFeaturePtr& theSketch, double& theSizeOfView, - std::shared_ptr& theCentralPnt) -{ + const CompositeFeaturePtr &theSketch, double &theSizeOfView, + std::shared_ptr &theCentralPnt) { if (!PartSet_Tools::sketchPlane(theSketch).get()) return false; - AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast - (theSketch->data()->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); + AttributeSelectionPtr aSelAttr = + std::dynamic_pointer_cast( + theSketch->data()->attribute( + SketchPlugin_SketchEntity::EXTERNAL_ID())); if (aSelAttr) { myShape = aSelAttr->value(); - // this case is needed by constructing sketch on a plane, where result shape is equal - // to context result, therefore value() returns NULL and we should use shape of context. + // this case is needed by constructing sketch on a plane, where result shape + // is equal to context result, therefore value() returns NULL and we should + // use shape of context. if (!myShape.get() && aSelAttr->context().get()) myShape = aSelAttr->context()->shape(); } @@ -182,7 +188,8 @@ bool PartSet_PreviewSketchPlane::getDefaultSizeOfView( std::list aResults = aFeature->results(); std::list::const_iterator aResultIt; - for (aResultIt = aResults.begin(); aResultIt != aResults.end(); ++aResultIt) { + for (aResultIt = aResults.begin(); aResultIt != aResults.end(); + ++aResultIt) { ResultPtr aResult = *aResultIt; std::shared_ptr aShapePtr = aResult->shape(); if (aShapePtr.get()) { @@ -201,42 +208,43 @@ bool PartSet_PreviewSketchPlane::getDefaultSizeOfView( theSizeOfView = maximumSize(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax); if (theSizeOfView > 0) { - gp_Pnt aCentre(aXmax-fabs(aXmax-aXmin)/2., anYmax-fabs(anYmax-anYmin)/2., - aZmax - fabs(aZmax-aZmin)/2.); - theCentralPnt = std::shared_ptr(new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), - aCentre.Z())); + gp_Pnt aCentre(aXmax - fabs(aXmax - aXmin) / 2., + anYmax - fabs(anYmax - anYmin) / 2., + aZmax - fabs(aZmax - aZmin) / 2.); + theCentralPnt = std::shared_ptr( + new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), aCentre.Z())); } return true; } -void PartSet_PreviewSketchPlane::setSizeOfView(double theSizeOfView, bool isUseSizeOfView, - const std::shared_ptr& theCentralPoint) -{ +void PartSet_PreviewSketchPlane::setSizeOfView( + double theSizeOfView, bool isUseSizeOfView, + const std::shared_ptr &theCentralPoint) { mySizeOfView = theSizeOfView; myIsUseSizeOfView = isUseSizeOfView; myViewCentralPoint = theCentralPoint; } -AISObjectPtr PartSet_PreviewSketchPlane::createPreviewPlane() -{ +AISObjectPtr PartSet_PreviewSketchPlane::createPreviewPlane() { if (myPlane.get()) { myPlane->createShape(myShape); return myPlane; - } - else { + } else { AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject()); aAIS->createShape(myShape); - std::vector aColor = Config_PropManager::color("Visualization", "sketch_preview_plane"); + std::vector aColor = + Config_PropManager::color("Visualization", "sketch_preview_plane"); if (aColor.size() == 3) aAIS->setColor(aColor[0], aColor[1], aColor[2]); aAIS->setTransparensy(0.8); int aDispMode = 1; // shading - Handle(AIS_InteractiveObject) anAISIO = aAIS->impl(); + Handle(AIS_InteractiveObject) anAISIO = + aAIS->impl(); if (!anAISIO.IsNull()) { - //anAISIO->SetInfiniteState(Standard_True); - anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True ); + // anAISIO->SetInfiniteState(Standard_True); + anAISIO->Attributes()->SetFaceBoundaryDraw(Standard_True); anAISIO->SetDisplayMode(aDispMode); } return aAIS; diff --git a/src/PartSet/PartSet_PreviewSketchPlane.h b/src/PartSet/PartSet_PreviewSketchPlane.h index cc9ca0698..ba8268023 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.h +++ b/src/PartSet/PartSet_PreviewSketchPlane.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_PreviewSketchPlane_H @@ -31,38 +32,39 @@ class ModelAPI_CompositeFeature; #include /** -* \class PartSet_PreviewSketchPlane -* \ingroup Modules -* A class to show/hide sketch preview plane -*/ -class PartSet_PreviewSketchPlane -{ + * \class PartSet_PreviewSketchPlane + * \ingroup Modules + * A class to show/hide sketch preview plane + */ +class PartSet_PreviewSketchPlane { public: /// Constructor PartSet_PreviewSketchPlane(); - ~PartSet_PreviewSketchPlane() {}; + ~PartSet_PreviewSketchPlane(){}; /// Erase preview planes /// \param theWorkshop the application workshop - /// \param isClearPlane flag whether the plane, origin and normal should be nullified - void eraseSketchPlane(ModuleBase_IWorkshop* theWorkshop, const bool isClearPlane = true); + /// \param isClearPlane flag whether the plane, origin and normal should be + /// nullified + void eraseSketchPlane(ModuleBase_IWorkshop *theWorkshop, + const bool isClearPlane = true); /// Show preview planes /// \param theSketch source sketch to initialize plane /// \param theWorkshop the application workshop - void createSketchPlane(const std::shared_ptr& theSketch, - ModuleBase_IWorkshop* theWorkshop); + void + createSketchPlane(const std::shared_ptr &theSketch, + ModuleBase_IWorkshop *theWorkshop); /// Returns bounding box size covered the sketch sub-elements. - /// If the sketch uses extenal face, it will not have default size and returns false. - /// \param theSketch sources sketch - /// \param [out] theSizeOfView maximum value in X, Y or Z direction - /// \param theCentralPoint central point of the sketch sub features - /// \return boolean value - bool getDefaultSizeOfView(const std::shared_ptr& theSketch, - double& theSizeOfView, - std::shared_ptr& theCentralPnt); + /// If the sketch uses extenal face, it will not have default size and returns + /// false. \param theSketch sources sketch \param [out] theSizeOfView maximum + /// value in X, Y or Z direction \param theCentralPoint central point of the + /// sketch sub features \return boolean value + bool getDefaultSizeOfView( + const std::shared_ptr &theSketch, + double &theSizeOfView, std::shared_ptr &theCentralPnt); /// Returns whether custom size of view is set /// \return boolean value @@ -72,22 +74,22 @@ public: /// \param theSizeOfView value /// \param isUseSizeOfView state whether the size should be used void setSizeOfView(double theSizeOfView, bool isUseSizeOfView, - const std::shared_ptr& theCentralPoint = std::shared_ptr()); + const std::shared_ptr &theCentralPoint = + std::shared_ptr()); /// Returns True if the plane preview is already created - bool isPlaneCreated() const { - return myPlane.get(); - } + bool isPlaneCreated() const { return myPlane.get(); } /// Returns current state of the plane preview visibility bool isDisplayed() const { return myPreviewIsDisplayed; } /// Displays preview planes - /// \param theWorkshop the application workshop - void displaySketchPlane(ModuleBase_IWorkshop* theWorkshop); + /// \param theWorkshop the application workshop + void displaySketchPlane(ModuleBase_IWorkshop *theWorkshop); /// Nullyfies current plane preview object. - /// Important: Before call of this function the plane has to be erased from viewer + /// Important: Before call of this function the plane has to be erased from + /// viewer void clearPlanePreview(); private: @@ -97,12 +99,14 @@ private: private: bool myPreviewIsDisplayed; std::shared_ptr myPlane; //! visualized presentation - std::shared_ptr myShape; //! current shape to be displayed - std::shared_ptr myViewCentralPoint; //! central point of the default view + std::shared_ptr myShape; //! current shape to be displayed + std::shared_ptr + myViewCentralPoint; //! central point of the default view double mySizeOfView; //! size that should be used by creating a default face bool myIsUseSizeOfView; //! state if the size is custom or from preferences - std::shared_ptr myViewOrigin; //! origin point of sketch if default view is used + std::shared_ptr + myViewOrigin; //! origin point of sketch if default view is used }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 6b8dca64c..d8fc2fc22 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_ResultSketchPrs.h" -#include "PartSet_Tools.h" #include "ModuleBase_Tools.h" +#include "PartSet_Tools.h" +#include #include -#include -#include #include -#include +#include +#include #include #include @@ -37,22 +38,22 @@ #include #include -#include +#include +#include #include +#include +#include #include -#include #include #include #include -#include -#include -#include +#include //#define DEBUG_WIRE #ifdef DEBUG_WIRE -#include #include +#include #endif #include @@ -66,8 +67,7 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_ResultSketchPrs, ViewerData_AISShape); PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) - : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult) -{ + : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); TopoDS_Shape aShape = aShapePtr->impl(); @@ -76,8 +76,9 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) if (aDrawer->HasOwnPointAspect()) aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS); else - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); - //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); + // aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); // Activate individual repaintng if this is a part of compsolid ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(myResult); @@ -86,15 +87,15 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) ModuleBase_Tools::setPointBallHighlighting(this); // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), + DynamicHilightAttributes()); ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); } void PartSet_ResultSketchPrs::Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) -{ + const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode) { thePresentation->Clear(); TopoDS_Shape aResultShape; @@ -102,7 +103,8 @@ void PartSet_ResultSketchPrs::Compute( NCollection_List aFaceList; fillShapes(aResultShape, anAuxiliaryCompound, mySketchFaceList); - bool aReadyToDisplay = !aResultShape.IsNull() || !anAuxiliaryCompound.IsNull(); + bool aReadyToDisplay = + !aResultShape.IsNull() || !anAuxiliaryCompound.IsNull(); if (aReadyToDisplay) { if (!aResultShape.IsNull()) { @@ -117,8 +119,7 @@ void PartSet_ResultSketchPrs::Compute( try { AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); - } - catch (...) { + } catch (...) { return; } if (!myAuxiliaryCompound.IsNull()) { @@ -130,36 +131,36 @@ void PartSet_ResultSketchPrs::Compute( if (!aReadyToDisplay) { Events_InfoMessage("PartSet_ResultSketchPrs", - "An empty AIS presentation: PartSet_ResultSketchPrs").send(); - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); + "An empty AIS presentation: PartSet_ResultSketchPrs") + .send(); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); } } #ifdef DEBUG_WIRE -void debugInfo(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType) -{ +void debugInfo(const TopoDS_Shape &theShape, const TopAbs_ShapeEnum theType) { TopTools_IndexedMapOfShape aSubShapes; - TopExp::MapShapes (theShape, theType, aSubShapes); + TopExp::MapShapes(theShape, theType, aSubShapes); - Standard_Boolean - isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1))); + Standard_Boolean isComesFromDecomposition = + !((aSubShapes.Extent() == 1) && (theShape == aSubShapes(1))); int anExtent = aSubShapes.Extent(); - for (Standard_Integer aShIndex = 1; aShIndex <= aSubShapes.Extent(); ++aShIndex) - { - const TopoDS_Shape& aSubShape = aSubShapes (aShIndex); + for (Standard_Integer aShIndex = 1; aShIndex <= aSubShapes.Extent(); + ++aShIndex) { + const TopoDS_Shape &aSubShape = aSubShapes(aShIndex); int aValue = 0; } } #endif -void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) -{ +void PartSet_ResultSketchPrs::ComputeSelection( + const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer theMode) { int aMode = theMode; - if (aMode > 8 && - aMode != SketcherPrs_Tools::Sel_Sketch_Face && + if (aMode > 8 && aMode != SketcherPrs_Tools::Sel_Sketch_Face && aMode != SketcherPrs_Tools::Sel_Sketch_Wire) // In order to avoid using custom selection modes return; @@ -168,36 +169,38 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) double aPrevDeviation = Attributes()->DeviationCoefficient(); if (aMode == SketcherPrs_Tools::Sel_Sketch_Face || aMode == SketcherPrs_Tools::Sel_Sketch_Wire) { - aMode = (aMode == SketcherPrs_Tools::Sel_Sketch_Face) ? AIS_Shape::SelectionMode(TopAbs_FACE) - : AIS_Shape::SelectionMode(TopAbs_WIRE); + aMode = (aMode == SketcherPrs_Tools::Sel_Sketch_Face) + ? AIS_Shape::SelectionMode(TopAbs_FACE) + : AIS_Shape::SelectionMode(TopAbs_WIRE); #ifdef DEBUG_WIRE - const TopoDS_Shape& aShape = Shape(); + const TopoDS_Shape &aShape = Shape(); debugInfo(aShape, TopAbs_VERTEX); // 24 - debugInfo(aShape, TopAbs_EDGE); // 12 - debugInfo(aShape, TopAbs_WIRE); // 0 - debugInfo(aShape, TopAbs_FACE); // 0 + debugInfo(aShape, TopAbs_EDGE); // 12 + debugInfo(aShape, TopAbs_WIRE); // 0 + debugInfo(aShape, TopAbs_FACE); // 0 #endif BRep_Builder aBuilder; TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); aBuilder.Add(aComp, myOriginalShape); - for(NCollection_List::Iterator anIt(mySketchFaceList); anIt.More(); anIt.Next()) { - const TopoDS_Shape& aFace = anIt.Value(); + for (NCollection_List::Iterator anIt(mySketchFaceList); + anIt.More(); anIt.Next()) { + const TopoDS_Shape &aFace = anIt.Value(); aBuilder.Add(aComp, aFace); } #ifdef DEBUG_WIRE debugInfo(aComp, TopAbs_VERTEX); // 24 - debugInfo(aComp, TopAbs_EDGE); // 12 - debugInfo(aComp, TopAbs_WIRE); // 4 - debugInfo(aComp, TopAbs_FACE); // 2 + debugInfo(aComp, TopAbs_EDGE); // 12 + debugInfo(aComp, TopAbs_WIRE); // 4 + debugInfo(aComp, TopAbs_FACE); // 2 #endif Set(aComp); - double aBodyDefDeflection = Config_PropManager::real("Visualization", "body_deflection"); + double aBodyDefDeflection = + Config_PropManager::real("Visualization", "body_deflection"); Attributes()->SetDeviationCoefficient(aBodyDefDeflection); aShapeIsChanged = true; - } - else + } else Set(myOriginalShape); // append auxiliary compound to selection of edges/vertices @@ -205,7 +208,8 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX)) { bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX); - appendShapeSelection(aSelection, myAuxiliaryCompound, isVertex ? TopAbs_VERTEX : TopAbs_EDGE); + appendShapeSelection(aSelection, myAuxiliaryCompound, + isVertex ? TopAbs_VERTEX : TopAbs_EDGE); } AIS_Shape::ComputeSelection(aSelection, aMode); @@ -216,33 +220,29 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) } } -void PartSet_ResultSketchPrs::appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection, - const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum& theTypeOfSelection) -{ +void PartSet_ResultSketchPrs::appendShapeSelection( + const Handle(SelectMgr_Selection) & theSelection, + const TopoDS_Shape &theShape, const TopAbs_ShapeEnum &theTypeOfSelection) { // POP protection against crash in low layers #if OCC_VERSION_HEX > 0x070400 - Standard_Real aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection(theShape, myDrawer); + Standard_Real aDeflection = + StdPrs_ToolTriangulatedShape::GetDeflection(theShape, myDrawer); #else Standard_Real aDeflection = Prs3d::GetDeflection(theShape, myDrawer); #endif try { - StdSelect_BRepSelectionTool::Load(theSelection, - this, - theShape, - theTypeOfSelection, - aDeflection, - myDrawer->DeviationAngle(), - myDrawer->IsAutoTriangulation()); - } catch ( Standard_Failure ) { + StdSelect_BRepSelectionTool::Load( + theSelection, this, theShape, theTypeOfSelection, aDeflection, + myDrawer->DeviationAngle(), myDrawer->IsAutoTriangulation()); + } catch (Standard_Failure) { } } -void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle(const bool isAuxiliary) -{ - Standard_Integer aLineStyle = isAuxiliary? - SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY() : - SketchPlugin_SketchEntity::SKETCH_LINE_STYLE(); +void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle( + const bool isAuxiliary) { + Standard_Integer aLineStyle = + isAuxiliary ? SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY() + : SketchPlugin_SketchEntity::SKETCH_LINE_STYLE(); Handle(Prs3d_Drawer) aDrawer = Attributes(); @@ -261,29 +261,30 @@ void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle(const bool isAuxilia Standard_Real aCurrentWidth = aLineAspect->Aspect()->Width(); bool isChangedLineType = aType != aPrevLineType; if (isChangedLineType) { - Handle(Prs3d_LineAspect) aAspect = new Prs3d_LineAspect(aCurrentColor, aType, aCurrentWidth); + Handle(Prs3d_LineAspect) aAspect = + new Prs3d_LineAspect(aCurrentColor, aType, aCurrentWidth); aDrawer->SetLineAspect(aAspect); aDrawer->SetWireAspect(aAspect); SetAttributes(aDrawer); } } -void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape, - TopoDS_Compound& theAuxiliaryCompound, - NCollection_List& theFaceList) -{ - //if (!aResultShape.IsNull() || !anAuxiliaryCompound.IsNull()) +void PartSet_ResultSketchPrs::fillShapes( + TopoDS_Shape &theResultShape, TopoDS_Compound &theAuxiliaryCompound, + NCollection_List &theFaceList) { + // if (!aResultShape.IsNull() || !anAuxiliaryCompound.IsNull()) std::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); if (!aShapePtr) return; theFaceList.Clear(); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(myResult); + std::dynamic_pointer_cast(myResult); if (aConstruction.get()) { int aFacesNum = aConstruction->facesNum(); - for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { - std::shared_ptr aFaceShape = aConstruction->face(aFaceIndex); + for (int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { + std::shared_ptr aFaceShape = + aConstruction->face(aFaceIndex); if (aFaceShape.get()) { TopoDS_Shape aFace = (aFaceShape)->impl(); theFaceList.Append(aFace); @@ -294,8 +295,8 @@ void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape, /// find auxiliary shapes FeaturePtr aResultFeature = ModelAPI_Feature::feature(myResult); - CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast - (aResultFeature); + CompositeFeaturePtr aSketchFeature = + std::dynamic_pointer_cast(aResultFeature); std::list anAuxiliaryResults; int aNumberOfSubs = aSketchFeature->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { @@ -308,20 +309,22 @@ void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape, if (aResult.get() && aResult->shape().get()) anAuxiliaryResults.push_back(aResult); } - } - else if (PartSet_Tools::isIncludeIntoSketchResult(aFeature)) { - // Append not-edges shapes, e.g. center of a circle, an arc, a point feature. - // Issue #2535: do not show elements produced by Projection or Intersection features, - // which should not be included into the sketch result. - const std::list >& aRes = aFeature->results(); - std::list >::const_iterator aResIter = aRes.cbegin(); + } else if (PartSet_Tools::isIncludeIntoSketchResult(aFeature)) { + // Append not-edges shapes, e.g. center of a circle, an arc, a point + // feature. Issue #2535: do not show elements produced by Projection or + // Intersection features, which should not be included into the sketch + // result. + const std::list> &aRes = + aFeature->results(); + std::list>::const_iterator aResIter = + aRes.cbegin(); for (; aResIter != aRes.cend(); aResIter++) { - std::shared_ptr aConstr = std::dynamic_pointer_cast< - ModelAPI_ResultConstruction>(*aResIter); + std::shared_ptr aConstr = + std::dynamic_pointer_cast(*aResIter); if (aConstr) { std::shared_ptr aGeomShape = aConstr->shape(); if (aGeomShape.get()) { - const TopoDS_Shape& aShape = aGeomShape->impl(); + const TopoDS_Shape &aShape = aGeomShape->impl(); if (aShape.ShapeType() != TopAbs_EDGE) anAuxiliaryResults.push_back(aConstr); } @@ -332,7 +335,7 @@ void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape, if (anAuxiliaryResults.size() > 0) { BRep_Builder aBuilder; - //TopoDS_Compound aComp; + // TopoDS_Compound aComp; aBuilder.MakeCompound(theAuxiliaryCompound); std::list::const_iterator anIt = anAuxiliaryResults.begin(), aLast = anAuxiliaryResults.end(); @@ -341,7 +344,7 @@ void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape, if (aResult.get()) { GeomShapePtr aGeomShape = aResult->shape(); if (aGeomShape.get()) { - const TopoDS_Shape& aShape = aGeomShape->impl(); + const TopoDS_Shape &aShape = aGeomShape->impl(); if (!aShape.IsNull()) aBuilder.Add(theAuxiliaryCompound, aShape); } diff --git a/src/PartSet/PartSet_ResultSketchPrs.h b/src/PartSet/PartSet_ResultSketchPrs.h index 04f8dca0f..072a3f581 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.h +++ b/src/PartSet/PartSet_ResultSketchPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_ResultSketchPrs_H @@ -31,12 +32,11 @@ DEFINE_STANDARD_HANDLE(PartSet_ResultSketchPrs, ViewerData_AISShape) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide specific behaviour -* for wire presentations based in a one plane -*/ -class PartSet_ResultSketchPrs: public ViewerData_AISShape -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * specific behaviour for wire presentations based in a one plane + */ +class PartSet_ResultSketchPrs : public ViewerData_AISShape { public: /// Constructor /// \param theResult a result object @@ -45,34 +45,37 @@ public: DEFINE_STANDARD_RTTIEXT(PartSet_ResultSketchPrs, ViewerData_AISShape) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) ; + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer theMode); private: /// Appens sensitive and owners for wires of the given shape into selection /// \param theSelection a current filled selection /// \param theShape a shape /// \param theTypeOfSelection type of selection: VERTEX, EDGE, WIRE - void appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection, - const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum& theTypeOfSelection); + void appendShapeSelection(const Handle(SelectMgr_Selection) & theSelection, + const TopoDS_Shape &theShape, + const TopAbs_ShapeEnum &theTypeOfSelection); - /// Sets color/line style/width of the presentation depending on the parameter state - /// \param isAuxiliary a boolean value if the properties are for auxiliary objects + /// Sets color/line style/width of the presentation depending on the parameter + /// state \param isAuxiliary a boolean value if the properties are for + /// auxiliary objects void setAuxiliaryPresentationStyle(const bool isAuxiliary); /// Fills the containers by the current result - /// \param theResultShape contains a shape of the result, it will be set as a Shape of AIS_Shape - /// \param theAuxiliaryCompound a compound of auxiliary shapes - /// \param theFaceList a list of face shapes - void fillShapes(TopoDS_Shape& aResultShape, - TopoDS_Compound& theAuxiliaryCompound, - NCollection_List& theFaceList); + /// \param theResultShape contains a shape of the result, it will be set as a + /// Shape of AIS_Shape \param theAuxiliaryCompound a compound of auxiliary + /// shapes \param theFaceList a list of face shapes + void fillShapes(TopoDS_Shape &aResultShape, + TopoDS_Compound &theAuxiliaryCompound, + NCollection_List &theFaceList); /// Reference to result object ResultPtr myResult; @@ -84,9 +87,8 @@ private: TopoDS_Compound myAuxiliaryCompound; /// List of faces - //std::list > myFacesList; + // std::list > myFacesList; NCollection_List mySketchFaceList; }; - -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index d47d1ec75..9f64a4167 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -14,50 +14,49 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_SketcherMgr.h" +#include "PartSet_ExternalPointsMgr.h" #include "PartSet_Filters.h" -#include "PartSet_SketcherReentrantMgr.h" #include "PartSet_Module.h" #include "PartSet_MouseProcessor.h" +#include "PartSet_PreviewSketchPlane.h" +#include "PartSet_ResultSketchPrs.h" +#include "PartSet_SketcherReentrantMgr.h" #include "PartSet_Tools.h" -#include "PartSet_WidgetSketchLabel.h" #include "PartSet_WidgetEditor.h" -#include "PartSet_ResultSketchPrs.h" -#include "PartSet_ExternalPointsMgr.h" -#include "PartSet_PreviewSketchPlane.h" +#include "PartSet_WidgetSketchLabel.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 @@ -66,36 +65,36 @@ #include -#include -#include -#include #include #include -#include -#include -#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include #include -#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include #include #include -#include +#include #include -#include -#include -#include +#include #include @@ -105,18 +104,18 @@ #include #include +#include #include #include -#include -#include #include +#include -#include #include #include -#include #include +#include +#include #include @@ -126,33 +125,32 @@ //#define DRAGGING_DEBUG //#define DEBUG_CURSOR - #ifdef DRAGGING_DEBUG #include #endif -/// Fills attribute and result lists by the selected owner. In case if the attribute is found, -/// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge, -/// put the function result as is to the list of results. -/// \param theOwner a viewer selected owner -/// \param theFeature a feature, where the attribute is searched -/// \param theSketch a current sketch +/// Fills attribute and result lists by the selected owner. In case if the +/// attribute is found, by the owner shape, it is put to the list. Otherwise if +/// type of owner shape is edge, put the function result as is to the list of +/// results. \param theOwner a viewer selected owner \param theFeature a +/// feature, where the attribute is searched \param theSketch a current sketch /// \param theSelectedAttribute an output list of attributes /// \param theSelectedResults an output list of edge results -void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner, - const FeaturePtr& theFeature, const FeaturePtr& theSketch, - const ResultPtr& theResult, - std::map& theSelectedAttributes, - std::set& theSelectedResults, - TopTools_MapOfShape& theShapes) -{ - Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); +void getAttributesOrResults(const Handle(SelectMgr_EntityOwner) & theOwner, + const FeaturePtr &theFeature, + const FeaturePtr &theSketch, + const ResultPtr &theResult, + std::map &theSelectedAttributes, + std::set &theSelectedResults, + TopTools_MapOfShape &theShapes) { + Handle(StdSelect_BRepOwner) aBRepOwner = + Handle(StdSelect_BRepOwner)::DownCast(theOwner); if (aBRepOwner.IsNull()) return; - Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast( - aBRepOwner->Selectable()); + Handle(AIS_InteractiveObject) anIO = + Handle(AIS_InteractiveObject)::DownCast(aBRepOwner->Selectable()); if (aBRepOwner->HasShape()) { - const TopoDS_Shape& aShape = aBRepOwner->Shape(); + const TopoDS_Shape &aShape = aBRepOwner->Shape(); theShapes.Add(aShape); TopAbs_ShapeEnum aShapeType = aShape.ShapeType(); if (aShapeType == TopAbs_VERTEX) { @@ -160,47 +158,44 @@ void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner, PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch); if (aPntAttrIndex.first.get() != NULL) theSelectedAttributes[aPntAttrIndex.first] = aPntAttrIndex.second; - } - else if (aShapeType == TopAbs_EDGE && - theSelectedResults.find(theResult) == theSelectedResults.end()) { + } else if (aShapeType == TopAbs_EDGE && + theSelectedResults.find(theResult) == theSelectedResults.end()) { theSelectedResults.insert(theResult); } } } -PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule) - : QObject(theModule), - myModule(theModule), - myIsEditLaunching(false), - myIsDragging(false), - myDragDone(false), - myIsMouseOverWindow(false), - myIsMouseOverViewProcessed(true), - myIsPopupMenuActive(false), - myPreviousUpdateViewerEnabled(true), - myExternalPointsMgr(0), - myNoDragMoving(false) -{ - ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); - ModuleBase_IViewer* aViewer = anIWorkshop->viewer(); +PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module *theModule) + : QObject(theModule), myModule(theModule), myIsEditLaunching(false), + myIsDragging(false), myDragDone(false), myIsMouseOverWindow(false), + myIsMouseOverViewProcessed(true), myIsPopupMenuActive(false), + myPreviousUpdateViewerEnabled(true), myExternalPointsMgr(0), + myNoDragMoving(false) { + ModuleBase_IWorkshop *anIWorkshop = myModule->workshop(); + ModuleBase_IViewer *aViewer = anIWorkshop->viewer(); - myPreviousDrawModeEnabled = true;//aViewer->isSelectionEnabled(); + myPreviousDrawModeEnabled = true; // aViewer->isSelectionEnabled(); - connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SLOT(onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow *, QMouseEvent *)), + this, SLOT(onMousePressed(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SLOT(onMouseReleased(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, + SIGNAL(mouseRelease(ModuleBase_IViewWindow *, QMouseEvent *)), this, + SLOT(onMouseReleased(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SLOT(onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow *, QMouseEvent *)), + this, SLOT(onMouseMoved(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SLOT(onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, + SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *)), + this, + SLOT(onMouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *))); - XGUI_ModuleConnector* aConnector = dynamic_cast(anIWorkshop); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - connect(aWorkshop, SIGNAL(applicationStarted()), this, SLOT(onApplicationStarted())); + XGUI_ModuleConnector *aConnector = + dynamic_cast(anIWorkshop); + XGUI_Workshop *aWorkshop = aConnector->workshop(); + connect(aWorkshop, SIGNAL(applicationStarted()), this, + SLOT(onApplicationStarted())); myIsConstraintsShown[PartSet_Tools::Geometrical] = true; myIsConstraintsShown[PartSet_Tools::Dimensional] = true; @@ -208,40 +203,40 @@ PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule) mySketchPlane = new PartSet_PreviewSketchPlane(); - registerSelectionFilter(SF_SketchCirclePointFilter, new PartSet_CirclePointFilter(anIWorkshop)); - registerSelectionFilter(SF_SketchPlaneFilter, new ModuleBase_ShapeInPlaneFilter()); + registerSelectionFilter(SF_SketchCirclePointFilter, + new PartSet_CirclePointFilter(anIWorkshop)); + registerSelectionFilter(SF_SketchPlaneFilter, + new ModuleBase_ShapeInPlaneFilter()); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_DOF_OBJECTS)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_DOF_OBJECTS)); } -PartSet_SketcherMgr::~PartSet_SketcherMgr() -{ - delete mySketchPlane; -} +PartSet_SketcherMgr::~PartSet_SketcherMgr() { delete mySketchPlane; } -void PartSet_SketcherMgr::onEnterViewPort() -{ - // 1. if the mouse over window, update the next flag. Do not perform update visibility of - // created feature because it should be done in onMouseMove(). Some widgets watch - // the mouse move and use the cursor position to update own values. If the presentaion is - // redisplayed before this update, the feature presentation jumps from reset value to current. +void PartSet_SketcherMgr::onEnterViewPort() { + // 1. if the mouse over window, update the next flag. Do not perform update + // visibility of created feature because it should be done in onMouseMove(). + // Some widgets watch the mouse move and use the cursor position to update own + // values. If the presentaion is redisplayed before this update, the feature + // presentation jumps from reset value to current. myIsMouseOverWindow = true; - #ifdef DEBUG_DO_NOT_BY_ENTER +#ifdef DEBUG_DO_NOT_BY_ENTER return; - #endif +#endif // It is switched off because of // Task #3067: 5.2.2 Drawing in the sketcher: change the mouse cursor arrow - if (canChangeCursor(getCurrentOperation())) { - QCursor* aCurrentCursor = QApplication::overrideCursor(); - if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) { - QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor()); - //#ifdef DEBUG_CURSOR - // qDebug("onEnterViewPort() : Qt::CrossCursor"); - //#endif - } + if (canChangeCursor(getCurrentOperation())) { + QCursor *aCurrentCursor = QApplication::overrideCursor(); + if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) { + QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor()); + //#ifdef DEBUG_CURSOR + // qDebug("onEnterViewPort() : Qt::CrossCursor"); + //#endif } + } if (!isNestedCreateOperation(getCurrentOperation(), activeSketch())) return; @@ -249,35 +244,36 @@ void PartSet_SketcherMgr::onEnterViewPort() operationMgr()->onValidateOperation(); // we need change displayed state of the current operation feature - // if the feature is presentable, e.g. distance construction. It has no results, so workshop does - // not accept a signal about the result created. Nothing is shown until mouse is moved out/in view - // port. If the isDisplayed flag is true, the presentable feature is displayed as soon as the + // if the feature is presentable, e.g. distance construction. It has no + // results, so workshop does not accept a signal about the result created. + // Nothing is shown until mouse is moved out/in view port. If the isDisplayed + // flag is true, the presentable feature is displayed as soon as the // presentation becomes valid and redisplay happens - //ModuleBase_Operation* aOperation = getCurrentOperation(); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); + // ModuleBase_Operation* aOperation = getCurrentOperation(); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); if (aFeature.get() && aFeature->data()->isValid()) { - visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature), false); + visualizeFeature(aFeature, aFOperation->isEditOperation(), + canDisplayObject(aFeature), false); } } } -void PartSet_SketcherMgr::onLeaveViewPort() -{ +void PartSet_SketcherMgr::onLeaveViewPort() { myIsMouseOverViewProcessed = false; myIsMouseOverWindow = false; - #ifdef DEBUG_DO_NOT_BY_ENTER +#ifdef DEBUG_DO_NOT_BY_ENTER return; - #endif +#endif if (canChangeCursor(getCurrentOperation())) { QApplication::restoreOverrideCursor(); -//#ifdef DEBUG_CURSOR -// qDebug("onLeaveViewPort() : None"); -//#endif + //#ifdef DEBUG_CURSOR + // qDebug("onLeaveViewPort() : None"); + //#endif } if (!isNestedCreateOperation(getCurrentOperation(), activeSketch())) @@ -288,32 +284,38 @@ void PartSet_SketcherMgr::onLeaveViewPort() if (myIsPopupMenuActive) return; - // it is important to validate operation here only if sketch entity create operation is active - // because at this operation we reacts to the mouse leave/enter view port + // it is important to validate operation here only if sketch entity create + // operation is active because at this operation we reacts to the mouse + // leave/enter view port operationMgr()->onValidateOperation(); - // 2. if the mouse IS NOT over window, reset the active widget value and hide the presentation - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); - // disable the viewer update in order to avoid visualization of redisplayed feature in viewer - // obtained after reset value + // 2. if the mouse IS NOT over window, reset the active widget value and hide + // the presentation + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(aWorkshop); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); + // disable the viewer update in order to avoid visualization of redisplayed + // feature in viewer obtained after reset value bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false); - ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); + ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); if (anActiveWidget) anActiveWidget->reset(); // hides the presentation of the current operation feature - // the feature is to be erased here, but it is correct to call canDisplayObject because - // there can be additional check (e.g. editor widget in distance constraint) - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); + // the feature is to be erased here, but it is correct to call + // canDisplayObject because there can be additional check (e.g. editor widget + // in distance constraint) + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); - visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature)); + visualizeFeature(aFeature, aFOperation->isEditOperation(), + canDisplayObject(aFeature)); } // we should update viewer after the presentation are hidden in the viewer - // otherwise the reset presentation(line) appears in the viewer(by quick move from viewer to PP) + // otherwise the reset presentation(line) appears in the viewer(by quick move + // from viewer to PP) aDisplayer->enableUpdateViewer(isEnableUpdateViewer); } @@ -321,61 +323,70 @@ void PartSet_SketcherMgr::onLeaveViewPort() //Temporary commented as we do not modify values in property panel void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel() { - if (!isNestedEditOperation(getCurrentOperation(), myModule->sketchMgr()->activeSketch()) || + if (!isNestedEditOperation(getCurrentOperation(), +myModule->sketchMgr()->activeSketch()) || myModule->sketchReentranceMgr()->isInternalEditActive()) return; - // it is necessary to save current selection in order to restore it after the values are modifed - storeSelection(ST_SelectAndHighlightType); + // it is necessary to save current selection in order to restore it after the +values are modifed storeSelection(ST_SelectAndHighlightType); ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); - myPreviousUpdateViewerEnabled = aDisplayer->enableUpdateViewer(false); + XGUI_ModuleConnector* aConnector = +dynamic_cast(aWorkshop); XGUI_Displayer* aDisplayer = +aConnector->workshop()->displayer(); myPreviousUpdateViewerEnabled = +aDisplayer->enableUpdateViewer(false); } void PartSet_SketcherMgr::onAfterValuesChangedInPropertyPanel() { - if (!isNestedEditOperation(getCurrentOperation(), myModule->sketchMgr()->activeSketch()) || + if (!isNestedEditOperation(getCurrentOperation(), +myModule->sketchMgr()->activeSketch()) || myModule->sketchReentranceMgr()->isInternalEditActive()) { myModule->sketchReentranceMgr()->updateInternalEditActiveState(); return; } - // it is necessary to restore current selection in order to restore it after values are modified - restoreSelection(); - myCurrentSelection.clear(); + // it is necessary to restore current selection in order to restore it after +values are modified restoreSelection(); myCurrentSelection.clear(); - // 3. the flag to disable the update viewer should be set in order to avoid blinking in the - // viewer happens by deselect/select the modified objects. The flag should be restored after + // 3. the flag to disable the update viewer should be set in order to avoid +blinking in the + // viewer happens by deselect/select the modified objects. The flag should be +restored after // the selection processing. The update viewer should be also called. ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + XGUI_ModuleConnector* aConnector = +dynamic_cast(aWorkshop); XGUI_Displayer* aDisplayer = +aConnector->workshop()->displayer(); aDisplayer->enableUpdateViewer(myPreviousUpdateViewerEnabled); aDisplayer->updateViewer(); } */ -bool PartSet_SketcherMgr::isDragModeCreation() const -{ - ModuleBase_Operation* aOp = getCurrentOperation(); +bool PartSet_SketcherMgr::isDragModeCreation() const { + ModuleBase_Operation *aOp = getCurrentOperation(); if (!aOp) return false; - bool aUserPref = Config_PropManager::boolean(SKETCH_TAB_NAME, "create_by_dragging"); + bool aUserPref = + Config_PropManager::boolean(SKETCH_TAB_NAME, "create_by_dragging"); if (!aUserPref) return false; QString aId = aOp->id(); // Acceptable features; QStringList aList; - aList << "SketchLine" << "SketchMacroCircle" << "SketchMacroArc" << - "SketchMacroEllipse" << "SketchMacroEllipticArc" << "SketchMacroRectangle"; + aList << "SketchLine" + << "SketchMacroCircle" + << "SketchMacroArc" + << "SketchMacroEllipse" + << "SketchMacroEllipticArc" + << "SketchMacroRectangle"; return aList.contains(aId); } static bool MyModeByDrag = false; static bool MyMultiselectionState = true; -void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) -{ +void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) { MyModeByDrag = isDragModeCreation(); // Clear dragging mode @@ -386,32 +397,33 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent)) return; - //get2dPoint(theWnd, theEvent, myClickedPoint); + // get2dPoint(theWnd, theEvent, myClickedPoint); if (!(theEvent->buttons() & Qt::LeftButton)) return; - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - ModuleBase_IViewer* aViewer = aWorkshop->viewer(); - //if (!aViewer->canDragByMouse()) - // return; + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + ModuleBase_IViewer *aViewer = aWorkshop->viewer(); + // if (!aViewer->canDragByMouse()) + // return; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (!aFOperation) return; bool isEditing = aFOperation->isEditOperation(); bool aCanDrag = aViewer->canDragByMouse(); - //if (!aViewer->canDragByMouse() && isEditing) { - // // Do not edit by dragging - // return; - //} + // if (!aViewer->canDragByMouse() && isEditing) { + // // Do not edit by dragging + // return; + // } if (isEditing) { - // If the current widget is a selector, do nothing, it processes the mouse press - ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); - if(anActiveWidget && anActiveWidget->isViewerSelector()) { + // If the current widget is a selector, do nothing, it processes the mouse + // press + ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); + if (anActiveWidget && anActiveWidget->isViewerSelector()) { return; } } @@ -431,14 +443,16 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE // Ignore creation sketch operation if ((!isSketcher) && (!isEditing)) { if (MyModeByDrag) { - ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); - PartSet_MouseProcessor* aProcessor = dynamic_cast(anActiveWidget); + ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); + PartSet_MouseProcessor *aProcessor = + dynamic_cast(anActiveWidget); if (aProcessor) { MyMultiselectionState = aViewer->isMultiSelectionEnabled(); aViewer->enableMultiselection(false); myIsDragging = true; - ModuleBase_ISelection* aSelection = aWorkshop->selection(); - QList aPreSelected = aSelection->getHighlighted(); + ModuleBase_ISelection *aSelection = aWorkshop->selection(); + QList aPreSelected = + aSelection->getHighlighted(); if (!aPreSelected.empty()) aProcessor->setPreSelection(aPreSelected.first(), theWnd, theEvent); else @@ -448,7 +462,8 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE return; } bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); - storeSelection(aHasShift ? ST_SelectAndHighlightType : ST_HighlightType, myCurrentSelection); + storeSelection(aHasShift ? ST_SelectAndHighlightType : ST_HighlightType, + myCurrentSelection); if (myCurrentSelection.empty()) { if (isSketchOpe && (!isSketcher)) @@ -470,26 +485,28 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE } else if (isSketchOpe && isEditing) { // If selected another object commit current result bool aPrevLaunchingState = myIsEditLaunching; - /// store editing state for Edit operation in order to do not clear highlight by restart - /// of edit operation. - /// Internal edit should not be stored as editing operation as the result will be a - /// creation operation, where previous selection should not be used(and will be cleared) - myIsEditLaunching = !myModule->sketchReentranceMgr()->isInternalEditActive(); + /// store editing state for Edit operation in order to do not clear + /// highlight by restart of edit operation. Internal edit should not be + /// stored as editing operation as the result will be a creation + /// operation, where previous selection should not be used(and will be + /// cleared) + myIsEditLaunching = + !myModule->sketchReentranceMgr()->isInternalEditActive(); std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aFOperation->feature()); + std::dynamic_pointer_cast( + aFOperation->feature()); bool isRelaunchEditing = true; if (aSPFeature->isExternal()) { - foreach(FeaturePtr aF, myCurrentSelection.keys()) { - FeaturePtr aProducerFeature = PartSet_Tools::findRefsToMeFeature(aF, - aSPFeature->getKind()); + foreach (FeaturePtr aF, myCurrentSelection.keys()) { + FeaturePtr aProducerFeature = + PartSet_Tools::findRefsToMeFeature(aF, aSPFeature->getKind()); if (aProducerFeature == aSPFeature) { isRelaunchEditing = false; break; } } - } - else { + } else { if (myCurrentSelection.size() > 1) isRelaunchEditing = !myCurrentSelection.contains(aSPFeature); } @@ -510,14 +527,15 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE myIsEditLaunching = aPrevLaunchingState; if (aFeature.get() != NULL) { std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get() && - (aSketchFeature->getKind() == SketchPlugin_ConstraintRadius::ID() || - aSketchFeature->getKind() == SketchPlugin_ConstraintAngle::ID())) { + (aSketchFeature->getKind() == SketchPlugin_ConstraintRadius::ID() || + aSketchFeature->getKind() == SketchPlugin_ConstraintAngle::ID())) { DataPtr aData = aSketchFeature->data(); - AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); + AttributePtr aAttr = + aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); std::shared_ptr aFPAttr = - std::dynamic_pointer_cast(aAttr); + std::dynamic_pointer_cast(aAttr); aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY); } } @@ -525,10 +543,10 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE } } -void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) -{ - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - ModuleBase_IViewer* aViewer = aWorkshop->viewer(); +void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) { + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + ModuleBase_IViewer *aViewer = aWorkshop->viewer(); if (myIsDragging) aViewer->enableDrawMode(myPreviousDrawModeEnabled); @@ -538,13 +556,14 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse if (myModule->sketchReentranceMgr()->processMouseReleased(theWnd, theEvent)) { return; } - // if mouse is pressed when it was over view and at release the mouse is out of view, do nothing + // if mouse is pressed when it was over view and at release the mouse is out + // of view, do nothing if (!myIsMouseOverViewProcessed) { return; } - ModuleBase_OperationFeature* aOp = - dynamic_cast(getCurrentOperation()); + ModuleBase_OperationFeature *aOp = + dynamic_cast(getCurrentOperation()); bool isEditing = false; if (aOp) { isEditing = aOp->isEditOperation(); @@ -561,15 +580,15 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse restoreSelection(myCurrentSelection); myCurrentSelection.clear(); } - } - else { + } else { if (isNestedSketchOperation(aOp)) { // Only for sketcher operations if (aWasDragging) { if (myDragDone) { - /// the previous selection is lost by mouse release in the viewer(Select method), but - /// it is still stored in myCurrentSelection. So, it is possible to restore selection - /// It is important for drag(edit with mouse) of sketch entities. + /// the previous selection is lost by mouse release in the + /// viewer(Select method), but it is still stored in + /// myCurrentSelection. So, it is possible to restore selection It + /// is important for drag(edit with mouse) of sketch entities. restoreSelection(myCurrentSelection); myCurrentSelection.clear(); } @@ -578,10 +597,11 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse } } - ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); - PartSet_MouseProcessor* aProcessor = dynamic_cast(anActiveWidget); + ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); + PartSet_MouseProcessor *aProcessor = + dynamic_cast(anActiveWidget); if (aProcessor) { - ModuleBase_ISelection* aSelection = aWorkshop->selection(); + ModuleBase_ISelection *aSelection = aWorkshop->selection(); QList aPreSelected = aSelection->getHighlighted(); if (MyModeByDrag && !aPreSelected.empty() && !isEditing) aProcessor->setPreSelection(aPreSelected.first(), theWnd, theEvent); @@ -606,51 +626,59 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse } } -void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) -{ +void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) { #ifdef DEBUG_SKETCH_ENTITIES_ON_MOVE CompositeFeaturePtr aSketch = activeSketch(); if (aSketch.get()) { - std::cout << "mouse move SKETCH FEATURES [" << aSketch->numberOfSubs() << "]:" << std::endl; + std::cout << "mouse move SKETCH FEATURES [" << aSketch->numberOfSubs() + << "]:" << std::endl; QStringList anInfo; for (int i = 0, aNbSubs = aSketch->numberOfSubs(); i < aNbSubs; i++) { - //std::cout << getFeatureInfo(aSketch->subFeature(i), false) << std::endl; + // std::cout << getFeatureInfo(aSketch->subFeature(i), false) << + // std::endl; anInfo.append(ModuleBase_Tools::objectInfo(aSketch->subFeature(i))); } QString anInfoStr = anInfo.join("\n"); - qDebug(QString("%1").arg(anInfo.size()).arg(anInfoStr).toStdString().c_str()); + qDebug( + QString("%1").arg(anInfo.size()).arg(anInfoStr).toStdString().c_str()); } #endif if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent)) return; - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(aWorkshop); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); if (isNestedCreateOperation(getCurrentOperation(), activeSketch())) { #ifdef DRAGGING_DEBUG QTime t; t.start(); #endif - // 1. perform the widget mouse move functionality and display the presentation - // the mouse move should be processed in the widget, if it can in order to visualize correct - // presentation. These widgets correct the feature attribute according to the mouse position - ModuleBase_ModelWidget* anActiveWidget = myModule->activeWidget(); - PartSet_MouseProcessor* aProcessor = dynamic_cast(anActiveWidget); + // 1. perform the widget mouse move functionality and display the + // presentation the mouse move should be processed in the widget, if it can + // in order to visualize correct presentation. These widgets correct the + // feature attribute according to the mouse position + ModuleBase_ModelWidget *anActiveWidget = myModule->activeWidget(); + PartSet_MouseProcessor *aProcessor = + dynamic_cast(anActiveWidget); if (aProcessor) aProcessor->mouseMoved(theWnd, theEvent); if (!myIsMouseOverViewProcessed) { myIsMouseOverViewProcessed = true; - // the feature is to be erased here, but it is correct to call canDisplayObject because - // there can be additional check (e.g. editor widget in distance constraint) - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); + // the feature is to be erased here, but it is correct to call + // canDisplayObject because there can be additional check (e.g. editor + // widget in distance constraint) + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); - visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature)); + visualizeFeature(aFeature, aFOperation->isEditOperation(), + canDisplayObject(aFeature)); } } aDisplayer->updateViewer(); @@ -658,15 +686,17 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve cout << "Mouse move processing " << t.elapsed() << endl; #endif } - //myClickedPoint.clear(); + // myClickedPoint.clear(); if (myIsDragging || myNoDragMoving) { - // 1. the current selection is saved in the mouse press method in order to restore it after + // 1. the current selection is saved in the mouse press method in order to + // restore it after // moving - // 2. the enable selection in the viewer should be temporary switched off in order to ignore - // mouse press signal in the viewer(it call Select for AIS context and the dragged objects are - // deselected). This flag should be restored in the slot, processed the mouse release signal. - ModuleBase_Operation* aCurrentOperation = getCurrentOperation(); + // 2. the enable selection in the viewer should be temporary switched off in + // order to ignore mouse press signal in the viewer(it call Select for AIS + // context and the dragged objects are deselected). This flag should be + // restored in the slot, processed the mouse release signal. + ModuleBase_Operation *aCurrentOperation = getCurrentOperation(); if (!aCurrentOperation) return; if (isSketchOperation(aCurrentOperation)) @@ -681,20 +711,24 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve Point aMousePnt; get2dPoint(theWnd, theEvent, aMousePnt); - std::shared_ptr anOriginalPosition = std::shared_ptr( - new GeomAPI_Pnt2d(myCurrentPoint.myCurX, myCurrentPoint.myCurY)); - std::shared_ptr aCurrentPosition = std::shared_ptr( - new GeomAPI_Pnt2d(aMousePnt.myCurX, aMousePnt.myCurY)); - - // 3. the flag to disable the update viewer should be set in order to avoid blinking in the - // viewer happens by deselect/select the modified objects. The flag should be restored after - // the selection processing. The update viewer should be also called. + std::shared_ptr anOriginalPosition = + std::shared_ptr( + new GeomAPI_Pnt2d(myCurrentPoint.myCurX, myCurrentPoint.myCurY)); + std::shared_ptr aCurrentPosition = + std::shared_ptr( + new GeomAPI_Pnt2d(aMousePnt.myCurX, aMousePnt.myCurY)); + + // 3. the flag to disable the update viewer should be set in order to avoid + // blinking in the viewer happens by deselect/select the modified objects. + // The flag should be restored after the selection processing. The update + // viewer should be also called. bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false); static Events_ID aMoveEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED); - //static Events_ID aUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + // static Events_ID aUpdateEvent = + // Events_Loop::eventByName(EVENT_OBJECT_UPDATED); FeatureToSelectionMap::const_iterator anIt = myCurrentSelection.begin(), - aLast = myCurrentSelection.end(); + aLast = myCurrentSelection.end(); // 4. the features and attributes modification(move) bool isModified = false; for (; anIt != aLast; anIt++) { @@ -703,8 +737,10 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve std::map anAttributes = anIt.value().myAttributes; // Process selection by attribute: the priority to the attribute if (!anAttributes.empty()) { - std::map::const_iterator anAttIt = anAttributes.begin(), - anAttLast = anAttributes.end(); + std::map::const_iterator anAttIt = + anAttributes.begin(), + anAttLast = + anAttributes.end(); for (; anAttIt != anAttLast; anAttIt++) { AttributePtr anAttr = anAttIt->first; if (anAttr.get() == NULL) @@ -717,8 +753,9 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve aPoint->attributeType() == GeomDataAPI_Point2DArray::typeId()) { bool isImmutable = aPoint->setImmutable(true); - std::shared_ptr aMessage = std::shared_ptr - (new ModelAPI_ObjectMovedMessage(this)); + std::shared_ptr aMessage = + std::shared_ptr( + new ModelAPI_ObjectMovedMessage(this)); aMessage->setMovedAttribute(aPoint, anAttIt->second); aMessage->setOriginalPosition(anOriginalPosition); aMessage->setCurrentPosition(aCurrentPosition); @@ -729,14 +766,14 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve } } } - } - else { + } else { // Process selection by feature std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aSketchFeature) { - std::shared_ptr aMessage = std::shared_ptr - (new ModelAPI_ObjectMovedMessage(this)); + std::shared_ptr aMessage = + std::shared_ptr( + new ModelAPI_ObjectMovedMessage(this)); aMessage->setMovedObject(aFeature); aMessage->setOriginalPosition(anOriginalPosition); aMessage->setCurrentPosition(aCurrentPosition); @@ -745,15 +782,18 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve } } } - // the modified state of the current operation should be updated if there are features, which - // were changed here + // the modified state of the current operation should be updated if there + // are features, which were changed here if (isModified) { aCurrentOperation->onValuesChanged(); - Events_Loop::loop()->flush(aMoveEvent); // up all move events - to be processed in the solver + Events_Loop::loop()->flush( + aMoveEvent); // up all move events - to be processed in the solver } - //Events_Loop::loop()->flush(aUpdateEvent); // up update events - to redisplay presentations + // Events_Loop::loop()->flush(aUpdateEvent); // up update events - to + // redisplay presentations - // 5. it is necessary to save current selection in order to restore it after the features moving + // 5. it is necessary to save current selection in order to restore it after + // the features moving restoreSelection(myCurrentSelection); // 6. restore the update viewer flag and call this update aDisplayer->enableUpdateViewer(isEnableUpdateViewer); @@ -768,24 +808,25 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve } } -void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); +void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (aFOperation && aFOperation->isEditOperation()) { std::string aId = aFOperation->id().toStdString(); - if (isDistanceOperation(aFOperation)) - { + if (isDistanceOperation(aFOperation)) { // Activate dimension value editing on double click - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - QList aWidgets = aPanel->modelWidgets(); + ModuleBase_IPropertyPanel *aPanel = aFOperation->propertyPanel(); + QList aWidgets = aPanel->modelWidgets(); // Find corresponded widget to activate value editing - foreach (ModuleBase_ModelWidget* aWgt, aWidgets) { + foreach (ModuleBase_ModelWidget *aWgt, aWidgets) { std::string anId = aWgt->attributeID(); if (anId == SketchPlugin_Constraint::VALUE() || - anId == SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID() || - anId == SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()) { - PartSet_WidgetEditor* anEditor = dynamic_cast(aWgt); + anId == SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID() || + anId == + SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()) { + PartSet_WidgetEditor *anEditor = + dynamic_cast(aWgt); if (anEditor) anEditor->showPopupEditor(); return; @@ -795,64 +836,62 @@ void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMo } } -void PartSet_SketcherMgr::onApplicationStarted() -{ - ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(anIWorkshop); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - PartSet_SketcherReentrantMgr* aReentranceMgr = myModule->sketchReentranceMgr(); +void PartSet_SketcherMgr::onApplicationStarted() { + ModuleBase_IWorkshop *anIWorkshop = myModule->workshop(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(anIWorkshop); + XGUI_Workshop *aWorkshop = aConnector->workshop(); + PartSet_SketcherReentrantMgr *aReentranceMgr = + myModule->sketchReentranceMgr(); - XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); + XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel(); if (aPropertyPanel) { - //connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)), - // this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*))); + // connect(aPropertyPanel, + // SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)), + // this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*))); - connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)), - aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&))); - //connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), - // aReentranceMgr, SLOT(onWidgetActivated())); + connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string &)), + aReentranceMgr, SLOT(onNoMoreWidgets(const std::string &))); + // connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), + // aReentranceMgr, SLOT(onWidgetActivated())); } - XGUI_ViewerProxy* aViewerProxy = aWorkshop->viewer(); + XGUI_ViewerProxy *aViewerProxy = aWorkshop->viewer(); connect(aViewerProxy, SIGNAL(enterViewPort()), this, SLOT(onEnterViewPort())); connect(aViewerProxy, SIGNAL(leaveViewPort()), this, SLOT(onLeaveViewPort())); - XGUI_ContextMenuMgr* aContextMenuMgr = aWorkshop->contextMenuMgr(); - connect(aContextMenuMgr, SIGNAL(beforeContextMenu()), this, SLOT(onBeforeContextMenu())); - connect(aContextMenuMgr, SIGNAL(afterContextMenu()), this, SLOT(onAfterContextMenu())); + XGUI_ContextMenuMgr *aContextMenuMgr = aWorkshop->contextMenuMgr(); + connect(aContextMenuMgr, SIGNAL(beforeContextMenu()), this, + SLOT(onBeforeContextMenu())); + connect(aContextMenuMgr, SIGNAL(afterContextMenu()), this, + SLOT(onAfterContextMenu())); } -//void PartSet_SketcherMgr::onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget) +// void PartSet_SketcherMgr::onBeforeWidgetActivated(ModuleBase_ModelWidget* +// theWidget) //{ - //if (!myClickedPoint.myIsInitialized) - // return; - - //ModuleBase_Operation* aOperation = getCurrentOperation(); - // the distance constraint feature should not use the clickedd point - // this is workaround in order to don't throw down the flyout point value, - // set by execute() method of these type of features - //if (isDistanceOperation(aOperation)) - // return; - - //PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast(theWidget); - //if (aPnt2dWgt) { - // aPnt2dWgt->setPoint(myClickedPoint.myCurX, myClickedPoint.myCurY); - //} +// if (!myClickedPoint.myIsInitialized) +// return; + +// ModuleBase_Operation* aOperation = getCurrentOperation(); +// the distance constraint feature should not use the clickedd point +// this is workaround in order to don't throw down the flyout point value, +// set by execute() method of these type of features +// if (isDistanceOperation(aOperation)) +// return; + +// PartSet_WidgetPoint2D* aPnt2dWgt = +// dynamic_cast(theWidget); if (aPnt2dWgt) { +// aPnt2dWgt->setPoint(myClickedPoint.myCurX, myClickedPoint.myCurY); +// } //} -void PartSet_SketcherMgr::onBeforeContextMenu() -{ - myIsPopupMenuActive = true; -} +void PartSet_SketcherMgr::onBeforeContextMenu() { myIsPopupMenuActive = true; } -void PartSet_SketcherMgr::onAfterContextMenu() -{ - myIsPopupMenuActive = false; -} +void PartSet_SketcherMgr::onAfterContextMenu() { myIsPopupMenuActive = false; } -void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent, - Point& thePoint) -{ +void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent, Point &thePoint) { Handle(V3d_View) aView = theWnd->v3dView(); gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView); double aX, anY; @@ -860,23 +899,22 @@ void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent thePoint.setValue(aX, anY); } -void PartSet_SketcherMgr::launchEditing() -{ +void PartSet_SketcherMgr::launchEditing() { if (!myCurrentSelection.empty()) { FeaturePtr aFeature = myCurrentSelection.begin().key(); std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aSPFeature) { if (!aSPFeature->isExternal()) myModule->editFeature(aSPFeature); else { // need to edit a feature (Projection/IntersectionPoint), // which produces current External feature - FeaturePtr aProducerFeature = PartSet_Tools::findRefsToMeFeature(aFeature, - SketchPlugin_Projection::ID()); + FeaturePtr aProducerFeature = PartSet_Tools::findRefsToMeFeature( + aFeature, SketchPlugin_Projection::ID()); if (!aProducerFeature.get()) - aProducerFeature = PartSet_Tools::findRefsToMeFeature(aFeature, - SketchPlugin_IntersectionPoint::ID()); + aProducerFeature = PartSet_Tools::findRefsToMeFeature( + aFeature, SketchPlugin_IntersectionPoint::ID()); if (aProducerFeature.get()) myModule->editFeature(aProducerFeature); } @@ -884,39 +922,37 @@ void PartSet_SketcherMgr::launchEditing() } } -bool PartSet_SketcherMgr::sketchSolverError() -{ +bool PartSet_SketcherMgr::sketchSolverError() { bool anError = false; CompositeFeaturePtr aSketch = activeSketch(); if (aSketch.get()) { - AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR()); + AttributeStringPtr aAttributeString = + aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR()); anError = !aAttributeString->value().empty(); } return anError; } -QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature) -{ +QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr &theFeature) { QString anError; if (!theFeature.get() || !theFeature->data()->isValid()) return anError; CompositeFeaturePtr aSketch = activeSketch(); if (aSketch.get() && aSketch == theFeature) { - std::string aSolverError = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR())->value(); + std::string aSolverError = + aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR())->value(); anError = ModuleBase_Tools::translate(aSketch->getKind(), aSolverError); } return anError; } -void PartSet_SketcherMgr::clearClickedFlags() -{ - //myClickedPoint.clear(); +void PartSet_SketcherMgr::clearClickedFlags() { + // myClickedPoint.clear(); myCurrentPoint.clear(); } -const QStringList& PartSet_SketcherMgr::replicationsIdList() -{ +const QStringList &PartSet_SketcherMgr::replicationsIdList() { static QStringList aReplicationIds; if (aReplicationIds.size() == 0) { aReplicationIds << SketchPlugin_ConstraintMirror::ID().c_str(); @@ -926,8 +962,7 @@ const QStringList& PartSet_SketcherMgr::replicationsIdList() return aReplicationIds; } -const QStringList& PartSet_SketcherMgr::constraintsIdList() -{ +const QStringList &PartSet_SketcherMgr::constraintsIdList() { static QStringList aConstraintIds; if (aConstraintIds.size() == 0) { aConstraintIds << SketchPlugin_ConstraintLength::ID().c_str(); @@ -954,9 +989,8 @@ const QStringList& PartSet_SketcherMgr::constraintsIdList() return aConstraintIds; } -void PartSet_SketcherMgr::sketchSelectionModes(const CompositeFeaturePtr& theSketch, - QIntList& theModes) -{ +void PartSet_SketcherMgr::sketchSelectionModes( + const CompositeFeaturePtr &theSketch, QIntList &theModes) { if (!theSketch.get() || !PartSet_Tools::sketchPlane(theSketch).get()) return; @@ -967,8 +1001,8 @@ void PartSet_SketcherMgr::sketchSelectionModes(const CompositeFeaturePtr& theSke theModes.append(TopAbs_EDGE); } -Handle(AIS_InteractiveObject) PartSet_SketcherMgr::createPresentation(const ObjectPtr& theObj) -{ +Handle(AIS_InteractiveObject) + PartSet_SketcherMgr::createPresentation(const ObjectPtr &theObj) { Handle(AIS_InteractiveObject) aPrs; FeaturePtr aFeature = ModelAPI_Feature::feature(theObj); @@ -980,21 +1014,22 @@ Handle(AIS_InteractiveObject) PartSet_SketcherMgr::createPresentation(const Obje return aPrs; } -bool PartSet_SketcherMgr::isSketchOperation(ModuleBase_Operation* theOperation) -{ - return theOperation && theOperation->id().toStdString() == SketchPlugin_Sketch::ID(); +bool PartSet_SketcherMgr::isSketchOperation( + ModuleBase_Operation *theOperation) { + return theOperation && + theOperation->id().toStdString() == SketchPlugin_Sketch::ID(); } -bool PartSet_SketcherMgr::isNestedSketchOperation(ModuleBase_Operation* theOperation) const -{ +bool PartSet_SketcherMgr::isNestedSketchOperation( + ModuleBase_Operation *theOperation) const { bool aNestedSketch = false; FeaturePtr anActiveSketch = activeSketch(); if (anActiveSketch.get() && theOperation) { - ModuleBase_Operation* aSketchOperation = operationMgr()->findOperation( - anActiveSketch->getKind().c_str()); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_Operation *aSketchOperation = + operationMgr()->findOperation(anActiveSketch->getKind().c_str()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aSketchOperation && aFOperation) { FeaturePtr aFeature = aFOperation->feature(); if (aFeature.get()) { @@ -1006,14 +1041,14 @@ bool PartSet_SketcherMgr::isNestedSketchOperation(ModuleBase_Operation* theOpera return aNestedSketch; } -bool PartSet_SketcherMgr::isNestedSketchFeature(const QString& theFeatureKind) const -{ +bool PartSet_SketcherMgr::isNestedSketchFeature( + const QString &theFeatureKind) const { bool aNestedSketch = false; FeaturePtr anActiveSketch = activeSketch(); if (anActiveSketch.get()) { - ModuleBase_Operation* aSketchOperation = operationMgr()->findOperation( - anActiveSketch->getKind().c_str()); + ModuleBase_Operation *aSketchOperation = + operationMgr()->findOperation(anActiveSketch->getKind().c_str()); if (aSketchOperation) { QStringList aGrantedOpIds = aSketchOperation->grantedOperationIds(); aNestedSketch = aGrantedOpIds.contains(theFeatureKind); @@ -1022,26 +1057,25 @@ bool PartSet_SketcherMgr::isNestedSketchFeature(const QString& theFeatureKind) c return aNestedSketch; } -bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOperation, - const CompositeFeaturePtr& theSketch) const -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); +bool PartSet_SketcherMgr::isNestedCreateOperation( + ModuleBase_Operation *theOperation, + const CompositeFeaturePtr &theSketch) const { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); return aFOperation && !aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation); } -bool PartSet_SketcherMgr::isNestedEditOperation(ModuleBase_Operation* theOperation, - const CompositeFeaturePtr& theSketch) const -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); +bool PartSet_SketcherMgr::isNestedEditOperation( + ModuleBase_Operation *theOperation, + const CompositeFeaturePtr &theSketch) const { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); return aFOperation && aFOperation->isEditOperation() && - isNestedSketchOperation(aFOperation); + isNestedSketchOperation(aFOperation); } -bool PartSet_SketcherMgr::isEntity(const std::string& theId) -{ +bool PartSet_SketcherMgr::isEntity(const std::string &theId) { return (theId == SketchPlugin_Line::ID()) || (theId == SketchPlugin_Point::ID()) || (theId == SketchPlugin_Arc::ID()) || @@ -1052,22 +1086,20 @@ bool PartSet_SketcherMgr::isEntity(const std::string& theId) (theId == SketchPlugin_EllipticArc::ID()); } -bool PartSet_SketcherMgr::isExternalFeature(const FeaturePtr& theFeature) -{ +bool PartSet_SketcherMgr::isExternalFeature(const FeaturePtr &theFeature) { std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(theFeature); + std::dynamic_pointer_cast(theFeature); return aSPFeature.get() && aSPFeature->isExternal(); } -bool PartSet_SketcherMgr::isDistanceOperation(ModuleBase_Operation* theOperation) -{ +bool PartSet_SketcherMgr::isDistanceOperation( + ModuleBase_Operation *theOperation) { std::string anId = theOperation ? theOperation->id().toStdString() : ""; return isDistanceKind(anId); } -bool PartSet_SketcherMgr::isDistanceKind(std::string& theKind) -{ +bool PartSet_SketcherMgr::isDistanceKind(std::string &theKind) { return (theKind == SketchPlugin_ConstraintLength::ID()) || (theKind == SketchPlugin_ConstraintDistance::ID()) || (theKind == SketchPlugin_ConstraintRadius::ID()) || @@ -1077,13 +1109,14 @@ bool PartSet_SketcherMgr::isDistanceKind(std::string& theKind) (theKind == SketchPlugin_ConstraintDistanceAlongDir::ID()); } -void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) -{ - static Events_ID EVENT_ATTR = Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES); - static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); +void PartSet_SketcherMgr::startSketch(ModuleBase_Operation *theOperation) { + static Events_ID EVENT_ATTR = + Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES); + static Events_ID EVENT_DISP = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (!aFOperation) return; @@ -1092,18 +1125,21 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) myModule->onViewTransformed(); // Display all sketcher sub-Objects - myCurrentSketch = std::dynamic_pointer_cast(aFOperation->feature()); + myCurrentSketch = std::dynamic_pointer_cast( + aFOperation->feature()); double aSizeOfView = 0; std::shared_ptr aCentralPoint; // Reset size of view from previous launches mySketchPlane->setSizeOfView(aSizeOfView, false, aCentralPoint); if (aFOperation->isEditOperation() && - mySketchPlane->getDefaultSizeOfView(myCurrentSketch, aSizeOfView, aCentralPoint)) { + mySketchPlane->getDefaultSizeOfView(myCurrentSketch, aSizeOfView, + aCentralPoint)) { mySketchPlane->setSizeOfView(aSizeOfView, true, aCentralPoint); } mySketchPlane->createSketchPlane(myCurrentSketch, myModule->workshop()); - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); + XGUI_ModuleConnector *aConnector = + dynamic_cast(myModule->workshop()); // Hide sketcher result std::list aResults = myCurrentSketch->results(); @@ -1115,7 +1151,7 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) // Remove invalid sketch entities std::set anInvalidFeatures; - ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aFactory = ModelAPI_Session::get()->validators(); int aNumberOfSubs = myCurrentSketch->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { FeaturePtr aFeature = myCurrentSketch->subFeature(i); @@ -1125,38 +1161,47 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) } } if (!anInvalidFeatures.empty()) { - std::map > aReferences; + std::map> aReferences; ModelAPI_Tools::findAllReferences(anInvalidFeatures, aReferences, false); std::set::const_iterator anIt = anInvalidFeatures.begin(), aLast = anInvalidFeatures.end(); - // separate features to references to parameter features and references to others + // separate features to references to parameter features and references to + // others QStringList anInvalidFeatureNames; for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature.get()) anInvalidFeatureNames.append(QString::fromStdWString(aFeature->name())); } - std::string aPrefixInfo = QString("Invalid features of the sketch will be deleted: %1.\n\n"). - arg(anInvalidFeatureNames.join(", ")).toStdString().c_str(); + std::string aPrefixInfo = + QString("Invalid features of the sketch will be deleted: %1.\n\n") + .arg(anInvalidFeatureNames.join(", ")) + .toStdString() + .c_str(); std::set aFeatureRefsToDelete; - if (ModuleBase_Tools::askToDelete(anInvalidFeatures, aReferences, aConnector->desktop(), + if (ModuleBase_Tools::askToDelete(anInvalidFeatures, aReferences, + aConnector->desktop(), aFeatureRefsToDelete, aPrefixInfo)) { if (!aFeatureRefsToDelete.empty()) - anInvalidFeatures.insert(aFeatureRefsToDelete.begin(), aFeatureRefsToDelete.end()); + anInvalidFeatures.insert(aFeatureRefsToDelete.begin(), + aFeatureRefsToDelete.end()); ModelAPI_Tools::removeFeatures(anInvalidFeatures, true); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - // TODO: call the next method in the XGUI_OperationMgr::onOperationStarted(). + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + // TODO: call the next method in the + // XGUI_OperationMgr::onOperationStarted(). workshop()->errorMgr()->updateAcceptAllAction(myCurrentSketch); } } - // update state of overconstraint listener should be done before sketch features/results - // display (as the display will ask custom color from the listener) + // update state of overconstraint listener should be done before sketch + // features/results display (as the display will ask custom color from the + // listener) myModule->overconstraintListener()->setActive(true); // Display sketcher objects QStringList anInfo; - const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); aNumberOfSubs = myCurrentSketch->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { FeaturePtr aFeature = myCurrentSketch->subFeature(i); @@ -1179,12 +1224,17 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) } #ifdef DEBUG_SKETCHER_ENTITIES QString anInfoStr = anInfo.join(";\t"); - qDebug(QString("startSketch: %1, %2").arg(anInfo.size()).arg(anInfoStr).toStdString().c_str()); + qDebug(QString("startSketch: %1, %2") + .arg(anInfo.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif std::shared_ptr aPln; aPln = PartSet_Tools::sketchPlane(myCurrentSketch); - Handle(SelectMgr_Filter) aFilter = myModule->selectionFilter(SF_SketchPlaneFilter); + Handle(SelectMgr_Filter) aFilter = + myModule->selectionFilter(SF_SketchPlaneFilter); if (!aFilter.IsNull()) Handle(ModuleBase_ShapeInPlaneFilter)::DownCast(aFilter)->setPlane(aPln); @@ -1194,18 +1244,20 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) Events_Loop::loop()->flush(EVENT_ATTR); Events_Loop::loop()->flush(EVENT_DISP); - myExternalPointsMgr = new PartSet_ExternalPointsMgr(myModule->workshop(), myCurrentSketch); + myExternalPointsMgr = + new PartSet_ExternalPointsMgr(myModule->workshop(), myCurrentSketch); workshop()->viewer()->set2dMode(true); - PartSet_Fitter* aFitter = new PartSet_Fitter(this); + PartSet_Fitter *aFitter = new PartSet_Fitter(this); myModule->workshop()->viewer()->setFitter(aFitter); } -void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - PartSet_Fitter* aFitter = (PartSet_Fitter*)myModule->workshop()->viewer()->fitter(); +void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation *theOperation) { + XGUI_ModuleConnector *aConnector = + dynamic_cast(myModule->workshop()); + PartSet_Fitter *aFitter = + (PartSet_Fitter *)myModule->workshop()->viewer()->fitter(); myModule->workshop()->viewer()->setFitter(0); delete aFitter; @@ -1222,7 +1274,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) DataPtr aData = myCurrentSketch->data(); if (!aData->isValid()) { - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); // The sketch was aborted myCurrentSketch = CompositeFeaturePtr(); mySketchPlane->eraseSketchPlane(myModule->workshop()); @@ -1234,8 +1286,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) if (!aObjData->isValid()) aObj->setDisplayed(false); } - } - else { + } else { // Hide all sketcher sub-Objects int aNumberOfSubs = myCurrentSketch->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { @@ -1250,16 +1301,17 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) // Display sketcher result std::list aResults = myCurrentSketch->results(); std::list::const_iterator aIt; - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { if (!aFOperation->isDisplayedOnStart(*aIt)) { (*aIt)->setDisplayed(true); - // this display event is needed because sketch already may have "displayed" state, - // but not displayed while it is still active (issue 613, abort of existing sketch) + // this display event is needed because sketch already may have + // "displayed" state, but not displayed while it is still active (issue + // 613, abort of existing sketch) ModelAPI_EventCreator::get()->sendUpdated(*aIt, aDispEvent); } } @@ -1276,24 +1328,24 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) workshop()->viewer()->set2dMode(false); } -void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation) -{ +void PartSet_SketcherMgr::startNestedSketch( + ModuleBase_Operation *theOperation) { if (canChangeCursor(theOperation) && myIsMouseOverWindow) { - QCursor* aCurrentCursor = QApplication::overrideCursor(); + QCursor *aCurrentCursor = QApplication::overrideCursor(); if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) { QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor()); -//#ifdef DEBUG_CURSOR -// qDebug("startNestedSketch() : Qt::CrossCursor"); -//#endif + //#ifdef DEBUG_CURSOR + // qDebug("startNestedSketch() : Qt::CrossCursor"); + //#endif } } } -void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation) -{ +void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation *theOperation) { myIsMouseOverViewProcessed = true; operationMgr()->onValidateOperation(); - // when sketch nested operation is stopped the cursor should be restored unconditionally + // when sketch nested operation is stopped the cursor should be restored + // unconditionally if (canChangeCursor(theOperation)) { QApplication::restoreOverrideCursor(); #ifdef DEBUG_CURSOR @@ -1304,11 +1356,12 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation) // returning to the neutral point of the Sketcher bool isClearSelectionPossible = true; if (myIsEditLaunching) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); - if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind())) { + if (aFeature.get() && + PartSet_SketcherMgr::isEntity(aFeature->getKind())) { isClearSelectionPossible = false; } } @@ -1319,15 +1372,16 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation) onShowPoints(true); } -void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation) -{ +void PartSet_SketcherMgr::commitNestedSketch( + ModuleBase_Operation *theOperation) { if (isNestedCreateOperation(theOperation, activeSketch())) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); // it is necessary to check the the feature data validity because - // some kind of features are removed by an operation commit(the macro state of a feature) + // some kind of features are removed by an operation commit(the macro + // state of a feature) if (aFeature.get() && aFeature->data()->isValid()) { visualizeFeature(aFeature, aFOperation->isEditOperation(), true); } @@ -1335,34 +1389,35 @@ void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation) } } -bool PartSet_SketcherMgr::sketchSelectionFilter(const ModuleBase_SelectionFilterType theFilterType) -{ - return mySelectionFilterTypes.find(theFilterType) != mySelectionFilterTypes.end(); +bool PartSet_SketcherMgr::sketchSelectionFilter( + const ModuleBase_SelectionFilterType theFilterType) { + return mySelectionFilterTypes.find(theFilterType) != + mySelectionFilterTypes.end(); } void PartSet_SketcherMgr::registerSelectionFilter( - const ModuleBase_SelectionFilterType theFilterType, const Handle(SelectMgr_Filter)& theFilter) -{ + const ModuleBase_SelectionFilterType theFilterType, + const Handle(SelectMgr_Filter) & theFilter) { mySelectionFilterTypes.insert(theFilterType); myModule->registerSelectionFilter(theFilterType, theFilter); } -bool PartSet_SketcherMgr::operationActivatedByPreselection() -{ +bool PartSet_SketcherMgr::operationActivatedByPreselection() { bool isOperationStopped = false; - ModuleBase_Operation* anOperation = getCurrentOperation(); - if(anOperation && isNestedSketchOperation(anOperation)) { + ModuleBase_Operation *anOperation = getCurrentOperation(); + if (anOperation && isNestedSketchOperation(anOperation)) { // Set final definitions if they are necessary - //propertyPanelDefined(aOperation); + // propertyPanelDefined(aOperation); /// Commit sketcher operations automatically - /// distance operation are able to show popup editor to modify the distance value - /// after entering the value, the operation should be committed/aborted(by Esc key) + /// distance operation are able to show popup editor to modify the distance + /// value after entering the value, the operation should be + /// committed/aborted(by Esc key) bool aCanCommitOperation = true; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(anOperation); if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation)) { - bool aValueAccepted = setDistanceValueByPreselection(anOperation, myModule->workshop(), - aCanCommitOperation); + bool aValueAccepted = setDistanceValueByPreselection( + anOperation, myModule->workshop(), aCanCommitOperation); if (!aValueAccepted) return isOperationStopped; } @@ -1377,63 +1432,61 @@ bool PartSet_SketcherMgr::operationActivatedByPreselection() return isOperationStopped; } -bool PartSet_SketcherMgr::canUndo() const -{ +bool PartSet_SketcherMgr::canUndo() const { return isNestedCreateOperation(getCurrentOperation(), activeSketch()); } -bool PartSet_SketcherMgr::canRedo() const -{ +bool PartSet_SketcherMgr::canRedo() const { return isNestedCreateOperation(getCurrentOperation(), activeSketch()); } -bool PartSet_SketcherMgr::canEraseObject(const ObjectPtr& theObject) const -{ +bool PartSet_SketcherMgr::canEraseObject(const ObjectPtr &theObject) const { bool aCanErase = true; - // when the sketch operation is active, results of sketch sub-feature can not be hidden + // when the sketch operation is active, results of sketch sub-feature can not + // be hidden if (myCurrentSketch.get()) { return !isObjectOfSketch(theObject); } return aCanErase; } -bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const -{ +bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr &theObject) const { bool aCanDisplay = true; bool aHasActiveSketch = activeSketch().get() != NULL; if (aHasActiveSketch) { - // 1. the sketch feature should not be displayed during the sketch active operation - // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch - // nested features can be visualized + // 1. the sketch feature should not be displayed during the sketch active + // operation it is hidden by a sketch operation start and shown by a sketch + // stop, just the sketch nested features can be visualized FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get() != NULL && aFeature == activeSketch()) { aCanDisplay = false; } std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); /// some sketch entities should be never shown, e.g. projection feature if (aSketchFeature.get()) aCanDisplay = aSketchFeature->canBeDisplayed(); - } - else { // there are no an active sketch - // 2. sketch sub-features should not be visualized if the sketch operation is not active + } else { // there are no an active sketch + // 2. sketch sub-features should not be visualized if the sketch operation + // is not active FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get() != NULL) { std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aFeature); + std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get()) { aCanDisplay = false; } } } - // 3. the method should not filter the objects, which are not related to the current operation. - // The object is filtered just if it is a current operation feature or this feature result + // 3. the method should not filter the objects, which are not related to the + // current operation. The object is filtered just if it is a current operation + // feature or this feature result if (aCanDisplay) { bool isObjectFound = false; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); if (aFeature.get()) { @@ -1441,7 +1494,8 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const if (theObject == aFeature) isObjectFound = true; else { - std::list::const_iterator anIt = aResults.begin(), aLast = aResults.end(); + std::list::const_iterator anIt = aResults.begin(), + aLast = aResults.end(); for (; anIt != aLast && !isObjectFound; anIt++) { isObjectFound = *anIt == theObject; } @@ -1449,36 +1503,41 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const } } if (isObjectFound) { - // 4. For created nested feature operation do not display the created feature if - // the mouse curstor leaves the OCC window. - // The correction cases, which ignores this condition: - // a. the property panel values modification - // b. the popup menu activated - // c. widget editor control - #ifndef DEBUG_DO_NOT_BY_ENTER +// 4. For created nested feature operation do not display the created feature if +// the mouse curstor leaves the OCC window. +// The correction cases, which ignores this condition: +// a. the property panel values modification +// b. the popup menu activated +// c. widget editor control +#ifndef DEBUG_DO_NOT_BY_ENTER if (isNestedCreateOperation(getCurrentOperation(), activeSketch())) { - ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); - ModuleBase_WidgetEditor* anEditorWdg = - anActiveWidget ? dynamic_cast(anActiveWidget) : 0; - // the active widget editor should not influence here. The presentation should be visible - // always when this widget is active. + ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); + ModuleBase_WidgetEditor *anEditorWdg = + anActiveWidget + ? dynamic_cast(anActiveWidget) + : 0; + // the active widget editor should not influence here. The presentation + // should be visible always when this widget is active. if (!anEditorWdg && !myIsPopupMenuActive) { // during a nested create operation, the feature is redisplayed only // if the mouse over view - // of there was a value modified in the property panel after the mouse left the view + // of there was a value modified in the property panel after the mouse + // left the view aCanDisplay = canDisplayCurrentCreatedFeature(); } } - #endif +#endif } } - // checks the sketcher constraints visibility according to active sketch check box states + // checks the sketcher constraints visibility according to active sketch check + // box states if (aCanDisplay) { bool aProcessed = false; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get()) { - bool aConstraintDisplayed = canDisplayConstraint(aFeature, PartSet_Tools::Any, aProcessed); + bool aConstraintDisplayed = + canDisplayConstraint(aFeature, PartSet_Tools::Any, aProcessed); if (aProcessed) aCanDisplay = aConstraintDisplayed; } @@ -1487,42 +1546,39 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const return aCanDisplay; } -bool PartSet_SketcherMgr::canDisplayConstraint(const FeaturePtr& theFeature, - const PartSet_Tools::ConstraintVisibleState& theState, - bool& isProcessed) const -{ +bool PartSet_SketcherMgr::canDisplayConstraint( + const FeaturePtr &theFeature, + const PartSet_Tools::ConstraintVisibleState &theState, + bool &isProcessed) const { bool aSwitchedOn = true; - const QStringList& aConstrIds = constraintsIdList(); + const QStringList &aConstrIds = constraintsIdList(); std::string aKind = theFeature->getKind(); if (aConstrIds.contains(QString(aKind.c_str()))) { switch (theState) { - case PartSet_Tools::Dimensional: { - bool isDistance = isDistanceKind(aKind); - if (isDistance) { - isProcessed = true; - aSwitchedOn = myIsConstraintsShown[theState]; - } - } - break; - case PartSet_Tools::Geometrical: { - bool isGeometrical = !isDistanceKind(aKind); - if (isGeometrical) { - isProcessed = true; - aSwitchedOn = myIsConstraintsShown[theState]; - } + case PartSet_Tools::Dimensional: { + bool isDistance = isDistanceKind(aKind); + if (isDistance) { + isProcessed = true; + aSwitchedOn = myIsConstraintsShown[theState]; } - break; - case PartSet_Tools::Any: { + } break; + case PartSet_Tools::Geometrical: { + bool isGeometrical = !isDistanceKind(aKind); + if (isGeometrical) { isProcessed = true; - bool isDistance = isDistanceKind(aKind); - if (isDistance) - aSwitchedOn = myIsConstraintsShown[PartSet_Tools::Dimensional]; - else - aSwitchedOn = myIsConstraintsShown[PartSet_Tools::Geometrical]; + aSwitchedOn = myIsConstraintsShown[theState]; } - break; + } break; + case PartSet_Tools::Any: { + isProcessed = true; + bool isDistance = isDistanceKind(aKind); + if (isDistance) + aSwitchedOn = myIsConstraintsShown[PartSet_Tools::Dimensional]; + else + aSwitchedOn = myIsConstraintsShown[PartSet_Tools::Geometrical]; + } break; default: break; } @@ -1530,11 +1586,12 @@ bool PartSet_SketcherMgr::canDisplayConstraint(const FeaturePtr& theFeature, return aSwitchedOn; } -/*void PartSet_SketcherMgr::processHiddenObject(const std::list& theObjects) +/*void PartSet_SketcherMgr::processHiddenObject(const std::list& +theObjects) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); - if (aFOperation && myCurrentSketch.get()) { + ModuleBase_OperationFeature* aFOperation = +dynamic_cast (getCurrentOperation()); if +(aFOperation && myCurrentSketch.get()) { // find results of the current operation // these results should not be proposed to be deleted FeaturePtr anOperationFeature = aFOperation->feature(); @@ -1547,12 +1604,12 @@ bool PartSet_SketcherMgr::canDisplayConstraint(const FeaturePtr& theFeature, std::set anObjectsToBeDeleted; QStringList anObjectsToBeDeletedNames; - std::list::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); - for (; anIt != aLast; anIt++) { - ObjectPtr anObject = *anIt; + std::list::const_iterator anIt = theObjects.begin(), aLast = +theObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; bool aCanErase = true; - // when the sketch operation is active, results of sketch sub-feature can not be hidden - ResultPtr aResult = std::dynamic_pointer_cast(anObject); + // when the sketch operation is active, results of sketch sub-feature can +not be hidden ResultPtr aResult = +std::dynamic_pointer_cast(anObject); // the result is found between current feature results if (anOperationResults.find(aResult) != anOperationResults.end()) continue; @@ -1563,41 +1620,37 @@ bool PartSet_SketcherMgr::canDisplayConstraint(const FeaturePtr& theFeature, FeaturePtr aFeature = myCurrentSketch->subFeature(i); std::list aResults = aFeature->results(); std::list::const_iterator anIt; - for (anIt = aResults.begin(); anIt != aResults.end() && aCanErase; ++anIt) { - aCanErase = *anIt != aResult; + for (anIt = aResults.begin(); anIt != aResults.end() && aCanErase; +++anIt) { aCanErase = *anIt != aResult; } } } if (!aCanErase) { FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); - if (aFeature.get() && anObjectsToBeDeleted.find(aFeature) == anObjectsToBeDeleted.end()) { - anObjectsToBeDeleted.insert(aFeature); + if (aFeature.get() && anObjectsToBeDeleted.find(aFeature) == +anObjectsToBeDeleted.end()) { anObjectsToBeDeleted.insert(aFeature); anObjectsToBeDeletedNames.append(aFeature->name().c_str()); } } } if (!anObjectsToBeDeleted.empty()) { QString aFeatureNames = anObjectsToBeDeletedNames.join(", "); - QString aMessage = tr("The following features have incorrect presentation and \ -will be hidden: %1. Would you like to delete them?") - .arg(aFeatureNames); - int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Features hide"), - aMessage, QMessageBox::Ok | QMessageBox::Cancel, - QMessageBox::Cancel); + QString aMessage = tr("The following features have incorrect presentation +and \ will be hidden: %1. Would you like to delete them?") .arg(aFeatureNames); + int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Features +hide"), aMessage, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); if (anAnswer == QMessageBox::Ok) { QObjectPtrList anObjects; - std::set::const_iterator anIt = anObjectsToBeDeleted.begin(), - aLast = anObjectsToBeDeleted.end(); - for (; anIt != aLast; anIt++) - anObjects.append(*anIt); - SessionPtr aMgr = ModelAPI_Session::get(); - DocumentPtr aDoc = aMgr->activeDocument(); - bool aIsOp = aMgr->isOperation(); - if (!aIsOp) - aMgr->startOperation(); + std::set::const_iterator anIt = +anObjectsToBeDeleted.begin(), aLast = anObjectsToBeDeleted.end(); for (; anIt != +aLast; anIt++) anObjects.append(*anIt); SessionPtr aMgr = +ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); bool aIsOp = +aMgr->isOperation(); if (!aIsOp) aMgr->startOperation(); workshop()->deleteFeatures(anObjects); - //static Events_ID aDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); - //static Events_ID aRedispEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + //static Events_ID aDeletedEvent = +Events_Loop::eventByName(EVENT_OBJECT_DELETED); + //static Events_ID aRedispEvent = +Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); //Events_Loop::loop()->flush(aDeletedEvent); //Events_Loop::loop()->flush(aRedispEvent); @@ -1608,30 +1661,29 @@ will be hidden: %1. Would you like to delete them?") } }*/ -bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature() const -{ +bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature() const { bool aCanDisplay = myIsMouseOverWindow; if (!aCanDisplay) { - ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); + ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); if (anActiveWidget) - aCanDisplay = anActiveWidget->getValueState() == ModuleBase_ModelWidget::Stored; + aCanDisplay = + anActiveWidget->getValueState() == ModuleBase_ModelWidget::Stored; } return aCanDisplay; } -bool PartSet_SketcherMgr::canChangeCursor(ModuleBase_Operation* theOperation) const -{ +bool PartSet_SketcherMgr::canChangeCursor( + ModuleBase_Operation *theOperation) const { return isNestedCreateOperation(theOperation, activeSketch()) || myModule->sketchReentranceMgr()->isInternalEditActive(); } -const QMap& PartSet_SketcherMgr::showConstraintStates() -{ +const QMap & +PartSet_SketcherMgr::showConstraintStates() { return myIsConstraintsShown; } -bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const -{ +bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr &theObject) const { if (!myCurrentSketch.get()) return false; FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject); @@ -1647,56 +1699,62 @@ bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const return false; } -void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr& thePlane) -{ - Handle(SelectMgr_Filter) aFilter = myModule->selectionFilter(SF_SketchPlaneFilter); +void PartSet_SketcherMgr::onPlaneSelected( + const std::shared_ptr &thePlane) { + Handle(SelectMgr_Filter) aFilter = + myModule->selectionFilter(SF_SketchPlaneFilter); if (!aFilter.IsNull()) - Handle(ModuleBase_ShapeInPlaneFilter)::DownCast(aFilter)->setPlane(thePlane); + Handle(ModuleBase_ShapeInPlaneFilter)::DownCast(aFilter)->setPlane( + thePlane); workshop()->selectionActivate()->updateSelectionModes(); } -bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* theOperation, - ModuleBase_IWorkshop* theWorkshop, - bool& theCanCommitOperation) -{ +bool PartSet_SketcherMgr::setDistanceValueByPreselection( + ModuleBase_Operation *theOperation, ModuleBase_IWorkshop *theWorkshop, + bool &theCanCommitOperation) { bool isValueAccepted = false; theCanCommitOperation = false; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); FeaturePtr aFeature = aFOperation->feature(); // editor is shown only if all attribute references are filled by preseletion bool anAllRefAttrInitialized = true; - std::list aRefAttrs = aFeature->data()->attributes( - ModelAPI_AttributeRefAttr::typeId()); - std::list::const_iterator anIt = aRefAttrs.begin(), aLast = aRefAttrs.end(); + std::list aRefAttrs = + aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); + std::list::const_iterator anIt = aRefAttrs.begin(), + aLast = aRefAttrs.end(); for (; anIt != aLast && anAllRefAttrInitialized; anIt++) { anAllRefAttrInitialized = (*anIt)->isInitialized(); } if (anAllRefAttrInitialized) { // Activate dimension value editing on double click - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - QList aWidgets = aPanel->modelWidgets(); + ModuleBase_IPropertyPanel *aPanel = aFOperation->propertyPanel(); + QList aWidgets = aPanel->modelWidgets(); // Find corresponded widget to activate value editing - foreach (ModuleBase_ModelWidget* aWgt, aWidgets) { + foreach (ModuleBase_ModelWidget *aWgt, aWidgets) { if (aWgt->attributeID() == "ConstraintValue") { - // the featue should be displayed in order to find the AIS text position, - // the place where the editor will be shown + // the featue should be displayed in order to find the AIS text + // position, the place where the editor will be shown aFeature->setDisplayed(true); - /// the execute is necessary to perform in the feature compute for flyout position + /// the execute is necessary to perform in the feature compute for + /// flyout position aFeature->execute(); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - PartSet_WidgetEditor* anEditor = dynamic_cast(aWgt); + PartSet_WidgetEditor *anEditor = + dynamic_cast(aWgt); if (anEditor) { int aX = 0, anY = 0; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(theWorkshop); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(theWorkshop); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); AISObjectPtr anAIS = aDisplayer->getAISObject(aFeature); Handle(AIS_InteractiveObject) anAISIO; if (anAIS.get() != NULL) { @@ -1706,16 +1764,18 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* t anAISIO = anAIS->impl(); if (!anAISIO.IsNull()) { - Handle(PrsDim_Dimension) aDim = Handle(PrsDim_Dimension)::DownCast(anAISIO); + Handle(PrsDim_Dimension) aDim = + Handle(PrsDim_Dimension)::DownCast(anAISIO); if (!aDim.IsNull()) { gp_Pnt aPosition = aDim->GetTextPosition(); - ModuleBase_IViewer* aViewer = aWorkshop->viewer(); + ModuleBase_IViewer *aViewer = aWorkshop->viewer(); Handle(V3d_View) aView = aViewer->activeView(); int aCX, aCY; - aView->Convert(aPosition.X(), aPosition.Y(), aPosition.Z(), aCX, aCY); + aView->Convert(aPosition.X(), aPosition.Y(), aPosition.Z(), aCX, + aCY); - QWidget* aViewPort = aViewer->activeViewPort(); + QWidget *aViewPort = aViewer->activeViewPort(); QPoint aGlPoint = aViewPort->mapToGlobal(QPoint(aCX, aCY)); aX = aGlPoint.x(); anY = aGlPoint.y(); @@ -1732,12 +1792,11 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* t return isValueAccepted; } -void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, - const FeaturePtr& theSketch, - ModuleBase_IWorkshop* theWorkshop, - const FeatureToSelectionMap& theSelection, - SelectMgr_IndexedMapOfOwner& theOwnersToSelect) -{ +void PartSet_SketcherMgr::getSelectionOwners( + const FeaturePtr &theFeature, const FeaturePtr &theSketch, + ModuleBase_IWorkshop *theWorkshop, + const FeatureToSelectionMap &theSelection, + SelectMgr_IndexedMapOfOwner &theOwnersToSelect) { if (theFeature.get() == NULL) return; @@ -1746,17 +1805,21 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, std::map aSelectedAttributes = anInfo.myAttributes; std::set aSelectedResults = anInfo.myResults; - XGUI_ModuleConnector* aConnector = dynamic_cast(theWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(theWorkshop); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); // 1. found the feature's owners. Check the AIS objects of the constructions AISObjectPtr aAISObj = aDisplayer->getAISObject(theFeature); - if (aAISObj.get() != NULL && aSelectedAttributes.empty() && aSelectedResults.empty()) { - Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl(); + if (aAISObj.get() != NULL && aSelectedAttributes.empty() && + aSelectedResults.empty()) { + Handle(AIS_InteractiveObject) anAISIO = + aAISObj->impl(); SelectMgr_IndexedMapOfOwner aSelectedOwners; - aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners); - for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++) { + aConnector->workshop()->selector()->selection()->entityOwners( + anAISIO, aSelectedOwners); + for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++) { Handle(SelectMgr_EntityOwner) anOwner = aSelectedOwners(i); if (!anOwner.IsNull()) theOwnersToSelect.Add(anOwner); @@ -1780,29 +1843,33 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, AISObjectPtr aResAISObj = aDisplayer->getAISObject(aResult); if (aResAISObj.get() == NULL) continue; - Handle(AIS_InteractiveObject) anAISIO = aResAISObj->impl(); + Handle(AIS_InteractiveObject) anAISIO = + aResAISObj->impl(); SelectMgr_IndexedMapOfOwner aSelectedOwners; - aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners); + aConnector->workshop()->selector()->selection()->entityOwners( + anAISIO, aSelectedOwners); bool aFoundLocalShape = false; - for ( Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) { + for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++) { Handle(StdSelect_BRepOwner) anOwner = - Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i)); - if ( anOwner.IsNull() || !anOwner->HasShape() || theOwnersToSelect.FindIndex(anOwner)) + Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i)); + if (anOwner.IsNull() || !anOwner->HasShape() || + theOwnersToSelect.FindIndex(anOwner)) continue; - const TopoDS_Shape& aShape = anOwner->Shape(); + const TopoDS_Shape &aShape = anOwner->Shape(); TopAbs_ShapeEnum aShapeType = aShape.ShapeType(); if (aShapeType == TopAbs_VERTEX) { std::pair aPntAttrIndex = - PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch); + PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, + theSketch); if (aPntAttrIndex.first.get() != NULL && - aSelectedAttributes.find(aPntAttrIndex.first) != aSelectedAttributes.end()) + aSelectedAttributes.find(aPntAttrIndex.first) != + aSelectedAttributes.end()) theOwnersToSelect.Add(anOwner); else if (isSameShape && anInfo.myLocalSelectedShapes.Contains(aShape)) { theOwnersToSelect.Add(anOwner); } - } - else if (aShapeType == TopAbs_EDGE) { + } else if (aShapeType == TopAbs_EDGE) { if (isSameShape && anInfo.myLocalSelectedShapes.Contains(aShape)) { // try to restore local selection on Shape result // we can do this only if the shape was not changed @@ -1813,13 +1880,15 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, } } if (!aFoundLocalShape) { - // result owners are put in the list of selection only if local selected shapes were not - // found + // result owners are put in the list of selection only if local selected + // shapes were not found if (aSelectedResults.find(aResult) != aSelectedResults.end()) { - for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) { + for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; + i++) { Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i)); - if (anOwner.IsNull() || !anOwner->HasShape() || theOwnersToSelect.FindIndex(anOwner)) + if (anOwner.IsNull() || !anOwner->HasShape() || + theOwnersToSelect.FindIndex(anOwner)) continue; // select whole result theOwnersToSelect.Add(anOwner); @@ -1829,96 +1898,94 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, } } -void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, - const bool isToConnect) -{ - //Temporary commented as we do not modify values in property panel +void PartSet_SketcherMgr::connectToPropertyPanel( + ModuleBase_ModelWidget *theWidget, const bool isToConnect) { + // Temporary commented as we do not modify values in property panel if (isToConnect) { - //connect(theWidget, SIGNAL(beforeValuesChanged()), - // this, SLOT(onBeforeValuesChangedInPropertyPanel())); - //connect(theWidget, SIGNAL(afterValuesChanged()), - // this, SLOT(onAfterValuesChangedInPropertyPanel())); + // connect(theWidget, SIGNAL(beforeValuesChanged()), + // this, SLOT(onBeforeValuesChangedInPropertyPanel())); + // connect(theWidget, SIGNAL(afterValuesChanged()), + // this, SLOT(onAfterValuesChangedInPropertyPanel())); connect(theWidget, SIGNAL(afterValuesChanged()), - myModule->sketchReentranceMgr(), SLOT(onAfterValuesChangedInPropertyPanel())); - } - else { - //disconnect(theWidget, SIGNAL(beforeValuesChanged()), - // this, SLOT(onBeforeValuesChangedInPropertyPanel())); - //disconnect(theWidget, SIGNAL(afterValuesChanged()), - // this, SLOT(onAfterValuesChangedInPropertyPanel())); + myModule->sketchReentranceMgr(), + SLOT(onAfterValuesChangedInPropertyPanel())); + } else { + // disconnect(theWidget, SIGNAL(beforeValuesChanged()), + // this, SLOT(onBeforeValuesChangedInPropertyPanel())); + // disconnect(theWidget, SIGNAL(afterValuesChanged()), + // this, SLOT(onAfterValuesChangedInPropertyPanel())); disconnect(theWidget, SIGNAL(afterValuesChanged()), - myModule->sketchReentranceMgr(), SLOT(onAfterValuesChangedInPropertyPanel())); + myModule->sketchReentranceMgr(), + SLOT(onAfterValuesChangedInPropertyPanel())); } } -void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (getCurrentOperation()); +void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(getCurrentOperation()); if (aFOperation) { if ((PartSet_SketcherMgr::isSketchOperation(aFOperation) || isNestedSketchOperation(aFOperation)) && thePreviousState == ModuleBase_ModelWidget::ModifiedInPP) { FeaturePtr aFeature = aFOperation->feature(); - visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature)); + visualizeFeature(aFeature, aFOperation->isEditOperation(), + canDisplayObject(aFeature)); } } } -//void PartSet_SketcherMgr::customisePresentation(const ObjectPtr& theObject) +// void PartSet_SketcherMgr::customisePresentation(const ObjectPtr& theObject) //{ -// ModuleBase_OperationFeature* aFOperation = dynamic_cast -// (getCurrentOperation()); -// if (aFOperation && (PartSet_SketcherMgr::isSketchOperation(aFOperation) || -// isNestedSketchOperation(aFOperation))) -// SketcherPrs_Tools::sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]); +// ModuleBase_OperationFeature* aFOperation = +// dynamic_cast +// (getCurrentOperation()); +// if (aFOperation && (PartSet_SketcherMgr::isSketchOperation(aFOperation) || +// isNestedSketchOperation(aFOperation))) +// SketcherPrs_Tools::sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]); // -// // update entities selection priorities -// FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); -// if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind())) { -// // update priority for feature -// updateSelectionPriority(aFeature, aFeature); -// // update priority for results of the feature -// std::list aResults = aFeature->results(); -// std::list::const_iterator anIt = aResults.begin(), aLastIt = aResults.end(); -// for (; anIt != aLastIt; anIt++) -// updateSelectionPriority(*anIt, aFeature); -// } -//} - -ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const -{ +// // update entities selection priorities +// FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); +// if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind())) { +// // update priority for feature +// updateSelectionPriority(aFeature, aFeature); +// // update priority for results of the feature +// std::list aResults = aFeature->results(); +// std::list::const_iterator anIt = aResults.begin(), aLastIt = +// aResults.end(); for (; anIt != aLastIt; anIt++) +// updateSelectionPriority(*anIt, aFeature); +// } +// } + +ModuleBase_Operation *PartSet_SketcherMgr::getCurrentOperation() const { return myModule->workshop()->currentOperation(); } //************************************************************** -ModuleBase_ModelWidget* PartSet_SketcherMgr::getActiveWidget() const -{ - ModuleBase_ModelWidget* aWidget = 0; - ModuleBase_Operation* anOperation = getCurrentOperation(); +ModuleBase_ModelWidget *PartSet_SketcherMgr::getActiveWidget() const { + ModuleBase_ModelWidget *aWidget = 0; + ModuleBase_Operation *anOperation = getCurrentOperation(); if (anOperation) { - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); if (aPanel) aWidget = aPanel->activeWidget(); } return aWidget; } -void PartSet_SketcherMgr::visualizeFeature(const FeaturePtr& theFeature, +void PartSet_SketcherMgr::visualizeFeature(const FeaturePtr &theFeature, const bool isEditOperation, const bool isToDisplay, - const bool isFlushRedisplay) -{ - #ifdef DEBUG_DO_NOT_BY_ENTER + const bool isFlushRedisplay) { +#ifdef DEBUG_DO_NOT_BY_ENTER return; - #endif +#endif if (isEditOperation || !theFeature.get()) return; - // 1. change visibility of the object itself, here the presentable object is processed, - // e.g. constraints features - //FeaturePtr aFeature = aFOperation->feature(); + // 1. change visibility of the object itself, here the presentable object is + // processed, e.g. constraints features + // FeaturePtr aFeature = aFOperation->feature(); std::list aResults = theFeature->results(); if (isToDisplay) theFeature->setDisplayed(true); @@ -1930,23 +1997,23 @@ void PartSet_SketcherMgr::visualizeFeature(const FeaturePtr& theFeature, for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { if (isToDisplay) { (*aIt)->setDisplayed(true); - } - else { + } else { (*aIt)->setDisplayed(false); } } if (isFlushRedisplay) - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } -void PartSet_SketcherMgr::storeSelection(const SelectionType theType, - PartSet_SketcherMgr::FeatureToSelectionMap& theCurrentSelection) -{ +void PartSet_SketcherMgr::storeSelection( + const SelectionType theType, + PartSet_SketcherMgr::FeatureToSelectionMap &theCurrentSelection) { if (!myCurrentSketch.get()) return; - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - ModuleBase_ISelection* aSelect = aWorkshop->selection(); + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + ModuleBase_ISelection *aSelect = aWorkshop->selection(); QList aStoredPrs; if (theType == ST_HighlightType || theType == ST_SelectAndHighlightType) @@ -1954,16 +2021,17 @@ void PartSet_SketcherMgr::storeSelection(const SelectionType theType, QList aFeatureList; if (theType == ST_SelectAndHighlightType || theType == ST_SelectType) { - QList aSelected = aSelect->getSelected( - ModuleBase_ISelection::AllControls); + QList aSelected = + aSelect->getSelected(ModuleBase_ISelection::AllControls); aStoredPrs.append(aSelected); } - // 1. it is necessary to save current selection in order to restore it after the features moving + // 1. it is necessary to save current selection in order to restore it after + // the features moving theCurrentSelection.clear(); QList::const_iterator anIt = aStoredPrs.begin(), - aLast = aStoredPrs.end(); + aLast = aStoredPrs.end(); CompositeFeaturePtr aSketch = activeSketch(); for (; anIt != aLast; anIt++) { @@ -1996,54 +2064,56 @@ void PartSet_SketcherMgr::storeSelection(const SelectionType theType, Handle(SelectMgr_EntityOwner) anOwner = aPrs->owner(); if (aResult.get()) { getAttributesOrResults(anOwner, aFeature, aSketch, aResult, - anInfo.myAttributes, anInfo.myResults, anInfo.myLocalSelectedShapes); - } - else { + anInfo.myAttributes, anInfo.myResults, + anInfo.myLocalSelectedShapes); + } else { std::list aResults = aFeature->results(); std::list::const_iterator aIt; for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { ResultPtr aCurResult = *aIt; getAttributesOrResults(anOwner, aFeature, aSketch, aCurResult, - anInfo.myAttributes, anInfo.myResults, anInfo.myLocalSelectedShapes); + anInfo.myAttributes, anInfo.myResults, + anInfo.myLocalSelectedShapes); } } theCurrentSelection[aFeature] = anInfo; } - //qDebug(QString(" storeSelection: %1").arg(theCurrentSelection.size()).toStdString().c_str()); + // qDebug(QString(" storeSelection: + // %1").arg(theCurrentSelection.size()).toStdString().c_str()); } void PartSet_SketcherMgr::restoreSelection( - PartSet_SketcherMgr::FeatureToSelectionMap& theCurrentSelection) -{ + PartSet_SketcherMgr::FeatureToSelectionMap &theCurrentSelection) { if (!myCurrentSketch.get()) return; - //qDebug(QString("restoreSelection: %1").arg(theCurrentSelection.size()).toStdString().c_str()); - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); + // qDebug(QString("restoreSelection: + // %1").arg(theCurrentSelection.size()).toStdString().c_str()); + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(aWorkshop); FeatureToSelectionMap::const_iterator aSIt = theCurrentSelection.begin(), aSLast = theCurrentSelection.end(); SelectMgr_IndexedMapOfOwner anOwnersToSelect; anOwnersToSelect.Clear(); for (; aSIt != aSLast; aSIt++) { - getSelectionOwners(aSIt.key(), myCurrentSketch, aWorkshop, theCurrentSelection, - anOwnersToSelect); + getSelectionOwners(aSIt.key(), myCurrentSketch, aWorkshop, + theCurrentSelection, anOwnersToSelect); } - aConnector->workshop()->selector()->setSelectedOwners(anOwnersToSelect, false); + aConnector->workshop()->selector()->setSelectedOwners(anOwnersToSelect, + false); } -void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) -{ - PartSet_Tools::ConstraintVisibleState aType = (PartSet_Tools::ConstraintVisibleState)theType; +void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) { + PartSet_Tools::ConstraintVisibleState aType = + (PartSet_Tools::ConstraintVisibleState)theType; updateBySketchParameters(aType, theState); myModule->workshop()->viewer()->update(); } void PartSet_SketcherMgr::updateBySketchParameters( - const PartSet_Tools::ConstraintVisibleState& theType, - bool theState) -{ + const PartSet_Tools::ConstraintVisibleState &theType, bool theState) { if (myCurrentSketch.get() == NULL) return; @@ -2051,41 +2121,43 @@ void PartSet_SketcherMgr::updateBySketchParameters( myIsConstraintsShown[theType] = theState; switch (theType) { - case PartSet_Tools::Geometrical: - case PartSet_Tools::Dimensional: { - if (aPrevState != theState) { - int aNumberOfSubs = myCurrentSketch->numberOfSubs(); - for (int i = 0; i < aNumberOfSubs; i++) { - FeaturePtr aSubFeature = myCurrentSketch->subFeature(i); - bool aProcessed = false; - bool aConstraintDisplayed = canDisplayConstraint(aSubFeature, theType, aProcessed); - if (aProcessed) - aSubFeature->setDisplayed(aConstraintDisplayed); - } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + case PartSet_Tools::Geometrical: + case PartSet_Tools::Dimensional: { + if (aPrevState != theState) { + int aNumberOfSubs = myCurrentSketch->numberOfSubs(); + for (int i = 0; i < aNumberOfSubs; i++) { + FeaturePtr aSubFeature = myCurrentSketch->subFeature(i); + bool aProcessed = false; + bool aConstraintDisplayed = + canDisplayConstraint(aSubFeature, theType, aProcessed); + if (aProcessed) + aSubFeature->setDisplayed(aConstraintDisplayed); } - } - break; - case PartSet_Tools::Expressions: { - if (aPrevState != theState) { - /// call all sketch features redisplay, the expression state will be corrected in customize - /// of distance presentation - SketcherPrs_Tools::ParameterStyle aStyle = myIsConstraintsShown[PartSet_Tools::Expressions] - ? SketcherPrs_Tools::ParameterText : SketcherPrs_Tools::ParameterValue; - SketcherPrs_Tools::setParameterStyle(aStyle); - Events_ID anEventId = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - PartSet_Tools::sendSubFeaturesEvent(myCurrentSketch, anEventId); - } - } + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + } + } break; + case PartSet_Tools::Expressions: { + if (aPrevState != theState) { + /// call all sketch features redisplay, the expression state will be + /// corrected in customize of distance presentation + SketcherPrs_Tools::ParameterStyle aStyle = + myIsConstraintsShown[PartSet_Tools::Expressions] + ? SketcherPrs_Tools::ParameterText + : SketcherPrs_Tools::ParameterValue; + SketcherPrs_Tools::setParameterStyle(aStyle); + Events_ID anEventId = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + PartSet_Tools::sendSubFeaturesEvent(myCurrentSketch, anEventId); + } + } break; + default: // [to avoid compilation warning] break; - default: // [to avoid compilation warning] - break; } } void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, - FeaturePtr theFeature) -{ + FeaturePtr theFeature) { if (!theObject.get() || !theFeature.get()) return; @@ -2099,7 +2171,7 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, int anAdditionalPriority = 0; // current feature std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(theFeature); + std::dynamic_pointer_cast(theFeature); if (aSPFeature.get() != NULL) { // 1. Vertices // 2. Simple segments @@ -2107,9 +2179,9 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, // 4. Auxiliary segments (dotted) // StdSelect_BRepSelectionTool::Load uses priority calculating: // Standard_Integer aPriority = - // (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority; - // Priority of Vertex is 8, edge(segment) is 7. - // It might be not corrected as provides the condition above. + // (thePriority == -1) ? GetStandardPriority (theShape, theType) : + // thePriority; Priority of Vertex is 8, edge(segment) is 7. It might be + // not corrected as provides the condition above. bool isExternal = aSPFeature->isExternal(); bool isAuxiliary = PartSet_Tools::isAuxiliarySketchEntity(aSPFeature); // current feature @@ -2120,10 +2192,12 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, anAdditionalPriority = 20; // auxiliary feature if (isAuxiliary) { - anAdditionalPriority = 10; /// auxiliary objects should have less priority that + anAdditionalPriority = + 10; /// auxiliary objects should have less priority that // edges/vertices of local selection on not-sketch objects } - Handle(ModuleBase_ResultPrs) aResult = Handle(ModuleBase_ResultPrs)::DownCast(anAISIO); + Handle(ModuleBase_ResultPrs) aResult = + Handle(ModuleBase_ResultPrs)::DownCast(anAISIO); if (!aResult.IsNull()) { aResult->setAdditionalSelectionPriority(anAdditionalPriority); } @@ -2131,38 +2205,38 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, } } -XGUI_Workshop* PartSet_SketcherMgr::workshop() const -{ - ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(anIWorkshop); +XGUI_Workshop *PartSet_SketcherMgr::workshop() const { + ModuleBase_IWorkshop *anIWorkshop = myModule->workshop(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(anIWorkshop); return aConnector->workshop(); } -XGUI_OperationMgr* PartSet_SketcherMgr::operationMgr() const -{ +XGUI_OperationMgr *PartSet_SketcherMgr::operationMgr() const { return workshop()->operationMgr(); } -void PartSet_SketcherMgr::onShowPoints(bool toShow) -{ +void PartSet_SketcherMgr::onShowPoints(bool toShow) { if (!myCurrentSketch.get()) return; - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - ModuleBase_IViewer* aViewer = aWorkshop->viewer(); + ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); + ModuleBase_IViewer *aViewer = aWorkshop->viewer(); Handle(AIS_InteractiveContext) aContext = aViewer->AISContext(); bool aToUpdate = false; if (toShow) { - std::list aFreePoints = SketcherPrs_Tools::getFreePoints(myCurrentSketch); + std::list aFreePoints = + SketcherPrs_Tools::getFreePoints(myCurrentSketch); // Delete obsolete presentations std::list aDelList; - foreach(ResultPtr aObj, myPointsHighlight.keys()) { - bool aFound = (std::find(aFreePoints.begin(), aFreePoints.end(), aObj) != aFreePoints.end()); + foreach (ResultPtr aObj, myPointsHighlight.keys()) { + bool aFound = (std::find(aFreePoints.begin(), aFreePoints.end(), aObj) != + aFreePoints.end()); if (!aFound) aDelList.push_back(aObj); } - foreach(ResultPtr aObj, aDelList) { + foreach (ResultPtr aObj, aDelList) { aContext->Remove(myPointsHighlight[aObj], false); aToUpdate = true; myPointsHighlight.remove(aObj); @@ -2183,18 +2257,17 @@ void PartSet_SketcherMgr::onShowPoints(bool toShow) aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_O_STAR); aDrawer->PointAspect()->SetColor(Quantity_NOC_BLUE1); aDrawer->PointAspect()->SetScale(2); - } - else - aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_O_STAR, Quantity_NOC_BLUE1, 2)); + } else + aDrawer->SetPointAspect( + new Prs3d_PointAspect(Aspect_TOM_O_STAR, Quantity_NOC_BLUE1, 2)); aContext->Display(aShapePrs, false); aContext->Deactivate(aShapePrs); myPointsHighlight[*aIt] = aShapePrs; aToUpdate = true; } } - } - else { - foreach(Handle(AIS_Shape) aPrs, myPointsHighlight.values()) { + } else { + foreach (Handle(AIS_Shape) aPrs, myPointsHighlight.values()) { aContext->Remove(aPrs, false); aToUpdate = true; } @@ -2204,11 +2277,12 @@ void PartSet_SketcherMgr::onShowPoints(bool toShow) aViewer->update(); } -void PartSet_SketcherMgr::processEvent(const std::shared_ptr& theMessage) -{ - if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOF_OBJECTS)) { +void PartSet_SketcherMgr::processEvent( + const std::shared_ptr &theMessage) { + if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_DOF_OBJECTS)) { std::shared_ptr anUpdateMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::set aObjects = anUpdateMsg->objects(); std::set::const_iterator aIt; QList aPrsList; @@ -2229,33 +2303,33 @@ void PartSet_SketcherMgr::processEvent(const std::shared_ptr& th } } -bool isExternal(const ObjectPtr& theObject) -{ +bool isExternal(const ObjectPtr &theObject) { AttributeSelectionPtr aAttr = - theObject->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + theObject->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (aAttr) return aAttr->context().get() != NULL && !aAttr->isInvalid(); return false; } -bool isCopy(const ObjectPtr& theObject) -{ - AttributeBooleanPtr anAttr = theObject->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); +bool isCopy(const ObjectPtr &theObject) { + AttributeBooleanPtr anAttr = + theObject->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (anAttr.get()) return anAttr->value(); return false; } -bool isIncludeToResult(const ObjectPtr& theObject) -{ +bool isIncludeToResult(const ObjectPtr &theObject) { AttributeBooleanPtr anAttr; std::set aRefsToMe = theObject->data()->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsToMe.cbegin(); aIt != aRefsToMe.cend(); ++aIt) { if ((*aIt)->id() == SketchPlugin_Projection::PROJECTED_FEATURE_ID()) { - FeaturePtr aFeature = std::dynamic_pointer_cast((*aIt)->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast((*aIt)->owner()); if (aFeature.get() && !aFeature->isMacro()) { - anAttr = aFeature->data()->boolean(SketchPlugin_Projection::INCLUDE_INTO_RESULT()); + anAttr = aFeature->data()->boolean( + SketchPlugin_Projection::INCLUDE_INTO_RESULT()); if (anAttr.get()) return anAttr->value(); } @@ -2265,14 +2339,17 @@ bool isIncludeToResult(const ObjectPtr& theObject) } //************************************************************************************** -std::vector PartSet_SketcherMgr::colorOfObject(const ObjectPtr& theObject, - const FeaturePtr& theFeature, bool isConstruction) const -{ - PartSet_OverconstraintListener* aOCListener = myModule->overconstraintListener(); +std::vector +PartSet_SketcherMgr::colorOfObject(const ObjectPtr &theObject, + const FeaturePtr &theFeature, + bool isConstruction) const { + PartSet_OverconstraintListener *aOCListener = + myModule->overconstraintListener(); std::string aKind = theFeature->getKind(); if (aOCListener->isConflictingObject(theObject)) { - return Config_PropManager::color("Visualization", "sketch_overconstraint_color"); + return Config_PropManager::color("Visualization", + "sketch_overconstraint_color"); } if (isDistanceKind(aKind)) { return Config_PropManager::color("Visualization", "sketch_dimension_color"); @@ -2281,7 +2358,8 @@ std::vector PartSet_SketcherMgr::colorOfObject(const ObjectPtr& theObject, return Config_PropManager::color("Visualization", "sketch_external_color"); if (aOCListener->isFullyConstrained()) { - return Config_PropManager::color("Visualization", "sketch_fully_constrained_color"); + return Config_PropManager::color("Visualization", + "sketch_fully_constrained_color"); } if (aKind == SketchPlugin_ConstraintCoincidence::ID()) return std::vector(3, 0); @@ -2293,24 +2371,26 @@ std::vector PartSet_SketcherMgr::colorOfObject(const ObjectPtr& theObject, } //************************************************************************************** -void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject, - const AISObjectPtr& thePrs) const -{ +void PartSet_SketcherMgr::customizeSketchPresentation( + const ObjectPtr &theObject, const AISObjectPtr &thePrs) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); // set color from preferences std::shared_ptr anAuxiliaryAttr = - aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); - bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value(); + aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); + bool isConstruction = + anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value(); std::vector aColor = colorOfObject(theObject, aFeature, isConstruction); if (!aColor.empty()) { // The code below causes redisplay again if (ModelAPI_Session::get()->isOperation()) { - AttributeIntArrayPtr aColorAttr = theObject->data()->intArray(ModelAPI_Result::COLOR_ID()); + AttributeIntArrayPtr aColorAttr = + theObject->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get()) { aColorAttr->setSize(3, false); - // Set the color attribute in order do not use default colors in the presentation object + // Set the color attribute in order do not use default colors in the + // presentation object for (int i = 0; i < 3; i++) aColorAttr->setValue(i, aColor[i], false); } @@ -2321,12 +2401,14 @@ void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject int aShapeType = thePrs->getShapeType(); // a compound is processed like the edge because the // arc feature uses the compound for presentable AIS - if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/) + if (aShapeType != 6 /*an edge*/ && aShapeType != 7 /*a vertex*/ && + aShapeType != 0 /*compound*/) return; - int aWidth = Config_PropManager::integer("Visualization", "sketch_line_width"); + int aWidth = + Config_PropManager::integer("Visualization", "sketch_line_width"); if (isExternal(aFeature)) { - thePrs->setWidth(isIncludeToResult(aFeature)? aWidth : 1); + thePrs->setWidth(isIncludeToResult(aFeature) ? aWidth : 1); return; } std::string aKind = aFeature->getKind(); @@ -2336,17 +2418,18 @@ void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a compound if (isConstruction) { // Set axilliary line - thePrs->setWidth(SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY()); - thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY()); - } - else { + thePrs->setWidth( + SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY()); + thePrs->setLineStyle( + SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY()); + } else { thePrs->setWidth(aWidth); thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE()); } - } - else if (aShapeType == 7) { // otherwise this is a vertex - // The width value do not have effect on the point presentation. - // It is defined in order to extend selection area of the object. + } else if (aShapeType == 7) { // otherwise this is a vertex + // The width value do not have effect on the + // point presentation. It is defined in order to + // extend selection area of the object. thePrs->setWidth(17); // thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol } @@ -2355,18 +2438,19 @@ void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject thePrs->setWidth(aPrsWidth / 2.5); } - double aDeflection = Config_PropManager::real("Visualization", "construction_deflection"); + double aDeflection = + Config_PropManager::real("Visualization", "construction_deflection"); thePrs->setDeflection(aDeflection); } //************************************************************************************* -void PartSet_Fitter::fitAll(Handle(V3d_View) theView) -{ +void PartSet_Fitter::fitAll(Handle(V3d_View) theView) { CompositeFeaturePtr aSketch = mySketchMgr->activeSketch(); - ModuleBase_IWorkshop* aWorkshop = mySketchMgr->module()->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + ModuleBase_IWorkshop *aWorkshop = mySketchMgr->module()->workshop(); + XGUI_ModuleConnector *aConnector = + dynamic_cast(aWorkshop); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); Bnd_Box aBndBox; int aNumberOfSubs = aSketch->numberOfSubs(); @@ -2375,14 +2459,14 @@ void PartSet_Fitter::fitAll(Handle(V3d_View) theView) FeaturePtr aFeature = aSketch->subFeature(i); if (aDisplayer->isVisible(aFeature)) { AISObjectPtr aAisPtr = aDisplayer->getAISObject(aFeature); - Handle(AIS_InteractiveObject) aAisObj = aAisPtr->impl(); + Handle(AIS_InteractiveObject) aAisObj = + aAisPtr->impl(); if (!aAisObj->IsInfinite()) { Bnd_Box aBox; aAisObj->BoundingBox(aBox); aBndBox.Add(aBox); } - } - else { + } else { std::list aResults = aFeature->results(); std::list::const_iterator aIt; ResultPtr aRes; @@ -2395,7 +2479,8 @@ void PartSet_Fitter::fitAll(Handle(V3d_View) theView) std::dynamic_pointer_cast(aCurFeature); if (aSPFeature.get()) { bool isAxiliary = - aSPFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + aSPFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value(); if (!(aSPFeature->isExternal() || isAxiliary)) { GeomShapePtr aShape = aRes->shape(); aShape->computeSize(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 14d88a168..ca312055f 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_SketcherMgr_H @@ -25,36 +26,35 @@ #include "PartSet_PreviewSketchPlane.h" #include "PartSet_Tools.h" -#include +#include #include #include +#include #include -#include #include #include #include -#include #include +#include #ifdef HAVE_SALOME - #include +#include #else - #include +#include #endif - #include #include -#include -#include #include +#include +#include -#include #include #include +#include #include #include @@ -80,53 +80,41 @@ class PartSet_Fitter : public AppElements_Fitter #endif { public: - PartSet_Fitter(PartSet_SketcherMgr* theSketchMgr): - mySketchMgr(theSketchMgr) {} + PartSet_Fitter(PartSet_SketcherMgr *theSketchMgr) + : mySketchMgr(theSketchMgr) {} virtual ~PartSet_Fitter() {} - /// A method which has top be reimplemented to provide alterantive implementation FitAll command - /// \param theView - a view which has to be fit + /// A method which has top be reimplemented to provide alterantive + /// implementation FitAll command \param theView - a view which has to be fit virtual void fitAll(Handle(V3d_View) theView); private: - PartSet_SketcherMgr* mySketchMgr; + PartSet_SketcherMgr *mySketchMgr; }; - - /** * \ingroup Modules * A class for management of sketch operations - At the time of the sketcher operation active, only the sketch sub-feature results are - displayed in the viewer. After the sketch create/edit operation is finished, the sub-feature - are hidden, the sketch feature result is displayed + At the time of the sketcher operation active, only the sketch sub-feature +results are displayed in the viewer. After the sketch create/edit operation is +finished, the sub-feature are hidden, the sketch feature result is displayed */ -class PARTSET_EXPORT PartSet_SketcherMgr : public QObject, public Events_Listener -{ +class PARTSET_EXPORT PartSet_SketcherMgr : public QObject, + public Events_Listener { Q_OBJECT /// Struct to define gp point, with the state is the point is initialized - struct Point - { + struct Point { /// Constructor - Point() - { - myIsInitialized = false; - } + Point() { myIsInitialized = false; } /// Destructor - ~Point() - { - } + ~Point() {} /// clear the initialized flag. - void clear() - { - myIsInitialized = false; - } + void clear() { myIsInitialized = false; } /// set the point and switch on the initialized flag /// \param thePoint the point - void setValue(const double theX, const double theY) - { + void setValue(const double theX, const double theY) { myIsInitialized = true; myCurX = theX; myCurY = theY; @@ -138,11 +126,10 @@ class PARTSET_EXPORT PartSet_SketcherMgr : public QObject, public Events_Listene public: /// Struct to define selection model information to store/restore selection - struct SelectionInfo - { + struct SelectionInfo { /// the selected attributes and indices of points if array std::map myAttributes; - std::set myResults; /// the selected results + std::set myResults; /// the selected results TopoDS_Shape myFirstResultShape; /// the first shape of feature result TopTools_MapOfShape myLocalSelectedShapes; /// shapes of local selection }; @@ -151,162 +138,164 @@ public: public: /// Constructor /// \param theModule a pointer to PartSet module - PartSet_SketcherMgr(PartSet_Module* theModule); + PartSet_SketcherMgr(PartSet_Module *theModule); virtual ~PartSet_SketcherMgr(); /// Returns true if the operation is the sketch /// \param theOperation an operation /// \return the boolean result - static bool isSketchOperation(ModuleBase_Operation* theOperation); + static bool isSketchOperation(ModuleBase_Operation *theOperation); - /// Returns true if the operation feature belongs to list of granted features of Sketch - /// operation. An operation of a sketch should be started before. + /// Returns true if the operation feature belongs to list of granted features + /// of Sketch operation. An operation of a sketch should be started before. /// \param theOperation an operation /// \return the boolean result - bool isNestedSketchOperation(ModuleBase_Operation* theOperation) const; + bool isNestedSketchOperation(ModuleBase_Operation *theOperation) const; - /// Returns true if the feature kind belongs to list of granted features of Sketch - /// operation. An operation of a sketch should be started before. + /// Returns true if the feature kind belongs to list of granted features of + /// Sketch operation. An operation of a sketch should be started before. /// \param theOperation an operation /// \return the boolean result - bool isNestedSketchFeature(const QString& theFeatureKind) const; + bool isNestedSketchFeature(const QString &theFeatureKind) const; /// Returns true if the operation is a create and nested sketch operationn /// \param theOperation a checked operation /// \param theSketch a sketch feature //// \return boolean value - bool isNestedCreateOperation(ModuleBase_Operation* theOperation, - const CompositeFeaturePtr& /*theSketch*/) const; + bool isNestedCreateOperation(ModuleBase_Operation *theOperation, + const CompositeFeaturePtr & /*theSketch*/) const; /// Returns true if the operation is an edit nested feature one /// \param theOperation a checked operation //// \return boolean value - bool isNestedEditOperation(ModuleBase_Operation* theOperation, - const CompositeFeaturePtr& /*theSketch*/) const; + bool isNestedEditOperation(ModuleBase_Operation *theOperation, + const CompositeFeaturePtr & /*theSketch*/) const; - /// Returns whether the current operation is a sketch entity - line, point, arc or circle - /// \param theId is an id of object - /// \return a boolean value - static bool isEntity(const std::string& theId); + /// Returns whether the current operation is a sketch entity - line, point, + /// arc or circle \param theId is an id of object \return a boolean value + static bool isEntity(const std::string &theId); - /// Returns whether the feature has external attribute filled with 'true' value - /// \param theFeature a feature object - /// \return a boolean value - static bool isExternalFeature(const FeaturePtr& theFeature); + /// Returns whether the feature has external attribute filled with 'true' + /// value \param theFeature a feature object \return a boolean value + static bool isExternalFeature(const FeaturePtr &theFeature); - /// Returns whether the current operation is a sketch distance - lenght, distance or radius - /// \param theOperation the operation - /// \return a boolean value - static bool isDistanceOperation(ModuleBase_Operation* theOperation); + /// Returns whether the current operation is a sketch distance - lenght, + /// distance or radius \param theOperation the operation \return a boolean + /// value + static bool isDistanceOperation(ModuleBase_Operation *theOperation); - /// Returns whether the feature kind is a sketch distance - lenght, distance or radius - /// \param theKind the feature kind - /// \return a boolean value - static bool isDistanceKind(std::string& theKind); + /// Returns whether the feature kind is a sketch distance - lenght, distance + /// or radius \param theKind the feature kind \return a boolean value + static bool isDistanceKind(std::string &theKind); /// Returns true if a mouse cursor is over viewer window bool isMouseOverWindow() { return myIsMouseOverWindow; } - /// Returns current Sketch feature/ Returns NULL if there is no launched sketch operation + /// Returns current Sketch feature/ Returns NULL if there is no launched + /// sketch operation CompositeFeaturePtr activeSketch() const { return myCurrentSketch; } /// Returns help class to visualize sketcher plane /// \return a preview plane - PartSet_PreviewSketchPlane* previewSketchPlane() const { return mySketchPlane; } + PartSet_PreviewSketchPlane *previewSketchPlane() const { + return mySketchPlane; + } /// Starts sketch operation - void startSketch(ModuleBase_Operation* ); + void startSketch(ModuleBase_Operation *); /// Stops sketch operation - void stopSketch(ModuleBase_Operation* ); + void stopSketch(ModuleBase_Operation *); /// Starts sketch operation, connects to the opeation property panel /// \param theOperation a committed operation - void startNestedSketch(ModuleBase_Operation* theOperation); + void startNestedSketch(ModuleBase_Operation *theOperation); /// Stop sketch operation, disconnects from the opeation property panel /// \param theOperation a stopped operation - void stopNestedSketch(ModuleBase_Operation* theOperation); + void stopNestedSketch(ModuleBase_Operation *theOperation); - /// Visualizes the operation feature if it is a creation nested feature operation - /// \param theOperation a committed operation - void commitNestedSketch(ModuleBase_Operation* theOperation); + /// Visualizes the operation feature if it is a creation nested feature + /// operation \param theOperation a committed operation + void commitNestedSketch(ModuleBase_Operation *theOperation); /// Returns true if the filter is created by the sketch manager /// \param theFilterType a checked type /// \return boolean value - bool sketchSelectionFilter(const ModuleBase_SelectionFilterType theFilterType); - - /// Append selection filter into the module and type of the filter in internal container - /// \param theFilterType selection filter type - /// \param theFilter added filter - void registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType, - const Handle(SelectMgr_Filter)& theFilter); - - /// Commit the operation if it is possible. If the operation is dimention constraint, - /// it gives widget editor to input dimention value - /// \return true if the operation is stopped after activation + bool + sketchSelectionFilter(const ModuleBase_SelectionFilterType theFilterType); + + /// Append selection filter into the module and type of the filter in internal + /// container \param theFilterType selection filter type \param theFilter + /// added filter + void + registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType, + const Handle(SelectMgr_Filter) & theFilter); + + /// Commit the operation if it is possible. If the operation is dimention + /// constraint, it gives widget editor to input dimention value \return true + /// if the operation is stopped after activation bool operationActivatedByPreselection(); - /// Returns True if there are available Undos and the sketch manager allows undo - /// \return the boolean result + /// Returns True if there are available Undos and the sketch manager allows + /// undo \return the boolean result bool canUndo() const; - //! Returns True if there are available Redos and the sketch manager allows redo + //! Returns True if there are available Redos and the sketch manager allows + //! redo /// \return the boolean result bool canRedo() const; /// Returns False only if the sketch creating feature can not be visualized. /// \return a boolean value - //bool canCommitOperation() const; - - /// Returns whether the object can be erased at the bounds of the active operation. - /// Sketch sub-entities can not be erased during the sketch operation - /// \param theObject a model object - bool canEraseObject(const ObjectPtr& theObject) const; - - /// Returns whether the object can be displayed at the bounds of the active operation. - /// Display only current operation results for usual operation and ask the sketcher manager - /// if it is a sketch operation - /// \param theObject a model object - bool canDisplayObject(const ObjectPtr& theObject) const; - - /// Returns whether the constraint object can be displayed. It depends on the sketch check - /// box states - /// \param theObject a model object - /// \param theState the constraint visible state state to be checked - /// \param isProcessed an output parameter if it is processed - /// \return result value - bool canDisplayConstraint(const FeaturePtr& theObject, - const PartSet_Tools::ConstraintVisibleState& theState, - bool& isProcessed) const; - - /// Check the given objects either there are some results of the current sketch. If so, - /// it suggests to delete them as there are no functionality to show back hidden sketch objects - /// \param theObjects a list of hidden objects - //virtual void processHiddenObject(const std::list& theObjects); - - /// Returns true if the mouse is over viewer or property panel value is changed - /// \return boolean result + // bool canCommitOperation() const; + + /// Returns whether the object can be erased at the bounds of the active + /// operation. Sketch sub-entities can not be erased during the sketch + /// operation \param theObject a model object + bool canEraseObject(const ObjectPtr &theObject) const; + + /// Returns whether the object can be displayed at the bounds of the active + /// operation. Display only current operation results for usual operation and + /// ask the sketcher manager if it is a sketch operation \param theObject a + /// model object + bool canDisplayObject(const ObjectPtr &theObject) const; + + /// Returns whether the constraint object can be displayed. It depends on the + /// sketch check box states \param theObject a model object \param theState + /// the constraint visible state state to be checked \param isProcessed an + /// output parameter if it is processed \return result value + bool + canDisplayConstraint(const FeaturePtr &theObject, + const PartSet_Tools::ConstraintVisibleState &theState, + bool &isProcessed) const; + + /// Check the given objects either there are some results of the current + /// sketch. If so, it suggests to delete them as there are no functionality to + /// show back hidden sketch objects \param theObjects a list of hidden objects + // virtual void processHiddenObject(const std::list& theObjects); + + /// Returns true if the mouse is over viewer or property panel value is + /// changed \return boolean result bool canDisplayCurrentCreatedFeature() const; - /// Returns true if the current operation is nested creation or internal reentrant edit - /// \param theOperation an operation - bool canChangeCursor(ModuleBase_Operation* theOperation) const; + /// Returns true if the current operation is nested creation or internal + /// reentrant edit \param theOperation an operation + bool canChangeCursor(ModuleBase_Operation *theOperation) const; /// Returns state of constraints showing flag - const QMap& showConstraintStates(); + const QMap & + showConstraintStates(); - /// Returns true if the object is a current sketch sub feature of a result of the feature - /// \param theObject an object - /// \return boolean value - bool isObjectOfSketch(const ObjectPtr& theObject) const; + /// Returns true if the object is a current sketch sub feature of a result of + /// the feature \param theObject an object \return boolean value + bool isObjectOfSketch(const ObjectPtr &theObject) const; /// Enumeration for selection mode used enum SelectionType { - ST_HighlightType, /// Only highlighted objects - ST_SelectType, /// Only selected objects + ST_HighlightType, /// Only highlighted objects + ST_SelectType, /// Only selected objects ST_SelectAndHighlightType /// Both, highlighted and selected objects }; @@ -315,82 +304,85 @@ public: /// The highlighted objects can be processes as the selected ones /// \param theHighlightedOnly a boolean flag /// \param theCurrentSelection a container filled by the current selection - void storeSelection(const SelectionType theType, FeatureToSelectionMap& theCurrentSelection); + void storeSelection(const SelectionType theType, + FeatureToSelectionMap &theCurrentSelection); /// Restores previously saved selection state /// \param theCurrentSelection a container filled by the current selection - void restoreSelection(FeatureToSelectionMap& theCurrentSelection); + void restoreSelection(FeatureToSelectionMap &theCurrentSelection); /// Return error state of the sketch feature, true if the error has happened /// \return boolean value bool sketchSolverError(); - //! Returns the feature error if the current state of the feature in the sketch is not correct - //! If the feature is correct, it returns an empty value + //! Returns the feature error if the current state of the feature in the + //! sketch is not correct If the feature is correct, it returns an empty value //! Incorrect states: the feature is sketch, the solver error value //! The feature value is reset, this is the flag of sketch mgr //! \return string value - QString getFeatureError(const FeaturePtr& theFeature); + QString getFeatureError(const FeaturePtr &theFeature); /// It nullify internal flags concerned to clicked mouse event void clearClickedFlags(); - /// Returns list of strings which contains id's of sketch replication operations - static const QStringList& replicationsIdList(); + /// Returns list of strings which contains id's of sketch replication + /// operations + static const QStringList &replicationsIdList(); /// Returns list of strings which contains id's of constraints operations - static const QStringList& constraintsIdList(); + static const QStringList &constraintsIdList(); /// Returns a list of modes, where the AIS objects should be activated - /// \param theSketch a sketch object, modes are empty if sketch plane is not defined yet - /// \param theModes a list of modes - static void sketchSelectionModes(const CompositeFeaturePtr& theSketch, QIntList& theModes); + /// \param theSketch a sketch object, modes are empty if sketch plane is not + /// defined yet \param theModes a list of modes + static void sketchSelectionModes(const CompositeFeaturePtr &theSketch, + QIntList &theModes); /// Create specific for the module presentation /// \param theResult an object for presentation /// \return created presentation or NULL(default value) - Handle(AIS_InteractiveObject) createPresentation(const ObjectPtr& theResult); + Handle(AIS_InteractiveObject) createPresentation(const ObjectPtr &theResult); - /// Connects or disconnects to the value changed signal of the property panel widgets - /// \param theWidget a property contol widget - /// \param isToConnect a boolean value whether connect or disconnect - void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect); + /// Connects or disconnects to the value changed signal of the property panel + /// widgets \param theWidget a property contol widget \param isToConnect a + /// boolean value whether connect or disconnect + void connectToPropertyPanel(ModuleBase_ModelWidget *theWidget, + const bool isToConnect); - /// Visualize the operation feature if the previous state is modified value in property panel - /// \param thePreviousState the previous widget value state + /// Visualize the operation feature if the previous state is modified value in + /// property panel \param thePreviousState the previous widget value state void widgetStateChanged(int thePreviousState); - /// If the current operation is a dimention one, the style of dimension visualization is send for - /// the current object - /// \param theObject an object to be customized - //void customisePresentation(const ObjectPtr& theObject); + /// If the current operation is a dimention one, the style of dimension + /// visualization is send for the current object \param theObject an object to + /// be customized + // void customisePresentation(const ObjectPtr& theObject); - void customizeSketchPresentation(const ObjectPtr& theObject, const AISObjectPtr& thePrs) const; + void customizeSketchPresentation(const ObjectPtr &theObject, + const AISObjectPtr &thePrs) const; /// Update sketch presentations according to the the state /// \param theType a type of sketch visualization style /// \param theState a boolean state - void updateBySketchParameters(const PartSet_Tools::ConstraintVisibleState& theType, - bool theState); + void + updateBySketchParameters(const PartSet_Tools::ConstraintVisibleState &theType, + bool theState); - bool isShowFreePointsShown() const { - return myPointsHighlight.size() > 0; - } + bool isShowFreePointsShown() const { return myPointsHighlight.size() > 0; } - PartSet_Module* module() const { return myModule; } + PartSet_Module *module() const { return myModule; } /** \brief Implementation of Event Listener method - * \param[in] theMessage the data of the event - */ - virtual void processEvent(const std::shared_ptr& theMessage); + * \param[in] theMessage the data of the event + */ + virtual void processEvent(const std::shared_ptr &theMessage); /// Returns true if current mode of objects creation is by drag mouse bool isDragModeCreation() const; - public slots: /// Process sketch plane selected event - void onPlaneSelected(const std::shared_ptr& thePln); + void onPlaneSelected(const std::shared_ptr &thePln); /// The slot is called when user checks "Show free points" button /// \param toShow a state of the check box @@ -399,24 +391,26 @@ public slots: private slots: /// Toggle show constraints void onShowConstraintsToggle(int theType, bool theState); - /// Process the enter mouse to the view port. If the current operation is a create of - /// a nested sketch feature, it updates internal flags to display the feature on mouse move + /// Process the enter mouse to the view port. If the current operation is a + /// create of a nested sketch feature, it updates internal flags to display + /// the feature on mouse move void onEnterViewPort(); - /// Process the leave mouse of the view port. If the current operation is a create of - /// a nested sketch feature, it hides the feature in the viewer + /// Process the leave mouse of the view port. If the current operation is a + /// create of a nested sketch feature, it hides the feature in the viewer void onLeaveViewPort(); - /// Listens to the value changed signal and display the current operation feature - //void onBeforeValuesChangedInPropertyPanel(); + /// Listens to the value changed signal and display the current operation + /// feature + // void onBeforeValuesChangedInPropertyPanel(); /// Listens to the signal about the modification of the values /// have been done in the property panel - //void onAfterValuesChangedInPropertyPanel(); + // void onAfterValuesChangedInPropertyPanel(); - void onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*); - void onMouseReleased(ModuleBase_IViewWindow*, QMouseEvent*); - void onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*); - void onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*); + void onMousePressed(ModuleBase_IViewWindow *, QMouseEvent *); + void onMouseReleased(ModuleBase_IViewWindow *, QMouseEvent *); + void onMouseMoved(ModuleBase_IViewWindow *, QMouseEvent *); + void onMouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *); void onApplicationStarted(); - //void onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget); + // void onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget); void onBeforeContextMenu(); void onAfterContextMenu(); @@ -427,33 +421,33 @@ private: /// Converts mouse position to 2d coordinates. /// Member myCurrentSketch has to be correctly defined - void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent, - Point& thePoint); + void get2dPoint(ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent, + Point &thePoint); - /// Show distance value editor if it is a distance operation and all attribute references - /// are filled by preseletion - /// \return true if the value is accepted - static bool setDistanceValueByPreselection(ModuleBase_Operation* theOperation, - ModuleBase_IWorkshop* theWorkshop, - bool& theCanCommitOperation); + /// Show distance value editor if it is a distance operation and all attribute + /// references are filled by preseletion \return true if the value is accepted + static bool setDistanceValueByPreselection(ModuleBase_Operation *theOperation, + ModuleBase_IWorkshop *theWorkshop, + bool &theCanCommitOperation); /// Applyes the current selection to the object in the workshop viewer - /// It includes the selection in all modes of activation, even local context - vertexes, edges - /// It gets all results of the feature, find an AIS object in the viewer and takes all BRep - /// selection owners. If the owner is vertex, the corresponded attribute is seached in - /// the feature and if it is in the container of selected attributes, the owner is put in the - /// out container. If the owner is edge and the current result is in the container of selected - /// results, the owner is put in the out container. - /// \param theFeature a feature or result object - /// \param theSketch a current sketch feature - /// \param theWorkshop a workshop to have an access to AIS context and displayer - /// \param theSelection a container of the selection, it has results and attributres for a feature - /// \param theOwnersToSelect an out container of found owners - static void getSelectionOwners(const FeaturePtr& theFeature, - const FeaturePtr& theSketch, - ModuleBase_IWorkshop* theWorkshop, - const FeatureToSelectionMap& theSelection, - SelectMgr_IndexedMapOfOwner& theOwnersToSelect); + /// It includes the selection in all modes of activation, even local context - + /// vertexes, edges It gets all results of the feature, find an AIS object in + /// the viewer and takes all BRep selection owners. If the owner is vertex, + /// the corresponded attribute is seached in the feature and if it is in the + /// container of selected attributes, the owner is put in the out container. + /// If the owner is edge and the current result is in the container of + /// selected results, the owner is put in the out container. \param theFeature + /// a feature or result object \param theSketch a current sketch feature + /// \param theWorkshop a workshop to have an access to AIS context and + /// displayer \param theSelection a container of the selection, it has results + /// and attributres for a feature \param theOwnersToSelect an out container of + /// found owners + static void + getSelectionOwners(const FeaturePtr &theFeature, const FeaturePtr &theSketch, + ModuleBase_IWorkshop *theWorkshop, + const FeatureToSelectionMap &theSelection, + SelectMgr_IndexedMapOfOwner &theOwnersToSelect); /// Returns true if the created feature is visible /// \param @@ -461,18 +455,20 @@ private: /// Returns a current operation /// \return an operation - ModuleBase_Operation* getCurrentOperation() const; + ModuleBase_Operation *getCurrentOperation() const; /// Get the active widget in the property panel - ModuleBase_ModelWidget* getActiveWidget() const; + ModuleBase_ModelWidget *getActiveWidget() const; - /// Erase or display the feature of the current operation. If the mouse over the active view or - /// a current value is changed by property panel, the feature is displayed otherwise it is hidden - /// \param theOperation an operation which feature is to be displayed, + /// Erase or display the feature of the current operation. If the mouse over + /// the active view or a current value is changed by property panel, the + /// feature is displayed otherwise it is hidden \param theOperation an + /// operation which feature is to be displayed, /// it is nested create operation /// \param isToDisplay a flag about the display or erase the feature - void visualizeFeature(const FeaturePtr& theFeature, const bool isEditOperation, - const bool isToDisplay, const bool isFlushRedisplay = true); + void visualizeFeature(const FeaturePtr &theFeature, + const bool isEditOperation, const bool isToDisplay, + const bool isFlushRedisplay = true); private: /// Updates selection priority of the presentation @@ -480,18 +476,21 @@ private: /// \param theFeature a feature of the presentation void updateSelectionPriority(ObjectPtr theObject, FeaturePtr theFeature); /// Returns current workshop - XGUI_Workshop* workshop() const; + XGUI_Workshop *workshop() const; /// Returns operation manager - XGUI_OperationMgr* operationMgr() const; + XGUI_OperationMgr *operationMgr() const; - std::vector colorOfObject(const ObjectPtr& theObject, - const FeaturePtr& aFeature, bool isConstruction) const; + std::vector colorOfObject(const ObjectPtr &theObject, + const FeaturePtr &aFeature, + bool isConstruction) const; private: - PartSet_Module* myModule; - PartSet_PreviewSketchPlane* mySketchPlane; // display/erase sketch plane on start/stop sketch + PartSet_Module *myModule; + PartSet_PreviewSketchPlane + *mySketchPlane; // display/erase sketch plane on start/stop sketch - bool myPreviousDrawModeEnabled; // the previous selection enabled state in the viewer + bool myPreviousDrawModeEnabled; // the previous selection enabled state in the + // viewer bool myIsEditLaunching; bool myIsDragging; bool myDragDone; @@ -500,7 +499,7 @@ private: bool myIsMouseOverViewProcessed; bool myIsPopupMenuActive; /// the state of the popup menu is shown Point myCurrentPoint; - //Point myClickedPoint; + // Point myClickedPoint; CompositeFeaturePtr myCurrentSketch; @@ -511,7 +510,7 @@ private: QMap myIsConstraintsShown; - PartSet_ExternalPointsMgr* myExternalPointsMgr; + PartSet_ExternalPointsMgr *myExternalPointsMgr; QMap myPointsHighlight; @@ -520,5 +519,4 @@ private: QPoint myMousePoint; }; - -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 5dfd5a26f..50ef2239d 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_SketcherReentrantMgr.h" @@ -23,85 +24,77 @@ #include "PartSet_SketcherMgr.h" #include "PartSet_WidgetPoint2d.h" -#include "ModelAPI_Session.h" -#include "ModelAPI_AttributeString.h" #include "ModelAPI_AttributeRefAttr.h" #include "ModelAPI_AttributeReference.h" +#include "ModelAPI_AttributeString.h" #include "ModelAPI_EventReentrantMessage.h" +#include "ModelAPI_Session.h" #include "GeomDataAPI_Point2D.h" -#include "GeomAPI_Lin2d.h" #include "GeomAPI_Dir2d.h" +#include "GeomAPI_Lin2d.h" +#include "ModuleBase_ISelection.h" +#include "ModuleBase_ToolBox.h" #include #include -#include #include -#include -#include -#include +#include +#include #include +#include +#include #include -#include -#include "ModuleBase_ToolBox.h" -#include "ModuleBase_ISelection.h" +#include +#include +#include #include #include #include #include #include -#include #include -#include -#include +#include -#include +#include #include #include #include -#include #include +#include #include //#define DEBUG_RESTART -PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop* theWorkshop) -: QObject(theWorkshop), - myWorkshop(theWorkshop), - myRestartingMode(RM_None), - myIsFlagsBlocked(false), - myIsInternalEditOperation(false), - myNoMoreWidgetsAttribute(""), - myIsAutoConstraints(true), - myLastAutoConstraint(0) -{ -} +PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr( + ModuleBase_IWorkshop *theWorkshop) + : QObject(theWorkshop), myWorkshop(theWorkshop), myRestartingMode(RM_None), + myIsFlagsBlocked(false), myIsInternalEditOperation(false), + myNoMoreWidgetsAttribute(""), myIsAutoConstraints(true), + myLastAutoConstraint(0) {} -PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() -{ -} +PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() {} -bool PartSet_SketcherReentrantMgr::isInternalEditActive() const -{ +bool PartSet_SketcherReentrantMgr::isInternalEditActive() const { return myIsInternalEditOperation; } -void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() -{ - if (myIsInternalEditOperation) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); +void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() { + if (myIsInternalEditOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); QString anError = myWorkshop->module()->getFeatureError(aFeature); - // stop started internal edit operation as soon as the operation becomes invalid - // it is especially important for the sketch tangent arc feature + // stop started internal edit operation as soon as the operation becomes + // invalid it is especially important for the sketch tangent arc feature if (!anError.isEmpty()) { aFOperation->setEditOperation(false); - //workshop()->operationMgr()->updateApplyOfOperations(); + // workshop()->operationMgr()->updateApplyOfOperations(); myIsInternalEditOperation = false; updateAcceptAllAction(); } @@ -109,8 +102,8 @@ void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() } } -bool PartSet_SketcherReentrantMgr::operationCommitted(ModuleBase_Operation* theOperation) -{ +bool PartSet_SketcherReentrantMgr::operationCommitted( + ModuleBase_Operation *theOperation) { bool aProcessed = false; if (!isActiveMgr()) return aProcessed; @@ -121,44 +114,48 @@ bool PartSet_SketcherReentrantMgr::operationCommitted(ModuleBase_Operation* theO return aProcessed; } -void PartSet_SketcherReentrantMgr::operationStarted(ModuleBase_Operation* theOperation) -{ +void PartSet_SketcherReentrantMgr::operationStarted( + ModuleBase_Operation *theOperation) { if (!isActiveMgr()) return; - //if (myPreviousFeature.get() && myRestartingMode == RM_LastFeatureUsed) { - //ModuleBase_OperationFeature* aCurrentOperation = dynamic_cast( - // myWorkshop->currentOperation()); - //CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); - //if (myPreviousFeature.get() && myPreviousFeature->data()->isValid()) // it is not removed - //copyReetntrantAttributes(myPreviousFeature, aCurrentOperation->feature(), aSketch); + // if (myPreviousFeature.get() && myRestartingMode == RM_LastFeatureUsed) { + // ModuleBase_OperationFeature* aCurrentOperation = + // dynamic_cast( + // myWorkshop->currentOperation()); + // CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); + // if (myPreviousFeature.get() && myPreviousFeature->data()->isValid()) // it + // is not removed copyReetntrantAttributes(myPreviousFeature, + // aCurrentOperation->feature(), aSketch); //} resetFlags(); } -void PartSet_SketcherReentrantMgr::operationAborted(ModuleBase_Operation* theOperation) -{ +void PartSet_SketcherReentrantMgr::operationAborted( + ModuleBase_Operation *theOperation) { if (!isActiveMgr()) return; resetFlags(); } -bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent) -{ +bool PartSet_SketcherReentrantMgr::processMouseMoved( + ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent) { bool aProcessed = false; if (!isActiveMgr()) return aProcessed; - if (myIsInternalEditOperation) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); - FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature() - : FeaturePtr(); + if (myIsInternalEditOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); + FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed + ? aFOperation->feature() + : FeaturePtr(); if (aLastFeature) { - ModuleBase_ModelWidget* anActiveWidget = module()->activeWidget(); - ModuleBase_IPropertyPanel* aPanel = myWorkshop->currentOperation()->propertyPanel(); + ModuleBase_ModelWidget *anActiveWidget = module()->activeWidget(); + ModuleBase_IPropertyPanel *aPanel = + myWorkshop->currentOperation()->propertyPanel(); FeaturePtr aCurrentFeature = aFOperation->feature(); bool isLineFeature = false, isReentrantArcFeature = false; @@ -166,15 +163,16 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* the if (aCurrentFeature->getKind() == SketchPlugin_Line::ID()) { anAttributeOnStart = SketchPlugin_Line::START_ID(); isLineFeature = anActiveWidget->attributeID() == anAttributeOnStart; - } - else if (isTangentArc(aFOperation, module()->sketchMgr()->activeSketch())) { + } else if (isTangentArc(aFOperation, + module()->sketchMgr()->activeSketch())) { isReentrantArcFeature = true; } bool aCanBeActivatedByMove = isLineFeature || isReentrantArcFeature; if (aCanBeActivatedByMove) { - /// before restarting of operation we need to clear selection, as it may take part in - /// new feature creation, e.g. tangent arc. But it is not necessary as it was processed - /// by mouse release when the operation was restarted. + /// before restarting of operation we need to clear selection, as it may + /// take part in new feature creation, e.g. tangent arc. But it is not + /// necessary as it was processed by mouse release when the operation + /// was restarted. workshop()->selector()->clearSelection(); myPreviousFeature = aFOperation->feature(); @@ -183,14 +181,16 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* the anActiveWidget = module()->activeWidget(); aProcessed = true; - if (anActiveWidget && anActiveWidget->attributeID() == anAttributeOnStart) { + if (anActiveWidget && + anActiveWidget->attributeID() == anAttributeOnStart) { // it was not deactivated by preselection processing aPanel->activateNextWidget(anActiveWidget); } } else { // processing mouse move in active widget of restarted operation - ModuleBase_ModelWidget* anActiveWdg = module()->activeWidget(); - PartSet_MouseProcessor* aProcessor = dynamic_cast(anActiveWdg); + ModuleBase_ModelWidget *anActiveWdg = module()->activeWidget(); + PartSet_MouseProcessor *aProcessor = + dynamic_cast(anActiveWdg); if (aProcessor) aProcessor->mouseMoved(theWnd, theEvent); } @@ -199,63 +199,67 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* the return aProcessed; } -bool PartSet_SketcherReentrantMgr::processMousePressed(ModuleBase_IViewWindow* /* theWnd*/, - QMouseEvent* /* theEvent*/) -{ +bool PartSet_SketcherReentrantMgr::processMousePressed( + ModuleBase_IViewWindow * /* theWnd*/, QMouseEvent * /* theEvent*/) { return isActiveMgr() && myIsInternalEditOperation; } -bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) -{ +bool PartSet_SketcherReentrantMgr::processMouseReleased( + ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) { bool aProcessed = false; if (!isActiveMgr()) return aProcessed; if (myIsInternalEditOperation) { - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + ModuleBase_Operation *anOperation = myWorkshop->currentOperation(); + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); + ModuleBase_ModelWidget *anActiveWidget = aPanel->activeWidget(); if (!anActiveWidget || !anActiveWidget->isViewerSelector()) { // block of viewer update - // we need to block update content of the viewer because of Sketch Point feature - // in activate() the value of the point is initialized and it can be displayed - // but the default value is [0, 0]. So, we block update viewer contentent until - // onMouseRelease happens, which correct the point position + // we need to block update content of the viewer because of Sketch Point + // feature in activate() the value of the point is initialized and it can + // be displayed but the default value is [0, 0]. So, we block update + // viewer contentent until onMouseRelease happens, which correct the point + // position ModuleBase_Tools::blockUpdateViewer(true); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); myPreviousFeature = aFOperation->feature(); - /// selection should be obtained from workshop before ask if the operation can be started as - /// the canStartOperation method performs commit/abort of previous operation. - /// Sometimes commit/abort - /// may cause selection clear(Sketch operation) as a result - /// it will be lost and is not used for preselection. - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + /// selection should be obtained from workshop before ask if the operation + /// can be started as the canStartOperation method performs commit/abort + /// of previous operation. Sometimes commit/abort may cause selection + /// clear(Sketch operation) as a result it will be lost and is not used + /// for preselection. + ModuleBase_ISelection *aSelection = myWorkshop->selection(); QList aPreSelected = - aSelection->getSelected(ModuleBase_ISelection::AllControls); + aSelection->getSelected(ModuleBase_ISelection::AllControls); - myClickedSketchPoint = PartSet_Tools::getPnt2d(theEvent, theWindow, - module()->sketchMgr()->activeSketch()); + myClickedSketchPoint = PartSet_Tools::getPnt2d( + theEvent, theWindow, module()->sketchMgr()->activeSketch()); FeaturePtr anExternalCreatedFeature; if (!aPreSelected.empty()) { ModuleBase_ViewerPrsPtr aValue = aPreSelected.first(); - module()->getGeomSelection(aValue, mySelectedObject, mySelectedAttribute); + module()->getGeomSelection(aValue, mySelectedObject, + mySelectedAttribute); - PartSet_WidgetPoint2D* aPointWidget = dynamic_cast(anActiveWidget); + PartSet_WidgetPoint2D *aPointWidget = + dynamic_cast(anActiveWidget); if (aPointWidget) { GeomShapePtr aShape; aPointWidget->getGeomSelection_(aValue, mySelectedObject, aShape); - ObjectPtr anExternalObject = - aPointWidget->getExternalObjectMgr()->getExternalObjectValidated(); - // if external object is during reentrant operation and is used as a parameter of feature - // it should be removed after the operation is restarted. (Circle feature, Projection) + ObjectPtr anExternalObject = aPointWidget->getExternalObjectMgr() + ->getExternalObjectValidated(); + // if external object is during reentrant operation and is used as a + // parameter of feature it should be removed after the operation is + // restarted. (Circle feature, Projection) if (anExternalObject.get()) - anExternalCreatedFeature = ModelAPI_Feature::feature(anExternalObject); + anExternalCreatedFeature = + ModelAPI_Feature::feature(anExternalObject); } } @@ -275,29 +279,31 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* aProcessed = true; // fill the first widget by the mouse event point - // if the active widget is not the first, it means that the restarted operation is filled by - // the current preselection. - PartSet_MouseProcessor* aMouseProcessor = dynamic_cast( - module()->activeWidget()); - //PartSet_WidgetPoint2D* aPoint2DWdg = - // dynamic_cast(module()->activeWidget()); - PartSet_MouseProcessor* aFirstWidget = dynamic_cast( - aPanel->findFirstAcceptingValueWidget()); - //if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) { + // if the active widget is not the first, it means that the restarted + // operation is filled by the current preselection. + PartSet_MouseProcessor *aMouseProcessor = + dynamic_cast(module()->activeWidget()); + // PartSet_WidgetPoint2D* aPoint2DWdg = + // dynamic_cast(module()->activeWidget()); + PartSet_MouseProcessor *aFirstWidget = + dynamic_cast( + aPanel->findFirstAcceptingValueWidget()); + // if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) { if (aMouseProcessor && aMouseProcessor == aFirstWidget) { std::shared_ptr aSelectedPrs; if (!aPreSelected.empty()) aSelectedPrs = aPreSelected.front(); - if (aSelectedPrs.get() && aSelectedPrs->object().get() - && !aSelectedPrs->object()->data()->isValid()) { - // the selected object was removed diring restart, e.g. presentable macro feature - // there are created objects to replace the object depending on created feature kind + if (aSelectedPrs.get() && aSelectedPrs->object().get() && + !aSelectedPrs->object()->data()->isValid()) { + // the selected object was removed diring restart, e.g. presentable + // macro feature there are created objects to replace the object + // depending on created feature kind aSelectedPrs = std::shared_ptr(); } aMouseProcessor->setPreSelection(aSelectedPrs, theWindow, theEvent); - //aPoint2DWdg->mouseReleased(theWindow, theEvent); - //if (!aPreSelected.empty()) - // aPoint2DWdg->setPreSelection(ModuleBase_ViewerPrsPtr()); + // aPoint2DWdg->mouseReleased(theWindow, theEvent); + // if (!aPreSelected.empty()) + // aPoint2DWdg->setPreSelection(ModuleBase_ViewerPrsPtr()); } // unblock viewer update ModuleBase_Tools::blockUpdateViewer(false); @@ -308,14 +314,14 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* //****************************************************** void PartSet_SketcherReentrantMgr::setReentrantPreSelection( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { ReentrantMessagePtr aReentrantMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (!aReentrantMessage.get()) return; - // if feature has already filled the selected object, we should not overwrite it + // if feature has already filled the selected object, we should not overwrite + // it if (!aReentrantMessage->selectedObject().get()) aReentrantMessage->setSelectedObject(mySelectedObject); @@ -323,27 +329,29 @@ void PartSet_SketcherReentrantMgr::setReentrantPreSelection( aReentrantMessage->setClickedPoint(myClickedSketchPoint); } -//void PartSet_SketcherReentrantMgr::onWidgetActivated() +// void PartSet_SketcherReentrantMgr::onWidgetActivated() //{ -// if (!isActiveMgr()) -// return; -// if (!myIsInternalEditOperation) -// return; +// if (!isActiveMgr()) +// return; +// if (!myIsInternalEditOperation) +// return; // -// PartSet_Module* aModule = module(); -// ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); -// ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel(); -// if (aFirstWidget != aPanel->activeWidget()) { -// ModuleBase_WidgetSelector* aWSelector = dynamic_cast -// (aFirstWidget); -// if (aWSelector) { -// myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector); -// } -// } -//} - -void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID) -{ +// PartSet_Module* aModule = module(); +// ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); +// ModuleBase_IPropertyPanel* aPanel = +// aModule->currentOperation()->propertyPanel(); if (aFirstWidget != +// aPanel->activeWidget()) { +// ModuleBase_WidgetSelector* aWSelector = +// dynamic_cast +// (aFirstWidget); +// if (aWSelector) { +// myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector); +// } +// } +// } + +void PartSet_SketcherReentrantMgr::onNoMoreWidgets( + const std::string &thePreviousAttributeID) { #ifdef DEBUG_RESTART std::cout << "PartSet_SketcherReentrantMgr::onNoMoreWidgets" << std::endl; #endif @@ -351,17 +359,18 @@ void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviou if (!isActiveMgr()) return; - // we should avoid processing of the signal about no more widgets attributes and - // do this after the restart operaion is finished if it was called - // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute - // if it should be called after restart + // we should avoid processing of the signal about no more widgets attributes + // and do this after the restart operaion is finished if it was called + // onNoMoreWidgets depends on myIsFlagsBlocked and fill + // myNoMoreWidgetsAttribute if it should be called after restart if (myIsFlagsBlocked) { myNoMoreWidgetsAttribute = thePreviousAttributeID; return; } - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (module()->sketchMgr()->isDragModeCreation()) { if (aFOperation && myIsAutoConstraints) addConstraints(aFOperation->feature()); @@ -370,11 +379,11 @@ void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviou if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) return; - if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { + if (aFOperation && + module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { if (aFOperation->isNeedToBeAborted()) { aFOperation->abort(); - } - else { + } else { bool isStarted = false; if (!module()->sketchMgr()->sketchSolverError()) { if (myRestartingMode != RM_Forbided) { @@ -391,20 +400,21 @@ void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviou } } -bool PartSet_SketcherReentrantMgr::processEnter(const std::string& thePreviousAttributeID) -{ +bool PartSet_SketcherReentrantMgr::processEnter( + const std::string &thePreviousAttributeID) { bool isDone = false; if (!isActiveMgr()) return isDone; - // empty previous attribute means that the Apply/Ok button has focus and the enter - // should not lead to start edition mode of the previous operation + // empty previous attribute means that the Apply/Ok button has focus and the + // enter should not lead to start edition mode of the previous operation if (thePreviousAttributeID.empty()) return isDone; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) return isDone; @@ -414,26 +424,27 @@ bool PartSet_SketcherReentrantMgr::processEnter(const std::string& thePreviousAt myRestartingMode = RM_EmptyFeatureUsed; // It seems that the call is obsolete for Enter key processing // It prevent finalysing of the current operation by Enter key - //isDone = startInternalEdit(thePreviousAttributeID); + // isDone = startInternalEdit(thePreviousAttributeID); } return isDone; } -void PartSet_SketcherReentrantMgr::onVertexSelected() -{ +void PartSet_SketcherReentrantMgr::onVertexSelected() { if (!isActiveMgr()) return; - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->currentOperation(); std::string anOperationId = anOperation->id().toStdString(); if (anOperationId == SketchPlugin_Line::ID() || isTangentArc(anOperation, module()->sketchMgr()->activeSketch())) { - /// If last line finished on vertex the lines creation sequence has to be break - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); - const QList& aWidgets = aPanel->modelWidgets(); - QList::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end(); + /// If last line finished on vertex the lines creation sequence has to be + /// break + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); + ModuleBase_ModelWidget *anActiveWidget = aPanel->activeWidget(); + const QList &aWidgets = aPanel->modelWidgets(); + QList::const_iterator anIt = aWidgets.begin(), + aLast = aWidgets.end(); bool aFoundWidget = false; bool aFoundObligatory = false; for (; anIt != aLast && !aFoundObligatory; anIt++) { @@ -447,38 +458,37 @@ void PartSet_SketcherReentrantMgr::onVertexSelected() } } -void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() -{ +void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() { if (isInternalEditActive()) { - ModuleBase_ModelWidget* aWidget = (ModuleBase_ModelWidget*)sender(); + ModuleBase_ModelWidget *aWidget = (ModuleBase_ModelWidget *)sender(); if (!aWidget->isModifiedInEdit().empty()) restartOperation(); } } -void PartSet_SketcherReentrantMgr::onBeforeStopped() -{ +void PartSet_SketcherReentrantMgr::onBeforeStopped() { if (!isActiveMgr() || !myIsInternalEditOperation) return; beforeStopInternalEdit(); } -bool PartSet_SketcherReentrantMgr::canBeCommittedByPreselection() -{ +bool PartSet_SketcherReentrantMgr::canBeCommittedByPreselection() { return !isActiveMgr() || myRestartingMode == RM_None; } -bool PartSet_SketcherReentrantMgr::isActiveMgr() const -{ - ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation(); +bool PartSet_SketcherReentrantMgr::isActiveMgr() const { + ModuleBase_Operation *aCurrentOperation = myWorkshop->currentOperation(); bool anActive = PartSet_SketcherMgr::isSketchOperation(aCurrentOperation); if (!anActive) { - anActive = module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation); - if (anActive) { // the manager is not active when the current operation is a usual Edit - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); + anActive = + module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation); + if (anActive) { // the manager is not active when the current operation is a + // usual Edit + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation->isEditOperation()) anActive = myIsInternalEditOperation; } @@ -486,80 +496,92 @@ bool PartSet_SketcherReentrantMgr::isActiveMgr() const return anActive; } -bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) -{ +bool PartSet_SketcherReentrantMgr::startInternalEdit( + const std::string &thePreviousAttributeID) { #ifdef DEBUG_RESTART std::cout << "PartSet_SketcherReentrantMgr::startInternalEdit" << std::endl; #endif bool isDone = false; - /// this is workaround for ModuleBase_WidgetEditor, used in SALOME mode. Sometimes key enter - /// event comes two times, so we should not start another internal edit operation - /// the Apply button becomes disabled becase the second additional internal feature is created + /// this is workaround for ModuleBase_WidgetEditor, used in SALOME mode. + /// Sometimes key enter event comes two times, so we should not start another + /// internal edit operation the Apply button becomes disabled becase the + /// second additional internal feature is created if (myIsInternalEditOperation) return true; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); - if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { - /// improvement to deselect automatically all eventual selected objects, when + if (aFOperation && + module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { + /// improvement to deselect automatically all eventual selected objects, + /// when // returning to the neutral point of the Sketcher or start internal edit workshop()->selector()->clearSelection(); if (myIsAutoConstraints) addConstraints(aFOperation->feature()); - aFOperation->setEditOperation(true/*, false*/); + aFOperation->setEditOperation(true /*, false*/); createInternalFeature(); myIsInternalEditOperation = true; updateAcceptAllAction(); isDone = true; - connect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped())); - connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped())); + connect(aFOperation, SIGNAL(beforeCommitted()), this, + SLOT(onBeforeStopped())); + connect(aFOperation, SIGNAL(beforeAborted()), this, + SLOT(onBeforeStopped())); // activate selection filters of the first widget in the viewer - //onWidgetActivated(); + // onWidgetActivated(); // activate the last active widget in the Property Panel if (!thePreviousAttributeID.empty()) { - ModuleBase_Operation* anEditOperation = module()->currentOperation(); + ModuleBase_Operation *anEditOperation = module()->currentOperation(); if (anEditOperation) { - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - ModuleBase_ModelWidget* aPreviousAttributeWidget = 0; - QList aWidgets = aPanel->modelWidgets(); - for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) { + ModuleBase_IPropertyPanel *aPanel = aFOperation->propertyPanel(); + ModuleBase_ModelWidget *aPreviousAttributeWidget = 0; + QList aWidgets = aPanel->modelWidgets(); + for (int i = 0, aNb = aWidgets.size(); + i < aNb && !aPreviousAttributeWidget; i++) { if (aWidgets[i]->attributeID() == thePreviousAttributeID) { - // workaround for the same attributes used in different stacked widgets(attribute types) + // workaround for the same attributes used in different stacked + // widgets(attribute types) if (ModuleBase_ToolBox::isOffToolBoxParent(aWidgets[i])) continue; aPreviousAttributeWidget = aWidgets[i]; } } - // If the current widget is a selector, do nothing, it processes the mouse press + // If the current widget is a selector, do nothing, it processes the + // mouse press if (aPreviousAttributeWidget) { if (!aPreviousAttributeWidget->isViewerSelector()) { aPreviousAttributeWidget->focusTo(); aPreviousAttributeWidget->emitFocusInWidget(); aPreviousAttributeWidget->selectContent(); - } - else { - // in case of shape multi selector, the widget does not lose focus by filling - // like it is in shape selector. So, if enter is pressed, the multi shape selector - // control should be deactivated. The focus is moved to Apply button and there - // should not be active control visualized in property panel + } else { + // in case of shape multi selector, the widget does not lose focus + // by filling like it is in shape selector. So, if enter is pressed, + // the multi shape selector control should be deactivated. The focus + // is moved to Apply button and there should not be active control + // visualized in property panel if (aPreviousAttributeWidget == aPanel->activeWidget()) { aPanel->activateWidget(NULL, false); } // if there is no the next widget to be automatically activated, // the Ok button in property - // panel should accept the focus(example is parallel constraint on sketch lines) - QToolButton* anOkBtn = - dynamic_cast(aPanel)->findButton(PROP_PANEL_OK); + // panel should accept the focus(example is parallel constraint on + // sketch lines) + QToolButton *anOkBtn = + dynamic_cast(aPanel)->findButton( + PROP_PANEL_OK); if (anOkBtn) - ModuleBase_Tools::setFocus(anOkBtn, "XGUI_PropertyPanel::activateNextWidget"); + ModuleBase_Tools::setFocus( + anOkBtn, "XGUI_PropertyPanel::activateNextWidget"); } } } @@ -571,31 +593,33 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi return isDone; } -void PartSet_SketcherReentrantMgr::beforeStopInternalEdit() -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); +void PartSet_SketcherReentrantMgr::beforeStopInternalEdit() { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { - disconnect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped())); - disconnect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped())); + disconnect(aFOperation, SIGNAL(beforeCommitted()), this, + SLOT(onBeforeStopped())); + disconnect(aFOperation, SIGNAL(beforeAborted()), this, + SLOT(onBeforeStopped())); } deleteInternalFeature(); } -void PartSet_SketcherReentrantMgr::restartOperation() -{ +void PartSet_SketcherReentrantMgr::restartOperation() { #ifdef DEBUG_RESTART std::cout << "PartSet_SketcherReentrantMgr::restartOperation" << std::endl; #endif if (myIsInternalEditOperation) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast( - myWorkshop->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); QList aPreSelected = - aSelection->getSelected(ModuleBase_ISelection::AllControls); + aSelection->getSelected(ModuleBase_ISelection::AllControls); if (myInternalFeature.get()) copyReetntrantAttributes(myInternalFeature, aFOperation->feature(), @@ -603,17 +627,18 @@ void PartSet_SketcherReentrantMgr::restartOperation() myNoMoreWidgetsAttribute = ""; myIsFlagsBlocked = true; - /// launch has 'false' parameter to do not start new operation if the previous operation - /// is not committed. It is important for Line Sketch feature as it uses the previous - /// created feature parameter(to build coincidence), but by abort the previous is removed + /// launch has 'false' parameter to do not start new operation if the + /// previous operation is not committed. It is important for Line Sketch + /// feature as it uses the previous created feature parameter(to build + /// coincidence), but by abort the previous is removed module()->launchOperation(aFOperation->id(), true); myIsFlagsBlocked = false; resetFlags(); - // we should avoid processing of the signal about no more widgets attributes and - // do this after the restart operaion is finished if it was called - // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute - // if it should be called after restart + // we should avoid processing of the signal about no more widgets + // attributes and do this after the restart operaion is finished if it was + // called onNoMoreWidgets depends on myIsFlagsBlocked and fill + // myNoMoreWidgetsAttribute if it should be called after restart if (!myNoMoreWidgetsAttribute.empty()) { onNoMoreWidgets(myNoMoreWidgetsAttribute); myNoMoreWidgetsAttribute = ""; @@ -622,12 +647,13 @@ void PartSet_SketcherReentrantMgr::restartOperation() } } -void PartSet_SketcherReentrantMgr::createInternalFeature() -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); +void PartSet_SketcherReentrantMgr::createInternalFeature() { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); - if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { + if (aFOperation && + module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { FeaturePtr anOperationFeature = aFOperation->feature(); CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); @@ -638,23 +664,25 @@ void PartSet_SketcherReentrantMgr::createInternalFeature() << myInternalFeature->data()->name() << std::endl; #endif - bool isFeatureChanged = copyReetntrantAttributes(anOperationFeature, myInternalFeature, - aSketch, false); - XGUI_PropertyPanel* aPropertyPanel = dynamic_cast - (aFOperation->propertyPanel()); + bool isFeatureChanged = copyReetntrantAttributes( + anOperationFeature, myInternalFeature, aSketch, false); + XGUI_PropertyPanel *aPropertyPanel = + dynamic_cast(aFOperation->propertyPanel()); - myInternalWidget = new QWidget(aPropertyPanel->contentWidget()->pageWidget()); + myInternalWidget = + new QWidget(aPropertyPanel->contentWidget()->pageWidget()); myInternalWidget->setVisible(false); - ModuleBase_PageWidget* anInternalPage = new ModuleBase_PageWidget(myInternalWidget); + ModuleBase_PageWidget *anInternalPage = + new ModuleBase_PageWidget(myInternalWidget); QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myWorkshop); aFactory.createWidget(anInternalPage); - QList aWidgets = aFactory.getModelWidgets(); + QList aWidgets = aFactory.getModelWidgets(); - foreach (ModuleBase_ModelWidget* aWidget, aWidgets) { + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { bool isStoreValue = !aFOperation->isEditOperation() && !aWidget->getDefaultValue().empty() && !aWidget->isComputedDefault(); @@ -663,15 +691,14 @@ void PartSet_SketcherReentrantMgr::createInternalFeature() aWidget->restoreValue(); } - ModuleBase_ModelWidget* aFirstWidget = ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget - (aWidgets); + ModuleBase_ModelWidget *aFirstWidget = + ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget(aWidgets); if (aFirstWidget) setInternalActiveWidget(aFirstWidget); } } -void PartSet_SketcherReentrantMgr::deleteInternalFeature() -{ +void PartSet_SketcherReentrantMgr::deleteInternalFeature() { #ifdef DEBUG_RESTART std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: " << myInternalFeature->data()->name() << std::endl; @@ -686,8 +713,7 @@ void PartSet_SketcherReentrantMgr::deleteInternalFeature() myInternalFeature = FeaturePtr(); } -void PartSet_SketcherReentrantMgr::resetFlags() -{ +void PartSet_SketcherReentrantMgr::resetFlags() { if (!myIsFlagsBlocked) { myIsInternalEditOperation = false; updateAcceptAllAction(); @@ -696,11 +722,9 @@ void PartSet_SketcherReentrantMgr::resetFlags() } } -bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& theSourceFeature, - const FeaturePtr& theNewFeature, - const CompositeFeaturePtr& theSketch, - const bool /*isTemporary*/) -{ +bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes( + const FeaturePtr &theSourceFeature, const FeaturePtr &theNewFeature, + const CompositeFeaturePtr &theSketch, const bool /*isTemporary*/) { bool aChanged = false; if (!theSourceFeature.get() || !theSourceFeature->data().get() || !theSourceFeature->data()->isValid()) @@ -708,18 +732,20 @@ bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& th #ifdef DEBUG_RESTART std::cout << "PartSet_SketcherReentrantMgr::copyReetntrantAttributes from '" - << theSourceFeature->data()->name() << "' to '" << theNewFeature->data()->name() - << "'" << std::endl; + << theSourceFeature->data()->name() << "' to '" + << theNewFeature->data()->name() << "'" << std::endl; #endif std::string aFeatureKind = theSourceFeature->getKind(); /*if (aFeatureKind == SketchPlugin_Line::ID()) { // Initialize new line with first point equal to end of previous std::shared_ptr aSFData = theSourceFeature->data(); - std::shared_ptr aSPoint = std::dynamic_pointer_cast( + std::shared_ptr aSPoint = + std::dynamic_pointer_cast( aSFData->attribute(SketchPlugin_Line::END_ID())); std::shared_ptr aNFData = theNewFeature->data(); - std::shared_ptr aNPoint = std::dynamic_pointer_cast( + std::shared_ptr aNPoint = + std::dynamic_pointer_cast( aNFData->attribute(SketchPlugin_Line::START_ID())); aNPoint->setValue(aSPoint->x(), aSPoint->y()); PartSet_Tools::createConstraint(theSketch, aSPoint, aNPoint); @@ -728,35 +754,37 @@ bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& th aSFData->attribute(SketchPlugin_Line::END_ID())); aNPoint->setValue(aSPoint->x(), aSPoint->y()); } - else*/ if (aFeatureKind == SketchPlugin_MacroCircle::ID()) { + else*/ + if (aFeatureKind == SketchPlugin_MacroCircle::ID()) { // set circle type /*std::string aTypeAttributeId = SketchPlugin_MacroCircle::CIRCLE_TYPE(); - AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId); - AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); - if (aNewFeatureTypeAttr->value() != aTypeAttributeId) // do nothing if there is no changes - aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value()); + AttributeStringPtr aSourceFeatureTypeAttr = + theSourceFeature->data()->string(aTypeAttributeId); AttributeStringPtr + aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); if + (aNewFeatureTypeAttr->value() != aTypeAttributeId) // do nothing if there is + no changes aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value()); //ModuleBase_Tools::flushUpdated(theNewFeature);*/ - //aChanged = true; - } - else if (aFeatureKind == SketchPlugin_MacroArc::ID()) { + // aChanged = true; + } else if (aFeatureKind == SketchPlugin_MacroArc::ID()) { // set arc type /*std::string aTypeAttributeId = SketchPlugin_MacroArc::ARC_TYPE(); - AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId); - AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); - if (aNewFeatureTypeAttr->value() != aTypeAttributeId) // do nothing if there is no changes - aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());*/ + AttributeStringPtr aSourceFeatureTypeAttr = + theSourceFeature->data()->string(aTypeAttributeId); AttributeStringPtr + aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); if + (aNewFeatureTypeAttr->value() != aTypeAttributeId) // do nothing if there is + no changes aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());*/ //// if the arc is tangent, set coincidence to end point of the previous arc - //std::string anArcType = aSourceFeatureTypeAttr->value(); - //if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) { - // // get the last point of the previuos arc feature(geom point 2d) - // std::shared_ptr aSData = theSourceFeature->data(); - // std::shared_ptr aSPointAttr = - // std::dynamic_pointer_cast( - // aSData->attribute(SketchPlugin_Arc::END_ID())); - // // get point attribute on the current feature - // AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr( - // SketchPlugin_Arc::TANGENT_POINT_ID()); - // aTangentPointAttr->setAttr(aSPointAttr); + // std::string anArcType = aSourceFeatureTypeAttr->value(); + // if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) { + // // get the last point of the previuos arc feature(geom point 2d) + // std::shared_ptr aSData = theSourceFeature->data(); + // std::shared_ptr aSPointAttr = + // std::dynamic_pointer_cast( + // aSData->attribute(SketchPlugin_Arc::END_ID())); + // // get point attribute on the current feature + // AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr( + // SketchPlugin_Arc::TANGENT_POINT_ID()); + // aTangentPointAttr->setAttr(aSPointAttr); // std::shared_ptr aNPointAttr = // std::dynamic_pointer_cast( @@ -764,88 +792,92 @@ bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& th // aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y()); //} - //ModuleBase_Tools::flushUpdated(theNewFeature); - //aChanged = true; - } - else if (aFeatureKind == SketchPlugin_Trim::ID() || - aFeatureKind == SketchPlugin_Split::ID()) { - std::string aPreviewObjectAttribute = aFeatureKind == SketchPlugin_Trim::ID() ? - SketchPlugin_Trim::PREVIEW_OBJECT(): SketchPlugin_Split::PREVIEW_OBJECT(); - std::string aPreviewPointAttribute = aFeatureKind == SketchPlugin_Trim::ID() ? - SketchPlugin_Trim::PREVIEW_POINT(): SketchPlugin_Split::PREVIEW_POINT(); + // ModuleBase_Tools::flushUpdated(theNewFeature); + // aChanged = true; + } else if (aFeatureKind == SketchPlugin_Trim::ID() || + aFeatureKind == SketchPlugin_Split::ID()) { + std::string aPreviewObjectAttribute = + aFeatureKind == SketchPlugin_Trim::ID() + ? SketchPlugin_Trim::PREVIEW_OBJECT() + : SketchPlugin_Split::PREVIEW_OBJECT(); + std::string aPreviewPointAttribute = + aFeatureKind == SketchPlugin_Trim::ID() + ? SketchPlugin_Trim::PREVIEW_POINT() + : SketchPlugin_Split::PREVIEW_POINT(); std::shared_ptr aRefPreviewAttr = - std::dynamic_pointer_cast( - theSourceFeature->data()->attribute(aPreviewObjectAttribute)); + std::dynamic_pointer_cast( + theSourceFeature->data()->attribute(aPreviewObjectAttribute)); std::shared_ptr aNRefPreviewAttr = - std::dynamic_pointer_cast( - theNewFeature->data()->attribute(aPreviewObjectAttribute)); + std::dynamic_pointer_cast( + theNewFeature->data()->attribute(aPreviewObjectAttribute)); aNRefPreviewAttr->setValue(aRefPreviewAttr->value()); std::shared_ptr aPointPreviewAttr = - std::dynamic_pointer_cast( - theSourceFeature->data()->attribute(aPreviewPointAttribute)); + std::dynamic_pointer_cast( + theSourceFeature->data()->attribute(aPreviewPointAttribute)); std::shared_ptr aNPointPreviewAttr = - std::dynamic_pointer_cast( - theNewFeature->data()->attribute(aPreviewPointAttribute)); - aNPointPreviewAttr->setValue(aPointPreviewAttr->x(), aPointPreviewAttr->y()); + std::dynamic_pointer_cast( + theNewFeature->data()->attribute(aPreviewPointAttribute)); + aNPointPreviewAttr->setValue(aPointPreviewAttr->x(), + aPointPreviewAttr->y()); } return aChanged; } -bool PartSet_SketcherReentrantMgr::isTangentArc(ModuleBase_Operation* theOperation, - const CompositeFeaturePtr& /*theSketch*/) const -{ +bool PartSet_SketcherReentrantMgr::isTangentArc( + ModuleBase_Operation *theOperation, + const CompositeFeaturePtr & /*theSketch*/) const { bool aTangentArc = false; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); - if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); + if (aFOperation && + module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { FeaturePtr aFeature = aFOperation->feature(); if (aFeature.get() && aFeature->getKind() == SketchPlugin_MacroArc::ID()) { - AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_MacroArc::ARC_TYPE()); + AttributeStringPtr aTypeAttr = + aFeature->data()->string(SketchPlugin_MacroArc::ARC_TYPE()); std::string anArcType = aTypeAttr.get() ? aTypeAttr->value() : ""; - aTangentArc = anArcType == SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(); + aTangentArc = + anArcType == SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(); } } return aTangentArc; } -void PartSet_SketcherReentrantMgr::updateAcceptAllAction() -{ +void PartSet_SketcherReentrantMgr::updateAcceptAllAction() { CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); if (aSketch.get()) workshop()->errorMgr()->updateAcceptAllAction(aSketch); } -XGUI_Workshop* PartSet_SketcherReentrantMgr::workshop() const -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); +XGUI_Workshop *PartSet_SketcherReentrantMgr::workshop() const { + XGUI_ModuleConnector *aConnector = + dynamic_cast(myWorkshop); return aConnector->workshop(); } -PartSet_Module* PartSet_SketcherReentrantMgr::module() const -{ - return dynamic_cast(myWorkshop->module()); +PartSet_Module *PartSet_SketcherReentrantMgr::module() const { + return dynamic_cast(myWorkshop->module()); } -void PartSet_SketcherReentrantMgr::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget) -{ - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); - if (aFOperation) - { - XGUI_PropertyPanel* aPropertyPanel = dynamic_cast - (aFOperation->propertyPanel()); +void PartSet_SketcherReentrantMgr::setInternalActiveWidget( + ModuleBase_ModelWidget *theWidget) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myWorkshop->currentOperation()); + if (aFOperation) { + XGUI_PropertyPanel *aPropertyPanel = + dynamic_cast(aFOperation->propertyPanel()); if (aPropertyPanel) aPropertyPanel->setInternalActiveWidget(theWidget); } } -void PartSet_SketcherReentrantMgr::onAutoConstraints(bool isOn) -{ +void PartSet_SketcherReentrantMgr::onAutoConstraints(bool isOn) { myIsAutoConstraints = isOn; } -void PartSet_SketcherReentrantMgr::addConstraints(const FeaturePtr& theFeature) -{ +void PartSet_SketcherReentrantMgr::addConstraints( + const FeaturePtr &theFeature) { if (theFeature->getKind() != SketchPlugin_Line::ID()) return; @@ -853,41 +885,42 @@ void PartSet_SketcherReentrantMgr::addConstraints(const FeaturePtr& theFeature) static GeomDir2dPtr myVertDir(new GeomAPI_Dir2d(0, 1)); std::shared_ptr aData = theFeature->data(); - std::shared_ptr aPoint1 = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aPoint2 = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aPoint1 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aPoint2 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::END_ID())); if (aPoint1.get() && aPoint2.get()) { GeomLine2dPtr aLine(new GeomAPI_Lin2d(aPoint1->pnt(), aPoint2->pnt())); GeomDir2dPtr aDir = aLine->direction(); double aHorAngle = fabs(myHorDir->angle(aDir)); double aVertAngle = fabs(myVertDir->angle(aDir)); - if (aHorAngle > M_PI/2.) + if (aHorAngle > M_PI / 2.) aHorAngle = M_PI - aHorAngle; - if (aVertAngle > M_PI/2.) + if (aVertAngle > M_PI / 2.) aVertAngle = M_PI - aVertAngle; - double aTolerance = Config_PropManager::real(SKETCH_TAB_NAME, "angular_tolerance"); + double aTolerance = + Config_PropManager::real(SKETCH_TAB_NAME, "angular_tolerance"); CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); FeaturePtr aFeature; if (aHorAngle < aTolerance) { // Add horizontal constraint aFeature = aSketch->addFeature(SketchPlugin_ConstraintHorizontal::ID()); - } - else if (aVertAngle < aTolerance) { + } else if (aVertAngle < aTolerance) { // Add vertical constraint aFeature = aSketch->addFeature(SketchPlugin_ConstraintVertical::ID()); } if (aFeature.get()) { - aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject( - theFeature->firstResult()); + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(theFeature->firstResult()); myLastAutoConstraint = aFeature.get(); } } } - -bool PartSet_SketcherReentrantMgr::isLastAutoConstraint(const ObjectPtr& theObj) const -{ +bool PartSet_SketcherReentrantMgr::isLastAutoConstraint( + const ObjectPtr &theObj) const { return theObj.get() == myLastAutoConstraint; } diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.h b/src/PartSet/PartSet_SketcherReentrantMgr.h index 220120e56..8d2a4dd65 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.h +++ b/src/PartSet/PartSet_SketcherReentrantMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_SketcherReentrantMgr_H @@ -24,8 +25,8 @@ #include -#include #include +#include #include @@ -46,30 +47,32 @@ class ModelAPI_Attribute; class GeomAPI_Pnt2d; /// \ingroup PartSet_SketcherReentrantMgr -/// It provides reentrant create operations in sketch, that is when all inputs are valid, -/// automatic validation of the creation and switch the created entity to edit mode -/// ('internal' edit operation), with the ability to simultaneously create the next entity -/// of same type (re-entrance of the operation). -/// OK valids the current edition and exits from the operation (no re-entrance). -/// Cancel removes (undo) the entity currently edited and -/// exits from the operation (no re-entrance). -class PARTSET_EXPORT PartSet_SketcherReentrantMgr : public QObject -{ -Q_OBJECT - -/// Enumeration to specify the restart operation properties. -enum RestartingMode { - RM_None, /// the operation should not be restarted - RM_Forbided, /// the operation should not be restarted after there is no active widget - RM_LastFeatureUsed, /// the operation is restarted and use - /// the previous feature for own initialization - RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature -}; +/// It provides reentrant create operations in sketch, that is when all inputs +/// are valid, automatic validation of the creation and switch the created +/// entity to edit mode +/// ('internal' edit operation), with the ability to simultaneously create the +/// next entity of same type (re-entrance of the operation). OK valids the +/// current edition and exits from the operation (no re-entrance). Cancel +/// removes (undo) the entity currently edited and exits from the operation (no +/// re-entrance). +class PARTSET_EXPORT PartSet_SketcherReentrantMgr : public QObject { + Q_OBJECT + + /// Enumeration to specify the restart operation properties. + enum RestartingMode { + RM_None, /// the operation should not be restarted + RM_Forbided, /// the operation should not be restarted after there is no + /// active widget + RM_LastFeatureUsed, /// the operation is restarted and use + /// the previous feature for own initialization + RM_EmptyFeatureUsed /// the operation is restarted and does not use the + /// previous feature + }; public: /// Constructor /// \param theWorkshop a workshop instance - PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop* theWorkshop); + PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop *theWorkshop); virtual ~PartSet_SketcherReentrantMgr(); public: @@ -79,41 +82,43 @@ public: /// Stop internal edit if the operation feature is invalid void updateInternalEditActiveState(); - /// if the internal flags allow it and the manager is active, it starts an internal edit operation - /// for the created operation. - /// \param thePreviousAttributeID an index of the previous active attribute - //bool restartOperation(const std::string& thePreviousAttributeID); - bool processEnter(const std::string& thePreviousAttributeID); + /// if the internal flags allow it and the manager is active, it starts an + /// internal edit operation for the created operation. \param + /// thePreviousAttributeID an index of the previous active attribute + // bool restartOperation(const std::string& thePreviousAttributeID); + bool processEnter(const std::string &thePreviousAttributeID); /// Resets the internal flags /// \param theOperation a started operation - void operationStarted(ModuleBase_Operation* theOperation); + void operationStarted(ModuleBase_Operation *theOperation); /// Resets the internal flags /// \param theOperation a started operation /// \return state whether the internal edit operation was active - bool operationCommitted(ModuleBase_Operation* theOperation); + bool operationCommitted(ModuleBase_Operation *theOperation); /// Resets the internal flags /// \param theOperation a started operation - void operationAborted(ModuleBase_Operation* theOperation); + void operationAborted(ModuleBase_Operation *theOperation); /// Return true if the manager processes the mouse move event - /// It happens if the current operation is an internal edit operation and the first - /// control can be filled by the mouse move event. The operation is restarted. - /// \return true if operation is committed. - bool processMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + /// It happens if the current operation is an internal edit operation and the + /// first control can be filled by the mouse move event. The operation is + /// restarted. \return true if operation is committed. + bool processMouseMoved(ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); /// Return true if the manager processes the mouse press event /// \return true if the current operation is an internal edit operation. - bool processMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + bool processMousePressed(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent); /// Return true if the manager processes the mouse enter event /// It happens if the current operation is an internal edit operation. - /// The operation is restarted. If the first widget of the started operation is - /// the point 2d, it processes this mouse event - /// \return true if operation is committed. - bool processMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + /// The operation is restarted. If the first widget of the started operation + /// is the point 2d, it processes this mouse event \return true if operation + /// is committed. + bool processMouseReleased(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent); /// It is called by the current operation filling with the preselection. /// Returns false if the reentrant mode of the operation is not empty. @@ -121,74 +126,81 @@ public: /// Fills reentrant message during restarting operation /// \param theMessage reentrant message - void setReentrantMessage(const std::shared_ptr& theMessage) - { myReentrantMessage = theMessage; } + void setReentrantMessage(const std::shared_ptr &theMessage) { + myReentrantMessage = theMessage; + } /// Returnss reentrant message - std::shared_ptr reentrantMessage() const { return myReentrantMessage; } + std::shared_ptr reentrantMessage() const { + return myReentrantMessage; + } /// Put current selection into reentrant message /// \param theMessage a message of reentrant operation - void setReentrantPreSelection(const std::shared_ptr& theMessage); + void + setReentrantPreSelection(const std::shared_ptr &theMessage); bool isAutoConstraints() const { return myIsAutoConstraints; } - - bool isLastAutoConstraint(const ObjectPtr& theObj) const; + bool isLastAutoConstraint(const ObjectPtr &theObj) const; public slots: /// The slot is called when user checks "Automatic constraints" button /// \param isOn a state of the check box void onAutoConstraints(bool isOn); - private slots: /// SLOT, that is called by a widget activating in the property panel - /// If the 'internal' edit operation is started, it activates the first widget selection - //void onWidgetActivated(); + /// If the 'internal' edit operation is started, it activates the first widget + /// selection + // void onWidgetActivated(); /// SLOT, that is called by no more widget signal emitted by property panel - /// Start an internal edit operation or, if the internal flag is forbided, commits - /// the current operation - /// \param thePreviousAttributeID an index of the previous active attribute - void onNoMoreWidgets(const std::string& thePreviousAttributeID); - - /// Processing of vertex selected. Set an internal reentrant flag to forbiddent state if - /// the current feature is a line and there are not obligate widgets anymore + /// Start an internal edit operation or, if the internal flag is forbided, + /// commits the current operation \param thePreviousAttributeID an index of + /// the previous active attribute + void onNoMoreWidgets(const std::string &thePreviousAttributeID); + + /// Processing of vertex selected. Set an internal reentrant flag to + /// forbiddent state if the current feature is a line and there are not + /// obligate widgets anymore void onVertexSelected(); /// Listens to the signal about the modification of the values - /// have been done in the property panel. If the manager has active edit operation and - /// the active widget does not process the modification of value, the manager will - /// restart current operation and fill a new feature attribute by the value of current - /// widget + /// have been done in the property panel. If the manager has active edit + /// operation and the active widget does not process the modification of + /// value, the manager will restart current operation and fill a new feature + /// attribute by the value of current widget void onAfterValuesChangedInPropertyPanel(); - /// Deactivates selection and filters of the first operation widget if it is an internal - /// 'edit' operation + /// Deactivates selection and filters of the first operation widget if it is + /// an internal 'edit' operation void onBeforeStopped(); private: - /// Returns true if the current operation is a sketch or a nested sketch operation + /// Returns true if the current operation is a sketch or a nested sketch + /// operation bool isActiveMgr() const; - /// Sets the focus to the last control of the property panel and activates selection - /// of the first widget to can select first value of the next create operation - /// \param thePreviousAttributeID an index of the previous attribute to set focus to this widget - /// \return true if it is started - bool startInternalEdit(const std::string& thePreviousAttributeID); + /// Sets the focus to the last control of the property panel and activates + /// selection of the first widget to can select first value of the next create + /// operation \param thePreviousAttributeID an index of the previous attribute + /// to set focus to this widget \return true if it is started + bool startInternalEdit(const std::string &thePreviousAttributeID); - /// Disconnects this manager from operation signals, deactivate selection of the first control - /// in the viewer. + /// Disconnects this manager from operation signals, deactivate selection of + /// the first control in the viewer. void beforeStopInternalEdit(); - /// Commits the current operation and launches a new with the commited operation feature index + /// Commits the current operation and launches a new with the commited + /// operation feature index void restartOperation(); /// Creates an internal feature and controls to process it void createInternalFeature(); - /// A pair method for an internal creation to remove it and clear all created controls + /// A pair method for an internal creation to remove it and clear all created + /// controls void deleteInternalFeature(); /// Breaks sequense of automatically resterted operations @@ -199,50 +211,55 @@ private: /// \param theSourceFeature a source feature /// \param theNewFeature a new feature /// \param theSketch an active sketch - /// \param isTemporary is used to do not create additional features(e.g. coincidence for line) - /// \return true is something is copied - static bool copyReetntrantAttributes(const FeaturePtr& theSourceFeature, - const FeaturePtr& theNewFeature, - const std::shared_ptr& theSketch, - const bool isTemporary = false); - - /// Checks whethe the feature of the given operation has kind an arc and the arc type is tangent - bool isTangentArc(ModuleBase_Operation* theOperation, - const std::shared_ptr& /*theSketch*/) const; + /// \param isTemporary is used to do not create additional features(e.g. + /// coincidence for line) \return true is something is copied + static bool copyReetntrantAttributes( + const FeaturePtr &theSourceFeature, const FeaturePtr &theNewFeature, + const std::shared_ptr &theSketch, + const bool isTemporary = false); + + /// Checks whethe the feature of the given operation has kind an arc and the + /// arc type is tangent + bool isTangentArc( + ModuleBase_Operation *theOperation, + const std::shared_ptr & /*theSketch*/) const; /// Accept All action is enabled if an internal edit is started. /// It updates the state of the button void updateAcceptAllAction(); /// Returns the workshop - XGUI_Workshop* workshop() const; + XGUI_Workshop *workshop() const; /// Returns the workshop module - PartSet_Module* module() const; + PartSet_Module *module() const; - void setInternalActiveWidget(ModuleBase_ModelWidget* theWidget); + void setInternalActiveWidget(ModuleBase_ModelWidget *theWidget); - void addConstraints(const FeaturePtr& theFeature); + void addConstraints(const FeaturePtr &theFeature); private: - ModuleBase_IWorkshop* myWorkshop; /// the workshop + ModuleBase_IWorkshop *myWorkshop; /// the workshop - RestartingMode myRestartingMode; /// automatical restarting mode flag + RestartingMode myRestartingMode; /// automatical restarting mode flag bool myIsFlagsBlocked; /// true when reset of flags should not be perfromed bool myIsInternalEditOperation; /// true when the 'internal' edit is started - FeaturePtr myPreviousFeature; /// feature of the previous operation, which is restarted + FeaturePtr myPreviousFeature; /// feature of the previous operation, which is + /// restarted FeaturePtr myInternalFeature; - QWidget* myInternalWidget; + QWidget *myInternalWidget; std::string myNoMoreWidgetsAttribute; - std::shared_ptr myReentrantMessage; /// message obtained by operation restart + std::shared_ptr + myReentrantMessage; /// message obtained by operation restart ObjectPtr mySelectedObject; /// cashed selected object - std::shared_ptr mySelectedAttribute; /// cashed selected attribute + std::shared_ptr + mySelectedAttribute; /// cashed selected attribute std::shared_ptr myClickedSketchPoint; /// cashed clicked point bool myIsAutoConstraints; - void* myLastAutoConstraint; //< Stores address of last automatic constraint. + void *myLastAutoConstraint; //< Stores address of last automatic constraint. //< Cannot be used as a pointer!!! }; diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 315abbd77..79096d67c 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -14,85 +14,86 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include -#include #include #include +#include #include -#include -#include #include -#include +#include +#include #include +#include #include #include -#include #include +#include #include -#include #include -#include -#include +#include #include +#include +#include -#include -#include -#include -#include +#include #include -#include #include -#include -#include +#include #include +#include +#include +#include +#include +#include #include #include -#include -#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include +#include +#include #include #include #include -#include +#include #include -#include #include +#include -#include -#include -#include -#include +#include +#include #include -#include #include -#include +#include +#include +#include +#include #include #include #include -#include -#include -#include +#include +#include +#include #include @@ -102,15 +103,13 @@ const double PRECISION_TOLERANCE = 0.000001; const int AIS_DEFAULT_WIDTH = 2; -const bool SKETCH_PROJECTION_INCLUDE_INTO_RESULT = false; // by default, it is not presented +const bool SKETCH_PROJECTION_INCLUDE_INTO_RESULT = + false; // by default, it is not presented -int PartSet_Tools::getAISDefaultWidth() -{ - return AIS_DEFAULT_WIDTH; -} +int PartSet_Tools::getAISDefaultWidth() { return AIS_DEFAULT_WIDTH; } -gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, Handle(V3d_View) theView) -{ +gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, + Handle(V3d_View) theView) { if (theView.IsNull()) return gp_Pnt(); @@ -128,28 +127,31 @@ gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, Handle(V3d_View) theV theView->Convert(thePoint.x(), thePoint.y(), X, Y, Z); gp_Pnt ConvertedPoint(X, Y, Z); - gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint); + gp_Pnt2d ConvertedPointOnPlane = + ProjLib::Project(PlaneOfTheView, ConvertedPoint); return ElSLib::Value(ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), - PlaneOfTheView); + PlaneOfTheView); } -void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch, -Handle(V3d_View) theView, - double& theX, double& theY) -{ +void PartSet_Tools::convertTo2D(const gp_Pnt &thePoint, FeaturePtr theSketch, + Handle(V3d_View) theView, double &theX, + double &theY) { if (!theSketch) return; AttributeDoublePtr anAttr; std::shared_ptr aData = theSketch->data(); - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); std::shared_ptr anY = aNorm->xyz()->cross(aX->xyz()); gp_Pnt anOriginPnt(anOrigin->x(), anOrigin->y(), anOrigin->z()); @@ -167,8 +169,9 @@ Handle(V3d_View) theView, gp_Vec anEyeVec(EyePoint, AtPoint); anEyeVec.Normalize(); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); gp_Vec aNormalVec(aNormal->x(), aNormal->y(), aNormal->z()); double aDen = anEyeVec * aNormalVec; @@ -182,68 +185,75 @@ Handle(V3d_View) theView, theY = aVec.X() * anY->x() + aVec.Y() * anY->y() + aVec.Z() * anY->z(); } -std::shared_ptr PartSet_Tools::convertTo2D(FeaturePtr theSketch, - const std::shared_ptr& thePnt) -{ +std::shared_ptr +PartSet_Tools::convertTo2D(FeaturePtr theSketch, + const std::shared_ptr &thePnt) { std::shared_ptr aRes; if (theSketch->getKind() != SketchPlugin_Sketch::ID()) return aRes; - std::shared_ptr aC = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + std::shared_ptr aC = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); return thePnt->to2D(aC->pnt(), aX->dir(), aY); } - -std::shared_ptr PartSet_Tools::convertTo3D(const double theX, const double theY, - FeaturePtr theSketch) -{ +std::shared_ptr PartSet_Tools::convertTo3D(const double theX, + const double theY, + FeaturePtr theSketch) { std::shared_ptr aData = theSketch->data(); - std::shared_ptr aC = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + std::shared_ptr aC = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); std::shared_ptr aPnt2d = - std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); + std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); return aPnt2d->to3D(aC->pnt(), aX->dir(), aY); } -std::shared_ptr PartSet_Tools::document() -{ +std::shared_ptr PartSet_Tools::document() { return ModelAPI_Session::get()->moduleDocument(); } void PartSet_Tools::setFeatureValue(FeaturePtr theFeature, double theValue, - const std::string& theAttribute) -{ + const std::string &theAttribute) { if (!theFeature) return; std::shared_ptr aData = theFeature->data(); - AttributeDoublePtr anAttribute = std::dynamic_pointer_cast( - aData->attribute(theAttribute)); + AttributeDoublePtr anAttribute = + std::dynamic_pointer_cast( + aData->attribute(theAttribute)); if (anAttribute) anAttribute->setValue(theValue); } -double PartSet_Tools::featureValue(FeaturePtr theFeature, const std::string& theAttribute, - bool& isValid) -{ +double PartSet_Tools::featureValue(FeaturePtr theFeature, + const std::string &theAttribute, + bool &isValid) { isValid = false; double aValue = 0; if (theFeature) { std::shared_ptr aData = theFeature->data(); - AttributeDoublePtr anAttribute = std::dynamic_pointer_cast( - aData->attribute(theAttribute)); + AttributeDoublePtr anAttribute = + std::dynamic_pointer_cast( + aData->attribute(theAttribute)); if (anAttribute) { aValue = anAttribute->value(); isValid = true; @@ -252,16 +262,17 @@ double PartSet_Tools::featureValue(FeaturePtr theFeature, const std::string& the return aValue; } -FeaturePtr PartSet_Tools::feature(FeaturePtr theFeature, const std::string& theAttribute, - const std::string& theKind) -{ +FeaturePtr PartSet_Tools::feature(FeaturePtr theFeature, + const std::string &theAttribute, + const std::string &theKind) { FeaturePtr aFeature; if (!theFeature) return aFeature; std::shared_ptr aData = theFeature->data(); - std::shared_ptr anAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(theAttribute)); + std::shared_ptr anAttr = + std::dynamic_pointer_cast( + aData->attribute(theAttribute)); if (anAttr) { aFeature = std::dynamic_pointer_cast(anAttr->object()); if (!theKind.empty() && aFeature && aFeature->getKind() != theKind) { @@ -271,10 +282,10 @@ FeaturePtr PartSet_Tools::feature(FeaturePtr theFeature, const std::string& theA return aFeature; } -void PartSet_Tools::createConstraint(CompositeFeaturePtr theSketch, - std::shared_ptr thePoint1, - std::shared_ptr thePoint2) -{ +void PartSet_Tools::createConstraint( + CompositeFeaturePtr theSketch, + std::shared_ptr thePoint1, + std::shared_ptr thePoint2) { FeaturePtr aFeature; if (theSketch) { aFeature = theSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); @@ -285,68 +296,79 @@ void PartSet_Tools::createConstraint(CompositeFeaturePtr theSketch, std::shared_ptr aData = aFeature->data(); - std::shared_ptr aRef1 = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::shared_ptr aRef1 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); aRef1->setAttr(thePoint1); - std::shared_ptr aRef2 = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + std::shared_ptr aRef2 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_B())); aRef2->setAttr(thePoint2); - // we need to flush created signal in order to coincidence is processed by solver + // we need to flush created signal in order to coincidence is processed by + // solver Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); } -std::shared_ptr PartSet_Tools::sketchPlane(CompositeFeaturePtr theSketch) -{ +std::shared_ptr +PartSet_Tools::sketchPlane(CompositeFeaturePtr theSketch) { std::shared_ptr aPlane; - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - if (aNormal.get() && aNormal->isInitialized() && - anOrigin.get() && anOrigin->isInitialized()) - aPlane = std::shared_ptr(new GeomAPI_Pln(anOrigin->pnt(), aNormal->dir())); + if (aNormal.get() && aNormal->isInitialized() && anOrigin.get() && + anOrigin->isInitialized()) + aPlane = std::shared_ptr( + new GeomAPI_Pln(anOrigin->pnt(), aNormal->dir())); return aPlane; } -void PartSet_Tools::nullifySketchPlane(CompositeFeaturePtr theSketch) -{ - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); +void PartSet_Tools::nullifySketchPlane(CompositeFeaturePtr theSketch) { + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); aNormal->reset(); anOrigin->reset(); } -std::shared_ptr PartSet_Tools::point3D(std::shared_ptr thePoint2D, - CompositeFeaturePtr theSketch) -{ +std::shared_ptr +PartSet_Tools::point3D(std::shared_ptr thePoint2D, + CompositeFeaturePtr theSketch) { std::shared_ptr aPoint; if (!theSketch || !thePoint2D) return aPoint; DataPtr aData = theSketch->data(); - std::shared_ptr aC = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + std::shared_ptr aC = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); return thePoint2D->to3D(aC->pnt(), aX->dir(), aY); } -ResultPtr PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape& theShape, - const ObjectPtr& theObject, - CompositeFeaturePtr theSketch) -{ +ResultPtr +PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape &theShape, + const ObjectPtr &theObject, + CompositeFeaturePtr theSketch) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (!aResult.get()) return ResultPtr(); @@ -362,35 +384,37 @@ ResultPtr PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape& theShape, } ResultPtr PartSet_Tools::createFixedObjectByExternal( - const std::shared_ptr& theShape, - const ObjectPtr& theObject, - CompositeFeaturePtr theSketch, - const bool theTemporary, - FeaturePtr& theCreatedFeature) -{ + const std::shared_ptr &theShape, const ObjectPtr &theObject, + CompositeFeaturePtr theSketch, const bool theTemporary, + FeaturePtr &theCreatedFeature) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (!aResult.get()) return ResultPtr(); - FeaturePtr aProjectionFeature = theSketch->addFeature(SketchPlugin_Projection::ID()); + FeaturePtr aProjectionFeature = + theSketch->addFeature(SketchPlugin_Projection::ID()); theCreatedFeature = aProjectionFeature; - AttributeSelectionPtr anExternalAttr = std::dynamic_pointer_cast( - aProjectionFeature->attribute(SketchPlugin_Projection::EXTERNAL_FEATURE_ID())); + AttributeSelectionPtr anExternalAttr = + std::dynamic_pointer_cast( + aProjectionFeature->attribute( + SketchPlugin_Projection::EXTERNAL_FEATURE_ID())); anExternalAttr->setValue(aResult, theShape); - AttributeBooleanPtr anIntoResult = std::dynamic_pointer_cast - (aProjectionFeature->data()->attribute(SketchPlugin_Projection::INCLUDE_INTO_RESULT())); + AttributeBooleanPtr anIntoResult = + std::dynamic_pointer_cast( + aProjectionFeature->data()->attribute( + SketchPlugin_Projection::INCLUDE_INTO_RESULT())); anIntoResult->setValue(SKETCH_PROJECTION_INCLUDE_INTO_RESULT); aProjectionFeature->execute(); - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); bool isValid = aValidators->validate(aProjectionFeature); // if projection feature has not been created, exit AttributeRefAttrPtr aRefAttr = aProjectionFeature->data()->refattr( - SketchPlugin_Projection::PROJECTED_FEATURE_ID()); - if (!isValid || !aRefAttr || !aRefAttr->isInitialized()) - { + SketchPlugin_Projection::PROJECTED_FEATURE_ID()); + if (!isValid || !aRefAttr || !aRefAttr->isInitialized()) { // remove external feature if the attribute is not filled std::set aFeatures; aFeatures.insert(aProjectionFeature); @@ -405,9 +429,9 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal( return ResultPtr(); } -bool PartSet_Tools::isContainPresentation(const QList& theSelected, - const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_Tools::isContainPresentation( + const QList &theSelected, + const ModuleBase_ViewerPrsPtr &thePrs) { foreach (ModuleBase_ViewerPrsPtr aPrs, theSelected) { if (aPrs->object() == thePrs->object()) return true; @@ -415,40 +439,50 @@ bool PartSet_Tools::isContainPresentation(const QList& return false; } -GeomShapePtr PartSet_Tools::findShapeBy2DPoint(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop) -{ +GeomShapePtr +PartSet_Tools::findShapeBy2DPoint(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop) { GeomShapePtr aShape; - XGUI_ModuleConnector* aConnector = dynamic_cast(theWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); - - // 2. find visualized vertices of the attribute and if the attribute of the vertex is - // the same, return it - FeaturePtr anAttributeFeature = ModelAPI_Feature::feature(theAttribute->owner()); + XGUI_ModuleConnector *aConnector = + dynamic_cast(theWorkshop); + XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); + + // 2. find visualized vertices of the attribute and if the attribute of the + // vertex is the same, return it + FeaturePtr anAttributeFeature = + ModelAPI_Feature::feature(theAttribute->owner()); // 2.1 get visualized results of the feature - const std::list& aResList = anAttributeFeature->results(); - std::list::const_iterator anIt = aResList.begin(), aLast = aResList.end(); + const std::list &aResList = anAttributeFeature->results(); + std::list::const_iterator anIt = aResList.begin(), + aLast = aResList.end(); for (; anIt != aLast; anIt++) { AISObjectPtr aAISObj = aDisplayer->getAISObject(*anIt); if (aAISObj.get() != NULL) { - Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl(); + Handle(AIS_InteractiveObject) anAISIO = + aAISObj->impl(); // 2.2 find selected owners of a visualizedd object SelectMgr_IndexedMapOfOwner aSelectedOwners; - aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners); + aConnector->workshop()->selector()->selection()->entityOwners( + anAISIO, aSelectedOwners); for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++) { Handle(SelectMgr_EntityOwner) anOwner = aSelectedOwners(i); if (!anOwner.IsNull()) { - Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(anOwner); + Handle(StdSelect_BRepOwner) aBRepOwner = + Handle(StdSelect_BRepOwner)::DownCast(anOwner); if (!aBRepOwner.IsNull() && aBRepOwner->HasShape()) { - const TopoDS_Shape& aBRepShape = aBRepOwner->Shape(); + const TopoDS_Shape &aBRepShape = aBRepOwner->Shape(); if (aBRepShape.ShapeType() == TopAbs_VERTEX) { - // 2.3 if the owner is vertex and an attribute of the vertex is equal to the initial - // attribute, returns the shape - PartSet_Module* aModule = dynamic_cast(theWorkshop->module()); - PartSet_SketcherMgr* aSketchMgr = aModule->sketchMgr(); - std::pair aPntAttrIndex = PartSet_Tools::findAttributeBy2dPoint( - anAttributeFeature, aBRepShape, aSketchMgr->activeSketch()); - if (aPntAttrIndex.first.get() != NULL && aPntAttrIndex.first == theAttribute) { + // 2.3 if the owner is vertex and an attribute of the vertex is + // equal to the initial attribute, returns the shape + PartSet_Module *aModule = + dynamic_cast(theWorkshop->module()); + PartSet_SketcherMgr *aSketchMgr = aModule->sketchMgr(); + std::pair aPntAttrIndex = + PartSet_Tools::findAttributeBy2dPoint( + anAttributeFeature, aBRepShape, + aSketchMgr->activeSketch()); + if (aPntAttrIndex.first.get() != NULL && + aPntAttrIndex.first == theAttribute) { aShape = std::shared_ptr(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(aBRepShape)); break; @@ -462,23 +496,24 @@ GeomShapePtr PartSet_Tools::findShapeBy2DPoint(const AttributePtr& theAttribute, return aShape; } -std::shared_ptr PartSet_Tools::getPoint( - std::shared_ptr& theFeature, - const std::string& theAttribute) -{ - std::shared_ptr aPointAttr = ModelGeomAlgo_Point2D::getPointOfRefAttr( - theFeature.get(), theAttribute, SketchPlugin_Point::ID(), - SketchPlugin_Point::COORD_ID()); +std::shared_ptr +PartSet_Tools::getPoint(std::shared_ptr &theFeature, + const std::string &theAttribute) { + std::shared_ptr aPointAttr = + ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(), theAttribute, + SketchPlugin_Point::ID(), + SketchPlugin_Point::COORD_ID()); if (aPointAttr.get() != NULL) return aPointAttr->pnt(); return std::shared_ptr(); } -std::shared_ptr PartSet_Tools::getPnt2d(QMouseEvent* theEvent, - ModuleBase_IViewWindow* theWindow, - const FeaturePtr& theSketch) -{ - gp_Pnt aPnt = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); +std::shared_ptr +PartSet_Tools::getPnt2d(QMouseEvent *theEvent, + ModuleBase_IViewWindow *theWindow, + const FeaturePtr &theSketch) { + gp_Pnt aPnt = + PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); double aX, anY; Handle(V3d_View) aView = theWindow->v3dView(); PartSet_Tools::convertTo2D(aPnt, theSketch, aView, aX, anY); @@ -486,13 +521,13 @@ std::shared_ptr PartSet_Tools::getPnt2d(QMouseEvent* theEvent, return std::shared_ptr(new GeomAPI_Pnt2d(aX, anY)); } -std::shared_ptr PartSet_Tools::getPnt2d(const Handle(V3d_View)& theView, - const TopoDS_Shape& theShape, - const FeaturePtr& theSketch) -{ +std::shared_ptr +PartSet_Tools::getPnt2d(const Handle(V3d_View) & theView, + const TopoDS_Shape &theShape, + const FeaturePtr &theSketch) { GeomPnt2dPtr aPoint2D; if (!theShape.IsNull() && theShape.ShapeType() == TopAbs_VERTEX) { - const TopoDS_Vertex& aVertex = TopoDS::Vertex(theShape); + const TopoDS_Vertex &aVertex = TopoDS::Vertex(theShape); if (!aVertex.IsNull()) { // the case when the point is taken from the existing vertex gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); @@ -504,25 +539,25 @@ std::shared_ptr PartSet_Tools::getPnt2d(const Handle(V3d_View)& t return aPoint2D; } -FeaturePtr findFirstCoincidenceByData(const DataPtr& theData, - std::shared_ptr thePoint) -{ +FeaturePtr findFirstCoincidenceByData(const DataPtr &theData, + std::shared_ptr thePoint) { FeaturePtr aCoincident; - const std::set& aRefsList = theData->refsToMe(); + const std::set &aRefsList = theData->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { - std::shared_ptr a2dPnt = - PartSet_Tools::getPoint(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A()); + std::shared_ptr a2dPnt = PartSet_Tools::getPoint( + aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A()); if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) { aCoincident = aConstrFeature; break; } else { - a2dPnt = PartSet_Tools::getPoint(aConstrFeature, - SketchPlugin_ConstraintCoincidence::ENTITY_B()); + a2dPnt = PartSet_Tools::getPoint( + aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_B()); if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) { aCoincident = aConstrFeature; break; @@ -533,27 +568,29 @@ FeaturePtr findFirstCoincidenceByData(const DataPtr& theData, return aCoincident; } -FeaturePtr PartSet_Tools::findFirstCoincidence(const FeaturePtr& theFeature, - std::shared_ptr thePoint) -{ +FeaturePtr +PartSet_Tools::findFirstCoincidence(const FeaturePtr &theFeature, + std::shared_ptr thePoint) { FeaturePtr aCoincident; if (theFeature.get() == NULL) return aCoincident; - const std::set& aRefsList = theFeature->data()->refsToMe(); + const std::set &aRefsList = theFeature->data()->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); - if (aConstrFeature && aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { - std::shared_ptr a2dPnt = - PartSet_Tools::getPoint(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A()); + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); + if (aConstrFeature && + aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { + std::shared_ptr a2dPnt = PartSet_Tools::getPoint( + aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A()); if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) { aCoincident = aConstrFeature; break; } else { - a2dPnt = PartSet_Tools::getPoint(aConstrFeature, - SketchPlugin_ConstraintCoincidence::ENTITY_B()); + a2dPnt = PartSet_Tools::getPoint( + aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_B()); if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) { aCoincident = aConstrFeature; break; @@ -575,10 +612,11 @@ FeaturePtr PartSet_Tools::findFirstCoincidence(const FeaturePtr& theFeature, return aCoincident; } -void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, QList& theList, - QList& theCoincidencies, - std::string theAttr, QList& theIsAttributes) -{ +void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, + QList &theList, + QList &theCoincidencies, + std::string theAttr, + QList &theIsAttributes) { std::shared_ptr aOrig = getCoincedencePoint(theStartCoin); if (aOrig.get() == NULL) return; @@ -593,19 +631,24 @@ void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, QList& theList.append(aFeature); theCoincidencies.append(theStartCoin); theIsAttributes.append(true); // point attribute on a feature - const std::set& aRefsList = aFeature->data()->refsToMe(); + const std::set &aRefsList = aFeature->data()->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); - if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); + if (aConstrFeature->getKind() == + SketchPlugin_ConstraintCoincidence::ID()) { if (!theCoincidencies.contains(aConstrFeature)) { - std::shared_ptr aCoincPnt = getCoincedencePoint(aConstrFeature); + std::shared_ptr aCoincPnt = + getCoincedencePoint(aConstrFeature); if (aCoincPnt.get() && aOrig->isEqual(aCoincPnt)) { findCoincidences(aConstrFeature, theList, theCoincidencies, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), theIsAttributes); + SketchPlugin_ConstraintCoincidence::ENTITY_A(), + theIsAttributes); findCoincidences(aConstrFeature, theList, theCoincidencies, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), theIsAttributes); + SketchPlugin_ConstraintCoincidence::ENTITY_B(), + theIsAttributes); } } } @@ -613,7 +656,8 @@ void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, QList& } } else { // Find by Results - ResultConstructionPtr aResult = std::dynamic_pointer_cast(aObj); + ResultConstructionPtr aResult = + std::dynamic_pointer_cast(aObj); if (aResult.get()) { FeaturePtr aFeat = ModelAPI_Feature::feature(aPnt->object()); if (!theList.contains(aFeat)) @@ -621,19 +665,24 @@ void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, QList& theCoincidencies.append(theStartCoin); theIsAttributes.append(false); // point attribute on a feature - const std::set& aRefsList = aResult->data()->refsToMe(); + const std::set &aRefsList = aResult->data()->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); - if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); + if (aConstrFeature->getKind() == + SketchPlugin_ConstraintCoincidence::ID()) { if (!theCoincidencies.contains(aConstrFeature)) { - std::shared_ptr aCoincPnt = getCoincedencePoint(aConstrFeature); + std::shared_ptr aCoincPnt = + getCoincedencePoint(aConstrFeature); if (aCoincPnt.get() && aOrig->isEqual(aCoincPnt)) { findCoincidences(aConstrFeature, theList, theCoincidencies, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), theIsAttributes); + SketchPlugin_ConstraintCoincidence::ENTITY_A(), + theIsAttributes); findCoincidences(aConstrFeature, theList, theCoincidencies, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), theIsAttributes); + SketchPlugin_ConstraintCoincidence::ENTITY_B(), + theIsAttributes); } } } @@ -642,27 +691,29 @@ void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, QList& } } -std::shared_ptr PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin) -{ - std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), - SketchPlugin_Constraint::ENTITY_A()); +std::shared_ptr +PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin) { + std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( + theStartCoin.get(), SketchPlugin_Constraint::ENTITY_A()); if (aPnt.get() == NULL) - aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B()); + aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), + SketchPlugin_Constraint::ENTITY_B()); return aPnt; } -class PointWrapper -{ +class PointWrapper { public: PointWrapper(AttributePtr theAttribute) - : myPoint(std::dynamic_pointer_cast(theAttribute)), - myArray(std::dynamic_pointer_cast(theAttribute)) - {} + : myPoint(std::dynamic_pointer_cast(theAttribute)), + myArray( + std::dynamic_pointer_cast(theAttribute)) { + } - int size() const { return myPoint.get() ? 1 : (myArray.get() ? myArray->size() : 0); } + int size() const { + return myPoint.get() ? 1 : (myArray.get() ? myArray->size() : 0); + } - GeomPointPtr point(int theIndex, FeaturePtr theSketch) - { + GeomPointPtr point(int theIndex, FeaturePtr theSketch) { GeomPnt2dPtr aP2d; if (myPoint.get()) aP2d = myPoint->pnt(); @@ -682,36 +733,38 @@ private: AttributePoint2DArrayPtr myArray; }; -std::pair PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj, - const TopoDS_Shape theShape, - FeaturePtr theSketch) -{ +std::pair PartSet_Tools::findAttributeBy2dPoint( + ObjectPtr theObj, const TopoDS_Shape theShape, FeaturePtr theSketch) { AttributePtr anAttribute; int aPointIndex = -1; FeaturePtr aFeature = ModelAPI_Feature::feature(theObj); if (aFeature) { if (theShape.ShapeType() == TopAbs_VERTEX) { - const TopoDS_Vertex& aVertex = TopoDS::Vertex(theShape); - if (!aVertex.IsNull()) { + const TopoDS_Vertex &aVertex = TopoDS::Vertex(theShape); + if (!aVertex.IsNull()) { gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); std::shared_ptr aValue = std::shared_ptr( new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); // find the given point in the feature attributes std::list anAttiributes = - aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list anArrays = - aFeature->data()->attributes(GeomDataAPI_Point2DArray::typeId()); - anAttiributes.insert(anAttiributes.end(), anArrays.begin(), anArrays.end()); + aFeature->data()->attributes(GeomDataAPI_Point2DArray::typeId()); + anAttiributes.insert(anAttiributes.end(), anArrays.begin(), + anArrays.end()); std::list::const_iterator anIt = anAttiributes.begin(), aLast = anAttiributes.end(); - double aMinDistance = 1.e-6; // searching for point with minimal distance and < 1.e-6 + double aMinDistance = + 1.e-6; // searching for point with minimal distance and < 1.e-6 for (; anIt != aLast && !anAttribute; anIt++) { PointWrapper aWrapper(*anIt); - for (int anIndex = 0, aSize = aWrapper.size(); anIndex < aSize; ++anIndex) { - std::shared_ptr aPnt = aWrapper.point(anIndex, theSketch); + for (int anIndex = 0, aSize = aWrapper.size(); anIndex < aSize; + ++anIndex) { + std::shared_ptr aPnt = + aWrapper.point(anIndex, theSketch); if (aPnt) { double aDistance = aPnt->distance(aValue); if (aDistance < aMinDistance) { @@ -729,38 +782,36 @@ std::pair PartSet_Tools::findAttributeBy2dPoint(ObjectPtr the return std::pair(anAttribute, aPointIndex); } -void PartSet_Tools::sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite, - const Events_ID theEventId) -{ +void PartSet_Tools::sendSubFeaturesEvent( + const CompositeFeaturePtr &theComposite, const Events_ID theEventId) { if (!theComposite.get()) return; int aNumberOfSubs = theComposite->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { FeaturePtr aSubFeature = theComposite->subFeature(i); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static const ModelAPI_EventCreator *aECreator = + ModelAPI_EventCreator::get(); aECreator->sendUpdated(aSubFeature, theEventId); } Events_Loop::loop()->flush(theEventId); } -bool PartSet_Tools::isAuxiliarySketchEntity(const ObjectPtr& theObject) -{ +bool PartSet_Tools::isAuxiliarySketchEntity(const ObjectPtr &theObject) { bool isAuxiliaryFeature = false; FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject); std::string anAuxiliaryAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); - AttributeBooleanPtr anAuxiliaryAttr = std::dynamic_pointer_cast( - anObjectFeature->data()->attribute(anAuxiliaryAttribute)); + AttributeBooleanPtr anAuxiliaryAttr = + std::dynamic_pointer_cast( + anObjectFeature->data()->attribute(anAuxiliaryAttribute)); if (anAuxiliaryAttr.get()) isAuxiliaryFeature = anAuxiliaryAttr->value(); - return isAuxiliaryFeature; } -bool PartSet_Tools::isIncludeIntoSketchResult(const ObjectPtr& theObject) -{ +bool PartSet_Tools::isIncludeIntoSketchResult(const ObjectPtr &theObject) { // check the feature is neither Projection nor IntersectionPoint feature FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature->getKind() == SketchPlugin_Projection::ID() || @@ -769,15 +820,18 @@ bool PartSet_Tools::isIncludeIntoSketchResult(const ObjectPtr& theObject) // go through the references to the feature to check // if it was created by Projection or Intersection - const std::set& aRefs = theObject->data()->refsToMe(); + const std::set &aRefs = theObject->data()->refsToMe(); for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end(); ++aRefIt) { AttributePtr anAttr = *aRefIt; std::string anIncludeToResultAttrName; if (anAttr->id() == SketchPlugin_Projection::PROJECTED_FEATURE_ID()) - anIncludeToResultAttrName = SketchPlugin_Projection::INCLUDE_INTO_RESULT(); - else if (anAttr->id() == SketchPlugin_IntersectionPoint::INTERSECTION_POINTS_ID()) - anIncludeToResultAttrName = SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(); + anIncludeToResultAttrName = + SketchPlugin_Projection::INCLUDE_INTO_RESULT(); + else if (anAttr->id() == + SketchPlugin_IntersectionPoint::INTERSECTION_POINTS_ID()) + anIncludeToResultAttrName = + SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(); if (!anIncludeToResultAttrName.empty()) { // check "include into result" flag @@ -788,33 +842,34 @@ bool PartSet_Tools::isIncludeIntoSketchResult(const ObjectPtr& theObject) return true; } - ResultPtr PartSet_Tools::createFixedByExternalCenter( - const ObjectPtr& theObject, - const std::shared_ptr& theEdge, + const ObjectPtr &theObject, const std::shared_ptr &theEdge, ModelAPI_AttributeSelection::CenterType theType, - const CompositeFeaturePtr& theSketch, - bool theTemporary, - FeaturePtr& theCreatedFeature) -{ + const CompositeFeaturePtr &theSketch, bool theTemporary, + FeaturePtr &theCreatedFeature) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (!aResult.get()) return ResultPtr(); - FeaturePtr aProjectionFeature = theSketch->addFeature(SketchPlugin_Projection::ID()); + FeaturePtr aProjectionFeature = + theSketch->addFeature(SketchPlugin_Projection::ID()); theCreatedFeature = aProjectionFeature; - AttributeSelectionPtr anExternalAttr = std::dynamic_pointer_cast( - aProjectionFeature->attribute(SketchPlugin_Projection::EXTERNAL_FEATURE_ID())); + AttributeSelectionPtr anExternalAttr = + std::dynamic_pointer_cast( + aProjectionFeature->attribute( + SketchPlugin_Projection::EXTERNAL_FEATURE_ID())); anExternalAttr->setValueCenter(aResult, theEdge, theType, theTemporary); - AttributeBooleanPtr anIntoResult = std::dynamic_pointer_cast - (aProjectionFeature->data()->attribute(SketchPlugin_Projection::INCLUDE_INTO_RESULT())); + AttributeBooleanPtr anIntoResult = + std::dynamic_pointer_cast( + aProjectionFeature->data()->attribute( + SketchPlugin_Projection::INCLUDE_INTO_RESULT())); anIntoResult->setValue(SKETCH_PROJECTION_INCLUDE_INTO_RESULT); aProjectionFeature->execute(); // if projection feature has not been created, exit AttributeRefAttrPtr aRefAttr = aProjectionFeature->data()->refattr( - SketchPlugin_Projection::PROJECTED_FEATURE_ID()); + SketchPlugin_Projection::PROJECTED_FEATURE_ID()); if (!aRefAttr || !aRefAttr->isInitialized()) return ResultPtr(); @@ -825,9 +880,8 @@ ResultPtr PartSet_Tools::createFixedByExternalCenter( return ResultPtr(); } -void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder, - int& theFirst, int& theLast) -{ +void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr &theFolder, + int &theFirst, int &theLast) { theFirst = -1; theLast = -1; @@ -837,10 +891,11 @@ void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder, return; AttributeReferencePtr aFirstFeatAttr = - aFolder->data()->reference(ModelAPI_Folder::FIRST_FEATURE_ID()); + aFolder->data()->reference(ModelAPI_Folder::FIRST_FEATURE_ID()); if (!aFirstFeatAttr.get()) return; - FeaturePtr aFirstFeatureInFolder = ModelAPI_Feature::feature(aFirstFeatAttr->value()); + FeaturePtr aFirstFeatureInFolder = + ModelAPI_Feature::feature(aFirstFeatAttr->value()); if (!aFirstFeatureInFolder.get()) return; @@ -852,10 +907,9 @@ void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder, theLast = aDoc->index(aLastFeatureInFolder); } - -void PartSet_Tools::getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid, - std::vector& theColor) -{ +void PartSet_Tools::getDefaultColor(ObjectPtr theObject, + const bool isEmptyColorValid, + std::vector &theColor) { theColor.clear(); // get default color from the preferences manager for the given result std::string aSection, aName, aDefault; @@ -866,14 +920,15 @@ void PartSet_Tools::getDefaultColor(ObjectPtr theObject, const bool isEmptyColor if (!isEmptyColorValid && theColor.empty()) { // all AIS objects, where the color is not set, are in black. // The color should be defined in XML or set in the attribute - theColor = Config_PropManager::color("Visualization", "object_default_color"); - Events_InfoMessage("PartSet_Tools", - "A default color is not defined in the preferences for this result type").send(); + theColor = + Config_PropManager::color("Visualization", "object_default_color"); + Events_InfoMessage("PartSet_Tools", "A default color is not defined in the " + "preferences for this result type") + .send(); } } -double PartSet_Tools::getDefaultDeflection(const ObjectPtr& theObject) -{ +double PartSet_Tools::getDefaultDeflection(const ObjectPtr &theObject) { double aDeflection = -1; ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { @@ -885,28 +940,30 @@ double PartSet_Tools::getDefaultDeflection(const ObjectPtr& theObject) else if (aResultGroup == ModelAPI_ResultBody::group()) { GeomShapePtr aGeomShape = aResult->shape(); if (aGeomShape.get()) { - // if the shape could not be exploded on faces, it contains only wires, edges, and vertices - // correction of deviation for them should not influence to the application performance + // if the shape could not be exploded on faces, it contains only wires, + // edges, and vertices correction of deviation for them should not + // influence to the application performance GeomAPI_ShapeExplorer anExp(aGeomShape, GeomAPI_Shape::FACE); isConstruction = !anExp.more(); } } if (isConstruction) - aDeflection = Config_PropManager::real("Visualization", "construction_deflection"); + aDeflection = + Config_PropManager::real("Visualization", "construction_deflection"); else - aDeflection = Config_PropManager::real("Visualization", "body_deflection"); + aDeflection = + Config_PropManager::real("Visualization", "body_deflection"); } return aDeflection; } - -double PartSet_Tools::getDefaultTransparency() -{ - return Config_PropManager::integer("Visualization", "shaper_default_transparency") / 100.; +double PartSet_Tools::getDefaultTransparency() { + return Config_PropManager::integer("Visualization", + "shaper_default_transparency") / + 100.; } -QCursor PartSet_Tools::getOperationCursor() -{ +QCursor PartSet_Tools::getOperationCursor() { int aId = Config_PropManager::integer(SKETCH_TAB_NAME, "operation_cursor"); switch (aId) { case 0: diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index 6a1ebf576..6fdf50505 100644 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_Tools_H @@ -24,14 +25,14 @@ #include -#include -#include #include +#include +#include -#include -#include #include #include +#include +#include #include @@ -59,77 +60,70 @@ class QMouseEvent; * \ingroup Modules * \brief The operation for the sketch feature creation */ -class PARTSET_EXPORT PartSet_Tools -{ +class PARTSET_EXPORT PartSet_Tools { public: - /// \enum ConstraintVisibleState types of constraints which visible state can be - /// changed in the sketch widget - enum ConstraintVisibleState - { + /// \enum ConstraintVisibleState types of constraints which visible state can + /// be changed in the sketch widget + enum ConstraintVisibleState { Geometrical = 0, // all constrains excepting dimensional Dimensional, // lenght, distance, radius and angle constraints Expressions, // parameter text should be shown in dimensional constraint Any // both, geometrical and dimensional, types of constraints }; - public: +public: /// Returns default value of AIS presentation /// \return integer value static int getAISDefaultWidth(); - /// Converts the 2D screen point to the 3D point on the view according to the point of view - /// \param thePoint a screen point - /// \param theView a 3D view + /// Converts the 2D screen point to the 3D point on the view according to the + /// point of view \param thePoint a screen point \param theView a 3D view static gp_Pnt convertClickToPoint(QPoint thePoint, Handle(V3d_View) theView); - /// \brief Converts the 3D point to the projected coodinates on the sketch plane. - /// \param thePoint the 3D point in the viewer - /// \param theSketch the sketch feature - /// \param theView a view 3d object - /// \param theX the X coordinate - /// \param theY the Y coordinate - static void convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch, - Handle(V3d_View) theView, - double& theX, double& theY); - - /// \brief Converts the 3D point to the projected coodinates on the sketch plane. - /// \param theSketch the sketch feature - /// \param thePnt the 3D point in the viewer - /// \returns the converted point object - static std::shared_ptr convertTo2D(FeaturePtr theSketch, - const std::shared_ptr& thePnt); - - /// \brief Converts the 2D projected coodinates on the sketch plane to the 3D point. - /// \param theX the X coordinate - /// \param theY the Y coordinate - /// \param theSketch the sketch feature - static std::shared_ptr convertTo3D(const double theX, const double theY, - FeaturePtr theSketch); + /// \brief Converts the 3D point to the projected coodinates on the sketch + /// plane. \param thePoint the 3D point in the viewer \param theSketch the + /// sketch feature \param theView a view 3d object \param theX the X + /// coordinate \param theY the Y coordinate + static void convertTo2D(const gp_Pnt &thePoint, FeaturePtr theSketch, + Handle(V3d_View) theView, double &theX, double &theY); + + /// \brief Converts the 3D point to the projected coodinates on the sketch + /// plane. \param theSketch the sketch feature \param thePnt the 3D point in + /// the viewer \returns the converted point object + static std::shared_ptr + convertTo2D(FeaturePtr theSketch, const std::shared_ptr &thePnt); + + /// \brief Converts the 2D projected coodinates on the sketch plane to the 3D + /// point. \param theX the X coordinate \param theY the Y coordinate \param + /// theSketch the sketch feature + static std::shared_ptr + convertTo3D(const double theX, const double theY, FeaturePtr theSketch); /// Returns pointer to the root document. static std::shared_ptr document(); - /// \brief Save the double to the feature. If the attribute is double, it is filled. - /// \param theFeature the feature - /// \param theX the horizontal coordinate - /// \param theAttribute the feature attribute - static void setFeatureValue(FeaturePtr theFeature, double theX, const std::string& theAttribute); + /// \brief Save the double to the feature. If the attribute is double, it is + /// filled. \param theFeature the feature \param theX the horizontal + /// coordinate \param theAttribute the feature attribute + static void setFeatureValue(FeaturePtr theFeature, double theX, + const std::string &theAttribute); /// \brief Returns the feature double value if it is. /// \param theFeature the feature /// \param theAttribute the feature attribute /// \param isValid an output parameter whether the value is valid /// \returns the feature value - static double featureValue(FeaturePtr theFeature, const std::string& theAttribute, bool& isValid); - - /// Find a feature in the attribute of the given feature. If the kind is not empty, - /// the return feature should be this type. Otherwise it is null - /// \param theFeature a source feature - /// \param theAttribute a name of the requried attribute attribute - /// \param theKind an output feature kind - /// \return the feature - static FeaturePtr feature(FeaturePtr theFeature, const std::string& theAttribute, - const std::string& theKind); + static double featureValue(FeaturePtr theFeature, + const std::string &theAttribute, bool &isValid); + + /// Find a feature in the attribute of the given feature. If the kind is not + /// empty, the return feature should be this type. Otherwise it is null \param + /// theFeature a source feature \param theAttribute a name of the requried + /// attribute attribute \param theKind an output feature kind \return the + /// feature + static FeaturePtr feature(FeaturePtr theFeature, + const std::string &theAttribute, + const std::string &theKind); /// Creates a constraint on two points /// \param theSketch a sketch feature @@ -142,7 +136,8 @@ public: /// Create a sketch plane instance /// \param theSketch a sketch feature /// \return API object of geom plane - static std::shared_ptr sketchPlane(CompositeFeaturePtr theSketch); + static std::shared_ptr + sketchPlane(CompositeFeaturePtr theSketch); /// Create a sketch plane instance /// \param theSketch a sketch feature @@ -153,78 +148,81 @@ public: /// \param thePoint2D a point on a sketch /// \param theSketch a sketch feature /// \return API object of point 3D - static std::shared_ptr point3D(std::shared_ptr thePoint2D, - CompositeFeaturePtr theSketch); + static std::shared_ptr + point3D(std::shared_ptr thePoint2D, + CompositeFeaturePtr theSketch); /// Finds a line (arc or circle) by given edge /// \param theShape an edge /// \param theObject a selected result object /// \param theSketch a sketch feature /// \return result of found feature or NULL - static std::shared_ptr findFixedObjectByExternal( - const TopoDS_Shape& theShape, - const ObjectPtr& theObject, - CompositeFeaturePtr theSketch); + static std::shared_ptr + findFixedObjectByExternal(const TopoDS_Shape &theShape, + const ObjectPtr &theObject, + CompositeFeaturePtr theSketch); /// Creates a line (arc or circle) by given edge /// Created line will have fixed constraint /// \param theShape an edge /// \param theObject a selected result object /// \param theSketch a sketch feature - /// \param theTemporary the created external object is temporary, execute is not performed for it - /// \param theCreatedFeature a new projection feature + /// \param theTemporary the created external object is temporary, execute is + /// not performed for it \param theCreatedFeature a new projection feature /// \return result of created feature static std::shared_ptr createFixedObjectByExternal( - const std::shared_ptr& theShape, - const ObjectPtr& theObject, - CompositeFeaturePtr theSketch, - const bool theTemporary, - FeaturePtr& theCreatedFeature); + const std::shared_ptr &theShape, + const ObjectPtr &theObject, CompositeFeaturePtr theSketch, + const bool theTemporary, FeaturePtr &theCreatedFeature); - /// Checks whether the list of selected presentations contains the given one + /// Checks whether the list of selected presentations contains the given one /// \param theSelected a list of presentations /// \param thePrs a presentation to be found /// \return - result of check, true if the list contains the prs - static bool isContainPresentation(const QList>& theSelected, - const std::shared_ptr& thePrs); + static bool isContainPresentation( + const QList> &theSelected, + const std::shared_ptr &thePrs); /** - * Find attribute of object which corresponds to the given shape - * \param theObj - an object - * \param theShape - a Shape - * \param theSketch - a Sketch to get a plane of converting to 2d - * \return Found attribute and index of point if the attribute is an array - */ - static std::pair findAttributeBy2dPoint(ObjectPtr theObj, - const TopoDS_Shape theShape, - FeaturePtr theSketch); + * Find attribute of object which corresponds to the given shape + * \param theObj - an object + * \param theShape - a Shape + * \param theSketch - a Sketch to get a plane of converting to 2d + * \return Found attribute and index of point if the attribute is an array + */ + static std::pair + findAttributeBy2dPoint(ObjectPtr theObj, const TopoDS_Shape theShape, + FeaturePtr theSketch); /** - * Finds an attribute value in attribute reference attribute value - * \param theAttribute - an attribure reference filled with an attribute - * \param theWorkshop a reference to workshop - * \return a geometry shape - */ - static std::shared_ptr findShapeBy2DPoint(const AttributePtr& theAttribute, - ModuleBase_IWorkshop* theWorkshop); + * Finds an attribute value in attribute reference attribute value + * \param theAttribute - an attribure reference filled with an attribute + * \param theWorkshop a reference to workshop + * \return a geometry shape + */ + static std::shared_ptr + findShapeBy2DPoint(const AttributePtr &theAttribute, + ModuleBase_IWorkshop *theWorkshop); /** - * Returns point of coincidence feature - * \param theFeature the coincidence feature - * \param theAttribute the attribute name - */ - static std::shared_ptr getPoint(std::shared_ptr& theFeature, - const std::string& theAttribute); + * Returns point of coincidence feature + * \param theFeature the coincidence feature + * \param theAttribute the attribute name + */ + static std::shared_ptr + getPoint(std::shared_ptr &theFeature, + const std::string &theAttribute); /** - * Convertes parameters into a geom point - * \param theEvent a Qt event to find mouse position - * \param theWindow view window to define eye of view - * \param theSketch to convert 3D point coordinates into coorditates of the sketch plane - */ - static std::shared_ptr getPnt2d(QMouseEvent* theEvent, - ModuleBase_IViewWindow* theWindow, - const FeaturePtr& theSketch); + * Convertes parameters into a geom point + * \param theEvent a Qt event to find mouse position + * \param theWindow view window to define eye of view + * \param theSketch to convert 3D point coordinates into coorditates of the + * sketch plane + */ + static std::shared_ptr + getPnt2d(QMouseEvent *theEvent, ModuleBase_IViewWindow *theWindow, + const FeaturePtr &theSketch); /** Returns point 2d from selected shape * \param theView a view window @@ -232,47 +230,50 @@ public: * \param theX an output value of X coordinate * \param theY an output value of Y coordinate */ - static std::shared_ptr getPnt2d(const Handle(V3d_View)& theView, - const TopoDS_Shape& theShape, - const FeaturePtr& theSketch); + static std::shared_ptr + getPnt2d(const Handle(V3d_View) & theView, const TopoDS_Shape &theShape, + const FeaturePtr &theSketch); /** - * Gets all references to the feature, take coincidence constraint features, get point 2d attributes - * and compare the point value to be equal with the given. Returns the first feature, which has - * equal points. - * \param theFeature the coincidence feature - * \param thePoint a 2d point - * \return the coincidence feature or null - */ - static FeaturePtr findFirstCoincidence(const FeaturePtr& theFeature, - std::shared_ptr thePoint); + * Gets all references to the feature, take coincidence constraint features, + * get point 2d attributes and compare the point value to be equal with the + * given. Returns the first feature, which has equal points. \param theFeature + * the coincidence feature \param thePoint a 2d point \return the coincidence + * feature or null + */ + static FeaturePtr + findFirstCoincidence(const FeaturePtr &theFeature, + std::shared_ptr thePoint); /** - * Returns list of features connected in a councedence feature point - * \param theStartCoin the coincidence feature - * \param theList a list which collects lines features - * \param theCoincidencies a list of coincidence features - * \param theAttr the attribute name - */ - static void findCoincidences(FeaturePtr theStartCoin, QList& theList, - QList& theCoincidencies, - std::string theAttr, QList& theIsAttributes); + * Returns list of features connected in a councedence feature point + * \param theStartCoin the coincidence feature + * \param theList a list which collects lines features + * \param theCoincidencies a list of coincidence features + * \param theAttr the attribute name + */ + static void findCoincidences(FeaturePtr theStartCoin, + QList &theList, + QList &theCoincidencies, + std::string theAttr, + QList &theIsAttributes); /* - * Finds and returns feature reerenced to the paramenter feature with the given name if found - * \param theFeature a source feature where refsToMe is obtained - * \param theFeatureId an indentifier of the searched feature - */ - static FeaturePtr findRefsToMeFeature(FeaturePtr theFeature, const std::string& theFeatureId) - { + * Finds and returns feature reerenced to the paramenter feature with the + * given name if found \param theFeature a source feature where refsToMe is + * obtained \param theFeatureId an indentifier of the searched feature + */ + static FeaturePtr findRefsToMeFeature(FeaturePtr theFeature, + const std::string &theFeatureId) { if (!theFeature.get()) return FeaturePtr(); // find first projected feature and edit it - const std::set& aRefsList = theFeature->data()->refsToMe(); + const std::set &aRefsList = theFeature->data()->refsToMe(); std::set::const_iterator anIt; for (anIt = aRefsList.cbegin(); anIt != aRefsList.cend(); ++anIt) { - FeaturePtr aRefFeature = std::dynamic_pointer_cast((*anIt)->owner()); + FeaturePtr aRefFeature = + std::dynamic_pointer_cast((*anIt)->owner()); if (aRefFeature && aRefFeature->getKind() == theFeatureId) return aRefFeature; } @@ -280,60 +281,59 @@ public: } /** - * Returns point of a coincedence - * \param theStartCoin the coincedence feature - */ - static std::shared_ptr getCoincedencePoint(FeaturePtr theStartCoin); + * Returns point of a coincedence + * \param theStartCoin the coincedence feature + */ + static std::shared_ptr + getCoincedencePoint(FeaturePtr theStartCoin); /// Sends redisplay event for all sub-features of the composite. Flush it. - static void sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite, + static void sendSubFeaturesEvent(const CompositeFeaturePtr &theComposite, const Events_ID theId); /** - * Returns true if the object is a sketch entity, where auxiliary attribute has true value - * \param theObject a result or feature - * \return boolean result + * Returns true if the object is a sketch entity, where auxiliary attribute + * has true value \param theObject a result or feature \return boolean result */ - static bool isAuxiliarySketchEntity(const ObjectPtr& theObject); + static bool isAuxiliarySketchEntity(const ObjectPtr &theObject); /** - * Returns true if the object is a sketch entity produced by projection or intersection feature - * and if it should not be included into the sketch result + * Returns true if the object is a sketch entity produced by projection or + * intersection feature and if it should not be included into the sketch + * result */ - static bool isIncludeIntoSketchResult(const ObjectPtr& theObject); - - static ResultPtr createFixedByExternalCenter(const ObjectPtr& theObject, - const std::shared_ptr& theEdge, - ModelAPI_AttributeSelection::CenterType theType, - const CompositeFeaturePtr& theSketch, - bool theTemporary, - FeaturePtr& theCreatedFeature); + static bool isIncludeIntoSketchResult(const ObjectPtr &theObject); + static ResultPtr + createFixedByExternalCenter(const ObjectPtr &theObject, + const std::shared_ptr &theEdge, + ModelAPI_AttributeSelection::CenterType theType, + const CompositeFeaturePtr &theSketch, + bool theTemporary, FeaturePtr &theCreatedFeature); - static void getFirstAndLastIndexInFolder(const ObjectPtr& theFolder, - int& theFirst, int& theLast); - + static void getFirstAndLastIndexInFolder(const ObjectPtr &theFolder, + int &theFirst, int &theLast); /** - * Returns default color value for the given object - */ + * Returns default color value for the given object + */ static void getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid, - std::vector& theColor); + std::vector &theColor); /** - * Returns default deflection value for the given object - */ - static double getDefaultDeflection(const ObjectPtr& theObject); - + * Returns default deflection value for the given object + */ + static double getDefaultDeflection(const ObjectPtr &theObject); /** - * Returns default transparency value - */ + * Returns default transparency value + */ static double getDefaultTransparency(); /** - * Returns cursor according to (SKETCH_TAB_NAME, "operation_cursor") property value - */ + * Returns cursor according to (SKETCH_TAB_NAME, "operation_cursor") property + * value + */ static QCursor getOperationCursor(); }; diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index fc70a9f11..a92be79ae 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -14,31 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_TreeNodes.h" #include "PartSet_Tools.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 @@ -46,23 +46,22 @@ #include #include - #define ACTIVE_COLOR QColor(Qt::black) #define SELECTABLE_COLOR QColor(100, 100, 100) #define DISABLED_COLOR QColor(200, 200, 200) Qt::ItemFlags aNullFlag; Qt::ItemFlags aDefaultFlag = Qt::ItemIsSelectable | Qt::ItemIsEnabled; -Qt::ItemFlags aEditingFlag = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable; - +Qt::ItemFlags aEditingFlag = + Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable; -ResultPartPtr getPartResult(const ObjectPtr& theObj) -{ +ResultPartPtr getPartResult(const ObjectPtr &theObj) { FeaturePtr aFeature = std::dynamic_pointer_cast(theObj); if (aFeature) { ResultPtr aRes = aFeature->firstResult(); if (aRes.get() && (aRes->groupName() == ModelAPI_ResultPart::group())) { - ResultPartPtr aPartRes = std::dynamic_pointer_cast(aRes); + ResultPartPtr aPartRes = + std::dynamic_pointer_cast(aRes); // Use only original parts, not a placement results if (aPartRes == aPartRes->original()) return aPartRes; @@ -71,8 +70,7 @@ ResultPartPtr getPartResult(const ObjectPtr& theObj) return ResultPartPtr(); } -bool isCurrentFeature(const ObjectPtr& theObj) -{ +bool isCurrentFeature(const ObjectPtr &theObj) { SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aCurDoc = aSession->activeDocument(); FeaturePtr aFeature = aCurDoc->currentFeature(true); @@ -80,8 +78,7 @@ bool isCurrentFeature(const ObjectPtr& theObj) } ////////////////////////////////////////////////////////////////////////////////// -QVariant PartSet_TreeNode::data(int theColumn, int theRole) const -{ +QVariant PartSet_TreeNode::data(int theColumn, int theRole) const { if ((theColumn == 1) && (theRole == Qt::ForegroundRole)) { Qt::ItemFlags aFlags = flags(theColumn); if (aFlags == Qt::ItemFlags()) @@ -93,26 +90,24 @@ QVariant PartSet_TreeNode::data(int theColumn, int theRole) const return ModuleBase_ITreeNode::data(theColumn, theRole); } -QColor PartSet_TreeNode::activeItemColor() const -{ +QColor PartSet_TreeNode::activeItemColor() const { // instead of ACTIVE_COLOR (black), // use the color text of the current theme (white or black or other) // to make it readable in dark theme (and light theme as well) - QColor color = QPalette().text().color() ; + QColor color = QPalette().text().color(); return color; } - ////////////////////////////////////////////////////////////////////////////////// -QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const -{ +QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const { switch (theRole) { case Qt::DisplayRole: if (theColumn == 1) { if (myObject->groupName() == ModelAPI_ResultParameter::group()) { - ResultParameterPtr aParam = std::dynamic_pointer_cast(myObject); + ResultParameterPtr aParam = + std::dynamic_pointer_cast(myObject); AttributeDoublePtr aValueAttribute = - aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + aParam->data()->real(ModelAPI_ResultParameter::VALUE()); QString aVal = QString::number(aValueAttribute->value()); QString aTitle = QString::fromStdWString(myObject->data()->name()); return aTitle + " = " + aVal; @@ -145,19 +140,16 @@ QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const return PartSet_TreeNode::data(theColumn, theRole); } -QColor PartSet_ObjectNode::activeItemColor() const -{ +QColor PartSet_ObjectNode::activeItemColor() const { if (myObject.get() && myObject->groupName() == ModelAPI_Feature::group()) { - std::vector aColor = - Config_PropManager::color("Visualization", "feature_objectbrowser_color"); + std::vector aColor = Config_PropManager::color( + "Visualization", "feature_objectbrowser_color"); return QColor(aColor[0], aColor[1], aColor[2]); } return PartSet_TreeNode::activeItemColor(); } - -Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const -{ +Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const { if (myObject->isDisabled()) { return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag; } else { @@ -165,10 +157,9 @@ Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const SessionPtr aSession = ModelAPI_Session::get(); FeaturePtr aFeature = std::dynamic_pointer_cast(myObject); - if (aFeature.get() && aFeature->getKind() == "Group") - { + if (aFeature.get() && aFeature->getKind() == "Group") { std::shared_ptr anOwner = - ModelAPI_Tools::compositeOwner (aFeature); + ModelAPI_Tools::compositeOwner(aFeature); if (anOwner.get() && anOwner->getKind() == "ImportResult") return aDefaultFlag; @@ -180,8 +171,8 @@ Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const return aDefaultFlag; } -PartSet_ObjectNode::VisibilityState PartSet_ObjectNode::visibilityState() const -{ +PartSet_ObjectNode::VisibilityState +PartSet_ObjectNode::visibilityState() const { Qt::ItemFlags aFlags = flags(1); if (aFlags == Qt::ItemFlags()) return NoneState; @@ -190,13 +181,16 @@ PartSet_ObjectNode::VisibilityState PartSet_ObjectNode::visibilityState() const return NoneState; ResultPtr aResObj = std::dynamic_pointer_cast(myObject); if (aResObj.get()) { - ModuleBase_IWorkshop* aWork = workshop(); - ResultBodyPtr aCompRes = std::dynamic_pointer_cast(aResObj); + ModuleBase_IWorkshop *aWork = workshop(); + ResultBodyPtr aCompRes = + std::dynamic_pointer_cast(aResObj); if (aCompRes.get()) { std::list aResultsList; ModelAPI_Tools::allSubs(aCompRes, aResultsList); - VisibilityState aState = aResultsList.size() == 0 ? - (aWork->isVisible(aCompRes) ? Visible : Hidden) : NoneState; + VisibilityState aState = + aResultsList.size() == 0 + ? (aWork->isVisible(aCompRes) ? Visible : Hidden) + : NoneState; std::list::const_iterator aIt; ResultBodyPtr aCompSub; @@ -224,18 +218,19 @@ PartSet_ObjectNode::VisibilityState PartSet_ObjectNode::visibilityState() const return NoneState; } -int PartSet_ObjectNode::numberOfSubs() const -{ - ResultBodyPtr aCompRes = std::dynamic_pointer_cast(myObject); +int PartSet_ObjectNode::numberOfSubs() const { + ResultBodyPtr aCompRes = + std::dynamic_pointer_cast(myObject); if (aCompRes.get()) - return aCompRes->numberOfSubs(true); + return aCompRes->numberOfSubs(true); else { CompositeFeaturePtr aCompFeature = - std::dynamic_pointer_cast(myObject); + std::dynamic_pointer_cast(myObject); if (aCompFeature.get() && aCompFeature->data()->isValid()) return aCompFeature->numberOfSubs(true); else { - ResultFieldPtr aFieldRes = std::dynamic_pointer_cast(myObject); + ResultFieldPtr aFieldRes = + std::dynamic_pointer_cast(myObject); if (aFieldRes.get()) return aFieldRes->stepsSize(); } @@ -243,41 +238,40 @@ int PartSet_ObjectNode::numberOfSubs() const return 0; } - -ObjectPtr PartSet_ObjectNode::subObject(int theId) const -{ - ResultBodyPtr aCompRes = std::dynamic_pointer_cast(myObject); +ObjectPtr PartSet_ObjectNode::subObject(int theId) const { + ResultBodyPtr aCompRes = + std::dynamic_pointer_cast(myObject); if (aCompRes.get()) return aCompRes->subResult(theId, true); else { CompositeFeaturePtr aCompFeature = - std::dynamic_pointer_cast(myObject); + std::dynamic_pointer_cast(myObject); if (aCompFeature.get()) return aCompFeature->subFeature(theId, true); } return ObjectPtr(); } -void PartSet_ObjectNode::update() -{ +void PartSet_ObjectNode::update() { int aNb = numberOfSubs(); if (aNb > 0) { - ResultFieldPtr aFieldRes = std::dynamic_pointer_cast(myObject); + ResultFieldPtr aFieldRes = + std::dynamic_pointer_cast(myObject); // If the object is a field result then delete extra sub-objects if (aFieldRes.get()) { // Call shape in order to update content of Field. - // It is necessary to do for cases when field was created by script when module is inactive. + // It is necessary to do for cases when field was created by script when + // module is inactive. aFieldRes->shape(); while (myChildren.size() > aNb) { - ModuleBase_ITreeNode* aNode = myChildren.last(); + ModuleBase_ITreeNode *aNode = myChildren.last(); myChildren.removeAll(aNode); delete aNode; } - } - else { + } else { ObjectPtr aObj; - ModuleBase_ITreeNode* aNode; + ModuleBase_ITreeNode *aNode; int aId = 0; while (aId < myChildren.size()) { aNode = myChildren.at(aId); @@ -285,13 +279,12 @@ void PartSet_ObjectNode::update() if (aNode->object() != aObj) { myChildren.removeAll(aNode); delete aNode; - } - else + } else aId++; } } - ModuleBase_ITreeNode* aNode; + ModuleBase_ITreeNode *aNode; ObjectPtr aBody; int i; for (i = 0; i < aNb; i++) { @@ -300,25 +293,23 @@ void PartSet_ObjectNode::update() if (i < myChildren.size()) { aNode = myChildren.at(i); if (aNode->object() != aBody) { - ((PartSet_ObjectNode*)aNode)->setObject(aBody); + ((PartSet_ObjectNode *)aNode)->setObject(aBody); } - } - else { + } else { aNode = new PartSet_ObjectNode(aBody, this); myChildren.append(aNode); aNode->update(); } - } - else if (aFieldRes.get()) { + } else if (aFieldRes.get()) { FieldStepPtr aStep = aFieldRes->step(i); if (aStep.get()) { if (i < myChildren.size()) { - PartSet_StepNode* aStepNode = static_cast(myChildren.at(i)); + PartSet_StepNode *aStepNode = + static_cast(myChildren.at(i)); if (aStepNode->object() != aStep) { aStepNode->setObject(aStep); } - } - else { + } else { aNode = new PartSet_StepNode(aStep, this); myChildren.append(aNode); } @@ -330,26 +321,27 @@ void PartSet_ObjectNode::update() aNode = myChildren.takeLast(); delete aNode; } - foreach(ModuleBase_ITreeNode* aChildNode, myChildren) { + foreach (ModuleBase_ITreeNode *aChildNode, myChildren) { aChildNode->update(); } - } - else { + } else { deleteChildren(); } } -QTreeNodesList PartSet_ObjectNode::objectCreated(const QObjectPtrList& theObjects) -{ +QTreeNodesList +PartSet_ObjectNode::objectCreated(const QObjectPtrList &theObjects) { QTreeNodesList aResult; int aNb = numberOfSubs(); if (aNb > 0) { - ModuleBase_ITreeNode* aNode; - ResultFieldPtr aFieldRes = std::dynamic_pointer_cast(myObject); + ModuleBase_ITreeNode *aNode; + ResultFieldPtr aFieldRes = + std::dynamic_pointer_cast(myObject); ObjectPtr aBody; int i; // Call shape in order to update content of Field. - // It is necessary to do for cases when field was created by script when module is inactive. + // It is necessary to do for cases when field was created by script when + // module is inactive. if (aFieldRes.get()) aFieldRes->shape(); for (i = 0; i < aNb; i++) { @@ -358,55 +350,51 @@ QTreeNodesList PartSet_ObjectNode::objectCreated(const QObjectPtrList& theObject if (i < myChildren.size()) { aNode = myChildren.at(i); if (aNode->object() != aBody) { - ((PartSet_ObjectNode*)aNode)->setObject(aBody); + ((PartSet_ObjectNode *)aNode)->setObject(aBody); aResult.append(aNode); } - } - else { + } else { aNode = new PartSet_ObjectNode(aBody, this); myChildren.append(aNode); aResult.append(aNode); aNode->update(); } - } - else { + } else { FieldStepPtr aStep = aFieldRes->step(i); if (aStep.get()) { if (i < myChildren.size()) { - PartSet_StepNode* aStepNode = static_cast(myChildren.at(i)); + PartSet_StepNode *aStepNode = + static_cast(myChildren.at(i)); if (aStepNode->object() != aStep) { aStepNode->setObject(aStep); } - } - else { + } else { aNode = new PartSet_StepNode(aStep, this); myChildren.append(aNode); } } } } - foreach(ModuleBase_ITreeNode* aChildNode, myChildren) { + foreach (ModuleBase_ITreeNode *aChildNode, myChildren) { aResult.append(aChildNode->objectCreated(theObjects)); } } return aResult; } -QTreeNodesList PartSet_ObjectNode::objectsDeleted( - const DocumentPtr& theDoc, const QString& theGroup) -{ +QTreeNodesList PartSet_ObjectNode::objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) { QTreeNodesList aResult; int aNb = numberOfSubs(); if (aNb != myChildren.size()) { if (aNb == 0) { deleteChildren(); aResult.append(this); - } - else { + } else { // Delete extra objects bool isDeleted = false; ObjectPtr aObj; - ModuleBase_ITreeNode* aNode; + ModuleBase_ITreeNode *aNode; int aId = 0; while (aId < myChildren.size()) { aNode = myChildren.at(aId); @@ -415,17 +403,16 @@ QTreeNodesList PartSet_ObjectNode::objectsDeleted( myChildren.removeAll(aNode); delete aNode; isDeleted = true; - } - else + } else aId++; } if (isDeleted) aResult.append(this); int i = 0; ObjectPtr aBody; - foreach(ModuleBase_ITreeNode* aChildNode, myChildren) { + foreach (ModuleBase_ITreeNode *aChildNode, myChildren) { aBody = subObject(i); - ((PartSet_ObjectNode*)aChildNode)->setObject(aBody); + ((PartSet_ObjectNode *)aChildNode)->setObject(aBody); aResult.append(aChildNode->objectsDeleted(theDoc, theGroup)); i++; } @@ -434,14 +421,11 @@ QTreeNodesList PartSet_ObjectNode::objectsDeleted( return aResult; } ////////////////////////////////////////////////////////////////////////////////// -PartSet_FolderNode::PartSet_FolderNode(ModuleBase_ITreeNode* theParent, - FolderType theType) - : PartSet_TreeNode(theParent), myType(theType) -{ -} +PartSet_FolderNode::PartSet_FolderNode(ModuleBase_ITreeNode *theParent, + FolderType theType) + : PartSet_TreeNode(theParent), myType(theType) {} -QString PartSet_FolderNode::name() const -{ +QString PartSet_FolderNode::name() const { switch (myType) { case ParametersFolder: return QObject::tr("Parameters"); @@ -459,9 +443,7 @@ QString PartSet_FolderNode::name() const return "NoName"; } - -QVariant PartSet_FolderNode::data(int theColumn, int theRole) const -{ +QVariant PartSet_FolderNode::data(int theColumn, int theRole) const { static QIcon aParamsIco(":pictures/params_folder.png"); static QIcon aConstrIco(":pictures/constr_folder.png"); @@ -490,12 +472,12 @@ QVariant PartSet_FolderNode::data(int theColumn, int theRole) const if (document().get()) { SessionPtr aSession = ModelAPI_Session::get(); if (document() != aSession->activeDocument()) - return QIcon(); + return QIcon(); FeaturePtr aFeature = document()->currentFeature(true); if (!aFeature.get()) { // There is no current feature - ModuleBase_ITreeNode* aLastFolder = 0; - foreach(ModuleBase_ITreeNode* aNode, parent()->children()) { + ModuleBase_ITreeNode *aLastFolder = 0; + foreach (ModuleBase_ITreeNode *aNode, parent()->children()) { if (aNode->type() == PartSet_FolderNode::typeId()) aLastFolder = aNode; else @@ -511,8 +493,7 @@ QVariant PartSet_FolderNode::data(int theColumn, int theRole) const return PartSet_TreeNode::data(theColumn, theRole); } -Qt::ItemFlags PartSet_FolderNode::flags(int theColumn) const -{ +Qt::ItemFlags PartSet_FolderNode::flags(int theColumn) const { SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aActiveDoc = aSession->activeDocument(); if (theColumn == 1) { @@ -522,18 +503,17 @@ Qt::ItemFlags PartSet_FolderNode::flags(int theColumn) const return aDefaultFlag; } -ModuleBase_ITreeNode* PartSet_FolderNode::createNode(const ObjectPtr& theObj) -{ - //ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast(theObj); - //if (aCompRes.get()) - // return new PartSet_CompsolidNode(theObj, this); - ModuleBase_ITreeNode* aNode = new PartSet_ObjectNode(theObj, this); +ModuleBase_ITreeNode *PartSet_FolderNode::createNode(const ObjectPtr &theObj) { + // ResultCompSolidPtr aCompRes = + // std::dynamic_pointer_cast(theObj); if + // (aCompRes.get()) + // return new PartSet_CompsolidNode(theObj, this); + ModuleBase_ITreeNode *aNode = new PartSet_ObjectNode(theObj, this); aNode->update(); return aNode; } -void PartSet_FolderNode::update() -{ +void PartSet_FolderNode::update() { DocumentPtr aDoc = document(); if (!aDoc.get()) return; @@ -542,7 +522,7 @@ void PartSet_FolderNode::update() int aIndex; int aId = 0; while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); aIndex = aDoc->index(aNode->object(), true); if ((aIndex == -1) || (aId != aIndex)) { myChildren.removeAll(aNode); @@ -558,22 +538,21 @@ void PartSet_FolderNode::update() ObjectPtr aObj = aDoc->object(aGroup, i, true); if (i < myChildren.size()) { if (myChildren.at(i)->object() != aObj) { - ModuleBase_ITreeNode* aNode = createNode(aObj); + ModuleBase_ITreeNode *aNode = createNode(aObj); myChildren.insert(i, aNode); } } else { - ModuleBase_ITreeNode* aNode = createNode(aObj); + ModuleBase_ITreeNode *aNode = createNode(aObj); myChildren.append(aNode); } } - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { aNode->update(); } } -std::string PartSet_FolderNode::groupName() const -{ +std::string PartSet_FolderNode::groupName() const { switch (myType) { case ParametersFolder: return ModelAPI_ResultParameter::group(); @@ -591,20 +570,21 @@ std::string PartSet_FolderNode::groupName() const return ""; } -QTreeNodesList PartSet_FolderNode::objectCreated(const QObjectPtrList& theObjects) -{ +QTreeNodesList +PartSet_FolderNode::objectCreated(const QObjectPtrList &theObjects) { QTreeNodesList aResult; std::string aName = groupName(); DocumentPtr aDoc = document(); int aIdx = -1; - QMap aNewNodes; - foreach(ObjectPtr aObj, theObjects) { + QMap aNewNodes; + foreach (ObjectPtr aObj, theObjects) { if ((aObj->document() == aDoc) && (aObj->groupName() == aName)) { aIdx = aDoc->index(aObj, true); if (aIdx != -1) { - bool aHasObject = (aIdx < myChildren.size()) && (myChildren.at(aIdx)->object() == aObj); + bool aHasObject = (aIdx < myChildren.size()) && + (myChildren.at(aIdx)->object() == aObj); if (!aHasObject) { - ModuleBase_ITreeNode* aNode = createNode(aObj); + ModuleBase_ITreeNode *aNode = createNode(aObj); aNewNodes[aIdx] = aNode; aResult.append(aNode); aNode->update(); @@ -627,15 +607,14 @@ QTreeNodesList PartSet_FolderNode::objectCreated(const QObjectPtrList& theObject aNewNodes.remove(i); } } - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { aResult.append(aNode->objectCreated(theObjects)); } return aResult; } -QTreeNodesList PartSet_FolderNode::objectsDeleted(const DocumentPtr& theDoc, - const QString& theGroup) -{ +QTreeNodesList PartSet_FolderNode::objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) { DocumentPtr aDoc = document(); QTreeNodesList aResult; if ((theGroup.toStdString() == groupName()) && (theDoc == aDoc)) { @@ -645,22 +624,21 @@ QTreeNodesList PartSet_FolderNode::objectsDeleted(const DocumentPtr& theDoc, bool aRemoved = false; bool aToSort = false; while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); aIndex = aDoc->index(aNode->object(), true); aToSort |= ((aIndex != -1) && (aId != aIndex)); if (aIndex == -1) { myChildren.removeAll(aNode); delete aNode; aRemoved = true; - } - else + } else aId++; } if (aRemoved) aResult.append(this); if (aToSort) sortChildren(); - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { aResult.append(aNode->objectsDeleted(theDoc, theGroup)); } } @@ -668,23 +646,24 @@ QTreeNodesList PartSet_FolderNode::objectsDeleted(const DocumentPtr& theDoc, } ////////////////////////////////////////////////////////////////////////////////// -QTreeNodesList PartSet_FeatureFolderNode::objectCreated(const QObjectPtrList& theObjects) -{ +QTreeNodesList +PartSet_FeatureFolderNode::objectCreated(const QObjectPtrList &theObjects) { QTreeNodesList aResult; // Process the root sub-objects DocumentPtr aDoc = document(); int aIdx = -1; int aNb = numberOfFolders(); - QMap aNewNodes; - foreach(ObjectPtr aObj, theObjects) { + QMap aNewNodes; + foreach (ObjectPtr aObj, theObjects) { if (aDoc == aObj->document()) { if ((aObj->groupName() == ModelAPI_Feature::group()) || - (aObj->groupName() == ModelAPI_Folder::group())){ + (aObj->groupName() == ModelAPI_Folder::group())) { aIdx = aDoc->index(aObj, true); if (aIdx != -1) { - ModuleBase_ITreeNode* aNode = createNode(aObj); + ModuleBase_ITreeNode *aNode = createNode(aObj); aIdx += aNb; - bool aHasObject = (aIdx < myChildren.size()) && (myChildren.at(aIdx)->object() == aObj); + bool aHasObject = (aIdx < myChildren.size()) && + (myChildren.at(aIdx)->object() == aObj); if (!aHasObject) { aNewNodes[aIdx] = aNode; aResult.append(aNode); @@ -712,19 +691,19 @@ QTreeNodesList PartSet_FeatureFolderNode::objectCreated(const QObjectPtrList& th } } // Update sub-folders - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { aResult.append(aNode->objectCreated(theObjects)); } return aResult; } -QTreeNodesList PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr& theDoc, - const QString& theGroup) -{ +QTreeNodesList +PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) { QTreeNodesList aResult; // Process sub-folders - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { if (aNode->childrenCount() > 0) { // aFolder node QTreeNodesList aList = aNode->objectsDeleted(theDoc, theGroup); if (aList.size() > 0) @@ -736,14 +715,14 @@ QTreeNodesList PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr& theD DocumentPtr aDoc = document(); int aNb = numberOfFolders(); bool isGroup = ((theGroup.toStdString() == ModelAPI_Feature::group()) || - (theGroup.toStdString() == ModelAPI_Folder::group())); + (theGroup.toStdString() == ModelAPI_Folder::group())); if ((theDoc == aDoc) && isGroup) { int aIndex; int aId = 0; bool aRemoved = false; bool aToSort = false; while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); if (aNode->object().get()) { aIndex = aDoc->index(aNode->object(), true); aToSort |= ((aIndex != -1) && (aId != (aIndex + aNb))); @@ -764,32 +743,33 @@ QTreeNodesList PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr& theD return aResult; } -ModuleBase_ITreeNode* PartSet_FeatureFolderNode::findParent(const DocumentPtr& theDoc, - QString theGroup) -{ - ModuleBase_ITreeNode* aResult = 0; - foreach(ModuleBase_ITreeNode* aNode, myChildren) { +ModuleBase_ITreeNode * +PartSet_FeatureFolderNode::findParent(const DocumentPtr &theDoc, + QString theGroup) { + ModuleBase_ITreeNode *aResult = 0; + foreach (ModuleBase_ITreeNode *aNode, myChildren) { aResult = aNode->findParent(theDoc, theGroup); if (aResult) { return aResult; } } bool isGroup = ((theGroup.toStdString() == ModelAPI_Feature::group()) || - (theGroup.toStdString() == ModelAPI_Folder::group())); + (theGroup.toStdString() == ModelAPI_Folder::group())); if ((theDoc == document()) && isGroup) return this; return 0; } - ////////////////////////////////////////////////////////////////////////////////// -PartSet_RootNode::PartSet_RootNode() : PartSet_FeatureFolderNode(0), myWorkshop(0) -{ +PartSet_RootNode::PartSet_RootNode() + : PartSet_FeatureFolderNode(0), myWorkshop(0) { SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aDoc = aSession->moduleDocument(); - myParamsFolder = new PartSet_FolderNode(this, PartSet_FolderNode::ParametersFolder); - myConstrFolder = new PartSet_FolderNode(this, PartSet_FolderNode::ConstructionFolder); + myParamsFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::ParametersFolder); + myConstrFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::ConstructionFolder); myPartsFolder = new PartSet_FolderNode(this, PartSet_FolderNode::PartsFolder); myChildren.append(myParamsFolder); @@ -799,9 +779,7 @@ PartSet_RootNode::PartSet_RootNode() : PartSet_FeatureFolderNode(0), myWorkshop( update(); } - -void PartSet_RootNode::update() -{ +void PartSet_RootNode::update() { myParamsFolder->update(); myConstrFolder->update(); myPartsFolder->update(); @@ -814,7 +792,7 @@ void PartSet_RootNode::update() int aIndex; int aId = 0; while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); if (aNode->object().get()) { aIndex = aDoc->index(aNode->object(), true); if ((aIndex == -1) || (aId != (aIndex + aNb))) { @@ -835,29 +813,27 @@ void PartSet_RootNode::update() aId = i + aNb; // Take into account existing folders if (aId < myChildren.size()) { if (myChildren.at(aId)->object() != aObj) { - ModuleBase_ITreeNode* aNode = createNode(aObj); + ModuleBase_ITreeNode *aNode = createNode(aObj); myChildren.insert(aId, aNode); } } else { - ModuleBase_ITreeNode* aNode = createNode(aObj); + ModuleBase_ITreeNode *aNode = createNode(aObj); myChildren.append(aNode); } } // Update sub-folders - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { if ((aNode->type() == PartSet_ObjectFolderNode::typeId()) || - (aNode->type() == PartSet_PartRootNode::typeId())) + (aNode->type() == PartSet_PartRootNode::typeId())) aNode->update(); } } -DocumentPtr PartSet_RootNode::document() const -{ +DocumentPtr PartSet_RootNode::document() const { return ModelAPI_Session::get()->moduleDocument(); } -ModuleBase_ITreeNode* PartSet_RootNode::createNode(const ObjectPtr& theObj) -{ +ModuleBase_ITreeNode *PartSet_RootNode::createNode(const ObjectPtr &theObj) { if (theObj->groupName() == ModelAPI_Folder::group()) return new PartSet_ObjectFolderNode(theObj, this); @@ -865,20 +841,25 @@ ModuleBase_ITreeNode* PartSet_RootNode::createNode(const ObjectPtr& theObj) if (aFeature->getKind() == PartSetPlugin_Part::ID()) return new PartSet_PartRootNode(theObj, this); - PartSet_ObjectNode* aNode = new PartSet_ObjectNode(theObj, this); + PartSet_ObjectNode *aNode = new PartSet_ObjectNode(theObj, this); aNode->update(); return aNode; } ////////////////////////////////////////////////////////////////////////////////// -PartSet_PartRootNode::PartSet_PartRootNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent) - : PartSet_FeatureFolderNode(theParent), myObject(theObj) -{ - myParamsFolder = new PartSet_FolderNode(this, PartSet_FolderNode::ParametersFolder); - myConstrFolder = new PartSet_FolderNode(this, PartSet_FolderNode::ConstructionFolder); - myResultsFolder = new PartSet_FolderNode(this, PartSet_FolderNode::ResultsFolder); - myFieldsFolder = new PartSet_FolderNode(this, PartSet_FolderNode::FieldsFolder); - myGroupsFolder = new PartSet_FolderNode(this, PartSet_FolderNode::GroupsFolder); +PartSet_PartRootNode::PartSet_PartRootNode(const ObjectPtr &theObj, + ModuleBase_ITreeNode *theParent) + : PartSet_FeatureFolderNode(theParent), myObject(theObj) { + myParamsFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::ParametersFolder); + myConstrFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::ConstructionFolder); + myResultsFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::ResultsFolder); + myFieldsFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::FieldsFolder); + myGroupsFolder = + new PartSet_FolderNode(this, PartSet_FolderNode::GroupsFolder); myChildren.append(myParamsFolder); myChildren.append(myConstrFolder); @@ -887,8 +868,7 @@ PartSet_PartRootNode::PartSet_PartRootNode(const ObjectPtr& theObj, ModuleBase_I update(); } -void PartSet_PartRootNode::deleteChildren() -{ +void PartSet_PartRootNode::deleteChildren() { if (!myFieldsFolder->childrenCount()) { delete myFieldsFolder; } @@ -898,9 +878,7 @@ void PartSet_PartRootNode::deleteChildren() PartSet_FeatureFolderNode::deleteChildren(); } - -void PartSet_PartRootNode::update() -{ +void PartSet_PartRootNode::update() { DocumentPtr aDoc = document(); if (!aDoc.get()) return; @@ -934,9 +912,9 @@ void PartSet_PartRootNode::update() // Remove extra sub-nodes int aIndex = -1; int aId = aRows; - QMap aExistingNodes; + QMap aExistingNodes; while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); if (aNode->object().get()) { aIndex = aDoc->index(aNode->object(), true); if ((aIndex == -1) || (aId != (aIndex + aRows))) { @@ -962,8 +940,7 @@ void PartSet_PartRootNode::update() if (aExistingNodes.contains(aId)) { myChildren.insert(aId, aExistingNodes[aId]); aExistingNodes.remove(aId); - } - else { + } else { myChildren.insert(aId, createNode(aObj)); } } @@ -975,31 +952,29 @@ void PartSet_PartRootNode::update() } } // Update sub-folders - foreach(ModuleBase_ITreeNode* aNode, myChildren) { + foreach (ModuleBase_ITreeNode *aNode, myChildren) { if (aNode->type() == PartSet_ObjectFolderNode::typeId()) aNode->update(); } } -DocumentPtr PartSet_PartRootNode::document() const -{ +DocumentPtr PartSet_PartRootNode::document() const { ResultPartPtr aPartRes = getPartResult(myObject); if (aPartRes.get()) return aPartRes->partDoc(); return DocumentPtr(); } -QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const -{ +QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const { switch (theColumn) { case 1: switch (theRole) { - case Qt::DisplayRole: - { + case Qt::DisplayRole: { ResultPartPtr aPartRes = getPartResult(myObject); if (aPartRes.get()) { if (aPartRes->partDoc().get() == NULL) - return QString::fromStdWString(myObject->data()->name()) + " (Not loaded)"; + return QString::fromStdWString(myObject->data()->name()) + + " (Not loaded)"; } return QString::fromStdWString(myObject->data()->name()); } @@ -1017,8 +992,7 @@ QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const return PartSet_TreeNode::data(theColumn, theRole); } -Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const -{ +Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const { if (myObject->isDisabled()) return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag; @@ -1029,17 +1003,16 @@ Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const return aDefaultFlag; } -ModuleBase_ITreeNode* PartSet_PartRootNode::createNode(const ObjectPtr& theObj) -{ +ModuleBase_ITreeNode * +PartSet_PartRootNode::createNode(const ObjectPtr &theObj) { if (theObj->groupName() == ModelAPI_Folder::group()) return new PartSet_ObjectFolderNode(theObj, this); - PartSet_ObjectNode* aNode = new PartSet_ObjectNode(theObj, this); + PartSet_ObjectNode *aNode = new PartSet_ObjectNode(theObj, this); aNode->update(); return aNode; } -int PartSet_PartRootNode::numberOfFolders() const -{ +int PartSet_PartRootNode::numberOfFolders() const { int aNb = 3; if (myFieldsFolder->childrenCount() > 0) aNb++; @@ -1048,8 +1021,8 @@ int PartSet_PartRootNode::numberOfFolders() const return aNb; } -QTreeNodesList PartSet_PartRootNode::objectCreated(const QObjectPtrList& theObjects) -{ +QTreeNodesList +PartSet_PartRootNode::objectCreated(const QObjectPtrList &theObjects) { QTreeNodesList aResult = PartSet_FeatureFolderNode::objectCreated(theObjects); if (!myFieldsFolder->childrenCount()) { QTreeNodesList aList = myFieldsFolder->objectCreated(theObjects); @@ -1062,7 +1035,8 @@ QTreeNodesList PartSet_PartRootNode::objectCreated(const QObjectPtrList& theObje if (!myGroupsFolder->childrenCount()) { QTreeNodesList aList = myGroupsFolder->objectCreated(theObjects); if (aList.size()) { - myChildren.insert(myFieldsFolder->childrenCount()? 4 : 3, myGroupsFolder); + myChildren.insert(myFieldsFolder->childrenCount() ? 4 : 3, + myGroupsFolder); aResult.append(myGroupsFolder); aResult.append(aList); } @@ -1070,9 +1044,8 @@ QTreeNodesList PartSet_PartRootNode::objectCreated(const QObjectPtrList& theObje return aResult; } -QTreeNodesList PartSet_PartRootNode::objectsDeleted(const DocumentPtr& theDoc, - const QString& theGroup) -{ +QTreeNodesList PartSet_PartRootNode::objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) { QTreeNodesList aResult; if (myFieldsFolder->childrenCount()) { QTreeNodesList aList = myFieldsFolder->objectsDeleted(theDoc, theGroup); @@ -1095,8 +1068,7 @@ QTreeNodesList PartSet_PartRootNode::objectsDeleted(const DocumentPtr& theDoc, } ////////////////////////////////////////////////////////////////////////////////// -void PartSet_ObjectFolderNode::update() -{ +void PartSet_ObjectFolderNode::update() { int aFirst = -1, aLast = -1; PartSet_Tools::getFirstAndLastIndexInFolder(myObject, aFirst, aLast); if ((aFirst == -1) || (aLast == -1)) { @@ -1116,15 +1088,15 @@ void PartSet_ObjectFolderNode::update() int aId = 0; int aNbOfFeatures = aDoc->size(ModelAPI_Feature::group(), true); while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); if ((aId < aNbItems) && ((aFirst + aId) < aNbOfFeatures)) { - if (aNode->object() != aDoc->object(ModelAPI_Feature::group(), aFirst + aId)) { + if (aNode->object() != + aDoc->object(ModelAPI_Feature::group(), aFirst + aId)) { myChildren.removeAll(aNode); delete aNode; continue; } - } - else { + } else { myChildren.removeAll(aNode); delete aNode; continue; @@ -1134,7 +1106,7 @@ void PartSet_ObjectFolderNode::update() } if (aNbItems > myChildren.size()) { // Add new nodes - ModuleBase_ITreeNode* aNode; + ModuleBase_ITreeNode *aNode; for (int i = 0; i < aNbItems; i++) { ObjectPtr aObj = aDoc->object(ModelAPI_Feature::group(), aFirst + i); if (i < myChildren.size()) { @@ -1143,8 +1115,7 @@ void PartSet_ObjectFolderNode::update() myChildren.insert(i, aNode); aNode->update(); } - } - else { + } else { aNode = new PartSet_ObjectNode(aObj, this); myChildren.append(aNode); aNode->update(); @@ -1153,8 +1124,8 @@ void PartSet_ObjectFolderNode::update() } } -QTreeNodesList PartSet_ObjectFolderNode::objectCreated(const QObjectPtrList& /*theObjects*/) -{ +QTreeNodesList +PartSet_ObjectFolderNode::objectCreated(const QObjectPtrList & /*theObjects*/) { QTreeNodesList aResult; int aFirst = -1, aLast = -1; PartSet_Tools::getFirstAndLastIndexInFolder(myObject, aFirst, aLast); @@ -1167,7 +1138,7 @@ QTreeNodesList PartSet_ObjectFolderNode::objectCreated(const QObjectPtrList& /*t } DocumentPtr aDoc = myObject->document(); // Add new nodes - ModuleBase_ITreeNode* aNode; + ModuleBase_ITreeNode *aNode; for (int i = 0; i < aNbItems; i++) { ObjectPtr aObj = aDoc->object(ModelAPI_Feature::group(), aFirst + i); if (i < myChildren.size()) { @@ -1187,9 +1158,9 @@ QTreeNodesList PartSet_ObjectFolderNode::objectCreated(const QObjectPtrList& /*t return aResult; } -QTreeNodesList PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr& /*theDoc*/, - const QString& /*theGroup*/) -{ +QTreeNodesList +PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr & /*theDoc*/, + const QString & /*theGroup*/) { QTreeNodesList aResult; int aFirst = -1, aLast = -1; PartSet_Tools::getFirstAndLastIndexInFolder(myObject, aFirst, aLast); @@ -1209,16 +1180,16 @@ QTreeNodesList PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr& /*the int aId = 0; int aNbOfFeatures = aDoc->size(ModelAPI_Feature::group(), true); while (aId < myChildren.size()) { - ModuleBase_ITreeNode* aNode = myChildren.at(aId); + ModuleBase_ITreeNode *aNode = myChildren.at(aId); if ((aFirst + aId) < aNbOfFeatures) { - if (aNode->object() != aDoc->object(ModelAPI_Feature::group(), aFirst + aId)) { + if (aNode->object() != + aDoc->object(ModelAPI_Feature::group(), aFirst + aId)) { myChildren.removeAll(aNode); delete aNode; aRemoved = true; continue; } - } - else { + } else { myChildren.removeAll(aNode); aResult.removeAll(aNode); delete aNode; @@ -1233,39 +1204,37 @@ QTreeNodesList PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr& /*the return aResult; } -QVariant PartSet_ObjectFolderNode::data(int theColumn, int theRole) const -{ +QVariant PartSet_ObjectFolderNode::data(int theColumn, int theRole) const { if (theRole == Qt::ForegroundRole) { if (!myObject->isDisabled()) { - std::vector aColor = - Config_PropManager::color("Visualization", "feature_objectbrowser_color"); + std::vector aColor = Config_PropManager::color( + "Visualization", "feature_objectbrowser_color"); return QColor(aColor[0], aColor[1], aColor[2]); } } return PartSet_ObjectNode::data(theColumn, theRole); - } ////////////////////////////////////////////////////////////////////////////////// -QVariant PartSet_StepNode::data(int theColumn, int theRole) const -{ +QVariant PartSet_StepNode::data(int theColumn, int theRole) const { if ((theColumn == 1) && (theRole == Qt::DisplayRole)) { FieldStepPtr aStep = - std::dynamic_pointer_cast(myObject); + std::dynamic_pointer_cast( + myObject); return "Step " + QString::number(aStep->id() + 1) + " " + - aStep->field()->textLine(aStep->id()).c_str(); + aStep->field()->textLine(aStep->id()).c_str(); } return PartSet_ObjectNode::data(theColumn, theRole); } -ModuleBase_ITreeNode::VisibilityState PartSet_StepNode::visibilityState() const -{ +ModuleBase_ITreeNode::VisibilityState +PartSet_StepNode::visibilityState() const { Qt::ItemFlags aFlags = flags(1); if (aFlags == Qt::ItemFlags()) return NoneState; - ModuleBase_IWorkshop* aWork = workshop(); + ModuleBase_IWorkshop *aWork = workshop(); if (aWork->isVisible(myObject)) return Visible; else diff --git a/src/PartSet/PartSet_TreeNodes.h b/src/PartSet/PartSet_TreeNodes.h index d666c0731..f4ca9b9e0 100644 --- a/src/PartSet/PartSet_TreeNodes.h +++ b/src/PartSet/PartSet_TreeNodes.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_TreeNodes_H @@ -22,18 +23,17 @@ #include "PartSet.h" -#include #include - +#include /** -* \ingroup Modules -* Implementation of base node for the module data tree -*/ -class PartSet_TreeNode : public ModuleBase_ITreeNode -{ + * \ingroup Modules + * Implementation of base node for the module data tree + */ +class PartSet_TreeNode : public ModuleBase_ITreeNode { public: - PartSet_TreeNode(ModuleBase_ITreeNode* theParent = 0) : ModuleBase_ITreeNode(theParent) {} + PartSet_TreeNode(ModuleBase_ITreeNode *theParent = 0) + : ModuleBase_ITreeNode(theParent) {} /// Returns the node representation according to theRole. virtual QVariant data(int theColumn, int theRole) const; @@ -43,17 +43,16 @@ public: }; /** -* \ingroup Modules -* Implementation of a node for object repesentation -*/ -class PartSet_ObjectNode : public PartSet_TreeNode -{ + * \ingroup Modules + * Implementation of a node for object repesentation + */ +class PartSet_ObjectNode : public PartSet_TreeNode { public: - PartSet_ObjectNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent = 0) - : PartSet_TreeNode(theParent), myObject(theObj) {} + PartSet_ObjectNode(const ObjectPtr &theObj, + ModuleBase_ITreeNode *theParent = 0) + : PartSet_TreeNode(theParent), myObject(theObj) {} - static std::string typeId() - { + static std::string typeId() { static std::string myType = "Object"; return myType; } @@ -81,12 +80,13 @@ public: /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects); + virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup); + virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup); /// Returns number of sub-objects of the current object virtual int numberOfSubs() const; @@ -101,11 +101,10 @@ protected: }; /** -* \ingroup Modules -* Implementation of aFolder node in data tree -*/ -class PartSet_FolderNode : public PartSet_TreeNode -{ + * \ingroup Modules + * Implementation of aFolder node in data tree + */ +class PartSet_FolderNode : public PartSet_TreeNode { public: enum FolderType { ParametersFolder, @@ -116,10 +115,9 @@ public: GroupsFolder }; - PartSet_FolderNode(ModuleBase_ITreeNode* theParent, FolderType theType); + PartSet_FolderNode(ModuleBase_ITreeNode *theParent, FolderType theType); - static std::string typeId() - { + static std::string typeId() { static std::string myType = "Folder"; return myType; } @@ -138,21 +136,21 @@ public: /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects); + virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup); + virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup); QString name() const; - /// Returns a node which belongs to the given document and contains objects of the given group - /// \param theDoc a document - /// \param theGroup a name of objects group - /// \return a parent node if it is found - virtual ModuleBase_ITreeNode* findParent(const DocumentPtr& theDoc, QString theGroup) - { + /// Returns a node which belongs to the given document and contains objects of + /// the given group \param theDoc a document \param theGroup a name of objects + /// group \return a parent node if it is found + virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, + QString theGroup) { if ((theDoc == document()) && (theGroup.toStdString() == groupName())) return this; return 0; @@ -161,56 +159,54 @@ public: private: std::string groupName() const; - ModuleBase_ITreeNode* createNode(const ObjectPtr& theObj); + ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj); FolderType myType; }; ///////////////////////////////////////////////////////////////////// /** -* \ingroup Modules -* A base class for root folders -*/ -class PartSet_FeatureFolderNode : public PartSet_TreeNode -{ + * \ingroup Modules + * A base class for root folders + */ +class PartSet_FeatureFolderNode : public PartSet_TreeNode { public: - PartSet_FeatureFolderNode(ModuleBase_ITreeNode* theParent = 0) : PartSet_TreeNode(theParent) {} + PartSet_FeatureFolderNode(ModuleBase_ITreeNode *theParent = 0) + : PartSet_TreeNode(theParent) {} /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects); + virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup); + virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup); - /// Returns a node which belongs to the given document and contains objects of the given group - /// \param theDoc a document - /// \param theGroup a name of objects group - /// \return a parent node if it is found - virtual ModuleBase_ITreeNode* findParent(const DocumentPtr& theDoc, QString theGroup); + /// Returns a node which belongs to the given document and contains objects of + /// the given group \param theDoc a document \param theGroup a name of objects + /// group \return a parent node if it is found + virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, + QString theGroup); protected: - virtual ModuleBase_ITreeNode* createNode(const ObjectPtr& theObj) = 0; + virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) = 0; virtual int numberOfFolders() const { return 0; } }; - ///////////////////////////////////////////////////////////////////// /** -* \ingroup Modules -* Implementation of Root node in data tree -*/ -class PartSet_RootNode : public PartSet_FeatureFolderNode -{ + * \ingroup Modules + * Implementation of Root node in data tree + */ +class PartSet_RootNode : public PartSet_FeatureFolderNode { public: PartSet_RootNode(); - static std::string typeId() - { + static std::string typeId() { static std::string myType = "PartSetRoot"; return myType; } @@ -220,38 +216,37 @@ public: /// Updates sub-nodes of the node virtual void update(); - virtual ModuleBase_IWorkshop* workshop() const { return myWorkshop; } + virtual ModuleBase_IWorkshop *workshop() const { return myWorkshop; } /// Returns document object of the sub-tree. virtual DocumentPtr document() const; - void setWorkshop(ModuleBase_IWorkshop* theWork) { myWorkshop = theWork; } + void setWorkshop(ModuleBase_IWorkshop *theWork) { myWorkshop = theWork; } protected: - virtual ModuleBase_ITreeNode* createNode(const ObjectPtr& theObj); + virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj); virtual int numberOfFolders() const { return 3; } private: - PartSet_FolderNode* myParamsFolder; - PartSet_FolderNode* myConstrFolder; - PartSet_FolderNode* myPartsFolder; + PartSet_FolderNode *myParamsFolder; + PartSet_FolderNode *myConstrFolder; + PartSet_FolderNode *myPartsFolder; - ModuleBase_IWorkshop* myWorkshop; + ModuleBase_IWorkshop *myWorkshop; }; ///////////////////////////////////////////////////////////////////// /** -* \ingroup Modules -* Implementation of Root node of a Part document in data tree -*/ -class PartSet_PartRootNode : public PartSet_FeatureFolderNode -{ + * \ingroup Modules + * Implementation of Root node of a Part document in data tree + */ +class PartSet_PartRootNode : public PartSet_FeatureFolderNode { public: - PartSet_PartRootNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent); + PartSet_PartRootNode(const ObjectPtr &theObj, + ModuleBase_ITreeNode *theParent); - static std::string typeId() - { + static std::string typeId() { static std::string myType = "PartRoot"; return myType; } @@ -276,43 +271,43 @@ public: /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects); + virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup); + virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup); protected: - virtual ModuleBase_ITreeNode* createNode(const ObjectPtr& theObj); + virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj); virtual int numberOfFolders() const; virtual void deleteChildren(); private: - PartSet_FolderNode* myParamsFolder; - PartSet_FolderNode* myConstrFolder; - PartSet_FolderNode* myResultsFolder; - PartSet_FolderNode* myFieldsFolder; - PartSet_FolderNode* myGroupsFolder; + PartSet_FolderNode *myParamsFolder; + PartSet_FolderNode *myConstrFolder; + PartSet_FolderNode *myResultsFolder; + PartSet_FolderNode *myFieldsFolder; + PartSet_FolderNode *myGroupsFolder; ObjectPtr myObject; }; ///////////////////////////////////////////////////////////////////// /** -* \ingroup Modules -* Implementation of a folder which corresponds to ModelAPI_Folder object -*/ -class PartSet_ObjectFolderNode : public PartSet_ObjectNode -{ + * \ingroup Modules + * Implementation of a folder which corresponds to ModelAPI_Folder object + */ +class PartSet_ObjectFolderNode : public PartSet_ObjectNode { public: - PartSet_ObjectFolderNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent) - : PartSet_ObjectNode(theObj, theParent) {} + PartSet_ObjectFolderNode(const ObjectPtr &theObj, + ModuleBase_ITreeNode *theParent) + : PartSet_ObjectNode(theObj, theParent) {} - static std::string typeId() - { + static std::string typeId() { static std::string myType = "ObjectFolder"; return myType; } @@ -325,31 +320,29 @@ public: /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects); + virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup); + virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup); /// Returns the node representation according to theRole. virtual QVariant data(int theColumn, int theRole) const; }; - ///////////////////////////////////////////////////////////////////// /** -* \ingroup Modules -* Implementation of a node for compsolid representation -*/ -class PartSet_StepNode : public PartSet_ObjectNode -{ + * \ingroup Modules + * Implementation of a node for compsolid representation + */ +class PartSet_StepNode : public PartSet_ObjectNode { public: - PartSet_StepNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent) : - PartSet_ObjectNode(theObj, theParent) {} + PartSet_StepNode(const ObjectPtr &theObj, ModuleBase_ITreeNode *theParent) + : PartSet_ObjectNode(theObj, theParent) {} - static std::string typeId() - { + static std::string typeId() { static std::string myType = "FieldStep"; return myType; } diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 40b19326a..3a03222a6 100644 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -14,44 +14,45 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_Validators.h" -#include "PartSet_Tools.h" #include "PartSet_SketcherMgr.h" +#include "PartSet_Tools.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 @@ -61,14 +62,14 @@ #include #endif -int shapesNbPoints(const ModuleBase_ISelection* theSelection) -{ - QList aList = theSelection->getSelected(ModuleBase_ISelection::Viewer); +int shapesNbPoints(const ModuleBase_ISelection *theSelection) { + QList aList = + theSelection->getSelected(ModuleBase_ISelection::Viewer); ModuleBase_ISelection::filterSelectionOnEqualPoints(aList); int aCount = 0; foreach (ModuleBase_ViewerPrsPtr aPrs, aList) { - const GeomShapePtr& aShape = aPrs->shape(); + const GeomShapePtr &aShape = aPrs->shape(); if (aShape.get() && !aShape->isNull()) { if (aShape->shapeType() == GeomAPI_Shape::VERTEX) aCount++; @@ -79,15 +80,16 @@ int shapesNbPoints(const ModuleBase_ISelection* theSelection) typedef std::unordered_map ShapeQuantity; -int shapesNbEdges(const ModuleBase_ISelection* theSelection, ShapeQuantity& theEdges) -{ - QList aList = theSelection->getSelected(ModuleBase_ISelection::Viewer); +int shapesNbEdges(const ModuleBase_ISelection *theSelection, + ShapeQuantity &theEdges) { + QList aList = + theSelection->getSelected(ModuleBase_ISelection::Viewer); int aCount = 0; - foreach(ModuleBase_ViewerPrsPtr aPrs, aList) { - const GeomShapePtr& aShape = aPrs->shape(); + foreach (ModuleBase_ViewerPrsPtr aPrs, aList) { + const GeomShapePtr &aShape = aPrs->shape(); if (aShape.get() && !aShape->isNull()) { if (aShape->shapeType() == GeomAPI_Shape::EDGE) { - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); TopoDS_Edge aEdge = TopoDS::Edge(aTDShape); Standard_Real aStart, aEnd; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aEdge, aStart, aEnd); @@ -100,16 +102,15 @@ int shapesNbEdges(const ModuleBase_ISelection* theSelection, ShapeQuantity& theE return aCount; } - -std::shared_ptr sketcherPlane(ModuleBase_Operation* theOperation) -{ +std::shared_ptr sketcherPlane(ModuleBase_Operation *theOperation) { std::shared_ptr aEmptyPln; if (theOperation) { - ModuleBase_OperationFeature* aFeatureOp = - dynamic_cast(theOperation); + ModuleBase_OperationFeature *aFeatureOp = + dynamic_cast(theOperation); if (aFeatureOp) { CompositeFeaturePtr aFeature = - std::dynamic_pointer_cast(aFeatureOp->feature()); + std::dynamic_pointer_cast( + aFeatureOp->feature()); if (aFeature && (aFeature->getKind() == SketchPlugin_Sketch::ID())) return PartSet_Tools::sketchPlane(aFeature); } @@ -117,32 +118,29 @@ std::shared_ptr sketcherPlane(ModuleBase_Operation* theOperation) return aEmptyPln; } - -bool isEmptySelectionValid(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* aFeatureOp = - dynamic_cast(theOperation); +bool isEmptySelectionValid(ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *aFeatureOp = + dynamic_cast(theOperation); // during the create operation empty selection is always valid if (!aFeatureOp->isEditOperation()) { return true; - } - else { + } else { if (PartSet_SketcherMgr::isSketchOperation(aFeatureOp)) { std::shared_ptr aPlane = sketcherPlane(theOperation); if (aPlane.get()) return true; else return false; - } - else - // in edit operation an empty selection is always valid, performed for re-entrant operrations + } else + // in edit operation an empty selection is always valid, performed for + // re-entrant operrations return true; } } -bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_DistanceSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { @@ -154,66 +152,69 @@ bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelectio } } -bool PartSet_LengthSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_LengthSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && (aShapes[GeomAbs_Line] == aNbEdges && aNbEdges == 1); + return aNbPoints == 0 && + (aShapes[GeomAbs_Line] == aNbEdges && aNbEdges == 1); } } -bool PartSet_PerpendicularSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_PerpendicularSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && aNbEdges > 0 && aNbEdges < 3; + return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && + aNbEdges > 0 && aNbEdges < 3; } } -bool PartSet_ParallelSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_ParallelSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && aNbEdges > 0 && aNbEdges < 3; + return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && + aNbEdges > 0 && aNbEdges < 3; } } -bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_RadiusSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && (aShapes[GeomAbs_Circle] == aNbEdges && aNbEdges == 1); + return aNbPoints == 0 && + (aShapes[GeomAbs_Circle] == aNbEdges && aNbEdges == 1); } } -bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { QList aList = - theSelection->getSelected(ModuleBase_ISelection::Viewer); + theSelection->getSelected(ModuleBase_ISelection::Viewer); int aCount = 0; foreach (ModuleBase_ViewerPrsPtr aPrs, aList) { ObjectPtr aObj = aPrs->object(); @@ -230,10 +231,9 @@ bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, } } - -bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_CoincidentSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { @@ -245,22 +245,22 @@ bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelect } } -bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && (aShapes[GeomAbs_Line] == aNbEdges && aNbEdges == 1); + return aNbPoints == 0 && + (aShapes[GeomAbs_Line] == aNbEdges && aNbEdges == 1); } } -bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_FilletSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { @@ -271,35 +271,35 @@ bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_TangentSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && (aNbEdges == 1 || (aNbEdges == 2 && aShapes[GeomAbs_Line] == 1)); + return aNbPoints == 0 && + (aNbEdges == 1 || (aNbEdges == 2 && aShapes[GeomAbs_Line] == 1)); } } -bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && aNbEdges > 0 && aNbEdges < 3; + return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && + aNbEdges > 0 && aNbEdges < 3; } } -bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { @@ -313,22 +313,23 @@ bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_CollinearSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { int aNbPoints = shapesNbPoints(theSelection); ShapeQuantity aShapes; int aNbEdges = shapesNbEdges(theSelection, aShapes); - return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && aNbEdges > 0 && aNbEdges < 3; + return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && + aNbEdges > 0 && aNbEdges < 3; } } -bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_MiddlePointSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) return isEmptySelectionValid(theOperation); else { @@ -339,9 +340,9 @@ bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelec } } -bool PartSet_MultyTranslationSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_MultyTranslationSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { @@ -351,9 +352,8 @@ bool PartSet_MultyTranslationSelection::isValid(const ModuleBase_ISelection* the } } -bool PartSet_SplitSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_SplitSelection::isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { @@ -363,119 +363,125 @@ bool PartSet_SplitSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_ProjectionSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_ProjectionSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { return theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0 && isEmptySelectionValid(theOperation); } -bool PartSet_IntersectionSelection::isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const -{ +bool PartSet_IntersectionSelection::isValid( + const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const { return theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0 && isEmptySelectionValid(theOperation); } - std::string PartSet_DifferentObjectsValidator::errorMessage( - const PartSet_DifferentObjectsValidator::ErrorType& theType, - const std::string& thEqualObject, const std::string& theFirstAttribute, - const std::string& theSecondAttribute) const -{ + const PartSet_DifferentObjectsValidator::ErrorType &theType, + const std::string &thEqualObject, const std::string &theFirstAttribute, + const std::string &theSecondAttribute) const { std::string anError; switch (theType) { - case EqualObjects: - anError = "The feature uses one " + thEqualObject + " object in " + - theFirstAttribute + " and " + theSecondAttribute + " attributes."; - break; - case EqualAttributes: - anError = "The feature uses reference to one " + thEqualObject + " attribute in " + - theFirstAttribute + " and " + theSecondAttribute + " attributes."; - break; - case EqualShapes: - anError = "The feature uses one shape in " + - theFirstAttribute + " and " + theSecondAttribute + " attributes."; - break; - case EmptyShapes: - anError = "The feature uses empty shapes in " + - theFirstAttribute + " and " + theSecondAttribute + " attributes."; - break; - break; - default: - break; + case EqualObjects: + anError = "The feature uses one " + thEqualObject + " object in " + + theFirstAttribute + " and " + theSecondAttribute + " attributes."; + break; + case EqualAttributes: + anError = "The feature uses reference to one " + thEqualObject + + " attribute in " + theFirstAttribute + " and " + + theSecondAttribute + " attributes."; + break; + case EqualShapes: + anError = "The feature uses one shape in " + theFirstAttribute + " and " + + theSecondAttribute + " attributes."; + break; + case EmptyShapes: + anError = "The feature uses empty shapes in " + theFirstAttribute + + " and " + theSecondAttribute + " attributes."; + break; + break; + default: + break; } return anError; } -bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); +bool PartSet_DifferentObjectsValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); // the type of validated attributes should be equal, attributes with // different types are not validated // Check RefAttr attributes std::string anAttrType = theAttribute->attributeType(); - std::list > anAttrs; + std::list> anAttrs; if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr anAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); bool isObject = anAttr->isObject(); ObjectPtr anObject = anAttr->object(); anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); if (anAttrs.size() > 0) { - std::list >::iterator anAttrIter = anAttrs.begin(); - for(; anAttrIter != anAttrs.end(); anAttrIter++) { - if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) { + std::list>::iterator anAttrIter = + anAttrs.begin(); + for (; anAttrIter != anAttrs.end(); anAttrIter++) { + if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) { std::shared_ptr aRef = - std::dynamic_pointer_cast(*anAttrIter); + std::dynamic_pointer_cast(*anAttrIter); if (aRef->isObject() != isObject) continue; if (isObject) { if (aRef->object() == anObject) { - theError = errorMessage(EqualObjects, - anObject.get() ? Locale::Convert::toString(anObject->data()->name()) : "", - theAttribute->id(), aRef->id()); + theError = errorMessage( + EqualObjects, + anObject.get() + ? Locale::Convert::toString(anObject->data()->name()) + : "", + theAttribute->id(), aRef->id()); return false; } - } - else { // the attribute reference + } else { // the attribute reference AttributePtr anAttributeAttr = anAttr->attr(); if (aRef->attr() == anAttributeAttr) { - theError = errorMessage(EqualAttributes, - anAttributeAttr.get() ? anAttributeAttr->id() : "", - theAttribute->id(), aRef->id()); + theError = errorMessage( + EqualAttributes, + anAttributeAttr.get() ? anAttributeAttr->id() : "", + theAttribute->id(), aRef->id()); return false; } } } } } - } - else if (anAttrType == ModelAPI_AttributeSelection::typeId()) { + } else if (anAttrType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttrSel = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttrSel->context(); FeaturePtr aContextFeature = anAttrSel->contextFeature(); GeomShapePtr aShape = anAttrSel->value(); // Check selection attributes - anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); + anAttrs = + aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); if (anAttrs.size() > 0) { - std::list >::iterator anAttr = anAttrs.begin(); - for(; anAttr != anAttrs.end(); anAttr++) { + std::list>::iterator anAttr = + anAttrs.begin(); + for (; anAttr != anAttrs.end(); anAttr++) { if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) { std::shared_ptr aRef = - std::dynamic_pointer_cast(*anAttr); + std::dynamic_pointer_cast(*anAttr); // check the object is already presented if (aRef->context() == aContext) { bool aHasShape = aShape.get() != NULL; if (!aHasShape || aRef->value()->isEqual(aShape)) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); + theError = + errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); return false; } } @@ -483,90 +489,110 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute if (aContextFeature.get()) { if (aRef->contextFeature().get()) { if (aContextFeature == aRef->contextFeature()) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); + theError = errorMessage(EqualShapes, "", theAttribute->id(), + aRef->id()); return false; } } else if (aRef->context().get() && - aRef->context()->document()->feature(aRef->context()) == aContextFeature) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); + aRef->context()->document()->feature(aRef->context()) == + aContextFeature) { + theError = + errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); return false; } } else if (aRef->contextFeature().get() && aContext.get()) { - if (aContext->document()->feature(aContext) == aRef->contextFeature()) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); + if (aContext->document()->feature(aContext) == + aRef->contextFeature()) { + theError = + errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); return false; } } } } } - } - else if (anAttrType == ModelAPI_AttributeReference::typeId()) { + } else if (anAttrType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttrRef = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); ObjectPtr anObject = anAttrRef->value(); // Check selection attributes - anAttrs = aFeature->data()->attributes(ModelAPI_AttributeReference::typeId()); + anAttrs = + aFeature->data()->attributes(ModelAPI_AttributeReference::typeId()); if (anAttrs.size() > 0) { - std::list >::iterator anAttr = anAttrs.begin(); - for(; anAttr != anAttrs.end(); anAttr++) { + std::list>::iterator anAttr = + anAttrs.begin(); + for (; anAttr != anAttrs.end(); anAttr++) { if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) { std::shared_ptr aRef = - std::dynamic_pointer_cast(*anAttr); + std::dynamic_pointer_cast(*anAttr); // check the object is already presented if (aRef->value() == anObject) { - theError = errorMessage(EqualObjects, - anObject.get() ? Locale::Convert::toString(anObject->data()->name()) : "", - theAttribute->id(), aRef->id()); + theError = errorMessage( + EqualObjects, + anObject.get() + ? Locale::Convert::toString(anObject->data()->name()) + : "", + theAttribute->id(), aRef->id()); return false; } } } return true; } - } - else if(anAttrType == ModelAPI_AttributeSelectionList::typeId()) { + } else if (anAttrType == ModelAPI_AttributeSelectionList::typeId()) { std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(theAttribute); - anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); - if(anAttrs.size() > 0) { - std::list>::iterator anAttrItr = anAttrs.begin(); - for(; anAttrItr != anAttrs.end(); anAttrItr++){ - if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()){ + std::dynamic_pointer_cast( + theAttribute); + anAttrs = + aFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); + if (anAttrs.size() > 0) { + std::list>::iterator anAttrItr = + anAttrs.begin(); + for (; anAttrItr != anAttrs.end(); anAttrItr++) { + if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()) { std::shared_ptr aRefSelList = - std::dynamic_pointer_cast(*anAttrItr); - for(int i = 0; i < aCurSelList->size(); i++) { - std::shared_ptr aCurSel = aCurSelList->value(i); + std::dynamic_pointer_cast( + *anAttrItr); + for (int i = 0; i < aCurSelList->size(); i++) { + std::shared_ptr aCurSel = + aCurSelList->value(i); ResultPtr aCurSelContext = aCurSel->context(); FeaturePtr aCurSelFeature = aCurSel->contextFeature(); - ResultBodyPtr aCurSelCompSolidPtr = ModelAPI_Tools::bodyOwner(aCurSelContext); + ResultBodyPtr aCurSelCompSolidPtr = + ModelAPI_Tools::bodyOwner(aCurSelContext); std::shared_ptr aCurSelCompSolid; - if(aCurSelCompSolidPtr.get()) { + if (aCurSelCompSolidPtr.get()) { aCurSelCompSolid = aCurSelCompSolidPtr->shape(); } - for(int j = 0; j < aRefSelList->size(); j++) { - std::shared_ptr aRefSel = aRefSelList->value(j); + for (int j = 0; j < aRefSelList->size(); j++) { + std::shared_ptr aRefSel = + aRefSelList->value(j); ResultPtr aRefSelContext = aRefSel->context(); FeaturePtr aRefSelFeature = aRefSel->contextFeature(); ResultBodyPtr aRefSelCompSolidPtr = - ModelAPI_Tools::bodyOwner(aRefSelContext); + ModelAPI_Tools::bodyOwner(aRefSelContext); std::shared_ptr aRefSelCompSolid; if (aRefSelCompSolidPtr.get()) { aRefSelCompSolid = aRefSelCompSolidPtr->shape(); } - if ((aCurSelCompSolid.get() && aCurSelCompSolid->isEqual(aRefSel->value())) - || (aRefSelCompSolid.get() && aRefSelCompSolid->isEqual(aCurSel->value()))) { + if ((aCurSelCompSolid.get() && + aCurSelCompSolid->isEqual(aRefSel->value())) || + (aRefSelCompSolid.get() && + aRefSelCompSolid->isEqual(aCurSel->value()))) { theError = errorMessage(EqualShapes, "", theAttribute->id(), - aRefSel->id()); + aRefSel->id()); return false; } if (aCurSelContext == aRefSelContext) { - if (aCurSel->value().get() == NULL || aRefSel->value().get() == NULL) { - theError = errorMessage(EmptyShapes, "", theAttribute->id(), aRefSel->id()); + if (aCurSel->value().get() == NULL || + aRefSel->value().get() == NULL) { + theError = errorMessage(EmptyShapes, "", theAttribute->id(), + aRefSel->id()); return false; } if (aCurSel->value()->isEqual(aRefSel->value())) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRefSel->id()); + theError = errorMessage(EqualShapes, "", theAttribute->id(), + aRefSel->id()); return false; } } @@ -575,19 +601,22 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute if (aCurSelFeature.get()) { if (aRefSelFeature.get()) { if (aCurSelFeature == aRefSelFeature) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRefSel->id()); + theError = errorMessage(EqualShapes, "", theAttribute->id(), + aRefSel->id()); return false; } - } - else if (aRefSelContext.get() && - aRefSelContext->document()->feature(aRefSelContext) == aCurSelFeature) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRefSel->id()); + } else if (aRefSelContext.get() && + aRefSelContext->document()->feature( + aRefSelContext) == aCurSelFeature) { + theError = errorMessage(EqualShapes, "", theAttribute->id(), + aRefSel->id()); return false; } - } - else if (aRefSelFeature.get() && aCurSelContext.get()) { - if (aCurSelContext->document()->feature(aCurSelContext) == aRefSelFeature) { - theError = errorMessage(EqualShapes, "", theAttribute->id(), aRefSel->id()); + } else if (aRefSelFeature.get() && aCurSelContext.get()) { + if (aCurSelContext->document()->feature(aCurSelContext) == + aRefSelFeature) { + theError = errorMessage(EqualShapes, "", theAttribute->id(), + aRefSel->id()); return false; } } @@ -596,25 +625,27 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute } } } - } - else if (anAttrType == ModelAPI_AttributeRefList::typeId()) { + } else if (anAttrType == ModelAPI_AttributeRefList::typeId()) { std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefList::typeId()); if (anAttrs.size() > 0) { - std::list>::iterator anAttrItr = anAttrs.begin(); - for (; anAttrItr != anAttrs.end(); anAttrItr++){ - if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()){ + std::list>::iterator anAttrItr = + anAttrs.begin(); + for (; anAttrItr != anAttrs.end(); anAttrItr++) { + if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()) { std::shared_ptr aRefSelList = - std::dynamic_pointer_cast(*anAttrItr); + std::dynamic_pointer_cast(*anAttrItr); for (int i = 0; i < aCurSelList->size(); i++) { ObjectPtr aCurSelObject = aCurSelList->object(i); for (int j = 0; j < aRefSelList->size(); j++) { if (aCurSelObject == aRefSelList->object(j)) { theError = errorMessage(EqualObjects, - aCurSelObject.get()? - Locale::Convert::toString(aCurSelObject->data()->name()) : "", - theAttribute->id(), aCurSelList->id()); + aCurSelObject.get() + ? Locale::Convert::toString( + aCurSelObject->data()->name()) + : "", + theAttribute->id(), aCurSelList->id()); return false; } } @@ -626,17 +657,18 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute return true; } -bool PartSet_DifferentPointsValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); +bool PartSet_DifferentPointsValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); // the type of validated attributes should be equal, attributes with // different types are not validated // Check RefAttr attributes std::string anAttrType = theAttribute->attributeType(); - std::list > anAttrs; + std::list> anAttrs; if (anAttrType != ModelAPI_AttributeRefAttr::typeId()) return true; @@ -646,8 +678,8 @@ bool PartSet_DifferentPointsValidator::isValid(const AttributePtr& theAttribute, return true; // obtain point of the parameter attribute - AttributePoint2DPtr anArgumentPoint = getRefPointAttribute - (aFeature->attribute(theArguments.front())); + AttributePoint2DPtr anArgumentPoint = + getRefPointAttribute(aFeature->attribute(theArguments.front())); if (!anArgumentPoint.get() || !anArgumentPoint->isInitialized()) return true; @@ -655,42 +687,44 @@ bool PartSet_DifferentPointsValidator::isValid(const AttributePtr& theAttribute, return !anAttributePoint->pnt()->isEqual(anArgumentPoint->pnt()); } -AttributePoint2DPtr PartSet_DifferentPointsValidator::getRefPointAttribute - (const AttributePtr& theAttribute) const -{ - AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); +AttributePoint2DPtr PartSet_DifferentPointsValidator::getRefPointAttribute( + const AttributePtr &theAttribute) const { + AttributeRefAttrPtr anAttr = + std::dynamic_pointer_cast(theAttribute); AttributePoint2DPtr aPointAttribute; if (anAttr->isObject()) { - ObjectPtr anObject = anAttr->object(); + ObjectPtr anObject = anAttr->object(); if (anObject.get()) { FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); if (aFeature->getKind() == SketchPlugin_Point::ID()) - aPointAttribute = std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_Point::COORD_ID())); + aPointAttribute = std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Point::COORD_ID())); } - } - else { - aPointAttribute = std::dynamic_pointer_cast(anAttr->attr()); + } else { + aPointAttribute = + std::dynamic_pointer_cast(anAttr->attr()); } return aPointAttribute; } -bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool PartSet_CoincidentAttr::isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - // there is a check whether the feature contains a point and a linear edge or two point values + // there is a check whether the feature contains a point and a linear edge or + // two point values std::string aParamA = theArguments.front(); - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); QList aCoinsideLines; QList aCoins; @@ -708,28 +742,34 @@ bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute, // check that both have coincidence FeaturePtr aConstrFeature; std::set aCoinList; - const std::set>& aRefsList = aRefFea->data()->refsToMe(); + const std::set> &aRefsList = + aRefFea->data()->refsToMe(); std::set>::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); - if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { - AttributeRefAttrPtr aRAttr = std::dynamic_pointer_cast(aAttr); + aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); + if (aConstrFeature->getKind() == + SketchPlugin_ConstraintCoincidence::ID()) { + AttributeRefAttrPtr aRAttr = + std::dynamic_pointer_cast(aAttr); AttributePtr aAR = aRAttr->attr(); - if (aAR->id() != SketchPlugin_Arc::CENTER_ID()) // ignore constraint to center of arc + if (aAR->id() != + SketchPlugin_Arc::CENTER_ID()) // ignore constraint to center of arc aCoinList.insert(aConstrFeature); QList anIsAttributes; - PartSet_Tools::findCoincidences(aConstrFeature, aCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), - anIsAttributes); - PartSet_Tools::findCoincidences(aConstrFeature, aCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), - anIsAttributes); + PartSet_Tools::findCoincidences( + aConstrFeature, aCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_A(), anIsAttributes); + PartSet_Tools::findCoincidences( + aConstrFeature, aCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_B(), anIsAttributes); } } // if there is no coincidence then it is not valid if (aCoinList.size() > 0) { - QList::const_iterator anIt = aCoinsideLines.begin(), aLast = aCoinsideLines.end(); + QList::const_iterator anIt = aCoinsideLines.begin(), + aLast = aCoinsideLines.end(); bool aValid = false; for (; anIt != aLast && !aValid; anIt++) { aValid = *anIt == aOtherFea; diff --git a/src/PartSet/PartSet_Validators.h b/src/PartSet/PartSet_Validators.h index 00098ba76..994145c9b 100644 --- a/src/PartSet/PartSet_Validators.h +++ b/src/PartSet/PartSet_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_Validators_H @@ -22,9 +23,9 @@ #include "PartSet.h" -#include -#include #include +#include +#include class GeomDataAPI_Point2D; @@ -32,248 +33,224 @@ class GeomDataAPI_Point2D; * Selector validators */ - //! \ingroup Validators //! A class to validate a selection for Distance constraint operation -class PartSet_DistanceSelection : public ModuleBase_SelectionValidator -{ +class PartSet_DistanceSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Length constraint operation -class PartSet_LengthSelection : public ModuleBase_SelectionValidator -{ +class PartSet_LengthSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Perpendicular constraint operation -class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator -{ +class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Parallel constraint operation -class PartSet_ParallelSelection : public ModuleBase_SelectionValidator -{ +class PartSet_ParallelSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Radius constraint operation -class PartSet_RadiusSelection : public ModuleBase_SelectionValidator -{ +class PartSet_RadiusSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Rigid constraint operation -class PartSet_RigidSelection : public ModuleBase_SelectionValidator -{ +class PartSet_RigidSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; - //! \ingroup Validators //! A class to validate a selection for coincedence constraint operation -class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator -{ +class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators -//! A class to validate a selection for Horizontal and Vertical constraints operation -class PartSet_HVDirSelection : public ModuleBase_SelectionValidator -{ +//! A class to validate a selection for Horizontal and Vertical constraints +//! operation +class PartSet_HVDirSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Tangential constraints operation -class PartSet_TangentSelection : public ModuleBase_SelectionValidator -{ +class PartSet_TangentSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Fillet constraints operation -class PartSet_FilletSelection : public ModuleBase_SelectionValidator -{ +class PartSet_FilletSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Angle constraints operation -class PartSet_AngleSelection : public ModuleBase_SelectionValidator -{ +class PartSet_AngleSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Equal constraints operation -class PartSet_EqualSelection : public ModuleBase_SelectionValidator -{ +class PartSet_EqualSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Collinear constraints operation -class PartSet_CollinearSelection : public ModuleBase_SelectionValidator -{ +class PartSet_CollinearSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation -class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator -{ +class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation -class PartSet_MultyTranslationSelection : public ModuleBase_SelectionValidator -{ +class PartSet_MultyTranslationSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation -class PartSet_SplitSelection : public ModuleBase_SelectionValidator -{ +class PartSet_SplitSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation -class PartSet_ProjectionSelection : public ModuleBase_SelectionValidator -{ +class PartSet_ProjectionSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; //! \ingroup Validators //! A class to validate a selection for intersection operation -class PartSet_IntersectionSelection : public ModuleBase_SelectionValidator -{ +class PartSet_IntersectionSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, - ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const; }; ////////////// Attribute validators //////////////// - /** -* \ingroup Validators -* A validator which checks that objects selected for feature attributes are different (not the same) -*/ -class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator -{ + * \ingroup Validators + * A validator which checks that objects selected for feature attributes are + * different (not the same) + */ +class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator { //! Validator possible error types - enum ErrorType { - EqualObjects, - EqualAttributes, - EqualShapes, - EmptyShapes - }; - public: + enum ErrorType { EqualObjects, EqualAttributes, EqualShapes, EmptyShapes }; + +public: //! Returns true if the attribute is good for the feature attribute //! \param theAttribute an attribute //! \param theArguments a list of arguments (names of attributes to check) //! \param theError an output error string - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; + private: //! Returns error message for the error type //! \param theType a type of error //! \param thEqualObjectInfo an - std::string errorMessage(const PartSet_DifferentObjectsValidator::ErrorType& theType, - const std::string& thEqualObject, const std::string& theFirstAttribute, - const std::string& theSecondAttribute) const; - + std::string + errorMessage(const PartSet_DifferentObjectsValidator::ErrorType &theType, + const std::string &thEqualObject, + const std::string &theFirstAttribute, + const std::string &theSecondAttribute) const; }; /** -* \ingroup Validators -* A validator which checks that Point2D selected for feature attributes are different (not the same) -* It iterates by the feature ModelAPI_AttributeRefAttr attributes, finds GeomDataAPI_Point2D attribute in -* value or attribute of the attributes and if the point of the given attribute is geometrical equal to -* a point of another attribute, returns false -*/ -class PartSet_DifferentPointsValidator : public ModelAPI_AttributeValidator -{ - public: + * \ingroup Validators + * A validator which checks that Point2D selected for feature attributes are + * different (not the same) It iterates by the feature ModelAPI_AttributeRefAttr + * attributes, finds GeomDataAPI_Point2D attribute in value or attribute of the + * attributes and if the point of the given attribute is geometrical equal to a + * point of another attribute, returns false + */ +class PartSet_DifferentPointsValidator : public ModelAPI_AttributeValidator { +public: //! Returns true if the attribute is good for the feature attribute //! \param theAttribute an attribute //! \param theArguments a list of arguments (names of attributes to check) //! \param theError an output error string - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; + private: //! Finds Point2D attribute by reference attribute. It might be: //! - COORD_ID attribute of SketchPlugin_Point if object //! - Attribute casted to point if attribute //! \param theAttribute an attribute //! \return point 2d attribute or NULL - std::shared_ptr getRefPointAttribute - (const AttributePtr& theAttribute) const; + std::shared_ptr + getRefPointAttribute(const AttributePtr &theAttribute) const; }; - /**\class PartSet_CoincidentAttr * \ingroup Validators * \brief Validator to check whether there is a coincident constraint between * the attribute and attribute of argument. */ -class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator -{ - public: +class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError an output error string - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - #endif diff --git a/src/PartSet/PartSet_WidgetBSplinePoints.cpp b/src/PartSet/PartSet_WidgetBSplinePoints.cpp index c6d0ca2a7..54de97a63 100644 --- a/src/PartSet/PartSet_WidgetBSplinePoints.cpp +++ b/src/PartSet/PartSet_WidgetBSplinePoints.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,61 +26,59 @@ #include #include +#include #include #include -#include #include -#include #include +#include #include #include #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 const double MaxCoordinate = 1e12; static bool IsPointCreated = false; - -PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), - myValueIsCashed(false), myIsFeatureVisibleInCash(true), - myXValueInCash(0), myYValueInCash(0), - myPointIndex(0), myFinished(false) -{ +PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), + myValueIsCashed(false), myIsFeatureVisibleInCash(true), myXValueInCash(0), + myYValueInCash(0), myPointIndex(0), myFinished(false) { myRefAttribute = theData->getProperty("reference_attribute"); - QVBoxLayout* aMainLayout = new QVBoxLayout(this); + QVBoxLayout *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aMainLayout); - // the control should accept the focus, so the boolean flag is corrected to be true + // the control should accept the focus, so the boolean flag is corrected to be + // true myIsObligatory = true; QString aPageName = translate(theData->getProperty(CONTAINER_PAGE_NAME)); myBox = new QGroupBox(aPageName, theParent); @@ -90,12 +89,12 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints(QWidget* theParent, #ifdef _DEBUG bool aAcceptVariables = #endif - theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); // B-spline weights attribute myWeightsAttr = theData->getProperty("weights"); - QVBoxLayout* aLayout = new QVBoxLayout(myBox); + QVBoxLayout *aLayout = new QVBoxLayout(myBox); ModuleBase_Tools::adjustMargins(aLayout); myScrollArea = new QScrollArea(myBox); @@ -104,12 +103,12 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints(QWidget* theParent, myScrollArea->setFrameStyle(QFrame::NoFrame); aLayout->addWidget(myScrollArea); - QWidget* aContainer = new QWidget(myScrollArea); - QVBoxLayout* aBoxLay = new QVBoxLayout(aContainer); + QWidget *aContainer = new QWidget(myScrollArea); + QVBoxLayout *aBoxLay = new QVBoxLayout(aContainer); aBoxLay->setContentsMargins(0, 0, 0, 0); myGroupBox = new QWidget(aContainer); - QGridLayout* aGroupLay = new QGridLayout(myGroupBox); + QGridLayout *aGroupLay = new QGridLayout(myGroupBox); ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setSpacing(4); aGroupLay->setColumnStretch(1, 1); @@ -120,22 +119,22 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints(QWidget* theParent, myScrollArea->setWidget(aContainer); myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop); - myExternalObjectMgr = new PartSet_ExternalObjectsMgr(theData->getProperty("use_external"), - theData->getProperty("can_create_external"), true); + myExternalObjectMgr = new PartSet_ExternalObjectsMgr( + theData->getProperty("use_external"), + theData->getProperty("can_create_external"), true); } -void PartSet_WidgetBSplinePoints::createNextPoint() -{ +void PartSet_WidgetBSplinePoints::createNextPoint() { storeCurentValue(); - QGridLayout* aGroupLay = dynamic_cast(myGroupBox->layout()); + QGridLayout *aGroupLay = dynamic_cast(myGroupBox->layout()); int row = (int)myXSpin.size(); QString aPoleStr = translate("Pole %1"); aPoleStr = aPoleStr.arg(myXSpin.size() + 1); - QGroupBox* aPoleGroupBox = new QGroupBox(aPoleStr, myGroupBox); - QGridLayout* aPoleLay = new QGridLayout(aPoleGroupBox); + QGroupBox *aPoleGroupBox = new QGroupBox(aPoleStr, myGroupBox); + QGridLayout *aPoleLay = new QGridLayout(aPoleGroupBox); ModuleBase_Tools::adjustMargins(aPoleLay); aPoleLay->setSpacing(2); aPoleLay->setColumnStretch(1, 1); @@ -149,12 +148,11 @@ void PartSet_WidgetBSplinePoints::createNextPoint() IsPointCreated = true; } -void PartSet_WidgetBSplinePoints::removeLastPoint() -{ - QGridLayout* aGroupLay = dynamic_cast(myGroupBox->layout()); - QWidget* aXSpin = myXSpin.back(); - QWidget* aYSpin = myYSpin.back(); - QWidget* aBox = myXSpin.back()->parentWidget(); +void PartSet_WidgetBSplinePoints::removeLastPoint() { + QGridLayout *aGroupLay = dynamic_cast(myGroupBox->layout()); + QWidget *aXSpin = myXSpin.back(); + QWidget *aYSpin = myYSpin.back(); + QWidget *aBox = myXSpin.back()->parentWidget(); myYSpin.pop_back(); myXSpin.pop_back(); @@ -168,17 +166,20 @@ void PartSet_WidgetBSplinePoints::removeLastPoint() storeValueCustom(); } -bool PartSet_WidgetBSplinePoints::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); +bool PartSet_WidgetBSplinePoints::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &theValue) { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) - return true; // when internal edit is started a new feature is created. I has not results, AIS + return true; // when internal edit is started a new feature is created. I + // has not results, AIS - // the selection is not possible if the current feature has no presentation for the current - // attribute not in AIS not in results. If so, no object in current feature where make - // coincidence, so selection is not necessary + // the selection is not possible if the current feature has no presentation + // for the current attribute not in AIS not in results. If so, no object in + // current feature where make coincidence, so selection is not necessary GeomShapePtr anAISShape; - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(myFeature); + GeomPresentablePtr aPrs = + std::dynamic_pointer_cast(myFeature); if (aPrs.get()) { AISObjectPtr anAIS; anAIS = aPrs->getAISObject(anAIS); @@ -186,28 +187,30 @@ bool PartSet_WidgetBSplinePoints::isValidSelectionCustom(const ModuleBase_Viewer anAISShape = anAIS->getShape(); } } - const std::list >& aResults = myFeature->results(); + const std::list> &aResults = + myFeature->results(); if (!anAISShape.get() && aResults.empty()) return true; AttributeRefAttrListPtr aRefAttrList = attributeRefAttrList(); if (aRefAttrList) - return isValidSelectionForAttribute_(theValue, myFeature->attribute(attributeID())); + return isValidSelectionForAttribute_(theValue, + myFeature->attribute(attributeID())); return true; } bool PartSet_WidgetBSplinePoints::isValidSelectionForAttribute_( - const ModuleBase_ViewerPrsPtr& theValue, - const AttributePtr& theAttribute) -{ + const ModuleBase_ViewerPrsPtr &theValue, const AttributePtr &theAttribute) { bool aValid = false; // stores the current values of the widget attribute - bool isFlushesActived, isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked; + bool isFlushesActived, isAttributeSetInitializedBlocked, + isAttributeSendUpdatedBlocked; AttributeRefAttrListPtr aRefAttrList = attributeRefAttrList(); - ModuleBase_WidgetValidated::blockFeatureAttribute(aRefAttrList, myFeature, true, - isFlushesActived, isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); + ModuleBase_WidgetValidated::blockFeatureAttribute( + aRefAttrList, myFeature, true, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); myWidgetValidator->storeAttributeValue(aRefAttrList); // saves the owner value to the widget attribute @@ -220,24 +223,24 @@ bool PartSet_WidgetBSplinePoints::isValidSelectionForAttribute_( myWidgetValidator->restoreAttributeValue(aRefAttrList, aValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); - ModuleBase_WidgetValidated::blockFeatureAttribute(aRefAttrList, myFeature, false, - isFlushesActived, isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); + ModuleBase_WidgetValidated::blockFeatureAttribute( + aRefAttrList, myFeature, false, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); return aValid; } -bool PartSet_WidgetBSplinePoints::setSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) -{ +bool PartSet_WidgetBSplinePoints::setSelectionCustom( + const ModuleBase_ViewerPrsPtr &theValue) { bool isDone = false; GeomShapePtr aShape = theValue->shape(); if (aShape.get() && !aShape->isNull()) { Handle(V3d_View) aView = myWorkshop->viewer()->activeView(); - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); if (aPnt) { fillRefAttribute(aPnt, theValue); isDone = true; - } - else if (aTDShape.ShapeType() == TopAbs_EDGE) { + } else if (aTDShape.ShapeType() == TopAbs_EDGE) { fillRefAttribute(theValue); isDone = true; } @@ -245,15 +248,14 @@ bool PartSet_WidgetBSplinePoints::setSelectionCustom(const ModuleBase_ViewerPrsP return isDone; } -static void fillLabels(std::vector& theLabels, const double theValue) -{ - for (std::vector::iterator anIt = theLabels.begin(); +static void fillLabels(std::vector &theLabels, + const double theValue) { + for (std::vector::iterator anIt = theLabels.begin(); anIt != theLabels.end(); ++anIt) (*anIt)->setValue(theValue); } -bool PartSet_WidgetBSplinePoints::resetCustom() -{ +bool PartSet_WidgetBSplinePoints::resetCustom() { bool aDone = false; if (!isUseReset() || isComputedDefault()) aDone = false; @@ -263,10 +265,9 @@ bool PartSet_WidgetBSplinePoints::resetCustom() // reset state for the widget in the parent aDone = restoreCurentValue(); emit objectUpdated(); - } - else { - // it is important to block the spin box control in order to do not through out the - // locking of the validating state. + } else { + // it is important to block the spin box control in order to do not + // through out the locking of the validating state. fillLabels(myXSpin, 0.0); fillLabels(myYSpin, 0.0); @@ -277,13 +278,11 @@ bool PartSet_WidgetBSplinePoints::resetCustom() return aDone; } -PartSet_WidgetBSplinePoints::~PartSet_WidgetBSplinePoints() -{ +PartSet_WidgetBSplinePoints::~PartSet_WidgetBSplinePoints() { delete myExternalObjectMgr; } -bool PartSet_WidgetBSplinePoints::setPoint(double theX, double theY) -{ +bool PartSet_WidgetBSplinePoints::setPoint(double theX, double theY) { if (fabs(theX) >= MaxCoordinate || fabs(theY) >= MaxCoordinate) return false; @@ -294,20 +293,21 @@ bool PartSet_WidgetBSplinePoints::setPoint(double theX, double theY) return true; } -void PartSet_WidgetBSplinePoints::storePolesAndWeights() const -{ +void PartSet_WidgetBSplinePoints::storePolesAndWeights() const { std::shared_ptr aData = myFeature->data(); - AttributePoint2DArrayPtr aPointArray = std::dynamic_pointer_cast( - aData->attribute(attributeID())); + AttributePoint2DArrayPtr aPointArray = + std::dynamic_pointer_cast( + aData->attribute(attributeID())); AttributeDoubleArrayPtr aWeightsArray = aData->realArray(myWeightsAttr); int aSize = (int)myXSpin.size(); aPointArray->setSize(aSize); aWeightsArray->setSize(aSize); - std::vector::const_iterator aXIt = myXSpin.begin(); - std::vector::const_iterator aYIt = myYSpin.begin(); - for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end(); ++anIndex, ++aXIt, ++aYIt) + std::vector::const_iterator aXIt = myXSpin.begin(); + std::vector::const_iterator aYIt = myYSpin.begin(); + for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end(); + ++anIndex, ++aXIt, ++aYIt) aPointArray->setPnt(anIndex, (*aXIt)->value(), (*aYIt)->value()); double aWeight = Config_PropManager::real(SKETCH_TAB_NAME, "spline_weight"); @@ -315,21 +315,22 @@ void PartSet_WidgetBSplinePoints::storePolesAndWeights() const aWeightsArray->setValue(anIndex, aWeight); } -bool PartSet_WidgetBSplinePoints::storeValueCustom() -{ +bool PartSet_WidgetBSplinePoints::storeValueCustom() { std::shared_ptr aData = myFeature->data(); if (!aData || !aData->isValid()) // can be on abort of sketcher element return false; - AttributePoint2DArrayPtr aPointArray = std::dynamic_pointer_cast( - aData->attribute(attributeID())); + AttributePoint2DArrayPtr aPointArray = + std::dynamic_pointer_cast( + aData->attribute(attributeID())); AttributeDoubleArrayPtr aWeightsArray = aData->realArray(myWeightsAttr); - PartSet_WidgetBSplinePoints* that = (PartSet_WidgetBSplinePoints*) this; + PartSet_WidgetBSplinePoints *that = (PartSet_WidgetBSplinePoints *)this; bool isBlocked = that->blockSignals(true); bool isImmutable = aPointArray->setImmutable(true); if (myFeature->isMacro()) { - // Moving points of macro-features has been processed directly (without solver) + // Moving points of macro-features has been processed directly (without + // solver) storePolesAndWeights(); updateObject(myFeature); @@ -342,7 +343,8 @@ bool PartSet_WidgetBSplinePoints::storeValueCustom() new ModelAPI_ObjectMovedMessage(this)); aMessage->setMovedAttribute(aPointArray, aPointArray->size() - 1); aMessage->setOriginalPosition(aPointArray->pnt(aPointArray->size() - 1)); - aMessage->setCurrentPosition(myXSpin.back()->value(), myYSpin.back()->value()); + aMessage->setCurrentPosition(myXSpin.back()->value(), + myYSpin.back()->value()); Events_Loop::loop()->send(aMessage); } @@ -352,27 +354,26 @@ bool PartSet_WidgetBSplinePoints::storeValueCustom() return true; } -bool PartSet_WidgetBSplinePoints::restoreValueCustom() -{ +bool PartSet_WidgetBSplinePoints::restoreValueCustom() { std::shared_ptr aData = myFeature->data(); - AttributePoint2DArrayPtr aPointArray = std::dynamic_pointer_cast( - aData->attribute(attributeID())); + AttributePoint2DArrayPtr aPointArray = + std::dynamic_pointer_cast( + aData->attribute(attributeID())); AttributeDoubleArrayPtr aWeightsArray = aData->realArray(myWeightsAttr); if (aPointArray->isInitialized()) { while ((int)myXSpin.size() < aPointArray->size()) createNextPoint(); - std::vector::iterator aXIt = myXSpin.begin(); - std::vector::iterator aYIt = myYSpin.begin(); + std::vector::iterator aXIt = myXSpin.begin(); + std::vector::iterator aYIt = myYSpin.begin(); for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end(); ++anIndex, ++aXIt, ++aYIt) { GeomPnt2dPtr aPoint = aPointArray->pnt(anIndex); (*aXIt)->setValue(aPoint->x()); (*aYIt)->setValue(aPoint->y()); } - } - else { + } else { if (myXSpin.empty()) createNextPoint(); @@ -383,31 +384,29 @@ bool PartSet_WidgetBSplinePoints::restoreValueCustom() return true; } -static void storeArray(const std::vector& theLabels, - std::vector& theValues) -{ +static void storeArray(const std::vector &theLabels, + std::vector &theValues) { theValues.clear(); theValues.reserve(theLabels.size()); - for (std::vector::const_iterator anIt = theLabels.begin(); + for (std::vector::const_iterator anIt = + theLabels.begin(); anIt != theLabels.end(); ++anIt) theValues.push_back((*anIt)->value()); } -void PartSet_WidgetBSplinePoints::storeCurentValue() -{ +void PartSet_WidgetBSplinePoints::storeCurentValue() { myValueIsCashed = true; myIsFeatureVisibleInCash = XGUI_Displayer::isVisible( - XGUI_Tools::workshop(myWorkshop)->displayer(), myFeature); + XGUI_Tools::workshop(myWorkshop)->displayer(), myFeature); storeArray(myXSpin, myXValueInCash); storeArray(myYSpin, myYValueInCash); } -static void restoreArray(std::vector& theCacheValues, - std::vector& theLabels) -{ +static void restoreArray(std::vector &theCacheValues, + std::vector &theLabels) { std::vector::iterator aCIt = theCacheValues.begin(); - std::vector::iterator anIt = theLabels.begin(); + std::vector::iterator anIt = theLabels.begin(); for (; anIt != theLabels.end(); ++anIt) { if (aCIt != theCacheValues.end()) (*anIt)->setValue(*aCIt++); @@ -417,8 +416,7 @@ static void restoreArray(std::vector& theCacheValues, theCacheValues.clear(); } -bool PartSet_WidgetBSplinePoints::restoreCurentValue() -{ +bool PartSet_WidgetBSplinePoints::restoreCurentValue() { bool aRestoredAndHidden = true; bool isVisible = myIsFeatureVisibleInCash; @@ -434,29 +432,26 @@ bool PartSet_WidgetBSplinePoints::restoreCurentValue() if (isVisible) { setValueState(Stored); aRestoredAndHidden = false; - } - else + } else aRestoredAndHidden = true; return aRestoredAndHidden; } -QList PartSet_WidgetBSplinePoints::getControls() const -{ - QList aControls; +QList PartSet_WidgetBSplinePoints::getControls() const { + QList aControls; aControls.append(myScrollArea); return aControls; } -void PartSet_WidgetBSplinePoints::selectionModes(int& theModuleSelectionModes, QIntList& theModes) -{ +void PartSet_WidgetBSplinePoints::selectionModes(int &theModuleSelectionModes, + QIntList &theModes) { theModuleSelectionModes = -1; theModes << TopAbs_VERTEX; theModes << TopAbs_EDGE; } -void PartSet_WidgetBSplinePoints::deactivate() -{ +void PartSet_WidgetBSplinePoints::deactivate() { // the value of the control should be stored to model if it was not // initialized yet. It is important when we leave this control by Tab key. // It should not be performed by the widget activation as the preview @@ -468,19 +463,20 @@ void PartSet_WidgetBSplinePoints::deactivate() ModuleBase_ModelWidget::deactivate(); } -void PartSet_WidgetBSplinePoints::mouseReleased(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) -{ - // the contex menu release by the right button should not be processed by this widget +void PartSet_WidgetBSplinePoints::mouseReleased( + ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) { + // the contex menu release by the right button should not be processed by this + // widget if (theEvent->button() != Qt::LeftButton) return; - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); Handle(V3d_View) aView = theWindow->v3dView(); - QList aList = aSelection->getSelected(ModuleBase_ISelection::Viewer); + QList aList = + aSelection->getSelected(ModuleBase_ISelection::Viewer); ModuleBase_ViewerPrsPtr aFirstValue = - aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr(); + aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr(); if (!aFirstValue.get() && myPreSelected.get()) { aFirstValue = myPreSelected; } @@ -490,7 +486,8 @@ void PartSet_WidgetBSplinePoints::mouseReleased(ModuleBase_IViewWindow* theWindo // if we have selection and use it if (aFirstValue.get() && isValidSelectionCustom(aFirstValue) && - aFirstValue->shape().get()) { // Trihedron Axis may be selected, but shape is empty + aFirstValue->shape() + .get()) { // Trihedron Axis may be selected, but shape is empty GeomShapePtr aGeomShape = aFirstValue->shape(); aSelectedShape = aGeomShape->impl(); aSelectedObject = aFirstValue->object(); @@ -498,12 +495,13 @@ void PartSet_WidgetBSplinePoints::mouseReleased(ModuleBase_IViewWindow* theWindo FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aSelectedObject); std::shared_ptr aSPFeature; if (aSelectedFeature.get()) - aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); + aSPFeature = + std::dynamic_pointer_cast(aSelectedFeature); bool isSketchExternalFeature = aSPFeature.get() && aSPFeature->isExternal(); if ((!aSPFeature && !aSelectedShape.IsNull()) || isSketchExternalFeature) { - ObjectPtr aFixedObject = - PartSet_Tools::findFixedObjectByExternal(aSelectedShape, aSelectedObject, mySketch); + ObjectPtr aFixedObject = PartSet_Tools::findFixedObjectByExternal( + aSelectedShape, aSelectedObject, mySketch); if (aFixedObject) aSelectedObject = aFixedObject; else if (!isSketchExternalFeature) { @@ -519,24 +517,27 @@ void PartSet_WidgetBSplinePoints::mouseReleased(ModuleBase_IViewWindow* theWindo Handle(PartSet_CenterPrs)::DownCast(aFirstValue->interactive()); if (!aAIS.IsNull()) { gp_Pnt aPntComp = aAIS->Component()->Pnt(); - GeomVertexPtr aVertPtr(new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); + GeomVertexPtr aVertPtr( + new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); aSelectedShape = aVertPtr->impl(); - aSelectedObject = - PartSet_Tools::findFixedObjectByExternal(aSelectedShape, aAIS->object(), mySketch); - if (!aSelectedObject.get()) - { + aSelectedObject = PartSet_Tools::findFixedObjectByExternal( + aSelectedShape, aAIS->object(), mySketch); + if (!aSelectedObject.get()) { FeaturePtr aCreatedFeature; - aSelectedObject = PartSet_Tools::createFixedByExternalCenter(aAIS->object(), aAIS->edge(), - aAIS->centerType(), mySketch, false, aCreatedFeature); + aSelectedObject = PartSet_Tools::createFixedByExternalCenter( + aAIS->object(), aAIS->edge(), aAIS->centerType(), mySketch, false, + aCreatedFeature); } } } - GeomPnt2dPtr aSelectedPoint = PartSet_Tools::getPnt2d(aView, aSelectedShape, mySketch); + GeomPnt2dPtr aSelectedPoint = + PartSet_Tools::getPnt2d(aView, aSelectedShape, mySketch); if (!aSelectedPoint) { aSelectedPoint = PartSet_Tools::getPnt2d(theEvent, theWindow, mySketch); - setValueState(Stored); // in case of edge selection, Apply state should also be updated + setValueState(Stored); // in case of edge selection, Apply state should also + // be updated } if (aSelectedObject) fillRefAttribute(aSelectedObject); @@ -547,15 +548,17 @@ void PartSet_WidgetBSplinePoints::mouseReleased(ModuleBase_IViewWindow* theWindo createNextPoint(); } -void PartSet_WidgetBSplinePoints::mouseMoved(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); +void PartSet_WidgetBSplinePoints::mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); - if (myFinished || isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) + if (myFinished || isEditingMode() || + aModule->sketchReentranceMgr()->isInternalEditActive()) return; - gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); + gp_Pnt aPoint = + PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); double aX = 0, aY = 0; PartSet_Tools::convertTo2D(aPoint, mySketch, theWindow->v3dView(), aX, aY); @@ -574,8 +577,7 @@ void PartSet_WidgetBSplinePoints::mouseMoved(ModuleBase_IViewWindow* theWindow, } } -bool PartSet_WidgetBSplinePoints::processEscape() -{ +bool PartSet_WidgetBSplinePoints::processEscape() { bool isProcessed = !isEditingMode(); if (isProcessed) { // remove widgets corrsponding to the last pole/weight of B-spline @@ -587,13 +589,10 @@ bool PartSet_WidgetBSplinePoints::processEscape() return isProcessed; } -bool PartSet_WidgetBSplinePoints::useSelectedShapes() const -{ - return true; -} +bool PartSet_WidgetBSplinePoints::useSelectedShapes() const { return true; } -AttributeRefAttrListPtr PartSet_WidgetBSplinePoints::attributeRefAttrList() const -{ +AttributeRefAttrListPtr +PartSet_WidgetBSplinePoints::attributeRefAttrList() const { if (myRefAttribute.empty()) return AttributeRefAttrListPtr(); @@ -601,12 +600,13 @@ AttributeRefAttrListPtr PartSet_WidgetBSplinePoints::attributeRefAttrList() cons if (!anAttributeRef.get()) return AttributeRefAttrListPtr(); - return std::dynamic_pointer_cast(anAttributeRef); + return std::dynamic_pointer_cast( + anAttributeRef); } -void PartSet_WidgetBSplinePoints::fillRefAttribute(GeomPnt2dPtr theClickedPoint, - const std::shared_ptr& theValue) -{ +void PartSet_WidgetBSplinePoints::fillRefAttribute( + GeomPnt2dPtr theClickedPoint, + const std::shared_ptr &theValue) { AttributeRefAttrListPtr aRefAttrList = attributeRefAttrList(); if (!aRefAttrList.get()) return; @@ -616,7 +616,8 @@ void PartSet_WidgetBSplinePoints::fillRefAttribute(GeomPnt2dPtr theClickedPoint, if (aFeature.get()) { AttributePoint2DPtr aClickedFeaturePoint = - PartSet_WidgetPoint2D::findFirstEqualPointInSketch(mySketch, aFeature, theClickedPoint); + PartSet_WidgetPoint2D::findFirstEqualPointInSketch(mySketch, aFeature, + theClickedPoint); if (aClickedFeaturePoint.get()) aRefAttrList->append(aClickedFeaturePoint); else @@ -624,29 +625,29 @@ void PartSet_WidgetBSplinePoints::fillRefAttribute(GeomPnt2dPtr theClickedPoint, } } -void PartSet_WidgetBSplinePoints::fillRefAttribute(const ModuleBase_ViewerPrsPtr& theValue) -{ +void PartSet_WidgetBSplinePoints::fillRefAttribute( + const ModuleBase_ViewerPrsPtr &theValue) { ObjectPtr anObject; if (theValue) anObject = getGeomSelection(theValue); fillRefAttribute(anObject); } -void PartSet_WidgetBSplinePoints::fillRefAttribute(const ObjectPtr& theObject) -{ +void PartSet_WidgetBSplinePoints::fillRefAttribute(const ObjectPtr &theObject) { AttributeRefAttrListPtr aRefAttrList = attributeRefAttrList(); if (aRefAttrList.get()) aRefAttrList->append(theObject); } -ObjectPtr PartSet_WidgetBSplinePoints::getGeomSelection(const ModuleBase_ViewerPrsPtr& theValue) -{ +ObjectPtr PartSet_WidgetBSplinePoints::getGeomSelection( + const ModuleBase_ViewerPrsPtr &theValue) { ObjectPtr anObject; GeomShapePtr aShape; - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); anObject = aSelection->getResult(theValue); aShape = aSelection->getShape(theValue); - myExternalObjectMgr->getGeomSelection(theValue, anObject, aShape, myWorkshop, sketch(), true); + myExternalObjectMgr->getGeomSelection(theValue, anObject, aShape, myWorkshop, + sketch(), true); return anObject; } diff --git a/src/PartSet/PartSet_WidgetBSplinePoints.h b/src/PartSet/PartSet_WidgetBSplinePoints.h index ea5b2d776..feff4861e 100644 --- a/src/PartSet/PartSet_WidgetBSplinePoints.h +++ b/src/PartSet/PartSet_WidgetBSplinePoints.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetBSplinePoints_H @@ -36,53 +37,55 @@ class QScrollArea; /**\class PartSet_WidgetBSplinePoints * \ingroup Modules - * \brief Implementation of model widget to provide widget to input a list of 2D poles - * of B-spline curve in association with weights - * In XML can be defined as following: - * \code - * + * \brief Implementation of model widget to provide widget to input a list of 2D + * poles of B-spline curve in association with weights In XML can be defined as + * following: \code * \endcode */ -class PARTSET_EXPORT PartSet_WidgetBSplinePoints : public ModuleBase_ModelWidget, - public PartSet_MouseProcessor -{ -Q_OBJECT +class PARTSET_EXPORT PartSet_WidgetBSplinePoints + : public ModuleBase_ModelWidget, + public PartSet_MouseProcessor { + Q_OBJECT public: /// Constructor /// \param theParent the parent object /// \param theWorkshop a current workshop - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetBSplinePoints(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetBSplinePoints(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); /// Destructor virtual ~PartSet_WidgetBSplinePoints(); /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param theModes [out] a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param theModes [out] a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& theValue); - - /// Checks all attribute validators returns valid. It tries on the given selection - /// to current attribute by setting the value inside and calling validators. After this, - /// the previous attribute value is restored.The valid/invalid value is cashed. - /// \param theValue a selected presentation in the view - /// \param theAttribute the attribute - /// \return a boolean value - bool isValidSelectionForAttribute_(const std::shared_ptr& theValue, - const std::shared_ptr& theAttribute); + virtual bool + isValidSelectionCustom(const std::shared_ptr &theValue); + + /// Checks all attribute validators returns valid. It tries on the given + /// selection to current attribute by setting the value inside and calling + /// validators. After this, the previous attribute value is restored.The + /// valid/invalid value is cashed. \param theValue a selected presentation in + /// the view \param theAttribute the attribute \return a boolean value + bool isValidSelectionForAttribute_( + const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - bool setSelectionCustom(const std::shared_ptr& theValue); + bool + setSelectionCustom(const std::shared_ptr &theValue); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// The methiod called when widget is deactivated virtual void deactivate(); @@ -91,7 +94,9 @@ public: std::shared_ptr sketch() const { return mySketch; } /// Set sketch instance - void setSketch(std::shared_ptr theSketch) { mySketch = theSketch; } + void setSketch(std::shared_ptr theSketch) { + mySketch = theSketch; + } /// Fill the widget values by given point /// \param theX the X coordinate @@ -102,19 +107,22 @@ public: /// Returns true if the event is processed. virtual bool processEscape(); - /// Returns true if the attribute can be changed using the selected shapes in the viewer - /// and creating a coincidence constraint to them. This control use them. + /// Returns true if the attribute can be changed using the selected shapes in + /// the viewer and creating a coincidence constraint to them. This control use + /// them. virtual bool useSelectedShapes() const; /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent); + virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent); /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent); + virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent); protected: /// Saves the internal parameters to the given feature @@ -144,27 +152,31 @@ private: /// Save B-spline poles and weights to corresponding attributes void storePolesAndWeights() const; - /// Returns attribute reference if the key is defined in XML definition of this control - /// \return found attribute or null + /// Returns attribute reference if the key is defined in XML definition of + /// this control \return found attribute or null std::shared_ptr attributeRefAttrList() const; - void fillRefAttribute(const std::shared_ptr& theValue); + void fillRefAttribute(const std::shared_ptr &theValue); void fillRefAttribute(std::shared_ptr theClickedPoint, - const std::shared_ptr& theValue); - void fillRefAttribute(const ObjectPtr& theObject); + const std::shared_ptr &theValue); + void fillRefAttribute(const ObjectPtr &theObject); - ObjectPtr getGeomSelection(const std::shared_ptr& theValue); + ObjectPtr + getGeomSelection(const std::shared_ptr &theValue); protected: - ModuleBase_IWorkshop* myWorkshop; ///< workshop + ModuleBase_IWorkshop *myWorkshop; ///< workshop private: - QGroupBox* myBox; - QWidget* myGroupBox; ///< the parent group box for all intenal widgets - QScrollArea* myScrollArea; - std::vector myXSpin; ///< the label for the X coordinate - std::vector myYSpin; ///< the label for the Y coordinate - PartSet_ExternalObjectsMgr* myExternalObjectMgr; ///< reference to external objects manager + QGroupBox *myBox; + QWidget *myGroupBox; ///< the parent group box for all intenal widgets + QScrollArea *myScrollArea; + std::vector + myXSpin; ///< the label for the X coordinate + std::vector + myYSpin; ///< the label for the Y coordinate + PartSet_ExternalObjectsMgr + *myExternalObjectMgr; ///< reference to external objects manager /// value used as selection in mouse release method std::shared_ptr myPreSelected; @@ -172,19 +184,26 @@ private: /// it is important during restart operation CompositeFeaturePtr mySketch; - std::string myRefAttribute; /// if not empty, coincidences are not set but attribute is filled + std::string myRefAttribute; /// if not empty, coincidences are not set but + /// attribute is filled - bool myValueIsCashed; /// boolean state if the value is cashed during value state change - bool myIsFeatureVisibleInCash; /// boolean value if the feature was visible when cash if filled - std::vector myXValueInCash; /// the cashed X value during value state change - std::vector myYValueInCash; /// the cashed Y value during value state change - std::vector myWeightInCash; /// the cached Weight value during valude state change + bool myValueIsCashed; /// boolean state if the value is cashed during value + /// state change + bool myIsFeatureVisibleInCash; /// boolean value if the feature was visible + /// when cash if filled + std::vector + myXValueInCash; /// the cashed X value during value state change + std::vector + myYValueInCash; /// the cashed Y value during value state change + std::vector + myWeightInCash; /// the cached Weight value during valude state change std::string myWeightsAttr; int myPointIndex; /// index of the changing point - bool myFinished; /// \c true if building the B-spline is finished (escape pressed) + bool myFinished; /// \c true if building the B-spline is finished (escape + /// pressed) }; #endif diff --git a/src/PartSet/PartSet_WidgetEditor.cpp b/src/PartSet/PartSet_WidgetEditor.cpp index c105c8916..66c6a5985 100644 --- a/src/PartSet/PartSet_WidgetEditor.cpp +++ b/src/PartSet/PartSet_WidgetEditor.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetEditor.h" @@ -26,15 +27,14 @@ #include -PartSet_WidgetEditor::PartSet_WidgetEditor(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) - : ModuleBase_WidgetEditor(theParent, theData), myWorkshop(theWorkshop) -{ -} +PartSet_WidgetEditor::PartSet_WidgetEditor(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetEditor(theParent, theData), myWorkshop(theWorkshop) {} -bool PartSet_WidgetEditor::focusTo() -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); +bool PartSet_WidgetEditor::focusTo() { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule->isMouseOverWindow() && !isEditingMode()) return ModuleBase_WidgetEditor::focusTo(); else { diff --git a/src/PartSet/PartSet_WidgetEditor.h b/src/PartSet/PartSet_WidgetEditor.h index 4af6f7938..9fb0c7d86 100644 --- a/src/PartSet/PartSet_WidgetEditor.h +++ b/src/PartSet/PartSet_WidgetEditor.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetEditor_H @@ -27,30 +28,30 @@ class ModuleBase_IWorkshop; /** -* \ingroup Modules -* Customization of ModuleBase_WidgetEditor in order to do not show the editor value if the mouse -* cursor is not over the OCC window -*/ -class PARTSET_EXPORT PartSet_WidgetEditor : public ModuleBase_WidgetEditor -{ -Q_OBJECT - public: + * \ingroup Modules + * Customization of ModuleBase_WidgetEditor in order to do not show the editor + * value if the mouse cursor is not over the OCC window + */ +class PARTSET_EXPORT PartSet_WidgetEditor : public ModuleBase_WidgetEditor { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuration. The attribute of the model widget is obtained from - PartSet_WidgetEditor(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + PartSet_WidgetEditor(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~PartSet_WidgetEditor() {} - /// Activates the editor control only in case if the mouse over the OCC window, otherwise - /// set focus to the usual double value control - /// \return the state whether the widget can accept the focus + /// Activates the editor control only in case if the mouse over the OCC + /// window, otherwise set focus to the usual double value control \return the + /// state whether the widget can accept the focus virtual bool focusTo(); private: - ModuleBase_IWorkshop* myWorkshop; // the current workshop + ModuleBase_IWorkshop *myWorkshop; // the current workshop }; #endif diff --git a/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp b/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp index d635af340..f811b9190 100644 --- a/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp +++ b/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetFeaturePointSelector.h" -#include "PartSet_Tools.h" #include "PartSet_ExternalObjectsMgr.h" +#include "PartSet_Tools.h" #include #include -#include -#include #include #include #include +#include +#include #include #include @@ -40,19 +41,19 @@ #include #include +#include #include #include -#include #include -#include -#include #include +#include #include +#include -#include #include +#include #define HIGHLIGHT_STAYS_PROBLEM #ifdef HIGHLIGHT_STAYS_PROBLEM @@ -60,14 +61,13 @@ #define SKETCH_ENTITY_COLOR "225,0,0" #endif -PartSet_WidgetFeaturePointSelector::PartSet_WidgetFeaturePointSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData) -{ +PartSet_WidgetFeaturePointSelector::PartSet_WidgetFeaturePointSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData) { std::string anAttributes = theData->getProperty("selection_attributes"); QStringList anAttributesList = - QString(anAttributes.c_str()).split(' ', QString::SkipEmptyParts); + QString(anAttributes.c_str()).split(' ', QString::SkipEmptyParts); myHasPreview = anAttributesList.size() >= 4; @@ -77,47 +77,43 @@ PartSet_WidgetFeaturePointSelector::PartSet_WidgetFeaturePointSelector(QWidget* myPreviewObjectAttribute = anAttributesList[2].toStdString(); myPreviewPointAttribute = anAttributesList[3].toStdString(); } - myExternalObjectMgr = new PartSet_ExternalObjectsMgr(theData->getProperty("use_external"), - theData->getProperty("can_create_external"), true); + myExternalObjectMgr = new PartSet_ExternalObjectsMgr( + theData->getProperty("use_external"), + theData->getProperty("can_create_external"), true); } -PartSet_WidgetFeaturePointSelector::~PartSet_WidgetFeaturePointSelector() -{ +PartSet_WidgetFeaturePointSelector::~PartSet_WidgetFeaturePointSelector() { delete myExternalObjectMgr; } //******************************************************************** bool PartSet_WidgetFeaturePointSelector::isValidSelection( - const std::shared_ptr& theValue) -{ + const std::shared_ptr &theValue) { return ModuleBase_WidgetShapeSelector::isValidSelection(theValue); - //return true; + // return true; } //******************************************************************** -void PartSet_WidgetFeaturePointSelector::activateCustom() -{ +void PartSet_WidgetFeaturePointSelector::activateCustom() { ModuleBase_WidgetShapeSelector::activateCustom(); - myWorkshop->module()->activateCustomPrs(myFeature, - ModuleBase_IModule::CustomizeHighlightedObjects, true); + myWorkshop->module()->activateCustomPrs( + myFeature, ModuleBase_IModule::CustomizeHighlightedObjects, true); } //******************************************************************** -void PartSet_WidgetFeaturePointSelector::deactivate() -{ +void PartSet_WidgetFeaturePointSelector::deactivate() { ModuleBase_WidgetShapeSelector::deactivate(); } //******************************************************************** -void PartSet_WidgetFeaturePointSelector::mouseMoved(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) -{ - ModuleBase_ISelection* aSelect = myWorkshop->selection(); +void PartSet_WidgetFeaturePointSelector::mouseMoved( + ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) { + ModuleBase_ISelection *aSelect = myWorkshop->selection(); QList aHighlighted = aSelect->getHighlighted(); - ModuleBase_ViewerPrsPtr aPrs = !aHighlighted.empty() ? aHighlighted.first() - : ModuleBase_ViewerPrsPtr(); + ModuleBase_ViewerPrsPtr aPrs = + !aHighlighted.empty() ? aHighlighted.first() : ModuleBase_ViewerPrsPtr(); myPreviewPoint = PartSet_Tools::getPnt2d(theEvent, theWindow, mySketch); if (myHasPreview) { if (aPrs.get() && aPrs->object().get()) @@ -126,29 +122,30 @@ void PartSet_WidgetFeaturePointSelector::mouseMoved(ModuleBase_IViewWindow* theW myPreviewObject = ObjectPtr(); fillFeature(); updateObject(feature()); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } } //******************************************************************** -void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* theWindow, - QMouseEvent* theEvent) -{ - // the contex menu release by the right button should not be processed by this widget +void PartSet_WidgetFeaturePointSelector::mouseReleased( + ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) { + // the contex menu release by the right button should not be processed by this + // widget if (theEvent->button() != Qt::LeftButton) return; - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); QList aSelected = - aSelection->getSelected(ModuleBase_ISelection::Viewer); + aSelection->getSelected(ModuleBase_ISelection::Viewer); ModuleBase_ViewerPrsPtr aPrs = - !aSelected.empty() ? aSelected.first() : ModuleBase_ViewerPrsPtr(); + !aSelected.empty() ? aSelected.first() : ModuleBase_ViewerPrsPtr(); if (aPrs.get() && aPrs->object().get()) { myPreviewObject = aSelection->getResult(aPrs); GeomShapePtr aShape = aSelection->getShape(aPrs); myExternalObjectMgr->getGeomSelection(aPrs, myPreviewObject, aShape, - myWorkshop, sketch(), true); + myWorkshop, sketch(), true); } myPreviewPoint = PartSet_Tools::getPnt2d(theEvent, theWindow, mySketch); @@ -156,21 +153,21 @@ void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* t GeomPnt2dPtr aPreviewPoint; if (myHasPreview) { std::shared_ptr aRefPreviewAttr = - std::dynamic_pointer_cast( - feature()->data()->attribute(myPreviewObjectAttribute)); + std::dynamic_pointer_cast( + feature()->data()->attribute(myPreviewObjectAttribute)); aPreviewObject = aRefPreviewAttr->value(); std::shared_ptr aPointPreviewAttr = - std::dynamic_pointer_cast( - feature()->data()->attribute(myPreviewPointAttribute)); + std::dynamic_pointer_cast( + feature()->data()->attribute(myPreviewPointAttribute)); aPreviewPoint = aPointPreviewAttr->pnt(); - } - else { + } else { aPreviewObject = myPreviewObject; aPreviewPoint = myPreviewPoint; } - // do not move focus from the current widget if the object is not highlighted/selected + // do not move focus from the current widget if the object is not + // highlighted/selected if (!aPreviewObject.get()) return; @@ -180,15 +177,17 @@ void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* t // set parameters of preview into parameters of selection in the feature std::shared_ptr aPointSelectedAttr = - std::dynamic_pointer_cast( - feature()->data()->attribute(mySelectedPointAttribute)); + std::dynamic_pointer_cast( + feature()->data()->attribute(mySelectedPointAttribute)); aPointSelectedAttr->setValue(aPreviewPoint); - AttributeReferencePtr aRefSelectedAttr = feature()->reference(mySelectedObjectAttribute); + AttributeReferencePtr aRefSelectedAttr = + feature()->reference(mySelectedObjectAttribute); if (aRefSelectedAttr) aRefSelectedAttr->setValue(aPreviewObject); else { - AttributeRefAttrPtr aRefAttrSelectedAttr = feature()->refattr(mySelectedObjectAttribute); + AttributeRefAttrPtr aRefAttrSelectedAttr = + feature()->refattr(mySelectedObjectAttribute); if (aRefAttrSelectedAttr) aRefAttrSelectedAttr->setObject(aPreviewObject); } @@ -198,27 +197,26 @@ void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* t // we need to deselect base feature for better visibility of selected feature XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(false); - // focusOutWidget should be the last functionality in the method because after this emit, - // the widget may be deleted and members of this class are deleted (e.g. myWorkshop) + // focusOutWidget should be the last functionality in the method because after + // this emit, the widget may be deleted and members of this class are deleted + // (e.g. myWorkshop) emit focusOutWidget(this); } //******************************************************************** -bool PartSet_WidgetFeaturePointSelector::fillFeature() -{ +bool PartSet_WidgetFeaturePointSelector::fillFeature() { if (myHasPreview) { std::shared_ptr aRef = - std::dynamic_pointer_cast( - feature()->data()->attribute(myPreviewObjectAttribute)); + std::dynamic_pointer_cast( + feature()->data()->attribute(myPreviewObjectAttribute)); aRef->setValue(myPreviewObject); if (myPreviewPoint.get()) { std::shared_ptr anAttributePoint = - std::dynamic_pointer_cast( - feature()->data()->attribute(myPreviewPointAttribute)); + std::dynamic_pointer_cast( + feature()->data()->attribute(myPreviewPointAttribute)); anAttributePoint->setValue(myPreviewPoint); } - } - else { + } else { // Do not use non-sketcher objects if (!sketch()->isSub(myPreviewObject)) return false; @@ -226,15 +224,17 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature() // set parameters of preview into parameters of selection in the feature if (myPreviewPoint.get()) { std::shared_ptr aPointSelectedAttr = - std::dynamic_pointer_cast( - feature()->data()->attribute(mySelectedPointAttribute)); + std::dynamic_pointer_cast( + feature()->data()->attribute(mySelectedPointAttribute)); aPointSelectedAttr->setValue(myPreviewPoint); } - AttributeReferencePtr aRefSelectedAttr = feature()->reference(mySelectedObjectAttribute); + AttributeReferencePtr aRefSelectedAttr = + feature()->reference(mySelectedObjectAttribute); if (aRefSelectedAttr) aRefSelectedAttr->setValue(myPreviewObject); else { - AttributeRefAttrPtr aRefAttrSelectedAttr = feature()->refattr(mySelectedObjectAttribute); + AttributeRefAttrPtr aRefAttrSelectedAttr = + feature()->refattr(mySelectedObjectAttribute); if (aRefAttrSelectedAttr) aRefAttrSelectedAttr->setObject(myPreviewObject); } @@ -248,51 +248,48 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature() } //******************************************************************** -QList PartSet_WidgetFeaturePointSelector::getAttributeSelection() const -{ +QList +PartSet_WidgetFeaturePointSelector::getAttributeSelection() const { return QList(); } //******************************************************************** -bool PartSet_WidgetFeaturePointSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_WidgetFeaturePointSelector::setSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { if (!thePrs.get() || !thePrs->object().get()) return false; - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); myPreviewObject = aSelection->getResult(thePrs); GeomShapePtr aShape = aSelection->getShape(thePrs); - myExternalObjectMgr->getGeomSelection(thePrs, myPreviewObject, aShape, myWorkshop, - sketch(), true); + myExternalObjectMgr->getGeomSelection(thePrs, myPreviewObject, aShape, + myWorkshop, sketch(), true); return fillFeature(); } //******************************************************************** void PartSet_WidgetFeaturePointSelector::setPreSelection( - const ModuleBase_ViewerPrsPtr& thePreSelected, - ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent) -{ - // the method is empty because firstly by starging of the feature there is no selection of - // sub-segments in the viewer, secondly preselection of restart operation is processed by - // special reentrant message sent by the feature + const ModuleBase_ViewerPrsPtr &thePreSelected, + ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent) { + // the method is empty because firstly by starging of the feature there is no + // selection of sub-segments in the viewer, secondly preselection of restart + // operation is processed by special reentrant message sent by the feature } //******************************************************************** -void PartSet_WidgetFeaturePointSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs, - ObjectPtr& theObject, GeomShapePtr& theShape) -{ +void PartSet_WidgetFeaturePointSelector::getGeomSelection( + const ModuleBase_ViewerPrsPtr &thePrs, ObjectPtr &theObject, + GeomShapePtr &theShape) { ModuleBase_WidgetShapeSelector::getGeomSelection(thePrs, theObject, theShape); - myExternalObjectMgr->getGeomSelection(thePrs, theObject, theShape, - myWorkshop, sketch(), myIsInValidate); + myExternalObjectMgr->getGeomSelection(thePrs, theObject, theShape, myWorkshop, + sketch(), myIsInValidate); myPreviewObject = theObject; } //******************************************************************** -void PartSet_WidgetFeaturePointSelector::restoreAttributeValue(const AttributePtr& theAttribute, - const bool theValid) -{ +void PartSet_WidgetFeaturePointSelector::restoreAttributeValue( + const AttributePtr &theAttribute, const bool theValid) { ModuleBase_WidgetShapeSelector::restoreAttributeValue(theAttribute, theValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); myPreviewObject = ObjectPtr(); diff --git a/src/PartSet/PartSet_WidgetFeaturePointSelector.h b/src/PartSet/PartSet_WidgetFeaturePointSelector.h index 7280875ae..504fd4d18 100644 --- a/src/PartSet/PartSet_WidgetFeaturePointSelector.h +++ b/src/PartSet/PartSet_WidgetFeaturePointSelector.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetFeaturePointSelector_H #define PartSet_WidgetFeaturePointSelector_H #include -#include #include +#include #include "PartSet.h" #include "PartSet_MouseProcessor.h" @@ -47,32 +48,36 @@ class QWidget; class QMouseEvent; /** -* \ingroup Modules -* Customosation of PartSet_WidgetFeaturePointSelector in order to visualize sub-shape -* by mouse move over shape in the viewer. Split of the object is performed by -* coincident points to the object. Segment between nearest coincidence is highlighted -*/ -class PARTSET_EXPORT PartSet_WidgetFeaturePointSelector: public ModuleBase_WidgetShapeSelector, - public PartSet_MouseProcessor -{ -Q_OBJECT - public: + * \ingroup Modules + * Customosation of PartSet_WidgetFeaturePointSelector in order to visualize + * sub-shape by mouse move over shape in the viewer. Split of the object is + * performed by coincident points to the object. Segment between nearest + * coincidence is highlighted + */ +class PARTSET_EXPORT PartSet_WidgetFeaturePointSelector + : public ModuleBase_WidgetShapeSelector, + public PartSet_MouseProcessor { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetFeaturePointSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetFeaturePointSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~PartSet_WidgetFeaturePointSelector(); - /// Checks all widget validator if the owner is valid. Firstly it checks custom widget - /// validating, next, the attribute's validating. It trying on the give selection to current - /// attribute by setting the value inside and calling validators. After this, the previous - /// attribute value is restored.The valid/invalid value is cashed. - /// \param theValue a selected presentation in the view - /// \return a boolean value - virtual bool isValidSelection(const std::shared_ptr& theValue); + /// Checks all widget validator if the owner is valid. Firstly it checks + /// custom widget validating, next, the attribute's validating. It trying on + /// the give selection to current attribute by setting the value inside and + /// calling validators. After this, the previous attribute value is + /// restored.The valid/invalid value is cashed. \param theValue a selected + /// presentation in the view \return a boolean value + virtual bool + isValidSelection(const std::shared_ptr &theValue); /// Set sketcher /// \param theSketch a sketcher object @@ -87,27 +92,30 @@ Q_OBJECT /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent); + virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent); /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent); - + virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs); + virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs); /// Fill preselection used in mouseReleased - virtual void setPreSelection(const ModuleBase_ViewerPrsPtr& thePreSelected, - ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent); + virtual void setPreSelection(const ModuleBase_ViewerPrsPtr &thePreSelected, + ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent); + protected: /// Return the attribute values wrapped in a list of viewer presentations - /// \return a list of viewer presentations, which contains an attribute result and - /// a shape. If the attribute do not uses the shape, it is empty - virtual QList> getAttributeSelection() const; + /// \return a list of viewer presentations, which contains an attribute result + /// and a shape. If the attribute do not uses the shape, it is empty + virtual QList> + getAttributeSelection() const; /// The methiod called when widget is activated virtual void activateCustom(); @@ -116,15 +124,17 @@ protected: /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void getGeomSelection(const std::shared_ptr& thePrs, - ObjectPtr& theObject, GeomShapePtr& theShape); + virtual void + getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape); /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute /// \param theValid a boolean flag, if restore happens for valid parameters - void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); + void restoreAttributeValue(const AttributePtr &theAttribute, + const bool theValid); protected: bool fillFeature(); @@ -141,8 +151,9 @@ protected: bool myHasPreview; std::shared_ptr myPreviewObject; - std::shared_ptr myPreviewPoint; - PartSet_ExternalObjectsMgr* myExternalObjectMgr; ///< reference to external objects manager + std::shared_ptr myPreviewPoint; + PartSet_ExternalObjectsMgr + *myExternalObjectMgr; ///< reference to external objects manager }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_WidgetFileSelector.cpp b/src/PartSet/PartSet_WidgetFileSelector.cpp index f8d2da92d..7b3ddfcca 100644 --- a/src/PartSet/PartSet_WidgetFileSelector.cpp +++ b/src/PartSet/PartSet_WidgetFileSelector.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetFileSelector.h" @@ -23,44 +24,42 @@ #include -PartSet_WidgetFileSelector::PartSet_WidgetFileSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetFileSelector(theParent, theData), - myWorkshop(theWorkshop) -{ -} +PartSet_WidgetFileSelector::PartSet_WidgetFileSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetFileSelector(theParent, theData), + myWorkshop(theWorkshop) {} -bool PartSet_WidgetFileSelector::restoreValueCustom() -{ +bool PartSet_WidgetFileSelector::restoreValueCustom() { // A rare case when plugin was not loaded. if (!myFeature) return false; DataPtr aData = myFeature->data(); - AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()); - mySelectedFilter = - formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value()))); + AttributeStringPtr aStringAttr = + aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()); + mySelectedFilter = formatToFilter( + shortFormatToFullFormat(QString::fromStdString(aStringAttr->value()))); return ModuleBase_WidgetFileSelector::restoreValueCustom(); } -bool PartSet_WidgetFileSelector::storeValueCustom() -{ +bool PartSet_WidgetFileSelector::storeValueCustom() { // A rare case when plugin was not loaded. if (!myFeature) return false; DataPtr aData = myFeature->data(); - AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()); + AttributeStringPtr aStringAttr = + aData->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()); aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString()); return ModuleBase_WidgetFileSelector::storeValueCustom(); } -QString PartSet_WidgetFileSelector::shortFormatToFullFormat( const QString & theFormat ) const -{ - foreach(const QString & eachFormat, getValidatorFormats()) +QString PartSet_WidgetFileSelector::shortFormatToFullFormat( + const QString &theFormat) const { + foreach (const QString &eachFormat, getValidatorFormats()) if (filterToShortFormat(formatToFilter(eachFormat)) == theFormat) return eachFormat; return QString(); diff --git a/src/PartSet/PartSet_WidgetFileSelector.h b/src/PartSet/PartSet_WidgetFileSelector.h index 55c925e37..cad7690c5 100644 --- a/src/PartSet/PartSet_WidgetFileSelector.h +++ b/src/PartSet/PartSet_WidgetFileSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARTSET_WIDGETFILESELECTOR_H_ @@ -27,21 +28,22 @@ class ModuleBase_IWorkshop; /** -* \ingroup Modules -* Customization of ModuleBase_WidgetFileSelector in order to write -* format of exported file. -*/ -class PARTSET_EXPORT PartSet_WidgetFileSelector : public ModuleBase_WidgetFileSelector -{ + * \ingroup Modules + * Customization of ModuleBase_WidgetFileSelector in order to write + * format of exported file. + */ +class PARTSET_EXPORT PartSet_WidgetFileSelector + : public ModuleBase_WidgetFileSelector { Q_OBJECT public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuration. The attribute of the model widget is obtained from - PartSet_WidgetFileSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuration. The attribute of the model widget + /// is obtained from + PartSet_WidgetFileSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~PartSet_WidgetFileSelector() {} @@ -53,10 +55,10 @@ protected: virtual bool restoreValueCustom(); /// Returns a full format string for the short format - QString shortFormatToFullFormat( const QString & theShortFormat ) const; + QString shortFormatToFullFormat(const QString &theShortFormat) const; private: - ModuleBase_IWorkshop* myWorkshop; // the current workshop + ModuleBase_IWorkshop *myWorkshop; // the current workshop }; #endif /* PARTSET_WIDGETFILESELECTOR_H_ */ diff --git a/src/PartSet/PartSet_WidgetMultiSelector.cpp b/src/PartSet/PartSet_WidgetMultiSelector.cpp index 31dcaae9e..496e108b5 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.cpp +++ b/src/PartSet/PartSet_WidgetMultiSelector.cpp @@ -14,28 +14,29 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetMultiSelector.h" #include -#include #include +#include #include #include #include -#include -#include #include +#include +#include #include #include #include -#include #include +#include #include #include @@ -44,23 +45,22 @@ #include -PartSet_WidgetMultiSelector::PartSet_WidgetMultiSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetMultiSelector(theParent, theWorkshop, theData) -{ - myExternalObjectMgr = new PartSet_ExternalObjectsMgr(theData->getProperty("use_external"), - theData->getProperty("can_create_external"), false); +PartSet_WidgetMultiSelector::PartSet_WidgetMultiSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetMultiSelector(theParent, theWorkshop, theData) { + myExternalObjectMgr = new PartSet_ExternalObjectsMgr( + theData->getProperty("use_external"), + theData->getProperty("can_create_external"), false); } -PartSet_WidgetMultiSelector::~PartSet_WidgetMultiSelector() -{ +PartSet_WidgetMultiSelector::~PartSet_WidgetMultiSelector() { delete myExternalObjectMgr; } //******************************************************************** -bool PartSet_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_WidgetMultiSelector::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { bool aValid = false; if (thePrs.get() && thePrs->interactive().get() && thePrs->interactive()->IsKind(STANDARD_TYPE(PartSet_CenterPrs))) @@ -76,24 +76,23 @@ bool PartSet_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_Viewer } //******************************************************************** -void PartSet_WidgetMultiSelector::restoreAttributeValue(const AttributePtr& theAttribute, - const bool theValid) -{ +void PartSet_WidgetMultiSelector::restoreAttributeValue( + const AttributePtr &theAttribute, const bool theValid) { ModuleBase_WidgetMultiSelector::restoreAttributeValue(theAttribute, theValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); } -void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape) -{ +void PartSet_WidgetMultiSelector::getGeomSelection( + const ModuleBase_ViewerPrsPtr &thePrs, ObjectPtr &theObject, + GeomShapePtr &theShape) { ModuleBase_WidgetMultiSelector::getGeomSelection(thePrs, theObject, theShape); FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(theObject); std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aSelectedFeature); - // there is no a sketch feature is selected, but the shape exists, try to create an exernal object + std::dynamic_pointer_cast(aSelectedFeature); + // there is no a sketch feature is selected, but the shape exists, try to + // create an exernal object // TODO: unite with the same functionality in PartSet_WidgetShapeSelector if (aSPFeature.get() == NULL) { ObjectPtr anExternalObject = ObjectPtr(); @@ -107,16 +106,16 @@ void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr aShape = aResult->shape(); } if (aShape.get() != NULL && !aShape->isNull()) - anExternalObject = - myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate); - } - else { + anExternalObject = myExternalObjectMgr->externalObject( + theObject, aShape, sketch(), myIsInValidate); + } else { anExternalObject = theObject; anExternalShape = theShape; } } - /// the object is null if the selected feature is "external"(not sketch entity feature of the - /// current sketch) and it is not created by object manager + /// the object is null if the selected feature is "external"(not sketch + /// entity feature of the current sketch) and it is not created by object + /// manager theObject = anExternalObject; theShape = anExternalShape; } diff --git a/src/PartSet/PartSet_WidgetMultiSelector.h b/src/PartSet/PartSet_WidgetMultiSelector.h index 078c529d4..1f7adf5fb 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.h +++ b/src/PartSet/PartSet_WidgetMultiSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetMultiSelector_H @@ -30,20 +31,22 @@ class PartSet_ExternalObjectsMgr; class ModuleBase_ViewerPrs; /** -* \ingroup Modules -* Customosation of ModuleBase_WidgetMultiSelector in order to provide -* working with sketch specific objects and creation of external objects. -*/ -class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetMultiSelector -{ -Q_OBJECT - public: + * \ingroup Modules + * Customosation of ModuleBase_WidgetMultiSelector in order to provide + * working with sketch specific objects and creation of external objects. + */ +class PARTSET_EXPORT PartSet_WidgetMultiSelector + : public ModuleBase_WidgetMultiSelector { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetMultiSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~PartSet_WidgetMultiSelector(); @@ -61,29 +64,31 @@ protected: /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + isValidSelectionCustom(const std::shared_ptr &thePrs); /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); + virtual void restoreAttributeValue(const AttributePtr &theAttribute, + const bool theValid); /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void getGeomSelection(const std::shared_ptr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape); + virtual void + getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape); protected: /// Manager of external objects - PartSet_ExternalObjectsMgr* myExternalObjectMgr; + PartSet_ExternalObjectsMgr *myExternalObjectMgr; /// Pointer to a sketch CompositeFeaturePtr mySketch; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp b/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp index 0d74d2a6f..71e26bc3f 100644 --- a/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp +++ b/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp @@ -14,54 +14,47 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetPoint2DFlyout.h" -#include "ModuleBase_WidgetValidator.h" #include "ModuleBase_ViewerPrs.h" +#include "ModuleBase_WidgetValidator.h" -#include -#include #include +#include +#include -#include #include +#include #include - -PartSet_WidgetPoint2DFlyout::PartSet_WidgetPoint2DFlyout(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) - : PartSet_WidgetPoint2D(theParent, theWorkshop, theData) -{ +PartSet_WidgetPoint2DFlyout::PartSet_WidgetPoint2DFlyout( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : PartSet_WidgetPoint2D(theParent, theWorkshop, theData) { myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop); } -bool PartSet_WidgetPoint2DFlyout::setSelection(QList& theValues, - const bool theToValidate) -{ +bool PartSet_WidgetPoint2DFlyout::setSelection( + QList &theValues, const bool theToValidate) { PartSet_WidgetPoint2D::setSelection(theValues, theToValidate); - // true value should be returned to set this control as processed the selection - // to move focus to the next control if it is filled by preselection + // true value should be returned to set this control as processed the + // selection to move focus to the next control if it is filled by preselection return true; } bool PartSet_WidgetPoint2DFlyout::isValidSelectionCustom( - const std::shared_ptr& theValue) -{ + const std::shared_ptr &theValue) { return false; } -bool PartSet_WidgetPoint2DFlyout::useSelectedShapes() const -{ - return false; -} +bool PartSet_WidgetPoint2DFlyout::useSelectedShapes() const { return false; } -bool PartSet_WidgetPoint2DFlyout::focusTo() -{ +bool PartSet_WidgetPoint2DFlyout::focusTo() { bool aCanAcceptFocus = true; if (isInternal() && isComputedDefault()) { AISObjectPtr anObject = workshop()->displayer()->getAISObject(feature()); @@ -72,8 +65,8 @@ bool PartSet_WidgetPoint2DFlyout::focusTo() return aCanAcceptFocus; } -XGUI_Workshop* PartSet_WidgetPoint2DFlyout::workshop() const -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); +XGUI_Workshop *PartSet_WidgetPoint2DFlyout::workshop() const { + XGUI_ModuleConnector *aConnector = + dynamic_cast(myWorkshop); return aConnector->workshop(); } diff --git a/src/PartSet/PartSet_WidgetPoint2DFlyout.h b/src/PartSet/PartSet_WidgetPoint2DFlyout.h index 03fe0b177..7467d2050 100644 --- a/src/PartSet/PartSet_WidgetPoint2DFlyout.h +++ b/src/PartSet/PartSet_WidgetPoint2DFlyout.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetPoint2DFlyout_H @@ -27,46 +28,52 @@ class XGUI_Workshop; /**\class PartSet_WidgetPoint2DFlyout * \ingroup Modules - * \brief Implementation of usual point 2d widget with a condition that it can not accept the focus - * when the AIS presentation is not visualized in the viewer. + * \brief Implementation of usual point 2d widget with a condition that it can + * not accept the focus when the AIS presentation is not visualized in the + * viewer. */ -class PARTSET_EXPORT PartSet_WidgetPoint2DFlyout : public PartSet_WidgetPoint2D -{ +class PARTSET_EXPORT PartSet_WidgetPoint2DFlyout + : public PartSet_WidgetPoint2D { Q_OBJECT public: /// Constructor /// \param theParent the parent object /// \param theWorkshop a current workshop - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetPoint2DFlyout(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetPoint2DFlyout(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); /// Destructor - virtual ~PartSet_WidgetPoint2DFlyout() {}; + virtual ~PartSet_WidgetPoint2DFlyout(){}; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped widget values /// \param theToValidate a validation flag - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& theValue); + virtual bool + isValidSelectionCustom(const std::shared_ptr &theValue); - /// Activates the editor control only in case if the mouse over the OCC window, otherwise - /// set focus to the usual double value control - /// \return the state whether the widget can accept the focus + /// Activates the editor control only in case if the mouse over the OCC + /// window, otherwise set focus to the usual double value control \return the + /// state whether the widget can accept the focus virtual bool focusTo(); - /// Returns true if the attribute can be changed using the selected shapes in the viewer - /// and creating a coincidence constraint to them. This control does not use them. + /// Returns true if the attribute can be changed using the selected shapes in + /// the viewer and creating a coincidence constraint to them. This control + /// does not use them. virtual bool useSelectedShapes() const; private: //! Returns workshop - XGUI_Workshop* workshop() const; + XGUI_Workshop *workshop() const; }; #endif diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index d8b66b2bb..a13095ba1 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -14,69 +14,70 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetPoint2d.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 #include #include -#include -#include -#include #include #include +#include +#include +#include #include -#include +#include +#include #include +#include #include -#include #include -#include -#include -#include #include #include +#include +#include #include #include @@ -85,22 +86,22 @@ const double MaxCoordinate = 1e12; static QStringList MyFeaturesForCoincedence; -PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), - myValueIsCashed(false), myIsFeatureVisibleInCash(true), - myXValueInCash(0), myYValueInCash(0) -{ +PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), + myValueIsCashed(false), myIsFeatureVisibleInCash(true), myXValueInCash(0), + myYValueInCash(0) { myRefAttribute = theData->getProperty("reference_attribute"); if (MyFeaturesForCoincedence.isEmpty()) { MyFeaturesForCoincedence << SketchPlugin_Line::ID().c_str() - << SketchPlugin_Arc::ID().c_str() - << SketchPlugin_Point::ID().c_str() - << SketchPlugin_Circle::ID().c_str(); + << SketchPlugin_Arc::ID().c_str() + << SketchPlugin_Point::ID().c_str() + << SketchPlugin_Circle::ID().c_str(); } - // the control should accept the focus, so the boolean flag is corrected to be true + // the control should accept the focus, so the boolean flag is corrected to be + // true myIsObligatory = true; QString aPageName = translate(theData->getProperty(CONTAINER_PAGE_NAME)); myGroupBox = new QGroupBox(aPageName, theParent); @@ -109,9 +110,9 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, #ifdef _DEBUG bool aAcceptVariables = #endif - theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); - QGridLayout* aGroupLay = new QGridLayout(myGroupBox); + QGridLayout *aGroupLay = new QGridLayout(myGroupBox); ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setSpacing(2); aGroupLay->setColumnStretch(1, 1); @@ -121,27 +122,31 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myYSpin = new ModuleBase_LabelValue(myGroupBox, tr("Y")); aGroupLay->addWidget(myYSpin, 1, 1); - QVBoxLayout* aLayout = new QVBoxLayout(this); + QVBoxLayout *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->addWidget(myGroupBox); setLayout(aLayout); myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop); - myExternalObjectMgr = new PartSet_ExternalObjectsMgr(theData->getProperty("use_external"), - theData->getProperty("can_create_external"), true); + myExternalObjectMgr = new PartSet_ExternalObjectsMgr( + theData->getProperty("use_external"), + theData->getProperty("can_create_external"), true); } -bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); +bool PartSet_WidgetPoint2D::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &theValue) { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) - return true; /// when internal edit is started a new feature is created. I has not results, AIS + return true; /// when internal edit is started a new feature is created. I + /// has not results, AIS - /// the selection is not possible if the current feature has no presentation for the current - /// attribute not in AIS not in results. If so, no object in current feature where make - /// coincidence, so selection is not necessary + /// the selection is not possible if the current feature has no presentation + /// for the current attribute not in AIS not in results. If so, no object in + /// current feature where make coincidence, so selection is not necessary GeomShapePtr anAISShape; - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(myFeature); + GeomPresentablePtr aPrs = + std::dynamic_pointer_cast(myFeature); if (aPrs.get()) { AISObjectPtr anAIS; anAIS = aPrs->getAISObject(anAIS); @@ -149,28 +154,31 @@ bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr anAISShape = anAIS->getShape(); } } - const std::list >& aResults = myFeature->results(); + const std::list> &aResults = + myFeature->results(); if (!anAISShape.get() && aResults.empty()) return true; AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (aRefAttr.get()) - return isValidSelectionForAttribute_(theValue, myFeature->attribute(attributeID())); + return isValidSelectionForAttribute_(theValue, + myFeature->attribute(attributeID())); else { bool aFoundPoint = false; - /// Avoid coincidence build to passed point. Coincidence is build later only if there are no - /// reference attribute. - /// The condition is that the selected feature has shape that has after explore a point - /// equal to clicked one. + /// Avoid coincidence build to passed point. Coincidence is build later only + /// if there are no reference attribute. The condition is that the selected + /// feature has shape that has after explore a point equal to clicked one. std::shared_ptr aData = myFeature->data(); - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast( - aData->attribute(attributeID())); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast( + aData->attribute(attributeID())); std::shared_ptr aPoint = aPointAttr->pnt(); if (anAISShape.get()) aFoundPoint = shapeExploreHasVertex(anAISShape, aPoint, mySketch); /// analysis of results - std::list >::const_iterator aRIter = aResults.cbegin(); + std::list>::const_iterator aRIter = + aResults.cbegin(); for (; aRIter != aResults.cend() && !aFoundPoint; aRIter++) { ResultPtr aResult = *aRIter; if (aResult.get() && aResult->shape().get()) { @@ -185,17 +193,17 @@ bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr //******************************************************************** bool PartSet_WidgetPoint2D::isValidSelectionForAttribute_( - const ModuleBase_ViewerPrsPtr& theValue, - const AttributePtr& theAttribute) -{ + const ModuleBase_ViewerPrsPtr &theValue, const AttributePtr &theAttribute) { bool aValid = false; // stores the current values of the widget attribute - bool isFlushesActived, isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked; + bool isFlushesActived, isAttributeSetInitializedBlocked, + isAttributeSendUpdatedBlocked; AttributeRefAttrPtr aRefAttr = attributeRefAttr(); - ModuleBase_WidgetValidated::blockFeatureAttribute(aRefAttr, myFeature, true, - isFlushesActived, isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); + ModuleBase_WidgetValidated::blockFeatureAttribute( + aRefAttr, myFeature, true, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); myWidgetValidator->storeAttributeValue(aRefAttr); // saves the owner value to the widget attribute @@ -208,24 +216,24 @@ bool PartSet_WidgetPoint2D::isValidSelectionForAttribute_( myWidgetValidator->restoreAttributeValue(aRefAttr, aValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); - ModuleBase_WidgetValidated::blockFeatureAttribute(aRefAttr, myFeature, false, isFlushesActived, - isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); + ModuleBase_WidgetValidated::blockFeatureAttribute( + aRefAttr, myFeature, false, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); return aValid; } -bool PartSet_WidgetPoint2D::setSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) -{ +bool PartSet_WidgetPoint2D::setSelectionCustom( + const ModuleBase_ViewerPrsPtr &theValue) { bool isDone = false; GeomShapePtr aShape = theValue->shape(); if (aShape.get() && !aShape->isNull()) { Handle(V3d_View) aView = myWorkshop->viewer()->activeView(); - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); if (aPnt) { fillRefAttribute(aPnt->x(), aPnt->y(), theValue); isDone = true; - } - else if (aTDShape.ShapeType() == TopAbs_EDGE) { + } else if (aTDShape.ShapeType() == TopAbs_EDGE) { fillRefAttribute(theValue); isDone = true; } @@ -233,30 +241,28 @@ bool PartSet_WidgetPoint2D::setSelectionCustom(const ModuleBase_ViewerPrsPtr& th return isDone; } -bool PartSet_WidgetPoint2D::resetCustom() -{ +bool PartSet_WidgetPoint2D::resetCustom() { bool aDone = false; if (!isUseReset() || isComputedDefault() /*|| myXSpin->hasVariable() || myYSpin->hasVariable()*/) { aDone = false; - } - else { + } else { if (myValueIsCashed) { // if the restored value should be hidden, aDone = true to set // reset state for the widget in the parent aDone = restoreCurentValue(); emit objectUpdated(); - } - else { + } else { bool isOk; - double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk); - // it is important to block the spin box control in order to do not through out the - // locking of the validating state. + double aDefValue = + QString::fromStdString(getDefaultValue()).toDouble(&isOk); + // it is important to block the spin box control in order to do not + // through out the locking of the validating state. myXSpin->setValue(isOk ? aDefValue : 0.0); myYSpin->setValue(isOk ? aDefValue : 0.0); - //ModuleBase_Tools::setSpinValue(myXSpin, isOk ? aDefValue : 0.0); - //ModuleBase_Tools::setSpinValue(myYSpin, isOk ? aDefValue : 0.0); + // ModuleBase_Tools::setSpinValue(myXSpin, isOk ? aDefValue : 0.0); + // ModuleBase_Tools::setSpinValue(myYSpin, isOk ? aDefValue : 0.0); storeValueCustom(); aDone = true; } @@ -264,14 +270,10 @@ bool PartSet_WidgetPoint2D::resetCustom() return aDone; } -PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D() -{ - delete myExternalObjectMgr; -} +PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D() { delete myExternalObjectMgr; } -bool PartSet_WidgetPoint2D::setSelection(QList& theValues, - const bool theToValidate) -{ +bool PartSet_WidgetPoint2D::setSelection( + QList &theValues, const bool theToValidate) { bool isDone = false; if (theValues.empty()) return isDone; @@ -282,12 +284,12 @@ bool PartSet_WidgetPoint2D::setSelection(QList& theValu GeomShapePtr aShape = aValue->shape(); if (aShape.get() && !aShape->isNull()) { Handle(V3d_View) aView = myWorkshop->viewer()->activeView(); - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); if (aPnt) { - //isDone = setPoint(aPnt->x(), aPnt->y()); - //setConstraintToPoint(aPnt->x(), aPnt->y(), aValue); + // isDone = setPoint(aPnt->x(), aPnt->y()); + // setConstraintToPoint(aPnt->x(), aPnt->y(), aValue); processSelection(aValue, aPnt->x(), aPnt->y()); isDone = true; } @@ -296,13 +298,12 @@ bool PartSet_WidgetPoint2D::setSelection(QList& theValu return isDone; } -//void PartSet_WidgetPoint2D::selectContent() +// void PartSet_WidgetPoint2D::selectContent() //{ -// // myXSpin->selectAll(); -//} +// // myXSpin->selectAll(); +// } -bool PartSet_WidgetPoint2D::setPoint(double theX, double theY) -{ +bool PartSet_WidgetPoint2D::setPoint(double theX, double theY) { if (fabs(theX) >= MaxCoordinate) return false; if (fabs(theY) >= MaxCoordinate) @@ -311,34 +312,36 @@ bool PartSet_WidgetPoint2D::setPoint(double theX, double theY) myXSpin->setValue(theX); myYSpin->setValue(theY); - //ModuleBase_Tools::setSpinValue(myXSpin, theX); - //ModuleBase_Tools::setSpinValue(myYSpin, theY); + // ModuleBase_Tools::setSpinValue(myXSpin, theX); + // ModuleBase_Tools::setSpinValue(myYSpin, theY); storeValue(); return true; } -bool PartSet_WidgetPoint2D::storeValueCustom() -{ +bool PartSet_WidgetPoint2D::storeValueCustom() { std::shared_ptr aData = myFeature->data(); if (!aData || !aData->isValid()) // can be on abort of sketcher element return false; AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( aData->attribute(attributeID())); - PartSet_WidgetPoint2D* that = (PartSet_WidgetPoint2D*) this; + PartSet_WidgetPoint2D *that = (PartSet_WidgetPoint2D *)this; bool isBlocked = that->blockSignals(true); bool isImmutable = aPoint->setImmutable(true); // if text is not empty then setValue will be ignored // so we should set the text at first - //aPoint->setText(myXSpin->hasVariable() ? myXSpin->text().toStdString() : "", - // myYSpin->hasVariable() ? myYSpin->text().toStdString() : ""); - //aPoint->setValue(!myXSpin->hasVariable() ? myXSpin->value() : aPoint->x(), + // aPoint->setText(myXSpin->hasVariable() ? myXSpin->text().toStdString() : + // "", + // myYSpin->hasVariable() ? myYSpin->text().toStdString() : + // ""); + // aPoint->setValue(!myXSpin->hasVariable() ? myXSpin->value() : aPoint->x(), // !myYSpin->hasVariable() ? myYSpin->value() : aPoint->y()); if (myFeature->isMacro()) { - // Moving points of macro-features has been processed directly (without solver) + // Moving points of macro-features has been processed directly (without + // solver) aPoint->setValue(myXSpin->value(), myYSpin->value()); updateObject(myFeature); @@ -360,8 +363,7 @@ bool PartSet_WidgetPoint2D::storeValueCustom() return true; } -bool PartSet_WidgetPoint2D::restoreValueCustom() -{ +bool PartSet_WidgetPoint2D::restoreValueCustom() { std::shared_ptr aData = myFeature->data(); AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( aData->attribute(attributeID())); @@ -373,21 +375,19 @@ bool PartSet_WidgetPoint2D::restoreValueCustom() return true; } -void PartSet_WidgetPoint2D::storeCurentValue() -{ +void PartSet_WidgetPoint2D::storeCurentValue() { // do not use cash if a variable is used - //if (myXSpin->hasVariable() || myYSpin->hasVariable()) + // if (myXSpin->hasVariable() || myYSpin->hasVariable()) // return; myValueIsCashed = true; myIsFeatureVisibleInCash = XGUI_Displayer::isVisible( - XGUI_Tools::workshop(myWorkshop)->displayer(), myFeature); + XGUI_Tools::workshop(myWorkshop)->displayer(), myFeature); myXValueInCash = myXSpin->value(); myYValueInCash = myYSpin->value(); } -bool PartSet_WidgetPoint2D::restoreCurentValue() -{ +bool PartSet_WidgetPoint2D::restoreCurentValue() { bool aRestoredAndHidden = true; bool isVisible = myIsFeatureVisibleInCash; @@ -397,40 +397,37 @@ bool PartSet_WidgetPoint2D::restoreCurentValue() myIsFeatureVisibleInCash = true; myXSpin->setValue(myXValueInCash); myYSpin->setValue(myYValueInCash); - //ModuleBase_Tools::setSpinValue(myXSpin, myXValueInCash); - //ModuleBase_Tools::setSpinValue(myYSpin, myYValueInCash); + // ModuleBase_Tools::setSpinValue(myXSpin, myXValueInCash); + // ModuleBase_Tools::setSpinValue(myYSpin, myYValueInCash); // store value to the model storeValueCustom(); if (isVisible) { setValueState(Stored); aRestoredAndHidden = false; - } - else + } else aRestoredAndHidden = true; return aRestoredAndHidden; } -QList PartSet_WidgetPoint2D::getControls() const -{ - QList aControls; +QList PartSet_WidgetPoint2D::getControls() const { + QList aControls; aControls.append(myXSpin); aControls.append(myYSpin); return aControls; } //******************************************************************** -void PartSet_WidgetPoint2D::selectionModes(int& theModuleSelectionModes, QIntList& theModes) -{ +void PartSet_WidgetPoint2D::selectionModes(int &theModuleSelectionModes, + QIntList &theModes) { theModuleSelectionModes = -1; theModes << TopAbs_VERTEX; theModes << TopAbs_EDGE; } //******************************************************************** -void PartSet_WidgetPoint2D::activateCustom() -{ +void PartSet_WidgetPoint2D::activateCustom() { if (!isEditingMode()) { FeaturePtr aFeature = feature(); if (aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID()) @@ -438,12 +435,9 @@ void PartSet_WidgetPoint2D::activateCustom() } } -void PartSet_WidgetPoint2D::setHighlighted(bool isHighlighted) -{ -} +void PartSet_WidgetPoint2D::setHighlighted(bool isHighlighted) {} -void PartSet_WidgetPoint2D::deactivate() -{ +void PartSet_WidgetPoint2D::deactivate() { // the value of the control should be stored to model if it was not // initialized yet. It is important when we leave this control by Tab key. // It should not be performed by the widget activation as the preview @@ -455,9 +449,9 @@ void PartSet_WidgetPoint2D::deactivate() ModuleBase_ModelWidget::deactivate(); } -bool PartSet_WidgetPoint2D::setConstraintToPoint(double theClickedX, double theClickedY, - const std::shared_ptr& theValue) -{ +bool PartSet_WidgetPoint2D::setConstraintToPoint( + double theClickedX, double theClickedY, + const std::shared_ptr &theValue) { AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (aRefAttr.get()) fillRefAttribute(theClickedX, theClickedY, theValue); @@ -468,54 +462,54 @@ bool PartSet_WidgetPoint2D::setConstraintToPoint(double theClickedX, double theC if (!aFeature.get()) return false; - std::shared_ptr aClickedPoint = std::shared_ptr( - new GeomAPI_Pnt2d(theClickedX, theClickedY)); - AttributePoint2DPtr aClickedFeaturePoint = findFirstEqualPointInSketch(mySketch, - aFeature, aClickedPoint); + std::shared_ptr aClickedPoint = + std::shared_ptr( + new GeomAPI_Pnt2d(theClickedX, theClickedY)); + AttributePoint2DPtr aClickedFeaturePoint = + findFirstEqualPointInSketch(mySketch, aFeature, aClickedPoint); if (!aClickedFeaturePoint.get()) return false; - // aRefAttr->setAttr(aClickedFeaturePoint); - //else { + // aRefAttr->setAttr(aClickedFeaturePoint); + // else { // find a feature point by the selection mode AttributePoint2DPtr aFeaturePoint; if (aFeature->isMacro()) { - // the macro feature will be removed after the operation is stopped, so we need to build - // coincidence to possible sub-features - aFeaturePoint = findFirstEqualPointInArgumentFeatures(aFeature, aClickedPoint); - } - else { - aFeaturePoint = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aFeature->data()->attribute(anAttribute)); + // the macro feature will be removed after the operation is stopped, so we + // need to build coincidence to possible sub-features + aFeaturePoint = + findFirstEqualPointInArgumentFeatures(aFeature, aClickedPoint); + } else { + aFeaturePoint = std::dynamic_pointer_cast( + aFeature->data()->attribute(anAttribute)); } if (!aFeaturePoint.get()) return false; - PartSet_Tools::createConstraint(mySketch, aClickedFeaturePoint, aFeaturePoint); + PartSet_Tools::createConstraint(mySketch, aClickedFeaturePoint, + aFeaturePoint); } return true; } -bool PartSet_WidgetPoint2D::setConstraintToObject(const ObjectPtr& theObject) -{ +bool PartSet_WidgetPoint2D::setConstraintToObject(const ObjectPtr &theObject) { AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (aRefAttr.get()) { fillRefAttribute(theObject); - } - else { + } else { AttributePoint2DPtr aFeaturePoint; if (feature()->isMacro()) { AttributePtr aThisAttr = feature()->data()->attribute(attributeID()); - AttributePoint2DPtr anAttrPoint = std::dynamic_pointer_cast(aThisAttr); + AttributePoint2DPtr anAttrPoint = + std::dynamic_pointer_cast(aThisAttr); if (anAttrPoint.get()) { - // the macro feature will be removed after the operation is stopped, so we need to build - // coincidence to possible sub-features - aFeaturePoint = findFirstEqualPointInArgumentFeatures(feature(), - anAttrPoint->pnt()); + // the macro feature will be removed after the operation is stopped, so + // we need to build coincidence to possible sub-features + aFeaturePoint = findFirstEqualPointInArgumentFeatures( + feature(), anAttrPoint->pnt()); } - } - else { + } else { AttributePtr aThisAttr = feature()->data()->attribute(attributeID()); aFeaturePoint = std::dynamic_pointer_cast(aThisAttr); } @@ -523,46 +517,52 @@ bool PartSet_WidgetPoint2D::setConstraintToObject(const ObjectPtr& theObject) return false; // Create point-edge coincedence - FeaturePtr aFeature = mySketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + FeaturePtr aFeature = + mySketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); std::shared_ptr aData = aFeature->data(); - std::shared_ptr aRef1 = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::shared_ptr aRef1 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); aRef1->setAttr(aFeaturePoint); - std::shared_ptr aRef2 = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + std::shared_ptr aRef2 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_B())); aRef2->setObject(theObject); - // we need to flush created signal in order to coincidence is processed by solver + // we need to flush created signal in order to coincidence is processed by + // solver Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); } return true; } -void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) -{ - // the contex menu release by the right button should not be processed by this widget +void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) { + // the contex menu release by the right button should not be processed by this + // widget if (theEvent->button() != Qt::LeftButton) return; - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); Handle(V3d_View) aView = theWindow->v3dView(); - QList aList = aSelection->getSelected(ModuleBase_ISelection::Viewer); + QList aList = + aSelection->getSelected(ModuleBase_ISelection::Viewer); ModuleBase_ViewerPrsPtr aFirstValue = - aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr(); + aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr(); if (!aFirstValue.get() && myPreSelected.get()) { aFirstValue = myPreSelected; } - double aX=0, aY=0; + double aX = 0, aY = 0; bool aHasPoint = false; if (aFirstValue.get()) { GeomShapePtr aShape = aFirstValue->shape(); if (aShape.get() && aShape->shapeType() == GeomAPI_Shape::VERTEX) { - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); aX = aPnt->x(); aY = aPnt->y(); @@ -576,13 +576,13 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo processSelection(aFirstValue, aX, aY); } -void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theValue, - double theX, double theY) -{ +void PartSet_WidgetPoint2D::processSelection( + const ModuleBase_ViewerPrsPtr &theValue, double theX, double theY) { if (!setPoint(theX, theY)) return; // if we have selection and use it - if (theValue.get() && isValidSelectionCustom(theValue) && theValue->shape().get()) { + if (theValue.get() && isValidSelectionCustom(theValue) && + theValue->shape().get()) { /// Trihedron Axis may be selected, but shape is empty GeomShapePtr aGeomShape = theValue->shape(); TopoDS_Shape aShape = aGeomShape->impl(); @@ -592,47 +592,54 @@ void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theV bool anExternal = false; std::shared_ptr aSPFeature; if (aSelectedFeature.get() != NULL) - aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); + aSPFeature = + std::dynamic_pointer_cast(aSelectedFeature); ResultPtr aFixedObject; bool aSketchExternalFeature = aSPFeature.get() && aSPFeature->isExternal(); if ((!aSPFeature && !aShape.IsNull()) || aSketchExternalFeature) { - aFixedObject = PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch); - if (aSketchExternalFeature && !aFixedObject.get()) {/// local selection on external feature + aFixedObject = + PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch); + if (aSketchExternalFeature && + !aFixedObject.get()) { /// local selection on external feature anExternal = false; - } - else { + } else { anExternal = true; - if (!aFixedObject.get()) - { + if (!aFixedObject.get()) { FeaturePtr aCreatedFeature; - aFixedObject = PartSet_Tools::createFixedObjectByExternal(aGeomShape, aObject, mySketch, - false, aCreatedFeature); + aFixedObject = PartSet_Tools::createFixedObjectByExternal( + aGeomShape, aObject, mySketch, false, aCreatedFeature); } } } if (anExternal) { if (!isFeatureContainsPoint(myFeature, theX, theY)) { if (aShape.ShapeType() == TopAbs_EDGE) { - setValueState(Stored); // in case of edge selection, Apply state should also be updated + setValueState(Stored); // in case of edge selection, Apply state + // should also be updated } - bool anOrphanPoint = aShape.ShapeType() == TopAbs_VERTEX || - isOrphanPoint(aSelectedFeature, mySketch, theX, theY); + bool anOrphanPoint = + aShape.ShapeType() == TopAbs_VERTEX || + isOrphanPoint(aSelectedFeature, mySketch, theX, theY); if (anExternal) { // we should not stop reentrant operation on external objects because anOrphanPoint = true; - // they are not participate in the contour creation excepting external vertices + // they are not participate in the contour creation excepting external + // vertices if (aShape.ShapeType() == TopAbs_VERTEX) { FeaturePtr aFixedFeature = ModelAPI_Feature::feature(aFixedObject); - if (aFixedFeature.get() && aFixedFeature->getKind() == SketchPlugin_Point::ID()) { - anOrphanPoint = isOrphanPoint(aFixedFeature, mySketch, theX, theY); + if (aFixedFeature.get() && + aFixedFeature->getKind() == SketchPlugin_Point::ID()) { + anOrphanPoint = + isOrphanPoint(aFixedFeature, mySketch, theX, theY); } } } if (aFixedObject.get()) setConstraintToObject(aFixedObject); - // fignal updated should be flushed in order to visualize possible created - // external objects e.g. selection of trihedron axis when input end arc point + // fignal updated should be flushed in order to visualize possible + // created external objects e.g. selection of trihedron axis when input + // end arc point updateObject(feature()); if (!anOrphanPoint) @@ -641,32 +648,33 @@ void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theV myPreSelected.reset(); emit focusOutWidget(this); } - } - else { + } else { if (!isFeatureContainsPoint(myFeature, theX, theY)) { double aX = 0, aY = 0; bool anOrphanPoint = isOrphanPoint(aSelectedFeature, mySketch, aX, aY); - // do not set a coincidence constraint in the attribute if the feature contains a point - // with the same coordinates. It is important for line creation in order to do not set - // the same constraints for the same points, oterwise the result line has zero length. + // do not set a coincidence constraint in the attribute if the feature + // contains a point with the same coordinates. It is important for line + // creation in order to do not set the same constraints for the same + // points, oterwise the result line has zero length. bool isAuxiliaryFeature = false; if (aShape.ShapeType() == TopAbs_VERTEX) { setConstraintToPoint(theX, theY, theValue); - } - else if (aShape.ShapeType() == TopAbs_EDGE) { - // point is taken from mouse event and set in attribute. It should be done before setting - // coinident constraint to the external line. If a point is created, it should be in - // the mouse clicked point + } else if (aShape.ShapeType() == TopAbs_EDGE) { + // point is taken from mouse event and set in attribute. It should be + // done before setting coinident constraint to the external line. If a + // point is created, it should be in the mouse clicked point setConstraintToObject(aObject); - setValueState(Stored); // in case of edge selection, Apply state should also be updated + setValueState(Stored); // in case of edge selection, Apply state + // should also be updated isAuxiliaryFeature = PartSet_Tools::isAuxiliarySketchEntity(aObject); } - // it is important to perform updateObject() in order to the current value is - // processed by Sketch Solver. Test case: line is created from a previous point - // to some distance, but in the area of the highlighting of the point. Constraint - // coincidence is created, after the solver is performed, the distance between the - // points of the line becomes less than the tolerance. Validator of the line returns - // false, the line will be aborted, but sketch stays valid. + // it is important to perform updateObject() in order to the current + // value is processed by Sketch Solver. Test case: line is created from + // a previous point to some distance, but in the area of the + // highlighting of the point. Constraint coincidence is created, after + // the solver is performed, the distance between the points of the line + // becomes less than the tolerance. Validator of the line returns false, + // the line will be aborted, but sketch stays valid. updateObject(feature()); if (!anOrphanPoint && !anExternal && !isAuxiliaryFeature) emit vertexSelected(); @@ -681,29 +689,30 @@ void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theV Handle(PartSet_CenterPrs)::DownCast(theValue->interactive()); if (!aAIS.IsNull()) { gp_Pnt aPntComp = aAIS->Component()->Pnt(); - GeomVertexPtr aVertPtr(new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); + GeomVertexPtr aVertPtr( + new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); TopoDS_Shape aShape = aVertPtr->impl(); - ResultPtr aFixedObject = - PartSet_Tools::findFixedObjectByExternal(aShape, aAIS->object(), mySketch); - if (!aFixedObject.get()) - { + ResultPtr aFixedObject = PartSet_Tools::findFixedObjectByExternal( + aShape, aAIS->object(), mySketch); + if (!aFixedObject.get()) { FeaturePtr aCreatedFeature; - aFixedObject = PartSet_Tools::createFixedByExternalCenter(aAIS->object(), aAIS->edge(), - aAIS->centerType(), mySketch, false, aCreatedFeature); + aFixedObject = PartSet_Tools::createFixedByExternalCenter( + aAIS->object(), aAIS->edge(), aAIS->centerType(), mySketch, false, + aCreatedFeature); } if (aFixedObject.get()) setConstraintToObject(aFixedObject); // fignal updated should be flushed in order to visualize possible created - // external objects e.g. selection of trihedron axis when input end arc point + // external objects e.g. selection of trihedron axis when input end arc + // point updateObject(feature()); emit vertexSelected(); // it stops the reentrant operation myPreSelected.reset(); emit focusOutWidget(this); } - } - else { + } else { // A case when point is taken from mouse event // if the feature contains the point, focus is not switched @@ -716,29 +725,29 @@ void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theV } void PartSet_WidgetPoint2D::setPreSelection( - const std::shared_ptr& thePreSelected, - ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent) -{ + const std::shared_ptr &thePreSelected, + ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent) { myPreSelected = thePreSelected; mouseReleased(theWnd, theEvent); } -void PartSet_WidgetPoint2D::getGeomSelection_(const std::shared_ptr& theValue, - ObjectPtr& theObject, - GeomShapePtr& theShape) -{ - myExternalObjectMgr->getGeomSelection(theValue, theObject, theShape, myWorkshop, sketch(), true); +void PartSet_WidgetPoint2D::getGeomSelection_( + const std::shared_ptr &theValue, ObjectPtr &theObject, + GeomShapePtr &theShape) { + myExternalObjectMgr->getGeomSelection(theValue, theObject, theShape, + myWorkshop, sketch(), true); } -void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); +void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) return; - gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); + gp_Pnt aPoint = + PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); double aX = 0, aY = 0; PartSet_Tools::convertTo2D(aPoint, mySketch, theWindow->v3dView(), aX, aY); @@ -751,20 +760,12 @@ void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow* theWindow, QMouse setValueState(ModifiedInViewer); } -double PartSet_WidgetPoint2D::x() const -{ - return myXSpin->value(); -} +double PartSet_WidgetPoint2D::x() const { return myXSpin->value(); } -double PartSet_WidgetPoint2D::y() const -{ - return myYSpin->value(); -} +double PartSet_WidgetPoint2D::y() const { return myYSpin->value(); } - -bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature, - double theX, double theY) -{ +bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr &theFeature, + double theX, double theY) { bool aPointIsFound = false; if (feature()->getKind() != SketchPlugin_Line::ID()) @@ -773,13 +774,13 @@ bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature, AttributePtr aWidgetAttribute = myFeature->attribute(attributeID()); std::shared_ptr aPnt2d = - std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); + std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); std::list anAttributes = - myFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + myFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list::iterator anIter = anAttributes.begin(); - for(; anIter != anAttributes.end() && !aPointIsFound; anIter++) { + for (; anIter != anAttributes.end() && !aPointIsFound; anIter++) { AttributePoint2DPtr aPoint2DAttribute = - std::dynamic_pointer_cast(*anIter); + std::dynamic_pointer_cast(*anIter); if (aPoint2DAttribute == aWidgetAttribute) continue; if (aPoint2DAttribute.get() && aPoint2DAttribute->isInitialized()) { @@ -789,17 +790,14 @@ bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature, return aPointIsFound; } -void PartSet_WidgetPoint2D::initializeValueByActivate() -{ -} +void PartSet_WidgetPoint2D::initializeValueByActivate() {} /*void PartSet_WidgetPoint2D::onValuesChanged() { emit valuesChanged(); }*/ -bool PartSet_WidgetPoint2D::processEnter() -{ +bool PartSet_WidgetPoint2D::processEnter() { return false; /*bool isModified = getValueState() == ModifiedInPP; if (isModified) { @@ -813,57 +811,55 @@ bool PartSet_WidgetPoint2D::processEnter() return isModified;*/ } -bool PartSet_WidgetPoint2D::useSelectedShapes() const -{ - return true; -} +bool PartSet_WidgetPoint2D::useSelectedShapes() const { return true; } -bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature, - const CompositeFeaturePtr& theSketch, - double theX, double theY) -{ +bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr &theFeature, + const CompositeFeaturePtr &theSketch, + double theX, double theY) { bool anOrphanPoint = false; if (theFeature.get()) { AttributePoint2DPtr aPointAttr; std::string aFeatureKind = theFeature->getKind(); if (aFeatureKind == SketchPlugin_Point::ID()) aPointAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Point::COORD_ID())); + theFeature->attribute(SketchPlugin_Point::COORD_ID())); else if (aFeatureKind == SketchPlugin_Circle::ID()) aPointAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Circle::CENTER_ID())); + theFeature->attribute(SketchPlugin_Circle::CENTER_ID())); else if (aFeatureKind == SketchPlugin_Arc::ID()) aPointAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Arc::CENTER_ID())); + theFeature->attribute(SketchPlugin_Arc::CENTER_ID())); - /// check that the geometry point with the given coordinates is the checked point - /// e.g. in arc the (x,y) point can not coicide to the center point and it automatically - /// means that this point is not an orphant one. + /// check that the geometry point with the given coordinates is the checked + /// point e.g. in arc the (x,y) point can not coicide to the center point + /// and it automatically means that this point is not an orphant one. if (aPointAttr.get()) { - std::shared_ptr aCheckedPoint = std::shared_ptr( - new GeomAPI_Pnt2d(theX, theY)); + std::shared_ptr aCheckedPoint = + std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); if (!aCheckedPoint->isEqual(aPointAttr->pnt())) return anOrphanPoint; } if (aPointAttr.get()) { std::shared_ptr aPoint = aPointAttr->pnt(); - // we need to find coincidence features in results also, because external object(point) - // uses refs to me in another feature. - FeaturePtr aCoincidence = PartSet_Tools::findFirstCoincidence(theFeature, aPoint); + // we need to find coincidence features in results also, because external + // object(point) uses refs to me in another feature. + FeaturePtr aCoincidence = + PartSet_Tools::findFirstCoincidence(theFeature, aPoint); anOrphanPoint = true; - // if there is at least one concident line to the point, the point is not an orphant + // if there is at least one concident line to the point, the point is not + // an orphant if (aCoincidence.get()) { QList aCoinsideLines; QList aCoins; QList anIsAttributes; - PartSet_Tools::findCoincidences(aCoincidence, aCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), - anIsAttributes); - PartSet_Tools::findCoincidences(aCoincidence, aCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), - anIsAttributes); + PartSet_Tools::findCoincidences( + aCoincidence, aCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_A(), anIsAttributes); + PartSet_Tools::findCoincidences( + aCoincidence, aCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_B(), anIsAttributes); QList::const_iterator anIt = aCoinsideLines.begin(), aLast = aCoinsideLines.end(); for (; anIt != aLast && anOrphanPoint; anIt++) { @@ -875,25 +871,26 @@ bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature, return anOrphanPoint; } -bool PartSet_WidgetPoint2D::shapeExploreHasVertex(const GeomShapePtr& theShape, - const std::shared_ptr& thePoint, - const CompositeFeaturePtr& theSketch) -{ - std::shared_ptr aPoint = PartSet_Tools::point3D(thePoint, theSketch); +bool PartSet_WidgetPoint2D::shapeExploreHasVertex( + const GeomShapePtr &theShape, + const std::shared_ptr &thePoint, + const CompositeFeaturePtr &theSketch) { + std::shared_ptr aPoint = + PartSet_Tools::point3D(thePoint, theSketch); bool aContainPoint = false; GeomAPI_ShapeExplorer anExp(theShape, GeomAPI_Shape::VERTEX); - for(; anExp.more() && !aContainPoint; anExp.next()) { + for (; anExp.more() && !aContainPoint; anExp.next()) { std::shared_ptr aVertexInCompSolid = anExp.current(); - std::shared_ptr aVertex(new GeomAPI_Vertex(aVertexInCompSolid)); + std::shared_ptr aVertex( + new GeomAPI_Vertex(aVertexInCompSolid)); if (aVertex.get()) aContainPoint = aPoint->isEqual(aVertex->point()); } return aContainPoint; } -AttributeRefAttrPtr PartSet_WidgetPoint2D::attributeRefAttr() const -{ +AttributeRefAttrPtr PartSet_WidgetPoint2D::attributeRefAttr() const { AttributeRefAttrPtr anAttribute; if (myRefAttribute.empty()) return anAttribute; @@ -905,9 +902,9 @@ AttributeRefAttrPtr PartSet_WidgetPoint2D::attributeRefAttr() const return std::dynamic_pointer_cast(anAttributeRef); } -void PartSet_WidgetPoint2D::fillRefAttribute(double theClickedX, double theClickedY, - const std::shared_ptr& theValue) -{ +void PartSet_WidgetPoint2D::fillRefAttribute( + double theClickedX, double theClickedY, + const std::shared_ptr &theValue) { AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (!aRefAttr.get()) return; @@ -916,10 +913,11 @@ void PartSet_WidgetPoint2D::fillRefAttribute(double theClickedX, double theClick std::string anAttribute = attributeID(); if (aFeature.get()) { - std::shared_ptr aClickedPoint = std::shared_ptr( - new GeomAPI_Pnt2d(theClickedX, theClickedY)); - AttributePoint2DPtr aClickedFeaturePoint = findFirstEqualPointInSketch(mySketch, - aFeature, aClickedPoint); + std::shared_ptr aClickedPoint = + std::shared_ptr( + new GeomAPI_Pnt2d(theClickedX, theClickedY)); + AttributePoint2DPtr aClickedFeaturePoint = + findFirstEqualPointInSketch(mySketch, aFeature, aClickedPoint); if (aClickedFeaturePoint.get()) aRefAttr->setAttr(aClickedFeaturePoint); else { @@ -930,36 +928,39 @@ void PartSet_WidgetPoint2D::fillRefAttribute(double theClickedX, double theClick } } -void PartSet_WidgetPoint2D::fillRefAttribute(const ModuleBase_ViewerPrsPtr& theValue) -{ +void PartSet_WidgetPoint2D::fillRefAttribute( + const ModuleBase_ViewerPrsPtr &theValue) { fillRefAttribute(getGeomSelection(theValue)); } -void PartSet_WidgetPoint2D::fillRefAttribute(const ObjectPtr& theObject) -{ +void PartSet_WidgetPoint2D::fillRefAttribute(const ObjectPtr &theObject) { AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (aRefAttr.get()) aRefAttr->setObject(theObject); } -std::shared_ptr PartSet_WidgetPoint2D::findFirstEqualPointInArgumentFeatures( - const FeaturePtr& theFeature, const std::shared_ptr& thePoint) -{ +std::shared_ptr +PartSet_WidgetPoint2D::findFirstEqualPointInArgumentFeatures( + const FeaturePtr &theFeature, + const std::shared_ptr &thePoint) { std::shared_ptr aFeaturePoint; - // may be feature is not updated yet, execute is not performed and references features - // are not created. Case: rectangle macro feature + // may be feature is not updated yet, execute is not performed and references + // features are not created. Case: rectangle macro feature ModuleBase_Tools::flushUpdated(theFeature); - std::list anAttributes = theFeature->data()->attributes( - ModelAPI_AttributeRefList::typeId()); - std::list::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end(); + std::list anAttributes = + theFeature->data()->attributes(ModelAPI_AttributeRefList::typeId()); + std::list::const_iterator anIt = anAttributes.begin(), + aLast = anAttributes.end(); for (; anIt != aLast && !aFeaturePoint.get(); anIt++) { std::shared_ptr aCurSelList = - std::dynamic_pointer_cast(*anIt); - for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFeaturePoint.get(); i++) { + std::dynamic_pointer_cast(*anIt); + for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFeaturePoint.get(); + i++) { ObjectPtr anObject = aCurSelList->object(i); - FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(anObject); if (aFeature.get()) aFeaturePoint = findFirstEqualPoint(aFeature, thePoint); } @@ -968,21 +969,22 @@ std::shared_ptr PartSet_WidgetPoint2D::findFirstEqualPointI } std::shared_ptr PartSet_WidgetPoint2D::findFirstEqualPoint( - const FeaturePtr& theFeature, - const std::shared_ptr& thePoint) -{ + const FeaturePtr &theFeature, + const std::shared_ptr &thePoint) { std::shared_ptr aFPoint; // find the given point in the feature attributes - std::list > anAttiributes = - theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); - std::list >::const_iterator anIt = anAttiributes.begin(), + std::list> anAttiributes = + theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + std::list>::const_iterator + anIt = anAttiributes.begin(), aLast = anAttiributes.end(); - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); for (; anIt != aLast && !aFPoint; anIt++) { std::shared_ptr aCurPoint = - std::dynamic_pointer_cast(*anIt); + std::dynamic_pointer_cast(*anIt); if (aCurPoint && aCurPoint->isInitialized() && aValidators->isCase(theFeature, aCurPoint->id()) && (aCurPoint->pnt()->distance(thePoint) < Precision::Confusion())) { @@ -993,20 +995,22 @@ std::shared_ptr PartSet_WidgetPoint2D::findFirstEqualPoint( return aFPoint; } -std::shared_ptr PartSet_WidgetPoint2D::findFirstEqualPointInSketch( - const CompositeFeaturePtr& theSketch, - const FeaturePtr& theSkipFeature, - const std::shared_ptr& thePoint) -{ - // get all sketch features. If the point with the given coordinates belong to any sketch feature, - // the constraint is created between the feature point and the found sketch point +std::shared_ptr +PartSet_WidgetPoint2D::findFirstEqualPointInSketch( + const CompositeFeaturePtr &theSketch, const FeaturePtr &theSkipFeature, + const std::shared_ptr &thePoint) { + // get all sketch features. If the point with the given coordinates belong to + // any sketch feature, the constraint is created between the feature point and + // the found sketch point std::shared_ptr aData = theSketch->data(); - std::shared_ptr aRefList = std::dynamic_pointer_cast< - ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID())); + std::shared_ptr aRefList = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::FEATURES_ID())); std::list aFeatures = aRefList->list(); - std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); - std::list > anAttiributes; + std::list::const_iterator anIt = aFeatures.begin(), + aLast = aFeatures.end(); + std::list> anAttiributes; std::shared_ptr aFPoint; for (; anIt != aLast; anIt++) { @@ -1020,14 +1024,15 @@ std::shared_ptr PartSet_WidgetPoint2D::findFirstEqualPointI return aFPoint; } -ObjectPtr PartSet_WidgetPoint2D::getGeomSelection(const ModuleBase_ViewerPrsPtr& theValue) -{ +ObjectPtr PartSet_WidgetPoint2D::getGeomSelection( + const ModuleBase_ViewerPrsPtr &theValue) { ObjectPtr anObject; GeomShapePtr aShape; - ModuleBase_ISelection* aSelection = myWorkshop->selection(); + ModuleBase_ISelection *aSelection = myWorkshop->selection(); anObject = aSelection->getResult(theValue); aShape = aSelection->getShape(theValue); - myExternalObjectMgr->getGeomSelection(theValue, anObject, aShape, myWorkshop, sketch(), true); + myExternalObjectMgr->getGeomSelection(theValue, anObject, aShape, myWorkshop, + sketch(), true); return anObject; } diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index f162e77c6..0176eb4d5 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetPoint2D_H @@ -51,61 +52,65 @@ class QMouseEvent; * \brief Implementation of model widget to provide widget to input point 2d * In XML can be defined as folloung: * \code - * - * \endcode + * \endcode */ class PARTSET_EXPORT PartSet_WidgetPoint2D : public ModuleBase_ModelWidget, - public PartSet_MouseProcessor -{ -Q_OBJECT - public: + public PartSet_MouseProcessor { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop a current workshop - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetPoint2D(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetPoint2D(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); /// Destructor virtual ~PartSet_WidgetPoint2D(); /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param theModes [out] a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param theModes [out] a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& theValue); - - /// Checks all attribute validators returns valid. It tries on the given selection - /// to current attribute by setting the value inside and calling validators. After this, - /// the previous attribute value is restored.The valid/invalid value is cashed. - /// \param theValue a selected presentation in the view - /// \param theAttribute the attribute - /// \return a boolean value - bool isValidSelectionForAttribute_(const std::shared_ptr& theValue, - const std::shared_ptr& theAttribute); + virtual bool + isValidSelectionCustom(const std::shared_ptr &theValue); + + /// Checks all attribute validators returns valid. It tries on the given + /// selection to current attribute by setting the value inside and calling + /// validators. After this, the previous attribute value is restored.The + /// valid/invalid value is cashed. \param theValue a selected presentation in + /// the view \param theAttribute the attribute \return a boolean value + bool isValidSelectionForAttribute_( + const std::shared_ptr &theValue, + const std::shared_ptr &theAttribute); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - bool setSelectionCustom(const std::shared_ptr& theValue); + bool + setSelectionCustom(const std::shared_ptr &theValue); /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped widget values /// \param theToValidate a validation flag - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); - /// Select the internal content if it can be selected. It is empty in the default realization - //virtual void selectContent(); + /// Select the internal content if it can be selected. It is empty in the + /// default realization + // virtual void selectContent(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; - //bool initFromPrevious(ObjectPtr theObject); + // bool initFromPrevious(ObjectPtr theObject); /// The methiod called when widget is deactivated virtual void deactivate(); @@ -131,37 +136,43 @@ Q_OBJECT /// Returns true if the event is processed. virtual bool processEnter(); - /// Returns true if the attribute can be changed using the selected shapes in the viewer - /// and creating a coincidence constraint to them. This control use them. + /// Returns true if the attribute can be changed using the selected shapes in + /// the viewer and creating a coincidence constraint to them. This control use + /// them. virtual bool useSelectedShapes() const; /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent); + virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent); /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent); + virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent); /// Fill preselection used in mouseReleased - //virtual void setPreSelection(const std::shared_ptr& thePreSelected); - virtual void setPreSelection(const std::shared_ptr& thePreSelected, - ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent); + // virtual void setPreSelection(const std::shared_ptr& + // thePreSelected); + virtual void + setPreSelection(const std::shared_ptr &thePreSelected, + ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - void getGeomSelection_(const std::shared_ptr& theValue, - std::shared_ptr& theObject, - std::shared_ptr& theShape); + void getGeomSelection_(const std::shared_ptr &theValue, + std::shared_ptr &theObject, + std::shared_ptr &theShape); /// Return reference to external objects manager /// \return manager instance - PartSet_ExternalObjectsMgr* getExternalObjectMgr() const { return myExternalObjectMgr; } + PartSet_ExternalObjectsMgr *getExternalObjectMgr() const { + return myExternalObjectMgr; + } signals: /// Signal about selection of an existing vertex from an object @@ -192,114 +203,119 @@ protected: //! Switch On/Off highlighting of the widget virtual void setHighlighted(bool isHighlighted); - /// Returns true if the feature contains Point2D attribute with the same coordinates - /// The attribute of the widget is not processed. - /// \param theFeature a feature - /// \param theX the X coordinate - /// \param theY the Y coordinate - /// \return boolean result - bool isFeatureContainsPoint(const FeaturePtr& theFeature, double theX, double theY); + /// Returns true if the feature contains Point2D attribute with the same + /// coordinates The attribute of the widget is not processed. \param + /// theFeature a feature \param theX the X coordinate \param theY the Y + /// coordinate \return boolean result + bool isFeatureContainsPoint(const FeaturePtr &theFeature, double theX, + double theY); -//private slots: + // private slots: /// Process value changed event - //void onValuesChanged(); + // void onValuesChanged(); /// Compute the feature default value and fill the controls with it /// or store the control value to the feature /// The widget is not initialize the attribute value in order to avoid the - /// incorrect visualization in Sketch. E.g. by a line creation, the line should not - /// be visualized immediatelly when the end point widget is activated. + /// incorrect visualization in Sketch. E.g. by a line creation, the line + /// should not be visualized immediatelly when the end point widget is + /// activated. virtual void initializeValueByActivate(); - private: - /// Creates constrains of the clicked point - /// \param theClickedX the horizontal coordnate of the point - /// \param theClickedY the vertical coordnate of the point - bool setConstraintToPoint(double theClickedX, double theClickedY, - const std::shared_ptr& theValue); - - /// Create a coincidence constraint between the attribute and the parameter object - /// \theObject a result object - /// \return true if succed - bool setConstraintToObject(const ObjectPtr& theObject); +private: + /// Creates constrains of the clicked point + /// \param theClickedX the horizontal coordnate of the point + /// \param theClickedY the vertical coordnate of the point + bool + setConstraintToPoint(double theClickedX, double theClickedY, + const std::shared_ptr &theValue); - /// Process selected value - /// \param theValue the selected object - /// \param theX X coordinate of clicked point - /// \param theY Y coordinate of clicked point - void processSelection(const ModuleBase_ViewerPrsPtr& theValue, double theX, double theY); + /// Create a coincidence constraint between the attribute and the parameter + /// object \theObject a result object \return true if succed + bool setConstraintToObject(const ObjectPtr &theObject); + /// Process selected value + /// \param theValue the selected object + /// \param theX X coordinate of clicked point + /// \param theY Y coordinate of clicked point + void processSelection(const ModuleBase_ViewerPrsPtr &theValue, double theX, + double theY); public: - /// Returns if the feature is an orphan point, circle or an arc. Returns true if it - /// has no a coincident to other lines. It processes point, circle and arc features - /// In circle an arc features, only centers are processed, for other points, it returns - /// that the point is not an orphan. - /// \param theFeature a checked feature - /// \param theSketch a sketch - /// \param theX an X coordinate of the point - /// \param theY an Y coordinate of the point - /// \return boolean result - static bool isOrphanPoint(const FeaturePtr& theFeature, const CompositeFeaturePtr& theSketch, - double theX, double theY); - - /// Explode the given shape by vertices and found closed to the point vertes - /// \param theShape a shape to be exploded - /// \param thePoint a point - /// \return boolean value - static bool shapeExploreHasVertex(const std::shared_ptr& theShape, - const std::shared_ptr& thePoint, - const CompositeFeaturePtr& theSketch); - - /// Finds in the feature's sub-features first Point2D attribute with the given point coordinates - /// \param theFeature a feature with sub-feature attributes - /// \param thePoint a point to provided searched coordinates - /// \return found point or null - static std::shared_ptr findFirstEqualPointInArgumentFeatures( - const FeaturePtr& theFeature, const std::shared_ptr& thePoint); - - /// Finds in the feature first Point2D attribute with the given point coordinates - /// \param theFeature a feature with point attributes + /// Returns if the feature is an orphan point, circle or an arc. Returns true + /// if it has no a coincident to other lines. It processes point, circle and + /// arc features In circle an arc features, only centers are processed, for + /// other points, it returns that the point is not an orphan. \param + /// theFeature a checked feature \param theSketch a sketch \param theX an X + /// coordinate of the point \param theY an Y coordinate of the point \return + /// boolean result + static bool isOrphanPoint(const FeaturePtr &theFeature, + const CompositeFeaturePtr &theSketch, double theX, + double theY); + + /// Explode the given shape by vertices and found closed to the point vertes + /// \param theShape a shape to be exploded + /// \param thePoint a point + /// \return boolean value + static bool + shapeExploreHasVertex(const std::shared_ptr &theShape, + const std::shared_ptr &thePoint, + const CompositeFeaturePtr &theSketch); + + /// Finds in the feature's sub-features first Point2D attribute with the given + /// point coordinates \param theFeature a feature with sub-feature attributes /// \param thePoint a point to provided searched coordinates /// \return found point or null - static std::shared_ptr findFirstEqualPoint(const FeaturePtr& theFeature, - const std::shared_ptr& thePoint); - - /// Finds in the sketch attribute point of any feature that is nearest to the given point - /// \param theSketch a sketch, that is a container of features + static std::shared_ptr + findFirstEqualPointInArgumentFeatures( + const FeaturePtr &theFeature, + const std::shared_ptr &thePoint); + + /// Finds in the feature first Point2D attribute with the given point + /// coordinates \param theFeature a feature with point attributes \param + /// thePoint a point to provided searched coordinates \return found point or + /// null + static std::shared_ptr + findFirstEqualPoint(const FeaturePtr &theFeature, + const std::shared_ptr &thePoint); + + /// Finds in the sketch attribute point of any feature that is nearest to the + /// given point \param theSketch a sketch, that is a container of features /// \param theSkipFeature a feature that do not participate in the search /// \param thePoint a point to provided searched coordinates /// \return found point or null - static std::shared_ptr findFirstEqualPointInSketch( - const CompositeFeaturePtr& theSketch, - const FeaturePtr& theSkipFeature, - const std::shared_ptr& thePoint); + static std::shared_ptr + findFirstEqualPointInSketch(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theSkipFeature, + const std::shared_ptr &thePoint); private: - /// Returns attribute reference if the key is defined in XML definition of this control - /// \return found attribute or null + /// Returns attribute reference if the key is defined in XML definition of + /// this control \return found attribute or null std::shared_ptr attributeRefAttr() const; - /// Finds first equal point attribute in sketch and set it to reference attribute - /// \param theClickedX the horizontal coordnate of the point - /// \param theClickedY the vertical coordnate of the point - void fillRefAttribute(const std::shared_ptr& theValue); + /// Finds first equal point attribute in sketch and set it to reference + /// attribute \param theClickedX the horizontal coordnate of the point \param + /// theClickedY the vertical coordnate of the point + void fillRefAttribute(const std::shared_ptr &theValue); void fillRefAttribute(double theClickedX, double theClickedY, - const std::shared_ptr& theValue); - void fillRefAttribute(const ObjectPtr& theObject); + const std::shared_ptr &theValue); + void fillRefAttribute(const ObjectPtr &theObject); - ObjectPtr getGeomSelection(const std::shared_ptr& theValue); + ObjectPtr + getGeomSelection(const std::shared_ptr &theValue); protected: - ModuleBase_IWorkshop* myWorkshop; ///< workshop + ModuleBase_IWorkshop *myWorkshop; ///< workshop private: - QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets - //ModuleBase_ParamSpinBox* myXSpin; ///< the spin box for the X coordinate - //ModuleBase_ParamSpinBox* myYSpin; ///< the spin box for the Y coordinate - ModuleBase_LabelValue* myXSpin; ///< the label for the X coordinate - ModuleBase_LabelValue* myYSpin; ///< the label for the Y coordinate - PartSet_ExternalObjectsMgr* myExternalObjectMgr; ///< reference to external objects manager + QGroupBox *myGroupBox; ///< the parent group box for all intenal widgets + // ModuleBase_ParamSpinBox* myXSpin; ///< the spin box for the X coordinate + // ModuleBase_ParamSpinBox* myYSpin; ///< the spin box for the Y coordinate + ModuleBase_LabelValue *myXSpin; ///< the label for the X coordinate + ModuleBase_LabelValue *myYSpin; ///< the label for the Y coordinate + PartSet_ExternalObjectsMgr + *myExternalObjectMgr; ///< reference to external objects manager /// value used as selection in mouse release method std::shared_ptr myPreSelected; @@ -307,9 +323,12 @@ private: /// it is important during restart operation CompositeFeaturePtr mySketch; - std::string myRefAttribute; /// if not empty, coincidences are not set but attribute is filled - bool myValueIsCashed; /// boolean state if the value is cashed during value state change - bool myIsFeatureVisibleInCash; /// boolean value if the feature was visible when cash if filled + std::string myRefAttribute; /// if not empty, coincidences are not set but + /// attribute is filled + bool myValueIsCashed; /// boolean state if the value is cashed during value + /// state change + bool myIsFeatureVisibleInCash; /// boolean value if the feature was visible + /// when cash if filled double myXValueInCash; /// the cashed X value during value state change double myYValueInCash; /// the cashed Y value during value state change }; diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 0e0559312..895d2f65c 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetShapeSelector.h" @@ -37,32 +38,32 @@ #include -#include #include -#include +#include #include +#include #include -PartSet_WidgetShapeSelector::PartSet_WidgetShapeSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData) -{ +PartSet_WidgetShapeSelector::PartSet_WidgetShapeSelector( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData) { myUseSketchPlane = theData->getBooleanAttribute("use_sketch_plane", true); - myExternalObjectMgr = new PartSet_ExternalObjectsMgr(theData->getProperty("use_external"), - theData->getProperty("can_create_external"), true); + myExternalObjectMgr = new PartSet_ExternalObjectsMgr( + theData->getProperty("use_external"), + theData->getProperty("can_create_external"), true); } -PartSet_WidgetShapeSelector::~PartSet_WidgetShapeSelector() -{ +PartSet_WidgetShapeSelector::~PartSet_WidgetShapeSelector() { delete myExternalObjectMgr; } //******************************************************************** -void PartSet_WidgetShapeSelector::selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters) -{ - ModuleBase_WidgetShapeSelector::selectionFilters(theModuleSelectionFilters, theSelectionFilters); +void PartSet_WidgetShapeSelector::selectionFilters( + QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) { + ModuleBase_WidgetShapeSelector::selectionFilters(theModuleSelectionFilters, + theSelectionFilters); if (!myUseSketchPlane) { if (theModuleSelectionFilters.contains(SF_SketchPlaneFilter)) @@ -71,8 +72,8 @@ void PartSet_WidgetShapeSelector::selectionFilters(QIntList& theModuleSelectionF } //******************************************************************** -bool PartSet_WidgetShapeSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_WidgetShapeSelector::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { bool aValid = false; if (thePrs.get() && thePrs->interactive().get() && thePrs->interactive()->IsKind(STANDARD_TYPE(PartSet_CenterPrs))) @@ -87,21 +88,18 @@ bool PartSet_WidgetShapeSelector::isValidSelectionCustom(const ModuleBase_Viewer return aValid; } -void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape) -{ +void PartSet_WidgetShapeSelector::getGeomSelection( + const ModuleBase_ViewerPrsPtr &thePrs, ObjectPtr &theObject, + GeomShapePtr &theShape) { ModuleBase_WidgetShapeSelector::getGeomSelection(thePrs, theObject, theShape); - myExternalObjectMgr->getGeomSelection(thePrs, theObject, theShape, - myWorkshop, sketch(), myIsInValidate); + myExternalObjectMgr->getGeomSelection(thePrs, theObject, theShape, myWorkshop, + sketch(), myIsInValidate); } //******************************************************************** -void PartSet_WidgetShapeSelector::restoreAttributeValue(const AttributePtr& theAttribute, - const bool theValid) -{ +void PartSet_WidgetShapeSelector::restoreAttributeValue( + const AttributePtr &theAttribute, const bool theValid) { ModuleBase_WidgetShapeSelector::restoreAttributeValue(theAttribute, theValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); } - diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index 814fdb1bd..db1cf597d 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetShapeSelector_H @@ -29,20 +30,22 @@ class PartSet_ExternalObjectsMgr; /** -* \ingroup Modules -* Customosation of ModuleBase_WidgetShapeSelector in order to provide -* working with sketch specific objects and external objects. -*/ -class PARTSET_EXPORT PartSet_WidgetShapeSelector: public ModuleBase_WidgetShapeSelector -{ -Q_OBJECT - public: + * \ingroup Modules + * Customosation of ModuleBase_WidgetShapeSelector in order to provide + * working with sketch specific objects and external objects. + */ +class PARTSET_EXPORT PartSet_WidgetShapeSelector + : public ModuleBase_WidgetShapeSelector { + Q_OBJECT +public: /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetShapeSelector(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData); virtual ~PartSet_WidgetShapeSelector(); @@ -54,40 +57,43 @@ Q_OBJECT CompositeFeaturePtr sketch() const { return mySketch; } /// Appends into container of workshop selection filters - /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes - /// \param [out] theSelectionFilters selection filters - virtual void selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters); + /// \param [out] theModuleSelectionFilters module additional modes, -1 means + /// all default modes \param [out] theSelectionFilters selection filters + virtual void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters); protected: /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& thePrs); + virtual bool + isValidSelectionCustom(const std::shared_ptr &thePrs); /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void getGeomSelection(const std::shared_ptr& thePrs, - ObjectPtr& theObject, - GeomShapePtr& theShape); + virtual void + getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape); /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute /// \param theValid a boolean flag, if restore happens for valid parameters - void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); + void restoreAttributeValue(const AttributePtr &theAttribute, + const bool theValid); protected: /// A reference to external objects manager - PartSet_ExternalObjectsMgr* myExternalObjectMgr; + PartSet_ExternalObjectsMgr *myExternalObjectMgr; /// Pointer to a sketch CompositeFeaturePtr mySketch; - bool myUseSketchPlane; ///< state whether the sketch plane filter should be switched on + bool myUseSketchPlane; ///< state whether the sketch plane filter should be + ///< switched on }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index bd0fc85cc..aa2dd3306 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -14,60 +14,61 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetSketchCreator.h" #include "PartSet_Module.h" -#include "PartSet_WidgetSketchLabel.h" #include "PartSet_PreviewPlanes.h" +#include "PartSet_WidgetSketchLabel.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 -#include -#include #include +#include +#include #ifdef WIN32 #pragma warning(disable : 4456) // for nested foreach @@ -75,12 +76,9 @@ #define DEBUG_UNDO_INVALID_SKETCH - - -QStringList getIconsList(const QStringList& theNames) -{ +QStringList getIconsList(const QStringList &theNames) { QStringList aIcons; - foreach(QString aName, theNames) { + foreach (QString aName, theNames) { QString aUName = aName.toUpper(); if ((aUName == "VERTICES") || (aUName == "VERTEX")) aIcons << ":pictures/vertex32.png"; @@ -92,18 +90,15 @@ QStringList getIconsList(const QStringList& theNames) return aIcons; } - - -PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent, - PartSet_Module* theModule, - const Config_WidgetAPI* theData) -: ModuleBase_WidgetSelector(theParent, theModule->workshop(), theData), - myModule(theModule), myIsCustomAttribute(false) -{ +PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator( + QWidget *theParent, PartSet_Module *theModule, + const Config_WidgetAPI *theData) + : ModuleBase_WidgetSelector(theParent, theModule->workshop(), theData), + myModule(theModule), myIsCustomAttribute(false) { myAttributeListID = theData->getProperty("attribute_list_id"); - //QFormLayout* aLayout = new QFormLayout(this); - QVBoxLayout* aLayout = new QVBoxLayout(this); + // QFormLayout* aLayout = new QFormLayout(this); + QVBoxLayout *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); ModuleBase_Tools::adjustMargins(aLayout); @@ -113,11 +108,13 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent, // Size of the View control mySizeOfViewWidget = new QWidget(this); - QHBoxLayout* aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); - aSizeLayout->addWidget(new QLabel(tr("Size of the view"), mySizeOfViewWidget)); + QHBoxLayout *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); + aSizeLayout->addWidget( + new QLabel(tr("Size of the view"), mySizeOfViewWidget)); mySizeOfView = new QLineEdit(mySizeOfViewWidget); - QDoubleValidator* aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); + QDoubleValidator *aValidator = + new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); aValidator->setLocale(ModuleBase_Tools::doubleLocale()); aValidator->setNotation(QDoubleValidator::StandardNotation); mySizeOfView->setValidator(aValidator); @@ -159,43 +156,36 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent, } } aLayout->addWidget(myTypeCtrl); - // There is no sense to parameterize list of types while we can not parameterize selection mode - // if the xml definition contains one type, the controls to select a type should not be shown + // There is no sense to parameterize list of types while we can not + // parameterize selection mode if the xml definition contains one type, the + // controls to select a type should not be shown if (myShapeTypes.size() <= 1 || !myIsUseChoice) { myTypeCtrl->setVisible(false); } - connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged())); + connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, + SLOT(onSelectionTypeChanged())); aLayout->addStretch(1); myPreviewPlanes = new PartSet_PreviewPlanes(); } -PartSet_WidgetSketchCreator::~PartSet_WidgetSketchCreator() -{ - // we need to deactivate here in order to hide preview planes if the selection mode is - // active +PartSet_WidgetSketchCreator::~PartSet_WidgetSketchCreator() { + // we need to deactivate here in order to hide preview planes if the selection + // mode is active deactivate(); } -QList PartSet_WidgetSketchCreator::getControls() const -{ - QList aControls; +QList PartSet_WidgetSketchCreator::getControls() const { + QList aControls; aControls.append(myLabel); return aControls; } -bool PartSet_WidgetSketchCreator::restoreValueCustom() -{ - return true; -} +bool PartSet_WidgetSketchCreator::restoreValueCustom() { return true; } -bool PartSet_WidgetSketchCreator::storeValueCustom() -{ - return true; -} +bool PartSet_WidgetSketchCreator::storeValueCustom() { return true; } -AttributePtr PartSet_WidgetSketchCreator::attribute() const -{ +AttributePtr PartSet_WidgetSketchCreator::attribute() const { AttributePtr anAttribute; if (myIsCustomAttribute) anAttribute = myFeature->attribute(myAttributeListID); @@ -206,8 +196,7 @@ AttributePtr PartSet_WidgetSketchCreator::attribute() const } //******************************************************************** -void PartSet_WidgetSketchCreator::openExtrusionTransaction() -{ +void PartSet_WidgetSketchCreator::openExtrusionTransaction() { SessionPtr aMgr = ModelAPI_Session::get(); bool aIsOp = aMgr->isOperation(); if (!aIsOp) { @@ -217,16 +206,15 @@ void PartSet_WidgetSketchCreator::openExtrusionTransaction() } //******************************************************************** -bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue) -{ +bool PartSet_WidgetSketchCreator::isValidSelection( + const ModuleBase_ViewerPrsPtr &theValue) { bool aValid = false; if (myIsCustomAttribute) { // check only suiting of the value to custom attribute (myAttributeListID) // do not cash of validation to avoid using states, stored for XML attribute // there is an alternative is to call clearValidatedCash() in setSelection() aValid = isValidSelectionForAttribute(theValue, attribute()); - } - else { /// if the validated attribute is already custom + } else { /// if the validated attribute is already custom if (getValidState(theValue, aValid)) { return aValid; } @@ -247,36 +235,35 @@ bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrsPtr } //******************************************************************** -bool PartSet_WidgetSketchCreator::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) -{ +bool PartSet_WidgetSketchCreator::isValidSelectionCustom( + const ModuleBase_ViewerPrsPtr &theValue) { return PartSet_WidgetSketchLabel::canFillSketch(theValue); } -void PartSet_WidgetSketchCreator::activateSelectionControl() -{ +void PartSet_WidgetSketchCreator::activateSelectionControl() { // reset previously set size of view needed on restart extrusion after Sketch if (myModule->sketchMgr()->previewSketchPlane()->isUseSizeOfView()) myModule->sketchMgr()->previewSketchPlane()->setSizeOfView(0, false); // we need to call activate here as the widget has no focus accepted controls - // if these controls are added here, activate will happens automatically after focusIn() - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); - XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel(); + // if these controls are added here, activate will happens automatically after + // focusIn() + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); + XGUI_PropertyPanel *aPanel = aWorkshop->propertyPanel(); aPanel->activateWidget(this, false); } -void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelectionControl) -{ +void PartSet_WidgetSketchCreator::setVisibleSelectionControl( + const bool theSelectionControl) { // hide current widget, activate the next widget - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); - XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel(); - const QList& aWidgets = aPanel->modelWidgets(); - foreach(ModuleBase_ModelWidget* aWidget, aWidgets) { + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); + XGUI_PropertyPanel *aPanel = aWorkshop->propertyPanel(); + const QList &aWidgets = aPanel->modelWidgets(); + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { if (theSelectionControl) { // hide other controls if (aWidget != this) aWidget->setVisible(false); - } - else { // hide current control + } else { // hide current control if (aWidget == this) aWidget->setVisible(false); else { @@ -294,8 +281,7 @@ void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelec // We have to select a plane before any operation myPreviewPlanes->showPreviewPlanes(myWorkshop); mySizeOfViewWidget->setVisible(true); - } - else { + } else { mySizeOfViewWidget->setVisible(false); } @@ -307,19 +293,18 @@ void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelec } } -QIntList PartSet_WidgetSketchCreator::shapeTypes() const -{ +QIntList PartSet_WidgetSketchCreator::shapeTypes() const { QIntList aShapeTypes; if (myShapeTypes.length() > 1 && myIsUseChoice) { - QStringList aTypes = myTypeCtrl->textValue().split("|", QString::SkipEmptyParts); - foreach(QString aType, aTypes) { + QStringList aTypes = + myTypeCtrl->textValue().split("|", QString::SkipEmptyParts); + foreach (QString aType, aTypes) { aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); } - } - else { - foreach(QString aType, myShapeTypes) { + } else { + foreach (QString aType, myShapeTypes) { QStringList aSubTypes = aType.split("|", QString::SkipEmptyParts); - foreach(QString asubType, aSubTypes) { + foreach (QString asubType, aSubTypes) { aShapeTypes.append(ModuleBase_Tools::shapeType(asubType)); } } @@ -327,17 +312,16 @@ QIntList PartSet_WidgetSketchCreator::shapeTypes() const return aShapeTypes; } -void PartSet_WidgetSketchCreator::setEditingMode(bool isEditing) -{ +void PartSet_WidgetSketchCreator::setEditingMode(bool isEditing) { ModuleBase_ModelWidget::setEditingMode(isEditing); if (isEditing) { setVisibleSelectionControl(false); - ModuleBase_ModelWidget* anAttributeListWidget = 0; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); - XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel(); - const QList& aWidgets = aPanel->modelWidgets(); - foreach(ModuleBase_ModelWidget* aWidget, aWidgets) { + ModuleBase_ModelWidget *anAttributeListWidget = 0; + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); + XGUI_PropertyPanel *aPanel = aWorkshop->propertyPanel(); + const QList &aWidgets = aPanel->modelWidgets(); + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { if (aWidget->attributeID() == myAttributeListID) { anAttributeListWidget = aWidget; break; @@ -348,31 +332,30 @@ void PartSet_WidgetSketchCreator::setEditingMode(bool isEditing) } } -bool PartSet_WidgetSketchCreator::isSelectionMode() const -{ - AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID); +bool PartSet_WidgetSketchCreator::isSelectionMode() const { + AttributeSelectionListPtr anAttrList = + myFeature->data()->selectionList(myAttributeListID); bool aHasValueInList = anAttrList.get() && anAttrList->size() > 0; return !aHasValueInList; } -bool PartSet_WidgetSketchCreator::hasSubObjects() const -{ +bool PartSet_WidgetSketchCreator::hasSubObjects() const { bool aHasSubObjects = false; - CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(myFeature); + CompositeFeaturePtr aComposite = + std::dynamic_pointer_cast(myFeature); if (aComposite.get()) aHasSubObjects = aComposite->numberOfSubs() > 0; return aHasSubObjects; } -bool PartSet_WidgetSketchCreator::setSelection(QList& theValues, - const bool theToValidate) -{ +bool PartSet_WidgetSketchCreator::setSelection( + QList &theValues, const bool theToValidate) { bool aDone = false; if (!startSketchOperation(theValues)) { myIsCustomAttribute = true; - QList::const_iterator - anIt = theValues.begin(), aLast = theValues.end(); + QList::const_iterator anIt = theValues.begin(), + aLast = theValues.end(); bool aProcessed = false; for (; anIt != aLast; anIt++) { ModuleBase_ViewerPrsPtr aValue = *anIt; @@ -395,22 +378,19 @@ bool PartSet_WidgetSketchCreator::setSelection(QList& t } //******************************************************************** -bool PartSet_WidgetSketchCreator::processSelection() -{ +bool PartSet_WidgetSketchCreator::processSelection() { QList aSelected = getFilteredSelected(); - bool isDone = setSelection(aSelected, true/*false*/); + bool isDone = setSelection(aSelected, true /*false*/); return isDone; } //******************************************************************** -void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone) -{ +void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone) { } bool PartSet_WidgetSketchCreator::startSketchOperation( - const QList& theValues) -{ + const QList &theValues) { bool aSketchStarted = false; if (theValues.size() != 1) @@ -420,12 +400,14 @@ bool PartSet_WidgetSketchCreator::startSketchOperation( if (!aValue.get() || !PartSet_WidgetSketchLabel::canFillSketch(aValue)) return aSketchStarted; - ResultPtr aResult = std::dynamic_pointer_cast(aValue->object()); - /// sketch should not started by object(face) selected as global. If Local face is selected, - /// sketch is started - if (aResult.get() && aValue->shape().get() && aResult->shape()->isEqual(aValue->shape())) { + ResultPtr aResult = + std::dynamic_pointer_cast(aValue->object()); + /// sketch should not started by object(face) selected as global. If Local + /// face is selected, sketch is started + if (aResult.get() && aValue->shape().get() && + aResult->shape()->isEqual(aValue->shape())) { ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aResult); + std::dynamic_pointer_cast(aResult); if (!aConstruction.get() || !aConstruction->isInfinite()) return aSketchStarted; } @@ -444,15 +426,18 @@ bool PartSet_WidgetSketchCreator::startSketchOperation( } } if (isSetSizeOfView) - myModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, true); + myModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, + true); } - // manually deactivation because the widget was not activated as has no focus acceptin controls + // manually deactivation because the widget was not activated as has no focus + // acceptin controls deactivate(); myPreviewPlanes->erasePreviewPlanes(myWorkshop); // start edit operation for the sketch - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myModule->createOperation("Sketch")); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myModule->createOperation("Sketch")); QList aValues; aValues.push_back(aValue); aFOperation->setPreselection(aValues); @@ -462,72 +447,74 @@ bool PartSet_WidgetSketchCreator::startSketchOperation( return aSketchStarted; } -bool PartSet_WidgetSketchCreator::focusTo() -{ - // this method is called only in creation mode. In Edition mode this widget is hidden +bool PartSet_WidgetSketchCreator::focusTo() { + // this method is called only in creation mode. In Edition mode this widget is + // hidden if (isSelectionMode() && !hasSubObjects()) { setVisibleSelectionControl(true); activateSelectionControl(); openExtrusionTransaction(); return true; - } - else - connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)), - SLOT(onResumed(ModuleBase_Operation*))); + } else + connect(myModule, SIGNAL(resumed(ModuleBase_Operation *)), + SLOT(onResumed(ModuleBase_Operation *))); return true; } -void PartSet_WidgetSketchCreator::deactivate() -{ +void PartSet_WidgetSketchCreator::deactivate() { ModuleBase_WidgetSelector::deactivate(); bool aHidePreview = myPreviewPlanes->isPreviewDisplayed(); myPreviewPlanes->erasePreviewPlanes(myWorkshop); if (aHidePreview) XGUI_Tools::workshop(myWorkshop)->viewer()->update(); - } -void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp) -{ +void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation *theOp) { SessionPtr aMgr = ModelAPI_Session::get(); bool aIsOp = aMgr->isOperation(); if (aIsOp) { - // in current implementation, all transactions are closed when resume happens - // so, this is a wrong case, which is not checked. - // To provide it, make correction in later rows about abort/undo transactions + // in current implementation, all transactions are closed when resume + // happens so, this is a wrong case, which is not checked. To provide it, + // make correction in later rows about abort/undo transactions return; } // Set visible only selection control setVisibleSelectionControl(true); - // Validate the created sketch. If it is valid, it is set into the composite feature selection - // list, otherwise it is removed + // Validate the created sketch. If it is valid, it is set into the composite + // feature selection list, otherwise it is removed CompositeFeaturePtr aCompFeature = - std::dynamic_pointer_cast(myFeature); - AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID); + std::dynamic_pointer_cast(myFeature); + AttributeSelectionListPtr anAttrList = + myFeature->data()->selectionList(myAttributeListID); if (aCompFeature->numberOfSubs() > 0) { - // set the sub feature to attribute selection list and check whether sketch is valid - const static std::string aNestedOpID("Set Sketch result into Selection list"); - aMgr->startOperation(aNestedOpID, false); // false to not attach to Extrusion operation + // set the sub feature to attribute selection list and check whether sketch + // is valid + const static std::string aNestedOpID( + "Set Sketch result into Selection list"); + aMgr->startOperation(aNestedOpID, + false); // false to not attach to Extrusion operation setSketchObjectToList(aCompFeature, anAttrList); aMgr->finishOperation(); if (!validateSelectionList()) { #ifdef DEBUG_UNDO_INVALID_SKETCH - aMgr->undo(); // Extrusion modification parameters: setSketchObjectToList() + aMgr->undo(); // Extrusion modification parameters: + // setSketchObjectToList() aMgr->undo(); /// Sketch creation #else aMgr->startOperation("Delete invalid Sketch feature", false); // delete invalid sketch CompositeFeaturePtr aSketchFeature = - std::dynamic_pointer_cast(aCompFeature->subFeature(0)); + std::dynamic_pointer_cast( + aCompFeature->subFeature(0)); QObjectPtrList anObjects; anObjects.append(aSketchFeature); - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); aWorkshop->deleteFeatures(anObjects); aMgr->finishOperation(); @@ -539,18 +526,19 @@ void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp) if (aCompFeature->numberOfSubs() == 0) { // call activateWidget() of the parent to connect to the viewer seleciton activateSelectionControl(); - } - else { - // check if the created sketch is valid. If it is invalid, it will be deleted with warning else + } else { + // check if the created sketch is valid. If it is invalid, it will be + // deleted with warning else /// the attribute selection list will be filled by result of this sketch. setVisibleSelectionControl(false); // Update value in attribute selection list - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); - XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); - const QList& aWidgets = aPropertyPanel->modelWidgets(); - ModuleBase_ModelWidget* aListWidget = 0; - foreach(ModuleBase_ModelWidget* aWidget, aWidgets) { + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); + XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel(); + const QList &aWidgets = + aPropertyPanel->modelWidgets(); + ModuleBase_ModelWidget *aListWidget = 0; + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { if (aWidget->attributeID() == myAttributeListID) { aListWidget = aWidget; break; @@ -563,26 +551,30 @@ void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp) // Hide sketcher result CompositeFeaturePtr aSketchFeature = - std::dynamic_pointer_cast(aCompFeature->subFeature(0)); + std::dynamic_pointer_cast( + aCompFeature->subFeature(0)); std::list aResults = aSketchFeature->results(); std::list::const_iterator aIt; for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { (*aIt)->setDisplayed(false); } aSketchFeature->setDisplayed(false); - static Events_Loop* aLoop = Events_Loop::loop(); + static Events_Loop *aLoop = Events_Loop::loop(); aLoop->flush(aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY)); // Add Selected body were created the sketcher to list of selected objects - std::string anObjectsAttribute = FeaturesPlugin_CompositeBoolean::OBJECTS_ID(); - AttributeSelectionListPtr aSelList = aCompFeature->data()->selectionList(anObjectsAttribute); + std::string anObjectsAttribute = + FeaturesPlugin_CompositeBoolean::OBJECTS_ID(); + AttributeSelectionListPtr aSelList = + aCompFeature->data()->selectionList(anObjectsAttribute); if (aSelList.get()) { DataPtr aData = aSketchFeature->data(); - AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); + AttributeSelectionPtr aSelAttr = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); ResultPtr aRes = aSelAttr.get() ? aSelAttr->context() : ResultPtr(); if (aRes.get()) { - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); AttributePtr anAttribute = myFeature->attribute(anObjectsAttribute); std::string aValidatorID; Events_InfoMessage anError; @@ -597,69 +589,70 @@ void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp) restoreValue(); } -bool PartSet_WidgetSketchCreator::validateSelectionList() const -{ - AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID); +bool PartSet_WidgetSketchCreator::validateSelectionList() const { + AttributeSelectionListPtr anAttrList = + myFeature->data()->selectionList(myAttributeListID); SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); std::string aValidatorID; Events_InfoMessage anError; - bool isValidPComposite = aFactory->validate(anAttrList, aValidatorID, anError); + bool isValidPComposite = + aFactory->validate(anAttrList, aValidatorID, anError); if (!isValidPComposite) { - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); // TODO(spo): translate - QMessageBox::question(aWorkshop->desktop(), tr("Apply current feature"), - tr("Sketch is invalid and will be deleted.\nError: %1") - .arg(anError.messageString().c_str()), - QMessageBox::Ok); + QMessageBox::question( + aWorkshop->desktop(), tr("Apply current feature"), + tr("Sketch is invalid and will be deleted.\nError: %1") + .arg(anError.messageString().c_str()), + QMessageBox::Ok); } return isValidPComposite; } void PartSet_WidgetSketchCreator::setSketchObjectToList( - const CompositeFeaturePtr& theCompositeFeature, - const AttributePtr& theAttribute) -{ + const CompositeFeaturePtr &theCompositeFeature, + const AttributePtr &theAttribute) { if (!theCompositeFeature.get() || theCompositeFeature->numberOfSubs() != 1) return; AttributeSelectionListPtr aBaseObjectsSelectionList = - std::dynamic_pointer_cast(theAttribute); - if(!aBaseObjectsSelectionList.get() || aBaseObjectsSelectionList->isInitialized()) { + std::dynamic_pointer_cast(theAttribute); + if (!aBaseObjectsSelectionList.get() || + aBaseObjectsSelectionList->isInitialized()) { return; } FeaturePtr aSketchFeature = theCompositeFeature->subFeature(0); - if(!aSketchFeature.get() || aSketchFeature->results().empty()) { + if (!aSketchFeature.get() || aSketchFeature->results().empty()) { return; } ResultPtr aSketchRes = aSketchFeature->results().front(); ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(aSketchRes); - if(!aConstruction.get()) { + std::dynamic_pointer_cast(aSketchRes); + if (!aConstruction.get()) { return; } - if(aBaseObjectsSelectionList->size() == 0) { + if (aBaseObjectsSelectionList->size() == 0) { aBaseObjectsSelectionList->append(aSketchRes, GeomShapePtr()); } } -void PartSet_WidgetSketchCreator::setEnabledModelWidget(ModuleBase_ModelWidget* theModelWidget, - const bool theEnabled) -{ - QList aMyControls = theModelWidget->getControls(); - foreach(QWidget* eachControl, aMyControls) { +void PartSet_WidgetSketchCreator::setEnabledModelWidget( + ModuleBase_ModelWidget *theModelWidget, const bool theEnabled) { + QList aMyControls = theModelWidget->getControls(); + foreach (QWidget *eachControl, aMyControls) { eachControl->setEnabled(theEnabled); } } -void PartSet_WidgetSketchCreator::onSelectionTypeChanged() -{ - // Clear current selection in order to avoid updating of object browser with obsolete indexes - // which can appear because of results deletetion after changing a type of selection +void PartSet_WidgetSketchCreator::onSelectionTypeChanged() { + // Clear current selection in order to avoid updating of object browser with + // obsolete indexes which can appear because of results deletetion after + // changing a type of selection QString aSelectionType = myTypeCtrl->textValue(); QList aEmptyList; myWorkshop->setSelected(aEmptyList); @@ -676,17 +669,19 @@ void PartSet_WidgetSketchCreator::onSelectionTypeChanged() } /// store the selected type - AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID); + AttributeSelectionListPtr anAttrList = + myFeature->data()->selectionList(myAttributeListID); anAttrList->setSelectionType(aSelectionType.toStdString()); anAttrList->clear(); - // update object is necessary to flush update signal. It leads to objects references map update - // and the operation presentation will not contain deleted items visualized as parameters of - // the feature. + // update object is necessary to flush update signal. It leads to objects + // references map update and the operation presentation will not contain + // deleted items visualized as parameters of the feature. updateObject(myFeature); myWorkshop->propertyPanel()->activeWidget()->restoreValue(); myWorkshop->setSelected(getAttributeSelection()); // may be the feature's result is not displayed, but attributes should be // hope that something is redisplayed by object updated - myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments, true); -} \ No newline at end of file + myWorkshop->module()->customizeFeature( + myFeature, ModuleBase_IModule::CustomizeArguments, true); +} diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index 768e5677c..bc614d550 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetSketchCreator_H @@ -33,29 +34,30 @@ class PartSet_PreviewPlanes; class ModuleBase_ChoiceCtrl; /** -* \ingroup Modules -* A widget which allow creation of a sketch in another operation. -* It creates sketch on aqctivation of this widget. If sketch object is already created then -* it will transfer a focus to next widget. It is supposed that the widget will be placed as -* a first widget in property panel -*/ -class PARTSET_EXPORT PartSet_WidgetSketchCreator : public ModuleBase_WidgetSelector -{ -Q_OBJECT + * \ingroup Modules + * A widget which allow creation of a sketch in another operation. + * It creates sketch on aqctivation of this widget. If sketch object is already + * created then it will transfer a focus to next widget. It is supposed that the + * widget will be placed as a first widget in property panel + */ +class PARTSET_EXPORT PartSet_WidgetSketchCreator + : public ModuleBase_WidgetSelector { + Q_OBJECT public: /// Constructor /// \param theParent the parent object /// \param theModule a reference to a module object - /// \param theData the widget configuation. The attribute of the model widget is obtained from - PartSet_WidgetSketchCreator(QWidget* theParent, PartSet_Module* theModule, - const Config_WidgetAPI* theData); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from + PartSet_WidgetSketchCreator(QWidget *theParent, PartSet_Module *theModule, + const Config_WidgetAPI *theData); virtual ~PartSet_WidgetSketchCreator(); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// Set focus to the first control of the current widget. /// The focus policy of the control is checked. @@ -70,32 +72,38 @@ public: /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values /// \param theToValidate a validation of the values flag - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); - /// Editing mode depends on mode of current operation. This value is defined by it. + /// Editing mode depends on mode of current operation. This value is defined + /// by it. virtual void setEditingMode(bool isEditing); - /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating, - /// next, the attribute's validating. It trying on the give selection to current attribute by - /// setting the value inside and calling validators. After this, the previous attribute value is + /// Checks all widget validator if the owner is valid. Firstly it checks + /// custom widget validating, next, the attribute's validating. It trying on + /// the give selection to current attribute by setting the value inside and + /// calling validators. After this, the previous attribute value is /// restored.The valid/invalid value is cashed. /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelection(const std::shared_ptr& theValue); + virtual bool + isValidSelection(const std::shared_ptr &theValue); - /// Returns True in case if the widget contains useful information for inspection tool + /// Returns True in case if the widget contains useful information for + /// inspection tool virtual bool isInformative() const { return false; } protected: - /// If there is no operation in current session, start operation for modify parameters - /// \return true if the operation was not opened + /// If there is no operation in current session, start operation for modify + /// parameters \return true if the operation was not opened void openExtrusionTransaction(); /// Checks whether the selection presentation contains preview planes /// \param theValue a selection information /// \return a boolean value - virtual bool isValidSelectionCustom(const std::shared_ptr& theValue); + virtual bool + isValidSelectionCustom(const std::shared_ptr &theValue); /// Saves the internal parameters to the given feature /// \return True in success @@ -108,12 +116,13 @@ protected: /// \return an attribute virtual AttributePtr attribute() const; - /// Sets the selection control visible and set the current widget as active in property panel - /// It leads to connect to onSelectionChanged slot + /// Sets the selection control visible and set the current widget as active in + /// property panel It leads to connect to onSelectionChanged slot void activateSelectionControl(); /// Visualization of the current control or others in PP - /// \param theSelectionControl state whether the control should be shown/hidden + /// \param theSelectionControl state whether the control should be + /// shown/hidden void setVisibleSelectionControl(const bool theSelectionControl); /// Retunrs a list of possible shape types @@ -129,66 +138,69 @@ protected: virtual bool processSelection(); private: - /// Returns true if the selection mode is active. This is when composition feature has no + /// Returns true if the selection mode is active. This is when composition + /// feature has no /// a sub-object and the attribute list is empty /// \return boolean value bool isSelectionMode() const; - /// Returns true if the current composite feature contains at least one sub-object - /// \return boolean value + /// Returns true if the current composite feature contains at least one + /// sub-object \return boolean value bool hasSubObjects() const; private slots: - void onResumed(ModuleBase_Operation* theOp); + void onResumed(ModuleBase_Operation *theOp); /// Slot is called on selection type changed void onSelectionTypeChanged(); private: - /// Append new Sketch, set the selected plane for the sketch and start Edit operation. - /// \param theValues a selection list - /// \return true if the sketch is started - bool startSketchOperation(const QList>& theValues); + /// Append new Sketch, set the selected plane for the sketch and start Edit + /// operation. \param theValues a selection list \return true if the sketch is + /// started + bool startSketchOperation( + const QList> &theValues); /// Sets the sub-object to list of base. - static void setSketchObjectToList(const CompositeFeaturePtr& theFeature, - const AttributePtr& theAttribute); + static void setSketchObjectToList(const CompositeFeaturePtr &theFeature, + const AttributePtr &theAttribute); /// Calls validator for attribute list and warn if it is not valid /// \return true if validation succeed bool validateSelectionList() const; - /// Change enable state of controls in the model widget by the attribute identifier - /// \param theModelWidget a model widget - /// \param theEnabled a state if the controls should be enabled/disabled - void setEnabledModelWidget(ModuleBase_ModelWidget* theModelWidget, + /// Change enable state of controls in the model widget by the attribute + /// identifier \param theModelWidget a model widget \param theEnabled a state + /// if the controls should be enabled/disabled + void setEnabledModelWidget(ModuleBase_ModelWidget *theModelWidget, const bool theEnabled); private: std::string myAttributeListID; - PartSet_Module* myModule; + PartSet_Module *myModule; - /// Flag if the attribute() should return the attribute list ID or XML attribute - /// to store selection and check validation + /// Flag if the attribute() should return the attribute list ID or XML + /// attribute to store selection and check validation bool myIsCustomAttribute; - QWidget* mySizeOfViewWidget;///< Size of view widget, visualized if preview planes are shown - QLineEdit* mySizeOfView; ///< Value of square of size of View + QWidget *mySizeOfViewWidget; ///< Size of view widget, visualized if preview + ///< planes are shown + QLineEdit *mySizeOfView; ///< Value of square of size of View /// Label of the widget - QLabel* myLabel; + QLabel *myLabel; /// List of accepting shapes types QStringList myShapeTypes; /// class to show/hide preview planes - PartSet_PreviewPlanes* myPreviewPlanes; + PartSet_PreviewPlanes *myPreviewPlanes; bool myIsUseChoice; ///< A flag to store use_choice parameter state /// Control for types - ModuleBase_ChoiceCtrl* myTypeCtrl; + ModuleBase_ChoiceCtrl *myTypeCtrl; std::string myDefMode; }; -#endif \ No newline at end of file +#endif diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 4a5edfa01..671f9dbf8 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -14,71 +14,72 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSet_WidgetSketchLabel.h" -#include "PartSet_Tools.h" #include "PartSet_Module.h" #include "PartSet_PreviewPlanes.h" #include "PartSet_SketcherReentrantMgr.h" +#include "PartSet_Tools.h" #include "SketchPlugin_SketchEntity.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 -#include -#include #include +#include -#include #include -#include -#include #include +#include +#include #include -#include +#include +#include #include -#include -#include +#include #include +#include #ifdef WIN32 #pragma warning(disable : 4456) // for nested foreach @@ -88,30 +89,31 @@ #define DBL_MAX 1.7976931348623158e+308 #endif -PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData, - const QMap& toShowConstraints) -: ModuleBase_WidgetValidated(theParent, theWorkshop, theData), myOpenTransaction(false), -myIsSelection(false) -{ - QVBoxLayout* aLayout = new QVBoxLayout(this); +PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( + QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData, + const QMap &toShowConstraints) + : ModuleBase_WidgetValidated(theParent, theWorkshop, theData), + myOpenTransaction(false), myIsSelection(false) { + QVBoxLayout *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); myStackWidget = new QStackedWidget(this); - myStackWidget->setContentsMargins(0,0,0,0); + myStackWidget->setContentsMargins(0, 0, 0, 0); aLayout->addWidget(myStackWidget); // Define label for plane selection - QWidget* aFirstWgt = new QWidget(this); + QWidget *aFirstWgt = new QWidget(this); // Size of the View control mySizeOfViewWidget = new QWidget(aFirstWgt); - QHBoxLayout* aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); - aSizeLayout->addWidget(new QLabel(tr("Size of the view"), mySizeOfViewWidget)); + QHBoxLayout *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); + aSizeLayout->addWidget( + new QLabel(tr("Size of the view"), mySizeOfViewWidget)); mySizeOfView = new QLineEdit(mySizeOfViewWidget); - QDoubleValidator* aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); + QDoubleValidator *aValidator = + new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); aValidator->setLocale(ModuleBase_Tools::doubleLocale()); aValidator->setNotation(QDoubleValidator::StandardNotation); mySizeOfView->setValidator(aValidator); @@ -120,9 +122,10 @@ myIsSelection(false) myPartSetMessage = new QDialog(this, Qt::ToolTip); myPartSetMessage->setModal(false); myPartSetMessage->setStyleSheet("background-color:lightyellow;"); - QVBoxLayout* aMsgLay = new QVBoxLayout(myPartSetMessage); + QVBoxLayout *aMsgLay = new QVBoxLayout(myPartSetMessage); QString aMsg = tr("The Sketch is created in PartSet.\n" - "It will be necessary to create a Part in order to use this sketch for body creation"); + "It will be necessary to create a Part in order to use " + "this sketch for body creation"); aMsgLay->addWidget(new QLabel(aMsg, myPartSetMessage)); myPartSetMessage->hide(); @@ -135,7 +138,7 @@ myIsSelection(false) mySizeMessage->hide(); QString aText = translate(theData->getProperty("title")); - QLabel* aLabel = new QLabel(aText, aFirstWgt); + QLabel *aLabel = new QLabel(aText, aFirstWgt); aLabel->setWordWrap(true); QString aTooltip = translate(theData->getProperty("tooltip")); aLabel->setToolTip(aTooltip); @@ -146,7 +149,8 @@ myIsSelection(false) aLayout->addWidget(mySizeOfViewWidget); aLayout->addWidget(aLabel); - myRemoveExternal = new QCheckBox(tr("Remove external dependencies"), aFirstWgt); + myRemoveExternal = + new QCheckBox(tr("Remove external dependencies"), aFirstWgt); myRemoveExternal->setChecked(false); aLayout->addWidget(myRemoveExternal); myRemoveExternal->setVisible(false); @@ -156,20 +160,22 @@ myIsSelection(false) myStackWidget->addWidget(aFirstWgt); // Define widget for sketch manmagement - QWidget* aSecondWgt = new QWidget(this); + QWidget *aSecondWgt = new QWidget(this); aLayout = new QVBoxLayout(aSecondWgt); ModuleBase_Tools::zeroMargins(aLayout); - QGroupBox* aViewBox = new QGroupBox(tr("Sketcher plane"), this); - QGridLayout* aViewLayout = new QGridLayout(aViewBox); + QGroupBox *aViewBox = new QGroupBox(tr("Sketcher plane"), this); + QGridLayout *aViewLayout = new QGridLayout(aViewBox); myViewInverted = new QCheckBox(tr("Reversed"), aViewBox); aViewLayout->addWidget(myViewInverted, 0, 0); // Sketch plane visibility myViewVisible = new QCheckBox(tr("Visible"), aViewBox); - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); - PartSet_PreviewSketchPlane* aPreviewPlane = aModule->sketchMgr()->previewSketchPlane(); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); + PartSet_PreviewSketchPlane *aPreviewPlane = + aModule->sketchMgr()->previewSketchPlane(); if (aPreviewPlane->isPlaneCreated()) // init with current state myViewVisible->setChecked(aPreviewPlane->isDisplayed()); @@ -178,10 +184,11 @@ myIsSelection(false) myViewVisible->setChecked(true); aViewLayout->addWidget(myViewVisible, 0, 1, Qt::AlignRight); - connect(myViewVisible, SIGNAL(toggled(bool)), this, SLOT(onShowViewPlane(bool))); + connect(myViewVisible, SIGNAL(toggled(bool)), this, + SLOT(onShowViewPlane(bool))); - QPushButton* aSetViewBtn = - new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox); + QPushButton *aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), + tr("Set plane view"), aViewBox); connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView())); aViewLayout->addWidget(aSetViewBtn, 1, 0, 1, 2); @@ -192,11 +199,13 @@ myIsSelection(false) aStates[PartSet_Tools::Dimensional] = tr("Show dimensional constraints"); aStates[PartSet_Tools::Expressions] = tr("Show existing expressions"); - QMap::const_iterator anIt = aStates.begin(), - aLast = aStates.end(); + QMap::const_iterator + anIt = aStates.begin(), + aLast = aStates.end(); for (; anIt != aLast; anIt++) { - QCheckBox* aShowConstraints = new QCheckBox(anIt.value(), this); - connect(aShowConstraints, SIGNAL(toggled(bool)), this, SLOT(onShowConstraint(bool))); + QCheckBox *aShowConstraints = new QCheckBox(anIt.value(), this); + connect(aShowConstraints, SIGNAL(toggled(bool)), this, + SLOT(onShowConstraint(bool))); aLayout->addWidget(aShowConstraints); PartSet_Tools::ConstraintVisibleState aState = anIt.key(); @@ -206,15 +215,19 @@ myIsSelection(false) aShowConstraints->setChecked(toShowConstraints[aState]); } myShowPoints = new QCheckBox(tr("Show free points"), this); - connect(myShowPoints, SIGNAL(toggled(bool)), this, SIGNAL(showFreePoints(bool))); + connect(myShowPoints, SIGNAL(toggled(bool)), this, + SIGNAL(showFreePoints(bool))); aLayout->addWidget(myShowPoints); myAutoConstraints = new QCheckBox(tr("Automatic constraints"), this); - myAutoConstraints->setToolTip(tr("Automatic vertical and horizontal constraints")); - connect(myAutoConstraints, SIGNAL(toggled(bool)), this, SIGNAL(autoConstraints(bool))); + myAutoConstraints->setToolTip( + tr("Automatic vertical and horizontal constraints")); + connect(myAutoConstraints, SIGNAL(toggled(bool)), this, + SIGNAL(autoConstraints(bool))); aLayout->addWidget(myAutoConstraints); - QPushButton* aPlaneBtn = new QPushButton(tr("Change sketch plane"), aSecondWgt); + QPushButton *aPlaneBtn = + new QPushButton(tr("Change sketch plane"), aSecondWgt); connect(aPlaneBtn, SIGNAL(clicked(bool)), SLOT(onChangePlane())); aLayout->addWidget(aPlaneBtn); @@ -229,21 +242,18 @@ myIsSelection(false) connect(myShowDOFBtn, SIGNAL(clicked(bool)), SLOT(onShowDOF())); myStackWidget->addWidget(aSecondWgt); - //setLayout(aLayout); + // setLayout(aLayout); myPreviewPlanes = new PartSet_PreviewPlanes(); } -PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() -{ -} +PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() {} -bool PartSet_WidgetSketchLabel::setSelection(QList& theValues, - const bool theToValidate) -{ - // do not use the given selection if the plane of the sketch has been already set. - // If this check is absent, a selected plane in the viewer can be set in the sketch - // even if the sketch is built on another plane. +bool PartSet_WidgetSketchLabel::setSelection( + QList &theValues, const bool theToValidate) { + // do not use the given selection if the plane of the sketch has been already + // set. If this check is absent, a selected plane in the viewer can be set in + // the sketch even if the sketch is built on another plane. if (plane().get()) return true; @@ -254,15 +264,13 @@ bool PartSet_WidgetSketchLabel::setSelection(QList& the return aDone; } -QList PartSet_WidgetSketchLabel::getControls() const -{ - QList aResult; +QList PartSet_WidgetSketchLabel::getControls() const { + QList aResult; aResult << myStackWidget; return aResult; } -bool PartSet_WidgetSketchLabel::processSelection() -{ +bool PartSet_WidgetSketchLabel::processSelection() { std::shared_ptr aPlane = plane(); if (aPlane.get()) return false; @@ -281,12 +289,12 @@ bool PartSet_WidgetSketchLabel::processSelection() return aDone; } -void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn) -{ - QCheckBox* aSenderCheckBox = qobject_cast(sender()); +void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn) { + QCheckBox *aSenderCheckBox = qobject_cast(sender()); - QMap::const_iterator - anIt = myShowConstraints.begin(), aLast = myShowConstraints.end(); + QMap::const_iterator + anIt = myShowConstraints.begin(), + aLast = myShowConstraints.end(); PartSet_Tools::ConstraintVisibleState aState = PartSet_Tools::Geometrical; bool aFound = false; @@ -299,22 +307,22 @@ void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn) emit showConstraintToggled(aState, theOn); } -void PartSet_WidgetSketchLabel::blockAttribute(const AttributePtr& theAttribute, - const bool& theToBlock, bool& isFlushesActived, - bool& isAttributeSetInitializedBlocked, - bool& isAttributeSendUpdatedBlocked) -{ - ModuleBase_WidgetValidated::blockAttribute(theAttribute, theToBlock, isFlushesActived, - isAttributeSetInitializedBlocked, - isAttributeSendUpdatedBlocked); - // We do not restore the previous state of isAttributeSetInitializedBlocked for each of - // attributes. It it is necessary, these states should be append to the method attributes - // or stored in the widget +void PartSet_WidgetSketchLabel::blockAttribute( + const AttributePtr &theAttribute, const bool &theToBlock, + bool &isFlushesActived, bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked) { + ModuleBase_WidgetValidated::blockAttribute( + theAttribute, theToBlock, isFlushesActived, + isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked); + // We do not restore the previous state of isAttributeSetInitializedBlocked + // for each of attributes. It it is necessary, these states should be append + // to the method attributes or stored in the widget std::list anAttributes = myFeature->data()->attributes(""); - std::list::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end(); + std::list::const_iterator anIt = anAttributes.begin(), + aLast = anAttributes.end(); QStringList aValues; - for(; anIt != aLast; anIt++) { + for (; anIt != aLast; anIt++) { AttributePtr anAttribute = *anIt; if (theToBlock) anAttribute->blockSetInitialized(true); @@ -324,19 +332,17 @@ void PartSet_WidgetSketchLabel::blockAttribute(const AttributePtr& theAttribute, } bool PartSet_WidgetSketchLabel::setSelectionInternal( - const QList& theValues, - const bool theToValidate) -{ + const QList &theValues, const bool theToValidate) { bool aDone = false; if (theValues.empty()) { - // In order to make reselection possible, set empty object and shape should be done + // In order to make reselection possible, set empty object and shape should + // be done setSelectionCustom(ModuleBase_ViewerPrsPtr( - new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL))); aDone = false; - } - else { + } else { // it removes the processed value from the parameters list - ModuleBase_ViewerPrsPtr aValue = theValues.first();//.takeFirst(); + ModuleBase_ViewerPrsPtr aValue = theValues.first(); //.takeFirst(); if (!theToValidate || isValidInFilters(aValue)) { myIsSelection = true; aDone = setSelectionCustom(aValue); @@ -347,8 +353,8 @@ bool PartSet_WidgetSketchLabel::setSelectionInternal( return aDone; } -void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs) -{ +void PartSet_WidgetSketchLabel::updateByPlaneSelected( + const ModuleBase_ViewerPrsPtr &thePrs) { // Nullify a temporary remembered plane if (myTmpPlane.get()) myTmpPlane.reset(); @@ -360,7 +366,8 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs myPartSetMessage->hide(); mySizeMessage->hide(); - // 1. hide main planes if they have been displayed and display sketch preview plane + // 1. hide main planes if they have been displayed and display sketch preview + // plane myPreviewPlanes->erasePreviewPlanes(myWorkshop); QString aSizeOfViewStr = mySizeOfView->text(); @@ -372,12 +379,16 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs isSetSizeOfView = false; } } - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule) { - CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); - aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, isSetSizeOfView); + CompositeFeaturePtr aSketch = + std::dynamic_pointer_cast(myFeature); + aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, + isSetSizeOfView); if (myViewVisible->isChecked()) - aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); + aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, + myWorkshop); else aModule->sketchMgr()->previewSketchPlane()->clearPlanePreview(); } @@ -389,16 +400,19 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs // Rotate view if the sketcher plane is selected only from preview planes // Preview planes are created only if there is no any shape - bool aRotate = Config_PropManager::boolean(SKETCH_TAB_NAME, "rotate_to_plane"); + bool aRotate = + Config_PropManager::boolean(SKETCH_TAB_NAME, "rotate_to_plane"); if (aRotate) { - myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist); + myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), + aTwist); } if (isSetSizeOfView && aSizeOfView > 0) { Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView(); if (!aView3d.IsNull()) { Bnd_Box aBndBox; - double aHalfSize = aSizeOfView/2.0; - aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize); + double aHalfSize = aSizeOfView / 2.0; + aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, + aHalfSize); aView3d->FitAll(aBndBox, 0.01, false); } } @@ -409,15 +423,16 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs } // 3. Clear text in the label myStackWidget->setCurrentIndex(1); - //myLabel->setText(""); - //myLabel->setToolTip(""); - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); + // myLabel->setText(""); + // myLabel->setToolTip(""); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); // 5. Clear selection mode and define sketching mode emit planeSelected(plane()); - // after the plane is selected in the sketch, the sketch selection should be activated - // it can not be performed in the sketch label widget because, we don't need to switch off - // the selection by any label deactivation, but need to switch it off by stop the sketch + // after the plane is selected in the sketch, the sketch selection should be + // activated it can not be performed in the sketch label widget because, we + // don't need to switch off the selection by any label deactivation, but need + // to switch it off by stop the sketch myWorkshop->selectionActivate()->updateSelectionFilters(); myWorkshop->selectionActivate()->updateSelectionModes(); @@ -431,55 +446,58 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs myRemoveExternal->setVisible(false); } -std::shared_ptr PartSet_WidgetSketchLabel::plane() const -{ - CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); +std::shared_ptr PartSet_WidgetSketchLabel::plane() const { + CompositeFeaturePtr aSketch = + std::dynamic_pointer_cast(myFeature); return PartSet_Tools::sketchPlane(aSketch); } -bool PartSet_WidgetSketchLabel::focusTo() -{ - ModuleBase_Tools::setFocus(myStackWidget, "PartSet_WidgetSketchLabel::focusTo()"); +bool PartSet_WidgetSketchLabel::focusTo() { + ModuleBase_Tools::setFocus(myStackWidget, + "PartSet_WidgetSketchLabel::focusTo()"); return true; } -void PartSet_WidgetSketchLabel::enableFocusProcessing() -{ +void PartSet_WidgetSketchLabel::enableFocusProcessing() { myStackWidget->installEventFilter(this); } -void PartSet_WidgetSketchLabel::storeAttributeValue(const AttributePtr& theAttribute) -{ +void PartSet_WidgetSketchLabel::storeAttributeValue( + const AttributePtr &theAttribute) { ModuleBase_WidgetValidated::storeAttributeValue(theAttribute); } -void PartSet_WidgetSketchLabel::restoreAttributeValue(const AttributePtr& theAttribute, - const bool theValid) -{ +void PartSet_WidgetSketchLabel::restoreAttributeValue( + const AttributePtr &theAttribute, const bool theValid) { ModuleBase_WidgetValidated::restoreAttributeValue(theAttribute, theValid); - // it is not necessary to save the previous plane value because the plane is chosen once + // it is not necessary to save the previous plane value because the plane is + // chosen once DataPtr aData = feature()->data(); - AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); + AttributeSelectionPtr aSelAttr = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); if (aSelAttr) { ResultPtr anEmptyResult; GeomShapePtr anEmptyShape; aSelAttr->setValue(anEmptyResult, anEmptyShape); } - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); anOrigin->reset(); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); aNormal->reset(); - std::shared_ptr aDirX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aDirX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); aDirX->reset(); } -bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_WidgetSketchLabel::setSelectionCustom( + const ModuleBase_ViewerPrsPtr &thePrs) { if (myIsSelection && myRemoveExternal->isVisible()) { if (myRemoveExternal->isChecked()) { myFeature->customAction(SketchPlugin_Sketch::ACTION_REMOVE_EXTERNAL()); @@ -488,8 +506,8 @@ bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrsPtr return fillSketchPlaneBySelection(thePrs); } -bool PartSet_WidgetSketchLabel::canFillSketch(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_WidgetSketchLabel::canFillSketch( + const ModuleBase_ViewerPrsPtr &thePrs) { bool aCanFillSketch = true; // avoid any selection on sketch object ObjectPtr anObject = thePrs->object(); @@ -509,22 +527,21 @@ bool PartSet_WidgetSketchLabel::canFillSketch(const ModuleBase_ViewerPrsPtr& the if (aGeomShape.get() && aGeomShape->shapeType() == GeomAPI_Shape::FACE) { std::shared_ptr aGeomFace(new GeomAPI_Face(aGeomShape)); aCanFillSketch = aGeomFace.get() && aGeomFace->isPlanar(); - } - else + } else aCanFillSketch = false; } return aCanFillSketch; } -bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const ModuleBase_ViewerPrsPtr& thePrs) -{ +bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection( + const ModuleBase_ViewerPrsPtr &thePrs) { bool isOwnerSet = false; - const GeomShapePtr& aShape = thePrs->shape(); + const GeomShapePtr &aShape = thePrs->shape(); std::shared_ptr aDir; if (aShape.get() && !aShape->isNull()) { - const TopoDS_Shape& aTDShape = aShape->impl(); + const TopoDS_Shape &aTDShape = aShape->impl(); aDir = setSketchPlane(aTDShape); isOwnerSet = aDir.get(); } @@ -532,34 +549,34 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const ModuleBase_View FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object()); DataPtr aData = feature()->data(); AttributeSelectionPtr aSelAttr = - std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); if (aSelAttr.get()) { - ResultPtr aRes = std::dynamic_pointer_cast(thePrs->object()); + ResultPtr aRes = + std::dynamic_pointer_cast(thePrs->object()); if (aRes.get()) { GeomShapePtr aShapePtr; - if (!aShape.get() || aShape->isNull()) { // selection happens in the OCC viewer + if (!aShape.get() || + aShape->isNull()) { // selection happens in the OCC viewer aShapePtr = ModelAPI_Tools::shape(aRes); - } - else { // selection happens in OB browser + } else { // selection happens in OB browser aShapePtr = aShape; } if (aShapePtr.get() && aShapePtr->isFace()) { - const TopoDS_Shape& aTDShape = aShapePtr->impl(); + const TopoDS_Shape &aTDShape = aShapePtr->impl(); setSketchPlane(aTDShape); aSelAttr->setValue(aRes, aShapePtr); isOwnerSet = true; } - } - else { + } else { aSelAttr->setValue(aFeature, GeomShapePtr()); GeomShapePtr aSelShape = aSelAttr->value(); if (!aSelShape.get() && aSelAttr->contextFeature().get() && - aSelAttr->contextFeature()->firstResult().get()) { + aSelAttr->contextFeature()->firstResult().get()) { aSelShape = aSelAttr->contextFeature()->firstResult()->shape(); } if (aSelShape.get() && aSelShape->isPlanar()) { - const TopoDS_Shape& aTDShape = aSelShape->impl(); + const TopoDS_Shape &aTDShape = aSelShape->impl(); setSketchPlane(aTDShape); isOwnerSet = true; } @@ -569,16 +586,17 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const ModuleBase_View return isOwnerSet; } -void PartSet_WidgetSketchLabel::activateCustom() -{ - QWidget* aTopWidget = window(); +void PartSet_WidgetSketchLabel::activateCustom() { + QWidget *aTopWidget = window(); if (aTopWidget) aTopWidget->installEventFilter(this); - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule) { bool isBlocked = myAutoConstraints->blockSignals(true); - myAutoConstraints->setChecked(aModule->sketchReentranceMgr()->isAutoConstraints()); + myAutoConstraints->setChecked( + aModule->sketchReentranceMgr()->isAutoConstraints()); myAutoConstraints->blockSignals(isBlocked); } @@ -591,28 +609,27 @@ void PartSet_WidgetSketchLabel::activateCustom() myStackWidget->setCurrentIndex(0); bool aBodyIsVisualized = myPreviewPlanes->hasVisualizedBodies(myWorkshop); - // Clear previous selection mode It is necessary for correct activation of preview planes - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_Displayer* aDisp = aWorkshop->displayer(); - aWorkshop->selectionActivate()->activateObjects(QIntList(), aDisp->displayedObjects(), false); + // Clear previous selection mode It is necessary for correct activation of + // preview planes + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Displayer *aDisp = aWorkshop->displayer(); + aWorkshop->selectionActivate()->activateObjects( + QIntList(), aDisp->displayedObjects(), false); if (!aBodyIsVisualized) { // We have to select a plane before any operation myPreviewPlanes->showPreviewPlanes(myWorkshop); mySizeOfViewWidget->setVisible(true); - } - else + } else mySizeOfViewWidget->setVisible(false); } -void PartSet_WidgetSketchLabel::showEvent(QShowEvent* theEvent) -{ +void PartSet_WidgetSketchLabel::showEvent(QShowEvent *theEvent) { ModuleBase_WidgetValidated::showEvent(theEvent); QTimer::singleShot(10, this, SLOT(onShowPanel())); } -void PartSet_WidgetSketchLabel::hideEvent(QHideEvent* theEvent) -{ +void PartSet_WidgetSketchLabel::hideEvent(QHideEvent *theEvent) { ModuleBase_WidgetValidated::hideEvent(theEvent); if (myPartSetMessage->isVisible()) myPartSetMessage->hide(); @@ -620,10 +637,8 @@ void PartSet_WidgetSketchLabel::hideEvent(QHideEvent* theEvent) mySizeMessage->hide(); } - -void PartSet_WidgetSketchLabel::onShowPanel() -{ - //if (mySizeOfViewWidget->isVisible()) { +void PartSet_WidgetSketchLabel::onShowPanel() { + // if (mySizeOfViewWidget->isVisible()) { if (myStackWidget->currentIndex() == 0) { DocumentPtr aDoc = feature()->document(); DocumentPtr aModDoc = ModelAPI_Session::get()->moduleDocument(); @@ -632,16 +647,16 @@ void PartSet_WidgetSketchLabel::onShowPanel() myPartSetMessage->show(); } if (mySizeOfViewWidget->isVisible()) { - QPoint aPnt = mySizeOfView->mapToGlobal(mySizeOfView->geometry().center()); + QPoint aPnt = + mySizeOfView->mapToGlobal(mySizeOfView->geometry().center()); mySizeMessage->move(aPnt); mySizeMessage->show(); } } } -void PartSet_WidgetSketchLabel::deactivate() -{ - QWidget* aTopWidget = window(); +void PartSet_WidgetSketchLabel::deactivate() { + QWidget *aTopWidget = window(); if (aTopWidget) aTopWidget->removeEventFilter(this); @@ -664,17 +679,17 @@ void PartSet_WidgetSketchLabel::deactivate() } } -void PartSet_WidgetSketchLabel::selectionModes(int& theModuleSelectionModes, QIntList& theModes) -{ +void PartSet_WidgetSketchLabel::selectionModes(int &theModuleSelectionModes, + QIntList &theModes) { theModuleSelectionModes = -1; std::shared_ptr aPlane = plane(); if (!aPlane.get()) theModes << TopAbs_FACE; } -void PartSet_WidgetSketchLabel::selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters) -{ +void PartSet_WidgetSketchLabel::selectionFilters( + QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) { std::shared_ptr aPlane = plane(); if (aPlane.get()) return; @@ -683,8 +698,7 @@ void PartSet_WidgetSketchLabel::selectionFilters(QIntList& theModuleSelectionFil } std::shared_ptr - PartSet_WidgetSketchLabel::setSketchPlane(const TopoDS_Shape& theShape) -{ +PartSet_WidgetSketchLabel::setSketchPlane(const TopoDS_Shape &theShape) { if (theShape.IsNull()) return std::shared_ptr(); @@ -700,9 +714,8 @@ std::shared_ptr return setSketchPlane(aPlane); } -std::shared_ptr - PartSet_WidgetSketchLabel::setSketchPlane(std::shared_ptr thePlane) -{ +std::shared_ptr PartSet_WidgetSketchLabel::setSketchPlane( + std::shared_ptr thePlane) { // set plane parameters to feature std::shared_ptr aData = feature()->data(); double anA, aB, aC, aD; @@ -717,26 +730,29 @@ std::shared_ptr // X axis is preferable to be dirX on the sketch const double tol = Precision::Confusion(); bool isX = fabs(fabs(anA) - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol; - std::shared_ptr aTempDir( - isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0)); - std::shared_ptr aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir))); + std::shared_ptr aTempDir(isX ? new GeomAPI_Dir(0, 1, 0) + : new GeomAPI_Dir(1, 0, 0)); + std::shared_ptr aYDir( + new GeomAPI_Dir(aNormDir->cross(aTempDir))); std::shared_ptr aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir))); - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); anOrigin->setValue(anOrigPnt); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); aNormal->setValue(aNormDir); - std::shared_ptr aDirX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aDirX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); aDirX->setValue(aXDir); std::shared_ptr aDir = thePlane->direction(); return aDir; } -void PartSet_WidgetSketchLabel::onSetPlaneView() -{ +void PartSet_WidgetSketchLabel::onSetPlaneView() { std::shared_ptr aPlane = plane(); if (aPlane.get()) { std::shared_ptr aDirection = aPlane->direction(); @@ -744,37 +760,38 @@ void PartSet_WidgetSketchLabel::onSetPlaneView() if (myViewInverted->isChecked()) aDir.Reverse(); myWorkshop->viewer()->setViewProjection(aDir.X(), aDir.Y(), aDir.Z(), 0.); - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule) aModule->onViewTransformed(); } } - //****************************************************** -QList PartSet_WidgetSketchLabel::findCircularEdgesInPlane() -{ +QList +PartSet_WidgetSketchLabel::findCircularEdgesInPlane() { QList> aResult; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); QObjectPtrList aDispObjects = aDisplayer->displayedObjects(); std::shared_ptr aPlane = plane(); - foreach(ObjectPtr aObj, aDispObjects) { + foreach (ObjectPtr aObj, aDispObjects) { ResultPtr aResObj = std::dynamic_pointer_cast(aObj); if (aResObj.get()) { GeomShapePtr aShape = aResObj->shape(); if (aShape.get()) { GeomAPI_ShapeExplorer aExplorer(aShape, GeomAPI_Shape::EDGE); - for(; aExplorer.more(); aExplorer.next()) { + for (; aExplorer.more(); aExplorer.next()) { GeomShapePtr aEdgeShape = aExplorer.current(); GeomAPI_Edge anEdge(aEdgeShape); if ((anEdge.isCircle() || anEdge.isArc() || anEdge.isEllipse()) && - anEdge.isInPlane(aPlane)) { + anEdge.isInPlane(aPlane)) { bool isContains = false; // Check that edge is not used. - // It is possible that the same edge will be taken from different faces - foreach(ModuleBase_ViewerPrsPtr aPrs, aResult) { + // It is possible that the same edge will be taken from different + // faces + foreach (ModuleBase_ViewerPrsPtr aPrs, aResult) { GeomAPI_Edge aUsedEdge(aPrs->shape()); if (aUsedEdge.isEqual(aEdgeShape)) { isContains = true; @@ -782,7 +799,8 @@ QList PartSet_WidgetSketchLabel::findCircularEdgesInPla } } if (!isContains) { - ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs(aResObj, aEdgeShape)); + ModuleBase_ViewerPrsPtr aPrs( + new ModuleBase_ViewerPrs(aResObj, aEdgeShape)); aResult.append(aPrs); } } @@ -794,9 +812,9 @@ QList PartSet_WidgetSketchLabel::findCircularEdgesInPla } //****************************************************** -void PartSet_WidgetSketchLabel::onChangePlane() -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); +void PartSet_WidgetSketchLabel::onChangePlane() { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); if (aModule) { mySizeOfViewWidget->setVisible(false); myRemoveExternal->setVisible(true); @@ -809,16 +827,18 @@ void PartSet_WidgetSketchLabel::onChangePlane() myPreviewPlanes->showPreviewPlanes(myWorkshop); } - CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); + CompositeFeaturePtr aSketch = + std::dynamic_pointer_cast(myFeature); myTmpPlane = PartSet_Tools::sketchPlane(aSketch); PartSet_Tools::nullifySketchPlane(aSketch); - Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_SketchPlaneFilter); + Handle(SelectMgr_Filter) aFilter = + aModule->selectionFilter(SF_SketchPlaneFilter); if (!aFilter.IsNull()) { std::shared_ptr aPln; Handle(ModuleBase_ShapeInPlaneFilter)::DownCast(aFilter)->setPlane(aPln); } - XGUI_Workshop* aWorkshop = aModule->getWorkshop(); + XGUI_Workshop *aWorkshop = aModule->getWorkshop(); aWorkshop->selectionActivate()->updateSelectionFilters(); aWorkshop->selectionActivate()->updateSelectionModes(); @@ -830,17 +850,16 @@ void PartSet_WidgetSketchLabel::onChangePlane() } } -void PartSet_WidgetSketchLabel::setShowPointsState(bool theState) -{ +void PartSet_WidgetSketchLabel::setShowPointsState(bool theState) { bool aBlock = myShowPoints->blockSignals(true); myShowPoints->setChecked(theState); myShowPoints->blockSignals(aBlock); } -bool PartSet_WidgetSketchLabel::restoreValueCustom() -{ +bool PartSet_WidgetSketchLabel::restoreValueCustom() { if (myFeature.get()) { - CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); + CompositeFeaturePtr aSketch = + std::dynamic_pointer_cast(myFeature); if (aSketch.get() && (aSketch->numberOfSubs() > 0)) { AttributeStringPtr aDOFStr = aSketch->string("SolverDOF"); if (aDOFStr.get()) { @@ -858,8 +877,7 @@ bool PartSet_WidgetSketchLabel::restoreValueCustom() myShowDOFBtn->setEnabled(true); } } - } - else { + } else { myDoFLabel->setText(""); myShowDOFBtn->setEnabled(false); } @@ -867,25 +885,24 @@ bool PartSet_WidgetSketchLabel::restoreValueCustom() return true; } - -void PartSet_WidgetSketchLabel::onShowDOF() -{ +void PartSet_WidgetSketchLabel::onShowDOF() { CompositeFeaturePtr aCompFeature = - std::dynamic_pointer_cast(myFeature); + std::dynamic_pointer_cast(myFeature); if (aCompFeature.get()) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_GET_DOF_OBJECTS); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_GET_DOF_OBJECTS); ModelAPI_EventCreator::get()->sendUpdated(aCompFeature, anEvent); Events_Loop::loop()->flush(anEvent); - // Transfer focus to the current viewport for correct processing of a key event - QWidget* aViewPort = myWorkshop->viewer()->activeViewPort(); + // Transfer focus to the current viewport for correct processing of a key + // event + QWidget *aViewPort = myWorkshop->viewer()->activeViewPort(); if (aViewPort) aViewPort->setFocus(); } } -bool PartSet_WidgetSketchLabel::eventFilter(QObject* theObj, QEvent* theEvent) -{ +bool PartSet_WidgetSketchLabel::eventFilter(QObject *theObj, QEvent *theEvent) { if (theObj == window()) { int aType = theEvent->type(); if ((aType == QEvent::Hide) || (aType == QEvent::WindowDeactivate)) { @@ -893,25 +910,25 @@ bool PartSet_WidgetSketchLabel::eventFilter(QObject* theObj, QEvent* theEvent) myPartSetMessage->hide(); if (mySizeMessage->isVisible()) mySizeMessage->hide(); - } - else if ((aType == QEvent::Show) || (aType == QEvent::WindowActivate)) + } else if ((aType == QEvent::Show) || (aType == QEvent::WindowActivate)) onShowPanel(); } return ModuleBase_WidgetValidated::eventFilter(theObj, theEvent); } -void PartSet_WidgetSketchLabel::onShowViewPlane(bool toShow) -{ - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); - PartSet_PreviewSketchPlane* aPreviewPlane = aModule->sketchMgr()->previewSketchPlane(); +void PartSet_WidgetSketchLabel::onShowViewPlane(bool toShow) { + PartSet_Module *aModule = + dynamic_cast(myWorkshop->module()); + PartSet_PreviewSketchPlane *aPreviewPlane = + aModule->sketchMgr()->previewSketchPlane(); if (toShow) { - CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); + CompositeFeaturePtr aSketch = + std::dynamic_pointer_cast(myFeature); if (aPreviewPlane->isPlaneCreated()) aPreviewPlane->displaySketchPlane(myWorkshop); else aPreviewPlane->createSketchPlane(aSketch, myWorkshop); - } - else { + } else { aPreviewPlane->eraseSketchPlane(myWorkshop, false); } myWorkshop->viewer()->update(); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index 9424d07e4..e5291ea90 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSet_WidgetSketchLabel_H @@ -24,16 +25,16 @@ #include "PartSet_Tools.h" -#include #include #include +#include #include #include -#include #include +#include class PartSet_PreviewPlanes; @@ -47,49 +48,52 @@ class QPushButton; class QDialog; /** -* \ingroup Modules -* A model widget implementation for a label which provides specific behaviour -* for sketcher starting and launching operations -*/ -class PARTSET_EXPORT PartSet_WidgetSketchLabel : public ModuleBase_WidgetValidated -{ -Q_OBJECT + * \ingroup Modules + * A model widget implementation for a label which provides specific behaviour + * for sketcher starting and launching operations + */ +class PARTSET_EXPORT PartSet_WidgetSketchLabel + : public ModuleBase_WidgetValidated { + Q_OBJECT public: /// Constructor /// \param theParent the parent object /// \param theWorkshop a reference to workshop - /// \param theData the widget configuation. The attribute of the model widget is obtained from - /// \param toShowConstraints a current show constraints state - PartSet_WidgetSketchLabel(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData, - const QMap& toShowConstraints); + /// \param theData the widget configuation. The attribute of the model widget + /// is obtained from \param toShowConstraints a current show constraints state + PartSet_WidgetSketchLabel(QWidget *theParent, + ModuleBase_IWorkshop *theWorkshop, + const Config_WidgetAPI *theData, + const QMap &toShowConstraints); virtual ~PartSet_WidgetSketchLabel(); /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs - /// The method is called by the current operation to process the operation preselection. - /// It is redefined to do nothing if the plane of the sketch has been already set. - /// \param theValues the wrapped selection values - /// \param theToValidate a validation flag - virtual bool setSelection(QList>& theValues, - const bool theToValidate); + /// The method is called by the current operation to process the operation + /// preselection. It is redefined to do nothing if the plane of the sketch has + /// been already set. \param theValues the wrapped selection values \param + /// theToValidate a validation flag + virtual bool + setSelection(QList> &theValues, + const bool theToValidate); /// Fills given container with selection modes if the widget has it - /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes - /// \param theModes [out] a container of modes - virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes); + /// \param [out] theModuleSelectionModes module additional modes, -1 means all + /// default modes \param theModes [out] a container of modes + virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); /// Using widget selection filter only if plane is not defined. - /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes - /// \param [out] selection filters - virtual void selectionFilters(QIntList& theModuleSelectionFilters, - SelectMgr_ListOfFilter& theSelectionFilters); + /// \param [out] theModuleSelectionFilters module additional modes, -1 means + /// all default modes \param [out] selection filters + virtual void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters); /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; /// The methiod called when widget is deactivated virtual void deactivate(); @@ -102,7 +106,7 @@ public: /// This control accepts focus virtual bool focusTo(); - virtual void setHighlighted(bool) { /*do nothing*/ }; + virtual void setHighlighted(bool){/*do nothing*/}; virtual void enableFocusProcessing(); /// Set current state of show free points @@ -111,17 +115,18 @@ public: /// Returns True if the selected presentation can be used for plane definition /// \param thePrs a presentation - static bool canFillSketch(const ModuleBase_ViewerPrsPtr& thePrs); + static bool canFillSketch(const ModuleBase_ViewerPrsPtr &thePrs); - /// If widgets has several panels then this method has to show a page which contains information - /// for current feature. By default does nothing + /// If widgets has several panels then this method has to show a page which + /// contains information for current feature. By default does nothing virtual void showInformativePage() { - if (myStackWidget) myStackWidget->setCurrentIndex(1); + if (myStackWidget) + myStackWidget->setCurrentIndex(1); } signals: /// Signal on plane selection - void planeSelected(const std::shared_ptr& thePln); + void planeSelected(const std::shared_ptr &thePln); /// A show constraint toggled signal /// \param theType a ConstraintVisibleState value @@ -141,26 +146,23 @@ protected: /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be stored - virtual void storeAttributeValue(const AttributePtr& theAttribute); + virtual void storeAttributeValue(const AttributePtr &theAttribute); /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be restored /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const AttributePtr& theAttribute, + virtual void restoreAttributeValue(const AttributePtr &theAttribute, const bool theValid); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs); + virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs); /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom() - { - return true; - } + virtual bool storeValueCustom() { return true; } virtual bool restoreValueCustom(); @@ -168,56 +170,56 @@ protected: virtual void activateCustom(); /// Block the model flush of update and intialization of attribute - /// In additional to curstom realization it blocks initialization for all feature attributes - /// as the current attribute is selection but its modification leads to other attributes change - /// \param theAttribute an attribute - /// \param theToBlock flag whether the model is blocked or unblocked - /// \param isFlushesActived out value if model is blocked, in value if model is unblocked - /// to be used to restore flush state when unblocked - /// \param isAttributeSetInitializedBlocked out value if model is blocked - /// in value if model is unblocked to be used to restore previous state when unblocked + /// In additional to curstom realization it blocks initialization for all + /// feature attributes as the current attribute is selection but its + /// modification leads to other attributes change \param theAttribute an + /// attribute \param theToBlock flag whether the model is blocked or unblocked + /// \param isFlushesActived out value if model is blocked, in value if model + /// is unblocked to be used to restore flush state when unblocked \param + /// isAttributeSetInitializedBlocked out value if model is blocked in value if + /// model is unblocked to be used to restore previous state when unblocked /// \param isAttributeSendUpdatedBlocked out value if model signal is blocked - virtual void blockAttribute(const AttributePtr& theAttribute, const bool& theToBlock, - bool& isFlushesActived, - bool& isAttributeSetInitializedBlocked, - bool& isAttributeSendUpdatedBlocked); + virtual void blockAttribute(const AttributePtr &theAttribute, + const bool &theToBlock, bool &isFlushesActived, + bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked); /// Returns true if envent is processed. virtual bool processSelection(); /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs - /// The method is called by the current operation to process the operation preselection. - /// It is redefined to do nothing if the plane of the sketch has been already set. - /// \param theValues the wrapped selection values - /// \param theToValidate a validation flag - bool setSelectionInternal(const QList& theValues, + /// The method is called by the current operation to process the operation + /// preselection. It is redefined to do nothing if the plane of the sketch has + /// been already set. \param theValues the wrapped selection values \param + /// theToValidate a validation flag + bool setSelectionInternal(const QList &theValues, const bool theToValidate); /// Erase preview planes, disconnect widget, change the view projection /// \param thePrs a selected presentation - void updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs); + void updateByPlaneSelected(const ModuleBase_ViewerPrsPtr &thePrs); /// Set sketch plane from selected object /// \param theFeature a feature of sketch /// \param thePrs a presentation - bool fillSketchPlaneBySelection(const ModuleBase_ViewerPrsPtr& thePrs); + bool fillSketchPlaneBySelection(const ModuleBase_ViewerPrsPtr &thePrs); /// Redefinition of a virtual function - virtual void showEvent(QShowEvent* theEvent); + virtual void showEvent(QShowEvent *theEvent); /// Redefinition of a virtual function - virtual void hideEvent(QHideEvent* theEvent); + virtual void hideEvent(QHideEvent *theEvent); /// Redefinition of a virtual function - virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + virtual bool eventFilter(QObject *theObj, QEvent *theEvent); private slots: /// A slot called on set sketch plane view void onSetPlaneView(); - /// Emits signal about check box state changed with information about ConstraintVisibleState - /// \param theOn a flag show constraints or not + /// Emits signal about check box state changed with information about + /// ConstraintVisibleState \param theOn a flag show constraints or not void onShowConstraint(bool theOn); /// A a slot called on "Change sketch plane" check box toggele @@ -235,43 +237,45 @@ private slots: private: /// Set sketch plane by shape /// \param theShape a planar face - std::shared_ptr setSketchPlane(const TopoDS_Shape& theShape); + std::shared_ptr setSketchPlane(const TopoDS_Shape &theShape); /// Set sketch plane /// \param thePlane a plane - std::shared_ptr setSketchPlane(std::shared_ptr thePlane); + std::shared_ptr + setSketchPlane(std::shared_ptr thePlane); /** - * Returns list of presentations which have displayed shapes with circular edges - * (circles, arcs) which are in pane of of the given sketch - * \param theSketch - the sketch - */ + * Returns list of presentations which have displayed shapes with circular + * edges (circles, arcs) which are in pane of of the given sketch \param + * theSketch - the sketch + */ QList findCircularEdgesInPlane(); private: /// class to show/hide preview planes - PartSet_PreviewPlanes* myPreviewPlanes; + PartSet_PreviewPlanes *myPreviewPlanes; - QCheckBox* myViewInverted; - QCheckBox* myViewVisible; - QCheckBox* myRemoveExternal; - QCheckBox* myShowPoints; - QCheckBox* myAutoConstraints; + QCheckBox *myViewInverted; + QCheckBox *myViewVisible; + QCheckBox *myRemoveExternal; + QCheckBox *myShowPoints; + QCheckBox *myAutoConstraints; - QMap myShowConstraints; + QMap myShowConstraints; - QWidget* mySizeOfViewWidget; ///< Size of view widget, visualized if preview planes are shown - QLineEdit* mySizeOfView; ///< Value of square of size of View - QStackedWidget* myStackWidget; + QWidget *mySizeOfViewWidget; ///< Size of view widget, visualized if preview + ///< planes are shown + QLineEdit *mySizeOfView; ///< Value of square of size of View + QStackedWidget *myStackWidget; - QLabel* myDoFLabel; - QPushButton* myShowDOFBtn; + QLabel *myDoFLabel; + QPushButton *myShowDOFBtn; bool myOpenTransaction; bool myIsSelection; - QDialog* myPartSetMessage; - QDialog* mySizeMessage; + QDialog *myPartSetMessage; + QDialog *mySizeMessage; GeomPlanePtr myTmpPlane; }; diff --git a/src/PartSetAPI/CMakeLists.txt b/src/PartSetAPI/CMakeLists.txt index 8a04dbc43..1d37a9ab2 100644 --- a/src/PartSetAPI/CMakeLists.txt +++ b/src/PartSetAPI/CMakeLists.txt @@ -98,16 +98,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/PartSetAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/PartSetAPI/PartSetAPI.h b/src/PartSetAPI/PartSetAPI.h index 619c3f050..4d9df20f1 100644 --- a/src/PartSetAPI/PartSetAPI.h +++ b/src/PartSetAPI/PartSetAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARTSETAPI_H @@ -22,13 +23,13 @@ #if defined PARTSETAPI_EXPORTS #if defined WIN32 -#define PARTSETAPI_EXPORT __declspec( dllexport ) +#define PARTSETAPI_EXPORT __declspec(dllexport) #else #define PARTSETAPI_EXPORT #endif #else #if defined WIN32 -#define PARTSETAPI_EXPORT __declspec( dllimport ) +#define PARTSETAPI_EXPORT __declspec(dllimport) #else #define PARTSETAPI_EXPORT #endif diff --git a/src/PartSetAPI/PartSetAPI_Part.cpp b/src/PartSetAPI/PartSetAPI_Part.cpp index 0f8e0bcf7..f2cae3395 100644 --- a/src/PartSetAPI/PartSetAPI_Part.cpp +++ b/src/PartSetAPI/PartSetAPI_Part.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSetAPI_Part.h" @@ -28,40 +29,35 @@ #include //-------------------------------------------------------------------------------------- PartSetAPI_Part::PartSetAPI_Part( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } -PartSetAPI_Part::~PartSetAPI_Part() -{ -} +PartSetAPI_Part::~PartSetAPI_Part() {} //-------------------------------------------------------------------------------------- -std::shared_ptr PartSetAPI_Part::document() const -{ - return std::dynamic_pointer_cast(defaultResult())->partDoc(); +std::shared_ptr PartSetAPI_Part::document() const { + return std::dynamic_pointer_cast(defaultResult()) + ->partDoc(); } -void PartSetAPI_Part::dump(ModelHighAPI_Dumper& theDumper) const -{ +void PartSetAPI_Part::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addPart(" << aDocName << ")" << std::endl; } //-------------------------------------------------------------------------------------- -PartPtr addPart(const std::shared_ptr & thePart) -{ - std::shared_ptr aFeature = thePart->addFeature(PartSetAPI_Part::ID()); +PartPtr addPart(const std::shared_ptr &thePart) { + std::shared_ptr aFeature = + thePart->addFeature(PartSetAPI_Part::ID()); aFeature->execute(); return PartPtr(new PartSetAPI_Part(aFeature)); } -PartPtr duplicatePart(const ModelHighAPI_Interface& thePart) -{ +PartPtr duplicatePart(const ModelHighAPI_Interface &thePart) { PartPtr aResult; // only the active part is duplicated, so, activate it FeaturePtr aPartFeature = thePart.feature(); @@ -69,17 +65,22 @@ PartPtr duplicatePart(const ModelHighAPI_Interface& thePart) // duplication of the current part is performed DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument(); aPartSet->setCurrentFeature(aPartFeature, false); - DocumentPtr aPartDoc = - std::dynamic_pointer_cast(aPartFeature->firstResult())->partDoc(); + DocumentPtr aPartDoc = std::dynamic_pointer_cast( + aPartFeature->firstResult()) + ->partDoc(); if (aPartDoc.get()) { ModelAPI_Session::get()->setActiveDocument(aPartDoc); - FeaturePtr aDuplicate = aPartDoc->addFeature(PartSetPlugin_Duplicate::ID()); - //aDuplicate->execute(); // it is executed at creation because it is action - FeaturePtr aNewPart = aPartSet->currentFeature(false); // a copy becomes a current + FeaturePtr aDuplicate = + aPartDoc->addFeature(PartSetPlugin_Duplicate::ID()); + // aDuplicate->execute(); // it is executed at creation because it is + // action + FeaturePtr aNewPart = + aPartSet->currentFeature(false); // a copy becomes a current if (aNewPart.get()) { aResult = PartPtr(new PartSetAPI_Part(aNewPart)); DocumentPtr aNewDoc = std::dynamic_pointer_cast( - aNewPart->firstResult())->partDoc(); + aNewPart->firstResult()) + ->partDoc(); ModelAPI_Session::get()->setActiveDocument(aNewDoc); } } @@ -87,15 +88,15 @@ PartPtr duplicatePart(const ModelHighAPI_Interface& thePart) return aResult; } -void removePart(const ModelHighAPI_Interface& thePart) -{ +void removePart(const ModelHighAPI_Interface &thePart) { FeaturePtr aPartFeature = thePart.feature(); if (aPartFeature) { // duplication of the current part is performed DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument(); aPartSet->setCurrentFeature(aPartFeature, false); - DocumentPtr aPartDoc = - std::dynamic_pointer_cast(aPartFeature->firstResult())->partDoc(); + DocumentPtr aPartDoc = std::dynamic_pointer_cast( + aPartFeature->firstResult()) + ->partDoc(); if (aPartDoc.get()) { ModelAPI_Session::get()->setActiveDocument(aPartDoc); aPartDoc->addFeature(PartSetPlugin_Remove::ID()); diff --git a/src/PartSetAPI/PartSetAPI_Part.h b/src/PartSetAPI/PartSetAPI_Part.h index c2e0c7aca..9bfdf8e2c 100644 --- a/src/PartSetAPI/PartSetAPI_Part.h +++ b/src/PartSetAPI/PartSetAPI_Part.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_PARTSETAPI_PARTSETAPI_PART_H_ @@ -34,12 +35,11 @@ class ModelAPI_Document; * \ingroup CPPHighAPI * \brief Interface for Part feature */ -class PartSetAPI_Part : public ModelHighAPI_Interface -{ +class PartSetAPI_Part : public ModelHighAPI_Interface { public: /// Constructor without values PARTSETAPI_EXPORT - explicit PartSetAPI_Part(const std::shared_ptr & theFeature); + explicit PartSetAPI_Part(const std::shared_ptr &theFeature); /// Destructor PARTSETAPI_EXPORT virtual ~PartSetAPI_Part(); @@ -52,7 +52,7 @@ public: /// Dump wrapped feature PARTSETAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Part object @@ -62,19 +62,19 @@ typedef std::shared_ptr PartPtr; * \brief Create Part feature */ PARTSETAPI_EXPORT -PartPtr addPart(const std::shared_ptr & thePartSet); +PartPtr addPart(const std::shared_ptr &thePartSet); /**\ingroup CPPHighAPI * \brief Duplicate Part feature */ PARTSETAPI_EXPORT -PartPtr duplicatePart(const ModelHighAPI_Interface& thePart); +PartPtr duplicatePart(const ModelHighAPI_Interface &thePart); /**\ingroup CPPHighAPI * \brief Remove Part feature */ PARTSETAPI_EXPORT -void removePart(const ModelHighAPI_Interface& thePart); +void removePart(const ModelHighAPI_Interface &thePart); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/PartSetAPI/PartSetAPI_swig.h b/src/PartSetAPI/PartSetAPI_swig.h index 6cdcf5cee..d2960d101 100644 --- a/src/PartSetAPI/PartSetAPI_swig.h +++ b/src/PartSetAPI/PartSetAPI_swig.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_PARTSETAPI_PARTSETAPI_SWIG_H_ #define SRC_PARTSETAPI_PARTSETAPI_SWIG_H_ - #include +#include - #include "PartSetAPI_Part.h" +#include "PartSetAPI_Part.h" #endif /* SRC_PARTSETAPI_PARTSETAPI_SWIG_H_ */ diff --git a/src/PartSetPlugin/PartSetPlugin.h b/src/PartSetPlugin/PartSetPlugin.h index 8692c4c16..7c4ea609b 100644 --- a/src/PartSetPlugin/PartSetPlugin.h +++ b/src/PartSetPlugin/PartSetPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PARTSETPLUGIN_H @@ -22,13 +23,13 @@ #if defined PARTSETPLUGIN_EXPORTS #if defined WIN32 -#define PARTSETPLUGIN_EXPORT __declspec( dllexport ) +#define PARTSETPLUGIN_EXPORT __declspec(dllexport) #else #define PARTSETPLUGIN_EXPORT #endif #else #if defined WIN32 -#define PARTSETPLUGIN_EXPORT __declspec( dllimport ) +#define PARTSETPLUGIN_EXPORT __declspec(dllimport) #else #define PARTSETPLUGIN_EXPORT #endif diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp index e7107b05b..0ff59cb37 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp @@ -14,28 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSetPlugin_Duplicate.h" #include "PartSetPlugin_Part.h" -#include #include +#include #include #include #include #include -void PartSetPlugin_Duplicate::execute() -{ +void PartSetPlugin_Duplicate::execute() { std::shared_ptr aPManager = ModelAPI_Session::get(); std::shared_ptr aRoot = aPManager->moduleDocument(); - std::shared_ptr aSource; // searching for source document attribute + std::shared_ptr + aSource; // searching for source document attribute for (int a = aRoot->size(getGroup()) - 1; a >= 0; a--) { - aSource = std::dynamic_pointer_cast(aRoot->object(getGroup(), a)); - if (aSource && aSource->data() - && aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value() - == aPManager->activeDocument()) + aSource = std::dynamic_pointer_cast( + aRoot->object(getGroup(), a)); + if (aSource && aSource->data() && + aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value() == + aPManager->activeDocument()) break; aSource.reset(); } @@ -45,7 +47,9 @@ void PartSetPlugin_Duplicate::execute() aNewPart->execute(); // to make result and generate a unique name std::shared_ptr aCopy = aPManager->copy( - aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(), - std::dynamic_pointer_cast(aNewPart->firstResult())->partDoc()->id()); + aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(), + std::dynamic_pointer_cast(aNewPart->firstResult()) + ->partDoc() + ->id()); } } diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.h b/src/PartSetPlugin/PartSetPlugin_Duplicate.h index d2fac7384..411c4dcc8 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.h +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSetPlugin_Duplicate_H_ @@ -27,49 +28,39 @@ * \ingroup Plugins * \brief Duplicates the active part (not root). Creates a new "part" feature. */ -class PartSetPlugin_Duplicate : public ModelAPI_Feature -{ - public: - +class PartSetPlugin_Duplicate : public ModelAPI_Feature { +public: /// Duplicate kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_REMOVE_KIND("Duplicate"); return MY_REMOVE_KIND; } -//LCOV_EXCL_START + // LCOV_EXCL_START /// Returns the kind of a feature - PARTSETPLUGIN_EXPORT virtual const std::string& getKind() - { + PARTSETPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PartSetPlugin_Duplicate::ID(); return MY_KIND; } -//LCOV_EXCL_STOP + // LCOV_EXCL_STOP /// Returns to which group in the document must be added feature - PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() - { + PARTSETPLUGIN_EXPORT virtual const std::string &getGroup() { static std::string MY_GROUP = "Parts"; return MY_GROUP; } - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PARTSETPLUGIN_EXPORT virtual void initAttributes() {} /// Not normal feature that stored in the tree - PARTSETPLUGIN_EXPORT virtual bool isAction() - { - return true; - } + PARTSETPLUGIN_EXPORT virtual bool isAction() { return true; } /// Performs the "duplicate" PARTSETPLUGIN_EXPORT virtual void execute(); /// Use plugin manager for features creation - PartSetPlugin_Duplicate() - { - } - + PartSetPlugin_Duplicate() {} }; #endif diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cpp b/src/PartSetPlugin/PartSetPlugin_Part.cpp index c5c26e7fd..e362482f6 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Part.cpp @@ -14,40 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSetPlugin_Part.h" -#include "ModelAPI_Session.h" -#include "ModelAPI_Document.h" -#include "ModelAPI_Data.h" #include "ModelAPI_AttributeDocRef.h" -#include +#include "ModelAPI_Data.h" +#include "ModelAPI_Document.h" +#include "ModelAPI_Session.h" #include +#include -PartSetPlugin_Part::PartSetPlugin_Part() -{ -} +PartSetPlugin_Part::PartSetPlugin_Part() {} -void PartSetPlugin_Part::initAttributes() -{ // all is in part result +void PartSetPlugin_Part::initAttributes() { // all is in part result } -void PartSetPlugin_Part::execute() -{ - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); +void PartSetPlugin_Part::execute() { + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (!aResult) { aResult = document()->createPart(data()); setResult(aResult); - // do not activate part by simple execution if it is not loaded yet: it must be explicitly - // activated for this + // do not activate part by simple execution if it is not loaded yet: it must + // be explicitly activated for this std::shared_ptr aDocRef = - aResult->data()->document(ModelAPI_ResultPart::DOC_REF()); - if (!ModelAPI_Session::get()->isLoadByDemand(aResult->data()->name(), aDocRef->docId())) { - // On undo/redo creation of the part result the Object Browser must get creation event - // earlier that activation of this part event (otherwise the crash is produced) - // So, send a creation event earlier, without any grouping - static Events_ID aCreateID = Events_Loop::eventByName(EVENT_OBJECT_CREATED); + aResult->data()->document(ModelAPI_ResultPart::DOC_REF()); + if (!ModelAPI_Session::get()->isLoadByDemand(aResult->data()->name(), + aDocRef->docId())) { + // On undo/redo creation of the part result the Object Browser must get + // creation event earlier that activation of this part event (otherwise + // the crash is produced) So, send a creation event earlier, without any + // grouping + static Events_ID aCreateID = + Events_Loop::eventByName(EVENT_OBJECT_CREATED); ModelAPI_EventCreator::get()->sendUpdated(aResult, aCreateID, false); aResult->activate(); @@ -57,15 +58,15 @@ void PartSetPlugin_Part::execute() } } -const std::string& PartSetPlugin_Part::documentToAdd() -{ +const std::string &PartSetPlugin_Part::documentToAdd() { // part must be added only to the module document return ModelAPI_Session::get()->moduleDocument()->kind(); } -std::shared_ptr PartSetPlugin_Part::addFeature(std::string theID) -{ - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); +std::shared_ptr +PartSetPlugin_Part::addFeature(std::string theID) { + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (aResult.get()) { DocumentPtr aDoc = aResult->partDoc(); if (aDoc.get() && aDoc->isOpened()) @@ -74,9 +75,9 @@ std::shared_ptr PartSetPlugin_Part::addFeature(std::string the return FeaturePtr(); } -int PartSetPlugin_Part::numberOfSubs(bool /*forTree*/) const -{ - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); +int PartSetPlugin_Part::numberOfSubs(bool /*forTree*/) const { + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (aResult.get()) { DocumentPtr aDoc = aResult->partDoc(); if (aDoc.get() && aDoc->isOpened()) @@ -85,10 +86,10 @@ int PartSetPlugin_Part::numberOfSubs(bool /*forTree*/) const return 0; } -std::shared_ptr PartSetPlugin_Part::subFeature(const int theIndex, - bool /*forTree*/) -{ - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); +std::shared_ptr +PartSetPlugin_Part::subFeature(const int theIndex, bool /*forTree*/) { + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (aResult.get()) { DocumentPtr aDoc = aResult->partDoc(); if (aDoc.get() && aDoc->isOpened()) { @@ -97,22 +98,24 @@ std::shared_ptr PartSetPlugin_Part::subFeature(const int theIn } return FeaturePtr(); } -//LCOV_EXCL_START -int PartSetPlugin_Part::subFeatureId(const int theIndex) const -{ - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); +// LCOV_EXCL_START +int PartSetPlugin_Part::subFeatureId(const int theIndex) const { + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (aResult.get()) { DocumentPtr aDoc = aResult->partDoc(); if (aDoc.get() && aDoc->isOpened()) { - return aDoc->object(ModelAPI_Feature::group(), theIndex)->data()->featureId(); + return aDoc->object(ModelAPI_Feature::group(), theIndex) + ->data() + ->featureId(); } } return 0; // none } -//LCOV_EXCL_STOP -bool PartSetPlugin_Part::isSub(ObjectPtr theObject) const -{ - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); +// LCOV_EXCL_STOP +bool PartSetPlugin_Part::isSub(ObjectPtr theObject) const { + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (aResult.get()) { DocumentPtr aDoc = aResult->partDoc(); return theObject->document() == aDoc; @@ -121,7 +124,8 @@ bool PartSetPlugin_Part::isSub(ObjectPtr theObject) const } void PartSetPlugin_Part::erase() { - ResultPartPtr aResult = std::dynamic_pointer_cast(firstResult()); + ResultPartPtr aResult = + std::dynamic_pointer_cast(firstResult()); if (aResult.get()) { DocumentPtr aDoc = aResult->partDoc(); if (aDoc.get()) diff --git a/src/PartSetPlugin/PartSetPlugin_Part.h b/src/PartSetPlugin/PartSetPlugin_Part.h index 6e761618e..76b7d2714 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.h +++ b/src/PartSetPlugin/PartSetPlugin_Part.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSetPlugin_Part_H_ @@ -28,39 +29,36 @@ * \brief Feature for creation of the new part in PartSet. * All sub-features are sub-elements of composite feature. */ -class PartSetPlugin_Part : public ModelAPI_CompositeFeature -{ - public: +class PartSetPlugin_Part : public ModelAPI_CompositeFeature { +public: /// Part kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_PART_KIND("Part"); return MY_PART_KIND; } /// Returns the kind of a feature - PARTSETPLUGIN_EXPORT virtual const std::string& getKind() - { + PARTSETPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PartSetPlugin_Part::ID(); return MY_KIND; } -//LCOV_EXCL_START + // LCOV_EXCL_START /// Returns to which group in the document must be added feature - PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() - { + PARTSETPLUGIN_EXPORT virtual const std::string &getGroup() { static std::string MY_GROUP = "Parts"; return MY_GROUP; } -//LCOV_EXCL_STOP + // LCOV_EXCL_STOP /// Creates a new part document if needed PARTSETPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PARTSETPLUGIN_EXPORT virtual void initAttributes(); /// Part must be added only to PartSet - PARTSETPLUGIN_EXPORT virtual const std::string& documentToAdd(); + PARTSETPLUGIN_EXPORT virtual const std::string &documentToAdd(); // composite feature methods @@ -71,22 +69,26 @@ class PartSetPlugin_Part : public ModelAPI_CompositeFeature virtual int numberOfSubs(bool forTree = false) const; /// Returns the sub-feature by zero-base index - virtual std::shared_ptr subFeature(const int theIndex, bool forTree = false); + virtual std::shared_ptr subFeature(const int theIndex, + bool forTree = false); - /// Returns the sub-feature unique identifier in this composite feature by zero-base index + /// Returns the sub-feature unique identifier in this composite feature by + /// zero-base index virtual int subFeatureId(const int theIndex) const; /// Returns true if feature or reuslt belong to this composite feature as subs virtual bool isSub(ObjectPtr theObject) const; - /// This method to inform that sub-feature is removed and must be removed from the internal data - /// structures of the owner (the remove from the document will be done outside just after) + /// This method to inform that sub-feature is removed and must be removed from + /// the internal data structures of the owner (the remove from the document + /// will be done outside just after) virtual void removeFeature(std::shared_ptr theFeature) {} /// Use plugin manager for features creation PartSetPlugin_Part(); - /// Just removes all features of the part without touching the document data (to be able undo) + /// Just removes all features of the part without touching the document data + /// (to be able undo) PARTSETPLUGIN_EXPORT virtual void erase(); }; diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp index 3e16f0915..45f96fc98 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp @@ -14,34 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSetPlugin_Plugin.h" -#include "PartSetPlugin_Part.h" #include "PartSetPlugin_Duplicate.h" +#include "PartSetPlugin_Part.h" #include "PartSetPlugin_Remove.h" #include -#include #include +#include #ifdef _DEBUG #include #endif // the only created instance of this plugin -static PartSetPlugin_Plugin* MY_PARTSET_INSTANCE = new PartSetPlugin_Plugin(); +static PartSetPlugin_Plugin *MY_PARTSET_INSTANCE = new PartSetPlugin_Plugin(); -PartSetPlugin_Plugin::PartSetPlugin_Plugin() -{ +PartSetPlugin_Plugin::PartSetPlugin_Plugin() { // register this plugin ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr PartSetPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr PartSetPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == PartSetPlugin_Part::ID()) { return FeaturePtr(new PartSetPlugin_Part); } @@ -55,25 +54,27 @@ FeaturePtr PartSetPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(); } // used only in GUI -//LCOV_EXCL_START -void PartSetPlugin_Plugin::processEvent(const std::shared_ptr& theMessage) -{ +// LCOV_EXCL_START +void PartSetPlugin_Plugin::processEvent( + const std::shared_ptr &theMessage) { const Events_ID kRequestEvent = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_REQUEST); if (theMessage->eventID() == kRequestEvent) { Events_Loop::loop()->send(getFeaturesState(), false); } else if (theMessage.get()) { - #ifdef _DEBUG - std::cout << "PartSetPlugin_Plugin::processEvent: unhandled message caught: " << std::endl - << theMessage->eventID().eventText() << std::endl; - #endif +#ifdef _DEBUG + std::cout + << "PartSetPlugin_Plugin::processEvent: unhandled message caught: " + << std::endl + << theMessage->eventID().eventText() << std::endl; +#endif } } -std::shared_ptr PartSetPlugin_Plugin::getFeaturesState() -{ +std::shared_ptr +PartSetPlugin_Plugin::getFeaturesState() { const Events_ID kResponseEvent = - Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); + Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); std::shared_ptr aMsg( new ModelAPI_FeatureStateMessage(kResponseEvent, this)); std::string aStdDocKind = ModelAPI_Session::get()->activeDocument()->kind(); @@ -83,4 +84,4 @@ std::shared_ptr PartSetPlugin_Plugin::getFeaturesS aMsg->setState(PartSetPlugin_Remove::ID(), aDocIsPart); return aMsg; } -//LCOV_EXCL_STOP +// LCOV_EXCL_STOP diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.h b/src/PartSetPlugin/PartSetPlugin_Plugin.h index bb78c8404..76b6e3a94 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.h +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSetPlugin_Plugin_H_ #define PartSetPlugin_Plugin_H_ -#include -#include -#include #include +#include +#include +#include #include @@ -33,21 +34,22 @@ * \ingroup Plugins * \brief The main class for management the part set operations as plugin. */ -class PartSetPlugin_Plugin : public ModelAPI_Plugin, - public Events_Listener -{ - public: +class PartSetPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener { +public: /// Creates the feature object of this plugin by the feature string ID - PARTSETPLUGIN_EXPORT virtual FeaturePtr createFeature(std::string theFeatureID); + PARTSETPLUGIN_EXPORT virtual FeaturePtr + createFeature(std::string theFeatureID); /// Is needed for python wrapping by swig PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin(); //! Redefinition of Events_Listener method - PARTSETPLUGIN_EXPORT virtual void processEvent(const std::shared_ptr& theMessage); + PARTSETPLUGIN_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage); //! Performs the chenges of enabled/disabled state in the toolbar //! due to the current state of the application. - PARTSETPLUGIN_EXPORT std::shared_ptr getFeaturesState(); + PARTSETPLUGIN_EXPORT std::shared_ptr + getFeaturesState(); }; #endif diff --git a/src/PartSetPlugin/PartSetPlugin_Remove.cpp b/src/PartSetPlugin/PartSetPlugin_Remove.cpp index 16adc503e..e428eeeaf 100644 --- a/src/PartSetPlugin/PartSetPlugin_Remove.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Remove.cpp @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PartSetPlugin_Remove.h" #include "PartSetPlugin_Part.h" -#include -#include #include +#include +#include +#include +#include #include #include -#include #include -#include #include -void PartSetPlugin_Remove::execute() -{ +void PartSetPlugin_Remove::execute() { std::shared_ptr aPManager = ModelAPI_Session::get(); std::shared_ptr aRoot = aPManager->moduleDocument(); DocumentPtr aThisDoc = document(); @@ -40,19 +40,20 @@ void PartSetPlugin_Remove::execute() if (aPart.get()) { FeaturePtr aFeature = aRoot->feature(aPart); if (aFeature) { - // do remove, but don't do real close (features are erased without persistence changes - // document remove may be undoed) + // do remove, but don't do real close (features are erased without + // persistence changes document remove may be undoed) // aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value()->close(); - std::set > aRefFeatures; + std::set> aRefFeatures; aRoot->refsToFeature(aFeature, aRefFeatures); if (aRefFeatures.empty()) { // before removing the part make the partSet active document if (aThisDoc == aPManager->activeDocument()) aPManager->setActiveDocument(aRoot); aRoot->removeFeature(aFeature); - // the redisplay signal should be flushed in order to erase the feature presentation - // in the viewer after removeFeature from the document - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + // the redisplay signal should be flushed in order to erase the feature + // presentation in the viewer after removeFeature from the document + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } } } diff --git a/src/PartSetPlugin/PartSetPlugin_Remove.h b/src/PartSetPlugin/PartSetPlugin_Remove.h index 5c92e68e8..a39d43e6e 100644 --- a/src/PartSetPlugin/PartSetPlugin_Remove.h +++ b/src/PartSetPlugin/PartSetPlugin_Remove.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PartSetPlugin_Remove_H_ @@ -27,49 +28,39 @@ * \ingroup Plugins * \brief Feature for creation of the new part in PartSet. */ -class PartSetPlugin_Remove : public ModelAPI_Feature -{ - public: +class PartSetPlugin_Remove : public ModelAPI_Feature { +public: /// Remove kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_REMOVE_KIND("Remove"); return MY_REMOVE_KIND; } -//LCOV_EXCL_START + // LCOV_EXCL_START /// Returns the kind of a feature - PARTSETPLUGIN_EXPORT virtual const std::string& getKind() - { + PARTSETPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PartSetPlugin_Remove::ID(); return MY_KIND; } /// Returns to which group in the document must be added feature - PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() - { + PARTSETPLUGIN_EXPORT virtual const std::string &getGroup() { static std::string MY_GROUP = "Parts"; return MY_GROUP; } - /// Request for initialization of data model of the feature: adding all attributes - PARTSETPLUGIN_EXPORT virtual void initAttributes() - { - } -//LCOV_EXCL_STOP + /// Request for initialization of data model of the feature: adding all + /// attributes + PARTSETPLUGIN_EXPORT virtual void initAttributes() {} + // LCOV_EXCL_STOP /// Not normal feature that stored in the tree - PARTSETPLUGIN_EXPORT virtual bool isAction() - { - return true; - } + PARTSETPLUGIN_EXPORT virtual bool isAction() { return true; } /// Performs the "remove" PARTSETPLUGIN_EXPORT virtual void execute(); /// Use plugin manager for features creation - PartSetPlugin_Remove() - { - } + PartSetPlugin_Remove() {} }; #endif diff --git a/src/PartSetPlugin/doc/TUI_new_partFeature.rst b/src/PartSetPlugin/doc/TUI_new_partFeature.rst index b3c198aae..eeb95a3b1 100644 --- a/src/PartSetPlugin/doc/TUI_new_partFeature.rst +++ b/src/PartSetPlugin/doc/TUI_new_partFeature.rst @@ -4,7 +4,7 @@ Create Part =========== -.. literalinclude:: examples/new_part.py +.. literalinclude:: examples/new_part.py :linenos: :language: python diff --git a/src/PrimitivesAPI/PrimitivesAPI.h b/src/PrimitivesAPI/PrimitivesAPI.h index da23902de..21a08a7f5 100644 --- a/src/PrimitivesAPI/PrimitivesAPI.h +++ b/src/PrimitivesAPI/PrimitivesAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESAPI_H @@ -22,16 +23,16 @@ #if defined PRIMITIVESAPI_EXPORTS #if defined WIN32 -#define PRIMITIVESAPI_EXPORT __declspec( dllexport ) +#define PRIMITIVESAPI_EXPORT __declspec(dllexport) #else #define PRIMITIVESAPI_EXPORT #endif #else #if defined WIN32 -#define PRIMITIVESAPI_EXPORT __declspec( dllimport ) +#define PRIMITIVESAPI_EXPORT __declspec(dllimport) #else #define PRIMITIVESAPI_EXPORT #endif #endif -#endif //PRIMITIVESAPI_H +#endif // PRIMITIVESAPI_H diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.cpp b/src/PrimitivesAPI/PrimitivesAPI_Box.cpp index fb6381b11..8a5c7319f 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Box.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PrimitivesAPI_Box.h" @@ -23,46 +24,42 @@ #include //================================================================================================== -PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Box::PrimitivesAPI_Box( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature, - const ModelHighAPI_Double & theDx, - const ModelHighAPI_Double & theDy, - const ModelHighAPI_Double & theDz) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Box::PrimitivesAPI_Box( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theDx, const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz) + : ModelHighAPI_Interface(theFeature) { if (initialize()) setDimensions(theDx, theDy, theDz); } //================================================================================================== -PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Box::PrimitivesAPI_Box( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint) + : ModelHighAPI_Interface(theFeature) { if (initialize()) setPoints(theFirstPoint, theSecondPoint); } //================================================================================================== -PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theOx, - const ModelHighAPI_Double& theOy, - const ModelHighAPI_Double& theOz, - const ModelHighAPI_Double& theHalfX, - const ModelHighAPI_Double& theHalfY, - const ModelHighAPI_Double& theHalfZ) -: ModelHighAPI_Interface(theFeature) -{ - if (initialize()) - { - fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_ONE_POINT_AND_DIMS(), creationMethod()); +PrimitivesAPI_Box::PrimitivesAPI_Box( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theOx, const ModelHighAPI_Double &theOy, + const ModelHighAPI_Double &theOz, const ModelHighAPI_Double &theHalfX, + const ModelHighAPI_Double &theHalfY, const ModelHighAPI_Double &theHalfZ) + : ModelHighAPI_Interface(theFeature) { + if (initialize()) { + fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_ONE_POINT_AND_DIMS(), + creationMethod()); fillAttribute(theOx, ox()); fillAttribute(theOy, oy()); fillAttribute(theOz, oz()); @@ -74,17 +71,14 @@ PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& th } //================================================================================================== -PrimitivesAPI_Box::~PrimitivesAPI_Box() -{ - -} +PrimitivesAPI_Box::~PrimitivesAPI_Box() {} //================================================================================================== -void PrimitivesAPI_Box::setDimensions(const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz) -{ - fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_DIMENSIONS(), creationMethod()); +void PrimitivesAPI_Box::setDimensions(const ModelHighAPI_Double &theDx, + const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz) { + fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_DIMENSIONS(), + creationMethod()); fillAttribute(theDx, dx()); fillAttribute(theDy, dy()); fillAttribute(theDz, dz()); @@ -93,10 +87,11 @@ void PrimitivesAPI_Box::setDimensions(const ModelHighAPI_Double& theDx, } //================================================================================================== -void PrimitivesAPI_Box::setPoints(const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint) -{ - fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_TWO_POINTS(), creationMethod()); +void PrimitivesAPI_Box::setPoints( + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint) { + fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_TWO_POINTS(), + creationMethod()); fillAttribute(theFirstPoint, firstPoint()); fillAttribute(theSecondPoint, secondPoint()); @@ -104,10 +99,9 @@ void PrimitivesAPI_Box::setPoints(const ModelHighAPI_Selection& theFirstPoint, } //================================================================================================== -void PrimitivesAPI_Box::setOrigin(const ModelHighAPI_Double& theOx, - const ModelHighAPI_Double& theOy, - const ModelHighAPI_Double& theOz) -{ +void PrimitivesAPI_Box::setOrigin(const ModelHighAPI_Double &theOx, + const ModelHighAPI_Double &theOy, + const ModelHighAPI_Double &theOz) { fillAttribute(theOx, ox()); fillAttribute(theOy, oy()); fillAttribute(theOz, oz()); @@ -116,10 +110,10 @@ void PrimitivesAPI_Box::setOrigin(const ModelHighAPI_Double& theOx, } //================================================================================================== -void PrimitivesAPI_Box::setHalfLengths(const ModelHighAPI_Double& theHalfLengthX, - const ModelHighAPI_Double& theHalfLengthY, - const ModelHighAPI_Double& theHalfLengthZ) -{ +void PrimitivesAPI_Box::setHalfLengths( + const ModelHighAPI_Double &theHalfLengthX, + const ModelHighAPI_Double &theHalfLengthY, + const ModelHighAPI_Double &theHalfLengthZ) { fillAttribute(theHalfLengthX, halfdx()); fillAttribute(theHalfLengthY, halfdy()); fillAttribute(theHalfLengthZ, halfdz()); @@ -128,33 +122,39 @@ void PrimitivesAPI_Box::setHalfLengths(const ModelHighAPI_Double& theHalfLengthX } //================================================================================================== -void PrimitivesAPI_Box::dump(ModelHighAPI_Dumper& theDumper) const -{ +void PrimitivesAPI_Box::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addBox(" << aDocName; - std::string aCreationMethod = aBase->string(PrimitivesPlugin_Box::CREATION_METHOD())->value(); + std::string aCreationMethod = + aBase->string(PrimitivesPlugin_Box::CREATION_METHOD())->value(); - if(aCreationMethod == PrimitivesPlugin_Box::CREATION_METHOD_BY_DIMENSIONS()) { + if (aCreationMethod == + PrimitivesPlugin_Box::CREATION_METHOD_BY_DIMENSIONS()) { AttributeDoublePtr anAttrDx = aBase->real(PrimitivesPlugin_Box::DX_ID()); AttributeDoublePtr anAttrDy = aBase->real(PrimitivesPlugin_Box::DY_ID()); AttributeDoublePtr anAttrDz = aBase->real(PrimitivesPlugin_Box::DZ_ID()); theDumper << ", " << anAttrDx << ", " << anAttrDy << ", " << anAttrDz; - } else if (aCreationMethod == PrimitivesPlugin_Box::CREATION_METHOD_BY_TWO_POINTS()) { + } else if (aCreationMethod == + PrimitivesPlugin_Box::CREATION_METHOD_BY_TWO_POINTS()) { AttributeSelectionPtr anAttrFirstPnt = - aBase->selection(PrimitivesPlugin_Box::POINT_FIRST_ID()); + aBase->selection(PrimitivesPlugin_Box::POINT_FIRST_ID()); AttributeSelectionPtr anAttrSecondPnt = - aBase->selection(PrimitivesPlugin_Box::POINT_SECOND_ID()); + aBase->selection(PrimitivesPlugin_Box::POINT_SECOND_ID()); theDumper << ", " << anAttrFirstPnt << ", " << anAttrSecondPnt; - } else if (aCreationMethod == PrimitivesPlugin_Box::CREATION_METHOD_BY_ONE_POINT_AND_DIMS()) { + } else if (aCreationMethod == + PrimitivesPlugin_Box::CREATION_METHOD_BY_ONE_POINT_AND_DIMS()) { AttributeDoublePtr anAttrOx = aBase->real(PrimitivesPlugin_Box::OX_ID()); AttributeDoublePtr anAttrOy = aBase->real(PrimitivesPlugin_Box::OY_ID()); AttributeDoublePtr anAttrOz = aBase->real(PrimitivesPlugin_Box::OZ_ID()); - AttributeDoublePtr anAttrHalfLengthX = aBase->real(PrimitivesPlugin_Box::HALF_DX_ID()); - AttributeDoublePtr anAttrHalfLengthY = aBase->real(PrimitivesPlugin_Box::HALF_DY_ID()); - AttributeDoublePtr anAttrHalfLengthZ = aBase->real(PrimitivesPlugin_Box::HALF_DZ_ID()); + AttributeDoublePtr anAttrHalfLengthX = + aBase->real(PrimitivesPlugin_Box::HALF_DX_ID()); + AttributeDoublePtr anAttrHalfLengthY = + aBase->real(PrimitivesPlugin_Box::HALF_DY_ID()); + AttributeDoublePtr anAttrHalfLengthZ = + aBase->real(PrimitivesPlugin_Box::HALF_DZ_ID()); theDumper << ", " << anAttrOx << ", " << anAttrOy << ", " << anAttrOz; theDumper << ", " << anAttrHalfLengthX << ", " << anAttrHalfLengthY; theDumper << ", " << anAttrHalfLengthZ; @@ -164,34 +164,35 @@ void PrimitivesAPI_Box::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -BoxPtr addBox(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Box::ID()); +BoxPtr addBox(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theDx, + const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Box::ID()); return BoxPtr(new PrimitivesAPI_Box(aFeature, theDx, theDy, theDz)); } //================================================================================================== -BoxPtr addBox(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Box::ID()); +BoxPtr addBox(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Box::ID()); return BoxPtr(new PrimitivesAPI_Box(aFeature, theFirstPoint, theSecondPoint)); } //================================================================================================== -BoxPtr addBox(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theOx, - const ModelHighAPI_Double& theOy, - const ModelHighAPI_Double& theOz, - const ModelHighAPI_Double& theHalfLengthX, - const ModelHighAPI_Double& theHalfLengthY, - const ModelHighAPI_Double& theHalfLengthZ) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Box::ID()); - return BoxPtr(new PrimitivesAPI_Box(aFeature, theOx, theOy, theOz, theHalfLengthX, - theHalfLengthY, theHalfLengthZ)); +BoxPtr addBox(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theOx, + const ModelHighAPI_Double &theOy, + const ModelHighAPI_Double &theOz, + const ModelHighAPI_Double &theHalfLengthX, + const ModelHighAPI_Double &theHalfLengthY, + const ModelHighAPI_Double &theHalfLengthZ) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Box::ID()); + return BoxPtr(new PrimitivesAPI_Box(aFeature, theOx, theOy, theOz, + theHalfLengthX, theHalfLengthY, + theHalfLengthZ)); } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.h b/src/PrimitivesAPI/PrimitivesAPI_Box.h index 23160847e..f9751908f 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Box.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESAPI_BOX_H_ @@ -33,92 +34,89 @@ class ModelHighAPI_Selection; /// \class PrimitivesAPI_Box /// \ingroup CPPHighAPI /// \brief Interface for primitive Box feature. -class PrimitivesAPI_Box: public ModelHighAPI_Interface -{ +class PrimitivesAPI_Box : public ModelHighAPI_Interface { public: /// Constructor without values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature); + explicit PrimitivesAPI_Box( + const std::shared_ptr &theFeature); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz); + explicit PrimitivesAPI_Box( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theDx, const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint); + explicit PrimitivesAPI_Box( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theOx, - const ModelHighAPI_Double& theOy, - const ModelHighAPI_Double& theOz, - const ModelHighAPI_Double& theHalfX, - const ModelHighAPI_Double& theHalfY, - const ModelHighAPI_Double& theHalfZ); + explicit PrimitivesAPI_Box( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theOx, const ModelHighAPI_Double &theOy, + const ModelHighAPI_Double &theOz, const ModelHighAPI_Double &theHalfX, + const ModelHighAPI_Double &theHalfY, const ModelHighAPI_Double &theHalfZ); /// Destructor. PRIMITIVESAPI_EXPORT virtual ~PrimitivesAPI_Box(); - INTERFACE_12(PrimitivesPlugin_Box::ID(), - creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - dx, PrimitivesPlugin_Box::DX_ID(), - ModelAPI_AttributeDouble, /** Dimension in X */, - dy, PrimitivesPlugin_Box::DY_ID(), - ModelAPI_AttributeDouble, /** Dimension in Y */, - dz, PrimitivesPlugin_Box::DZ_ID(), - ModelAPI_AttributeDouble, /** Dimension in Z */, - firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(), - ModelAPI_AttributeSelection, /** First point */, - secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(), - ModelAPI_AttributeSelection, /** Second point */, - ox, PrimitivesPlugin_Box::OX_ID(), - ModelAPI_AttributeDouble, /** X coordinate for origin*/, - oy, PrimitivesPlugin_Box::OY_ID(), - ModelAPI_AttributeDouble, /** Y coordinate for origin*/, - oz, PrimitivesPlugin_Box::OZ_ID(), - ModelAPI_AttributeDouble, /** Z coordinate for origin*/, - halfdx, PrimitivesPlugin_Box::HALF_DX_ID(), - ModelAPI_AttributeDouble, /** Half length in X*/, - halfdy, PrimitivesPlugin_Box::HALF_DY_ID(), - ModelAPI_AttributeDouble, /** Half length in Y*/, - halfdz, PrimitivesPlugin_Box::HALF_DZ_ID(), - ModelAPI_AttributeDouble, /** Half length in Z*/) + INTERFACE_12(PrimitivesPlugin_Box::ID(), creationMethod, + PrimitivesPlugin_Box::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, dx, + PrimitivesPlugin_Box::DX_ID(), ModelAPI_AttributeDouble, + /** Dimension in X */, dy, PrimitivesPlugin_Box::DY_ID(), + ModelAPI_AttributeDouble, /** Dimension in Y */, dz, + PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble, + /** Dimension in Z */, firstPoint, + PrimitivesPlugin_Box::POINT_FIRST_ID(), + ModelAPI_AttributeSelection, /** First point */, secondPoint, + PrimitivesPlugin_Box::POINT_SECOND_ID(), + ModelAPI_AttributeSelection, /** Second point */, ox, + PrimitivesPlugin_Box::OX_ID(), ModelAPI_AttributeDouble, + /** X coordinate for origin*/, oy, PrimitivesPlugin_Box::OY_ID(), + ModelAPI_AttributeDouble, /** Y coordinate for origin*/, oz, + PrimitivesPlugin_Box::OZ_ID(), ModelAPI_AttributeDouble, + /** Z coordinate for origin*/, halfdx, + PrimitivesPlugin_Box::HALF_DX_ID(), ModelAPI_AttributeDouble, + /** Half length in X*/, halfdy, + PrimitivesPlugin_Box::HALF_DY_ID(), ModelAPI_AttributeDouble, + /** Half length in Y*/, halfdz, + PrimitivesPlugin_Box::HALF_DZ_ID(), ModelAPI_AttributeDouble, + /** Half length in Z*/) /// Set dimensions PRIMITIVESAPI_EXPORT - void setDimensions(const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz); + void setDimensions(const ModelHighAPI_Double &theDx, + const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz); /// Set points PRIMITIVESAPI_EXPORT - void setPoints(const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint); + void setPoints(const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint); /// Set origin point PRIMITIVESAPI_EXPORT - void setOrigin(const ModelHighAPI_Double& theOx, - const ModelHighAPI_Double& theOy, - const ModelHighAPI_Double& theOz); + void setOrigin(const ModelHighAPI_Double &theOx, + const ModelHighAPI_Double &theOy, + const ModelHighAPI_Double &theOz); /// Set half lengths PRIMITIVESAPI_EXPORT - void setHalfLengths(const ModelHighAPI_Double& theHalfLengthX, - const ModelHighAPI_Double& theHalfLengthY, - const ModelHighAPI_Double& theHalfLengthZ); + void setHalfLengths(const ModelHighAPI_Double &theHalfLengthX, + const ModelHighAPI_Double &theHalfLengthY, + const ModelHighAPI_Double &theHalfLengthZ); /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Box object @@ -127,27 +125,27 @@ typedef std::shared_ptr BoxPtr; /// \ingroup CPPHighAPI /// \brief Create primitive Box feature. PRIMITIVESAPI_EXPORT -BoxPtr addBox(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theDx, - const ModelHighAPI_Double& theDy, - const ModelHighAPI_Double& theDz); +BoxPtr addBox(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theDx, + const ModelHighAPI_Double &theDy, + const ModelHighAPI_Double &theDz); /// \ingroup CPPHighAPI /// \brief Create primitive Box feature. PRIMITIVESAPI_EXPORT -BoxPtr addBox(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theFirstPoint, - const ModelHighAPI_Selection& theSecondPoint); +BoxPtr addBox(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theFirstPoint, + const ModelHighAPI_Selection &theSecondPoint); /// \ingroup CPPHighAPI /// \brief Create primitive Box feature. PRIMITIVESAPI_EXPORT -BoxPtr addBox(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theOx, - const ModelHighAPI_Double& theOy, - const ModelHighAPI_Double& theOz, - const ModelHighAPI_Double& theHalfLengthX, - const ModelHighAPI_Double& theHalfLengthY, - const ModelHighAPI_Double& theHalfLengthZ); +BoxPtr addBox(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theOx, + const ModelHighAPI_Double &theOy, + const ModelHighAPI_Double &theOz, + const ModelHighAPI_Double &theHalfLengthX, + const ModelHighAPI_Double &theHalfLengthY, + const ModelHighAPI_Double &theHalfLengthZ); #endif // PRIMITIVESAPI_BOX_H_ diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp b/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp index 24b5c5344..56376e715 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesAPI_Cone.cpp @@ -28,21 +29,21 @@ #include //================================================================================================== -PrimitivesAPI_Cone::PrimitivesAPI_Cone(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Cone::PrimitivesAPI_Cone( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -PrimitivesAPI_Cone::PrimitivesAPI_Cone(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius, - const ModelHighAPI_Double& theHeight) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Cone::PrimitivesAPI_Cone( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius, + const ModelHighAPI_Double &theHeight) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theBasePoint, basePoint()); fillAttribute(theAxis, axis()); @@ -53,31 +54,26 @@ PrimitivesAPI_Cone::PrimitivesAPI_Cone(const std::shared_ptr& } //================================================================================================== -PrimitivesAPI_Cone::~PrimitivesAPI_Cone() -{ -} +PrimitivesAPI_Cone::~PrimitivesAPI_Cone() {} //================================================================================================== -void PrimitivesAPI_Cone::setRadius(const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius) -{ +void PrimitivesAPI_Cone::setRadius(const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius) { fillAttribute(theBaseRadius, baseRadius()); fillAttribute(theTopRadius, topRadius()); execute(); } //================================================================================================== -void PrimitivesAPI_Cone::setHeight(const ModelHighAPI_Double& theHeight) -{ +void PrimitivesAPI_Cone::setHeight(const ModelHighAPI_Double &theHeight) { fillAttribute(theHeight, height()); execute(); } //================================================================================================== -void PrimitivesAPI_Cone::dump(ModelHighAPI_Dumper& theDumper) const -{ +void PrimitivesAPI_Cone::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addCone(" << aDocName; @@ -87,36 +83,40 @@ void PrimitivesAPI_Cone::dump(ModelHighAPI_Dumper& theDumper) const aBase->selection(PrimitivesPlugin_Cone::AXIS_ID()); theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; - AttributeDoublePtr anAttrBaseRadius = aBase->real(PrimitivesPlugin_Cone::BASE_RADIUS_ID()); - AttributeDoublePtr anAttrTopRadius = aBase->real(PrimitivesPlugin_Cone::TOP_RADIUS_ID()); - AttributeDoublePtr anAttrHeight = aBase->real(PrimitivesPlugin_Cone::HEIGHT_ID()); - theDumper << ", " << anAttrBaseRadius << ", " << anAttrTopRadius << ", " << anAttrHeight; + AttributeDoublePtr anAttrBaseRadius = + aBase->real(PrimitivesPlugin_Cone::BASE_RADIUS_ID()); + AttributeDoublePtr anAttrTopRadius = + aBase->real(PrimitivesPlugin_Cone::TOP_RADIUS_ID()); + AttributeDoublePtr anAttrHeight = + aBase->real(PrimitivesPlugin_Cone::HEIGHT_ID()); + theDumper << ", " << anAttrBaseRadius << ", " << anAttrTopRadius << ", " + << anAttrHeight; theDumper << ")" << std::endl; } //================================================================================================== -ConePtr addCone(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius, - const ModelHighAPI_Double& theHeight) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cone::ID()); - return ConePtr(new PrimitivesAPI_Cone(aFeature, theBasePoint, theAxis, theBaseRadius, - theTopRadius, theHeight)); +ConePtr addCone(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius, + const ModelHighAPI_Double &theHeight) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Cone::ID()); + return ConePtr(new PrimitivesAPI_Cone( + aFeature, theBasePoint, theAxis, theBaseRadius, theTopRadius, theHeight)); } //================================================================================================== -ConePtr addCone(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius, - const ModelHighAPI_Double& theHeight) -{ +ConePtr addCone(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius, + const ModelHighAPI_Double &theHeight) { ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin"); ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ"); - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cone::ID()); - return ConePtr(new PrimitivesAPI_Cone(aFeature, aBasePoint, anAxis, theBaseRadius, - theTopRadius, theHeight)); + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Cone::ID()); + return ConePtr(new PrimitivesAPI_Cone( + aFeature, aBasePoint, anAxis, theBaseRadius, theTopRadius, theHeight)); } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cone.h b/src/PrimitivesAPI/PrimitivesAPI_Cone.h index aaf034a66..d8bc447a7 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cone.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Cone.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesAPI_Cone.h @@ -37,50 +38,50 @@ class ModelHighAPI_Selection; /// \class PrimitivesAPI_Cone /// \ingroup CPPHighAPI /// \brief Interface for primitive Cone feature. -class PrimitivesAPI_Cone: public ModelHighAPI_Interface -{ +class PrimitivesAPI_Cone : public ModelHighAPI_Interface { public: /// Constructor without values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Cone(const std::shared_ptr& theFeature); + explicit PrimitivesAPI_Cone( + const std::shared_ptr &theFeature); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Cone(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius, - const ModelHighAPI_Double& theHeight); + explicit PrimitivesAPI_Cone( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius, + const ModelHighAPI_Double &theHeight); /// Destructor. PRIMITIVESAPI_EXPORT virtual ~PrimitivesAPI_Cone(); - INTERFACE_5(PrimitivesPlugin_Cone::ID(), - basePoint, PrimitivesPlugin_Cone::BASE_POINT_ID(), - ModelAPI_AttributeSelection, /** Base point */, - axis, PrimitivesPlugin_Cone::AXIS_ID(), - ModelAPI_AttributeSelection, /** Axis */, - baseRadius, PrimitivesPlugin_Cone::BASE_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Base radius */, - topRadius, PrimitivesPlugin_Cone::TOP_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Top radius */, - height, PrimitivesPlugin_Cone::HEIGHT_ID(), - ModelAPI_AttributeDouble, /** Height */) + INTERFACE_5(PrimitivesPlugin_Cone::ID(), basePoint, + PrimitivesPlugin_Cone::BASE_POINT_ID(), + ModelAPI_AttributeSelection, /** Base point */, axis, + PrimitivesPlugin_Cone::AXIS_ID(), ModelAPI_AttributeSelection, + /** Axis */, baseRadius, PrimitivesPlugin_Cone::BASE_RADIUS_ID(), + ModelAPI_AttributeDouble, /** Base radius */, topRadius, + PrimitivesPlugin_Cone::TOP_RADIUS_ID(), ModelAPI_AttributeDouble, + /** Top radius */, height, PrimitivesPlugin_Cone::HEIGHT_ID(), + ModelAPI_AttributeDouble, + /** Height */) /// Set radius PRIMITIVESAPI_EXPORT - void setRadius(const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius); + void setRadius(const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius); /// Set height PRIMITIVESAPI_EXPORT - void setHeight(const ModelHighAPI_Double& theHeight); + void setHeight(const ModelHighAPI_Double &theHeight); /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Cone object @@ -89,19 +90,19 @@ typedef std::shared_ptr ConePtr; /// \ingroup CPPHighAPI /// \brief Create primitive Cone feature. PRIMITIVESAPI_EXPORT -ConePtr addCone(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius, - const ModelHighAPI_Double& theHeight); +ConePtr addCone(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius, + const ModelHighAPI_Double &theHeight); /// \ingroup CPPHighAPI /// \brief Create primitive Cone feature. PRIMITIVESAPI_EXPORT -ConePtr addCone(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theBaseRadius, - const ModelHighAPI_Double& theTopRadius, - const ModelHighAPI_Double& theHeight); +ConePtr addCone(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theBaseRadius, + const ModelHighAPI_Double &theTopRadius, + const ModelHighAPI_Double &theHeight); #endif // PRIMITIVESAPI_CONE_H_ diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp index ddc919091..796ccfb5d 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PrimitivesAPI_Cylinder.h" @@ -24,22 +25,22 @@ #include //================================================================================================== -PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER(), creationMethod()); + fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER(), + creationMethod()); fillAttribute(theBasePoint, basePoint()); fillAttribute(theAxis, axis()); setSizes(theRadius, theHeight); @@ -47,16 +48,15 @@ PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight, const ModelHighAPI_Double &theAngle) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION(), creationMethod()); + fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION(), + creationMethod()); fillAttribute(theBasePoint, basePoint()); fillAttribute(theAxis, axis()); fillAttribute(theAngle, angle()); @@ -65,42 +65,42 @@ PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptrdocument()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addCylinder(" << aDocName; AttributeSelectionPtr anAttrBasePoint = - aBase->selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); - AttributeSelectionPtr anAttrAxis = aBase->selection(PrimitivesPlugin_Cylinder::AXIS_ID()); + aBase->selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); + AttributeSelectionPtr anAttrAxis = + aBase->selection(PrimitivesPlugin_Cylinder::AXIS_ID()); theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; - AttributeDoublePtr anAttrRadius = aBase->real(PrimitivesPlugin_Cylinder::RADIUS_ID()); - AttributeDoublePtr anAttrHeight = aBase->real(PrimitivesPlugin_Cylinder::HEIGHT_ID()); + AttributeDoublePtr anAttrRadius = + aBase->real(PrimitivesPlugin_Cylinder::RADIUS_ID()); + AttributeDoublePtr anAttrHeight = + aBase->real(PrimitivesPlugin_Cylinder::HEIGHT_ID()); theDumper << ", " << anAttrRadius << ", " << anAttrHeight; std::string aCreationMethod = - aBase->string(PrimitivesPlugin_Cylinder::CREATION_METHOD())->value(); + aBase->string(PrimitivesPlugin_Cylinder::CREATION_METHOD())->value(); - if (aCreationMethod == PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION()) { - AttributeDoublePtr anAttrAngle = aBase->real(PrimitivesPlugin_Cylinder::ANGLE_ID()); + if (aCreationMethod == + PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION()) { + AttributeDoublePtr anAttrAngle = + aBase->real(PrimitivesPlugin_Cylinder::ANGLE_ID()); theDumper << ", " << anAttrAngle; } @@ -108,51 +108,51 @@ void PrimitivesAPI_Cylinder::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis, theRadius, theHeight)); } //================================================================================================== -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); - return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis, - theRadius, theHeight, theAngle)); +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight, + const ModelHighAPI_Double &theAngle) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Cylinder::ID()); + return CylinderPtr(new PrimitivesAPI_Cylinder( + aFeature, theBasePoint, theAxis, theRadius, theHeight, theAngle)); } //================================================================================================== -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) -{ +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight) { ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin"); ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ"); - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis, theRadius, theHeight)); } //================================================================================================== -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) -{ +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight, + const ModelHighAPI_Double &theAngle) { ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin"); ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ"); - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); - return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis, - theRadius, theHeight, theAngle)); + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Cylinder::ID()); + return CylinderPtr(new PrimitivesAPI_Cylinder( + aFeature, aBasePoint, anAxis, theRadius, theHeight, theAngle)); } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h index 41261bf4f..1e434ffb2 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESAPI_CYLINDER_H_ @@ -33,56 +34,57 @@ class ModelHighAPI_Selection; /// \class PrimitivesAPI_Cylinder /// \ingroup CPPHighAPI /// \brief Interface for primitive Cylinder feature. -class PrimitivesAPI_Cylinder: public ModelHighAPI_Interface -{ +class PrimitivesAPI_Cylinder : public ModelHighAPI_Interface { public: /// Constructor without values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature); + explicit PrimitivesAPI_Cylinder( + const std::shared_ptr &theFeature); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight); + explicit PrimitivesAPI_Cylinder( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle); + explicit PrimitivesAPI_Cylinder( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight, + const ModelHighAPI_Double &theAngle); /// Destructor. PRIMITIVESAPI_EXPORT virtual ~PrimitivesAPI_Cylinder(); - INTERFACE_6(PrimitivesPlugin_Cylinder::ID(), - creationMethod, PrimitivesPlugin_Cylinder::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - basePoint, PrimitivesPlugin_Cylinder::BASE_POINT_ID(), - ModelAPI_AttributeSelection, /** Base point */, - axis, PrimitivesPlugin_Cylinder::AXIS_ID(), - ModelAPI_AttributeSelection, /** Axis */, - radius, PrimitivesPlugin_Cylinder::RADIUS_ID(), - ModelAPI_AttributeDouble, /** Radius */, - height, PrimitivesPlugin_Cylinder::HEIGHT_ID(), - ModelAPI_AttributeDouble, /** Height */, - angle, PrimitivesPlugin_Cylinder::ANGLE_ID(), - ModelAPI_AttributeDouble, /** Angle */) + INTERFACE_6(PrimitivesPlugin_Cylinder::ID(), creationMethod, + PrimitivesPlugin_Cylinder::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, basePoint, + PrimitivesPlugin_Cylinder::BASE_POINT_ID(), + ModelAPI_AttributeSelection, /** Base point */, axis, + PrimitivesPlugin_Cylinder::AXIS_ID(), ModelAPI_AttributeSelection, + /** Axis */, radius, PrimitivesPlugin_Cylinder::RADIUS_ID(), + ModelAPI_AttributeDouble, /** Radius */, height, + PrimitivesPlugin_Cylinder::HEIGHT_ID(), ModelAPI_AttributeDouble, + /** Height */, angle, PrimitivesPlugin_Cylinder::ANGLE_ID(), + ModelAPI_AttributeDouble, + /** Angle */) /// Set dimensions PRIMITIVESAPI_EXPORT - void setSizes(const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight); + void setSizes(const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight); /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Cylinder object @@ -91,35 +93,35 @@ typedef std::shared_ptr CylinderPtr; /// \ingroup CPPHighAPI /// \brief Create primitive Cylinder feature. PRIMITIVESAPI_EXPORT -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight); +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight); /// \ingroup CPPHighAPI /// \brief Create primitive Cylinder feature. PRIMITIVESAPI_EXPORT -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle); +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight, + const ModelHighAPI_Double &theAngle); /// \ingroup CPPHighAPI /// \brief Create primitive Cylinder feature. PRIMITIVESAPI_EXPORT -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight); +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight); /// \ingroup CPPHighAPI /// \brief Create primitive Cylinder feature. PRIMITIVESAPI_EXPORT -CylinderPtr addCylinder(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle); +CylinderPtr addCylinder(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theHeight, + const ModelHighAPI_Double &theAngle); -#endif // PRIMITIVESAPI_CYLINDER_H_ \ No newline at end of file +#endif // PRIMITIVESAPI_CYLINDER_H_ diff --git a/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp b/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp index 7143444de..e8f968bf6 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesAPI_Sphere.h @@ -28,37 +29,37 @@ #include //================================================================================================== -PrimitivesAPI_Sphere::PrimitivesAPI_Sphere(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Sphere::PrimitivesAPI_Sphere( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -PrimitivesAPI_Sphere::PrimitivesAPI_Sphere(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theRadius) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Sphere::PrimitivesAPI_Sphere( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theRadius) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(PrimitivesPlugin_Sphere::CREATION_METHOD_BY_PT_RADIUS(), creationMethod()); + fillAttribute(PrimitivesPlugin_Sphere::CREATION_METHOD_BY_PT_RADIUS(), + creationMethod()); fillAttribute(theCenterPoint, centerPoint()); setRadius(theRadius); } } //================================================================================================== -PrimitivesAPI_Sphere::PrimitivesAPI_Sphere(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& thePhiMin, - const ModelHighAPI_Double& thePhiMax, - const ModelHighAPI_Double& theThetaMin, - const ModelHighAPI_Double& theThetaMax) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Sphere::PrimitivesAPI_Sphere( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theRMin, const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &thePhiMin, const ModelHighAPI_Double &thePhiMax, + const ModelHighAPI_Double &theThetaMin, + const ModelHighAPI_Double &theThetaMax) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { - fillAttribute(PrimitivesPlugin_Sphere::CREATION_METHOD_BY_DIMENSIONS(), creationMethod()); + fillAttribute(PrimitivesPlugin_Sphere::CREATION_METHOD_BY_DIMENSIONS(), + creationMethod()); fillAttribute(theRMin, rmin()); fillAttribute(theRMax, rmax()); fillAttribute(thePhiMin, phimin()); @@ -70,75 +71,78 @@ PrimitivesAPI_Sphere::PrimitivesAPI_Sphere(const std::shared_ptrdocument()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addSphere(" << aDocName; - std::string aCreationMethod = aBase->string(PrimitivesPlugin_Sphere::CREATION_METHOD())->value(); - - if (aCreationMethod == PrimitivesPlugin_Sphere::CREATION_METHOD_BY_DIMENSIONS()) { - AttributeDoublePtr anAttrRMin = aBase->real(PrimitivesPlugin_Sphere::RMIN_ID()); - AttributeDoublePtr anAttrRMax = aBase->real(PrimitivesPlugin_Sphere::RMAX_ID()); - AttributeDoublePtr anAttrPhiMin = aBase->real(PrimitivesPlugin_Sphere::PHIMIN_ID()); - AttributeDoublePtr anAttrPhiMax = aBase->real(PrimitivesPlugin_Sphere::PHIMAX_ID()); - AttributeDoublePtr anAttrThetaMin = aBase->real(PrimitivesPlugin_Sphere::THETAMIN_ID()); - AttributeDoublePtr anAttrThetaMax = aBase->real(PrimitivesPlugin_Sphere::THETAMAX_ID()); + std::string aCreationMethod = + aBase->string(PrimitivesPlugin_Sphere::CREATION_METHOD())->value(); + + if (aCreationMethod == + PrimitivesPlugin_Sphere::CREATION_METHOD_BY_DIMENSIONS()) { + AttributeDoublePtr anAttrRMin = + aBase->real(PrimitivesPlugin_Sphere::RMIN_ID()); + AttributeDoublePtr anAttrRMax = + aBase->real(PrimitivesPlugin_Sphere::RMAX_ID()); + AttributeDoublePtr anAttrPhiMin = + aBase->real(PrimitivesPlugin_Sphere::PHIMIN_ID()); + AttributeDoublePtr anAttrPhiMax = + aBase->real(PrimitivesPlugin_Sphere::PHIMAX_ID()); + AttributeDoublePtr anAttrThetaMin = + aBase->real(PrimitivesPlugin_Sphere::THETAMIN_ID()); + AttributeDoublePtr anAttrThetaMax = + aBase->real(PrimitivesPlugin_Sphere::THETAMAX_ID()); theDumper << ", " << anAttrRMin << ", " << anAttrRMax; theDumper << ", " << anAttrPhiMin << ", " << anAttrPhiMax; theDumper << ", " << anAttrThetaMin << ", " << anAttrThetaMax; - } else { // CREATION_METHOD_BY_PT_RADIUS by default to support versions with undefined method + } else { // CREATION_METHOD_BY_PT_RADIUS by default to support versions with + // undefined method AttributeSelectionPtr anAttrCenterPoint = aBase->selection(PrimitivesPlugin_Sphere::CENTER_POINT_ID()); - AttributeDoublePtr anAttrRadius = aBase->real(PrimitivesPlugin_Sphere::RADIUS_ID()); + AttributeDoublePtr anAttrRadius = + aBase->real(PrimitivesPlugin_Sphere::RADIUS_ID()); theDumper << ", " << anAttrCenterPoint << ", " << anAttrRadius; } @@ -146,33 +150,35 @@ void PrimitivesAPI_Sphere::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== -SpherePtr addSphere(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theRadius) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Sphere::ID()); - return SpherePtr(new PrimitivesAPI_Sphere(aFeature, theCenterPoint, theRadius)); +SpherePtr addSphere(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theRadius) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Sphere::ID()); + return SpherePtr( + new PrimitivesAPI_Sphere(aFeature, theCenterPoint, theRadius)); } //================================================================================================== -SpherePtr addSphere(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius) -{ +SpherePtr addSphere(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius) { ModelHighAPI_Selection aCenterPoint("VERTEX", L"PartSet/Origin"); - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Sphere::ID()); + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Sphere::ID()); return SpherePtr(new PrimitivesAPI_Sphere(aFeature, aCenterPoint, theRadius)); } //================================================================================================== -SpherePtr addSphere(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& thePhiMin, - const ModelHighAPI_Double& thePhiMax, - const ModelHighAPI_Double& theThetaMin, - const ModelHighAPI_Double& theThetaMax) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Sphere::ID()); - return SpherePtr(new PrimitivesAPI_Sphere(aFeature, theRMin, theRMax, thePhiMin, thePhiMax, - theThetaMin, theThetaMax)); +SpherePtr addSphere(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &thePhiMin, + const ModelHighAPI_Double &thePhiMax, + const ModelHighAPI_Double &theThetaMin, + const ModelHighAPI_Double &theThetaMax) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Sphere::ID()); + return SpherePtr(new PrimitivesAPI_Sphere(aFeature, theRMin, theRMax, + thePhiMin, thePhiMax, theThetaMin, + theThetaMax)); } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Sphere.h b/src/PrimitivesAPI/PrimitivesAPI_Sphere.h index 699121020..5c4d2b137 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Sphere.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Sphere.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesAPI_Sphere.h @@ -37,76 +38,79 @@ class ModelHighAPI_Selection; /// \class PrimitivesAPI_Sphere /// \ingroup CPPHighAPI /// \brief Interface for primitive Sphere feature. -class PrimitivesAPI_Sphere: public ModelHighAPI_Interface -{ +class PrimitivesAPI_Sphere : public ModelHighAPI_Interface { public: /// Constructor without values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Sphere(const std::shared_ptr& theFeature); + explicit PrimitivesAPI_Sphere( + const std::shared_ptr &theFeature); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Sphere(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theRadius); + explicit PrimitivesAPI_Sphere( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theRadius); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Sphere(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& thePhiMin, - const ModelHighAPI_Double& thePhiMax, - const ModelHighAPI_Double& theThetaMin, - const ModelHighAPI_Double& theThetaMax); + explicit PrimitivesAPI_Sphere( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theRMin, const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &thePhiMin, + const ModelHighAPI_Double &thePhiMax, + const ModelHighAPI_Double &theThetaMin, + const ModelHighAPI_Double &theThetaMax); /// Destructor. PRIMITIVESAPI_EXPORT virtual ~PrimitivesAPI_Sphere(); - INTERFACE_9(PrimitivesPlugin_Sphere::ID(), - creationMethod, PrimitivesPlugin_Sphere::CREATION_METHOD(), - ModelAPI_AttributeString, /** Creation method */, - centerPoint, PrimitivesPlugin_Sphere::CENTER_POINT_ID(), - ModelAPI_AttributeSelection, /** Center point */, - radius, PrimitivesPlugin_Sphere::RADIUS_ID(), - ModelAPI_AttributeDouble, /** Radius */, - rmin, PrimitivesPlugin_Sphere::RMIN_ID(), - ModelAPI_AttributeDouble, /** The minimum radius*/, - rmax, PrimitivesPlugin_Sphere::RMAX_ID(), - ModelAPI_AttributeDouble, /** The maximum radius*/, - phimin, PrimitivesPlugin_Sphere::PHIMIN_ID(), - ModelAPI_AttributeDouble, /** The minimum phi*/, - phimax, PrimitivesPlugin_Sphere::PHIMAX_ID(), - ModelAPI_AttributeDouble, /** The maximum phi*/, - thetamin, PrimitivesPlugin_Sphere::THETAMIN_ID(), - ModelAPI_AttributeDouble, /** The minimum theta*/, - thetamax,PrimitivesPlugin_Sphere::THETAMAX_ID(), - ModelAPI_AttributeDouble, /** The maximum theta*/) + INTERFACE_9(PrimitivesPlugin_Sphere::ID(), creationMethod, + PrimitivesPlugin_Sphere::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, centerPoint, + PrimitivesPlugin_Sphere::CENTER_POINT_ID(), + ModelAPI_AttributeSelection, /** Center point */, radius, + PrimitivesPlugin_Sphere::RADIUS_ID(), ModelAPI_AttributeDouble, + /** Radius */, rmin, PrimitivesPlugin_Sphere::RMIN_ID(), + ModelAPI_AttributeDouble, /** The minimum radius*/, rmax, + PrimitivesPlugin_Sphere::RMAX_ID(), ModelAPI_AttributeDouble, + /** The maximum radius*/, phimin, + PrimitivesPlugin_Sphere::PHIMIN_ID(), ModelAPI_AttributeDouble, + /** The minimum phi*/, phimax, + PrimitivesPlugin_Sphere::PHIMAX_ID(), ModelAPI_AttributeDouble, + /** The maximum phi*/, thetamin, + PrimitivesPlugin_Sphere::THETAMIN_ID(), ModelAPI_AttributeDouble, + /** The minimum theta*/, thetamax, + PrimitivesPlugin_Sphere::THETAMAX_ID(), ModelAPI_AttributeDouble, + /** The maximum theta*/) /// Set center point PRIMITIVESAPI_EXPORT - void setCenterPoint(const ModelHighAPI_Selection& theCenterPoint); + void setCenterPoint(const ModelHighAPI_Selection &theCenterPoint); /// Set radius PRIMITIVESAPI_EXPORT - void setRadius(const ModelHighAPI_Double& theRadius); + void setRadius(const ModelHighAPI_Double &theRadius); /// Set minimum and maximum radius PRIMITIVESAPI_EXPORT - void setRadius(const ModelHighAPI_Double& theRMin, const ModelHighAPI_Double& theRMax); + void setRadius(const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax); /// Set minimum and maximum phi PRIMITIVESAPI_EXPORT - void setPhi(const ModelHighAPI_Double& thePhiMin, const ModelHighAPI_Double& thePhiMax); + void setPhi(const ModelHighAPI_Double &thePhiMin, + const ModelHighAPI_Double &thePhiMax); /// Set minimum and maximum theta PRIMITIVESAPI_EXPORT - void setTheta(const ModelHighAPI_Double& theThetaMin, const ModelHighAPI_Double& theThetaMax); + void setTheta(const ModelHighAPI_Double &theThetaMin, + const ModelHighAPI_Double &theThetaMax); /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Sphere object @@ -115,25 +119,25 @@ typedef std::shared_ptr SpherePtr; /// \ingroup CPPHighAPI /// \brief Create primitive Sphere feature. PRIMITIVESAPI_EXPORT -SpherePtr addSphere(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theCenterPoint, - const ModelHighAPI_Double& theRadius); +SpherePtr addSphere(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theCenterPoint, + const ModelHighAPI_Double &theRadius); /// \ingroup CPPHighAPI /// \brief Create primitive Sphere feature. PRIMITIVESAPI_EXPORT -SpherePtr addSphere(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius); +SpherePtr addSphere(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius); /// \ingroup CPPHighAPI /// \brief Create primitive Sphere feature. PRIMITIVESAPI_EXPORT -SpherePtr addSphere(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& thePhiMin, - const ModelHighAPI_Double& thePhiMax, - const ModelHighAPI_Double& theThetaMin, - const ModelHighAPI_Double& theThetaMax); +SpherePtr addSphere(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &thePhiMin, + const ModelHighAPI_Double &thePhiMax, + const ModelHighAPI_Double &theThetaMin, + const ModelHighAPI_Double &theThetaMax); #endif // PRIMITIVESAPI_SPHERE_H_ diff --git a/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp b/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp index 49267d6a0..e0041a6bd 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesAPI_Torus.cpp @@ -28,20 +29,19 @@ #include //================================================================================================== -PrimitivesAPI_Torus::PrimitivesAPI_Torus(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Torus::PrimitivesAPI_Torus( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -PrimitivesAPI_Torus::PrimitivesAPI_Torus(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Torus::PrimitivesAPI_Torus( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theBasePoint, basePoint()); fillAttribute(theAxis, axis()); @@ -50,24 +50,20 @@ PrimitivesAPI_Torus::PrimitivesAPI_Torus(const std::shared_ptr } //================================================================================================== -PrimitivesAPI_Torus::~PrimitivesAPI_Torus() -{ -} +PrimitivesAPI_Torus::~PrimitivesAPI_Torus() {} //================================================================================================== -void PrimitivesAPI_Torus::setRadius(const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius) -{ +void PrimitivesAPI_Torus::setRadius(const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius) { fillAttribute(theRadius, radius()); fillAttribute(theRingRadius, ringRadius()); execute(); } //================================================================================================== -void PrimitivesAPI_Torus::dump(ModelHighAPI_Dumper& theDumper) const -{ +void PrimitivesAPI_Torus::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addTorus(" << aDocName; @@ -77,32 +73,35 @@ void PrimitivesAPI_Torus::dump(ModelHighAPI_Dumper& theDumper) const aBase->selection(PrimitivesPlugin_Torus::AXIS_ID()); theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; - AttributeDoublePtr anAttrRadius = aBase->real(PrimitivesPlugin_Torus::RADIUS_ID()); - AttributeDoublePtr anAttrRingRadius = aBase->real(PrimitivesPlugin_Torus::RING_RADIUS_ID()); + AttributeDoublePtr anAttrRadius = + aBase->real(PrimitivesPlugin_Torus::RADIUS_ID()); + AttributeDoublePtr anAttrRingRadius = + aBase->real(PrimitivesPlugin_Torus::RING_RADIUS_ID()); theDumper << ", " << anAttrRadius << ", " << anAttrRingRadius; theDumper << ")" << std::endl; } //================================================================================================== -TorusPtr addTorus(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Torus::ID()); +TorusPtr addTorus(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Torus::ID()); return TorusPtr(new PrimitivesAPI_Torus(aFeature, theBasePoint, theAxis, theRadius, theRingRadius)); } //================================================================================================== -TorusPtr addTorus(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius) -{ +TorusPtr addTorus(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius) { ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin"); ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ"); - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Torus::ID()); - return TorusPtr(new PrimitivesAPI_Torus(aFeature, aBasePoint, anAxis, theRadius, theRingRadius)); + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Torus::ID()); + return TorusPtr(new PrimitivesAPI_Torus(aFeature, aBasePoint, anAxis, + theRadius, theRingRadius)); } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Torus.h b/src/PrimitivesAPI/PrimitivesAPI_Torus.h index d947b44e8..a7c93667c 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Torus.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Torus.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesAPI_Torus.h @@ -37,43 +38,44 @@ class ModelHighAPI_Selection; /// \class PrimitivesAPI_Torus /// \ingroup CPPHighAPI /// \brief Interface for primitive Torus feature. -class PrimitivesAPI_Torus: public ModelHighAPI_Interface -{ +class PrimitivesAPI_Torus : public ModelHighAPI_Interface { public: /// Constructor without values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Torus(const std::shared_ptr& theFeature); + explicit PrimitivesAPI_Torus( + const std::shared_ptr &theFeature); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Torus(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius); + explicit PrimitivesAPI_Torus( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius); /// Destructor. PRIMITIVESAPI_EXPORT virtual ~PrimitivesAPI_Torus(); - INTERFACE_4(PrimitivesPlugin_Torus::ID(), - basePoint, PrimitivesPlugin_Torus::BASE_POINT_ID(), - ModelAPI_AttributeSelection, /** Base point */, - axis, PrimitivesPlugin_Torus::AXIS_ID(), - ModelAPI_AttributeSelection, /** Axis */, - radius, PrimitivesPlugin_Torus::RADIUS_ID(), - ModelAPI_AttributeDouble, /** Radius */, - ringRadius, PrimitivesPlugin_Torus::RING_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Ring radius */) + INTERFACE_4(PrimitivesPlugin_Torus::ID(), basePoint, + PrimitivesPlugin_Torus::BASE_POINT_ID(), + ModelAPI_AttributeSelection, /** Base point */, axis, + PrimitivesPlugin_Torus::AXIS_ID(), ModelAPI_AttributeSelection, + /** Axis */, radius, PrimitivesPlugin_Torus::RADIUS_ID(), + ModelAPI_AttributeDouble, /** Radius */, ringRadius, + PrimitivesPlugin_Torus::RING_RADIUS_ID(), + ModelAPI_AttributeDouble, + /** Ring radius */) /// Set radius PRIMITIVESAPI_EXPORT - void setRadius(const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius); + void setRadius(const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius); /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Torus object @@ -82,17 +84,17 @@ typedef std::shared_ptr TorusPtr; /// \ingroup CPPHighAPI /// \brief Create primitive Torus feature. PRIMITIVESAPI_EXPORT -TorusPtr addTorus(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius); +TorusPtr addTorus(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theBasePoint, + const ModelHighAPI_Selection &theAxis, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius); /// \ingroup CPPHighAPI /// \brief Create primitive Torus feature. PRIMITIVESAPI_EXPORT -TorusPtr addTorus(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theRingRadius); +TorusPtr addTorus(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRadius, + const ModelHighAPI_Double &theRingRadius); #endif // PRIMITIVESAPI_TORUS_H_ diff --git a/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp b/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp index 820f35ebe..4404b89ee 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "PrimitivesAPI_Tube.h" @@ -23,19 +24,18 @@ #include //================================================================================================== -PrimitivesAPI_Tube::PrimitivesAPI_Tube(const std::shared_ptr& theFeature) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Tube::PrimitivesAPI_Tube( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -PrimitivesAPI_Tube::PrimitivesAPI_Tube(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& theHeight) -: ModelHighAPI_Interface(theFeature) -{ +PrimitivesAPI_Tube::PrimitivesAPI_Tube( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theRMin, const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &theHeight) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theRMin, rmin()); fillAttribute(theRMax, rmax()); @@ -44,48 +44,44 @@ PrimitivesAPI_Tube::PrimitivesAPI_Tube(const std::shared_ptr& } //================================================================================================== -PrimitivesAPI_Tube::~PrimitivesAPI_Tube() -{ -} +PrimitivesAPI_Tube::~PrimitivesAPI_Tube() {} //================================================================================================== -void PrimitivesAPI_Tube::setRadius(const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax) -{ +void PrimitivesAPI_Tube::setRadius(const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax) { fillAttribute(theRMin, rmin()); fillAttribute(theRMax, rmax()); execute(); } //================================================================================================== -void PrimitivesAPI_Tube::setHeight(const ModelHighAPI_Double& theHeight) -{ +void PrimitivesAPI_Tube::setHeight(const ModelHighAPI_Double &theHeight) { fillAttribute(theHeight, height()); execute(); } //================================================================================================== -void PrimitivesAPI_Tube::dump(ModelHighAPI_Dumper& theDumper) const -{ +void PrimitivesAPI_Tube::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); theDumper << aBase << " = model.addTube(" << aDocName; AttributeDoublePtr anAttrRMin = aBase->real(PrimitivesPlugin_Tube::RMIN_ID()); AttributeDoublePtr anAttrRMax = aBase->real(PrimitivesPlugin_Tube::RMAX_ID()); - AttributeDoublePtr anAttrHeight = aBase->real(PrimitivesPlugin_Tube::HEIGHT_ID()); + AttributeDoublePtr anAttrHeight = + aBase->real(PrimitivesPlugin_Tube::HEIGHT_ID()); theDumper << ", " << anAttrRMin << ", " << anAttrRMax << ", " << anAttrHeight; theDumper << ")" << std::endl; } //================================================================================================== -TubePtr addTube(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& theHeight) -{ - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Tube::ID()); +TubePtr addTube(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &theHeight) { + std::shared_ptr aFeature = + thePart->addFeature(PrimitivesAPI_Tube::ID()); return TubePtr(new PrimitivesAPI_Tube(aFeature, theRMin, theRMax, theHeight)); } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Tube.h b/src/PrimitivesAPI/PrimitivesAPI_Tube.h index 8f5ca9e99..eb161f93f 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Tube.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Tube.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESAPI_TUBE_H_ @@ -28,48 +29,46 @@ #include #include - /// \class PrimitivesAPI_Tube /// \ingroup CPPHighAPI /// \brief Interface for primitive Tube feature. -class PrimitivesAPI_Tube: public ModelHighAPI_Interface -{ +class PrimitivesAPI_Tube : public ModelHighAPI_Interface { public: /// Constructor without values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Tube(const std::shared_ptr& theFeature); + explicit PrimitivesAPI_Tube( + const std::shared_ptr &theFeature); /// Constructor with values. PRIMITIVESAPI_EXPORT - explicit PrimitivesAPI_Tube(const std::shared_ptr& theFeature, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& theHeight); + explicit PrimitivesAPI_Tube( + const std::shared_ptr &theFeature, + const ModelHighAPI_Double &theRMin, const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &theHeight); /// Destructor. PRIMITIVESAPI_EXPORT virtual ~PrimitivesAPI_Tube(); - INTERFACE_3(PrimitivesPlugin_Tube::ID(), - rmin, PrimitivesPlugin_Tube::RMIN_ID(), - ModelAPI_AttributeDouble, /** Inner radius */, - rmax, PrimitivesPlugin_Tube::RMAX_ID(), - ModelAPI_AttributeDouble, /** Outer radius */, - height, PrimitivesPlugin_Tube::HEIGHT_ID(), - ModelAPI_AttributeDouble, /** Height */) + INTERFACE_3(PrimitivesPlugin_Tube::ID(), rmin, + PrimitivesPlugin_Tube::RMIN_ID(), ModelAPI_AttributeDouble, + /** Inner radius */, rmax, PrimitivesPlugin_Tube::RMAX_ID(), + ModelAPI_AttributeDouble, /** Outer radius */, height, + PrimitivesPlugin_Tube::HEIGHT_ID(), ModelAPI_AttributeDouble, + /** Height */) /// Set radius PRIMITIVESAPI_EXPORT - void setRadius(const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax); + void setRadius(const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax); /// Set height PRIMITIVESAPI_EXPORT - void setHeight(const ModelHighAPI_Double& theHeight); + void setHeight(const ModelHighAPI_Double &theHeight); /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on primitive Tube object @@ -78,9 +77,9 @@ typedef std::shared_ptr TubePtr; /// \ingroup CPPHighAPI /// \brief Create primitive Tube feature. PRIMITIVESAPI_EXPORT -TubePtr addTube(const std::shared_ptr& thePart, - const ModelHighAPI_Double& theRMin, - const ModelHighAPI_Double& theRMax, - const ModelHighAPI_Double& theHeight); +TubePtr addTube(const std::shared_ptr &thePart, + const ModelHighAPI_Double &theRMin, + const ModelHighAPI_Double &theRMax, + const ModelHighAPI_Double &theHeight); #endif // PRIMITIVESAPI_TUBE_H_ diff --git a/src/PrimitivesAPI/PrimitivesAPI_swig.h b/src/PrimitivesAPI/PrimitivesAPI_swig.h index fa87d72fb..737c80fbc 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_swig.h +++ b/src/PrimitivesAPI/PrimitivesAPI_swig.h @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESAPI_SWIG_H_ #define PRIMITIVESAPI_SWIG_H_ - #include +#include - #include "PrimitivesAPI.h" - #include "PrimitivesAPI_Box.h" - #include "PrimitivesAPI_Cone.h" - #include "PrimitivesAPI_Cylinder.h" - #include "PrimitivesAPI_Sphere.h" - #include "PrimitivesAPI_Torus.h" - #include "PrimitivesAPI_Tube.h" +#include "PrimitivesAPI.h" +#include "PrimitivesAPI_Box.h" +#include "PrimitivesAPI_Cone.h" +#include "PrimitivesAPI_Cylinder.h" +#include "PrimitivesAPI_Sphere.h" +#include "PrimitivesAPI_Torus.h" +#include "PrimitivesAPI_Tube.h" #endif // PRIMITIVESAPI_SWIG_H_ diff --git a/src/PrimitivesPlugin/CMakeLists.txt b/src/PrimitivesPlugin/CMakeLists.txt index aadcdc40c..0c1dc5b0d 100644 --- a/src/PrimitivesPlugin/CMakeLists.txt +++ b/src/PrimitivesPlugin/CMakeLists.txt @@ -76,5 +76,3 @@ TARGET_LINK_LIBRARIES(PrimitivesPlugin ${PROJECT_LIBRARIES}) INSTALL(TARGETS PrimitivesPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES}) INSTALL(FILES ${XML_RESOURCES} ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}) INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Primitives) - - diff --git a/src/PrimitivesPlugin/PrimitivesPlugin.h b/src/PrimitivesPlugin/PrimitivesPlugin.h index 586c353d1..70101b2e8 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESPLUGIN_H @@ -22,13 +23,13 @@ #if defined PRIMITIVESPLUGIN_EXPORTS #if defined WIN32 -#define PRIMITIVESPLUGIN_EXPORT __declspec( dllexport ) +#define PRIMITIVESPLUGIN_EXPORT __declspec(dllexport) #else #define PRIMITIVESPLUGIN_EXPORT #endif #else #if defined WIN32 -#define PRIMITIVESPLUGIN_EXPORT __declspec( dllimport ) +#define PRIMITIVESPLUGIN_EXPORT __declspec(dllimport) #else #define PRIMITIVESPLUGIN_EXPORT #endif diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp index 31c50a4a3..deca244a7 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp @@ -14,36 +14,40 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include #include #include #include +#include +#include #include -#include #include +#include //================================================================================================= -PrimitivesPlugin_Box::PrimitivesPlugin_Box() // Nothing to do during instantiation -{ -} +PrimitivesPlugin_Box::PrimitivesPlugin_Box() // Nothing to do during + // instantiation +{} //================================================================================================= -void PrimitivesPlugin_Box::initAttributes() -{ - data()->addAttribute(PrimitivesPlugin_Box::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); +void PrimitivesPlugin_Box::initAttributes() { + data()->addAttribute(PrimitivesPlugin_Box::CREATION_METHOD(), + ModelAPI_AttributeString::typeId()); // Data for the first mode - data()->addAttribute(PrimitivesPlugin_Box::DX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::DX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::DY_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::DZ_ID(), + ModelAPI_AttributeDouble::typeId()); // Data for the second mode data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(), @@ -52,18 +56,24 @@ void PrimitivesPlugin_Box::initAttributes() ModelAPI_AttributeSelection::typeId()); // Data for the third mode - data()->addAttribute(PrimitivesPlugin_Box::OX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::OY_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::OZ_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::HALF_DX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::HALF_DY_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::HALF_DZ_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::OX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::OY_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::OZ_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::HALF_DX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::HALF_DY_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::HALF_DZ_ID(), + ModelAPI_AttributeDouble::typeId()); } //================================================================================================= -void PrimitivesPlugin_Box::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(PrimitivesPlugin_Box::CREATION_METHOD()); +void PrimitivesPlugin_Box::execute() { + AttributeStringPtr aMethodTypeAttr = + string(PrimitivesPlugin_Box::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); if (aMethodType == CREATION_METHOD_BY_DIMENSIONS()) @@ -77,13 +87,12 @@ void PrimitivesPlugin_Box::execute() } //================================================================================================= -void PrimitivesPlugin_Box::createBoxByDimensions() -{ +void PrimitivesPlugin_Box::createBoxByDimensions() { double aDx = real(PrimitivesPlugin_Box::DX_ID())->value(); double aDy = real(PrimitivesPlugin_Box::DY_ID())->value(); double aDz = real(PrimitivesPlugin_Box::DZ_ID())->value(); - std::shared_ptr aBoxAlgo(new GeomAlgoAPI_Box(aDx,aDy,aDz)); + std::shared_ptr aBoxAlgo(new GeomAlgoAPI_Box(aDx, aDy, aDz)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -96,11 +105,11 @@ void PrimitivesPlugin_Box::createBoxByDimensions() aBoxAlgo->build(); // Check if the creation of the box - if(!aBoxAlgo->isDone()) { + if (!aBoxAlgo->isDone()) { setError(aBoxAlgo->getError()); return; } - if(!aBoxAlgo->checkValid("Box builder with dimensions")) { + if (!aBoxAlgo->checkValid("Box builder with dimensions")) { setError(aBoxAlgo->getError()); return; } @@ -112,24 +121,29 @@ void PrimitivesPlugin_Box::createBoxByDimensions() } //================================================================================================= -void PrimitivesPlugin_Box::createBoxByTwoPoints() -{ - AttributeSelectionPtr aRef1 = data()->selection(PrimitivesPlugin_Box::POINT_FIRST_ID()); - AttributeSelectionPtr aRef2 = data()->selection(PrimitivesPlugin_Box::POINT_SECOND_ID()); +void PrimitivesPlugin_Box::createBoxByTwoPoints() { + AttributeSelectionPtr aRef1 = + data()->selection(PrimitivesPlugin_Box::POINT_FIRST_ID()); + AttributeSelectionPtr aRef2 = + data()->selection(PrimitivesPlugin_Box::POINT_SECOND_ID()); std::shared_ptr aBoxAlgo; if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { GeomShapePtr aShape1 = aRef1->value(); - if (!aShape1.get()) //If we can't get the points directly, try getting them from the context + if (!aShape1.get()) // If we can't get the points directly, try getting them + // from the context aShape1 = aRef1->context()->shape(); GeomShapePtr aShape2 = aRef2->value(); if (!aShape2.get()) aShape2 = aRef2->context()->shape(); - if (aShape1 && aShape2){ - std::shared_ptr aFirstPoint = GeomAlgoAPI_PointBuilder::point(aShape1); - std::shared_ptr aSecondPoint = GeomAlgoAPI_PointBuilder::point(aShape2); - aBoxAlgo = std::shared_ptr(new GeomAlgoAPI_Box(aFirstPoint,aSecondPoint)); + if (aShape1 && aShape2) { + std::shared_ptr aFirstPoint = + GeomAlgoAPI_PointBuilder::point(aShape1); + std::shared_ptr aSecondPoint = + GeomAlgoAPI_PointBuilder::point(aShape2); + aBoxAlgo = std::shared_ptr( + new GeomAlgoAPI_Box(aFirstPoint, aSecondPoint)); } } @@ -144,13 +158,15 @@ void PrimitivesPlugin_Box::createBoxByTwoPoints() aBoxAlgo->build(); // Check if the creation of the box - if(!aBoxAlgo->isDone()) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aBoxAlgo->isDone()) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aBoxAlgo->getError()); return; } - if(!aBoxAlgo->checkValid("Box builder with two points")) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aBoxAlgo->checkValid("Box builder with two points")) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aBoxAlgo->getError()); return; } @@ -162,8 +178,7 @@ void PrimitivesPlugin_Box::createBoxByTwoPoints() } //================================================================================================= -void PrimitivesPlugin_Box::createBoxByOnePointAndDims() -{ +void PrimitivesPlugin_Box::createBoxByOnePointAndDims() { // Getting dx, dy and dz double aDx = real(PrimitivesPlugin_Box::HALF_DX_ID())->value(); double aDy = real(PrimitivesPlugin_Box::HALF_DY_ID())->value(); @@ -175,7 +190,8 @@ void PrimitivesPlugin_Box::createBoxByOnePointAndDims() double z = real(PrimitivesPlugin_Box::OZ_ID())->value(); std::shared_ptr aBoxAlgo; - aBoxAlgo = std::shared_ptr(new GeomAlgoAPI_Box(x,y,z,aDx,aDy,aDz)); + aBoxAlgo = std::shared_ptr( + new GeomAlgoAPI_Box(x, y, z, aDx, aDy, aDz)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -188,13 +204,15 @@ void PrimitivesPlugin_Box::createBoxByOnePointAndDims() aBoxAlgo->build(); // Check if the creation of the box - if(!aBoxAlgo->isDone()) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aBoxAlgo->isDone()) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aBoxAlgo->getError()); return; } - if(!aBoxAlgo->checkValid("Box builder with one point and dimensions")) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aBoxAlgo->checkValid("Box builder with one point and dimensions")) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aBoxAlgo->getError()); return; } @@ -206,9 +224,9 @@ void PrimitivesPlugin_Box::createBoxByOnePointAndDims() } //================================================================================================= -void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr theBoxAlgo, - std::shared_ptr theResultBox) -{ +void PrimitivesPlugin_Box::loadNamingDS( + std::shared_ptr theBoxAlgo, + std::shared_ptr theResultBox) { // Load the result theResultBox->store(theBoxAlgo->shape()); @@ -216,13 +234,11 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr theBoxA theBoxAlgo->prepareNamingFaces(); // Insert to faces - std::map< std::string, std::shared_ptr > listOfFaces = - theBoxAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) - { + std::map> listOfFaces = + theBoxAlgo->getCreatedFaces(); + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultBox->generated((*it).second, (*it).first); } } - diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.h b/src/PrimitivesPlugin/PrimitivesPlugin_Box.h index 1ca4620e9..a6cc1ffde 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PrimitivesPlugin_Box_H_ #define PrimitivesPlugin_Box_H_ -#include -#include #include +#include +#include class GeomAPI_Shape; class ModelAPI_ResultBody; @@ -31,129 +32,111 @@ class ModelAPI_ResultBody; * \ingroup Plugins * \brief Feature for creation of a box primitive using various methods. * - * Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via three - * methods : using two points that define a diagonal, a point that define a center and 3 lengths - * that define the half-lengths on X, Y and Z-axes, or using 3 lengths that define the - * rectangular dimensions. + * Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be + * built via three methods : using two points that define a diagonal, a point + * that define a center and 3 lengths that define the half-lengths on X, Y and + * Z-axes, or using 3 lengths that define the rectangular dimensions. */ -class PrimitivesPlugin_Box : public ModelAPI_Feature -{ - public: +class PrimitivesPlugin_Box : public ModelAPI_Feature { +public: /// Box kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_BOX_ID("Box"); return MY_BOX_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() - { + inline static const std::string &CREATION_METHOD_BY_DIMENSIONS() { static const std::string MY_CREATION_METHOD_ID("BoxByDimensions"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_BY_TWO_POINTS() - { + inline static const std::string &CREATION_METHOD_BY_TWO_POINTS() { static const std::string MY_CREATION_METHOD_ID("BoxByTwoPoints"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_BY_ONE_POINT_AND_DIMS() - { + inline static const std::string &CREATION_METHOD_BY_ONE_POINT_AND_DIMS() { static const std::string MY_CREATION_METHOD_ID("BoxByOnePointAndDims"); return MY_CREATION_METHOD_ID; } /// Attribute name of first point - inline static const std::string& POINT_FIRST_ID() - { + inline static const std::string &POINT_FIRST_ID() { static const std::string MY_POINT_FIRST_ID("FirstPoint"); return MY_POINT_FIRST_ID; } /// Attribute name of second point - inline static const std::string& POINT_SECOND_ID() - { + inline static const std::string &POINT_SECOND_ID() { static const std::string MY_POINT_SECOND_ID("SecondPoint"); return MY_POINT_SECOND_ID; } /// Attribute first coordinate - inline static const std::string& DX_ID() - { + inline static const std::string &DX_ID() { static const std::string MY_DX_ID("dx"); return MY_DX_ID; } /// Attribute second coordinate - inline static const std::string& DY_ID() - { + inline static const std::string &DY_ID() { static const std::string MY_DY_ID("dy"); return MY_DY_ID; } /// Attribute third coordinate - inline static const std::string& DZ_ID() - { + inline static const std::string &DZ_ID() { static const std::string MY_DZ_ID("dz"); return MY_DZ_ID; } /// Attribute name of the first coordinate of the center - inline static const std::string& OX_ID() - { + inline static const std::string &OX_ID() { static const std::string MY_OX_ID("ox"); return MY_OX_ID; } /// Attribute name of the second coordinate of the center - inline static const std::string& OY_ID() - { + inline static const std::string &OY_ID() { static const std::string MY_OY_ID("oy"); return MY_OY_ID; } /// Attribute name of the third coordinate of the center - inline static const std::string& OZ_ID() - { + inline static const std::string &OZ_ID() { static const std::string MY_OZ_ID("oz"); return MY_OZ_ID; } /// Attribute name of the half-length on X axis - inline static const std::string& HALF_DX_ID() - { + inline static const std::string &HALF_DX_ID() { static const std::string MY_HALF_DX_ID("half_dx"); return MY_HALF_DX_ID; } /// Attribute name of the half-length on Y axis - inline static const std::string& HALF_DY_ID() - { + inline static const std::string &HALF_DY_ID() { static const std::string MY_HALF_DY_ID("half_dy"); return MY_HALF_DY_ID; } /// Attribute name of the half-length on Z axis - inline static const std::string& HALF_DZ_ID() - { + inline static const std::string &HALF_DZ_ID() { static const std::string MY_HALF_DZ_ID("half_dz"); return MY_HALF_DZ_ID; } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind() - { + PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PrimitivesPlugin_Box::ID(); return MY_KIND; } @@ -161,27 +144,26 @@ class PrimitivesPlugin_Box : public ModelAPI_Feature /// Creates a new part document if needed PRIMITIVESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation PrimitivesPlugin_Box(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theBoxAlgo, std::shared_ptr theResultBox); - ///Perform the creation of the box using two points defining a diagonal + /// Perform the creation of the box using two points defining a diagonal void createBoxByTwoPoints(); - ///Perform the creation of the box using three cordinates + /// Perform the creation of the box using three cordinates void createBoxByDimensions(); - ///Perform the creation of the box using a center and three half-lenths + /// Perform the creation of the box using a center and three half-lenths void createBoxByOnePointAndDims(); - }; - #endif diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp index 12c74f185..5353a2fdc 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesPlugin_Cone.cpp @@ -39,13 +40,10 @@ #include //================================================================================================= -PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() -{ -} +PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() {} //================================================================================================= -void PrimitivesPlugin_Cone::initAttributes() -{ +void PrimitivesPlugin_Cone::initAttributes() { data()->addAttribute(PrimitivesPlugin_Cone::BASE_POINT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(PrimitivesPlugin_Cone::AXIS_ID(), @@ -58,49 +56,55 @@ void PrimitivesPlugin_Cone::initAttributes() data()->addAttribute(PrimitivesPlugin_Cone::HEIGHT_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the base point of the cone at the origin if the base point is not filled. + // Initialize the base point of the cone at the origin if the base point is + // not filled. AttributeSelectionPtr aCenterPoint = - data()->selection(PrimitivesPlugin_Cone::BASE_POINT_ID()); + data()->selection(PrimitivesPlugin_Cone::BASE_POINT_ID()); if (!aCenterPoint->isInitialized()) { - ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin"); + ObjectPtr aPointObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"Origin"); if (aPointObj.get()) { - ResultPtr aPointRes = std::dynamic_pointer_cast(aPointObj); + ResultPtr aPointRes = + std::dynamic_pointer_cast(aPointObj); aCenterPoint->setValue(aPointRes, std::shared_ptr()); } } // Initialize the axis at the OZ axis if the axis is not filled. - AttributeSelectionPtr anAxis = data()->selection(PrimitivesPlugin_Cone::AXIS_ID()); + AttributeSelectionPtr anAxis = + data()->selection(PrimitivesPlugin_Cone::AXIS_ID()); if (!anAxis->isInitialized()) { - ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"OZ"); + ObjectPtr anAxisObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"OZ"); if (anAxisObj.get()) { - ResultPtr anAxisRes = std::dynamic_pointer_cast(anAxisObj); + ResultPtr anAxisRes = + std::dynamic_pointer_cast(anAxisObj); anAxis->setValue(anAxisRes, std::shared_ptr()); } } } //================================================================================================= -void PrimitivesPlugin_Cone::execute() -{ +void PrimitivesPlugin_Cone::execute() { // Getting base point. std::shared_ptr aBasePoint; std::shared_ptr aPointRef = - selection(PrimitivesPlugin_Cone::BASE_POINT_ID()); + selection(PrimitivesPlugin_Cone::BASE_POINT_ID()); if (aPointRef.get() != NULL) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); } if (aShape1) { - aBasePoint = GeomAlgoAPI_PointBuilder::point(aShape1); + aBasePoint = GeomAlgoAPI_PointBuilder::point(aShape1); } } // Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; std::shared_ptr anEdgeRef = selection(AXIS_ID()); GeomShapePtr aShape = anEdgeRef->value(); if (!aShape.get()) { @@ -113,29 +117,23 @@ void PrimitivesPlugin_Cone::execute() return; } std::shared_ptr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); - } - else - { + } else { setError(aSelectionError); return; } - if (!anEdge.get()) - { + if (!anEdge.get()) { setError(aSelectionError); return; } - std::shared_ptr anAxis(new GeomAPI_Ax2(aBasePoint, - anEdge->line()->direction())); + std::shared_ptr anAxis( + new GeomAPI_Ax2(aBasePoint, anEdge->line()->direction())); // Getting base radius, top radius and height double aBaseRadius = real(PrimitivesPlugin_Cone::BASE_RADIUS_ID())->value(); @@ -143,10 +141,8 @@ void PrimitivesPlugin_Cone::execute() double aHeight = real(PrimitivesPlugin_Cone::HEIGHT_ID())->value(); std::shared_ptr aConeAlgo = - std::shared_ptr(new GeomAlgoAPI_Cone(anAxis, - aBaseRadius, - aTopRadius, - aHeight)); + std::shared_ptr( + new GeomAlgoAPI_Cone(anAxis, aBaseRadius, aTopRadius, aHeight)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -159,11 +155,11 @@ void PrimitivesPlugin_Cone::execute() aConeAlgo->build(); // Check if the creation of the cylinder - if(!aConeAlgo->isDone()) { + if (!aConeAlgo->isDone()) { setError(aConeAlgo->getError()); return; } - if(!aConeAlgo->checkValid("Cone builder")) { + if (!aConeAlgo->checkValid("Cone builder")) { setError(aConeAlgo->getError()); return; } @@ -175,9 +171,9 @@ void PrimitivesPlugin_Cone::execute() } //================================================================================================= -void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr theConeAlgo, - std::shared_ptr theResultCone) -{ +void PrimitivesPlugin_Cone::loadNamingDS( + std::shared_ptr theConeAlgo, + std::shared_ptr theResultCone) { // Load the result theResultCone->store(theConeAlgo->shape()); @@ -185,11 +181,12 @@ void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr theCo theConeAlgo->prepareNamingFaces(); // Insert to faces - std::map< std::string, std::shared_ptr > listOfFaces = + std::map> listOfFaces = theConeAlgo->getCreatedFaces(); int nbFaces = 0; - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultCone->generated((*it).second, (*it).first); nbFaces++; } @@ -198,13 +195,12 @@ void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr theCo // Naming vertices GeomAPI_DataMapOfShapeShape aVertices; int anIndex = 1; - for (GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX); - aVertExp.more(); - aVertExp.next()) - { + for (GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), + GeomAPI_Shape::VERTEX); + aVertExp.more(); aVertExp.next()) { if (!aVertices.isBound(aVertExp.current())) { std::ostringstream aStream; - aStream<<"Vertex_"<generated(aVertExp.current(), aStream.str()); aVertices.bind(aVertExp.current(), aVertExp.current()); } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h index aab2cf026..7d58ced26 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesPlugin_Cone.h @@ -24,64 +25,56 @@ #ifndef PRIMITIVESPLUGIN_CONE_H_ #define PRIMITIVESPLUGIN_CONE_H_ -#include -#include #include +#include +#include /**\class PrimitivesPlugin_Cone * \ingroup Plugins * \brief Feature for creation of a cone. * - * Creates a cone from a + * Creates a cone from a */ -class PrimitivesPlugin_Cone : public ModelAPI_Feature -{ - public: +class PrimitivesPlugin_Cone : public ModelAPI_Feature { +public: /// Cone kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONE_ID("Cone"); return MY_CONE_ID; } /// Attribute name of the base point - inline static const std::string& BASE_POINT_ID() - { + inline static const std::string &BASE_POINT_ID() { static const std::string MY_BASE_POINT_ID("base_point"); return MY_BASE_POINT_ID; } /// Attribute name of the axis - inline static const std::string& AXIS_ID() - { + inline static const std::string &AXIS_ID() { static const std::string MY_AXIS_ID("axis"); return MY_AXIS_ID; } /// Attribute name of the base radius - inline static const std::string& BASE_RADIUS_ID() - { + inline static const std::string &BASE_RADIUS_ID() { static const std::string MY_BASE_RADIUS_ID("base_radius"); return MY_BASE_RADIUS_ID; } /// Attribute name of the radius - inline static const std::string& TOP_RADIUS_ID() - { + inline static const std::string &TOP_RADIUS_ID() { static const std::string MY_TOP_RADIUS_ID("top_radius"); return MY_TOP_RADIUS_ID; } /// Attribute name of the radius - inline static const std::string& HEIGHT_ID() - { + inline static const std::string &HEIGHT_ID() { static const std::string MY_HEIGHT_ID("height"); return MY_HEIGHT_ID; } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind() - { + PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PrimitivesPlugin_Cone::ID(); return MY_KIND; } @@ -89,17 +82,17 @@ class PrimitivesPlugin_Cone : public ModelAPI_Feature /// Creates a new part document if needed PRIMITIVESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation PrimitivesPlugin_Cone(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theConeAlgo, std::shared_ptr theResultCone); - }; #endif // PRIMITIVESPLUGIN_CONE_H_ diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp index 30949df04..0bf607698 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -34,13 +35,10 @@ #include //================================================================================================= -PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder() -{ -} +PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder() {} //================================================================================================= -void PrimitivesPlugin_Cylinder::initAttributes() -{ +void PrimitivesPlugin_Cylinder::initAttributes() { data()->addAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); @@ -56,13 +54,16 @@ void PrimitivesPlugin_Cylinder::initAttributes() data()->addAttribute(PrimitivesPlugin_Cylinder::ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the base point of the cylinder at the origin if the base point is not filled. + // Initialize the base point of the cylinder at the origin if the base point + // is not filled. AttributeSelectionPtr aBasePoint = data()->selection(BASE_POINT_ID()); if (!aBasePoint->isInitialized()) { - ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin"); + ObjectPtr aPointObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"Origin"); if (aPointObj.get()) { - ResultPtr aPointRes = std::dynamic_pointer_cast(aPointObj); + ResultPtr aPointRes = + std::dynamic_pointer_cast(aPointObj); aBasePoint->setValue(aPointRes, std::shared_ptr()); } } @@ -70,19 +71,21 @@ void PrimitivesPlugin_Cylinder::initAttributes() // Initialize the axis at the OZ axis if the axis is not filled. AttributeSelectionPtr anAxis = data()->selection(AXIS_ID()); if (!anAxis->isInitialized()) { - ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"OZ"); + ObjectPtr anAxisObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"OZ"); if (anAxisObj.get()) { - ResultPtr anAxisRes = std::dynamic_pointer_cast(anAxisObj); + ResultPtr anAxisRes = + std::dynamic_pointer_cast(anAxisObj); anAxis->setValue(anAxisRes, std::shared_ptr()); } } } //================================================================================================= -void PrimitivesPlugin_Cylinder::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(PrimitivesPlugin_Cylinder::CREATION_METHOD()); +void PrimitivesPlugin_Cylinder::execute() { + AttributeStringPtr aMethodTypeAttr = + string(PrimitivesPlugin_Cylinder::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); if (aMethodType == CREATION_METHOD_CYLINDER()) { @@ -95,12 +98,11 @@ void PrimitivesPlugin_Cylinder::execute() } //================================================================================================= -void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) -{ +void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) { // Getting point. std::shared_ptr aBasePoint; std::shared_ptr aPointRef = - selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); + selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); if (aPointRef.get() != NULL) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { @@ -112,7 +114,8 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) } // Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; std::shared_ptr anEdgeRef = selection(AXIS_ID()); GeomShapePtr aShape = anEdgeRef->value(); if (!aShape.get()) { @@ -125,30 +128,23 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) return; } std::shared_ptr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); - } - else - { + } else { setError(aSelectionError); return; } - if (!anEdge.get()) - { + if (!anEdge.get()) { setError(aSelectionError); return; } - std::shared_ptr anAxis(new GeomAPI_Ax2(aBasePoint, - anEdge->line()->direction())); - + std::shared_ptr anAxis( + new GeomAPI_Ax2(aBasePoint, anEdge->line()->direction())); // Getting radius and height double aRadius = real(PrimitivesPlugin_Cylinder::RADIUS_ID())->value(); @@ -158,14 +154,11 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) if (withAngle) { // Getting angle double anAngle = real(PrimitivesPlugin_Cylinder::ANGLE_ID())->value(); - aCylinderAlgo = - std::shared_ptr(new GeomAlgoAPI_Cylinder(anAxis, - aRadius, aHeight, - anAngle)); + aCylinderAlgo = std::shared_ptr( + new GeomAlgoAPI_Cylinder(anAxis, aRadius, aHeight, anAngle)); } else { - aCylinderAlgo = - std::shared_ptr(new GeomAlgoAPI_Cylinder(anAxis, - aRadius, aHeight)); + aCylinderAlgo = std::shared_ptr( + new GeomAlgoAPI_Cylinder(anAxis, aRadius, aHeight)); } // These checks should be made to the GUI for the feature but @@ -179,13 +172,15 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) aCylinderAlgo->build(); // Check if the creation of the cylinder - if(!aCylinderAlgo->isDone()) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aCylinderAlgo->isDone()) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aCylinderAlgo->getError()); return; } - if(!aCylinderAlgo->checkValid("Cylinder builder")) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aCylinderAlgo->checkValid("Cylinder builder")) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aCylinderAlgo->getError()); return; } @@ -197,9 +192,9 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) } //================================================================================================= -void PrimitivesPlugin_Cylinder::loadNamingDS(std::shared_ptr theCylinderAlgo, - std::shared_ptr theResultCylinder) -{ +void PrimitivesPlugin_Cylinder::loadNamingDS( + std::shared_ptr theCylinderAlgo, + std::shared_ptr theResultCylinder) { // Load the result theResultCylinder->store(theCylinderAlgo->shape()); @@ -207,12 +202,11 @@ void PrimitivesPlugin_Cylinder::loadNamingDS(std::shared_ptrprepareNamingFaces(); // Insert to faces - std::map< std::string, std::shared_ptr > listOfFaces = - theCylinderAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) - { + std::map> listOfFaces = + theCylinderAlgo->getCreatedFaces(); + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultCylinder->generated((*it).second, (*it).first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h index b9c77ced0..12af199ab 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PRIMITIVESPLUGIN_CYLINDER_H_ #define PRIMITIVESPLUGIN_CYLINDER_H_ -#include -#include #include +#include +#include class GeomAPI_Shape; class ModelAPI_ResultBody; @@ -31,78 +32,67 @@ class ModelAPI_ResultBody; * \ingroup Plugins * \brief Feature for creation of a cylinder. * - * Creates a cylinder from a radius, a height, an angle, a center point defaulting to - * the origin and an axis defaulting to OZ + * Creates a cylinder from a radius, a height, an angle, a center point + * defaulting to the origin and an axis defaulting to OZ */ -class PrimitivesPlugin_Cylinder : public ModelAPI_Feature -{ - public: +class PrimitivesPlugin_Cylinder : public ModelAPI_Feature { +public: /// Cylinder kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CYLINDER_ID("Cylinder"); return MY_CYLINDER_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_CYLINDER() - { + inline static const std::string &CREATION_METHOD_CYLINDER() { static const std::string MY_CREATION_METHOD_ID("Cylinder"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_CYLINDER_PORTION() - { + inline static const std::string &CREATION_METHOD_CYLINDER_PORTION() { static const std::string MY_CREATION_METHOD_ID("CylinderPortion"); return MY_CREATION_METHOD_ID; } /// Attribute name of the base point - inline static const std::string& BASE_POINT_ID() - { + inline static const std::string &BASE_POINT_ID() { static const std::string MY_BASE_POINT_ID("base_point"); return MY_BASE_POINT_ID; } /// Attribute name of the axis - inline static const std::string& AXIS_ID() - { + inline static const std::string &AXIS_ID() { static const std::string MY_AXIS_ID("axis"); return MY_AXIS_ID; } /// Attribute name of the radius - inline static const std::string& RADIUS_ID() - { + inline static const std::string &RADIUS_ID() { static const std::string MY_RADIUS_ID("radius"); return MY_RADIUS_ID; } /// Attribute name of the height - inline static const std::string& HEIGHT_ID() - { + inline static const std::string &HEIGHT_ID() { static const std::string MY_HEIGHT_ID("height"); return MY_HEIGHT_ID; } /// Attribute name of the angle - inline static const std::string& ANGLE_ID() - { + inline static const std::string &ANGLE_ID() { static const std::string MY_ANGLE_ID("angle"); return MY_ANGLE_ID; } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind() - { + PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PrimitivesPlugin_Cylinder::ID(); return MY_KIND; } @@ -110,20 +100,20 @@ class PrimitivesPlugin_Cylinder : public ModelAPI_Feature /// Creates a new part document if needed PRIMITIVESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation PrimitivesPlugin_Cylinder(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theCylinderAlgo, std::shared_ptr theResultCylinder); - ///Perform the creation of a cylinder + /// Perform the creation of a cylinder void createCylinder(bool withAngle); - }; #endif // PRIMITIVESPLUGIN_CYLINDER_H_ diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp index 703dbafa2..86ca91192 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -28,21 +29,20 @@ #include -#include -#include #include +#include +#include // the only created instance of this plugin -static PrimitivesPlugin_Plugin* MY_PRIMITIVES_INSTANCE = new PrimitivesPlugin_Plugin(); +static PrimitivesPlugin_Plugin *MY_PRIMITIVES_INSTANCE = + new PrimitivesPlugin_Plugin(); -PrimitivesPlugin_Plugin::PrimitivesPlugin_Plugin() -{ +PrimitivesPlugin_Plugin::PrimitivesPlugin_Plugin() { // register this plugin ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr PrimitivesPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr PrimitivesPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == PrimitivesPlugin_Box::ID()) { return FeaturePtr(new PrimitivesPlugin_Box); } else if (theFeatureID == PrimitivesPlugin_Cone::ID()) { diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h index 49c03206c..b8099bfa1 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h @@ -14,27 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PrimitivesPlugin_Plugin_H_ #define PrimitivesPlugin_Plugin_H_ #include "PrimitivesPlugin.h" -#include #include +#include /**\class PrimitivesPlugin_Plugin * \ingroup Plugins * \brief The main class managing Primitive Features as plugins. */ -class PRIMITIVESPLUGIN_EXPORT PrimitivesPlugin_Plugin : public ModelAPI_Plugin -{ - public: +class PRIMITIVESPLUGIN_EXPORT PrimitivesPlugin_Plugin : public ModelAPI_Plugin { +public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); - public: +public: /// Default constructor PrimitivesPlugin_Plugin(); }; diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp index cf88ca191..f323805c9 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesPlugin_Sphere.cpp @@ -37,36 +38,36 @@ #include //================================================================================================= -PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere() -{ -} +PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere() {} //================================================================================================= -void PrimitivesPlugin_Sphere::initAttributes() -{ +void PrimitivesPlugin_Sphere::initAttributes() { // Attention! A fix for 37570 Tuleap issue. // We could have studies with aCenterPoint at the first position (old studies) // and studies with CREATION_METHOD() at the first position (new studies) // data for the first mode : by a point and a radius - AttributeSelectionPtr aCenterPoint = std::dynamic_pointer_cast - (data()->addAttribute(PrimitivesPlugin_Sphere::CENTER_POINT_ID(), - ModelAPI_AttributeSelection::typeId())); // #1 (old studies) + AttributeSelectionPtr aCenterPoint = + std::dynamic_pointer_cast( + data()->addAttribute( + PrimitivesPlugin_Sphere::CENTER_POINT_ID(), + ModelAPI_AttributeSelection::typeId())); // #1 (old studies) if (aCenterPoint->isInitialized()) { // we are opening an old study: // #1 Center Point // #2 Radius // #3 Creation method (initialize now) - data()->addAttribute(PrimitivesPlugin_Sphere::RADIUS_ID(), - ModelAPI_AttributeDouble::typeId()); // #2 (old studies) + data()->addAttribute( + PrimitivesPlugin_Sphere::RADIUS_ID(), + ModelAPI_AttributeDouble::typeId()); // #2 (old studies) - AttributeStringPtr aMethod = std::dynamic_pointer_cast - (data()->addAttribute(PrimitivesPlugin_Sphere::CREATION_METHOD(), - ModelAPI_AttributeString::typeId())); // #3 + AttributeStringPtr aMethod = + std::dynamic_pointer_cast( + data()->addAttribute(PrimitivesPlugin_Sphere::CREATION_METHOD(), + ModelAPI_AttributeString::typeId())); // #3 aMethod->setValue(CREATION_METHOD_BY_PT_RADIUS()); - } - else { + } else { // we are opening a new study or creating Sphere from scratch // #1 Creation method // #2 Center Point @@ -76,17 +77,20 @@ void PrimitivesPlugin_Sphere::initAttributes() ModelAPI_AttributeString::typeId(), 1); // #1 new studies or from scratch - aCenterPoint = std::dynamic_pointer_cast - (data()->addAttribute(PrimitivesPlugin_Sphere::CENTER_POINT_ID(), - ModelAPI_AttributeSelection::typeId(), - 2)); // #2 + aCenterPoint = std::dynamic_pointer_cast( + data()->addAttribute(PrimitivesPlugin_Sphere::CENTER_POINT_ID(), + ModelAPI_AttributeSelection::typeId(), + 2)); // #2 - // Initialize the center point of the sphere at the origin if the center point is not filled. + // Initialize the center point of the sphere at the origin if the center + // point is not filled. if (!aCenterPoint->isInitialized()) { - ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin"); + ObjectPtr aPointObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"Origin"); if (aPointObj.get()) { - ResultPtr aPointRes = std::dynamic_pointer_cast(aPointObj); + ResultPtr aPointRes = + std::dynamic_pointer_cast(aPointObj); aCenterPoint->setValue(aPointRes, std::shared_ptr()); } } @@ -97,18 +101,24 @@ void PrimitivesPlugin_Sphere::initAttributes() } // data for the second mode : by dimensions - data()->addAttribute(PrimitivesPlugin_Sphere::RMIN_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Sphere::RMAX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Sphere::PHIMIN_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Sphere::PHIMAX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Sphere::THETAMIN_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Sphere::THETAMAX_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Sphere::RMIN_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Sphere::RMAX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Sphere::PHIMIN_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Sphere::PHIMAX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Sphere::THETAMIN_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Sphere::THETAMAX_ID(), + ModelAPI_AttributeDouble::typeId()); } //================================================================================================= -void PrimitivesPlugin_Sphere::execute() -{ - AttributeStringPtr aMethodTypeAttr = string(PrimitivesPlugin_Sphere::CREATION_METHOD()); +void PrimitivesPlugin_Sphere::execute() { + AttributeStringPtr aMethodTypeAttr = + string(PrimitivesPlugin_Sphere::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); if (aMethodType == CREATION_METHOD_BY_PT_RADIUS()) @@ -118,21 +128,19 @@ void PrimitivesPlugin_Sphere::execute() createShereByDimensions(); } - //================================================================================================= -void PrimitivesPlugin_Sphere::createSphereByPtRadius() -{ +void PrimitivesPlugin_Sphere::createSphereByPtRadius() { // Getting point. std::shared_ptr aCenterPoint; std::shared_ptr aPointRef = - selection(PrimitivesPlugin_Sphere::CENTER_POINT_ID()); + selection(PrimitivesPlugin_Sphere::CENTER_POINT_ID()); if (aPointRef.get() != NULL) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); } if (aShape1) { - aCenterPoint = GeomAlgoAPI_PointBuilder::point(aShape1); + aCenterPoint = GeomAlgoAPI_PointBuilder::point(aShape1); } } @@ -140,7 +148,8 @@ void PrimitivesPlugin_Sphere::createSphereByPtRadius() double aRadius = real(PrimitivesPlugin_Sphere::RADIUS_ID())->value(); std::shared_ptr aSphereAlgo = - std::shared_ptr(new GeomAlgoAPI_Sphere(aCenterPoint, aRadius)); + std::shared_ptr( + new GeomAlgoAPI_Sphere(aCenterPoint, aRadius)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -153,11 +162,11 @@ void PrimitivesPlugin_Sphere::createSphereByPtRadius() aSphereAlgo->build(); // Check if the creation of the sphere is OK - if(!aSphereAlgo->isDone()) { + if (!aSphereAlgo->isDone()) { setError(aSphereAlgo->getError()); return; } - if(!aSphereAlgo->checkValid("Sphere builder")) { + if (!aSphereAlgo->checkValid("Sphere builder")) { setError(aSphereAlgo->getError()); return; } @@ -169,8 +178,7 @@ void PrimitivesPlugin_Sphere::createSphereByPtRadius() } //================================================================================================= -void PrimitivesPlugin_Sphere::createShereByDimensions() -{ +void PrimitivesPlugin_Sphere::createShereByDimensions() { // Getting rmin, rmax, phimin, phimax, thetamin et thetamax double aRMin = real(PrimitivesPlugin_Sphere::RMIN_ID())->value(); double aRMax = real(PrimitivesPlugin_Sphere::RMAX_ID())->value(); @@ -179,8 +187,9 @@ void PrimitivesPlugin_Sphere::createShereByDimensions() double aThetaMin = real(PrimitivesPlugin_Sphere::THETAMIN_ID())->value(); double aThetaMax = real(PrimitivesPlugin_Sphere::THETAMAX_ID())->value(); - std::shared_ptr aSphereAlgo = std::shared_ptr( - new GeomAlgoAPI_Sphere(aRMin, aRMax, aPhiMin, aPhiMax, aThetaMin, aThetaMax)); + std::shared_ptr aSphereAlgo = + std::shared_ptr(new GeomAlgoAPI_Sphere( + aRMin, aRMax, aPhiMin, aPhiMax, aThetaMin, aThetaMax)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -193,13 +202,15 @@ void PrimitivesPlugin_Sphere::createShereByDimensions() aSphereAlgo->build(); // Check if the creation of the sphere is OK - if(!aSphereAlgo->isDone()) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aSphereAlgo->isDone()) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aSphereAlgo->getError()); return; } - if(!aSphereAlgo->checkValid("Sphere Builder")) { - // The error is not displayed in a popup window. It must be in the message console. + if (!aSphereAlgo->checkValid("Sphere Builder")) { + // The error is not displayed in a popup window. It must be in the message + // console. setError(aSphereAlgo->getError()); return; } @@ -211,9 +222,9 @@ void PrimitivesPlugin_Sphere::createShereByDimensions() } //================================================================================================= -void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr theSphereAlgo, - std::shared_ptr theResultSphere) -{ +void PrimitivesPlugin_Sphere::loadNamingDS( + std::shared_ptr theSphereAlgo, + std::shared_ptr theResultSphere) { // Load the result theResultSphere->store(theSphereAlgo->shape()); @@ -222,25 +233,23 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr t // Insert to faces // Naming for faces and edges - std::map< std::string, std::shared_ptr > listOfFaces = + std::map> listOfFaces = theSphereAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) - { + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultSphere->generated((*it).second, (*it).first); } // Naming vertices GeomAPI_DataMapOfShapeShape aVertices; int anIndex = 1; - for (GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX); - aVertExp.more(); - aVertExp.next()) - { + for (GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), + GeomAPI_Shape::VERTEX); + aVertExp.more(); aVertExp.next()) { if (!aVertices.isBound(aVertExp.current())) { std::ostringstream aStream; - aStream<<"Vertex_"<generated(aVertExp.current(), aStream.str()); aVertices.bind(aVertExp.current(), aVertExp.current()); } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h index 1f9437a67..f217fbc20 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesPlugin_Sphere.h @@ -24,107 +25,94 @@ #ifndef PRIMITIVESPLUGIN_SPHERE_H_ #define PRIMITIVESPLUGIN_SPHERE_H_ -#include -#include #include +#include +#include /**\class PrimitivesPlugin_Sphere * \ingroup Plugins * \brief Feature for creation of a sphere primitive using various methods. * - * It can be built via two methods : using a radius and a center point defaulting to the origin, - * or radii (inner and outer) and angle limits (theta and phi). + * It can be built via two methods : using a radius and a center point + * defaulting to the origin, or radii (inner and outer) and angle limits (theta + * and phi). */ -class PrimitivesPlugin_Sphere : public ModelAPI_Feature -{ - public: +class PrimitivesPlugin_Sphere : public ModelAPI_Feature { +public: /// Sphere kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SPHERE_ID("Sphere"); return MY_SPHERE_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD() - { + inline static const std::string &CREATION_METHOD() { static const std::string MY_CREATION_METHOD_ID("CreationMethod"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_BY_PT_RADIUS() - { + inline static const std::string &CREATION_METHOD_BY_PT_RADIUS() { static const std::string MY_CREATION_METHOD_ID("SphereByPointRadius"); return MY_CREATION_METHOD_ID; } /// Attribute name for creation method - inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() - { + inline static const std::string &CREATION_METHOD_BY_DIMENSIONS() { static const std::string MY_CREATION_METHOD_ID("SphereByDimensions"); return MY_CREATION_METHOD_ID; } /// Attribute name of the base point - inline static const std::string& CENTER_POINT_ID() - { + inline static const std::string &CENTER_POINT_ID() { static const std::string MY_CENTER_POINT_ID("center_point"); return MY_CENTER_POINT_ID; } /// Attribute name of the radius - inline static const std::string& RADIUS_ID() - { + inline static const std::string &RADIUS_ID() { static const std::string MY_RADIUS_ID("radius"); return MY_RADIUS_ID; } /// attribute name of the inner radius - inline static const std::string& RMIN_ID() - { + inline static const std::string &RMIN_ID() { static const std::string MY_RMIN_ID("rmin"); return MY_RMIN_ID; } /// attribute name of the outer radius - inline static const std::string& RMAX_ID() - { + inline static const std::string &RMAX_ID() { static const std::string MY_RMAX_ID("rmax"); return MY_RMAX_ID; } /// attribute name of the lower phi limit - inline static const std::string& PHIMIN_ID() - { + inline static const std::string &PHIMIN_ID() { static const std::string MY_PHIMIN_ID("phimin"); return MY_PHIMIN_ID; } /// attribute name of the higher phi limit - inline static const std::string& PHIMAX_ID() - { + inline static const std::string &PHIMAX_ID() { static const std::string MY_PHIMAX_ID("phimax"); return MY_PHIMAX_ID; } /// attribute name of the lower theta limit - inline static const std::string& THETAMIN_ID() - { + inline static const std::string &THETAMIN_ID() { static const std::string MY_THETAMIN_ID("thetamin"); return MY_THETAMIN_ID; } /// attribute name of the higher theta limit - inline static const std::string& THETAMAX_ID() - { + inline static const std::string &THETAMAX_ID() { static const std::string MY_THETAMAX_ID("thetamax"); return MY_THETAMAX_ID; } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind() - { + PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PrimitivesPlugin_Sphere::ID(); return MY_KIND; } @@ -132,13 +120,14 @@ class PrimitivesPlugin_Sphere : public ModelAPI_Feature /// Creates a new part document if needed PRIMITIVESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation PrimitivesPlugin_Sphere(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theSphereAlgo, std::shared_ptr theResultSphere); @@ -146,10 +135,9 @@ class PrimitivesPlugin_Sphere : public ModelAPI_Feature /// Perform the creation of the sphere using a point and a radius void createSphereByPtRadius(); - /// Perform the creation of the sphere using radii (inner and outer) and angle limits - /// (theta and phi) + /// Perform the creation of the sphere using radii (inner and outer) and angle + /// limits (theta and phi) void createShereByDimensions(); - }; #endif // PRIMITIVESPLUGIN_SPHERE_H_ diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp index ba168a188..9e2ff415a 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesPlugin_Torus.cpp @@ -39,13 +40,10 @@ #include //================================================================================================= -PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() -{ -} +PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() {} //================================================================================================= -void PrimitivesPlugin_Torus::initAttributes() -{ +void PrimitivesPlugin_Torus::initAttributes() { data()->addAttribute(PrimitivesPlugin_Torus::BASE_POINT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(PrimitivesPlugin_Torus::AXIS_ID(), @@ -56,49 +54,55 @@ void PrimitivesPlugin_Torus::initAttributes() data()->addAttribute(PrimitivesPlugin_Torus::RING_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the base point of the torus at the origin if the base point is not filled. + // Initialize the base point of the torus at the origin if the base point is + // not filled. AttributeSelectionPtr aCenterPoint = - data()->selection(PrimitivesPlugin_Torus::BASE_POINT_ID()); + data()->selection(PrimitivesPlugin_Torus::BASE_POINT_ID()); if (!aCenterPoint->isInitialized()) { - ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin"); + ObjectPtr aPointObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"Origin"); if (aPointObj.get()) { - ResultPtr aPointRes = std::dynamic_pointer_cast(aPointObj); + ResultPtr aPointRes = + std::dynamic_pointer_cast(aPointObj); aCenterPoint->setValue(aPointRes, std::shared_ptr()); } } // Initialize the axis at the OZ axis if the axis is not filled. - AttributeSelectionPtr anAxis = data()->selection(PrimitivesPlugin_Torus::AXIS_ID()); + AttributeSelectionPtr anAxis = + data()->selection(PrimitivesPlugin_Torus::AXIS_ID()); if (!anAxis->isInitialized()) { - ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument() - ->objectByName(ModelAPI_ResultConstruction::group(), L"OZ"); + ObjectPtr anAxisObj = + ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), L"OZ"); if (anAxisObj.get()) { - ResultPtr anAxisRes = std::dynamic_pointer_cast(anAxisObj); + ResultPtr anAxisRes = + std::dynamic_pointer_cast(anAxisObj); anAxis->setValue(anAxisRes, std::shared_ptr()); } } } //================================================================================================= -void PrimitivesPlugin_Torus::execute() -{ +void PrimitivesPlugin_Torus::execute() { // Getting base point. std::shared_ptr aBasePoint; std::shared_ptr aPointRef = - selection(PrimitivesPlugin_Torus::BASE_POINT_ID()); + selection(PrimitivesPlugin_Torus::BASE_POINT_ID()); if (aPointRef.get() != NULL) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); } if (aShape1) { - aBasePoint = GeomAlgoAPI_PointBuilder::point(aShape1); + aBasePoint = GeomAlgoAPI_PointBuilder::point(aShape1); } } // Getting axis. - static const std::string aSelectionError = "Error: The axis shape selection is bad."; + static const std::string aSelectionError = + "Error: The axis shape selection is bad."; std::shared_ptr anEdgeRef = selection(AXIS_ID()); GeomShapePtr aShape = anEdgeRef->value(); if (!aShape.get()) { @@ -111,38 +115,31 @@ void PrimitivesPlugin_Torus::execute() return; } std::shared_ptr anEdge; - if (aShape->isEdge()) - { + if (aShape->isEdge()) { anEdge = aShape->edge(); - } - else if (aShape->isCompound()) - { + } else if (aShape->isCompound()) { GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); - } - else - { + } else { setError(aSelectionError); return; } - if (!anEdge.get()) - { + if (!anEdge.get()) { setError(aSelectionError); return; } - std::shared_ptr anAxis(new GeomAPI_Ax2(aBasePoint, - anEdge->line()->direction())); + std::shared_ptr anAxis( + new GeomAPI_Ax2(aBasePoint, anEdge->line()->direction())); // Getting radius and ring radius double aRadius = real(PrimitivesPlugin_Torus::RADIUS_ID())->value(); double aRingRadius = real(PrimitivesPlugin_Torus::RING_RADIUS_ID())->value(); std::shared_ptr aTorusAlgo = - std::shared_ptr(new GeomAlgoAPI_Torus(anAxis, - aRadius, - aRingRadius)); + std::shared_ptr( + new GeomAlgoAPI_Torus(anAxis, aRadius, aRingRadius)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -155,11 +152,11 @@ void PrimitivesPlugin_Torus::execute() aTorusAlgo->build(); // Check if the creation of the cylinder - if(!aTorusAlgo->isDone()) { + if (!aTorusAlgo->isDone()) { setError(aTorusAlgo->getError()); return; } - if(!aTorusAlgo->checkValid("Torus builder")) { + if (!aTorusAlgo->checkValid("Torus builder")) { setError(aTorusAlgo->getError()); return; } @@ -171,9 +168,9 @@ void PrimitivesPlugin_Torus::execute() } //================================================================================================= -void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr theTorusAlgo, - std::shared_ptr theResultTorus) -{ +void PrimitivesPlugin_Torus::loadNamingDS( + std::shared_ptr theTorusAlgo, + std::shared_ptr theResultTorus) { // Load the result theResultTorus->store(theTorusAlgo->shape()); @@ -182,25 +179,23 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr the // Insert to faces // Naming for faces - std::map< std::string, std::shared_ptr > listOfFaces = + std::map> listOfFaces = theTorusAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) - { + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultTorus->generated((*it).second, (*it).first); } // Naming of edges GeomAPI_DataMapOfShapeShape anEdges; int anIndex = 1; - for (GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE); - anEdgeExp.more(); - anEdgeExp.next()) - { + for (GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), + GeomAPI_Shape::EDGE); + anEdgeExp.more(); anEdgeExp.next()) { if (!anEdges.isBound(anEdgeExp.current())) { std::ostringstream aStream; - aStream<<"Edge_"<generated(anEdgeExp.current(), aStream.str()); anEdges.bind(anEdgeExp.current(), anEdgeExp.current()); } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h index 1ce54189d..ba4455717 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: PrimitivesPlugin_Torus.h @@ -24,57 +25,50 @@ #ifndef PRIMITIVESPLUGIN_TORUS_H_ #define PRIMITIVESPLUGIN_TORUS_H_ -#include -#include #include +#include +#include /**\class PrimitivesPlugin_Torus * \ingroup Plugins * \brief Feature for creation of a torus. * - * Creates a torus from a + * Creates a torus from a */ -class PrimitivesPlugin_Torus : public ModelAPI_Feature -{ - public: +class PrimitivesPlugin_Torus : public ModelAPI_Feature { +public: /// Torus kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_TORUS_ID("Torus"); return MY_TORUS_ID; } /// Attribute name of the base point - inline static const std::string& BASE_POINT_ID() - { + inline static const std::string &BASE_POINT_ID() { static const std::string MY_BASE_POINT_ID("base_point"); return MY_BASE_POINT_ID; } /// Attribute name of the axis - inline static const std::string& AXIS_ID() - { + inline static const std::string &AXIS_ID() { static const std::string MY_AXIS_ID("axis"); return MY_AXIS_ID; } /// Attribute name of the radius - inline static const std::string& RADIUS_ID() - { + inline static const std::string &RADIUS_ID() { static const std::string MY_RADIUS_ID("radius"); return MY_RADIUS_ID; } /// Attribute name of the section radius - inline static const std::string& RING_RADIUS_ID() - { + inline static const std::string &RING_RADIUS_ID() { static const std::string MY_RING_RADIUS_ID("ring_radius"); return MY_RING_RADIUS_ID; } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind() - { + PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PrimitivesPlugin_Torus::ID(); return MY_KIND; } @@ -82,17 +76,17 @@ class PrimitivesPlugin_Torus : public ModelAPI_Feature /// Creates a new part document if needed PRIMITIVESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation PrimitivesPlugin_Torus(); - private: +private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theTorusAlgo, std::shared_ptr theResultTorus); - }; #endif // PRIMITIVESPLUGIN_TORUS_H_ diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp index 5c01c03c6..566a413e6 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,26 +24,28 @@ #include //================================================================================================= -PrimitivesPlugin_Tube::PrimitivesPlugin_Tube() // Nothing to do during instantiation -{ -} +PrimitivesPlugin_Tube::PrimitivesPlugin_Tube() // Nothing to do during + // instantiation +{} //================================================================================================= -void PrimitivesPlugin_Tube::initAttributes() -{ - data()->addAttribute(PrimitivesPlugin_Tube::RMIN_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Tube::RMAX_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Tube::HEIGHT_ID(), ModelAPI_AttributeDouble::typeId()); +void PrimitivesPlugin_Tube::initAttributes() { + data()->addAttribute(PrimitivesPlugin_Tube::RMIN_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Tube::RMAX_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Tube::HEIGHT_ID(), + ModelAPI_AttributeDouble::typeId()); } //================================================================================================= -void PrimitivesPlugin_Tube::execute() -{ +void PrimitivesPlugin_Tube::execute() { double aRMin = real(PrimitivesPlugin_Tube::RMIN_ID())->value(); double aRMax = real(PrimitivesPlugin_Tube::RMAX_ID())->value(); double aZ = real(PrimitivesPlugin_Tube::HEIGHT_ID())->value(); - std::shared_ptr aTubeAlgo(new GeomAlgoAPI_Tube(aRMin,aRMax,aZ)); + std::shared_ptr aTubeAlgo( + new GeomAlgoAPI_Tube(aRMin, aRMax, aZ)); // These checks should be made to the GUI for the feature but // the corresponding validator does not exist yet. @@ -61,9 +64,9 @@ void PrimitivesPlugin_Tube::execute() } //================================================================================================= -void PrimitivesPlugin_Tube::loadNamingDS(std::shared_ptr theTubeAlgo, - std::shared_ptr theResultTube) -{ +void PrimitivesPlugin_Tube::loadNamingDS( + std::shared_ptr theTubeAlgo, + std::shared_ptr theResultTube) { // Load the result theResultTube->store(theTubeAlgo->shape()); @@ -71,12 +74,11 @@ void PrimitivesPlugin_Tube::loadNamingDS(std::shared_ptr theTu theTubeAlgo->prepareNamingFaces(); // Insert to faces - std::map< std::string, std::shared_ptr > listOfFaces = - theTubeAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); - it != listOfFaces.end(); - ++it) - { + std::map> listOfFaces = + theTubeAlgo->getCreatedFaces(); + for (std::map>::iterator it = + listOfFaces.begin(); + it != listOfFaces.end(); ++it) { theResultTube->generated((*it).second, (*it).first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h index 9560292e4..b9500f559 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PrimitivesPlugin_Tube_H_ @@ -28,44 +29,38 @@ * \ingroup Plugins * \brief Feature for creation of a tube primitive using various methods. * - * Tube creates a tuboid - Holed cylinder. It can be built via two methods : - * using an inner raidus, an outer radius and a heigth or radii (inner and outer) - * and angles. + * Tube creates a tuboid - Holed cylinder. It can be built via two methods : + * using an inner raidus, an outer radius and a heigth or radii (inner and + * outer) and angles. */ -class PrimitivesPlugin_Tube : public ModelAPI_Feature -{ - public: +class PrimitivesPlugin_Tube : public ModelAPI_Feature { +public: /// Tube kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_TUBE_ID("Tube"); return MY_TUBE_ID; } /// Attrinute name of the inner radius - inline static const std::string& RMIN_ID() - { + inline static const std::string &RMIN_ID() { static const std::string MY_RMIN_ID("rmin"); return MY_RMIN_ID; } /// Attrinute name of the outer radius - inline static const std::string& RMAX_ID() - { + inline static const std::string &RMAX_ID() { static const std::string MY_RMAX_ID("rmax"); return MY_RMAX_ID; } /// Attrinute name of the height - inline static const std::string& HEIGHT_ID() - { + inline static const std::string &HEIGHT_ID() { static const std::string MY_HEIGHT_ID("height"); return MY_HEIGHT_ID; } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind() - { + PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = PrimitivesPlugin_Tube::ID(); return MY_KIND; } @@ -73,13 +68,14 @@ class PrimitivesPlugin_Tube : public ModelAPI_Feature /// Performs the algorithm and stores results it in the data structure PRIMITIVESPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); /// Use plugin manager for features creation. PrimitivesPlugin_Tube(); - private: +private: /// Load naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theTubeAlgo, std::shared_ptr theResultBox); diff --git a/src/PrimitivesPlugin/cone_widget.xml b/src/PrimitivesPlugin/cone_widget.xml index 27f571b8e..95045aba2 100644 --- a/src/PrimitivesPlugin/cone_widget.xml +++ b/src/PrimitivesPlugin/cone_widget.xml @@ -42,4 +42,4 @@ icon="icons/Primitives/dimension_v.png" tooltip="Enter the height of the cone"> - \ No newline at end of file + diff --git a/src/PrimitivesPlugin/doc/TUI_boxByPoints.rst b/src/PrimitivesPlugin/doc/TUI_boxByPoints.rst index 31eaf4bf8..d0820cc18 100644 --- a/src/PrimitivesPlugin/doc/TUI_boxByPoints.rst +++ b/src/PrimitivesPlugin/doc/TUI_boxByPoints.rst @@ -8,4 +8,4 @@ Create Box by points :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_boxByPtDims.rst b/src/PrimitivesPlugin/doc/TUI_boxByPtDims.rst index 2b5aa3142..3a536730a 100644 --- a/src/PrimitivesPlugin/doc/TUI_boxByPtDims.rst +++ b/src/PrimitivesPlugin/doc/TUI_boxByPtDims.rst @@ -8,5 +8,4 @@ Create Box coordinates of a point and dimensions :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_boxDimensions.rst b/src/PrimitivesPlugin/doc/TUI_boxDimensions.rst index ddeabf16f..c82c2f091 100644 --- a/src/PrimitivesPlugin/doc/TUI_boxDimensions.rst +++ b/src/PrimitivesPlugin/doc/TUI_boxDimensions.rst @@ -8,5 +8,4 @@ Create Box by dimensions :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_coneFeature.rst b/src/PrimitivesPlugin/doc/TUI_coneFeature.rst index 4c5b3ffdc..12789fdc6 100644 --- a/src/PrimitivesPlugin/doc/TUI_coneFeature.rst +++ b/src/PrimitivesPlugin/doc/TUI_coneFeature.rst @@ -8,5 +8,4 @@ Create Cone :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_cylinderFeature.rst b/src/PrimitivesPlugin/doc/TUI_cylinderFeature.rst index bb9030e53..b7b991fa2 100644 --- a/src/PrimitivesPlugin/doc/TUI_cylinderFeature.rst +++ b/src/PrimitivesPlugin/doc/TUI_cylinderFeature.rst @@ -8,5 +8,4 @@ Create Cylinder :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_cylinderPortion.rst b/src/PrimitivesPlugin/doc/TUI_cylinderPortion.rst index 5014c936d..dd8ae6ef5 100644 --- a/src/PrimitivesPlugin/doc/TUI_cylinderPortion.rst +++ b/src/PrimitivesPlugin/doc/TUI_cylinderPortion.rst @@ -8,5 +8,4 @@ Create Portion of cylinder :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_sphereFeature.rst b/src/PrimitivesPlugin/doc/TUI_sphereFeature.rst index 45a63db54..a055d6312 100644 --- a/src/PrimitivesPlugin/doc/TUI_sphereFeature.rst +++ b/src/PrimitivesPlugin/doc/TUI_sphereFeature.rst @@ -8,4 +8,4 @@ Create Sphere :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_spherePart.rst b/src/PrimitivesPlugin/doc/TUI_spherePart.rst index 56b3447b4..8c3c47a53 100644 --- a/src/PrimitivesPlugin/doc/TUI_spherePart.rst +++ b/src/PrimitivesPlugin/doc/TUI_spherePart.rst @@ -8,4 +8,4 @@ Create Part of sphere :linenos: :language: python -:download:`Download this script ` +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_torusFeature.rst b/src/PrimitivesPlugin/doc/TUI_torusFeature.rst index 07a422740..4253236cc 100644 --- a/src/PrimitivesPlugin/doc/TUI_torusFeature.rst +++ b/src/PrimitivesPlugin/doc/TUI_torusFeature.rst @@ -8,5 +8,4 @@ Create Torus :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/TUI_tubeFeature.rst b/src/PrimitivesPlugin/doc/TUI_tubeFeature.rst index 551c85415..257692b8d 100644 --- a/src/PrimitivesPlugin/doc/TUI_tubeFeature.rst +++ b/src/PrimitivesPlugin/doc/TUI_tubeFeature.rst @@ -8,5 +8,4 @@ Create Tube :linenos: :language: python -:download:`Download this script ` - +:download:`Download this script ` diff --git a/src/PrimitivesPlugin/doc/boxFeature.rst b/src/PrimitivesPlugin/doc/boxFeature.rst index e91466c20..5528e5596 100644 --- a/src/PrimitivesPlugin/doc/boxFeature.rst +++ b/src/PrimitivesPlugin/doc/boxFeature.rst @@ -16,19 +16,19 @@ There are 3 algorithms for creation of a Box: :align: left :height: 24px -**By dimensions** +**By dimensions** .. figure:: images/box_2pt_32x32.png :align: left :height: 24px -**By two points** +**By two points** .. figure:: images/box_pt_dxyz_32x32.png :align: left :height: 24px -**By coordinates of a point and dimensions** +**By coordinates of a point and dimensions** -------------------------------------------------------------------------------- @@ -42,12 +42,12 @@ Box is created by dimensions along X, Y, Z axis starting from the origin. Input fields: -- **DX**, **DY**, **DZ** define dimensions of the box along the corresponding coordinate axes. +- **DX**, **DY**, **DZ** define dimensions of the box along the corresponding coordinate axes. **TUI Command**: .. py:function:: model.addBox(Part_doc, DX, DY, DZ) - + :param part: The current part object. :param real: Size along X. :param real: Size along Y. @@ -75,7 +75,7 @@ Box is created by two points of the box diagonal. Input fields: - **Point 1** and **Point 2** define diagonal points of the box selected in 3D OCC viewer or object browser. - + **TUI Command**: .. py:function:: model.addBox(Part_doc, point1, point2) @@ -92,7 +92,7 @@ A solid box based on two points and with edges parallel to the coordinate axes. .. figure:: images/Box2.png :align: center - + Created boxes **See Also** a sample TUI Script of :ref:`tui_create_boxpnt` operation. @@ -109,7 +109,7 @@ Input fields: - **OX**, **OY**, **OZ** define coordinates of the center of box. - **DX**, **DY**, **DZ** define dimensions (hafl length) of the box along the corresponding coordinate axes. - + **TUI Command**: .. py:function:: model.addBox(Part_doc, OX, OY, OZ, DX, DY, DZ) @@ -130,7 +130,7 @@ A solid box whose point coordinates are the center and the dimensions are half l .. figure:: images/Box3.png :align: center - + Created boxes **See Also** a sample TUI Script of :ref:`tui_create_boxptdim` operation. diff --git a/src/PrimitivesPlugin/doc/coneFeature.rst b/src/PrimitivesPlugin/doc/coneFeature.rst index 68788cc49..2e4f21cc4 100644 --- a/src/PrimitivesPlugin/doc/coneFeature.rst +++ b/src/PrimitivesPlugin/doc/coneFeature.rst @@ -19,13 +19,13 @@ The following property panel appears. Input fields: -- **Point** defines the center of the cone base selected in 3D OCC viewer or object browser; +- **Point** defines the center of the cone base selected in 3D OCC viewer or object browser; - **Vector** defines the axis of the cone selected in 3D OCC viewer or object browser; -- Dimensions: +- Dimensions: - **Base Radius**; - - **Top radius**; + - **Top radius**; - **Height**. - + **TUI Command**: .. py:function:: model.addCone(Part_doc, Point, Axis, Radius1, Radius2, Height) @@ -47,7 +47,7 @@ If the radii are equal, the Cylinder will be created instead of cone. .. figure:: images/Cone_res.png :align: center - - Cone created + + Cone created **See Also** a sample TUI Script of :ref:`tui_create_cone` operation. diff --git a/src/PrimitivesPlugin/doc/cylinderFeature.rst b/src/PrimitivesPlugin/doc/cylinderFeature.rst index 95e543f43..ac2d817ba 100644 --- a/src/PrimitivesPlugin/doc/cylinderFeature.rst +++ b/src/PrimitivesPlugin/doc/cylinderFeature.rst @@ -31,16 +31,16 @@ Cylinder .. figure:: images/Cylinder.png :align: center - + **Cylinder** property panel Input fields: -- **Point** defines the center of the cylinder base selected in 3D OCC viewer or object browser; +- **Point** defines the center of the cylinder base selected in 3D OCC viewer or object browser; - **Vector** defines the axis of the cylinder selected in 3D OCC viewer or object browser; -- Dimensions: +- Dimensions: - **Radius**; - - **Height**. + - **Height**. **TUI Commands**: @@ -60,8 +60,8 @@ An example is shown below. .. figure:: images/Cylinder1.png :align: center - - Cylinder + + Cylinder **See Also** a sample TUI Script of :ref:`tui_create_cylinder` operation. @@ -70,15 +70,15 @@ Portion of cylinder .. figure:: images/Portion_cylinder.png :align: center - - **Portion of cylinder** property panel + + **Portion of cylinder** property panel Input fields for ***Portion of cylinder** tab include **Angle** defining a portion of cylinder. **TUI Commands**: .. py:function:: model.addCylinder(Part_doc, Point, Axis, Radius, Height,Angle) - + :param part: The current part object. :param object: Vertex. :param object: Axis. @@ -94,7 +94,7 @@ An example is shown below. .. figure:: images/Cylinder2.png :align: center - - Portion of cylinder + + Portion of cylinder **See Also** a sample TUI Script of :ref:`tui_create_cylportion` operation. diff --git a/src/PrimitivesPlugin/doc/sphereFeature.rst b/src/PrimitivesPlugin/doc/sphereFeature.rst index ade524999..aa82c9401 100644 --- a/src/PrimitivesPlugin/doc/sphereFeature.rst +++ b/src/PrimitivesPlugin/doc/sphereFeature.rst @@ -16,13 +16,13 @@ There are 2 algorithms for creation of a Sphere :align: left :height: 24px -**By a center and a radius** +**By a center and a radius** .. figure:: images/sphere_part_32x32.png :align: left :height: 24px -**By radii (inner and outer) and angle limits (theta and phi)** +**By radii (inner and outer) and angle limits (theta and phi)** -------------------------------------------------------------------------------- @@ -36,13 +36,13 @@ Sphere is created by a center (origin by default) and a radius. Input fields: -- **Point** defines the center of the sphere selected in 3D OCC viewer or object browser; +- **Point** defines the center of the sphere selected in 3D OCC viewer or object browser; - **Radius** defines the radius. **TUI Command**: .. py:function:: model.addSphere(Part_doc, Point, Radius) - + :param part: The current part object. :param object: Vertex. :param real: Radius. @@ -78,7 +78,7 @@ Input fields: **TUI Command**: .. py:function:: model.addSphere(Part_doc, RMin, RMax, PhiMin, PhiMax, ThetaMin, ThetaMax) - + :param part: The current part object. :param real: Inner radius. :param real: Outer radius. @@ -97,6 +97,3 @@ A solid sphere based on the origin with radii (inner and outer) and angles (phi :align: center **See Also** a sample TUI Script of a :ref:`tui_create_part_sphere` operation. - - - diff --git a/src/PrimitivesPlugin/doc/torusFeature.rst b/src/PrimitivesPlugin/doc/torusFeature.rst index ff8d1ad11..bce2c59e2 100644 --- a/src/PrimitivesPlugin/doc/torusFeature.rst +++ b/src/PrimitivesPlugin/doc/torusFeature.rst @@ -19,12 +19,12 @@ The following property panel appears. Input fields: -- **Point** defines the center of the torus base selected in 3D OCC viewer or object browser; +- **Point** defines the center of the torus base selected in 3D OCC viewer or object browser; - **Vector** defines the axis of the torus selected in 3D OCC viewer or object browser; -- Dimensions: +- Dimensions: - **Radius**; - **Ring radius**. - + **TUI Command**: .. py:function:: model.addTorus(Part_doc, Point, Axis, Radius1, Radius2) @@ -43,8 +43,7 @@ An example is shown below. .. figure:: images/Torus_res.png :align: center - - Torus created + + Torus created **See Also** a sample TUI Script of :ref:`tui_create_torus` operation. - diff --git a/src/PrimitivesPlugin/doc/tubeFeature.rst b/src/PrimitivesPlugin/doc/tubeFeature.rst index feb2ac468..57a7771eb 100644 --- a/src/PrimitivesPlugin/doc/tubeFeature.rst +++ b/src/PrimitivesPlugin/doc/tubeFeature.rst @@ -19,10 +19,10 @@ The following property panel appears. Input fields: -- **rmin** defines the inner radius of the the tube; +- **rmin** defines the inner radius of the the tube; - **rmax** defines the outer radius of the the tube; - **height** defines the height of the the tube; - + **TUI Command**: .. py:function:: model.addTube(Part_doc, rmin, rmax, height) @@ -40,7 +40,7 @@ An example is shown below. .. figure:: images/Tube_res.png :align: center - - Tube created + + Tube created **See Also** a sample TUI Script of :ref:`tui_create_tube` operation. diff --git a/src/PrimitivesPlugin/torus_widget.xml b/src/PrimitivesPlugin/torus_widget.xml index 244e6780a..1dbd3f36e 100644 --- a/src/PrimitivesPlugin/torus_widget.xml +++ b/src/PrimitivesPlugin/torus_widget.xml @@ -34,4 +34,4 @@ default="3." tooltip="Enter the ring radius of the torus"> - \ No newline at end of file + diff --git a/src/PythonAPI/CMakeLists.txt b/src/PythonAPI/CMakeLists.txt index b275b26e5..a70e30f8f 100644 --- a/src/PythonAPI/CMakeLists.txt +++ b/src/PythonAPI/CMakeLists.txt @@ -31,12 +31,12 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/PythonAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") diff --git a/src/PythonAPI/doc/source/index.rst b/src/PythonAPI/doc/source/index.rst index 5140367bd..f3e814e8d 100644 --- a/src/PythonAPI/doc/source/index.rst +++ b/src/PythonAPI/doc/source/index.rst @@ -17,7 +17,7 @@ Parametric API This API is implemented in the model Python package. A script written with the parametric API will typically begin with a code like below: -.. doctest:: +.. doctest:: >>> from salome.shaper import model >>> model.begin() diff --git a/src/PythonAPI/doc/source/model/extrusion.rst b/src/PythonAPI/doc/source/model/extrusion.rst index dce320d6d..b1b56ff16 100644 --- a/src/PythonAPI/doc/source/model/extrusion.rst +++ b/src/PythonAPI/doc/source/model/extrusion.rst @@ -19,12 +19,12 @@ Provided that a sketch has been created before an extrusion can then be created by the following code: .. doctest:: - + >>> base = sketch.selectFace() >>> extrusion = model.addExtrusion(part, base, 10) >>> # Modification of the extrusion >>> extrusion.setSize(20) - + All the ways to create an extrusion and the data access and modification methods of the extrusion are documented below @@ -50,7 +50,7 @@ Extrusion Boolean object .. autoclass:: model.features.extrusion_boolean.ExtrusionBoolean :members: - + Create an Extrusion Sketch -------------------------- diff --git a/src/PythonAPI/doc/source/model/revolution.rst b/src/PythonAPI/doc/source/model/revolution.rst index 061904ff9..a038ed399 100644 --- a/src/PythonAPI/doc/source/model/revolution.rst +++ b/src/PythonAPI/doc/source/model/revolution.rst @@ -23,7 +23,7 @@ Revolution Boolean object .. autoclass:: model.features.revolution_boolean.RevolutionBoolean :members: - + Create an Revolution Sketch --------------------------- diff --git a/src/PythonAddons/doc/TUI_pyFile_rectangleFeature.rst b/src/PythonAddons/doc/TUI_pyFile_rectangleFeature.rst index bbe2eafdb..88d6653df 100644 --- a/src/PythonAddons/doc/TUI_pyFile_rectangleFeature.rst +++ b/src/PythonAddons/doc/TUI_pyFile_rectangleFeature.rst @@ -1,11 +1,11 @@ .. _create_custom_rectangle_py: -File feature.py +File feature.py =============== -.. literalinclude:: examples/rectangle/feature.py +.. literalinclude:: examples/rectangle/feature.py :linenos: :language: python -:download:`Download this script ` \ No newline at end of file +:download:`Download this script ` diff --git a/src/PythonAddons/doc/TUI_xmlFile_rectangleFeature.rst b/src/PythonAddons/doc/TUI_xmlFile_rectangleFeature.rst index 1901d9629..5d524038a 100644 --- a/src/PythonAddons/doc/TUI_xmlFile_rectangleFeature.rst +++ b/src/PythonAddons/doc/TUI_xmlFile_rectangleFeature.rst @@ -1,11 +1,11 @@ .. _create_custom_rectangle_xml: -File widget.xml +File widget.xml =============== -.. literalinclude:: examples/rectangle/widget.xml +.. literalinclude:: examples/rectangle/widget.xml :linenos: :language: html -:download:`Download this script ` \ No newline at end of file +:download:`Download this script ` diff --git a/src/PythonAddons/doc/compoundVerticesFeature.rst b/src/PythonAddons/doc/compoundVerticesFeature.rst index 54168cc60..5e515e7cf 100644 --- a/src/PythonAddons/doc/compoundVerticesFeature.rst +++ b/src/PythonAddons/doc/compoundVerticesFeature.rst @@ -10,7 +10,7 @@ It allows creation of several points basing on XYZ coords file. .. warning:: Please note that it is better to limit yourself to create a maximum of 100 points. -These set of points will be grouped in a compound and can be used for others features. +These set of points will be grouped in a compound and can be used for others features. To add a new set of points: @@ -29,7 +29,7 @@ Select your points file and define a separator if it's different that " " in you Result """""" -A resulting compound will contain the points +A resulting compound will contain the points .. figure:: images/compoundVertices.png :align: center diff --git a/src/PythonAddons/doc/midSurfaceFeature.rst b/src/PythonAddons/doc/midSurfaceFeature.rst index 5ca04765f..0af981ed2 100644 --- a/src/PythonAddons/doc/midSurfaceFeature.rst +++ b/src/PythonAddons/doc/midSurfaceFeature.rst @@ -69,6 +69,3 @@ on obtient 4 surfaces indépendantes : :alt: Exemple de surfaces dans les solides Surfaces dans les solides - - - diff --git a/src/PythonAddons/doc/pipeNetworkFeature.rst b/src/PythonAddons/doc/pipeNetworkFeature.rst index 02a44595b..12b7e2772 100644 --- a/src/PythonAddons/doc/pipeNetworkFeature.rst +++ b/src/PythonAddons/doc/pipeNetworkFeature.rst @@ -101,5 +101,3 @@ Le pilotage en TUI se fait ainsi : :language: python :download:`Téléchargement du pilotage en TUI` - - diff --git a/src/PythonAddons/doc/rectangleFeature.rst b/src/PythonAddons/doc/rectangleFeature.rst index d47bd2158..0c64ffb23 100644 --- a/src/PythonAddons/doc/rectangleFeature.rst +++ b/src/PythonAddons/doc/rectangleFeature.rst @@ -14,4 +14,4 @@ Custom files for **Rectangle** feature are: File icon.png -The description of custom feature :ref:`create_sketch_rectangle` is given in Sketch plug-in. \ No newline at end of file +The description of custom feature :ref:`create_sketch_rectangle` is given in Sketch plug-in. diff --git a/src/PythonAddons/macros/midSurface/midSurface_1.stp b/src/PythonAddons/macros/midSurface/midSurface_1.stp index 252310c8a..a41d4aaf4 100644 --- a/src/PythonAddons/macros/midSurface/midSurface_1.stp +++ b/src/PythonAddons/macros/midSurface/midSurface_1.stp @@ -35,7 +35,7 @@ DATA; #24 = CARTESIAN_POINT('',(0.,0.,0.)); #25 = DIRECTION('',(0.,0.,1.)); #26 = DIRECTION('',(1.,0.,-0.)); -#27 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +#27 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#31)) GLOBAL_UNIT_ASSIGNED_CONTEXT( (#28,#29,#30)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); @@ -72,7 +72,7 @@ GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#31)) GLOBAL_UNIT_ASSIGNED_CONTEXT( #57 = AXIS2_PLACEMENT_2D('',#58,#59); #58 = CARTESIAN_POINT('',(0.,0.)); #59 = DIRECTION('',(1.,-0.)); -#60 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#60 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #61 = PCURVE('',#62,#67); @@ -86,7 +86,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #69 = CARTESIAN_POINT('',(0.,0.)); #70 = VECTOR('',#71,1.); #71 = DIRECTION('',(1.,0.)); -#72 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#72 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #73 = ADVANCED_FACE('',(#74),#62,.T.); @@ -108,7 +108,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #89 = CARTESIAN_POINT('',(0.,0.)); #90 = VECTOR('',#91,1.); #91 = DIRECTION('',(0.,1.)); -#92 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#92 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #93 = PCURVE('',#62,#94); @@ -117,7 +117,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #96 = CARTESIAN_POINT('',(6.28318530718,0.)); #97 = VECTOR('',#98,1.); #98 = DIRECTION('',(0.,1.)); -#99 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#99 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #100 = ORIENTED_EDGE('',*,*,#101,.F.); @@ -134,7 +134,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #111 = CARTESIAN_POINT('',(0.,0.5)); #112 = VECTOR('',#113,1.); #113 = DIRECTION('',(1.,0.)); -#114 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#114 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #115 = PCURVE('',#116,#121); @@ -148,7 +148,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #123 = AXIS2_PLACEMENT_2D('',#124,#125); #124 = CARTESIAN_POINT('',(0.,0.)); #125 = DIRECTION('',(1.,-0.)); -#126 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#126 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #127 = ORIENTED_EDGE('',*,*,#78,.F.); @@ -171,7 +171,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #144 = AXIS2_PLACEMENT_2D('',#145,#146); #145 = CARTESIAN_POINT('',(0.,0.)); #146 = DIRECTION('',(1.,-0.)); -#147 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#147 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #148 = PCURVE('',#149,#154); @@ -185,7 +185,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #156 = AXIS2_PLACEMENT_2D('',#157,#158); #157 = CARTESIAN_POINT('',(0.,0.)); #158 = DIRECTION('',(1.,-0.)); -#159 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#159 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #160 = FACE_BOUND('',#161,.F.); @@ -195,7 +195,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #164 = FACE_BOUND('',#165,.F.); #165 = EDGE_LOOP('',(#166)); #166 = ORIENTED_EDGE('',*,*,#132,.F.); -#167 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +#167 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#171)) GLOBAL_UNIT_ASSIGNED_CONTEXT ((#168,#169,#170)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); @@ -212,8 +212,8 @@ GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#171)) GLOBAL_UNIT_ASSIGNED_CONTEXT #177 = PRODUCT_CONTEXT('',#2,'mechanical'); #178 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #179 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#180,#182); -#180 = ( REPRESENTATION_RELATIONSHIP('','',#33,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#181) +#180 = ( REPRESENTATION_RELATIONSHIP('','',#33,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#181) SHAPE_REPRESENTATION_RELATIONSHIP() ); #181 = ITEM_DEFINED_TRANSFORMATION('','',#11,#15); #182 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item',#183 @@ -248,7 +248,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #210 = CARTESIAN_POINT('',(0.,0.)); #211 = VECTOR('',#212,1.); #212 = DIRECTION('',(0.,1.)); -#213 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#213 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #214 = PCURVE('',#203,#215); @@ -257,7 +257,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #217 = CARTESIAN_POINT('',(6.28318530718,0.)); #218 = VECTOR('',#219,1.); #219 = DIRECTION('',(0.,1.)); -#220 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#220 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #221 = ORIENTED_EDGE('',*,*,#222,.T.); @@ -274,7 +274,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #232 = CARTESIAN_POINT('',(0.,0.5)); #233 = VECTOR('',#234,1.); #234 = DIRECTION('',(1.,0.)); -#235 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#235 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #236 = PCURVE('',#237,#242); @@ -288,7 +288,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #244 = AXIS2_PLACEMENT_2D('',#245,#246); #245 = CARTESIAN_POINT('',(0.,0.)); #246 = DIRECTION('',(1.,-0.)); -#247 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#247 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #248 = ORIENTED_EDGE('',*,*,#192,.T.); @@ -308,7 +308,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #262 = CARTESIAN_POINT('',(0.,135.)); #263 = VECTOR('',#264,1.); #264 = DIRECTION('',(1.,0.)); -#265 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#265 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #266 = PCURVE('',#267,#272); @@ -322,7 +322,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #274 = AXIS2_PLACEMENT_2D('',#275,#276); #275 = CARTESIAN_POINT('',(-7.65,5.1)); #276 = DIRECTION('',(1.,0.)); -#277 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#277 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #278 = ORIENTED_EDGE('',*,*,#279,.T.); @@ -340,7 +340,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.5,150.0000204),.PIECEWISE_BEZIER_KNOTS.); #290 = CARTESIAN_POINT('',(6.183017886018,127.5)); #291 = CARTESIAN_POINT('',(6.183017886018,150.0000204)); -#292 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#292 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #293 = PCURVE('',#294,#299); @@ -354,7 +354,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.5,150.0000204),.PIECEWISE_BEZIER_KNOTS.); #301 = CARTESIAN_POINT('',(-7.5,43.094359292438)); #302 = CARTESIAN_POINT('',(15.0000204,43.094359292438)); -#303 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#303 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #304 = ORIENTED_EDGE('',*,*,#305,.F.); @@ -373,7 +373,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #317 = CARTESIAN_POINT('',(0.,150.)); #318 = VECTOR('',#319,1.); #319 = DIRECTION('',(1.,0.)); -#320 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#320 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #321 = PCURVE('',#322,#327); @@ -387,7 +387,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #329 = AXIS2_PLACEMENT_2D('',#330,#331); #330 = CARTESIAN_POINT('',(0.,0.)); #331 = DIRECTION('',(1.,-0.)); -#332 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#332 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #333 = ORIENTED_EDGE('',*,*,#334,.F.); @@ -405,7 +405,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.5,150.0000204),.PIECEWISE_BEZIER_KNOTS.); #345 = CARTESIAN_POINT('',(0.100167421162,127.5)); #346 = CARTESIAN_POINT('',(0.100167421162,150.0000204)); -#347 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#347 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #348 = PCURVE('',#349,#354); @@ -419,7 +419,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.5,150.0000204),.PIECEWISE_BEZIER_KNOTS.); #356 = CARTESIAN_POINT('',(-7.5,43.094359292438)); #357 = CARTESIAN_POINT('',(15.0000204,43.094359292438)); -#358 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#358 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #359 = ORIENTED_EDGE('',*,*,#360,.F.); @@ -436,7 +436,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #370 = CARTESIAN_POINT('',(0.,135.)); #371 = VECTOR('',#372,1.); #372 = DIRECTION('',(1.,0.)); -#373 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#373 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #374 = PCURVE('',#267,#375); @@ -445,7 +445,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #377 = AXIS2_PLACEMENT_2D('',#378,#379); #378 = CARTESIAN_POINT('',(-7.65,5.1)); #379 = DIRECTION('',(1.,0.)); -#380 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#380 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #381 = ADVANCED_FACE('',(#382),#267,.T.); @@ -466,7 +466,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #396 = CARTESIAN_POINT('',(0.,10.2)); #397 = VECTOR('',#398,1.); #398 = DIRECTION('',(1.,0.)); -#399 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#399 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #400 = PCURVE('',#349,#401); @@ -475,7 +475,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #403 = CARTESIAN_POINT('',(0.,0.)); #404 = VECTOR('',#405,1.); #405 = DIRECTION('',(0.,1.)); -#406 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#406 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #407 = ORIENTED_EDGE('',*,*,#408,.F.); @@ -494,7 +494,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #420 = AXIS2_PLACEMENT_2D('',#421,#422); #421 = CARTESIAN_POINT('',(-7.65,5.1)); #422 = DIRECTION('',(1.,0.)); -#423 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#423 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #424 = PCURVE('',#425,#430); @@ -508,7 +508,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #432 = CARTESIAN_POINT('',(0.,134.5)); #433 = VECTOR('',#434,1.); #434 = DIRECTION('',(1.,0.)); -#435 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#435 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #436 = ORIENTED_EDGE('',*,*,#437,.F.); @@ -527,7 +527,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #449 = AXIS2_PLACEMENT_2D('',#450,#451); #450 = CARTESIAN_POINT('',(-7.65,5.1)); #451 = DIRECTION('',(1.,0.)); -#452 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#452 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #453 = PCURVE('',#425,#454); @@ -536,7 +536,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #456 = CARTESIAN_POINT('',(0.,134.5)); #457 = VECTOR('',#458,1.); #458 = DIRECTION('',(1.,0.)); -#459 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#459 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #460 = ORIENTED_EDGE('',*,*,#461,.T.); @@ -552,7 +552,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #470 = CARTESIAN_POINT('',(0.,0.)); #471 = VECTOR('',#472,1.); #472 = DIRECTION('',(1.,0.)); -#473 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#473 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #474 = PCURVE('',#294,#475); @@ -561,7 +561,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #477 = CARTESIAN_POINT('',(0.,0.)); #478 = VECTOR('',#479,1.); #479 = DIRECTION('',(0.,1.)); -#480 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#480 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #481 = ORIENTED_EDGE('',*,*,#250,.T.); @@ -585,7 +585,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.,149.5000204),.PIECEWISE_BEZIER_KNOTS.); #499 = CARTESIAN_POINT('',(-7.5,42.59181525383)); #500 = CARTESIAN_POINT('',(15.0000204,42.59181525383)); -#501 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#501 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #502 = PCURVE('',#425,#503); @@ -594,7 +594,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.,149.5000204),.PIECEWISE_BEZIER_KNOTS.); #505 = CARTESIAN_POINT('',(0.101162558036,127.)); #506 = CARTESIAN_POINT('',(0.101162558036,149.5000204)); -#507 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#507 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #508 = ORIENTED_EDGE('',*,*,#509,.T.); @@ -610,7 +610,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #518 = CARTESIAN_POINT('',(15.,0.)); #519 = CARTESIAN_POINT('',(15.,43.35)); -#520 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#520 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #521 = PCURVE('',#322,#522); @@ -619,7 +619,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #524 = CARTESIAN_POINT('',(7.65,5.1)); #525 = CARTESIAN_POINT('',(51.,5.1)); -#526 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#526 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #527 = ORIENTED_EDGE('',*,*,#334,.F.); @@ -643,7 +643,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #545 = AXIS2_PLACEMENT_2D('',#546,#547); #546 = CARTESIAN_POINT('',(0.,0.)); #547 = DIRECTION('',(1.,-0.)); -#548 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#548 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #549 = PCURVE('',#425,#550); @@ -652,7 +652,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #552 = CARTESIAN_POINT('',(0.,149.5)); #553 = VECTOR('',#554,1.); #554 = DIRECTION('',(1.,0.)); -#555 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#555 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #556 = ORIENTED_EDGE('',*,*,#557,.T.); @@ -668,7 +668,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #566 = CARTESIAN_POINT('',(7.65,-5.1)); #567 = CARTESIAN_POINT('',(51.,-5.1)); -#568 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#568 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #569 = PCURVE('',#294,#570); @@ -677,7 +677,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #572 = CARTESIAN_POINT('',(15.,0.)); #573 = CARTESIAN_POINT('',(15.,43.35)); -#574 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#574 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #575 = ORIENTED_EDGE('',*,*,#305,.F.); @@ -698,7 +698,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.,149.5000204),.PIECEWISE_BEZIER_KNOTS.); #590 = CARTESIAN_POINT('',(-7.5,42.59181525383)); #591 = CARTESIAN_POINT('',(15.0000204,42.59181525383)); -#592 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#592 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #593 = PCURVE('',#425,#594); @@ -707,7 +707,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' (2,2),(127.,149.5000204),.PIECEWISE_BEZIER_KNOTS.); #596 = CARTESIAN_POINT('',(6.182022749144,127.)); #597 = CARTESIAN_POINT('',(6.182022749144,149.5000204)); -#598 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#598 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #599 = ORIENTED_EDGE('',*,*,#557,.T.); @@ -731,7 +731,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #617 = AXIS2_PLACEMENT_2D('',#618,#619); #618 = CARTESIAN_POINT('',(0.,0.)); #619 = DIRECTION('',(1.,-0.)); -#620 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#620 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #621 = PCURVE('',#425,#622); @@ -740,7 +740,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #624 = CARTESIAN_POINT('',(0.,0.)); #625 = VECTOR('',#626,1.); #626 = DIRECTION('',(1.,0.)); -#627 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#627 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #628 = FACE_BOUND('',#629,.T.); @@ -762,7 +762,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #644 = CARTESIAN_POINT('',(0.,0.)); #645 = VECTOR('',#646,1.); #646 = DIRECTION('',(0.,1.)); -#647 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#647 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #648 = PCURVE('',#425,#649); @@ -771,7 +771,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #651 = CARTESIAN_POINT('',(6.28318530718,0.)); #652 = VECTOR('',#653,1.); #653 = DIRECTION('',(0.,1.)); -#654 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#654 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #655 = ORIENTED_EDGE('',*,*,#605,.T.); @@ -781,7 +781,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #659 = ORIENTED_EDGE('',*,*,#533,.F.); #660 = ORIENTED_EDGE('',*,*,#488,.F.); #661 = ORIENTED_EDGE('',*,*,#408,.F.); -#662 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +#662 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#666)) GLOBAL_UNIT_ASSIGNED_CONTEXT ((#663,#664,#665)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); @@ -798,8 +798,8 @@ GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#666)) GLOBAL_UNIT_ASSIGNED_CONTEXT #672 = PRODUCT_CONTEXT('',#2,'mechanical'); #673 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #674 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#675,#677); -#675 = ( REPRESENTATION_RELATIONSHIP('','',#185,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#676) +#675 = ( REPRESENTATION_RELATIONSHIP('','',#185,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#676) SHAPE_REPRESENTATION_RELATIONSHIP() ); #676 = ITEM_DEFINED_TRANSFORMATION('','',#11,#19); #677 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item',#678 @@ -882,7 +882,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #747 = CARTESIAN_POINT('',(0.100426785688,9.503871251789E-02)); #748 = CARTESIAN_POINT('',(0.100167421162,4.751935620192E-02)); #749 = CARTESIAN_POINT('',(0.100167421162,0.)); -#750 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#750 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #751 = PCURVE('',#752,#757); @@ -896,7 +896,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #759 = AXIS2_PLACEMENT_2D('',#760,#761); #760 = CARTESIAN_POINT('',(15.,-7.65)); #761 = DIRECTION('',(1.,0.)); -#762 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#762 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #763 = ORIENTED_EDGE('',*,*,#764,.T.); @@ -915,7 +915,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #776 = CARTESIAN_POINT('',(0.,0.)); #777 = VECTOR('',#778,1.); #778 = DIRECTION('',(1.,0.)); -#779 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#779 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #780 = PCURVE('',#781,#786); @@ -929,7 +929,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #788 = AXIS2_PLACEMENT_2D('',#789,#790); #789 = CARTESIAN_POINT('',(0.,0.)); #790 = DIRECTION('',(1.,-0.)); -#791 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#791 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #792 = ORIENTED_EDGE('',*,*,#793,.F.); @@ -995,7 +995,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #846 = CARTESIAN_POINT('',(6.182758521491,9.503871251789E-02)); #847 = CARTESIAN_POINT('',(6.183017886018,4.751935620192E-02)); #848 = CARTESIAN_POINT('',(6.183017886018,0.)); -#849 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#849 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #850 = PCURVE('',#851,#856); @@ -1009,7 +1009,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #858 = AXIS2_PLACEMENT_2D('',#859,#860); #859 = CARTESIAN_POINT('',(15.,-7.65)); #860 = DIRECTION('',(1.,0.)); -#861 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#861 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #862 = ORIENTED_EDGE('',*,*,#863,.F.); @@ -1041,7 +1041,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #886 = CARTESIAN_POINT('',(5.762598258809,1.397325591087)); #887 = CARTESIAN_POINT('',(5.728036854313,1.393542045138)); #888 = CARTESIAN_POINT('',(5.695182703632,1.389527695651)); -#889 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#889 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #890 = PCURVE('',#891,#896); @@ -1055,7 +1055,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #898 = AXIS2_PLACEMENT_2D('',#899,#900); #899 = CARTESIAN_POINT('',(15.,-5.1)); #900 = DIRECTION('',(1.,0.)); -#901 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#901 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #902 = ORIENTED_EDGE('',*,*,#903,.T.); @@ -1074,7 +1074,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #915 = CARTESIAN_POINT('',(0.,-1.570796326795)); #916 = VECTOR('',#917,1.); #917 = DIRECTION('',(0.,1.)); -#918 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#918 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #919 = PCURVE('',#699,#920); @@ -1083,7 +1083,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #922 = CARTESIAN_POINT('',(6.28318530718,-1.570796326795)); #923 = VECTOR('',#924,1.); #924 = DIRECTION('',(0.,1.)); -#925 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#925 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #926 = ORIENTED_EDGE('',*,*,#903,.F.); @@ -1114,7 +1114,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #949 = CARTESIAN_POINT('',(9.540120695172E-02,1.419825310827)); #950 = CARTESIAN_POINT('',(4.770061558156E-02,1.420228054018)); #951 = CARTESIAN_POINT('',(1.614388188236E-15,1.420228054018)); -#952 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#952 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #953 = PCURVE('',#891,#954); @@ -1123,7 +1123,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #956 = AXIS2_PLACEMENT_2D('',#957,#958); #957 = CARTESIAN_POINT('',(15.,-5.1)); #958 = DIRECTION('',(1.,0.)); -#959 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#959 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #960 = ADVANCED_FACE('',(#961),#752,.F.); @@ -1147,7 +1147,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #978 = AXIS2_PLACEMENT_2D('',#979,#980); #979 = CARTESIAN_POINT('',(15.,-7.65)); #980 = DIRECTION('',(1.,0.)); -#981 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#981 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #982 = PCURVE('',#983,#988); @@ -1208,7 +1208,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1031 = CARTESIAN_POINT('',(0.10142390157,9.49270290968E-02)); #1032 = CARTESIAN_POINT('',(0.101162558036,4.74635144909E-02)); #1033 = CARTESIAN_POINT('',(0.101162558036,0.)); -#1034 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1034 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1035 = ORIENTED_EDGE('',*,*,#1036,.T.); @@ -1224,7 +1224,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1045 = CARTESIAN_POINT('',(0.,0.)); #1046 = VECTOR('',#1047,1.); #1047 = DIRECTION('',(1.,0.)); -#1048 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1048 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1049 = PCURVE('',#891,#1050); @@ -1233,7 +1233,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1052 = CARTESIAN_POINT('',(0.,-10.2)); #1053 = VECTOR('',#1054,1.); #1054 = DIRECTION('',(1.,0.)); -#1055 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1055 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1056 = ORIENTED_EDGE('',*,*,#687,.T.); @@ -1250,7 +1250,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' .F.,(2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #1067 = CARTESIAN_POINT('',(15.,0.)); #1068 = CARTESIAN_POINT('',(15.,43.35)); -#1069 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1069 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1070 = PCURVE('',#781,#1071); @@ -1259,7 +1259,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' .F.,(2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #1073 = CARTESIAN_POINT('',(7.65,5.1)); #1074 = CARTESIAN_POINT('',(51.,5.1)); -#1075 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1075 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1076 = ADVANCED_FACE('',(#1077),#891,.T.); @@ -1280,7 +1280,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1091 = CARTESIAN_POINT('',(0.,0.)); #1092 = VECTOR('',#1093,1.); #1093 = DIRECTION('',(1.,0.)); -#1094 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1094 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1095 = PCURVE('',#851,#1096); @@ -1289,7 +1289,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1098 = CARTESIAN_POINT('',(0.,0.)); #1099 = VECTOR('',#1100,1.); #1100 = DIRECTION('',(1.,0.)); -#1101 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1101 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1102 = ORIENTED_EDGE('',*,*,#1103,.F.); @@ -1308,7 +1308,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1115 = AXIS2_PLACEMENT_2D('',#1116,#1117); #1116 = CARTESIAN_POINT('',(15.,-5.1)); #1117 = DIRECTION('',(1.,0.)); -#1118 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1118 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1119 = PCURVE('',#983,#1120); @@ -1331,7 +1331,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1133 = CARTESIAN_POINT('',(5.762593981635,1.395589933234)); #1134 = CARTESIAN_POINT('',(5.72803454552,1.39176790089)); #1135 = CARTESIAN_POINT('',(5.695182703632,1.387712734649)); -#1136 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1136 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1137 = ORIENTED_EDGE('',*,*,#1138,.F.); @@ -1348,7 +1348,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1148 = AXIS2_PLACEMENT_2D('',#1149,#1150); #1149 = CARTESIAN_POINT('',(15.,-5.1)); #1150 = DIRECTION('',(1.,0.)); -#1151 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1151 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1152 = PCURVE('',#983,#1153); @@ -1371,7 +1371,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1166 = CARTESIAN_POINT('',(9.54045453125E-02,1.418318886065)); #1167 = CARTESIAN_POINT('',(4.770228477296E-02,1.41872573847)); #1168 = CARTESIAN_POINT('',(1.598194695534E-15,1.41872573847)); -#1169 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1169 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1170 = ORIENTED_EDGE('',*,*,#1036,.T.); @@ -1396,7 +1396,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1189 = AXIS2_PLACEMENT_2D('',#1190,#1191); #1190 = CARTESIAN_POINT('',(15.,-7.65)); #1191 = DIRECTION('',(1.,0.)); -#1192 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1192 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1193 = PCURVE('',#983,#1194); @@ -1452,7 +1452,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1237 = CARTESIAN_POINT('',(6.181761405609,9.49270290968E-02)); #1238 = CARTESIAN_POINT('',(6.182022749144,4.74635144909E-02)); #1239 = CARTESIAN_POINT('',(6.182022749144,0.)); -#1240 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1240 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1241 = ORIENTED_EDGE('',*,*,#1080,.T.); @@ -1470,7 +1470,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' .F.,(2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #1253 = CARTESIAN_POINT('',(15.,0.)); #1254 = CARTESIAN_POINT('',(15.,43.35)); -#1255 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1255 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1256 = PCURVE('',#781,#1257); @@ -1479,7 +1479,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' .F.,(2,2),(3.825,47.175),.PIECEWISE_BEZIER_KNOTS.); #1259 = CARTESIAN_POINT('',(7.65,-5.1)); #1260 = CARTESIAN_POINT('',(51.,-5.1)); -#1261 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1261 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1262 = ADVANCED_FACE('',(#1263),#781,.F.); @@ -1500,7 +1500,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1277 = AXIS2_PLACEMENT_2D('',#1278,#1279); #1278 = CARTESIAN_POINT('',(0.,0.)); #1279 = DIRECTION('',(1.,-0.)); -#1280 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1280 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1281 = PCURVE('',#983,#1282); @@ -1509,7 +1509,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1284 = CARTESIAN_POINT('',(0.,0.)); #1285 = VECTOR('',#1286,1.); #1286 = DIRECTION('',(1.,0.)); -#1287 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1287 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1288 = ORIENTED_EDGE('',*,*,#1244,.T.); @@ -1537,7 +1537,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1310 = CARTESIAN_POINT('',(0.,-1.570796326795)); #1311 = VECTOR('',#1312,1.); #1312 = DIRECTION('',(0.,1.)); -#1313 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1313 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1314 = PCURVE('',#983,#1315); @@ -1546,13 +1546,13 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1317 = CARTESIAN_POINT('',(6.28318530718,-1.570796326795)); #1318 = VECTOR('',#1319,1.); #1319 = DIRECTION('',(0.,1.)); -#1320 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1320 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1321 = ORIENTED_EDGE('',*,*,#1298,.F.); #1322 = ORIENTED_EDGE('',*,*,#1138,.F.); -#1323 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#1327)) +#1323 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#1327)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#1324,#1325,#1326)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #1324 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -1568,8 +1568,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#1324,#1325,#1326)) REPRESENTATION_CONTEXT #1333 = PRODUCT_CONTEXT('',#2,'mechanical'); #1334 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #1335 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#1336,#1338); -#1336 = ( REPRESENTATION_RELATIONSHIP('','',#680,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#1337) +#1336 = ( REPRESENTATION_RELATIONSHIP('','',#680,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#1337) SHAPE_REPRESENTATION_RELATIONSHIP() ); #1337 = ITEM_DEFINED_TRANSFORMATION('','',#11,#23); #1338 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', diff --git a/src/PythonAddons/macros/midSurface/midSurface_2.stp b/src/PythonAddons/macros/midSurface/midSurface_2.stp index 67838bf3a..c146f6aff 100644 --- a/src/PythonAddons/macros/midSurface/midSurface_2.stp +++ b/src/PythonAddons/macros/midSurface/midSurface_2.stp @@ -68,7 +68,7 @@ DATA; #56 = CARTESIAN_POINT('',(0.,0.,0.)); #57 = DIRECTION('',(0.,0.,1.)); #58 = DIRECTION('',(1.,0.,-0.)); -#59 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +#59 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#63)) GLOBAL_UNIT_ASSIGNED_CONTEXT( (#60,#61,#62)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); @@ -111,7 +111,7 @@ GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#63)) GLOBAL_UNIT_ASSIGNED_CONTEXT( #91 = CARTESIAN_POINT('',(-0.,-0.)); #92 = VECTOR('',#93,1.); #93 = DIRECTION('',(-1.,-0.)); -#94 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#94 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #95 = PCURVE('',#96,#101); @@ -126,7 +126,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #103 = AXIS2_PLACEMENT_2D('',#104,#105); #104 = CARTESIAN_POINT('',(0.,0.)); #105 = DIRECTION('',(1.,0.)); -#106 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#106 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #107 = ORIENTED_EDGE('',*,*,#108,.T.); @@ -152,7 +152,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #123 = CARTESIAN_POINT('',(-6.05385106334,-14.74808961316)); #124 = CARTESIAN_POINT('',(-6.024573659209,-19.25418595849)); #125 = CARTESIAN_POINT('',(-5.993565325336,-23.5608428516)); -#126 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#126 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #127 = PCURVE('',#128,#133); @@ -167,7 +167,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #135 = AXIS2_PLACEMENT_2D('',#136,#137); #136 = CARTESIAN_POINT('',(-44.82960644807,-497.9013836235)); #137 = DIRECTION('',(8.782283631556E-02,0.996136109887)); -#138 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#138 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #139 = ORIENTED_EDGE('',*,*,#140,.F.); @@ -220,7 +220,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #179 = CARTESIAN_POINT('',(-5.842848153556,-19.00885839921)); #180 = CARTESIAN_POINT('',(-6.062196625275,-19.66109817846)); #181 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#182 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#182 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #183 = PCURVE('',#184,#189); @@ -235,7 +235,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #191 = AXIS2_PLACEMENT_2D('',#192,#193); #192 = CARTESIAN_POINT('',(-3.330669073875E-16,3.030292448132)); #193 = DIRECTION('',(-5.551115123126E-17,-1.)); -#194 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#194 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #195 = ORIENTED_EDGE('',*,*,#196,.T.); @@ -258,7 +258,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #209 = CARTESIAN_POINT('',(-5.412285107933,-9.76578427471)); #210 = CARTESIAN_POINT('',(-5.464703483303,-5.054169837669)); #211 = CARTESIAN_POINT('',(-5.514500089542,-3.31266545726E-13)); -#212 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#212 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #213 = PCURVE('',#214,#219); @@ -273,7 +273,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #221 = AXIS2_PLACEMENT_2D('',#222,#223); #222 = CARTESIAN_POINT('',(109.27270025172,-900.7312900925)); #223 = DIRECTION('',(-8.782283631556E-02,0.996136109887)); -#224 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#224 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #225 = ADVANCED_FACE('',(#226),#96,.F.); @@ -297,7 +297,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #241 = CARTESIAN_POINT('',(4.150702186867,6.161296528855)); #242 = VECTOR('',#243,1.); #243 = DIRECTION('',(-0.862679176789,0.50575155752)); -#244 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#244 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #245 = PCURVE('',#128,#246); @@ -306,7 +306,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #248 = CARTESIAN_POINT('',(-2.135385180448,-18.93010208569)); #249 = VECTOR('',#250,1.); #250 = DIRECTION('',(-0.996136109887,8.782283631556E-02)); -#251 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#251 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #252 = ORIENTED_EDGE('',*,*,#253,.F.); @@ -327,7 +327,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #265 = AXIS2_PLACEMENT_2D('',#266,#267); #266 = CARTESIAN_POINT('',(0.,0.)); #267 = DIRECTION('',(1.,0.)); -#268 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#268 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #269 = PCURVE('',#270,#275); @@ -342,7 +342,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #277 = CARTESIAN_POINT('',(-0.,-0.)); #278 = VECTOR('',#279,1.); #279 = DIRECTION('',(-1.,-0.)); -#280 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#280 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #281 = ORIENTED_EDGE('',*,*,#282,.T.); @@ -359,7 +359,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #291 = CARTESIAN_POINT('',(10.441536996445,-11.59691219543)); #292 = VECTOR('',#293,1.); #293 = DIRECTION('',(0.862679176789,-0.50575155752)); -#294 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#294 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #295 = PCURVE('',#214,#296); @@ -368,7 +368,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #298 = CARTESIAN_POINT('',(16.871354838974,-22.0137826693)); #299 = VECTOR('',#300,1.); #300 = DIRECTION('',(-0.996136109887,-8.782283631556E-02)); -#301 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#301 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #302 = ADVANCED_FACE('',(#303),#214,.T.); @@ -392,7 +392,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #318 = CARTESIAN_POINT('',(-1.06581410364E-14,-40.)); #319 = VECTOR('',#320,1.); #320 = DIRECTION('',(1.,1.110223024625E-16)); -#321 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#321 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #322 = PCURVE('',#184,#323); @@ -401,7 +401,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #325 = CARTESIAN_POINT('',(25.052558883258,-19.85640646055)); #326 = VECTOR('',#327,1.); #327 = DIRECTION('',(-0.866025403784,0.5)); -#328 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#328 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #329 = ORIENTED_EDGE('',*,*,#330,.T.); @@ -419,7 +419,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #340 = AXIS2_PLACEMENT_2D('',#341,#342); #341 = CARTESIAN_POINT('',(102.8899493578,-828.3345318848)); #342 = DIRECTION('',(-8.782283631556E-02,0.996136109887)); -#343 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#343 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #344 = PCURVE('',#270,#345); @@ -433,7 +433,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #350 = CARTESIAN_POINT('',(-5.365122964016,-10.09727912145)); #351 = CARTESIAN_POINT('',(-5.428068982643,-5.261936178707)); #352 = CARTESIAN_POINT('',(-5.487401342306,-3.318426614577E-13)); -#353 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#353 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #354 = ORIENTED_EDGE('',*,*,#282,.T.); @@ -457,7 +457,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #370 = CARTESIAN_POINT('',(6.,5.)); #371 = VECTOR('',#372,1.); #372 = DIRECTION('',(0.866025403784,-0.5)); -#373 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#373 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #374 = PCURVE('',#128,#375); @@ -466,7 +466,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #377 = CARTESIAN_POINT('',(1.06581410364E-14,-40.)); #378 = VECTOR('',#379,1.); #379 = DIRECTION('',(1.,-1.110223024625E-16)); -#380 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#380 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #381 = ORIENTED_EDGE('',*,*,#382,.F.); @@ -485,7 +485,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #392 = AXIS2_PLACEMENT_2D('',#393,#394); #393 = CARTESIAN_POINT('',(-1.998401444325E-15,3.090026406575)); #394 = DIRECTION('',(-5.551115123126E-17,-1.)); -#395 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#395 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #396 = PCURVE('',#270,#397); @@ -525,7 +525,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #426 = CARTESIAN_POINT('',(-5.842848153556,-19.16530193861)); #427 = CARTESIAN_POINT('',(-6.062196625275,-19.73903071256)); #428 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#429 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#429 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #430 = ORIENTED_EDGE('',*,*,#307,.F.); @@ -548,7 +548,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #446 = AXIS2_PLACEMENT_2D('',#447,#448); #447 = CARTESIAN_POINT('',(-38.44685555415,-425.5046254159)); #448 = DIRECTION('',(8.782283631556E-02,0.996136109887)); -#449 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#449 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #450 = PCURVE('',#270,#451); @@ -562,7 +562,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #456 = CARTESIAN_POINT('',(-6.092971844708,-14.93059980413)); #457 = CARTESIAN_POINT('',(-6.061146857907,-19.44806554494)); #458 = CARTESIAN_POINT('',(-6.027155923212,-23.74318137502)); -#459 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#459 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #460 = ORIENTED_EDGE('',*,*,#359,.T.); @@ -575,7 +575,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #467 = ORIENTED_EDGE('',*,*,#436,.T.); #468 = ORIENTED_EDGE('',*,*,#382,.F.); #469 = ORIENTED_EDGE('',*,*,#330,.T.); -#470 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +#470 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#474)) GLOBAL_UNIT_ASSIGNED_CONTEXT ((#471,#472,#473)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); @@ -592,8 +592,8 @@ GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#474)) GLOBAL_UNIT_ASSIGNED_CONTEXT #480 = PRODUCT_CONTEXT('',#2,'mechanical'); #481 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #482 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#483,#485); -#483 = ( REPRESENTATION_RELATIONSHIP('','',#65,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#484) +#483 = ( REPRESENTATION_RELATIONSHIP('','',#65,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#484) SHAPE_REPRESENTATION_RELATIONSHIP() ); #484 = ITEM_DEFINED_TRANSFORMATION('','',#11,#15); #485 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item',#486 @@ -633,7 +633,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #514 = CARTESIAN_POINT('',(-0.,-0.)); #515 = VECTOR('',#516,1.); #516 = DIRECTION('',(-1.,-0.)); -#517 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#517 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #518 = PCURVE('',#519,#524); @@ -648,7 +648,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #526 = AXIS2_PLACEMENT_2D('',#527,#528); #527 = CARTESIAN_POINT('',(0.,0.)); #528 = DIRECTION('',(1.,0.)); -#529 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#529 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #530 = ORIENTED_EDGE('',*,*,#531,.T.); @@ -674,7 +674,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #546 = CARTESIAN_POINT('',(-5.057075027595,-13.72846143143)); #547 = CARTESIAN_POINT('',(-5.071789553271,-17.81475934112)); #548 = CARTESIAN_POINT('',(-5.087264869104,-21.68152980932)); -#549 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#549 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #550 = PCURVE('',#551,#556); @@ -690,7 +690,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #558 = AXIS2_PLACEMENT_2D('',#559,#560); #559 = CARTESIAN_POINT('',(-29.69418778058,-138.1769303614)); #560 = DIRECTION('',(0.173648177667,0.984807753012)); -#561 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#561 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #562 = ORIENTED_EDGE('',*,*,#563,.F.); @@ -743,7 +743,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #602 = CARTESIAN_POINT('',(-5.842848153556,-19.00885839921)); #603 = CARTESIAN_POINT('',(-6.062196625275,-19.66109817846)); #604 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#605 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#605 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #606 = PCURVE('',#607,#612); @@ -758,7 +758,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #614 = AXIS2_PLACEMENT_2D('',#615,#616); #615 = CARTESIAN_POINT('',(-3.330669073875E-16,3.030292448132)); #616 = DIRECTION('',(-5.551115123126E-17,-1.)); -#617 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#617 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #618 = ORIENTED_EDGE('',*,*,#619,.F.); @@ -781,7 +781,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #632 = CARTESIAN_POINT('',(-4.367702933175,-13.72846143143)); #633 = CARTESIAN_POINT('',(-4.352988407498,-17.81475934112)); #634 = CARTESIAN_POINT('',(-4.337513091665,-21.68152980932)); -#635 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#635 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #636 = PCURVE('',#637,#642); @@ -797,7 +797,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #644 = AXIS2_PLACEMENT_2D('',#645,#646); #645 = CARTESIAN_POINT('',(-29.69418778058,-138.1769303614)); #646 = DIRECTION('',(0.173648177667,0.984807753012)); -#647 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#647 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #648 = ADVANCED_FACE('',(#649),#519,.F.); @@ -821,7 +821,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #664 = CARTESIAN_POINT('',(6.,-2.62444709642)); #665 = VECTOR('',#666,1.); #666 = DIRECTION('',(0.,1.)); -#667 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#667 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #668 = PCURVE('',#551,#669); @@ -830,7 +830,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #671 = CARTESIAN_POINT('',(-6.271830612626,-20.45573045567)); #672 = VECTOR('',#673,1.); #673 = DIRECTION('',(-0.984807753012,0.173648177667)); -#674 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#674 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #675 = ORIENTED_EDGE('',*,*,#676,.F.); @@ -851,7 +851,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #688 = AXIS2_PLACEMENT_2D('',#689,#690); #689 = CARTESIAN_POINT('',(0.,0.)); #690 = DIRECTION('',(1.,0.)); -#691 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#691 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #692 = PCURVE('',#693,#698); @@ -866,7 +866,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #700 = CARTESIAN_POINT('',(-0.,-0.)); #701 = VECTOR('',#702,1.); #702 = DIRECTION('',(-1.,-0.)); -#703 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#703 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #704 = ORIENTED_EDGE('',*,*,#705,.F.); @@ -883,7 +883,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #714 = CARTESIAN_POINT('',(-6.,-2.62444709642)); #715 = VECTOR('',#716,1.); #716 = DIRECTION('',(0.,1.)); -#717 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#717 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #718 = PCURVE('',#637,#719); @@ -892,7 +892,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #721 = CARTESIAN_POINT('',(-6.271830612626,-20.45573045567)); #722 = VECTOR('',#723,1.); #723 = DIRECTION('',(-0.984807753012,0.173648177667)); -#724 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#724 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #725 = ADVANCED_FACE('',(#726),#637,.F.); @@ -916,7 +916,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #741 = AXIS2_PLACEMENT_2D('',#742,#743); #742 = CARTESIAN_POINT('',(-27.61040964857,-126.3592373253)); #743 = DIRECTION('',(0.173648177667,0.984807753012)); -#744 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#744 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #745 = PCURVE('',#693,#746); @@ -930,7 +930,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #751 = CARTESIAN_POINT('',(-4.320263097955,-14.1150335334)); #752 = CARTESIAN_POINT('',(-4.300743183741,-18.22706269479)); #753 = CARTESIAN_POINT('',(-4.280064947432,-22.07748333665)); -#754 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#754 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #755 = ORIENTED_EDGE('',*,*,#756,.T.); @@ -948,7 +948,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #765 = CARTESIAN_POINT('',(1.7763568394E-15,-40.)); #766 = VECTOR('',#767,1.); #767 = DIRECTION('',(1.,0.)); -#768 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#768 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #769 = PCURVE('',#607,#770); @@ -957,7 +957,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #772 = CARTESIAN_POINT('',(-6.,-8.856406460551)); #773 = VECTOR('',#774,1.); #774 = DIRECTION('',(-5.551115123126E-17,-1.)); -#775 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#775 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #776 = ORIENTED_EDGE('',*,*,#619,.F.); @@ -984,7 +984,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #794 = AXIS2_PLACEMENT_2D('',#795,#796); #795 = CARTESIAN_POINT('',(-1.998401444325E-15,3.090026406575)); #796 = DIRECTION('',(-5.551115123126E-17,-1.)); -#797 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#797 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #798 = PCURVE('',#693,#799); @@ -1024,7 +1024,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #828 = CARTESIAN_POINT('',(-5.842848153556,-19.16530193861)); #829 = CARTESIAN_POINT('',(-6.062196625275,-19.73903071256)); #830 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#831 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#831 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #832 = ORIENTED_EDGE('',*,*,#756,.T.); @@ -1044,7 +1044,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #844 = CARTESIAN_POINT('',(6.,-8.856406460551)); #845 = VECTOR('',#846,1.); #846 = DIRECTION('',(-5.551115123126E-17,-1.)); -#847 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#847 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #848 = PCURVE('',#551,#849); @@ -1053,7 +1053,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #851 = CARTESIAN_POINT('',(3.552713678801E-15,-40.)); #852 = VECTOR('',#853,1.); #853 = DIRECTION('',(1.,0.)); -#854 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#854 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #855 = ADVANCED_FACE('',(#856),#551,.T.); @@ -1074,7 +1074,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #869 = AXIS2_PLACEMENT_2D('',#870,#871); #870 = CARTESIAN_POINT('',(-27.61040964857,-126.3592373253)); #871 = DIRECTION('',(0.173648177667,0.984807753012)); -#872 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#872 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #873 = PCURVE('',#693,#874); @@ -1088,7 +1088,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #879 = CARTESIAN_POINT('',(-5.104514862814,-14.1150335334)); #880 = CARTESIAN_POINT('',(-5.124034777029,-18.22706269479)); #881 = CARTESIAN_POINT('',(-5.144713013337,-22.07748333665)); -#882 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#882 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #883 = ORIENTED_EDGE('',*,*,#835,.T.); @@ -1101,7 +1101,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #890 = ORIENTED_EDGE('',*,*,#859,.T.); #891 = ORIENTED_EDGE('',*,*,#782,.F.); #892 = ORIENTED_EDGE('',*,*,#729,.F.); -#893 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +#893 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#897)) GLOBAL_UNIT_ASSIGNED_CONTEXT ((#894,#895,#896)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); @@ -1118,8 +1118,8 @@ GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#897)) GLOBAL_UNIT_ASSIGNED_CONTEXT #903 = PRODUCT_CONTEXT('',#2,'mechanical'); #904 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #905 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#906,#908); -#906 = ( REPRESENTATION_RELATIONSHIP('','',#488,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#907) +#906 = ( REPRESENTATION_RELATIONSHIP('','',#488,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#907) SHAPE_REPRESENTATION_RELATIONSHIP() ); #907 = ITEM_DEFINED_TRANSFORMATION('','',#11,#19); #908 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item',#909 @@ -1164,7 +1164,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #940 = CARTESIAN_POINT('',(-3.370926897429,-14.74808961316)); #941 = CARTESIAN_POINT('',(-3.40020430156,-19.25418595849)); #942 = CARTESIAN_POINT('',(-3.431212635434,-23.5608428516)); -#943 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#943 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #944 = PCURVE('',#945,#950); @@ -1179,7 +1179,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #952 = AXIS2_PLACEMENT_2D('',#953,#954); #953 = CARTESIAN_POINT('',(-44.82960644807,-497.9013836235)); #954 = DIRECTION('',(8.782283631556E-02,0.996136109887)); -#955 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#955 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #956 = ORIENTED_EDGE('',*,*,#957,.T.); @@ -1200,7 +1200,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #969 = CARTESIAN_POINT('',(-0.,-0.)); #970 = VECTOR('',#971,1.); #971 = DIRECTION('',(-1.,-0.)); -#972 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#972 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #973 = PCURVE('',#974,#979); @@ -1215,7 +1215,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #981 = AXIS2_PLACEMENT_2D('',#982,#983); #982 = CARTESIAN_POINT('',(0.,0.)); #983 = DIRECTION('',(1.,0.)); -#984 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#984 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #985 = ORIENTED_EDGE('',*,*,#986,.F.); @@ -1241,7 +1241,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1001 = CARTESIAN_POINT('',(-4.012492852837,-9.76578427471)); #1002 = CARTESIAN_POINT('',(-3.960074477467,-5.054169837669)); #1003 = CARTESIAN_POINT('',(-3.910277871227,-3.31266545726E-13)); -#1004 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1004 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1005 = PCURVE('',#1006,#1011); @@ -1256,7 +1256,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1013 = AXIS2_PLACEMENT_2D('',#1014,#1015); #1014 = CARTESIAN_POINT('',(109.27270025172,-900.7312900925)); #1015 = DIRECTION('',(-8.782283631556E-02,0.996136109887)); -#1016 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1016 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1017 = ORIENTED_EDGE('',*,*,#1018,.F.); @@ -1307,7 +1307,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1055 = CARTESIAN_POINT('',(-5.842848153556,-19.00885839921)); #1056 = CARTESIAN_POINT('',(-6.062196625275,-19.66109817846)); #1057 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#1058 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1058 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1059 = PCURVE('',#1060,#1065); @@ -1322,7 +1322,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1067 = AXIS2_PLACEMENT_2D('',#1068,#1069); #1068 = CARTESIAN_POINT('',(-3.330669073875E-16,3.030292448132)); #1069 = DIRECTION('',(-5.551115123126E-17,-1.)); -#1070 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1070 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1071 = ADVANCED_FACE('',(#1072),#945,.F.); @@ -1349,7 +1349,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1089 = AXIS2_PLACEMENT_2D('',#1090,#1091); #1090 = CARTESIAN_POINT('',(-38.44685555415,-425.5046254159)); #1091 = DIRECTION('',(8.782283631556E-02,0.996136109887)); -#1092 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1092 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1093 = PCURVE('',#1094,#1099); @@ -1369,7 +1369,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1104 = CARTESIAN_POINT('',(-3.331806116062,-14.93059980413)); #1105 = CARTESIAN_POINT('',(-3.363631102863,-19.44806554494)); #1106 = CARTESIAN_POINT('',(-3.397622037557,-23.74318137502)); -#1107 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1107 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1108 = ORIENTED_EDGE('',*,*,#1109,.T.); @@ -1386,7 +1386,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1118 = CARTESIAN_POINT('',(8.881784197001E-16,-40.)); #1119 = VECTOR('',#1120,1.); #1120 = DIRECTION('',(1.,2.775557561563E-17)); -#1121 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1121 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1122 = PCURVE('',#1060,#1123); @@ -1395,7 +1395,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1125 = CARTESIAN_POINT('',(-6.,5.)); #1126 = VECTOR('',#1127,1.); #1127 = DIRECTION('',(-0.866025403784,-0.5)); -#1128 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1128 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1129 = ORIENTED_EDGE('',*,*,#918,.F.); @@ -1413,7 +1413,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1140 = CARTESIAN_POINT('',(-2.135385180448,-18.93010208569)); #1141 = VECTOR('',#1142,1.); #1142 = DIRECTION('',(-0.996136109887,8.782283631556E-02)); -#1143 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1143 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1144 = PCURVE('',#974,#1145); @@ -1422,7 +1422,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1147 = CARTESIAN_POINT('',(-4.150702186867,6.161296528855)); #1148 = VECTOR('',#1149,1.); #1149 = DIRECTION('',(0.862679176789,0.50575155752)); -#1150 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1150 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1151 = ADVANCED_FACE('',(#1152),#1060,.T.); @@ -1447,7 +1447,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1167 = AXIS2_PLACEMENT_2D('',#1168,#1169); #1168 = CARTESIAN_POINT('',(-1.998401444325E-15,3.090026406575)); #1169 = DIRECTION('',(-5.551115123126E-17,-1.)); -#1170 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1170 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1171 = PCURVE('',#1094,#1172); @@ -1488,7 +1488,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1201 = CARTESIAN_POINT('',(-5.842848153556,-19.16530193861)); #1202 = CARTESIAN_POINT('',(-6.062196625275,-19.73903071256)); #1203 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#1204 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1204 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1205 = ORIENTED_EDGE('',*,*,#1109,.T.); @@ -1507,7 +1507,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1217 = CARTESIAN_POINT('',(-25.05255888325,-19.85640646055)); #1218 = VECTOR('',#1219,1.); #1219 = DIRECTION('',(0.866025403784,0.5)); -#1220 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1220 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1221 = PCURVE('',#1006,#1222); @@ -1516,7 +1516,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1224 = CARTESIAN_POINT('',(-4.884981308351E-15,-40.)); #1225 = VECTOR('',#1226,1.); #1226 = DIRECTION('',(1.,2.775557561563E-17)); -#1227 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1227 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1228 = ADVANCED_FACE('',(#1229),#1006,.F.); @@ -1542,7 +1542,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1246 = AXIS2_PLACEMENT_2D('',#1247,#1248); #1247 = CARTESIAN_POINT('',(102.8899493578,-828.3345318848)); #1248 = DIRECTION('',(-8.782283631556E-02,0.996136109887)); -#1249 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1249 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1250 = PCURVE('',#1094,#1251); @@ -1556,7 +1556,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1256 = CARTESIAN_POINT('',(-4.059654996753,-10.09727912145)); #1257 = CARTESIAN_POINT('',(-3.996708978126,-5.261936178707)); #1258 = CARTESIAN_POINT('',(-3.937376618463,-3.318426614577E-13)); -#1259 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1259 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1260 = ORIENTED_EDGE('',*,*,#1261,.T.); @@ -1573,7 +1573,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1270 = CARTESIAN_POINT('',(16.871354838974,-22.0137826693)); #1271 = VECTOR('',#1272,1.); #1272 = DIRECTION('',(-0.996136109887,-8.782283631556E-02)); -#1273 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1273 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1274 = PCURVE('',#974,#1275); @@ -1582,7 +1582,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1277 = CARTESIAN_POINT('',(-10.44153699644,-11.59691219543)); #1278 = VECTOR('',#1279,1.); #1279 = DIRECTION('',(-0.862679176789,-0.50575155752)); -#1280 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1280 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1281 = ADVANCED_FACE('',(#1282),#974,.F.); @@ -1606,7 +1606,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1298 = AXIS2_PLACEMENT_2D('',#1299,#1300); #1299 = CARTESIAN_POINT('',(0.,0.)); #1300 = DIRECTION('',(1.,0.)); -#1301 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1301 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1302 = PCURVE('',#1094,#1303); @@ -1615,7 +1615,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1305 = CARTESIAN_POINT('',(-0.,-0.)); #1306 = VECTOR('',#1307,1.); #1307 = DIRECTION('',(-1.,-0.)); -#1308 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1308 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1309 = ADVANCED_FACE('',(#1310),#1094,.F.); @@ -1625,8 +1625,8 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1313 = ORIENTED_EDGE('',*,*,#1288,.T.); #1314 = ORIENTED_EDGE('',*,*,#1234,.F.); #1315 = ORIENTED_EDGE('',*,*,#1155,.F.); -#1316 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#1320)) +#1316 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#1320)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#1317,#1318,#1319)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #1317 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -1642,8 +1642,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#1317,#1318,#1319)) REPRESENTATION_CONTEXT #1326 = PRODUCT_CONTEXT('',#2,'mechanical'); #1327 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #1328 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#1329,#1331); -#1329 = ( REPRESENTATION_RELATIONSHIP('','',#911,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#1330) +#1329 = ( REPRESENTATION_RELATIONSHIP('','',#911,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#1330) SHAPE_REPRESENTATION_RELATIONSHIP() ); #1330 = ITEM_DEFINED_TRANSFORMATION('','',#11,#23); #1331 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -1689,7 +1689,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #1364 = CARTESIAN_POINT('',(-1.23839633391,-10.0150231721)); #1365 = CARTESIAN_POINT('',(-1.252598005958,-5.153434009021)); #1366 = CARTESIAN_POINT('',(-1.266103672779,5.761157316974E-16)); -#1367 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1367 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1368 = PCURVE('',#1369,#1374); @@ -1705,7 +1705,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1376 = AXIS2_PLACEMENT_2D('',#1377,#1378); #1377 = CARTESIAN_POINT('',(13.090421910244,-138.1769303614)); #1378 = DIRECTION('',(0.173648177667,0.984807753012)); -#1379 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1379 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1380 = ORIENTED_EDGE('',*,*,#1381,.T.); @@ -1726,7 +1726,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1393 = CARTESIAN_POINT('',(-0.,-0.)); #1394 = VECTOR('',#1395,1.); #1395 = DIRECTION('',(-1.,-0.)); -#1396 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1396 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1397 = PCURVE('',#1398,#1403); @@ -1741,7 +1741,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1405 = AXIS2_PLACEMENT_2D('',#1406,#1407); #1406 = CARTESIAN_POINT('',(0.,0.)); #1407 = DIRECTION('',(1.,0.)); -#1408 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1408 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1409 = ORIENTED_EDGE('',*,*,#1410,.F.); @@ -1768,7 +1768,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1426 = CARTESIAN_POINT('',(-1.90319631968,-10.0150231721)); #1427 = CARTESIAN_POINT('',(-1.888994647632,-5.153434009021)); #1428 = CARTESIAN_POINT('',(-1.87548898081,5.761157316974E-16)); -#1429 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1429 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1430 = PCURVE('',#1431,#1436); @@ -1784,7 +1784,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1438 = AXIS2_PLACEMENT_2D('',#1439,#1440); #1439 = CARTESIAN_POINT('',(13.090421910244,-138.1769303614)); #1440 = DIRECTION('',(0.173648177667,0.984807753012)); -#1441 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1441 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1442 = ORIENTED_EDGE('',*,*,#1443,.F.); @@ -1835,7 +1835,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1480 = CARTESIAN_POINT('',(-5.842848153556,-19.00885839921)); #1481 = CARTESIAN_POINT('',(-6.062196625275,-19.66109817846)); #1482 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#1483 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1483 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1484 = PCURVE('',#1485,#1490); @@ -1850,7 +1850,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1492 = AXIS2_PLACEMENT_2D('',#1493,#1494); #1493 = CARTESIAN_POINT('',(-3.330669073875E-16,3.030292448132)); #1494 = DIRECTION('',(-5.551115123126E-17,-1.)); -#1495 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1495 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1496 = ADVANCED_FACE('',(#1497),#1369,.T.); @@ -1875,7 +1875,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1512 = CARTESIAN_POINT('',(1.7763568394E-15,-40.)); #1513 = VECTOR('',#1514,1.); #1514 = DIRECTION('',(1.,0.)); -#1515 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1515 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1516 = PCURVE('',#1485,#1517); @@ -1884,7 +1884,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1519 = CARTESIAN_POINT('',(6.,33.928203230275)); #1520 = VECTOR('',#1521,1.); #1521 = DIRECTION('',(-5.551115123126E-17,-1.)); -#1522 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1522 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1523 = ORIENTED_EDGE('',*,*,#1524,.T.); @@ -1905,7 +1905,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1536 = AXIS2_PLACEMENT_2D('',#1537,#1538); #1537 = CARTESIAN_POINT('',(15.174200042247,-126.3592373253)); #1538 = DIRECTION('',(0.173648177667,0.984807753012)); -#1539 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1539 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1540 = PCURVE('',#1541,#1546); @@ -1926,7 +1926,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1552 = CARTESIAN_POINT('',(-1.196030215426,-10.03493273927)); #1553 = CARTESIAN_POINT('',(-1.213983856016,-5.18552691579)); #1554 = CARTESIAN_POINT('',(-1.230959417341,1.325066182904E-14)); -#1555 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1555 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1556 = ORIENTED_EDGE('',*,*,#1557,.T.); @@ -1943,7 +1943,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1566 = CARTESIAN_POINT('',(15.765531153075,-16.79743087102)); #1567 = VECTOR('',#1568,1.); #1568 = DIRECTION('',(-0.984807753012,0.173648177667)); -#1569 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1569 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1570 = PCURVE('',#1398,#1571); @@ -1952,7 +1952,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1573 = CARTESIAN_POINT('',(6.,18.442860570144)); #1574 = VECTOR('',#1575,1.); #1575 = DIRECTION('',(0.,1.)); -#1576 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1576 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1577 = ADVANCED_FACE('',(#1578),#1485,.T.); @@ -1977,7 +1977,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1593 = CARTESIAN_POINT('',(-6.,33.928203230275)); #1594 = VECTOR('',#1595,1.); #1595 = DIRECTION('',(-5.551115123126E-17,-1.)); -#1596 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1596 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1597 = PCURVE('',#1431,#1598); @@ -1986,7 +1986,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1600 = CARTESIAN_POINT('',(5.329070518201E-15,-40.)); #1601 = VECTOR('',#1602,1.); #1602 = DIRECTION('',(1.,0.)); -#1603 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1603 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1604 = ORIENTED_EDGE('',*,*,#1605,.F.); @@ -2005,7 +2005,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1615 = AXIS2_PLACEMENT_2D('',#1616,#1617); #1616 = CARTESIAN_POINT('',(-1.998401444325E-15,3.090026406575)); #1617 = DIRECTION('',(-5.551115123126E-17,-1.)); -#1618 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1618 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1619 = PCURVE('',#1541,#1620); @@ -2046,7 +2046,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1649 = CARTESIAN_POINT('',(-5.842848153556,-19.16530193861)); #1650 = CARTESIAN_POINT('',(-6.062196625275,-19.73903071256)); #1651 = CARTESIAN_POINT('',(-6.28318530718,-20.30853223771)); -#1652 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1652 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1653 = ORIENTED_EDGE('',*,*,#1501,.F.); @@ -2073,7 +2073,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1672 = AXIS2_PLACEMENT_2D('',#1673,#1674); #1673 = CARTESIAN_POINT('',(15.174200042247,-126.3592373253)); #1674 = DIRECTION('',(0.173648177667,0.984807753012)); -#1675 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1675 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1676 = PCURVE('',#1541,#1677); @@ -2088,7 +2088,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1683 = CARTESIAN_POINT('',(-1.945562438164,-10.03493273927)); #1684 = CARTESIAN_POINT('',(-1.927608797574,-5.18552691579)); #1685 = CARTESIAN_POINT('',(-1.910633236249,1.382677756074E-14)); -#1686 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1686 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1687 = ORIENTED_EDGE('',*,*,#1688,.T.); @@ -2105,7 +2105,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1697 = CARTESIAN_POINT('',(15.765531153075,-16.79743087102)); #1698 = VECTOR('',#1699,1.); #1699 = DIRECTION('',(-0.984807753012,0.173648177667)); -#1700 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1700 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1701 = PCURVE('',#1398,#1702); @@ -2114,7 +2114,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1704 = CARTESIAN_POINT('',(-6.,18.442860570144)); #1705 = VECTOR('',#1706,1.); #1706 = DIRECTION('',(0.,1.)); -#1707 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1707 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1708 = ADVANCED_FACE('',(#1709),#1398,.F.); @@ -2138,7 +2138,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1725 = AXIS2_PLACEMENT_2D('',#1726,#1727); #1726 = CARTESIAN_POINT('',(0.,0.)); #1727 = DIRECTION('',(1.,0.)); -#1728 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1728 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1729 = PCURVE('',#1541,#1730); @@ -2147,7 +2147,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1732 = CARTESIAN_POINT('',(-0.,-0.)); #1733 = VECTOR('',#1734,1.); #1734 = DIRECTION('',(-1.,-0.)); -#1735 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1735 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1736 = ADVANCED_FACE('',(#1737),#1541,.F.); @@ -2157,8 +2157,8 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1740 = ORIENTED_EDGE('',*,*,#1715,.T.); #1741 = ORIENTED_EDGE('',*,*,#1660,.F.); #1742 = ORIENTED_EDGE('',*,*,#1605,.F.); -#1743 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#1747)) +#1743 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#1747)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#1744,#1745,#1746)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #1744 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -2174,8 +2174,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#1744,#1745,#1746)) REPRESENTATION_CONTEXT #1753 = PRODUCT_CONTEXT('',#2,'mechanical'); #1754 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #1755 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#1756,#1758); -#1756 = ( REPRESENTATION_RELATIONSHIP('','',#1334,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#1757) +#1756 = ( REPRESENTATION_RELATIONSHIP('','',#1334,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#1757) SHAPE_REPRESENTATION_RELATIONSHIP() ); #1757 = ITEM_DEFINED_TRANSFORMATION('','',#11,#27); #1758 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -2215,7 +2215,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #1787 = CARTESIAN_POINT('',(0.,6.28318530718)); #1788 = VECTOR('',#1789,1.); #1789 = DIRECTION('',(1.,0.)); -#1790 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1790 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1791 = PCURVE('',#1780,#1792); @@ -2224,7 +2224,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #1794 = CARTESIAN_POINT('',(0.,0.)); #1795 = VECTOR('',#1796,1.); #1796 = DIRECTION('',(1.,0.)); -#1797 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#1797 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #1798 = ORIENTED_EDGE('',*,*,#1799,.T.); @@ -2670,7 +2670,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #2066 = CARTESIAN_POINT('',(1.813535985182,6.124424869722)); #2067 = CARTESIAN_POINT('',(1.813162178226,6.20381253121)); #2068 = CARTESIAN_POINT('',(1.813162177834,6.28318530718)); -#2069 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#2069 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #2070 = PCURVE('',#2071,#2076); @@ -2834,7 +2834,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #2207 = CARTESIAN_POINT('',(9.697819456832,-19.20619689505)); #2208 = CARTESIAN_POINT('',(9.658881072134,-19.60313612015)); #2209 = CARTESIAN_POINT('',(9.658881031252,-20.)); -#2210 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#2210 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #2211 = ORIENTED_EDGE('',*,*,#1768,.F.); @@ -3281,7 +3281,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #2480 = CARTESIAN_POINT('',(1.328056668407,6.124424869713)); #2481 = CARTESIAN_POINT('',(1.328430475363,6.203812531205)); #2482 = CARTESIAN_POINT('',(1.328430475756,6.28318530718)); -#2483 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#2483 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #2484 = PCURVE('',#2485,#2490); @@ -3445,7 +3445,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #2621 = CARTESIAN_POINT('',(9.697819456837,-19.206196895)); #2622 = CARTESIAN_POINT('',(9.658881072134,-19.60313612012)); #2623 = CARTESIAN_POINT('',(9.658881031252,-20.)); -#2624 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#2624 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #2625 = ADVANCED_FACE('',(#2626,#2629),#2485,.T.); @@ -3866,7 +3866,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #2881 = CARTESIAN_POINT('',(11.762276233741,-19.39676430878)); #2882 = CARTESIAN_POINT('',(11.724599640115,-19.69846148366)); #2883 = CARTESIAN_POINT('',(11.724599919101,-20.)); -#2884 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#2884 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #2885 = PCURVE('',#2886,#2891); @@ -4018,7 +4018,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3012 = CARTESIAN_POINT('',(1.306446148996,6.082107949375)); #3013 = CARTESIAN_POINT('',(1.306873481477,6.182672233286)); #3014 = CARTESIAN_POINT('',(1.306873478665,6.28318530718)); -#3015 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3015 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3016 = ADVANCED_FACE('',(#3017,#3020),#2071,.F.); @@ -4439,7 +4439,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3272 = CARTESIAN_POINT('',(11.762277882918,-19.39676871561)); #3273 = CARTESIAN_POINT('',(11.724599950337,-19.69845195347)); #3274 = CARTESIAN_POINT('',(11.724599919101,-20.)); -#3275 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3275 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3276 = PCURVE('',#2886,#3277); @@ -4585,7 +4585,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3398 = CARTESIAN_POINT('',(1.835146522902,6.082109071394)); #3399 = CARTESIAN_POINT('',(1.834719175279,6.182669291672)); #3400 = CARTESIAN_POINT('',(1.834719174925,6.28318530718)); -#3401 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3401 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3402 = ADVANCED_FACE('',(#3403),#2886,.F.); @@ -4606,7 +4606,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3416 = CARTESIAN_POINT('',(0.,6.28318530718)); #3417 = VECTOR('',#3418,1.); #3418 = DIRECTION('',(1.,0.)); -#3419 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3419 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3420 = PCURVE('',#2886,#3421); @@ -4615,14 +4615,14 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3423 = CARTESIAN_POINT('',(0.,0.)); #3424 = VECTOR('',#3425,1.); #3425 = DIRECTION('',(1.,0.)); -#3426 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3426 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3427 = ORIENTED_EDGE('',*,*,#3023,.T.); #3428 = ORIENTED_EDGE('',*,*,#3406,.F.); #3429 = ORIENTED_EDGE('',*,*,#2632,.F.); -#3430 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#3434)) +#3430 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#3434)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#3431,#3432,#3433)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #3431 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -4638,8 +4638,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#3431,#3432,#3433)) REPRESENTATION_CONTEXT #3440 = PRODUCT_CONTEXT('',#2,'mechanical'); #3441 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #3442 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#3443,#3445); -#3443 = ( REPRESENTATION_RELATIONSHIP('','',#1761,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#3444) +#3443 = ( REPRESENTATION_RELATIONSHIP('','',#1761,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#3444) SHAPE_REPRESENTATION_RELATIONSHIP() ); #3444 = ITEM_DEFINED_TRANSFORMATION('','',#11,#31); #3445 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -4679,7 +4679,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #3474 = CARTESIAN_POINT('',(0.,0.)); #3475 = VECTOR('',#3476,1.); #3476 = DIRECTION('',(1.,0.)); -#3477 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3477 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3478 = PCURVE('',#3467,#3479); @@ -4688,7 +4688,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3481 = CARTESIAN_POINT('',(0.,6.28318530718)); #3482 = VECTOR('',#3483,1.); #3483 = DIRECTION('',(1.,0.)); -#3484 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3484 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3485 = ORIENTED_EDGE('',*,*,#3486,.F.); @@ -5134,7 +5134,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3753 = CARTESIAN_POINT('',(5.571393262628,6.12246443717)); #3754 = CARTESIAN_POINT('',(5.571687907419,6.202831597868)); #3755 = CARTESIAN_POINT('',(5.571687907725,6.28318530718)); -#3756 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3756 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3757 = PCURVE('',#3758,#3763); @@ -5299,7 +5299,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #3894 = CARTESIAN_POINT('',(7.103816889165,-19.19639476727)); #3895 = CARTESIAN_POINT('',(7.064382437774,-19.59823145344)); #3896 = CARTESIAN_POINT('',(7.064382396877,-20.)); -#3897 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#3897 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #3898 = ORIENTED_EDGE('',*,*,#3455,.T.); @@ -5746,7 +5746,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #4167 = CARTESIAN_POINT('',(6.057616581779,6.126352363352)); #4168 = CARTESIAN_POINT('',(6.057164075582,6.204777233922)); #4169 = CARTESIAN_POINT('',(6.057164075102,6.28318530718)); -#4170 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#4170 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #4171 = PCURVE('',#4172,#4177); @@ -5911,7 +5911,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #4308 = CARTESIAN_POINT('',(21.166503927923,-19.21583431452)); #4309 = CARTESIAN_POINT('',(21.205086790486,-19.60795963371)); #4310 = CARTESIAN_POINT('',(21.205086831492,-20.)); -#4311 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#4311 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #4312 = ADVANCED_FACE('',(#4313,#4316),#4172,.T.); @@ -6410,7 +6410,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #4616 = CARTESIAN_POINT('',(19.077574448487,-19.48736461292)); #4617 = CARTESIAN_POINT('',(19.10451813367,-19.74373720368)); #4618 = CARTESIAN_POINT('',(19.104518160706,-20.)); -#4619 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#4619 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #4620 = PCURVE('',#4621,#4626); @@ -6589,7 +6589,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #4771 = CARTESIAN_POINT('',(6.084318773588,6.112306866526)); #4772 = CARTESIAN_POINT('',(6.083945424927,6.197764375076)); #4773 = CARTESIAN_POINT('',(6.083945424552,6.28318530718)); -#4774 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#4774 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #4775 = ADVANCED_FACE('',(#4776,#4779),#3758,.T.); @@ -7010,7 +7010,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5031 = CARTESIAN_POINT('',(9.142029849868,-19.38506074443)); #5032 = CARTESIAN_POINT('',(9.103425722659,-19.69259394646)); #5033 = CARTESIAN_POINT('',(9.103425691264,-20.)); -#5034 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5034 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5035 = PCURVE('',#4621,#5036); @@ -7156,7 +7156,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5157 = CARTESIAN_POINT('',(5.554786238145,6.078206426136)); #5158 = CARTESIAN_POINT('',(5.555127023169,6.180716622668)); #5159 = CARTESIAN_POINT('',(5.555127023446,6.28318530718)); -#5160 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5160 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5161 = ADVANCED_FACE('',(#5162),#4621,.F.); @@ -7177,7 +7177,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5175 = CARTESIAN_POINT('',(0.,0.)); #5176 = VECTOR('',#5177,1.); #5177 = DIRECTION('',(1.,0.)); -#5178 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5178 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5179 = PCURVE('',#4621,#5180); @@ -7186,14 +7186,14 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5182 = CARTESIAN_POINT('',(0.,6.28318530718)); #5183 = VECTOR('',#5184,1.); #5184 = DIRECTION('',(1.,0.)); -#5185 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5185 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5186 = ORIENTED_EDGE('',*,*,#4782,.F.); #5187 = ORIENTED_EDGE('',*,*,#5165,.T.); #5188 = ORIENTED_EDGE('',*,*,#4319,.T.); -#5189 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#5193)) +#5189 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#5193)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#5190,#5191,#5192)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #5190 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -7209,8 +7209,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#5190,#5191,#5192)) REPRESENTATION_CONTEXT #5199 = PRODUCT_CONTEXT('',#2,'mechanical'); #5200 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #5201 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#5202,#5204); -#5202 = ( REPRESENTATION_RELATIONSHIP('','',#3448,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#5203) +#5202 = ( REPRESENTATION_RELATIONSHIP('','',#3448,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#5203) SHAPE_REPRESENTATION_RELATIONSHIP() ); #5203 = ITEM_DEFINED_TRANSFORMATION('','',#11,#35); #5204 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -7250,7 +7250,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #5233 = CARTESIAN_POINT('',(0.,6.28318530718)); #5234 = VECTOR('',#5235,1.); #5235 = DIRECTION('',(1.,0.)); -#5236 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5236 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5237 = PCURVE('',#5226,#5238); @@ -7259,7 +7259,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5240 = CARTESIAN_POINT('',(0.,0.)); #5241 = VECTOR('',#5242,1.); #5242 = DIRECTION('',(1.,0.)); -#5243 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5243 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5244 = ORIENTED_EDGE('',*,*,#5245,.T.); @@ -7705,7 +7705,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5512 = CARTESIAN_POINT('',(3.853384698142,6.122464437183)); #5513 = CARTESIAN_POINT('',(3.85309005335,6.202831597875)); #5514 = CARTESIAN_POINT('',(3.853090053045,6.28318530718)); -#5515 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5515 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5516 = PCURVE('',#5517,#5522); @@ -7869,7 +7869,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5653 = CARTESIAN_POINT('',(7.103816889158,-19.19639476734)); #5654 = CARTESIAN_POINT('',(7.064382437774,-19.59823145347)); #5655 = CARTESIAN_POINT('',(7.064382396877,-20.)); -#5656 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5656 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5657 = ORIENTED_EDGE('',*,*,#5214,.F.); @@ -8316,7 +8316,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #5926 = CARTESIAN_POINT('',(3.36716137899,6.126352363331)); #5927 = CARTESIAN_POINT('',(3.367613885187,6.204777233912)); #5928 = CARTESIAN_POINT('',(3.367613885668,6.28318530718)); -#5929 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#5929 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #5930 = PCURVE('',#5931,#5936); @@ -8480,7 +8480,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6067 = CARTESIAN_POINT('',(21.166503927913,-19.21583431441)); #6068 = CARTESIAN_POINT('',(21.205086790486,-19.60795963366)); #6069 = CARTESIAN_POINT('',(21.205086831492,-20.)); -#6070 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6070 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6071 = ADVANCED_FACE('',(#6072,#6075),#5931,.F.); @@ -8979,7 +8979,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6375 = CARTESIAN_POINT('',(19.077574448488,-19.48736461293)); #6376 = CARTESIAN_POINT('',(19.10451813367,-19.74373720369)); #6377 = CARTESIAN_POINT('',(19.104518160706,-20.)); -#6378 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6378 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6379 = PCURVE('',#6380,#6385); @@ -9158,7 +9158,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6530 = CARTESIAN_POINT('',(3.340459187182,6.11230686653)); #6531 = CARTESIAN_POINT('',(3.340832535843,6.197764375078)); #6532 = CARTESIAN_POINT('',(3.340832536217,6.28318530718)); -#6533 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6533 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6534 = ADVANCED_FACE('',(#6535,#6538),#5517,.F.); @@ -9579,7 +9579,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6790 = CARTESIAN_POINT('',(9.142029849867,-19.38506074443)); #6791 = CARTESIAN_POINT('',(9.103425722659,-19.69259394647)); #6792 = CARTESIAN_POINT('',(9.103425691264,-20.)); -#6793 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6793 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6794 = PCURVE('',#6380,#6795); @@ -9725,7 +9725,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6916 = CARTESIAN_POINT('',(3.869991722625,6.078206426139)); #6917 = CARTESIAN_POINT('',(3.8696509376,6.18071662267)); #6918 = CARTESIAN_POINT('',(3.869650937323,6.28318530718)); -#6919 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6919 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6920 = ADVANCED_FACE('',(#6921),#6380,.F.); @@ -9746,7 +9746,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6934 = CARTESIAN_POINT('',(0.,6.28318530718)); #6935 = VECTOR('',#6936,1.); #6936 = DIRECTION('',(1.,0.)); -#6937 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6937 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6938 = PCURVE('',#6380,#6939); @@ -9755,14 +9755,14 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6941 = CARTESIAN_POINT('',(0.,0.)); #6942 = VECTOR('',#6943,1.); #6943 = DIRECTION('',(1.,0.)); -#6944 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6944 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6945 = ORIENTED_EDGE('',*,*,#6541,.T.); #6946 = ORIENTED_EDGE('',*,*,#6924,.F.); #6947 = ORIENTED_EDGE('',*,*,#6078,.F.); -#6948 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#6952)) +#6948 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#6952)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#6949,#6950,#6951)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #6949 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -9778,8 +9778,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#6949,#6950,#6951)) REPRESENTATION_CONTEXT #6958 = PRODUCT_CONTEXT('',#2,'mechanical'); #6959 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #6960 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#6961,#6963); -#6961 = ( REPRESENTATION_RELATIONSHIP('','',#5207,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#6962) +#6961 = ( REPRESENTATION_RELATIONSHIP('','',#5207,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#6962) SHAPE_REPRESENTATION_RELATIONSHIP() ); #6962 = ITEM_DEFINED_TRANSFORMATION('','',#11,#39); #6963 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -9819,7 +9819,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #6992 = CARTESIAN_POINT('',(0.,0.)); #6993 = VECTOR('',#6994,1.); #6994 = DIRECTION('',(1.,0.)); -#6995 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#6995 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #6996 = PCURVE('',#6985,#6997); @@ -9828,7 +9828,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #6999 = CARTESIAN_POINT('',(0.,6.28318530718)); #7000 = VECTOR('',#7001,1.); #7001 = DIRECTION('',(1.,0.)); -#7002 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#7002 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #7003 = ORIENTED_EDGE('',*,*,#7004,.F.); @@ -10274,7 +10274,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #7271 = CARTESIAN_POINT('',(4.469649321997,6.12442486971)); #7272 = CARTESIAN_POINT('',(4.470023128953,6.203812531203)); #7273 = CARTESIAN_POINT('',(4.470023129346,6.28318530718)); -#7274 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#7274 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #7275 = PCURVE('',#7276,#7281); @@ -10438,7 +10438,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #7412 = CARTESIAN_POINT('',(15.373977312887,-19.20619689499)); #7413 = CARTESIAN_POINT('',(15.412915697591,-19.60313612011)); #7414 = CARTESIAN_POINT('',(15.412915738472,-20.)); -#7415 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#7415 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #7416 = ORIENTED_EDGE('',*,*,#6973,.T.); @@ -10885,7 +10885,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #7685 = CARTESIAN_POINT('',(4.955128638772,6.124424869743)); #7686 = CARTESIAN_POINT('',(4.954754831816,6.20381253122)); #7687 = CARTESIAN_POINT('',(4.954754831424,6.28318530718)); -#7688 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#7688 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #7689 = PCURVE('',#7690,#7695); @@ -11049,7 +11049,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #7826 = CARTESIAN_POINT('',(15.373977312903,-19.20619689515)); #7827 = CARTESIAN_POINT('',(15.412915697591,-19.6031361202)); #7828 = CARTESIAN_POINT('',(15.412915738472,-20.)); -#7829 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#7829 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #7830 = ADVANCED_FACE('',(#7831,#7834),#7690,.T.); @@ -11470,7 +11470,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8086 = CARTESIAN_POINT('',(13.309518886811,-19.39676871564)); #8087 = CARTESIAN_POINT('',(13.347196819387,-19.69845195349)); #8088 = CARTESIAN_POINT('',(13.347196850624,-20.)); -#8089 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8089 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8090 = PCURVE('',#8091,#8096); @@ -11622,7 +11622,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8217 = CARTESIAN_POINT('',(4.976739176492,6.082109071407)); #8218 = CARTESIAN_POINT('',(4.976311828869,6.182669291679)); #8219 = CARTESIAN_POINT('',(4.976311828514,6.28318530718)); -#8220 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8220 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8221 = ADVANCED_FACE('',(#8222,#8225),#7276,.F.); @@ -12043,7 +12043,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8477 = CARTESIAN_POINT('',(13.309518886788,-19.39676871546)); #8478 = CARTESIAN_POINT('',(13.347196819387,-19.6984519534)); #8479 = CARTESIAN_POINT('',(13.347196850624,-20.)); -#8480 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8480 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8481 = PCURVE('',#8091,#8482); @@ -12189,7 +12189,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8603 = CARTESIAN_POINT('',(4.448038784277,6.082109071346)); #8604 = CARTESIAN_POINT('',(4.448466131901,6.182669291648)); #8605 = CARTESIAN_POINT('',(4.448466132255,6.28318530718)); -#8606 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8606 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8607 = ADVANCED_FACE('',(#8608),#8091,.F.); @@ -12210,7 +12210,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8621 = CARTESIAN_POINT('',(0.,0.)); #8622 = VECTOR('',#8623,1.); #8623 = DIRECTION('',(1.,0.)); -#8624 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8624 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8625 = PCURVE('',#8091,#8626); @@ -12219,14 +12219,14 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8628 = CARTESIAN_POINT('',(0.,6.28318530718)); #8629 = VECTOR('',#8630,1.); #8630 = DIRECTION('',(1.,0.)); -#8631 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8631 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8632 = ORIENTED_EDGE('',*,*,#8228,.F.); #8633 = ORIENTED_EDGE('',*,*,#8611,.T.); #8634 = ORIENTED_EDGE('',*,*,#7837,.T.); -#8635 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#8639)) +#8635 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#8639)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#8636,#8637,#8638)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #8636 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -12242,8 +12242,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#8636,#8637,#8638)) REPRESENTATION_CONTEXT #8645 = PRODUCT_CONTEXT('',#2,'mechanical'); #8646 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #8647 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#8648,#8650); -#8648 = ( REPRESENTATION_RELATIONSHIP('','',#6966,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#8649) +#8648 = ( REPRESENTATION_RELATIONSHIP('','',#6966,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#8649) SHAPE_REPRESENTATION_RELATIONSHIP() ); #8649 = ITEM_DEFINED_TRANSFORMATION('','',#11,#43); #8650 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -12284,7 +12284,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #8678 = CARTESIAN_POINT('',(-6.28318530718,0.)); #8679 = VECTOR('',#8680,1.); #8680 = DIRECTION('',(-0.,-1.)); -#8681 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8681 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8682 = PCURVE('',#8683,#8688); @@ -12300,7 +12300,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8690 = CARTESIAN_POINT('',(-0.,0.)); #8691 = VECTOR('',#8692,1.); #8692 = DIRECTION('',(-0.,-1.)); -#8693 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8693 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8694 = ORIENTED_EDGE('',*,*,#8695,.T.); @@ -12326,7 +12326,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8710 = CARTESIAN_POINT('',(-6.056840529297,-1.891683272375)); #8711 = CARTESIAN_POINT('',(-5.981392270003,-1.633250409431)); #8712 = CARTESIAN_POINT('',(-5.905944010708,-1.468229606816)); -#8713 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8713 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8714 = PCURVE('',#8715,#8720); @@ -12340,7 +12340,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8722 = AXIS2_PLACEMENT_2D('',#8723,#8724); #8723 = CARTESIAN_POINT('',(43.675337555651,-198.6171504451)); #8724 = DIRECTION('',(0.327803204882,-0.944746028766)); -#8725 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8725 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8726 = ORIENTED_EDGE('',*,*,#8727,.T.); @@ -12375,7 +12375,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8752 = CARTESIAN_POINT('',(-3.333776381062,-33.90245740799)); #8753 = CARTESIAN_POINT('',(-3.138489713197,-29.52741410638)); #8754 = CARTESIAN_POINT('',(-2.943203045331,-24.60675113315)); -#8755 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8755 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8756 = PCURVE('',#8757,#8762); @@ -12389,7 +12389,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8764 = AXIS2_PLACEMENT_2D('',#8765,#8766); #8765 = CARTESIAN_POINT('',(-4.779064583606,-199.2154496729)); #8766 = DIRECTION('',(-0.869546910408,-0.493850352434)); -#8767 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8767 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8768 = ORIENTED_EDGE('',*,*,#8769,.T.); @@ -12425,7 +12425,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8794 = CARTESIAN_POINT('',(-5.766991998882,-25.68769417932)); #8795 = CARTESIAN_POINT('',(-5.975762417396,-26.18024227859)); #8796 = CARTESIAN_POINT('',(-6.184532835905,-27.27390143636)); -#8797 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8797 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8798 = PCURVE('',#8799,#8804); @@ -12439,7 +12439,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8806 = AXIS2_PLACEMENT_2D('',#8807,#8808); #8807 = CARTESIAN_POINT('',(47.725848673317,-192.7140903086)); #8808 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#8809 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8809 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8810 = ORIENTED_EDGE('',*,*,#8811,.T.); @@ -12465,7 +12465,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8826 = CARTESIAN_POINT('',(-6.068277324413,-42.11698267492)); #8827 = CARTESIAN_POINT('',(-6.059665226858,-48.033130957)); #8828 = CARTESIAN_POINT('',(-6.051053129302,-53.94826833384)); -#8829 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8829 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8830 = PCURVE('',#8831,#8836); @@ -12479,7 +12479,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8838 = AXIS2_PLACEMENT_2D('',#8839,#8840); #8839 = CARTESIAN_POINT('',(3.585384677238,-191.8307902945)); #8840 = DIRECTION('',(-0.970968111016,-0.239208961766)); -#8841 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8841 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8842 = ORIENTED_EDGE('',*,*,#8843,.T.); @@ -12502,7 +12502,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8856 = CARTESIAN_POINT('',(-6.154103598072,-51.86766865052)); #8857 = CARTESIAN_POINT('',(-6.218644452626,-52.22099574796)); #8858 = CARTESIAN_POINT('',(-6.28318530718,-52.63416568141)); -#8859 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8859 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8860 = PCURVE('',#8861,#8866); @@ -12516,7 +12516,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8868 = AXIS2_PLACEMENT_2D('',#8869,#8870); #8869 = CARTESIAN_POINT('',(1.560974449966,-186.8014192154)); #8870 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#8871 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8871 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8872 = ADVANCED_FACE('',(#8873),#8683,.T.); @@ -12548,7 +12548,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8893 = CARTESIAN_POINT('',(-0.298818145228,-5.546531767407)); #8894 = CARTESIAN_POINT('',(-0.149409072614,-4.223331054709)); #8895 = CARTESIAN_POINT('',(-2.78644210102E-16,-3.197008098752)); -#8896 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8896 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8897 = PCURVE('',#8715,#8898); @@ -12557,7 +12557,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8900 = AXIS2_PLACEMENT_2D('',#8901,#8902); #8901 = CARTESIAN_POINT('',(43.675337555651,-198.6171504451)); #8902 = DIRECTION('',(0.327803204882,-0.944746028766)); -#8903 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8903 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8904 = ORIENTED_EDGE('',*,*,#8660,.T.); @@ -12595,7 +12595,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8931 = CARTESIAN_POINT('',(-2.684725698596,-77.6826886236)); #8932 = CARTESIAN_POINT('',(-2.876491819926,-77.12128807921)); #8933 = CARTESIAN_POINT('',(-3.068257941255,-76.05844563825)); -#8934 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8934 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8935 = PCURVE('',#8861,#8936); @@ -12604,7 +12604,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8938 = AXIS2_PLACEMENT_2D('',#8939,#8940); #8939 = CARTESIAN_POINT('',(1.560974449966,-186.8014192154)); #8940 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#8941 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8941 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8942 = ORIENTED_EDGE('',*,*,#8943,.T.); @@ -12627,7 +12627,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8956 = CARTESIAN_POINT('',(-0.86967986257,-33.45909513377)); #8957 = CARTESIAN_POINT('',(-0.841739114676,-20.52543671103)); #8958 = CARTESIAN_POINT('',(-0.813798366781,-6.85134695788)); -#8959 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8959 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8960 = PCURVE('',#8961,#8966); @@ -12641,7 +12641,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8968 = AXIS2_PLACEMENT_2D('',#8969,#8970); #8969 = CARTESIAN_POINT('',(797.35328721316,-381.4664020455)); #8970 = DIRECTION('',(0.97103613988,-0.238932657974)); -#8971 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8971 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8972 = ADVANCED_FACE('',(#8973),#8861,.T.); @@ -12668,7 +12668,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #8990 = AXIS2_PLACEMENT_2D('',#8991,#8992); #8991 = CARTESIAN_POINT('',(1.560974449966,-186.8014192154)); #8992 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#8993 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#8993 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #8994 = PCURVE('',#8995,#9000); @@ -12689,7 +12689,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9005 = CARTESIAN_POINT('',(-6.153100759843,-52.10267334702)); #9006 = CARTESIAN_POINT('',(-6.218143033511,-52.45130431158)); #9007 = CARTESIAN_POINT('',(-6.28318530718,-52.85951985907)); -#9008 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9008 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9009 = ORIENTED_EDGE('',*,*,#9010,.T.); @@ -12705,7 +12705,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9019 = CARTESIAN_POINT('',(0.,0.)); #9020 = VECTOR('',#9021,1.); #9021 = DIRECTION('',(0.,-1.)); -#9022 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9022 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9023 = PCURVE('',#8831,#9024); @@ -12714,7 +12714,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9026 = CARTESIAN_POINT('',(24.,0.)); #9027 = VECTOR('',#9028,1.); #9028 = DIRECTION('',(0.,-1.)); -#9029 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9029 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9030 = ORIENTED_EDGE('',*,*,#8843,.T.); @@ -12735,7 +12735,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9044 = CARTESIAN_POINT('',(48.,0.)); #9045 = VECTOR('',#9046,1.); #9046 = DIRECTION('',(0.,-1.)); -#9047 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9047 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9048 = PCURVE('',#8961,#9049); @@ -12744,7 +12744,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9051 = CARTESIAN_POINT('',(0.,0.)); #9052 = VECTOR('',#9053,1.); #9053 = DIRECTION('',(0.,-1.)); -#9054 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9054 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9055 = ORIENTED_EDGE('',*,*,#9056,.F.); @@ -12762,7 +12762,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9066 = AXIS2_PLACEMENT_2D('',#9067,#9068); #9067 = CARTESIAN_POINT('',(1.560974449966,-186.8014192154)); #9068 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#9069 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9069 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9070 = PCURVE('',#9071,#9076); @@ -12794,7 +12794,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9091 = CARTESIAN_POINT('',(-2.686919407222,-77.41596001279)); #9092 = CARTESIAN_POINT('',(-2.878842222025,-76.85931951929)); #9093 = CARTESIAN_POINT('',(-3.070765036827,-75.81084061936)); -#9094 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9094 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9095 = ADVANCED_FACE('',(#9096),#8831,.T.); @@ -12817,7 +12817,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9111 = AXIS2_PLACEMENT_2D('',#9112,#9113); #9112 = CARTESIAN_POINT('',(3.585384677238,-191.8307902945)); #9113 = DIRECTION('',(-0.970968111016,-0.239208961766)); -#9114 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9114 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9115 = PCURVE('',#8995,#9116); @@ -12831,7 +12831,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9121 = CARTESIAN_POINT('',(-6.067939392918,-42.36276435844)); #9122 = CARTESIAN_POINT('',(-6.059154997874,-48.27894912856)); #9123 = CARTESIAN_POINT('',(-6.05037060283,-54.1940584314)); -#9124 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9124 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9125 = ORIENTED_EDGE('',*,*,#9126,.T.); @@ -12847,7 +12847,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9135 = CARTESIAN_POINT('',(0.,0.)); #9136 = VECTOR('',#9137,1.); #9137 = DIRECTION('',(0.,-1.)); -#9138 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9138 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9139 = PCURVE('',#8799,#9140); @@ -12856,7 +12856,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9142 = CARTESIAN_POINT('',(48.,0.)); #9143 = VECTOR('',#9144,1.); #9144 = DIRECTION('',(0.,-1.)); -#9145 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9145 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9146 = ORIENTED_EDGE('',*,*,#8811,.T.); @@ -12881,7 +12881,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9164 = AXIS2_PLACEMENT_2D('',#9165,#9166); #9165 = CARTESIAN_POINT('',(47.725848673317,-192.7140903086)); #9166 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#9167 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9167 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9168 = PCURVE('',#8995,#9169); @@ -12906,7 +12906,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9184 = CARTESIAN_POINT('',(-5.768487578957,-25.95415971038)); #9185 = CARTESIAN_POINT('',(-5.977507260821,-26.44236376275)); #9186 = CARTESIAN_POINT('',(-6.186526942677,-27.520787949)); -#9187 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9187 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9188 = ORIENTED_EDGE('',*,*,#9189,.T.); @@ -12922,7 +12922,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9198 = CARTESIAN_POINT('',(0.,0.)); #9199 = VECTOR('',#9200,1.); #9200 = DIRECTION('',(0.,-1.)); -#9201 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9201 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9202 = PCURVE('',#8757,#9203); @@ -12931,7 +12931,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9205 = CARTESIAN_POINT('',(48.,0.)); #9206 = VECTOR('',#9207,1.); #9207 = DIRECTION('',(0.,-1.)); -#9208 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9208 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9209 = ORIENTED_EDGE('',*,*,#8769,.T.); @@ -12955,7 +12955,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9227 = AXIS2_PLACEMENT_2D('',#9228,#9229); #9228 = CARTESIAN_POINT('',(-4.779064583606,-199.2154496729)); #9229 = DIRECTION('',(-0.869546910408,-0.493850352434)); -#9230 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9230 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9231 = PCURVE('',#8995,#9232); @@ -12980,7 +12980,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9247 = CARTESIAN_POINT('',(-3.334962116661,-33.50078899737)); #9248 = CARTESIAN_POINT('',(-3.139078879841,-29.20004113866)); #9249 = CARTESIAN_POINT('',(-2.943195643017,-24.36110687528)); -#9250 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9250 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9251 = ORIENTED_EDGE('',*,*,#9252,.T.); @@ -12996,7 +12996,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9261 = CARTESIAN_POINT('',(0.,0.)); #9262 = VECTOR('',#9263,1.); #9263 = DIRECTION('',(0.,-1.)); -#9264 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9264 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9265 = PCURVE('',#8715,#9266); @@ -13005,7 +13005,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9268 = CARTESIAN_POINT('',(48.,0.)); #9269 = VECTOR('',#9270,1.); #9270 = DIRECTION('',(0.,-1.)); -#9271 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9271 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9272 = ORIENTED_EDGE('',*,*,#8727,.T.); @@ -13035,7 +13035,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9292 = AXIS2_PLACEMENT_2D('',#9293,#9294); #9293 = CARTESIAN_POINT('',(43.675337555651,-198.6171504451)); #9294 = DIRECTION('',(0.327803204882,-0.944746028766)); -#9295 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9295 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9296 = PCURVE('',#9071,#9297); @@ -13051,7 +13051,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9304 = CARTESIAN_POINT('',(-0.317480641014,-5.887151402183)); #9305 = CARTESIAN_POINT('',(-0.158740320507,-4.4895633497)); #9306 = CARTESIAN_POINT('',(-2.84217094304E-16,-3.42052286094)); -#9307 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9307 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9308 = ORIENTED_EDGE('',*,*,#9309,.T.); @@ -13067,7 +13067,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9318 = CARTESIAN_POINT('',(0.,0.)); #9319 = VECTOR('',#9320,1.); #9320 = DIRECTION('',(0.,-1.)); -#9321 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9321 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9322 = PCURVE('',#8961,#9323); @@ -13076,7 +13076,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9325 = CARTESIAN_POINT('',(48.,0.)); #9326 = VECTOR('',#9327,1.); #9327 = DIRECTION('',(0.,-1.)); -#9328 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9328 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9329 = ORIENTED_EDGE('',*,*,#8876,.T.); @@ -13098,7 +13098,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9343 = AXIS2_PLACEMENT_2D('',#9344,#9345); #9344 = CARTESIAN_POINT('',(43.675337555651,-198.6171504451)); #9345 = DIRECTION('',(0.327803204882,-0.944746028766)); -#9346 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9346 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9347 = PCURVE('',#8995,#9348); @@ -13113,7 +13113,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9354 = CARTESIAN_POINT('',(-6.029274768536,-2.046533141339)); #9355 = CARTESIAN_POINT('',(-5.965797133875,-1.851108605188)); #9356 = CARTESIAN_POINT('',(-5.902319499214,-1.717954437449)); -#9357 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9357 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9358 = ADVANCED_FACE('',(#9359),#8961,.T.); @@ -13134,7 +13134,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9372 = AXIS2_PLACEMENT_2D('',#9373,#9374); #9373 = CARTESIAN_POINT('',(797.35328721316,-381.4664020455)); #9374 = DIRECTION('',(0.97103613988,-0.238932657974)); -#9375 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9375 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9376 = PCURVE('',#9071,#9377); @@ -13148,7 +13148,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9382 = CARTESIAN_POINT('',(-0.908349214655,-34.50870663902)); #9383 = CARTESIAN_POINT('',(-0.877494261072,-21.3696233486)); #9384 = CARTESIAN_POINT('',(-0.846639307489,-7.327034836156)); -#9385 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9385 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9386 = ORIENTED_EDGE('',*,*,#9033,.T.); @@ -13171,7 +13171,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9402 = CARTESIAN_POINT('',(-6.28318530718,0.)); #9403 = VECTOR('',#9404,1.); #9404 = DIRECTION('',(-0.,-1.)); -#9405 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9405 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9406 = PCURVE('',#9071,#9407); @@ -13180,7 +13180,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9409 = CARTESIAN_POINT('',(-0.,0.)); #9410 = VECTOR('',#9411,1.); #9411 = DIRECTION('',(-0.,-1.)); -#9412 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9412 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9413 = ORIENTED_EDGE('',*,*,#9333,.T.); @@ -13195,8 +13195,8 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9422 = ORIENTED_EDGE('',*,*,#9393,.T.); #9423 = ORIENTED_EDGE('',*,*,#9056,.T.); #9424 = ORIENTED_EDGE('',*,*,#9362,.T.); -#9425 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9429)) +#9425 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9429)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#9426,#9427,#9428)) REPRESENTATION_CONTEXT ('Context #1','3D Context with UNIT and UNCERTAINTY') ); #9426 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -13212,8 +13212,8 @@ GLOBAL_UNIT_ASSIGNED_CONTEXT((#9426,#9427,#9428)) REPRESENTATION_CONTEXT #9435 = PRODUCT_CONTEXT('',#2,'mechanical'); #9436 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #9437 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#9438,#9440); -#9438 = ( REPRESENTATION_RELATIONSHIP('','',#8653,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#9439) +#9438 = ( REPRESENTATION_RELATIONSHIP('','',#8653,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#9439) SHAPE_REPRESENTATION_RELATIONSHIP() ); #9439 = ITEM_DEFINED_TRANSFORMATION('','',#11,#47); #9440 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -13269,7 +13269,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #9482 = CARTESIAN_POINT('',(-5.766991998882,-25.68769417932)); #9483 = CARTESIAN_POINT('',(-5.975762417396,-26.18024227859)); #9484 = CARTESIAN_POINT('',(-6.184532835905,-27.27390143636)); -#9485 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9485 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9486 = PCURVE('',#9487,#9492); @@ -13283,7 +13283,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9494 = AXIS2_PLACEMENT_2D('',#9495,#9496); #9495 = CARTESIAN_POINT('',(47.725848673317,-192.7140903086)); #9496 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#9497 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9497 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9498 = ORIENTED_EDGE('',*,*,#9499,.T.); @@ -13318,7 +13318,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9524 = CARTESIAN_POINT('',(-3.333776381062,-33.90245740799)); #9525 = CARTESIAN_POINT('',(-3.138489713197,-29.52741410638)); #9526 = CARTESIAN_POINT('',(-2.943203045331,-24.60675113315)); -#9527 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9527 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9528 = PCURVE('',#9529,#9534); @@ -13332,7 +13332,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9536 = AXIS2_PLACEMENT_2D('',#9537,#9538); #9537 = CARTESIAN_POINT('',(-4.779064583606,-199.2154496729)); #9538 = DIRECTION('',(-0.869546910408,-0.493850352434)); -#9539 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9539 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9540 = ORIENTED_EDGE('',*,*,#9541,.T.); @@ -13362,7 +13362,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9559 = CARTESIAN_POINT('',(-2.055466361382,-26.28217709946)); #9560 = CARTESIAN_POINT('',(-1.877578260785,-24.72762549146)); #9561 = CARTESIAN_POINT('',(-1.699690160189,-22.8737214835)); -#9562 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9562 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9563 = PCURVE('',#9564,#9569); @@ -13376,7 +13376,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9571 = AXIS2_PLACEMENT_2D('',#9572,#9573); #9572 = CARTESIAN_POINT('',(43.675337555651,-198.6171504451)); #9573 = DIRECTION('',(0.327803204882,-0.944746028766)); -#9574 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9574 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9575 = ORIENTED_EDGE('',*,*,#9576,.T.); @@ -13402,7 +13402,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9591 = CARTESIAN_POINT('',(-1.847933058021,-57.0991363029)); #9592 = CARTESIAN_POINT('',(-1.819992310127,-67.85813846104)); #9593 = CARTESIAN_POINT('',(-1.792051562232,-77.80746628557)); -#9594 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9594 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9595 = PCURVE('',#9596,#9601); @@ -13416,7 +13416,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9603 = AXIS2_PLACEMENT_2D('',#9604,#9605); #9604 = CARTESIAN_POINT('',(797.35328721316,-381.4664020455)); #9605 = DIRECTION('',(0.97103613988,-0.238932657974)); -#9606 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9606 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9607 = ORIENTED_EDGE('',*,*,#9608,.T.); @@ -13453,7 +13453,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9633 = CARTESIAN_POINT('',(-2.684725698596,-77.6826886236)); #9634 = CARTESIAN_POINT('',(-2.876491819926,-77.12128807921)); #9635 = CARTESIAN_POINT('',(-3.068257941255,-76.05844563825)); -#9636 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9636 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9637 = PCURVE('',#9638,#9643); @@ -13467,7 +13467,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9645 = AXIS2_PLACEMENT_2D('',#9646,#9647); #9646 = CARTESIAN_POINT('',(1.560974449966,-186.8014192154)); #9647 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#9648 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9648 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9649 = ORIENTED_EDGE('',*,*,#9650,.T.); @@ -13490,7 +13490,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9663 = CARTESIAN_POINT('',(-2.951849553695,-61.25698569006)); #9664 = CARTESIAN_POINT('',(-2.943237456139,-55.34194995819)); #9665 = CARTESIAN_POINT('',(-2.934625358584,-49.42632255196)); -#9666 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9666 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9667 = PCURVE('',#9668,#9673); @@ -13504,7 +13504,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9675 = AXIS2_PLACEMENT_2D('',#9676,#9677); #9676 = CARTESIAN_POINT('',(3.585384677238,-191.8307902945)); #9677 = DIRECTION('',(-0.970968111016,-0.239208961766)); -#9678 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9678 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9679 = ADVANCED_FACE('',(#9680),#9487,.T.); @@ -13526,7 +13526,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9695 = CARTESIAN_POINT('',(0.,0.)); #9696 = VECTOR('',#9697,1.); #9697 = DIRECTION('',(0.,-1.)); -#9698 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9698 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9699 = PCURVE('',#9529,#9700); @@ -13535,7 +13535,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9702 = CARTESIAN_POINT('',(48.,0.)); #9703 = VECTOR('',#9704,1.); #9704 = DIRECTION('',(0.,-1.)); -#9705 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9705 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9706 = ORIENTED_EDGE('',*,*,#9707,.F.); @@ -13555,7 +13555,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9719 = AXIS2_PLACEMENT_2D('',#9720,#9721); #9720 = CARTESIAN_POINT('',(47.725848673317,-192.7140903086)); #9721 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#9722 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9722 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9723 = PCURVE('',#9724,#9729); @@ -13587,7 +13587,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9744 = CARTESIAN_POINT('',(-5.768487578957,-25.95415971038)); #9745 = CARTESIAN_POINT('',(-5.977507260821,-26.44236376275)); #9746 = CARTESIAN_POINT('',(-6.186526942677,-27.520787949)); -#9747 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9747 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9748 = ORIENTED_EDGE('',*,*,#9749,.F.); @@ -13603,7 +13603,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9758 = CARTESIAN_POINT('',(48.,0.)); #9759 = VECTOR('',#9760,1.); #9760 = DIRECTION('',(0.,-1.)); -#9761 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9761 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9762 = PCURVE('',#9668,#9763); @@ -13612,7 +13612,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9765 = CARTESIAN_POINT('',(0.,0.)); #9766 = VECTOR('',#9767,1.); #9767 = DIRECTION('',(0.,-1.)); -#9768 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9768 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9769 = ADVANCED_FACE('',(#9770),#9668,.T.); @@ -13638,7 +13638,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9787 = AXIS2_PLACEMENT_2D('',#9788,#9789); #9788 = CARTESIAN_POINT('',(3.585384677238,-191.8307902945)); #9789 = DIRECTION('',(-0.970968111016,-0.239208961766)); -#9790 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9790 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9791 = PCURVE('',#9724,#9792); @@ -13652,7 +13652,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9797 = CARTESIAN_POINT('',(-2.952015187703,-61.01142548592)); #9798 = CARTESIAN_POINT('',(-2.943230792658,-55.09634282867)); #9799 = CARTESIAN_POINT('',(-2.934446397614,-49.1806682807)); -#9800 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9800 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9801 = ORIENTED_EDGE('',*,*,#9802,.F.); @@ -13668,7 +13668,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9811 = CARTESIAN_POINT('',(24.,0.)); #9812 = VECTOR('',#9813,1.); #9813 = DIRECTION('',(0.,-1.)); -#9814 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9814 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9815 = PCURVE('',#9638,#9816); @@ -13677,7 +13677,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9818 = CARTESIAN_POINT('',(0.,0.)); #9819 = VECTOR('',#9820,1.); #9820 = DIRECTION('',(0.,-1.)); -#9821 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9821 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9822 = ADVANCED_FACE('',(#9823),#9638,.T.); @@ -13703,7 +13703,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9840 = AXIS2_PLACEMENT_2D('',#9841,#9842); #9841 = CARTESIAN_POINT('',(1.560974449966,-186.8014192154)); #9842 = DIRECTION('',(-0.296422624454,-0.955056871454)); -#9843 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9843 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9844 = PCURVE('',#9724,#9845); @@ -13728,7 +13728,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9860 = CARTESIAN_POINT('',(-2.686919407222,-77.41596001279)); #9861 = CARTESIAN_POINT('',(-2.878842222025,-76.85931951929)); #9862 = CARTESIAN_POINT('',(-3.070765036827,-75.81084061936)); -#9863 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9863 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9864 = ORIENTED_EDGE('',*,*,#9865,.F.); @@ -13744,7 +13744,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9874 = CARTESIAN_POINT('',(48.,0.)); #9875 = VECTOR('',#9876,1.); #9876 = DIRECTION('',(0.,-1.)); -#9877 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9877 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9878 = PCURVE('',#9596,#9879); @@ -13753,7 +13753,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9881 = CARTESIAN_POINT('',(0.,0.)); #9882 = VECTOR('',#9883,1.); #9883 = DIRECTION('',(0.,-1.)); -#9884 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9884 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9885 = ADVANCED_FACE('',(#9886),#9596,.T.); @@ -13779,7 +13779,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9903 = AXIS2_PLACEMENT_2D('',#9904,#9905); #9904 = CARTESIAN_POINT('',(797.35328721316,-381.4664020455)); #9905 = DIRECTION('',(0.97103613988,-0.238932657974)); -#9906 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9906 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9907 = PCURVE('',#9724,#9908); @@ -13793,7 +13793,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9913 = CARTESIAN_POINT('',(-1.806349500248,-57.0435913497)); #9914 = CARTESIAN_POINT('',(-1.775494546665,-67.60018613136)); #9915 = CARTESIAN_POINT('',(-1.744639593082,-77.1701599207)); -#9916 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9916 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9917 = ORIENTED_EDGE('',*,*,#9918,.F.); @@ -13809,7 +13809,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9927 = CARTESIAN_POINT('',(48.,0.)); #9928 = VECTOR('',#9929,1.); #9929 = DIRECTION('',(0.,-1.)); -#9930 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9930 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9931 = PCURVE('',#9564,#9932); @@ -13818,7 +13818,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9934 = CARTESIAN_POINT('',(0.,0.)); #9935 = VECTOR('',#9936,1.); #9936 = DIRECTION('',(0.,-1.)); -#9937 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9937 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9938 = ADVANCED_FACE('',(#9939),#9564,.T.); @@ -13844,7 +13844,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9956 = AXIS2_PLACEMENT_2D('',#9957,#9958); #9957 = CARTESIAN_POINT('',(43.675337555651,-198.6171504451)); #9958 = DIRECTION('',(0.327803204882,-0.944746028766)); -#9959 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9959 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9960 = PCURVE('',#9724,#9961); @@ -13861,7 +13861,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9969 = CARTESIAN_POINT('',(-2.007383437812,-25.7324587736)); #9970 = CARTESIAN_POINT('',(-1.820877431374,-24.02753291185)); #9971 = CARTESIAN_POINT('',(-1.634371424935,-22.02719984695)); -#9972 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9972 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9973 = ORIENTED_EDGE('',*,*,#9974,.F.); @@ -13877,7 +13877,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9983 = CARTESIAN_POINT('',(48.,0.)); #9984 = VECTOR('',#9985,1.); #9985 = DIRECTION('',(0.,-1.)); -#9986 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9986 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9987 = PCURVE('',#9529,#9988); @@ -13886,7 +13886,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #9990 = CARTESIAN_POINT('',(0.,0.)); #9991 = VECTOR('',#9992,1.); #9992 = DIRECTION('',(0.,-1.)); -#9993 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#9993 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #9994 = ADVANCED_FACE('',(#9995),#9529,.T.); @@ -13908,7 +13908,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10010 = AXIS2_PLACEMENT_2D('',#10011,#10012); #10011 = CARTESIAN_POINT('',(-4.779064583606,-199.2154496729)); #10012 = DIRECTION('',(-0.869546910408,-0.493850352434)); -#10013 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10013 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10014 = PCURVE('',#9724,#10015); @@ -13933,7 +13933,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10030 = CARTESIAN_POINT('',(-3.334962116661,-33.50078899737)); #10031 = CARTESIAN_POINT('',(-3.139078879841,-29.20004113866)); #10032 = CARTESIAN_POINT('',(-2.943195643017,-24.36110687528)); -#10033 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10033 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10034 = ORIENTED_EDGE('',*,*,#9684,.F.); @@ -13946,9 +13946,9 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10041 = ORIENTED_EDGE('',*,*,#9891,.T.); #10042 = ORIENTED_EDGE('',*,*,#9828,.T.); #10043 = ORIENTED_EDGE('',*,*,#9775,.T.); -#10044 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#10048)) -GLOBAL_UNIT_ASSIGNED_CONTEXT((#10045,#10046,#10047)) +#10044 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#10048)) +GLOBAL_UNIT_ASSIGNED_CONTEXT((#10045,#10046,#10047)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); #10045 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -13964,8 +13964,8 @@ REPRESENTATION_CONTEXT('Context #1', #10054 = PRODUCT_CONTEXT('',#2,'mechanical'); #10055 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #10056 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#10057,#10059); -#10057 = ( REPRESENTATION_RELATIONSHIP('','',#9443,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#10058) +#10057 = ( REPRESENTATION_RELATIONSHIP('','',#9443,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#10058) SHAPE_REPRESENTATION_RELATIONSHIP() ); #10058 = ITEM_DEFINED_TRANSFORMATION('','',#11,#51); #10059 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -13988,9 +13988,9 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #10075 = CARTESIAN_POINT('',(0.,0.,0.)); #10076 = DIRECTION('',(0.,0.,1.)); #10077 = DIRECTION('',(1.,0.,-0.)); -#10078 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#10082)) -GLOBAL_UNIT_ASSIGNED_CONTEXT((#10079,#10080,#10081)) +#10078 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#10082)) +GLOBAL_UNIT_ASSIGNED_CONTEXT((#10079,#10080,#10081)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); #10079 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -14027,7 +14027,7 @@ REPRESENTATION_CONTEXT('Context #1', #10108 = CARTESIAN_POINT('',(0.,0.)); #10109 = VECTOR('',#10110,1.); #10110 = DIRECTION('',(0.,-1.)); -#10111 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10111 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10112 = PCURVE('',#10113,#10118); @@ -14041,7 +14041,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10120 = CARTESIAN_POINT('',(72.,0.)); #10121 = VECTOR('',#10122,1.); #10122 = DIRECTION('',(0.,-1.)); -#10123 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10123 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10124 = ORIENTED_EDGE('',*,*,#10125,.T.); @@ -14059,7 +14059,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10136 = CARTESIAN_POINT('',(0.,-2.)); #10137 = VECTOR('',#10138,1.); #10138 = DIRECTION('',(1.,0.)); -#10139 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10139 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10140 = PCURVE('',#10141,#10146); @@ -14073,7 +14073,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10148 = CARTESIAN_POINT('',(0.,0.)); #10149 = VECTOR('',#10150,1.); #10150 = DIRECTION('',(1.,0.)); -#10151 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10151 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10152 = ORIENTED_EDGE('',*,*,#10153,.F.); @@ -14091,7 +14091,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10164 = CARTESIAN_POINT('',(48.,0.)); #10165 = VECTOR('',#10166,1.); #10166 = DIRECTION('',(0.,-1.)); -#10167 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10167 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10168 = PCURVE('',#10169,#10174); @@ -14105,7 +14105,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10176 = CARTESIAN_POINT('',(0.,0.)); #10177 = VECTOR('',#10178,1.); #10178 = DIRECTION('',(0.,-1.)); -#10179 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10179 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10180 = ORIENTED_EDGE('',*,*,#10181,.F.); @@ -14121,7 +14121,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10190 = CARTESIAN_POINT('',(0.,0.)); #10191 = VECTOR('',#10192,1.); #10192 = DIRECTION('',(1.,0.)); -#10193 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10193 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10194 = PCURVE('',#10195,#10200); @@ -14135,7 +14135,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10202 = CARTESIAN_POINT('',(0.,0.)); #10203 = VECTOR('',#10204,1.); #10204 = DIRECTION('',(1.,0.)); -#10205 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10205 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10206 = ADVANCED_FACE('',(#10207),#10169,.F.); @@ -14157,7 +14157,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10222 = CARTESIAN_POINT('',(0.,-2.)); #10223 = VECTOR('',#10224,1.); #10224 = DIRECTION('',(1.,0.)); -#10225 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10225 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10226 = PCURVE('',#10141,#10227); @@ -14166,7 +14166,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10229 = CARTESIAN_POINT('',(48.,0.)); #10230 = VECTOR('',#10231,1.); #10231 = DIRECTION('',(0.707106781187,0.707106781187)); -#10232 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10232 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10233 = ORIENTED_EDGE('',*,*,#10234,.F.); @@ -14184,7 +14184,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10245 = CARTESIAN_POINT('',(78.801081914276,0.)); #10246 = VECTOR('',#10247,1.); #10247 = DIRECTION('',(0.,-1.)); -#10248 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10248 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10249 = PCURVE('',#10250,#10255); @@ -14198,7 +14198,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10257 = CARTESIAN_POINT('',(0.,0.)); #10258 = VECTOR('',#10259,1.); #10259 = DIRECTION('',(0.,-1.)); -#10260 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10260 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10261 = ORIENTED_EDGE('',*,*,#10262,.F.); @@ -14214,7 +14214,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10271 = CARTESIAN_POINT('',(0.,0.)); #10272 = VECTOR('',#10273,1.); #10273 = DIRECTION('',(1.,0.)); -#10274 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10274 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10275 = PCURVE('',#10195,#10276); @@ -14223,7 +14223,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10278 = CARTESIAN_POINT('',(48.,0.)); #10279 = VECTOR('',#10280,1.); #10280 = DIRECTION('',(0.707106781187,0.707106781187)); -#10281 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10281 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10282 = ADVANCED_FACE('',(#10283),#10250,.F.); @@ -14245,7 +14245,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10298 = CARTESIAN_POINT('',(0.,-2.)); #10299 = VECTOR('',#10300,1.); #10300 = DIRECTION('',(1.,0.)); -#10301 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10301 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10302 = PCURVE('',#10141,#10303); @@ -14254,7 +14254,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10305 = CARTESIAN_POINT('',(103.72077938642,55.720779386421)); #10306 = VECTOR('',#10307,1.); #10307 = DIRECTION('',(-0.707106781187,0.707106781187)); -#10308 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10308 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10309 = ORIENTED_EDGE('',*,*,#10310,.F.); @@ -14272,7 +14272,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10321 = CARTESIAN_POINT('',(36.,0.)); #10322 = VECTOR('',#10323,1.); #10323 = DIRECTION('',(0.,-1.)); -#10324 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10324 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10325 = PCURVE('',#10326,#10331); @@ -14286,7 +14286,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10333 = CARTESIAN_POINT('',(0.,0.)); #10334 = VECTOR('',#10335,1.); #10335 = DIRECTION('',(-0.,-1.)); -#10336 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10336 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10337 = ORIENTED_EDGE('',*,*,#10338,.F.); @@ -14302,7 +14302,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10347 = CARTESIAN_POINT('',(0.,0.)); #10348 = VECTOR('',#10349,1.); #10349 = DIRECTION('',(1.,0.)); -#10350 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10350 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10351 = PCURVE('',#10195,#10352); @@ -14311,7 +14311,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10354 = CARTESIAN_POINT('',(103.72077938642,55.720779386421)); #10355 = VECTOR('',#10356,1.); #10356 = DIRECTION('',(-0.707106781187,0.707106781187)); -#10357 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10357 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10358 = ADVANCED_FACE('',(#10359),#10326,.F.); @@ -14333,7 +14333,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10374 = CARTESIAN_POINT('',(-0.,-2.)); #10375 = VECTOR('',#10376,1.); #10376 = DIRECTION('',(1.,0.)); -#10377 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10377 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10378 = PCURVE('',#10141,#10379); @@ -14342,7 +14342,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10381 = CARTESIAN_POINT('',(78.264935263706,81.176623509137)); #10382 = VECTOR('',#10383,1.); #10383 = DIRECTION('',(-0.993196201911,-0.116453014175)); -#10384 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10384 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10385 = ORIENTED_EDGE('',*,*,#10386,.F.); @@ -14360,7 +14360,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10397 = CARTESIAN_POINT('',(78.801081914276,0.)); #10398 = VECTOR('',#10399,1.); #10399 = DIRECTION('',(-0.,-1.)); -#10400 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10400 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10401 = PCURVE('',#10113,#10402); @@ -14369,7 +14369,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10404 = CARTESIAN_POINT('',(0.,0.)); #10405 = VECTOR('',#10406,1.); #10406 = DIRECTION('',(0.,-1.)); -#10407 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10407 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10408 = ORIENTED_EDGE('',*,*,#10409,.F.); @@ -14385,7 +14385,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10418 = CARTESIAN_POINT('',(0.,0.)); #10419 = VECTOR('',#10420,1.); #10420 = DIRECTION('',(1.,0.)); -#10421 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10421 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10422 = PCURVE('',#10195,#10423); @@ -14394,7 +14394,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10425 = CARTESIAN_POINT('',(78.264935263706,81.176623509137)); #10426 = VECTOR('',#10427,1.); #10427 = DIRECTION('',(-0.993196201911,-0.116453014175)); -#10428 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10428 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10429 = ADVANCED_FACE('',(#10430),#10113,.F.); @@ -14414,7 +14414,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10443 = CARTESIAN_POINT('',(0.,-2.)); #10444 = VECTOR('',#10445,1.); #10445 = DIRECTION('',(1.,0.)); -#10446 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10446 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10447 = PCURVE('',#10141,#10448); @@ -14423,7 +14423,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10450 = CARTESIAN_POINT('',(0.,72.)); #10451 = VECTOR('',#10452,1.); #10452 = DIRECTION('',(0.,-1.)); -#10453 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10453 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10454 = ORIENTED_EDGE('',*,*,#10090,.F.); @@ -14440,7 +14440,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10465 = CARTESIAN_POINT('',(0.,0.)); #10466 = VECTOR('',#10467,1.); #10467 = DIRECTION('',(1.,0.)); -#10468 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10468 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10469 = PCURVE('',#10195,#10470); @@ -14449,7 +14449,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10472 = CARTESIAN_POINT('',(0.,72.)); #10473 = VECTOR('',#10474,1.); #10474 = DIRECTION('',(0.,-1.)); -#10475 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10475 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10476 = ADVANCED_FACE('',(#10477),#10195,.F.); @@ -14468,9 +14468,9 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10489 = ORIENTED_EDGE('',*,*,#10287,.T.); #10490 = ORIENTED_EDGE('',*,*,#10363,.T.); #10491 = ORIENTED_EDGE('',*,*,#10434,.T.); -#10492 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#10496)) -GLOBAL_UNIT_ASSIGNED_CONTEXT((#10493,#10494,#10495)) +#10492 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#10496)) +GLOBAL_UNIT_ASSIGNED_CONTEXT((#10493,#10494,#10495)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); #10493 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -14486,8 +14486,8 @@ REPRESENTATION_CONTEXT('Context #1', #10502 = PRODUCT_CONTEXT('',#2,'mechanical'); #10503 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #10504 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#10505,#10507); -#10505 = ( REPRESENTATION_RELATIONSHIP('','',#10083,#10069) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#10506) +#10505 = ( REPRESENTATION_RELATIONSHIP('','',#10083,#10069) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#10506) SHAPE_REPRESENTATION_RELATIONSHIP() ); #10506 = ITEM_DEFINED_TRANSFORMATION('','',#11,#10070); #10507 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -14523,7 +14523,7 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #10535 = CARTESIAN_POINT('',(0.,0.)); #10536 = VECTOR('',#10537,1.); #10537 = DIRECTION('',(0.,-1.)); -#10538 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10538 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10539 = PCURVE('',#10540,#10545); @@ -14537,7 +14537,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10547 = CARTESIAN_POINT('',(67.2,0.)); #10548 = VECTOR('',#10549,1.); #10549 = DIRECTION('',(0.,-1.)); -#10550 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10550 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10551 = ORIENTED_EDGE('',*,*,#10552,.T.); @@ -14555,7 +14555,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10563 = CARTESIAN_POINT('',(0.,-2.)); #10564 = VECTOR('',#10565,1.); #10565 = DIRECTION('',(1.,0.)); -#10566 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10566 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10567 = PCURVE('',#10568,#10573); @@ -14569,7 +14569,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10575 = CARTESIAN_POINT('',(-4.8,72.)); #10576 = VECTOR('',#10577,1.); #10577 = DIRECTION('',(1.,0.)); -#10578 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10578 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10579 = ORIENTED_EDGE('',*,*,#10580,.F.); @@ -14587,7 +14587,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10591 = CARTESIAN_POINT('',(4.8,0.)); #10592 = VECTOR('',#10593,1.); #10593 = DIRECTION('',(0.,-1.)); -#10594 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10594 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10595 = PCURVE('',#10596,#10601); @@ -14601,7 +14601,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10603 = CARTESIAN_POINT('',(0.,0.)); #10604 = VECTOR('',#10605,1.); #10605 = DIRECTION('',(0.,-1.)); -#10606 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10606 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10607 = ORIENTED_EDGE('',*,*,#10608,.F.); @@ -14617,7 +14617,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10617 = CARTESIAN_POINT('',(0.,0.)); #10618 = VECTOR('',#10619,1.); #10619 = DIRECTION('',(1.,0.)); -#10620 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10620 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10621 = PCURVE('',#10622,#10627); @@ -14631,7 +14631,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10629 = CARTESIAN_POINT('',(-4.8,72.)); #10630 = VECTOR('',#10631,1.); #10631 = DIRECTION('',(1.,0.)); -#10632 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10632 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10633 = ADVANCED_FACE('',(#10634),#10540,.T.); @@ -14654,7 +14654,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10650 = CARTESIAN_POINT('',(0.,0.)); #10651 = VECTOR('',#10652,1.); #10652 = DIRECTION('',(0.,-1.)); -#10653 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10653 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10654 = PCURVE('',#10655,#10660); @@ -14668,7 +14668,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10662 = CARTESIAN_POINT('',(91.2,0.)); #10663 = VECTOR('',#10664,1.); #10664 = DIRECTION('',(0.,-1.)); -#10665 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10665 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10666 = ORIENTED_EDGE('',*,*,#10667,.T.); @@ -14684,7 +14684,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10676 = CARTESIAN_POINT('',(0.,-2.)); #10677 = VECTOR('',#10678,1.); #10678 = DIRECTION('',(1.,0.)); -#10679 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10679 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10680 = PCURVE('',#10568,#10681); @@ -14693,7 +14693,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10683 = CARTESIAN_POINT('',(-4.8,4.8)); #10684 = VECTOR('',#10685,1.); #10685 = DIRECTION('',(0.,1.)); -#10686 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10686 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10687 = ORIENTED_EDGE('',*,*,#10517,.F.); @@ -14710,7 +14710,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10698 = CARTESIAN_POINT('',(0.,0.)); #10699 = VECTOR('',#10700,1.); #10700 = DIRECTION('',(1.,0.)); -#10701 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10701 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10702 = PCURVE('',#10622,#10703); @@ -14719,7 +14719,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10705 = CARTESIAN_POINT('',(-4.8,4.8)); #10706 = VECTOR('',#10707,1.); #10707 = DIRECTION('',(0.,1.)); -#10708 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10708 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10709 = ADVANCED_FACE('',(#10710),#10655,.T.); @@ -14742,7 +14742,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10726 = CARTESIAN_POINT('',(0.,0.)); #10727 = VECTOR('',#10728,1.); #10728 = DIRECTION('',(0.,-1.)); -#10729 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10729 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10730 = PCURVE('',#10731,#10736); @@ -14756,7 +14756,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10738 = CARTESIAN_POINT('',(0.,0.)); #10739 = VECTOR('',#10740,1.); #10740 = DIRECTION('',(0.,-1.)); -#10741 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10741 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10742 = ORIENTED_EDGE('',*,*,#10743,.T.); @@ -14772,7 +14772,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10752 = CARTESIAN_POINT('',(0.,-2.)); #10753 = VECTOR('',#10754,1.); #10754 = DIRECTION('',(1.,0.)); -#10755 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10755 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10756 = PCURVE('',#10568,#10757); @@ -14781,7 +14781,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10759 = CARTESIAN_POINT('',(-96.,4.8)); #10760 = VECTOR('',#10761,1.); #10761 = DIRECTION('',(1.,0.)); -#10762 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10762 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10763 = ORIENTED_EDGE('',*,*,#10637,.F.); @@ -14798,7 +14798,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10774 = CARTESIAN_POINT('',(0.,0.)); #10775 = VECTOR('',#10776,1.); #10776 = DIRECTION('',(1.,0.)); -#10777 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10777 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10778 = PCURVE('',#10622,#10779); @@ -14807,7 +14807,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10781 = CARTESIAN_POINT('',(-96.,4.8)); #10782 = VECTOR('',#10783,1.); #10783 = DIRECTION('',(1.,0.)); -#10784 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10784 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10785 = ADVANCED_FACE('',(#10786),#10731,.F.); @@ -14829,7 +14829,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10801 = CARTESIAN_POINT('',(0.,-2.)); #10802 = VECTOR('',#10803,1.); #10803 = DIRECTION('',(1.,0.)); -#10804 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10804 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10805 = PCURVE('',#10568,#10806); @@ -14838,7 +14838,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10808 = CARTESIAN_POINT('',(-96.,4.8)); #10809 = VECTOR('',#10810,1.); #10810 = DIRECTION('',(0.,-1.)); -#10811 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10811 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10812 = ORIENTED_EDGE('',*,*,#10813,.F.); @@ -14856,7 +14856,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10824 = CARTESIAN_POINT('',(4.8,0.)); #10825 = VECTOR('',#10826,1.); #10826 = DIRECTION('',(0.,-1.)); -#10827 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10827 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10828 = PCURVE('',#10829,#10834); @@ -14870,7 +14870,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10836 = CARTESIAN_POINT('',(96.,0.)); #10837 = VECTOR('',#10838,1.); #10838 = DIRECTION('',(0.,-1.)); -#10839 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10839 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10840 = ORIENTED_EDGE('',*,*,#10841,.F.); @@ -14886,7 +14886,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10850 = CARTESIAN_POINT('',(0.,0.)); #10851 = VECTOR('',#10852,1.); #10852 = DIRECTION('',(1.,0.)); -#10853 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10853 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10854 = PCURVE('',#10622,#10855); @@ -14895,7 +14895,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10857 = CARTESIAN_POINT('',(-96.,4.8)); #10858 = VECTOR('',#10859,1.); #10859 = DIRECTION('',(0.,-1.)); -#10860 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10860 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10861 = ADVANCED_FACE('',(#10862),#10829,.T.); @@ -14918,7 +14918,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10878 = CARTESIAN_POINT('',(0.,0.)); #10879 = VECTOR('',#10880,1.); #10880 = DIRECTION('',(0.,-1.)); -#10881 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10881 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10882 = PCURVE('',#10596,#10883); @@ -14927,7 +14927,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10885 = CARTESIAN_POINT('',(72.,0.)); #10886 = VECTOR('',#10887,1.); #10887 = DIRECTION('',(0.,-1.)); -#10888 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10888 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10889 = ORIENTED_EDGE('',*,*,#10890,.T.); @@ -14943,7 +14943,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10899 = CARTESIAN_POINT('',(0.,-2.)); #10900 = VECTOR('',#10901,1.); #10901 = DIRECTION('',(1.,0.)); -#10902 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10902 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10903 = PCURVE('',#10568,#10904); @@ -14952,7 +14952,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10906 = CARTESIAN_POINT('',(0.,0.)); #10907 = VECTOR('',#10908,1.); #10908 = DIRECTION('',(-1.,0.)); -#10909 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10909 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10910 = ORIENTED_EDGE('',*,*,#10813,.F.); @@ -14969,7 +14969,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10921 = CARTESIAN_POINT('',(0.,0.)); #10922 = VECTOR('',#10923,1.); #10923 = DIRECTION('',(1.,0.)); -#10924 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10924 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10925 = PCURVE('',#10622,#10926); @@ -14978,7 +14978,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10928 = CARTESIAN_POINT('',(0.,0.)); #10929 = VECTOR('',#10930,1.); #10930 = DIRECTION('',(-1.,0.)); -#10931 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10931 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10932 = ADVANCED_FACE('',(#10933),#10596,.T.); @@ -14998,7 +14998,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10946 = CARTESIAN_POINT('',(0.,-2.)); #10947 = VECTOR('',#10948,1.); #10948 = DIRECTION('',(1.,0.)); -#10949 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10949 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10950 = PCURVE('',#10568,#10951); @@ -15007,7 +15007,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10953 = CARTESIAN_POINT('',(0.,72.)); #10954 = VECTOR('',#10955,1.); #10955 = DIRECTION('',(0.,-1.)); -#10956 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10956 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10957 = ORIENTED_EDGE('',*,*,#10865,.F.); @@ -15024,7 +15024,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10968 = CARTESIAN_POINT('',(0.,0.)); #10969 = VECTOR('',#10970,1.); #10970 = DIRECTION('',(1.,0.)); -#10971 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10971 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10972 = PCURVE('',#10622,#10973); @@ -15033,7 +15033,7 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10975 = CARTESIAN_POINT('',(0.,72.)); #10976 = VECTOR('',#10977,1.); #10977 = DIRECTION('',(0.,-1.)); -#10978 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +#10978 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' ) ); #10979 = ADVANCED_FACE('',(#10980),#10622,.F.); @@ -15054,9 +15054,9 @@ PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' #10994 = ORIENTED_EDGE('',*,*,#10790,.T.); #10995 = ORIENTED_EDGE('',*,*,#10890,.F.); #10996 = ORIENTED_EDGE('',*,*,#10937,.F.); -#10997 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) -GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#11001)) -GLOBAL_UNIT_ASSIGNED_CONTEXT((#10998,#10999,#11000)) +#10997 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#11001)) +GLOBAL_UNIT_ASSIGNED_CONTEXT((#10998,#10999,#11000)) REPRESENTATION_CONTEXT('Context #1', '3D Context with UNIT and UNCERTAINTY') ); #10998 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) ); @@ -15072,8 +15072,8 @@ REPRESENTATION_CONTEXT('Context #1', #11007 = PRODUCT_CONTEXT('',#2,'mechanical'); #11008 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design'); #11009 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#11010,#11012); -#11010 = ( REPRESENTATION_RELATIONSHIP('','',#10510,#10069) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#11011) +#11010 = ( REPRESENTATION_RELATIONSHIP('','',#10510,#10069) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#11011) SHAPE_REPRESENTATION_RELATIONSHIP() ); #11011 = ITEM_DEFINED_TRANSFORMATION('','',#11,#10074); #11012 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', @@ -15081,8 +15081,8 @@ SHAPE_REPRESENTATION_RELATIONSHIP() ); #11013 = NEXT_ASSEMBLY_USAGE_OCCURRENCE('25','','',#10064,#11004,$); #11014 = PRODUCT_RELATED_PRODUCT_CATEGORY('part',$,(#11006)); #11015 = CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#11016,#11018); -#11016 = ( REPRESENTATION_RELATIONSHIP('','',#10069,#10) -REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#11017) +#11016 = ( REPRESENTATION_RELATIONSHIP('','',#10069,#10) +REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#11017) SHAPE_REPRESENTATION_RELATIONSHIP() ); #11017 = ITEM_DEFINED_TRANSFORMATION('','',#11,#55); #11018 = PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item', diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index b18573838..edc7c6843 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -14,140 +14,125 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SHAPERGUI.h" #include "SHAPERGUI_DataModel.h" -#include "SHAPERGUI_OCCSelector.h" #include "SHAPERGUI_NestedButton.h" +#include "SHAPERGUI_OCCSelector.h" #include "SHAPERGUI_ToolbarsMgr.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 +#include +#include -#include #include +#include -#include #include +#include #include -#include #include -#include +#include #include +#include #include -#include #include +#include #if OCC_VERSION_HEX < 0x070400 - #define SALOME_PATCH_FOR_CTRL_WHEEL +#define SALOME_PATCH_FOR_CTRL_WHEEL #endif extern "C" { -SHAPERGUI_EXPORT CAM_Module* createModule() -{ - return new SHAPERGUI(); -} +SHAPERGUI_EXPORT CAM_Module *createModule() { return new SHAPERGUI(); } -SHAPERGUI_EXPORT char* getModuleVersion() -{ - return (char*)"0.0"; -} +SHAPERGUI_EXPORT char *getModuleVersion() { return (char *)"0.0"; } } // extern "C" - static const QString ToolbarsSection("SHAPER_Toolbars"); static const QString FreeCommandsParam("OutOFToolbars"); - /** -* Class for preferences management -*/ -class SHAPERGUI_PrefMgr: public ModuleBase_IPrefMgr -{ + * Class for preferences management + */ +class SHAPERGUI_PrefMgr : public ModuleBase_IPrefMgr { public: /// Constructor /// \param theMgr preferences manager of SALOME /// \param theModName name of the module - SHAPERGUI_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName): - myMgr(theMgr), myModName(theModName) {} + SHAPERGUI_PrefMgr(LightApp_Preferences *theMgr, const QString &theModName) + : myMgr(theMgr), myModName(theModName) {} - virtual int addPreference(const QString& theLbl, int pId, + virtual int addPreference(const QString &theLbl, int pId, SUIT_PreferenceMgr::PrefItemType theType, - const QString& theSection, const QString& theName ) - { - return myMgr->addPreference(myModName, theLbl, pId, theType, theSection, theName); + const QString &theSection, const QString &theName) { + return myMgr->addPreference(myModName, theLbl, pId, theType, theSection, + theName); } - virtual void setItemProperty(const QString& thePropName, - const QVariant& theValue, - const int theId = -1) - { + virtual void setItemProperty(const QString &thePropName, + const QVariant &theValue, const int theId = -1) { myMgr->setItemProperty(thePropName, theValue, theId); } - - virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; } + virtual SUIT_PreferenceMgr *prefMgr() const { return myMgr; } private: - LightApp_Preferences* myMgr; + LightApp_Preferences *myMgr; QString myModName; }; - - - //****************************************************** SHAPERGUI::SHAPERGUI() - : LightApp_Module("SHAPER"), - mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false), - myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false), - myAxisArrowRate(-1) -{ + : LightApp_Module("SHAPER"), mySelector(0), myIsOpened(0), myPopupMgr(0), + myIsInspectionVisible(false), myInspectionPanel(0), + myIsFacesPanelVisible(false), myIsToolbarsModified(false), + myAxisArrowRate(-1) { myWorkshop = new XGUI_Workshop(this); - connect(myWorkshop, SIGNAL(commandStatusUpdated()), - this, SLOT(onUpdateCommandStatus())); + connect(myWorkshop, SIGNAL(commandStatusUpdated()), this, + SLOT(onUpdateCommandStatus())); myProxyViewer = new SHAPERGUI_SalomeViewer(this); @@ -158,32 +143,31 @@ SHAPERGUI::SHAPERGUI() } //****************************************************** -SHAPERGUI::~SHAPERGUI() -{ +SHAPERGUI::~SHAPERGUI() { delete myWorkshop; delete myProxyViewer; } //****************************************************** -void SHAPERGUI::initialize(CAM_Application* theApp) -{ +void SHAPERGUI::initialize(CAM_Application *theApp) { LightApp_Module::initialize(theApp); myWorkshop->startApplication(); - LightApp_Application* anApp = dynamic_cast(theApp); - if (anApp) - { - connect(anApp, SIGNAL(preferenceResetToDefaults()), this, SLOT(onDefaultPreferences())); + LightApp_Application *anApp = dynamic_cast(theApp); + if (anApp) { + connect(anApp, SIGNAL(preferenceResetToDefaults()), this, + SLOT(onDefaultPreferences())); } int aMenu = createMenu(tr("Inspection"), -1, -1, 30); int aId = getNextCommandId(); myActionsList.append(aId); - SUIT_Desktop* aDesk = application()->desktop(); + SUIT_Desktop *aDesk = application()->desktop(); QString aTip = tr("Show inspection window"); - myWhatIsAction = createAction(aId, aTip, QIcon(":pictures/whatis.png"), tr("What Is"), - aTip, QKeySequence(), aDesk, true, this, SLOT(onWhatIs(bool))); + myWhatIsAction = createAction(aId, aTip, QIcon(":pictures/whatis.png"), + tr("What Is"), aTip, QKeySequence(), aDesk, + true, this, SLOT(onWhatIs(bool))); myWhatIsAction->setStatusTip(aTip); myWhatIsAction->setData("INSPECTION_CMD"); createMenu(aId, aMenu, 0); @@ -193,28 +177,29 @@ void SHAPERGUI::initialize(CAM_Application* theApp) #ifdef _DEBUG int aToolId = #endif - createTool(myWhatIsAction, aTool); + createTool(myWhatIsAction, aTool); registerCommandToolbar(aToolName, aId); // Define Edit toolbars command aId = getNextCommandId(); - //myActionsList.append(aId); Do not use it for editing of toolbars + // myActionsList.append(aId); Do not use it for editing of toolbars aTip = tr("Edit toolbars of the module"); #ifdef _DEBUG - QAction* aAction = + QAction *aAction = #endif - createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"), - tr("Edit toolbars..."), aTip, QKeySequence(), aDesk, false, this, SLOT(onEditToolbars())); + createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"), + tr("Edit toolbars..."), aTip, QKeySequence(), aDesk, false, + this, SLOT(onEditToolbars())); int aEditMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1, -1); #ifdef _DEBUG int aEditItem = #endif - createMenu(aId, aEditMenu); + createMenu(aId, aEditMenu); if (!myInspectionPanel) { myInspectionPanel = myWorkshop->inspectionPanel(); - connect(myInspectionPanel->toggleViewAction(), SIGNAL(toggled(bool)), - this, SLOT(onWhatIs(bool))); + connect(myInspectionPanel->toggleViewAction(), SIGNAL(toggled(bool)), this, + SLOT(onWhatIs(bool))); } hideInternalWindows(); @@ -222,35 +207,36 @@ void SHAPERGUI::initialize(CAM_Application* theApp) ViewManagerList aOCCViewManagers; application()->viewManagers(OCCViewer_Viewer::Type(), aOCCViewManagers); if (aOCCViewManagers.size() > 0) { - SUIT_ViewManager* aMgr = aOCCViewManagers.first(); - SUIT_ViewWindow* aWnd = aMgr->getActiveView(); + SUIT_ViewManager *aMgr = aOCCViewManagers.first(); + SUIT_ViewWindow *aWnd = aMgr->getActiveView(); if (aWnd) { - OCCViewer_ViewWindow* aOccWnd = static_cast(aWnd); - OCCViewer_ViewPort3d* aViewPort = aOccWnd->getViewPort(); + OCCViewer_ViewWindow *aOccWnd = static_cast(aWnd); + OCCViewer_ViewPort3d *aViewPort = aOccWnd->getViewPort(); if (aViewPort) { - XGUI_ViewerProxy* aViewer = myWorkshop->viewer(); + XGUI_ViewerProxy *aViewer = myWorkshop->viewer(); aViewPort->installEventFilter(aViewer); Handle(V3d_View) aView = aViewPort->getView(); aViewer->SetScale(aView, aView->Camera()->Scale()); - // We can not create selector here because other modules will be deactivated later - //onViewManagerAdded(aMgr); + // We can not create selector here because other modules will be + // deactivated later + // onViewManagerAdded(aMgr); } } } - SHAPERGUI_DataModel* aDataModel = dynamic_cast(dataModel()); + SHAPERGUI_DataModel *aDataModel = + dynamic_cast(dataModel()); aDataModel->initRootObject(); } //****************************************************** -void SHAPERGUI::windows(QMap& theWndMap) const -{ - theWndMap.insert(LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea); +void SHAPERGUI::windows(QMap &theWndMap) const { + theWndMap.insert(LightApp_Application::WT_PyConsole, + Qt::BottomDockWidgetArea); theWndMap.insert(LightApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea); } //****************************************************** -void SHAPERGUI::viewManagers(QStringList& theList) const -{ +void SHAPERGUI::viewManagers(QStringList &theList) const { theList.append(OCCViewer_Viewer::Type()); } @@ -258,13 +244,16 @@ void SHAPERGUI::viewManagers(QStringList& theList) const // We can not create selector in this method because it can be called when // SHAPER module is not active. Take into account that creation of our selector // leads to switching OFF all other selectors -//void SHAPERGUI::connectToStudy(CAM_Study* theStudy) +// void SHAPERGUI::connectToStudy(CAM_Study* theStudy) //{ // // if there are created viewer managers, we should try to create viewer -// // selector and initialize viewer with it. It sets interactive context to the -// // proxy viewer. If study is opened, CAM application calls this method before the open() +// // selector and initialize viewer with it. It sets interactive context to +// the +// // proxy viewer. If study is opened, CAM application calls this method +// before the open() // // of data model -// // the SHAPER data model is specific and during open(load) redisplay signals are flushed, so +// // the SHAPER data model is specific and during open(load) redisplay signals +// are flushed, so // // we need to connect to the viewer before it. Here, // // it seems the most appropriate place for this // // according to SALOME architecture. @@ -279,16 +268,16 @@ void SHAPERGUI::viewManagers(QStringList& theList) const //} //****************************************************** -bool SHAPERGUI::activateModule(SUIT_Study* theStudy) -{ - ModelAPI_Session::get()->moduleDocument(); // initialize a root document if not done yet - - // this must be done in the initialization and in activation (on the second activation - // initialization in not called, so SComponent must be added anyway - SHAPERGUI_DataModel* aDataModel = dynamic_cast(dataModel()); +bool SHAPERGUI::activateModule(SUIT_Study *theStudy) { + ModelAPI_Session::get() + ->moduleDocument(); // initialize a root document if not done yet + + // this must be done in the initialization and in activation (on the second + // activation initialization in not called, so SComponent must be added anyway + SHAPERGUI_DataModel *aDataModel = + dynamic_cast(dataModel()); aDataModel->initRootObject(); - bool isDone = LightApp_Module::activateModule(theStudy); loadToolbarsConfig(); @@ -296,8 +285,8 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) setMenuShown(true); setToolShown(true); - QObject* aObj = myWorkshop->objectBrowser()->parent(); - QDockWidget* aObjDoc = dynamic_cast(aObj); + QObject *aObj = myWorkshop->objectBrowser()->parent(); + QDockWidget *aObjDoc = dynamic_cast(aObj); if (aObjDoc) { myWorkshop->objectBrowser()->setVisible(true); aObjDoc->setVisible(true); @@ -319,16 +308,16 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) onViewManagerAdded(OCCViewManagers.first()); } } - // it should be performed after the selector creation in order to have AISContext + // it should be performed after the selector creation in order to have + // AISContext myWorkshop->activateModule(); - //action(myEraseAll)->setEnabled(false); + // action(myEraseAll)->setEnabled(false); if (myIsOpened) { myWorkshop->objectBrowser()->rebuildDataTree(); myWorkshop->updateCommandStatus(); myIsOpened = false; - } - else + } else myWorkshop->updateCommandStatus(); } myIsEditEnabled = getApp()->isEditEnabled(); @@ -340,7 +329,7 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) aContext = mySelector->viewer()->getAISContext(); if (!aContext.IsNull()) { - XGUI_Displayer* aDisp = myWorkshop->displayer(); + XGUI_Displayer *aDisp = myWorkshop->displayer(); QObjectPtrList aObjList = aDisp->displayedObjects(); if (myOldSelectionColor.size() == 0) @@ -352,7 +341,8 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) Handle(AIS_InteractiveObject) anAISIO; foreach (ObjectPtr aObj, aObjList) { AISObjectPtr aPrs = aDisp->getAISObject(aObj); - Handle(AIS_InteractiveObject) aAIS = aPrs->impl(); + Handle(AIS_InteractiveObject) aAIS = + aPrs->impl(); bool aFound = false; for (aLIt.Initialize(aList); aLIt.More(); aLIt.Next()) { anAISIO = aLIt.Value(); @@ -363,49 +353,54 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) } if (!aFound) { aObj->setDisplayed(false); - //aDisp->erase(aObj, false); + // aDisp->erase(aObj, false); } } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } myProxyViewer->activateViewer(true); - // Post-processing for LoadScriptId to remove created(if it was created) SALOME Object Browser - connect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)), - this, SLOT(onScriptLoaded())); + // Post-processing for LoadScriptId to remove created(if it was created) + // SALOME Object Browser + connect(getApp()->action(LightApp_Application::UserID + 1), + SIGNAL(triggered(bool)), this, SLOT(onScriptLoaded())); - disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), - getApp(), SLOT(onSaveDoc())); - disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), - getApp(), SLOT(onSaveAsDoc())); + disconnect(getApp()->action(LightApp_Application::FileSaveId), + SIGNAL(triggered(bool)), getApp(), SLOT(onSaveDoc())); + disconnect(getApp()->action(LightApp_Application::FileSaveAsId), + SIGNAL(triggered(bool)), getApp(), SLOT(onSaveAsDoc())); - connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), - this, SLOT(onSaveDocByShaper())); - connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), - this, SLOT(onSaveAsDocByShaper())); + connect(getApp()->action(LightApp_Application::FileSaveId), + SIGNAL(triggered(bool)), this, SLOT(onSaveDocByShaper())); + connect(getApp()->action(LightApp_Application::FileSaveAsId), + SIGNAL(triggered(bool)), this, SLOT(onSaveAsDocByShaper())); updateInfoPanel(); - //connect(myWorkshop->operationMgr(), SIGNAL(operationResumed(ModuleBase_Operation*)), - // this, SLOT(onOperationResumed(ModuleBase_Operation*))); - //connect(myWorkshop->operationMgr(), SIGNAL(operationStopped(ModuleBase_Operation*)), - // this, SLOT(onOperationStopped(ModuleBase_Operation*))); - connect(myWorkshop->operationMgr(), SIGNAL(operationCommitted(ModuleBase_Operation*)), - this, SLOT(onOperationCommitted(ModuleBase_Operation*))); - connect(myWorkshop->operationMgr(), SIGNAL(operationAborted(ModuleBase_Operation*)), - this, SLOT(onOperationAborted(ModuleBase_Operation*))); + // connect(myWorkshop->operationMgr(), + // SIGNAL(operationResumed(ModuleBase_Operation*)), + // this, SLOT(onOperationResumed(ModuleBase_Operation*))); + // connect(myWorkshop->operationMgr(), + // SIGNAL(operationStopped(ModuleBase_Operation*)), + // this, SLOT(onOperationStopped(ModuleBase_Operation*))); + connect(myWorkshop->operationMgr(), + SIGNAL(operationCommitted(ModuleBase_Operation *)), this, + SLOT(onOperationCommitted(ModuleBase_Operation *))); + connect(myWorkshop->operationMgr(), + SIGNAL(operationAborted(ModuleBase_Operation *)), this, + SLOT(onOperationAborted(ModuleBase_Operation *))); return isDone; } //****************************************************** -void SHAPERGUI::hideInternalWindows() -{ +void SHAPERGUI::hideInternalWindows() { myProxyViewer->activateViewer(false); setMenuShown(false); setToolShown(false); - QObject* aObj = myWorkshop->objectBrowser()->parent(); - QDockWidget* aObjDoc = dynamic_cast(aObj); + QObject *aObj = myWorkshop->objectBrowser()->parent(); + QDockWidget *aObjDoc = dynamic_cast(aObj); if (aObjDoc) { aObjDoc->setVisible(false); myWorkshop->objectBrowser()->setVisible(false); @@ -424,10 +419,8 @@ void SHAPERGUI::hideInternalWindows() myWorkshop->hidePanel(myWorkshop->facesPanel()); } - //****************************************************** -bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) -{ +bool SHAPERGUI::deactivateModule(SUIT_Study *theStudy) { saveToolbarsConfig(); myWorkshop->deactivateModule(); @@ -435,13 +428,13 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) myIsFacesPanelVisible = myWorkshop->facesPanel()->isVisible(); hideInternalWindows(); - // the active operation should be stopped for the next activation. // There should not be active operation and visualized preview. // Abort operation should be performed before the selection's remove // because the displayed objects should be removed from the viewer, but // the AIS context is obtained from the selector. - ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); + ModuleBase_Operation *anOperation = + myWorkshop->operationMgr()->currentOperation(); while (anOperation) { anOperation->abort(); anOperation = myWorkshop->operationMgr()->currentOperation(); @@ -451,18 +444,21 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) // Restore size of arrows of trihedron if (myAxisArrowRate > 0) { Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron(); - Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); - aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate); - Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext(); + Handle(Prs3d_DatumAspect) aDatumAspect = + aTrihedron->Attributes()->DatumAspect(); + aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, + myAxisArrowRate); + Handle(AIS_InteractiveContext) aContext = + mySelector->viewer()->getAISContext(); aContext->Redisplay(aTrihedron, false); } myWorkshop->displayer()->setSelectionColor(myOldSelectionColor); myProxyViewer->setSelector(0); - LightApp_SelectionMgr* aMgr = getApp()->selectionMgr(); - QList aList; + LightApp_SelectionMgr *aMgr = getApp()->selectionMgr(); + QList aList; aMgr->selectors(aList); - foreach(SUIT_Selector* aSel, aList) { + foreach (SUIT_Selector *aSel, aList) { aSel->setEnabled(aSel != mySelector); } @@ -470,25 +466,26 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) mySelector = 0; } - //myWorkshop->contextMenuMgr()->disconnectViewer(); + // myWorkshop->contextMenuMgr()->disconnectViewer(); getApp()->setEditEnabled(myIsEditEnabled); myOldSelectionColor.clear(); - // Post-processing for LoadScriptId to remove created(if it was created) SALOME Object Browser - disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)), - this, SLOT(onScriptLoaded())); + // Post-processing for LoadScriptId to remove created(if it was created) + // SALOME Object Browser + disconnect(getApp()->action(LightApp_Application::UserID + 1), + SIGNAL(triggered(bool)), this, SLOT(onScriptLoaded())); - disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), - this, SLOT(onSaveDocByShaper())); - disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), - this, SLOT(onSaveAsDocByShaper())); + disconnect(getApp()->action(LightApp_Application::FileSaveId), + SIGNAL(triggered(bool)), this, SLOT(onSaveDocByShaper())); + disconnect(getApp()->action(LightApp_Application::FileSaveAsId), + SIGNAL(triggered(bool)), this, SLOT(onSaveAsDocByShaper())); - connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)), - getApp(), SLOT(onSaveDoc())); - connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)), - getApp(), SLOT(onSaveAsDoc())); + connect(getApp()->action(LightApp_Application::FileSaveId), + SIGNAL(triggered(bool)), getApp(), SLOT(onSaveDoc())); + connect(getApp()->action(LightApp_Application::FileSaveAsId), + SIGNAL(triggered(bool)), getApp(), SLOT(onSaveAsDoc())); publishToStudy(); @@ -496,55 +493,43 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) } //****************************************************** -void SHAPERGUI::logShaperGUIEvent() -{ - QAction* anAction = static_cast(sender()); - if ( !anAction ) +void SHAPERGUI::logShaperGUIEvent() { + QAction *anAction = static_cast(sender()); + if (!anAction) return; const QString anId = anAction->data().toString(); const QString section = anId.contains("Sketch") ? "sketcher" : ""; - CAM_Application::logStructuredUserEvent( moduleName(), - section, - anAction->text(), - "activated" ); + CAM_Application::logStructuredUserEvent(moduleName(), section, + anAction->text(), "activated"); } //****************************************************** -static void onOperationGeneric( ModuleBase_Operation* theOperation, - const QString moduleName, - const QString &event ) -{ +static void onOperationGeneric(ModuleBase_Operation *theOperation, + const QString moduleName, const QString &event) { QString anId = theOperation->id(); QString section = ""; - if (anId.contains("Sketch")) - { + if (anId.contains("Sketch")) { section = "sketcher"; anId.remove("Sketch"); } - CAM_Application::logStructuredUserEvent( moduleName, - section, - anId, - event ); + CAM_Application::logStructuredUserEvent(moduleName, section, anId, event); } //****************************************************** -void SHAPERGUI::onOperationCommitted(ModuleBase_Operation* theOperation) -{ +void SHAPERGUI::onOperationCommitted(ModuleBase_Operation *theOperation) { onOperationGeneric(theOperation, moduleName(), "committed"); } //****************************************************** -void SHAPERGUI::onOperationAborted(ModuleBase_Operation* theOperation) -{ +void SHAPERGUI::onOperationAborted(ModuleBase_Operation *theOperation) { onOperationGeneric(theOperation, moduleName(), "aborted"); } //****************************************************** -void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager* theMgr) -{ +void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager *theMgr) { if (!mySelector) { mySelector = createSelector(theMgr); myWorkshop->selectionActivate()->updateSelectionFilters(); @@ -552,27 +537,29 @@ void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager* theMgr) myWorkshop->synchronizeViewer(); } if (theMgr->getType() == OCCViewer_Viewer::Type()) { - // Set the auto rotate flag in the new viewer based on the current preference - OCCViewer_ViewManager *aVM = (OCCViewer_ViewManager*)theMgr; - bool aAutoRotation = Config_PropManager::boolean("Visualization", "use_auto_rotation"); + // Set the auto rotate flag in the new viewer based on the current + // preference + OCCViewer_ViewManager *aVM = (OCCViewer_ViewManager *)theMgr; + bool aAutoRotation = + Config_PropManager::boolean("Visualization", "use_auto_rotation"); aVM->setAutoRotation(aAutoRotation); - connect(theMgr, SIGNAL(viewCreated(SUIT_ViewWindow*)), - myProxyViewer, SLOT(onViewCreated(SUIT_ViewWindow*))); + connect(theMgr, SIGNAL(viewCreated(SUIT_ViewWindow *)), myProxyViewer, + SLOT(onViewCreated(SUIT_ViewWindow *))); } } //****************************************************** -void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager* theMgr) -{ +void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager *theMgr) { if (mySelector) { if (theMgr->getType() == OCCViewer_Viewer::Type()) { - OCCViewer_Viewer* aViewer = static_cast(theMgr->getViewModel()); + OCCViewer_Viewer *aViewer = + static_cast(theMgr->getViewModel()); if (mySelector->viewer() == aViewer) { - XGUI_Displayer* aDisp = myWorkshop->displayer(); + XGUI_Displayer *aDisp = myWorkshop->displayer(); QObjectPtrList aObjects = aDisp->displayedObjects(); ResultPtr aRes; - foreach(ObjectPtr aObj, aObjects) { + foreach (ObjectPtr aObj, aObjects) { aObj->setDisplayed(false); aRes = std::dynamic_pointer_cast(aObj); if (aRes.get()) { @@ -581,7 +568,8 @@ void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager* theMgr) } } } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); myProxyViewer->setSelector(0); delete mySelector; mySelector = 0; @@ -593,16 +581,14 @@ void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager* theMgr) } //****************************************************** -QtxPopupMgr* SHAPERGUI::popupMgr() -{ +QtxPopupMgr *SHAPERGUI::popupMgr() { if (!myPopupMgr) - myPopupMgr = new QtxPopupMgr( 0, this ); + myPopupMgr = new QtxPopupMgr(0, this); return myPopupMgr; } //****************************************************** -void SHAPERGUI::onDefaultPreferences() -{ +void SHAPERGUI::onDefaultPreferences() { // reset main resources ModuleBase_Preferences::resetResourcePreferences(preferences()); // reset plugin's resources @@ -612,14 +598,14 @@ void SHAPERGUI::onDefaultPreferences() } //****************************************************** -void SHAPERGUI::onScriptLoaded() -{ - // this slot is called after processing of the LoadScriptId action of SalomeApp Application - // Each dumped script contains updateObjBrowser() that creates a new instance of Object - // Browser. When SHAPER module is active, this browser should not be used. It might be removed - // as hidden by means of updateWindows() of SalomeApp_Application or to remove - // it manually (because this method of application is protected) - SUIT_DataBrowser* aBrowser = getApp()->objectBrowser(); +void SHAPERGUI::onScriptLoaded() { + // this slot is called after processing of the LoadScriptId action of + // SalomeApp Application Each dumped script contains updateObjBrowser() that + // creates a new instance of Object Browser. When SHAPER module is active, + // this browser should not be used. It might be removed as hidden by means of + // updateWindows() of SalomeApp_Application or to remove it manually (because + // this method of application is protected) + SUIT_DataBrowser *aBrowser = getApp()->objectBrowser(); if (aBrowser) delete aBrowser; myWorkshop->displayer()->updateViewer(); @@ -627,55 +613,56 @@ void SHAPERGUI::onScriptLoaded() } //****************************************************** -void SHAPERGUI::onSaveDocByShaper() -{ - if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage)) +void SHAPERGUI::onSaveDocByShaper() { + if (!workshop()->operationMgr()->abortAllOperations( + XGUI_OperationMgr::XGUI_InformationMessage)) return; getApp()->onSaveDoc(); } //****************************************************** -void SHAPERGUI::onSaveAsDocByShaper() -{ - if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage)) +void SHAPERGUI::onSaveAsDocByShaper() { + if (!workshop()->operationMgr()->abortAllOperations( + XGUI_OperationMgr::XGUI_InformationMessage)) return; getApp()->onSaveAsDoc(); } //****************************************************** -void SHAPERGUI::onUpdateCommandStatus() -{ +void SHAPERGUI::onUpdateCommandStatus() { getApp()->updateActions(); - LightApp_Application* aApp = dynamic_cast(application()); - QtxInfoPanel* aInfoPanel = aApp->infoPanel(); + LightApp_Application *aApp = + dynamic_cast(application()); + QtxInfoPanel *aInfoPanel = aApp->infoPanel(); if (aInfoPanel->isVisible()) updateInfoPanel(); } //****************************************************** -SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr) -{ +SHAPERGUI_OCCSelector *SHAPERGUI::createSelector(SUIT_ViewManager *theMgr) { if (theMgr->getType() == OCCViewer_Viewer::Type()) { - OCCViewer_Viewer* aViewer = static_cast(theMgr->getViewModel()); + OCCViewer_Viewer *aViewer = + static_cast(theMgr->getViewModel()); // Remember current length of arrow of axis Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron(); - Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); - myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); + Handle(Prs3d_DatumAspect) aDatumAspect = + aTrihedron->Attributes()->DatumAspect(); + myAxisArrowRate = + aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); - SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer, - getApp()->selectionMgr()); + SHAPERGUI_OCCSelector *aSelector = + new SHAPERGUI_OCCSelector(aViewer, getApp()->selectionMgr()); #ifdef SALOME_PATCH_FOR_CTRL_WHEEL aViewer->setUseLocalSelection(true); #endif - LightApp_SelectionMgr* aMgr = getApp()->selectionMgr(); - QList aList; + LightApp_SelectionMgr *aMgr = getApp()->selectionMgr(); + QList aList; aMgr->selectors(aList); - foreach(SUIT_Selector* aSel, aList) - { + foreach (SUIT_Selector *aSel, aList) { aSel->setEnabled(aSel == aSelector); } myProxyViewer->setSelector(aSelector); @@ -683,7 +670,8 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr) if (myOldSelectionColor.size() == 0) myOldSelectionColor = myWorkshop->displayer()->selectionColor(); - std::vector aColor = Config_PropManager::color("Visualization", "selection_color"); + std::vector aColor = + Config_PropManager::color("Visualization", "selection_color"); myWorkshop->displayer()->setSelectionColor(aColor); // Cause scaling of arrows of axis and dimensions @@ -695,34 +683,28 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr) } //****************************************************** -CAM_DataModel* SHAPERGUI::createDataModel() -{ +CAM_DataModel *SHAPERGUI::createDataModel() { return new SHAPERGUI_DataModel(this); } -QAction* SHAPERGUI::addFeature(const QString& theWBName, const ActionInfo& theInfo, - const bool isAddSeparator) -{ - return addFeature(theWBName, - theInfo.toolBar, - theInfo.id, - theInfo.text, - //Issue #650: in the SALOME mode the tooltip should be same as text - theInfo.text, - theInfo.icon, - theInfo.shortcut, - theInfo.checkable, - isAddSeparator, - theInfo.toolTip); +QAction *SHAPERGUI::addFeature(const QString &theWBName, + const ActionInfo &theInfo, + const bool isAddSeparator) { + return addFeature( + theWBName, theInfo.toolBar, theInfo.id, theInfo.text, + // Issue #650: in the SALOME mode the tooltip should be same as text + theInfo.text, theInfo.icon, theInfo.shortcut, theInfo.checkable, + isAddSeparator, theInfo.toolTip); } //****************************************************** -QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBName, - const QString& theId, const QString& theTitle, const QString& theTip, - const QIcon& theIcon, const QKeySequence& theKeys, - bool isCheckable, const bool isAddSeparator, - const QString& theStatusTip) -{ +QAction *SHAPERGUI::addFeature(const QString &theWBName, + const QString &theTBName, const QString &theId, + const QString &theTitle, const QString &theTip, + const QIcon &theIcon, + const QKeySequence &theKeys, bool isCheckable, + const bool isAddSeparator, + const QString &theStatusTip) { static QString aLastTool = ""; static int aNb = 0; if (aLastTool.isEmpty()) @@ -738,25 +720,25 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam int aId = getNextCommandId(); myActionsList.append(aId); - SUIT_Desktop* aDesk = application()->desktop(); + SUIT_Desktop *aDesk = application()->desktop(); int aKeys = 0; for (int i = 0; i < theKeys.count(); i++) aKeys += theKeys[i]; - QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk, - isCheckable); + QAction *aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, + aDesk, isCheckable); aAction->setStatusTip(theStatusTip); aAction->setData(theId); - int aWBMenu = createMenu(theWBName, -1, -1, 30/*10-Window, 1000 - Help*/); + int aWBMenu = createMenu(theWBName, -1, -1, 30 /*10-Window, 1000 - Help*/); - if( theId == "PointCoordinates" ) + if (theId == "PointCoordinates") createMenu(separator(), aWBMenu); #ifdef _DEBUG int aItemId = #endif - createMenu(aId, aWBMenu); + createMenu(aId, aWBMenu); if (isAddSeparator) createMenu(separator(), aWBMenu); @@ -765,7 +747,7 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam #ifdef _DEBUG int aToolId = #endif - createTool(aId, aWBTool); + createTool(aId, aWBTool); registerCommandToolbar(theTBName, aId); if (isAddSeparator) { createTool(separator(), aWBTool); @@ -775,17 +757,17 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam return aAction; } -bool SHAPERGUI::isFeatureOfNested(const QAction* theAction) -{ - return dynamic_cast(theAction); +bool SHAPERGUI::isFeatureOfNested(const QAction *theAction) { + return dynamic_cast(theAction); } -QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName, - const ActionInfo& theInfo, - const QList& theNestedActions) -{ - SUIT_Desktop* aDesk = application()->desktop(); - SHAPERGUI_NestedButton* anAction = new SHAPERGUI_NestedButton(aDesk, theNestedActions); +QAction * +SHAPERGUI::addFeatureOfNested(const QString &theWBName, + const ActionInfo &theInfo, + const QList &theNestedActions) { + SUIT_Desktop *aDesk = application()->desktop(); + SHAPERGUI_NestedButton *anAction = + new SHAPERGUI_NestedButton(aDesk, theNestedActions); anAction->setData(theInfo.id); anAction->setCheckable(theInfo.checkable); anAction->setChecked(theInfo.checked); @@ -800,15 +782,17 @@ QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName, int aWBMenu = createMenu(theWBName, -1, -1, 30); int aItemId = createMenu(anAction, aWBMenu); myActionsList.append(aItemId); - createMenu(separator(), aWBMenu); /// nested action is always separated of others + createMenu(separator(), + aWBMenu); /// nested action is always separated of others int aWBTool = createTool(theWBName, theWBName); #ifdef _DEBUG int aToolId = #endif - createTool(anAction, aWBTool); + createTool(anAction, aWBTool); registerCommandToolbar(theWBName, aItemId); - createTool(separator(), aWBTool); /// nested action is always separated of others + createTool(separator(), + aWBTool); /// nested action is always separated of others registerCommandToolbar(theWBName, -1); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(logShaperGUIEvent())); @@ -816,28 +800,24 @@ QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName, return anAction; } - //****************************************************** -QAction* SHAPERGUI::addDesktopCommand(const QString& theId, const QString& theTitle, - const QString& theTip, const QIcon& theIcon, - const QKeySequence& theKeys, bool isCheckable, - const char* theMenuSourceText, - const QString& theSubMenu, - const int theMenuPosition, - const int theSuibMenuPosition) -{ +QAction *SHAPERGUI::addDesktopCommand( + const QString &theId, const QString &theTitle, const QString &theTip, + const QIcon &theIcon, const QKeySequence &theKeys, bool isCheckable, + const char *theMenuSourceText, const QString &theSubMenu, + const int theMenuPosition, const int theSuibMenuPosition) { int aMenu = createMenu(tr(theMenuSourceText), -1, -1); if (!theSubMenu.isNull()) aMenu = createMenu(theSubMenu, aMenu, -1, theSuibMenuPosition); int aId = getNextCommandId(); myActionsList.append(aId); - SUIT_Desktop* aDesk = application()->desktop(); + SUIT_Desktop *aDesk = application()->desktop(); int aKeys = 0; for (int i = 0; i < theKeys.count(); i++) aKeys += theKeys[i]; - QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk, - isCheckable); + QAction *aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, + aDesk, isCheckable); aAction->setStatusTip(theTip); aAction->setData(theId); createMenu(aId, aMenu, theMenuPosition); @@ -848,36 +828,35 @@ QAction* SHAPERGUI::addDesktopCommand(const QString& theId, const QString& theTi } //****************************************************** -void SHAPERGUI::addDesktopMenuSeparator(const char* theMenuSourceText, const int theMenuPosition) -{ +void SHAPERGUI::addDesktopMenuSeparator(const char *theMenuSourceText, + const int theMenuPosition) { int aMenu = createMenu(tr(theMenuSourceText), -1, -1); createMenu(separator(), aMenu, -1, theMenuPosition); } //****************************************************** -bool SHAPERGUI::addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) -{ - if( !theAction ) +bool SHAPERGUI::addActionInToolbar(QAction *theAction, + const QString &theToolBarTitle) { + if (!theAction) return false; - SUIT_Desktop* aDesktop = application()->desktop(); - if( !aDesktop ) + SUIT_Desktop *aDesktop = application()->desktop(); + if (!aDesktop) return false; - QtxActionToolMgr* aToolMgr = aDesktop->toolMgr(); - if( !aToolMgr ) + QtxActionToolMgr *aToolMgr = aDesktop->toolMgr(); + if (!aToolMgr) return false; - aToolMgr->append( theAction, theToolBarTitle ); + aToolMgr->append(theAction, theToolBarTitle); return true; } //****************************************************** -QList SHAPERGUI::commandList() const -{ - QList aActions; +QList SHAPERGUI::commandList() const { + QList aActions; foreach (int aId, myActionsList) { - QAction* aCmd = action(aId); + QAction *aCmd = action(aId); if (aCmd) aActions.append(aCmd); } @@ -886,58 +865,52 @@ QList SHAPERGUI::commandList() const } //****************************************************** -QMainWindow* SHAPERGUI::desktop() const -{ - return application()->desktop(); -} +QMainWindow *SHAPERGUI::desktop() const { return application()->desktop(); } -void SHAPERGUI::setFeatureInfo(const QString& theFeatureId, - const std::shared_ptr& theMessage) -{ +void SHAPERGUI::setFeatureInfo( + const QString &theFeatureId, + const std::shared_ptr &theMessage) { myFeaturesInfo.insert(theFeatureId, theMessage); } -std::shared_ptr SHAPERGUI::featureInfo(const QString& theFeatureId) -{ +std::shared_ptr +SHAPERGUI::featureInfo(const QString &theFeatureId) { std::shared_ptr aMessage; if (myFeaturesInfo.contains(theFeatureId)) - aMessage = myFeaturesInfo[theFeatureId]; + aMessage = myFeaturesInfo[theFeatureId]; return aMessage; } //****************************************************** -void SHAPERGUI::selectionChanged() -{ +void SHAPERGUI::selectionChanged() { LightApp_Module::selectionChanged(); myWorkshop->salomeViewerSelectionChanged(); } //****************************************************** -void SHAPERGUI::contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle) -{ +void SHAPERGUI::contextMenuPopup(const QString &theClient, QMenu *theMenu, + QString &theTitle) { myWorkshop->contextMenuMgr()->updateViewerMenu(); myWorkshop->contextMenuMgr()->addViewerMenu(theMenu); LightApp_Module::contextMenuPopup(theClient, theMenu, theTitle); } - //****************************************************** -void SHAPERGUI::createPreferences() -{ - LightApp_Preferences* aPref = preferences(); +void SHAPERGUI::createPreferences() { + LightApp_Preferences *aPref = preferences(); if (!aPref) return; ModuleBase_Preferences::updateConfigByResources(); QString aModName = moduleName(); - QtxPreferenceItem* item = aPref->findItem(aModName, true ); - if ( item && (!item->isEmpty() )) { + QtxPreferenceItem *item = aPref->findItem(aModName, true); + if (item && (!item->isEmpty())) { item->parentItem()->removeItem(item); delete item; } - int catId = aPref->addPreference(aModName, -1 ); - if ( catId == -1 ) + int catId = aPref->addPreference(aModName, -1); + if (catId == -1) return; SHAPERGUI_PrefMgr aMgr(aPref, aModName); ModuleBase_Preferences::createEditContent(&aMgr, catId); @@ -946,89 +919,100 @@ void SHAPERGUI::createPreferences() // Create other parameters group in viewer tab int otherGroup = aPref->addItem(tr("Default selection"), viewTab); aPref->setItemProperty("columns", 3, otherGroup); - aPref->addItem(tr("Faces"), otherGroup, - SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::VIEWER_SECTION, "face-selection"); - aPref->addItem(tr("Edges"), otherGroup, - SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::VIEWER_SECTION, "edge-selection"); - aPref->addItem(tr("Vertices"), otherGroup, - SUIT_PreferenceMgr::Bool, - ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection"); + aPref->addItem(tr("Faces"), otherGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "face-selection"); + aPref->addItem(tr("Edges"), otherGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "edge-selection"); + aPref->addItem(tr("Vertices"), otherGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection"); int sensitivityGroup = aPref->addItem(tr("Selection sensitivity"), viewTab); aPref->setItemProperty("columns", 2, sensitivityGroup); aPref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, - ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity"); + ModuleBase_Preferences::VIEWER_SECTION, + "point-selection-sensitivity"); aPref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, - ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity"); + ModuleBase_Preferences::VIEWER_SECTION, + "edge-selection-sensitivity"); int highlightGroup = aPref->addItem(tr("Additional highlighting"), viewTab); aPref->setItemProperty("columns", 2, highlightGroup); - aPref->addItem(tr("In 3d mode"), highlightGroup, - SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d"); - aPref->addItem(tr("In 2d mode"), highlightGroup, - SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d"); + aPref->addItem(tr("In 3d mode"), highlightGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d"); + aPref->addItem(tr("In 2d mode"), highlightGroup, SUIT_PreferenceMgr::Bool, + ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d"); int colorScaleGroup = aPref->addItem(tr("Color scale"), viewTab); aPref->setItemProperty("columns", 4, colorScaleGroup); - int aItem = aMgr.addPreference(tr("X position"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position"); + int aItem = aMgr.addPreference( + tr("X position"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position"); aPref->setItemProperty("min", 0, aItem); aPref->setItemProperty("max", 1, aItem); - aItem = aMgr.addPreference(tr("Y position"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position"); + aItem = aMgr.addPreference( + tr("Y position"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position"); aPref->setItemProperty("min", 0, aItem); aPref->setItemProperty("max", 1, aItem); - aItem = aMgr.addPreference(tr("Width"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width"); + aItem = aMgr.addPreference( + tr("Width"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width"); aPref->setItemProperty("min", 0, aItem); aPref->setItemProperty("max", 1, aItem); - aItem = aMgr.addPreference(tr("Height"), colorScaleGroup, - SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height"); + aItem = aMgr.addPreference( + tr("Height"), colorScaleGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height"); aPref->setItemProperty("min", 0, aItem); aPref->setItemProperty("max", 1, aItem); - aItem = aMgr.addPreference(tr("Intervals number"), colorScaleGroup, - SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals"); + aItem = aMgr.addPreference( + tr("Intervals number"), colorScaleGroup, SUIT_PreferenceMgr::Integer, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals"); aPref->setItemProperty("min", 0, aItem); aPref->setItemProperty("max", 100, aItem); - aItem = aMgr.addPreference(tr("Text height"), colorScaleGroup, - SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height"); + aItem = aMgr.addPreference( + tr("Text height"), colorScaleGroup, SUIT_PreferenceMgr::Integer, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height"); aPref->setItemProperty("min", 0, aItem); aPref->setItemProperty("max", 100, aItem); - aItem = aMgr.addPreference(tr("Text color"), colorScaleGroup, - SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color"); + aItem = aMgr.addPreference( + tr("Text color"), colorScaleGroup, SUIT_PreferenceMgr::Color, + ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color"); - int aGroupNamesGroup = aMgr.addPreference(tr("Group names display"), viewTab, - SUIT_PreferenceMgr::GroupBox , ModuleBase_Preferences::VIEWER_SECTION, "group_names_display"); + int aGroupNamesGroup = aMgr.addPreference( + tr("Group names display"), viewTab, SUIT_PreferenceMgr::GroupBox, + ModuleBase_Preferences::VIEWER_SECTION, "group_names_display"); aPref->setItemProperty("columns", 3, aGroupNamesGroup); - aMgr.addPreference(tr("Text font"), aGroupNamesGroup, - SUIT_PreferenceMgr::String, ModuleBase_Preferences::VIEWER_SECTION, "group_names_font"); - aItem = aMgr.addPreference(tr("Text size"), aGroupNamesGroup, - SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "group_names_size"); + aMgr.addPreference( + tr("Text font"), aGroupNamesGroup, SUIT_PreferenceMgr::String, + ModuleBase_Preferences::VIEWER_SECTION, "group_names_font"); + aItem = aMgr.addPreference( + tr("Text size"), aGroupNamesGroup, SUIT_PreferenceMgr::Integer, + ModuleBase_Preferences::VIEWER_SECTION, "group_names_size"); aPref->setItemProperty("min", 8, aItem); aPref->setItemProperty("max", 100, aItem); - aItem = aMgr.addPreference(tr("Text color"), aGroupNamesGroup, - SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "group_names_color"); + aItem = aMgr.addPreference( + tr("Text color"), aGroupNamesGroup, SUIT_PreferenceMgr::Color, + ModuleBase_Preferences::VIEWER_SECTION, "group_names_color"); aPref->retrieve(); } //****************************************************** -void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& theParam) -{ - SUIT_ResourceMgr* aResMgr = application()->resourceMgr(); +void SHAPERGUI::preferencesChanged(const QString &theSection, + const QString &theParam) { + SUIT_ResourceMgr *aResMgr = application()->resourceMgr(); QString aVal = aResMgr->stringValue(theSection, theParam); - Config_Prop* aProp = Config_PropManager::findProp(theSection.toStdString(), + Config_Prop *aProp = Config_PropManager::findProp(theSection.toStdString(), theParam.toStdString()); if (!aProp) - return; // invalid case, the property default value must be registered in XML file + return; // invalid case, the property default value must be registered in + // XML file std::string aValue = aVal.toStdString(); if (aValue.empty()) { aValue = aProp->defaultValue(); aResMgr->setValue(theSection, theParam, QString(aValue.c_str())); - LightApp_Preferences* aPref = preferences(); + LightApp_Preferences *aPref = preferences(); if (aPref) aPref->retrieve(); } @@ -1036,91 +1020,96 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the if (theSection == "Visualization") { if (theParam == "selection_color") { - std::vector aColor = Config_PropManager::color("Visualization", "selection_color"); + std::vector aColor = + Config_PropManager::color("Visualization", "selection_color"); myWorkshop->displayer()->setSelectionColor(aColor); } - if ((theParam == "zoom_trihedron_arrows") || (theParam == "axis_arrow_size")) { + if ((theParam == "zoom_trihedron_arrows") || + (theParam == "axis_arrow_size")) { if (mySelector) { Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron(); if (!aTrihedron.IsNull()) { - bool aZoom = Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows"); - Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext(); + bool aZoom = Config_PropManager::boolean("Visualization", + "zoom_trihedron_arrows"); + Handle(AIS_InteractiveContext) aContext = + mySelector->viewer()->getAISContext(); - ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->viewer(); Handle(V3d_View) aView = aViewer->activeView(); if (aZoom) { - double aAxLen = - aView->Convert(Config_PropManager::integer("Visualization", "axis_arrow_size")); - Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); + double aAxLen = aView->Convert(Config_PropManager::integer( + "Visualization", "axis_arrow_size")); + Handle(Prs3d_DatumAspect) aDatumAspect = + aTrihedron->Attributes()->DatumAspect(); double aAxisLen = aDatumAspect->AxisLength(Prs3d_DP_XAxis); - myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); - aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen); + myAxisArrowRate = + aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); + aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, + aAxLen / aAxisLen); aTrihedron->Attributes()->SetDatumAspect(aDatumAspect); aContext->Redisplay(aTrihedron, true); - } - else if (myAxisArrowRate > 0) { - Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); - aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate); + } else if (myAxisArrowRate > 0) { + Handle(Prs3d_DatumAspect) aDatumAspect = + aTrihedron->Attributes()->DatumAspect(); + aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, + myAxisArrowRate); aContext->Redisplay(aTrihedron, true); } } } } if (theParam == "use_auto_rotation") { - bool aAutoRotation = Config_PropManager::boolean("Visualization", "use_auto_rotation"); + bool aAutoRotation = + Config_PropManager::boolean("Visualization", "use_auto_rotation"); // Update the auto rotation flag in all OCC 3D view windows ViewManagerList lst; getApp()->viewManagers(OCCViewer_Viewer::Type(), lst); - for ( auto it = lst.begin(); it != lst.end(); ++it ) - { - OCCViewer_ViewManager *aVMgr = dynamic_cast(*it); + for (auto it = lst.begin(); it != lst.end(); ++it) { + OCCViewer_ViewManager *aVMgr = + dynamic_cast(*it); if (aVMgr) { aVMgr->setAutoRotation(aAutoRotation); } } } - } - else if (theSection == ModuleBase_Preferences::GENERAL_SECTION && theParam == "create_init_part") { + } else if (theSection == ModuleBase_Preferences::GENERAL_SECTION && + theParam == "create_init_part") { bool aCreate = ModuleBase_Preferences::resourceMgr()->booleanValue( - ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true); - Events_MessageBool aCreateMsg(Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate); + ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true); + Events_MessageBool aCreateMsg( + Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate); aCreateMsg.send(); - } - else if (theSection == ModuleBase_Preferences::VIEWER_SECTION && - theParam.startsWith("group_names_")) - { // one of the group names parameter changed, so, update the groups names vizualization + } else if (theSection == ModuleBase_Preferences::VIEWER_SECTION && + theParam.startsWith( + "group_names_")) { // one of the group names parameter changed, + // so, update the groups names vizualization myWorkshop->updateGroupsText(); myWorkshop->displayer()->updateViewer(); } myWorkshop->displayer()->redisplayObjects(); } -void SHAPERGUI::putInfo(const QString& theInfo, const int theMSecs) -{ +void SHAPERGUI::putInfo(const QString &theInfo, const int theMSecs) { application()->putInfo(theInfo, theMSecs); } -bool SHAPERGUI::abortAllOperations() -{ +bool SHAPERGUI::abortAllOperations() { return workshop()->operationMgr()->abortAllOperations(); } -void SHAPERGUI::createFeatureActions() -{ +void SHAPERGUI::createFeatureActions() { myWorkshop->menuMgr()->createFeatureActions(); } -void SHAPERGUI::onWhatIs(bool isToggled) -{ +void SHAPERGUI::onWhatIs(bool isToggled) { if (sender() == myWhatIsAction) { - QAction* aViewAct = myInspectionPanel->toggleViewAction(); + QAction *aViewAct = myInspectionPanel->toggleViewAction(); aViewAct->blockSignals(true); aViewAct->setChecked(isToggled); aViewAct->blockSignals(false); myInspectionPanel->setVisible(isToggled); - } - else { + } else { myWhatIsAction->blockSignals(true); myWhatIsAction->setChecked(isToggled); myWhatIsAction->blockSignals(false); @@ -1128,8 +1117,7 @@ void SHAPERGUI::onWhatIs(bool isToggled) } } -void SHAPERGUI::updateModuleVisibilityState() -{ +void SHAPERGUI::updateModuleVisibilityState() { LightApp_Module::updateModuleVisibilityState(); onWhatIs(myIsInspectionVisible); @@ -1138,14 +1126,13 @@ void SHAPERGUI::updateModuleVisibilityState() // load it after the module activation. So, if the panel is visible before // deactivate, it becomes visible after activate. // In order to avoid the visible property panel, we hide it here - ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); + ModuleBase_Operation *anOperation = myWorkshop->module()->currentOperation(); if (!anOperation) { myWorkshop->hidePanel(myWorkshop->propertyPanel()); } } -void SHAPERGUI::onEditToolbars() -{ +void SHAPERGUI::onEditToolbars() { SHAPERGUI_ToolbarsDlg aDlg(this); if (aDlg.exec() == QDialog::Accepted) { if (aDlg.isReset()) @@ -1155,16 +1142,15 @@ void SHAPERGUI::onEditToolbars() } } -void SHAPERGUI::registerCommandToolbar(const QString& theToolName, int theCommandId) -{ +void SHAPERGUI::registerCommandToolbar(const QString &theToolName, + int theCommandId) { if (!myToolbars.contains(theToolName)) myToolbars[theToolName] = QList(); myToolbars[theToolName].append(theCommandId); } -int SHAPERGUI::getNextCommandId() const -{ - QtxActionMenuMgr* aMenuMgr = menuMgr(); +int SHAPERGUI::getNextCommandId() const { + QtxActionMenuMgr *aMenuMgr = menuMgr(); QIntList aIds = aMenuMgr->idList(); int aId = aIds.count(); while (action(aId) || myActionsList.contains(aId)) @@ -1172,30 +1158,28 @@ int SHAPERGUI::getNextCommandId() const return aId; } -void SHAPERGUI::updateToolbars(const QMap& theNewToolbars) -{ +void SHAPERGUI::updateToolbars(const QMap &theNewToolbars) { // Store default toolbars if (myDefaultToolbars.size() == 0) myDefaultToolbars = myToolbars; - QtxActionToolMgr* aMgr = toolMgr(); + QtxActionToolMgr *aMgr = toolMgr(); QStringList aToolbars = theNewToolbars.keys(); QIntList aCommands, aOldCmd; int aToolbarId; - QAction* aAction; + QAction *aAction; int aActionId; - foreach(QString aName, aToolbars) { + foreach (QString aName, aToolbars) { aCommands = theNewToolbars[aName]; // Find or create toolbar if (aMgr->hasToolBar(aName)) { aToolbarId = aMgr->find(aMgr->toolBar(aName)); aOldCmd = myToolbars[aName]; - } - else { + } else { aToolbarId = aMgr->createToolBar(aName); } int aPos = 0; - foreach(int aCmd, aCommands) { + foreach (int aCmd, aCommands) { // Find action if (aCmd == -1) aAction = separator(); @@ -1205,8 +1189,7 @@ void SHAPERGUI::updateToolbars(const QMap& theNewToolbars) if (aActionId == -1) { // Add new action aMgr->insert(aAction, aToolbarId, aPos); - } - else { + } else { // Change position of action if (aMgr->index(aActionId, aToolbarId) != aPos) { if (aMgr->containsAction(aActionId, aToolbarId)) @@ -1218,7 +1201,7 @@ void SHAPERGUI::updateToolbars(const QMap& theNewToolbars) aPos++; } // remove extra actions - foreach(int aCmd, aOldCmd) { + foreach (int aCmd, aOldCmd) { aAction = action(aCmd); aActionId = aMgr->actionId(aAction); aMgr->remove(aActionId, aToolbarId); @@ -1227,7 +1210,7 @@ void SHAPERGUI::updateToolbars(const QMap& theNewToolbars) } // Remove extra toolbars aToolbars = myToolbars.keys(); - foreach(QString aName, aToolbars) { + foreach (QString aName, aToolbars) { aMgr->removeToolBar(aName); } // Set new toolbars structure @@ -1235,22 +1218,21 @@ void SHAPERGUI::updateToolbars(const QMap& theNewToolbars) myIsToolbarsModified = true; } -void SHAPERGUI::saveToolbarsConfig() -{ +void SHAPERGUI::saveToolbarsConfig() { if (!myIsToolbarsModified) return; // Save toolbars configuration into map QMap aToolbarsConfig; #ifdef _DEBUG - QtxActionToolMgr* aMgr = + QtxActionToolMgr *aMgr = #endif - toolMgr(); + toolMgr(); QStringList aToolbars = myToolbars.keys(); QIntList aActionsIds; - foreach(QString aName, aToolbars) { + foreach (QString aName, aToolbars) { aActionsIds = myToolbars[aName]; QStringList aContent; - foreach(int aId, aActionsIds) { + foreach (int aId, aActionsIds) { if (aId == -1) aContent.append(""); else @@ -1259,22 +1241,23 @@ void SHAPERGUI::saveToolbarsConfig() aToolbarsConfig[aName] = aContent; } // Store the configuration into resources - SUIT_ResourceMgr* aResMgr = application()->resourceMgr(); + SUIT_ResourceMgr *aResMgr = application()->resourceMgr(); QStringList aNames = aToolbarsConfig.keys(); QStringList aValues; - foreach(QString aToolbar, aNames) { - aResMgr->setValue(ToolbarsSection, aToolbar, aToolbarsConfig[aToolbar].join(",")); + foreach (QString aToolbar, aNames) { + aResMgr->setValue(ToolbarsSection, aToolbar, + aToolbarsConfig[aToolbar].join(",")); } // Remove obsolete parameters from resources QStringList aOldParams = aResMgr->parameters(ToolbarsSection); - foreach(QString aName, aOldParams) { + foreach (QString aName, aOldParams) { if (!aToolbars.contains(aName)) aResMgr->remove(ToolbarsSection, aName); } // Store current list of free commands QIntList aFreeCommands = getFreeCommands(); QStringList aFreeList; - foreach(int aId, aFreeCommands) { + foreach (int aId, aFreeCommands) { aFreeList.append(action(aId)->data().toString()); } if (aFreeList.size() > 0) @@ -1283,9 +1266,8 @@ void SHAPERGUI::saveToolbarsConfig() myIsToolbarsModified = false; } -void SHAPERGUI::loadToolbarsConfig() -{ - SUIT_ResourceMgr* aResMgr = application()->resourceMgr(); +void SHAPERGUI::loadToolbarsConfig() { + SUIT_ResourceMgr *aResMgr = application()->resourceMgr(); QStringList aToolbarNames = aResMgr->parameters(ToolbarsSection); if (aToolbarNames.size() == 0) return; @@ -1293,7 +1275,7 @@ void SHAPERGUI::loadToolbarsConfig() // Create commands map QMap aCommandsMap; QString aCmdIdStr; - foreach(int aId, myActionsList) { + foreach (int aId, myActionsList) { aCmdIdStr = action(aId)->data().toString(); aCommandsMap[aCmdIdStr] = aId; } @@ -1302,19 +1284,18 @@ void SHAPERGUI::loadToolbarsConfig() QMap aToolbars; QStringList aCommands; QIntList aKnownCommands; - QList aActions; - foreach(QString aName, aToolbarNames) { + QList aActions; + foreach (QString aName, aToolbarNames) { aCommands = aResMgr->stringValue(ToolbarsSection, aName).split(","); if (aName == FreeCommandsParam) { // The value is a list of free commands - foreach(QString aCommand, aCommands) { + foreach (QString aCommand, aCommands) { aKnownCommands.append(aCommandsMap[aCommand]); } - } - else { + } else { aToolbars[aName] = QIntList(); if (aCommands.size() > 0) { - foreach(QString aCommand, aCommands) { + foreach (QString aCommand, aCommands) { if (aCommand.isEmpty()) aToolbars[aName].append(-1); else if (aCommandsMap.contains(aCommand)) { @@ -1328,7 +1309,7 @@ void SHAPERGUI::loadToolbarsConfig() } // Find new and obsolete commands QIntList aNewCommands = myActionsList; - foreach(int aId, myActionsList) { + foreach (int aId, myActionsList) { if (aKnownCommands.contains(aId)) { aKnownCommands.removeAll(aId); aNewCommands.removeAll(aId); @@ -1337,8 +1318,8 @@ void SHAPERGUI::loadToolbarsConfig() if (aNewCommands.size() > 0) { // Add new commands to toolbars structure QStringList aKeys = myToolbars.keys(); - foreach(int aNewId, aNewCommands) { - foreach(QString aName, aKeys) { + foreach (int aNewId, aNewCommands) { + foreach (QString aName, aKeys) { if (myToolbars[aName].contains(aNewId)) { if (!aToolbars.contains(aName)) { aToolbars[aName] = QIntList(); @@ -1351,8 +1332,8 @@ void SHAPERGUI::loadToolbarsConfig() if (aKnownCommands.size() > 0) { // Remove obsolete commands from the toolbars structure QStringList aKeys = aToolbars.keys(); - foreach(int aOldId, aKnownCommands) { - foreach(QString aName, aKeys) { + foreach (int aOldId, aKnownCommands) { + foreach (QString aName, aKeys) { if (aToolbars[aName].contains(aOldId)) { aToolbars[aName].removeAll(aOldId); if (aToolbars[aName].size() == 0) @@ -1365,16 +1346,14 @@ void SHAPERGUI::loadToolbarsConfig() myIsToolbarsModified = false; } - -QIntList SHAPERGUI::getFreeCommands() const -{ +QIntList SHAPERGUI::getFreeCommands() const { QIntList aFreeCommands; - QtxActionToolMgr* aMgr = toolMgr(); - QAction* anAction; + QtxActionToolMgr *aMgr = toolMgr(); + QAction *anAction; int aId; QMap::const_iterator aIt; QIntList aShaperActions = shaperActions(); - foreach(int aCmd, aShaperActions) { + foreach (int aCmd, aShaperActions) { anAction = action(aCmd); aId = aMgr->actionId(anAction); if (!aMgr->containsAction(aId)) @@ -1383,80 +1362,78 @@ QIntList SHAPERGUI::getFreeCommands() const return aFreeCommands; } -void SHAPERGUI::resetToolbars() -{ +void SHAPERGUI::resetToolbars() { if (!myDefaultToolbars.isEmpty()) updateToolbars(myDefaultToolbars); myIsToolbarsModified = false; - SUIT_ResourceMgr* aResMgr = application()->resourceMgr(); + SUIT_ResourceMgr *aResMgr = application()->resourceMgr(); aResMgr->remove(ToolbarsSection); } -void SHAPERGUI::publishToStudy() -{ +void SHAPERGUI::publishToStudy() { if (isActiveModule() && ModelAPI_Session::get()->hasModuleDocument()) { myWorkshop->module()->launchOperation("PublishToStudy", false); // update SHAPERSTUDY objects in OCC and VTK viewers QStringList aVMList; - aVMList << "OCCViewer" << "VTKViewer"; + aVMList << "OCCViewer" + << "VTKViewer"; getApp()->updatePresentations("SHAPERSTUDY", aVMList); } } -void SHAPERGUI::fillPartSetInfoPanel(QtxInfoPanel* theInfoPanel) -{ +void SHAPERGUI::fillPartSetInfoPanel(QtxInfoPanel *theInfoPanel) { QIntList aShaperActions = shaperActions(); theInfoPanel->addLabel(tr("Current mode: Part set mode")); addActionsToInfoGroup(theInfoPanel, tr("Parts management"), - { "Part", "Duplicate", "Remove" }); + {"Part", "Duplicate", "Remove"}); addActionsToInfoGroup(theInfoPanel, tr("Import operations"), - { "OPEN_CMD", "IMPORT_PART_CMD", "IMPORT_SHAPE_CMD" }); + {"OPEN_CMD", "IMPORT_PART_CMD", "IMPORT_SHAPE_CMD"}); addActionsToInfoGroup(theInfoPanel, tr("Export operations"), - { "SAVEAS_CMD", "EXPORT_PART_CMD", "EXPORT_SHAPE_CMD" }); + {"SAVEAS_CMD", "EXPORT_PART_CMD", "EXPORT_SHAPE_CMD"}); addActionsToInfoGroup(theInfoPanel, tr("Arrangement of parts"), - { "Placement", "Translation", "Rotation" }); + {"Placement", "Translation", "Rotation"}); } -void SHAPERGUI::fillPartInfoPanel(QtxInfoPanel* theInfoPanel) -{ +void SHAPERGUI::fillPartInfoPanel(QtxInfoPanel *theInfoPanel) { QIntList aShaperActions = shaperActions(); theInfoPanel->addLabel(tr("Current mode: Part mode")); addActionsToInfoGroup(theInfoPanel, tr("Primitives"), - { "Box", "Cylinder", "Sphere" }); + {"Box", "Cylinder", "Sphere"}); addActionsToInfoGroup(theInfoPanel, tr("Geometry"), - { "Vertex", "Edge", "Wire", "Face" }); + {"Vertex", "Edge", "Wire", "Face"}); addActionsToInfoGroup(theInfoPanel, tr("Features"), - { "Extrusion", "Revolution", "Cut", "Fuse", "Fillet" }); + {"Extrusion", "Revolution", "Cut", "Fuse", "Fillet"}); } -void SHAPERGUI::fillSketcherInfoPanel(QtxInfoPanel* theInfoPanel) -{ +void SHAPERGUI::fillSketcherInfoPanel(QtxInfoPanel *theInfoPanel) { QIntList aShaperActions = shaperActions(); theInfoPanel->addLabel(tr("Current mode: Sketcher mode")); - addActionsToInfoGroup(theInfoPanel, tr("Primitives"), - { "SketchPoint", "SketchLine", "SketchCircle", "SketchRectangle" }); + addActionsToInfoGroup( + theInfoPanel, tr("Primitives"), + {"SketchPoint", "SketchLine", "SketchCircle", "SketchRectangle"}); addActionsToInfoGroup(theInfoPanel, tr("Dimensions"), - { "SketchConstraintLength", "SketchConstraintRadius", "SketchConstraintAngle" }); - addActionsToInfoGroup(theInfoPanel, tr("Constraints"), - { "SketchConstraintParallel", "SketchConstraintPerpendicular", - "SketchConstraintEqual", "SketchConstraintCoincidence" }); + {"SketchConstraintLength", "SketchConstraintRadius", + "SketchConstraintAngle"}); + addActionsToInfoGroup( + theInfoPanel, tr("Constraints"), + {"SketchConstraintParallel", "SketchConstraintPerpendicular", + "SketchConstraintEqual", "SketchConstraintCoincidence"}); } -void SHAPERGUI::addActionsToInfoGroup(QtxInfoPanel* theInfoPanel, - const QString& theGroup, const QSet& theActions) -{ +void SHAPERGUI::addActionsToInfoGroup(QtxInfoPanel *theInfoPanel, + const QString &theGroup, + const QSet &theActions) { QIntList aShaperActions = shaperActions(); int aGroup = theInfoPanel->addGroup(theGroup); int aCount = 0; - foreach(int aCmd, aShaperActions) { - QAction* aAction = action(aCmd); - if (theActions.contains(aAction->data().toString())) - { + foreach (int aCmd, aShaperActions) { + QAction *aAction = action(aCmd); + if (theActions.contains(aAction->data().toString())) { theInfoPanel->addAction(aAction, aGroup); aCount++; } @@ -1465,10 +1442,10 @@ void SHAPERGUI::addActionsToInfoGroup(QtxInfoPanel* theInfoPanel, } } -void SHAPERGUI::updateInfoPanel() -{ - LightApp_Application* aApp = dynamic_cast(application()); - QtxInfoPanel* aInfoPanel = aApp->infoPanel(); +void SHAPERGUI::updateInfoPanel() { + LightApp_Application *aApp = + dynamic_cast(application()); + QtxInfoPanel *aInfoPanel = aApp->infoPanel(); aInfoPanel->clear(); aInfoPanel->setTitle(tr("Welcome to SHAPER")); @@ -1477,7 +1454,7 @@ void SHAPERGUI::updateInfoPanel() DocumentPtr aActiveDoc = aMgr->activeDocument(); DocumentPtr aModuleDoc = aMgr->moduleDocument(); - XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr(); + XGUI_OperationMgr *aOpMgr = myWorkshop->operationMgr(); QStringList aOpList = aOpMgr->operationList(); bool isSketcher = false; if (aOpList.size() > 0) diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index 2a84accc3..d7356e626 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SHAPERGUI_H #define SHAPERGUI_H -#include "SHAPER_SHAPERGUI.h" #include "SHAPERGUI_SalomeViewer.h" +#include "SHAPER_SHAPERGUI.h" #include #include @@ -43,10 +44,10 @@ class ModuleBase_Operation; * An implementation of SALOME connector class for implementation of * XGUI functionality as a module of SALOME */ -class SHAPERGUI_EXPORT SHAPERGUI : public LightApp_Module, public XGUI_SalomeConnector -{ -Q_OBJECT - public: +class SHAPERGUI_EXPORT SHAPERGUI : public LightApp_Module, + public XGUI_SalomeConnector { + Q_OBJECT +public: SHAPERGUI(); virtual ~SHAPERGUI(); @@ -54,104 +55,112 @@ Q_OBJECT /// \brief Initializing of the module /// \param theApp application instance - virtual void initialize(CAM_Application* theApp); + virtual void initialize(CAM_Application *theApp); /// \brief Definition of module standard windows - virtual void windows(QMap& theWndMap) const; + virtual void windows(QMap &theWndMap) const; /// \brief Definition of module viewer - virtual void viewManagers(QStringList& theList) const; + virtual void viewManagers(QStringList &theList) const; /// \brief The method is called on selection changed event virtual void selectionChanged(); //--- XGUI connector interface ----- - virtual QAction* addFeature(const QString& theWBName, const QString& theTBName, - const QString& theId, const QString& theTitle, - const QString& theTip, const QIcon& theIcon, - const QKeySequence& theKeys/* = QKeySequence()*/, - bool isCheckable /*= false*/, const bool isAddSeparator/* = false*/, - const QString& theStatusTip); - - //! Add feature (QAction) in the \a theWBName toolbar with given \a theInfo about action - virtual QAction* addFeature(const QString& theWBName, - const ActionInfo& theInfo, const bool isAddSeparator); + virtual QAction *addFeature(const QString &theWBName, + const QString &theTBName, const QString &theId, + const QString &theTitle, const QString &theTip, + const QIcon &theIcon, + const QKeySequence &theKeys /* = QKeySequence()*/, + bool isCheckable /*= false*/, + const bool isAddSeparator /* = false*/, + const QString &theStatusTip); + + //! Add feature (QAction) in the \a theWBName toolbar with given \a theInfo + //! about action + virtual QAction *addFeature(const QString &theWBName, + const ActionInfo &theInfo, + const bool isAddSeparator); /// Add a nested feature /// \param theWBName a workbench name /// \param theInfo the action parameters /// \param theNestedActions a list of nested actions - virtual QAction* addFeatureOfNested(const QString& theWBName, - const ActionInfo& theInfo, - const QList& theNestedActions); + virtual QAction *addFeatureOfNested(const QString &theWBName, + const ActionInfo &theInfo, + const QList &theNestedActions); //! Returns true if the feature action is a nested action, in other words, //! it is created by addNestedFeature(). //! \param theAction - an action of a feature //! returns boolean result - virtual bool isFeatureOfNested(const QAction* theAction); + virtual bool isFeatureOfNested(const QAction *theAction); - virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle, - const QString& theTip, const QIcon& theIcon, - const QKeySequence& theKeys, bool isCheckable, - const char* theMenuSourceText, const QString& theSubMenu = QString(), - const int theMenuPosition = 10, - const int theSuibMenuPosition = -1) Standard_OVERRIDE; + virtual QAction *addDesktopCommand( + const QString &theId, const QString &theTitle, const QString &theTip, + const QIcon &theIcon, const QKeySequence &theKeys, bool isCheckable, + const char *theMenuSourceText, const QString &theSubMenu = QString(), + const int theMenuPosition = 10, + const int theSuibMenuPosition = -1) Standard_OVERRIDE; - virtual void addDesktopMenuSeparator(const char* theMenuSourceText, + virtual void addDesktopMenuSeparator(const char *theMenuSourceText, const int theMenuPosition = 10); /// Add an action to a tool bar /// \param theAction an ation to add /// \param theToolBarTitle a name of tool bar - virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ); + virtual bool addActionInToolbar(QAction *theAction, + const QString &theToolBarTitle); - /// Creates menu/tool bar actions for loaded features stored in the menu manager + /// Creates menu/tool bar actions for loaded features stored in the menu + /// manager virtual void createFeatureActions(); - virtual QMainWindow* desktop() const; + virtual QMainWindow *desktop() const; //! Stores XML information for the feature kind //! \param theFeatureId a feature kind //! \param theMessage a container of the feature XML properties - virtual void setFeatureInfo(const QString& theFeatureId, - const std::shared_ptr& theMessage); + virtual void + setFeatureInfo(const QString &theFeatureId, + const std::shared_ptr &theMessage); //! Returns XML information for the feature kind //! \param theFeatureId a feature kind //! \return theMessage a container of the feature XML properties - virtual std::shared_ptr featureInfo(const QString& theFeatureId); + virtual std::shared_ptr + featureInfo(const QString &theFeatureId); //! Returns interface to Salome viewer - virtual ModuleBase_IViewer* viewer() const - { - return myProxyViewer; - } + virtual ModuleBase_IViewer *viewer() const { return myProxyViewer; } //! Returns list of defined actions (just by SHAPER module) - virtual QList commandList() const; + virtual QList commandList() const; /// Redefinition of virtual function. /// \param theClient name of pop-up client /// \param theMenu popup menu instance /// \param theTitle menu title. - virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle); + virtual void contextMenuPopup(const QString &theClient, QMenu *theMenu, + QString &theTitle); /// Redefinition of virtual function for preferences creation. virtual void createPreferences(); /// Redefinition of virtual function for preferences changed event. - virtual void preferencesChanged(const QString& theSection, const QString& theParam); + virtual void preferencesChanged(const QString &theSection, + const QString &theParam); //! Shows the given text in status bar as a permanent text //! \theInfo a string value - //! \theMsecs interval of msec milliseconds when the message will be hidden, if -1, it stays. + //! \theMsecs interval of msec milliseconds when the message will be hidden, + //! if -1, it stays. // If 0, default value is used, it is 3000 - virtual void putInfo(const QString& theInfo, const int theMSecs = 0); + virtual void putInfo(const QString &theInfo, const int theMSecs = 0); /// \return Workshop class instance - XGUI_Workshop* workshop() const { return myWorkshop; } + XGUI_Workshop *workshop() const { return myWorkshop; } /// \brief Set flag about opened document state void setIsOpened(bool theOpened) { myIsOpened = theOpened; } @@ -168,8 +177,9 @@ Q_OBJECT QIntList getFreeCommands() const; /// Returns structure of default tool bars - QMap defaultToolbars() const - { return (myDefaultToolbars.size() == 0)? myToolbars : myDefaultToolbars; } + QMap defaultToolbars() const { + return (myDefaultToolbars.size() == 0) ? myToolbars : myDefaultToolbars; + } void resetToolbars(); @@ -177,28 +187,28 @@ Q_OBJECT virtual void updateInfoPanel(); - public slots: - /// \brief The method is redefined to connect to the study viewer before the data - /// model is filled by opened file. This file open will flush redisplay signals for, - /// objects which should be visualized - //virtual void connectToStudy(CAM_Study* theStudy); +public slots: + /// \brief The method is redefined to connect to the study viewer before the + /// data model is filled by opened file. This file open will flush redisplay + /// signals for, objects which should be visualized + // virtual void connectToStudy(CAM_Study* theStudy); - /// \brief The method is called on the module activation - /// \param theStudy current study - virtual bool activateModule(SUIT_Study* theStudy); + /// \brief The method is called on the module activation + /// \param theStudy current study + virtual bool activateModule(SUIT_Study *theStudy); - /// \brief The method is called on the module activation - /// \param theStudy current study - virtual bool deactivateModule(SUIT_Study* theStudy); + /// \brief The method is called on the module activation + /// \param theStudy current study + virtual bool deactivateModule(SUIT_Study *theStudy); - protected slots: - /// Redefinition of virtual function - /// \param theMgr view manager - virtual void onViewManagerAdded(SUIT_ViewManager* theMgr); +protected slots: + /// Redefinition of virtual function + /// \param theMgr view manager + virtual void onViewManagerAdded(SUIT_ViewManager *theMgr); - /// Redefinition of virtual function - /// \param theMgr view manager - virtual void onViewManagerRemoved(SUIT_ViewManager* theMgr); + /// Redefinition of virtual function + /// \param theMgr view manager + virtual void onViewManagerRemoved(SUIT_ViewManager *theMgr); /// Set preferences to default void onDefaultPreferences(); @@ -206,24 +216,26 @@ Q_OBJECT /// Hide object browser if it was created during loading script void onScriptLoaded(); - /// Save application functionality with additional processing of aborting the current operation + /// Save application functionality with additional processing of aborting the + /// current operation void onSaveDocByShaper(); - /// Save application functionality with additional processing of aborting the current operation + /// Save application functionality with additional processing of aborting the + /// current operation void onSaveAsDocByShaper(); /// Obtains the current application and updates its actions void onUpdateCommandStatus(); - /// \brief The method is called on any GUI action + /// \brief The method is called on any GUI action virtual void logShaperGUIEvent(); - protected: - /// Create data model - CAM_DataModel* createDataModel(); +protected: + /// Create data model + CAM_DataModel *createDataModel(); /// Create popup menu manager - virtual QtxPopupMgr* popupMgr(); + virtual QtxPopupMgr *popupMgr(); /// Abort all operations virtual bool abortAllOperations(); @@ -233,35 +245,37 @@ private slots: void onEditToolbars(); - void onOperationCommitted(ModuleBase_Operation*); - void onOperationAborted(ModuleBase_Operation*); + void onOperationCommitted(ModuleBase_Operation *); + void onOperationAborted(ModuleBase_Operation *); - private: - /// Create selector for OCC Viewer - /// \param theMgr view manager - SHAPERGUI_OCCSelector* createSelector(SUIT_ViewManager* theMgr); +private: + /// Create selector for OCC Viewer + /// \param theMgr view manager + SHAPERGUI_OCCSelector *createSelector(SUIT_ViewManager *theMgr); - void registerCommandToolbar(const QString& theToolName, int theCommandId); + void registerCommandToolbar(const QString &theToolName, int theCommandId); int getNextCommandId() const; // Update current toolbars - void updateToolbars(const QMap& theNewToolbars); + void updateToolbars(const QMap &theNewToolbars); void saveToolbarsConfig(); void loadToolbarsConfig(); //! Fill Info Panel in Part set mode - void fillPartSetInfoPanel(QtxInfoPanel* theInfoPanel); + void fillPartSetInfoPanel(QtxInfoPanel *theInfoPanel); //! Fill Info Panel in Part mode - void fillPartInfoPanel(QtxInfoPanel* theInfoPanel); + void fillPartInfoPanel(QtxInfoPanel *theInfoPanel); //! Fill Info Panel in Sketcher mode - void fillSketcherInfoPanel(QtxInfoPanel* theInfoPanel); + void fillSketcherInfoPanel(QtxInfoPanel *theInfoPanel); //! Fill Info Panel in Sketcher mode - void addActionsToInfoGroup(QtxInfoPanel* theInfoPanel, const QString& theGroup, const QSet& theActions); + void addActionsToInfoGroup(QtxInfoPanel *theInfoPanel, + const QString &theGroup, + const QSet &theActions); void hideInternalWindows(); @@ -269,16 +283,16 @@ private slots: QStringList myNestedActionsList; /// Reference to workshop - XGUI_Workshop* myWorkshop; + XGUI_Workshop *myWorkshop; /// OCC viewer selector instance - SHAPERGUI_OCCSelector* mySelector; + SHAPERGUI_OCCSelector *mySelector; /// Proxy viewer for connection to OCC Viewer in SALOME - SHAPERGUI_SalomeViewer* myProxyViewer; + SHAPERGUI_SalomeViewer *myProxyViewer; /// Map of feature kind to a container of XML properties for the feature - QMap > myFeaturesInfo; + QMap> myFeaturesInfo; /// Flag of opened document state bool myIsOpened; @@ -288,12 +302,12 @@ private slots: bool myIsEditEnabled; /// Popup manager - QtxPopupMgr* myPopupMgr; + QtxPopupMgr *myPopupMgr; - QAction* myWhatIsAction; + QAction *myWhatIsAction; bool myIsInspectionVisible; - QDockWidget* myInspectionPanel; + QDockWidget *myInspectionPanel; bool myIsFacesPanelVisible; /// List of registered actions diff --git a/src/SHAPERGUI/SHAPERGUI_DataModel.cpp b/src/SHAPERGUI/SHAPERGUI_DataModel.cpp index a8856b26d..e2325989d 100644 --- a/src/SHAPERGUI/SHAPERGUI_DataModel.cpp +++ b/src/SHAPERGUI/SHAPERGUI_DataModel.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SHAPERGUI_DataModel.h" @@ -22,50 +23,46 @@ #include -#include -#include -#include #include +#include +#include +#include -#include #include #include -#include +#include #include +#include -#include #include +#include #include #define DUMP_NAME "shaper_dump.py" +SHAPERGUI_DataModel::SHAPERGUI_DataModel(SHAPERGUI *theModule) + : LightApp_DataModel(theModule), myStudyPath(""), myModule(theModule) {} -SHAPERGUI_DataModel::SHAPERGUI_DataModel(SHAPERGUI* theModule) - : LightApp_DataModel(theModule), myStudyPath(""), myModule(theModule) -{ -} +SHAPERGUI_DataModel::~SHAPERGUI_DataModel() {} -SHAPERGUI_DataModel::~SHAPERGUI_DataModel() -{ -} - -bool SHAPERGUI_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles) -{ - LightApp_DataModel::open( thePath, theStudy, theFiles ); +bool SHAPERGUI_DataModel::open(const QString &thePath, CAM_Study *theStudy, + QStringList theFiles) { + LightApp_DataModel::open(thePath, theStudy, theFiles); if (theFiles.size() == 0) return false; myStudyPath = thePath; - // If the file is Multi(contain all module files inside), the open SALOME functionality creates - // these files in a temporary directory. After the open functionality is finished, it removes - // these files (in the full SALOME mode). - // The postponed loading of the files is realized in the SHAPER module. So, it is important do - // not remove the opened files. - // The following code creates a new tmp directory with a copy of files. + // If the file is Multi(contain all module files inside), the open SALOME + // functionality creates these files in a temporary directory. After the open + // functionality is finished, it removes these files (in the full SALOME + // mode). The postponed loading of the files is realized in the SHAPER module. + // So, it is important do not remove the opened files. The following code + // creates a new tmp directory with a copy of files. QString aTmpDir = theFiles.first(); - LightApp_Study* aStudy = dynamic_cast( myModule->application()->activeStudy() ); + LightApp_Study *aStudy = + dynamic_cast(myModule->application()->activeStudy()); QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str(); QDir aDir(aTmpDir); @@ -75,7 +72,7 @@ bool SHAPERGUI_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStr QString aFileName = *anIt; QString aCurrentFile = SUIT_Tools::addSlash(aTmpDir) + aFileName; - XGUI_Workshop* aWorkShop = myModule->workshop(); + XGUI_Workshop *aWorkShop = myModule->workshop(); aWorkShop->openFile(aCurrentFile); } @@ -83,23 +80,23 @@ bool SHAPERGUI_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStr return true; } -bool SHAPERGUI_DataModel::save(QStringList& theFiles) -{ +bool SHAPERGUI_DataModel::save(QStringList &theFiles) { // Publish to study before saving of the data model myModule->publishToStudy(); - LightApp_DataModel::save( theFiles ); - XGUI_Workshop* aWorkShop = myModule->workshop(); + LightApp_DataModel::save(theFiles); + XGUI_Workshop *aWorkShop = myModule->workshop(); std::list aFileNames; - CAM_Application* anApp = myModule->application(); - LightApp_Study* aStudy = dynamic_cast(anApp->activeStudy()); - SUIT_ResourceMgr* aResMgr = anApp->resourceMgr(); + CAM_Application *anApp = myModule->application(); + LightApp_Study *aStudy = dynamic_cast(anApp->activeStudy()); + SUIT_ResourceMgr *aResMgr = anApp->resourceMgr(); - // it is important to check whether the file is saved in the multi-files mode in order to save - // files in temporary directories, which are removed in the full SALOME mode after copiying - // the files content in a result file. - bool isMultiFile = aResMgr ? aResMgr->booleanValue("Study", "multi_file", false) : false; + // it is important to check whether the file is saved in the multi-files mode + // in order to save files in temporary directories, which are removed in the + // full SALOME mode after copiying the files content in a result file. + bool isMultiFile = + aResMgr ? aResMgr->booleanValue("Study", "multi_file", false) : false; std::string aTmpDir = aStudy->GetTmpDir(qPrintable(myStudyPath), isMultiFile); QString aTmp = QString(aTmpDir.c_str()); @@ -109,7 +106,7 @@ bool SHAPERGUI_DataModel::save(QStringList& theFiles) if (aMgr->isAutoUpdateBlocked()) aMgr->blockAutoUpdate(false); - //aWorkShop->saveDocument(QString(aTmpDir.c_str()), aFileNames); + // aWorkShop->saveDocument(QString(aTmpDir.c_str()), aFileNames); aWorkShop->setCurrentDataFile(aTmp + "shaper.shaper"); aWorkShop->onSave(); QString aName = aWorkShop->currentDataFile(); @@ -120,79 +117,74 @@ bool SHAPERGUI_DataModel::save(QStringList& theFiles) return true; } -bool SHAPERGUI_DataModel::saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles) -{ +bool SHAPERGUI_DataModel::saveAs(const QString &thePath, CAM_Study *theStudy, + QStringList &theFiles) { myStudyPath = thePath; return save(theFiles); } -bool SHAPERGUI_DataModel::close() -{ +bool SHAPERGUI_DataModel::close() { myModule->workshop()->closeDocument(); return LightApp_DataModel::close(); } -bool SHAPERGUI_DataModel::create(CAM_Study* theStudy) -{ - return true; -} +bool SHAPERGUI_DataModel::create(CAM_Study *theStudy) { return true; } -bool SHAPERGUI_DataModel::isModified() const -{ +bool SHAPERGUI_DataModel::isModified() const { SessionPtr aMgr = ModelAPI_Session::get(); return aMgr->isModified(); } -bool SHAPERGUI_DataModel::isSaved() const -{ - return !isModified(); -} +bool SHAPERGUI_DataModel::isSaved() const { return !isModified(); } -void SHAPERGUI_DataModel::update(LightApp_DataObject* theObj, LightApp_Study* theStudy) -{ +void SHAPERGUI_DataModel::update(LightApp_DataObject *theObj, + LightApp_Study *theStudy) { // Nothing to do here: we always keep the data tree in the up-to-date state - // The only goal of this method is to hide default behavior from LightApp_DataModel + // The only goal of this method is to hide default behavior from + // LightApp_DataModel return; } -void SHAPERGUI_DataModel::initRootObject() -{ - LightApp_Study* study = dynamic_cast( module()->application()->activeStudy() ); - CAM_ModuleObject *aModelRoot = dynamic_cast(root()); - if(study && aModelRoot == NULL) { - aModelRoot = createModuleObject( study->root() ); - aModelRoot->setDataModel( this ); +void SHAPERGUI_DataModel::initRootObject() { + LightApp_Study *study = + dynamic_cast(module()->application()->activeStudy()); + CAM_ModuleObject *aModelRoot = dynamic_cast(root()); + if (study && aModelRoot == NULL) { + aModelRoot = createModuleObject(study->root()); + aModelRoot->setDataModel(this); setRoot(aModelRoot); } } -void SHAPERGUI_DataModel::removeDirectory(const QString& theDirectoryName) -{ +void SHAPERGUI_DataModel::removeDirectory(const QString &theDirectoryName) { Qtx::rmDir(theDirectoryName); } -bool SHAPERGUI_DataModel::dumpPython(const QString& thePath, CAM_Study* theStudy, - bool isMultiFile, QStringList& theListOfFiles) -{ - LightApp_Study* aStudy = dynamic_cast(theStudy); +bool SHAPERGUI_DataModel::dumpPython(const QString &thePath, + CAM_Study *theStudy, bool isMultiFile, + QStringList &theListOfFiles) { + LightApp_Study *aStudy = dynamic_cast(theStudy); if (!aStudy) return false; myModule->publishToStudy(); - std::shared_ptr aDoc = ModelAPI_Session::get()->activeDocument(); + std::shared_ptr aDoc = + ModelAPI_Session::get()->activeDocument(); ModelAPI_Session::get()->startOperation(ExchangePlugin_Dump::ID()); FeaturePtr aFeature = aDoc->addFeature(ExchangePlugin_Dump::ID()); if (aFeature.get()) { // keep path to the true dumping directory for external files dumping - AttributeStringPtr aAttr = aFeature->string(ExchangePlugin_Dump::DUMP_DIR_ID()); + AttributeStringPtr aAttr = + aFeature->string(ExchangePlugin_Dump::DUMP_DIR_ID()); if (aAttr.get()) { QString aDirPath = QFileInfo(thePath).path(); aAttr->setValue(aDirPath.toStdString()); } // tmp path to write the script - std::string aTmpDir = aStudy->GetTmpDir(thePath.toStdString().c_str(), isMultiFile); + std::string aTmpDir = + aStudy->GetTmpDir(thePath.toStdString().c_str(), isMultiFile); std::string aFileName = aTmpDir + DUMP_NAME; if (QFile::exists(aFileName.c_str())) { @@ -208,7 +200,8 @@ bool SHAPERGUI_DataModel::dumpPython(const QString& thePath, CAM_Study* theStudy aAttr->setValue(".py"); #ifdef HAVE_SALOME - aFeature->boolean(ExchangePlugin_Dump::EXPORT_VARIABLES_ID())->setValue(true); + aFeature->boolean(ExchangePlugin_Dump::EXPORT_VARIABLES_ID()) + ->setValue(true); #endif ModelAPI_Session::get()->finishOperation(); @@ -225,7 +218,7 @@ bool SHAPERGUI_DataModel::dumpPython(const QString& thePath, CAM_Study* theStudy QStringList aBuffer; aBuffer.push_back(QString("def RebuildData():")); QStringList aList(aTrace.split("\n")); - foreach(QString aStr, aList) { + foreach (QString aStr, aList) { QString s = " " + aStr; aBuffer.push_back(s); } diff --git a/src/SHAPERGUI/SHAPERGUI_DataModel.h b/src/SHAPERGUI/SHAPERGUI_DataModel.h index 571d1b76a..5d7a96d3f 100644 --- a/src/SHAPERGUI/SHAPERGUI_DataModel.h +++ b/src/SHAPERGUI/SHAPERGUI_DataModel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SHAPERGUI_DATAMODEL_H @@ -26,40 +27,42 @@ class SHAPERGUI; /** -* \ingroup Salome -* A Data Model class provides a connection of SALOME data structure and OpenParts application data model -*/ -class SHAPERGUI_EXPORT SHAPERGUI_DataModel : public LightApp_DataModel -{ + * \ingroup Salome + * A Data Model class provides a connection of SALOME data structure and + * OpenParts application data model + */ +class SHAPERGUI_EXPORT SHAPERGUI_DataModel : public LightApp_DataModel { Q_OBJECT - public: - /// Constructor - /// \param theModule a module instance - SHAPERGUI_DataModel(SHAPERGUI* theModule); +public: + /// Constructor + /// \param theModule a module instance + SHAPERGUI_DataModel(SHAPERGUI *theModule); virtual ~SHAPERGUI_DataModel(); /// Open a data file /// \param thePath a path to the directory /// \param theStudy a current study /// \param theFiles a list of files to open - virtual bool open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles); + virtual bool open(const QString &thePath, CAM_Study *theStudy, + QStringList theFiles); /// Save module data to file /// \param theFiles list of created files - virtual bool save(QStringList& theFiles); + virtual bool save(QStringList &theFiles); /// Save module data to a file /// \param thePath a path to the directory /// \param theStudy a current study /// \param theFiles a list of files to open - virtual bool saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles); + virtual bool saveAs(const QString &thePath, CAM_Study *theStudy, + QStringList &theFiles); /// Close data structure virtual bool close(); /// Create data structure /// \param theStudy a current study - virtual bool create(CAM_Study* theStudy); + virtual bool create(CAM_Study *theStudy); /// Returns True if the data structure has been modified virtual bool isModified() const; @@ -75,28 +78,31 @@ class SHAPERGUI_EXPORT SHAPERGUI_DataModel : public LightApp_DataModel /// Update data object /// \param theObj an data object /// \param theStudy a current study - virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0); + virtual void update(LightApp_DataObject *theObj = 0, + LightApp_Study *theStudy = 0); - /// Redefinition of virtual method: include the module dump in the common SALOME dump - virtual bool dumpPython( const QString&, CAM_Study*, bool, QStringList& ); + /// Redefinition of virtual method: include the module dump in the common + /// SALOME dump + virtual bool dumpPython(const QString &, CAM_Study *, bool, QStringList &); protected: /** * Removes the directory with content if it exists * \param theDirectoryName a directory name */ - static void removeDirectory(const QString& theDirectoryName); + static void removeDirectory(const QString &theDirectoryName); - private: - /// Pat to a study file +private: + /// Pat to a study file QString myStudyPath; /// a path to the temporary directory, created by opening a document file - //QString myTmpDirectory; + // QString myTmpDirectory; - /// it should be created because the files reading is postponed in the module. The directory + /// it should be created because the files reading is postponed in the module. + /// The directory // should be removed after the model document is closed. - SHAPERGUI* myModule; + SHAPERGUI *myModule; }; #endif diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp b/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp index 629bcc60d..881be87a9 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // /* @@ -27,28 +28,20 @@ #include #include +#include #include #include -#include #include -#include +#include -SHAPERGUI_NestedButton::SHAPERGUI_NestedButton(QObject* theParent, - const QList& theNestedActions) -: QWidgetAction(theParent), - myNestedActions(theNestedActions), - myAdditionalButtonsWidget(0), - myButtonFrame(0), - myThisButton(0) -{ -} +SHAPERGUI_NestedButton::SHAPERGUI_NestedButton( + QObject *theParent, const QList &theNestedActions) + : QWidgetAction(theParent), myNestedActions(theNestedActions), + myAdditionalButtonsWidget(0), myButtonFrame(0), myThisButton(0) {} -SHAPERGUI_NestedButton::~SHAPERGUI_NestedButton() -{ -} +SHAPERGUI_NestedButton::~SHAPERGUI_NestedButton() {} -void SHAPERGUI_NestedButton::showAdditionalButtons(bool isShow) -{ +void SHAPERGUI_NestedButton::showAdditionalButtons(bool isShow) { myAdditionalButtonsWidget->setVisible(isShow); if (isShow) { myButtonFrame->setFrameStyle(QFrame::WinPanel); @@ -61,16 +54,15 @@ void SHAPERGUI_NestedButton::showAdditionalButtons(bool isShow) } } -QWidget * SHAPERGUI_NestedButton::createWidget(QWidget * theParent) -{ +QWidget *SHAPERGUI_NestedButton::createWidget(QWidget *theParent) { // the action has widget only in tool bar, in menu bar, the default // action presentation is shown - QToolBar* aToolBar = dynamic_cast(theParent); + QToolBar *aToolBar = dynamic_cast(theParent); if (!aToolBar) return 0; myButtonFrame = new QFrame(theParent); - QHBoxLayout* aBoxLay = new QHBoxLayout(myButtonFrame); + QHBoxLayout *aBoxLay = new QHBoxLayout(myButtonFrame); aBoxLay->setContentsMargins(2, 0, 0, 0); aBoxLay->setSpacing(1); QSizePolicy aSizePolicy; @@ -83,11 +75,11 @@ QWidget * SHAPERGUI_NestedButton::createWidget(QWidget * theParent) aBoxLay->addWidget(myThisButton, 1); myAdditionalButtonsWidget = new QWidget(myButtonFrame); - QHBoxLayout* aAdditionalBoxLay = new QHBoxLayout(myAdditionalButtonsWidget); + QHBoxLayout *aAdditionalBoxLay = new QHBoxLayout(myAdditionalButtonsWidget); aAdditionalBoxLay->setContentsMargins(0, 0, 0, 0); aAdditionalBoxLay->setSpacing(1); - foreach (QAction* eachAct, myNestedActions) { - QToolButton* aButton = new QToolButton(myButtonFrame); + foreach (QAction *eachAct, myNestedActions) { + QToolButton *aButton = new QToolButton(myButtonFrame); aButton->setDefaultAction(eachAct); aButton->setAutoRaise(true); aAdditionalBoxLay->addWidget(aButton); @@ -103,8 +95,7 @@ QWidget * SHAPERGUI_NestedButton::createWidget(QWidget * theParent) return myButtonFrame; } -bool SHAPERGUI_NestedButton::event(QEvent* theEvent) -{ +bool SHAPERGUI_NestedButton::event(QEvent *theEvent) { if (theEvent->type() == QEvent::ActionChanged) { if (myThisButton) { myThisButton->setEnabled(isEnabled()); @@ -114,13 +105,10 @@ bool SHAPERGUI_NestedButton::event(QEvent* theEvent) return QWidgetAction::event(theEvent); } - -void SHAPERGUI_NestedButton::actionStateChanged() -{ +void SHAPERGUI_NestedButton::actionStateChanged() { if (isEnabled()) { QString s = "true"; } else { QString s = "false"; } - } diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.h b/src/SHAPERGUI/SHAPERGUI_NestedButton.h index 17189fd05..7aa1b5976 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.h +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // /* @@ -38,35 +39,36 @@ class QToolButton; * \ingroup Salome * Custom (nested) button in salome mode. */ -class SHAPERGUI_NestedButton : public QWidgetAction -{ +class SHAPERGUI_NestedButton : public QWidgetAction { Q_OBJECT - public: - /// Constructor - /// \param theParent a parent objects - /// \param theNestedActions a list of nested actions - SHAPERGUI_NestedButton(QObject* theParent, const QList& theNestedActions); +public: + /// Constructor + /// \param theParent a parent objects + /// \param theNestedActions a list of nested actions + SHAPERGUI_NestedButton(QObject *theParent, + const QList &theNestedActions); virtual ~SHAPERGUI_NestedButton(); - private slots: +private slots: /// Shows/hides the additional buttons widget void showAdditionalButtons(bool); /// Slot called on action state void actionStateChanged(); - protected: +protected: /// Creates the button representation /// \param theParent a parent widget - virtual QWidget * createWidget(QWidget * theParent); + virtual QWidget *createWidget(QWidget *theParent); - virtual bool event(QEvent* theEvent); + virtual bool event(QEvent *theEvent); - private: - QList myNestedActions; ///< list of nested actions - QWidget* myAdditionalButtonsWidget; ///< widget to precess additional buttons visibility - QFrame* myButtonFrame; ///< frame arround button representation - QToolButton* myThisButton; ///< main button +private: + QList myNestedActions; ///< list of nested actions + QWidget *myAdditionalButtonsWidget; ///< widget to precess additional buttons + ///< visibility + QFrame *myButtonFrame; ///< frame arround button representation + QToolButton *myThisButton; ///< main button }; #endif /* SRC_SHAPERGUI_NESTEDBUTTON_H_ */ diff --git a/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp b/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp index 07031f259..d3651ef4d 100644 --- a/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp +++ b/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp @@ -14,31 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SHAPERGUI_OCCSelector.h" -SHAPERGUI_OCCSelector::SHAPERGUI_OCCSelector(OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr) - : LightApp_OCCSelector(theViewer, theMgr) -{ -} +SHAPERGUI_OCCSelector::SHAPERGUI_OCCSelector(OCCViewer_Viewer *theViewer, + SUIT_SelectionMgr *theMgr) + : LightApp_OCCSelector(theViewer, theMgr) {} -SHAPERGUI_OCCSelector::~SHAPERGUI_OCCSelector() -{ -} +SHAPERGUI_OCCSelector::~SHAPERGUI_OCCSelector() {} -void SHAPERGUI_OCCSelector::getSelection(SUIT_DataOwnerPtrList& thePtrList) const -{ - OCCViewer_Viewer* vw = viewer(); +void SHAPERGUI_OCCSelector::getSelection( + SUIT_DataOwnerPtrList &thePtrList) const { + OCCViewer_Viewer *vw = viewer(); if (!vw) return; } -void SHAPERGUI_OCCSelector::setSelection(const SUIT_DataOwnerPtrList& thePtrList) -{ - OCCViewer_Viewer* vw = viewer(); +void SHAPERGUI_OCCSelector::setSelection( + const SUIT_DataOwnerPtrList &thePtrList) { + OCCViewer_Viewer *vw = viewer(); if (!vw) return; - } diff --git a/src/SHAPERGUI/SHAPERGUI_OCCSelector.h b/src/SHAPERGUI/SHAPERGUI_OCCSelector.h index dda6caf4c..c2cd32c1a 100644 --- a/src/SHAPERGUI/SHAPERGUI_OCCSelector.h +++ b/src/SHAPERGUI/SHAPERGUI_OCCSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SHAPERGUI_OCCSelector_H @@ -25,24 +26,23 @@ #include /** -* \ingroup Salome -* Redefinition of standard OCC selector in order to adapt it to SHAPER needs -*/ -class SHAPERGUI_EXPORT SHAPERGUI_OCCSelector : public LightApp_OCCSelector -{ - public: - /// Constructor - /// \param theViewer a viewer - /// \param theMgr a selection manager - SHAPERGUI_OCCSelector(OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr); + * \ingroup Salome + * Redefinition of standard OCC selector in order to adapt it to SHAPER needs + */ +class SHAPERGUI_EXPORT SHAPERGUI_OCCSelector : public LightApp_OCCSelector { +public: + /// Constructor + /// \param theViewer a viewer + /// \param theMgr a selection manager + SHAPERGUI_OCCSelector(OCCViewer_Viewer *theViewer, SUIT_SelectionMgr *theMgr); virtual ~SHAPERGUI_OCCSelector(); - protected: - /// Redifinition of virtual function - virtual void getSelection(SUIT_DataOwnerPtrList& theList) const; +protected: + /// Redifinition of virtual function + virtual void getSelection(SUIT_DataOwnerPtrList &theList) const; - /// Redifinition of virtual function - virtual void setSelection(const SUIT_DataOwnerPtrList& theList); + /// Redifinition of virtual function + virtual void setSelection(const SUIT_DataOwnerPtrList &theList); }; #endif diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index 3533bcd94..d54ec7034 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -14,56 +14,55 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SHAPERGUI_SalomeViewer.h" #include "SHAPERGUI_OCCSelector.h" -#include #include #include +#include #include #include #include #include -#include -#include #include #include +#include +#include -#include #include +#include #include #if OCC_VERSION_HEX < 0x070400 - #define SALOME_PATCH_FOR_CTRL_WHEEL +#define SALOME_PATCH_FOR_CTRL_WHEEL #endif -SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer* theViewer) -: ModuleBase_IViewWindow(), myCurrentView(0) -{ +SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer *theViewer) + : ModuleBase_IViewWindow(), myCurrentView(0) { myViewer = theViewer; } - -Handle(V3d_View) SHAPERGUI_SalomeView::v3dView() const -{ +Handle(V3d_View) SHAPERGUI_SalomeView::v3dView() const { Handle(V3d_View) aView; if (myCurrentView) { - OCCViewer_ViewWindow* aWnd = static_cast(myCurrentView); + OCCViewer_ViewWindow *aWnd = + static_cast(myCurrentView); aView = aWnd->getViewPort()->getView(); } return aView; } -QWidget* SHAPERGUI_SalomeView::viewPort() const -{ - QWidget* aViewPort = 0; +QWidget *SHAPERGUI_SalomeView::viewPort() const { + QWidget *aViewPort = 0; if (myCurrentView) { - OCCViewer_ViewWindow* aWnd = static_cast(myCurrentView); + OCCViewer_ViewWindow *aWnd = + static_cast(myCurrentView); aViewPort = aWnd->getViewPort(); } return aViewPort; @@ -73,24 +72,17 @@ QWidget* SHAPERGUI_SalomeView::viewPort() const //********************************************** //********************************************** +SHAPERGUI_SalomeViewer::SHAPERGUI_SalomeViewer(QObject *theParent) + : ModuleBase_IViewer(theParent), mySelector(0), myView(0), + myIsSelectionChanged(false) {} - -SHAPERGUI_SalomeViewer::SHAPERGUI_SalomeViewer(QObject* theParent) - : ModuleBase_IViewer(theParent), - mySelector(0), myView(0), myIsSelectionChanged(false) -{ -} - -SHAPERGUI_SalomeViewer::~SHAPERGUI_SalomeViewer() -{ +SHAPERGUI_SalomeViewer::~SHAPERGUI_SalomeViewer() { if (myView) delete myView; } - //********************************************** -Handle(AIS_InteractiveContext) SHAPERGUI_SalomeViewer::AISContext() const -{ +Handle(AIS_InteractiveContext) SHAPERGUI_SalomeViewer::AISContext() const { if (mySelector && mySelector->viewer()) return mySelector->viewer()->getAISContext(); Handle(AIS_InteractiveContext) aNull; @@ -98,53 +90,50 @@ Handle(AIS_InteractiveContext) SHAPERGUI_SalomeViewer::AISContext() const } //********************************************** -Handle(V3d_Viewer) SHAPERGUI_SalomeViewer::v3dViewer() const -{ +Handle(V3d_Viewer) SHAPERGUI_SalomeViewer::v3dViewer() const { if (mySelector) return mySelector->viewer()->getViewer3d(); return Handle(V3d_Viewer)(); } //********************************************** -Handle(AIS_Trihedron) SHAPERGUI_SalomeViewer::trihedron() const -{ +Handle(AIS_Trihedron) SHAPERGUI_SalomeViewer::trihedron() const { return mySelector->viewer()->getTrihedron(); } //********************************************** -Handle(V3d_View) SHAPERGUI_SalomeViewer::activeView() const -{ +Handle(V3d_View) SHAPERGUI_SalomeViewer::activeView() const { if (mySelector) { - OCCViewer_Viewer* aViewer = mySelector->viewer(); - SUIT_ViewManager* aMgr = aViewer->getViewManager(); - OCCViewer_ViewWindow* aWnd = static_cast(aMgr->getActiveView()); + OCCViewer_Viewer *aViewer = mySelector->viewer(); + SUIT_ViewManager *aMgr = aViewer->getViewManager(); + OCCViewer_ViewWindow *aWnd = + static_cast(aMgr->getActiveView()); return aWnd->getViewPort()->getView(); } return Handle(V3d_View)(); } //********************************************** -QWidget* SHAPERGUI_SalomeViewer::activeViewPort() const -{ - QWidget* aViewPort = 0; +QWidget *SHAPERGUI_SalomeViewer::activeViewPort() const { + QWidget *aViewPort = 0; if (mySelector) { - OCCViewer_Viewer* aViewer = mySelector->viewer(); - SUIT_ViewManager* aMgr = aViewer->getViewManager(); - OCCViewer_ViewWindow* aWnd = static_cast(aMgr->getActiveView()); + OCCViewer_Viewer *aViewer = mySelector->viewer(); + SUIT_ViewManager *aMgr = aViewer->getViewManager(); + OCCViewer_ViewWindow *aWnd = + static_cast(aMgr->getActiveView()); aViewPort = aWnd->getViewPort(); } return aViewPort; } //********************************************** -void SHAPERGUI_SalomeViewer::setSelector(SHAPERGUI_OCCSelector* theSel) -{ +void SHAPERGUI_SalomeViewer::setSelector(SHAPERGUI_OCCSelector *theSel) { if (mySelector) { if (mySelector == theSel) return; else { mySelector->viewer()->getViewManager()->disconnect(this); - OCCViewer_Viewer* aViewer = mySelector->viewer(); + OCCViewer_Viewer *aViewer = mySelector->viewer(); if (aViewer) aViewer->disconnect(this); } @@ -152,57 +141,58 @@ void SHAPERGUI_SalomeViewer::setSelector(SHAPERGUI_OCCSelector* theSel) mySelector = theSel; if (!mySelector) return; - OCCViewer_Viewer* aViewer = mySelector->viewer(); - SUIT_ViewManager* aMgr = aViewer->getViewManager(); + OCCViewer_Viewer *aViewer = mySelector->viewer(); + SUIT_ViewManager *aMgr = aViewer->getViewManager(); myView = new SHAPERGUI_SalomeView(mySelector->viewer()); // TODO: Provide ModuleBase_IViewWindow interface - connect(aMgr, SIGNAL(lastViewClosed(SUIT_ViewManager*)), this, SIGNAL(lastViewClosed())); - - connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewWindow*)), - this, SLOT(onTryCloseView(SUIT_ViewWindow*))); - connect(aMgr, SIGNAL(deleteView(SUIT_ViewWindow*)), - this, SLOT(onDeleteView(SUIT_ViewWindow*))); - connect(aMgr, SIGNAL(viewCreated(SUIT_ViewWindow*)), - this, SLOT(onViewCreated(SUIT_ViewWindow*))); - connect(aMgr, SIGNAL(activated(SUIT_ViewManager*)), - this, SLOT(onActivated(SUIT_ViewManager*))); - - connect(aMgr, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this, - SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - connect(aMgr, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*))); - connect(aMgr, SIGNAL(mouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*))); - connect(aMgr, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*))); - - connect(aMgr, SIGNAL(keyPress(SUIT_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyPress(SUIT_ViewWindow*, QKeyEvent*))); - connect(aMgr, SIGNAL(keyRelease(SUIT_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyRelease(SUIT_ViewWindow*, QKeyEvent*))); - - connect(aViewer, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); + connect(aMgr, SIGNAL(lastViewClosed(SUIT_ViewManager *)), this, + SIGNAL(lastViewClosed())); + + connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewWindow *)), this, + SLOT(onTryCloseView(SUIT_ViewWindow *))); + connect(aMgr, SIGNAL(deleteView(SUIT_ViewWindow *)), this, + SLOT(onDeleteView(SUIT_ViewWindow *))); + connect(aMgr, SIGNAL(viewCreated(SUIT_ViewWindow *)), this, + SLOT(onViewCreated(SUIT_ViewWindow *))); + connect(aMgr, SIGNAL(activated(SUIT_ViewManager *)), this, + SLOT(onActivated(SUIT_ViewManager *))); + + connect(aMgr, SIGNAL(mousePress(SUIT_ViewWindow *, QMouseEvent *)), this, + SLOT(onMousePress(SUIT_ViewWindow *, QMouseEvent *))); + connect(aMgr, SIGNAL(mouseRelease(SUIT_ViewWindow *, QMouseEvent *)), this, + SLOT(onMouseRelease(SUIT_ViewWindow *, QMouseEvent *))); + connect(aMgr, SIGNAL(mouseDoubleClick(SUIT_ViewWindow *, QMouseEvent *)), + this, SLOT(onMouseDoubleClick(SUIT_ViewWindow *, QMouseEvent *))); + connect(aMgr, SIGNAL(mouseMove(SUIT_ViewWindow *, QMouseEvent *)), this, + SLOT(onMouseMove(SUIT_ViewWindow *, QMouseEvent *))); + + connect(aMgr, SIGNAL(keyPress(SUIT_ViewWindow *, QKeyEvent *)), this, + SLOT(onKeyPress(SUIT_ViewWindow *, QKeyEvent *))); + connect(aMgr, SIGNAL(keyRelease(SUIT_ViewWindow *, QKeyEvent *)), this, + SLOT(onKeyRelease(SUIT_ViewWindow *, QKeyEvent *))); + + connect(aViewer, SIGNAL(selectionChanged()), this, + SLOT(onSelectionChanged())); } //********************************************** -void SHAPERGUI_SalomeViewer::onSelectionChanged() -{ +void SHAPERGUI_SalomeViewer::onSelectionChanged() { // Selection event must be sent only after mouse release myIsSelectionChanged = true; } //********************************************** -void SHAPERGUI_SalomeViewer::onMousePress(SUIT_ViewWindow* theView, QMouseEvent* theEvent) -{ +void SHAPERGUI_SalomeViewer::onMousePress(SUIT_ViewWindow *theView, + QMouseEvent *theEvent) { myView->setCurrentView(theView); emit mousePress(myView, theEvent); } //********************************************** -void SHAPERGUI_SalomeViewer::onMouseRelease(SUIT_ViewWindow* theView, QMouseEvent* theEvent) -{ +void SHAPERGUI_SalomeViewer::onMouseRelease(SUIT_ViewWindow *theView, + QMouseEvent *theEvent) { myView->setCurrentView(theView); emit mouseRelease(myView, theEvent); if (myIsSelectionChanged) { @@ -212,75 +202,75 @@ void SHAPERGUI_SalomeViewer::onMouseRelease(SUIT_ViewWindow* theView, QMouseEven } //********************************************** -void SHAPERGUI_SalomeViewer::onMouseDoubleClick(SUIT_ViewWindow* theView, QMouseEvent* theEvent) -{ +void SHAPERGUI_SalomeViewer::onMouseDoubleClick(SUIT_ViewWindow *theView, + QMouseEvent *theEvent) { myView->setCurrentView(theView); emit mouseDoubleClick(myView, theEvent); } //********************************************** -void SHAPERGUI_SalomeViewer::onMouseMove(SUIT_ViewWindow* theView, QMouseEvent* theEvent) -{ +void SHAPERGUI_SalomeViewer::onMouseMove(SUIT_ViewWindow *theView, + QMouseEvent *theEvent) { myView->setCurrentView(theView); emit mouseMove(myView, theEvent); } //********************************************** -bool SHAPERGUI_SalomeViewer::canDragByMouse() const -{ - OCCViewer_Viewer* aViewer = mySelector->viewer(); - SUIT_ViewWindow* aWnd = aViewer->getViewManager()->getActiveView(); - OCCViewer_ViewWindow* aViewWnd = dynamic_cast(aWnd); +bool SHAPERGUI_SalomeViewer::canDragByMouse() const { + OCCViewer_Viewer *aViewer = mySelector->viewer(); + SUIT_ViewWindow *aWnd = aViewer->getViewManager()->getActiveView(); + OCCViewer_ViewWindow *aViewWnd = dynamic_cast(aWnd); if (aViewWnd) { return (aViewWnd->interactionStyle() == 0); } return true; } - //********************************************** -void SHAPERGUI_SalomeViewer::onKeyPress(SUIT_ViewWindow* /*theView*/, QKeyEvent* theEvent) -{ +void SHAPERGUI_SalomeViewer::onKeyPress(SUIT_ViewWindow * /*theView*/, + QKeyEvent *theEvent) { emit keyPress(myView, theEvent); } //********************************************** -void SHAPERGUI_SalomeViewer::onKeyRelease(SUIT_ViewWindow* /*theView*/, QKeyEvent* theEvent) -{ +void SHAPERGUI_SalomeViewer::onKeyRelease(SUIT_ViewWindow * /*theView*/, + QKeyEvent *theEvent) { emit keyRelease(myView, theEvent); } //********************************************** -void SHAPERGUI_SalomeViewer::onTryCloseView(SUIT_ViewWindow*) -{ +void SHAPERGUI_SalomeViewer::onTryCloseView(SUIT_ViewWindow *) { emit tryCloseView(myView); } //********************************************** -void SHAPERGUI_SalomeViewer::onDeleteView(SUIT_ViewWindow*) -{ - if(myWindowScale.contains(myView->v3dView())) +void SHAPERGUI_SalomeViewer::onDeleteView(SUIT_ViewWindow *) { + if (myWindowScale.contains(myView->v3dView())) myWindowScale.remove(myView->v3dView()); emit deleteView(myView); } //********************************************** -void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow* theView) -{ +void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow *theView) { myView->setCurrentView(theView); - OCCViewer_ViewFrame* aView = dynamic_cast(theView); + OCCViewer_ViewFrame *aView = dynamic_cast(theView); - OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW); + OCCViewer_ViewWindow *aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW); if (aWnd) { - connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), - this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); - OCCViewer_ViewPort3d* aViewPort = aWnd->getViewPort(); + connect( + aWnd, + SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), + this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); + OCCViewer_ViewPort3d *aViewPort = aWnd->getViewPort(); if (aViewPort) - connect(aViewPort, SIGNAL(vpMapped(OCCViewer_ViewPort3d*)), this, SLOT(onViewPortMapped())); - - OCCViewer_ViewManager* aMgr = dynamic_cast(aWnd->getViewManager()); - if (aMgr) aWnd->enableAutoRotation(aMgr->isAutoRotation()); + connect(aViewPort, SIGNAL(vpMapped(OCCViewer_ViewPort3d *)), this, + SLOT(onViewPortMapped())); + + OCCViewer_ViewManager *aMgr = + dynamic_cast(aWnd->getViewManager()); + if (aMgr) + aWnd->enableAutoRotation(aMgr->isAutoRotation()); } reconnectActions(aWnd, true); @@ -293,58 +283,53 @@ void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow* theView) } //********************************************** -void SHAPERGUI_SalomeViewer::onAfterViewCreated() -{ +void SHAPERGUI_SalomeViewer::onAfterViewCreated() { // Update trihedron and dimension arrows emit onViewTransformed(OCCViewer_ViewWindow::ZOOMVIEW); } - //********************************************** -void SHAPERGUI_SalomeViewer::onActivated(SUIT_ViewManager* theMgr) -{ +void SHAPERGUI_SalomeViewer::onActivated(SUIT_ViewManager *theMgr) { myView->setCurrentView(theMgr->getActiveView()); emit activated(myView); } //********************************************** -void SHAPERGUI_SalomeViewer::enableSelection(bool isEnabled) -{ +void SHAPERGUI_SalomeViewer::enableSelection(bool isEnabled) { if (mySelector) if (mySelector->viewer()->isSelectionEnabled() != isEnabled) mySelector->viewer()->enableSelection(isEnabled); - // The enableSelection() in SALOME 7.5 cause of forced Viewer update(we have blinking) - // After this is corrected, the first row should be recommented, the last - removed - //mySelector->viewer()->setInteractionStyle(isEnabled ? SUIT_ViewModel::STANDARD - // : SUIT_ViewModel::KEY_FREE); + // The enableSelection() in SALOME 7.5 cause of forced Viewer update(we have + // blinking) After this is corrected, the first row should be recommented, the + // last - removed + // mySelector->viewer()->setInteractionStyle(isEnabled ? + // SUIT_ViewModel::STANDARD + // : + // SUIT_ViewModel::KEY_FREE); } //********************************************** -bool SHAPERGUI_SalomeViewer::isSelectionEnabled() const -{ +bool SHAPERGUI_SalomeViewer::isSelectionEnabled() const { if (mySelector) return mySelector->viewer()->isSelectionEnabled(); return false; } //********************************************** -void SHAPERGUI_SalomeViewer::enableMultiselection(bool isEnable) -{ +void SHAPERGUI_SalomeViewer::enableMultiselection(bool isEnable) { if (mySelector) mySelector->viewer()->enableMultiselection(isEnable); } //********************************************** -bool SHAPERGUI_SalomeViewer::isMultiSelectionEnabled() const -{ +bool SHAPERGUI_SalomeViewer::isMultiSelectionEnabled() const { if (mySelector) return mySelector->viewer()->isMultiSelectionEnabled(); return false; } //********************************************** -bool SHAPERGUI_SalomeViewer::enableDrawMode(bool isEnabled) -{ +bool SHAPERGUI_SalomeViewer::enableDrawMode(bool isEnabled) { // TODO: Has to be replaced when SALOME patch become available if (mySelector) return mySelector->viewer()->enableDrawMode(isEnabled); @@ -352,37 +337,37 @@ bool SHAPERGUI_SalomeViewer::enableDrawMode(bool isEnabled) } //********************************************** -void SHAPERGUI_SalomeViewer::reconnectActions(SUIT_ViewWindow* theWindow, - const bool theUseSHAPERSlot) -{ - OCCViewer_ViewWindow* aWindow = dynamic_cast(theWindow); +void SHAPERGUI_SalomeViewer::reconnectActions(SUIT_ViewWindow *theWindow, + const bool theUseSHAPERSlot) { + OCCViewer_ViewWindow *aWindow = + dynamic_cast(theWindow); if (!aWindow) return; - QAction* anAction = theWindow->toolMgr()->action(OCCViewer_ViewWindow::TrihedronShowId); + QAction *anAction = + theWindow->toolMgr()->action(OCCViewer_ViewWindow::TrihedronShowId); if (!anAction) return; if (theUseSHAPERSlot) { - anAction->disconnect(anAction, SIGNAL(toggled(bool)), - theWindow, SLOT(onTrihedronShow(bool))); - anAction->connect(anAction, SIGNAL(toggled(bool)), - this, SIGNAL(trihedronVisibilityChanged(bool))); - } - else { - anAction->connect(anAction, SIGNAL(toggled(bool)), - theWindow, SLOT(onTrihedronShow(bool))); - anAction->disconnect(anAction, SIGNAL(toggled(bool)), - this, SIGNAL(trihedronVisibilityChanged(bool))); + anAction->disconnect(anAction, SIGNAL(toggled(bool)), theWindow, + SLOT(onTrihedronShow(bool))); + anAction->connect(anAction, SIGNAL(toggled(bool)), this, + SIGNAL(trihedronVisibilityChanged(bool))); + } else { + anAction->connect(anAction, SIGNAL(toggled(bool)), theWindow, + SLOT(onTrihedronShow(bool))); + anAction->disconnect(anAction, SIGNAL(toggled(bool)), this, + SIGNAL(trihedronVisibilityChanged(bool))); } } //********************************************** -void SHAPERGUI_SalomeViewer::fitAll() -{ +void SHAPERGUI_SalomeViewer::fitAll() { if (mySelector) { - SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager(); - OCCViewer_ViewFrame* aVFrame = dynamic_cast(aMgr->getActiveView()); + SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager(); + OCCViewer_ViewFrame *aVFrame = + dynamic_cast(aMgr->getActiveView()); if (aVFrame) { aVFrame->onFitAll(); } @@ -390,8 +375,7 @@ void SHAPERGUI_SalomeViewer::fitAll() } //********************************************** -void SHAPERGUI_SalomeViewer::eraseAll() -{ +void SHAPERGUI_SalomeViewer::eraseAll() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; @@ -410,20 +394,20 @@ void SHAPERGUI_SalomeViewer::eraseAll() //********************************************** void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY, - double theZ, double theTwist) -{ + double theZ, double theTwist) { if (!mySelector) return; - SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager(); - OCCViewer_ViewFrame* aVFrame = dynamic_cast(aMgr->getActiveView()); + SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager(); + OCCViewer_ViewFrame *aVFrame = + dynamic_cast(aMgr->getActiveView()); if (aVFrame) { Handle(V3d_View) aView3d = aVFrame->getViewPort()->getView(); if (!aView3d.IsNull()) { aView3d->SetProj(theX, theY, theZ); - aView3d->SetTwist( theTwist ); + aView3d->SetTwist(theTwist); aView3d->FitAll(0.01, false); - //aView3d->SetZSize(0.); + // aView3d->SetZSize(0.); if (aView3d->Depth() < 0.1) aView3d->DepthFitAll(); } @@ -431,8 +415,8 @@ void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY, } //*************************************** -void SHAPERGUI_SalomeViewer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +void SHAPERGUI_SalomeViewer::addSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { aContext->AddFilter(theFilter); @@ -440,8 +424,8 @@ void SHAPERGUI_SalomeViewer::addSelectionFilter(const Handle(SelectMgr_Filter)& } //*************************************** -void SHAPERGUI_SalomeViewer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +void SHAPERGUI_SalomeViewer::removeSelectionFilter( + const Handle(SelectMgr_Filter) & theFilter) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { aContext->RemoveFilter(theFilter); @@ -449,12 +433,12 @@ void SHAPERGUI_SalomeViewer::removeSelectionFilter(const Handle(SelectMgr_Filter } //*************************************** -bool SHAPERGUI_SalomeViewer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +bool SHAPERGUI_SalomeViewer::hasSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { bool aFoundFilter = false; Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { - const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + const SelectMgr_ListOfFilter &aFilters = aContext->Filters(); SelectMgr_ListIteratorOfListOfFilter aIt(aFilters); for (; aIt.More() && !aFoundFilter; aIt.Next()) { aFoundFilter = theFilter.get() == aIt.Value().get(); @@ -464,8 +448,7 @@ bool SHAPERGUI_SalomeViewer::hasSelectionFilter(const Handle(SelectMgr_Filter)& } //*************************************** -void SHAPERGUI_SalomeViewer::clearSelectionFilters() -{ +void SHAPERGUI_SalomeViewer::clearSelectionFilters() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { aContext->RemoveFilters(); @@ -473,8 +456,7 @@ void SHAPERGUI_SalomeViewer::clearSelectionFilters() } //*************************************** -void SHAPERGUI_SalomeViewer::update() -{ +void SHAPERGUI_SalomeViewer::update() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { aContext->UpdateCurrentViewer(); @@ -482,149 +464,148 @@ void SHAPERGUI_SalomeViewer::update() } //*************************************** -void SHAPERGUI_SalomeViewer::onViewTransformed(OCCViewer_ViewWindow::OperationType theType) -{ - emit viewTransformed((int) theType); +void SHAPERGUI_SalomeViewer::onViewTransformed( + OCCViewer_ViewWindow::OperationType theType) { + emit viewTransformed((int)theType); } //*************************************** -void SHAPERGUI_SalomeViewer::onViewPortMapped() -{ +void SHAPERGUI_SalomeViewer::onViewPortMapped() { emit trihedronVisibilityChanged(true); } //*************************************** -void SHAPERGUI_SalomeViewer::activateViewer(bool toActivate) -{ +void SHAPERGUI_SalomeViewer::activateViewer(bool toActivate) { if (!mySelector || !mySelector->viewer()) return; - SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager(); + SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager(); #ifdef SALOME_PATCH_FOR_CTRL_WHEEL - OCCViewer_Viewer* aViewer = dynamic_cast(aMgr->getViewModel()); + OCCViewer_Viewer *aViewer = + dynamic_cast(aMgr->getViewModel()); if (aViewer) aViewer->setUseLocalSelection(toActivate); #endif - QVector aViews = aMgr->getViews(); + QVector aViews = aMgr->getViews(); if (toActivate) { - foreach (SUIT_ViewWindow* aView, aViews) { - OCCViewer_ViewFrame* aOCCView = dynamic_cast(aView); - OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW); - connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), - this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); + foreach (SUIT_ViewWindow *aView, aViews) { + OCCViewer_ViewFrame *aOCCView = + dynamic_cast(aView); + OCCViewer_ViewWindow *aWnd = + aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW); + connect( + aWnd, + SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), + this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); reconnectActions(aWnd, true); - OCCViewer_ViewManager* aOCCMgr = dynamic_cast(aMgr); - if (aOCCMgr) aWnd->enableAutoRotation(aOCCMgr->isAutoRotation()); + OCCViewer_ViewManager *aOCCMgr = + dynamic_cast(aMgr); + if (aOCCMgr) + aWnd->enableAutoRotation(aOCCMgr->isAutoRotation()); } } else { - foreach (SUIT_ViewWindow* aView, aViews) { - OCCViewer_ViewFrame* aOCCView = dynamic_cast(aView); - OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW); - disconnect((OCCViewer_ViewWindow*)aWnd, - SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), - this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); + foreach (SUIT_ViewWindow *aView, aViews) { + OCCViewer_ViewFrame *aOCCView = + dynamic_cast(aView); + OCCViewer_ViewWindow *aWnd = + aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW); + disconnect( + (OCCViewer_ViewWindow *)aWnd, + SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), + this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); reconnectActions(aWnd, false); aWnd->enableAutoRotation(false); } } } -bool SHAPERGUI_SalomeViewer::isColorScaleVisible() const -{ +bool SHAPERGUI_SalomeViewer::isColorScaleVisible() const { if (mySelector) { return mySelector->viewer()->isColorScaleVisible(); } return false; } -void SHAPERGUI_SalomeViewer::setColorScaleShown(bool on) -{ +void SHAPERGUI_SalomeViewer::setColorScaleShown(bool on) { if (mySelector) { mySelector->viewer()->setColorScaleShown(on); } } -void SHAPERGUI_SalomeViewer::setColorScalePosition(double theX, double theY) -{ +void SHAPERGUI_SalomeViewer::setColorScalePosition(double theX, double theY) { if (mySelector) { - QWidget* aWindow = activeViewPort(); - mySelector->viewer()->getColorScale()->SetPosition(aWindow->width() * theX, - aWindow->height() * theY); + QWidget *aWindow = activeViewPort(); + mySelector->viewer()->getColorScale()->SetPosition( + aWindow->width() * theX, aWindow->height() * theY); } } -void SHAPERGUI_SalomeViewer::setColorScaleSize(double theW, double theH) -{ +void SHAPERGUI_SalomeViewer::setColorScaleSize(double theW, double theH) { if (mySelector) { - QWidget* aWindow = activeViewPort(); + QWidget *aWindow = activeViewPort(); mySelector->viewer()->getColorScale()->SetSize(aWindow->width() * theW, - aWindow->height() * theH); + aWindow->height() * theH); } } -void SHAPERGUI_SalomeViewer::setColorScaleRange(double theMin, double theMax) -{ +void SHAPERGUI_SalomeViewer::setColorScaleRange(double theMin, double theMax) { if (mySelector) { mySelector->viewer()->getColorScale()->SetRange(theMin, theMax); } } -void SHAPERGUI_SalomeViewer::setColorScaleIntervals(int theNb) -{ +void SHAPERGUI_SalomeViewer::setColorScaleIntervals(int theNb) { if (mySelector) { mySelector->viewer()->getColorScale()->SetNumberOfIntervals(theNb); } } -void SHAPERGUI_SalomeViewer::setColorScaleTextHeigth(int theH) -{ +void SHAPERGUI_SalomeViewer::setColorScaleTextHeigth(int theH) { if (mySelector) { mySelector->viewer()->getColorScale()->SetTextHeight(theH); } } -void SHAPERGUI_SalomeViewer::setColorScaleTextColor(const QColor& theColor) -{ +void SHAPERGUI_SalomeViewer::setColorScaleTextColor(const QColor &theColor) { if (mySelector) { - Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), Quantity_TOC_RGB); + Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), + Quantity_TOC_RGB); mySelector->viewer()->getColorScale()->SetColor(aColor); } } -void SHAPERGUI_SalomeViewer::setColorScaleTitle(const QString& theText) -{ +void SHAPERGUI_SalomeViewer::setColorScaleTitle(const QString &theText) { if (mySelector) { - mySelector->viewer()->getColorScale()->SetTitle(theText.toStdString().c_str()); + mySelector->viewer()->getColorScale()->SetTitle( + theText.toStdString().c_str()); } } void SHAPERGUI_SalomeViewer::setText( - const ModuleBase_IViewer::TextColor& theText, const int theSize) -{ + const ModuleBase_IViewer::TextColor &theText, const int theSize) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; NCollection_List::Iterator aPrsIter(myText); - if (!theText.empty()) - { + if (!theText.empty()) { Quantity_Color aTextColor; std::string aTextFont; - double anOffset = -theSize - 1; // initial offset from the toolbar of the viewer + double anOffset = + -theSize - 1; // initial offset from the toolbar of the viewer ModuleBase_IViewer::TextColor::const_iterator aLine = theText.cbegin(); - for (; aLine != theText.cend(); aLine++) - { + for (; aLine != theText.cend(); aLine++) { Quantity_Color aColor(aLine->second.at(0) / 255., - aLine->second.at(1) / 255., aLine->second.at(2) / 255., Quantity_TOC_RGB); - if (aLine == theText.cbegin()) - { // the first is the font name and text color + aLine->second.at(1) / 255., + aLine->second.at(2) / 255., Quantity_TOC_RGB); + if (aLine == + theText.cbegin()) { // the first is the font name and text color aTextColor = aColor; aTextFont = std::string(aLine->first.begin(), aLine->first.end()); continue; } Handle(AIS_TextLabel) aPrs; - if (!aPrsIter.More()) - { // new presentation is added to the list forever + if (!aPrsIter.More()) { // new presentation is added to the list forever aPrs = new AIS_TextLabel; aPrs->SetZLayer(Graphic3d_ZLayerId_TopOSD); aPrs->SetHJustification(Graphic3d_HTA_RIGHT); @@ -633,10 +614,8 @@ void SHAPERGUI_SalomeViewer::setText( aPrs->SetTransparency(0.2); static const Graphic3d_Vec2i aZOffset(0); aPrs->SetTransformPersistence(new Graphic3d_TransformPers( - Graphic3d_TMF_2d, Aspect_TOTP_RIGHT_UPPER, aZOffset)); - } - else - { // update the existing presentation + Graphic3d_TMF_2d, Aspect_TOTP_RIGHT_UPPER, aZOffset)); + } else { // update the existing presentation aPrs = aPrsIter.ChangeValue(); if (!aContext->IsDisplayed(aPrs)) aContext->Display(aPrs, Standard_False); @@ -646,16 +625,14 @@ void SHAPERGUI_SalomeViewer::setText( aPrs->SetFont(aTextFont.c_str()); aPrs->SetHeight(theSize); aPrs->SetPosition(gp_Pnt(0, anOffset, 0)); - anOffset -= int(double(theSize) * 1.2 + 1); // to have a proportional gap between lines + anOffset -= int(double(theSize) * 1.2 + + 1); // to have a proportional gap between lines aPrs->SetColor(aTextColor); aPrs->SetColorSubTitle(aColor); - if (!aPrsIter.More()) - { // for the new presentation + if (!aPrsIter.More()) { // for the new presentation aContext->Display(aPrs, Standard_False); myText.Append(aPrs); - } - else - { // update existing presentation + } else { // update existing presentation aContext->Redisplay(aPrs, Standard_False, Standard_False); aPrsIter.Next(); } @@ -666,14 +643,12 @@ void SHAPERGUI_SalomeViewer::setText( aContext->Erase(aPrsIter.ChangeValue(), Standard_False); } -void SHAPERGUI_SalomeViewer::setFitter(OCCViewer_Fitter* theFitter) -{ +void SHAPERGUI_SalomeViewer::setFitter(OCCViewer_Fitter *theFitter) { if (mySelector) mySelector->viewer()->setFitter(theFitter); } -OCCViewer_Fitter* SHAPERGUI_SalomeViewer::fitter() const -{ +OCCViewer_Fitter *SHAPERGUI_SalomeViewer::fitter() const { if (mySelector) return mySelector->viewer()->fitter(); return 0; diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h index ac1eeb74a..3e1948687 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SHAPERGUI_SalomeViewer_H @@ -22,13 +23,13 @@ #include "SHAPER_SHAPERGUI.h" -#include #include +#include #include -#include #include +#include class SUIT_ViewWindow; class QMouseEvent; @@ -40,51 +41,48 @@ class SUIT_ViewManager; class AIS_TextLabel; /** -* \ingroup Salome -* A class for providing access of SHAPERGUI functionality to -* SALOME view window functionality -*/ -class SHAPERGUI_SalomeView: public ModuleBase_IViewWindow -{ + * \ingroup Salome + * A class for providing access of SHAPERGUI functionality to + * SALOME view window functionality + */ +class SHAPERGUI_SalomeView : public ModuleBase_IViewWindow { public: /// Constructor /// \param theViewer a reference to a viewer - SHAPERGUI_SalomeView(OCCViewer_Viewer* theViewer); + SHAPERGUI_SalomeView(OCCViewer_Viewer *theViewer); virtual Handle(V3d_View) v3dView() const; /// Returns the view window view port - virtual QWidget* viewPort() const; + virtual QWidget *viewPort() const; /// Set the current viewer /// \param theViewer a viewer instance - void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; } + void setViewer(OCCViewer_Viewer *theViewer) { myViewer = theViewer; } /// Returns current viewer - OCCViewer_Viewer* viewer() const { return myViewer; } + OCCViewer_Viewer *viewer() const { return myViewer; } /// Sets the current view - void setCurrentView(SUIT_ViewWindow* theView) { myCurrentView = theView; } + void setCurrentView(SUIT_ViewWindow *theView) { myCurrentView = theView; } private: /// A reference to a viewer - OCCViewer_Viewer* myViewer; - SUIT_ViewWindow* myCurrentView; + OCCViewer_Viewer *myViewer; + SUIT_ViewWindow *myCurrentView; }; - /** -* \ingroup Salome -* A class for providing access of SHAPERGUI functionality to -* SALOME viewer functionality -*/ -class SHAPERGUI_SalomeViewer : public ModuleBase_IViewer -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent object - SHAPERGUI_SalomeViewer(QObject* theParent); + * \ingroup Salome + * A class for providing access of SHAPERGUI functionality to + * SALOME viewer functionality + */ +class SHAPERGUI_SalomeViewer : public ModuleBase_IViewer { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent object + SHAPERGUI_SalomeViewer(QObject *theParent); ~SHAPERGUI_SalomeViewer(); @@ -101,7 +99,7 @@ Q_OBJECT virtual Handle(V3d_View) activeView() const; //! Returns viewer view port - virtual QWidget* activeViewPort() const; + virtual QWidget *activeViewPort() const; //! Enable or disable selection in the viewer virtual void enableSelection(bool isEnabled); @@ -118,8 +116,10 @@ Q_OBJECT //! Enable or disable draw mode in the viewer virtual bool enableDrawMode(bool isEnabled); - //! For some signals it disconnects the window from usual signal and connect it to the module ones - void reconnectActions(SUIT_ViewWindow* theWindow, const bool theUseSHAPERSlot); + //! For some signals it disconnects the window from usual signal and connect + //! it to the module ones + void reconnectActions(SUIT_ViewWindow *theWindow, + const bool theUseSHAPERSlot); //! Perfroms the fit all for the active view virtual void fitAll(); @@ -132,31 +132,29 @@ Q_OBJECT /// \param theY the Y projection value /// \param theZ the Z projection value /// \param theTwist the twist angle in radians - virtual void setViewProjection( double theX, double theY, double theZ, - double theTwist ); + virtual void setViewProjection(double theX, double theY, double theZ, + double theTwist); /// Set selector /// \param theSel a selector instance - void setSelector(SHAPERGUI_OCCSelector* theSel); + void setSelector(SHAPERGUI_OCCSelector *theSel); /// Add selection filter to the viewer - virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// Remove selection filter from the viewer - virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual void removeSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter); /// Returns true if the selection filter is set to the viewer /// \param theFilter a selection filter - virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// Remove all selection filters from the viewer virtual void clearSelectionFilters(); /// Returns current selector - SHAPERGUI_OCCSelector* selector() const - { - return mySelector; - } + SHAPERGUI_OCCSelector *selector() const { return mySelector; } /// Update current viewer virtual void update(); @@ -202,53 +200,54 @@ Q_OBJECT //! Set color of text of color scale // \param theH is number of intervals - virtual void setColorScaleTextColor(const QColor& theColor); + virtual void setColorScaleTextColor(const QColor &theColor); //! Set title of color scale // \param theText is a title - virtual void setColorScaleTitle(const QString& theText); + virtual void setColorScaleTitle(const QString &theText); //! Sets the text displayed in right-top corner of the 3D view //! \param theText the text to display, or empty string to erase presentation; //! the first item is the font name and text color //! \param theSize size of the text font - virtual void setText(const ModuleBase_IViewer::TextColor& theText, const int theSize); + virtual void setText(const ModuleBase_IViewer::TextColor &theText, + const int theSize); - virtual void setFitter(OCCViewer_Fitter* theFitter); - virtual OCCViewer_Fitter* fitter() const; + virtual void setFitter(OCCViewer_Fitter *theFitter); + virtual OCCViewer_Fitter *fitter() const; - private slots: - void onMousePress(SUIT_ViewWindow*, QMouseEvent*); - void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*); - void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); - void onKeyPress(SUIT_ViewWindow*, QKeyEvent*); - void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*); +private slots: + void onMousePress(SUIT_ViewWindow *, QMouseEvent *); + void onMouseRelease(SUIT_ViewWindow *, QMouseEvent *); + void onMouseDoubleClick(SUIT_ViewWindow *, QMouseEvent *); + void onMouseMove(SUIT_ViewWindow *, QMouseEvent *); + void onKeyPress(SUIT_ViewWindow *, QKeyEvent *); + void onKeyRelease(SUIT_ViewWindow *, QKeyEvent *); - void onTryCloseView(SUIT_ViewWindow*); - void onDeleteView(SUIT_ViewWindow*); - void onViewCreated(SUIT_ViewWindow*); - void onActivated(SUIT_ViewManager*); + void onTryCloseView(SUIT_ViewWindow *); + void onDeleteView(SUIT_ViewWindow *); + void onViewCreated(SUIT_ViewWindow *); + void onActivated(SUIT_ViewManager *); void onSelectionChanged(); void onViewTransformed(OCCViewer_ViewWindow::OperationType); /// Emit signal about trihedron visiblity change because SALOME sets /// the trihedron visible by this signal. - /// It is necessary to activate the viewer trihedron in the current selection mode + /// It is necessary to activate the viewer trihedron in the current selection + /// mode void onViewPortMapped(); /// Signal called in order to apdate viewer transformed objects void onAfterViewCreated(); - private: - SHAPERGUI_OCCSelector* mySelector; - SHAPERGUI_SalomeView* myView; +private: + SHAPERGUI_OCCSelector *mySelector; + SHAPERGUI_SalomeView *myView; bool myIsSelectionChanged; /// Presentation of names of all displayed SHAPER group results in 3D view, /// a text in right-top corner of the view. NCollection_List myText; }; - #endif diff --git a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp index ef0573879..53c1b006d 100644 --- a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp +++ b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp @@ -14,39 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SHAPERGUI_ToolbarsMgr.h" #include "SHAPERGUI.h" #include +#include #include #include -#include -#include #include +#include #include +#include #include -#include -#include #include #include - +#include #define SEPARATOR "------" #define LIST_WIDTH 180 -class SHAPERGUI_CommandIdItem : public QListWidgetItem -{ +class SHAPERGUI_CommandIdItem : public QListWidgetItem { public: - SHAPERGUI_CommandIdItem(QListWidget* theParent, int theId, SHAPERGUI* theModule) - : QListWidgetItem(theParent), myModule(theModule), myId(theId) {} - + SHAPERGUI_CommandIdItem(QListWidget *theParent, int theId, + SHAPERGUI *theModule) + : QListWidgetItem(theParent), myModule(theModule), myId(theId) {} virtual QVariant data(int theRole) const { - QAction* aAction = 0; + QAction *aAction = 0; if (myId != -1) aAction = myModule->action(myId); @@ -65,88 +64,84 @@ public: return QListWidgetItem::data(theRole); } - int id() const { return myId; } private: - SHAPERGUI* myModule; + SHAPERGUI *myModule; int myId; }; - //************************************************************************************ //************************************************************************************ //************************************************************************************ -SHAPERGUI_ToolbarsDlg::SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule) - : QDialog(theModule->application()->desktop()), - myModule(theModule), - myResult(theModule->shaperToolbars()), - myIsReset(false) -{ +SHAPERGUI_ToolbarsDlg::SHAPERGUI_ToolbarsDlg(SHAPERGUI *theModule) + : QDialog(theModule->application()->desktop()), myModule(theModule), + myResult(theModule->shaperToolbars()), myIsReset(false) { myFreeCommands = theModule->getFreeCommands(); setWindowTitle(tr("Toolbars")); - QVBoxLayout* aMailLayout = new QVBoxLayout(this); + QVBoxLayout *aMailLayout = new QVBoxLayout(this); // Controls part of the dialog - QWidget* aControlsWgt = new QWidget(this); - QHBoxLayout* aContolsLay = new QHBoxLayout(aControlsWgt); + QWidget *aControlsWgt = new QWidget(this); + QHBoxLayout *aContolsLay = new QHBoxLayout(aControlsWgt); aContolsLay->setContentsMargins(0, 0, 0, 0); aMailLayout->addWidget(aControlsWgt); // Right controls - QWidget* aListWgt = new QWidget(aControlsWgt); - QVBoxLayout* aListLayout = new QVBoxLayout(aListWgt); + QWidget *aListWgt = new QWidget(aControlsWgt); + QVBoxLayout *aListLayout = new QVBoxLayout(aListWgt); aListLayout->setContentsMargins(0, 0, 0, 0); aContolsLay->addWidget(aListWgt); aListLayout->addWidget(new QLabel(tr("Toolbars:"), aListWgt)); myToolbarsList = new QListWidget(aListWgt); - connect(myToolbarsList, SIGNAL(doubleClicked(const QModelIndex&)), - SLOT(onDoubleClick(const QModelIndex&))); + connect(myToolbarsList, SIGNAL(doubleClicked(const QModelIndex &)), + SLOT(onDoubleClick(const QModelIndex &))); aListLayout->addWidget(myToolbarsList); - QWidget* aFreeItemsWgt = new QWidget(aListWgt); - QHBoxLayout* aFreeLayout = new QHBoxLayout(aFreeItemsWgt); + QWidget *aFreeItemsWgt = new QWidget(aListWgt); + QHBoxLayout *aFreeLayout = new QHBoxLayout(aFreeItemsWgt); aFreeLayout->setContentsMargins(0, 0, 0, 0); aListLayout->addWidget(aFreeItemsWgt); - aFreeLayout->addWidget(new QLabel(tr("Number of commands out of toolbars:"), aFreeItemsWgt)); + aFreeLayout->addWidget( + new QLabel(tr("Number of commands out of toolbars:"), aFreeItemsWgt)); myFreeNbLbl = new QLabel(aFreeItemsWgt); aFreeLayout->addWidget(myFreeNbLbl); // Left controls - QWidget* aButtonsWgt = new QWidget(aControlsWgt); - QVBoxLayout* aBtnLayout = new QVBoxLayout(aButtonsWgt); + QWidget *aButtonsWgt = new QWidget(aControlsWgt); + QVBoxLayout *aBtnLayout = new QVBoxLayout(aButtonsWgt); aBtnLayout->setContentsMargins(0, 0, 0, 0); aContolsLay->addWidget(aButtonsWgt); - QPushButton* aAddBtn = new QPushButton(tr("Add..."), aButtonsWgt); + QPushButton *aAddBtn = new QPushButton(tr("Add..."), aButtonsWgt); aAddBtn->setToolTip(tr("Add a new empty toolbar to the toolbars list")); connect(aAddBtn, SIGNAL(clicked(bool)), SLOT(onAdd())); aBtnLayout->addWidget(aAddBtn); - QPushButton* aEditBtn = new QPushButton(tr("Edit..."), aButtonsWgt); + QPushButton *aEditBtn = new QPushButton(tr("Edit..."), aButtonsWgt); aEditBtn->setToolTip(tr("Edit currently selected toolbar")); connect(aEditBtn, SIGNAL(clicked(bool)), SLOT(onEdit())); aBtnLayout->addWidget(aEditBtn); - QPushButton* aDeleteBtn = new QPushButton(tr("Delete"), aButtonsWgt); + QPushButton *aDeleteBtn = new QPushButton(tr("Delete"), aButtonsWgt); aDeleteBtn->setToolTip(tr("Delete currently selected toolbar")); connect(aDeleteBtn, SIGNAL(clicked(bool)), SLOT(onDelete())); aBtnLayout->addWidget(aDeleteBtn); aBtnLayout->addStretch(1); - QPushButton* aResetBtn = new QPushButton(tr("Reset"), aButtonsWgt); + QPushButton *aResetBtn = new QPushButton(tr("Reset"), aButtonsWgt); aResetBtn->setToolTip(tr("Restore default toolbars structure")); connect(aResetBtn, SIGNAL(clicked(bool)), SLOT(onReset())); aBtnLayout->addWidget(aResetBtn); aBtnLayout->addSpacing(19); // Buttons part of the dialog - QDialogButtonBox* aButtons = - new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + QDialogButtonBox *aButtons = new QDialogButtonBox( + QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); aMailLayout->addWidget(aButtons); connect(aButtons, SIGNAL(accepted()), SLOT(accept())); @@ -157,33 +152,31 @@ SHAPERGUI_ToolbarsDlg::SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule) updateNumber(); } -void SHAPERGUI_ToolbarsDlg::onAdd() -{ - QString aNewToolbar = - QInputDialog::getText(this, tr("Create toolbar"), tr("Name of a new toolbar")); +void SHAPERGUI_ToolbarsDlg::onAdd() { + QString aNewToolbar = QInputDialog::getText(this, tr("Create toolbar"), + tr("Name of a new toolbar")); if (!(aNewToolbar.isNull() || aNewToolbar.isEmpty())) { if (!myResult.contains(aNewToolbar)) { myResult[aNewToolbar] = QIntList(); updateToolbarsList(); myIsReset = false; - } - else { - QString aMsg = tr("A tool bar with name %1 already exists").arg(aNewToolbar); + } else { + QString aMsg = + tr("A tool bar with name %1 already exists").arg(aNewToolbar); QMessageBox::warning(this, tr("Create toolbar"), aMsg); } } } -void SHAPERGUI_ToolbarsDlg::onEdit() -{ - QList aSelected = myToolbarsList->selectedItems(); +void SHAPERGUI_ToolbarsDlg::onEdit() { + QList aSelected = myToolbarsList->selectedItems(); if (aSelected.size() == 1) { QString aToolbarName = aSelected.first()->text(); int aPos = aToolbarName.lastIndexOf(" ("); aToolbarName = aToolbarName.left(aPos); - SHAPERGUI_ToolbarItemsDlg aDlg(this, myModule, - aToolbarName, myFreeCommands, myResult[aToolbarName]); + SHAPERGUI_ToolbarItemsDlg aDlg(this, myModule, aToolbarName, myFreeCommands, + myResult[aToolbarName]); if (aDlg.exec() == QDialog::Accepted) { myFreeCommands = aDlg.freeItems(); myResult[aToolbarName] = aDlg.toolbarItems(); @@ -194,16 +187,17 @@ void SHAPERGUI_ToolbarsDlg::onEdit() } } -void SHAPERGUI_ToolbarsDlg::onDelete() -{ - QList aSelected = myToolbarsList->selectedItems(); +void SHAPERGUI_ToolbarsDlg::onDelete() { + QList aSelected = myToolbarsList->selectedItems(); if (aSelected.size() == 1) { QString aToolbarName = aSelected.first()->text(); int aPos = aToolbarName.lastIndexOf(" ("); aToolbarName = aToolbarName.left(aPos); - QString aMsg = tr("Toolbar %1 will be deleted. Continue?").arg(aToolbarName); - if (QMessageBox::question(this, tr("Delete toolbar"), aMsg) == QMessageBox::Yes) { + QString aMsg = + tr("Toolbar %1 will be deleted. Continue?").arg(aToolbarName); + if (QMessageBox::question(this, tr("Delete toolbar"), aMsg) == + QMessageBox::Yes) { myFreeCommands.append(myResult[aToolbarName]); // remove separators from free items myFreeCommands.removeAll(-1); @@ -215,68 +209,60 @@ void SHAPERGUI_ToolbarsDlg::onDelete() } } -void SHAPERGUI_ToolbarsDlg::updateToolbarsList() -{ +void SHAPERGUI_ToolbarsDlg::updateToolbarsList() { myToolbarsList->clear(); QStringList aItems; QMap::const_iterator aIt; for (aIt = myResult.cbegin(); aIt != myResult.cend(); aIt++) { - aItems.append(aIt.key() + tr(" (%1 commands)").arg(aIt.value().size() - aIt.value().count(-1))); + aItems.append( + aIt.key() + + tr(" (%1 commands)").arg(aIt.value().size() - aIt.value().count(-1))); } myToolbarsList->addItems(aItems); } - -void SHAPERGUI_ToolbarsDlg::onDoubleClick(const QModelIndex& theIdx) -{ +void SHAPERGUI_ToolbarsDlg::onDoubleClick(const QModelIndex &theIdx) { if (theIdx.isValid()) onEdit(); } -void SHAPERGUI_ToolbarsDlg::updateNumber() -{ +void SHAPERGUI_ToolbarsDlg::updateNumber() { myFreeNbLbl->setText(QString::number(myFreeCommands.size())); } -void SHAPERGUI_ToolbarsDlg::onReset() -{ +void SHAPERGUI_ToolbarsDlg::onReset() { myResult = myModule->defaultToolbars(); updateNumber(); updateToolbarsList(); myIsReset = true; } -void SHAPERGUI_ToolbarsDlg::onHelp() -{ - SUIT_Application* app = SUIT_Session::session()->activeApplication(); +void SHAPERGUI_ToolbarsDlg::onHelp() { + SUIT_Application *app = SUIT_Session::session()->activeApplication(); if (app) - app->onHelpContextModule("SHAPER", "Introduction.html", "toolbars-dialog-box"); + app->onHelpContextModule("SHAPER", "Introduction.html", + "toolbars-dialog-box"); } - //************************************************************************************ //************************************************************************************ //************************************************************************************ -SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg(QWidget* theParent, - SHAPERGUI* theModule, - const QString& theToolbar, - const QIntList& theFreeItems, - const QIntList& theItemsList) - : QDialog(theParent), - myModule(theModule) -{ +SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg( + QWidget *theParent, SHAPERGUI *theModule, const QString &theToolbar, + const QIntList &theFreeItems, const QIntList &theItemsList) + : QDialog(theParent), myModule(theModule) { setWindowTitle(tr("Edit toolbar")); - QVBoxLayout* aMailLayout = new QVBoxLayout(this); + QVBoxLayout *aMailLayout = new QVBoxLayout(this); // Name of toolbar - QWidget* aNameWgt = new QWidget(this); - QHBoxLayout* aNameLay = new QHBoxLayout(aNameWgt); + QWidget *aNameWgt = new QWidget(this); + QHBoxLayout *aNameLay = new QHBoxLayout(aNameWgt); aNameLay->setContentsMargins(0, 0, 0, 0); aMailLayout->addWidget(aNameWgt); aNameLay->addWidget(new QLabel(tr("Toolbar name:"), aNameWgt)); - QLabel* aNameLbl = new QLabel(theToolbar, aNameWgt); + QLabel *aNameLbl = new QLabel(theToolbar, aNameWgt); QFont aFont = aNameLbl->font(); aFont.setBold(true); aNameLbl->setFont(aFont); @@ -284,14 +270,14 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg(QWidget* theParent, aNameLay->addStretch(1); // Lists widget - QWidget* aControlsWgt = new QWidget(this); - QHBoxLayout* aCtrlLayout = new QHBoxLayout(aControlsWgt); + QWidget *aControlsWgt = new QWidget(this); + QHBoxLayout *aCtrlLayout = new QHBoxLayout(aControlsWgt); aCtrlLayout->setContentsMargins(0, 0, 0, 0); aMailLayout->addWidget(aControlsWgt); // Left list - QWidget* aCommandsWgt = new QWidget(aControlsWgt); - QVBoxLayout* aCommandsLay = new QVBoxLayout(aCommandsWgt); + QWidget *aCommandsWgt = new QWidget(aControlsWgt); + QVBoxLayout *aCommandsLay = new QVBoxLayout(aCommandsWgt); aCommandsLay->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aCommandsWgt); @@ -299,68 +285,75 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg(QWidget* theParent, myCommandsList = new QListWidget(aCommandsWgt); myCommandsList->setSortingEnabled(false); - myCommandsList->addItem(new SHAPERGUI_CommandIdItem(myCommandsList, -1, myModule)); - foreach(int aId, theFreeItems) { - myCommandsList->addItem(new SHAPERGUI_CommandIdItem(myCommandsList, aId, myModule)); + myCommandsList->addItem( + new SHAPERGUI_CommandIdItem(myCommandsList, -1, myModule)); + foreach (int aId, theFreeItems) { + myCommandsList->addItem( + new SHAPERGUI_CommandIdItem(myCommandsList, aId, myModule)); } myCommandsList->setMaximumWidth(LIST_WIDTH); aCommandsLay->addWidget(myCommandsList); // Middle buttons - QWidget* aButtonsWgt = new QWidget(aControlsWgt); - QVBoxLayout* aBtnLayout = new QVBoxLayout(aButtonsWgt); + QWidget *aButtonsWgt = new QWidget(aControlsWgt); + QVBoxLayout *aBtnLayout = new QVBoxLayout(aButtonsWgt); aBtnLayout->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aButtonsWgt); aBtnLayout->addStretch(1); - QPushButton* aAddButton = new QPushButton(QIcon(":pictures/arrow-right.png"), "", aButtonsWgt); + QPushButton *aAddButton = + new QPushButton(QIcon(":pictures/arrow-right.png"), "", aButtonsWgt); connect(aAddButton, SIGNAL(clicked(bool)), SLOT(onAddItem())); aBtnLayout->addWidget(aAddButton); aBtnLayout->addSpacing(20); - QPushButton* aDelButton = new QPushButton(QIcon(":pictures/arrow-left.png"), "", aButtonsWgt); + QPushButton *aDelButton = + new QPushButton(QIcon(":pictures/arrow-left.png"), "", aButtonsWgt); connect(aDelButton, SIGNAL(clicked(bool)), SLOT(onDelItem())); aBtnLayout->addWidget(aDelButton); aBtnLayout->addStretch(1); // Right list - QWidget* aItemsWgt = new QWidget(aControlsWgt); - QVBoxLayout* aItemsLay = new QVBoxLayout(aItemsWgt); + QWidget *aItemsWgt = new QWidget(aControlsWgt); + QVBoxLayout *aItemsLay = new QVBoxLayout(aItemsWgt); aItemsLay->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aItemsWgt); aItemsLay->addWidget(new QLabel(tr("In the toolbar:"), aItemsWgt)); myItemsList = new QListWidget(aItemsWgt); myItemsList->setSortingEnabled(false); - foreach(int aId, theItemsList) { - myItemsList->addItem(new SHAPERGUI_CommandIdItem(myItemsList, aId, myModule)); + foreach (int aId, theItemsList) { + myItemsList->addItem( + new SHAPERGUI_CommandIdItem(myItemsList, aId, myModule)); } myItemsList->setMaximumWidth(LIST_WIDTH); myItemsList->viewport()->installEventFilter(this); aItemsLay->addWidget(myItemsList); // Buttons of right list - QWidget* aBtnWgt = new QWidget(aControlsWgt); - QVBoxLayout* aBtnLay = new QVBoxLayout(aBtnWgt); + QWidget *aBtnWgt = new QWidget(aControlsWgt); + QVBoxLayout *aBtnLay = new QVBoxLayout(aBtnWgt); aBtnLay->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aBtnWgt); aBtnLay->addStretch(1); - QPushButton* aUpButton = new QPushButton(QIcon(":pictures/arrow-up.png"), "", aBtnWgt); + QPushButton *aUpButton = + new QPushButton(QIcon(":pictures/arrow-up.png"), "", aBtnWgt); connect(aUpButton, SIGNAL(clicked(bool)), SLOT(onUp())); aBtnLay->addWidget(aUpButton); aBtnLay->addSpacing(20); - QPushButton* aDownButton = new QPushButton(QIcon(":pictures/arrow-down.png"), "", aBtnWgt); + QPushButton *aDownButton = + new QPushButton(QIcon(":pictures/arrow-down.png"), "", aBtnWgt); connect(aDownButton, SIGNAL(clicked(bool)), SLOT(onDown())); aBtnLay->addWidget(aDownButton); aBtnLay->addStretch(1); // Buttons part of the dialog - QDialogButtonBox* aButtons = - new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + QDialogButtonBox *aButtons = new QDialogButtonBox( + QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); aMailLayout->addWidget(aButtons); connect(aButtons, SIGNAL(accepted()), SLOT(accept())); @@ -368,11 +361,11 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg(QWidget* theParent, connect(aButtons, SIGNAL(helpRequested()), SLOT(onHelp())); } -void SHAPERGUI_ToolbarItemsDlg::onAddItem() -{ - QList aCurrentList = myCommandsList->selectedItems(); +void SHAPERGUI_ToolbarItemsDlg::onAddItem() { + QList aCurrentList = myCommandsList->selectedItems(); if (aCurrentList.size() > 0) { - SHAPERGUI_CommandIdItem* aItem = dynamic_cast(aCurrentList.first()); + SHAPERGUI_CommandIdItem *aItem = + dynamic_cast(aCurrentList.first()); int aId = aItem->id(); if (aId != -1) { myCommandsList->removeItemWidget(aItem); @@ -383,18 +376,17 @@ void SHAPERGUI_ToolbarItemsDlg::onAddItem() if (aIdx.isValid()) { int aRow = aIdx.row(); myItemsList->insertItem(aRow, aItem); - } - else { + } else { myItemsList->addItem(aItem); } } } -void SHAPERGUI_ToolbarItemsDlg::onDelItem() -{ - QList aCurrentList = myItemsList->selectedItems(); +void SHAPERGUI_ToolbarItemsDlg::onDelItem() { + QList aCurrentList = myItemsList->selectedItems(); if (aCurrentList.size() > 0) { - SHAPERGUI_CommandIdItem* aItem = dynamic_cast(aCurrentList.first()); + SHAPERGUI_CommandIdItem *aItem = + dynamic_cast(aCurrentList.first()); int aId = aItem->id(); myItemsList->removeItemWidget(aItem); delete aItem; @@ -405,11 +397,9 @@ void SHAPERGUI_ToolbarItemsDlg::onDelItem() } } - -bool SHAPERGUI_ToolbarItemsDlg::eventFilter(QObject* theObj, QEvent* theEvent) -{ +bool SHAPERGUI_ToolbarItemsDlg::eventFilter(QObject *theObj, QEvent *theEvent) { if (theEvent->type() == QEvent::MouseButtonRelease) { - QMouseEvent* aMouseEvent = (QMouseEvent*)theEvent; + QMouseEvent *aMouseEvent = (QMouseEvent *)theEvent; QModelIndex aIdx = myItemsList->indexAt(aMouseEvent->pos()); if (!aIdx.isValid() || aMouseEvent->button() == Qt::RightButton) { myItemsList->setCurrentIndex(QModelIndex()); @@ -418,13 +408,12 @@ bool SHAPERGUI_ToolbarItemsDlg::eventFilter(QObject* theObj, QEvent* theEvent) return QDialog::eventFilter(theObj, theEvent); } -void SHAPERGUI_ToolbarItemsDlg::onUp() -{ +void SHAPERGUI_ToolbarItemsDlg::onUp() { QModelIndex aCurrentIdx = myItemsList->currentIndex(); if (aCurrentIdx.isValid()) { int aRow = aCurrentIdx.row(); if (aRow > 0) { - QListWidgetItem* aItem = myItemsList->takeItem(aRow); + QListWidgetItem *aItem = myItemsList->takeItem(aRow); aRow--; myItemsList->insertItem(aRow, aItem); myItemsList->setCurrentRow(aRow); @@ -432,14 +421,13 @@ void SHAPERGUI_ToolbarItemsDlg::onUp() } } -void SHAPERGUI_ToolbarItemsDlg::onDown() -{ +void SHAPERGUI_ToolbarItemsDlg::onDown() { QModelIndex aCurrentIdx = myItemsList->currentIndex(); if (aCurrentIdx.isValid()) { int aNb = myItemsList->count(); int aRow = aCurrentIdx.row(); if (aRow < (aNb - 1)) { - QListWidgetItem* aItem = myItemsList->takeItem(aRow); + QListWidgetItem *aItem = myItemsList->takeItem(aRow); aRow++; myItemsList->insertItem(aRow, aItem); myItemsList->setCurrentRow(aRow); @@ -447,31 +435,29 @@ void SHAPERGUI_ToolbarItemsDlg::onDown() } } -QIntList SHAPERGUI_ToolbarItemsDlg::freeItems() const -{ +QIntList SHAPERGUI_ToolbarItemsDlg::freeItems() const { return getItems(myCommandsList, 1); } -QIntList SHAPERGUI_ToolbarItemsDlg::toolbarItems() const -{ +QIntList SHAPERGUI_ToolbarItemsDlg::toolbarItems() const { return getItems(myItemsList, 0); } -QIntList SHAPERGUI_ToolbarItemsDlg::getItems(QListWidget* theWidget, int theStart) const -{ +QIntList SHAPERGUI_ToolbarItemsDlg::getItems(QListWidget *theWidget, + int theStart) const { QIntList aList; - SHAPERGUI_CommandIdItem* aItem = 0; + SHAPERGUI_CommandIdItem *aItem = 0; int aNb = theWidget->count(); for (int i = theStart; i < aNb; i++) { - aItem = (SHAPERGUI_CommandIdItem*)theWidget->item(i); + aItem = (SHAPERGUI_CommandIdItem *)theWidget->item(i); aList.append(aItem->id()); } return aList; } -void SHAPERGUI_ToolbarItemsDlg::onHelp() -{ - SUIT_Application* app = SUIT_Session::session()->activeApplication(); +void SHAPERGUI_ToolbarItemsDlg::onHelp() { + SUIT_Application *app = SUIT_Session::session()->activeApplication(); if (app) - app->onHelpContextModule("SHAPER", "Introduction.html", "edit-toolbar-dialog-box"); + app->onHelpContextModule("SHAPER", "Introduction.html", + "edit-toolbar-dialog-box"); } diff --git a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h index b09bf680a..abf3ce83f 100644 --- a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h +++ b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SHAPERGUI_ToolbarsMgr_H @@ -25,20 +26,19 @@ #include #include +#include #include #include -#include class QListWidget; class SHAPERGUI; class QLabel; /** -* \ingroup Salome -* A dialog box for editing of toolbar items -*/ -class SHAPERGUI_ToolbarItemsDlg : public QDialog -{ + * \ingroup Salome + * A dialog box for editing of toolbar items + */ +class SHAPERGUI_ToolbarItemsDlg : public QDialog { Q_OBJECT public: /// Constructor @@ -47,11 +47,10 @@ public: /// \param theToolbar a name of the toolbar for editing /// \param theFreeItems a list of commands out of toolbars /// \param theItemsList a list of command in the toolbar - SHAPERGUI_ToolbarItemsDlg(QWidget* theParent, - SHAPERGUI* theModule, - const QString& theToolbar, - const QIntList& theFreeItems, - const QIntList& theItemsList); + SHAPERGUI_ToolbarItemsDlg(QWidget *theParent, SHAPERGUI *theModule, + const QString &theToolbar, + const QIntList &theFreeItems, + const QIntList &theItemsList); /// Returns list of free commands QIntList freeItems() const; @@ -63,7 +62,7 @@ protected: /// An redifinition of a virtual function /// \param theObj an object /// \param theEvent an event - virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + virtual bool eventFilter(QObject *theObj, QEvent *theEvent); private slots: /// A slot for button to add an item to toolbar commands @@ -82,34 +81,30 @@ private slots: void onHelp(); private: - QIntList getItems(QListWidget* theWidget, int theStart) const; + QIntList getItems(QListWidget *theWidget, int theStart) const; - SHAPERGUI* myModule; + SHAPERGUI *myModule; - QListWidget* myCommandsList; - QListWidget* myItemsList; + QListWidget *myCommandsList; + QListWidget *myItemsList; }; - /** -* \ingroup Salome -* A dialog box for toolbars management -*/ -class SHAPERGUI_ToolbarsDlg : public QDialog -{ + * \ingroup Salome + * A dialog box for toolbars management + */ +class SHAPERGUI_ToolbarsDlg : public QDialog { Q_OBJECT public: /// Constructor /// \param theModule a SHAPER module - SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule); + SHAPERGUI_ToolbarsDlg(SHAPERGUI *theModule); /// Returns result of editing QMap result() const { return myResult; } /// Returns a flag of resetted toolbars structure - bool isReset() const { - return myIsReset; - } + bool isReset() const { return myIsReset; } private slots: /// A slot to add a new toolbar @@ -128,7 +123,7 @@ private slots: void onHelp(); /// A slot called on double click on item in list - void onDoubleClick(const QModelIndex& theIdx); + void onDoubleClick(const QModelIndex &theIdx); private: /// Update content of toolbars list @@ -138,15 +133,14 @@ private: void updateNumber(); private: - SHAPERGUI* myModule; + SHAPERGUI *myModule; QMap myResult; QIntList myFreeCommands; - QLabel* myFreeNbLbl; - QListWidget* myToolbarsList; + QLabel *myFreeNbLbl; + QListWidget *myToolbarsList; bool myIsReset; }; - -#endif \ No newline at end of file +#endif diff --git a/src/SHAPERGUI/SHAPER_SHAPERGUI.h b/src/SHAPERGUI/SHAPER_SHAPERGUI.h index a87896f5f..9e669bdbf 100644 --- a/src/SHAPERGUI/SHAPER_SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPER_SHAPERGUI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SHAPER_SHAPERGUI_H @@ -22,17 +23,16 @@ #if defined SHAPERGUI_EXPORTS #if defined WIN32 -#define SHAPERGUI_EXPORT __declspec( dllexport ) +#define SHAPERGUI_EXPORT __declspec(dllexport) #else #define SHAPERGUI_EXPORT #endif #else #if defined WIN32 -#define SHAPERGUI_EXPORT __declspec( dllimport ) +#define SHAPERGUI_EXPORT __declspec(dllimport) #else #define SHAPERGUI_EXPORT #endif #endif #endif - diff --git a/src/SHAPERGUI/shapergui_app.cpp b/src/SHAPERGUI/shapergui_app.cpp index eeae5764c..5c1f53c5f 100644 --- a/src/SHAPERGUI/shapergui_app.cpp +++ b/src/SHAPERGUI/shapergui_app.cpp @@ -14,47 +14,51 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include #include -int main(int argc, char *argv[]) -{ - constexpr char GUI_ROOT_DIR[]="GUI_ROOT_DIR"; - constexpr char SHAPER_ROOT_DIR[]="SHAPER_ROOT_DIR"; - constexpr char LIGHTAPPCONFIG[]="LightAppConfig"; +int main(int argc, char *argv[]) { + constexpr char GUI_ROOT_DIR[] = "GUI_ROOT_DIR"; + constexpr char SHAPER_ROOT_DIR[] = "SHAPER_ROOT_DIR"; + constexpr char LIGHTAPPCONFIG[] = "LightAppConfig"; QProcessEnvironment pe(QProcessEnvironment::systemEnvironment()); - if(!pe.contains(SHAPER_ROOT_DIR)) - { - std::cerr << SHAPER_ROOT_DIR << " is not defined in your environment !" << std::endl; - return 1; - } - if(!pe.contains(GUI_ROOT_DIR)) - { - std::cerr << GUI_ROOT_DIR << " is not defined in your environment !" << std::endl; - return 1; - } + if (!pe.contains(SHAPER_ROOT_DIR)) { + std::cerr << SHAPER_ROOT_DIR << " is not defined in your environment !" + << std::endl; + return 1; + } + if (!pe.contains(GUI_ROOT_DIR)) { + std::cerr << GUI_ROOT_DIR << " is not defined in your environment !" + << std::endl; + return 1; + } // fill LightAppConfig env var - QString gui_root_dir( QDir::fromNativeSeparators(pe.value(GUI_ROOT_DIR)) ); - QString shaper_root_dir( QDir::fromNativeSeparators(pe.value(SHAPER_ROOT_DIR)) ); - QString lightappconfig_val( QString("%1:%2") - .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/gui").arg(gui_root_dir) ) ) - .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/shaper") - .arg(shaper_root_dir) ) ) ); - pe.insert(LIGHTAPPCONFIG,lightappconfig_val); - //tells shutup to salome.salome_init invoked at shaper engine ignition - pe.insert("SALOME_EMB_SERVANT","1"); + QString gui_root_dir(QDir::fromNativeSeparators(pe.value(GUI_ROOT_DIR))); + QString shaper_root_dir( + QDir::fromNativeSeparators(pe.value(SHAPER_ROOT_DIR))); + QString lightappconfig_val( + QString("%1:%2") + .arg(QDir::toNativeSeparators( + QString("%1/share/salome/resources/gui").arg(gui_root_dir))) + .arg(QDir::toNativeSeparators( + QString("%1/share/salome/resources/shaper") + .arg(shaper_root_dir)))); + pe.insert(LIGHTAPPCONFIG, lightappconfig_val); + // tells shutup to salome.salome_init invoked at shaper engine ignition + pe.insert("SALOME_EMB_SERVANT", "1"); // QProcess proc; proc.setProcessEnvironment(pe); proc.setProgram("suitexe"); proc.setArguments({"--modules=SHAPER"}); - proc.setProcessChannelMode( QProcess::ForwardedErrorChannel ); + proc.setProcessChannelMode(QProcess::ForwardedErrorChannel); proc.start(); proc.waitForFinished(-1); return proc.exitCode(); diff --git a/src/SamplePanelPlugin/SamplePanelPlugin.h b/src/SamplePanelPlugin/SamplePanelPlugin.h index a7adaa8f0..cf50b3589 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SAMPLEPANELPLUGIN_H @@ -22,13 +23,13 @@ #if defined SAMPLEPANELPLUGIN_EXPORTS #if defined WIN32 -#define SAMPLEPANELPLUGIN_EXPORT __declspec( dllexport ) +#define SAMPLEPANELPLUGIN_EXPORT __declspec(dllexport) #else #define SAMPLEPANELPLUGIN_EXPORT #endif #else #if defined WIN32 -#define SAMPLEPANELPLUGIN_EXPORT __declspec( dllimport ) +#define SAMPLEPANELPLUGIN_EXPORT __declspec(dllimport) #else #define SAMPLEPANELPLUGIN_EXPORT #endif diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Feature.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_Feature.cpp index 46abab390..ec8916278 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Feature.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Feature.cpp @@ -14,19 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SamplePanelPlugin_Feature.h" #include "ModelAPI_AttributeInteger.h" -SamplePanelPlugin_Feature::SamplePanelPlugin_Feature() -: ModelAPI_Feature() -{ -} +SamplePanelPlugin_Feature::SamplePanelPlugin_Feature() : ModelAPI_Feature() {} -void SamplePanelPlugin_Feature::initAttributes() -{ +void SamplePanelPlugin_Feature::initAttributes() { data()->addAttribute(VALUE_ID(), ModelAPI_AttributeInteger::typeId()); } diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h b/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h index 3e957cfcb..edfd8bda6 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SAMPLEPANELPLUGIN_FEATURE_H_ @@ -28,28 +29,26 @@ * \ingroup Plugins * \brief Sample feature to be filled by the panel. */ -class SamplePanelPlugin_Feature : public ModelAPI_Feature -{ - public: +class SamplePanelPlugin_Feature : public ModelAPI_Feature { +public: /// SketchShape feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SAMPLE_PANEL_FEATURE_ID("QtPanelFeature"); return MY_SAMPLE_PANEL_FEATURE_ID; } /// Total number of objects, initial and translated objects - inline static const std::string& VALUE_ID() - { + inline static const std::string &VALUE_ID() { static const std::string MY_VALUE_ID("Value"); return MY_VALUE_ID; } - /// Request for initialization of data model of the object: adding all attributes + /// Request for initialization of data model of the object: adding all + /// attributes virtual void initAttributes(); /// Returns the unique kind of a feature - virtual const std::string& getKind() { + virtual const std::string &getKind() { static std::string MY_KIND = SamplePanelPlugin_Feature::ID(); return MY_KIND; }; diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp index f78065847..1a53f5b5a 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp @@ -14,11 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include @@ -26,22 +27,21 @@ #include #include -#include +#include #include #include -#include +#include -SamplePanelPlugin_ModelWidget::SamplePanelPlugin_ModelWidget(QWidget* theParent, - const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData), myDefaultValue(0) -{ - QVBoxLayout* aLay = new QVBoxLayout(this); +SamplePanelPlugin_ModelWidget::SamplePanelPlugin_ModelWidget( + QWidget *theParent, const Config_WidgetAPI *theData) + : ModuleBase_ModelWidget(theParent, theData), myDefaultValue(0) { + QVBoxLayout *aLay = new QVBoxLayout(this); aLay->setContentsMargins(0, 0, 0, 0); myMainWidget = new QWidget(this); aLay->addWidget(myMainWidget); - QGridLayout* aLayout = new QGridLayout(myMainWidget); + QGridLayout *aLayout = new QGridLayout(myMainWidget); aLayout->addWidget(new QLabel(tr("Values:")), 0, 0); myComboBox = new QComboBox(myMainWidget); @@ -49,33 +49,34 @@ SamplePanelPlugin_ModelWidget::SamplePanelPlugin_ModelWidget(QWidget* theParent, myComboBox->addItem("Value_2"); myComboBox->addItem("Value_3"); - connect(myComboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(valuesChanged())); + connect(myComboBox, SIGNAL(currentIndexChanged(int)), this, + SIGNAL(valuesChanged())); aLayout->addWidget(myComboBox, 0, 1); } -QList SamplePanelPlugin_ModelWidget::getControls() const -{ - QList aControls; - // this control will accept focus and will be highlighted in the Property Panel +QList SamplePanelPlugin_ModelWidget::getControls() const { + QList aControls; + // this control will accept focus and will be highlighted in the Property + // Panel aControls.push_back(myComboBox); return aControls; } -bool SamplePanelPlugin_ModelWidget::storeValueCustom() -{ - AttributePtr anAttribute = myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); +bool SamplePanelPlugin_ModelWidget::storeValueCustom() { + AttributePtr anAttribute = + myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); AttributeIntegerPtr aValueAttribute = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); aValueAttribute->setValue(myComboBox->currentIndex()); updateObject(myFeature); return true; } -bool SamplePanelPlugin_ModelWidget::restoreValueCustom() -{ - AttributePtr anAttribute = myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); +bool SamplePanelPlugin_ModelWidget::restoreValueCustom() { + AttributePtr anAttribute = + myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); AttributeIntegerPtr aValueAttribute = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); bool isBlocked = myComboBox->blockSignals(true); myComboBox->setCurrentIndex(aValueAttribute->value()); @@ -83,4 +84,3 @@ bool SamplePanelPlugin_ModelWidget::restoreValueCustom() return true; } - diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h index 42736bc0b..b7e6a353b 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SamplePanelPlugin_ModelWidget_H_ @@ -31,20 +32,21 @@ class QComboBox; /*! * \ingroup GUI - * Represent a content of the property panel to show/modify parameters of some feature. + * Represent a content of the property panel to show/modify parameters of some + * feature. */ -class SamplePanelPlugin_ModelWidget : public ModuleBase_ModelWidget -{ - Q_OBJECT +class SamplePanelPlugin_ModelWidget : public ModuleBase_ModelWidget { + Q_OBJECT public: /// Constructs a model widget - SamplePanelPlugin_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData); + SamplePanelPlugin_ModelWidget(QWidget *theParent, + const Config_WidgetAPI *theData); /// Destructs the model widget virtual ~SamplePanelPlugin_ModelWidget() {} /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + virtual QList getControls() const; protected: /// Saves the internal parameters to the given feature @@ -55,9 +57,9 @@ protected: virtual bool restoreValueCustom(); private: - QWidget* myMainWidget; // parent control for all widget controls - QComboBox* myComboBox; // control for value attribute of the current feature - int myDefaultValue; /// the default combo box value + QWidget *myMainWidget; // parent control for all widget controls + QComboBox *myComboBox; // control for value attribute of the current feature + int myDefaultValue; /// the default combo box value }; #endif /* SamplePanelPlugin_ModelWidget_H_ */ diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp index 8d763e15d..5b5983dac 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SamplePanelPlugin_ModelWidgetCreator.h" @@ -23,23 +24,20 @@ #include SamplePanelPlugin_ModelWidgetCreator::SamplePanelPlugin_ModelWidgetCreator() -: ModuleBase_IWidgetCreator() -{ + : ModuleBase_IWidgetCreator() { myModelWidgetTypes.insert("QtModelWidget"); } -void SamplePanelPlugin_ModelWidgetCreator::widgetTypes(std::set& theTypes) -{ +void SamplePanelPlugin_ModelWidgetCreator::widgetTypes( + std::set &theTypes) { theTypes = myModelWidgetTypes; } -ModuleBase_ModelWidget* SamplePanelPlugin_ModelWidgetCreator::createWidgetByType( - const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* /*theWorkshop*/) -{ - ModuleBase_ModelWidget* aModelWidget = 0; +ModuleBase_ModelWidget * +SamplePanelPlugin_ModelWidgetCreator::createWidgetByType( + const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop * /*theWorkshop*/) { + ModuleBase_ModelWidget *aModelWidget = 0; if (myModelWidgetTypes.find(theType) == myModelWidgetTypes.end()) return aModelWidget; diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h index 1413ae29b..7caf98c55 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SamplePanelPlugin_ModelWidgetCreator_H @@ -24,19 +25,18 @@ #include -#include #include +#include class ModuleBase_IWorkshop; class Config_WidgetAPI; class QWidget; -/** -* \ingroup GUI -* Interface to WidgetCreator which can create specific widgets by type -*/ -class SamplePanelPlugin_ModelWidgetCreator : public ModuleBase_IWidgetCreator -{ +/** + * \ingroup GUI + * Interface to WidgetCreator which can create specific widgets by type + */ +class SamplePanelPlugin_ModelWidgetCreator : public ModuleBase_IWidgetCreator { public: /// Default constructor SamplePanelPlugin_ModelWidgetCreator(); @@ -44,9 +44,9 @@ public: /// Virtual destructor ~SamplePanelPlugin_ModelWidgetCreator() {} - /// Returns a container of possible widget types, which this creator can process - /// \param a list of type names - virtual void widgetTypes(std::set& theTypes); + /// Returns a container of possible widget types, which this creator can + /// process \param a list of type names + virtual void widgetTypes(std::set &theTypes); /// Create widget by its type /// The default implementation is empty @@ -55,10 +55,11 @@ public: /// \param theData a low-level API for reading xml definitions of widgets /// \param theWorkshop a current workshop /// \return a created model widget or null - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - ModuleBase_IWorkshop* /*theWorkshop*/); + virtual ModuleBase_ModelWidget * + createWidgetByType(const std::string &theType, QWidget *theParent, + Config_WidgetAPI *theWidgetApi, + ModuleBase_IWorkshop * /*theWorkshop*/); + private: std::set myModelWidgetTypes; /// types of widgets }; diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp index 3f5b46f56..3b3afb485 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include #include +#include #include #include -#include -SamplePanelPlugin_Panel::SamplePanelPlugin_Panel(QWidget* theParent) -: QWidget(theParent), myDefaultValue(0) -{ - QGridLayout* aLayout = new QGridLayout(this); +SamplePanelPlugin_Panel::SamplePanelPlugin_Panel(QWidget *theParent) + : QWidget(theParent), myDefaultValue(0) { + QGridLayout *aLayout = new QGridLayout(this); aLayout->addWidget(new QLabel(tr("Values:")), 0, 0); myComboBox = new QComboBox(this); @@ -40,25 +40,26 @@ SamplePanelPlugin_Panel::SamplePanelPlugin_Panel(QWidget* theParent) myComboBox->addItem("Value_2"); myComboBox->addItem("Value_3"); - connect(myComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int))); + connect(myComboBox, SIGNAL(currentIndexChanged(int)), this, + SLOT(onCurrentIndexChanged(int))); aLayout->addWidget(myComboBox, 0, 1); } -void SamplePanelPlugin_Panel::setFeature(const FeaturePtr& theFeature) -{ +void SamplePanelPlugin_Panel::setFeature(const FeaturePtr &theFeature) { myFeature = theFeature; - AttributePtr anAttribute = myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); + AttributePtr anAttribute = + myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); AttributeIntegerPtr aValueAttribute = - std::dynamic_pointer_cast(anAttribute); - /// the attribute should be filled with some value, because Apply button of the Property - /// panel is enabled only if all attributes of the feature are initialized - /// It is possible to make it in the initializeAttribute method of the feature after - /// attribute creation + std::dynamic_pointer_cast(anAttribute); + /// the attribute should be filled with some value, because Apply button of + /// the Property panel is enabled only if all attributes of the feature are + /// initialized It is possible to make it in the initializeAttribute method of + /// the feature after attribute creation if (!aValueAttribute->isInitialized()) { aValueAttribute->setValue(myDefaultValue); - /// to update error state of the feature: previous value was that this attribute is not - /// initialized yet. Apply of Property panel was disabled. + /// to update error state of the feature: previous value was that this + /// attribute is not initialized yet. Apply of Property panel was disabled. Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } @@ -66,14 +67,14 @@ void SamplePanelPlugin_Panel::setFeature(const FeaturePtr& theFeature) myComboBox->setCurrentIndex(aValueId); } -void SamplePanelPlugin_Panel::onCurrentIndexChanged(int theIndex) -{ +void SamplePanelPlugin_Panel::onCurrentIndexChanged(int theIndex) { if (!myFeature.get()) return; - AttributePtr anAttribute = myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); + AttributePtr anAttribute = + myFeature->attribute(SamplePanelPlugin_Feature::VALUE_ID()); AttributeIntegerPtr aValueAttribute = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); aValueAttribute->setValue(theIndex); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h index 9edad07da..da2a6506c 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SAMPLEPANELPLUGIN_PANEL_H_ @@ -28,20 +29,20 @@ class QComboBox; /*! * \ingroup GUI - * Represent a content of the property panel to show/modify parameters of some feature. + * Represent a content of the property panel to show/modify parameters of some + * feature. */ -class SamplePanelPlugin_Panel : public QWidget -{ - Q_OBJECT +class SamplePanelPlugin_Panel : public QWidget { + Q_OBJECT public: /// Constructs a panel page - SamplePanelPlugin_Panel(QWidget* theParent); + SamplePanelPlugin_Panel(QWidget *theParent); /// Destructs the page virtual ~SamplePanelPlugin_Panel() {} /// Fill the panel by the feature /// \param theFeature a feature to fill the panel controls - void setFeature(const FeaturePtr& theFeature); + void setFeature(const FeaturePtr &theFeature); protected slots: /// Update feature attribute by the current value of combo box @@ -49,9 +50,9 @@ protected slots: void onCurrentIndexChanged(int theIndex); private: - FeaturePtr myFeature; // the feature which corresponds to the current panel - QComboBox* myComboBox; // control for value attribute of the current feature - int myDefaultValue; /// the default combo box value + FeaturePtr myFeature; // the feature which corresponds to the current panel + QComboBox *myComboBox; // control for value attribute of the current feature + int myDefaultValue; /// the default combo box value }; #endif /* SAMPLEPANELPLUGIN_PANEL_H_ */ diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp index 84d97c9be..1516ea119 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp @@ -14,43 +14,44 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include -#include #include +#include #include +#include +#include #include -#include #include +#include // the only created instance of this plugin -static SamplePanelPlugin_Plugin* MY_SAMPLE_PANEL_PLUGIN_INSTANCE = new SamplePanelPlugin_Plugin(); +static SamplePanelPlugin_Plugin *MY_SAMPLE_PANEL_PLUGIN_INSTANCE = + new SamplePanelPlugin_Plugin(); -SamplePanelPlugin_Plugin::SamplePanelPlugin_Plugin() -{ +SamplePanelPlugin_Plugin::SamplePanelPlugin_Plugin() { SessionPtr aMgr = ModelAPI_Session::get(); - WidgetCreatorFactoryPtr aWidgetCreatorFactory = ModuleBase_WidgetCreatorFactory::get(); + WidgetCreatorFactoryPtr aWidgetCreatorFactory = + ModuleBase_WidgetCreatorFactory::get(); aWidgetCreatorFactory->registerCreator( - std::shared_ptr(new SamplePanelPlugin_WidgetCreator())); + std::shared_ptr( + new SamplePanelPlugin_WidgetCreator())); aWidgetCreatorFactory->registerCreator( - std::shared_ptr( - new SamplePanelPlugin_ModelWidgetCreator())); + std::shared_ptr( + new SamplePanelPlugin_ModelWidgetCreator())); // register this plugin ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr SamplePanelPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr SamplePanelPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == SamplePanelPlugin_Feature::ID()) { return FeaturePtr(new SamplePanelPlugin_Feature); } // feature of such kind is not found return FeaturePtr(); } - diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h index a64075ee5..fd98370e4 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h @@ -14,35 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SAMPLEPANELPLUGIN_PLUGIN_H_ #define SAMPLEPANELPLUGIN_PLUGIN_H_ -#include #include +#include //#include -#include #include +#include class ModuleBase_ModelWidget; class QWidget; /**\class SamplePanelPlugin_Plugin * \ingroup Plugins - * \brief Interface common for any plugin: allows to use plugin by the plugins manager. + * \brief Interface common for any plugin: allows to use plugin by the plugins + * manager. */ //, public ModuleBase_IWidgetCreator -class SamplePanelPlugin_Plugin : public ModelAPI_Plugin -{ +class SamplePanelPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID virtual FeaturePtr createFeature(std::string theFeatureID); - public: - SamplePanelPlugin_Plugin(); +public: + SamplePanelPlugin_Plugin(); }; #endif diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp index 556cfc807..a3c8250c5 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SamplePanelPlugin_WidgetCreator.h" @@ -22,26 +23,24 @@ #include "SamplePanelPlugin_Panel.h" SamplePanelPlugin_WidgetCreator::SamplePanelPlugin_WidgetCreator() -: ModuleBase_IWidgetCreator() -{ + : ModuleBase_IWidgetCreator() { myPanelTypes.insert("QtPanel"); } -void SamplePanelPlugin_WidgetCreator::panelTypes(std::set& theTypes) -{ +void SamplePanelPlugin_WidgetCreator::panelTypes( + std::set &theTypes) { theTypes = myPanelTypes; } -QWidget* SamplePanelPlugin_WidgetCreator::createPanelByType(const std::string& theType, - QWidget* theParent, - const FeaturePtr& theFeature) -{ - QWidget* aWidget = 0; +QWidget *SamplePanelPlugin_WidgetCreator::createPanelByType( + const std::string &theType, QWidget *theParent, + const FeaturePtr &theFeature) { + QWidget *aWidget = 0; if (myPanelTypes.find(theType) == myPanelTypes.end()) return aWidget; if (theType == "QtPanel") { - SamplePanelPlugin_Panel* aPanel = new SamplePanelPlugin_Panel(theParent); + SamplePanelPlugin_Panel *aPanel = new SamplePanelPlugin_Panel(theParent); aPanel->setFeature(theFeature); aWidget = aPanel; } diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h index 783941567..8fad56ce4 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SamplePanelPlugin_WidgetCreator_H @@ -24,17 +25,16 @@ #include -#include #include +#include class QWidget; -/** -* \ingroup GUI -* Interface to WidgetCreator which can create specific widgets by type -*/ -class SamplePanelPlugin_WidgetCreator : public ModuleBase_IWidgetCreator -{ +/** + * \ingroup GUI + * Interface to WidgetCreator which can create specific widgets by type + */ +class SamplePanelPlugin_WidgetCreator : public ModuleBase_IWidgetCreator { public: /// Default constructor SamplePanelPlugin_WidgetCreator(); @@ -44,16 +44,17 @@ public: /// Returns a container of possible page types, which this creator can process /// \param theTypes a list of type names - virtual void panelTypes(std::set& theTypes); + virtual void panelTypes(std::set &theTypes); /// Create panel control by its type. /// \param theType a panel type /// \param theParent a parent widget /// \param theFeature a feature to fill the panel /// \return created widget or null - virtual QWidget* createPanelByType(const std::string& theType, - QWidget* theParent, - const FeaturePtr& theFeature); + virtual QWidget *createPanelByType(const std::string &theType, + QWidget *theParent, + const FeaturePtr &theFeature); + private: std::set myPanelTypes; /// types of panels }; diff --git a/src/Selector/Selector.h b/src/Selector/Selector.h index 1551cc568..0ec7f4405 100644 --- a/src/Selector/Selector.h +++ b/src/Selector/Selector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SELECTOR_H @@ -22,13 +23,13 @@ #if defined SELECTOR_EXPORTS #if defined WIN32 -#define SELECTOR_EXPORT __declspec( dllexport ) +#define SELECTOR_EXPORT __declspec(dllexport) #else #define SELECTOR_EXPORT #endif #else #if defined WIN32 -#define SELECTOR_EXPORT __declspec( dllimport ) +#define SELECTOR_EXPORT __declspec(dllimport) #else #define SELECTOR_EXPORT #endif diff --git a/src/Selector/Selector_Algo.cpp b/src/Selector/Selector_Algo.cpp index fca069679..b21f36bd8 100644 --- a/src/Selector/Selector_Algo.cpp +++ b/src/Selector/Selector_Algo.cpp @@ -14,70 +14,74 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include #include #include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include #include #include +#include #include -#include +#include +#include +#include +#include +#include #include -#include - +#include +#include +#include +#include +#include /// type of the selection, integer keeps the Selector_Type value static const Standard_GUID kSEL_TYPE("db174d59-c2e3-4a90-955e-55544df090d6"); // geometrical naming indicator -static const Standard_GUID kGEOMETRICAL_NAMING("a5322d02-50fb-43ed-9255-75c7b93f6657"); +static const Standard_GUID + kGEOMETRICAL_NAMING("a5322d02-50fb-43ed-9255-75c7b93f6657"); - -// reference attribute that contains the reference to labels where the "from" or "base" shapes +// reference attribute that contains the reference to labels where the "from" +// or "base" shapes // of selection are located static const Standard_GUID kBASE_ARRAY("7c515b1a-9549-493d-9946-a4933a22f45f"); -// if the base array contains reference to the root label, this means that it refers to an -// external document and this list contains a tag in the document +// if the base array contains reference to the root label, this means that it +// refers to an external document and this list contains a tag in the document static const Standard_GUID kBASE_LIST("7c515b1a-9549-493d-9946-a4933a22f45a"); -Selector_Algo::Selector_Algo() -{ +Selector_Algo::Selector_Algo() { myGeometricalNaming = false; // default values myAlwaysGeometricalNaming = false; } -static TDF_Label findGoodLabelWithShape(const TDF_Label theAccess, const TopoDS_Shape& theShape) { +static TDF_Label findGoodLabelWithShape(const TDF_Label theAccess, + const TopoDS_Shape &theShape) { TDF_Label aResult; TDF_Label aMyOpLab; bool aMyOpLabIsComputed = false; - if (TNaming_Tool::HasLabel(theAccess, theShape)) { // selection and delete evolution are not used - for(TNaming_SameShapeIterator aShapes(theShape, theAccess); aShapes.More(); aShapes.Next()) - { + if (TNaming_Tool::HasLabel( + theAccess, theShape)) { // selection and delete evolution are not used + for (TNaming_SameShapeIterator aShapes(theShape, theAccess); aShapes.More(); + aShapes.Next()) { Handle(TNaming_NamedShape) aNS; if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED || + if (aNS->Evolution() == TNaming_MODIFY || + aNS->Evolution() == TNaming_GENERATED || aNS->Evolution() == TNaming_PRIMITIVE) { - // getting label of this operation to avoid usage of ready shapes of this + // getting label of this operation to avoid usage of ready shapes of + // this if (!aMyOpLabIsComputed) { aMyOpLab = theAccess; if (!aMyOpLab.IsNull()) { @@ -85,7 +89,7 @@ static TDF_Label findGoodLabelWithShape(const TDF_Label theAccess, const TopoDS_ if (aDepth < 3) aMyOpLab.Nullify(); else { - for(; aDepth != 3; aDepth--) + for (; aDepth != 3; aDepth--) aMyOpLab = aMyOpLab.Father(); } } @@ -102,34 +106,35 @@ static TDF_Label findGoodLabelWithShape(const TDF_Label theAccess, const TopoDS_ return aResult; } -#define SET_ALGO_FLAGS(algo) \ - algo->myLab = theAccess; \ - algo->myBaseDocumentLab = theBaseDocument; \ - algo->myGeometricalNaming = theGeometricalNaming; \ - algo->myUseNeighbors = theUseNeighbors; \ - algo->myUseIntersections = theUseIntersections; \ +#define SET_ALGO_FLAGS(algo) \ + algo->myLab = theAccess; \ + algo->myBaseDocumentLab = theBaseDocument; \ + algo->myGeometricalNaming = theGeometricalNaming; \ + algo->myUseNeighbors = theUseNeighbors; \ + algo->myUseIntersections = theUseIntersections; \ algo->myAlwaysGeometricalNaming = theAlwaysGeometricalNaming; -Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue, - const TDF_Label theAccess, const TDF_Label theBaseDocument, - const bool theGeometricalNaming, const bool theUseNeighbors, const bool theUseIntersections, - const bool theAlwaysGeometricalNaming) -{ - Selector_Algo* aResult = NULL; +Selector_Algo *Selector_Algo::select( + const TopoDS_Shape theContext, const TopoDS_Shape theValue, + const TDF_Label theAccess, const TDF_Label theBaseDocument, + const bool theGeometricalNaming, const bool theUseNeighbors, + const bool theUseIntersections, const bool theAlwaysGeometricalNaming) { + Selector_Algo *aResult = NULL; if (theValue.IsNull() || theContext.IsNull()) return aResult; - // check the value shape can be named as it is, or it is needed to construct it from the - // higher level shapes (like a box vertex by faces that form this vertex) + // check the value shape can be named as it is, or it is needed to construct + // it from the higher level shapes (like a box vertex by faces that form this + // vertex) bool aIsFound = !findGoodLabelWithShape(theAccess, theValue).IsNull(); if (!aIsFound && !theBaseDocument.IsNull()) // searching in the base document aIsFound = !findGoodLabelWithShape(theBaseDocument, theValue).IsNull(); if (!aIsFound) { TopAbs_ShapeEnum aSelectionType = theValue.ShapeType(); - if (aSelectionType == TopAbs_COMPOUND || aSelectionType == TopAbs_COMPSOLID || - aSelectionType == TopAbs_SHELL || aSelectionType == TopAbs_WIRE) - { - Selector_Container* aContainer = new Selector_Container; + if (aSelectionType == TopAbs_COMPOUND || + aSelectionType == TopAbs_COMPSOLID || aSelectionType == TopAbs_SHELL || + aSelectionType == TopAbs_WIRE) { + Selector_Container *aContainer = new Selector_Container; SET_ALGO_FLAGS(aContainer); if (aContainer->select(theContext, theValue)) return aContainer; @@ -137,10 +142,11 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS return NULL; } - Selector_Intersect* anIntersect = new Selector_Intersect; + Selector_Intersect *anIntersect = new Selector_Intersect; SET_ALGO_FLAGS(anIntersect); bool aGoodIntersector = anIntersect->select(theContext, theValue); - // weak intersector is bad for not use neighbors and has lower priority than neighbors + // weak intersector is bad for not use neighbors and has lower priority than + // neighbors if (aGoodIntersector && anIntersect->myWeakIndex == -1) { return anIntersect; } @@ -149,32 +155,36 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS return NULL; } // searching by neighbors - Selector_FilterByNeighbors* aNBs = new Selector_FilterByNeighbors; + Selector_FilterByNeighbors *aNBs = new Selector_FilterByNeighbors; SET_ALGO_FLAGS(aNBs); // searching a context lab to store in NB algorithm TDF_Label aContextLab = findGoodLabelWithShape(theAccess, theContext); - if (aContextLab.IsNull() && !theBaseDocument.IsNull()) // search also in the base document + if (aContextLab.IsNull() && + !theBaseDocument.IsNull()) // search also in the base document aContextLab = findGoodLabelWithShape(theBaseDocument, theContext); if (aNBs->select(aContextLab, theContext, theValue)) { delete anIntersect; return aNBs; } delete aNBs; - if (aGoodIntersector) { // if neighbors are bad, use intersector with weak index + if (aGoodIntersector) { // if neighbors are bad, use intersector with weak + // index return anIntersect; } delete anIntersect; - // pure weak naming: there is no sense to use pure weak naming for neighbors selection + // pure weak naming: there is no sense to use pure weak naming for neighbors + // selection if (theUseNeighbors) { - Selector_WeakName* aWeak = new Selector_WeakName; + Selector_WeakName *aWeak = new Selector_WeakName; SET_ALGO_FLAGS(aWeak); if (aWeak->select(theContext, theValue)) { return aWeak; } delete aWeak; } - return NULL; // not found value in the tree, not found context shape in the tree also + return NULL; // not found value in the tree, not found context shape in the + // tree also } // getting label of this operation to avoid usage of ready shapes of this TDF_Label aMyOpLab = theAccess; @@ -183,19 +193,19 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS if (aDepth < 3) aMyOpLab.Nullify(); else { - for(; aDepth != 3; aDepth--) + for (; aDepth != 3; aDepth--) aMyOpLab = aMyOpLab.Father(); } } // searching for the base shapes of the value Handle(TNaming_NamedShape) aPrimitiveNS; NCollection_List aModifList; - for(int aUseExternal = 0; aUseExternal < 2; aUseExternal++) { + for (int aUseExternal = 0; aUseExternal < 2; aUseExternal++) { TDF_Label aLab = aUseExternal == 0 ? theAccess : theBaseDocument; if (aLab.IsNull() || !TNaming_Tool::HasLabel(aLab, theValue)) continue; - for(TNaming_SameShapeIterator aShapes(theValue, aLab); aShapes.More(); aShapes.Next()) - { + for (TNaming_SameShapeIterator aShapes(theValue, aLab); aShapes.More(); + aShapes.Next()) { Handle(TNaming_NamedShape) aNS; if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) { TNaming_Evolution anEvolution = aNS->Evolution(); @@ -203,13 +213,15 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS continue; if (!aMyOpLab.IsNull() && aNS->Label().IsDescendant(aMyOpLab)) continue; - if (anEvolution == TNaming_PRIMITIVE) { // the value shape is declared as PRIMITIVE + if (anEvolution == + TNaming_PRIMITIVE) { // the value shape is declared as PRIMITIVE aPrimitiveNS = aNS; break; - } else if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) { + } else if (anEvolution == TNaming_GENERATED || + anEvolution == TNaming_MODIFY) { // check this is a new shape TNaming_Iterator aNSIter(aNS); - for(; aNSIter.More(); aNSIter.Next()) + for (; aNSIter.More(); aNSIter.Next()) if (aNSIter.NewShape().IsSame(theValue)) break; if (aNSIter.More()) // new was found @@ -220,15 +232,16 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS } if (!aPrimitiveNS.IsNull()) { - Selector_Primitive* aPrimitive = new Selector_Primitive; + Selector_Primitive *aPrimitive = new Selector_Primitive; SET_ALGO_FLAGS(aPrimitive); aPrimitive->select(aPrimitiveNS->Label()); return aPrimitive; } else { - Selector_Modify* aModify = new Selector_Modify; + Selector_Modify *aModify = new Selector_Modify; SET_ALGO_FLAGS(aModify); bool aGoodModify = aModify->select(aModifList, theContext, theValue); - // weak intersector is bad for not use neighbors and has lower priority than neighbors + // weak intersector is bad for not use neighbors and has lower priority than + // neighbors if (aGoodModify && aModify->myWeakIndex == -1) { return aModify; } @@ -237,11 +250,12 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS return NULL; } // searching by neighbors - Selector_FilterByNeighbors* aNBs = new Selector_FilterByNeighbors; + Selector_FilterByNeighbors *aNBs = new Selector_FilterByNeighbors; SET_ALGO_FLAGS(aNBs); // searching a context lab to store in NB algorithm TDF_Label aContextLab = findGoodLabelWithShape(theAccess, theContext); - if (aContextLab.IsNull() && !theBaseDocument.IsNull()) // search also in the base document + if (aContextLab.IsNull() && + !theBaseDocument.IsNull()) // search also in the base document aContextLab = findGoodLabelWithShape(theBaseDocument, theContext); if (aNBs->select(aContextLab, theContext, theValue)) { delete aModify; @@ -258,22 +272,23 @@ Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS return NULL; // invalid case } -Selector_Algo* Selector_Algo::relesectWithAllGeometry( - Selector_Algo* theOldAlgo, const TopoDS_Shape theContext) -{ - return select(theContext, theOldAlgo->value(), - theOldAlgo->myLab, theOldAlgo->myBaseDocumentLab, true, true, true, true); +Selector_Algo * +Selector_Algo::relesectWithAllGeometry(Selector_Algo *theOldAlgo, + const TopoDS_Shape theContext) { + return select(theContext, theOldAlgo->value(), theOldAlgo->myLab, + theOldAlgo->myBaseDocumentLab, true, true, true, true); } -void Selector_Algo::storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& theLast) -{ +void Selector_Algo::storeBaseArray(const TDF_LabelList &theRef, + const TDF_Label &theLast) { Handle(TDataStd_ReferenceArray) anArray = - TDataStd_ReferenceArray::Set(myLab, kBASE_ARRAY, 0, theRef.Extent()); - Handle(TDataStd_ExtStringList) anEntries; // entries of references to external document + TDataStd_ReferenceArray::Set(myLab, kBASE_ARRAY, 0, theRef.Extent()); + Handle(TDataStd_ExtStringList) + anEntries; // entries of references to external document const TDF_Label aThisDocRoot = myLab.Root(); TDF_LabelList::Iterator aBIter(theRef); - for(int anIndex = 0; true; aBIter.Next(), anIndex++) { - const TDF_Label& aLab = aBIter.More() ? aBIter.Value() : theLast; + for (int anIndex = 0; true; aBIter.Next(), anIndex++) { + const TDF_Label &aLab = aBIter.More() ? aBIter.Value() : theLast; // check this is a label of this document if (aLab.Root().IsEqual(aThisDocRoot)) { anArray->SetValue(anIndex, aLab); @@ -284,22 +299,24 @@ void Selector_Algo::storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& TCollection_AsciiString anEntry; TDF_Tool::Entry(aLab, anEntry); anEntries->Append(anEntry); - anArray->SetValue(anIndex, aThisDocRoot); // stored root means it is external reference + anArray->SetValue( + anIndex, aThisDocRoot); // stored root means it is external reference } if (!aBIter.More()) break; } } -bool Selector_Algo::restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast) -{ +bool Selector_Algo::restoreBaseArray(TDF_LabelList &theRef, + TDF_Label &theLast) { const TDF_Label aThisDocRoot = myLab.Root(); - Handle(TDataStd_ExtStringList) anEntries; // entries of references to external document + Handle(TDataStd_ExtStringList) + anEntries; // entries of references to external document TDataStd_ListOfExtendedString::Iterator anIter; Handle(TDataStd_ReferenceArray) anArray; if (myLab.FindAttribute(kBASE_ARRAY, anArray)) { int anUpper = anArray->Upper(); - for(int anIndex = anArray->Lower(); anIndex <= anUpper; anIndex++) { + for (int anIndex = anArray->Lower(); anIndex <= anUpper; anIndex++) { TDF_Label aLab = anArray->Value(anIndex); if (aLab.IsEqual(aThisDocRoot)) { // external document reference if (myBaseDocumentLab.IsNull()) @@ -325,15 +342,15 @@ bool Selector_Algo::restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast) return false; } -void Selector_Algo::store(const TopoDS_Shape theShape) -{ +void Selector_Algo::store(const TopoDS_Shape theShape) { TNaming_Builder aBuilder(myLab); aBuilder.Select(theShape, theShape); } -bool Selector_Algo::sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2) { - if (!theShape1.IsNull() && !theShape2.IsNull() && theShape1.ShapeType() == theShape2.ShapeType()) - { +bool Selector_Algo::sameGeometry(const TopoDS_Shape theShape1, + const TopoDS_Shape theShape2) { + if (!theShape1.IsNull() && !theShape2.IsNull() && + theShape1.ShapeType() == theShape2.ShapeType()) { if (theShape1.ShapeType() == TopAbs_FACE) { // check surfaces TopLoc_Location aLoc1, aLoc2; TopoDS_Face aFace1 = TopoDS::Face(theShape1); @@ -345,30 +362,31 @@ bool Selector_Algo::sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shap TopLoc_Location aLoc1, aLoc2; Standard_Real aFirst, aLast; TopoDS_Edge anEdge1 = TopoDS::Edge(theShape1); - Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aLoc1, aFirst, aLast); + Handle(Geom_Curve) aCurve1 = + BRep_Tool::Curve(anEdge1, aLoc1, aFirst, aLast); TopoDS_Edge anEdge2 = TopoDS::Edge(theShape2); - Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aLoc2, aFirst, aLast); + Handle(Geom_Curve) aCurve2 = + BRep_Tool::Curve(anEdge2, aLoc2, aFirst, aLast); return aCurve1 == aCurve2 && aLoc1.IsEqual(aLoc2); } } return false; } -TopoDS_Shape Selector_Algo::value() -{ +TopoDS_Shape Selector_Algo::value() { Handle(TNaming_NamedShape) aNS; if (myLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aNS->Get(); return TopoDS_Shape(); // empty, error shape } -Selector_Algo* Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab) -{ +Selector_Algo *Selector_Algo::restoreByLab(TDF_Label theLab, + TDF_Label theBaseDocLab) { Handle(TDataStd_Integer) aTypeAttr; if (!theLab.FindAttribute(kSEL_TYPE, aTypeAttr)) return NULL; Selector_Type aType = Selector_Type(aTypeAttr->Get()); - Selector_Algo* aResult = NULL; + Selector_Algo *aResult = NULL; switch (aType) { case SELTYPE_CONTAINER: { aResult = new Selector_Container; @@ -409,13 +427,13 @@ Selector_Algo* Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDo return aResult; } -Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseDocLab, - std::wstring theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, - Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab) -{ - Selector_Algo* aResult = NULL; +Selector_Algo *Selector_Algo::restoreByName( + TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName, + const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, + Selector_NameGenerator *theNameGenerator, TDF_Label &theContextLab) { + Selector_Algo *aResult = NULL; if (theName[0] == L'[') { // intersection or container - switch(theShapeType) { + switch (theShapeType) { case TopAbs_COMPOUND: case TopAbs_COMPSOLID: case TopAbs_SHELL: @@ -443,7 +461,8 @@ Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseD aResult->myLab = theLab; aResult->myBaseDocumentLab = theBaseDocLab; aResult->myGeometricalNaming = theGeomNaming; - theContextLab = aResult->restoreByName(theName, theShapeType, theNameGenerator); + theContextLab = + aResult->restoreByName(theName, theShapeType, theNameGenerator); if (theContextLab.IsNull()) { delete aResult; aResult = NULL; @@ -452,8 +471,7 @@ Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseD return aResult; } -void Selector_Algo::storeType(const Selector_Type theType) -{ +void Selector_Algo::storeType(const Selector_Type theType) { myLab.ForgetAllAttributes(true); TDataStd_Integer::Set(myLab, kSEL_TYPE, (int)(theType)); if (myGeometricalNaming) @@ -461,20 +479,23 @@ void Selector_Algo::storeType(const Selector_Type theType) } /// Returns true if theSub is in theContext shape -static bool isInContext(const TopoDS_Shape& theContext, const TopoDS_Shape& theSub) { - for(TopExp_Explorer anExp(theContext, theSub.ShapeType()); anExp.More(); anExp.Next()) { +static bool isInContext(const TopoDS_Shape &theContext, + const TopoDS_Shape &theSub) { + for (TopExp_Explorer anExp(theContext, theSub.ShapeType()); anExp.More(); + anExp.Next()) { if (anExp.Current().IsSame(theSub)) return true; } return false; } -bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const -{ +bool Selector_Algo::findNewVersion(const TopoDS_Shape &theContext, + TopoDS_Shape &theResult) const { if (theResult.IsNull()) return false; if (!TNaming_Tool::HasLabel(myLab, theResult)) { - if (theResult.ShapeType() == TopAbs_COMPOUND) { // do it for all elements of compound + if (theResult.ShapeType() == + TopAbs_COMPOUND) { // do it for all elements of compound BRep_Builder aBuilder; TopoDS_Compound aResultingCompound; aBuilder.MakeCompound(aResultingCompound); @@ -495,8 +516,8 @@ bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& return false; // searching the next modifications of the result shape in document TopTools_MapOfShape aResultShapes; - for(TNaming_NewShapeIterator aBaseIter(theResult, myLab); aBaseIter.More(); aBaseIter.Next()) - { + for (TNaming_NewShapeIterator aBaseIter(theResult, myLab); aBaseIter.More(); + aBaseIter.Next()) { TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution(); if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) { TopoDS_Shape aNextModification = aBaseIter.Shape(); @@ -506,8 +527,7 @@ bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& // don't add vertices generated from edges if (aNextModification.ShapeType() <= theResult.ShapeType()) aResultShapes.Add(aNextModification); - } - else if (findNewVersion(theContext, aNextModification)) { + } else if (findNewVersion(theContext, aNextModification)) { if (aNextModification.ShapeType() <= theResult.ShapeType()) aResultShapes.Add(aNextModification); } @@ -521,7 +541,8 @@ bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& BRep_Builder aBuilder; TopoDS_Compound aResultingCompound; aBuilder.MakeCompound(aResultingCompound); - for(TopTools_MapIteratorOfMapOfShape anIter(aResultShapes); anIter.More(); anIter.Next()) + for (TopTools_MapIteratorOfMapOfShape anIter(aResultShapes); + anIter.More(); anIter.Next()) aBuilder.Add(aResultingCompound, anIter.Value()); theResult = aResultingCompound; } diff --git a/src/Selector/Selector_Algo.h b/src/Selector/Selector_Algo.h index f94634303..f7612b161 100644 --- a/src/Selector/Selector_Algo.h +++ b/src/Selector/Selector_Algo.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_Algo_H_ @@ -33,27 +34,31 @@ class Selector_NameGenerator; * \ingroup DataModel * \brief Base class for all kinds of selection algorithms. */ -class Selector_Algo -{ +class Selector_Algo { TopAbs_ShapeEnum myShapeType; ///< type of this shape - TDF_Label myLab; ///< label where this also may be located - TDF_Label myBaseDocumentLab; ///< an access-label of the document that may contain initial shapes - bool myGeometricalNaming; ///< flag that indicates that geometrical naming selection is enabled - bool myAlwaysGeometricalNaming; ///< to enable geometrical naming from beginning, at select - bool myUseNeighbors; ///< to use neighbors algorithms - bool myUseIntersections; ///< to use intersections algorithms + TDF_Label myLab; ///< label where this also may be located + TDF_Label myBaseDocumentLab; ///< an access-label of the document that may + ///< contain initial shapes + bool myGeometricalNaming; ///< flag that indicates that geometrical naming + ///< selection is enabled + bool myAlwaysGeometricalNaming; ///< to enable geometrical naming from + ///< beginning, at select + bool myUseNeighbors; ///< to use neighbors algorithms + bool myUseIntersections; ///< to use intersections algorithms public: - /// Type of a selector algorithm: on this type depends what is stored in this label and how to - /// restore it on update. + /// Type of a selector algorithm: on this type depends what is stored in this + /// label and how to restore it on update. enum Selector_Type { - SELTYPE_CONTAINER, ///< just a container of sub-elements, keeps the shape type of container - SELTYPE_INTERSECT, ///< sub-shape is intersection of higher level objects - SELTYPE_PRIMITIVE, ///< sub-shape found as a primitive on some label + SELTYPE_CONTAINER, ///< just a container of sub-elements, keeps the shape + ///< type of container + SELTYPE_INTERSECT, ///< sub-shape is intersection of higher level objects + SELTYPE_PRIMITIVE, ///< sub-shape found as a primitive on some label SELTYPE_MODIFICATION, ///< modification of base shapes to the final label - SELTYPE_FILTER_BY_NEIGHBOR, ///< identification by neighbor shapes in context - SELTYPE_WEAK_NAMING, ///< pure weak naming by weak index in context + SELTYPE_FILTER_BY_NEIGHBOR, ///< identification by neighbor shapes in + ///< context + SELTYPE_WEAK_NAMING, ///< pure weak naming by weak index in context }; /// Initializes the algorithm @@ -67,110 +72,115 @@ public: /// \param theValue selected subshape /// \param theGeometricalNaming treats selection with equal surfaces as one /// \param theUseNeighbors enables searching algorithm by neighbors - /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes - SELECTOR_EXPORT static Selector_Algo* select( - const TopoDS_Shape theContext, const TopoDS_Shape theValue, - const TDF_Label theAccess, const TDF_Label theBaseDocument, - const bool theGeometricalNaming = false, - const bool theUseNeighbors = true, const bool theUseIntersections = true, - const bool theAlwaysGeometricalNaming = false); + /// \param theUseIntersections enables searching algorithm by intersection of + /// higher level shapes + SELECTOR_EXPORT static Selector_Algo * + select(const TopoDS_Shape theContext, const TopoDS_Shape theValue, + const TDF_Label theAccess, const TDF_Label theBaseDocument, + const bool theGeometricalNaming = false, + const bool theUseNeighbors = true, + const bool theUseIntersections = true, + const bool theAlwaysGeometricalNaming = false); /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT virtual void store() = 0; - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT virtual bool restore() = 0; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) = 0; + SELECTOR_EXPORT virtual TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) = 0; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) = 0; + SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) = 0; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) = 0; + SELECTOR_EXPORT virtual std::wstring + name(Selector_NameGenerator *theNameGenerator) = 0; /// Returns the current sub-shape value (null if can not resolve) SELECTOR_EXPORT TopoDS_Shape value(); /// Restores sub-algorithm of a given type by the storage-label - SELECTOR_EXPORT static Selector_Algo* restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab); + SELECTOR_EXPORT static Selector_Algo *restoreByLab(TDF_Label theLab, + TDF_Label theBaseDocLab); /// Restores the selected sub-algorithm by the naming name. /// Returns not empty label of the context. - SELECTOR_EXPORT static Selector_Algo* restoreByName( - TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName, - const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, - Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab); + SELECTOR_EXPORT static Selector_Algo * + restoreByName(TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName, + const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, + Selector_NameGenerator *theNameGenerator, + TDF_Label &theContextLab); /// Returns true if the given shapes are based on the same geometry - static bool sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2); - - /// Creates a new selection algorithm for selection of all topology based on the same geometry - SELECTOR_EXPORT static Selector_Algo* relesectWithAllGeometry( - Selector_Algo* theOldAlgo, const TopoDS_Shape theContext); + static bool sameGeometry(const TopoDS_Shape theShape1, + const TopoDS_Shape theShape2); + + /// Creates a new selection algorithm for selection of all topology based on + /// the same geometry + SELECTOR_EXPORT static Selector_Algo * + relesectWithAllGeometry(Selector_Algo *theOldAlgo, + const TopoDS_Shape theContext); /// Sets geometrical naming flag to true - void setGeometricalNaming() - {myGeometricalNaming = true;} + void setGeometricalNaming() { myGeometricalNaming = true; } protected: - /// Returns label where this algorithm is attached to, or just an access label to the document - const TDF_Label& label() const - {return myLab;} - /// Stores the array of references to theLab: references to elements of ref-list, then the last - void storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& theLast); - /// Restores references to the labels: references to elements of ref-list, then the last - bool restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast); + /// Returns label where this algorithm is attached to, or just an access label + /// to the document + const TDF_Label &label() const { return myLab; } + /// Stores the array of references to theLab: references to elements of + /// ref-list, then the last + void storeBaseArray(const TDF_LabelList &theRef, const TDF_Label &theLast); + /// Restores references to the labels: references to elements of ref-list, + /// then the last + bool restoreBaseArray(TDF_LabelList &theRef, TDF_Label &theLast); /// Stores result of selection at the given label void store(const TopoDS_Shape theShape); /// Returns an access-label of the document that may contain initial shapes - const TDF_Label& baseDocument() const - {return myBaseDocumentLab;} + const TDF_Label &baseDocument() const { return myBaseDocumentLab; } /// Returns the geometrical naming flag - bool geometricalNaming() const - {return myGeometricalNaming;} + bool geometricalNaming() const { return myGeometricalNaming; } /// Returns always geometrical naming flag - bool alwaysGeometricalNaming() const - {return myAlwaysGeometricalNaming;} + bool alwaysGeometricalNaming() const { return myAlwaysGeometricalNaming; } /// Returns use neighbors flag - bool useNeighbors() const - {return myUseNeighbors;} + bool useNeighbors() const { return myUseNeighbors; } /// Returns use intersections flag - bool useIntersections() const - {return myUseIntersections;} + bool useIntersections() const { return myUseIntersections; } /// Returns GUID for the weak index (integer attribute) of the sub-shape - static const Standard_GUID& weakID() - { - static const Standard_GUID kWEAK_INDEX("e9373a61-cabc-4ee8-aabf-aea47c62ed87"); + static const Standard_GUID &weakID() { + static const Standard_GUID kWEAK_INDEX( + "e9373a61-cabc-4ee8-aabf-aea47c62ed87"); return kWEAK_INDEX; } - /// Returns GUID for the type of the shape, stored in case it is intersection or container - static const Standard_GUID& shapeTypeID() - { - static const Standard_GUID kSHAPE_TYPE("864b3267-cb9d-4107-bf58-c3ce1775b171"); + /// Returns GUID for the type of the shape, stored in case it is intersection + /// or container + static const Standard_GUID &shapeTypeID() { + static const Standard_GUID kSHAPE_TYPE( + "864b3267-cb9d-4107-bf58-c3ce1775b171"); return kSHAPE_TYPE; } - /// old string identifier of the weak name in modification or intersection types of algorithm - static const std::wstring& oldWeakNameID() - { + /// old string identifier of the weak name in modification or intersection + /// types of algorithm + static const std::wstring &oldWeakNameID() { static const std::wstring kWEAK_NAME_IDENTIFIER = L"weak_name_"; return kWEAK_NAME_IDENTIFIER; } /// old string identifier of the pure weak name - static const std::wstring& oldPureWeakNameID() - { + static const std::wstring &oldPureWeakNameID() { static const std::wstring kPURE_WEAK_NAME_IDENTIFIER = L"_weak_name_"; return kPURE_WEAK_NAME_IDENTIFIER; } - /// string identifier of the weak name in modification or intersection types of algorithm - static const std::wstring& weakNameID() - { - static const std::wstring kWEAK_NAME_IDENTIFIER = std::wstring(L"new_") + oldWeakNameID(); + /// string identifier of the weak name in modification or intersection types + /// of algorithm + static const std::wstring &weakNameID() { + static const std::wstring kWEAK_NAME_IDENTIFIER = + std::wstring(L"new_") + oldWeakNameID(); return kWEAK_NAME_IDENTIFIER; } /// string identifier of the pure weak name - static const std::wstring& pureWeakNameID() - { + static const std::wstring &pureWeakNameID() { static const std::wstring kPURE_WEAK_NAME_IDENTIFIER = std::wstring(L"_new") + oldPureWeakNameID(); return kPURE_WEAK_NAME_IDENTIFIER; @@ -178,9 +188,11 @@ protected: /// Stores the type of an algorithm in the data tree (in myLab) void storeType(const Selector_Type theType); - /// Searches the newer version of the shape in the document if the base shape does not - /// belong to context. Returns it in theResult (if any). Returns true is theResult is changed. - bool findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const; + /// Searches the newer version of the shape in the document if the base shape + /// does not belong to context. Returns it in theResult (if any). Returns true + /// is theResult is changed. + bool findNewVersion(const TopoDS_Shape &theContext, + TopoDS_Shape &theResult) const; }; #endif diff --git a/src/Selector/Selector_AlgoWithSubs.cpp b/src/Selector/Selector_AlgoWithSubs.cpp index ec7a39f81..b3b830c3e 100644 --- a/src/Selector/Selector_AlgoWithSubs.cpp +++ b/src/Selector/Selector_AlgoWithSubs.cpp @@ -14,35 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -Selector_AlgoWithSubs::Selector_AlgoWithSubs() : Selector_Algo() -{} +Selector_AlgoWithSubs::Selector_AlgoWithSubs() : Selector_Algo() {} -void Selector_AlgoWithSubs::clearSubAlgos() -{ - std::list::iterator anAlgo = mySubSelList.begin(); - for(; anAlgo != mySubSelList.end(); anAlgo++) { +void Selector_AlgoWithSubs::clearSubAlgos() { + std::list::iterator anAlgo = mySubSelList.begin(); + for (; anAlgo != mySubSelList.end(); anAlgo++) { delete *anAlgo; } mySubSelList.clear(); } -Selector_AlgoWithSubs::~Selector_AlgoWithSubs() -{ - clearSubAlgos(); -} +Selector_AlgoWithSubs::~Selector_AlgoWithSubs() { clearSubAlgos(); } -TDF_Label Selector_AlgoWithSubs::newSubLabel() -{ +TDF_Label Selector_AlgoWithSubs::newSubLabel() { return label().FindChild(int(mySubSelList.size() + 1)); } -bool Selector_AlgoWithSubs::append(Selector_Algo* theAlgo, const bool theEraseIfNull) -{ +bool Selector_AlgoWithSubs::append(Selector_Algo *theAlgo, + const bool theEraseIfNull) { if (theAlgo) { mySubSelList.push_back(theAlgo); return true; @@ -52,7 +47,6 @@ bool Selector_AlgoWithSubs::append(Selector_Algo* theAlgo, const bool theEraseIf return false; } -std::list& Selector_AlgoWithSubs::list() -{ +std::list &Selector_AlgoWithSubs::list() { return mySubSelList; } diff --git a/src/Selector/Selector_AlgoWithSubs.h b/src/Selector/Selector_AlgoWithSubs.h index c6c836b71..2a2c6310a 100644 --- a/src/Selector/Selector_AlgoWithSubs.h +++ b/src/Selector/Selector_AlgoWithSubs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_AlgoWithSubs_H_ @@ -26,12 +27,12 @@ /**\class Selector_AlgoWithSubs * \ingroup DataModel - * \brief Kind of selection algorithm: generic algorithm that contains sub-algorithms inside. - * It is base for Container, Intersection and FilterByNeighbours algorithms. + * \brief Kind of selection algorithm: generic algorithm that contains + * sub-algorithms inside. It is base for Container, Intersection and + * FilterByNeighbours algorithms. */ -class Selector_AlgoWithSubs: public Selector_Algo -{ - std::list mySubSelList; ///< list of sub-algorithms +class Selector_AlgoWithSubs : public Selector_Algo { + std::list mySubSelList; ///< list of sub-algorithms public: /// Initializes selector Selector_AlgoWithSubs(); @@ -42,9 +43,9 @@ public: /// Returns the next label for a new sub-selector created TDF_Label newSubLabel(); /// Appends a new algorithm to the list, erases list if it is null (failed) - bool append(Selector_Algo* theAlgo, const bool theEraseIfNull = true); + bool append(Selector_Algo *theAlgo, const bool theEraseIfNull = true); /// Returns the stored list of sub-algorithms. - std::list& list(); + std::list &list(); }; #endif diff --git a/src/Selector/Selector_Container.cpp b/src/Selector/Selector_Container.cpp index 90bfdaf0c..e6b6bff29 100644 --- a/src/Selector/Selector_Container.cpp +++ b/src/Selector/Selector_Container.cpp @@ -14,64 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include -#include -#include -#include +#include #include -#include +#include +#include +#include #include -#include +#include #include #include #include -Selector_Container::Selector_Container() : Selector_AlgoWithSubs() -{} +Selector_Container::Selector_Container() : Selector_AlgoWithSubs() {} -bool Selector_Container::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue) -{ +bool Selector_Container::select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue) { myShapeType = theValue.ShapeType(); // iterate all sub-shapes and select them on sublabels - for(TopoDS_Iterator aSubIter(theValue); aSubIter.More(); aSubIter.Next()) { - Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aSubIter.Value(), - newSubLabel(), baseDocument(), - false, useNeighbors(), useIntersections()); //for subs no geometrical naming allowed + for (TopoDS_Iterator aSubIter(theValue); aSubIter.More(); aSubIter.Next()) { + Selector_Algo *aSubAlgo = Selector_Algo::select( + theContext, aSubIter.Value(), newSubLabel(), baseDocument(), false, + useNeighbors(), + useIntersections()); // for subs no geometrical naming allowed if (!append(aSubAlgo)) return false; } return true; } -void Selector_Container::store() -{ +void Selector_Container::store() { storeType(Selector_Algo::SELTYPE_CONTAINER); // store all sub-selectors TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { (*aSubSel)->store(); } TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); } -bool Selector_Container::restore() -{ +bool Selector_Container::restore() { Handle(TDataStd_Integer) aShapeTypeAttr; if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr)) return false; myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get()); // restore sub-selectors - for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { - Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); + for (TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { + Selector_Algo *aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { break; // some empty label left in the end } @@ -79,17 +78,20 @@ bool Selector_Container::restore() return true; } -TDF_Label Selector_Container::restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) -{ +TDF_Label +Selector_Container::restoreByName(std::wstring theName, + const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) { myShapeType = theShapeType; TDF_Label aContext; - for(size_t aStart = 0; aStart != std::wstring::npos; aStart = theName.find('[', aStart + 1)) { + for (size_t aStart = 0; aStart != std::wstring::npos; + aStart = theName.find('[', aStart + 1)) { size_t anEndPos = theName.find(L']', aStart + 1); if (anEndPos != std::wstring::npos) { - // there could be sub-intersections, so, [[...]] case; searching for other open-bracket + // there could be sub-intersections, so, [[...]] case; searching for other + // open-bracket size_t aNextStart = theName.find(L'[', aStart + 1); - while(aNextStart != std::wstring::npos && aNextStart < anEndPos) { + while (aNextStart != std::wstring::npos && aNextStart < anEndPos) { anEndPos = theName.find(L']', anEndPos + 1); if (anEndPos == std::wstring::npos) { return TDF_Label(); // invalid parentheses @@ -101,13 +103,17 @@ TDF_Label Selector_Container::restoreByName(std::wstring theName, std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1); TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE; switch (myShapeType) { - case TopAbs_COMPSOLID: aSubShapeType = TopAbs_SOLID; break; - case TopAbs_WIRE: aSubShapeType = TopAbs_EDGE; break; + case TopAbs_COMPSOLID: + aSubShapeType = TopAbs_SOLID; + break; + case TopAbs_WIRE: + aSubShapeType = TopAbs_EDGE; + break; default:; } TDF_Label aSubContext; - Selector_Algo* aSubSel = - Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType, + Selector_Algo *aSubSel = Selector_Algo::restoreByName( + newSubLabel(), baseDocument(), aSubStr, aSubShapeType, geometricalNaming(), theNameGenerator, aSubContext); if (!append(aSubSel)) return TDF_Label(); @@ -130,12 +136,11 @@ TDF_Label Selector_Container::restoreByName(std::wstring theName, return aContext; } -bool Selector_Container::solve(const TopoDS_Shape& theContext) -{ +bool Selector_Container::solve(const TopoDS_Shape &theContext) { TopoDS_Shape aResult; TopoDS_Builder aBuilder; - switch(myShapeType) { + switch (myShapeType) { case TopAbs_COMPOUND: { TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); @@ -164,8 +169,8 @@ bool Selector_Container::solve(const TopoDS_Shape& theContext) break; } TopoDS_ListOfShape aSubSelectorShapes; - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { if (!(*aSubSel)->solve(theContext)) { return false; } @@ -178,12 +183,12 @@ bool Selector_Container::solve(const TopoDS_Shape& theContext) return false; } -std::wstring Selector_Container::name(Selector_NameGenerator* theNameGenerator) -{ +std::wstring +Selector_Container::name(Selector_NameGenerator *theNameGenerator) { std::wstring aResult; // add names of sub-components one by one in "[]" - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { aResult += '['; aResult += (*aSubSel)->name(theNameGenerator); aResult += ']'; diff --git a/src/Selector/Selector_Container.h b/src/Selector/Selector_Container.h index 005794a14..94b653601 100644 --- a/src/Selector/Selector_Container.h +++ b/src/Selector/Selector_Container.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_Container_H_ @@ -26,33 +27,36 @@ /**\class Selector_Container * \ingroup DataModel - * \brief Kind of selection algorithm: selected shape is a container of sub-shapes that must - * be named one by one. + * \brief Kind of selection algorithm: selected shape is a container of + * sub-shapes that must be named one by one. */ -class Selector_Container: public Selector_AlgoWithSubs -{ +class Selector_Container : public Selector_AlgoWithSubs { TopAbs_ShapeEnum myShapeType; ///< type of this container public: /// Initializes the selection of this kind - SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue); + SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT virtual void store() override; - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT virtual bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override; + SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual std::wstring + name(Selector_NameGenerator *theNameGenerator) override; + private: /// Initializes selector Selector_Container(); diff --git a/src/Selector/Selector_FilterByNeighbors.cpp b/src/Selector/Selector_FilterByNeighbors.cpp index 12fc456a7..1181e9949 100644 --- a/src/Selector/Selector_FilterByNeighbors.cpp +++ b/src/Selector/Selector_FilterByNeighbors.cpp @@ -14,37 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include // array of the neighbor levels -static const Standard_GUID kLEVELS_ARRAY("ee4c4b45-e859-4e86-aa4f-6eac68e0ca1f"); +static const Standard_GUID + kLEVELS_ARRAY("ee4c4b45-e859-4e86-aa4f-6eac68e0ca1f"); -Selector_FilterByNeighbors::Selector_FilterByNeighbors() : Selector_AlgoWithSubs() -{} +Selector_FilterByNeighbors::Selector_FilterByNeighbors() + : Selector_AlgoWithSubs() {} /// Searches neighbor of theLevel of neighborhood to theValue in theContex -static void findNeighbors(const TopoDS_Shape theContext, const TopoDS_Shape theValue, - const int theLevel, TopTools_MapOfShape& theResult) -{ - TopAbs_ShapeEnum aConnectorType = TopAbs_VERTEX; // type of the connector sub-shapes +static void findNeighbors(const TopoDS_Shape theContext, + const TopoDS_Shape theValue, const int theLevel, + TopTools_MapOfShape &theResult) { + TopAbs_ShapeEnum aConnectorType = + TopAbs_VERTEX; // type of the connector sub-shapes TopAbs_ShapeEnum aValueType = theValue.ShapeType(); if (aValueType == TopAbs_FACE) aConnectorType = TopAbs_EDGE; - else if (aValueType == TopAbs_COMPOUND) { // for geometrical naming: compound of faces + else if (aValueType == + TopAbs_COMPOUND) { // for geometrical naming: compound of faces TopExp_Explorer anExp(theValue, TopAbs_FACE); if (anExp.More()) { aConnectorType = TopAbs_EDGE; @@ -53,40 +57,47 @@ static void findNeighbors(const TopoDS_Shape theContext, const TopoDS_Shape theV aValueType = TopAbs_EDGE; } } - TopTools_MapOfShape aNBConnectors; // connector shapes that already belong to neighbors - for(TopExp_Explorer aValExp(theValue, aConnectorType); aValExp.More(); aValExp.Next()) + TopTools_MapOfShape + aNBConnectors; // connector shapes that already belong to neighbors + for (TopExp_Explorer aValExp(theValue, aConnectorType); aValExp.More(); + aValExp.Next()) aNBConnectors.Add(aValExp.Current()); TopTools_MapOfShape alreadyProcessed; if (aValueType == theValue.ShapeType()) alreadyProcessed.Add(theValue); else - for(TopExp_Explorer aValExp(theValue, aValueType); aValExp.More(); aValExp.Next()) + for (TopExp_Explorer aValExp(theValue, aValueType); aValExp.More(); + aValExp.Next()) alreadyProcessed.Add(aValExp.Current()); - for(int aLevel = 1; aLevel <= theLevel; aLevel++) { + for (int aLevel = 1; aLevel <= theLevel; aLevel++) { TopoDS_ListOfShape aGoodCandidates; TopExp_Explorer aCandidate(theContext, aValueType); - for(; aCandidate.More(); aCandidate.Next()) { + for (; aCandidate.More(); aCandidate.Next()) { if (alreadyProcessed.Contains(aCandidate.Current())) continue; TopExp_Explorer aCandConnector(aCandidate.Current(), aConnectorType); - for(; aCandConnector.More(); aCandConnector.Next()) { - if (aNBConnectors.Contains(aCandConnector.Current())) // candidate is neighbor + for (; aCandConnector.More(); aCandConnector.Next()) { + if (aNBConnectors.Contains( + aCandConnector.Current())) // candidate is neighbor break; } if (aCandConnector.More()) { - if (aLevel == theLevel) { // add a NB into result: it is connected to other neighbors + if (aLevel == theLevel) { // add a NB into result: it is connected to + // other neighbors theResult.Add(aCandidate.Current()); } else { // add to the NB of the current level aGoodCandidates.Append(aCandidate.Current()); } } } - if (aLevel != theLevel) { // good candidates are added to neighbor of this level by connectors - for(TopoDS_ListOfShape::Iterator aGood(aGoodCandidates); aGood.More(); aGood.Next()) { + if (aLevel != theLevel) { // good candidates are added to neighbor of this + // level by connectors + for (TopoDS_ListOfShape::Iterator aGood(aGoodCandidates); aGood.More(); + aGood.Next()) { TopExp_Explorer aGoodConnector(aGood.Value(), aConnectorType); - for(; aGoodConnector.More(); aGoodConnector.Next()) { + for (; aGoodConnector.More(); aGoodConnector.Next()) { aNBConnectors.Add(aGoodConnector.Current()); } alreadyProcessed.Add(aGood.Value()); @@ -95,14 +106,17 @@ static void findNeighbors(const TopoDS_Shape theContext, const TopoDS_Shape theV } } -/// Searches the neighbor shape by neighbors defined in theNB in theContext shape -static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext, - const std::list >& theNB, const bool theGeometrical) -{ +/// Searches the neighbor shape by neighbors defined in theNB in theContext +/// shape +static const TopoDS_Shape +findNeighbor(const TopoDS_Shape theContext, + const std::list> &theNB, + const bool theGeometrical) { // searching for neighbors with minimum level int aMinLevel = 0; - std::list >::const_iterator aNBIter = theNB.cbegin(); - for(; aNBIter != theNB.cend(); aNBIter++) { + std::list>::const_iterator aNBIter = + theNB.cbegin(); + for (; aNBIter != theNB.cend(); aNBIter++) { if (aMinLevel == 0 || aNBIter->second < aMinLevel) { aMinLevel = aNBIter->second; } @@ -110,16 +124,17 @@ static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext, // collect all neighbors which are neighbors of sub-shapes with minimum level bool aFirst = true; TopoDS_ListOfShape aMatches; - for(aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) { + for (aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) { if (aNBIter->second == aMinLevel) { TopTools_MapOfShape aThisNBs; findNeighbors(theContext, aNBIter->first, aMinLevel, aThisNBs); if (aFirst) { // aMatches must contain common part of all NBs lists - for(TopTools_MapOfShape::Iterator aThisNB(aThisNBs); aThisNB.More(); aThisNB.Next()) { + for (TopTools_MapOfShape::Iterator aThisNB(aThisNBs); aThisNB.More(); + aThisNB.Next()) { aMatches.Append(aThisNB.Value()); } } else { // remove all in aMatches which are not in this NBs - for(TopoDS_ListOfShape::Iterator aMatch(aMatches); aMatch.More(); ) { + for (TopoDS_ListOfShape::Iterator aMatch(aMatches); aMatch.More();) { if (aThisNBs.Contains(aMatch.Value())) { aMatch.Next(); } else { @@ -134,26 +149,32 @@ static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext, return TopoDS_Shape(); // not found any candidate if (aMatches.Extent() == 1) return aMatches.First(); // already found good candidate - TopoDS_Compound aResultCompound; // in case of geometrical name and many candidates - // iterate all matches to find by other (higher level) neighbors the best candidate + TopoDS_Compound + aResultCompound; // in case of geometrical name and many candidates + // iterate all matches to find by other (higher level) neighbors the best + // candidate TopoDS_Shape aGoodCandidate; - TopTools_MapOfShape aGoodCandidates; // already added good candidates to the map - for(TopoDS_ListOfShape::Iterator aCandidate(aMatches); aCandidate.More(); aCandidate.Next()) { + TopTools_MapOfShape + aGoodCandidates; // already added good candidates to the map + for (TopoDS_ListOfShape::Iterator aCandidate(aMatches); aCandidate.More(); + aCandidate.Next()) { bool aValidCadidate = true; - for(int aLevel = aMinLevel + 1; true; aLevel++) { + for (int aLevel = aMinLevel + 1; true; aLevel++) { bool aFooundHigherLevel = false; TopoDS_ListOfShape aLevelNBs; - for(aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) { + for (aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) { if (aNBIter->second == aLevel) aLevelNBs.Append(aNBIter->first); else if (aNBIter->second >= aLevel) aFooundHigherLevel = true; } - if (!aFooundHigherLevel && aLevelNBs.IsEmpty()) { // iterated all, so, good candidate + if (!aFooundHigherLevel && + aLevelNBs.IsEmpty()) { // iterated all, so, good candidate if (aGoodCandidate.IsNull()) { aGoodCandidate = aCandidate.Value(); } else { // another good candidate - if (theGeometrical && Selector_Algo::sameGeometry(aGoodCandidate, aCandidate.Value())) { + if (theGeometrical && + Selector_Algo::sameGeometry(aGoodCandidate, aCandidate.Value())) { if (!aGoodCandidates.Add(aCandidate.Value())) break; static TopoDS_Builder aBuilder; @@ -171,7 +192,8 @@ static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext, TopTools_MapOfShape aNBsOfCandidate; findNeighbors(theContext, aCandidate.Value(), aLevel, aNBsOfCandidate); // check all stored neighbors are in the map of real neighbors - for(TopoDS_ListOfShape::Iterator aLevIter(aLevelNBs); aLevIter.More(); aLevIter.Next()) { + for (TopoDS_ListOfShape::Iterator aLevIter(aLevelNBs); aLevIter.More(); + aLevIter.Next()) { if (!aNBsOfCandidate.Contains(aLevIter.Value())) { aValidCadidate = false; break; @@ -187,43 +209,49 @@ static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext, return aGoodCandidate; } -bool Selector_FilterByNeighbors::select( - const TDF_Label theContextLab, const TopoDS_Shape theContext, const TopoDS_Shape theValue) -{ +bool Selector_FilterByNeighbors::select(const TDF_Label theContextLab, + const TopoDS_Shape theContext, + const TopoDS_Shape theValue) { myShapeType = theValue.ShapeType(); myContext = theContextLab; // searching by neighbors - std::list > aNBs; /// neighbor sub-shape -> level of neighborhood - // # 19071 : moving through all levels may be too long, in practice there are no more than 2 or 3 - // levels real cases, so, make it "5" as maximum possible - for(int aLevel = 1; aLevel < 5; aLevel++) { + std::list> + aNBs; /// neighbor sub-shape -> level of neighborhood + // # 19071 : moving through all levels may be too long, in practice there are + // no more than 2 or 3 levels real cases, so, make it "5" as maximum possible + for (int aLevel = 1; aLevel < 5; aLevel++) { TopTools_MapOfShape aNewNB; findNeighbors(theContext, theValue, aLevel, aNewNB); - if (aNewNB.Extent() == 0) { // there are no neighbors of the given level, stop iteration + if (aNewNB.Extent() == + 0) { // there are no neighbors of the given level, stop iteration break; } // iterate by the order in theContext to keep same naming names TopExp_Explorer anOrder(theContext, theValue.ShapeType()); TopTools_MapOfShape alreadyProcessed; for (; anOrder.More(); anOrder.Next()) { - if (alreadyProcessed.Add(anOrder.Current()) && aNewNB.Contains(anOrder.Current())) { + if (alreadyProcessed.Add(anOrder.Current()) && + aNewNB.Contains(anOrder.Current())) { TopoDS_Shape aNewNBShape = anOrder.Current(); // check which can be named correctly, without "by neighbors" type - Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aNewNBShape, - newSubLabel(), baseDocument(), geometricalNaming(), false, useIntersections()); + Selector_Algo *aSubAlgo = Selector_Algo::select( + theContext, aNewNBShape, newSubLabel(), baseDocument(), + geometricalNaming(), false, useIntersections()); if (aSubAlgo) { // add to list of good NBs aNBs.push_back(std::pair(aNewNBShape, aLevel)); } - delete aSubAlgo; // don't keep this sub-algo until all subs and whole validity are checked + delete aSubAlgo; // don't keep this sub-algo until all subs and whole + // validity are checked } } TopoDS_Shape aResult = findNeighbor(theContext, aNBs, geometricalNaming()); if (!aResult.IsNull() && aResult.IsSame(theValue)) { - std::list >::iterator aNBIter = aNBs.begin(); - for(; aNBIter != aNBs.end(); aNBIter++) { - Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aNBIter->first, - newSubLabel(), baseDocument(), geometricalNaming(), false, useIntersections()); + std::list>::iterator aNBIter = aNBs.begin(); + for (; aNBIter != aNBs.end(); aNBIter++) { + Selector_Algo *aSubAlgo = Selector_Algo::select( + theContext, aNBIter->first, newSubLabel(), baseDocument(), + geometricalNaming(), false, useIntersections()); if (append(aSubAlgo)) { myNBLevel.push_back(aNBIter->second); } else { @@ -236,20 +264,19 @@ bool Selector_FilterByNeighbors::select( return false; } -void Selector_FilterByNeighbors::store() -{ +void Selector_FilterByNeighbors::store() { storeType(Selector_Algo::SELTYPE_FILTER_BY_NEIGHBOR); TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); // store numbers of levels corresponded to the neighbors in sub-selectors - Handle(TDataStd_IntegerArray) anArray = - TDataStd_IntegerArray::Set(label(), kLEVELS_ARRAY, 0, int(myNBLevel.size()) - 1); + Handle(TDataStd_IntegerArray) anArray = TDataStd_IntegerArray::Set( + label(), kLEVELS_ARRAY, 0, int(myNBLevel.size()) - 1); std::list::iterator aLevel = myNBLevel.begin(); - for(int anIndex = 0; aLevel != myNBLevel.end(); aLevel++, anIndex++) { + for (int anIndex = 0; aLevel != myNBLevel.end(); aLevel++, anIndex++) { anArray->SetValue(anIndex, Abs(*aLevel)); } // store all sub-selectors - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { (*aSubSel)->store(); } // store context reference if exists @@ -259,8 +286,7 @@ void Selector_FilterByNeighbors::store() } } -bool Selector_FilterByNeighbors::restore() -{ +bool Selector_FilterByNeighbors::restore() { Handle(TDataStd_Integer) aShapeTypeAttr; if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr)) return false; @@ -269,19 +295,20 @@ bool Selector_FilterByNeighbors::restore() Handle(TDataStd_IntegerArray) anArray; if (!label().FindAttribute(kLEVELS_ARRAY, anArray)) return false; - for(int anIndex = 0; anIndex <= anArray->Upper(); anIndex++) { + for (int anIndex = 0; anIndex <= anArray->Upper(); anIndex++) { myNBLevel.push_back(anArray->Value(anIndex)); } // restore sub-selectors - for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { - Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); + for (TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { + Selector_Algo *aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { if (!aSub.Value().HasAttribute()) break; // some empty label left in the end - // some selector fails, try to use rest selectors, myNBLevel becomes negative: unused + // some selector fails, try to use rest selectors, myNBLevel becomes + // negative: unused if (myNBLevel.size() > list().size()) { std::list::iterator aListIter = myNBLevel.begin(); - for(size_t a = 0; a < list().size(); a++) + for (size_t a = 0; a < list().size(); a++) aListIter++; *aListIter = -*aListIter; list().push_back(NULL); @@ -295,20 +322,21 @@ bool Selector_FilterByNeighbors::restore() return myNBLevel.size() == list().size() && !myNBLevel.empty(); } -TDF_Label Selector_FilterByNeighbors::restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) -{ +TDF_Label Selector_FilterByNeighbors::restoreByName( + std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) { myShapeType = theShapeType; TDF_Label aContext; - std::wstring aLastLevel; // last level string (after '(' ) to check the context name in the end + std::wstring aLastLevel; // last level string (after '(' ) to check the + // context name in the end for (size_t aStart = 0; aStart != std::wstring::npos; aStart = theName.find(L'(', aStart + 1)) { size_t anEndPos = theName.find(L')', aStart + 1); if (anEndPos != std::wstring::npos) { std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1); TDF_Label aSubContext; - Selector_Algo* aSubSel = - Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, myShapeType, + Selector_Algo *aSubSel = Selector_Algo::restoreByName( + newSubLabel(), baseDocument(), aSubStr, myShapeType, geometricalNaming(), theNameGenerator, aSubContext); if (!append(aSubSel)) return TDF_Label(); @@ -324,14 +352,15 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::wstring theName, } else { aContext = aSubContext; } - //if (!aContext.IsNull()) // for filters by neighbor the latest context shape is vital - // aContext = theNameGenerator->newestContext(aContext); + // if (!aContext.IsNull()) // for filters by neighbor the latest context + // shape is vital + // aContext = theNameGenerator->newestContext(aContext); // searching for the level index std::wstring aLevel; for (anEndPos++; anEndPos != std::wstring::npos && - theName[anEndPos] != L'(' && theName[anEndPos] != 0; - anEndPos++) { + theName[anEndPos] != L'(' && theName[anEndPos] != 0; + anEndPos++) { aLevel += theName[anEndPos]; } aLastLevel = aLevel; @@ -353,7 +382,8 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::wstring theName, std::wstring aContextName = aLastLevel.substr(aLinePos + 1); if (!aContextName.empty()) { TDF_Label aThisContext, aValue; - if (theNameGenerator->restoreContext(aContextName, aThisContext, aValue)) { + if (theNameGenerator->restoreContext(aContextName, aThisContext, + aValue)) { if (!aThisContext.IsNull()) aContext = aThisContext; } @@ -364,18 +394,19 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::wstring theName, return aContext; } -bool Selector_FilterByNeighbors::solve(const TopoDS_Shape& theContext) -{ +bool Selector_FilterByNeighbors::solve(const TopoDS_Shape &theContext) { TopoDS_Shape aResult; - std::list > aNBs; /// neighbor sub-shape -> level of neighborhood + std::list> + aNBs; /// neighbor sub-shape -> level of neighborhood std::list::iterator aLevel = myNBLevel.begin(); - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++, aLevel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++, aLevel++) { if (*aLevel < 0) continue; // skip because sub-selector is not good if ((*aSubSel)->solve(theContext)) { - aNBs.push_back(std::pair((*aSubSel)->value(), *aLevel)); + aNBs.push_back( + std::pair((*aSubSel)->value(), *aLevel)); } } if (!aNBs.empty()) { @@ -388,8 +419,8 @@ bool Selector_FilterByNeighbors::solve(const TopoDS_Shape& theContext) return false; } -std::wstring Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGenerator) -{ +std::wstring +Selector_FilterByNeighbors::name(Selector_NameGenerator *theNameGenerator) { // (nb1)level_if_more_than_1(nb2)level_if_more_than_1(nb3)level_if_more_than_1 bool aThisContextNameNeeded = !myContext.IsNull(); std::wstring aContextName; @@ -397,8 +428,8 @@ std::wstring Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGen aContextName = theNameGenerator->contextName(myContext); std::wstring aResult; std::list::iterator aLevel = myNBLevel.begin(); - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++, aLevel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++, aLevel++) { if (!*aSubSel) continue; std::wstring aSubName = (*aSubSel)->name(theNameGenerator); @@ -407,12 +438,13 @@ std::wstring Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGen aResult += L"(" + aSubName + L")"; if (*aLevel > 1) { std::wostringstream aLevelStr; - aLevelStr<<*aLevel; + aLevelStr << *aLevel; aResult += aLevelStr.str(); } - // sub-name already contains the needed context name, so, here it is not needed - if (aThisContextNameNeeded && ( - aSubName.find(aContextName) == 0 || aSubName.substr(1).find(aContextName) == 0)) + // sub-name already contains the needed context name, so, here it is not + // needed + if (aThisContextNameNeeded && (aSubName.find(aContextName) == 0 || + aSubName.substr(1).find(aContextName) == 0)) aThisContextNameNeeded = false; } if (aThisContextNameNeeded) { diff --git a/src/Selector/Selector_FilterByNeighbors.h b/src/Selector/Selector_FilterByNeighbors.h index 5d1b9782a..df3d630cc 100644 --- a/src/Selector/Selector_FilterByNeighbors.h +++ b/src/Selector/Selector_FilterByNeighbors.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_FilterByNeighbors_H_ @@ -26,37 +27,42 @@ /**\class Selector_FilterByNeighbors * \ingroup DataModel - * \brief Kind of selection algorithm: selected shape is identified by neighbor faces of - * the same type. Or neighbors of neighbors are considered, etc. - * be named one by one. + * \brief Kind of selection algorithm: selected shape is identified by neighbor + * faces of the same type. Or neighbors of neighbors are considered, etc. be + * named one by one. */ -class Selector_FilterByNeighbors: public Selector_AlgoWithSubs -{ +class Selector_FilterByNeighbors : public Selector_AlgoWithSubs { TopAbs_ShapeEnum myShapeType; ///< type of this shape - std::list myNBLevel; ///< list of integers corresponding to subs neighborhood level - TDF_Label myContext; ///< label where the context of filter is stored (for naming name strings) + std::list + myNBLevel; ///< list of integers corresponding to subs neighborhood level + TDF_Label myContext; ///< label where the context of filter is stored (for + ///< naming name strings) public: /// Initializes the selection of this kind - SELECTOR_EXPORT bool select( - const TDF_Label theContextLab, const TopoDS_Shape theContext, const TopoDS_Shape theValue); + SELECTOR_EXPORT bool select(const TDF_Label theContextLab, + const TopoDS_Shape theContext, + const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT virtual void store() override; - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT virtual bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override; + SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual std::wstring + name(Selector_NameGenerator *theNameGenerator) override; + private: /// Initializes selector Selector_FilterByNeighbors(); diff --git a/src/Selector/Selector_Intersect.cpp b/src/Selector/Selector_Intersect.cpp index 7af473b27..42bd79235 100644 --- a/src/Selector/Selector_Intersect.cpp +++ b/src/Selector/Selector_Intersect.cpp @@ -14,46 +14,50 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include #include -#include -#include -#include +#include #include -#include +#include +#include +#include #include -#include +#include #include #include #include -Selector_Intersect::Selector_Intersect() : Selector_AlgoWithSubs() -{ +Selector_Intersect::Selector_Intersect() : Selector_AlgoWithSubs() { myWeakIndex = -1; // no index by default myRecomputeWeakIndex = false; } -// returns the sub-shapes of theSubType which belong to all theShapes (so, common or intersection) -static void commonShapes(const TopoDS_ListOfShape& theShapes, TopAbs_ShapeEnum theSubType, - TopoDS_ListOfShape& theResults) -{ +// returns the sub-shapes of theSubType which belong to all theShapes (so, +// common or intersection) +static void commonShapes(const TopoDS_ListOfShape &theShapes, + TopAbs_ShapeEnum theSubType, + TopoDS_ListOfShape &theResults) { TopoDS_ListOfShape::iterator aSubSel = theShapes.begin(); - for(; aSubSel != theShapes.end(); aSubSel++) { + for (; aSubSel != theShapes.end(); aSubSel++) { TopTools_MapOfShape aCurrentMap; - for(TopExp_Explorer anExp(*aSubSel, theSubType); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(*aSubSel, theSubType); anExp.More(); + anExp.Next()) { if (aCurrentMap.Add(anExp.Current()) && aSubSel == theShapes.begin()) theResults.Append(anExp.Current()); } - if (aSubSel != theShapes.begin()) { // remove from common shapes not in aCurrentMap - for(TopoDS_ListOfShape::Iterator aComIter(theResults); aComIter.More(); ) { + if (aSubSel != + theShapes.begin()) { // remove from common shapes not in aCurrentMap + for (TopoDS_ListOfShape::Iterator aComIter(theResults); + aComIter.More();) { if (aCurrentMap.Contains(aComIter.Value())) aComIter.Next(); else @@ -63,17 +67,19 @@ static void commonShapes(const TopoDS_ListOfShape& theShapes, TopAbs_ShapeEnum t } } -bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue) -{ +bool Selector_Intersect::select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue) { if (!useIntersections()) return false; myShapeType = theValue.ShapeType(); TopAbs_ShapeEnum aSelectionType = myShapeType; // try to find the shape of the higher level type in the context shape - bool aFacesTried = false; // for identification of vertices, faces are tried, then edges - TopoDS_ListOfShape aLastCommon; // store not good commons, but which may be used for weak naming + bool aFacesTried = + false; // for identification of vertices, faces are tried, then edges + TopoDS_ListOfShape aLastCommon; // store not good commons, but which may be + // used for weak naming TopoDS_ListOfShape aLastIntersectors; - while(aSelectionType != TopAbs_FACE || !aFacesTried) { + while (aSelectionType != TopAbs_FACE || !aFacesTried) { if (aSelectionType == TopAbs_FACE) { if (theValue.ShapeType() != TopAbs_VERTEX) break; @@ -81,14 +87,16 @@ bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shap aSelectionType = TopAbs_EDGE; } else aSelectionType = TopAbs_FACE; - TopTools_MapOfShape anIntersectors; // shapes of aSelectionType that contain theValue + TopTools_MapOfShape + anIntersectors; // shapes of aSelectionType that contain theValue TopoDS_ListOfShape anIntList; // same as anIntersectors - for(TopExp_Explorer aSelExp(theContext, aSelectionType); aSelExp.More(); aSelExp.Next()) { + for (TopExp_Explorer aSelExp(theContext, aSelectionType); aSelExp.More(); + aSelExp.Next()) { if (aSelectionType == TopAbs_EDGE && - BRep_Tool::Degenerated(TopoDS::Edge(aSelExp.Current()))) + BRep_Tool::Degenerated(TopoDS::Edge(aSelExp.Current()))) continue; TopExp_Explorer aSubExp(aSelExp.Current(), theValue.ShapeType()); - for(; aSubExp.More(); aSubExp.Next()) { + for (; aSubExp.More(); aSubExp.Next()) { if (aSubExp.Current().IsSame(theValue)) { if (anIntersectors.Add(aSelExp.Current())) anIntList.Append(aSelExp.Current()); @@ -103,15 +111,16 @@ bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shap // name the intersectors TopoDS_ListOfShape::Iterator anInt(anIntList); for (; anInt.More(); anInt.Next()) { - Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, anInt.Value(), - newSubLabel(), baseDocument(), geometricalNaming(), useNeighbors(), false); + Selector_Algo *aSubAlgo = Selector_Algo::select( + theContext, anInt.Value(), newSubLabel(), baseDocument(), + geometricalNaming(), useNeighbors(), false); if (!append(aSubAlgo)) break; // if some selector is failed, stop and search another solution } if (!anInt.More()) { // all intersectors were correctly named return true; } - } else if (aCommon.Extent() > 1 && aLastCommon.IsEmpty()) { + } else if (aCommon.Extent() > 1 && aLastCommon.IsEmpty()) { aLastCommon = aCommon; aLastIntersectors = anIntList; } @@ -120,7 +129,7 @@ bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shap if (alwaysGeometricalNaming()) { TopoDS_ListOfShape::Iterator aCommonIter(aLastCommon); TopoDS_Shape aFirst = aCommonIter.Value(); - for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) { + for (aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) { if (!sameGeometry(aFirst, aCommonIter.Value())) break; } @@ -135,8 +144,9 @@ bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shap // name the intersectors TopoDS_ListOfShape::Iterator anInt(aLastIntersectors); for (; anInt.More(); anInt.Next()) { - Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, anInt.Value(), - newSubLabel(), baseDocument(), geometricalNaming(), useNeighbors(), false); + Selector_Algo *aSubAlgo = Selector_Algo::select( + theContext, anInt.Value(), newSubLabel(), baseDocument(), + geometricalNaming(), useNeighbors(), false); if (!append(aSubAlgo)) break; // if some selector is failed, stop and search another solution } @@ -148,13 +158,12 @@ bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shap return false; // solution does not found } -void Selector_Intersect::store() -{ +void Selector_Intersect::store() { storeType(Selector_Algo::SELTYPE_INTERSECT); // store all sub-selectors TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { (*aSubSel)->store(); } TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); @@ -163,15 +172,14 @@ void Selector_Intersect::store() } } -bool Selector_Intersect::restore() -{ +bool Selector_Intersect::restore() { Handle(TDataStd_Integer) aShapeTypeAttr; if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr)) return false; myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get()); // restore sub-selectors - for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { - Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); + for (TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { + Selector_Algo *aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { break; // some empty label left in the end } @@ -183,21 +191,24 @@ bool Selector_Intersect::restore() return true; } -TDF_Label Selector_Intersect::restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) -{ +TDF_Label +Selector_Intersect::restoreByName(std::wstring theName, + const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) { myShapeType = theShapeType; TDF_Label aContext; - for(size_t aStart = 0; aStart != std::wstring::npos; aStart = theName.find(L'[', aStart + 1)) { + for (size_t aStart = 0; aStart != std::wstring::npos; + aStart = theName.find(L'[', aStart + 1)) { size_t anEndPos = theName.find(L']', aStart + 1); if (anEndPos != std::wstring::npos) { std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1); size_t aFoundOldWeak = aSubStr.find(oldWeakNameID()); - size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos ? - aSubStr.find(weakNameID()) : - aFoundOldWeak; + size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos + ? aSubStr.find(weakNameID()) + : aFoundOldWeak; if (aFoundOldWeak == 0 || aFoundNewWeak == 0) { // weak name identifier - std::wstring aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size()); + std::wstring aWeakIndex = + aSubStr.substr(aFoundOldWeak + oldWeakNameID().size()); myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str()); myRecomputeWeakIndex = aFoundOldWeak == 0; continue; @@ -206,16 +217,20 @@ TDF_Label Selector_Intersect::restoreByName(std::wstring theName, if (anEndPos != std::wstring::npos && anEndPos + 1 < theName.size()) { wchar_t aShapeChar = theName[anEndPos + 1]; if (theName[anEndPos + 1] != L'[') { - switch(aShapeChar) { - case 'e': aSubShapeType = TopAbs_EDGE; break; - case 'v': aSubShapeType = TopAbs_VERTEX; break; + switch (aShapeChar) { + case 'e': + aSubShapeType = TopAbs_EDGE; + break; + case 'v': + aSubShapeType = TopAbs_VERTEX; + break; default:; } } } TDF_Label aSubContext; - Selector_Algo* aSubSel = - Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType, + Selector_Algo *aSubSel = Selector_Algo::restoreByName( + newSubLabel(), baseDocument(), aSubStr, aSubShapeType, geometricalNaming(), theNameGenerator, aSubContext); if (!append(aSubSel)) return TDF_Label(); @@ -237,18 +252,18 @@ TDF_Label Selector_Intersect::restoreByName(std::wstring theName, return aContext; } -bool Selector_Intersect::solve(const TopoDS_Shape& theContext) -{ +bool Selector_Intersect::solve(const TopoDS_Shape &theContext) { TopoDS_Shape aResult; TopoDS_ListOfShape aSubSelectorShapes; - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { if (!(*aSubSel)->solve(theContext)) { return false; } aSubSelectorShapes.Append((*aSubSel)->value()); } - TopoDS_ListOfShape aCommon; // common sub shapes in each sub-selector (a result) + TopoDS_ListOfShape + aCommon; // common sub shapes in each sub-selector (a result) commonShapes(aSubSelectorShapes, myShapeType, aCommon); if (aCommon.Extent() != 1) { if (myWeakIndex != -1) { @@ -259,15 +274,17 @@ bool Selector_Intersect::solve(const TopoDS_Shape& theContext) // check results are on the same geometry, create compound TopoDS_ListOfShape::Iterator aCommonIter(aCommon); TopoDS_Shape aFirst = aCommonIter.Value(); - for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) { + for (aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) { if (!sameGeometry(aFirst, aCommonIter.Value())) break; } - if (!aCommonIter.More()) { // all geometry is same, create a result compound + if (!aCommonIter + .More()) { // all geometry is same, create a result compound TopoDS_Builder aBuilder; TopoDS_Compound aCompound; aBuilder.MakeCompound(aCompound); - for(aCommonIter.Initialize(aCommon); aCommonIter.More(); aCommonIter.Next()) { + for (aCommonIter.Initialize(aCommon); aCommonIter.More(); + aCommonIter.Next()) { aBuilder.Add(aCompound, aCommonIter.Value()); } aResult = aCompound; @@ -285,22 +302,27 @@ bool Selector_Intersect::solve(const TopoDS_Shape& theContext) return false; } -std::wstring Selector_Intersect::name(Selector_NameGenerator* theNameGenerator) -{ +std::wstring +Selector_Intersect::name(Selector_NameGenerator *theNameGenerator) { std::wstring aResult; // add names of sub-components one by one in "[]" +optionally [weak_name_1] - std::list::const_iterator aSubSel = list().cbegin(); - for(; aSubSel != list().cend(); aSubSel++) { + std::list::const_iterator aSubSel = list().cbegin(); + for (; aSubSel != list().cend(); aSubSel++) { aResult += '['; aResult += (*aSubSel)->name(theNameGenerator); aResult += ']'; TopoDS_Shape aSubVal = (*aSubSel)->value(); if (!aSubVal.IsNull()) { TopAbs_ShapeEnum aSubType = aSubVal.ShapeType(); - if (aSubType != TopAbs_FACE) { // in case the sub shape type must be stored - switch(aSubType) { - case TopAbs_EDGE: aResult += L"e"; break; - case TopAbs_VERTEX: aResult += L"v"; break; + if (aSubType != + TopAbs_FACE) { // in case the sub shape type must be stored + switch (aSubType) { + case TopAbs_EDGE: + aResult += L"e"; + break; + case TopAbs_VERTEX: + aResult += L"v"; + break; default:; } } @@ -308,7 +330,7 @@ std::wstring Selector_Intersect::name(Selector_NameGenerator* theNameGenerator) } if (myWeakIndex != -1) { std::wostringstream aWeakStr; - aWeakStr<<"["< -#include #include +#include #include -#include +#include +#include +#include +#include #include -#include +#include #include +#include #include -#include -#include -#include -#include #include -#include +#include #include #include #include -Selector_Modify::Selector_Modify() : Selector_Algo() -{ +Selector_Modify::Selector_Modify() : Selector_Algo() { myWeakIndex = -1; // no index by default myRecomputeWeakIndex = false; } -// adds to theResult all labels that contain initial shapes for theValue located in theFinal +// adds to theResult all labels that contain initial shapes for theValue located +// in theFinal static void findBases(TDF_Label theAccess, Handle(TNaming_NamedShape) theFinal, - const TopoDS_Shape& theValue, - bool aMustBeAtFinal, const TDF_Label& theAdditionalDocument, TDF_LabelList& theResult) -{ + const TopoDS_Shape &theValue, bool aMustBeAtFinal, + const TDF_Label &theAdditionalDocument, + TDF_LabelList &theResult) { bool aFoundAnyShape = false; if (TNaming_Tool::HasLabel(theAccess, theValue)) { TNaming_SameShapeIterator aLabIter(theValue, theAccess); - for(; aLabIter.More(); aLabIter.Next()) { + for (; aLabIter.More(); aLabIter.Next()) { Handle(TNaming_NamedShape) aNS; if (aLabIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) { if (aMustBeAtFinal && aNS != theFinal) @@ -63,7 +64,7 @@ static void findBases(TDF_Label theAccess, Handle(TNaming_NamedShape) theFinal, // check that this is not in the results already const TDF_Label aResult = aNS->Label(); TDF_LabelList::Iterator aResIter(theResult); - for(; aResIter.More(); aResIter.Next()) { + for (; aResIter.More(); aResIter.Next()) { if (aResIter.Value().IsEqual(aResult)) break; } @@ -72,11 +73,12 @@ static void findBases(TDF_Label theAccess, Handle(TNaming_NamedShape) theFinal, aFoundAnyShape = true; } if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) { - for(TNaming_Iterator aThisIter(aNS); aThisIter.More(); aThisIter.Next()) { + for (TNaming_Iterator aThisIter(aNS); aThisIter.More(); + aThisIter.Next()) { if (aThisIter.NewShape().IsSame(theValue)) { // continue recursively, null NS means that any NS are ok - findBases(theAccess, theFinal, aThisIter.OldShape(), - false, theAdditionalDocument, theResult); + findBases(theAccess, theFinal, aThisIter.OldShape(), false, + theAdditionalDocument, theResult); aFoundAnyShape = true; } } @@ -84,59 +86,67 @@ static void findBases(TDF_Label theAccess, Handle(TNaming_NamedShape) theFinal, } } } - if (!aFoundAnyShape && !theAdditionalDocument.IsNull()) { // try to find in additional document + if (!aFoundAnyShape && + !theAdditionalDocument.IsNull()) { // try to find in additional document static TDF_Label anEmpty; if (TNaming_Tool::HasLabel(theAdditionalDocument, theValue)) findBases(theAdditionalDocument, Handle(TNaming_NamedShape)(), theValue, - false, anEmpty, theResult); + false, anEmpty, theResult); } } -/// Returns in theResults all shapes with history started in theBase and ended in theFinal -static void findFinals(const TDF_Label& anAccess, const TopoDS_Shape& theBase, - const TDF_Label& theFinal, - const TDF_Label& theAdditionalDoc, TopTools_MapOfShape& thePass, TopTools_MapOfShape& theResults) -{ +/// Returns in theResults all shapes with history started in theBase and ended +/// in theFinal +static void findFinals(const TDF_Label &anAccess, const TopoDS_Shape &theBase, + const TDF_Label &theFinal, + const TDF_Label &theAdditionalDoc, + TopTools_MapOfShape &thePass, + TopTools_MapOfShape &theResults) { if (TNaming_Tool::HasLabel(anAccess, theBase)) { - for(TNaming_NewShapeIterator aBaseIter(theBase, anAccess); aBaseIter.More(); aBaseIter.Next()) - { + for (TNaming_NewShapeIterator aBaseIter(theBase, anAccess); + aBaseIter.More(); aBaseIter.Next()) { TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution(); if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) { if (aBaseIter.NamedShape()->Label().IsEqual(theFinal)) { theResults.Add(aBaseIter.Shape()); } else { if (thePass.Add(aBaseIter.Shape())) - findFinals( - anAccess, aBaseIter.Shape(), theFinal, theAdditionalDoc, thePass, theResults); + findFinals(anAccess, aBaseIter.Shape(), theFinal, theAdditionalDoc, + thePass, theResults); } } } } - if (!theAdditionalDoc.IsNull()) { // search additionally by the additional access label + if (!theAdditionalDoc + .IsNull()) { // search additionally by the additional access label static TDF_Label anEmpty; TopTools_MapOfShape aPass; findFinals(theAdditionalDoc, theBase, theFinal, anEmpty, aPass, theResults); } } -void Selector_Modify::findModificationResult(TopoDS_ListOfShape& theCommon) { - for(TDF_LabelList::Iterator aBase(myBases); aBase.More(); aBase.Next()) { - TDF_Label anAdditionalDoc; // this document if base is started in extra document +void Selector_Modify::findModificationResult(TopoDS_ListOfShape &theCommon) { + for (TDF_LabelList::Iterator aBase(myBases); aBase.More(); aBase.Next()) { + TDF_Label + anAdditionalDoc; // this document if base is started in extra document if (aBase.Value().Root() != label().Root()) { anAdditionalDoc = label(); } TopTools_MapOfShape aFinals; TopTools_MapOfShape aPass; - for(TNaming_Iterator aBaseShape(aBase.Value()); aBaseShape.More(); aBaseShape.Next()) { - findFinals(aBase.Value(), aBaseShape.NewShape(), myFinal, anAdditionalDoc, aPass, aFinals); + for (TNaming_Iterator aBaseShape(aBase.Value()); aBaseShape.More(); + aBaseShape.Next()) { + findFinals(aBase.Value(), aBaseShape.NewShape(), myFinal, anAdditionalDoc, + aPass, aFinals); } if (!aFinals.IsEmpty()) { if (theCommon.IsEmpty()) { // just copy all to common - for(TopTools_MapOfShape::Iterator aFinal(aFinals); aFinal.More(); aFinal.Next()) { + for (TopTools_MapOfShape::Iterator aFinal(aFinals); aFinal.More(); + aFinal.Next()) { theCommon.Append(aFinal.Key()); } } else { // keep only shapes presented in both lists - for(TopoDS_ListOfShape::Iterator aCommon(theCommon); aCommon.More(); ) { + for (TopoDS_ListOfShape::Iterator aCommon(theCommon); aCommon.More();) { if (aFinals.Contains(aCommon.Value())) { aCommon.Next(); } else { // common is not found, remove it @@ -148,21 +158,24 @@ void Selector_Modify::findModificationResult(TopoDS_ListOfShape& theCommon) { } } -bool Selector_Modify::select(NCollection_List& theModifList, - const TopoDS_Shape theContext, const TopoDS_Shape theValue) -{ - if (theModifList.Extent() > 1) { // searching for the best modification result: by context +bool Selector_Modify::select( + NCollection_List &theModifList, + const TopoDS_Shape theContext, const TopoDS_Shape theValue) { + if (theModifList.Extent() > + 1) { // searching for the best modification result: by context bool isFound = false; Handle(TNaming_NamedShape) aCandidate; - NCollection_List::Iterator aModIter(theModifList); + NCollection_List::Iterator aModIter( + theModifList); for (; aModIter.More() && !isFound; aModIter.Next()) { aCandidate = aModIter.Value(); TDF_Label aFatherLab = aCandidate->Label().Father(); Handle(TNaming_NamedShape) aFatherNS; if (aFatherLab.FindAttribute(TNaming_NamedShape::GetID(), aFatherNS)) { - for (TNaming_Iterator anIter(aFatherNS); - anIter.More() && !isFound; anIter.Next()) { - if (theContext.IsSame(anIter.NewShape())) { // found the best modification + for (TNaming_Iterator anIter(aFatherNS); anIter.More() && !isFound; + anIter.Next()) { + if (theContext.IsSame( + anIter.NewShape())) { // found the best modification isFound = true; } } @@ -175,7 +188,8 @@ bool Selector_Modify::select(NCollection_List& theMo if (!theModifList.IsEmpty()) { // searching for all the base shapes of this modification - findBases(label(), theModifList.First(), theValue, true, baseDocument(), myBases); + findBases(label(), theModifList.First(), theValue, true, baseDocument(), + myBases); if (!myBases.IsEmpty()) { myFinal = theModifList.First()->Label(); TopoDS_ListOfShape aCommon; @@ -189,15 +203,18 @@ bool Selector_Modify::select(NCollection_List& theMo if (!sameGeometry(aFirst, aCommonIter.Value())) break; } - if (!aCommonIter.More()) { // all geometry is same, result is a compound + if (!aCommonIter + .More()) { // all geometry is same, result is a compound return true; } } } else if (aCommon.Extent() == 1) { return true; // simple modification } - if (useNeighbors()) { // optimization: for the current moment only in one case this method is - // called where this is not needed if neighbors option is disabled + if (useNeighbors()) { // optimization: for the current moment only in one + // case this method is + // called where this is not needed if neighbors + // option is disabled // weak naming between the common results Selector_NExplode aNexp(aCommon); myWeakIndex = aNexp.index(theValue); @@ -210,8 +227,9 @@ bool Selector_Modify::select(NCollection_List& theMo myFinal = theModifList.First()->Label(); Handle(TNaming_NamedShape) aNS; if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - for(TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); aFinalIter.Next()) { - const TopoDS_Shape& aNewShape = aFinalIter.NewShape(); + for (TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); + aFinalIter.Next()) { + const TopoDS_Shape &aNewShape = aFinalIter.NewShape(); if (!aNewShape.IsNull()) aCommon.Append(aNewShape); } @@ -223,8 +241,7 @@ bool Selector_Modify::select(NCollection_List& theMo return false; } -void Selector_Modify::store() -{ +void Selector_Modify::store() { storeType(Selector_Algo::SELTYPE_MODIFICATION); storeBaseArray(myBases, myFinal); if (myWeakIndex != -1) { @@ -232,8 +249,7 @@ void Selector_Modify::store() } } -bool Selector_Modify::restore() -{ +bool Selector_Modify::restore() { if (restoreBaseArray(myBases, myFinal)) { Handle(TDataStd_Integer) aWeakInt; if (label().FindAttribute(weakID(), aWeakInt)) { @@ -244,25 +260,28 @@ bool Selector_Modify::restore() return false; } -TDF_Label Selector_Modify::restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) -{ - typedef NCollection_DataMap MapOfCompsolids; +TDF_Label +Selector_Modify::restoreByName(std::wstring theName, + const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) { + typedef NCollection_DataMap + MapOfCompsolids; MapOfCompsolids aWrongSubsCompsolids; TDF_Label aContext; - for(size_t anEnd, aStart = 0; aStart != std::wstring::npos; aStart = anEnd) { + for (size_t anEnd, aStart = 0; aStart != std::wstring::npos; aStart = anEnd) { if (aStart != 0) aStart++; anEnd = theName.find(L'&', aStart); - std::wstring aSubStr = - theName.substr(aStart, anEnd == std::wstring::npos ? anEnd : anEnd - aStart); + std::wstring aSubStr = theName.substr( + aStart, anEnd == std::wstring::npos ? anEnd : anEnd - aStart); size_t aFoundOldWeak = aSubStr.find(oldWeakNameID()); - size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos ? - aSubStr.find(weakNameID()) : - aFoundOldWeak; + size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos + ? aSubStr.find(weakNameID()) + : aFoundOldWeak; if (aFoundOldWeak == 0 || aFoundNewWeak == 0) { // weak name identifier - std::wstring aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size()); + std::wstring aWeakIndex = + aSubStr.substr(aFoundOldWeak + oldWeakNameID().size()); myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str()); myRecomputeWeakIndex = aFoundOldWeak == 0; continue; @@ -270,15 +289,17 @@ TDF_Label Selector_Modify::restoreByName(std::wstring theName, TDF_Label aSubContext, aValue; if (!theNameGenerator->restoreContext(aSubStr, aSubContext, aValue)) return TDF_Label(); // can not restore - if (aSubContext.IsNull() || (aValue.IsNull() && theShapeType <= TopAbs_SHELL)) + if (aSubContext.IsNull() || + (aValue.IsNull() && theShapeType <= TopAbs_SHELL)) return TDF_Label(); // can not restore if (myFinal.IsNull()) { myFinal = aValue; aContext = aSubContext; } else { - // This could be a solid in a compsolid, which was not modified by the previous operation, - // however, the selected subshape is stored on its sub-label by mistake. Thus, wait until - // the end of processing to check whether the subshape is found in another solid. + // This could be a solid in a compsolid, which was not modified by the + // previous operation, however, the selected subshape is stored on its + // sub-label by mistake. Thus, wait until the end of processing to check + // whether the subshape is found in another solid. TDF_Label aParent = aSubContext.Father().Father(); Handle(TNaming_NamedShape) aNS; if (aParent.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { @@ -299,22 +320,24 @@ TDF_Label Selector_Modify::restoreByName(std::wstring theName, } // check all compsolids are processed and names are resolved - for (MapOfCompsolids::Iterator anIt(aWrongSubsCompsolids); anIt.More(); anIt.Next()) + for (MapOfCompsolids::Iterator anIt(aWrongSubsCompsolids); anIt.More(); + anIt.Next()) if (!anIt.Value()) return TDF_Label(); return aContext; } -bool Selector_Modify::solve(const TopoDS_Shape& theContext) -{ +bool Selector_Modify::solve(const TopoDS_Shape &theContext) { TopoDS_Shape aResult; - if (myBases.IsEmpty() && myWeakIndex > 0) { // weak name by the final shapes index + if (myBases.IsEmpty() && + myWeakIndex > 0) { // weak name by the final shapes index TopoDS_ListOfShape aCommon; Handle(TNaming_NamedShape) aNS; if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - for(TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); aFinalIter.Next()) { - const TopoDS_Shape& aNewShape = aFinalIter.NewShape(); + for (TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); + aFinalIter.Next()) { + const TopoDS_Shape &aNewShape = aFinalIter.NewShape(); if (!aNewShape.IsNull()) aCommon.Append(aNewShape); } @@ -323,7 +346,8 @@ bool Selector_Modify::solve(const TopoDS_Shape& theContext) aResult = aNexp.shape(myWeakIndex); myRecomputeWeakIndex = false; } else { // standard case - TopoDS_ListOfShape aFinalsCommon; // final shapes presented in all results from bases + TopoDS_ListOfShape + aFinalsCommon; // final shapes presented in all results from bases findModificationResult(aFinalsCommon); if (aFinalsCommon.Extent() == 1) { // result is valid: found only one shape aResult = aFinalsCommon.First(); @@ -333,25 +357,27 @@ bool Selector_Modify::solve(const TopoDS_Shape& theContext) aResult = aNExp.shape(myWeakIndex); myRecomputeWeakIndex = false; findNewVersion(theContext, aResult); - } else if (aFinalsCommon.Extent() > 1 && geometricalNaming()) {// if same geometry - compound + } else if (aFinalsCommon.Extent() > 1 && + geometricalNaming()) { // if same geometry - compound TopoDS_ListOfShape::Iterator aCommonIter(aFinalsCommon); TopoDS_Shape aFirst = aCommonIter.Value(); - for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) { + for (aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) { if (!sameGeometry(aFirst, aCommonIter.Value())) break; } - if (!aCommonIter.More()) { // all geometry is same, create a result compound + if (!aCommonIter + .More()) { // all geometry is same, create a result compound TopoDS_Builder aBuilder; TopoDS_Compound aCompound; aBuilder.MakeCompound(aCompound); - for(aCommonIter.Initialize(aFinalsCommon); aCommonIter.More(); aCommonIter.Next()) { + for (aCommonIter.Initialize(aFinalsCommon); aCommonIter.More(); + aCommonIter.Next()) { TopoDS_Shape aSub = aCommonIter.Value(); findNewVersion(theContext, aSub); aBuilder.Add(aCompound, aSub); } aResult = aCompound; } - } } @@ -362,8 +388,7 @@ bool Selector_Modify::solve(const TopoDS_Shape& theContext) return false; } -std::wstring Selector_Modify::name(Selector_NameGenerator* theNameGenerator) -{ +std::wstring Selector_Modify::name(Selector_NameGenerator *theNameGenerator) { // final&base1&base2 +optionally: [weak_name_1] std::wstring aResult; Handle(TDataStd_Name) aName; @@ -371,7 +396,8 @@ std::wstring Selector_Modify::name(Selector_NameGenerator* theNameGenerator) return L""; aResult += theNameGenerator->contextName(myFinal) + L"/"; aResult += Locale::Convert::toWString(aName->Get().ToExtString()); - for(TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end(); aBase++) { + for (TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end(); + aBase++) { if (!aBase->FindAttribute(TDataStd_Name::GetID(), aName)) return L""; aResult += L"&"; @@ -380,7 +406,7 @@ std::wstring Selector_Modify::name(Selector_NameGenerator* theNameGenerator) } if (myWeakIndex != -1) { std::wostringstream aWeakStr; - aWeakStr<& theModifList, - const TopoDS_Shape theContext, const TopoDS_Shape theValue); + /// Initializes the selection of this kind by list of named shapes where the + /// modification results are presented and the selected value. + SELECTOR_EXPORT bool + select(NCollection_List &theModifList, + const TopoDS_Shape theContext, const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT virtual void store() override; - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT virtual bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override; + SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual std::wstring + name(Selector_NameGenerator *theNameGenerator) override; private: /// Initializes selector Selector_Modify(); - /// Searches the final shapes presented in all results from bases basing on modification fields - void findModificationResult(TopoDS_ListOfShape& theCommon); + /// Searches the final shapes presented in all results from bases basing on + /// modification fields + void findModificationResult(TopoDS_ListOfShape &theCommon); friend class Selector_Algo; }; diff --git a/src/Selector/Selector_NExplode.cpp b/src/Selector/Selector_NExplode.cpp index 5c325cbef..363e3e211 100644 --- a/src/Selector/Selector_NExplode.cpp +++ b/src/Selector/Selector_NExplode.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "Selector_NExplode.h" @@ -34,47 +35,44 @@ ////#include ////#include -static GeomAlgoAPI_NExplode::ShapeOrder getOrder(const bool isOld) -{ +static GeomAlgoAPI_NExplode::ShapeOrder getOrder(const bool isOld) { return isOld ? GeomAlgoAPI_NExplode::ORDER_BY_HASH_VALUE : GeomAlgoAPI_NExplode::ORDER_BY_MIDDLE_POINT; } -static GeomShapePtr convertShape(const TopoDS_Shape& theShape) -{ +static GeomShapePtr convertShape(const TopoDS_Shape &theShape) { GeomShapePtr aNewShape(new GeomAPI_Shape); aNewShape->setImpl(new TopoDS_Shape(theShape)); return aNewShape; } -Selector_NExplode::Selector_NExplode(const TopoDS_ListOfShape& theShapes, const bool theOldOrder) - : myToBeReordered(theOldOrder) -{ +Selector_NExplode::Selector_NExplode(const TopoDS_ListOfShape &theShapes, + const bool theOldOrder) + : myToBeReordered(theOldOrder) { ListOfShape aShapes; for (TopoDS_ListOfShape::Iterator anIt(theShapes); anIt.More(); anIt.Next()) aShapes.push_back(convertShape(anIt.Value())); - mySorted = std::make_shared(aShapes, getOrder(theOldOrder)); + mySorted = + std::make_shared(aShapes, getOrder(theOldOrder)); } -Selector_NExplode::Selector_NExplode(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType, +Selector_NExplode::Selector_NExplode(const TopoDS_Shape &theShape, + const TopAbs_ShapeEnum theType, const bool theOldOrder) - : myToBeReordered(theOldOrder) -{ + : myToBeReordered(theOldOrder) { GeomShapePtr aShape = convertShape(theShape); GeomAPI_Shape::ShapeType aType = (GeomAPI_Shape::ShapeType)theType; - mySorted = std::make_shared(aShape, aType, getOrder(theOldOrder)); + mySorted = std::make_shared(aShape, aType, + getOrder(theOldOrder)); } - -int Selector_NExplode::index(const TopoDS_Shape& theSubShape) -{ +int Selector_NExplode::index(const TopoDS_Shape &theSubShape) { int anIndex = mySorted->index(convertShape(theSubShape)); return anIndex > 0 ? anIndex : -1; // -1 if not found } -TopoDS_Shape Selector_NExplode::shape(int& theIndex) -{ +TopoDS_Shape Selector_NExplode::shape(int &theIndex) { TopoDS_Shape aResult; GeomShapePtr aShape = mySorted->shape(theIndex); if (aShape) { diff --git a/src/Selector/Selector_NExplode.h b/src/Selector/Selector_NExplode.h index c939bfa6d..7f9480bd6 100644 --- a/src/Selector/Selector_NExplode.h +++ b/src/Selector/Selector_NExplode.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_NExplode_H_ @@ -30,28 +31,32 @@ class GeomAlgoAPI_NExplode; /// \class Selector_NExplode /// \ingroup DataModel -/// \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9. -/// Algorithm is copied from GEOM module, which uses nexplode Draw command from OCCT. -/// Used for getting index of sub0shape in WeakNaming algorithm. -class Selector_NExplode -{ - public: - /// \brief Initializes the sorted list of shapes by the shapes list. - SELECTOR_EXPORT Selector_NExplode(const TopoDS_ListOfShape& theShapes, - const bool theOldOrder = false); - /// \brief Initializes the sorted list of shapes by the context shape and type of sub-shapes. - SELECTOR_EXPORT Selector_NExplode(const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum theType, - const bool theOldOrder = false); - - /// Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found. - SELECTOR_EXPORT int index(const TopoDS_Shape& theSubShape); - /// Returns a shape by an index (started from one). Returns null if not found. - /// Recompute the index if the old order was used. The value will contain the new ordered index. - SELECTOR_EXPORT TopoDS_Shape shape(int& theIndex); +/// \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + +/// Z*0.9. Algorithm is copied from GEOM module, which uses nexplode Draw +/// command from OCCT. Used for getting index of sub0shape in WeakNaming +/// algorithm. +class Selector_NExplode { +public: + /// \brief Initializes the sorted list of shapes by the shapes list. + SELECTOR_EXPORT Selector_NExplode(const TopoDS_ListOfShape &theShapes, + const bool theOldOrder = false); + /// \brief Initializes the sorted list of shapes by the context shape and type + /// of sub-shapes. + SELECTOR_EXPORT Selector_NExplode(const TopoDS_Shape &theShape, + const TopAbs_ShapeEnum theType, + const bool theOldOrder = false); + + /// Returns an index (started from one) of sub-shape in the sorted list. + /// Returns 0 if not found. + SELECTOR_EXPORT int index(const TopoDS_Shape &theSubShape); + /// Returns a shape by an index (started from one). Returns null if not found. + /// Recompute the index if the old order was used. The value will contain the + /// new ordered index. + SELECTOR_EXPORT TopoDS_Shape shape(int &theIndex); protected: - std::shared_ptr mySorted; ///< keep the ordered list of shapes + std::shared_ptr + mySorted; ///< keep the ordered list of shapes bool myToBeReordered; ///< the list has to be reordered }; diff --git a/src/Selector/Selector_NameGenerator.cpp b/src/Selector/Selector_NameGenerator.cpp index 1cca56bdd..15dc721a6 100644 --- a/src/Selector/Selector_NameGenerator.cpp +++ b/src/Selector/Selector_NameGenerator.cpp @@ -14,6 +14,7 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include diff --git a/src/Selector/Selector_NameGenerator.h b/src/Selector/Selector_NameGenerator.h index 0c63924b3..53af8479f 100644 --- a/src/Selector/Selector_NameGenerator.h +++ b/src/Selector/Selector_NameGenerator.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_NameGenerator_H_ @@ -26,26 +27,29 @@ /**\class Selector_NameGenerator * \ingroup DataModel - * \brief An interface for generation of the naming name basing on the current selection and - * document information. This requires higher-level data access, so, the caller of "name" method - * of Selector must implement this helper-class abstract methods. + * \brief An interface for generation of the naming name basing on the current + * selection and document information. This requires higher-level data access, + * so, the caller of "name" method of Selector must implement this helper-class + * abstract methods. */ -class Selector_NameGenerator -{ +class Selector_NameGenerator { public: /// empty constructor, nothing to add - Selector_NameGenerator() {}; + Selector_NameGenerator(){}; - /// This method returns the context name by the label of the sub-selected shape + /// This method returns the context name by the label of the sub-selected + /// shape virtual std::wstring contextName(const TDF_Label theSelectionLab) = 0; /// This method restores by the context and value name the context label and /// sub-label where the value is. Returns true if it is valid. - virtual bool restoreContext(std::wstring theName, - TDF_Label& theContext, TDF_Label& theValue) = 0; + virtual bool restoreContext(std::wstring theName, TDF_Label &theContext, + TDF_Label &theValue) = 0; - /// Returns true if the first result is older than the second one in the tree of features - virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2) const = 0; + /// Returns true if the first result is older than the second one in the tree + /// of features + virtual bool isLater(const TDF_Label theResult1, + const TDF_Label theResult2) const = 0; }; #endif diff --git a/src/Selector/Selector_Primitive.cpp b/src/Selector/Selector_Primitive.cpp index d36cc0561..d5560de3e 100644 --- a/src/Selector/Selector_Primitive.cpp +++ b/src/Selector/Selector_Primitive.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,35 +24,30 @@ #include -#include #include +#include +Selector_Primitive::Selector_Primitive() : Selector_Algo() {} -Selector_Primitive::Selector_Primitive() : Selector_Algo() -{ -} - -void Selector_Primitive::select(const TDF_Label theFinalLabel) -{ +void Selector_Primitive::select(const TDF_Label theFinalLabel) { myFinal = theFinalLabel; } -void Selector_Primitive::store() -{ +void Selector_Primitive::store() { storeType(Selector_Algo::SELTYPE_PRIMITIVE); static const TDF_LabelList anEmptyRefList; storeBaseArray(anEmptyRefList, myFinal); } -bool Selector_Primitive::restore() -{ +bool Selector_Primitive::restore() { static TDF_LabelList anEmptyRefList; return restoreBaseArray(anEmptyRefList, myFinal); } -TDF_Label Selector_Primitive::restoreByName(std::wstring theName, - const TopAbs_ShapeEnum /*theShapeType*/, Selector_NameGenerator* theNameGenerator) -{ +TDF_Label +Selector_Primitive::restoreByName(std::wstring theName, + const TopAbs_ShapeEnum /*theShapeType*/, + Selector_NameGenerator *theNameGenerator) { TDF_Label aContext; if (theNameGenerator->restoreContext(theName, aContext, myFinal)) { if (myFinal.IsNull()) @@ -60,13 +56,13 @@ TDF_Label Selector_Primitive::restoreByName(std::wstring theName, return aContext; } -bool Selector_Primitive::solve(const TopoDS_Shape& theContext) -{ +bool Selector_Primitive::solve(const TopoDS_Shape &theContext) { Handle(TNaming_NamedShape) aNS; if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { TopoDS_Shape aResult = aNS->Get(); - // if shape was modified and not exists in the context anymore, check evolution of this shape - // issue 2254 and similar (document CEA parametric first issue description) + // if shape was modified and not exists in the context anymore, check + // evolution of this shape issue 2254 and similar (document CEA parametric + // first issue description) findNewVersion(theContext, aResult); Selector_Algo::store(aResult); return true; @@ -74,8 +70,8 @@ bool Selector_Primitive::solve(const TopoDS_Shape& theContext) return false; } -std::wstring Selector_Primitive::name(Selector_NameGenerator* theNameGenerator) -{ +std::wstring +Selector_Primitive::name(Selector_NameGenerator *theNameGenerator) { Handle(TDataStd_Name) aName; if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName)) return L""; diff --git a/src/Selector/Selector_Primitive.h b/src/Selector/Selector_Primitive.h index 0fbcc2b56..27d0764c9 100644 --- a/src/Selector/Selector_Primitive.h +++ b/src/Selector/Selector_Primitive.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_Primitive_H_ @@ -24,10 +25,10 @@ /**\class Selector_Primitive * \ingroup DataModel - * \brief Kind of selection algorithm: exact referencing to alone shape in the data structure. + * \brief Kind of selection algorithm: exact referencing to alone shape in the + * data structure. */ -class Selector_Primitive: public Selector_Algo -{ +class Selector_Primitive : public Selector_Algo { TDF_Label myFinal; ///< final label of the where the value is public: /// Initializes the selection of this kind @@ -37,20 +38,23 @@ public: /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT virtual void store() override; - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT virtual bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override; + SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual std::wstring + name(Selector_NameGenerator *theNameGenerator) override; + private: /// Initializes selector Selector_Primitive(); diff --git a/src/Selector/Selector_Selector.cpp b/src/Selector/Selector_Selector.cpp index c45885251..d61d8e484 100644 --- a/src/Selector/Selector_Selector.cpp +++ b/src/Selector/Selector_Selector.cpp @@ -14,89 +14,87 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include -#include +#include #include +#include #include #include -#include -Selector_Selector::Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab) : - myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(NULL) -{} +Selector_Selector::Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab) + : myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(NULL) {} -Selector_Selector::~Selector_Selector() -{ +Selector_Selector::~Selector_Selector() { if (myAlgo) delete myAlgo; } -bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue, - const bool theGeometricalNaming) -{ +bool Selector_Selector::select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue, + const bool theGeometricalNaming) { if (theValue.IsNull() || theContext.IsNull()) return false; myAlgo = Selector_Algo::select(theContext, theValue, myLab, myBaseDocumentLab, - theGeometricalNaming, true, true); + theGeometricalNaming, true, true); return myAlgo != NULL; } -bool Selector_Selector::store(const TopoDS_Shape theContext) -{ +bool Selector_Selector::store(const TopoDS_Shape theContext) { myAlgo->store(); - return myAlgo->solve(theContext); // to update the selection shape on the label + return myAlgo->solve( + theContext); // to update the selection shape on the label } -bool Selector_Selector::restore(const TopoDS_Shape theContext) -{ +bool Selector_Selector::restore(const TopoDS_Shape theContext) { myAlgo = Selector_Algo::restoreByLab(myLab, myBaseDocumentLab); if (myAlgo) { - return myAlgo->solve(theContext); // to update the selection shape on the label + return myAlgo->solve( + theContext); // to update the selection shape on the label } return false; } -TopoDS_Shape Selector_Selector::value() -{ +TopoDS_Shape Selector_Selector::value() { Handle(TNaming_NamedShape) aNS; if (myLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aNS->Get(); return TopoDS_Shape(); // empty, error shape } -std::wstring Selector_Selector::name(Selector_NameGenerator* theNameGenerator) { +std::wstring Selector_Selector::name(Selector_NameGenerator *theNameGenerator) { return myAlgo->name(theNameGenerator); } TDF_Label Selector_Selector::restoreByName( - std::wstring theName, const TopAbs_ShapeEnum theShapeType, - Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming) -{ + std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator, const bool theGeometricalNaming) { TDF_Label aResult; - myAlgo = Selector_Algo::restoreByName(myLab, myBaseDocumentLab, theName, theShapeType, - theGeometricalNaming, theNameGenerator, aResult); + myAlgo = Selector_Algo::restoreByName(myLab, myBaseDocumentLab, theName, + theShapeType, theGeometricalNaming, + theNameGenerator, aResult); if (myAlgo) { return aResult; } return TDF_Label(); } -void Selector_Selector::combineGeometrical(const TopoDS_Shape theContext) -{ +void Selector_Selector::combineGeometrical(const TopoDS_Shape theContext) { TopoDS_Shape aValue = value(); if (aValue.IsNull() || aValue.ShapeType() == TopAbs_COMPOUND) return; - Selector_Algo* aNewAlgo = Selector_Algo::relesectWithAllGeometry(myAlgo, theContext); + Selector_Algo *aNewAlgo = + Selector_Algo::relesectWithAllGeometry(myAlgo, theContext); if (aNewAlgo) { aNewAlgo->store(); aNewAlgo->solve(theContext); @@ -105,7 +103,6 @@ void Selector_Selector::combineGeometrical(const TopoDS_Shape theContext) } } -bool Selector_Selector::solve(const TopoDS_Shape theContext) -{ +bool Selector_Selector::solve(const TopoDS_Shape theContext) { return myAlgo->solve(theContext); } diff --git a/src/Selector/Selector_Selector.h b/src/Selector/Selector_Selector.h index c1072867f..69adc358f 100644 --- a/src/Selector/Selector_Selector.h +++ b/src/Selector/Selector_Selector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_Selector_H_ @@ -30,18 +31,19 @@ class Selector_Algo; /**\class Selector_Selector * \ingroup DataModel - * \brief Main object for selection of the sub-shapes in the parametrically updated - * shapes using topological naming mechanism. + * \brief Main object for selection of the sub-shapes in the parametrically + * updated shapes using topological naming mechanism. */ -class Selector_Selector -{ - TDF_Label myLab; ///< main label where selector is performed - TDF_Label myBaseDocumentLab; ///< an access-label to the document that may contain initial shapes - Selector_Algo* myAlgo; ///< root algorithm of the selector +class Selector_Selector { + TDF_Label myLab; ///< main label where selector is performed + TDF_Label myBaseDocumentLab; ///< an access-label to the document that may + ///< contain initial shapes + Selector_Algo *myAlgo; ///< root algorithm of the selector public: /// Initializes selector on the label - SELECTOR_EXPORT Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab = TDF_Label()); + SELECTOR_EXPORT Selector_Selector(TDF_Label theLab, + TDF_Label theBaseDocLab = TDF_Label()); /// Destructor SELECTOR_EXPORT ~Selector_Selector(); @@ -52,33 +54,38 @@ public: /// \param theValue selected subshape /// \param theGeometricalNaming treats selection with equal surfaces as one /// \param theUseNeighbors enables searching algorithm by neighbors - /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes - SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue, - const bool theGeometricalNaming = false); + /// \param theUseIntersections enables searching algorithm by intersection of + /// higher level shapes + SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue, + const bool theGeometricalNaming = false); /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT bool store(const TopoDS_Shape theContext); - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT bool restore(const TopoDS_Shape theContext); /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT TDF_Label restoreByName( - std::wstring theName, const TopAbs_ShapeEnum theShapeType, - Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming = false); + SELECTOR_EXPORT TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator, + const bool theGeometricalNaming = false); /// Returns the current sub-shape value (null if can not resolve) SELECTOR_EXPORT TopoDS_Shape value(); /// Returns the naming name of the selection - SELECTOR_EXPORT std::wstring name(Selector_NameGenerator* theNameGenerator); + SELECTOR_EXPORT std::wstring name(Selector_NameGenerator *theNameGenerator); - /// Makes the current local selection becomes all sub-shapes with same base geometry. + /// Makes the current local selection becomes all sub-shapes with same base + /// geometry. SELECTOR_EXPORT void combineGeometrical(const TopoDS_Shape theContext); - /// Stores the selected shape in he tree and returns true if shape found correctly + /// Stores the selected shape in he tree and returns true if shape found + /// correctly SELECTOR_EXPORT bool solve(const TopoDS_Shape theContext); }; diff --git a/src/Selector/Selector_WeakName.cpp b/src/Selector/Selector_WeakName.cpp index 020711c7f..726ee47f7 100644 --- a/src/Selector/Selector_WeakName.cpp +++ b/src/Selector/Selector_WeakName.cpp @@ -14,42 +14,44 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include #include -#include -#include -#include #include +#include +#include +#include -Selector_WeakName::Selector_WeakName() : Selector_Algo(), myRecomputeWeakIndex(false) -{ -} +Selector_WeakName::Selector_WeakName() + : Selector_Algo(), myRecomputeWeakIndex(false) {} -bool Selector_WeakName::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue) -{ +bool Selector_WeakName::select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue) { myShapeType = theValue.ShapeType(); Selector_NExplode aNexp(theContext, myShapeType); myWeakIndex = aNexp.index(theValue); if (myWeakIndex != -1) { // searching for context shape label to store in myFinal if (TNaming_Tool::HasLabel(label(), theContext)) { - for(TNaming_SameShapeIterator aShapes(theContext, label()); aShapes.More(); aShapes.Next()) - { + for (TNaming_SameShapeIterator aShapes(theContext, label()); + aShapes.More(); aShapes.Next()) { Handle(TNaming_NamedShape) aNS; if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) { TNaming_Evolution anEvolution = aNS->Evolution(); - if (anEvolution == TNaming_PRIMITIVE || anEvolution == TNaming_GENERATED || - anEvolution == TNaming_MODIFY) { + if (anEvolution == TNaming_PRIMITIVE || + anEvolution == TNaming_GENERATED || + anEvolution == TNaming_MODIFY) { // check this is a new shape - for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) { + for (TNaming_Iterator aNSIter(aNS); aNSIter.More(); + aNSIter.Next()) { if (aNSIter.NewShape().IsSame(theContext)) { myContext = aNS->Label(); break; @@ -64,8 +66,7 @@ bool Selector_WeakName::select(const TopoDS_Shape theContext, const TopoDS_Shape return false; } -void Selector_WeakName::store() -{ +void Selector_WeakName::store() { static const TDF_LabelList anEmptyRefList; storeType(Selector_Algo::SELTYPE_WEAK_NAMING); storeBaseArray(anEmptyRefList, myContext); @@ -73,8 +74,7 @@ void Selector_WeakName::store() TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); } -bool Selector_WeakName::restore() -{ +bool Selector_WeakName::restore() { Handle(TDataStd_Integer) aWeakInt; if (!label().FindAttribute(weakID(), aWeakInt)) return false; @@ -87,11 +87,13 @@ bool Selector_WeakName::restore() return restoreBaseArray(anEmptyRefList, myContext); } -TDF_Label Selector_WeakName::restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) -{ +TDF_Label +Selector_WeakName::restoreByName(std::wstring theName, + const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) { size_t aFoundWeak = theName.find(oldPureWeakNameID()); - std::wstring aWeakIndex = theName.substr(aFoundWeak + oldPureWeakNameID().size()); + std::wstring aWeakIndex = + theName.substr(aFoundWeak + oldPureWeakNameID().size()); std::size_t aContextPosition = aWeakIndex.find(L"_"); myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str()); myRecomputeWeakIndex = aFoundWeak == 0; @@ -107,8 +109,7 @@ TDF_Label Selector_WeakName::restoreByName(std::wstring theName, return aContext; } -bool Selector_WeakName::solve(const TopoDS_Shape& theContext) -{ +bool Selector_WeakName::solve(const TopoDS_Shape &theContext) { TopoDS_Shape aContext; if (myContext.IsNull()) { @@ -131,11 +132,10 @@ bool Selector_WeakName::solve(const TopoDS_Shape& theContext) return false; } -std::wstring Selector_WeakName::name(Selector_NameGenerator* theNameGenerator) -{ +std::wstring Selector_WeakName::name(Selector_NameGenerator *theNameGenerator) { // _weak_naming_1_Context std::wostringstream aWeakStr; - aWeakStr<contextName(myContext); diff --git a/src/Selector/Selector_WeakName.h b/src/Selector/Selector_WeakName.h index c3e7d1e91..de6a2c998 100644 --- a/src/Selector/Selector_WeakName.h +++ b/src/Selector/Selector_WeakName.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef Selector_WeakName_H_ @@ -24,36 +25,40 @@ /**\class Selector_WeakName * \ingroup DataModel - * \brief Kind of selection algorithm: if other algorithms fail, this stores the geometrical - * index of the selected shape. Pure weak naming approach. + * \brief Kind of selection algorithm: if other algorithms fail, this stores the + * geometrical index of the selected shape. Pure weak naming approach. */ -class Selector_WeakName: public Selector_Algo -{ +class Selector_WeakName : public Selector_Algo { TopAbs_ShapeEnum myShapeType; ///< type of this shape int myWeakIndex; ///< weak index in case modification produces several shapes - bool myRecomputeWeakIndex; ///< if the index is stored with old (unstable) order, recompute it - TDF_Label myContext; ///< context shape label + bool myRecomputeWeakIndex; ///< if the index is stored with old (unstable) + ///< order, recompute it + TDF_Label myContext; ///< context shape label public: /// Initializes the selection of this kind - SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue); + SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, + const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree SELECTOR_EXPORT virtual void store() override; - /// Restores the selected shape by the topological naming kept in the data structure - /// Returns true if it can restore structure correctly + /// Restores the selected shape by the topological naming kept in the data + /// structure Returns true if it can restore structure correctly SELECTOR_EXPORT virtual bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual TDF_Label + restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, + Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override; + SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override; + SELECTOR_EXPORT virtual std::wstring + name(Selector_NameGenerator *theNameGenerator) override; + private: /// Initializes selector Selector_WeakName(); diff --git a/src/SketchAPI/CMakeLists.txt b/src/SketchAPI/CMakeLists.txt index e83046e9e..ed30788df 100644 --- a/src/SketchAPI/CMakeLists.txt +++ b/src/SketchAPI/CMakeLists.txt @@ -152,16 +152,16 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/SketchAPI") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/SketchAPI/SketchAPI.h b/src/SketchAPI/SketchAPI.h index 377cabf17..7babaa42a 100644 --- a/src/SketchAPI/SketchAPI.h +++ b/src/SketchAPI/SketchAPI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SKETCHAPI_H @@ -22,13 +23,13 @@ #if defined SKETCHAPI_EXPORTS #if defined WIN32 -#define SKETCHAPI_EXPORT __declspec( dllexport ) +#define SKETCHAPI_EXPORT __declspec(dllexport) #else #define SKETCHAPI_EXPORT #endif #else #if defined WIN32 -#define SKETCHAPI_EXPORT __declspec( dllimport ) +#define SKETCHAPI_EXPORT __declspec(dllimport) #else #define SKETCHAPI_EXPORT #endif diff --git a/src/SketchAPI/SketchAPI_Arc.cpp b/src/SketchAPI/SketchAPI_Arc.cpp index bce401779..de420ce8e 100644 --- a/src/SketchAPI/SketchAPI_Arc.cpp +++ b/src/SketchAPI/SketchAPI_Arc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Arc.h" @@ -30,71 +31,64 @@ #include //================================================================================================ -SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Arc::SketchAPI_Arc( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } //================================================================================================ -SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { - setByCenterStartEnd(theCenterX, theCenterY, theStartX, - theStartY, theEndX, theEndY, theInversed); +SketchAPI_Arc::SketchAPI_Arc( + const std::shared_ptr &theFeature, double theCenterX, + double theCenterY, double theStartX, double theStartY, double theEndX, + double theEndY, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { + setByCenterStartEnd(theCenterX, theCenterY, theStartX, theStartY, theEndX, + theEndY, theInversed); } } //================================================================================================ -SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_Arc::SketchAPI_Arc( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterStartEnd(theCenter, theStart, theEnd, theInversed); } } //================================================================================================ -SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Arc::SketchAPI_Arc( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); } } //================================================================================================ -SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, - const std::wstring& theExternalName) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Arc::SketchAPI_Arc( + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); } } //================================================================================================ -SketchAPI_Arc::~SketchAPI_Arc() -{ - -} +SketchAPI_Arc::~SketchAPI_Arc() {} //================================================================================================ void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY, double theStartX, double theStartY, double theEndX, double theEndY, - bool theInversed) -{ + bool theInversed) { fillAttribute(center(), theCenterX, theCenterY); fillAttribute(startPoint(), theStartX, theStartY); fillAttribute(endPoint(), theEndX, theEndY); @@ -104,11 +98,10 @@ void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY, } //================================================================================================ -void SketchAPI_Arc::setByCenterStartEnd(const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) -{ +void SketchAPI_Arc::setByCenterStartEnd( + const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed) { fillAttribute(theCenter, mycenter); fillAttribute(theStart, mystartPoint); fillAttribute(theEnd, myendPoint); @@ -118,38 +111,38 @@ void SketchAPI_Arc::setByCenterStartEnd(const std::shared_ptr& th } //================================================================================================ -void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, external()); execute(); } //=============================================================================================== -void SketchAPI_Arc::setByExternalName(const std::wstring & theExternalName) -{ +void SketchAPI_Arc::setByExternalName(const std::wstring &theExternalName) { fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external()); execute(); } //================================================================================================ -void SketchAPI_Arc::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Arc::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // arc is external - theDumper << aBase << " = " << aSketchName << ".addArc(" << anExternal << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addArc(" << anExternal + << ")" << std::endl; } else { // arc given by center and start, end points theDumper << aBase << " = " << aSketchName << ".addArc(" << center() << ", " - << startPoint() << ", " << endPoint() << ", " << reversed() << ")" << std::endl; + << startPoint() << ", " << endPoint() << ", " << reversed() << ")" + << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); diff --git a/src/SketchAPI/SketchAPI_Arc.h b/src/SketchAPI/SketchAPI_Arc.h index 0cd903afd..edfd24c02 100644 --- a/src/SketchAPI/SketchAPI_Arc.h +++ b/src/SketchAPI/SketchAPI_Arc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_Arc_H_ @@ -33,84 +34,77 @@ class ModelHighAPI_Selection; /// \class SketchAPI_Arc /// \ingroup CPPHighAPI /// \brief Interface for Arc feature. -class SketchAPI_Arc: public SketchAPI_SketchEntity -{ +class SketchAPI_Arc : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_Arc(const std::shared_ptr& theFeature); + explicit SketchAPI_Arc(const std::shared_ptr &theFeature); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Arc(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, + SketchAPI_Arc(const std::shared_ptr &theFeature, + double theCenterX, double theCenterY, double theStartX, + double theStartY, double theEndX, double theEndY, bool theInversed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Arc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed); + SketchAPI_Arc(const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Arc(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal); + SketchAPI_Arc(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Arc(const std::shared_ptr& theFeature, - const std::wstring& theExternalName); + SketchAPI_Arc(const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_Arc(); - INTERFACE_7(SketchPlugin_Arc::ID(), - center, SketchPlugin_Arc::CENTER_ID(), - GeomDataAPI_Point2D, /** Center point */, - startPoint, SketchPlugin_Arc::START_ID(), - GeomDataAPI_Point2D, /** Start point */, - endPoint, SketchPlugin_Arc::END_ID(), - GeomDataAPI_Point2D, /** End point */, - reversed, SketchPlugin_Arc::REVERSED_ID(), - ModelAPI_AttributeBoolean, /** Inversed flag */, - radius, SketchPlugin_Arc::RADIUS_ID(), - ModelAPI_AttributeDouble, /** Radius */, - angle, SketchPlugin_Arc::ANGLE_ID(), - ModelAPI_AttributeDouble, /** Angle */, - external, SketchPlugin_Arc::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */) + INTERFACE_7(SketchPlugin_Arc::ID(), center, SketchPlugin_Arc::CENTER_ID(), + GeomDataAPI_Point2D, /** Center point */, startPoint, + SketchPlugin_Arc::START_ID(), GeomDataAPI_Point2D, + /** Start point */, endPoint, SketchPlugin_Arc::END_ID(), + GeomDataAPI_Point2D, /** End point */, reversed, + SketchPlugin_Arc::REVERSED_ID(), ModelAPI_AttributeBoolean, + /** Inversed flag */, radius, SketchPlugin_Arc::RADIUS_ID(), + ModelAPI_AttributeDouble, /** Radius */, angle, + SketchPlugin_Arc::ANGLE_ID(), ModelAPI_AttributeDouble, + /** Angle */, external, SketchPlugin_Arc::EXTERNAL_ID(), + ModelAPI_AttributeSelection, + /** External */) /// Set by center and start, end point. SKETCHAPI_EXPORT void setByCenterStartEnd(double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed); + double theStartX, double theStartY, double theEndX, + double theEndY, bool theInversed); /// Set by center and start, end point. SKETCHAPI_EXPORT - void setByCenterStartEnd(const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, + void setByCenterStartEnd(const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed); /// Set by external. SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection& theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Set by external name. SKETCHAPI_EXPORT - void setByExternalName(const std::wstring& theExternalName); + void setByExternalName(const std::wstring &theExternalName); /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Arc object. diff --git a/src/SketchAPI/SketchAPI_BSpline.cpp b/src/SketchAPI/SketchAPI_BSpline.cpp index 8e72ab970..79faedfbf 100644 --- a/src/SketchAPI/SketchAPI_BSpline.cpp +++ b/src/SketchAPI/SketchAPI_BSpline.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_BSpline.h" @@ -40,36 +41,32 @@ #include - -SketchAPI_BSpline::SketchAPI_BSpline(const std::shared_ptr & theFeature) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_BSpline::SketchAPI_BSpline( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } -SketchAPI_BSpline::SketchAPI_BSpline(const std::shared_ptr& theFeature, - bool theInitialize) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_BSpline::SketchAPI_BSpline( + const std::shared_ptr &theFeature, bool theInitialize) + : SketchAPI_SketchEntity(theFeature) { if (theInitialize) initialize(); } -SketchAPI_BSpline::~SketchAPI_BSpline() -{ -} +SketchAPI_BSpline::~SketchAPI_BSpline() {} -void SketchAPI_BSpline::setByDegreePolesAndWeights(const ModelHighAPI_Integer& theDegree, - const std::list& thePoles, - const std::list& theWeights) -{ +void SketchAPI_BSpline::setByDegreePolesAndWeights( + const ModelHighAPI_Integer &theDegree, + const std::list &thePoles, + const std::list &theWeights) { std::list aWeights; if (theWeights.size() <= 1) { // prepare array of equal weights - aWeights.assign(thePoles.size(), - theWeights.empty() ? ModelHighAPI_Double(1.0) : theWeights.front()); - } - else + aWeights.assign(thePoles.size(), theWeights.empty() + ? ModelHighAPI_Double(1.0) + : theWeights.front()); + } else aWeights = theWeights; ModelHighAPI_Integer aDegree = theDegree; @@ -80,22 +77,22 @@ void SketchAPI_BSpline::setByDegreePolesAndWeights(const ModelHighAPI_Integer& t setByParameters(aDegree, thePoles, aWeights, aKnots, aMults); } -void SketchAPI_BSpline::setByParameters(const ModelHighAPI_Integer& theDegree, - const std::list& thePoles, - const std::list& theWeights, - const std::list& theKnots, - const std::list& theMults) -{ +void SketchAPI_BSpline::setByParameters( + const ModelHighAPI_Integer &theDegree, + const std::list &thePoles, + const std::list &theWeights, + const std::list &theKnots, + const std::list &theMults) { fillAttribute(theDegree, degree()); fillAttribute(thePoles, poles()); if (theWeights.size() <= 1) { // prepare array of equal weights - std::list aWeights(thePoles.size(), + std::list aWeights( + thePoles.size(), theWeights.empty() ? ModelHighAPI_Double(1.0) : theWeights.front()); fillAttribute(aWeights, weights()); - } - else + } else fillAttribute(theWeights, weights()); fillAttribute(theKnots, knots()); @@ -106,96 +103,99 @@ void SketchAPI_BSpline::setByParameters(const ModelHighAPI_Integer& theDegree, execute(); } -void SketchAPI_BSpline::setStartAndEndPoints() -{ +void SketchAPI_BSpline::setStartAndEndPoints() { fillAttribute(poles()->pnt(0), startPoint()); fillAttribute(poles()->pnt(poles()->size() - 1), endPoint()); } -void SketchAPI_BSpline::setByExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_BSpline::setByExternal( + const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, external()); execute(); } -static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) -{ - const std::set& aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) +static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) { + const std::set &aRefs = theFeature->data()->refsToMe(); + for (std::set::const_iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) - return std::dynamic_pointer_cast((*anIt)->owner()); + return std::dynamic_pointer_cast( + (*anIt)->owner()); return CompositeFeaturePtr(); } -static void createInternalConstraint(const CompositeFeaturePtr& theSketch, - const AttributePoint2DPtr& thePoint, - const AttributePoint2DArrayPtr& thePoles, - const int thePoleIndex) -{ - FeaturePtr aConstraint = theSketch->addFeature(SketchPlugin_ConstraintCoincidenceInternal::ID()); +static void createInternalConstraint(const CompositeFeaturePtr &theSketch, + const AttributePoint2DPtr &thePoint, + const AttributePoint2DArrayPtr &thePoles, + const int thePoleIndex) { + FeaturePtr aConstraint = + theSketch->addFeature(SketchPlugin_ConstraintCoincidenceInternal::ID()); aConstraint->refattr(SketchPlugin_Constraint::ENTITY_A())->setAttr(thePoint); aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(thePoles); - aConstraint->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()) + aConstraint + ->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()) ->setValue(thePoleIndex); aConstraint->execute(); } -static void createPole(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theBSpline, - const AttributePoint2DArrayPtr& thePoles, - const int thePoleIndex, - const bool theAuxiliary, - std::list& theEntities) -{ +static void createPole(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theBSpline, + const AttributePoint2DArrayPtr &thePoles, + const int thePoleIndex, const bool theAuxiliary, + std::list &theEntities) { GeomPnt2dPtr aPole = thePoles->pnt(thePoleIndex); FeaturePtr aPointFeature = theSketch->addFeature(SketchPlugin_Point::ID()); AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( aPointFeature->attribute(SketchPlugin_Point::COORD_ID())); aCoord->setValue(aPole); - aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theBSpline); + aPointFeature->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(theBSpline); aPointFeature->execute(); std::wostringstream aName; - aName << theBSpline->name() << "_" << Locale::Convert::toWString(thePoles->id()) - << "_" << thePoleIndex; + aName << theBSpline->name() << "_" + << Locale::Convert::toWString(thePoles->id()) << "_" << thePoleIndex; aPointFeature->data()->setName(aName.str()); aPointFeature->lastResult()->data()->setName(aName.str()); - aPointFeature->boolean(SketchPlugin_Point::AUXILIARY_ID())->setValue(theAuxiliary); + aPointFeature->boolean(SketchPlugin_Point::AUXILIARY_ID()) + ->setValue(theAuxiliary); createInternalConstraint(theSketch, aCoord, thePoles, thePoleIndex); theEntities.push_back(aPointFeature); } -static void createSegment(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theBSpline, - const AttributePoint2DArrayPtr& thePoles, - const int theStartPoleIndex, - const bool theAuxiliary, - std::list& theEntities) -{ +static void createSegment(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theBSpline, + const AttributePoint2DArrayPtr &thePoles, + const int theStartPoleIndex, const bool theAuxiliary, + std::list &theEntities) { int aEndPoleIndex = (theStartPoleIndex + 1) % thePoles->size(); GeomPnt2dPtr aStartPoint = thePoles->pnt(theStartPoleIndex); GeomPnt2dPtr aEndPoint = thePoles->pnt(aEndPoleIndex); FeaturePtr aLineFeature = theSketch->addFeature(SketchPlugin_Line::ID()); - AttributePoint2DPtr aLineStart = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::START_ID())); + AttributePoint2DPtr aLineStart = + std::dynamic_pointer_cast( + aLineFeature->attribute(SketchPlugin_Line::START_ID())); aLineStart->setValue(aStartPoint); AttributePoint2DPtr aLineEnd = std::dynamic_pointer_cast( aLineFeature->attribute(SketchPlugin_Line::END_ID())); aLineEnd->setValue(aEndPoint); - aLineFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theBSpline); + aLineFeature->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(theBSpline); aLineFeature->execute(); std::wostringstream aName; - aName << theBSpline->name() << "_segment_" << theStartPoleIndex << "_" << aEndPoleIndex; + aName << theBSpline->name() << "_segment_" << theStartPoleIndex << "_" + << aEndPoleIndex; aLineFeature->data()->setName(aName.str()); aLineFeature->lastResult()->data()->setName(aName.str()); - aLineFeature->boolean(SketchPlugin_Line::AUXILIARY_ID())->setValue(theAuxiliary); + aLineFeature->boolean(SketchPlugin_Line::AUXILIARY_ID()) + ->setValue(theAuxiliary); createInternalConstraint(theSketch, aLineStart, thePoles, theStartPoleIndex); createInternalConstraint(theSketch, aLineEnd, thePoles, aEndPoleIndex); @@ -203,20 +203,18 @@ static void createSegment(const CompositeFeaturePtr& theSketch, theEntities.push_back(aLineFeature); } -static void toMapOfAuxIndices(const std::list& theRegular, - const std::list& theAuxiliary, - std::map& theIndices) -{ +static void toMapOfAuxIndices(const std::list &theRegular, + const std::list &theAuxiliary, + std::map &theIndices) { for (auto it = theRegular.begin(); it != theRegular.end(); ++it) theIndices[*it] = false; for (auto it = theAuxiliary.begin(); it != theAuxiliary.end(); ++it) theIndices[*it] = true; } -std::list > SketchAPI_BSpline::controlPoles( - const std::list& regular, - const std::list& auxiliary) const -{ +std::list> +SketchAPI_BSpline::controlPoles(const std::list ®ular, + const std::list &auxiliary) const { std::map anAux; toMapOfAuxIndices(regular, auxiliary, anAux); @@ -232,10 +230,9 @@ std::list > SketchAPI_BSpline::controlPo return SketchAPI_SketchEntity::wrap(anEntities); } -std::list > SketchAPI_BSpline::controlPolygon( - const std::list& regular, - const std::list& auxiliary) const -{ +std::list> +SketchAPI_BSpline::controlPolygon(const std::list ®ular, + const std::list &auxiliary) const { std::map anAux; toMapOfAuxIndices(regular, auxiliary, anAux); @@ -251,14 +248,11 @@ std::list > SketchAPI_BSpline::controlPo return SketchAPI_SketchEntity::wrap(anEntities); } - void SketchAPI_BSpline::getDefaultParameters( - const std::list >& thePoles, - const std::list& theWeights, - ModelHighAPI_Integer& theDegree, - std::list& theKnots, - std::list& theMults) const -{ + const std::list> &thePoles, + const std::list &theWeights, + ModelHighAPI_Integer &theDegree, std::list &theKnots, + std::list &theMults) const { std::shared_ptr aBSplineCurve; try { std::list aWeights; @@ -266,15 +260,17 @@ void SketchAPI_BSpline::getDefaultParameters( it != theWeights.end(); ++it) aWeights.push_back(it->value()); - bool isPeriodic = feature()->getKind() == SketchPlugin_BSplinePeriodic::ID(); + bool isPeriodic = + feature()->getKind() == SketchPlugin_BSplinePeriodic::ID(); if (theDegree.intValue() < 0) - aBSplineCurve.reset(new GeomAPI_BSpline2d(thePoles, aWeights, isPeriodic)); + aBSplineCurve.reset( + new GeomAPI_BSpline2d(thePoles, aWeights, isPeriodic)); else { - aBSplineCurve.reset(new GeomAPI_BSpline2d(theDegree.intValue(), thePoles, aWeights, - std::list(), std::list(), isPeriodic)); + aBSplineCurve.reset(new GeomAPI_BSpline2d(theDegree.intValue(), thePoles, + aWeights, std::list(), + std::list(), isPeriodic)); } - } - catch (...) { + } catch (...) { // cannot build a B-spline curve return; } @@ -286,10 +282,9 @@ void SketchAPI_BSpline::getDefaultParameters( theMults.assign(aMults.begin(), aMults.end()); } -void SketchAPI_BSpline::checkDefaultParameters(bool& isDefaultDegree, - bool& isDefaultWeights, - bool& isDefaultKnotsMults) const -{ +void SketchAPI_BSpline::checkDefaultParameters( + bool &isDefaultDegree, bool &isDefaultWeights, + bool &isDefaultKnotsMults) const { static const double TOLERANCE = 1.e-7; AttributePoint2DArrayPtr aPolesAttr = poles(); @@ -318,16 +313,19 @@ void SketchAPI_BSpline::checkDefaultParameters(bool& isDefaultDegree, getDefaultParameters(aPoles, aWeights, aDegree, aKnots, aMults); } - isDefaultKnotsMults = aKnotsAttr->size() == (int)aKnots.size() - && aMultsAttr->size() == (int)aMults.size(); + isDefaultKnotsMults = aKnotsAttr->size() == (int)aKnots.size() && + aMultsAttr->size() == (int)aMults.size(); if (isDefaultKnotsMults) { std::list::iterator anIt = aKnots.begin(); - for (int anIndex = 0; isDefaultKnotsMults && anIt != aKnots.end(); ++anIt, ++anIndex) - isDefaultKnotsMults = fabs(anIt->value() - aKnotsAttr->value(anIndex)) < TOLERANCE; + for (int anIndex = 0; isDefaultKnotsMults && anIt != aKnots.end(); + ++anIt, ++anIndex) + isDefaultKnotsMults = + fabs(anIt->value() - aKnotsAttr->value(anIndex)) < TOLERANCE; } if (isDefaultKnotsMults) { std::list::iterator anIt = aMults.begin(); - for (int anIndex = 0; isDefaultKnotsMults && anIt != aMults.end(); ++anIt, ++anIndex) + for (int anIndex = 0; isDefaultKnotsMults && anIt != aMults.end(); + ++anIt, ++anIndex) isDefaultKnotsMults = anIt->intValue() == aMultsAttr->value(anIndex); } @@ -335,11 +333,9 @@ void SketchAPI_BSpline::checkDefaultParameters(bool& isDefaultDegree, isDefaultWeights = isDefaultWeights && isDefaultKnotsMults; } - -static void bsplineAuxiliaryFeature(const AttributeRefAttrPtr& theReference, - FeaturePtr& thePoint, - FeaturePtr& theSegment) -{ +static void bsplineAuxiliaryFeature(const AttributeRefAttrPtr &theReference, + FeaturePtr &thePoint, + FeaturePtr &theSegment) { ObjectPtr anAuxObject; if (theReference->isObject()) anAuxObject = theReference->object(); @@ -357,28 +353,33 @@ static void bsplineAuxiliaryFeature(const AttributeRefAttrPtr& theReference, } static void collectAuxiliaryFeatures(FeaturePtr theBSpline, - std::map& thePoints, - std::map& theSegments) -{ - const std::set& aRefs = theBSpline->data()->refsToMe(); + std::map &thePoints, + std::map &theSegments) { + const std::set &aRefs = theBSpline->data()->refsToMe(); for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end(); ++aRefIt) { FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); - if (anOwner->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { + if (anOwner->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { // process internal constraints only - AttributeRefAttrPtr aRefAttrA = anOwner->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr aRefAttrB = anOwner->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr aRefAttrA = + anOwner->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrB = + anOwner->refattr(SketchPlugin_Constraint::ENTITY_B()); AttributePtr anAttrA = aRefAttrA->attr(); AttributePtr anAttrB = aRefAttrB->attr(); AttributeIntegerPtr aPoleIndex; FeaturePtr aPoint, aLine; - if (anAttrA && anAttrA->attributeType() == GeomDataAPI_Point2DArray::typeId()) { - aPoleIndex = anOwner->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); + if (anAttrA && + anAttrA->attributeType() == GeomDataAPI_Point2DArray::typeId()) { + aPoleIndex = anOwner->integer( + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); bsplineAuxiliaryFeature(aRefAttrB, aPoint, aLine); - } - else if (anAttrB && anAttrB->attributeType() == GeomDataAPI_Point2DArray::typeId()) { - aPoleIndex = anOwner->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + } else if (anAttrB && anAttrB->attributeType() == + GeomDataAPI_Point2DArray::typeId()) { + aPoleIndex = anOwner->integer( + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); bsplineAuxiliaryFeature(aRefAttrA, aPoint, aLine); } @@ -390,22 +391,24 @@ static void collectAuxiliaryFeatures(FeaturePtr theBSpline, } } -void SketchAPI_BSpline::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_BSpline::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // B-spline is external - theDumper << aBase << " = " << aSketchName << ".addSpline(" << anExternal << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addSpline(" << anExternal + << ")" << std::endl; } else { // check if some B-spline parameters are default and should not be dumped bool isDefaultDegree, isDefaultWeights, isDefaultKnotsMults; - checkDefaultParameters(isDefaultDegree, isDefaultWeights, isDefaultKnotsMults); + checkDefaultParameters(isDefaultDegree, isDefaultWeights, + isDefaultKnotsMults); theDumper << aBase << " = " << aSketchName << ".addSpline("; if (!isDefaultDegree) @@ -414,7 +417,8 @@ void SketchAPI_BSpline::dump(ModelHighAPI_Dumper& theDumper) const if (!isDefaultWeights) theDumper << ", weights = " << weights(); if (!isDefaultKnotsMults) - theDumper << ", knots = " << knots() << ", multiplicities = " << multiplicities(); + theDumper << ", knots = " << knots() + << ", multiplicities = " << multiplicities(); if (aBase->getKind() == SketchPlugin_BSplinePeriodic::ID()) theDumper << ", periodic = True"; theDumper << ")" << std::endl; @@ -432,10 +436,9 @@ void SketchAPI_BSpline::dump(ModelHighAPI_Dumper& theDumper) const dumpControlPolygon(theDumper, aBase, "controlPolygon", anAuxSegments); } -static void dumpList(ModelHighAPI_Dumper& theDumper, - const std::string& theAttrName, - const std::set& theIndices) -{ +static void dumpList(ModelHighAPI_Dumper &theDumper, + const std::string &theAttrName, + const std::set &theIndices) { theDumper << theAttrName << " = ["; std::set::const_iterator it = theIndices.begin(); theDumper << *it; @@ -445,11 +448,9 @@ static void dumpList(ModelHighAPI_Dumper& theDumper, } void SketchAPI_BSpline::dumpControlPolygon( - ModelHighAPI_Dumper& theDumper, - const FeaturePtr& theBSpline, - const std::string& theMethod, - const std::map& theAuxFeatures) const -{ + ModelHighAPI_Dumper &theDumper, const FeaturePtr &theBSpline, + const std::string &theMethod, + const std::map &theAuxFeatures) const { theDumper << "["; bool isFirst = true; // dump features and split them to auxiliary and regular @@ -478,25 +479,25 @@ void SketchAPI_BSpline::dumpControlPolygon( theDumper << ")" << std::endl; } -static void setCoordinates(const FeaturePtr& theFeature, - const std::string& theAttrName, - const GeomPnt2dPtr& theCoordinates) -{ - AttributePoint2DPtr aPoint = - std::dynamic_pointer_cast(theFeature->attribute(theAttrName)); +static void setCoordinates(const FeaturePtr &theFeature, + const std::string &theAttrName, + const GeomPnt2dPtr &theCoordinates) { + AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( + theFeature->attribute(theAttrName)); aPoint->setValue(theCoordinates); } bool SketchAPI_BSpline::insertPole(const int theIndex, - const GeomPnt2dPtr& theCoordinates, - const ModelHighAPI_Double& theWeight) -{ + const GeomPnt2dPtr &theCoordinates, + const ModelHighAPI_Double &theWeight) { std::ostringstream anActionName; - anActionName << SketchPlugin_BSplineBase::ADD_POLE_ACTION_ID() << "#" << theIndex; + anActionName << SketchPlugin_BSplineBase::ADD_POLE_ACTION_ID() << "#" + << theIndex; bool isOk = feature()->customAction(anActionName.str()); if (isOk) { int anIndex = theIndex + 1; - if (feature()->getKind() == SketchPlugin_BSpline::ID() && anIndex + 1 >= poles()->size()) + if (feature()->getKind() == SketchPlugin_BSpline::ID() && + anIndex + 1 >= poles()->size()) anIndex = poles()->size() - 2; // initialize coordinates and weight of new pole poles()->setPnt(anIndex, theCoordinates); @@ -507,22 +508,23 @@ bool SketchAPI_BSpline::insertPole(const int theIndex, collectAuxiliaryFeatures(feature(), aPoints, aLines); std::map::iterator aFound = aPoints.find(anIndex); if (aFound != aPoints.end()) - setCoordinates(aFound->second, SketchPlugin_Point::COORD_ID(), theCoordinates); + setCoordinates(aFound->second, SketchPlugin_Point::COORD_ID(), + theCoordinates); aFound = aLines.find(anIndex); if (aFound != aLines.end()) - setCoordinates(aFound->second, SketchPlugin_Line::START_ID(), theCoordinates); + setCoordinates(aFound->second, SketchPlugin_Line::START_ID(), + theCoordinates); aFound = aLines.find(anIndex - 1); if (aFound != aLines.end()) - setCoordinates(aFound->second, SketchPlugin_Line::END_ID(), theCoordinates); + setCoordinates(aFound->second, SketchPlugin_Line::END_ID(), + theCoordinates); } return isOk; } - - // ================================================================================================= -SketchAPI_BSplinePeriodic::SketchAPI_BSplinePeriodic(const FeaturePtr& theFeature) - : SketchAPI_BSpline(theFeature, false) -{ +SketchAPI_BSplinePeriodic::SketchAPI_BSplinePeriodic( + const FeaturePtr &theFeature) + : SketchAPI_BSpline(theFeature, false) { initialize(); } diff --git a/src/SketchAPI/SketchAPI_BSpline.h b/src/SketchAPI/SketchAPI_BSpline.h index 003a45d97..a4a5e839e 100644 --- a/src/SketchAPI/SketchAPI_BSpline.h +++ b/src/SketchAPI/SketchAPI_BSpline.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_BSpline_H_ @@ -38,77 +39,79 @@ class ModelHighAPI_Selection; /// \class SketchAPI_BSpline /// \ingroup CPPHighAPI /// \brief Interface for BSpline feature. -class SketchAPI_BSpline : public SketchAPI_SketchEntity -{ +class SketchAPI_BSpline : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_BSpline(const std::shared_ptr& theFeature); + explicit SketchAPI_BSpline( + const std::shared_ptr &theFeature); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_BSpline(); - INTERFACE_8(SketchPlugin_BSpline::ID(), - poles, SketchPlugin_BSplineBase::POLES_ID(), - GeomDataAPI_Point2DArray, /** B-spline poles */, - weights, SketchPlugin_BSplineBase::WEIGHTS_ID(), - ModelAPI_AttributeDoubleArray, /** B-spline weights */, - knots, SketchPlugin_BSplineBase::KNOTS_ID(), - ModelAPI_AttributeDoubleArray, /** B-spline knots */, - multiplicities, SketchPlugin_BSplineBase::MULTS_ID(), - ModelAPI_AttributeIntArray, /** Knots multiplicities */, - degree, SketchPlugin_BSplineBase::DEGREE_ID(), - ModelAPI_AttributeInteger, /** B-spline degree */, - startPoint, SketchPlugin_BSpline::START_ID(), - GeomDataAPI_Point2D, /** First pole of B-spline */, - endPoint, SketchPlugin_BSpline::END_ID(), - GeomDataAPI_Point2D, /** Last pole of B-spline */, - external, SketchPlugin_BSplineBase::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */) + INTERFACE_8( + SketchPlugin_BSpline::ID(), poles, SketchPlugin_BSplineBase::POLES_ID(), + GeomDataAPI_Point2DArray, /** B-spline poles */, weights, + SketchPlugin_BSplineBase::WEIGHTS_ID(), ModelAPI_AttributeDoubleArray, + /** B-spline weights */, knots, SketchPlugin_BSplineBase::KNOTS_ID(), + ModelAPI_AttributeDoubleArray, /** B-spline knots */, multiplicities, + SketchPlugin_BSplineBase::MULTS_ID(), ModelAPI_AttributeIntArray, + /** Knots multiplicities */, degree, + SketchPlugin_BSplineBase::DEGREE_ID(), ModelAPI_AttributeInteger, + /** B-spline degree */, startPoint, SketchPlugin_BSpline::START_ID(), + GeomDataAPI_Point2D, /** First pole of B-spline */, endPoint, + SketchPlugin_BSpline::END_ID(), GeomDataAPI_Point2D, + /** Last pole of B-spline */, external, + SketchPlugin_BSplineBase::EXTERNAL_ID(), ModelAPI_AttributeSelection, + /** External */) /// Set by poles and weights. SKETCHAPI_EXPORT - void setByDegreePolesAndWeights(const ModelHighAPI_Integer& theDegree, - const std::list >& thePoles, - const std::list& theWeights); + void setByDegreePolesAndWeights( + const ModelHighAPI_Integer &theDegree, + const std::list> &thePoles, + const std::list &theWeights); /// Initialize by full set of B-spline parameters. SKETCHAPI_EXPORT - void setByParameters(const ModelHighAPI_Integer& theDegree, - const std::list >& thePoles, - const std::list& theWeights, - const std::list& theKnots, - const std::list& theMults); + void + setByParameters(const ModelHighAPI_Integer &theDegree, + const std::list> &thePoles, + const std::list &theWeights, + const std::list &theKnots, + const std::list &theMults); /// Set by external. SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection& theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Generate list of construction points coincident with B-spline poles SKETCHAPI_EXPORT - std::list > controlPoles( - const std::list& regular = std::list(), - const std::list& auxiliary = std::list()) const; + std::list> + controlPoles(const std::list ®ular = std::list(), + const std::list &auxiliary = std::list()) const; /// Generate control polygon for B-spline curve SKETCHAPI_EXPORT - std::list > controlPolygon( - const std::list& regular = std::list(), - const std::list& auxiliary = std::list()) const; + std::list> + controlPolygon(const std::list ®ular = std::list(), + const std::list &auxiliary = std::list()) const; /// Insert new pole after the pole with the given index SKETCHAPI_EXPORT - bool insertPole(const int theIndex, - const std::shared_ptr& theCoordinates, - const ModelHighAPI_Double& theWeight = ModelHighAPI_Double(1.0)); + bool + insertPole(const int theIndex, + const std::shared_ptr &theCoordinates, + const ModelHighAPI_Double &theWeight = ModelHighAPI_Double(1.0)); /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; protected: - SketchAPI_BSpline(const std::shared_ptr& theFeature, bool theInitialize); + SketchAPI_BSpline(const std::shared_ptr &theFeature, + bool theInitialize); private: /// Initialize start and end points of B-spline and apply internal coincidence @@ -117,37 +120,34 @@ private: /// Compute default B-spline parameters (degree, knots and multiplicities) /// basing on hte given poles and weights - void getDefaultParameters(const std::list >& thePoles, - const std::list& theWeights, - ModelHighAPI_Integer& theDegree, - std::list& theKnots, - std::list& theMults) const; + void getDefaultParameters( + const std::list> &thePoles, + const std::list &theWeights, + ModelHighAPI_Integer &theDegree, std::list &theKnots, + std::list &theMults) const; /// Check what parameters of B-spline are default - void checkDefaultParameters(bool& isDefaultDegree, - bool& isDefaultWeights, - bool& isDefaultKnotsMults) const; - - void dumpControlPolygon(ModelHighAPI_Dumper& theDumper, - const FeaturePtr& theBSpline, - const std::string& theMethod, - const std::map& theAuxFeatures) const; + void checkDefaultParameters(bool &isDefaultDegree, bool &isDefaultWeights, + bool &isDefaultKnotsMults) const; + + void + dumpControlPolygon(ModelHighAPI_Dumper &theDumper, + const FeaturePtr &theBSpline, const std::string &theMethod, + const std::map &theAuxFeatures) const; }; /// Pointer on B-spline object. typedef std::shared_ptr BSplinePtr; - - /// \class SketchAPI_BSplinePeriodic /// \ingroup CPPHighAPI /// \brief Interface for BSplinePeriodic feature. -class SketchAPI_BSplinePeriodic : public SketchAPI_BSpline -{ +class SketchAPI_BSplinePeriodic : public SketchAPI_BSpline { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_BSplinePeriodic(const std::shared_ptr& theFeature); + explicit SketchAPI_BSplinePeriodic( + const std::shared_ptr &theFeature); /// Destructor. SKETCHAPI_EXPORT diff --git a/src/SketchAPI/SketchAPI_Circle.cpp b/src/SketchAPI/SketchAPI_Circle.cpp index 41853fe1d..2dbafac2c 100644 --- a/src/SketchAPI/SketchAPI_Circle.cpp +++ b/src/SketchAPI/SketchAPI_Circle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Circle.h" @@ -27,64 +28,59 @@ #include //================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Circle::SketchAPI_Circle( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } //================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, - double theCenterX, - double theCenterY, - double theRadius) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_Circle::SketchAPI_Circle( + const std::shared_ptr &theFeature, double theCenterX, + double theCenterY, double theRadius) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterAndRadius(theCenterX, theCenterY, theRadius); } } //================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - double theRadius) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_Circle::SketchAPI_Circle( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, double theRadius) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterAndRadius(theCenter, theRadius); } } //================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Circle::SketchAPI_Circle( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); } } //================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, - const std::wstring& theExternalName) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Circle::SketchAPI_Circle( + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); } } //================================================================================================== -SketchAPI_Circle::~SketchAPI_Circle() -{ - -} +SketchAPI_Circle::~SketchAPI_Circle() {} //================================================================================================== -void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius) -{ +void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, + double theCenterY, + double theRadius) { fillAttribute(center(), theCenterX, theCenterY); fillAttribute(theRadius, myradius); @@ -92,9 +88,8 @@ void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY } //================================================================================================== -void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr& theCenter, - double theRadius) -{ +void SketchAPI_Circle::setByCenterAndRadius( + const std::shared_ptr &theCenter, double theRadius) { fillAttribute(theCenter, mycenter); fillAttribute(theRadius, myradius); @@ -102,62 +97,60 @@ void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr } //================================================================================================== -void SketchAPI_Circle::setByExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_Circle::setByExternal( + const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, external()); execute(); } //================================================================================================== -void SketchAPI_Circle::setByExternalName(const std::wstring & theExternalName) -{ +void SketchAPI_Circle::setByExternalName(const std::wstring &theExternalName) { fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external()); execute(); } //================================================================================================== -void SketchAPI_Circle::setCenter(double theX, double theY) -{ +void SketchAPI_Circle::setCenter(double theX, double theY) { fillAttribute(center(), theX, theY); execute(); } //================================================================================================== -void SketchAPI_Circle::setCenter(const std::shared_ptr & theCenter) -{ +void SketchAPI_Circle::setCenter( + const std::shared_ptr &theCenter) { fillAttribute(theCenter, mycenter); execute(); } //================================================================================================== -void SketchAPI_Circle::setRadius(double theRadius) -{ +void SketchAPI_Circle::setRadius(double theRadius) { fillAttribute(ModelHighAPI_Double(theRadius), myradius); execute(); } //================================================================================================== -void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Circle::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // circle is external - theDumper << aBase << " = " << aSketchName << ".addCircle(" << anExternal << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addCircle(" << anExternal + << ")" << std::endl; } else { // circle given by center and radius - theDumper << aBase << " = " << aSketchName << ".addCircle(" - << center() << ", " << radius() << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addCircle(" << center() + << ", " << radius() << ")" << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); diff --git a/src/SketchAPI/SketchAPI_Circle.h b/src/SketchAPI/SketchAPI_Circle.h index dcc58c715..9992b2117 100644 --- a/src/SketchAPI/SketchAPI_Circle.h +++ b/src/SketchAPI/SketchAPI_Circle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_Circle_H_ @@ -30,63 +31,62 @@ class ModelHighAPI_Selection; /// \class SketchAPI_Circle /// \ingroup CPPHighAPI /// \brief Interface for Circle feature. -class SketchAPI_Circle: public SketchAPI_SketchEntity -{ +class SketchAPI_Circle : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_Circle(const std::shared_ptr& theFeature); + explicit SketchAPI_Circle( + const std::shared_ptr &theFeature); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Circle(const std::shared_ptr& theFeature, - double theCenterX, - double theCenterY, - double theRadius); + SketchAPI_Circle(const std::shared_ptr &theFeature, + double theCenterX, double theCenterY, double theRadius); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Circle(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, + SketchAPI_Circle(const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, double theRadius); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Circle(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal); + SketchAPI_Circle(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Circle(const std::shared_ptr& theFeature, - const std::wstring& theExternalName); + SketchAPI_Circle(const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_Circle(); - INTERFACE_3(SketchPlugin_Circle::ID(), - center, SketchPlugin_Circle::CENTER_ID(), - GeomDataAPI_Point2D, /** Center point */, - radius, SketchPlugin_Circle::RADIUS_ID(), - ModelAPI_AttributeDouble, /** Radius */, - external, SketchPlugin_Circle::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */) + INTERFACE_3(SketchPlugin_Circle::ID(), center, + SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D, + /** Center point */, radius, SketchPlugin_Circle::RADIUS_ID(), + ModelAPI_AttributeDouble, /** Radius */, external, + SketchPlugin_Circle::EXTERNAL_ID(), ModelAPI_AttributeSelection, + /** External */) /// Set by center and radius. SKETCHAPI_EXPORT - void setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius); + void setByCenterAndRadius(double theCenterX, double theCenterY, + double theRadius); /// Set by center and radius. SKETCHAPI_EXPORT - void setByCenterAndRadius(const std::shared_ptr& theCenter, double theRadius); + void setByCenterAndRadius(const std::shared_ptr &theCenter, + double theRadius); /// Set by external. SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection& theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Set by external name. SKETCHAPI_EXPORT - void setByExternalName(const std::wstring& theExternalName); + void setByExternalName(const std::wstring &theExternalName); /// Set center. SKETCHAPI_EXPORT @@ -94,7 +94,7 @@ public: /// Set center. SKETCHAPI_EXPORT - void setCenter(const std::shared_ptr & theCenter); + void setCenter(const std::shared_ptr &theCenter); /// Set radius. SKETCHAPI_EXPORT @@ -102,7 +102,7 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Circle object. diff --git a/src/SketchAPI/SketchAPI_Constraint.cpp b/src/SketchAPI/SketchAPI_Constraint.cpp index d69c35f88..fd70ba5a2 100644 --- a/src/SketchAPI/SketchAPI_Constraint.cpp +++ b/src/SketchAPI/SketchAPI_Constraint.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Constraint.h" #include #include -#include #include +#include #include #include @@ -40,28 +41,25 @@ #include #include #include -#include #include +#include #include #include SketchAPI_Constraint::SketchAPI_Constraint( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ - ConstraintPtr aConstraint = std::dynamic_pointer_cast(theFeature); + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { + ConstraintPtr aConstraint = + std::dynamic_pointer_cast(theFeature); if (aConstraint) initialize(); } -SketchAPI_Constraint::~SketchAPI_Constraint() -{ -} +SketchAPI_Constraint::~SketchAPI_Constraint() {} -bool SketchAPI_Constraint::initialize() -{ +bool SketchAPI_Constraint::initialize() { if (!feature()) { throwException("Constraint exception: The feature is NULL."); return false; @@ -69,40 +67,38 @@ bool SketchAPI_Constraint::initialize() return true; } -void SketchAPI_Constraint::setEntityA(const ModelHighAPI_RefAttr& theEntity) -{ - fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_A())); +void SketchAPI_Constraint::setEntityA(const ModelHighAPI_RefAttr &theEntity) { + fillAttribute(theEntity, + feature()->refattr(SketchPlugin_Constraint::ENTITY_A())); } -void SketchAPI_Constraint::setEntityB(const ModelHighAPI_RefAttr& theEntity) -{ - fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_B())); +void SketchAPI_Constraint::setEntityB(const ModelHighAPI_RefAttr &theEntity) { + fillAttribute(theEntity, + feature()->refattr(SketchPlugin_Constraint::ENTITY_B())); } -void SketchAPI_Constraint::setEntityC(const ModelHighAPI_RefAttr& theEntity) -{ - fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_C())); +void SketchAPI_Constraint::setEntityC(const ModelHighAPI_RefAttr &theEntity) { + fillAttribute(theEntity, + feature()->refattr(SketchPlugin_Constraint::ENTITY_C())); } -void SketchAPI_Constraint::setEntityD(const ModelHighAPI_RefAttr& theEntity) -{ - fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_D())); +void SketchAPI_Constraint::setEntityD(const ModelHighAPI_RefAttr &theEntity) { + fillAttribute(theEntity, + feature()->refattr(SketchPlugin_Constraint::ENTITY_D())); } -void SketchAPI_Constraint::setValue(const ModelHighAPI_Double& theValue) -{ +void SketchAPI_Constraint::setValue(const ModelHighAPI_Double &theValue) { fillAttribute(theValue, feature()->real(SketchPlugin_Constraint::VALUE())); } -double SketchAPI_Constraint::value() const -{ - AttributeDoublePtr aValueAttr = feature()->real(SketchPlugin_Constraint::VALUE()); +double SketchAPI_Constraint::value() const { + AttributeDoublePtr aValueAttr = + feature()->real(SketchPlugin_Constraint::VALUE()); return aValueAttr->isInitialized() ? aValueAttr->value() : std::numeric_limits::quiet_NaN(); } -static const std::string& constraintTypeToSetter(const std::string& theType) -{ +static const std::string &constraintTypeToSetter(const std::string &theType) { if (theType == SketchPlugin_ConstraintCoincidence::ID()) { static const std::string COINCIDENCE_SETTER("setCoincident"); return COINCIDENCE_SETTER; @@ -168,12 +164,13 @@ static const std::string& constraintTypeToSetter(const std::string& theType) return DUMMY; } -bool SketchAPI_Constraint::areAllAttributesDumped(ModelHighAPI_Dumper& theDumper) const -{ +bool SketchAPI_Constraint::areAllAttributesDumped( + ModelHighAPI_Dumper &theDumper) const { bool areAttributesDumped = true; FeaturePtr aBase = feature(); for (int i = 0; i < CONSTRAINT_ATTR_SIZE && areAttributesDumped; ++i) { - AttributeRefAttrPtr aRefAttr = aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr && aRefAttr->isInitialized()) areAttributesDumped = theDumper.isDumped(aRefAttr); } @@ -182,37 +179,38 @@ bool SketchAPI_Constraint::areAllAttributesDumped(ModelHighAPI_Dumper& theDumper return areAttributesDumped; } -void SketchAPI_Constraint::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Constraint::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSetter = constraintTypeToSetter(aBase->getKind()); + const std::string &aSetter = constraintTypeToSetter(aBase->getKind()); if (aSetter.empty()) return; // incorrect constraint type // do not need to dump "Fixed" constraint for external object if (aBase->getKind() == SketchPlugin_ConstraintRigid::ID()) { - AttributeRefAttrPtr aRefAttr = aBase->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttr = + aBase->refattr(SketchPlugin_Constraint::ENTITY_A()); FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); if (!aFeature) return; AttributeSelectionPtr aAttr = - aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (aAttr && aAttr->context().get() != NULL && !aAttr->isInvalid()) return; } - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); // Dump middle constraint by object if (SketchPlugin_ConstraintMiddle::ID() == aBase->getKind() && - aBase->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE())->value() == SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE()) - { + aBase->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE())->value() == + SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE()) { FeaturePtr aFeature; - AttributeRefAttrPtr aPointRefAttr = aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(1)); - AttributeRefAttrPtr aRefAttr = aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(0)); + AttributeRefAttrPtr aPointRefAttr = + aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(1)); + AttributeRefAttrPtr aRefAttr = + aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(0)); - if (!theDumper.isDumped(aRefAttr)) - { + if (!theDumper.isDumped(aRefAttr)) { theDumper.postpone(aBase); return; } @@ -220,14 +218,13 @@ void SketchAPI_Constraint::dump(ModelHighAPI_Dumper& theDumper) const theDumper.name(aFeature, false, true, true); // mark point as dumped - theDumper << theDumper.name(aFeature) << " = " << aSketchName << "." << aSetter << "("; + theDumper << theDumper.name(aFeature) << " = " << aSketchName << "." + << aSetter << "("; if (aRefAttr && aRefAttr->isInitialized()) { theDumper << aRefAttr; } theDumper << ")" << std::endl; - } - else - { + } else { // postpone constraint until all its attributes be dumped if (!areAllAttributesDumped(theDumper)) return; @@ -235,7 +232,8 @@ void SketchAPI_Constraint::dump(ModelHighAPI_Dumper& theDumper) const theDumper << aSketchName << "." << aSetter << "("; bool isFirstAttr = true; for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr && aRefAttr->isInitialized()) { theDumper << (isFirstAttr ? "" : ", ") << aRefAttr; isFirstAttr = false; @@ -244,18 +242,19 @@ void SketchAPI_Constraint::dump(ModelHighAPI_Dumper& theDumper) const AttributeDoublePtr aValueAttr; if (aBase->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID() || - aBase->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) - aValueAttr = aBase->real(SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()); + aBase->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) + aValueAttr = aBase->real( + SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()); else aValueAttr = aBase->real(SketchPlugin_Constraint::VALUE()); if (aValueAttr && aValueAttr->isInitialized()) theDumper << ", " << aValueAttr; if (aBase->getKind() == SketchPlugin_ConstraintDistance::ID()) { - AttributeBooleanPtr isSigned = aBase->boolean(SketchPlugin_ConstraintDistance::SIGNED()); + AttributeBooleanPtr isSigned = + aBase->boolean(SketchPlugin_ConstraintDistance::SIGNED()); theDumper << ", " << isSigned->value(); } theDumper << ")" << std::endl; } - } diff --git a/src/SketchAPI/SketchAPI_Constraint.h b/src/SketchAPI/SketchAPI_Constraint.h index fe4ece791..e157f4385 100644 --- a/src/SketchAPI/SketchAPI_Constraint.h +++ b/src/SketchAPI/SketchAPI_Constraint.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_CONSTRAINT_H_ @@ -35,19 +36,18 @@ class SketchAPI_SketchEntity; * \ingroup CPPHighAPI * \brief Interface for Constraint feature */ -class SketchAPI_Constraint : public ModelHighAPI_Interface -{ +class SketchAPI_Constraint : public ModelHighAPI_Interface { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Constraint(const std::shared_ptr & theFeature); + explicit SketchAPI_Constraint( + const std::shared_ptr &theFeature); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Constraint(); - static std::string ID() - { + static std::string ID() { static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraint"; return MY_SKETCH_CONSTRAINT_ID; } @@ -56,23 +56,23 @@ public: SKETCHAPI_EXPORT bool initialize(); - SKETCHAPI_EXPORT void setEntityA(const ModelHighAPI_RefAttr& theEntity); - SKETCHAPI_EXPORT void setEntityB(const ModelHighAPI_RefAttr& theEntity); - SKETCHAPI_EXPORT void setEntityC(const ModelHighAPI_RefAttr& theEntity); - SKETCHAPI_EXPORT void setEntityD(const ModelHighAPI_RefAttr& theEntity); + SKETCHAPI_EXPORT void setEntityA(const ModelHighAPI_RefAttr &theEntity); + SKETCHAPI_EXPORT void setEntityB(const ModelHighAPI_RefAttr &theEntity); + SKETCHAPI_EXPORT void setEntityC(const ModelHighAPI_RefAttr &theEntity); + SKETCHAPI_EXPORT void setEntityD(const ModelHighAPI_RefAttr &theEntity); - SKETCHAPI_EXPORT void setValue(const ModelHighAPI_Double& theValue); + SKETCHAPI_EXPORT void setValue(const ModelHighAPI_Double &theValue); SKETCHAPI_EXPORT double value() const; /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; protected: // Check all attributes of constraint are already dumped. // If not, store the constraint as postponed. - bool areAllAttributesDumped(ModelHighAPI_Dumper& theDumper) const; + bool areAllAttributesDumped(ModelHighAPI_Dumper &theDumper) const; }; #endif diff --git a/src/SketchAPI/SketchAPI_ConstraintAngle.cpp b/src/SketchAPI/SketchAPI_ConstraintAngle.cpp index edf90a5d3..99eb090d5 100644 --- a/src/SketchAPI/SketchAPI_ConstraintAngle.cpp +++ b/src/SketchAPI/SketchAPI_ConstraintAngle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_ConstraintAngle.h" @@ -33,22 +34,24 @@ #include SketchAPI_ConstraintAngle::SketchAPI_ConstraintAngle( - const std::shared_ptr & theFeature) -: SketchAPI_Constraint(theFeature) -{ - ConstraintPtr aConstraint = std::dynamic_pointer_cast(theFeature); + const std::shared_ptr &theFeature) + : SketchAPI_Constraint(theFeature) { + ConstraintPtr aConstraint = + std::dynamic_pointer_cast(theFeature); if (aConstraint) initialize(); } -static FeaturePtr getFeatureLine(DataPtr theData, const std::string& theAttribute) -{ +static FeaturePtr getFeatureLine(DataPtr theData, + const std::string &theAttribute) { FeaturePtr aLine; - if (!theData.get() || !theData->isValid()) /// essential check as it is called in openGl thread) + if (!theData.get() || + !theData->isValid()) /// essential check as it is called in openGl thread) return aLine; std::shared_ptr anAttr = - std::dynamic_pointer_cast(theData->attribute(theAttribute)); + std::dynamic_pointer_cast( + theData->attribute(theAttribute)); if (anAttr) { FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object()); if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) { @@ -59,20 +62,27 @@ static FeaturePtr getFeatureLine(DataPtr theData, const std::string& theAttribut } static void calculatePossibleValuesOfAngle(FeaturePtr theFeature, - double& theAngleDirect, double& theAngleComplementary, double& theAngleBackward) -{ + double &theAngleDirect, + double &theAngleComplementary, + double &theAngleBackward) { std::shared_ptr aData = theFeature->data(); - FeaturePtr aLineA = getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A()); - FeaturePtr aLineB = getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B()); - - std::shared_ptr aStartA = std::dynamic_pointer_cast( - aLineA->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aEndA = std::dynamic_pointer_cast( - aLineA->attribute(SketchPlugin_Line::END_ID())); - std::shared_ptr aStartB = std::dynamic_pointer_cast( - aLineB->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aEndB = std::dynamic_pointer_cast( - aLineB->attribute(SketchPlugin_Line::END_ID())); + FeaturePtr aLineA = + getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A()); + FeaturePtr aLineB = + getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B()); + + std::shared_ptr aStartA = + std::dynamic_pointer_cast( + aLineA->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aEndA = + std::dynamic_pointer_cast( + aLineA->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aStartB = + std::dynamic_pointer_cast( + aLineB->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aEndB = + std::dynamic_pointer_cast( + aLineB->attribute(SketchPlugin_Line::END_ID())); std::shared_ptr anAng(new GeomAPI_Angle2d( aStartA->pnt(), aEndA->pnt(), aStartB->pnt(), aEndB->pnt())); @@ -81,32 +91,34 @@ static void calculatePossibleValuesOfAngle(FeaturePtr theFeature, theAngleBackward = 360.0 - theAngleDirect; } -static std::string angleTypeToString(FeaturePtr theFeature) -{ +static std::string angleTypeToString(FeaturePtr theFeature) { static const double TOLERANCE = 1.e-7; static const std::string THE_ANGLE_DIRECT("Direct"); static const std::string THE_ANGLE_SUPPLEMENTARY("Supplementary"); static const std::string THE_ANGLE_BACKWARD("Backward"); double anAngleDirect, anAngleComplmentary, anAngleBackward; - calculatePossibleValuesOfAngle(theFeature, anAngleDirect, anAngleComplmentary, anAngleBackward); + calculatePossibleValuesOfAngle(theFeature, anAngleDirect, anAngleComplmentary, + anAngleBackward); - AttributeDoublePtr aValueAttr = theFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); + AttributeDoublePtr aValueAttr = + theFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); double aDirectDiff = fabs(aValueAttr->value() - anAngleDirect); double aComplementaryDiff = fabs(aValueAttr->value() - anAngleComplmentary); double aBackwardDiff = fabs(aValueAttr->value() - anAngleBackward); - AttributeIntegerPtr aTypeAttr = theFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID()); + AttributeIntegerPtr aTypeAttr = + theFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID()); bool isDirect = aTypeAttr->value() == SketcherPrs_Tools::ANGLE_DIRECT; - bool isComplementary = aTypeAttr->value() == SketcherPrs_Tools::ANGLE_COMPLEMENTARY; + bool isComplementary = + aTypeAttr->value() == SketcherPrs_Tools::ANGLE_COMPLEMENTARY; bool isBackward = aTypeAttr->value() == SketcherPrs_Tools::ANGLE_BACKWARD; // find the minimal difference std::string aType; if (isDirect && aDirectDiff < TOLERANCE) { aType = THE_ANGLE_DIRECT; - } - else if (isComplementary && aComplementaryDiff < TOLERANCE) + } else if (isComplementary && aComplementaryDiff < TOLERANCE) aType = THE_ANGLE_SUPPLEMENTARY; else if (isBackward && aBackwardDiff < TOLERANCE) aType = THE_ANGLE_BACKWARD; @@ -121,8 +133,7 @@ static std::string angleTypeToString(FeaturePtr theFeature) return aType; } -void SketchAPI_ConstraintAngle::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_ConstraintAngle::dump(ModelHighAPI_Dumper &theDumper) const { // postpone constraint until all its attributes be dumped if (!areAllAttributesDumped(theDumper)) return; @@ -130,20 +141,23 @@ void SketchAPI_ConstraintAngle::dump(ModelHighAPI_Dumper& theDumper) const // calculate angle value as it was just applied to the attributes FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); theDumper.name(aBase, false, true, true); // mark constraint as dumped - theDumper << aSketchName << "." << "setAngle("; + theDumper << aSketchName << "." + << "setAngle("; bool isFirstAttr = true; for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + aBase->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr && aRefAttr->isInitialized()) { theDumper << (isFirstAttr ? "" : ", ") << aRefAttr; isFirstAttr = false; } } - AttributeDoublePtr aValueAttr = aBase->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); + AttributeDoublePtr aValueAttr = + aBase->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); if (aValueAttr && aValueAttr->isInitialized()) theDumper << ", " << aValueAttr; diff --git a/src/SketchAPI/SketchAPI_ConstraintAngle.h b/src/SketchAPI/SketchAPI_ConstraintAngle.h index dc9f30b68..9d8aa7f67 100644 --- a/src/SketchAPI/SketchAPI_ConstraintAngle.h +++ b/src/SketchAPI/SketchAPI_ConstraintAngle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_CONSTRAINTANGLE_H_ @@ -28,15 +29,14 @@ class ModelHighAPI_Double; * \ingroup CPPHighAPI * \brief Interface for ConstraintAngle feature */ -class SketchAPI_ConstraintAngle : public SketchAPI_Constraint -{ +class SketchAPI_ConstraintAngle : public SketchAPI_Constraint { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_ConstraintAngle(const std::shared_ptr & theFeature); + explicit SketchAPI_ConstraintAngle( + const std::shared_ptr &theFeature); - static std::string ID() - { + static std::string ID() { static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraintAngle"; return MY_SKETCH_CONSTRAINT_ID; } @@ -44,7 +44,7 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; #endif diff --git a/src/SketchAPI/SketchAPI_Ellipse.cpp b/src/SketchAPI/SketchAPI_Ellipse.cpp index 6c869440e..a822bcaac 100644 --- a/src/SketchAPI/SketchAPI_Ellipse.cpp +++ b/src/SketchAPI/SketchAPI_Ellipse.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Ellipse.h" @@ -37,60 +38,58 @@ static const std::wstring AUXILIARY_VALUE = L"aux"; static const std::string MAJOR_AXIS_ID = "majorAxis"; static const std::string MINOR_AXIS_ID = "minorAxis"; -SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr & theFeature) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Ellipse::SketchAPI_Ellipse( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } -SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theMinorRadius) - : SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { - setByCenterFocusAndRadius(theCenterX, theCenterY, theFocusX, theFocusY, theMinorRadius); +SketchAPI_Ellipse::SketchAPI_Ellipse( + const std::shared_ptr &theFeature, double theCenterX, + double theCenterY, double theFocusX, double theFocusY, + double theMinorRadius) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { + setByCenterFocusAndRadius(theCenterX, theCenterY, theFocusX, theFocusY, + theMinorRadius); } } -SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - double theMinorRadius) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_Ellipse::SketchAPI_Ellipse( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, double theMinorRadius) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterFocusAndRadius(theCenter, theFocus, theMinorRadius); } } -SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Ellipse::SketchAPI_Ellipse( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); } } -SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr& theFeature, - const std::wstring& theExternalName) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Ellipse::SketchAPI_Ellipse( + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); } } -SketchAPI_Ellipse::~SketchAPI_Ellipse() -{ -} +SketchAPI_Ellipse::~SketchAPI_Ellipse() {} -void SketchAPI_Ellipse::setByCenterFocusAndRadius(double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theMinorRadius) -{ +void SketchAPI_Ellipse::setByCenterFocusAndRadius(double theCenterX, + double theCenterY, + double theFocusX, + double theFocusY, + double theMinorRadius) { fillAttribute(center(), theCenterX, theCenterY); fillAttribute(firstFocus(), theFocusX, theFocusY); fillAttribute(theMinorRadius, myminorRadius); @@ -98,10 +97,9 @@ void SketchAPI_Ellipse::setByCenterFocusAndRadius(double theCenterX, double theC execute(); } -void SketchAPI_Ellipse::setByCenterFocusAndRadius(const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - double theMinorRadius) -{ +void SketchAPI_Ellipse::setByCenterFocusAndRadius( + const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, double theMinorRadius) { fillAttribute(theCenter, mycenter); fillAttribute(theFocus, myfirstFocus); fillAttribute(theMinorRadius, myminorRadius); @@ -109,50 +107,45 @@ void SketchAPI_Ellipse::setByCenterFocusAndRadius(const std::shared_ptr & theCenter) -{ +void SketchAPI_Ellipse::setCenter( + const std::shared_ptr &theCenter) { fillAttribute(theCenter, mycenter); execute(); } -void SketchAPI_Ellipse::setFocus(double theX, double theY) -{ +void SketchAPI_Ellipse::setFocus(double theX, double theY) { fillAttribute(firstFocus(), theX, theY); execute(); } -void SketchAPI_Ellipse::setFocus(const std::shared_ptr & theFocus) -{ +void SketchAPI_Ellipse::setFocus( + const std::shared_ptr &theFocus) { fillAttribute(theFocus, myfirstFocus); execute(); } -void SketchAPI_Ellipse::setMinorRadius(double theMinorRadius) -{ +void SketchAPI_Ellipse::setMinorRadius(double theMinorRadius) { fillAttribute(theMinorRadius, myminorRadius); execute(); } -static const std::list& ellipseAttrAndDumpNames() -{ +static const std::list &ellipseAttrAndDumpNames() { static std::list anAttributes; if (anAttributes.empty()) { anAttributes.push_back( @@ -161,57 +154,60 @@ static const std::list& ellipseAttrAndDumpNames() PairOfStrings(SketchPlugin_Ellipse::FIRST_FOCUS_ID(), "firstFocus")); anAttributes.push_back( PairOfStrings(SketchPlugin_Ellipse::SECOND_FOCUS_ID(), "secondFocus")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), "majorAxisStart")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID(), "majorAxisEnd")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), "minorAxisStart")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_Ellipse::MINOR_AXIS_END_ID(), "minorAxisEnd")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), "majorAxisStart")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_Ellipse::MAJOR_AXIS_END_ID(), "majorAxisEnd")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), "minorAxisStart")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_Ellipse::MINOR_AXIS_END_ID(), "minorAxisEnd")); } return anAttributes; } -static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) -{ - const std::set& aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) +static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) { + const std::set &aRefs = theFeature->data()->refsToMe(); + for (std::set::const_iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) - return std::dynamic_pointer_cast((*anIt)->owner()); + return std::dynamic_pointer_cast( + (*anIt)->owner()); return CompositeFeaturePtr(); } -static void createInternalConstraint(const CompositeFeaturePtr& theSketch, - const AttributePoint2DPtr& thePoint1, - const AttributePoint2DPtr& thePoint2) -{ - FeaturePtr aConstraint = theSketch->addFeature(SketchPlugin_ConstraintCoincidenceInternal::ID()); +static void createInternalConstraint(const CompositeFeaturePtr &theSketch, + const AttributePoint2DPtr &thePoint1, + const AttributePoint2DPtr &thePoint2) { + FeaturePtr aConstraint = + theSketch->addFeature(SketchPlugin_ConstraintCoincidenceInternal::ID()); aConstraint->refattr(SketchPlugin_Constraint::ENTITY_A())->setAttr(thePoint1); aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(thePoint2); aConstraint->execute(); } -static void createPoint(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theEllipse, - const std::string& theCoincident, - const std::wstring& theAuxOrName, - std::list& theEntities) -{ +static void createPoint(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theEllipse, + const std::string &theCoincident, + const std::wstring &theAuxOrName, + std::list &theEntities) { if (theAuxOrName.empty()) return; - AttributePoint2DPtr anElPoint = std::dynamic_pointer_cast( - theEllipse->attribute(theCoincident)); + AttributePoint2DPtr anElPoint = + std::dynamic_pointer_cast( + theEllipse->attribute(theCoincident)); FeaturePtr aPointFeature = theSketch->addFeature(SketchPlugin_Point::ID()); AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( aPointFeature->attribute(SketchPlugin_Point::COORD_ID())); aCoord->setValue(anElPoint->x(), anElPoint->y()); - aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theEllipse); + aPointFeature->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(theEllipse); aPointFeature->execute(); - std::wstring aName = theEllipse->name() + L"_" + Locale::Convert::toWString(theCoincident); + std::wstring aName = + theEllipse->name() + L"_" + Locale::Convert::toWString(theCoincident); aPointFeature->data()->setName(aName); aPointFeature->lastResult()->data()->setName(aName); @@ -227,34 +223,39 @@ static void createPoint(const CompositeFeaturePtr& theSketch, theEntities.push_back(aPointFeature); } -static void createAxis(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theEllipse, - const std::string& theCoincidentStart, - const std::string& theCoincidentEnd, - const std::wstring& theAuxOrName, - std::list& theEntities) -{ +static void createAxis(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theEllipse, + const std::string &theCoincidentStart, + const std::string &theCoincidentEnd, + const std::wstring &theAuxOrName, + std::list &theEntities) { if (theAuxOrName.empty()) return; AttributePoint2DPtr aStartPoint = - std::dynamic_pointer_cast(theEllipse->attribute(theCoincidentStart)); + std::dynamic_pointer_cast( + theEllipse->attribute(theCoincidentStart)); AttributePoint2DPtr aEndPoint = - std::dynamic_pointer_cast(theEllipse->attribute(theCoincidentEnd)); + std::dynamic_pointer_cast( + theEllipse->attribute(theCoincidentEnd)); FeaturePtr aLineFeature = theSketch->addFeature(SketchPlugin_Line::ID()); - AttributePoint2DPtr aLineStart = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::START_ID())); + AttributePoint2DPtr aLineStart = + std::dynamic_pointer_cast( + aLineFeature->attribute(SketchPlugin_Line::START_ID())); aLineStart->setValue(aStartPoint->x(), aStartPoint->y()); AttributePoint2DPtr aLineEnd = std::dynamic_pointer_cast( aLineFeature->attribute(SketchPlugin_Line::END_ID())); aLineEnd->setValue(aEndPoint->x(), aEndPoint->y()); - aLineFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theEllipse); + aLineFeature->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(theEllipse); aLineFeature->execute(); - std::wstring aName = theEllipse->name() + L"_" + - (theCoincidentStart == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() ? - L"major_axis" : L"minor_axis"); + std::wstring aName = + theEllipse->name() + L"_" + + (theCoincidentStart == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() + ? L"major_axis" + : L"minor_axis"); aLineFeature->data()->setName(aName); aLineFeature->lastResult()->data()->setName(aName); @@ -271,68 +272,69 @@ static void createAxis(const CompositeFeaturePtr& theSketch, theEntities.push_back(aLineFeature); } -std::list > SketchAPI_Ellipse::construction( - const std::wstring& center, - const std::wstring& firstFocus, - const std::wstring& secondFocus, - const std::wstring& majorAxisStart, - const std::wstring& majorAxisEnd, - const std::wstring& minorAxisStart, - const std::wstring& minorAxisEnd, - const std::wstring& majorAxis, - const std::wstring& minorAxis) const -{ +std::list> +SketchAPI_Ellipse::construction( + const std::wstring ¢er, const std::wstring &firstFocus, + const std::wstring &secondFocus, const std::wstring &majorAxisStart, + const std::wstring &majorAxisEnd, const std::wstring &minorAxisStart, + const std::wstring &minorAxisEnd, const std::wstring &majorAxis, + const std::wstring &minorAxis) const { FeaturePtr anEllipse = feature(); std::list anAttributes = ellipseAttrAndDumpNames(); // append start and end attributes for axes - anAttributes.push_back(PairOfStrings(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), - SketchPlugin_Ellipse::MAJOR_AXIS_END_ID())); - anAttributes.push_back(PairOfStrings(SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), - SketchPlugin_Ellipse::MINOR_AXIS_END_ID())); - - return buildConstructionEntities(anEllipse, anAttributes, center, firstFocus, secondFocus, - majorAxisStart, majorAxisEnd, minorAxisStart, minorAxisEnd, majorAxis, minorAxis); + anAttributes.push_back( + PairOfStrings(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), + SketchPlugin_Ellipse::MAJOR_AXIS_END_ID())); + anAttributes.push_back( + PairOfStrings(SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), + SketchPlugin_Ellipse::MINOR_AXIS_END_ID())); + + return buildConstructionEntities( + anEllipse, anAttributes, center, firstFocus, secondFocus, majorAxisStart, + majorAxisEnd, minorAxisStart, minorAxisEnd, majorAxis, minorAxis); } -std::list > SketchAPI_Ellipse::buildConstructionEntities( - const FeaturePtr& theEllipse, - const std::list& theAttributes, - const std::wstring& theCenter, - const std::wstring& theFirstFocus, - const std::wstring& theSecondFocus, - const std::wstring& theMajorAxisStart, - const std::wstring& theMajorAxisEnd, - const std::wstring& theMinorAxisStart, - const std::wstring& theMinorAxisEnd, - const std::wstring& theMajorAxis, - const std::wstring& theMinorAxis) -{ +std::list> +SketchAPI_Ellipse::buildConstructionEntities( + const FeaturePtr &theEllipse, const std::list &theAttributes, + const std::wstring &theCenter, const std::wstring &theFirstFocus, + const std::wstring &theSecondFocus, const std::wstring &theMajorAxisStart, + const std::wstring &theMajorAxisEnd, const std::wstring &theMinorAxisStart, + const std::wstring &theMinorAxisEnd, const std::wstring &theMajorAxis, + const std::wstring &theMinorAxis) { CompositeFeaturePtr aSketch = sketchForFeature(theEllipse); std::list anEntities; std::list::const_iterator anAttrIt = theAttributes.begin(); createPoint(aSketch, theEllipse, (anAttrIt++)->first, theCenter, anEntities); - createPoint(aSketch, theEllipse, (anAttrIt++)->first, theFirstFocus, anEntities); - createPoint(aSketch, theEllipse, (anAttrIt++)->first, theSecondFocus, anEntities); - createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMajorAxisStart, anEntities); - createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMajorAxisEnd, anEntities); - createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMinorAxisStart, anEntities); - createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMinorAxisEnd, anEntities); - - createAxis(aSketch, theEllipse, anAttrIt->first, anAttrIt->second, theMajorAxis, anEntities); + createPoint(aSketch, theEllipse, (anAttrIt++)->first, theFirstFocus, + anEntities); + createPoint(aSketch, theEllipse, (anAttrIt++)->first, theSecondFocus, + anEntities); + createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMajorAxisStart, + anEntities); + createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMajorAxisEnd, + anEntities); + createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMinorAxisStart, + anEntities); + createPoint(aSketch, theEllipse, (anAttrIt++)->first, theMinorAxisEnd, + anEntities); + + createAxis(aSketch, theEllipse, anAttrIt->first, anAttrIt->second, + theMajorAxis, anEntities); ++anAttrIt; - createAxis(aSketch, theEllipse, anAttrIt->first, anAttrIt->second, theMinorAxis, anEntities); + createAxis(aSketch, theEllipse, anAttrIt->first, anAttrIt->second, + theMinorAxis, anEntities); return SketchAPI_SketchEntity::wrap(anEntities); } static void ellipseAttributeAndAuxiliaryFeature( - const FeaturePtr& theInternalConstraint, - const std::pair& theMajorAxisStartEnd, - const std::pair& theMinorAxisStartEnd, - std::map& theAttrToFeature) -{ + const FeaturePtr &theInternalConstraint, + const std::pair &theMajorAxisStartEnd, + const std::pair &theMinorAxisStartEnd, + std::map &theAttrToFeature) { AttributeRefAttrPtr aRefAttrA = theInternalConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); AttributeRefAttrPtr aRefAttrB = @@ -349,47 +351,52 @@ static void ellipseAttributeAndAuxiliaryFeature( if (anAuxFeature->getKind() == SketchPlugin_Point::ID()) theAttrToFeature[aRefAttrA->attr()->id()] = anAuxFeature; else { - const std::string& anAttrID = aRefAttrA->attr()->id(); - if (anAttrID == theMajorAxisStartEnd.first || anAttrID == theMajorAxisStartEnd.second) + const std::string &anAttrID = aRefAttrA->attr()->id(); + if (anAttrID == theMajorAxisStartEnd.first || + anAttrID == theMajorAxisStartEnd.second) theAttrToFeature[MAJOR_AXIS_ID] = anAuxFeature; - else if (anAttrID == theMinorAxisStartEnd.first || anAttrID == theMinorAxisStartEnd.second) + else if (anAttrID == theMinorAxisStartEnd.first || + anAttrID == theMinorAxisStartEnd.second) theAttrToFeature[MINOR_AXIS_ID] = anAuxFeature; } } void SketchAPI_Ellipse::collectAuxiliaryFeatures( FeaturePtr theEllipse, - const std::pair& theMajorAxis, - const std::pair& theMinorAxis, - std::map& theAttrToFeature) -{ - const std::set& aRefs = theEllipse->data()->refsToMe(); + const std::pair &theMajorAxis, + const std::pair &theMinorAxis, + std::map &theAttrToFeature) { + const std::set &aRefs = theEllipse->data()->refsToMe(); for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end(); ++aRefIt) { FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); - if (anOwner->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { + if (anOwner->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { // process internal constraints only - ellipseAttributeAndAuxiliaryFeature(anOwner, theMajorAxis, theMinorAxis, theAttrToFeature); + ellipseAttributeAndAuxiliaryFeature(anOwner, theMajorAxis, theMinorAxis, + theAttrToFeature); } } } -void SketchAPI_Ellipse::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Ellipse::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // circle is external - theDumper << aBase << " = " << aSketchName << ".addEllipse(" << anExternal << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addEllipse(" << anExternal + << ")" << std::endl; } else { // ellipse given by center, focus and radius - theDumper << aBase << " = " << aSketchName << ".addEllipse(" - << center() << ", " << firstFocus() << ", " << minorRadius() << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addEllipse(" << center() + << ", " << firstFocus() << ", " << minorRadius() << ")" + << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); @@ -406,17 +413,15 @@ void SketchAPI_Ellipse::dump(ModelHighAPI_Dumper& theDumper) const if (!anAuxFeatures.empty()) { // a list of attributes to write features in special order - const std::list& anAttributes = ellipseAttrAndDumpNames(); + const std::list &anAttributes = ellipseAttrAndDumpNames(); dumpConstructionEntities(theDumper, aBase, anAttributes, anAuxFeatures); } } void SketchAPI_Ellipse::dumpConstructionEntities( - ModelHighAPI_Dumper& theDumper, - const FeaturePtr& theEllipse, - const std::list& theAttributes, - const std::map& theAuxFeatures) -{ + ModelHighAPI_Dumper &theDumper, const FeaturePtr &theEllipse, + const std::list &theAttributes, + const std::map &theAuxFeatures) { std::list anAttributes = theAttributes; // append axes anAttributes.push_back(PairOfStrings(MAJOR_AXIS_ID, MAJOR_AXIS_ID)); @@ -425,8 +430,9 @@ void SketchAPI_Ellipse::dumpConstructionEntities( theDumper << "["; bool isFirst = true; for (std::list::iterator anIt = anAttributes.begin(); - anIt != anAttributes.end(); ++anIt) { - std::map::const_iterator aFound = theAuxFeatures.find(anIt->first); + anIt != anAttributes.end(); ++anIt) { + std::map::const_iterator aFound = + theAuxFeatures.find(anIt->first); if (aFound == theAuxFeatures.end()) continue; if (!isFirst) @@ -438,15 +444,17 @@ void SketchAPI_Ellipse::dumpConstructionEntities( theDumper << "] = " << theDumper.name(theEllipse) << ".construction("; isFirst = true; for (std::list::iterator anIt = anAttributes.begin(); - anIt != anAttributes.end(); ++anIt) { - std::map::const_iterator aFound = theAuxFeatures.find(anIt->first); + anIt != anAttributes.end(); ++anIt) { + std::map::const_iterator aFound = + theAuxFeatures.find(anIt->first); if (aFound == theAuxFeatures.end()) continue; if (!isFirst) theDumper << ", "; isFirst = false; theDumper << anIt->second << " = \""; - if (aFound->second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) + if (aFound->second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()) theDumper << AUXILIARY_VALUE; else theDumper << aFound->second->name(); diff --git a/src/SketchAPI/SketchAPI_Ellipse.h b/src/SketchAPI/SketchAPI_Ellipse.h index 0ccf9abc7..527340dbe 100644 --- a/src/SketchAPI/SketchAPI_Ellipse.h +++ b/src/SketchAPI/SketchAPI_Ellipse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_Ellipse_H_ @@ -32,48 +33,47 @@ typedef std::pair PairOfStrings; /// \class SketchAPI_Ellipse /// \ingroup CPPHighAPI /// \brief Interface for Ellipse feature. -class SketchAPI_Ellipse : public SketchAPI_SketchEntity -{ +class SketchAPI_Ellipse : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_Ellipse(const std::shared_ptr& theFeature); + explicit SketchAPI_Ellipse( + const std::shared_ptr &theFeature); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Ellipse(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theMinorRadius); + SketchAPI_Ellipse(const std::shared_ptr &theFeature, + double theCenterX, double theCenterY, double theFocusX, + double theFocusY, double theMinorRadius); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_Ellipse(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, + SketchAPI_Ellipse(const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, double theMinorRadius); /// Constructor with external. SKETCHAPI_EXPORT - SketchAPI_Ellipse(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal); + SketchAPI_Ellipse(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with external. SKETCHAPI_EXPORT - SketchAPI_Ellipse(const std::shared_ptr& theFeature, - const std::wstring& theExternalName); + SketchAPI_Ellipse(const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_Ellipse(); - INTERFACE_10(SketchPlugin_Ellipse::ID(), - center, SketchPlugin_Ellipse::CENTER_ID(), - GeomDataAPI_Point2D, /** Center point */, - firstFocus, SketchPlugin_Ellipse::FIRST_FOCUS_ID(), - GeomDataAPI_Point2D, /** Focus in positive direction of a major axis */, - secondFocus, SketchPlugin_Ellipse::SECOND_FOCUS_ID(), - GeomDataAPI_Point2D, /** Focus in negative direction of a major axis */, + INTERFACE_10(SketchPlugin_Ellipse::ID(), center, + SketchPlugin_Ellipse::CENTER_ID(), GeomDataAPI_Point2D, + /** Center point */, firstFocus, + SketchPlugin_Ellipse::FIRST_FOCUS_ID(), GeomDataAPI_Point2D, + /** Focus in positive direction of a major axis */, secondFocus, + SketchPlugin_Ellipse::SECOND_FOCUS_ID(), GeomDataAPI_Point2D, + /** Focus in negative direction of a major axis */, majorAxisNegative, SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), GeomDataAPI_Point2D, /** Start point of major axis */, majorAxisPositive, SketchPlugin_Ellipse::MAJOR_AXIS_END_ID(), @@ -81,13 +81,13 @@ public: minorAxisNegative, SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), GeomDataAPI_Point2D, /** Start point of minor axis */, minorAxisPositive, SketchPlugin_Ellipse::MINOR_AXIS_END_ID(), - GeomDataAPI_Point2D, /** End point of minor axis */, - majorRadius, SketchPlugin_Ellipse::MAJOR_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Major radius */, - minorRadius, SketchPlugin_Ellipse::MINOR_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Minor radius */, - external, SketchPlugin_Ellipse::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */) + GeomDataAPI_Point2D, /** End point of minor axis */, majorRadius, + SketchPlugin_Ellipse::MAJOR_RADIUS_ID(), + ModelAPI_AttributeDouble, /** Major radius */, minorRadius, + SketchPlugin_Ellipse::MINOR_RADIUS_ID(), + ModelAPI_AttributeDouble, /** Minor radius */, external, + SketchPlugin_Ellipse::EXTERNAL_ID(), ModelAPI_AttributeSelection, + /** External */) /// Set by center, focus and radius. SKETCHAPI_EXPORT @@ -97,17 +97,18 @@ public: /// Set by center, focus and radius. SKETCHAPI_EXPORT - void setByCenterFocusAndRadius(const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - double theMinorRadius); + void + setByCenterFocusAndRadius(const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, + double theMinorRadius); /// Set by external. SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection& theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Set by external name. SKETCHAPI_EXPORT - void setByExternalName(const std::wstring& theExternalName); + void setByExternalName(const std::wstring &theExternalName); /// Set center. SKETCHAPI_EXPORT @@ -115,7 +116,7 @@ public: /// Set center. SKETCHAPI_EXPORT - void setCenter(const std::shared_ptr& theCenter); + void setCenter(const std::shared_ptr &theCenter); /// Set focus. SKETCHAPI_EXPORT @@ -123,67 +124,69 @@ public: /// Set focus. SKETCHAPI_EXPORT - void setFocus(const std::shared_ptr& theFocus); + void setFocus(const std::shared_ptr &theFocus); /// Set radius. SKETCHAPI_EXPORT void setMinorRadius(double theRadius); /// Create construction elements (focuses, axes etc.). - /// Empty value for each parameter shows that the corresponding feature has been removed. - /// Value "aux" marks this feature as auxiliary. - /// And the name of the feature shows that it is a regular feature. - SKETCHAPI_EXPORT - std::list > construction( - const std::wstring& center = std::wstring(), - const std::wstring& firstFocus = std::wstring(), - const std::wstring& secondFocus = std::wstring(), - const std::wstring& majorAxisStart = std::wstring(), - const std::wstring& majorAxisEnd = std::wstring(), - const std::wstring& minorAxisStart = std::wstring(), - const std::wstring& minorAxisEnd = std::wstring(), - const std::wstring& majorAxis = std::wstring(), - const std::wstring& minorAxis = std::wstring()) const; + /// Empty value for each parameter shows that the corresponding feature has + /// been removed. Value "aux" marks this feature as auxiliary. And the name of + /// the feature shows that it is a regular feature. + SKETCHAPI_EXPORT + std::list> + construction(const std::wstring ¢er = std::wstring(), + const std::wstring &firstFocus = std::wstring(), + const std::wstring &secondFocus = std::wstring(), + const std::wstring &majorAxisStart = std::wstring(), + const std::wstring &majorAxisEnd = std::wstring(), + const std::wstring &minorAxisStart = std::wstring(), + const std::wstring &minorAxisEnd = std::wstring(), + const std::wstring &majorAxis = std::wstring(), + const std::wstring &minorAxis = std::wstring()) const; /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; private: /// Find all features connected with theEllipse by the internal coincidence. /// \param[in] theEllipse ellipse or elliptic arc - /// \param[in] theMajorAxis names of attributes composing a major axis of ellipse - /// \param[in] theMinorAxis names of attributes composing a minor axis of ellipse - /// \param[out] theAttrToFeature map attribute of ellipse and coincident auxiliary feature - static void collectAuxiliaryFeatures(FeaturePtr theEllipse, - const PairOfStrings& theMajorAxis, - const PairOfStrings& theMinorAxis, - std::map& theAttrToFeature); + /// \param[in] theMajorAxis names of attributes composing a major axis + /// of ellipse \param[in] theMinorAxis names of attributes composing a + /// minor axis of ellipse \param[out] theAttrToFeature map attribute of + /// ellipse and coincident auxiliary feature + static void + collectAuxiliaryFeatures(FeaturePtr theEllipse, + const PairOfStrings &theMajorAxis, + const PairOfStrings &theMinorAxis, + std::map &theAttrToFeature); /// \brief Dump the construction features (points, axes) for the ellipse. /// \param[in] theDumper dumper instance /// \param[in] theAttributes list of attributes the construction points are /// connected with, and their dump names /// \param[in] theAuxFeatures list of construction features - static void dumpConstructionEntities(ModelHighAPI_Dumper& theDumper, - const FeaturePtr& theEllipse, - const std::list& theAttributes, - const std::map& theAuxFeatures); + static void dumpConstructionEntities( + ModelHighAPI_Dumper &theDumper, const FeaturePtr &theEllipse, + const std::list &theAttributes, + const std::map &theAuxFeatures); /// \brief Create construction features for the ellipse connected /// with corresponding attribute of ellipse. - static std::list > buildConstructionEntities( - const FeaturePtr& theEllipse, - const std::list& theAttributes, - const std::wstring& theCenter, - const std::wstring& theFirstFocus, - const std::wstring& theSecondFocus, - const std::wstring& theMajorAxisStart, - const std::wstring& theMajorAxisEnd, - const std::wstring& theMinorAxisStart, - const std::wstring& theMinorAxisEnd, - const std::wstring& theMajorAxis, - const std::wstring& theMinorAxis); + static std::list> + buildConstructionEntities(const FeaturePtr &theEllipse, + const std::list &theAttributes, + const std::wstring &theCenter, + const std::wstring &theFirstFocus, + const std::wstring &theSecondFocus, + const std::wstring &theMajorAxisStart, + const std::wstring &theMajorAxisEnd, + const std::wstring &theMinorAxisStart, + const std::wstring &theMinorAxisEnd, + const std::wstring &theMajorAxis, + const std::wstring &theMinorAxis); friend class SketchAPI_EllipticArc; }; diff --git a/src/SketchAPI/SketchAPI_EllipticArc.cpp b/src/SketchAPI/SketchAPI_EllipticArc.cpp index 0cd684417..5f3f7110e 100644 --- a/src/SketchAPI/SketchAPI_EllipticArc.cpp +++ b/src/SketchAPI/SketchAPI_EllipticArc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_EllipticArc.h" @@ -30,69 +31,63 @@ #include #include - -SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr & theFeature) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_EllipticArc::SketchAPI_EllipticArc( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } -SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) - : SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_EllipticArc::SketchAPI_EllipticArc( + const std::shared_ptr &theFeature, double theCenterX, + double theCenterY, double theFocusX, double theFocusY, double theStartX, + double theStartY, double theEndX, double theEndY, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterFocusAndPoints(theCenterX, theCenterY, theFocusX, theFocusY, - theStartX, theStartY, theEndX, theEndY, theInversed); + theStartX, theStartY, theEndX, theEndY, + theInversed); } } -SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) - : SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { - setByCenterFocusAndPoints(theCenter, theFocus, theStart, theEnd, theInversed); +SketchAPI_EllipticArc::SketchAPI_EllipticArc( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { + setByCenterFocusAndPoints(theCenter, theFocus, theStart, theEnd, + theInversed); } } -SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_EllipticArc::SketchAPI_EllipticArc( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); } } -SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - const std::wstring& theExternalName) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_EllipticArc::SketchAPI_EllipticArc( + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); } } -SketchAPI_EllipticArc::~SketchAPI_EllipticArc() -{ -} +SketchAPI_EllipticArc::~SketchAPI_EllipticArc() {} -void SketchAPI_EllipticArc::setByCenterFocusAndPoints(double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) -{ - // the order of attribute initialization is reversed to avoid odd recalculation of an elliptic arc +void SketchAPI_EllipticArc::setByCenterFocusAndPoints( + double theCenterX, double theCenterY, double theFocusX, double theFocusY, + double theStartX, double theStartY, double theEndX, double theEndY, + bool theInversed) { + // the order of attribute initialization is reversed to avoid odd + // recalculation of an elliptic arc fillAttribute(theInversed, reversed()); fillAttribute(endPoint(), theEndX, theEndY); fillAttribute(startPoint(), theStartX, theStartY); @@ -103,13 +98,12 @@ void SketchAPI_EllipticArc::setByCenterFocusAndPoints(double theCenterX, double } void SketchAPI_EllipticArc::setByCenterFocusAndPoints( - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) -{ - // the order of attribute initialization is reversed to avoid odd recalculation of an elliptic arc + const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed) { + // the order of attribute initialization is reversed to avoid odd + // recalculation of an elliptic arc fillAttribute(theInversed, reversed()); fillAttribute(theEnd, endPoint()); fillAttribute(theStart, startPoint()); @@ -119,110 +113,102 @@ void SketchAPI_EllipticArc::setByCenterFocusAndPoints( execute(); } -void SketchAPI_EllipticArc::setByExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_EllipticArc::setByExternal( + const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, external()); execute(); } -void SketchAPI_EllipticArc::setByExternalName(const std::wstring & theExternalName) -{ +void SketchAPI_EllipticArc::setByExternalName( + const std::wstring &theExternalName) { fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external()); execute(); } -void SketchAPI_EllipticArc::setCenter(double theX, double theY) -{ +void SketchAPI_EllipticArc::setCenter(double theX, double theY) { fillAttribute(center(), theX, theY); execute(); } -void SketchAPI_EllipticArc::setCenter(const std::shared_ptr & theCenter) -{ +void SketchAPI_EllipticArc::setCenter( + const std::shared_ptr &theCenter) { fillAttribute(theCenter, mycenter); execute(); } -void SketchAPI_EllipticArc::setFocus(double theX, double theY) -{ +void SketchAPI_EllipticArc::setFocus(double theX, double theY) { fillAttribute(firstFocus(), theX, theY); execute(); } -void SketchAPI_EllipticArc::setFocus(const std::shared_ptr & theFocus) -{ +void SketchAPI_EllipticArc::setFocus( + const std::shared_ptr &theFocus) { fillAttribute(theFocus, myfirstFocus); execute(); } -static const std::list& ellipticArcAttrAndDumpNames() -{ +static const std::list &ellipticArcAttrAndDumpNames() { static std::list anAttributes; if (anAttributes.empty()) { anAttributes.push_back( PairOfStrings(SketchPlugin_EllipticArc::CENTER_ID(), "center")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_EllipticArc::FIRST_FOCUS_ID(), "firstFocus")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_EllipticArc::SECOND_FOCUS_ID(), "secondFocus")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), "majorAxisStart")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID(), "majorAxisEnd")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), "minorAxisStart")); - anAttributes.push_back( - PairOfStrings(SketchPlugin_EllipticArc::MINOR_AXIS_END_ID(), "minorAxisEnd")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_EllipticArc::FIRST_FOCUS_ID(), "firstFocus")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_EllipticArc::SECOND_FOCUS_ID(), "secondFocus")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), "majorAxisStart")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID(), "majorAxisEnd")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), "minorAxisStart")); + anAttributes.push_back(PairOfStrings( + SketchPlugin_EllipticArc::MINOR_AXIS_END_ID(), "minorAxisEnd")); } return anAttributes; } -std::list > SketchAPI_EllipticArc::construction( - const std::wstring& center, - const std::wstring& firstFocus, - const std::wstring& secondFocus, - const std::wstring& majorAxisStart, - const std::wstring& majorAxisEnd, - const std::wstring& minorAxisStart, - const std::wstring& minorAxisEnd, - const std::wstring& majorAxis, - const std::wstring& minorAxis) const -{ +std::list> +SketchAPI_EllipticArc::construction( + const std::wstring ¢er, const std::wstring &firstFocus, + const std::wstring &secondFocus, const std::wstring &majorAxisStart, + const std::wstring &majorAxisEnd, const std::wstring &minorAxisStart, + const std::wstring &minorAxisEnd, const std::wstring &majorAxis, + const std::wstring &minorAxis) const { FeaturePtr anEllipse = feature(); std::list anAttributes = ellipticArcAttrAndDumpNames(); // append start and end attributes for axes - anAttributes.push_back(PairOfStrings(SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), - SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID())); - anAttributes.push_back(PairOfStrings(SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), - SketchPlugin_EllipticArc::MINOR_AXIS_END_ID())); + anAttributes.push_back( + PairOfStrings(SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), + SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID())); + anAttributes.push_back( + PairOfStrings(SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), + SketchPlugin_EllipticArc::MINOR_AXIS_END_ID())); - return SketchAPI_Ellipse::buildConstructionEntities(anEllipse, anAttributes, - center, firstFocus, secondFocus, - majorAxisStart, majorAxisEnd, - minorAxisStart, minorAxisEnd, - majorAxis, minorAxis); + return SketchAPI_Ellipse::buildConstructionEntities( + anEllipse, anAttributes, center, firstFocus, secondFocus, majorAxisStart, + majorAxisEnd, minorAxisStart, minorAxisEnd, majorAxis, minorAxis); } -void SketchAPI_EllipticArc::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_EllipticArc::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // circle is external theDumper << aBase << " = " << aSketchName << ".addEllipticArc(" << anExternal << ")" << std::endl; } else { // ellipse given by center, focus and radius - theDumper << aBase << " = " << aSketchName << ".addEllipticArc(" - << center() << ", " << firstFocus() << ", " - << startPoint() << ", " << endPoint() << ", " - << reversed() << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addEllipticArc(" << center() + << ", " << firstFocus() << ", " << startPoint() << ", " + << endPoint() << ", " << reversed() << ")" << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); @@ -235,11 +221,14 @@ void SketchAPI_EllipticArc::dump(ModelHighAPI_Dumper& theDumper) const static const std::pair aMinorAxis( SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()); - SketchAPI_Ellipse::collectAuxiliaryFeatures(aBase, aMajorAxis, aMinorAxis, anAuxFeatures); + SketchAPI_Ellipse::collectAuxiliaryFeatures(aBase, aMajorAxis, aMinorAxis, + anAuxFeatures); if (!anAuxFeatures.empty()) { // a list of attributes to write features in special order - static std::list anAttributes = ellipticArcAttrAndDumpNames(); - SketchAPI_Ellipse::dumpConstructionEntities(theDumper, aBase, anAttributes, anAuxFeatures); + static std::list anAttributes = + ellipticArcAttrAndDumpNames(); + SketchAPI_Ellipse::dumpConstructionEntities(theDumper, aBase, anAttributes, + anAuxFeatures); } } diff --git a/src/SketchAPI/SketchAPI_EllipticArc.h b/src/SketchAPI/SketchAPI_EllipticArc.h index d6d8816a9..ffcf22205 100644 --- a/src/SketchAPI/SketchAPI_EllipticArc.h +++ b/src/SketchAPI/SketchAPI_EllipticArc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_EllipticArc_H_ @@ -30,72 +31,73 @@ class ModelHighAPI_Selection; /// \class SketchAPI_EllipticArc /// \ingroup CPPHighAPI /// \brief Interface for Elliptic Arc feature. -class SketchAPI_EllipticArc : public SketchAPI_SketchEntity -{ +class SketchAPI_EllipticArc : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_EllipticArc(const std::shared_ptr& theFeature); + explicit SketchAPI_EllipticArc( + const std::shared_ptr &theFeature); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed); + SketchAPI_EllipticArc(const std::shared_ptr &theFeature, + double theCenterX, double theCenterY, double theFocusX, + double theFocusY, double theStartX, double theStartY, + double theEndX, double theEndY, bool theInversed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, + SketchAPI_EllipticArc(const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed); /// Constructor with external. SKETCHAPI_EXPORT - SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theExternal); + SketchAPI_EllipticArc(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with external. SKETCHAPI_EXPORT - SketchAPI_EllipticArc(const std::shared_ptr& theFeature, - const std::wstring& theExternalName); + SketchAPI_EllipticArc(const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_EllipticArc(); - INTERFACE_13(SketchPlugin_EllipticArc::ID(), - center, SketchPlugin_EllipticArc::CENTER_ID(), - GeomDataAPI_Point2D, /** Center point */, - startPoint, SketchPlugin_EllipticArc::START_POINT_ID(), - GeomDataAPI_Point2D, /** Start point of elliptic arc */, - endPoint, SketchPlugin_EllipticArc::END_POINT_ID(), - GeomDataAPI_Point2D, /** End point of elliptic arc */, - reversed, SketchPlugin_EllipticArc::REVERSED_ID(), - ModelAPI_AttributeBoolean, /** Inversed flag */, - firstFocus, SketchPlugin_EllipticArc::FIRST_FOCUS_ID(), - GeomDataAPI_Point2D, /** Focus in positive direction of a major axis */, - secondFocus, SketchPlugin_EllipticArc::SECOND_FOCUS_ID(), - GeomDataAPI_Point2D, /** Focus in negative direction of a major axis */, - majorAxisNegative, SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), + INTERFACE_13(SketchPlugin_EllipticArc::ID(), center, + SketchPlugin_EllipticArc::CENTER_ID(), GeomDataAPI_Point2D, + /** Center point */, startPoint, + SketchPlugin_EllipticArc::START_POINT_ID(), GeomDataAPI_Point2D, + /** Start point of elliptic arc */, endPoint, + SketchPlugin_EllipticArc::END_POINT_ID(), GeomDataAPI_Point2D, + /** End point of elliptic arc */, reversed, + SketchPlugin_EllipticArc::REVERSED_ID(), + ModelAPI_AttributeBoolean, /** Inversed flag */, firstFocus, + SketchPlugin_EllipticArc::FIRST_FOCUS_ID(), GeomDataAPI_Point2D, + /** Focus in positive direction of a major axis */, secondFocus, + SketchPlugin_EllipticArc::SECOND_FOCUS_ID(), GeomDataAPI_Point2D, + /** Focus in negative direction of a major axis */, + majorAxisNegative, + SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), GeomDataAPI_Point2D, /** Start point of major axis */, majorAxisPositive, SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID(), GeomDataAPI_Point2D, /** End point of major axis */, - minorAxisNegative, SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), + minorAxisNegative, + SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), GeomDataAPI_Point2D, /** Start point of minor axis */, minorAxisPositive, SketchPlugin_EllipticArc::MINOR_AXIS_END_ID(), - GeomDataAPI_Point2D, /** End point of minor axis */, - majorRadius, SketchPlugin_EllipticArc::MAJOR_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Major radius */, - minorRadius, SketchPlugin_EllipticArc::MINOR_RADIUS_ID(), - ModelAPI_AttributeDouble, /** Minor radius */, - external, SketchPlugin_EllipticArc::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */) + GeomDataAPI_Point2D, /** End point of minor axis */, majorRadius, + SketchPlugin_EllipticArc::MAJOR_RADIUS_ID(), + ModelAPI_AttributeDouble, /** Major radius */, minorRadius, + SketchPlugin_EllipticArc::MINOR_RADIUS_ID(), + ModelAPI_AttributeDouble, /** Minor radius */, external, + SketchPlugin_EllipticArc::EXTERNAL_ID(), + ModelAPI_AttributeSelection, + /** External */) /// Set by center, focus and radius. SKETCHAPI_EXPORT @@ -107,19 +109,20 @@ public: /// Set by center, focus and radius. SKETCHAPI_EXPORT - void setByCenterFocusAndPoints(const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed); + void + setByCenterFocusAndPoints(const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + bool theInversed); /// Set by external. SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection& theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Set by external name. SKETCHAPI_EXPORT - void setByExternalName(const std::wstring& theExternalName); + void setByExternalName(const std::wstring &theExternalName); /// Set center. SKETCHAPI_EXPORT @@ -127,7 +130,7 @@ public: /// Set center. SKETCHAPI_EXPORT - void setCenter(const std::shared_ptr & theCenter); + void setCenter(const std::shared_ptr &theCenter); /// Set focus. SKETCHAPI_EXPORT @@ -135,27 +138,27 @@ public: /// Set focus. SKETCHAPI_EXPORT - void setFocus(const std::shared_ptr & theFocus); + void setFocus(const std::shared_ptr &theFocus); /// Create construction elements (focuses, axes etc.). - /// Empty value for each parameter shows that the corresponding feature has been removed. - /// Value "aux" marks this feature as auxiliary. - /// And the name of the feature shows that it is a regular feature. - SKETCHAPI_EXPORT - std::list > construction( - const std::wstring& center = std::wstring(), - const std::wstring& firstFocus = std::wstring(), - const std::wstring& secondFocus = std::wstring(), - const std::wstring& majorAxisStart = std::wstring(), - const std::wstring& majorAxisEnd = std::wstring(), - const std::wstring& minorAxisStart = std::wstring(), - const std::wstring& minorAxisEnd = std::wstring(), - const std::wstring& majorAxis = std::wstring(), - const std::wstring& minorAxis = std::wstring()) const; + /// Empty value for each parameter shows that the corresponding feature has + /// been removed. Value "aux" marks this feature as auxiliary. And the name of + /// the feature shows that it is a regular feature. + SKETCHAPI_EXPORT + std::list> + construction(const std::wstring ¢er = std::wstring(), + const std::wstring &firstFocus = std::wstring(), + const std::wstring &secondFocus = std::wstring(), + const std::wstring &majorAxisStart = std::wstring(), + const std::wstring &majorAxisEnd = std::wstring(), + const std::wstring &minorAxisStart = std::wstring(), + const std::wstring &minorAxisEnd = std::wstring(), + const std::wstring &majorAxis = std::wstring(), + const std::wstring &minorAxis = std::wstring()) const; /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; /// Pointer on Ellipse object. diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp index 6cc79abd2..ab58b63ea 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_IntersectionPoint.h" @@ -29,73 +30,68 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( - const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( - const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalEdge(theExternal); } } SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( - const std::shared_ptr & theFeature, - const std::wstring & theExternalName ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalEdgeName(theExternalName); } } -SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() -{ - -} +SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() {} //-------------------------------------------------------------------------------------- -void SketchAPI_IntersectionPoint::setByExternalEdge(const ModelHighAPI_Selection & theExternalLine) -{ +void SketchAPI_IntersectionPoint::setByExternalEdge( + const ModelHighAPI_Selection &theExternalLine) { fillAttribute(theExternalLine, externalFeature()); execute(); } -void SketchAPI_IntersectionPoint::setByExternalEdgeName(const std::wstring & theExternalLineName) -{ - fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalFeature()); +void SketchAPI_IntersectionPoint::setByExternalEdgeName( + const std::wstring &theExternalLineName) { + fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), + externalFeature()); execute(); } -void SketchAPI_IntersectionPoint::setIncludeToResult(bool theKeepResult) -{ +void SketchAPI_IntersectionPoint::setIncludeToResult(bool theKeepResult) { fillAttribute(theKeepResult, includeToResult()); execute(true); } //-------------------------------------------------------------------------------------- -std::list > -SketchAPI_IntersectionPoint::intersectionPoints() const -{ - std::list > anEntities; +std::list> +SketchAPI_IntersectionPoint::intersectionPoints() const { + std::list> anEntities; std::list anIntersections = - feature()->reflist(SketchPlugin_IntersectionPoint::INTERSECTION_POINTS_ID())->list(); + feature() + ->reflist(SketchPlugin_IntersectionPoint::INTERSECTION_POINTS_ID()) + ->list(); for (std::list::iterator anIt = anIntersections.begin(); anIt != anIntersections.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) - { - std::shared_ptr anEnt(new SketchAPI_Point(aFeature)); + if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) { + std::shared_ptr anEnt( + new SketchAPI_Point(aFeature)); anEntities.push_back(anEnt); } } @@ -105,10 +101,9 @@ SketchAPI_IntersectionPoint::intersectionPoints() const //-------------------------------------------------------------------------------------- -void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); AttributeSelectionPtr anExternal = externalFeature(); AttributeBooleanPtr isIncludeToRes = includeToResult(); @@ -119,12 +114,15 @@ void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const // Dump variables for a list of intersected points theDumper << "["; - std::list > aList = intersectionPoints(); - std::list >::const_iterator anIt = aList.begin(); + std::list> aList = + intersectionPoints(); + std::list>::const_iterator anIt = + aList.begin(); for (; anIt != aList.end(); ++anIt) { if (anIt != aList.begin()) theDumper << ", "; theDumper << (*anIt)->feature(); } - theDumper << "] = " << theDumper.name(aBase) << ".intersectionPoints()" << std::endl; + theDumper << "] = " << theDumper.name(aBase) << ".intersectionPoints()" + << std::endl; } diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.h b/src/SketchAPI/SketchAPI_IntersectionPoint.h index 7cfbe7c77..ceb234e55 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.h +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_ @@ -33,40 +34,42 @@ class ModelHighAPI_Selection; * \ingroup CPPHighAPI * \brief Interface for IntersectionPoint feature */ -class SketchAPI_IntersectionPoint : public SketchAPI_SketchEntity -{ +class SketchAPI_IntersectionPoint : public SketchAPI_SketchEntity { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_IntersectionPoint(const std::shared_ptr & theFeature); + explicit SketchAPI_IntersectionPoint( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_IntersectionPoint(const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal); + SketchAPI_IntersectionPoint( + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_IntersectionPoint(const std::shared_ptr & theFeature, - const std::wstring & theExternalName); + SketchAPI_IntersectionPoint( + const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_IntersectionPoint(); - INTERFACE_3(SketchPlugin_IntersectionPoint::ID(), - externalFeature, SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID(), - ModelAPI_AttributeSelection, /** External edge */, - external, SketchPlugin_IntersectionPoint::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */, - includeToResult, SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(), + INTERFACE_3(SketchPlugin_IntersectionPoint::ID(), externalFeature, + SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID(), + ModelAPI_AttributeSelection, /** External edge */, external, + SketchPlugin_IntersectionPoint::EXTERNAL_ID(), + ModelAPI_AttributeSelection, /** External */, includeToResult, + SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(), ModelAPI_AttributeBoolean, /** Include into result */ ) /// Set by external SKETCHAPI_EXPORT - void setByExternalEdge(const ModelHighAPI_Selection & theExternaEdge); + void setByExternalEdge(const ModelHighAPI_Selection &theExternaEdge); /// Set by external name SKETCHAPI_EXPORT - void setByExternalEdgeName(const std::wstring & theExternalEdgeName); + void setByExternalEdgeName(const std::wstring &theExternalEdgeName); /// Set flag to include projection to result or not SKETCHAPI_EXPORT @@ -74,11 +77,11 @@ public: /// Returns created intersection points SKETCHAPI_EXPORT - std::list > intersectionPoints() const; + std::list> intersectionPoints() const; /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on IntersectionPoint object diff --git a/src/SketchAPI/SketchAPI_Line.cpp b/src/SketchAPI/SketchAPI_Line.cpp index 142d1932d..e4116dd90 100644 --- a/src/SketchAPI/SketchAPI_Line.cpp +++ b/src/SketchAPI/SketchAPI_Line.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Line.h" @@ -26,62 +27,53 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_Line::SketchAPI_Line( - const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } SketchAPI_Line::SketchAPI_Line( - const std::shared_ptr & theFeature, - double theX1, double theY1, double theX2, double theY2) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, double theX1, + double theY1, double theX2, double theY2) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByCoordinates(theX1, theY1, theX2, theY2); } } SketchAPI_Line::SketchAPI_Line( - const std::shared_ptr & theFeature, - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByPoints(theStartPoint, theEndPoint); } } SketchAPI_Line::SketchAPI_Line( - const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); } } SketchAPI_Line::SketchAPI_Line( - const std::shared_ptr & theFeature, - const std::wstring & theExternalName ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); } } -SketchAPI_Line::~SketchAPI_Line() -{ - -} +SketchAPI_Line::~SketchAPI_Line() {} //-------------------------------------------------------------------------------------- -void SketchAPI_Line::setByCoordinates( - double theX1, double theY1, double theX2, double theY2) -{ +void SketchAPI_Line::setByCoordinates(double theX1, double theY1, double theX2, + double theY2) { fillAttribute(startPoint(), theX1, theY1); fillAttribute(endPoint(), theX2, theY2); @@ -89,50 +81,45 @@ void SketchAPI_Line::setByCoordinates( } void SketchAPI_Line::setByPoints( - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint) -{ + const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint) { fillAttribute(theStartPoint, startPoint()); fillAttribute(theEndPoint, endPoint()); execute(); } -void SketchAPI_Line::setByExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_Line::setByExternal(const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, external()); execute(); } -void SketchAPI_Line::setByExternalName(const std::wstring & theExternalName) -{ +void SketchAPI_Line::setByExternalName(const std::wstring &theExternalName) { fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external()); execute(); } //-------------------------------------------------------------------------------------- -void SketchAPI_Line::setStartPoint(double theX, double theY) -{ +void SketchAPI_Line::setStartPoint(double theX, double theY) { fillAttribute(startPoint(), theX, theY); execute(); } -void SketchAPI_Line::setStartPoint(const std::shared_ptr & thePoint) -{ +void SketchAPI_Line::setStartPoint( + const std::shared_ptr &thePoint) { fillAttribute(thePoint, startPoint()); execute(); } -void SketchAPI_Line::setEndPoint(double theX, double theY) -{ +void SketchAPI_Line::setEndPoint(double theX, double theY) { fillAttribute(endPoint(), theX, theY); execute(); } -void SketchAPI_Line::setEndPoint(const std::shared_ptr & thePoint) -{ +void SketchAPI_Line::setEndPoint( + const std::shared_ptr &thePoint) { fillAttribute(thePoint, endPoint()); execute(); @@ -140,22 +127,23 @@ void SketchAPI_Line::setEndPoint(const std::shared_ptr & thePoint //-------------------------------------------------------------------------------------- -void SketchAPI_Line::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Line::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // line is external - theDumper << aBase << " = " << aSketchName << ".addLine(" << anExternal << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addLine(" << anExternal + << ")" << std::endl; } else { // segment given by its points - theDumper << aBase << " = " << aSketchName << ".addLine(" - << startPoint() << ", " << endPoint() << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addLine(" << startPoint() + << ", " << endPoint() << ")" << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); diff --git a/src/SketchAPI/SketchAPI_Line.h b/src/SketchAPI/SketchAPI_Line.h index f9c0bb31f..a2facccb9 100644 --- a/src/SketchAPI/SketchAPI_Line.h +++ b/src/SketchAPI/SketchAPI_Line.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_ @@ -35,39 +36,37 @@ class ModelHighAPI_Selection; * \ingroup CPPHighAPI * \brief Interface for Line feature */ -class SketchAPI_Line : public SketchAPI_SketchEntity -{ +class SketchAPI_Line : public SketchAPI_SketchEntity { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Line(const std::shared_ptr & theFeature); + explicit SketchAPI_Line(const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Line(const std::shared_ptr & theFeature, + SketchAPI_Line(const std::shared_ptr &theFeature, double theX1, double theY1, double theX2, double theY2); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Line(const std::shared_ptr & theFeature, - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint); + SketchAPI_Line(const std::shared_ptr &theFeature, + const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Line(const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal); + SketchAPI_Line(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Line(const std::shared_ptr & theFeature, - const std::wstring & theExternalName); + SketchAPI_Line(const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Line(); - INTERFACE_3(SketchPlugin_Line::ID(), - startPoint, SketchPlugin_Line::START_ID(), - GeomDataAPI_Point2D, /** Start point */, - endPoint, SketchPlugin_Line::END_ID(), - GeomDataAPI_Point2D, /** End point */, - external, SketchPlugin_Line::EXTERNAL_ID(), + INTERFACE_3(SketchPlugin_Line::ID(), startPoint, + SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D, + /** Start point */, endPoint, SketchPlugin_Line::END_ID(), + GeomDataAPI_Point2D, /** End point */, external, + SketchPlugin_Line::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */ ) @@ -77,16 +76,16 @@ public: /// Set by points SKETCHAPI_EXPORT - void setByPoints(const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint); + void setByPoints(const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint); /// Set by external SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection & theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Set by external name SKETCHAPI_EXPORT - void setByExternalName(const std::wstring & theExternalName); + void setByExternalName(const std::wstring &theExternalName); /// Set start point SKETCHAPI_EXPORT @@ -94,7 +93,7 @@ public: /// Set start point SKETCHAPI_EXPORT - void setStartPoint(const std::shared_ptr & thePoint); + void setStartPoint(const std::shared_ptr &thePoint); /// Set end point SKETCHAPI_EXPORT @@ -102,11 +101,11 @@ public: /// Set end point SKETCHAPI_EXPORT - void setEndPoint(const std::shared_ptr & thePoint); + void setEndPoint(const std::shared_ptr &thePoint); /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Line object diff --git a/src/SketchAPI/SketchAPI_MacroArc.cpp b/src/SketchAPI/SketchAPI_MacroArc.cpp index 0685a5f38..b18c7a9d9 100644 --- a/src/SketchAPI/SketchAPI_MacroArc.cpp +++ b/src/SketchAPI/SketchAPI_MacroArc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_MacroArc.h" @@ -30,100 +31,93 @@ #include //================================================================================================ -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } //================================================================================================ -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { - setByCenterStartEnd(theCenterX, theCenterY, theStartX, - theStartY, theEndX, theEndY, theInversed); +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature, double theCenterX, + double theCenterY, double theStartX, double theStartY, double theEndX, + double theEndY, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { + setByCenterStartEnd(theCenterX, theCenterY, theStartX, theStartY, theEndX, + theEndY, theInversed); } } //================================================================================================ -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterStartEnd(theCenter, theStart, theEnd, theInversed); } } //================================================================================================ -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr& theFeature, - double theStartX, double theStartY, - double theEndX, double theEndY, - double thePassedX, double thePassedY) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature, double theStartX, + double theStartY, double theEndX, double theEndY, double thePassedX, + double thePassedY) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { - setByStartEndPassed(theStartX, theStartY, theEndX, theEndY, thePassedX, thePassedY); + setByStartEndPassed(theStartX, theStartY, theEndX, theEndY, thePassedX, + thePassedY); } } //=============================================================================================== -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - const std::shared_ptr& thePassed) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + const std::shared_ptr &thePassed) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByStartEndPassed(theStart, theEnd, thePassed); } } //================================================================================================ -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const ModelHighAPI_RefAttr& theTangentPoint, - double theEndX, double theEndY, - bool theInversed) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theTangentPoint, double theEndX, double theEndY, + bool theInversed) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByTangent(theTangentPoint, theEndX, theEndY, theInversed); } } //================================================================================================ -SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const ModelHighAPI_RefAttr& theTangentPoint, - const std::shared_ptr& theEnd, - bool theInversed) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroArc::SketchAPI_MacroArc( + const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theTangentPoint, + const std::shared_ptr &theEnd, bool theInversed) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByTangent(theTangentPoint, theEnd, theInversed); } } //================================================================================================ -SketchAPI_MacroArc::~SketchAPI_MacroArc() -{ - -} +SketchAPI_MacroArc::~SketchAPI_MacroArc() {} //================================================================================================ -void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) -{ - fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), myarcType); +void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, + double theCenterY, + double theStartX, double theStartY, + double theEndX, double theEndY, + bool theInversed) { + fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), + myarcType); fillAttribute(center(), theCenterX, theCenterY); fillAttribute(startPoint1(), theStartX, theStartY); fillAttribute(endPoint1(), theEndX, theEndY); @@ -133,12 +127,12 @@ void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, double theCenter } //================================================================================================ -void SketchAPI_MacroArc::setByCenterStartEnd(const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) -{ - fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), myarcType); +void SketchAPI_MacroArc::setByCenterStartEnd( + const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed) { + fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), + myarcType); fillAttribute(theCenter, mycenter); fillAttribute(theStart, mystartPoint1); fillAttribute(theEnd, myendPoint1); @@ -149,9 +143,9 @@ void SketchAPI_MacroArc::setByCenterStartEnd(const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - const std::shared_ptr& thePassed) -{ +void SketchAPI_MacroArc::setByStartEndPassed( + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + const std::shared_ptr &thePassed) { fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_THREE_POINTS(), myarcType); fillAttribute(theStart, mystartPoint2); fillAttribute(theEnd, myendPoint2); @@ -174,10 +168,9 @@ void SketchAPI_MacroArc::setByStartEndPassed(const std::shared_ptr& theEnd, - bool theInversed) -{ +void SketchAPI_MacroArc::setByTangent( + const ModelHighAPI_RefAttr &theTangentPoint, + const std::shared_ptr &theEnd, bool theInversed) { fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(), myarcType); fillAttribute(theTangentPoint, mytangentPoint); fillAttribute(theEnd, myendPoint3); @@ -200,11 +192,11 @@ void SketchAPI_MacroArc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoin } //================================================================================================ -void SketchAPI_MacroArc::setByTransversal(const ModelHighAPI_RefAttr& theTransversalPoint, - double theEndX, double theEndY, - bool theInversed) -{ - fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), myarcType); +void SketchAPI_MacroArc::setByTransversal( + const ModelHighAPI_RefAttr &theTransversalPoint, double theEndX, + double theEndY, bool theInversed) { + fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), + myarcType); fillAttribute(theTransversalPoint, mytransversalPoint); fillAttribute(endPoint4(), theEndX, theEndY); fillAttribute(theInversed, myreversed); @@ -213,11 +205,11 @@ void SketchAPI_MacroArc::setByTransversal(const ModelHighAPI_RefAttr& theTransve } //================================================================================================ -void SketchAPI_MacroArc::setByTransversal(const ModelHighAPI_RefAttr& theTransversalPoint, - const std::shared_ptr& theEnd, - bool theInversed) -{ - fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), myarcType); +void SketchAPI_MacroArc::setByTransversal( + const ModelHighAPI_RefAttr &theTransversalPoint, + const std::shared_ptr &theEnd, bool theInversed) { + fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), + myarcType); fillAttribute(theTransversalPoint, mytransversalPoint); fillAttribute(theEnd, myendPoint4); fillAttribute(theInversed, myreversed); diff --git a/src/SketchAPI/SketchAPI_MacroArc.h b/src/SketchAPI/SketchAPI_MacroArc.h index ca51bae8e..e28721a82 100644 --- a/src/SketchAPI/SketchAPI_MacroArc.h +++ b/src/SketchAPI/SketchAPI_MacroArc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_MacroArc_H_ @@ -33,139 +34,129 @@ class ModelHighAPI_Selection; /// \class SketchAPI_MacroArc /// \ingroup CPPHighAPI /// \brief Interface for Arc feature. -class SketchAPI_MacroArc: public SketchAPI_SketchEntity -{ +class SketchAPI_MacroArc : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_MacroArc(const std::shared_ptr& theFeature); + explicit SketchAPI_MacroArc( + const std::shared_ptr &theFeature); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroArc(const std::shared_ptr& theFeature, - double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed); + SketchAPI_MacroArc(const std::shared_ptr &theFeature, + double theCenterX, double theCenterY, double theStartX, + double theStartY, double theEndX, double theEndY, + bool theInversed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed); + SketchAPI_MacroArc(const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + bool theInversed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroArc(const std::shared_ptr& theFeature, - double theStartX, double theStartY, - double theEndX, double theEndY, - double thePassedX, double thePassedY); + SketchAPI_MacroArc(const std::shared_ptr &theFeature, + double theStartX, double theStartY, double theEndX, + double theEndY, double thePassedX, double thePassedY); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - const std::shared_ptr& thePassed); + SketchAPI_MacroArc(const std::shared_ptr &theFeature, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + const std::shared_ptr &thePassed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const ModelHighAPI_RefAttr& theTangentPoint, - double theEndX, double theEndY, - bool theInversed); + SketchAPI_MacroArc(const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theTangentPoint, + double theEndX, double theEndY, bool theInversed); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroArc(const std::shared_ptr& theFeature, - const ModelHighAPI_RefAttr& theTangentPoint, - const std::shared_ptr& theEnd, - bool theInversed); + SketchAPI_MacroArc(const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theTangentPoint, + const std::shared_ptr &theEnd, + bool theInversed); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_MacroArc(); - INTERFACE_14(SketchPlugin_MacroArc::ID(), - arcType, SketchPlugin_MacroArc::ARC_TYPE(), - ModelAPI_AttributeString, /** Arc type */, - center, SketchPlugin_MacroArc::CENTER_POINT_ID(), - GeomDataAPI_Point2D, /** Center point */, - startPoint1, SketchPlugin_MacroArc::START_POINT_1_ID(), - GeomDataAPI_Point2D, /** Start point */, - endPoint1, SketchPlugin_MacroArc::END_POINT_1_ID(), - GeomDataAPI_Point2D, /** End point */, - startPoint2, SketchPlugin_MacroArc::START_POINT_2_ID(), - GeomDataAPI_Point2D, /** Start point */, - endPoint2, SketchPlugin_MacroArc::END_POINT_2_ID(), - GeomDataAPI_Point2D, /** End point */, - passedPoint, SketchPlugin_MacroArc::PASSED_POINT_ID(), - GeomDataAPI_Point2D, /** Passed point */, - tangentPoint, SketchPlugin_MacroArc::TANGENT_POINT_ID(), - ModelAPI_AttributeRefAttr, /** Tangent point */, - endPoint3, SketchPlugin_MacroArc::END_POINT_3_ID(), - GeomDataAPI_Point2D, /** End point */, - transversalPoint, SketchPlugin_MacroArc::TRANSVERSAL_POINT_ID(), - ModelAPI_AttributeRefAttr, /** Transversal point */, - endPoint4, SketchPlugin_MacroArc::END_POINT_4_ID(), - GeomDataAPI_Point2D, /** End point */, - reversed, SketchPlugin_MacroArc::REVERSED_ID(), - ModelAPI_AttributeBoolean, /** Reversed flag */, - radius, SketchPlugin_MacroArc::RADIUS_ID(), - ModelAPI_AttributeDouble, /** Radius */, - angle, SketchPlugin_MacroArc::ANGLE_ID(), - ModelAPI_AttributeDouble, /** Angle */) + INTERFACE_14( + SketchPlugin_MacroArc::ID(), arcType, SketchPlugin_MacroArc::ARC_TYPE(), + ModelAPI_AttributeString, /** Arc type */, center, + SketchPlugin_MacroArc::CENTER_POINT_ID(), GeomDataAPI_Point2D, + /** Center point */, startPoint1, + SketchPlugin_MacroArc::START_POINT_1_ID(), GeomDataAPI_Point2D, + /** Start point */, endPoint1, SketchPlugin_MacroArc::END_POINT_1_ID(), + GeomDataAPI_Point2D, /** End point */, startPoint2, + SketchPlugin_MacroArc::START_POINT_2_ID(), GeomDataAPI_Point2D, + /** Start point */, endPoint2, SketchPlugin_MacroArc::END_POINT_2_ID(), + GeomDataAPI_Point2D, /** End point */, passedPoint, + SketchPlugin_MacroArc::PASSED_POINT_ID(), GeomDataAPI_Point2D, + /** Passed point */, tangentPoint, + SketchPlugin_MacroArc::TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr, + /** Tangent point */, endPoint3, SketchPlugin_MacroArc::END_POINT_3_ID(), + GeomDataAPI_Point2D, /** End point */, transversalPoint, + SketchPlugin_MacroArc::TRANSVERSAL_POINT_ID(), ModelAPI_AttributeRefAttr, + /** Transversal point */, endPoint4, + SketchPlugin_MacroArc::END_POINT_4_ID(), GeomDataAPI_Point2D, + /** End point */, reversed, SketchPlugin_MacroArc::REVERSED_ID(), + ModelAPI_AttributeBoolean, /** Reversed flag */, radius, + SketchPlugin_MacroArc::RADIUS_ID(), ModelAPI_AttributeDouble, + /** Radius */, angle, SketchPlugin_MacroArc::ANGLE_ID(), + ModelAPI_AttributeDouble, + /** Angle */) /// Set by center and start, end point. SKETCHAPI_EXPORT void setByCenterStartEnd(double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed); + double theStartX, double theStartY, double theEndX, + double theEndY, bool theInversed); /// Set by center and start, end point. SKETCHAPI_EXPORT - void setByCenterStartEnd(const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, + void setByCenterStartEnd(const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed); /// Set by start, end and passed points. SKETCHAPI_EXPORT - void setByStartEndPassed(double theStartX, double theStartY, - double theEndX, double theEndY, - double thePassedX, double thePassedY); + void setByStartEndPassed(double theStartX, double theStartY, double theEndX, + double theEndY, double thePassedX, + double thePassedY); /// Set by start, end and passed points. SKETCHAPI_EXPORT - void setByStartEndPassed(const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - const std::shared_ptr& thePassed); + void setByStartEndPassed(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + const std::shared_ptr &thePassed); /// Set by tangent and end point. SKETCHAPI_EXPORT - void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint, - double theEndX, double theEndY, - bool theInversed); + void setByTangent(const ModelHighAPI_RefAttr &theTangentPoint, double theEndX, + double theEndY, bool theInversed); /// Set by tangent and end point. SKETCHAPI_EXPORT - void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint, - const std::shared_ptr& theEnd, + void setByTangent(const ModelHighAPI_RefAttr &theTangentPoint, + const std::shared_ptr &theEnd, bool theInversed); /// Set by tangent and end point. SKETCHAPI_EXPORT - void setByTransversal(const ModelHighAPI_RefAttr& theTransversalPoint, - double theEndX, double theEndY, - bool theInversed); + void setByTransversal(const ModelHighAPI_RefAttr &theTransversalPoint, + double theEndX, double theEndY, bool theInversed); /// Set by tangent and end point. SKETCHAPI_EXPORT - void setByTransversal(const ModelHighAPI_RefAttr& theTransversalPoint, - const std::shared_ptr& theEnd, + void setByTransversal(const ModelHighAPI_RefAttr &theTransversalPoint, + const std::shared_ptr &theEnd, bool theInversed); }; diff --git a/src/SketchAPI/SketchAPI_MacroCircle.cpp b/src/SketchAPI/SketchAPI_MacroCircle.cpp index f5e459a40..685fc465a 100644 --- a/src/SketchAPI/SketchAPI_MacroCircle.cpp +++ b/src/SketchAPI/SketchAPI_MacroCircle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_MacroCircle.h" @@ -27,72 +28,66 @@ #include //================================================================================================== -SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroCircle::SketchAPI_MacroCircle( + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } //================================================================================================== -SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - double theCenterX, - double theCenterY, - double thePassedX, - double thePassedY) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_MacroCircle::SketchAPI_MacroCircle( + const std::shared_ptr &theFeature, double theCenterX, + double theCenterY, double thePassedX, double thePassedY) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY); } } //================================================================================================== -SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenterPoint, - const std::shared_ptr& thePassedPoint) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_MacroCircle::SketchAPI_MacroCircle( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenterPoint, + const std::shared_ptr &thePassedPoint) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByCenterAndPassedPoints(theCenterPoint, thePassedPoint); } } //================================================================================================== -SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_MacroCircle::SketchAPI_MacroCircle( + const std::shared_ptr &theFeature, double theX1, + double theY1, double theX2, double theY2, double theX3, double theY3) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3); } } //================================================================================================== -SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -: SketchAPI_SketchEntity(theFeature) -{ - if(initialize()) { +SketchAPI_MacroCircle::SketchAPI_MacroCircle( + const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3) + : SketchAPI_SketchEntity(theFeature) { + if (initialize()) { setByThreePoints(thePoint1, thePoint2, thePoint3); } } //================================================================================================== -SketchAPI_MacroCircle::~SketchAPI_MacroCircle() -{ -} +SketchAPI_MacroCircle::~SketchAPI_MacroCircle() {} //================================================================================================== void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX, double theCenterY, double thePassedX, - double thePassedY) -{ - fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + double thePassedY) { + fillAttribute( + SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), + mycircleType); fillAttribute(centerPoint(), theCenterX, theCenterY); fillAttribute(passedPoint(), thePassedX, thePassedY); @@ -101,10 +96,11 @@ void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX, //================================================================================================== void SketchAPI_MacroCircle::setByCenterAndPassedPoints( - const std::shared_ptr& theCenterPoint, - const std::shared_ptr& thePassedPoint) -{ - fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + const std::shared_ptr &theCenterPoint, + const std::shared_ptr &thePassedPoint) { + fillAttribute( + SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), + mycircleType); fillAttribute(theCenterPoint, mycenterPoint); fillAttribute(thePassedPoint, mypassedPoint); @@ -114,9 +110,9 @@ void SketchAPI_MacroCircle::setByCenterAndPassedPoints( //================================================================================================== void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1, double theX2, double theY2, - double theX3, double theY3) -{ - fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + double theX3, double theY3) { + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), + mycircleType); fillAttribute(firstPoint(), theX1, theY1); fillAttribute(secondPoint(), theX2, theY2); fillAttribute(thirdPoint(), theX3, theY3); @@ -125,11 +121,12 @@ void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1, } //================================================================================================== -void SketchAPI_MacroCircle::setByThreePoints(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -{ - fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); +void SketchAPI_MacroCircle::setByThreePoints( + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3) { + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), + mycircleType); fillAttribute(thePoint1, myfirstPoint); fillAttribute(thePoint2, mysecondPoint); fillAttribute(thePoint3, mythirdPoint); diff --git a/src/SketchAPI/SketchAPI_MacroCircle.h b/src/SketchAPI/SketchAPI_MacroCircle.h index 725edeacb..130ff19d9 100644 --- a/src/SketchAPI/SketchAPI_MacroCircle.h +++ b/src/SketchAPI/SketchAPI_MacroCircle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_MacroCircle_H_ @@ -30,58 +31,55 @@ class ModelHighAPI_Selection; /// \class SketchAPI_MacroCircle /// \ingroup CPPHighAPI /// \brief Interface for Circle feature. -class SketchAPI_MacroCircle: public SketchAPI_SketchEntity -{ +class SketchAPI_MacroCircle : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_MacroCircle(const std::shared_ptr& theFeature); + explicit SketchAPI_MacroCircle( + const std::shared_ptr &theFeature); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - double theCenterX, - double theCenterY, - double thePassedX, + SketchAPI_MacroCircle(const std::shared_ptr &theFeature, + double theCenterX, double theCenterY, double thePassedX, double thePassedY); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenterPoint, - const std::shared_ptr& thePassedPoint); + SketchAPI_MacroCircle(const std::shared_ptr &theFeature, + const std::shared_ptr &theCenterPoint, + const std::shared_ptr &thePassedPoint); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - double theX1, double theY1, - double theX2, double theY2, + SketchAPI_MacroCircle(const std::shared_ptr &theFeature, + double theX1, double theY1, double theX2, double theY2, double theX3, double theY3); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroCircle(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3); + SketchAPI_MacroCircle(const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_MacroCircle(); - INTERFACE_6(SketchPlugin_MacroCircle::ID(), - circleType, SketchPlugin_MacroCircle::CIRCLE_TYPE(), - ModelAPI_AttributeString, /** Circle type */, - centerPoint, SketchPlugin_MacroCircle::CENTER_POINT_ID(), - GeomDataAPI_Point2D, /** Center point */, - passedPoint, SketchPlugin_MacroCircle::PASSED_POINT_ID(), - GeomDataAPI_Point2D, /** Passed point */, - firstPoint, SketchPlugin_MacroCircle::FIRST_POINT_ID(), - GeomDataAPI_Point2D, /** First point */, - secondPoint, SketchPlugin_MacroCircle::SECOND_POINT_ID(), - GeomDataAPI_Point2D, /** Second point */, - thirdPoint, SketchPlugin_MacroCircle::THIRD_POINT_ID(), - GeomDataAPI_Point2D, /** Third point */) + INTERFACE_6(SketchPlugin_MacroCircle::ID(), circleType, + SketchPlugin_MacroCircle::CIRCLE_TYPE(), ModelAPI_AttributeString, + /** Circle type */, centerPoint, + SketchPlugin_MacroCircle::CENTER_POINT_ID(), GeomDataAPI_Point2D, + /** Center point */, passedPoint, + SketchPlugin_MacroCircle::PASSED_POINT_ID(), GeomDataAPI_Point2D, + /** Passed point */, firstPoint, + SketchPlugin_MacroCircle::FIRST_POINT_ID(), GeomDataAPI_Point2D, + /** First point */, secondPoint, + SketchPlugin_MacroCircle::SECOND_POINT_ID(), GeomDataAPI_Point2D, + /** Second point */, thirdPoint, + SketchPlugin_MacroCircle::THIRD_POINT_ID(), GeomDataAPI_Point2D, + /** Third point */) private: /// Set by center and passed points. @@ -89,18 +87,18 @@ private: double thePassedX, double thePassedY); /// Set by center and passed points. - void setByCenterAndPassedPoints(const std::shared_ptr& theCenterPoint, - const std::shared_ptr& thePassedPoint); + void setByCenterAndPassedPoints( + const std::shared_ptr &theCenterPoint, + const std::shared_ptr &thePassedPoint); /// Set by three points. - void setByThreePoints(double theX1, double theY1, - double theX2, double theY2, + void setByThreePoints(double theX1, double theY1, double theX2, double theY2, double theX3, double theY3); /// Set by three points. - void setByThreePoints(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3); + void setByThreePoints(const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3); }; /// Pointer on Circle object. diff --git a/src/SketchAPI/SketchAPI_MacroEllipse.cpp b/src/SketchAPI/SketchAPI_MacroEllipse.cpp index 9cc6a2bd1..a5aadfc1b 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipse.cpp +++ b/src/SketchAPI/SketchAPI_MacroEllipse.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_MacroEllipse.h" @@ -28,25 +29,22 @@ #include -#define POINT_ATTR(x) (std::dynamic_pointer_cast(feature()->attribute((x)))) -#define POINT_REF(x) (feature()->refattr((x))) +#define POINT_ATTR(x) \ + (std::dynamic_pointer_cast(feature()->attribute((x)))) +#define POINT_REF(x) (feature()->refattr((x))) - -SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - bool callInitialize) -: SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroEllipse::SketchAPI_MacroEllipse( + const std::shared_ptr &theFeature, bool callInitialize) + : SketchAPI_SketchEntity(theFeature) { if (callInitialize && initialize()) storeSketch(theFeature); } -SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3, - bool byCenter) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroEllipse::SketchAPI_MacroEllipse( + const std::shared_ptr &theFeature, double theX1, + double theY1, double theX2, double theY2, double theX3, double theY3, + bool byCenter) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { static const ModelHighAPI_RefAttr DUMMY_REF; @@ -55,64 +53,58 @@ SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3, - bool byCenter) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroEllipse::SketchAPI_MacroEllipse( + const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3, bool byCenter) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { static const ModelHighAPI_RefAttr DUMMY_REF; if (byCenter) - setByCenterAndPassedPoints(thePoint1, DUMMY_REF, thePoint2, DUMMY_REF, thePoint3, DUMMY_REF); + setByCenterAndPassedPoints(thePoint1, DUMMY_REF, thePoint2, DUMMY_REF, + thePoint3, DUMMY_REF); else { - setByMajorAxisAndPassedPoint(thePoint1, DUMMY_REF, - thePoint2, DUMMY_REF, + setByMajorAxisAndPassedPoint(thePoint1, DUMMY_REF, thePoint2, DUMMY_REF, thePoint3, DUMMY_REF); } } } -SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const ModelHighAPI_RefAttr& thePoint1Ref, - const std::shared_ptr& thePoint2, - const ModelHighAPI_RefAttr& thePoint2Ref, - const std::shared_ptr& thePoint3, - const ModelHighAPI_RefAttr& thePoint3Ref, - bool byCenter) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_MacroEllipse::SketchAPI_MacroEllipse( + const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint1, + const ModelHighAPI_RefAttr &thePoint1Ref, + const std::shared_ptr &thePoint2, + const ModelHighAPI_RefAttr &thePoint2Ref, + const std::shared_ptr &thePoint3, + const ModelHighAPI_RefAttr &thePoint3Ref, bool byCenter) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { if (byCenter) { - setByCenterAndPassedPoints(thePoint1, thePoint1Ref, - thePoint2, thePoint2Ref, - thePoint3, thePoint3Ref); - } - else { - setByMajorAxisAndPassedPoint(thePoint1, thePoint1Ref, - thePoint2, thePoint2Ref, - thePoint3, thePoint3Ref); + setByCenterAndPassedPoints(thePoint1, thePoint1Ref, thePoint2, + thePoint2Ref, thePoint3, thePoint3Ref); + } else { + setByMajorAxisAndPassedPoint(thePoint1, thePoint1Ref, thePoint2, + thePoint2Ref, thePoint3, thePoint3Ref); } } } -SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse() -{ -} +SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse() {} -static void fillAttribute(const std::shared_ptr& thePoint, - const ModelHighAPI_RefAttr& thePointRef, +static void fillAttribute(const std::shared_ptr &thePoint, + const ModelHighAPI_RefAttr &thePointRef, std::shared_ptr thePointAttr, - AttributeRefAttrPtr thePointRefAttr) -{ + AttributeRefAttrPtr thePointRefAttr) { GeomPnt2dPtr aPoint = thePoint; if (!thePointRef.isEmpty()) { fillAttribute(thePointRef, thePointRefAttr); @@ -125,26 +117,32 @@ static void fillAttribute(const std::shared_ptr& thePoint, } void SketchAPI_MacroEllipse::setByCenterAndPassedPoints( - const std::shared_ptr& theCenter, - const ModelHighAPI_RefAttr& theCenterRef, - const std::shared_ptr& theMajorAxisPoint, - const ModelHighAPI_RefAttr& theMajorAxisPointRef, - const std::shared_ptr& thePassedPoint, - const ModelHighAPI_RefAttr& thePassedPointRef) -{ - fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_CENTER_AXIS_POINT(), myellipseType); - - AttributePoint2DPtr aCenterAttr = POINT_ATTR(SketchPlugin_MacroEllipse::CENTER_POINT_ID()); - AttributePoint2DPtr aMajorAxisAttr = POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_POINT_ID()); - AttributePoint2DPtr aPassedAttr = POINT_ATTR(SketchPlugin_MacroEllipse::PASSED_POINT_ID()); - - AttributeRefAttrPtr aCenterRef = POINT_REF(SketchPlugin_MacroEllipse::CENTER_POINT_REF_ID()); + const std::shared_ptr &theCenter, + const ModelHighAPI_RefAttr &theCenterRef, + const std::shared_ptr &theMajorAxisPoint, + const ModelHighAPI_RefAttr &theMajorAxisPointRef, + const std::shared_ptr &thePassedPoint, + const ModelHighAPI_RefAttr &thePassedPointRef) { + fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_CENTER_AXIS_POINT(), + myellipseType); + + AttributePoint2DPtr aCenterAttr = + POINT_ATTR(SketchPlugin_MacroEllipse::CENTER_POINT_ID()); + AttributePoint2DPtr aMajorAxisAttr = + POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_POINT_ID()); + AttributePoint2DPtr aPassedAttr = + POINT_ATTR(SketchPlugin_MacroEllipse::PASSED_POINT_ID()); + + AttributeRefAttrPtr aCenterRef = + POINT_REF(SketchPlugin_MacroEllipse::CENTER_POINT_REF_ID()); AttributeRefAttrPtr aMajorAxisRef = POINT_REF(SketchPlugin_MacroEllipse::MAJOR_AXIS_POINT_REF_ID()); - AttributeRefAttrPtr aPassedRef = POINT_REF(SketchPlugin_MacroEllipse::PASSED_POINT_REF_ID()); + AttributeRefAttrPtr aPassedRef = + POINT_REF(SketchPlugin_MacroEllipse::PASSED_POINT_REF_ID()); fillAttribute(theCenter, theCenterRef, aCenterAttr, aCenterRef); - fillAttribute(theMajorAxisPoint, theMajorAxisPointRef, aMajorAxisAttr, aMajorAxisRef); + fillAttribute(theMajorAxisPoint, theMajorAxisPointRef, aMajorAxisAttr, + aMajorAxisRef); fillAttribute(thePassedPoint, thePassedPointRef, aPassedAttr, aPassedRef); storeSketch(feature()); @@ -152,119 +150,113 @@ void SketchAPI_MacroEllipse::setByCenterAndPassedPoints( } void SketchAPI_MacroEllipse::setByMajorAxisAndPassedPoint( - const std::shared_ptr& theMajorAxisStart, - const ModelHighAPI_RefAttr& theMajorAxisStartRef, - const std::shared_ptr& theMajorAxisEnd, - const ModelHighAPI_RefAttr& theMajorAxisEndRef, - const std::shared_ptr& thePassedPoint, - const ModelHighAPI_RefAttr& thePassedPointRef) -{ - fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_AXIS_AND_POINT(), myellipseType); + const std::shared_ptr &theMajorAxisStart, + const ModelHighAPI_RefAttr &theMajorAxisStartRef, + const std::shared_ptr &theMajorAxisEnd, + const ModelHighAPI_RefAttr &theMajorAxisEndRef, + const std::shared_ptr &thePassedPoint, + const ModelHighAPI_RefAttr &thePassedPointRef) { + fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_AXIS_AND_POINT(), + myellipseType); AttributePoint2DPtr aMajorAxisStartAttr = POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_START_ID()); AttributePoint2DPtr aMajorAxisEndAttr = POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_END_ID()); - AttributePoint2DPtr aPassedAttr = POINT_ATTR(SketchPlugin_MacroEllipse::PASSED_POINT_1_ID()); + AttributePoint2DPtr aPassedAttr = + POINT_ATTR(SketchPlugin_MacroEllipse::PASSED_POINT_1_ID()); AttributeRefAttrPtr aMajorAxisStartRef = POINT_REF(SketchPlugin_MacroEllipse::MAJOR_AXIS_START_REF_ID()); AttributeRefAttrPtr aMajorAxisEndRef = POINT_REF(SketchPlugin_MacroEllipse::MAJOR_AXIS_END_REF_ID()); - AttributeRefAttrPtr aPassedRef = POINT_REF(SketchPlugin_MacroEllipse::PASSED_POINT_1_REF_ID()); + AttributeRefAttrPtr aPassedRef = + POINT_REF(SketchPlugin_MacroEllipse::PASSED_POINT_1_REF_ID()); - fillAttribute(theMajorAxisStart, theMajorAxisStartRef, aMajorAxisStartAttr, aMajorAxisStartRef); - fillAttribute(theMajorAxisEnd, theMajorAxisEndRef, aMajorAxisEndAttr, aMajorAxisEndRef); + fillAttribute(theMajorAxisStart, theMajorAxisStartRef, aMajorAxisStartAttr, + aMajorAxisStartRef); + fillAttribute(theMajorAxisEnd, theMajorAxisEndRef, aMajorAxisEndAttr, + aMajorAxisEndRef); fillAttribute(thePassedPoint, thePassedPointRef, aPassedAttr, aPassedRef); storeSketch(feature()); execute(); } -void SketchAPI_MacroEllipse::storeSketch(const FeaturePtr& theFeature) -{ - const std::set& aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) +void SketchAPI_MacroEllipse::storeSketch(const FeaturePtr &theFeature) { + const std::set &aRefs = theFeature->data()->refsToMe(); + for (std::set::const_iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) { - mySketch = std::dynamic_pointer_cast((*anIt)->owner()); + mySketch = std::dynamic_pointer_cast( + (*anIt)->owner()); break; } } -std::shared_ptr SketchAPI_MacroEllipse::center() -{ +std::shared_ptr SketchAPI_MacroEllipse::center() { if (!myCenter) collectAuxiliary(); return myCenter; } -std::shared_ptr SketchAPI_MacroEllipse::focus1() -{ +std::shared_ptr SketchAPI_MacroEllipse::focus1() { if (!myFocus1) collectAuxiliary(); return myFocus1; } -std::shared_ptr SketchAPI_MacroEllipse::focus2() -{ +std::shared_ptr SketchAPI_MacroEllipse::focus2() { if (!myFocus2) collectAuxiliary(); return myFocus2; } -std::shared_ptr SketchAPI_MacroEllipse::majorAxisStart() -{ +std::shared_ptr SketchAPI_MacroEllipse::majorAxisStart() { if (!myMajorAxisStart) collectAuxiliary(); return myMajorAxisStart; } -std::shared_ptr SketchAPI_MacroEllipse::majorAxisEnd() -{ +std::shared_ptr SketchAPI_MacroEllipse::majorAxisEnd() { if (!myMajorAxisEnd) collectAuxiliary(); return myMajorAxisEnd; } -std::shared_ptr SketchAPI_MacroEllipse::minorAxisStart() -{ +std::shared_ptr SketchAPI_MacroEllipse::minorAxisStart() { if (!myMinorAxisStart) collectAuxiliary(); return myMinorAxisStart; } -std::shared_ptr SketchAPI_MacroEllipse::minorAxisEnd() -{ +std::shared_ptr SketchAPI_MacroEllipse::minorAxisEnd() { if (!myMinorAxisEnd) collectAuxiliary(); return myMinorAxisEnd; } -std::shared_ptr SketchAPI_MacroEllipse::majorAxis() -{ +std::shared_ptr SketchAPI_MacroEllipse::majorAxis() { if (!myMajorAxis) collectAuxiliary(); return myMajorAxis; } -std::shared_ptr SketchAPI_MacroEllipse::minorAxis() -{ +std::shared_ptr SketchAPI_MacroEllipse::minorAxis() { if (!myMinorAxis) collectAuxiliary(); return myMinorAxis; } -void SketchAPI_MacroEllipse::collectAuxiliary() -{ +void SketchAPI_MacroEllipse::collectAuxiliary() { // collect auxiliary features int aNbSubs = mySketch->numberOfSubs(); - std::shared_ptr* anAuxPoint[] = { - &myCenter, &myFocus1, &myFocus2, - &myMajorAxisStart, &myMajorAxisEnd, - &myMinorAxisStart, &myMinorAxisEnd - }; - std::shared_ptr* anAuxLine[] = {&myMajorAxis, &myMinorAxis}; - for (int aPtInd = 7, aLinInd = 2; (aPtInd > 0 || aLinInd > 0) && aNbSubs >= 0; ) { + std::shared_ptr *anAuxPoint[] = { + &myCenter, &myFocus1, &myFocus2, &myMajorAxisStart, + &myMajorAxisEnd, &myMinorAxisStart, &myMinorAxisEnd}; + std::shared_ptr *anAuxLine[] = {&myMajorAxis, &myMinorAxis}; + for (int aPtInd = 7, aLinInd = 2; + (aPtInd > 0 || aLinInd > 0) && aNbSubs >= 0;) { FeaturePtr aCurFeature = mySketch->subFeature(--aNbSubs); if (aPtInd > 0 && aCurFeature->getKind() == SketchPlugin_Point::ID()) anAuxPoint[--aPtInd]->reset(new SketchAPI_Point(aCurFeature)); diff --git a/src/SketchAPI/SketchAPI_MacroEllipse.h b/src/SketchAPI/SketchAPI_MacroEllipse.h index 5823213ec..cdd3bdde6 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipse.h +++ b/src/SketchAPI/SketchAPI_MacroEllipse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_MacroEllipse_H_ @@ -32,48 +33,47 @@ class SketchAPI_Line; /// \class SketchAPI_MacroEllipse /// \ingroup CPPHighAPI /// \brief Interface for Ellipse feature. -class SketchAPI_MacroEllipse: public SketchAPI_SketchEntity -{ +class SketchAPI_MacroEllipse : public SketchAPI_SketchEntity { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - bool callInitialize = true); + explicit SketchAPI_MacroEllipse( + const std::shared_ptr &theFeature, + bool callInitialize = true); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3, - bool byCenter = true); + SketchAPI_MacroEllipse(const std::shared_ptr &theFeature, + double theX1, double theY1, double theX2, double theY2, + double theX3, double theY3, bool byCenter = true); /// Constructor with values. SKETCHAPI_EXPORT - SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3, + SketchAPI_MacroEllipse(const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3, bool byCenter = true); /// Constructor with values and/or references. SKETCHAPI_EXPORT - SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const ModelHighAPI_RefAttr& thePoint1Ref, - const std::shared_ptr& thePoint2, - const ModelHighAPI_RefAttr& thePoint2Ref, - const std::shared_ptr& thePoint3, - const ModelHighAPI_RefAttr& thePoint3Ref, + SketchAPI_MacroEllipse(const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint1, + const ModelHighAPI_RefAttr &thePoint1Ref, + const std::shared_ptr &thePoint2, + const ModelHighAPI_RefAttr &thePoint2Ref, + const std::shared_ptr &thePoint3, + const ModelHighAPI_RefAttr &thePoint3Ref, bool byCenter = true); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_MacroEllipse(); - INTERFACE_1(SketchPlugin_MacroEllipse::ID(), - ellipseType, SketchPlugin_MacroEllipse::ELLIPSE_TYPE(), - ModelAPI_AttributeString, /** Ellipse type */) + INTERFACE_1(SketchPlugin_MacroEllipse::ID(), ellipseType, + SketchPlugin_MacroEllipse::ELLIPSE_TYPE(), + ModelAPI_AttributeString, + /** Ellipse type */) /// Return created auxiliary center point SKETCHAPI_EXPORT std::shared_ptr center(); @@ -96,23 +96,25 @@ public: protected: // find a parent sketch - void storeSketch(const std::shared_ptr& theFeature); + void storeSketch(const std::shared_ptr &theFeature); private: /// Set flag of creation by center, major semi-axis and passed point. - void setByCenterAndPassedPoints(const std::shared_ptr& theCenter, - const ModelHighAPI_RefAttr& theCenterRef, - const std::shared_ptr& theMajorAxisPoint, - const ModelHighAPI_RefAttr& theMajorAxisPointRef, - const std::shared_ptr& thePassedPoint, - const ModelHighAPI_RefAttr& thePassedPointRef); + void setByCenterAndPassedPoints( + const std::shared_ptr &theCenter, + const ModelHighAPI_RefAttr &theCenterRef, + const std::shared_ptr &theMajorAxisPoint, + const ModelHighAPI_RefAttr &theMajorAxisPointRef, + const std::shared_ptr &thePassedPoint, + const ModelHighAPI_RefAttr &thePassedPointRef); /// Set flag of creation by major axis and passed point. - void setByMajorAxisAndPassedPoint(const std::shared_ptr& theMajorAxisStart, - const ModelHighAPI_RefAttr& theMajorAxisStartRef, - const std::shared_ptr& theMajorAxisEnd, - const ModelHighAPI_RefAttr& theMajorAxisEndRef, - const std::shared_ptr& thePassedPoint, - const ModelHighAPI_RefAttr& thePassedPointRef); + void setByMajorAxisAndPassedPoint( + const std::shared_ptr &theMajorAxisStart, + const ModelHighAPI_RefAttr &theMajorAxisStartRef, + const std::shared_ptr &theMajorAxisEnd, + const ModelHighAPI_RefAttr &theMajorAxisEndRef, + const std::shared_ptr &thePassedPoint, + const ModelHighAPI_RefAttr &thePassedPointRef); /// Collect auxiliary features void collectAuxiliary(); @@ -126,8 +128,8 @@ private: std::shared_ptr myMajorAxisEnd; std::shared_ptr myMinorAxisStart; std::shared_ptr myMinorAxisEnd; - std::shared_ptr myMajorAxis; - std::shared_ptr myMinorAxis; + std::shared_ptr myMajorAxis; + std::shared_ptr myMinorAxis; }; /// Pointer on Circle object. diff --git a/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp b/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp index 540430aaf..e974a12ea 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp +++ b/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_MacroEllipticArc.h" @@ -26,27 +27,32 @@ #include -#define CENTER_POINT (std::dynamic_pointer_cast( \ - feature()->attribute(SketchPlugin_MacroEllipticArc::CENTER_ID()))) -#define MAJOR_AXIS_POSITIVE (std::dynamic_pointer_cast( \ - feature()->attribute(SketchPlugin_MacroEllipticArc::MAJOR_AXIS_POINT_ID()))) -#define START_POINT (std::dynamic_pointer_cast( \ - feature()->attribute(SketchPlugin_MacroEllipticArc::START_POINT_ID()))) -#define END_POINT (std::dynamic_pointer_cast( \ - feature()->attribute(SketchPlugin_MacroEllipticArc::END_POINT_ID()))) +#define CENTER_POINT \ + (std::dynamic_pointer_cast( \ + feature()->attribute(SketchPlugin_MacroEllipticArc::CENTER_ID()))) +#define MAJOR_AXIS_POSITIVE \ + (std::dynamic_pointer_cast(feature()->attribute( \ + SketchPlugin_MacroEllipticArc::MAJOR_AXIS_POINT_ID()))) +#define START_POINT \ + (std::dynamic_pointer_cast( \ + feature()->attribute(SketchPlugin_MacroEllipticArc::START_POINT_ID()))) +#define END_POINT \ + (std::dynamic_pointer_cast( \ + feature()->attribute(SketchPlugin_MacroEllipticArc::END_POINT_ID()))) -#define CENTER_POINT_REF (feature()->refattr(SketchPlugin_MacroEllipticArc::CENTER_REF_ID())) -#define MAJOR_AXIS_POSITIVE_REF (feature()->refattr( \ - SketchPlugin_MacroEllipticArc::MAJOR_AXIS_POINT_REF_ID())) -#define START_POINT_REF (feature()->refattr(SketchPlugin_MacroEllipticArc::START_POINT_REF_ID())) -#define END_POINT_REF (feature()->refattr(SketchPlugin_MacroEllipticArc::END_POINT_REF_ID())) +#define CENTER_POINT_REF \ + (feature()->refattr(SketchPlugin_MacroEllipticArc::CENTER_REF_ID())) +#define MAJOR_AXIS_POSITIVE_REF \ + (feature()->refattr(SketchPlugin_MacroEllipticArc::MAJOR_AXIS_POINT_REF_ID())) +#define START_POINT_REF \ + (feature()->refattr(SketchPlugin_MacroEllipticArc::START_POINT_REF_ID())) +#define END_POINT_REF \ + (feature()->refattr(SketchPlugin_MacroEllipticArc::END_POINT_REF_ID())) - -static void fillAttribute(const std::shared_ptr& thePoint, - const ModelHighAPI_RefAttr& thePointRef, +static void fillAttribute(const std::shared_ptr &thePoint, + const ModelHighAPI_RefAttr &thePointRef, std::shared_ptr thePointAttr, - AttributeRefAttrPtr thePointRefAttr) -{ + AttributeRefAttrPtr thePointRefAttr) { GeomPnt2dPtr aPoint = thePoint; if (!thePointRef.isEmpty()) { fillAttribute(thePointRef, thePointRefAttr); @@ -58,29 +64,25 @@ static void fillAttribute(const std::shared_ptr& thePoint, fillAttribute(aPoint, thePointAttr); } -SketchAPI_MacroEllipticArc::SketchAPI_MacroEllipticArc(const FeaturePtr& theFeature) - : SketchAPI_MacroEllipse(theFeature, false) -{ -} +SketchAPI_MacroEllipticArc::SketchAPI_MacroEllipticArc( + const FeaturePtr &theFeature) + : SketchAPI_MacroEllipse(theFeature, false) {} SketchAPI_MacroEllipticArc::SketchAPI_MacroEllipticArc( - const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const ModelHighAPI_RefAttr& theCenterRef, - const std::shared_ptr& theMajorAxisPoint, - const ModelHighAPI_RefAttr& theMajorAxisPointRef, - const std::shared_ptr& theArcStart, - const ModelHighAPI_RefAttr& theArcStartRef, - const std::shared_ptr& theArcEnd, - const ModelHighAPI_RefAttr& theArcEndRef, - const bool theReversed) - : SketchAPI_MacroEllipse(theFeature, false) -{ + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const ModelHighAPI_RefAttr &theCenterRef, + const std::shared_ptr &theMajorAxisPoint, + const ModelHighAPI_RefAttr &theMajorAxisPointRef, + const std::shared_ptr &theArcStart, + const ModelHighAPI_RefAttr &theArcStartRef, + const std::shared_ptr &theArcEnd, + const ModelHighAPI_RefAttr &theArcEndRef, const bool theReversed) + : SketchAPI_MacroEllipse(theFeature, false) { if (initialize()) { - fillAttribute(theCenter, theCenterRef, - CENTER_POINT, CENTER_POINT_REF); - fillAttribute(theMajorAxisPoint, theMajorAxisPointRef, - MAJOR_AXIS_POSITIVE, MAJOR_AXIS_POSITIVE_REF); + fillAttribute(theCenter, theCenterRef, CENTER_POINT, CENTER_POINT_REF); + fillAttribute(theMajorAxisPoint, theMajorAxisPointRef, MAJOR_AXIS_POSITIVE, + MAJOR_AXIS_POSITIVE_REF); fillAttribute(theArcStart, theArcStartRef, START_POINT, START_POINT_REF); fillAttribute(theArcEnd, theArcEndRef, END_POINT, END_POINT_REF); @@ -91,6 +93,4 @@ SketchAPI_MacroEllipticArc::SketchAPI_MacroEllipticArc( } } -SketchAPI_MacroEllipticArc::~SketchAPI_MacroEllipticArc() -{ -} +SketchAPI_MacroEllipticArc::~SketchAPI_MacroEllipticArc() {} diff --git a/src/SketchAPI/SketchAPI_MacroEllipticArc.h b/src/SketchAPI/SketchAPI_MacroEllipticArc.h index 4a2f7eac4..9616e1b5a 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipticArc.h +++ b/src/SketchAPI/SketchAPI_MacroEllipticArc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchAPI_MacroEllipticArc_H_ @@ -28,37 +29,38 @@ /// \class SketchAPI_MacroEllipticArc /// \ingroup CPPHighAPI /// \brief Interface for Elliptic Arc feature. -class SketchAPI_MacroEllipticArc: public SketchAPI_MacroEllipse -{ +class SketchAPI_MacroEllipticArc : public SketchAPI_MacroEllipse { public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_MacroEllipticArc(const std::shared_ptr& theFeature); + explicit SketchAPI_MacroEllipticArc( + const std::shared_ptr &theFeature); /// Constructor with values and/or references. SKETCHAPI_EXPORT - SketchAPI_MacroEllipticArc(const std::shared_ptr& theFeature, - const std::shared_ptr& theCenter, - const ModelHighAPI_RefAttr& theCenterRef, - const std::shared_ptr& theMajorAxisPoint, - const ModelHighAPI_RefAttr& theMajorAxisPointRef, - const std::shared_ptr& theArcStart, - const ModelHighAPI_RefAttr& theArcStartRef, - const std::shared_ptr& theArcEnd, - const ModelHighAPI_RefAttr& theArcEndRef, - const bool theReversed); + SketchAPI_MacroEllipticArc( + const std::shared_ptr &theFeature, + const std::shared_ptr &theCenter, + const ModelHighAPI_RefAttr &theCenterRef, + const std::shared_ptr &theMajorAxisPoint, + const ModelHighAPI_RefAttr &theMajorAxisPointRef, + const std::shared_ptr &theArcStart, + const ModelHighAPI_RefAttr &theArcStartRef, + const std::shared_ptr &theArcEnd, + const ModelHighAPI_RefAttr &theArcEndRef, const bool theReversed); /// Destructor. SKETCHAPI_EXPORT virtual ~SketchAPI_MacroEllipticArc(); - INTERFACE_3(SketchPlugin_MacroEllipticArc::ID(), - startPoint, SketchPlugin_MacroEllipticArc::START_POINT_ID(), - GeomDataAPI_Point2D, /** Start point of elliptic arc */, - endPoint, SketchPlugin_MacroEllipticArc::END_POINT_ID(), - GeomDataAPI_Point2D, /** End point of elliptic arc */, - reversed, SketchPlugin_MacroEllipticArc::REVERSED_ID(), - ModelAPI_AttributeBoolean, /** Reversed flag for elliptic arc*/) + INTERFACE_3(SketchPlugin_MacroEllipticArc::ID(), startPoint, + SketchPlugin_MacroEllipticArc::START_POINT_ID(), + GeomDataAPI_Point2D, /** Start point of elliptic arc */, endPoint, + SketchPlugin_MacroEllipticArc::END_POINT_ID(), + GeomDataAPI_Point2D, /** End point of elliptic arc */, reversed, + SketchPlugin_MacroEllipticArc::REVERSED_ID(), + ModelAPI_AttributeBoolean, + /** Reversed flag for elliptic arc*/) }; /// Pointer on Elliptic Arc object. diff --git a/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp b/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp index 3ec3a3610..30d48f55f 100644 --- a/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp +++ b/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_MacroMiddlePoint.h" @@ -26,30 +27,32 @@ #include SketchAPI_MacroMiddlePoint::SketchAPI_MacroMiddlePoint( - const std::shared_ptr & theFeature) -: SketchAPI_Point(theFeature) -{ - ConstraintPtr aConstraint = std::dynamic_pointer_cast(theFeature); + const std::shared_ptr &theFeature) + : SketchAPI_Point(theFeature) { + ConstraintPtr aConstraint = + std::dynamic_pointer_cast(theFeature); if (aConstraint) initialize(); } -SketchAPI_MacroMiddlePoint::SketchAPI_MacroMiddlePoint(const std::shared_ptr& theFeature, - const ModelHighAPI_RefAttr& theLine, const std::shared_ptr& thePoint) - : SketchAPI_Point(theFeature, thePoint) -{ +SketchAPI_MacroMiddlePoint::SketchAPI_MacroMiddlePoint( + const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theLine, + const std::shared_ptr &thePoint) + : SketchAPI_Point(theFeature, thePoint) { createConstraint(theLine); } -void SketchAPI_MacroMiddlePoint::createConstraint(const ModelHighAPI_RefAttr& theLine) -{ +void SketchAPI_MacroMiddlePoint::createConstraint( + const ModelHighAPI_RefAttr &theLine) { // Find sketch CompositeFeaturePtr aSketch; - const std::set& aRefs = feature()->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) - if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) - { - aSketch = std::dynamic_pointer_cast((*anIt)->owner()); + const std::set &aRefs = feature()->data()->refsToMe(); + for (std::set::const_iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) + if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) { + aSketch = std::dynamic_pointer_cast( + (*anIt)->owner()); break; } if (!aSketch) @@ -57,15 +60,22 @@ void SketchAPI_MacroMiddlePoint::createConstraint(const ModelHighAPI_RefAttr& th // Create middle constraint for line and poiunt std::shared_ptr aConstrFeature = - aSketch->addFeature(SketchPlugin_ConstraintMiddle::ID()); - aConstrFeature->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE())->setValue(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE()); - aConstrFeature->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(theLine.object()); - aConstrFeature->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(coordinates()); - std::dynamic_pointer_cast(aConstrFeature->attribute(SketchPlugin_ConstraintMiddle::POINT_REF_ID()))->setValue(coordinates()->x(), coordinates()->y()); + aSketch->addFeature(SketchPlugin_ConstraintMiddle::ID()); + aConstrFeature->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE()) + ->setValue(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE()); + aConstrFeature->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(theLine.object()); + aConstrFeature->refattr(SketchPlugin_Constraint::ENTITY_B()) + ->setAttr(coordinates()); + std::dynamic_pointer_cast( + aConstrFeature->attribute(SketchPlugin_ConstraintMiddle::POINT_REF_ID())) + ->setValue(coordinates()->x(), coordinates()->y()); aConstrFeature->execute(); feature()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue(true); - feature()->reference(SketchPlugin_SketchEntity::PARENT_ID())->setValue(aConstrFeature); + feature() + ->reference(SketchPlugin_SketchEntity::PARENT_ID()) + ->setValue(aConstrFeature); feature()->execute(); } diff --git a/src/SketchAPI/SketchAPI_MacroMiddlePoint.h b/src/SketchAPI/SketchAPI_MacroMiddlePoint.h index 2e747dff0..3634d3e67 100644 --- a/src/SketchAPI/SketchAPI_MacroMiddlePoint.h +++ b/src/SketchAPI/SketchAPI_MacroMiddlePoint.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_MACRO_MIDDLEPOINT_H_ @@ -26,33 +27,32 @@ class ModelHighAPI_RefAttr; - /**\class SketchAPI_MacroMiddlePoint * \ingroup CPPHighAPI * \brief Interface for Middle Point feature */ -class SketchAPI_MacroMiddlePoint : public SketchAPI_Point -{ +class SketchAPI_MacroMiddlePoint : public SketchAPI_Point { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_MacroMiddlePoint(const std::shared_ptr & theFeature); + explicit SketchAPI_MacroMiddlePoint( + const std::shared_ptr &theFeature); /// Constructor with line and middle point coordinates SKETCHAPI_EXPORT - SketchAPI_MacroMiddlePoint(const std::shared_ptr& theFeature, - const ModelHighAPI_RefAttr& theLine, - const std::shared_ptr& thePoint); + SketchAPI_MacroMiddlePoint( + const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theLine, + const std::shared_ptr &thePoint); - static std::string ID() - { + static std::string ID() { static const std::string MY_SKETCH_CONSTRAINT_ID = "MacroConstraintMiddle"; return MY_SKETCH_CONSTRAINT_ID; } virtual std::string getID() { return ID(); } protected: - void createConstraint(const ModelHighAPI_RefAttr& theLine); + void createConstraint(const ModelHighAPI_RefAttr &theLine); }; #endif diff --git a/src/SketchAPI/SketchAPI_Mirror.cpp b/src/SketchAPI/SketchAPI_Mirror.cpp index 1709dc79c..ce4a0714f 100644 --- a/src/SketchAPI/SketchAPI_Mirror.cpp +++ b/src/SketchAPI/SketchAPI_Mirror.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Mirror.h" @@ -25,36 +26,32 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_Mirror::SketchAPI_Mirror( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } SketchAPI_Mirror::SketchAPI_Mirror( - const std::shared_ptr & theFeature, - const ModelHighAPI_RefAttr & theMirrorLine, - const std::list > & theObjects) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theMirrorLine, + const std::list> &theObjects) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theMirrorLine, mirrorLine()); setMirrorList(theObjects); } } -SketchAPI_Mirror::~SketchAPI_Mirror() -{ -} +SketchAPI_Mirror::~SketchAPI_Mirror() {} -void SketchAPI_Mirror::setMirrorList(const std::list >& theObjects) -{ +void SketchAPI_Mirror::setMirrorList( + const std::list> &theObjects) { fillAttribute(theObjects, mirrorList()); execute(); } -std::list > SketchAPI_Mirror::mirrored() const -{ +std::list> +SketchAPI_Mirror::mirrored() const { std::list aList = mirroredObjects()->list(); std::list anIntermediate; std::list::const_iterator anIt = aList.begin(); @@ -67,48 +64,50 @@ std::list > SketchAPI_Mirror::mirrored() //-------------------------------------------------------------------------------------- -void SketchAPI_Mirror::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Mirror::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); AttributeRefAttrPtr aMirrorLine = mirrorLine(); AttributeRefListPtr aMirrorObjects = mirrorList(); - // Check all attributes are already dumped. If not, store the constraint as postponed. + // Check all attributes are already dumped. If not, store the constraint as + // postponed. size_t aFirstNotDumped = theDumper.indexOfFirstNotDumped(aMirrorObjects); if (!theDumper.isDumped(aMirrorLine) || aFirstNotDumped == 0) { theDumper.postpone(aBase); return; } - - // the number of dumped aMirrorObjects is not changed, no need to dump anything + // the number of dumped aMirrorObjects is not changed, no need to dump + // anything static std::map aNbDumpedArguments; - std::map::iterator aFound = aNbDumpedArguments.find(aBase); + std::map::iterator aFound = + aNbDumpedArguments.find(aBase); if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) { theDumper.postpone(aBase); return; - } - else + } else aNbDumpedArguments[aBase] = aFirstNotDumped; if (theDumper.isDumped(aBase)) { - // the feature is already dumped, but it was postponed, because of some arguments - // were not dumped yet, thus, it is necessary to update the list of rotated objects + // the feature is already dumped, but it was postponed, because of some + // arguments were not dumped yet, thus, it is necessary to update the list + // of rotated objects theDumper << "\n### Update " << aBase->getKind() << std::endl; - theDumper << aBase << ".setMirrorList(" << aMirrorObjects << ")" << std::endl; - } - else { + theDumper << aBase << ".setMirrorList(" << aMirrorObjects << ")" + << std::endl; + } else { // the feature is not dumped yet, make the full dump - theDumper << aBase << " = " << aSketchName << ".addMirror(" << aMirrorLine << ", " - << aMirrorObjects << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addMirror(" << aMirrorLine + << ", " << aMirrorObjects << ")" << std::endl; } // Dump variables for a list of mirrored features theDumper << "["; - std::list > aList = mirrored(); - std::list >::const_iterator anIt = aList.begin(); + std::list> aList = mirrored(); + std::list>::const_iterator anIt = + aList.begin(); for (size_t anIndex = 0; anIndex < aFirstNotDumped; ++anIndex, ++anIt) { if (anIt != aList.begin()) theDumper << ", "; @@ -126,17 +125,19 @@ void SketchAPI_Mirror::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aFeature = ModelAPI_Feature::feature(*aMIt); if (!aFeature) continue; - bool aBaseAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aBaseAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); aFeature = (*anIt)->feature(); - bool aFeatAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aFeatAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); if (aFeatAux != aBaseAux) theDumper << theDumper.name((*anIt)->feature(), false) - << ".setAuxiliary(" << aFeatAux << ")" < & theFeature); + explicit SketchAPI_Mirror( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Mirror(const std::shared_ptr & theFeature, - const ModelHighAPI_RefAttr & theMirrorLine, - const std::list > & theObjects); + SketchAPI_Mirror( + const std::shared_ptr &theFeature, + const ModelHighAPI_RefAttr &theMirrorLine, + const std::list> &theObjects); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Mirror(); - INTERFACE_4(SketchPlugin_ConstraintMirror::ID(), - mirrorLine, SketchPlugin_ConstraintMirror::ENTITY_A(), - ModelAPI_AttributeRefAttr, /** Mirror line */, - mirrorList, SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), - ModelAPI_AttributeRefList, /** Mirror list */, - referenceObjects, SketchPlugin_ConstraintMirror::ENTITY_B(), + INTERFACE_4(SketchPlugin_ConstraintMirror::ID(), mirrorLine, + SketchPlugin_ConstraintMirror::ENTITY_A(), + ModelAPI_AttributeRefAttr, /** Mirror line */, mirrorList, + SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), + ModelAPI_AttributeRefList, /** Mirror list */, referenceObjects, + SketchPlugin_ConstraintMirror::ENTITY_B(), ModelAPI_AttributeRefList, /** Reference objects */, mirroredObjects, SketchPlugin_ConstraintMirror::ENTITY_C(), ModelAPI_AttributeRefList, /** Mirrored objects */ @@ -66,14 +68,15 @@ public: /// Set list of original objects SKETCHAPI_EXPORT - void setMirrorList(const std::list >& theObjects); + void + setMirrorList(const std::list> &theObjects); /// List of mirrored objects SKETCHAPI_EXPORT - std::list > mirrored() const; + std::list> mirrored() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Mirror object diff --git a/src/SketchAPI/SketchAPI_Offset.cpp b/src/SketchAPI/SketchAPI_Offset.cpp index 6f8088f70..16cc17c0c 100644 --- a/src/SketchAPI/SketchAPI_Offset.cpp +++ b/src/SketchAPI/SketchAPI_Offset.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Offset.h" @@ -25,20 +26,18 @@ #include //-------------------------------------------------------------------------------------- -SketchAPI_Offset::SketchAPI_Offset (const std::shared_ptr & theFeature) - : ModelHighAPI_Interface(theFeature) -{ +SketchAPI_Offset::SketchAPI_Offset( + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } -SketchAPI_Offset::SketchAPI_Offset (const std::shared_ptr & theFeature, - const std::list > & theObjects, - const ModelHighAPI_Double & theOffsetValue, - const bool theIsReversed, - const std::string & theJointType, - const bool theIsApprox) - : ModelHighAPI_Interface(theFeature) -{ +SketchAPI_Offset::SketchAPI_Offset( + const std::shared_ptr &theFeature, + const std::list> &theObjects, + const ModelHighAPI_Double &theOffsetValue, const bool theIsReversed, + const std::string &theJointType, const bool theIsApprox) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theObjects, edgesList()); fillAttribute(theOffsetValue, value()); @@ -50,13 +49,12 @@ SketchAPI_Offset::SketchAPI_Offset (const std::shared_ptr & th } } -SketchAPI_Offset::~SketchAPI_Offset() -{ -} +SketchAPI_Offset::~SketchAPI_Offset() {} -std::list > SketchAPI_Offset::offset() const -{ - std::list aList = feature()->reflist(SketchPlugin_Constraint::ENTITY_B())->list(); +std::list> +SketchAPI_Offset::offset() const { + std::list aList = + feature()->reflist(SketchPlugin_Constraint::ENTITY_B())->list(); std::list anIntermediate; std::list::const_iterator anIt = aList.begin(); for (; anIt != aList.end(); ++anIt) { @@ -68,10 +66,9 @@ std::list > SketchAPI_Offset::offset() c //-------------------------------------------------------------------------------------- -void SketchAPI_Offset::dump (ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Offset::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); AttributeRefListPtr aOffsetObjects = edgesList(); AttributeDoublePtr aValue = value(); @@ -79,19 +76,22 @@ void SketchAPI_Offset::dump (ModelHighAPI_Dumper& theDumper) const AttributeStringPtr aJoint = joint(); AttributeBooleanPtr anApprox = approx(); - // Check all attributes are already dumped. If not, store the feature as postponed. + // Check all attributes are already dumped. If not, store the feature as + // postponed. if (!theDumper.isDumped(aOffsetObjects)) { theDumper.postpone(aBase); return; } - theDumper << aBase << " = " << aSketchName << ".addOffset(" << aOffsetObjects << ", " - << aValue << ", " << aReversed << ", " << aJoint << ", " << anApprox << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addOffset(" << aOffsetObjects + << ", " << aValue << ", " << aReversed << ", " << aJoint << ", " + << anApprox << ")" << std::endl; // Dump variables for a list of created features theDumper << "["; - std::list > aList = offset(); - std::list >::const_iterator anIt = aList.begin(); + std::list> aList = offset(); + std::list>::const_iterator anIt = + aList.begin(); for (; anIt != aList.end(); ++anIt) { if (anIt != aList.begin()) theDumper << ", "; @@ -102,9 +102,10 @@ void SketchAPI_Offset::dump (ModelHighAPI_Dumper& theDumper) const // Set necessary "auxiliary" flag for created features for (anIt = aList.begin(); anIt != aList.end(); ++anIt) { FeaturePtr aFeature = (*anIt)->feature(); - bool aFeatAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aFeatAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); if (aFeatAux) - theDumper << theDumper.name((*anIt)->feature(), false) - << ".setAuxiliary(" << aFeatAux << ")" <feature(), false) << ".setAuxiliary(" + << aFeatAux << ")" << std::endl; } } diff --git a/src/SketchAPI/SketchAPI_Offset.h b/src/SketchAPI/SketchAPI_Offset.h index ca87685df..7b184e14a 100644 --- a/src/SketchAPI/SketchAPI_Offset.h +++ b/src/SketchAPI/SketchAPI_Offset.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_OFFSET_H_ @@ -39,20 +40,22 @@ class ModelHighAPI_Double; * \ingroup CPPHighAPI * \brief Interface for Offset feature */ -class SketchAPI_Offset : public ModelHighAPI_Interface -{ +class SketchAPI_Offset : public ModelHighAPI_Interface { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Offset(const std::shared_ptr & theFeature); + explicit SketchAPI_Offset( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Offset(const std::shared_ptr & theFeature, - const std::list > & theObjects, - const ModelHighAPI_Double & theOffsetValue, - const bool theIsReversed = false, - const std::string & theJointType = SketchPlugin_Offset::JOINT_KEEP_DISTANCE(), - const bool theIsApprox = false); + SketchAPI_Offset( + const std::shared_ptr &theFeature, + const std::list> &theObjects, + const ModelHighAPI_Double &theOffsetValue, + const bool theIsReversed = false, + const std::string &theJointType = + SketchPlugin_Offset::JOINT_KEEP_DISTANCE(), + const bool theIsApprox = false); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Offset(); @@ -62,25 +65,25 @@ public: edgesList, SketchPlugin_Offset::EDGES_ID(), ModelAPI_AttributeRefList, /** Offset edges list */, - value, SketchPlugin_Offset::VALUE_ID(), - ModelAPI_AttributeDouble, /** Value */, + value, SketchPlugin_Offset::VALUE_ID(), ModelAPI_AttributeDouble, + /** Value */, reversed, SketchPlugin_Offset::REVERSED_ID(), ModelAPI_AttributeBoolean, /** Negative value */, - joint, SketchPlugin_Offset::JOINT_ID(), - ModelAPI_AttributeString, /** Joint type */, + joint, SketchPlugin_Offset::JOINT_ID(), ModelAPI_AttributeString, + /** Joint type */, approx, SketchPlugin_Offset::APPROX_ID(), ModelAPI_AttributeBoolean, /** Negative value */ - ) + ) /// List of created objects SKETCHAPI_EXPORT - std::list > offset() const; + std::list> offset() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Offset object diff --git a/src/SketchAPI/SketchAPI_Point.cpp b/src/SketchAPI/SketchAPI_Point.cpp index 4427459cf..0589901b2 100644 --- a/src/SketchAPI/SketchAPI_Point.cpp +++ b/src/SketchAPI/SketchAPI_Point.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Point.h" @@ -26,83 +27,70 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_Point::SketchAPI_Point( - const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } SketchAPI_Point::SketchAPI_Point( - const std::shared_ptr & theFeature, - double theX, double theY) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, double theX, + double theY) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setCoordinates(theX, theY); } } SketchAPI_Point::SketchAPI_Point( - const std::shared_ptr & theFeature, - const std::shared_ptr & thePoint) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setCoordinates(thePoint); } } SketchAPI_Point::SketchAPI_Point( - const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); } } SketchAPI_Point::SketchAPI_Point( - const std::shared_ptr & theFeature, - const std::wstring & theExternalName ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const std::wstring &theExternalName) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); } } -SketchAPI_Point::~SketchAPI_Point() -{ - -} +SketchAPI_Point::~SketchAPI_Point() {} //-------------------------------------------------------------------------------------- -void SketchAPI_Point::setCoordinates( - double theX, double theY) -{ +void SketchAPI_Point::setCoordinates(double theX, double theY) { fillAttribute(coordinates(), theX, theY); execute(); } void SketchAPI_Point::setCoordinates( - const std::shared_ptr & thePoint) -{ + const std::shared_ptr &thePoint) { fillAttribute(thePoint, coordinates()); execute(); } -void SketchAPI_Point::setByExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_Point::setByExternal(const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, external()); execute(); } -void SketchAPI_Point::setByExternalName(const std::wstring & theExternalName) -{ +void SketchAPI_Point::setByExternalName(const std::wstring &theExternalName) { fillAttribute(ModelHighAPI_Selection("VERTEX", theExternalName), external()); execute(); @@ -110,22 +98,24 @@ void SketchAPI_Point::setByExternalName(const std::wstring & theExternalName) //-------------------------------------------------------------------------------------- -void SketchAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Point::dump(ModelHighAPI_Dumper &theDumper) const { if (isCopy()) return; // no need to dump copied feature FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->context()) { // point is external - theDumper << aBase << " = " << aSketchName << ".addPoint(" << anExternal << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addPoint(" << anExternal + << ")" << std::endl; } else { // point given by coordinates std::shared_ptr aPoint = coordinates(); - theDumper << aBase << " = " << aSketchName << ".addPoint(" << aPoint << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addPoint(" << aPoint << ")" + << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); diff --git a/src/SketchAPI/SketchAPI_Point.h b/src/SketchAPI/SketchAPI_Point.h index 6d5ab0e02..a6dd9e45b 100644 --- a/src/SketchAPI/SketchAPI_Point.h +++ b/src/SketchAPI/SketchAPI_Point.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_POINT_H_ @@ -35,36 +36,35 @@ class ModelHighAPI_Selection; * \ingroup CPPHighAPI * \brief Interface for Point feature */ -class SketchAPI_Point : public SketchAPI_SketchEntity -{ +class SketchAPI_Point : public SketchAPI_SketchEntity { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Point(const std::shared_ptr & theFeature); + explicit SketchAPI_Point(const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Point(const std::shared_ptr & theFeature, - double theX, double theY); + SketchAPI_Point(const std::shared_ptr &theFeature, + double theX, double theY); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Point(const std::shared_ptr & theFeature, - const std::shared_ptr & thePoint); + SketchAPI_Point(const std::shared_ptr &theFeature, + const std::shared_ptr &thePoint); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Point(const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal); + SketchAPI_Point(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Point(const std::shared_ptr & theFeature, - const std::wstring & theExternalName); + SketchAPI_Point(const std::shared_ptr &theFeature, + const std::wstring &theExternalName); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Point(); - INTERFACE_2(SketchPlugin_Point::ID(), - coordinates, SketchPlugin_Point::COORD_ID(), - GeomDataAPI_Point2D, /** Point coordinates */, - external, SketchPlugin_Point::EXTERNAL_ID(), + INTERFACE_2(SketchPlugin_Point::ID(), coordinates, + SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D, + /** Point coordinates */, external, + SketchPlugin_Point::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */ ) @@ -74,19 +74,19 @@ public: /// Set by points SKETCHAPI_EXPORT - void setCoordinates(const std::shared_ptr & thePoint); + void setCoordinates(const std::shared_ptr &thePoint); /// Set by external SKETCHAPI_EXPORT - void setByExternal(const ModelHighAPI_Selection & theExternal); + void setByExternal(const ModelHighAPI_Selection &theExternal); /// Set by external name SKETCHAPI_EXPORT - void setByExternalName(const std::wstring & theExternalName); + void setByExternalName(const std::wstring &theExternalName); /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Point object diff --git a/src/SketchAPI/SketchAPI_Projection.cpp b/src/SketchAPI/SketchAPI_Projection.cpp index f2dac81a3..366bc4834 100644 --- a/src/SketchAPI/SketchAPI_Projection.cpp +++ b/src/SketchAPI/SketchAPI_Projection.cpp @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Projection.h" -#include #include #include #include #include #include +#include #include #include @@ -40,58 +41,55 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_Projection::SketchAPI_Projection( - const std::shared_ptr & theFeature) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } SketchAPI_Projection::SketchAPI_Projection( - const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternalFeature ) -: SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternalFeature) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setExternalFeature(theExternalFeature); } } -SketchAPI_Projection::~SketchAPI_Projection() -{ - -} +SketchAPI_Projection::~SketchAPI_Projection() {} //-------------------------------------------------------------------------------------- -void SketchAPI_Projection::setExternalFeature(const ModelHighAPI_Selection & theExternalFeature) -{ +void SketchAPI_Projection::setExternalFeature( + const ModelHighAPI_Selection &theExternalFeature) { fillAttribute(theExternalFeature, externalFeature()); execute(true); } -void SketchAPI_Projection::setIncludeToResult(bool theKeepResult) -{ +void SketchAPI_Projection::setIncludeToResult(bool theKeepResult) { fillAttribute(theKeepResult, includeToResult()); execute(true); } -void SketchAPI_Projection::setKeepReferenceToOriginal(bool theKeepRefToOriginal) -{ +void SketchAPI_Projection::setKeepReferenceToOriginal( + bool theKeepRefToOriginal) { // the Fixed constraint should be assigned explicitly - fillAttribute(false, feature()->boolean(SketchPlugin_Projection::MAKE_FIXED())); - fillAttribute(theKeepRefToOriginal ? "true" : "false", - feature()->string(SketchPlugin_Projection::KEEP_REFERENCE_ID())); + fillAttribute(false, + feature()->boolean(SketchPlugin_Projection::MAKE_FIXED())); + fillAttribute( + theKeepRefToOriginal ? "true" : "false", + feature()->string(SketchPlugin_Projection::KEEP_REFERENCE_ID())); execute(true); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Projection::createdFeature() const -{ +std::shared_ptr +SketchAPI_Projection::createdFeature() const { AttributeRefAttrPtr aProjectedRefAttr = projectedFeature(); - FeaturePtr aProjectedFeature = ModelAPI_Feature::feature(aProjectedRefAttr->object()); + FeaturePtr aProjectedFeature = + ModelAPI_Feature::feature(aProjectedRefAttr->object()); std::shared_ptr anEntity; - if(!aProjectedFeature.get()) { + if (!aProjectedFeature.get()) { return anEntity; } @@ -117,21 +115,21 @@ std::shared_ptr SketchAPI_Projection::createdFeature() c //-------------------------------------------------------------------------------------- -void SketchAPI_Projection::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Projection::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); AttributeSelectionPtr anExternal = externalFeature(); AttributeBooleanPtr isIncludeToRes = includeToResult(); - theDumper << aBase << " = " << aSketchName << ".addProjection(" - << anExternal << ", " << isIncludeToRes << ")" << std::endl; + theDumper << aBase << " = " << aSketchName << ".addProjection(" << anExternal + << ", " << isIncludeToRes << ")" << std::endl; // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); // Dump created line feature AttributeRefAttrPtr aProjectedRefAttr = projectedFeature(); - FeaturePtr aProjectedFeature = ModelAPI_Feature::feature(aProjectedRefAttr->object()); - theDumper << aProjectedFeature << " = " - << theDumper.name(aBase) << ".createdFeature()" << std::endl; + FeaturePtr aProjectedFeature = + ModelAPI_Feature::feature(aProjectedRefAttr->object()); + theDumper << aProjectedFeature << " = " << theDumper.name(aBase) + << ".createdFeature()" << std::endl; } diff --git a/src/SketchAPI/SketchAPI_Projection.h b/src/SketchAPI/SketchAPI_Projection.h index dc46c1a90..cb2edbf63 100644 --- a/src/SketchAPI/SketchAPI_Projection.h +++ b/src/SketchAPI/SketchAPI_Projection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_ @@ -33,34 +34,34 @@ class ModelHighAPI_Selection; * \ingroup CPPHighAPI * \brief Interface for Projection feature */ -class SketchAPI_Projection : public SketchAPI_SketchEntity -{ +class SketchAPI_Projection : public SketchAPI_SketchEntity { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Projection(const std::shared_ptr & theFeature); + explicit SketchAPI_Projection( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Projection(const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternalFeature); + SketchAPI_Projection(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternalFeature); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Projection(); - INTERFACE_4(SketchPlugin_Projection::ID(), - externalFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), + INTERFACE_4(SketchPlugin_Projection::ID(), externalFeature, + SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection, /** External feature */, projectedFeature, SketchPlugin_Projection::PROJECTED_FEATURE_ID(), - ModelAPI_AttributeRefAttr, /** Projected feature */, - external, SketchPlugin_Projection::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */, - includeToResult, SketchPlugin_Projection::INCLUDE_INTO_RESULT(), + ModelAPI_AttributeRefAttr, /** Projected feature */, external, + SketchPlugin_Projection::EXTERNAL_ID(), + ModelAPI_AttributeSelection, /** External */, includeToResult, + SketchPlugin_Projection::INCLUDE_INTO_RESULT(), ModelAPI_AttributeBoolean, /** Include into result */ ) /// Set external feature SKETCHAPI_EXPORT - void setExternalFeature(const ModelHighAPI_Selection & theExternalLine); + void setExternalFeature(const ModelHighAPI_Selection &theExternalLine); /// Set flag to include projection to result or not SKETCHAPI_EXPORT @@ -76,7 +77,7 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Projection object diff --git a/src/SketchAPI/SketchAPI_Rectangle.cpp b/src/SketchAPI/SketchAPI_Rectangle.cpp index bf7e3d44b..28a66b738 100644 --- a/src/SketchAPI/SketchAPI_Rectangle.cpp +++ b/src/SketchAPI/SketchAPI_Rectangle.cpp @@ -14,61 +14,58 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Rectangle.h" //-------------------------------------------------------------------------------------- #include //-------------------------------------------------------------------------------------- +#include #include #include -#include //-------------------------------------------------------------------------------------- SketchAPI_Rectangle::SketchAPI_Rectangle( - const std::shared_ptr & theFeature) - : SketchAPI_SketchEntity(theFeature) -{ + const std::shared_ptr &theFeature) + : SketchAPI_SketchEntity(theFeature) { initialize(); } -SketchAPI_Rectangle::SketchAPI_Rectangle(const std::shared_ptr & theFeature, - double theX1, double theY1, double theX2, double theY2) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Rectangle::SketchAPI_Rectangle( + const std::shared_ptr &theFeature, double theX1, + double theY1, double theX2, double theY2) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByCoordinates(theX1, theY1, theX2, theY2); } } -SketchAPI_Rectangle::SketchAPI_Rectangle(const std::shared_ptr & theFeature, - const std::shared_ptr & theFirstPoint, - const std::shared_ptr & theEndPoint) - : SketchAPI_SketchEntity(theFeature) -{ +SketchAPI_Rectangle::SketchAPI_Rectangle( + const std::shared_ptr &theFeature, + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theEndPoint) + : SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByPoints(theFirstPoint, theEndPoint); } } -SketchAPI_Rectangle::~SketchAPI_Rectangle() -{ -} +SketchAPI_Rectangle::~SketchAPI_Rectangle() {} //-------------------------------------------------------------------------------------- -void SketchAPI_Rectangle::setByCoordinates( - double theX1, double theY1, double theX2, double theY2) -{ +void SketchAPI_Rectangle::setByCoordinates(double theX1, double theY1, + double theX2, double theY2) { fillAttribute("RectangleTypeByCorners", type()); fillAttribute(startPoint(), theX1, theY1); fillAttribute(endPoint(), theX2, theY2); execute(); } -void SketchAPI_Rectangle::setByPoints(const std::shared_ptr & theFirstPoint, - const std::shared_ptr & theSecondPoint) -{ +void SketchAPI_Rectangle::setByPoints( + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint) { fillAttribute("RectangleTypeByCorners", type()); fillAttribute(theFirstPoint, startPoint()); fillAttribute(theSecondPoint, endPoint()); @@ -77,8 +74,8 @@ void SketchAPI_Rectangle::setByPoints(const std::shared_ptr & the //-------------------------------------------------------------------------------------- -std::list > SketchAPI_Rectangle::lines() const -{ +std::list> +SketchAPI_Rectangle::lines() const { std::list aFeatures; std::list aList = linesList()->list(); std::list::const_iterator anIt = aList.begin(); diff --git a/src/SketchAPI/SketchAPI_Rectangle.h b/src/SketchAPI/SketchAPI_Rectangle.h index ba8f9962a..0fab92813 100644 --- a/src/SketchAPI/SketchAPI_Rectangle.h +++ b/src/SketchAPI/SketchAPI_Rectangle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_ @@ -32,39 +33,38 @@ class ModelHighAPI_Selection; * \ingroup CPPHighAPI * \brief Interface for Rectangle feature */ -class SketchAPI_Rectangle : public SketchAPI_SketchEntity -{ +class SketchAPI_Rectangle : public SketchAPI_SketchEntity { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Rectangle(const std::shared_ptr & theFeature); + explicit SketchAPI_Rectangle( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Rectangle(const std::shared_ptr & theFeature, + SketchAPI_Rectangle(const std::shared_ptr &theFeature, double theX1, double theY1, double theX2, double theY2); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Rectangle(const std::shared_ptr & theFeature, - const std::shared_ptr & theFirstPoint, - const std::shared_ptr & theEndPoint); + SketchAPI_Rectangle(const std::shared_ptr &theFeature, + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theEndPoint); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Rectangle(); - INTERFACE_7("SketchRectangle", - type, "RectangleType", ModelAPI_AttributeString, - /** Creation type of rectangle */, - startPoint, "RectStartPoint", GeomDataAPI_Point2D, - /** Start point */, - endPoint, "RectEndPoint", GeomDataAPI_Point2D, - /** End point */, - centerPoint, "RectCenterPoint", GeomDataAPI_Point2D, - /** Center point */, - centerPointRef, "RectCenterPointRef", ModelAPI_AttributeRefAttr, - /** Reference to center point */, - cornerPoint, "RectCornerPoint", GeomDataAPI_Point2D, - /** Corner point */, - linesList, "RectangleList", ModelAPI_AttributeRefList, + INTERFACE_7("SketchRectangle", type, "RectangleType", + ModelAPI_AttributeString, + /** Creation type of rectangle */, startPoint, "RectStartPoint", + GeomDataAPI_Point2D, + /** Start point */, endPoint, "RectEndPoint", GeomDataAPI_Point2D, + /** End point */, centerPoint, "RectCenterPoint", + GeomDataAPI_Point2D, + /** Center point */, centerPointRef, "RectCenterPointRef", + ModelAPI_AttributeRefAttr, + /** Reference to center point */, cornerPoint, "RectCornerPoint", + GeomDataAPI_Point2D, + /** Corner point */, linesList, "RectangleList", + ModelAPI_AttributeRefList, /** Lines list */ ) @@ -74,11 +74,12 @@ public: /// Set by points SKETCHAPI_EXPORT - void setByPoints(const std::shared_ptr & theFirstPoint, - const std::shared_ptr & theSecondPoint); + void setByPoints(const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint); /// List of lines composing rectangle - SKETCHAPI_EXPORT std::list > lines() const; + SKETCHAPI_EXPORT std::list> + lines() const; }; //! Pointer on Rectangle object diff --git a/src/SketchAPI/SketchAPI_Rotation.cpp b/src/SketchAPI/SketchAPI_Rotation.cpp index a5b332adc..1655963e1 100644 --- a/src/SketchAPI/SketchAPI_Rotation.cpp +++ b/src/SketchAPI/SketchAPI_Rotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Rotation.h" @@ -26,22 +27,18 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_Rotation::SketchAPI_Rotation( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } SketchAPI_Rotation::SketchAPI_Rotation( - const std::shared_ptr & theFeature, - const std::list > & theObjects, - const ModelHighAPI_RefAttr & theCenter, - const ModelHighAPI_Double & theAngle, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue, + const std::shared_ptr &theFeature, + const std::list> &theObjects, + const ModelHighAPI_RefAttr &theCenter, const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue, bool theReversed) -: ModelHighAPI_Interface(theFeature) -{ + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theCenter, center()); fillAttribute(theFullValue ? "FullAngle" : "SingleAngle", valueType()); @@ -53,35 +50,32 @@ SketchAPI_Rotation::SketchAPI_Rotation( } } -SketchAPI_Rotation::~SketchAPI_Rotation() -{ - -} +SketchAPI_Rotation::~SketchAPI_Rotation() {} void SketchAPI_Rotation::setRotationList( - const std::list >& theObjects) -{ + const std::list> &theObjects) { fillAttribute(theObjects, rotationList()); execute(true); } -std::list > SketchAPI_Rotation::rotated() const -{ +std::list> +SketchAPI_Rotation::rotated() const { std::list aList = rotatedObjects()->list(); // remove all initial features std::list anIntermediate; std::list::const_iterator anIt = aList.begin(); for (; anIt != aList.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeBooleanPtr isCopy = + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (isCopy.get() && isCopy->value()) anIntermediate.push_back(aFeature); } return SketchAPI_SketchEntity::wrap(anIntermediate); } -std::list > SketchAPI_Rotation::rotatedList() const -{ +std::list> +SketchAPI_Rotation::rotatedList() const { std::list aList = rotationList()->list(); std::set anOriginalObjects; anOriginalObjects.insert(aList.begin(), aList.end()); @@ -93,7 +87,8 @@ std::list > SketchAPI_Rotation::rotatedL if (anOriginalObjects.find(*anIt) != anOriginalObjects.end()) continue; // skip initial object FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeBooleanPtr isCopy = + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (isCopy.get() && isCopy->value()) anIntermediate.push_back(aFeature); } @@ -102,10 +97,9 @@ std::list > SketchAPI_Rotation::rotatedL //-------------------------------------------------------------------------------------- -void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Rotation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); AttributeRefListPtr aRotObjects = rotationList(); AttributeRefAttrPtr aCenter = center(); @@ -114,7 +108,8 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const bool isFullValue = valueType()->value() != "SingleAngle"; bool isReversed = reversed()->value(); - // Check all attributes are already dumped. If not, store the constraint as postponed. + // Check all attributes are already dumped. If not, store the constraint as + // postponed. size_t aFirstNotDumped = theDumper.indexOfFirstNotDumped(aRotObjects); if (!theDumper.isDumped(aCenter) || aFirstNotDumped == 0) { theDumper.postpone(aBase); @@ -123,26 +118,26 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const // the number of dumped aRotObjects is not changed, no need to dump anything static std::map aNbDumpedArguments; - std::map::iterator aFound = aNbDumpedArguments.find(aBase); + std::map::iterator aFound = + aNbDumpedArguments.find(aBase); if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) { theDumper.postpone(aBase); return; - } - else + } else aNbDumpedArguments[aBase] = aFirstNotDumped; if (theDumper.isDumped(aBase)) { - // the feature is already dumped, but it was postponed, because of some arguments - // were not dumped yet, thus, it is necessary to update the list of rotated objects + // the feature is already dumped, but it was postponed, because of some + // arguments were not dumped yet, thus, it is necessary to update the list + // of rotated objects theDumper << "\n### Update " << aBase->getKind() << std::endl; - theDumper << aBase << ".setRotationList(" << aRotObjects << ")" << std::endl; - } - else { + theDumper << aBase << ".setRotationList(" << aRotObjects << ")" + << std::endl; + } else { // the feature is not dumped yet, make the full dump - theDumper << aBase << " = " << aSketchName << ".addRotation(" - << aRotObjects << ", " << aCenter << ", " << anAngle << ", " << aNbCopies; - if (isFullValue || isReversed) - { + theDumper << aBase << " = " << aSketchName << ".addRotation(" << aRotObjects + << ", " << aCenter << ", " << anAngle << ", " << aNbCopies; + if (isFullValue || isReversed) { theDumper << ", " << isFullValue; if (isReversed) theDumper << ", " << isReversed; @@ -152,10 +147,12 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const // Dump variables for a list of rotated features theDumper << "["; - std::list > aList = rotatedList(); - std::list >::const_iterator anIt = aList.begin(); + std::list> aList = rotatedList(); + std::list>::const_iterator anIt = + aList.begin(); for (size_t anIndex = 0; anIndex < aFirstNotDumped; ++anIndex) - for (int i = 1; i < aNbCopies->value() && anIt != aList.end(); ++i, ++anIt) { + for (int i = 1; i < aNbCopies->value() && anIt != aList.end(); + ++i, ++anIt) { if (anIt != aList.begin()) theDumper << ", "; theDumper << (*anIt)->feature(); @@ -173,19 +170,22 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aFeature = ModelAPI_Feature::feature(*aRIt); if (!aFeature) continue; - bool aBaseAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aBaseAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); for (int i = 1; i < aNbCopies->value(); ++i, ++anIt) { aFeature = (*anIt)->feature(); - bool aFeatAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aFeatAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value(); if (aFeatAux != aBaseAux) theDumper << theDumper.name((*anIt)->feature(), false) << ".setAuxiliary(" << aFeatAux << ")" << std::endl; } } - } - else { - // If all refereced objects are not dumped yet, mark the feature as postponed. + } else { + // If all refereced objects are not dumped yet, mark the feature as + // postponed. theDumper.postpone(aBase); } } diff --git a/src/SketchAPI/SketchAPI_Rotation.h b/src/SketchAPI/SketchAPI_Rotation.h index 6859c6b19..4cbd5b71f 100644 --- a/src/SketchAPI/SketchAPI_Rotation.h +++ b/src/SketchAPI/SketchAPI_Rotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_ @@ -40,59 +41,59 @@ class ModelHighAPI_RefAttr; * \ingroup CPPHighAPI * \brief Interface for Rotation feature */ -class SketchAPI_Rotation : public ModelHighAPI_Interface -{ +class SketchAPI_Rotation : public ModelHighAPI_Interface { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Rotation(const std::shared_ptr & theFeature); + explicit SketchAPI_Rotation( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Rotation(const std::shared_ptr & theFeature, - const std::list > & theObjects, - const ModelHighAPI_RefAttr & theCenter, - const ModelHighAPI_Double & theAngle, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue = false, - bool theReversed = false); + SketchAPI_Rotation( + const std::shared_ptr &theFeature, + const std::list> &theObjects, + const ModelHighAPI_RefAttr &theCenter, + const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue = false, + bool theReversed = false); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Rotation(); - INTERFACE_8(SketchPlugin_MultiRotation::ID(), - rotationList, SketchPlugin_MultiRotation::ROTATION_LIST_ID(), - ModelAPI_AttributeRefList, /** Rotation list */, - center, SketchPlugin_MultiRotation::CENTER_ID(), - ModelAPI_AttributeRefAttr, /** Center */, - angle, SketchPlugin_MultiRotation::ANGLE_ID(), - ModelAPI_AttributeDouble, /** Angle */, - reversed, SketchPlugin_MultiRotation::REVERSED_ID(), - ModelAPI_AttributeBoolean, /** Negative angle */, - numberOfObjects, SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID(), - ModelAPI_AttributeInteger, /** Number of objects */, - valueType, SketchPlugin_MultiRotation::ANGLE_TYPE(), - ModelAPI_AttributeString, /** Value type */, - referenceObjects, SketchPlugin_MultiRotation::ENTITY_A(), - ModelAPI_AttributeRefList, /** Reference objects */, - rotatedObjects, SketchPlugin_MultiRotation::ENTITY_B(), + INTERFACE_8(SketchPlugin_MultiRotation::ID(), rotationList, + SketchPlugin_MultiRotation::ROTATION_LIST_ID(), + ModelAPI_AttributeRefList, /** Rotation list */, center, + SketchPlugin_MultiRotation::CENTER_ID(), + ModelAPI_AttributeRefAttr, /** Center */, angle, + SketchPlugin_MultiRotation::ANGLE_ID(), ModelAPI_AttributeDouble, + /** Angle */, reversed, SketchPlugin_MultiRotation::REVERSED_ID(), + ModelAPI_AttributeBoolean, /** Negative angle */, numberOfObjects, + SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID(), + ModelAPI_AttributeInteger, /** Number of objects */, valueType, + SketchPlugin_MultiRotation::ANGLE_TYPE(), + ModelAPI_AttributeString, /** Value type */, referenceObjects, + SketchPlugin_MultiRotation::ENTITY_A(), ModelAPI_AttributeRefList, + /** Reference objects */, rotatedObjects, + SketchPlugin_MultiRotation::ENTITY_B(), ModelAPI_AttributeRefList, /** Rotated objects */ ) /// Set list of objects to be rotated SKETCHAPI_EXPORT - void setRotationList(const std::list >& theObjects); + void setRotationList( + const std::list> &theObjects); /// List of rotated objects. /// [DEPRECATED]: use rotatedList() instead. SKETCHAPI_EXPORT - std::list > rotated() const; + std::list> rotated() const; /// List of rotated objects. SKETCHAPI_EXPORT - std::list > rotatedList() const; + std::list> rotatedList() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Rotation object diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index b0836ae12..c892c11af 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Sketch.h" @@ -27,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -36,18 +36,19 @@ #include #include #include -#include -#include -#include #include #include +#include +#include #include -#include #include +#include +#include +#include #include //-------------------------------------------------------------------------------------- -#include #include +#include #include #include #include @@ -59,6 +60,7 @@ #include "SketchAPI_Arc.h" #include "SketchAPI_BSpline.h" #include "SketchAPI_Circle.h" +#include "SketchAPI_Constraint.h" #include "SketchAPI_Ellipse.h" #include "SketchAPI_EllipticArc.h" #include "SketchAPI_IntersectionPoint.h" @@ -75,7 +77,6 @@ #include "SketchAPI_Rectangle.h" #include "SketchAPI_Rotation.h" #include "SketchAPI_Translation.h" -#include "SketchAPI_Constraint.h" //-------------------------------------------------------------------------------------- #include #include @@ -88,19 +89,20 @@ #include //-------------------------------------------------------------------------------------- - -static std::shared_ptr pointCoordinates(const AttributePtr& thePoint) -{ - AttributePoint2DPtr aPnt = std::dynamic_pointer_cast(thePoint); +static std::shared_ptr +pointCoordinates(const AttributePtr &thePoint) { + AttributePoint2DPtr aPnt = + std::dynamic_pointer_cast(thePoint); return aPnt ? aPnt->pnt() : std::shared_ptr(); } -static std::shared_ptr middlePointOnLine(const FeaturePtr& theFeature) -{ - AttributePoint2DPtr aStartAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Line::START_ID())); +static std::shared_ptr +middlePointOnLine(const FeaturePtr &theFeature) { + AttributePoint2DPtr aStartAttr = + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Line::START_ID())); AttributePoint2DPtr aEndAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Line::END_ID())); + theFeature->attribute(SketchPlugin_Line::END_ID())); if (!aStartAttr || !aEndAttr) return std::shared_ptr(); @@ -108,43 +110,47 @@ static std::shared_ptr middlePointOnLine(const FeaturePtr& theFea std::shared_ptr aStartPoint = aStartAttr->pnt()->xy(); std::shared_ptr aEndPoint = aEndAttr->pnt()->xy(); return std::shared_ptr( - new GeomAPI_Pnt2d(aStartPoint->added(aEndPoint)->multiplied(0.5))); + new GeomAPI_Pnt2d(aStartPoint->added(aEndPoint)->multiplied(0.5))); } -static std::shared_ptr pointOnCircle(const FeaturePtr& theFeature) -{ +static std::shared_ptr +pointOnCircle(const FeaturePtr &theFeature) { AttributePoint2DPtr aCenter = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Circle::CENTER_ID())); - AttributeDoublePtr aRadius = theFeature->real(SketchPlugin_Circle::RADIUS_ID()); + theFeature->attribute(SketchPlugin_Circle::CENTER_ID())); + AttributeDoublePtr aRadius = + theFeature->real(SketchPlugin_Circle::RADIUS_ID()); if (!aCenter || !aRadius) return std::shared_ptr(); return std::shared_ptr( - new GeomAPI_Pnt2d(aCenter->x() + aRadius->value(), aCenter->y())); + new GeomAPI_Pnt2d(aCenter->x() + aRadius->value(), aCenter->y())); } -static std::shared_ptr middlePointOnArc(const FeaturePtr& theFeature) -{ +static std::shared_ptr +middlePointOnArc(const FeaturePtr &theFeature) { static const double PI = 3.141592653589793238463; - AttributePoint2DPtr aCenterAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Arc::CENTER_ID())); - AttributePoint2DPtr aStartAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Arc::START_ID())); + AttributePoint2DPtr aCenterAttr = + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Arc::CENTER_ID())); + AttributePoint2DPtr aStartAttr = + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Arc::START_ID())); AttributePoint2DPtr aEndAttr = std::dynamic_pointer_cast( - theFeature->attribute(SketchPlugin_Arc::END_ID())); + theFeature->attribute(SketchPlugin_Arc::END_ID())); if (!aCenterAttr || !aStartAttr || !aEndAttr) return std::shared_ptr(); std::shared_ptr aStartDir(new GeomAPI_Dir2d( - aStartAttr->x() - aCenterAttr->x(), aStartAttr->y() - aCenterAttr->y())); + aStartAttr->x() - aCenterAttr->x(), aStartAttr->y() - aCenterAttr->y())); std::shared_ptr aEndDir(new GeomAPI_Dir2d( - aEndAttr->x() - aCenterAttr->x(), aEndAttr->y() - aCenterAttr->y())); + aEndAttr->x() - aCenterAttr->x(), aEndAttr->y() - aCenterAttr->y())); double anAngle = aStartDir->angle(aEndDir); - bool isReversed = theFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->value(); + bool isReversed = + theFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->value(); if (isReversed && anAngle > 0.) anAngle -= 2.0 * PI; else if (!isReversed && anAngle <= 0.) @@ -155,40 +161,44 @@ static std::shared_ptr middlePointOnArc(const FeaturePtr& theFeat // rotate start dir to find middle point on arc double aRadius = aStartAttr->pnt()->distance(aCenterAttr->pnt()); - double x = aCenterAttr->x() + aRadius * (aStartDir->x() * cosA - aStartDir->y() * sinA); - double y = aCenterAttr->y() + aRadius * (aStartDir->x() * sinA + aStartDir->y() * cosA); + double x = aCenterAttr->x() + + aRadius * (aStartDir->x() * cosA - aStartDir->y() * sinA); + double y = aCenterAttr->y() + + aRadius * (aStartDir->x() * sinA + aStartDir->y() * cosA); return std::shared_ptr(new GeomAPI_Pnt2d(x, y)); } -static std::shared_ptr pointOnEllipse(const FeaturePtr& theFeature, - bool isEllipse = true) -{ - const std::string& anAttrName = isEllipse ? SketchPlugin_Ellipse::MAJOR_AXIS_END_ID() : - SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID(); - AttributePoint2DPtr aMajorAxisEnd = std::dynamic_pointer_cast( - theFeature->attribute(anAttrName)); - return aMajorAxisEnd ? aMajorAxisEnd->pnt() : std::shared_ptr(); +static std::shared_ptr +pointOnEllipse(const FeaturePtr &theFeature, bool isEllipse = true) { + const std::string &anAttrName = + isEllipse ? SketchPlugin_Ellipse::MAJOR_AXIS_END_ID() + : SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID(); + AttributePoint2DPtr aMajorAxisEnd = + std::dynamic_pointer_cast( + theFeature->attribute(anAttrName)); + return aMajorAxisEnd ? aMajorAxisEnd->pnt() + : std::shared_ptr(); } -static std::shared_ptr middlePointOnBSpline(const FeaturePtr& theFeature, - SketchAPI_Sketch* theSketch) -{ +static std::shared_ptr +middlePointOnBSpline(const FeaturePtr &theFeature, + SketchAPI_Sketch *theSketch) { GeomAPI_Edge anEdge(theFeature->lastResult()->shape()); GeomPointPtr aMiddle = anEdge.middlePoint(); return theSketch->to2D(aMiddle); } -static std::shared_ptr middlePoint(const ObjectPtr& theObject, - SketchAPI_Sketch* theSketch) -{ +static std::shared_ptr middlePoint(const ObjectPtr &theObject, + SketchAPI_Sketch *theSketch) { std::shared_ptr aMiddlePoint; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature) { // move only features of the following types - const std::string& aFeatureKind = aFeature->getKind(); + const std::string &aFeatureKind = aFeature->getKind(); if (aFeatureKind == SketchPlugin_Point::ID()) - aMiddlePoint = pointCoordinates(aFeature->attribute(SketchPlugin_Point::COORD_ID())); + aMiddlePoint = + pointCoordinates(aFeature->attribute(SketchPlugin_Point::COORD_ID())); else if (aFeatureKind == SketchPlugin_Line::ID()) aMiddlePoint = middlePointOnLine(aFeature); else if (aFeatureKind == SketchPlugin_Circle::ID()) @@ -200,63 +210,55 @@ static std::shared_ptr middlePoint(const ObjectPtr& theObject, else if (aFeatureKind == SketchPlugin_EllipticArc::ID()) aMiddlePoint = pointOnEllipse(aFeature, false); else if (aFeatureKind == SketchPlugin_BSpline::ID() || - aFeatureKind == SketchPlugin_BSplinePeriodic::ID()) + aFeatureKind == SketchPlugin_BSplinePeriodic::ID()) aMiddlePoint = middlePointOnBSpline(aFeature, theSketch); } return aMiddlePoint; } SketchAPI_Sketch::SketchAPI_Sketch( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } SketchAPI_Sketch::SketchAPI_Sketch( - const std::shared_ptr & theFeature, - const std::shared_ptr & thePlane) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::shared_ptr &thePlane) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setPlane(thePlane); } } SketchAPI_Sketch::SketchAPI_Sketch( - const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setExternal(theExternal); } } SketchAPI_Sketch::SketchAPI_Sketch( - const std::shared_ptr & theFeature, + const std::shared_ptr &theFeature, std::shared_ptr thePlaneObject) -: ModelHighAPI_Interface(theFeature) -{ + : ModelHighAPI_Interface(theFeature) { if (initialize()) { setExternal(thePlaneObject); } } -SketchAPI_Sketch::~SketchAPI_Sketch() -{ - -} +SketchAPI_Sketch::~SketchAPI_Sketch() {} //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::compositeFeature() const -{ +std::shared_ptr +SketchAPI_Sketch::compositeFeature() const { return std::dynamic_pointer_cast(feature()); } //-------------------------------------------------------------------------------------- -void SketchAPI_Sketch::setPlane(const std::shared_ptr & thePlane) -{ +void SketchAPI_Sketch::setPlane(const std::shared_ptr &thePlane) { fillAttribute(thePlane->origin(), myorigin); fillAttribute(thePlane->dirX(), mydirX); fillAttribute(thePlane->normal(), mynormal); @@ -264,9 +266,8 @@ void SketchAPI_Sketch::setPlane(const std::shared_ptr & thePlane) execute(); } -void SketchAPI_Sketch::setPlane(const ModelHighAPI_Selection & thePlane, - bool theRemoveExternalDependency) -{ +void SketchAPI_Sketch::setPlane(const ModelHighAPI_Selection &thePlane, + bool theRemoveExternalDependency) { FeaturePtr aSketch = feature(); DocumentPtr aDoc = aSketch->document(); @@ -283,15 +284,14 @@ void SketchAPI_Sketch::setPlane(const ModelHighAPI_Selection & thePlane, } //-------------------------------------------------------------------------------------- -void SketchAPI_Sketch::setExternal(const ModelHighAPI_Selection & theExternal) -{ +void SketchAPI_Sketch::setExternal(const ModelHighAPI_Selection &theExternal) { fillAttribute(theExternal, myexternal); execute(); } -void SketchAPI_Sketch::setExternal(std::shared_ptr thePlaneObject) -{ +void SketchAPI_Sketch::setExternal( + std::shared_ptr thePlaneObject) { ResultPtr aRes = std::dynamic_pointer_cast(thePlaneObject); ModelHighAPI_Selection aSel(aRes); setExternal(aSel); @@ -299,71 +299,70 @@ void SketchAPI_Sketch::setExternal(std::shared_ptr thePlaneObje //-------------------------------------------------------------------------------------- void SketchAPI_Sketch::setValue( - const std::shared_ptr & theConstraint, - const ModelHighAPI_Double & theValue) -{ - fillAttribute(theValue, theConstraint->feature()->real(SketchPlugin_Constraint::VALUE())); + const std::shared_ptr &theConstraint, + const ModelHighAPI_Double &theValue) { + fillAttribute(theValue, theConstraint->feature()->real( + SketchPlugin_Constraint::VALUE())); -// theConstraint->execute(); + // theConstraint->execute(); } //-------------------------------------------------------------------------------------- -std::list SketchAPI_Sketch::selectFace() const -{ - const_cast(this)->execute(); +std::list SketchAPI_Sketch::selectFace() const { + const_cast(this)->execute(); std::list aSelectionList; ResultConstructionPtr aResultConstruction = - std::dynamic_pointer_cast(feature()->firstResult()); + std::dynamic_pointer_cast( + feature()->firstResult()); if (aResultConstruction.get() == NULL) return aSelectionList; for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) { - aSelectionList.push_back( - ModelHighAPI_Selection(aResultConstruction, - aResultConstruction->face(anIndex))); + aSelectionList.push_back(ModelHighAPI_Selection( + aResultConstruction, aResultConstruction->face(anIndex))); } return aSelectionList; } //-------------------------------------------------------------------------------------- -SketchPtr addSketch(const std::shared_ptr & thePart, - const std::shared_ptr & thePlane) -{ - std::shared_ptr aFeature = thePart->addFeature(SketchAPI_Sketch::ID()); +SketchPtr addSketch(const std::shared_ptr &thePart, + const std::shared_ptr &thePlane) { + std::shared_ptr aFeature = + thePart->addFeature(SketchAPI_Sketch::ID()); return SketchPtr(new SketchAPI_Sketch(aFeature, thePlane)); } -SketchPtr addSketch(const std::shared_ptr & thePart, - const ModelHighAPI_Selection & theExternal) -{ - std::shared_ptr aFeature = thePart->addFeature(SketchAPI_Sketch::ID()); +SketchPtr addSketch(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theExternal) { + std::shared_ptr aFeature = + thePart->addFeature(SketchAPI_Sketch::ID()); return SketchPtr(new SketchAPI_Sketch(aFeature, theExternal)); } -SketchPtr addSketch(const std::shared_ptr & thePart, - const std::wstring & theExternalName) -{ - std::shared_ptr aFeature = thePart->addFeature(SketchAPI_Sketch::ID()); - return SketchPtr( - new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName))); +SketchPtr addSketch(const std::shared_ptr &thePart, + const std::wstring &theExternalName) { + std::shared_ptr aFeature = + thePart->addFeature(SketchAPI_Sketch::ID()); + return SketchPtr(new SketchAPI_Sketch( + aFeature, ModelHighAPI_Selection("FACE", theExternalName))); } -SketchPtr addSketch(const std::shared_ptr & thePart, - std::shared_ptr thePlaneObject) -{ - std::shared_ptr aFeature = thePart->addFeature(SketchAPI_Sketch::ID()); +SketchPtr addSketch(const std::shared_ptr &thePart, + std::shared_ptr thePlaneObject) { + std::shared_ptr aFeature = + thePart->addFeature(SketchAPI_Sketch::ID()); return SketchPtr(new SketchAPI_Sketch(aFeature, thePlaneObject)); } //-------------------------------------------------------------------------------------- -SketchPtr copySketch(const std::shared_ptr & thePart, - const SketchPtr & theSketch) -{ +SketchPtr copySketch(const std::shared_ptr &thePart, + const SketchPtr &theSketch) { FeaturePtr aCopyer = thePart->addFeature(SketchPlugin_SketchCopy::ID()); - aCopyer->reference(SketchPlugin_SketchCopy::BASE_ID())->setValue(theSketch->feature()); + aCopyer->reference(SketchPlugin_SketchCopy::BASE_ID()) + ->setValue(theSketch->feature()); aCopyer->execute(); FeaturePtr aNewSketch = thePart->nextFeature(aCopyer); @@ -375,13 +374,13 @@ SketchPtr copySketch(const std::shared_ptr & thePart, return SketchPtr(new SketchAPI_Sketch(aNewSketch)); } - //-------------------------------------------------------------------------------------- -std::list< std::shared_ptr > SketchAPI_Sketch::getFreePoints() -{ - std::list< std::shared_ptr > aFreePoints; - std::list aPoints = SketcherPrs_Tools::getFreePoints(compositeFeature()); - for (std::list::iterator anIt = aPoints.begin(); anIt != aPoints.end(); ++anIt) { +std::list> SketchAPI_Sketch::getFreePoints() { + std::list> aFreePoints; + std::list aPoints = + SketcherPrs_Tools::getFreePoints(compositeFeature()); + for (std::list::iterator anIt = aPoints.begin(); + anIt != aPoints.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); PointPtr aPoint(new SketchAPI_Point(aFeature)); aFreePoints.push_back(aPoint); @@ -390,8 +389,7 @@ std::list< std::shared_ptr > SketchAPI_Sketch::getFreePoints() } //-------------------------------------------------------------------------------------- -static GeomCurvePtr untrimmedCurve(GeomShapePtr theShape) -{ +static GeomCurvePtr untrimmedCurve(GeomShapePtr theShape) { GeomCurvePtr aCurve(new GeomAPI_Curve(theShape)); if (aCurve->isTrimmed()) aCurve = aCurve->basisCurve(); @@ -399,16 +397,16 @@ static GeomCurvePtr untrimmedCurve(GeomShapePtr theShape) } void SketchAPI_Sketch::changeFacesOrder( - const std::list >& theFaces) -{ + const std::list> &theFaces) { // collect faces of the sketch ResultConstructionPtr aSketchResult = - std::dynamic_pointer_cast(feature()->lastResult()); + std::dynamic_pointer_cast( + feature()->lastResult()); if (!aSketchResult) { // sketch is nested to a boolean operation, thus, it has no result yet. feature()->execute(); - aSketchResult = - std::dynamic_pointer_cast(feature()->lastResult()); + aSketchResult = std::dynamic_pointer_cast( + feature()->lastResult()); } std::list aFaces; int aFacesNum = aSketchResult->facesNum(); @@ -416,7 +414,8 @@ void SketchAPI_Sketch::changeFacesOrder( aFaces.push_back(aSketchResult->face(i)); // find new faces order according to the given lists of edges std::list aNewFacesOrder; - std::list >::const_iterator anIt = theFaces.begin(); + std::list>::const_iterator anIt = + theFaces.begin(); for (; anIt != theFaces.end(); ++anIt) { // find the appropriate face std::list::iterator aFIt = aFaces.begin(); @@ -449,106 +448,103 @@ void SketchAPI_Sketch::changeFacesOrder( } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addPoint( - double theX, double theY) -{ +std::shared_ptr SketchAPI_Sketch::addPoint(double theX, + double theY) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Point::ID()); + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, theX, theY)); } -std::shared_ptr SketchAPI_Sketch::addPoint( - const std::shared_ptr & thePoint) -{ +std::shared_ptr +SketchAPI_Sketch::addPoint(const std::shared_ptr &thePoint) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Point::ID()); + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, thePoint)); } std::shared_ptr - SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal) -{ +SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection &theExternal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Point::ID()); + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, theExternal)); } -std::shared_ptr SketchAPI_Sketch::addPoint(const std::wstring & theExternalName) -{ +std::shared_ptr +SketchAPI_Sketch::addPoint(const std::wstring &theExternalName) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Point::ID()); + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, theExternalName)); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addIntersectionPoint( - const ModelHighAPI_Selection & theExternal, - bool theKeepResult) -{ +std::shared_ptr +SketchAPI_Sketch::addIntersectionPoint( + const ModelHighAPI_Selection &theExternal, bool theKeepResult) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); - IntersectionPointPtr anIntersection(new SketchAPI_IntersectionPoint(aFeature, theExternal)); + compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); + IntersectionPointPtr anIntersection( + new SketchAPI_IntersectionPoint(aFeature, theExternal)); anIntersection->setIncludeToResult(theKeepResult); return anIntersection; } -std::shared_ptr SketchAPI_Sketch::addIntersectionPoint( - const std::wstring & theExternalName, - bool theKeepResult) -{ +std::shared_ptr +SketchAPI_Sketch::addIntersectionPoint(const std::wstring &theExternalName, + bool theKeepResult) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); - IntersectionPointPtr anIntersection(new SketchAPI_IntersectionPoint(aFeature, theExternalName)); + compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); + IntersectionPointPtr anIntersection( + new SketchAPI_IntersectionPoint(aFeature, theExternalName)); anIntersection->setIncludeToResult(theKeepResult); return anIntersection; } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addLine(double theX1, double theY1, - double theX2, double theY2) -{ +std::shared_ptr SketchAPI_Sketch::addLine(double theX1, + double theY1, + double theX2, + double theY2) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Line::ID()); + compositeFeature()->addFeature(SketchPlugin_Line::ID()); return LinePtr(new SketchAPI_Line(aFeature, theX1, theY1, theX2, theY2)); } -std::shared_ptr SketchAPI_Sketch::addLine( - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint) -{ +std::shared_ptr +SketchAPI_Sketch::addLine(const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Line::ID()); + compositeFeature()->addFeature(SketchPlugin_Line::ID()); return LinePtr(new SketchAPI_Line(aFeature, theStartPoint, theEndPoint)); } std::shared_ptr - SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal) -{ +SketchAPI_Sketch::addLine(const ModelHighAPI_Selection &theExternal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Line::ID()); + compositeFeature()->addFeature(SketchPlugin_Line::ID()); return LinePtr(new SketchAPI_Line(aFeature, theExternal)); } -std::shared_ptr SketchAPI_Sketch::addLine(const std::wstring & theExternalName) -{ +std::shared_ptr +SketchAPI_Sketch::addLine(const std::wstring &theExternalName) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Line::ID()); + compositeFeature()->addFeature(SketchPlugin_Line::ID()); return LinePtr(new SketchAPI_Line(aFeature, theExternalName)); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addRectangle(double theX1, double theY1, - double theX2, double theY2) -{ +std::shared_ptr +SketchAPI_Sketch::addRectangle(double theX1, double theY1, double theX2, + double theY2) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); - return RectanglePtr(new SketchAPI_Rectangle(aFeature, theX1, theY1, theX2, theY2)); + compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); + return RectanglePtr( + new SketchAPI_Rectangle(aFeature, theX1, theY1, theX2, theY2)); } std::shared_ptr SketchAPI_Sketch::addRectangle( - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint) -{ + const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); - return RectanglePtr(new SketchAPI_Rectangle(aFeature, theStartPoint, theEndPoint)); + compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); + return RectanglePtr( + new SketchAPI_Rectangle(aFeature, theStartPoint, theEndPoint)); } static std::shared_ptr pointCoordinates( - const std::pair, ModelHighAPI_RefAttr> & thePoint) -{ + const std::pair, ModelHighAPI_RefAttr> + &thePoint) { if (thePoint.first) return thePoint.first; @@ -567,11 +563,12 @@ static std::shared_ptr pointCoordinates( } std::shared_ptr SketchAPI_Sketch::addRectangleCentered( - const std::pair, ModelHighAPI_RefAttr> & theCenter, - const std::pair, ModelHighAPI_RefAttr> & theCorner) -{ + const std::pair, ModelHighAPI_RefAttr> + &theCenter, + const std::pair, ModelHighAPI_RefAttr> + &theCorner) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); + compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); RectanglePtr aRect(new SketchAPI_Rectangle(aFeature)); fillAttribute("RectangleTypeCentered", aRect->type()); if (!theCenter.second.isEmpty()) @@ -581,7 +578,8 @@ std::shared_ptr SketchAPI_Sketch::addRectangleCentered( aRect->execute(); if (!theCorner.second.isEmpty() && aRect->linesList()->size() > 1) { - // get start point of the last line in rectangle and apply coindidence constraint + // get start point of the last line in rectangle and apply coindidence + // constraint FeaturePtr aLine = ModelAPI_Feature::feature(aRect->linesList()->object(3)); AttributePtr aEndPnt = aLine->attribute(SketchPlugin_Line::START_ID()); setCoincident(ModelHighAPI_RefAttr(aEndPnt), theCorner.second); @@ -590,136 +588,122 @@ std::shared_ptr SketchAPI_Sketch::addRectangleCentered( } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addCircle(double theCenterX, - double theCenterY, - double theRadius) -{ +std::shared_ptr +SketchAPI_Sketch::addCircle(double theCenterX, double theCenterY, + double theRadius) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Circle::ID()); - return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius)); + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + return CirclePtr( + new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius)); } -std::shared_ptr SketchAPI_Sketch::addCircle( - const std::shared_ptr& theCenter, - double theRadius) -{ +std::shared_ptr +SketchAPI_Sketch::addCircle(const std::shared_ptr &theCenter, + double theRadius) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius)); } -std::shared_ptr SketchAPI_Sketch::addCircle(double theCenterX, - double theCenterY, - double thePassedX, - double thePassedY) -{ +std::shared_ptr +SketchAPI_Sketch::addCircle(double theCenterX, double theCenterY, + double thePassedX, double thePassedY) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); - return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterX, theCenterY, - thePassedX, thePassedY)); + compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); + return MacroCirclePtr(new SketchAPI_MacroCircle( + aFeature, theCenterX, theCenterY, thePassedX, thePassedY)); } std::shared_ptr SketchAPI_Sketch::addCircle( - const std::shared_ptr& theCenterPoint, - const std::shared_ptr& thePassedPoint) -{ + const std::shared_ptr &theCenterPoint, + const std::shared_ptr &thePassedPoint) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); - return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint)); + compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); + return MacroCirclePtr( + new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint)); } -std::shared_ptr SketchAPI_Sketch::addCircle(double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3) -{ +std::shared_ptr +SketchAPI_Sketch::addCircle(double theX1, double theY1, double theX2, + double theY2, double theX3, double theY3) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); - return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theX1, theY1, - theX2, theY2, - theX3, theY3)); + compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); + return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theX1, theY1, theX2, + theY2, theX3, theY3)); } -std::shared_ptr SketchAPI_Sketch::addCircle( - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -{ +std::shared_ptr +SketchAPI_Sketch::addCircle(const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); - return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3)); + compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID()); + return MacroCirclePtr( + new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3)); } std::shared_ptr - SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal) -{ +SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection &theExternal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, theExternal)); } -std::shared_ptr SketchAPI_Sketch::addCircle(const std::wstring & theExternalName) -{ +std::shared_ptr +SketchAPI_Sketch::addCircle(const std::wstring &theExternalName) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName)); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addArc(double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(double theCenterX, double theCenterY, double theStartX, + double theStartY, double theEndX, double theEndY, + bool theInversed) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Arc::ID()); - return ArcPtr(new SketchAPI_Arc(aFeature, - theCenterX, theCenterY, - theStartX, theStartY, - theEndX, theEndY, - theInversed)); + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + return ArcPtr(new SketchAPI_Arc(aFeature, theCenterX, theCenterY, theStartX, + theStartY, theEndX, theEndY, theInversed)); } -std::shared_ptr SketchAPI_Sketch::addArc( - const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + bool theInversed) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Arc::ID()); - return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed)); + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + return ArcPtr( + new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed)); } -std::shared_ptr SketchAPI_Sketch::addArc(double theStartX, double theStartY, - double theEndX, double theEndY, - double thePassedX, double thePassedY) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(double theStartX, double theStartY, double theEndX, + double theEndY, double thePassedX, double thePassedY) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); - return MacroArcPtr(new SketchAPI_MacroArc(aFeature, - theStartX, theStartY, - theEndX, theEndY, - thePassedX, thePassedY)); + compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); + return MacroArcPtr(new SketchAPI_MacroArc(aFeature, theStartX, theStartY, + theEndX, theEndY, thePassedX, + thePassedY)); } -std::shared_ptr SketchAPI_Sketch::addArc( - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - const std::shared_ptr& thePassed) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + const std::shared_ptr &thePassed) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); - return MacroArcPtr(new SketchAPI_MacroArc(aFeature, theStart, theEnd, thePassed)); + compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); + return MacroArcPtr( + new SketchAPI_MacroArc(aFeature, theStart, theEnd, thePassed)); } -std::shared_ptr SketchAPI_Sketch::addArc( - const ModelHighAPI_RefAttr& theTangentPoint, - double theEndX, double theEndY, - bool theInversed, - bool theTransversal) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr &theTangentPoint, + double theEndX, double theEndY, bool theInversed, + bool theTransversal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); + compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); MacroArcPtr aMacroArc(new SketchAPI_MacroArc(aFeature)); if (theTransversal) aMacroArc->setByTransversal(theTangentPoint, theEndX, theEndY, theInversed); @@ -728,14 +712,12 @@ std::shared_ptr SketchAPI_Sketch::addArc( return aMacroArc; } -std::shared_ptr SketchAPI_Sketch::addArc( - const ModelHighAPI_RefAttr& theTangentPoint, - const std::shared_ptr& theEnd, - bool theInversed, - bool theTransversal) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr &theTangentPoint, + const std::shared_ptr &theEnd, + bool theInversed, bool theTransversal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); + compositeFeature()->addFeature(SketchPlugin_MacroArc::ID()); MacroArcPtr aMacroArc(new SketchAPI_MacroArc(aFeature)); if (theTransversal) aMacroArc->setByTransversal(theTangentPoint, theEnd, theInversed); @@ -744,90 +726,80 @@ std::shared_ptr SketchAPI_Sketch::addArc( return aMacroArc; } -std::shared_ptr SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(const ModelHighAPI_Selection &theExternal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theExternal)); } -std::shared_ptr SketchAPI_Sketch::addArc(const std::wstring & theExternalName) -{ +std::shared_ptr +SketchAPI_Sketch::addArc(const std::wstring &theExternalName) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName)); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addEllipse( - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theMinorRadius) -{ +std::shared_ptr +SketchAPI_Sketch::addEllipse(double theCenterX, double theCenterY, + double theFocusX, double theFocusY, + double theMinorRadius) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Ellipse::ID()); - return EllipsePtr(new SketchAPI_Ellipse(aFeature, - theCenterX, theCenterY, theFocusX, theFocusY, theMinorRadius)); + return EllipsePtr(new SketchAPI_Ellipse( + aFeature, theCenterX, theCenterY, theFocusX, theFocusY, theMinorRadius)); } -std::shared_ptr SketchAPI_Sketch::addEllipse( - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - double theMinorRadius) -{ +std::shared_ptr +SketchAPI_Sketch::addEllipse(const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, + double theMinorRadius) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Ellipse::ID()); - return EllipsePtr(new SketchAPI_Ellipse(aFeature, theCenter, theFocus, theMinorRadius)); + return EllipsePtr( + new SketchAPI_Ellipse(aFeature, theCenter, theFocus, theMinorRadius)); } std::shared_ptr SketchAPI_Sketch::addEllipse( - double thePoint1X, double thePoint1Y, - double thePoint2X, double thePoint2Y, - double thePassedX, double thePassedY, - bool isPoint1Center) -{ + double thePoint1X, double thePoint1Y, double thePoint2X, double thePoint2Y, + double thePassedX, double thePassedY, bool isPoint1Center) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_MacroEllipse::ID()); - return MacroEllipsePtr(new SketchAPI_MacroEllipse(aFeature, - thePoint1X, thePoint1Y, thePoint2X, thePoint2Y, thePassedX, thePassedY, isPoint1Center)); + return MacroEllipsePtr(new SketchAPI_MacroEllipse( + aFeature, thePoint1X, thePoint1Y, thePoint2X, thePoint2Y, thePassedX, + thePassedY, isPoint1Center)); } std::shared_ptr SketchAPI_Sketch::addEllipse( - const PointOrReference& thePoint1, - const PointOrReference& thePoint2, - const PointOrReference& thePassedPoint, - bool isPoint1Center) -{ + const PointOrReference &thePoint1, const PointOrReference &thePoint2, + const PointOrReference &thePassedPoint, bool isPoint1Center) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_MacroEllipse::ID()); MacroEllipsePtr anEllipse; - if (thePoint1.second.isEmpty() && - thePoint2.second.isEmpty() && + if (thePoint1.second.isEmpty() && thePoint2.second.isEmpty() && thePassedPoint.second.isEmpty()) { - anEllipse.reset(new SketchAPI_MacroEllipse(aFeature, - thePoint1.first, thePoint2.first, thePassedPoint.first, isPoint1Center)); - } - else { - anEllipse.reset(new SketchAPI_MacroEllipse(aFeature, - thePoint1.first, thePoint1.second, - thePoint2.first, thePoint2.second, - thePassedPoint.first, thePassedPoint.second, + anEllipse.reset( + new SketchAPI_MacroEllipse(aFeature, thePoint1.first, thePoint2.first, + thePassedPoint.first, isPoint1Center)); + } else { + anEllipse.reset(new SketchAPI_MacroEllipse( + aFeature, thePoint1.first, thePoint1.second, thePoint2.first, + thePoint2.second, thePassedPoint.first, thePassedPoint.second, isPoint1Center)); } return anEllipse; } -std::shared_ptr SketchAPI_Sketch::addEllipse( - const ModelHighAPI_Selection & theExternal) -{ +std::shared_ptr +SketchAPI_Sketch::addEllipse(const ModelHighAPI_Selection &theExternal) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Ellipse::ID()); return EllipsePtr(new SketchAPI_Ellipse(aFeature, theExternal)); } -std::shared_ptr SketchAPI_Sketch::addEllipse( - const std::wstring & theExternalName) -{ +std::shared_ptr +SketchAPI_Sketch::addEllipse(const std::wstring &theExternalName) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Ellipse::ID()); return EllipsePtr(new SketchAPI_Ellipse(aFeature, theExternalName)); @@ -835,50 +807,39 @@ std::shared_ptr SketchAPI_Sketch::addEllipse( //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addEllipticArc( - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed) -{ + double theCenterX, double theCenterY, double theFocusX, double theFocusY, + double theStartX, double theStartY, double theEndX, double theEndY, + bool theInversed) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID()); - return EllipticArcPtr(new SketchAPI_EllipticArc(aFeature, - theCenterX, theCenterY, - theFocusX, theFocusY, - theStartX, theStartY, - theEndX, theEndY, - theInversed)); -} - -std::shared_ptr SketchAPI_Sketch::addEllipticArc( - const PointOrReference& theCenter, - const PointOrReference& theMajorAxisPoint, - const PointOrReference& theStartPoint, - const PointOrReference& theEndPoint, - bool theInversed) -{ + return EllipticArcPtr(new SketchAPI_EllipticArc( + aFeature, theCenterX, theCenterY, theFocusX, theFocusY, theStartX, + theStartY, theEndX, theEndY, theInversed)); +} + +std::shared_ptr +SketchAPI_Sketch::addEllipticArc(const PointOrReference &theCenter, + const PointOrReference &theMajorAxisPoint, + const PointOrReference &theStartPoint, + const PointOrReference &theEndPoint, + bool theInversed) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_MacroEllipticArc::ID()); - return MacroEllipticArcPtr(new SketchAPI_MacroEllipticArc(aFeature, - theCenter.first, theCenter.second, - theMajorAxisPoint.first, theMajorAxisPoint.second, - theStartPoint.first, theStartPoint.second, - theEndPoint.first, theEndPoint.second, - theInversed)); + return MacroEllipticArcPtr(new SketchAPI_MacroEllipticArc( + aFeature, theCenter.first, theCenter.second, theMajorAxisPoint.first, + theMajorAxisPoint.second, theStartPoint.first, theStartPoint.second, + theEndPoint.first, theEndPoint.second, theInversed)); } -std::shared_ptr SketchAPI_Sketch::addEllipticArc( - const ModelHighAPI_Selection & theExternal) -{ +std::shared_ptr +SketchAPI_Sketch::addEllipticArc(const ModelHighAPI_Selection &theExternal) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID()); return EllipticArcPtr(new SketchAPI_EllipticArc(aFeature, theExternal)); } -std::shared_ptr SketchAPI_Sketch::addEllipticArc( - const std::wstring & theExternalName) -{ +std::shared_ptr +SketchAPI_Sketch::addEllipticArc(const std::wstring &theExternalName) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID()); return EllipticArcPtr(new SketchAPI_EllipticArc(aFeature, theExternalName)); @@ -887,19 +848,18 @@ std::shared_ptr SketchAPI_Sketch::addEllipticArc( //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addSpline( - const ModelHighAPI_Selection & external, - const int degree, - const std::list& poles, - const std::list& weights, - const std::list& knots, - const std::list& multiplicities, - const bool periodic) -{ + const ModelHighAPI_Selection &external, const int degree, + const std::list &poles, + const std::list &weights, + const std::list &knots, + const std::list &multiplicities, + const bool periodic) { // split poles and references to other shapes bool hasReference = false; std::list aPoints; std::list aReferences; - for (std::list::const_iterator it = poles.begin(); it != poles.end(); ++it) { + for (std::list::const_iterator it = poles.begin(); + it != poles.end(); ++it) { aPoints.push_back(it->first); aReferences.push_back(it->second); if (!it->second.isEmpty()) @@ -910,28 +870,33 @@ std::shared_ptr SketchAPI_Sketch::addSpline( CompositeFeaturePtr aSketch = compositeFeature(); if (hasReference) { // use macro-feature to create coincidences to referred features - FeaturePtr aMacroFeature = aSketch->addFeature( - periodic ? SketchPlugin_MacroBSplinePeriodic::ID() : SketchPlugin_MacroBSpline::ID()); - AttributePoint2DArrayPtr aPolesAttr = std::dynamic_pointer_cast( - aMacroFeature->attribute(SketchPlugin_MacroBSpline::POLES_ID())); - AttributeDoubleArrayPtr aWeightsAttr = - aMacroFeature->data()->realArray(SketchPlugin_MacroBSpline::WEIGHTS_ID()); - AttributeRefAttrListPtr aPolesRefAttr = - aMacroFeature->data()->refattrlist(SketchPlugin_MacroBSpline::REF_POLES_ID()); + FeaturePtr aMacroFeature = + aSketch->addFeature(periodic ? SketchPlugin_MacroBSplinePeriodic::ID() + : SketchPlugin_MacroBSpline::ID()); + AttributePoint2DArrayPtr aPolesAttr = + std::dynamic_pointer_cast( + aMacroFeature->attribute(SketchPlugin_MacroBSpline::POLES_ID())); + AttributeDoubleArrayPtr aWeightsAttr = aMacroFeature->data()->realArray( + SketchPlugin_MacroBSpline::WEIGHTS_ID()); + AttributeRefAttrListPtr aPolesRefAttr = aMacroFeature->data()->refattrlist( + SketchPlugin_MacroBSpline::REF_POLES_ID()); // always generate a control polygon to apply coincidences correctly - aMacroFeature->boolean(SketchPlugin_MacroBSpline::CONTROL_POLYGON_ID())->setValue(true); + aMacroFeature->boolean(SketchPlugin_MacroBSpline::CONTROL_POLYGON_ID()) + ->setValue(true); // initialize B-spline attributes fillAttribute(aPoints, aPolesAttr); if (weights.empty()) - fillAttribute(std::list(poles.size(), 1.0), aWeightsAttr); + fillAttribute(std::list(poles.size(), 1.0), + aWeightsAttr); else fillAttribute(weights, aWeightsAttr); fillAttribute(aReferences, aPolesRefAttr); apply(); // to kill macro-feature // find created B-spline feature - const std::string& aKindToFind = - periodic ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID(); + const std::string &aKindToFind = periodic + ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID(); int aNbSubs = aSketch->numberOfSubs(); for (int anIndex = aNbSubs - 1; anIndex >= 0; --anIndex) { FeaturePtr aFeature = aSketch->subFeature(anIndex); @@ -942,11 +907,11 @@ std::shared_ptr SketchAPI_Sketch::addSpline( break; } } - } - else { + } else { // compute B-spline by parameters - FeaturePtr aFeature = aSketch->addFeature( - periodic ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID()); + FeaturePtr aFeature = + aSketch->addFeature(periodic ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID()); aBSpline.reset(periodic ? new SketchAPI_BSplinePeriodic(aFeature) : new SketchAPI_BSpline(aFeature)); @@ -955,40 +920,39 @@ std::shared_ptr SketchAPI_Sketch::addSpline( else if (knots.empty() || multiplicities.empty()) aBSpline->setByDegreePolesAndWeights(degree, aPoints, weights); else - aBSpline->setByParameters(degree, aPoints, weights, knots, multiplicities); + aBSpline->setByParameters(degree, aPoints, weights, knots, + multiplicities); } return aBSpline; } //-------------------------------------------------------------------------------------- -static std::shared_ptr buildInterpolation( - const CompositeFeaturePtr& theSketch, - const FeaturePtr& theCurveFittingFeature, - const std::list& points, - const bool periodic, - const bool closed) -{ +static std::shared_ptr +buildInterpolation(const CompositeFeaturePtr &theSketch, + const FeaturePtr &theCurveFittingFeature, + const std::list &points, + const bool periodic, const bool closed) { AttributeBooleanPtr aPeriodicAttr = theCurveFittingFeature->boolean(SketchPlugin_CurveFitting::PERIODIC_ID()); fillAttribute(periodic, aPeriodicAttr); AttributeBooleanPtr aClosedAttr = theCurveFittingFeature->boolean(SketchPlugin_CurveFitting::CLOSED_ID()); fillAttribute(closed, aClosedAttr); - AttributeRefAttrListPtr aPointsAttr = - theCurveFittingFeature->refattrlist(SketchPlugin_CurveFitting::POINTS_ID()); + AttributeRefAttrListPtr aPointsAttr = theCurveFittingFeature->refattrlist( + SketchPlugin_CurveFitting::POINTS_ID()); fillAttribute(points, aPointsAttr); apply(); // to execute and kill the macro-feature // find created B-spline feature BSplinePtr aBSpline; - const std::string& aKindToFind = - periodic ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID(); + const std::string &aKindToFind = periodic ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID(); int aNbSubs = theSketch->numberOfSubs(); for (int anIndex = aNbSubs - 1; anIndex >= 0; --anIndex) { FeaturePtr aFeature = theSketch->subFeature(anIndex); if (aFeature->getKind() == aKindToFind) { aBSpline.reset(periodic ? new SketchAPI_BSplinePeriodic(aFeature) - : new SketchAPI_BSpline(aFeature)); + : new SketchAPI_BSpline(aFeature)); aBSpline->execute(); break; } @@ -997,39 +961,36 @@ static std::shared_ptr buildInterpolation( } std::shared_ptr SketchAPI_Sketch::addInterpolation( - const std::list& points, - const bool periodic, - const bool closed) -{ + const std::list &points, const bool periodic, + const bool closed) { CompositeFeaturePtr aSketch = compositeFeature(); - FeaturePtr anInterpFeature = aSketch->addFeature(SketchPlugin_CurveFitting::ID()); + FeaturePtr anInterpFeature = + aSketch->addFeature(SketchPlugin_CurveFitting::ID()); anInterpFeature->string(SketchPlugin_CurveFitting::TYPE_ID()) ->setValue(SketchPlugin_CurveFitting::TYPE_INTERPOLATION_ID()); return buildInterpolation(aSketch, anInterpFeature, points, periodic, closed); } std::shared_ptr SketchAPI_Sketch::addApproximation( - const std::list& points, - const ModelHighAPI_Double& precision, - const bool periodic, - const bool closed) -{ + const std::list &points, + const ModelHighAPI_Double &precision, const bool periodic, + const bool closed) { CompositeFeaturePtr aSketch = compositeFeature(); - FeaturePtr anInterpFeature = aSketch->addFeature(SketchPlugin_CurveFitting::ID()); + FeaturePtr anInterpFeature = + aSketch->addFeature(SketchPlugin_CurveFitting::ID()); anInterpFeature->string(SketchPlugin_CurveFitting::TYPE_ID()) ->setValue(SketchPlugin_CurveFitting::TYPE_APPROXIMATION_ID()); - fillAttribute(precision, anInterpFeature->real(SketchPlugin_CurveFitting::PRECISION_ID())); + fillAttribute(precision, anInterpFeature->real( + SketchPlugin_CurveFitting::PRECISION_ID())); return buildInterpolation(aSketch, anInterpFeature, points, periodic, closed); } //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addProjection( - const ModelHighAPI_Selection & theExternalFeature, - bool keepResult, - bool keepRefToOriginal) -{ + const ModelHighAPI_Selection &theExternalFeature, bool keepResult, + bool keepRefToOriginal) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Projection::ID()); + compositeFeature()->addFeature(SketchPlugin_Projection::ID()); ProjectionPtr aProjection(new SketchAPI_Projection(aFeature)); aProjection->setIncludeToResult(keepResult); aProjection->setKeepReferenceToOriginal(keepRefToOriginal); @@ -1039,69 +1000,64 @@ std::shared_ptr SketchAPI_Sketch::addProjection( //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addMirror( - const ModelHighAPI_RefAttr & theMirrorLine, - const std::list > & theObjects) -{ + const ModelHighAPI_RefAttr &theMirrorLine, + const std::list> &theObjects) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID()); + compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID()); return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects)); } //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addOffset( - const std::list > & theObjects, - const ModelHighAPI_Double & theValue, - const bool theReversed, - const std::string & theJointType, - const bool theApprox) -{ + const std::list> &theObjects, + const ModelHighAPI_Double &theValue, const bool theReversed, + const std::string &theJointType, const bool theApprox) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Offset::ID()); - return OffsetPtr(new SketchAPI_Offset(aFeature, theObjects, theValue, theReversed, theJointType, theApprox)); + compositeFeature()->addFeature(SketchPlugin_Offset::ID()); + return OffsetPtr(new SketchAPI_Offset(aFeature, theObjects, theValue, + theReversed, theJointType, theApprox)); } //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addTranslation( - const std::list > & theObjects, - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue) -{ + const std::list> &theObjects, + const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID()); - return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, - thePoint2, theNumberOfObjects, theFullValue)); + compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID()); + return TranslationPtr( + new SketchAPI_Translation(aFeature, theObjects, thePoint1, thePoint2, + theNumberOfObjects, theFullValue)); } //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addRotation( - const std::list > & theObjects, - const ModelHighAPI_RefAttr & theCenter, - const ModelHighAPI_Double & theAngle, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue, - bool theReversed) -{ + const std::list> &theObjects, + const ModelHighAPI_RefAttr &theCenter, const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue, + bool theReversed) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID()); - return RotationPtr( - new SketchAPI_Rotation(aFeature, theObjects, theCenter, - theAngle, theNumberOfObjects, theFullValue, theReversed)); + compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID()); + return RotationPtr(new SketchAPI_Rotation(aFeature, theObjects, theCenter, + theAngle, theNumberOfObjects, + theFullValue, theReversed)); } //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addSplit( - const ModelHighAPI_Reference& theFeature, - const std::shared_ptr& thePositionPoint) -{ + const ModelHighAPI_Reference &theFeature, + const std::shared_ptr &thePositionPoint) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Split::ID()); - fillAttribute(theFeature, aFeature->reference(SketchPlugin_Split::SELECTED_OBJECT())); + compositeFeature()->addFeature(SketchPlugin_Split::ID()); + fillAttribute(theFeature, + aFeature->reference(SketchPlugin_Split::SELECTED_OBJECT())); - AttributePtr anAttribute = aFeature->attribute(SketchPlugin_Split::SELECTED_POINT()); + AttributePtr anAttribute = + aFeature->attribute(SketchPlugin_Split::SELECTED_POINT()); if (anAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast(anAttribute); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast(anAttribute); fillAttribute(thePositionPoint, aPointAttr); } @@ -1110,16 +1066,18 @@ std::shared_ptr SketchAPI_Sketch::addSplit( //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::addTrim( - const ModelHighAPI_Reference& theFeature, - const std::shared_ptr& thePositionPoint) -{ + const ModelHighAPI_Reference &theFeature, + const std::shared_ptr &thePositionPoint) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Trim::ID()); - fillAttribute(theFeature, aFeature->reference(SketchPlugin_Trim::SELECTED_OBJECT())); + compositeFeature()->addFeature(SketchPlugin_Trim::ID()); + fillAttribute(theFeature, + aFeature->reference(SketchPlugin_Trim::SELECTED_OBJECT())); - AttributePtr anAttribute = aFeature->attribute(SketchPlugin_Trim::SELECTED_POINT()); + AttributePtr anAttribute = + aFeature->attribute(SketchPlugin_Trim::SELECTED_POINT()); if (anAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast(anAttribute); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast(anAttribute); fillAttribute(thePositionPoint, aPointAttr); } @@ -1128,27 +1086,32 @@ std::shared_ptr SketchAPI_Sketch::addTrim( //-------------------------------------------------------------------------------------- std::shared_ptr SketchAPI_Sketch::setAngle( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue, - const std::string& theType) -{ + const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, + const ModelHighAPI_Double &theValue, const std::string &theType) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID()); - const int aVersion = theType.empty() ? SketchPlugin_ConstraintAngle::THE_VERSION_0 - : SketchPlugin_ConstraintAngle::THE_VERSION_1; - fillAttribute(aVersion, aFeature->integer(SketchPlugin_ConstraintAngle::VERSION_ID())); + const int aVersion = theType.empty() + ? SketchPlugin_ConstraintAngle::THE_VERSION_0 + : SketchPlugin_ConstraintAngle::THE_VERSION_1; + fillAttribute(aVersion, + aFeature->integer(SketchPlugin_ConstraintAngle::VERSION_ID())); int aType = (int)SketcherPrs_Tools::ANGLE_DIRECT; - fillAttribute(aType, aFeature->integer(SketchPlugin_ConstraintAngle::PREV_TYPE_ID())); - fillAttribute(aType, aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute( + aType, aFeature->integer(SketchPlugin_ConstraintAngle::PREV_TYPE_ID())); + fillAttribute(aType, + aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); if (aVersion == SketchPlugin_ConstraintAngle::THE_VERSION_0) - fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); + fillAttribute( + theValue, + aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); - fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(theLine1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); if (aVersion == SketchPlugin_ConstraintAngle::THE_VERSION_1) { std::string aTypeLC = theType; @@ -1159,162 +1122,177 @@ std::shared_ptr SketchAPI_Sketch::setAngle( else if (aTypeLC == "backward") aType = (int)SketcherPrs_Tools::ANGLE_BACKWARD; - fillAttribute(aType, aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); - fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); + fillAttribute(aType, + aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute( + theValue, + aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); } aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setAngleComplementary( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue) -{ +std::shared_ptr +SketchAPI_Sketch::setAngleComplementary(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2, + const ModelHighAPI_Double &theValue) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID()); fillAttribute(SketchPlugin_ConstraintAngle::THE_VERSION_0, - aFeature->integer(SketchPlugin_ConstraintAngle::VERSION_ID())); + aFeature->integer(SketchPlugin_ConstraintAngle::VERSION_ID())); fillAttribute(SketcherPrs_Tools::ANGLE_COMPLEMENTARY, - aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); - fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); - fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute(theValue, + aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); + fillAttribute(theLine1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setAngleBackward( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue) -{ +std::shared_ptr +SketchAPI_Sketch::setAngleBackward(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2, + const ModelHighAPI_Double &theValue) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID()); fillAttribute(SketchPlugin_ConstraintAngle::THE_VERSION_0, - aFeature->integer(SketchPlugin_ConstraintAngle::VERSION_ID())); + aFeature->integer(SketchPlugin_ConstraintAngle::VERSION_ID())); fillAttribute(SketcherPrs_Tools::ANGLE_BACKWARD, - aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); - fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); - fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute(theValue, + aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); + fillAttribute(theLine1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setCoincident( - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2) -{ +std::shared_ptr +SketchAPI_Sketch::setCoincident(const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintCoincidence::ID()); - fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(thePoint1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(thePoint2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setCollinear( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2) -{ +std::shared_ptr +SketchAPI_Sketch::setCollinear(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintCollinear::ID()); - fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(theLine1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setDistance( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & thePointOrLine, - const ModelHighAPI_Double & theValue, - bool isSigned) -{ +std::shared_ptr +SketchAPI_Sketch::setDistance(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &thePointOrLine, + const ModelHighAPI_Double &theValue, + bool isSigned) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintDistance::ID()); - fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(thePointOrLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(thePoint, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(thePointOrLine, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); - fillAttribute(isSigned, aFeature->boolean(SketchPlugin_ConstraintDistance::SIGNED())); + fillAttribute(isSigned, + aFeature->boolean(SketchPlugin_ConstraintDistance::SIGNED())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setSignedDistance( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & thePointOrLine, - const ModelHighAPI_Double & theValue) -{ +std::shared_ptr +SketchAPI_Sketch::setSignedDistance(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &thePointOrLine, + const ModelHighAPI_Double &theValue) { return setDistance(thePoint, thePointOrLine, theValue, true); } std::shared_ptr SketchAPI_Sketch::setUnsignedDistance( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & thePointOrLine, - const ModelHighAPI_Double & theValue) -{ + const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &thePointOrLine, + const ModelHighAPI_Double &theValue) { return setDistance(thePoint, thePointOrLine, theValue, false); } -std::shared_ptr SketchAPI_Sketch::setHorizontalDistance( - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Double & theValue) -{ - std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_ConstraintDistanceHorizontal::ID()); - fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); - fillAttribute(theValue, - aFeature->real(SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID())); +std::shared_ptr +SketchAPI_Sketch::setHorizontalDistance(const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Double &theValue) { + std::shared_ptr aFeature = compositeFeature()->addFeature( + SketchPlugin_ConstraintDistanceHorizontal::ID()); + fillAttribute(thePoint1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(thePoint2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute( + theValue, + aFeature->real( + SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setVerticalDistance( - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Double & theValue) -{ - std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_ConstraintDistanceVertical::ID()); - fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); - fillAttribute(theValue, - aFeature->real(SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID())); +std::shared_ptr +SketchAPI_Sketch::setVerticalDistance(const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Double &theValue) { + std::shared_ptr aFeature = compositeFeature()->addFeature( + SketchPlugin_ConstraintDistanceVertical::ID()); + fillAttribute(thePoint1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(thePoint2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute( + theValue, + aFeature->real( + SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setEqual( - const ModelHighAPI_RefAttr & theObject1, - const ModelHighAPI_RefAttr & theObject2) -{ +std::shared_ptr +SketchAPI_Sketch::setEqual(const ModelHighAPI_RefAttr &theObject1, + const ModelHighAPI_RefAttr &theObject2) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintEqual::ID()); - fillAttribute(theObject1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theObject2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(theObject1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theObject2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setFillet( - const ModelHighAPI_RefAttr & thePoint) -{ +std::shared_ptr +SketchAPI_Sketch::setFillet(const ModelHighAPI_RefAttr &thePoint) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Fillet::ID()); - fillAttribute(thePoint, aFeature->data()->refattr(SketchPlugin_Fillet::FILLET_POINT_ID())); + fillAttribute(thePoint, aFeature->data()->refattr( + SketchPlugin_Fillet::FILLET_POINT_ID())); apply(); // finish operation to remove Fillet feature correcly return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setFilletWithRadius( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_Double & theRadius) -{ +std::shared_ptr +SketchAPI_Sketch::setFilletWithRadius(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_Double &theRadius) { CompositeFeaturePtr aSketch = compositeFeature(); int aNbSubs = aSketch->numberOfSubs(); @@ -1324,136 +1302,143 @@ std::shared_ptr SketchAPI_Sketch::setFilletWithRadius( // set radius for just created arc FeaturePtr anArc = aSketch->subFeature(aNbSubs - 1); if (anArc->getKind() == SketchPlugin_Arc::ID()) - setRadius(ModelHighAPI_RefAttr(ObjectPtr(anArc->lastResult())), ModelHighAPI_Double(theRadius)); + setRadius(ModelHighAPI_RefAttr(ObjectPtr(anArc->lastResult())), + ModelHighAPI_Double(theRadius)); return aFilletFeature; } -std::shared_ptr SketchAPI_Sketch::setFixed( - const ModelHighAPI_RefAttr & theObject) -{ +std::shared_ptr +SketchAPI_Sketch::setFixed(const ModelHighAPI_RefAttr &theObject) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID()); - fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theObject, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setHorizontal( - const ModelHighAPI_RefAttr & theLine) -{ +std::shared_ptr +SketchAPI_Sketch::setHorizontal(const ModelHighAPI_RefAttr &theLine) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintHorizontal::ID()); - fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setLength( - const ModelHighAPI_RefAttr & theLine, - const ModelHighAPI_Double & theValue) -{ +std::shared_ptr +SketchAPI_Sketch::setLength(const ModelHighAPI_RefAttr &theLine, + const ModelHighAPI_Double &theValue) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintLength::ID()); - fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setMiddlePoint( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & theLine) -{ +std::shared_ptr +SketchAPI_Sketch::setMiddlePoint(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &theLine) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintMiddle::ID()); - auto aType = aFeature->data()->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE()); - fillAttribute(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE_AND_POINT(), aType); + auto aType = + aFeature->data()->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE()); + fillAttribute(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE_AND_POINT(), + aType); - fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(thePoint, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setMiddlePoint( - const ModelHighAPI_RefAttr& theLine) -{ +std::shared_ptr +SketchAPI_Sketch::setMiddlePoint(const ModelHighAPI_RefAttr &theLine) { std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_Point::ID()); + compositeFeature()->addFeature(SketchPlugin_Point::ID()); ObjectPtr anObj = theLine.object(); auto aPoint = middlePoint(anObj, this); - return std::shared_ptr - (new SketchAPI_MacroMiddlePoint(aFeature, theLine, aPoint)); + return std::shared_ptr( + new SketchAPI_MacroMiddlePoint(aFeature, theLine, aPoint)); } -std::shared_ptr SketchAPI_Sketch::setParallel( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2) -{ +std::shared_ptr +SketchAPI_Sketch::setParallel(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintParallel::ID()); - fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(theLine1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setPerpendicular( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2) -{ - std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_ConstraintPerpendicular::ID()); - fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); +std::shared_ptr +SketchAPI_Sketch::setPerpendicular(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2) { + std::shared_ptr aFeature = compositeFeature()->addFeature( + SketchPlugin_ConstraintPerpendicular::ID()); + fillAttribute(theLine1, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine2, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setRadius( - const ModelHighAPI_RefAttr & theCircleOrArc, - const ModelHighAPI_Double & theValue) -{ +std::shared_ptr +SketchAPI_Sketch::setRadius(const ModelHighAPI_RefAttr &theCircleOrArc, + const ModelHighAPI_Double &theValue) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintRadius::ID()); - fillAttribute(theCircleOrArc, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theCircleOrArc, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setTangent( - const ModelHighAPI_RefAttr & theLine, - const ModelHighAPI_RefAttr & theCircle) -{ +std::shared_ptr +SketchAPI_Sketch::setTangent(const ModelHighAPI_RefAttr &theLine, + const ModelHighAPI_RefAttr &theCircle) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintTangent::ID()); - fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - fillAttribute(theCircle, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); + fillAttribute(theLine, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theCircle, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } -std::shared_ptr SketchAPI_Sketch::setVertical( - const ModelHighAPI_RefAttr & theLine) -{ +std::shared_ptr +SketchAPI_Sketch::setVertical(const ModelHighAPI_RefAttr &theLine) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintVertical::ID()); - fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + fillAttribute(theLine, + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); aFeature->execute(); return InterfacePtr(new ModelHighAPI_Interface(aFeature)); } //-------------------------------------------------------------------------------------- -void SketchAPI_Sketch::move(const ModelHighAPI_RefAttr& theMovedEntity, - const std::shared_ptr& theTargetPoint) -{ - std::shared_ptr aMessage(new ModelAPI_ObjectMovedMessage); +void SketchAPI_Sketch::move( + const ModelHighAPI_RefAttr &theMovedEntity, + const std::shared_ptr &theTargetPoint) { + std::shared_ptr aMessage( + new ModelAPI_ObjectMovedMessage); theMovedEntity.fillMessage(aMessage); std::shared_ptr anOriginalPosition; @@ -1470,39 +1455,44 @@ void SketchAPI_Sketch::move(const ModelHighAPI_RefAttr& theMovedEntity, Events_Loop::loop()->send(aMessage); } -void SketchAPI_Sketch::move(const ModelHighAPI_RefAttr& theMovedEntity, - double theTargetX, double theTargetY) -{ - std::shared_ptr aTargetPoint(new GeomAPI_Pnt2d(theTargetX, theTargetY)); +void SketchAPI_Sketch::move(const ModelHighAPI_RefAttr &theMovedEntity, + double theTargetX, double theTargetY) { + std::shared_ptr aTargetPoint( + new GeomAPI_Pnt2d(theTargetX, theTargetY)); move(theMovedEntity, aTargetPoint); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::to2D(const std::shared_ptr& thePoint) -{ +std::shared_ptr +SketchAPI_Sketch::to2D(const std::shared_ptr &thePoint) { FeaturePtr aBase = feature(); - std::shared_ptr aC = std::dynamic_pointer_cast( - aBase->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aBase->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aBase->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + std::shared_ptr aC = + std::dynamic_pointer_cast( + aBase->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aBase->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + aBase->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); return thePoint->to2D(aC->pnt(), aX->dir(), aY); } //-------------------------------------------------------------------------------------- -static bool isDifferent(GeomFacePtr theFace1, GeomFacePtr theFace2) -{ +static bool isDifferent(GeomFacePtr theFace1, GeomFacePtr theFace2) { // collect edges of the first face std::list anEdges1; - for (GeomAPI_ShapeExplorer anExp(theFace1, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) + for (GeomAPI_ShapeExplorer anExp(theFace1, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) anEdges1.push_back(anExp.current()); // compare edges of faces - for (GeomAPI_ShapeExplorer anExp(theFace2, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(theFace2, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { GeomShapePtr aCurrent = anExp.current(); bool isFound = false; std::list::iterator anIt1 = anEdges1.begin(); @@ -1518,10 +1508,10 @@ static bool isDifferent(GeomFacePtr theFace1, GeomFacePtr theFace2) return !anEdges1.empty(); } -static bool isCustomFacesOrder(CompositeFeaturePtr theSketch) -{ +static bool isCustomFacesOrder(CompositeFeaturePtr theSketch) { ResultConstructionPtr aSketchResult = - std::dynamic_pointer_cast(theSketch->lastResult()); + std::dynamic_pointer_cast( + theSketch->lastResult()); if (!aSketchResult) return false; @@ -1533,7 +1523,7 @@ static bool isCustomFacesOrder(CompositeFeaturePtr theSketch) // collect faces constructed by SketchBuilder algorithm GeomAlgoAPI_SketchBuilder aSketchBuilder(aWires->origin(), aWires->dirX(), aWires->norm(), aWires); - const ListOfShape& aFaces = aSketchBuilder.faces(); + const ListOfShape &aFaces = aSketchBuilder.faces(); // compare faces stored in sketch with faces generated by SketchBuilder int aNbSketchFaces = aSketchResult->facesNum(); @@ -1550,10 +1540,10 @@ static bool isCustomFacesOrder(CompositeFeaturePtr theSketch) } static void edgesOfSketchFaces(CompositeFeaturePtr theSketch, - std::list >& theEdges) -{ + std::list> &theEdges) { ResultConstructionPtr aSketchResult = - std::dynamic_pointer_cast(theSketch->lastResult()); + std::dynamic_pointer_cast( + theSketch->lastResult()); if (!aSketchResult) return; @@ -1562,7 +1552,7 @@ static void edgesOfSketchFaces(CompositeFeaturePtr theSketch, int aSubNum = theSketch->numberOfSubs(); for (int a = 0; a < aSubNum; ++a) { FeaturePtr aSub = theSketch->subFeature(a); - const std::list& aResults = aSub->results(); + const std::list &aResults = aSub->results(); std::list::const_iterator aRes = aResults.cbegin(); for (; aRes != aResults.cend(); aRes++) { GeomShapePtr aCurShape = (*aRes)->shape(); @@ -1575,11 +1565,11 @@ static void edgesOfSketchFaces(CompositeFeaturePtr theSketch, int aFacesNum = aSketchResult->facesNum(); for (int a = 0; a < aFacesNum; ++a) { theEdges.push_back(std::list()); - std::list& aCurEdges = theEdges.back(); + std::list &aCurEdges = theEdges.back(); GeomFacePtr aFace = aSketchResult->face(a); - for (GeomAPI_ShapeExplorer anExp(aFace, GeomAPI_Shape::EDGE); - anExp.more(); anExp.next()) { + for (GeomAPI_ShapeExplorer anExp(aFace, GeomAPI_Shape::EDGE); anExp.more(); + anExp.next()) { GeomCurvePtr aCurrent = untrimmedCurve(anExp.current()); aCurEdges.push_back(aCurves[aCurrent]); } @@ -1588,85 +1578,95 @@ static void edgesOfSketchFaces(CompositeFeaturePtr theSketch, //-------------------------------------------------------------------------------------- -void SketchAPI_Sketch::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Sketch::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aDocName = theDumper.name(aBase->document()); + const std::string &aDocName = theDumper.name(aBase->document()); - AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr anExternal = + aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (anExternal->value()) { - theDumper << aBase << " = model.addSketch(" << aDocName << - ", " << anExternal << ")" << std::endl; + theDumper << aBase << " = model.addSketch(" << aDocName << ", " + << anExternal << ")" << std::endl; } else { // Sketch is base on a plane. - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - aBase->attribute(SketchPlugin_Sketch::ORIGIN_ID()))->pnt(); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - aBase->attribute(SketchPlugin_Sketch::NORM_ID()))->dir(); - std::shared_ptr aDirX = std::dynamic_pointer_cast( - aBase->attribute(SketchPlugin_Sketch::DIRX_ID()))->dir(); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + aBase->attribute(SketchPlugin_Sketch::ORIGIN_ID())) + ->pnt(); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + aBase->attribute(SketchPlugin_Sketch::NORM_ID())) + ->dir(); + std::shared_ptr aDirX = + std::dynamic_pointer_cast( + aBase->attribute(SketchPlugin_Sketch::DIRX_ID())) + ->dir(); // Check the plane is coordinate plane std::wstring aPlaneName = defaultPlane(anOrigin, aNormal, aDirX); - if(anExternal->context()) { // checking for selected planes - if (!aPlaneName.empty() - && anExternal->context()->data() - && anExternal->context()->data()->name() == aPlaneName) { + if (anExternal->context()) { // checking for selected planes + if (!aPlaneName.empty() && anExternal->context()->data() && + anExternal->context()->data()->name() == aPlaneName) { // dump sketch based on coordinate plane theDumper << aBase << " = model.addSketch(" << aDocName - << ", model.standardPlane(\"" << aPlaneName << "\"))" << std::endl; + << ", model.standardPlane(\"" << aPlaneName << "\"))" + << std::endl; } else { // some other plane - theDumper << aBase << " = model.addSketch(" << aDocName << - ", " << anExternal<< ")" << std::endl; + theDumper << aBase << " = model.addSketch(" << aDocName << ", " + << anExternal << ")" << std::endl; } } else { if (aPlaneName.empty()) { // needs import additional module theDumper.importModule("GeomAPI"); // dump plane parameters - const std::string& aSketchName = theDumper.name(aBase); + const std::string &aSketchName = theDumper.name(aBase); std::string anOriginName = aSketchName + "_origin"; - std::string aNormalName = aSketchName + "_norm"; - std::string aDirXName = aSketchName + "_dirx"; + std::string aNormalName = aSketchName + "_norm"; + std::string aDirXName = aSketchName + "_dirx"; // use "\n" instead of std::endl to avoid automatic dumping sketch here // and then dumplicate dumping it in the next line theDumper << anOriginName << " = " << anOrigin << "\n" - << aNormalName << " = " << aNormal << "\n" - << aDirXName << " = " << aDirX << "\n"; + << aNormalName << " = " << aNormal << "\n" + << aDirXName << " = " << aDirX << "\n"; // dump sketch based on arbitrary plane - theDumper << aBase << " = model.addSketch(" << aDocName << ", GeomAPI_Ax3(" - << anOriginName << ", " << aDirXName << ", " << aNormalName << "))" << std::endl; + theDumper << aBase << " = model.addSketch(" << aDocName + << ", GeomAPI_Ax3(" << anOriginName << ", " << aDirXName + << ", " << aNormalName << "))" << std::endl; } else { // dump sketch based on coordinate plane theDumper << aBase << " = model.addSketch(" << aDocName - << ", model.defaultPlane(\"" << aPlaneName << "\"))" << std::endl; + << ", model.defaultPlane(\"" << aPlaneName << "\"))" + << std::endl; } } } // dump sketch's subfeatures - CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast(aBase); + CompositeFeaturePtr aCompFeat = + std::dynamic_pointer_cast(aBase); theDumper.processSubs(aCompFeat, true); // if face order differs to the order generated by SketchBuilder, // dump the list of faces for correct execution of the script if (isCustomFacesOrder(aCompFeat)) { - std::list > aFaces; + std::list> aFaces; edgesOfSketchFaces(aCompFeat, aFaces); - const std::string& aSketchName = theDumper.name(aBase); + const std::string &aSketchName = theDumper.name(aBase); std::string aMethodName(".changeFacesOrder"); std::string aSpaceShift(aSketchName.size() + aMethodName.size(), ' '); theDumper << aSketchName << aMethodName << "(["; - for (std::list >::iterator aFIt = aFaces.begin(); + for (std::list>::iterator aFIt = aFaces.begin(); aFIt != aFaces.end(); ++aFIt) { if (aFIt != aFaces.begin()) theDumper << ",\n" << aSpaceShift << " "; theDumper << *aFIt; } theDumper << "\n" << aSpaceShift << " ])" << std::endl; - // call model.do() for correct update of the document's labels related to the changed faces + // call model.do() for correct update of the document's labels related to + // the changed faces theDumper << "model.do()" << std::endl; } } diff --git a/src/SketchAPI/SketchAPI_Sketch.h b/src/SketchAPI/SketchAPI_Sketch.h index 993e6ef90..6ede2827e 100644 --- a/src/SketchAPI/SketchAPI_Sketch.h +++ b/src/SketchAPI/SketchAPI_Sketch.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ @@ -25,9 +26,9 @@ #include +#include #include #include -#include #include #include @@ -60,63 +61,61 @@ class SketchAPI_Translation; class SketchAPI_MacroMiddlePoint; //-------------------------------------------------------------------------------------- -typedef std::pair, ModelHighAPI_RefAttr> PointOrReference; +typedef std::pair, ModelHighAPI_RefAttr> + PointOrReference; //-------------------------------------------------------------------------------------- /**\class SketchAPI_Sketch * \ingroup CPPHighAPI * \brief Interface for Sketch feature */ -class SketchAPI_Sketch : public ModelHighAPI_Interface -{ +class SketchAPI_Sketch : public ModelHighAPI_Interface { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Sketch(const std::shared_ptr & theFeature); + explicit SketchAPI_Sketch( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Sketch(const std::shared_ptr & theFeature, - const std::shared_ptr & thePlane); + SketchAPI_Sketch(const std::shared_ptr &theFeature, + const std::shared_ptr &thePlane); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Sketch(const std::shared_ptr & theFeature, - const ModelHighAPI_Selection & theExternal); + SketchAPI_Sketch(const std::shared_ptr &theFeature, + const ModelHighAPI_Selection &theExternal); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Sketch(const std::shared_ptr & theFeature, + SketchAPI_Sketch(const std::shared_ptr &theFeature, std::shared_ptr thePlaneObject); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Sketch(); - INTERFACE_7(SketchPlugin_Sketch::ID(), - origin, SketchPlugin_Sketch::ORIGIN_ID(), - GeomDataAPI_Point, /** Origin point */, - dirX, SketchPlugin_Sketch::DIRX_ID(), - GeomDataAPI_Dir, /** Direction of X */, - normal, SketchPlugin_Sketch::NORM_ID(), - GeomDataAPI_Dir, /** Normal */, + INTERFACE_7(SketchPlugin_Sketch::ID(), origin, + SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, + /** Origin point */, dirX, SketchPlugin_Sketch::DIRX_ID(), + GeomDataAPI_Dir, /** Direction of X */, normal, + SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */, features, SketchPlugin_Sketch::FEATURES_ID(), - ModelAPI_AttributeRefList, /** Features */, - external, SketchPlugin_SketchEntity::EXTERNAL_ID(), - ModelAPI_AttributeSelection, /** External */, - solverError, SketchPlugin_Sketch::SOLVER_ERROR(), - ModelAPI_AttributeString, /** Solver error */, - solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), + ModelAPI_AttributeRefList, /** Features */, external, + SketchPlugin_SketchEntity::EXTERNAL_ID(), + ModelAPI_AttributeSelection, /** External */, solverError, + SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, + /** Solver error */, solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */ ) /// Set plane SKETCHAPI_EXPORT - void setPlane(const std::shared_ptr & thePlane); + void setPlane(const std::shared_ptr &thePlane); /// Change sketch plane SKETCHAPI_EXPORT - void setPlane(const ModelHighAPI_Selection & thePlane, + void setPlane(const ModelHighAPI_Selection &thePlane, bool theRemoveExternalDependency = false); /// Set external SKETCHAPI_EXPORT - void setExternal(const ModelHighAPI_Selection & theExternal); + void setExternal(const ModelHighAPI_Selection &theExternal); /// Set external SKETCHAPI_EXPORT @@ -124,471 +123,466 @@ public: /// Change order of sketch results (faces) SKETCHAPI_EXPORT - void changeFacesOrder(const std::list >& theFaces); + void changeFacesOrder( + const std::list> &theFaces); /// List points not connected by constraints with other sketch entitites SKETCHAPI_EXPORT - std::list< std::shared_ptr > getFreePoints(); + std::list> getFreePoints(); /// Add point SKETCHAPI_EXPORT - std::shared_ptr addPoint( - double theX, double theY); + std::shared_ptr addPoint(double theX, double theY); /// Add point SKETCHAPI_EXPORT - std::shared_ptr addPoint( - const std::shared_ptr & thePoint); + std::shared_ptr + addPoint(const std::shared_ptr &thePoint); /// Add point SKETCHAPI_EXPORT - std::shared_ptr addPoint(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addPoint(const ModelHighAPI_Selection &theExternal); /// Add point SKETCHAPI_EXPORT - std::shared_ptr addPoint(const std::wstring & theExternalName); + std::shared_ptr + addPoint(const std::wstring &theExternalName); /// Add intersection point SKETCHAPI_EXPORT std::shared_ptr - addIntersectionPoint(const ModelHighAPI_Selection & theExternal, - bool theKeepResult = false); + addIntersectionPoint(const ModelHighAPI_Selection &theExternal, + bool theKeepResult = false); /// Add point SKETCHAPI_EXPORT std::shared_ptr - addIntersectionPoint(const std::wstring & theExternalName, - bool theKeepResult = false); + addIntersectionPoint(const std::wstring &theExternalName, + bool theKeepResult = false); /// Add line SKETCHAPI_EXPORT - std::shared_ptr addLine( - double theX1, double theY1, double theX2, double theY2); + std::shared_ptr addLine(double theX1, double theY1, + double theX2, double theY2); /// Add line SKETCHAPI_EXPORT - std::shared_ptr addLine( - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint); + std::shared_ptr + addLine(const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint); /// Add line SKETCHAPI_EXPORT - std::shared_ptr addLine(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addLine(const ModelHighAPI_Selection &theExternal); /// Add line SKETCHAPI_EXPORT - std::shared_ptr addLine(const std::wstring & theExternalName); + std::shared_ptr addLine(const std::wstring &theExternalName); /// Add rectangle SKETCHAPI_EXPORT - std::shared_ptr addRectangle( - double theX1, double theY1, double theX2, double theY2); + std::shared_ptr addRectangle(double theX1, double theY1, + double theX2, double theY2); /// Add rectangle SKETCHAPI_EXPORT - std::shared_ptr addRectangle( - const std::shared_ptr & theStartPoint, - const std::shared_ptr & theEndPoint); + std::shared_ptr + addRectangle(const std::shared_ptr &theStartPoint, + const std::shared_ptr &theEndPoint); /// Add rectangle SKETCHAPI_EXPORT std::shared_ptr addRectangleCentered( - const std::pair, ModelHighAPI_RefAttr> & theCenter, - const std::pair, ModelHighAPI_RefAttr> & theCorner); + const std::pair, ModelHighAPI_RefAttr> + &theCenter, + const std::pair, ModelHighAPI_RefAttr> + &theCorner); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( - double theCenterX, double theCenterY, - double theRadius); + std::shared_ptr + addCircle(double theCenterX, double theCenterY, double theRadius); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( - const std::shared_ptr& theCenter, - double theRadius); + std::shared_ptr + addCircle(const std::shared_ptr &theCenter, double theRadius); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( - double theCenterX, double theCenterY, - double thePassedX, double thePassedY); + std::shared_ptr addCircle(double theCenterX, + double theCenterY, + double thePassedX, + double thePassedY); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( - const std::shared_ptr& theCenterPoint, - const std::shared_ptr& thePassedPoint); + std::shared_ptr + addCircle(const std::shared_ptr &theCenterPoint, + const std::shared_ptr &thePassedPoint); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( - double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3); + std::shared_ptr addCircle(double theX1, double theY1, + double theX2, double theY2, + double theX3, double theY3); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3); + std::shared_ptr + addCircle(const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addCircle(const ModelHighAPI_Selection &theExternal); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle(const std::wstring & theExternalName); + std::shared_ptr + addCircle(const std::wstring &theExternalName); /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc( - double theCenterX, double theCenterY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed); + std::shared_ptr addArc(double theCenterX, double theCenterY, + double theStartX, double theStartY, + double theEndX, double theEndY, + bool theInversed); /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc( - const std::shared_ptr& theCenter, - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - bool theInversed); + std::shared_ptr + addArc(const std::shared_ptr &theCenter, + const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, bool theInversed); /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc( - double theStartX, double theStartY, - double theEndX, double theEndY, - double thePassedX, double thePassedY); + std::shared_ptr addArc(double theStartX, double theStartY, + double theEndX, double theEndY, + double thePassedX, + double thePassedY); /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc( - const std::shared_ptr& theStart, - const std::shared_ptr& theEnd, - const std::shared_ptr& thePassed); + std::shared_ptr + addArc(const std::shared_ptr &theStart, + const std::shared_ptr &theEnd, + const std::shared_ptr &thePassed); /// Add transversal/tangent arc SKETCHAPI_EXPORT - std::shared_ptr addArc( - const ModelHighAPI_RefAttr& theConnectedPoint, - double theEndX, double theEndY, - bool theInversed, - bool theTransversal = false); + std::shared_ptr + addArc(const ModelHighAPI_RefAttr &theConnectedPoint, double theEndX, + double theEndY, bool theInversed, bool theTransversal = false); /// Add transversal/tangent arc SKETCHAPI_EXPORT - std::shared_ptr addArc( - const ModelHighAPI_RefAttr& theConnectedPoint, - const std::shared_ptr& theEnd, - bool theInversed, - bool theTransversal = false); + std::shared_ptr + addArc(const ModelHighAPI_RefAttr &theConnectedPoint, + const std::shared_ptr &theEnd, bool theInversed, + bool theTransversal = false); /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addArc(const ModelHighAPI_Selection &theExternal); /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc(const std::wstring & theExternalName); + std::shared_ptr addArc(const std::wstring &theExternalName); /// Add ellipse SKETCHAPI_EXPORT - std::shared_ptr addEllipse( - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theMinorRadius); + std::shared_ptr + addEllipse(double theCenterX, double theCenterY, double theFocusX, + double theFocusY, double theMinorRadius); /// Add ellipse SKETCHAPI_EXPORT - std::shared_ptr addEllipse( - const std::shared_ptr& theCenter, - const std::shared_ptr& theFocus, - double theRadius); + std::shared_ptr + addEllipse(const std::shared_ptr &theCenter, + const std::shared_ptr &theFocus, double theRadius); /// Add ellipse SKETCHAPI_EXPORT - std::shared_ptr addEllipse( - double thePoint1X, double thePoint1Y, - double thePoint2X, double thePoint2Y, - double thePassedX, double thePassedY, - bool isPoint1Center = true); + std::shared_ptr + addEllipse(double thePoint1X, double thePoint1Y, double thePoint2X, + double thePoint2Y, double thePassedX, double thePassedY, + bool isPoint1Center = true); /// Add ellipse SKETCHAPI_EXPORT std::shared_ptr addEllipse( - const PointOrReference& thePoint1, - const PointOrReference& thePoint2, - const PointOrReference& thePassedPoint, - bool isPoint1Center = true); + const PointOrReference &thePoint1, const PointOrReference &thePoint2, + const PointOrReference &thePassedPoint, bool isPoint1Center = true); /// Add ellipse SKETCHAPI_EXPORT - std::shared_ptr addEllipse(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addEllipse(const ModelHighAPI_Selection &theExternal); /// Add ellipse SKETCHAPI_EXPORT - std::shared_ptr addEllipse(const std::wstring & theExternalName); + std::shared_ptr + addEllipse(const std::wstring &theExternalName); /// Add elliptic arc SKETCHAPI_EXPORT - std::shared_ptr addEllipticArc( - double theCenterX, double theCenterY, - double theFocusX, double theFocusY, - double theStartX, double theStartY, - double theEndX, double theEndY, - bool theInversed = false); + std::shared_ptr + addEllipticArc(double theCenterX, double theCenterY, double theFocusX, + double theFocusY, double theStartX, double theStartY, + double theEndX, double theEndY, bool theInversed = false); /// Add elliptic arc SKETCHAPI_EXPORT - std::shared_ptr addEllipticArc( - const PointOrReference& theCenter, - const PointOrReference& theMajorAxisPoint, - const PointOrReference& theStartPoint, - const PointOrReference& theEndPoint, - bool theInversed = false); + std::shared_ptr + addEllipticArc(const PointOrReference &theCenter, + const PointOrReference &theMajorAxisPoint, + const PointOrReference &theStartPoint, + const PointOrReference &theEndPoint, bool theInversed = false); /// Add elliptic arc SKETCHAPI_EXPORT - std::shared_ptr addEllipticArc(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addEllipticArc(const ModelHighAPI_Selection &theExternal); /// Add elliptic arc SKETCHAPI_EXPORT - std::shared_ptr addEllipticArc(const std::wstring & theExternalName); + std::shared_ptr + addEllipticArc(const std::wstring &theExternalName); /// Add B-spline SKETCHAPI_EXPORT std::shared_ptr addSpline( - const ModelHighAPI_Selection & external = ModelHighAPI_Selection(), + const ModelHighAPI_Selection &external = ModelHighAPI_Selection(), const int degree = -1, - const std::list& poles = std::list(), - const std::list& weights = std::list(), - const std::list& knots = std::list(), - const std::list& multiplicities = std::list(), + const std::list &poles = std::list(), + const std::list &weights = + std::list(), + const std::list &knots = + std::list(), + const std::list &multiplicities = + std::list(), const bool periodic = false); /// Add interpolation feature SKETCHAPI_EXPORT - std::shared_ptr addInterpolation( - const std::list& points, - const bool periodic = false, - const bool closed = false); + std::shared_ptr + addInterpolation(const std::list &points, + const bool periodic = false, const bool closed = false); /// Add approximation feature SKETCHAPI_EXPORT std::shared_ptr addApproximation( - const std::list& points, - const ModelHighAPI_Double& precision = ModelHighAPI_Double(1.e-3), - const bool periodic = false, - const bool closed = false); + const std::list &points, + const ModelHighAPI_Double &precision = ModelHighAPI_Double(1.e-3), + const bool periodic = false, const bool closed = false); /// Add projection SKETCHAPI_EXPORT - std::shared_ptr addProjection( - const ModelHighAPI_Selection & theExternalFeature, - bool keepResult = false, - bool keepRefToOriginal = true); + std::shared_ptr + addProjection(const ModelHighAPI_Selection &theExternalFeature, + bool keepResult = false, bool keepRefToOriginal = true); /// Add mirror SKETCHAPI_EXPORT - std::shared_ptr addMirror( - const ModelHighAPI_RefAttr & theMirrorLine, - const std::list > & theObjects); + std::shared_ptr + addMirror(const ModelHighAPI_RefAttr &theMirrorLine, + const std::list> &theObjects); /// Add offset SKETCHAPI_EXPORT - std::shared_ptr addOffset( - const std::list > & theObjects, - const ModelHighAPI_Double & theValue, - const bool theReversed = false, - const std::string & theJointType = SketchPlugin_Offset::JOINT_KEEP_DISTANCE(), - const bool theApprox = false); + std::shared_ptr + addOffset(const std::list> &theObjects, + const ModelHighAPI_Double &theValue, const bool theReversed = false, + const std::string &theJointType = + SketchPlugin_Offset::JOINT_KEEP_DISTANCE(), + const bool theApprox = false); /// Add translation SKETCHAPI_EXPORT - std::shared_ptr addTranslation( - const std::list > & theObjects, - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue = false); + std::shared_ptr + addTranslation(const std::list> &theObjects, + const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Integer &theNumberOfObjects, + bool theFullValue = false); /// Add rotation SKETCHAPI_EXPORT - std::shared_ptr addRotation( - const std::list > & theObjects, - const ModelHighAPI_RefAttr & theCenter, - const ModelHighAPI_Double & theAngle, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue = false, - bool theReversed = false); + std::shared_ptr + addRotation(const std::list> &theObjects, + const ModelHighAPI_RefAttr &theCenter, + const ModelHighAPI_Double &theAngle, + const ModelHighAPI_Integer &theNumberOfObjects, + bool theFullValue = false, bool theReversed = false); /// Add split SKETCHAPI_EXPORT - std::shared_ptr addSplit( - const ModelHighAPI_Reference& theFeature, - const std::shared_ptr& thePositionPoint); + std::shared_ptr + addSplit(const ModelHighAPI_Reference &theFeature, + const std::shared_ptr &thePositionPoint); /// Add trim SKETCHAPI_EXPORT - std::shared_ptr addTrim( - const ModelHighAPI_Reference& theFeature, - const std::shared_ptr& thePositionPoint); + std::shared_ptr + addTrim(const ModelHighAPI_Reference &theFeature, + const std::shared_ptr &thePositionPoint); /// Set angle SKETCHAPI_EXPORT - std::shared_ptr setAngle( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue, - const std::string& type = std::string()); + std::shared_ptr + setAngle(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2, + const ModelHighAPI_Double &theValue, + const std::string &type = std::string()); /// Set complementary angle SKETCHAPI_EXPORT - std::shared_ptr setAngleComplementary( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setAngleComplementary(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2, + const ModelHighAPI_Double &theValue); /// Set backward angle (= 360 - angle) SKETCHAPI_EXPORT - std::shared_ptr setAngleBackward( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setAngleBackward(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2, + const ModelHighAPI_Double &theValue); /// Set coincident SKETCHAPI_EXPORT - std::shared_ptr setCoincident( - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2); + std::shared_ptr + setCoincident(const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2); /// Set collinear SKETCHAPI_EXPORT - std::shared_ptr setCollinear( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2); + std::shared_ptr + setCollinear(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2); /// Set distance SKETCHAPI_EXPORT - std::shared_ptr setDistance( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & thePointOrLine, - const ModelHighAPI_Double & theValue, - bool isSigned = false); + std::shared_ptr + setDistance(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &thePointOrLine, + const ModelHighAPI_Double &theValue, bool isSigned = false); /// Set signed distance SKETCHAPI_EXPORT - std::shared_ptr setSignedDistance( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & thePointOrLine, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setSignedDistance(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &thePointOrLine, + const ModelHighAPI_Double &theValue); /// Set unsigned distance SKETCHAPI_EXPORT - std::shared_ptr setUnsignedDistance( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & thePointOrLine, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setUnsignedDistance(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &thePointOrLine, + const ModelHighAPI_Double &theValue); /// Set horizontal distance SKETCHAPI_EXPORT - std::shared_ptr setHorizontalDistance( - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setHorizontalDistance(const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Double &theValue); /// Set vertical distance SKETCHAPI_EXPORT - std::shared_ptr setVerticalDistance( - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setVerticalDistance(const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Double &theValue); /// Set equal SKETCHAPI_EXPORT - std::shared_ptr setEqual( - const ModelHighAPI_RefAttr & theObject1, - const ModelHighAPI_RefAttr & theObject2); + std::shared_ptr + setEqual(const ModelHighAPI_RefAttr &theObject1, + const ModelHighAPI_RefAttr &theObject2); /// Set fillet SKETCHAPI_EXPORT - std::shared_ptr setFillet( - const ModelHighAPI_RefAttr & thePoint); + std::shared_ptr + setFillet(const ModelHighAPI_RefAttr &thePoint); /// Set fillet with additional radius constraint SKETCHAPI_EXPORT - std::shared_ptr setFilletWithRadius( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_Double & theRadius); + std::shared_ptr + setFilletWithRadius(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_Double &theRadius); /// Set fixed SKETCHAPI_EXPORT - std::shared_ptr setFixed( - const ModelHighAPI_RefAttr & theObject); + std::shared_ptr + setFixed(const ModelHighAPI_RefAttr &theObject); /// Set horizontal SKETCHAPI_EXPORT - std::shared_ptr setHorizontal( - const ModelHighAPI_RefAttr & theLine); + std::shared_ptr + setHorizontal(const ModelHighAPI_RefAttr &theLine); /// Set length SKETCHAPI_EXPORT - std::shared_ptr setLength( - const ModelHighAPI_RefAttr & theLine, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setLength(const ModelHighAPI_RefAttr &theLine, + const ModelHighAPI_Double &theValue); /// Set middle SKETCHAPI_EXPORT - std::shared_ptr setMiddlePoint( - const ModelHighAPI_RefAttr & thePoint, - const ModelHighAPI_RefAttr & theLine); + std::shared_ptr + setMiddlePoint(const ModelHighAPI_RefAttr &thePoint, + const ModelHighAPI_RefAttr &theLine); /// Set middle SKETCHAPI_EXPORT - std::shared_ptr setMiddlePoint( - const ModelHighAPI_RefAttr& theLine); + std::shared_ptr + setMiddlePoint(const ModelHighAPI_RefAttr &theLine); /// Set parallel SKETCHAPI_EXPORT - std::shared_ptr setParallel( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2); + std::shared_ptr + setParallel(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2); /// Set perpendicular SKETCHAPI_EXPORT - std::shared_ptr setPerpendicular( - const ModelHighAPI_RefAttr & theLine1, - const ModelHighAPI_RefAttr & theLine2); + std::shared_ptr + setPerpendicular(const ModelHighAPI_RefAttr &theLine1, + const ModelHighAPI_RefAttr &theLine2); /// Set radius SKETCHAPI_EXPORT - std::shared_ptr setRadius( - const ModelHighAPI_RefAttr & theCircleOrArc, - const ModelHighAPI_Double & theValue); + std::shared_ptr + setRadius(const ModelHighAPI_RefAttr &theCircleOrArc, + const ModelHighAPI_Double &theValue); /// Set tangent SKETCHAPI_EXPORT - std::shared_ptr setTangent( - const ModelHighAPI_RefAttr & theLine, - const ModelHighAPI_RefAttr & theCircle); + std::shared_ptr + setTangent(const ModelHighAPI_RefAttr &theLine, + const ModelHighAPI_RefAttr &theCircle); /// Set vertical SKETCHAPI_EXPORT - std::shared_ptr setVertical( - const ModelHighAPI_RefAttr & theLine); + std::shared_ptr + setVertical(const ModelHighAPI_RefAttr &theLine); /// Set constraint value SKETCHAPI_EXPORT - void setValue( - const std::shared_ptr & theConstraint, - const ModelHighAPI_Double & theValue); + void setValue(const std::shared_ptr &theConstraint, + const ModelHighAPI_Double &theValue); /// Move point or sketch feature SKETCHAPI_EXPORT - void move(const ModelHighAPI_RefAttr& theMovedEntity, - const std::shared_ptr& theTargetPoint); + void move(const ModelHighAPI_RefAttr &theMovedEntity, + const std::shared_ptr &theTargetPoint); /// Move point or sketch feature SKETCHAPI_EXPORT - void move(const ModelHighAPI_RefAttr& theMovedEntity, - double theTargetX, double theTargetY); + void move(const ModelHighAPI_RefAttr &theMovedEntity, double theTargetX, + double theTargetY); SKETCHAPI_EXPORT - std::shared_ptr to2D(const std::shared_ptr& thePoint); + std::shared_ptr + to2D(const std::shared_ptr &thePoint); - // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG) + // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to + // SWIG) /// Select face SKETCHAPI_EXPORT std::list selectFace() const; /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; protected: std::shared_ptr compositeFeature() const; - }; //! Pointer on Sketch object @@ -600,28 +594,28 @@ typedef std::shared_ptr SketchPtr; * \brief Create Sketch feature */ SKETCHAPI_EXPORT -SketchPtr addSketch(const std::shared_ptr & thePart, - const std::shared_ptr & thePlane); +SketchPtr addSketch(const std::shared_ptr &thePart, + const std::shared_ptr &thePlane); /**\ingroup CPPHighAPI * \brief Create Sketch feature */ SKETCHAPI_EXPORT -SketchPtr addSketch(const std::shared_ptr & thePart, - const ModelHighAPI_Selection & theExternal); +SketchPtr addSketch(const std::shared_ptr &thePart, + const ModelHighAPI_Selection &theExternal); /**\ingroup CPPHighAPI * \brief Create Sketch feature */ SKETCHAPI_EXPORT -SketchPtr addSketch(const std::shared_ptr & thePart, - const std::wstring & theExternalName); +SketchPtr addSketch(const std::shared_ptr &thePart, + const std::wstring &theExternalName); /**\ingroup CPPHighAPI * \brief Create Sketch feature */ SKETCHAPI_EXPORT -SketchPtr addSketch(const std::shared_ptr & thePart, +SketchPtr addSketch(const std::shared_ptr &thePart, std::shared_ptr thePlaneObject); //-------------------------------------------------------------------------------------- @@ -630,8 +624,8 @@ SketchPtr addSketch(const std::shared_ptr & thePart, * \brief Copy sketch with all its sub-features */ SKETCHAPI_EXPORT -SketchPtr copySketch(const std::shared_ptr & thePart, - const SketchPtr & theSketch); +SketchPtr copySketch(const std::shared_ptr &thePart, + const SketchPtr &theSketch); //-------------------------------------------------------------------------------------- #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */ diff --git a/src/SketchAPI/SketchAPI_SketchEntity.cpp b/src/SketchAPI/SketchAPI_SketchEntity.cpp index 1149084fd..510da9a3e 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.cpp +++ b/src/SketchAPI/SketchAPI_SketchEntity.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_SketchEntity.h" @@ -39,84 +40,86 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_SketchEntity::SketchAPI_SketchEntity( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } -SketchAPI_SketchEntity::~SketchAPI_SketchEntity() -{ - -} +SketchAPI_SketchEntity::~SketchAPI_SketchEntity() {} //-------------------------------------------------------------------------------------- -bool SketchAPI_SketchEntity::initialize() -{ - SET_ATTRIBUTE(Auxiliary, ModelAPI_AttributeBoolean, SketchPlugin_SketchEntity::AUXILIARY_ID()) +bool SketchAPI_SketchEntity::initialize() { + SET_ATTRIBUTE(Auxiliary, ModelAPI_AttributeBoolean, + SketchPlugin_SketchEntity::AUXILIARY_ID()) return true; } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_SketchEntity::auxiliary() const -{ +std::shared_ptr +SketchAPI_SketchEntity::auxiliary() const { return myAuxiliary; } -void SketchAPI_SketchEntity::setAuxiliary(bool theAuxiliary) -{ +void SketchAPI_SketchEntity::setAuxiliary(bool theAuxiliary) { fillAttribute(theAuxiliary, myAuxiliary); execute(); } //-------------------------------------------------------------------------------------- -void SketchAPI_SketchEntity::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_SketchEntity::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - AttributeBooleanPtr anAux = aBase->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); + AttributeBooleanPtr anAux = + aBase->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); if (anAux->value()) { - const std::string& aName = theDumper.name(aBase); - theDumper << aName << ".setAuxiliary(" << anAux << ")" <boolean(SketchPlugin_SketchEntity::COPY_ID()); - AttributeReferencePtr hasParent = feature()->reference(SketchPlugin_SketchEntity::PARENT_ID()); + AttributeBooleanPtr isCopy = + feature()->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeReferencePtr hasParent = + feature()->reference(SketchPlugin_SketchEntity::PARENT_ID()); return (isCopy.get() && isCopy->value()) || (hasParent && hasParent->value()); } -std::list > -SketchAPI_SketchEntity::wrap(const std::list >& theFeatures) -{ - std::list > aResult; - std::list >::const_iterator anIt = theFeatures.begin(); +std::list> SketchAPI_SketchEntity::wrap( + const std::list> &theFeatures) { + std::list> aResult; + std::list>::const_iterator anIt = + theFeatures.begin(); for (; anIt != theFeatures.end(); ++anIt) { if ((*anIt)->getKind() == SketchPlugin_Line::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Line(*anIt))); + aResult.push_back( + std::shared_ptr(new SketchAPI_Line(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_Arc::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Arc(*anIt))); + aResult.push_back( + std::shared_ptr(new SketchAPI_Arc(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_Circle::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Circle(*anIt))); + aResult.push_back( + std::shared_ptr(new SketchAPI_Circle(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_Ellipse::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Ellipse(*anIt))); + aResult.push_back(std::shared_ptr( + new SketchAPI_Ellipse(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_EllipticArc::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_EllipticArc(*anIt))); + aResult.push_back(std::shared_ptr( + new SketchAPI_EllipticArc(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_BSpline::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_BSpline(*anIt))); + aResult.push_back(std::shared_ptr( + new SketchAPI_BSpline(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_BSplinePeriodic::ID()) { + aResult.push_back(std::shared_ptr( + new SketchAPI_BSplinePeriodic(*anIt))); + } else if ((*anIt)->getKind() == SketchPlugin_Point::ID()) aResult.push_back( - std::shared_ptr(new SketchAPI_BSplinePeriodic(*anIt))); - } - else if ((*anIt)->getKind() == SketchPlugin_Point::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Point(*anIt))); + std::shared_ptr(new SketchAPI_Point(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_IntersectionPoint::ID()) aResult.push_back(std::shared_ptr( - new SketchAPI_IntersectionPoint(*anIt))); + new SketchAPI_IntersectionPoint(*anIt))); } return aResult; } diff --git a/src/SketchAPI/SketchAPI_SketchEntity.h b/src/SketchAPI/SketchAPI_SketchEntity.h index 4962bbf29..40c2664d4 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.h +++ b/src/SketchAPI/SketchAPI_SketchEntity.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCHENTITY_H_ @@ -34,12 +35,12 @@ class ModelAPI_Feature; * \ingroup CPPHighAPI * \brief Base class for Sketch feature interfaces */ -class SketchAPI_SketchEntity : public ModelHighAPI_Interface -{ +class SketchAPI_SketchEntity : public ModelHighAPI_Interface { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_SketchEntity(const std::shared_ptr & theFeature); + explicit SketchAPI_SketchEntity( + const std::shared_ptr &theFeature); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_SketchEntity(); @@ -53,12 +54,12 @@ public: void setAuxiliary(bool theAuxiliary); /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; /// Convert list of features to list of appropriate wrappers SKETCHAPI_EXPORT - static std::list > - wrap(const std::list >& theFeatures); + static std::list> + wrap(const std::list> &theFeatures); protected: std::shared_ptr myAuxiliary; diff --git a/src/SketchAPI/SketchAPI_Translation.cpp b/src/SketchAPI/SketchAPI_Translation.cpp index 04ddf5183..af7cab449 100644 --- a/src/SketchAPI/SketchAPI_Translation.cpp +++ b/src/SketchAPI/SketchAPI_Translation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchAPI_Translation.h" @@ -26,21 +27,18 @@ #include //-------------------------------------------------------------------------------------- SketchAPI_Translation::SketchAPI_Translation( - const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature) + : ModelHighAPI_Interface(theFeature) { initialize(); } SketchAPI_Translation::SketchAPI_Translation( - const std::shared_ptr & theFeature, - const std::list > & theObjects, - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue) -: ModelHighAPI_Interface(theFeature) -{ + const std::shared_ptr &theFeature, + const std::list> &theObjects, + const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue) + : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(thePoint1, startPoint()); fillAttribute(thePoint2, endPoint()); @@ -51,34 +49,32 @@ SketchAPI_Translation::SketchAPI_Translation( } } -SketchAPI_Translation::~SketchAPI_Translation() -{ -} +SketchAPI_Translation::~SketchAPI_Translation() {} void SketchAPI_Translation::setTranslationList( - const std::list >& theObjects) -{ + const std::list> &theObjects) { fillAttribute(theObjects, translationList()); execute(true); } -std::list > SketchAPI_Translation::translated() const -{ +std::list> +SketchAPI_Translation::translated() const { std::list aList = translatedObjects()->list(); // remove all initial features std::list anIntermediate; std::list::const_iterator anIt = aList.begin(); for (; anIt != aList.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeBooleanPtr isCopy = + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (isCopy.get() && isCopy->value()) anIntermediate.push_back(aFeature); } return SketchAPI_SketchEntity::wrap(anIntermediate); } -std::list > SketchAPI_Translation::translatedList() const -{ +std::list> +SketchAPI_Translation::translatedList() const { std::list aList = translationList()->list(); std::set anOriginalObjects; anOriginalObjects.insert(aList.begin(), aList.end()); @@ -90,7 +86,8 @@ std::list > SketchAPI_Translation::trans if (anOriginalObjects.find(*anIt) != anOriginalObjects.end()) continue; // skip initial object FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeBooleanPtr isCopy = + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (isCopy.get() && isCopy->value()) anIntermediate.push_back(aFeature); } @@ -99,44 +96,47 @@ std::list > SketchAPI_Translation::trans //-------------------------------------------------------------------------------------- -void SketchAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const -{ +void SketchAPI_Translation::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); - const std::string& aSketchName = theDumper.parentName(aBase); + const std::string &aSketchName = theDumper.parentName(aBase); AttributeRefListPtr aTransObjects = translationList(); AttributeRefAttrPtr aStart = startPoint(); - AttributeRefAttrPtr aEnd = endPoint(); + AttributeRefAttrPtr aEnd = endPoint(); AttributeIntegerPtr aNbCopies = numberOfObjects(); bool isFullValue = valueType()->value() != "SingleValue"; - // Check all attributes are already dumped. If not, store the constraint as postponed. + // Check all attributes are already dumped. If not, store the constraint as + // postponed. size_t aFirstNotDumped = theDumper.indexOfFirstNotDumped(aTransObjects); - if (!theDumper.isDumped(aStart) || !theDumper.isDumped(aEnd) || aFirstNotDumped == 0) { + if (!theDumper.isDumped(aStart) || !theDumper.isDumped(aEnd) || + aFirstNotDumped == 0) { theDumper.postpone(aBase); return; } // the number of dumped aTransObjects is not changed, no need to dump anything static std::map aNbDumpedArguments; - std::map::iterator aFound = aNbDumpedArguments.find(aBase); + std::map::iterator aFound = + aNbDumpedArguments.find(aBase); if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) { theDumper.postpone(aBase); return; - } - else + } else aNbDumpedArguments[aBase] = aFirstNotDumped; if (theDumper.isDumped(aBase)) { - // the feature is already dumped, but it was postponed, because of some arguments - // were not dumped yet, thus, it is necessary to update the list of rotated objects + // the feature is already dumped, but it was postponed, because of some + // arguments were not dumped yet, thus, it is necessary to update the list + // of rotated objects theDumper << "\n### Update " << aBase->getKind() << std::endl; - theDumper << aBase << ".setTranslationList(" << aTransObjects << ")" << std::endl; - } - else { + theDumper << aBase << ".setTranslationList(" << aTransObjects << ")" + << std::endl; + } else { // the feature is not dumped yet, make the full dump theDumper << aBase << " = " << aSketchName << ".addTranslation(" - << aTransObjects << ", " << aStart << ", " << aEnd << ", " << aNbCopies; + << aTransObjects << ", " << aStart << ", " << aEnd << ", " + << aNbCopies; if (isFullValue) theDumper << ", " << isFullValue; theDumper << ")" << std::endl; @@ -144,15 +144,18 @@ void SketchAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const // Dump variables for a list of translated features theDumper << "["; - std::list > aList = translatedList(); - std::list >::const_iterator anIt = aList.begin(); + std::list> aList = translatedList(); + std::list>::const_iterator anIt = + aList.begin(); for (size_t anIndex = 0; anIndex < aFirstNotDumped; ++anIndex) - for (int i = 1; i < aNbCopies->value() && anIt != aList.end(); ++i, ++anIt) { + for (int i = 1; i < aNbCopies->value() && anIt != aList.end(); + ++i, ++anIt) { if (anIt != aList.begin()) theDumper << ", "; theDumper << (*anIt)->feature(); } - theDumper << "] = " << theDumper.name(aBase) << ".translatedList()" << std::endl; + theDumper << "] = " << theDumper.name(aBase) << ".translatedList()" + << std::endl; if (theDumper.isDumped(aTransObjects)) { aNbDumpedArguments.erase(aBase); @@ -165,19 +168,22 @@ void SketchAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aFeature = ModelAPI_Feature::feature(*aTrIt); if (!aFeature) continue; - bool aBaseAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aBaseAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); for (int i = 1; i < aNbCopies->value(); ++i, ++anIt) { aFeature = (*anIt)->feature(); - bool aFeatAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value(); + bool aFeatAux = + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value(); if (aFeatAux != aBaseAux) theDumper << theDumper.name((*anIt)->feature(), false) << ".setAuxiliary(" << aFeatAux << ")" << std::endl; } } - } - else { - // If all refereced objects are not dumped yet, mark the feature as postponed. + } else { + // If all refereced objects are not dumped yet, mark the feature as + // postponed. theDumper.postpone(aBase); } } diff --git a/src/SketchAPI/SketchAPI_Translation.h b/src/SketchAPI/SketchAPI_Translation.h index a16f54724..2154bf4be 100644 --- a/src/SketchAPI/SketchAPI_Translation.h +++ b/src/SketchAPI/SketchAPI_Translation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_ @@ -39,36 +40,37 @@ class ModelHighAPI_RefAttr; * \ingroup CPPHighAPI * \brief Interface for Translation feature */ -class SketchAPI_Translation : public ModelHighAPI_Interface -{ +class SketchAPI_Translation : public ModelHighAPI_Interface { public: /// Constructor without values SKETCHAPI_EXPORT - explicit SketchAPI_Translation(const std::shared_ptr & theFeature); + explicit SketchAPI_Translation( + const std::shared_ptr &theFeature); /// Constructor with values SKETCHAPI_EXPORT - SketchAPI_Translation(const std::shared_ptr & theFeature, - const std::list > & theObjects, - const ModelHighAPI_RefAttr & thePoint1, - const ModelHighAPI_RefAttr & thePoint2, - const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue = false); + SketchAPI_Translation( + const std::shared_ptr &theFeature, + const std::list> &theObjects, + const ModelHighAPI_RefAttr &thePoint1, + const ModelHighAPI_RefAttr &thePoint2, + const ModelHighAPI_Integer &theNumberOfObjects, + bool theFullValue = false); /// Destructor SKETCHAPI_EXPORT virtual ~SketchAPI_Translation(); - INTERFACE_7(SketchPlugin_MultiTranslation::ID(), - translationList, SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID(), - ModelAPI_AttributeRefList, /** Translation list */, - startPoint, SketchPlugin_MultiTranslation::START_POINT_ID(), - ModelAPI_AttributeRefAttr, /** Start point */, - endPoint, SketchPlugin_MultiTranslation::END_POINT_ID(), - ModelAPI_AttributeRefAttr, /** Start point */, - numberOfObjects, SketchPlugin_MultiTranslation::NUMBER_OF_OBJECTS_ID(), - ModelAPI_AttributeInteger, /** Number of objects */, - valueType, SketchPlugin_MultiTranslation::VALUE_TYPE(), - ModelAPI_AttributeString, /** Value type */, - referenceObjects, SketchPlugin_MultiTranslation::ENTITY_A(), + INTERFACE_7(SketchPlugin_MultiTranslation::ID(), translationList, + SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID(), + ModelAPI_AttributeRefList, /** Translation list */, startPoint, + SketchPlugin_MultiTranslation::START_POINT_ID(), + ModelAPI_AttributeRefAttr, /** Start point */, endPoint, + SketchPlugin_MultiTranslation::END_POINT_ID(), + ModelAPI_AttributeRefAttr, /** Start point */, numberOfObjects, + SketchPlugin_MultiTranslation::NUMBER_OF_OBJECTS_ID(), + ModelAPI_AttributeInteger, /** Number of objects */, valueType, + SketchPlugin_MultiTranslation::VALUE_TYPE(), + ModelAPI_AttributeString, /** Value type */, referenceObjects, + SketchPlugin_MultiTranslation::ENTITY_A(), ModelAPI_AttributeRefList, /** Reference objects */, translatedObjects, SketchPlugin_MultiTranslation::ENTITY_B(), ModelAPI_AttributeRefList, /** Translationed objects */ @@ -76,19 +78,20 @@ public: /// Set list of objects to be translated SKETCHAPI_EXPORT - void setTranslationList(const std::list >& theObjects); + void setTranslationList( + const std::list> &theObjects); /// List of translated objects. /// [DEPRECATED]: use translatedList() instead. SKETCHAPI_EXPORT - std::list > translated() const; + std::list> translated() const; /// List of translated objects. SKETCHAPI_EXPORT - std::list > translatedList() const; + std::list> translatedList() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper& theDumper) const; + virtual void dump(ModelHighAPI_Dumper &theDumper) const; }; //! Pointer on Translation object diff --git a/src/SketchAPI/SketchAPI_swig.h b/src/SketchAPI/SketchAPI_swig.h index 111782427..b14956028 100644 --- a/src/SketchAPI/SketchAPI_swig.h +++ b/src/SketchAPI/SketchAPI_swig.h @@ -14,37 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_SWIG_H_ #define SRC_SKETCHAPI_SKETCHAPI_SWIG_H_ - #include +#include - #include "SketchAPI.h" - #include "SketchAPI_Arc.h" - #include "SketchAPI_MacroArc.h" - #include "SketchAPI_Circle.h" - #include "SketchAPI_MacroCircle.h" - #include "SketchAPI_Ellipse.h" - #include "SketchAPI_MacroEllipse.h" - #include "SketchAPI_EllipticArc.h" - #include "SketchAPI_MacroEllipticArc.h" - #include "SketchAPI_BSpline.h" - #include "SketchAPI_Constraint.h" - #include "SketchAPI_ConstraintAngle.h" - #include "SketchAPI_IntersectionPoint.h" - #include "SketchAPI_Line.h" - #include "SketchAPI_Mirror.h" - #include "SketchAPI_Offset.h" - #include "SketchAPI_Sketch.h" - #include "SketchAPI_SketchEntity.h" - #include "SketchAPI_Point.h" - #include "SketchAPI_MacroMiddlePoint.h" - #include "SketchAPI_Projection.h" - #include "SketchAPI_Rectangle.h" - #include "SketchAPI_Rotation.h" - #include "SketchAPI_Translation.h" +#include "SketchAPI.h" +#include "SketchAPI_Arc.h" +#include "SketchAPI_BSpline.h" +#include "SketchAPI_Circle.h" +#include "SketchAPI_Constraint.h" +#include "SketchAPI_ConstraintAngle.h" +#include "SketchAPI_Ellipse.h" +#include "SketchAPI_EllipticArc.h" +#include "SketchAPI_IntersectionPoint.h" +#include "SketchAPI_Line.h" +#include "SketchAPI_MacroArc.h" +#include "SketchAPI_MacroCircle.h" +#include "SketchAPI_MacroEllipse.h" +#include "SketchAPI_MacroEllipticArc.h" +#include "SketchAPI_MacroMiddlePoint.h" +#include "SketchAPI_Mirror.h" +#include "SketchAPI_Offset.h" +#include "SketchAPI_Point.h" +#include "SketchAPI_Projection.h" +#include "SketchAPI_Rectangle.h" +#include "SketchAPI_Rotation.h" +#include "SketchAPI_Sketch.h" +#include "SketchAPI_SketchEntity.h" +#include "SketchAPI_Translation.h" #endif /* SRC_SKETCHAPI_SKETCHAPI_SWIG_H_ */ diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index b4a17bb4e..47b1ff997 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -202,7 +202,7 @@ ADD_RESTRICTED_TESTS( if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/SketchPlugin") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) @@ -211,11 +211,11 @@ if(${HAVE_SALOME}) install(FILES tests_change_radius.set DESTINATION ${TEST_INSTALL_DIRECTORY}) endif() install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) - + set(TMP_TESTS_NAMES) foreach(tfile ${TEST_NAMES}) list(APPEND TMP_TESTS_NAMES "Test/${tfile}") endforeach(tfile ${TEST_NAMES}) - + install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY}) endif(${HAVE_SALOME}) diff --git a/src/SketchPlugin/SketchPlugin.h b/src/SketchPlugin/SketchPlugin.h index cf0a87ea1..c4e0a50b3 100644 --- a/src/SketchPlugin/SketchPlugin.h +++ b/src/SketchPlugin/SketchPlugin.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SKETCHPLUGIN_H @@ -22,13 +23,13 @@ #if defined SKETCHPLUGIN_EXPORTS #if defined WIN32 -#define SKETCHPLUGIN_EXPORT __declspec( dllexport ) +#define SKETCHPLUGIN_EXPORT __declspec(dllexport) #else #define SKETCHPLUGIN_EXPORT #endif #else #if defined WIN32 -#define SKETCHPLUGIN_EXPORT __declspec( dllimport ) +#define SKETCHPLUGIN_EXPORT __declspec(dllimport) #else #define SKETCHPLUGIN_EXPORT #endif diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 0eb84450c..1e0845945 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Arc.h" @@ -23,32 +24,32 @@ #include #include -#include -#include #include #include #include #include +#include #include -#include +#include #include #include +#include #include -#include #include -#include +#include #include -#include +#include #include +#include #include #include #include -#include -#include -#include -#include #include +#include +#include +#include +#include // for sqrt on Linux #include @@ -56,48 +57,50 @@ static const double tolerance = 1e-7; static const double paramTolerance = 1.e-4; static const double PI = 3.141592653589793238463; - -SketchPlugin_Arc::SketchPlugin_Arc() -: SketchPlugin_SketchEntity() -{ +SketchPlugin_Arc::SketchPlugin_Arc() : SketchPlugin_SketchEntity() { myParamBefore = 0.0; } -void SketchPlugin_Arc::initDerivedClassAttributes() -{ +void SketchPlugin_Arc::initDerivedClassAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); - AttributeBooleanPtr isReversed = std::dynamic_pointer_cast( - data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId())); + AttributeBooleanPtr isReversed = + std::dynamic_pointer_cast(data()->addAttribute( + REVERSED_ID(), ModelAPI_AttributeBoolean::typeId())); data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - // set after all to avoid in attributeChanged reference to not existing attributes + // set after all to avoid in attributeChanged reference to not existing + // attributes if (!isReversed->isInitialized()) { isReversed->setValue(false); } } -void SketchPlugin_Arc::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { +void SketchPlugin_Arc::execute() { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return; } std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); std::shared_ptr aStartAttr = - std::dynamic_pointer_cast(data()->attribute(START_ID())); + std::dynamic_pointer_cast( + data()->attribute(START_ID())); std::shared_ptr anEndAttr = - std::dynamic_pointer_cast(data()->attribute(END_ID())); - if(!aCenterAttr->isInitialized() || !aStartAttr->isInitialized() || !anEndAttr->isInitialized()) { + std::dynamic_pointer_cast( + data()->attribute(END_ID())); + if (!aCenterAttr->isInitialized() || !aStartAttr->isInitialized() || + !anEndAttr->isInitialized()) { return; } @@ -105,12 +108,17 @@ void SketchPlugin_Arc::execute() SketchPlugin_Sketch::createPoint2DResult(this, sketch(), CENTER_ID(), 0); // Make a visible arc. - std::shared_ptr aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); - std::shared_ptr aStart(aSketch->to3D(aStartAttr->x(), aStartAttr->y())); - std::shared_ptr anEnd(aSketch->to3D(anEndAttr->x(), anEndAttr->y())); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); + std::shared_ptr aCenter( + aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); + std::shared_ptr aStart( + aSketch->to3D(aStartAttr->x(), aStartAttr->y())); + std::shared_ptr anEnd( + aSketch->to3D(anEndAttr->x(), anEndAttr->y())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal( + new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); if (myParamBefore == 0) { // parameter has not been calculate yet std::shared_ptr aCircleForArc( @@ -122,24 +130,30 @@ void SketchPlugin_Arc::execute() GeomEdgePtr anArcShape; if (fabs(myParamBefore - 2.0 * PI) < paramTolerance) { - anArcShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aStart->distance(aCenter)); + anArcShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, + aStart->distance(aCenter)); myParamBefore = 0; } else { - anArcShape = isReversed ? - GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, anEnd, aStart, aNormal) - : GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStart, anEnd, aNormal); + anArcShape = isReversed + ? GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, anEnd, + aStart, aNormal) + : GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStart, + anEnd, aNormal); } - // calculate tolerances for start and end points of the arc and set them to the result shape - // (this is done to fix gaps which appear because of inaccurate computation of arcs in PlaneGCS, - // which leads to difference in SketchPlugin_Arc attributes and boundary points of result shape) + // calculate tolerances for start and end points of the arc and set them to + // the result shape (this is done to fix gaps which appear because of + // inaccurate computation of arcs in PlaneGCS, which leads to difference in + // SketchPlugin_Arc attributes and boundary points of result shape) if (anArcShape) { for (int ind = 0; ind < 2; ++ind) { bool isFirst = ind == 0; GeomPointPtr anArcBndPoint = isFirst == isReversed ? anEnd : aStart; - GeomPointPtr aShapePoint = isFirst ? anArcShape->firstPoint() : anArcShape->lastPoint(); + GeomPointPtr aShapePoint = + isFirst ? anArcShape->firstPoint() : anArcShape->lastPoint(); double aDistance = anArcBndPoint->distance(aShapePoint); - // avoid setting too high tolerance because it may be caused by incomplete update of an arc + // avoid setting too high tolerance because it may be caused by incomplete + // update of an arc if (aDistance > tolerance && aDistance < 100. * tolerance) { if (isFirst) anArcShape->setFirstPointTolerance(aDistance); @@ -149,41 +163,44 @@ void SketchPlugin_Arc::execute() } } - std::shared_ptr aResult = document()->createConstruction(data(), 1); + std::shared_ptr aResult = + document()->createConstruction(data(), 1); aResult->setShape(anArcShape); aResult->setIsInHistory(false); setResult(aResult, 1); } -bool SketchPlugin_Arc::isFixed() -{ +bool SketchPlugin_Arc::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_Arc::attributeChanged(const std::string& theID) -{ - std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(CENTER_ID())); - std::shared_ptr aStartAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(START_ID())); - std::shared_ptr anEndAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(END_ID())); +void SketchPlugin_Arc::attributeChanged(const std::string &theID) { + std::shared_ptr aCenterAttr = + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); + std::shared_ptr aStartAttr = + std::dynamic_pointer_cast( + data()->attribute(START_ID())); + std::shared_ptr anEndAttr = + std::dynamic_pointer_cast( + data()->attribute(END_ID())); // The second condition for unability to move external segments anywhere. - if(theID == EXTERNAL_ID() || isFixed()) { - std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); - if(!aSelection) { + if (theID == EXTERNAL_ID() || isFixed()) { + std::shared_ptr aSelection = + data()->selection(EXTERNAL_ID())->value(); + if (!aSelection) { // empty shape in selection shows that the shape is equal to context ResultPtr anExtRes = selection(EXTERNAL_ID())->context(); - if(anExtRes) { + if (anExtRes) { aSelection = anExtRes->shape(); } } // update arguments due to the selection value - if(aSelection && !aSelection->isNull() && aSelection->isEdge()) { - std::shared_ptr anEdge( new GeomAPI_Edge(aSelection)); + if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { + std::shared_ptr anEdge(new GeomAPI_Edge(aSelection)); std::shared_ptr aCirc = anEdge->circle(); - if(aCirc.get()) { + if (aCirc.get()) { bool aWasBlocked = data()->blockSendAttributeUpdated(true); aCenterAttr->setValue(sketch()->to2D(aCirc->center())); aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint())); @@ -191,17 +208,18 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) data()->blockSendAttributeUpdated(aWasBlocked, false); std::shared_ptr aCircle2d = - std::shared_ptr(new GeomAPI_Circ2d(aCenterAttr->pnt(), - aStartAttr->pnt())); + std::shared_ptr( + new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt())); double anEndParam = 0.0; aCircle2d->parameter(anEndAttr->pnt(), paramTolerance, anEndParam); myParamBefore = anEndParam; - double aMidParam = anEndParam / 2.0; + double aMidParam = anEndParam / 2.0; std::shared_ptr aMidPnt2d; aCircle2d->D0(aMidParam, aMidPnt2d); - std::shared_ptr aMinPnt = sketch()->to3D(aMidPnt2d->x(), aMidPnt2d->y()); + std::shared_ptr aMinPnt = + sketch()->to3D(aMidPnt2d->x(), aMidPnt2d->y()); double aStartParam = 0.0; aCirc->parameter(anEdge->firstPoint(), paramTolerance, aStartParam); aCirc->parameter(aMinPnt, paramTolerance, aMidParam); @@ -216,7 +234,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) aMidParam += 2.0 * PI; aWasBlocked = data()->blockSendAttributeUpdated(true); - if(aMidParam < anEndParam) { + if (aMidParam < anEndParam) { setReversed(false); } else { setReversed(true); @@ -224,10 +242,9 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) data()->blockSendAttributeUpdated(aWasBlocked, false); } } - } else if(theID == CENTER_ID() || theID == START_ID() || theID == END_ID()) { - if(!aCenterAttr->isInitialized() - || !aStartAttr->isInitialized() - || !anEndAttr->isInitialized()) { + } else if (theID == CENTER_ID() || theID == START_ID() || theID == END_ID()) { + if (!aCenterAttr->isInitialized() || !aStartAttr->isInitialized() || + !anEndAttr->isInitialized()) { return; } std::shared_ptr aCenter = aCenterAttr->pnt(); @@ -236,20 +253,21 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) double aRadius = aCenter->distance(aStart); if (aRadius < tolerance) return; - std::shared_ptr aCircleForArc(new GeomAPI_Circ2d(aCenter, aStart)); + std::shared_ptr aCircleForArc( + new GeomAPI_Circ2d(aCenter, aStart)); // Do not recalculate REVERSED flag if the arc is not consistent std::shared_ptr aProjection = aCircleForArc->project(anEnd); if (aProjection && anEnd->distance(aProjection) <= tolerance) { double aParameterNew = 0.0; - if(aCircleForArc->parameter(anEnd, paramTolerance, aParameterNew)) { + if (aCircleForArc->parameter(anEnd, paramTolerance, aParameterNew)) { bool aWasBlocked = data()->blockSendAttributeUpdated(true); - if(myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) { - if(!boolean(REVERSED_ID())->value()) { + if (myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) { + if (!boolean(REVERSED_ID())->value()) { boolean(REVERSED_ID())->setValue(true); } - } else if(myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) { - if(boolean(REVERSED_ID())->value()) { + } else if (myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) { + if (boolean(REVERSED_ID())->value()) { boolean(REVERSED_ID())->setValue(false); } } @@ -264,10 +282,10 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) double aRadius = 0; double anAngle = 0; - if(aCenterAttr->isInitialized() && aStartAttr->isInitialized()) { + if (aCenterAttr->isInitialized() && aStartAttr->isInitialized()) { aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); - if(anEndAttr->isInitialized()) { - if(aStartAttr->pnt()->isEqual(anEndAttr->pnt())) { + if (anEndAttr->isInitialized()) { + if (aStartAttr->pnt()->isEqual(anEndAttr->pnt())) { anAngle = 360; } else { GeomAPI_Circ2d aCircleForArc(aCenterAttr->pnt(), aStartAttr->pnt()); @@ -275,7 +293,8 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) aCircleForArc.parameter(aStartAttr->pnt(), paramTolerance, aStartParam); aCircleForArc.parameter(anEndAttr->pnt(), paramTolerance, anEndParam); anAngle = (anEndParam - aStartParam) / PI * 180.0; - if(isReversed()) anAngle = 360.0 - anAngle; + if (isReversed()) + anAngle = 360.0 - anAngle; } } } @@ -286,12 +305,8 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) data()->blockSendAttributeUpdated(aWasBlocked, false); } -void SketchPlugin_Arc::setReversed(bool isReversed) -{ +void SketchPlugin_Arc::setReversed(bool isReversed) { boolean(REVERSED_ID())->setValue(isReversed); } -bool SketchPlugin_Arc::isReversed() -{ - return boolean(REVERSED_ID())->value(); -} +bool SketchPlugin_Arc::isReversed() { return boolean(REVERSED_ID())->value(); } diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index 57cf7654d..9c5dd8f72 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Arc_H_ @@ -24,70 +25,60 @@ #include "SketchPlugin_SketchEntity.h" - - /**\class SketchPlugin_Arc * \ingroup Plugins * \brief Feature for creation of the new arc of circle in PartSet. - * The visualization of this object is separated in two parts. The first one is an AIS object - * calculated when there is non-initialized attributes of the arc. The second is a result and - * it is calculated if all attributes are initialized. + * The visualization of this object is separated in two parts. The first one is + * an AIS object calculated when there is non-initialized attributes of the arc. + * The second is a result and it is calculated if all attributes are + * initialized. */ -class SketchPlugin_Arc: public SketchPlugin_SketchEntity -{ - public: +class SketchPlugin_Arc : public SketchPlugin_SketchEntity { +public: /// Arc feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchArc"); return ID; } /// Central 2D point of the circle which contains the arc - inline static const std::string& CENTER_ID() - { + inline static const std::string &CENTER_ID() { static const std::string ID = "center_point"; return ID; } /// Start 2D point of the arc - inline static const std::string& START_ID() - { + inline static const std::string &START_ID() { static const std::string ID = "start_point"; return ID; } /// End 2D point of the arc - inline static const std::string& END_ID() - { + inline static const std::string &END_ID() { static const std::string ID = "end_point"; return ID; } /// Arc radius. - static const std::string& RADIUS_ID() - { + static const std::string &RADIUS_ID() { static const std::string ID("radius"); return ID; } /// Arc angle. - static const std::string& ANGLE_ID() - { + static const std::string &ANGLE_ID() { static const std::string ID("angle"); return ID; } /// Reversed flag - inline static const std::string& REVERSED_ID() - { + inline static const std::string &REVERSED_ID() { static const std::string ID("reversed"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Arc::ID(); return MY_KIND; } @@ -97,7 +88,7 @@ class SketchPlugin_Arc: public SketchPlugin_SketchEntity /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates an arc-shape SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_BSpline.cpp b/src/SketchPlugin/SketchPlugin_BSpline.cpp index a41b2dad3..1b35209d9 100644 --- a/src/SketchPlugin/SketchPlugin_BSpline.cpp +++ b/src/SketchPlugin/SketchPlugin_BSpline.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,29 +23,24 @@ #include #include +SketchPlugin_BSpline::SketchPlugin_BSpline() : SketchPlugin_BSplineBase() {} -SketchPlugin_BSpline::SketchPlugin_BSpline() - : SketchPlugin_BSplineBase() -{ -} - -void SketchPlugin_BSpline::initDerivedClassAttributes() -{ +void SketchPlugin_BSpline::initDerivedClassAttributes() { data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId()); SketchPlugin_BSplineBase::initDerivedClassAttributes(); } -void SketchPlugin_BSpline::attributeChanged(const std::string& theID) { +void SketchPlugin_BSpline::attributeChanged(const std::string &theID) { if (theID == POLES_ID()) { AttributePoint2DArrayPtr aPolesArray = - std::dynamic_pointer_cast(attribute(POLES_ID())); - std::dynamic_pointer_cast( - attribute(START_ID()))->setValue(aPolesArray->pnt(0)); - std::dynamic_pointer_cast( - attribute(END_ID()))->setValue(aPolesArray->pnt(aPolesArray->size() - 1)); - } - else + std::dynamic_pointer_cast( + attribute(POLES_ID())); + std::dynamic_pointer_cast(attribute(START_ID())) + ->setValue(aPolesArray->pnt(0)); + std::dynamic_pointer_cast(attribute(END_ID())) + ->setValue(aPolesArray->pnt(aPolesArray->size() - 1)); + } else SketchPlugin_BSplineBase::attributeChanged(theID); } diff --git a/src/SketchPlugin/SketchPlugin_BSpline.h b/src/SketchPlugin/SketchPlugin_BSpline.h index 5e503d03f..ec3dd265b 100644 --- a/src/SketchPlugin/SketchPlugin_BSpline.h +++ b/src/SketchPlugin/SketchPlugin_BSpline.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_BSpline_H_ @@ -26,38 +27,33 @@ * \ingroup Plugins * \brief Feature for creation of the B-spline curve in the sketch. */ -class SketchPlugin_BSpline : public SketchPlugin_BSplineBase -{ +class SketchPlugin_BSpline : public SketchPlugin_BSplineBase { public: /// B-spline feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchBSpline"); return ID; } /// start point of B-spline curve - inline static const std::string& START_ID() - { + inline static const std::string &START_ID() { static const std::string ID("start_point"); return ID; } /// end point of B-spline curve - inline static const std::string& END_ID() - { + inline static const std::string &END_ID() { static const std::string ID("end_point"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_BSpline::ID(); return MY_KIND; } /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation SketchPlugin_BSpline(); diff --git a/src/SketchPlugin/SketchPlugin_BSplineBase.cpp b/src/SketchPlugin/SketchPlugin_BSplineBase.cpp index f69a894b8..d54bc7d73 100644 --- a/src/SketchPlugin/SketchPlugin_BSplineBase.cpp +++ b/src/SketchPlugin/SketchPlugin_BSplineBase.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -43,14 +44,10 @@ #include #include - SketchPlugin_BSplineBase::SketchPlugin_BSplineBase() - : SketchPlugin_SketchEntity() -{ -} + : SketchPlugin_SketchEntity() {} -void SketchPlugin_BSplineBase::initDerivedClassAttributes() -{ +void SketchPlugin_BSplineBase::initDerivedClassAttributes() { data()->addAttribute(POLES_ID(), GeomDataAPI_Point2DArray::typeId()); data()->addAttribute(WEIGHTS_ID(), ModelAPI_AttributeDoubleArray::typeId()); data()->addAttribute(KNOTS_ID(), ModelAPI_AttributeDoubleArray::typeId()); @@ -58,18 +55,19 @@ void SketchPlugin_BSplineBase::initDerivedClassAttributes() data()->addAttribute(DEGREE_ID(), ModelAPI_AttributeInteger::typeId()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); } -void SketchPlugin_BSplineBase::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { +void SketchPlugin_BSplineBase::execute() { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return; } AttributePoint2DArrayPtr aPolesArray = - std::dynamic_pointer_cast(attribute(POLES_ID())); + std::dynamic_pointer_cast( + attribute(POLES_ID())); AttributeDoubleArrayPtr aWeightsArray = data()->realArray(WEIGHTS_ID()); AttributeDoubleArrayPtr aKnotsArray = data()->realArray(KNOTS_ID()); AttributeIntArrayPtr aMultsArray = data()->intArray(MULTS_ID()); @@ -95,8 +93,9 @@ void SketchPlugin_BSplineBase::execute() aMults.push_back(aMultsArray->value(anIndex)); // create result B-spline curve - GeomShapePtr anEdge = GeomAlgoAPI_EdgeBuilder::bsplineOnPlane(aSketch->coordinatePlane(), - aPoles2D, aWeights, aKnots, aMults, aDegreeAttr->value(), isPeriodic()); + GeomShapePtr anEdge = GeomAlgoAPI_EdgeBuilder::bsplineOnPlane( + aSketch->coordinatePlane(), aPoles2D, aWeights, aKnots, aMults, + aDegreeAttr->value(), isPeriodic()); ResultConstructionPtr aResult = document()->createConstruction(data(), 0); aResult->setShape(anEdge); @@ -108,12 +107,10 @@ bool SketchPlugin_BSplineBase::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_BSplineBase::attributeChanged(const std::string& /*theID*/) -{ +void SketchPlugin_BSplineBase::attributeChanged(const std::string & /*theID*/) { } -bool SketchPlugin_BSplineBase::customAction(const std::string& theActionId) -{ +bool SketchPlugin_BSplineBase::customAction(const std::string &theActionId) { // parse for the action and an index divided by '#' std::string anAction; int anIndex = -1; @@ -128,48 +125,61 @@ bool SketchPlugin_BSplineBase::customAction(const std::string& theActionId) } std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\"."; - Events_InfoMessage("SketchPlugin_BSplineBase", aMsg).arg(getKind()).arg(theActionId).send(); + Events_InfoMessage("SketchPlugin_BSplineBase", aMsg) + .arg(getKind()) + .arg(theActionId) + .send(); return false; } -bool SketchPlugin_BSplineBase::addPole(const int theAfter) -{ +bool SketchPlugin_BSplineBase::addPole(const int theAfter) { AttributePoint2DArrayPtr aPolesArray = - std::dynamic_pointer_cast(attribute(POLES_ID())); + std::dynamic_pointer_cast( + attribute(POLES_ID())); AttributeDoubleArrayPtr aWeightsArray = data()->realArray(WEIGHTS_ID()); - int anAfter = (!isPeriodic() && theAfter == aPolesArray->size() - 1) ? theAfter - 1 : theAfter; + int anAfter = (!isPeriodic() && theAfter == aPolesArray->size() - 1) + ? theAfter - 1 + : theAfter; // find internal coincidences applied to the poles with greater indices std::list aCoincidentPoleIndex; std::map aControlPoles, aControlSegments; bool hasAuxSegment = false; - const std::set& aRefs = data()->refsToMe(); - for (std::set::iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) { + const std::set &aRefs = data()->refsToMe(); + for (std::set::iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature((*anIt)->owner()); - if (aFeature->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { + if (aFeature->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { AttributeIntegerPtr anIndex; AttributeRefAttrPtr aNonSplinePoint; - if ((*anIt)->id() == SketchPlugin_ConstraintCoincidenceInternal::ENTITY_A()) { - anIndex = aFeature->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); - aNonSplinePoint = aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()); - } - else if ((*anIt)->id() == SketchPlugin_ConstraintCoincidenceInternal::ENTITY_B()) { - anIndex = aFeature->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); - aNonSplinePoint = aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()); + if ((*anIt)->id() == + SketchPlugin_ConstraintCoincidenceInternal::ENTITY_A()) { + anIndex = aFeature->integer( + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); + aNonSplinePoint = + aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()); + } else if ((*anIt)->id() == + SketchPlugin_ConstraintCoincidenceInternal::ENTITY_B()) { + anIndex = aFeature->integer( + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + aNonSplinePoint = + aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()); } if (anIndex && anIndex->isInitialized()) { if (anIndex->value() > anAfter) { aCoincidentPoleIndex.push_back(anIndex); - FeaturePtr aParent = ModelAPI_Feature::feature(aNonSplinePoint->attr()->owner()); + FeaturePtr aParent = + ModelAPI_Feature::feature(aNonSplinePoint->attr()->owner()); if (aParent->getKind() == SketchPlugin_Point::ID()) aControlPoles[anIndex->value()] = aParent; else if (aParent->getKind() == SketchPlugin_Line::ID() && - aNonSplinePoint->attr()->id() == SketchPlugin_Line::START_ID()) + aNonSplinePoint->attr()->id() == + SketchPlugin_Line::START_ID()) aControlSegments[anIndex->value()] = aParent; - } - else if (anIndex->value() == anAfter && !hasAuxSegment) { + } else if (anIndex->value() == anAfter && !hasAuxSegment) { // check the constrained object is a segment of the control polygon if (aNonSplinePoint && !aNonSplinePoint->isObject() && aNonSplinePoint->attr()->id() == SketchPlugin_Line::START_ID()) { @@ -188,7 +198,8 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) // add new pole and default weight std::list aPoles; aPolesArray->setSize(aPolesArray->size() + 1); - aPolesArray->setPnt(aPolesArray->size() - 1, aPolesArray->pnt(0)); // for periodic spline + aPolesArray->setPnt(aPolesArray->size() - 1, + aPolesArray->pnt(0)); // for periodic spline for (int i = aPolesArray->size() - 2; i > anAfter; --i) { aPoles.push_front(aPolesArray->pnt(i)); aPolesArray->setPnt(i + 1, aPoles.front()); @@ -197,7 +208,7 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) GeomPnt2dPtr aCurPole = aPolesArray->pnt(anAfter); GeomPnt2dPtr aNextPole = aPolesArray->pnt(anAfter + 1); aPolesArray->setPnt(anAfter + 1, (aCurPole->x() + aNextPole->x()) * 0.5, - (aCurPole->y() + aNextPole->y()) * 0.5); + (aCurPole->y() + aNextPole->y()) * 0.5); for (int i = anAfter + 1; i >= 0; --i) aPoles.push_front(aPolesArray->pnt(i)); @@ -218,7 +229,8 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) integer(DEGREE_ID())->setValue(aBSplineCurve->degree()); - AttributeDoubleArrayPtr aKnotsAttr = data()->realArray(SketchPlugin_BSplineBase::KNOTS_ID()); + AttributeDoubleArrayPtr aKnotsAttr = + data()->realArray(SketchPlugin_BSplineBase::KNOTS_ID()); std::list aKnots = aBSplineCurve->knots(); int aSize = (int)aKnots.size(); aKnotsAttr->setSize(aSize); @@ -226,7 +238,8 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) for (int index = 0; index < aSize; ++index, ++aKIt) aKnotsAttr->setValue(index, *aKIt); - AttributeIntArrayPtr aMultsAttr = data()->intArray(SketchPlugin_BSplineBase::MULTS_ID()); + AttributeIntArrayPtr aMultsAttr = + data()->intArray(SketchPlugin_BSplineBase::MULTS_ID()); std::list aMults = aBSplineCurve->mults(); aSize = (int)aMults.size(); aMultsAttr->setSize(aSize); @@ -237,24 +250,28 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) data()->blockSendAttributeUpdated(aWasBlocked, true); // update indices of internal coincidences - for (std::list::iterator aCIt = aCoincidentPoleIndex.begin(); + for (std::list::iterator aCIt = + aCoincidentPoleIndex.begin(); aCIt != aCoincidentPoleIndex.end(); ++aCIt) (*aCIt)->setValue((*aCIt)->value() + 1); // create auxiliary segment and pole updating the control polygon SketchPlugin_MacroBSpline::createAuxiliaryPole(aPolesArray, anAfter + 1); if (hasAuxSegment) - SketchPlugin_MacroBSpline::createAuxiliarySegment(aPolesArray, anAfter, anAfter + 1); + SketchPlugin_MacroBSpline::createAuxiliarySegment(aPolesArray, anAfter, + anAfter + 1); // update names of features representing control polygon for (std::map::iterator anIt = aControlPoles.begin(); anIt != aControlPoles.end(); ++anIt) { - SketchPlugin_MacroBSpline::assignDefaultNameForAux(anIt->second, aPolesArray, anIt->first + 1); + SketchPlugin_MacroBSpline::assignDefaultNameForAux( + anIt->second, aPolesArray, anIt->first + 1); } for (std::map::iterator anIt = aControlSegments.begin(); anIt != aControlSegments.end(); ++anIt) { - SketchPlugin_MacroBSpline::assignDefaultNameForAux(anIt->second, aPolesArray, - anIt->first + 1, (anIt->first + 2) % aPolesArray->size()); + SketchPlugin_MacroBSpline::assignDefaultNameForAux( + anIt->second, aPolesArray, anIt->first + 1, + (anIt->first + 2) % aPolesArray->size()); } return true; diff --git a/src/SketchPlugin/SketchPlugin_BSplineBase.h b/src/SketchPlugin/SketchPlugin_BSplineBase.h index 044dcc2a1..b98cb27d1 100644 --- a/src/SketchPlugin/SketchPlugin_BSplineBase.h +++ b/src/SketchPlugin/SketchPlugin_BSplineBase.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_BSplineBase_H_ @@ -27,47 +28,40 @@ * \ingroup Plugins * \brief Base class for B-spline curves in the sketch. */ -class SketchPlugin_BSplineBase : public SketchPlugin_SketchEntity -{ +class SketchPlugin_BSplineBase : public SketchPlugin_SketchEntity { public: /// list of B-spline poles - inline static const std::string& POLES_ID() - { + inline static const std::string &POLES_ID() { static const std::string ID("poles"); return ID; } /// list of B-spline weights - inline static const std::string& WEIGHTS_ID() - { + inline static const std::string &WEIGHTS_ID() { static const std::string ID("weights"); return ID; } /// attribute to store the degree of B-spline - inline static const std::string& DEGREE_ID() - { + inline static const std::string &DEGREE_ID() { static const std::string ID("degree"); return ID; } /// list of B-spline knots - inline static const std::string& KNOTS_ID() - { + inline static const std::string &KNOTS_ID() { static const std::string ID("knots"); return ID; } /// list of B-spline multiplicities - inline static const std::string& MULTS_ID() - { + inline static const std::string &MULTS_ID() { static const std::string ID("multiplicities"); return ID; } /// name for add pole action - inline static const std::string& ADD_POLE_ACTION_ID() - { + inline static const std::string &ADD_POLE_ACTION_ID() { static const std::string ID("AddPole"); return ID; } @@ -76,7 +70,7 @@ public: SKETCHPLUGIN_EXPORT virtual bool isFixed(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); @@ -84,7 +78,7 @@ public: /// Updates the B-spline curve. /// \param[in] theActionId action key id (in following form: Action#Index) /// \return \c false in case the action not performed. - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId); + SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); protected: /// Called from the derived class diff --git a/src/SketchPlugin/SketchPlugin_BSplinePeriodic.cpp b/src/SketchPlugin/SketchPlugin_BSplinePeriodic.cpp index f8947d2cd..0ccb635b5 100644 --- a/src/SketchPlugin/SketchPlugin_BSplinePeriodic.cpp +++ b/src/SketchPlugin/SketchPlugin_BSplinePeriodic.cpp @@ -14,12 +14,11 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include SketchPlugin_BSplinePeriodic::SketchPlugin_BSplinePeriodic() - : SketchPlugin_BSplineBase() -{ -} + : SketchPlugin_BSplineBase() {} diff --git a/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h b/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h index 2b33a2fde..5d248f637 100644 --- a/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h +++ b/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_BSplinePeriodic_H_ @@ -26,19 +27,16 @@ * \ingroup Plugins * \brief Feature for creation of the periodic B-spline curve in the sketch. */ -class SketchPlugin_BSplinePeriodic : public SketchPlugin_BSplineBase -{ +class SketchPlugin_BSplinePeriodic : public SketchPlugin_BSplineBase { public: /// B-spline feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchBSplinePeriodic"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_BSplinePeriodic::ID(); return MY_KIND; } diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index c0eecf508..cacf30453 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -14,66 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Circle.h" #include "SketchPlugin_Sketch.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 const double tolerance = 1e-7; +SketchPlugin_Circle::SketchPlugin_Circle() : SketchPlugin_SketchEntity() {} -SketchPlugin_Circle::SketchPlugin_Circle() -: SketchPlugin_SketchEntity() -{ -} - -void SketchPlugin_Circle::initDerivedClassAttributes() -{ +void SketchPlugin_Circle::initDerivedClassAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); } -void SketchPlugin_Circle::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { +void SketchPlugin_Circle::execute() { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return; } // Compute a circle in 3D view. std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); AttributeDoublePtr aRadiusAttr = real(RADIUS_ID()); - if(!aCenterAttr->isInitialized() || !aRadiusAttr->isInitialized()) { + if (!aCenterAttr->isInitialized() || !aRadiusAttr->isInitialized()) { return; } double aRadius = aRadiusAttr->value(); - if(aRadius < tolerance) { + if (aRadius < tolerance) { return; } @@ -81,15 +78,19 @@ void SketchPlugin_Circle::execute() SketchPlugin_Sketch::createPoint2DResult(this, sketch(), CENTER_ID(), 0); // Make a visible circle. - std::shared_ptr aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); + std::shared_ptr aCenter( + aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal( + new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); std::shared_ptr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius); - std::shared_ptr aResult = document()->createConstruction(data(), 1); + std::shared_ptr aResult = + document()->createConstruction(data(), 1); aResult->setShape(aCircleShape); aResult->setIsInHistory(false); setResult(aResult, 1); @@ -99,10 +100,11 @@ bool SketchPlugin_Circle::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_Circle::attributeChanged(const std::string& theID) { +void SketchPlugin_Circle::attributeChanged(const std::string &theID) { // the second condition for unability to move external segments anywhere if (theID == EXTERNAL_ID() || isFixed()) { - std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); + std::shared_ptr aSelection = + data()->selection(EXTERNAL_ID())->value(); if (!aSelection) { // empty shape in selection shows that the shape is equal to context ResultPtr anExtRes = selection(EXTERNAL_ID())->context(); @@ -111,10 +113,11 @@ void SketchPlugin_Circle::attributeChanged(const std::string& theID) { } // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { - std::shared_ptr anEdge( new GeomAPI_Edge(aSelection)); + std::shared_ptr anEdge(new GeomAPI_Edge(aSelection)); std::shared_ptr aCirc = anEdge->circle(); std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(attribute(CENTER_ID())); + std::dynamic_pointer_cast( + attribute(CENTER_ID())); aCenterAttr->setValue(sketch()->to2D(aCirc->center())); real(RADIUS_ID())->setValue(aCirc->radius()); } diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index c5035fba2..a637febf5 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -14,47 +14,43 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Circle_H_ #define SketchPlugin_Circle_H_ #include "SketchPlugin.h" -#include #include +#include /**\class SketchPlugin_Circle * \ingroup Plugins * \brief Feature for creation of the new circle in Sketch. */ -class SketchPlugin_Circle: public SketchPlugin_SketchEntity -{ - public: +class SketchPlugin_Circle : public SketchPlugin_SketchEntity { +public: /// Circle feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchCircle"); return ID; } /// 2D point - center of the circle - inline static const std::string& CENTER_ID() - { + inline static const std::string &CENTER_ID() { static const std::string ID("circle_center"); return ID; } /// Radius of the circle - inline static const std::string& RADIUS_ID() - { + inline static const std::string &RADIUS_ID() { static const std::string ID("circle_radius"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Circle::ID(); return MY_KIND; } @@ -63,7 +59,7 @@ class SketchPlugin_Circle: public SketchPlugin_SketchEntity SKETCHPLUGIN_EXPORT virtual bool isFixed(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_Constraint.cpp b/src/SketchPlugin/SketchPlugin_Constraint.cpp index 67d51b0f7..2a69fedfe 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.cpp +++ b/src/SketchPlugin/SketchPlugin_Constraint.cpp @@ -14,12 +14,10 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Constraint.h" -SketchPlugin_Constraint::SketchPlugin_Constraint() -{ - -} +SketchPlugin_Constraint::SketchPlugin_Constraint() {} diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 7b5723875..ab3118f53 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Constraint_H_ @@ -31,66 +32,58 @@ const int CONSTRAINT_ATTR_SIZE = 4; * \brief Abstract interface to the SketchPlugin_ConstraintBase * For more info see: SketchPlugin_ConstraintBase.h */ -class SketchPlugin_Constraint : public SketchPlugin_Feature -{ - public: +class SketchPlugin_Constraint : public SketchPlugin_Feature { +public: /// The value parameter for the constraint - inline static const std::string& VALUE() - { + inline static const std::string &VALUE() { static const std::string MY_CONSTRAINT_VALUE("ConstraintValue"); return MY_CONSTRAINT_VALUE; } /// The 2D value parameter for the constraint - inline static const std::string& FLYOUT_VALUE_PNT() - { + inline static const std::string &FLYOUT_VALUE_PNT() { static const std::string MY_FLYOUT_VALUE_PNT("ConstraintFlyoutValuePnt"); return MY_FLYOUT_VALUE_PNT; } /// First entity for the constraint - inline static const std::string& ENTITY_A() - { + inline static const std::string &ENTITY_A() { static const std::string MY_ENTITY_A("ConstraintEntityA"); return MY_ENTITY_A; } /// Second entity for the constraint - inline static const std::string& ENTITY_B() - { + inline static const std::string &ENTITY_B() { static const std::string MY_ENTITY_B("ConstraintEntityB"); return MY_ENTITY_B; } /// Third entity for the constraint - inline static const std::string& ENTITY_C() - { + inline static const std::string &ENTITY_C() { static const std::string MY_ENTITY_C("ConstraintEntityC"); return MY_ENTITY_C; } /// Fourth entity for the constraint - inline static const std::string& ENTITY_D() - { + inline static const std::string &ENTITY_D() { static const std::string MY_ENTITY_D("ConstraintEntityD"); return MY_ENTITY_D; } /// List of constraint attributes - inline static const std::string& ATTRIBUTE(const int theNumber) - { + inline static const std::string &ATTRIBUTE(const int theNumber) { switch (theNumber) { - case 0: - return ENTITY_A(); - case 1: - return ENTITY_B(); - case 2: - return ENTITY_C(); - case 3: - return ENTITY_D(); - default: - break; + case 0: + return ENTITY_A(); + case 1: + return ENTITY_B(); + case 2: + return ENTITY_C(); + case 3: + return ENTITY_D(); + default: + break; } static const std::string EMPTY_STRING(""); return EMPTY_STRING; } - protected: +protected: /// \brief Use plugin manager for features creation SketchPlugin_Constraint(); }; diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index cdb3309ec..a2a03ac8e 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintAngle.h" @@ -49,41 +50,46 @@ const double tolerance = 1.e-7; #define PI 3.1415926535897932 -// To support old types of GCC (less than 4.9), check the regular expressions are working -#if (__cplusplus >= 201103L || _MSVC_LANG >= 201103L) && \ - (__cplusplus >= 201402L || !defined(__GLIBCXX__) || \ - (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \ - defined(_GLIBCXX_REGEX_STATE_LIMIT) || \ - (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4))) +// To support old types of GCC (less than 4.9), check the regular expressions +// are working +#if (__cplusplus >= 201103L || _MSVC_LANG >= 201103L) && \ + (__cplusplus >= 201402L || !defined(__GLIBCXX__) || \ + (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \ + defined(_GLIBCXX_REGEX_STATE_LIMIT) || \ + (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4))) #define HAVE_WORKING_REGEX 1 #else #define HAVE_WORKING_REGEX 0 #endif - /// \brief Calculate intersection point of two lines -static std::shared_ptr intersect(FeaturePtr theLine1, FeaturePtr theLine2); - +static std::shared_ptr intersect(FeaturePtr theLine1, + FeaturePtr theLine2); -SketchPlugin_ConstraintAngle::SketchPlugin_ConstraintAngle() -{ +SketchPlugin_ConstraintAngle::SketchPlugin_ConstraintAngle() { myFlyoutUpdate = false; } -void SketchPlugin_ConstraintAngle::initAttributes() -{ - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); +void SketchPlugin_ConstraintAngle::initAttributes() { + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); - data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SketchPlugin_Constraint::VALUE(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), + GeomDataAPI_Point2D::typeId()); data()->addAttribute(ANGLE_VALUE_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(TYPE_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(ANGLE_REVERSED_FIRST_LINE_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(ANGLE_REVERSED_SECOND_LINE_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(ANGLE_REVERSED_FIRST_LINE_ID(), + ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(ANGLE_REVERSED_SECOND_LINE_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(LOCATION_TYPE_ID(), ModelAPI_AttributeInteger::typeId()); aValidators->registerNotObligatory(getKind(), LOCATION_TYPE_ID()); @@ -94,18 +100,22 @@ void SketchPlugin_ConstraintAngle::initAttributes() if (attribute(TYPE_ID())->isInitialized()) integer(PREV_TYPE_ID())->setValue(integer(TYPE_ID())->value()); - data()->addAttribute(SELECTED_FIRST_POINT_ID(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SELECTED_FIRST_POINT_ID(), + GeomDataAPI_Point2D::typeId()); data()->attribute(SELECTED_FIRST_POINT_ID())->setIsArgument(false); aValidators->registerNotObligatory(getKind(), SELECTED_FIRST_POINT_ID()); - data()->addAttribute(SELECTED_SECOND_POINT_ID(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SELECTED_SECOND_POINT_ID(), + GeomDataAPI_Point2D::typeId()); data()->attribute(SELECTED_SECOND_POINT_ID())->setIsArgument(false); aValidators->registerNotObligatory(getKind(), SELECTED_SECOND_POINT_ID()); - AttributeIntegerPtr aVerAttr = std::dynamic_pointer_cast( - data()->addAttribute(VERSION_ID(), ModelAPI_AttributeInteger::typeId())); + AttributeIntegerPtr aVerAttr = + std::dynamic_pointer_cast(data()->addAttribute( + VERSION_ID(), ModelAPI_AttributeInteger::typeId())); aVerAttr->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERSION_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + VERSION_ID()); if (!aVerAttr->isInitialized()) { // this is a newly created feature (not read from file), // so, initialize the latest version @@ -113,20 +123,21 @@ void SketchPlugin_ConstraintAngle::initAttributes() } } -void SketchPlugin_ConstraintAngle::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void SketchPlugin_ConstraintAngle::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "sketch_dimension_color"; theDefault = SKETCH_DIMENSION_COLOR; } -void SketchPlugin_ConstraintAngle::execute() -{ +void SketchPlugin_ConstraintAngle::execute() { std::shared_ptr aData = data(); - AttributeRefAttrPtr anAttrA = aData->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr anAttrB = aData->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr anAttrA = + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr anAttrB = + aData->refattr(SketchPlugin_Constraint::ENTITY_B()); if (!anAttrA->isInitialized() || !anAttrB->isInitialized()) return; @@ -140,21 +151,23 @@ void SketchPlugin_ConstraintAngle::execute() // the value should to be computed here, not in the // getAISObject in order to change the model value - // inside the object transaction. This is important for creating a constraint by preselection. - // The display of the presentation in this case happens after the transaction commit - std::shared_ptr aFlyOutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - if(!aFlyOutAttr->isInitialized()) + // inside the object transaction. This is important for creating a constraint + // by preselection. The display of the presentation in this case happens after + // the transaction commit + std::shared_ptr aFlyOutAttr = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + if (!aFlyOutAttr->isInitialized()) compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); } -AISObjectPtr SketchPlugin_ConstraintAngle::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintAngle::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::angleConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::angleConstraint(this, sketch(), thePrevious); if (anAIS.get() && !thePrevious.get()) SketchPlugin_Tools::setDimensionColor(anAIS); return anAIS; @@ -162,8 +175,7 @@ AISObjectPtr SketchPlugin_ConstraintAngle::getAISObject(AISObjectPtr thePrevious // LCOV_EXCL_START std::string SketchPlugin_ConstraintAngle::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::string aFilledAttributeName; std::shared_ptr aReentrantMessage = @@ -171,15 +183,15 @@ std::string SketchPlugin_ConstraintAngle::processEvent( if (aReentrantMessage.get()) { aFilledAttributeName = ENTITY_A(); refattr(ENTITY_A())->setObject(aReentrantMessage->selectedObject()); - std::dynamic_pointer_cast(attribute(SELECTED_FIRST_POINT_ID())) + std::dynamic_pointer_cast( + attribute(SELECTED_FIRST_POINT_ID())) ->setValue(aReentrantMessage->clickedPoint()); } return aFilledAttributeName; } // LCOV_EXCL_STOP -void SketchPlugin_ConstraintAngle::attributeChanged(const std::string& theID) -{ +void SketchPlugin_ConstraintAngle::attributeChanged(const std::string &theID) { if (myFlyoutUpdate) return; @@ -199,16 +211,15 @@ void SketchPlugin_ConstraintAngle::attributeChanged(const std::string& theID) if (!aVersion->isInitialized() || aVersion->value() < THE_VERSION_1) updateVersion(); - if (theID == ENTITY_A() || theID == ENTITY_B() || - theID == TYPE_ID() || theID == ANGLE_VALUE_ID()) { + if (theID == ENTITY_A() || theID == ENTITY_B() || theID == TYPE_ID() || + theID == ANGLE_VALUE_ID()) { calculateAngle(); } else if (theID == FLYOUT_VALUE_PNT()) { compute(theID); } } -void SketchPlugin_ConstraintAngle::calculateAngle() -{ +void SketchPlugin_ConstraintAngle::calculateAngle() { // update *_REVERSED_* flags calculateAnglePosition(); @@ -217,10 +228,14 @@ void SketchPlugin_ConstraintAngle::calculateAngle() FeaturePtr aLineA = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_A()); FeaturePtr aLineB = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_B()); - GeomPnt2dPtr aStartA = SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::START_ID()); - GeomPnt2dPtr aEndA = SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::END_ID()); - GeomPnt2dPtr aStartB = SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::START_ID()); - GeomPnt2dPtr aEndB = SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::END_ID()); + GeomPnt2dPtr aStartA = + SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::START_ID()); + GeomPnt2dPtr aEndA = + SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::END_ID()); + GeomPnt2dPtr aStartB = + SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::START_ID()); + GeomPnt2dPtr aEndB = + SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::END_ID()); std::shared_ptr aLine1(new GeomAPI_Lin2d(aStartA, aEndA)); std::shared_ptr aLine2(new GeomAPI_Lin2d(aStartB, aEndB)); @@ -235,18 +250,19 @@ void SketchPlugin_ConstraintAngle::calculateAngle() anAngleValueAttr->setValue(getAngleForType(fabs(anAng->angleDegree()))); } - std::shared_ptr anAng(new GeomAPI_Angle2d(aLine1, false, aLine2, false)); + std::shared_ptr anAng( + new GeomAPI_Angle2d(aLine1, false, aLine2, false)); double anAngle = anAng->angleDegree(); anAngle /= fabs(anAngle); - anAngle *= getAngleForType(anAngleValueAttr->value(), isReversed1, isReversed2); + anAngle *= + getAngleForType(anAngleValueAttr->value(), isReversed1, isReversed2); // update value of the constraint to be passed to the solver real(SketchPlugin_Constraint::VALUE())->setValue(anAngle); } -void SketchPlugin_ConstraintAngle::calculateAnglePosition() -{ +void SketchPlugin_ConstraintAngle::calculateAnglePosition() { if (attribute(ANGLE_REVERSED_FIRST_LINE_ID())->isInitialized() && attribute(ANGLE_REVERSED_SECOND_LINE_ID())->isInitialized()) return; // already calculated @@ -255,30 +271,36 @@ void SketchPlugin_ConstraintAngle::calculateAnglePosition() FeaturePtr aLineA = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_A()); FeaturePtr aLineB = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_B()); - GeomPnt2dPtr aStartA = SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::START_ID()); - GeomPnt2dPtr aEndA = SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::END_ID()); - GeomPnt2dPtr aStartB = SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::START_ID()); - GeomPnt2dPtr aEndB = SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::END_ID()); + GeomPnt2dPtr aStartA = + SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::START_ID()); + GeomPnt2dPtr aEndA = + SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::END_ID()); + GeomPnt2dPtr aStartB = + SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::START_ID()); + GeomPnt2dPtr aEndB = + SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::END_ID()); bool isReversed1 = false; bool isReversed2 = false; - GeomPnt2dPtr aSelected1 = SketcherPrs_Tools::getPoint(this, SELECTED_FIRST_POINT_ID()); - GeomPnt2dPtr aSelected2 = SketcherPrs_Tools::getPoint(this, SELECTED_SECOND_POINT_ID()); + GeomPnt2dPtr aSelected1 = + SketcherPrs_Tools::getPoint(this, SELECTED_FIRST_POINT_ID()); + GeomPnt2dPtr aSelected2 = + SketcherPrs_Tools::getPoint(this, SELECTED_SECOND_POINT_ID()); if (aSelected1 && aSelected2) { GeomPnt2dPtr anInterPnt = intersect(aLineA, aLineB); if (!anInterPnt) return; std::shared_ptr anInterXY = anInterPnt->xy(); isReversed1 = aSelected1->xy()->decreased(anInterXY)->dot( - aEndA->xy()->decreased(aStartA->xy())) < -tolerance; + aEndA->xy()->decreased(aStartA->xy())) < -tolerance; isReversed2 = aSelected2->xy()->decreased(anInterXY)->dot( - aEndB->xy()->decreased(aStartB->xy())) < -tolerance; - } - else { + aEndB->xy()->decreased(aStartB->xy())) < -tolerance; + } else { // no point is selected (document opened or Python script is loaded), // calculate basing on the value - std::shared_ptr anAng(new GeomAPI_Angle2d(aStartA, aEndA, aStartB, aEndB)); + std::shared_ptr anAng( + new GeomAPI_Angle2d(aStartA, aEndA, aStartB, aEndB)); isReversed1 = anAng->isReversed(0); isReversed2 = anAng->isReversed(1); } @@ -286,7 +308,8 @@ void SketchPlugin_ConstraintAngle::calculateAnglePosition() // adjust reversed flags according to the angle type AttributeIntegerPtr aTypeAttr = integer(TYPE_ID()); if (aTypeAttr && aTypeAttr->isInitialized() && - (SketcherPrs_Tools::AngleType)(aTypeAttr->value()) == SketcherPrs_Tools::ANGLE_COMPLEMENTARY) + (SketcherPrs_Tools::AngleType)(aTypeAttr->value()) == + SketcherPrs_Tools::ANGLE_COMPLEMENTARY) isReversed1 = !isReversed1; boolean(ANGLE_REVERSED_FIRST_LINE_ID())->setValue(isReversed1); @@ -294,29 +317,27 @@ void SketchPlugin_ConstraintAngle::calculateAnglePosition() } // Convert angle value from the DIRECT to any given type. -static double angleForType(const double theAngle, const int theType) -{ +static double angleForType(const double theAngle, const int theType) { double anAngle = theAngle; switch ((SketcherPrs_Tools::AngleType)theType) { - case SketcherPrs_Tools::ANGLE_DIRECT: - anAngle = theAngle; - break; - case SketcherPrs_Tools::ANGLE_COMPLEMENTARY: - anAngle = 180.0 - theAngle; - break; - case SketcherPrs_Tools::ANGLE_BACKWARD: - anAngle = 360.0 - theAngle; - break; - default: - break; + case SketcherPrs_Tools::ANGLE_DIRECT: + anAngle = theAngle; + break; + case SketcherPrs_Tools::ANGLE_COMPLEMENTARY: + anAngle = 180.0 - theAngle; + break; + case SketcherPrs_Tools::ANGLE_BACKWARD: + anAngle = 360.0 - theAngle; + break; + default: + break; } return anAngle; } double SketchPlugin_ConstraintAngle::getAngleForType(double theAngle, bool isReversed1, - bool isReversed2) -{ + bool isReversed2) { double anAngle = angleForType(theAngle, integer(TYPE_ID())->value()); if (isReversed1 != isReversed2) anAngle = 180.0 - anAngle; @@ -324,8 +345,8 @@ double SketchPlugin_ConstraintAngle::getAngleForType(double theAngle, } #if !HAVE_WORKING_REGEX -static bool parseString(const std::wstring& theString, std::wostringstream* theResult) -{ +static bool parseString(const std::wstring &theString, + std::wostringstream *theResult) { // skip leading spaces size_t aLength = theString.size(); size_t aPos = theString.find_first_not_of(L' '); @@ -364,9 +385,8 @@ static bool parseString(const std::wstring& theString, std::wostringstream* theR #endif // Convert angle value or a text expression from one angle type to another -static void convertAngle(AttributeDoublePtr theAngle, - const int thePrevType, const int theNewType) -{ +static void convertAngle(AttributeDoublePtr theAngle, const int thePrevType, + const int theNewType) { if (theAngle->isInitialized()) { if (theAngle->text().empty()) { // calculate value related to the type twice: @@ -375,17 +395,17 @@ static void convertAngle(AttributeDoublePtr theAngle, double aValue = angleForType(theAngle->value(), thePrevType); aValue = angleForType(aValue, theNewType); theAngle->setValue(aValue); - } - else { + } else { // process the parametric value std::wstring anAngleText = theAngle->text(); #if HAVE_WORKING_REGEX - std::wregex anAngleRegex(L"\\s*([-+]?[0-9]*\\.?[0-9]*)\\s*([-+])\\s*\\((.*)\\)$", - std::regex_constants::ECMAScript); + std::wregex anAngleRegex( + L"\\s*([-+]?[0-9]*\\.?[0-9]*)\\s*([-+])\\s*\\((.*)\\)$", + std::regex_constants::ECMAScript); #endif double anAnglePrefix = 0.0; - static const wchar_t aSignPrefix[2] = { L'-', L'+' }; + static const wchar_t aSignPrefix[2] = {L'-', L'+'}; int aSignInd = 1; #if HAVE_WORKING_REGEX @@ -396,7 +416,8 @@ static void convertAngle(AttributeDoublePtr theAngle, std::wostringstream aResult[4]; if (parseString(anAngleText, aResult)) { #endif - anAnglePrefix = std::atof(Locale::Convert::toString(aResult[1].str()).c_str()); + anAnglePrefix = + std::atof(Locale::Convert::toString(aResult[1].str()).c_str()); aSignInd = aResult[2].str()[0] == aSignPrefix[0] ? 0 : 1; anAngleText = aResult[3].str(); } @@ -423,39 +444,40 @@ static void convertAngle(AttributeDoublePtr theAngle, } } -void SketchPlugin_ConstraintAngle::updateAngleValue() -{ +void SketchPlugin_ConstraintAngle::updateAngleValue() { AttributeIntegerPtr anAngleType = integer(TYPE_ID()); AttributeIntegerPtr aPrevAngleType = integer(PREV_TYPE_ID()); - convertAngle(real(ANGLE_VALUE_ID()), aPrevAngleType->value(), anAngleType->value()); + convertAngle(real(ANGLE_VALUE_ID()), aPrevAngleType->value(), + anAngleType->value()); aPrevAngleType->setValue(anAngleType->value()); } -static GeomPnt2dPtr lineBoundary(const FeaturePtr& theLine, const bool theReversed, - const GeomPnt2dPtr& thePointToAvoid) -{ - GeomPnt2dPtr aPoint = SketcherPrs_Tools::getPoint(theLine.get(), - theReversed ? SketchPlugin_Line::START_ID() : SketchPlugin_Line::END_ID()); +static GeomPnt2dPtr lineBoundary(const FeaturePtr &theLine, + const bool theReversed, + const GeomPnt2dPtr &thePointToAvoid) { + GeomPnt2dPtr aPoint = SketcherPrs_Tools::getPoint( + theLine.get(), theReversed ? SketchPlugin_Line::START_ID() + : SketchPlugin_Line::END_ID()); if (aPoint->distance(thePointToAvoid) < tolerance) { // extremity is equal to the intersection point, // thus recalculate it using another boundary point - aPoint = SketcherPrs_Tools::getPoint(theLine.get(), - theReversed ? SketchPlugin_Line::END_ID() : SketchPlugin_Line::START_ID()); + aPoint = SketcherPrs_Tools::getPoint( + theLine.get(), theReversed ? SketchPlugin_Line::END_ID() + : SketchPlugin_Line::START_ID()); aPoint->setX(thePointToAvoid->x() * 2.0 - aPoint->x()); aPoint->setY(thePointToAvoid->y() * 2.0 - aPoint->y()); } return aPoint; } -bool SketchPlugin_ConstraintAngle::compute(const std::string& theAttributeId) -{ +bool SketchPlugin_ConstraintAngle::compute(const std::string &theAttributeId) { if (theAttributeId != SketchPlugin_Constraint::FLYOUT_VALUE_PNT()) return false; if (!sketch()) return false; - std::shared_ptr aFlyOutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(attribute(theAttributeId)); + std::shared_ptr aFlyOutAttr = + std::dynamic_pointer_cast(attribute(theAttributeId)); DataPtr aData = data(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); @@ -475,10 +497,12 @@ bool SketchPlugin_ConstraintAngle::compute(const std::string& theAttributeId) int anAngleType = integer(TYPE_ID())->value(); - bool isSupplementary = anAngleType == (int)SketcherPrs_Tools::ANGLE_COMPLEMENTARY; + bool isSupplementary = + anAngleType == (int)SketcherPrs_Tools::ANGLE_COMPLEMENTARY; // point on lines to compose an angle - GeomPnt2dPtr aPointA = lineBoundary(aLineA, isReversed1 ^ isSupplementary, anInter); + GeomPnt2dPtr aPointA = + lineBoundary(aLineA, isReversed1 ^ isSupplementary, anInter); GeomPnt2dPtr aPointB = lineBoundary(aLineB, isReversed2, anInter); myFlyoutUpdate = true; @@ -503,20 +527,21 @@ bool SketchPlugin_ConstraintAngle::compute(const std::string& theAttributeId) // the direction is reversed only once if ((cross1 + tolerance) * (cross2 + tolerance) < 0.0) { if (anAngleType == (int)SketcherPrs_Tools::ANGLE_BACKWARD) { - convertAngle(real(ANGLE_VALUE_ID()), (int)SketcherPrs_Tools::ANGLE_BACKWARD, + convertAngle(real(ANGLE_VALUE_ID()), + (int)SketcherPrs_Tools::ANGLE_BACKWARD, (int)SketcherPrs_Tools::ANGLE_DIRECT); } convertAngle(real(ANGLE_VALUE_ID()), (int)SketcherPrs_Tools::ANGLE_DIRECT, (int)SketcherPrs_Tools::ANGLE_COMPLEMENTARY); if (anAngleType == (int)SketcherPrs_Tools::ANGLE_BACKWARD) { - convertAngle(real(ANGLE_VALUE_ID()), (int)SketcherPrs_Tools::ANGLE_DIRECT, + convertAngle(real(ANGLE_VALUE_ID()), + (int)SketcherPrs_Tools::ANGLE_DIRECT, (int)SketcherPrs_Tools::ANGLE_BACKWARD); } } calculateAngle(); - } - else { + } else { // default position of the presentation double aX = (aPointA->x() + aPointB->x() + anInter->x()) / 3.; double aY = (aPointA->y() + aPointB->y() + anInter->y()) / 3.; @@ -527,8 +552,7 @@ bool SketchPlugin_ConstraintAngle::compute(const std::string& theAttributeId) return true; } -void SketchPlugin_ConstraintAngle::updateVersion() -{ +void SketchPlugin_ConstraintAngle::updateVersion() { bool aWasBlocked = data()->blockSendAttributeUpdated(true); // Calculate angle value by the old algorithm and @@ -536,10 +560,14 @@ void SketchPlugin_ConstraintAngle::updateVersion() FeaturePtr aLineA = SketcherPrs_Tools::getFeatureLine(data(), ENTITY_A()); FeaturePtr aLineB = SketcherPrs_Tools::getFeatureLine(data(), ENTITY_B()); - GeomPnt2dPtr aStartA = SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::START_ID()); - GeomPnt2dPtr aEndA = SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::END_ID()); - GeomPnt2dPtr aStartB = SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::START_ID()); - GeomPnt2dPtr aEndB = SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::END_ID()); + GeomPnt2dPtr aStartA = + SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::START_ID()); + GeomPnt2dPtr aEndA = + SketcherPrs_Tools::getPoint(aLineA.get(), SketchPlugin_Line::END_ID()); + GeomPnt2dPtr aStartB = + SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::START_ID()); + GeomPnt2dPtr aEndB = + SketcherPrs_Tools::getPoint(aLineB.get(), SketchPlugin_Line::END_ID()); std::shared_ptr anAng; @@ -551,8 +579,7 @@ void SketchPlugin_ConstraintAngle::updateVersion() std::shared_ptr aLine1(new GeomAPI_Lin2d(aStartA, aEndA)); std::shared_ptr aLine2(new GeomAPI_Lin2d(aStartB, aEndB)); anAng.reset(new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2)); - } - else { + } else { anAng.reset(new GeomAPI_Angle2d(aStartA, aEndA, aStartB, aEndB)); bool isReversed1 = anAng->isReversed(0); @@ -569,12 +596,12 @@ void SketchPlugin_ConstraintAngle::updateVersion() case SketcherPrs_Tools::ANGLE_DIRECT: if (anAngleValue < 0.0 && aConstValue > 180.0) convertAngle(real(ANGLE_VALUE_ID()), SketcherPrs_Tools::ANGLE_BACKWARD, - SketcherPrs_Tools::ANGLE_DIRECT); + SketcherPrs_Tools::ANGLE_DIRECT); break; case SketcherPrs_Tools::ANGLE_BACKWARD: if (anAngleValue < 0.0 && aConstValue < 180.0) convertAngle(real(ANGLE_VALUE_ID()), SketcherPrs_Tools::ANGLE_DIRECT, - SketcherPrs_Tools::ANGLE_BACKWARD); + SketcherPrs_Tools::ANGLE_BACKWARD); break; default: break; @@ -583,18 +610,22 @@ void SketchPlugin_ConstraintAngle::updateVersion() integer(VERSION_ID())->setValue(THE_VERSION_1); } - // =============== Auxiliary functions ================================== -std::shared_ptr intersect(FeaturePtr theLine1, FeaturePtr theLine2) -{ +std::shared_ptr intersect(FeaturePtr theLine1, + FeaturePtr theLine2) { // Start and end points of lines - const std::string& aLineStartAttr = SketchPlugin_Line::START_ID(); - const std::string& aLineEndAttr = SketchPlugin_Line::END_ID(); - GeomPnt2dPtr aStartA = SketcherPrs_Tools::getPoint(theLine1.get(), aLineStartAttr); - GeomPnt2dPtr aEndA = SketcherPrs_Tools::getPoint(theLine1.get(), aLineEndAttr); - GeomPnt2dPtr aStartB = SketcherPrs_Tools::getPoint(theLine2.get(), aLineStartAttr); - GeomPnt2dPtr aEndB = SketcherPrs_Tools::getPoint(theLine2.get(), aLineEndAttr); - if (aStartA->distance(aEndA) < tolerance || aStartB->distance(aEndB) < tolerance) + const std::string &aLineStartAttr = SketchPlugin_Line::START_ID(); + const std::string &aLineEndAttr = SketchPlugin_Line::END_ID(); + GeomPnt2dPtr aStartA = + SketcherPrs_Tools::getPoint(theLine1.get(), aLineStartAttr); + GeomPnt2dPtr aEndA = + SketcherPrs_Tools::getPoint(theLine1.get(), aLineEndAttr); + GeomPnt2dPtr aStartB = + SketcherPrs_Tools::getPoint(theLine2.get(), aLineStartAttr); + GeomPnt2dPtr aEndB = + SketcherPrs_Tools::getPoint(theLine2.get(), aLineEndAttr); + if (aStartA->distance(aEndA) < tolerance || + aStartB->distance(aEndB) < tolerance) std::shared_ptr(); // Lines and their intersection point diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h index b1bfcc249..3062fb112 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintAngle_H_ #define SketchPlugin_ConstraintAngle_H_ #include "SketchPlugin.h" -#include "SketchPlugin_Sketch.h" #include "SketchPlugin_ConstraintBase.h" +#include "SketchPlugin_Sketch.h" #include @@ -34,72 +35,61 @@ * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ class SketchPlugin_ConstraintAngle : public SketchPlugin_ConstraintBase, - public ModelAPI_IReentrant -{ + public ModelAPI_IReentrant { public: /// Angle constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_ANGLE_ID("SketchConstraintAngle"); return MY_CONSTRAINT_ANGLE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintAngle::ID(); return MY_KIND; } /// attribute name of operation type - inline static const std::string& TYPE_ID() - { + inline static const std::string &TYPE_ID() { static const std::string MY_TYPE_ID("AngleType"); return MY_TYPE_ID; } /// attribute name of previous value of operation type - inline static const std::string& PREV_TYPE_ID() - { + inline static const std::string &PREV_TYPE_ID() { static const std::string MY_TYPE_ID("AngleTypePrevious"); return MY_TYPE_ID; } /// attribute name of operation type - inline static const std::string& ANGLE_VALUE_ID() - { + inline static const std::string &ANGLE_VALUE_ID() { static const std::string MY_ANGLE_VALUE_ID("AngleValue"); return MY_ANGLE_VALUE_ID; } /// attribute name indicating the first line is reversed - inline static const std::string& ANGLE_REVERSED_FIRST_LINE_ID() - { + inline static const std::string &ANGLE_REVERSED_FIRST_LINE_ID() { static const std::string MY_ANGLE_REVERSED_ID("AngleReversedLine1"); return MY_ANGLE_REVERSED_ID; } /// attribute name indicating the second line is reversed - inline static const std::string& ANGLE_REVERSED_SECOND_LINE_ID() - { + inline static const std::string &ANGLE_REVERSED_SECOND_LINE_ID() { static const std::string MY_ANGLE_REVERSED_ID("AngleReversedLine2"); return MY_ANGLE_REVERSED_ID; } /// attribute name of dimension location type - inline static const std::string& LOCATION_TYPE_ID() - { + inline static const std::string &LOCATION_TYPE_ID() { static const std::string MY_LOCATION_TYPE_ID("LocationType"); return MY_LOCATION_TYPE_ID; } /// attribute name indicating the first point selected - inline static const std::string& SELECTED_FIRST_POINT_ID() - { + inline static const std::string &SELECTED_FIRST_POINT_ID() { static const std::string MY_SELECTED_FIRST_POINT_ID("SelectedPointA"); return MY_SELECTED_FIRST_POINT_ID; } /// attribute name indicating the second point selected - inline static const std::string& SELECTED_SECOND_POINT_ID() - { + inline static const std::string &SELECTED_SECOND_POINT_ID() { static const std::string MY_SELECTED_SECOND_POINT_ID("SelectedPointB"); return MY_SELECTED_SECOND_POINT_ID; } @@ -109,8 +99,7 @@ public: static const int THE_VERSION_1 = 20191210; /// Attribute name of the version of Angle feature - inline static const std::string& VERSION_ID() - { + inline static const std::string &VERSION_ID() { static const std::string MY_VERSION_ID("version"); return MY_VERSION_ID; } @@ -119,28 +108,32 @@ public: /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Computes the attribute value on the base of other attributes if the value can be computed - /// \param theAttributeId an attribute index to be computed + /// Computes the attribute value on the base of other attributes if the value + /// can be computed \param theAttributeId an attribute index to be computed /// \return a boolean value about it is computed - SKETCHPLUGIN_EXPORT virtual bool compute(const std::string& theAttributeId); + SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Apply information of the message to current object. /// It fills selected point and the first object. - virtual std::string processEvent(const std::shared_ptr& theMessage); + virtual std::string + processEvent(const std::shared_ptr &theMessage); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintAngle(); @@ -149,14 +142,15 @@ protected: /// Calculate current value of the angle void calculateAngle(); - /// Compute the position of the angle presentation (the quarter selected by the user) + /// Compute the position of the angle presentation (the quarter selected by + /// the user) void calculateAnglePosition(); - /// Converts the angle value according to the current angle type and sketch plane normal. - /// The in/out angle is in degree. - /// \param theAngle a source for the calculated angle - /// \param a double angle value - double getAngleForType(double theAngle, bool isReversed1 = false, bool isReversed2 = false); + /// Converts the angle value according to the current angle type and sketch + /// plane normal. The in/out angle is in degree. \param theAngle a source for + /// the calculated angle \param a double angle value + double getAngleForType(double theAngle, bool isReversed1 = false, + bool isReversed2 = false); /// Update value of ANGLE_VALUE attribute according to the current type void updateAngleValue(); @@ -165,7 +159,8 @@ protected: void updateVersion(); private: - bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point + bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of + ///< flyout point }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.h b/src/SketchPlugin/SketchPlugin_ConstraintBase.h index 19cde0c62..333709b48 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintBase.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.h @@ -14,32 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintBase_H_ #define SketchPlugin_ConstraintBase_H_ #include "SketchPlugin.h" +#include +#include #include #include -#include -#include -#include #include +#include #include -/** Description: - * Each constraint uses a set of parameters. In the SolveSpace library - * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". +/** Description: + * Each constraint uses a set of parameters. In the SolveSpace library + * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". * The "ptA" and "ptB" parameters represents a point in the constraint. * The "entityA" and "entityB" represents any other object (and a point too). * And the "valA" represents a real value. * * The attributes below are named independent of the SolveSpace. - * Some of them may be unused. + * Some of them may be unused. * * Also the list of possible attributes is provided to simplify assignment. */ @@ -52,13 +53,11 @@ * Some feature's methods implemented here as dummy to * Base class for all constraints. */ -class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable -{ - protected: +class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, + public GeomAPI_IPresentable { +protected: /// \brief Use plugin manager for features creation - SketchPlugin_ConstraintBase() - { - } + SketchPlugin_ConstraintBase() {} }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp index 795eee98d..21d6ef15a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp @@ -14,63 +14,62 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintCoincidence.h" -#include -#include #include #include +#include +#include +#include #include #include -#include #include #include -SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence() -{ -} +SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence() {} -void SketchPlugin_ConstraintCoincidence::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintCoincidence::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintCoincidence::execute() -{ -} +void SketchPlugin_ConstraintCoincidence::execute() {} -AISObjectPtr SketchPlugin_ConstraintCoincidence::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintCoincidence::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::coincidentConstraint(this, sketch(), thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::coincidentConstraint(this, sketch(), thePrevious); return anAIS; } -AttributePoint2DPtr SketchPlugin_ConstraintCoincidence::getPoint(const FeaturePtr& theFeature) -{ - AttributePoint2DPtr aPoint = ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(), - SketchPlugin_Constraint::ENTITY_A(), - SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); +AttributePoint2DPtr +SketchPlugin_ConstraintCoincidence::getPoint(const FeaturePtr &theFeature) { + AttributePoint2DPtr aPoint = ModelGeomAlgo_Point2D::getPointOfRefAttr( + theFeature.get(), SketchPlugin_Constraint::ENTITY_A(), + SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); if (!aPoint.get()) - aPoint = ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(), - SketchPlugin_Constraint::ENTITY_B(), - SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); + aPoint = ModelGeomAlgo_Point2D::getPointOfRefAttr( + theFeature.get(), SketchPlugin_Constraint::ENTITY_B(), + SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); return aPoint; } -void SketchPlugin_ConstraintCoincidence::createCoincidenceFeature(SketchPlugin_Sketch* theSketch, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2) -{ +void SketchPlugin_ConstraintCoincidence::createCoincidenceFeature( + SketchPlugin_Sketch *theSketch, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2) { FeaturePtr aFeature; if (theSketch) { aFeature = theSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); @@ -81,14 +80,17 @@ void SketchPlugin_ConstraintCoincidence::createCoincidenceFeature(SketchPlugin_S std::shared_ptr aData = aFeature->data(); - std::shared_ptr aRef1 = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::shared_ptr aRef1 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); aRef1->setAttr(thePoint1); - std::shared_ptr aRef2 = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + std::shared_ptr aRef2 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_B())); aRef2->setAttr(thePoint2); - // we need to flush created signal in order to coincidence is processed by solver + // we need to flush created signal in order to coincidence is processed by + // solver Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h index 5522c19d1..1d54ab5ad 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintCoincidence_H_ @@ -29,48 +30,52 @@ class GeomDataAPI_Point2D; /** \class SketchPlugin_ConstraintCoincidence * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines equivalence of two points + * \brief Feature for creation of a new constraint which defines equivalence of + * two points * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase { +public: /// Coincidence constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_COINCIDENCE_ID("SketchConstraintCoincidence"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_COINCIDENCE_ID( + "SketchConstraintCoincidence"); return MY_CONSTRAINT_COINCIDENCE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintCoincidence::ID(); return MY_KIND; } /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Creates a constraint on two points /// \param theSketch a sketch feature /// \param thePoint1 the first point /// \param thePoint2 the second point - static void createCoincidenceFeature(SketchPlugin_Sketch* theSketch, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2); + static void createCoincidenceFeature( + SketchPlugin_Sketch *theSketch, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2); /// Returns point of coincidence feature /// \param theFeature a coincidence feature - /// \return point 2d attribute. Coincidence always has at least one point 2d attribute - static std::shared_ptr getPoint(const FeaturePtr& theFeature); + /// \return point 2d attribute. Coincidence always has at least one point 2d + /// attribute + static std::shared_ptr + getPoint(const FeaturePtr &theFeature); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintCoincidence(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp index 200e03a40..57c1293c0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintCoincidenceInternal.h" @@ -23,26 +24,24 @@ #include #include -SketchPlugin_ConstraintCoincidenceInternal::SketchPlugin_ConstraintCoincidenceInternal() -{ -} +SketchPlugin_ConstraintCoincidenceInternal:: + SketchPlugin_ConstraintCoincidenceInternal() {} -void SketchPlugin_ConstraintCoincidenceInternal::initAttributes() -{ +void SketchPlugin_ConstraintCoincidenceInternal::initAttributes() { SketchPlugin_ConstraintCoincidence::initAttributes(); data()->addAttribute(INDEX_ENTITY_A(), ModelAPI_AttributeInteger::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), INDEX_ENTITY_A()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), INDEX_ENTITY_A()); data()->addAttribute(INDEX_ENTITY_B(), ModelAPI_AttributeInteger::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), INDEX_ENTITY_B()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), INDEX_ENTITY_B()); } -void SketchPlugin_ConstraintCoincidenceInternal::execute() -{ -} +void SketchPlugin_ConstraintCoincidenceInternal::execute() {} -AISObjectPtr SketchPlugin_ConstraintCoincidenceInternal::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr SketchPlugin_ConstraintCoincidenceInternal::getAISObject( + AISObjectPtr thePrevious) { return AISObjectPtr(); } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h index 85a867eea..210611f17 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintCoincidenceInternal_H_ @@ -27,42 +28,42 @@ * \ingroup Plugins * \brief Internal coincidence constraint not applicable for the end user */ -class SketchPlugin_ConstraintCoincidenceInternal : public SketchPlugin_ConstraintCoincidence -{ - public: +class SketchPlugin_ConstraintCoincidenceInternal + : public SketchPlugin_ConstraintCoincidence { +public: /// \brief Coincidence constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_COINCIDENCE_ID("SketchConstraintCoincidenceInternal"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_COINCIDENCE_ID( + "SketchConstraintCoincidenceInternal"); return MY_CONSTRAINT_COINCIDENCE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { - static std::string MY_KIND = SketchPlugin_ConstraintCoincidenceInternal::ID(); + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + static std::string MY_KIND = + SketchPlugin_ConstraintCoincidenceInternal::ID(); return MY_KIND; } /// \brief Index of point in the array if the first attribute is an array - inline static const std::string& INDEX_ENTITY_A() - { + inline static const std::string &INDEX_ENTITY_A() { static const std::string MY_INDEX("ConstraintEntityA_Index"); return MY_INDEX; } /// \brief Index of point in the array if the second attribute is an array - inline static const std::string& INDEX_ENTITY_B() - { + inline static const std::string &INDEX_ENTITY_B() { static const std::string MY_INDEX("ConstraintEntityB_Index"); return MY_INDEX; } /// \brief Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// \brief Use plugin manager for features creation diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp index e689458e8..0999923e7 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp @@ -14,35 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintCollinear.h" #include "SketcherPrs_Factory.h" -SketchPlugin_ConstraintCollinear::SketchPlugin_ConstraintCollinear() -{ -} +SketchPlugin_ConstraintCollinear::SketchPlugin_ConstraintCollinear() {} -void SketchPlugin_ConstraintCollinear::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintCollinear::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintCollinear::execute() -{ -} +void SketchPlugin_ConstraintCollinear::execute() {} -AISObjectPtr SketchPlugin_ConstraintCollinear::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintCollinear::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::collinearConstraint( - this, sketch(), thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::collinearConstraint(this, sketch(), thePrevious); return anAIS; } - - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h index 48d356a87..6152a6971 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintCollinear_H_ #define SketchPlugin_ConstraintCollinear_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintCollinear * \ingroup Plugins @@ -31,18 +32,16 @@ * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintCollinear : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintCollinear : public SketchPlugin_ConstraintBase { +public: /// Parallel constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_COLLINEAR_ID("SketchConstraintCollinear"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_COLLINEAR_ID( + "SketchConstraintCollinear"); return MY_CONSTRAINT_COLLINEAR_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintCollinear::ID(); return MY_KIND; } @@ -50,11 +49,13 @@ class SketchPlugin_ConstraintCollinear : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintCollinear(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index 2f2c59b0a..d27c5961d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintDistance.h" -#include #include #include +#include #include -#include #include +#include #include #include #include #include -#include #include +#include #include #include @@ -45,104 +46,112 @@ const double tolerance = 1e-7; - -SketchPlugin_ConstraintDistance::SketchPlugin_ConstraintDistance() -{ +SketchPlugin_ConstraintDistance::SketchPlugin_ConstraintDistance() { myFlyoutUpdate = false; } //************************************************************************************* -void SketchPlugin_ConstraintDistance::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintDistance::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::VALUE(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), + GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SIGNED(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID(), ModelAPI_AttributeInteger::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), LOCATION_TYPE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), LOCATION_TYPE_ID()); - AttributePtr anAttr = data()->addAttribute(SketchPlugin_ConstraintDistance::DIRECTION_ID(), - GeomDataAPI_Dir::typeId()); + AttributePtr anAttr = + data()->addAttribute(SketchPlugin_ConstraintDistance::DIRECTION_ID(), + GeomDataAPI_Dir::typeId()); anAttr->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), DIRECTION_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + DIRECTION_ID()); } -void SketchPlugin_ConstraintDistance::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void SketchPlugin_ConstraintDistance::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "sketch_dimension_color"; theDefault = SKETCH_DIMENSION_COLOR; } //************************************************************************************* -void SketchPlugin_ConstraintDistance::execute() -{ +void SketchPlugin_ConstraintDistance::execute() { std::shared_ptr aData = data(); - AttributeDoublePtr anAttrValue = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::VALUE())); + AttributeDoublePtr anAttrValue = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::VALUE())); - if(anAttrValue->isInitialized()) + if (anAttrValue->isInitialized()) return; double aDistance = calculateCurrentDistance(); - if(aDistance >= 0) + if (aDistance >= 0) anAttrValue->setValue(aDistance); } //************************************************************************************* -AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, - sketch(), - thePrevious); + AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint( + this, sketch(), thePrevious); if (anAIS.get() && !thePrevious.get()) SketchPlugin_Tools::setDimensionColor(anAIS); return anAIS; } -static std::shared_ptr getLine(DataPtr theData, const std::string& theAttrName) -{ - FeaturePtr aLineFeature = SketcherPrs_Tools::getFeatureLine(theData, theAttrName); +static std::shared_ptr getLine(DataPtr theData, + const std::string &theAttrName) { + FeaturePtr aLineFeature = + SketcherPrs_Tools::getFeatureLine(theData, theAttrName); if (!aLineFeature) return GeomLine2dPtr(); - std::shared_ptr aStart = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aEnd = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aStart = + std::dynamic_pointer_cast( + aLineFeature->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aEnd = + std::dynamic_pointer_cast( + aLineFeature->attribute(SketchPlugin_Line::END_ID())); - return GeomLine2dPtr(new GeomAPI_Lin2d(aStart->x(), aStart->y(), aEnd->x(), aEnd->y())); + return GeomLine2dPtr( + new GeomAPI_Lin2d(aStart->x(), aStart->y(), aEnd->x(), aEnd->y())); } -double SketchPlugin_ConstraintDistance::calculateCurrentDistance() -{ +double SketchPlugin_ConstraintDistance::calculateCurrentDistance() { double aDistance = -1.; std::shared_ptr aData = data(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); std::shared_ptr aPointA = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); std::shared_ptr aPointB = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); GeomPnt2dPtr aGeomPntA, aGeomPntB; GeomLine2dPtr aLine; - if (aPointA.get() && aPointB.get()) { // both points + if (aPointA.get() && aPointB.get()) { // both points aGeomPntA = aPointA->pnt(); aGeomPntB = aPointB->pnt(); } else { - if (!aPointA.get() && aPointB.get()) { //Line and point + if (!aPointA.get() && aPointB.get()) { // Line and point aLine = getLine(aData, SketchPlugin_Constraint::ENTITY_A()); aGeomPntB = aPointB->pnt(); aGeomPntA = aLine ? aLine->project(aGeomPntB) : GeomPnt2dPtr(); - } else if (aPointA.get() && !aPointB.get()) { // Point and line + } else if (aPointA.get() && !aPointB.get()) { // Point and line aLine = getLine(aData, SketchPlugin_Constraint::ENTITY_B()); aGeomPntA = aPointA->pnt(); aGeomPntB = aLine ? aLine->project(aGeomPntA) : GeomPnt2dPtr(); @@ -159,7 +168,8 @@ double SketchPlugin_ConstraintDistance::calculateCurrentDistance() std::shared_ptr aPointPointDir = std::dynamic_pointer_cast(attribute(DIRECTION_ID())); if (aDistance > tolerance) - aPointPointDir->setValue(aGeomPntB->x() - aGeomPntA->x(), aGeomPntB->y() - aGeomPntA->y(), 0.0); + aPointPointDir->setValue(aGeomPntB->x() - aGeomPntA->x(), + aGeomPntB->y() - aGeomPntA->y(), 0.0); else if (aLine) { GeomDir2dPtr aLineDir = aLine->direction(); aPointPointDir->setValue(-aLineDir->y(), aLineDir->x(), 0.0); @@ -168,23 +178,26 @@ double SketchPlugin_ConstraintDistance::calculateCurrentDistance() return aDistance; } -bool SketchPlugin_ConstraintDistance::areAttributesInitialized() -{ +bool SketchPlugin_ConstraintDistance::areAttributesInitialized() { std::shared_ptr aData = data(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); std::shared_ptr aPointA = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); std::shared_ptr aPointB = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); if (!aPointA && !aPointB) return false; else if (aPointA || aPointB) { FeaturePtr aLine; if (!aPointA) - aLine = SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A()); + aLine = SketcherPrs_Tools::getFeatureLine( + aData, SketchPlugin_Constraint::ENTITY_A()); else if (!aPointB) - aLine = SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B()); + aLine = SketcherPrs_Tools::getFeatureLine( + aData, SketchPlugin_Constraint::ENTITY_B()); else // both points are initialized return true; @@ -194,13 +207,13 @@ bool SketchPlugin_ConstraintDistance::areAttributesInitialized() return true; } -void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) -{ +void SketchPlugin_ConstraintDistance::attributeChanged( + const std::string &theID) { if (theID == SketchPlugin_Constraint::ENTITY_A() || - theID == SketchPlugin_Constraint::ENTITY_B()) - { - std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE())); + theID == SketchPlugin_Constraint::ENTITY_B()) { + std::shared_ptr aValueAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::VALUE())); if (!aValueAttr->isInitialized()) { // only if it is not initialized, try to compute the current value double aDistance = calculateCurrentDistance(); @@ -208,22 +221,26 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) aValueAttr->setValue(aDistance); } } - } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { + } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && + !myFlyoutUpdate) { // Recalculate flyout point in local coordinates of the distance constraint: // the X coordinate is a length of projection of the flyout point on the // line binding two distanced points - // or a line of projection of the distanced point onto the distanced segment + // or a line of projection of the distanced point onto the + // distanced segment // the Y coordinate is a distance from the flyout point to the line std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFlyoutPnt = aFlyoutAttr->pnt(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aPointA = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); - std::shared_ptr aPointB = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); + std::shared_ptr aPointA = + SketcherPrs_Tools::getFeaturePoint( + data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); + std::shared_ptr aPointB = + SketcherPrs_Tools::getFeaturePoint( + data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); std::shared_ptr aStartPnt; std::shared_ptr aEndPnt; @@ -231,16 +248,16 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) aStartPnt = aPointA->pnt()->xy(); aEndPnt = aPointB->pnt()->xy(); } else if (aPointA) { - FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(data(), - SketchPlugin_Constraint::ENTITY_B()); + FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine( + data(), SketchPlugin_Constraint::ENTITY_B()); if (!aLine) return; std::shared_ptr aPoint = aPointA->pnt(); aStartPnt = aPoint->xy(); aEndPnt = SketcherPrs_Tools::getProjectionPoint(aLine, aPoint)->xy(); } else if (aPointB) { - FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(data(), - SketchPlugin_Constraint::ENTITY_A()); + FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine( + data(), SketchPlugin_Constraint::ENTITY_A()); if (!aLine) return; std::shared_ptr aPoint = aPointB->pnt(); @@ -250,16 +267,16 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) return; myFlyoutUpdate = true; - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); + std::shared_ptr aFlyoutDir = + aFlyoutPnt->xy()->decreased(aStartPnt); if (aEndPnt->distance(aStartPnt) >= tolerance) { - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); + std::shared_ptr aLineDir( + new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); double X = aFlyoutDir->dot(aLineDir->xy()); double Y = -aFlyoutDir->cross(aLineDir->xy()); aFlyoutAttr->setValue(X, Y); - } - else + } else aFlyoutAttr->setValue(aFlyoutDir->x(), aFlyoutDir->y()); myFlyoutUpdate = false; } } - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index 2089f2cfd..1248c7de2 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintDistance_H_ #define SketchPlugin_ConstraintDistance_H_ +#include "ModelAPI_Data.h" #include "SketchPlugin.h" #include "SketchPlugin_ConstraintBase.h" #include "SketchPlugin_Sketch.h" -#include "ModelAPI_Data.h" #include @@ -38,43 +39,39 @@ class GeomDataAPI_Point2D; * between a point and another feature (point, line, plane or face) * * This constraint has three attributes: - * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() + * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and + * SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase { +public: /// Distance constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_DISTANCE_ID("SketchConstraintDistance"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_DISTANCE_ID( + "SketchConstraintDistance"); return MY_CONSTRAINT_DISTANCE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintDistance::ID(); return MY_KIND; } /// \brief Shows whether the point-line distance should keep its sign - inline static const std::string& SIGNED() - { + inline static const std::string &SIGNED() { static const std::string MY_SIGNED("SignedDistance"); return MY_SIGNED; } /// \brief The direction from the first object to the second. /// To change distance value from zero to non-zero correctly. - inline static const std::string& DIRECTION_ID() - { + inline static const std::string &DIRECTION_ID() { static const std::string MY_DIRECTION_ID("DistanceDirection"); return MY_DIRECTION_ID; } /// attribute name of dimension location type - inline static const std::string& LOCATION_TYPE_ID() - { + inline static const std::string &LOCATION_TYPE_ID() { static const std::string MY_LOCATION_TYPE_ID("LocationType"); return MY_LOCATION_TYPE_ID; } @@ -82,19 +79,22 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintDistance(); @@ -107,7 +107,8 @@ protected: bool areAttributesInitialized(); protected: - bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point + bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of + ///< flyout point }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp index e15b4402c..431950927 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchPlugin_ConstraintDistanceAlongDir.cpp @@ -24,8 +25,8 @@ #include #include -#include #include +#include #include #include @@ -40,24 +41,25 @@ const double tolerance = 1e-7; - -SketchPlugin_ConstraintDistanceAlongDir::SketchPlugin_ConstraintDistanceAlongDir() - : SketchPlugin_ConstraintDistance(), - myValue(-1.e100), - myValueUpdate(false) -{ -} +SketchPlugin_ConstraintDistanceAlongDir:: + SketchPlugin_ConstraintDistanceAlongDir() + : SketchPlugin_ConstraintDistance(), myValue(-1.e100), + myValueUpdate(false) {} //************************************************************************************* -void SketchPlugin_ConstraintDistanceAlongDir::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintDistanceAlongDir::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::VALUE(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), + GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(LOCATION_TYPE_ID(), ModelAPI_AttributeInteger::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), LOCATION_TYPE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), LOCATION_TYPE_ID()); data()->addAttribute(DISTANCE_VALUE_ID(), ModelAPI_AttributeDouble::typeId()); @@ -66,8 +68,7 @@ void SketchPlugin_ConstraintDistanceAlongDir::initAttributes() } //************************************************************************************* -void SketchPlugin_ConstraintDistanceAlongDir::execute() -{ +void SketchPlugin_ConstraintDistanceAlongDir::execute() { AttributeDoublePtr anAttrValue = real(SketchPlugin_Constraint::VALUE()); if (anAttrValue->isInitialized() || !areAttributesInitialized()) return; @@ -77,24 +78,22 @@ void SketchPlugin_ConstraintDistanceAlongDir::execute() } //************************************************************************************* -AISObjectPtr SketchPlugin_ConstraintDistanceAlongDir::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr SketchPlugin_ConstraintDistanceAlongDir::getAISObject( + AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, - sketch(), - thePrevious); + AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint( + this, sketch(), thePrevious); if (anAIS.get() && !thePrevious.get()) SketchPlugin_Tools::setDimensionColor(anAIS); return anAIS; } -void SketchPlugin_ConstraintDistanceAlongDir::attributeChanged(const std::string& theID) -{ +void SketchPlugin_ConstraintDistanceAlongDir::attributeChanged( + const std::string &theID) { if (theID == SketchPlugin_Constraint::ENTITY_A() || - theID == SketchPlugin_Constraint::ENTITY_B()) - { + theID == SketchPlugin_Constraint::ENTITY_B()) { AttributeDoublePtr aValueAttr = real(SketchPlugin_Constraint::VALUE()); if (!aValueAttr->isInitialized() && areAttributesInitialized()) { // only if it is not initialized, try to compute the current value @@ -108,31 +107,36 @@ void SketchPlugin_ConstraintDistanceAlongDir::attributeChanged(const std::string double aConstraintValue = real(SketchPlugin_Constraint::VALUE())->value(); aDistanceValueAttr->setValue(fabs(aConstraintValue)); myValueUpdate = false; - } else if (theID == DISTANCE_VALUE_ID() && !myValueUpdate){ + } else if (theID == DISTANCE_VALUE_ID() && !myValueUpdate) { myValueUpdate = true; // update value of the distance according to the value set by user double aDistanceValue = real(DISTANCE_VALUE_ID())->value(); - AttributeDoublePtr aConstraintValueAttr = real(SketchPlugin_Constraint::VALUE()); + AttributeDoublePtr aConstraintValueAttr = + real(SketchPlugin_Constraint::VALUE()); if (aConstraintValueAttr->value() < 0.0) aDistanceValue = -aDistanceValue; aConstraintValueAttr->setValue(aDistanceValue); myValueUpdate = false; - } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { + } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && + !myFlyoutUpdate) { // Recalculate flyout point in local coordinates of the distance constraint: // the X coordinate is a length of projection of the flyout point on the // line binding two distanced points - // or a line of projection of the distanced point onto the distanced segment + // or a line of projection of the distanced point onto the + // distanced segment // the Y coordinate is a distance from the flyout point to the line std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFlyoutPnt = aFlyoutAttr->pnt(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aPointA = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); - std::shared_ptr aPointB = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); + std::shared_ptr aPointA = + SketcherPrs_Tools::getFeaturePoint( + data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); + std::shared_ptr aPointB = + SketcherPrs_Tools::getFeaturePoint( + data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); std::shared_ptr aStartPnt = aPointA->pnt()->xy(); std::shared_ptr aEndPnt = aPointB->pnt()->xy(); @@ -140,7 +144,8 @@ void SketchPlugin_ConstraintDistanceAlongDir::attributeChanged(const std::string if (aEndPnt->distance(aStartPnt) < tolerance) return; - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aEndPnt); + std::shared_ptr aFlyoutDir = + aFlyoutPnt->xy()->decreased(aEndPnt); myFlyoutUpdate = true; updateFlyoutPoint(); myFlyoutUpdate = false; diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h index e6f421e88..216b11271 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchPlugin_ConstraintDistanceAlongDir.h @@ -29,32 +30,30 @@ /** \class SketchPlugin_ConstraintDistanceAlongDir * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines a distance along direction. - * The base class for horizontal and vertical constraints. + * \brief Feature for creation of a new constraint which defines a distance + * along direction. The base class for horizontal and vertical constraints. * * This constraint has three attributes: - * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() + * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and + * SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintDistanceAlongDir : public SketchPlugin_ConstraintDistance -{ +class SketchPlugin_ConstraintDistanceAlongDir + : public SketchPlugin_ConstraintDistance { public: /// attribute name of dimension location type - inline static const std::string& LOCATION_TYPE_ID() - { + inline static const std::string &LOCATION_TYPE_ID() { static const std::string MY_LOCATION_TYPE_ID("LocationType"); return MY_LOCATION_TYPE_ID; } /// attribute name of the distance value shown to the user - inline static const std::string& DISTANCE_VALUE_ID() - { - static const std::string& MY_DISTANCE_VALUE("DistanceValue"); + inline static const std::string &DISTANCE_VALUE_ID() { + static const std::string &MY_DISTANCE_VALUE("DistanceValue"); return MY_DISTANCE_VALUE; } /// attribute name of the sign of distance - inline static const std::string& NEGATIVE_TYPE_ID() - { + inline static const std::string &NEGATIVE_TYPE_ID() { static const std::string MY_NEGATIVE_VALUE("NegativeValue"); return MY_NEGATIVE_VALUE; } @@ -62,15 +61,17 @@ public: /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintDistanceAlongDir(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp index a4df87c20..09f43278a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchPlugin_ConstraintDistanceHorizontal.cpp @@ -28,36 +29,36 @@ #include #include +SketchPlugin_ConstraintDistanceHorizontal:: + SketchPlugin_ConstraintDistanceHorizontal() + : SketchPlugin_ConstraintDistanceAlongDir() {} -SketchPlugin_ConstraintDistanceHorizontal::SketchPlugin_ConstraintDistanceHorizontal() - : SketchPlugin_ConstraintDistanceAlongDir() -{ -} - -double SketchPlugin_ConstraintDistanceHorizontal::calculateCurrentDistance() -{ +double SketchPlugin_ConstraintDistanceHorizontal::calculateCurrentDistance() { std::shared_ptr aData = data(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); std::shared_ptr aPointA = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); std::shared_ptr aPointB = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); return aPointB->x() - aPointA->x(); } -void SketchPlugin_ConstraintDistanceHorizontal::updateFlyoutPoint() -{ +void SketchPlugin_ConstraintDistanceHorizontal::updateFlyoutPoint() { std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFlyoutPnt = aFlyoutAttr->pnt(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aEndPoint = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); + std::shared_ptr aEndPoint = + SketcherPrs_Tools::getFeaturePoint( + data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aEndPoint->pnt()->xy()); + std::shared_ptr aFlyoutDir = + aFlyoutPnt->xy()->decreased(aEndPoint->pnt()->xy()); double X = aFlyoutDir->x(); // Dot on OX axis double Y = aFlyoutDir->y(); // Cross to OX axis aFlyoutAttr->setValue(X, Y); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h index 611697e8c..3168015b3 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchPlugin_ConstraintDistanceHorizontal.h @@ -29,25 +30,27 @@ /** \class SketchPlugin_ConstraintDistanceHorizontal * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines a horizontal distance between two points. + * \brief Feature for creation of a new constraint which defines a horizontal + * distance between two points. * * This constraint has three attributes: - * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() + * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and + * SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintDistanceHorizontal : public SketchPlugin_ConstraintDistanceAlongDir -{ +class SketchPlugin_ConstraintDistanceHorizontal + : public SketchPlugin_ConstraintDistanceAlongDir { public: /// Distance constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_DISTANCE_ID("SketchConstraintDistanceHorizontal"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_DISTANCE_ID( + "SketchConstraintDistanceHorizontal"); return MY_CONSTRAINT_DISTANCE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { - static std::string MY_KIND = SketchPlugin_ConstraintDistanceHorizontal::ID(); + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + static std::string MY_KIND = + SketchPlugin_ConstraintDistanceHorizontal::ID(); return MY_KIND; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp index ea6ce98cf..26dfeb9e3 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchPlugin_ConstraintDistanceVertical.cpp @@ -28,37 +29,37 @@ #include #include +SketchPlugin_ConstraintDistanceVertical:: + SketchPlugin_ConstraintDistanceVertical() + : SketchPlugin_ConstraintDistanceAlongDir() {} -SketchPlugin_ConstraintDistanceVertical::SketchPlugin_ConstraintDistanceVertical() - : SketchPlugin_ConstraintDistanceAlongDir() -{ -} - -double SketchPlugin_ConstraintDistanceVertical::calculateCurrentDistance() -{ +double SketchPlugin_ConstraintDistanceVertical::calculateCurrentDistance() { std::shared_ptr aData = data(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); std::shared_ptr aPointA = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_A(), aPlane); std::shared_ptr aPointB = - SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_B(), aPlane); return aPointB->y() - aPointA->y(); } -void SketchPlugin_ConstraintDistanceVertical::updateFlyoutPoint() -{ +void SketchPlugin_ConstraintDistanceVertical::updateFlyoutPoint() { std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFlyoutPnt = aFlyoutAttr->pnt(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aEndPoint = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); + std::shared_ptr aEndPoint = + SketcherPrs_Tools::getFeaturePoint( + data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aEndPoint->pnt()->xy()); - double X = aFlyoutDir->y(); // Dot on OY axis + std::shared_ptr aFlyoutDir = + aFlyoutPnt->xy()->decreased(aEndPoint->pnt()->xy()); + double X = aFlyoutDir->y(); // Dot on OY axis double Y = -aFlyoutDir->x(); // Cross to OY axis aFlyoutAttr->setValue(X, Y); } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h index 506306bd1..c143ec4d0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchPlugin_ConstraintDistanceVertical.h @@ -29,24 +30,25 @@ /** \class SketchPlugin_ConstraintDistanceVertical * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines a vertical distance between two points. + * \brief Feature for creation of a new constraint which defines a vertical + * distance between two points. * * This constraint has three attributes: - * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() + * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and + * SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintDistanceVertical : public SketchPlugin_ConstraintDistanceAlongDir -{ +class SketchPlugin_ConstraintDistanceVertical + : public SketchPlugin_ConstraintDistanceAlongDir { public: /// Distance constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_DISTANCE_ID("SketchConstraintDistanceVertical"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_DISTANCE_ID( + "SketchConstraintDistanceVertical"); return MY_CONSTRAINT_DISTANCE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintDistanceVertical::ID(); return MY_KIND; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp b/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp index e3637a73e..cdd644e97 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintEqual.h" @@ -30,28 +31,23 @@ #include -SketchPlugin_ConstraintEqual::SketchPlugin_ConstraintEqual() -{ -} +SketchPlugin_ConstraintEqual::SketchPlugin_ConstraintEqual() {} -void SketchPlugin_ConstraintEqual::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintEqual::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintEqual::execute() -{ -} +void SketchPlugin_ConstraintEqual::execute() {} -AISObjectPtr SketchPlugin_ConstraintEqual::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintEqual::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::equalConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::equalConstraint(this, sketch(), thePrevious); return anAIS; } - - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintEqual.h b/src/SketchPlugin/SketchPlugin_ConstraintEqual.h index c8b0de970..28b7c051d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintEqual.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintEqual.h @@ -14,36 +14,34 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintEqual_H_ #define SketchPlugin_ConstraintEqual_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintEqual * \ingroup Plugins - * \brief Feature for creation of a new constraint specifying equality of lengths of two lines - * or equality of radii of two circular arcs (full circles) + * \brief Feature for creation of a new constraint specifying equality of + * lengths of two lines or equality of radii of two circular arcs (full circles) * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintEqual : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintEqual : public SketchPlugin_ConstraintBase { +public: /// Equal constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_EQUAL_ID("SketchConstraintEqual"); return MY_CONSTRAINT_EQUAL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintEqual::ID(); return MY_KIND; } @@ -51,11 +49,13 @@ class SketchPlugin_ConstraintEqual : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintEqual(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp index dae341a66..ae28b92ab 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintHorizontal.h" @@ -31,26 +32,21 @@ #include -SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal() -{ -} +SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal() {} -void SketchPlugin_ConstraintHorizontal::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintHorizontal::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintHorizontal::execute() -{ -} +void SketchPlugin_ConstraintHorizontal::execute() {} -AISObjectPtr SketchPlugin_ConstraintHorizontal::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintHorizontal::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::horisontalConstraint(this, sketch(), thePrevious); return anAIS; } - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h index c793570d4..daa479c51 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintHorizontal_H_ #define SketchPlugin_ConstraintHorizontal_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintHorizontal * \ingroup Plugins @@ -31,18 +32,16 @@ * This constraint has one attribute SketchPlugin_Constraint::ENTITY_A(), * which specifies a line to be horizontal */ -class SketchPlugin_ConstraintHorizontal : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintHorizontal : public SketchPlugin_ConstraintBase { +public: /// Horizontal constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_HORIZONTAL_ID("SketchConstraintHorizontal"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_HORIZONTAL_ID( + "SketchConstraintHorizontal"); return MY_CONSTRAINT_HORIZONTAL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintHorizontal::ID(); return MY_KIND; } @@ -50,11 +49,13 @@ class SketchPlugin_ConstraintHorizontal : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintHorizontal(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index cfe1da52f..b9ea091d3 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintLength.h" @@ -46,49 +47,54 @@ const double tolerance = 1e-7; -SketchPlugin_ConstraintLength::SketchPlugin_ConstraintLength() -{ +SketchPlugin_ConstraintLength::SketchPlugin_ConstraintLength() { myFlyoutUpdate = false; } -void SketchPlugin_ConstraintLength::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintLength::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::VALUE(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), + GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SketchPlugin_ConstraintLength::LOCATION_TYPE_ID(), ModelAPI_AttributeInteger::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), LOCATION_TYPE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), LOCATION_TYPE_ID()); } -void SketchPlugin_ConstraintLength::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void SketchPlugin_ConstraintLength::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "sketch_dimension_color"; theDefault = SKETCH_DIMENSION_COLOR; } -void SketchPlugin_ConstraintLength::execute() -{ - std::shared_ptr aRef = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A())); +void SketchPlugin_ConstraintLength::execute() { + std::shared_ptr aRef = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object()); if (aFeature) { // set length value - std::shared_ptr aPoint1 = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aPoint2 = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aPoint1 = + std::dynamic_pointer_cast( + aFeature->data()->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aPoint2 = + std::dynamic_pointer_cast( + aFeature->data()->attribute(SketchPlugin_Line::END_ID())); if (aPoint1.get() && aPoint2.get()) { // the value should to be computed here, not in the getAISObject // in order to change the model value - // inside the object transaction. This is important for creating a constraint by preselection. - // The display of the presentation in this case happens after the transaction commit + // inside the object transaction. This is important for creating a + // constraint by preselection. The display of the presentation in this + // case happens after the transaction commit AttributePtr aFlyOutAttribute = - data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); + data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); if (!aFlyOutAttribute->isInitialized()) { compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); } @@ -96,8 +102,7 @@ void SketchPlugin_ConstraintLength::execute() } } -bool SketchPlugin_ConstraintLength::compute(const std::string& theAttributeId) -{ +bool SketchPlugin_ConstraintLength::compute(const std::string &theAttributeId) { if (theAttributeId != SketchPlugin_Constraint::FLYOUT_VALUE_PNT()) return false; @@ -106,14 +111,15 @@ bool SketchPlugin_ConstraintLength::compute(const std::string& theAttributeId) if (!getPoints(aPoint1, aPoint2, aStartPoint, anEndPoint)) return false; - std::shared_ptr aFlyOutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(theAttributeId)); + std::shared_ptr aFlyOutAttr = + std::dynamic_pointer_cast( + data()->attribute(theAttributeId)); - std::shared_ptr aLine = - std::shared_ptr(new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt())); - if (!aFlyOutAttr->isInitialized() || - (fabs(aFlyOutAttr->x()) < tolerance && fabs(aFlyOutAttr->y()) < tolerance)) { - double aDist = aPoint1->distance(aPoint2)/5.; + std::shared_ptr aLine = std::shared_ptr( + new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt())); + if (!aFlyOutAttr->isInitialized() || (fabs(aFlyOutAttr->x()) < tolerance && + fabs(aFlyOutAttr->y()) < tolerance)) { + double aDist = aPoint1->distance(aPoint2) / 5.; std::shared_ptr aFPnt = aLine->shiftedLocation(aDist); aFlyOutAttr->setValue(aFPnt); } @@ -121,8 +127,7 @@ bool SketchPlugin_ConstraintLength::compute(const std::string& theAttributeId) return true; } -bool SketchPlugin_ConstraintLength::computeLenghtValue(double& theValue) -{ +bool SketchPlugin_ConstraintLength::computeLenghtValue(double &theValue) { bool aResult = false; std::shared_ptr aPoint1, aPoint2; std::shared_ptr aStartPoint, anEndPoint; @@ -134,61 +139,64 @@ bool SketchPlugin_ConstraintLength::computeLenghtValue(double& theValue) } bool SketchPlugin_ConstraintLength::getPoints( - std::shared_ptr& thePoint1, std::shared_ptr& thePoint2, - std::shared_ptr& theStartPoint, - std::shared_ptr& theEndPoint) -{ + std::shared_ptr &thePoint1, + std::shared_ptr &thePoint2, + std::shared_ptr &theStartPoint, + std::shared_ptr &theEndPoint) { if (!sketch()) return false; - std::shared_ptr anAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::shared_ptr anAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); if (!anAttr) return false; FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object()); if (!aFeature || aFeature->getKind() != SketchPlugin_Line::ID()) return false; DataPtr aData = aFeature->data(); - theStartPoint = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::START_ID())); - theEndPoint = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID())); + theStartPoint = std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::START_ID())); + theEndPoint = std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::END_ID())); thePoint1 = sketch()->to3D(theStartPoint->x(), theStartPoint->y()); thePoint2 = sketch()->to3D(theEndPoint->x(), theEndPoint->y()); return true; } -AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, - sketch(), thePrevious); + AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint( + this, sketch(), thePrevious); if (anAIS.get() && !thePrevious.get()) SketchPlugin_Tools::setDimensionColor(anAIS); return anAIS; } -void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) { - if (theID == SketchPlugin_Constraint::ENTITY_A()) - { - std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(attribute(SketchPlugin_Constraint::VALUE())); +void SketchPlugin_ConstraintLength::attributeChanged(const std::string &theID) { + if (theID == SketchPlugin_Constraint::ENTITY_A()) { + std::shared_ptr aValueAttr = + std::dynamic_pointer_cast( + attribute(SketchPlugin_Constraint::VALUE())); if (!aValueAttr->isInitialized()) { // only if it is not initialized, try to compute the current value double aLength; if (computeLenghtValue(aLength)) aValueAttr->setValue(aLength); } - } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { + } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && + !myFlyoutUpdate) { // Recalculate flyout point in local coordinates of the line: - // the X coordinate is a length of projection of the flyout point on the line - // the Y coordinate is a distance from the point to the line + // the X coordinate is a length of projection of the flyout point on the + // line the Y coordinate is a distance from the point to the line std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - AttributeRefAttrPtr aLineAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::ENTITY_A())); + attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + AttributeRefAttrPtr aLineAttr = + std::dynamic_pointer_cast( + attribute(SketchPlugin_Constraint::ENTITY_A())); if (!aLineAttr || !aLineAttr->isObject()) return; FeaturePtr aLine = ModelAPI_Feature::feature(aLineAttr->object()); @@ -196,14 +204,22 @@ void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) { return; std::shared_ptr aFlyoutPnt = aFlyoutAttr->pnt(); - std::shared_ptr aStartPnt = std::dynamic_pointer_cast( - aLine->attribute(SketchPlugin_Line::START_ID()))->pnt()->xy(); - std::shared_ptr aEndPnt = std::dynamic_pointer_cast( - aLine->attribute(SketchPlugin_Line::END_ID()))->pnt()->xy(); + std::shared_ptr aStartPnt = + std::dynamic_pointer_cast( + aLine->attribute(SketchPlugin_Line::START_ID())) + ->pnt() + ->xy(); + std::shared_ptr aEndPnt = + std::dynamic_pointer_cast( + aLine->attribute(SketchPlugin_Line::END_ID())) + ->pnt() + ->xy(); myFlyoutUpdate = true; - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); + std::shared_ptr aLineDir( + new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); + std::shared_ptr aFlyoutDir = + aFlyoutPnt->xy()->decreased(aStartPnt); double X = aFlyoutDir->dot(aLineDir->xy()); double Y = -aFlyoutDir->cross(aLineDir->xy()); aFlyoutAttr->setValue(X, Y); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.h b/src/SketchPlugin/SketchPlugin_ConstraintLength.h index b150a48c7..1ba2f9065 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintLength_H_ @@ -33,32 +34,31 @@ class GeomDataAPI_Point2D; /** \class SketchPlugin_ConstraintLength * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines a length of a line segment + * \brief Feature for creation of a new constraint which defines a length of a + * line segment * * This constraint has two attributes: - * SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment), - * SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle) + * SketchPlugin_Constraint::VALUE() (length) and + * SketchPlugin_Constraint::ENTITY_A() (segment), + * SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints + * handle) */ -class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase { +public: /// Length constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_LENGTH_ID("SketchConstraintLength"); return MY_CONSTRAINT_LENGTH_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintLength::ID(); return MY_KIND; } /// attribute name of dimension location type - inline static const std::string& LOCATION_TYPE_ID() - { + inline static const std::string &LOCATION_TYPE_ID() { static const std::string MY_LOCATION_TYPE_ID("LocationType"); return MY_LOCATION_TYPE_ID; } @@ -66,42 +66,46 @@ class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Computes the attribute value on the base of other attributes if the value can be computed - /// \param theAttributeId an attribute index to be computed + /// Computes the attribute value on the base of other attributes if the value + /// can be computed \param theAttributeId an attribute index to be computed /// \return a boolean value about it is computed - SKETCHPLUGIN_EXPORT virtual bool compute(const std::string& theAttributeId); + SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintLength(); /// Computes distance between lenght point attributes - /// \param theValue [out] distance or 0 if one of point attributes is not initialized - /// \return boolean value if distance is computed - bool computeLenghtValue(double& theValue); + /// \param theValue [out] distance or 0 if one of point attributes is not + /// initialized \return boolean value if distance is computed + bool computeLenghtValue(double &theValue); private: /// retrns the points-base of length, returns false if it is not possible - bool getPoints( - std::shared_ptr& thePoint1, std::shared_ptr& thePoint2, - std::shared_ptr& theStartPoint, - std::shared_ptr& theEndPoint); + bool getPoints(std::shared_ptr &thePoint1, + std::shared_ptr &thePoint2, + std::shared_ptr &theStartPoint, + std::shared_ptr &theEndPoint); private: - bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point + bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of + ///< flyout point }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp index ddfe2b9c2..b8b7998b6 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintMiddle.h" @@ -23,61 +24,57 @@ #include -#include #include +#include #include #include #include - class RaiiSetBoolFlag { public: RaiiSetBoolFlag() = delete; - RaiiSetBoolFlag(bool &theFlag) - { + RaiiSetBoolFlag(bool &theFlag) { myBoolPtr = &theFlag; *myBoolPtr = true; } - ~RaiiSetBoolFlag() - { - *myBoolPtr = false; - } + ~RaiiSetBoolFlag() { *myBoolPtr = false; } + private: bool *myBoolPtr; }; - -SketchPlugin_ConstraintMiddle::SketchPlugin_ConstraintMiddle() -{ +SketchPlugin_ConstraintMiddle::SketchPlugin_ConstraintMiddle() { myBlockAttribInit = false; } // Create new point for Middle constraint -void SketchPlugin_ConstraintMiddle::CreatePoint() -{ +void SketchPlugin_ConstraintMiddle::CreatePoint() { // Wait all objects being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - auto aTrPnt = std::dynamic_pointer_cast(data()->attribute(POINT_REF_ID())); + auto aTrPnt = std::dynamic_pointer_cast( + data()->attribute(POINT_REF_ID())); - if (!myPoint) - { + if (!myPoint) { // Get last subfeature (constraintMiddle) for set as parent - FeaturePtr aCurrentFeature = sketch()->subFeature(sketch()->numberOfSubs() - 1); + FeaturePtr aCurrentFeature = + sketch()->subFeature(sketch()->numberOfSubs() - 1); keepCurrentFeature(); myPoint = sketch()->addFeature(SketchPlugin_Point::ID()); myPoint->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue(true); restoreCurrentFeature(); - myPoint->reference(SketchPlugin_Point::PARENT_ID())->setValue(aCurrentFeature); + myPoint->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(aCurrentFeature); } AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( - myPoint->attribute(SketchPlugin_Point::COORD_ID())); + myPoint->attribute(SketchPlugin_Point::COORD_ID())); aCoord->setValue(aTrPnt->pnt()); myPoint->execute(); @@ -85,93 +82,99 @@ void SketchPlugin_ConstraintMiddle::CreatePoint() // Init second attr for constraint refattr(SketchPlugin_Constraint::ENTITY_B())->setObject(myPoint); - if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, true); } -void SketchPlugin_ConstraintMiddle::initAttributes() -{ - // To maintain compatibility with older study versions, keep the order of all previously existing attributes: +void SketchPlugin_ConstraintMiddle::initAttributes() { + // To maintain compatibility with older study versions, keep the order of all + // previously existing attributes: // 1) ENTITY_A // 2) ENTITY_B // ----------- new attributes start here: // 3) MIDDLE_TYPE // 4) POINT_REF_ID - AttributeRefAttrPtr aAttrEntA = std::dynamic_pointer_cast( - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId())); - - AttributeRefAttrPtr aAttrEntB = std::dynamic_pointer_cast( - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId())); - - AttributeStringPtr aMethodAttr = std::dynamic_pointer_cast( - data()->addAttribute(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE(), ModelAPI_AttributeString::typeId())); - - // When loading studies from older versions (<9.12), the MIDDLE_TYPE attribute did not exist - // and is therefore not initialized! - // BUT: in case of a valid middle point constraint, the ENTITY_A and ENTITY_B attributes must be initialized + AttributeRefAttrPtr aAttrEntA = + std::dynamic_pointer_cast( + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId())); + + AttributeRefAttrPtr aAttrEntB = + std::dynamic_pointer_cast( + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId())); + + AttributeStringPtr aMethodAttr = + std::dynamic_pointer_cast( + data()->addAttribute(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE(), + ModelAPI_AttributeString::typeId())); + + // When loading studies from older versions (<9.12), the MIDDLE_TYPE attribute + // did not exist and is therefore not initialized! BUT: in case of a valid + // middle point constraint, the ENTITY_A and ENTITY_B attributes must be + // initialized bool useDefaultMethod = !aMethodAttr->isInitialized(); - if (aAttrEntA->isInitialized() && aAttrEntB->isInitialized() && useDefaultMethod) - { - // Initialize the creation method attribute (MIDDLE_TYPE) with the previously default - // creation method: "mid point from line and point". - // NOTE: ensure that the other attributes are NOT reset, as we want to keep the current inputs + if (aAttrEntA->isInitialized() && aAttrEntB->isInitialized() && + useDefaultMethod) { + // Initialize the creation method attribute (MIDDLE_TYPE) with the + // previously default creation method: "mid point from line and point". + // NOTE: ensure that the other attributes are NOT reset, as we want to keep + // the current inputs RaiiSetBoolFlag blockEntityReset(myBlockAttribInit); aMethodAttr->setValue(MIDDLE_TYPE_BY_LINE_AND_POINT()); } data()->addAttribute(POINT_REF_ID(), GeomDataAPI_Point2D::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + POINT_REF_ID()); } -void SketchPlugin_ConstraintMiddle::execute() -{ - if (string(MIDDLE_TYPE())->value() == MIDDLE_TYPE_BY_LINE()) - { - std::dynamic_pointer_cast(data()->attribute(POINT_REF_ID()))->setValue(1., 1.); - AttributeRefAttrPtr aPointRes = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_B())); - - auto aRefAttr = data()->refattr(SketchPlugin_Constraint::ENTITY_A())->object(); +void SketchPlugin_ConstraintMiddle::execute() { + if (string(MIDDLE_TYPE())->value() == MIDDLE_TYPE_BY_LINE()) { + std::dynamic_pointer_cast( + data()->attribute(POINT_REF_ID())) + ->setValue(1., 1.); + AttributeRefAttrPtr aPointRes = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_B())); + + auto aRefAttr = + data()->refattr(SketchPlugin_Constraint::ENTITY_A())->object(); if (!aRefAttr.get()) return; - if (!attribute(ENTITY_B())->isInitialized()) CreatePoint(); // Create new point } } -void SketchPlugin_ConstraintMiddle::attributeChanged(const std::string& theID) -{ - if (theID == MIDDLE_TYPE()) - { +void SketchPlugin_ConstraintMiddle::attributeChanged(const std::string &theID) { + if (theID == MIDDLE_TYPE()) { if (!myBlockAttribInit) { SketchPlugin_Tools::resetAttribute(this, ENTITY_A()); SketchPlugin_Tools::resetAttribute(this, ENTITY_B()); } - } - else if (theID == POINT_REF_ID()) - { + } else if (theID == POINT_REF_ID()) { if (!myPoint) return; - auto aTrPnt = std::dynamic_pointer_cast(data()->attribute(POINT_REF_ID())); + auto aTrPnt = std::dynamic_pointer_cast( + data()->attribute(POINT_REF_ID())); AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( - myPoint->attribute(SketchPlugin_Point::COORD_ID())); + myPoint->attribute(SketchPlugin_Point::COORD_ID())); aCoord->setValue(aTrPnt->pnt()); myPoint->execute(); } } -AISObjectPtr SketchPlugin_ConstraintMiddle::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintMiddle::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::middleConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::middleConstraint(this, sketch(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h index 686e60b15..6cd4afd92 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h @@ -14,81 +14,78 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintMiddle_H_ #define SketchPlugin_ConstraintMiddle_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include class ModelAPI_Feature; /** \class SketchPlugin_ConstraintMiddle * \ingroup Plugins - * \brief Feature for creation of a new constraint which places a point in the middle of a line + * \brief Feature for creation of a new constraint which places a point in the + * middle of a line * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintMiddle : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintMiddle : public SketchPlugin_ConstraintBase { +public: /// Parallel constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_MIDDLE_ID("SketchConstraintMiddle"); return MY_CONSTRAINT_MIDDLE_ID; } /// Middle constraint kind - inline static const std::string& MIDDLE_TYPE() - { + inline static const std::string &MIDDLE_TYPE() { static const std::string MY_TYPE_ID("middle_type"); return MY_TYPE_ID; } /// Middle constraint type by line and point - inline static const std::string& MIDDLE_TYPE_BY_LINE_AND_POINT() - { + inline static const std::string &MIDDLE_TYPE_BY_LINE_AND_POINT() { static const std::string MY_TYPE_ID("middle_type_by_line_and_point"); return MY_TYPE_ID; } /// Middle constraint type by line - inline static const std::string& MIDDLE_TYPE_BY_LINE() - { + inline static const std::string &MIDDLE_TYPE_BY_LINE() { static const std::string MY_TYPE_ID("middle_type_by_line"); return MY_TYPE_ID; } /// Created points for middle type by line - inline static const std::string& POINT_REF_ID() - { + inline static const std::string &POINT_REF_ID() { static const std::string MY_POINT_REF("point"); return MY_POINT_REF; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintMiddle::ID(); return MY_KIND; } /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintMiddle(); @@ -97,7 +94,7 @@ private: void CreatePoint(); std::shared_ptr myPoint; - bool myBlockAttribInit; + bool myBlockAttribInit; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp index fbbb8044a..3d0401239 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintMirror.h" #include -#include -#include #include +#include #include +#include #include -#include #include +#include #include #include @@ -35,48 +36,52 @@ #include -SketchPlugin_ConstraintMirror::SketchPlugin_ConstraintMirror() -{ -} +SketchPlugin_ConstraintMirror::SketchPlugin_ConstraintMirror() {} -void SketchPlugin_ConstraintMirror::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), ModelAPI_AttributeRefList::typeId()); +void SketchPlugin_ConstraintMirror::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), + ModelAPI_AttributeRefList::typeId()); data()->addAttribute(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), ModelAPI_AttributeRefList::typeId()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_C()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_B()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_C()); } -void SketchPlugin_ConstraintMirror::execute() -{ - AttributeRefListPtr aMirrorObjectRefs = reflist(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID()); +void SketchPlugin_ConstraintMirror::execute() { + AttributeRefListPtr aMirrorObjectRefs = + reflist(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID()); // Wait all objects being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - // Save the current feature of the document, because new features may appear while executing. - // In this case, they will become current. But if the number of copies is updated from outside - // of sketch (e.g. by parameter change), the history line should not hold in sketch. + // Save the current feature of the document, because new features may appear + // while executing. In this case, they will become current. But if the number + // of copies is updated from outside of sketch (e.g. by parameter change), the + // history line should not hold in sketch. keepCurrentFeature(); std::shared_ptr aData = data(); - AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::ENTITY_B())); - AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::ENTITY_C())); - std::list anInitialList = aRefListOfShapes->list(); - std::list aMirroredList = aRefListOfMirrored->list(); + AttributeRefListPtr aRefListOfShapes = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + AttributeRefListPtr aRefListOfMirrored = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_C())); + std::list anInitialList = aRefListOfShapes->list(); + std::list aMirroredList = aRefListOfMirrored->list(); std::vector isUsed(anInitialList.size(), false); // add new items to the list - for(int anInd = 0; anInd < aMirrorObjectRefs->size(); anInd++) { + for (int anInd = 0; anInd < aMirrorObjectRefs->size(); anInd++) { ObjectPtr anObject = aMirrorObjectRefs->object(anInd); std::list::const_iterator anIt = anInitialList.begin(); std::vector::iterator aUsedIt = isUsed.begin(); @@ -100,9 +105,10 @@ void SketchPlugin_ConstraintMirror::execute() aRefListOfMirrored->remove(*aMirrorIter); // remove the corresponding feature from the sketch ResultConstructionPtr aRC = - std::dynamic_pointer_cast(*aMirrorIter); + std::dynamic_pointer_cast( + *aMirrorIter); DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr(); - FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); + FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); if (aFeature) aFeaturesToBeRemoved.insert(aFeature); } @@ -114,21 +120,23 @@ void SketchPlugin_ConstraintMirror::execute() } ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved); - static Events_ID aRedisplayEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID aRedisplayEvent = + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); // Check consistency of initial list and mirrored list - anInitialList = aRefListOfShapes->list(); + anInitialList = aRefListOfShapes->list(); anInitIter = anInitialList.begin(); aMirrorIter = aMirroredList.begin(); - int indFirstWrong = 0; // index of element starts difference in the lists + int indFirstWrong = 0; // index of element starts difference in the lists std::set anInvalidInd; // list of indices of removed features std::shared_ptr aFeatureIn, aFeatureOut; - for ( ; anInitIter != anInitialList.end(); anInitIter++, indFirstWrong++) { + for (; anInitIter != anInitialList.end(); anInitIter++, indFirstWrong++) { // Add features and store indices of objects to remove aFeatureIn = std::dynamic_pointer_cast(*anInitIter); ResultConstructionPtr aRCIn; if (!aFeatureIn) { - aRCIn = std::dynamic_pointer_cast(*anInitIter); + aRCIn = + std::dynamic_pointer_cast(*anInitIter); if (aRCIn) aFeatureIn = std::dynamic_pointer_cast( aRCIn->document()->feature(aRCIn)); @@ -136,7 +144,8 @@ void SketchPlugin_ConstraintMirror::execute() if (aMirrorIter == aMirroredList.end()) aFeatureOut = std::shared_ptr(); else { - aFeatureOut = std::dynamic_pointer_cast(*aMirrorIter); + aFeatureOut = + std::dynamic_pointer_cast(*aMirrorIter); if (!aFeatureOut) { ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anInitIter); @@ -154,17 +163,19 @@ void SketchPlugin_ConstraintMirror::execute() if (aMirrorIter != aMirroredList.end()) break; // the lists are inconsistent // There is no mirrored object yet, create it - FeaturePtr aNewFeature = - SketchPlugin_Sketch::addUniqueNamedCopiedFeature(aFeatureIn, sketch(), true); + FeaturePtr aNewFeature = SketchPlugin_Sketch::addUniqueNamedCopiedFeature( + aFeatureIn, sketch(), true); aNewFeature->execute(); ModelAPI_EventCreator::get()->sendUpdated(aNewFeature, aRedisplayEvent); std::shared_ptr aShapeIn = aRCIn->shape(); - const std::list& aResults = aNewFeature->results(); + const std::list &aResults = aNewFeature->results(); std::list::const_iterator anIt = aResults.begin(); for (; anIt != aResults.end(); anIt++) { - ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anIt); - if (!aRC) continue; + ResultConstructionPtr aRC = + std::dynamic_pointer_cast(*anIt); + if (!aRC) + continue; std::shared_ptr aShapeOut = aRC->shape(); if ((aShapeIn->isVertex() && aShapeOut->isVertex()) || (aShapeIn->isEdge() && aShapeOut->isEdge()) || @@ -183,22 +194,26 @@ void SketchPlugin_ConstraintMirror::execute() } // Remove from the list objects already deleted before std::set::reverse_iterator anIt = anInvalidInd.rbegin(); - for ( ; anIt != anInvalidInd.rend(); anIt++) { - if (*anIt < indFirstWrong) indFirstWrong--; + for (; anIt != anInvalidInd.rend(); anIt++) { + if (*anIt < indFirstWrong) + indFirstWrong--; aRefListOfShapes->remove(aRefListOfShapes->object(*anIt)); aRefListOfMirrored->remove(aRefListOfMirrored->object(*anIt)); } - // If the lists inconsistent, remove all objects from mirrored list starting from indFirstWrong + // If the lists inconsistent, remove all objects from mirrored list starting + // from indFirstWrong if (anInitIter != anInitialList.end()) { while (aRefListOfMirrored->size() > indFirstWrong) aRefListOfMirrored->remove(aRefListOfMirrored->object(indFirstWrong)); // Create mirrored features instead of removed - anInitialList = aRefListOfShapes->list(); + anInitialList = aRefListOfShapes->list(); anInitIter = anInitialList.begin(); - for (int i = 0; i < indFirstWrong; i++) anInitIter++; - for ( ; anInitIter != anInitialList.end(); anInitIter++) { + for (int i = 0; i < indFirstWrong; i++) + anInitIter++; + for (; anInitIter != anInitialList.end(); anInitIter++) { aFeatureIn = std::dynamic_pointer_cast(*anInitIter); - FeaturePtr aNewFeature = aFeatureIn->document()->addFeature(aFeatureIn->getKind()); + FeaturePtr aNewFeature = + aFeatureIn->document()->addFeature(aFeatureIn->getKind()); aRefListOfMirrored->append(aNewFeature); } } @@ -210,38 +225,40 @@ void SketchPlugin_ConstraintMirror::execute() Events_Loop::loop()->setFlushed(anUpdateEvent, true); } -AISObjectPtr SketchPlugin_ConstraintMirror::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintMirror::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::mirrorConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::mirrorConstraint(this, sketch(), thePrevious); return anAIS; } -void SketchPlugin_ConstraintMirror::erase() -{ +void SketchPlugin_ConstraintMirror::erase() { // Set copy attribute to false on all copied features. - AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_C())); + AttributeRefListPtr aRefListOfMirrored = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_C())); - if(aRefListOfMirrored.get()) { - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + if (aRefListOfMirrored.get()) { + static Events_Loop *aLoop = Events_Loop::loop(); + static Events_ID aRedispEvent = + aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); std::list aTargetList = aRefListOfMirrored->list(); - for(std::list::const_iterator aTargetIt = - aTargetList.cbegin(); aTargetIt != aTargetList.cend(); aTargetIt++) { - if((*aTargetIt).get()) { + for (std::list::const_iterator aTargetIt = aTargetList.cbegin(); + aTargetIt != aTargetList.cend(); aTargetIt++) { + if ((*aTargetIt).get()) { ResultPtr aRes = std::dynamic_pointer_cast(*aTargetIt); - if(aRes.get()) { + if (aRes.get()) { FeaturePtr aFeature = aRes->document()->feature(aRes); - if(aFeature.get()) { + if (aFeature.get()) { AttributeBooleanPtr aBooleanAttr = - aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); - if(aBooleanAttr.get()) { - if (ModelAPI_Session::get()->isOperation()) // if this is not undo or redo + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if (aBooleanAttr.get()) { + if (ModelAPI_Session::get() + ->isOperation()) // if this is not undo or redo aBooleanAttr->setValue(false); // Redisplay object as it is not copy anymore. ModelAPI_EventCreator::get()->sendUpdated(aRes, aRedispEvent); @@ -255,15 +272,15 @@ void SketchPlugin_ConstraintMirror::erase() SketchPlugin_ConstraintBase::erase(); } -void SketchPlugin_ConstraintMirror::attributeChanged(const std::string& theID) -{ +void SketchPlugin_ConstraintMirror::attributeChanged(const std::string &theID) { if (theID == MIRROR_LIST_ID()) { AttributeRefListPtr aMirrorObjectRefs = reflist(MIRROR_LIST_ID()); if (aMirrorObjectRefs->size() == 0) { DocumentPtr aDoc = document(); // Clear list of objects - AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_C())); + AttributeRefListPtr aRefListOfMirrored = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_C())); std::list aTargetList = aRefListOfMirrored->list(); std::list::iterator aTargetIter = aTargetList.begin(); for (; aTargetIter != aTargetList.end(); aTargetIter++) { @@ -273,8 +290,8 @@ void SketchPlugin_ConstraintMirror::attributeChanged(const std::string& theID) } aRefListOfMirrored->clear(); std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_B()))->clear(); + data()->attribute(SketchPlugin_Constraint::ENTITY_B())) + ->clear(); } } } - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.h b/src/SketchPlugin/SketchPlugin_ConstraintMirror.h index 10daa80cd..5fd8775d9 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.h @@ -14,19 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintMirror_H_ #define SketchPlugin_ConstraintMirror_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintMirror * \ingroup Plugins - * \brief Feature for creation of a new constraint mirroring a list of objects regarding to a given line + * \brief Feature for creation of a new constraint mirroring a list of objects + * regarding to a given line * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() for mirror line and @@ -35,25 +37,21 @@ * Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C() * which contains list of mirrored objects */ -class SketchPlugin_ConstraintMirror : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintMirror : public SketchPlugin_ConstraintBase { +public: /// Mirror constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_MIRROR_ID("SketchConstraintMirror"); return MY_CONSTRAINT_MIRROR_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintMirror::ID(); return MY_KIND; } /// List of objects to be mirrored - inline static const std::string& MIRROR_LIST_ID() - { + inline static const std::string &MIRROR_LIST_ID() { static const std::string MY_MIRROR_LIST_ID("ConstraintMirrorList"); return MY_MIRROR_LIST_ID; } @@ -61,15 +59,17 @@ class SketchPlugin_ConstraintMirror : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// removes all fields from this feature: results, data, etc SKETCHPLUGIN_EXPORT virtual void erase(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp index 2c5977867..8da0d5c32 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintParallel.h" @@ -28,36 +29,31 @@ #include -#include -#include #include +#include #include #include +#include #include -SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() -{ -} +SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() {} -void SketchPlugin_ConstraintParallel::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintParallel::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintParallel::execute() -{ -} +void SketchPlugin_ConstraintParallel::execute() {} -AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::parallelConstraint(this, sketch(), thePrevious); return anAIS; } - - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h index db6ebaf4c..347571c11 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintParallel_H_ #define SketchPlugin_ConstraintParallel_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintParallel * \ingroup Plugins @@ -31,18 +32,16 @@ * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintParallel : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintParallel : public SketchPlugin_ConstraintBase { +public: /// Parallel constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_PARALLEL_ID("SketchConstraintParallel"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_PARALLEL_ID( + "SketchConstraintParallel"); return MY_CONSTRAINT_PARALLEL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintParallel::ID(); return MY_KIND; } @@ -50,11 +49,13 @@ class SketchPlugin_ConstraintParallel : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintParallel(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp index 108ee2a16..0c626c9c1 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintPerpendicular.h" @@ -29,33 +30,29 @@ #include -#include -#include #include +#include +#include #include -SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular() -{ -} +SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular() {} -void SketchPlugin_ConstraintPerpendicular::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintPerpendicular::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintPerpendicular::execute() -{ -} +void SketchPlugin_ConstraintPerpendicular::execute() {} -AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::perpendicularConstraint(this, sketch(), thePrevious); return anAIS; } - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h index 46b6c3d60..d501bba35 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h @@ -14,35 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintPerpendicular_H_ #define SketchPlugin_ConstraintPerpendicular_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintPerpendicular * \ingroup Plugins - * \brief Feature for creation of a new constraint for perpendicularity of two lines + * \brief Feature for creation of a new constraint for perpendicularity of two + * lines * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintPerpendicular : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintPerpendicular + : public SketchPlugin_ConstraintBase { +public: /// Perpendicular constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_PERPENDICULAR_ID("SketchConstraintPerpendicular"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_PERPENDICULAR_ID( + "SketchConstraintPerpendicular"); return MY_CONSTRAINT_PERPENDICULAR_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintPerpendicular::ID(); return MY_KIND; } @@ -50,11 +51,13 @@ class SketchPlugin_ConstraintPerpendicular : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintPerpendicular(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index 6dc1bd1df..6f58384ba 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintRadius.h" @@ -33,62 +34,65 @@ #include #include -#include #include #include #include +#include #include #include -#include #include +#include #include const double tolerance = 1.e-7; -SketchPlugin_ConstraintRadius::SketchPlugin_ConstraintRadius() -{ +SketchPlugin_ConstraintRadius::SketchPlugin_ConstraintRadius() { myFlyoutUpdate = false; } -void SketchPlugin_ConstraintRadius::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); +void SketchPlugin_ConstraintRadius::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::VALUE(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), + GeomDataAPI_Point2D::typeId()); data()->addAttribute(SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID(), ModelAPI_AttributeInteger::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), LOCATION_TYPE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), LOCATION_TYPE_ID()); } -void SketchPlugin_ConstraintRadius::colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault) -{ +void SketchPlugin_ConstraintRadius::colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) { theSection = "Visualization"; theName = "sketch_dimension_color"; theDefault = SKETCH_DIMENSION_COLOR; } -void SketchPlugin_ConstraintRadius::execute() -{ - std::shared_ptr aRef = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A())); +void SketchPlugin_ConstraintRadius::execute() { + std::shared_ptr aRef = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object()); if (aFeature) { // the value should to be computed here, // not in the getAISObject in order to change the model value - // inside the object transaction. This is important for creating a constraint by preselection. - // The display of the presentation in this case happens after the transaction commit - std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + // inside the object transaction. This is important for creating a + // constraint by preselection. The display of the presentation in this case + // happens after the transaction commit + std::shared_ptr aFlyoutAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); if (!aFlyoutAttr->isInitialized()) compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); } } -bool SketchPlugin_ConstraintRadius::compute(const std::string& theAttributeId) -{ +bool SketchPlugin_ConstraintRadius::compute(const std::string &theAttributeId) { if (theAttributeId != SketchPlugin_Constraint::FLYOUT_VALUE_PNT()) return false; @@ -98,35 +102,38 @@ bool SketchPlugin_ConstraintRadius::compute(const std::string& theAttributeId) return false; // Flyout point - std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(theAttributeId)); + std::shared_ptr aFlyoutAttr = + std::dynamic_pointer_cast( + data()->attribute(theAttributeId)); // Prepare a circle if (aCyrcFeature->getKind() == SketchPlugin_Circle::ID()) { // circle std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast( - aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID())); + std::dynamic_pointer_cast( + aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID())); double aShift = aRadius * 1.1; std::shared_ptr aPnt = aCenterAttr->pnt(); - std::shared_ptr aFPnt = - std::shared_ptr(new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift)); + std::shared_ptr aFPnt = std::shared_ptr( + new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift)); aFlyoutAttr->setValue(aFPnt); } else { // arc - std::shared_ptr aStartAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID())); + std::shared_ptr aStartAttr = + std::dynamic_pointer_cast( + aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID())); aFlyoutAttr->setValue(aStartAttr->pnt()); } return true; } -double SketchPlugin_ConstraintRadius::circleRadius(std::shared_ptr& theCirc) -{ +double SketchPlugin_ConstraintRadius::circleRadius( + std::shared_ptr &theCirc) { static const double kErrorResult = -1.; if (!sketch()) return kErrorResult; std::shared_ptr aData = data(); - std::shared_ptr anAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::shared_ptr anAttr = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); if (!anAttr) return kErrorResult; theCirc = ModelAPI_Feature::feature(anAttr->object()); @@ -137,57 +144,63 @@ double SketchPlugin_ConstraintRadius::circleRadius(std::shared_ptrdata(); std::shared_ptr aCenterAttr; if (aKind == SketchPlugin_Circle::ID()) { - AttributeDoublePtr aCircRadius = std::dynamic_pointer_cast( - aCircData->attribute(SketchPlugin_Circle::RADIUS_ID())); + AttributeDoublePtr aCircRadius = + std::dynamic_pointer_cast( + aCircData->attribute(SketchPlugin_Circle::RADIUS_ID())); return aCircRadius->value(); } else { aCenterAttr = std::dynamic_pointer_cast( aCircData->attribute(SketchPlugin_Arc::CENTER_ID())); - std::shared_ptr aStartAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aCircData->attribute(SketchPlugin_Arc::START_ID())); + std::shared_ptr aStartAttr = + std::dynamic_pointer_cast( + aCircData->attribute(SketchPlugin_Arc::START_ID())); return aCenterAttr->pnt()->distance(aStartAttr->pnt()); } return kErrorResult; } -AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::radiusConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::radiusConstraint(this, sketch(), thePrevious); if (anAIS.get() && !thePrevious.get()) SketchPlugin_Tools::setDimensionColor(anAIS); return anAIS; } -void SketchPlugin_ConstraintRadius::attributeChanged(const std::string& theID) { +void SketchPlugin_ConstraintRadius::attributeChanged(const std::string &theID) { if (theID == SketchPlugin_Constraint::ENTITY_A()) { - std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE())); + std::shared_ptr aValueAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::VALUE())); if (!aValueAttr->isInitialized()) { // only if it is not initialized, try to compute the current value std::shared_ptr aCyrcFeature; double aRadius = circleRadius(aCyrcFeature); - if (aRadius > 0) { // set as value the radius of updated reference to another circle + if (aRadius > + 0) { // set as value the radius of updated reference to another circle aValueAttr->setValue(aRadius); } } - } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { + } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && + !myFlyoutUpdate) { // Recalculate flyout point in local coordinates of the circle (or arc): // coordinates are calculated according to center of the shape std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + attribute(SketchPlugin_Constraint::ENTITY_A())); if (!aRefAttr || !aRefAttr->isObject()) return; FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); if (!aFeature || (aFeature->getKind() != SketchPlugin_Arc::ID() && - aFeature->getKind() != SketchPlugin_Circle::ID())) + aFeature->getKind() != SketchPlugin_Circle::ID())) return; std::string aCenterAttrName; @@ -195,11 +208,13 @@ void SketchPlugin_ConstraintRadius::attributeChanged(const std::string& theID) { aCenterAttrName = SketchPlugin_Circle::CENTER_ID(); else if (aFeature->getKind() == SketchPlugin_Arc::ID()) aCenterAttrName = SketchPlugin_Arc::CENTER_ID(); - std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aFeature->data()->attribute(aCenterAttrName)); + std::shared_ptr aCenterAttr = + std::dynamic_pointer_cast( + aFeature->data()->attribute(aCenterAttrName)); std::shared_ptr aCenter = aCenterAttr->pnt(); - std::shared_ptr aRadius = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(attribute(SketchPlugin_Constraint::VALUE())); + std::shared_ptr aRadius = + std::dynamic_pointer_cast( + attribute(SketchPlugin_Constraint::VALUE())); std::shared_ptr aFlyoutPnt = aFlyoutAttr->pnt(); double aDist = aFlyoutPnt->distance(aCenter); @@ -207,7 +222,8 @@ void SketchPlugin_ConstraintRadius::attributeChanged(const std::string& theID) { return; myFlyoutUpdate = true; - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aCenter->xy()); + std::shared_ptr aFlyoutDir = + aFlyoutPnt->xy()->decreased(aCenter->xy()); aFlyoutAttr->setValue(aFlyoutDir->x(), aFlyoutDir->y()); myFlyoutUpdate = false; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h index e1edf88c1..601d2e5cd 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h @@ -14,43 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintRadius_H_ #define SketchPlugin_ConstraintRadius_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintRadius * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines + * \brief Feature for creation of a new constraint which defines * a radius of a circle or an arc of circle * * This constraint has two attributes: - * SketchPlugin_Constraint::VALUE() (radius), SketchPlugin_Constraint::ENTITY_A() (a circle) + * SketchPlugin_Constraint::VALUE() (radius), + * SketchPlugin_Constraint::ENTITY_A() (a circle) */ -class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase { +public: /// Radius constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_RADIUS_ID("SketchConstraintRadius"); return MY_CONSTRAINT_RADIUS_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintRadius::ID(); return MY_KIND; } /// attribute name of dimension location type - inline static const std::string& LOCATION_TYPE_ID() - { + inline static const std::string &LOCATION_TYPE_ID() { static const std::string MY_LOCATION_TYPE_ID("LocationType"); return MY_LOCATION_TYPE_ID; } @@ -58,35 +56,39 @@ class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Computes the attribute value on the base of other attributes if the value can be computed - /// \param theAttributeId an attribute index to be computed + /// Computes the attribute value on the base of other attributes if the value + /// can be computed \param theAttributeId an attribute index to be computed /// \return a boolean value about it is computed - SKETCHPLUGIN_EXPORT virtual bool compute(const std::string& theAttributeId); + SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, - std::string& theDefault); + SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintRadius(); private: - /// Checks and gets the radius of referenced circle (or arc) otherwise returns -1. - /// \param theCircData the found referenced circle returned by this method - double circleRadius(std::shared_ptr& theCirc); + /// Checks and gets the radius of referenced circle (or arc) otherwise returns + /// -1. \param theCircData the found referenced circle returned by this method + double circleRadius(std::shared_ptr &theCirc); private: - bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point + bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of + ///< flyout point }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp index e70c77b37..e31b4169a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintRigid.h" @@ -23,28 +24,24 @@ #include -#include #include +#include -#include #include +#include -SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() -{ -} +SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() {} -void SketchPlugin_ConstraintRigid::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintRigid::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintRigid::execute() -{ -} +void SketchPlugin_ConstraintRigid::execute() {} -AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; return SketcherPrs_Factory::rigidConstraint(this, sketch(), thePrevious); -} \ No newline at end of file +} diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.h b/src/SketchPlugin/SketchPlugin_ConstraintRigid.h index 56c835947..c6c5ba388 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintRigid_H_ @@ -27,34 +28,35 @@ /** \class SketchPlugin_ConstraintRigid * \ingroup Plugins - * \brief Feature for creation of a new constraint which defines immovable object + * \brief Feature for creation of a new constraint which defines immovable + * object * * This constraint has one attribute: - * SketchPlugin_Constraint::ENTITY_A() (any object, i.e. point, line, circle, arc) + * SketchPlugin_Constraint::ENTITY_A() (any object, i.e. point, line, circle, + * arc) */ -class SketchPlugin_ConstraintRigid : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintRigid : public SketchPlugin_ConstraintBase { +public: /// Length constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_RIGID_ID("SketchConstraintRigid"); return MY_CONSTRAINT_RIGID_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintRigid::ID(); return MY_KIND; } /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// \brief Use plugin manager for features creation diff --git a/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp b/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp index 224ac900a..ab90edbda 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintTangent.h" @@ -30,28 +31,23 @@ #include -SketchPlugin_ConstraintTangent::SketchPlugin_ConstraintTangent() -{ -} +SketchPlugin_ConstraintTangent::SketchPlugin_ConstraintTangent() {} -void SketchPlugin_ConstraintTangent::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintTangent::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintTangent::execute() -{ -} +void SketchPlugin_ConstraintTangent::execute() {} -AISObjectPtr SketchPlugin_ConstraintTangent::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintTangent::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::tangentConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::tangentConstraint(this, sketch(), thePrevious); return anAIS; } - - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintTangent.h b/src/SketchPlugin/SketchPlugin_ConstraintTangent.h index aafd49a44..e8800d7e1 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintTangent.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintTangent.h @@ -14,36 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintTangent_H_ #define SketchPlugin_ConstraintTangent_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintTangent * \ingroup Plugins - * \brief Feature for creation of a new constraint tangency between line and arc - * or between two circular arcs. The used features must have shared vertex + * \brief Feature for creation of a new constraint tangency between line and + * arc or between two circular arcs. The used features must have shared vertex * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintTangent : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintTangent : public SketchPlugin_ConstraintBase { +public: /// Equal constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_TANGENT_ID("SketchConstraintTangent"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_TANGENT_ID( + "SketchConstraintTangent"); return MY_CONSTRAINT_TANGENT_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintTangent::ID(); return MY_KIND; } @@ -51,11 +50,13 @@ class SketchPlugin_ConstraintTangent : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintTangent(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp b/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp index e921e8404..38c07af83 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ConstraintVertical.h" @@ -30,27 +31,21 @@ #include -SketchPlugin_ConstraintVertical::SketchPlugin_ConstraintVertical() -{ -} +SketchPlugin_ConstraintVertical::SketchPlugin_ConstraintVertical() {} -void SketchPlugin_ConstraintVertical::initAttributes() -{ - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); +void SketchPlugin_ConstraintVertical::initAttributes() { + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_ConstraintVertical::execute() -{ -} +void SketchPlugin_ConstraintVertical::execute() {} -AISObjectPtr SketchPlugin_ConstraintVertical::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_ConstraintVertical::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::verticalConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::verticalConstraint(this, sketch(), thePrevious); return anAIS; } - - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintVertical.h b/src/SketchPlugin/SketchPlugin_ConstraintVertical.h index 98cb6d4d7..c9ac97430 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintVertical.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintVertical.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ConstraintVertical_H_ #define SketchPlugin_ConstraintVertical_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_ConstraintVertical * \ingroup Plugins @@ -31,18 +32,16 @@ * This constraint has one attribute SketchPlugin_Constraint::ENTITY_A(), * which specifies a line to be vertical */ -class SketchPlugin_ConstraintVertical : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_ConstraintVertical : public SketchPlugin_ConstraintBase { +public: /// Vertical constraint kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_VERTICAL_ID("SketchConstraintVertical"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_VERTICAL_ID( + "SketchConstraintVertical"); return MY_CONSTRAINT_VERTICAL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_ConstraintVertical::ID(); return MY_KIND; } @@ -50,11 +49,13 @@ class SketchPlugin_ConstraintVertical : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintVertical(); diff --git a/src/SketchPlugin/SketchPlugin_CurveFitting.cpp b/src/SketchPlugin/SketchPlugin_CurveFitting.cpp index 11d9ebafe..1b44ab7d1 100644 --- a/src/SketchPlugin/SketchPlugin_CurveFitting.cpp +++ b/src/SketchPlugin/SketchPlugin_CurveFitting.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,8 +25,8 @@ #include #include #include -#include #include +#include #include #include @@ -46,60 +47,56 @@ #include -static void convertTo3D(SketchPlugin_Sketch* theSketch, - const AttributeRefAttrListPtr& theAttribute, +static void convertTo3D(SketchPlugin_Sketch *theSketch, + const AttributeRefAttrListPtr &theAttribute, bool theClosedButNotPeriodic, - std::list& thePoints); + std::list &thePoints); -static GeomEdgePtr buildInterpolationCurve(SketchPlugin_Sketch* theSketch, +static GeomEdgePtr buildInterpolationCurve(SketchPlugin_Sketch *theSketch, AttributeRefAttrListPtr thePoints, - bool thePeriodic, - bool theClosed); -static GeomEdgePtr buildApproximationCurve(SketchPlugin_Sketch* theSketch, + bool thePeriodic, bool theClosed); +static GeomEdgePtr buildApproximationCurve(SketchPlugin_Sketch *theSketch, AttributeRefAttrListPtr thePoints, double thePrecision, - bool thePeriodic, - bool theClosed); - + bool thePeriodic, bool theClosed); SketchPlugin_CurveFitting::SketchPlugin_CurveFitting() - : SketchPlugin_SketchEntity() -{ -} + : SketchPlugin_SketchEntity() {} -void SketchPlugin_CurveFitting::initDerivedClassAttributes() -{ +void SketchPlugin_CurveFitting::initDerivedClassAttributes() { data()->addAttribute(POINTS_ID(), ModelAPI_AttributeRefAttrList::typeId()); data()->addAttribute(TYPE_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(PRECISION_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PRECISION_ID()); - - data()->addAttribute(NEED_CONTROL_POLYGON_ID(), ModelAPI_AttributeBoolean::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - NEED_CONTROL_POLYGON_ID()); + PRECISION_ID()); + + data()->addAttribute(NEED_CONTROL_POLYGON_ID(), + ModelAPI_AttributeBoolean::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), NEED_CONTROL_POLYGON_ID()); data()->addAttribute(PERIODIC_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(CLOSED_ID(), ModelAPI_AttributeBoolean::typeId()); } -void SketchPlugin_CurveFitting::execute() -{ +void SketchPlugin_CurveFitting::execute() { FeaturePtr aBSpline = createBSplineFeature(); // create control polygon AttributeBooleanPtr aNeedControlPoly = boolean(NEED_CONTROL_POLYGON_ID()); - if (aNeedControlPoly && aNeedControlPoly->isInitialized() && aNeedControlPoly->value()) { + if (aNeedControlPoly && aNeedControlPoly->isInitialized() && + aNeedControlPoly->value()) { bool isPeriodic = boolean(PERIODIC_ID())->value(); std::list aControlPoles; - SketchPlugin_MacroBSpline::createControlPolygon(aBSpline, isPeriodic, aControlPoles); + SketchPlugin_MacroBSpline::createControlPolygon(aBSpline, isPeriodic, + aControlPoles); } // constraints for the selected points createConstraints(aBSpline); } -FeaturePtr SketchPlugin_CurveFitting::createBSplineFeature() -{ +FeaturePtr SketchPlugin_CurveFitting::createBSplineFeature() { // create transient curve if not created yet if (!myTransientResult) { getAISObject(AISObjectPtr()); @@ -107,41 +104,45 @@ FeaturePtr SketchPlugin_CurveFitting::createBSplineFeature() return FeaturePtr(); } - SketchPlugin_Sketch* aSketch = sketch(); + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch) return FeaturePtr(); bool isPeriodic = boolean(PERIODIC_ID())->value(); - FeaturePtr aBSplineFeature = aSketch->addFeature( - isPeriodic ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID()); + FeaturePtr aBSplineFeature = + aSketch->addFeature(isPeriodic ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID()); // Convert transient edge to B-spline curve. GeomCurvePtr aCurve = std::make_shared(myTransientResult); - std::shared_ptr aBSpline = std::make_shared(aCurve); + std::shared_ptr aBSpline = + std::make_shared(aCurve); // Fill attributes of B-spline feature: - bool aWasBlocked = aBSplineFeature->data()->blockSendAttributeUpdated(true, false); + bool aWasBlocked = + aBSplineFeature->data()->blockSendAttributeUpdated(true, false); // 1. Degree - aBSplineFeature->integer(SketchPlugin_BSplineBase::DEGREE_ID())->setValue(aBSpline->degree()); + aBSplineFeature->integer(SketchPlugin_BSplineBase::DEGREE_ID()) + ->setValue(aBSpline->degree()); // 2. Poles std::list aPoles = aBSpline->poles(); - AttributePoint2DArrayPtr aPolesAttr = std::dynamic_pointer_cast( - aBSplineFeature->attribute(SketchPlugin_BSplineBase::POLES_ID())); + AttributePoint2DArrayPtr aPolesAttr = + std::dynamic_pointer_cast( + aBSplineFeature->attribute(SketchPlugin_BSplineBase::POLES_ID())); aPolesAttr->setSize((int)aPoles.size()); int anIndex = 0; for (auto it = aPoles.begin(); it != aPoles.end(); ++it, ++anIndex) aPolesAttr->setPnt(anIndex, aSketch->to2D(*it)); // 3. Weights std::list aWeights = aBSpline->weights(); - AttributeDoubleArrayPtr aWeightsAttr = - aBSplineFeature->data()->realArray(SketchPlugin_BSplineBase::WEIGHTS_ID()); + AttributeDoubleArrayPtr aWeightsAttr = aBSplineFeature->data()->realArray( + SketchPlugin_BSplineBase::WEIGHTS_ID()); if (aWeights.empty()) { aWeightsAttr->setSize((int)aPoles.size()); for (anIndex = 0; anIndex < (int)aPoles.size(); ++anIndex) aWeightsAttr->setValue(anIndex, 1.0); - } - else { + } else { aWeightsAttr->setSize((int)aWeights.size()); anIndex = 0; for (auto it = aWeights.begin(); it != aWeights.end(); ++it, ++anIndex) @@ -156,7 +157,8 @@ FeaturePtr SketchPlugin_CurveFitting::createBSplineFeature() double aLastKnot = aKnots.back(); anIndex = 0; for (auto it = aKnots.begin(); it != aKnots.end(); ++it, ++anIndex) - aKnotsAttr->setValue(anIndex, (*it - aFirstKnot) / (aLastKnot - aFirstKnot)); + aKnotsAttr->setValue(anIndex, + (*it - aFirstKnot) / (aLastKnot - aFirstKnot)); // 5. Multiplicities std::list aMults = aBSpline->mults(); AttributeIntArrayPtr aMultsAttr = @@ -167,17 +169,19 @@ FeaturePtr SketchPlugin_CurveFitting::createBSplineFeature() aMultsAttr->setValue(anIndex, *it); if (!isPeriodic) { - AttributePoint2DPtr aStartPoint = std::dynamic_pointer_cast( - aBSplineFeature->attribute(SketchPlugin_BSpline::START_ID())); + AttributePoint2DPtr aStartPoint = + std::dynamic_pointer_cast( + aBSplineFeature->attribute(SketchPlugin_BSpline::START_ID())); aStartPoint->setValue(aPolesAttr->pnt(0)); - AttributePoint2DPtr aEndPoint = std::dynamic_pointer_cast( - aBSplineFeature->attribute(SketchPlugin_BSpline::END_ID())); + AttributePoint2DPtr aEndPoint = + std::dynamic_pointer_cast( + aBSplineFeature->attribute(SketchPlugin_BSpline::END_ID())); aEndPoint->setValue(aPolesAttr->pnt(aPolesAttr->size() - 1)); } - aBSplineFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue( - boolean(AUXILIARY_ID())->value()); + aBSplineFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->setValue(boolean(AUXILIARY_ID())->value()); aBSplineFeature->data()->blockSendAttributeUpdated(aWasBlocked); @@ -186,20 +190,22 @@ FeaturePtr SketchPlugin_CurveFitting::createBSplineFeature() return aBSplineFeature; } -void SketchPlugin_CurveFitting::createConstraints(FeaturePtr theProducedFeature) -{ +void SketchPlugin_CurveFitting::createConstraints( + FeaturePtr theProducedFeature) { if (!theProducedFeature) return; - SketchPlugin_Sketch* aSketch = sketch(); + SketchPlugin_Sketch *aSketch = sketch(); ResultPtr aResult = theProducedFeature->lastResult(); bool isPeriodic = boolean(PERIODIC_ID())->value(); bool isClosed = boolean(CLOSED_ID())->value(); bool isApproximation = string(TYPE_ID())->value() == TYPE_APPROXIMATION_ID(); AttributeRefAttrListPtr aPointsAttr = refattrlist(POINTS_ID()); - std::list > aPointsList = aPointsAttr->list(); - std::list >::iterator aLastIt = --aPointsList.end(); + std::list> aPointsList = + aPointsAttr->list(); + std::list>::iterator aLastIt = + --aPointsList.end(); for (auto it = aPointsList.begin(); it != aPointsList.end(); ++it) { AttributePtr anAttr = it->second; if (!anAttr) { @@ -212,46 +218,44 @@ void SketchPlugin_CurveFitting::createConstraints(FeaturePtr theProducedFeature) } if (!isPeriodic && it == aPointsList.begin()) { - SketchPlugin_Tools::createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidence::ID(), - anAttr, theProducedFeature->attribute(SketchPlugin_BSpline::START_ID())); + SketchPlugin_Tools::createConstraintAttrAttr( + aSketch, SketchPlugin_ConstraintCoincidence::ID(), anAttr, + theProducedFeature->attribute(SketchPlugin_BSpline::START_ID())); if (isClosed) { - // end of B-spline curve should be coincident with the first selected point - SketchPlugin_Tools::createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidence::ID(), - anAttr, theProducedFeature->attribute(SketchPlugin_BSpline::END_ID())); + // end of B-spline curve should be coincident with the first selected + // point + SketchPlugin_Tools::createConstraintAttrAttr( + aSketch, SketchPlugin_ConstraintCoincidence::ID(), anAttr, + theProducedFeature->attribute(SketchPlugin_BSpline::END_ID())); } - } - else if (!isPeriodic && !isClosed && it == aLastIt) { - SketchPlugin_Tools::createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidence::ID(), - anAttr, theProducedFeature->attribute(SketchPlugin_BSpline::END_ID())); - } - else if (!isApproximation) { - SketchPlugin_Tools::createConstraintAttrObject(aSketch, - SketchPlugin_ConstraintCoincidence::ID(), - anAttr, aResult); + } else if (!isPeriodic && !isClosed && it == aLastIt) { + SketchPlugin_Tools::createConstraintAttrAttr( + aSketch, SketchPlugin_ConstraintCoincidence::ID(), anAttr, + theProducedFeature->attribute(SketchPlugin_BSpline::END_ID())); + } else if (!isApproximation) { + SketchPlugin_Tools::createConstraintAttrObject( + aSketch, SketchPlugin_ConstraintCoincidence::ID(), anAttr, aResult); } } } -bool SketchPlugin_CurveFitting::customAction(const std::string& theActionId) -{ +bool SketchPlugin_CurveFitting::customAction(const std::string &theActionId) { bool isOk = true; if (theActionId == REORDER_POINTS_ACTION_ID()) { reorderPoints(); } else { - static const std::string MESSAGE("Error: Feature \"%1\" does not support action \"%2\"."); + static const std::string MESSAGE( + "Error: Feature \"%1\" does not support action \"%2\"."); Events_InfoMessage("SketchPlugin_CurveFitting", MESSAGE) - .arg(getKind()).arg(theActionId).send(); + .arg(getKind()) + .arg(theActionId) + .send(); isOk = false; } return isOk; } - -void SketchPlugin_CurveFitting::reorderPoints() -{ +void SketchPlugin_CurveFitting::reorderPoints() { AttributeRefAttrListPtr aPointsAttr = refattrlist(POINTS_ID()); bool isPeriodic = boolean(PERIODIC_ID())->value(); bool isClosed = boolean(CLOSED_ID())->value(); @@ -260,12 +264,15 @@ void SketchPlugin_CurveFitting::reorderPoints() convertTo3D(sketch(), aPointsAttr, !isPeriodic && isClosed, aCoordinates); // to keep mapping between points and attributes - std::map > aMap; - std::list > aPointsList = aPointsAttr->list(); + std::map> aMap; + std::list> aPointsList = + aPointsAttr->list(); std::list::iterator aCoordIt = aCoordinates.begin(); - std::list >::iterator anAttrIt = aPointsList.begin(); - for (; aCoordIt != aCoordinates.end() && anAttrIt != aPointsList.end(); ++aCoordIt, ++anAttrIt) + std::list>::iterator anAttrIt = + aPointsList.begin(); + for (; aCoordIt != aCoordinates.end() && anAttrIt != aPointsList.end(); + ++aCoordIt, ++anAttrIt) aMap[*aCoordIt] = *anAttrIt; // reorder points @@ -274,8 +281,9 @@ void SketchPlugin_CurveFitting::reorderPoints() // re-compose the attribute bool aWasBlocked = data()->blockSendAttributeUpdated(true); aPointsAttr->clear(); - for (aCoordIt = aCoordinates.begin(); aCoordIt != aCoordinates.end(); ++aCoordIt) { - const std::pair& aValue = aMap.at(*aCoordIt); + for (aCoordIt = aCoordinates.begin(); aCoordIt != aCoordinates.end(); + ++aCoordIt) { + const std::pair &aValue = aMap.at(*aCoordIt); if (aValue.second) aPointsAttr->append(aValue.second); else @@ -284,25 +292,20 @@ void SketchPlugin_CurveFitting::reorderPoints() data()->blockSendAttributeUpdated(aWasBlocked); } -AISObjectPtr SketchPlugin_CurveFitting::getAISObject(AISObjectPtr thePrevious) -{ - SketchPlugin_Sketch* aSketch = sketch(); +AISObjectPtr SketchPlugin_CurveFitting::getAISObject(AISObjectPtr thePrevious) { + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch) return AISObjectPtr(); std::string aType = string(TYPE_ID())->value(); if (aType == TYPE_INTERPOLATION_ID()) { - myTransientResult = buildInterpolationCurve(aSketch, - refattrlist(POINTS_ID()), - boolean(PERIODIC_ID())->value(), - boolean(CLOSED_ID())->value()); - } - else if (aType == TYPE_APPROXIMATION_ID()) { - myTransientResult = buildApproximationCurve(aSketch, - refattrlist(POINTS_ID()), - real(PRECISION_ID())->value(), - boolean(PERIODIC_ID())->value(), - boolean(CLOSED_ID())->value()); + myTransientResult = buildInterpolationCurve( + aSketch, refattrlist(POINTS_ID()), boolean(PERIODIC_ID())->value(), + boolean(CLOSED_ID())->value()); + } else if (aType == TYPE_APPROXIMATION_ID()) { + myTransientResult = buildApproximationCurve( + aSketch, refattrlist(POINTS_ID()), real(PRECISION_ID())->value(), + boolean(PERIODIC_ID())->value(), boolean(CLOSED_ID())->value()); } if (!myTransientResult) return AISObjectPtr(); @@ -313,20 +316,21 @@ AISObjectPtr SketchPlugin_CurveFitting::getAISObject(AISObjectPtr thePrevious) anAIS->createShape(myTransientResult); // Modify attributes - SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, + boolean(AUXILIARY_ID())->value()); return anAIS; } +// =============================== Auxiliary functions +// ==================================== -// =============================== Auxiliary functions ==================================== - -void convertTo3D(SketchPlugin_Sketch* theSketch, - const AttributeRefAttrListPtr& theAttribute, +void convertTo3D(SketchPlugin_Sketch *theSketch, + const AttributeRefAttrListPtr &theAttribute, bool theClosedButNotPeriodic, - std::list& thePoints) -{ - std::list > aPointsList = theAttribute->list(); + std::list &thePoints) { + std::list> aPointsList = + theAttribute->list(); for (auto it = aPointsList.begin(); it != aPointsList.end(); ++it) { AttributePtr anAttr = it->second; if (!anAttr) { @@ -340,7 +344,8 @@ void convertTo3D(SketchPlugin_Sketch* theSketch, } } - AttributePoint2DPtr aPoint = std::dynamic_pointer_cast(anAttr); + AttributePoint2DPtr aPoint = + std::dynamic_pointer_cast(anAttr); if (aPoint) { GeomPointPtr aPnt3D = theSketch->to3D(aPoint->x(), aPoint->y()); thePoints.push_back(aPnt3D); @@ -352,11 +357,9 @@ void convertTo3D(SketchPlugin_Sketch* theSketch, thePoints.push_back(thePoints.front()); // close the curve } -GeomEdgePtr buildInterpolationCurve(SketchPlugin_Sketch* theSketch, +GeomEdgePtr buildInterpolationCurve(SketchPlugin_Sketch *theSketch, AttributeRefAttrListPtr thePoints, - bool thePeriodic, - bool theClosed) -{ + bool thePeriodic, bool theClosed) { std::list aCoordinates; convertTo3D(theSketch, thePoints, !thePeriodic && theClosed, aCoordinates); @@ -364,23 +367,22 @@ GeomEdgePtr buildInterpolationCurve(SketchPlugin_Sketch* theSketch, if (aCoordinates.size() > 1) { static const bool isReorder = false; static GeomDirPtr aStartEndDir; - aResult = GeomAlgoAPI_CurveBuilder::edge(aCoordinates, thePeriodic, - isReorder, aStartEndDir, aStartEndDir); + aResult = GeomAlgoAPI_CurveBuilder::edge( + aCoordinates, thePeriodic, isReorder, aStartEndDir, aStartEndDir); } return aResult; } -GeomEdgePtr buildApproximationCurve(SketchPlugin_Sketch* theSketch, +GeomEdgePtr buildApproximationCurve(SketchPlugin_Sketch *theSketch, AttributeRefAttrListPtr thePoints, - double thePrecision, - bool thePeriodic, - bool theClosed) -{ + double thePrecision, bool thePeriodic, + bool theClosed) { std::list aCoordinates; convertTo3D(theSketch, thePoints, !thePeriodic && theClosed, aCoordinates); GeomEdgePtr aResult; if (aCoordinates.size() > 1) - aResult = GeomAlgoAPI_CurveBuilder::approximate(aCoordinates, thePeriodic, thePrecision); + aResult = GeomAlgoAPI_CurveBuilder::approximate(aCoordinates, thePeriodic, + thePrecision); return aResult; } diff --git a/src/SketchPlugin/SketchPlugin_CurveFitting.h b/src/SketchPlugin/SketchPlugin_CurveFitting.h index ac88a4522..057a2f106 100644 --- a/src/SketchPlugin/SketchPlugin_CurveFitting.h +++ b/src/SketchPlugin/SketchPlugin_CurveFitting.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_CurveFitting_H_ @@ -33,82 +34,70 @@ class GeomAPI_Edge; * as an interpolation or an approximation of a list of points. */ class SketchPlugin_CurveFitting : public SketchPlugin_SketchEntity, - public GeomAPI_IPresentable -{ + public GeomAPI_IPresentable { public: /// Interpolation macro feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchCurveFitting"); return ID; } /// list of selected points - inline static const std::string& POINTS_ID() - { + inline static const std::string &POINTS_ID() { static const std::string ID("points"); return ID; } /// attribute for the periodic flag - inline static const std::string& PERIODIC_ID() - { + inline static const std::string &PERIODIC_ID() { static const std::string ID("periodic"); return ID; } /// attribute for the closed flag - inline static const std::string& CLOSED_ID() - { + inline static const std::string &CLOSED_ID() { static const std::string ID("closed"); return ID; } /// attribute for the flag of creation a control polygon - inline static const std::string& NEED_CONTROL_POLYGON_ID() - { + inline static const std::string &NEED_CONTROL_POLYGON_ID() { static const std::string ID("need_control_poly"); return ID; } /// attribute for the type of the operation - inline static const std::string& TYPE_ID() - { + inline static const std::string &TYPE_ID() { static const std::string ID("type"); return ID; } /// value for the type of operation - inline static const std::string& TYPE_INTERPOLATION_ID() - { + inline static const std::string &TYPE_INTERPOLATION_ID() { static const std::string ID("interpolation_type"); return ID; } /// value for the type of operation - inline static const std::string& TYPE_APPROXIMATION_ID() - { + inline static const std::string &TYPE_APPROXIMATION_ID() { static const std::string ID("approximation_type"); return ID; } /// attribute for the precision of the approximation - inline static const std::string& PRECISION_ID() - { + inline static const std::string &PRECISION_ID() { static const std::string ID("precision"); return ID; } /// attribute for the closed flag - inline static const std::string& REORDER_POINTS_ACTION_ID() - { + inline static const std::string &REORDER_POINTS_ACTION_ID() { static const std::string ID("reorder_points"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_CurveFitting::ID(); return MY_KIND; } @@ -121,14 +110,14 @@ public: /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}; + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; /// Performs some functionality by action id. /// \param[in] theAttributeId action key id. /// \return false in case if action not performed. - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId); + SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); /// Use plugin manager for features creation SketchPlugin_CurveFitting(); @@ -141,7 +130,8 @@ private: /// \brief Create a feature, which passes through the selected points FeaturePtr createBSplineFeature(); - /// \brief Create coincidence constraints between selected points and the produced curve. + /// \brief Create coincidence constraints between selected points and the + /// produced curve. void createConstraints(FeaturePtr theProducedFeature); /// \brief Reorder point to compose the polyline of the minimal length diff --git a/src/SketchPlugin/SketchPlugin_Ellipse.cpp b/src/SketchPlugin/SketchPlugin_Ellipse.cpp index 0834a13aa..221c6607c 100644 --- a/src/SketchPlugin/SketchPlugin_Ellipse.cpp +++ b/src/SketchPlugin/SketchPlugin_Ellipse.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -38,14 +39,9 @@ static const double tolerance = 1e-7; +SketchPlugin_Ellipse::SketchPlugin_Ellipse() : SketchPlugin_SketchEntity() {} -SketchPlugin_Ellipse::SketchPlugin_Ellipse() -: SketchPlugin_SketchEntity() -{ -} - -void SketchPlugin_Ellipse::initDerivedClassAttributes() -{ +void SketchPlugin_Ellipse::initDerivedClassAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(FIRST_FOCUS_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(SECOND_FOCUS_ID(), GeomDataAPI_Point2D::typeId()); @@ -56,21 +52,27 @@ void SketchPlugin_Ellipse::initDerivedClassAttributes() data()->addAttribute(MAJOR_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(MINOR_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SECOND_FOCUS_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_START_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_END_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MINOR_AXIS_START_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MINOR_AXIS_END_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_RADIUS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SECOND_FOCUS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_AXIS_START_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_AXIS_END_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MINOR_AXIS_START_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MINOR_AXIS_END_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_RADIUS_ID()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); } -void SketchPlugin_Ellipse::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { +void SketchPlugin_Ellipse::execute() { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return; } @@ -85,10 +87,11 @@ bool SketchPlugin_Ellipse::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_Ellipse::attributeChanged(const std::string& theID) { +void SketchPlugin_Ellipse::attributeChanged(const std::string &theID) { // the second condition for unability to move external segments anywhere if (theID == EXTERNAL_ID() || isFixed()) { - std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); + std::shared_ptr aSelection = + data()->selection(EXTERNAL_ID())->value(); if (!aSelection) { // empty shape in selection shows that the shape is equal to context ResultPtr anExtRes = selection(EXTERNAL_ID())->context(); @@ -97,15 +100,17 @@ void SketchPlugin_Ellipse::attributeChanged(const std::string& theID) { } // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { - std::shared_ptr anEdge( new GeomAPI_Edge(aSelection)); + std::shared_ptr anEdge(new GeomAPI_Edge(aSelection)); std::shared_ptr anEllipse = anEdge->ellipse(); std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(attribute(CENTER_ID())); + std::dynamic_pointer_cast( + attribute(CENTER_ID())); aCenterAttr->setValue(sketch()->to2D(anEllipse->center())); std::shared_ptr aFocusAttr = - std::dynamic_pointer_cast(attribute(FIRST_FOCUS_ID())); + std::dynamic_pointer_cast( + attribute(FIRST_FOCUS_ID())); aFocusAttr->setValue(sketch()->to2D(anEllipse->firstFocus())); real(MAJOR_RADIUS_ID())->setValue(anEllipse->majorRadius()); @@ -114,17 +119,17 @@ void SketchPlugin_Ellipse::attributeChanged(const std::string& theID) { } } -bool SketchPlugin_Ellipse::fillCharacteristicPoints() -{ +bool SketchPlugin_Ellipse::fillCharacteristicPoints() { std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); std::shared_ptr aFocusAttr = - std::dynamic_pointer_cast(data()->attribute(FIRST_FOCUS_ID())); + std::dynamic_pointer_cast( + data()->attribute(FIRST_FOCUS_ID())); AttributeDoublePtr aMinorRadiusAttr = real(MINOR_RADIUS_ID()); - if (!aCenterAttr->isInitialized() || - !aFocusAttr->isInitialized() || + if (!aCenterAttr->isInitialized() || !aFocusAttr->isInitialized() || !aMinorRadiusAttr->isInitialized()) { return false; } @@ -138,25 +143,30 @@ bool SketchPlugin_Ellipse::fillCharacteristicPoints() GeomPnt2dPtr aCenter2d = aCenterAttr->pnt(); GeomPnt2dPtr aFocus2d = aFocusAttr->pnt(); GeomDir2dPtr aMajorDir2d(new GeomAPI_Dir2d(aFocus2d->x() - aCenter2d->x(), - aFocus2d->y() - aCenter2d->y())); - GeomDir2dPtr aMinorDir2d(new GeomAPI_Dir2d(-aMajorDir2d->y(), aMajorDir2d->x())); + aFocus2d->y() - aCenter2d->y())); + GeomDir2dPtr aMinorDir2d( + new GeomAPI_Dir2d(-aMajorDir2d->y(), aMajorDir2d->x())); AttributeDoublePtr aMajorRadiusAttr = real(MAJOR_RADIUS_ID()); double aFocalDist = aCenter2d->distance(aFocus2d); - double aMajorRadius = sqrt(aFocalDist * aFocalDist + aMinorRadius * aMinorRadius); + double aMajorRadius = + sqrt(aFocalDist * aFocalDist + aMinorRadius * aMinorRadius); if (!aMajorRadiusAttr->isInitialized() || fabs(aMajorRadiusAttr->value() - aMajorRadius) > tolerance) aMajorRadiusAttr->setValue(aMajorRadius); std::dynamic_pointer_cast(attribute(SECOND_FOCUS_ID())) - ->setValue(2.0 * aCenter2d->x() - aFocus2d->x(), 2.0 * aCenter2d->y() - aFocus2d->y()); - std::dynamic_pointer_cast(attribute(MAJOR_AXIS_START_ID())) + ->setValue(2.0 * aCenter2d->x() - aFocus2d->x(), + 2.0 * aCenter2d->y() - aFocus2d->y()); + std::dynamic_pointer_cast( + attribute(MAJOR_AXIS_START_ID())) ->setValue(aCenter2d->x() - aMajorDir2d->x() * aMajorRadius, aCenter2d->y() - aMajorDir2d->y() * aMajorRadius); std::dynamic_pointer_cast(attribute(MAJOR_AXIS_END_ID())) ->setValue(aCenter2d->x() + aMajorDir2d->x() * aMajorRadius, aCenter2d->y() + aMajorDir2d->y() * aMajorRadius); - std::dynamic_pointer_cast(attribute(MINOR_AXIS_START_ID())) + std::dynamic_pointer_cast( + attribute(MINOR_AXIS_START_ID())) ->setValue(aCenter2d->x() - aMinorDir2d->x() * aMinorRadius, aCenter2d->y() - aMinorDir2d->y() * aMinorRadius); std::dynamic_pointer_cast(attribute(MINOR_AXIS_END_ID())) @@ -167,19 +177,22 @@ bool SketchPlugin_Ellipse::fillCharacteristicPoints() return true; } -void SketchPlugin_Ellipse::createEllipse(SketchPlugin_Sketch* theSketch, const int theResultIndex) -{ +void SketchPlugin_Ellipse::createEllipse(SketchPlugin_Sketch *theSketch, + const int theResultIndex) { // Compute a ellipse in 3D view. std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); std::shared_ptr aFocusAttr = - std::dynamic_pointer_cast(data()->attribute(FIRST_FOCUS_ID())); + std::dynamic_pointer_cast( + data()->attribute(FIRST_FOCUS_ID())); double aMajorRadius = real(MAJOR_RADIUS_ID())->value(); double aMinorRadius = real(MINOR_RADIUS_ID())->value(); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - theSketch->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + theSketch->attribute(SketchPlugin_Sketch::NORM_ID())); GeomPointPtr aCenter(theSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); GeomPointPtr aFocus(theSketch->to3D(aFocusAttr->x(), aFocusAttr->y())); @@ -187,17 +200,19 @@ void SketchPlugin_Ellipse::createEllipse(SketchPlugin_Sketch* theSketch, const i std::shared_ptr anEllipseShape; if (aFocus->distance(aCenter) > tolerance) { GeomDirPtr aMajorAxis(new GeomAPI_Dir(aFocus->x() - aCenter->x(), - aFocus->y() - aCenter->y(), aFocus->z() - aCenter->z())); + aFocus->y() - aCenter->y(), + aFocus->z() - aCenter->z())); - anEllipseShape = - GeomAlgoAPI_EdgeBuilder::ellipse(aCenter, aNormal, aMajorAxis, aMajorRadius, aMinorRadius); - } - else { + anEllipseShape = GeomAlgoAPI_EdgeBuilder::ellipse( + aCenter, aNormal, aMajorAxis, aMajorRadius, aMinorRadius); + } else { // build circle instead of ellipse - anEllipseShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aMajorRadius); + anEllipseShape = + GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aMajorRadius); } - ResultConstructionPtr aResult = document()->createConstruction(data(), theResultIndex); + ResultConstructionPtr aResult = + document()->createConstruction(data(), theResultIndex); aResult->setShape(anEllipseShape); aResult->setIsInHistory(false); setResult(aResult, theResultIndex); diff --git a/src/SketchPlugin/SketchPlugin_Ellipse.h b/src/SketchPlugin/SketchPlugin_Ellipse.h index 309ebe60b..d30f510cc 100644 --- a/src/SketchPlugin/SketchPlugin_Ellipse.h +++ b/src/SketchPlugin/SketchPlugin_Ellipse.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Ellipse_H_ @@ -27,79 +28,67 @@ * \ingroup Plugins * \brief Feature for creation of the new ellipse in Sketch. */ -class SketchPlugin_Ellipse: public SketchPlugin_SketchEntity -{ - public: +class SketchPlugin_Ellipse : public SketchPlugin_SketchEntity { +public: /// Ellipse feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchEllipse"); return ID; } /// 2D point - center of the ellipse - inline static const std::string& CENTER_ID() - { + inline static const std::string &CENTER_ID() { static const std::string ID("ellipse_center"); return ID; } /// 2D point - focus of the ellipse - inline static const std::string& FIRST_FOCUS_ID() - { + inline static const std::string &FIRST_FOCUS_ID() { static const std::string ID("ellipse_first_focus"); return ID; } /// 2D point - second focus of the ellipse - inline static const std::string& SECOND_FOCUS_ID() - { + inline static const std::string &SECOND_FOCUS_ID() { static const std::string ID("ellipse_second_focus"); return ID; } /// 2D point - start point of major axis - inline static const std::string& MAJOR_AXIS_START_ID() - { + inline static const std::string &MAJOR_AXIS_START_ID() { static const std::string ID("ellipse_major_axis_start_point"); return ID; } /// 2D point - end point of major axis - inline static const std::string& MAJOR_AXIS_END_ID() - { + inline static const std::string &MAJOR_AXIS_END_ID() { static const std::string ID("ellipse_major_axis_end_point"); return ID; } /// 2D point - start point of minor axis - inline static const std::string& MINOR_AXIS_START_ID() - { + inline static const std::string &MINOR_AXIS_START_ID() { static const std::string ID("ellipse_minor_axis_start_point"); return ID; } /// 2D point - end point of minor axis - inline static const std::string& MINOR_AXIS_END_ID() - { + inline static const std::string &MINOR_AXIS_END_ID() { static const std::string ID("ellipse_minor_axis_end_point"); return ID; } /// Major radius of the ellipse - inline static const std::string& MAJOR_RADIUS_ID() - { + inline static const std::string &MAJOR_RADIUS_ID() { static const std::string ID("ellipse_major_radius"); return ID; } /// Minor radius of the ellipse - inline static const std::string& MINOR_RADIUS_ID() - { + inline static const std::string &MINOR_RADIUS_ID() { static const std::string ID("ellipse_minor_radius"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Ellipse::ID(); return MY_KIND; } @@ -108,7 +97,7 @@ class SketchPlugin_Ellipse: public SketchPlugin_SketchEntity SKETCHPLUGIN_EXPORT virtual bool isFixed(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); @@ -123,7 +112,7 @@ protected: private: bool fillCharacteristicPoints(); - void createEllipse(SketchPlugin_Sketch* theSketch, const int theResultIndex); + void createEllipse(SketchPlugin_Sketch *theSketch, const int theResultIndex); }; #endif diff --git a/src/SketchPlugin/SketchPlugin_EllipticArc.cpp b/src/SketchPlugin/SketchPlugin_EllipticArc.cpp index de2db6c72..b77a83679 100644 --- a/src/SketchPlugin/SketchPlugin_EllipticArc.cpp +++ b/src/SketchPlugin/SketchPlugin_EllipticArc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -42,15 +43,10 @@ static const double tolerance = 1e-7; static const double paramTolerance = 1.e-4; static const double PI = 3.141592653589793238463; - SketchPlugin_EllipticArc::SketchPlugin_EllipticArc() - : SketchPlugin_SketchEntity(), - myParamDelta(0.0) -{ -} + : SketchPlugin_SketchEntity(), myParamDelta(0.0) {} -void SketchPlugin_EllipticArc::initDerivedClassAttributes() -{ +void SketchPlugin_EllipticArc::initDerivedClassAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(FIRST_FOCUS_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(SECOND_FOCUS_ID(), GeomDataAPI_Point2D::typeId()); @@ -65,22 +61,29 @@ void SketchPlugin_EllipticArc::initDerivedClassAttributes() data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SECOND_FOCUS_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_START_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_END_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MINOR_AXIS_START_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MINOR_AXIS_END_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_RADIUS_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MINOR_RADIUS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SECOND_FOCUS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_AXIS_START_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_AXIS_END_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MINOR_AXIS_START_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MINOR_AXIS_END_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_RADIUS_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MINOR_RADIUS_ID()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); } -void SketchPlugin_EllipticArc::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { +void SketchPlugin_EllipticArc::execute() { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return; } @@ -95,10 +98,11 @@ bool SketchPlugin_EllipticArc::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_EllipticArc::attributeChanged(const std::string& theID) { +void SketchPlugin_EllipticArc::attributeChanged(const std::string &theID) { // the second condition for unability to move external segments anywhere if (theID == EXTERNAL_ID() || isFixed()) { - std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); + std::shared_ptr aSelection = + data()->selection(EXTERNAL_ID())->value(); if (!aSelection) { // empty shape in selection shows that the shape is equal to context ResultPtr anExtRes = selection(EXTERNAL_ID())->context(); @@ -112,19 +116,23 @@ void SketchPlugin_EllipticArc::attributeChanged(const std::string& theID) { bool aWasBlocked = data()->blockSendAttributeUpdated(true); std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(attribute(CENTER_ID())); + std::dynamic_pointer_cast( + attribute(CENTER_ID())); aCenterAttr->setValue(sketch()->to2D(anEllipse->center())); std::shared_ptr aFocusAttr = - std::dynamic_pointer_cast(attribute(FIRST_FOCUS_ID())); + std::dynamic_pointer_cast( + attribute(FIRST_FOCUS_ID())); aFocusAttr->setValue(sketch()->to2D(anEllipse->firstFocus())); std::shared_ptr aStartAttr = - std::dynamic_pointer_cast(attribute(START_POINT_ID())); + std::dynamic_pointer_cast( + attribute(START_POINT_ID())); aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint())); std::shared_ptr aEndAttr = - std::dynamic_pointer_cast(attribute(END_POINT_ID())); + std::dynamic_pointer_cast( + attribute(END_POINT_ID())); aEndAttr->setValue(sketch()->to2D(anEdge->lastPoint())); real(MAJOR_RADIUS_ID())->setValue(anEllipse->majorRadius()); @@ -144,41 +152,42 @@ void SketchPlugin_EllipticArc::attributeChanged(const std::string& theID) { fillCharacteristicPoints(); } - } - else if (theID == CENTER_ID() || theID == FIRST_FOCUS_ID() || - theID == START_POINT_ID() || theID == END_POINT_ID()) + } else if (theID == CENTER_ID() || theID == FIRST_FOCUS_ID() || + theID == START_POINT_ID() || theID == END_POINT_ID()) fillCharacteristicPoints(); else if (theID == REVERSED_ID() && myParamDelta == 0.0) myParamDelta = 2.0 * PI; } -static void calculateRadii(const GeomPnt2dPtr& theCenter, - const GeomPnt2dPtr& theFocus, - const GeomPnt2dPtr& thePassed, - double& theMajorRadius, - double& theMinorRadius) -{ +static void calculateRadii(const GeomPnt2dPtr &theCenter, + const GeomPnt2dPtr &theFocus, + const GeomPnt2dPtr &thePassed, + double &theMajorRadius, double &theMinorRadius) { GeomPnt2dPtr aSecondFocus(new GeomAPI_Pnt2d( theCenter->xy()->multiplied(2.0)->decreased(theFocus->xy()))); - theMajorRadius = 0.5 * (thePassed->distance(theFocus) + thePassed->distance(aSecondFocus)); + theMajorRadius = + 0.5 * (thePassed->distance(theFocus) + thePassed->distance(aSecondFocus)); double aFocalDist = theCenter->distance(theFocus); - theMinorRadius = sqrt(theMajorRadius * theMajorRadius - aFocalDist * aFocalDist); + theMinorRadius = + sqrt(theMajorRadius * theMajorRadius - aFocalDist * aFocalDist); } -bool SketchPlugin_EllipticArc::fillCharacteristicPoints() -{ +bool SketchPlugin_EllipticArc::fillCharacteristicPoints() { std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); std::shared_ptr aFocusAttr = - std::dynamic_pointer_cast(data()->attribute(FIRST_FOCUS_ID())); + std::dynamic_pointer_cast( + data()->attribute(FIRST_FOCUS_ID())); std::shared_ptr aStartPointAttr = - std::dynamic_pointer_cast(data()->attribute(START_POINT_ID())); + std::dynamic_pointer_cast( + data()->attribute(START_POINT_ID())); std::shared_ptr aEndPointAttr = - std::dynamic_pointer_cast(data()->attribute(END_POINT_ID())); + std::dynamic_pointer_cast( + data()->attribute(END_POINT_ID())); - if (!aCenterAttr->isInitialized() || - !aFocusAttr->isInitialized() || + if (!aCenterAttr->isInitialized() || !aFocusAttr->isInitialized() || !aStartPointAttr->isInitialized()) { return false; } @@ -197,30 +206,35 @@ bool SketchPlugin_EllipticArc::fillCharacteristicPoints() real(MINOR_RADIUS_ID())->setValue(aMinorRadius); GeomDir2dPtr aMajorDir2d(new GeomAPI_Dir2d(aFocus2d->x() - aCenter2d->x(), - aFocus2d->y() - aCenter2d->y())); - GeomDir2dPtr aMinorDir2d(new GeomAPI_Dir2d(-aMajorDir2d->y(), aMajorDir2d->x())); + aFocus2d->y() - aCenter2d->y())); + GeomDir2dPtr aMinorDir2d( + new GeomAPI_Dir2d(-aMajorDir2d->y(), aMajorDir2d->x())); std::dynamic_pointer_cast(attribute(SECOND_FOCUS_ID())) - ->setValue(2.0 * aCenter2d->x() - aFocus2d->x(), 2.0 * aCenter2d->y() - aFocus2d->y()); - std::dynamic_pointer_cast(attribute(MAJOR_AXIS_START_ID())) - ->setValue(aCenter2d->x() - aMajorDir2d->x() * aMajorRadius, - aCenter2d->y() - aMajorDir2d->y() * aMajorRadius); + ->setValue(2.0 * aCenter2d->x() - aFocus2d->x(), + 2.0 * aCenter2d->y() - aFocus2d->y()); + std::dynamic_pointer_cast( + attribute(MAJOR_AXIS_START_ID())) + ->setValue(aCenter2d->x() - aMajorDir2d->x() * aMajorRadius, + aCenter2d->y() - aMajorDir2d->y() * aMajorRadius); std::dynamic_pointer_cast(attribute(MAJOR_AXIS_END_ID())) - ->setValue(aCenter2d->x() + aMajorDir2d->x() * aMajorRadius, - aCenter2d->y() + aMajorDir2d->y() * aMajorRadius); - std::dynamic_pointer_cast(attribute(MINOR_AXIS_START_ID())) - ->setValue(aCenter2d->x() - aMinorDir2d->x() * aMinorRadius, - aCenter2d->y() - aMinorDir2d->y() * aMinorRadius); + ->setValue(aCenter2d->x() + aMajorDir2d->x() * aMajorRadius, + aCenter2d->y() + aMajorDir2d->y() * aMajorRadius); + std::dynamic_pointer_cast( + attribute(MINOR_AXIS_START_ID())) + ->setValue(aCenter2d->x() - aMinorDir2d->x() * aMinorRadius, + aCenter2d->y() - aMinorDir2d->y() * aMinorRadius); std::dynamic_pointer_cast(attribute(MINOR_AXIS_END_ID())) - ->setValue(aCenter2d->x() + aMinorDir2d->x() * aMinorRadius, - aCenter2d->y() + aMinorDir2d->y() * aMinorRadius); + ->setValue(aCenter2d->x() + aMinorDir2d->x() * aMinorRadius, + aCenter2d->y() + aMinorDir2d->y() * aMinorRadius); if (aEndPointAttr->isInitialized()) { // recalculate REVERSED flag - std::shared_ptr anEllipseForArc( - new GeomAPI_Ellipse2d(aCenter2d, aMajorDir2d, aMajorRadius, aMinorRadius)); + std::shared_ptr anEllipseForArc(new GeomAPI_Ellipse2d( + aCenter2d, aMajorDir2d, aMajorRadius, aMinorRadius)); GeomPnt2dPtr anEnd = aEndPointAttr->pnt(); - std::shared_ptr aProjection = anEllipseForArc->project(anEnd); + std::shared_ptr aProjection = + anEllipseForArc->project(anEnd); double aParamStart = 0.0, aParamEnd = 0.0; if (aProjection && anEnd->distance(aProjection) <= tolerance && anEllipseForArc->parameter(anEnd, paramTolerance, aParamEnd)) { @@ -228,12 +242,11 @@ bool SketchPlugin_EllipticArc::fillCharacteristicPoints() anEllipseForArc->parameter(aStart2d, paramTolerance, aParamStart); aParamEnd -= aParamStart; - if (myParamDelta >= 0.0 && myParamDelta <= PI * 0.5 && - aParamEnd < 0.0 && aParamEnd >= -PI * 0.5) { + if (myParamDelta >= 0.0 && myParamDelta <= PI * 0.5 && aParamEnd < 0.0 && + aParamEnd >= -PI * 0.5) { boolean(REVERSED_ID())->setValue(true); - } - else if (myParamDelta <= 0.0 && myParamDelta >= -PI * 0.5 && - aParamEnd > 0.0 && aParamEnd <= PI * 0.5) { + } else if (myParamDelta <= 0.0 && myParamDelta >= -PI * 0.5 && + aParamEnd > 0.0 && aParamEnd <= PI * 0.5) { boolean(REVERSED_ID())->setValue(false); } myParamDelta = aParamEnd; @@ -244,19 +257,22 @@ bool SketchPlugin_EllipticArc::fillCharacteristicPoints() return true; } -void SketchPlugin_EllipticArc::createEllipticArc(SketchPlugin_Sketch* theSketch) -{ +void SketchPlugin_EllipticArc::createEllipticArc( + SketchPlugin_Sketch *theSketch) { // Compute a ellipse in 3D view. std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + std::dynamic_pointer_cast( + data()->attribute(CENTER_ID())); std::shared_ptr aFocusAttr = - std::dynamic_pointer_cast(data()->attribute(FIRST_FOCUS_ID())); + std::dynamic_pointer_cast( + data()->attribute(FIRST_FOCUS_ID())); double aMajorRadius = real(MAJOR_RADIUS_ID())->value(); double aMinorRadius = real(MINOR_RADIUS_ID())->value(); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - theSketch->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + theSketch->attribute(SketchPlugin_Sketch::NORM_ID())); GeomPointPtr aCenter(theSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); GeomPointPtr aFocus(theSketch->to3D(aFocusAttr->x(), aFocusAttr->y())); @@ -264,24 +280,28 @@ void SketchPlugin_EllipticArc::createEllipticArc(SketchPlugin_Sketch* theSketch) std::shared_ptr anEllipseShape; if (aFocus->distance(aCenter) > tolerance) { GeomDirPtr aMajorAxis(new GeomAPI_Dir(aFocus->x() - aCenter->x(), - aFocus->y() - aCenter->y(), aFocus->z() - aCenter->z())); + aFocus->y() - aCenter->y(), + aFocus->z() - aCenter->z())); std::shared_ptr aStartAttr = - std::dynamic_pointer_cast(data()->attribute(START_POINT_ID())); + std::dynamic_pointer_cast( + data()->attribute(START_POINT_ID())); std::shared_ptr aEndAttr = - std::dynamic_pointer_cast(data()->attribute(END_POINT_ID())); + std::dynamic_pointer_cast( + data()->attribute(END_POINT_ID())); GeomPointPtr aStartPnt(theSketch->to3D(aStartAttr->x(), aStartAttr->y())); GeomPointPtr aEndPnt(theSketch->to3D(aEndAttr->x(), aEndAttr->y())); if (boolean(REVERSED_ID())->value()) std::swap(aStartPnt, aEndPnt); - anEllipseShape = GeomAlgoAPI_EdgeBuilder::ellipticArc(aCenter, aNormal, aMajorAxis, - aMajorRadius, aMinorRadius, aStartPnt, aEndPnt); - } - else { + anEllipseShape = GeomAlgoAPI_EdgeBuilder::ellipticArc( + aCenter, aNormal, aMajorAxis, aMajorRadius, aMinorRadius, aStartPnt, + aEndPnt); + } else { // build circle instead of ellipse - anEllipseShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aMajorRadius); + anEllipseShape = + GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aMajorRadius); } ResultConstructionPtr aResult = document()->createConstruction(data()); diff --git a/src/SketchPlugin/SketchPlugin_EllipticArc.h b/src/SketchPlugin/SketchPlugin_EllipticArc.h index a7e8b3632..284afc032 100644 --- a/src/SketchPlugin/SketchPlugin_EllipticArc.h +++ b/src/SketchPlugin/SketchPlugin_EllipticArc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_EllipticArc_H_ @@ -27,99 +28,84 @@ * \ingroup Plugins * \brief Feature for creation of the new elliptic arc in Sketch. */ -class SketchPlugin_EllipticArc: public SketchPlugin_SketchEntity -{ - public: +class SketchPlugin_EllipticArc : public SketchPlugin_SketchEntity { +public: /// Ellipse feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchEllipticArc"); return ID; } /// 2D point - center of the ellipse - inline static const std::string& CENTER_ID() - { + inline static const std::string &CENTER_ID() { static const std::string ID("ellipse_center"); return ID; } /// 2D point - start point of elliptic arc - inline static const std::string& START_POINT_ID() - { + inline static const std::string &START_POINT_ID() { static const std::string ID("start_point"); return ID; } /// 2D point - end point of elliptic arc - inline static const std::string& END_POINT_ID() - { + inline static const std::string &END_POINT_ID() { static const std::string ID("end_point"); return ID; } /// 2D point - focus of the ellipse - inline static const std::string& FIRST_FOCUS_ID() - { + inline static const std::string &FIRST_FOCUS_ID() { static const std::string ID("ellipse_first_focus"); return ID; } /// 2D point - second focus of the ellipse - inline static const std::string& SECOND_FOCUS_ID() - { + inline static const std::string &SECOND_FOCUS_ID() { static const std::string ID("ellipse_second_focus"); return ID; } /// 2D point - start point of major axis - inline static const std::string& MAJOR_AXIS_START_ID() - { + inline static const std::string &MAJOR_AXIS_START_ID() { static const std::string ID("ellipse_major_axis_start_point"); return ID; } /// 2D point - end point of major axis - inline static const std::string& MAJOR_AXIS_END_ID() - { + inline static const std::string &MAJOR_AXIS_END_ID() { static const std::string ID("ellipse_major_axis_end_point"); return ID; } /// 2D point - start point of minor axis - inline static const std::string& MINOR_AXIS_START_ID() - { + inline static const std::string &MINOR_AXIS_START_ID() { static const std::string ID("ellipse_minor_axis_start_point"); return ID; } /// 2D point - end point of minor axis - inline static const std::string& MINOR_AXIS_END_ID() - { + inline static const std::string &MINOR_AXIS_END_ID() { static const std::string ID("ellipse_minor_axis_end_point"); return ID; } /// Major radius of the ellipse - inline static const std::string& MAJOR_RADIUS_ID() - { + inline static const std::string &MAJOR_RADIUS_ID() { static const std::string ID("ellipse_major_radius"); return ID; } /// Minor radius of the ellipse - inline static const std::string& MINOR_RADIUS_ID() - { + inline static const std::string &MINOR_RADIUS_ID() { static const std::string ID("ellipse_minor_radius"); return ID; } /// Flag the arc is reversed - inline static const std::string& REVERSED_ID() - { + inline static const std::string &REVERSED_ID() { static const std::string ID("reversed"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_EllipticArc::ID(); return MY_KIND; } @@ -128,7 +114,7 @@ class SketchPlugin_EllipticArc: public SketchPlugin_SketchEntity SKETCHPLUGIN_EXPORT virtual bool isFixed(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); @@ -143,7 +129,7 @@ protected: private: bool fillCharacteristicPoints(); - void createEllipticArc(SketchPlugin_Sketch* theSketch); + void createEllipticArc(SketchPlugin_Sketch *theSketch); private: double myParamDelta; diff --git a/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp index 8acc4bd18..11484cd16 100644 --- a/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp +++ b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_ExternalValidator.h" @@ -22,45 +23,51 @@ #include -#include +#include #include +#include #include -#include -bool SketchPlugin_ExternalValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_ExternalValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theArguments.size() != 1) return true; // ask whether the feature of the attribute is external bool isAttributeExternal = isExternalAttribute(theAttribute); - // ask whether the feature of the attribute by parameter identifier is external + // ask whether the feature of the attribute by parameter identifier is + // external std::string aFrontArgument = theArguments.front(); - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); - bool isParameterExternal = isExternalAttribute(aFeature->attribute(aFrontArgument)); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); + bool isParameterExternal = + isExternalAttribute(aFeature->attribute(aFrontArgument)); - // it is not possible that both features, attribute and attribute in parameter, are external + // it is not possible that both features, attribute and attribute in + // parameter, are external if (isAttributeExternal && isParameterExternal) { - theError = "Both features, attribute and attribute in parameter, are external."; + theError = + "Both features, attribute and attribute in parameter, are external."; return false; } return true; } -bool SketchPlugin_ExternalValidator::isExternalAttribute(const AttributePtr& theAttribute) const -{ +bool SketchPlugin_ExternalValidator::isExternalAttribute( + const AttributePtr &theAttribute) const { bool isExternal = false; AttributeRefAttrPtr anAttribute = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (anAttribute.get() != NULL) { - FeaturePtr anArgumentFeature = ModelAPI_Feature::feature(anAttribute->object()); + FeaturePtr anArgumentFeature = + ModelAPI_Feature::feature(anAttribute->object()); if (anArgumentFeature.get() != NULL) { std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(anArgumentFeature); + std::dynamic_pointer_cast(anArgumentFeature); if (aSketchFeature.get() != NULL) { isExternal = aSketchFeature->isExternal(); } diff --git a/src/SketchPlugin/SketchPlugin_ExternalValidator.h b/src/SketchPlugin/SketchPlugin_ExternalValidator.h index 2651ead1d..5ad754b17 100644 --- a/src/SketchPlugin/SketchPlugin_ExternalValidator.h +++ b/src/SketchPlugin/SketchPlugin_ExternalValidator.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_ExternalValidator_H #define SketchPlugin_ExternalValidator_H -#include #include +#include /**\class SketchPlugin_ExternalValidator * \ingroup Validators @@ -29,8 +30,7 @@ * * Allows to select points only. */ -class SketchPlugin_ExternalValidator : public ModelAPI_AttributeValidator -{ +class SketchPlugin_ExternalValidator : public ModelAPI_AttributeValidator { public: /// returns true if the feature of attribute do not contain external features /// in the given attribute and @@ -38,14 +38,15 @@ public: /// \param theAttribute an attribute to check /// \param theArguments a filter parameters /// \param theError error message - SKETCHPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + SKETCHPLUGIN_EXPORT virtual bool + isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; protected: /// returns true if the feature of the attribute is external /// \param theAttribute an attribute to check - bool isExternalAttribute(const AttributePtr& theAttribute) const; + bool isExternalAttribute(const AttributePtr &theAttribute) const; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index f42f4c835..675a43c75 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -14,40 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Feature.h" #include "SketchPlugin_Sketch.h" -#include #include +#include #include #include /// It is important. /// -/// Before writing a new method implementation in this file, please check the next rule: -/// exported public methods must not be implemented in this source file. They should be inline and -/// placed in the header file. -/// Because it leads to the runtime problem on the Linux OS. +/// Before writing a new method implementation in this file, please check the +/// next rule: exported public methods must not be implemented in this source +/// file. They should be inline and placed in the header file. Because it leads +/// to the runtime problem on the Linux OS. /// -/// The reason is that this is an abstract interface. An interface of this class can be used in -/// outside libraries through casting without a link to the current library. +/// The reason is that this is an abstract interface. An interface of this class +/// can be used in outside libraries through casting without a link to the +/// current library. -SketchPlugin_Feature::SketchPlugin_Feature() -{ - mySketch = 0; -} +SketchPlugin_Feature::SketchPlugin_Feature() { mySketch = 0; } -SketchPlugin_Sketch* SketchPlugin_Feature::sketch() -{ +SketchPlugin_Sketch *SketchPlugin_Feature::sketch() { if (!mySketch) { // find sketch that references to this feature - const std::set& aBackRefs = data()->refsToMe(); + const std::set &aBackRefs = data()->refsToMe(); std::set::const_iterator aBackRef = aBackRefs.begin(); - for(; aBackRef != aBackRefs.end(); aBackRef++) { + for (; aBackRef != aBackRefs.end(); aBackRef++) { std::shared_ptr aSketch = - std::dynamic_pointer_cast((*aBackRef)->owner()); + std::dynamic_pointer_cast((*aBackRef)->owner()); if (aSketch) { mySketch = aSketch.get(); break; @@ -57,8 +55,7 @@ SketchPlugin_Sketch* SketchPlugin_Feature::sketch() return mySketch; } -void SketchPlugin_Feature::keepCurrentFeature() -{ +void SketchPlugin_Feature::keepCurrentFeature() { FeaturePtr aCurFeature = document()->currentFeature(true); std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aCurFeature); @@ -69,8 +66,7 @@ void SketchPlugin_Feature::keepCurrentFeature() myCurrentFeature = aCurFeature; } -void SketchPlugin_Feature::restoreCurrentFeature() -{ +void SketchPlugin_Feature::restoreCurrentFeature() { if (myCurrentFeature) document()->setCurrentFeature(myCurrentFeature, true); myCurrentFeature = FeaturePtr(); diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index bdfb08ee5..0580b9d81 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Feature_H_ #define SketchPlugin_Feature_H_ #include "SketchPlugin.h" -#include #include -#include -#include #include +#include +#include +#include #include @@ -33,61 +34,50 @@ class SketchPlugin_Sketch; /**\class SketchPlugin_Feature * \ingroup Plugins - * \brief Feature for creation of the new feature in PartSet. This is an abstract class to give - * an interface to create the sketch feature preview. + * \brief Feature for creation of the new feature in PartSet. This is an + * abstract class to give an interface to create the sketch feature preview. */ -class SketchPlugin_Feature : public ModelAPI_Feature -{ - public: - /// Returns true if this feature must be displayed in the history (top level of Part tree) - SKETCHPLUGIN_EXPORT virtual bool isInHistory() - { - return false; - } - - /// Returns true of the feature is created basing on the external shape of not-this-sketch object - SKETCHPLUGIN_EXPORT virtual bool isExternal() const - { - return false; - } +class SketchPlugin_Feature : public ModelAPI_Feature { +public: + /// Returns true if this feature must be displayed in the history (top level + /// of Part tree) + SKETCHPLUGIN_EXPORT virtual bool isInHistory() { return false; } + + /// Returns true of the feature is created basing on the external shape of + /// not-this-sketch object + SKETCHPLUGIN_EXPORT virtual bool isExternal() const { return false; } /// Returns true if the feature is a copy of other feature - SKETCHPLUGIN_EXPORT virtual bool isCopy() const - { - return false; - } + SKETCHPLUGIN_EXPORT virtual bool isCopy() const { return false; } /// Returns true if the feature and the feature results can be displayed /// \return true - SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const - { - return true; - } + SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const { return true; } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;} + SKETCHPLUGIN_EXPORT virtual bool isFixed() { return false; } /// Returns the sketch of this feature - SketchPlugin_Sketch* sketch(); + SketchPlugin_Sketch *sketch(); + protected: /// Sets the higher-level feature for the sub-feature (sketch for line) - void setSketch(SketchPlugin_Sketch* theSketch) - { - mySketch = theSketch; - } + void setSketch(SketchPlugin_Sketch *theSketch) { mySketch = theSketch; } /// initializes mySketch SketchPlugin_Feature(); - /// Store current feature of the document if it is not the sub-feature of the current sketch + /// Store current feature of the document if it is not the sub-feature of the + /// current sketch void keepCurrentFeature(); - /// Restore current feature of the document after adding new feature to the sketch + /// Restore current feature of the document after adding new feature to the + /// sketch void restoreCurrentFeature(); friend class SketchPlugin_Sketch; private: - std::shared_ptr myPreview; ///< the preview shape - SketchPlugin_Sketch* mySketch; /// sketch that contains this feature + std::shared_ptr myPreview; ///< the preview shape + SketchPlugin_Sketch *mySketch; /// sketch that contains this feature FeaturePtr myCurrentFeature; /// temporary stored current feature }; diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index 0acd530fd..428f2fa8c 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Fillet.h" #include "SketchPlugin_Arc.h" -#include "SketchPlugin_Line.h" -#include "SketchPlugin_Point.h" -#include "SketchPlugin_Sketch.h" +#include "SketchPlugin_ConstraintCoincidence.h" #include "SketchPlugin_ConstraintDistance.h" #include "SketchPlugin_ConstraintEqual.h" -#include "SketchPlugin_ConstraintCoincidence.h" #include "SketchPlugin_ConstraintLength.h" #include "SketchPlugin_ConstraintMiddle.h" -#include "SketchPlugin_ConstraintTangent.h" #include "SketchPlugin_ConstraintRadius.h" +#include "SketchPlugin_ConstraintTangent.h" +#include "SketchPlugin_Line.h" +#include "SketchPlugin_Point.h" +#include "SketchPlugin_Sketch.h" #include "SketchPlugin_Tools.h" #include "SketchPlugin_Validators.h" @@ -53,8 +54,8 @@ #include -#include #include +#include #include @@ -63,45 +64,46 @@ const double paramTolerance = 1.e-4; const double PI = 3.141592653589793238463; /// \brief Attract specified point on theNewArc to the attribute of theFeature -static void recalculateAttributes(FeaturePtr theNewArc, const std::string& theNewArcAttribute, - FeaturePtr theFeature, const std::string& theFeatureAttribute); - +static void recalculateAttributes(FeaturePtr theNewArc, + const std::string &theNewArcAttribute, + FeaturePtr theFeature, + const std::string &theFeatureAttribute); /// \brief Calculate radius of a fillet. /// It should not be greater than 1/3 of shortest edge length. static double calculateFilletRadius(FeaturePtr theFilletFeatures[2]); /// \brief Calculates center of fillet arc and coordinates of tangency points -static void calculateFilletCenter(FeaturePtr theFilletFeatures[2], - double theFilletRadius, - const std::shared_ptr& theSketchPlane, - std::shared_ptr& theCenter, - std::shared_ptr& theTangentA, - std::shared_ptr& theTangentB); +static void +calculateFilletCenter(FeaturePtr theFilletFeatures[2], double theFilletRadius, + const std::shared_ptr &theSketchPlane, + std::shared_ptr &theCenter, + std::shared_ptr &theTangentA, + std::shared_ptr &theTangentB); -static std::set findFeaturesToRemove(const FeaturePtr theFeature, - const AttributePtr theAttribute); +static std::set +findFeaturesToRemove(const FeaturePtr theFeature, + const AttributePtr theAttribute); SketchPlugin_Fillet::SketchPlugin_Fillet() -: myIsReversed(false), myFilletCreated(false) -{ + : myIsReversed(false), myFilletCreated(false) { myIsNotInversed[0] = myIsNotInversed[1] = true; } -void SketchPlugin_Fillet::initAttributes() -{ +void SketchPlugin_Fillet::initAttributes() { data()->addAttribute(FILLET_POINT_ID(), ModelAPI_AttributeRefAttr::typeId()); } -void SketchPlugin_Fillet::execute() -{ +void SketchPlugin_Fillet::execute() { // Wait all constraints being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - // set flag here to avoid building Fillet presentation if "Redisplay" event appears + // set flag here to avoid building Fillet presentation if "Redisplay" event + // appears myFilletCreated = true; // create feature for fillet arc @@ -119,7 +121,8 @@ void SketchPlugin_Fillet::execute() for (int i = 0; i < 2; ++i) { bool isFirstIndex = (i == 0); aFeatInd[i] = myIsReversed == isFirstIndex ? 1 : 0; - anAttrInd[i] = (myIsReversed == isFirstIndex ? 2 : 0) + (myIsNotInversed[aFeatInd[i]] ? 0 : 1); + anAttrInd[i] = (myIsReversed == isFirstIndex ? 2 : 0) + + (myIsNotInversed[aFeatInd[i]] ? 0 : 1); aFilletPoints[i] = std::dynamic_pointer_cast( myBaseFeatures[aFeatInd[i]]->attribute(myFeatAttributes[anAttrInd[i]])); std::set aRemove = @@ -132,30 +135,31 @@ void SketchPlugin_Fillet::execute() // Update fillet edges. recalculateAttributes(aFilletArc, SketchPlugin_Arc::START_ID(), - myBaseFeatures[aFeatInd[0]], myFeatAttributes[anAttrInd[0]]); + myBaseFeatures[aFeatInd[0]], + myFeatAttributes[anAttrInd[0]]); recalculateAttributes(aFilletArc, SketchPlugin_Arc::END_ID(), - myBaseFeatures[aFeatInd[1]], myFeatAttributes[anAttrInd[1]]); + myBaseFeatures[aFeatInd[1]], + myFeatAttributes[anAttrInd[1]]); FeaturePtr aConstraint; // Create coincidence features. - aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aFilletArc->attribute(SketchPlugin_Arc::START_ID()), - myBaseFeatures[aFeatInd[0]]->attribute(myFeatAttributes[anAttrInd[0]])); + aConstraint = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + aFilletArc->attribute(SketchPlugin_Arc::START_ID()), + myBaseFeatures[aFeatInd[0]]->attribute(myFeatAttributes[anAttrInd[0]])); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); - aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aFilletArc->attribute(SketchPlugin_Arc::END_ID()), - myBaseFeatures[aFeatInd[1]]->attribute(myFeatAttributes[anAttrInd[1]])); + aConstraint = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + aFilletArc->attribute(SketchPlugin_Arc::END_ID()), + myBaseFeatures[aFeatInd[1]]->attribute(myFeatAttributes[anAttrInd[1]])); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); // Create tangent features. for (int i = 0; i < 2; i++) { - aConstraint = SketchPlugin_Tools::createConstraintObjectObject(sketch(), - SketchPlugin_ConstraintTangent::ID(), - aFilletArc->lastResult(), - myBaseFeatures[i]->lastResult()); + aConstraint = SketchPlugin_Tools::createConstraintObjectObject( + sketch(), SketchPlugin_ConstraintTangent::ID(), + aFilletArc->lastResult(), myBaseFeatures[i]->lastResult()); aConstraint->execute(); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); } @@ -165,14 +169,13 @@ void SketchPlugin_Fillet::execute() Events_Loop::loop()->setFlushed(anUpdateEvent, true); } -AISObjectPtr SketchPlugin_Fillet::getAISObject(AISObjectPtr thePrevious) -{ - if(myFilletCreated) { +AISObjectPtr SketchPlugin_Fillet::getAISObject(AISObjectPtr thePrevious) { + if (myFilletCreated) { return AISObjectPtr(); } - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return AISObjectPtr(); } @@ -180,18 +183,21 @@ AISObjectPtr SketchPlugin_Fillet::getAISObject(AISObjectPtr thePrevious) return AISObjectPtr(); // Create arc for presentation. - std::shared_ptr aCenterPnt(aSketch->to3D(myCenterXY->x(), myCenterXY->y())); - std::shared_ptr aTangentPnt1(aSketch->to3D(myTangentXY1->x(), - myTangentXY1->y())); - std::shared_ptr aTangentPnt2(aSketch->to3D(myTangentXY2->x(), - myTangentXY2->y())); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aCenterPnt( + aSketch->to3D(myCenterXY->x(), myCenterXY->y())); + std::shared_ptr aTangentPnt1( + aSketch->to3D(myTangentXY1->x(), myTangentXY1->y())); + std::shared_ptr aTangentPnt2( + aSketch->to3D(myTangentXY2->x(), myTangentXY2->y())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); std::shared_ptr anArcShape = - GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenterPnt, aTangentPnt1, aTangentPnt2, aNDir->dir()); + GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenterPnt, aTangentPnt1, + aTangentPnt2, aNDir->dir()); AISObjectPtr anAISObject = thePrevious; - if(!anAISObject.get()) { + if (!anAISObject.get()) { anAISObject = AISObjectPtr(new GeomAPI_AISObject); } anAISObject->createShape(anArcShape); @@ -203,21 +209,20 @@ AISObjectPtr SketchPlugin_Fillet::getAISObject(AISObjectPtr thePrevious) return anAISObject; } -bool SketchPlugin_Fillet::calculateFilletParameters() -{ +bool SketchPlugin_Fillet::calculateFilletParameters() { // Get fillet point. AttributeRefAttrPtr aPointRefAttr = refattr(FILLET_POINT_ID()); if (!aPointRefAttr->isInitialized() || aPointRefAttr->isObject()) return false; std::shared_ptr aFilletPoint2D = - std::dynamic_pointer_cast(aPointRefAttr->attr()); + std::dynamic_pointer_cast(aPointRefAttr->attr()); if (!aFilletPoint2D.get()) return false; Events_InfoMessage anError; FeaturePtr anEdge1, anEdge2; - if (!SketchPlugin_FilletVertexValidator::isValidVertex - (aPointRefAttr, anError, anEdge1, anEdge2)) { + if (!SketchPlugin_FilletVertexValidator::isValidVertex(aPointRefAttr, anError, + anEdge1, anEdge2)) { setError(anError.messageString()); return false; } @@ -243,38 +248,45 @@ bool SketchPlugin_Fillet::calculateFilletParameters() setError("Error: One of the points has wrong coincide feature"); return false; } - myFeatAttributes[2*i] = aStartAttr; - aStartEndPnt[2*i] = std::dynamic_pointer_cast( - myBaseFeatures[i]->attribute(aStartAttr))->pnt(); - myFeatAttributes[2*i+1] = aEndAttr; - aStartEndPnt[2*i+1] = std::dynamic_pointer_cast( - myBaseFeatures[i]->attribute(aEndAttr))->pnt(); + myFeatAttributes[2 * i] = aStartAttr; + aStartEndPnt[2 * i] = std::dynamic_pointer_cast( + myBaseFeatures[i]->attribute(aStartAttr)) + ->pnt(); + myFeatAttributes[2 * i + 1] = aEndAttr; + aStartEndPnt[2 * i + 1] = std::dynamic_pointer_cast( + myBaseFeatures[i]->attribute(aEndAttr)) + ->pnt(); } for (int aFeatInd = 0; aFeatInd < aNbFeatures; aFeatInd++) { for (int j = 0; j < 2; j++) // loop on start-end of each feature - if (aStartEndPnt[aFeatInd * aNbFeatures + j]->distance(aFilletPnt2d) < 1.e-10) { - myIsNotInversed[aFeatInd] = (j==0); + if (aStartEndPnt[aFeatInd * aNbFeatures + j]->distance(aFilletPnt2d) < + 1.e-10) { + myIsNotInversed[aFeatInd] = (j == 0); break; } } - std::shared_ptr aSketchPlane = SketchPlugin_Sketch::plane(sketch()); - calculateFilletCenter(myBaseFeatures, aRadius, aSketchPlane, - myCenterXY, myTangentXY1, myTangentXY2); + std::shared_ptr aSketchPlane = + SketchPlugin_Sketch::plane(sketch()); + calculateFilletCenter(myBaseFeatures, aRadius, aSketchPlane, myCenterXY, + myTangentXY1, myTangentXY2); // Tangent directions of the features in coincident point. std::shared_ptr aTangentDir[aNbFeatures]; for (int i = 0; i < aNbFeatures; i++) { std::shared_ptr aDir; if (myBaseFeatures[i]->getKind() == SketchPlugin_Line::ID()) { - aDir = aStartEndPnt[2*i+1]->xy()->decreased(aStartEndPnt[2*i]->xy()); + aDir = + aStartEndPnt[2 * i + 1]->xy()->decreased(aStartEndPnt[2 * i]->xy()); if (!myIsNotInversed[i]) aDir = aDir->multiplied(-1.0); } else if (myBaseFeatures[i]->getKind() == SketchPlugin_Arc::ID()) { std::shared_ptr aCenterPoint = - std::dynamic_pointer_cast( - myBaseFeatures[i]->attribute(SketchPlugin_Arc::CENTER_ID()))->pnt(); - aDir = myIsNotInversed[i] ? aStartEndPnt[2*i]->xy() : aStartEndPnt[2*i+1]->xy(); + std::dynamic_pointer_cast( + myBaseFeatures[i]->attribute(SketchPlugin_Arc::CENTER_ID())) + ->pnt(); + aDir = myIsNotInversed[i] ? aStartEndPnt[2 * i]->xy() + : aStartEndPnt[2 * i + 1]->xy(); aDir = aDir->decreased(aCenterPoint->xy()); double x = aDir->x(); @@ -282,7 +294,8 @@ bool SketchPlugin_Fillet::calculateFilletParameters() aDir->setX(-y); aDir->setY(x); if (myIsNotInversed[i] == - std::dynamic_pointer_cast(myBaseFeatures[i])->isReversed()) + std::dynamic_pointer_cast(myBaseFeatures[i]) + ->isReversed()) aDir = aDir->multiplied(-1.0); } aTangentDir[i] = std::shared_ptr(new GeomAPI_Dir2d(aDir)); @@ -290,12 +303,14 @@ bool SketchPlugin_Fillet::calculateFilletParameters() // By default, the start point of fillet arc is connected to FeatureA, // and the end point - to FeatureB. But when the angle between TangentDirA and - // TangentDirB greater 180 degree, the sequaence of features need to be reversed. + // TangentDirB greater 180 degree, the sequaence of features need to be + // reversed. double cosBA = aTangentDir[0]->cross(aTangentDir[1]); // cos(B-A), - // where A and B - angles between corresponding tanget direction and the X axis + // where A and B - angles between corresponding tanget direction and the X + // axis myIsReversed = cosBA > 0.0; - if(myIsReversed) { + if (myIsReversed) { std::shared_ptr aTmp = myTangentXY1; myTangentXY1 = myTangentXY2; myTangentXY2 = aTmp; @@ -303,13 +318,13 @@ bool SketchPlugin_Fillet::calculateFilletParameters() return true; } -FeaturePtr SketchPlugin_Fillet::createFilletArc() -{ +FeaturePtr SketchPlugin_Fillet::createFilletArc() { // Calculate Fillet parameters if does not yet if (!myBaseFeatures[0] || !myBaseFeatures[1]) calculateFilletParameters(); - // fix for issue #2810 (sometimes, myCenterXY is NULL, fillet should report an error) + // fix for issue #2810 (sometimes, myCenterXY is NULL, fillet should report an + // error) if (!myCenterXY) return FeaturePtr(); @@ -319,17 +334,17 @@ FeaturePtr SketchPlugin_Fillet::createFilletArc() // Set arc attributes. bool aWasBlocked = aFilletArc->data()->blockSendAttributeUpdated(true); std::dynamic_pointer_cast( - aFilletArc->attribute(SketchPlugin_Arc::CENTER_ID()))->setValue(myCenterXY->x(), - myCenterXY->y()); + aFilletArc->attribute(SketchPlugin_Arc::CENTER_ID())) + ->setValue(myCenterXY->x(), myCenterXY->y()); std::shared_ptr aStartPoint = std::dynamic_pointer_cast( aFilletArc->attribute(SketchPlugin_Arc::START_ID())); std::shared_ptr aEndPoint = std::dynamic_pointer_cast( aFilletArc->attribute(SketchPlugin_Arc::END_ID())); - if(aStartPoint->isInitialized() && aEndPoint->isInitialized() - && (aStartPoint->pnt()->xy()->distance(myTangentXY1) > tolerance - || aEndPoint->pnt()->xy()->distance(myTangentXY2) > tolerance)) { + if (aStartPoint->isInitialized() && aEndPoint->isInitialized() && + (aStartPoint->pnt()->xy()->distance(myTangentXY1) > tolerance || + aEndPoint->pnt()->xy()->distance(myTangentXY2) > tolerance)) { std::dynamic_pointer_cast(aFilletArc)->setReversed(false); } aStartPoint->setValue(myTangentXY1->x(), myTangentXY1->y()); @@ -340,8 +355,8 @@ FeaturePtr SketchPlugin_Fillet::createFilletArc() return aFilletArc; } -FeaturePtr SketchPlugin_Fillet::createFilletApex(const GeomPnt2dPtr& theCoordinates) -{ +FeaturePtr +SketchPlugin_Fillet::createFilletApex(const GeomPnt2dPtr &theCoordinates) { FeaturePtr anApex = sketch()->addFeature(SketchPlugin_Point::ID()); AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( anApex->attribute(SketchPlugin_Point::COORD_ID())); @@ -349,13 +364,13 @@ FeaturePtr SketchPlugin_Fillet::createFilletApex(const GeomPnt2dPtr& theCoordina anApex->boolean(SketchPlugin_Point::AUXILIARY_ID())->setValue(true); // additional coincidence constraints - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); FeaturePtr aConstraint; for (int i = 0; i < 2; i++) { - aConstraint = SketchPlugin_Tools::createConstraintAttrObject(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aCoord, - myBaseFeatures[i]->lastResult()); + aConstraint = SketchPlugin_Tools::createConstraintAttrObject( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), aCoord, + myBaseFeatures[i]->lastResult()); aConstraint->execute(); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); } @@ -372,9 +387,8 @@ struct Length { }; void SketchPlugin_Fillet::removeReferencesButKeepDistances( - std::set& theFeaturesToRemove, - const AttributePoint2DPtr theFilletPoints[2]) -{ + std::set &theFeaturesToRemove, + const AttributePoint2DPtr theFilletPoints[2]) { FeaturePtr aFilletApex; std::list aLengthToDistance; @@ -387,12 +401,15 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( aFilletApex = createFilletApex(theFilletPoints[0]->pnt()); // update attributes of distance constraints bool isUpdated = false; - for (int attrInd = 0; attrInd < CONSTRAINT_ATTR_SIZE && !isUpdated; ++attrInd) { + for (int attrInd = 0; attrInd < CONSTRAINT_ATTR_SIZE && !isUpdated; + ++attrInd) { AttributeRefAttrPtr aRefAttr = aDistance->refattr(SketchPlugin_Constraint::ATTRIBUTE(attrInd)); if (aRefAttr && !aRefAttr->isObject() && - (aRefAttr->attr() == theFilletPoints[0] || aRefAttr->attr() == theFilletPoints[1])) { - aRefAttr->setAttr(aFilletApex->attribute(SketchPlugin_Point::COORD_ID())); + (aRefAttr->attr() == theFilletPoints[0] || + aRefAttr->attr() == theFilletPoints[1])) { + aRefAttr->setAttr( + aFilletApex->attribute(SketchPlugin_Point::COORD_ID())); isUpdated = true; } } @@ -409,31 +426,36 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( aFilletApex = createFilletApex(theFilletPoints[0]->pnt()); // remove Length, but create new distance constraint AttributeRefAttrPtr aRefAttr = - aLength->refattr(SketchPlugin_Constraint::ENTITY_A()); + aLength->refattr(SketchPlugin_Constraint::ENTITY_A()); FeaturePtr aLine = ModelAPI_Feature::feature(aRefAttr->object()); if (aLine) { aLengthToDistance.push_back(Length()); - Length& aNewLength = aLengthToDistance.back(); + Length &aNewLength = aLengthToDistance.back(); // main attrbutes for (int i = 0; i < 2; ++i) { - AttributePtr anAttr = aLine->attribute( - i == 0 ? SketchPlugin_Line::START_ID() : SketchPlugin_Line::END_ID()); + AttributePtr anAttr = + aLine->attribute(i == 0 ? SketchPlugin_Line::START_ID() + : SketchPlugin_Line::END_ID()); if (anAttr == theFilletPoints[0] || anAttr == theFilletPoints[1]) - aNewLength.myPoints[i] = aFilletApex->attribute(SketchPlugin_Point::COORD_ID()); + aNewLength.myPoints[i] = + aFilletApex->attribute(SketchPlugin_Point::COORD_ID()); else aNewLength.myPoints[i] = anAttr; } // value - AttributeDoublePtr aValue = aLength->real(SketchPlugin_Constraint::VALUE()); + AttributeDoublePtr aValue = + aLength->real(SketchPlugin_Constraint::VALUE()); aNewLength.myValueDouble = aValue->value(); aNewLength.myValueText = aValue->text(); // auxiliary attributes - AttributePoint2DPtr aFlyoutAttr = std::dynamic_pointer_cast( - aLength->attribute(SketchPlugin_ConstraintLength::FLYOUT_VALUE_PNT())); + AttributePoint2DPtr aFlyoutAttr = + std::dynamic_pointer_cast(aLength->attribute( + SketchPlugin_ConstraintLength::FLYOUT_VALUE_PNT())); if (aFlyoutAttr && aFlyoutAttr->isInitialized()) - aNewLength.myFlyoutPoint = SketchPlugin_Tools::flyoutPointCoordinates(aLength); - AttributeIntegerPtr aLocationAttr = - aLength->integer(SketchPlugin_ConstraintLength::LOCATION_TYPE_ID()); + aNewLength.myFlyoutPoint = + SketchPlugin_Tools::flyoutPointCoordinates(aLength); + AttributeIntegerPtr aLocationAttr = aLength->integer( + SketchPlugin_ConstraintLength::LOCATION_TYPE_ID()); if (aLocationAttr && aLocationAttr->isInitialized()) aNewLength.myLocationType = aLocationAttr->value(); else @@ -453,85 +475,90 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( FeaturePtr aConstraint; std::list::iterator anIt = aLengthToDistance.begin(); for (; anIt != aLengthToDistance.end(); ++anIt) { - aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintDistance::ID(), anIt->myPoints[0], anIt->myPoints[1]); + aConstraint = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintDistance::ID(), anIt->myPoints[0], + anIt->myPoints[1]); // set value - AttributeDoublePtr aValue = aConstraint->real(SketchPlugin_Constraint::VALUE()); + AttributeDoublePtr aValue = + aConstraint->real(SketchPlugin_Constraint::VALUE()); if (anIt->myValueText.empty()) aValue->setValue(anIt->myValueDouble); else aValue->setText(anIt->myValueText); // set flyout point if exists if (anIt->myFlyoutPoint) { - AttributePoint2DPtr aFlyoutAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_ConstraintDistance::FLYOUT_VALUE_PNT())); + AttributePoint2DPtr aFlyoutAttr = + std::dynamic_pointer_cast(aConstraint->attribute( + SketchPlugin_ConstraintDistance::FLYOUT_VALUE_PNT())); aFlyoutAttr->setValue(anIt->myFlyoutPoint); } // set location type if initialized if (anIt->myLocationType >= 0) { - AttributeIntegerPtr aLocationType = - aConstraint->integer(SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID()); + AttributeIntegerPtr aLocationType = aConstraint->integer( + SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID()); aLocationType->setValue(anIt->myLocationType); } aConstraint->execute(); - ModelAPI_EventCreator::get()->sendUpdated(aConstraint, - Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + ModelAPI_EventCreator::get()->sendUpdated( + aConstraint, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } } // ========= Auxiliary functions ================= -void recalculateAttributes(FeaturePtr theNewArc, const std::string& theNewArcAttribute, - FeaturePtr theFeature, const std::string& theFeatureAttribute) -{ - std::shared_ptr anArcPoint = std::dynamic_pointer_cast( - theNewArc->attribute(theNewArcAttribute))->pnt(); +void recalculateAttributes(FeaturePtr theNewArc, + const std::string &theNewArcAttribute, + FeaturePtr theFeature, + const std::string &theFeatureAttribute) { + std::shared_ptr anArcPoint = + std::dynamic_pointer_cast( + theNewArc->attribute(theNewArcAttribute)) + ->pnt(); std::dynamic_pointer_cast( - theFeature->attribute(theFeatureAttribute))->setValue(anArcPoint->x(), anArcPoint->y()); + theFeature->attribute(theFeatureAttribute)) + ->setValue(anArcPoint->x(), anArcPoint->y()); } -static std::shared_ptr toPoint(const AttributePtr& theAttribute) -{ +static std::shared_ptr +toPoint(const AttributePtr &theAttribute) { std::shared_ptr aPoint; - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast(theAttribute); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast(theAttribute); if (aPointAttr) aPoint = aPointAttr->pnt(); return aPoint; } -static std::shared_ptr toLine(const FeaturePtr& theFeature) -{ +static std::shared_ptr toLine(const FeaturePtr &theFeature) { std::shared_ptr aLine; if (theFeature->getKind() == SketchPlugin_Line::ID()) { std::shared_ptr aStart = - toPoint( theFeature->attribute(SketchPlugin_Line::START_ID()) ); + toPoint(theFeature->attribute(SketchPlugin_Line::START_ID())); std::shared_ptr aEnd = - toPoint( theFeature->attribute(SketchPlugin_Line::END_ID()) ); + toPoint(theFeature->attribute(SketchPlugin_Line::END_ID())); aLine = std::shared_ptr(new GeomAPI_Lin2d(aStart, aEnd)); } return aLine; } -static std::shared_ptr toCircle(const FeaturePtr& theFeature) -{ +static std::shared_ptr toCircle(const FeaturePtr &theFeature) { std::shared_ptr aCircle; if (theFeature->getKind() == SketchPlugin_Arc::ID()) { std::shared_ptr aCenter = - toPoint( theFeature->attribute(SketchPlugin_Arc::CENTER_ID()) ); + toPoint(theFeature->attribute(SketchPlugin_Arc::CENTER_ID())); std::shared_ptr aStart = - toPoint( theFeature->attribute(SketchPlugin_Arc::START_ID()) ); - aCircle = std::shared_ptr(new GeomAPI_Circ2d(aCenter, aStart)); + toPoint(theFeature->attribute(SketchPlugin_Arc::START_ID())); + aCircle = + std::shared_ptr(new GeomAPI_Circ2d(aCenter, aStart)); } return aCircle; } - void calculateFilletCenter(FeaturePtr theFilletFeatures[2], double theFilletRadius, - const std::shared_ptr& theSketchPlane, - std::shared_ptr& theCenter, - std::shared_ptr& theTangentA, - std::shared_ptr& theTangentB) -{ + const std::shared_ptr &theSketchPlane, + std::shared_ptr &theCenter, + std::shared_ptr &theTangentA, + std::shared_ptr &theTangentB) { GeomShapePtr aShapeA = theFilletFeatures[0]->lastResult()->shape(); GeomShapePtr aShapeB = theFilletFeatures[1]->lastResult()->shape(); @@ -561,12 +588,12 @@ void calculateFilletCenter(FeaturePtr theFilletFeatures[2], theTangentB = aTgPoints[1]->xy(); } -double calculateFilletRadius(FeaturePtr theFilletFeatures[2]) -{ - double aLengths[2] = { 0, 0 }; +double calculateFilletRadius(FeaturePtr theFilletFeatures[2]) { + double aLengths[2] = {0, 0}; for (int i = 0; i < 2; ++i) { GeomShapePtr aShape = theFilletFeatures[i]->lastResult()->shape(); - std::shared_ptr anEdge = std::dynamic_pointer_cast(aShape); + std::shared_ptr anEdge = + std::dynamic_pointer_cast(aShape); if (anEdge) aLengths[i] = anEdge->length(); } @@ -578,34 +605,33 @@ std::set findFeaturesToRemove(const FeaturePtr theFeature, std::set aFeaturesToBeRemoved; std::set aRefs = theFeature->data()->refsToMe(); std::list aResults = theFeature->results(); - for(std::list::const_iterator aResultsIt = aResults.cbegin(); - aResultsIt != aResults.cend(); - ++aResultsIt) { + for (std::list::const_iterator aResultsIt = aResults.cbegin(); + aResultsIt != aResults.cend(); ++aResultsIt) { ResultPtr aResult = *aResultsIt; std::set aResultRefs = aResult->data()->refsToMe(); aRefs.insert(aResultRefs.begin(), aResultRefs.end()); } - for(std::set::const_iterator anIt = aRefs.cbegin(); - anIt != aRefs.cend(); - ++anIt) { + for (std::set::const_iterator anIt = aRefs.cbegin(); + anIt != aRefs.cend(); ++anIt) { std::shared_ptr anAttr = (*anIt); - FeaturePtr aFeature = std::dynamic_pointer_cast(anAttr->owner()); - if(aFeature->getKind() == SketchPlugin_Fillet::ID()) { + FeaturePtr aFeature = + std::dynamic_pointer_cast(anAttr->owner()); + if (aFeature->getKind() == SketchPlugin_Fillet::ID()) { continue; } - if(aFeature->getKind() == SketchPlugin_ConstraintLength::ID() - || aFeature->getKind() == SketchPlugin_ConstraintEqual::ID() - || aFeature->getKind() == SketchPlugin_ConstraintMiddle::ID()) { + if (aFeature->getKind() == SketchPlugin_ConstraintLength::ID() || + aFeature->getKind() == SketchPlugin_ConstraintEqual::ID() || + aFeature->getKind() == SketchPlugin_ConstraintMiddle::ID()) { aFeaturesToBeRemoved.insert(aFeature); } else { std::list anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); - for(std::list::const_iterator aRefAttrsIt = anAttrs.cbegin(); - aRefAttrsIt != anAttrs.cend(); - ++aRefAttrsIt) { + for (std::list::const_iterator aRefAttrsIt = + anAttrs.cbegin(); + aRefAttrsIt != anAttrs.cend(); ++aRefAttrsIt) { AttributeRefAttrPtr anAttrRefAttr = - std::dynamic_pointer_cast(*aRefAttrsIt); - if(anAttrRefAttr.get() && anAttrRefAttr->attr() == theAttribute) { + std::dynamic_pointer_cast(*aRefAttrsIt); + if (anAttrRefAttr.get() && anAttrRefAttr->attr() == theAttribute) { aFeaturesToBeRemoved.insert(aFeature); } } diff --git a/src/SketchPlugin/SketchPlugin_Fillet.h b/src/SketchPlugin/SketchPlugin_Fillet.h index 16b38caa3..413cccf67 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.h +++ b/src/SketchPlugin/SketchPlugin_Fillet.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Fillet_H_ @@ -33,26 +34,23 @@ class GeomAPI_XY; /// \ingroup Plugins /// \brief Feature for creation of a new arc filleting two objects which have /// coincident point. -class SketchPlugin_Fillet: public SketchPlugin_SketchEntity, public GeomAPI_IPresentable -{ - public: +class SketchPlugin_Fillet : public SketchPlugin_SketchEntity, + public GeomAPI_IPresentable { +public: /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_FEATURE_ID("SketchFillet"); return MY_FEATURE_ID; } /// Attribute name of fillet point. - inline static const std::string& FILLET_POINT_ID() - { + inline static const std::string &FILLET_POINT_ID() { static const std::string ID("fillet_point"); return ID; } /// \return the kind of a feature. - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Fillet::ID(); return MY_KIND; } @@ -60,17 +58,19 @@ class SketchPlugin_Fillet: public SketchPlugin_SketchEntity, public GeomAPI_IPre /// \brief Creates a new part document if needed. SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes. + /// \brief Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;} + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;} + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } /// Reimplemented from SketchPlugin_Feature::move(). /// Do nothing. @@ -85,28 +85,34 @@ private: /// Create new feature presenting a fillet arc and initialize its parameters FeaturePtr createFilletArc(); - /// Create point representing fillet apex and additional coincidences with fillet features - FeaturePtr createFilletApex(const std::shared_ptr& theCoordinates); + /// Create point representing fillet apex and additional coincidences with + /// fillet features + FeaturePtr + createFilletApex(const std::shared_ptr &theCoordinates); /// Remove references to a feature participating in fillet, /// but transfer "distance" constraints to features after fillet /// \param[in, out] theFeaturesToRemove features referred to fillet edges - /// (all distances will be processed and removed from this list) - /// \param[in] theFilletPoints fillet points from participating features - void removeReferencesButKeepDistances(std::set& theFeaturesToRemove, - const AttributePoint2DPtr theFilletPoints[2]); + /// (all distances will be processed and removed from this + /// list) + /// \param[in] theFilletPoints fillet points from participating + /// features + void removeReferencesButKeepDistances( + std::set &theFeaturesToRemove, + const AttributePoint2DPtr theFilletPoints[2]); - bool findFeaturesContainingFilletPoint(std::shared_ptr theFilletPoint); + bool findFeaturesContainingFilletPoint( + std::shared_ptr theFilletPoint); private: - FeaturePtr myBaseFeatures[2]; - std::string myFeatAttributes[4]; // attributes of features - bool myIsReversed; - bool myIsNotInversed[2]; // indicates which point the features share - bool myFilletCreated; - std::shared_ptr myCenterXY; - std::shared_ptr myTangentXY1; - std::shared_ptr myTangentXY2; + FeaturePtr myBaseFeatures[2]; + std::string myFeatAttributes[4]; // attributes of features + bool myIsReversed; + bool myIsNotInversed[2]; // indicates which point the features share + bool myFilletCreated; + std::shared_ptr myCenterXY; + std::shared_ptr myTangentXY1; + std::shared_ptr myTangentXY2; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp index 7b3ad4647..958b3a10c 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_IntersectionPoint.h" #include "SketchPlugin_Point.h" -#include #include +#include #include #include #include @@ -33,27 +34,27 @@ #include SketchPlugin_IntersectionPoint::SketchPlugin_IntersectionPoint() - : SketchPlugin_SketchEntity(), - myIsComputing(false) -{ -} + : SketchPlugin_SketchEntity(), myIsComputing(false) {} -void SketchPlugin_IntersectionPoint::initDerivedClassAttributes() -{ - data()->addAttribute(EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(INTERSECTION_POINTS_ID(), ModelAPI_AttributeRefList::typeId()); +void SketchPlugin_IntersectionPoint::initDerivedClassAttributes() { + data()->addAttribute(EXTERNAL_FEATURE_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INTERSECTION_POINTS_ID(), + ModelAPI_AttributeRefList::typeId()); data()->attribute(INTERSECTION_POINTS_ID())->setIsArgument(false); - data()->addAttribute(INCLUDE_INTO_RESULT(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(INCLUDE_INTO_RESULT(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), AUXILIARY_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + AUXILIARY_ID()); } -void SketchPlugin_IntersectionPoint::execute() -{ +void SketchPlugin_IntersectionPoint::execute() { AttributeRefListPtr anIntersectionsList = reflist(INTERSECTION_POINTS_ID()); if (!anIntersectionsList || !anIntersectionsList->isInitialized()) return; // no intersections @@ -61,14 +62,13 @@ void SketchPlugin_IntersectionPoint::execute() computePoint(EXTERNAL_FEATURE_ID()); } -void SketchPlugin_IntersectionPoint::attributeChanged(const std::string& theID) -{ +void SketchPlugin_IntersectionPoint::attributeChanged( + const std::string &theID) { // compute intersection between line and sketch plane computePoint(theID); } -void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) -{ +void SketchPlugin_IntersectionPoint::computePoint(const std::string &theID) { if (theID != EXTERNAL_FEATURE_ID() && theID != EXTERNAL_ID()) return; @@ -95,13 +95,15 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) AttributeRefListPtr anIntersectionsList = reflist(INTERSECTION_POINTS_ID()); std::list anExistentIntersections = anIntersectionsList->list(); - std::list::const_iterator aExistInterIt = anExistentIntersections.begin(); + std::list::const_iterator aExistInterIt = + anExistentIntersections.begin(); - const std::list& aResults = results(); + const std::list &aResults = results(); std::list::const_iterator aResIt = aResults.begin(); int aResultIndex = 0; - for (std::list::iterator aPntIt = anIntersectionsPoints.begin(); + for (std::list::iterator aPntIt = + anIntersectionsPoints.begin(); aPntIt != anIntersectionsPoints.end(); ++aPntIt, ++aResultIndex) { std::shared_ptr aCurSketchPoint; if (aExistInterIt == anExistentIntersections.end()) { @@ -109,14 +111,15 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) // create new point aCurSketchPoint = std::dynamic_pointer_cast( - sketch()->addFeature(SketchPlugin_Point::ID())); + sketch()->addFeature(SketchPlugin_Point::ID())); aCurSketchPoint->boolean(COPY_ID())->setValue(true); anIntersectionsList->append(aCurSketchPoint); restoreCurrentFeature(); } else { // update existent point - aCurSketchPoint = std::dynamic_pointer_cast(*aExistInterIt); + aCurSketchPoint = + std::dynamic_pointer_cast(*aExistInterIt); ++aExistInterIt; } @@ -128,7 +131,8 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) aCurResult->setDisplayed(false); } else { // update existent result - aCurResult = std::dynamic_pointer_cast(*aResIt); + aCurResult = + std::dynamic_pointer_cast(*aResIt); aCurResult->setShape(std::shared_ptr()); ++aResIt; } @@ -136,7 +140,8 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) // update coordinates of intersection GeomPnt2dPtr aPointInSketch = sketch()->to2D(*aPntIt); std::dynamic_pointer_cast( - aCurSketchPoint->attribute(SketchPlugin_Point::COORD_ID()))->setValue(aPointInSketch); + aCurSketchPoint->attribute(SketchPlugin_Point::COORD_ID())) + ->setValue(aPointInSketch); aCurSketchPoint->execute(); // update result @@ -145,7 +150,8 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) // make intersection point external GeomShapePtr anEmptyVal; - aCurSketchPoint->selection(EXTERNAL_ID())->setValue(aCurResult, anEmptyVal); + aCurSketchPoint->selection(EXTERNAL_ID()) + ->setValue(aCurResult, anEmptyVal); } // remove rest results from previous pass diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h index b420b3ece..4d9cda63f 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_IntersectionPoint_H_ @@ -27,54 +28,47 @@ * \brief Feature for creation of external point as an intersection * between external edge and a plane of the sketch. */ -class SketchPlugin_IntersectionPoint : public SketchPlugin_SketchEntity -{ +class SketchPlugin_IntersectionPoint : public SketchPlugin_SketchEntity { public: /// Point feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_POINT_ID("SketchIntersectionPoint"); return MY_POINT_ID; } /// Returns the kind of a feature - virtual const std::string& getKind() - { + virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_IntersectionPoint::ID(); return MY_KIND; } - static const std::string& EXTERNAL_FEATURE_ID() - { + static const std::string &EXTERNAL_FEATURE_ID() { static std::string MY_FEATURE_ID("ExternalFeature"); return MY_FEATURE_ID; } - static const std::string& INTERSECTION_POINTS_ID() - { + static const std::string &INTERSECTION_POINTS_ID() { static std::string MY_INTERSECTIONS_ID("IntersectionPoints"); return MY_INTERSECTIONS_ID; } - static const std::string& INCLUDE_INTO_RESULT() - { + static const std::string &INCLUDE_INTO_RESULT() { static std::string MY_INCLUDE("IncludeToResult"); return MY_INCLUDE; } /// Returns true because intersection point is always external - virtual bool isFixed() - { return true; } + virtual bool isFixed() { return true; } /// Returns true if the feature and the feature results can be displayed. /// \return false - virtual bool canBeDisplayed() const - { return false; } + virtual bool canBeDisplayed() const { return false; } /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Called on change of any argument-attribute of this object: for external point - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + /// Called on change of any argument-attribute of this object: for external + /// point + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation SketchPlugin_IntersectionPoint(); @@ -85,7 +79,7 @@ protected: private: /// \brief Find intersection between a line and a sketch plane - void computePoint(const std::string& theID); + void computePoint(const std::string &theID); bool myIsComputing; }; diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index 2d6ad7183..ee4643346 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -14,21 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Line.h" -#include "SketchPlugin_Sketch.h" #include "SketchPlugin_ConstraintCoincidence.h" +#include "SketchPlugin_Sketch.h" +#include +#include +#include #include #include #include -#include -#include -#include -#include #include +#include #include #include @@ -37,75 +38,77 @@ #include -SketchPlugin_Line::SketchPlugin_Line() - : SketchPlugin_SketchEntity() -{} +SketchPlugin_Line::SketchPlugin_Line() : SketchPlugin_SketchEntity() {} -void SketchPlugin_Line::initAttributes() -{ +void SketchPlugin_Line::initAttributes() { SketchPlugin_SketchEntity::initAttributes(); /// new attributes should be added to end of the feature in order to provide /// correct attribute values in previous saved studies data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeDouble::typeId()); } -void SketchPlugin_Line::initDerivedClassAttributes() -{ +void SketchPlugin_Line::initDerivedClassAttributes() { data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); } -void SketchPlugin_Line::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); +void SketchPlugin_Line::execute() { + SketchPlugin_Sketch *aSketch = sketch(); if (aSketch) { // compute a start point in 3D view - std::shared_ptr aStartAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(START_ID())); + std::shared_ptr aStartAttr = + std::dynamic_pointer_cast( + data()->attribute(START_ID())); // compute an end point in 3D view - std::shared_ptr anEndAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(END_ID())); + std::shared_ptr anEndAttr = + std::dynamic_pointer_cast( + data()->attribute(END_ID())); if (aStartAttr->isInitialized() && anEndAttr->isInitialized()) { - SketchPlugin_Sketch::createLine2DResult(this, aSketch, START_ID(), END_ID()); + SketchPlugin_Sketch::createLine2DResult(this, aSketch, START_ID(), + END_ID()); static Events_ID anId = ModelAPI_EventReentrantMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new ModelAPI_EventReentrantMessage(anId, this)); - aMessage->setCreatedFeature(ModelAPI_Feature::feature( - data()->attribute(START_ID())->owner())); + std::shared_ptr aMessage = + std::shared_ptr( + new ModelAPI_EventReentrantMessage(anId, this)); + aMessage->setCreatedFeature( + ModelAPI_Feature::feature(data()->attribute(START_ID())->owner())); Events_Loop::loop()->send(aMessage); } } } // LCOV_EXCL_START -std::string SketchPlugin_Line::processEvent(const std::shared_ptr& theMessage) -{ +std::string SketchPlugin_Line::processEvent( + const std::shared_ptr &theMessage) { std::string aFilledAttributeName; std::shared_ptr aReentrantMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aReentrantMessage.get()) { FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature(); // Initialize new line with first point equal to end of previous std::shared_ptr aSFData = aCreatedFeature->data(); - std::shared_ptr aSPoint = std::dynamic_pointer_cast( - aSFData->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aSPoint = + std::dynamic_pointer_cast( + aSFData->attribute(SketchPlugin_Line::END_ID())); std::shared_ptr aNFData = data(); - std::shared_ptr aNPoint = std::dynamic_pointer_cast( - aNFData->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aNPoint = + std::dynamic_pointer_cast( + aNFData->attribute(SketchPlugin_Line::START_ID())); aNPoint->setValue(aSPoint->x(), aSPoint->y()); - SketchPlugin_ConstraintCoincidence::createCoincidenceFeature(sketch(), aSPoint, aNPoint); + SketchPlugin_ConstraintCoincidence::createCoincidenceFeature( + sketch(), aSPoint, aNPoint); } return aFilledAttributeName; } // LCOV_EXCL_STOP -const std::string& SketchPlugin_Line::getKind() -{ +const std::string &SketchPlugin_Line::getKind() { static std::string MY_KIND = SketchPlugin_Line::ID(); return MY_KIND; } @@ -114,12 +117,13 @@ bool SketchPlugin_Line::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_Line::attributeChanged(const std::string& theID) { +void SketchPlugin_Line::attributeChanged(const std::string &theID) { // the second condition for unability to move external segments anywhere - // isCopy() is checked temporary for case when copied lines stored external id state - // to be removed after debug + // isCopy() is checked temporary for case when copied lines stored external id + // state to be removed after debug if ((theID == EXTERNAL_ID() || isFixed()) && !isCopy()) { - std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); + std::shared_ptr aSelection = + data()->selection(EXTERNAL_ID())->value(); if (!aSelection) { // empty shape in selection shows that the shape is equal to context ResultPtr anExtRes = selection(EXTERNAL_ID())->context(); @@ -128,27 +132,27 @@ void SketchPlugin_Line::attributeChanged(const std::string& theID) { } // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { - std::shared_ptr anEdge( new GeomAPI_Edge(aSelection)); + std::shared_ptr anEdge(new GeomAPI_Edge(aSelection)); std::shared_ptr aStartAttr = - std::dynamic_pointer_cast(attribute(START_ID())); + std::dynamic_pointer_cast(attribute(START_ID())); aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint())); std::shared_ptr anEndAttr = - std::dynamic_pointer_cast(attribute(END_ID())); + std::dynamic_pointer_cast(attribute(END_ID())); anEndAttr->setValue(sketch()->to2D(anEdge->lastPoint())); updateLenghtValue(); } - } - else if (theID == START_ID() || theID == END_ID()) { + } else if (theID == START_ID() || theID == END_ID()) { updateLenghtValue(); } } -void SketchPlugin_Line::updateLenghtValue() -{ - std::shared_ptr aStartAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(START_ID())); - std::shared_ptr anEndAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(END_ID())); +void SketchPlugin_Line::updateLenghtValue() { + std::shared_ptr aStartAttr = + std::dynamic_pointer_cast( + data()->attribute(START_ID())); + std::shared_ptr anEndAttr = + std::dynamic_pointer_cast( + data()->attribute(END_ID())); if (aStartAttr->isInitialized() && anEndAttr->isInitialized()) { double aDistance = aStartAttr->pnt()->distance(anEndAttr->pnt()); data()->real(LENGTH_ID())->setValue(aDistance); diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index eefe61b07..216d8f0da 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Line_H_ @@ -23,8 +24,8 @@ #include #include "SketchPlugin.h" -#include #include +#include #include class GeomAPI_Pnt2d; @@ -34,60 +35,58 @@ class GeomAPI_Pnt2d; * \brief Feature for creation of the new part in PartSet. */ class SketchPlugin_Line : public SketchPlugin_SketchEntity, - public ModelAPI_IReentrant -{ - public: + public ModelAPI_IReentrant { +public: /// Arc feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string SKETCH_LINE_ID("SketchLine"); return SKETCH_LINE_ID; } /// Start 2D point of the line - inline static const std::string& START_ID() - { + inline static const std::string &START_ID() { static const std::string MY_START_ID("StartPoint"); return MY_START_ID; } /// End 2D point of the line - inline static const std::string& END_ID() - { + inline static const std::string &END_ID() { static const std::string MY_END_ID("EndPoint"); return MY_END_ID; } /// Line length. - static const std::string& LENGTH_ID() - { + static const std::string &LENGTH_ID() { static const std::string MY_LENGTH("LineLength"); return MY_LENGTH; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind(); + SKETCHPLUGIN_EXPORT virtual const std::string &getKind(); /// Returns true is sketch element is under the rigid constraint SKETCHPLUGIN_EXPORT virtual bool isFixed(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes virtual void initAttributes(); /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Apply information of the message to current object. It fills start attribute of - /// the current feature by last attribute of the message feature, build coincidence - /// if message has selected object - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills start + /// attribute of the current feature by last attribute of the message feature, + /// build coincidence if message has selected object + virtual std::string + processEvent(const std::shared_ptr &theMessage); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation SketchPlugin_Line(); private: - /// Calculates the length of the line and fill the length attribute with the value + /// Calculates the length of the line and fill the length attribute with the + /// value void updateLenghtValue(); protected: diff --git a/src/SketchPlugin/SketchPlugin_MacroArc.cpp b/src/SketchPlugin/SketchPlugin_MacroArc.cpp index d3687c9a3..f2f120990 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArc.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroArc.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_MacroArc.h" @@ -22,9 +23,9 @@ #include "SketchPlugin_Arc.h" #include "SketchPlugin_ConstraintPerpendicular.h" #include "SketchPlugin_ConstraintTangent.h" +#include "SketchPlugin_MacroArcReentrantMessage.h" #include "SketchPlugin_Sketch.h" #include "SketchPlugin_Tools.h" -#include "SketchPlugin_MacroArcReentrantMessage.h" #include #include @@ -41,16 +42,16 @@ #include #include #include +#include #include #include -#include -#include #include +#include #include -#include #include +#include #include // for sqrt on Linux @@ -60,18 +61,18 @@ const double tolerance = 1e-7; const double paramTolerance = 1.e-4; const double PI = 3.141592653589793238463; -static void projectPointOnCircle(AttributePoint2DPtr& thePoint, const GeomAPI_Circ2d& theCircle) -{ - std::shared_ptr aProjection = theCircle.project(thePoint->pnt()); - if(aProjection.get()) +static void projectPointOnCircle(AttributePoint2DPtr &thePoint, + const GeomAPI_Circ2d &theCircle) { + std::shared_ptr aProjection = + theCircle.project(thePoint->pnt()); + if (aProjection.get()) thePoint->setValue(aProjection); } -static void intersectShapeAndCircle(const GeomShapePtr& theShape, - const GeomAPI_Circ2d& theCircle, - const SketchPlugin_Sketch* theSketch, - AttributePoint2DPtr& theIntersection) -{ +static void intersectShapeAndCircle(const GeomShapePtr &theShape, + const GeomAPI_Circ2d &theCircle, + const SketchPlugin_Sketch *theSketch, + AttributePoint2DPtr &theIntersection) { if (!theShape->isEdge()) return projectPointOnCircle(theIntersection, theCircle); @@ -95,10 +96,14 @@ static void intersectShapeAndCircle(const GeomShapePtr& theShape, // convert 2D circle to 3D object std::shared_ptr aCenter2d = theCircle.center(); - std::shared_ptr aCenter(theSketch->to3D(aCenter2d->x(), aCenter2d->y())); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - const_cast(theSketch)->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); + std::shared_ptr aCenter( + theSketch->to3D(aCenter2d->x(), aCenter2d->y())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + const_cast(theSketch)->attribute( + SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal( + new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); GeomShapePtr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, theCircle.radius()); @@ -127,20 +132,15 @@ static void intersectShapeAndCircle(const GeomShapePtr& theShape, } } } - if(anInterPnt.get()) { + if (anInterPnt.get()) { theIntersection->setValue(anInterPnt); } } - SketchPlugin_MacroArc::SketchPlugin_MacroArc() -: SketchPlugin_SketchEntity(), - myParamBefore(0.0) -{ -} + : SketchPlugin_SketchEntity(), myParamBefore(0.0) {} -void SketchPlugin_MacroArc::initAttributes() -{ +void SketchPlugin_MacroArc::initAttributes() { data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(CENTER_POINT_ID(), GeomDataAPI_Point2D::typeId()); @@ -154,7 +154,8 @@ void SketchPlugin_MacroArc::initAttributes() data()->addAttribute(TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(END_POINT_3_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(TRANSVERSAL_POINT_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(TRANSVERSAL_POINT_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(END_POINT_4_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId()); @@ -164,29 +165,36 @@ void SketchPlugin_MacroArc::initAttributes() data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(CENTER_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(START_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(CENTER_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(START_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(END_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(PASSED_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(PASSED_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(EDIT_ARC_TYPE_ID(), ModelAPI_AttributeString::typeId()); boolean(REVERSED_ID())->setValue(false); string(EDIT_ARC_TYPE_ID())->setValue(""); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), START_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), END_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EDIT_ARC_TYPE_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), CENTER_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), START_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), END_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PASSED_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), EDIT_ARC_TYPE_ID()); } -void SketchPlugin_MacroArc::attributeChanged(const std::string& theID) -{ +void SketchPlugin_MacroArc::attributeChanged(const std::string &theID) { std::string anArcType = string(ARC_TYPE())->value(); // If arc type switched reset according attributes. - if(theID == ARC_TYPE()) { + if (theID == ARC_TYPE()) { SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_ID()); SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_REF_ID()); SketchPlugin_Tools::resetAttribute(this, START_POINT_1_ID()); @@ -210,21 +218,21 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID) myEnd.reset(); boolean(REVERSED_ID())->setValue(false); myParamBefore = 0.0; - } else if(anArcType == ARC_TYPE_BY_CENTER_AND_POINTS()) + } else if (anArcType == ARC_TYPE_BY_CENTER_AND_POINTS()) fillByCenterAndTwoPassed(); - else if(anArcType == ARC_TYPE_BY_THREE_POINTS()) + else if (anArcType == ARC_TYPE_BY_THREE_POINTS()) fillByThreePassedPoints(); - else if(anArcType == ARC_TYPE_BY_TANGENT_EDGE()) + else if (anArcType == ARC_TYPE_BY_TANGENT_EDGE()) fillByEdge(false); else if (anArcType == ARC_TYPE_BY_TRANSVERSAL_LINE()) fillByEdge(true); double aRadius = 0; double anAngle = 0; - if(myCenter.get() && myStart.get()) { + if (myCenter.get() && myStart.get()) { aRadius = myCenter->distance(myStart); - if(myEnd.get()) { - if(myStart->isEqual(myEnd)) { + if (myEnd.get()) { + if (myStart->isEqual(myEnd)) { anAngle = 360; } else { GeomAPI_Circ2d aCircleForArc(myCenter, myStart); @@ -232,14 +240,16 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID) aCircleForArc.parameter(myStart, paramTolerance, aStartParam); aCircleForArc.parameter(myEnd, paramTolerance, anEndParam); anAngle = (anEndParam - aStartParam) / PI * 180.0; - if(boolean(REVERSED_ID())->value()) anAngle = 360.0 - anAngle; + if (boolean(REVERSED_ID())->value()) + anAngle = 360.0 - anAngle; } } } bool aWasBlocked = data()->blockSendAttributeUpdated(true); - if(myCenter.get()) { - // center attribute is used in processEvent() to set reference to reentrant arc + if (myCenter.get()) { + // center attribute is used in processEvent() to set reference to reentrant + // arc std::dynamic_pointer_cast(attribute(CENTER_POINT_ID())) ->setValue(myCenter); } @@ -248,29 +258,34 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID) data()->blockSendAttributeUpdated(aWasBlocked, false); } -GeomShapePtr SketchPlugin_MacroArc::getArcShape(bool isBound) -{ - if(!myStart.get() || !myEnd.get() || !myCenter.get()) { +GeomShapePtr SketchPlugin_MacroArc::getArcShape(bool isBound) { + if (!myStart.get() || !myEnd.get() || !myCenter.get()) { return GeomShapePtr(); } - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch) { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) { return GeomShapePtr(); } - std::shared_ptr aCenter(aSketch->to3D(myCenter->x(), myCenter->y())); - std::shared_ptr aStart(aSketch->to3D(myStart->x(), myStart->y())); + std::shared_ptr aCenter( + aSketch->to3D(myCenter->x(), myCenter->y())); + std::shared_ptr aStart( + aSketch->to3D(myStart->x(), myStart->y())); std::shared_ptr anEnd(aSketch->to3D(myEnd->x(), myEnd->y())); std::shared_ptr aNDir = - std::dynamic_pointer_cast(aSketch->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); + std::dynamic_pointer_cast( + aSketch->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal( + new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); GeomShapePtr anArcShape; if (isBound) { - anArcShape = boolean(REVERSED_ID())->value() ? - GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, anEnd, aStart, aNormal) - : GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStart, anEnd, aNormal); + anArcShape = boolean(REVERSED_ID())->value() + ? GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, anEnd, + aStart, aNormal) + : GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStart, + anEnd, aNormal); } else { double aRadius = aCenter->distance(aStart); anArcShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius); @@ -279,35 +294,37 @@ GeomShapePtr SketchPlugin_MacroArc::getArcShape(bool isBound) return anArcShape; } -AISObjectPtr SketchPlugin_MacroArc::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr SketchPlugin_MacroArc::getAISObject(AISObjectPtr thePrevious) { GeomShapePtr anArcShape = getArcShape(); - if(!anArcShape.get()) + if (!anArcShape.get()) return AISObjectPtr(); - SketchPlugin_Sketch* aSketch = sketch(); - std::shared_ptr aCenter = aSketch->to3D(myCenter->x(), myCenter->y());; + SketchPlugin_Sketch *aSketch = sketch(); + std::shared_ptr aCenter = + aSketch->to3D(myCenter->x(), myCenter->y()); + ; GeomShapePtr aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter); - if(!aCenterPointShape.get()) + if (!aCenterPointShape.get()) return AISObjectPtr(); - std::list > aShapes; + std::list> aShapes; aShapes.push_back(anArcShape); aShapes.push_back(aCenterPointShape); - std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); + std::shared_ptr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aShapes); AISObjectPtr anAIS = thePrevious; - if(!anAIS.get()) { + if (!anAIS.get()) { anAIS.reset(new GeomAPI_AISObject()); } anAIS->createShape(aCompound); - SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, + boolean(AUXILIARY_ID())->value()); return anAIS; } -void SketchPlugin_MacroArc::execute() -{ +void SketchPlugin_MacroArc::execute() { FeaturePtr anArcFeature = createArcFeature(); myCenter.reset(); @@ -316,87 +333,84 @@ void SketchPlugin_MacroArc::execute() // Create constraints. std::string anArcType = string(ARC_TYPE())->value(); - if(anArcType == ARC_TYPE_BY_CENTER_AND_POINTS()) { - SketchPlugin_Tools::createCoincidenceOrTangency(this, - CENTER_POINT_REF_ID(), - anArcFeature->attribute(SketchPlugin_Arc::CENTER_ID()), - ObjectPtr(), - false); - SketchPlugin_Tools::createCoincidenceOrTangency(this, - START_POINT_REF_ID(), - anArcFeature->attribute(SketchPlugin_Arc::START_ID()), - ObjectPtr(), - false); - SketchPlugin_Tools::createCoincidenceOrTangency(this, - END_POINT_REF_ID(), - anArcFeature->attribute(SketchPlugin_Arc::END_ID()), - ObjectPtr(), - false); - } else if(anArcType == ARC_TYPE_BY_THREE_POINTS()) { - SketchPlugin_Tools::createCoincidenceOrTangency(this, - START_POINT_REF_ID(), - anArcFeature->attribute(SketchPlugin_Arc::START_ID()), - ObjectPtr(), - false); - SketchPlugin_Tools::createCoincidenceOrTangency(this, - END_POINT_REF_ID(), - anArcFeature->attribute(SketchPlugin_Arc::END_ID()), - ObjectPtr(), - false); - SketchPlugin_Tools::createCoincidenceOrTangency(this, - PASSED_POINT_REF_ID(), - AttributePtr(), - anArcFeature->lastResult(), - true); + if (anArcType == ARC_TYPE_BY_CENTER_AND_POINTS()) { + SketchPlugin_Tools::createCoincidenceOrTangency( + this, CENTER_POINT_REF_ID(), + anArcFeature->attribute(SketchPlugin_Arc::CENTER_ID()), ObjectPtr(), + false); + SketchPlugin_Tools::createCoincidenceOrTangency( + this, START_POINT_REF_ID(), + anArcFeature->attribute(SketchPlugin_Arc::START_ID()), ObjectPtr(), + false); + SketchPlugin_Tools::createCoincidenceOrTangency( + this, END_POINT_REF_ID(), + anArcFeature->attribute(SketchPlugin_Arc::END_ID()), ObjectPtr(), + false); + } else if (anArcType == ARC_TYPE_BY_THREE_POINTS()) { + SketchPlugin_Tools::createCoincidenceOrTangency( + this, START_POINT_REF_ID(), + anArcFeature->attribute(SketchPlugin_Arc::START_ID()), ObjectPtr(), + false); + SketchPlugin_Tools::createCoincidenceOrTangency( + this, END_POINT_REF_ID(), + anArcFeature->attribute(SketchPlugin_Arc::END_ID()), ObjectPtr(), + false); + SketchPlugin_Tools::createCoincidenceOrTangency( + this, PASSED_POINT_REF_ID(), AttributePtr(), anArcFeature->lastResult(), + true); } else { // coincident with connection point - const std::string& aPointAttr = anArcType == ARC_TYPE_BY_TANGENT_EDGE() ? - TANGENT_POINT_ID() : TRANSVERSAL_POINT_ID(); - SketchPlugin_Tools::createCoincidenceOrTangency(this, - aPointAttr, - anArcFeature->attribute(SketchPlugin_Arc::START_ID()), - ObjectPtr(), - false); + const std::string &aPointAttr = anArcType == ARC_TYPE_BY_TANGENT_EDGE() + ? TANGENT_POINT_ID() + : TRANSVERSAL_POINT_ID(); + SketchPlugin_Tools::createCoincidenceOrTangency( + this, aPointAttr, anArcFeature->attribute(SketchPlugin_Arc::START_ID()), + ObjectPtr(), false); // tangent or perpendicular constraint FeaturePtr aStartPointConstraint; if (anArcType == ARC_TYPE_BY_TANGENT_EDGE()) - aStartPointConstraint = sketch()->addFeature(SketchPlugin_ConstraintTangent::ID()); + aStartPointConstraint = + sketch()->addFeature(SketchPlugin_ConstraintTangent::ID()); else - aStartPointConstraint = sketch()->addFeature(SketchPlugin_ConstraintPerpendicular::ID()); + aStartPointConstraint = + sketch()->addFeature(SketchPlugin_ConstraintPerpendicular::ID()); // setting attributes of the start point constraint AttributeRefAttrPtr aRefAttrA = aStartPointConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); AttributeRefAttrPtr aTgPntRefAttr = refattr(aPointAttr); - FeaturePtr aTgFeature = ModelAPI_Feature::feature(aTgPntRefAttr->attr()->owner()); + FeaturePtr aTgFeature = + ModelAPI_Feature::feature(aTgPntRefAttr->attr()->owner()); aRefAttrA->setObject(aTgFeature->lastResult()); AttributeRefAttrPtr aRefAttrB = aStartPointConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); aRefAttrB->setObject(anArcFeature->lastResult()); // constraint for end point - SketchPlugin_Tools::createCoincidenceOrTangency(this, - END_POINT_REF_ID(), - anArcFeature->attribute(SketchPlugin_Arc::END_ID()), - ObjectPtr(), - false); + SketchPlugin_Tools::createCoincidenceOrTangency( + this, END_POINT_REF_ID(), + anArcFeature->attribute(SketchPlugin_Arc::END_ID()), ObjectPtr(), + false); } // message to init reentrant operation static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new SketchPlugin_MacroArcReentrantMessage(anId, this)); + std::shared_ptr aMessage = + std::shared_ptr( + new SketchPlugin_MacroArcReentrantMessage(anId, this)); std::string anEditArcType = string(EDIT_ARC_TYPE_ID())->value(); - aMessage->setTypeOfCreation(!anEditArcType.empty() ? anEditArcType : anArcType); + aMessage->setTypeOfCreation(!anEditArcType.empty() ? anEditArcType + : anArcType); aMessage->setCreatedFeature(anArcFeature); Events_Loop::loop()->send(aMessage); } // LCOV_EXCL_START -std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptr& theMessage) -{ +std::string SketchPlugin_MacroArc::processEvent( + const std::shared_ptr &theMessage) { std::string aFilledAttributeName; std::shared_ptr aReentrantMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast( + theMessage); if (aReentrantMessage.get()) { FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature(); std::string anArcType = aReentrantMessage->typeOfCreation(); @@ -404,23 +418,22 @@ std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptrsetValue(anArcType); aFilledAttributeName = ARC_TYPE(); - if(anArcType == ARC_TYPE_BY_TANGENT_EDGE()) { + if (anArcType == ARC_TYPE_BY_TANGENT_EDGE()) { aFilledAttributeName = TANGENT_POINT_ID(); AttributeRefAttrPtr aRefAttr = refattr(aFilledAttributeName); aRefAttr->setAttr(aCreatedFeature->attribute(SketchPlugin_Arc::END_ID())); - } - else if (anArcType == ARC_TYPE_BY_TRANSVERSAL_LINE()) { + } else if (anArcType == ARC_TYPE_BY_TRANSVERSAL_LINE()) { AttributeRefAttrPtr aRefAttr = refattr(TRANSVERSAL_POINT_ID()); AttributePtr anAttribute = aReentrantMessage->selectedAttribute(); if (anAttribute) { aRefAttr->setAttr(anAttribute); aFilledAttributeName = TRANSVERSAL_POINT_ID(); } - } - else { + } else { ObjectPtr anObject = aReentrantMessage->selectedObject(); AttributePtr anAttribute = aReentrantMessage->selectedAttribute(); - std::shared_ptr aClickedPoint = aReentrantMessage->clickedPoint(); + std::shared_ptr aClickedPoint = + aReentrantMessage->clickedPoint(); if (aClickedPoint.get() && (anObject.get() || anAttribute.get())) { if (anArcType == ARC_TYPE_BY_CENTER_AND_POINTS() || @@ -429,28 +442,31 @@ std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptr( - attribute(aFilledAttributeName)); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast( + attribute(aFilledAttributeName)); aPointAttr->setValue(aClickedPoint); // fill reference attribute - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - attribute(aReferenceAttributeName)); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + attribute(aReferenceAttributeName)); if (aRefAttr.get()) { if (anAttribute.get()) { - if (!anAttribute->owner().get() || !anAttribute->owner()->data()->isValid()) { + if (!anAttribute->owner().get() || + !anAttribute->owner()->data()->isValid()) { if (aCreatedFeature.get()) { std::string anID = anAttribute->id(); std::string anArcID; if (anID == END_POINT_1_ID() || anID == END_POINT_2_ID() || anID == END_POINT_3_ID()) anArcID = SketchPlugin_Arc::END_ID(); - else if (anID == START_POINT_1_ID() || anID ==START_POINT_2_ID()) + else if (anID == START_POINT_1_ID() || + anID == START_POINT_2_ID()) anArcID = SketchPlugin_Arc::START_ID(); else if (anID == CENTER_POINT_ID()) anArcID = SketchPlugin_Arc::CENTER_ID(); @@ -458,12 +474,12 @@ std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptrsetAttr(anAttribute); - } - else if (anObject.get()) { - // if attribute is NULL, only object is defined, it should be processed outside - // the feature because it might be an external feature, that will be - // removed/created again after restart operation - // #2468 - Crash when sketching circles successively on a repetition + } else if (anObject.get()) { + // if attribute is NULL, only object is defined, it should be + // processed outside the feature because it might be an external + // feature, that will be removed/created again after restart + // operation #2468 - Crash when sketching circles successively on + // a repetition aFilledAttributeName = ARC_TYPE(); } } @@ -476,33 +492,36 @@ std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptraddFeature(SketchPlugin_Arc::ID()); std::dynamic_pointer_cast( - anArcFeature->attribute(SketchPlugin_Arc::CENTER_ID()))->setValue(myCenter); + anArcFeature->attribute(SketchPlugin_Arc::CENTER_ID())) + ->setValue(myCenter); std::dynamic_pointer_cast( - anArcFeature->attribute(SketchPlugin_Arc::START_ID()))->setValue(myStart); + anArcFeature->attribute(SketchPlugin_Arc::START_ID())) + ->setValue(myStart); std::dynamic_pointer_cast( - anArcFeature->attribute(SketchPlugin_Arc::END_ID()))->setValue(myEnd); + anArcFeature->attribute(SketchPlugin_Arc::END_ID())) + ->setValue(myEnd); anArcFeature->boolean(SketchPlugin_Arc::REVERSED_ID()) - ->setValue(boolean(REVERSED_ID())->value()); + ->setValue(boolean(REVERSED_ID())->value()); anArcFeature->boolean(SketchPlugin_Arc::AUXILIARY_ID()) - ->setValue(boolean(AUXILIARY_ID())->value()); + ->setValue(boolean(AUXILIARY_ID())->value()); anArcFeature->execute(); return anArcFeature; } -void SketchPlugin_MacroArc::fillByCenterAndTwoPassed() -{ +void SketchPlugin_MacroArc::fillByCenterAndTwoPassed() { AttributePoint2DPtr aCenterPointAttr = - std::dynamic_pointer_cast(attribute(CENTER_POINT_ID())); + std::dynamic_pointer_cast( + attribute(CENTER_POINT_ID())); if (!aCenterPointAttr->isInitialized()) - return; + return; AttributePoint2DPtr aStartPointAttr = - std::dynamic_pointer_cast(attribute(START_POINT_1_ID())); + std::dynamic_pointer_cast( + attribute(START_POINT_1_ID())); if (!aStartPointAttr->isInitialized()) return; @@ -511,13 +530,14 @@ void SketchPlugin_MacroArc::fillByCenterAndTwoPassed() myEnd = myStart; AttributePoint2DPtr anEndPointAttr = - std::dynamic_pointer_cast(attribute(END_POINT_1_ID())); + std::dynamic_pointer_cast( + attribute(END_POINT_1_ID())); if (!anEndPointAttr->isInitialized()) return; GeomAPI_Circ2d aCircleForArc(myCenter, myStart); // avoid degerated arc, when the center and the start points are equal - if (!aCircleForArc.implPtr()) + if (!aCircleForArc.implPtr()) return; bool aWasBlocked = data()->blockSendAttributeUpdated(true); @@ -526,7 +546,8 @@ void SketchPlugin_MacroArc::fillByCenterAndTwoPassed() AttributeRefAttrPtr aEndPointRefAttr = refattr(END_POINT_REF_ID()); if (aEndPointRefAttr && aEndPointRefAttr->isInitialized()) { if (aEndPointRefAttr->isObject()) { - FeaturePtr aFeature = ModelAPI_Feature::feature(aEndPointRefAttr->object()); + FeaturePtr aFeature = + ModelAPI_Feature::feature(aEndPointRefAttr->object()); if (aFeature) aRefShape = aFeature->lastResult()->shape(); } @@ -545,28 +566,29 @@ void SketchPlugin_MacroArc::fillByCenterAndTwoPassed() recalculateReversedFlagByEnd(aCircleForArc); } -void SketchPlugin_MacroArc::recalculateReversedFlagByEnd(const GeomAPI_Circ2d& theCurrentCircular) -{ +void SketchPlugin_MacroArc::recalculateReversedFlagByEnd( + const GeomAPI_Circ2d &theCurrentCircular) { double aParameterNew = 0.0; - if(theCurrentCircular.parameter(myEnd, paramTolerance, aParameterNew)) { - if(myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) { + if (theCurrentCircular.parameter(myEnd, paramTolerance, aParameterNew)) { + if (myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) { boolean(REVERSED_ID())->setValue(true); - } else if(myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) { + } else if (myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) { boolean(REVERSED_ID())->setValue(false); } } myParamBefore = aParameterNew; } -void SketchPlugin_MacroArc::fillByThreePassedPoints() -{ +void SketchPlugin_MacroArc::fillByThreePassedPoints() { AttributePoint2DPtr aStartPointAttr = - std::dynamic_pointer_cast(attribute(START_POINT_2_ID())); + std::dynamic_pointer_cast( + attribute(START_POINT_2_ID())); if (!aStartPointAttr->isInitialized()) return; AttributePoint2DPtr anEndPointAttr = - std::dynamic_pointer_cast(attribute(END_POINT_2_ID())); + std::dynamic_pointer_cast( + attribute(END_POINT_2_ID())); if (!anEndPointAttr->isInitialized()) return; @@ -574,14 +596,17 @@ void SketchPlugin_MacroArc::fillByThreePassedPoints() myEnd = anEndPointAttr->pnt(); AttributePoint2DPtr aPassedPointAttr = - std::dynamic_pointer_cast(attribute(PASSED_POINT_ID())); + std::dynamic_pointer_cast( + attribute(PASSED_POINT_ID())); if (aPassedPointAttr->isInitialized()) { std::shared_ptr aPassedPnt; std::shared_ptr aTangentCurve; SketchPlugin_Tools::convertRefAttrToPointOrTangentCurve( - refattr(PASSED_POINT_REF_ID()), aPassedPointAttr, aTangentCurve, aPassedPnt); + refattr(PASSED_POINT_REF_ID()), aPassedPointAttr, aTangentCurve, + aPassedPnt); - GeomAlgoAPI_Circ2dBuilder aCircBuilder(SketchPlugin_Sketch::plane(sketch())); + GeomAlgoAPI_Circ2dBuilder aCircBuilder( + SketchPlugin_Sketch::plane(sketch())); aCircBuilder.addPassingPoint(myStart); aCircBuilder.addPassingPoint(myEnd); if (aTangentCurve) { @@ -595,24 +620,27 @@ void SketchPlugin_MacroArc::fillByThreePassedPoints() return; myCenter = aCircle->center(); - aCircle = std::shared_ptr(new GeomAPI_Circ2d(myCenter, myStart)); + aCircle = + std::shared_ptr(new GeomAPI_Circ2d(myCenter, myStart)); recalculateReversedFlagByPassed(*aCircle); } else - myCenter.reset(new GeomAPI_Pnt2d(myStart->xy()->added(myEnd->xy())->multiplied(0.5))); + myCenter.reset( + new GeomAPI_Pnt2d(myStart->xy()->added(myEnd->xy())->multiplied(0.5))); } void SketchPlugin_MacroArc::recalculateReversedFlagByPassed( - const GeomAPI_Circ2d& theCurrentCircular) -{ + const GeomAPI_Circ2d &theCurrentCircular) { AttributePoint2DPtr aPassedAttr = - std::dynamic_pointer_cast(attribute(PASSED_POINT_ID())); - std::shared_ptr aPassed = theCurrentCircular.project(aPassedAttr->pnt()); + std::dynamic_pointer_cast( + attribute(PASSED_POINT_ID())); + std::shared_ptr aPassed = + theCurrentCircular.project(aPassedAttr->pnt()); double aEndParam, aPassedParam; theCurrentCircular.parameter(myEnd, paramTolerance, aEndParam); theCurrentCircular.parameter(aPassed, paramTolerance, aPassedParam); - if(aPassedParam > aEndParam) + if (aPassedParam > aEndParam) boolean(REVERSED_ID())->setValue(true); else boolean(REVERSED_ID())->setValue(false); @@ -620,10 +648,11 @@ void SketchPlugin_MacroArc::recalculateReversedFlagByPassed( myParamBefore = aEndParam; } -void SketchPlugin_MacroArc::fillByEdge(bool theTransversal) -{ - const std::string& aStartPoint = theTransversal ? TRANSVERSAL_POINT_ID() : TANGENT_POINT_ID(); - const std::string& aEndPoint = theTransversal ? END_POINT_4_ID() : END_POINT_3_ID(); +void SketchPlugin_MacroArc::fillByEdge(bool theTransversal) { + const std::string &aStartPoint = + theTransversal ? TRANSVERSAL_POINT_ID() : TANGENT_POINT_ID(); + const std::string &aEndPoint = + theTransversal ? END_POINT_4_ID() : END_POINT_3_ID(); AttributeRefAttrPtr aTangentAttr = refattr(aStartPoint); if (!aTangentAttr->isInitialized()) @@ -645,8 +674,10 @@ void SketchPlugin_MacroArc::fillByEdge(bool theTransversal) return; // obtain a shape the tangent point belongs to - FeaturePtr aConnectedFeature = ModelAPI_Feature::feature(aConnectionPointAttr->owner()); - std::shared_ptr aTangentShape = aConnectedFeature->lastResult()->shape(); + FeaturePtr aConnectedFeature = + ModelAPI_Feature::feature(aConnectionPointAttr->owner()); + std::shared_ptr aTangentShape = + aConnectedFeature->lastResult()->shape(); GeomAlgoAPI_Circ2dBuilder aCircBuilder(SketchPlugin_Sketch::plane(sketch())); aCircBuilder.addPassingPoint(myStart); @@ -662,6 +693,7 @@ void SketchPlugin_MacroArc::fillByEdge(bool theTransversal) myCenter = aCircle->center(); // rebuild circle to set start point equal to zero parameter - aCircle = std::shared_ptr(new GeomAPI_Circ2d(myCenter, myStart)); + aCircle = + std::shared_ptr(new GeomAPI_Circ2d(myCenter, myStart)); recalculateReversedFlagByEnd(*aCircle); } diff --git a/src/SketchPlugin/SketchPlugin_MacroArc.h b/src/SketchPlugin/SketchPlugin_MacroArc.h index 67d6e2822..bf0a17371 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArc.h +++ b/src/SketchPlugin/SketchPlugin_MacroArc.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MacroArc_H_ @@ -33,184 +34,160 @@ class GeomAPI_Pnt2d; /**\class SketchPlugin_MacroArc * \ingroup Plugins * \brief Feature for creation of the new arc of circle in PartSet. - * The visualization of this object is separated in two parts. The first one is an AIS object - * calculated when there is non-initialized attributes of the arc. The second is a result and - * it is calculated if all attributes are initialized. + * The visualization of this object is separated in two parts. The first one is + * an AIS object calculated when there is non-initialized attributes of the arc. + * The second is a result and it is calculated if all attributes are + * initialized. */ -class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity, - public GeomAPI_IPresentable, - public ModelAPI_IReentrant -{ - public: +class SketchPlugin_MacroArc : public SketchPlugin_SketchEntity, + public GeomAPI_IPresentable, + public ModelAPI_IReentrant { +public: /// Arc feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchMacroArc"); return ID; } - inline static const std::string& ARC_TYPE() - { + inline static const std::string &ARC_TYPE() { static const std::string ID("arc_type"); return ID; } - static const std::string& ARC_TYPE_BY_CENTER_AND_POINTS() - { + static const std::string &ARC_TYPE_BY_CENTER_AND_POINTS() { static const std::string ID("by_center_and_points"); return ID; } - static const std::string& ARC_TYPE_BY_THREE_POINTS() - { + static const std::string &ARC_TYPE_BY_THREE_POINTS() { static const std::string ID("by_three_points"); return ID; } - inline static const std::string& ARC_TYPE_BY_TANGENT_EDGE() - { + inline static const std::string &ARC_TYPE_BY_TANGENT_EDGE() { static const std::string ID("by_tangent_edge"); return ID; } - inline static const std::string& ARC_TYPE_BY_TRANSVERSAL_LINE() - { + inline static const std::string &ARC_TYPE_BY_TRANSVERSAL_LINE() { static const std::string ID("by_transversal_line"); return ID; } /// Central 2D point of the circle which contains the arc - inline static const std::string& CENTER_POINT_ID() - { + inline static const std::string &CENTER_POINT_ID() { static const std::string ID = "center_point"; return ID; } - inline static const std::string& CENTER_POINT_REF_ID() - { + inline static const std::string &CENTER_POINT_REF_ID() { static const std::string ID = "center_point_ref"; return ID; } /// Start 2D point of the arc - inline static const std::string& START_POINT_1_ID() - { + inline static const std::string &START_POINT_1_ID() { static const std::string ID = "start_point_1"; return ID; } /// Start 2D point of the arc - inline static const std::string& START_POINT_2_ID() - { + inline static const std::string &START_POINT_2_ID() { static const std::string ID = "start_point_2"; return ID; } - inline static const std::string& START_POINT_REF_ID() - { + inline static const std::string &START_POINT_REF_ID() { static const std::string ID = "start_point_ref"; return ID; } /// End 2D point of the arc - inline static const std::string& END_POINT_1_ID() - { + inline static const std::string &END_POINT_1_ID() { static const std::string ID = "end_point_1"; return ID; } /// End 2D point of the arc - inline static const std::string& END_POINT_2_ID() - { + inline static const std::string &END_POINT_2_ID() { static const std::string ID = "end_point_2"; return ID; } /// End 2D point of the arc - inline static const std::string& END_POINT_3_ID() - { + inline static const std::string &END_POINT_3_ID() { static const std::string ID = "end_point_3"; return ID; } /// End 2D point of the arc - inline static const std::string& END_POINT_4_ID() - { + inline static const std::string &END_POINT_4_ID() { static const std::string ID = "end_point_4"; return ID; } - inline static const std::string& END_POINT_REF_ID() - { + inline static const std::string &END_POINT_REF_ID() { static const std::string ID = "end_point_ref"; return ID; } /// Passed point of the arc. - static const std::string& PASSED_POINT_ID() - { + static const std::string &PASSED_POINT_ID() { static const std::string ID("passed_point"); return ID; } - static const std::string& PASSED_POINT_REF_ID() - { + static const std::string &PASSED_POINT_REF_ID() { static const std::string ID("passed_point_ref"); return ID; } - static const std::string& TANGENT_POINT_ID() - { + static const std::string &TANGENT_POINT_ID() { static const std::string ID("tangent_point"); return ID; } - static const std::string& TRANSVERSAL_POINT_ID() - { + static const std::string &TRANSVERSAL_POINT_ID() { static const std::string ID("transversal_point"); return ID; } /// Reversed flag - inline static const std::string& REVERSED_ID() - { + inline static const std::string &REVERSED_ID() { static const std::string ID("reversed"); return ID; } /// Arc radius. - static const std::string& RADIUS_ID() - { + static const std::string &RADIUS_ID() { static const std::string ID("radius"); return ID; } /// Arc angle. - static const std::string& ANGLE_ID() - { + static const std::string &ANGLE_ID() { static const std::string ID("angle"); return ID; } /// Arc angle. - static const std::string& EDIT_ARC_TYPE_ID() - { + static const std::string &EDIT_ARC_TYPE_ID() { static const std::string ID("edit_arc_type"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MacroArc::ID(); return MY_KIND; } - /// \brief Request for initialization of data model of the feature: adding all attributes. + /// \brief Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); @@ -219,19 +196,21 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity, SKETCHPLUGIN_EXPORT virtual void execute(); /// Reimplemented from ModelAPI_Feature::isMacro(). - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}; + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; - /// Apply information of the message to current object. It fills reference object, - /// tangent type and tangent point refence in case of tangent arc - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills reference + /// object, tangent type and tangent point refence in case of tangent arc + virtual std::string + processEvent(const std::shared_ptr &theMessage); /// Use plugin manager for features creation. SketchPlugin_MacroArc(); /// Returns shape of arc. - /// \param isBound if true prepare arc, otherwice create circle containing this arc + /// \param isBound if true prepare arc, otherwice create circle containing + /// this arc GeomShapePtr getArcShape(bool isBound = true); private: @@ -239,14 +218,16 @@ private: void fillByCenterAndTwoPassed(); /// Set fields for center, start and end points by selected passed points void fillByThreePassedPoints(); - /// Set fields for center, start and end points by selected tangent or transversal edge - /// \param theTransversal if \c true, builds transversal arc, otherwise builds tangential arc. + /// Set fields for center, start and end points by selected tangent or + /// transversal edge \param theTransversal if \c true, builds transversal arc, + /// otherwise builds tangential arc. void fillByEdge(bool theTransversal); FeaturePtr createArcFeature(); - void recalculateReversedFlagByEnd(const GeomAPI_Circ2d& theCurrentCircular); - void recalculateReversedFlagByPassed(const GeomAPI_Circ2d& theCurrentCircular); + void recalculateReversedFlagByEnd(const GeomAPI_Circ2d &theCurrentCircular); + void + recalculateReversedFlagByPassed(const GeomAPI_Circ2d &theCurrentCircular); private: std::shared_ptr myCenter; diff --git a/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h b/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h index a9df87a20..de634c002 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h +++ b/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MacroArcReentrantMessage_H_ #define SketchPlugin_MacroArcReentrantMessage_H_ -#include #include +#include #include @@ -29,35 +30,39 @@ /// Message that style of visualization of parameter is changed. /// It will be shown as expression or value -class SketchPlugin_MacroArcReentrantMessage : public ModelAPI_EventReentrantMessage -{ +class SketchPlugin_MacroArcReentrantMessage + : public ModelAPI_EventReentrantMessage { public: /// Creates an empty message - SKETCHPLUGIN_EXPORT SketchPlugin_MacroArcReentrantMessage(const Events_ID theID, - const void* theSender) - : ModelAPI_EventReentrantMessage(theID, theSender) {} + SKETCHPLUGIN_EXPORT + SketchPlugin_MacroArcReentrantMessage(const Events_ID theID, + const void *theSender) + : ModelAPI_EventReentrantMessage(theID, theSender) {} /// The virtual destructor SKETCHPLUGIN_EXPORT virtual ~SketchPlugin_MacroArcReentrantMessage() {} /// Static. Returns EventID of the message. - inline static Events_ID eventId() - { - static const char * MY_EVENT_MACRO_ARC_MESSAGE_ID("MacroArcReentrantMessage"); + inline static Events_ID eventId() { + static const char *MY_EVENT_MACRO_ARC_MESSAGE_ID( + "MacroArcReentrantMessage"); return Events_Loop::eventByName(MY_EVENT_MACRO_ARC_MESSAGE_ID); } /// Stores type of creation /// \param the type - SKETCHPLUGIN_EXPORT void setTypeOfCreation(const std::string& theType) - { myTypeOfCreation = theType; } + SKETCHPLUGIN_EXPORT void setTypeOfCreation(const std::string &theType) { + myTypeOfCreation = theType; + } /// Returns type of creation /// \return the type - SKETCHPLUGIN_EXPORT std::string typeOfCreation() const { return myTypeOfCreation; } + SKETCHPLUGIN_EXPORT std::string typeOfCreation() const { + return myTypeOfCreation; + } private: - std::string myTypeOfCreation; ///< to know what parameters of new feature should be filled + std::string myTypeOfCreation; ///< to know what parameters of new feature + ///< should be filled }; - #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp b/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp index 9781c8e22..e482cc1a5 100644 --- a/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,8 +25,8 @@ #include #include #include -#include #include +#include #include @@ -34,8 +35,8 @@ #include #include #include -#include #include +#include #include @@ -48,41 +49,32 @@ #include /// Create internal coincidence constraint with B-spline pole -static void createInternalConstraint(SketchPlugin_Sketch* theSketch, +static void createInternalConstraint(SketchPlugin_Sketch *theSketch, AttributePtr thePoint, AttributePtr theBSplinePoles, const int thePoleIndex); - SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline() - : SketchPlugin_SketchEntity(), - myDegree(3), - myIsPeriodic(false) -{ -} + : SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(false) {} SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline(bool isPeriodic) - : SketchPlugin_SketchEntity(), - myDegree(3), - myIsPeriodic(isPeriodic) -{ -} + : SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(isPeriodic) {} -void SketchPlugin_MacroBSpline::initAttributes() -{ +void SketchPlugin_MacroBSpline::initAttributes() { data()->addAttribute(POLES_ID(), GeomDataAPI_Point2DArray::typeId()); data()->addAttribute(WEIGHTS_ID(), ModelAPI_AttributeDoubleArray::typeId()); data()->addAttribute(REF_POLES_ID(), ModelAPI_AttributeRefAttrList::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), REF_POLES_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + REF_POLES_ID()); - data()->addAttribute(CONTROL_POLYGON_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(CONTROL_POLYGON_ID(), + ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId()); } -void SketchPlugin_MacroBSpline::execute() -{ +void SketchPlugin_MacroBSpline::execute() { FeaturePtr aBSpline = createBSplineFeature(); if (boolean(CONTROL_POLYGON_ID())->value()) { @@ -92,20 +84,22 @@ void SketchPlugin_MacroBSpline::execute() } } -FeaturePtr SketchPlugin_MacroBSpline::createBSplineFeature() -{ +FeaturePtr SketchPlugin_MacroBSpline::createBSplineFeature() { if (myKnots.empty() || myMultiplicities.empty()) getAISObject(AISObjectPtr()); // fill B-spline parameters - FeaturePtr aBSpline = sketch()->addFeature( - myIsPeriodic ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID()); + FeaturePtr aBSpline = + sketch()->addFeature(myIsPeriodic ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID()); aBSpline->integer(SketchPlugin_BSplineBase::DEGREE_ID())->setValue(myDegree); - AttributePoint2DArrayPtr aPoles = std::dynamic_pointer_cast( - aBSpline->attribute(SketchPlugin_BSplineBase::POLES_ID())); + AttributePoint2DArrayPtr aPoles = + std::dynamic_pointer_cast( + aBSpline->attribute(SketchPlugin_BSplineBase::POLES_ID())); AttributePoint2DArrayPtr aPolesMacro = - std::dynamic_pointer_cast(attribute(POLES_ID())); + std::dynamic_pointer_cast( + attribute(POLES_ID())); aPoles->assign(aPolesMacro); AttributeDoubleArrayPtr aWeights = @@ -124,7 +118,8 @@ FeaturePtr SketchPlugin_MacroBSpline::createBSplineFeature() for (int index = 0; index < aSize; ++index, ++aKIt) aKnots->setValue(index, *aKIt); - AttributeIntArrayPtr aMults = aBSpline->data()->intArray(SketchPlugin_BSplineBase::MULTS_ID()); + AttributeIntArrayPtr aMults = + aBSpline->data()->intArray(SketchPlugin_BSplineBase::MULTS_ID()); aSize = (int)myMultiplicities.size(); aMults->setSize(aSize); std::list::iterator aMIt = myMultiplicities.begin(); @@ -132,29 +127,30 @@ FeaturePtr SketchPlugin_MacroBSpline::createBSplineFeature() aMults->setValue(index, *aMIt); if (!myIsPeriodic) { - AttributePoint2DPtr aStartPoint = std::dynamic_pointer_cast( - aBSpline->attribute(SketchPlugin_BSpline::START_ID())); + AttributePoint2DPtr aStartPoint = + std::dynamic_pointer_cast( + aBSpline->attribute(SketchPlugin_BSpline::START_ID())); aStartPoint->setValue(aPoles->pnt(0)); - AttributePoint2DPtr aEndPoint = std::dynamic_pointer_cast( - aBSpline->attribute(SketchPlugin_BSpline::END_ID())); + AttributePoint2DPtr aEndPoint = + std::dynamic_pointer_cast( + aBSpline->attribute(SketchPlugin_BSpline::END_ID())); aEndPoint->setValue(aPoles->pnt(aPoles->size() - 1)); } - aBSpline->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue( - boolean(AUXILIARY_ID())->value()); + aBSpline->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->setValue(boolean(AUXILIARY_ID())->value()); aBSpline->execute(); return aBSpline; } -void SketchPlugin_MacroBSpline::createControlPolygon(FeaturePtr theBSpline, - bool thePeriodic, - std::list& thePoles) -{ - AttributePoint2DArrayPtr aPoles = std::dynamic_pointer_cast( - theBSpline->attribute(SketchPlugin_BSpline::POLES_ID())); +void SketchPlugin_MacroBSpline::createControlPolygon( + FeaturePtr theBSpline, bool thePeriodic, std::list &thePoles) { + AttributePoint2DArrayPtr aPoles = + std::dynamic_pointer_cast( + theBSpline->attribute(SketchPlugin_BSpline::POLES_ID())); int aSize = aPoles->size(); // poles for (int index = 0; index < aSize; ++index) @@ -168,41 +164,42 @@ void SketchPlugin_MacroBSpline::createControlPolygon(FeaturePtr theBSpline, } } -void SketchPlugin_MacroBSpline::constraintsForPoles(const std::list& thePoles) -{ +void SketchPlugin_MacroBSpline::constraintsForPoles( + const std::list &thePoles) { AttributeRefAttrListPtr aRefAttrList = data()->refattrlist(REF_POLES_ID()); - std::list > aList; + std::list> aList; if (aRefAttrList) aList = aRefAttrList->list(); - SketchPlugin_Sketch* aSketch = sketch(); + SketchPlugin_Sketch *aSketch = sketch(); - std::list >::iterator aLIt = aList.begin(); + std::list>::iterator aLIt = aList.begin(); std::list::const_iterator aPIt = thePoles.begin(); for (; aLIt != aList.end() && aPIt != thePoles.end(); ++aPIt, ++aLIt) { - // firstly, check the attribute (in this case the object will be not empty too) + // firstly, check the attribute (in this case the object will be not empty + // too) if (aLIt->second) { - SketchPlugin_Tools::createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidence::ID(), + SketchPlugin_Tools::createConstraintAttrAttr( + aSketch, SketchPlugin_ConstraintCoincidence::ID(), (*aPIt)->attribute(SketchPlugin_Point::COORD_ID()), aLIt->second); } // now add coincidence with the result else if (aLIt->first) { - SketchPlugin_Tools::createConstraintAttrObject(aSketch, - SketchPlugin_ConstraintCoincidence::ID(), + SketchPlugin_Tools::createConstraintAttrObject( + aSketch, SketchPlugin_ConstraintCoincidence::ID(), (*aPIt)->attribute(SketchPlugin_Point::COORD_ID()), aLIt->first); } } } -AISObjectPtr SketchPlugin_MacroBSpline::getAISObject(AISObjectPtr thePrevious) -{ - SketchPlugin_Sketch* aSketch = sketch(); +AISObjectPtr SketchPlugin_MacroBSpline::getAISObject(AISObjectPtr thePrevious) { + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch) return AISObjectPtr(); AttributePoint2DArrayPtr aPolesArray = - std::dynamic_pointer_cast(attribute(POLES_ID())); + std::dynamic_pointer_cast( + attribute(POLES_ID())); AttributeDoubleArrayPtr aWeightsArray = data()->realArray(WEIGHTS_ID()); if (aPolesArray->size() < 2) @@ -229,13 +226,14 @@ AISObjectPtr SketchPlugin_MacroBSpline::getAISObject(AISObjectPtr thePrevious) // create result non-periodic B-spline curve std::shared_ptr aBSplineCurve; try { - aBSplineCurve.reset(new GeomAPI_BSpline2d(aPoles2D, aWeights, myIsPeriodic)); + aBSplineCurve.reset( + new GeomAPI_BSpline2d(aPoles2D, aWeights, myIsPeriodic)); } catch (...) { // cannot build a B-spline curve return AISObjectPtr(); } - GeomShapePtr anEdge = - GeomAlgoAPI_EdgeBuilder::bsplineOnPlane(aSketch->coordinatePlane(), aBSplineCurve); + GeomShapePtr anEdge = GeomAlgoAPI_EdgeBuilder::bsplineOnPlane( + aSketch->coordinatePlane(), aBSplineCurve); if (!anEdge) return AISObjectPtr(); @@ -253,26 +251,25 @@ AISObjectPtr SketchPlugin_MacroBSpline::getAISObject(AISObjectPtr thePrevious) anAIS->createShape(aCompound); // Modify attributes - SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, + boolean(AUXILIARY_ID())->value()); return anAIS; } +// ========================== Auxiliary functions +// =========================================== - -// ========================== Auxiliary functions =========================================== - -void SketchPlugin_MacroBSpline::assignDefaultNameForAux(FeaturePtr theAuxFeature, - AttributePoint2DArrayPtr theBSplinePoles, - const int thePoleIndex1, - const int thePoleIndex2) -{ +void SketchPlugin_MacroBSpline::assignDefaultNameForAux( + FeaturePtr theAuxFeature, AttributePoint2DArrayPtr theBSplinePoles, + const int thePoleIndex1, const int thePoleIndex2) { FeaturePtr aBSpline = ModelAPI_Feature::feature(theBSplinePoles->owner()); std::wostringstream aName; aName << aBSpline->name(); if (theAuxFeature->getKind() == SketchPlugin_Point::ID()) - aName << "_" << Locale::Convert::toWString(theBSplinePoles->id()) << "_" << thePoleIndex1; + aName << "_" << Locale::Convert::toWString(theBSplinePoles->id()) << "_" + << thePoleIndex1; else aName << "_segment_" << thePoleIndex1 << "_" << thePoleIndex2; @@ -280,12 +277,11 @@ void SketchPlugin_MacroBSpline::assignDefaultNameForAux(FeaturePtr theAuxFeature theAuxFeature->lastResult()->data()->setName(aName.str()); } -FeaturePtr SketchPlugin_MacroBSpline::createAuxiliaryPole(AttributePoint2DArrayPtr theBSplinePoles, - const int thePoleIndex) -{ +FeaturePtr SketchPlugin_MacroBSpline::createAuxiliaryPole( + AttributePoint2DArrayPtr theBSplinePoles, const int thePoleIndex) { FeaturePtr aBSpline = ModelAPI_Feature::feature(theBSplinePoles->owner()); - SketchPlugin_Sketch* aSketch = + SketchPlugin_Sketch *aSketch = std::dynamic_pointer_cast(aBSpline)->sketch(); // create child point equal to the B-spline's pole @@ -308,13 +304,12 @@ FeaturePtr SketchPlugin_MacroBSpline::createAuxiliaryPole(AttributePoint2DArrayP return aPointFeature; } -void SketchPlugin_MacroBSpline::createAuxiliarySegment(AttributePoint2DArrayPtr theBSplinePoles, - const int thePoleIndex1, - const int thePoleIndex2) -{ +void SketchPlugin_MacroBSpline::createAuxiliarySegment( + AttributePoint2DArrayPtr theBSplinePoles, const int thePoleIndex1, + const int thePoleIndex2) { FeaturePtr aBSpline = ModelAPI_Feature::feature(theBSplinePoles->owner()); - SketchPlugin_Sketch* aSketch = + SketchPlugin_Sketch *aSketch = std::dynamic_pointer_cast(aBSpline)->sketch(); // create child segment between B-spline poles @@ -322,32 +317,36 @@ void SketchPlugin_MacroBSpline::createAuxiliarySegment(AttributePoint2DArrayPtr aLineFeature->boolean(SketchPlugin_Point::AUXILIARY_ID())->setValue(true); aLineFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(aBSpline); - AttributePoint2DPtr aLineStart = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::START_ID())); + AttributePoint2DPtr aLineStart = + std::dynamic_pointer_cast( + aLineFeature->attribute(SketchPlugin_Line::START_ID())); aLineStart->setValue(theBSplinePoles->pnt(thePoleIndex1)); AttributePoint2DPtr aLineEnd = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::END_ID())); + aLineFeature->attribute(SketchPlugin_Line::END_ID())); aLineEnd->setValue(theBSplinePoles->pnt(thePoleIndex2)); aLineFeature->execute(); - assignDefaultNameForAux(aLineFeature, theBSplinePoles, thePoleIndex1, thePoleIndex2); + assignDefaultNameForAux(aLineFeature, theBSplinePoles, thePoleIndex1, + thePoleIndex2); // internal constraints to keep the segment position createInternalConstraint(aSketch, aLineStart, theBSplinePoles, thePoleIndex1); createInternalConstraint(aSketch, aLineEnd, theBSplinePoles, thePoleIndex2); } -void createInternalConstraint(SketchPlugin_Sketch* theSketch, +void createInternalConstraint(SketchPlugin_Sketch *theSketch, AttributePtr thePoint, AttributePtr theBSplinePoles, - const int thePoleIndex) -{ + const int thePoleIndex) { std::shared_ptr aConstraint = std::dynamic_pointer_cast( - theSketch->addFeature(SketchPlugin_ConstraintCoincidenceInternal::ID())); + theSketch->addFeature( + SketchPlugin_ConstraintCoincidenceInternal::ID())); aConstraint->refattr(SketchPlugin_Constraint::ENTITY_A())->setAttr(thePoint); - aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(theBSplinePoles); - aConstraint->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()) + aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()) + ->setAttr(theBSplinePoles); + aConstraint + ->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()) ->setValue(thePoleIndex); } diff --git a/src/SketchPlugin/SketchPlugin_MacroBSpline.h b/src/SketchPlugin/SketchPlugin_MacroBSpline.h index cdb7d8bca..29077972a 100644 --- a/src/SketchPlugin/SketchPlugin_MacroBSpline.h +++ b/src/SketchPlugin/SketchPlugin_MacroBSpline.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MacroBSpline_H_ @@ -38,53 +39,46 @@ class GeomDataAPI_Point2DArray; * \brief Feature for creation of the new B-spline in Sketch. */ class SketchPlugin_MacroBSpline : public SketchPlugin_SketchEntity, - public GeomAPI_IPresentable -{ + public GeomAPI_IPresentable { public: /// B-spline macro feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchMacroBSpline"); return ID; } - /// list of B-spline poles - inline static const std::string& POLES_ID() - { + inline static const std::string &POLES_ID() { static const std::string ID("poles"); return ID; } /// list of references of B-spline poles - inline static const std::string& REF_POLES_ID() - { + inline static const std::string &REF_POLES_ID() { static const std::string ID("poles_ref"); return ID; } /// list of B-spline weights - inline static const std::string& WEIGHTS_ID() - { + inline static const std::string &WEIGHTS_ID() { static const std::string ID("weights"); return ID; } /// flag attribute whether control polygon is need to be created - inline static const std::string& CONTROL_POLYGON_ID() - { + inline static const std::string &CONTROL_POLYGON_ID() { static const std::string ID("need_control_poly"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MacroBSpline::ID(); return MY_KIND; } - /// \brief Request for initialization of data model of the feature: adding all attributes. + /// \brief Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview @@ -95,9 +89,9 @@ public: /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}; + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; /// Use plugin manager for features creation SketchPlugin_MacroBSpline(); @@ -109,25 +103,26 @@ private: FeaturePtr createBSplineFeature(); /// Create control polygon for the B-spline and returns the list of its poles - static void createControlPolygon(FeaturePtr theBSpline, - bool thePeriodic, - std::list& thePoles); + static void createControlPolygon(FeaturePtr theBSpline, bool thePeriodic, + std::list &thePoles); - /// Create additional coincidences if other features were selected while creating the B-spline - void constraintsForPoles(const std::list& thePoles); + /// Create additional coincidences if other features were selected while + /// creating the B-spline + void constraintsForPoles(const std::list &thePoles); /// Create Point feature coincident with the B-spline pole - static FeaturePtr createAuxiliaryPole(std::shared_ptr theBSplinePoles, - const int thePoleIndex); + static FeaturePtr + createAuxiliaryPole(std::shared_ptr theBSplinePoles, + const int thePoleIndex); /// Create segment between consequtive B-spline poles - static void createAuxiliarySegment(std::shared_ptr theBSplinePoles, - const int thePoleIndex1, - const int thePoleIndex2); + static void createAuxiliarySegment( + std::shared_ptr theBSplinePoles, + const int thePoleIndex1, const int thePoleIndex2); /// Set name of auxiliary feature representing the control polygon - static void assignDefaultNameForAux(FeaturePtr theAuxFeature, - std::shared_ptr theBSplinePoles, - const int thePoleIndex1, - const int thePoleIndex2 = -1); + static void assignDefaultNameForAux( + FeaturePtr theAuxFeature, + std::shared_ptr theBSplinePoles, + const int thePoleIndex1, const int thePoleIndex2 = -1); friend class SketchPlugin_BSplineBase; friend class SketchPlugin_CurveFitting; @@ -138,24 +133,20 @@ private: bool myIsPeriodic; }; - /**\class SketchPlugin_MacroBSplinePeriodic -* \ingroup Plugins -* \brief Feature for creation of the new periodic B-spline in Sketch. -*/ -class SketchPlugin_MacroBSplinePeriodic : public SketchPlugin_MacroBSpline -{ + * \ingroup Plugins + * \brief Feature for creation of the new periodic B-spline in Sketch. + */ +class SketchPlugin_MacroBSplinePeriodic : public SketchPlugin_MacroBSpline { public: /// B-spline macro feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchMacroBSplinePeriodic"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { return SketchPlugin_MacroBSplinePeriodic::ID(); } diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp index 2725d0be9..32a05bdf4 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_MacroCircle.h" #include "SketchPlugin_Circle.h" +#include "SketchPlugin_MacroArcReentrantMessage.h" #include "SketchPlugin_Point.h" #include "SketchPlugin_Tools.h" -#include "SketchPlugin_MacroArcReentrantMessage.h" #include #include #include +#include #include #include -#include #include #include @@ -43,62 +44,68 @@ #include #include - const double tolerance = 1e-7; namespace { - static const std::string& POINT_ID(int theIndex) - { - switch (theIndex) { - case 1: return SketchPlugin_MacroCircle::FIRST_POINT_ID(); - case 2: return SketchPlugin_MacroCircle::SECOND_POINT_ID(); - case 3: return SketchPlugin_MacroCircle::THIRD_POINT_ID(); - } - - static const std::string DUMMY; - return DUMMY; +static const std::string &POINT_ID(int theIndex) { + switch (theIndex) { + case 1: + return SketchPlugin_MacroCircle::FIRST_POINT_ID(); + case 2: + return SketchPlugin_MacroCircle::SECOND_POINT_ID(); + case 3: + return SketchPlugin_MacroCircle::THIRD_POINT_ID(); } -} + static const std::string DUMMY; + return DUMMY; +} +} // namespace SketchPlugin_MacroCircle::SketchPlugin_MacroCircle() -: SketchPlugin_SketchEntity(), - myRadius(0.0) -{ -} + : SketchPlugin_SketchEntity(), myRadius(0.0) {} -void SketchPlugin_MacroCircle::initAttributes() -{ +void SketchPlugin_MacroCircle::initAttributes() { data()->addAttribute(CIRCLE_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(EDIT_CIRCLE_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(CENTER_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(CENTER_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(CENTER_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(PASSED_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(PASSED_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(FIRST_POINT_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(SECOND_POINT_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(THIRD_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(FIRST_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SECOND_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(THIRD_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(FIRST_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SECOND_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(THIRD_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(CIRCLE_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId()); string(EDIT_CIRCLE_TYPE())->setValue(""); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FIRST_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SECOND_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), THIRD_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EDIT_CIRCLE_TYPE()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), CENTER_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PASSED_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), FIRST_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SECOND_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), THIRD_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), EDIT_CIRCLE_TYPE()); } -void SketchPlugin_MacroCircle::execute() -{ +void SketchPlugin_MacroCircle::execute() { FeaturePtr aCircle = createCircleFeature(); std::string aType = string(CIRCLE_TYPE())->value(); @@ -109,8 +116,9 @@ void SketchPlugin_MacroCircle::execute() // message to init reentrant operation static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new SketchPlugin_MacroArcReentrantMessage(anId, this)); + std::shared_ptr aMessage = + std::shared_ptr( + new SketchPlugin_MacroArcReentrantMessage(anId, this)); std::string anEditType = string(EDIT_CIRCLE_TYPE())->value(); aMessage->setTypeOfCreation(!anEditType.empty() ? anEditType : aType); @@ -120,11 +128,11 @@ void SketchPlugin_MacroCircle::execute() // LCOV_EXCL_START std::string SketchPlugin_MacroCircle::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::string aFilledAttributeName; std::shared_ptr aReentrantMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast( + theMessage); if (aReentrantMessage.get()) { std::string aCircleType = aReentrantMessage->typeOfCreation(); @@ -133,28 +141,31 @@ std::string SketchPlugin_MacroCircle::processEvent( aFilledAttributeName = CIRCLE_TYPE(); ObjectPtr anObject = aReentrantMessage->selectedObject(); AttributePtr anAttribute = aReentrantMessage->selectedAttribute(); - std::shared_ptr aClickedPoint = aReentrantMessage->clickedPoint(); + std::shared_ptr aClickedPoint = + aReentrantMessage->clickedPoint(); if (aClickedPoint.get() && (anObject.get() || anAttribute.get())) { std::string aReferenceAttributeName; if (aCircleType == CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS()) { aFilledAttributeName = CENTER_POINT_ID(); aReferenceAttributeName = CENTER_POINT_REF_ID(); - } - else { + } else { aFilledAttributeName = FIRST_POINT_ID(); aReferenceAttributeName = FIRST_POINT_REF_ID(); } // fill 2d point attribute - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast( - attribute(aFilledAttributeName)); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast( + attribute(aFilledAttributeName)); aPointAttr->setValue(aClickedPoint); // fill reference attribute - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - attribute(aReferenceAttributeName)); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + attribute(aReferenceAttributeName)); if (aRefAttr.get()) { if (anAttribute.get()) { - if (!anAttribute->owner().get() || !anAttribute->owner()->data()->isValid()) { + if (!anAttribute->owner().get() || + !anAttribute->owner()->data()->isValid()) { FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature(); if (aCreatedFeature.get()) { std::string anID = anAttribute->id(); @@ -165,11 +176,10 @@ std::string SketchPlugin_MacroCircle::processEvent( } } aRefAttr->setAttr(anAttribute); - } - else if (anObject.get()) { - // if attribute is NULL, only object is defined, it should be processed outside - // the feature because it might be an external feature, that will be - // removed/created again after restart operation + } else if (anObject.get()) { + // if attribute is NULL, only object is defined, it should be + // processed outside the feature because it might be an external + // feature, that will be removed/created again after restart operation // #2468 - Crash when sketching circles successively on a repetition aFilledAttributeName = CIRCLE_TYPE(); } @@ -181,8 +191,8 @@ std::string SketchPlugin_MacroCircle::processEvent( } // LCOV_EXCL_STOP -void SketchPlugin_MacroCircle::constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature) -{ +void SketchPlugin_MacroCircle::constraintsForCircleByCenterAndPassed( + FeaturePtr theCircleFeature) { // Create constraints. SketchPlugin_Tools::createCoincidenceOrTangency( this, CENTER_POINT_REF_ID(), @@ -193,11 +203,10 @@ void SketchPlugin_MacroCircle::constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature->lastResult(), true); } -void SketchPlugin_MacroCircle::constraintsForCircleByThreePoints(FeaturePtr theCircleFeature) -{ - std::string aPointRef[3] = { FIRST_POINT_REF_ID(), - SECOND_POINT_REF_ID(), - THIRD_POINT_REF_ID() }; +void SketchPlugin_MacroCircle::constraintsForCircleByThreePoints( + FeaturePtr theCircleFeature) { + std::string aPointRef[3] = {FIRST_POINT_REF_ID(), SECOND_POINT_REF_ID(), + THIRD_POINT_REF_ID()}; // Create constraints. ResultPtr aCircleResult = theCircleFeature->lastResult(); @@ -207,21 +216,19 @@ void SketchPlugin_MacroCircle::constraintsForCircleByThreePoints(FeaturePtr theC } } -FeaturePtr SketchPlugin_MacroCircle::createCircleFeature() -{ +FeaturePtr SketchPlugin_MacroCircle::createCircleFeature() { FeaturePtr aCircleFeature = sketch()->addFeature(SketchPlugin_Circle::ID()); std::dynamic_pointer_cast( - aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->setValue(myCenter->x(), - myCenter->y()); + aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID())) + ->setValue(myCenter->x(), myCenter->y()); aCircleFeature->real(SketchPlugin_Circle::RADIUS_ID())->setValue(myRadius); aCircleFeature->boolean(SketchPlugin_Circle::AUXILIARY_ID()) - ->setValue(boolean(AUXILIARY_ID())->value()); + ->setValue(boolean(AUXILIARY_ID())->value()); aCircleFeature->execute(); return aCircleFeature; } -void SketchPlugin_MacroCircle::fillByCenterAndPassed() -{ +void SketchPlugin_MacroCircle::fillByCenterAndPassed() { AttributePtr aCenterAttr = attribute(CENTER_POINT_ID()); AttributePtr aPassedAttr = attribute(PASSED_POINT_ID()); if (!aCenterAttr->isInitialized() || !aPassedAttr->isInitialized()) @@ -234,7 +241,8 @@ void SketchPlugin_MacroCircle::fillByCenterAndPassed() SketchPlugin_Tools::convertRefAttrToPointOrTangentCurve( aCenterRef, aCenterAttr, aCurve, aCenter); if (!aCenter) - aCenter = std::dynamic_pointer_cast(aCenterAttr)->pnt(); + aCenter = + std::dynamic_pointer_cast(aCenterAttr)->pnt(); AttributeRefAttrPtr aPassedRef = refattr(PASSED_POINT_REF_ID()); std::shared_ptr aPassedPoint; std::shared_ptr aTangentCurve; @@ -261,14 +269,11 @@ void SketchPlugin_MacroCircle::fillByCenterAndPassed() } } -void SketchPlugin_MacroCircle::fillByThreePoints() -{ - std::string aPointAttr[3] = { FIRST_POINT_ID(), - SECOND_POINT_ID(), - THIRD_POINT_ID() }; - std::string aPointRef[3] = { FIRST_POINT_REF_ID(), - SECOND_POINT_REF_ID(), - THIRD_POINT_REF_ID() }; +void SketchPlugin_MacroCircle::fillByThreePoints() { + std::string aPointAttr[3] = {FIRST_POINT_ID(), SECOND_POINT_ID(), + THIRD_POINT_ID()}; + std::string aPointRef[3] = {FIRST_POINT_REF_ID(), SECOND_POINT_REF_ID(), + THIRD_POINT_REF_ID()}; GeomAlgoAPI_Circ2dBuilder aCircBuilder(SketchPlugin_Sketch::plane(sketch())); @@ -302,16 +307,14 @@ void SketchPlugin_MacroCircle::fillByThreePoints() } } -void SketchPlugin_MacroCircle::fillByTwoPassedPoints() -{ - std::string aPointAttr[2] = { FIRST_POINT_ID(), - SECOND_POINT_ID() }; - std::string aPointRef[2] = { FIRST_POINT_REF_ID(), - SECOND_POINT_REF_ID() }; +void SketchPlugin_MacroCircle::fillByTwoPassedPoints() { + std::string aPointAttr[2] = {FIRST_POINT_ID(), SECOND_POINT_ID()}; + std::string aPointRef[2] = {FIRST_POINT_REF_ID(), SECOND_POINT_REF_ID()}; GeomAlgoAPI_Circ2dBuilder aCircBuilder(SketchPlugin_Sketch::plane(sketch())); - std::shared_ptr aPassedPoints[2]; // there is possible only two passed points + std::shared_ptr + aPassedPoints[2]; // there is possible only two passed points bool hasTangentCurve = false; int aPntIndex = 0; for (; aPntIndex < 2; ++aPntIndex) { @@ -350,7 +353,8 @@ void SketchPlugin_MacroCircle::fillByTwoPassedPoints() std::shared_ptr aCenter(new GeomAPI_Pnt2d( (aPassedPoints[0]->x() + aPassedPoints[1]->x()) * 0.5, (aPassedPoints[0]->y() + aPassedPoints[1]->y()) * 0.5)); - aCircle = std::shared_ptr(new GeomAPI_Circ2d(aCenter, aPassedPoints[0])); + aCircle = std::shared_ptr( + new GeomAPI_Circ2d(aCenter, aPassedPoints[0])); } if (aCircle) { @@ -359,45 +363,48 @@ void SketchPlugin_MacroCircle::fillByTwoPassedPoints() } } -AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious) -{ - SketchPlugin_Sketch* aSketch = sketch(); - if(!aSketch || !myCenter || myRadius == 0) { +AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious) { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch || !myCenter || myRadius == 0) { return AISObjectPtr(); } // Compute a circle in 3D view. - std::shared_ptr aCenter(aSketch->to3D(myCenter->x(), myCenter->y())); + std::shared_ptr aCenter( + aSketch->to3D(myCenter->x(), myCenter->y())); std::shared_ptr aNDir = std::dynamic_pointer_cast( aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); std::shared_ptr aNormal = aNDir->dir(); - GeomShapePtr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, myRadius); + GeomShapePtr aCircleShape = + GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, myRadius); GeomShapePtr aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter); - if(!aCircleShape.get() || !aCenterPointShape.get()) { + if (!aCircleShape.get() || !aCenterPointShape.get()) { return AISObjectPtr(); } - std::list > aShapes; + std::list> aShapes; aShapes.push_back(aCircleShape); aShapes.push_back(aCenterPointShape); - std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); + std::shared_ptr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aShapes); AISObjectPtr anAIS = thePrevious; - if(!anAIS.get()) { + if (!anAIS.get()) { anAIS.reset(new GeomAPI_AISObject()); } anAIS->createShape(aCompound); // Modify attributes - SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, + boolean(AUXILIARY_ID())->value()); return anAIS; } -void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) { +void SketchPlugin_MacroCircle::attributeChanged(const std::string &theID) { // If circle type switched reset all attributes. - if(theID == CIRCLE_TYPE()) { + if (theID == CIRCLE_TYPE()) { SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_ID()); SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_REF_ID()); SketchPlugin_Tools::resetAttribute(this, PASSED_POINT_ID()); @@ -408,24 +415,25 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) { SketchPlugin_Tools::resetAttribute(this, SECOND_POINT_REF_ID()); SketchPlugin_Tools::resetAttribute(this, THIRD_POINT_ID()); SketchPlugin_Tools::resetAttribute(this, THIRD_POINT_REF_ID()); - } else if(theID == CENTER_POINT_ID() || theID == PASSED_POINT_ID() || - theID == CENTER_POINT_REF_ID() || theID == PASSED_POINT_REF_ID()) + } else if (theID == CENTER_POINT_ID() || theID == PASSED_POINT_ID() || + theID == CENTER_POINT_REF_ID() || theID == PASSED_POINT_REF_ID()) fillByCenterAndPassed(); - else if(theID == FIRST_POINT_ID() || theID == FIRST_POINT_REF_ID() || - theID == SECOND_POINT_ID() || theID == SECOND_POINT_REF_ID() || - theID == THIRD_POINT_ID() || theID == THIRD_POINT_REF_ID()) { + else if (theID == FIRST_POINT_ID() || theID == FIRST_POINT_REF_ID() || + theID == SECOND_POINT_ID() || theID == SECOND_POINT_REF_ID() || + theID == THIRD_POINT_ID() || theID == THIRD_POINT_REF_ID()) { std::shared_ptr aPoints[3]; int aNbInitialized = 0; - for(int i = 1; i <= 3; ++i) { + for (int i = 1; i <= 3; ++i) { std::shared_ptr aCurPnt = - std::dynamic_pointer_cast(attribute(POINT_ID(i))); - if(aCurPnt->isInitialized()) + std::dynamic_pointer_cast( + attribute(POINT_ID(i))); + if (aCurPnt->isInitialized()) aPoints[aNbInitialized++] = aCurPnt->pnt(); } - if(aNbInitialized == 1) + if (aNbInitialized == 1) return; - else if(aNbInitialized == 2) + else if (aNbInitialized == 2) fillByTwoPassedPoints(); else fillByThreePoints(); @@ -433,8 +441,9 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) { AttributeDoublePtr aRadiusAttr = real(CIRCLE_RADIUS_ID()); bool aWasBlocked = data()->blockSendAttributeUpdated(true); - if(myCenter.get()) { - // center attribute is used in processEvent() to set reference to reentrant arc + if (myCenter.get()) { + // center attribute is used in processEvent() to set reference to reentrant + // arc std::dynamic_pointer_cast(attribute(CENTER_POINT_ID())) ->setValue(myCenter); } diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.h b/src/SketchPlugin/SketchPlugin_MacroCircle.h index c810eb061..2e90290ca 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.h +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MacroCircle_H_ @@ -35,133 +36,116 @@ class GeomAPI_Pnt2d; * \ingroup Plugins * \brief Feature for creation of the new circle in Sketch. */ -class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, - public GeomAPI_IPresentable, - public ModelAPI_IReentrant -{ - public: +class SketchPlugin_MacroCircle : public SketchPlugin_SketchEntity, + public GeomAPI_IPresentable, + public ModelAPI_IReentrant { +public: /// Circle feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchMacroCircle"); return ID; } - inline static const std::string& CIRCLE_TYPE() - { + inline static const std::string &CIRCLE_TYPE() { static const std::string ID("circle_type"); return ID; } - inline static const std::string& EDIT_CIRCLE_TYPE() - { + inline static const std::string &EDIT_CIRCLE_TYPE() { static const std::string ID("edit_circle_type"); return ID; } /// Creation method by center and passed point. - inline static const std::string& CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS() - { + inline static const std::string &CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS() { static const std::string ID("circle_type_by_center_and_passed_points"); return ID; } /// Creation method by three points. - inline static const std::string& CIRCLE_TYPE_BY_THREE_POINTS() - { + inline static const std::string &CIRCLE_TYPE_BY_THREE_POINTS() { static const std::string ID("circle_type_by_three_points"); return ID; } /// 2D point - center of the circle. - inline static const std::string& CENTER_POINT_ID() - { + inline static const std::string &CENTER_POINT_ID() { static const std::string ID("center_point"); return ID; } /// Reference for center point selection. - inline static const std::string& CENTER_POINT_REF_ID() - { + inline static const std::string &CENTER_POINT_REF_ID() { static const std::string ID("center_point_ref"); return ID; } /// 2D point - passed point of the circle - inline static const std::string& PASSED_POINT_ID() - { + inline static const std::string &PASSED_POINT_ID() { static const std::string ID("passed_point"); return ID; } /// Reference for passed point selection. - inline static const std::string& PASSED_POINT_REF_ID() - { + inline static const std::string &PASSED_POINT_REF_ID() { static const std::string ID("passed_point_ref"); return ID; } /// First point id. - inline static const std::string& FIRST_POINT_ID() - { + inline static const std::string &FIRST_POINT_ID() { static const std::string ID("first_point"); return ID; } /// Reference for first point selection. - inline static const std::string& FIRST_POINT_REF_ID() - { + inline static const std::string &FIRST_POINT_REF_ID() { static const std::string ID("first_point_ref"); return ID; } /// Second point id. - inline static const std::string& SECOND_POINT_ID() - { + inline static const std::string &SECOND_POINT_ID() { static const std::string ID("second_point"); return ID; } /// Reference for second point selection. - inline static const std::string& SECOND_POINT_REF_ID() - { + inline static const std::string &SECOND_POINT_REF_ID() { static const std::string ID("second_point_ref"); return ID; } /// Third point id. - inline static const std::string& THIRD_POINT_ID() - { + inline static const std::string &THIRD_POINT_ID() { static const std::string ID("third_point"); return ID; } /// Reference for third point selection. - inline static const std::string& THIRD_POINT_REF_ID() - { + inline static const std::string &THIRD_POINT_REF_ID() { static const std::string ID("third_point_ref"); return ID; } /// Radius of the circle - inline static const std::string& CIRCLE_RADIUS_ID() - { + inline static const std::string &CIRCLE_RADIUS_ID() { static const std::string ID("circle_radius"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MacroCircle::ID(); return MY_KIND; } - /// \brief Request for initialization of data model of the feature: adding all attributes. + /// \brief Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); @@ -171,13 +155,14 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}; + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; - /// Apply information of the message to current object. It fills reference object, - /// tangent type and tangent point refence in case of tangent arc - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills reference + /// object, tangent type and tangent point refence in case of tangent arc + virtual std::string + processEvent(const std::shared_ptr &theMessage); /// Use plugin manager for features creation SketchPlugin_MacroCircle(); @@ -195,7 +180,7 @@ private: private: std::shared_ptr myCenter; - double myRadius; + double myRadius; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp b/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp index f5027fb3b..3c94718f4 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -24,15 +25,15 @@ #include #include #include -#include #include +#include #include #include #include +#include #include #include -#include #include @@ -47,30 +48,31 @@ static const double TOLERANCE = 1.e-7; SketchPlugin_MacroEllipse::SketchPlugin_MacroEllipse() -: SketchPlugin_SketchEntity(), - myMajorRadius(0.0), - myMinorRadius(0.0) -{ -} + : SketchPlugin_SketchEntity(), myMajorRadius(0.0), myMinorRadius(0.0) {} -void SketchPlugin_MacroEllipse::initAttributes() -{ +void SketchPlugin_MacroEllipse::initAttributes() { data()->addAttribute(ELLIPSE_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(EDIT_ELLIPSE_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(CENTER_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(CENTER_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(CENTER_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(MAJOR_AXIS_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(MAJOR_AXIS_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(MAJOR_AXIS_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(PASSED_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(PASSED_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(MAJOR_AXIS_START_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(MAJOR_AXIS_START_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(MAJOR_AXIS_START_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(MAJOR_AXIS_END_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(MAJOR_AXIS_END_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(MAJOR_AXIS_END_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(PASSED_POINT_1_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(PASSED_POINT_1_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(PASSED_POINT_1_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(MAJOR_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(MINOR_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); @@ -78,19 +80,23 @@ void SketchPlugin_MacroEllipse::initAttributes() string(EDIT_ELLIPSE_TYPE())->setValue(""); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), CENTER_POINT_REF_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( getKind(), MAJOR_AXIS_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PASSED_POINT_REF_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory( getKind(), MAJOR_AXIS_START_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_END_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_1_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EDIT_ELLIPSE_TYPE()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_AXIS_END_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PASSED_POINT_1_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), EDIT_ELLIPSE_TYPE()); } -void SketchPlugin_MacroEllipse::execute() -{ +void SketchPlugin_MacroEllipse::execute() { FeaturePtr anEllipse = createEllipseFeature(); std::string aType = string(ELLIPSE_TYPE())->value(); @@ -101,8 +107,9 @@ void SketchPlugin_MacroEllipse::execute() // message to init reentrant operation static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new SketchPlugin_MacroArcReentrantMessage(anId, this)); + std::shared_ptr aMessage = + std::shared_ptr( + new SketchPlugin_MacroArcReentrantMessage(anId, this)); std::string anEditType = string(EDIT_ELLIPSE_TYPE())->value(); aMessage->setTypeOfCreation(!anEditType.empty() ? anEditType : aType); @@ -110,8 +117,7 @@ void SketchPlugin_MacroEllipse::execute() Events_Loop::loop()->send(aMessage); } -void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) -{ +void SketchPlugin_MacroEllipse::attributeChanged(const std::string &theID) { static const int NB_POINTS = 3; std::string aPointAttrName[NB_POINTS]; std::string aPointRefName[NB_POINTS]; @@ -122,15 +128,15 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) aPointRefName[0] = CENTER_POINT_REF_ID(); aPointRefName[1] = MAJOR_AXIS_POINT_REF_ID(); aPointRefName[2] = PASSED_POINT_REF_ID(); - } else if (string(ELLIPSE_TYPE())->value() == ELLIPSE_TYPE_BY_AXIS_AND_POINT()) { + } else if (string(ELLIPSE_TYPE())->value() == + ELLIPSE_TYPE_BY_AXIS_AND_POINT()) { aPointAttrName[0] = MAJOR_AXIS_START_ID(); aPointAttrName[1] = MAJOR_AXIS_END_ID(); aPointAttrName[2] = PASSED_POINT_1_ID(); aPointRefName[0] = MAJOR_AXIS_START_REF_ID(); aPointRefName[1] = MAJOR_AXIS_END_REF_ID(); aPointRefName[2] = PASSED_POINT_1_REF_ID(); - } - else + } else return; // type of ellipse switched, thus reset all attributes @@ -139,8 +145,7 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) SketchPlugin_Tools::resetAttribute(this, aPointAttrName[aPntIndex]); SketchPlugin_Tools::resetAttribute(this, aPointRefName[aPntIndex]); } - } - else { + } else { int aNbInitialized = 0; GeomPnt2dPtr anEllipsePoints[NB_POINTS]; @@ -155,7 +160,7 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) std::dynamic_pointer_cast(aPointAttr)->pnt(); GeomShapePtr aTangentCurve; SketchPlugin_Tools::convertRefAttrToPointOrTangentCurve( - aPointRef, aPointAttr, aTangentCurve, aPassedPoint); + aPointRef, aPointAttr, aTangentCurve, aPassedPoint); anEllipsePoints[aNbInitialized++] = aPassedPoint; } @@ -166,8 +171,10 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) if (string(ELLIPSE_TYPE())->value() == ELLIPSE_TYPE_BY_AXIS_AND_POINT()) { // ellipse is given by major axis and passing point, // recalculate the first point to be a center - anEllipsePoints[0]->setX(0.5 * (anEllipsePoints[0]->x() + anEllipsePoints[1]->x())); - anEllipsePoints[0]->setY(0.5 * (anEllipsePoints[0]->y() + anEllipsePoints[1]->y())); + anEllipsePoints[0]->setX( + 0.5 * (anEllipsePoints[0]->x() + anEllipsePoints[1]->x())); + anEllipsePoints[0]->setY( + 0.5 * (anEllipsePoints[0]->y() + anEllipsePoints[1]->y())); } if (anEllipsePoints[0]->distance(anEllipsePoints[1]) < TOLERANCE) @@ -175,15 +182,15 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) std::shared_ptr anEllipse; if (aNbInitialized == 2) { - GeomDir2dPtr aXDir(new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(), - anEllipsePoints[1]->y() - anEllipsePoints[0]->y())); + GeomDir2dPtr aXDir( + new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(), + anEllipsePoints[1]->y() - anEllipsePoints[0]->y())); double aMajorRad = anEllipsePoints[1]->distance(anEllipsePoints[0]); - anEllipse = std::shared_ptr( - new GeomAPI_Ellipse2d(anEllipsePoints[0], aXDir, aMajorRad, 0.5 * aMajorRad)); - } - else if (aNbInitialized == 3) { - anEllipse = std::shared_ptr( - new GeomAPI_Ellipse2d(anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2])); + anEllipse = std::shared_ptr(new GeomAPI_Ellipse2d( + anEllipsePoints[0], aXDir, aMajorRad, 0.5 * aMajorRad)); + } else if (aNbInitialized == 3) { + anEllipse = std::shared_ptr(new GeomAPI_Ellipse2d( + anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2])); } if (!anEllipse || anEllipse->implPtr() == 0) @@ -206,12 +213,12 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) // LCOV_EXCL_START std::string SketchPlugin_MacroEllipse::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::string aFilledAttributeName; std::shared_ptr aReentrantMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast( + theMessage); if (aReentrantMessage) { FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature(); std::string anEllipseType = aReentrantMessage->typeOfCreation(); @@ -221,7 +228,8 @@ std::string SketchPlugin_MacroEllipse::processEvent( aFilledAttributeName = ELLIPSE_TYPE(); ObjectPtr anObject = aReentrantMessage->selectedObject(); AttributePtr anAttribute = aReentrantMessage->selectedAttribute(); - std::shared_ptr aClickedPoint = aReentrantMessage->clickedPoint(); + std::shared_ptr aClickedPoint = + aReentrantMessage->clickedPoint(); if (aClickedPoint && (anObject || anAttribute)) { aFilledAttributeName = CENTER_POINT_ID(); @@ -233,27 +241,28 @@ std::string SketchPlugin_MacroEllipse::processEvent( // fill 2d point attribute AttributePoint2DPtr aPointAttr = - std::dynamic_pointer_cast(attribute(aFilledAttributeName)); + std::dynamic_pointer_cast( + attribute(aFilledAttributeName)); aPointAttr->setValue(aClickedPoint); // fill reference attribute AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(attribute(aReferenceAttributeName)); + std::dynamic_pointer_cast( + attribute(aReferenceAttributeName)); if (anAttribute) { if (!anAttribute->owner() || !anAttribute->owner()->data()->isValid()) { if (aCreatedFeature && anAttribute->id() == CENTER_POINT_ID()) anAttribute = aCreatedFeature->attribute( - anEllipseType == ELLIPSE_TYPE_BY_CENTER_AXIS_POINT() ? - SketchPlugin_Ellipse::CENTER_ID() : - SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()); + anEllipseType == ELLIPSE_TYPE_BY_CENTER_AXIS_POINT() + ? SketchPlugin_Ellipse::CENTER_ID() + : SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()); } aRefAttr->setAttr(anAttribute); - } - else if (anObject.get()) { - // if attribute is NULL, only object is defined, it should be processed outside - // the feature because it might be an external feature, that will be - // removed/created again after restart operation - // #2468 - Crash when sketching circles successively on a repetition + } else if (anObject.get()) { + // if attribute is NULL, only object is defined, it should be processed + // outside the feature because it might be an external feature, that + // will be removed/created again after restart operation #2468 - Crash + // when sketching circles successively on a repetition aFilledAttributeName = ELLIPSE_TYPE(); } } @@ -264,8 +273,7 @@ std::string SketchPlugin_MacroEllipse::processEvent( // LCOV_EXCL_STOP void SketchPlugin_MacroEllipse::constraintsForEllipseByCenterAxisAndPassed( - FeaturePtr theEllipseFeature) -{ + FeaturePtr theEllipseFeature) { // tangency on-the-fly is not applicable for ellipses static const bool isTangencyApplicable = false; // Create constraints. @@ -277,7 +285,8 @@ void SketchPlugin_MacroEllipse::constraintsForEllipseByCenterAxisAndPassed( this, MAJOR_AXIS_POINT_REF_ID(), theEllipseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()), ObjectPtr(), isTangencyApplicable); - // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an object + // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an + // object if (!refattr(PASSED_POINT_REF_ID())->isObject()) { SketchPlugin_Tools::createCoincidenceOrTangency( this, PASSED_POINT_REF_ID(), AttributePtr(), @@ -286,8 +295,7 @@ void SketchPlugin_MacroEllipse::constraintsForEllipseByCenterAxisAndPassed( } void SketchPlugin_MacroEllipse::constraintsForEllipseByMajoxAxisAndPassed( - FeaturePtr theEllipseFeature) -{ + FeaturePtr theEllipseFeature) { // tangency on-the-fly is not applicable for ellipses static const bool isTangencyApplicable = false; // Create constraints. @@ -299,7 +307,8 @@ void SketchPlugin_MacroEllipse::constraintsForEllipseByMajoxAxisAndPassed( this, MAJOR_AXIS_END_REF_ID(), theEllipseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()), ObjectPtr(), isTangencyApplicable); - // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an object + // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an + // object if (!refattr(PASSED_POINT_1_REF_ID())->isObject()) { SketchPlugin_Tools::createCoincidenceOrTangency( this, PASSED_POINT_1_REF_ID(), AttributePtr(), @@ -307,23 +316,26 @@ void SketchPlugin_MacroEllipse::constraintsForEllipseByMajoxAxisAndPassed( } } -FeaturePtr SketchPlugin_MacroEllipse::createEllipseFeature() -{ +FeaturePtr SketchPlugin_MacroEllipse::createEllipseFeature() { FeaturePtr aEllipseFeature = sketch()->addFeature(SketchPlugin_Ellipse::ID()); - AttributePoint2DPtr aCenterAttr = std::dynamic_pointer_cast( - aEllipseFeature->attribute(SketchPlugin_Ellipse::CENTER_ID())); + AttributePoint2DPtr aCenterAttr = + std::dynamic_pointer_cast( + aEllipseFeature->attribute(SketchPlugin_Ellipse::CENTER_ID())); aCenterAttr->setValue(myCenter->x(), myCenter->y()); - AttributePoint2DPtr aFocusAttr = std::dynamic_pointer_cast( - aEllipseFeature->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID())); + AttributePoint2DPtr aFocusAttr = + std::dynamic_pointer_cast( + aEllipseFeature->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID())); aFocusAttr->setValue(myFocus->x(), myFocus->y()); - aEllipseFeature->real(SketchPlugin_Ellipse::MAJOR_RADIUS_ID())->setValue(myMajorRadius); - aEllipseFeature->real(SketchPlugin_Ellipse::MINOR_RADIUS_ID())->setValue(myMinorRadius); + aEllipseFeature->real(SketchPlugin_Ellipse::MAJOR_RADIUS_ID()) + ->setValue(myMajorRadius); + aEllipseFeature->real(SketchPlugin_Ellipse::MINOR_RADIUS_ID()) + ->setValue(myMinorRadius); - aEllipseFeature->boolean(SketchPlugin_Ellipse::AUXILIARY_ID())->setValue( - boolean(AUXILIARY_ID())->value()); + aEllipseFeature->boolean(SketchPlugin_Ellipse::AUXILIARY_ID()) + ->setValue(boolean(AUXILIARY_ID())->value()); aEllipseFeature->execute(); @@ -343,50 +355,54 @@ FeaturePtr SketchPlugin_MacroEllipse::createEllipseFeature() SketchPlugin_Tools::createAuxiliaryPointOnEllipse( aEllipseFeature, SketchPlugin_Ellipse::MINOR_AXIS_END_ID()); // create auxiliary axes - SketchPlugin_Tools::createAuxiliaryAxisOfEllipse(aEllipseFeature, - SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), - SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()); - SketchPlugin_Tools::createAuxiliaryAxisOfEllipse(aEllipseFeature, - SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), - SketchPlugin_Ellipse::MINOR_AXIS_END_ID()); + SketchPlugin_Tools::createAuxiliaryAxisOfEllipse( + aEllipseFeature, SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(), + SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()); + SketchPlugin_Tools::createAuxiliaryAxisOfEllipse( + aEllipseFeature, SketchPlugin_Ellipse::MINOR_AXIS_START_ID(), + SketchPlugin_Ellipse::MINOR_AXIS_END_ID()); return aEllipseFeature; } -AISObjectPtr SketchPlugin_MacroEllipse::getAISObject(AISObjectPtr thePrevious) -{ - SketchPlugin_Sketch* aSketch = sketch(); +AISObjectPtr SketchPlugin_MacroEllipse::getAISObject(AISObjectPtr thePrevious) { + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch || !myCenter || myMajorRadius == 0) return AISObjectPtr(); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); // Compute a ellipse in 3D view. GeomPointPtr aCenter(aSketch->to3D(myCenter->x(), myCenter->y())); GeomPointPtr aFocus(aSketch->to3D(myFocus->x(), myFocus->y())); GeomDirPtr aNormal = aNDir->dir(); GeomDirPtr aMajorAxis(new GeomAPI_Dir(aFocus->x() - aCenter->x(), - aFocus->y() - aCenter->y(), aFocus->z() - aCenter->z())); + aFocus->y() - aCenter->y(), + aFocus->z() - aCenter->z())); std::shared_ptr anEllipseShape = - GeomAlgoAPI_EdgeBuilder::ellipse(aCenter, aNormal, aMajorAxis, myMajorRadius, myMinorRadius); + GeomAlgoAPI_EdgeBuilder::ellipse(aCenter, aNormal, aMajorAxis, + myMajorRadius, myMinorRadius); GeomShapePtr aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter); if (!anEllipseShape.get() || !aCenterPointShape.get()) return AISObjectPtr(); - std::list > aShapes; + std::list> aShapes; aShapes.push_back(anEllipseShape); aShapes.push_back(aCenterPointShape); - std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); + std::shared_ptr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aShapes); AISObjectPtr anAIS = thePrevious; if (!anAIS) anAIS.reset(new GeomAPI_AISObject()); anAIS->createShape(aCompound); // Modify attributes - SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, + boolean(AUXILIARY_ID())->value()); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipse.h b/src/SketchPlugin/SketchPlugin_MacroEllipse.h index 1a6bd9efe..a37165535 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipse.h +++ b/src/SketchPlugin/SketchPlugin_MacroEllipse.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MacroEllipse_H_ #define SketchPlugin_MacroEllipse_H_ +#include #include #include #include -#include class GeomAPI_Pnt2d; @@ -31,151 +32,131 @@ class GeomAPI_Pnt2d; * \ingroup Plugins * \brief Feature for creation of the new ellipse in Sketch. */ -class SketchPlugin_MacroEllipse: public SketchPlugin_SketchEntity, - public GeomAPI_IPresentable, - public ModelAPI_IReentrant -{ - public: +class SketchPlugin_MacroEllipse : public SketchPlugin_SketchEntity, + public GeomAPI_IPresentable, + public ModelAPI_IReentrant { +public: /// Ellipse feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchMacroEllipse"); return ID; } - static const std::string& ELLIPSE_TYPE() - { + static const std::string &ELLIPSE_TYPE() { static const std::string ID("ellipse_type"); return ID; } - static const std::string& ELLIPSE_TYPE_BY_CENTER_AXIS_POINT() - { + static const std::string &ELLIPSE_TYPE_BY_CENTER_AXIS_POINT() { static const std::string ID("by_center_axis_point"); return ID; } - static const std::string& ELLIPSE_TYPE_BY_AXIS_AND_POINT() - { + static const std::string &ELLIPSE_TYPE_BY_AXIS_AND_POINT() { static const std::string ID("by_major_axis_and_point"); return ID; } - static const std::string& EDIT_ELLIPSE_TYPE() - { + static const std::string &EDIT_ELLIPSE_TYPE() { static const std::string ID("edit_ellipse_type"); return ID; } /// Attribute for the first point selected during ellipse creation. - inline static const std::string& CENTER_POINT_ID() - { + inline static const std::string &CENTER_POINT_ID() { static const std::string ID("first_point"); return ID; } /// Reference to the first selected point. - inline static const std::string& CENTER_POINT_REF_ID() - { + inline static const std::string &CENTER_POINT_REF_ID() { static const std::string ID("first_point_ref"); return ID; } /// Attribute for the second point selected during ellipse creation. - inline static const std::string& MAJOR_AXIS_POINT_ID() - { + inline static const std::string &MAJOR_AXIS_POINT_ID() { static const std::string ID("second_point"); return ID; } /// Reference to the second selected point. - inline static const std::string& MAJOR_AXIS_POINT_REF_ID() - { + inline static const std::string &MAJOR_AXIS_POINT_REF_ID() { static const std::string ID("second_point_ref"); return ID; } /// Attribute for the third point selected during ellipse creation. - inline static const std::string& PASSED_POINT_ID() - { + inline static const std::string &PASSED_POINT_ID() { static const std::string ID("passed_point"); return ID; } /// Reference for passed point selection. - inline static const std::string& PASSED_POINT_REF_ID() - { + inline static const std::string &PASSED_POINT_REF_ID() { static const std::string ID("passed_point_ref"); return ID; } /// Attribute for the first point selected during ellipse creation. - inline static const std::string& MAJOR_AXIS_START_ID() - { + inline static const std::string &MAJOR_AXIS_START_ID() { static const std::string ID("first_point_1"); return ID; } /// Reference to the first selected point. - inline static const std::string& MAJOR_AXIS_START_REF_ID() - { + inline static const std::string &MAJOR_AXIS_START_REF_ID() { static const std::string ID("first_point_ref_1"); return ID; } /// Attribute for the second point selected during ellipse creation. - inline static const std::string& MAJOR_AXIS_END_ID() - { + inline static const std::string &MAJOR_AXIS_END_ID() { static const std::string ID("second_point_1"); return ID; } /// Reference to the second selected point. - inline static const std::string& MAJOR_AXIS_END_REF_ID() - { + inline static const std::string &MAJOR_AXIS_END_REF_ID() { static const std::string ID("second_point_ref_1"); return ID; } /// Attribute for the third point selected during ellipse creation. - inline static const std::string& PASSED_POINT_1_ID() - { + inline static const std::string &PASSED_POINT_1_ID() { static const std::string ID("passed_point_1"); return ID; } /// Reference for passed point selection. - inline static const std::string& PASSED_POINT_1_REF_ID() - { + inline static const std::string &PASSED_POINT_1_REF_ID() { static const std::string ID("passed_point_ref_1"); return ID; } /// Major radius of the ellipse - inline static const std::string& MAJOR_RADIUS_ID() - { + inline static const std::string &MAJOR_RADIUS_ID() { static const std::string ID("major_radius"); return ID; } /// Minor radius of the ellipse - inline static const std::string& MINOR_RADIUS_ID() - { + inline static const std::string &MINOR_RADIUS_ID() { static const std::string ID("minor_radius"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MacroEllipse::ID(); return MY_KIND; } - /// \brief Request for initialization of data model of the feature: adding all attributes. + /// \brief Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); @@ -185,15 +166,14 @@ class SketchPlugin_MacroEllipse: public SketchPlugin_SketchEntity, /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const - {return true;} + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const - {return false;} + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } - /// Apply information of the message to current object. It fills reference object, - /// tangent type and tangent point refence in case of tangent arc - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills reference + /// object, tangent type and tangent point refence in case of tangent arc + virtual std::string + processEvent(const std::shared_ptr &theMessage); /// Use plugin manager for features creation SketchPlugin_MacroEllipse(); @@ -207,8 +187,8 @@ private: private: std::shared_ptr myCenter; std::shared_ptr myFocus; - double myMajorRadius; - double myMinorRadius; + double myMajorRadius; + double myMinorRadius; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp index 7f09b00d2..f51cd1309 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp @@ -14,21 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include #include -#include #include +#include #include #include +#include #include #include -#include #include @@ -41,28 +42,23 @@ #include #include - const double TOLERANCE = 1.e-7; const double paramTolerance = 1.e-4; const double PI = 3.141592653589793238463; - SketchPlugin_MacroEllipticArc::SketchPlugin_MacroEllipticArc() - : SketchPlugin_SketchEntity(), - myMajorRadius(0.0), - myMinorRadius(0.0), - myParamDelta(0.0) -{ -} + : SketchPlugin_SketchEntity(), myMajorRadius(0.0), myMinorRadius(0.0), + myParamDelta(0.0) {} -void SketchPlugin_MacroEllipticArc::initAttributes() -{ +void SketchPlugin_MacroEllipticArc::initAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(CENTER_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(MAJOR_AXIS_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(MAJOR_AXIS_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(MAJOR_AXIS_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(START_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(START_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(START_POINT_REF_ID(), + ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(END_POINT_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(END_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); @@ -74,37 +70,37 @@ void SketchPlugin_MacroEllipticArc::initAttributes() boolean(REVERSED_ID())->setValue(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_REF_ID()); - ModelAPI_Session::get()->validators() - ->registerNotObligatory(getKind(), MAJOR_AXIS_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), START_POINT_REF_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), END_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + CENTER_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), MAJOR_AXIS_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), START_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), END_POINT_REF_ID()); } -void SketchPlugin_MacroEllipticArc::execute() -{ +void SketchPlugin_MacroEllipticArc::execute() { FeaturePtr anEllipse = createEllipticArcFeature(); constraintsForEllipticArc(anEllipse); // message to init reentrant operation static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new SketchPlugin_MacroArcReentrantMessage(anId, this)); + std::shared_ptr aMessage = + std::shared_ptr( + new SketchPlugin_MacroArcReentrantMessage(anId, this)); aMessage->setCreatedFeature(anEllipse); Events_Loop::loop()->send(aMessage); } -void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& /*theID*/) -{ +void SketchPlugin_MacroEllipticArc::attributeChanged( + const std::string & /*theID*/) { static const int NB_POINTS = 4; - std::string aPointAttrName[NB_POINTS] = { CENTER_ID(), - MAJOR_AXIS_POINT_ID(), - START_POINT_ID(), - END_POINT_ID() }; - std::string aPointRefName[NB_POINTS] = { CENTER_REF_ID(), - MAJOR_AXIS_POINT_REF_ID(), - START_POINT_REF_ID(), - END_POINT_REF_ID() }; + std::string aPointAttrName[NB_POINTS] = {CENTER_ID(), MAJOR_AXIS_POINT_ID(), + START_POINT_ID(), END_POINT_ID()}; + std::string aPointRefName[NB_POINTS] = { + CENTER_REF_ID(), MAJOR_AXIS_POINT_REF_ID(), START_POINT_REF_ID(), + END_POINT_REF_ID()}; int aNbInitialized = 0; GeomPnt2dPtr anEllipsePoints[NB_POINTS]; @@ -120,7 +116,7 @@ void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& /*theID* std::dynamic_pointer_cast(aPointAttr)->pnt(); GeomShapePtr aTangentCurve; SketchPlugin_Tools::convertRefAttrToPointOrTangentCurve( - aPointRef, aPointAttr, aTangentCurve, aPassedPoint); + aPointRef, aPointAttr, aTangentCurve, aPassedPoint); anEllipsePoints[aNbInitialized++] = aPassedPoint; } @@ -128,25 +124,25 @@ void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& /*theID* if (aNbInitialized <= 1) return; // too few points for the ellipse - myCenter = anEllipsePoints[0]; + myCenter = anEllipsePoints[0]; myMajorAxis = anEllipsePoints[1]; - myStartPnt = anEllipsePoints[2]; - myEndPnt = anEllipsePoints[3]; + myStartPnt = anEllipsePoints[2]; + myEndPnt = anEllipsePoints[3]; if (myCenter->distance(myMajorAxis) < TOLERANCE) return; // ellipse is not valid std::shared_ptr anEllipse; if (aNbInitialized == 2) { - GeomDir2dPtr aXDir(new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(), - anEllipsePoints[1]->y() - anEllipsePoints[0]->y())); + GeomDir2dPtr aXDir( + new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(), + anEllipsePoints[1]->y() - anEllipsePoints[0]->y())); double aMajorRad = anEllipsePoints[1]->distance(anEllipsePoints[0]); - anEllipse = std::shared_ptr( - new GeomAPI_Ellipse2d(anEllipsePoints[0], aXDir, aMajorRad, 0.5 * aMajorRad)); - } - else if (aNbInitialized >= 3) { - anEllipse = std::shared_ptr( - new GeomAPI_Ellipse2d(anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2])); + anEllipse = std::shared_ptr(new GeomAPI_Ellipse2d( + anEllipsePoints[0], aXDir, aMajorRad, 0.5 * aMajorRad)); + } else if (aNbInitialized >= 3) { + anEllipse = std::shared_ptr(new GeomAPI_Ellipse2d( + anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2])); } if (!anEllipse || anEllipse->implPtr() == 0) @@ -169,12 +165,11 @@ void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& /*theID* anEllipse->parameter(myStartPnt, paramTolerance, aParamStart); aParameterEnd -= aParamStart; - if (myParamDelta > 0.0 && myParamDelta <= PI * 0.5 && - aParameterEnd < 0 && aParameterEnd >= -PI * 0.5) { + if (myParamDelta > 0.0 && myParamDelta <= PI * 0.5 && aParameterEnd < 0 && + aParameterEnd >= -PI * 0.5) { boolean(REVERSED_ID())->setValue(true); - } - else if (myParamDelta < 0.0 && myParamDelta >= -PI * 0.5 && - aParameterEnd > 0.0 && aParameterEnd <= PI * 0.5) { + } else if (myParamDelta < 0.0 && myParamDelta >= -PI * 0.5 && + aParameterEnd > 0.0 && aParameterEnd <= PI * 0.5) { boolean(REVERSED_ID())->setValue(false); } } @@ -184,18 +179,19 @@ void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& /*theID* // LCOV_EXCL_START std::string SketchPlugin_MacroEllipticArc::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { std::string aFilledAttributeName; std::shared_ptr aReentrantMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast( + theMessage); if (aReentrantMessage) { FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature(); ObjectPtr anObject = aReentrantMessage->selectedObject(); AttributePtr anAttribute = aReentrantMessage->selectedAttribute(); - std::shared_ptr aClickedPoint = aReentrantMessage->clickedPoint(); + std::shared_ptr aClickedPoint = + aReentrantMessage->clickedPoint(); if (aClickedPoint && (anObject || anAttribute)) { aFilledAttributeName = CENTER_ID(); @@ -203,24 +199,26 @@ std::string SketchPlugin_MacroEllipticArc::processEvent( // fill 2d point attribute AttributePoint2DPtr aPointAttr = - std::dynamic_pointer_cast(attribute(aFilledAttributeName)); + std::dynamic_pointer_cast( + attribute(aFilledAttributeName)); aPointAttr->setValue(aClickedPoint); // fill reference attribute AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(attribute(aReferenceAttributeName)); + std::dynamic_pointer_cast( + attribute(aReferenceAttributeName)); if (anAttribute) { if (!anAttribute->owner() || !anAttribute->owner()->data()->isValid()) { if (aCreatedFeature && anAttribute->id() == CENTER_ID()) - anAttribute = aCreatedFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID()); + anAttribute = aCreatedFeature->attribute( + SketchPlugin_EllipticArc::CENTER_ID()); } aRefAttr->setAttr(anAttribute); - } - else if (anObject.get()) { - // if attribute is NULL, only object is defined, it should be processed outside - // the feature because it might be an external feature, that will be - // removed/created again after restart operation - // #2468 - Crash when sketching circles successively on a repetition + } else if (anObject.get()) { + // if attribute is NULL, only object is defined, it should be processed + // outside the feature because it might be an external feature, that + // will be removed/created again after restart operation #2468 - Crash + // when sketching circles successively on a repetition aFilledAttributeName = ""; } } @@ -230,8 +228,7 @@ std::string SketchPlugin_MacroEllipticArc::processEvent( } // LCOV_EXCL_STOP -FeaturePtr SketchPlugin_MacroEllipticArc::createEllipticArcFeature() -{ +FeaturePtr SketchPlugin_MacroEllipticArc::createEllipticArcFeature() { GeomShapePtr anArc = getArcShape(); GeomEllipsePtr anEllipse; GeomPointPtr aStartPoint, aEndPoint; @@ -250,33 +247,39 @@ FeaturePtr SketchPlugin_MacroEllipticArc::createEllipticArcFeature() return FeaturePtr(); // Create and fill new EllipticArc feature - SketchPlugin_Sketch* aSketch = sketch(); - FeaturePtr aEllipseFeature = aSketch->addFeature(SketchPlugin_EllipticArc::ID()); + SketchPlugin_Sketch *aSketch = sketch(); + FeaturePtr aEllipseFeature = + aSketch->addFeature(SketchPlugin_EllipticArc::ID()); - AttributePoint2DPtr aCenterAttr = std::dynamic_pointer_cast( - aEllipseFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID())); + AttributePoint2DPtr aCenterAttr = + std::dynamic_pointer_cast( + aEllipseFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID())); aCenterAttr->setValue(aSketch->to2D(anEllipse->center())); - AttributePoint2DPtr aFocusAttr = std::dynamic_pointer_cast( - aEllipseFeature->attribute(SketchPlugin_EllipticArc::FIRST_FOCUS_ID())); + AttributePoint2DPtr aFocusAttr = + std::dynamic_pointer_cast(aEllipseFeature->attribute( + SketchPlugin_EllipticArc::FIRST_FOCUS_ID())); aFocusAttr->setValue(aSketch->to2D(anEllipse->firstFocus())); - AttributePoint2DPtr aStartAttr = std::dynamic_pointer_cast( - aEllipseFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); + AttributePoint2DPtr aStartAttr = + std::dynamic_pointer_cast(aEllipseFeature->attribute( + SketchPlugin_EllipticArc::START_POINT_ID())); aStartAttr->setValue(aSketch->to2D(aStartPoint)); AttributePoint2DPtr aEndAttr = std::dynamic_pointer_cast( aEllipseFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID())); aEndAttr->setValue(aSketch->to2D(aEndPoint)); - aEllipseFeature->real(SketchPlugin_EllipticArc::MAJOR_RADIUS_ID())->setValue(myMajorRadius); - aEllipseFeature->real(SketchPlugin_EllipticArc::MINOR_RADIUS_ID())->setValue(myMinorRadius); + aEllipseFeature->real(SketchPlugin_EllipticArc::MAJOR_RADIUS_ID()) + ->setValue(myMajorRadius); + aEllipseFeature->real(SketchPlugin_EllipticArc::MINOR_RADIUS_ID()) + ->setValue(myMinorRadius); - aEllipseFeature->boolean(SketchPlugin_EllipticArc::REVERSED_ID())->setValue( - boolean(REVERSED_ID())->value()); + aEllipseFeature->boolean(SketchPlugin_EllipticArc::REVERSED_ID()) + ->setValue(boolean(REVERSED_ID())->value()); - aEllipseFeature->boolean(SketchPlugin_EllipticArc::AUXILIARY_ID())->setValue( - boolean(AUXILIARY_ID())->value()); + aEllipseFeature->boolean(SketchPlugin_EllipticArc::AUXILIARY_ID()) + ->setValue(boolean(AUXILIARY_ID())->value()); aEllipseFeature->execute(); @@ -296,18 +299,18 @@ FeaturePtr SketchPlugin_MacroEllipticArc::createEllipticArcFeature() SketchPlugin_Tools::createAuxiliaryPointOnEllipse( aEllipseFeature, SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()); // create auxiliary axes - SketchPlugin_Tools::createAuxiliaryAxisOfEllipse(aEllipseFeature, - SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), - SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID()); - SketchPlugin_Tools::createAuxiliaryAxisOfEllipse(aEllipseFeature, - SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), - SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()); + SketchPlugin_Tools::createAuxiliaryAxisOfEllipse( + aEllipseFeature, SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(), + SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID()); + SketchPlugin_Tools::createAuxiliaryAxisOfEllipse( + aEllipseFeature, SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(), + SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()); return aEllipseFeature; } -void SketchPlugin_MacroEllipticArc::constraintsForEllipticArc(FeaturePtr theEllipticArc) -{ +void SketchPlugin_MacroEllipticArc::constraintsForEllipticArc( + FeaturePtr theEllipticArc) { // tangency on-the-fly is not applicable for elliptic arcs static const bool isTangencyApplicable = false; // Create constraints. @@ -315,11 +318,11 @@ void SketchPlugin_MacroEllipticArc::constraintsForEllipticArc(FeaturePtr theElli this, CENTER_REF_ID(), theEllipticArc->attribute(SketchPlugin_EllipticArc::CENTER_ID()), ObjectPtr(), isTangencyApplicable); - // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an object + // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an + // object if (!refattr(MAJOR_AXIS_POINT_REF_ID())->isObject()) { SketchPlugin_Tools::createCoincidenceOrTangency( - this, MAJOR_AXIS_POINT_REF_ID(), - AttributePtr(), + this, MAJOR_AXIS_POINT_REF_ID(), AttributePtr(), theEllipticArc->lastResult(), isTangencyApplicable); } SketchPlugin_Tools::createCoincidenceOrTangency( @@ -332,9 +335,9 @@ void SketchPlugin_MacroEllipticArc::constraintsForEllipticArc(FeaturePtr theElli ObjectPtr(), isTangencyApplicable); } -AISObjectPtr SketchPlugin_MacroEllipticArc::getAISObject(AISObjectPtr thePrevious) -{ - SketchPlugin_Sketch* aSketch = sketch(); +AISObjectPtr +SketchPlugin_MacroEllipticArc::getAISObject(AISObjectPtr thePrevious) { + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch || !myCenter || !myMajorAxis) return AISObjectPtr(); @@ -345,25 +348,26 @@ AISObjectPtr SketchPlugin_MacroEllipticArc::getAISObject(AISObjectPtr thePreviou if (!anArcShape.get() || !aCenterPointShape.get()) return AISObjectPtr(); - std::list > aShapes; + std::list> aShapes; aShapes.push_back(anArcShape); aShapes.push_back(aCenterPointShape); - std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); + std::shared_ptr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aShapes); AISObjectPtr anAIS = thePrevious; if (!anAIS) anAIS.reset(new GeomAPI_AISObject()); anAIS->createShape(aCompound); - SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, + boolean(AUXILIARY_ID())->value()); return anAIS; } -GeomShapePtr SketchPlugin_MacroEllipticArc::getArcShape() -{ +GeomShapePtr SketchPlugin_MacroEllipticArc::getArcShape() { if (!myCenter.get() || !myMajorAxis.get()) return GeomShapePtr(); - SketchPlugin_Sketch* aSketch = sketch(); + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch || myCenter->distance(myMajorAxis) < 1.e-7) return GeomShapePtr(); @@ -373,8 +377,9 @@ GeomShapePtr SketchPlugin_MacroEllipticArc::getArcShape() aMajorAxisPnt->y() - aCenter->y(), aMajorAxisPnt->z() - aCenter->z())); - std::shared_ptr aNDir = std::dynamic_pointer_cast( - aSketch->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + aSketch->attribute(SketchPlugin_Sketch::NORM_ID())); GeomDirPtr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); GeomPointPtr aStart, anEnd; @@ -388,12 +393,12 @@ GeomShapePtr SketchPlugin_MacroEllipticArc::getArcShape() if (boolean(REVERSED_ID())->value()) std::swap(aStart, anEnd); - anArcShape = GeomAlgoAPI_EdgeBuilder::ellipticArc(aCenter, aNormal, aMajorAxisDir, - myMajorRadius, myMinorRadius, aStart, anEnd); - } - else { - anArcShape = GeomAlgoAPI_EdgeBuilder::ellipse(aCenter, aNormal, aMajorAxisDir, - myMajorRadius, myMinorRadius); + anArcShape = GeomAlgoAPI_EdgeBuilder::ellipticArc( + aCenter, aNormal, aMajorAxisDir, myMajorRadius, myMinorRadius, aStart, + anEnd); + } else { + anArcShape = GeomAlgoAPI_EdgeBuilder::ellipse( + aCenter, aNormal, aMajorAxisDir, myMajorRadius, myMinorRadius); } return anArcShape; diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h index 5c9594051..ce03ec4fe 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h +++ b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MacroEllipticArc_H_ #define SketchPlugin_MacroEllipticArc_H_ +#include #include #include #include -#include class GeomAPI_Pnt2d; class GeomAPI_Shape; @@ -32,107 +33,96 @@ class GeomAPI_Shape; * \ingroup Plugins * \brief Feature for creation of the new elliptic arc in Sketch. */ -class SketchPlugin_MacroEllipticArc: public SketchPlugin_SketchEntity, - public GeomAPI_IPresentable, - public ModelAPI_IReentrant -{ +class SketchPlugin_MacroEllipticArc : public SketchPlugin_SketchEntity, + public GeomAPI_IPresentable, + public ModelAPI_IReentrant { public: /// Elliptic arc feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchMacroEllipticArc"); return ID; } /// Attribute for the central point selected during elliptic arc creation. - inline static const std::string& CENTER_ID() - { + inline static const std::string &CENTER_ID() { static const std::string ID("center"); return ID; } /// Reference to the first selected point (center of ellipse). - inline static const std::string& CENTER_REF_ID() - { + inline static const std::string &CENTER_REF_ID() { static const std::string ID("center_ref"); return ID; } - /// Attribute for the point on major semi-axis selected during elliptic arc creation. - inline static const std::string& MAJOR_AXIS_POINT_ID() - { + /// Attribute for the point on major semi-axis selected during elliptic arc + /// creation. + inline static const std::string &MAJOR_AXIS_POINT_ID() { static const std::string ID("major_axis_point"); return ID; } /// Reference to the second selected point (major semi-axis of the ellipse). - inline static const std::string& MAJOR_AXIS_POINT_REF_ID() - { + inline static const std::string &MAJOR_AXIS_POINT_REF_ID() { static const std::string ID("major_axis_point_ref"); return ID; } - /// Attribute for the start point of the elliptic arc selected during creation. - inline static const std::string& START_POINT_ID() - { + /// Attribute for the start point of the elliptic arc selected during + /// creation. + inline static const std::string &START_POINT_ID() { static const std::string ID("start_point"); return ID; } /// Reference for the start point selection. - inline static const std::string& START_POINT_REF_ID() - { + inline static const std::string &START_POINT_REF_ID() { static const std::string ID("start_point_ref"); return ID; } /// Attribute for the end point of the elliptic arc selected during creation. - inline static const std::string& END_POINT_ID() - { + inline static const std::string &END_POINT_ID() { static const std::string ID("end_point"); return ID; } /// Reference for the end point selection. - inline static const std::string& END_POINT_REF_ID() - { + inline static const std::string &END_POINT_REF_ID() { static const std::string ID("end_point_ref"); return ID; } /// Major radius of the ellipse - inline static const std::string& MAJOR_RADIUS_ID() - { + inline static const std::string &MAJOR_RADIUS_ID() { static const std::string ID("major_radius"); return ID; } /// Minor radius of the ellipse - inline static const std::string& MINOR_RADIUS_ID() - { + inline static const std::string &MINOR_RADIUS_ID() { static const std::string ID("minor_radius"); return ID; } /// Flag the arc is reversed - inline static const std::string& REVERSED_ID() - { + inline static const std::string &REVERSED_ID() { static const std::string ID("reversed"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MacroEllipticArc::ID(); return MY_KIND; } - /// \brief Request for initialization of data model of the feature: adding all attributes. + /// \brief Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); @@ -142,15 +132,14 @@ public: /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const - {return true;} + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const - {return false;} + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } - /// Apply information of the message to current object. It fills reference object, - /// tangent type and tangent point refence in case of tangent arc - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills reference + /// object, tangent type and tangent point refence in case of tangent arc + virtual std::string + processEvent(const std::shared_ptr &theMessage); /// Use plugin manager for features creation SketchPlugin_MacroEllipticArc(); diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp index 4e862e119..632dbd152 100644 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp @@ -14,25 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_MultiRotation.h" #include "SketchPlugin_Tools.h" #include -#include #include #include -#include #include -#include -#include +#include #include +#include +#include #include +#include #include -#include #include +#include #include @@ -48,33 +49,33 @@ static const double PERIOD = 360.0; static const double ANGLETOL = 1.e-7; SketchPlugin_MultiRotation::SketchPlugin_MultiRotation() - : isUpdatingAngle(false) -{ -} + : isUpdatingAngle(false) {} -void SketchPlugin_MultiRotation::initAttributes() -{ +void SketchPlugin_MultiRotation::initAttributes() { data()->addAttribute(CENTER_ID(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(ANGLE_TYPE(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(ANGLE_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefList::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(NUMBER_OF_OBJECTS_ID(), + ModelAPI_AttributeInteger::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefList::typeId()); data()->addAttribute(ROTATION_LIST_ID(), ModelAPI_AttributeRefList::typeId()); data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_A()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_A()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_B()); } -void SketchPlugin_MultiRotation::execute() -{ +void SketchPlugin_MultiRotation::execute() { if (!sketch()) { - // it is possible, that this method is called before this feature has back reference to sketch - // in this case, the execute is performed after this is done + // it is possible, that this method is called before this feature has back + // reference to sketch in this case, the execute is performed after this is + // done return; } @@ -88,36 +89,42 @@ void SketchPlugin_MultiRotation::execute() if (!aCenter || !aCenter->isInitialized()) return; - //double anAngle = std::dynamic_pointer_cast( - // attribute(ANGLE_ID()))->value(); + // double anAngle = std::dynamic_pointer_cast( + // attribute(ANGLE_ID()))->value(); // Convert angle to radians - //anAngle *= PI / 180.0; + // anAngle *= PI / 180.0; // Wait all objects being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - // Save the current feature of the document, because new features may appear while executing. - // In this case, they will become current. But if the number of copies is updated from outside - // of sketch (e.g. by parameter change), the history line should not hold in sketch. + // Save the current feature of the document, because new features may appear + // while executing. In this case, they will become current. But if the number + // of copies is updated from outside of sketch (e.g. by parameter change), the + // history line should not hold in sketch. keepCurrentFeature(); std::shared_ptr aData = data(); - AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::ENTITY_A())); - AttributeRefListPtr aRefListOfRotated = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::ENTITY_B())); - int aCurrentNbCopies = aRefListOfShapes->size() ? - aRefListOfRotated->size() / aRefListOfShapes->size() - 1 : 0; + AttributeRefListPtr aRefListOfShapes = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefListPtr aRefListOfRotated = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + int aCurrentNbCopies = + aRefListOfShapes->size() + ? aRefListOfRotated->size() / aRefListOfShapes->size() - 1 + : 0; std::list anInitialList = aRefListOfShapes->list(); std::list aTargetList = aRefListOfRotated->list(); std::list anAddition; std::vector isUsed(anInitialList.size(), false); // collect new items and check the items to remove - for(int anInd = 0; anInd < aRotationObjectRefs->size(); anInd++) { + for (int anInd = 0; anInd < aRotationObjectRefs->size(); anInd++) { ObjectPtr anObject = aRotationObjectRefs->object(anInd); std::list::const_iterator anIt = anInitialList.begin(); std::vector::iterator aUsedIt = isUsed.begin(); @@ -143,9 +150,10 @@ void SketchPlugin_MultiRotation::execute() aRefListOfRotated->remove(*aTargetIter); // remove the corresponding feature from the sketch ResultConstructionPtr aRC = - std::dynamic_pointer_cast(*aTargetIter); + std::dynamic_pointer_cast( + *aTargetIter); DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr(); - FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); + FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); if (aFeature) aFeaturesToBeRemoved.insert(aFeature); } @@ -172,7 +180,7 @@ void SketchPlugin_MultiRotation::execute() aRefListOfRotated->remove(*aTargetIter); aTargetIter++; ind++; - if (ind > aMinCopies && ind <=aMaxCopies) { + if (ind > aMinCopies && ind <= aMaxCopies) { while (ind <= aMaxCopies) { if (isAdd) { // Add new shifted item @@ -186,9 +194,10 @@ void SketchPlugin_MultiRotation::execute() aRefListOfRotated->remove(anObject); // remove the corresponding feature from the sketch ResultConstructionPtr aRC = - std::dynamic_pointer_cast(anObject); + std::dynamic_pointer_cast( + anObject); DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr(); - FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); + FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); if (aFeature) aFeaturesToBeRemoved.insert(aFeature); } @@ -202,7 +211,8 @@ void SketchPlugin_MultiRotation::execute() ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved); aFeaturesToBeRemoved.clear(); - for (aTargetIter = aTargetList.begin(); aTargetIter != aTargetList.end(); aTargetIter++) + for (aTargetIter = aTargetList.begin(); aTargetIter != aTargetList.end(); + aTargetIter++) aRefListOfRotated->append(*aTargetIter); } // add new items @@ -223,43 +233,45 @@ void SketchPlugin_MultiRotation::execute() Events_Loop::loop()->setFlushed(anUpdateEvent, true); } -AISObjectPtr SketchPlugin_MultiRotation::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_MultiRotation::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::rotateConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::rotateConstraint(this, sketch(), thePrevious); return anAIS; } -void SketchPlugin_MultiRotation::erase() -{ - static Events_Loop* aLoop = Events_Loop::loop(); +void SketchPlugin_MultiRotation::erase() { + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); // Set copy attribute to false on all copied features. - AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_A())); - AttributeRefListPtr aRefListOfRotated = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_B())); - - if(aRefListOfShapes.get() && aRefListOfRotated.get()) { - for(int anIndex = 0; anIndex < aRefListOfRotated->size(); anIndex++) { + AttributeRefListPtr aRefListOfShapes = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefListPtr aRefListOfRotated = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_B())); + + if (aRefListOfShapes.get() && aRefListOfRotated.get()) { + for (int anIndex = 0; anIndex < aRefListOfRotated->size(); anIndex++) { ObjectPtr anObject = aRefListOfRotated->object(anIndex); - if(aRefListOfShapes->isInList(anObject)) { + if (aRefListOfShapes->isInList(anObject)) { // Don't modify attribute of original features, just skip. continue; } - if(anObject.get()) { + if (anObject.get()) { ResultPtr aRes = std::dynamic_pointer_cast(anObject); - if(aRes.get()) { + if (aRes.get()) { FeaturePtr aFeature = aRes->document()->feature(aRes); - if(aFeature.get()) { + if (aFeature.get()) { AttributeBooleanPtr aBooleanAttr = - aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); - if(aBooleanAttr.get()) { - if (ModelAPI_Session::get()->isOperation()) // if this is not undo or redo + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if (aBooleanAttr.get()) { + if (ModelAPI_Session::get() + ->isOperation()) // if this is not undo or redo aBooleanAttr->setValue(false); // Redisplay object as it is not copy anymore. ModelAPI_EventCreator::get()->sendUpdated(aRes, aRedispEvent); @@ -273,26 +285,29 @@ void SketchPlugin_MultiRotation::erase() SketchPlugin_ConstraintBase::erase(); } -ObjectPtr SketchPlugin_MultiRotation::copyFeature(ObjectPtr theObject) -{ - ResultPtr aResult = std::dynamic_pointer_cast(theObject); +ObjectPtr SketchPlugin_MultiRotation::copyFeature(ObjectPtr theObject) { + ResultPtr aResult = + std::dynamic_pointer_cast(theObject); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (!aFeature || !aResult) return ObjectPtr(); - FeaturePtr aNewFeature = - SketchPlugin_Sketch::addUniqueNamedCopiedFeature(aFeature, sketch(), true); + FeaturePtr aNewFeature = SketchPlugin_Sketch::addUniqueNamedCopiedFeature( + aFeature, sketch(), true); aNewFeature->execute(); - static Events_ID aRedisplayEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID aRedisplayEvent = + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(aNewFeature, aRedisplayEvent); std::shared_ptr aShapeIn = aResult->shape(); - const std::list& aResults = aNewFeature->results(); + const std::list &aResults = aNewFeature->results(); std::list::const_iterator anIt = aResults.begin(); for (; anIt != aResults.end(); anIt++) { - ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anIt); - if (!aRC) continue; + ResultConstructionPtr aRC = + std::dynamic_pointer_cast(*anIt); + if (!aRC) + continue; std::shared_ptr aShapeOut = aRC->shape(); if ((aShapeIn->isVertex() && aShapeOut->isVertex()) || (aShapeIn->isEdge() && aShapeOut->isEdge()) || @@ -306,9 +321,9 @@ ObjectPtr SketchPlugin_MultiRotation::copyFeature(ObjectPtr theObject) ObjectPtr theInitial, ObjectPtr theTarget, double theCenterX, double theCenterY, double theAngle) { - std::shared_ptr aCenter(new GeomAPI_Pnt2d(theCenterX, theCenterY)); - double cosA = std::cos(theAngle); - double sinA = std::sin(theAngle); + std::shared_ptr aCenter(new GeomAPI_Pnt2d(theCenterX, +theCenterY)); double cosA = std::cos(theAngle); double sinA = +std::sin(theAngle); FeaturePtr anInitialFeature = ModelAPI_Feature::feature(theInitial); FeaturePtr aTargetFeature = ModelAPI_Feature::feature(theTarget); @@ -342,24 +357,24 @@ ObjectPtr SketchPlugin_MultiRotation::copyFeature(ObjectPtr theObject) aTargetFeature->data()->blockSendAttributeUpdated(false); }*/ - -void SketchPlugin_MultiRotation::attributeChanged(const std::string& theID) -{ +void SketchPlugin_MultiRotation::attributeChanged(const std::string &theID) { if (theID == ROTATION_LIST_ID()) { AttributeRefListPtr aRotationObjectRefs = reflist(ROTATION_LIST_ID()); if (aRotationObjectRefs->size() == 0) { - int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value()-1; + int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value() - 1; if (aNbCopies <= 0) return; // Clear list of objects - AttributeRefListPtr aRefListOfRotated = reflist(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefListPtr aRefListOfRotated = + reflist(SketchPlugin_Constraint::ENTITY_B()); std::list aTargetList = aRefListOfRotated->list(); std::list::iterator aTargetIter = aTargetList.begin(); std::set aFeaturesToBeRemoved; while (aTargetIter != aTargetList.end()) { aTargetIter++; - for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end(); i++, aTargetIter++) { + for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end(); + i++, aTargetIter++) { aRefListOfRotated->remove(*aTargetIter); // remove the corresponding feature from the sketch FeaturePtr aFeature = ModelAPI_Feature::feature(*aTargetIter); @@ -372,25 +387,24 @@ void SketchPlugin_MultiRotation::attributeChanged(const std::string& theID) aRefListOfRotated->clear(); reflist(SketchPlugin_Constraint::ENTITY_A())->clear(); } - } - else if (!isUpdatingAngle && real(ANGLE_ID())->isInitialized()) - { + } else if (!isUpdatingAngle && real(ANGLE_ID())->isInitialized()) { isUpdatingAngle = true; AttributeDoublePtr anAngle = real(ANGLE_ID()); - if (theID == ANGLE_TYPE() && integer(NUMBER_OF_OBJECTS_ID())->isInitialized()) { + if (theID == ANGLE_TYPE() && + integer(NUMBER_OF_OBJECTS_ID())->isInitialized()) { if (string(ANGLE_TYPE())->value() != "SingleAngle") - anAngle->setValue(anAngle->value() * (integer(NUMBER_OF_OBJECTS_ID())->value() - 1)); - else - { + anAngle->setValue(anAngle->value() * + (integer(NUMBER_OF_OBJECTS_ID())->value() - 1)); + else { int aNbSplits = integer(NUMBER_OF_OBJECTS_ID())->value(); if (anAngle->value() < PERIOD - ANGLETOL) aNbSplits -= 1; anAngle->setValue(anAngle->value() / aNbSplits); } - } - else if (theID == ANGLE_ID()) { + } else if (theID == ANGLE_ID()) { if (anAngle->value() > PERIOD + ANGLETOL || anAngle->value() < -ANGLETOL) - anAngle->setValue(anAngle->value() + PERIOD * ceil(-anAngle->value() / PERIOD)); + anAngle->setValue(anAngle->value() + + PERIOD * ceil(-anAngle->value() / PERIOD)); if (fabs(anAngle->value() - PERIOD) < ANGLETOL) anAngle->setValue(PERIOD); else if (fabs(anAngle->value()) < ANGLETOL) diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.h b/src/SketchPlugin/SketchPlugin_MultiRotation.h index d8401f652..30a7681d0 100644 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.h +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.h @@ -14,81 +14,75 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MultiRotation_H_ #define SketchPlugin_MultiRotation_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_MultiRotation * \ingroup Plugins - * \brief Feature for creation of a number of rotated copies of a list of objects + * \brief Feature for creation of a number of rotated copies of a list of + * objects * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() for initial list of objects and * SketchPlugin_Constraint::ENTITY_B() for the list of created objects * - * The list of created objects contains initial and copied objects of each object given. The - * number copies is the NUMBER_OF_OBJECTS_ID() minus 1. At the start of the list, there are - * collected N copies of first object from initial list, then N copies of second object etc. + * The list of created objects contains initial and copied objects of each + * object given. The number copies is the NUMBER_OF_OBJECTS_ID() minus 1. At the + * start of the list, there are collected N copies of first object from initial + * list, then N copies of second object etc. */ -class SketchPlugin_MultiRotation : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_MultiRotation : public SketchPlugin_ConstraintBase { +public: /// Multi-rotation kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_CONSTRAINT_ROTATION_ID("SketchMultiRotation"); return MY_CONSTRAINT_ROTATION_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MultiRotation::ID(); return MY_KIND; } /// List of objects to be mirrored - inline static const std::string& ROTATION_LIST_ID() - { + inline static const std::string &ROTATION_LIST_ID() { static const std::string MY_ROTATION_LIST_ID("MultiRotationList"); return MY_ROTATION_LIST_ID; } /// Center of rotation - inline static const std::string& CENTER_ID() - { + inline static const std::string &CENTER_ID() { static const std::string MY_CENTER_ID("MultiRotationCenter"); return MY_CENTER_ID; } /// attribute name for first point - inline static const std::string& ANGLE_TYPE() - { + inline static const std::string &ANGLE_TYPE() { static const std::string ANGLE_TYPE_ATTR("AngleType"); return ANGLE_TYPE_ATTR; } /// End point of translation - inline static const std::string& ANGLE_ID() - { + inline static const std::string &ANGLE_ID() { static const std::string MY_ANGLE_ID("MultiRotationAngle"); return MY_ANGLE_ID; } /// Total number of objects, initial and translated objects - inline static const std::string& NUMBER_OF_OBJECTS_ID() - { + inline static const std::string &NUMBER_OF_OBJECTS_ID() { static const std::string MY_NUMBER_OF_OBJECTS_ID("MultiRotationObjects"); return MY_NUMBER_OF_OBJECTS_ID; } /// Name of the flag to reverse rotation - inline static const std::string& REVERSED_ID() - { + inline static const std::string &REVERSED_ID() { static const std::string MY_REVERSED_ID("MultiRotationReversed"); return MY_REVERSED_ID; } @@ -96,15 +90,17 @@ class SketchPlugin_MultiRotation : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// removes all fields from this feature: results, data, etc SKETCHPLUGIN_EXPORT virtual void erase(); @@ -114,8 +110,8 @@ class SketchPlugin_MultiRotation : public SketchPlugin_ConstraintBase private: ObjectPtr copyFeature(ObjectPtr theObject); - //void rotateFeature(ObjectPtr theInitial, ObjectPtr theTarget, - // double theCenterX, double theCenterY, double theAngle); + // void rotateFeature(ObjectPtr theInitial, ObjectPtr theTarget, + // double theCenterX, double theCenterY, double theAngle); bool updateFullAngleValue(); diff --git a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp index 8a543fcaf..0d4d8f414 100644 --- a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_MultiTranslation.h" @@ -24,50 +25,51 @@ #include #include #include -#include -#include -#include #include +#include #include +#include #include +#include #include -#include #include +#include #include #include -SketchPlugin_MultiTranslation::SketchPlugin_MultiTranslation() -{ -} +SketchPlugin_MultiTranslation::SketchPlugin_MultiTranslation() {} -void SketchPlugin_MultiTranslation::initAttributes() -{ - data()->addAttribute(VALUE_TYPE(), ModelAPI_AttributeString::typeId()); +void SketchPlugin_MultiTranslation::initAttributes() { + data()->addAttribute(VALUE_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(START_POINT_ID(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(END_POINT_ID(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefList::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId()); - data()->addAttribute(TRANSLATION_LIST_ID(), ModelAPI_AttributeRefList::typeId()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_A()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B()); + data()->addAttribute(NUMBER_OF_OBJECTS_ID(), + ModelAPI_AttributeInteger::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefList::typeId()); + data()->addAttribute(TRANSLATION_LIST_ID(), + ModelAPI_AttributeRefList::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_A()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_B()); } -void SketchPlugin_MultiTranslation::execute() -{ +void SketchPlugin_MultiTranslation::execute() { if (!sketch()) { - // it is possible, that this method is called before this feature has back reference to sketch - // in this case, the execute is performed after this is done + // it is possible, that this method is called before this feature has back + // reference to sketch in this case, the execute is performed after this is + // done return; } AttributeRefListPtr aTranslationObjectRefs = reflist(TRANSLATION_LIST_ID()); - int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value()-1; + int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value() - 1; if (aNbCopies <= 0) return; @@ -75,42 +77,52 @@ void SketchPlugin_MultiTranslation::execute() AttributeRefAttrPtr aStartAttr = data()->refattr(START_POINT_ID()); AttributeRefAttrPtr anEndAttr = data()->refattr(END_POINT_ID()); - if (!aStartAttr || !anEndAttr || !aStartAttr->isInitialized() || !anEndAttr->isInitialized()) + if (!aStartAttr || !anEndAttr || !aStartAttr->isInitialized() || + !anEndAttr->isInitialized()) return; DataPtr aData = data(); - AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData, START_POINT_ID()); - AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData, END_POINT_ID()); + AttributePoint2DPtr aStart = + GeomDataAPI_Point2D::getPoint2D(aData, START_POINT_ID()); + AttributePoint2DPtr aEnd = + GeomDataAPI_Point2D::getPoint2D(aData, END_POINT_ID()); if (!aStart || !aEnd) return; - std::shared_ptr - aShiftVec(new GeomAPI_XY(aEnd->x() - aStart->x(), aEnd->y() - aStart->y())); + std::shared_ptr aShiftVec( + new GeomAPI_XY(aEnd->x() - aStart->x(), aEnd->y() - aStart->y())); // Wait all objects being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - // Save the current feature of the document, because new features may appear while executing. - // In this case, they will become current. But if the number of copies is updated from outside - // of sketch (e.g. by parameter change), the history line should not hold in sketch. + // Save the current feature of the document, because new features may appear + // while executing. In this case, they will become current. But if the number + // of copies is updated from outside of sketch (e.g. by parameter change), the + // history line should not hold in sketch. keepCurrentFeature(); - AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::ENTITY_A())); - AttributeRefListPtr aRefListOfTranslated = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::ENTITY_B())); - int aCurrentNbCopies = aRefListOfShapes->size() ? - aRefListOfTranslated->size() / aRefListOfShapes->size() - 1 : 0; + AttributeRefListPtr aRefListOfShapes = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefListPtr aRefListOfTranslated = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + int aCurrentNbCopies = + aRefListOfShapes->size() + ? aRefListOfTranslated->size() / aRefListOfShapes->size() - 1 + : 0; std::list anInitialList = aRefListOfShapes->list(); std::list aTargetList = aRefListOfTranslated->list(); std::list anAddition; std::vector isUsed(anInitialList.size(), false); // collect new items and check the items to remove - for(int anInd = 0; anInd < aTranslationObjectRefs->size(); anInd++) { - //std::shared_ptr aSelect = aTranslationObjectRefs->value(anInd); + for (int anInd = 0; anInd < aTranslationObjectRefs->size(); anInd++) { + // std::shared_ptr aSelect = + // aTranslationObjectRefs->value(anInd); ObjectPtr anObject = aTranslationObjectRefs->object(anInd); std::list::const_iterator anIt = anInitialList.begin(); std::vector::iterator aUsedIt = isUsed.begin(); @@ -136,9 +148,10 @@ void SketchPlugin_MultiTranslation::execute() aRefListOfTranslated->remove(*aTargetIter); // remove the corresponding feature from the sketch ResultConstructionPtr aRC = - std::dynamic_pointer_cast(*aTargetIter); + std::dynamic_pointer_cast( + *aTargetIter); DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr(); - FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); + FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); if (aFeature) aFeaturesToBeRemoved.insert(aFeature); } @@ -164,7 +177,7 @@ void SketchPlugin_MultiTranslation::execute() aRefListOfTranslated->remove(*aTargetIter); aTargetIter++; ind++; - if (ind > aMinCopies && ind <=aMaxCopies) { + if (ind > aMinCopies && ind <= aMaxCopies) { while (ind <= aMaxCopies) { if (isAdd) { // Add new shifted item @@ -178,9 +191,10 @@ void SketchPlugin_MultiTranslation::execute() aRefListOfTranslated->remove(anObject); // remove the corresponding feature from the sketch ResultConstructionPtr aRC = - std::dynamic_pointer_cast(anObject); + std::dynamic_pointer_cast( + anObject); DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr(); - FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); + FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr(); if (aFeature) aDoc->removeFeature(aFeature); } @@ -192,7 +206,8 @@ void SketchPlugin_MultiTranslation::execute() } } - for (aTargetIter = aTargetList.begin(); aTargetIter != aTargetList.end(); aTargetIter++) + for (aTargetIter = aTargetList.begin(); aTargetIter != aTargetList.end(); + aTargetIter++) aRefListOfTranslated->append(*aTargetIter); } // add new items @@ -213,43 +228,45 @@ void SketchPlugin_MultiTranslation::execute() Events_Loop::loop()->setFlushed(anUpdateEvent, true); } -AISObjectPtr SketchPlugin_MultiTranslation::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr +SketchPlugin_MultiTranslation::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::translateConstraint(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::translateConstraint(this, sketch(), thePrevious); return anAIS; } -void SketchPlugin_MultiTranslation::erase() -{ - static Events_Loop* aLoop = Events_Loop::loop(); +void SketchPlugin_MultiTranslation::erase() { + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); // Set copy attribute to false on all copied features. - AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_A())); - AttributeRefListPtr aRefListOfTranslated = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Constraint::ENTITY_B())); - - if(aRefListOfShapes.get() && aRefListOfTranslated.get()) { - for(int anIndex = 0; anIndex < aRefListOfTranslated->size(); anIndex++) { + AttributeRefListPtr aRefListOfShapes = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefListPtr aRefListOfTranslated = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_B())); + + if (aRefListOfShapes.get() && aRefListOfTranslated.get()) { + for (int anIndex = 0; anIndex < aRefListOfTranslated->size(); anIndex++) { ObjectPtr anObject = aRefListOfTranslated->object(anIndex); - if(aRefListOfShapes->isInList(anObject)) { + if (aRefListOfShapes->isInList(anObject)) { // Don't modify attribute of original features, just skip. continue; } - if(anObject.get()) { + if (anObject.get()) { ResultPtr aRes = std::dynamic_pointer_cast(anObject); - if(aRes.get()) { + if (aRes.get()) { FeaturePtr aFeature = aRes->document()->feature(aRes); - if(aFeature.get()) { + if (aFeature.get()) { AttributeBooleanPtr aBooleanAttr = - aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); - if(aBooleanAttr.get()) { - if (ModelAPI_Session::get()->isOperation()) // if this is not undo or redo + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if (aBooleanAttr.get()) { + if (ModelAPI_Session::get() + ->isOperation()) // if this is not undo or redo aBooleanAttr->setValue(false); // Redisplay object as it is not copy anymore. ModelAPI_EventCreator::get()->sendUpdated(aRes, aRedispEvent); @@ -263,26 +280,29 @@ void SketchPlugin_MultiTranslation::erase() SketchPlugin_ConstraintBase::erase(); } -ObjectPtr SketchPlugin_MultiTranslation::copyFeature(ObjectPtr theObject) -{ - ResultPtr aResult = std::dynamic_pointer_cast(theObject); +ObjectPtr SketchPlugin_MultiTranslation::copyFeature(ObjectPtr theObject) { + ResultPtr aResult = + std::dynamic_pointer_cast(theObject); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (!aFeature || !aResult) return ObjectPtr(); - FeaturePtr aNewFeature = - SketchPlugin_Sketch::addUniqueNamedCopiedFeature(aFeature, sketch(), true); + FeaturePtr aNewFeature = SketchPlugin_Sketch::addUniqueNamedCopiedFeature( + aFeature, sketch(), true); aNewFeature->execute(); - static Events_ID aRedisplayEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID aRedisplayEvent = + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(aNewFeature, aRedisplayEvent); std::shared_ptr aShapeIn = aResult->shape(); - const std::list& aResults = aNewFeature->results(); + const std::list &aResults = aNewFeature->results(); std::list::const_iterator anIt = aResults.begin(); for (; anIt != aResults.end(); anIt++) { - ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anIt); - if (!aRC) continue; + ResultConstructionPtr aRC = + std::dynamic_pointer_cast(*anIt); + if (!aRC) + continue; std::shared_ptr aShapeOut = aRC->shape(); if ((aShapeIn->isVertex() && aShapeOut->isVertex()) || (aShapeIn->isEdge() && aShapeOut->isEdge()) || @@ -292,23 +312,24 @@ ObjectPtr SketchPlugin_MultiTranslation::copyFeature(ObjectPtr theObject) return ObjectPtr(); } -void SketchPlugin_MultiTranslation::attributeChanged(const std::string& theID) -{ +void SketchPlugin_MultiTranslation::attributeChanged(const std::string &theID) { if (theID == TRANSLATION_LIST_ID()) { AttributeRefListPtr aTranslationObjectRefs = reflist(TRANSLATION_LIST_ID()); if (aTranslationObjectRefs->size() == 0) { - int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value()-1; + int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value() - 1; if (aNbCopies <= 0) return; DocumentPtr aDoc = document(); // Clear list of objects - AttributeRefListPtr aRefListOfTranslated = reflist(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefListPtr aRefListOfTranslated = + reflist(SketchPlugin_Constraint::ENTITY_B()); std::list aTargetList = aRefListOfTranslated->list(); std::list::iterator aTargetIter = aTargetList.begin(); while (aTargetIter != aTargetList.end()) { aTargetIter++; - for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end(); i++, aTargetIter++) { + for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end(); + i++, aTargetIter++) { aRefListOfTranslated->remove(*aTargetIter); FeaturePtr aFeature = ModelAPI_Feature::feature(*aTargetIter); if (aFeature) diff --git a/src/SketchPlugin/SketchPlugin_MultiTranslation.h b/src/SketchPlugin/SketchPlugin_MultiTranslation.h index c27c887ad..d9bfc5923 100644 --- a/src/SketchPlugin/SketchPlugin_MultiTranslation.h +++ b/src/SketchPlugin/SketchPlugin_MultiTranslation.h @@ -14,75 +14,71 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_MultiTranslation_H_ #define SketchPlugin_MultiTranslation_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include /** \class SketchPlugin_MultiTranslation * \ingroup Plugins - * \brief Feature for creation of a number of shifted copies of a list of objects + * \brief Feature for creation of a number of shifted copies of a list of + * objects * * This constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() for initial list of objects and * SketchPlugin_Constraint::ENTITY_B() for the list of created objects * - * The list of created objects contains initial and copied objects of each object given. The - * number copies is the NUMBER_OF_OBJECTS_ID() minus 1. At the start of the list, there are - * collected N copies of first object from initial list, then N copies of second object etc. + * The list of created objects contains initial and copied objects of each + * object given. The number copies is the NUMBER_OF_OBJECTS_ID() minus 1. At the + * start of the list, there are collected N copies of first object from initial + * list, then N copies of second object etc. */ -class SketchPlugin_MultiTranslation : public SketchPlugin_ConstraintBase -{ - public: +class SketchPlugin_MultiTranslation : public SketchPlugin_ConstraintBase { +public: /// Multi-translation kind - inline static const std::string& ID() - { - static const std::string MY_CONSTRAINT_TRANSLATION_ID("SketchMultiTranslation"); + inline static const std::string &ID() { + static const std::string MY_CONSTRAINT_TRANSLATION_ID( + "SketchMultiTranslation"); return MY_CONSTRAINT_TRANSLATION_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_MultiTranslation::ID(); return MY_KIND; } /// List of objects to be mirrored - inline static const std::string& TRANSLATION_LIST_ID() - { + inline static const std::string &TRANSLATION_LIST_ID() { static const std::string MY_TRANSLATION_LIST_ID("MultiTranslationList"); return MY_TRANSLATION_LIST_ID; } /// attribute name for first point - inline static const std::string& VALUE_TYPE() - { + inline static const std::string &VALUE_TYPE() { static const std::string VALUE_TYPE_ATTR("ValueType"); return VALUE_TYPE_ATTR; } /// Start point of translation - inline static const std::string& START_POINT_ID() - { + inline static const std::string &START_POINT_ID() { static const std::string MY_START_POINT_ID("MultiTranslationStartPoint"); return MY_START_POINT_ID; } /// End point of translation - inline static const std::string& END_POINT_ID() - { + inline static const std::string &END_POINT_ID() { static const std::string MY_END_POINT_ID("MultiTranslationEndPoint"); return MY_END_POINT_ID; } /// Total number of objects, initial and translated objects - inline static const std::string& NUMBER_OF_OBJECTS_ID() - { + inline static const std::string &NUMBER_OF_OBJECTS_ID() { static const std::string MY_NUMBER_OF_OBJECTS_ID("MultiTranslationObjects"); return MY_NUMBER_OF_OBJECTS_ID; } @@ -90,15 +86,17 @@ class SketchPlugin_MultiTranslation : public SketchPlugin_ConstraintBase /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// removes all fields from this feature: results, data, etc SKETCHPLUGIN_EXPORT virtual void erase(); @@ -108,7 +106,6 @@ class SketchPlugin_MultiTranslation : public SketchPlugin_ConstraintBase private: ObjectPtr copyFeature(ObjectPtr theObject); - }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Offset.cpp b/src/SketchPlugin/SketchPlugin_Offset.cpp index 119a7373b..9225f35f5 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.cpp +++ b/src/SketchPlugin/SketchPlugin_Offset.cpp @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include -#include -#include #include +#include +#include #include #include #include -#include -#include +#include +#include +#include #include #include @@ -37,8 +38,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -46,13 +47,13 @@ #include #include +#include #include #include #include #include -#include -#include #include +#include #include #include @@ -69,21 +70,21 @@ static const double tolerance = 1.e-7; -SketchPlugin_Offset::SketchPlugin_Offset() -{ -} +SketchPlugin_Offset::SketchPlugin_Offset() {} -void SketchPlugin_Offset::initAttributes() -{ - AttributeRefListPtr anEdgesAttr = std::dynamic_pointer_cast - (data()->addAttribute(EDGES_ID(), ModelAPI_AttributeRefList::typeId())); // #1 - data()->addAttribute(VALUE_ID(), ModelAPI_AttributeDouble::typeId()); // #2 - data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId()); // #3 +void SketchPlugin_Offset::initAttributes() { + AttributeRefListPtr anEdgesAttr = + std::dynamic_pointer_cast(data()->addAttribute( + EDGES_ID(), ModelAPI_AttributeRefList::typeId())); // #1 + data()->addAttribute(VALUE_ID(), ModelAPI_AttributeDouble::typeId()); // #2 + data()->addAttribute(REVERSED_ID(), + ModelAPI_AttributeBoolean::typeId()); // #3 // SketchPlugin_Constraint::ENTITY_A() stores original entities - AttributeRefListPtr entaAttr = std::dynamic_pointer_cast - (data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), - ModelAPI_AttributeRefList::typeId())); // #4 + AttributeRefListPtr entaAttr = + std::dynamic_pointer_cast( + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefList::typeId())); // #4 bool badOrder = false; if (anEdgesAttr->isInitialized()) { // restoring data from saved study @@ -98,38 +99,41 @@ void SketchPlugin_Offset::initAttributes() // We could have studies with approxAttr at the 4th position. // Using directly attribute index 4, we create approxAttr on label #4, // otherwise (with default -1 index) it would be created on the next one. - approxAttr = std::dynamic_pointer_cast - (data()->addAttribute(APPROX_ID(), - ModelAPI_AttributeBoolean::typeId(), - 4)); // #4 - - entaAttr = std::dynamic_pointer_cast - (data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), - ModelAPI_AttributeRefList::typeId(), - 5)); // #5 + approxAttr = std::dynamic_pointer_cast( + data()->addAttribute(APPROX_ID(), ModelAPI_AttributeBoolean::typeId(), + 4)); // #4 + + entaAttr = std::dynamic_pointer_cast( + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), + ModelAPI_AttributeRefList::typeId(), + 5)); // #5 } // store offset entities - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId()); - // store mapping between original entity and index of the corresponding offset entity - data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), ModelAPI_AttributeIntArray::typeId()); - - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_A()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B()); - ModelAPI_Session::get()->validators()-> - registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_C()); - - AttributeStringPtr aJointAttr = std::dynamic_pointer_cast - (data()->addAttribute(JOINT_ID(), ModelAPI_AttributeString::typeId())); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), + ModelAPI_AttributeRefList::typeId()); + // store mapping between original entity and index of the corresponding offset + // entity + data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), + ModelAPI_AttributeIntArray::typeId()); + + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_A()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_B()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Constraint::ENTITY_C()); + + AttributeStringPtr aJointAttr = + std::dynamic_pointer_cast( + data()->addAttribute(JOINT_ID(), ModelAPI_AttributeString::typeId())); if (!aJointAttr->isInitialized()) aJointAttr->setValue(JOINT_KEEP_DISTANCE()); if (!badOrder) { // Good place for approxAttr is here - approxAttr = std::dynamic_pointer_cast - (data()->addAttribute(APPROX_ID(), ModelAPI_AttributeBoolean::typeId())); + approxAttr = std::dynamic_pointer_cast( + data()->addAttribute(APPROX_ID(), ModelAPI_AttributeBoolean::typeId())); } // Initialize approximation to false by default for backward compatibility @@ -137,10 +141,10 @@ void SketchPlugin_Offset::initAttributes() approxAttr->setValue(false); } -void SketchPlugin_Offset::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); - if (!aSketch) return; +void SketchPlugin_Offset::execute() { + SketchPlugin_Sketch *aSketch = sketch(); + if (!aSketch) + return; // 0. Joint type AttributeStringPtr aJointAttr = string(JOINT_ID()); @@ -161,14 +165,18 @@ void SketchPlugin_Offset::execute() // 2. Offset value AttributeDoublePtr aValueAttr = real(VALUE_ID()); - if (!aValueAttr->isInitialized()) return; + if (!aValueAttr->isInitialized()) + return; double aValue = aValueAttr->value(); - if (aValue < tolerance) return; + if (aValue < tolerance) + return; // 2.a. Reversed? AttributeBooleanPtr aReversedAttr = boolean(REVERSED_ID()); - if (!aReversedAttr->isInitialized()) return; - if (aReversedAttr->value()) aValue = -aValue; // reverse offset direction + if (!aReversedAttr->isInitialized()) + return; + if (aReversedAttr->value()) + aValue = -aValue; // reverse offset direction // 3. List of all selected edges AttributeRefListPtr aSelectedEdges = reflist(EDGES_ID()); @@ -185,20 +193,23 @@ void SketchPlugin_Offset::execute() } // Wait all objects being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - // Save the current feature of the document, because new features may appear while executing. - // In this case, they will become current. But if the number of copies is updated from outside - // of sketch (e.g. by parameter change), the history line should not hold in sketch. + // Save the current feature of the document, because new features may appear + // while executing. In this case, they will become current. But if the number + // of copies is updated from outside of sketch (e.g. by parameter change), the + // history line should not hold in sketch. keepCurrentFeature(); // 5. Gather wires and make offset for each wire ListOfMakeShape anOffsetAlgos; std::set aProcessedEdgesSet; - for (anEdgesIt = anEdgesList.begin(); anEdgesIt != anEdgesList.end(); anEdgesIt++) { + for (anEdgesIt = anEdgesList.begin(); anEdgesIt != anEdgesList.end(); + anEdgesIt++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anEdgesIt); if (aFeature.get()) { if (aProcessedEdgesSet.find(aFeature) != aProcessedEdgesSet.end()) @@ -206,12 +217,13 @@ void SketchPlugin_Offset::execute() // 5.a. End points (if any) std::shared_ptr aStartPoint, anEndPoint; - SketchPlugin_SegmentationTools::getFeaturePoints(aFeature, aStartPoint, anEndPoint); + SketchPlugin_SegmentationTools::getFeaturePoints(aFeature, aStartPoint, + anEndPoint); // 5.b. Find a chain of edges std::list aChain; aChain.push_back(aFeature); - bool isClosed = !(aStartPoint && anEndPoint); // not closed edge + bool isClosed = !(aStartPoint && anEndPoint); // not closed edge if (!isClosed) { isClosed = findWireOneWay(aFeature, aFeature, aStartPoint, anEdgesSet, aProcessedEdgesSet, aChain, true); @@ -236,7 +248,7 @@ void SketchPlugin_Offset::execute() new GeomAlgoAPI_WireBuilder(aTopoChain, !isClosed)); GeomShapePtr aWireShape = aWireBuilder->shape(); - GeomWirePtr aWire (new GeomAPI_Wire (aWireShape)); + GeomWirePtr aWire(new GeomAPI_Wire(aWireShape)); // Fix for a problem of offset side change with selection change. // Wire direction is defined by the first selected edge of this wire. @@ -253,29 +265,28 @@ void SketchPlugin_Offset::execute() // 5.d. Make offset for the wire AttributeBooleanPtr anApproxAttr = boolean(APPROX_ID()); - if (!anApproxAttr->isInitialized()) - { - // It must be initialized at least by SketchPlugin_Offset::initAttributes() + if (!anApproxAttr->isInitialized()) { + // It must be initialized at least by + // SketchPlugin_Offset::initAttributes() return; } - std::shared_ptr anOffsetShape - (new GeomAlgoAPI_Offset(aPlane, aWireShape, aValue*aSign, aJoint, anApproxAttr->value())); + std::shared_ptr anOffsetShape(new GeomAlgoAPI_Offset( + aPlane, aWireShape, aValue * aSign, aJoint, anApproxAttr->value())); if (anOffsetShape->isDone()) { if (aJoint == GeomAlgoAPI_OffsetJoint::Arcs) { // For Arcs joint make fillet at all straight edges intersections // of the wire, resulting from GeomAlgoAPI_Offset algorithm makeFillet(fabs(aValue), aWireBuilder, anOffsetShape, anOffsetAlgos); - } - else { - std::shared_ptr aMakeList (new GeomAlgoAPI_MakeShapeList); + } else { + std::shared_ptr aMakeList( + new GeomAlgoAPI_MakeShapeList); aMakeList->appendAlgo(aWireBuilder); aMakeList->appendAlgo(anOffsetShape); anOffsetAlgos.push_back(aMakeList); } - } - else { + } else { setError("Offset algorithm failed"); } } @@ -293,16 +304,15 @@ void SketchPlugin_Offset::execute() Events_Loop::loop()->setFlushed(anUpdateEvent, true); } -bool SketchPlugin_Offset::findWireOneWay (const FeaturePtr& theFirstEdge, - const FeaturePtr& theEdge, - const std::shared_ptr& theEndPoint, - std::set& theEdgesSet, - std::set& theProcessedEdgesSet, - std::list& theChain, - const bool isPrepend) -{ +bool SketchPlugin_Offset::findWireOneWay( + const FeaturePtr &theFirstEdge, const FeaturePtr &theEdge, + const std::shared_ptr &theEndPoint, + std::set &theEdgesSet, + std::set &theProcessedEdgesSet, std::list &theChain, + const bool isPrepend) { // 1. Find a single edge, coincident to theEndPoint by one of its ends - if (!theEndPoint) return false; + if (!theEndPoint) + return false; FeaturePtr aNextEdgeFeature; int nbFound = 0; @@ -313,11 +323,14 @@ bool SketchPlugin_Offset::findWireOneWay (const FeaturePtr& theFirstEdge, std::set::iterator aPointsIt = aCoincPoints.begin(); for (; aPointsIt != aCoincPoints.end(); aPointsIt++) { AttributePoint2DPtr aP = (*aPointsIt); - FeaturePtr aCoincFeature = std::dynamic_pointer_cast(aP->owner()); + FeaturePtr aCoincFeature = + std::dynamic_pointer_cast(aP->owner()); bool isInSet = (theEdgesSet.find(aCoincFeature) != theEdgesSet.end()); // Condition 0: not auxiliary - if (!isInSet && aCoincFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) + if (!isInSet && + aCoincFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()) continue; // Condition 1: not a point feature @@ -329,13 +342,17 @@ bool SketchPlugin_Offset::findWireOneWay (const FeaturePtr& theFirstEdge, if (isInSet || theEdgesSet.empty()) { // Condition 4: consider only features with two end points std::shared_ptr aP1, aP2; - SketchPlugin_SegmentationTools::getFeaturePoints(aCoincFeature, aP1, aP2); + SketchPlugin_SegmentationTools::getFeaturePoints(aCoincFeature, aP1, + aP2); if (aP1 && aP2) { - // Condition 5: consider only features, that have aP as one of they ends. - // For example, we do not need an arc, coincident to aP by its center. + // Condition 5: consider only features, that have aP as one of they + // ends. + // For example, we do not need an arc, coincident to aP + // by its center. if (theEndPoint->pnt()->isEqual(aP1->pnt()) || theEndPoint->pnt()->isEqual(aP2->pnt())) { - // Condition 6: only one edge can prolongate the chain. If several, we stop here. + // Condition 6: only one edge can prolongate the chain. If + // several, we stop here. nbFound++; if (nbFound > 1) return false; @@ -376,25 +393,22 @@ bool SketchPlugin_Offset::findWireOneWay (const FeaturePtr& theFirstEdge, } // 5. Continue gathering the chain (recursive) - return findWireOneWay (theFirstEdge, aNextEdgeFeature, aP2, theEdgesSet, - theProcessedEdgesSet, theChain, isPrepend); + return findWireOneWay(theFirstEdge, aNextEdgeFeature, aP2, theEdgesSet, + theProcessedEdgesSet, theChain, isPrepend); } static void setRefListValue(AttributeRefListPtr theList, int theListSize, - ObjectPtr theValue, int theIndex) -{ + ObjectPtr theValue, int theIndex) { if (theIndex < theListSize) { ObjectPtr aCur = theList->object(theIndex); if (aCur != theValue) theList->substitute(aCur, theValue); - } - else + } else theList->append(theValue); } // Reorder shapes according to the wire's order -static void reorderShapes(ListOfShape& theShapes, GeomShapePtr theWire) -{ +static void reorderShapes(ListOfShape &theShapes, GeomShapePtr theWire) { std::set aShapes; aShapes.insert(theShapes.begin(), theShapes.end()); theShapes.clear(); @@ -411,8 +425,8 @@ static void reorderShapes(ListOfShape& theShapes, GeomShapePtr theWire) } } -static void removeLastFromIndex(AttributeRefListPtr theList, int theListSize, int& theLastIndex) -{ +static void removeLastFromIndex(AttributeRefListPtr theList, int theListSize, + int &theLastIndex) { if (theLastIndex < theListSize) { std::set anIndicesToRemove; for (; theLastIndex < theListSize; ++theLastIndex) @@ -421,8 +435,7 @@ static void removeLastFromIndex(AttributeRefListPtr theList, int theListSize, in } } -void SketchPlugin_Offset::addToSketch(const ListOfMakeShape& theOffsetAlgos) -{ +void SketchPlugin_Offset::addToSketch(const ListOfMakeShape &theOffsetAlgos) { AttributeRefListPtr aSelectedRefList = reflist(EDGES_ID()); AttributeRefListPtr aBaseRefList = reflist(ENTITY_A()); AttributeRefListPtr anOffsetRefList = reflist(ENTITY_B()); @@ -430,25 +443,26 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape& theOffsetAlgos) // compare the list of selected edges and the previously stored, // and store maping between them - std::map > aMapExistent; + std::map> aMapExistent; std::list anObjectsToRemove; std::list aSelectedList = aSelectedRefList->list(); for (std::list::iterator aSIt = aSelectedList.begin(); aSIt != aSelectedList.end(); ++aSIt) { aMapExistent[*aSIt] = std::list(); } - for (int anIndex = 0, aSize = anOffsetRefList->size(); anIndex < aSize; ++anIndex) { + for (int anIndex = 0, aSize = anOffsetRefList->size(); anIndex < aSize; + ++anIndex) { ObjectPtr aCurrent = anOffsetRefList->object(anIndex); int aBaseIndex = anOffsetToBaseMap->value(anIndex); if (aBaseIndex >= 0) { ObjectPtr aBaseObj = aBaseRefList->object(aBaseIndex); - std::map >::iterator aFound = aMapExistent.find(aBaseObj); + std::map>::iterator aFound = + aMapExistent.find(aBaseObj); if (aFound != aMapExistent.end()) aFound->second.push_back(aCurrent); else anObjectsToRemove.push_back(aCurrent); - } - else + } else anObjectsToRemove.push_back(aCurrent); } @@ -477,9 +491,10 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape& theOffsetAlgos) setRefListValue(aBaseRefList, aBaseListSize, *aSIt, aBaseListIndex); // create or update an offseted feature - const std::list& anImages = aMapExistent[*aSIt]; + const std::list &anImages = aMapExistent[*aSIt]; std::list::const_iterator anImgIt = anImages.begin(); - for (ListOfShape::iterator aNewIt = aNewShapes.begin(); aNewIt != aNewShapes.end(); ++aNewIt) { + for (ListOfShape::iterator aNewIt = aNewShapes.begin(); + aNewIt != aNewShapes.end(); ++aNewIt) { FeaturePtr aNewFeature; if (anImgIt != anImages.end()) aNewFeature = ModelAPI_Feature::feature(*anImgIt++); @@ -487,7 +502,8 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape& theOffsetAlgos) aProcessedOffsets.insert(*aNewIt); // store an offseted feature - setRefListValue(anOffsetRefList, anOffsetListSize, aNewFeature, anOffsetListIndex); + setRefListValue(anOffsetRefList, anOffsetListSize, aNewFeature, + anOffsetListIndex); anOffsetBaseBackRefs.push_back(aBaseListIndex); ++anOffsetListIndex; @@ -508,7 +524,8 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape& theOffsetAlgos) aProcessedOffsets.insert(aCurEdge); // store an offseted feature - setRefListValue(anOffsetRefList, anOffsetListSize, aNewFeature, anOffsetListIndex); + setRefListValue(anOffsetRefList, anOffsetListSize, aNewFeature, + anOffsetListIndex); anOffsetBaseBackRefs.push_back(-1); ++anOffsetListIndex; @@ -537,11 +554,10 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape& theOffsetAlgos) ModelAPI_Tools::removeFeaturesAndReferences(aSet); } -static void findOrCreateFeatureByKind(SketchPlugin_Sketch* theSketch, - const std::string& theFeatureKind, - FeaturePtr& theFeature, - std::list& thePoolOfFeatures) -{ +static void findOrCreateFeatureByKind(SketchPlugin_Sketch *theSketch, + const std::string &theFeatureKind, + FeaturePtr &theFeature, + std::list &thePoolOfFeatures) { if (theFeature) { // check the feature type is the same as required if (theFeature->getKind() != theFeatureKind) { @@ -567,10 +583,9 @@ static void findOrCreateFeatureByKind(SketchPlugin_Sketch* theSketch, } } -void SketchPlugin_Offset::updateExistentOrCreateNew(const GeomShapePtr& theShape, - FeaturePtr& theFeature, - std::list& thePoolOfFeatures) -{ +void SketchPlugin_Offset::updateExistentOrCreateNew( + const GeomShapePtr &theShape, FeaturePtr &theFeature, + std::list &thePoolOfFeatures) { if (theShape->shapeType() != GeomAPI_Shape::EDGE) return; @@ -585,19 +600,22 @@ void SketchPlugin_Offset::updateExistentOrCreateNew(const GeomShapePtr& theShape } if (aResEdge->isLine()) { - findOrCreateFeatureByKind(sketch(), SketchPlugin_Line::ID(), theFeature, thePoolOfFeatures); - - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Line::START_ID()))->setValue(aFP); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Line::END_ID()))->setValue(aLP); - } - else if (aResEdge->isArc()) { + findOrCreateFeatureByKind(sketch(), SketchPlugin_Line::ID(), theFeature, + thePoolOfFeatures); + + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Line::START_ID())) + ->setValue(aFP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Line::END_ID())) + ->setValue(aLP); + } else if (aResEdge->isArc()) { std::shared_ptr aCircEdge = aResEdge->circle(); std::shared_ptr aCP3d = aCircEdge->center(); std::shared_ptr aCP = sketch()->to2D(aCP3d); - findOrCreateFeatureByKind(sketch(), SketchPlugin_Arc::ID(), theFeature, thePoolOfFeatures); + findOrCreateFeatureByKind(sketch(), SketchPlugin_Arc::ID(), theFeature, + thePoolOfFeatures); GeomDirPtr aCircNormal = aCircEdge->normal(); GeomDirPtr aSketchNormal = sketch()->coordinatePlane()->normal(); @@ -605,26 +623,30 @@ void SketchPlugin_Offset::updateExistentOrCreateNew(const GeomShapePtr& theShape std::swap(aFP, aLP); bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Arc::END_ID()))->setValue(aLP); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Arc::START_ID()))->setValue(aFP); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Arc::CENTER_ID()))->setValue(aCP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Arc::END_ID())) + ->setValue(aLP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Arc::START_ID())) + ->setValue(aFP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Arc::CENTER_ID())) + ->setValue(aCP); theFeature->data()->blockSendAttributeUpdated(aWasBlocked); - } - else if (aResEdge->isCircle()) { + } else if (aResEdge->isCircle()) { std::shared_ptr aCircEdge = aResEdge->circle(); std::shared_ptr aCP3d = aCircEdge->center(); std::shared_ptr aCP = sketch()->to2D(aCP3d); - findOrCreateFeatureByKind(sketch(), SketchPlugin_Circle::ID(), theFeature, thePoolOfFeatures); + findOrCreateFeatureByKind(sketch(), SketchPlugin_Circle::ID(), theFeature, + thePoolOfFeatures); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->setValue(aCP); - theFeature->real(SketchPlugin_Circle::RADIUS_ID())->setValue(aCircEdge->radius()); - } - else if (aResEdge->isEllipse()) { + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Circle::CENTER_ID())) + ->setValue(aCP); + theFeature->real(SketchPlugin_Circle::RADIUS_ID()) + ->setValue(aCircEdge->radius()); + } else if (aResEdge->isEllipse()) { std::shared_ptr anEllipseEdge = aResEdge->ellipse(); GeomPointPtr aCP3d = anEllipseEdge->center(); @@ -639,30 +661,34 @@ void SketchPlugin_Offset::updateExistentOrCreateNew(const GeomShapePtr& theShape theFeature, thePoolOfFeatures); bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID()))->setValue(aCP); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_EllipticArc::FIRST_FOCUS_ID()))->setValue(aFocus); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))->setValue(aFP); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))->setValue(aLP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID())) + ->setValue(aCP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_EllipticArc::FIRST_FOCUS_ID())) + ->setValue(aFocus); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())) + ->setValue(aFP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID())) + ->setValue(aLP); theFeature->data()->blockSendAttributeUpdated(aWasBlocked); - } - else { + } else { // Ellipse findOrCreateFeatureByKind(sketch(), SketchPlugin_Ellipse::ID(), theFeature, thePoolOfFeatures); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Ellipse::CENTER_ID()))->setValue(aCP); - std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID()))->setValue(aFocus); - theFeature->real(SketchPlugin_Ellipse::MINOR_RADIUS_ID())->setValue( - anEllipseEdge->minorRadius()); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Ellipse::CENTER_ID())) + ->setValue(aCP); + std::dynamic_pointer_cast( + theFeature->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID())) + ->setValue(aFocus); + theFeature->real(SketchPlugin_Ellipse::MINOR_RADIUS_ID()) + ->setValue(anEllipseEdge->minorRadius()); } - } - else { + } else { // convert to b-spline mkBSpline(theFeature, aResEdge, thePoolOfFeatures); } @@ -671,31 +697,35 @@ void SketchPlugin_Offset::updateExistentOrCreateNew(const GeomShapePtr& theShape theFeature->boolean(SketchPlugin_SketchEntity::COPY_ID())->setValue(true); theFeature->execute(); - static Events_ID aRedisplayEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID aRedisplayEvent = + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(theFeature, aRedisplayEvent); - const std::list& aResults = theFeature->results(); + const std::list &aResults = theFeature->results(); for (std::list::const_iterator anIt = aResults.begin(); anIt != aResults.end(); ++anIt) ModelAPI_EventCreator::get()->sendUpdated(*anIt, aRedisplayEvent); } } -void SketchPlugin_Offset::mkBSpline (FeaturePtr& theResult, - const GeomEdgePtr& theEdge, - std::list& thePoolOfFeatures) -{ - GeomCurvePtr aCurve (new GeomAPI_Curve (theEdge)); +void SketchPlugin_Offset::mkBSpline(FeaturePtr &theResult, + const GeomEdgePtr &theEdge, + std::list &thePoolOfFeatures) { + GeomCurvePtr aCurve(new GeomAPI_Curve(theEdge)); // Forced conversion to b-spline, if aCurve is not b-spline GeomBSplinePtr aBSpline = GeomAPI_BSpline::convertToBSpline(aCurve); - const std::string& aBSplineKind = aBSpline->isPeriodic() ? SketchPlugin_BSplinePeriodic::ID() - : SketchPlugin_BSpline::ID(); - findOrCreateFeatureByKind(sketch(), aBSplineKind, theResult, thePoolOfFeatures); + const std::string &aBSplineKind = aBSpline->isPeriodic() + ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID(); + findOrCreateFeatureByKind(sketch(), aBSplineKind, theResult, + thePoolOfFeatures); - theResult->integer(SketchPlugin_BSpline::DEGREE_ID())->setValue(aBSpline->degree()); + theResult->integer(SketchPlugin_BSpline::DEGREE_ID()) + ->setValue(aBSpline->degree()); - AttributePoint2DArrayPtr aPolesAttr = std::dynamic_pointer_cast - (theResult->attribute(SketchPlugin_BSpline::POLES_ID())); + AttributePoint2DArrayPtr aPolesAttr = + std::dynamic_pointer_cast( + theResult->attribute(SketchPlugin_BSpline::POLES_ID())); std::list aPoles = aBSpline->poles(); aPolesAttr->setSize((int)aPoles.size()); std::list::iterator anIt = aPoles.begin(); @@ -712,8 +742,7 @@ void SketchPlugin_Offset::mkBSpline (FeaturePtr& theResult, aWeightsAttr->setSize(aSize); for (int anIndex = 0; anIndex < aSize; ++anIndex) aWeightsAttr->setValue(anIndex, 1.0); - } - else { // non-rational B-spline + } else { // non-rational B-spline aWeightsAttr->setSize((int)aWeights.size()); std::list::iterator aWIt = aWeights.begin(); for (int anIndex = 0; aWIt != aWeights.end(); ++aWIt, ++anIndex) @@ -739,13 +768,13 @@ void SketchPlugin_Offset::mkBSpline (FeaturePtr& theResult, aMultsAttr->setValue(index, *aMIt); } -void SketchPlugin_Offset::attributeChanged(const std::string& theID) -{ +void SketchPlugin_Offset::attributeChanged(const std::string &theID) { if (theID == EDGES_ID()) { AttributeRefListPtr aSelected = reflist(EDGES_ID()); if (aSelected->size() == 0) { // Clear list of objects - AttributeRefListPtr anOffsetAttr = reflist(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefListPtr anOffsetAttr = + reflist(SketchPlugin_Constraint::ENTITY_B()); std::list anOffsetList = anOffsetAttr->list(); std::set aFeaturesToBeRemoved; for (std::list::iterator anIt = anOffsetList.begin(); @@ -764,21 +793,21 @@ void SketchPlugin_Offset::attributeChanged(const std::string& theID) } } -bool SketchPlugin_Offset::customAction(const std::string& theActionId) -{ +bool SketchPlugin_Offset::customAction(const std::string &theActionId) { bool isOk = false; if (theActionId == ADD_WIRE_ACTION_ID()) { isOk = findWires(); - } - else { + } else { std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\"."; - Events_InfoMessage("SketchPlugin_Offset", aMsg).arg(getKind()).arg(theActionId).send(); + Events_InfoMessage("SketchPlugin_Offset", aMsg) + .arg(getKind()) + .arg(theActionId) + .send(); } return isOk; } -bool SketchPlugin_Offset::findWires() -{ +bool SketchPlugin_Offset::findWires() { AttributeRefListPtr aSelectedEdges = reflist(EDGES_ID()); std::list anEdgesList = aSelectedEdges->list(); @@ -801,7 +830,8 @@ bool SketchPlugin_Offset::findWires() bool aWasBlocked = data()->blockSendAttributeUpdated(true); // Gather chains of edges - for (anEdgesIt = anEdgesList.begin(); anEdgesIt != anEdgesList.end(); anEdgesIt++) { + for (anEdgesIt = anEdgesList.begin(); anEdgesIt != anEdgesList.end(); + anEdgesIt++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anEdgesIt); if (aFeature.get()) { if (aProcessedEdgesSet.find(aFeature) != aProcessedEdgesSet.end()) @@ -810,12 +840,14 @@ bool SketchPlugin_Offset::findWires() // End points (if any) std::shared_ptr aStartPoint, anEndPoint; - SketchPlugin_SegmentationTools::getFeaturePoints(aFeature, aStartPoint, anEndPoint); + SketchPlugin_SegmentationTools::getFeaturePoints(aFeature, aStartPoint, + anEndPoint); std::list aChain; aChain.push_back(aFeature); - bool isClosed = findWireOneWay(aFeature, aFeature, aStartPoint, anEdgesSet, - aProcessedEdgesSet, aChain, true); + bool isClosed = + findWireOneWay(aFeature, aFeature, aStartPoint, anEdgesSet, + aProcessedEdgesSet, aChain, true); if (!isClosed) { findWireOneWay(aFeature, aFeature, anEndPoint, anEdgesSet, aProcessedEdgesSet, aChain, false); @@ -835,34 +867,31 @@ bool SketchPlugin_Offset::findWires() return true; } - -AISObjectPtr SketchPlugin_Offset::getAISObject(AISObjectPtr thePrevious) -{ +AISObjectPtr SketchPlugin_Offset::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::offsetObject(this, sketch(), - thePrevious); + AISObjectPtr anAIS = + SketcherPrs_Factory::offsetObject(this, sketch(), thePrevious); return anAIS; } - -void SketchPlugin_Offset::makeFillet - (const double theValue, - const std::shared_ptr& theWireBuilder, - const std::shared_ptr& theOffsetShape, - ListOfMakeShape& theOffsetAlgos) -{ - std::shared_ptr aMakeList (new GeomAlgoAPI_MakeShapeList); +void SketchPlugin_Offset::makeFillet( + const double theValue, + const std::shared_ptr &theWireBuilder, + const std::shared_ptr &theOffsetShape, + ListOfMakeShape &theOffsetAlgos) { + std::shared_ptr aMakeList( + new GeomAlgoAPI_MakeShapeList); aMakeList->appendAlgo(theWireBuilder); aMakeList->appendAlgo(theOffsetShape); bool isOK = true; GeomShapePtr aResWire = theOffsetShape->shape(); - GeomAlgoAPI_MapShapesAndAncestors aMapVE - (aResWire, GeomAPI_Shape::VERTEX, GeomAPI_Shape::EDGE); - const MapShapeToShapes& aSubshapes = aMapVE.map(); + GeomAlgoAPI_MapShapesAndAncestors aMapVE(aResWire, GeomAPI_Shape::VERTEX, + GeomAPI_Shape::EDGE); + const MapShapeToShapes &aSubshapes = aMapVE.map(); // find vertices for fillet std::set aFilletVertices; @@ -875,8 +904,8 @@ void SketchPlugin_Offset::makeFillet // both edges should be linear ListOfShape anEdges; anEdges.insert(anEdges.end(), anIt->second.begin(), anIt->second.end()); - GeomEdgePtr anEdge1 (new GeomAPI_Edge(anEdges.front())); - GeomEdgePtr anEdge2 (new GeomAPI_Edge(anEdges.back())); + GeomEdgePtr anEdge1(new GeomAPI_Edge(anEdges.front())); + GeomEdgePtr anEdge2(new GeomAPI_Edge(anEdges.back())); if (!anEdge1->isLine() || !anEdge2->isLine()) continue; @@ -890,19 +919,18 @@ void SketchPlugin_Offset::makeFillet if (!aFilletVertices.empty()) { isOK = false; // the wire needs correction - ListOfShape aVerticesList (aFilletVertices.begin(), aFilletVertices.end()); + ListOfShape aVerticesList(aFilletVertices.begin(), aFilletVertices.end()); // Fillet1D on all linear edges intersections - std::shared_ptr aFilletBuilder - (new GeomAlgoAPI_Fillet1D(aResWire, aVerticesList, theValue)); + std::shared_ptr aFilletBuilder( + new GeomAlgoAPI_Fillet1D(aResWire, aVerticesList, theValue)); std::string anError; - if (!GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed - (aFilletBuilder, getKind(), anError)) { + if (!GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, + getKind(), anError)) { aMakeList->appendAlgo(aFilletBuilder); isOK = true; - } - else { + } else { ListOfShape aFailedVertices = aFilletBuilder->failedVertices(); if (aFailedVertices.size() != 0) { // Exclude failed vertices and also vertices, joined @@ -912,34 +940,38 @@ void SketchPlugin_Offset::makeFillet GeomShapePtr aFailedVertex = *itVertices; aFilletVertices.erase(aFailedVertex); // remove also neighbour vertices - MapShapeToShapes::const_iterator anIt = aSubshapes.find(aFailedVertex); + MapShapeToShapes::const_iterator anIt = + aSubshapes.find(aFailedVertex); if (anIt != aSubshapes.end()) { // should be always true ListOfShape anEdges; - anEdges.insert(anEdges.end(), anIt->second.begin(), anIt->second.end()); - GeomEdgePtr anEdge1 (new GeomAPI_Edge(anEdges.front())); - GeomEdgePtr anEdge2 (new GeomAPI_Edge(anEdges.back())); + anEdges.insert(anEdges.end(), anIt->second.begin(), + anIt->second.end()); + GeomEdgePtr anEdge1(new GeomAPI_Edge(anEdges.front())); + GeomEdgePtr anEdge2(new GeomAPI_Edge(anEdges.back())); GeomVertexPtr V1, V2; anEdge1->vertices(V1, V2); - if (V1->isEqual(aFailedVertex)) V1 = V2; + if (V1->isEqual(aFailedVertex)) + V1 = V2; aFilletVertices.erase(V1); anEdge2->vertices(V1, V2); - if (V1->isEqual(aFailedVertex)) V1 = V2; + if (V1->isEqual(aFailedVertex)) + V1 = V2; aFilletVertices.erase(V1); } } if (aFilletVertices.size() == 0) { // there are no suitable vertices for fillet isOK = true; - } - else { + } else { // Fillet1D one more try - ListOfShape aVerticesList1 (aFilletVertices.begin(), aFilletVertices.end()); + ListOfShape aVerticesList1(aFilletVertices.begin(), + aFilletVertices.end()); - std::shared_ptr aFilletBuilder1 - (new GeomAlgoAPI_Fillet1D(aResWire, aVerticesList1, theValue)); + std::shared_ptr aFilletBuilder1( + new GeomAlgoAPI_Fillet1D(aResWire, aVerticesList1, theValue)); - if (!GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed - (aFilletBuilder1, getKind(), anError)) { + if (!GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( + aFilletBuilder1, getKind(), anError)) { aMakeList->appendAlgo(aFilletBuilder1); isOK = true; } diff --git a/src/SketchPlugin/SketchPlugin_Offset.h b/src/SketchPlugin/SketchPlugin_Offset.h index a865ba483..be0c45970 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.h +++ b/src/SketchPlugin/SketchPlugin_Offset.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Offset_H_ @@ -35,103 +36,92 @@ class GeomAlgoAPI_WireBuilder; * \ingroup Plugins * \brief Builds offset curves in the sketch. */ -class SketchPlugin_Offset : public SketchPlugin_ConstraintBase -{ +class SketchPlugin_Offset : public SketchPlugin_ConstraintBase { public: /// Offset macro feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string ID("SketchOffset"); return ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Offset::ID(); return MY_KIND; } /// Type of joint - inline static const std::string& JOINT_ID() - { + inline static const std::string &JOINT_ID() { static const std::string ID("offset_joint"); return ID; } /// Keep distance joint (add arcs where needed) - inline static const std::string& JOINT_KEEP_DISTANCE() - { + inline static const std::string &JOINT_KEEP_DISTANCE() { static const std::string ID("KeepDistance"); return ID; } /// Arcs joint (make fillets on all straight lines intersections) - inline static const std::string& JOINT_ARCS() - { + inline static const std::string &JOINT_ARCS() { static const std::string ID("Arcs"); return ID; } /// Lines joint (do not add new arcs, prolongate and intersect adjacent lines) - inline static const std::string& JOINT_LINES() - { + inline static const std::string &JOINT_LINES() { static const std::string ID("Lines"); return ID; } /// list of offset edges - inline static const std::string& EDGES_ID() - { + inline static const std::string &EDGES_ID() { static const std::string ID("segments"); return ID; } /// attribute to store the offset value - inline static const std::string& VALUE_ID() - { + inline static const std::string &VALUE_ID() { static const std::string ID("offset_value"); return ID; } /// attribute to store the reversed offset direction - inline static const std::string& REVERSED_ID() - { + inline static const std::string &REVERSED_ID() { static const std::string ID("reversed"); return ID; } /// attribute to approx by segments and arcs - inline static const std::string& APPROX_ID() - { + inline static const std::string &APPROX_ID() { static const std::string ID("approx"); return ID; } /// name for add wire action - inline static const std::string& ADD_WIRE_ACTION_ID() - { + inline static const std::string &ADD_WIRE_ACTION_ID() { static const std::string ID("add_wire"); return ID; } /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return true; } - /// Find edges connected by coincident boundary constraint and composing a wire with - /// the already selected segments. It means that not more than 2 edges can be connected - /// with the coincident point. - /// \param[in] theActionId action key id (in following form: Action#Index) - /// \return \c false in case the action not performed. - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId); + /// Find edges connected by coincident boundary constraint and composing a + /// wire with the already selected segments. It means that not more than 2 + /// edges can be connected with the coincident point. \param[in] theActionId + /// action key id (in following form: Action#Index) \return \c false in case + /// the action not performed. + SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); /// Use plugin manager for features creation. SketchPlugin_Offset(); @@ -145,43 +135,46 @@ private: bool findWires(); /// Create sketch feature for each edge of the offset result, - /// and store it in ENTITY_B(). Original edges are copied to ENTITY_A() to update - /// correctly if original selection is modified. - void addToSketch (const std::list< std::shared_ptr >& theOffsetAlgos); + /// and store it in ENTITY_B(). Original edges are copied to ENTITY_A() to + /// update correctly if original selection is modified. + void addToSketch( + const std::list> &theOffsetAlgos); /// Create BSpline or BSplinePeriodic sketch feature from theEdge - void mkBSpline (FeaturePtr& theResult, const GeomEdgePtr& theEdge, - std::list& thePoolOfFeatures); - - /// Update existent feature by the parameters of the given edge or create a new feature. - /// \param[in] theShape a shape to be converted to sketch feature - /// \param[in,out] theFeature sketch feature to be updated or created from scratch - /// \param[in,out] thePoolOfFeatures list of features to be removed (may be used as a new feature) - void updateExistentOrCreateNew (const GeomShapePtr& theShape, FeaturePtr& theFeature, - std::list& thePoolOfFeatures); + void mkBSpline(FeaturePtr &theResult, const GeomEdgePtr &theEdge, + std::list &thePoolOfFeatures); + + /// Update existent feature by the parameters of the given edge or create a + /// new feature. \param[in] theShape a shape to be converted to + /// sketch feature \param[in,out] theFeature sketch feature to be + /// updated or created from scratch \param[in,out] thePoolOfFeatures list of + /// features to be removed (may be used as a new feature) + void updateExistentOrCreateNew(const GeomShapePtr &theShape, + FeaturePtr &theFeature, + std::list &thePoolOfFeatures); /// Find edges that prolongate theEdgeFeature (in a chain) at theEndPoint /// Recursive method. /// \param[in] theFirstEdge Start edge of wire searching /// \param[in] theEdge Current edge - /// \param[in] theEndPoint Point of the Current edge, not belonging to a previous edge - /// \param[in/out] theEdgesSet All edges to find among. If empty, all sketch edges assumed. - /// \param[in/out] theProcessedEdgesSet Already processed (put in chains) edges. - /// \param[in/out] theChain Resulting edges - /// \param[in] isPrepend if true, push new found edges to theChain front, else to the back - /// \return \c true if the chain is closed - bool findWireOneWay (const FeaturePtr& theFirstEdge, - const FeaturePtr& theEdge, - const std::shared_ptr& theEndPoint, - std::set& theEdgesSet, - std::set& theProcessedEdgesSet, - std::list& theChain, - const bool isPrepend = false); - - void makeFillet (const double theValue, - const std::shared_ptr&, - const std::shared_ptr&, - std::list< std::shared_ptr >& theOffsetAlgos); + /// \param[in] theEndPoint Point of the Current edge, not belonging to a + /// previous edge \param[in/out] theEdgesSet All edges to find among. If + /// empty, all sketch edges assumed. \param[in/out] theProcessedEdgesSet + /// Already processed (put in chains) edges. \param[in/out] theChain Resulting + /// edges \param[in] isPrepend if true, push new found edges to theChain + /// front, else to the back \return \c true if the chain is closed + bool findWireOneWay(const FeaturePtr &theFirstEdge, const FeaturePtr &theEdge, + const std::shared_ptr &theEndPoint, + std::set &theEdgesSet, + std::set &theProcessedEdgesSet, + std::list &theChain, + const bool isPrepend = false); + + void + makeFillet(const double theValue, + const std::shared_ptr &, + const std::shared_ptr &, + std::list> &theOffsetAlgos); }; #endif diff --git a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp index a7bf35037..ca65e46dc 100644 --- a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp +++ b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,43 +24,40 @@ #include #include -#include #include +#include #include #include #include -#include #include +#include #include #include -static SketchPlugin_OverConstraintsResolver* myConstResolver = - new SketchPlugin_OverConstraintsResolver; +static SketchPlugin_OverConstraintsResolver *myConstResolver = + new SketchPlugin_OverConstraintsResolver; -SketchPlugin_OverConstraintsResolver::SketchPlugin_OverConstraintsResolver() -{ - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_CHECK_CONSTRAINTS)); +SketchPlugin_OverConstraintsResolver::SketchPlugin_OverConstraintsResolver() { + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_CHECK_CONSTRAINTS)); } void SketchPlugin_OverConstraintsResolver::setConstraints( - const std::set& theConstraints) -{ + const std::set &theConstraints) { myConstraints = theConstraints; } -bool SketchPlugin_OverConstraintsResolver::perform() -{ +bool SketchPlugin_OverConstraintsResolver::perform() { bool hasConflicts = false; hasConflicts |= checkArcsAboutTangentialConflict(); hasConflicts |= checkHorizontalOrVerticalConflict(); return hasConflicts; } -bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() -{ - std::set::const_iterator - anIt = myConstraints.begin(), aLast = myConstraints.end(); +bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() { + std::set::const_iterator anIt = myConstraints.begin(), + aLast = myConstraints.end(); bool isHVConstraint = false; FeaturePtr aFeature; for (; anIt != aLast; anIt++) { @@ -69,8 +67,7 @@ bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() if (aFeature) { std::string aType = aFeature->getKind(); if ((aType == SketchPlugin_ConstraintHorizontal::ID()) || - (aType == SketchPlugin_ConstraintVertical::ID())) - { + (aType == SketchPlugin_ConstraintVertical::ID())) { myConstraintsToRemove.insert(*anIt); isHVConstraint = true; } @@ -80,21 +77,20 @@ bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() return isHVConstraint; } -bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() -{ +bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() { bool isConflictsFound = false; - std::set::const_iterator - anIt = myConstraints.begin(), aLast = myConstraints.end(); + std::set::const_iterator anIt = myConstraints.begin(), + aLast = myConstraints.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; ConstraintPtr aConstain = - std::dynamic_pointer_cast(anObject); + std::dynamic_pointer_cast(anObject); if (aConstain.get()) { - std::shared_ptr aRefAttrA = aConstain->refattr( - aConstain->ENTITY_A()); - std::shared_ptr aRefAttrB = aConstain->refattr( - aConstain->ENTITY_B()); + std::shared_ptr aRefAttrA = + aConstain->refattr(aConstain->ENTITY_A()); + std::shared_ptr aRefAttrB = + aConstain->refattr(aConstain->ENTITY_B()); if (!aRefAttrA || !aRefAttrB) continue; @@ -104,25 +100,25 @@ bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() if (aFeatureA && aFeatureA->getKind() == SketchPlugin_Arc::ID() && aFeatureB && aFeatureB->getKind() == SketchPlugin_Arc::ID()) { - std::shared_ptr anAttrStrA = aFeatureA->attribute( - SketchPlugin_Arc::START_ID()); - std::shared_ptr anAttrEndA = aFeatureA->attribute( - SketchPlugin_Arc::END_ID()); - std::shared_ptr anAttrStrB = aFeatureB->attribute( - SketchPlugin_Arc::START_ID()); - std::shared_ptr anAttrEndB = aFeatureB->attribute( - SketchPlugin_Arc::END_ID()); - std::shared_ptr anAttrCenA = aFeatureA->attribute( - SketchPlugin_Arc::CENTER_ID()); - std::shared_ptr anAttrCenB = aFeatureB->attribute( - SketchPlugin_Arc::CENTER_ID()); + std::shared_ptr anAttrStrA = + aFeatureA->attribute(SketchPlugin_Arc::START_ID()); + std::shared_ptr anAttrEndA = + aFeatureA->attribute(SketchPlugin_Arc::END_ID()); + std::shared_ptr anAttrStrB = + aFeatureB->attribute(SketchPlugin_Arc::START_ID()); + std::shared_ptr anAttrEndB = + aFeatureB->attribute(SketchPlugin_Arc::END_ID()); + std::shared_ptr anAttrCenA = + aFeatureA->attribute(SketchPlugin_Arc::CENTER_ID()); + std::shared_ptr anAttrCenB = + aFeatureB->attribute(SketchPlugin_Arc::CENTER_ID()); bool isCoincident = false; bool isCoincidentAtCenter = false; std::set aTangentConstraints; std::set aFeatures; - std::map > aFeaturesMap; + std::map> aFeaturesMap; aFeatures.insert(aFeatureA); aFeatures.insert(aFeatureB); ModelAPI_Tools::findAllReferences(aFeatures, aFeaturesMap); @@ -130,31 +126,38 @@ bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() std::set aFeaturesA = aFeaturesMap[aFeatureA]; std::set aFeaturesB = aFeaturesMap[aFeatureB]; - for (auto aFeatIter = aFeaturesA.begin(); aFeatIter != aFeaturesA.end(); ++aFeatIter) { - if (aFeaturesB.find(aFeatIter.operator*()) != aFeaturesB.end()){ - const std::string& aType = (*aFeatIter)->getKind(); + for (auto aFeatIter = aFeaturesA.begin(); aFeatIter != aFeaturesA.end(); + ++aFeatIter) { + if (aFeaturesB.find(aFeatIter.operator*()) != aFeaturesB.end()) { + const std::string &aType = (*aFeatIter)->getKind(); if (aType == SketchPlugin_ConstraintCoincidence::ID()) { ConstraintPtr aCoincidence = - std::dynamic_pointer_cast(*aFeatIter); + std::dynamic_pointer_cast( + *aFeatIter); std::set anAttrSet; - anAttrSet.insert(aCoincidence->refattr(aCoincidence->ENTITY_A())->attr()); - anAttrSet.insert(aCoincidence->refattr(aCoincidence->ENTITY_B())->attr()); - isCoincident |= ((anAttrSet.find(anAttrStrA) != anAttrSet.end() || - anAttrSet.find(anAttrEndA) != anAttrSet.end()) && - (anAttrSet.find(anAttrStrB) != anAttrSet.end() || - anAttrSet.find(anAttrEndB) != anAttrSet.end())); - isCoincidentAtCenter |= (anAttrSet.find(anAttrCenA) != anAttrSet.end() && - anAttrSet.find(anAttrCenB) != anAttrSet.end()); - } - else if (aType == SketchPlugin_ConstraintTangent::ID()) { + anAttrSet.insert( + aCoincidence->refattr(aCoincidence->ENTITY_A())->attr()); + anAttrSet.insert( + aCoincidence->refattr(aCoincidence->ENTITY_B())->attr()); + isCoincident |= + ((anAttrSet.find(anAttrStrA) != anAttrSet.end() || + anAttrSet.find(anAttrEndA) != anAttrSet.end()) && + (anAttrSet.find(anAttrStrB) != anAttrSet.end() || + anAttrSet.find(anAttrEndB) != anAttrSet.end())); + isCoincidentAtCenter |= + (anAttrSet.find(anAttrCenA) != anAttrSet.end() && + anAttrSet.find(anAttrCenB) != anAttrSet.end()); + } else if (aType == SketchPlugin_ConstraintTangent::ID()) { aTangentConstraints.insert(*aFeatIter); } } } - if (isCoincident && isCoincidentAtCenter && !aTangentConstraints.empty()) { + if (isCoincident && isCoincidentAtCenter && + !aTangentConstraints.empty()) { isConflictsFound = true; - myConstraintsToRemove.insert(aTangentConstraints.begin(), aTangentConstraints.end()); + myConstraintsToRemove.insert(aTangentConstraints.begin(), + aTangentConstraints.end()); } } } @@ -164,21 +167,19 @@ bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() } void SketchPlugin_OverConstraintsResolver::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { Events_ID anEventID = theMessage->eventID(); if (anEventID == Events_Loop::eventByName(EVENT_CHECK_CONSTRAINTS)) { std::shared_ptr aConstraintsMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aConstraintsMsg.get()) { myConstraintsToRemove.clear(); myConstraints = aConstraintsMsg->constraints(); - if (perform()) - { + if (perform()) { std::shared_ptr aMessage = - std::shared_ptr( - new ModelAPI_CheckConstraintsMessage( - Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS))); + std::shared_ptr( + new ModelAPI_CheckConstraintsMessage( + Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS))); aMessage->setConstraints(myConstraintsToRemove); Events_Loop::loop()->send(aMessage); } diff --git a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h index e1bc9c678..2b7daea42 100644 --- a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h +++ b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_OverConstraintsResolver_H_ @@ -28,13 +29,12 @@ #include -class SketchPlugin_OverConstraintsResolver : public Events_Listener -{ +class SketchPlugin_OverConstraintsResolver : public Events_Listener { public: SketchPlugin_OverConstraintsResolver(); /// Redefinition of Events_Listener method - void processEvent(const std::shared_ptr& theMessage); + void processEvent(const std::shared_ptr &theMessage); virtual bool groupMessages() { return true; } @@ -43,7 +43,7 @@ protected: bool perform(); /// Set set of constraints to check - void setConstraints(const std::set& theConstraints); + void setConstraints(const std::set &theConstraints); /// Check arcs in sketch about tangential conflict bool checkArcsAboutTangentialConflict(); diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 83fc84bc7..7650e73fc 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -14,19 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include -#include -#include -#include -#include #include #include #include -#include +#include #include #include #include @@ -35,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -46,33 +40,40 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include #include #include #include -#include +#include +#include +#include +#include +#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include -#include +#include #include +#include #include -#include #include @@ -92,12 +93,11 @@ //#define SET_PLANES_COLOR_IN_PREFERENCES // the only created instance of this plugin -static SketchPlugin_Plugin* MY_SKETCH_INSTANCE = new SketchPlugin_Plugin(); +static SketchPlugin_Plugin *MY_SKETCH_INSTANCE = new SketchPlugin_Plugin(); -SketchPlugin_Plugin::SketchPlugin_Plugin() -{ +SketchPlugin_Plugin::SketchPlugin_Plugin() { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); aFactory->registerValidator("SketchPlugin_DistanceAttr", new SketchPlugin_DistanceAttrValidator); aFactory->registerValidator("SketchPlugin_ExternalValidator", @@ -136,17 +136,20 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() new SketchPlugin_ProjectionValidator); aFactory->registerValidator("SketchPlugin_DifferentReference", new SketchPlugin_DifferentReferenceValidator); - aFactory->registerValidator("SketchPlugin_DifferentPointReference", - new SketchPlugin_DifferentPointReferenceValidator); + aFactory->registerValidator( + "SketchPlugin_DifferentPointReference", + new SketchPlugin_DifferentPointReferenceValidator); aFactory->registerValidator("SketchPlugin_CirclePassedPointValidator", new SketchPlugin_CirclePassedPointValidator); aFactory->registerValidator("SketchPlugin_ThirdPointValidator", new SketchPlugin_ThirdPointValidator); aFactory->registerValidator("SketchPlugin_ArcEndPointValidator", new SketchPlugin_ArcEndPointValidator); - aFactory->registerValidator("SketchPlugin_ArcEndPointIntersectionValidator", - new SketchPlugin_ArcEndPointIntersectionValidator); - aFactory->registerValidator("SketchPlugin_HasNoConstraint", new SketchPlugin_HasNoConstraint); + aFactory->registerValidator( + "SketchPlugin_ArcEndPointIntersectionValidator", + new SketchPlugin_ArcEndPointIntersectionValidator); + aFactory->registerValidator("SketchPlugin_HasNoConstraint", + new SketchPlugin_HasNoConstraint); aFactory->registerValidator("SketchPlugin_ReplicationReference", new SketchPlugin_ReplicationReferenceValidator); aFactory->registerValidator("SketchPlugin_SketchFeatureValidator", @@ -162,8 +165,8 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() ModelAPI_Session::get()->registerPlugin(this); Config_PropManager::registerProp("Visualization", "sketch_entity_color", - "Sketch entity color", - Config_Prop::Color, SKETCH_ENTITY_COLOR); + "Sketch entity color", Config_Prop::Color, + SKETCH_ENTITY_COLOR); Config_PropManager::registerProp("Visualization", "sketch_external_color", "Sketch external entity color", @@ -173,32 +176,35 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() "Sketch auxiliary entity color", Config_Prop::Color, SKETCH_AUXILIARY_COLOR); - Config_PropManager::registerProp("Visualization", "sketch_overconstraint_color", - "Sketch overconstraint color", - Config_Prop::Color, SKETCH_OVERCONSTRAINT_COLOR); + Config_PropManager::registerProp( + "Visualization", "sketch_overconstraint_color", + "Sketch overconstraint color", Config_Prop::Color, + SKETCH_OVERCONSTRAINT_COLOR); - Config_PropManager::registerProp("Visualization", "sketch_fully_constrained_color", - "Sketch fully constrained color", - Config_Prop::Color, SKETCH_FULLY_CONSTRAINED_COLOR); + Config_PropManager::registerProp( + "Visualization", "sketch_fully_constrained_color", + "Sketch fully constrained color", Config_Prop::Color, + SKETCH_FULLY_CONSTRAINED_COLOR); Config_PropManager::registerProp("Visualization", "sketch_line_width", - "Sketch line width", - Config_Prop::IntSpin, "3"); + "Sketch line width", Config_Prop::IntSpin, + "3"); // register sketcher properties #ifdef SET_PLANES_COLOR_IN_PREFERENCES - Config_PropManager::registerProp("Visualization", "yz_plane_color", "YZ plane color", - Config_Prop::Color, YZ_PLANE_COLOR); - Config_PropManager::registerProp("Visualization", "xz_plane_color", "XZ plane color", - Config_Prop::Color, XZ_PLANE_COLOR); - Config_PropManager::registerProp("Visualization", "xy_plane_color", "XY plane color", - Config_Prop::Color, XY_PLANE_COLOR); + Config_PropManager::registerProp("Visualization", "yz_plane_color", + "YZ plane color", Config_Prop::Color, + YZ_PLANE_COLOR); + Config_PropManager::registerProp("Visualization", "xz_plane_color", + "XZ plane color", Config_Prop::Color, + XZ_PLANE_COLOR); + Config_PropManager::registerProp("Visualization", "xy_plane_color", + "XY plane color", Config_Prop::Color, + XY_PLANE_COLOR); #endif - } -FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) -{ +FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == SketchPlugin_Sketch::ID()) { return FeaturePtr(new SketchPlugin_Sketch); } else if (theFeatureID == SketchPlugin_Point::ID()) { @@ -293,21 +299,23 @@ FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) } // LCOV_EXCL_START -void SketchPlugin_Plugin::processEvent(const std::shared_ptr& theMessage) -{ +void SketchPlugin_Plugin::processEvent( + const std::shared_ptr &theMessage) { const Events_ID kRequestEvent = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_REQUEST); if (theMessage->eventID() == kRequestEvent) { std::shared_ptr aStateMessage = std::dynamic_pointer_cast(theMessage); - Events_Loop::loop()->send(getFeaturesState(aStateMessage->feature()), false); + Events_Loop::loop()->send(getFeaturesState(aStateMessage->feature()), + false); } } -std::shared_ptr SketchPlugin_Plugin -::getFeaturesState(const std::shared_ptr& theFeature) const -{ - const Events_ID kResponseEvent = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); +std::shared_ptr +SketchPlugin_Plugin ::getFeaturesState( + const std::shared_ptr &theFeature) const { + const Events_ID kResponseEvent = + Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); std::shared_ptr aMsg( new ModelAPI_FeatureStateMessage(kResponseEvent, this)); @@ -318,12 +326,14 @@ std::shared_ptr SketchPlugin_Plugin std::shared_ptr aData = aSketchFeature->data(); if (aData) { std::shared_ptr aNormal = - std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); // it is important to check whether the normal attribute is initialized - // because it is possible that normal values are filled when the plane is checked on validity - aHasSketchPlane = aNormal && aNormal->isInitialized() && - !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0); + // because it is possible that normal values are filled when the plane is + // checked on validity + aHasSketchPlane = + aNormal && aNormal->isInitialized() && + !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0); aMsg->setState(SketchPlugin_Point::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_IntersectionPoint::ID(), aHasSketchPlane); @@ -336,12 +346,14 @@ std::shared_ptr SketchPlugin_Plugin aMsg->setState(SketchPlugin_EllipticArc::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_Projection::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintCoincidence::ID(), aHasSketchPlane); - aMsg->setState(SketchPlugin_ConstraintCoincidenceInternal::ID(), aHasSketchPlane); + aMsg->setState(SketchPlugin_ConstraintCoincidenceInternal::ID(), + aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintCollinear::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintDistance::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintLength::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintParallel::ID(), aHasSketchPlane); - aMsg->setState(SketchPlugin_ConstraintPerpendicular::ID(), aHasSketchPlane); + aMsg->setState(SketchPlugin_ConstraintPerpendicular::ID(), + aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintRadius::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintRigid::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_ConstraintHorizontal::ID(), aHasSketchPlane); @@ -362,11 +374,14 @@ std::shared_ptr SketchPlugin_Plugin aMsg->setState(SketchPlugin_MacroCircle::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_MacroEllipse::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_MacroEllipticArc::ID(), aHasSketchPlane); - aMsg->setState(SketchPlugin_ConstraintDistanceHorizontal::ID(), aHasSketchPlane); - aMsg->setState(SketchPlugin_ConstraintDistanceVertical::ID(), aHasSketchPlane); + aMsg->setState(SketchPlugin_ConstraintDistanceHorizontal::ID(), + aHasSketchPlane); + aMsg->setState(SketchPlugin_ConstraintDistanceVertical::ID(), + aHasSketchPlane); aMsg->setState(SketchPlugin_CurveFitting::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_Offset::ID(), aHasSketchPlane); - // SketchRectangle is a python feature, so its ID is passed just as a string + // SketchRectangle is a python feature, so its ID is passed just as a + // string aMsg->setState("SketchRectangle", aHasSketchPlane); } } diff --git a/src/SketchPlugin/SketchPlugin_Plugin.h b/src/SketchPlugin/SketchPlugin_Plugin.h index 4e9563921..4109ac806 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.h +++ b/src/SketchPlugin/SketchPlugin_Plugin.h @@ -14,38 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SKETCHPLUGIN_PLUGIN_H_ #define SKETCHPLUGIN_PLUGIN_H_ -#include #include -#include -#include #include +#include +#include +#include /**\class SketchPlugin_Plugin * \ingroup Plugins - * \brief Interface common for any plugin: allows to use plugin by the plugins manager. + * \brief Interface common for any plugin: allows to use plugin by the plugins + * manager. */ -class SketchPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener -{ +class SketchPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener { public: /// Creates the feature object of this plugin by the feature string ID - SKETCHPLUGIN_EXPORT virtual FeaturePtr createFeature(std::string theFeatureID); + SKETCHPLUGIN_EXPORT virtual FeaturePtr + createFeature(std::string theFeatureID); /// Constructor that registers features and other plugin elements. SKETCHPLUGIN_EXPORT SketchPlugin_Plugin(); //! Redefinition of Events_Listener method - SKETCHPLUGIN_EXPORT virtual void processEvent(const std::shared_ptr& theMessage); + SKETCHPLUGIN_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage); protected: - //! Returns the state of the feature in the WorkBench: enabled or disabled for the moment. - std::shared_ptr getFeaturesState( - const std::shared_ptr& theFeature) const; + //! Returns the state of the feature in the WorkBench: enabled or disabled for + //! the moment. + std::shared_ptr + getFeaturesState(const std::shared_ptr &theFeature) const; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index ddf6edfa9..08bcef246 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -14,47 +14,48 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Point.h" #include "SketchPlugin_Sketch.h" +#include #include #include -#include -#include #include +#include #include #include -#include #include +#include -SketchPlugin_Point::SketchPlugin_Point() - : SketchPlugin_SketchEntity() -{ -} +SketchPlugin_Point::SketchPlugin_Point() : SketchPlugin_SketchEntity() {} -void SketchPlugin_Point::initDerivedClassAttributes() -{ - data()->addAttribute(SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D::typeId()); +void SketchPlugin_Point::initDerivedClassAttributes() { + data()->addAttribute(SketchPlugin_Point::COORD_ID(), + GeomDataAPI_Point2D::typeId()); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); } -void SketchPlugin_Point::execute() -{ - SketchPlugin_Sketch* aSketch = sketch(); +void SketchPlugin_Point::execute() { + SketchPlugin_Sketch *aSketch = sketch(); if (aSketch) { // compute a point in 3D view std::shared_ptr aPoint = std::dynamic_pointer_cast( data()->attribute(SketchPlugin_Point::COORD_ID())); - std::shared_ptr aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y())); + std::shared_ptr aPoint3D( + aSketch->to3D(aPoint->x(), aPoint->y())); // make a visible point - std::shared_ptr aPointShape = GeomAlgoAPI_PointBuilder::vertex(aPoint3D); - std::shared_ptr aConstr = document()->createConstruction(data()); + std::shared_ptr aPointShape = + GeomAlgoAPI_PointBuilder::vertex(aPoint3D); + std::shared_ptr aConstr = + document()->createConstruction(data()); aConstr->setShape(aPointShape); aConstr->setIsInHistory(false); setResult(aConstr); @@ -65,10 +66,11 @@ bool SketchPlugin_Point::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } -void SketchPlugin_Point::attributeChanged(const std::string& theID) { +void SketchPlugin_Point::attributeChanged(const std::string &theID) { // the second condition for inability to move external point anywhere if (theID == EXTERNAL_ID() || isFixed()) { - std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); + std::shared_ptr aSelection = + data()->selection(EXTERNAL_ID())->value(); if (!aSelection) { // empty shape in selection shows that the shape is equal to context ResultPtr anExtRes = selection(EXTERNAL_ID())->context(); @@ -79,7 +81,7 @@ void SketchPlugin_Point::attributeChanged(const std::string& theID) { if (aSelection && !aSelection->isNull() && aSelection->isVertex()) { std::shared_ptr aVertex(new GeomAPI_Vertex(aSelection)); std::shared_ptr aCoordAttr = - std::dynamic_pointer_cast(attribute(COORD_ID())); + std::dynamic_pointer_cast(attribute(COORD_ID())); aCoordAttr->setValue(sketch()->to2D(aVertex->point())); } } diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index 047fd0101..26828c0b2 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -14,39 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Point_H_ #define SketchPlugin_Point_H_ #include "SketchPlugin.h" -#include #include "SketchPlugin_SketchEntity.h" +#include #include /**\class SketchPlugin_Point * \ingroup Plugins * \brief Feature for creation of a new point. */ -class SketchPlugin_Point : public SketchPlugin_SketchEntity -{ - public: +class SketchPlugin_Point : public SketchPlugin_SketchEntity { +public: /// Point feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_POINT_ID("SketchPoint"); return MY_POINT_ID; } /// Coordinates of the point - inline static const std::string& COORD_ID() - { + inline static const std::string &COORD_ID() { static const std::string MY_COORD_ID("PointCoordinates"); return MY_COORD_ID; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Point::ID(); return MY_KIND; } @@ -57,8 +54,9 @@ class SketchPlugin_Point : public SketchPlugin_SketchEntity /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Called on change of any argument-attribute of this object: for external point - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + /// Called on change of any argument-attribute of this object: for external + /// point + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); /// Use plugin manager for features creation SketchPlugin_Point(); diff --git a/src/SketchPlugin/SketchPlugin_Projection.cpp b/src/SketchPlugin/SketchPlugin_Projection.cpp index 9d0ff96e9..25258b3cb 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.cpp +++ b/src/SketchPlugin/SketchPlugin_Projection.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,24 +24,24 @@ #include #include #include +#include #include #include #include #include #include -#include -#include -#include #include #include #include +#include +#include #include +#include #include #include -#include #include -#include +#include #include @@ -62,51 +63,54 @@ static const double tolerance = 1.e-7; static const std::string THE_KEEP_REF("true"); -static bool isKeepReference(AttributeStringPtr theAttr) -{ - return !theAttr || !theAttr->isInitialized() || theAttr->value() == THE_KEEP_REF; +static bool isKeepReference(AttributeStringPtr theAttr) { + return !theAttr || !theAttr->isInitialized() || + theAttr->value() == THE_KEEP_REF; } - SketchPlugin_Projection::SketchPlugin_Projection() - : SketchPlugin_SketchEntity(), - myIsComputing(false) -{ -} - -void SketchPlugin_Projection::initDerivedClassAttributes() -{ - data()->addAttribute(EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(PROJECTED_FEATURE_ID(), ModelAPI_AttributeRefAttr::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PROJECTED_FEATURE_ID()); + : SketchPlugin_SketchEntity(), myIsComputing(false) {} + +void SketchPlugin_Projection::initDerivedClassAttributes() { + data()->addAttribute(EXTERNAL_FEATURE_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(PROJECTED_FEATURE_ID(), + ModelAPI_AttributeRefAttr::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PROJECTED_FEATURE_ID()); data()->attribute(PROJECTED_FEATURE_ID())->setIsArgument(false); data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + EXTERNAL_ID()); - data()->addAttribute(INCLUDE_INTO_RESULT(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(INCLUDE_INTO_RESULT(), + ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), AUXILIARY_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + AUXILIARY_ID()); } -void SketchPlugin_Projection::initDerivedClassAttributes2() -{ - AttributePtr aKeepRefAttr = - data()->addAttribute(KEEP_REFERENCE_ID(), ModelAPI_AttributeString::typeId()); +void SketchPlugin_Projection::initDerivedClassAttributes2() { + AttributePtr aKeepRefAttr = data()->addAttribute( + KEEP_REFERENCE_ID(), ModelAPI_AttributeString::typeId()); if (!aKeepRefAttr->isInitialized()) { - std::dynamic_pointer_cast(aKeepRefAttr)->setValue(THE_KEEP_REF); + std::dynamic_pointer_cast(aKeepRefAttr) + ->setValue(THE_KEEP_REF); } data()->addAttribute(MAKE_FIXED(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAKE_FIXED()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + MAKE_FIXED()); - data()->addAttribute(FIXED_CONSTRAINT_ID(), ModelAPI_AttributeReference::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FIXED_CONSTRAINT_ID()); + data()->addAttribute(FIXED_CONSTRAINT_ID(), + ModelAPI_AttributeReference::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), FIXED_CONSTRAINT_ID()); data()->attribute(FIXED_CONSTRAINT_ID())->setIsArgument(false); } -void SketchPlugin_Projection::execute() -{ +void SketchPlugin_Projection::execute() { AttributeRefAttrPtr aRefAttr = data()->refattr(PROJECTED_FEATURE_ID()); if (!aRefAttr || !aRefAttr->isInitialized()) return; @@ -122,51 +126,48 @@ void SketchPlugin_Projection::execute() setResult(aConstr); if (hasProjResult) - aProjection->selection(EXTERNAL_ID())->setValue(lastResult(), lastResult()->shape()); + aProjection->selection(EXTERNAL_ID()) + ->setValue(lastResult(), lastResult()->shape()); } - // is sketch plane is changed (issue 1791), attribute of projection is not changed, but - // projection must be fully recomputed + // is sketch plane is changed (issue 1791), attribute of projection is not + // changed, but projection must be fully recomputed computeProjection(EXTERNAL_FEATURE_ID()); } -bool SketchPlugin_Projection::isMacro() const -{ +bool SketchPlugin_Projection::isMacro() const { if (!data() || !data()->isValid()) return false; AttributeStringPtr aKeepRefAttr = - const_cast(this)->string(KEEP_REFERENCE_ID()); + const_cast(this)->string(KEEP_REFERENCE_ID()); return !isKeepReference(aKeepRefAttr); } -void SketchPlugin_Projection::attributeChanged(const std::string& theID) -{ - if ((theID == EXTERNAL_FEATURE_ID() || theID == EXTERNAL_ID()) && !myIsComputing) { +void SketchPlugin_Projection::attributeChanged(const std::string &theID) { + if ((theID == EXTERNAL_FEATURE_ID() || theID == EXTERNAL_ID()) && + !myIsComputing) { myIsComputing = true; computeProjection(theID); myIsComputing = false; } } -static const std::set& POINT_PROJECTION() -{ +static const std::set &POINT_PROJECTION() { static std::set aProj; if (aProj.empty()) aProj.insert(SketchPlugin_Point::ID()); return aProj; } -static const std::set& LINE_PROJECTION() -{ +static const std::set &LINE_PROJECTION() { static std::set aProj; if (aProj.empty()) aProj.insert(SketchPlugin_Line::ID()); return aProj; } -static const std::set& CIRCLE_ELLIPSE_PROJECTION() -{ +static const std::set &CIRCLE_ELLIPSE_PROJECTION() { static std::set aProj; if (aProj.empty()) { aProj.insert(SketchPlugin_Circle::ID()); @@ -175,8 +176,7 @@ static const std::set& CIRCLE_ELLIPSE_PROJECTION() return aProj; } -static const std::set& ARC_PROJECTION() -{ +static const std::set &ARC_PROJECTION() { static std::set aProj; if (aProj.empty()) { aProj.insert(SketchPlugin_Arc::ID()); @@ -185,8 +185,7 @@ static const std::set& ARC_PROJECTION() return aProj; } -static const std::set& BSPLINE_PROJECTION() -{ +static const std::set &BSPLINE_PROJECTION() { static std::set aProj; if (aProj.empty()) { aProj.insert(SketchPlugin_BSpline::ID()); @@ -195,10 +194,8 @@ static const std::set& BSPLINE_PROJECTION() return aProj; } - -static const std::set& possibleProjectionTypes(GeomEdgePtr theEdge, - GeomVertexPtr theVertex) -{ +static const std::set & +possibleProjectionTypes(GeomEdgePtr theEdge, GeomVertexPtr theVertex) { if (theVertex) return POINT_PROJECTION(); if (theEdge) { @@ -209,18 +206,17 @@ static const std::set& possibleProjectionTypes(GeomEdgePtr theEdge, return CIRCLE_ELLIPSE_PROJECTION(); else return ARC_PROJECTION(); - } - else + } else return BSPLINE_PROJECTION(); } static const std::set DUMMY; return DUMMY; } -void SketchPlugin_Projection::computeProjection(const std::string& theID) -{ +void SketchPlugin_Projection::computeProjection(const std::string &theID) { AttributeSelectionPtr aExtFeature = - std::dynamic_pointer_cast(attribute(EXTERNAL_FEATURE_ID())); + std::dynamic_pointer_cast( + attribute(EXTERNAL_FEATURE_ID())); GeomShapePtr aShape; GeomEdgePtr anEdge; @@ -238,22 +234,26 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) if (!anEdge && !aVertex) return; - const std::set& aProjType = possibleProjectionTypes(anEdge, aVertex); + const std::set &aProjType = + possibleProjectionTypes(anEdge, aVertex); AttributeRefAttrPtr aRefAttr = data()->refattr(PROJECTED_FEATURE_ID()); FeaturePtr aProjection; if (aRefAttr && aRefAttr->isInitialized()) aProjection = ModelAPI_Feature::feature(aRefAttr->object()); - // if the type of feature differs with already selected, remove it and create once again + // if the type of feature differs with already selected, remove it and create + // once again bool isRebuild = rebuildProjectedFeature(aProjection, aProjType); ResultConstructionPtr aResult = std::dynamic_pointer_cast(lastResult()); - if (!isRebuild && aResult && aResult->shape() && theID == EXTERNAL_FEATURE_ID()) { + if (!isRebuild && aResult && aResult->shape() && + theID == EXTERNAL_FEATURE_ID()) { aResult->setShape(std::shared_ptr()); if (aProjection) - aProjection->selection(EXTERNAL_ID())->setValue(ResultPtr(), GeomShapePtr()); + aProjection->selection(EXTERNAL_ID()) + ->setValue(ResultPtr(), GeomShapePtr()); } keepCurrentFeature(); @@ -276,7 +276,8 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) restoreCurrentFeature(); AttributeBooleanPtr aMakeFixedAttr = boolean(MAKE_FIXED()); - bool isMakeFixed = aMakeFixedAttr && aMakeFixedAttr->isInitialized() && aMakeFixedAttr->value(); + bool isMakeFixed = aMakeFixedAttr && aMakeFixedAttr->isInitialized() && + aMakeFixedAttr->value(); AttributeReferencePtr aFixedConstrAttr = reference(FIXED_CONSTRAINT_ID()); FeaturePtr aFixedConstraint; @@ -291,19 +292,19 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) aResult->setShape(aProjection->lastResult()->shape()); setResult(aResult); GeomShapePtr anEmptyVal; - aProjection->selection(EXTERNAL_ID())->setValue(lastResult(), anEmptyVal); + aProjection->selection(EXTERNAL_ID()) + ->setValue(lastResult(), anEmptyVal); } } - } - else if (isMakeFixed) { + } else if (isMakeFixed) { // fix the projected entity with the Fixed constraint if (!aFixedConstraint) - aFixedConstraint = sketch()->addFeature(SketchPlugin_ConstraintRigid::ID()); - aFixedConstraint->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject( - aProjection->lastResult()); + aFixedConstraint = + sketch()->addFeature(SketchPlugin_ConstraintRigid::ID()); + aFixedConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(aProjection->lastResult()); } - // remove Fixed constraint in case of redundance if (aFixedConstraint && (keepBackRef || !isMakeFixed)) { document()->removeFeature(aFixedConstraint); @@ -311,23 +312,25 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) } aFixedConstrAttr->setValue(aFixedConstraint); - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); ModelAPI_EventCreator::get()->sendUpdated(aProjection, anEvent, false); } bool SketchPlugin_Projection::rebuildProjectedFeature( - FeaturePtr& theProjection, - const std::set& theSupportedTypes, - const std::string& theRequestedFeature) -{ + FeaturePtr &theProjection, const std::set &theSupportedTypes, + const std::string &theRequestedFeature) { bool isRebuild = false; - if (theProjection && - (theSupportedTypes.find(theProjection->getKind()) == theSupportedTypes.end() || - (!theRequestedFeature.empty() && theProjection->getKind() != theRequestedFeature))) { + if (theProjection && (theSupportedTypes.find(theProjection->getKind()) == + theSupportedTypes.end() || + (!theRequestedFeature.empty() && + theProjection->getKind() != theRequestedFeature))) { DocumentPtr aDoc = sketch()->document(); AttributeRefAttrPtr aRefAttr = data()->refattr(PROJECTED_FEATURE_ID()); - aRefAttr->setObject(data()->owner()); // to not remove of this remove reference to aProjection + aRefAttr->setObject( + data() + ->owner()); // to not remove of this remove reference to aProjection std::set aFeaturesToBeRemoved; aFeaturesToBeRemoved.insert(theProjection); ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved); @@ -341,48 +344,55 @@ bool SketchPlugin_Projection::rebuildProjectedFeature( return isRebuild; } -bool SketchPlugin_Projection::projectPoint(FeaturePtr& theProjection, const GeomPointPtr& thePoint) -{ +bool SketchPlugin_Projection::projectPoint(FeaturePtr &theProjection, + const GeomPointPtr &thePoint) { std::shared_ptr aSketchPlane = sketch()->plane(); std::shared_ptr aPrjPnt = aSketchPlane->project(thePoint); std::shared_ptr aPntInSketch = sketch()->to2D(aPrjPnt); - rebuildProjectedFeature(theProjection, POINT_PROJECTION(), SketchPlugin_Point::ID()); + rebuildProjectedFeature(theProjection, POINT_PROJECTION(), + SketchPlugin_Point::ID()); // update coordinates of projection std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Point::COORD_ID()))->setValue(aPntInSketch); + theProjection->attribute(SketchPlugin_Point::COORD_ID())) + ->setValue(aPntInSketch); return true; } -bool SketchPlugin_Projection::projectSegment(FeaturePtr& theProjection, const GeomEdgePtr& theEdge) -{ +bool SketchPlugin_Projection::projectSegment(FeaturePtr &theProjection, + const GeomEdgePtr &theEdge) { std::shared_ptr aSketchPlane = sketch()->plane(); - std::shared_ptr aFirst = aSketchPlane->project(theEdge->firstPoint()); - std::shared_ptr aLast = aSketchPlane->project(theEdge->lastPoint()); + std::shared_ptr aFirst = + aSketchPlane->project(theEdge->firstPoint()); + std::shared_ptr aLast = + aSketchPlane->project(theEdge->lastPoint()); std::shared_ptr aFirstInSketch = sketch()->to2D(aFirst); std::shared_ptr aLastInSketch = sketch()->to2D(aLast); if (aFirstInSketch->distance(aLastInSketch) < tolerance) return false; // line is semi-orthogonal to the sketch plane - rebuildProjectedFeature(theProjection, LINE_PROJECTION(), SketchPlugin_Line::ID()); + rebuildProjectedFeature(theProjection, LINE_PROJECTION(), + SketchPlugin_Line::ID()); // update attributes of projection - std::shared_ptr aStartPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aEndPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aStartPnt = + std::dynamic_pointer_cast( + theProjection->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aEndPnt = + std::dynamic_pointer_cast( + theProjection->attribute(SketchPlugin_Line::END_ID())); aStartPnt->setValue(aFirstInSketch); aEndPnt->setValue(aLastInSketch); return true; } -bool SketchPlugin_Projection::projectEdge(FeaturePtr& theProjection, const GeomEdgePtr& theEdge) -{ +bool SketchPlugin_Projection::projectEdge(FeaturePtr &theProjection, + const GeomEdgePtr &theEdge) { if (theEdge->isLine()) return projectSegment(theProjection, theEdge); @@ -396,34 +406,31 @@ bool SketchPlugin_Projection::projectEdge(FeaturePtr& theProjection, const GeomE if (aProjectedCurve->isTrimmed()) { // ARC is a projection isOk = fillArc(theProjection, aProjectedCurve, aSketchPlane, theEdge); - } - else { + } else { // CIRCLE is a projection isOk = fillCircle(theProjection, aProjectedCurve, aSketchPlane); } - } - else if (aProjectedCurve->isEllipse()) { + } else if (aProjectedCurve->isEllipse()) { if (aProjectedCurve->isTrimmed()) { // ELLIPTIC ARC is a projection - isOk = fillEllipticArc(theProjection, aProjectedCurve, aSketchPlane, theEdge); - } - else { + isOk = fillEllipticArc(theProjection, aProjectedCurve, aSketchPlane, + theEdge); + } else { // ELLIPSE is a projection isOk = fillEllipse(theProjection, aProjectedCurve, aSketchPlane); } - } - else + } else isOk = fillBSpline(theProjection, aProjectedCurve, aSketchPlane); return isOk; } -bool SketchPlugin_Projection::fillArc(FeaturePtr& theProjection, - const GeomCurvePtr& theArc, - const GeomPlanePtr& thePlane, - const GeomEdgePtr& theOriginalEdge) -{ - rebuildProjectedFeature(theProjection, ARC_PROJECTION(), SketchPlugin_Arc::ID()); +bool SketchPlugin_Projection::fillArc(FeaturePtr &theProjection, + const GeomCurvePtr &theArc, + const GeomPlanePtr &thePlane, + const GeomEdgePtr &theOriginalEdge) { + rebuildProjectedFeature(theProjection, ARC_PROJECTION(), + SketchPlugin_Arc::ID()); GeomAPI_Circ aCircle(theArc); @@ -454,13 +461,13 @@ bool SketchPlugin_Projection::fillArc(FeaturePtr& theProjection, // update attributes of projection std::shared_ptr aCenterPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Arc::CENTER_ID())); + theProjection->attribute(SketchPlugin_Arc::CENTER_ID())); std::shared_ptr aStartPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Arc::START_ID())); + theProjection->attribute(SketchPlugin_Arc::START_ID())); std::shared_ptr aEndPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Arc::END_ID())); + theProjection->attribute(SketchPlugin_Arc::END_ID())); aStartPnt->setValue(aFirstInSketch); aEndPnt->setValue(aLastInSketch); aCenterPnt->setValue(aCenterInSketch); @@ -470,11 +477,11 @@ bool SketchPlugin_Projection::fillArc(FeaturePtr& theProjection, return true; } -bool SketchPlugin_Projection::fillCircle(FeaturePtr& theProjection, - const GeomCurvePtr& theCircle, - const GeomPlanePtr& thePlane) -{ - rebuildProjectedFeature(theProjection, CIRCLE_ELLIPSE_PROJECTION(), SketchPlugin_Circle::ID()); +bool SketchPlugin_Projection::fillCircle(FeaturePtr &theProjection, + const GeomCurvePtr &theCircle, + const GeomPlanePtr &thePlane) { + rebuildProjectedFeature(theProjection, CIRCLE_ELLIPSE_PROJECTION(), + SketchPlugin_Circle::ID()); GeomAPI_Circ aCircle(theCircle); GeomPointPtr aCenter = thePlane->project(aCircle.center()); @@ -483,17 +490,18 @@ bool SketchPlugin_Projection::fillCircle(FeaturePtr& theProjection, // update attributes of projection std::shared_ptr aCenterPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Circle::CENTER_ID())); + theProjection->attribute(SketchPlugin_Circle::CENTER_ID())); aCenterPnt->setValue(aCenterInSketch); - theProjection->real(SketchPlugin_Circle::RADIUS_ID())->setValue(aCircle.radius()); + theProjection->real(SketchPlugin_Circle::RADIUS_ID()) + ->setValue(aCircle.radius()); return true; } -bool SketchPlugin_Projection::fillEllipse(FeaturePtr& theProjection, - const GeomCurvePtr& theEllipse, - const GeomPlanePtr& thePlane) -{ - rebuildProjectedFeature(theProjection, CIRCLE_ELLIPSE_PROJECTION(), SketchPlugin_Ellipse::ID()); +bool SketchPlugin_Projection::fillEllipse(FeaturePtr &theProjection, + const GeomCurvePtr &theEllipse, + const GeomPlanePtr &thePlane) { + rebuildProjectedFeature(theProjection, CIRCLE_ELLIPSE_PROJECTION(), + SketchPlugin_Ellipse::ID()); GeomAPI_Ellipse anEllipse(theEllipse); GeomPointPtr aCenter = thePlane->project(anEllipse.center()); @@ -504,22 +512,22 @@ bool SketchPlugin_Projection::fillEllipse(FeaturePtr& theProjection, // update attributes of projection std::shared_ptr aCenterPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Ellipse::CENTER_ID())); + theProjection->attribute(SketchPlugin_Ellipse::CENTER_ID())); aCenterPnt->setValue(aCenterInSketch); std::shared_ptr aFocusPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID())); + theProjection->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID())); aFocusPnt->setValue(aFocusInSketch); - theProjection->real(SketchPlugin_Ellipse::MINOR_RADIUS_ID())->setValue(anEllipse.minorRadius()); + theProjection->real(SketchPlugin_Ellipse::MINOR_RADIUS_ID()) + ->setValue(anEllipse.minorRadius()); return true; } -bool SketchPlugin_Projection::fillEllipticArc(FeaturePtr& theProjection, - const GeomCurvePtr& theEllipticArc, - const GeomPlanePtr& thePlane, - const GeomEdgePtr& theOriginalEdge) -{ - rebuildProjectedFeature(theProjection, ARC_PROJECTION(), SketchPlugin_EllipticArc::ID()); +bool SketchPlugin_Projection::fillEllipticArc( + FeaturePtr &theProjection, const GeomCurvePtr &theEllipticArc, + const GeomPlanePtr &thePlane, const GeomEdgePtr &theOriginalEdge) { + rebuildProjectedFeature(theProjection, ARC_PROJECTION(), + SketchPlugin_EllipticArc::ID()); GeomAPI_Ellipse anEllipse(theEllipticArc); @@ -551,39 +559,43 @@ bool SketchPlugin_Projection::fillEllipticArc(FeaturePtr& theProjection, // update attributes of projection std::shared_ptr aCenterPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_EllipticArc::CENTER_ID())); + theProjection->attribute(SketchPlugin_EllipticArc::CENTER_ID())); std::shared_ptr aFocusPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_EllipticArc::FIRST_FOCUS_ID())); + theProjection->attribute(SketchPlugin_EllipticArc::FIRST_FOCUS_ID())); std::shared_ptr aStartPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); + theProjection->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); std::shared_ptr aEndPnt = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_EllipticArc::END_POINT_ID())); + theProjection->attribute(SketchPlugin_EllipticArc::END_POINT_ID())); aStartPnt->setValue(aFirstInSketch); aEndPnt->setValue(aLastInSketch); aCenterPnt->setValue(aCenterInSketch); aFocusPnt->setValue(aFocusInSketch); - theProjection->boolean(SketchPlugin_EllipticArc::REVERSED_ID())->setValue(isInversed); + theProjection->boolean(SketchPlugin_EllipticArc::REVERSED_ID()) + ->setValue(isInversed); theProjection->data()->blockSendAttributeUpdated(aWasBlocked); return true; } -bool SketchPlugin_Projection::fillBSpline(FeaturePtr& theProjection, - const GeomCurvePtr& theCurve, - const GeomPlanePtr& /*thePlane*/) -{ +bool SketchPlugin_Projection::fillBSpline(FeaturePtr &theProjection, + const GeomCurvePtr &theCurve, + const GeomPlanePtr & /*thePlane*/) { GeomAPI_BSpline aBSpline(theCurve); rebuildProjectedFeature(theProjection, BSPLINE_PROJECTION(), - aBSpline.isPeriodic() ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID()); + aBSpline.isPeriodic() + ? SketchPlugin_BSplinePeriodic::ID() + : SketchPlugin_BSpline::ID()); - theProjection->integer(SketchPlugin_BSpline::DEGREE_ID())->setValue(aBSpline.degree()); + theProjection->integer(SketchPlugin_BSpline::DEGREE_ID()) + ->setValue(aBSpline.degree()); - AttributePoint2DArrayPtr aPolesAttr = std::dynamic_pointer_cast( - theProjection->attribute(SketchPlugin_BSpline::POLES_ID())); + AttributePoint2DArrayPtr aPolesAttr = + std::dynamic_pointer_cast( + theProjection->attribute(SketchPlugin_BSpline::POLES_ID())); std::list aPoles = aBSpline.poles(); aPolesAttr->setSize((int)aPoles.size()); std::list::iterator anIt = aPoles.begin(); @@ -600,8 +612,7 @@ bool SketchPlugin_Projection::fillBSpline(FeaturePtr& theProjection, aWeightsAttr->setSize(aSize); for (int anIndex = 0; anIndex < aSize; ++anIndex) aWeightsAttr->setValue(anIndex, 1.0); - } - else { // non-rational B-spline + } else { // non-rational B-spline aWeightsAttr->setSize((int)aWeights.size()); std::list::iterator aWIt = aWeights.begin(); for (int anIndex = 0; aWIt != aWeights.end(); ++aWIt, ++anIndex) diff --git a/src/SketchPlugin/SketchPlugin_Projection.h b/src/SketchPlugin/SketchPlugin_Projection.h index c33452f21..fc1498511 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.h +++ b/src/SketchPlugin/SketchPlugin_Projection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Projection_H_ @@ -26,80 +27,69 @@ class GeomAPI_Curve; /** \class SketchPlugin_Projection * \ingroup Plugins - * \brief Feature for creation of external feature as a projection onto the sketch plane. + * \brief Feature for creation of external feature as a projection onto the + * sketch plane. */ -class SketchPlugin_Projection : public SketchPlugin_SketchEntity -{ +class SketchPlugin_Projection : public SketchPlugin_SketchEntity { public: /// Projection feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_PROJECTION_ID("SketchProjection"); return MY_PROJECTION_ID; } /// Returns the kind of a feature - virtual const std::string& getKind() - { + virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Projection::ID(); return MY_KIND; } - static const std::string& EXTERNAL_FEATURE_ID() - { + static const std::string &EXTERNAL_FEATURE_ID() { static std::string MY_EXT_FEATURE_ID("ExternalFeature"); return MY_EXT_FEATURE_ID; } - static const std::string& PROJECTED_FEATURE_ID() - { + static const std::string &PROJECTED_FEATURE_ID() { static std::string MY_PROJ_FEATURE_ID("ProjectedFeature"); return MY_PROJ_FEATURE_ID; } - static const std::string& INCLUDE_INTO_RESULT() - { + static const std::string &INCLUDE_INTO_RESULT() { static std::string MY_INCLUDE("IncludeToResult"); return MY_INCLUDE; } - static const std::string& KEEP_REFERENCE_ID() - { + static const std::string &KEEP_REFERENCE_ID() { static std::string ID("keep_reference"); return ID; } - static const std::string& MAKE_FIXED() - { + static const std::string &MAKE_FIXED() { static std::string ID("make_fixed"); return ID; } - static const std::string& FIXED_CONSTRAINT_ID() - { + static const std::string &FIXED_CONSTRAINT_ID() { static std::string ID("fixed_constraint"); return ID; } /// Returns true because projected feature is always external - virtual bool isFixed() - { return true; } + virtual bool isFixed() { return true; } /// Returns true if the feature and the feature results can be displayed. /// \return false - SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const - { - return false; - } + SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const { return false; } /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Called on change of any argument-attribute of this object: for external point - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + /// Called on change of any argument-attribute of this object: for external + /// point + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); - /// Returns true if this feature is used as macro: creates other features and then removed. - /// This feature may change its macro-state according to selected item. - /// \returns false by default + /// Returns true if this feature is used as macro: creates other features and + /// then removed. This feature may change its macro-state according to + /// selected item. \returns false by default SKETCHPLUGIN_EXPORT virtual bool isMacro() const; /// Use plugin manager for features creation @@ -109,52 +99,57 @@ protected: /// \brief Initializes attributes of derived class. virtual void initDerivedClassAttributes(); - /// \brief Initializes attributes of keeping the reference to the original shape. + /// \brief Initializes attributes of keeping the reference to the original + /// shape. virtual void initDerivedClassAttributes2(); private: /// \brief Find projection of a feature onto sketch plane - void computeProjection(const std::string& theID); + void computeProjection(const std::string &theID); /// \brief Project point to the sketch plane - bool projectPoint(FeaturePtr& theProjection, const std::shared_ptr& thePoint); + bool projectPoint(FeaturePtr &theProjection, + const std::shared_ptr &thePoint); /// \brief Project segment to the sketch plane - bool projectSegment(FeaturePtr& theProjection, const std::shared_ptr& theEdge); + bool projectSegment(FeaturePtr &theProjection, + const std::shared_ptr &theEdge); /// \brief Project any edge to sketch plane - bool projectEdge(FeaturePtr& theProjection, const std::shared_ptr& theEdge); + bool projectEdge(FeaturePtr &theProjection, + const std::shared_ptr &theEdge); /// \brief Fill attributes of the Arc feature - bool fillArc(FeaturePtr& theProjection, - const std::shared_ptr& theArc, - const std::shared_ptr& thePlane, - const std::shared_ptr& theOriginalEdge); + bool fillArc(FeaturePtr &theProjection, + const std::shared_ptr &theArc, + const std::shared_ptr &thePlane, + const std::shared_ptr &theOriginalEdge); /// \brief Fill attributes of the Circle feature - bool fillCircle(FeaturePtr& theProjection, - const std::shared_ptr& theCircle, - const std::shared_ptr& thePlane); + bool fillCircle(FeaturePtr &theProjection, + const std::shared_ptr &theCircle, + const std::shared_ptr &thePlane); /// \brief Fill attributes of the Ellipse feature - bool fillEllipse(FeaturePtr& theProjection, - const std::shared_ptr& theEllipse, - const std::shared_ptr& thePlane); + bool fillEllipse(FeaturePtr &theProjection, + const std::shared_ptr &theEllipse, + const std::shared_ptr &thePlane); /// \brief Fill attributes of the EllipticArc feature - bool fillEllipticArc(FeaturePtr& theProjection, - const std::shared_ptr& theEllipticArc, - const std::shared_ptr& thePlane, - const std::shared_ptr& theOriginalEdge); + bool fillEllipticArc(FeaturePtr &theProjection, + const std::shared_ptr &theEllipticArc, + const std::shared_ptr &thePlane, + const std::shared_ptr &theOriginalEdge); /// \brief Fill attributes of the B-spline feature - bool fillBSpline(FeaturePtr& theProjection, - const std::shared_ptr& theCurve, - const std::shared_ptr& thePlane); + bool fillBSpline(FeaturePtr &theProjection, + const std::shared_ptr &theCurve, + const std::shared_ptr &thePlane); /// \brief Delete already calculated projected feature /// if the selection of the projection is changed /// \param[in/out] theProjection projected feature - /// \param[in] theSupportedTypes types supported relatively to the base selection - /// \param[in] theRequestedFeature type of the new feature to be created + /// \param[in] theSupportedTypes types supported relatively to the base + /// selection \param[in] theRequestedFeature type of the new feature to be + /// created /// (remove only if empty string). - bool rebuildProjectedFeature(FeaturePtr& theProjection, - const std::set& theSupportedTypes, - const std::string& theRequestedFeature = std::string()); + bool rebuildProjectedFeature( + FeaturePtr &theProjection, const std::set &theSupportedTypes, + const std::string &theRequestedFeature = std::string()); bool myIsComputing; }; diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index 1d3c560da..e399edd08 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -29,24 +30,24 @@ #include #include -#include #include +#include #include #include #include #include +#include #include #include #include -#include #include -#include +#include -#include #include #include #include +#include #include #include @@ -58,78 +59,95 @@ #include #include -SketchPlugin_Sketch::SketchPlugin_Sketch() -{ -} - -void SketchPlugin_Sketch::initAttributes() -{ - data()->addAttribute(SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point::typeId()); - data()->addAttribute(SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir::typeId()); - data()->addAttribute(SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir::typeId()); - data()->addAttribute(SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList::typeId()); +SketchPlugin_Sketch::SketchPlugin_Sketch() {} + +void SketchPlugin_Sketch::initAttributes() { + data()->addAttribute(SketchPlugin_Sketch::ORIGIN_ID(), + GeomDataAPI_Point::typeId()); + data()->addAttribute(SketchPlugin_Sketch::DIRX_ID(), + GeomDataAPI_Dir::typeId()); + data()->addAttribute(SketchPlugin_Sketch::NORM_ID(), + GeomDataAPI_Dir::typeId()); + data()->addAttribute(SketchPlugin_Sketch::FEATURES_ID(), + ModelAPI_AttributeRefList::typeId()); // the selected face, base for the sketcher plane, not obligatory data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(), - ModelAPI_AttributeSelection::typeId()); + ModelAPI_AttributeSelection::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID()); - data()->addAttribute(SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString::typeId()); + getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID()); + data()->addAttribute(SketchPlugin_Sketch::SOLVER_ERROR(), + ModelAPI_AttributeString::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), SketchPlugin_Sketch::SOLVER_ERROR()); - data()->addAttribute(SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString::typeId()); + getKind(), SketchPlugin_Sketch::SOLVER_ERROR()); + data()->addAttribute(SketchPlugin_Sketch::SOLVER_DOF(), + ModelAPI_AttributeString::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory( - getKind(), SketchPlugin_Sketch::SOLVER_DOF()); + getKind(), SketchPlugin_Sketch::SOLVER_DOF()); } -void SketchPlugin_Sketch::execute() -{ +void SketchPlugin_Sketch::execute() { if (!data()->isValid()) return; - std::shared_ptr aRefList = std::dynamic_pointer_cast< - ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID())); - - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aDirX = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aRefList = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::FEATURES_ID())); + + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aDirX = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::NORM_ID())); std::list aFeatures = aRefList->list(); if (aFeatures.empty()) // actually, this must be avoided by the validators return; - std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); + std::list::const_iterator anIt = aFeatures.begin(), + aLast = aFeatures.end(); std::shared_ptr aFeature; - std::list > aFeaturesPreview; + std::list> aFeaturesPreview; for (; anIt != aLast; anIt++) { aFeature = std::dynamic_pointer_cast(*anIt); if (aFeature) { - if (!aFeature->sketch()) // on load document the back references are missed + if (!aFeature + ->sketch()) // on load document the back references are missed aFeature->setSketch(this); - // do not include into the result the external edges with disabled flag "Include into result" - if (aFeature->data()->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())) { - if (aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->context()) { - const std::string& anAttrName = - aFeature->getKind() == SketchPlugin_Projection::ID() ? - SketchPlugin_Projection::INCLUDE_INTO_RESULT() : - SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(); + // do not include into the result the external edges with disabled flag + // "Include into result" + if (aFeature->data()->attribute( + SketchPlugin_SketchEntity::EXTERNAL_ID())) { + if (aFeature->data() + ->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()) + ->context()) { + const std::string &anAttrName = + aFeature->getKind() == SketchPlugin_Projection::ID() + ? SketchPlugin_Projection::INCLUDE_INTO_RESULT() + : SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(); AttributeBooleanPtr aKeepResult = aFeature->boolean(anAttrName); if (!aKeepResult || !aKeepResult->value()) continue; } } // do not include the construction entities in the result - if (aFeature->data()->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID())) { - if (aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) + if (aFeature->data()->attribute( + SketchPlugin_SketchEntity::AUXILIARY_ID())) { + if (aFeature->data() + ->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()) continue; } - const std::list >& aRes = aFeature->results(); - std::list >::const_iterator aResIter = aRes.cbegin(); + const std::list> &aRes = + aFeature->results(); + std::list>::const_iterator aResIter = + aRes.cbegin(); for (; aResIter != aRes.cend(); aResIter++) { - std::shared_ptr aConstr = std::dynamic_pointer_cast< - ModelAPI_ResultConstruction>(*aResIter); + std::shared_ptr aConstr = + std::dynamic_pointer_cast(*aResIter); if (aConstr) { std::shared_ptr aShape = aConstr->shape(); if (aShape) @@ -141,22 +159,25 @@ void SketchPlugin_Sketch::execute() // Collect all edges as one big wire std::shared_ptr aBigWire(new GeomAPI_PlanarEdges); - std::list >::const_iterator aShapeIt = aFeaturesPreview.begin(); + std::list>::const_iterator aShapeIt = + aFeaturesPreview.begin(); for (; aShapeIt != aFeaturesPreview.end(); ++aShapeIt) { aBigWire->addEdge(*aShapeIt); } aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir()); - std::shared_ptr aConstr = document()->createConstruction(data()); + std::shared_ptr aConstr = + document()->createConstruction(data()); aConstr->setShape(aBigWire); setResult(aConstr); } -std::shared_ptr SketchPlugin_Sketch::addFeature(std::string theID) -{ +std::shared_ptr +SketchPlugin_Sketch::addFeature(std::string theID) { // It is necessary to keep and restore the current feature in the document, - // if the sketch is updated from Python API. Because in that case, the current feature - // may be a non-sketch feature, so it is required to set it back, after adding a sketch feature, - // to keep the sequence of non-sketch features within the document. + // if the sketch is updated from Python API. Because in that case, the current + // feature may be a non-sketch feature, so it is required to set it back, + // after adding a sketch feature, to keep the sequence of non-sketch features + // within the document. FeaturePtr aCurFeature = document()->currentFeature(false); std::shared_ptr aCurSketchFeature = std::dynamic_pointer_cast(aCurFeature); @@ -164,19 +185,25 @@ std::shared_ptr SketchPlugin_Sketch::addFeature(std::string th std::dynamic_pointer_cast(aCurFeature); if ((aCurSketch && aCurSketch.get() == this) || (aCurSketchFeature && aCurSketchFeature->sketch() == this)) - aCurFeature = FeaturePtr(); // no need to restore feature if it is from the current sketch + aCurFeature = FeaturePtr(); // no need to restore feature if it is from the + // current sketch // Set last feature of the sketch as current feature. - // Reason: Changing of parameter through Python API may lead to creation of new features - // (e.g. changing number of copies in MultiRotation). If the sketch is not the last - // feature in the Object Browser, then new features will be added to the end feature. - // Therefore, setting any feature below the sketch as a current feature will disable - // these newly created features. - std::shared_ptr aRefList = std::dynamic_pointer_cast< - ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID())); + // Reason: Changing of parameter through Python API may lead to creation of + // new features + // (e.g. changing number of copies in MultiRotation). If the sketch is + // not the last feature in the Object Browser, then new features will + // be added to the end feature. Therefore, setting any feature below + // the sketch as a current feature will disable these newly created + // features. + std::shared_ptr aRefList = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::FEATURES_ID())); int aSize = aRefList->size(false); - ObjectPtr aLastObject = aSize == 0 ? data()->owner() : aRefList->object(aSize - 1, false); - FeaturePtr aLastFeature = std::dynamic_pointer_cast(aLastObject); + ObjectPtr aLastObject = + aSize == 0 ? data()->owner() : aRefList->object(aSize - 1, false); + FeaturePtr aLastFeature = + std::dynamic_pointer_cast(aLastObject); document()->setCurrentFeature(aLastFeature, false); // add new feature @@ -191,16 +218,17 @@ std::shared_ptr SketchPlugin_Sketch::addFeature(std::string th data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->append(aNew); } - // set as current also after it becomes sub to set correctly enabled for other sketch subs - // or restore the previous current feature + // set as current also after it becomes sub to set correctly enabled for other + // sketch subs or restore the previous current feature document()->setCurrentFeature(aCurFeature ? aCurFeature : aNew, false); return aNew; } -void SketchPlugin_Sketch::removeFeature(std::shared_ptr theFeature) -{ - if (!data()->isValid()) // sketch is already removed (case on undo of sketch), sync is not needed +void SketchPlugin_Sketch::removeFeature( + std::shared_ptr theFeature) { + if (!data()->isValid()) // sketch is already removed (case on undo of sketch), + // sync is not needed return; AttributeRefListPtr aList = reflist(SketchPlugin_Sketch::FEATURES_ID()); // if the object is last, remove it from the list @@ -208,37 +236,38 @@ void SketchPlugin_Sketch::removeFeature(std::shared_ptr theFea if (aList->object(aList->size(true) - 1, true) == theFeature) { aList->remove(theFeature); } else { - // to keep the persistent sub-elements indexing, do not remove elements from list, - // but substitute by nulls + // to keep the persistent sub-elements indexing, do not remove elements from + // list, but substitute by nulls aList->substitute(theFeature, ObjectPtr()); } } -int SketchPlugin_Sketch::numberOfSubs(bool forTree) const -{ +int SketchPlugin_Sketch::numberOfSubs(bool forTree) const { if (forTree) return 0; return data()->reflist(FEATURES_ID())->size(false); } -std::shared_ptr SketchPlugin_Sketch::subFeature( - const int theIndex, bool forTree) -{ +std::shared_ptr +SketchPlugin_Sketch::subFeature(const int theIndex, bool forTree) { if (forTree) return FeaturePtr(); - ObjectPtr anObj = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->object(theIndex, false); + ObjectPtr anObj = data() + ->reflist(SketchPlugin_Sketch::FEATURES_ID()) + ->object(theIndex, false); FeaturePtr aRes = std::dynamic_pointer_cast(anObj); return aRes; } -int SketchPlugin_Sketch::subFeatureId(const int theIndex) const -{ - std::shared_ptr aRefList = std::dynamic_pointer_cast< - ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID())); +int SketchPlugin_Sketch::subFeatureId(const int theIndex) const { + std::shared_ptr aRefList = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::FEATURES_ID())); std::list aFeatures = aRefList->list(); std::list::const_iterator anIt = aFeatures.begin(); - int aResultIndex = 1; // number of the counted (created) features, started from 1 + int aResultIndex = + 1; // number of the counted (created) features, started from 1 int aFeatureIndex = -1; // number of the not-empty features in the list for (; anIt != aFeatures.end(); anIt++) { if (anIt->get()) @@ -250,8 +279,7 @@ int SketchPlugin_Sketch::subFeatureId(const int theIndex) const return aResultIndex; } -bool SketchPlugin_Sketch::isSub(ObjectPtr theObject) const -{ +bool SketchPlugin_Sketch::isSub(ObjectPtr theObject) const { // check is this feature of result FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); if (!aFeature) { @@ -260,28 +288,30 @@ bool SketchPlugin_Sketch::isSub(ObjectPtr theObject) const aFeature = document()->feature(aRes); } if (aFeature) { - return data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->isInList(aFeature); + return data() + ->reflist(SketchPlugin_Sketch::FEATURES_ID()) + ->isInList(aFeature); } return false; } - -static bool isOrigin(const GeomPointPtr& thePoint, const double theTolerance) -{ +static bool isOrigin(const GeomPointPtr &thePoint, const double theTolerance) { return fabs(thePoint->x()) < theTolerance && fabs(thePoint->y()) < theTolerance && fabs(thePoint->z()) < theTolerance; } -static bool isCoordinateAxis(const GeomDirPtr& theDir, const double theTolerance) -{ - return fabs(theDir->x() - 1.0) < theTolerance || fabs(theDir->x() + 1.0) < theTolerance || - fabs(theDir->y() - 1.0) < theTolerance || fabs(theDir->y() + 1.0) < theTolerance || - fabs(theDir->z() - 1.0) < theTolerance || fabs(theDir->z() + 1.0) < theTolerance; +static bool isCoordinateAxis(const GeomDirPtr &theDir, + const double theTolerance) { + return fabs(theDir->x() - 1.0) < theTolerance || + fabs(theDir->x() + 1.0) < theTolerance || + fabs(theDir->y() - 1.0) < theTolerance || + fabs(theDir->y() + 1.0) < theTolerance || + fabs(theDir->z() - 1.0) < theTolerance || + fabs(theDir->z() + 1.0) < theTolerance; } -static bool isCoordinatePlane(const GeomAx3Ptr& thePlane) -{ +static bool isCoordinatePlane(const GeomAx3Ptr &thePlane) { static const double THE_TOLERANCE = 1.e-7; if (!thePlane) return false; @@ -295,12 +325,15 @@ static bool isCoordinatePlane(const GeomAx3Ptr& thePlane) isCoordinateAxis(aDirX, THE_TOLERANCE); } -void SketchPlugin_Sketch::attributeChanged(const std::string& theID) { +void SketchPlugin_Sketch::attributeChanged(const std::string &theID) { if (theID == SketchPlugin_SketchEntity::EXTERNAL_ID()) { - AttributeSelectionPtr aSelAttr = selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); - if (aSelAttr->context().get()) { // update arguments due to the selection value + AttributeSelectionPtr aSelAttr = + selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + if (aSelAttr->context() + .get()) { // update arguments due to the selection value std::shared_ptr aSelection = aSelAttr->value(); - if (!aSelection.get()) aSelection = aSelAttr->context()->shape(); + if (!aSelection.get()) + aSelection = aSelAttr->context()->shape(); // update the sketch plane std::shared_ptr aFace; if (aSelection->isFace()) { @@ -322,43 +355,54 @@ void SketchPlugin_Sketch::attributeChanged(const std::string& theID) { aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero)); std::shared_ptr anOrigPnt(new GeomAPI_Pnt(aCoords)); // X axis is preferable to be dirX on the sketch - // here can not be very small value to avoid very close to X normal axis (issue 595) + // here can not be very small value to avoid very close to X normal + // axis (issue 595) static const double tol = 0.1; bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol; - std::shared_ptr aTempDir( - isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0)); - std::shared_ptr aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir))); - std::shared_ptr aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir))); + std::shared_ptr aTempDir(isX ? new GeomAPI_Dir(0, 1, 0) + : new GeomAPI_Dir(1, 0, 0)); + std::shared_ptr aYDir( + new GeomAPI_Dir(aNormDir->cross(aTempDir))); + std::shared_ptr aXDir( + new GeomAPI_Dir(aYDir->cross(aNormDir))); bool aWasBlocked = data()->blockSendAttributeUpdated(true); // update position of the sketch - std::shared_ptr anOrigin = std::dynamic_pointer_cast - (data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::ORIGIN_ID())); anOrigin->setValue(anOrigPnt); - std::shared_ptr aNormal = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::NORM_ID())); aNormal->setValue(aNormDir); - std::shared_ptr aDirX = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aDirX = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Sketch::DIRX_ID())); aDirX->setValue(aXDir); data()->blockSendAttributeUpdated(aWasBlocked, true); } } } } else if (theID == NORM_ID() || theID == DIRX_ID() || theID == ORIGIN_ID()) { - // check if current and previous sketch planes are coordinate planes and they are different + // check if current and previous sketch planes are coordinate planes and + // they are different GeomAx3Ptr aCurPlane; bool areCoordPlanes = false; if (isPlaneSet()) { aCurPlane = coordinatePlane(); - areCoordPlanes = isCoordinatePlane(aCurPlane) && isCoordinatePlane(myPlane); + areCoordPlanes = + isCoordinatePlane(aCurPlane) && isCoordinatePlane(myPlane); } - // send all sub-elements are also updated: all entities become created on different plane - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - std::list aSubs = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list(); + // send all sub-elements are also updated: all entities become created on + // different plane + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + std::list aSubs = + data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list(); std::list::iterator aSub = aSubs.begin(); - for(; aSub != aSubs.end(); aSub++) { + for (; aSub != aSubs.end(); aSub++) { if (aSub->get()) { if (areCoordPlanes) updateCoordinateAxis(*aSub, aCurPlane); @@ -371,49 +415,58 @@ void SketchPlugin_Sketch::attributeChanged(const std::string& theID) { } } -void SketchPlugin_Sketch::createPoint2DResult(ModelAPI_Feature* theFeature, - SketchPlugin_Sketch* theSketch, - const std::string& theAttributeID, const int theIndex) -{ - std::shared_ptr aPoint = std::dynamic_pointer_cast( - theFeature->attribute(theAttributeID)); +void SketchPlugin_Sketch::createPoint2DResult(ModelAPI_Feature *theFeature, + SketchPlugin_Sketch *theSketch, + const std::string &theAttributeID, + const int theIndex) { + std::shared_ptr aPoint = + std::dynamic_pointer_cast( + theFeature->attribute(theAttributeID)); if (!aPoint || !aPoint->isInitialized()) return; - std::shared_ptr aCenter(theSketch->to3D(aPoint->x(), aPoint->y())); - //std::cout<<"Execute circle "<x()<<" "<y()<<" "<z()< aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter); - std::shared_ptr aResult = theFeature->document()->createConstruction( - theFeature->data(), theIndex); + std::shared_ptr aCenter( + theSketch->to3D(aPoint->x(), aPoint->y())); + // std::cout<<"Execute circle "<x()<<" "<y()<<" + // "<z()< aCenterPointShape = + GeomAlgoAPI_PointBuilder::vertex(aCenter); + std::shared_ptr aResult = + theFeature->document()->createConstruction(theFeature->data(), theIndex); aResult->setShape(aCenterPointShape); aResult->setIsInHistory(false); theFeature->setResult(aResult, theIndex); } -void SketchPlugin_Sketch::createLine2DResult(ModelAPI_Feature* theFeature, - SketchPlugin_Sketch* theSketch, - const std::string& theStartAttrID, - const std::string& theEndAttrID, - const int theIndex) -{ +void SketchPlugin_Sketch::createLine2DResult(ModelAPI_Feature *theFeature, + SketchPlugin_Sketch *theSketch, + const std::string &theStartAttrID, + const std::string &theEndAttrID, + const int theIndex) { std::shared_ptr aStartAttr = - std::dynamic_pointer_cast(theFeature->attribute(theStartAttrID)); + std::dynamic_pointer_cast( + theFeature->attribute(theStartAttrID)); std::shared_ptr anEndAttr = - std::dynamic_pointer_cast(theFeature->attribute(theEndAttrID)); + std::dynamic_pointer_cast( + theFeature->attribute(theEndAttrID)); - if (!aStartAttr || !aStartAttr->isInitialized() || - !anEndAttr || !anEndAttr->isInitialized()) + if (!aStartAttr || !aStartAttr->isInitialized() || !anEndAttr || + !anEndAttr->isInitialized()) return; - std::shared_ptr aStart(theSketch->to3D(aStartAttr->x(), aStartAttr->y())); - std::shared_ptr anEnd(theSketch->to3D(anEndAttr->x(), anEndAttr->y())); - //std::cout<<"Execute line "<x()<<" "<y()<<" "<z()<<" - " - // <x()<<" "<y()<<" "<z()< anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); + std::shared_ptr aStart( + theSketch->to3D(aStartAttr->x(), aStartAttr->y())); + std::shared_ptr anEnd( + theSketch->to3D(anEndAttr->x(), anEndAttr->y())); + // std::cout<<"Execute line "<x()<<" "<y()<<" + // "<z()<<" - " + // <x()<<" "<y()<<" "<z()< anEdge = + GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); // store the result std::shared_ptr aResult = theFeature->document()->createConstruction(theFeature->data(), theIndex); @@ -422,80 +475,87 @@ void SketchPlugin_Sketch::createLine2DResult(ModelAPI_Feature* theFeature, theFeature->setResult(aResult, theIndex); } -FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeature, - SketchPlugin_Sketch* theSketch, - const bool theIsCopy) -{ +FeaturePtr +SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeature, + SketchPlugin_Sketch *theSketch, + const bool theIsCopy) { FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind()); // addFeature generates a unique name for the feature, it caches the name std::wstring aUniqueFeatureName = aNewFeature->data()->name(); - // all attribute values are copied\pasted to the new feature, name is not an exception + // all attribute values are copied\pasted to the new feature, name is not an + // exception theFeature->data()->copyTo(aNewFeature->data()); - // external state should not be copied as a new object is an object of the current sketch + // external state should not be copied as a new object is an object of the + // current sketch if (theFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()).get()) - aNewFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->setValue(ResultPtr(), - GeomShapePtr()); + aNewFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()) + ->setValue(ResultPtr(), GeomShapePtr()); aNewFeature->data()->setName(aUniqueFeatureName); // text expressions could block setValue of some attributes SketchPlugin_Tools::clearExpressions(aNewFeature); // Set copy attribute - AttributeBooleanPtr anAttr = aNewFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); - if(anAttr.get()) { + AttributeBooleanPtr anAttr = + aNewFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if (anAttr.get()) { anAttr->setValue(theIsCopy); } return aNewFeature; } -std::shared_ptr SketchPlugin_Sketch::plane(SketchPlugin_Sketch* theSketch) -{ +std::shared_ptr +SketchPlugin_Sketch::plane(SketchPlugin_Sketch *theSketch) { std::shared_ptr aData = theSketch->data(); - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aDirX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); - - if (aNorm.get() && aNorm->isInitialized() && anOrigin.get() && anOrigin->isInitialized()) + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aDirX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); + + if (aNorm.get() && aNorm->isInitialized() && anOrigin.get() && + anOrigin->isInitialized()) return std::shared_ptr( - new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir())); + new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir())); return std::shared_ptr(); } -bool SketchPlugin_Sketch::customAction(const std::string& theActionId) -{ +bool SketchPlugin_Sketch::customAction(const std::string &theActionId) { bool isOk = false; if (theActionId == ACTION_REMOVE_EXTERNAL()) isOk = removeLinksToExternal(); else { std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\"."; - Events_InfoMessage("SketchPlugin_Sketch", aMsg).arg(getKind()).arg(theActionId).send(); + Events_InfoMessage("SketchPlugin_Sketch", aMsg) + .arg(getKind()) + .arg(theActionId) + .send(); } return isOk; } -static bool isExternalBased(const FeaturePtr theFeature) -{ +static bool isExternalBased(const FeaturePtr theFeature) { return theFeature->getKind() == SketchPlugin_Projection::ID() || theFeature->getKind() == SketchPlugin_IntersectionPoint::ID(); } -bool SketchPlugin_Sketch::removeLinksToExternal() -{ +bool SketchPlugin_Sketch::removeLinksToExternal() { std::list aRemove; std::list aSubs = reflist(FEATURES_ID())->list(); - for (std::list::iterator anIt = aSubs.begin(); anIt != aSubs.end(); ++anIt) { + for (std::list::iterator anIt = aSubs.begin(); anIt != aSubs.end(); + ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); if (!aFeature) continue; if (isExternalBased(aFeature)) { // mark feature as to be removed aRemove.push_back(aFeature); - } - else { + } else { AttributeSelectionPtr anExtAttr = aFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); ResultPtr anExternal = anExtAttr ? anExtAttr->context() : ResultPtr(); @@ -503,39 +563,43 @@ bool SketchPlugin_Sketch::removeLinksToExternal() FeaturePtr anExtFeature = ModelAPI_Feature::feature(anExternal); if (anExtFeature && isExternalBased(anExtFeature)) { // make result of projection/intersection as non-external, - aFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->setValue( - ObjectPtr(), GeomShapePtr()); - // set feature auxiliary if the parent is not included into sketch result + aFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()) + ->setValue(ObjectPtr(), GeomShapePtr()); + // set feature auxiliary if the parent is not included into sketch + // result bool isIncludedToSketchResult = false; if (anExtFeature->getKind() == SketchPlugin_Projection::ID()) { - isIncludedToSketchResult = anExtFeature->boolean( - SketchPlugin_Projection::INCLUDE_INTO_RESULT())->value(); + isIncludedToSketchResult = + anExtFeature + ->boolean(SketchPlugin_Projection::INCLUDE_INTO_RESULT()) + ->value(); } if (anExtFeature->getKind() == SketchPlugin_IntersectionPoint::ID()) { - isIncludedToSketchResult = anExtFeature->boolean( - SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT())->value(); + isIncludedToSketchResult = + anExtFeature + ->boolean( + SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT()) + ->value(); } - aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID())->setValue(false); - aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue( - !isIncludedToSketchResult); + aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()) + ->setValue(false); + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->setValue(!isIncludedToSketchResult); } } } } - for (std::list::iterator anIt = aRemove.begin(); anIt != aRemove.end(); ++anIt) + for (std::list::iterator anIt = aRemove.begin(); + anIt != aRemove.end(); ++anIt) document()->removeFeature(*anIt); return true; } - -static ObjectPtr findAxis(GeomShapePtr theAxisToCompare, - ObjectPtr theOX, - ObjectPtr theOY, - ObjectPtr theOZ) -{ +static ObjectPtr findAxis(GeomShapePtr theAxisToCompare, ObjectPtr theOX, + ObjectPtr theOY, ObjectPtr theOZ) { if (theAxisToCompare) { - ObjectPtr anAxes[] = { theOX, theOY, theOZ }; + ObjectPtr anAxes[] = {theOX, theOY, theOZ}; for (int i = 0; i < 3; ++i) { ResultPtr anAx = std::dynamic_pointer_cast(anAxes[i]); if (anAx && theAxisToCompare->isEqual(anAx->shape())) @@ -545,11 +609,8 @@ static ObjectPtr findAxis(GeomShapePtr theAxisToCompare, return ObjectPtr(); } -static ObjectPtr findAxis(ObjectPtr theAxisToCompare, - ObjectPtr theOX, - ObjectPtr theOY, - ObjectPtr theOZ) -{ +static ObjectPtr findAxis(ObjectPtr theAxisToCompare, ObjectPtr theOX, + ObjectPtr theOY, ObjectPtr theOZ) { if (theAxisToCompare == theOX) return theOX; else if (theAxisToCompare == theOY) @@ -557,12 +618,14 @@ static ObjectPtr findAxis(ObjectPtr theAxisToCompare, else if (theAxisToCompare == theOZ) return theOZ; // nothing helped, search by shape - ResultPtr anAxis = std::dynamic_pointer_cast(theAxisToCompare); - return findAxis(anAxis ? anAxis->shape() : GeomShapePtr(), theOX, theOY, theOZ); + ResultPtr anAxis = + std::dynamic_pointer_cast(theAxisToCompare); + return findAxis(anAxis ? anAxis->shape() : GeomShapePtr(), theOX, theOY, + theOZ); } -GeomShapePtr axisOnNewPlane(ObjectPtr theAxis, GeomAx3Ptr theOldPlane, GeomAx3Ptr theNewPlane) -{ +GeomShapePtr axisOnNewPlane(ObjectPtr theAxis, GeomAx3Ptr theOldPlane, + GeomAx3Ptr theNewPlane) { ResultPtr anAxis = std::dynamic_pointer_cast(theAxis); if (!anAxis) return GeomShapePtr(); @@ -590,22 +653,27 @@ GeomShapePtr axisOnNewPlane(ObjectPtr theAxis, GeomAx3Ptr theOldPlane, GeomAx3Pt return GeomAlgoAPI_EdgeBuilder::line(aFirstPoint, aLastPoint); } -void SketchPlugin_Sketch::updateCoordinateAxis(ObjectPtr theSub, GeomAx3Ptr thePlane) -{ +void SketchPlugin_Sketch::updateCoordinateAxis(ObjectPtr theSub, + GeomAx3Ptr thePlane) { FeaturePtr aFeature = ModelAPI_Feature::feature(theSub); if (!aFeature) return; DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); - ObjectPtr anOX = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OX"); - ObjectPtr anOY = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OY"); - ObjectPtr anOZ = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OZ"); + ObjectPtr anOX = + aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OX"); + ObjectPtr anOY = + aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OY"); + ObjectPtr anOZ = + aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OZ"); AttributeSelectionPtr anExtFeature; if (aFeature->getKind() == SketchPlugin_Projection::ID()) - anExtFeature = aFeature->selection(SketchPlugin_Projection::EXTERNAL_FEATURE_ID()); + anExtFeature = + aFeature->selection(SketchPlugin_Projection::EXTERNAL_FEATURE_ID()); else if (aFeature->getKind() == SketchPlugin_IntersectionPoint::ID()) - anExtFeature = aFeature->selection(SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID()); + anExtFeature = aFeature->selection( + SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID()); else return; diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index 75a451ace..82def5a2b 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -14,92 +14,86 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Sketch_H_ #define SketchPlugin_Sketch_H_ #include "SketchPlugin.h" -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include -#include #include +#include #include #ifdef SET_PLANES_COLOR_IN_PREFERENCES - #define YZ_PLANE_COLOR "225,0,0" - #define XZ_PLANE_COLOR "0,225,0" - #define XY_PLANE_COLOR "0,0,225" +#define YZ_PLANE_COLOR "225,0,0" +#define XZ_PLANE_COLOR "0,225,0" +#define XY_PLANE_COLOR "0,0,225" #endif /**\class SketchPlugin_Sketch * \ingroup Plugins * \brief Feature for creation of the new part in PartSet. */ -class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_ICustomPrs +class SketchPlugin_Sketch + : public ModelAPI_CompositeFeature //, public GeomAPI_ICustomPrs { - public: +public: /// Sketch feature kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SKETCH_ID("Sketch"); return MY_SKETCH_ID; } /// Origin point of the sketcher in 3D space - inline static const std::string& ORIGIN_ID() - { + inline static const std::string &ORIGIN_ID() { static const std::string MY_ORIGIN_ID("Origin"); return MY_ORIGIN_ID; } /// Vector X inside of the sketch plane - inline static const std::string& DIRX_ID() - { + inline static const std::string &DIRX_ID() { static const std::string MY_DIRX_ID("DirX"); return MY_DIRX_ID; } /// Vector Z, normal to the sketch plane - inline static const std::string& NORM_ID() - { + inline static const std::string &NORM_ID() { static const std::string MY_NORM_ID("Norm"); return MY_NORM_ID; } /// All features of this sketch (list of references) - inline static const std::string& FEATURES_ID() - { + inline static const std::string &FEATURES_ID() { static const std::string MY_FEATURES_ID("Features"); return MY_FEATURES_ID; } /// Sketch solver error - inline static const std::string& SOLVER_ERROR() - { + inline static const std::string &SOLVER_ERROR() { static const std::string MY_SOLVER_ERROR("SolverError"); return MY_SOLVER_ERROR; } /// Sketch solver error - inline static const std::string& SOLVER_DOF() - { + inline static const std::string &SOLVER_DOF() { static const std::string MY_SOLVER_DOF("SolverDOF"); return MY_SOLVER_DOF; } - /// Action ID to remove links to external entities while changing the sketch plane. - inline static const std::string& ACTION_REMOVE_EXTERNAL() - { + /// Action ID to remove links to external entities while changing the sketch + /// plane. + inline static const std::string &ACTION_REMOVE_EXTERNAL() { static const std::string MY_ACTION_REMOVE_EXTERNAL("RemoveExternalLinks"); return MY_ACTION_REMOVE_EXTERNAL; } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Sketch::ID(); return MY_KIND; } @@ -107,96 +101,111 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_I /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Converts a 2D sketch space point into point in 3D space /// \param theX an X coordinate /// \param theY an Y coordinate - std::shared_ptr to3D(const double theX, const double theY) const - { - std::shared_ptr aC = std::dynamic_pointer_cast( - data()->attribute(ORIGIN_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - data()->attribute(NORM_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - data()->attribute(DIRX_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); - - std::shared_ptr aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX)) - ->added(aY->xyz()->multiplied(theY)); + std::shared_ptr to3D(const double theX, + const double theY) const { + std::shared_ptr aC = + std::dynamic_pointer_cast( + data()->attribute(ORIGIN_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + data()->attribute(NORM_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + data()->attribute(DIRX_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + + std::shared_ptr aSum = + aC->pnt() + ->xyz() + ->added(aX->dir()->xyz()->multiplied(theX)) + ->added(aY->xyz()->multiplied(theY)); return std::shared_ptr(new GeomAPI_Pnt(aSum)); } /// Returns the point projected into the sketch plane /// \param thePnt a source 3d point - std::shared_ptr to2D(const std::shared_ptr& thePnt) const - { - std::shared_ptr aC = std::dynamic_pointer_cast( - data()->attribute(ORIGIN_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - data()->attribute(NORM_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - data()->attribute(DIRX_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + std::shared_ptr + to2D(const std::shared_ptr &thePnt) const { + std::shared_ptr aC = + std::dynamic_pointer_cast( + data()->attribute(ORIGIN_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + data()->attribute(NORM_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + data()->attribute(DIRX_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); return thePnt->to2D(aC->pnt(), aX->dir(), aY); } - /// Returns true if this feature must be displayed in the history (top level of Part tree) - SKETCHPLUGIN_EXPORT virtual bool isInHistory() - { - return true; - } + /// Returns true if this feature must be displayed in the history (top level + /// of Part tree) + SKETCHPLUGIN_EXPORT virtual bool isInHistory() { return true; } /// Use plugin manager for features creation SketchPlugin_Sketch(); /// Returns the basis plane for the sketch - std::shared_ptr plane() const - { - std::shared_ptr anOrigin = std::dynamic_pointer_cast( - data()->attribute(ORIGIN_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - data()->attribute(NORM_ID())); - - if (anOrigin.get() && aNorm.get() && anOrigin->isInitialized() && aNorm->isInitialized()) - return std::shared_ptr(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir())); + std::shared_ptr plane() const { + std::shared_ptr anOrigin = + std::dynamic_pointer_cast( + data()->attribute(ORIGIN_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + data()->attribute(NORM_ID())); + + if (anOrigin.get() && aNorm.get() && anOrigin->isInitialized() && + aNorm->isInitialized()) + return std::shared_ptr( + new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir())); return std::shared_ptr(); } /// Returns currently defined plane as an object of Ax3 - std::shared_ptr coordinatePlane() const - { + std::shared_ptr coordinatePlane() const { DataPtr aData = data(); - std::shared_ptr aC = std::dynamic_pointer_cast( - aData->attribute(ORIGIN_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aData->attribute(DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(NORM_ID())); + std::shared_ptr aC = + std::dynamic_pointer_cast( + aData->attribute(ORIGIN_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast(aData->attribute(DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast(aData->attribute(NORM_ID())); if (!aNorm->isInitialized() || !aX->isInitialized() || aNorm->dir()->cross(aX->dir())->squareModulus() < 1.e-14) return std::shared_ptr(); - return std::shared_ptr(new GeomAPI_Ax3(aC->pnt(), aX->dir(), aNorm->dir())); + return std::shared_ptr( + new GeomAPI_Ax3(aC->pnt(), aX->dir(), aNorm->dir())); } /// Checks whether the plane is set in the sketch. /// \returns the boolean state - bool isPlaneSet() const - { - std::shared_ptr aNormal = std::dynamic_pointer_cast( - data()->attribute(NORM_ID())); + bool isPlaneSet() const { + std::shared_ptr aNormal = + std::dynamic_pointer_cast( + data()->attribute(NORM_ID())); - return aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0); + return aNormal && + !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0); } - /// appends a feature to the sketch sub-elements container - SKETCHPLUGIN_EXPORT virtual std::shared_ptr addFeature(std::string theID); + SKETCHPLUGIN_EXPORT virtual std::shared_ptr + addFeature(std::string theID); /// Just to synchronise the container of sub-features virtual void removeFeature(std::shared_ptr theFeature); @@ -206,29 +215,30 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_I /// Returns the sub-feature by zero-base index SKETCHPLUGIN_EXPORT virtual std::shared_ptr - subFeature(const int theIndex, bool forTree = false); + subFeature(const int theIndex, bool forTree = false); - /// Returns the sub-feature unique identifier in this composite feature by index + /// Returns the sub-feature unique identifier in this composite feature by + /// index SKETCHPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const; /// Returns true if feature or reuslt belong to this composite feature as subs SKETCHPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const; - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); - /// Performs some custom feature specific functionality (normally called by some GUI button) - /// \param theActionId an action key - /// \return a boolean value about it is performed - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId); + /// Performs some custom feature specific functionality (normally called by + /// some GUI button) \param theActionId an action key \return a boolean value + /// about it is performed + SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); - /// \brief Create a result for the point in the attribute if the attribute is initialized - /// \param theFeature a source feature - /// \param theSketch a sketch intance - /// \param theAttributeID an attribute string - /// \param theIndex an index of the result - static void createPoint2DResult(ModelAPI_Feature* theFeature, - SketchPlugin_Sketch* theSketch, - const std::string& theAttributeID, const int theIndex); + /// \brief Create a result for the point in the attribute if the attribute is + /// initialized \param theFeature a source feature \param theSketch a sketch + /// intance \param theAttributeID an attribute string \param theIndex an index + /// of the result + static void createPoint2DResult(ModelAPI_Feature *theFeature, + SketchPlugin_Sketch *theSketch, + const std::string &theAttributeID, + const int theIndex); /// \brief Create a result for the segment given by a pair of attributes /// \param theFeature a source feature @@ -236,36 +246,38 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_I /// \param theStartAttrID an attribute string /// \param theEndAttrID an attribute string /// \param theIndex an index of the result - static void createLine2DResult(ModelAPI_Feature* theFeature, - SketchPlugin_Sketch* theSketch, - const std::string& theStartAttrID, - const std::string& theEndAttrID, + static void createLine2DResult(ModelAPI_Feature *theFeature, + SketchPlugin_Sketch *theSketch, + const std::string &theStartAttrID, + const std::string &theEndAttrID, const int theIndex = 0); - /// Add new feature and fill the data of the feature by the data of the parameter feature. - /// The name of the created feature stays unique. - /// \param theFeature a source feature - /// \param theSketch a sketch intance - /// \param theIsCopy if true sets feature copy attribute to true. - /// \return a created feature + /// Add new feature and fill the data of the feature by the data of the + /// parameter feature. The name of the created feature stays unique. \param + /// theFeature a source feature \param theSketch a sketch intance \param + /// theIsCopy if true sets feature copy attribute to true. \return a created + /// feature static FeaturePtr addUniqueNamedCopiedFeature(FeaturePtr theFeature, - SketchPlugin_Sketch* theSketch, + SketchPlugin_Sketch *theSketch, const bool theIsCopy = false); /// Creates a plane of the sketch. /// \param theSketch a sketch intance - static std::shared_ptr plane(SketchPlugin_Sketch* theSketch); + static std::shared_ptr plane(SketchPlugin_Sketch *theSketch); /// Customize presentation of the feature - //virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - // std::shared_ptr theDefaultPrs) + // virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr + // thePrs, + // std::shared_ptr + // theDefaultPrs) //{ - // bool isCustomized = false; - // // apply the color of the result to the presentation - // if (theDefaultPrs.get()) - // isCustomized = theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); - // // set the sketch presentation bold - // isCustomized = thePrs->setWidth(2) || isCustomized; + // bool isCustomized = false; + // // apply the color of the result to the presentation + // if (theDefaultPrs.get()) + // isCustomized = theDefaultPrs->customisePresentation(theResult, thePrs, + // theDefaultPrs); + // // set the sketch presentation bold + // isCustomized = thePrs->setWidth(2) || isCustomized; // return isCustomized; //} @@ -276,7 +288,8 @@ private: bool removeLinksToExternal(); /// Update projected coordinate axes - void updateCoordinateAxis(ObjectPtr theSub, std::shared_ptr thePlane); + void updateCoordinateAxis(ObjectPtr theSub, + std::shared_ptr thePlane); private: std::shared_ptr myPlane; diff --git a/src/SketchPlugin/SketchPlugin_SketchCopy.cpp b/src/SketchPlugin/SketchPlugin_SketchCopy.cpp index e27f60d99..36207f464 100644 --- a/src/SketchPlugin/SketchPlugin_SketchCopy.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchCopy.cpp @@ -14,18 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include #include #include #include -#include #include +#include #include #include @@ -33,52 +34,50 @@ #include #include -#include #include +#include class MapEntities; -static void copyAttribute(AttributePtr theOld, AttributePtr theNew, MapEntities& theMapOldNew); +static void copyAttribute(AttributePtr theOld, AttributePtr theNew, + MapEntities &theMapOldNew); -/// Internal structure to keep relation between sub-elements of old and new sketch. -class MapEntities -{ +/// Internal structure to keep relation between sub-elements of old and new +/// sketch. +class MapEntities { public: - void bind(FeaturePtr theOld, FeaturePtr theNew) - { + void bind(FeaturePtr theOld, FeaturePtr theNew) { myObjects[theOld] = theNew; checkPostponed(theOld); std::list anOldResults = theOld->results(); std::list aNewResults = theNew->results(); - for (std::list::iterator it1 = anOldResults.begin(), it2 = aNewResults.begin(); + for (std::list::iterator it1 = anOldResults.begin(), + it2 = aNewResults.begin(); it1 != anOldResults.end() && it2 != aNewResults.end(); ++it1, ++it2) { myObjects[*it1] = *it2; checkPostponed(*it1); } } - void postpone(ObjectPtr theOldObject, AttributePtr theOldAttr, AttributePtr theNewAttr) - { + void postpone(ObjectPtr theOldObject, AttributePtr theOldAttr, + AttributePtr theNewAttr) { if (theOldObject) myPostponed[theOldObject][theOldAttr] = theNewAttr; } - ObjectPtr find(ObjectPtr theOld) - { + ObjectPtr find(ObjectPtr theOld) { auto aFound = myObjects.find(theOld); return aFound == myObjects.end() ? ObjectPtr() : aFound->second; } - AttributePtr find(AttributePtr theOld) - { + AttributePtr find(AttributePtr theOld) { FeaturePtr anOldOwner = ModelAPI_Feature::feature(theOld->owner()); FeaturePtr aNewOwner = ModelAPI_Feature::feature(find(anOldOwner)); return aNewOwner ? aNewOwner->attribute(theOld->id()) : AttributePtr(); } protected: - void checkPostponed(ObjectPtr theOld) - { + void checkPostponed(ObjectPtr theOld) { auto aFound = myPostponed.find(theOld); if (aFound == myPostponed.end()) return; @@ -89,30 +88,24 @@ protected: private: std::map myObjects; - std::map > myPostponed; + std::map> myPostponed; }; +SketchPlugin_SketchCopy::SketchPlugin_SketchCopy() : ModelAPI_Feature() {} -SketchPlugin_SketchCopy::SketchPlugin_SketchCopy() : ModelAPI_Feature() -{} - -void SketchPlugin_SketchCopy::initAttributes() -{ +void SketchPlugin_SketchCopy::initAttributes() { data()->addAttribute(BASE_ID(), ModelAPI_AttributeReference::typeId()); } -static void copyRefAttr(AttributeRefAttrPtr theOld, - AttributeRefAttrPtr theNew, - MapEntities& theMapOldNew) -{ +static void copyRefAttr(AttributeRefAttrPtr theOld, AttributeRefAttrPtr theNew, + MapEntities &theMapOldNew) { if (theOld->isObject()) { ObjectPtr aNew = theMapOldNew.find(theOld->object()); if (aNew) theNew->setObject(aNew); else theMapOldNew.postpone(theOld->object(), theOld, theNew); - } - else { + } else { AttributePtr aNewAttr = theMapOldNew.find(theOld->attr()); if (aNewAttr) theNew->setAttr(aNewAttr); @@ -123,14 +116,16 @@ static void copyRefAttr(AttributeRefAttrPtr theOld, static void copyRefAttrList(AttributeRefAttrListPtr theOld, AttributeRefAttrListPtr theNew, - MapEntities& theMapOldNew) -{ + MapEntities &theMapOldNew) { // copy only if all referred objects/attribute are already transfered - std::list > aRefs = theOld->list(); - for (std::list >::iterator anIt = aRefs.begin(); + std::list> aRefs = theOld->list(); + for (std::list>::iterator anIt = + aRefs.begin(); anIt != aRefs.end(); ++anIt) { - ObjectPtr aNewObj = anIt->first ? theMapOldNew.find(anIt->first) : ObjectPtr(); - AttributePtr aNewAttr = anIt->second ? theMapOldNew.find(anIt->second) : AttributePtr(); + ObjectPtr aNewObj = + anIt->first ? theMapOldNew.find(anIt->first) : ObjectPtr(); + AttributePtr aNewAttr = + anIt->second ? theMapOldNew.find(anIt->second) : AttributePtr(); if (aNewObj || aNewAttr) *anIt = std::pair(aNewObj, aNewAttr); else { @@ -143,7 +138,8 @@ static void copyRefAttrList(AttributeRefAttrListPtr theOld, } // update the RefAttrList theNew->clear(); - for (std::list >::iterator anIt = aRefs.begin(); + for (std::list>::iterator anIt = + aRefs.begin(); anIt != aRefs.end(); ++anIt) { if (anIt->first) theNew->append(anIt->first); @@ -154,8 +150,7 @@ static void copyRefAttrList(AttributeRefAttrListPtr theOld, static void copyReference(AttributeReferencePtr theOld, AttributeReferencePtr theNew, - MapEntities& theMapOldNew) -{ + MapEntities &theMapOldNew) { ObjectPtr aNew = theMapOldNew.find(theOld->value()); if (aNew) theNew->setValue(aNew); @@ -163,13 +158,12 @@ static void copyReference(AttributeReferencePtr theOld, theMapOldNew.postpone(theOld->value(), theOld, theNew); } -static void copyRefList(AttributeRefListPtr theOld, - AttributeRefListPtr theNew, - MapEntities& theMapOldNew) -{ +static void copyRefList(AttributeRefListPtr theOld, AttributeRefListPtr theNew, + MapEntities &theMapOldNew) { // copy only if all referred objects are already transfered std::list aRefs = theOld->list(); - for (std::list::iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) { + for (std::list::iterator anIt = aRefs.begin(); anIt != aRefs.end(); + ++anIt) { ObjectPtr aNew = theMapOldNew.find(*anIt); if (aNew) *anIt = aNew; @@ -180,51 +174,52 @@ static void copyRefList(AttributeRefListPtr theOld, } // update theRefList theNew->clear(); - for (std::list::iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) + for (std::list::iterator anIt = aRefs.begin(); anIt != aRefs.end(); + ++anIt) theNew->append(*anIt); } static void copySelection(AttributeSelectionPtr theOld, - AttributeSelectionPtr theNew) -{ + AttributeSelectionPtr theNew) { theNew->selectValue(theOld); } -void copyAttribute(AttributePtr theOld, AttributePtr theNew, MapEntities& theMapOldNew) -{ +void copyAttribute(AttributePtr theOld, AttributePtr theNew, + MapEntities &theMapOldNew) { if (theNew->attributeType() == ModelAPI_AttributeRefAttr::typeId()) { copyRefAttr(std::dynamic_pointer_cast(theOld), std::dynamic_pointer_cast(theNew), theMapOldNew); - } - else if (theNew->attributeType() == ModelAPI_AttributeReference::typeId()) { - copyReference(std::dynamic_pointer_cast(theOld), - std::dynamic_pointer_cast(theNew), - theMapOldNew); - } - else if (theNew->attributeType() == ModelAPI_AttributeRefAttrList::typeId()) { - copyRefAttrList(std::dynamic_pointer_cast(theOld), - std::dynamic_pointer_cast(theNew), - theMapOldNew); - } - else if (theNew->attributeType() == ModelAPI_AttributeRefList::typeId()) { + } else if (theNew->attributeType() == ModelAPI_AttributeReference::typeId()) { + copyReference( + std::dynamic_pointer_cast(theOld), + std::dynamic_pointer_cast(theNew), + theMapOldNew); + } else if (theNew->attributeType() == + ModelAPI_AttributeRefAttrList::typeId()) { + copyRefAttrList( + std::dynamic_pointer_cast(theOld), + std::dynamic_pointer_cast(theNew), + theMapOldNew); + } else if (theNew->attributeType() == ModelAPI_AttributeRefList::typeId()) { copyRefList(std::dynamic_pointer_cast(theOld), std::dynamic_pointer_cast(theNew), theMapOldNew); - } - else if (theNew->attributeType() == ModelAPI_AttributeSelection::typeId()) { - copySelection(std::dynamic_pointer_cast(theOld), - std::dynamic_pointer_cast(theNew)); + } else if (theNew->attributeType() == ModelAPI_AttributeSelection::typeId()) { + copySelection( + std::dynamic_pointer_cast(theOld), + std::dynamic_pointer_cast(theNew)); } } -static void renameByParent(FeaturePtr theOld, FeaturePtr theNew) -{ - AttributeReferencePtr anOldParentRef = theOld->reference(SketchPlugin_SketchEntity::PARENT_ID()); +static void renameByParent(FeaturePtr theOld, FeaturePtr theNew) { + AttributeReferencePtr anOldParentRef = + theOld->reference(SketchPlugin_SketchEntity::PARENT_ID()); if (!anOldParentRef || !anOldParentRef->isInitialized()) return; - AttributeReferencePtr aNewParentRef = theNew->reference(SketchPlugin_SketchEntity::PARENT_ID()); + AttributeReferencePtr aNewParentRef = + theNew->reference(SketchPlugin_SketchEntity::PARENT_ID()); std::wstring anOldName = anOldParentRef->value()->data()->name(); std::wstring aNewName = aNewParentRef->value()->data()->name(); @@ -233,9 +228,10 @@ static void renameByParent(FeaturePtr theOld, FeaturePtr theNew) theNew->data()->setName(theOld->name()); SketchPlugin_Tools::replaceInName(theNew, anOldName, aNewName); - const std::list& anOldResults = theOld->results(); - const std::list& aNewResults = theNew->results(); - for (std::list::const_iterator it0 = anOldResults.begin(), it1 = aNewResults.begin(); + const std::list &anOldResults = theOld->results(); + const std::list &aNewResults = theNew->results(); + for (std::list::const_iterator it0 = anOldResults.begin(), + it1 = aNewResults.begin(); it0 != anOldResults.end() && it1 != aNewResults.end(); ++it0, ++it1) { (*it1)->data()->setName((*it0)->data()->name()); SketchPlugin_Tools::replaceInName(*it1, anOldName, aNewName); @@ -244,8 +240,7 @@ static void renameByParent(FeaturePtr theOld, FeaturePtr theNew) static void copyFeature(const FeaturePtr theFeature, std::shared_ptr theSketch, - MapEntities& theMapOldNew) -{ + MapEntities &theMapOldNew) { if (!theFeature) return; @@ -253,10 +248,11 @@ static void copyFeature(const FeaturePtr theFeature, FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind()); theFeature->data()->copyTo(aNewFeature->data()); int aResultIndex = 0; - for (std::list::const_iterator aRIt = theFeature->results().begin(); + for (std::list::const_iterator aRIt = + theFeature->results().begin(); aRIt != theFeature->results().end(); ++aRIt) { - ResultConstructionPtr aResult = - theSketch->document()->createConstruction(aNewFeature->data(), aResultIndex); + ResultConstructionPtr aResult = theSketch->document()->createConstruction( + aNewFeature->data(), aResultIndex); GeomAlgoAPI_Copy aCopyAlgo((*aRIt)->shape()); @@ -267,10 +263,12 @@ static void copyFeature(const FeaturePtr theFeature, theMapOldNew.bind(theFeature, aNewFeature); // update referred features and attributes - bool aWasBlocked = aNewFeature->data()->blockSendAttributeUpdated(true, false); + bool aWasBlocked = + aNewFeature->data()->blockSendAttributeUpdated(true, false); std::list anAttrs = aNewFeature->data()->attributes(std::string()); - for (std::list::iterator anIt = anAttrs.begin(); anIt != anAttrs.end(); ++anIt) { + for (std::list::iterator anIt = anAttrs.begin(); + anIt != anAttrs.end(); ++anIt) { AttributePtr anOldAttr = theFeature->attribute((*anIt)->id()); copyAttribute(anOldAttr, *anIt, theMapOldNew); } @@ -280,8 +278,7 @@ static void copyFeature(const FeaturePtr theFeature, renameByParent(theFeature, aNewFeature); } -static int index(const std::wstring& theName, const std::wstring& thePrefix) -{ +static int index(const std::wstring &theName, const std::wstring &thePrefix) { int anIndex = -1; if (theName.find(thePrefix) == 0) { anIndex = 0; @@ -293,10 +290,9 @@ static int index(const std::wstring& theName, const std::wstring& thePrefix) return anIndex; } - -void SketchPlugin_SketchCopy::execute() -{ - FeaturePtr aBaseSketchFeature = ModelAPI_Feature::feature(reference(BASE_ID())->value()); +void SketchPlugin_SketchCopy::execute() { + FeaturePtr aBaseSketchFeature = + ModelAPI_Feature::feature(reference(BASE_ID())->value()); CompositeFeaturePtr aBaseSketch = std::dynamic_pointer_cast(aBaseSketchFeature); if (!aBaseSketch) { @@ -307,7 +303,8 @@ void SketchPlugin_SketchCopy::execute() FeaturePtr aNewSketchFeature = document()->addFeature(aBaseSketch->getKind()); std::shared_ptr aNewSketch = std::dynamic_pointer_cast(aNewSketchFeature); - // copy all attributes of sketch, then clear sub-features to be able to copy then one by one + // copy all attributes of sketch, then clear sub-features to be able to copy + // then one by one aBaseSketch->data()->copyTo(aNewSketch->data()); aNewSketch->reflist(SketchPlugin_Sketch::FEATURES_ID())->clear(); @@ -328,7 +325,8 @@ void SketchPlugin_SketchCopy::execute() std::wstring aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX; int aNewSketchIndex = 0; std::list aFeatures = document()->allFeatures(); - for (std::list::iterator aFIt = aFeatures.begin(); aFIt != aFeatures.end(); ++aFIt) { + for (std::list::iterator aFIt = aFeatures.begin(); + aFIt != aFeatures.end(); ++aFIt) { if ((*aFIt)->getKind() != SketchPlugin_Sketch::ID()) continue; int anIndex = index((*aFIt)->name(), aSketchName); diff --git a/src/SketchPlugin/SketchPlugin_SketchCopy.h b/src/SketchPlugin/SketchPlugin_SketchCopy.h index 071f312fa..8508c25ed 100644 --- a/src/SketchPlugin/SketchPlugin_SketchCopy.h +++ b/src/SketchPlugin/SketchPlugin_SketchCopy.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_SketchCopy_H_ @@ -25,30 +26,27 @@ /// \class SketchPlugin_SketchCopy /// \ingroup Plugins -/// \brief Feature for copy of a sketch and all its sub-features to the same plane. -class SketchPlugin_SketchCopy : public ModelAPI_Feature -{ +/// \brief Feature for copy of a sketch and all its sub-features to the same +/// plane. +class SketchPlugin_SketchCopy : public ModelAPI_Feature { public: /// A constructor SketchPlugin_SketchCopy(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_FEATURE_ID("SketchCopy"); return MY_FEATURE_ID; } /// Attribute name of the base sketch selected. - inline static const std::string& BASE_ID() - { + inline static const std::string &BASE_ID() { static const std::string ID("base_sketch"); return ID; } /// \return the kind of a feature. - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_SketchCopy::ID(); return MY_KIND; } @@ -56,14 +54,15 @@ public: /// Creates a new sketch. SKETCHPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Means that feature is removed on apply. - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;} + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// No preview is generated until it is applied. - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;} + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } }; #endif diff --git a/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp b/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp index 913d0a6bd..4fb830551 100644 --- a/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp @@ -14,64 +14,64 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_SketchDrawer.h" #include "SketchPlugin_Arc.h" -#include "SketchPlugin_Line.h" #include "SketchPlugin_Circle.h" -#include "SketchPlugin_Point.h" -#include "SketchPlugin_Sketch.h" -#include "SketchPlugin_ConstraintDistance.h" #include "SketchPlugin_ConstraintCoincidence.h" +#include "SketchPlugin_ConstraintDistance.h" +#include "SketchPlugin_ConstraintDistanceHorizontal.h" +#include "SketchPlugin_ConstraintDistanceVertical.h" +#include "SketchPlugin_ConstraintHorizontal.h" #include "SketchPlugin_ConstraintLength.h" #include "SketchPlugin_ConstraintRadius.h" #include "SketchPlugin_ConstraintVertical.h" -#include "SketchPlugin_ConstraintHorizontal.h" -#include "SketchPlugin_ConstraintDistanceVertical.h" -#include "SketchPlugin_ConstraintDistanceHorizontal.h" +#include "SketchPlugin_Line.h" +#include "SketchPlugin_Point.h" +#include "SketchPlugin_Sketch.h" #include "SketchPlugin_Tools.h" -#include -#include #include -#include #include +#include +#include +#include -#include -#include #include +#include +#include #include #include static const double kTOL = 1.e-6; -SketchPlugin_SketchDrawer::SketchPlugin_SketchDrawer() : ModelAPI_Feature() -{} +SketchPlugin_SketchDrawer::SketchPlugin_SketchDrawer() : ModelAPI_Feature() {} -void SketchPlugin_SketchDrawer::initAttributes() -{ +void SketchPlugin_SketchDrawer::initAttributes() { data()->addAttribute(BASE_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(PLANE_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(ADD_DIMENSIONS_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(ADD_DIMENSIONS_ID(), + ModelAPI_AttributeBoolean::typeId()); } // sets a point attribute of the feature by 3D point on the sketch -static void setPoint(FeaturePtr theFeature, const std::string& theAttrID, - std::shared_ptr theSketch, GeomPointPtr thePoint, - std::list >& aPoints) -{ +static void setPoint(FeaturePtr theFeature, const std::string &theAttrID, + std::shared_ptr theSketch, + GeomPointPtr thePoint, + std::list> &aPoints) { GeomPnt2dPtr aPnt2D = theSketch->to2D(thePoint); std::dynamic_pointer_cast( - theFeature->attribute(theAttrID))->setValue(aPnt2D); + theFeature->attribute(theAttrID)) + ->setValue(aPnt2D); aPoints.push_back(std::pair(aPnt2D, theAttrID)); } -void SketchPlugin_SketchDrawer::execute() -{ +void SketchPlugin_SketchDrawer::execute() { GeomShapePtr aBase = selection(BASE_ID())->value(); if (!aBase.get() && selection(BASE_ID())->context().get()) aBase = selection(BASE_ID())->context()->shape(); @@ -94,19 +94,22 @@ void SketchPlugin_SketchDrawer::execute() // create and initialize sketch DocumentPtr aMyDoc = document(); std::shared_ptr aSketch = - std::dynamic_pointer_cast(aMyDoc->addFeature(SketchPlugin_Sketch::ID())); + std::dynamic_pointer_cast( + aMyDoc->addFeature(SketchPlugin_Sketch::ID())); // by selection of plane - aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())-> - setValue(selection(PLANE_ID())->context(), aPlaneShape); + aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()) + ->setValue(selection(PLANE_ID())->context(), aPlaneShape); // remove reference, but keep the sketch position - aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())-> - setValue(ResultPtr(), GeomShapePtr()); + aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()) + ->setValue(ResultPtr(), GeomShapePtr()); bool addDimensions = boolean(ADD_DIMENSIONS_ID())->value(); // iterate all edges of the base to find all edges that belong to this plane GeomAPI_DataMapOfShapeShape alreadyProcessed; - std::list aCreatedPoints;// points to check and set coincidence - for(GeomAPI_ShapeExplorer anEdges(aBase, GeomAPI_Shape::EDGE); anEdges.more(); anEdges.next()) { + std::list + aCreatedPoints; // points to check and set coincidence + for (GeomAPI_ShapeExplorer anEdges(aBase, GeomAPI_Shape::EDGE); + anEdges.more(); anEdges.next()) { if (!alreadyProcessed.bind(anEdges.current(), anEdges.current())) continue; // skip duplicated edges GeomEdgePtr anEdge(new GeomAPI_Edge(anEdges.current())); @@ -118,8 +121,10 @@ void SketchPlugin_SketchDrawer::execute() continue; // skip edges not in plane FeaturePtr anItem; - std::list > aPoints; // created point to attribute ID - if (anEdge->isLine()) { // line is already in the plane: create by two points + std::list> + aPoints; // created point to attribute ID + if (anEdge + ->isLine()) { // line is already in the plane: create by two points anItem = aSketch->addFeature(SketchPlugin_Line::ID()); setPoint(anItem, SketchPlugin_Line::START_ID(), aSketch, aStart, aPoints); setPoint(anItem, SketchPlugin_Line::END_ID(), aSketch, anEnd, aPoints); @@ -127,35 +132,46 @@ void SketchPlugin_SketchDrawer::execute() // add a vertical or horizontal constraints bool isHorVertConstr = true; if (fabs(aPoints.front().first->x() - aPoints.back().first->x()) < kTOL) { - FeaturePtr aVert = aSketch->addFeature(SketchPlugin_ConstraintVertical::ID()); - aVert->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->firstResult()); - } else if (fabs(aPoints.front().first->y() - aPoints.back().first->y()) < kTOL) { - FeaturePtr aHor = aSketch->addFeature(SketchPlugin_ConstraintHorizontal::ID()); - aHor->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->firstResult()); + FeaturePtr aVert = + aSketch->addFeature(SketchPlugin_ConstraintVertical::ID()); + aVert->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(anItem->firstResult()); + } else if (fabs(aPoints.front().first->y() - aPoints.back().first->y()) < + kTOL) { + FeaturePtr aHor = + aSketch->addFeature(SketchPlugin_ConstraintHorizontal::ID()); + aHor->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(anItem->firstResult()); } else { isHorVertConstr = false; } if (addDimensions) { if (isHorVertConstr) { // only length constraint is enough - FeaturePtr aLen = aSketch->addFeature(SketchPlugin_ConstraintLength::ID()); + FeaturePtr aLen = + aSketch->addFeature(SketchPlugin_ConstraintLength::ID()); aLen->refattr(SketchPlugin_ConstraintLength::ENTITY_A()) - ->setObject(anItem->firstResult()); - aLen->real(SketchPlugin_ConstraintLength::VALUE())->setValue(anEdge->length()); + ->setObject(anItem->firstResult()); + aLen->real(SketchPlugin_ConstraintLength::VALUE()) + ->setValue(anEdge->length()); } else { // set horizontal and vertical distance constraints - FeaturePtr aVDist = aSketch->addFeature(SketchPlugin_ConstraintDistanceVertical::ID()); + FeaturePtr aVDist = aSketch->addFeature( + SketchPlugin_ConstraintDistanceVertical::ID()); aVDist->refattr(SketchPlugin_Constraint::ENTITY_A()) - ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID())); + ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID())); aVDist->refattr(SketchPlugin_Constraint::ENTITY_B()) - ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID())); + ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID())); aVDist->real(SketchPlugin_ConstraintDistanceVertical::VALUE()) - ->setValue(aPoints.back().first->y() - aPoints.front().first->y()); - FeaturePtr aHDist = aSketch->addFeature(SketchPlugin_ConstraintDistanceHorizontal::ID()); + ->setValue(aPoints.back().first->y() - + aPoints.front().first->y()); + FeaturePtr aHDist = aSketch->addFeature( + SketchPlugin_ConstraintDistanceHorizontal::ID()); aHDist->refattr(SketchPlugin_Constraint::ENTITY_A()) - ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID())); + ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID())); aHDist->refattr(SketchPlugin_Constraint::ENTITY_B()) - ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID())); + ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID())); aHDist->real(SketchPlugin_ConstraintDistanceVertical::VALUE()) - ->setValue(aPoints.back().first->x() - aPoints.front().first->x()); + ->setValue(aPoints.back().first->x() - + aPoints.front().first->x()); } } } else if (anEdge->isArc()) { // check also center @@ -164,39 +180,52 @@ void SketchPlugin_SketchDrawer::execute() continue; // create arc by 3 points anItem = aSketch->addFeature(SketchPlugin_Arc::ID()); - setPoint(anItem, SketchPlugin_Arc::CENTER_ID(), aSketch, aCenter, aPoints); + setPoint(anItem, SketchPlugin_Arc::CENTER_ID(), aSketch, aCenter, + aPoints); setPoint(anItem, SketchPlugin_Arc::START_ID(), aSketch, aStart, aPoints); setPoint(anItem, SketchPlugin_Arc::END_ID(), aSketch, anEnd, aPoints); anItem->execute(); // for constraints setting on result // set radius constraint if (addDimensions) { - FeaturePtr aRad = aSketch->addFeature(SketchPlugin_ConstraintRadius::ID()); - aRad->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->lastResult()); + FeaturePtr aRad = + aSketch->addFeature(SketchPlugin_ConstraintRadius::ID()); + aRad->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(anItem->lastResult()); } - } else if (anEdge->isCircle()) { // check also center and middle (at value 2.) + } else if (anEdge + ->isCircle()) { // check also center and middle (at value 2.) GeomPointPtr aCenter = anEdge->circle()->center(); - if (aPlane->distance(aCenter) >= kTOL || aPlane->distance(anEdge->middlePoint()) >= kTOL) + if (aPlane->distance(aCenter) >= kTOL || + aPlane->distance(anEdge->middlePoint()) >= kTOL) continue; // circle by center and radius anItem = aSketch->addFeature(SketchPlugin_Circle::ID()); - setPoint(anItem, SketchPlugin_Circle::CENTER_ID(), aSketch, aCenter, aPoints); - anItem->real(SketchPlugin_Circle::RADIUS_ID())->setValue(anEdge->circle()->radius()); + setPoint(anItem, SketchPlugin_Circle::CENTER_ID(), aSketch, aCenter, + aPoints); + anItem->real(SketchPlugin_Circle::RADIUS_ID()) + ->setValue(anEdge->circle()->radius()); anItem->execute(); // for constraints setting on result // set radius constraint if (addDimensions) { - FeaturePtr aRad = aSketch->addFeature(SketchPlugin_ConstraintRadius::ID()); - aRad->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->lastResult()); + FeaturePtr aRad = + aSketch->addFeature(SketchPlugin_ConstraintRadius::ID()); + aRad->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setObject(anItem->lastResult()); } } else { - continue; // other types of edges are not supported, only lines, circles and arcs + continue; // other types of edges are not supported, only lines, circles + // and arcs } // check some resulting points are coincident to existing - std::list >::iterator aPIter = aPoints.begin(); - for(; aPIter != aPoints.end(); aPIter++) { + std::list>::iterator aPIter = + aPoints.begin(); + for (; aPIter != aPoints.end(); aPIter++) { AttributePoint2DPtr aPointAttr = - std::dynamic_pointer_cast(anItem->attribute(aPIter->second)); - std::list::iterator aCoincIter = aCreatedPoints.begin(); - for(; aCoincIter != aCreatedPoints.end(); aCoincIter++) { + std::dynamic_pointer_cast( + anItem->attribute(aPIter->second)); + std::list::iterator aCoincIter = + aCreatedPoints.begin(); + for (; aCoincIter != aCreatedPoints.end(); aCoincIter++) { double aDX = (*aCoincIter)->x() - aPIter->first->x(); if (fabs(aDX) >= kTOL) continue; @@ -204,9 +233,12 @@ void SketchPlugin_SketchDrawer::execute() if (fabs(aDY) >= kTOL) continue; // create a coincidence constraint - FeaturePtr aCoinc = aSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); - aCoinc->refattr(SketchPlugin_Constraint::ENTITY_A())->setAttr(aPointAttr); - aCoinc->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(*aCoincIter); + FeaturePtr aCoinc = + aSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + aCoinc->refattr(SketchPlugin_Constraint::ENTITY_A()) + ->setAttr(aPointAttr); + aCoinc->refattr(SketchPlugin_Constraint::ENTITY_B()) + ->setAttr(*aCoincIter); break; // only one coincidence per point } aCreatedPoints.push_back(aPointAttr); diff --git a/src/SketchPlugin/SketchPlugin_SketchDrawer.h b/src/SketchPlugin/SketchPlugin_SketchDrawer.h index f0b9e1df6..8d050fbbf 100644 --- a/src/SketchPlugin/SketchPlugin_SketchDrawer.h +++ b/src/SketchPlugin/SketchPlugin_SketchDrawer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_SketchDrawer_H_ @@ -25,44 +26,39 @@ /// \class SketchPlugin_SketchDrawer /// \ingroup Plugins -/// \brief Feature for creation of a sketch on selected base object and plane. It tries -/// to make sketch elements equal to edges and vertices of the objects that belong to -/// the selected plane. -class SketchPlugin_SketchDrawer: public ModelAPI_Feature -{ - public: +/// \brief Feature for creation of a sketch on selected base object and plane. +/// It tries +/// to make sketch elements equal to edges and vertices of the objects that +/// belong to the selected plane. +class SketchPlugin_SketchDrawer : public ModelAPI_Feature { +public: /// A constructor SketchPlugin_SketchDrawer(); /// Feature kind. - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_FEATURE_ID("SketchDrawer"); return MY_FEATURE_ID; } /// Attribute name of the base shape selected. - inline static const std::string& BASE_ID() - { + inline static const std::string &BASE_ID() { static const std::string ID("base_shape"); return ID; } /// Attribute name of the plane selected. - inline static const std::string& PLANE_ID() - { + inline static const std::string &PLANE_ID() { static const std::string ID("plane"); return ID; } /// Attribute name of the add-dimensions flag. - inline static const std::string& ADD_DIMENSIONS_ID() - { + inline static const std::string &ADD_DIMENSIONS_ID() { static const std::string ID("add_dimensions"); return ID; } /// \return the kind of a feature. - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_SketchDrawer::ID(); return MY_KIND; } @@ -70,15 +66,16 @@ class SketchPlugin_SketchDrawer: public ModelAPI_Feature /// Creates a new sketch. SKETCHPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes. + /// Request for initialization of data model of the feature: adding all + /// attributes. SKETCHPLUGIN_EXPORT virtual void initAttributes(); - /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is removed on apply. - /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;} + /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is + /// removed on apply. \returns true + SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } /// No preview is generated until it is applied. - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;} + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } }; #endif diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.cpp b/src/SketchPlugin/SketchPlugin_SketchEntity.cpp index 3a4165c8e..3de433149 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_SketchEntity.h" @@ -24,25 +25,25 @@ #include SketchPlugin_SketchEntity::SketchPlugin_SketchEntity() -: SketchPlugin_Feature() -{ -} + : SketchPlugin_Feature() {} -void SketchPlugin_SketchEntity::initAttributes() -{ +void SketchPlugin_SketchEntity::initAttributes() { data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId()); initDerivedClassAttributes(); - AttributePtr anAttr = data()->addAttribute(SketchPlugin_SketchEntity::COPY_ID(), - ModelAPI_AttributeBoolean::typeId()); + AttributePtr anAttr = + data()->addAttribute(SketchPlugin_SketchEntity::COPY_ID(), + ModelAPI_AttributeBoolean::typeId()); anAttr->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), - SketchPlugin_SketchEntity::COPY_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_SketchEntity::COPY_ID()); - anAttr = data()->addAttribute(PARENT_ID(), ModelAPI_AttributeReference::typeId()); + anAttr = + data()->addAttribute(PARENT_ID(), ModelAPI_AttributeReference::typeId()); anAttr->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PARENT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + PARENT_ID()); // initialize the rest of attributes initDerivedClassAttributes2(); diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 3f3e7526a..cc7a97d65 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_SketchEntity_H_ @@ -23,85 +24,74 @@ #include "SketchPlugin.h" #include "SketchPlugin_Feature.h" -#include -#include -#include #include -#include -#include +#include +#include #include #include -#include +#include +#include +#include +#include #include /**\class SketchPlugin_SketchEntity * \ingroup Plugins - * \brief Sketch Entity for creation of the new feature in PartSet. + * \brief Sketch Entity for creation of the new feature in PartSet. * This is an abstract class to give - * an interface to create the entity features such as line, circle, arc and point. + * an interface to create the entity features such as line, circle, arc and + * point. */ -class SketchPlugin_SketchEntity : public SketchPlugin_Feature //, public GeomAPI_ICustomPrs +class SketchPlugin_SketchEntity + : public SketchPlugin_Feature //, public GeomAPI_ICustomPrs { - public: +public: /// Reference to the construction type of the feature - inline static const std::string& AUXILIARY_ID() - { + inline static const std::string &AUXILIARY_ID() { static const std::string MY_AUXILIARY_ID("Auxiliary"); return MY_AUXILIARY_ID; } /// Reference to the external edge or vertex as a AttributeSelection - inline static const std::string& EXTERNAL_ID() - { + inline static const std::string &EXTERNAL_ID() { static const std::string MY_EXTERNAL_ID("External"); return MY_EXTERNAL_ID; } /// Reference to the copy type of the feature - inline static const std::string& COPY_ID() - { + inline static const std::string ©_ID() { static const std::string MY_COPY_ID("Copy"); return MY_COPY_ID; } /// Reference to the parent feature if exist - inline static const std::string& PARENT_ID() - { - static const std::string& MY_PARENT_ID("ParentFeature"); + inline static const std::string &PARENT_ID() { + static const std::string &MY_PARENT_ID("ParentFeature"); return MY_PARENT_ID; } /// Width of the auxiliary line - inline static const int SKETCH_LINE_WIDTH_AUXILIARY() - { - return 2; - } + inline static const int SKETCH_LINE_WIDTH_AUXILIARY() { return 2; } /// Width of the line - inline static const int SKETCH_LINE_WIDTH() - { + inline static const int SKETCH_LINE_WIDTH() { return Config_PropManager::integer("Visualization", "sketch_line_width"); } /// Style of the auxiliary line - inline static const int SKETCH_LINE_STYLE_AUXILIARY() - { - return 3; - } + inline static const int SKETCH_LINE_STYLE_AUXILIARY() { return 3; } /// Style of the line - inline static const int SKETCH_LINE_STYLE() - { - return 0; - } + inline static const int SKETCH_LINE_STYLE() { return 0; } - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all + /// attributes virtual void initAttributes(); - /// Returns true of the feature is created basing on the external shape of not-this-sketch object - virtual bool isExternal() const - { + /// Returns true of the feature is created basing on the external shape of + /// not-this-sketch object + virtual bool isExternal() const { AttributeSelectionPtr aAttr = data()->selection(EXTERNAL_ID()); if (aAttr) return aAttr->context().get() != NULL && !aAttr->isInvalid(); @@ -109,81 +99,90 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature //, public GeomAPI } /// Returns true of the feature is a copy of other feature - virtual bool isCopy() const - { + virtual bool isCopy() const { AttributeBooleanPtr anAttr = data()->boolean(COPY_ID()); - if(anAttr.get()) { + if (anAttr.get()) { return anAttr->value(); } return false; } - //virtual bool isIncludeToResult() const + // virtual bool isIncludeToResult() const //{ - // AttributeBooleanPtr anAttr; - // std::set aRefsToMe = data()->refsToMe(); - // std::set::const_iterator aIt; - // for (aIt = aRefsToMe.cbegin(); aIt != aRefsToMe.cend(); ++aIt) { - // if ((*aIt)->id() == "ProjectedFeature") { - // FeaturePtr aFeature = std::dynamic_pointer_cast((*aIt)->owner()); - // if (aFeature.get()) { - // anAttr = aFeature->data()->boolean("IncludeToResult"); - // if (anAttr.get()) - // return anAttr->value(); - // } - // } - // } - // return true; - //} - -// LCOV_EXCL_START + // AttributeBooleanPtr anAttr; + // std::set aRefsToMe = data()->refsToMe(); + // std::set::const_iterator aIt; + // for (aIt = aRefsToMe.cbegin(); aIt != aRefsToMe.cend(); ++aIt) { + // if ((*aIt)->id() == "ProjectedFeature") { + // FeaturePtr aFeature = + // std::dynamic_pointer_cast((*aIt)->owner()); if + // (aFeature.get()) { + // anAttr = aFeature->data()->boolean("IncludeToResult"); + // if (anAttr.get()) + // return anAttr->value(); + // } + // } + // } + // return true; + // } + + // LCOV_EXCL_START /// Customize presentation of the feature - //virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - // std::shared_ptr theDefaultPrs) + // virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr + // thePrs, + // std::shared_ptr + // theDefaultPrs) //{ - // /// Store previous color values of the presentation to check it after setting specific entity - // /// color. Default color is set into presentation to have not modified isCustomized state - // /// after default customize prs is completed. - // std::vector aPrevColor; - // aPrevColor.resize(3); - // thePrs->getColor(aPrevColor[0], aPrevColor[1], aPrevColor[2]); - // if (theResult.get()) { - // std::string aSection, aName, aDefault; - // theResult->colorConfigInfo(aSection, aName, aDefault); - // std::vector aColor; - // aColor = Config_PropManager::color(aSection, aName); - // thePrs->setColor(aColor[0], aColor[1], aColor[2]); - // } + // /// Store previous color values of the presentation to check it after + // setting specific entity + // /// color. Default color is set into presentation to have not modified + // isCustomized state + // /// after default customize prs is completed. + // std::vector aPrevColor; + // aPrevColor.resize(3); + // thePrs->getColor(aPrevColor[0], aPrevColor[1], aPrevColor[2]); + // if (theResult.get()) { + // std::string aSection, aName, aDefault; + // theResult->colorConfigInfo(aSection, aName, aDefault); + // std::vector aColor; + // aColor = Config_PropManager::color(aSection, aName); + // thePrs->setColor(aColor[0], aColor[1], aColor[2]); + // } // bool isCustomized = theDefaultPrs.get() != NULL && - // theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); + // theDefaultPrs->customisePresentation(theResult, + // thePrs, theDefaultPrs); // int aShapeType = thePrs->getShapeType(); // // a compound is processed like the edge because the // // arc feature uses the compound for presentable AIS - // if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/) + // if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && + // aShapeType != 0/*compound*/) // return false; // // set color from preferences // std::vector aColor; // std::shared_ptr anAuxiliaryAttr = // data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); - // bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value(); - // if (isConstruction) { - // aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color"); + // bool isConstruction = anAuxiliaryAttr.get() != NULL && + // anAuxiliaryAttr->value(); if (isConstruction) { + // aColor = Config_PropManager::color("Visualization", + // "sketch_auxiliary_color"); // } // else if (isExternal()) { - // aColor = Config_PropManager::color("Visualization", "sketch_external_color"); + // aColor = Config_PropManager::color("Visualization", + // "sketch_external_color"); // } // else { - // aColor = Config_PropManager::color("Visualization", "sketch_entity_color"); + // aColor = Config_PropManager::color("Visualization", + // "sketch_entity_color"); // } // if (!aColor.empty()) { // if (theResult.get() && ModelAPI_Session::get()->isOperation()) { // AttributeIntArrayPtr aColorAttr = // theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); // aColorAttr->setSize(3); - // // Set the color attribute in order do not use default colors in the presentation object - // for (int i = 0; i < 3; i++) + // // Set the color attribute in order do not use default colors in the + // presentation object for (int i = 0; i < 3; i++) // aColorAttr->setValue(i, aColor[i]); // } // thePrs->setColor(aColor[0], aColor[1], aColor[2]); @@ -191,14 +190,17 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature //, public GeomAPI // isCustomized = aColor[i] != aPrevColor[i]; // } - // if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a compound + // if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a + // compound // if (isConstruction) { - // isCustomized = thePrs->setWidth(SKETCH_LINE_WIDTH_AUXILIARY()) || isCustomized; - // isCustomized = thePrs->setLineStyle(SKETCH_LINE_STYLE_AUXILIARY()) || isCustomized; + // isCustomized = thePrs->setWidth(SKETCH_LINE_WIDTH_AUXILIARY()) || + // isCustomized; isCustomized = + // thePrs->setLineStyle(SKETCH_LINE_STYLE_AUXILIARY()) || isCustomized; // } // else { // isCustomized = thePrs->setWidth(SKETCH_LINE_WIDTH()) || isCustomized; - // isCustomized = thePrs->setLineStyle(SKETCH_LINE_STYLE()) || isCustomized; + // isCustomized = thePrs->setLineStyle(SKETCH_LINE_STYLE()) || + // isCustomized; // } // } // else if (aShapeType == 7) { // otherwise this is a vertex @@ -213,12 +215,12 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature //, public GeomAPI // } // if (!theResult.get()) { - // double aDeflection = Config_PropManager::real("Visualization", "construction_deflection"); - // thePrs->setDeflection(aDeflection); + // double aDeflection = Config_PropManager::real("Visualization", + // "construction_deflection"); thePrs->setDeflection(aDeflection); // } // return isCustomized; //} -// LCOV_EXCL_STOP + // LCOV_EXCL_STOP protected: /// initializes mySketch @@ -229,7 +231,6 @@ protected: /// \brief Initializes attributes of derived class which were added recently. virtual void initDerivedClassAttributes2(){}; - }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Split.cpp b/src/SketchPlugin/SketchPlugin_Split.cpp index ab89602c1..9219f4288 100644 --- a/src/SketchPlugin/SketchPlugin_Split.cpp +++ b/src/SketchPlugin/SketchPlugin_Split.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Split.h" @@ -25,8 +26,8 @@ #include #include #include -#include #include +#include #include @@ -36,9 +37,9 @@ #include #include #include -#include #include #include +#include #include @@ -59,9 +60,9 @@ #include #include -#include -#include #include +#include +#include #include @@ -73,13 +74,11 @@ static const double PI = 3.141592653589793238463; -SketchPlugin_Split::SketchPlugin_Split() -{ -} +SketchPlugin_Split::SketchPlugin_Split() {} -void SketchPlugin_Split::initAttributes() -{ - data()->addAttribute(SELECTED_OBJECT(), ModelAPI_AttributeReference::typeId()); +void SketchPlugin_Split::initAttributes() { + data()->addAttribute(SELECTED_OBJECT(), + ModelAPI_AttributeReference::typeId()); data()->addAttribute(SELECTED_POINT(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(PREVIEW_POINT(), GeomDataAPI_Point2D::typeId()); @@ -89,46 +88,51 @@ void SketchPlugin_Split::initAttributes() data()->attribute(SELECTED_POINT())->setIsArgument(false); data()->attribute(PREVIEW_OBJECT())->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PREVIEW_POINT()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PREVIEW_OBJECT()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + PREVIEW_POINT()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PREVIEW_OBJECT()); } -void SketchPlugin_Split::execute() -{ +void SketchPlugin_Split::execute() { std::shared_ptr aData = data(); // Check the base objects are initialized. - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SELECTED_OBJECT())); - if(!aBaseObjectAttr->isInitialized()) { + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SELECTED_OBJECT())); + if (!aBaseObjectAttr->isInitialized()) { setError("Error: Base object is not initialized."); return; } ObjectPtr aBaseObject = aBaseObjectAttr->value(); AttributePoint2DPtr aFirstPointAttrOfSplit = getPointAttribute(true); AttributePoint2DPtr aSecondPointAttrOfSplit = getPointAttribute(false); - if (!aFirstPointAttrOfSplit.get() || !aFirstPointAttrOfSplit->isInitialized() || - !aSecondPointAttrOfSplit.get() || !aSecondPointAttrOfSplit->isInitialized()) { + if (!aFirstPointAttrOfSplit.get() || + !aFirstPointAttrOfSplit->isInitialized() || + !aSecondPointAttrOfSplit.get() || + !aSecondPointAttrOfSplit->isInitialized()) { setError("Error: Sub-shape is not initialized."); return; } - // Remove reference of this feature to feature used in preview, it is not necessary anymore - // as trim will be removed after execute + // Remove reference of this feature to feature used in preview, it is not + // necessary anymore as trim will be removed after execute AttributeReferencePtr aPreviewObjectAttr = - std::dynamic_pointer_cast( - data()->attribute(PREVIEW_OBJECT())); + std::dynamic_pointer_cast( + data()->attribute(PREVIEW_OBJECT())); ObjectPtr aPreviewObject = aPreviewObjectAttr->value(); AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( - data()->attribute(PREVIEW_POINT())); + data()->attribute(PREVIEW_POINT())); std::shared_ptr aPreviewPnt2d = aPoint->pnt(); // nullify pointer of preview attribute aPreviewObjectAttr->setValue(ResultPtr()); bool anIsEqualPreviewAndSelected = aPreviewObject == aBaseObject; // Wait all constraints being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); @@ -138,11 +142,11 @@ void SketchPlugin_Split::execute() ResultPtr aBaseFeatureResult = aBaseFeature->lastResult(); std::set aFeaturesToDelete, aFeaturesToUpdate; - //std::map aTangentFeatures; + // std::map aTangentFeatures; std::map aCoincidenceToFeature; getConstraints(aFeaturesToDelete, aFeaturesToUpdate, aCoincidenceToFeature); - std::map > aBaseRefAttributes; + std::map> aBaseRefAttributes; std::list aRefsToFeature; SketchPlugin_SegmentationTools::getRefAttributes( aBaseFeature, aBaseRefAttributes, aRefsToFeature); @@ -154,8 +158,9 @@ void SketchPlugin_Split::execute() std::cout << "SketchPlugin_Split::execute()" << std::endl; std::cout << std::endl; - SketchPlugin_Sketch* aSketch = sketch(); - std::cout << "SKETCH FEATURES (before split) [" << aSketch->numberOfSubs() << "]:" << std::endl; + SketchPlugin_Sketch *aSketch = sketch(); + std::cout << "SKETCH FEATURES (before split) [" << aSketch->numberOfSubs() + << "]:" << std::endl; for (int i = 0, aNbSubs = aSketch->numberOfSubs(); i < aNbSubs; i++) { std::cout << getFeatureInfo(aSketch->subFeature(i), false) << std::endl; } @@ -166,26 +171,30 @@ void SketchPlugin_Split::execute() std::cout << std::endl; if (!aCoincidenceToFeature.empty()) { - std::cout << "Coincidences to base feature[" << - aCoincidenceToFeature.size() << "]: " << std::endl; - std::map::const_iterator anIt = aCoincidenceToFeature.begin(), - aLast = aCoincidenceToFeature.end(); + std::cout << "Coincidences to base feature[" << aCoincidenceToFeature.size() + << "]: " << std::endl; + std::map::const_iterator + anIt = aCoincidenceToFeature.begin(), + aLast = aCoincidenceToFeature.end(); for (int i = 1; anIt != aLast; anIt++, i++) { FeaturePtr aFeature = (*anIt).first; std::string anAttributeId = (*anIt).second.first; std::shared_ptr aPointAttr = (*anIt).second.second; std::cout << i << "-" << getFeatureInfo(aFeature) << std::endl; - std::cout << " -Attribute to correct:" << anAttributeId << std::endl; - std::cout << " -Point attribute:" << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aPointAttr) << std::endl; + std::cout << " -Attribute to correct:" << anAttributeId << std::endl; + std::cout << " -Point attribute:" + << ModelGeomAlgo_Point2D::getPointAttributeInfo(aPointAttr) + << std::endl; } } - std::map >::const_iterator - aRefIt = aBaseRefAttributes.begin(), aRefLast = aBaseRefAttributes.end(); - std::cout << std::endl << "References to attributes of base feature [" << - aBaseRefAttributes.size() << "]" << std::endl; + std::map>::const_iterator + aRefIt = aBaseRefAttributes.begin(), + aRefLast = aBaseRefAttributes.end(); + std::cout << std::endl + << "References to attributes of base feature [" + << aBaseRefAttributes.size() << "]" << std::endl; for (; aRefIt != aRefLast; aRefIt++) { AttributePtr aBaseAttr = aRefIt->first; std::list aRefAttributes = aRefIt->second; @@ -201,13 +210,14 @@ void SketchPlugin_Split::execute() aRefsInfo.append("(" + aRFeature->name() + ") "); } std::shared_ptr aPointAttr = - std::dynamic_pointer_cast(aBaseAttr); - std::cout << aPointAttr->id().c_str() << - ": " << "[" << aRefAttributes.size() << "] " << aRefsInfo << std::endl; + std::dynamic_pointer_cast(aBaseAttr); + std::cout << aPointAttr->id().c_str() << ": " + << "[" << aRefAttributes.size() << "] " << aRefsInfo << std::endl; } std::cout << std::endl; - std::cout << std::endl << "References to base feature [" << - aRefsToFeature.size() << "]" << std::endl; + std::cout << std::endl + << "References to base feature [" << aRefsToFeature.size() << "]" + << std::endl; std::list::const_iterator aRefAttrIt = aRefsToFeature.begin(), aRefAttrLast = aRefsToFeature.end(); std::string aRefsInfo; @@ -221,7 +231,6 @@ void SketchPlugin_Split::execute() } std::cout << "[" << aRefsToFeature.size() << "] " << aRefsInfo << std::endl; - std::cout << std::endl; std::cout << "---- SPLIT ----" << std::endl; std::cout << std::endl; @@ -236,21 +245,26 @@ void SketchPlugin_Split::execute() std::set> aModifiedAttributes; FeaturePtr aReplacingFeature, aNewFeature; if (aFeatureKind == SketchPlugin_Line::ID()) - aNewFeature = splitLine(aSplitFeature, aBaseFeature, anAfterFeature, - aFurtherCoincidences, aCreatedFeatures, aModifiedAttributes); + aNewFeature = + splitLine(aSplitFeature, aBaseFeature, anAfterFeature, + aFurtherCoincidences, aCreatedFeatures, aModifiedAttributes); else if (aFeatureKind == SketchPlugin_Arc::ID()) - aNewFeature = splitArc(aSplitFeature, aBaseFeature, anAfterFeature, aFurtherCoincidences, - aCreatedFeatures, aModifiedAttributes); + aNewFeature = + splitArc(aSplitFeature, aBaseFeature, anAfterFeature, + aFurtherCoincidences, aCreatedFeatures, aModifiedAttributes); else if (aFeatureKind == SketchPlugin_EllipticArc::ID()) aNewFeature = splitEllipticArc(aSplitFeature, aBaseFeature, anAfterFeature, - aFurtherCoincidences, aCreatedFeatures, aModifiedAttributes); + aFurtherCoincidences, aCreatedFeatures, + aModifiedAttributes); restoreCurrentFeature(); - if (aFeatureKind == SketchPlugin_Circle::ID() || aFeatureKind == SketchPlugin_Ellipse::ID()) { + if (aFeatureKind == SketchPlugin_Circle::ID() || + aFeatureKind == SketchPlugin_Ellipse::ID()) { aFeaturesToDelete.insert(aBaseFeature); aReplacingFeature = splitClosed(aSplitFeature, aBaseFeature, anAfterFeature, - aFurtherCoincidences, aCreatedFeatures, aModifiedAttributes); + aFurtherCoincidences, aCreatedFeatures, + aModifiedAttributes); updateRefFeatureConstraints(aBaseFeature->lastResult(), aRefsToFeature); @@ -260,12 +274,14 @@ void SketchPlugin_Split::execute() #ifdef DEBUG_SPLIT std::cout << "---- OUT PARAMETERS ----" << std::endl; - std::cout << "Base modified feature:" << getFeatureInfo(aBaseFeature) << std::endl; + std::cout << "Base modified feature:" << getFeatureInfo(aBaseFeature) + << std::endl; std::cout << "Split feature:" << getFeatureInfo(aSplitFeature) << std::endl; std::cout << "After feature:" << getFeatureInfo(anAfterFeature) << std::endl; std::cout << std::endl; - std::cout << "Created features by split:[" << aCreatedFeatures.size() << "]" << std::endl; + std::cout << "Created features by split:[" << aCreatedFeatures.size() << "]" + << std::endl; std::set::const_iterator aFIt = aCreatedFeatures.begin(), aFLast = aCreatedFeatures.end(); for (; aFIt != aFLast; aFIt++) { @@ -274,8 +290,10 @@ void SketchPlugin_Split::execute() std::cout << std::endl; std::cout << "Attributes for further Coincidences:" << std::endl; - std::set::const_iterator anIt = aFurtherCoincidences.begin(), - aLast = aFurtherCoincidences.end(); + std::set::const_iterator anIt = aFurtherCoincidences + .begin(), + aLast = + aFurtherCoincidences.end(); for (; anIt != aLast; anIt++) { AttributePtr anAttribute = *anIt; FeaturePtr aFeature = ModelAPI_Feature::feature(anAttribute->owner()); @@ -283,9 +301,11 @@ void SketchPlugin_Split::execute() << " [" << getFeatureInfo(aFeature, false) << "]" << std::endl; } - std::cout << "Modifed attributes (constraints to attributes are moved here):" << std::endl; - std::set >::const_iterator - aPIt = aModifiedAttributes.begin(), aPLast = aModifiedAttributes.end(); + std::cout << "Modifed attributes (constraints to attributes are moved here):" + << std::endl; + std::set>::const_iterator + aPIt = aModifiedAttributes.begin(), + aPLast = aModifiedAttributes.end(); std::string aResInfo; for (; aPIt != aPLast; aPIt++) { if (!aResInfo.empty()) @@ -314,10 +334,12 @@ void SketchPlugin_Split::execute() aFeatureResults.insert(anAfterFeature->lastResult()); // coincidence to feature - updateCoincidenceConstraintsToFeature(aCoincidenceToFeature, aFurtherCoincidences, - aFeatureResults, aSplitFeature, aFeaturesToDelete); + updateCoincidenceConstraintsToFeature(aCoincidenceToFeature, + aFurtherCoincidences, aFeatureResults, + aSplitFeature, aFeaturesToDelete); - SketchPlugin_SegmentationTools::updateRefAttConstraints(aBaseRefAttributes, aModifiedAttributes); + SketchPlugin_SegmentationTools::updateRefAttConstraints(aBaseRefAttributes, + aModifiedAttributes); // delete constraints #ifdef DEBUG_SPLIT @@ -341,14 +363,15 @@ void SketchPlugin_Split::execute() std::cout << std::endl; } #endif - SketchPlugin_SegmentationTools::updateFeaturesAfterOperation(aFeaturesToUpdate); + SketchPlugin_SegmentationTools::updateFeaturesAfterOperation( + aFeaturesToUpdate); // Send events to update the sub-features by the solver. - if(isUpdateFlushed) { + if (isUpdateFlushed) { Events_Loop::loop()->setFlushed(anUpdateEvent, true); } - if (anIsEqualPreviewAndSelected) { + if (anIsEqualPreviewAndSelected) { // equal preview and selected objects // nothing to do if the preview and selected objects are different ResultPtr aReplacingResult; @@ -358,37 +381,41 @@ void SketchPlugin_Split::execute() } if (aReplacingResult.get()) { // base object was removed aPreviewObject = aReplacingResult; - //aMessage->setSelectedObject(aReplacingResult); - - //GeomShapePtr aSelectedShape = aReplacingResult->shape(); - //std::shared_ptr aPreviewPnt = sketch()->to3D(aPreviewPnt2d->x(), - // aPreviewPnt2d->y()); - //std::shared_ptr aProjectedPoint; - //if (ModelGeomAlgo_Point2D::isPointOnEdge(aSelectedShape, aPreviewPnt, aProjectedPoint)) { - //bool aValue = true; + // aMessage->setSelectedObject(aReplacingResult); + + // GeomShapePtr aSelectedShape = aReplacingResult->shape(); + // std::shared_ptr aPreviewPnt = + // sketch()->to3D(aPreviewPnt2d->x(), + // aPreviewPnt2d->y()); + // std::shared_ptr aProjectedPoint; + // if (ModelGeomAlgo_Point2D::isPointOnEdge(aSelectedShape, aPreviewPnt, + // aProjectedPoint)) { bool aValue = true; //} - //aBaseShape = aShape; + // aBaseShape = aShape; #ifdef DEBUG_SPLIT if (!aSelectedShape.get()) std::cout << "Set empty selected object" << std::endl; else - std::cout << "Set shape with ShapeType: " << aSelectedShape->shapeTypeStr() << std::endl; + std::cout << "Set shape with ShapeType: " + << aSelectedShape->shapeTypeStr() << std::endl; #endif - //bool aValue = true; - } - else { + // bool aValue = true; + } else { aPreviewObject = ObjectPtr(); - aBaseFeature->execute(); // should recompute shapes of result to do not check obsolete one + aBaseFeature->execute(); // should recompute shapes of result to do not + // check obsolete one aBaseObject = aBaseFeature->lastResult(); - std::shared_ptr aPreviewPnt = sketch()->to3D(aPreviewPnt2d->x(), - aPreviewPnt2d->y()); - ResultPtr aBaseResult = std::dynamic_pointer_cast(aBaseObject); + std::shared_ptr aPreviewPnt = + sketch()->to3D(aPreviewPnt2d->x(), aPreviewPnt2d->y()); + ResultPtr aBaseResult = + std::dynamic_pointer_cast(aBaseObject); if (aBaseResult) { GeomShapePtr aShape = aBaseResult->shape(); std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, aProjectedPoint)) + if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, + aProjectedPoint)) aPreviewObject = aBaseResult; } if (!aPreviewObject.get() && aNewFeature.get()) { @@ -396,23 +423,25 @@ void SketchPlugin_Split::execute() if (aNewFeatureResult.get()) { GeomShapePtr aShape = aNewFeatureResult->shape(); std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, aProjectedPoint)) + if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, + aProjectedPoint)) aPreviewObject = aNewFeatureResult; } } } } if (aPreviewObject.get()) { - std::shared_ptr aMessage = std::shared_ptr - (new ModelAPI_EventReentrantMessage( - ModelAPI_EventReentrantMessage::eventId(), this)); + std::shared_ptr aMessage = + std::shared_ptr( + new ModelAPI_EventReentrantMessage( + ModelAPI_EventReentrantMessage::eventId(), this)); aMessage->setSelectedObject(aPreviewObject); Events_Loop::loop()->send(aMessage); } - #ifdef DEBUG_SPLIT - std::cout << "SKETCH FEATURES (after split) [" << aSketch->numberOfSubs() << "]:" << std::endl; + std::cout << "SKETCH FEATURES (after split) [" << aSketch->numberOfSubs() + << "]:" << std::endl; for (int i = 0, aNbSubs = aSketch->numberOfSubs(); i < aNbSubs; i++) { std::cout << getFeatureInfo(aSketch->subFeature(i), false) << std::endl; } @@ -420,15 +449,16 @@ void SketchPlugin_Split::execute() } // LCOV_EXCL_START -std::string SketchPlugin_Split::processEvent(const std::shared_ptr& theMessage) -{ +std::string SketchPlugin_Split::processEvent( + const std::shared_ptr &theMessage) { #ifdef DEBUG_SPLIT - std::cout << "SketchPlugin_Split::processEvent:" << data()->name() << std::endl; + std::cout << "SketchPlugin_Split::processEvent:" << data()->name() + << std::endl; #endif std::string aFilledAttributeName; std::shared_ptr aMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMessage.get()) { ObjectPtr anObject = aMessage->selectedObject(); std::shared_ptr aPoint = aMessage->clickedPoint(); @@ -438,47 +468,51 @@ std::string SketchPlugin_Split::processEvent(const std::shared_ptr& aShapes = myCashedShapes[anObject]; + const std::set &aShapes = myCashedShapes[anObject]; if (aShapes.size() > 1) { std::shared_ptr aRefSelectedAttr = - std::dynamic_pointer_cast( - data()->attribute(SELECTED_OBJECT())); + std::dynamic_pointer_cast( + data()->attribute(SELECTED_OBJECT())); std::shared_ptr aRefPreviewAttr = - std::dynamic_pointer_cast( - data()->attribute(PREVIEW_OBJECT())); + std::dynamic_pointer_cast( + data()->attribute(PREVIEW_OBJECT())); aRefSelectedAttr->setValue(anObject); aRefPreviewAttr->setValue(anObject); std::shared_ptr aPointSelectedAttr = - std::dynamic_pointer_cast( - data()->attribute(SELECTED_POINT())); + std::dynamic_pointer_cast( + data()->attribute(SELECTED_POINT())); std::shared_ptr aPointPreviewAttr = - std::dynamic_pointer_cast( - data()->attribute(PREVIEW_POINT())); + std::dynamic_pointer_cast( + data()->attribute(PREVIEW_POINT())); aPointSelectedAttr->setValue(aPoint); aPointPreviewAttr->setValue(aPoint); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - GeomShapePtr aSelectedShape = SketchPlugin_SegmentationTools::getSubShape(this, - SELECTED_OBJECT(), SELECTED_POINT(), myCashedShapes, myCashedReferences); + GeomShapePtr aSelectedShape = + SketchPlugin_SegmentationTools::getSubShape( + this, SELECTED_OBJECT(), SELECTED_POINT(), myCashedShapes, + myCashedReferences); if (aSelectedShape.get()) { aFilledAttributeName = SELECTED_OBJECT(); - } - else { + } else { // #2480 - sub shape is not initialized when split sketch - // If restarted operation use some selection on the shape that is split and - // result selectiona can not participate in new split(checked shape above is null), - // reset filled values of selection set in this method above + // If restarted operation use some selection on the shape that is + // split and result selectiona can not participate in new + // split(checked shape above is null), reset filled values of + // selection set in this method above aRefSelectedAttr->setValue(ResultPtr()); aRefPreviewAttr->setValue(ResultPtr()); } - #ifdef DEBUG_SPLIT +#ifdef DEBUG_SPLIT if (!aSelectedShape.get()) std::cout << "Set empty selected object" << std::endl; else - std::cout << "Set shape with ShapeType: " << aSelectedShape->shapeTypeStr() << std::endl; - #endif + std::cout << "Set shape with ShapeType: " + << aSelectedShape->shapeTypeStr() << std::endl; +#endif } } } @@ -486,22 +520,23 @@ std::string SketchPlugin_Split::processEvent(const std::shared_ptr& theFeaturesToDelete, - std::set& theFeaturesToUpdate, - std::map& theCoincidenceToFeature) -{ +void SketchPlugin_Split::getConstraints( + std::set &theFeaturesToDelete, + std::set &theFeaturesToUpdate, + std::map &theCoincidenceToFeature) { std::shared_ptr aData = data(); // Check the base objects are initialized. - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SELECTED_OBJECT())); + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SELECTED_OBJECT())); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); ResultPtr aBaseFeatureResult = aBaseFeature->lastResult(); @@ -512,7 +547,8 @@ void SketchPlugin_Split::getConstraints(std::set& theFeaturesToDelet std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr aAttr = (*aIt); - FeaturePtr aRefFeature = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aRefFeature = + std::dynamic_pointer_cast(aAttr->owner()); std::string aRefFeatureKind = aRefFeature->getKind(); if (aRefFeatureKind == SketchPlugin_ConstraintMirror::ID() || aRefFeatureKind == SketchPlugin_MultiRotation::ID() || @@ -522,25 +558,32 @@ void SketchPlugin_Split::getConstraints(std::set& theFeaturesToDelet else if (aRefFeatureKind == SketchPlugin_ConstraintLength::ID()) theFeaturesToUpdate.insert(aRefFeature); else if (aRefFeatureKind == SketchPlugin_ConstraintCoincidence::ID() || - aRefFeatureKind == SketchPlugin_ConstraintCoincidenceInternal::ID()) { + aRefFeatureKind == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { std::string anAttributeToBeModified; AttributePoint2DPtr aCoincidentPoint; - AttributeRefAttrPtr anAttrA = aRefFeature->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr anAttrB = aRefFeature->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr anAttrA = + aRefFeature->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr anAttrB = + aRefFeature->refattr(SketchPlugin_Constraint::ENTITY_B()); bool isToFeature = false; - if (anAttrA->isObject() || anAttrB->isObject()) { // coincidence to base feature - FeaturePtr aFeature = anAttrA->isObject() ? ModelAPI_Feature::feature(anAttrA->object()) - : FeaturePtr(); + if (anAttrA->isObject() || + anAttrB->isObject()) { // coincidence to base feature + FeaturePtr aFeature = anAttrA->isObject() + ? ModelAPI_Feature::feature(anAttrA->object()) + : FeaturePtr(); isToFeature = aFeature.get() && aFeature == aBaseFeature; anAttributeToBeModified = anAttrA->id(); if (!isToFeature) { - aFeature = anAttrB->isObject() ? ModelAPI_Feature::feature(anAttrB->object()) - : FeaturePtr(); + aFeature = anAttrB->isObject() + ? ModelAPI_Feature::feature(anAttrB->object()) + : FeaturePtr(); isToFeature = aFeature.get() && aFeature == aBaseFeature; anAttributeToBeModified = anAttrB->id(); } if (isToFeature) - aCoincidentPoint = SketchPlugin_ConstraintCoincidence::getPoint(aRefFeature); + aCoincidentPoint = + SketchPlugin_ConstraintCoincidence::getPoint(aRefFeature); } if (!isToFeature) { // coincidence to point on base feature AttributePtr anAttribute; @@ -548,7 +591,8 @@ void SketchPlugin_Split::getConstraints(std::set& theFeaturesToDelet if (!anAttrA->isObject()) { AttributePtr aCurAttribute = anAttrA->attr(); if (aCurAttribute.get()) { - FeaturePtr aCurFeature = ModelAPI_Feature::feature(aCurAttribute->owner()); + FeaturePtr aCurFeature = + ModelAPI_Feature::feature(aCurAttribute->owner()); if (aCurFeature.get() && aCurFeature == aBaseFeature) { anAttribute = anAttrB->attr(); anAttributeToBeModified = anAttrA->id(); @@ -558,7 +602,8 @@ void SketchPlugin_Split::getConstraints(std::set& theFeaturesToDelet if (!anAttribute.get() && !anAttrB->isObject()) { AttributePtr aCurAttribute = anAttrB->attr(); if (aCurAttribute.get()) { - FeaturePtr aCurFeature = ModelAPI_Feature::feature(aCurAttribute->owner()); + FeaturePtr aCurFeature = + ModelAPI_Feature::feature(aCurAttribute->owner()); if (aCurFeature.get() && aCurFeature == aBaseFeature) { anAttribute = anAttrA->attr(); anAttributeToBeModified = anAttrB->id(); @@ -566,50 +611,58 @@ void SketchPlugin_Split::getConstraints(std::set& theFeaturesToDelet } } if (anAttribute.get()) - aCoincidentPoint = std::dynamic_pointer_cast(anAttribute); + aCoincidentPoint = + std::dynamic_pointer_cast(anAttribute); } if (aCoincidentPoint.get() && isToFeature) - theCoincidenceToFeature[aRefFeature] = std::make_pair(anAttributeToBeModified, - aCoincidentPoint); + theCoincidenceToFeature[aRefFeature] = + std::make_pair(anAttributeToBeModified, aCoincidentPoint); } } } void SketchPlugin_Split::updateCoincidenceConstraintsToFeature( - const std::map, IdToPointPair>& theCoincidenceToFeature, - const std::set >& theFurtherCoincidences, - const std::set& theFeatureResults, - const FeaturePtr& theSplitFeature, - std::set& theFeaturesToDelete) -{ + const std::map, IdToPointPair> + &theCoincidenceToFeature, + const std::set> + &theFurtherCoincidences, + const std::set &theFeatureResults, + const FeaturePtr &theSplitFeature, + std::set &theFeaturesToDelete) { if (theCoincidenceToFeature.empty()) return; // we should build coincidence constraints to end of the split feature - std::set > aNewCoincidencesToSplitFeature; + std::set> aNewCoincidencesToSplitFeature; AttributePoint2DPtr aStartPointAttr, anEndPointAttr; SketchPlugin_SegmentationTools::getFeaturePoints( theSplitFeature, aStartPointAttr, anEndPointAttr); - if (theFurtherCoincidences.find(aStartPointAttr) == theFurtherCoincidences.end()) + if (theFurtherCoincidences.find(aStartPointAttr) == + theFurtherCoincidences.end()) aNewCoincidencesToSplitFeature.insert(aStartPointAttr); - if (theFurtherCoincidences.find(anEndPointAttr) == theFurtherCoincidences.end()) + if (theFurtherCoincidences.find(anEndPointAttr) == + theFurtherCoincidences.end()) aNewCoincidencesToSplitFeature.insert(anEndPointAttr); - std::map::const_iterator aCIt = theCoincidenceToFeature.begin(), - aCLast = theCoincidenceToFeature.end(); + std::map::const_iterator + aCIt = theCoincidenceToFeature.begin(), + aCLast = theCoincidenceToFeature.end(); #ifdef DEBUG_SPLIT std::cout << std::endl; - std::cout << "Coincidences to feature(modified):"<< std::endl; + std::cout << "Coincidences to feature(modified):" << std::endl; #endif for (; aCIt != aCLast; aCIt++) { FeaturePtr aCoincFeature = aCIt->first; std::string anAttributeId = aCIt->second.first; - std::string aSecondAttribute = anAttributeId == SketchPlugin_Constraint::ENTITY_A() ? - SketchPlugin_Constraint::ENTITY_B() : SketchPlugin_Constraint::ENTITY_A(); + std::string aSecondAttribute = + anAttributeId == SketchPlugin_Constraint::ENTITY_A() + ? SketchPlugin_Constraint::ENTITY_B() + : SketchPlugin_Constraint::ENTITY_A(); AttributePoint2DPtr aCoincPoint = aCIt->second.second; - std::set::const_iterator aFCIt = theFurtherCoincidences.begin(), - aFCLast = theFurtherCoincidences.end(); + std::set::const_iterator + aFCIt = theFurtherCoincidences.begin(), + aFCLast = theFurtherCoincidences.end(); std::shared_ptr aCoincPnt = aCoincPoint->pnt(); AttributePoint2DPtr aFeaturePointAttribute; for (; aFCIt != aFCLast && !aFeaturePointAttribute.get(); aFCIt++) { @@ -619,73 +672,77 @@ void SketchPlugin_Split::updateCoincidenceConstraintsToFeature( } if (aFeaturePointAttribute.get()) { // create new constraint and remove the current - aCoincFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aFeaturePointAttribute, aCoincFeature->refattr(aSecondAttribute)->attr()); + aCoincFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + aFeaturePointAttribute, + aCoincFeature->refattr(aSecondAttribute)->attr()); theFeaturesToDelete.insert(aCIt->first); // create new coincidences to split feature points - std::set::const_iterator aSFIt = aNewCoincidencesToSplitFeature.begin(), - aSFLast = aNewCoincidencesToSplitFeature.end(); + std::set::const_iterator + aSFIt = aNewCoincidencesToSplitFeature.begin(), + aSFLast = aNewCoincidencesToSplitFeature.end(); for (; aSFIt != aSFLast; aSFIt++) { AttributePoint2DPtr aSFAttribute = *aSFIt; if (aCoincPnt->isEqual(aSFAttribute->pnt())) { - SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aSFAttribute, aCoincFeature->refattr(aSecondAttribute)->attr()); + SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), aSFAttribute, + aCoincFeature->refattr(aSecondAttribute)->attr()); } } - } - else { + } else { // find feature by shape intersected the point ResultPtr aResultForCoincidence = *(theFeatureResults.begin()); - if (theFeatureResults.size() > 1) { // try to find point on additional feature + if (theFeatureResults.size() > + 1) { // try to find point on additional feature ResultPtr anAddtionalResult = *(theFeatureResults.begin()++); GeomShapePtr aShape = anAddtionalResult->shape(); std::shared_ptr aPnt2d = aCoincPoint->pnt(); - std::shared_ptr aPoint = sketch()->to3D(aPnt2d->x(), aPnt2d->y()); + std::shared_ptr aPoint = + sketch()->to3D(aPnt2d->x(), aPnt2d->y()); std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPoint, aProjectedPoint)) + if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPoint, + aProjectedPoint)) aResultForCoincidence = anAddtionalResult; } aCoincFeature->refattr(anAttributeId)->setObject(aResultForCoincidence); } #ifdef DEBUG_SPLIT - std::cout << " -" << getFeatureInfo(aCoincFeature) << std::endl; + std::cout << " -" << getFeatureInfo(aCoincFeature) << std::endl; #endif } } void SketchPlugin_Split::updateRefFeatureConstraints( - const ResultPtr& theFeatureBaseResult, - const std::list& theRefsToFeature) -{ + const ResultPtr &theFeatureBaseResult, + const std::list &theRefsToFeature) { std::list::const_iterator anIt = theRefsToFeature.begin(), aLast = theRefsToFeature.end(); for (; anIt != aLast; anIt++) { - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*anIt); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(*anIt); if (aRefAttr.get()) aRefAttr->setObject(theFeatureBaseResult); } } -FeaturePtr SketchPlugin_Split::splitLine(FeaturePtr& theSplitFeature, - FeaturePtr& theBaseFeatureModified, - FeaturePtr& theAfterFeature, - std::set& thePoints, - std::set& theCreatedFeatures, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Split::splitLine( + FeaturePtr &theSplitFeature, FeaturePtr &theBaseFeatureModified, + FeaturePtr &theAfterFeature, std::set &thePoints, + std::set &theCreatedFeatures, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; std::set aCreatedFeatures; FeaturePtr aConstraintFeature; - theBaseFeatureModified = FeaturePtr(); // it will contain modified base feature + theBaseFeatureModified = + FeaturePtr(); // it will contain modified base feature - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SELECTED_OBJECT())); + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SELECTED_OBJECT())); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); AttributePoint2DPtr aFirstPointAttrOfSplit = getPointAttribute(true); @@ -703,29 +760,40 @@ FeaturePtr SketchPlugin_Split::splitLine(FeaturePtr& theSplitFeature, aFirstPointAttrOfSplit, aSecondPointAttrOfSplit); #ifdef DEBUG_SPLIT - std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl; - std::cout << "Start point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aStartPointAttrOfBase) << std::endl; - std::cout << "1st point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aFirstPointAttrOfSplit) << std::endl; - std::cout << "2nd point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aSecondPointAttrOfSplit) << std::endl; - std::cout << "End point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(anEndPointAttrOfBase) << std::endl; + std::cout << "Arranged points (to build split between 1st and 2nd points:" + << std::endl; + std::cout << "Start point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aStartPointAttrOfBase) + << std::endl; + std::cout << "1st point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aFirstPointAttrOfSplit) + << std::endl; + std::cout << "2nd point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aSecondPointAttrOfSplit) + << std::endl; + std::cout << "End point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + anEndPointAttrOfBase) + << std::endl; #endif // create a split feature theSplitFeature = SketchPlugin_SegmentationTools::createLineFeature( - aBaseFeature, aFirstPointAttrOfSplit->pnt(), aSecondPointAttrOfSplit->pnt()); + aBaseFeature, aFirstPointAttrOfSplit->pnt(), + aSecondPointAttrOfSplit->pnt()); theCreatedFeatures.insert(theSplitFeature); // before split feature if (aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) { - theModifiedAttributes.insert(std::make_pair(aStartPointAttrOfBase, - theSplitFeature->attribute(SketchPlugin_Line::START_ID()))); - } - else { - theBaseFeatureModified = aBaseFeature; // use base feature to store all constraints here + theModifiedAttributes.insert(std::make_pair( + aStartPointAttrOfBase, + theSplitFeature->attribute(SketchPlugin_Line::START_ID()))); + } else { + theBaseFeatureModified = + aBaseFeature; // use base feature to store all constraints here // move end arc point to start of split } @@ -734,92 +802,91 @@ FeaturePtr SketchPlugin_Split::splitLine(FeaturePtr& theSplitFeature, FeaturePtr aFeature; if (!theBaseFeatureModified.get()) { aFeature = aBaseFeature; // use base feature to store all constraints here - fillAttribute(aFeature->attribute(SketchPlugin_Line::START_ID()), aSecondPointAttrOfSplit); + fillAttribute(aFeature->attribute(SketchPlugin_Line::START_ID()), + aSecondPointAttrOfSplit); aFeature->execute(); // to update result - } - else { + } else { aFeature = SketchPlugin_SegmentationTools::createLineFeature( - aBaseFeature, aSecondPointAttrOfSplit->pnt(), anEndPointAttrOfBase->pnt()); + aBaseFeature, aSecondPointAttrOfSplit->pnt(), + anEndPointAttrOfBase->pnt()); theCreatedFeatures.insert(aFeature); - theModifiedAttributes.insert(std::make_pair(anEndPointAttrOfBase, - aFeature->attribute(SketchPlugin_Line::END_ID()))); + theModifiedAttributes.insert( + std::make_pair(anEndPointAttrOfBase, + aFeature->attribute(SketchPlugin_Line::END_ID()))); anNewFeature = aFeature; } - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theSplitFeature->attribute(SketchPlugin_Line::END_ID()), - aFeature->attribute(SketchPlugin_Line::START_ID())); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theSplitFeature->attribute(SketchPlugin_Line::END_ID()), + aFeature->attribute(SketchPlugin_Line::START_ID())); theCreatedFeatures.insert(aConstraintFeature); - thePoints.insert(std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_Line::START_ID()))); - thePoints.insert(std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_Line::END_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Line::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Line::END_ID()))); if (!theBaseFeatureModified.get()) theBaseFeatureModified = aFeature; else theAfterFeature = aFeature; - } - else { - thePoints.insert(std::dynamic_pointer_cast - (theSplitFeature->attribute(SketchPlugin_Line::END_ID()))); - theModifiedAttributes.insert(std::make_pair(anEndPointAttrOfBase, - theSplitFeature->attribute(SketchPlugin_Line::END_ID()))); + } else { + thePoints.insert(std::dynamic_pointer_cast( + theSplitFeature->attribute(SketchPlugin_Line::END_ID()))); + theModifiedAttributes.insert(std::make_pair( + anEndPointAttrOfBase, + theSplitFeature->attribute(SketchPlugin_Line::END_ID()))); } // base split, that is defined before split feature should be changed at end - // (after the after feature creation). Otherwise modified value will be used in after feature - // before split feature + // (after the after feature creation). Otherwise modified value will be used + // in after feature before split feature if (!aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) { // move end arc point to start of split - fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()), - aFirstPointAttrOfSplit); + fillAttribute( + theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()), + aFirstPointAttrOfSplit); theBaseFeatureModified->execute(); // to update result - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()), - theSplitFeature->attribute(SketchPlugin_Line::START_ID())); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()), + theSplitFeature->attribute(SketchPlugin_Line::START_ID())); theCreatedFeatures.insert(aConstraintFeature); - thePoints.insert(std::dynamic_pointer_cast - (theBaseFeatureModified->attribute(SketchPlugin_Line::START_ID()))); - thePoints.insert(std::dynamic_pointer_cast - (theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()))); - } - else - thePoints.insert(std::dynamic_pointer_cast - (theSplitFeature->attribute(SketchPlugin_Line::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + theBaseFeatureModified->attribute(SketchPlugin_Line::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()))); + } else + thePoints.insert(std::dynamic_pointer_cast( + theSplitFeature->attribute(SketchPlugin_Line::START_ID()))); #ifdef CREATE_CONSTRAINTS // additional constraints between split and base features - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintParallel::ID(), - aBaseFeature->lastResult(), - theSplitFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintParallel::ID(), + aBaseFeature->lastResult(), theSplitFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); if (theAfterFeature.get()) { - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintParallel::ID(), - aBaseFeature->lastResult(), - theAfterFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintParallel::ID(), + aBaseFeature->lastResult(), theAfterFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); } #endif return anNewFeature; } -FeaturePtr SketchPlugin_Split::splitArc(FeaturePtr& theSplitFeature, - FeaturePtr& theBaseFeatureModified, - FeaturePtr& theAfterFeature, - std::set& thePoints, - std::set& theCreatedFeatures, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Split::splitArc( + FeaturePtr &theSplitFeature, FeaturePtr &theBaseFeatureModified, + FeaturePtr &theAfterFeature, std::set &thePoints, + std::set &theCreatedFeatures, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; std::set aCreatedFeatures; FeaturePtr aConstraintFeature; - theBaseFeatureModified = FeaturePtr(); // it will contain modified base feature + theBaseFeatureModified = + FeaturePtr(); // it will contain modified base feature AttributeReferencePtr aBaseObjectAttr = reference(SELECTED_OBJECT()); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); @@ -837,29 +904,40 @@ FeaturePtr SketchPlugin_Split::splitArc(FeaturePtr& theSplitFeature, arrangePointsOnArc(aBaseFeature, aStartPointAttrOfBase, anEndPointAttrOfBase, aFirstPointAttrOfSplit, aSecondPointAttrOfSplit); #ifdef DEBUG_SPLIT - std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl; - std::cout << "Start point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aStartPointAttrOfBase) << std::endl; - std::cout << "1st point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aFirstPointAttrOfSplit) << std::endl; - std::cout << "2nd point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aSecondPointAttrOfSplit) << std::endl; - std::cout << "End point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(anEndPointAttrOfBase) << std::endl; + std::cout << "Arranged points (to build split between 1st and 2nd points:" + << std::endl; + std::cout << "Start point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aStartPointAttrOfBase) + << std::endl; + std::cout << "1st point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aFirstPointAttrOfSplit) + << std::endl; + std::cout << "2nd point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aSecondPointAttrOfSplit) + << std::endl; + std::cout << "End point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + anEndPointAttrOfBase) + << std::endl; #endif // split feature theSplitFeature = SketchPlugin_SegmentationTools::createArcFeature( - aBaseFeature, aFirstPointAttrOfSplit->pnt(), aSecondPointAttrOfSplit->pnt()); + aBaseFeature, aFirstPointAttrOfSplit->pnt(), + aSecondPointAttrOfSplit->pnt()); theCreatedFeatures.insert(theSplitFeature); // before split feature if (aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) { - theModifiedAttributes.insert(std::make_pair(aStartPointAttrOfBase, - theSplitFeature->attribute(SketchPlugin_Arc::START_ID()))); - } - else { - theBaseFeatureModified = aBaseFeature; // use base feature to store all constraints here + theModifiedAttributes.insert(std::make_pair( + aStartPointAttrOfBase, + theSplitFeature->attribute(SketchPlugin_Arc::START_ID()))); + } else { + theBaseFeatureModified = + aBaseFeature; // use base feature to store all constraints here // move end arc point to start of split } @@ -868,102 +946,98 @@ FeaturePtr SketchPlugin_Split::splitArc(FeaturePtr& theSplitFeature, FeaturePtr aFeature; if (!theBaseFeatureModified.get()) { aFeature = aBaseFeature; // use base feature to store all constraints here - fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), aSecondPointAttrOfSplit); + fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), + aSecondPointAttrOfSplit); aFeature->execute(); // to update result - } - else { + } else { aFeature = SketchPlugin_SegmentationTools::createArcFeature( - aBaseFeature, aSecondPointAttrOfSplit->pnt(), anEndPointAttrOfBase->pnt()); + aBaseFeature, aSecondPointAttrOfSplit->pnt(), + anEndPointAttrOfBase->pnt()); theCreatedFeatures.insert(aFeature); - theModifiedAttributes.insert(std::make_pair(anEndPointAttrOfBase, - aFeature->attribute(SketchPlugin_Arc::END_ID()))); + theModifiedAttributes.insert( + std::make_pair(anEndPointAttrOfBase, + aFeature->attribute(SketchPlugin_Arc::END_ID()))); anNewFeature = aFeature; } - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theSplitFeature->attribute(SketchPlugin_Arc::END_ID()), - aFeature->attribute(SketchPlugin_Arc::START_ID())); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theSplitFeature->attribute(SketchPlugin_Arc::END_ID()), + aFeature->attribute(SketchPlugin_Arc::START_ID())); theCreatedFeatures.insert(aConstraintFeature); - thePoints.insert(std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_Arc::START_ID()))); - thePoints.insert(std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_Arc::END_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Arc::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Arc::END_ID()))); if (!theBaseFeatureModified.get()) theBaseFeatureModified = aFeature; else theAfterFeature = aFeature; - } - else { - thePoints.insert(std::dynamic_pointer_cast - (theSplitFeature->attribute(SketchPlugin_Arc::END_ID()))); - theModifiedAttributes.insert(std::make_pair(anEndPointAttrOfBase, - theSplitFeature->attribute(SketchPlugin_Arc::END_ID()))); + } else { + thePoints.insert(std::dynamic_pointer_cast( + theSplitFeature->attribute(SketchPlugin_Arc::END_ID()))); + theModifiedAttributes.insert( + std::make_pair(anEndPointAttrOfBase, + theSplitFeature->attribute(SketchPlugin_Arc::END_ID()))); } // base split, that is defined before split feature should be changed at end - // (after the after feature creation). Otherwise modified value will be used in after feature - // before split feature + // (after the after feature creation). Otherwise modified value will be used + // in after feature before split feature if (!aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) { // move end arc point to start of split fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()), - aFirstPointAttrOfSplit); + aFirstPointAttrOfSplit); theBaseFeatureModified->execute(); // to update result - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()), - theSplitFeature->attribute(SketchPlugin_Arc::START_ID())); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()), + theSplitFeature->attribute(SketchPlugin_Arc::START_ID())); theCreatedFeatures.insert(aConstraintFeature); - thePoints.insert(std::dynamic_pointer_cast - (theBaseFeatureModified->attribute(SketchPlugin_Arc::START_ID()))); - thePoints.insert(std::dynamic_pointer_cast - (theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()))); - } - else - thePoints.insert(std::dynamic_pointer_cast - (theSplitFeature->attribute(SketchPlugin_Arc::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + theBaseFeatureModified->attribute(SketchPlugin_Arc::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()))); + } else + thePoints.insert(std::dynamic_pointer_cast( + theSplitFeature->attribute(SketchPlugin_Arc::START_ID()))); - // additional constraints between split and base features + // additional constraints between split and base features #ifdef CREATE_CONSTRAINTS - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintEqual::ID(), - aBaseFeature->lastResult(), - theSplitFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintEqual::ID(), aBaseFeature->lastResult(), + theSplitFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintTangent::ID(), - theSplitFeature->lastResult(), - aBaseFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintTangent::ID(), + theSplitFeature->lastResult(), aBaseFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); if (theAfterFeature.get()) { - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintEqual::ID(), - aBaseFeature->lastResult(), - theAfterFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintEqual::ID(), + aBaseFeature->lastResult(), theAfterFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintTangent::ID(), - theSplitFeature->lastResult(), - theAfterFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintTangent::ID(), + theSplitFeature->lastResult(), theAfterFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); } #endif return anNewFeature; } -FeaturePtr SketchPlugin_Split::splitEllipticArc(FeaturePtr& theSplitFeature, - FeaturePtr& theBaseFeatureModified, - FeaturePtr& theAfterFeature, - std::set& thePoints, - std::set& theCreatedFeatures, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Split::splitEllipticArc( + FeaturePtr &theSplitFeature, FeaturePtr &theBaseFeatureModified, + FeaturePtr &theAfterFeature, std::set &thePoints, + std::set &theCreatedFeatures, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; std::set aCreatedFeatures; FeaturePtr aConstraintFeature; - theBaseFeatureModified = FeaturePtr(); // it will contain modified base feature + theBaseFeatureModified = + FeaturePtr(); // it will contain modified base feature AttributeReferencePtr aBaseObjectAttr = reference(SELECTED_OBJECT()); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); @@ -981,29 +1055,41 @@ FeaturePtr SketchPlugin_Split::splitEllipticArc(FeaturePtr& theSplitFeature, arrangePointsOnArc(aBaseFeature, aStartPointAttrOfBase, anEndPointAttrOfBase, aFirstPointAttrOfSplit, aSecondPointAttrOfSplit); #ifdef DEBUG_SPLIT - std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl; - std::cout << "Start point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aStartPointAttrOfBase) << std::endl; - std::cout << "1st point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aFirstPointAttrOfSplit) << std::endl; - std::cout << "2nd point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(aSecondPointAttrOfSplit) << std::endl; - std::cout << "End point: " << - ModelGeomAlgo_Point2D::getPointAttributeInfo(anEndPointAttrOfBase) << std::endl; + std::cout << "Arranged points (to build split between 1st and 2nd points:" + << std::endl; + std::cout << "Start point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aStartPointAttrOfBase) + << std::endl; + std::cout << "1st point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aFirstPointAttrOfSplit) + << std::endl; + std::cout << "2nd point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + aSecondPointAttrOfSplit) + << std::endl; + std::cout << "End point: " + << ModelGeomAlgo_Point2D::getPointAttributeInfo( + anEndPointAttrOfBase) + << std::endl; #endif // split feature theSplitFeature = SketchPlugin_SegmentationTools::createArcFeature( - aBaseFeature, aFirstPointAttrOfSplit->pnt(), aSecondPointAttrOfSplit->pnt()); + aBaseFeature, aFirstPointAttrOfSplit->pnt(), + aSecondPointAttrOfSplit->pnt()); theCreatedFeatures.insert(theSplitFeature); // before split feature if (aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) { - theModifiedAttributes.insert(std::make_pair(aStartPointAttrOfBase, - theSplitFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); - } - else { - theBaseFeatureModified = aBaseFeature; // use base feature to store all constraints here + theModifiedAttributes.insert( + std::make_pair(aStartPointAttrOfBase, + theSplitFeature->attribute( + SketchPlugin_EllipticArc::START_POINT_ID()))); + } else { + theBaseFeatureModified = + aBaseFeature; // use base feature to store all constraints here // move end arc point to start of split } @@ -1012,102 +1098,103 @@ FeaturePtr SketchPlugin_Split::splitEllipticArc(FeaturePtr& theSplitFeature, FeaturePtr aFeature; if (!theBaseFeatureModified.get()) { aFeature = aBaseFeature; // use base feature to store all constraints here - fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), aSecondPointAttrOfSplit); + fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), + aSecondPointAttrOfSplit); aFeature->execute(); // to update result - } - else { + } else { aFeature = SketchPlugin_SegmentationTools::createArcFeature( - aBaseFeature, aSecondPointAttrOfSplit->pnt(), anEndPointAttrOfBase->pnt()); + aBaseFeature, aSecondPointAttrOfSplit->pnt(), + anEndPointAttrOfBase->pnt()); theCreatedFeatures.insert(aFeature); theModifiedAttributes.insert(std::make_pair( - anEndPointAttrOfBase, aFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); + anEndPointAttrOfBase, + aFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); anNewFeature = aFeature; } - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theSplitFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()), - aFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theSplitFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()), + aFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); theCreatedFeatures.insert(aConstraintFeature); - thePoints.insert(std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); - thePoints.insert(std::dynamic_pointer_cast - (aFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); if (!theBaseFeatureModified.get()) theBaseFeatureModified = aFeature; else theAfterFeature = aFeature; - } - else { + } else { thePoints.insert(std::dynamic_pointer_cast( theSplitFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); - theModifiedAttributes.insert(std::make_pair(anEndPointAttrOfBase, + theModifiedAttributes.insert(std::make_pair( + anEndPointAttrOfBase, theSplitFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); } // base split, that is defined before split feature should be changed at end - // (after the after feature creation). Otherwise modified value will be used in after feature - // before split feature + // (after the after feature creation). Otherwise modified value will be used + // in after feature before split feature if (!aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) { // move end arc point to start of split - fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::END_POINT_ID()), + fillAttribute(theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::END_POINT_ID()), aFirstPointAttrOfSplit); theBaseFeatureModified->execute(); // to update result - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::END_POINT_ID()), - theSplitFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::END_POINT_ID()), + theSplitFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); theCreatedFeatures.insert(aConstraintFeature); thePoints.insert(std::dynamic_pointer_cast( - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::START_POINT_ID()))); thePoints.insert(std::dynamic_pointer_cast( - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); - } - else + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::END_POINT_ID()))); + } else thePoints.insert(std::dynamic_pointer_cast( - theSplitFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); + theSplitFeature->attribute( + SketchPlugin_EllipticArc::START_POINT_ID()))); - // additional constraints between split and base features + // additional constraints between split and base features #ifdef CREATE_CONSTRAINTS - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintEqual::ID(), - aBaseFeature->lastResult(), - theSplitFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintEqual::ID(), aBaseFeature->lastResult(), + theSplitFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintTangent::ID(), - theSplitFeature->lastResult(), - aBaseFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintTangent::ID(), + theSplitFeature->lastResult(), aBaseFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); if (theAfterFeature.get()) { - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintEqual::ID(), - aBaseFeature->lastResult(), - theAfterFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintEqual::ID(), + aBaseFeature->lastResult(), theAfterFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintTangent::ID(), - theSplitFeature->lastResult(), - theAfterFeature->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintTangent::ID(), + theSplitFeature->lastResult(), theAfterFeature->lastResult()); theCreatedFeatures.insert(aConstraintFeature); } #endif return anNewFeature; } -FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature, - FeaturePtr& theBaseFeatureModified, - FeaturePtr& /*theAfterFeature*/, - std::set& thePoints, - std::set& theCreatedFeatures, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Split::splitClosed( + FeaturePtr &theSplitFeature, FeaturePtr &theBaseFeatureModified, + FeaturePtr & /*theAfterFeature*/, std::set &thePoints, + std::set &theCreatedFeatures, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; std::set aCreatedFeatures; FeaturePtr aConstraintFeature; - theBaseFeatureModified = FeaturePtr(); // it will contain modified base feature + theBaseFeatureModified = + FeaturePtr(); // it will contain modified base feature AttributeReferencePtr aBaseObjectAttr = reference(SELECTED_OBJECT()); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); @@ -1117,15 +1204,19 @@ FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature, // split feature theSplitFeature = SketchPlugin_SegmentationTools::createArcFeature( - aBaseFeature, aFirstPointAttrOfSplit->pnt(), aSecondPointAttrOfSplit->pnt()); - const std::string& aReversedAttrName = theSplitFeature->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::REVERSED_ID() : SketchPlugin_EllipticArc::REVERSED_ID(); + aBaseFeature, aFirstPointAttrOfSplit->pnt(), + aSecondPointAttrOfSplit->pnt()); + const std::string &aReversedAttrName = + theSplitFeature->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::REVERSED_ID() + : SketchPlugin_EllipticArc::REVERSED_ID(); bool aSplitReversed = theSplitFeature->boolean(aReversedAttrName)->value(); theCreatedFeatures.insert(theSplitFeature); // base feature is a left part of the circle theBaseFeatureModified = SketchPlugin_SegmentationTools::createArcFeature( - aBaseFeature, aFirstPointAttrOfSplit->pnt(), aSecondPointAttrOfSplit->pnt()); + aBaseFeature, aFirstPointAttrOfSplit->pnt(), + aSecondPointAttrOfSplit->pnt()); anNewFeature = theBaseFeatureModified; theBaseFeatureModified->boolean(aReversedAttrName)->setValue(!aSplitReversed); theBaseFeatureModified->execute(); @@ -1134,34 +1225,42 @@ FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature, theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Circle::CENTER_ID()), theBaseFeatureModified->attribute(SketchPlugin_Arc::CENTER_ID()))); - } - else if (aBaseFeature->getKind() == SketchPlugin_Ellipse::ID()) { + } else if (aBaseFeature->getKind() == SketchPlugin_Ellipse::ID()) { theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::CENTER_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::CENTER_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::CENTER_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::FIRST_FOCUS_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::FIRST_FOCUS_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::FIRST_FOCUS_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::SECOND_FOCUS_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::SECOND_FOCUS_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::SECOND_FOCUS_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MINOR_AXIS_START_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::MINOR_AXIS_START_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::MINOR_AXIS_START_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MINOR_AXIS_END_ID()), - theBaseFeatureModified->attribute(SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()))); + theBaseFeatureModified->attribute( + SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()))); - // update the PARENT_ID reference for all the features created by the ellipse - const std::set& aRefs = aBaseFeature->data()->refsToMe(); + // update the PARENT_ID reference for all the features created by the + // ellipse + const std::set &aRefs = aBaseFeature->data()->refsToMe(); std::list aRefsToParent; - for (std::set::const_iterator aRef = aRefs.begin(); aRef != aRefs.end(); ++aRef) { + for (std::set::const_iterator aRef = aRefs.begin(); + aRef != aRefs.end(); ++aRef) { if ((*aRef)->id() == SketchPlugin_SketchEntity::PARENT_ID()) aRefsToParent.push_back(*aRef); } @@ -1171,53 +1270,56 @@ FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature, theBaseFeatureModified); FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner()); - SketchPlugin_Tools::replaceInName(anOwner, - aBaseFeature->name(), theBaseFeatureModified->name()); + SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(), + theBaseFeatureModified->name()); SketchPlugin_Tools::replaceInName(anOwner->lastResult(), - aBaseFeature->name(), theBaseFeatureModified->name()); + aBaseFeature->name(), + theBaseFeatureModified->name()); } } theCreatedFeatures.insert(theBaseFeatureModified); - const std::string& aStartAttrName = theSplitFeature->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::START_ID() : SketchPlugin_EllipticArc::START_POINT_ID(); - const std::string& aEndAttrName = theSplitFeature->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::END_ID() : SketchPlugin_EllipticArc::END_POINT_ID(); + const std::string &aStartAttrName = + theSplitFeature->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::START_ID() + : SketchPlugin_EllipticArc::START_POINT_ID(); + const std::string &aEndAttrName = + theSplitFeature->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::END_ID() + : SketchPlugin_EllipticArc::END_POINT_ID(); - thePoints.insert(std::dynamic_pointer_cast - (theBaseFeatureModified->attribute(aStartAttrName))); - thePoints.insert(std::dynamic_pointer_cast - (theBaseFeatureModified->attribute(aEndAttrName))); + thePoints.insert(std::dynamic_pointer_cast( + theBaseFeatureModified->attribute(aStartAttrName))); + thePoints.insert(std::dynamic_pointer_cast( + theBaseFeatureModified->attribute(aEndAttrName))); // additional constraints between split and base features - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theBaseFeatureModified->attribute(aEndAttrName), - theSplitFeature->attribute(aEndAttrName)); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theBaseFeatureModified->attribute(aEndAttrName), + theSplitFeature->attribute(aEndAttrName)); theCreatedFeatures.insert(aConstraintFeature); - aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - theBaseFeatureModified->attribute(aStartAttrName), - theSplitFeature->attribute(aStartAttrName)); + aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + theBaseFeatureModified->attribute(aStartAttrName), + theSplitFeature->attribute(aStartAttrName)); theCreatedFeatures.insert(aConstraintFeature); #ifdef CREATE_CONSTRAINTS - aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(), - SketchPlugin_ConstraintTangent::ID(), - theSplitFeature->lastResult(), - theBaseFeatureModified->lastResult()); + aConstraintFeature = SketchPlugin_Tools::createConstraint( + sketch(), SketchPlugin_ConstraintTangent::ID(), + theSplitFeature->lastResult(), theBaseFeatureModified->lastResult()); theCreatedFeatures.insert(aConstraintFeature); #endif return anNewFeature; } void SketchPlugin_Split::arrangePointsOnLine( - const AttributePoint2DPtr& theStartPointAttr, - const AttributePoint2DPtr& /*theEndPointAttr*/, - AttributePoint2DPtr& theFirstPointAttr, - AttributePoint2DPtr& theLastPointAttr) const -{ + const AttributePoint2DPtr &theStartPointAttr, + const AttributePoint2DPtr & /*theEndPointAttr*/, + AttributePoint2DPtr &theFirstPointAttr, + AttributePoint2DPtr &theLastPointAttr) const { // if first point is closer to last point, swap first and last values if (theStartPointAttr->pnt()->distance(theFirstPointAttr->pnt()) > theStartPointAttr->pnt()->distance(theLastPointAttr->pnt())) { @@ -1228,30 +1330,35 @@ void SketchPlugin_Split::arrangePointsOnLine( } void SketchPlugin_Split::arrangePointsOnArc( - const FeaturePtr& theArc, - const std::shared_ptr& theStartPointAttr, - const std::shared_ptr& /*theEndPointAttr*/, - std::shared_ptr& theFirstPointAttr, - std::shared_ptr& theSecondPointAttr) const -{ + const FeaturePtr &theArc, + const std::shared_ptr &theStartPointAttr, + const std::shared_ptr & /*theEndPointAttr*/, + std::shared_ptr &theFirstPointAttr, + std::shared_ptr &theSecondPointAttr) const { static const double anAngleTol = 1.e-12; - const std::string& aCenterAttrName = theArc->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::CENTER_ID() : SketchPlugin_EllipticArc::CENTER_ID(); - const std::string& aReversedAttrName = theArc->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::REVERSED_ID() : SketchPlugin_EllipticArc::REVERSED_ID(); - - std::shared_ptr aCenter = std::dynamic_pointer_cast( - theArc->attribute(aCenterAttrName))->pnt(); + const std::string &aCenterAttrName = + theArc->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::CENTER_ID() + : SketchPlugin_EllipticArc::CENTER_ID(); + const std::string &aReversedAttrName = + theArc->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::REVERSED_ID() + : SketchPlugin_EllipticArc::REVERSED_ID(); + + std::shared_ptr aCenter = + std::dynamic_pointer_cast( + theArc->attribute(aCenterAttrName)) + ->pnt(); bool isReversed = theArc->boolean(aReversedAttrName)->value(); // collect directions to each point - std::shared_ptr aStartDir( - new GeomAPI_Dir2d(theStartPointAttr->pnt()->xy()->decreased(aCenter->xy()))); - std::shared_ptr aFirstPtDir( - new GeomAPI_Dir2d(theFirstPointAttr->pnt()->xy()->decreased(aCenter->xy()))); - std::shared_ptr aSecondPtDir( - new GeomAPI_Dir2d(theSecondPointAttr->pnt()->xy()->decreased(aCenter->xy()))); + std::shared_ptr aStartDir(new GeomAPI_Dir2d( + theStartPointAttr->pnt()->xy()->decreased(aCenter->xy()))); + std::shared_ptr aFirstPtDir(new GeomAPI_Dir2d( + theFirstPointAttr->pnt()->xy()->decreased(aCenter->xy()))); + std::shared_ptr aSecondPtDir(new GeomAPI_Dir2d( + theSecondPointAttr->pnt()->xy()->decreased(aCenter->xy()))); // sort points by their angular values double aFirstPtAngle = aStartDir->angle(aFirstPtDir); @@ -1269,24 +1376,24 @@ void SketchPlugin_Split::arrangePointsOnArc( } } -void SketchPlugin_Split::fillAttribute(const AttributePtr& theModifiedAttribute, - const AttributePtr& theSourceAttribute) -{ +void SketchPlugin_Split::fillAttribute(const AttributePtr &theModifiedAttribute, + const AttributePtr &theSourceAttribute) { std::string anAttributeType = theModifiedAttribute->attributeType(); if (anAttributeType == GeomDataAPI_Point2D::typeId()) { - AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast( - theModifiedAttribute); - AttributePoint2DPtr aSourceAttribute = std::dynamic_pointer_cast( - theSourceAttribute); + AttributePoint2DPtr aModifiedAttribute = + std::dynamic_pointer_cast(theModifiedAttribute); + AttributePoint2DPtr aSourceAttribute = + std::dynamic_pointer_cast(theSourceAttribute); if (aModifiedAttribute.get() && aSourceAttribute.get()) aModifiedAttribute->setValue(aSourceAttribute->pnt()); - } - else if (anAttributeType == ModelAPI_AttributeBoolean::typeId()) { - AttributeBooleanPtr aModifiedAttribute = std::dynamic_pointer_cast( - theModifiedAttribute); - AttributeBooleanPtr aSourceAttribute = std::dynamic_pointer_cast( - theSourceAttribute); + } else if (anAttributeType == ModelAPI_AttributeBoolean::typeId()) { + AttributeBooleanPtr aModifiedAttribute = + std::dynamic_pointer_cast( + theModifiedAttribute); + AttributeBooleanPtr aSourceAttribute = + std::dynamic_pointer_cast( + theSourceAttribute); if (aModifiedAttribute.get() && aSourceAttribute.get()) aModifiedAttribute->setValue(aSourceAttribute->value()); @@ -1294,46 +1401,46 @@ void SketchPlugin_Split::fillAttribute(const AttributePtr& theModifiedAttribute, } #ifdef _DEBUG -std::set > SketchPlugin_Split::getEdgeAttributes( - const std::shared_ptr& theFeature) -{ - std::set > anAttributes; +std::set> +SketchPlugin_Split::getEdgeAttributes( + const std::shared_ptr &theFeature) { + std::set> anAttributes; std::string aFeatureKind = theFeature->getKind(); if (aFeatureKind == SketchPlugin_Line::ID()) { anAttributes.insert(theFeature->attribute(SketchPlugin_Line::START_ID())); anAttributes.insert(theFeature->attribute(SketchPlugin_Line::END_ID())); - } - else if (aFeatureKind == SketchPlugin_Arc::ID()) { + } else if (aFeatureKind == SketchPlugin_Arc::ID()) { anAttributes.insert(theFeature->attribute(SketchPlugin_Arc::START_ID())); anAttributes.insert(theFeature->attribute(SketchPlugin_Arc::END_ID())); - } - else if (aFeatureKind == SketchPlugin_EllipticArc::ID()) { - anAttributes.insert(theFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); - anAttributes.insert(theFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID())); - } - else if (aFeatureKind == SketchPlugin_Circle::ID()) { + } else if (aFeatureKind == SketchPlugin_EllipticArc::ID()) { + anAttributes.insert( + theFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); + anAttributes.insert( + theFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID())); + } else if (aFeatureKind == SketchPlugin_Circle::ID()) { } return anAttributes; } #endif -std::shared_ptr SketchPlugin_Split::getPointAttribute - (const bool isFirstAttribute) -{ +std::shared_ptr +SketchPlugin_Split::getPointAttribute(const bool isFirstAttribute) { std::shared_ptr anAttribute; - GeomShapePtr aSelectedShape = SketchPlugin_SegmentationTools::getSubShape(this, - SELECTED_OBJECT(), SELECTED_POINT(), myCashedShapes, myCashedReferences); + GeomShapePtr aSelectedShape = SketchPlugin_SegmentationTools::getSubShape( + this, SELECTED_OBJECT(), SELECTED_POINT(), myCashedShapes, + myCashedReferences); if (!aSelectedShape.get()) return anAttribute; if (aSelectedShape->shapeType() != GeomAPI_Shape::EDGE) return anAttribute; - AttributeReferencePtr anObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SELECTED_OBJECT())); + AttributeReferencePtr anObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SELECTED_OBJECT())); ObjectPtr aBaseObject = anObjectAttr->value(); if (!aBaseObject.get()) return anAttribute; @@ -1346,15 +1453,16 @@ std::shared_ptr SketchPlugin_Split::getPointAttribute std::shared_ptr aFirstPointAttr, aLastPointAttr; // find the points in feature attributes FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObject); - std::list a2DPointAttributes = aBaseFeature->data()->attributes( - GeomDataAPI_Point2D::typeId()); + std::list a2DPointAttributes = + aBaseFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list::const_iterator anIt = a2DPointAttributes.begin(), aLast = a2DPointAttributes.end(); for (; anIt != aLast; anIt++) { std::shared_ptr anAttributePoint = - std::dynamic_pointer_cast(*anIt); + std::dynamic_pointer_cast(*anIt); std::shared_ptr aPoint2D = anAttributePoint->pnt(); - std::shared_ptr aPoint3D = sketch()->to3D(aPoint2D->x(), aPoint2D->y()); + std::shared_ptr aPoint3D = + sketch()->to3D(aPoint2D->x(), aPoint2D->y()); if (aFirstPnt->isEqual(aPoint3D)) aFirstPointAttr = anAttributePoint; else if (aLastPnt->isEqual(aPoint3D)) @@ -1362,11 +1470,13 @@ std::shared_ptr SketchPlugin_Split::getPointAttribute } // find the points in coincident features - const GeomAlgoAPI_ShapeTools::PointToRefsMap& aRefAttributes = myCashedReferences.at(aBaseObject); + const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefAttributes = + myCashedReferences.at(aBaseObject); GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator - aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end(); + aRIt = aRefAttributes.begin(), + aRLast = aRefAttributes.end(); for (; aRIt != aRLast; aRIt++) { - const std::list& anAttributes = aRIt->second.first; + const std::list &anAttributes = aRIt->second.first; GeomPointPtr aPoint = aRIt->first; if (!aFirstPointAttr.get() && aFirstPnt->isEqual(aPoint)) aFirstPointAttr = anAttributes.front(); @@ -1382,9 +1492,9 @@ std::shared_ptr SketchPlugin_Split::getPointAttribute } #ifdef _DEBUG -std::string SketchPlugin_Split::getFeatureInfo(const std::shared_ptr& theFeature, - const bool isUseAttributesInfo) -{ +std::string SketchPlugin_Split::getFeatureInfo( + const std::shared_ptr &theFeature, + const bool isUseAttributesInfo) { std::string anInfo; if (!theFeature.get()) { return "none"; @@ -1394,20 +1504,21 @@ std::string SketchPlugin_Split::getFeatureInfo(const std::shared_ptrdata()->name())); if (isUseAttributesInfo) { - std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(theFeature, - getEdgeAttributes(theFeature)); + std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo( + theFeature, getEdgeAttributes(theFeature)); // processing of feature with point 2d attributes, like line, arc, circle if (!aPointsInfo.empty()) { anInfo += ": "; anInfo += "\n"; anInfo += aPointsInfo; - } - else { // process constraint coincidence, find points in ref attr attributes - std::list anAttrs = theFeature->data()->attributes( - ModelAPI_AttributeRefAttr::typeId()); - std::list::const_iterator anIt = anAttrs.begin(), aLast = anAttrs.end(); + } else { // process constraint coincidence, find points in ref attr + // attributes + std::list anAttrs = + theFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); + std::list::const_iterator anIt = anAttrs.begin(), + aLast = anAttrs.end(); std::string anAttributesInfo; - for(; anIt != aLast; anIt++) { + for (; anIt != aLast; anIt++) { if (!anAttributesInfo.empty()) { anAttributesInfo.append(", "); anAttributesInfo += "\n"; @@ -1417,18 +1528,21 @@ std::string SketchPlugin_Split::getFeatureInfo(const std::shared_ptrattributeType(); if (aType == ModelAPI_AttributeRefAttr::typeId()) { std::shared_ptr aRefAttr = - std::dynamic_pointer_cast(anAttr); + std::dynamic_pointer_cast(anAttr); if (aRefAttr.get()) { if (aRefAttr->isObject()) { - FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); + FeaturePtr aFeature = + ModelAPI_Feature::feature(aRefAttr->object()); aValue = "" + getFeatureInfo(aFeature, false); - } - else { + } else { AttributePtr anAttribute = aRefAttr->attr(); if (anAttribute.get()) { - FeaturePtr aFeature = ModelAPI_Feature::feature(anAttribute->owner()); - aValue = "" + ModelGeomAlgo_Point2D::getPointAttributeInfo(anAttribute) + - " [" + getFeatureInfo(aFeature, false) + "]"; + FeaturePtr aFeature = + ModelAPI_Feature::feature(anAttribute->owner()); + aValue = + "" + + ModelGeomAlgo_Point2D::getPointAttributeInfo(anAttribute) + + " [" + getFeatureInfo(aFeature, false) + "]"; } } } diff --git a/src/SketchPlugin/SketchPlugin_Split.h b/src/SketchPlugin/SketchPlugin_Split.h index ed0e9d390..c0def317a 100644 --- a/src/SketchPlugin/SketchPlugin_Split.h +++ b/src/SketchPlugin/SketchPlugin_Split.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Split_H_ @@ -32,74 +33,76 @@ class GeomDataAPI_Point2D; class ModelAPI_Feature; class ModelAPI_Result; -typedef std::pair > IdToPointPair; +typedef std::pair> + IdToPointPair; /** \class SketchPlugin_Split * \ingroup Plugins - * \brief Feature for creation of a new constraint splitting object. Entities for split: + * \brief Feature for creation of a new constraint splitting object. Entities + * for split: * - Linear segment by point(s) on this line * - Circular/elliptic arc by point(s) on this arc * - Circle/ellipse by at least 2 split-points on it * - * The following constraints will be applied after split to keep the divided segments geometry: - * - Coincident constraints for both parts of created segments in the point of splitting + * The following constraints will be applied after split to keep the divided + * segments geometry: + * - Coincident constraints for both parts of created segments in the point of + * splitting * - For linear segments parallel, for circles/ellipses - tangent constraint, - * for arc - tangent and equal constraints. In case of three segments in result - * two couple of constraints are created - * - parallel and equal constraints: the first is between 1st and middle entity, the second is - * between 1st and 3rd. - * - tangency constraints: the first between 1st and 2nd, the second between 2nd and 3rd. - * - Constraints assigned to the feature before split operation are assigned after using rules: - * - Coincident constraints are assigned to the segment where they belong to. Segment of split - * has only a coincidence to the neighbor segment. All constraints used in the splitting of - * this segment are moved to point of neighbor segment. If constraint was initially built - * to the point of splitting segment, it stays for this point. - * - Geometrical and dimensional constraints are assigned to one of result segment, not the - * selected for split. In case of 3 result segments, this will be the segment nearest to the - * start point of arc/line. - * - Replication constraint used split feature will be deleted in the same way as it is deleted - * by any of entity delete in sketch which is used in this constraint. + * for arc - tangent and equal constraints. In case of three segments in + * result two couple of constraints are created + * - parallel and equal constraints: the first is between 1st and middle + * entity, the second is between 1st and 3rd. + * - tangency constraints: the first between 1st and 2nd, the second between + * 2nd and 3rd. + * - Constraints assigned to the feature before split operation are assigned + * after using rules: + * - Coincident constraints are assigned to the segment where they belong to. + * Segment of split has only a coincidence to the neighbor segment. All + * constraints used in the splitting of this segment are moved to point of + * neighbor segment. If constraint was initially built to the point of splitting + * segment, it stays for this point. + * - Geometrical and dimensional constraints are assigned to one of result + * segment, not the selected for split. In case of 3 result segments, this will + * be the segment nearest to the start point of arc/line. + * - Replication constraint used split feature will be deleted in the same + * way as it is deleted by any of entity delete in sketch which is used in this + * constraint. */ -class SketchPlugin_Split : public SketchPlugin_Feature, public GeomAPI_IPresentable, - public ModelAPI_IReentrant -{ - public: +class SketchPlugin_Split : public SketchPlugin_Feature, + public GeomAPI_IPresentable, + public ModelAPI_IReentrant { +public: /// Split constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_SPLIT_ID("SketchSplit"); return MY_SPLIT_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Split::ID(); return MY_KIND; } /// The value parameter for the constraint - inline static const std::string& SELECTED_OBJECT() - { + inline static const std::string &SELECTED_OBJECT() { static const std::string MY_SELECTED_OBJECT("SelectedObject"); return MY_SELECTED_OBJECT; } /// Start 2D point of the split segment - inline static const std::string& SELECTED_POINT() - { + inline static const std::string &SELECTED_POINT() { static const std::string MY_SELECTED_POINT("SelectedPoint"); return MY_SELECTED_POINT; } /// The value parameter for the preview object - inline static const std::string& PREVIEW_OBJECT() - { + inline static const std::string &PREVIEW_OBJECT() { static const std::string MY_PREVIEW_OBJECT("PreviewObject"); return MY_PREVIEW_OBJECT; } /// Start 2D point of the split segment - inline static const std::string& PREVIEW_POINT() - { + inline static const std::string &PREVIEW_POINT() { static const std::string MY_PREVIEW_POINT("PreviewPoint"); return MY_PREVIEW_POINT; } @@ -107,7 +110,8 @@ class SketchPlugin_Split : public SketchPlugin_Feature, public GeomAPI_IPresenta /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Reimplemented from ModelAPI_Feature::isMacro(). @@ -122,157 +126,177 @@ class SketchPlugin_Split : public SketchPlugin_Feature, public GeomAPI_IPresenta SketchPlugin_Split(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); - /// Apply information of the message to current object. It fills selected point and object - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills selected + /// point and object + virtual std::string + processEvent(const std::shared_ptr &theMessage); private: - /// Obtains those constraints of the feature that should be modified. output maps contain - /// point of coincidence and attribute id to be modified after split - /// \param theFeaturesToDelete [out] constrains that will be deleted after split - /// \param theFeaturesToUpdate [out] constrains that will be updated after split - /// \param theTangentFeatures [out] tangent feature to be connected to new feature - /// \param theCoincidenceToFeature [out] coincidence to feature to be connected to new feature - /// \param theCoincidenceToPoint [out] coincidence to point be connected to new feature - void getConstraints(std::set>& theFeaturesToDelete, - std::set>& theFeaturesToUpdate, - std::map, IdToPointPair>& theCoincidenceToFeature); + /// Obtains those constraints of the feature that should be modified. output + /// maps contain point of coincidence and attribute id to be modified after + /// split \param theFeaturesToDelete [out] constrains that will be deleted + /// after split \param theFeaturesToUpdate [out] constrains that will be + /// updated after split \param theTangentFeatures [out] tangent feature to be + /// connected to new feature \param theCoincidenceToFeature [out] coincidence + /// to feature to be connected to new feature \param theCoincidenceToPoint + /// [out] coincidence to point be connected to new feature + void getConstraints( + std::set> &theFeaturesToDelete, + std::set> &theFeaturesToUpdate, + std::map, IdToPointPair> + &theCoincidenceToFeature); /// Move coincidence constraint from feature to point if it is found - /// \param theCoincidenceToFeature coincidence to feature to be connected to new feature - /// \param theFurtherCoincidences a list of points where coincidences will be build - /// \param theFeatureResults created results after split where constaint might be connected - /// \param theSplitFeature feature created by split, new coincidences to points should be created - /// \param theFeaturesToDelete the list of removed features (will be updated here by + /// \param theCoincidenceToFeature coincidence to feature to be connected to + /// new feature \param theFurtherCoincidences a list of points where + /// coincidences will be build \param theFeatureResults created results after + /// split where constaint might be connected \param theSplitFeature feature + /// created by split, new coincidences to points should be created \param + /// theFeaturesToDelete the list of removed features (will be updated here by /// the coincidences to be removed) /// if theCoincidenceToFeature contains equal points void updateCoincidenceConstraintsToFeature( - const std::map, IdToPointPair>& theCoincidenceToFeature, - const std::set >& theFurtherCoincidences, - const std::set& theFeatureResults, - const FeaturePtr& theSplitFeature, - std::set& theFeaturesToDelete); + const std::map, IdToPointPair> + &theCoincidenceToFeature, + const std::set> + &theFurtherCoincidences, + const std::set &theFeatureResults, + const FeaturePtr &theSplitFeature, + std::set &theFeaturesToDelete); /// Move constraints from base feature to given feature /// \param theFeature a base feature /// \param theRefsToFeature list of attributes referenced to base feature - void updateRefFeatureConstraints(const std::shared_ptr& theFeatureBaseResult, - const std::list& theRefsToFeature); + void updateRefFeatureConstraints( + const std::shared_ptr &theFeatureBaseResult, + const std::list &theRefsToFeature); /// Make the base object is splitted by the point attributes /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point - /// \param thePoints a list of points where coincidences will be build - /// \param theCreatedFeatures a container of created features - /// \param theModifiedAttributes a container of attribute on base - /// feature to attribute on new feature - /// \return new line if it was created - FeaturePtr splitLine(std::shared_ptr& theSplitFeature, - std::shared_ptr& theBeforeFeature, - std::shared_ptr& theAfterFeature, - std::set >& thePoints, - std::set>& theCreatedFeatures, - std::set>& theModifiedAttributes); + /// \param theBeforeFeature a feature between start point and the 1st point of + /// split feature \param theAfterFeature a feature between last point of split + /// feature and the end point \param thePoints a list of points where + /// coincidences will be build \param theCreatedFeatures a container of + /// created features \param theModifiedAttributes a container of attribute on + /// base feature to attribute on new feature \return new line if it was + /// created + FeaturePtr splitLine( + std::shared_ptr &theSplitFeature, + std::shared_ptr &theBeforeFeature, + std::shared_ptr &theAfterFeature, + std::set> &thePoints, + std::set> &theCreatedFeatures, + std::set> &theModifiedAttributes); /// Make the base object is splitted by the point attributes /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point - /// \param thePoints a list of points where coincidences will be build - /// \param theCreatedFeatures a container of created features - /// \return new arc if it was created - FeaturePtr splitArc(std::shared_ptr& theSplitFeature, - std::shared_ptr& theBeforeFeature, - std::shared_ptr& theAfterFeature, - std::set >& thePoints, - std::set>& theCreatedFeatures, - std::set>& theModifiedAttributes); + /// \param theBeforeFeature a feature between start point and the 1st point of + /// split feature \param theAfterFeature a feature between last point of split + /// feature and the end point \param thePoints a list of points where + /// coincidences will be build \param theCreatedFeatures a container of + /// created features \return new arc if it was created + FeaturePtr splitArc( + std::shared_ptr &theSplitFeature, + std::shared_ptr &theBeforeFeature, + std::shared_ptr &theAfterFeature, + std::set> &thePoints, + std::set> &theCreatedFeatures, + std::set> &theModifiedAttributes); /// Make the base object is splitted by the point attributes /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point - /// \param thePoints a list of points where coincidences will be build - /// \param theCreatedFeatures a container of created features - /// \return new elliptic arc if it was created - FeaturePtr splitEllipticArc(std::shared_ptr& theSplitFeature, - std::shared_ptr& theBeforeFeature, - std::shared_ptr& theAfterFeature, - std::set >& thePoints, - std::set>& theCreatedFeatures, - std::set>& theModifiedAttributes); + /// \param theBeforeFeature a feature between start point and the 1st point of + /// split feature \param theAfterFeature a feature between last point of split + /// feature and the end point \param thePoints a list of points where + /// coincidences will be build \param theCreatedFeatures a container of + /// created features \return new elliptic arc if it was created + FeaturePtr splitEllipticArc( + std::shared_ptr &theSplitFeature, + std::shared_ptr &theBeforeFeature, + std::shared_ptr &theAfterFeature, + std::set> &thePoints, + std::set> &theCreatedFeatures, + std::set> &theModifiedAttributes); /// Make the base object is splitted by the point attributes /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point - /// \param thePoints a list of points where coincidences will be build - /// \param theCreatedFeatures a container of created features - /// \return new arc if it was created - FeaturePtr splitClosed(std::shared_ptr& theSplitFeature, - std::shared_ptr& theBeforeFeature, - std::shared_ptr& theAfterFeature, - std::set >& thePoints, - std::set>& theCreatedFeatures, - std::set>& theModifiedAttributes); - - /// Correct the first and the second point to provide condition that the first is closer to - /// the start point and the second point - to the last end of current segment. To rearrange - /// them if this condition is not satisfied. + /// \param theBeforeFeature a feature between start point and the 1st point of + /// split feature \param theAfterFeature a feature between last point of split + /// feature and the end point \param thePoints a list of points where + /// coincidences will be build \param theCreatedFeatures a container of + /// created features \return new arc if it was created + FeaturePtr splitClosed( + std::shared_ptr &theSplitFeature, + std::shared_ptr &theBeforeFeature, + std::shared_ptr &theAfterFeature, + std::set> &thePoints, + std::set> &theCreatedFeatures, + std::set> &theModifiedAttributes); + + /// Correct the first and the second point to provide condition that the first + /// is closer to the start point and the second point - to the last end of + /// current segment. To rearrange them if this condition is not satisfied. /// \param theStartPointAttr a start point of a segment /// \param theEndPointAttr an end point of a segment /// \param theFirstPointAttr a start point of a segment /// \param theSecondPointAttr an end point of a segment - void arrangePointsOnLine(const std::shared_ptr& theStartPointAttr, - const std::shared_ptr& theEndPointAttr, - std::shared_ptr& theFirstPointAttr, - std::shared_ptr& theSecondPointAttr) const; - - /// Correct the first and the second point to provide condition that the first is closer to - /// the start point and the second point - to the last end of current segment. To rearrange - /// them if this condition is not satisfied. + void arrangePointsOnLine( + const std::shared_ptr &theStartPointAttr, + const std::shared_ptr &theEndPointAttr, + std::shared_ptr &theFirstPointAttr, + std::shared_ptr &theSecondPointAttr) const; + + /// Correct the first and the second point to provide condition that the first + /// is closer to the start point and the second point - to the last end of + /// current segment. To rearrange them if this condition is not satisfied. /// \param theArc an arc to be split /// \param theStartPointAttr a start point of a segment /// \param theEndPointAttr an end point of a segment /// \param theFirstPointAttr a start point of a segment /// \param theSecondPointAttr an end point of a segment - void arrangePointsOnArc(const FeaturePtr& theArc, - const std::shared_ptr& theStartPointAttr, - const std::shared_ptr& theEndPointAttr, - std::shared_ptr& theFirstPointAttr, - std::shared_ptr& theSecondPointAttr) const; - - /// Fill attribute by value of another attribute. It processes only Point 2D attributes. - /// \param theModifiedAttribute an attribute of GeomDataAPI_Point2D on feature to be modified - /// \param theSourceAttribute an attribute of GeomDataAPI_Point2D to obtain data - void fillAttribute(const AttributePtr& theModifiedAttribute, - const AttributePtr& theSourceAttribute); - - /// Returns attributes of the feature, used in edge build, for arc it is end and start points - /// \param theFeature a feature - /// \return container of attributes - std::set > getEdgeAttributes( - const std::shared_ptr& theFeature); - - /// Returns first attribute coincident to the first/second point of selected shape - /// \param isFirstAttribute true for getting the first atribute, false otherwise - /// \return an attribute or NULL - std::shared_ptr getPointAttribute(const bool isFirstAttribute); + void arrangePointsOnArc( + const FeaturePtr &theArc, + const std::shared_ptr &theStartPointAttr, + const std::shared_ptr &theEndPointAttr, + std::shared_ptr &theFirstPointAttr, + std::shared_ptr &theSecondPointAttr) const; + + /// Fill attribute by value of another attribute. It processes only Point 2D + /// attributes. \param theModifiedAttribute an attribute of + /// GeomDataAPI_Point2D on feature to be modified \param theSourceAttribute an + /// attribute of GeomDataAPI_Point2D to obtain data + void fillAttribute(const AttributePtr &theModifiedAttribute, + const AttributePtr &theSourceAttribute); + + /// Returns attributes of the feature, used in edge build, for arc it is end + /// and start points \param theFeature a feature \return container of + /// attributes + std::set> + getEdgeAttributes(const std::shared_ptr &theFeature); + + /// Returns first attribute coincident to the first/second point of selected + /// shape \param isFirstAttribute true for getting the first atribute, false + /// otherwise \return an attribute or NULL + std::shared_ptr + getPointAttribute(const bool isFirstAttribute); #ifdef _DEBUG /// Return feature name, kind, point attribute values united in a string /// \param theFeature an investigated feature /// \return string value - std::string getFeatureInfo(const std::shared_ptr& theFeature, - const bool isUseAttributesInfo = true); + std::string + getFeatureInfo(const std::shared_ptr &theFeature, + const bool isUseAttributesInfo = true); #endif private: - - std::map, std::set > myCashedShapes; + std::map, std::set> + myCashedShapes; std::map, - GeomAlgoAPI_ShapeTools::PointToRefsMap> myCashedReferences; + GeomAlgoAPI_ShapeTools::PointToRefsMap> + myCashedReferences; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp index 710c6fd18..28991e0ff 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Tools.h" @@ -63,23 +64,19 @@ namespace SketchPlugin_Tools { -void clearExpressions(AttributeDoublePtr theAttribute) -{ +void clearExpressions(AttributeDoublePtr theAttribute) { theAttribute->setText(std::wstring()); } -void clearExpressions(AttributePointPtr theAttribute) -{ +void clearExpressions(AttributePointPtr theAttribute) { theAttribute->setText(std::wstring(), std::wstring(), std::wstring()); } -void clearExpressions(AttributePoint2DPtr theAttribute) -{ +void clearExpressions(AttributePoint2DPtr theAttribute) { theAttribute->setText(std::wstring(), std::wstring()); } -void clearExpressions(AttributePtr theAttribute) -{ +void clearExpressions(AttributePtr theAttribute) { // Double AttributeDoublePtr anAttributeDouble = std::dynamic_pointer_cast(theAttribute); @@ -97,76 +94,80 @@ void clearExpressions(AttributePtr theAttribute) clearExpressions(anAttributePoint2D); } -void clearExpressions(FeaturePtr theFeature) -{ +void clearExpressions(FeaturePtr theFeature) { if (!theFeature.get()) return; - std::list anAttributes = theFeature->data()->attributes(std::string()); + std::list anAttributes = + theFeature->data()->attributes(std::string()); std::list::iterator anAttributeIt = anAttributes.begin(); for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) { clearExpressions(*anAttributeIt); } } -std::shared_ptr getCoincidencePoint(const FeaturePtr theStartCoin) -{ - std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), - SketchPlugin_Constraint::ENTITY_A()); +std::shared_ptr +getCoincidencePoint(const FeaturePtr theStartCoin) { + std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( + theStartCoin.get(), SketchPlugin_Constraint::ENTITY_A()); if (aPnt.get() == NULL) - aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B()); + aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), + SketchPlugin_Constraint::ENTITY_B()); return aPnt; } -std::set findCoincidentConstraints(const ObjectPtr& theObject) -{ +std::set findCoincidentConstraints(const ObjectPtr &theObject) { std::set aCoincident; - const std::set& aRefsList = theObject->data()->refsToMe(); + const std::set &aRefsList = theObject->data()->refsToMe(); std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { - FeaturePtr aConstrFeature = std::dynamic_pointer_cast((*aIt)->owner()); - if (aConstrFeature && (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID() || - aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID())) + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast((*aIt)->owner()); + if (aConstrFeature && + (aConstrFeature->getKind() == + SketchPlugin_ConstraintCoincidence::ID() || + aConstrFeature->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID())) aCoincident.insert(aConstrFeature); } return aCoincident; } -void findCoincidences(const FeaturePtr theStartCoin, - const std::string& theAttr, - std::set& theList, - const bool theIsAttrOnly) -{ +void findCoincidences(const FeaturePtr theStartCoin, const std::string &theAttr, + std::set &theList, const bool theIsAttrOnly) { AttributeRefAttrPtr aPnt = theStartCoin->refattr(theAttr); - if(!aPnt) { + if (!aPnt) { return; } FeaturePtr aObj = ModelAPI_Feature::feature(aPnt->object()); - if(theList.find(aObj) == theList.end()) { + if (theList.find(aObj) == theList.end()) { std::shared_ptr aOrig = getCoincidencePoint(theStartCoin); - if(aOrig.get() == NULL) { + if (aOrig.get() == NULL) { return; } - if(!theIsAttrOnly || !aPnt->isObject()) { + if (!theIsAttrOnly || !aPnt->isObject()) { theList.insert(aObj); } std::set aCoincidences = findCoincidentConstraints(aObj); std::set::const_iterator aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { FeaturePtr aConstrFeature = *aCIt; - std::shared_ptr aPnt2d = getCoincidencePoint(aConstrFeature); - if(aPnt2d.get() && aOrig->isEqual(aPnt2d)) { - findCoincidences(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A(), + std::shared_ptr aPnt2d = + getCoincidencePoint(aConstrFeature); + if (aPnt2d.get() && aOrig->isEqual(aPnt2d)) { + findCoincidences(aConstrFeature, + SketchPlugin_ConstraintCoincidence::ENTITY_A(), theList, theIsAttrOnly); - findCoincidences(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_B(), + findCoincidences(aConstrFeature, + SketchPlugin_ConstraintCoincidence::ENTITY_B(), theList, theIsAttrOnly); } } } } -std::set findFeaturesCoincidentToPoint(const AttributePoint2DPtr& thePoint) -{ +std::set +findFeaturesCoincidentToPoint(const AttributePoint2DPtr &thePoint) { std::set aCoincidentFeatures; FeaturePtr anOwner = ModelAPI_Feature::feature(thePoint->owner()); @@ -178,7 +179,8 @@ std::set findFeaturesCoincidentToPoint(const AttributePoint2DPtr& th bool isPointUsedInCoincidence = false; AttributeRefAttrPtr anOtherCoincidentAttr; for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr) continue; if (!aRefAttr->isObject() && aRefAttr->attr() == thePoint) @@ -202,19 +204,17 @@ std::set findFeaturesCoincidentToPoint(const AttributePoint2DPtr& th // Container for point-point coincidences. // Useful to find points coincident to a given point. -class CoincidentPoints -{ +class CoincidentPoints { static const int THE_DEFAULT_INDEX = -1; public: - void addCoincidence(const AttributePtr& thePoint1, const int theIndex1, - const AttributePtr& thePoint2, const int theIndex2) - { + void addCoincidence(const AttributePtr &thePoint1, const int theIndex1, + const AttributePtr &thePoint2, const int theIndex2) { auto aFound1 = find(thePoint1, theIndex1); auto aFound2 = find(thePoint2, theIndex2); if (aFound1 == myCoincidentPoints.end()) { if (aFound2 == myCoincidentPoints.end()) { - std::map > aNewSet; + std::map> aNewSet; aNewSet[thePoint1].insert(theIndex1); if (thePoint2) aNewSet[thePoint2].insert(theIndex2); @@ -231,15 +231,16 @@ public: } } - std::set coincidentPoints(const AttributePoint2DPtr& thePoint) - { + std::set + coincidentPoints(const AttributePoint2DPtr &thePoint) { collectCoincidentPoints(thePoint); std::set aCoincPoints; auto aFound = find(thePoint, THE_DEFAULT_INDEX); if (aFound != myCoincidentPoints.end()) { for (auto it = aFound->begin(); it != aFound->end(); ++it) { - AttributePoint2DPtr aPoint = std::dynamic_pointer_cast(it->first); + AttributePoint2DPtr aPoint = + std::dynamic_pointer_cast(it->first); if (aPoint) aCoincPoints.insert(aPoint); else { @@ -248,15 +249,18 @@ public: if (aPointArray) { // this is a B-spline feature, the connection is possible // to the first or the last point - FeaturePtr anOwner = ModelAPI_Feature::feature(aPointArray->owner()); + FeaturePtr anOwner = + ModelAPI_Feature::feature(aPointArray->owner()); if (it->second.find(0) != it->second.end()) { - AttributePoint2DPtr aFirstPoint = std::dynamic_pointer_cast( - anOwner->attribute(SketchPlugin_BSpline::START_ID())); + AttributePoint2DPtr aFirstPoint = + std::dynamic_pointer_cast( + anOwner->attribute(SketchPlugin_BSpline::START_ID())); aCoincPoints.insert(aFirstPoint); } if (it->second.find(aPointArray->size() - 1) != it->second.end()) { - AttributePoint2DPtr aFirstPoint = std::dynamic_pointer_cast( - anOwner->attribute(SketchPlugin_BSpline::END_ID())); + AttributePoint2DPtr aFirstPoint = + std::dynamic_pointer_cast( + anOwner->attribute(SketchPlugin_BSpline::END_ID())); aCoincPoints.insert(aFirstPoint); } } @@ -267,25 +271,26 @@ public: } private: - void coincidences(const FeaturePtr& theFeature, - std::set& theCoincidences) const - { + void coincidences(const FeaturePtr &theFeature, + std::set &theCoincidences) const { // iterate through coincideces for the given feature - std::set aCoincidences = SketchPlugin_Tools::findCoincidentConstraints(theFeature); + std::set aCoincidences = + SketchPlugin_Tools::findCoincidentConstraints(theFeature); if (theFeature->getKind() == SketchPlugin_Point::ID()) { std::set aCoincToRes = - SketchPlugin_Tools::findCoincidentConstraints(theFeature->lastResult()); + SketchPlugin_Tools::findCoincidentConstraints( + theFeature->lastResult()); aCoincidences.insert(aCoincToRes.begin(), aCoincToRes.end()); } std::set::const_iterator aCIt = aCoincidences.begin(); - for (; aCIt != aCoincidences.end(); ++aCIt) - { + for (; aCIt != aCoincidences.end(); ++aCIt) { if (theCoincidences.find(*aCIt) != theCoincidences.end()) continue; // already processed theCoincidences.insert(*aCIt); // iterate on coincident attributes for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr) continue; FeaturePtr anOwner; @@ -293,8 +298,7 @@ private: FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); if (aFeature->getKind() == SketchPlugin_Point::ID()) anOwner = aFeature; - } - else + } else anOwner = ModelAPI_Feature::feature(aRefAttr->attr()->owner()); if (anOwner && anOwner != theFeature) coincidences(anOwner, theCoincidences); @@ -304,8 +308,7 @@ private: // Iteratively search points coincident to the given point // (two points may be coincident through the third point) - void collectCoincidentPoints(const AttributePoint2DPtr& thePoint) - { + void collectCoincidentPoints(const AttributePoint2DPtr &thePoint) { AttributePtr aPoints[2]; int anIndicesInArray[2]; @@ -318,25 +321,29 @@ private: aPoints[0] = aPoints[1] = AttributePtr(); anIndicesInArray[0] = anIndicesInArray[1] = THE_DEFAULT_INDEX; for (int i = 0, aPtInd = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr) continue; if (aRefAttr->isObject()) { FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) - aPoints[aPtInd++] = aFeature->attribute(SketchPlugin_Point::COORD_ID()); - } - else { + aPoints[aPtInd++] = + aFeature->attribute(SketchPlugin_Point::COORD_ID()); + } else { AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast(aRefAttr->attr()); AttributePoint2DArrayPtr aPointArray = - std::dynamic_pointer_cast(aRefAttr->attr()); + std::dynamic_pointer_cast( + aRefAttr->attr()); if (aPointAttr) aPoints[aPtInd++] = aPointAttr; else if (aPointArray) { - AttributeIntegerPtr anIndexAttr = (*aCIt)->integer(i == 0 ? - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A() : - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + AttributeIntegerPtr anIndexAttr = (*aCIt)->integer( + i == 0 ? SketchPlugin_ConstraintCoincidenceInternal:: + INDEX_ENTITY_A() + : SketchPlugin_ConstraintCoincidenceInternal:: + INDEX_ENTITY_B()); aPoints[aPtInd] = aPointArray; anIndicesInArray[aPtInd++] = anIndexAttr->value(); } @@ -344,20 +351,22 @@ private: } if (aPoints[0] && aPoints[1]) - addCoincidence(aPoints[0], anIndicesInArray[0], aPoints[1], anIndicesInArray[1]); + addCoincidence(aPoints[0], anIndicesInArray[0], aPoints[1], + anIndicesInArray[1]); } } - std::list< std::map > >::iterator find(const AttributePtr& thePoint, - const int theIndex) - { + std::list>>::iterator + find(const AttributePtr &thePoint, const int theIndex) { auto aSeek = myCoincidentPoints.begin(); for (; aSeek != myCoincidentPoints.end(); ++aSeek) { auto aFound = aSeek->find(thePoint); - if (aFound != aSeek->end() && aFound->second.find(theIndex) != aFound->second.end()) + if (aFound != aSeek->end() && + aFound->second.find(theIndex) != aFound->second.end()) return aSeek; } - // nothing is found, but if the point is a B-spline boundary point, lets check it as poles array + // nothing is found, but if the point is a B-spline boundary point, lets + // check it as poles array FeaturePtr anOwner = ModelAPI_Feature::feature(thePoint->owner()); if (anOwner->getKind() == SketchPlugin_BSpline::ID()) { AttributePtr aPointsArray; @@ -365,10 +374,12 @@ private: if (thePoint->id() == SketchPlugin_BSpline::START_ID()) { aPointsArray = anOwner->attribute(SketchPlugin_BSpline::POLES_ID()); anIndex = 0; - } - else if (thePoint->id() == SketchPlugin_BSpline::END_ID()) { + } else if (thePoint->id() == SketchPlugin_BSpline::END_ID()) { aPointsArray = anOwner->attribute(SketchPlugin_BSpline::POLES_ID()); - anIndex = std::dynamic_pointer_cast(aPointsArray)->size() - 1; + anIndex = + std::dynamic_pointer_cast(aPointsArray) + ->size() - + 1; } if (aPointsArray) return find(aPointsArray, anIndex); @@ -377,70 +388,68 @@ private: } private: - std::list< std::map > > myCoincidentPoints; + std::list>> myCoincidentPoints; }; -std::set findPointsCoincidentToPoint(const AttributePoint2DPtr& thePoint) -{ +std::set +findPointsCoincidentToPoint(const AttributePoint2DPtr &thePoint) { CoincidentPoints aCoincidentPoints; return aCoincidentPoints.coincidentPoints(thePoint); } - -void resetAttribute(SketchPlugin_Feature* theFeature, - const std::string& theId) -{ +void resetAttribute(SketchPlugin_Feature *theFeature, + const std::string &theId) { AttributePtr anAttr = theFeature->attribute(theId); - if(anAttr.get()) { + if (anAttr.get()) { anAttr->reset(); } } -void createCoincidenceOrTangency(SketchPlugin_Feature* theFeature, - const std::string& theId, +void createCoincidenceOrTangency(SketchPlugin_Feature *theFeature, + const std::string &theId, const AttributePtr theAttr, const ObjectPtr theObject, - const bool theIsCanBeTangent) -{ + const bool theIsCanBeTangent) { AttributeRefAttrPtr aRefAttr = theFeature->refattr(theId); - if(aRefAttr.get() && aRefAttr->isInitialized()) { + if (aRefAttr.get() && aRefAttr->isInitialized()) { FeaturePtr aConstraint; - if(!theIsCanBeTangent) { - aConstraint = theFeature->sketch() - ->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + if (!theIsCanBeTangent) { + aConstraint = theFeature->sketch()->addFeature( + SketchPlugin_ConstraintCoincidence::ID()); } else { - if(aRefAttr->isObject()) { + if (aRefAttr->isObject()) { ObjectPtr anObject = aRefAttr->object(); FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); - if(aFeature->getKind() == SketchPlugin_Point::ID()) { - aConstraint = theFeature->sketch() - ->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + if (aFeature->getKind() == SketchPlugin_Point::ID()) { + aConstraint = theFeature->sketch()->addFeature( + SketchPlugin_ConstraintCoincidence::ID()); } else { - aConstraint = theFeature->sketch() - ->addFeature(SketchPlugin_ConstraintTangent::ID()); + aConstraint = theFeature->sketch()->addFeature( + SketchPlugin_ConstraintTangent::ID()); } } else { - aConstraint = theFeature->sketch() - ->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + aConstraint = theFeature->sketch()->addFeature( + SketchPlugin_ConstraintCoincidence::ID()); } } - AttributeRefAttrPtr aRefAttrA = aConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrA = + aConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); aRefAttr->isObject() ? aRefAttrA->setObject(aRefAttr->object()) : aRefAttrA->setAttr(aRefAttr->attr()); - AttributeRefAttrPtr aRefAttrB = aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); - if(theObject.get()) { + AttributeRefAttrPtr aRefAttrB = + aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); + if (theObject.get()) { aRefAttrB->setObject(theObject); - } else if(theAttr.get()) { + } else if (theAttr.get()) { aRefAttrB->setAttr(theAttr); } } } -void convertRefAttrToPointOrTangentCurve(const AttributeRefAttrPtr& theRefAttr, - const AttributePtr& theDefaultAttr, - std::shared_ptr& theTangentCurve, - std::shared_ptr& thePassingPoint) -{ +void convertRefAttrToPointOrTangentCurve( + const AttributeRefAttrPtr &theRefAttr, const AttributePtr &theDefaultAttr, + std::shared_ptr &theTangentCurve, + std::shared_ptr &thePassingPoint) { AttributePtr anAttr = theDefaultAttr; if (theRefAttr->isObject()) { FeaturePtr aTgFeature = ModelAPI_Feature::feature(theRefAttr->object()); @@ -454,187 +463,209 @@ void convertRefAttrToPointOrTangentCurve(const AttributeRefAttrPtr& theRefA } else anAttr = theRefAttr->attr(); - thePassingPoint = std::dynamic_pointer_cast(anAttr)->pnt(); + thePassingPoint = + std::dynamic_pointer_cast(anAttr)->pnt(); } - -FeaturePtr createConstraintAttrAttr(SketchPlugin_Sketch* theSketch, - const std::string& theConstraintId, - const AttributePtr& theFirstAttribute, - const AttributePtr& theSecondAttribute) -{ +FeaturePtr createConstraintAttrAttr(SketchPlugin_Sketch *theSketch, + const std::string &theConstraintId, + const AttributePtr &theFirstAttribute, + const AttributePtr &theSecondAttribute) { FeaturePtr aConstraint = theSketch->addFeature(theConstraintId); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); aRefAttr->setAttr(theFirstAttribute); aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); aRefAttr->setAttr(theSecondAttribute); #if defined(DEBUG_TRIM) || defined(DEBUG_SPLIT) std::cout << " :" << " first attribute - " << theFirstAttribute->id() - << " second attribute - " << theSecondAttribute->id() - << std::endl; + << " second attribute - " << theSecondAttribute->id() << std::endl; #endif return aConstraint; } -FeaturePtr createConstraintAttrObject(SketchPlugin_Sketch* theSketch, - const std::string& theConstraintId, - const AttributePtr& theFirstAttribute, - const ObjectPtr& theSecondObject) -{ +FeaturePtr createConstraintAttrObject(SketchPlugin_Sketch *theSketch, + const std::string &theConstraintId, + const AttributePtr &theFirstAttribute, + const ObjectPtr &theSecondObject) { FeaturePtr aConstraint = theSketch->addFeature(theConstraintId); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); aRefAttr->setAttr(theFirstAttribute); aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); aRefAttr->setObject(theSecondObject); #if defined(DEBUG_TRIM) || defined(DEBUG_SPLIT) std::cout << " :" << " first attribute - " << theFirstAttribute->id() - << " second object - " << ModelAPI_Feature::feature(theSecondObject)->getKind() + << " second object - " + << ModelAPI_Feature::feature(theSecondObject)->getKind() << std::endl; #endif return aConstraint; } -FeaturePtr createConstraintObjectObject(SketchPlugin_Sketch* theSketch, - const std::string& theConstraintId, - const ObjectPtr& theFirstObject, - const ObjectPtr& theSecondObject) -{ +FeaturePtr createConstraintObjectObject(SketchPlugin_Sketch *theSketch, + const std::string &theConstraintId, + const ObjectPtr &theFirstObject, + const ObjectPtr &theSecondObject) { FeaturePtr aConstraint = theSketch->addFeature(theConstraintId); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); aRefAttr->setObject(theFirstObject); aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); aRefAttr->setObject(theSecondObject); #if defined(DEBUG_TRIM) || defined(DEBUG_SPLIT) std::cout << " :" - << " first object - " << ModelAPI_Feature::feature(theFirstObject)->getKind() - << " second object - " << ModelAPI_Feature::feature(theSecondObject)->getKind() + << " first object - " + << ModelAPI_Feature::feature(theFirstObject)->getKind() + << " second object - " + << ModelAPI_Feature::feature(theSecondObject)->getKind() << std::endl; #endif return aConstraint; } -void createAuxiliaryPointOnEllipse(const FeaturePtr& theEllipseFeature, - const std::string& theEllipsePoint) -{ - SketchPlugin_Sketch* aSketch = - std::dynamic_pointer_cast(theEllipseFeature)->sketch(); +void createAuxiliaryPointOnEllipse(const FeaturePtr &theEllipseFeature, + const std::string &theEllipsePoint) { + SketchPlugin_Sketch *aSketch = + std::dynamic_pointer_cast(theEllipseFeature) + ->sketch(); FeaturePtr aPointFeature = aSketch->addFeature(SketchPlugin_Point::ID()); aPointFeature->boolean(SketchPlugin_Point::AUXILIARY_ID())->setValue(true); - aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theEllipseFeature); + aPointFeature->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(theEllipseFeature); - AttributePoint2DPtr anElPoint = std::dynamic_pointer_cast( - theEllipseFeature->attribute(theEllipsePoint)); + AttributePoint2DPtr anElPoint = + std::dynamic_pointer_cast( + theEllipseFeature->attribute(theEllipsePoint)); AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( - aPointFeature->attribute(SketchPlugin_Point::COORD_ID())); + aPointFeature->attribute(SketchPlugin_Point::COORD_ID())); aCoord->setValue(anElPoint->x(), anElPoint->y()); aPointFeature->execute(); std::wstring aName = theEllipseFeature->name() + L"_" + - Locale::Convert::toWString(theEllipsePoint); + Locale::Convert::toWString(theEllipsePoint); aPointFeature->data()->setName(aName); aPointFeature->lastResult()->data()->setName(aName); createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidenceInternal::ID(), anElPoint, aCoord); + SketchPlugin_ConstraintCoincidenceInternal::ID(), + anElPoint, aCoord); } -void createAuxiliaryAxisOfEllipse(const FeaturePtr& theEllipseFeature, - const std::string& theStartPoint, - const std::string& theEndPoint) -{ - SketchPlugin_Sketch* aSketch = - std::dynamic_pointer_cast(theEllipseFeature)->sketch(); +void createAuxiliaryAxisOfEllipse(const FeaturePtr &theEllipseFeature, + const std::string &theStartPoint, + const std::string &theEndPoint) { + SketchPlugin_Sketch *aSketch = + std::dynamic_pointer_cast(theEllipseFeature) + ->sketch(); FeaturePtr aLineFeature = aSketch->addFeature(SketchPlugin_Line::ID()); aLineFeature->boolean(SketchPlugin_Point::AUXILIARY_ID())->setValue(true); - aLineFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theEllipseFeature); + aLineFeature->reference(SketchPlugin_Point::PARENT_ID()) + ->setValue(theEllipseFeature); - AttributePoint2DPtr aStartPoint = std::dynamic_pointer_cast( - theEllipseFeature->attribute(theStartPoint)); - AttributePoint2DPtr aEndPoint = std::dynamic_pointer_cast( - theEllipseFeature->attribute(theEndPoint)); + AttributePoint2DPtr aStartPoint = + std::dynamic_pointer_cast( + theEllipseFeature->attribute(theStartPoint)); + AttributePoint2DPtr aEndPoint = + std::dynamic_pointer_cast( + theEllipseFeature->attribute(theEndPoint)); - AttributePoint2DPtr aLineStart = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::START_ID())); + AttributePoint2DPtr aLineStart = + std::dynamic_pointer_cast( + aLineFeature->attribute(SketchPlugin_Line::START_ID())); aLineStart->setValue(aStartPoint->x(), aStartPoint->y()); AttributePoint2DPtr aLineEnd = std::dynamic_pointer_cast( - aLineFeature->attribute(SketchPlugin_Line::END_ID())); + aLineFeature->attribute(SketchPlugin_Line::END_ID())); aLineEnd->setValue(aEndPoint->x(), aEndPoint->y()); aLineFeature->execute(); - std::wstring aName = theEllipseFeature->name() + L"_" + - (theStartPoint == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() ? L"major_axis" : L"minor_axis"); + std::wstring aName = + theEllipseFeature->name() + L"_" + + (theStartPoint == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() + ? L"major_axis" + : L"minor_axis"); aLineFeature->data()->setName(aName); aLineFeature->lastResult()->data()->setName(aName); createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidenceInternal::ID(), aStartPoint, aLineStart); + SketchPlugin_ConstraintCoincidenceInternal::ID(), + aStartPoint, aLineStart); createConstraintAttrAttr(aSketch, - SketchPlugin_ConstraintCoincidenceInternal::ID(), aEndPoint, aLineEnd); + SketchPlugin_ConstraintCoincidenceInternal::ID(), + aEndPoint, aLineEnd); } -GeomPnt2dPtr flyoutPointCoordinates(const ConstraintPtr& theConstraint) -{ +GeomPnt2dPtr flyoutPointCoordinates(const ConstraintPtr &theConstraint) { // currently process Length constraints only if (theConstraint->getKind() != SketchPlugin_ConstraintLength::ID()) return GeomPnt2dPtr(); - AttributeRefAttrPtr aLineAttr = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aLineAttr = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); if (!aLineAttr || !aLineAttr->isObject()) return GeomPnt2dPtr(); FeaturePtr aLine = ModelAPI_Feature::feature(aLineAttr->object()); if (!aLine || aLine->getKind() != SketchPlugin_Line::ID()) return GeomPnt2dPtr(); - std::shared_ptr aStartPnt = std::dynamic_pointer_cast( - aLine->attribute(SketchPlugin_Line::START_ID()))->pnt()->xy(); - std::shared_ptr aEndPnt = std::dynamic_pointer_cast( - aLine->attribute(SketchPlugin_Line::END_ID()))->pnt()->xy(); + std::shared_ptr aStartPnt = + std::dynamic_pointer_cast( + aLine->attribute(SketchPlugin_Line::START_ID())) + ->pnt() + ->xy(); + std::shared_ptr aEndPnt = + std::dynamic_pointer_cast( + aLine->attribute(SketchPlugin_Line::END_ID())) + ->pnt() + ->xy(); std::shared_ptr aFlyoutAttr = - std::dynamic_pointer_cast( - theConstraint->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + std::dynamic_pointer_cast(theConstraint->attribute( + SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFltPnt = aFlyoutAttr->pnt(); - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); + std::shared_ptr aLineDir( + new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - double X = aStartPnt->x() + aFltPnt->x() * aLineDir->x() - aFltPnt->y() * aLineDir->y(); - double Y = aStartPnt->y() + aFltPnt->x() * aLineDir->y() + aFltPnt->y() * aLineDir->x(); + double X = aStartPnt->x() + aFltPnt->x() * aLineDir->x() - + aFltPnt->y() * aLineDir->y(); + double Y = aStartPnt->y() + aFltPnt->x() * aLineDir->y() + + aFltPnt->y() * aLineDir->x(); return GeomPnt2dPtr(new GeomAPI_Pnt2d(X, Y)); } - -void customizeFeaturePrs(const AISObjectPtr& thePrs, bool isAxiliary) -{ +void customizeFeaturePrs(const AISObjectPtr &thePrs, bool isAxiliary) { std::vector aColor; int aWidth = 1; if (isAxiliary) { - thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY()); - aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color"); + thePrs->setLineStyle( + SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY()); + aColor = + Config_PropManager::color("Visualization", "sketch_auxiliary_color"); aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY(); - } - else { + } else { thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE()); aColor = Config_PropManager::color("Visualization", "sketch_entity_color"); aWidth = Config_PropManager::integer("Visualization", "sketch_line_width"); @@ -643,50 +674,45 @@ void customizeFeaturePrs(const AISObjectPtr& thePrs, bool isAxiliary) thePrs->setColor(aColor[0], aColor[1], aColor[2]); } -void setDimensionColor(const AISObjectPtr& theDimPrs) -{ - std::vector aColor = Config_PropManager::color("Visualization", "sketch_dimension_color"); +void setDimensionColor(const AISObjectPtr &theDimPrs) { + std::vector aColor = + Config_PropManager::color("Visualization", "sketch_dimension_color"); if (aColor.size() == 3) theDimPrs->setColor(aColor[0], aColor[1], aColor[2]); } -void replaceInName(ObjectPtr theObject, const std::wstring& theSource, const std::wstring& theDest) -{ +void replaceInName(ObjectPtr theObject, const std::wstring &theSource, + const std::wstring &theDest) { std::wstring aName = theObject->data()->name(); size_t aPos = aName.find(theSource); if (aPos != std::wstring::npos) { - std::wstring aNewName = aName.substr(0, aPos) + theDest - + aName.substr(aPos + theSource.size()); + std::wstring aNewName = + aName.substr(0, aPos) + theDest + aName.substr(aPos + theSource.size()); theObject->data()->setName(aNewName); } } } // namespace SketchPlugin_Tools - // ================================================================================================= // namespace SketchPlugin_SegmentationTools // ================================================================================================= -void SketchPlugin_SegmentationTools::getFeaturePoints(const FeaturePtr& theFeature, - AttributePoint2DPtr& theStartPointAttr, - AttributePoint2DPtr& theEndPointAttr) -{ +void SketchPlugin_SegmentationTools::getFeaturePoints( + const FeaturePtr &theFeature, AttributePoint2DPtr &theStartPointAttr, + AttributePoint2DPtr &theEndPointAttr) { std::string aFeatureKind = theFeature->getKind(); std::string aStartAttributeName, anEndAttributeName; if (aFeatureKind == SketchPlugin_Line::ID()) { aStartAttributeName = SketchPlugin_Line::START_ID(); anEndAttributeName = SketchPlugin_Line::END_ID(); - } - else if (aFeatureKind == SketchPlugin_Arc::ID()) { + } else if (aFeatureKind == SketchPlugin_Arc::ID()) { aStartAttributeName = SketchPlugin_Arc::START_ID(); anEndAttributeName = SketchPlugin_Arc::END_ID(); - } - else if (aFeatureKind == SketchPlugin_EllipticArc::ID()) { + } else if (aFeatureKind == SketchPlugin_EllipticArc::ID()) { aStartAttributeName = SketchPlugin_EllipticArc::START_POINT_ID(); anEndAttributeName = SketchPlugin_EllipticArc::END_POINT_ID(); - } - else if (aFeatureKind == SketchPlugin_BSpline::ID()) { + } else if (aFeatureKind == SketchPlugin_BSpline::ID()) { aStartAttributeName = SketchPlugin_BSpline::START_ID(); anEndAttributeName = SketchPlugin_BSpline::END_ID(); } @@ -698,24 +724,23 @@ void SketchPlugin_SegmentationTools::getFeaturePoints(const FeaturePtr& theFeatu } } - void SketchPlugin_SegmentationTools::getRefAttributes( - const FeaturePtr& theFeature, - std::map >& theRefs, - std::list& theRefsToFeature) -{ + const FeaturePtr &theFeature, + std::map> &theRefs, + std::list &theRefsToFeature) { theRefs.clear(); std::list aPointAttributes = - theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::set aPointAttributesSet; - std::list::const_iterator aPIt = - aPointAttributes.begin(), aPLast = aPointAttributes.end(); + std::list::const_iterator aPIt = aPointAttributes.begin(), + aPLast = aPointAttributes.end(); for (; aPIt != aPLast; aPIt++) aPointAttributesSet.insert(*aPIt); - std::set aRefsAttributes = theFeature->lastResult()->data()->refsToMe(); + std::set aRefsAttributes = + theFeature->lastResult()->data()->refsToMe(); std::set aFRefsList = theFeature->data()->refsToMe(); aRefsAttributes.insert(aFRefsList.begin(), aFRefsList.end()); @@ -723,13 +748,17 @@ void SketchPlugin_SegmentationTools::getRefAttributes( for (aIt = aRefsAttributes.cbegin(); aIt != aRefsAttributes.cend(); ++aIt) { AttributePtr anAttr = (*aIt); FeaturePtr anAttrFeature = ModelAPI_Feature::feature(anAttr->owner()); - if (!anAttrFeature->isMacro() && // <- skip reference from Trim or Split feature - anAttr.get() && anAttr->attributeType() == ModelAPI_AttributeRefAttr::typeId()) { - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(anAttr); - if (!aRefAttr->isObject()) { // find attributes referenced to feature point attributes + if (!anAttrFeature + ->isMacro() && // <- skip reference from Trim or Split feature + anAttr.get() && + anAttr->attributeType() == ModelAPI_AttributeRefAttr::typeId()) { + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(anAttr); + if (!aRefAttr->isObject()) { // find attributes referenced to feature + // point attributes AttributePtr anAttrInRef = aRefAttr->attr(); - if (anAttrInRef.get() && - aPointAttributesSet.find(anAttrInRef) != aPointAttributesSet.end()) { + if (anAttrInRef.get() && aPointAttributesSet.find(anAttrInRef) != + aPointAttributesSet.end()) { if (theRefs.find(anAttrInRef) != theRefs.end()) theRefs[anAttrInRef].push_back(aRefAttr); else { @@ -738,8 +767,7 @@ void SketchPlugin_SegmentationTools::getRefAttributes( theRefs[anAttrInRef] = anAttrList; } } - } - else { // find attributes referenced to feature itself + } else { // find attributes referenced to feature itself theRefsToFeature.push_back(anAttr); } } @@ -747,37 +775,41 @@ void SketchPlugin_SegmentationTools::getRefAttributes( } GeomShapePtr SketchPlugin_SegmentationTools::getSubShape( - SketchPlugin_Feature* theFeature, - const std::string& theObjectAttributeId, - const std::string& thePointAttributeId, - std::map >& theCashedShapes, - std::map& theObjectToPoints) -{ + SketchPlugin_Feature *theFeature, const std::string &theObjectAttributeId, + const std::string &thePointAttributeId, + std::map> &theCashedShapes, + std::map + &theObjectToPoints) { GeomShapePtr aBaseShape; - AttributeReferencePtr anObjectAttr = theFeature->reference(theObjectAttributeId); + AttributeReferencePtr anObjectAttr = + theFeature->reference(theObjectAttributeId); ObjectPtr aBaseObject = anObjectAttr->value(); if (!aBaseObject.get()) return aBaseShape; // point on feature AttributePoint2DPtr aPointAttr = - std::dynamic_pointer_cast(theFeature->attribute(thePointAttributeId)); + std::dynamic_pointer_cast( + theFeature->attribute(thePointAttributeId)); std::shared_ptr anAttributePnt2d = aPointAttr->pnt(); std::shared_ptr anAttributePnt = theFeature->sketch()->to3D(anAttributePnt2d->x(), anAttributePnt2d->y()); if (theCashedShapes.find(aBaseObject) == theCashedShapes.end()) - fillObjectShapes(theFeature, aBaseObject, theCashedShapes, theObjectToPoints); + fillObjectShapes(theFeature, aBaseObject, theCashedShapes, + theObjectToPoints); std::shared_ptr aStartPoint; std::shared_ptr aSecondPoint; - const std::set& aShapes = theCashedShapes[aBaseObject]; - std::set::const_iterator anIt = aShapes.begin(), aLast = aShapes.end(); + const std::set &aShapes = theCashedShapes[aBaseObject]; + std::set::const_iterator anIt = aShapes.begin(), + aLast = aShapes.end(); for (; anIt != aLast; anIt++) { GeomShapePtr aCurrentShape = *anIt; std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aCurrentShape, anAttributePnt, aProjectedPoint)) { + if (ModelGeomAlgo_Point2D::isPointOnEdge(aCurrentShape, anAttributePnt, + aProjectedPoint)) { if (theFeature->getKind() == SketchPlugin_Split::ID()) { // for Split operation collect start and end points of the shape if (aCurrentShape->shapeType() == GeomAPI_Shape::EDGE) { @@ -785,8 +817,7 @@ GeomShapePtr SketchPlugin_SegmentationTools::getSubShape( aStartPoint = anEdge->firstPoint(); aSecondPoint = anEdge->lastPoint(); } - } - else + } else aBaseShape = aCurrentShape; break; } @@ -796,15 +827,16 @@ GeomShapePtr SketchPlugin_SegmentationTools::getSubShape( return aBaseShape; FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObject); - if (anObjectAttr->isInitialized() && aBaseFeature.get() && aPointAttr->isInitialized()) { + if (anObjectAttr->isInitialized() && aBaseFeature.get() && + aPointAttr->isInitialized()) { ResultPtr aResult = aBaseFeature->lastResult(); GeomShapePtr aResultShape = aResult->shape(); - std::list > aPoints; + std::list> aPoints; aPoints.push_back(aStartPoint); aPoints.push_back(aSecondPoint); - std::set > aSplitShapes; + std::set> aSplitShapes; GeomAlgoAPI_ShapeTools::splitShape_p(aResultShape, aPoints, aSplitShapes); aBaseShape = GeomAlgoAPI_ShapeTools::findShape(aPoints, aSplitShapes); } @@ -812,50 +844,58 @@ GeomShapePtr SketchPlugin_SegmentationTools::getSubShape( } void SketchPlugin_SegmentationTools::fillObjectShapes( - SketchPlugin_Feature* theOpFeature, - const ObjectPtr& theObject, - std::map >& theCashedShapes, - std::map& theObjectToPoints) -{ - SketchPlugin_Sketch* aSketch = theOpFeature->sketch(); + SketchPlugin_Feature *theOpFeature, const ObjectPtr &theObject, + std::map> &theCashedShapes, + std::map + &theObjectToPoints) { + SketchPlugin_Sketch *aSketch = theOpFeature->sketch(); GeomAlgoAPI_ShapeTools::PointToRefsMap aPoints; std::set aShapes; - std::set aRefAttributes; + std::set aRefAttributes; // current feature FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); std::set anEdgeShapes; // edges on feature - ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeShapes); + ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::EDGE, + anEdgeShapes); if (!anEdgeShapes.empty()) { GeomShapePtr aFeatureShape = (*anEdgeShapes.begin())->shape(); // coincidences to the feature - ModelGeomAlgo_Point2D::getPointsOfReference(aFeature, SketchPlugin_ConstraintCoincidence::ID(), - aRefAttributes, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); + ModelGeomAlgo_Point2D::getPointsOfReference( + aFeature, SketchPlugin_ConstraintCoincidence::ID(), aRefAttributes, + SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); // layed on feature coincidences to divide it on several shapes std::shared_ptr aData = aSketch->data(); - std::shared_ptr aC = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); - - ModelGeomAlgo_Point2D::getPointsInsideShape(aFeatureShape, aRefAttributes, aC->pnt(), - aX->dir(), aY, aPoints); + std::shared_ptr aC = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + + ModelGeomAlgo_Point2D::getPointsInsideShape( + aFeatureShape, aRefAttributes, aC->pnt(), aX->dir(), aY, aPoints); if (theOpFeature->getKind() == SketchPlugin_Trim::ID()) { - // collect all intersection points with other edges for Trim operation only + // collect all intersection points with other edges for Trim operation + // only std::list aFeatures; for (int i = 0; i < aSketch->numberOfSubs(); i++) { FeaturePtr aSubFeature = aSketch->subFeature(i); - if (aSubFeature.get() && aSubFeature->getKind() != SketchPlugin_Projection::ID()) + if (aSubFeature.get() && + aSubFeature->getKind() != SketchPlugin_Projection::ID()) aFeatures.push_back(aSubFeature); } - ModelGeomAlgo_Point2D::getPointsIntersectedShape(aFeature, aFeatures, aPoints); + ModelGeomAlgo_Point2D::getPointsIntersectedShape(aFeature, aFeatures, + aPoints); } if (!aPoints.empty()) @@ -866,15 +906,16 @@ void SketchPlugin_SegmentationTools::fillObjectShapes( } void SketchPlugin_SegmentationTools::updateRefAttConstraints( - const std::map >& theBaseRefAttributes, - const std::set >& theModifiedAttributes) -{ + const std::map> &theBaseRefAttributes, + const std::set> + &theModifiedAttributes) { #if defined DEBUG_SPLIT || defined DEBUG_TRIM std::cout << "updateRefAttConstraints" << std::endl; #endif - std::set >::const_iterator - anIt = theModifiedAttributes.begin(), aLast = theModifiedAttributes.end(); + std::set>::const_iterator + anIt = theModifiedAttributes.begin(), + aLast = theModifiedAttributes.end(); for (; anIt != aLast; anIt++) { AttributePtr anAttribute = anIt->first; AttributePtr aNewAttribute = anIt->second; @@ -883,12 +924,14 @@ void SketchPlugin_SegmentationTools::updateRefAttConstraints( if (!aNewAttribute.get() || theBaseRefAttributes.find(anAttribute) == theBaseRefAttributes.end()) continue; - std::list aRefAttributes = theBaseRefAttributes.at(anAttribute); + std::list aRefAttributes = + theBaseRefAttributes.at(anAttribute); std::list::const_iterator aRefIt = aRefAttributes.begin(), aRLast = aRefAttributes.end(); for (; aRefIt != aRLast; aRefIt++) { - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*aRefIt); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(*aRefIt); if (aRefAttr.get()) { aRefAttr->setAttr(aNewAttribute); #ifdef DEBUG_SPLIT @@ -901,8 +944,7 @@ void SketchPlugin_SegmentationTools::updateRefAttConstraints( } void SketchPlugin_SegmentationTools::updateFeaturesAfterOperation( - const std::set& theFeaturesToUpdate) -{ + const std::set &theFeaturesToUpdate) { std::set::const_iterator anIt = theFeaturesToUpdate.begin(), aLast = theFeaturesToUpdate.end(); for (; anIt != aLast; anIt++) { @@ -910,10 +952,11 @@ void SketchPlugin_SegmentationTools::updateFeaturesAfterOperation( std::string aRefFeatureKind = aRefFeature->getKind(); if (aRefFeatureKind == SketchPlugin_ConstraintLength::ID()) { std::shared_ptr aLenghtFeature = - std::dynamic_pointer_cast(*anIt); + std::dynamic_pointer_cast(*anIt); if (aLenghtFeature.get()) { - std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(aLenghtFeature->attribute(SketchPlugin_Constraint::VALUE())); + std::shared_ptr aValueAttr = + std::dynamic_pointer_cast( + aLenghtFeature->attribute(SketchPlugin_Constraint::VALUE())); double aValue; if (aLenghtFeature->computeLenghtValue(aValue) && aValueAttr.get()) aValueAttr->setValue(aValue); @@ -923,28 +966,28 @@ void SketchPlugin_SegmentationTools::updateFeaturesAfterOperation( } AISObjectPtr SketchPlugin_SegmentationTools::getAISObject( - AISObjectPtr thePrevious, - SketchPlugin_Feature* theOpFeature, - const std::string& thePreviewObjectAttrName, - const std::string& thePreviewPointAttrName, - const std::string& theSelectedObjectAttrName, - const std::string& theSelectedPointAttrName) -{ + AISObjectPtr thePrevious, SketchPlugin_Feature *theOpFeature, + const std::string &thePreviewObjectAttrName, + const std::string &thePreviewPointAttrName, + const std::string &theSelectedObjectAttrName, + const std::string &theSelectedPointAttrName) { #if defined DEBUG_SPLIT || defined DEBUG_TRIM_METHODS std::cout << "getAISObject: " << theOpFeature->data()->name() << std::endl; #endif AISObjectPtr anAIS = thePrevious; - std::list > aShapes; - std::map > aCashedShapes; + std::list> aShapes; + std::map> aCashedShapes; std::map aObjectToPoints; - GeomShapePtr aPreviewShape = getSubShape(theOpFeature, - thePreviewObjectAttrName, thePreviewPointAttrName, aCashedShapes, aObjectToPoints); + GeomShapePtr aPreviewShape = + getSubShape(theOpFeature, thePreviewObjectAttrName, + thePreviewPointAttrName, aCashedShapes, aObjectToPoints); if (aPreviewShape.get()) aShapes.push_back(aPreviewShape); - GeomShapePtr aSelectedShape = getSubShape(theOpFeature, - theSelectedObjectAttrName, theSelectedPointAttrName, aCashedShapes, aObjectToPoints); + GeomShapePtr aSelectedShape = + getSubShape(theOpFeature, theSelectedObjectAttrName, + theSelectedPointAttrName, aCashedShapes, aObjectToPoints); if (aSelectedShape.get()) aShapes.push_back(aSelectedShape); @@ -961,48 +1004,51 @@ AISObjectPtr SketchPlugin_SegmentationTools::getAISObject( anAIS->createShape(aBaseShape); std::vector aColor; - aColor = Config_PropManager::color("Visualization", "operation_remove_feature_color"); + aColor = Config_PropManager::color("Visualization", + "operation_remove_feature_color"); double aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH(); int aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE(); anAIS->setColor(aColor[0], aColor[1], aColor[2]); // width when there is not base object should be extened in several points // in order to see this preview over highlight - anAIS->setWidth(aWidth+4); + anAIS->setWidth(aWidth + 4); anAIS->setLineStyle(aLineStyle); - } - else + } else anAIS = AISObjectPtr(); return anAIS; } -#define GEOM_DATA_POINT2D(f, a) std::dynamic_pointer_cast((f)->attribute(a)) +#define GEOM_DATA_POINT2D(f, a) \ + std::dynamic_pointer_cast((f)->attribute(a)) FeaturePtr SketchPlugin_SegmentationTools::createLineFeature( - const FeaturePtr& theBaseFeature, - const std::shared_ptr& theFirstPoint, - const std::shared_ptr& theSecondPoint) -{ + const FeaturePtr &theBaseFeature, + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint) { FeaturePtr aFeature; std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(theBaseFeature); - SketchPlugin_Sketch* aSketch = aSketchFeature->sketch(); + SketchPlugin_Sketch *aSketch = aSketchFeature->sketch(); if (!aSketch || !theBaseFeature.get()) return aFeature; aFeature = aSketch->addFeature(SketchPlugin_Line::ID()); - GEOM_DATA_POINT2D(aFeature, SketchPlugin_Line::START_ID())->setValue(theFirstPoint); - GEOM_DATA_POINT2D(aFeature, SketchPlugin_Line::END_ID())->setValue(theSecondPoint); + GEOM_DATA_POINT2D(aFeature, SketchPlugin_Line::START_ID()) + ->setValue(theFirstPoint); + GEOM_DATA_POINT2D(aFeature, SketchPlugin_Line::END_ID()) + ->setValue(theSecondPoint); - aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue( - theBaseFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()); + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->setValue( + theBaseFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()); aFeature->execute(); // to obtain result return aFeature; } -struct ArcAttributes -{ +struct ArcAttributes { std::string myKind; std::string myCenter; std::string myFocus; @@ -1012,22 +1058,18 @@ struct ArcAttributes ArcAttributes() {} - ArcAttributes(const std::string& theKind) : myKind(theKind) - { + ArcAttributes(const std::string &theKind) : myKind(theKind) { if (myKind == SketchPlugin_Arc::ID()) { myCenter = SketchPlugin_Arc::CENTER_ID(); myStart = SketchPlugin_Arc::START_ID(); myEnd = SketchPlugin_Arc::END_ID(); myReversed = SketchPlugin_Arc::REVERSED_ID(); - } - else if (myKind == SketchPlugin_Circle::ID()) { + } else if (myKind == SketchPlugin_Circle::ID()) { myCenter = SketchPlugin_Circle::CENTER_ID(); - } - else if (myKind == SketchPlugin_Ellipse::ID()) { + } else if (myKind == SketchPlugin_Ellipse::ID()) { myCenter = SketchPlugin_Ellipse::CENTER_ID(); myFocus = SketchPlugin_Ellipse::FIRST_FOCUS_ID(); - } - else if (myKind == SketchPlugin_EllipticArc::ID()) { + } else if (myKind == SketchPlugin_EllipticArc::ID()) { myCenter = SketchPlugin_EllipticArc::CENTER_ID(); myFocus = SketchPlugin_EllipticArc::FIRST_FOCUS_ID(); myStart = SketchPlugin_EllipticArc::START_POINT_ID(); @@ -1038,14 +1080,13 @@ struct ArcAttributes }; FeaturePtr SketchPlugin_SegmentationTools::createArcFeature( - const FeaturePtr& theBaseFeature, - const std::shared_ptr& theFirstPoint, - const std::shared_ptr& theSecondPoint) -{ + const FeaturePtr &theBaseFeature, + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint) { FeaturePtr aFeature; std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(theBaseFeature); - SketchPlugin_Sketch* aSketch = aSketchFeature->sketch(); + SketchPlugin_Sketch *aSketch = aSketchFeature->sketch(); if (!aSketch || !theBaseFeature.get()) return aFeature; @@ -1062,29 +1103,35 @@ FeaturePtr SketchPlugin_SegmentationTools::createArcFeature( return aFeature; aFeature = aSketch->addFeature(aTargetAttrs.myKind); - // update fillet arc: make the arc correct for sure, so, it is not needed to process - // the "attribute updated" - // by arc; moreover, it may cause cyclicity in hte mechanism of updater + // update fillet arc: make the arc correct for sure, so, it is not needed to + // process the "attribute updated" by arc; moreover, it may cause cyclicity in + // hte mechanism of updater bool aWasBlocked = aFeature->data()->blockSendAttributeUpdated(true); - GEOM_DATA_POINT2D(aFeature, aTargetAttrs.myCenter)->setValue( - GEOM_DATA_POINT2D(theBaseFeature, aBaseAttrs.myCenter)->pnt()); + GEOM_DATA_POINT2D(aFeature, aTargetAttrs.myCenter) + ->setValue(GEOM_DATA_POINT2D(theBaseFeature, aBaseAttrs.myCenter)->pnt()); if (!aTargetAttrs.myFocus.empty()) { - GEOM_DATA_POINT2D(aFeature, aTargetAttrs.myFocus)->setValue( - GEOM_DATA_POINT2D(theBaseFeature, aBaseAttrs.myFocus)->pnt()); + GEOM_DATA_POINT2D(aFeature, aTargetAttrs.myFocus) + ->setValue( + GEOM_DATA_POINT2D(theBaseFeature, aBaseAttrs.myFocus)->pnt()); } GEOM_DATA_POINT2D(aFeature, aTargetAttrs.myStart)->setValue(theFirstPoint); GEOM_DATA_POINT2D(aFeature, aTargetAttrs.myEnd)->setValue(theSecondPoint); - aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->setValue( - theBaseFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()); + aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->setValue( + theBaseFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()); /// fill referersed state of created arc as it is on the base arc - bool aReversed = aBaseAttrs.myReversed.empty() ? false : - theBaseFeature->boolean(aBaseAttrs.myReversed)->value(); + bool aReversed = + aBaseAttrs.myReversed.empty() + ? false + : theBaseFeature->boolean(aBaseAttrs.myReversed)->value(); aFeature->boolean(aTargetAttrs.myReversed)->setValue(aReversed); - aFeature->execute(); // to obtain result (need to calculate arc parameters before sending Update) + aFeature->execute(); // to obtain result (need to calculate arc parameters + // before sending Update) aFeature->data()->blockSendAttributeUpdated(aWasBlocked); return aFeature; diff --git a/src/SketchPlugin/SketchPlugin_Tools.h b/src/SketchPlugin/SketchPlugin_Tools.h index 83212febf..86229058f 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.h +++ b/src/SketchPlugin/SketchPlugin_Tools.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SKETCHPLUGIN_TOOLS_H_ @@ -22,14 +23,14 @@ #include -#include -#include -#include -#include #include +#include +#include #include #include -#include +#include +#include +#include #include #include @@ -47,67 +48,70 @@ void clearExpressions(FeaturePtr theFeature); /// \return coincidence point /// \param[in] theStartCoin coincidence feature -std::shared_ptr getCoincidencePoint(const FeaturePtr theStartCoin); +std::shared_ptr +getCoincidencePoint(const FeaturePtr theStartCoin); /// Find all Coincident constraints referred to the feature or its attribute -std::set findCoincidentConstraints(const ObjectPtr& theObject); +std::set findCoincidentConstraints(const ObjectPtr &theObject); /// Finds lines coincident at point /// \param[in] theStartCoin coincidence feature /// \param[in] theAttr attribute name /// \param[out] theList list of lines /// \param[in] theIsAttrOnly if true includes only coincidences with attributes. -void findCoincidences(const FeaturePtr theStartCoin, - const std::string& theAttr, - std::set& theList, +void findCoincidences(const FeaturePtr theStartCoin, const std::string &theAttr, + std::set &theList, const bool theIsAttrOnly = false); /// Find all features the point is coincident to. -std::set findFeaturesCoincidentToPoint(const AttributePoint2DPtr& thePoint); +std::set +findFeaturesCoincidentToPoint(const AttributePoint2DPtr &thePoint); /// Find all points the given point is coincident to. -std::set findPointsCoincidentToPoint(const AttributePoint2DPtr& thePoint); +std::set +findPointsCoincidentToPoint(const AttributePoint2DPtr &thePoint); -void resetAttribute(SketchPlugin_Feature* theFeature, const std::string& theId); +void resetAttribute(SketchPlugin_Feature *theFeature, const std::string &theId); /// Create new constraint between given attributes /// \param[in] theSketch a sketch where the constraint will be created /// \param[in] theConstraintId a constraint identifier /// \param[in] theFirstAttribute an attribute of further constraint /// \param[in] theSecondAttribute an attribute of further constraint -FeaturePtr createConstraintAttrAttr(SketchPlugin_Sketch* theSketch, - const std::string& theConstraintId, - const AttributePtr& theFirstAttribute, - const AttributePtr& theSecondAttribute); +FeaturePtr createConstraintAttrAttr(SketchPlugin_Sketch *theSketch, + const std::string &theConstraintId, + const AttributePtr &theFirstAttribute, + const AttributePtr &theSecondAttribute); /// Create new constraint between given attribute and object /// \param[in] theSketch a sketch where the constraint will be created /// \param[in] theConstraintId a constraint identifier /// \param[in] theFirstAttribute an attribute of further constraint /// \param[in] theSecondObject an attribute of further constraint -FeaturePtr createConstraintAttrObject(SketchPlugin_Sketch* theSketch, - const std::string& theConstraintId, - const AttributePtr& theFirstAttribute, - const ObjectPtr& theSecondObject); +FeaturePtr createConstraintAttrObject(SketchPlugin_Sketch *theSketch, + const std::string &theConstraintId, + const AttributePtr &theFirstAttribute, + const ObjectPtr &theSecondObject); /// Create new constraint between given objects /// \param[in] theSketch a sketch where the constraint will be created /// \param[in] theConstraintId a constraint identifier /// \param[in] theFirstObject an attribute of further constraint /// \param[in] theSecondObject an attribute of further constraint -FeaturePtr createConstraintObjectObject(SketchPlugin_Sketch* theSketch, - const std::string& theConstraintId, - const ObjectPtr& theFirstObject, - const ObjectPtr& theSecondObject); +FeaturePtr createConstraintObjectObject(SketchPlugin_Sketch *theSketch, + const std::string &theConstraintId, + const ObjectPtr &theFirstObject, + const ObjectPtr &theSecondObject); /// Creates coincidence or tangent constraint. /// \param[in] theFeature to get selected attribute or object /// \param[in] theId ID of attribute where selection is. /// \param[in] theObject object for constraint -/// \param[in] theIsCanBeTangent if true constraint can be tangent or coincidence, depending on +/// \param[in] theIsCanBeTangent if true constraint can be tangent or +/// coincidence, depending on /// the selection in the attribute with passed ID. -void createCoincidenceOrTangency(SketchPlugin_Feature* theFeature, - const std::string& theId, +void createCoincidenceOrTangency(SketchPlugin_Feature *theFeature, + const std::string &theId, const AttributePtr theAttr, const ObjectPtr theObject, const bool theIsCanBeTangent); @@ -116,127 +120,135 @@ void createCoincidenceOrTangency(SketchPlugin_Feature* theFeature, /// \param[in] theEllipse base ellipse feature /// \param[in] theAttrName name of the attribute of the ellipse, /// the new point should be constrained -void createAuxiliaryPointOnEllipse(const FeaturePtr& theEllipseFeature, - const std::string& theAttrName); +void createAuxiliaryPointOnEllipse(const FeaturePtr &theEllipseFeature, + const std::string &theAttrName); /// Creates auxiliary axis for ellipse and corresponding internal constraints. /// \param[in] theEllipse base ellipse feature -/// \param[in] theStartAttr name of the attribute of the ellipse, the line is started -/// \param[in] theEndAttr name of the attribute of the ellipse, the line is ended -void createAuxiliaryAxisOfEllipse(const FeaturePtr& theEllipseFeature, - const std::string& theStartAttr, - const std::string& theEndAttr); - -/// Creates passing point or tangent curve basing on the given attributes are initialized. -/// \param[in] theRefAttr prefered attribute to be converted -/// \param[in] theDefaultAttr default attribute if theRefAttr is not initialized -/// \param[out] theTangentCurve tangent curve if theRefAttr refers to an edge -/// \param[out] thePassingPoint passing point if theRefAttr does not refer to an edge -void convertRefAttrToPointOrTangentCurve(const AttributeRefAttrPtr& theRefAttr, - const AttributePtr& theDefaultAttr, - std::shared_ptr& theTangentCurve, - std::shared_ptr& thePassingPoint); +/// \param[in] theStartAttr name of the attribute of the ellipse, the line is +/// started \param[in] theEndAttr name of the attribute of the ellipse, the +/// line is ended +void createAuxiliaryAxisOfEllipse(const FeaturePtr &theEllipseFeature, + const std::string &theStartAttr, + const std::string &theEndAttr); + +/// Creates passing point or tangent curve basing on the given attributes are +/// initialized. \param[in] theRefAttr prefered attribute to be converted +/// \param[in] theDefaultAttr default attribute if theRefAttr is not +/// initialized \param[out] theTangentCurve tangent curve if theRefAttr refers +/// to an edge \param[out] thePassingPoint passing point if theRefAttr does not +/// refer to an edge +void convertRefAttrToPointOrTangentCurve( + const AttributeRefAttrPtr &theRefAttr, const AttributePtr &theDefaultAttr, + std::shared_ptr &theTangentCurve, + std::shared_ptr &thePassingPoint); /// Calculate global coordinates for flyout point of Length constraint -GeomPnt2dPtr flyoutPointCoordinates(const std::shared_ptr& theConstraint); +GeomPnt2dPtr flyoutPointCoordinates( + const std::shared_ptr &theConstraint); /// Sets attributes of feature presentation /// \param[in] thePrs a presentation /// \param[in] isAxiliary is axiliary flag -void customizeFeaturePrs(const AISObjectPtr& thePrs, bool isAxiliary); +void customizeFeaturePrs(const AISObjectPtr &thePrs, bool isAxiliary); -void setDimensionColor(const AISObjectPtr& theDimPrs); +void setDimensionColor(const AISObjectPtr &theDimPrs); /// Replace string in the name of object -void replaceInName(ObjectPtr theObject, const std::wstring& theSource, const std::wstring& theDest); +void replaceInName(ObjectPtr theObject, const std::wstring &theSource, + const std::wstring &theDest); }; // namespace SketchPlugin_Tools -namespace SketchPlugin_SegmentationTools -{ - /// Returns geom point attribute of the feature bounds. It processes line or arc. - /// For circle/ellipse feature, the result attributes are null - /// \param theFeature a source feature - /// \param theStartPointAttr an out attribute to start point - /// \param theEndPointAttr an out attribute to end point - void getFeaturePoints(const FeaturePtr& theFeature, - std::shared_ptr& theStartPointAttr, - std::shared_ptr& theEndPointAttr); - - /// Obtains references to feature point attributes and to feature, - /// e.g. for feature line: 1st container is - /// <1st line point, list > - /// <2nd line point, list<> > - /// for feature circle 2nd container is - /// \param theFeature an investigated feature - /// \param theRefs a container of list of referenced attributes - /// \param theRefsToFeature references to the feature result - void getRefAttributes(const FeaturePtr& theFeature, - std::map >& theRefs, - std::list& theRefsToFeature); - - /// Obtains a part of shape selected/highlighted in the viewer for Split/Trim operation - /// \param[in] theFeature Split/Trim feature - /// \param[in] theObjectAttributeId name of attribute containing selected object - /// \param[in] thePointAttributeId name of attribute containing point selected on the object - GeomShapePtr getSubShape( - SketchPlugin_Feature* theFeature, - const std::string& theObjectAttributeId, - const std::string& thePointAttributeId, - std::map >& theCashedShapes, - std::map& theObjectToPoints); - - /// Fulfill an internal containers by shapes obtained from the parameter object - /// Shapes are results of Split/Trim operation by points coincident to shape of the object - /// \param theOpFeture an operation feature (Split/Trim) - /// \param theObject a source object (will be splitted) - void fillObjectShapes( - SketchPlugin_Feature* theOpFeature, - const ObjectPtr& theObject, - std::map >& theCashedShapes, - std::map& theObjectToPoints); - - /// AIS object for selected/highlighted part of splitting/triming feature - /// \param[in] thePrevious previous presentation - /// \param[in] theOpFeture an operation feature (Split/Trim) - std::shared_ptr getAISObject(std::shared_ptr thePrevious, - SketchPlugin_Feature* theOpFeature, - const std::string& thePreviewObjectAttrName, - const std::string& thePreviewPointAttrName, - const std::string& theSelectedObjectAttrName, - const std::string& theSelectedPointAttrName); - - /// Move constraints from attribute of base feature to attribute after modification - /// \param theBaseRefAttributes container of references to the attributes of base feature - /// \param theModifiedAttributes container of attributes placed instead of base attributes - /// at the same place - void updateRefAttConstraints( - const std::map >& theBaseRefAttributes, - const std::set >& theModifiedAttributes); - - /// Updates line length if it exist in the list - /// \param theFeaturesToUpdate a constraint index - void updateFeaturesAfterOperation(const std::set& theFeaturesToUpdate); - - - /// Creates a line feature filled by center of base feature and given points - /// \param theBaseFeature another arc feature - /// \param theFirstAttribute an attribute with coordinates for the start point - /// \param theSecondAttribute an attribute with coordinates for the end point - FeaturePtr createLineFeature(const FeaturePtr& theBaseFeature, - const std::shared_ptr& theFirstPoint, - const std::shared_ptr& theSecondPoint); - - /// Creates a circular/elliptic arc feature filled by center - /// (or by center and focus for elliptic arc) of base feature and given points - /// \param theBaseFeature another circle or ellipse or circular/elliptic arc - /// \param theFirstAttribute an attribute with coordinates for the start point - /// \param theSecondAttribute an attribute with coordinates for the end point - FeaturePtr createArcFeature( - const FeaturePtr& theBaseFeature, - const std::shared_ptr& theFirstPoint, - const std::shared_ptr& theSecondPoint); +namespace SketchPlugin_SegmentationTools { +/// Returns geom point attribute of the feature bounds. It processes line or +/// arc. For circle/ellipse feature, the result attributes are null \param +/// theFeature a source feature \param theStartPointAttr an out attribute +/// to start point \param theEndPointAttr an out attribute to end point +void getFeaturePoints(const FeaturePtr &theFeature, + std::shared_ptr &theStartPointAttr, + std::shared_ptr &theEndPointAttr); + +/// Obtains references to feature point attributes and to feature, +/// e.g. for feature line: 1st container is +/// <1st line point, list > <2nd line point, list<> > +/// for feature circle 2nd container is +/// \param theFeature an investigated feature +/// \param theRefs a container of list of referenced attributes +/// \param theRefsToFeature references to the feature result +void getRefAttributes(const FeaturePtr &theFeature, + std::map> &theRefs, + std::list &theRefsToFeature); + +/// Obtains a part of shape selected/highlighted in the viewer for Split/Trim +/// operation \param[in] theFeature Split/Trim feature \param[in] +/// theObjectAttributeId name of attribute containing selected object +/// \param[in] thePointAttributeId name of attribute containing point selected +/// on the object +GeomShapePtr +getSubShape(SketchPlugin_Feature *theFeature, + const std::string &theObjectAttributeId, + const std::string &thePointAttributeId, + std::map> &theCashedShapes, + std::map + &theObjectToPoints); + +/// Fulfill an internal containers by shapes obtained from the parameter object +/// Shapes are results of Split/Trim operation by points coincident to shape of +/// the object \param theOpFeture an operation feature (Split/Trim) \param +/// theObject a source object (will be splitted) +void fillObjectShapes( + SketchPlugin_Feature *theOpFeature, const ObjectPtr &theObject, + std::map> &theCashedShapes, + std::map + &theObjectToPoints); + +/// AIS object for selected/highlighted part of splitting/triming feature +/// \param[in] thePrevious previous presentation +/// \param[in] theOpFeture an operation feature (Split/Trim) +std::shared_ptr +getAISObject(std::shared_ptr thePrevious, + SketchPlugin_Feature *theOpFeature, + const std::string &thePreviewObjectAttrName, + const std::string &thePreviewPointAttrName, + const std::string &theSelectedObjectAttrName, + const std::string &theSelectedPointAttrName); + +/// Move constraints from attribute of base feature to attribute after +/// modification \param theBaseRefAttributes container of references to the +/// attributes of base feature \param theModifiedAttributes container of +/// attributes placed instead of base attributes at the same place +void updateRefAttConstraints( + const std::map> &theBaseRefAttributes, + const std::set> + &theModifiedAttributes); + +/// Updates line length if it exist in the list +/// \param theFeaturesToUpdate a constraint index +void updateFeaturesAfterOperation( + const std::set &theFeaturesToUpdate); + +/// Creates a line feature filled by center of base feature and given points +/// \param theBaseFeature another arc feature +/// \param theFirstAttribute an attribute with coordinates for the start point +/// \param theSecondAttribute an attribute with coordinates for the end point +FeaturePtr +createLineFeature(const FeaturePtr &theBaseFeature, + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint); + +/// Creates a circular/elliptic arc feature filled by center +/// (or by center and focus for elliptic arc) of base feature and given points +/// \param theBaseFeature another circle or ellipse or circular/elliptic arc +/// \param theFirstAttribute an attribute with coordinates for the start point +/// \param theSecondAttribute an attribute with coordinates for the end point +FeaturePtr +createArcFeature(const FeaturePtr &theBaseFeature, + const std::shared_ptr &theFirstPoint, + const std::shared_ptr &theSecondPoint); }; // namespace SketchPlugin_SegmentationTools -#endif // SKETCHPLUGIN_TOOLS_H_ \ No newline at end of file +#endif // SKETCHPLUGIN_TOOLS_H_ diff --git a/src/SketchPlugin/SketchPlugin_Trim.cpp b/src/SketchPlugin/SketchPlugin_Trim.cpp index aca80577b..1cc79e7c5 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.cpp +++ b/src/SketchPlugin/SketchPlugin_Trim.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Trim.h" @@ -23,30 +24,30 @@ #include #include #include -#include #include +#include +#include +#include #include #include -#include #include -#include -#include -#include #include +#include +#include #include #include -#include #include #include +#include #include -#include #include +#include #include -#include +#include #include #include #include @@ -57,12 +58,12 @@ #include #include -#include #include #include +#include -#include #include +#include #include @@ -76,13 +77,11 @@ static const double PI = 3.141592653589793238463; -SketchPlugin_Trim::SketchPlugin_Trim() -{ -} +SketchPlugin_Trim::SketchPlugin_Trim() {} -void SketchPlugin_Trim::initAttributes() -{ - data()->addAttribute(SELECTED_OBJECT(), ModelAPI_AttributeReference::typeId()); +void SketchPlugin_Trim::initAttributes() { + data()->addAttribute(SELECTED_OBJECT(), + ModelAPI_AttributeReference::typeId()); data()->addAttribute(SELECTED_POINT(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(PREVIEW_POINT(), GeomDataAPI_Point2D::typeId()); @@ -92,74 +91,79 @@ void SketchPlugin_Trim::initAttributes() data()->attribute(SELECTED_POINT())->setIsArgument(false); data()->attribute(PREVIEW_OBJECT())->setIsArgument(false); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PREVIEW_POINT()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PREVIEW_OBJECT()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), + PREVIEW_POINT()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), PREVIEW_OBJECT()); } -void SketchPlugin_Trim::findShapePoints(const std::string& theObjectAttributeId, - const std::string& thePointAttributeId, - std::shared_ptr& aStartPoint, - std::shared_ptr& aLastPoint) -{ - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(theObjectAttributeId)); +void SketchPlugin_Trim::findShapePoints( + const std::string &theObjectAttributeId, + const std::string &thePointAttributeId, + std::shared_ptr &aStartPoint, + std::shared_ptr &aLastPoint) { + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(theObjectAttributeId)); ObjectPtr aBaseObject = aBaseObjectAttr->value(); AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( - data()->attribute(thePointAttributeId)); + data()->attribute(thePointAttributeId)); std::shared_ptr anAttributePnt2d = aPoint->pnt(); - std::shared_ptr anAttributePnt = sketch()->to3D(anAttributePnt2d->x(), - anAttributePnt2d->y()); + std::shared_ptr anAttributePnt = + sketch()->to3D(anAttributePnt2d->x(), anAttributePnt2d->y()); if (myCashedShapes.find(aBaseObject) == myCashedShapes.end()) { SketchPlugin_SegmentationTools::fillObjectShapes( this, aBaseObject, myCashedShapes, myObjectToPoints); } - const std::set& aShapes = myCashedShapes[aBaseObject]; + const std::set &aShapes = myCashedShapes[aBaseObject]; if (!aShapes.empty()) { - std::set::const_iterator anIt = aShapes.begin(), aLast = aShapes.end(); + std::set::const_iterator anIt = aShapes.begin(), + aLast = aShapes.end(); for (; anIt != aLast; anIt++) { GeomShapePtr aBaseShape = *anIt; std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aBaseShape, anAttributePnt, aProjectedPoint)) { + if (ModelGeomAlgo_Point2D::isPointOnEdge(aBaseShape, anAttributePnt, + aProjectedPoint)) { if (aBaseShape->shapeType() == GeomAPI_Shape::EDGE) { std::shared_ptr anEdge(new GeomAPI_Edge(aBaseShape)); - //GeomAPI_Shape::Orientation anOrientation = anEdge->orientation(); - //if (anOrientation == GeomAPI_Shape::REVERSED) { - aStartPoint = anEdge->lastPoint(); - aLastPoint = anEdge->firstPoint(); + // GeomAPI_Shape::Orientation anOrientation = anEdge->orientation(); + // if (anOrientation == GeomAPI_Shape::REVERSED) { + aStartPoint = anEdge->lastPoint(); + aLastPoint = anEdge->firstPoint(); //} - //else { - //aStartPoint = anEdge->firstPoint(); - //aLastPoint = anEdge->lastPoint(); + // else { + // aStartPoint = anEdge->firstPoint(); + // aLastPoint = anEdge->lastPoint(); //} } } } } #ifdef DEBUG_TRIM - std::cout << " => " - << std::endl << "Attribute point: " - << anAttributePnt->x() << ", " << anAttributePnt->y() << ", " << anAttributePnt->z() << "]" - << std::endl << "Start Point: [" - << aStartPoint->x() << ", " << aStartPoint->y() << ", " << aStartPoint->z() << "]" - << std::endl << "Last Point: [" - << aLastPoint->x() << ", " << aLastPoint->y() << ", " << aLastPoint->z() << "]" - << std::endl; + std::cout << " => " << std::endl + << "Attribute point: " << anAttributePnt->x() << ", " + << anAttributePnt->y() << ", " << anAttributePnt->z() << "]" + << std::endl + << "Start Point: [" << aStartPoint->x() << ", " << aStartPoint->y() + << ", " << aStartPoint->z() << "]" << std::endl + << "Last Point: [" << aLastPoint->x() << ", " << aLastPoint->y() + << ", " << aLastPoint->z() << "]" << std::endl; #endif } -std::shared_ptr SketchPlugin_Trim::convertPoint( - const std::shared_ptr& thePoint) -{ +std::shared_ptr +SketchPlugin_Trim::convertPoint(const std::shared_ptr &thePoint) { std::shared_ptr aPoint; if (!thePoint.get()) return aPoint; - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); ObjectPtr aBaseObject = aBaseObjectAttr->value(); if (myObjectToPoints.find(aBaseObject) == myObjectToPoints.end()) { SketchPlugin_SegmentationTools::fillObjectShapes( @@ -167,47 +171,48 @@ std::shared_ptr SketchPlugin_Trim::convertPoint( } bool aFound = false; - const GeomAlgoAPI_ShapeTools::PointToRefsMap& aRefsMap = myObjectToPoints.at(aBaseObject); - for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aPointIt = aRefsMap.begin(); + const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefsMap = + myObjectToPoints.at(aBaseObject); + for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aPointIt = + aRefsMap.begin(); aPointIt != aRefsMap.end() && !aFound; aPointIt++) { if (aPointIt->first->isEqual(thePoint)) { - const std::pair, - std::list >& anInfo = aPointIt->second; - const std::list& anAttributes = anInfo.first; + const std::pair, std::list> + &anInfo = aPointIt->second; + const std::list &anAttributes = anInfo.first; if (!anAttributes.empty()) { aPoint = anAttributes.front()->pnt(); aFound = true; - } - else { + } else { aPoint = sketch()->to2D(thePoint); aFound = true; } } } if (!aFound) { - // returns an end of the shape to define direction of split if feature's attribute - // participates + // returns an end of the shape to define direction of split if feature's + // attribute participates aPoint = sketch()->to2D(thePoint); } return aPoint; } -void SketchPlugin_Trim::execute() -{ +void SketchPlugin_Trim::execute() { #ifdef DEBUG_TRIM_METHODS std::cout << "SketchPlugin_Trim::execute: " << data()->name() << std::endl; #endif - SketchPlugin_Sketch* aSketch = sketch(); + SketchPlugin_Sketch *aSketch = sketch(); if (!aSketch) { setError("Error: Sketch object is empty."); return; } // Check the base objects are initialized. - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); - if(!aBaseObjectAttr->isInitialized()) { + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); + if (!aBaseObjectAttr->isInitialized()) { setError("Error: Base object is not initialized."); return; } @@ -218,15 +223,15 @@ void SketchPlugin_Trim::execute() } FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); - /// Remove reference of this feature to feature used in preview, it is not necessary anymore - /// as trim will be removed after execute + /// Remove reference of this feature to feature used in preview, it is not + /// necessary anymore as trim will be removed after execute AttributeReferencePtr aPreviewObjectAttr = - std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT())); + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT())); ObjectPtr aPreviewObject = aPreviewObjectAttr->value(); AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( - data()->attribute(PREVIEW_POINT())); + data()->attribute(PREVIEW_POINT())); std::shared_ptr aPreviewPnt2d = aPoint->pnt(); // nullify pointer of preview attribute aPreviewObjectAttr->setValue(ResultPtr()); @@ -238,28 +243,34 @@ void SketchPlugin_Trim::execute() #ifdef DEBUG_TRIM std::cout << " Base Feature: " << aBaseFeature->data()->name() << std::endl; #endif - findShapePoints(SELECTED_OBJECT(), SELECTED_POINT(), aStartShapePoint, aLastShapePoint); + findShapePoints(SELECTED_OBJECT(), SELECTED_POINT(), aStartShapePoint, + aLastShapePoint); if (!aStartShapePoint || !aLastShapePoint) { setError("Error: Selected point is not placed on any edge"); return; } - std::shared_ptr aStartShapePoint2d = convertPoint(aStartShapePoint); - std::shared_ptr aLastShapePoint2d = convertPoint(aLastShapePoint); - /// find features that should be deleted (e.g. Middle Point) or updated (e.g. Length) + std::shared_ptr aStartShapePoint2d = + convertPoint(aStartShapePoint); + std::shared_ptr aLastShapePoint2d = + convertPoint(aLastShapePoint); + /// find features that should be deleted (e.g. Middle Point) or updated (e.g. + /// Length) std::set aFeaturesToDelete, aFeaturesToUpdate; getConstraints(aFeaturesToDelete, aFeaturesToUpdate); // find references(attributes and features) to the base feature - std::map > aBaseRefAttributes; + std::map> aBaseRefAttributes; std::list aRefsToFeature; SketchPlugin_SegmentationTools::getRefAttributes( aBaseFeature, aBaseRefAttributes, aRefsToFeature); #ifdef DEBUG_TRIM std::cout << "---- getRefAttributes ----" << std::endl; - std::map >::const_iterator - aRefIt = aBaseRefAttributes.begin(), aRefLast = aBaseRefAttributes.end(); - std::cout << std::endl << "References to attributes of base feature [" << - aBaseRefAttributes.size() << "]" << std::endl; + std::map>::const_iterator + aRefIt = aBaseRefAttributes.begin(), + aRefLast = aBaseRefAttributes.end(); + std::cout << std::endl + << "References to attributes of base feature [" + << aBaseRefAttributes.size() << "]" << std::endl; for (; aRefIt != aRefLast; aRefIt++) { AttributePtr aBaseAttr = aRefIt->first; std::list aRefAttributes = aRefIt->second; @@ -275,13 +286,14 @@ void SketchPlugin_Trim::execute() aRefsInfo.append("(" + aRFeature->name() + ") "); } std::shared_ptr aPointAttr = - std::dynamic_pointer_cast(aBaseAttr); - std::cout << aPointAttr->id().c_str() << - ": " << "[" << aRefAttributes.size() << "] " << aRefsInfo << std::endl; + std::dynamic_pointer_cast(aBaseAttr); + std::cout << aPointAttr->id().c_str() << ": " + << "[" << aRefAttributes.size() << "] " << aRefsInfo << std::endl; } std::cout << std::endl; - std::cout << std::endl << "References to base feature [" << - aRefsToFeature.size() << "]" << std::endl; + std::cout << std::endl + << "References to base feature [" << aRefsToFeature.size() << "]" + << std::endl; std::list::const_iterator aRefAttrIt = aRefsToFeature.begin(), aRefAttrLast = aRefsToFeature.end(); std::string aRefsInfo; @@ -301,30 +313,30 @@ void SketchPlugin_Trim::execute() std::set aFurtherCoincidences; std::set> aModifiedAttributes; - const std::string& aKind = aBaseFeature->getKind(); + const std::string &aKind = aBaseFeature->getKind(); FeaturePtr aReplacingFeature, aNewFeature; if (aKind == SketchPlugin_Circle::ID() || aKind == SketchPlugin_Ellipse::ID()) { aReplacingFeature = trimClosed(aStartShapePoint2d, aLastShapePoint2d, - aFurtherCoincidences, aModifiedAttributes); + aFurtherCoincidences, aModifiedAttributes); aFeaturesToDelete.insert(aBaseFeature); - // as circle is removed, erase it from dependencies(arguments) of this feature - // otherwise Trim feature will be removed with the circle before + // as circle is removed, erase it from dependencies(arguments) of this + // feature otherwise Trim feature will be removed with the circle before // this operation is finished aBaseObjectAttr->setObject(ResultPtr()); - } - else if (aKind == SketchPlugin_Line::ID()) { - aNewFeature = trimLine(aStartShapePoint2d, aLastShapePoint2d, aBaseRefAttributes, - aFurtherCoincidences, aModifiedAttributes); - } - else if (aKind == SketchPlugin_Arc::ID()) { - aNewFeature = trimArc(aStartShapePoint2d, aLastShapePoint2d, aBaseRefAttributes, - aFurtherCoincidences, aModifiedAttributes); - } - else if (aKind == SketchPlugin_EllipticArc::ID()) { - aNewFeature = trimEllipticArc(aStartShapePoint2d, aLastShapePoint2d, aBaseRefAttributes, - aFurtherCoincidences, aModifiedAttributes); + } else if (aKind == SketchPlugin_Line::ID()) { + aNewFeature = + trimLine(aStartShapePoint2d, aLastShapePoint2d, aBaseRefAttributes, + aFurtherCoincidences, aModifiedAttributes); + } else if (aKind == SketchPlugin_Arc::ID()) { + aNewFeature = + trimArc(aStartShapePoint2d, aLastShapePoint2d, aBaseRefAttributes, + aFurtherCoincidences, aModifiedAttributes); + } else if (aKind == SketchPlugin_EllipticArc::ID()) { + aNewFeature = trimEllipticArc(aStartShapePoint2d, aLastShapePoint2d, + aBaseRefAttributes, aFurtherCoincidences, + aModifiedAttributes); } restoreCurrentFeature(); @@ -336,22 +348,25 @@ void SketchPlugin_Trim::execute() } // create coincidence to objects, intersected the base object - const GeomAlgoAPI_ShapeTools::PointToRefsMap& aRefsMap = myObjectToPoints.at(aBaseObject); - for (std::set::const_iterator anIt = aFurtherCoincidences.begin(), - aLast = aFurtherCoincidences.end(); + const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefsMap = + myObjectToPoints.at(aBaseObject); + for (std::set::const_iterator + anIt = aFurtherCoincidences.begin(), + aLast = aFurtherCoincidences.end(); anIt != aLast; anIt++) { AttributePoint2DPtr aPointAttribute = (*anIt); std::shared_ptr aPoint2d = aPointAttribute->pnt(); #ifdef DEBUG_TRIM std::cout << " => " << std::endl - << "aPoint2d: [" << aPoint2d->x() << ", " << aPoint2d->y() << "]" << std::endl; + << "aPoint2d: [" << aPoint2d->x() << ", " << aPoint2d->y() << "]" + << std::endl; if (aStartShapePoint2d.get()) - std::cout << "Start Point: [" << aStartShapePoint2d->x() << ", " << aStartShapePoint2d->y() - << "]" << std::endl; + std::cout << "Start Point: [" << aStartShapePoint2d->x() << ", " + << aStartShapePoint2d->y() << "]" << std::endl; if (aLastShapePoint2d.get()) - std::cout << "Last Point: [" << aLastShapePoint2d->x() << ", " << aLastShapePoint2d->y() - << "]" << std::endl; + std::cout << "Last Point: [" << aLastShapePoint2d->x() << ", " + << aLastShapePoint2d->y() << "]" << std::endl; #endif std::shared_ptr aExtrPoint; @@ -363,18 +378,21 @@ void SketchPlugin_Trim::execute() if (!aExtrPoint.get()) continue; - std::pair, std::list > anInfo; - for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aRefIt = aRefsMap.begin(); - aRefIt != aRefsMap.end(); aRefIt++) - { + std::pair, std::list> anInfo; + for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aRefIt = + aRefsMap.begin(); + aRefIt != aRefsMap.end(); aRefIt++) { if (aRefIt->first->isEqual(aExtrPoint)) { anInfo = aRefIt->second; - // prefer a segment instead of a point, because further coincidence with a segment - // decreases only 1 DoF (instead of 2 for point) and prevents an overconstraint situation. + // prefer a segment instead of a point, because further coincidence with + // a segment decreases only 1 DoF (instead of 2 for point) and prevents + // an overconstraint situation. bool isEdge = false; - for (std::list::const_iterator anInfoIt = anInfo.second.begin(); + for (std::list::const_iterator anInfoIt = + anInfo.second.begin(); anInfoIt != anInfo.second.end() && !isEdge; ++anInfoIt) { - ResultPtr aResult = std::dynamic_pointer_cast(*anInfoIt); + ResultPtr aResult = + std::dynamic_pointer_cast(*anInfoIt); if (aResult) { GeomShapePtr aShape = aResult->shape(); isEdge = aShape && aShape->isEdge(); @@ -384,28 +402,29 @@ void SketchPlugin_Trim::execute() break; } } - const std::list& anObjects = anInfo.second; + const std::list &anObjects = anInfo.second; for (std::list::const_iterator anObjectIt = anObjects.begin(); - anObjectIt != anObjects.end(); anObjectIt++) { - SketchPlugin_Tools::createConstraintAttrObject(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aPointAttribute, *anObjectIt); + anObjectIt != anObjects.end(); anObjectIt++) { + SketchPlugin_Tools::createConstraintAttrObject( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), aPointAttribute, + *anObjectIt); } } - // move constraints from base feature to replacing feature: ignore coincidences to feature - // if attributes of coincidence participated in split + // move constraints from base feature to replacing feature: ignore + // coincidences to feature if attributes of coincidence participated in split ResultPtr aReplacingResult; if (aReplacingFeature.get()) { aReplacingFeature->execute(); // need it to obtain result aReplacingResult = aReplacingFeature->lastResult(); } - for(std::list::const_iterator anIt = aRefsToFeature.begin(), - aLast = aRefsToFeature.end(); - anIt != aLast; anIt++) { + for (std::list::const_iterator anIt = aRefsToFeature.begin(), + aLast = aRefsToFeature.end(); + anIt != aLast; anIt++) { AttributePtr anAttribute = *anIt; - if (setCoincidenceToAttribute(anAttribute, aFurtherCoincidences, aFeaturesToDelete)) + if (setCoincidenceToAttribute(anAttribute, aFurtherCoincidences, + aFeaturesToDelete)) continue; // move tangency constraint to the nearest feature if possible @@ -419,22 +438,24 @@ void SketchPlugin_Trim::execute() aRefAttr->setObject(aReplacingResult); else { AttributeReferencePtr aReferenceAttr = - std::dynamic_pointer_cast(anAttribute); + std::dynamic_pointer_cast(anAttribute); if (aReferenceAttr.get()) aReferenceAttr->setObject(aReplacingResult); } } } - SketchPlugin_SegmentationTools::updateRefAttConstraints(aBaseRefAttributes, aModifiedAttributes); + SketchPlugin_SegmentationTools::updateRefAttConstraints(aBaseRefAttributes, + aModifiedAttributes); // Wait all constraints being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); - // delete constraints + // delete constraints #ifdef DEBUG_TRIM if (aFeaturesToDelete.size() > 0) { std::cout << "after SPlit: removeFeaturesAndReferences: " << std::endl; @@ -449,10 +470,11 @@ void SketchPlugin_Trim::execute() ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToDelete); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); - SketchPlugin_SegmentationTools::updateFeaturesAfterOperation(aFeaturesToUpdate); + SketchPlugin_SegmentationTools::updateFeaturesAfterOperation( + aFeaturesToUpdate); // Send events to update the sub-features by the solver. - if(isUpdateFlushed) { + if (isUpdateFlushed) { Events_Loop::loop()->setFlushed(anUpdateEvent, true); } @@ -461,26 +483,29 @@ void SketchPlugin_Trim::execute() // nothing to do if the preview and selected objects are different if (aReplacingResult.get()) { // base object was removed aPreviewObject = aReplacingResult; - //aMessage->setSelectedObject(aReplacingResult); + // aMessage->setSelectedObject(aReplacingResult); #ifdef DEBUG_TRIM_METHODS if (!aSelectedShape.get()) std::cout << "Set empty selected object" << std::endl; else - std::cout << "Set shape with ShapeType: " << aSelectedShape->shapeTypeStr() << std::endl; + std::cout << "Set shape with ShapeType: " + << aSelectedShape->shapeTypeStr() << std::endl; #endif - } - else { + } else { aPreviewObject = ObjectPtr(); - aBaseFeature->execute(); // should recompute shapes of result to do not check obsolete one + aBaseFeature->execute(); // should recompute shapes of result to do not + // check obsolete one aBaseObject = aBaseFeature->lastResult(); - std::shared_ptr aPreviewPnt = sketch()->to3D(aPreviewPnt2d->x(), - aPreviewPnt2d->y()); - ResultPtr aBaseResult = std::dynamic_pointer_cast(aBaseObject); + std::shared_ptr aPreviewPnt = + sketch()->to3D(aPreviewPnt2d->x(), aPreviewPnt2d->y()); + ResultPtr aBaseResult = + std::dynamic_pointer_cast(aBaseObject); if (aBaseResult) { GeomShapePtr aShape = aBaseResult->shape(); std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, aProjectedPoint)) + if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, + aProjectedPoint)) aPreviewObject = aBaseResult; } if (!aPreviewObject.get() && aNewFeature.get()) { @@ -488,16 +513,18 @@ void SketchPlugin_Trim::execute() if (aNewFeatureResult.get()) { GeomShapePtr aShape = aNewFeatureResult->shape(); std::shared_ptr aProjectedPoint; - if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, aProjectedPoint)) + if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, aPreviewPnt, + aProjectedPoint)) aPreviewObject = aNewFeatureResult; } } } } if (aPreviewObject.get()) { - std::shared_ptr aMessage = std::shared_ptr - (new ModelAPI_EventReentrantMessage( - ModelAPI_EventReentrantMessage::eventId(), this)); + std::shared_ptr aMessage = + std::shared_ptr( + new ModelAPI_EventReentrantMessage( + ModelAPI_EventReentrantMessage::eventId(), this)); aMessage->setSelectedObject(aPreviewObject); Events_Loop::loop()->send(aMessage); } @@ -507,15 +534,16 @@ void SketchPlugin_Trim::execute() } // LCOV_EXCL_START -std::string SketchPlugin_Trim::processEvent(const std::shared_ptr& theMessage) -{ +std::string SketchPlugin_Trim::processEvent( + const std::shared_ptr &theMessage) { #ifdef DEBUG_TRIM_METHODS - std::cout << "SketchPlugin_Trim::processEvent:" << data()->name() << std::endl; + std::cout << "SketchPlugin_Trim::processEvent:" << data()->name() + << std::endl; #endif std::string aFilledAttributeName; std::shared_ptr aMessage = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aMessage.get()) { ObjectPtr anObject = aMessage->selectedObject(); std::shared_ptr aPoint = aMessage->clickedPoint(); @@ -525,36 +553,40 @@ std::string SketchPlugin_Trim::processEvent(const std::shared_ptr& aShapes = myCashedShapes[anObject]; + const std::set &aShapes = myCashedShapes[anObject]; if (aShapes.size() > 1) { std::shared_ptr aRefSelectedAttr = - std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); std::shared_ptr aRefPreviewAttr = - std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT())); + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT())); aRefSelectedAttr->setValue(anObject); aRefPreviewAttr->setValue(anObject); std::shared_ptr aPointSelectedAttr = - std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::SELECTED_POINT())); + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::SELECTED_POINT())); std::shared_ptr aPointPreviewAttr = - std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::PREVIEW_POINT())); + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::PREVIEW_POINT())); aPointSelectedAttr->setValue(aPoint); aPointPreviewAttr->setValue(aPoint); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - GeomShapePtr aSelectedShape = SketchPlugin_SegmentationTools::getSubShape(this, - SELECTED_OBJECT(), SELECTED_POINT(), myCashedShapes, myObjectToPoints); - #ifdef DEBUG_TRIM_METHODS + GeomShapePtr aSelectedShape = + SketchPlugin_SegmentationTools::getSubShape( + this, SELECTED_OBJECT(), SELECTED_POINT(), myCashedShapes, + myObjectToPoints); +#ifdef DEBUG_TRIM_METHODS if (!aSelectedShape.get()) std::cout << "Set empty selected object" << std::endl; else - std::cout << "Set shape with ShapeType: " << aSelectedShape->shapeTypeStr() << std::endl; - #endif + std::cout << "Set shape with ShapeType: " + << aSelectedShape->shapeTypeStr() << std::endl; +#endif aFilledAttributeName = SketchPlugin_Trim::SELECTED_OBJECT(); } } @@ -563,45 +595,46 @@ std::string SketchPlugin_Trim::processEvent(const std::shared_ptr& theFurtherCoincidences, - std::set>& theFeaturesToDelete) -{ +bool SketchPlugin_Trim::setCoincidenceToAttribute( + const AttributePtr &theAttribute, + const std::set &theFurtherCoincidences, + std::set> &theFeaturesToDelete) { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (aFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID()) return false; - AttributePoint2DPtr aRefPointAttr = SketchPlugin_ConstraintCoincidence::getPoint(aFeature); + AttributePoint2DPtr aRefPointAttr = + SketchPlugin_ConstraintCoincidence::getPoint(aFeature); if (!aRefPointAttr.get()) return false; std::shared_ptr aRefPnt2d = aRefPointAttr->pnt(); - std::set::const_iterator anIt = theFurtherCoincidences.begin(), - aLast = theFurtherCoincidences.end(); + std::set::const_iterator + anIt = theFurtherCoincidences.begin(), + aLast = theFurtherCoincidences.end(); bool aFoundPoint = false; for (; anIt != aLast && !aFoundPoint; anIt++) { AttributePoint2DPtr aPointAttribute = (*anIt); std::shared_ptr aPoint2d = aPointAttribute->pnt(); if (aPoint2d->isEqual(aRefPnt2d)) { // create new coincidence and then remove the old one - SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aRefPointAttr, aPointAttribute); + SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), aRefPointAttr, + aPointAttribute); theFeaturesToDelete.insert(aFeature); } } return aFoundPoint; } -bool SketchPlugin_Trim::moveTangency(const AttributePtr& theAttribute, - const FeaturePtr& theFeature) -{ +bool SketchPlugin_Trim::moveTangency(const AttributePtr &theAttribute, + const FeaturePtr &theFeature) { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (aFeature->getKind() != SketchPlugin_ConstraintTangent::ID()) return false; - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - theAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); if (!aRefAttr.get()) return false; @@ -609,20 +642,24 @@ bool SketchPlugin_Trim::moveTangency(const AttributePtr& theAttribute, std::string aTangentAttr = SketchPlugin_Constraint::ENTITY_A(); if (aRefAttr->id() == SketchPlugin_Constraint::ENTITY_A()) aTangentAttr = SketchPlugin_Constraint::ENTITY_B(); - AttributeRefAttrPtr aTangentRefAttr = std::dynamic_pointer_cast( - aFeature->attribute(aTangentAttr)); - FeaturePtr aTangentFeature = ModelAPI_Feature::feature(aTangentRefAttr->object()); + AttributeRefAttrPtr aTangentRefAttr = + std::dynamic_pointer_cast( + aFeature->attribute(aTangentAttr)); + FeaturePtr aTangentFeature = + ModelAPI_Feature::feature(aTangentRefAttr->object()); // get shape of the feature of the attribute FeaturePtr anAttributeFeature = ModelAPI_Feature::feature(aRefAttr->object()); - anAttributeFeature->execute(); // the modified value should be applyed to recompute shape + anAttributeFeature + ->execute(); // the modified value should be applyed to recompute shape GeomAlgoAPI_ShapeTools::PointToRefsMap aPointToAttributeOrObject; std::list aFeatures; aFeatures.push_back(anAttributeFeature); ModelGeomAlgo_Point2D::getPointsIntersectedShape(aTangentFeature, aFeatures, aPointToAttributeOrObject); if (!aPointToAttributeOrObject.empty()) - return true; // the attribute feature has a point of intersection, so we do not replace it + return true; // the attribute feature has a point of intersection, so we do + // not replace it // get shape of the feature aPointToAttributeOrObject.clear(); @@ -632,32 +669,35 @@ bool SketchPlugin_Trim::moveTangency(const AttributePtr& theAttribute, aPointToAttributeOrObject); if (!aPointToAttributeOrObject.empty()) { std::set anEdgeShapes; - ModelGeomAlgo_Shape::shapesOfType(theFeature, GeomAPI_Shape::EDGE, anEdgeShapes); + ModelGeomAlgo_Shape::shapesOfType(theFeature, GeomAPI_Shape::EDGE, + anEdgeShapes); if (!anEdgeShapes.empty()) { ResultPtr aResult = *anEdgeShapes.begin(); if (aResult.get()) { aRefAttr->setObject(aResult); - return true; // the attribute feature has a point of intersection, so we do not replace it + return true; // the attribute feature has a point of intersection, so we + // do not replace it } } } return false; } -AISObjectPtr SketchPlugin_Trim::getAISObject(AISObjectPtr thePrevious) -{ - return SketchPlugin_SegmentationTools::getAISObject(thePrevious, - this, PREVIEW_OBJECT(), PREVIEW_POINT(), SELECTED_OBJECT(), SELECTED_POINT()); +AISObjectPtr SketchPlugin_Trim::getAISObject(AISObjectPtr thePrevious) { + return SketchPlugin_SegmentationTools::getAISObject( + thePrevious, this, PREVIEW_OBJECT(), PREVIEW_POINT(), SELECTED_OBJECT(), + SELECTED_POINT()); } -void SketchPlugin_Trim::getConstraints(std::set& theFeaturesToDelete, - std::set& theFeaturesToUpdate) -{ +void SketchPlugin_Trim::getConstraints( + std::set &theFeaturesToDelete, + std::set &theFeaturesToUpdate) { std::shared_ptr aData = data(); // Check the base objects are initialized. - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); ResultPtr aBaseFeatureResult = aBaseFeature->lastResult(); @@ -668,7 +708,8 @@ void SketchPlugin_Trim::getConstraints(std::set& theFeaturesToDelete std::set::const_iterator aIt; for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { std::shared_ptr anAttr = (*aIt); - FeaturePtr aRefFeature = std::dynamic_pointer_cast(anAttr->owner()); + FeaturePtr aRefFeature = + std::dynamic_pointer_cast(anAttr->owner()); std::string aRefFeatureKind = aRefFeature->getKind(); std::string anAttributeId = anAttr->id(); if ((aRefFeatureKind == SketchPlugin_ConstraintMirror::ID() && @@ -676,7 +717,8 @@ void SketchPlugin_Trim::getConstraints(std::set& theFeaturesToDelete (aRefFeatureKind == SketchPlugin_MultiRotation::ID() && anAttributeId == SketchPlugin_MultiRotation::ROTATION_LIST_ID()) || (aRefFeatureKind == SketchPlugin_MultiTranslation::ID() && - anAttributeId == SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID()) || + anAttributeId == + SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID()) || aRefFeatureKind == SketchPlugin_ConstraintMiddle::ID()) theFeaturesToDelete.insert(aRefFeature); else if (aRefFeatureKind == SketchPlugin_ConstraintLength::ID()) @@ -684,20 +726,22 @@ void SketchPlugin_Trim::getConstraints(std::set& theFeaturesToDelete } } -void SketchPlugin_Trim::removeReferencesToAttribute(const AttributePtr& theAttribute, - std::map >& theBaseRefAttributes) -{ +void SketchPlugin_Trim::removeReferencesToAttribute( + const AttributePtr &theAttribute, + std::map> &theBaseRefAttributes) { /// not found in references if (theBaseRefAttributes.find(theAttribute) == theBaseRefAttributes.end()) return; - std::list aRefAttributes = theBaseRefAttributes.at(theAttribute); + std::list aRefAttributes = + theBaseRefAttributes.at(theAttribute); std::list::const_iterator aRefIt = aRefAttributes.begin(), aRLast = aRefAttributes.end(); std::set aFeaturesToDelete; for (; aRefIt != aRLast; aRefIt++) { - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*aRefIt); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(*aRefIt); if (aRefAttr.get()) { aFeaturesToDelete.insert(ModelAPI_Feature::feature(aRefAttr->owner())); } @@ -719,17 +763,18 @@ void SketchPlugin_Trim::removeReferencesToAttribute(const AttributePtr& theAttri Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); } -FeaturePtr SketchPlugin_Trim::trimLine(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::map >& theBaseRefAttributes, - std::set& thePoints, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Trim::trimLine( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::map> &theBaseRefAttributes, + std::set &thePoints, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; // Check the base objects are initialized. - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); ObjectPtr aBaseObject = aBaseObjectAttr->value(); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); @@ -738,90 +783,98 @@ FeaturePtr SketchPlugin_Trim::trimLine(const std::shared_ptr& the SketchPlugin_SegmentationTools::getFeaturePoints( aBaseFeature, aStartPointAttrOfBase, anEndPointAttrOfBase); - std::shared_ptr aStartFeaturePoint = aStartPointAttrOfBase->pnt(); - std::shared_ptr aLastFeaturePoint = anEndPointAttrOfBase->pnt(); + std::shared_ptr aStartFeaturePoint = + aStartPointAttrOfBase->pnt(); + std::shared_ptr aLastFeaturePoint = + anEndPointAttrOfBase->pnt(); std::shared_ptr aStartShapePoint = theStartShapePoint; std::shared_ptr aLastShapePoint = theLastShapePoint; arrangePointsOnLine(aStartPointAttrOfBase, anEndPointAttrOfBase, aStartShapePoint, aLastShapePoint); #ifdef DEBUG_TRIM - std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl; + std::cout << "Arranged points (to build split between 1st and 2nd points:" + << std::endl; if (aStartShapePoint.get()) - std::cout << "Start point: [" << aStartShapePoint->x() << ", " << - aStartShapePoint->y() << "]" << std::endl; - std::cout << "1st point: [" << aStartFeaturePoint->x() << ", " << - aStartFeaturePoint->y() << "]" << std::endl; + std::cout << "Start point: [" << aStartShapePoint->x() << ", " + << aStartShapePoint->y() << "]" << std::endl; + std::cout << "1st point: [" << aStartFeaturePoint->x() << ", " + << aStartFeaturePoint->y() << "]" << std::endl; if (aLastShapePoint.get()) - std::cout << "2st point: [" << aLastShapePoint->x() << ", " << - aLastShapePoint->y() << "]" << std::endl; - std::cout << "End point: [" << aLastFeaturePoint->x() << ", " << - aLastFeaturePoint->y() << "]" << std::endl; + std::cout << "2st point: [" << aLastShapePoint->x() << ", " + << aLastShapePoint->y() << "]" << std::endl; + std::cout << "End point: [" << aLastFeaturePoint->x() << ", " + << aLastFeaturePoint->y() << "]" << std::endl; #endif - bool isStartPoint = !aStartShapePoint.get() || aStartFeaturePoint->isEqual(aStartShapePoint); - bool isLastPoint = !aLastShapePoint.get() || aLastFeaturePoint->isEqual(aLastShapePoint); + bool isStartPoint = + !aStartShapePoint.get() || aStartFeaturePoint->isEqual(aStartShapePoint); + bool isLastPoint = + !aLastShapePoint.get() || aLastFeaturePoint->isEqual(aLastShapePoint); if (isStartPoint || isLastPoint) { // result is one line: changed existing line - std::string aModifiedAttribute = isStartPoint ? SketchPlugin_Line::START_ID() - : SketchPlugin_Line::END_ID(); + std::string aModifiedAttribute = isStartPoint + ? SketchPlugin_Line::START_ID() + : SketchPlugin_Line::END_ID(); std::shared_ptr aPoint; if (aStartShapePoint.get() && aLastShapePoint.get()) aPoint = isStartPoint ? aLastShapePoint : aStartShapePoint; else aPoint = aStartShapePoint.get() ? aStartShapePoint : aLastShapePoint; - // it is important to delete references before the feature modification because - // if deletion will be after the feature modification, solver returns the feature back + // it is important to delete references before the feature modification + // because if deletion will be after the feature modification, solver + // returns the feature back removeReferencesToAttribute(aBaseFeature->attribute(aModifiedAttribute), theBaseRefAttributes); fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), aPoint); - //theModifiedAttributes.insert( - // std::make_pair(aBaseFeature->attribute(aModifiedAttribute), AttributePtr())); + // theModifiedAttributes.insert( + // std::make_pair(aBaseFeature->attribute(aModifiedAttribute), + // AttributePtr())); - thePoints.insert(std::dynamic_pointer_cast - (aBaseFeature->attribute(aModifiedAttribute))); - } - else { + thePoints.insert(std::dynamic_pointer_cast( + aBaseFeature->attribute(aModifiedAttribute))); + } else { // result is two lines: start line point - start shape point, // last shape point - last line point // create second line anNewFeature = SketchPlugin_SegmentationTools::createLineFeature( aBaseFeature, aLastShapePoint, aLastFeaturePoint); - thePoints.insert(std::dynamic_pointer_cast - (anNewFeature->attribute(SketchPlugin_Line::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + anNewFeature->attribute(SketchPlugin_Line::START_ID()))); std::string aModifiedAttribute = SketchPlugin_Line::END_ID(); theModifiedAttributes.insert( - std::make_pair(aBaseFeature->attribute(aModifiedAttribute), - anNewFeature->attribute(SketchPlugin_Line::END_ID()))); + std::make_pair(aBaseFeature->attribute(aModifiedAttribute), + anNewFeature->attribute(SketchPlugin_Line::END_ID()))); // modify base arc - fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), aStartShapePoint); + fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), + aStartShapePoint); - thePoints.insert(std::dynamic_pointer_cast - (aBaseFeature->attribute(aModifiedAttribute))); + thePoints.insert(std::dynamic_pointer_cast( + aBaseFeature->attribute(aModifiedAttribute))); // Collinear constraint for lines - SketchPlugin_Tools::createConstraintObjectObject(sketch(), - SketchPlugin_ConstraintCollinear::ID(), - aBaseFeature->lastResult(), - anNewFeature->lastResult()); + SketchPlugin_Tools::createConstraintObjectObject( + sketch(), SketchPlugin_ConstraintCollinear::ID(), + aBaseFeature->lastResult(), anNewFeature->lastResult()); } return anNewFeature; } -FeaturePtr SketchPlugin_Trim::trimArc(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::map >& theBaseRefAttributes, - std::set& thePoints, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Trim::trimArc( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::map> &theBaseRefAttributes, + std::set &thePoints, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; // Check the base objects are initialized. - AttributeReferencePtr aBaseObjectAttr = std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); + AttributeReferencePtr aBaseObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT())); ObjectPtr aBaseObject = aBaseObjectAttr->value(); FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); @@ -838,21 +891,24 @@ FeaturePtr SketchPlugin_Trim::trimArc(const std::shared_ptr& theS arrangePointsOnArc(aBaseFeature, aStartPointAttrOfBase, anEndPointAttrOfBase, aStartShapePoint, aLastShapePoint); #ifdef DEBUG_TRIM - std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl; + std::cout << "Arranged points (to build split between 1st and 2nd points:" + << std::endl; if (aStartShapePoint.get()) - std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " << - aStartShapePoint->y() << "]" << std::endl; - std::cout << "Start arc attribute point: [" << aStartArcPoint->x() << ", " << - aStartArcPoint->y() << "]" << std::endl; + std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " + << aStartShapePoint->y() << "]" << std::endl; + std::cout << "Start arc attribute point: [" << aStartArcPoint->x() << ", " + << aStartArcPoint->y() << "]" << std::endl; if (aLastShapePoint.get()) - std::cout << "Last shape point: [" << aLastShapePoint->x() << ", " << - aLastShapePoint->y() << "]" << std::endl; - std::cout << "Last arc attribute point: [" << aLastArcPoint->x() << ", " << - aLastArcPoint->y() << "]" << std::endl; + std::cout << "Last shape point: [" << aLastShapePoint->x() << ", " + << aLastShapePoint->y() << "]" << std::endl; + std::cout << "Last arc attribute point: [" << aLastArcPoint->x() << ", " + << aLastArcPoint->y() << "]" << std::endl; #endif - bool isStartPoint = !aStartShapePoint.get() || aStartArcPoint->isEqual(aStartShapePoint); - bool isLastPoint = !aLastShapePoint.get() || aLastArcPoint->isEqual(aLastShapePoint); + bool isStartPoint = + !aStartShapePoint.get() || aStartArcPoint->isEqual(aStartShapePoint); + bool isLastPoint = + !aLastShapePoint.get() || aLastArcPoint->isEqual(aLastShapePoint); if (isStartPoint || isLastPoint) { // result is one arc: changed existing arc std::string aModifiedAttribute = isStartPoint ? SketchPlugin_Arc::START_ID() @@ -868,55 +924,53 @@ FeaturePtr SketchPlugin_Trim::trimArc(const std::shared_ptr& theS fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), aPoint); - thePoints.insert(std::dynamic_pointer_cast - (aBaseFeature->attribute(aModifiedAttribute))); - } - else { - // result is two arcs: start arc point - start shape point, last shape point - last arc point - // create second arc + thePoints.insert(std::dynamic_pointer_cast( + aBaseFeature->attribute(aModifiedAttribute))); + } else { + // result is two arcs: start arc point - start shape point, last shape point + // - last arc point create second arc anNewFeature = SketchPlugin_SegmentationTools::createArcFeature( aBaseFeature, aLastShapePoint, aLastArcPoint); - thePoints.insert(std::dynamic_pointer_cast - (anNewFeature->attribute(SketchPlugin_Arc::START_ID()))); + thePoints.insert(std::dynamic_pointer_cast( + anNewFeature->attribute(SketchPlugin_Arc::START_ID()))); std::string aModifiedAttribute = SketchPlugin_Arc::END_ID(); theModifiedAttributes.insert( - std::make_pair(aBaseFeature->attribute(aModifiedAttribute), - anNewFeature->attribute(SketchPlugin_Arc::END_ID()))); + std::make_pair(aBaseFeature->attribute(aModifiedAttribute), + anNewFeature->attribute(SketchPlugin_Arc::END_ID()))); // modify base arc - fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), aStartShapePoint); + fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), + aStartShapePoint); - thePoints.insert(std::dynamic_pointer_cast - (aBaseFeature->attribute(aModifiedAttribute))); + thePoints.insert(std::dynamic_pointer_cast( + aBaseFeature->attribute(aModifiedAttribute))); // equal Radius constraint for arcs - SketchPlugin_Tools::createConstraintObjectObject(sketch(), - SketchPlugin_ConstraintEqual::ID(), - aBaseFeature->lastResult(), - anNewFeature->lastResult()); + SketchPlugin_Tools::createConstraintObjectObject( + sketch(), SketchPlugin_ConstraintEqual::ID(), + aBaseFeature->lastResult(), anNewFeature->lastResult()); // coincident centers constraint - SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), - aBaseFeature->attribute(SketchPlugin_Arc::CENTER_ID()), - anNewFeature->attribute(SketchPlugin_Arc::CENTER_ID())); + SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), + aBaseFeature->attribute(SketchPlugin_Arc::CENTER_ID()), + anNewFeature->attribute(SketchPlugin_Arc::CENTER_ID())); #ifdef DEBUG_TRIM std::cout << "Created arc on points:" << std::endl; - std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " << - aStartShapePoint->y() << "]" << std::endl; + std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " + << aStartShapePoint->y() << "]" << std::endl; #endif } return anNewFeature; } FeaturePtr SketchPlugin_Trim::trimEllipticArc( - const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::map >& theBaseRefAttributes, - std::set& thePoints, - std::set>& theModifiedAttributes) -{ + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::map> &theBaseRefAttributes, + std::set &thePoints, + std::set> &theModifiedAttributes) { FeaturePtr anNewFeature; // Check the base objects are initialized. AttributeReferencePtr aBaseObjectAttr = reference(SELECTED_OBJECT()); @@ -936,25 +990,29 @@ FeaturePtr SketchPlugin_Trim::trimEllipticArc( arrangePointsOnArc(aBaseFeature, aStartPointAttrOfBase, anEndPointAttrOfBase, aStartShapePoint, aLastShapePoint); #ifdef DEBUG_TRIM - std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl; + std::cout << "Arranged points (to build split between 1st and 2nd points:" + << std::endl; if (aStartShapePoint.get()) - std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " << - aStartShapePoint->y() << "]" << std::endl; - std::cout << "Start arc attribute point: [" << aStartArcPoint->x() << ", " << - aStartArcPoint->y() << "]" << std::endl; + std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " + << aStartShapePoint->y() << "]" << std::endl; + std::cout << "Start arc attribute point: [" << aStartArcPoint->x() << ", " + << aStartArcPoint->y() << "]" << std::endl; if (aLastShapePoint.get()) - std::cout << "Last shape point: [" << aLastShapePoint->x() << ", " << - aLastShapePoint->y() << "]" << std::endl; - std::cout << "Last arc attribute point: [" << aLastArcPoint->x() << ", " << - aLastArcPoint->y() << "]" << std::endl; + std::cout << "Last shape point: [" << aLastShapePoint->x() << ", " + << aLastShapePoint->y() << "]" << std::endl; + std::cout << "Last arc attribute point: [" << aLastArcPoint->x() << ", " + << aLastArcPoint->y() << "]" << std::endl; #endif - bool isStartPoint = !aStartShapePoint.get() || aStartArcPoint->isEqual(aStartShapePoint); - bool isLastPoint = !aLastShapePoint.get() || aLastArcPoint->isEqual(aLastShapePoint); + bool isStartPoint = + !aStartShapePoint.get() || aStartArcPoint->isEqual(aStartShapePoint); + bool isLastPoint = + !aLastShapePoint.get() || aLastArcPoint->isEqual(aLastShapePoint); if (isStartPoint || isLastPoint) { // result is one arc: changed existing arc - std::string aModifiedAttribute = isStartPoint ? SketchPlugin_EllipticArc::START_POINT_ID() - : SketchPlugin_EllipticArc::END_POINT_ID(); + std::string aModifiedAttribute = + isStartPoint ? SketchPlugin_EllipticArc::START_POINT_ID() + : SketchPlugin_EllipticArc::END_POINT_ID(); std::shared_ptr aPoint; if (aStartShapePoint.get() && aLastShapePoint.get()) aPoint = isStartPoint ? aLastShapePoint : aStartShapePoint; @@ -966,53 +1024,52 @@ FeaturePtr SketchPlugin_Trim::trimEllipticArc( fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), aPoint); - thePoints.insert(std::dynamic_pointer_cast - (aBaseFeature->attribute(aModifiedAttribute))); - } - else { - // result is two arcs: start arc point - start shape point, last shape point - last arc point - // create second arc + thePoints.insert(std::dynamic_pointer_cast( + aBaseFeature->attribute(aModifiedAttribute))); + } else { + // result is two arcs: start arc point - start shape point, last shape point + // - last arc point create second arc anNewFeature = SketchPlugin_SegmentationTools::createArcFeature( aBaseFeature, aLastShapePoint, aLastArcPoint); thePoints.insert(std::dynamic_pointer_cast( - anNewFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); + anNewFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID()))); std::string aModifiedAttribute = SketchPlugin_EllipticArc::END_POINT_ID(); - theModifiedAttributes.insert( - std::make_pair(aBaseFeature->attribute(aModifiedAttribute), - anNewFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); + theModifiedAttributes.insert(std::make_pair( + aBaseFeature->attribute(aModifiedAttribute), + anNewFeature->attribute(SketchPlugin_EllipticArc::END_POINT_ID()))); // modify base arc - fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), aStartShapePoint); + fillPointAttribute(aBaseFeature->attribute(aModifiedAttribute), + aStartShapePoint); - thePoints.insert(std::dynamic_pointer_cast - (aBaseFeature->attribute(aModifiedAttribute))); + thePoints.insert(std::dynamic_pointer_cast( + aBaseFeature->attribute(aModifiedAttribute))); // make elliptic arcs equal - SketchPlugin_Tools::createConstraintObjectObject(sketch(), - SketchPlugin_ConstraintEqual::ID(), - aBaseFeature->lastResult(), - anNewFeature->lastResult()); + SketchPlugin_Tools::createConstraintObjectObject( + sketch(), SketchPlugin_ConstraintEqual::ID(), + aBaseFeature->lastResult(), anNewFeature->lastResult()); // coincident centers constraint - SketchPlugin_Tools::createConstraintAttrAttr(sketch(), - SketchPlugin_ConstraintCoincidence::ID(), + SketchPlugin_Tools::createConstraintAttrAttr( + sketch(), SketchPlugin_ConstraintCoincidence::ID(), aBaseFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID()), anNewFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID())); #ifdef DEBUG_TRIM std::cout << "Created arc on points:" << std::endl; - std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " << - aStartShapePoint->y() << "]" << std::endl; + std::cout << "Start shape point: [" << aStartShapePoint->x() << ", " + << aStartShapePoint->y() << "]" << std::endl; #endif } return anNewFeature; } -FeaturePtr SketchPlugin_Trim::trimClosed(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::set& thePoints, - std::set>& theModifiedAttributes) -{ +FeaturePtr SketchPlugin_Trim::trimClosed( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::set &thePoints, + std::set> &theModifiedAttributes) { // Check the base objects are initialized. AttributeReferencePtr aBaseObjectAttr = reference(SELECTED_OBJECT()); ObjectPtr aBaseObject = aBaseObjectAttr->value(); @@ -1021,17 +1078,19 @@ FeaturePtr SketchPlugin_Trim::trimClosed(const std::shared_ptr& t // trim feature FeaturePtr anNewFeature = SketchPlugin_SegmentationTools::createArcFeature( aBaseFeature, theStartShapePoint, theLastShapePoint); - // arc created by trim of circle is always correct, that means that it is not inversed - const std::string& aReversedAttrName = anNewFeature->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::REVERSED_ID() : SketchPlugin_EllipticArc::REVERSED_ID(); + // arc created by trim of circle is always correct, that means that it is not + // inversed + const std::string &aReversedAttrName = + anNewFeature->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::REVERSED_ID() + : SketchPlugin_EllipticArc::REVERSED_ID(); anNewFeature->boolean(aReversedAttrName)->setValue(false); if (aBaseFeature->getKind() == SketchPlugin_Circle::ID()) { - theModifiedAttributes.insert( - std::make_pair(aBaseFeature->attribute(SketchPlugin_Circle::CENTER_ID()), - anNewFeature->attribute(SketchPlugin_Arc::CENTER_ID()))); - } - else if (aBaseFeature->getKind() == SketchPlugin_Ellipse::ID()) { + theModifiedAttributes.insert(std::make_pair( + aBaseFeature->attribute(SketchPlugin_Circle::CENTER_ID()), + anNewFeature->attribute(SketchPlugin_Arc::CENTER_ID()))); + } else if (aBaseFeature->getKind() == SketchPlugin_Ellipse::ID()) { theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::CENTER_ID()), anNewFeature->attribute(SketchPlugin_EllipticArc::CENTER_ID()))); @@ -1043,53 +1102,65 @@ FeaturePtr SketchPlugin_Trim::trimClosed(const std::shared_ptr& t anNewFeature->attribute(SketchPlugin_EllipticArc::SECOND_FOCUS_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()), - anNewFeature->attribute(SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID()))); + anNewFeature->attribute( + SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()), - anNewFeature->attribute(SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID()))); + anNewFeature->attribute( + SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MINOR_AXIS_START_ID()), - anNewFeature->attribute(SketchPlugin_EllipticArc::MINOR_AXIS_START_ID()))); + anNewFeature->attribute( + SketchPlugin_EllipticArc::MINOR_AXIS_START_ID()))); theModifiedAttributes.insert(std::make_pair( aBaseFeature->attribute(SketchPlugin_Ellipse::MINOR_AXIS_END_ID()), - anNewFeature->attribute(SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()))); + anNewFeature->attribute( + SketchPlugin_EllipticArc::MINOR_AXIS_END_ID()))); - // update the PARENT_ID reference for all the features created by the ellipse - const std::set& aRefs = aBaseFeature->data()->refsToMe(); + // update the PARENT_ID reference for all the features created by the + // ellipse + const std::set &aRefs = aBaseFeature->data()->refsToMe(); std::list aRefsToParent; - for (std::set::const_iterator aRef = aRefs.begin(); aRef != aRefs.end(); ++aRef) { + for (std::set::const_iterator aRef = aRefs.begin(); + aRef != aRefs.end(); ++aRef) { if ((*aRef)->id() == SketchPlugin_SketchEntity::PARENT_ID()) aRefsToParent.push_back(*aRef); } for (std::list::iterator aRef = aRefsToParent.begin(); aRef != aRefsToParent.end(); ++aRef) { - std::dynamic_pointer_cast(*aRef)->setValue(anNewFeature); + std::dynamic_pointer_cast(*aRef)->setValue( + anNewFeature); FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner()); - SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(), anNewFeature->name()); - SketchPlugin_Tools::replaceInName(anOwner->lastResult(), - aBaseFeature->name(), anNewFeature->name()); + SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(), + anNewFeature->name()); + SketchPlugin_Tools::replaceInName( + anOwner->lastResult(), aBaseFeature->name(), anNewFeature->name()); } } - const std::string& aStartAttrName = anNewFeature->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::START_ID() : SketchPlugin_EllipticArc::START_POINT_ID(); - const std::string& aEndAttrName = anNewFeature->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::END_ID() : SketchPlugin_EllipticArc::END_POINT_ID(); + const std::string &aStartAttrName = + anNewFeature->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::START_ID() + : SketchPlugin_EllipticArc::START_POINT_ID(); + const std::string &aEndAttrName = + anNewFeature->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::END_ID() + : SketchPlugin_EllipticArc::END_POINT_ID(); - thePoints.insert(std::dynamic_pointer_cast - (anNewFeature->attribute(aStartAttrName))); - thePoints.insert(std::dynamic_pointer_cast - (anNewFeature->attribute(aEndAttrName))); + thePoints.insert(std::dynamic_pointer_cast( + anNewFeature->attribute(aStartAttrName))); + thePoints.insert(std::dynamic_pointer_cast( + anNewFeature->attribute(aEndAttrName))); return anNewFeature; } -void SketchPlugin_Trim::arrangePointsOnLine(const AttributePoint2DPtr& theStartPointAttr, - const AttributePoint2DPtr& /*theEndPointAttr*/, - std::shared_ptr& theFirstPoint, - std::shared_ptr& theLastPoint) const -{ +void SketchPlugin_Trim::arrangePointsOnLine( + const AttributePoint2DPtr &theStartPointAttr, + const AttributePoint2DPtr & /*theEndPointAttr*/, + std::shared_ptr &theFirstPoint, + std::shared_ptr &theLastPoint) const { if (!theFirstPoint.get() || !theLastPoint.get()) return; @@ -1102,29 +1173,34 @@ void SketchPlugin_Trim::arrangePointsOnLine(const AttributePoint2DPtr& theStartP } } -void SketchPlugin_Trim::arrangePointsOnArc(const FeaturePtr& theArc, - const AttributePoint2DPtr& theStartPointAttr, - const AttributePoint2DPtr& /*theEndPointAttr*/, - std::shared_ptr& theFirstPoint, - std::shared_ptr& theSecondPoint) const -{ +void SketchPlugin_Trim::arrangePointsOnArc( + const FeaturePtr &theArc, const AttributePoint2DPtr &theStartPointAttr, + const AttributePoint2DPtr & /*theEndPointAttr*/, + std::shared_ptr &theFirstPoint, + std::shared_ptr &theSecondPoint) const { if (!theFirstPoint.get() || !theSecondPoint.get()) return; static const double anAngleTol = 1.e-12; - const std::string& aCenterAttrName = theArc->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::CENTER_ID() : SketchPlugin_EllipticArc::CENTER_ID(); - const std::string& aReversedAttrName = theArc->getKind() == SketchPlugin_Arc::ID() ? - SketchPlugin_Arc::REVERSED_ID() : SketchPlugin_EllipticArc::REVERSED_ID(); - - std::shared_ptr aCenter = std::dynamic_pointer_cast( - theArc->attribute(aCenterAttrName))->pnt(); + const std::string &aCenterAttrName = + theArc->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::CENTER_ID() + : SketchPlugin_EllipticArc::CENTER_ID(); + const std::string &aReversedAttrName = + theArc->getKind() == SketchPlugin_Arc::ID() + ? SketchPlugin_Arc::REVERSED_ID() + : SketchPlugin_EllipticArc::REVERSED_ID(); + + std::shared_ptr aCenter = + std::dynamic_pointer_cast( + theArc->attribute(aCenterAttrName)) + ->pnt(); bool isReversed = theArc->boolean(aReversedAttrName)->value(); // collect directions to each point - std::shared_ptr aStartDir( - new GeomAPI_Dir2d(theStartPointAttr->pnt()->xy()->decreased(aCenter->xy()))); + std::shared_ptr aStartDir(new GeomAPI_Dir2d( + theStartPointAttr->pnt()->xy()->decreased(aCenter->xy()))); std::shared_ptr aFirstPtDir( new GeomAPI_Dir2d(theFirstPoint->xy()->decreased(aCenter->xy()))); std::shared_ptr aSecondPtDir( @@ -1146,42 +1222,43 @@ void SketchPlugin_Trim::arrangePointsOnArc(const FeaturePtr& theArc, } } -void SketchPlugin_Trim::fillPointAttribute(const AttributePtr& theModifiedAttribute, - const std::shared_ptr& thePoint) -{ +void SketchPlugin_Trim::fillPointAttribute( + const AttributePtr &theModifiedAttribute, + const std::shared_ptr &thePoint) { std::string anAttributeType = theModifiedAttribute->attributeType(); if (anAttributeType == GeomDataAPI_Point2D::typeId()) { - AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast( - theModifiedAttribute); + AttributePoint2DPtr aModifiedAttribute = + std::dynamic_pointer_cast(theModifiedAttribute); aModifiedAttribute->setValue(thePoint); #ifdef DEBUG_TRIM - FeaturePtr aFeature = ModelAPI_Feature::feature(theModifiedAttribute->owner()); - std::cout << "data()->name() << ": " << - theModifiedAttribute->id() << - "]> => Pnt2d - [" << thePoint->x() << ", " << thePoint->y() << "]" << std::endl; + FeaturePtr aFeature = + ModelAPI_Feature::feature(theModifiedAttribute->owner()); + std::cout << "data()->name() << ": " + << theModifiedAttribute->id() << "]> => Pnt2d - [" + << thePoint->x() << ", " << thePoint->y() << "]" << std::endl; #endif } } -void SketchPlugin_Trim::fillAttribute(const AttributePtr& theModifiedAttribute, - const AttributePtr& theSourceAttribute) -{ +void SketchPlugin_Trim::fillAttribute(const AttributePtr &theModifiedAttribute, + const AttributePtr &theSourceAttribute) { std::string anAttributeType = theModifiedAttribute->attributeType(); if (anAttributeType == GeomDataAPI_Point2D::typeId()) { - AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast( - theModifiedAttribute); - AttributePoint2DPtr aSourceAttribute = std::dynamic_pointer_cast( - theSourceAttribute); + AttributePoint2DPtr aModifiedAttribute = + std::dynamic_pointer_cast(theModifiedAttribute); + AttributePoint2DPtr aSourceAttribute = + std::dynamic_pointer_cast(theSourceAttribute); if (aModifiedAttribute.get() && aSourceAttribute.get()) aModifiedAttribute->setValue(aSourceAttribute->pnt()); - } - else if (anAttributeType == ModelAPI_AttributeBoolean::typeId()) { - AttributeBooleanPtr aModifiedAttribute = std::dynamic_pointer_cast( - theModifiedAttribute); - AttributeBooleanPtr aSourceAttribute = std::dynamic_pointer_cast( - theSourceAttribute); + } else if (anAttributeType == ModelAPI_AttributeBoolean::typeId()) { + AttributeBooleanPtr aModifiedAttribute = + std::dynamic_pointer_cast( + theModifiedAttribute); + AttributeBooleanPtr aSourceAttribute = + std::dynamic_pointer_cast( + theSourceAttribute); if (aModifiedAttribute.get() && aSourceAttribute.get()) aModifiedAttribute->setValue(aSourceAttribute->value()); diff --git a/src/SketchPlugin/SketchPlugin_Trim.h b/src/SketchPlugin/SketchPlugin_Trim.h index cbe7a00ba..7a44f9230 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.h +++ b/src/SketchPlugin/SketchPlugin_Trim.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Trim_H_ @@ -32,53 +33,49 @@ class ModelAPI_Feature; class ModelAPI_Result; class ModelAPI_Object; -typedef std::pair > IdToPointPair; +typedef std::pair> + IdToPointPair; /** \class SketchPlugin_Trim * \ingroup Plugins - * \brief Feature for creation of a new constraint trimming object. Entities for split: + * \brief Feature for creation of a new constraint trimming object. Entities + * for split: */ -class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentable, - public ModelAPI_IReentrant -{ - public: +class SketchPlugin_Trim : public SketchPlugin_Feature, + public GeomAPI_IPresentable, + public ModelAPI_IReentrant { +public: /// Split constraint kind - inline static const std::string& ID() - { + inline static const std::string &ID() { static const std::string MY_TRIM_ID("SketchTrim"); return MY_TRIM_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - { + SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { static std::string MY_KIND = SketchPlugin_Trim::ID(); return MY_KIND; } /// The value parameter for the constraint - inline static const std::string& SELECTED_OBJECT() - { + inline static const std::string &SELECTED_OBJECT() { static const std::string MY_SELECTED_OBJECT("SelectedObject"); return MY_SELECTED_OBJECT; } /// Start 2D point of the split segment - inline static const std::string& SELECTED_POINT() - { + inline static const std::string &SELECTED_POINT() { static const std::string MY_SELECTED_POINT("SelectedPoint"); return MY_SELECTED_POINT; } /// The value parameter for the preview object - inline static const std::string& PREVIEW_OBJECT() - { + inline static const std::string &PREVIEW_OBJECT() { static const std::string MY_PREVIEW_OBJECT("PreviewObject"); return MY_PREVIEW_OBJECT; } /// Start 2D point of the split segment - inline static const std::string& PREVIEW_POINT() - { + inline static const std::string &PREVIEW_POINT() { static const std::string MY_PREVIEW_POINT("PreviewPoint"); return MY_PREVIEW_POINT; } @@ -86,7 +83,8 @@ class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentab /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// \brief Request for initialization of data model of the feature: adding all attributes + /// \brief Request for initialization of data model of the feature: adding all + /// attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Reimplemented from ModelAPI_Feature::isMacro() @@ -101,120 +99,140 @@ class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentab SketchPlugin_Trim(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr + getAISObject(AISObjectPtr thePrevious); - /// Apply information of the message to current object. It fills selected point and object - virtual std::string processEvent(const std::shared_ptr& theMessage); + /// Apply information of the message to current object. It fills selected + /// point and object + virtual std::string + processEvent(const std::shared_ptr &theMessage); private: - bool setCoincidenceToAttribute(const AttributePtr& theAttribute, - const std::set >& theFurtherCoincidences, - std::set>& theFeaturesToDelete); - /// Move tangency constraint to the feature if it is geometrically closely to it - /// \param theAttribute an attribute of a tangent constraint feature - /// \param theFeature a feature that can be set into the attribute - bool moveTangency(const AttributePtr& theAttribute, const FeaturePtr& theFeature); - - /// Obtains those constraints of the feature that should be modified. output maps contain - /// point of coincidence and attribute id to be modified after split - /// \param theFeaturesToDelete [out] constrains that will be deleted after split - /// \param theFeaturesToUpdate [out] constrains that will be updated after split - void getConstraints(std::set>& theFeaturesToDelete, - std::set& theFeaturesToUpdate); - - /// Remove references constraints from attribute of base feature refer to the given attribute - /// \param theAttribute an attribute - /// \param theModifiedAttributes modifiable container of attributes - void removeReferencesToAttribute(const AttributePtr& theAttribute, - std::map >& theBaseRefAttributes); + bool setCoincidenceToAttribute( + const AttributePtr &theAttribute, + const std::set> + &theFurtherCoincidences, + std::set> &theFeaturesToDelete); + /// Move tangency constraint to the feature if it is geometrically closely to + /// it \param theAttribute an attribute of a tangent constraint feature \param + /// theFeature a feature that can be set into the attribute + bool moveTangency(const AttributePtr &theAttribute, + const FeaturePtr &theFeature); + + /// Obtains those constraints of the feature that should be modified. output + /// maps contain point of coincidence and attribute id to be modified after + /// split \param theFeaturesToDelete [out] constrains that will be deleted + /// after split \param theFeaturesToUpdate [out] constrains that will be + /// updated after split + void getConstraints( + std::set> &theFeaturesToDelete, + std::set &theFeaturesToUpdate); + + /// Remove references constraints from attribute of base feature refer to the + /// given attribute \param theAttribute an attribute \param + /// theModifiedAttributes modifiable container of attributes + void removeReferencesToAttribute( + const AttributePtr &theAttribute, + std::map> &theBaseRefAttributes); /// Make the base object is splitted by the point attributes - /// \param theBaseRefAttributes container of references to the attributes of base feature - /// \param thePoints a list of points where coincidences will be build - /// \param theModifiedAttributes a container of attribute on base + /// \param theBaseRefAttributes container of references to the attributes of + /// base feature \param thePoints a list of points where coincidences will be + /// build \param theModifiedAttributes a container of attribute on base /// feature to attribute on new feature /// \return new line if it was created - FeaturePtr trimLine(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::map >& theBaseRefAttributes, - std::set >& thePoints, - std::set>& theModifiedAttributes); + FeaturePtr trimLine( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::map> &theBaseRefAttributes, + std::set> &thePoints, + std::set> &theModifiedAttributes); /// Make the base object is splitted by the point attributes /// \param thePoints a list of points where coincidences will be build /// \return new line if it was created - FeaturePtr trimArc(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::map >& theBaseRefAttributes, - std::set >& thePoints, - std::set>& theModifiedAttributes); + FeaturePtr trimArc( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::map> &theBaseRefAttributes, + std::set> &thePoints, + std::set> &theModifiedAttributes); /// Make the base object is splitted by the point attributes /// \param thePoints a list of points where coincidences will be build /// \return new elliptic arc if it was created - FeaturePtr trimEllipticArc(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::map >& theBaseRefAttributes, - std::set >& thePoints, - std::set>& theModifiedAttributes); + FeaturePtr trimEllipticArc( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::map> &theBaseRefAttributes, + std::set> &thePoints, + std::set> &theModifiedAttributes); /// Make the base object is splitted by the point attributes /// \param thePoints a list of points where coincidences will be build - FeaturePtr trimClosed(const std::shared_ptr& theStartShapePoint, - const std::shared_ptr& theLastShapePoint, - std::set >& thePoints, - std::set>& theModifiedAttributes); - - /// Correct the first and the second point to provide condition that the first is closer to - /// the start point and the second point - to the last end of current segment. To rearrange - /// them if this condition is not satisfied. + FeaturePtr trimClosed( + const std::shared_ptr &theStartShapePoint, + const std::shared_ptr &theLastShapePoint, + std::set> &thePoints, + std::set> &theModifiedAttributes); + + /// Correct the first and the second point to provide condition that the first + /// is closer to the start point and the second point - to the last end of + /// current segment. To rearrange them if this condition is not satisfied. /// \param theStartPointAttr a start point of a segment /// \param theEndPointAttr an end point of a segment /// \param theFirstPoint a start point of a segment /// \param theSecondPoint an end point of a segment - void arrangePointsOnLine(const std::shared_ptr& theStartPointAttr, - const std::shared_ptr& theEndPointAttr, - std::shared_ptr& theFirstPoint, - std::shared_ptr& theSecondPoint) const; - - /// Correct the first and the second point to provide condition that the first is closer to - /// the start point and the second point - to the last end of current segment. To rearrange - /// them if this condition is not satisfied. + void arrangePointsOnLine( + const std::shared_ptr &theStartPointAttr, + const std::shared_ptr &theEndPointAttr, + std::shared_ptr &theFirstPoint, + std::shared_ptr &theSecondPoint) const; + + /// Correct the first and the second point to provide condition that the first + /// is closer to the start point and the second point - to the last end of + /// current segment. To rearrange them if this condition is not satisfied. /// \param theArc an arc to be split /// \param theStartPointAttr a start point of a segment /// \param theEndPointAttr an end point of a segment /// \param theFirstPoint a start point of a segment /// \param theSecondPoint an end point of a segment - void arrangePointsOnArc(const FeaturePtr& theArc, - const std::shared_ptr& theStartPointAttr, - const std::shared_ptr& theEndPointAttr, - std::shared_ptr& theFirstPoint, - std::shared_ptr& theSecondPoint) const; - - /// Fill attribute by value of another attribute. It processes only Point 2D attributes. - /// \param theModifiedAttribute an attribute of GeomDataAPI_Point2D on feature to be modified - /// \param theSourceAttribute an attribute of GeomDataAPI_Point2D to obtain data - void fillAttribute(const AttributePtr& theModifiedAttribute, - const AttributePtr& theSourceAttribute); - - /// Fill attribute by value of another attribute. It processes only Point 2D attributes. - /// \param theModifiedAttribute an attribute of GeomDataAPI_Point2D on feature to be modified - /// \param thePoint a point value - void fillPointAttribute(const AttributePtr& theModifiedAttribute, - const std::shared_ptr& thePoint); + void arrangePointsOnArc( + const FeaturePtr &theArc, + const std::shared_ptr &theStartPointAttr, + const std::shared_ptr &theEndPointAttr, + std::shared_ptr &theFirstPoint, + std::shared_ptr &theSecondPoint) const; + + /// Fill attribute by value of another attribute. It processes only Point 2D + /// attributes. \param theModifiedAttribute an attribute of + /// GeomDataAPI_Point2D on feature to be modified \param theSourceAttribute an + /// attribute of GeomDataAPI_Point2D to obtain data + void fillAttribute(const AttributePtr &theModifiedAttribute, + const AttributePtr &theSourceAttribute); + + /// Fill attribute by value of another attribute. It processes only Point 2D + /// attributes. \param theModifiedAttribute an attribute of + /// GeomDataAPI_Point2D on feature to be modified \param thePoint a point + /// value + void fillPointAttribute(const AttributePtr &theModifiedAttribute, + const std::shared_ptr &thePoint); private: - void findShapePoints(const std::string& theObjectAttributeId, - const std::string& thePointAttributeId, - std::shared_ptr& aStartPoint, - std::shared_ptr& aLastPoint); + void findShapePoints(const std::string &theObjectAttributeId, + const std::string &thePointAttributeId, + std::shared_ptr &aStartPoint, + std::shared_ptr &aLastPoint); - std::shared_ptr convertPoint(const std::shared_ptr& thePoint); + std::shared_ptr + convertPoint(const std::shared_ptr &thePoint); private: - std::map, std::set > myCashedShapes; + std::map, std::set> + myCashedShapes; std::map, - GeomAlgoAPI_ShapeTools::PointToRefsMap> myObjectToPoints; + GeomAlgoAPI_ShapeTools::PointToRefsMap> + myObjectToPoints; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 4f5f9cba1..eaa1830b5 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchPlugin_Validators.h" @@ -28,10 +29,10 @@ #include "SketchPlugin_ConstraintDistance.h" #include "SketchPlugin_ConstraintRigid.h" #include "SketchPlugin_ConstraintTangent.h" +#include "SketchPlugin_CurveFitting.h" #include "SketchPlugin_Ellipse.h" #include "SketchPlugin_EllipticArc.h" #include "SketchPlugin_Fillet.h" -#include "SketchPlugin_CurveFitting.h" #include "SketchPlugin_Line.h" #include "SketchPlugin_MacroArc.h" #include "SketchPlugin_MacroCircle.h" @@ -39,8 +40,8 @@ #include "SketchPlugin_Offset.h" #include "SketchPlugin_Point.h" #include "SketchPlugin_Sketch.h" -#include "SketchPlugin_Trim.h" #include "SketchPlugin_Tools.h" +#include "SketchPlugin_Trim.h" #include "SketcherPrs_Tools.h" @@ -48,8 +49,6 @@ #include -#include -#include #include #include #include @@ -57,9 +56,11 @@ #include #include #include +#include +#include #include #include -#include +#include #include #include @@ -70,9 +71,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -82,35 +83,35 @@ #include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif const double tolerance = 1.e-7; -static bool isSpline(FeaturePtr theFeature) -{ - return theFeature && (theFeature->getKind() == SketchPlugin_BSpline::ID() || - theFeature->getKind() == SketchPlugin_BSplinePeriodic::ID()); +static bool isSpline(FeaturePtr theFeature) { + return theFeature && + (theFeature->getKind() == SketchPlugin_BSpline::ID() || + theFeature->getKind() == SketchPlugin_BSplinePeriodic::ID()); } - -bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_DistanceAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - // there is a check whether the feature contains a point and a linear edge or two point values + // there is a check whether the feature contains a point and a linear edge or + // two point values std::string aParamA = theArguments.front(); SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast - (theAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); bool isObject = aRefAttr->isObject(); if (!isObject) { // an attribute is a point. A point value is valid always for the distance @@ -119,13 +120,14 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut // 1. check whether the references object is a linear ObjectPtr anObject = aRefAttr->object(); - const ModelAPI_AttributeValidator* aShapeValidator = - dynamic_cast( - aFactory->validator("GeomValidators_ShapeType")); + const ModelAPI_AttributeValidator *aShapeValidator = + dynamic_cast( + aFactory->validator("GeomValidators_ShapeType")); std::list anArguments; anArguments.push_back("circle"); Events_InfoMessage aCircleError; - bool aShapeValid = aShapeValidator->isValid(aRefAttr, anArguments, aCircleError); + bool aShapeValid = + aShapeValidator->isValid(aRefAttr, anArguments, aCircleError); // the circle line is not a valid case if (aShapeValid) { theError = "Circle can not be used in distance constraint"; @@ -136,16 +138,20 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut anArguments.push_back("line"); Events_InfoMessage aLineError; aShapeValid = aShapeValidator->isValid(aRefAttr, anArguments, aLineError); - // if the attribute value is not a line, that means it is a vertex. A vertex is always valid + // if the attribute value is not a line, that means it is a vertex. A vertex + // is always valid if (aShapeValid) { - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); - // If it is a line then we have to check that first attribute id not a line + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); + // If it is a line then we have to check that first attribute id not a + // line std::shared_ptr aSFeature = - std::dynamic_pointer_cast(theAttribute->owner()); - SketchPlugin_Sketch* aSketch = aSFeature->sketch(); + std::dynamic_pointer_cast( + theAttribute->owner()); + SketchPlugin_Sketch *aSketch = aSFeature->sketch(); std::shared_ptr aPlane = SketchPlugin_Sketch::plane(aSketch); - std::shared_ptr aPoint = SketcherPrs_Tools::getFeaturePoint( - aFeature->data(), aParamA, aPlane); + std::shared_ptr aPoint = + SketcherPrs_Tools::getFeaturePoint(aFeature->data(), aParamA, aPlane); if (!aPoint.get()) { theError = "One of parameters of distance constraint should be a point"; return false; @@ -155,23 +161,24 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut return true; } -bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_TangentAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - // there is a check whether the feature contains a point and a linear edge or two point values + // there is a check whether the feature contains a point and a linear edge or + // two point values std::string aParamA = theArguments.front(); FeaturePtr anAttributeFeature = - std::dynamic_pointer_cast(theAttribute->owner()); + std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); bool isObject = aRefAttr->isObject(); ObjectPtr anObject = aRefAttr->object(); @@ -192,8 +199,7 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute aOtherFea->getKind() == SketchPlugin_Line::ID()) { theError = "Two segments cannot be tangent"; return false; - } - else if (isSpline(aRefFea) && isSpline(aOtherFea)) { + } else if (isSpline(aRefFea) && isSpline(aOtherFea)) { theError = "Two B-splines cannot be tangent"; return false; } @@ -205,52 +211,65 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute std::swap(aRefFea, aOtherFea); } if (hasSpline) { - auto isApplicableCoincidence = [](FeaturePtr theFeature, const std::string& theAttrName) { + auto isApplicableCoincidence = [](FeaturePtr theFeature, + const std::string &theAttrName) { AttributeRefAttrPtr aRefAttr = theFeature->refattr(theAttrName); if (aRefAttr->isObject()) return false; AttributePtr anAttr = aRefAttr->attr(); FeaturePtr anOwner = ModelAPI_Feature::feature(anAttr->owner()); - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast(anAttr); + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast(anAttr); if (aPointAttr) { return anOwner->getKind() == SketchPlugin_BSpline::ID() && - (aPointAttr->id() == SketchPlugin_BSpline::START_ID() || - aPointAttr->id() == SketchPlugin_BSpline::END_ID()); + (aPointAttr->id() == SketchPlugin_BSpline::START_ID() || + aPointAttr->id() == SketchPlugin_BSpline::END_ID()); } AttributePoint2DArrayPtr aPntArray = std::dynamic_pointer_cast(anAttr); if (aPntArray && anOwner->getKind() == SketchPlugin_BSpline::ID()) { // check index of the pole - AttributeIntegerPtr anIndex = theAttrName == SketchPlugin_Constraint::ENTITY_A() ? - theFeature->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()) : - theFeature->integer(SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); - return anIndex && (anIndex->value() == 0 || anIndex->value() == aPntArray->size() - 1); + AttributeIntegerPtr anIndex = + theAttrName == SketchPlugin_Constraint::ENTITY_A() + ? theFeature->integer( + SketchPlugin_ConstraintCoincidenceInternal:: + INDEX_ENTITY_A()) + : theFeature->integer( + SketchPlugin_ConstraintCoincidenceInternal:: + INDEX_ENTITY_B()); + return anIndex && (anIndex->value() == 0 || + anIndex->value() == aPntArray->size() - 1); } return false; }; isValid = false; - AttributePoint2DArrayPtr aBSplinePoles = std::dynamic_pointer_cast( - aRefFea->attribute(SketchPlugin_BSplineBase::POLES_ID())); - // additional check the B-spline edge and the other edge have a coincident boundary point - std::set aCoincidences = SketchPlugin_Tools::findCoincidentConstraints(aRefFea); + AttributePoint2DArrayPtr aBSplinePoles = + std::dynamic_pointer_cast( + aRefFea->attribute(SketchPlugin_BSplineBase::POLES_ID())); + // additional check the B-spline edge and the other edge have a coincident + // boundary point + std::set aCoincidences = + SketchPlugin_Tools::findCoincidentConstraints(aRefFea); for (std::set::iterator anIt = aCoincidences.begin(); anIt != aCoincidences.end() && !isValid; ++anIt) { std::set aCoinc; if (isApplicableCoincidence(*anIt, SketchPlugin_Constraint::ENTITY_A())) - SketchPlugin_Tools::findCoincidences(*anIt, SketchPlugin_Constraint::ENTITY_B(), - aCoinc, true); - else if (isApplicableCoincidence(*anIt, SketchPlugin_Constraint::ENTITY_B())) - SketchPlugin_Tools::findCoincidences(*anIt, SketchPlugin_Constraint::ENTITY_A(), - aCoinc, true); + SketchPlugin_Tools::findCoincidences( + *anIt, SketchPlugin_Constraint::ENTITY_B(), aCoinc, true); + else if (isApplicableCoincidence(*anIt, + SketchPlugin_Constraint::ENTITY_B())) + SketchPlugin_Tools::findCoincidences( + *anIt, SketchPlugin_Constraint::ENTITY_A(), aCoinc, true); std::set::iterator aFoundCoinc = aCoinc.find(aOtherFea); if (aFoundCoinc != aCoinc.end()) { // do not take into account internal constraints AttributeReferencePtr aParent = (*aFoundCoinc)->reference(SketchPlugin_SketchEntity::PARENT_ID()); - isValid = !aParent || !aParent->isInitialized() || aParent->value() != aRefFea; + isValid = !aParent || !aParent->isInitialized() || + aParent->value() != aRefFea; } } } @@ -258,10 +277,10 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute return isValid; } -bool SketchPlugin_PerpendicularAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_PerpendicularAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -270,7 +289,8 @@ bool SketchPlugin_PerpendicularAttrValidator::isValid(const AttributePtr& theAtt std::string aParamA = theArguments.front(); - FeaturePtr anOwner = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr anOwner = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); @@ -284,17 +304,15 @@ bool SketchPlugin_PerpendicularAttrValidator::isValid(const AttributePtr& theAtt FeaturePtr aOtherFea = ModelAPI_Feature::feature(aOtherObject); // at least one feature should be a line - if (aRefFea->getKind() != SketchPlugin_Line::ID() && - aOtherFea && aOtherFea->getKind() != SketchPlugin_Line::ID()) { + if (aRefFea->getKind() != SketchPlugin_Line::ID() && aOtherFea && + aOtherFea->getKind() != SketchPlugin_Line::ID()) { theError = "At least one feature should be a line"; return false; - } - else if (isSpline(aRefFea) || isSpline(aOtherFea)) { + } else if (isSpline(aRefFea) || isSpline(aOtherFea)) { theError = "B-spline is not supported"; return false; } - } - else { + } else { theError = "It uses an empty object"; return false; } @@ -302,10 +320,10 @@ bool SketchPlugin_PerpendicularAttrValidator::isValid(const AttributePtr& theAtt return true; } -bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_NotFixedValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -317,16 +335,19 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute, if (!aFeature) return true; - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); - SketchPlugin_Sketch* aSketch = aFeature->sketch(); + SketchPlugin_Sketch *aSketch = aFeature->sketch(); int aNbFeatures = aSketch->numberOfSubs(); for (int anInd = 0; anInd < aNbFeatures; anInd++) { FeaturePtr aSubFeature = aSketch->subFeature(anInd); - if (aSubFeature->getKind() != SketchPlugin_ConstraintRigid::ID() || aSubFeature == aFeature) + if (aSubFeature->getKind() != SketchPlugin_ConstraintRigid::ID() || + aSubFeature == aFeature) continue; - AttributeRefAttrPtr aRAttr = std::dynamic_pointer_cast( - aSubFeature->attribute(SketchPlugin_ConstraintRigid::ENTITY_A())); + AttributeRefAttrPtr aRAttr = + std::dynamic_pointer_cast( + aSubFeature->attribute(SketchPlugin_ConstraintRigid::ENTITY_A())); if (aRefAttr->isObject()) { if (aRefAttr->object() == aRAttr->object()) { ObjectPtr anObject = aRefAttr->object(); @@ -335,11 +356,11 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute, theError.arg(aName); return false; } - } - else if (aRefAttr->attr() == aRAttr->attr()) { + } else if (aRefAttr->attr() == aRAttr->attr()) { AttributePtr anAttribute = aRefAttr->attr(); - std::wstring aName = - anAttribute.get() ? Locale::Convert::toWString(anAttribute->id()) : L""; + std::wstring aName = anAttribute.get() + ? Locale::Convert::toWString(anAttribute->id()) + : L""; theError = "The attribute %1 has been already fixed."; theError.arg(aName); return false; @@ -348,10 +369,10 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute, return true; } -bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_EqualAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -359,9 +380,11 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, } std::string aParamA = theArguments.front(); - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttr[2]; - aRefAttr[0] = std::dynamic_pointer_cast(theAttribute); + aRefAttr[0] = + std::dynamic_pointer_cast(theAttribute); aRefAttr[1] = aFeature->data()->refattr(aParamA); if (!aRefAttr[0]->isObject() || !aRefAttr[1]->isObject()) { @@ -392,13 +415,17 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, bool isOk = aType[0] == aType[1]; if (!isOk) { // circle and arc may be equal - isOk = (aType[0] == SketchPlugin_Arc::ID() && aType[1] == SketchPlugin_Circle::ID()) - || (aType[0] == SketchPlugin_Circle::ID() && aType[1] == SketchPlugin_Arc::ID()); + isOk = (aType[0] == SketchPlugin_Arc::ID() && + aType[1] == SketchPlugin_Circle::ID()) || + (aType[0] == SketchPlugin_Circle::ID() && + aType[1] == SketchPlugin_Arc::ID()); } if (!isOk) { // ellipse and elliptic arc may be equal - isOk = (aType[0] == SketchPlugin_EllipticArc::ID() && aType[1] == SketchPlugin_Ellipse::ID()) - || (aType[0] == SketchPlugin_Ellipse::ID() && aType[1] == SketchPlugin_EllipticArc::ID()); + isOk = (aType[0] == SketchPlugin_EllipticArc::ID() && + aType[1] == SketchPlugin_Ellipse::ID()) || + (aType[0] == SketchPlugin_Ellipse::ID() && + aType[1] == SketchPlugin_EllipticArc::ID()); } if (!isOk) { theError = "Features with kinds %1 and %2 can not be equal."; @@ -408,30 +435,34 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, return true; } -bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_MirrorAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); - AttributeRefListPtr aSelAttr = std::dynamic_pointer_cast(theAttribute); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); + AttributeRefListPtr aSelAttr = + std::dynamic_pointer_cast(theAttribute); - AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_Constraint::ENTITY_C())); + AttributeRefListPtr aRefListOfMirrored = + std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Constraint::ENTITY_C())); std::list aMirroredObjects = aRefListOfMirrored->list(); - for(int anInd = 0; anInd < aSelAttr->size(); anInd++) { + for (int anInd = 0; anInd < aSelAttr->size(); anInd++) { ObjectPtr aSelObject = aSelAttr->object(anInd); // B-splines are not supported in Mirror yet FeaturePtr aSelFeature = ModelAPI_Feature::feature(aSelObject); - if (aSelFeature && (aSelFeature->getKind() == SketchPlugin_BSpline::ID() || - aSelFeature->getKind() == SketchPlugin_BSplinePeriodic::ID())) { + if (aSelFeature && + (aSelFeature->getKind() == SketchPlugin_BSpline::ID() || + aSelFeature->getKind() == SketchPlugin_BSplinePeriodic::ID())) { theError = "Not supported"; return false; } @@ -448,20 +479,22 @@ bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute, return true; } -bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_CoincidenceAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - // there is a check whether the feature contains a point and a linear edge or two point values + // there is a check whether the feature contains a point and a linear edge or + // two point values std::string aParamA = theArguments.front(); - FeaturePtr aConstraint = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aConstraint = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttrA = aConstraint->data()->refattr(aParamA); if (!aRefAttrA) { theError = "The %1 attribute should be %2"; @@ -470,7 +503,7 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri } AttributeRefAttrPtr aRefAttrB = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); // first attribute is a point, it may coincide with any object if (!aRefAttrA->isObject()) @@ -510,31 +543,33 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri return false; } - -bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_CopyValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefListPtr aSelAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); std::set aSelected; - AttributeRefListPtr aRefListOfInitial = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_Constraint::ENTITY_A())); - AttributeRefListPtr aRefListOfCopied = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_Constraint::ENTITY_B())); + AttributeRefListPtr aRefListOfInitial = + std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributeRefListPtr aRefListOfCopied = + std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_Constraint::ENTITY_B())); std::list anInitialObjects = aRefListOfInitial->list(); std::list aCopiedObjects = aRefListOfCopied->list(); std::list::iterator anObjIter; - for(int anInd = 0; anInd < aSelAttr->size(); anInd++) { + for (int anInd = 0; anInd < aSelAttr->size(); anInd++) { ObjectPtr aSelObject = aSelAttr->object(anInd); if (aSelected.find(aSelObject) != aSelected.end()) { theError = "Error: An object selected twice"; @@ -551,9 +586,9 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, // B-splines are not supported in Copying features FeaturePtr aSelFeature = ModelAPI_Feature::feature(aSelObject); - if (aFeature->getKind() != SketchPlugin_Offset::ID() && - aSelFeature && (aSelFeature->getKind() == SketchPlugin_BSpline::ID() || - aSelFeature->getKind() == SketchPlugin_BSplinePeriodic::ID())) { + if (aFeature->getKind() != SketchPlugin_Offset::ID() && aSelFeature && + (aSelFeature->getKind() == SketchPlugin_BSpline::ID() || + aSelFeature->getKind() == SketchPlugin_BSplinePeriodic::ID())) { theError = "Not supported"; return false; } @@ -563,18 +598,21 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, bool isFound = aSelObject == *anObjIter; if (!isFound) { // check in the results of the feature - FeaturePtr aCurFeature = std::dynamic_pointer_cast(*anObjIter); + FeaturePtr aCurFeature = + std::dynamic_pointer_cast(*anObjIter); if (aCurFeature) { - const std::list& aResults = aCurFeature->results(); + const std::list &aResults = aCurFeature->results(); for (std::list::const_iterator aResIt = aResults.begin(); - aResIt != aResults.end() && !isFound; ++aResIt) { + aResIt != aResults.end() && !isFound; ++aResIt) { isFound = aSelObject == *aResIt; } } } if (isFound) { std::string aName = - aSelObject.get() ? Locale::Convert::toString(aSelObject->data()->name()) : ""; + aSelObject.get() + ? Locale::Convert::toString(aSelObject->data()->name()) + : ""; theError = "The object %1 is a result of copy"; theError.arg(aName); return false; @@ -585,11 +623,11 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, } bool SketchPlugin_SolverErrorValidator::isValid( - const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ - AttributeStringPtr aAttributeString = theFeature->string(SketchPlugin_Sketch::SOLVER_ERROR()); + const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { + AttributeStringPtr aAttributeString = + theFeature->string(SketchPlugin_Sketch::SOLVER_ERROR()); if (!aAttributeString->value().empty()) { theError = aAttributeString->value(); @@ -599,45 +637,48 @@ bool SketchPlugin_SolverErrorValidator::isValid( return true; } -bool SketchPlugin_SolverErrorValidator::isNotObligatory(std::string theFeature, - std::string theAttribute) -{ +bool SketchPlugin_SolverErrorValidator::isNotObligatory( + std::string theFeature, std::string theAttribute) { return true; } -static bool hasSameTangentFeature(const std::set& theRefsList, - const FeaturePtr theFeature) -{ - for(std::set::const_iterator - anIt = theRefsList.cbegin(); anIt != theRefsList.cend(); ++anIt) { +static bool hasSameTangentFeature(const std::set &theRefsList, + const FeaturePtr theFeature) { + for (std::set::const_iterator anIt = theRefsList.cbegin(); + anIt != theRefsList.cend(); ++anIt) { std::shared_ptr aAttr = (*anIt); - FeaturePtr aFeature = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aAttr->owner()); if (!aFeature) continue; if (aFeature->getKind() == SketchPlugin_ConstraintTangent::ID()) { - AttributeRefAttrPtr anAttrRefA = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_ConstraintTangent::ENTITY_A())); - AttributeRefAttrPtr anAttrRefB = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_ConstraintTangent::ENTITY_B())); - if(anAttrRefA.get()) { - ResultPtr aResA = std::dynamic_pointer_cast(anAttrRefA->object()); - if(aResA.get()) { + AttributeRefAttrPtr anAttrRefA = + std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_ConstraintTangent::ENTITY_A())); + AttributeRefAttrPtr anAttrRefB = + std::dynamic_pointer_cast( + aFeature->attribute(SketchPlugin_ConstraintTangent::ENTITY_B())); + if (anAttrRefA.get()) { + ResultPtr aResA = + std::dynamic_pointer_cast(anAttrRefA->object()); + if (aResA.get()) { DocumentPtr aDoc = aResA->document(); - if(aDoc.get()) { + if (aDoc.get()) { FeaturePtr aFeatureA = aDoc->feature(aResA); - if(aFeatureA.get() && aFeatureA == theFeature) { + if (aFeatureA.get() && aFeatureA == theFeature) { return true; } } } } - if(anAttrRefB.get()) { - ResultPtr aResB = std::dynamic_pointer_cast(anAttrRefB->object()); - if(aResB.get()) { + if (anAttrRefB.get()) { + ResultPtr aResB = + std::dynamic_pointer_cast(anAttrRefB->object()); + if (aResB.get()) { DocumentPtr aDoc = aResB->document(); - if(aDoc.get()) { + if (aDoc.get()) { FeaturePtr aFeatureB = aDoc->feature(aResB); - if(aFeatureB.get() && aFeatureB == theFeature) { + if (aFeatureB.get() && aFeatureB == theFeature) { return true; } } @@ -648,40 +689,37 @@ static bool hasSameTangentFeature(const std::set& theRefsList, return false; } -static bool isPointPointCoincidence(const FeaturePtr& theCoincidence) -{ +static bool isPointPointCoincidence(const FeaturePtr &theCoincidence) { AttributeRefAttrPtr aRefAttr[2] = { theCoincidence->refattr(SketchPlugin_Constraint::ENTITY_A()), - theCoincidence->refattr(SketchPlugin_Constraint::ENTITY_B()) - }; + theCoincidence->refattr(SketchPlugin_Constraint::ENTITY_B())}; bool arePoints = true; for (int i = 0; i < 2 && arePoints; ++i) { if (aRefAttr[i]->isObject()) { FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr[i]->object()); - arePoints = aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID(); + arePoints = + aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID(); } else arePoints = aRefAttr[i]->attr().get() != NULL; } return arePoints; } -bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_FilletVertexValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr anEdge1, anEdge2; return isValidVertex(theAttribute, theError, anEdge1, anEdge2); } -bool SketchPlugin_FilletVertexValidator::isValidVertex(const AttributePtr& theAttribute, - Events_InfoMessage& theError, - FeaturePtr& theEdge1, - FeaturePtr& theEdge2) -{ +bool SketchPlugin_FilletVertexValidator::isValidVertex( + const AttributePtr &theAttribute, Events_InfoMessage &theError, + FeaturePtr &theEdge1, FeaturePtr &theEdge2) { AttributeRefAttrPtr aPointRefAttr = - std::dynamic_pointer_cast(theAttribute); - if(!aPointRefAttr.get()) { + std::dynamic_pointer_cast(theAttribute); + if (!aPointRefAttr.get()) { theError = "Error: Point not selected."; return false; } @@ -692,73 +730,79 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex(const AttributePtr& theAt return false; } std::shared_ptr aSelectedPnt = - std::dynamic_pointer_cast(aPointAttribute)->pnt(); + std::dynamic_pointer_cast(aPointAttribute)->pnt(); // Obtain constraint coincidence for the fillet point. - const std::set& aRefsList = aPointAttribute->owner()->data()->refsToMe(); + const std::set &aRefsList = + aPointAttribute->owner()->data()->refsToMe(); FeaturePtr aConstraintCoincidence; - for(std::set::const_iterator anIt = aRefsList.cbegin(); - anIt != aRefsList.cend(); ++anIt) { + for (std::set::const_iterator anIt = aRefsList.cbegin(); + anIt != aRefsList.cend(); ++anIt) { std::shared_ptr aAttr = (*anIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); + FeaturePtr aConstrFeature = + std::dynamic_pointer_cast(aAttr->owner()); if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { if (!isPointPointCoincidence(aConstrFeature)) continue; - AttributeRefAttrPtr anAttrRefA = std::dynamic_pointer_cast( - aConstrFeature->attribute(SketchPlugin_ConstraintCoincidence::ENTITY_A())); - AttributeRefAttrPtr anAttrRefB = std::dynamic_pointer_cast( - aConstrFeature->attribute(SketchPlugin_ConstraintCoincidence::ENTITY_B())); + AttributeRefAttrPtr anAttrRefA = + std::dynamic_pointer_cast( + aConstrFeature->attribute( + SketchPlugin_ConstraintCoincidence::ENTITY_A())); + AttributeRefAttrPtr anAttrRefB = + std::dynamic_pointer_cast( + aConstrFeature->attribute( + SketchPlugin_ConstraintCoincidence::ENTITY_B())); AttributePtr anAttrA = anAttrRefA->attr(); - if(aPointAttribute == anAttrA) { + if (aPointAttribute == anAttrA) { aConstraintCoincidence = aConstrFeature; break; } AttributePtr anAttrB = anAttrRefB->attr(); - if(aPointAttribute == anAttrB) { + if (aPointAttribute == anAttrB) { aConstraintCoincidence = aConstrFeature; break; } } } - if(!aConstraintCoincidence.get()) { + if (!aConstraintCoincidence.get()) { theError = "Error: one of the selected point does not have coincidence."; return false; } // Get coincides from constraint. std::set aCoinsides; - SketchPlugin_Tools::findCoincidences(aConstraintCoincidence, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), - aCoinsides, - true); - SketchPlugin_Tools::findCoincidences(aConstraintCoincidence, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), - aCoinsides, - true); + SketchPlugin_Tools::findCoincidences( + aConstraintCoincidence, SketchPlugin_ConstraintCoincidence::ENTITY_A(), + aCoinsides, true); + SketchPlugin_Tools::findCoincidences( + aConstraintCoincidence, SketchPlugin_ConstraintCoincidence::ENTITY_B(), + aCoinsides, true); // Remove points and external lines from set of coincides. std::set aNewSetOfCoincides; - for(std::set::iterator anIt = aCoinsides.begin(); - anIt != aCoinsides.end(); ++anIt) { + for (std::set::iterator anIt = aCoinsides.begin(); + anIt != aCoinsides.end(); ++anIt) { std::shared_ptr aSketchEntity = - std::dynamic_pointer_cast(*anIt); - if(aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) { + std::dynamic_pointer_cast(*anIt); + if (aSketchEntity.get() && + (aSketchEntity->isCopy() || aSketchEntity->isExternal())) { continue; } - if((*anIt)->getKind() != SketchPlugin_Line::ID() && + if ((*anIt)->getKind() != SketchPlugin_Line::ID() && (*anIt)->getKind() != SketchPlugin_Arc::ID()) { - continue; + continue; } - if((*anIt)->getKind() == SketchPlugin_Arc::ID()) { - AttributePtr anArcCenter = (*anIt)->attribute(SketchPlugin_Arc::CENTER_ID()); + if ((*anIt)->getKind() == SketchPlugin_Arc::ID()) { + AttributePtr anArcCenter = + (*anIt)->attribute(SketchPlugin_Arc::CENTER_ID()); std::shared_ptr anArcCenterPnt = - std::dynamic_pointer_cast(anArcCenter)->pnt(); + std::dynamic_pointer_cast(anArcCenter)->pnt(); double aDistSelectedArcCenter = aSelectedPnt->distance(anArcCenterPnt); - if(aDistSelectedArcCenter < tolerance) { + if (aDistSelectedArcCenter < tolerance) { continue; } } @@ -766,20 +810,24 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex(const AttributePtr& theAt } aCoinsides = aNewSetOfCoincides; - // If we still have more than two coincides remove auxilary entities from set of coincides. - if(aCoinsides.size() > 2) { + // If we still have more than two coincides remove auxilary entities from set + // of coincides. + if (aCoinsides.size() > 2) { aNewSetOfCoincides.clear(); - for(std::set::iterator anIt = aCoinsides.begin(); - anIt != aCoinsides.end(); ++anIt) { - if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) { + for (std::set::iterator anIt = aCoinsides.begin(); + anIt != aCoinsides.end(); ++anIt) { + if (!(*anIt) + ->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()) { aNewSetOfCoincides.insert(*anIt); } } aCoinsides = aNewSetOfCoincides; } - if(aCoinsides.size() != 2) { - theError = "Error: One of the selected points does not have two suitable edges for fillet."; + if (aCoinsides.size() != 2) { + theError = "Error: One of the selected points does not have two suitable " + "edges for fillet."; return false; } @@ -792,34 +840,39 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex(const AttributePtr& theAt std::set::iterator anIt = aCoinsides.begin(); FeaturePtr aFirstFeature = *anIt++; FeaturePtr aSecondFeature = *anIt; - const std::set& aFirstFeatureRefsList = aFirstFeature->data()->refsToMe(); - if(hasSameTangentFeature(aFirstFeatureRefsList, aSecondFeature)) { + const std::set &aFirstFeatureRefsList = + aFirstFeature->data()->refsToMe(); + if (hasSameTangentFeature(aFirstFeatureRefsList, aSecondFeature)) { theError = "Error: Edges in selected point has tangent constraint."; return false; } std::list aFirstResults = aFirstFeature->results(); - for(std::list::iterator aResIt = aFirstResults.begin(); - aResIt != aFirstResults.end(); ++aResIt) { + for (std::list::iterator aResIt = aFirstResults.begin(); + aResIt != aFirstResults.end(); ++aResIt) { ResultPtr aRes = *aResIt; - const std::set& aResRefsList = aRes->data()->refsToMe(); - if(hasSameTangentFeature(aResRefsList, aSecondFeature)) { + const std::set &aResRefsList = aRes->data()->refsToMe(); + if (hasSameTangentFeature(aResRefsList, aSecondFeature)) { theError = "Error: Edges in selected point has tangent constraint."; return false; } } // Check the features are not tangent - std::shared_ptr aFirstShape = aFirstFeature->lastResult()->shape(); - std::shared_ptr aSecondShape = aSecondFeature->lastResult()->shape(); - if (!aFirstShape || !aFirstShape->isEdge() || - !aSecondShape || !aSecondShape->isEdge()) { + std::shared_ptr aFirstShape = + aFirstFeature->lastResult()->shape(); + std::shared_ptr aSecondShape = + aSecondFeature->lastResult()->shape(); + if (!aFirstShape || !aFirstShape->isEdge() || !aSecondShape || + !aSecondShape->isEdge()) { theError = "Error: At least on of the features is not an edge"; return false; } - std::shared_ptr anEdge1 = std::dynamic_pointer_cast(aFirstShape); - std::shared_ptr anEdge2 = std::dynamic_pointer_cast(aSecondShape); + std::shared_ptr anEdge1 = + std::dynamic_pointer_cast(aFirstShape); + std::shared_ptr anEdge2 = + std::dynamic_pointer_cast(aSecondShape); static const double TOL = 1.e-7; if (anEdge1->isLine() && anEdge2->isLine()) { @@ -858,23 +911,26 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex(const AttributePtr& theAt return true; } -bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_MiddlePointAttrValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - // there is a check whether the feature contains a point and a linear edge or two point values + // there is a check whether the feature contains a point and a linear edge or + // two point values std::string aParamA = theArguments.front(); FeaturePtr anAttributeFeature = - std::dynamic_pointer_cast(theAttribute->owner()); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); - AttributeRefAttrPtr anOtherAttr = anAttributeFeature->data()->refattr(aParamA); + std::dynamic_pointer_cast(theAttribute->owner()); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); + AttributeRefAttrPtr anOtherAttr = + anAttributeFeature->data()->refattr(aParamA); AttributeRefAttrPtr aRefAttrs[2] = {aRefAttr, anOtherAttr}; int aNbPoints = 0; @@ -887,7 +943,8 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttri if (!aFeature) { if (aNbPoints + aNbLines != 0) return true; - else continue; + else + continue; } if (aFeature->getKind() == SketchPlugin_Point::ID()) @@ -906,21 +963,25 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttri return true; } -bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_ArcTangentPointValidator::isValid( + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - FeaturePtr anOwner = std::dynamic_pointer_cast(theAttribute->owner()); - AttributeStringPtr anArcTypeAttr = anOwner->string(SketchPlugin_MacroArc::ARC_TYPE()); - if (anArcTypeAttr && anArcTypeAttr->value() != SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE()) + FeaturePtr anOwner = + std::dynamic_pointer_cast(theAttribute->owner()); + AttributeStringPtr anArcTypeAttr = + anOwner->string(SketchPlugin_MacroArc::ARC_TYPE()); + if (anArcTypeAttr && anArcTypeAttr->value() != + SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE()) return true; // not applicable for non-tangent arcs - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); AttributePtr anAttr = aRefAttr->attr(); if (!anAttr) { theError = "The attribute %1 should be a point"; @@ -928,27 +989,28 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri return false; } - FeaturePtr anAttrFeature = std::dynamic_pointer_cast(anAttr->owner()); - const std::string& aFeatureType = anAttrFeature->getKind(); + FeaturePtr anAttrFeature = + std::dynamic_pointer_cast(anAttr->owner()); + const std::string &aFeatureType = anAttrFeature->getKind(); if (aFeatureType == SketchPlugin_Arc::ID()) { // selected point should not be a center of arc - const std::string& aPntId = anAttr->id(); - if (aPntId != SketchPlugin_Arc::START_ID() && aPntId != SketchPlugin_Arc::END_ID()) { + const std::string &aPntId = anAttr->id(); + if (aPntId != SketchPlugin_Arc::START_ID() && + aPntId != SketchPlugin_Arc::END_ID()) { theError = "The attribute %1 is not supported"; theError.arg(aPntId); return false; } - } - else if (aFeatureType == SketchPlugin_Line::ID()) { + } else if (aFeatureType == SketchPlugin_Line::ID()) { // selected point should be bound point of line - const std::string& aPntId = anAttr->id(); - if (aPntId != SketchPlugin_Line::START_ID() && aPntId != SketchPlugin_Line::END_ID()) { + const std::string &aPntId = anAttr->id(); + if (aPntId != SketchPlugin_Line::START_ID() && + aPntId != SketchPlugin_Line::END_ID()) { theError = "The attribute %1 is not supported"; theError.arg(aPntId); return false; } - } - else { + } else { theError = "Unable to build tangent arc on %1"; theError.arg(anAttrFeature->getKind()); return false; @@ -958,22 +1020,25 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri } bool SketchPlugin_ArcTransversalPointValidator::isValid( - const AttributePtr& theAttribute, - const std::list& /*theArguments*/, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list & /*theArguments*/, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; } - FeaturePtr anOwner = std::dynamic_pointer_cast(theAttribute->owner()); - AttributeStringPtr anArcTypeAttr = anOwner->string(SketchPlugin_MacroArc::ARC_TYPE()); + FeaturePtr anOwner = + std::dynamic_pointer_cast(theAttribute->owner()); + AttributeStringPtr anArcTypeAttr = + anOwner->string(SketchPlugin_MacroArc::ARC_TYPE()); if (anArcTypeAttr && - anArcTypeAttr->value() != SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE()) + anArcTypeAttr->value() != + SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE()) return true; // not applicable for non-transversal arcs - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); AttributePtr anAttr = aRefAttr->attr(); if (!anAttr) { theError = "The attribute %1 should be a point"; @@ -981,18 +1046,19 @@ bool SketchPlugin_ArcTransversalPointValidator::isValid( return false; } - FeaturePtr anAttrFeature = std::dynamic_pointer_cast(anAttr->owner()); - const std::string& aFeatureType = anAttrFeature->getKind(); + FeaturePtr anAttrFeature = + std::dynamic_pointer_cast(anAttr->owner()); + const std::string &aFeatureType = anAttrFeature->getKind(); if (aFeatureType == SketchPlugin_Line::ID()) { // selected point should be bound point of line - const std::string& aPntId = anAttr->id(); - if (aPntId != SketchPlugin_Line::START_ID() && aPntId != SketchPlugin_Line::END_ID()) { + const std::string &aPntId = anAttr->id(); + if (aPntId != SketchPlugin_Line::START_ID() && + aPntId != SketchPlugin_Line::END_ID()) { theError = "The attribute %1 is not supported"; theError.arg(aPntId); return false; } - } - else { + } else { theError = "Unable to build perpendicular arc on %1"; theError.arg(anAttrFeature->getKind()); return false; @@ -1001,10 +1067,10 @@ bool SketchPlugin_ArcTransversalPointValidator::isValid( return true; } -bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_IntersectionValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -1013,11 +1079,14 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut AttributeSelectionPtr anExternalAttr = std::dynamic_pointer_cast(theAttribute); std::shared_ptr anEdge; - if (anExternalAttr && anExternalAttr->value() && anExternalAttr->value()->isEdge()) { - anEdge = std::shared_ptr(new GeomAPI_Edge(anExternalAttr->value())); - } else if(anExternalAttr->context() && anExternalAttr->context()->shape() && - anExternalAttr->context()->shape()->isEdge()) { - anEdge = std::shared_ptr(new GeomAPI_Edge(anExternalAttr->context()->shape())); + if (anExternalAttr && anExternalAttr->value() && + anExternalAttr->value()->isEdge()) { + anEdge = std::shared_ptr( + new GeomAPI_Edge(anExternalAttr->value())); + } else if (anExternalAttr->context() && anExternalAttr->context()->shape() && + anExternalAttr->context()->shape()->isEdge()) { + anEdge = std::shared_ptr( + new GeomAPI_Edge(anExternalAttr->context()->shape())); } if (!anEdge) { @@ -1055,10 +1124,10 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut return true; } -bool SketchPlugin_SplitValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_SplitValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { bool aValid = false; if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { @@ -1067,14 +1136,16 @@ bool SketchPlugin_SplitValidator::isValid(const AttributePtr& theAttribute, return aValid; } AttributeReferencePtr aFeatureAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); std::shared_ptr aSplitFeature = - std::dynamic_pointer_cast(theAttribute->owner()); + std::dynamic_pointer_cast(theAttribute->owner()); ObjectPtr anAttrObject = aFeatureAttr->value(); if (!anAttrObject) { - AttributePtr aPreviewAttr = aSplitFeature->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()); - aFeatureAttr = std::dynamic_pointer_cast(aPreviewAttr); + AttributePtr aPreviewAttr = + aSplitFeature->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()); + aFeatureAttr = + std::dynamic_pointer_cast(aPreviewAttr); anAttrObject = aFeatureAttr->value(); } @@ -1090,39 +1161,46 @@ bool SketchPlugin_SplitValidator::isValid(const AttributePtr& theAttribute, } std::set anEdgeShapes; - ModelGeomAlgo_Shape::shapesOfType(anAttrFeature, GeomAPI_Shape::EDGE, anEdgeShapes); - if (anEdgeShapes.empty() || anEdgeShapes.size() > 1 /*there case has not existed yet*/) + ModelGeomAlgo_Shape::shapesOfType(anAttrFeature, GeomAPI_Shape::EDGE, + anEdgeShapes); + if (anEdgeShapes.empty() || + anEdgeShapes.size() > 1 /*there case has not existed yet*/) return aValid; // coincidences to the feature - std::set > aRefAttributes; - ModelGeomAlgo_Point2D::getPointsOfReference(anAttrFeature, - SketchPlugin_ConstraintCoincidence::ID(), - aRefAttributes, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); + std::set> aRefAttributes; + ModelGeomAlgo_Point2D::getPointsOfReference( + anAttrFeature, SketchPlugin_ConstraintCoincidence::ID(), aRefAttributes, + SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); GeomShapePtr anAttrShape = (*anEdgeShapes.begin())->shape(); std::shared_ptr aSFeature = - std::dynamic_pointer_cast(anAttrFeature); + std::dynamic_pointer_cast(anAttrFeature); if (!aSFeature || aSFeature->isCopy()) return false; - SketchPlugin_Sketch* aSketch = aSFeature->sketch(); + SketchPlugin_Sketch *aSketch = aSFeature->sketch(); std::shared_ptr aData = aSketch->data(); - std::shared_ptr aC = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); - std::shared_ptr aX = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::DIRX_ID())); - std::shared_ptr aNorm = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aDirY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); + std::shared_ptr aC = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); + std::shared_ptr aX = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::DIRX_ID())); + std::shared_ptr aNorm = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aDirY( + new GeomAPI_Dir(aNorm->dir()->cross(aX->dir()))); typedef std::map, - std::pair >, - std::list > > > PointToRefsMap; + std::pair>, + std::list>>> + PointToRefsMap; PointToRefsMap aPointsInfo; - ModelGeomAlgo_Point2D::getPointsInsideShape(anAttrShape, aRefAttributes, aC->pnt(), - aX->dir(), aDirY, aPointsInfo); + ModelGeomAlgo_Point2D::getPointsInsideShape( + anAttrShape, aRefAttributes, aC->pnt(), aX->dir(), aDirY, aPointsInfo); int aCoincidentToFeature = (int)aPointsInfo.size(); if (anAttrFeature->getKind() == SketchPlugin_Circle::ID() || anAttrFeature->getKind() == SketchPlugin_Ellipse::ID()) @@ -1133,10 +1211,10 @@ bool SketchPlugin_SplitValidator::isValid(const AttributePtr& theAttribute, return aValid; } -bool SketchPlugin_TrimValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_TrimValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { bool aValid = false; if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { @@ -1145,15 +1223,17 @@ bool SketchPlugin_TrimValidator::isValid(const AttributePtr& theAttribute, return aValid; } AttributeReferencePtr aBaseObjectAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); std::shared_ptr aTrimFeature = - std::dynamic_pointer_cast(theAttribute->owner()); + std::dynamic_pointer_cast(theAttribute->owner()); ObjectPtr aBaseObject = aBaseObjectAttr->value(); if (!aBaseObject) { - AttributePtr aPreviewAttr = aTrimFeature->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()); - aBaseObjectAttr = std::dynamic_pointer_cast(aPreviewAttr); + AttributePtr aPreviewAttr = + aTrimFeature->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()); + aBaseObjectAttr = + std::dynamic_pointer_cast(aPreviewAttr); aBaseObject = aBaseObjectAttr->value(); } @@ -1162,7 +1242,7 @@ bool SketchPlugin_TrimValidator::isValid(const AttributePtr& theAttribute, return aValid; std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aBaseFeature); + std::dynamic_pointer_cast(aBaseFeature); if (!aSketchFeature.get() || aSketchFeature->isCopy()) return aValid; @@ -1175,29 +1255,31 @@ bool SketchPlugin_TrimValidator::isValid(const AttributePtr& theAttribute, // point on feature AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( - aTrimFeature->data()->attribute(SketchPlugin_Trim::PREVIEW_POINT())); + aTrimFeature->data()->attribute(SketchPlugin_Trim::PREVIEW_POINT())); - SketchPlugin_Sketch* aSketch = aTrimFeature->sketch(); + SketchPlugin_Sketch *aSketch = aTrimFeature->sketch(); std::shared_ptr anAttributePnt2d = aPoint->pnt(); - std::shared_ptr anAttributePnt = aSketch->to3D(anAttributePnt2d->x(), - anAttributePnt2d->y()); - - std::map > aCashedShapes; - std::map, - std::pair >, - std::list > > > > anObjectToPoints; + std::shared_ptr anAttributePnt = + aSketch->to3D(anAttributePnt2d->x(), anAttributePnt2d->y()); + + std::map> aCashedShapes; + std::map, + std::pair>, + std::list>>>> + anObjectToPoints; SketchPlugin_SegmentationTools::fillObjectShapes( aTrimFeature.get(), aBaseObject, aCashedShapes, anObjectToPoints); - const std::set& aShapes = aCashedShapes[aBaseObject]; + const std::set &aShapes = aCashedShapes[aBaseObject]; return aShapes.size() > 1; } -bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_ProjectionValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -1216,17 +1298,18 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, aVertex = std::shared_ptr(new GeomAPI_Vertex(aVal)); else if (aVal && aVal->isEdge()) { anEdge = std::shared_ptr(new GeomAPI_Edge(aVal)); - } else if(aRes && aRes->shape()) { + } else if (aRes && aRes->shape()) { if (aRes->shape()->isVertex()) - aVertex = std::shared_ptr(new GeomAPI_Vertex(aRes->shape())); + aVertex = + std::shared_ptr(new GeomAPI_Vertex(aRes->shape())); else if (aRes->shape()->isEdge()) anEdge = std::shared_ptr(new GeomAPI_Edge(aRes->shape())); } // try to convert result to sketch feature if (aRes) { - aSketchFeature = - std::dynamic_pointer_cast(ModelAPI_Feature::feature(aRes)); + aSketchFeature = std::dynamic_pointer_cast( + ModelAPI_Feature::feature(aRes)); } } if (!aVertex && !anEdge) { @@ -1270,33 +1353,35 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, aValid = fabs(aDot - 1.0) >= tolerance * tolerance; if (!aValid) theError = "Error: Line is orthogonal to the sketch plane."; - } - else if (anEdge->isCircle() || anEdge->isArc()) { + } else if (anEdge->isCircle() || anEdge->isArc()) { std::shared_ptr aCircle = anEdge->circle(); std::shared_ptr aCircNormal = aCircle->normal(); double aDot = fabs(aNormal->dot(aCircNormal)); aValid = aDot >= tolerance * tolerance; if (!aValid) - theError.arg(anEdge->isCircle() ? "Error: Circle is orthogonal to the sketch plane." - : "Error: Arc is orthogonal to the sketch plane."); - } - else if (anEdge->isEllipse()) { + theError.arg(anEdge->isCircle() + ? "Error: Circle is orthogonal to the sketch plane." + : "Error: Arc is orthogonal to the sketch plane."); + } else if (anEdge->isEllipse()) { std::shared_ptr anEllipse = anEdge->ellipse(); std::shared_ptr anEllipseNormal = anEllipse->normal(); double aDot = fabs(aNormal->dot(anEllipseNormal)); aValid = aDot >= tolerance * tolerance; if (!aValid) - theError.arg(anEdge->isClosed() ? "Error: Ellipse is orthogonal to the sketch plane." - : "Error: Elliptic Arc is orthogonal to the sketch plane."); - } - else if (anEdge->isBSpline()) { + theError.arg( + anEdge->isClosed() + ? "Error: Ellipse is orthogonal to the sketch plane." + : "Error: Elliptic Arc is orthogonal to the sketch plane."); + } else if (anEdge->isBSpline()) { // check B-spline is periodic and planar std::shared_ptr aCurve(new GeomAPI_Curve(anEdge)); std::shared_ptr aBSpline(new GeomAPI_BSpline(aCurve)); if (aBSpline->isPeriodic()) { - GeomPlanePtr aBSplinePlane = GeomAlgoAPI_ShapeTools::findPlane(ListOfShape(1, anEdge)); + GeomPlanePtr aBSplinePlane = + GeomAlgoAPI_ShapeTools::findPlane(ListOfShape(1, anEdge)); if (aBSplinePlane) { - std::shared_ptr aBSplineNormal = aBSplinePlane->direction(); + std::shared_ptr aBSplineNormal = + aBSplinePlane->direction(); double aDot = fabs(aNormal->dot(aBSplineNormal)); aValid = aDot > tolerance * tolerance; if (!aValid) { @@ -1304,12 +1389,13 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, // thus, need to check whether B-spline is planar. std::list aPoles = aBSpline->poles(); for (std::list::iterator it = aPoles.begin(); - it != aPoles.end() && !aValid; ++it) { + it != aPoles.end() && !aValid; ++it) { if (aBSplinePlane->distance(*it) > tolerance) aValid = true; // non-planar B-spline curve } if (!aValid) - theError = "Error: Periodic B-spline is orthogonal to the sketch plane."; + theError = + "Error: Periodic B-spline is orthogonal to the sketch plane."; } } } @@ -1318,10 +1404,8 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, return aValid; } - -static std::set common(const std::set& theSet1, - const std::set& theSet2) -{ +static std::set common(const std::set &theSet1, + const std::set &theSet2) { std::set aCommon; if (theSet1.empty() || theSet2.empty()) return aCommon; @@ -1334,10 +1418,9 @@ static std::set common(const std::set& theSet1, } bool SketchPlugin_DifferentReferenceValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); int aNbFeaturesReferred = 0; @@ -1362,7 +1445,8 @@ bool SketchPlugin_DifferentReferenceValidator::isValid( AttributePoint2DPtr aPoint = std::dynamic_pointer_cast(aRefAttr->attr()); if (aPoint) { - aCoincidentFeatures = SketchPlugin_Tools::findFeaturesCoincidentToPoint(aPoint); + aCoincidentFeatures = + SketchPlugin_Tools::findFeaturesCoincidentToPoint(aPoint); aNbAttributesReferred += 1; } } @@ -1370,7 +1454,8 @@ bool SketchPlugin_DifferentReferenceValidator::isValid( if (aCommonReferredFeatures.empty()) aCommonReferredFeatures = aCoincidentFeatures; else - aCommonReferredFeatures = common(aCommonReferredFeatures, aCoincidentFeatures); + aCommonReferredFeatures = + common(aCommonReferredFeatures, aCoincidentFeatures); if (aCommonReferredFeatures.empty()) return true; @@ -1393,10 +1478,9 @@ bool SketchPlugin_DifferentReferenceValidator::isValid( } bool SketchPlugin_DifferentPointReferenceValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); std::set aReferredCoincidentPoints; @@ -1412,8 +1496,10 @@ bool SketchPlugin_DifferentPointReferenceValidator::isValid( AttributePoint2DPtr aPoint = std::dynamic_pointer_cast(aRefAttr->attr()); if (aReferredCoincidentPoints.empty()) - aReferredCoincidentPoints = SketchPlugin_Tools::findPointsCoincidentToPoint(aPoint); - else if (aReferredCoincidentPoints.find(aPoint) == aReferredCoincidentPoints.end()) + aReferredCoincidentPoints = + SketchPlugin_Tools::findPointsCoincidentToPoint(aPoint); + else if (aReferredCoincidentPoints.find(aPoint) == + aReferredCoincidentPoints.end()) return true; // non-coincident point has been found else hasRefsToPoints = true; @@ -1426,10 +1512,8 @@ bool SketchPlugin_DifferentPointReferenceValidator::isValid( } bool SketchPlugin_CirclePassedPointValidator::isValid( - const AttributePtr& theAttribute, - const std::list&, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, const std::list &, + Events_InfoMessage &theError) const { static const std::string aErrorMessage( "Passed point refers to the same feature as a center point"); @@ -1460,7 +1544,7 @@ bool SketchPlugin_CirclePassedPointValidator::isValid( SketchPlugin_Tools::findFeaturesCoincidentToPoint(aCenterPoint); // check one of coincident features is a feature referred by passed point std::set::const_iterator anIt = aCoincidentFeatures.begin(); - for(; anIt != aCoincidentFeatures.end(); ++anIt) + for (; anIt != aCoincidentFeatures.end(); ++anIt) if (*anIt == aPassedFeature) { theError = aErrorMessage; return false; @@ -1471,21 +1555,20 @@ bool SketchPlugin_CirclePassedPointValidator::isValid( } bool SketchPlugin_ThirdPointValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); return arePointsNotOnLine(anOwner, theError) && arePointsNotSeparated(anOwner, theArguments, theError); } -static std::shared_ptr toPoint(const FeaturePtr& theMacroCircle, - const std::string& thePointAttrName, - const std::string& theRefPointAttrName) -{ - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast( - theMacroCircle->attribute(thePointAttrName)); +static std::shared_ptr +toPoint(const FeaturePtr &theMacroCircle, const std::string &thePointAttrName, + const std::string &theRefPointAttrName) { + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast( + theMacroCircle->attribute(thePointAttrName)); AttributeRefAttrPtr aRefAttr = theMacroCircle->refattr(theRefPointAttrName); std::shared_ptr aPoint = aPointAttr->pnt(); @@ -1494,18 +1577,20 @@ static std::shared_ptr toPoint(const FeaturePtr& theMacroCircle, // project a point onto selected feature std::shared_ptr aFeature = std::dynamic_pointer_cast( - ModelAPI_Feature::feature(aRefAttr->object())); + ModelAPI_Feature::feature(aRefAttr->object())); if (aFeature) { - SketchPlugin_Sketch* aSketch = aFeature->sketch(); + SketchPlugin_Sketch *aSketch = aFeature->sketch(); std::shared_ptr anEdge = - std::dynamic_pointer_cast(aFeature->lastResult()->shape()); + std::dynamic_pointer_cast( + aFeature->lastResult()->shape()); if (anEdge) { - std::shared_ptr aPoint3D = aSketch->to3D(aPoint->x(), aPoint->y()); + std::shared_ptr aPoint3D = + aSketch->to3D(aPoint->x(), aPoint->y()); if (anEdge->isLine()) aPoint3D = anEdge->line()->project(aPoint3D); else if (anEdge->isCircle()) aPoint3D = anEdge->circle()->project(aPoint3D); - if(aPoint3D) + if (aPoint3D) aPoint = aSketch->to2D(aPoint3D); } } @@ -1513,59 +1598,58 @@ static std::shared_ptr toPoint(const FeaturePtr& theMacroCircle, AttributePoint2DPtr anOtherPoint = std::dynamic_pointer_cast(aRefAttr->attr()); if (anOtherPoint) - aPoint = anOtherPoint->pnt(); // the reference point is much more precise, use it + aPoint = + anOtherPoint + ->pnt(); // the reference point is much more precise, use it } } return aPoint; } -static void threePointsOfFeature(const FeaturePtr& theMacroFeature, - std::shared_ptr thePoints[3]) -{ +static void threePointsOfFeature(const FeaturePtr &theMacroFeature, + std::shared_ptr thePoints[3]) { if (theMacroFeature->getKind() == SketchPlugin_MacroCircle::ID()) { - thePoints[0] = toPoint(theMacroFeature, - SketchPlugin_MacroCircle::FIRST_POINT_ID(), - SketchPlugin_MacroCircle::FIRST_POINT_REF_ID()); - thePoints[1] = toPoint(theMacroFeature, - SketchPlugin_MacroCircle::SECOND_POINT_ID(), - SketchPlugin_MacroCircle::SECOND_POINT_REF_ID()); - thePoints[2] = toPoint(theMacroFeature, - SketchPlugin_MacroCircle::THIRD_POINT_ID(), - SketchPlugin_MacroCircle::THIRD_POINT_REF_ID()); + thePoints[0] = + toPoint(theMacroFeature, SketchPlugin_MacroCircle::FIRST_POINT_ID(), + SketchPlugin_MacroCircle::FIRST_POINT_REF_ID()); + thePoints[1] = + toPoint(theMacroFeature, SketchPlugin_MacroCircle::SECOND_POINT_ID(), + SketchPlugin_MacroCircle::SECOND_POINT_REF_ID()); + thePoints[2] = + toPoint(theMacroFeature, SketchPlugin_MacroCircle::THIRD_POINT_ID(), + SketchPlugin_MacroCircle::THIRD_POINT_REF_ID()); } else if (theMacroFeature->getKind() == SketchPlugin_MacroArc::ID()) { - thePoints[0] = toPoint(theMacroFeature, - SketchPlugin_MacroArc::START_POINT_2_ID(), - SketchPlugin_MacroArc::START_POINT_REF_ID()); - thePoints[1] = toPoint(theMacroFeature, - SketchPlugin_MacroArc::END_POINT_2_ID(), - SketchPlugin_MacroArc::END_POINT_REF_ID()); - thePoints[2] = toPoint(theMacroFeature, - SketchPlugin_MacroArc::PASSED_POINT_ID(), - SketchPlugin_MacroArc::PASSED_POINT_REF_ID()); + thePoints[0] = + toPoint(theMacroFeature, SketchPlugin_MacroArc::START_POINT_2_ID(), + SketchPlugin_MacroArc::START_POINT_REF_ID()); + thePoints[1] = + toPoint(theMacroFeature, SketchPlugin_MacroArc::END_POINT_2_ID(), + SketchPlugin_MacroArc::END_POINT_REF_ID()); + thePoints[2] = + toPoint(theMacroFeature, SketchPlugin_MacroArc::PASSED_POINT_ID(), + SketchPlugin_MacroArc::PASSED_POINT_REF_ID()); } } -static bool isPointsOnLine(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -{ +static bool isPointsOnLine(const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2, + const std::shared_ptr &thePoint3) { static const double aTolerance = 1.e-7; if (thePoint1->distance(thePoint2) < aTolerance || thePoint1->distance(thePoint3) < aTolerance) return true; - std::shared_ptr aDirP1P2(new GeomAPI_Dir2d(thePoint2->x() - thePoint1->x(), - thePoint2->y() - thePoint1->y())); - std::shared_ptr aDirP1P3(new GeomAPI_Dir2d(thePoint3->x() - thePoint1->x(), - thePoint3->y() - thePoint1->y())); + std::shared_ptr aDirP1P2(new GeomAPI_Dir2d( + thePoint2->x() - thePoint1->x(), thePoint2->y() - thePoint1->y())); + std::shared_ptr aDirP1P3(new GeomAPI_Dir2d( + thePoint3->x() - thePoint1->x(), thePoint3->y() - thePoint1->y())); return fabs(aDirP1P2->cross(aDirP1P3)) < aTolerance; } -static bool isOnSameSide(const std::shared_ptr& theLine, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2) -{ +static bool isOnSameSide(const std::shared_ptr &theLine, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2) { static const double aTolerance = 1.e-7; std::shared_ptr aLineDir = theLine->direction(); std::shared_ptr aLineLoc = theLine->location()->xyz(); @@ -1584,21 +1668,19 @@ static bool isOnSameSide(const std::shared_ptr& theLine, return aLineDir->cross(aDirP1L)->dot(aLineDir->cross(aDirP2L)) > -aTolerance; } -static bool isOnSameSide(const std::shared_ptr& theCircle, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2) -{ +static bool isOnSameSide(const std::shared_ptr &theCircle, + const std::shared_ptr &thePoint1, + const std::shared_ptr &thePoint2) { static const double aTolerance = 1.e-7; std::shared_ptr aCenter = theCircle->center(); double aDistP1C = thePoint1->distance(aCenter); double aDistP2C = thePoint2->distance(aCenter); - return (aDistP1C - theCircle->radius()) * (aDistP2C - theCircle->radius()) > -aTolerance; + return (aDistP1C - theCircle->radius()) * (aDistP2C - theCircle->radius()) > + -aTolerance; } bool SketchPlugin_ThirdPointValidator::arePointsNotOnLine( - const FeaturePtr& theMacroFeature, - Events_InfoMessage& theError) const -{ + const FeaturePtr &theMacroFeature, Events_InfoMessage &theError) const { static const std::string aErrorPointsOnLine( "Selected points are on the same line"); @@ -1613,14 +1695,14 @@ bool SketchPlugin_ThirdPointValidator::arePointsNotOnLine( } bool SketchPlugin_ThirdPointValidator::arePointsNotSeparated( - const FeaturePtr& theMacroFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const FeaturePtr &theMacroFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const { static const std::string aErrorPointsApart( "Selected entity is lying between first two points"); - AttributeRefAttrPtr aThirdPointRef = theMacroFeature->refattr(theArguments.front()); + AttributeRefAttrPtr aThirdPointRef = + theMacroFeature->refattr(theArguments.front()); FeaturePtr aRefByThird; if (aThirdPointRef->isObject()) aRefByThird = ModelAPI_Feature::feature(aThirdPointRef->object()); @@ -1631,14 +1713,18 @@ bool SketchPlugin_ThirdPointValidator::arePointsNotSeparated( threePointsOfFeature(theMacroFeature, aPoints); std::shared_ptr aThirdShape = - std::dynamic_pointer_cast(aRefByThird->lastResult()->shape()); + std::dynamic_pointer_cast( + aRefByThird->lastResult()->shape()); if (!aThirdShape) return true; - SketchPlugin_Sketch* aSketch = - std::dynamic_pointer_cast(theMacroFeature)->sketch(); - std::shared_ptr aFirstPnt3D = aSketch->to3D(aPoints[0]->x(), aPoints[0]->y()); - std::shared_ptr aSecondPnt3D = aSketch->to3D(aPoints[1]->x(), aPoints[1]->y()); + SketchPlugin_Sketch *aSketch = + std::dynamic_pointer_cast(theMacroFeature) + ->sketch(); + std::shared_ptr aFirstPnt3D = + aSketch->to3D(aPoints[0]->x(), aPoints[0]->y()); + std::shared_ptr aSecondPnt3D = + aSketch->to3D(aPoints[1]->x(), aPoints[1]->y()); bool isOk = true; if (aThirdShape->isLine()) @@ -1652,38 +1738,37 @@ bool SketchPlugin_ThirdPointValidator::arePointsNotSeparated( } bool SketchPlugin_ArcEndPointValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeRefAttrPtr anEndPointRef = aFeature->refattr(theArguments.front()); - if(!anEndPointRef.get()) { + if (!anEndPointRef.get()) { return true; } ObjectPtr anObject = anEndPointRef->object(); AttributePtr anAttr = anEndPointRef->attr(); - if(!anObject.get() && !anAttr.get()) { + if (!anObject.get() && !anAttr.get()) { return true; } - if(anEndPointRef->attr().get()) { + if (anEndPointRef->attr().get()) { return false; } ResultPtr aResult = std::dynamic_pointer_cast(anObject); - if(aResult.get()) { + if (aResult.get()) { GeomShapePtr aShape = aResult->shape(); - if(aShape.get() && aShape->isVertex()) { + if (aShape.get() && aShape->isVertex()) { return false; } } aFeature = ModelAPI_Feature::feature(anObject); - if(aFeature.get()) { - if(aFeature->getKind() == SketchPlugin_Point::ID()) { + if (aFeature.get()) { + if (aFeature->getKind() == SketchPlugin_Point::ID()) { return false; } } @@ -1691,29 +1776,28 @@ bool SketchPlugin_ArcEndPointValidator::isValid( return true; } -static GeomShapePtr toInfiniteEdge(const GeomShapePtr theShape) -{ - if(!theShape.get()) { +static GeomShapePtr toInfiniteEdge(const GeomShapePtr theShape) { + if (!theShape.get()) { return theShape; } - if(!theShape->isEdge()) { + if (!theShape->isEdge()) { return theShape; } std::shared_ptr anEdge(new GeomAPI_Edge(theShape)); - if(!anEdge.get()) { + if (!anEdge.get()) { return theShape; } - if(anEdge->isLine()) { + if (anEdge->isLine()) { std::shared_ptr aLine = anEdge->line(); GeomShapePtr aShape = GeomAlgoAPI_EdgeBuilder::line(aLine); return aShape; } - if(anEdge->isCircle() || anEdge->isArc()) { + if (anEdge->isCircle() || anEdge->isArc()) { std::shared_ptr aCircle = anEdge->circle(); GeomShapePtr aShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCircle); return aShape; @@ -1723,56 +1807,54 @@ static GeomShapePtr toInfiniteEdge(const GeomShapePtr theShape) } bool SketchPlugin_ArcEndPointIntersectionValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::shared_ptr anArcFeature = std::dynamic_pointer_cast(theAttribute->owner()); - AttributeRefAttrPtr anEndPointRef = anArcFeature->refattr(theArguments.front()); + AttributeRefAttrPtr anEndPointRef = + anArcFeature->refattr(theArguments.front()); - if(!anEndPointRef.get()) { + if (!anEndPointRef.get()) { return true; } GeomShapePtr anArcShape = toInfiniteEdge(anArcFeature->getArcShape(false)); - if(!anArcShape.get() || anArcShape->isNull()) { + if (!anArcShape.get() || anArcShape->isNull()) { return true; } ObjectPtr anObject = anEndPointRef->object(); AttributePtr anAttr = anEndPointRef->attr(); - if(!anObject.get() && !anAttr.get()) { + if (!anObject.get() && !anAttr.get()) { return true; } ResultPtr aResult = std::dynamic_pointer_cast(anObject); - if(aResult.get()) { + if (aResult.get()) { GeomShapePtr aShape = aResult->shape(); if (!aShape->isEdge()) return true; aShape = toInfiniteEdge(aShape); - if(aShape.get() && !aShape->isNull()) { - if(anArcShape->isIntersect(aShape)) { + if (aShape.get() && !aShape->isNull()) { + if (anArcShape->isIntersect(aShape)) { return true; } } } FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(anObject); - if(aSelectedFeature.get()) { + if (aSelectedFeature.get()) { std::list aResults = aSelectedFeature->results(); - for(std::list::const_iterator anIt = aResults.cbegin(); - anIt != aResults.cend(); - ++anIt) - { + for (std::list::const_iterator anIt = aResults.cbegin(); + anIt != aResults.cend(); ++anIt) { GeomShapePtr aShape = (*anIt)->shape(); if (!aShape->isEdge()) return true; aShape = toInfiniteEdge(aShape); - if(aShape.get() && !aShape->isNull()) { - if(anArcShape->isIntersect(aShape)) { + if (aShape.get() && !aShape->isNull()) { + if (anArcShape->isIntersect(aShape)) { return true; } } @@ -1782,10 +1864,10 @@ bool SketchPlugin_ArcEndPointIntersectionValidator::isValid( return false; } -bool SketchPlugin_HasNoConstraint::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_HasNoConstraint::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { std::set aFeatureKinds; for (std::list::const_iterator anArgIt = theArguments.begin(); anArgIt != theArguments.end(); anArgIt++) { @@ -1798,8 +1880,8 @@ bool SketchPlugin_HasNoConstraint::isValid(const AttributePtr& theAttribute, return false; } - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast - (theAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(theAttribute); bool isObject = aRefAttr->isObject(); if (!isObject) { theError = "It uses an empty object"; @@ -1820,20 +1902,19 @@ bool SketchPlugin_HasNoConstraint::isValid(const AttributePtr& theAttribute, FeaturePtr aRefFeature = ModelAPI_Feature::feature((*anIt)->owner()); if (aRefFeature.get() && aCurrentFeature != aRefFeature && aFeatureKinds.find(aRefFeature->getKind()) != aFeatureKinds.end()) - return false; // constraint is found, that means that the check is not valid + return false; // constraint is found, that means that the check is not + // valid } return true; } bool SketchPlugin_ReplicationReferenceValidator::isValid( - const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); - if (!aRefAttr) - { + if (!aRefAttr) { theError = "Incorrect attribute"; return false; } @@ -1841,15 +1922,15 @@ bool SketchPlugin_ReplicationReferenceValidator::isValid( ObjectPtr anOwner; if (aRefAttr->isObject()) anOwner = aRefAttr->object(); - else - { + else { AttributePtr anAttr = aRefAttr->attr(); anOwner = anAttr->owner(); } FeaturePtr anAttrOwnerFeature = ModelAPI_Feature::feature(anOwner); if (!anAttrOwnerFeature) return true; - AttributeBooleanPtr aCopyAttr = anAttrOwnerFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeBooleanPtr aCopyAttr = + anAttrOwnerFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (!aCopyAttr || !aCopyAttr->value()) return true; // feature is not a copy, thus valid @@ -1857,9 +1938,9 @@ bool SketchPlugin_ReplicationReferenceValidator::isValid( // Collect original entities std::set anOriginalFeatures; if (theArguments.size() > 1) { - AttributeRefListPtr anOrigList = aMultiFeature->reflist(theArguments.back()); - for (int i = 0; i < anOrigList->size(); ++i) - { + AttributeRefListPtr anOrigList = + aMultiFeature->reflist(theArguments.back()); + for (int i = 0; i < anOrigList->size(); ++i) { FeaturePtr aFeature = ModelAPI_Feature::feature(anOrigList->object(i)); if (aFeature == anAttrOwnerFeature) return true; @@ -1868,11 +1949,9 @@ bool SketchPlugin_ReplicationReferenceValidator::isValid( // check the copy feature is already referred by the "Multi" feature AttributeRefListPtr aRefList = aMultiFeature->reflist(theArguments.front()); - for (int i = 0; i < aRefList->size(); ++i) - { + for (int i = 0; i < aRefList->size(); ++i) { FeaturePtr aRefOwner = ModelAPI_Feature::feature(aRefList->object(i)); - if (aRefOwner == anAttrOwnerFeature) - { + if (aRefOwner == anAttrOwnerFeature) { theError = "Attribute refers to the object generated by this feature"; return false; } @@ -1881,10 +1960,10 @@ bool SketchPlugin_ReplicationReferenceValidator::isValid( return true; } -bool SketchPlugin_SketchFeatureValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_SketchFeatureValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId() && theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -1907,13 +1986,13 @@ bool SketchPlugin_SketchFeatureValidator::isValid(const AttributePtr& theAttribu isSketchFeature = aSketchFeature.get() != NULL; } } - } - else { + } else { AttributeReferencePtr aReference = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aReference) { FeaturePtr aFeature = ModelAPI_Feature::feature(aReference->value()); - isSketchFeature = aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID(); + isSketchFeature = + aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID(); } } @@ -1922,10 +2001,10 @@ bool SketchPlugin_SketchFeatureValidator::isValid(const AttributePtr& theAttribu return isSketchFeature; } -bool SketchPlugin_MultiRotationAngleValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_MultiRotationAngleValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeDouble::typeId()) { theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); @@ -1933,28 +2012,24 @@ bool SketchPlugin_MultiRotationAngleValidator::isValid(const AttributePtr& theAt } AttributeDoublePtr anAngleAttr = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); FeaturePtr aMultiRotation = ModelAPI_Feature::feature(theAttribute->owner()); AttributeStringPtr anAngleType = aMultiRotation->string(SketchPlugin_MultiRotation::ANGLE_TYPE()); - AttributeIntegerPtr aNbCopies = - aMultiRotation->integer(SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID()); + AttributeIntegerPtr aNbCopies = aMultiRotation->integer( + SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID()); - if (anAngleType->value() != "FullAngle") - { + if (anAngleType->value() != "FullAngle") { double aFullAngleValue = anAngleAttr->value() * (aNbCopies->value() - 1); - if (aFullAngleValue < -1.e-7 || aFullAngleValue > 359.9999999) - { - theError = "Rotation single angle should produce full angle less than 360 degree"; + if (aFullAngleValue < -1.e-7 || aFullAngleValue > 359.9999999) { + theError = "Rotation single angle should produce full angle less than " + "360 degree"; return false; } - } - else - { + } else { double aFullAngleValue = anAngleAttr->value(); - if (aFullAngleValue < -1.e-7 || aFullAngleValue > 360.0000001) - { + if (aFullAngleValue < -1.e-7 || aFullAngleValue > 360.0000001) { theError = "Rotation full angle should be in range [0, 360]"; return false; } @@ -1963,10 +2038,10 @@ bool SketchPlugin_MultiRotationAngleValidator::isValid(const AttributePtr& theAt return true; } -bool SketchPlugin_BSplineValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_BSplineValidator::isValid( + const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const { AttributePoint2DArrayPtr aPolesArray = std::dynamic_pointer_cast(theAttribute); if (!aPolesArray) @@ -1980,10 +2055,9 @@ bool SketchPlugin_BSplineValidator::isValid(const AttributePtr& theAttribute, return true; } -bool SketchPlugin_CurveFittingValidator::isValid(const FeaturePtr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const -{ +bool SketchPlugin_CurveFittingValidator::isValid( + const FeaturePtr &theFeature, const std::list &theArguments, + Events_InfoMessage &theError) const { AttributeRefAttrListPtr aRefAttrList = theFeature->refattrlist(SketchPlugin_CurveFitting::POINTS_ID()); AttributeBooleanPtr aPeriodicAttr = diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index 9c774602f..c373fe1e8 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.h +++ b/src/SketchPlugin/SketchPlugin_Validators.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchPlugin_Validators_H @@ -30,16 +31,15 @@ * * It just checks that distance is greater than zero. */ -class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_TangentAttrValidator @@ -48,16 +48,15 @@ class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator * * It just checks that distance is greater than zero. */ -class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_PerpendicularAttrValidator @@ -66,35 +65,33 @@ class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator * * Checks that two arcs are not selected for perpendicular. */ -class SketchPlugin_PerpendicularAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_PerpendicularAttrValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - /**\class SketchPlugin_NotFixedValidator * \ingroup Validators * \brief Validator for the rigid constraint input. * * It just checks there is no rigid constraint for the current feature. */ -class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is not used in another rigid constraint //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_EqualAttrValidator @@ -103,16 +100,15 @@ class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator * * It checks that attributes of the Equal constraint are correct. */ -class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_MirrorAttrValidator @@ -121,76 +117,75 @@ class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator * * It checks that attributes of the Mirror constraint are correct. */ -class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - /**\class SketchPlugin_CoincidenceAttrValidator * \ingroup Validators * \brief Validator for the coincidence constraint input. * * It checks that attributes of the Coincidence constraint are correct. */ -class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_CoincidenceAttrValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - /**\class SketchPlugin_CopyValidator * \ingroup Validators * \brief Validator for the constraints which create features. * - * Applicable only for features, which creates another features. It verifies the produced - * features of current constraint don't become into the list of initial features + * Applicable only for features, which creates another features. It verifies the + * produced features of current constraint don't become into the list of initial + * features */ -class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_SolverErrorValidator * \ingroup Validators * \brief Validator for the solver error. * - * Simply checks that solver error attribute is empty. Returns the attribute value as an error. + * Simply checks that solver error attribute is empty. Returns the attribute + * value as an error. */ -class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator -{ - public: +class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator { +public: //! returns true if there are no solver errors //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; - - /// Returns true if the attribute in feature is not obligatory for the feature execution - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; + + /// Returns true if the attribute in feature is not obligatory for the feature + /// execution + virtual bool isNotObligatory(std::string theFeature, + std::string theAttribute); }; /**\class SketchPlugin_FilletVertexValidator @@ -199,64 +194,60 @@ class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator * * Checks that selected point have exactly two coincident lines. */ -class SketchPlugin_FilletVertexValidator : public ModelAPI_AttributeValidator -{ +class SketchPlugin_FilletVertexValidator : public ModelAPI_AttributeValidator { public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; //! returns true if attribute is a good point for fillet //! \param theAttribute the checked point attribute //! \param theError error message //! \param theEdge1 adjacent edge feature //! \param theEdge2 adjacent edge feature - static bool isValidVertex(const AttributePtr& theAttribute, - Events_InfoMessage& theError, - FeaturePtr& theEdge1, - FeaturePtr& theEdge2); + static bool isValidVertex(const AttributePtr &theAttribute, + Events_InfoMessage &theError, FeaturePtr &theEdge1, + FeaturePtr &theEdge2); }; - /**\class SketchPlugin_MiddlePointAttrValidator * \ingroup Validators * \brief Validator for the middle point constraint input. * * It checks that attributes of the Middle point constraint are correct. */ -class SketchPlugin_MiddlePointAttrValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_MiddlePointAttrValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - /**\class SketchPlugin_ArcTangentPointValidator * \ingroup Validators * \brief Validator for the point where the tangent arc is building. * * Checks that the point is a start or end point just on line or arc. */ -class SketchPlugin_ArcTangentPointValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ArcTangentPointValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_ArcTransversalPointValidator @@ -265,19 +256,18 @@ class SketchPlugin_ArcTangentPointValidator : public ModelAPI_AttributeValidator * * Checks that the point is a start or end point just on line or arc. */ -class SketchPlugin_ArcTransversalPointValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ArcTransversalPointValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; - /**\class SketchPlugin_SplitValidator * \ingroup Validators * \brief Validator for the entity of the following type: @@ -287,16 +277,15 @@ class SketchPlugin_ArcTransversalPointValidator : public ModelAPI_AttributeValid * * Checks that there are coincident point on selected feature. */ -class SketchPlugin_SplitValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_SplitValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_TrimValidator @@ -308,48 +297,45 @@ class SketchPlugin_SplitValidator : public ModelAPI_AttributeValidator * * Checks that there are coincident point on selected feature. */ -class SketchPlugin_TrimValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_TrimValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_IntersectionValidator * \ingroup Validators * \brief Validator for the attribute to be intersected with the sketch plane. */ -class SketchPlugin_IntersectionValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_IntersectionValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_ProjectionValidator * \ingroup Validators * \brief Validator for the attribute to be projected onto the sketch plane. */ -class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_DifferentReferenceValidator @@ -359,82 +345,84 @@ class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator * It checks that at least one of specified attributes * refers to another feature in respect to each other. */ -class SketchPlugin_DifferentReferenceValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_DifferentReferenceValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_DifferentPointReferenceValidator * \ingroup Validators * \brief Validator for attributes of a sketch feature. * - * It checks that at least two of specified attributes refer to different points. + * It checks that at least two of specified attributes refer to different + * points. */ -class SketchPlugin_DifferentPointReferenceValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_DifferentPointReferenceValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_CirclePassedPointValidator * \ingroup Validators * \brief Validator for passed point of MacroCircle feature. * - * Checks that passed point does not refer to the feature, the center is coincident to. + * Checks that passed point does not refer to the feature, the center is + * coincident to. */ -class SketchPlugin_CirclePassedPointValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_CirclePassedPointValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list&, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_ThirdPointValidator * \ingroup Validators * \brief Validator for the third point of MacroCircle feature. * - * Checks that third point does not lie on a line passed through the first two points. - * Checks that third point does not refer to feature lying between the first two points. + * Checks that third point does not lie on a line passed through the first two + * points. Checks that third point does not refer to feature lying between the + * first two points. */ -class SketchPlugin_ThirdPointValidator : public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ThirdPointValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; private: //! returns true if three points have not been placed on the same line - bool arePointsNotOnLine(const FeaturePtr& theMacroFeature, - Events_InfoMessage& theError) const; + bool arePointsNotOnLine(const FeaturePtr &theMacroFeature, + Events_InfoMessage &theError) const; //! returns true if the first two points have not been separated //! by a feature referred by thrid point - bool arePointsNotSeparated(const FeaturePtr& theMacroFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + bool arePointsNotSeparated(const FeaturePtr &theMacroFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_ArcEndPointValidator @@ -443,16 +431,15 @@ private: * * Checks that third point does not lie on a point. */ -class SketchPlugin_ArcEndPointValidator: public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ArcEndPointValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_ArcEndPointIntersectionValidator @@ -461,115 +448,113 @@ class SketchPlugin_ArcEndPointValidator: public ModelAPI_AttributeValidator * * Checks that third point does lie on edge which intersects arc. */ -class SketchPlugin_ArcEndPointIntersectionValidator: public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ArcEndPointIntersectionValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_HasNoConstraint * \ingroup Validators * \brief Validator for checking whether the feature has constraint. * - * Checks that feature of the attribute does not have constraint with some kinds. - * The kinds of constraints should be described in parameters of the validator - * Validator processes the ModelAPI_AttributeRefAttr attribute kind + * Checks that feature of the attribute does not have constraint with some + * kinds. The kinds of constraints should be described in parameters of the + * validator Validator processes the ModelAPI_AttributeRefAttr attribute kind */ -class SketchPlugin_HasNoConstraint: public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_HasNoConstraint : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_ReplicationReferenceValidator * \ingroup Validators * \brief Validator checking that the replications features (Mirror, - * Multi-Rotation, Mutli-Translation) do not refer to the shapes they produce. + * Multi-Rotation, Mutli-Translation) do not refer to the shapes they + * produce. */ -class SketchPlugin_ReplicationReferenceValidator: public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_ReplicationReferenceValidator + : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_SketchFeatureValidator * \ingroup Validators - * \brief Validator for checking whether the feature referred by attribute is a sketch feature. + * \brief Validator for checking whether the feature referred by attribute is a + * sketch feature. */ -class SketchPlugin_SketchFeatureValidator: public ModelAPI_AttributeValidator -{ - public: +class SketchPlugin_SketchFeatureValidator : public ModelAPI_AttributeValidator { +public: //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_MultiRotationAngleValidator * \ingroup Validators - * \brief Validator for checking whether the angle of MultiRotation is in range [0, 360]. + * \brief Validator for checking whether the angle of MultiRotation is in range + * [0, 360]. */ -class SketchPlugin_MultiRotationAngleValidator : public ModelAPI_AttributeValidator -{ +class SketchPlugin_MultiRotationAngleValidator + : public ModelAPI_AttributeValidator { //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_BSplineValidator * \ingroup Validators * \brief Validator for checking poles/weights of B-spline curve. */ -class SketchPlugin_BSplineValidator : public ModelAPI_AttributeValidator -{ +class SketchPlugin_BSplineValidator : public ModelAPI_AttributeValidator { //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - Events_InfoMessage& theError) const; + virtual bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; /**\class SketchPlugin_CurveFittingValidator * \ingroup Validators * \brief Validator for the selected vertices for the curve fitting feature. */ -class SketchPlugin_CurveFittingValidator : public ModelAPI_FeatureValidator -{ +class SketchPlugin_CurveFittingValidator : public ModelAPI_FeatureValidator { public: - //! returns true if number of selected points is greater than the minimal value - //! \param theAttribute the checked attribute - //! \param theArguments arguments of the attribute - //! \param theError error message - virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments, - Events_InfoMessage& theError) const; + //! returns true if number of selected points is greater than the minimal + //! value \param theAttribute the checked attribute \param theArguments + //! arguments of the attribute \param theError error message + virtual bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_msg_en.ts b/src/SketchPlugin/SketchPlugin_msg_en.ts index 1361cdc79..b23ec589c 100644 --- a/src/SketchPlugin/SketchPlugin_msg_en.ts +++ b/src/SketchPlugin/SketchPlugin_msg_en.ts @@ -338,7 +338,7 @@ - + SketchConstraintHorizontal:Model_FeatureValidator @@ -402,7 +402,7 @@ The constraint argument refers to the empty shape - + SketchConstraintPerpendicular:Model_FeatureValidator @@ -529,7 +529,7 @@ Two external lines can not be constrained as perpendicular - + SketchConstraintRadius:Model_FeatureValidator @@ -628,7 +628,7 @@ The constraint argument refers to the empty shape - + SketchConstraintVertical @@ -692,7 +692,7 @@ The first line refers to the empty shape - + SketchLine:GeomValidators_Different @@ -764,7 +764,7 @@ Select a point - + SketchRectangle @@ -1166,7 +1166,7 @@ The rotation center refers to the empty shape - + SketchMultiTranslation:Model_FeatureValidator diff --git a/src/SketchPlugin/doc/SketchPlugin.rst b/src/SketchPlugin/doc/SketchPlugin.rst index d1c47eb22..5008e345a 100644 --- a/src/SketchPlugin/doc/SketchPlugin.rst +++ b/src/SketchPlugin/doc/SketchPlugin.rst @@ -46,7 +46,7 @@ After the plane for sketch is selected, the following property panel will be ope - **Reversed** check box - allows reversing the sketch plane normal; - **Set plane view** button - switches the viewer to the top view for the sketch plane; - **Show geometrical constraints** check box - displays/hides geometrical constraints: -- **Show dimensional constraints** check box - displays/hides dimensional constraints; +- **Show dimensional constraints** check box - displays/hides dimensional constraints; - **Show existing expressions** check box - displays/hides expressions. - **Show free points** check box - highlights free points in the current sketch if it is checked. - **Automatic constraints** - automatically create horizontal or vertical constraints if angle between created line and horizontal or vertical less then angular tolerance (defined in preferences). diff --git a/src/SketchPlugin/doc/arcEllipseFeature.rst b/src/SketchPlugin/doc/arcEllipseFeature.rst index 582281244..216477b1d 100644 --- a/src/SketchPlugin/doc/arcEllipseFeature.rst +++ b/src/SketchPlugin/doc/arcEllipseFeature.rst @@ -42,4 +42,4 @@ Created elliptic arc appears in the view. Elliptic arc created -**See Also** a sample TUI Script of :ref:`tui_create_elliptic_arc` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_create_elliptic_arc` operation. diff --git a/src/SketchPlugin/doc/bsplineFeature.rst b/src/SketchPlugin/doc/bsplineFeature.rst index fd7ebe2dc..09b7710ef 100644 --- a/src/SketchPlugin/doc/bsplineFeature.rst +++ b/src/SketchPlugin/doc/bsplineFeature.rst @@ -73,6 +73,6 @@ The following options are provided to modify the already created B-spline curve: #. Change weight of each pole. #. Add new pole. -The new pole is added after the current by pressing on the corresponding |add_pole.icon| button. The default weight for the new pole is 1. +The new pole is added after the current by pressing on the corresponding |add_pole.icon| button. The default weight for the new pole is 1. **Note:** adding the new pole after the last for non-periodic B-spline will not change the last point of the curve to avoid modification of full sketch. diff --git a/src/SketchPlugin/doc/coincedentFeature.rst b/src/SketchPlugin/doc/coincedentFeature.rst index 31121057d..dc109d91c 100644 --- a/src/SketchPlugin/doc/coincedentFeature.rst +++ b/src/SketchPlugin/doc/coincedentFeature.rst @@ -43,4 +43,4 @@ Created Coincident constraint appears in the view. Created coincident constraint -**See Also** a sample TUI Script of :ref:`tui_create_coincident` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_create_coincident` operation. diff --git a/src/SketchPlugin/doc/fixedFeature.rst b/src/SketchPlugin/doc/fixedFeature.rst index 693f0f374..0f26a37a2 100644 --- a/src/SketchPlugin/doc/fixedFeature.rst +++ b/src/SketchPlugin/doc/fixedFeature.rst @@ -44,6 +44,6 @@ Created Fixed constraint appears in the view. .. figure:: images/Fixed_res.png :align: center - Created fixed constraint + Created fixed constraint **See Also** a sample TUI Script of :ref:`tui_create_fixed` operation. diff --git a/src/SketchPlugin/doc/horizontalFeature.rst b/src/SketchPlugin/doc/horizontalFeature.rst index ae14805c5..ad86e95c5 100644 --- a/src/SketchPlugin/doc/horizontalFeature.rst +++ b/src/SketchPlugin/doc/horizontalFeature.rst @@ -39,4 +39,4 @@ Created Horizontal constraint appears in the view. Horizontal constraint created -**See Also** a sample TUI Script of :ref:`tui_create_horizontal` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_create_horizontal` operation. diff --git a/src/SketchPlugin/doc/radiusFeature.rst b/src/SketchPlugin/doc/radiusFeature.rst index 0fa5fbded..15cb6abdd 100644 --- a/src/SketchPlugin/doc/radiusFeature.rst +++ b/src/SketchPlugin/doc/radiusFeature.rst @@ -21,7 +21,7 @@ Property panel: Input fields: -- **Circle or Arc** is the circle or arc selected in the view; +- **Circle or Arc** is the circle or arc selected in the view; - **Value** is a radius of the selected object, could be modified to set the desirable value - **Text location** is a position of the radius value label relating to extension line (in the view) | |loc_left| **Left** inserts text at the left of the radius extension line. diff --git a/src/SketchPlugin/doc/sketchCopy.rst b/src/SketchPlugin/doc/sketchCopy.rst index 45a37b9ad..27fa02660 100644 --- a/src/SketchPlugin/doc/sketchCopy.rst +++ b/src/SketchPlugin/doc/sketchCopy.rst @@ -5,7 +5,7 @@ Sketch Copy =========== This macro will just copy the selected sketch feature into a new sketch feature and disappear. -So, the new sketch feature will be placed into the current history location with all sub-elements +So, the new sketch feature will be placed into the current history location with all sub-elements of the sketch copied. To start a Sketch Copy operation: diff --git a/src/SketchPlugin/doc/splitFeature.rst b/src/SketchPlugin/doc/splitFeature.rst index 8dcea1d08..54e680159 100644 --- a/src/SketchPlugin/doc/splitFeature.rst +++ b/src/SketchPlugin/doc/splitFeature.rst @@ -46,6 +46,6 @@ Created Split appears in the view. .. figure:: images/Split_res.png :align: center - Created split + Created split **See Also** a sample TUI Script of :ref:`tui_create_split` operation. diff --git a/src/SketchPlugin/tests.set b/src/SketchPlugin/tests.set index c30866fcf..7d42a2621 100644 --- a/src/SketchPlugin/tests.set +++ b/src/SketchPlugin/tests.set @@ -239,4 +239,3 @@ SET(TEST_NAMES_SEQ ) set(TEST_NAMES ${TEST_NAMES_PARA} ${TEST_NAMES_SEQ}) - diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.cpp index a325efbb2..0d6e6bd58 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.cpp @@ -14,35 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -static double deg2rad(double theDegrees) -{ - return theDegrees * M_PI / 180.0; -} +static double deg2rad(double theDegrees) { return theDegrees * M_PI / 180.0; } -static double rad2deg(double theRadians) -{ - return theRadians * 180.0 / M_PI; -} +static double rad2deg(double theRadians) { return theRadians * 180.0 / M_PI; } PlaneGCSSolver_AngleWrapper::PlaneGCSSolver_AngleWrapper(double *const theParam) - : PlaneGCSSolver_ScalarWrapper(theParam) -{ + : PlaneGCSSolver_ScalarWrapper(theParam) { setValue(*theParam); } -void PlaneGCSSolver_AngleWrapper::setValue(double theValue) -{ +void PlaneGCSSolver_AngleWrapper::setValue(double theValue) { *(myValue) = deg2rad(theValue); } -double PlaneGCSSolver_AngleWrapper::value() const -{ - return rad2deg(*myValue); -} +double PlaneGCSSolver_AngleWrapper::value() const { return rad2deg(*myValue); } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h index fb712b2dd..ecb1048b8 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_AngleWrapper_H_ @@ -26,8 +27,7 @@ * Wrapper providing operations with angular parameters in PlaneGCS. * Provides automatic conversion from degrees to radians and vice versa. */ -class PlaneGCSSolver_AngleWrapper : public PlaneGCSSolver_ScalarWrapper -{ +class PlaneGCSSolver_AngleWrapper : public PlaneGCSSolver_ScalarWrapper { public: PlaneGCSSolver_AngleWrapper(double *const theParam); ~PlaneGCSSolver_AngleWrapper() {} diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp index d129baeff..b6c530146 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include +#include #include #include -#include #include -#include +#include #include #include @@ -38,41 +39,39 @@ #include PlaneGCSSolver_AttributeBuilder::PlaneGCSSolver_AttributeBuilder( - PlaneGCSSolver_Storage* theStorage) - : PlaneGCSSolver_EntityBuilder(theStorage) -{ -} + PlaneGCSSolver_Storage *theStorage) + : PlaneGCSSolver_EntityBuilder(theStorage) {} -PlaneGCSSolver_AttributeBuilder::PlaneGCSSolver_AttributeBuilder(const StoragePtr& theStorage) - : PlaneGCSSolver_EntityBuilder( - std::dynamic_pointer_cast(theStorage).get()) -{ +PlaneGCSSolver_AttributeBuilder::PlaneGCSSolver_AttributeBuilder( + const StoragePtr &theStorage) + : PlaneGCSSolver_EntityBuilder( + std::dynamic_pointer_cast(theStorage).get()) { } -static double* createParameter(PlaneGCSSolver_Storage* theStorage) -{ +static double *createParameter(PlaneGCSSolver_Storage *theStorage) { return theStorage ? theStorage->createParameter() : (new double(0)); } -static EntityWrapperPtr createBoolean(const AttributePtr& theAttribute) -{ +static EntityWrapperPtr createBoolean(const AttributePtr &theAttribute) { BooleanWrapperPtr aWrapper; AttributeBooleanPtr aBoolean = std::dynamic_pointer_cast(theAttribute); if (aBoolean) - aWrapper = BooleanWrapperPtr(new PlaneGCSSolver_BooleanWrapper(aBoolean->value())); + aWrapper = + BooleanWrapperPtr(new PlaneGCSSolver_BooleanWrapper(aBoolean->value())); return aWrapper; } -static EntityWrapperPtr createScalar(const AttributePtr& theAttribute, - PlaneGCSSolver_Storage* theStorage) -{ +static EntityWrapperPtr createScalar(const AttributePtr &theAttribute, + PlaneGCSSolver_Storage *theStorage) { double aValue = 0.0; - AttributeDoublePtr aDouble = std::dynamic_pointer_cast(theAttribute); + AttributeDoublePtr aDouble = + std::dynamic_pointer_cast(theAttribute); if (aDouble) aValue = aDouble->isInitialized() ? aDouble->value() : 0.0; else { - AttributeIntegerPtr anInt = std::dynamic_pointer_cast(theAttribute); + AttributeIntegerPtr anInt = + std::dynamic_pointer_cast(theAttribute); if (anInt) aValue = anInt->isInitialized() ? anInt->value() : 0.0; else @@ -85,49 +84,54 @@ static EntityWrapperPtr createScalar(const AttributePtr& theAttribute, // - angle of the Multi-Rotation constraint FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); if ((theAttribute->id() == SketchPlugin_Constraint::VALUE() && - anOwner->getKind() == SketchPlugin_ConstraintAngle::ID()) || - (theAttribute->id() == SketchPlugin_MultiRotation::ANGLE_ID() && - anOwner->getKind() == SketchPlugin_MultiRotation::ID())) - aWrapper = ScalarWrapperPtr(new PlaneGCSSolver_AngleWrapper(createParameter(theStorage))); + anOwner->getKind() == SketchPlugin_ConstraintAngle::ID()) || + (theAttribute->id() == SketchPlugin_MultiRotation::ANGLE_ID() && + anOwner->getKind() == SketchPlugin_MultiRotation::ID())) + aWrapper = ScalarWrapperPtr( + new PlaneGCSSolver_AngleWrapper(createParameter(theStorage))); else if ((anOwner->getKind() == SketchPlugin_BSpline::ID() || anOwner->getKind() == SketchPlugin_BSplinePeriodic::ID()) && theAttribute->id() == SketchPlugin_BSplineBase::DEGREE_ID()) // Degree of B-spline is not processed by the solver - aWrapper = ScalarWrapperPtr(new PlaneGCSSolver_ScalarWrapper(createParameter(nullptr))); + aWrapper = ScalarWrapperPtr( + new PlaneGCSSolver_ScalarWrapper(createParameter(nullptr))); else - aWrapper = ScalarWrapperPtr(new PlaneGCSSolver_ScalarWrapper(createParameter(theStorage))); + aWrapper = ScalarWrapperPtr( + new PlaneGCSSolver_ScalarWrapper(createParameter(theStorage))); aWrapper->setValue(aValue); return aWrapper; } template -static bool nonSolverAttribute(const FeaturePtr theOwner, const std::string& theAttrId) -{ - return theOwner->getKind() == TYPE::ID() && (theAttrId == TYPE::WEIGHTS_ID() - || theAttrId == TYPE::KNOTS_ID() || theAttrId == TYPE::MULTS_ID()); +static bool nonSolverAttribute(const FeaturePtr theOwner, + const std::string &theAttrId) { + return theOwner->getKind() == TYPE::ID() && + (theAttrId == TYPE::WEIGHTS_ID() || theAttrId == TYPE::KNOTS_ID() || + theAttrId == TYPE::MULTS_ID()); } -static EntityWrapperPtr createScalarArray(const AttributePtr& theAttribute, - PlaneGCSSolver_Storage* theStorage) -{ +static EntityWrapperPtr createScalarArray(const AttributePtr &theAttribute, + PlaneGCSSolver_Storage *theStorage) { PlaneGCSSolver_Tools::AttributeArray anArray(theAttribute); if (!anArray.isInitialized()) return EntityWrapperPtr(); - PlaneGCSSolver_Storage* aStorage = theStorage; - // Weights, knots and multiplicities of B-spline curve are not processed by the solver + PlaneGCSSolver_Storage *aStorage = theStorage; + // Weights, knots and multiplicities of B-spline curve are not processed by + // the solver FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); if (nonSolverAttribute(anOwner, theAttribute->id()) || - nonSolverAttribute(anOwner, theAttribute->id())) + nonSolverAttribute(anOwner, + theAttribute->id())) aStorage = 0; int aSize = anArray.size(); GCS::VEC_pD aParameters; aParameters.reserve(aSize); for (int index = 0; index < aSize; ++index) { - double* aParam = createParameter(aStorage); + double *aParam = createParameter(aStorage); *aParam = anArray.value(index); aParameters.push_back(aParam); } @@ -135,8 +139,8 @@ static EntityWrapperPtr createScalarArray(const AttributePtr& theAttribute, return EntityWrapperPtr(new PlaneGCSSolver_ScalarArrayWrapper(aParameters)); } -static PointWrapperPtr createPoint(const GeomPnt2dPtr& thePoint, PlaneGCSSolver_Storage* theStorage) -{ +static PointWrapperPtr createPoint(const GeomPnt2dPtr &thePoint, + PlaneGCSSolver_Storage *theStorage) { GCSPointPtr aNewPoint(new GCS::Point); aNewPoint->x = createParameter(theStorage); @@ -149,9 +153,8 @@ static PointWrapperPtr createPoint(const GeomPnt2dPtr& thePoint, PlaneGCSSolver_ return PointWrapperPtr(new PlaneGCSSolver_PointWrapper(aNewPoint)); } -static EntityWrapperPtr createPoint(const AttributePtr& theAttribute, - PlaneGCSSolver_Storage* theStorage) -{ +static EntityWrapperPtr createPoint(const AttributePtr &theAttribute, + PlaneGCSSolver_Storage *theStorage) { std::shared_ptr aPoint2D = std::dynamic_pointer_cast(theAttribute); if (!aPoint2D) @@ -164,9 +167,8 @@ static EntityWrapperPtr createPoint(const AttributePtr& theAttribute, return createPoint(aPnt, theStorage); } -static EntityWrapperPtr createPointArray(const AttributePtr& theAttribute, - PlaneGCSSolver_Storage* theStorage) -{ +static EntityWrapperPtr createPointArray(const AttributePtr &theAttribute, + PlaneGCSSolver_Storage *theStorage) { std::shared_ptr aPointArray = std::dynamic_pointer_cast(theAttribute); if (!aPointArray) @@ -182,9 +184,8 @@ static EntityWrapperPtr createPointArray(const AttributePtr& theAttribute, return EntityWrapperPtr(new PlaneGCSSolver_PointArrayWrapper(aPointWrappers)); } -EntityWrapperPtr PlaneGCSSolver_AttributeBuilder::createAttribute( - AttributePtr theAttribute) -{ +EntityWrapperPtr +PlaneGCSSolver_AttributeBuilder::createAttribute(AttributePtr theAttribute) { EntityWrapperPtr aResult; if (myStorage) aResult = myStorage->entity(theAttribute); @@ -204,9 +205,7 @@ EntityWrapperPtr PlaneGCSSolver_AttributeBuilder::createAttribute( } bool PlaneGCSSolver_AttributeBuilder::updateAttribute( - AttributePtr theAttribute, - EntityWrapperPtr theEntity) -{ + AttributePtr theAttribute, EntityWrapperPtr theEntity) { bool isUpdated = false; GCS::SET_pD aParamsToRemove; // rebuild array if its size is changed @@ -241,25 +240,24 @@ bool PlaneGCSSolver_AttributeBuilder::updateAttribute( } aWrapper->setArray(aPointsArray); - } - else { + } else { // update coordinates of points for (int anIndex = 0; aPos != aPointsArray.end(); ++aPos, ++anIndex) { - const GCSPointPtr& aGCSPoint = (*aPos)->point(); + const GCSPointPtr &aGCSPoint = (*aPos)->point(); GeomPnt2dPtr aCoord = anAttribute->pnt(anIndex); *aGCSPoint->x = aCoord->x(); *aGCSPoint->y = aCoord->y(); } } - } - else if (theEntity->type() == ENTITY_SCALAR_ARRAY) { + } else if (theEntity->type() == ENTITY_SCALAR_ARRAY) { std::shared_ptr aWrapper = std::dynamic_pointer_cast(theEntity); - if (aWrapper->size() != PlaneGCSSolver_Tools::AttributeArray(theAttribute).size()) { + if (aWrapper->size() != + PlaneGCSSolver_Tools::AttributeArray(theAttribute).size()) { aParamsToRemove = PlaneGCSSolver_Tools::parameters(aWrapper); std::shared_ptr aNewArray = std::dynamic_pointer_cast( - createScalarArray(theAttribute, myStorage)); + createScalarArray(theAttribute, myStorage)); aWrapper->setArray(aNewArray->array()); isUpdated = true; } @@ -270,7 +268,7 @@ bool PlaneGCSSolver_AttributeBuilder::updateAttribute( myStorage->removeParameters(aParamsToRemove); else { std::for_each(aParamsToRemove.begin(), aParamsToRemove.end(), - [](double* theParam) { delete theParam; }); + [](double *theParam) { delete theParam; }); } } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h index 804d21c87..b1e7fa494 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_AttributeBuilder_H_ @@ -24,13 +25,13 @@ /** \class PlaneGCSSolver_AttributeBuilder * \ingroup Plugins - * \brief Converts ModelAPI_Attribute to the entity applicable for PlaneGCS solver + * \brief Converts ModelAPI_Attribute to the entity applicable for PlaneGCS + * solver */ -class PlaneGCSSolver_AttributeBuilder : public PlaneGCSSolver_EntityBuilder -{ +class PlaneGCSSolver_AttributeBuilder : public PlaneGCSSolver_EntityBuilder { public: - PlaneGCSSolver_AttributeBuilder(PlaneGCSSolver_Storage* theStorage = 0); - PlaneGCSSolver_AttributeBuilder(const StoragePtr& theStorage); + PlaneGCSSolver_AttributeBuilder(PlaneGCSSolver_Storage *theStorage = 0); + PlaneGCSSolver_AttributeBuilder(const StoragePtr &theStorage); /// \brief Converts an attribute to the solver's entity. /// Double attributes and 2D points are supported only. @@ -40,11 +41,13 @@ public: /// \brief Update entity by the attribute values. /// \return \c true if any value is updated. - virtual bool updateAttribute(AttributePtr theAttribute, EntityWrapperPtr theEntity); + virtual bool updateAttribute(AttributePtr theAttribute, + EntityWrapperPtr theEntity); /// \brief Blank. To be defined in derived class. - virtual EntityWrapperPtr createFeature(FeaturePtr) - { return EntityWrapperPtr(); } + virtual EntityWrapperPtr createFeature(FeaturePtr) { + return EntityWrapperPtr(); + } }; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.cpp index 26a06b0b9..c6bd1f40f 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,12 +23,9 @@ #include PlaneGCSSolver_BooleanWrapper::PlaneGCSSolver_BooleanWrapper(bool theParam) - : myValue(theParam) -{ -} + : myValue(theParam) {} -bool PlaneGCSSolver_BooleanWrapper::update(AttributePtr theAttribute) -{ +bool PlaneGCSSolver_BooleanWrapper::update(AttributePtr theAttribute) { bool isUpdated = false; AttributeBooleanPtr aBoolean = std::dynamic_pointer_cast(theAttribute); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h index 9664f2569..07ccb1ebf 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_BooleanWrapper_H_ @@ -26,25 +27,22 @@ /** * Wrapper providing storage for boolean values. */ -class PlaneGCSSolver_BooleanWrapper : public PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_BooleanWrapper : public PlaneGCSSolver_EntityWrapper { public: PlaneGCSSolver_BooleanWrapper(bool theValue); /// \brief Change value of parameter - void setValue(bool theValue) - { myValue = theValue; } + void setValue(bool theValue) { myValue = theValue; } /// \brief Return value of parameter - bool value() const - { return myValue; } + bool value() const { return myValue; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const - { return ENTITY_BOOLEAN; } + virtual SketchSolver_EntityType type() const { return ENTITY_BOOLEAN; } protected: /// \brief Update entity by the values of theAttribute - /// \return \c true if any value of attribute is not equal to the stored in the entity + /// \return \c true if any value of attribute is not equal to the stored in + /// the entity virtual bool update(std::shared_ptr theAttribute); protected: diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.cpp index c3d62ff6a..9536d9dab 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.cpp @@ -14,45 +14,39 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include PlaneGCSSolver_ConstraintWrapper::PlaneGCSSolver_ConstraintWrapper( - const GCSConstraintPtr& theConstraint, - const SketchSolver_ConstraintType& theType) - : myGCSConstraints(1, theConstraint), - myType(theType) -{ + const GCSConstraintPtr &theConstraint, + const SketchSolver_ConstraintType &theType) + : myGCSConstraints(1, theConstraint), myType(theType) { myID = CID_UNKNOWN; } PlaneGCSSolver_ConstraintWrapper::PlaneGCSSolver_ConstraintWrapper( - const std::list& theConstraints, - const SketchSolver_ConstraintType& theType) - : myGCSConstraints(theConstraints), - myType(theType) -{ + const std::list &theConstraints, + const SketchSolver_ConstraintType &theType) + : myGCSConstraints(theConstraints), myType(theType) { myID = CID_UNKNOWN; } -void PlaneGCSSolver_ConstraintWrapper::setId(const ConstraintID& theID) -{ +void PlaneGCSSolver_ConstraintWrapper::setId(const ConstraintID &theID) { myID = theID; } -void PlaneGCSSolver_ConstraintWrapper::setValueParameter(const ScalarWrapperPtr& theValue) -{ +void PlaneGCSSolver_ConstraintWrapper::setValueParameter( + const ScalarWrapperPtr &theValue) { myValueParam = theValue; } -void PlaneGCSSolver_ConstraintWrapper::setValue(const double& theValue) -{ +void PlaneGCSSolver_ConstraintWrapper::setValue(const double &theValue) { myValueParam->setValue(theValue); } -double PlaneGCSSolver_ConstraintWrapper::value() const -{ +double PlaneGCSSolver_ConstraintWrapper::value() const { return myValueParam ? myValueParam->value() : 0.0; } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h index 95b83aa74..c515cd0bb 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_ConstraintWrapper_H_ @@ -28,46 +29,45 @@ /** * Wrapper providing operations with PlaneGCS constraints. */ -class PlaneGCSSolver_ConstraintWrapper -{ +class PlaneGCSSolver_ConstraintWrapper { public: - PlaneGCSSolver_ConstraintWrapper(const GCSConstraintPtr& theConstraint, - const SketchSolver_ConstraintType& theType); - PlaneGCSSolver_ConstraintWrapper(const std::list& theConstraints, - const SketchSolver_ConstraintType& theType); + PlaneGCSSolver_ConstraintWrapper(const GCSConstraintPtr &theConstraint, + const SketchSolver_ConstraintType &theType); + PlaneGCSSolver_ConstraintWrapper( + const std::list &theConstraints, + const SketchSolver_ConstraintType &theType); /// \brief Return list of constraints - const std::list& constraints() const - { return myGCSConstraints; } + const std::list &constraints() const { + return myGCSConstraints; + } /// \brief Change list of constraints - void setConstraints(const std::list& theConstraints) - { myGCSConstraints = theConstraints; } + void setConstraints(const std::list &theConstraints) { + myGCSConstraints = theConstraints; + } /// \brief Return ID of current constraint - const ConstraintID& id() const - { return myID; } + const ConstraintID &id() const { return myID; } /// \brief Change constraint ID - virtual void setId(const ConstraintID& theID); + virtual void setId(const ConstraintID &theID); /// \brief Return type of current entity - virtual SketchSolver_ConstraintType type() const - { return myType; } + virtual SketchSolver_ConstraintType type() const { return myType; } /// \brief Assign numeric parameter of constraint - virtual void setValue(const double& theValue); + virtual void setValue(const double &theValue); /// \brief Return numeric parameter of constraint virtual double value() const; /// \brief Change parameter representing the value of constraint - void setValueParameter(const ScalarWrapperPtr& theValue); + void setValueParameter(const ScalarWrapperPtr &theValue); /// \brief Return parametric representation of constraint value - const ScalarWrapperPtr& valueParameter() const - { return myValueParam; } + const ScalarWrapperPtr &valueParameter() const { return myValueParam; } private: - ConstraintID myID; + ConstraintID myID; SketchSolver_ConstraintType myType; - ScalarWrapperPtr myValueParam; + ScalarWrapperPtr myValueParam; std::list myGCSConstraints; }; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h index f2250b169..644490fa5 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_Defs_H_ @@ -24,9 +25,9 @@ #include #include -typedef std::shared_ptr GCSPointPtr; -typedef std::shared_ptr GCSCurvePtr; -typedef std::shared_ptr GCSConstraintPtr; +typedef std::shared_ptr GCSPointPtr; +typedef std::shared_ptr GCSCurvePtr; +typedef std::shared_ptr GCSConstraintPtr; // Tolerance for value of parameters const double tolerance = 1.e-10; @@ -37,9 +38,9 @@ const double tolerance = 1.e-10; typedef int ConstraintID; // Predefined values for identifiers -const ConstraintID CID_UNKNOWN = 0; +const ConstraintID CID_UNKNOWN = 0; const ConstraintID CID_MOVEMENT = -1; -const ConstraintID CID_FICTIVE = 99; +const ConstraintID CID_FICTIVE = 99; /// Types of entities enum SketchSolver_EntityType { @@ -61,11 +62,12 @@ enum SketchSolver_EntityType { /// Types of constraints enum SketchSolver_ConstraintType { CONSTRAINT_UNKNOWN = 0, - CONSTRAINT_COINCIDENCE, // base coincidence if we don't know exact type yet + CONSTRAINT_COINCIDENCE, // base coincidence if we don't know exact type yet CONSTRAINT_PT_PT_COINCIDENT, CONSTRAINT_PT_ON_CURVE, CONSTRAINT_MIDDLE_POINT, - CONSTRAINT_DISTANCE, // base distance if we don't know the measured objects yet + CONSTRAINT_DISTANCE, // base distance if we don't know the measured objects + // yet CONSTRAINT_PT_PT_DISTANCE, CONSTRAINT_PT_LINE_DISTANCE, CONSTRAINT_HORIZONTAL_DISTANCE, @@ -79,12 +81,12 @@ enum SketchSolver_ConstraintType { CONSTRAINT_PERPENDICULAR, CONSTRAINT_PERPENDICULAR_CURVES, CONSTRAINT_SYMMETRIC, - CONSTRAINT_EQUAL, // base equality if we don't know the measured objects yet + CONSTRAINT_EQUAL, // base equality if we don't know the measured objects yet CONSTRAINT_EQUAL_LINES, CONSTRAINT_EQUAL_LINE_ARC, CONSTRAINT_EQUAL_RADIUS, CONSTRAINT_EQUAL_ELLIPSES, - CONSTRAINT_TANGENT, // base tangency if we don't know the measured objects yet + CONSTRAINT_TANGENT, // base tangency if we don't know the measured objects yet CONSTRAINT_TANGENT_CIRCLE_LINE, CONSTRAINT_TANGENT_CURVE_CURVE, CONSTRAINT_COLLINEAR, diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.cpp index 09ed04e01..dfcfd850e 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.cpp @@ -14,22 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -template -static bool isCurve(const GCSCurvePtr& theEntity) -{ +template static bool isCurve(const GCSCurvePtr &theEntity) { return std::dynamic_pointer_cast(theEntity).get(); } - -PlaneGCSSolver_EdgeWrapper::PlaneGCSSolver_EdgeWrapper(const GCSCurvePtr theEntity) - : myEntity(theEntity) -{ +PlaneGCSSolver_EdgeWrapper::PlaneGCSSolver_EdgeWrapper( + const GCSCurvePtr theEntity) + : myEntity(theEntity) { if (isCurve(myEntity)) myType = ENTITY_LINE; else if (isCurve(myEntity)) @@ -44,45 +42,48 @@ PlaneGCSSolver_EdgeWrapper::PlaneGCSSolver_EdgeWrapper(const GCSCurvePtr theEnti myType = ENTITY_BSPLINE; } -static double squareDistance(const GCS::Point& theP1, const GCS::Point& theP2) -{ +static double squareDistance(const GCS::Point &theP1, const GCS::Point &theP2) { double dx = *theP1.x - *theP2.x; double dy = *theP1.y - *theP2.y; - return dx*dx + dy*dy; + return dx * dx + dy * dy; } -bool PlaneGCSSolver_EdgeWrapper::isDegenerated() const -{ +bool PlaneGCSSolver_EdgeWrapper::isDegenerated() const { static const double THE_SQ_TOL = tolerance * 1e-2; static const double THE_ANGLE_TOL = 1.e-5; static const double THE_MAX_RADIUS = 1e8; static const double THE_SQ_MAX_RADIUS = THE_MAX_RADIUS * THE_MAX_RADIUS; if (myType == ENTITY_LINE) { - std::shared_ptr aLine = std::dynamic_pointer_cast(myEntity); + std::shared_ptr aLine = + std::dynamic_pointer_cast(myEntity); return squareDistance(aLine->p1, aLine->p2) < THE_SQ_TOL; - } - else if (myType == ENTITY_CIRCLE) { - std::shared_ptr aCircle = std::dynamic_pointer_cast(myEntity); + } else if (myType == ENTITY_CIRCLE) { + std::shared_ptr aCircle = + std::dynamic_pointer_cast(myEntity); return *aCircle->rad < tolerance || *aCircle->rad > THE_MAX_RADIUS; - } - else if (myType == ENTITY_ARC) { - std::shared_ptr anArc = std::dynamic_pointer_cast(myEntity); + } else if (myType == ENTITY_ARC) { + std::shared_ptr anArc = + std::dynamic_pointer_cast(myEntity); double anAngleDiff = fabs(*anArc->startAngle - *anArc->endAngle); double aSqRadius = squareDistance(anArc->center, anArc->start); - return aSqRadius < THE_SQ_TOL || aSqRadius > THE_SQ_MAX_RADIUS || // <- arc radius - anAngleDiff < THE_ANGLE_TOL || fabs(anAngleDiff - 2*PI) < THE_ANGLE_TOL; // <- arc angle - } - else if (myType == ENTITY_ELLIPSE) { - std::shared_ptr anEllipse = std::dynamic_pointer_cast(myEntity); - return *anEllipse->radmin < tolerance || anEllipse->getRadMaj() > THE_MAX_RADIUS; - } - else if (myType == ENTITY_ELLIPTIC_ARC) { + return aSqRadius < THE_SQ_TOL || + aSqRadius > THE_SQ_MAX_RADIUS || // <- arc radius + anAngleDiff < THE_ANGLE_TOL || + fabs(anAngleDiff - 2 * PI) < THE_ANGLE_TOL; // <- arc angle + } else if (myType == ENTITY_ELLIPSE) { + std::shared_ptr anEllipse = + std::dynamic_pointer_cast(myEntity); + return *anEllipse->radmin < tolerance || + anEllipse->getRadMaj() > THE_MAX_RADIUS; + } else if (myType == ENTITY_ELLIPTIC_ARC) { std::shared_ptr anArc = std::dynamic_pointer_cast(myEntity); double anAngleDiff = fabs(*anArc->startAngle - *anArc->endAngle); - return *anArc->radmin < THE_SQ_TOL || anArc->getRadMaj() > THE_SQ_MAX_RADIUS || // <- arc radius - anAngleDiff < THE_ANGLE_TOL || fabs(anAngleDiff - 2*PI) < THE_ANGLE_TOL; // <- arc angle + return *anArc->radmin < THE_SQ_TOL || + anArc->getRadMaj() > THE_SQ_MAX_RADIUS || // <- arc radius + anAngleDiff < THE_ANGLE_TOL || + fabs(anAngleDiff - 2 * PI) < THE_ANGLE_TOL; // <- arc angle } return false; } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h index a8cc5a2ad..36401f8f8 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h @@ -14,42 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_EdgeWrapper_H_ #define PlaneGCSSolver_EdgeWrapper_H_ -#include #include +#include #include /** - * Wrapper providing operations with PlaneGCS entities (lines, circles and arcs). + * Wrapper providing operations with PlaneGCS entities (lines, circles and + * arcs). */ -class PlaneGCSSolver_EdgeWrapper : public PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_EdgeWrapper : public PlaneGCSSolver_EntityWrapper { public: PlaneGCSSolver_EdgeWrapper(const GCSCurvePtr theEntity); /// \brief Return PlaneGCS geometric entity - const GCSCurvePtr& entity() const - { return myEntity; } + const GCSCurvePtr &entity() const { return myEntity; } /// \brief Return PlaneGCS geometric entity to change - GCSCurvePtr& changeEntity() - { return myEntity; } + GCSCurvePtr &changeEntity() { return myEntity; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const - { return myType; } + virtual SketchSolver_EntityType type() const { return myType; } bool isDegenerated() const; - void setReversed(BooleanWrapperPtr theReversed) - { myReversed = theReversed; } + void setReversed(BooleanWrapperPtr theReversed) { myReversed = theReversed; } - bool isReversed() const - { return myReversed ? myReversed->value() : false; } + bool isReversed() const { return myReversed ? myReversed->value() : false; } private: SketchSolver_EntityType myType; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h index 1ebb642e7..f00b39a1b 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_EntityBuilder_H_ @@ -25,17 +26,16 @@ /** \class PlaneGCSSolver_EntityBuilder * \ingroup Plugins - * \brief API to convert data model entity to the entity applicable for PlaneGCS solver + * \brief API to convert data model entity to the entity applicable for + * PlaneGCS solver */ -class PlaneGCSSolver_EntityBuilder -{ +class PlaneGCSSolver_EntityBuilder { public: /// \brief Create entity in the given storage. /// If the storage is empty, the entity should not be changed /// while constraint solving. So, it is created out of the storage. - PlaneGCSSolver_EntityBuilder(PlaneGCSSolver_Storage* theStorage = 0) - : myStorage(theStorage) - {} + PlaneGCSSolver_EntityBuilder(PlaneGCSSolver_Storage *theStorage = 0) + : myStorage(theStorage) {} virtual ~PlaneGCSSolver_EntityBuilder() {} @@ -51,7 +51,7 @@ public: virtual EntityWrapperPtr createFeature(FeaturePtr) = 0; protected: - PlaneGCSSolver_Storage* myStorage; + PlaneGCSSolver_Storage *myStorage; }; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.cpp index 181bee37b..b6004f0c4 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.cpp @@ -14,18 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include +#include #include #include -#include #include -void PlaneGCSSolver_EntityDestroyer::remove(const EntityWrapperPtr& theEntity) -{ +void PlaneGCSSolver_EntityDestroyer::remove(const EntityWrapperPtr &theEntity) { GCS::SET_pD aParameters = PlaneGCSSolver_Tools::parameters(theEntity); if (theEntity->isExternal()) myParamsOutOfStorage.insert(aParameters.begin(), aParameters.end()); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h index c8fb378a3..9395a79cf 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_EntityDestroyer_H_ @@ -27,21 +28,21 @@ * \ingroup Plugins * \brief Collect entities of PlaneGCS solver which should be removed */ -class PlaneGCSSolver_EntityDestroyer -{ +class PlaneGCSSolver_EntityDestroyer { public: PlaneGCSSolver_EntityDestroyer() {} - /// \brief Add entity to remove. Its parameters are stored for further remove from the storage. - void remove(const EntityWrapperPtr& theEntity); + /// \brief Add entity to remove. Its parameters are stored for further remove + /// from the storage. + void remove(const EntityWrapperPtr &theEntity); /// \brief Return parameters to remove - const GCS::SET_pD& parametersToRemove() - { return myParams; } + const GCS::SET_pD ¶metersToRemove() { return myParams; } private: GCS::SET_pD myParams; ///< set of parameters to be removed - GCS::SET_pD myParamsOutOfStorage; ///< set of parameters not kept in the storage + GCS::SET_pD + myParamsOutOfStorage; ///< set of parameters not kept in the storage }; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h index 3edd5c319..2f0eb5af5 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_EntityWrapper_H_ @@ -33,8 +34,7 @@ typedef std::shared_ptr EntityWrapperPtr; /** * Wrapper providing operations with entities regardless the solver. */ -class PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_EntityWrapper { public: PlaneGCSSolver_EntityWrapper() : myExternal(false) {} virtual ~PlaneGCSSolver_EntityWrapper() {} @@ -48,17 +48,22 @@ public: bool isExternal() const { return myExternal; } /// \brief Store names of attributes and their values if necessary - void setAdditionalAttributes(const std::map& theAttribues) - { myAdditionalAttributes = theAttribues; } + void setAdditionalAttributes( + const std::map &theAttribues) { + myAdditionalAttributes = theAttribues; + } /// \brief Return the list of additional attributes - const std::map& additionalAttributes() const - { return myAdditionalAttributes; } + const std::map &additionalAttributes() const { + return myAdditionalAttributes; + } protected: /// \brief Update entity by the values of theAttribute - /// \return \c true if any value of attribute is not equal to the stored in the entity - virtual bool update(std::shared_ptr theAttribute) - { return false; } + /// \return \c true if any value of attribute is not equal to the stored in + /// the entity + virtual bool update(std::shared_ptr theAttribute) { + return false; + } friend class PlaneGCSSolver_AttributeBuilder; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp index 3eee24b31..b89cc7c4c 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include #include -#include #include -#include +#include #include +#include #include #include @@ -41,43 +42,39 @@ #include #include - -static EntityWrapperPtr createLine(const AttributeEntityMap& theAttributes); -static EntityWrapperPtr createCircle(const AttributeEntityMap& theAttributes); -static EntityWrapperPtr createArc(const AttributeEntityMap& theAttributes, - PlaneGCSSolver_Storage* theStorage); -static EntityWrapperPtr createEllipse(const AttributeEntityMap& theAttributes); -static EntityWrapperPtr createEllipticArc(const AttributeEntityMap& theAttributes, - PlaneGCSSolver_Storage* theStorage); +static EntityWrapperPtr createLine(const AttributeEntityMap &theAttributes); +static EntityWrapperPtr createCircle(const AttributeEntityMap &theAttributes); +static EntityWrapperPtr createArc(const AttributeEntityMap &theAttributes, + PlaneGCSSolver_Storage *theStorage); +static EntityWrapperPtr createEllipse(const AttributeEntityMap &theAttributes); +static EntityWrapperPtr +createEllipticArc(const AttributeEntityMap &theAttributes, + PlaneGCSSolver_Storage *theStorage); template -static EntityWrapperPtr createBSpline(const AttributeEntityMap& theAttributes); - +static EntityWrapperPtr createBSpline(const AttributeEntityMap &theAttributes); PlaneGCSSolver_FeatureBuilder::PlaneGCSSolver_FeatureBuilder( - PlaneGCSSolver_Storage* theStorage) - : PlaneGCSSolver_AttributeBuilder(theStorage) -{ -} + PlaneGCSSolver_Storage *theStorage) + : PlaneGCSSolver_AttributeBuilder(theStorage) {} -PlaneGCSSolver_FeatureBuilder::PlaneGCSSolver_FeatureBuilder(const StoragePtr& theStorage) - : PlaneGCSSolver_AttributeBuilder(theStorage) -{ -} +PlaneGCSSolver_FeatureBuilder::PlaneGCSSolver_FeatureBuilder( + const StoragePtr &theStorage) + : PlaneGCSSolver_AttributeBuilder(theStorage) {} -EntityWrapperPtr PlaneGCSSolver_FeatureBuilder::createAttribute( - AttributePtr theAttribute) -{ +EntityWrapperPtr +PlaneGCSSolver_FeatureBuilder::createAttribute(AttributePtr theAttribute) { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); EntityWrapperPtr anAttr; - if (PlaneGCSSolver_Tools::isAttributeApplicable(theAttribute->id(), anOwner->getKind())) + if (PlaneGCSSolver_Tools::isAttributeApplicable(theAttribute->id(), + anOwner->getKind())) anAttr = PlaneGCSSolver_AttributeBuilder::createAttribute(theAttribute); if (anAttr) myAttributes[theAttribute] = anAttr; return anAttr; } -EntityWrapperPtr PlaneGCSSolver_FeatureBuilder::createFeature(FeaturePtr theFeature) -{ +EntityWrapperPtr +PlaneGCSSolver_FeatureBuilder::createFeature(FeaturePtr theFeature) { EntityWrapperPtr aResult; if (myStorage) aResult = myStorage->entity(theFeature); @@ -91,7 +88,7 @@ EntityWrapperPtr PlaneGCSSolver_FeatureBuilder::createFeature(FeaturePtr theFeat return aResult; // Verify the feature by its kind - const std::string& aFeatureKind = aFeature->getKind(); + const std::string &aFeatureKind = aFeature->getKind(); // Line if (aFeatureKind == SketchPlugin_Line::ID()) aResult = createLine(myAttributes); @@ -112,7 +109,8 @@ EntityWrapperPtr PlaneGCSSolver_FeatureBuilder::createFeature(FeaturePtr theFeat aResult = createBSpline(myAttributes); else if (aFeatureKind == SketchPlugin_BSplinePeriodic::ID()) aResult = createBSpline(myAttributes); - // Point (it has low probability to be an attribute of constraint, so it is checked at the end) + // Point (it has low probability to be an attribute of constraint, so it is + // checked at the end) else if (aFeatureKind == SketchPlugin_Point::ID() || aFeatureKind == SketchPlugin_IntersectionPoint::ID()) { AttributeEntityMap::const_iterator anIt = myAttributes.begin(); @@ -130,13 +128,8 @@ EntityWrapperPtr PlaneGCSSolver_FeatureBuilder::createFeature(FeaturePtr theFeat return aResult; } - - - - // ============== Auxiliary functions ===================================== -EntityWrapperPtr createLine(const AttributeEntityMap& theAttributes) -{ +EntityWrapperPtr createLine(const AttributeEntityMap &theAttributes) { std::shared_ptr aNewLine(new GCS::Line); AttributeEntityMap::const_iterator anIt = theAttributes.begin(); @@ -155,8 +148,7 @@ EntityWrapperPtr createLine(const AttributeEntityMap& theAttributes) return EntityWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aNewLine)); } -EntityWrapperPtr createCircle(const AttributeEntityMap& theAttributes) -{ +EntityWrapperPtr createCircle(const AttributeEntityMap &theAttributes) { std::shared_ptr aNewCircle(new GCS::Circle); AttributeEntityMap::const_iterator anIt = theAttributes.begin(); @@ -165,8 +157,7 @@ EntityWrapperPtr createCircle(const AttributeEntityMap& theAttributes) std::shared_ptr aPoint = std::dynamic_pointer_cast(anIt->second); aNewCircle->center = *(aPoint->point()); - } - else if(anIt->first->id() == SketchPlugin_Circle::RADIUS_ID()) { + } else if (anIt->first->id() == SketchPlugin_Circle::RADIUS_ID()) { ScalarWrapperPtr aScalar = std::dynamic_pointer_cast(anIt->second); aNewCircle->rad = aScalar->scalar(); @@ -176,14 +167,12 @@ EntityWrapperPtr createCircle(const AttributeEntityMap& theAttributes) return EntityWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aNewCircle)); } -static double* createParameter(PlaneGCSSolver_Storage* theStorage) -{ +static double *createParameter(PlaneGCSSolver_Storage *theStorage) { return theStorage ? theStorage->createParameter() : (new double(0)); } -EntityWrapperPtr createArc(const AttributeEntityMap& theAttributes, - PlaneGCSSolver_Storage* theStorage) -{ +EntityWrapperPtr createArc(const AttributeEntityMap &theAttributes, + PlaneGCSSolver_Storage *theStorage) { std::shared_ptr aNewArc(new GCS::Arc); BooleanWrapperPtr isReversed; @@ -199,18 +188,18 @@ EntityWrapperPtr createArc(const AttributeEntityMap& theAttributes, aNewArc->start = *(aPoint->point()); else if (anIt->first->id() == SketchPlugin_Arc::END_ID()) aNewArc->end = *(aPoint->point()); - } - else { + } else { // reversed flag - isReversed = std::dynamic_pointer_cast(anIt->second); + isReversed = std::dynamic_pointer_cast( + anIt->second); } } // Additional attributes of arc necessary for PlaneGCS solver // (start and end angles, radius) aNewArc->startAngle = createParameter(theStorage); - aNewArc->endAngle = createParameter(theStorage); - aNewArc->rad = createParameter(theStorage); + aNewArc->endAngle = createParameter(theStorage); + aNewArc->rad = createParameter(theStorage); EdgeWrapperPtr anArcWrapper(new PlaneGCSSolver_EdgeWrapper(aNewArc)); anArcWrapper->setReversed(isReversed); @@ -219,8 +208,7 @@ EntityWrapperPtr createArc(const AttributeEntityMap& theAttributes, return anArcWrapper; } -EntityWrapperPtr createEllipse(const AttributeEntityMap& theAttributes) -{ +EntityWrapperPtr createEllipse(const AttributeEntityMap &theAttributes) { std::shared_ptr aNewEllipse(new GCS::Ellipse); std::map anAdditionalAttributes; @@ -236,24 +224,22 @@ EntityWrapperPtr createEllipse(const AttributeEntityMap& theAttributes) aNewEllipse->focus1 = *(aPoint->point()); else anAdditionalAttributes[anIt->first->id()] = anIt->second; - } - else if (anIt->first->id() == SketchPlugin_Ellipse::MINOR_RADIUS_ID()) { + } else if (anIt->first->id() == SketchPlugin_Ellipse::MINOR_RADIUS_ID()) { ScalarWrapperPtr aScalar = std::dynamic_pointer_cast(anIt->second); aNewEllipse->radmin = aScalar->scalar(); - } - else + } else anAdditionalAttributes[anIt->first->id()] = anIt->second; } - EntityWrapperPtr anEllipseWrapper(new PlaneGCSSolver_EdgeWrapper(aNewEllipse)); + EntityWrapperPtr anEllipseWrapper( + new PlaneGCSSolver_EdgeWrapper(aNewEllipse)); anEllipseWrapper->setAdditionalAttributes(anAdditionalAttributes); return anEllipseWrapper; } -EntityWrapperPtr createEllipticArc(const AttributeEntityMap& theAttributes, - PlaneGCSSolver_Storage* theStorage) -{ +EntityWrapperPtr createEllipticArc(const AttributeEntityMap &theAttributes, + PlaneGCSSolver_Storage *theStorage) { std::shared_ptr aNewArc(new GCS::ArcOfEllipse); BooleanWrapperPtr isReversed; @@ -274,19 +260,20 @@ EntityWrapperPtr createEllipticArc(const AttributeEntityMap& theAttributes, aNewArc->end = *(aPoint->point()); else anAdditionalAttributes[anIt->first->id()] = anIt->second; - } - else if (anIt->first->id() == SketchPlugin_EllipticArc::MINOR_RADIUS_ID()) { + } else if (anIt->first->id() == + SketchPlugin_EllipticArc::MINOR_RADIUS_ID()) { ScalarWrapperPtr aScalar = std::dynamic_pointer_cast(anIt->second); aNewArc->radmin = aScalar->scalar(); - } - else if (anIt->first->id() == SketchPlugin_EllipticArc::REVERSED_ID()) - isReversed = std::dynamic_pointer_cast(anIt->second); + } else if (anIt->first->id() == SketchPlugin_EllipticArc::REVERSED_ID()) + isReversed = std::dynamic_pointer_cast( + anIt->second); else anAdditionalAttributes[anIt->first->id()] = anIt->second; } - // Additional attributes of elliptic arc necessary for PlaneGCS solver (start and end angles) + // Additional attributes of elliptic arc necessary for PlaneGCS solver (start + // and end angles) aNewArc->startAngle = createParameter(theStorage); aNewArc->endAngle = createParameter(theStorage); @@ -299,8 +286,7 @@ EntityWrapperPtr createEllipticArc(const AttributeEntityMap& theAttributes, } template -EntityWrapperPtr createBSpline(const AttributeEntityMap& theAttributes) -{ +EntityWrapperPtr createBSpline(const AttributeEntityMap &theAttributes) { std::shared_ptr aNewSpline(new GCS::BSplineImpl); aNewSpline->degree = 3; @@ -310,10 +296,11 @@ EntityWrapperPtr createBSpline(const AttributeEntityMap& theAttributes) AttributeEntityMap::const_iterator anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { - const std::string& anAttrID = anIt->first->id(); + const std::string &anAttrID = anIt->first->id(); if (anAttrID == TYPE::POLES_ID()) { PointArrayWrapperPtr anArray = - std::dynamic_pointer_cast(anIt->second); + std::dynamic_pointer_cast( + anIt->second); int aSize = anArray->size(); aNewSpline->poles.reserve(aSize); @@ -322,27 +309,26 @@ EntityWrapperPtr createBSpline(const AttributeEntityMap& theAttributes) aNewSpline->start = aNewSpline->poles.front(); aNewSpline->end = aNewSpline->poles.back(); - } - else if (anAttrID == TYPE::DEGREE_ID()) { + } else if (anAttrID == TYPE::DEGREE_ID()) { ScalarWrapperPtr aScalar = std::dynamic_pointer_cast(anIt->second); aNewSpline->degree = (int)aScalar->value(); - } - else if (anAttrID == SketchPlugin_BSpline::START_ID() || - anAttrID == SketchPlugin_BSpline::END_ID()) { + } else if (anAttrID == SketchPlugin_BSpline::START_ID() || + anAttrID == SketchPlugin_BSpline::END_ID()) { anAdditionalAttributes[anAttrID] = anIt->second; - } - else { + } else { ScalarArrayWrapperPtr anArray = - std::dynamic_pointer_cast(anIt->second); + std::dynamic_pointer_cast( + anIt->second); if (anAttrID == TYPE::WEIGHTS_ID()) aNewSpline->weights = anArray->array(); else if (anAttrID == TYPE::KNOTS_ID()) aNewSpline->knots = anArray->array(); else if (anAttrID == TYPE::MULTS_ID()) { - const GCS::VEC_pD& aValues = anArray->array(); + const GCS::VEC_pD &aValues = anArray->array(); aNewSpline->mult.reserve(aValues.size()); - for (GCS::VEC_pD::const_iterator anIt = aValues.begin(); anIt != aValues.end(); ++anIt) + for (GCS::VEC_pD::const_iterator anIt = aValues.begin(); + anIt != aValues.end(); ++anIt) aNewSpline->mult.push_back((int)(**anIt)); } } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h index 170bb957a..411f9c691 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_FeatureBuilder_H_ @@ -26,15 +27,16 @@ typedef std::map AttributeEntityMap; /** \class PlaneGCSSolver_FeatureBuilder * \ingroup Plugins - * \brief Converts SketchPlugin_Feature to the entity applicable for PlaneGCS solver + * \brief Converts SketchPlugin_Feature to the entity applicable for PlaneGCS + * solver */ -class PlaneGCSSolver_FeatureBuilder : public PlaneGCSSolver_AttributeBuilder -{ +class PlaneGCSSolver_FeatureBuilder : public PlaneGCSSolver_AttributeBuilder { public: - PlaneGCSSolver_FeatureBuilder(PlaneGCSSolver_Storage* theStorage = 0); - PlaneGCSSolver_FeatureBuilder(const StoragePtr& theStorage); + PlaneGCSSolver_FeatureBuilder(PlaneGCSSolver_Storage *theStorage = 0); + PlaneGCSSolver_FeatureBuilder(const StoragePtr &theStorage); - /// \brief Converts an attribute to the solver's entity and stores it for further processing. + /// \brief Converts an attribute to the solver's entity and stores it for + /// further processing. /// Double attributes and 2D points are supported only. /// \param theAttribute [in] attribute to create /// \return Created wrapper of the attribute applicable for specific solver diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp index 45ff24893..3e9a1963c 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,28 +26,25 @@ #include -namespace GCS -{ +namespace GCS { - static void periodicNormalization(double& theParam, double thePeriodStart, double thePeriodEnd) - { - double aPeriod = thePeriodEnd - thePeriodStart; - if (aPeriod > tolerance) { - theParam = std::max(thePeriodStart, - theParam + aPeriod * std::ceil((thePeriodStart - theParam) / aPeriod)); - } +static void periodicNormalization(double &theParam, double thePeriodStart, + double thePeriodEnd) { + double aPeriod = thePeriodEnd - thePeriodStart; + if (aPeriod > tolerance) { + theParam = std::max( + thePeriodStart, + theParam + aPeriod * std::ceil((thePeriodStart - theParam) / aPeriod)); } +} - -DeriVector2 BSplineImpl::Value(double u, double du, double* derivparam) -{ +DeriVector2 BSplineImpl::Value(double u, double du, double *derivparam) { DeriVector2 value, deriv; d1(u, derivparam, value, deriv); return value.sum(GCS::DeriVector2(0., 0., deriv.x, deriv.y).mult(du)); } -DeriVector2 BSplineImpl::CalculateNormal(Point &p, double* derivparam) -{ +DeriVector2 BSplineImpl::CalculateNormal(Point &p, double *derivparam) { double u = 0.0; if (!parameter(p, u)) return DeriVector2(); @@ -56,16 +54,11 @@ DeriVector2 BSplineImpl::CalculateNormal(Point &p, double* derivparam) return deriv.rotate90ccw(); } -BSplineImpl* BSplineImpl::Copy() -{ - return new BSplineImpl(*this); -} +BSplineImpl *BSplineImpl::Copy() { return new BSplineImpl(*this); } -void BSplineImpl::d1(double theU, - double* theDerivParam, - GCS::DeriVector2& theValue, - GCS::DeriVector2& theDerivative) -{ +void BSplineImpl::d1(double theU, double *theDerivParam, + GCS::DeriVector2 &theValue, + GCS::DeriVector2 &theDerivative) { int aSpan = spanIndex(theU); std::vector aPoles; std::vector aWeights; @@ -73,8 +66,7 @@ void BSplineImpl::d1(double theU, performDeBoor(theU, aSpan, aPoles, aWeights, theValue, theDerivative); } -int BSplineImpl::spanIndex(double& u) -{ +int BSplineImpl::spanIndex(double &u) { if (myFlatKnots.empty()) { // fill flat knots indices for (int i = 0; i < (int)mult.size(); ++i) @@ -85,13 +77,15 @@ int BSplineImpl::spanIndex(double& u) int anExtraEnd = degree + 1 - mult.back(); double aPeriod = *knots.back() - *knots.front(); VEC_D aNewFlatKnots; - aNewFlatKnots.reserve(myFlatKnots.size() + (size_t)(anExtraBegin + anExtraEnd)); + aNewFlatKnots.reserve(myFlatKnots.size() + + (size_t)(anExtraBegin + anExtraEnd)); auto it = myFlatKnots.end() - mult.back() - anExtraBegin; while (anExtraBegin > 0) { aNewFlatKnots.push_back(*(it++) - aPeriod); --anExtraBegin; } - aNewFlatKnots.insert(aNewFlatKnots.end(), myFlatKnots.begin(), myFlatKnots.end()); + aNewFlatKnots.insert(aNewFlatKnots.end(), myFlatKnots.begin(), + myFlatKnots.end()); it = myFlatKnots.begin() + mult.front(); while (anExtraEnd > 0) { aNewFlatKnots.push_back(*(it++) + aPeriod); @@ -113,28 +107,25 @@ int BSplineImpl::spanIndex(double& u) return anIndex; } -void BSplineImpl::spanPolesAndWeights(int theSpanIndex, - double* theDerivParam, - std::vector& thePoles, - std::vector& theWeights) const -{ +void BSplineImpl::spanPolesAndWeights(int theSpanIndex, double *theDerivParam, + std::vector &thePoles, + std::vector &theWeights) const { thePoles.reserve(degree + 1); theWeights.reserve(degree + 1); for (int i = theSpanIndex; i <= theSpanIndex + degree; ++i) { // optimization: weighted pole int idx = i % (int)poles.size(); - thePoles.push_back(GCS::DeriVector2(poles[idx], theDerivParam).mult(*weights[idx])); + thePoles.push_back( + GCS::DeriVector2(poles[idx], theDerivParam).mult(*weights[idx])); theWeights.push_back(*weights[idx]); } } -void BSplineImpl::performDeBoor(double theU, - int theSpanIndex, - std::vector& thePoles, - std::vector& theWeights, - GCS::DeriVector2& theValue, - GCS::DeriVector2& theDerivative) const -{ +void BSplineImpl::performDeBoor(double theU, int theSpanIndex, + std::vector &thePoles, + std::vector &theWeights, + GCS::DeriVector2 &theValue, + GCS::DeriVector2 &theDerivative) const { std::vector aPDeriv(thePoles.size(), DeriVector2()); std::vector aWDeriv(theWeights.size(), 0.0); for (int i = 0; i < degree; ++i) { @@ -142,10 +133,12 @@ void BSplineImpl::performDeBoor(double theU, double denom = (myFlatKnots[theSpanIndex + j + degree - i] - myFlatKnots[theSpanIndex + j]); double a = (theU - myFlatKnots[theSpanIndex + j]) / denom; - aPDeriv[j] = aPDeriv[j].linCombi(a, aPDeriv[j - 1], 1.0 - a).sum( - thePoles[j].subtr(thePoles[j - 1]).mult(1.0 / denom)); - aWDeriv[j] = aWDeriv[j] * a + aWDeriv[j - 1] * (1.0 - a) - + (theWeights[j] - theWeights[j - 1]) / denom; + aPDeriv[j] = + aPDeriv[j] + .linCombi(a, aPDeriv[j - 1], 1.0 - a) + .sum(thePoles[j].subtr(thePoles[j - 1]).mult(1.0 / denom)); + aWDeriv[j] = aWDeriv[j] * a + aWDeriv[j - 1] * (1.0 - a) + + (theWeights[j] - theWeights[j - 1]) / denom; thePoles[j] = thePoles[j].linCombi(a, thePoles[j - 1], 1.0 - a); theWeights[j] = theWeights[j] * a + theWeights[j - 1] * (1.0 - a); } @@ -155,23 +148,25 @@ void BSplineImpl::performDeBoor(double theU, theDerivative = aPDeriv[degree].subtr(theValue.mult(aWDeriv[degree])).mult(w); } -bool BSplineImpl::parameter(const Point& thePoint, double& theParam) const -{ +bool BSplineImpl::parameter(const Point &thePoint, double &theParam) const { std::list aPoles; std::list aWeights; std::list aKnots; std::list aMults; - for (GCS::VEC_P::const_iterator anIt = poles.begin(); anIt != poles.end(); ++anIt) + for (GCS::VEC_P::const_iterator anIt = poles.begin(); anIt != poles.end(); + ++anIt) aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*anIt->x, *anIt->y))); - for (GCS::VEC_pD::const_iterator anIt = weights.begin(); anIt != weights.end(); ++anIt) + for (GCS::VEC_pD::const_iterator anIt = weights.begin(); + anIt != weights.end(); ++anIt) aWeights.push_back(**anIt); - for (GCS::VEC_pD::const_iterator anIt = knots.begin(); anIt != knots.end(); ++anIt) + for (GCS::VEC_pD::const_iterator anIt = knots.begin(); anIt != knots.end(); + ++anIt) aKnots.push_back(**anIt); aMults.assign(mult.begin(), mult.end()); - std::shared_ptr aCurve( - new GeomAPI_BSpline2d(degree, aPoles, aWeights, aKnots, aMults, periodic)); + std::shared_ptr aCurve(new GeomAPI_BSpline2d( + degree, aPoles, aWeights, aKnots, aMults, periodic)); GeomPnt2dPtr aPoint(new GeomAPI_Pnt2d(*thePoint.x, *thePoint.y)); return aCurve->parameter(aPoint, 1e100, theParam); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h index 6a23dd15c..98d4c2aa4 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_GeomExtensions_H_ @@ -23,43 +24,44 @@ #include namespace GCS { - /// \brife SHAPER's implementation of B-spline curves in PlaneGCS solver - class BSplineImpl : public BSpline - { - public: - virtual DeriVector2 Value(double u, double du, double* derivparam = 0); - virtual DeriVector2 CalculateNormal(Point &p, double* derivparam = 0); +/// \brife SHAPER's implementation of B-spline curves in PlaneGCS solver +class BSplineImpl : public BSpline { +public: + virtual DeriVector2 Value(double u, double du, double *derivparam = 0); + virtual DeriVector2 CalculateNormal(Point &p, double *derivparam = 0); - virtual BSplineImpl* Copy(); + virtual BSplineImpl *Copy(); - private: - /// Return the index of start knot for the given parameter. - /// Parameter is updated accordingly, if the B-spline curve is periodic - /// and the parameter is out of period. - int spanIndex(double& u); +private: + /// Return the index of start knot for the given parameter. + /// Parameter is updated accordingly, if the B-spline curve is periodic + /// and the parameter is out of period. + int spanIndex(double &u); - /// Collect the list of poles and their weights affecting the given span - void spanPolesAndWeights(int theSpanIndex, - double* theDerivParam, - std::vector& thePoles, - std::vector& theWeights) const; + /// Collect the list of poles and their weights affecting the given span + void spanPolesAndWeights(int theSpanIndex, double *theDerivParam, + std::vector &thePoles, + std::vector &theWeights) const; - /// Execute De Boor algorithm to calculate B-spline curve's value - void performDeBoor(double theU, int theSpanIndex, - std::vector& thePoles, std::vector& theWeights, - GCS::DeriVector2& theValue, GCS::DeriVector2& theDerivative) const; + /// Execute De Boor algorithm to calculate B-spline curve's value + void performDeBoor(double theU, int theSpanIndex, + std::vector &thePoles, + std::vector &theWeights, + GCS::DeriVector2 &theValue, + GCS::DeriVector2 &theDerivative) const; - /// Calculate the value and the first derivative for the given parameter on B-spline - void d1(double theU, double* theDerivParam, - GCS::DeriVector2& theValue, GCS::DeriVector2& theDerivative); + /// Calculate the value and the first derivative for the given parameter on + /// B-spline + void d1(double theU, double *theDerivParam, GCS::DeriVector2 &theValue, + GCS::DeriVector2 &theDerivative); - /// Find the parameter on B-spline corresponding to the given point - /// \return \c false if it is unable to calculate the parameter - bool parameter(const Point& thePoint, double& theParam) const; + /// Find the parameter on B-spline corresponding to the given point + /// \return \c false if it is unable to calculate the parameter + bool parameter(const Point &thePoint, double &theParam) const; - private: - VEC_D myFlatKnots; /// indices of knots duplicated by multiplicity - }; -} +private: + VEC_D myFlatKnots; /// indices of knots duplicated by multiplicity +}; +} // namespace GCS #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp index 13d280df5..80ff8da32 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -25,13 +26,10 @@ #include PlaneGCSSolver_PointArrayWrapper::PlaneGCSSolver_PointArrayWrapper( - const std::vector& thePoints) - : myPoints(thePoints) -{ -} + const std::vector &thePoints) + : myPoints(thePoints) {} -bool PlaneGCSSolver_PointArrayWrapper::update(AttributePtr theAttribute) -{ +bool PlaneGCSSolver_PointArrayWrapper::update(AttributePtr theAttribute) { bool isUpdated = false; std::shared_ptr aPointArray = std::dynamic_pointer_cast(theAttribute); @@ -40,9 +38,13 @@ bool PlaneGCSSolver_PointArrayWrapper::update(AttributePtr theAttribute) for (int anIndex = 0; aPIt != myPoints.end(); ++aPIt, ++anIndex) { GeomPnt2dPtr aPnt = aPointArray->pnt(anIndex); - const GCSPointPtr& aGCSPoint = (*aPIt)->point(); - isUpdated = PlaneGCSSolver_Tools::updateValue(aPnt->x(), *(aGCSPoint->x)) || isUpdated; - isUpdated = PlaneGCSSolver_Tools::updateValue(aPnt->y(), *(aGCSPoint->y)) || isUpdated; + const GCSPointPtr &aGCSPoint = (*aPIt)->point(); + isUpdated = + PlaneGCSSolver_Tools::updateValue(aPnt->x(), *(aGCSPoint->x)) || + isUpdated; + isUpdated = + PlaneGCSSolver_Tools::updateValue(aPnt->y(), *(aGCSPoint->y)) || + isUpdated; } } return isUpdated; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h index 58d93c621..200ad3d52 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_PointArrayWrapper_H_ @@ -26,30 +27,33 @@ /** * Wrapper providing operations with arrays of PlaneGCS points. */ -class PlaneGCSSolver_PointArrayWrapper : public PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_PointArrayWrapper : public PlaneGCSSolver_EntityWrapper { public: - PlaneGCSSolver_PointArrayWrapper(const std::vector& thePoints); + PlaneGCSSolver_PointArrayWrapper( + const std::vector &thePoints); /// \brief Return wrapper of PlaneGCS point - const PointWrapperPtr& value(const int theIndex) const - { return myPoints[theIndex]; } + const PointWrapperPtr &value(const int theIndex) const { + return myPoints[theIndex]; + } /// \breif Size of array int size() const { return (int)myPoints.size(); } /// \brief Return array of points - const std::vector& array() const { return myPoints; } + const std::vector &array() const { return myPoints; } /// \breif Set points - void setArray(const std::vector& thePoints) { myPoints = thePoints; } + void setArray(const std::vector &thePoints) { + myPoints = thePoints; + } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const - { return ENTITY_POINT_ARRAY; } + virtual SketchSolver_EntityType type() const { return ENTITY_POINT_ARRAY; } protected: /// \brief Update entity by the values of theAttribute - /// \return \c true if any value of attribute is not equal to the stored in the entity + /// \return \c true if any value of attribute is not equal to the stored in + /// the entity virtual bool update(std::shared_ptr theAttribute); private: diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp index ed6ee28fb..6a0437fd6 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,19 +23,21 @@ #include -PlaneGCSSolver_PointWrapper::PlaneGCSSolver_PointWrapper(const GCSPointPtr thePoint) - : myPoint(thePoint) -{ -} +PlaneGCSSolver_PointWrapper::PlaneGCSSolver_PointWrapper( + const GCSPointPtr thePoint) + : myPoint(thePoint) {} -bool PlaneGCSSolver_PointWrapper::update(AttributePtr theAttribute) -{ +bool PlaneGCSSolver_PointWrapper::update(AttributePtr theAttribute) { bool isUpdated = false; std::shared_ptr aPoint2D = std::dynamic_pointer_cast(theAttribute); if (aPoint2D) { - isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->x(), *(myPoint->x)) || isUpdated; - isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->y(), *(myPoint->y)) || isUpdated; + isUpdated = + PlaneGCSSolver_Tools::updateValue(aPoint2D->x(), *(myPoint->x)) || + isUpdated; + isUpdated = + PlaneGCSSolver_Tools::updateValue(aPoint2D->y(), *(myPoint->y)) || + isUpdated; } return isUpdated; } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h index 95d19e6a0..870f781eb 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_PointWrapper_H_ @@ -26,25 +27,22 @@ /** * Wrapper providing operations with PlaneGCS points. */ -class PlaneGCSSolver_PointWrapper : public PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_PointWrapper : public PlaneGCSSolver_EntityWrapper { public: PlaneGCSSolver_PointWrapper(const GCSPointPtr thePoint); /// \brief Return PlaneGCS point - const GCSPointPtr& point() const - { return myPoint; } + const GCSPointPtr &point() const { return myPoint; } /// \brief Return PlaneGCS point to change - GCSPointPtr& changeEntity() - { return myPoint; } + GCSPointPtr &changeEntity() { return myPoint; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const - { return ENTITY_POINT; } + virtual SketchSolver_EntityType type() const { return ENTITY_POINT; } protected: /// \brief Update entity by the values of theAttribute - /// \return \c true if any value of attribute is not equal to the stored in the entity + /// \return \c true if any value of attribute is not equal to the stored in + /// the entity virtual bool update(std::shared_ptr theAttribute); private: diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.cpp index 242e26359..714c6c2eb 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.cpp @@ -14,25 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -PlaneGCSSolver_ScalarArrayWrapper::PlaneGCSSolver_ScalarArrayWrapper(const GCS::VEC_pD& theParam) - : myValue(theParam) -{ -} +PlaneGCSSolver_ScalarArrayWrapper::PlaneGCSSolver_ScalarArrayWrapper( + const GCS::VEC_pD &theParam) + : myValue(theParam) {} -bool PlaneGCSSolver_ScalarArrayWrapper::update(AttributePtr theAttribute) -{ +bool PlaneGCSSolver_ScalarArrayWrapper::update(AttributePtr theAttribute) { bool isUpdated = false; PlaneGCSSolver_Tools::AttributeArray anArray(theAttribute); if (anArray.isInitialized() && anArray.size() == (int)myValue.size()) { for (int anIndex = 0; anIndex < anArray.size(); ++anIndex) { - isUpdated = PlaneGCSSolver_Tools::updateValue(anArray.value(anIndex), *(myValue[anIndex])) - || isUpdated; + isUpdated = PlaneGCSSolver_Tools::updateValue(anArray.value(anIndex), + *(myValue[anIndex])) || + isUpdated; } } return isUpdated; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h index af413b5bf..09c967aa2 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_ScalarArrayWrapper_H_ @@ -26,32 +27,32 @@ /** * Wrapper providing operations with array of PlaneGCS scalars. */ -class PlaneGCSSolver_ScalarArrayWrapper : public PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_ScalarArrayWrapper : public PlaneGCSSolver_EntityWrapper { public: - PlaneGCSSolver_ScalarArrayWrapper(const GCS::VEC_pD& theParam); + PlaneGCSSolver_ScalarArrayWrapper(const GCS::VEC_pD &theParam); /// \breif Size of array int size() const { return (int)myValue.size(); } /// \brief Return array of PlaneGCS parameters - const GCS::VEC_pD& array() const { return myValue; } + const GCS::VEC_pD &array() const { return myValue; } /// \breif Set array of parameters - void setArray(const GCS::VEC_pD& theParams) { myValue = theParams; } + void setArray(const GCS::VEC_pD &theParams) { myValue = theParams; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const - { return ENTITY_SCALAR_ARRAY; } + virtual SketchSolver_EntityType type() const { return ENTITY_SCALAR_ARRAY; } protected: /// \brief Update entity by the values of theAttribute - /// \return \c true if any value of attribute is not equal to the stored in the entity + /// \return \c true if any value of attribute is not equal to the stored in + /// the entity virtual bool update(std::shared_ptr theAttribute); protected: GCS::VEC_pD myValue; ///< list of pointers to values provided by the storage }; -typedef std::shared_ptr ScalarArrayWrapperPtr; +typedef std::shared_ptr + ScalarArrayWrapperPtr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp index 45d00efd7..e44a436a1 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,23 +24,17 @@ #include #include -PlaneGCSSolver_ScalarWrapper::PlaneGCSSolver_ScalarWrapper(double *const theParam) - : myValue(theParam) -{ -} +PlaneGCSSolver_ScalarWrapper::PlaneGCSSolver_ScalarWrapper( + double *const theParam) + : myValue(theParam) {} -void PlaneGCSSolver_ScalarWrapper::setValue(double theValue) -{ +void PlaneGCSSolver_ScalarWrapper::setValue(double theValue) { *myValue = theValue; } -double PlaneGCSSolver_ScalarWrapper::value() const -{ - return *myValue; -} +double PlaneGCSSolver_ScalarWrapper::value() const { return *myValue; } -bool PlaneGCSSolver_ScalarWrapper::update(AttributePtr theAttribute) -{ +bool PlaneGCSSolver_ScalarWrapper::update(AttributePtr theAttribute) { double anAttrValue = 0.0; AttributeDoublePtr aDouble = std::dynamic_pointer_cast(theAttribute); @@ -54,11 +49,12 @@ bool PlaneGCSSolver_ScalarWrapper::update(AttributePtr theAttribute) return false; } - // There is possible an angular value, which is converted between degrees and radians. - // So, we use its value instead of using direct pointer to variable. + // There is possible an angular value, which is converted between degrees and + // radians. So, we use its value instead of using direct pointer to variable. double aCurrentValue = value(); - bool isUpdated = PlaneGCSSolver_Tools::updateValue(anAttrValue, aCurrentValue); + bool isUpdated = + PlaneGCSSolver_Tools::updateValue(anAttrValue, aCurrentValue); if (isUpdated) setValue(aCurrentValue); return isUpdated; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h index c7b22217a..85c08c371 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_ScalarWrapper_H_ @@ -26,14 +27,12 @@ /** * Wrapper providing operations with PlaneGCS scalars. */ -class PlaneGCSSolver_ScalarWrapper : public PlaneGCSSolver_EntityWrapper -{ +class PlaneGCSSolver_ScalarWrapper : public PlaneGCSSolver_EntityWrapper { public: PlaneGCSSolver_ScalarWrapper(double *const theParam); /// \brief Return PlaneGCS parameter - double* scalar() const - { return myValue; } + double *scalar() const { return myValue; } /// \brief Change value of parameter virtual void setValue(double theValue); @@ -41,16 +40,16 @@ public: virtual double value() const; /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const - { return ENTITY_SCALAR; } + virtual SketchSolver_EntityType type() const { return ENTITY_SCALAR; } protected: /// \brief Update entity by the values of theAttribute - /// \return \c true if any value of attribute is not equal to the stored in the entity + /// \return \c true if any value of attribute is not equal to the stored in + /// the entity virtual bool update(std::shared_ptr theAttribute); protected: - double* myValue; ///< pointer to value provided by the storage + double *myValue; ///< pointer to value provided by the storage }; typedef std::shared_ptr ScalarWrapperPtr; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index 47b03a01c..a13e7ced6 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -14,33 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include -// Multiplier to correlate IDs of SketchPlugin constraint and primitive PlaneGCS constraints +// Multiplier to correlate IDs of SketchPlugin constraint and primitive PlaneGCS +// constraints static const int THE_CONSTRAINT_MULT = 100; - PlaneGCSSolver_Solver::PlaneGCSSolver_Solver() - : myEquationSystem(new GCS::System), - myDiagnoseBeforeSolve(false), - myInitilized(false), - myConfCollected(false), - myDOF(0), - myFictiveConstraint(0) -{ -} + : myEquationSystem(new GCS::System), myDiagnoseBeforeSolve(false), + myInitilized(false), myConfCollected(false), myDOF(0), + myFictiveConstraint(0) {} -PlaneGCSSolver_Solver::~PlaneGCSSolver_Solver() -{ - clear(); -} +PlaneGCSSolver_Solver::~PlaneGCSSolver_Solver() { clear(); } -void PlaneGCSSolver_Solver::clear() -{ +void PlaneGCSSolver_Solver::clear() { myEquationSystem->clear(); myParameters.clear(); myConstraints.clear(); @@ -50,14 +42,15 @@ void PlaneGCSSolver_Solver::clear() removeFictiveConstraint(); } -void PlaneGCSSolver_Solver::addConstraint(const ConstraintID& theMultiConstraintID, - const std::list& theConstraints) -{ - int anID = theMultiConstraintID > CID_UNKNOWN ? - theMultiConstraintID * THE_CONSTRAINT_MULT : - theMultiConstraintID; +void PlaneGCSSolver_Solver::addConstraint( + const ConstraintID &theMultiConstraintID, + const std::list &theConstraints) { + int anID = theMultiConstraintID > CID_UNKNOWN + ? theMultiConstraintID * THE_CONSTRAINT_MULT + : theMultiConstraintID; - for (std::list::const_iterator anIt = theConstraints.begin(); + for (std::list::const_iterator anIt = + theConstraints.begin(); anIt != theConstraints.end(); ++anIt) { GCSConstraintPtr aConstraint = *anIt; aConstraint->setTag(anID); @@ -73,8 +66,7 @@ void PlaneGCSSolver_Solver::addConstraint(const ConstraintID& theMultiConstraint myInitilized = false; } -void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID& theID) -{ +void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID &theID) { ConstraintMap::iterator aFound = myConstraints.find(theID); if (aFound != myConstraints.end()) { for (std::list::iterator anIt = aFound->second.begin(); @@ -93,9 +85,8 @@ void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID& theID) myInitilized = false; } -double* PlaneGCSSolver_Solver::createParameter() -{ - double* aResult = new double(0); +double *PlaneGCSSolver_Solver::createParameter() { + double *aResult = new double(0); myParameters.push_back(aResult); if (myConstraints.empty() && myDOF >= 0) ++myDOF; // calculate DoF by hand if and only if there is no constraints yet @@ -104,8 +95,7 @@ double* PlaneGCSSolver_Solver::createParameter() return aResult; } -void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD& theParams) -{ +void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD &theParams) { GCS::SET_pD aParams(theParams); // leave new parameters only GCS::VEC_pD::iterator anIt = myParameters.begin(); @@ -114,14 +104,14 @@ void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD& theParams) aParams.erase(*anIt); myParameters.insert(myParameters.end(), aParams.begin(), aParams.end()); - if (myConstraints.empty() && myDOF >=0) - myDOF += (int)aParams.size(); // calculate DoF by hand only if there is no constraints yet + if (myConstraints.empty() && myDOF >= 0) + myDOF += (int)aParams.size(); // calculate DoF by hand only if there is no + // constraints yet else myDiagnoseBeforeSolve = true; } -void PlaneGCSSolver_Solver::removeParameters(const GCS::SET_pD& theParams) -{ +void PlaneGCSSolver_Solver::removeParameters(const GCS::SET_pD &theParams) { for (int i = (int)myParameters.size() - 1; i >= 0; --i) if (theParams.find(myParameters[i]) != theParams.end()) { myParameters.erase(myParameters.begin() + i); @@ -131,8 +121,7 @@ void PlaneGCSSolver_Solver::removeParameters(const GCS::SET_pD& theParams) myDiagnoseBeforeSolve = true; } -void PlaneGCSSolver_Solver::initialize() -{ +void PlaneGCSSolver_Solver::initialize() { Events_LongOp::start(this); addFictiveConstraintIfNecessary(); if (myDiagnoseBeforeSolve) @@ -144,8 +133,7 @@ void PlaneGCSSolver_Solver::initialize() myInitilized = true; } -PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Solver::solve() -{ +PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Solver::solve() { // clear list of conflicting constraints if (myConfCollected) { myConflictingIDs.clear(); @@ -166,20 +154,22 @@ PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Solver::solve() } if (aResult == GCS::Failed) { - // DogLeg solver failed without conflicting constraints, try to use Levenberg-Marquardt solver + // DogLeg solver failed without conflicting constraints, try to use + // Levenberg-Marquardt solver diagnose(GCS::LevenbergMarquardt); - aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters, true, - GCS::LevenbergMarquardt); + aResult = (GCS::SolveStatus)myEquationSystem->solve( + myParameters, true, GCS::LevenbergMarquardt); if (aResult == GCS::Failed) { diagnose(GCS::BFGS); - aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters, true, GCS::BFGS); + aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters, true, + GCS::BFGS); } } Events_LongOp::end(this); // collect information about conflicting constraints every time, - // sometimes solver reports about succeeded recalculation but has conflicting constraints - // (for example, apply horizontal constraint for a copied feature) + // sometimes solver reports about succeeded recalculation but has conflicting + // constraints (for example, apply horizontal constraint for a copied feature) collectConflicting(); if (!myConflictingIDs.empty()) aResult = GCS::Failed; @@ -199,52 +189,47 @@ PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Solver::solve() return aStatus; } -void PlaneGCSSolver_Solver::undo() -{ - myEquationSystem->undoSolution(); -} +void PlaneGCSSolver_Solver::undo() { myEquationSystem->undoSolution(); } -bool PlaneGCSSolver_Solver::isConflicting(const ConstraintID& theConstraint) const -{ +bool PlaneGCSSolver_Solver::isConflicting( + const ConstraintID &theConstraint) const { if (!myConfCollected) - const_cast(this)->collectConflicting(); + const_cast(this)->collectConflicting(); return myConflictingIDs.find((int)theConstraint) != myConflictingIDs.end(); } -void PlaneGCSSolver_Solver::collectConflicting(bool withRedundant) -{ +void PlaneGCSSolver_Solver::collectConflicting(bool withRedundant) { GCS::VEC_I aConflict; myEquationSystem->getConflicting(aConflict); // convert PlaneGCS constraint IDs to SketchPlugin's ID - for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); anIt != aConflict.end(); ++anIt) + for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); + anIt != aConflict.end(); ++anIt) myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT); if (withRedundant) { myEquationSystem->getRedundant(aConflict); // convert PlaneGCS constraint IDs to SketchPlugin's ID - for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); anIt != aConflict.end(); ++anIt) + for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); + anIt != aConflict.end(); ++anIt) myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT); } myConfCollected = true; } -int PlaneGCSSolver_Solver::dof() -{ +int PlaneGCSSolver_Solver::dof() { if (myDOF < 0 && !myConstraints.empty()) diagnose(); return myDOF; } -void PlaneGCSSolver_Solver::diagnose(const GCS::Algorithm& theAlgo) -{ +void PlaneGCSSolver_Solver::diagnose(const GCS::Algorithm &theAlgo) { myEquationSystem->declareUnknowns(myParameters); myDOF = myEquationSystem->diagnose(theAlgo); myDiagnoseBeforeSolve = false; } -void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD& theFreeParams) -{ +void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD &theFreeParams) { if (myConstraints.empty()) theFreeParams.insert(myParameters.begin(), myParameters.end()); else { @@ -274,15 +259,13 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD& theFreeParams) return; // find all equal parameters too - struct EqualParameters - { - typedef std::map::iterator> MapParamGroup; + struct EqualParameters { + typedef std::map::iterator> MapParamGroup; std::list myEqualParams; MapParamGroup myGroups; - void add(double* theParam1, double* theParam2) - { + void add(double *theParam1, double *theParam2) { MapParamGroup::iterator aFound1 = myGroups.find(theParam1); MapParamGroup::iterator aFound2 = myGroups.find(theParam2); @@ -295,24 +278,22 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD& theFreeParams) aGroup->insert(theParam2); myGroups[theParam1] = aGroup; myGroups[theParam2] = aGroup; - } - else { + } else { // add first parameter to the second group aFound2->second->insert(theParam1); myGroups[theParam1] = aFound2->second; } - } - else { + } else { if (aFound2 == myGroups.end()) { // add second parameter to the first group aFound1->second->insert(theParam2); myGroups[theParam2] = aFound1->second; - } - else if (aFound1 != aFound2) { + } else if (aFound1 != aFound2) { // merge two groups GCS::SET_pD aCopy = *(aFound2->second); myEqualParams.erase(aFound2->second); - for (GCS::SET_pD::iterator anIt = aCopy.begin(); anIt != aCopy.end(); ++anIt) + for (GCS::SET_pD::iterator anIt = aCopy.begin(); anIt != aCopy.end(); + ++anIt) myGroups[*anIt] = aFound1->second; aFound1->second->insert(aCopy.begin(), aCopy.end()); } @@ -320,7 +301,8 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD& theFreeParams) } } anEqualParams; - for (ConstraintMap::iterator anIt = myConstraints.begin(); anIt != myConstraints.end(); ++anIt) + for (ConstraintMap::iterator anIt = myConstraints.begin(); + anIt != myConstraints.end(); ++anIt) for (std::list::iterator aCIt = anIt->second.begin(); aCIt != anIt->second.end(); ++aCIt) { if ((*aCIt)->getTypeId() == GCS::Equal) @@ -330,14 +312,14 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD& theFreeParams) GCS::SET_pD aFreeParamsCopy = theFreeParams; for (GCS::SET_pD::iterator anIt = aFreeParamsCopy.begin(); anIt != aFreeParamsCopy.end(); ++anIt) { - EqualParameters::MapParamGroup::iterator aFound = anEqualParams.myGroups.find(*anIt); + EqualParameters::MapParamGroup::iterator aFound = + anEqualParams.myGroups.find(*anIt); if (aFound != anEqualParams.myGroups.end()) theFreeParams.insert(aFound->second->begin(), aFound->second->end()); } } -void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() -{ +void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() { bool hasOnlyMovement = true; for (ConstraintMap::iterator anIt = myConstraints.begin(); anIt != myConstraints.end() && hasOnlyMovement; ++anIt) @@ -349,8 +331,8 @@ void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() return; // no need several fictive constraints int aDOF = myDOF; - double* aParam = createParameter(); - double* aFictiveParameter = new double(0.0); + double *aParam = createParameter(); + double *aFictiveParameter = new double(0.0); myFictiveConstraint = new GCS::ConstraintEqual(aFictiveParameter, aParam); myFictiveConstraint->setTag(CID_FICTIVE); @@ -359,15 +341,15 @@ void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() myDOF = aDOF; } -void PlaneGCSSolver_Solver::removeFictiveConstraint() -{ +void PlaneGCSSolver_Solver::removeFictiveConstraint() { if (myFictiveConstraint) { myEquationSystem->clearByTag(myFictiveConstraint->getTag()); myParameters.pop_back(); GCS::VEC_pD aParams = myFictiveConstraint->params(); - for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end(); ++anIt) { - double* aPar = *anIt; + for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end(); + ++anIt) { + double *aPar = *anIt; delete aPar; } delete myFictiveConstraint; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h index b3714e55c..c1e2068d0 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_Solver_H_ #define PlaneGCSSolver_Solver_H_ -#include #include +#include #include -/// \brief The main class that performs the high-level operations for connection to the PlaneGCS. -class PlaneGCSSolver_Solver -{ +/// \brief The main class that performs the high-level operations for connection +/// to the PlaneGCS. +class PlaneGCSSolver_Solver { public: /// The result of constraints solution enum SolveStatus { @@ -46,24 +47,26 @@ public: void clear(); /// \brief Add constraint to the system of equations - /// \param[in] theMultiConstraintID ID of the multi constraint which may consists of + /// \param[in] theMultiConstraintID ID of the multi constraint which may + /// consists of /// several primitive constraints /// \param[in] theConstraints list of primitive constraints - void addConstraint(const ConstraintID& theMultiConstraintID, - const std::list& theConstraints); + void addConstraint(const ConstraintID &theMultiConstraintID, + const std::list &theConstraints); /// \brief Remove constraints from the system of equations - void removeConstraint(const ConstraintID& theID); + void removeConstraint(const ConstraintID &theID); /// \brief Initialize memory for new solver's parameter - double* createParameter(); + double *createParameter(); /// \brief Add parameters created elsewhere - void addParameters(const GCS::SET_pD& theParams); + void addParameters(const GCS::SET_pD &theParams); /// \brief Release memory occupied by parameters - void removeParameters(const GCS::SET_pD& theParams); + void removeParameters(const GCS::SET_pD &theParams); /// \brief Preliminary initialization of solver (useful for moving a feature). - /// When called, the solve() method does not reinitialize a set of constraints. + /// When called, the solve() method does not reinitialize a set of + /// constraints. void initialize(); /// \brief Solve the set of equations @@ -74,13 +77,13 @@ public: void undo(); /// \brief Check the constraint is conflicted with others - bool isConflicting(const ConstraintID& theConstraint) const; + bool isConflicting(const ConstraintID &theConstraint) const; /// \brief Check conflicting/redundant constraints and DoF - void diagnose(const GCS::Algorithm& theAlgo = GCS::DogLeg); + void diagnose(const GCS::Algorithm &theAlgo = GCS::DogLeg); /// \brief Return the list of modifiable parameters - void getFreeParameters(GCS::SET_pD& theFreeParams); + void getFreeParameters(GCS::SET_pD &theFreeParams); /// \brief Degrees of freedom int dof(); @@ -88,28 +91,30 @@ public: private: void collectConflicting(bool withRedundant = true); - /// \brief Add fictive constraint if the sketch contains temporary constraints only + /// \brief Add fictive constraint if the sketch contains temporary constraints + /// only void addFictiveConstraintIfNecessary(); /// \brief Remove previously added fictive constraint void removeFictiveConstraint(); private: - typedef std::map > ConstraintMap; + typedef std::map> ConstraintMap; - GCS::VEC_pD myParameters; ///< list of unknowns - ConstraintMap myConstraints; ///< list of constraints + GCS::VEC_pD myParameters; ///< list of unknowns + ConstraintMap myConstraints; ///< list of constraints - std::shared_ptr myEquationSystem; ///< set of equations for solving in FreeGCS - bool myDiagnoseBeforeSolve; ///< is the diagnostic necessary - bool myInitilized; ///< is the system already initialized + std::shared_ptr + myEquationSystem; ///< set of equations for solving in FreeGCS + bool myDiagnoseBeforeSolve; ///< is the diagnostic necessary + bool myInitilized; ///< is the system already initialized - GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints + GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints /// specifies the conflicting constraints are already collected - bool myConfCollected; + bool myConfCollected; - int myDOF; ///< degrees of freedom + int myDOF; ///< degrees of freedom - GCS::Constraint* myFictiveConstraint; + GCS::Constraint *myFictiveConstraint; }; typedef std::shared_ptr SolverPtr; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index deefed48c..e3c0e44ee 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include #include #include -#include #include +#include #include +#include +#include #include #include -#include #include +#include #include #include @@ -44,26 +45,19 @@ #include - -static void constraintsToSolver(const ConstraintWrapperPtr& theConstraint, - const SolverPtr& theSolver) -{ - const std::list& aConstraints = - std::dynamic_pointer_cast(theConstraint)->constraints(); +static void constraintsToSolver(const ConstraintWrapperPtr &theConstraint, + const SolverPtr &theSolver) { + const std::list &aConstraints = + std::dynamic_pointer_cast(theConstraint) + ->constraints(); theSolver->addConstraint(theConstraint->id(), aConstraints); } - -PlaneGCSSolver_Storage::PlaneGCSSolver_Storage(const SolverPtr& theSolver) - : SketchSolver_Storage(theSolver), - myConstraintLastID(CID_UNKNOWN) -{ -} +PlaneGCSSolver_Storage::PlaneGCSSolver_Storage(const SolverPtr &theSolver) + : SketchSolver_Storage(theSolver), myConstraintLastID(CID_UNKNOWN) {} void PlaneGCSSolver_Storage::addConstraint( - ConstraintPtr theConstraint, - ConstraintWrapperPtr theSolverConstraint) -{ + ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint) { SketchSolver_Storage::addConstraint(theConstraint, theSolverConstraint); theSolverConstraint->setId(++myConstraintLastID); @@ -71,8 +65,7 @@ void PlaneGCSSolver_Storage::addConstraint( } void PlaneGCSSolver_Storage::addMovementConstraint( - const ConstraintWrapperPtr& theSolverConstraint) -{ + const ConstraintWrapperPtr &theSolverConstraint) { // before adding movement constraint to solver, re-check its DOF if (mySketchSolver->dof() == 0) mySketchSolver->diagnose(); @@ -81,12 +74,10 @@ void PlaneGCSSolver_Storage::addMovementConstraint( constraintsToSolver(theSolverConstraint, mySketchSolver); } - EntityWrapperPtr PlaneGCSSolver_Storage::createFeature( - const FeaturePtr& theFeature, - PlaneGCSSolver_EntityBuilder* theBuilder) -{ - std::list anAttributes = theFeature->data()->attributes(std::string()); + const FeaturePtr &theFeature, PlaneGCSSolver_EntityBuilder *theBuilder) { + std::list anAttributes = + theFeature->data()->attributes(std::string()); std::list::const_iterator anIt = anAttributes.begin(); for (; anIt != anAttributes.end(); ++anIt) createAttribute(*anIt, theBuilder); @@ -98,9 +89,8 @@ EntityWrapperPtr PlaneGCSSolver_Storage::createFeature( } EntityWrapperPtr PlaneGCSSolver_Storage::createAttribute( - const AttributePtr& theAttribute, - PlaneGCSSolver_EntityBuilder* theBuilder) -{ + const AttributePtr &theAttribute, + PlaneGCSSolver_EntityBuilder *theBuilder) { EntityWrapperPtr aResult = theBuilder->createAttribute(theAttribute); if (aResult) addEntity(theAttribute, aResult); @@ -108,25 +98,22 @@ EntityWrapperPtr PlaneGCSSolver_Storage::createAttribute( } static bool hasReference(std::shared_ptr theFeature, - const std::string& theFeatureKind) -{ - const std::set& aRefs = theFeature->data()->refsToMe(); + const std::string &theFeatureKind) { + const std::set &aRefs = theFeature->data()->refsToMe(); for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end(); ++aRefIt) { - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); - if (anOwner && !anOwner->isMacro() && anOwner->getKind() == theFeatureKind) - return true; + FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); + if (anOwner && !anOwner->isMacro() && anOwner->getKind() == theFeatureKind) + return true; } return false; } -static bool isCopyFeature(std::shared_ptr theFeature) -{ +static bool isCopyFeature(std::shared_ptr theFeature) { return theFeature && theFeature->isCopy(); } -bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) -{ +bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) { bool sendNotify = false; bool isUpdated = false; std::shared_ptr aSketchFeature = @@ -136,15 +123,17 @@ bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) sendNotify = true; else { // Feature is not exist, create it bool isCopy = isCopyFeature(aSketchFeature); - bool isProjReferred = hasReference(aSketchFeature, SketchPlugin_Projection::ID()); - // the feature is a copy in "Multi" constraint and does not used in other constraints + bool isProjReferred = + hasReference(aSketchFeature, SketchPlugin_Projection::ID()); + // the feature is a copy in "Multi" constraint and does not used in other + // constraints if (!theForce && (isCopy && !isProjReferred) && myFeatureMap.find(theFeature) == myFeatureMap.end()) return false; // external feature processing - bool isExternal = - (aSketchFeature && (aSketchFeature->isExternal() || isCopy || isProjReferred)); + bool isExternal = (aSketchFeature && (aSketchFeature->isExternal() || + isCopy || isProjReferred)); PlaneGCSSolver_FeatureBuilder aBuilder(isExternal ? 0 : this); @@ -156,15 +145,17 @@ bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) isUpdated = true; } - std::list anAttributes = theFeature->data()->attributes(std::string()); + std::list anAttributes = + theFeature->data()->attributes(std::string()); std::list::iterator anAttrIt = anAttributes.begin(); for (; anAttrIt != anAttributes.end(); ++anAttrIt) - if (PlaneGCSSolver_Tools::isAttributeApplicable((*anAttrIt)->id(), theFeature->getKind())) + if (PlaneGCSSolver_Tools::isAttributeApplicable((*anAttrIt)->id(), + theFeature->getKind())) isUpdated = update(*anAttrIt) || isUpdated; // check external attribute is changed - bool isExternal = aSketchFeature && - (aSketchFeature->isExternal() || isCopyFeature(aSketchFeature)); + bool isExternal = aSketchFeature && (aSketchFeature->isExternal() || + isCopyFeature(aSketchFeature)); if (aRelated && isExternal != aRelated->isExternal()) { if (isExternal) makeExternal(aRelated); @@ -184,13 +175,13 @@ bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) return isUpdated; } -bool PlaneGCSSolver_Storage::update(AttributePtr theAttribute, bool theForce) -{ +bool PlaneGCSSolver_Storage::update(AttributePtr theAttribute, bool theForce) { if (!theAttribute->isInitialized()) return false; AttributePtr anAttribute = theAttribute; - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(anAttribute); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(anAttribute); if (aRefAttr) { if (aRefAttr->isObject()) { FeaturePtr aFeature; @@ -207,7 +198,9 @@ bool PlaneGCSSolver_Storage::update(AttributePtr theAttribute, bool theForce) if (!aRelated) { // Attribute does not exist, create it. // First of all check if the parent feature exists. If not, add it. if (aFeature && myFeatureMap.find(aFeature) == myFeatureMap.end()) - return update(aFeature, theForce); // theAttribute has been processed while adding feature + return update( + aFeature, + theForce); // theAttribute has been processed while adding feature return aRelated.get() != 0; } @@ -220,8 +213,7 @@ bool PlaneGCSSolver_Storage::update(AttributePtr theAttribute, bool theForce) return isUpdated; } -void PlaneGCSSolver_Storage::makeExternal(const EntityWrapperPtr& theEntity) -{ +void PlaneGCSSolver_Storage::makeExternal(const EntityWrapperPtr &theEntity) { if (theEntity->isExternal()) return; @@ -233,8 +225,8 @@ void PlaneGCSSolver_Storage::makeExternal(const EntityWrapperPtr& theEntity) myNeedToResolve = true; } -void PlaneGCSSolver_Storage::makeNonExternal(const EntityWrapperPtr& theEntity) -{ +void PlaneGCSSolver_Storage::makeNonExternal( + const EntityWrapperPtr &theEntity) { if (!theEntity->isExternal()) return; @@ -247,30 +239,30 @@ void PlaneGCSSolver_Storage::makeNonExternal(const EntityWrapperPtr& theEntity) myNeedToResolve = true; } - -static void createArcConstraints(const EntityWrapperPtr& theArc, - const SolverPtr& theSolver, - const ConstraintID theConstraintID, - std::map& theConstraints) -{ - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(theArc); - std::shared_ptr anArc = std::dynamic_pointer_cast(anEdge->entity()); +static void createArcConstraints( + const EntityWrapperPtr &theArc, const SolverPtr &theSolver, + const ConstraintID theConstraintID, + std::map &theConstraints) { + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(theArc); + std::shared_ptr anArc = + std::dynamic_pointer_cast(anEdge->entity()); // Additional constaints to fix arc's extra DoF (if the arc is not external): std::list anArcConstraints; // 1. distances from center till start and end points are equal to radius - anArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintP2PDistance( - anArc->center, anArc->start, anArc->rad))); - anArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintP2PDistance( - anArc->center, anArc->end, anArc->rad))); + anArcConstraints.push_back(GCSConstraintPtr( + new GCS::ConstraintP2PDistance(anArc->center, anArc->start, anArc->rad))); + anArcConstraints.push_back(GCSConstraintPtr( + new GCS::ConstraintP2PDistance(anArc->center, anArc->end, anArc->rad))); // 2. angles of start and end points should be equal to the arc angles anArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintP2PAngle( anArc->center, anArc->start, anArc->startAngle))); - anArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintP2PAngle( - anArc->center, anArc->end, anArc->endAngle))); + anArcConstraints.push_back(GCSConstraintPtr( + new GCS::ConstraintP2PAngle(anArc->center, anArc->end, anArc->endAngle))); - ConstraintWrapperPtr aWrapper( - new PlaneGCSSolver_ConstraintWrapper(anArcConstraints, CONSTRAINT_UNKNOWN)); + ConstraintWrapperPtr aWrapper(new PlaneGCSSolver_ConstraintWrapper( + anArcConstraints, CONSTRAINT_UNKNOWN)); aWrapper->setId(theConstraintID); constraintsToSolver(aWrapper, theSolver); @@ -278,20 +270,21 @@ static void createArcConstraints(const EntityWrapperPtr& theArc, } static void createEllipseConstraints( - const EntityWrapperPtr& theEllipse, - const SolverPtr& theSolver, + const EntityWrapperPtr &theEllipse, const SolverPtr &theSolver, const ConstraintID theConstraintID, - std::map& theConstraints) -{ - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(theEllipse); + std::map &theConstraints) { + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(theEllipse); std::shared_ptr anEllipse = std::dynamic_pointer_cast(anEdge->entity()); // Additional constaints to fix ellipse's extra points std::list anEllipseConstraints; - const std::map& anAttributes = theEllipse->additionalAttributes(); - for (std::map::const_iterator anIt = anAttributes.begin(); + const std::map &anAttributes = + theEllipse->additionalAttributes(); + for (std::map::const_iterator anIt = + anAttributes.begin(); anIt != anAttributes.end(); ++anIt) { std::shared_ptr aPoint = std::dynamic_pointer_cast(anIt->second); @@ -310,27 +303,29 @@ static void createEllipseConstraints( else if (anIt->first == SketchPlugin_Ellipse::MINOR_AXIS_END_ID()) anAlignmentX = GCS::EllipsePositiveMinorX; - anEllipseConstraints.push_back(GCSConstraintPtr( - new GCS::ConstraintInternalAlignmentPoint2Ellipse( - *anEllipse, *(aPoint->point()), anAlignmentX))); + anEllipseConstraints.push_back( + GCSConstraintPtr(new GCS::ConstraintInternalAlignmentPoint2Ellipse( + *anEllipse, *(aPoint->point()), anAlignmentX))); anAlignmentY = (GCS::InternalAlignmentType)((int)anAlignmentX + 1); - anEllipseConstraints.push_back(GCSConstraintPtr( - new GCS::ConstraintInternalAlignmentPoint2Ellipse( - *anEllipse, *(aPoint->point()), anAlignmentY))); + anEllipseConstraints.push_back( + GCSConstraintPtr(new GCS::ConstraintInternalAlignmentPoint2Ellipse( + *anEllipse, *(aPoint->point()), anAlignmentY))); } // constraint to bind the major radius value std::shared_ptr aMajorAxisStart = std::dynamic_pointer_cast( - anAttributes.at(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID())); + anAttributes.at(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID())); ScalarWrapperPtr aMajorRadius = std::dynamic_pointer_cast( - anAttributes.at(SketchPlugin_Ellipse::MAJOR_RADIUS_ID())); - anEllipseConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintP2PDistance( - anEllipse->center, *(aMajorAxisStart->point()), aMajorRadius->scalar()))); - - ConstraintWrapperPtr aWrapper( - new PlaneGCSSolver_ConstraintWrapper(anEllipseConstraints, CONSTRAINT_UNKNOWN)); + anAttributes.at(SketchPlugin_Ellipse::MAJOR_RADIUS_ID())); + anEllipseConstraints.push_back(GCSConstraintPtr( + new GCS::ConstraintP2PDistance(anEllipse->center, + *(aMajorAxisStart->point()), + aMajorRadius->scalar()))); + + ConstraintWrapperPtr aWrapper(new PlaneGCSSolver_ConstraintWrapper( + anEllipseConstraints, CONSTRAINT_UNKNOWN)); aWrapper->setId(theConstraintID); if (theSolver) constraintsToSolver(aWrapper, theSolver); @@ -339,43 +334,43 @@ static void createEllipseConstraints( } static void createEllipticArcConstraints( - const EntityWrapperPtr& theEllipticArc, - const SolverPtr& theSolver, + const EntityWrapperPtr &theEllipticArc, const SolverPtr &theSolver, const ConstraintID theConstraintID, - std::map& theConstraints) -{ + std::map &theConstraints) { // create base constraints for the ellipse without adding them to solver - createEllipseConstraints(theEllipticArc, SolverPtr(), theConstraintID, theConstraints); + createEllipseConstraints(theEllipticArc, SolverPtr(), theConstraintID, + theConstraints); - ConstraintWrapperPtr& aConstraint = theConstraints[theEllipticArc]; + ConstraintWrapperPtr &aConstraint = theConstraints[theEllipticArc]; std::list anEllArcConstraints = aConstraint->constraints(); // constrain extremities of the elliptic arc - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(theEllipticArc); + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(theEllipticArc); std::shared_ptr anArc = std::dynamic_pointer_cast(anEdge->entity()); - anEllArcConstraints.push_back(GCSConstraintPtr( - new GCS::ConstraintCurveValue(anArc->start, anArc->start.x, *anArc, anArc->startAngle))); - anEllArcConstraints.push_back(GCSConstraintPtr( - new GCS::ConstraintCurveValue(anArc->start, anArc->start.y, *anArc, anArc->startAngle))); - anEllArcConstraints.push_back(GCSConstraintPtr( - new GCS::ConstraintCurveValue(anArc->end, anArc->end.x, *anArc, anArc->endAngle))); - anEllArcConstraints.push_back(GCSConstraintPtr( - new GCS::ConstraintCurveValue(anArc->end, anArc->end.y, *anArc, anArc->endAngle))); + anEllArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintCurveValue( + anArc->start, anArc->start.x, *anArc, anArc->startAngle))); + anEllArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintCurveValue( + anArc->start, anArc->start.y, *anArc, anArc->startAngle))); + anEllArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintCurveValue( + anArc->end, anArc->end.x, *anArc, anArc->endAngle))); + anEllArcConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintCurveValue( + anArc->end, anArc->end.y, *anArc, anArc->endAngle))); aConstraint->setConstraints(anEllArcConstraints); constraintsToSolver(aConstraint, theSolver); } static void createBSplineConstraints( - const EntityWrapperPtr& theCurve, - const SolverPtr& theSolver, + const EntityWrapperPtr &theCurve, const SolverPtr &theSolver, const ConstraintID theConstraintID, - std::map& theConstraints) -{ - // set start and end point of B-spline equal to first and last pole correspondingly - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(theCurve); + std::map &theConstraints) { + // set start and end point of B-spline equal to first and last pole + // correspondingly + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(theCurve); std::shared_ptr aBSpline = std::dynamic_pointer_cast(anEdge->entity()); if (aBSpline->periodic) @@ -383,25 +378,32 @@ static void createBSplineConstraints( std::list aBSplineConstraints; - const std::map& anAdditional = anEdge->additionalAttributes(); - PointWrapperPtr aStartPoint = std::dynamic_pointer_cast( - anAdditional.at(SketchPlugin_BSpline::START_ID())); + const std::map &anAdditional = + anEdge->additionalAttributes(); + PointWrapperPtr aStartPoint = + std::dynamic_pointer_cast( + anAdditional.at(SketchPlugin_BSpline::START_ID())); - const GCS::Point& sp = *aStartPoint->point(); - const GCS::Point& p0 = aBSpline->poles.front(); - aBSplineConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(p0.x, sp.x))); - aBSplineConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(p0.y, sp.y))); + const GCS::Point &sp = *aStartPoint->point(); + const GCS::Point &p0 = aBSpline->poles.front(); + aBSplineConstraints.push_back( + GCSConstraintPtr(new GCS::ConstraintEqual(p0.x, sp.x))); + aBSplineConstraints.push_back( + GCSConstraintPtr(new GCS::ConstraintEqual(p0.y, sp.y))); - PointWrapperPtr aEndPoint = std::dynamic_pointer_cast( - anAdditional.at(SketchPlugin_BSpline::END_ID())); + PointWrapperPtr aEndPoint = + std::dynamic_pointer_cast( + anAdditional.at(SketchPlugin_BSpline::END_ID())); - const GCS::Point& ep = *aEndPoint->point(); - const GCS::Point& pN = aBSpline->poles.back(); - aBSplineConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(pN.x, ep.x))); - aBSplineConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(pN.y, ep.y))); + const GCS::Point &ep = *aEndPoint->point(); + const GCS::Point &pN = aBSpline->poles.back(); + aBSplineConstraints.push_back( + GCSConstraintPtr(new GCS::ConstraintEqual(pN.x, ep.x))); + aBSplineConstraints.push_back( + GCSConstraintPtr(new GCS::ConstraintEqual(pN.y, ep.y))); - ConstraintWrapperPtr aWrapper( - new PlaneGCSSolver_ConstraintWrapper(aBSplineConstraints, CONSTRAINT_UNKNOWN)); + ConstraintWrapperPtr aWrapper(new PlaneGCSSolver_ConstraintWrapper( + aBSplineConstraints, CONSTRAINT_UNKNOWN)); aWrapper->setId(theConstraintID); if (theSolver) constraintsToSolver(aWrapper, theSolver); @@ -409,27 +411,29 @@ static void createBSplineConstraints( theConstraints[theCurve] = aWrapper; } -void PlaneGCSSolver_Storage::createAuxiliaryConstraints(const EntityWrapperPtr& theEntity) -{ +void PlaneGCSSolver_Storage::createAuxiliaryConstraints( + const EntityWrapperPtr &theEntity) { if (!theEntity || theEntity->isExternal()) return; if (theEntity->type() == ENTITY_ARC) - createArcConstraints(theEntity, mySketchSolver, ++myConstraintLastID, myAuxConstraintMap); + createArcConstraints(theEntity, mySketchSolver, ++myConstraintLastID, + myAuxConstraintMap); else if (theEntity->type() == ENTITY_ELLIPSE) - createEllipseConstraints(theEntity, mySketchSolver, ++myConstraintLastID, myAuxConstraintMap); + createEllipseConstraints(theEntity, mySketchSolver, ++myConstraintLastID, + myAuxConstraintMap); else if (theEntity->type() == ENTITY_ELLIPTIC_ARC) { createEllipticArcConstraints(theEntity, mySketchSolver, ++myConstraintLastID, myAuxConstraintMap); - } - else if (theEntity->type() == ENTITY_BSPLINE) - createBSplineConstraints(theEntity, mySketchSolver, ++myConstraintLastID, myAuxConstraintMap); + } else if (theEntity->type() == ENTITY_BSPLINE) + createBSplineConstraints(theEntity, mySketchSolver, ++myConstraintLastID, + myAuxConstraintMap); } -void PlaneGCSSolver_Storage::removeAuxiliaryConstraints(const EntityWrapperPtr& theEntity) -{ - std::map::iterator - aFound = myAuxConstraintMap.find(theEntity); +void PlaneGCSSolver_Storage::removeAuxiliaryConstraints( + const EntityWrapperPtr &theEntity) { + std::map::iterator aFound = + myAuxConstraintMap.find(theEntity); if (aFound != myAuxConstraintMap.end()) { mySketchSolver->removeConstraint(aFound->second->id()); myAuxConstraintMap.erase(aFound); @@ -437,8 +441,7 @@ void PlaneGCSSolver_Storage::removeAuxiliaryConstraints(const EntityWrapperPtr& } template -void adjustArcParametrization(ARCTYPE& theArc, bool theReversed) -{ +void adjustArcParametrization(ARCTYPE &theArc, bool theReversed) { // tune start angle of the arc to be in [0, 2PI] while (*theArc.startAngle < -PI) *theArc.startAngle += 2.0 * PI; @@ -450,8 +453,7 @@ void adjustArcParametrization(ARCTYPE& theArc, bool theReversed) *theArc.endAngle -= 2.0 * PI; while (*theArc.endAngle + 2 * PI < *theArc.startAngle) *theArc.endAngle += 2.0 * PI; - } - else { + } else { while (*theArc.endAngle < *theArc.startAngle) *theArc.endAngle += 2.0 * PI; while (*theArc.endAngle > *theArc.startAngle + 2 * PI) @@ -459,12 +461,14 @@ void adjustArcParametrization(ARCTYPE& theArc, bool theReversed) } } -void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() -{ - std::map::iterator anIt = myAuxConstraintMap.begin(); +void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() { + std::map::iterator anIt = + myAuxConstraintMap.begin(); for (; anIt != myAuxConstraintMap.end(); ++anIt) { - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(anIt->first); - std::shared_ptr anArc = std::dynamic_pointer_cast(anEdge->entity()); + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(anIt->first); + std::shared_ptr anArc = + std::dynamic_pointer_cast(anEdge->entity()); if (anArc) adjustArcParametrization(*anArc, anEdge->isReversed()); else { @@ -476,18 +480,17 @@ void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() } // update parameters of Middle point constraint for point on arc - std::map::iterator aCIt = myConstraintMap.begin(); + std::map::iterator aCIt = + myConstraintMap.begin(); for (; aCIt != myConstraintMap.end(); ++aCIt) if (aCIt->second->type() == CONSTRAINT_MIDDLE_POINT) { notify(aCIt->first); } } - -bool PlaneGCSSolver_Storage::removeConstraint(ConstraintPtr theConstraint) -{ - std::map::iterator - aFound = myConstraintMap.find(theConstraint); +bool PlaneGCSSolver_Storage::removeConstraint(ConstraintPtr theConstraint) { + std::map::iterator aFound = + myConstraintMap.find(theConstraint); if (aFound != myConstraintMap.end()) { ConstraintWrapperPtr aCW = aFound->second; ConstraintID anID = aCW->id(); @@ -496,7 +499,7 @@ bool PlaneGCSSolver_Storage::removeConstraint(ConstraintPtr theConstraint) mySketchSolver->removeConstraint(anID); // Remove value if exists - const ScalarWrapperPtr& aValue = aCW->valueParameter(); + const ScalarWrapperPtr &aValue = aCW->valueParameter(); if (aValue) { GCS::SET_pD aParToRemove; aParToRemove.insert(aValue->scalar()); @@ -515,24 +518,25 @@ bool PlaneGCSSolver_Storage::removeConstraint(ConstraintPtr theConstraint) return true; } -void PlaneGCSSolver_Storage::removeInvalidEntities() -{ +void PlaneGCSSolver_Storage::removeInvalidEntities() { PlaneGCSSolver_EntityDestroyer aDestroyer; // Remove invalid constraints std::list anInvalidConstraints; - std::map::const_iterator - aCIter = myConstraintMap.begin(); + std::map::const_iterator aCIter = + myConstraintMap.begin(); for (; aCIter != myConstraintMap.end(); ++aCIter) if (!aCIter->first->data() || !aCIter->first->data()->isValid()) anInvalidConstraints.push_back(aCIter->first); - std::list::const_iterator anInvCIt = anInvalidConstraints.begin(); + std::list::const_iterator anInvCIt = + anInvalidConstraints.begin(); for (; anInvCIt != anInvalidConstraints.end(); ++anInvCIt) removeConstraint(*anInvCIt); // Remove invalid features std::list anInvalidFeatures; - std::map::const_iterator aFIter = myFeatureMap.begin(); + std::map::const_iterator aFIter = + myFeatureMap.begin(); for (; aFIter != myFeatureMap.end(); aFIter++) if (!aFIter->first->data() || !aFIter->first->data()->isValid()) { anInvalidFeatures.push_back(aFIter->first); @@ -548,7 +552,8 @@ void PlaneGCSSolver_Storage::removeInvalidEntities() // Remove invalid attributes std::list anInvalidAttributes; - std::map::const_iterator anAttrIt = myAttributeMap.begin(); + std::map::const_iterator anAttrIt = + myAttributeMap.begin(); for (; anAttrIt != myAttributeMap.end(); ++anAttrIt) { FeaturePtr anOwner = ModelAPI_Feature::feature(anAttrIt->first->owner()); if (!anOwner || !anOwner->data() || !anOwner->data()->isValid()) { @@ -556,7 +561,8 @@ void PlaneGCSSolver_Storage::removeInvalidEntities() aDestroyer.remove(anAttrIt->second); } } - std::list::const_iterator anInvAtIt = anInvalidAttributes.begin(); + std::list::const_iterator anInvAtIt = + anInvalidAttributes.begin(); for (; anInvAtIt != anInvalidAttributes.end(); ++anInvAtIt) removeAttribute(*anInvAtIt); @@ -566,23 +572,19 @@ void PlaneGCSSolver_Storage::removeInvalidEntities() /// TODO: Think on optimization of checking invalid features and attributes } - - -double* PlaneGCSSolver_Storage::createParameter() -{ +double *PlaneGCSSolver_Storage::createParameter() { return mySketchSolver->createParameter(); } -void PlaneGCSSolver_Storage::removeParameters(const GCS::SET_pD& theParams) -{ +void PlaneGCSSolver_Storage::removeParameters(const GCS::SET_pD &theParams) { mySketchSolver->removeParameters(theParams); - //for (GCS::SET_pD::iterator it = theParams.begin(); it != theParams.end(); ++it) - // delete *it; + // for (GCS::SET_pD::iterator it = theParams.begin(); it != theParams.end(); + // ++it) + // delete *it; } // indicates attribute containing in the external feature -static bool isExternalAttribute(const AttributePtr& theAttribute) -{ +static bool isExternalAttribute(const AttributePtr &theAttribute) { if (!theAttribute) return false; std::shared_ptr aSketchFeature = @@ -590,20 +592,21 @@ static bool isExternalAttribute(const AttributePtr& theAttribute) return aSketchFeature.get() && aSketchFeature->isExternal(); } -static void addOwnerToSet(const AttributePtr& theAttribute, std::set& theFeatures) -{ +static void addOwnerToSet(const AttributePtr &theAttribute, + std::set &theFeatures) { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttribute->owner()); if (anOwner) theFeatures.insert(anOwner); } -void PlaneGCSSolver_Storage::refresh() const -{ - const double aTol = 1000. * tolerance; // tolerance to prevent frequent updates +void PlaneGCSSolver_Storage::refresh() const { + const double aTol = + 1000. * tolerance; // tolerance to prevent frequent updates std::set anUpdatedFeatures; - std::map::const_iterator anIt = myAttributeMap.begin(); + std::map::const_iterator anIt = + myAttributeMap.begin(); for (; anIt != myAttributeMap.end(); ++anIt) { if (!anIt->first->isInitialized()) continue; @@ -630,7 +633,8 @@ void PlaneGCSSolver_Storage::refresh() const std::dynamic_pointer_cast(anIt->first); if (aPointArray) { std::shared_ptr anArrayWrapper = - std::dynamic_pointer_cast(anIt->second); + std::dynamic_pointer_cast( + anIt->second); int aSize = aPointArray->size(); for (int anIndex = 0; anIndex < aSize; ++anIndex) { GeomPnt2dPtr anOriginal = aPointArray->pnt(anIndex); @@ -643,7 +647,8 @@ void PlaneGCSSolver_Storage::refresh() const } continue; } - AttributeDoublePtr aScalar = std::dynamic_pointer_cast(anIt->first); + AttributeDoublePtr aScalar = + std::dynamic_pointer_cast(anIt->first); if (aScalar) { ScalarWrapperPtr aScalarWrapper = std::dynamic_pointer_cast(anIt->second); @@ -657,10 +662,12 @@ void PlaneGCSSolver_Storage::refresh() const std::dynamic_pointer_cast(anIt->first); if (aRealArray) { std::shared_ptr anArrayWrapper = - std::dynamic_pointer_cast(anIt->second); + std::dynamic_pointer_cast( + anIt->second); int aSize = aRealArray->size(); for (int anIndex = 0; anIndex < aSize; ++anIndex) { - if (fabs(aRealArray->value(anIndex) - *anArrayWrapper->array()[anIndex]) > aTol) { + if (fabs(aRealArray->value(anIndex) - + *anArrayWrapper->array()[anIndex]) > aTol) { aRealArray->setValue(anIndex, *anArrayWrapper->array()[anIndex]); addOwnerToSet(anIt->first, anUpdatedFeatures); } @@ -675,31 +682,34 @@ void PlaneGCSSolver_Storage::refresh() const notify(*aFIt); } -PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Storage::checkDegeneratedGeometry() const -{ - std::map::const_iterator aFIt = myFeatureMap.begin(); +PlaneGCSSolver_Solver::SolveStatus +PlaneGCSSolver_Storage::checkDegeneratedGeometry() const { + std::map::const_iterator aFIt = + myFeatureMap.begin(); for (; aFIt != myFeatureMap.end(); ++aFIt) { - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(aFIt->second); + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(aFIt->second); if (anEdge && anEdge->isDegenerated()) return PlaneGCSSolver_Solver::STATUS_DEGENERATED; } return PlaneGCSSolver_Solver::STATUS_OK; } - -void PlaneGCSSolver_Storage::getUnderconstrainedGeometry(std::set& theFeatures) const -{ - std::set aFreeParams; +void PlaneGCSSolver_Storage::getUnderconstrainedGeometry( + std::set &theFeatures) const { + std::set aFreeParams; mySketchSolver->getFreeParameters(aFreeParams); if (aFreeParams.empty()) return; - for (std::map::const_iterator aFIt = myFeatureMap.begin(); + for (std::map::const_iterator aFIt = + myFeatureMap.begin(); aFIt != myFeatureMap.end(); ++aFIt) { if (!aFIt->second) continue; GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt->second); - for (GCS::SET_pD::iterator aPIt = aParams.begin(); aPIt != aParams.end(); ++aPIt) + for (GCS::SET_pD::iterator aPIt = aParams.begin(); aPIt != aParams.end(); + ++aPIt) if (aFreeParams.find(*aPIt) != aFreeParams.end()) { theFeatures.insert(aFIt->first); break; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h index 6623376a5..74458f7bf 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_Storage_H_ @@ -27,47 +28,48 @@ class PlaneGCSSolver_EntityBuilder; /** \class PlaneGCSSolver_Storage * \ingroup Plugins - * \brief Contains all necessary data in PlaneGCS format to solve a single group of constraints + * \brief Contains all necessary data in PlaneGCS format to solve a single + * group of constraints */ -class PlaneGCSSolver_Storage : public SketchSolver_Storage -{ +class PlaneGCSSolver_Storage : public SketchSolver_Storage { public: - PlaneGCSSolver_Storage(const SolverPtr& theSolver); + PlaneGCSSolver_Storage(const SolverPtr &theSolver); -// ============= Inherited from SketchSolver_Storage ============= + // ============= Inherited from SketchSolver_Storage ============= /// \brief Change mapping between constraint from SketchPlugin and /// a constraint applicable for corresponding solver. /// \param theConstraint [in] original SketchPlugin constraint /// \param theSolverConstraint [in] solver's constraint - virtual void addConstraint(ConstraintPtr theConstraint, + virtual void addConstraint(ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint); /// \brief Add a movement constraint which will be destroyed /// after the next solving of the set of constraints. /// \param theSolverConstraint [in] solver's constraint - virtual void addMovementConstraint(const ConstraintWrapperPtr& theSolverConstraint); + virtual void + addMovementConstraint(const ConstraintWrapperPtr &theSolverConstraint); - - /// \brief Convert feature to the form applicable for specific solver and map it - /// \param theFeature [in] feature to convert - /// \param theForce [in] forced feature creation - /// \return \c true if the feature has been created or updated + /// \brief Convert feature to the form applicable for specific solver and map + /// it \param theFeature [in] feature to convert \param theForce [in] + /// forced feature creation \return \c true if the feature has been created or + /// updated virtual bool update(FeaturePtr theFeature, bool theForce = false); - /// \brief Convert attribute to the form applicable for specific solver and map it - /// \param theAttribute [in] attribute to convert - /// \param theForce [in] forced feature creation - /// \return \c true if the attribute has been created or updated + /// \brief Convert attribute to the form applicable for specific solver and + /// map it \param theAttribute [in] attribute to convert \param theForce [in] + /// forced feature creation \return \c true if the attribute has been created + /// or updated virtual bool update(AttributePtr theAttribute, bool theForce = false); /// \brief Make entity external - virtual void makeExternal(const EntityWrapperPtr& theEntity); + virtual void makeExternal(const EntityWrapperPtr &theEntity); /// \brief Make entity non-external - virtual void makeNonExternal(const EntityWrapperPtr& theEntity); + virtual void makeNonExternal(const EntityWrapperPtr &theEntity); /// \brief Removes constraint from the storage - /// \return \c true if the constraint and all its parameters are removed successfully + /// \return \c true if the constraint and all its parameters are removed + /// successfully virtual bool removeConstraint(ConstraintPtr theConstraint); /// \brief Verify, the sketch contains degenerated geometry @@ -79,44 +81,48 @@ public: virtual void refresh() const; /// \brief Initialize memory for new solver's parameter - double* createParameter(); + double *createParameter(); /// \brief Release memory occupied by parameters - void removeParameters(const GCS::SET_pD& theParams); + void removeParameters(const GCS::SET_pD &theParams); /// \brief Remove all features became invalid virtual void removeInvalidEntities(); /// \brief Check the storage has constraints - virtual bool isEmpty() const - { return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty(); } + virtual bool isEmpty() const { + return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty(); + } /// \brief Make parametrization of arcs consistent. - /// Forward arcs should have the last parameter greater than the first parameter. - /// Reversed arcs should have the last parameter lesser than the first parameter. + /// Forward arcs should have the last parameter greater than the first + /// parameter. Reversed arcs should have the last parameter lesser than + /// the first parameter. virtual void adjustParametrizationOfArcs(); /// \brief Return list of features which are not fully constrained - virtual void getUnderconstrainedGeometry(std::set& theFeatures) const; + virtual void + getUnderconstrainedGeometry(std::set &theFeatures) const; private: /// \brief Convert feature using specified builder. - EntityWrapperPtr createFeature(const FeaturePtr& theFeature, - PlaneGCSSolver_EntityBuilder* theBuilder); + EntityWrapperPtr createFeature(const FeaturePtr &theFeature, + PlaneGCSSolver_EntityBuilder *theBuilder); /// \brief Convert attribute using specified builder. - EntityWrapperPtr createAttribute(const AttributePtr& theAttribute, - PlaneGCSSolver_EntityBuilder* theBuilder); + EntityWrapperPtr createAttribute(const AttributePtr &theAttribute, + PlaneGCSSolver_EntityBuilder *theBuilder); /// \brief Create additional constaints: /// * for arc to fix extra parameters; /// * for ellipse to keep auxiliary points on their places - void createAuxiliaryConstraints(const EntityWrapperPtr& theEntity); - void removeAuxiliaryConstraints(const EntityWrapperPtr& theEntity); + void createAuxiliaryConstraints(const EntityWrapperPtr &theEntity); + void removeAuxiliaryConstraints(const EntityWrapperPtr &theEntity); private: - ConstraintID myConstraintLastID; ///< identifier of last added constraint + ConstraintID myConstraintLastID; ///< identifier of last added constraint - /// additional constraints for correct processing of the arcs, ellipses, elliptic arcs + /// additional constraints for correct processing of the arcs, ellipses, + /// elliptic arcs std::map myAuxConstraintMap; /// list of removed constraints to notify solver diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp index 1f0fd0e7c..9111345d8 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp @@ -14,21 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include #include #include #include #include #include -#include +#include +#include #include #include #include -#include #include #include #include @@ -36,11 +37,11 @@ #include #include #include -#include -#include #include #include #include +#include +#include #include #include @@ -56,8 +57,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -79,192 +80,205 @@ #include +#define GCS_EDGE_WRAPPER(x) \ + std::dynamic_pointer_cast(x) +#define GCS_POINT_WRAPPER(x) \ + std::dynamic_pointer_cast(x) +#define GCS_SCALAR_WRAPPER(x) \ + std::dynamic_pointer_cast(x) -#define GCS_EDGE_WRAPPER(x) std::dynamic_pointer_cast(x) -#define GCS_POINT_WRAPPER(x) std::dynamic_pointer_cast(x) -#define GCS_SCALAR_WRAPPER(x) std::dynamic_pointer_cast(x) - - - -static ConstraintWrapperPtr - createConstraintCoincidence(std::shared_ptr thePoint1, - std::shared_ptr thePoint2); -static ConstraintWrapperPtr - createConstraintPointOnEntity(const SketchSolver_ConstraintType& theType, - std::shared_ptr thePoint, - std::shared_ptr theEntity, - std::shared_ptr theValue); -static ConstraintWrapperPtr - createConstraintPointsCollinear(std::shared_ptr thePoint1, - std::shared_ptr thePoint2, - std::shared_ptr thePoint3); -static ConstraintWrapperPtr - createConstraintDistancePointPoint(std::shared_ptr theValue, - std::shared_ptr thePoint1, - std::shared_ptr thePoint2); -static ConstraintWrapperPtr - createConstraintDistancePointLine(std::shared_ptr theValue, - std::shared_ptr thePoint, - std::shared_ptr theEntity); -static ConstraintWrapperPtr - createConstraintHVDistance(const SketchSolver_ConstraintType& theType, - std::shared_ptr theValue, - std::shared_ptr thePoint1, - std::shared_ptr thePoint2); -static ConstraintWrapperPtr - createConstraintRadius(std::shared_ptr theValue, - std::shared_ptr theEntity); -static ConstraintWrapperPtr - createConstraintAngle(ConstraintPtr theConstraint, - std::shared_ptr theValue, - std::shared_ptr theEntity1, - std::shared_ptr theEntity2); -static ConstraintWrapperPtr - createConstraintHorizVert(const SketchSolver_ConstraintType& theType, - std::shared_ptr theEntity); -static ConstraintWrapperPtr - createConstraintParallel(std::shared_ptr theEntity1, - std::shared_ptr theEntity2); -static ConstraintWrapperPtr - createConstraintPerpendicular(std::shared_ptr theEntity1, - std::shared_ptr theEntity2); -static ConstraintWrapperPtr - createConstraintEqual(const SketchSolver_ConstraintType& theType, - std::shared_ptr theEntity1, - std::shared_ptr theEntity2, - std::shared_ptr theIntermed); +static ConstraintWrapperPtr createConstraintCoincidence( + std::shared_ptr thePoint1, + std::shared_ptr thePoint2); +static ConstraintWrapperPtr createConstraintPointOnEntity( + const SketchSolver_ConstraintType &theType, + std::shared_ptr thePoint, + std::shared_ptr theEntity, + std::shared_ptr theValue); +static ConstraintWrapperPtr createConstraintPointsCollinear( + std::shared_ptr thePoint1, + std::shared_ptr thePoint2, + std::shared_ptr thePoint3); +static ConstraintWrapperPtr createConstraintDistancePointPoint( + std::shared_ptr theValue, + std::shared_ptr thePoint1, + std::shared_ptr thePoint2); +static ConstraintWrapperPtr createConstraintDistancePointLine( + std::shared_ptr theValue, + std::shared_ptr thePoint, + std::shared_ptr theEntity); +static ConstraintWrapperPtr createConstraintHVDistance( + const SketchSolver_ConstraintType &theType, + std::shared_ptr theValue, + std::shared_ptr thePoint1, + std::shared_ptr thePoint2); static ConstraintWrapperPtr - createConstraintMiddlePoint(std::shared_ptr thePoint, - std::shared_ptr theEntity, - std::shared_ptr theAuxParameters); +createConstraintRadius(std::shared_ptr theValue, + std::shared_ptr theEntity); static ConstraintWrapperPtr - createConstraintAngleBetweenCurves(std::shared_ptr theValue, - std::shared_ptr thePoint, - std::shared_ptr theEntity1, - std::shared_ptr theEntity2); - -static GCS::SET_pD scalarParameters(const ScalarWrapperPtr& theScalar); -static GCS::SET_pD scalarArrayParameters(const EntityWrapperPtr& theArray); -static GCS::SET_pD pointParameters(const PointWrapperPtr& thePoint); -static GCS::SET_pD pointArrayParameters(const EntityWrapperPtr& theArray); -static GCS::SET_pD lineParameters(const EdgeWrapperPtr& theLine); -static GCS::SET_pD circleParameters(const EdgeWrapperPtr& theCircle); -static GCS::SET_pD arcParameters(const EdgeWrapperPtr& theArc); -static GCS::SET_pD ellipseParameters(const EdgeWrapperPtr& theEllipse); -static GCS::SET_pD ellipticArcParameters(const EdgeWrapperPtr& theEllipticArc); -static GCS::SET_pD bsplineParameters(const EdgeWrapperPtr& theEdge); - - - - -SolverConstraintPtr PlaneGCSSolver_Tools::createConstraint(ConstraintPtr theConstraint) -{ +createConstraintAngle(ConstraintPtr theConstraint, + std::shared_ptr theValue, + std::shared_ptr theEntity1, + std::shared_ptr theEntity2); +static ConstraintWrapperPtr createConstraintHorizVert( + const SketchSolver_ConstraintType &theType, + std::shared_ptr theEntity); +static ConstraintWrapperPtr createConstraintParallel( + std::shared_ptr theEntity1, + std::shared_ptr theEntity2); +static ConstraintWrapperPtr createConstraintPerpendicular( + std::shared_ptr theEntity1, + std::shared_ptr theEntity2); +static ConstraintWrapperPtr createConstraintEqual( + const SketchSolver_ConstraintType &theType, + std::shared_ptr theEntity1, + std::shared_ptr theEntity2, + std::shared_ptr theIntermed); +static ConstraintWrapperPtr createConstraintMiddlePoint( + std::shared_ptr thePoint, + std::shared_ptr theEntity, + std::shared_ptr theAuxParameters); +static ConstraintWrapperPtr createConstraintAngleBetweenCurves( + std::shared_ptr theValue, + std::shared_ptr thePoint, + std::shared_ptr theEntity1, + std::shared_ptr theEntity2); + +static GCS::SET_pD scalarParameters(const ScalarWrapperPtr &theScalar); +static GCS::SET_pD scalarArrayParameters(const EntityWrapperPtr &theArray); +static GCS::SET_pD pointParameters(const PointWrapperPtr &thePoint); +static GCS::SET_pD pointArrayParameters(const EntityWrapperPtr &theArray); +static GCS::SET_pD lineParameters(const EdgeWrapperPtr &theLine); +static GCS::SET_pD circleParameters(const EdgeWrapperPtr &theCircle); +static GCS::SET_pD arcParameters(const EdgeWrapperPtr &theArc); +static GCS::SET_pD ellipseParameters(const EdgeWrapperPtr &theEllipse); +static GCS::SET_pD ellipticArcParameters(const EdgeWrapperPtr &theEllipticArc); +static GCS::SET_pD bsplineParameters(const EdgeWrapperPtr &theEdge); + +SolverConstraintPtr +PlaneGCSSolver_Tools::createConstraint(ConstraintPtr theConstraint) { if (theConstraint->getKind() == SketchPlugin_ConstraintCoincidence::ID() || - theConstraint->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintCoincidence(theConstraint)); - } else if (theConstraint->getKind() == SketchPlugin_ConstraintCollinear::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintCollinear(theConstraint)); - } else if (theConstraint->getKind() == SketchPlugin_ConstraintDistance::ID() || - theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID() || - theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintDistance(theConstraint)); + theConstraint->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { + return SolverConstraintPtr( + new SketchSolver_ConstraintCoincidence(theConstraint)); + } else if (theConstraint->getKind() == + SketchPlugin_ConstraintCollinear::ID()) { + return SolverConstraintPtr( + new SketchSolver_ConstraintCollinear(theConstraint)); + } else if (theConstraint->getKind() == + SketchPlugin_ConstraintDistance::ID() || + theConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID() || + theConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) { + return SolverConstraintPtr( + new SketchSolver_ConstraintDistance(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintEqual::ID()) { return SolverConstraintPtr(new SketchSolver_ConstraintEqual(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintLength(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintLength(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintMiddle::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintMiddle(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintMiddle(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintMirror(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintMirror(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintTangent::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintTangent(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintTangent(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintRigid::ID()) { return SolverConstraintPtr(new SketchSolver_ConstraintFixed(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintMultiTranslation(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintMultiTranslation(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintMultiRotation(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintMultiRotation(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_ConstraintAngle::ID()) { return SolverConstraintPtr(new SketchSolver_ConstraintAngle(theConstraint)); - } else if (theConstraint->getKind() == SketchPlugin_ConstraintPerpendicular::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintPerpendicular(theConstraint)); + } else if (theConstraint->getKind() == + SketchPlugin_ConstraintPerpendicular::ID()) { + return SolverConstraintPtr( + new SketchSolver_ConstraintPerpendicular(theConstraint)); } else if (theConstraint->getKind() == SketchPlugin_Offset::ID()) { - return SolverConstraintPtr(new SketchSolver_ConstraintOffset(theConstraint)); + return SolverConstraintPtr( + new SketchSolver_ConstraintOffset(theConstraint)); } // All other types of constraints return SolverConstraintPtr(new SketchSolver_Constraint(theConstraint)); } -std::shared_ptr PlaneGCSSolver_Tools::createMovementConstraint( - FeaturePtr theMovedFeature) -{ +std::shared_ptr +PlaneGCSSolver_Tools::createMovementConstraint(FeaturePtr theMovedFeature) { return std::shared_ptr( new SketchSolver_ConstraintMovement(theMovedFeature)); } -std::shared_ptr PlaneGCSSolver_Tools::createMovementConstraint( - AttributePtr theMovedAttribute) -{ +std::shared_ptr +PlaneGCSSolver_Tools::createMovementConstraint(AttributePtr theMovedAttribute) { return std::shared_ptr( new SketchSolver_ConstraintMovement(theMovedAttribute)); } -std::shared_ptr PlaneGCSSolver_Tools::createMovementConstraint( - const std::pair& theMovedPointInArray) -{ +std::shared_ptr +PlaneGCSSolver_Tools::createMovementConstraint( + const std::pair &theMovedPointInArray) { return std::shared_ptr( - new SketchSolver_ConstraintMovement(theMovedPointInArray.first, theMovedPointInArray.second)); + new SketchSolver_ConstraintMovement(theMovedPointInArray.first, + theMovedPointInArray.second)); } - - ConstraintWrapperPtr PlaneGCSSolver_Tools::createConstraint( - ConstraintPtr theConstraint, - const SketchSolver_ConstraintType& theType, - const EntityWrapperPtr& theValue, - const EntityWrapperPtr& thePoint1, - const EntityWrapperPtr& thePoint2, - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2) -{ + ConstraintPtr theConstraint, const SketchSolver_ConstraintType &theType, + const EntityWrapperPtr &theValue, const EntityWrapperPtr &thePoint1, + const EntityWrapperPtr &thePoint2, const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2) { ConstraintWrapperPtr aResult; ScalarWrapperPtr anIntermediate; - std::shared_ptr aPoint1 = GCS_POINT_WRAPPER(thePoint1); - std::shared_ptr aPoint2 = GCS_POINT_WRAPPER(thePoint2); - std::shared_ptr anEntity1 = GCS_EDGE_WRAPPER(theEntity1); + std::shared_ptr aPoint1 = + GCS_POINT_WRAPPER(thePoint1); + std::shared_ptr aPoint2 = + GCS_POINT_WRAPPER(thePoint2); + std::shared_ptr anEntity1 = + GCS_EDGE_WRAPPER(theEntity1); switch (theType) { case CONSTRAINT_PT_PT_COINCIDENT: aResult = createConstraintCoincidence(aPoint1, aPoint2); break; case CONSTRAINT_PT_ON_CURVE: - aResult = anEntity1 ? - createConstraintPointOnEntity(theType, aPoint1, anEntity1, GCS_SCALAR_WRAPPER(theValue)) : - createConstraintPointsCollinear(aPoint1, aPoint2, GCS_POINT_WRAPPER(theEntity1)); + aResult = anEntity1 + ? createConstraintPointOnEntity(theType, aPoint1, anEntity1, + GCS_SCALAR_WRAPPER(theValue)) + : createConstraintPointsCollinear( + aPoint1, aPoint2, GCS_POINT_WRAPPER(theEntity1)); break; case CONSTRAINT_MIDDLE_POINT: - aResult = createConstraintMiddlePoint(aPoint1, GCS_EDGE_WRAPPER(theEntity1), aPoint2); + aResult = createConstraintMiddlePoint(aPoint1, GCS_EDGE_WRAPPER(theEntity1), + aPoint2); break; case CONSTRAINT_PT_PT_DISTANCE: - aResult = createConstraintDistancePointPoint(GCS_SCALAR_WRAPPER(theValue), aPoint1, aPoint2); + aResult = createConstraintDistancePointPoint(GCS_SCALAR_WRAPPER(theValue), + aPoint1, aPoint2); break; case CONSTRAINT_PT_LINE_DISTANCE: aResult = createConstraintDistancePointLine(GCS_SCALAR_WRAPPER(theValue), - aPoint1, - anEntity1); + aPoint1, anEntity1); break; case CONSTRAINT_HORIZONTAL_DISTANCE: case CONSTRAINT_VERTICAL_DISTANCE: - aResult = createConstraintHVDistance(theType, GCS_SCALAR_WRAPPER(theValue), aPoint1, aPoint2); + aResult = createConstraintHVDistance(theType, GCS_SCALAR_WRAPPER(theValue), + aPoint1, aPoint2); break; case CONSTRAINT_RADIUS: aResult = createConstraintRadius(GCS_SCALAR_WRAPPER(theValue), anEntity1); break; case CONSTRAINT_ANGLE: - aResult = createConstraintAngle(theConstraint, - GCS_SCALAR_WRAPPER(theValue), - anEntity1, GCS_EDGE_WRAPPER(theEntity2)); + aResult = createConstraintAngle(theConstraint, GCS_SCALAR_WRAPPER(theValue), + anEntity1, GCS_EDGE_WRAPPER(theEntity2)); break; case CONSTRAINT_FIXED: break; @@ -276,21 +290,22 @@ ConstraintWrapperPtr PlaneGCSSolver_Tools::createConstraint( aResult = createConstraintParallel(anEntity1, GCS_EDGE_WRAPPER(theEntity2)); break; case CONSTRAINT_PERPENDICULAR: - aResult = createConstraintPerpendicular(anEntity1, GCS_EDGE_WRAPPER(theEntity2)); + aResult = + createConstraintPerpendicular(anEntity1, GCS_EDGE_WRAPPER(theEntity2)); break; case CONSTRAINT_PERPENDICULAR_CURVES: aResult = createConstraintAngleBetweenCurves(GCS_SCALAR_WRAPPER(theValue), - aPoint1, anEntity1, GCS_EDGE_WRAPPER(theEntity2)); + aPoint1, anEntity1, + GCS_EDGE_WRAPPER(theEntity2)); break; case CONSTRAINT_EQUAL_LINES: case CONSTRAINT_EQUAL_ELLIPSES: - anIntermediate = GCS_SCALAR_WRAPPER(theValue); // parameter is used to store length of lines + anIntermediate = GCS_SCALAR_WRAPPER( + theValue); // parameter is used to store length of lines case CONSTRAINT_EQUAL_LINE_ARC: case CONSTRAINT_EQUAL_RADIUS: - aResult = createConstraintEqual(theType, - anEntity1, - GCS_EDGE_WRAPPER(theEntity2), - anIntermediate); + aResult = createConstraintEqual( + theType, anEntity1, GCS_EDGE_WRAPPER(theEntity2), anIntermediate); break; default: break; @@ -299,31 +314,33 @@ ConstraintWrapperPtr PlaneGCSSolver_Tools::createConstraint( return aResult; } -std::shared_ptr PlaneGCSSolver_Tools::point(EntityWrapperPtr theEntity) -{ +std::shared_ptr +PlaneGCSSolver_Tools::point(EntityWrapperPtr theEntity) { if (theEntity->type() != ENTITY_POINT) return std::shared_ptr(); std::shared_ptr aPointWrapper = std::dynamic_pointer_cast(theEntity); - const GCSPointPtr& aPoint = aPointWrapper->point(); - return std::shared_ptr(new GeomAPI_Pnt2d(*aPoint->x, *aPoint->y)); + const GCSPointPtr &aPoint = aPointWrapper->point(); + return std::shared_ptr( + new GeomAPI_Pnt2d(*aPoint->x, *aPoint->y)); } -std::shared_ptr PlaneGCSSolver_Tools::line(EntityWrapperPtr theEntity) -{ +std::shared_ptr +PlaneGCSSolver_Tools::line(EntityWrapperPtr theEntity) { if (theEntity->type() != ENTITY_LINE) return std::shared_ptr(); std::shared_ptr anEntity = std::dynamic_pointer_cast(theEntity); - std::shared_ptr aLine = std::dynamic_pointer_cast(anEntity->entity()); - return std::shared_ptr( - new GeomAPI_Lin2d(*(aLine->p1.x), *(aLine->p1.y), *(aLine->p2.x), *(aLine->p2.y))); + std::shared_ptr aLine = + std::dynamic_pointer_cast(anEntity->entity()); + return std::shared_ptr(new GeomAPI_Lin2d( + *(aLine->p1.x), *(aLine->p1.y), *(aLine->p2.x), *(aLine->p2.y))); } -std::shared_ptr PlaneGCSSolver_Tools::line(FeaturePtr theFeature) -{ +std::shared_ptr +PlaneGCSSolver_Tools::line(FeaturePtr theFeature) { if (theFeature->getKind() != SketchPlugin_Line::ID()) return std::shared_ptr(); @@ -332,43 +349,46 @@ std::shared_ptr PlaneGCSSolver_Tools::line(FeaturePtr theFeature) AttributePoint2DPtr aEnd = std::dynamic_pointer_cast( theFeature->attribute(SketchPlugin_Line::END_ID())); - return std::shared_ptr(new GeomAPI_Lin2d(aStart->pnt(), aEnd->pnt())); + return std::shared_ptr( + new GeomAPI_Lin2d(aStart->pnt(), aEnd->pnt())); } -std::shared_ptr PlaneGCSSolver_Tools::circle(EntityWrapperPtr theEntity) -{ +std::shared_ptr +PlaneGCSSolver_Tools::circle(EntityWrapperPtr theEntity) { if (theEntity->type() != ENTITY_CIRCLE && theEntity->type() != ENTITY_ARC) return std::shared_ptr(); std::shared_ptr anEntity = - std::dynamic_pointer_cast(theEntity); - std::shared_ptr aCirc = std::dynamic_pointer_cast(anEntity->entity()); - return std::shared_ptr( - new GeomAPI_Circ2d(*(aCirc->center.x), *(aCirc->center.y), *(aCirc->rad))); + std::dynamic_pointer_cast(theEntity); + std::shared_ptr aCirc = + std::dynamic_pointer_cast(anEntity->entity()); + return std::shared_ptr(new GeomAPI_Circ2d( + *(aCirc->center.x), *(aCirc->center.y), *(aCirc->rad))); } -std::shared_ptr PlaneGCSSolver_Tools::ellipse(EntityWrapperPtr theEntity) -{ - if (theEntity->type() != ENTITY_ELLIPSE && theEntity->type() != ENTITY_ELLIPTIC_ARC) +std::shared_ptr +PlaneGCSSolver_Tools::ellipse(EntityWrapperPtr theEntity) { + if (theEntity->type() != ENTITY_ELLIPSE && + theEntity->type() != ENTITY_ELLIPTIC_ARC) return std::shared_ptr(); std::shared_ptr anEntity = - std::dynamic_pointer_cast(theEntity); + std::dynamic_pointer_cast(theEntity); std::shared_ptr anEllipse = std::dynamic_pointer_cast(anEntity->entity()); std::shared_ptr aCenter( new GeomAPI_Pnt2d(*(anEllipse->center.x), *(anEllipse->center.y))); - std::shared_ptr anAxis(new GeomAPI_Dir2d( - *(anEllipse->focus1.x) - *(anEllipse->center.x), - *(anEllipse->focus1.y) - *(anEllipse->center.y))); + std::shared_ptr anAxis( + new GeomAPI_Dir2d(*(anEllipse->focus1.x) - *(anEllipse->center.x), + *(anEllipse->focus1.y) - *(anEllipse->center.y))); - return std::shared_ptr( - new GeomAPI_Ellipse2d(aCenter, anAxis, anEllipse->getRadMaj(), *anEllipse->radmin)); + return std::shared_ptr(new GeomAPI_Ellipse2d( + aCenter, anAxis, anEllipse->getRadMaj(), *anEllipse->radmin)); } -std::shared_ptr PlaneGCSSolver_Tools::bspline(EntityWrapperPtr theEntity) -{ +std::shared_ptr +PlaneGCSSolver_Tools::bspline(EntityWrapperPtr theEntity) { if (theEntity->type() != ENTITY_BSPLINE) return std::shared_ptr(); @@ -378,7 +398,8 @@ std::shared_ptr PlaneGCSSolver_Tools::bspline(EntityWrapperPt std::dynamic_pointer_cast(anEntity->entity()); std::list aPoles; - for (GCS::VEC_P::iterator anIt = aSpline->poles.begin(); anIt != aSpline->poles.end(); ++anIt) + for (GCS::VEC_P::iterator anIt = aSpline->poles.begin(); + anIt != aSpline->poles.end(); ++anIt) aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*anIt->x, *anIt->y))); std::list aWeights; @@ -387,26 +408,27 @@ std::shared_ptr PlaneGCSSolver_Tools::bspline(EntityWrapperPt aWeights.push_back(**anIt); std::list aKnots; - for (GCS::VEC_pD::iterator anIt = aSpline->knots.begin(); anIt != aSpline->knots.end(); ++anIt) + for (GCS::VEC_pD::iterator anIt = aSpline->knots.begin(); + anIt != aSpline->knots.end(); ++anIt) aKnots.push_back(**anIt); std::list aMultiplicities; aMultiplicities.assign(aSpline->mult.begin(), aSpline->mult.end()); return std::shared_ptr( - new GeomAPI_BSpline2d(aSpline->degree, aPoles, aWeights, - aKnots, aMultiplicities, aSpline->periodic)); + new GeomAPI_BSpline2d(aSpline->degree, aPoles, aWeights, aKnots, + aMultiplicities, aSpline->periodic)); } -void PlaneGCSSolver_Tools::recalculateArcParameters(EntityWrapperPtr theArc) -{ +void PlaneGCSSolver_Tools::recalculateArcParameters(EntityWrapperPtr theArc) { std::shared_ptr anEdge = std::dynamic_pointer_cast(theArc); if (!anEdge) return; if (anEdge->type() == ENTITY_ARC) { - std::shared_ptr anArc = std::dynamic_pointer_cast(anEdge->entity()); + std::shared_ptr anArc = + std::dynamic_pointer_cast(anEdge->entity()); GCS::Point aCenter = anArc->center; GCS::Point aStartPnt = anArc->start; @@ -416,32 +438,34 @@ void PlaneGCSSolver_Tools::recalculateArcParameters(EntityWrapperPtr theArc) static GeomDir2dPtr OX(new GeomAPI_Dir2d(1.0, 0.0)); - GeomDir2dPtr aDir(new GeomAPI_Dir2d(*aStartPnt.x - *aCenter.x, *aStartPnt.y - *aCenter.y)); + GeomDir2dPtr aDir(new GeomAPI_Dir2d(*aStartPnt.x - *aCenter.x, + *aStartPnt.y - *aCenter.y)); *anArc->startAngle = OX->angle(aDir); - aDir.reset(new GeomAPI_Dir2d(*aEndPnt.x - *aCenter.x, *aEndPnt.y - *aCenter.y)); + aDir.reset( + new GeomAPI_Dir2d(*aEndPnt.x - *aCenter.x, *aEndPnt.y - *aCenter.y)); *anArc->endAngle = OX->angle(aDir); - } - else if (anEdge->type() == ENTITY_ELLIPTIC_ARC) { + } else if (anEdge->type() == ENTITY_ELLIPTIC_ARC) { std::shared_ptr aEllArc = std::dynamic_pointer_cast(anEdge->entity()); - GeomPnt2dPtr aCenter(new GeomAPI_Pnt2d(*aEllArc->center.x, *aEllArc->center.y)); - GeomPnt2dPtr aStartPnt(new GeomAPI_Pnt2d(*aEllArc->start.x, *aEllArc->start.y)); + GeomPnt2dPtr aCenter( + new GeomAPI_Pnt2d(*aEllArc->center.x, *aEllArc->center.y)); + GeomPnt2dPtr aStartPnt( + new GeomAPI_Pnt2d(*aEllArc->start.x, *aEllArc->start.y)); GeomPnt2dPtr aEndPnt(new GeomAPI_Pnt2d(*aEllArc->end.x, *aEllArc->end.y)); GeomDir2dPtr anAxis(new GeomAPI_Dir2d(*aEllArc->focus1.x - aCenter->x(), *aEllArc->focus1.y - aCenter->y())); - GeomAPI_Ellipse2d anEllipse(aCenter, anAxis, aEllArc->getRadMaj(), *aEllArc->radmin); + GeomAPI_Ellipse2d anEllipse(aCenter, anAxis, aEllArc->getRadMaj(), + *aEllArc->radmin); anEllipse.parameter(aStartPnt, 1.e-4, *aEllArc->startAngle); anEllipse.parameter(aEndPnt, 1.e-4, *aEllArc->endAngle); } } - - -GCS::SET_pD PlaneGCSSolver_Tools::parameters(const EntityWrapperPtr& theEntity) -{ +GCS::SET_pD +PlaneGCSSolver_Tools::parameters(const EntityWrapperPtr &theEntity) { switch (theEntity->type()) { case ENTITY_SCALAR: case ENTITY_ANGLE: @@ -464,29 +488,26 @@ GCS::SET_pD PlaneGCSSolver_Tools::parameters(const EntityWrapperPtr& theEntity) return ellipticArcParameters(GCS_EDGE_WRAPPER(theEntity)); case ENTITY_BSPLINE: return bsplineParameters(GCS_EDGE_WRAPPER(theEntity)); - default: break; + default: + break; } return GCS::SET_pD(); } -bool PlaneGCSSolver_Tools::isAttributeApplicable(const std::string& theAttrName, - const std::string& theOwnerName) -{ +bool PlaneGCSSolver_Tools::isAttributeApplicable( + const std::string &theAttrName, const std::string &theOwnerName) { if (theOwnerName == SketchPlugin_Arc::ID()) { return theAttrName == SketchPlugin_Arc::CENTER_ID() || theAttrName == SketchPlugin_Arc::START_ID() || theAttrName == SketchPlugin_Arc::END_ID() || theAttrName == SketchPlugin_Arc::REVERSED_ID(); - } - else if (theOwnerName == SketchPlugin_Circle::ID()) { + } else if (theOwnerName == SketchPlugin_Circle::ID()) { return theAttrName == SketchPlugin_Circle::CENTER_ID() || theAttrName == SketchPlugin_Circle::RADIUS_ID(); - } - else if (theOwnerName == SketchPlugin_Line::ID()) { + } else if (theOwnerName == SketchPlugin_Line::ID()) { return theAttrName == SketchPlugin_Line::START_ID() || theAttrName == SketchPlugin_Line::END_ID(); - } - else if (theOwnerName == SketchPlugin_Ellipse::ID()) { + } else if (theOwnerName == SketchPlugin_Ellipse::ID()) { return theAttrName == SketchPlugin_Ellipse::CENTER_ID() || theAttrName == SketchPlugin_Ellipse::FIRST_FOCUS_ID() || theAttrName == SketchPlugin_Ellipse::SECOND_FOCUS_ID() || @@ -496,8 +517,7 @@ bool PlaneGCSSolver_Tools::isAttributeApplicable(const std::string& theAttrName, theAttrName == SketchPlugin_Ellipse::MINOR_AXIS_END_ID() || theAttrName == SketchPlugin_Ellipse::MAJOR_RADIUS_ID() || theAttrName == SketchPlugin_Ellipse::MINOR_RADIUS_ID(); - } - else if (theOwnerName == SketchPlugin_EllipticArc::ID()) { + } else if (theOwnerName == SketchPlugin_EllipticArc::ID()) { return theAttrName == SketchPlugin_EllipticArc::CENTER_ID() || theAttrName == SketchPlugin_EllipticArc::FIRST_FOCUS_ID() || theAttrName == SketchPlugin_EllipticArc::SECOND_FOCUS_ID() || @@ -510,8 +530,7 @@ bool PlaneGCSSolver_Tools::isAttributeApplicable(const std::string& theAttrName, theAttrName == SketchPlugin_EllipticArc::START_POINT_ID() || theAttrName == SketchPlugin_EllipticArc::END_POINT_ID() || theAttrName == SketchPlugin_EllipticArc::REVERSED_ID(); - } - else if (theOwnerName == SketchPlugin_BSpline::ID()) { + } else if (theOwnerName == SketchPlugin_BSpline::ID()) { return theAttrName == SketchPlugin_BSpline::POLES_ID() || theAttrName == SketchPlugin_BSpline::WEIGHTS_ID() || theAttrName == SketchPlugin_BSpline::KNOTS_ID() || @@ -519,8 +538,7 @@ bool PlaneGCSSolver_Tools::isAttributeApplicable(const std::string& theAttrName, theAttrName == SketchPlugin_BSpline::DEGREE_ID() || theAttrName == SketchPlugin_BSpline::START_ID() || theAttrName == SketchPlugin_BSpline::END_ID(); - } - else if (theOwnerName == SketchPlugin_BSplinePeriodic::ID()) { + } else if (theOwnerName == SketchPlugin_BSplinePeriodic::ID()) { return theAttrName == SketchPlugin_BSplinePeriodic::POLES_ID() || theAttrName == SketchPlugin_BSplinePeriodic::WEIGHTS_ID() || theAttrName == SketchPlugin_BSplinePeriodic::KNOTS_ID() || @@ -532,58 +550,48 @@ bool PlaneGCSSolver_Tools::isAttributeApplicable(const std::string& theAttrName, } /// \brief Update value -bool PlaneGCSSolver_Tools::updateValue(const double& theSource, double& theDest, - const double theTolerance) -{ +bool PlaneGCSSolver_Tools::updateValue(const double &theSource, double &theDest, + const double theTolerance) { bool isUpdated = fabs(theSource - theDest) > theTolerance; if (isUpdated) theDest = theSource; return isUpdated; } - -double PlaneGCSSolver_Tools::distance(const GCS::Point& thePnt1, const GCS::Point& thePnt2) -{ +double PlaneGCSSolver_Tools::distance(const GCS::Point &thePnt1, + const GCS::Point &thePnt2) { double x = *thePnt1.x - *thePnt2.x; double y = *thePnt1.y - *thePnt2.y; - return sqrt(x*x + y*y); + return sqrt(x * x + y * y); } - - - // ================ AttributeArray methods ========================== -PlaneGCSSolver_Tools::AttributeArray::AttributeArray(AttributePtr theAttribute) -{ - myDouble = std::dynamic_pointer_cast(theAttribute); - myInteger = std::dynamic_pointer_cast(theAttribute); +PlaneGCSSolver_Tools::AttributeArray::AttributeArray( + AttributePtr theAttribute) { + myDouble = + std::dynamic_pointer_cast(theAttribute); + myInteger = + std::dynamic_pointer_cast(theAttribute); } -bool PlaneGCSSolver_Tools::AttributeArray::isInitialized() const -{ - return (myDouble && myDouble->isInitialized()) || (myInteger && myInteger->isInitialized()); +bool PlaneGCSSolver_Tools::AttributeArray::isInitialized() const { + return (myDouble && myDouble->isInitialized()) || + (myInteger && myInteger->isInitialized()); } -int PlaneGCSSolver_Tools::AttributeArray::size() const -{ +int PlaneGCSSolver_Tools::AttributeArray::size() const { return myDouble.get() ? myDouble->size() : myInteger->size(); } -double PlaneGCSSolver_Tools::AttributeArray::value(const int theIndex) const -{ - return myDouble.get() ? myDouble->value(theIndex) : myInteger->value(theIndex); +double PlaneGCSSolver_Tools::AttributeArray::value(const int theIndex) const { + return myDouble.get() ? myDouble->value(theIndex) + : myInteger->value(theIndex); } - - - - - // ================ Auxiliary functions ========================== ConstraintWrapperPtr createConstraintCoincidence( std::shared_ptr thePoint1, - std::shared_ptr thePoint2) -{ + std::shared_ptr thePoint2) { GCSPointPtr aPoint1 = thePoint1->point(); GCSPointPtr aPoint2 = thePoint2->point(); @@ -599,27 +607,28 @@ ConstraintWrapperPtr createConstraintCoincidence( } ConstraintWrapperPtr createConstraintPointOnEntity( - const SketchSolver_ConstraintType& theType, + const SketchSolver_ConstraintType &theType, std::shared_ptr thePoint, std::shared_ptr theEntity, - std::shared_ptr theValue) -{ + std::shared_ptr theValue) { GCSConstraintPtr aNewConstr; switch (theEntity->type()) { case ENTITY_LINE: { - std::shared_ptr aLine = std::dynamic_pointer_cast(theEntity->entity()); - aNewConstr = GCSConstraintPtr(new GCS::ConstraintPointOnLine(*(thePoint->point()), *aLine)); + std::shared_ptr aLine = + std::dynamic_pointer_cast(theEntity->entity()); + aNewConstr = GCSConstraintPtr( + new GCS::ConstraintPointOnLine(*(thePoint->point()), *aLine)); break; - } + } case ENTITY_ARC: case ENTITY_CIRCLE: { std::shared_ptr aCirc = - std::dynamic_pointer_cast(theEntity->entity()); - aNewConstr = GCSConstraintPtr( - new GCS::ConstraintP2PDistance(*(thePoint->point()), aCirc->center, aCirc->rad)); + std::dynamic_pointer_cast(theEntity->entity()); + aNewConstr = GCSConstraintPtr(new GCS::ConstraintP2PDistance( + *(thePoint->point()), aCirc->center, aCirc->rad)); break; - } + } case ENTITY_ELLIPSE: case ENTITY_ELLIPTIC_ARC: { std::shared_ptr anEllipse = @@ -627,27 +636,30 @@ ConstraintWrapperPtr createConstraintPointOnEntity( aNewConstr = GCSConstraintPtr( new GCS::ConstraintPointOnEllipse(*(thePoint->point()), *anEllipse)); break; - } + } case ENTITY_BSPLINE: { std::list aConstraints; aConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintCurveValue( - *thePoint->point(), thePoint->point()->x, *theEntity->entity(), theValue->scalar()))); + *thePoint->point(), thePoint->point()->x, *theEntity->entity(), + theValue->scalar()))); aConstraints.push_back(GCSConstraintPtr(new GCS::ConstraintCurveValue( - *thePoint->point(), thePoint->point()->y, *theEntity->entity(), theValue->scalar()))); - return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper(aConstraints, theType)); + *thePoint->point(), thePoint->point()->y, *theEntity->entity(), + theValue->scalar()))); + return ConstraintWrapperPtr( + new PlaneGCSSolver_ConstraintWrapper(aConstraints, theType)); } default: return ConstraintWrapperPtr(); } - return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper(aNewConstr, theType)); + return ConstraintWrapperPtr( + new PlaneGCSSolver_ConstraintWrapper(aNewConstr, theType)); } ConstraintWrapperPtr createConstraintPointsCollinear( std::shared_ptr thePoint1, std::shared_ptr thePoint2, - std::shared_ptr thePoint3) -{ + std::shared_ptr thePoint3) { GCSConstraintPtr aNewConstr(new GCS::ConstraintPointOnLine( *(thePoint1->point()), *(thePoint2->point()), *(thePoint3->point()))); return ConstraintWrapperPtr( @@ -655,13 +667,12 @@ ConstraintWrapperPtr createConstraintPointsCollinear( } template -void createConstraintMiddlePointOnArc(ARCTYPE theArc, - GCSPointPtr thePoint, - std::shared_ptr theAuxParameters, - std::list& theConstraints) -{ - double* u = theAuxParameters->point()->x; - double* diff = theAuxParameters->point()->y; +void createConstraintMiddlePointOnArc( + ARCTYPE theArc, GCSPointPtr thePoint, + std::shared_ptr theAuxParameters, + std::list &theConstraints) { + double *u = theAuxParameters->point()->x; + double *diff = theAuxParameters->point()->y; *u = (*theArc->startAngle + *theArc->endAngle) * 0.5; *diff = (*theArc->endAngle - *theArc->startAngle) * 0.5; @@ -678,67 +689,71 @@ void createConstraintMiddlePointOnArc(ARCTYPE theArc, ConstraintWrapperPtr createConstraintMiddlePoint( std::shared_ptr thePoint, std::shared_ptr theEntity, - std::shared_ptr theAuxParameters) -{ + std::shared_ptr theAuxParameters) { std::list aConstrList; GCSPointPtr aPoint = thePoint->point(); - std::shared_ptr aLine = std::dynamic_pointer_cast(theEntity->entity()); + std::shared_ptr aLine = + std::dynamic_pointer_cast(theEntity->entity()); if (aLine) { - aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintPointOnLine(*aPoint, *aLine))); aConstrList.push_back( - GCSConstraintPtr(new GCS::ConstraintPointOnPerpBisector(*aPoint, aLine->p1, aLine->p2))); - } - else { - std::shared_ptr anArc = std::dynamic_pointer_cast(theEntity->entity()); + GCSConstraintPtr(new GCS::ConstraintPointOnLine(*aPoint, *aLine))); + aConstrList.push_back(GCSConstraintPtr( + new GCS::ConstraintPointOnPerpBisector(*aPoint, aLine->p1, aLine->p2))); + } else { + std::shared_ptr anArc = + std::dynamic_pointer_cast(theEntity->entity()); if (anArc) - createConstraintMiddlePointOnArc(anArc, aPoint, theAuxParameters, aConstrList); + createConstraintMiddlePointOnArc(anArc, aPoint, theAuxParameters, + aConstrList); else { std::shared_ptr aEllArc = std::dynamic_pointer_cast(theEntity->entity()); if (aEllArc) - createConstraintMiddlePointOnArc(aEllArc, aPoint, theAuxParameters, aConstrList); + createConstraintMiddlePointOnArc(aEllArc, aPoint, theAuxParameters, + aConstrList); } } - return aConstrList.empty() ? ConstraintWrapperPtr() : ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aConstrList, CONSTRAINT_MIDDLE_POINT)); + return aConstrList.empty() + ? ConstraintWrapperPtr() + : ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aConstrList, CONSTRAINT_MIDDLE_POINT)); } - ConstraintWrapperPtr createConstraintDistancePointPoint( std::shared_ptr theValue, - std::shared_ptr thePoint1, - std::shared_ptr thePoint2) -{ + std::shared_ptr thePoint1, + std::shared_ptr thePoint2) { GCSConstraintPtr aNewConstr(new GCS::ConstraintP2PDistance( *(thePoint1->point()), *(thePoint2->point()), theValue->scalar())); std::shared_ptr aResult( - new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_PT_PT_DISTANCE)); + new PlaneGCSSolver_ConstraintWrapper(aNewConstr, + CONSTRAINT_PT_PT_DISTANCE)); aResult->setValueParameter(theValue); return aResult; } ConstraintWrapperPtr createConstraintDistancePointLine( std::shared_ptr theValue, - std::shared_ptr thePoint, - std::shared_ptr theEntity) -{ - std::shared_ptr aLine = std::dynamic_pointer_cast(theEntity->entity()); + std::shared_ptr thePoint, + std::shared_ptr theEntity) { + std::shared_ptr aLine = + std::dynamic_pointer_cast(theEntity->entity()); GCSConstraintPtr aNewConstr(new GCS::ConstraintP2LDistance( *(thePoint->point()), *(aLine), theValue->scalar())); std::shared_ptr aResult( - new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_PT_LINE_DISTANCE)); + new PlaneGCSSolver_ConstraintWrapper(aNewConstr, + CONSTRAINT_PT_LINE_DISTANCE)); aResult->setValueParameter(theValue); return aResult; } ConstraintWrapperPtr createConstraintHVDistance( - const SketchSolver_ConstraintType& theType, + const SketchSolver_ConstraintType &theType, std::shared_ptr theValue, std::shared_ptr thePoint1, - std::shared_ptr thePoint2) -{ + std::shared_ptr thePoint2) { GCSPointPtr aPoint1 = thePoint1->point(); GCSPointPtr aPoint2 = thePoint2->point(); @@ -751,7 +766,8 @@ ConstraintWrapperPtr createConstraintHVDistance( aParam2 = aPoint2->y; } - GCSConstraintPtr aNewConstr(new GCS::ConstraintDifference(aParam1, aParam2, theValue->scalar())); + GCSConstraintPtr aNewConstr( + new GCS::ConstraintDifference(aParam1, aParam2, theValue->scalar())); std::shared_ptr aResult( new PlaneGCSSolver_ConstraintWrapper(aNewConstr, theType)); @@ -759,27 +775,28 @@ ConstraintWrapperPtr createConstraintHVDistance( return aResult; } -ConstraintWrapperPtr createConstraintRadius( - std::shared_ptr theValue, - std::shared_ptr theEntity) -{ +ConstraintWrapperPtr +createConstraintRadius(std::shared_ptr theValue, + std::shared_ptr theEntity) { std::shared_ptr aCircle = - std::dynamic_pointer_cast(theEntity->entity()); - GCSConstraintPtr aNewConstr(new GCS::ConstraintEqual(aCircle->rad, theValue->scalar())); + std::dynamic_pointer_cast(theEntity->entity()); + GCSConstraintPtr aNewConstr( + new GCS::ConstraintEqual(aCircle->rad, theValue->scalar())); std::shared_ptr aResult( new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_RADIUS)); aResult->setValueParameter(theValue); return aResult; } -ConstraintWrapperPtr createConstraintAngle( - ConstraintPtr theConstraint, - std::shared_ptr theValue, - std::shared_ptr theEntity1, - std::shared_ptr theEntity2) -{ - std::shared_ptr aLine1 = std::dynamic_pointer_cast(theEntity1->entity()); - std::shared_ptr aLine2 = std::dynamic_pointer_cast(theEntity2->entity()); +ConstraintWrapperPtr +createConstraintAngle(ConstraintPtr theConstraint, + std::shared_ptr theValue, + std::shared_ptr theEntity1, + std::shared_ptr theEntity2) { + std::shared_ptr aLine1 = + std::dynamic_pointer_cast(theEntity1->entity()); + std::shared_ptr aLine2 = + std::dynamic_pointer_cast(theEntity2->entity()); GCSConstraintPtr aNewConstr(new GCS::ConstraintL2LAngle( aLine1->p1, aLine1->p2, aLine2->p1, aLine2->p2, theValue->scalar())); @@ -791,26 +808,31 @@ ConstraintWrapperPtr createConstraintAngle( } ConstraintWrapperPtr createConstraintHorizVert( - const SketchSolver_ConstraintType& theType, - std::shared_ptr theEntity) -{ - std::shared_ptr aLine = std::dynamic_pointer_cast(theEntity->entity()); + const SketchSolver_ConstraintType &theType, + std::shared_ptr theEntity) { + std::shared_ptr aLine = + std::dynamic_pointer_cast(theEntity->entity()); GCSConstraintPtr aNewConstr; if (theType == CONSTRAINT_HORIZONTAL) - aNewConstr = GCSConstraintPtr(new GCS::ConstraintEqual(aLine->p1.y, aLine->p2.y)); + aNewConstr = + GCSConstraintPtr(new GCS::ConstraintEqual(aLine->p1.y, aLine->p2.y)); else - aNewConstr = GCSConstraintPtr(new GCS::ConstraintEqual(aLine->p1.x, aLine->p2.x)); + aNewConstr = + GCSConstraintPtr(new GCS::ConstraintEqual(aLine->p1.x, aLine->p2.x)); - return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper(aNewConstr, theType)); + return ConstraintWrapperPtr( + new PlaneGCSSolver_ConstraintWrapper(aNewConstr, theType)); } ConstraintWrapperPtr createConstraintParallel( std::shared_ptr theEntity1, - std::shared_ptr theEntity2) -{ - std::shared_ptr aLine1 = std::dynamic_pointer_cast(theEntity1->entity()); - std::shared_ptr aLine2 = std::dynamic_pointer_cast(theEntity2->entity()); - GCSConstraintPtr aNewConstr(new GCS::ConstraintParallel(*(aLine1), *(aLine2))); + std::shared_ptr theEntity2) { + std::shared_ptr aLine1 = + std::dynamic_pointer_cast(theEntity1->entity()); + std::shared_ptr aLine2 = + std::dynamic_pointer_cast(theEntity2->entity()); + GCSConstraintPtr aNewConstr( + new GCS::ConstraintParallel(*(aLine1), *(aLine2))); return ConstraintWrapperPtr( new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_PARALLEL)); @@ -818,10 +840,11 @@ ConstraintWrapperPtr createConstraintParallel( ConstraintWrapperPtr createConstraintPerpendicular( std::shared_ptr theEntity1, - std::shared_ptr theEntity2) -{ - std::shared_ptr aLine1 = std::dynamic_pointer_cast(theEntity1->entity()); - std::shared_ptr aLine2 = std::dynamic_pointer_cast(theEntity2->entity()); + std::shared_ptr theEntity2) { + std::shared_ptr aLine1 = + std::dynamic_pointer_cast(theEntity1->entity()); + std::shared_ptr aLine2 = + std::dynamic_pointer_cast(theEntity2->entity()); std::shared_ptr aCirc1 = std::dynamic_pointer_cast(theEntity1->entity()); @@ -840,44 +863,45 @@ ConstraintWrapperPtr createConstraintPerpendicular( aNewConstr.reset(new GCS::ConstraintPointOnLine(aCirc1->center, *aLine1)); } - return ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_PERPENDICULAR)); + return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aNewConstr, CONSTRAINT_PERPENDICULAR)); } ConstraintWrapperPtr createConstraintAngleBetweenCurves( std::shared_ptr theValue, std::shared_ptr thePoint, std::shared_ptr theEntity1, - std::shared_ptr theEntity2) -{ + std::shared_ptr theEntity2) { GCSConstraintPtr aNewConstr(new GCS::ConstraintAngleViaPoint( - *theEntity1->entity(), *theEntity2->entity(), *thePoint->point(), theValue->scalar())); - return ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_PERPENDICULAR_CURVES)); + *theEntity1->entity(), *theEntity2->entity(), *thePoint->point(), + theValue->scalar())); + return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aNewConstr, CONSTRAINT_PERPENDICULAR_CURVES)); } ConstraintWrapperPtr createConstraintEqual( - const SketchSolver_ConstraintType& theType, + const SketchSolver_ConstraintType &theType, std::shared_ptr theEntity1, std::shared_ptr theEntity2, - std::shared_ptr theIntermed) -{ + std::shared_ptr theIntermed) { if (theType == CONSTRAINT_EQUAL_LINE_ARC) return ConstraintWrapperPtr(); // line-arc equivalence is not supported yet std::list aConstrList; if (theType == CONSTRAINT_EQUAL_LINES) { - std::shared_ptr aLine1 = std::dynamic_pointer_cast(theEntity1->entity()); - std::shared_ptr aLine2 = std::dynamic_pointer_cast(theEntity2->entity()); + std::shared_ptr aLine1 = + std::dynamic_pointer_cast(theEntity1->entity()); + std::shared_ptr aLine2 = + std::dynamic_pointer_cast(theEntity2->entity()); - aConstrList.push_back(GCSConstraintPtr( - new GCS::ConstraintP2PDistance(aLine1->p1, aLine1->p2, theIntermed->scalar()))); - aConstrList.push_back(GCSConstraintPtr( - new GCS::ConstraintP2PDistance(aLine2->p1, aLine2->p2, theIntermed->scalar()))); + aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintP2PDistance( + aLine1->p1, aLine1->p2, theIntermed->scalar()))); + aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintP2PDistance( + aLine2->p1, aLine2->p2, theIntermed->scalar()))); // update value of intermediate parameter - theIntermed->setValue(PlaneGCSSolver_Tools::distance(aLine1->p1, aLine1->p2)); - } - else if (theType == CONSTRAINT_EQUAL_ELLIPSES) { + theIntermed->setValue( + PlaneGCSSolver_Tools::distance(aLine1->p1, aLine1->p2)); + } else if (theType == CONSTRAINT_EQUAL_ELLIPSES) { std::shared_ptr anEllipse1 = std::dynamic_pointer_cast(theEntity1->entity()); std::shared_ptr anEllipse2 = @@ -890,14 +914,15 @@ ConstraintWrapperPtr createConstraintEqual( aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintP2PDistance( anEllipse2->center, anEllipse2->focus1, theIntermed->scalar()))); // update value of intermediate parameter - theIntermed->setValue(PlaneGCSSolver_Tools::distance(anEllipse1->center, anEllipse1->focus1)); - } - else { + theIntermed->setValue( + PlaneGCSSolver_Tools::distance(anEllipse1->center, anEllipse1->focus1)); + } else { std::shared_ptr aCirc1 = std::dynamic_pointer_cast(theEntity1->entity()); std::shared_ptr aCirc2 = std::dynamic_pointer_cast(theEntity2->entity()); - aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(aCirc1->rad, aCirc2->rad))); + aConstrList.push_back( + GCSConstraintPtr(new GCS::ConstraintEqual(aCirc1->rad, aCirc2->rad))); } std::shared_ptr aResult( @@ -907,34 +932,31 @@ ConstraintWrapperPtr createConstraintEqual( return aResult; } -GCS::SET_pD scalarParameters(const ScalarWrapperPtr& theScalar) -{ +GCS::SET_pD scalarParameters(const ScalarWrapperPtr &theScalar) { GCS::SET_pD aParams; aParams.insert(theScalar->scalar()); return aParams; } -GCS::SET_pD scalarArrayParameters(const EntityWrapperPtr& theArray) -{ +GCS::SET_pD scalarArrayParameters(const EntityWrapperPtr &theArray) { ScalarArrayWrapperPtr anArray = std::dynamic_pointer_cast(theArray); return GCS::SET_pD(anArray->array().begin(), anArray->array().end()); } -GCS::SET_pD pointParameters(const PointWrapperPtr& thePoint) -{ +GCS::SET_pD pointParameters(const PointWrapperPtr &thePoint) { GCS::SET_pD aParams; aParams.insert(thePoint->point()->x); aParams.insert(thePoint->point()->y); return aParams; } -GCS::SET_pD pointArrayParameters(const EntityWrapperPtr& theArray) -{ +GCS::SET_pD pointArrayParameters(const EntityWrapperPtr &theArray) { GCS::SET_pD aParams; PointArrayWrapperPtr aPoints = std::dynamic_pointer_cast(theArray); - for (std::vector::const_iterator anIt = aPoints->array().begin(); + for (std::vector::const_iterator anIt = + aPoints->array().begin(); anIt != aPoints->array().end(); ++anIt) { GCS::SET_pD aPointParams = PlaneGCSSolver_Tools::parameters(*anIt); aParams.insert(aPointParams.begin(), aPointParams.end()); @@ -942,10 +964,10 @@ GCS::SET_pD pointArrayParameters(const EntityWrapperPtr& theArray) return aParams; } -GCS::SET_pD lineParameters(const EdgeWrapperPtr& theLine) -{ +GCS::SET_pD lineParameters(const EdgeWrapperPtr &theLine) { GCS::SET_pD aParams; - std::shared_ptr aLine = std::dynamic_pointer_cast(theLine->entity()); + std::shared_ptr aLine = + std::dynamic_pointer_cast(theLine->entity()); aParams.insert(aLine->p1.x); aParams.insert(aLine->p1.y); aParams.insert(aLine->p2.x); @@ -953,20 +975,20 @@ GCS::SET_pD lineParameters(const EdgeWrapperPtr& theLine) return aParams; } -GCS::SET_pD circleParameters(const EdgeWrapperPtr& theCircle) -{ +GCS::SET_pD circleParameters(const EdgeWrapperPtr &theCircle) { GCS::SET_pD aParams; - std::shared_ptr aCirc = std::dynamic_pointer_cast(theCircle->entity()); + std::shared_ptr aCirc = + std::dynamic_pointer_cast(theCircle->entity()); aParams.insert(aCirc->center.x); aParams.insert(aCirc->center.y); aParams.insert(aCirc->rad); return aParams; } -GCS::SET_pD arcParameters(const EdgeWrapperPtr& theArc) -{ +GCS::SET_pD arcParameters(const EdgeWrapperPtr &theArc) { GCS::SET_pD aParams = circleParameters(theArc); - std::shared_ptr anArc = std::dynamic_pointer_cast(theArc->entity()); + std::shared_ptr anArc = + std::dynamic_pointer_cast(theArc->entity()); aParams.insert(anArc->start.x); aParams.insert(anArc->start.y); aParams.insert(anArc->end.x); @@ -976,8 +998,7 @@ GCS::SET_pD arcParameters(const EdgeWrapperPtr& theArc) return aParams; } -GCS::SET_pD ellipseParameters(const EdgeWrapperPtr& theEllipse) -{ +GCS::SET_pD ellipseParameters(const EdgeWrapperPtr &theEllipse) { GCS::SET_pD aParams; std::shared_ptr anEllipse = std::dynamic_pointer_cast(theEllipse->entity()); @@ -989,8 +1010,7 @@ GCS::SET_pD ellipseParameters(const EdgeWrapperPtr& theEllipse) return aParams; } -GCS::SET_pD ellipticArcParameters(const EdgeWrapperPtr& theEllipticArc) -{ +GCS::SET_pD ellipticArcParameters(const EdgeWrapperPtr &theEllipticArc) { GCS::SET_pD aParams = ellipseParameters(theEllipticArc); std::shared_ptr anArc = std::dynamic_pointer_cast(theEllipticArc->entity()); @@ -1003,18 +1023,19 @@ GCS::SET_pD ellipticArcParameters(const EdgeWrapperPtr& theEllipticArc) return aParams; } -GCS::SET_pD bsplineParameters(const EdgeWrapperPtr& theEdge) -{ +GCS::SET_pD bsplineParameters(const EdgeWrapperPtr &theEdge) { GCS::SET_pD aParams; std::shared_ptr aBSpline = - std::dynamic_pointer_cast(theEdge->entity()); + std::dynamic_pointer_cast(theEdge->entity()); - for (GCS::VEC_P::iterator it = aBSpline->poles.begin(); it != aBSpline->poles.end(); ++it) { + for (GCS::VEC_P::iterator it = aBSpline->poles.begin(); + it != aBSpline->poles.end(); ++it) { aParams.insert(it->x); aParams.insert(it->y); } - for (GCS::VEC_pD::iterator it = aBSpline->weights.begin(); it != aBSpline->weights.end(); ++it) + for (GCS::VEC_pD::iterator it = aBSpline->weights.begin(); + it != aBSpline->weights.end(); ++it) aParams.insert(*it); return aParams; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h index 3e615dcf1..6ead5aeb2 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_Tools_H_ #define PlaneGCSSolver_Tools_H_ +#include #include #include -#include class GeomAPI_BSpline2d; class GeomAPI_Circ2d; @@ -37,97 +38,95 @@ class ModelAPI_AttributeIntArray; * \ingroup Plugins * \brief Converter tools */ -namespace PlaneGCSSolver_Tools -{ - /// \brief Creates a solver's constraint using given SketchPlugin constraint - /// or returns empty pointer if not all attributes are correct - SolverConstraintPtr createConstraint(ConstraintPtr theConstraint); - - /// \brief Creates temporary constraint to fix the feature after movement - std::shared_ptr - createMovementConstraint(FeaturePtr theMovedFeature); - /// \brief Creates temporary constraint to fix the attribute after movement - std::shared_ptr - createMovementConstraint(AttributePtr theMovedAttribute); - /// \brief Creates temporary constraint to fix the point in array after movement - std::shared_ptr - createMovementConstraint(const std::pair& theMovedPointInArray); - - /// \brief Creates new constraint using given parameters - /// \param theConstraint [in] original constraint - /// \param theType [in] type of constraint - /// \param theValue [in] numeric characteristic of constraint - /// (e.g. distance or radius) if applicable - /// \param theEntity1 [in] first attribute of constraint - /// \param theEntity2 [in] second attribute of constraint - /// \param theEntity3 [in] third attribute of constraint - /// \param theEntity4 [in] fourth attribute of constraint - /// \return Created wrapper of constraints applicable for specific solver. - ConstraintWrapperPtr createConstraint(ConstraintPtr theConstraint, - const SketchSolver_ConstraintType& theType, - const EntityWrapperPtr& theValue, - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(), - const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(), - const EntityWrapperPtr& theEntity4 = EntityWrapperPtr()); - - /// \brief Return \c true if the attribute is used in PlaneGCS solver - /// \param[in] theAttrName name of the attribute - /// \param[in] theOwnerName name of the parent feature - bool isAttributeApplicable(const std::string& theAttrName, - const std::string& theOwnerName); - - /// \brief Convert entity to point - /// \return empty pointer if the entity is not a point - std::shared_ptr point(EntityWrapperPtr theEntity); - /// \brief Convert entity to line - /// \return empty pointer if the entity is not a line - std::shared_ptr line(EntityWrapperPtr theEntity); - /// \brief Convert entity to circle - /// \return empty pointer if the entity is not a circle - std::shared_ptr circle(EntityWrapperPtr theEntity); - /// \brief Convert entity to ellipse - /// \return empty pointer if the entity is not an ellipse - std::shared_ptr ellipse(EntityWrapperPtr theEntity); - /// \brief Convert entity to Bs-pline - /// \return empty pointer if the entity is not an ellipse - std::shared_ptr bspline(EntityWrapperPtr theEntity); - - /// \brief Convert entity to line - /// \return empty pointer if the entity is not a line - std::shared_ptr line(FeaturePtr theFeature); - - /// \brief Update start and end parameters of circular and elliptic arcs - /// respectively to start and end points on the arc. - /// For the circular arc, the radius is calculated too. - void recalculateArcParameters(EntityWrapperPtr theArc); - - /// brief Return list of parameters for the given entity - GCS::SET_pD parameters(const EntityWrapperPtr& theEntity); - - /// \brief Update value in theDest if theSource is differ more than theTolerance - /// \return \c true if the value was updated. - bool updateValue(const double& theSource, double& theDest, - const double theTolerance = 1.e4 * tolerance); - - double distance(const GCS::Point& thePnt1, const GCS::Point& thePnt2); - - /// \brief Provide an interface to access values in attribute which is an array of values - class AttributeArray - { - public: - AttributeArray(AttributePtr theAttribute); - - bool isInitialized() const; - - int size() const; - - double value(const int theIndex) const; - - private: - std::shared_ptr myDouble; - std::shared_ptr myInteger; - }; +namespace PlaneGCSSolver_Tools { +/// \brief Creates a solver's constraint using given SketchPlugin constraint +/// or returns empty pointer if not all attributes are correct +SolverConstraintPtr createConstraint(ConstraintPtr theConstraint); + +/// \brief Creates temporary constraint to fix the feature after movement +std::shared_ptr +createMovementConstraint(FeaturePtr theMovedFeature); +/// \brief Creates temporary constraint to fix the attribute after movement +std::shared_ptr +createMovementConstraint(AttributePtr theMovedAttribute); +/// \brief Creates temporary constraint to fix the point in array after movement +std::shared_ptr createMovementConstraint( + const std::pair &theMovedPointInArray); + +/// \brief Creates new constraint using given parameters +/// \param theConstraint [in] original constraint +/// \param theType [in] type of constraint +/// \param theValue [in] numeric characteristic of constraint +/// (e.g. distance or radius) if applicable +/// \param theEntity1 [in] first attribute of constraint +/// \param theEntity2 [in] second attribute of constraint +/// \param theEntity3 [in] third attribute of constraint +/// \param theEntity4 [in] fourth attribute of constraint +/// \return Created wrapper of constraints applicable for specific solver. +ConstraintWrapperPtr createConstraint( + ConstraintPtr theConstraint, const SketchSolver_ConstraintType &theType, + const EntityWrapperPtr &theValue, const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2 = EntityWrapperPtr(), + const EntityWrapperPtr &theEntity3 = EntityWrapperPtr(), + const EntityWrapperPtr &theEntity4 = EntityWrapperPtr()); + +/// \brief Return \c true if the attribute is used in PlaneGCS solver +/// \param[in] theAttrName name of the attribute +/// \param[in] theOwnerName name of the parent feature +bool isAttributeApplicable(const std::string &theAttrName, + const std::string &theOwnerName); + +/// \brief Convert entity to point +/// \return empty pointer if the entity is not a point +std::shared_ptr point(EntityWrapperPtr theEntity); +/// \brief Convert entity to line +/// \return empty pointer if the entity is not a line +std::shared_ptr line(EntityWrapperPtr theEntity); +/// \brief Convert entity to circle +/// \return empty pointer if the entity is not a circle +std::shared_ptr circle(EntityWrapperPtr theEntity); +/// \brief Convert entity to ellipse +/// \return empty pointer if the entity is not an ellipse +std::shared_ptr ellipse(EntityWrapperPtr theEntity); +/// \brief Convert entity to Bs-pline +/// \return empty pointer if the entity is not an ellipse +std::shared_ptr bspline(EntityWrapperPtr theEntity); + +/// \brief Convert entity to line +/// \return empty pointer if the entity is not a line +std::shared_ptr line(FeaturePtr theFeature); + +/// \brief Update start and end parameters of circular and elliptic arcs +/// respectively to start and end points on the arc. +/// For the circular arc, the radius is calculated too. +void recalculateArcParameters(EntityWrapperPtr theArc); + +/// brief Return list of parameters for the given entity +GCS::SET_pD parameters(const EntityWrapperPtr &theEntity); + +/// \brief Update value in theDest if theSource is differ more than theTolerance +/// \return \c true if the value was updated. +bool updateValue(const double &theSource, double &theDest, + const double theTolerance = 1.e4 * tolerance); + +double distance(const GCS::Point &thePnt1, const GCS::Point &thePnt2); + +/// \brief Provide an interface to access values in attribute which is an array +/// of values +class AttributeArray { +public: + AttributeArray(AttributePtr theAttribute); + + bool isInitialized() const; + + int size() const; + + double value(const int theIndex) const; + +private: + std::shared_ptr myDouble; + std::shared_ptr myInteger; }; +}; // namespace PlaneGCSSolver_Tools #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h index e62380cec..531a7ec68 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_Update_H_ @@ -34,12 +35,9 @@ typedef std::shared_ptr UpdaterPtr; * \ingroup Plugins * \brief Send events to listeners about changing a feature */ -class PlaneGCSSolver_Update -{ +class PlaneGCSSolver_Update { public: - PlaneGCSSolver_Update(UpdaterPtr theNext = UpdaterPtr()) - : myNext(theNext) - {} + PlaneGCSSolver_Update(UpdaterPtr theNext = UpdaterPtr()) : myNext(theNext) {} virtual ~PlaneGCSSolver_Update() {} @@ -47,11 +45,12 @@ public: /// \param theObserver [in] object which want to receive notifications /// \param theType [in] receive notifications about changing objects /// of theType and their derivatives - virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType) = 0; + virtual void attach(SketchSolver_Constraint *theObserver, + const std::string &theType) = 0; /// \brief Detach listener - void detach(SketchSolver_Constraint* theObserver) { - std::list::iterator anIt = myObservers.begin(); + void detach(SketchSolver_Constraint *theObserver) { + std::list::iterator anIt = myObservers.begin(); for (; anIt != myObservers.end(); ++anIt) if (*anIt == theObserver) { myObservers.erase(anIt); @@ -63,11 +62,12 @@ public: } /// \brief Send notification about update of the feature to all interested - virtual void update(const FeaturePtr& theFeature) = 0; + virtual void update(const FeaturePtr &theFeature) = 0; protected: - UpdaterPtr myNext; ///< next updater, access if current one unable to process request - std::list myObservers; ///< list of observers + UpdaterPtr + myNext; ///< next updater, access if current one unable to process request + std::list myObservers; ///< list of observers }; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp index ec0004ab4..27b4c5ed5 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include #include #include @@ -27,18 +28,18 @@ #include #include -static bool hasSamePoint(const std::set& theList, - const EntityWrapperPtr& thePoint); +static bool hasSamePoint(const std::set &theList, + const EntityWrapperPtr &thePoint); - -void PlaneGCSSolver_UpdateCoincidence::attach(SketchSolver_Constraint* theObserver, - const std::string& theType) -{ +void PlaneGCSSolver_UpdateCoincidence::attach( + SketchSolver_Constraint *theObserver, const std::string &theType) { if (theType == GROUP()) { - std::list::iterator aPlaceToAdd = myObservers.end(); + std::list::iterator aPlaceToAdd = + myObservers.end(); // point-point coincidence is placed first, // other constraints are sorted by their type - for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); ++aPlaceToAdd) + for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); + ++aPlaceToAdd) if ((*aPlaceToAdd)->getType() > theObserver->getType()) break; myObservers.insert(aPlaceToAdd, theObserver); @@ -46,40 +47,37 @@ void PlaneGCSSolver_UpdateCoincidence::attach(SketchSolver_Constraint* theObserv myNext->attach(theObserver, theType); } -void PlaneGCSSolver_UpdateCoincidence::update(const FeaturePtr& theFeature) -{ +void PlaneGCSSolver_UpdateCoincidence::update(const FeaturePtr &theFeature) { if (theFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID() || - theFeature->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID() || + theFeature->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID() || theFeature->getKind() == SketchPlugin_ConstraintMiddle::ID() || theFeature->getKind() == SketchPlugin_ConstraintCollinear::ID()) { myCoincident.clear(); // notify listeners and stop procesing - std::list::iterator anIt = myObservers.begin(); + std::list::iterator anIt = myObservers.begin(); for (; anIt != myObservers.end(); ++anIt) (*anIt)->notify(theFeature, this); } else myNext->update(theFeature); } -static bool hasAnotherExternalPoint(const std::set& theCoincidences, - const EntityWrapperPtr& thePoint) -{ +static bool +hasAnotherExternalPoint(const std::set &theCoincidences, + const EntityWrapperPtr &thePoint) { std::set::const_iterator anIt = theCoincidences.begin(); for (; anIt != theCoincidences.end(); ++anIt) - if ((*anIt)->type() == ENTITY_POINT && (*anIt)->isExternal() && *anIt != thePoint) + if ((*anIt)->type() == ENTITY_POINT && (*anIt)->isExternal() && + *anIt != thePoint) return true; return false; } bool PlaneGCSSolver_UpdateCoincidence::addCoincidence( - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2) -{ + const EntityWrapperPtr &theEntity1, const EntityWrapperPtr &theEntity2) { bool isAccepted = true; std::list::iterator aFound[2] = { - findGroupOfCoincidence(theEntity1), - findGroupOfCoincidence(theEntity2) - }; + findGroupOfCoincidence(theEntity1), findGroupOfCoincidence(theEntity2)}; if (aFound[0] == myCoincident.end() && aFound[1] == myCoincident.end()) { // new group of coincidence @@ -113,10 +111,9 @@ bool PlaneGCSSolver_UpdateCoincidence::addCoincidence( } bool PlaneGCSSolver_UpdateCoincidence::isPointOnEntity( - const EntityWrapperPtr& thePoint, - const EntityWrapperPtr& theEntity) -{ - std::list::iterator anIt = findGroupOfCoincidence(thePoint); + const EntityWrapperPtr &thePoint, const EntityWrapperPtr &theEntity) { + std::list::iterator anIt = + findGroupOfCoincidence(thePoint); if (anIt == myCoincident.end()) return false; @@ -125,15 +122,16 @@ bool PlaneGCSSolver_UpdateCoincidence::isPointOnEntity( if (theEntity->type() == ENTITY_LINE) { std::shared_ptr aLine = std::dynamic_pointer_cast( - std::dynamic_pointer_cast(theEntity)->entity()); + std::dynamic_pointer_cast(theEntity) + ->entity()); return anIt->isExist(aLine->p1) || anIt->isExist(aLine->p2); } return false; } std::list::iterator - PlaneGCSSolver_UpdateCoincidence::findGroupOfCoincidence(const EntityWrapperPtr& theEntity) -{ +PlaneGCSSolver_UpdateCoincidence::findGroupOfCoincidence( + const EntityWrapperPtr &theEntity) { if (theEntity->type() != ENTITY_POINT) return myCoincident.end(); @@ -145,32 +143,27 @@ std::list::iterator } bool PlaneGCSSolver_UpdateCoincidence::addToGroupOfCoincidence( - CoincidentEntities& theGroup, const EntityWrapperPtr& theEntity) -{ + CoincidentEntities &theGroup, const EntityWrapperPtr &theEntity) { if (theGroup.isExist(theEntity)) return false; return theGroup.add(theEntity); } - - - - -static const GCS::Point& toPoint(const EntityWrapperPtr& theEntity) -{ - PointWrapperPtr aPoint = std::dynamic_pointer_cast(theEntity); +static const GCS::Point &toPoint(const EntityWrapperPtr &theEntity) { + PointWrapperPtr aPoint = + std::dynamic_pointer_cast(theEntity); return *(aPoint->point()); } -static double squareDistance(const GCS::Point& thePoint1, const GCS::Point& thePoint2) -{ +static double squareDistance(const GCS::Point &thePoint1, + const GCS::Point &thePoint2) { double dx = *thePoint1.x - *thePoint2.x; double dy = *thePoint1.y - *thePoint2.y; return dx * dx + dy * dy; } -static bool hasSamePoint(const std::set& theList, const GCS::Point& thePoint) -{ +static bool hasSamePoint(const std::set &theList, + const GCS::Point &thePoint) { std::set::const_iterator anIt = theList.begin(); for (; anIt != theList.end(); ++anIt) if (squareDistance(thePoint, toPoint(*anIt)) < 1.e-14) @@ -178,24 +171,19 @@ static bool hasSamePoint(const std::set& theList, const GCS::P return false; } -bool hasSamePoint(const std::set& theList, - const EntityWrapperPtr& thePoint) -{ +bool hasSamePoint(const std::set &theList, + const EntityWrapperPtr &thePoint) { return hasSamePoint(theList, toPoint(thePoint)); } - PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::CoincidentEntities( - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2) -{ + const EntityWrapperPtr &theEntity1, const EntityWrapperPtr &theEntity2) { add(theEntity1); add(theEntity2); } bool PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::add( - const EntityWrapperPtr& theEntity) -{ + const EntityWrapperPtr &theEntity) { bool isAdded = true; if (theEntity->type() == ENTITY_POINT) { if (theEntity->isExternal()) { @@ -209,8 +197,7 @@ bool PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::add( } void PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::remove( - const EntityWrapperPtr& theEntity) -{ + const EntityWrapperPtr &theEntity) { if (theEntity->type() == ENTITY_POINT) { if (theEntity->isExternal()) myExternalPoints.erase(theEntity); @@ -221,16 +208,15 @@ void PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::remove( } void PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::merge( - const CoincidentEntities& theOther) -{ - myExternalPoints.insert(theOther.myExternalPoints.begin(), theOther.myExternalPoints.end()); + const CoincidentEntities &theOther) { + myExternalPoints.insert(theOther.myExternalPoints.begin(), + theOther.myExternalPoints.end()); myPoints.insert(theOther.myPoints.begin(), theOther.myPoints.end()); myFeatures.insert(theOther.myFeatures.begin(), theOther.myFeatures.end()); } bool PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::isExist( - const EntityWrapperPtr& theEntity) const -{ + const EntityWrapperPtr &theEntity) const { if (theEntity->type() == ENTITY_POINT) { if (theEntity->isExternal()) return myExternalPoints.find(theEntity) != myExternalPoints.end(); @@ -242,12 +228,13 @@ bool PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::isExist( } bool PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::isExist( - const GCS::Point& thePoint) const -{ - return hasSamePoint(myExternalPoints, thePoint) || hasSamePoint(myPoints, thePoint); + const GCS::Point &thePoint) const { + return hasSamePoint(myExternalPoints, thePoint) || + hasSamePoint(myPoints, thePoint); } -EntityWrapperPtr PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::externalPoint() const -{ - return myExternalPoints.empty() ? EntityWrapperPtr() : *myExternalPoints.begin(); +EntityWrapperPtr +PlaneGCSSolver_UpdateCoincidence::CoincidentEntities::externalPoint() const { + return myExternalPoints.empty() ? EntityWrapperPtr() + : *myExternalPoints.begin(); } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h index 827c8bacb..d1e70c028 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_UpdateCoincidence_H_ #define PlaneGCSSolver_UpdateCoincidence_H_ -#include #include +#include #include @@ -31,18 +32,15 @@ * \ingroup Plugins * \brief Send events to listeners about changing a constraint */ -class PlaneGCSSolver_UpdateCoincidence : public PlaneGCSSolver_Update -{ +class PlaneGCSSolver_UpdateCoincidence : public PlaneGCSSolver_Update { public: PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr()) - : PlaneGCSSolver_Update(theNext) - {} + : PlaneGCSSolver_Update(theNext) {} virtual ~PlaneGCSSolver_UpdateCoincidence() {} /// \brief Group of entities, processed by this kind of updater - static const std::string& GROUP() - { + static const std::string &GROUP() { static const std::string TYPE("Coincidence"); return TYPE; } @@ -51,57 +49,62 @@ public: /// \param theObserver [in] object which want to receive notifications /// \param theType [in] receive notifications about changing objects /// of theType and their derivatives - virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType); + virtual void attach(SketchSolver_Constraint *theObserver, + const std::string &theType); /// \brief Send notification about update of the feature to all interested - virtual void update(const FeaturePtr& theFeature); + virtual void update(const FeaturePtr &theFeature); /// \brief Set coincidence between two given entities /// \return \c true if the entities does not coincident yet - bool addCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2); + bool addCoincidence(const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2); /// \brief Verifies the point is coincident to the feature /// \return \c true if the point is on the feature - bool isPointOnEntity(const EntityWrapperPtr& thePoint, const EntityWrapperPtr& theEntity); + bool isPointOnEntity(const EntityWrapperPtr &thePoint, + const EntityWrapperPtr &theEntity); private: /// \brief Container for collecting and operating coincident entities - class CoincidentEntities - { + class CoincidentEntities { public: - CoincidentEntities(const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2); + CoincidentEntities(const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2); /// Verify the entity is already in the list - bool isExist(const EntityWrapperPtr& theEntity) const; + bool isExist(const EntityWrapperPtr &theEntity) const; /// Verify the point is already in the list - bool isExist(const GCS::Point& thePoint) const; + bool isExist(const GCS::Point &thePoint) const; /// Add entity to group - bool add(const EntityWrapperPtr& theEntity); + bool add(const EntityWrapperPtr &theEntity); /// Remove entity from group - void remove(const EntityWrapperPtr& theEntity); + void remove(const EntityWrapperPtr &theEntity); /// Merge two groups - void merge(const CoincidentEntities& theOther); + void merge(const CoincidentEntities &theOther); /// Returns any of external points EntityWrapperPtr externalPoint() const; private: std::set myPoints; ///< coincident points - std::set myExternalPoints; //< external points coincident to other points + std::set + myExternalPoints; //< external points coincident to other points std::set myFeatures; ///< other entities containing points }; /// \brief Search the group of coincidences containing given entity. /// Searches points only. - std::list::iterator findGroupOfCoincidence(const EntityWrapperPtr& theEntity); + std::list::iterator + findGroupOfCoincidence(const EntityWrapperPtr &theEntity); /// \brief Add entity to group of coincidences /// \reutrn \c true if the entity is added, thus the coincidence is new - bool addToGroupOfCoincidence(CoincidentEntities& theGroup, const EntityWrapperPtr& theEntity); + bool addToGroupOfCoincidence(CoincidentEntities &theGroup, + const EntityWrapperPtr &theEntity); private: std::list myCoincident; ///< list of coincidences diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp index e18afbe26..84a4061ff 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp @@ -14,24 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -void PlaneGCSSolver_UpdateFeature::attach(SketchSolver_Constraint* theObserver, - const std::string& theType) -{ +void PlaneGCSSolver_UpdateFeature::attach(SketchSolver_Constraint *theObserver, + const std::string &theType) { if (theType == GROUP()) myObservers.push_back(theObserver); else myNext->attach(theObserver, theType); } -void PlaneGCSSolver_UpdateFeature::update(const FeaturePtr& theFeature) -{ - std::list::iterator anIt = myObservers.begin(); +void PlaneGCSSolver_UpdateFeature::update(const FeaturePtr &theFeature) { + std::list::iterator anIt = myObservers.begin(); for (; anIt != myObservers.end(); ++anIt) (*anIt)->notify(theFeature, this); } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h index 3f20b6304..55e1c3d8f 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef PlaneGCSSolver_UpdateFeature_H_ @@ -26,16 +27,13 @@ * \ingroup Plugins * \brief Send events to listeners about changing a feature */ -class PlaneGCSSolver_UpdateFeature : public PlaneGCSSolver_Update -{ +class PlaneGCSSolver_UpdateFeature : public PlaneGCSSolver_Update { public: PlaneGCSSolver_UpdateFeature(UpdaterPtr theNext = UpdaterPtr()) - : PlaneGCSSolver_Update(theNext) - {} + : PlaneGCSSolver_Update(theNext) {} /// \brief Group of entities, processed by this kind of updater - static const std::string& GROUP() - { + static const std::string &GROUP() { static const std::string TYPE("Feature"); return TYPE; } @@ -44,10 +42,11 @@ public: /// \param theObserver [in] object which want to receive notifications /// \param theType [in] receive notifications about changing objects /// of theType and their derivatives - virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType); + virtual void attach(SketchSolver_Constraint *theObserver, + const std::string &theType); /// \brief Send notification about update of the feature to all interested - virtual void update(const FeaturePtr& theFeature); + virtual void update(const FeaturePtr &theFeature); }; #endif diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 0ea0e8cdc..18b363860 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -53,30 +54,24 @@ #include -SketchSolver_Constraint::SketchSolver_Constraint( - ConstraintPtr theConstraint) - : myBaseConstraint(theConstraint), - myType(CONSTRAINT_UNKNOWN) -{ -} +SketchSolver_Constraint::SketchSolver_Constraint(ConstraintPtr theConstraint) + : myBaseConstraint(theConstraint), myType(CONSTRAINT_UNKNOWN) {} -void SketchSolver_Constraint::process(StoragePtr theStorage, bool theEvensBlocked) -{ +void SketchSolver_Constraint::process(StoragePtr theStorage, + bool theEvensBlocked) { myStorage = theStorage; blockEvents(theEvensBlocked); // Process constraint according to its type process(); } -void SketchSolver_Constraint::blockEvents(bool isBlocked) -{ +void SketchSolver_Constraint::blockEvents(bool isBlocked) { myBaseConstraint->data()->blockSendAttributeUpdated(isBlocked); } - -SketchSolver_ConstraintType SketchSolver_Constraint::TYPE(ConstraintPtr theConstraint) -{ - const std::string& aType = theConstraint->getKind(); +SketchSolver_ConstraintType +SketchSolver_Constraint::TYPE(ConstraintPtr theConstraint) { + const std::string &aType = theConstraint->getKind(); if (aType == SketchPlugin_ConstraintCoincidence::ID() || aType == SketchPlugin_ConstraintCoincidenceInternal::ID()) return CONSTRAINT_COINCIDENCE; @@ -111,8 +106,7 @@ SketchSolver_ConstraintType SketchSolver_Constraint::TYPE(ConstraintPtr theConst return CONSTRAINT_UNKNOWN; } -void SketchSolver_Constraint::process() -{ +void SketchSolver_Constraint::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -133,8 +127,8 @@ void SketchSolver_Constraint::process() aConstrType = getType(); ConstraintWrapperPtr aNewConstraint = PlaneGCSSolver_Tools::createConstraint( - myBaseConstraint, aConstrType, - aValue, anAttributes[0], anAttributes[1], anAttributes[2], anAttributes[3]); + myBaseConstraint, aConstrType, aValue, anAttributes[0], anAttributes[1], + anAttributes[2], anAttributes[3]); if (!aNewConstraint) { myErrorMsg = SketchSolver_Error::WRONG_CONSTRAINT_TYPE(); return; @@ -144,26 +138,29 @@ void SketchSolver_Constraint::process() adjustConstraint(); } -void SketchSolver_Constraint::update() -{ +void SketchSolver_Constraint::update() { cleanErrorMsg(); - // Get list of attributes of the constraint and compare it with previously stored. - // If the lists are different, fully rebuild constraint + // Get list of attributes of the constraint and compare it with previously + // stored. If the lists are different, fully rebuild constraint std::set anAttributes; for (int anEntIndex = 0; anEntIndex < 4; ++anEntIndex) { - AttributePtr anAttr = - myBaseConstraint->attribute(SketchPlugin_Constraint::ATTRIBUTE(anEntIndex)); + AttributePtr anAttr = myBaseConstraint->attribute( + SketchPlugin_Constraint::ATTRIBUTE(anEntIndex)); if (!anAttr) continue; if (myBaseConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) { - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(anAttr); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast(anAttr); FeaturePtr aFeat = ModelAPI_Feature::feature(aRefAttr->object()); if (aFeat) { - // Workaround for the Length constraint: add points of line, not line itself - anAttributes.insert(myStorage->entity(aFeat->attribute(SketchPlugin_Line::START_ID()))); - anAttributes.insert(myStorage->entity(aFeat->attribute(SketchPlugin_Line::END_ID()))); + // Workaround for the Length constraint: add points of line, not line + // itself + anAttributes.insert( + myStorage->entity(aFeat->attribute(SketchPlugin_Line::START_ID()))); + anAttributes.insert( + myStorage->entity(aFeat->attribute(SketchPlugin_Line::END_ID()))); } } else anAttributes.insert(myStorage->entity(anAttr)); @@ -180,15 +177,15 @@ void SketchSolver_Constraint::update() return; } - AttributePtr aValueAttr = myBaseConstraint->attribute(SketchPlugin_Constraint::VALUE()); + AttributePtr aValueAttr = + myBaseConstraint->attribute(SketchPlugin_Constraint::VALUE()); if (aValueAttr) myStorage->update(aValueAttr); adjustConstraint(); } -bool SketchSolver_Constraint::remove() -{ +bool SketchSolver_Constraint::remove() { cleanErrorMsg(); myType = CONSTRAINT_UNKNOWN; myStorage->unsubscribeUpdates(this); @@ -196,9 +193,7 @@ bool SketchSolver_Constraint::remove() } void SketchSolver_Constraint::getAttributes( - EntityWrapperPtr& theValue, - std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { static const int anInitNbOfAttr = 4; theAttributes.assign(anInitNbOfAttr, EntityWrapperPtr()); myAttributes.clear(); @@ -214,9 +209,10 @@ void SketchSolver_Constraint::getAttributes( myStorage->addEntity(aValueAttr, theValue); } - int aPtInd = 0; // index of first point in the list of attributes + int aPtInd = 0; // index of first point in the list of attributes int aEntInd = 2; // index of first entity in the list of attributes - std::list aConstrAttrs = aData->attributes(ModelAPI_AttributeRefAttr::typeId()); + std::list aConstrAttrs = + aData->attributes(ModelAPI_AttributeRefAttr::typeId()); std::list::iterator anIter = aConstrAttrs.begin(); for (; anIter != aConstrAttrs.end(); anIter++) { AttributeRefAttrPtr aRefAttr = diff --git a/src/SketchSolver/SketchSolver_Constraint.h b/src/SketchSolver/SketchSolver_Constraint.h index 487200dd3..73c8d0707 100644 --- a/src/SketchSolver/SketchSolver_Constraint.h +++ b/src/SketchSolver/SketchSolver_Constraint.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_Constraint_H_ #define SketchSolver_Constraint_H_ -#include #include +#include #include @@ -33,15 +34,13 @@ /** \class SketchSolver_Constraint * \ingroup Plugins - * \brief Converts SketchPlugin constraint to the constraint applicable for solver + * \brief Converts SketchPlugin constraint to the constraint applicable for + * solver */ -class SketchSolver_Constraint -{ +class SketchSolver_Constraint { protected: /// Default constructor - SketchSolver_Constraint() - : myType(CONSTRAINT_UNKNOWN) - {} + SketchSolver_Constraint() : myType(CONSTRAINT_UNKNOWN) {} public: /// Constructor based on SketchPlugin constraint @@ -51,18 +50,20 @@ public: /// \brief Initializes parameters and start constraint creation /// \param theStorage [in] storage where to place new constraint - /// \param theEventsBlocked [in] all events from this constraint should be blocked + /// \param theEventsBlocked [in] all events from this constraint should be + /// blocked void process(StoragePtr theStorage, bool theEvensBlocked); /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update* theUpdater) {} + virtual void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) {} /// \brief Update constraint virtual void update(); /// \brief Tries to remove constraint - /// \return \c false, if current constraint contains another SketchPlugin constraints - /// (like for multiple coincidence) + /// \return \c false, if current constraint contains another SketchPlugin + /// constraints (like for multiple coincidence) virtual bool remove(); /// \brief Block or unblock events from this constraint @@ -72,42 +73,40 @@ public: static SketchSolver_ConstraintType TYPE(ConstraintPtr theConstraint); /// \brief Returns the type of constraint - virtual SketchSolver_ConstraintType getType() const - { return myType; } + virtual SketchSolver_ConstraintType getType() const { return myType; } /// \brief Shows error message - const std::string& error() const - { return myErrorMsg; } + const std::string &error() const { return myErrorMsg; } protected: /// \brief Converts SketchPlugin constraint to a list of solver's constraints virtual void process(); - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); - /// \brief This method is used in derived objects to check consistency of constraint. + /// \brief This method is used in derived objects to check consistency of + /// constraint. /// E.g. the distance between line and point may be signed. - virtual void adjustConstraint() - {} + virtual void adjustConstraint() {} /// \brief Removes last error - void cleanErrorMsg() - { myErrorMsg.clear(); } + void cleanErrorMsg() { myErrorMsg.clear(); } protected: - ConstraintPtr myBaseConstraint; ///< base SketchPlugin constraint + ConstraintPtr myBaseConstraint; ///< base SketchPlugin constraint ConstraintWrapperPtr mySolverConstraint; ///< wrapper for PlaneGCS constraint /// storage, which contains all information about entities and constraints - StoragePtr myStorage; - SketchSolver_ConstraintType myType; ///< type of constraint + StoragePtr myStorage; + SketchSolver_ConstraintType myType; ///< type of constraint std::list myAttributes; ///< attributes of constraint - std::string myErrorMsg; ///< error message + std::string myErrorMsg; ///< error message }; typedef std::shared_ptr SolverConstraintPtr; diff --git a/src/SketchSolver/SketchSolver_ConstraintAngle.cpp b/src/SketchSolver/SketchSolver_ConstraintAngle.cpp index 4f424ffab..e3a4e0591 100644 --- a/src/SketchSolver/SketchSolver_ConstraintAngle.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintAngle.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,16 +24,15 @@ #include void SketchSolver_ConstraintAngle::getAttributes( - EntityWrapperPtr& theValue, std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { SketchSolver_Constraint::getAttributes(theValue, theAttributes); - myType = myBaseConstraint->integer(SketchPlugin_ConstraintAngle::TYPE_ID())->value(); + myType = myBaseConstraint->integer(SketchPlugin_ConstraintAngle::TYPE_ID()) + ->value(); } - -void SketchSolver_ConstraintAngle::adjustConstraint() -{ - int aType = myBaseConstraint->integer(SketchPlugin_ConstraintAngle::TYPE_ID())->value(); +void SketchSolver_ConstraintAngle::adjustConstraint() { + int aType = myBaseConstraint->integer(SketchPlugin_ConstraintAngle::TYPE_ID()) + ->value(); if (aType != myType) { myType = aType; myStorage->setNeedToResolve(true); diff --git a/src/SketchSolver/SketchSolver_ConstraintAngle.h b/src/SketchSolver/SketchSolver_ConstraintAngle.h index ddc876f7d..197b4156f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintAngle.h +++ b/src/SketchSolver/SketchSolver_ConstraintAngle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintAngle_H_ @@ -26,26 +27,26 @@ * \ingroup Plugins * \brief Convert Agnle constraint to SolveSpace structure */ -class SketchSolver_ConstraintAngle : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintAngle : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint SketchSolver_ConstraintAngle(ConstraintPtr theConstraint) - : SketchSolver_Constraint(theConstraint) - {} + : SketchSolver_Constraint(theConstraint) {} - /// \brief This method is used in derived objects to check consistence of constraint. + /// \brief This method is used in derived objects to check consistence of + /// constraint. virtual void adjustConstraint(); protected: - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); private: - int myType; + int myType; }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index 2cd15f10c..cbc96be96 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include #include #include #include +#include +#include #include #include @@ -38,12 +39,13 @@ #include #include -static void getCoincidentFeatureExtremities(const ConstraintPtr& theConstraint, - const StoragePtr& theStorage, - EntityWrapperPtr theExtremities[2]) -{ +static void +getCoincidentFeatureExtremities(const ConstraintPtr &theConstraint, + const StoragePtr &theStorage, + EntityWrapperPtr theExtremities[2]) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = theConstraint->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + theConstraint->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr || !aRefAttr->isObject()) continue; @@ -52,11 +54,15 @@ static void getCoincidentFeatureExtremities(const ConstraintPtr& theConstraint, continue; if (aFeature->getKind() == SketchPlugin_Line::ID()) { - theExtremities[0] = theStorage->entity(aFeature->attribute(SketchPlugin_Line::START_ID())); - theExtremities[1] = theStorage->entity(aFeature->attribute(SketchPlugin_Line::END_ID())); + theExtremities[0] = theStorage->entity( + aFeature->attribute(SketchPlugin_Line::START_ID())); + theExtremities[1] = + theStorage->entity(aFeature->attribute(SketchPlugin_Line::END_ID())); } else if (aFeature->getKind() == SketchPlugin_Arc::ID()) { - theExtremities[0] = theStorage->entity(aFeature->attribute(SketchPlugin_Arc::START_ID())); - theExtremities[1] = theStorage->entity(aFeature->attribute(SketchPlugin_Arc::END_ID())); + theExtremities[0] = + theStorage->entity(aFeature->attribute(SketchPlugin_Arc::START_ID())); + theExtremities[1] = + theStorage->entity(aFeature->attribute(SketchPlugin_Arc::END_ID())); } else if (aFeature->getKind() == SketchPlugin_EllipticArc::ID()) { theExtremities[0] = theStorage->entity( aFeature->attribute(SketchPlugin_EllipticArc::START_POINT_ID())); @@ -67,10 +73,9 @@ static void getCoincidentFeatureExtremities(const ConstraintPtr& theConstraint, } static void getPointOwnerAndParent(const AttributeRefAttrPtr theRefAttr, - AttributePoint2DPtr& thePoint, - FeaturePtr& theOwner, - FeaturePtr& theParent) -{ + AttributePoint2DPtr &thePoint, + FeaturePtr &theOwner, + FeaturePtr &theParent) { AttributePtr anAttr = theRefAttr->attr(); if (theRefAttr->isObject()) { FeaturePtr anOwner = ModelAPI_Feature::feature(theRefAttr->object()); @@ -85,15 +90,16 @@ static void getPointOwnerAndParent(const AttributeRefAttrPtr theRefAttr, if (theOwner) { AttributeReferencePtr aParentRef = theOwner->reference(SketchPlugin_SketchEntity::PARENT_ID()); - theParent = aParentRef ? ModelAPI_Feature::feature(aParentRef->value()) : FeaturePtr(); + theParent = aParentRef ? ModelAPI_Feature::feature(aParentRef->value()) + : FeaturePtr(); } } } -static void ellipseDiameters(FeaturePtr theEllipse, - std::pair& theMajorAxis, - std::pair& theMinorAxis) -{ +static void +ellipseDiameters(FeaturePtr theEllipse, + std::pair &theMajorAxis, + std::pair &theMinorAxis) { if (theEllipse->getKind() == SketchPlugin_Ellipse::ID()) { theMajorAxis.first = SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(); theMajorAxis.second = SketchPlugin_Ellipse::MAJOR_AXIS_END_ID(); @@ -108,16 +114,15 @@ static void ellipseDiameters(FeaturePtr theEllipse, } static void findDiameterOnEllipse(FeaturePtr theConstruction, - FeaturePtr theEllipse, - AttributePtr& theStart, - AttributePtr& theEnd) -{ + FeaturePtr theEllipse, AttributePtr &theStart, + AttributePtr &theEnd) { AttributePtr anEllipseAttr; - const std::set& aRefs = theConstruction->data()->refsToMe(); + const std::set &aRefs = theConstruction->data()->refsToMe(); for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end(); ++aRefIt) { FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); - if (anOwner && anOwner->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { + if (anOwner && anOwner->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { AttributeRefAttrPtr aRefAttr; if ((*aRefIt)->id() == SketchPlugin_Constraint::ENTITY_A()) aRefAttr = anOwner->refattr(SketchPlugin_Constraint::ENTITY_B()); @@ -135,34 +140,31 @@ static void findDiameterOnEllipse(FeaturePtr theConstruction, if (anEllipseAttr->id() == aMajorAxis.first) { theStart = anEllipseAttr; theEnd = theEllipse->attribute(aMajorAxis.second); - } - else if (anEllipseAttr->id() == aMajorAxis.second) { + } else if (anEllipseAttr->id() == aMajorAxis.second) { theStart = theEllipse->attribute(aMajorAxis.first); theEnd = anEllipseAttr; - } - else if (anEllipseAttr->id() == aMinorAxis.first) { + } else if (anEllipseAttr->id() == aMinorAxis.first) { theStart = anEllipseAttr; theEnd = theEllipse->attribute(aMinorAxis.second); - } - else if (anEllipseAttr->id() == aMinorAxis.second) { + } else if (anEllipseAttr->id() == aMinorAxis.second) { theStart = theEllipse->attribute(aMinorAxis.first); theEnd = anEllipseAttr; } } -static void processEllipticArcExtremities(SketchSolver_ConstraintType& theType, - const ConstraintPtr& theConstraint, - const StoragePtr& theStorage, - std::vector& theAttributes, - EntityWrapperPtr theExtremities[2]) -{ +static void processEllipticArcExtremities( + SketchSolver_ConstraintType &theType, const ConstraintPtr &theConstraint, + const StoragePtr &theStorage, std::vector &theAttributes, + EntityWrapperPtr theExtremities[2]) { AttributePoint2DPtr aPointA, aPointB; FeaturePtr anOwnerA, anOwnerB; FeaturePtr aParentA, aParentB; - getPointOwnerAndParent(theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()), - aPointA, anOwnerA, aParentA); - getPointOwnerAndParent(theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()), - aPointB, anOwnerB, aParentB); + getPointOwnerAndParent( + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()), aPointA, + anOwnerA, aParentA); + getPointOwnerAndParent( + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()), aPointB, + anOwnerB, aParentB); AttributePtr anAxisStart, anAxisEnd, aPoint; FeaturePtr aConstruction, anEllipticArc; @@ -170,14 +172,14 @@ static void processEllipticArcExtremities(SketchSolver_ConstraintType& theType, aPoint = aPointB; aConstruction = anOwnerA; anEllipticArc = anOwnerB; - } - else if (aParentB && aParentB == anOwnerA) { + } else if (aParentB && aParentB == anOwnerA) { aPoint = aPointA; aConstruction = anOwnerB; anEllipticArc = anOwnerA; } - if (!anEllipticArc || anEllipticArc->getKind() != SketchPlugin_EllipticArc::ID() || + if (!anEllipticArc || + anEllipticArc->getKind() != SketchPlugin_EllipticArc::ID() || (aPoint->id() != SketchPlugin_EllipticArc::START_POINT_ID() && aPoint->id() != SketchPlugin_EllipticArc::END_POINT_ID())) return; @@ -193,10 +195,9 @@ static void processEllipticArcExtremities(SketchSolver_ConstraintType& theType, } } -static void getPointFromArray(EntityWrapperPtr& theArray, - const ConstraintPtr& theConstraint, - const std::string& theIndexAttrId) -{ +static void getPointFromArray(EntityWrapperPtr &theArray, + const ConstraintPtr &theConstraint, + const std::string &theIndexAttrId) { if (theArray && theArray->type() == ENTITY_POINT_ARRAY) { AttributeIntegerPtr anIndexAttr = theConstraint->integer(theIndexAttrId); if (anIndexAttr) { @@ -207,9 +208,7 @@ static void getPointFromArray(EntityWrapperPtr& theArray, } } - -void SketchSolver_ConstraintCoincidence::process() -{ +void SketchSolver_ConstraintCoincidence::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -227,15 +226,14 @@ void SketchSolver_ConstraintCoincidence::process() } mySolverConstraint = PlaneGCSSolver_Tools::createConstraint( - myBaseConstraint, getType(), - myAuxValue, anAttributes[0], anAttributes[1], anAttributes[2], anAttributes[3]); + myBaseConstraint, getType(), myAuxValue, anAttributes[0], anAttributes[1], + anAttributes[2], anAttributes[3]); myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateCoincidence::GROUP()); myStorage->notify(myBaseConstraint); } -bool SketchSolver_ConstraintCoincidence::remove() -{ +bool SketchSolver_ConstraintCoincidence::remove() { myInSolver = false; myFeatureExtremities[0] = EntityWrapperPtr(); myFeatureExtremities[1] = EntityWrapperPtr(); @@ -250,9 +248,7 @@ bool SketchSolver_ConstraintCoincidence::remove() } void SketchSolver_ConstraintCoincidence::getAttributes( - EntityWrapperPtr& theValue, - std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { SketchSolver_Constraint::getAttributes(theValue, theAttributes); if (!myErrorMsg.empty() || !theAttributes[0]) { theAttributes.clear(); @@ -261,9 +257,10 @@ void SketchSolver_ConstraintCoincidence::getAttributes( if (theAttributes[1]) { myType = CONSTRAINT_PT_PT_COINCIDENT; - // if elliptic arc boundary point is connected with one of ellipse characteristics, - // it should be changed from point-point coincidence to coincidence between point - // and axis of the ellipse to decrease only 1 DoF instead of 2 DoF and avoid overconstraint. + // if elliptic arc boundary point is connected with one of ellipse + // characteristics, it should be changed from point-point coincidence to + // coincidence between point and axis of the ellipse to decrease only 1 DoF + // instead of 2 DoF and avoid overconstraint. processEllipticArcExtremities(myType, myBaseConstraint, myStorage, theAttributes, myFeatureExtremities); } else if (theAttributes[2]) { @@ -272,39 +269,48 @@ void SketchSolver_ConstraintCoincidence::getAttributes( if (theAttributes[2]->type() == ENTITY_BSPLINE) { std::shared_ptr aStorage = std::dynamic_pointer_cast(myStorage); - myAuxValue.reset(new PlaneGCSSolver_ScalarWrapper(aStorage->createParameter())); - // calculate the parameter of the point on B-spline nearest to the constrained point. + myAuxValue.reset( + new PlaneGCSSolver_ScalarWrapper(aStorage->createParameter())); + // calculate the parameter of the point on B-spline nearest to the + // constrained point. GeomPnt2dPtr aPoint = PlaneGCSSolver_Tools::point(theAttributes[0]); - std::shared_ptr aSpline = PlaneGCSSolver_Tools::bspline(theAttributes[2]); + std::shared_ptr aSpline = + PlaneGCSSolver_Tools::bspline(theAttributes[2]); if (aPoint && aSpline) aSpline->parameter(aPoint, 1.e100, *myAuxValue->scalar()); - } - else { - // obtain extremity points of the coincident feature for further checking of multi-coincidence - getCoincidentFeatureExtremities(myBaseConstraint, myStorage, myFeatureExtremities); + } else { + // obtain extremity points of the coincident feature for further checking + // of multi-coincidence + getCoincidentFeatureExtremities(myBaseConstraint, myStorage, + myFeatureExtremities); } } else myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); // process internal coincidence with a point in the array of points - getPointFromArray(theAttributes[0], myBaseConstraint, - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); - getPointFromArray(theAttributes[1], myBaseConstraint, - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + getPointFromArray( + theAttributes[0], myBaseConstraint, + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); + getPointFromArray( + theAttributes[1], myBaseConstraint, + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); } -void SketchSolver_ConstraintCoincidence::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater) -{ - PlaneGCSSolver_UpdateCoincidence* anUpdater = - static_cast(theUpdater); - bool isAccepted = anUpdater->addCoincidence(myAttributes.front(), myAttributes.back()); - // additionally process internal coincidence, set point coincident with ellipse/elliptic arc - // for correct processing further coincidences set by the user - if (isAccepted && - myBaseConstraint->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { - AttributeRefAttrPtr aRefAttrA = myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr aRefAttrB = myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); +void SketchSolver_ConstraintCoincidence::notify( + const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) { + PlaneGCSSolver_UpdateCoincidence *anUpdater = + static_cast(theUpdater); + bool isAccepted = + anUpdater->addCoincidence(myAttributes.front(), myAttributes.back()); + // additionally process internal coincidence, set point coincident with + // ellipse/elliptic arc for correct processing further coincidences set by the + // user + if (isAccepted && myBaseConstraint->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { + AttributeRefAttrPtr aRefAttrA = + myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrB = + myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); if (aRefAttrA && aRefAttrB) { AttributePoint2DPtr anAttrA, anAttrB; FeaturePtr anOwnerA, anOwnerB; @@ -316,8 +322,7 @@ void SketchSolver_ConstraintCoincidence::notify(const FeaturePtr& theFeatur if (aParentA == anOwnerB) { aPoint = myStorage->entity(anAttrA); anEntity = myStorage->entity(anOwnerB); - } - else if (aParentB == anOwnerA) { + } else if (aParentB == anOwnerA) { aPoint = myStorage->entity(anAttrB); anEntity = myStorage->entity(anOwnerA); } @@ -326,13 +331,16 @@ void SketchSolver_ConstraintCoincidence::notify(const FeaturePtr& theFeatur } } - // additionally check the point is coincident to extremity of coincident feature + // additionally check the point is coincident to extremity of coincident + // feature if (myFeatureExtremities[0] && myFeatureExtremities[1]) { - EntityWrapperPtr aPoint = - myAttributes.front()->type() == ENTITY_POINT ? myAttributes.front() : myAttributes.back(); + EntityWrapperPtr aPoint = myAttributes.front()->type() == ENTITY_POINT + ? myAttributes.front() + : myAttributes.back(); for (int i = 0; i < 2; ++i) - isAccepted = isAccepted && !anUpdater->isPointOnEntity(aPoint, myFeatureExtremities[i]); + isAccepted = isAccepted && + !anUpdater->isPointOnEntity(aPoint, myFeatureExtremities[i]); } if (isAccepted) { @@ -348,9 +356,9 @@ void SketchSolver_ConstraintCoincidence::notify(const FeaturePtr& theFeatur } } -void SketchSolver_ConstraintCoincidence::adjustConstraint() -{ - if (myBaseConstraint->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { +void SketchSolver_ConstraintCoincidence::adjustConstraint() { + if (myBaseConstraint->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID()) { AttributeIntegerPtr anIndexA = myBaseConstraint->integer( SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); AttributeIntegerPtr anIndexB = myBaseConstraint->integer( diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.h b/src/SketchSolver/SketchSolver_ConstraintCoincidence.h index 368dee7ae..5a4a90dd2 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.h +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintCoincidence_H_ @@ -26,18 +27,15 @@ * \ingroup Plugins * \brief Convert coincidence constraint to SolveSpace structure */ -class SketchSolver_ConstraintCoincidence : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintCoincidence : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintCoincidence(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint), - myInSolver(false) - {} + SketchSolver_ConstraintCoincidence(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint), myInSolver(false) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater); + virtual void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater); /// \brief Remove constraint virtual bool remove(); @@ -46,20 +44,23 @@ protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints virtual void process(); - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); - /// \brief This method is used in derived objects to check consistency of constraint. + /// \brief This method is used in derived objects to check consistency of + /// constraint. /// E.g. the distance between line and point may be signed. virtual void adjustConstraint(); protected: bool myInSolver; ///< shows the constraint is added to the solver - EntityWrapperPtr myFeatureExtremities[2]; ///< extremities of a feature, a point is coincident to - ScalarWrapperPtr myAuxValue; ///< parameter on B-spline curve + EntityWrapperPtr myFeatureExtremities[2]; ///< extremities of a feature, a + ///< point is coincident to + ScalarWrapperPtr myAuxValue; ///< parameter on B-spline curve }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp b/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp index cea03a276..fe0d648cb 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -27,28 +28,28 @@ #include -static ConstraintWrapperPtr createPointsOnLine( - std::shared_ptr thePoint1, - std::shared_ptr thePoint2, - std::shared_ptr theLine) -{ - std::shared_ptr aGCSLine = std::dynamic_pointer_cast(theLine->entity()); +static ConstraintWrapperPtr +createPointsOnLine(std::shared_ptr thePoint1, + std::shared_ptr thePoint2, + std::shared_ptr theLine) { + std::shared_ptr aGCSLine = + std::dynamic_pointer_cast(theLine->entity()); std::list aConstrList; if (thePoint1) - aConstrList.push_back( GCSConstraintPtr( - new GCS::ConstraintPointOnLine(*thePoint1->point(), *aGCSLine)) ); + aConstrList.push_back(GCSConstraintPtr( + new GCS::ConstraintPointOnLine(*thePoint1->point(), *aGCSLine))); if (thePoint2) - aConstrList.push_back( GCSConstraintPtr( - new GCS::ConstraintPointOnLine(*thePoint2->point(), *aGCSLine)) ); + aConstrList.push_back(GCSConstraintPtr( + new GCS::ConstraintPointOnLine(*thePoint2->point(), *aGCSLine))); - return aConstrList.empty() ? ConstraintWrapperPtr() : ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aConstrList, CONSTRAINT_COLLINEAR)); + return aConstrList.empty() + ? ConstraintWrapperPtr() + : ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aConstrList, CONSTRAINT_COLLINEAR)); } - -void SketchSolver_ConstraintCollinear::process() -{ +void SketchSolver_ConstraintCollinear::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -66,30 +67,34 @@ void SketchSolver_ConstraintCollinear::process() } for (int i = 0; i < 2; ++i) { - AttributeRefAttrPtr aRefAttr = myBaseConstraint->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + myBaseConstraint->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); FeaturePtr aLine = ModelAPI_Feature::feature(aRefAttr->object()); - myPoints[2*i] = myStorage->entity(aLine->attribute(SketchPlugin_Line::START_ID())); - myPoints[2*i + 1] = myStorage->entity(aLine->attribute(SketchPlugin_Line::END_ID())); + myPoints[2 * i] = + myStorage->entity(aLine->attribute(SketchPlugin_Line::START_ID())); + myPoints[2 * i + 1] = + myStorage->entity(aLine->attribute(SketchPlugin_Line::END_ID())); } myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateCoincidence::GROUP()); myStorage->notify(myBaseConstraint); } -void SketchSolver_ConstraintCollinear::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater) -{ +void SketchSolver_ConstraintCollinear::notify( + const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) { if (theFeature == myBaseConstraint && myInSolver) return; // the constraint is already being updated - PlaneGCSSolver_UpdateCoincidence* anUpdater = - static_cast(theUpdater); + PlaneGCSSolver_UpdateCoincidence *anUpdater = + static_cast(theUpdater); bool isPointOnOppositeLine[4]; std::list::reverse_iterator anIt = myAttributes.rbegin(); for (int i = 0; i < 2; ++i, ++anIt) { - isPointOnOppositeLine[2*i] = anUpdater->isPointOnEntity(myPoints[2*i], *anIt); - isPointOnOppositeLine[2*i + 1] = anUpdater->isPointOnEntity(myPoints[2*i + 1], *anIt); + isPointOnOppositeLine[2 * i] = + anUpdater->isPointOnEntity(myPoints[2 * i], *anIt); + isPointOnOppositeLine[2 * i + 1] = + anUpdater->isPointOnEntity(myPoints[2 * i + 1], *anIt); } // both points of one line is on another line => lines are already collinear, @@ -112,21 +117,25 @@ void SketchSolver_ConstraintCollinear::notify(const FeaturePtr& theFeature, continue; if (!myIsConstraintApplied[i]) - aPoints[i] = std::dynamic_pointer_cast(myPoints[i]); + aPoints[i] = + std::dynamic_pointer_cast(myPoints[i]); aConstraintToApply[i] = true; } - aLine = std::dynamic_pointer_cast(myAttributes.back()); + aLine = std::dynamic_pointer_cast( + myAttributes.back()); } else { // verify second line and add necessary constraints for (int i = 0; i < 2; ++i) { if (isPointOnOppositeLine[i + 2]) continue; - if (!myIsConstraintApplied[i+2]) - aPoints[i] = std::dynamic_pointer_cast(myPoints[i + 2]); - aConstraintToApply[i+2] = true; + if (!myIsConstraintApplied[i + 2]) + aPoints[i] = std::dynamic_pointer_cast( + myPoints[i + 2]); + aConstraintToApply[i + 2] = true; } - aLine = std::dynamic_pointer_cast(myAttributes.front()); + aLine = std::dynamic_pointer_cast( + myAttributes.front()); } bool isNew = false; diff --git a/src/SketchSolver/SketchSolver_ConstraintCollinear.h b/src/SketchSolver/SketchSolver_ConstraintCollinear.h index b6e54c087..26372fbdb 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCollinear.h +++ b/src/SketchSolver/SketchSolver_ConstraintCollinear.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintCollinear_H_ @@ -24,23 +25,21 @@ /** \class SketchSolver_ConstraintCollinear * \ingroup Plugins - * \brief Converts collinear constraint to the constraint applicable for solver + * \brief Converts collinear constraint to the constraint applicable for + * solver */ -class SketchSolver_ConstraintCollinear : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintCollinear : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint) - : SketchSolver_Constraint(theConstraint), - myInSolver(false) - { + : SketchSolver_Constraint(theConstraint), myInSolver(false) { for (int i = 0; i < 4; ++i) myIsConstraintApplied[i] = false; } /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater); + virtual void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater); protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints @@ -49,7 +48,7 @@ protected: private: EntityWrapperPtr myPoints[4]; ///< extremities on collinear lines bool myIsConstraintApplied[4]; ///< set \c true if point on opposite line - bool myInSolver; ///< the constraint is added to the solver + bool myInSolver; ///< the constraint is added to the solver }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintDistance.cpp b/src/SketchSolver/SketchSolver_ConstraintDistance.cpp index 590681a86..be7420a13 100644 --- a/src/SketchSolver/SketchSolver_ConstraintDistance.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintDistance.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -37,12 +38,13 @@ #include - -static void getPointAndLine(const ConstraintPtr& theConstraint, const StoragePtr& theStorage, - EntityWrapperPtr& thePoint, EntityWrapperPtr& theLine) -{ +static void getPointAndLine(const ConstraintPtr &theConstraint, + const StoragePtr &theStorage, + EntityWrapperPtr &thePoint, + EntityWrapperPtr &theLine) { for (int i = 0; i < 2; ++i) { - AttributePtr anAttr = theConstraint->attribute(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributePtr anAttr = + theConstraint->attribute(SketchPlugin_Constraint::ATTRIBUTE(i)); EntityWrapperPtr anEntity = theStorage->entity(anAttr); if (anEntity->type() == ENTITY_POINT) thePoint = anEntity; @@ -51,29 +53,30 @@ static void getPointAndLine(const ConstraintPtr& theConstraint, const StoragePtr } } -static void adjustOddPoint(const EntityWrapperPtr& theDistPoint, - const EntityWrapperPtr& theDistLine, - GCSPointPtr& theOddPoint) -{ +static void adjustOddPoint(const EntityWrapperPtr &theDistPoint, + const EntityWrapperPtr &theDistLine, + GCSPointPtr &theOddPoint) { if (!theOddPoint) return; - std::shared_ptr aLine = PlaneGCSSolver_Tools::line(theDistLine); - std::shared_ptr aPoint = PlaneGCSSolver_Tools::point(theDistPoint); + std::shared_ptr aLine = + PlaneGCSSolver_Tools::line(theDistLine); + std::shared_ptr aPoint = + PlaneGCSSolver_Tools::point(theDistPoint); std::shared_ptr aLineVec = aLine->direction()->xy(); - std::shared_ptr aPtLineVec = aPoint->xy()->decreased(aLine->location()->xy()); + std::shared_ptr aPtLineVec = + aPoint->xy()->decreased(aLine->location()->xy()); double aDot = aPtLineVec->dot(aLineVec); std::shared_ptr aProjectedPnt = - aLine->location()->xy()->added(aLineVec->multiplied(aDot)); + aLine->location()->xy()->added(aLineVec->multiplied(aDot)); *(theOddPoint->x) = aProjectedPnt->x(); *(theOddPoint->y) = aProjectedPnt->y(); } -static FeaturePtr getFeature(AttributeRefAttrPtr theRefAttr) -{ +static FeaturePtr getFeature(AttributeRefAttrPtr theRefAttr) { ObjectPtr anObj; if (theRefAttr->isObject()) anObj = theRefAttr->object(); @@ -82,12 +85,12 @@ static FeaturePtr getFeature(AttributeRefAttrPtr theRefAttr) return ModelAPI_Feature::feature(anObj); } -static void calculateDistanceDirection(const ConstraintPtr& theConstraint, - const StoragePtr& theStorage, - double& theDirX, double& theDirY) -{ - std::shared_ptr aDistDir = std::dynamic_pointer_cast( - theConstraint->attribute(SketchPlugin_ConstraintDistance::DIRECTION_ID())); +static void calculateDistanceDirection(const ConstraintPtr &theConstraint, + const StoragePtr &theStorage, + double &theDirX, double &theDirY) { + std::shared_ptr aDistDir = + std::dynamic_pointer_cast(theConstraint->attribute( + SketchPlugin_ConstraintDistance::DIRECTION_ID())); if (aDistDir && aDistDir->isInitialized()) { theDirX = aDistDir->x(); theDirY = aDistDir->y(); @@ -95,29 +98,34 @@ static void calculateDistanceDirection(const ConstraintPtr& theConstraint, return; } - AttributeRefAttrPtr aRefAttrA = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr aRefAttrB = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr aRefAttrA = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrB = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); EntityWrapperPtr aEntityA = theStorage->entity(aRefAttrA); EntityWrapperPtr aEntityB = theStorage->entity(aRefAttrB); GCSPointPtr aPoint; if (aEntityA->type() != ENTITY_LINE && aEntityB->type() != ENTITY_LINE) { - aPoint = std::dynamic_pointer_cast(aEntityA)->point(); + aPoint = std::dynamic_pointer_cast(aEntityA) + ->point(); theDirX = 1.0; theDirY = 0.0; - EdgeWrapperPtr anEdgeA = std::dynamic_pointer_cast( - theStorage->entity(getFeature(aRefAttrA))); - EdgeWrapperPtr anEdgeB = std::dynamic_pointer_cast( - theStorage->entity(getFeature(aRefAttrB))); + EdgeWrapperPtr anEdgeA = + std::dynamic_pointer_cast( + theStorage->entity(getFeature(aRefAttrA))); + EdgeWrapperPtr anEdgeB = + std::dynamic_pointer_cast( + theStorage->entity(getFeature(aRefAttrB))); if (anEdgeA && anEdgeB) { GCS::DeriVector2 aDirA = anEdgeA->entity()->CalculateNormal(*aPoint); GCS::DeriVector2 aDirB = anEdgeB->entity()->CalculateNormal(*aPoint); double x = -aDirA.x + aDirB.x; double y = -aDirA.y + aDirB.y; - double norm = sqrt(x*x + y*y); + double norm = sqrt(x * x + y * y); if (norm > tolerance) { theDirX = x / norm; theDirY = y / norm; @@ -126,73 +134,79 @@ static void calculateDistanceDirection(const ConstraintPtr& theConstraint, } } -static void moveEntity(const ConstraintPtr& theConstraint, - const StoragePtr& theStorage, - const double theDX, const double theDY) -{ +static void moveEntity(const ConstraintPtr &theConstraint, + const StoragePtr &theStorage, const double theDX, + const double theDY) { static const double THE_SHIFT = 1.e-4; - AttributeRefAttrPtr aRefAttrA = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr aRefAttrB = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr aRefAttrA = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrB = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); EntityWrapperPtr aEntityA = theStorage->entity(aRefAttrA); EntityWrapperPtr aEntityB = theStorage->entity(aRefAttrB); - PointWrapperPtr aPointA = std::dynamic_pointer_cast(aEntityA); - PointWrapperPtr aPointB = std::dynamic_pointer_cast(aEntityB); + PointWrapperPtr aPointA = + std::dynamic_pointer_cast(aEntityA); + PointWrapperPtr aPointB = + std::dynamic_pointer_cast(aEntityB); if (aPointA) { *aPointA->point()->x -= THE_SHIFT * theDX; *aPointA->point()->y -= THE_SHIFT * theDY; - } - else if (aPointB) { + } else if (aPointB) { *aPointB->point()->x += THE_SHIFT * theDX; *aPointB->point()->y += THE_SHIFT * theDY; } } - - void SketchSolver_ConstraintDistance::getAttributes( - EntityWrapperPtr& theValue, - std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { SketchSolver_Constraint::getAttributes(theValue, theAttributes); if (!myErrorMsg.empty() || !theAttributes[0]) { theAttributes.clear(); return; } - ScalarWrapperPtr aValue = std::dynamic_pointer_cast(theValue); + ScalarWrapperPtr aValue = + std::dynamic_pointer_cast(theValue); bool isCoincidence = fabs(aValue->value()) < tolerance; if (theAttributes[1]) { - if (myBaseConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID()) + if (myBaseConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID()) myType = CONSTRAINT_HORIZONTAL_DISTANCE; - else if (myBaseConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) + else if (myBaseConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) myType = CONSTRAINT_VERTICAL_DISTANCE; else - myType = isCoincidence ? CONSTRAINT_PT_PT_COINCIDENT : CONSTRAINT_PT_PT_DISTANCE; + myType = isCoincidence ? CONSTRAINT_PT_PT_COINCIDENT + : CONSTRAINT_PT_PT_DISTANCE; } else if (theAttributes[2] && theAttributes[2]->type() == ENTITY_LINE) - myType = isCoincidence ? CONSTRAINT_PT_ON_CURVE : CONSTRAINT_PT_LINE_DISTANCE; + myType = + isCoincidence ? CONSTRAINT_PT_ON_CURVE : CONSTRAINT_PT_LINE_DISTANCE; else theAttributes.clear(); - if (myType == CONSTRAINT_HORIZONTAL_DISTANCE || myType == CONSTRAINT_VERTICAL_DISTANCE) + if (myType == CONSTRAINT_HORIZONTAL_DISTANCE || + myType == CONSTRAINT_VERTICAL_DISTANCE) mySignValue = aValue->value() < 0.0 ? -1.0 : 1.0; myPrevValue = 0.0; if (isCoincidence) - myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateCoincidence::GROUP()); + myStorage->subscribeUpdates(this, + PlaneGCSSolver_UpdateCoincidence::GROUP()); else myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateFeature::GROUP()); } -void SketchSolver_ConstraintDistance::adjustConstraint() -{ +void SketchSolver_ConstraintDistance::adjustConstraint() { if (getType() == CONSTRAINT_PT_LINE_DISTANCE) { - bool isSigned = myBaseConstraint->boolean(SketchPlugin_ConstraintDistance::SIGNED())->value(); + bool isSigned = + myBaseConstraint->boolean(SketchPlugin_ConstraintDistance::SIGNED()) + ->value(); if (myIsSigned == isSigned) { // adjust auxiliary point for sign-keeping if (isSigned) { @@ -200,8 +214,7 @@ void SketchSolver_ConstraintDistance::adjustConstraint() getPointAndLine(myBaseConstraint, myStorage, aDistPoint, aDistLine); adjustOddPoint(aDistPoint, aDistLine, myOddPoint); } - } - else { + } else { // Adjust point-line distance by setting/removing additional constraints if (isSigned) addConstraintsToKeepSign(); @@ -212,18 +225,22 @@ void SketchSolver_ConstraintDistance::adjustConstraint() } } -void SketchSolver_ConstraintDistance::update() -{ +void SketchSolver_ConstraintDistance::update() { ConstraintWrapperPtr aConstraint = myStorage->constraint(myBaseConstraint); myPrevValue = aConstraint->value(); bool isDistanceAlognDir = - myBaseConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID() || - myBaseConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID(); - - AttributeDoublePtr aCurValue = myBaseConstraint->real(SketchPlugin_Constraint::VALUE()); - bool isZeroSwitch = fabs(myPrevValue) < tolerance && fabs(aCurValue->value()) > tolerance; - bool isNonZeroSwitch = fabs(myPrevValue) > tolerance && fabs(aCurValue->value()) < tolerance; + myBaseConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID() || + myBaseConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID(); + + AttributeDoublePtr aCurValue = + myBaseConstraint->real(SketchPlugin_Constraint::VALUE()); + bool isZeroSwitch = + fabs(myPrevValue) < tolerance && fabs(aCurValue->value()) > tolerance; + bool isNonZeroSwitch = + fabs(myPrevValue) > tolerance && fabs(aCurValue->value()) < tolerance; if (!isDistanceAlognDir && (isZeroSwitch || isNonZeroSwitch)) { // the value is changed from non-zero to zero or vice versa @@ -242,8 +259,7 @@ void SketchSolver_ConstraintDistance::update() addConstraintsToKeepSign(); } } - } - else { + } else { SketchSolver_Constraint::update(); if (isDistanceAlognDir && mySignValue * aConstraint->value() < 0.0) { if (isZeroSwitch) @@ -254,14 +270,12 @@ void SketchSolver_ConstraintDistance::update() } } -bool SketchSolver_ConstraintDistance::remove() -{ +bool SketchSolver_ConstraintDistance::remove() { removeConstraintsKeepingSign(); return SketchSolver_Constraint::remove(); } -void SketchSolver_ConstraintDistance::addConstraintsToKeepSign() -{ +void SketchSolver_ConstraintDistance::addConstraintsToKeepSign() { std::shared_ptr aStorage = std::dynamic_pointer_cast(myStorage); @@ -273,14 +287,16 @@ void SketchSolver_ConstraintDistance::addConstraintsToKeepSign() getPointAndLine(myBaseConstraint, myStorage, aDistPoint, aDistLine); std::shared_ptr aLine = PlaneGCSSolver_Tools::line(aDistLine); - std::shared_ptr aPoint = PlaneGCSSolver_Tools::point(aDistPoint); + std::shared_ptr aPoint = + PlaneGCSSolver_Tools::point(aDistPoint); std::shared_ptr aLineVec = aLine->direction()->xy(); - std::shared_ptr aPtLineVec = aPoint->xy()->decreased(aLine->location()->xy()); + std::shared_ptr aPtLineVec = + aPoint->xy()->decreased(aLine->location()->xy()); if (aLineVec->cross(aPtLineVec) >= 0.) - mySignValue = PI/2.0; + mySignValue = PI / 2.0; else - mySignValue = - PI/2.0; + mySignValue = -PI / 2.0; // create auxiliary point on the line and set auxiliary constraints myOddPoint = GCSPointPtr(new GCS::Point); @@ -288,15 +304,20 @@ void SketchSolver_ConstraintDistance::addConstraintsToKeepSign() myOddPoint->y = aStorage->createParameter(); adjustOddPoint(aDistPoint, aDistLine, myOddPoint); - PointWrapperPtr aPointWr = std::dynamic_pointer_cast(aDistPoint); - EdgeWrapperPtr anEdgeWr = std::dynamic_pointer_cast(aDistLine); - std::shared_ptr aGCSLine = std::dynamic_pointer_cast(anEdgeWr->entity()); + PointWrapperPtr aPointWr = + std::dynamic_pointer_cast(aDistPoint); + EdgeWrapperPtr anEdgeWr = + std::dynamic_pointer_cast(aDistLine); + std::shared_ptr aGCSLine = + std::dynamic_pointer_cast(anEdgeWr->entity()); // point-on-line - GCSConstraintPtr aNewConstraint(new GCS::ConstraintPointOnLine(*myOddPoint, *aGCSLine)); + GCSConstraintPtr aNewConstraint( + new GCS::ConstraintPointOnLine(*myOddPoint, *aGCSLine)); aGCSConstraints.push_back(aNewConstraint); // angle which keep orientation - aNewConstraint = GCSConstraintPtr(new GCS::ConstraintL2LAngle( - aGCSLine->p1, aGCSLine->p2, *myOddPoint, *(aPointWr->point()), &mySignValue)); + aNewConstraint = GCSConstraintPtr( + new GCS::ConstraintL2LAngle(aGCSLine->p1, aGCSLine->p2, *myOddPoint, + *(aPointWr->point()), &mySignValue)); aGCSConstraints.push_back(aNewConstraint); aConstraint->setConstraints(aGCSConstraints); @@ -305,8 +326,7 @@ void SketchSolver_ConstraintDistance::addConstraintsToKeepSign() aStorage->addConstraint(myBaseConstraint, aConstraint); } -void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign() -{ +void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign() { if (!myOddPoint) return; // no sign kept => nothing to remove @@ -336,14 +356,14 @@ void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign() myIsSigned = false; } -void SketchSolver_ConstraintDistance::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update*) -{ +void SketchSolver_ConstraintDistance::notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *) { if (getType() == CONSTRAINT_PT_LINE_DISTANCE && myIsSigned && theFeature->getKind() == SketchPlugin_Sketch::ID()) { // the sketch plane was updated, recalculate auxiliary constraints removeConstraintsKeepingSign(); addConstraintsToKeepSign(); - myIsSigned = true; // reset it, due to changing by removeConstraintsKeepingSign() + myIsSigned = + true; // reset it, due to changing by removeConstraintsKeepingSign() } } diff --git a/src/SketchSolver/SketchSolver_ConstraintDistance.h b/src/SketchSolver/SketchSolver_ConstraintDistance.h index f902b7276..57474f063 100644 --- a/src/SketchSolver/SketchSolver_ConstraintDistance.h +++ b/src/SketchSolver/SketchSolver_ConstraintDistance.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintDistance_H_ @@ -26,15 +27,12 @@ * \ingroup Plugins * \brief Convert distance constraint to SolveSpace structure */ -class SketchSolver_ConstraintDistance : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintDistance : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintDistance(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint), - myIsSigned(false), - mySignValue(0.0) - {} + SketchSolver_ConstraintDistance(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint), myIsSigned(false), + mySignValue(0.0) {} /// \brief Update constraint virtual void update(); @@ -43,16 +41,18 @@ public: virtual bool remove(); /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*); + virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *); protected: - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); - /// \brief This method is used in derived objects to check consistence of constraint. + /// \brief This method is used in derived objects to check consistence of + /// constraint. /// E.g. the distance between line and point may be signed. virtual void adjustConstraint(); @@ -61,8 +61,10 @@ private: void removeConstraintsKeepingSign(); private: - double myPrevValue; ///< previous value of distance (for correct calculation of a distance sign) - bool myIsSigned; ///< true if the sign of point-line distance should be kept everytime + double myPrevValue; ///< previous value of distance (for correct calculation + ///< of a distance sign) + bool myIsSigned; ///< true if the sign of point-line distance should be kept + ///< everytime GCSPointPtr myOddPoint; ///< auxiliary point to keep sign of distance double mySignValue; }; diff --git a/src/SketchSolver/SketchSolver_ConstraintEqual.cpp b/src/SketchSolver/SketchSolver_ConstraintEqual.cpp index e0e97f956..9911f499d 100644 --- a/src/SketchSolver/SketchSolver_ConstraintEqual.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintEqual.cpp @@ -14,20 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // +#include #include #include -#include #include #include void SketchSolver_ConstraintEqual::getAttributes( - EntityWrapperPtr& theValue, - std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { SketchSolver_Constraint::getAttributes(theValue, theAttributes); if (!myErrorMsg.empty() || !theAttributes[2] || !theAttributes[3]) { theAttributes.clear(); @@ -50,13 +49,12 @@ void SketchSolver_ConstraintEqual::getAttributes( else if (aType == ENTITY_ARC) { ++aNbArcs; isArcFirst = (aNbLines == 0); - } - else if (aType == ENTITY_ELLIPSE || aType == ENTITY_ELLIPTIC_ARC) + } else if (aType == ENTITY_ELLIPSE || aType == ENTITY_ELLIPTIC_ARC) ++aNbEllipses; } if (aNbLines + aNbArcs + aNbCircs + aNbEllipses != 2 || - (aNbArcs == 1 && aNbEllipses != 0) || aNbEllipses == 1) { + (aNbArcs == 1 && aNbEllipses != 0) || aNbEllipses == 1) { myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); return; } @@ -67,10 +65,10 @@ void SketchSolver_ConstraintEqual::getAttributes( myType = CONSTRAINT_EQUAL_ELLIPSES; std::shared_ptr aStorage = std::dynamic_pointer_cast(myStorage); - myAuxValue = ScalarWrapperPtr(new PlaneGCSSolver_ScalarWrapper(aStorage->createParameter())); + myAuxValue = ScalarWrapperPtr( + new PlaneGCSSolver_ScalarWrapper(aStorage->createParameter())); theValue = myAuxValue; - } - else + } else myType = CONSTRAINT_EQUAL_RADIUS; break; case 1: @@ -91,14 +89,14 @@ void SketchSolver_ConstraintEqual::getAttributes( PlaneGCSSolver_AttributeBuilder aBuilder(myStorage); // store length of first line as a value for constraint // (will be used to make equal lengths of lines) - theValue = aBuilder.createAttribute(aLine1->attribute(SketchPlugin_Line::LENGTH_ID())); + theValue = aBuilder.createAttribute( + aLine1->attribute(SketchPlugin_Line::LENGTH_ID())); } break; } } -bool SketchSolver_ConstraintEqual::remove() -{ +bool SketchSolver_ConstraintEqual::remove() { if (myAuxValue) { std::shared_ptr aStorage = std::dynamic_pointer_cast(myStorage); diff --git a/src/SketchSolver/SketchSolver_ConstraintEqual.h b/src/SketchSolver/SketchSolver_ConstraintEqual.h index e95ab4a55..8bc61a4fb 100644 --- a/src/SketchSolver/SketchSolver_ConstraintEqual.h +++ b/src/SketchSolver/SketchSolver_ConstraintEqual.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintEqual_H_ @@ -26,28 +27,28 @@ * \ingroup Plugins * \brief Convert equality constraint to SolveSpace structure */ -class SketchSolver_ConstraintEqual : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintEqual : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintEqual(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint) - {} + SketchSolver_ConstraintEqual(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint) {} /// \brief Tries to remove constraint - /// \return \c false, if current constraint contains another SketchPlugin constraints - /// (like for multiple coincidence) + /// \return \c false, if current constraint contains another SketchPlugin + /// constraints (like for multiple coincidence) virtual bool remove(); protected: - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); private: - ScalarWrapperPtr myAuxValue; ///< scalar value to store ellipses focus distance + ScalarWrapperPtr + myAuxValue; ///< scalar value to store ellipses focus distance }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintFixed.cpp b/src/SketchSolver/SketchSolver_ConstraintFixed.cpp index 6b73471ab..7cdcfa212 100644 --- a/src/SketchSolver/SketchSolver_ConstraintFixed.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintFixed.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -30,22 +31,19 @@ #include /// \brief Get list of parameters of current entity -static GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity); +static GCS::VEC_pD toParameters(const EntityWrapperPtr &theEntity); - -SketchSolver_ConstraintFixed::SketchSolver_ConstraintFixed(ConstraintPtr theConstraint) - : SketchSolver_Constraint(theConstraint) -{ +SketchSolver_ConstraintFixed::SketchSolver_ConstraintFixed( + ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint) { myType = CONSTRAINT_FIXED; } -void SketchSolver_ConstraintFixed::blockEvents(bool isBlocked) -{ +void SketchSolver_ConstraintFixed::blockEvents(bool isBlocked) { SketchSolver_Constraint::blockEvents(isBlocked); } -void SketchSolver_ConstraintFixed::process() -{ +void SketchSolver_ConstraintFixed::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -62,8 +60,8 @@ void SketchSolver_ConstraintFixed::process() myStorage->addConstraint(myBaseConstraint, aConstraint); } -ConstraintWrapperPtr SketchSolver_ConstraintFixed::fixFeature(EntityWrapperPtr theFeature) -{ +ConstraintWrapperPtr +SketchSolver_ConstraintFixed::fixFeature(EntityWrapperPtr theFeature) { GCS::VEC_pD aParameters = toParameters(theFeature); // Fix given list of parameters @@ -80,10 +78,10 @@ ConstraintWrapperPtr SketchSolver_ConstraintFixed::fixFeature(EntityWrapperPtr t new PlaneGCSSolver_ConstraintWrapper(aConstraints, getType())); } -EntityWrapperPtr SketchSolver_ConstraintFixed::entityToFix() -{ +EntityWrapperPtr SketchSolver_ConstraintFixed::entityToFix() { // Constraint Fixed is added by user. - // Get the attribute of constraint (it should be alone in the list of constraints). + // Get the attribute of constraint (it should be alone in the list of + // constraints). EntityWrapperPtr aValue; std::vector anAttributes; SketchSolver_Constraint::getAttributes(aValue, anAttributes); @@ -94,12 +92,8 @@ EntityWrapperPtr SketchSolver_ConstraintFixed::entityToFix() return EntityWrapperPtr(); } - - - // ================== Auxiliary functions ================== -GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity) -{ +GCS::VEC_pD toParameters(const EntityWrapperPtr &theEntity) { GCS::VEC_pD aParameters; if (!theEntity) return aParameters; @@ -115,15 +109,16 @@ GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity) aParameters.push_back(aPoint->point()->x); aParameters.push_back(aPoint->point()->y); break; - } + } case ENTITY_LINE: { - std::shared_ptr aLine = std::dynamic_pointer_cast(anEntity->entity()); + std::shared_ptr aLine = + std::dynamic_pointer_cast(anEntity->entity()); aParameters.push_back(aLine->p1.x); aParameters.push_back(aLine->p1.y); aParameters.push_back(aLine->p2.x); aParameters.push_back(aLine->p2.y); break; - } + } case ENTITY_CIRCLE: { std::shared_ptr aCircle = std::dynamic_pointer_cast(anEntity->entity()); @@ -131,16 +126,17 @@ GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity) aParameters.push_back(aCircle->center.y); aParameters.push_back(aCircle->rad); break; - } + } case ENTITY_ARC: { - std::shared_ptr anArc = std::dynamic_pointer_cast(anEntity->entity()); + std::shared_ptr anArc = + std::dynamic_pointer_cast(anEntity->entity()); aParameters.push_back(anArc->center.x); aParameters.push_back(anArc->center.y); aParameters.push_back(anArc->rad); aParameters.push_back(anArc->startAngle); aParameters.push_back(anArc->endAngle); break; - } + } case ENTITY_ELLIPSE: { std::shared_ptr anEllipse = std::dynamic_pointer_cast(anEntity->entity()); @@ -150,7 +146,7 @@ GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity) aParameters.push_back(anEllipse->focus1.y); aParameters.push_back(anEllipse->radmin); break; - } + } case ENTITY_ELLIPTIC_ARC: { std::shared_ptr anEllArc = std::dynamic_pointer_cast(anEntity->entity()); @@ -162,7 +158,7 @@ GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity) aParameters.push_back(anEllArc->startAngle); aParameters.push_back(anEllArc->endAngle); break; - } + } case ENTITY_BSPLINE: { std::shared_ptr aBSpline = std::dynamic_pointer_cast(anEntity->entity()); diff --git a/src/SketchSolver/SketchSolver_ConstraintFixed.h b/src/SketchSolver/SketchSolver_ConstraintFixed.h index 6d9aafb86..dcc2f1b7e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintFixed.h +++ b/src/SketchSolver/SketchSolver_ConstraintFixed.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintFixed_H_ @@ -26,8 +27,7 @@ * \ingroup Plugins * \brief Stores data of the Fixed constraint */ -class SketchSolver_ConstraintFixed : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintFixed : public SketchSolver_Constraint { public: /// Creates constraint to manage the given constraint from plugin SketchSolver_ConstraintFixed(ConstraintPtr theConstraint); @@ -36,14 +36,16 @@ public: virtual void blockEvents(bool isBlocked); protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints virtual void process(); - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& , std::vector& ) - {} + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &, + std::vector &) {} /// \brief Obtain entity to be fixed EntityWrapperPtr entityToFix(); diff --git a/src/SketchSolver/SketchSolver_ConstraintLength.cpp b/src/SketchSolver/SketchSolver_ConstraintLength.cpp index 36508d28b..20d462cf9 100644 --- a/src/SketchSolver/SketchSolver_ConstraintLength.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintLength.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,11 +23,8 @@ #include - void SketchSolver_ConstraintLength::getAttributes( - EntityWrapperPtr& theValue, - std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { SketchSolver_Constraint::getAttributes(theValue, theAttributes); if (!myErrorMsg.empty() || !theAttributes[2] || theAttributes[2]->type() != ENTITY_LINE) { @@ -34,12 +32,14 @@ void SketchSolver_ConstraintLength::getAttributes( return; } - AttributeRefAttrPtr aRefAttr = myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttr = + myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); FeaturePtr aLine = ModelAPI_Feature::feature(aRefAttr->object()); - theAttributes[0] = myStorage->entity(aLine->attribute(SketchPlugin_Line::START_ID())); - theAttributes[1] = myStorage->entity(aLine->attribute(SketchPlugin_Line::END_ID())); + theAttributes[0] = + myStorage->entity(aLine->attribute(SketchPlugin_Line::START_ID())); + theAttributes[1] = + myStorage->entity(aLine->attribute(SketchPlugin_Line::END_ID())); myType = CONSTRAINT_PT_PT_DISTANCE; } - diff --git a/src/SketchSolver/SketchSolver_ConstraintLength.h b/src/SketchSolver/SketchSolver_ConstraintLength.h index c120ce781..8a05f9e8f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintLength.h +++ b/src/SketchSolver/SketchSolver_ConstraintLength.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintLength_H_ @@ -26,20 +27,19 @@ * \ingroup Plugins * \brief Convert length constraint to SolveSpace structure */ -class SketchSolver_ConstraintLength : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintLength : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintLength(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint) - {} + SketchSolver_ConstraintLength(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint) {} protected: - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp b/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp index aed7e9281..805eec24f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp @@ -14,26 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include #include #include #include #include +#include -static bool isArc(EntityWrapperPtr theEntity) -{ - return theEntity->type() == ENTITY_ARC || theEntity->type() == ENTITY_ELLIPTIC_ARC; +static bool isArc(EntityWrapperPtr theEntity) { + return theEntity->type() == ENTITY_ARC || + theEntity->type() == ENTITY_ELLIPTIC_ARC; } void SketchSolver_ConstraintMiddle::getAttributes( - EntityWrapperPtr& theValue, - std::vector& theAttributes) -{ + EntityWrapperPtr &theValue, std::vector &theAttributes) { SketchSolver_Constraint::getAttributes(theValue, theAttributes); // create auxiliary point if middle point on arc is specified @@ -44,12 +43,12 @@ void SketchSolver_ConstraintMiddle::getAttributes( myOddPoint = GCSPointPtr(new GCS::Point); myOddPoint->x = aStorage->createParameter(); myOddPoint->y = aStorage->createParameter(); - theAttributes[1] = PointWrapperPtr(new PlaneGCSSolver_PointWrapper(myOddPoint)); + theAttributes[1] = + PointWrapperPtr(new PlaneGCSSolver_PointWrapper(myOddPoint)); } } -bool SketchSolver_ConstraintMiddle::remove() -{ +bool SketchSolver_ConstraintMiddle::remove() { if (myOddPoint) { std::shared_ptr aStorage = std::dynamic_pointer_cast(myStorage); @@ -62,25 +61,25 @@ bool SketchSolver_ConstraintMiddle::remove() return SketchSolver_ConstraintCoincidence::remove(); } -void SketchSolver_ConstraintMiddle::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater) -{ +void SketchSolver_ConstraintMiddle::notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) { if (theFeature == myBaseConstraint && myInSolver) { // the constraint is already being updated, // update the middle point parameter if the constraint is "point-on-arc". if (myOddPoint) { - EntityWrapperPtr anArcEntity = - isArc(myAttributes.front()) ? myAttributes.front() : myAttributes.back(); + EntityWrapperPtr anArcEntity = isArc(myAttributes.front()) + ? myAttributes.front() + : myAttributes.back(); EdgeWrapperPtr anArcEdge = std::dynamic_pointer_cast(anArcEntity); if (anArcEdge) { - std::shared_ptr anArc = std::dynamic_pointer_cast(anArcEdge->entity()); + std::shared_ptr anArc = + std::dynamic_pointer_cast(anArcEdge->entity()); if (anArc) { // recalculate parameters of middle point according to arc *myOddPoint->x = (*anArc->startAngle + *anArc->endAngle) * 0.5; *myOddPoint->y = (*anArc->endAngle - *anArc->startAngle) * 0.5; - } - else { + } else { std::shared_ptr aEllArc = std::dynamic_pointer_cast(anArcEdge->entity()); if (aEllArc) { @@ -94,9 +93,10 @@ void SketchSolver_ConstraintMiddle::notify(const FeaturePtr& theFeature, return; } - PlaneGCSSolver_UpdateCoincidence* anUpdater = - static_cast(theUpdater); - bool isAccepted = anUpdater->addCoincidence(myAttributes.front(), myAttributes.back()); + PlaneGCSSolver_UpdateCoincidence *anUpdater = + static_cast(theUpdater); + bool isAccepted = + anUpdater->addCoincidence(myAttributes.front(), myAttributes.back()); if (isAccepted) { if (!myInSolver) { myInSolver = true; @@ -109,8 +109,9 @@ void SketchSolver_ConstraintMiddle::notify(const FeaturePtr& theFeature, aGCSConstraints.push_front(mySolverConstraint->constraints().front()); myMiddle = ConstraintWrapperPtr(); - mySolverConstraint = ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aGCSConstraints, CONSTRAINT_MIDDLE_POINT)); + mySolverConstraint = + ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aGCSConstraints, CONSTRAINT_MIDDLE_POINT)); } myStorage->addConstraint(myBaseConstraint, mySolverConstraint); @@ -122,16 +123,19 @@ void SketchSolver_ConstraintMiddle::notify(const FeaturePtr& theFeature, } if (!myMiddle) { - // divide solver constraints to the middle point and point-line coincidence + // divide solver constraints to the middle point and point-line + // coincidence std::shared_ptr aConstraint = - std::dynamic_pointer_cast(mySolverConstraint); + std::dynamic_pointer_cast( + mySolverConstraint); std::list aGCSConstraints = aConstraint->constraints(); - mySolverConstraint = ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aGCSConstraints.front(), CONSTRAINT_MIDDLE_POINT)); + mySolverConstraint = + ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aGCSConstraints.front(), CONSTRAINT_MIDDLE_POINT)); aGCSConstraints.pop_front(); - myMiddle = ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aGCSConstraints, CONSTRAINT_MIDDLE_POINT)); + myMiddle = ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aGCSConstraints, CONSTRAINT_MIDDLE_POINT)); // send middle constraint only myStorage->addConstraint(myBaseConstraint, myMiddle); diff --git a/src/SketchSolver/SketchSolver_ConstraintMiddle.h b/src/SketchSolver/SketchSolver_ConstraintMiddle.h index 10901fc0e..bcd501ddb 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMiddle.h +++ b/src/SketchSolver/SketchSolver_ConstraintMiddle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintMiddle_H_ @@ -24,29 +25,30 @@ /** \class SketchSolver_ConstraintMiddle * \ingroup Plugins - * \brief Converts middle-point constraint to the constraint applicable for solver + * \brief Converts middle-point constraint to the constraint applicable for + * solver */ -class SketchSolver_ConstraintMiddle : public SketchSolver_ConstraintCoincidence -{ +class SketchSolver_ConstraintMiddle + : public SketchSolver_ConstraintCoincidence { public: /// Constructor based on SketchPlugin constraint SketchSolver_ConstraintMiddle(ConstraintPtr theConstraint) - : SketchSolver_ConstraintCoincidence(theConstraint) - {} + : SketchSolver_ConstraintCoincidence(theConstraint) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater); + virtual void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater); /// \brief Remove constraint virtual bool remove(); protected: - /// \brief Generate list of attributes of constraint in order useful for constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(EntityWrapperPtr& theValue, - std::vector& theAttributes); + /// \brief Generate list of attributes of constraint in order useful for + /// constraints \param[out] theValue numerical characteristic of + /// constraint (e.g. distance) \param[out] theAttributes list of attributes to + /// be filled + virtual void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes); private: ConstraintWrapperPtr myMiddle; diff --git a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp index 0e9e87a48..9f16818f9 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -32,24 +33,20 @@ #include #include +static void mirrorPoints(const std::shared_ptr &theMirrorLine, + const AttributePoint2DPtr &theOriginal, + const AttributePoint2DPtr &theMirrored); -static void mirrorPoints(const std::shared_ptr& theMirrorLine, - const AttributePoint2DPtr& theOriginal, - const AttributePoint2DPtr& theMirrored); - -static void mirrorEntities(const std::shared_ptr& theMirrorLine, - const FeaturePtr& theOriginal, - const FeaturePtr& theMirrored); - - +static void mirrorEntities(const std::shared_ptr &theMirrorLine, + const FeaturePtr &theOriginal, + const FeaturePtr &theMirrored); void SketchSolver_ConstraintMirror::getAttributes( - EntityWrapperPtr&, - std::vector&) -{ + EntityWrapperPtr &, std::vector &) { AttributeRefAttrPtr aMirLineRefAttr = myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); - if (!aMirLineRefAttr || !aMirLineRefAttr->isInitialized() || !aMirLineRefAttr->isObject()) { + if (!aMirLineRefAttr || !aMirLineRefAttr->isInitialized() || + !aMirLineRefAttr->isObject()) { myErrorMsg = SketchSolver_Error::NOT_INITIALIZED(); return; } @@ -60,7 +57,6 @@ void SketchSolver_ConstraintMirror::getAttributes( myType = TYPE(myBaseConstraint); myStorage->update(aMirrorLine); - AttributeRefListPtr aBaseRefList = myBaseConstraint->reflist(SketchPlugin_Constraint::ENTITY_B()); AttributeRefListPtr aMirroredRefList = @@ -91,8 +87,7 @@ void SketchSolver_ConstraintMirror::getAttributes( } } -void SketchSolver_ConstraintMirror::process() -{ +void SketchSolver_ConstraintMirror::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -109,20 +104,17 @@ void SketchSolver_ConstraintMirror::process() myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateFeature::GROUP()); } - -void SketchSolver_ConstraintMirror::update() -{ +void SketchSolver_ConstraintMirror::update() { cleanErrorMsg(); remove(); process(); } -void SketchSolver_ConstraintMirror::adjustConstraint() -{ +void SketchSolver_ConstraintMirror::adjustConstraint() { AttributeRefAttrPtr aMirrLineRefAttr = myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); - std::shared_ptr aMirrorLine = - PlaneGCSSolver_Tools::line(ModelAPI_Feature::feature(aMirrLineRefAttr->object())); + std::shared_ptr aMirrorLine = PlaneGCSSolver_Tools::line( + ModelAPI_Feature::feature(aMirrLineRefAttr->object())); AttributeRefListPtr aBaseRefList = myBaseConstraint->reflist(SketchPlugin_Constraint::ENTITY_B()); @@ -133,8 +125,7 @@ void SketchSolver_ConstraintMirror::adjustConstraint() std::list aMirroredList = aMirroredRefList->list(); std::list::iterator aBIt, aMIt; for (aBIt = aBaseList.begin(), aMIt = aMirroredList.begin(); - aBIt != aBaseList.end() && aMIt != aMirroredList.end(); - ++aBIt, ++aMIt) { + aBIt != aBaseList.end() && aMIt != aMirroredList.end(); ++aBIt, ++aMIt) { FeaturePtr aBase = ModelAPI_Feature::feature(*aBIt); FeaturePtr aMirrored = ModelAPI_Feature::feature(*aMIt); mirrorEntities(aMirrorLine, aBase, aMirrored); @@ -145,16 +136,14 @@ void SketchSolver_ConstraintMirror::adjustConstraint() } } -void SketchSolver_ConstraintMirror::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update*) -{ +void SketchSolver_ConstraintMirror::notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *) { if (myFeatures.find(theFeature) == myFeatures.end()) return; // the feature is not used by constraint => nothing to update adjustConstraint(); } -void SketchSolver_ConstraintMirror::blockEvents(bool isBlocked) -{ +void SketchSolver_ConstraintMirror::blockEvents(bool isBlocked) { std::set::iterator anIt = myFeatures.begin(); for (; anIt != myFeatures.end(); ++anIt) (*anIt)->data()->blockSendAttributeUpdated(isBlocked); @@ -162,24 +151,21 @@ void SketchSolver_ConstraintMirror::blockEvents(bool isBlocked) SketchSolver_Constraint::blockEvents(isBlocked); } - - - // ================= Auxiliary functions ================================== -void mirrorPoints(const std::shared_ptr& theMirrorLine, - const AttributePoint2DPtr& theOriginal, - const AttributePoint2DPtr& theMirrored) -{ +void mirrorPoints(const std::shared_ptr &theMirrorLine, + const AttributePoint2DPtr &theOriginal, + const AttributePoint2DPtr &theMirrored) { std::shared_ptr anOriginal = theOriginal->pnt(); std::shared_ptr aPtOnLine = theMirrorLine->project(anOriginal); - std::shared_ptr aPerp = aPtOnLine->xy()->decreased(anOriginal->xy()); - theMirrored->setValue(anOriginal->x() + aPerp->x() * 2.0, anOriginal->y() + aPerp->y() * 2.0); + std::shared_ptr aPerp = + aPtOnLine->xy()->decreased(anOriginal->xy()); + theMirrored->setValue(anOriginal->x() + aPerp->x() * 2.0, + anOriginal->y() + aPerp->y() * 2.0); } -void mirrorEntities(const std::shared_ptr& theMirrorLine, - const FeaturePtr& theOriginal, - const FeaturePtr& theMirrored) -{ +void mirrorEntities(const std::shared_ptr &theMirrorLine, + const FeaturePtr &theOriginal, + const FeaturePtr &theMirrored) { std::list aPoints0 = theOriginal->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list aPoints1 = @@ -188,25 +174,30 @@ void mirrorEntities(const std::shared_ptr& theMirrorLine, // process specific features if (theOriginal->getKind() == SketchPlugin_Arc::ID()) { // orientation of arc - theMirrored->boolean(SketchPlugin_Arc::REVERSED_ID())->setValue( - !theOriginal->boolean(SketchPlugin_Arc::REVERSED_ID())->value()); + theMirrored->boolean(SketchPlugin_Arc::REVERSED_ID()) + ->setValue( + !theOriginal->boolean(SketchPlugin_Arc::REVERSED_ID())->value()); } else if (theOriginal->getKind() == SketchPlugin_Circle::ID()) { // radius of the circle - theMirrored->real(SketchPlugin_Circle::RADIUS_ID())->setValue( - theOriginal->real(SketchPlugin_Circle::RADIUS_ID())->value()); - } - else if (theOriginal->getKind() == SketchPlugin_EllipticArc::ID()) { + theMirrored->real(SketchPlugin_Circle::RADIUS_ID()) + ->setValue( + theOriginal->real(SketchPlugin_Circle::RADIUS_ID())->value()); + } else if (theOriginal->getKind() == SketchPlugin_EllipticArc::ID()) { // orientation of arc - theMirrored->boolean(SketchPlugin_EllipticArc::REVERSED_ID())->setValue( - !theOriginal->boolean(SketchPlugin_EllipticArc::REVERSED_ID())->value()); + theMirrored->boolean(SketchPlugin_EllipticArc::REVERSED_ID()) + ->setValue( + !theOriginal->boolean(SketchPlugin_EllipticArc::REVERSED_ID()) + ->value()); } // mirror all initialized points of features std::list::iterator anIt0, anIt1; for (anIt0 = aPoints0.begin(), anIt1 = aPoints1.begin(); anIt0 != aPoints0.end() && anIt1 != aPoints1.end(); ++anIt0, ++anIt1) { - AttributePoint2DPtr aPt0 = std::dynamic_pointer_cast(*anIt0); - AttributePoint2DPtr aPt1 = std::dynamic_pointer_cast(*anIt1); + AttributePoint2DPtr aPt0 = + std::dynamic_pointer_cast(*anIt0); + AttributePoint2DPtr aPt1 = + std::dynamic_pointer_cast(*anIt1); if (aPt0->isInitialized() && aPt1->isInitialized()) mirrorPoints(theMirrorLine, aPt0, aPt1); } diff --git a/src/SketchSolver/SketchSolver_ConstraintMirror.h b/src/SketchSolver/SketchSolver_ConstraintMirror.h index 1644f8f9d..b96221a00 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMirror.h +++ b/src/SketchSolver/SketchSolver_ConstraintMirror.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintMirror_H_ @@ -26,38 +27,39 @@ * \ingroup Plugins * \brief Convert fillet constraint to SolveSpace structure */ -class SketchSolver_ConstraintMirror : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintMirror : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintMirror(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint), - myNumberOfObjects(0) - {} + SketchSolver_ConstraintMirror(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint), myNumberOfObjects(0) {} /// \brief Update constraint virtual void update(); /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*); + virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *); /// \brief Block or unblock events from this constraint virtual void blockEvents(bool isBlocked); protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints virtual void process(); /// \brief Generate list of entities of mirror constraint - virtual void getAttributes(EntityWrapperPtr&, std::vector&); + virtual void getAttributes(EntityWrapperPtr &, + std::vector &); - /// \brief This method is used in derived objects to check consistence of constraint. + /// \brief This method is used in derived objects to check consistence of + /// constraint. /// E.g. the distance between line and point may be signed. virtual void adjustConstraint(); private: - size_t myNumberOfObjects; ///< number of previously mirrored objects - std::set myFeatures; ///< mirror line, original and mirrored features + size_t myNumberOfObjects; ///< number of previously mirrored objects + std::set + myFeatures; ///< mirror line, original and mirrored features }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintMovement.cpp b/src/SketchSolver/SketchSolver_ConstraintMovement.cpp index aefb48597..a21346a0e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMovement.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMovement.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -38,40 +39,32 @@ #include -static GCS::Point createGCSPoint(double* x, double* y) -{ +static GCS::Point createGCSPoint(double *x, double *y) { GCS::Point aPoint; aPoint.x = x; aPoint.y = y; return aPoint; } +SketchSolver_ConstraintMovement::SketchSolver_ConstraintMovement( + FeaturePtr theFeature) + : SketchSolver_ConstraintFixed(ConstraintPtr()), myMovedFeature(theFeature), + mySimpleMove(true) {} -SketchSolver_ConstraintMovement::SketchSolver_ConstraintMovement(FeaturePtr theFeature) - : SketchSolver_ConstraintFixed(ConstraintPtr()), - myMovedFeature(theFeature), - mySimpleMove(true) -{ -} - -SketchSolver_ConstraintMovement::SketchSolver_ConstraintMovement(AttributePtr theAttribute, - const int thePointIndex) - : SketchSolver_ConstraintFixed(ConstraintPtr()), - myDraggedAttribute(theAttribute), - myDraggedPointIndex(thePointIndex), - mySimpleMove(true) -{ +SketchSolver_ConstraintMovement::SketchSolver_ConstraintMovement( + AttributePtr theAttribute, const int thePointIndex) + : SketchSolver_ConstraintFixed(ConstraintPtr()), + myDraggedAttribute(theAttribute), myDraggedPointIndex(thePointIndex), + mySimpleMove(true) { myMovedFeature = ModelAPI_Feature::feature(theAttribute->owner()); } -void SketchSolver_ConstraintMovement::blockEvents(bool isBlocked) -{ +void SketchSolver_ConstraintMovement::blockEvents(bool isBlocked) { if (myMovedFeature) myMovedFeature->data()->blockSendAttributeUpdated(isBlocked); } -void SketchSolver_ConstraintMovement::process() -{ +void SketchSolver_ConstraintMovement::process() { cleanErrorMsg(); if (!myMovedFeature || !myStorage) { // Not enough parameters are initialized @@ -88,9 +81,8 @@ void SketchSolver_ConstraintMovement::process() myStorage->addMovementConstraint(mySolverConstraint); } - -static bool isSimpleMove(FeaturePtr theMovedFeature, AttributePtr theDraggedPoint) -{ +static bool isSimpleMove(FeaturePtr theMovedFeature, + AttributePtr theDraggedPoint) { bool isSimple = true; #ifdef CHANGE_RADIUS_WHILE_MOVE if (theMovedFeature->getKind() == SketchPlugin_Circle::ID() || @@ -98,16 +90,16 @@ static bool isSimpleMove(FeaturePtr theMovedFeature, AttributePtr theDraggedPoin isSimple = (theDraggedPoint.get() != 0); else if (theMovedFeature->getKind() == SketchPlugin_Arc::ID() || theMovedFeature->getKind() == SketchPlugin_EllipticArc::ID()) { - isSimple = (theDraggedPoint.get() != 0 && - (theDraggedPoint->id() == SketchPlugin_Arc::CENTER_ID() || - theDraggedPoint->id() == SketchPlugin_EllipticArc::CENTER_ID())); + isSimple = + (theDraggedPoint.get() != 0 && + (theDraggedPoint->id() == SketchPlugin_Arc::CENTER_ID() || + theDraggedPoint->id() == SketchPlugin_EllipticArc::CENTER_ID())); } #endif return isSimple; } -ConstraintWrapperPtr SketchSolver_ConstraintMovement::initMovement() -{ +ConstraintWrapperPtr SketchSolver_ConstraintMovement::initMovement() { ConstraintWrapperPtr aConstraint; // if the feature is copy, do not move it @@ -118,8 +110,9 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::initMovement() return aConstraint; } - EntityWrapperPtr anEntity = myDraggedAttribute ? myStorage->entity(myDraggedAttribute) - : myStorage->entity(myMovedFeature); + EntityWrapperPtr anEntity = myDraggedAttribute + ? myStorage->entity(myDraggedAttribute) + : myStorage->entity(myMovedFeature); if (!anEntity) { myStorage->update(myMovedFeature, true); anEntity = myDraggedAttribute ? myStorage->entity(myDraggedAttribute) @@ -132,19 +125,20 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::initMovement() if (mySimpleMove) { if (anEntity->type() == ENTITY_POINT_ARRAY) { - anEntity = std::dynamic_pointer_cast(anEntity) - ->value(myDraggedPointIndex); + anEntity = + std::dynamic_pointer_cast(anEntity) + ->value(myDraggedPointIndex); } aConstraint = fixFeature(anEntity); - } - else { + } else { if (myDraggedAttribute) // start or end point of arc has been moved aConstraint = fixArcExtremity(anEntity); - else if (anEntity->type() == ENTITY_CIRCLE || anEntity->type() == ENTITY_ARC) { + else if (anEntity->type() == ENTITY_CIRCLE || + anEntity->type() == ENTITY_ARC) { // arc or circle has been moved aConstraint = fixPointOnCircle(anEntity); - } - else if (anEntity->type() == ENTITY_ELLIPSE || anEntity->type() == ENTITY_ELLIPTIC_ARC) { + } else if (anEntity->type() == ENTITY_ELLIPSE || + anEntity->type() == ENTITY_ELLIPTIC_ARC) { // ellipse or elliptic arc has been moved aConstraint = fixPointOnEllipse(anEntity); } @@ -154,13 +148,13 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::initMovement() } ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixArcExtremity( - const EntityWrapperPtr& theArcExtremity) -{ + const EntityWrapperPtr &theArcExtremity) { static const int nbParams = 4; myFixedValues.reserve(nbParams); // moved point and center of arc - EdgeWrapperPtr aCircularEntity = std::dynamic_pointer_cast( - myStorage->entity(myMovedFeature)); + EdgeWrapperPtr aCircularEntity = + std::dynamic_pointer_cast( + myStorage->entity(myMovedFeature)); std::shared_ptr anArc = std::dynamic_pointer_cast(aCircularEntity->entity()); std::shared_ptr anEllArc = @@ -169,12 +163,11 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixArcExtremity( PointWrapperPtr aPoint = std::dynamic_pointer_cast(theArcExtremity); - double* aParams[nbParams] = { aPoint->point()->x, aPoint->point()->y, 0, 0 }; + double *aParams[nbParams] = {aPoint->point()->x, aPoint->point()->y, 0, 0}; if (anArc) { aParams[2] = anArc->center.x; aParams[3] = anArc->center.y; - } - else if (anEllArc) { + } else if (anEllArc) { aParams[2] = anEllArc->center.x; aParams[3] = anEllArc->center.y; } @@ -182,7 +175,8 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixArcExtremity( std::list aConstraints; for (int i = 0; i < nbParams; ++i) { myFixedValues.push_back(*aParams[i]); - GCSConstraintPtr aNewConstraint(new GCS::ConstraintEqual(&myFixedValues[i], aParams[i])); + GCSConstraintPtr aNewConstraint( + new GCS::ConstraintEqual(&myFixedValues[i], aParams[i])); aNewConstraint->rescale(0.01); aConstraints.push_back(aNewConstraint); } @@ -192,8 +186,7 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixArcExtremity( } ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixPointOnCircle( - const EntityWrapperPtr& theCircular) -{ + const EntityWrapperPtr &theCircular) { static const double scale = 0.01; static const int nbParams = 4; myFixedValues.reserve(nbParams); // moved point and center of arc/circle @@ -210,12 +203,13 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixPointOnCircle( myFixedValues.push_back(*aCircular->center.y); // create a moved point - GCS::Point aPointOnCircle = createGCSPoint(&myFixedValues[0], &myFixedValues[1]); + GCS::Point aPointOnCircle = + createGCSPoint(&myFixedValues[0], &myFixedValues[1]); std::list aConstraints; // point-on-circle - GCSConstraintPtr aNewConstraint( - new GCS::ConstraintP2PDistance(aPointOnCircle, aCircular->center, aCircular->rad)); + GCSConstraintPtr aNewConstraint(new GCS::ConstraintP2PDistance( + aPointOnCircle, aCircular->center, aCircular->rad)); aNewConstraint->rescale(scale); aConstraints.push_back(aNewConstraint); // fixed center (x) @@ -234,24 +228,24 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixPointOnCircle( } ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixPointOnEllipse( - const EntityWrapperPtr& theConic) -{ + const EntityWrapperPtr &theConic) { static const double scale = 0.01; static const int nbParams = 6; myFixedValues.reserve(nbParams); // moved point; center and focus of ellipse - EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(theConic); - std::shared_ptr aConic = std::dynamic_pointer_cast(anEdge->entity()); + EdgeWrapperPtr anEdge = + std::dynamic_pointer_cast(theConic); + std::shared_ptr aConic = + std::dynamic_pointer_cast(anEdge->entity()); // major axis direction double dx = *aConic->focus1.x - *aConic->center.x; double dy = *aConic->focus1.y - *aConic->center.y; - double norm = sqrt(dx * dx + dy* dy); + double norm = sqrt(dx * dx + dy * dy); if (norm < tolerance) { dx = 1.0; dy = 0.0; - } - else { + } else { dx /= norm; dy /= norm; } @@ -267,39 +261,39 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixPointOnEllipse( myFixedValues.push_back(*aConic->focus1.y); // create a moved point - GCS::Point aPointOnEllipse = createGCSPoint(&myFixedValues[0], &myFixedValues[1]); + GCS::Point aPointOnEllipse = + createGCSPoint(&myFixedValues[0], &myFixedValues[1]); std::list aConstraints; // point-on-circle GCSConstraintPtr aNewConstraint( - new GCS::ConstraintPointOnEllipse(aPointOnEllipse, *aConic)); + new GCS::ConstraintPointOnEllipse(aPointOnEllipse, *aConic)); aNewConstraint->rescale(scale); aConstraints.push_back(aNewConstraint); // fixed center (x) aNewConstraint = GCSConstraintPtr( - new GCS::ConstraintEqual(&myFixedValues[2], aConic->center.x)); + new GCS::ConstraintEqual(&myFixedValues[2], aConic->center.x)); aNewConstraint->rescale(scale); aConstraints.push_back(aNewConstraint); // fixed center (y) aNewConstraint = GCSConstraintPtr( - new GCS::ConstraintEqual(&myFixedValues[3], aConic->center.y)); + new GCS::ConstraintEqual(&myFixedValues[3], aConic->center.y)); aNewConstraint->rescale(scale); aConstraints.push_back(aNewConstraint); // focus on the major axis GCS::Point aStartPoint = createGCSPoint(&myFixedValues[2], &myFixedValues[3]); - GCS::Point aEndPoint = createGCSPoint(&myFixedValues[4], &myFixedValues[5]); + GCS::Point aEndPoint = createGCSPoint(&myFixedValues[4], &myFixedValues[5]); aNewConstraint = GCSConstraintPtr( - new GCS::ConstraintPointOnLine(aConic->focus1, aStartPoint, aEndPoint)); + new GCS::ConstraintPointOnLine(aConic->focus1, aStartPoint, aEndPoint)); aNewConstraint->rescale(scale); aConstraints.push_back(aNewConstraint); return ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aConstraints, getType())); + new PlaneGCSSolver_ConstraintWrapper(aConstraints, getType())); } void SketchSolver_ConstraintMovement::startPoint( - const std::shared_ptr& theStartPoint) -{ + const std::shared_ptr &theStartPoint) { myStartPoint = theStartPoint; if (!mySimpleMove) { myFixedValues[0] = myStartPoint->x(); @@ -308,19 +302,20 @@ void SketchSolver_ConstraintMovement::startPoint( } void SketchSolver_ConstraintMovement::moveTo( - const std::shared_ptr& theDestinationPoint) -{ + const std::shared_ptr &theDestinationPoint) { if (!myMovedFeature) return; // nothing to move - double aDelta[2] = { theDestinationPoint->x() - myStartPoint->x(), - theDestinationPoint->y() - myStartPoint->y() }; + double aDelta[2] = {theDestinationPoint->x() - myStartPoint->x(), + theDestinationPoint->y() - myStartPoint->y()}; #ifdef CHANGE_RADIUS_WHILE_MOVE int aMaxSize = mySimpleMove ? (int)myFixedValues.size() : 2; #else - int aMaxSize = - myMovedFeature->getKind() == SketchPlugin_Line::ID() && !myDraggedAttribute ? 4 : 2; + int aMaxSize = myMovedFeature->getKind() == SketchPlugin_Line::ID() && + !myDraggedAttribute + ? 4 + : 2; #endif for (int i = 0; i < aMaxSize; ++i) myFixedValues[i] += aDelta[i % 2]; diff --git a/src/SketchSolver/SketchSolver_ConstraintMovement.h b/src/SketchSolver/SketchSolver_ConstraintMovement.h index 13a16e91a..a8e840054 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMovement.h +++ b/src/SketchSolver/SketchSolver_ConstraintMovement.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // File: SketchSolver_ConstraintMovement.h @@ -32,53 +33,58 @@ class GeomAPI_Pnt2d; * \ingroup Plugins * \brief Stores data to the Fixed constraint for the moved feature only */ -class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintFixed -{ +class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintFixed { public: /// Creates movement constraint based on feature SketchSolver_ConstraintMovement(FeaturePtr theFeature); /// Creates movement constraint based on point - SketchSolver_ConstraintMovement(AttributePtr theMovedAttribute, const int thePointIndex = -1); + SketchSolver_ConstraintMovement(AttributePtr theMovedAttribute, + const int thePointIndex = -1); /// \brief Set coordinates of the start point of the movement - void startPoint(const std::shared_ptr& theStartPoint); + void startPoint(const std::shared_ptr &theStartPoint); - /// \brief Set coordinates of fixed feature to the values where it has been dragged. + /// \brief Set coordinates of fixed feature to the values where it has been + /// dragged. /// Useful when the feature is being moved. - void moveTo(const std::shared_ptr& theDestinationPoint); + void moveTo(const std::shared_ptr &theDestinationPoint); /// \brief Block or unblock events from this constraint virtual void blockEvents(bool isBlocked); /// \brief Returns moved feature - FeaturePtr movedFeature() const - { return myMovedFeature; } + FeaturePtr movedFeature() const { return myMovedFeature; } protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints virtual void process(); - /// \brief Create Fixed constraint for the feature basing on its type and moved point - /// \return Fixed constraint + /// \brief Create Fixed constraint for the feature basing on its type and + /// moved point \return Fixed constraint ConstraintWrapperPtr initMovement(); /// \brief Create constraint to fix moved arc extremity - ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr& theArcExtremity); + ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr &theArcExtremity); /// \brief Create constraint to fix moved point on circle/arc - ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr& theCircular); + ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr &theCircular); /// \brief Create constraint to fix moved point on ellipse/elliptic arc - ConstraintWrapperPtr fixPointOnEllipse(const EntityWrapperPtr& theConic); + ConstraintWrapperPtr fixPointOnEllipse(const EntityWrapperPtr &theConic); private: - FeaturePtr myMovedFeature; ///< fixed feature (if set, myBaseConstraint should be NULL) - AttributePtr myDraggedAttribute; ///< one of the feature points which has been moved - int myDraggedPointIndex; ///< index of the point if the moved attribute is an array + FeaturePtr myMovedFeature; ///< fixed feature (if set, myBaseConstraint should + ///< be NULL) + AttributePtr + myDraggedAttribute; ///< one of the feature points which has been moved + int myDraggedPointIndex; ///< index of the point if the moved attribute is an + ///< array std::shared_ptr myStartPoint; ///< start point of the movement - bool mySimpleMove; ///< simple move, thus all parameters should be increased by movement delta + bool mySimpleMove; ///< simple move, thus all parameters should be increased + ///< by movement delta }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp index 871a76e2e..d21bfd990 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -27,12 +28,12 @@ #include #include #include +#include #include #include -#include -static void createCopiedEntity(const FeaturePtr& theFeature, const StoragePtr& theStorage) -{ +static void createCopiedEntity(const FeaturePtr &theFeature, + const StoragePtr &theStorage) { EntityWrapperPtr anEntity = theStorage->entity(theFeature); if (anEntity) { std::shared_ptr aSketchFeature = @@ -42,8 +43,8 @@ static void createCopiedEntity(const FeaturePtr& theFeature, const StoragePtr& t } } -void SketchSolver_ConstraintMulti::getEntities(std::list& theEntities) -{ +void SketchSolver_ConstraintMulti::getEntities( + std::list &theEntities) { myAdjusted = false; // Lists of objects and number of copies @@ -73,12 +74,14 @@ void SketchSolver_ConstraintMulti::getEntities(std::list& theE if (!aFeature) continue; - // the entity is not created, so it is a copy in "multi" constraint, force its creation + // the entity is not created, so it is a copy in "multi" constraint, force + // its creation if (!myStorage->update(aFeature)) myStorage->update(aFeature, true); theEntities.push_back(myStorage->entity(aFeature)); myOriginalFeatures.insert(aFeature); - for (int i = 0; i < myNumberOfCopies && anObjIt != anObjectList.end(); ++i, ++anObjIt) { + for (int i = 0; i < myNumberOfCopies && anObjIt != anObjectList.end(); + ++i, ++anObjIt) { // just add copied features into the list of objects aFeature = ModelAPI_Feature::feature(*anObjIt); if (aFeature) { @@ -89,12 +92,11 @@ void SketchSolver_ConstraintMulti::getEntities(std::list& theE } } -bool SketchSolver_ConstraintMulti::remove() -{ +bool SketchSolver_ConstraintMulti::remove() { myStorage->unsubscribeUpdates(this); - // "Multi" constraint has been removed, thus all copy features become non-copied, - // add them once again to be a common feature + // "Multi" constraint has been removed, thus all copy features become + // non-copied, add them once again to be a common feature std::set::iterator anIt = myCopiedFeatures.begin(); for (; anIt != myCopiedFeatures.end(); ++anIt) { EntityWrapperPtr anEntity = myStorage->entity(*anIt); @@ -112,16 +114,15 @@ bool SketchSolver_ConstraintMulti::remove() return SketchSolver_Constraint::remove(); } -void SketchSolver_ConstraintMulti::update() -{ +void SketchSolver_ConstraintMulti::update() { cleanErrorMsg(); AttributeRefListPtr anInitialRefList = myBaseConstraint->reflist(SketchPlugin_Constraint::ENTITY_A()); AttributeIntegerPtr aNbObjects = myBaseConstraint->integer(nameNbObjects()); if (!anInitialRefList || !aNbObjects) return; // the "Multi" constraint is in queue to remove - bool isUpdated = - anInitialRefList->size() != myNumberOfObjects || aNbObjects->value()-1 != myNumberOfCopies; + bool isUpdated = anInitialRefList->size() != myNumberOfObjects || + aNbObjects->value() - 1 != myNumberOfCopies; if (!isUpdated) { // additional check that the features and their copies are changed AttributeRefListPtr aRefList = @@ -132,7 +133,8 @@ void SketchSolver_ConstraintMulti::update() std::list::iterator anObjIt = anObjectList.begin(); for (; anObjIt != anObjectList.end(); ++anObjIt) { aFeature = ModelAPI_Feature::feature(*anObjIt); - if (aFeature && myOriginalFeatures.find(aFeature) == myOriginalFeatures.end() && + if (aFeature && + myOriginalFeatures.find(aFeature) == myOriginalFeatures.end() && myCopiedFeatures.find(aFeature) == myCopiedFeatures.end()) { isUpdated = true; break; @@ -151,8 +153,7 @@ void SketchSolver_ConstraintMulti::update() adjustConstraint(); } -void SketchSolver_ConstraintMulti::adjustConstraint() -{ +void SketchSolver_ConstraintMulti::adjustConstraint() { AttributeRefListPtr aRefList = myBaseConstraint->reflist(SketchPlugin_Constraint::ENTITY_B()); if (!aRefList || aRefList->size() == 0) { @@ -177,7 +178,8 @@ void SketchSolver_ConstraintMulti::adjustConstraint() anOriginal->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list::iterator aPtIt = aPoints.begin(); for (; aPtIt != aPoints.end(); ++aPtIt) { - AttributePoint2DPtr aPoint2D = std::dynamic_pointer_cast(*aPtIt); + AttributePoint2DPtr aPoint2D = + std::dynamic_pointer_cast(*aPtIt); if (aPoint2D->isInitialized()) { aXCoord = aPoint2D->x(); aYCoord = aPoint2D->y(); @@ -190,7 +192,8 @@ void SketchSolver_ConstraintMulti::adjustConstraint() } // Calculate positions of copied features - for (int i = 0; i < myNumberOfCopies && anObjIt != anObjectList.end(); ++i, ++anObjIt) { + for (int i = 0; i < myNumberOfCopies && anObjIt != anObjectList.end(); + ++i, ++anObjIt) { aFeature = ModelAPI_Feature::feature(*anObjIt); if (!aFeature) continue; @@ -198,9 +201,11 @@ void SketchSolver_ConstraintMulti::adjustConstraint() if (myIsEventsBlocked) aFeature->data()->blockSendAttributeUpdated(true); - if (aFeature->getKind() == SketchPlugin_Circle::ID()) // update circle's radius - aFeature->real(SketchPlugin_Circle::RADIUS_ID())->setValue( - anOriginal->real(SketchPlugin_Circle::RADIUS_ID())->value()); + if (aFeature->getKind() == + SketchPlugin_Circle::ID()) // update circle's radius + aFeature->real(SketchPlugin_Circle::RADIUS_ID()) + ->setValue( + anOriginal->real(SketchPlugin_Circle::RADIUS_ID())->value()); aPoints = aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); for (aPtIt = aPoints.begin(), aXIt = aX.begin(), aYIt = aY.begin(); @@ -224,9 +229,8 @@ void SketchSolver_ConstraintMulti::adjustConstraint() myAdjusted = true; } -void SketchSolver_ConstraintMulti::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update*) -{ +void SketchSolver_ConstraintMulti::notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *) { if (myOriginalFeatures.find(theFeature) == myOriginalFeatures.end() && myCopiedFeatures.find(theFeature) == myCopiedFeatures.end()) return; // the feature is not used by constraint => nothing to update @@ -235,8 +239,10 @@ void SketchSolver_ConstraintMulti::notify(const FeaturePtr& theFeature, return; // "notify" is already processing // do not adjust "multi"-constraint if the number of objects is changed, - // wait until the constraint is updated (issue #2425: changing number of copies by parameter) - if (myNumberOfCopies + 1 == myBaseConstraint->integer(nameNbObjects())->value()) { + // wait until the constraint is updated (issue #2425: changing number of + // copies by parameter) + if (myNumberOfCopies + 1 == + myBaseConstraint->integer(nameNbObjects())->value()) { myIsProcessingNotify = true; // update derivative object @@ -248,8 +254,7 @@ void SketchSolver_ConstraintMulti::notify(const FeaturePtr& theFeature, } } -void SketchSolver_ConstraintMulti::blockEvents(bool isBlocked) -{ +void SketchSolver_ConstraintMulti::blockEvents(bool isBlocked) { myIsEventsBlocked = isBlocked; std::set::iterator anIt = myOriginalFeatures.begin(); diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.h b/src/SketchSolver/SketchSolver_ConstraintMulti.h index 71bb81557..4cbadfded 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.h +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintMulti_H_ @@ -28,25 +29,19 @@ * \ingroup Plugins * \brief Common base class for the Multi constraints */ -class SketchSolver_ConstraintMulti : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintMulti : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintMulti(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint), - myNumberOfObjects(0), - myNumberOfCopies(0), - myIsFullValue(false), - myAdjusted(false), - myIsEventsBlocked(false), - myIsProcessingNotify(false) - {} + SketchSolver_ConstraintMulti(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint), myNumberOfObjects(0), + myNumberOfCopies(0), myIsFullValue(false), myAdjusted(false), + myIsEventsBlocked(false), myIsProcessingNotify(false) {} /// \brief Update constraint virtual void update(); /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*); + virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *); /// \brief Tries to remove constraint /// \return \c false, if current constraint contains another SketchPlugin @@ -57,42 +52,53 @@ public: virtual void blockEvents(bool isBlocked); protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints - virtual void process() - { /* do nothing here */ } + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints + virtual void process() { /* do nothing here */ + } /// \brief Collect entities which are translated or rotated (not their copies) - void getEntities(std::list& theEntities); + void getEntities(std::list &theEntities); - /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints - virtual void getAttributes(EntityWrapperPtr&, std::vector&) - { /* do nothing here */ } + /// \brief Generate list of attributes of constraint in order useful for + /// SolveSpace constraints + virtual void + getAttributes(EntityWrapperPtr &, + std::vector &) { /* do nothing here */ + } - /// \brief This method is used in derived objects to check consistence of constraint. + /// \brief This method is used in derived objects to check consistence of + /// constraint. virtual void adjustConstraint(); /// \brief Update parameters of derived classes virtual void updateLocal() = 0; - /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature - virtual const std::string& nameNbObjects() = 0; + /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding + /// feature + virtual const std::string &nameNbObjects() = 0; protected: /// \brief Convert absolute coordinates to relative coordinates - virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY) = 0; + virtual void getRelative(double theAbsX, double theAbsY, double &theRelX, + double &theRelY) = 0; /// \brief Convert relative coordinates to absolute coordinates - virtual void getAbsolute(double theRelX, double theRelY, double& theAbsX, double& theAbsY) = 0; + virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX, + double &theAbsY) = 0; /// \brief Apply transformation for relative coordinates - virtual void transformRelative(double& theX, double& theY) = 0; + virtual void transformRelative(double &theX, double &theY) = 0; protected: int myNumberOfObjects; ///< number of previous initial objects int myNumberOfCopies; ///< number of previous copies of initial objects - bool myIsFullValue; ///< value whether the angle/distance is a full or single for objects + bool myIsFullValue; ///< value whether the angle/distance is a full or single + ///< for objects - bool myAdjusted; ///< the constraint is already adjusted (to not do it several times) + bool myAdjusted; ///< the constraint is already adjusted (to not do it several + ///< times) - /// lists of original features and their copies to find whether some of them are disappeared + /// lists of original features and their copies to find whether some of them + /// are disappeared std::set myOriginalFeatures; std::set myCopiedFeatures; diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp index 03510131e..2de5a0d2b 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -33,10 +34,10 @@ #include void SketchSolver_ConstraintMultiRotation::getAttributes( - EntityWrapperPtr& theCenter, ScalarWrapperPtr& theAngle, - bool& theFullValue, bool& theReversed, std::list& theEntities) -{ - AttributePtr anAngleAttr = myBaseConstraint->attribute(SketchPlugin_MultiRotation::ANGLE_ID()); + EntityWrapperPtr &theCenter, ScalarWrapperPtr &theAngle, bool &theFullValue, + bool &theReversed, std::list &theEntities) { + AttributePtr anAngleAttr = + myBaseConstraint->attribute(SketchPlugin_MultiRotation::ANGLE_ID()); PlaneGCSSolver_AttributeBuilder aValueBuilder; theAngle = std::dynamic_pointer_cast( aValueBuilder.createAttribute(anAngleAttr)); @@ -58,18 +59,20 @@ void SketchSolver_ConstraintMultiRotation::getAttributes( myBaseConstraint->string(SketchPlugin_MultiRotation::ANGLE_TYPE()); theFullValue = aMethodTypeAttr->value() != "SingleAngle"; - theReversed = myBaseConstraint->boolean(SketchPlugin_MultiRotation::REVERSED_ID())->value(); + theReversed = + myBaseConstraint->boolean(SketchPlugin_MultiRotation::REVERSED_ID()) + ->value(); getEntities(theEntities); - // add owner of central point of Multi-Rotation to the list of monitored features + // add owner of central point of Multi-Rotation to the list of monitored + // features FeaturePtr anOwner = ModelAPI_Feature::feature(aCenterAttr->attr()->owner()); if (anOwner) myOriginalFeatures.insert(anOwner); } -void SketchSolver_ConstraintMultiRotation::process() -{ +void SketchSolver_ConstraintMultiRotation::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -78,7 +81,8 @@ void SketchSolver_ConstraintMultiRotation::process() EntityWrapperPtr aRotationCenter; std::list aBaseEntities; - getAttributes(aRotationCenter, myAngle, myIsFullValue, myIsRevered, aBaseEntities); + getAttributes(aRotationCenter, myAngle, myIsFullValue, myIsRevered, + aBaseEntities); if (!myErrorMsg.empty()) return; @@ -88,10 +92,12 @@ void SketchSolver_ConstraintMultiRotation::process() myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateFeature::GROUP()); } -void SketchSolver_ConstraintMultiRotation::updateLocal() -{ - double aValue = myBaseConstraint->real(SketchPlugin_MultiRotation::ANGLE_ID())->value(); - bool isReversed = myBaseConstraint->boolean(SketchPlugin_MultiRotation::REVERSED_ID())->value(); +void SketchSolver_ConstraintMultiRotation::updateLocal() { + double aValue = + myBaseConstraint->real(SketchPlugin_MultiRotation::ANGLE_ID())->value(); + bool isReversed = + myBaseConstraint->boolean(SketchPlugin_MultiRotation::REVERSED_ID()) + ->value(); if (fabs(myAngle->value() - aValue) > tolerance || isReversed != myIsRevered) myAdjusted = false; // update angle value @@ -100,13 +106,14 @@ void SketchSolver_ConstraintMultiRotation::updateLocal() // update center DataPtr aData = myBaseConstraint->data(); - AttributePoint2DPtr aCenterPointAttribute = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiRotation::CENTER_ID()); + AttributePoint2DPtr aCenterPointAttribute = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiRotation::CENTER_ID()); bool aCenterPointChanged = aCenterPointAttribute != myCenterPointAttribute; if (aCenterPointChanged) myCenterPointAttribute = aCenterPointAttribute; - AttributeStringPtr aMethodTypeAttr = aData->string(SketchPlugin_MultiRotation::ANGLE_TYPE()); + AttributeStringPtr aMethodTypeAttr = + aData->string(SketchPlugin_MultiRotation::ANGLE_TYPE()); bool aFullValue = aMethodTypeAttr->value() != "SingleAngle"; bool isMethodChanged = aFullValue != myIsFullValue; if (isMethodChanged) @@ -116,8 +123,7 @@ void SketchSolver_ConstraintMultiRotation::updateLocal() myAdjusted = false; } -void SketchSolver_ConstraintMultiRotation::adjustConstraint() -{ +void SketchSolver_ConstraintMultiRotation::adjustConstraint() { if (myAdjusted) return; @@ -134,23 +140,19 @@ void SketchSolver_ConstraintMultiRotation::adjustConstraint() myBaseConstraint->refattr(SketchPlugin_MultiRotation::CENTER_ID()); std::shared_ptr aRotCenter = std::dynamic_pointer_cast( - myStorage->entity(AttributePtr(aCenterAttr))); - if (aRotCenter) - { + myStorage->entity(AttributePtr(aCenterAttr))); + if (aRotCenter) { GCSPointPtr aCenterPoint = aRotCenter->point(); myCenterCoord[0] = *(aCenterPoint->x); myCenterCoord[1] = *(aCenterPoint->y); - } - else - { + } else { AttributePoint2DPtr aCenterPnt = std::dynamic_pointer_cast(aCenterAttr->attr()); myCenterCoord[0] = aCenterPnt->x(); myCenterCoord[1] = aCenterPnt->y(); } - if (myIsFullValue && myNumberOfCopies > 0) - { + if (myIsFullValue && myNumberOfCopies > 0) { // if the full angle value is equal to 360, then distribute rotated items // to avoid superposition of original feature and last copy if (fabs(anAngleValue - 360.0) < 1.e-7) @@ -165,22 +167,24 @@ void SketchSolver_ConstraintMultiRotation::adjustConstraint() SketchSolver_ConstraintMulti::adjustConstraint(); } -void SketchSolver_ConstraintMultiRotation::getRelative( - double theAbsX, double theAbsY, double& theRelX, double& theRelY) -{ +void SketchSolver_ConstraintMultiRotation::getRelative(double theAbsX, + double theAbsY, + double &theRelX, + double &theRelY) { theRelX = theAbsX - myCenterCoord[0]; theRelY = theAbsY - myCenterCoord[1]; } -void SketchSolver_ConstraintMultiRotation::getAbsolute( - double theRelX, double theRelY, double& theAbsX, double& theAbsY) -{ +void SketchSolver_ConstraintMultiRotation::getAbsolute(double theRelX, + double theRelY, + double &theAbsX, + double &theAbsY) { theAbsX = theRelX + myCenterCoord[0]; theAbsY = theRelY + myCenterCoord[1]; } -void SketchSolver_ConstraintMultiRotation::transformRelative(double& theX, double& theY) -{ +void SketchSolver_ConstraintMultiRotation::transformRelative(double &theX, + double &theY) { // rotate direction // myRotationVal[0] = sinA, myRotationVal[1] = cosA double aTemp = theX * myRotationVal[1] - theY * myRotationVal[0]; @@ -188,7 +192,6 @@ void SketchSolver_ConstraintMultiRotation::transformRelative(double& theX, doubl theX = aTemp; } -const std::string& SketchSolver_ConstraintMultiRotation::nameNbObjects() -{ +const std::string &SketchSolver_ConstraintMultiRotation::nameNbObjects() { return SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID(); } diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h index 82d3ceeb2..0b4722304 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h +++ b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintMultiRotation_H_ @@ -28,31 +29,30 @@ * \ingroup Plugins * \brief Convert rotated features to the list of SolveSpace constraints */ -class SketchSolver_ConstraintMultiRotation : public SketchSolver_ConstraintMulti -{ +class SketchSolver_ConstraintMultiRotation + : public SketchSolver_ConstraintMulti { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintMultiRotation(ConstraintPtr theConstraint) : - SketchSolver_ConstraintMulti(theConstraint) - {} + SketchSolver_ConstraintMultiRotation(ConstraintPtr theConstraint) + : SketchSolver_ConstraintMulti(theConstraint) {} protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints virtual void process(); /// \brief Generate list of rotated entities /// \param[out] theCenter central point of rotation /// \param[out] theAngle rotation angle - /// \param[out] theFullValue applying translation using the distance as a full or single value - /// \param[out] theReversed rotation angle is negative + /// \param[out] theFullValue applying translation using the distance as a full + /// or single value \param[out] theReversed rotation angle is negative /// \param[out] theEntities list of base entities - void getAttributes(EntityWrapperPtr& theCenter, - ScalarWrapperPtr& theAngle, - bool& theFullValue, - bool& theReversed, - std::list& theEntities); + void getAttributes(EntityWrapperPtr &theCenter, ScalarWrapperPtr &theAngle, + bool &theFullValue, bool &theReversed, + std::list &theEntities); - /// \brief This method is used in derived objects to check consistence of constraint. + /// \brief This method is used in derived objects to check consistence of + /// constraint. virtual void adjustConstraint(); /// \brief Update parameters (called from base class) @@ -60,21 +60,22 @@ protected: private: /// \brief Convert absolute coordinates to relative coordinates - virtual void getRelative(double theAbsX, double theAbsY, - double& theRelX, double& theRelY); + virtual void getRelative(double theAbsX, double theAbsY, double &theRelX, + double &theRelY); /// \brief Convert relative coordinates to absolute coordinates - virtual void getAbsolute(double theRelX, double theRelY, - double& theAbsX, double& theAbsY); + virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX, + double &theAbsY); /// \brief Apply transformation for relative coordinates - virtual void transformRelative(double& theX, double& theY); + virtual void transformRelative(double &theX, double &theY); - /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature - virtual const std::string& nameNbObjects(); + /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding + /// feature + virtual const std::string &nameNbObjects(); private: AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation - ScalarWrapperPtr myAngle; ///< angle of rotation - bool myIsRevered; ///< angle of rotation is negative + ScalarWrapperPtr myAngle; ///< angle of rotation + bool myIsRevered; ///< angle of rotation is negative double myCenterCoord[2]; ///< coordinates of rotation center double myRotationVal[2]; ///< sinus and cosine of rotation angle diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp index b86ff5d8f..132e3d021 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -30,16 +31,15 @@ #include void SketchSolver_ConstraintMultiTranslation::getAttributes( - EntityWrapperPtr& theStartPoint, EntityWrapperPtr& theEndPoint, - bool& theFullValue, std::list& theEntities) -{ + EntityWrapperPtr &theStartPoint, EntityWrapperPtr &theEndPoint, + bool &theFullValue, std::list &theEntities) { DataPtr aData = myBaseConstraint->data(); AttributeRefAttrPtr aStartPointAttr = aData->refattr(SketchPlugin_MultiTranslation::START_POINT_ID()); AttributeRefAttrPtr aEndPointAttr = aData->refattr(SketchPlugin_MultiTranslation::END_POINT_ID()); - if (!aStartPointAttr || !aStartPointAttr->isInitialized() || - !aEndPointAttr || !aEndPointAttr->isInitialized()) { + if (!aStartPointAttr || !aStartPointAttr->isInitialized() || !aEndPointAttr || + !aEndPointAttr->isInitialized()) { myErrorMsg = SketchSolver_Error::NOT_INITIALIZED(); return; } @@ -51,13 +51,16 @@ void SketchSolver_ConstraintMultiTranslation::getAttributes( myStorage->update(AttributePtr(aEndPointAttr)); theEndPoint = myStorage->entity(AttributePtr(aEndPointAttr)); - AttributeStringPtr aMethodTypeAttr = aData->string(SketchPlugin_MultiTranslation::VALUE_TYPE()); + AttributeStringPtr aMethodTypeAttr = + aData->string(SketchPlugin_MultiTranslation::VALUE_TYPE()); theFullValue = aMethodTypeAttr->value() != "SingleValue"; getEntities(theEntities); - // add owner of start and end points of Multi-Translation to the list of monitored features - FeaturePtr anOwner = ModelAPI_Feature::feature(aStartPointAttr->attr()->owner()); + // add owner of start and end points of Multi-Translation to the list of + // monitored features + FeaturePtr anOwner = + ModelAPI_Feature::feature(aStartPointAttr->attr()->owner()); if (anOwner) myOriginalFeatures.insert(anOwner); anOwner = ModelAPI_Feature::feature(aEndPointAttr->attr()->owner()); @@ -65,8 +68,7 @@ void SketchSolver_ConstraintMultiTranslation::getAttributes( myOriginalFeatures.insert(anOwner); } -void SketchSolver_ConstraintMultiTranslation::process() -{ +void SketchSolver_ConstraintMultiTranslation::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -85,19 +87,18 @@ void SketchSolver_ConstraintMultiTranslation::process() myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateFeature::GROUP()); } -const std::string& SketchSolver_ConstraintMultiTranslation::nameNbObjects() -{ +const std::string &SketchSolver_ConstraintMultiTranslation::nameNbObjects() { return SketchPlugin_MultiTranslation::NUMBER_OF_OBJECTS_ID(); } -void SketchSolver_ConstraintMultiTranslation::updateLocal() -{ +void SketchSolver_ConstraintMultiTranslation::updateLocal() { DataPtr aData = myBaseConstraint->data(); - AttributePoint2DPtr aStartPointAttribute = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiTranslation::START_POINT_ID()); - AttributePoint2DPtr anEndPointAttribute = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiTranslation::END_POINT_ID()); - AttributeStringPtr aMethodTypeAttr = aData->string(SketchPlugin_MultiTranslation::VALUE_TYPE()); + AttributePoint2DPtr aStartPointAttribute = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiTranslation::START_POINT_ID()); + AttributePoint2DPtr anEndPointAttribute = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiTranslation::END_POINT_ID()); + AttributeStringPtr aMethodTypeAttr = + aData->string(SketchPlugin_MultiTranslation::VALUE_TYPE()); bool aFullValue = aMethodTypeAttr->value() != "SingleValue"; bool aStartPointChanged = aStartPointAttribute != myStartPointAttribute; @@ -115,30 +116,25 @@ void SketchSolver_ConstraintMultiTranslation::updateLocal() myAdjusted = false; } -void SketchSolver_ConstraintMultiTranslation::adjustConstraint() -{ +void SketchSolver_ConstraintMultiTranslation::adjustConstraint() { if (myAdjusted) return; // Obtain delta between start and end points of translation AttributeRefAttrPtr aStartEnd[2] = { - myBaseConstraint->refattr(SketchPlugin_MultiTranslation::START_POINT_ID()), - myBaseConstraint->refattr(SketchPlugin_MultiTranslation::END_POINT_ID()) - }; + myBaseConstraint->refattr( + SketchPlugin_MultiTranslation::START_POINT_ID()), + myBaseConstraint->refattr(SketchPlugin_MultiTranslation::END_POINT_ID())}; double aCoords[2][2]; - for (int i = 0; i < 2; ++i) - { + for (int i = 0; i < 2; ++i) { std::shared_ptr aPointWrapper = std::dynamic_pointer_cast( - myStorage->entity(AttributePtr(aStartEnd[i]))); - if (aPointWrapper) - { + myStorage->entity(AttributePtr(aStartEnd[i]))); + if (aPointWrapper) { GCSPointPtr aPnt = aPointWrapper->point(); aCoords[i][0] = *(aPnt->x); aCoords[i][1] = *(aPnt->y); - } - else - { + } else { AttributePoint2DPtr aPnt = std::dynamic_pointer_cast(aStartEnd[i]->attr()); aCoords[i][0] = aPnt->x(); @@ -157,24 +153,25 @@ void SketchSolver_ConstraintMultiTranslation::adjustConstraint() SketchSolver_ConstraintMulti::adjustConstraint(); } -void SketchSolver_ConstraintMultiTranslation::getRelative( - double theAbsX, double theAbsY, double& theRelX, double& theRelY) -{ +void SketchSolver_ConstraintMultiTranslation::getRelative(double theAbsX, + double theAbsY, + double &theRelX, + double &theRelY) { theRelX = theAbsX; theRelY = theAbsY; } -void SketchSolver_ConstraintMultiTranslation::getAbsolute( - double theRelX, double theRelY, double& theAbsX, double& theAbsY) -{ +void SketchSolver_ConstraintMultiTranslation::getAbsolute(double theRelX, + double theRelY, + double &theAbsX, + double &theAbsY) { theAbsX = theRelX; theAbsY = theRelY; } -void SketchSolver_ConstraintMultiTranslation::transformRelative(double& theX, double& theY) -{ +void SketchSolver_ConstraintMultiTranslation::transformRelative(double &theX, + double &theY) { // translate coordinates theX += myDelta[0]; theY += myDelta[1]; } - diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h index 891b56c73..a2541eba4 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h +++ b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintMultiTranslation_H_ @@ -28,27 +29,29 @@ * \ingroup Plugins * \brief Convert translated features to the list of SolveSpace constraints */ -class SketchSolver_ConstraintMultiTranslation : public SketchSolver_ConstraintMulti -{ +class SketchSolver_ConstraintMultiTranslation + : public SketchSolver_ConstraintMulti { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintMultiTranslation(ConstraintPtr theConstraint) : - SketchSolver_ConstraintMulti(theConstraint) - {} + SketchSolver_ConstraintMultiTranslation(ConstraintPtr theConstraint) + : SketchSolver_ConstraintMulti(theConstraint) {} protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints virtual void process(); /// \brief Generate list of translated entities /// \param[out] theStartPoint start point of translation /// \param[out] theEndPoint final point of translation - /// \param[out] theFullValue applying translation using the distance as a full or single value - /// \param[out] theEntities list of base entities - void getAttributes(EntityWrapperPtr& theStartPoint, EntityWrapperPtr& theEndPoint, - bool& theFullValue, std::list& theEntities); + /// \param[out] theFullValue applying translation using the distance as a + /// full or single value \param[out] theEntities list of base entities + void getAttributes(EntityWrapperPtr &theStartPoint, + EntityWrapperPtr &theEndPoint, bool &theFullValue, + std::list &theEntities); - /// \brief This method is used in derived objects to check consistence of constraint. + /// \brief This method is used in derived objects to check consistence of + /// constraint. virtual void adjustConstraint(); /// \brief Update parameters (called from base class) @@ -56,16 +59,17 @@ protected: private: /// \brief Convert absolute coordinates to relative coordinates - virtual void getRelative(double theAbsX, double theAbsY, - double& theRelX, double& theRelY); + virtual void getRelative(double theAbsX, double theAbsY, double &theRelX, + double &theRelY); /// \brief Convert relative coordinates to absolute coordinates - virtual void getAbsolute(double theRelX, double theRelY, - double& theAbsX, double& theAbsY); + virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX, + double &theAbsY); /// \brief Apply transformation for relative coordinates - virtual void transformRelative(double& theX, double& theY); + virtual void transformRelative(double &theX, double &theY); - /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature - virtual const std::string& nameNbObjects(); + /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding + /// feature + virtual const std::string &nameNbObjects(); private: AttributePoint2DPtr myStartPointAttribute; diff --git a/src/SketchSolver/SketchSolver_ConstraintOffset.cpp b/src/SketchSolver/SketchSolver_ConstraintOffset.cpp index 80f919acd..ee9c9a74e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintOffset.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintOffset.cpp @@ -14,26 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include - void SketchSolver_ConstraintOffset::getAttributes( - EntityWrapperPtr&, - std::vector&) -{ -} - -void SketchSolver_ConstraintOffset::process() -{ - cleanErrorMsg(); -} + EntityWrapperPtr &, std::vector &) {} +void SketchSolver_ConstraintOffset::process() { cleanErrorMsg(); } -void SketchSolver_ConstraintOffset::update() -{ +void SketchSolver_ConstraintOffset::update() { cleanErrorMsg(); remove(); process(); diff --git a/src/SketchSolver/SketchSolver_ConstraintOffset.h b/src/SketchSolver/SketchSolver_ConstraintOffset.h index 7c440267c..86f2d76a3 100644 --- a/src/SketchSolver/SketchSolver_ConstraintOffset.h +++ b/src/SketchSolver/SketchSolver_ConstraintOffset.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintOffset_H_ @@ -26,23 +27,23 @@ * \ingroup Plugins * \brief Convert offset to the solver's data model */ -class SketchSolver_ConstraintOffset : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintOffset : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintOffset(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint) - {} + SketchSolver_ConstraintOffset(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint) {} /// \brief Update constraint virtual void update(); protected: - /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + /// \brief Converts SketchPlugin constraint to a list of SolveSpace + /// constraints virtual void process(); /// \brief Generate list of entities of mirror constraint - virtual void getAttributes(EntityWrapperPtr&, std::vector&); + virtual void getAttributes(EntityWrapperPtr &, + std::vector &); }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp index 40ca6d3f1..6792cae0c 100644 --- a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -27,9 +28,9 @@ #include #include +#include #include #include -#include #include #include @@ -38,13 +39,14 @@ #include -#define GCS_EDGE_WRAPPER(x) std::dynamic_pointer_cast(x) -#define GCS_POINT_WRAPPER(x) std::dynamic_pointer_cast(x) +#define GCS_EDGE_WRAPPER(x) \ + std::dynamic_pointer_cast(x) +#define GCS_POINT_WRAPPER(x) \ + std::dynamic_pointer_cast(x) /// \brief Obtain constrained features -static void getFeatures(const ConstraintPtr& theConstraint, - FeaturePtr& theFeature1, - FeaturePtr& theFeature2); +static void getFeatures(const ConstraintPtr &theConstraint, + FeaturePtr &theFeature1, FeaturePtr &theFeature2); /// \brief Check whether the entities has only one shared point or less. /// Return list of coincident points. @@ -52,20 +54,20 @@ static std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeaturePtr theFeature2); /// \brief Collect points coincident with each of two features -static std::set coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2); +static std::set coincidentPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2); -static void calculateIntersectionPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurve2, - GCSPointPtr& theIntersectionPoint); +static void calculateIntersectionPoint(EntityWrapperPtr theCurve1, + EntityWrapperPtr theCurve2, + GCSPointPtr &theIntersectionPoint); /// sets angle to 90 or -90 degrees -static void adjustAngleBetweenCurves(const GCSCurvePtr& theCurve1, - const GCSCurvePtr& theCurve2, - const GCSPointPtr& thePoint, - double* theAngle); - +static void adjustAngleBetweenCurves(const GCSCurvePtr &theCurve1, + const GCSCurvePtr &theCurve2, + const GCSPointPtr &thePoint, + double *theAngle); -void SketchSolver_ConstraintPerpendicular::process() -{ +void SketchSolver_ConstraintPerpendicular::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -85,8 +87,7 @@ void SketchSolver_ConstraintPerpendicular::process() myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateCoincidence::GROUP()); } -void SketchSolver_ConstraintPerpendicular::rebuild() -{ +void SketchSolver_ConstraintPerpendicular::rebuild() { if (mySolverConstraint) myStorage->removeConstraint(myBaseConstraint); @@ -111,7 +112,8 @@ void SketchSolver_ConstraintPerpendicular::rebuild() continue; if ((*anEntIt)->type() == ENTITY_LINE) ++aNbLines; - else if ((*anEntIt)->type() == ENTITY_ARC || (*anEntIt)->type() == ENTITY_CIRCLE) + else if ((*anEntIt)->type() == ENTITY_ARC || + (*anEntIt)->type() == ENTITY_CIRCLE) ++aNbCircles; else if ((*anEntIt)->type() != ENTITY_POINT) ++aNbOther; @@ -120,8 +122,7 @@ void SketchSolver_ConstraintPerpendicular::rebuild() if (aNbLines + aNbCircles + aNbOther == 2) { if (aNbOther > 0) myType = CONSTRAINT_PERPENDICULAR_CURVES; - } - else { + } else { myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); return; } @@ -130,7 +131,8 @@ void SketchSolver_ConstraintPerpendicular::rebuild() getFeatures(myBaseConstraint, aFeature1, aFeature2); // check number of coincident points - std::set aCoincidentPoints = coincidentBoundaryPoints(aFeature1, aFeature2); + std::set aCoincidentPoints = + coincidentBoundaryPoints(aFeature1, aFeature2); // Try to find non-boundary points coincident with both features. // It is necesasry to create perpendicularity with ellipse if (aCoincidentPoints.empty() && aNbOther > 0) @@ -141,52 +143,56 @@ void SketchSolver_ConstraintPerpendicular::rebuild() if (!aCoincidentPoints.empty()) { mySharedPoint = *aCoincidentPoints.begin(); aSharedPointEntity = myStorage->entity(mySharedPoint); - } - else if (aNbOther > 0) { + } else if (aNbOther > 0) { // create auxiliary point GCSPointPtr aPoint(new GCS::Point); aPoint->x = aStorage->createParameter(); aPoint->y = aStorage->createParameter(); - calculateIntersectionPoint(myAttributes.front(), myAttributes.back(), aPoint); + calculateIntersectionPoint(myAttributes.front(), myAttributes.back(), + aPoint); myAuxPoint.reset(new PlaneGCSSolver_PointWrapper(aPoint)); aSharedPointEntity = myAuxPoint; // create auxiliary coincident constraints for tangency with ellipse EntityWrapperPtr aDummy; - ConstraintWrapperPtr aCoincidence = PlaneGCSSolver_Tools::createConstraint(ConstraintPtr(), - CONSTRAINT_PT_ON_CURVE, aDummy, aSharedPointEntity, aDummy, myAttributes.front(), aDummy); + ConstraintWrapperPtr aCoincidence = PlaneGCSSolver_Tools::createConstraint( + ConstraintPtr(), CONSTRAINT_PT_ON_CURVE, aDummy, aSharedPointEntity, + aDummy, myAttributes.front(), aDummy); anAuxConstraints = aCoincidence->constraints(); - aCoincidence = PlaneGCSSolver_Tools::createConstraint(ConstraintPtr(), - CONSTRAINT_PT_ON_CURVE, aDummy, aSharedPointEntity, aDummy, myAttributes.back(), aDummy); + aCoincidence = PlaneGCSSolver_Tools::createConstraint( + ConstraintPtr(), CONSTRAINT_PT_ON_CURVE, aDummy, aSharedPointEntity, + aDummy, myAttributes.back(), aDummy); anAuxConstraints.insert(anAuxConstraints.end(), - aCoincidence->constraints().begin(), aCoincidence->constraints().end()); + aCoincidence->constraints().begin(), + aCoincidence->constraints().end()); } ScalarWrapperPtr anAngleWrapper; if (aSharedPointEntity) { adjustAngleBetweenCurves(GCS_EDGE_WRAPPER(myAttributes.front())->entity(), GCS_EDGE_WRAPPER(myAttributes.back())->entity(), - GCS_POINT_WRAPPER(aSharedPointEntity)->point(), &myCurveCurveAngle); + GCS_POINT_WRAPPER(aSharedPointEntity)->point(), + &myCurveCurveAngle); anAngleWrapper.reset(new PlaneGCSSolver_ScalarWrapper(&myCurveCurveAngle)); } - mySolverConstraint = PlaneGCSSolver_Tools::createConstraint(myBaseConstraint, myType, - anAngleWrapper, aSharedPointEntity, EntityWrapperPtr(), - myAttributes.front(), myAttributes.back()); + mySolverConstraint = PlaneGCSSolver_Tools::createConstraint( + myBaseConstraint, myType, anAngleWrapper, aSharedPointEntity, + EntityWrapperPtr(), myAttributes.front(), myAttributes.back()); if (!anAuxConstraints.empty()) { - anAuxConstraints.insert(anAuxConstraints.end(), mySolverConstraint->constraints().begin(), - mySolverConstraint->constraints().end()); + anAuxConstraints.insert(anAuxConstraints.end(), + mySolverConstraint->constraints().begin(), + mySolverConstraint->constraints().end()); mySolverConstraint->setConstraints(anAuxConstraints); } myStorage->addConstraint(myBaseConstraint, mySolverConstraint); } -void SketchSolver_ConstraintPerpendicular::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater) -{ +void SketchSolver_ConstraintPerpendicular::notify( + const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) { if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID()) return; @@ -201,10 +207,12 @@ void SketchSolver_ConstraintPerpendicular::notify(const FeaturePtr& theFeat if (theFeature->data() && theFeature->data()->isValid()) { // the constraint has been created if (!mySharedPoint) { - // features has no shared point, check whether coincidence constraint binds these features) + // features has no shared point, check whether coincidence constraint + // binds these features) int aNbCoincidentFeatures = 0; for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = theFeature->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + theFeature->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr) continue; @@ -226,18 +234,20 @@ void SketchSolver_ConstraintPerpendicular::notify(const FeaturePtr& theFeat if (!isRebuild) { if (mySharedPoint) { - // The features are tangent in the shared point, but the coincidence has been removed/updated. - // Check if the coincidence is the same. - std::set aCoincidentPoints = coincidentBoundaryPoints(aTgFeat1, aTgFeat2); + // The features are tangent in the shared point, but the coincidence has + // been removed/updated. Check if the coincidence is the same. + std::set aCoincidentPoints = + coincidentBoundaryPoints(aTgFeat1, aTgFeat2); isRebuild = true; std::set::iterator anIt = aCoincidentPoints.begin(); for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt) if (*anIt == mySharedPoint) - isRebuild = false; // the coincidence is still exists => nothing to change - } - else { + isRebuild = + false; // the coincidence is still exists => nothing to change + } else { // check both features have a coincident point - std::set aCoincidentPoints = coincidentPoints(aTgFeat1, aTgFeat2); + std::set aCoincidentPoints = + coincidentPoints(aTgFeat1, aTgFeat2); isRebuild = (bool)(myAuxPoint.get()) == (!aCoincidentPoints.empty()); } } @@ -246,24 +256,20 @@ void SketchSolver_ConstraintPerpendicular::notify(const FeaturePtr& theFeat rebuild(); } - - - // ================== Auxiliary functions ================================= -void getFeatures(const ConstraintPtr& theConstraint, - FeaturePtr& theFeature1, - FeaturePtr& theFeature2) -{ - AttributeRefAttrPtr aRefAttr = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); +void getFeatures(const ConstraintPtr &theConstraint, FeaturePtr &theFeature1, + FeaturePtr &theFeature2) { + AttributeRefAttrPtr aRefAttr = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); theFeature1 = ModelAPI_Feature::feature(aRefAttr->object()); aRefAttr = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); theFeature2 = ModelAPI_Feature::feature(aRefAttr->object()); } -static std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theFeature2) -{ - const std::set& aRefs1 = theFeature1->data()->refsToMe(); - const std::set& aRefs2 = theFeature2->data()->refsToMe(); +static std::set collectCoincidences(FeaturePtr theFeature1, + FeaturePtr theFeature2) { + const std::set &aRefs1 = theFeature1->data()->refsToMe(); + const std::set &aRefs2 = theFeature2->data()->refsToMe(); std::set aCoincidences; std::set::const_iterator anIt; @@ -286,17 +292,20 @@ static std::set collectCoincidences(FeaturePtr theFeature1, FeatureP return aCoincidencesBetweenFeatures; } -std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeaturePtr theFeature2) -{ - std::set aCoincidences = collectCoincidences(theFeature1, theFeature2); +std::set coincidentBoundaryPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2) { + std::set aCoincidences = + collectCoincidences(theFeature1, theFeature2); // collect points only std::set aCoincidentPoints; std::set::const_iterator aCIt = aCoincidences.begin(); - for (; aCIt != aCoincidences.end(); ++ aCIt) { - AttributeRefAttrPtr aRefAttrA = (*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_A()); - AttributeRefAttrPtr aRefAttrB = (*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_B()); - if (!aRefAttrA || aRefAttrA->isObject() || - !aRefAttrB || aRefAttrB->isObject()) + for (; aCIt != aCoincidences.end(); ++aCIt) { + AttributeRefAttrPtr aRefAttrA = + (*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrB = + (*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_B()); + if (!aRefAttrA || aRefAttrA->isObject() || !aRefAttrB || + aRefAttrB->isObject()) continue; AttributePtr anAttrA = aRefAttrA->attr(); @@ -312,34 +321,34 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeatureP return aCoincidentPoints; } -static std::set refsToFeatureAndResults(FeaturePtr theFeature) -{ +static std::set refsToFeatureAndResults(FeaturePtr theFeature) { std::set aRefs = theFeature->data()->refsToMe(); - const std::list& aResults = theFeature->results(); + const std::list &aResults = theFeature->results(); for (std::list::const_iterator anIt = aResults.begin(); - anIt != aResults.end(); ++anIt) { - const std::set& aResRefs = (*anIt)->data()->refsToMe(); + anIt != aResults.end(); ++anIt) { + const std::set &aResRefs = (*anIt)->data()->refsToMe(); aRefs.insert(aResRefs.begin(), aResRefs.end()); } return aRefs; } // collect all points coincident with the feature -static std::set pointsOnFeature(FeaturePtr theFeature) -{ +static std::set pointsOnFeature(FeaturePtr theFeature) { std::set aPoints; std::set aRefs = refsToFeatureAndResults(theFeature); - for (std::set::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) { + for (std::set::const_iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) { FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner()); if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || aRef->getKind() == SketchPlugin_ConstraintMiddle::ID())) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr) { AttributePtr anAttr = aRefAttr->attr(); if (anAttr && anAttr->id() != SketchPlugin_Arc::CENTER_ID() && - anAttr->id() != SketchPlugin_Circle::CENTER_ID()) + anAttr->id() != SketchPlugin_Circle::CENTER_ID()) aPoints.insert(anAttr); } } @@ -348,8 +357,8 @@ static std::set pointsOnFeature(FeaturePtr theFeature) return aPoints; } -std::set coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2) -{ +std::set coincidentPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2) { std::set aPointsOnF1 = pointsOnFeature(theFeature1); std::set aPointsOnF2 = pointsOnFeature(theFeature2); @@ -361,15 +370,16 @@ std::set coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFe return aCommonPoints; } -void adjustAngleBetweenCurves(const GCSCurvePtr& theCurve1, - const GCSCurvePtr& theCurve2, - const GCSPointPtr& thePoint, - double* theAngle) -{ - double anAngle = GCS::System().calculateAngleViaPoint(*theCurve1, *theCurve2, *thePoint); +void adjustAngleBetweenCurves(const GCSCurvePtr &theCurve1, + const GCSCurvePtr &theCurve2, + const GCSPointPtr &thePoint, double *theAngle) { + double anAngle = + GCS::System().calculateAngleViaPoint(*theCurve1, *theCurve2, *thePoint); // bring angle to [-pi..pi] - if (anAngle > PI) anAngle -= 2.0 * PI; - if (anAngle < -PI) anAngle += 2.0 * PI; + if (anAngle > PI) + anAngle -= 2.0 * PI; + if (anAngle < -PI) + anAngle += 2.0 * PI; // set angle value according to the current angle between curves if (anAngle >= 0) *theAngle = PI / 2.; @@ -377,10 +387,11 @@ void adjustAngleBetweenCurves(const GCSCurvePtr& theCurve1, *theAngle = -PI / 2.; } -void calculateIntersectionPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurve2, - GCSPointPtr& theIntersectionPoint) -{ - std::shared_ptr anEllipse = PlaneGCSSolver_Tools::ellipse(theCurve1); +void calculateIntersectionPoint(EntityWrapperPtr theCurve1, + EntityWrapperPtr theCurve2, + GCSPointPtr &theIntersectionPoint) { + std::shared_ptr anEllipse = + PlaneGCSSolver_Tools::ellipse(theCurve1); EntityWrapperPtr aCurve2 = theCurve2; if (!anEllipse) { // try converting to ellipse the second curve @@ -394,13 +405,15 @@ void calculateIntersectionPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr the if (aCurve2->type() == ENTITY_LINE) { std::shared_ptr aLine = PlaneGCSSolver_Tools::line(aCurve2); anEllipse->distance(aLine, aP1, aP2); - } - else if (aCurve2->type() == ENTITY_ARC || aCurve2->type() == ENTITY_CIRCLE) { - std::shared_ptr aCircle = PlaneGCSSolver_Tools::circle(aCurve2); + } else if (aCurve2->type() == ENTITY_ARC || + aCurve2->type() == ENTITY_CIRCLE) { + std::shared_ptr aCircle = + PlaneGCSSolver_Tools::circle(aCurve2); anEllipse->distance(aCircle, aP1, aP2); - } - else if (aCurve2->type() == ENTITY_ELLIPSE || aCurve2->type() == ENTITY_ELLIPTIC_ARC) { - std::shared_ptr anEl2 = PlaneGCSSolver_Tools::ellipse(aCurve2); + } else if (aCurve2->type() == ENTITY_ELLIPSE || + aCurve2->type() == ENTITY_ELLIPTIC_ARC) { + std::shared_ptr anEl2 = + PlaneGCSSolver_Tools::ellipse(aCurve2); anEllipse->distance(anEl2, aP1, aP2); } diff --git a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h index b6d280e9d..43584b554 100644 --- a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h +++ b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintPerpendicular_H_ @@ -26,18 +27,15 @@ * \ingroup Plugins * \brief Convert perpendicularity constraint to SolveSpace structure */ -class SketchSolver_ConstraintPerpendicular : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintPerpendicular : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintPerpendicular(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint), - myCurveCurveAngle(0.0) - {} + SketchSolver_ConstraintPerpendicular(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint), myCurveCurveAngle(0.0) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater); + virtual void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater); protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp index 22516bff3..39cecf9ac 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -27,9 +28,9 @@ #include #include +#include #include #include -#include #include @@ -44,15 +45,17 @@ #include -#define GCS_EDGE_WRAPPER(x) std::dynamic_pointer_cast(x) +#define GCS_EDGE_WRAPPER(x) \ + std::dynamic_pointer_cast(x) /// \brief Obtain tangent features from the constraint -static void getTangentFeatures(const ConstraintPtr& theConstraint, - FeaturePtr& theFeature1, - FeaturePtr& theFeature2); +static void getTangentFeatures(const ConstraintPtr &theConstraint, + FeaturePtr &theFeature1, + FeaturePtr &theFeature2); /// \brief Obtain all coincident constraints between features -static std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theFeature2); +static std::set collectCoincidences(FeaturePtr theFeature1, + FeaturePtr theFeature2); /// \brief Check whether the entities has only one shared point or less. /// Return list of coincident points. @@ -60,7 +63,8 @@ static std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeaturePtr theFeature2); /// \brief Collect points coincident with each of two features -static std::set coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2); +static std::set coincidentPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2); /// \brief Check if two connected arcs have centers /// in same direction relatively to connection point @@ -68,24 +72,21 @@ static bool isArcArcTangencyInternal(EntityWrapperPtr theArc1, EntityWrapperPtr theArc2); static ConstraintWrapperPtr - createArcLineTangency(EntityWrapperPtr theEntity1, - EntityWrapperPtr theEntity2, - EntityWrapperPtr theShapedPoint = EntityWrapperPtr(), - double* theAngle = 0); +createArcLineTangency(EntityWrapperPtr theEntity1, EntityWrapperPtr theEntity2, + EntityWrapperPtr theShapedPoint = EntityWrapperPtr(), + double *theAngle = 0); static ConstraintWrapperPtr - createCurveCurveTangency(EntityWrapperPtr theEntity1, - EntityWrapperPtr theEntity2, - bool theInternalTangency, - EntityWrapperPtr theSharedPoint = EntityWrapperPtr(), - double* theAngle = 0); - -static void calculateTangencyPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurve2, - GCSPointPtr& theTangencyPoint); +createCurveCurveTangency(EntityWrapperPtr theEntity1, + EntityWrapperPtr theEntity2, bool theInternalTangency, + EntityWrapperPtr theSharedPoint = EntityWrapperPtr(), + double *theAngle = 0); +static void calculateTangencyPoint(EntityWrapperPtr theCurve1, + EntityWrapperPtr theCurve2, + GCSPointPtr &theTangencyPoint); -void SketchSolver_ConstraintTangent::process() -{ +void SketchSolver_ConstraintTangent::process() { cleanErrorMsg(); if (!myBaseConstraint || !myStorage) { // Not enough parameters are assigned @@ -105,8 +106,7 @@ void SketchSolver_ConstraintTangent::process() myStorage->subscribeUpdates(this, PlaneGCSSolver_UpdateCoincidence::GROUP()); } -void SketchSolver_ConstraintTangent::rebuild() -{ +void SketchSolver_ConstraintTangent::rebuild() { if (mySolverConstraint) myStorage->removeConstraint(myBaseConstraint); @@ -137,9 +137,11 @@ void SketchSolver_ConstraintTangent::rebuild() continue; if ((*anEntIt)->type() == ENTITY_LINE) ++aNbLines; - else if ((*anEntIt)->type() == ENTITY_ARC || (*anEntIt)->type() == ENTITY_CIRCLE) + else if ((*anEntIt)->type() == ENTITY_ARC || + (*anEntIt)->type() == ENTITY_CIRCLE) ++aNbCircles; - else if ((*anEntIt)->type() == ENTITY_ELLIPSE || (*anEntIt)->type() == ENTITY_ELLIPTIC_ARC) + else if ((*anEntIt)->type() == ENTITY_ELLIPSE || + (*anEntIt)->type() == ENTITY_ELLIPTIC_ARC) ++aNbEllipses; else if ((*anEntIt)->type() == ENTITY_BSPLINE) ++aNbSplines; @@ -151,12 +153,11 @@ void SketchSolver_ConstraintTangent::rebuild() } if (aNbLines == 1 && aNbCircles == 1) { myType = CONSTRAINT_TANGENT_CIRCLE_LINE; - } - else if (aNbLines + aNbCircles + aNbEllipses + aNbSplines == 2) { + } else if (aNbLines + aNbCircles + aNbEllipses + aNbSplines == 2) { myType = CONSTRAINT_TANGENT_CURVE_CURVE; - isArcArcInternal = isArcArcTangencyInternal(myAttributes.front(), myAttributes.back()); - } - else { + isArcArcInternal = + isArcArcTangencyInternal(myAttributes.front(), myAttributes.back()); + } else { myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); return; } @@ -165,27 +166,30 @@ void SketchSolver_ConstraintTangent::rebuild() getTangentFeatures(myBaseConstraint, aFeatures[0], aFeatures[1]); // check number of coincident points - std::set aCoincidentPoints = coincidentBoundaryPoints(aFeatures[0], aFeatures[1]); - if (myType == CONSTRAINT_TANGENT_CIRCLE_LINE && aCoincidentPoints.size() > 2) { + std::set aCoincidentPoints = + coincidentBoundaryPoints(aFeatures[0], aFeatures[1]); + if (myType == CONSTRAINT_TANGENT_CIRCLE_LINE && + aCoincidentPoints.size() > 2) { myErrorMsg = SketchSolver_Error::TANGENCY_FAILED(); return; } - EntityWrapperPtr aTgEntities[2] = { myAttributes.front(), myAttributes.back() }; + EntityWrapperPtr aTgEntities[2] = {myAttributes.front(), myAttributes.back()}; if (aCoincidentPoints.empty()) { // Try to find non-boundary points coincident with both features. // It is necesasry to create tangency with ellipse. if (aNbEllipses > 0) aCoincidentPoints = coincidentPoints(aFeatures[0], aFeatures[1]); - } - else if (aNbSplines > 0) { - // General approach applying tangency to B-spline leads to hang-up in PlaneGCS. - // So, the tangency will be applied for the construction segment instead of B-spline curve. + } else if (aNbSplines > 0) { + // General approach applying tangency to B-spline leads to hang-up in + // PlaneGCS. So, the tangency will be applied for the construction segment + // instead of B-spline curve. for (int i = 0; i < 2; ++i) { if (aTgEntities[i]->type() == ENTITY_BSPLINE) { EdgeWrapperPtr anEdge = - std::dynamic_pointer_cast(aTgEntities[i]); + std::dynamic_pointer_cast( + aTgEntities[i]); std::shared_ptr aBSpline = std::dynamic_pointer_cast(anEdge->entity()); @@ -197,8 +201,7 @@ void SketchSolver_ConstraintTangent::rebuild() if ((*aPIt)->id() == SketchPlugin_BSpline::START_ID()) { aPoint1 = aBSpline->poles[0]; aPoint2 = aBSpline->poles[1]; - } - else if ((*aPIt)->id() == SketchPlugin_BSpline::END_ID()) { + } else if ((*aPIt)->id() == SketchPlugin_BSpline::END_ID()) { aPoint1 = aBSpline->poles[aBSpline->poles.size() - 2]; aPoint2 = aBSpline->poles[aBSpline->poles.size() - 1]; } @@ -210,7 +213,8 @@ void SketchSolver_ConstraintTangent::rebuild() std::shared_ptr aSegment(new GCS::Line); aSegment->p1 = aPoint1; aSegment->p2 = aPoint2; - aTgEntities[i] = EdgeWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aSegment)); + aTgEntities[i] = + EdgeWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aSegment)); --aNbSplines; ++aNbLines; } @@ -222,8 +226,7 @@ void SketchSolver_ConstraintTangent::rebuild() if (!aCoincidentPoints.empty()) { mySharedPoint = *aCoincidentPoints.begin(); aSharedPointEntity = myStorage->entity(mySharedPoint); - } - else if (aNbEllipses + aNbSplines > 0) { + } else if (aNbEllipses + aNbSplines > 0) { // create auxiliary point GCSPointPtr aPoint(new GCS::Point); aPoint->x = aStorage->createParameter(); @@ -237,50 +240,53 @@ void SketchSolver_ConstraintTangent::rebuild() for (int i = 0; i < 2; ++i) { // create auxiliary parameters for coincidence with B-spline if (aTgEntities[i]->type() == ENTITY_BSPLINE) - myAuxParameters[i].reset(new PlaneGCSSolver_ScalarWrapper(aStorage->createParameter())); + myAuxParameters[i].reset( + new PlaneGCSSolver_ScalarWrapper(aStorage->createParameter())); // create auxiliary coincident constraints for tangency with ellipse - ConstraintWrapperPtr aCoincidence = PlaneGCSSolver_Tools::createConstraint(ConstraintPtr(), - CONSTRAINT_PT_ON_CURVE, myAuxParameters[i], - aSharedPointEntity, aDummy, aTgEntities[i], aDummy); + ConstraintWrapperPtr aCoincidence = + PlaneGCSSolver_Tools::createConstraint( + ConstraintPtr(), CONSTRAINT_PT_ON_CURVE, myAuxParameters[i], + aSharedPointEntity, aDummy, aTgEntities[i], aDummy); anAuxConstraints.insert(anAuxConstraints.end(), - aCoincidence->constraints().begin(), aCoincidence->constraints().end()); + aCoincidence->constraints().begin(), + aCoincidence->constraints().end()); } } if (myType == CONSTRAINT_TANGENT_CIRCLE_LINE) { - mySolverConstraint = createArcLineTangency(aTgEntities[0], aTgEntities[1], - aSharedPointEntity, &myCurveCurveAngle); + mySolverConstraint = createArcLineTangency( + aTgEntities[0], aTgEntities[1], aSharedPointEntity, &myCurveCurveAngle); } else { - mySolverConstraint = createCurveCurveTangency(aTgEntities[0], aTgEntities[1], - isArcArcInternal, aSharedPointEntity, &myCurveCurveAngle); + mySolverConstraint = createCurveCurveTangency( + aTgEntities[0], aTgEntities[1], isArcArcInternal, aSharedPointEntity, + &myCurveCurveAngle); } if (!anAuxConstraints.empty()) { - anAuxConstraints.insert(anAuxConstraints.end(), mySolverConstraint->constraints().begin(), - mySolverConstraint->constraints().end()); + anAuxConstraints.insert(anAuxConstraints.end(), + mySolverConstraint->constraints().begin(), + mySolverConstraint->constraints().end()); mySolverConstraint->setConstraints(anAuxConstraints); } myStorage->addConstraint(myBaseConstraint, mySolverConstraint); } -void SketchSolver_ConstraintTangent::adjustConstraint() -{ +void SketchSolver_ConstraintTangent::adjustConstraint() { if (myType == CONSTRAINT_TANGENT_CURVE_CURVE) { - EntityWrapperPtr anEntity1 = - myStorage->entity(myBaseConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); - EntityWrapperPtr anEntity2 = - myStorage->entity(myBaseConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); + EntityWrapperPtr anEntity1 = myStorage->entity( + myBaseConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); + EntityWrapperPtr anEntity2 = myStorage->entity( + myBaseConstraint->attribute(SketchPlugin_Constraint::ENTITY_B())); if (isArcArcInternal != isArcArcTangencyInternal(anEntity1, anEntity2)) rebuild(); } } -void SketchSolver_ConstraintTangent::notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater) -{ +void SketchSolver_ConstraintTangent::notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) { if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID()) return; @@ -295,10 +301,12 @@ void SketchSolver_ConstraintTangent::notify(const FeaturePtr& theFeature, if (theFeature->data() && theFeature->data()->isValid()) { // the constraint has been created if (!mySharedPoint) { - // features has no shared point, check whether coincidence constraint binds these features) + // features has no shared point, check whether coincidence constraint + // binds these features) int aNbCoincidentFeatures = 0; for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = theFeature->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + theFeature->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr) continue; @@ -320,18 +328,20 @@ void SketchSolver_ConstraintTangent::notify(const FeaturePtr& theFeature, if (!isRebuild) { if (mySharedPoint) { - // The features are tangent in the shared point, but the coincidence has been removed/updated. - // Check if the coincidence is the same. - std::set aCoincidentPoints = coincidentBoundaryPoints(aTgFeat1, aTgFeat2); + // The features are tangent in the shared point, but the coincidence has + // been removed/updated. Check if the coincidence is the same. + std::set aCoincidentPoints = + coincidentBoundaryPoints(aTgFeat1, aTgFeat2); isRebuild = true; std::set::iterator anIt = aCoincidentPoints.begin(); for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt) if (*anIt == mySharedPoint) - isRebuild = false; // the coincidence is still exists => nothing to change - } - else { + isRebuild = + false; // the coincidence is still exists => nothing to change + } else { // check both features have a coincident point - std::set aCoincidentPoints = coincidentPoints(aTgFeat1, aTgFeat2); + std::set aCoincidentPoints = + coincidentPoints(aTgFeat1, aTgFeat2); isRebuild = (bool)(myAuxPoint.get()) == (!aCoincidentPoints.empty()); } } @@ -340,8 +350,7 @@ void SketchSolver_ConstraintTangent::notify(const FeaturePtr& theFeature, rebuild(); } -bool SketchSolver_ConstraintTangent::remove() -{ +bool SketchSolver_ConstraintTangent::remove() { if (myAuxPoint) { std::shared_ptr aStorage = std::dynamic_pointer_cast(myStorage); @@ -358,24 +367,20 @@ bool SketchSolver_ConstraintTangent::remove() return SketchSolver_Constraint::remove(); } - - - // ================== Auxiliary functions ================================= -void getTangentFeatures(const ConstraintPtr& theConstraint, - FeaturePtr& theFeature1, - FeaturePtr& theFeature2) -{ - AttributeRefAttrPtr aRefAttr = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); +void getTangentFeatures(const ConstraintPtr &theConstraint, + FeaturePtr &theFeature1, FeaturePtr &theFeature2) { + AttributeRefAttrPtr aRefAttr = + theConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); theFeature1 = ModelAPI_Feature::feature(aRefAttr->object()); aRefAttr = theConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); theFeature2 = ModelAPI_Feature::feature(aRefAttr->object()); } -std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theFeature2) -{ - const std::set& aRefs1 = theFeature1->data()->refsToMe(); - const std::set& aRefs2 = theFeature2->data()->refsToMe(); +std::set collectCoincidences(FeaturePtr theFeature1, + FeaturePtr theFeature2) { + const std::set &aRefs1 = theFeature1->data()->refsToMe(); + const std::set &aRefs2 = theFeature2->data()->refsToMe(); std::set aCoincidences; std::map aCoincidentPoints; @@ -384,13 +389,16 @@ std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theF // collect coincidences referred to the first feature for (anIt = aRefs1.begin(); anIt != aRefs1.end(); ++anIt) { FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner()); - if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || - aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID())) { + if (aRef && + (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || + aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID())) { aCoincidences.insert(aRef); - AttributeRefAttrPtr aRefAttrA = aRef->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aRefAttrA = + aRef->refattr(SketchPlugin_Constraint::ENTITY_A()); if (!aRefAttrA->isObject()) aCoincidentPoints[aRefAttrA->attr()] = aRef; - AttributeRefAttrPtr aRefAttrB = aRef->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr aRefAttrB = + aRef->refattr(SketchPlugin_Constraint::ENTITY_B()); if (!aRefAttrB->isObject()) aCoincidentPoints[aRefAttrB->attr()] = aRef; } @@ -402,10 +410,13 @@ std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theF FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner()); if (aCoincidences.find(aRef) != aCoincidences.end()) aCoincidencesBetweenFeatures.insert(aRef); - else if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || - aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID())) { + else if (aRef && + (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || + aRef->getKind() == + SketchPlugin_ConstraintCoincidenceInternal::ID())) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr && !aRefAttr->isObject()) { std::map::iterator aFound = aCoincidentPoints.find(aRefAttr->attr()); @@ -421,15 +432,17 @@ std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theF return aCoincidencesBetweenFeatures; } -std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeaturePtr theFeature2) -{ - std::set aCoincidences = collectCoincidences(theFeature1, theFeature2); +std::set coincidentBoundaryPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2) { + std::set aCoincidences = + collectCoincidences(theFeature1, theFeature2); // collect points only - std::map > aCoincidentPoints; + std::map> aCoincidentPoints; std::set::const_iterator aCIt = aCoincidences.begin(); - for (; aCIt != aCoincidences.end(); ++ aCIt) { + for (; aCIt != aCoincidences.end(); ++aCIt) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (!aRefAttr || aRefAttr->isObject()) continue; @@ -442,9 +455,11 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeatureP AttributeIntegerPtr anIndex; if (anOwner->getKind() == SketchPlugin_BSpline::ID()) { - anIndex = (*aCIt)->integer(i == 0 ? - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A() : - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + anIndex = (*aCIt)->integer( + i == 0 ? SketchPlugin_ConstraintCoincidenceInternal:: + INDEX_ENTITY_A() + : SketchPlugin_ConstraintCoincidenceInternal:: + INDEX_ENTITY_B()); } if (anIndex) { if (anIndex->value() == 0) @@ -454,9 +469,8 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeatureP if (anAttr) aCoincidentPoints[anOwner].insert(anAttr); } - } - else if (anAttr->id() != SketchPlugin_Arc::CENTER_ID() && - anAttr->id() != SketchPlugin_Circle::CENTER_ID()) + } else if (anAttr->id() != SketchPlugin_Arc::CENTER_ID() && + anAttr->id() != SketchPlugin_Circle::CENTER_ID()) aCoincidentPoints[anOwner].insert(anAttr); } } @@ -464,42 +478,44 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeatureP std::set aBoundaryPoints; if (aCoincidentPoints.size() == 2) { - for (std::map >::iterator anIt = aCoincidentPoints.begin(); + for (std::map>::iterator anIt = + aCoincidentPoints.begin(); anIt != aCoincidentPoints.end(); ++anIt) aBoundaryPoints.insert(anIt->second.begin(), anIt->second.end()); } return aBoundaryPoints; } -static std::set refsToFeatureAndResults(FeaturePtr theFeature) -{ +static std::set refsToFeatureAndResults(FeaturePtr theFeature) { std::set aRefs = theFeature->data()->refsToMe(); - const std::list& aResults = theFeature->results(); + const std::list &aResults = theFeature->results(); for (std::list::const_iterator anIt = aResults.begin(); - anIt != aResults.end(); ++anIt) { - const std::set& aResRefs = (*anIt)->data()->refsToMe(); + anIt != aResults.end(); ++anIt) { + const std::set &aResRefs = (*anIt)->data()->refsToMe(); aRefs.insert(aResRefs.begin(), aResRefs.end()); } return aRefs; } // collect all points coincident with the feature -static std::set pointsOnFeature(FeaturePtr theFeature) -{ +static std::set pointsOnFeature(FeaturePtr theFeature) { std::set aPoints; std::set aRefs = refsToFeatureAndResults(theFeature); - for (std::set::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt) { + for (std::set::const_iterator anIt = aRefs.begin(); + anIt != aRefs.end(); ++anIt) { FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner()); - if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || - aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID() || - aRef->getKind() == SketchPlugin_ConstraintMiddle::ID())) { + if (aRef && + (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || + aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID() || + aRef->getKind() == SketchPlugin_ConstraintMiddle::ID())) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); + AttributeRefAttrPtr aRefAttr = + aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr) { AttributePtr anAttr = aRefAttr->attr(); if (anAttr && anAttr->id() != SketchPlugin_Arc::CENTER_ID() && - anAttr->id() != SketchPlugin_Circle::CENTER_ID()) + anAttr->id() != SketchPlugin_Circle::CENTER_ID()) aPoints.insert(anAttr); } } @@ -508,8 +524,8 @@ static std::set pointsOnFeature(FeaturePtr theFeature) return aPoints; } -std::set coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2) -{ +std::set coincidentPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2) { std::set aPointsOnF1 = pointsOnFeature(theFeature1); std::set aPointsOnF2 = pointsOnFeature(theFeature2); @@ -521,8 +537,8 @@ std::set coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFe return aCommonPoints; } -bool isArcArcTangencyInternal(EntityWrapperPtr theArc1, EntityWrapperPtr theArc2) -{ +bool isArcArcTangencyInternal(EntityWrapperPtr theArc1, + EntityWrapperPtr theArc2) { std::shared_ptr aCirc1 = std::dynamic_pointer_cast( GCS_EDGE_WRAPPER(theArc1)->entity()); std::shared_ptr aCirc2 = std::dynamic_pointer_cast( @@ -539,15 +555,17 @@ bool isArcArcTangencyInternal(EntityWrapperPtr theArc1, EntityWrapperPtr theArc2 } // sets angle to 0 or 180 degrees -static void adjustAngleBetweenCurves(const GCSCurvePtr& theCurve1, - const GCSCurvePtr& theCurve2, - const GCSPointPtr& thePoint, - double* theAngle) -{ - double anAngle = GCS::System().calculateAngleViaPoint(*theCurve1, *theCurve2, *thePoint); +static void adjustAngleBetweenCurves(const GCSCurvePtr &theCurve1, + const GCSCurvePtr &theCurve2, + const GCSPointPtr &thePoint, + double *theAngle) { + double anAngle = + GCS::System().calculateAngleViaPoint(*theCurve1, *theCurve2, *thePoint); // bring angle to [-pi..pi] - if (anAngle > PI) anAngle -= 2.0 * PI; - if (anAngle < -PI) anAngle += 2.0 * PI; + if (anAngle > PI) + anAngle -= 2.0 * PI; + if (anAngle < -PI) + anAngle += 2.0 * PI; // set angle value according to the current angle between curves if (fabs(anAngle) <= PI / 2.) *theAngle = 0.0; @@ -555,12 +573,10 @@ static void adjustAngleBetweenCurves(const GCSCurvePtr& theCurve1, *theAngle = PI; } - ConstraintWrapperPtr createArcLineTangency(EntityWrapperPtr theEntity1, EntityWrapperPtr theEntity2, EntityWrapperPtr theSharedPoint, - double* theAngle) -{ + double *theAngle) { EdgeWrapperPtr anEntLine, anEntCirc; if (theEntity1->type() == ENTITY_LINE) { anEntLine = GCS_EDGE_WRAPPER(theEntity1); @@ -578,56 +594,62 @@ ConstraintWrapperPtr createArcLineTangency(EntityWrapperPtr theEntity1, std::dynamic_pointer_cast(anEntLine->entity()); GCSConstraintPtr aNewConstr; - if (theSharedPoint && anArc) { // do not process shared point between circle and line + if (theSharedPoint && + anArc) { // do not process shared point between circle and line GCSPointPtr aPoint = - std::dynamic_pointer_cast(theSharedPoint)->point(); + std::dynamic_pointer_cast(theSharedPoint) + ->point(); adjustAngleBetweenCurves(anArc, aLine, aPoint, theAngle); - aNewConstr = - GCSConstraintPtr(new GCS::ConstraintAngleViaPoint(*anArc, *aLine, *aPoint, theAngle)); + aNewConstr = GCSConstraintPtr( + new GCS::ConstraintAngleViaPoint(*anArc, *aLine, *aPoint, theAngle)); } else { - aNewConstr = - GCSConstraintPtr(new GCS::ConstraintP2LDistance(aCirc->center, *aLine, aCirc->rad)); + aNewConstr = GCSConstraintPtr( + new GCS::ConstraintP2LDistance(aCirc->center, *aLine, aCirc->rad)); } - return ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_TANGENT_CIRCLE_LINE)); + return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aNewConstr, CONSTRAINT_TANGENT_CIRCLE_LINE)); } ConstraintWrapperPtr createCurveCurveTangency(EntityWrapperPtr theEntity1, EntityWrapperPtr theEntity2, - bool theInternalTangency, + bool theInternalTangency, EntityWrapperPtr theSharedPoint, - double* theAngle) -{ - GCSCurvePtr aCurve1 = - std::dynamic_pointer_cast(GCS_EDGE_WRAPPER(theEntity1)->entity()); - GCSCurvePtr aCurve2 = - std::dynamic_pointer_cast(GCS_EDGE_WRAPPER(theEntity2)->entity()); + double *theAngle) { + GCSCurvePtr aCurve1 = std::dynamic_pointer_cast( + GCS_EDGE_WRAPPER(theEntity1)->entity()); + GCSCurvePtr aCurve2 = std::dynamic_pointer_cast( + GCS_EDGE_WRAPPER(theEntity2)->entity()); GCSConstraintPtr aNewConstr; if (theSharedPoint) { GCSPointPtr aPoint = - std::dynamic_pointer_cast(theSharedPoint)->point(); + std::dynamic_pointer_cast(theSharedPoint) + ->point(); adjustAngleBetweenCurves(aCurve1, aCurve2, aPoint, theAngle); - aNewConstr = - GCSConstraintPtr(new GCS::ConstraintAngleViaPoint(*aCurve1, *aCurve2, *aPoint, theAngle)); + aNewConstr = GCSConstraintPtr(new GCS::ConstraintAngleViaPoint( + *aCurve1, *aCurve2, *aPoint, theAngle)); } else { - std::shared_ptr aCirc1 = std::dynamic_pointer_cast(aCurve1); - std::shared_ptr aCirc2 = std::dynamic_pointer_cast(aCurve2); - aNewConstr = GCSConstraintPtr(new GCS::ConstraintTangentCircumf(aCirc1->center, aCirc2->center, - aCirc1->rad, aCirc2->rad, theInternalTangency)); + std::shared_ptr aCirc1 = + std::dynamic_pointer_cast(aCurve1); + std::shared_ptr aCirc2 = + std::dynamic_pointer_cast(aCurve2); + aNewConstr = GCSConstraintPtr(new GCS::ConstraintTangentCircumf( + aCirc1->center, aCirc2->center, aCirc1->rad, aCirc2->rad, + theInternalTangency)); } - return ConstraintWrapperPtr( - new PlaneGCSSolver_ConstraintWrapper(aNewConstr, CONSTRAINT_TANGENT_CURVE_CURVE)); + return ConstraintWrapperPtr(new PlaneGCSSolver_ConstraintWrapper( + aNewConstr, CONSTRAINT_TANGENT_CURVE_CURVE)); } -void calculateTangencyPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurve2, - GCSPointPtr& theTangencyPoint) -{ - std::shared_ptr anEllipse = PlaneGCSSolver_Tools::ellipse(theCurve1); +void calculateTangencyPoint(EntityWrapperPtr theCurve1, + EntityWrapperPtr theCurve2, + GCSPointPtr &theTangencyPoint) { + std::shared_ptr anEllipse = + PlaneGCSSolver_Tools::ellipse(theCurve1); EntityWrapperPtr aCurve2 = theCurve2; if (!anEllipse) { // try converting to ellipse the second curve @@ -641,13 +663,15 @@ void calculateTangencyPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurv if (aCurve2->type() == ENTITY_LINE) { std::shared_ptr aLine = PlaneGCSSolver_Tools::line(aCurve2); anEllipse->distance(aLine, aP1, aP2); - } - else if (aCurve2->type() == ENTITY_ARC || aCurve2->type() == ENTITY_CIRCLE) { - std::shared_ptr aCircle = PlaneGCSSolver_Tools::circle(aCurve2); + } else if (aCurve2->type() == ENTITY_ARC || + aCurve2->type() == ENTITY_CIRCLE) { + std::shared_ptr aCircle = + PlaneGCSSolver_Tools::circle(aCurve2); anEllipse->distance(aCircle, aP1, aP2); - } - else if (aCurve2->type() == ENTITY_ELLIPSE || aCurve2->type() == ENTITY_ELLIPTIC_ARC) { - std::shared_ptr anEl2 = PlaneGCSSolver_Tools::ellipse(aCurve2); + } else if (aCurve2->type() == ENTITY_ELLIPSE || + aCurve2->type() == ENTITY_ELLIPTIC_ARC) { + std::shared_ptr anEl2 = + PlaneGCSSolver_Tools::ellipse(aCurve2); anEllipse->distance(anEl2, aP1, aP2); } diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.h b/src/SketchSolver/SketchSolver_ConstraintTangent.h index 6e5a76fa6..3ee1d0f5a 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.h +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_ConstraintTangent_H_ @@ -26,23 +27,20 @@ * \ingroup Plugins * \brief Convert tangency constraint to SolveSpace structure */ -class SketchSolver_ConstraintTangent : public SketchSolver_Constraint -{ +class SketchSolver_ConstraintTangent : public SketchSolver_Constraint { public: /// Constructor based on SketchPlugin constraint - SketchSolver_ConstraintTangent(ConstraintPtr theConstraint) : - SketchSolver_Constraint(theConstraint), - isArcArcInternal(false), - myCurveCurveAngle(0.0) - {} + SketchSolver_ConstraintTangent(ConstraintPtr theConstraint) + : SketchSolver_Constraint(theConstraint), isArcArcInternal(false), + myCurveCurveAngle(0.0) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr& theFeature, - PlaneGCSSolver_Update* theUpdater); + virtual void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater); /// \brief Tries to remove constraint - /// \return \c false, if current constraint contains another SketchPlugin constraints - /// (like for multiple coincidence) + /// \return \c false, if current constraint contains another SketchPlugin + /// constraints (like for multiple coincidence) virtual bool remove(); protected: @@ -52,7 +50,8 @@ protected: /// \brief Remove current constraint from the storage and build is again void rebuild(); - /// \brief This method is used in derived objects to check consistency of constraint. + /// \brief This method is used in derived objects to check consistency of + /// constraint. /// E.g. the distance between line and point may be signed. virtual void adjustConstraint(); diff --git a/src/SketchSolver/SketchSolver_Error.h b/src/SketchSolver/SketchSolver_Error.h index b31b16216..350dcd62e 100644 --- a/src/SketchSolver/SketchSolver_Error.h +++ b/src/SketchSolver/SketchSolver_Error.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_Error_H_ @@ -27,96 +28,90 @@ * \brief Collects all sketch solver error' codes * as inline static functions */ -class SketchSolver_Error -{ - public: +class SketchSolver_Error { +public: /// The value parameter for the constraint - inline static const std::string& CONSTRAINTS() - { - static const std::string MY_ERROR_VALUE("The constraint is conflicting with others. " - "To fix this, you can either undo (Ctrl+Z) your operation or " - "remove a conflicting constraint."); + inline static const std::string &CONSTRAINTS() { + static const std::string MY_ERROR_VALUE( + "The constraint is conflicting with others. " + "To fix this, you can either undo (Ctrl+Z) " + "your operation or " + "remove a conflicting constraint."); return MY_ERROR_VALUE; } /// Cyclic dependency of copied features with their originals - inline static const std::string& INFINITE_LOOP() - { + inline static const std::string &INFINITE_LOOP() { static const std::string MY_ERROR_VALUE( - "There is a circular reference between copied sketch entities and their originals. " - "To fix this, you can either undo (Ctrl+Z) your operation or " - "remove wrong constraint."); + "There is a circular reference between copied sketch entities and " + "their originals. " + "To fix this, you can either undo (Ctrl+Z) " + "your operation or " + "remove wrong constraint."); return MY_ERROR_VALUE; } /// Constraints should use objects instead of features as attributes - inline static const std::string& NEED_OBJECT_NOT_FEATURE() - { - static const std::string - MY_ERROR_VALUE("Constraint should be based on object instead of feature"); + inline static const std::string &NEED_OBJECT_NOT_FEATURE() { + static const std::string MY_ERROR_VALUE( + "Constraint should be based on object instead of feature"); return MY_ERROR_VALUE; } /// The entities need to have shared point, but they have not - inline static const std::string& NO_COINCIDENT_POINTS() - { - static const std::string MY_ERROR_VALUE("Objects should have coincident point"); + inline static const std::string &NO_COINCIDENT_POINTS() { + static const std::string MY_ERROR_VALUE( + "Objects should have coincident point"); return MY_ERROR_VALUE; } /// Attribute of a feature is not initialized - inline static const std::string& NOT_INITIALIZED() - { + inline static const std::string &NOT_INITIALIZED() { static const std::string MY_ERROR_VALUE("Attribute is not initialized"); return MY_ERROR_VALUE; } /// Constraint has wrong attributes - inline static const std::string& INCORRECT_ATTRIBUTE() - { + inline static const std::string &INCORRECT_ATTRIBUTE() { static const std::string MY_ERROR_VALUE("Incorrect attribute"); return MY_ERROR_VALUE; } /// Tangency constraint has wrong attributes - inline static const std::string& INCORRECT_TANGENCY_ATTRIBUTE() - { - static const std::string MY_ERROR_VALUE("An arc should be an attribute of tangency constraint"); + inline static const std::string &INCORRECT_TANGENCY_ATTRIBUTE() { + static const std::string MY_ERROR_VALUE( + "An arc should be an attribute of tangency constraint"); return MY_ERROR_VALUE; } /// Mirror constraint has wrong attributes - inline static const std::string& INCORRECT_MIRROR_ATTRIBUTE() - { - static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes"); + inline static const std::string &INCORRECT_MIRROR_ATTRIBUTE() { + static const std::string MY_ERROR_VALUE( + "Mirror constraint has wrong attributes"); return MY_ERROR_VALUE; } /// Entity is already fixed - inline static const std::string& ALREADY_FIXED() - { + inline static const std::string &ALREADY_FIXED() { static const std::string MY_ERROR_VALUE("Entity already fixed"); return MY_ERROR_VALUE; } /// Tangency constraint has been built with wrong attributes /// (for example, line and arc have two coincident points) - inline static const std::string& TANGENCY_FAILED() - { - static const std::string - MY_ERROR_VALUE("Unable to create tangency constraint on given attributes"); + inline static const std::string &TANGENCY_FAILED() { + static const std::string MY_ERROR_VALUE( + "Unable to create tangency constraint on given attributes"); return MY_ERROR_VALUE; } /// Crash in SolveSpace - inline static const std::string& SOLVESPACE_CRASH() - { - static const std::string MY_ERROR_VALUE("Caution: SolveSpace crashed! Constraints are wrong"); + inline static const std::string &SOLVESPACE_CRASH() { + static const std::string MY_ERROR_VALUE( + "Caution: SolveSpace crashed! Constraints are wrong"); return MY_ERROR_VALUE; } /// Constraint has wrong type - inline static const std::string& WRONG_CONSTRAINT_TYPE() - { + inline static const std::string &WRONG_CONSTRAINT_TYPE() { static const std::string MY_ERROR_VALUE("Unsupported type of constraint"); return MY_ERROR_VALUE; } /// Sketch contains degenerated geometry - inline static const std::string& DEGENERATED_GEOMETRY() - { + inline static const std::string &DEGENERATED_GEOMETRY() { static const std::string MY_ERROR_VALUE( - "The set of constraints lead to degenerated geometry. " - "To fix this, you can either undo your operation or " - "remove a constraint or the degenerated geometry."); + "The set of constraints lead to degenerated geometry. " + "To fix this, you can either undo your operation or " + "remove a constraint or the degenerated geometry."); return MY_ERROR_VALUE; } }; diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 232c8525e..bde8616f8 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchSolver_Group.h" @@ -35,30 +36,29 @@ #include - -static void sendMessage(const char* theMessageName) -{ +static void sendMessage(const char *theMessageName) { std::shared_ptr aMessage = std::shared_ptr( new Events_Message(Events_Loop::eventByName(theMessageName))); Events_Loop::loop()->send(aMessage); } -static void sendMessage(const char* theMessageName, const std::set& theConflicting) -{ +static void sendMessage(const char *theMessageName, + const std::set &theConflicting) { std::shared_ptr aMessage = std::shared_ptr( - new ModelAPI_SolverFailedMessage(Events_Loop::eventByName(theMessageName))); + new ModelAPI_SolverFailedMessage( + Events_Loop::eventByName(theMessageName))); aMessage->setObjects(theConflicting); Events_Loop::loop()->send(aMessage); } -static void sendMessage(const char* theMessageName, - const CompositeFeaturePtr& theSketch, - const int theDOF) -{ +static void sendMessage(const char *theMessageName, + const CompositeFeaturePtr &theSketch, + const int theDOF) { std::shared_ptr aMessage = std::shared_ptr( - new ModelAPI_SolverFailedMessage(Events_Loop::eventByName(theMessageName))); + new ModelAPI_SolverFailedMessage( + Events_Loop::eventByName(theMessageName))); std::set anObjects; anObjects.insert(theSketch); @@ -68,25 +68,19 @@ static void sendMessage(const char* theMessageName, Events_Loop::loop()->send(aMessage); } - - // ======================================================== // ========= SketchSolver_Group =============== // ======================================================== -SketchSolver_Group::SketchSolver_Group(const CompositeFeaturePtr& theWorkplane) - : myPrevResult(PlaneGCSSolver_Solver::STATUS_UNKNOWN), - myDOF(-1), - myIsEventsBlocked(false), - myMultiConstraintUpdateStack(0) -{ +SketchSolver_Group::SketchSolver_Group(const CompositeFeaturePtr &theWorkplane) + : myPrevResult(PlaneGCSSolver_Solver::STATUS_UNKNOWN), myDOF(-1), + myIsEventsBlocked(false), myMultiConstraintUpdateStack(0) { mySketchSolver = SolverPtr(new PlaneGCSSolver_Solver); myStorage = StoragePtr(new PlaneGCSSolver_Storage(mySketchSolver)); updateSketch(theWorkplane); } -SketchSolver_Group::~SketchSolver_Group() -{ +SketchSolver_Group::~SketchSolver_Group() { myConstraints.clear(); // send the message that there is no more conflicting constraints if (!myConflictingConstraints.empty()) { @@ -101,23 +95,25 @@ SketchSolver_Group::~SketchSolver_Group() // Purpose: create/update the constraint in the group // ============================================================================ bool SketchSolver_Group::changeConstraint( - std::shared_ptr theConstraint) -{ - bool isNewConstraint = myConstraints.find(theConstraint) == myConstraints.end(); + std::shared_ptr theConstraint) { + bool isNewConstraint = + myConstraints.find(theConstraint) == myConstraints.end(); if (isNewConstraint) { // Add constraint to the current group - SolverConstraintPtr aConstraint = PlaneGCSSolver_Tools::createConstraint(theConstraint); + SolverConstraintPtr aConstraint = + PlaneGCSSolver_Tools::createConstraint(theConstraint); if (!aConstraint) return false; aConstraint->process(myStorage, myIsEventsBlocked); if (!aConstraint->error().empty()) { if (aConstraint->error() == SketchSolver_Error::NOT_INITIALIZED()) - return false; // some attribute are not initialized yet, don't show message - Events_InfoMessage("SketchSolver_Group", aConstraint->error(), this).send(); + return false; // some attribute are not initialized yet, don't show + // message + Events_InfoMessage("SketchSolver_Group", aConstraint->error(), this) + .send(); } myConstraints[theConstraint] = aConstraint; - } - else + } else myConstraints[theConstraint]->update(); // constraint is created/updated => reset stack of "multi" constraints updates @@ -125,8 +121,7 @@ bool SketchSolver_Group::changeConstraint( return true; } -bool SketchSolver_Group::updateSketch(CompositeFeaturePtr theSketch) -{ +bool SketchSolver_Group::updateSketch(CompositeFeaturePtr theSketch) { static const double THE_TOLERANCE = 1.e-7; bool isChanged = theSketch != mySketch; @@ -137,10 +132,13 @@ bool SketchSolver_Group::updateSketch(CompositeFeaturePtr theSketch) AttributeDirPtr aDirX = std::dynamic_pointer_cast( theSketch->attribute(SketchPlugin_Sketch::DIRX_ID())); - isChanged = isChanged - || (mySketchOrigin && anOrigin && anOrigin->pnt()->distance(mySketchOrigin) > THE_TOLERANCE) - || (mySketchNormal && aNorm && aNorm->xyz()->distance(mySketchNormal->xyz()) > THE_TOLERANCE) - || (mySketchXDir && aDirX && aDirX->xyz()->distance(mySketchXDir->xyz()) > THE_TOLERANCE); + isChanged = isChanged || + (mySketchOrigin && anOrigin && + anOrigin->pnt()->distance(mySketchOrigin) > THE_TOLERANCE) || + (mySketchNormal && aNorm && + aNorm->xyz()->distance(mySketchNormal->xyz()) > THE_TOLERANCE) || + (mySketchXDir && aDirX && + aDirX->xyz()->distance(mySketchXDir->xyz()) > THE_TOLERANCE); if (isChanged) { mySketch = theSketch; @@ -153,21 +151,17 @@ bool SketchSolver_Group::updateSketch(CompositeFeaturePtr theSketch) return true; } -bool SketchSolver_Group::updateFeature(FeaturePtr theFeature) -{ +bool SketchSolver_Group::updateFeature(FeaturePtr theFeature) { return myStorage->update(theFeature); } template static SolverConstraintPtr move(StoragePtr theStorage, - SolverPtr theSketchSolver, - int theSketchDOF, - bool theEventsBlocked, - Type theFeatureOrPoint, - const EntityWrapperPtr& theSolverEntity, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo) -{ + SolverPtr theSketchSolver, int theSketchDOF, + bool theEventsBlocked, Type theFeatureOrPoint, + const EntityWrapperPtr &theSolverEntity, + const std::shared_ptr &theFrom, + const std::shared_ptr &theTo) { bool isEntityExists = (theSolverEntity.get() != 0); if (theSketchDOF == 0 && isEntityExists) { // avoid moving elements of fully constrained sketch @@ -193,32 +187,31 @@ static SolverConstraintPtr move(StoragePtr theStorage, return aConstraint; } -bool SketchSolver_Group::moveFeature(FeaturePtr theFeature, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo) -{ +bool SketchSolver_Group::moveFeature( + FeaturePtr theFeature, const std::shared_ptr &theFrom, + const std::shared_ptr &theTo) { EntityWrapperPtr anEntity = myStorage->entity(theFeature); - SolverConstraintPtr aConstraint = move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, - theFeature, anEntity, theFrom, theTo); + SolverConstraintPtr aConstraint = + move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, theFeature, + anEntity, theFrom, theTo); setTemporary(aConstraint); return true; } -bool SketchSolver_Group::movePoint(AttributePtr theAttribute, - const int thePointIndex, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo) -{ +bool SketchSolver_Group::movePoint( + AttributePtr theAttribute, const int thePointIndex, + const std::shared_ptr &theFrom, + const std::shared_ptr &theTo) { EntityWrapperPtr anEntity = myStorage->entity(theAttribute); SolverConstraintPtr aConstraint; if (thePointIndex < 0) { aConstraint = move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, theAttribute, anEntity, theFrom, theTo); - } - else { - aConstraint = move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, - std::pair(theAttribute, thePointIndex), anEntity, - theFrom, theTo); + } else { + aConstraint = + move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, + std::pair(theAttribute, thePointIndex), + anEntity, theFrom, theTo); } setTemporary(aConstraint); return true; @@ -229,16 +222,16 @@ bool SketchSolver_Group::movePoint(AttributePtr theAttribute, // Class: SketchSolver_Group // Purpose: solve the set of constraints for the current group // ============================================================================ -bool SketchSolver_Group::resolveConstraints() -{ +bool SketchSolver_Group::resolveConstraints() { static const int MAX_STACK_SIZE = 5; // check the "Multi" constraints do not drop sketch into infinite loop if (myMultiConstraintUpdateStack > MAX_STACK_SIZE) { myMultiConstraintUpdateStack = 0; myPrevResult = PlaneGCSSolver_Solver::STATUS_FAILED; // generate error message due to loop update of the sketch - getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR()) - ->setValue(SketchSolver_Error::INFINITE_LOOP()); + getWorkplane() + ->string(SketchPlugin_Sketch::SOLVER_ERROR()) + ->setValue(SketchSolver_Error::INFINITE_LOOP()); sendMessage(EVENT_SOLVER_FAILED, myConflictingConstraints); return false; } @@ -247,9 +240,10 @@ bool SketchSolver_Group::resolveConstraints() bool isGroupEmpty = isEmpty() && myStorage->isEmpty(); if (myStorage->isNeedToResolve() && (!isGroupEmpty || !myConflictingConstraints.empty() || - myPrevResult == PlaneGCSSolver_Solver::STATUS_FAILED)) { + myPrevResult == PlaneGCSSolver_Solver::STATUS_FAILED)) { - PlaneGCSSolver_Solver::SolveStatus aResult = PlaneGCSSolver_Solver::STATUS_OK; + PlaneGCSSolver_Solver::SolveStatus aResult = + PlaneGCSSolver_Solver::STATUS_OK; try { if (!isGroupEmpty) { myStorage->adjustParametrizationOfArcs(); @@ -265,8 +259,9 @@ bool SketchSolver_Group::resolveConstraints() if (aResult == PlaneGCSSolver_Solver::STATUS_OK) aResult = myStorage->checkDegeneratedGeometry(); } catch (...) { - getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR()) - ->setValue(SketchSolver_Error::SOLVESPACE_CRASH()); + getWorkplane() + ->string(SketchPlugin_Sketch::SOLVER_ERROR()) + ->setValue(SketchSolver_Error::SOLVESPACE_CRASH()); if (myPrevResult == PlaneGCSSolver_Solver::STATUS_OK || myPrevResult == PlaneGCSSolver_Solver::STATUS_UNKNOWN) { // the error message should be changed before sending the message @@ -282,8 +277,8 @@ bool SketchSolver_Group::resolveConstraints() myStorage->setNeedToResolve(false); myStorage->refresh(); - // additional check that copied entities used in Mirror and other "Multi" constraints - // is not connected with their originals by constraints. + // additional check that copied entities used in Mirror and other "Multi" + // constraints is not connected with their originals by constraints. myMultiConstraintUpdateStack += 1; aResolved = true; if (myStorage->isNeedToResolve()) @@ -294,7 +289,9 @@ bool SketchSolver_Group::resolveConstraints() if (myPrevResult != PlaneGCSSolver_Solver::STATUS_OK || myPrevResult == PlaneGCSSolver_Solver::STATUS_UNKNOWN) { - getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(""); + getWorkplane() + ->string(SketchPlugin_Sketch::SOLVER_ERROR()) + ->setValue(""); std::set aConflicting = myConflictingConstraints; myConflictingConstraints.clear(); myPrevResult = PlaneGCSSolver_Solver::STATUS_OK; @@ -309,15 +306,19 @@ bool SketchSolver_Group::resolveConstraints() mySketchSolver->undo(); if (!myConstraints.empty()) { // the error message should be changed before sending the message - const std::string& aErrorMsg = aResult == PlaneGCSSolver_Solver::STATUS_DEGENERATED ? - SketchSolver_Error::DEGENERATED_GEOMETRY() : - SketchSolver_Error::CONSTRAINTS(); - getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(aErrorMsg); + const std::string &aErrorMsg = + aResult == PlaneGCSSolver_Solver::STATUS_DEGENERATED + ? SketchSolver_Error::DEGENERATED_GEOMETRY() + : SketchSolver_Error::CONSTRAINTS(); + getWorkplane() + ->string(SketchPlugin_Sketch::SOLVER_ERROR()) + ->setValue(aErrorMsg); if (myPrevResult != aResult || myPrevResult == PlaneGCSSolver_Solver::STATUS_UNKNOWN || myPrevResult == PlaneGCSSolver_Solver::STATUS_FAILED) { // Obtain list of conflicting constraints - std::set aConflicting = myStorage->getConflictingConstraints(mySketchSolver); + std::set aConflicting = + myStorage->getConflictingConstraints(mySketchSolver); if (!myConflictingConstraints.empty()) { std::set::iterator anIt = aConflicting.begin(); @@ -341,8 +342,7 @@ bool SketchSolver_Group::resolveConstraints() computeDoF(); } - } - else if (isGroupEmpty && isWorkplaneValid()) { + } else if (isGroupEmpty && isWorkplaneValid()) { // clear error related to previously degenerated entities if (myPrevResult == PlaneGCSSolver_Solver::STATUS_DEGENERATED) { getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(""); @@ -364,27 +364,26 @@ bool SketchSolver_Group::resolveConstraints() // Class: SketchSolver_Group // Purpose: compute DoF of the sketch and set corresponding field // ============================================================================ -void SketchSolver_Group::computeDoF() -{ +void SketchSolver_Group::computeDoF() { std::string aDoFMsg; static const std::string aMsgContext("Sketch"); int aDoF = mySketchSolver->dof(); /// "DoF = 0" content of string value is used in PartSet by Sketch edit /// If it is changed, it should be corrected also there - //if (aDoF == 0) { - // static const std::string aMsgDoF("Sketch is fully fixed (DoF = 0)"); - // aDoFMsg = Config_Translator::translate(aMsgContext, aMsgDoF); - //} else { - // static const std::string aMsgDoF("DoF (degrees of freedom) = %1"); - // Events_InfoMessage aMsg(aMsgContext, aMsgDoF); - // aMsg.addParameter(aDoF); - // aDoFMsg = Config_Translator::translate(aMsg); - //} + // if (aDoF == 0) { + // static const std::string aMsgDoF("Sketch is fully fixed (DoF = 0)"); + // aDoFMsg = Config_Translator::translate(aMsgContext, aMsgDoF); + // } else { + // static const std::string aMsgDoF("DoF (degrees of freedom) = %1"); + // Events_InfoMessage aMsg(aMsgContext, aMsgDoF); + // aMsg.addParameter(aDoF); + // aDoFMsg = Config_Translator::translate(aMsg); + // } //// store Unicode value for translated message about DoF - //size_t aLen = aDoFMsg.size(); - //std::wstring aWStr(aLen, L'#'); - //mbstowcs(&aWStr[0], aDoFMsg.c_str(), aLen); - //mySketch->string(SketchPlugin_Sketch::SOLVER_DOF())->setValue(aWStr); + // size_t aLen = aDoFMsg.size(); + // std::wstring aWStr(aLen, L'#'); + // mbstowcs(&aWStr[0], aDoFMsg.c_str(), aLen); + // mySketch->string(SketchPlugin_Sketch::SOLVER_DOF())->setValue(aWStr); std::ostringstream aStr; aStr << aDoF; @@ -405,8 +404,7 @@ void SketchSolver_Group::computeDoF() // Class: SketchSolver_Group // Purpose: search removed entities and constraints // ============================================================================ -void SketchSolver_Group::repairConsistency() -{ +void SketchSolver_Group::repairConsistency() { if (!areConstraintsValid() || !myStorage->areFeaturesValid()) { // remove invalid constraints std::set anInvalidConstraints; @@ -415,7 +413,8 @@ void SketchSolver_Group::repairConsistency() if (!aCIter->first->data() || !aCIter->first->data()->isValid()) anInvalidConstraints.insert(aCIter->first); } - std::set::const_iterator aRemoveIt = anInvalidConstraints.begin(); + std::set::const_iterator aRemoveIt = + anInvalidConstraints.begin(); for (; aRemoveIt != anInvalidConstraints.end(); ++aRemoveIt) removeConstraint(*aRemoveIt); @@ -433,8 +432,7 @@ void SketchSolver_Group::repairConsistency() // Purpose: remove all transient SLVS_C_WHERE_DRAGGED constraints after // resolving the set of constraints // ============================================================================ -void SketchSolver_Group::removeTemporaryConstraints() -{ +void SketchSolver_Group::removeTemporaryConstraints() { if (!myTempConstraints.empty()) { mySketchSolver->removeConstraint(CID_MOVEMENT); @@ -453,8 +451,7 @@ void SketchSolver_Group::removeTemporaryConstraints() // Class: SketchSolver_Group // Purpose: remove constraint and all unused entities // ============================================================================ -void SketchSolver_Group::removeConstraint(ConstraintPtr theConstraint) -{ +void SketchSolver_Group::removeConstraint(ConstraintPtr theConstraint) { ConstraintConstraintMap::iterator aCIter = myConstraints.begin(); for (; aCIter != myConstraints.end(); aCIter++) if (aCIter->first == theConstraint) { @@ -473,8 +470,7 @@ void SketchSolver_Group::removeConstraint(ConstraintPtr theConstraint) // Class: SketchSolver_Group // Purpose: append given constraint to the group of temporary constraints // ============================================================================ -void SketchSolver_Group::setTemporary(SolverConstraintPtr theConstraint) -{ +void SketchSolver_Group::setTemporary(SolverConstraintPtr theConstraint) { if (theConstraint) myTempConstraints.insert(theConstraint); } @@ -484,8 +480,7 @@ void SketchSolver_Group::setTemporary(SolverConstraintPtr theConstraint) // Class: SketchSolver_Group // Purpose: block or unblock events from features in this group // ============================================================================ -void SketchSolver_Group::blockEvents(bool isBlocked) -{ +void SketchSolver_Group::blockEvents(bool isBlocked) { if (myIsEventsBlocked == isBlocked) return; @@ -500,8 +495,7 @@ void SketchSolver_Group::blockEvents(bool isBlocked) myIsEventsBlocked = isBlocked; } -bool SketchSolver_Group::areConstraintsValid() const -{ +bool SketchSolver_Group::areConstraintsValid() const { // Check the constraints are valid ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin(); for (; aCIter != myConstraints.end(); ++aCIter) @@ -510,7 +504,7 @@ bool SketchSolver_Group::areConstraintsValid() const return true; } -void SketchSolver_Group::underconstrainedFeatures(std::set& theFeatures) const -{ +void SketchSolver_Group::underconstrainedFeatures( + std::set &theFeatures) const { myStorage->getUnderconstrainedGeometry(theFeatures); } diff --git a/src/SketchSolver/SketchSolver_Group.h b/src/SketchSolver/SketchSolver_Group.h index d8ef3dc3c..5abdea54b 100644 --- a/src/SketchSolver/SketchSolver_Group.h +++ b/src/SketchSolver/SketchSolver_Group.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_Group_H_ @@ -27,8 +28,8 @@ #include -#include #include +#include class GeomAPI_Dir; class GeomAPI_Pnt; @@ -40,26 +41,23 @@ typedef std::map ConstraintConstraintMap; * \ingroup Plugins * \brief Keeps the group of constraints which placed in the same sketch */ -class SketchSolver_Group -{ - public: +class SketchSolver_Group { +public: /** \brief New group based on specified workplane. - * Throws an exception if theWorkplane is not an object of SketchPlugin_Sketch type - * \remark Type of theSketch is not verified inside + * Throws an exception if theWorkplane is not an object of + * SketchPlugin_Sketch type \remark Type of theSketch is not verified inside */ - SketchSolver_Group(const CompositeFeaturePtr& theWorkplane); + SketchSolver_Group(const CompositeFeaturePtr &theWorkplane); virtual ~SketchSolver_Group(); /// \brief Returns true if the group has no constraints yet - inline bool isEmpty() const - { + inline bool isEmpty() const { return myConstraints.empty() && myTempConstraints.empty(); } /// \brief Check for valid sketch data - inline bool isWorkplaneValid() const - { + inline bool isWorkplaneValid() const { return mySketch->data() && mySketch->data()->isValid(); } @@ -86,8 +84,8 @@ class SketchSolver_Group * \return \c true, if the feature is really moved */ bool moveFeature(FeaturePtr theFeature, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo); + const std::shared_ptr &theFrom, + const std::shared_ptr &theTo); /** \brief Updates the data corresponding the specified point moved in GUI. * Special kind of Fixed constraints is created. * \param[in] thePointOrArray the attribute to be updated @@ -96,29 +94,25 @@ class SketchSolver_Group * \param[in] theTo destination point of the movement * \return \c true, if the attribute is really moved */ - bool movePoint(AttributePtr thePointOrArray, - const int thePointIndex, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo); + bool movePoint(AttributePtr thePointOrArray, const int thePointIndex, + const std::shared_ptr &theFrom, + const std::shared_ptr &theTo); /// Returns the current workplane - inline const CompositeFeaturePtr& getWorkplane() const - { - return mySketch; - } + inline const CompositeFeaturePtr &getWorkplane() const { return mySketch; } - /** \brief Searches invalid features and constraints in the group and removes them - * \return \c false if the group several constraints were removed + /** \brief Searches invalid features and constraints in the group and removes + * them \return \c false if the group several constraints were removed */ void repairConsistency(); - /** \brief Start solution procedure if necessary and update attributes of features - * \return \c false when no need to solve constraints + /** \brief Start solution procedure if necessary and update attributes of + * features \return \c false when no need to solve constraints */ bool resolveConstraints(); /// \brief Find the list of features, which are not fully constrained. - void underconstrainedFeatures(std::set& theFeatures) const; + void underconstrainedFeatures(std::set &theFeatures) const; /// \brief Block or unblock events sent by features in this group void blockEvents(bool isBlocked); @@ -148,20 +142,25 @@ private: std::shared_ptr mySketchXDir; ConstraintConstraintMap myConstraints; ///< List of constraints - std::set myTempConstraints; ///< List of temporary constraints + std::set + myTempConstraints; ///< List of temporary constraints - StoragePtr myStorage; ///< Container for the set of SolveSpace constraints and their entities - SolverPtr mySketchSolver; ///< Solver for set of equations obtained by constraints + StoragePtr myStorage; ///< Container for the set of SolveSpace constraints and + ///< their entities + SolverPtr + mySketchSolver; ///< Solver for set of equations obtained by constraints /// Result of previous solution of the set of constraints PlaneGCSSolver_Solver::SolveStatus myPrevResult; - std::set myConflictingConstraints; ///< List of conflicting constraints + std::set + myConflictingConstraints; ///< List of conflicting constraints - int myDOF; ///< degrees of freedom of the current sketch + int myDOF; ///< degrees of freedom of the current sketch bool myIsEventsBlocked; ///< shows the events are blocked for this group - int myMultiConstraintUpdateStack; ///< depth of the stack updating "Multi" constraints + int myMultiConstraintUpdateStack; ///< depth of the stack updating "Multi" + ///< constraints }; typedef std::shared_ptr SketchGroupPtr; diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 5761c09b4..7c5b2e51f 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketchSolver_Manager.h" @@ -30,38 +31,38 @@ #include /// Global constraint manager object -static SketchSolver_Manager* myManager = SketchSolver_Manager::instance(); +static SketchSolver_Manager *myManager = SketchSolver_Manager::instance(); /// \brief Verifies is the feature valid -static bool isFeatureValid(FeaturePtr theFeature) -{ +static bool isFeatureValid(FeaturePtr theFeature) { if (!theFeature || !theFeature->data() || !theFeature->data()->isValid()) return false; SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); return aFactory->validate(theFeature); } typedef std::map> IndexedFeatureMap; -static void featuresOrderedByCreation(const std::set& theOriginalFeatures, - IndexedFeatureMap& theOrderedFeatures) -{ +static void +featuresOrderedByCreation(const std::set &theOriginalFeatures, + IndexedFeatureMap &theOrderedFeatures) { std::set::iterator aFeatIter = theOriginalFeatures.begin(); for (; aFeatIter != theOriginalFeatures.end(); aFeatIter++) { std::shared_ptr aFeature = std::dynamic_pointer_cast(*aFeatIter); - if (aFeature && !aFeature->isMacro() && aFeature->data() && aFeature->data()->isValid()) { + if (aFeature && !aFeature->isMacro() && aFeature->data() && + aFeature->data()->isValid()) { theOrderedFeatures[aFeature->data()->featureId()] = aFeature; } } } -static void featuresOrderedByType(const std::set& theOriginalFeatures, - IndexedFeatureMap& theOrderedFeatures, - CompositeFeaturePtr& theSketch) -{ +static void +featuresOrderedByType(const std::set &theOriginalFeatures, + IndexedFeatureMap &theOrderedFeatures, + CompositeFeaturePtr &theSketch) { int aFeatureIndex = 0; int aConstraintIndex = (int)theOriginalFeatures.size(); @@ -70,7 +71,8 @@ static void featuresOrderedByType(const std::set& theOriginalFeatures std::shared_ptr aFeature = std::dynamic_pointer_cast(*aFeatIter); if (aFeature) { - if (!aFeature->isMacro() && aFeature->data() && aFeature->data()->isValid()) { + if (!aFeature->isMacro() && aFeature->data() && + aFeature->data()->isValid()) { std::shared_ptr aConstraint = std::dynamic_pointer_cast(aFeature); if (aConstraint) @@ -78,8 +80,7 @@ static void featuresOrderedByType(const std::set& theOriginalFeatures else theOrderedFeatures[++aFeatureIndex] = aFeature; } - } - else { + } else { CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(*aFeatIter); if (aSketch && aSketch->getKind() == SketchPlugin_Sketch::ID()) @@ -88,11 +89,10 @@ static void featuresOrderedByType(const std::set& theOriginalFeatures } } -static void setPoint(AttributePtr theAttribute, - const int thePointIndex, - const std::shared_ptr theValue) -{ - AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast(theAttribute); +static void setPoint(AttributePtr theAttribute, const int thePointIndex, + const std::shared_ptr theValue) { + AttributePoint2DPtr aPointAttr = + std::dynamic_pointer_cast(theAttribute); AttributePoint2DArrayPtr aPointArrayAttr = std::dynamic_pointer_cast(theAttribute); if (aPointAttr) @@ -101,60 +101,61 @@ static void setPoint(AttributePtr theAttribute, aPointArrayAttr->setPnt(thePointIndex, theValue); } - - // ======================================================== // ========= SketchSolver_Manager =============== // ======================================================== -SketchSolver_Manager* SketchSolver_Manager::instance() -{ - static SketchSolver_Manager* mySelf = 0; // Self pointer to implement singleton functionality +SketchSolver_Manager *SketchSolver_Manager::instance() { + static SketchSolver_Manager *mySelf = + 0; // Self pointer to implement singleton functionality if (!mySelf) mySelf = new SketchSolver_Manager(); return mySelf; } -SketchSolver_Manager::SketchSolver_Manager() -{ +SketchSolver_Manager::SketchSolver_Manager() { myGroups.clear(); myIsComputed = false; // Register in event loop - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_MOVED)); - - ////Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_SOLVER_FAILED)); - ////Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_SKETCH_PREPARED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_GET_DOF_OBJECTS)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_OBJECT_DELETED)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_OBJECT_MOVED)); + + ////Events_Loop::loop()->registerListener(this, + /// Events_Loop::eventByName(EVENT_SOLVER_FAILED)); + ////Events_Loop::loop()->registerListener(this, + /// Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_SKETCH_PREPARED)); + Events_Loop::loop()->registerListener( + this, Events_Loop::eventByName(EVENT_GET_DOF_OBJECTS)); } -SketchSolver_Manager::~SketchSolver_Manager() -{ - myGroups.clear(); -} +SketchSolver_Manager::~SketchSolver_Manager() { myGroups.clear(); } -bool SketchSolver_Manager::groupMessages() -{ - return true; -} +bool SketchSolver_Manager::groupMessages() { return true; } // ============================================================================ // Function: processEvent // Purpose: listen the event loop and process the message // ============================================================================ void SketchSolver_Manager::processEvent( - const std::shared_ptr& theMessage) -{ + const std::shared_ptr &theMessage) { bool needToResolve = false; bool isUpdateFlushed = false; bool isMovedEvt = false; - static const Events_ID aCreatedEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); - static const Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - static const Events_ID aSketchPreparedEvent = Events_Loop::eventByName(EVENT_SKETCH_PREPARED); + static const Events_ID aCreatedEvent = + Events_Loop::eventByName(EVENT_OBJECT_CREATED); + static const Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID aSketchPreparedEvent = + Events_Loop::eventByName(EVENT_SKETCH_PREPARED); // sketch is prepared for resolve: all the needed events // are collected and must be processed by the solver if (theMessage->eventID() == aSketchPreparedEvent) { @@ -166,17 +167,19 @@ void SketchSolver_Manager::processEvent( return; myIsComputed = true; - if (theMessage->eventID() == aCreatedEvent || theMessage->eventID() == anUpdateEvent) { + if (theMessage->eventID() == aCreatedEvent || + theMessage->eventID() == anUpdateEvent) { std::shared_ptr anUpdateMsg = std::dynamic_pointer_cast(theMessage); isUpdateFlushed = stopSendUpdate(); // update sketch features only - const std::set& aFeatures = anUpdateMsg->objects(); + const std::set &aFeatures = anUpdateMsg->objects(); IndexedFeatureMap anOrderedFeatures; CompositeFeaturePtr aSketchFeature; - // try to keep order as features were created if there are several created features: #2229 + // try to keep order as features were created if there are several created + // features: #2229 if (theMessage->eventID() == aCreatedEvent && aFeatures.size() > 1) { featuresOrderedByCreation(aFeatures, anOrderedFeatures); } else { // order is not important, just process features before constraints @@ -184,12 +187,14 @@ void SketchSolver_Manager::processEvent( } IndexedFeatureMap::iterator aFeat; - for (aFeat = anOrderedFeatures.begin(); aFeat != anOrderedFeatures.end(); aFeat++) { + for (aFeat = anOrderedFeatures.begin(); aFeat != anOrderedFeatures.end(); + aFeat++) { updateFeature(aFeat->second); } updateSketch(aSketchFeature); - } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) { std::shared_ptr aMoveMsg = std::dynamic_pointer_cast(theMessage); @@ -197,8 +202,8 @@ void SketchSolver_Manager::processEvent( AttributePtr aMovedAttribute = aMoveMsg->movedAttribute(); int aMovedPoint = aMoveMsg->movedPointIndex(); - const std::shared_ptr& aFrom = aMoveMsg->originalPosition(); - const std::shared_ptr& aTo = aMoveMsg->currentPosition(); + const std::shared_ptr &aFrom = aMoveMsg->originalPosition(); + const std::shared_ptr &aTo = aMoveMsg->currentPosition(); if (aMovedObject) { FeaturePtr aMovedFeature = ModelAPI_Feature::feature(aMovedObject); @@ -209,24 +214,28 @@ void SketchSolver_Manager::processEvent( } else if (aMovedAttribute) needToResolve = moveAttribute(aMovedAttribute, aMovedPoint, aFrom, aTo); - } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) { std::shared_ptr aDeleteMsg = - std::dynamic_pointer_cast(theMessage); - const std::list, std::string>>& aFeatureGroups = - aDeleteMsg->groups(); + std::dynamic_pointer_cast(theMessage); + const std::list, std::string>> + &aFeatureGroups = aDeleteMsg->groups(); // Find SketchPlugin_Sketch::ID() in groups. - // The constraint groups should be updated when an object removed from Sketch - std::list, std::string>>::const_iterator aFGrIter; - for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); aFGrIter++) + // The constraint groups should be updated when an object removed from + // Sketch + std::list, + std::string>>::const_iterator aFGrIter; + for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); + aFGrIter++) if (aFGrIter->second == ModelAPI_ResultConstruction::group() || - aFGrIter->second == ModelAPI_Feature::group()) + aFGrIter->second == ModelAPI_Feature::group()) break; if (aFGrIter != aFeatureGroups.end()) { std::list::iterator aGroupIter = myGroups.begin(); while (aGroupIter != myGroups.end()) { - if (!(*aGroupIter)->isWorkplaneValid()) { // the group should be removed + if (!(*aGroupIter)->isWorkplaneValid()) { // the group should be removed std::list::iterator aRemoveIt = aGroupIter++; myGroups.erase(aRemoveIt); continue; @@ -237,10 +246,10 @@ void SketchSolver_Manager::processEvent( } } myIsComputed = false; - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_GET_DOF_OBJECTS)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_GET_DOF_OBJECTS)) { std::shared_ptr anUpdateMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::set aObjects = anUpdateMsg->objects(); if (aObjects.size() == 1) { std::set::const_iterator aIt; @@ -255,12 +264,14 @@ void SketchSolver_Manager::processEvent( std::list aFeatures; std::set::const_iterator aIt; - for (aIt = aFreeFeatures.cbegin(); aIt != aFreeFeatures.cend(); ++aIt) { + for (aIt = aFreeFeatures.cbegin(); aIt != aFreeFeatures.cend(); + ++aIt) { aFeatures.push_back(*aIt); } // send features to GUI - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_DOF_OBJECTS); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_DOF_OBJECTS); ModelAPI_EventCreator::get()->sendUpdated(aFeatures, anEvent); Events_Loop::loop()->flush(anEvent); } @@ -287,8 +298,7 @@ void SketchSolver_Manager::processEvent( // Function: updateSketch // Purpose: update sketch plane in appropriate group // ============================================================================ -bool SketchSolver_Manager::updateSketch(const CompositeFeaturePtr& theSketch) -{ +bool SketchSolver_Manager::updateSketch(const CompositeFeaturePtr &theSketch) { if (!theSketch) return true; @@ -306,8 +316,8 @@ bool SketchSolver_Manager::updateSketch(const CompositeFeaturePtr& theSketch) // Function: updateFeature // Purpose: create/update constraint or feature in appropriate group // ============================================================================ -bool SketchSolver_Manager::updateFeature(const std::shared_ptr& theFeature) -{ +bool SketchSolver_Manager::updateFeature( + const std::shared_ptr &theFeature) { // Check feature validity and find a group to place it. // If the feature is not valid, the returned group will be empty. // This will protect to deal with wrong (not fully initialized) features. @@ -332,24 +342,23 @@ bool SketchSolver_Manager::updateFeature(const std::shared_ptr& theMovedFeature, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo) -{ + const std::shared_ptr &theMovedFeature, + const std::shared_ptr &theFrom, + const std::shared_ptr &theTo) { SketchGroupPtr aGroup = findGroup(theMovedFeature); if (!aGroup) return false; std::shared_ptr aConstraint = std::dynamic_pointer_cast(theMovedFeature); - if (aConstraint) - { - std::shared_ptr aPntAttr = std::dynamic_pointer_cast - (aConstraint->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - if (aPntAttr) - { + if (aConstraint) { + std::shared_ptr aPntAttr = + std::dynamic_pointer_cast(aConstraint->attribute( + SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + if (aPntAttr) { aPntAttr->setValue(theTo); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } return true; } @@ -363,16 +372,13 @@ bool SketchSolver_Manager::moveFeature( // Purpose: move given attribute in appropriate group // ============================================================================ bool SketchSolver_Manager::moveAttribute( - const std::shared_ptr& theMovedAttribute, - const int theMovedPointIndex, - const std::shared_ptr& theFrom, - const std::shared_ptr& theTo) -{ + const std::shared_ptr &theMovedAttribute, + const int theMovedPointIndex, const std::shared_ptr &theFrom, + const std::shared_ptr &theTo) { FeaturePtr anOwner = ModelAPI_Feature::feature(theMovedAttribute->owner()); std::shared_ptr aConstraint = std::dynamic_pointer_cast(anOwner); - if (aConstraint) - { + if (aConstraint) { setPoint(theMovedAttribute, theMovedPointIndex, theTo); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); return true; @@ -389,7 +395,8 @@ bool SketchSolver_Manager::moveAttribute( } aGroup->blockEvents(true); - return aGroup->movePoint(theMovedAttribute, theMovedPointIndex, theFrom, theTo); + return aGroup->movePoint(theMovedAttribute, theMovedPointIndex, theFrom, + theTo); } // ============================================================================ @@ -397,14 +404,13 @@ bool SketchSolver_Manager::moveAttribute( // Purpose: search groups of entities interacting with given feature // ============================================================================ SketchGroupPtr SketchSolver_Manager::findGroup( - std::shared_ptr theFeature) -{ + std::shared_ptr theFeature) { if (!isFeatureValid(theFeature)) return SketchGroupPtr(); // do not process wrong features // Obtain sketch, containing the feature CompositeFeaturePtr aSketch; - const std::set& aRefsList = theFeature->data()->refsToMe(); + const std::set &aRefsList = theFeature->data()->refsToMe(); std::set::const_iterator aRefIt = aRefsList.begin(); for (; aRefIt != aRefsList.end(); ++aRefIt) { FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); @@ -416,8 +422,7 @@ SketchGroupPtr SketchSolver_Manager::findGroup( return findGroup(aSketch); } -SketchGroupPtr SketchSolver_Manager::findGroup(CompositeFeaturePtr theSketch) -{ +SketchGroupPtr SketchSolver_Manager::findGroup(CompositeFeaturePtr theSketch) { if (!theSketch) return SketchGroupPtr(); // not a sketch's feature @@ -436,8 +441,7 @@ SketchGroupPtr SketchSolver_Manager::findGroup(CompositeFeaturePtr theSketch) // Function: resolveConstraints // Purpose: change entities according to available constraints // ============================================================================ -bool SketchSolver_Manager::resolveConstraints() -{ +bool SketchSolver_Manager::resolveConstraints() { bool needToUpdate = false; std::list::const_iterator aGroupIter = myGroups.begin(); for (; aGroupIter != myGroups.end(); ++aGroupIter) { @@ -447,17 +451,17 @@ bool SketchSolver_Manager::resolveConstraints() return needToUpdate; } -void SketchSolver_Manager::releaseFeaturesIfEventsBlocked() const -{ +void SketchSolver_Manager::releaseFeaturesIfEventsBlocked() const { std::list::const_iterator aGroupIter = myGroups.begin(); for (; aGroupIter != myGroups.end(); ++aGroupIter) (*aGroupIter)->blockEvents(false); } -bool SketchSolver_Manager::stopSendUpdate() const -{ -static const Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - // to avoid redisplay of each segment on update by solver one by one in the viewer +bool SketchSolver_Manager::stopSendUpdate() const { + static const Events_ID anUpdateEvent = + Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + // to avoid redisplay of each segment on update by solver one by one in the + // viewer bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); if (isUpdateFlushed) { Events_Loop::loop()->setFlushed(anUpdateEvent, false); @@ -465,7 +469,7 @@ static const Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPD return isUpdateFlushed; } -void SketchSolver_Manager::allowSendUpdate() const -{ - Events_Loop::loop()->setFlushed(Events_Loop::eventByName(EVENT_OBJECT_UPDATED), true); +void SketchSolver_Manager::allowSendUpdate() const { + Events_Loop::loop()->setFlushed( + Events_Loop::eventByName(EVENT_OBJECT_UPDATED), true); } diff --git a/src/SketchSolver/SketchSolver_Manager.h b/src/SketchSolver/SketchSolver_Manager.h index 04a87d2b6..2fbea6bda 100644 --- a/src/SketchSolver/SketchSolver_Manager.h +++ b/src/SketchSolver/SketchSolver_Manager.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_Manager_H_ @@ -34,27 +35,27 @@ class SketchPlugin_Constraint; /** \class SketchSolver_Manager * \ingroup Plugins - * \brief Listens the changes of SketchPlugin features and transforms the Constraint - * feature into the format understandable by sketch solver. + * \brief Listens the changes of SketchPlugin features and transforms the + * Constraint feature into the format understandable by sketch solver. * * \remark This is a singleton. */ -class SketchSolver_Manager : public Events_Listener -{ +class SketchSolver_Manager : public Events_Listener { public: /** \brief Main method to create constraint manager * \return pointer to the singleton */ - static SketchSolver_Manager* instance(); + static SketchSolver_Manager *instance(); /** \brief Implementation of Event Listener method * \param[in] theMessage the data of the event */ - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); /** - * The solver needs all the updated objects are transfered in one group, not one by one. - * This iscreases performance and avoids problems in resolve of only part of the made updates. + * The solver needs all the updated objects are transfered in one group, not + * one by one. This iscreases performance and avoids problems in resolve of + * only part of the made updates. */ virtual bool groupMessages(); @@ -66,35 +67,39 @@ protected: * \param[in] theFeature sketch feature to be changed * \return \c true if the feature changed successfully */ - bool updateFeature(const std::shared_ptr& theFeature); + bool updateFeature(const std::shared_ptr &theFeature); - /** \brief Updates the sketch and related constraints, if the sketch plane is changed - * \param[in] theSketch sketch to be updated - * \return \c true if the sketch plane is changed + /** \brief Updates the sketch and related constraints, if the sketch plane is + * changed \param[in] theSketch sketch to be updated \return \c true if the + * sketch plane is changed */ - bool updateSketch(const std::shared_ptr& theSketch); + bool + updateSketch(const std::shared_ptr &theSketch); /** \brief Move feature * \param[in] theMovedFeature dragged sketch feature * \param[in] theFromPoint original position of the feature - * \param[in] theToPoint prefereble position of the feature (current position of the mouse) - * \return \c true if the feature has been changed successfully + * \param[in] theToPoint prefereble position of the feature (current + * position of the mouse) \return \c true if the feature has been changed + * successfully */ - bool moveFeature(const std::shared_ptr& theMovedFeature, - const std::shared_ptr& theFromPoint, - const std::shared_ptr& theToPoint); + bool moveFeature(const std::shared_ptr &theMovedFeature, + const std::shared_ptr &theFromPoint, + const std::shared_ptr &theToPoint); /** \brief Move feature using its moved attribute - * \param[in] theMovedAttribute dragged point (array of points) attribute of sketch feature - * \param[in] theMovedPointIndex index of dragged point in an array (-1 otherwise) - * \param[in] theFromPoint original position of the moved point - * \param[in] theToPoint prefereble position (current position of the mouse) - * \return \c true if the attribute owner has been changed successfully + * \param[in] theMovedAttribute dragged point (array of points) attribute of + * sketch feature \param[in] theMovedPointIndex index of dragged point in an + * array (-1 otherwise) \param[in] theFromPoint original position of the + * moved point \param[in] theToPoint prefereble position (current + * position of the mouse) \return \c true if the attribute owner has been + * changed successfully */ - bool moveAttribute(const std::shared_ptr& theMovedAttribute, - const int theMovedPointIndex, - const std::shared_ptr& theFromPoint, - const std::shared_ptr& theToPoint); + bool + moveAttribute(const std::shared_ptr &theMovedAttribute, + const int theMovedPointIndex, + const std::shared_ptr &theFromPoint, + const std::shared_ptr &theToPoint); /** \brief Removes a constraint from the manager * \param[in] theConstraint constraint to be removed @@ -103,7 +108,7 @@ protected: bool removeConstraint(std::shared_ptr theConstraint); /** \brief Goes through the list of groups and solve the constraints - * \return \c true, if groups are resolved, and features should be updated + * \return \c true, if groups are resolved, and features should be updated * (send the Update event) */ bool resolveConstraints(); @@ -111,14 +116,17 @@ protected: private: /** \brief Searches group which interact with specified feature * \param[in] theFeature object to be found - * \return Pointer to corresponding group or NULL if the group cannot be created. + * \return Pointer to corresponding group or NULL if the group cannot be + * created. */ SketchGroupPtr findGroup(std::shared_ptr theFeature); /** \brief Searches group related to specified composite feature * \param[in] theSketch sketch to be found - * \return Pointer to corresponding group or NULL if the group cannot be created. + * \return Pointer to corresponding group or NULL if the group cannot be + * created. */ - SketchGroupPtr findGroup(std::shared_ptr theSketch); + SketchGroupPtr + findGroup(std::shared_ptr theSketch); /// \brief Stop sending the Update event until all features updated /// \return \c true, if the last flushed event is Update @@ -131,8 +139,8 @@ private: private: std::list myGroups; ///< Groups of constraints - /// true if computation is performed and all "updates" are generated by this algo - /// and needs no recomputation + /// true if computation is performed and all "updates" are generated by this + /// algo and needs no recomputation bool myIsComputed; }; diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index 4b1ed82ee..dc333924d 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -14,88 +14,82 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include #include +#include #include #include #include #include -#include -#include -#include #include #include #include - +#include +#include +#include SketchSolver_Storage::SketchSolver_Storage(SolverPtr theSolver) - : mySketchSolver(theSolver), - myNeedToResolve(false), - myEventsBlocked(false) -{ + : mySketchSolver(theSolver), myNeedToResolve(false), + myEventsBlocked(false) { // create updaters (constraints processed at first) UpdaterPtr aFeatureUpdater(new PlaneGCSSolver_UpdateFeature); - myUpdaters = UpdaterPtr(new PlaneGCSSolver_UpdateCoincidence(aFeatureUpdater)); + myUpdaters = + UpdaterPtr(new PlaneGCSSolver_UpdateCoincidence(aFeatureUpdater)); } -void SketchSolver_Storage::addConstraint(ConstraintPtr theConstraint, - ConstraintWrapperPtr theSolverConstraint) -{ - std::map::const_iterator - aFound = myConstraintMap.find(theConstraint); +void SketchSolver_Storage::addConstraint( + ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint) { + std::map::const_iterator aFound = + myConstraintMap.find(theConstraint); if (aFound == myConstraintMap.end() || aFound->second != theSolverConstraint) setNeedToResolve(true); -//// if (theSolverConstraints.empty()) { -//// // constraint links to the empty list, add its attributes linked to the empty entities -//// std::list aRefAttrs = -//// theConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); -//// std::list::const_iterator anAttrIt = aRefAttrs.begin(); -//// for (; anAttrIt != aRefAttrs.end(); ++anAttrIt) { -//// AttributeRefAttrPtr aRef = -//// std::dynamic_pointer_cast(*anAttrIt); -//// if (aRef->isObject()) { -//// FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object()); -//// if (aFeature) addEntity(aFeature, EntityWrapperPtr()); -//// } else -//// addEntity(aRef->attr(), EntityWrapperPtr()); -//// } -//// std::list aRefLists = -//// theConstraint->data()->attributes(ModelAPI_AttributeRefList::typeId()); -//// for (anAttrIt = aRefLists.begin(); anAttrIt != aRefLists.end(); ++anAttrIt) { -//// AttributeRefListPtr aRef = -//// std::dynamic_pointer_cast(*anAttrIt); -//// std::list anObj = aRef->list(); -//// std::list::iterator anIt = anObj.begin(); -//// for (; anIt != anObj.end(); ++anIt) { -//// FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); -//// if (aFeature) addEntity(aFeature, EntityWrapperPtr()); -//// } -//// } -//// } -//// else if (theSolverConstraints.front()->type() != CONSTRAINT_PT_PT_COINCIDENT) { -//// // Do not add point-point coincidence, because it is already made by setting -//// // the same parameters for both points -//// std::list::iterator aCIt = theSolverConstraints.begin(); -//// for (; aCIt != theSolverConstraints.end(); ++aCIt) -//// update(*aCIt); -//// } + //// if (theSolverConstraints.empty()) { + //// // constraint links to the empty list, add its attributes linked to + /// the empty entities / std::list aRefAttrs = / + /// theConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); / + /// std::list::const_iterator anAttrIt = aRefAttrs.begin(); / + /// for + ///(; anAttrIt != aRefAttrs.end(); ++anAttrIt) { / AttributeRefAttrPtr + /// aRef = / std::dynamic_pointer_cast(*anAttrIt); + //// if (aRef->isObject()) { + //// FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object()); + //// if (aFeature) addEntity(aFeature, EntityWrapperPtr()); + //// } else + //// addEntity(aRef->attr(), EntityWrapperPtr()); + //// } + //// std::list aRefLists = + //// theConstraint->data()->attributes(ModelAPI_AttributeRefList::typeId()); + //// for (anAttrIt = aRefLists.begin(); anAttrIt != aRefLists.end(); + ///++anAttrIt) { / AttributeRefListPtr aRef = / + /// std::dynamic_pointer_cast(*anAttrIt); / + /// std::list anObj = aRef->list(); / + /// std::list::iterator anIt = anObj.begin(); / for (; anIt != + /// anObj.end(); ++anIt) { / FeaturePtr aFeature = + /// ModelAPI_Feature::feature(*anIt); / if (aFeature) + /// addEntity(aFeature, EntityWrapperPtr()); / } / } / } / else if + /// (theSolverConstraints.front()->type() != CONSTRAINT_PT_PT_COINCIDENT) { / + /// // Do not add point-point coincidence, because it is already made by + /// setting / // the same parameters for both points / + /// std::list::iterator aCIt = + /// theSolverConstraints.begin(); / for (; aCIt != + /// theSolverConstraints.end(); ++aCIt) / update(*aCIt); / } if (!theSolverConstraint || aFound == myConstraintMap.end()) myConstraintMap[theConstraint] = theSolverConstraint; // block events if necessary - if (myEventsBlocked && theConstraint && theConstraint->data() && theConstraint->data()->isValid()) + if (myEventsBlocked && theConstraint && theConstraint->data() && + theConstraint->data()->isValid()) theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked); } -void SketchSolver_Storage::addEntity(FeaturePtr theFeature, - EntityWrapperPtr theSolverEntity) -{ +void SketchSolver_Storage::addEntity(FeaturePtr theFeature, + EntityWrapperPtr theSolverEntity) { if (theSolverEntity) { myFeatureMap[theFeature] = theSolverEntity; setNeedToResolve(true); @@ -106,9 +100,8 @@ void SketchSolver_Storage::addEntity(FeaturePtr theFeature, theFeature->data()->blockSendAttributeUpdated(myEventsBlocked); } -void SketchSolver_Storage::addEntity(AttributePtr theAttribute, - EntityWrapperPtr theSolverEntity) -{ +void SketchSolver_Storage::addEntity(AttributePtr theAttribute, + EntityWrapperPtr theSolverEntity) { if (theSolverEntity) { myAttributeMap[theAttribute] = theSolverEntity; setNeedToResolve(true); @@ -120,23 +113,21 @@ void SketchSolver_Storage::addEntity(AttributePtr theAttribute, theAttribute->owner()->data()->blockSendAttributeUpdated(myEventsBlocked); } - - -const ConstraintWrapperPtr& SketchSolver_Storage::constraint( - const ConstraintPtr& theConstraint) const -{ +const ConstraintWrapperPtr & +SketchSolver_Storage::constraint(const ConstraintPtr &theConstraint) const { static ConstraintWrapperPtr aDummy; - std::map::const_iterator - aFound = myConstraintMap.find(theConstraint); + std::map::const_iterator aFound = + myConstraintMap.find(theConstraint); if (aFound != myConstraintMap.end()) return aFound->second; return aDummy; } -const EntityWrapperPtr& SketchSolver_Storage::entity(const FeaturePtr& theFeature) const -{ - std::map::const_iterator aFound = myFeatureMap.find(theFeature); +const EntityWrapperPtr & +SketchSolver_Storage::entity(const FeaturePtr &theFeature) const { + std::map::const_iterator aFound = + myFeatureMap.find(theFeature); if (aFound != myFeatureMap.end()) return aFound->second; @@ -144,10 +135,10 @@ const EntityWrapperPtr& SketchSolver_Storage::entity(const FeaturePtr& theFeatur return aDummy; } -const EntityWrapperPtr& SketchSolver_Storage::entity(const AttributePtr& theAttribute) const -{ - std::map::const_iterator - aFound = myAttributeMap.find(theAttribute); +const EntityWrapperPtr & +SketchSolver_Storage::entity(const AttributePtr &theAttribute) const { + std::map::const_iterator aFound = + myAttributeMap.find(theAttribute); if (aFound != myAttributeMap.end()) return aFound->second; @@ -157,7 +148,8 @@ const EntityWrapperPtr& SketchSolver_Storage::entity(const AttributePtr& theAttr AttributePtr anAttribute; if (aRefAttr->isObject()) { - /// TODO: Check resultToFeatureOrAttribute() precisely. Create additional unit-test + /// TODO: Check resultToFeatureOrAttribute() precisely. Create additional + /// unit-test FeaturePtr aFeature; resultToFeatureOrAttribute(aRefAttr->object(), aFeature, anAttribute); if (aFeature) @@ -172,38 +164,35 @@ const EntityWrapperPtr& SketchSolver_Storage::entity(const AttributePtr& theAttr return aDummy; } - -void SketchSolver_Storage::removeFeature(FeaturePtr theFeature) -{ +void SketchSolver_Storage::removeFeature(FeaturePtr theFeature) { myFeatureMap.erase(theFeature); myNeedToResolve = true; } -void SketchSolver_Storage::removeAttribute(AttributePtr theAttribute) -{ +void SketchSolver_Storage::removeAttribute(AttributePtr theAttribute) { myAttributeMap.erase(theAttribute); myNeedToResolve = true; } - -bool SketchSolver_Storage::areFeaturesValid() const -{ +bool SketchSolver_Storage::areFeaturesValid() const { // Check the features are valid - std::map::const_iterator aFIter = myFeatureMap.begin(); + std::map::const_iterator aFIter = + myFeatureMap.begin(); for (; aFIter != myFeatureMap.end(); aFIter++) if (!aFIter->first->data() || !aFIter->first->data()->isValid()) return false; return true; } -void SketchSolver_Storage::blockEvents(bool isBlocked) -{ - std::map::const_iterator aFIter = myFeatureMap.begin(); +void SketchSolver_Storage::blockEvents(bool isBlocked) { + std::map::const_iterator aFIter = + myFeatureMap.begin(); for (; aFIter != myFeatureMap.end(); aFIter++) if (aFIter->first->data() && aFIter->first->data()->isValid()) aFIter->first->data()->blockSendAttributeUpdated(isBlocked); - std::map::const_iterator anAtIter = myAttributeMap.begin(); + std::map::const_iterator anAtIter = + myAttributeMap.begin(); for (; anAtIter != myAttributeMap.end(); anAtIter++) if (anAtIter->first->owner() && anAtIter->first->owner()->data() && anAtIter->first->owner()->data()->isValid()) @@ -212,11 +201,11 @@ void SketchSolver_Storage::blockEvents(bool isBlocked) myEventsBlocked = isBlocked; } -std::set SketchSolver_Storage::getConflictingConstraints(SolverPtr theSolver) const -{ +std::set +SketchSolver_Storage::getConflictingConstraints(SolverPtr theSolver) const { std::set aConflicting; - std::map::const_iterator - aConstrIt = myConstraintMap.begin(); + std::map::const_iterator aConstrIt = + myConstraintMap.begin(); for (; aConstrIt != myConstraintMap.end(); ++aConstrIt) { if (theSolver->isConflicting(aConstrIt->second->id())) aConflicting.insert(aConstrIt->first); @@ -225,30 +214,28 @@ std::set SketchSolver_Storage::getConflictingConstraints(SolverPtr th } void SketchSolver_Storage::subscribeUpdates( - SketchSolver_Constraint* theSubscriber, const std::string& theGroup) const -{ + SketchSolver_Constraint *theSubscriber, const std::string &theGroup) const { myUpdaters->attach(theSubscriber, theGroup); } -void SketchSolver_Storage::unsubscribeUpdates(SketchSolver_Constraint* theSubscriber) const -{ +void SketchSolver_Storage::unsubscribeUpdates( + SketchSolver_Constraint *theSubscriber) const { myUpdaters->detach(theSubscriber); } -void SketchSolver_Storage::notify(const FeaturePtr & theFeature) const -{ +void SketchSolver_Storage::notify(const FeaturePtr &theFeature) const { myUpdaters->update(theFeature); } -void SketchSolver_Storage::resultToFeatureOrAttribute(const ObjectPtr& theResult, - FeaturePtr& theFeature, AttributePtr& theAttribute) -{ +void SketchSolver_Storage::resultToFeatureOrAttribute( + const ObjectPtr &theResult, FeaturePtr &theFeature, + AttributePtr &theAttribute) { FeaturePtr aFeature = ModelAPI_Feature::feature(theResult); if (!aFeature) return; // if the feature has several results, we choose which one is referred - const std::list& aResults = aFeature->results(); + const std::list &aResults = aFeature->results(); if (aResults.size() > 1 && theResult != aFeature->lastResult()) { // actually, the attribute refers to center of arc or circle, // but not the edge, get correct attributes diff --git a/src/SketchSolver/SketchSolver_Storage.h b/src/SketchSolver/SketchSolver_Storage.h index 281913257..339e17116 100644 --- a/src/SketchSolver/SketchSolver_Storage.h +++ b/src/SketchSolver/SketchSolver_Storage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketchSolver_Storage_H_ @@ -33,18 +34,18 @@ class SketchSolver_ConstraintDistance; class SketchSolver_ConstraintFixedArcRadius; -typedef std::map > CoincidentPointsMap; - +typedef std::map> + CoincidentPointsMap; /** \class SketchSolver_Storage * \ingroup Plugins - * \brief Interface to map SketchPlugin features to the entities of corresponding solver. + * \brief Interface to map SketchPlugin features to the entities of + * corresponding solver. */ -class SketchSolver_Storage -{ +class SketchSolver_Storage { private: - SketchSolver_Storage(const SketchSolver_Storage&); - SketchSolver_Storage& operator=(const SketchSolver_Storage&); + SketchSolver_Storage(const SketchSolver_Storage &); + SketchSolver_Storage &operator=(const SketchSolver_Storage &); public: SketchSolver_Storage(SolverPtr theSolver); @@ -53,55 +54,56 @@ public: /// a constraint applicable for corresponding solver. /// \param theConstraint [in] original SketchPlugin constraint /// \param theSolverConstraint [in] solver's constraint - virtual void addConstraint(ConstraintPtr theConstraint, + virtual void addConstraint(ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint); /// \brief Add a movement constraint which will be destroyed /// after the next solving of the set of constraints. /// \param theSolverConstraint [in] solver's constraint - virtual void addMovementConstraint(const ConstraintWrapperPtr& theSolverConstraint) = 0; + virtual void + addMovementConstraint(const ConstraintWrapperPtr &theSolverConstraint) = 0; /// \brief Change mapping feature from SketchPlugin and /// the entity applicable for corresponding solver. /// \param theFeature [in] original SketchPlugin feature /// \param theSolverEntity [in] solver's entity, created outside - void addEntity(FeaturePtr theFeature, - EntityWrapperPtr theSolverEntity); + void addEntity(FeaturePtr theFeature, EntityWrapperPtr theSolverEntity); /// \brief Change mapping attribute of a feature and the entity /// applicable for corresponding solver. /// \param theAttribute [in] original attribute /// \param theSolverEntity [in] solver's entity, created outside - void addEntity(AttributePtr theAttribute, - EntityWrapperPtr theSolverEntity); + void addEntity(AttributePtr theAttribute, EntityWrapperPtr theSolverEntity); - /// \brief Convert feature to the form applicable for specific solver and map it - /// \param theFeature [in] feature to convert - /// \param theForce [in] forced feature creation - /// \return \c true if the feature has been created or updated + /// \brief Convert feature to the form applicable for specific solver and map + /// it \param theFeature [in] feature to convert \param theForce [in] + /// forced feature creation \return \c true if the feature has been created or + /// updated virtual bool update(FeaturePtr theFeature, bool theForce = false) = 0; - /// \brief Convert attribute to the form applicable for specific solver and map it - /// \param theAttribute [in] attribute to convert - /// \param theForce [in] forced feature creation - /// \return \c true if the attribute has been created or updated + /// \brief Convert attribute to the form applicable for specific solver and + /// map it \param theAttribute [in] attribute to convert \param theForce [in] + /// forced feature creation \return \c true if the attribute has been created + /// or updated virtual bool update(AttributePtr theAttribute, bool theForce = false) = 0; /// \brief Returns constraint related to corresponding constraint - const ConstraintWrapperPtr& constraint(const ConstraintPtr& theConstraint) const; + const ConstraintWrapperPtr & + constraint(const ConstraintPtr &theConstraint) const; /// \brief Returns entity related to corresponding feature - const EntityWrapperPtr& entity(const FeaturePtr& theFeature) const; + const EntityWrapperPtr &entity(const FeaturePtr &theFeature) const; /// \brief Returns entity related to corresponding attribute - const EntityWrapperPtr& entity(const AttributePtr& theAttribute) const; + const EntityWrapperPtr &entity(const AttributePtr &theAttribute) const; /// \brief Make entity external - virtual void makeExternal(const EntityWrapperPtr& theEntity) = 0; + virtual void makeExternal(const EntityWrapperPtr &theEntity) = 0; /// \brief Make entity non-external - virtual void makeNonExternal(const EntityWrapperPtr& theEntity) = 0; + virtual void makeNonExternal(const EntityWrapperPtr &theEntity) = 0; /// \brief Removes constraint from the storage - /// \return \c true if the constraint and all its parameters are removed successfully + /// \return \c true if the constraint and all its parameters are removed + /// successfully virtual bool removeConstraint(ConstraintPtr theConstraint) = 0; /// \brief Removes feature from the storage void removeFeature(FeaturePtr theFeature); @@ -115,26 +117,25 @@ public: bool areFeaturesValid() const; /// \brief Check the storage has constraints - virtual bool isEmpty() const - { return myConstraintMap.empty(); } + virtual bool isEmpty() const { return myConstraintMap.empty(); } /// \brief Shows the sketch should be resolved - virtual bool isNeedToResolve() - { return myNeedToResolve; } + virtual bool isNeedToResolve() { return myNeedToResolve; } /// \brief Changes the flag of group to be resolved - void setNeedToResolve(bool theFlag) - { myNeedToResolve = theFlag; } + void setNeedToResolve(bool theFlag) { myNeedToResolve = theFlag; } /// \brief Return list of conflicting constraints std::set getConflictingConstraints(SolverPtr theSolver) const; /// \brief Return list of features which are not fully constrained - virtual void getUnderconstrainedGeometry(std::set& theFeatures) const = 0; + virtual void + getUnderconstrainedGeometry(std::set &theFeatures) const = 0; /// \brief Verify, the sketch contains degenerated geometry /// after resolving the set of constraints /// \return STATUS_OK if the geometry is valid, STATUS_DEGENERATED otherwise. - virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const = 0; + virtual PlaneGCSSolver_Solver::SolveStatus + checkDegeneratedGeometry() const = 0; /// \brief Update SketchPlugin features after resolving constraints virtual void refresh() const = 0; @@ -145,36 +146,41 @@ public: /// \brief Subscribe for updates of features /// \param theSubscriber [in] object which wants to revceive notifications /// \param theGroup [in] group of updates features to be send - void subscribeUpdates(SketchSolver_Constraint* theSubscriber, const std::string& theGroup) const; + void subscribeUpdates(SketchSolver_Constraint *theSubscriber, + const std::string &theGroup) const; /// \brief Unsubscribe for updates of features - /// \param theSubscriber [in] object which does not want to revceive notifications anymore - void unsubscribeUpdates(SketchSolver_Constraint* theSubscriber) const; + /// \param theSubscriber [in] object which does not want to revceive + /// notifications anymore + void unsubscribeUpdates(SketchSolver_Constraint *theSubscriber) const; /// \brief Notify all subscribers about update of the feature - void notify(const FeaturePtr& theFeature) const; + void notify(const FeaturePtr &theFeature) const; /// \brief Make parametrization of arcs consistent. - /// Forward arcs should have the last parameter greater than the first parameter. - /// Reversed arcs should have the last parameter lesser than the first parameter. + /// Forward arcs should have the last parameter greater than the first + /// parameter. Reversed arcs should have the last parameter lesser than + /// the first parameter. virtual void adjustParametrizationOfArcs() = 0; protected: - /// \brief Convert result to feature or attribute if theResult is linked to center of circle/arc - static void resultToFeatureOrAttribute(const ObjectPtr& theResult, - FeaturePtr& theFeature, - AttributePtr& theAttribute); + /// \brief Convert result to feature or attribute if theResult is linked to + /// center of circle/arc + static void resultToFeatureOrAttribute(const ObjectPtr &theResult, + FeaturePtr &theFeature, + AttributePtr &theAttribute); protected: SolverPtr mySketchSolver; ///< Sketch solver, prepared in corresponding group - bool myNeedToResolve; ///< parameters are changed and group needs to be resolved - bool myEventsBlocked; ///< indicates that features do not send events + bool myNeedToResolve; ///< parameters are changed and group needs to be + ///< resolved + bool myEventsBlocked; ///< indicates that features do not send events /// map SketchPlugin constraint to a list of solver's constraints std::map myConstraintMap; /// map SketchPlugin feature to solver's entity - std::map myFeatureMap; + std::map myFeatureMap; /// map attribute to solver's entity - std::map myAttributeMap; + std::map myAttributeMap; UpdaterPtr myUpdaters; }; diff --git a/src/SketchSolver/SketchSolver_msg_en.ts b/src/SketchSolver/SketchSolver_msg_en.ts index acb900786..e7546aba5 100644 --- a/src/SketchSolver/SketchSolver_msg_en.ts +++ b/src/SketchSolver/SketchSolver_msg_en.ts @@ -21,4 +21,3 @@ - diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp index c281c41ff..2571acc23 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include +#include +#include +#include +#include #include #include -#include -#include -#include -#include #include @@ -39,28 +40,28 @@ #include #include +#include +#include #include #include -#include -#include #include - -static EntityWrapperPtr createLine(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID); -static EntityWrapperPtr createCircle(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID); -static EntityWrapperPtr createArc(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID); - -/// \brief Set flags of constraint to identify which points are coincident in the Tangency +static EntityWrapperPtr +createLine(FeaturePtr theFeature, + const std::list &theAttributes, + const GroupID &theGroupID, const EntityID &theSketchID); +static EntityWrapperPtr +createCircle(FeaturePtr theFeature, + const std::list &theAttributes, + const GroupID &theGroupID, const EntityID &theSketchID); +static EntityWrapperPtr +createArc(FeaturePtr theFeature, + const std::list &theAttributes, + const GroupID &theGroupID, const EntityID &theSketchID); + +/// \brief Set flags of constraint to identify which points are coincident in +/// the Tangency /// (for more information, see SolveSpace documentation) static void adjustTangency(ConstraintWrapperPtr theConstraint); /// \brief Set flags for angle constraint @@ -75,13 +76,11 @@ static void makeMirrorPoints(EntityWrapperPtr theOriginal, EntityWrapperPtr theMirrored, EntityWrapperPtr theMirrorLine); - - // Initialization of constraint builder self pointer -BuilderPtr SolveSpaceSolver_Builder::mySelf = SolveSpaceSolver_Builder::getInstance(); +BuilderPtr SolveSpaceSolver_Builder::mySelf = + SolveSpaceSolver_Builder::getInstance(); -BuilderPtr SolveSpaceSolver_Builder::getInstance() -{ +BuilderPtr SolveSpaceSolver_Builder::getInstance() { if (!mySelf) { mySelf = BuilderPtr(new SolveSpaceSolver_Builder); SketchSolver_Manager::instance()->setBuilder(mySelf); @@ -89,45 +88,39 @@ BuilderPtr SolveSpaceSolver_Builder::getInstance() return mySelf; } -StoragePtr SolveSpaceSolver_Builder::createStorage(const GroupID& theGroup) const -{ +StoragePtr +SolveSpaceSolver_Builder::createStorage(const GroupID &theGroup) const { return StoragePtr(new SolveSpaceSolver_Storage(theGroup)); } -SolverPtr SolveSpaceSolver_Builder::createSolver() const -{ +SolverPtr SolveSpaceSolver_Builder::createSolver() const { return SolverPtr(new SolveSpaceSolver_Solver); } - std::list SolveSpaceSolver_Builder::createConstraint( - ConstraintPtr theConstraint, - const GroupID& theGroupID, - const EntityID& theSketchID, - const SketchSolver_ConstraintType& theType, - const double& theValue, - const EntityWrapperPtr& thePoint1, - const EntityWrapperPtr& thePoint2, - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2) const -{ + ConstraintPtr theConstraint, const GroupID &theGroupID, + const EntityID &theSketchID, const SketchSolver_ConstraintType &theType, + const double &theValue, const EntityWrapperPtr &thePoint1, + const EntityWrapperPtr &thePoint2, const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2) const { if (theType == CONSTRAINT_SYMMETRIC) - return createMirror(theConstraint, theGroupID, theSketchID, - thePoint1, thePoint2, theEntity1); + return createMirror(theConstraint, theGroupID, theSketchID, thePoint1, + thePoint2, theEntity1); else if (theType == CONSTRAINT_TANGENT_CIRCLE_LINE) { // replace by distance from center of circle to the line - const std::list& aSubs = theEntity1->subEntities(); + const std::list &aSubs = theEntity1->subEntities(); EntityWrapperPtr aCenter = aSubs.front(); - AttributeDoublePtr aRadius = std::dynamic_pointer_cast( - aSubs.back()->baseAttribute()); + AttributeDoublePtr aRadius = + std::dynamic_pointer_cast( + aSubs.back()->baseAttribute()); return createConstraint(theConstraint, theGroupID, theSketchID, - CONSTRAINT_PT_LINE_DISTANCE, aRadius->value(), aCenter, EntityWrapperPtr(), theEntity2); - } - else if (theType == CONSTRAINT_COLLINEAR) { + CONSTRAINT_PT_LINE_DISTANCE, aRadius->value(), + aCenter, EntityWrapperPtr(), theEntity2); + } else if (theType == CONSTRAINT_COLLINEAR) { // replace by two constraints point-on-line std::list aConstraints; - const std::list& aSubs1 = theEntity1->subEntities(); - const std::list& aSubs2 = theEntity2->subEntities(); + const std::list &aSubs1 = theEntity1->subEntities(); + const std::list &aSubs2 = theEntity2->subEntities(); std::list::const_iterator anIt1, anIt2; for (anIt2 = aSubs2.begin(); anIt2 != aSubs2.end(); ++anIt2) { for (anIt1 = aSubs1.begin(); anIt1 != aSubs1.end(); ++anIt1) @@ -136,8 +129,9 @@ std::list SolveSpaceSolver_Builder::createConstraint( if (anIt1 != aSubs1.end()) continue; // the lines have coincident point - std::list aC = createConstraint(theConstraint, theGroupID, - theSketchID, CONSTRAINT_PT_ON_LINE, theValue, *anIt2, EntityWrapperPtr(), theEntity1); + std::list aC = createConstraint( + theConstraint, theGroupID, theSketchID, CONSTRAINT_PT_ON_LINE, + theValue, *anIt2, EntityWrapperPtr(), theEntity1); aConstraints.insert(aConstraints.end(), aC.begin(), aC.end()); } return aConstraints; @@ -147,8 +141,10 @@ std::list SolveSpaceSolver_Builder::createConstraint( if (aType == SLVS_C_UNKNOWN) return std::list(); - Slvs_hEntity aSlvsEntities[4] = {SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN}; - EntityWrapperPtr anOriginal[4] = {thePoint1, thePoint2, theEntity1, theEntity2}; + Slvs_hEntity aSlvsEntities[4] = {SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, + SLVS_E_UNKNOWN, SLVS_E_UNKNOWN}; + EntityWrapperPtr anOriginal[4] = {thePoint1, thePoint2, theEntity1, + theEntity2}; std::list aConstrAttrList; // to be filled for (int i = 0; i < 4; ++i) { if (!anOriginal[i]) @@ -160,10 +156,12 @@ std::list SolveSpaceSolver_Builder::createConstraint( aConstrAttrList.push_back(anOriginal[i]); } - Slvs_Constraint aConstraint = Slvs_MakeConstraint( - SLVS_C_UNKNOWN, (Slvs_hGroup)theGroupID, aType, (Slvs_hEntity)theSketchID, - theValue, aSlvsEntities[0], aSlvsEntities[1], aSlvsEntities[2], aSlvsEntities[3]); - ConstraintWrapperPtr aResult(new SolveSpaceSolver_ConstraintWrapper(theConstraint, aConstraint)); + Slvs_Constraint aConstraint = + Slvs_MakeConstraint(SLVS_C_UNKNOWN, (Slvs_hGroup)theGroupID, aType, + (Slvs_hEntity)theSketchID, theValue, aSlvsEntities[0], + aSlvsEntities[1], aSlvsEntities[2], aSlvsEntities[3]); + ConstraintWrapperPtr aResult( + new SolveSpaceSolver_ConstraintWrapper(theConstraint, aConstraint)); aResult->setGroup(theGroupID); aResult->setValue(theValue); aResult->setEntities(aConstrAttrList); @@ -173,25 +171,21 @@ std::list SolveSpaceSolver_Builder::createConstraint( } std::list SolveSpaceSolver_Builder::createConstraint( - ConstraintPtr theConstraint, - const GroupID& theGroupID, - const EntityID& theSketchID, - const SketchSolver_ConstraintType& theType, - const double& theValue, - const bool theFullValue, - const EntityWrapperPtr& thePoint1, - const EntityWrapperPtr& thePoint2, - const std::list& theTrsfEnt) const -{ - if (theType != CONSTRAINT_MULTI_ROTATION && theType != CONSTRAINT_MULTI_TRANSLATION) + ConstraintPtr theConstraint, const GroupID &theGroupID, + const EntityID &theSketchID, const SketchSolver_ConstraintType &theType, + const double &theValue, const bool theFullValue, + const EntityWrapperPtr &thePoint1, const EntityWrapperPtr &thePoint2, + const std::list &theTrsfEnt) const { + if (theType != CONSTRAINT_MULTI_ROTATION && + theType != CONSTRAINT_MULTI_TRANSLATION) return std::list(); int aType = ConstraintType::toSolveSpace(theType); if (aType == SLVS_C_UNKNOWN) return std::list(); - Slvs_Constraint aConstraint = - Slvs_MakeConstraint(SLVS_C_UNKNOWN, (Slvs_hGroup)theGroupID, aType, (Slvs_hEntity)theSketchID, + Slvs_Constraint aConstraint = Slvs_MakeConstraint( + SLVS_C_UNKNOWN, (Slvs_hGroup)theGroupID, aType, (Slvs_hEntity)theSketchID, theValue, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); std::list aConstrAttrList = theTrsfEnt; @@ -199,7 +193,8 @@ std::list SolveSpaceSolver_Builder::createConstraint( aConstrAttrList.push_front(thePoint2); aConstrAttrList.push_front(thePoint1); - ConstraintWrapperPtr aResult(new SolveSpaceSolver_ConstraintWrapper(theConstraint, aConstraint)); + ConstraintWrapperPtr aResult( + new SolveSpaceSolver_ConstraintWrapper(theConstraint, aConstraint)); aResult->setGroup(theGroupID); aResult->setValue(theValue); aResult->setIsFullValue(theFullValue); @@ -207,15 +202,11 @@ std::list SolveSpaceSolver_Builder::createConstraint( return std::list(1, aResult); } - std::list SolveSpaceSolver_Builder::createMirror( - ConstraintPtr theConstraint, - const GroupID& theGroupID, - const EntityID& theSketchID, - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2, - const EntityWrapperPtr& theMirrorLine) const -{ + ConstraintPtr theConstraint, const GroupID &theGroupID, + const EntityID &theSketchID, const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2, + const EntityWrapperPtr &theMirrorLine) const { Slvs_Constraint aConstraint; std::list aResult; std::list aConstrAttrList; @@ -223,76 +214,82 @@ std::list SolveSpaceSolver_Builder::createMirror( makeMirrorPoints(theEntity1, theEntity2, theMirrorLine); aConstraint = Slvs_MakeConstraint( - SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, SLVS_C_SYMMETRIC_LINE, (Slvs_hEntity)theSketchID, - 0.0, (Slvs_hEntity)theEntity1->id(), (Slvs_hEntity)theEntity2->id(), - (Slvs_hEntity)theMirrorLine->id(), SLVS_E_UNKNOWN); + SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, SLVS_C_SYMMETRIC_LINE, + (Slvs_hEntity)theSketchID, 0.0, (Slvs_hEntity)theEntity1->id(), + (Slvs_hEntity)theEntity2->id(), (Slvs_hEntity)theMirrorLine->id(), + SLVS_E_UNKNOWN); aConstrAttrList.push_back(theEntity1); aConstrAttrList.push_back(theEntity2); aConstrAttrList.push_back(theMirrorLine); - ConstraintWrapperPtr aWrapper(new SolveSpaceSolver_ConstraintWrapper( - theConstraint, aConstraint)); + ConstraintWrapperPtr aWrapper( + new SolveSpaceSolver_ConstraintWrapper(theConstraint, aConstraint)); aWrapper->setGroup(theGroupID); aWrapper->setEntities(aConstrAttrList); aResult.push_back(aWrapper); - } - else if (theEntity1->type() == ENTITY_LINE) { - const std::list& aPoints1 = theEntity1->subEntities(); - const std::list& aPoints2 = theEntity2->subEntities(); + } else if (theEntity1->type() == ENTITY_LINE) { + const std::list &aPoints1 = theEntity1->subEntities(); + const std::list &aPoints2 = theEntity2->subEntities(); std::list::const_iterator anIt1 = aPoints1.begin(); std::list::const_iterator anIt2 = aPoints2.begin(); - for (; anIt1 != aPoints1.end() && anIt2 != aPoints2.end(); ++anIt1, ++anIt2) { + for (; anIt1 != aPoints1.end() && anIt2 != aPoints2.end(); + ++anIt1, ++anIt2) { std::list aMrrList = - createMirror(theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, theMirrorLine); + createMirror(theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, + theMirrorLine); aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end()); } - } - else if (theEntity1->type() == ENTITY_CIRCLE) { - const std::list& aPoints1 = theEntity1->subEntities(); + } else if (theEntity1->type() == ENTITY_CIRCLE) { + const std::list &aPoints1 = theEntity1->subEntities(); std::list::const_iterator anIt1 = aPoints1.begin(); for (; anIt1 != aPoints1.end(); ++anIt1) if ((*anIt1)->type() == ENTITY_POINT) break; - const std::list& aPoints2 = theEntity2->subEntities(); + const std::list &aPoints2 = theEntity2->subEntities(); std::list::const_iterator anIt2 = aPoints2.begin(); for (; anIt2 != aPoints2.end(); ++anIt2) if ((*anIt2)->type() == ENTITY_POINT) break; - std::list aMrrList = - createMirror(theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, theMirrorLine); + std::list aMrrList = createMirror( + theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, theMirrorLine); aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end()); // Additional constraint for equal radii - aMrrList = createConstraint(theConstraint, theGroupID, theSketchID, CONSTRAINT_EQUAL_RADIUS, - 0.0, EntityWrapperPtr(), EntityWrapperPtr(), theEntity1, theEntity2); + aMrrList = createConstraint( + theConstraint, theGroupID, theSketchID, CONSTRAINT_EQUAL_RADIUS, 0.0, + EntityWrapperPtr(), EntityWrapperPtr(), theEntity1, theEntity2); aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end()); - } - else if (theEntity1->type() == ENTITY_ARC) { + } else if (theEntity1->type() == ENTITY_ARC) { // Do not allow mirrored arc recalculate its position until // coordinated of all points recalculated FeaturePtr aMirrArc = theEntity2->baseFeature(); bool aWasBlocked = aMirrArc->data()->blockSendAttributeUpdated(true); std::list aMrrList; - std::list::const_iterator anIt1 = theEntity1->subEntities().begin(); - std::list::const_iterator anIt2 = theEntity2->subEntities().begin(); + std::list::const_iterator anIt1 = + theEntity1->subEntities().begin(); + std::list::const_iterator anIt2 = + theEntity2->subEntities().begin(); makeMirrorPoints(*anIt1, *anIt2, theMirrorLine); // Workaround to avoid problems in SolveSpace. - // The symmetry of two arcs will be done using symmetry of three points on these arcs: - // start point, end point, and any other point on the arc - std::list aBaseArcPoints(++anIt1, theEntity1->subEntities().end()); - std::list aMirrorArcPoints(++anIt2, theEntity2->subEntities().end()); - // indices of points of arc, center corresponds center, first point corresponds last point + // The symmetry of two arcs will be done using symmetry of three points on + // these arcs: start point, end point, and any other point on the arc + std::list aBaseArcPoints(++anIt1, + theEntity1->subEntities().end()); + std::list aMirrorArcPoints( + ++anIt2, theEntity2->subEntities().end()); + // indices of points of arc, center corresponds center, first point + // corresponds last point aMirrorArcPoints.reverse(); anIt1 = aBaseArcPoints.begin(); anIt2 = aMirrorArcPoints.begin(); for (; anIt1 != aBaseArcPoints.end(); ++anIt1, ++anIt2) { - aMrrList = - createMirror(theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, theMirrorLine); + aMrrList = createMirror(theConstraint, theGroupID, theSketchID, *anIt1, + *anIt2, theMirrorLine); aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end()); } // Restore event sending @@ -301,11 +298,12 @@ std::list SolveSpaceSolver_Builder::createMirror( return aResult; } -void SolveSpaceSolver_Builder::adjustConstraint(ConstraintWrapperPtr theConstraint) const -{ +void SolveSpaceSolver_Builder::adjustConstraint( + ConstraintWrapperPtr theConstraint) const { SketchSolver_ConstraintType aType = theConstraint->type(); // Update flags in constraints - if (aType == CONSTRAINT_TANGENT_ARC_ARC || aType == CONSTRAINT_TANGENT_ARC_LINE) + if (aType == CONSTRAINT_TANGENT_ARC_ARC || + aType == CONSTRAINT_TANGENT_ARC_LINE) adjustTangency(theConstraint); else if (aType == CONSTRAINT_ANGLE) adjustAngle(theConstraint); @@ -316,17 +314,15 @@ void SolveSpaceSolver_Builder::adjustConstraint(ConstraintWrapperPtr theConstrai } EntityWrapperPtr SolveSpaceSolver_Builder::createFeature( - FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID) const -{ + FeaturePtr theFeature, const std::list &theAttributes, + const GroupID &theGroupID, const EntityID &theSketchID) const { static EntityWrapperPtr aDummy; if (!theFeature->data()->isValid()) return aDummy; // Sketch - CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(theFeature); + CompositeFeaturePtr aSketch = + std::dynamic_pointer_cast(theFeature); if (aSketch) return createSketchEntity(aSketch, theGroupID); @@ -337,7 +333,7 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createFeature( return aDummy; // Verify the feature by its kind - const std::string& aFeatureKind = aFeature->getKind(); + const std::string &aFeatureKind = aFeature->getKind(); // Line if (aFeatureKind == SketchPlugin_Line::ID()) return createLine(theFeature, theAttributes, theGroupID, theSketchID); @@ -347,21 +343,24 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createFeature( // Arc else if (aFeatureKind == SketchPlugin_Arc::ID()) return createArc(theFeature, theAttributes, theGroupID, theSketchID); - // Point (it has low probability to be an attribute of constraint, so it is checked at the end) + // Point (it has low probability to be an attribute of constraint, so it is + // checked at the end) else if (aFeatureKind == SketchPlugin_Point::ID() || aFeatureKind == SketchPlugin_IntersectionPoint::ID()) { AttributePtr aPoint = theFeature->attribute(SketchPlugin_Point::COORD_ID()); if (!aPoint->isInitialized()) return aDummy; - EntityWrapperPtr aSub = theAttributes.empty() ? - createAttribute(aPoint, theGroupID, theSketchID) : - theAttributes.front(); + EntityWrapperPtr aSub = + theAttributes.empty() ? createAttribute(aPoint, theGroupID, theSketchID) + : theAttributes.front(); if (!aSub) return aDummy; - const Slvs_Entity& aSubEnt = - std::dynamic_pointer_cast(aSub)->entity(); - EntityWrapperPtr aResult(new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt)); + const Slvs_Entity &aSubEnt = + std::dynamic_pointer_cast(aSub) + ->entity(); + EntityWrapperPtr aResult( + new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt)); aResult->setSubEntities(theAttributes); return aResult; } @@ -370,11 +369,10 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createFeature( return aDummy; } -EntityWrapperPtr SolveSpaceSolver_Builder::createAttribute( - AttributePtr theAttribute, - const GroupID& theGroupID, - const EntityID& theSketchID) const -{ +EntityWrapperPtr +SolveSpaceSolver_Builder::createAttribute(AttributePtr theAttribute, + const GroupID &theGroupID, + const EntityID &theSketchID) const { AttributePtr anAttribute = theAttribute; AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(anAttribute); @@ -394,34 +392,38 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createAttribute( std::shared_ptr aPoint = std::dynamic_pointer_cast(theAttribute); if (aPoint) { - aParameters.push_back(createParameter(theGroupID, aPoint->x(), !aPoint->textX().empty())); - aParameters.push_back(createParameter(theGroupID, aPoint->y(), !aPoint->textY().empty())); - aParameters.push_back(createParameter(theGroupID, aPoint->z(), !aPoint->textZ().empty())); + aParameters.push_back( + createParameter(theGroupID, aPoint->x(), !aPoint->textX().empty())); + aParameters.push_back( + createParameter(theGroupID, aPoint->y(), !aPoint->textY().empty())); + aParameters.push_back( + createParameter(theGroupID, aPoint->z(), !aPoint->textZ().empty())); // Create entity (parameters are not filled) anEntity = Slvs_MakePoint3d(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); + SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); } else { // Point in 2D std::shared_ptr aPoint2D = - std::dynamic_pointer_cast(theAttribute); + std::dynamic_pointer_cast(theAttribute); if (aPoint2D) { aParameters.push_back(createParameter(theGroupID, aPoint2D->x(), - !aPoint2D->textX().empty())); + !aPoint2D->textX().empty())); aParameters.push_back(createParameter(theGroupID, aPoint2D->y(), - !aPoint2D->textY().empty())); + !aPoint2D->textY().empty())); // Create entity (parameters are not filled) anEntity = Slvs_MakePoint2d(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - (Slvs_hEntity)theSketchID, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); + (Slvs_hEntity)theSketchID, SLVS_E_UNKNOWN, + SLVS_E_UNKNOWN); } else { // Scalar value (used for the distance entities) AttributeDoublePtr aScalar = std::dynamic_pointer_cast(theAttribute); if (aScalar) { aParameters.push_back(createParameter(theGroupID, aScalar->value(), - !aScalar->text().empty())); + !aScalar->text().empty())); // Create entity (parameter is not filled) anEntity = Slvs_MakeDistance(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - (Slvs_hEntity)theSketchID, SLVS_E_UNKNOWN); + (Slvs_hEntity)theSketchID, SLVS_E_UNKNOWN); } } } @@ -431,26 +433,26 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createAttribute( return EntityWrapperPtr(); } - EntityWrapperPtr aResult(new SolveSpaceSolver_EntityWrapper(theAttribute, anEntity)); + EntityWrapperPtr aResult( + new SolveSpaceSolver_EntityWrapper(theAttribute, anEntity)); aResult->setParameters(aParameters); return aResult; } - - -EntityWrapperPtr SolveSpaceSolver_Builder::createSketchEntity( - CompositeFeaturePtr theSketch, - const GroupID& theGroupID) const -{ +EntityWrapperPtr +SolveSpaceSolver_Builder::createSketchEntity(CompositeFeaturePtr theSketch, + const GroupID &theGroupID) const { DataPtr aSketchData = theSketch->data(); if (!aSketchData || !aSketchData->isValid()) return EntityWrapperPtr(); // the sketch is incorrect // Get parameters of workplane - AttributePtr aDirX = aSketchData->attribute(SketchPlugin_Sketch::DIRX_ID()); - AttributePtr aNorm = aSketchData->attribute(SketchPlugin_Sketch::NORM_ID()); - AttributePtr anOrigin = aSketchData->attribute(SketchPlugin_Sketch::ORIGIN_ID()); - if (!anOrigin->isInitialized() || !aNorm->isInitialized() || !aDirX->isInitialized()) + AttributePtr aDirX = aSketchData->attribute(SketchPlugin_Sketch::DIRX_ID()); + AttributePtr aNorm = aSketchData->attribute(SketchPlugin_Sketch::NORM_ID()); + AttributePtr anOrigin = + aSketchData->attribute(SketchPlugin_Sketch::ORIGIN_ID()); + if (!anOrigin->isInitialized() || !aNorm->isInitialized() || + !aDirX->isInitialized()) return EntityWrapperPtr(); EntityWrapperPtr aNewEnt; @@ -469,8 +471,8 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createSketchEntity( aSubs.push_back(aNewEnt); // Create workplane - Slvs_Entity aWorkplane = Slvs_MakeWorkplane(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); + Slvs_Entity aWorkplane = Slvs_MakeWorkplane( + SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); aNewEnt = EntityWrapperPtr( new SolveSpaceSolver_EntityWrapper(FeaturePtr(theSketch), aWorkplane)); @@ -478,25 +480,27 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createSketchEntity( return aNewEnt; } -EntityWrapperPtr SolveSpaceSolver_Builder::createNormal( - AttributePtr theNormal, - AttributePtr theDirX, - const GroupID& theGroupID) const -{ - std::shared_ptr aNorm = std::dynamic_pointer_cast(theNormal); - std::shared_ptr aDirX = std::dynamic_pointer_cast(theDirX); +EntityWrapperPtr +SolveSpaceSolver_Builder::createNormal(AttributePtr theNormal, + AttributePtr theDirX, + const GroupID &theGroupID) const { + std::shared_ptr aNorm = + std::dynamic_pointer_cast(theNormal); + std::shared_ptr aDirX = + std::dynamic_pointer_cast(theDirX); if (!aDirX || !aNorm || (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance) || !aNorm->isInitialized()) return EntityWrapperPtr(); // calculate Y direction - std::shared_ptr aDirY(new GeomAPI_Dir(aNorm->dir()->cross(aDirX->dir()))); + std::shared_ptr aDirY( + new GeomAPI_Dir(aNorm->dir()->cross(aDirX->dir()))); // quaternion parameters of normal vector double qw, qx, qy, qz; - Slvs_MakeQuaternion(aDirX->x(), aDirX->y(), aDirX->z(), aDirY->x(), aDirY->y(), aDirY->z(), &qw, - &qx, &qy, &qz); - double aNormCoord[4] = { qw, qx, qy, qz }; + Slvs_MakeQuaternion(aDirX->x(), aDirX->y(), aDirX->z(), aDirY->x(), + aDirY->y(), aDirY->z(), &qw, &qx, &qy, &qz); + double aNormCoord[4] = {qw, qx, qy, qz}; // Create parameters of the normal std::list aParameters; @@ -504,32 +508,29 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createNormal( aParameters.push_back(createParameter(theGroupID, aNormCoord[i])); // Create a normal with empty parameters - Slvs_Entity aNormalEnt = Slvs_MakeNormal3d(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); - EntityWrapperPtr aNormal(new SolveSpaceSolver_EntityWrapper(theNormal, aNormalEnt)); + Slvs_Entity aNormalEnt = + Slvs_MakeNormal3d(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, SLVS_E_UNKNOWN, + SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN); + EntityWrapperPtr aNormal( + new SolveSpaceSolver_EntityWrapper(theNormal, aNormalEnt)); aNormal->setParameters(aParameters); return aNormal; } ParameterWrapperPtr SolveSpaceSolver_Builder::createParameter( - const GroupID& theGroup, const double theValue, const bool theExpr) const -{ - Slvs_Param aParam = Slvs_MakeParam(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroup, theValue); + const GroupID &theGroup, const double theValue, const bool theExpr) const { + Slvs_Param aParam = + Slvs_MakeParam(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroup, theValue); ParameterWrapperPtr aWrapper(new SolveSpaceSolver_ParameterWrapper(aParam)); aWrapper->setIsParametric(theExpr); return aWrapper; } - - - - // ================ Auxiliary functions ========================== EntityWrapperPtr createLine(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID) -{ + const std::list &theAttributes, + const GroupID &theGroupID, + const EntityID &theSketchID) { EntityWrapperPtr aNewEntity; std::list aSubs; @@ -553,24 +554,27 @@ EntityWrapperPtr createLine(FeaturePtr theFeature, aSubs.push_back(aStartEnt); aSubs.push_back(aEndEnt); - Slvs_Entity anEntity = Slvs_MakeLineSegment(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - (Slvs_hEntity)theSketchID, (Slvs_hEntity)aStartEnt->id(), (Slvs_hEntity)aEndEnt->id()); + Slvs_Entity anEntity = Slvs_MakeLineSegment( + SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, (Slvs_hEntity)theSketchID, + (Slvs_hEntity)aStartEnt->id(), (Slvs_hEntity)aEndEnt->id()); - aNewEntity = EntityWrapperPtr(new SolveSpaceSolver_EntityWrapper(theFeature, anEntity)); + aNewEntity = EntityWrapperPtr( + new SolveSpaceSolver_EntityWrapper(theFeature, anEntity)); aNewEntity->setSubEntities(aSubs); return aNewEntity; } EntityWrapperPtr createCircle(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID) -{ + const std::list &theAttributes, + const GroupID &theGroupID, + const EntityID &theSketchID) { EntityWrapperPtr aNewEntity; std::list aSubs; - AttributePtr aCenter = theFeature->attribute(SketchPlugin_Circle::CENTER_ID()); - AttributePtr aRadius = theFeature->attribute(SketchPlugin_Circle::RADIUS_ID()); + AttributePtr aCenter = + theFeature->attribute(SketchPlugin_Circle::CENTER_ID()); + AttributePtr aRadius = + theFeature->attribute(SketchPlugin_Circle::RADIUS_ID()); if (!aCenter->isInitialized() || !aRadius->isInitialized()) return aNewEntity; @@ -591,27 +595,29 @@ EntityWrapperPtr createCircle(FeaturePtr theFeature, aSubs.push_back(aCenterEnt); aSubs.push_back(aRadiusEnt); - Slvs_Entity anEntity = Slvs_MakeCircle(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - (Slvs_hEntity)theSketchID, (Slvs_hEntity)aCenterEnt->id(), - (Slvs_hEntity)aNormalEnt->id(), (Slvs_hEntity)aRadiusEnt->id()); + Slvs_Entity anEntity = Slvs_MakeCircle( + SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, (Slvs_hEntity)theSketchID, + (Slvs_hEntity)aCenterEnt->id(), (Slvs_hEntity)aNormalEnt->id(), + (Slvs_hEntity)aRadiusEnt->id()); - aNewEntity = EntityWrapperPtr(new SolveSpaceSolver_EntityWrapper(theFeature, anEntity)); + aNewEntity = EntityWrapperPtr( + new SolveSpaceSolver_EntityWrapper(theFeature, anEntity)); aNewEntity->setSubEntities(aSubs); return aNewEntity; } EntityWrapperPtr createArc(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID) -{ + const std::list &theAttributes, + const GroupID &theGroupID, + const EntityID &theSketchID) { EntityWrapperPtr aNewEntity; std::list aSubs; AttributePtr aCenter = theFeature->attribute(SketchPlugin_Arc::CENTER_ID()); AttributePtr aStart = theFeature->attribute(SketchPlugin_Arc::START_ID()); AttributePtr aEnd = theFeature->attribute(SketchPlugin_Arc::END_ID()); - if (!aCenter->isInitialized() || !aStart->isInitialized() || !aEnd->isInitialized()) + if (!aCenter->isInitialized() || !aStart->isInitialized() || + !aEnd->isInitialized()) return aNewEntity; EntityWrapperPtr aCenterEnt, aStartEnt, aEndEnt, aNormalEnt; @@ -634,30 +640,31 @@ EntityWrapperPtr createArc(FeaturePtr theFeature, aSubs.push_back(aCenterEnt); aSubs.push_back(aStartEnt); aSubs.push_back(aEndEnt); - Slvs_Entity anEntity = Slvs_MakeArcOfCircle(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, - (Slvs_hEntity)theSketchID, (Slvs_hEntity)aNormalEnt->id(), - (Slvs_hEntity)aCenterEnt->id(), (Slvs_hEntity)aStartEnt->id(), (Slvs_hEntity)aEndEnt->id()); + Slvs_Entity anEntity = Slvs_MakeArcOfCircle( + SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID, (Slvs_hEntity)theSketchID, + (Slvs_hEntity)aNormalEnt->id(), (Slvs_hEntity)aCenterEnt->id(), + (Slvs_hEntity)aStartEnt->id(), (Slvs_hEntity)aEndEnt->id()); - aNewEntity = EntityWrapperPtr(new SolveSpaceSolver_EntityWrapper(theFeature, anEntity)); + aNewEntity = EntityWrapperPtr( + new SolveSpaceSolver_EntityWrapper(theFeature, anEntity)); aNewEntity->setSubEntities(aSubs); return aNewEntity; } - -void adjustTangency(ConstraintWrapperPtr theConstraint) -{ +void adjustTangency(ConstraintWrapperPtr theConstraint) { BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance(); std::shared_ptr aConstraint = - std::dynamic_pointer_cast(theConstraint); + std::dynamic_pointer_cast( + theConstraint); // Collect start, end points of entities std::shared_ptr aStartEntPoints[2][2]; bool isCoinc[2][2] = {false}; - const std::list& aSubs = aConstraint->entities(); + const std::list &aSubs = aConstraint->entities(); std::list::const_iterator aSIt = aSubs.begin(); for (int i = 0; aSIt != aSubs.end(); ++aSIt, ++i) { - const std::list& aPoints = (*aSIt)->subEntities(); + const std::list &aPoints = (*aSIt)->subEntities(); std::list::const_iterator aPIt = aPoints.begin(); if ((*aSIt)->type() == ENTITY_ARC) ++aPIt; @@ -665,34 +672,37 @@ void adjustTangency(ConstraintWrapperPtr theConstraint) aStartEntPoints[i][j] = aBuilder->point(*aPIt); if (i > 0) { // check coincidence for (int k = 0; k < 2; ++k) - if (aStartEntPoints[i][j]->distance(aStartEntPoints[0][k]) < tolerance) + if (aStartEntPoints[i][j]->distance(aStartEntPoints[0][k]) < + tolerance) isCoinc[0][k] = isCoinc[i][j] = true; } } } - Slvs_Constraint& aSlvsConstraint = aConstraint->changeConstraint(); + Slvs_Constraint &aSlvsConstraint = aConstraint->changeConstraint(); if (isCoinc[0][0] == false && isCoinc[0][1] == true) aSlvsConstraint.other = 1; - else aSlvsConstraint.other = 0; + else + aSlvsConstraint.other = 0; if (isCoinc[1][0] == false && isCoinc[1][1] == true) aSlvsConstraint.other2 = 1; - else aSlvsConstraint.other2 = 0; + else + aSlvsConstraint.other2 = 0; } -void adjustAngle(ConstraintWrapperPtr theConstraint) -{ +void adjustAngle(ConstraintWrapperPtr theConstraint) { BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance(); std::shared_ptr aConstraint = - std::dynamic_pointer_cast(theConstraint); + std::dynamic_pointer_cast( + theConstraint); bool isFixed[2][2]; std::shared_ptr aPoints[2][2]; // start and end points of lines - const std::list& aConstrLines = aConstraint->entities(); + const std::list &aConstrLines = aConstraint->entities(); std::list::const_iterator aCLIt = aConstrLines.begin(); for (int i = 0; aCLIt != aConstrLines.end(); ++i, ++aCLIt) { - const std::list& aLinePoints = (*aCLIt)->subEntities(); + const std::list &aLinePoints = (*aCLIt)->subEntities(); std::list::const_iterator aLPIt = aLinePoints.begin(); for (int j = 0; aLPIt != aLinePoints.end(); ++j, ++aLPIt) { isFixed[i][j] = ((*aLPIt)->group() != theConstraint->group()); @@ -704,29 +714,32 @@ void adjustAngle(ConstraintWrapperPtr theConstraint) return; // both lines are fixed => no need to update them std::shared_ptr aLine[2] = { - std::shared_ptr(new GeomAPI_Lin2d(aPoints[0][0], aPoints[0][1])), - std::shared_ptr(new GeomAPI_Lin2d(aPoints[1][0], aPoints[1][1])) - }; + std::shared_ptr( + new GeomAPI_Lin2d(aPoints[0][0], aPoints[0][1])), + std::shared_ptr( + new GeomAPI_Lin2d(aPoints[1][0], aPoints[1][1]))}; bool isReversed[2] = { - aConstraint->baseConstraint()->boolean( - SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->value(), - aConstraint->baseConstraint()->boolean( - SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->value() - }; - std::shared_ptr - anAngle(new GeomAPI_Angle2d(aLine[0], isReversed[0], aLine[1], isReversed[1])); + aConstraint->baseConstraint() + ->boolean( + SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID()) + ->value(), + aConstraint->baseConstraint() + ->boolean( + SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID()) + ->value()}; + std::shared_ptr anAngle( + new GeomAPI_Angle2d(aLine[0], isReversed[0], aLine[1], isReversed[1])); std::shared_ptr aCenter = anAngle->center(); - Slvs_Constraint& aSlvsConstraint = aConstraint->changeConstraint(); + Slvs_Constraint &aSlvsConstraint = aConstraint->changeConstraint(); aSlvsConstraint.other = isReversed[0] != isReversed[1]; } -void adjustMirror(ConstraintWrapperPtr theConstraint) -{ +void adjustMirror(ConstraintWrapperPtr theConstraint) { std::vector aPoints; EntityWrapperPtr aMirrorLine; - const std::list& aSubs = theConstraint->entities(); + const std::list &aSubs = theConstraint->entities(); std::list::const_iterator anIt = aSubs.begin(); for (; anIt != aSubs.end(); ++anIt) { if ((*anIt)->type() == ENTITY_POINT) @@ -740,36 +753,38 @@ void adjustMirror(ConstraintWrapperPtr theConstraint) void makeMirrorPoints(EntityWrapperPtr theOriginal, EntityWrapperPtr theMirrored, - EntityWrapperPtr theMirrorLine) -{ + EntityWrapperPtr theMirrorLine) { BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance(); std::shared_ptr aMirrorLine = aBuilder->line(theMirrorLine); std::shared_ptr aMLDir = aMirrorLine->direction(); // orthogonal direction - aMLDir = std::shared_ptr(new GeomAPI_Dir2d(aMLDir->y(), -aMLDir->x())); + aMLDir = std::shared_ptr( + new GeomAPI_Dir2d(aMLDir->y(), -aMLDir->x())); std::shared_ptr aPoint = aBuilder->point(theOriginal); - std::shared_ptr aVec = aPoint->xy()->decreased(aMirrorLine->location()->xy()); + std::shared_ptr aVec = + aPoint->xy()->decreased(aMirrorLine->location()->xy()); double aDist = aVec->dot(aMLDir->xy()); aVec = aPoint->xy()->added(aMLDir->xy()->multiplied(-2.0 * aDist)); double aCoord[2] = {aVec->x(), aVec->y()}; - std::list::const_iterator aMIt = theMirrored->parameters().begin(); + std::list::const_iterator aMIt = + theMirrored->parameters().begin(); for (int i = 0; aMIt != theMirrored->parameters().end(); ++aMIt, ++i) (*aMIt)->setValue(aCoord[i]); // update corresponding attribute AttributePtr anAttr = - std::dynamic_pointer_cast(theMirrored)->baseAttribute(); + std::dynamic_pointer_cast(theMirrored) + ->baseAttribute(); if (anAttr) { std::shared_ptr aMirroredPnt = - std::dynamic_pointer_cast(anAttr); + std::dynamic_pointer_cast(anAttr); aMirroredPnt->setValue(aCoord[0], aCoord[1]); } } -void adjustPtLineDistance(ConstraintWrapperPtr theConstraint) -{ +void adjustPtLineDistance(ConstraintWrapperPtr theConstraint) { BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance(); std::shared_ptr aPoint; @@ -784,7 +799,8 @@ void adjustPtLineDistance(ConstraintWrapperPtr theConstraint) } std::shared_ptr aLineVec = aLine->direction()->xy(); - std::shared_ptr aPtLineVec = aPoint->xy()->decreased(aLine->location()->xy()); + std::shared_ptr aPtLineVec = + aPoint->xy()->decreased(aLine->location()->xy()); if (aPtLineVec->cross(aLineVec) * theConstraint->value() < 0.0) theConstraint->setValue(theConstraint->value() * (-1.0)); } diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h index bbb284a5e..306939e10 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_Builder_H_ @@ -29,10 +30,10 @@ /** \class SolveSpaceSolver_Builder * \ingroup Plugins - * \brief Create bridges between SketchPlugin constraints and SolveSpace constraints + * \brief Create bridges between SketchPlugin constraints and SolveSpace + * constraints */ -class SolveSpaceSolver_Builder : public SketchSolver_Builder -{ +class SolveSpaceSolver_Builder : public SketchSolver_Builder { private: /// Default constructor SolveSpaceSolver_Builder() {} @@ -42,7 +43,7 @@ public: static BuilderPtr getInstance(); /// \brief Creates a storage specific for used solver - virtual StoragePtr createStorage(const GroupID& theGroup) const; + virtual StoragePtr createStorage(const GroupID &theGroup) const; /// \brief Creates specific solver virtual SolverPtr createSolver() const; @@ -57,19 +58,18 @@ public: /// \param theEntity2 [in] second attribute of constraint /// \param theEntity3 [in] third attribute of constraint /// \param theEntity4 [in] fourth attribute of constraint - /// \return Created list of wrappers of constraints applicable for specific solver. - /// Most of constraint types lead to single constraint, but there are some kind of - /// constraints (e.g. mirror), which may produce couple of constraints. - virtual std::list - createConstraint(ConstraintPtr theConstraint, - const GroupID& theGroupID, - const EntityID& theSketchID, - const SketchSolver_ConstraintType& theType, - const double& theValue, - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(), - const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(), - const EntityWrapperPtr& theEntity4 = EntityWrapperPtr()) const; + /// \return Created list of wrappers of constraints applicable for specific + /// solver. + /// Most of constraint types lead to single constraint, but there are + /// some kind of constraints (e.g. mirror), which may produce couple + /// of constraints. + virtual std::list createConstraint( + ConstraintPtr theConstraint, const GroupID &theGroupID, + const EntityID &theSketchID, const SketchSolver_ConstraintType &theType, + const double &theValue, const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2 = EntityWrapperPtr(), + const EntityWrapperPtr &theEntity3 = EntityWrapperPtr(), + const EntityWrapperPtr &theEntity4 = EntityWrapperPtr()) const; /// \brief Creates new multi-translation or multi-rotation constraint /// \param theConstraint [in] original constraint @@ -79,20 +79,18 @@ public: /// \param theValue [in] numeric characteristic of constraint /// (angle for multi-rotation) if applicable /// \param theFullValue [in] indicates theValue shows full translation - /// delta/rotation angle or delta/angle between neighbor entities - /// \param thePoint1 [in] center for multi-rotation or start point for multi-translation - /// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation) - /// \param theTrsfEnt [in] list of transformed entities - virtual std::list - createConstraint(ConstraintPtr theConstraint, - const GroupID& theGroupID, - const EntityID& theSketchID, - const SketchSolver_ConstraintType& theType, - const double& theValue, - const bool theFullValue, - const EntityWrapperPtr& thePoint1, - const EntityWrapperPtr& thePoint2, - const std::list& theTrsfEnt) const; + /// delta/rotation angle or delta/angle between + /// neighbor entities + /// \param thePoint1 [in] center for multi-rotation or start point for + /// multi-translation \param thePoint2 [in] end point for + /// multi-translation (empty for multi-rotation) \param theTrsfEnt [in] + /// list of transformed entities + virtual std::list createConstraint( + ConstraintPtr theConstraint, const GroupID &theGroupID, + const EntityID &theSketchID, const SketchSolver_ConstraintType &theType, + const double &theValue, const bool theFullValue, + const EntityWrapperPtr &thePoint1, const EntityWrapperPtr &thePoint2, + const std::list &theTrsfEnt) const; /// \brief Update flags for several kinds of constraints virtual void adjustConstraint(ConstraintWrapperPtr theConstraint) const; @@ -103,51 +101,52 @@ public: /// \param theGroupID [in] group the feature belongs to /// \param theSketchID [in] sketch the feature belongs to /// \return Created wrapper of the feature applicable for specific solver - virtual EntityWrapperPtr createFeature(FeaturePtr theFeature, - const std::list& theAttributes, - const GroupID& theGroupID, - const EntityID& theSketchID = EID_UNKNOWN) const; + virtual EntityWrapperPtr + createFeature(FeaturePtr theFeature, + const std::list &theAttributes, + const GroupID &theGroupID, + const EntityID &theSketchID = EID_UNKNOWN) const; /// \brief Creates an attribute /// \param theAttribute [in] attribute to create /// \param theGroup [in] group the attribute belongs to /// \param theSketchID [in] sketch the attribute belongs to /// \return Created wrapper of the attribute applicable for specific solver - virtual EntityWrapperPtr createAttribute(AttributePtr theAttribute, - const GroupID& theGroup, - const EntityID& theSketchID = EID_UNKNOWN) const; + virtual EntityWrapperPtr + createAttribute(AttributePtr theAttribute, const GroupID &theGroup, + const EntityID &theSketchID = EID_UNKNOWN) const; private: - /// \brief Create necessary constraints to make two object symmetric relatively a given line - std::list createMirror(ConstraintPtr theConstraint, - const GroupID& theGroupID, - const EntityID& theSketchID, - const EntityWrapperPtr& theEntity1, - const EntityWrapperPtr& theEntity2, - const EntityWrapperPtr& theMirrorLine) const; + /// \brief Create necessary constraints to make two object symmetric + /// relatively a given line + std::list + createMirror(ConstraintPtr theConstraint, const GroupID &theGroupID, + const EntityID &theSketchID, const EntityWrapperPtr &theEntity1, + const EntityWrapperPtr &theEntity2, + const EntityWrapperPtr &theMirrorLine) const; /// \brief Converts sketch parameters to the entity applicable for the solver. /// \param theSketch [in] the element to be converted /// \param theGroupID [in] group where the sketch should be created - /// \return Entity respective the sketch or empty pointer, it the sketch has incorrect attributes + /// \return Entity respective the sketch or empty pointer, it the sketch has + /// incorrect attributes EntityWrapperPtr createSketchEntity(CompositeFeaturePtr theSketch, - const GroupID& theGroupID) const; + const GroupID &theGroupID) const; /// \brief Converts two axes of sketch's trihedron to the normal entity /// \param theNormal [in] direction of the normal of the sketch /// \param theDirX [in] direction of the X axis of the sketch /// \param theGroupID [in] group, the normal belongs to /// \return Created entity or empty pointer, if there are incorrect attributes - EntityWrapperPtr createNormal(AttributePtr theNormal, - AttributePtr theDirX, - const GroupID& theGroupID) const; + EntityWrapperPtr createNormal(AttributePtr theNormal, AttributePtr theDirX, + const GroupID &theGroupID) const; /// \brief Converts a value to SolveSpace parameter /// \param theGroup [in] group to store parameter /// \param theValue [in] value of parameter /// \param theExpr [in] shows the parameter is given by expression /// \return Created parameter's wrapper - ParameterWrapperPtr createParameter(const GroupID& theGroup, + ParameterWrapperPtr createParameter(const GroupID &theGroup, const double theValue = 0.0, const bool theExpr = false) const; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintType.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintType.h index ee8535459..68ccc5d7d 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintType.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintType.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_ConstraintType_H_ @@ -23,68 +24,108 @@ #include #include -namespace ConstraintType -{ - /// \brief Convert constraint type from SketchSolver to SolveSpace - static int toSolveSpace(SketchSolver_ConstraintType theType) - { - switch (theType) { - case CONSTRAINT_PT_PT_COINCIDENT: return SLVS_C_POINTS_COINCIDENT; - case CONSTRAINT_PT_ON_LINE: return SLVS_C_PT_ON_LINE; - case CONSTRAINT_PT_ON_CIRCLE: return SLVS_C_PT_ON_CIRCLE; - case CONSTRAINT_MIDDLE_POINT: return SLVS_C_AT_MIDPOINT; - case CONSTRAINT_PT_PT_DISTANCE: return SLVS_C_PT_PT_DISTANCE; - case CONSTRAINT_PT_LINE_DISTANCE: return SLVS_C_PT_LINE_DISTANCE; - case CONSTRAINT_ANGLE: return SLVS_C_ANGLE; - case CONSTRAINT_RADIUS: return SLVS_C_DIAMETER; - case CONSTRAINT_FIXED: return SLVS_C_WHERE_DRAGGED; - case CONSTRAINT_HORIZONTAL: return SLVS_C_HORIZONTAL; - case CONSTRAINT_VERTICAL: return SLVS_C_VERTICAL; - case CONSTRAINT_PARALLEL: return SLVS_C_PARALLEL; - case CONSTRAINT_PERPENDICULAR: return SLVS_C_PERPENDICULAR; - case CONSTRAINT_SYMMETRIC: return SLVS_C_SYMMETRIC_LINE; - case CONSTRAINT_EQUAL_LINES: return SLVS_C_EQUAL_LENGTH_LINES; - case CONSTRAINT_EQUAL_LINE_ARC: return SLVS_C_EQUAL_LINE_ARC_LEN; - case CONSTRAINT_EQUAL_RADIUS: return SLVS_C_EQUAL_RADIUS; - case CONSTRAINT_TANGENT_ARC_LINE: return SLVS_C_ARC_LINE_TANGENT; - case CONSTRAINT_TANGENT_ARC_ARC: return SLVS_C_CURVE_CURVE_TANGENT; - case CONSTRAINT_MULTI_ROTATION: return SLVS_C_MULTI_ROTATION; - case CONSTRAINT_MULTI_TRANSLATION: return SLVS_C_MULTI_TRANSLATION; - default: break; - } - return SLVS_C_UNKNOWN; +namespace ConstraintType { +/// \brief Convert constraint type from SketchSolver to SolveSpace +static int toSolveSpace(SketchSolver_ConstraintType theType) { + switch (theType) { + case CONSTRAINT_PT_PT_COINCIDENT: + return SLVS_C_POINTS_COINCIDENT; + case CONSTRAINT_PT_ON_LINE: + return SLVS_C_PT_ON_LINE; + case CONSTRAINT_PT_ON_CIRCLE: + return SLVS_C_PT_ON_CIRCLE; + case CONSTRAINT_MIDDLE_POINT: + return SLVS_C_AT_MIDPOINT; + case CONSTRAINT_PT_PT_DISTANCE: + return SLVS_C_PT_PT_DISTANCE; + case CONSTRAINT_PT_LINE_DISTANCE: + return SLVS_C_PT_LINE_DISTANCE; + case CONSTRAINT_ANGLE: + return SLVS_C_ANGLE; + case CONSTRAINT_RADIUS: + return SLVS_C_DIAMETER; + case CONSTRAINT_FIXED: + return SLVS_C_WHERE_DRAGGED; + case CONSTRAINT_HORIZONTAL: + return SLVS_C_HORIZONTAL; + case CONSTRAINT_VERTICAL: + return SLVS_C_VERTICAL; + case CONSTRAINT_PARALLEL: + return SLVS_C_PARALLEL; + case CONSTRAINT_PERPENDICULAR: + return SLVS_C_PERPENDICULAR; + case CONSTRAINT_SYMMETRIC: + return SLVS_C_SYMMETRIC_LINE; + case CONSTRAINT_EQUAL_LINES: + return SLVS_C_EQUAL_LENGTH_LINES; + case CONSTRAINT_EQUAL_LINE_ARC: + return SLVS_C_EQUAL_LINE_ARC_LEN; + case CONSTRAINT_EQUAL_RADIUS: + return SLVS_C_EQUAL_RADIUS; + case CONSTRAINT_TANGENT_ARC_LINE: + return SLVS_C_ARC_LINE_TANGENT; + case CONSTRAINT_TANGENT_ARC_ARC: + return SLVS_C_CURVE_CURVE_TANGENT; + case CONSTRAINT_MULTI_ROTATION: + return SLVS_C_MULTI_ROTATION; + case CONSTRAINT_MULTI_TRANSLATION: + return SLVS_C_MULTI_TRANSLATION; + default: + break; } + return SLVS_C_UNKNOWN; +} - /// \brief Convert constraint type from SolveSpace to SketchSolver - static SketchSolver_ConstraintType fromSolveSpace(int theType) - { - switch (theType) { - case SLVS_C_POINTS_COINCIDENT: return CONSTRAINT_PT_PT_COINCIDENT; - case SLVS_C_PT_ON_LINE: return CONSTRAINT_PT_ON_LINE; - case SLVS_C_PT_ON_CIRCLE: return CONSTRAINT_PT_ON_CIRCLE; - case SLVS_C_AT_MIDPOINT: return CONSTRAINT_MIDDLE_POINT; - case SLVS_C_PT_PT_DISTANCE: return CONSTRAINT_PT_PT_DISTANCE; - case SLVS_C_PT_LINE_DISTANCE: return CONSTRAINT_PT_LINE_DISTANCE; - case SLVS_C_EQUAL_LENGTH_LINES: return CONSTRAINT_EQUAL_LINES; - case SLVS_C_EQUAL_LINE_ARC_LEN: return CONSTRAINT_EQUAL_LINE_ARC; - case SLVS_C_SYMMETRIC_LINE: return CONSTRAINT_SYMMETRIC; - case SLVS_C_HORIZONTAL: return CONSTRAINT_HORIZONTAL; - case SLVS_C_VERTICAL: return CONSTRAINT_VERTICAL; - case SLVS_C_DIAMETER: return CONSTRAINT_RADIUS; - case SLVS_C_ANGLE: return CONSTRAINT_ANGLE; - case SLVS_C_PARALLEL: return CONSTRAINT_PARALLEL; - case SLVS_C_PERPENDICULAR: return CONSTRAINT_PERPENDICULAR; - case SLVS_C_ARC_LINE_TANGENT: return CONSTRAINT_TANGENT_ARC_LINE; - case SLVS_C_EQUAL_RADIUS: return CONSTRAINT_EQUAL_RADIUS; - case SLVS_C_WHERE_DRAGGED: return CONSTRAINT_FIXED; - case SLVS_C_CURVE_CURVE_TANGENT: return CONSTRAINT_TANGENT_ARC_ARC; - case SLVS_C_MULTI_ROTATION: return CONSTRAINT_MULTI_ROTATION; - case SLVS_C_MULTI_TRANSLATION: return CONSTRAINT_MULTI_TRANSLATION; - default: break; - } - return CONSTRAINT_UNKNOWN; +/// \brief Convert constraint type from SolveSpace to SketchSolver +static SketchSolver_ConstraintType fromSolveSpace(int theType) { + switch (theType) { + case SLVS_C_POINTS_COINCIDENT: + return CONSTRAINT_PT_PT_COINCIDENT; + case SLVS_C_PT_ON_LINE: + return CONSTRAINT_PT_ON_LINE; + case SLVS_C_PT_ON_CIRCLE: + return CONSTRAINT_PT_ON_CIRCLE; + case SLVS_C_AT_MIDPOINT: + return CONSTRAINT_MIDDLE_POINT; + case SLVS_C_PT_PT_DISTANCE: + return CONSTRAINT_PT_PT_DISTANCE; + case SLVS_C_PT_LINE_DISTANCE: + return CONSTRAINT_PT_LINE_DISTANCE; + case SLVS_C_EQUAL_LENGTH_LINES: + return CONSTRAINT_EQUAL_LINES; + case SLVS_C_EQUAL_LINE_ARC_LEN: + return CONSTRAINT_EQUAL_LINE_ARC; + case SLVS_C_SYMMETRIC_LINE: + return CONSTRAINT_SYMMETRIC; + case SLVS_C_HORIZONTAL: + return CONSTRAINT_HORIZONTAL; + case SLVS_C_VERTICAL: + return CONSTRAINT_VERTICAL; + case SLVS_C_DIAMETER: + return CONSTRAINT_RADIUS; + case SLVS_C_ANGLE: + return CONSTRAINT_ANGLE; + case SLVS_C_PARALLEL: + return CONSTRAINT_PARALLEL; + case SLVS_C_PERPENDICULAR: + return CONSTRAINT_PERPENDICULAR; + case SLVS_C_ARC_LINE_TANGENT: + return CONSTRAINT_TANGENT_ARC_LINE; + case SLVS_C_EQUAL_RADIUS: + return CONSTRAINT_EQUAL_RADIUS; + case SLVS_C_WHERE_DRAGGED: + return CONSTRAINT_FIXED; + case SLVS_C_CURVE_CURVE_TANGENT: + return CONSTRAINT_TANGENT_ARC_ARC; + case SLVS_C_MULTI_ROTATION: + return CONSTRAINT_MULTI_ROTATION; + case SLVS_C_MULTI_TRANSLATION: + return CONSTRAINT_MULTI_TRANSLATION; + default: + break; } + return CONSTRAINT_UNKNOWN; } - +} // namespace ConstraintType #endif diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.cpp index 2a9d146a2..945663384 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.cpp @@ -14,42 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include #include SolveSpaceSolver_ConstraintWrapper::SolveSpaceSolver_ConstraintWrapper( - const ConstraintPtr& theOriginal, - const Slvs_Constraint& theConstraint) - : mySlvsConstraint(theConstraint) -{ + const ConstraintPtr &theOriginal, const Slvs_Constraint &theConstraint) + : mySlvsConstraint(theConstraint) { myBaseConstraint = theOriginal; myValue = mySlvsConstraint.valA; } -ConstraintID SolveSpaceSolver_ConstraintWrapper::id() const -{ +ConstraintID SolveSpaceSolver_ConstraintWrapper::id() const { return (ConstraintID)mySlvsConstraint.h; } -void SolveSpaceSolver_ConstraintWrapper::setGroup(const GroupID& theGroup) -{ +void SolveSpaceSolver_ConstraintWrapper::setGroup(const GroupID &theGroup) { mySlvsConstraint.group = (Slvs_hGroup)theGroup; std::list::iterator aSubsIt = myConstrained.begin(); for (; aSubsIt != myConstrained.end(); ++aSubsIt) (*aSubsIt)->setGroup(theGroup); } -SketchSolver_ConstraintType SolveSpaceSolver_ConstraintWrapper::type() const -{ +SketchSolver_ConstraintType SolveSpaceSolver_ConstraintWrapper::type() const { return ConstraintType::fromSolveSpace(mySlvsConstraint.type); } -bool SolveSpaceSolver_ConstraintWrapper::isUsed(FeaturePtr theFeature) const -{ +bool SolveSpaceSolver_ConstraintWrapper::isUsed(FeaturePtr theFeature) const { std::list::const_iterator anIt = myConstrained.begin(); for (; anIt != myConstrained.end(); ++anIt) if ((*anIt)->isUsed(theFeature)) @@ -57,8 +52,8 @@ bool SolveSpaceSolver_ConstraintWrapper::isUsed(FeaturePtr theFeature) const return false; } -bool SolveSpaceSolver_ConstraintWrapper::isUsed(AttributePtr theAttribute) const -{ +bool SolveSpaceSolver_ConstraintWrapper::isUsed( + AttributePtr theAttribute) const { std::list::const_iterator anIt = myConstrained.begin(); for (; anIt != myConstrained.end(); ++anIt) if ((*anIt)->isUsed(theAttribute)) @@ -66,17 +61,19 @@ bool SolveSpaceSolver_ConstraintWrapper::isUsed(AttributePtr theAttribute) const return false; } -bool SolveSpaceSolver_ConstraintWrapper::isEqual(const ConstraintWrapperPtr& theOther) -{ +bool SolveSpaceSolver_ConstraintWrapper::isEqual( + const ConstraintWrapperPtr &theOther) { const Slvs_Constraint anOtherConstraint = - std::dynamic_pointer_cast(theOther)->constraint(); + std::dynamic_pointer_cast(theOther) + ->constraint(); if (mySlvsConstraint.type != anOtherConstraint.type) return false; - // Verify SolveSpace entities. If they are equal, no need additional checking of parameters. - if (mySlvsConstraint.group == anOtherConstraint.group && - mySlvsConstraint.ptA == anOtherConstraint.ptA && - mySlvsConstraint.ptB == anOtherConstraint.ptB && + // Verify SolveSpace entities. If they are equal, no need additional checking + // of parameters. + if (mySlvsConstraint.group == anOtherConstraint.group && + mySlvsConstraint.ptA == anOtherConstraint.ptA && + mySlvsConstraint.ptB == anOtherConstraint.ptB && mySlvsConstraint.entityA == anOtherConstraint.entityA && mySlvsConstraint.entityB == anOtherConstraint.entityB && mySlvsConstraint.entityC == anOtherConstraint.entityC && @@ -90,28 +87,30 @@ bool SolveSpaceSolver_ConstraintWrapper::isEqual(const ConstraintWrapperPtr& the return false; // Verify equality of entities - const std::list& anOtherSubs = theOther->entities(); + const std::list &anOtherSubs = theOther->entities(); if (myConstrained.size() != anOtherSubs.size()) return false; std::list::const_iterator aMySubsIt = myConstrained.begin(); - std::list::const_iterator anOtherSubsIt = anOtherSubs.begin(); + std::list::const_iterator anOtherSubsIt = + anOtherSubs.begin(); for (; aMySubsIt != myConstrained.end(); ++aMySubsIt, ++anOtherSubsIt) if (!(*aMySubsIt)->isEqual(*anOtherSubsIt)) return false; return true; } -bool SolveSpaceSolver_ConstraintWrapper::update(const ConstraintWrapperPtr& theOther) -{ +bool SolveSpaceSolver_ConstraintWrapper::update( + const ConstraintWrapperPtr &theOther) { bool isUpdated = false; std::list aMySubs = entities(); std::list anOtherSubs = theOther->entities(); std::list::const_iterator aMySubsIt = aMySubs.begin(); - std::list::const_iterator anOtherSubsIt = anOtherSubs.begin(); + std::list::const_iterator anOtherSubsIt = + anOtherSubs.begin(); for (; aMySubsIt != aMySubs.end() && anOtherSubsIt != anOtherSubs.end(); ++aMySubsIt, ++anOtherSubsIt) - isUpdated = (*aMySubsIt)->update(*anOtherSubsIt) || isUpdated; + isUpdated = (*aMySubsIt)->update(*anOtherSubsIt) || isUpdated; if (fabs(value() - theOther->value()) > tolerance) { myValue = theOther->value(); diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.h index ca17f314e..fbf7f3d49 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ConstraintWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_ConstraintWrapper_H_ @@ -23,31 +24,27 @@ #include #include - /** * Wrapper providing operations with SovleSpace constraints. */ -class SolveSpaceSolver_ConstraintWrapper : public SketchSolver_IConstraintWrapper -{ +class SolveSpaceSolver_ConstraintWrapper + : public SketchSolver_IConstraintWrapper { public: - SolveSpaceSolver_ConstraintWrapper(const ConstraintPtr& theOriginal, - const Slvs_Constraint& theConstraint); + SolveSpaceSolver_ConstraintWrapper(const ConstraintPtr &theOriginal, + const Slvs_Constraint &theConstraint); /// \brief Return SolveSpace constraint - const Slvs_Constraint& constraint() const - { return mySlvsConstraint; } + const Slvs_Constraint &constraint() const { return mySlvsConstraint; } /// \brief Return SolveSpace constraint to change - Slvs_Constraint& changeConstraint() - { return mySlvsConstraint; } + Slvs_Constraint &changeConstraint() { return mySlvsConstraint; } /// \brief Return ID of current entity virtual ConstraintID id() const; /// \brief Change group for the constraint - virtual void setGroup(const GroupID& theGroup); + virtual void setGroup(const GroupID &theGroup); /// \brief Return identifier of the group the constraint belongs to - virtual GroupID group() const - { return (GroupID)mySlvsConstraint.group; } + virtual GroupID group() const { return (GroupID)mySlvsConstraint.group; } /// \brief Return type of current entity virtual SketchSolver_ConstraintType type() const; @@ -58,11 +55,12 @@ public: virtual bool isUsed(AttributePtr theAttribute) const; /// \brief Compare current constraint with other - virtual bool isEqual(const ConstraintWrapperPtr& theOther); + virtual bool isEqual(const ConstraintWrapperPtr &theOther); - /// \brief Update values of parameters of this constraint by the parameters of given one - /// \return \c true if some parameters change their values - virtual bool update(const std::shared_ptr& theOther); + /// \brief Update values of parameters of this constraint by the parameters of + /// given one \return \c true if some parameters change their values + virtual bool + update(const std::shared_ptr &theOther); private: Slvs_Constraint mySlvsConstraint; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.cpp index 610c1002c..60e951d82 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.cpp @@ -14,43 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include SolveSpaceSolver_EntityWrapper::SolveSpaceSolver_EntityWrapper( - const FeaturePtr theFeature, const Slvs_Entity& theEntity) - : myEntity(theEntity) -{ + const FeaturePtr theFeature, const Slvs_Entity &theEntity) + : myEntity(theEntity) { myBaseFeature = theFeature; } SolveSpaceSolver_EntityWrapper::SolveSpaceSolver_EntityWrapper( - const AttributePtr theAttribute, const Slvs_Entity& theEntity) - : myEntity(theEntity) -{ + const AttributePtr theAttribute, const Slvs_Entity &theEntity) + : myEntity(theEntity) { myBaseAttribute = theAttribute; } SolveSpaceSolver_EntityWrapper::SolveSpaceSolver_EntityWrapper( - const FeaturePtr thePointFeature, - const AttributePtr thePointAttribute, - const Slvs_Entity& theEntity) - : myEntity(theEntity) -{ + const FeaturePtr thePointFeature, const AttributePtr thePointAttribute, + const Slvs_Entity &theEntity) + : myEntity(theEntity) { myBaseFeature = thePointFeature; myBaseAttribute = thePointAttribute; } - -EntityID SolveSpaceSolver_EntityWrapper::id() const -{ +EntityID SolveSpaceSolver_EntityWrapper::id() const { return (EntityID)myEntity.h; } -void SolveSpaceSolver_EntityWrapper::setGroup(const GroupID& theGroup) -{ +void SolveSpaceSolver_EntityWrapper::setGroup(const GroupID &theGroup) { myEntity.group = (Slvs_hGroup)theGroup; std::list::iterator aSubsIt = mySubEntities.begin(); for (; aSubsIt != mySubEntities.end(); ++aSubsIt) @@ -60,25 +54,31 @@ void SolveSpaceSolver_EntityWrapper::setGroup(const GroupID& theGroup) (*aPIt)->setGroup(theGroup); } -SketchSolver_EntityType SolveSpaceSolver_EntityWrapper::type() const -{ +SketchSolver_EntityType SolveSpaceSolver_EntityWrapper::type() const { switch (myEntity.type) { case SLVS_E_POINT_IN_3D: - case SLVS_E_POINT_IN_2D: return ENTITY_POINT; - case SLVS_E_LINE_SEGMENT: return ENTITY_LINE; - case SLVS_E_CIRCLE: return ENTITY_CIRCLE; - case SLVS_E_ARC_OF_CIRCLE: return ENTITY_ARC; + case SLVS_E_POINT_IN_2D: + return ENTITY_POINT; + case SLVS_E_LINE_SEGMENT: + return ENTITY_LINE; + case SLVS_E_CIRCLE: + return ENTITY_CIRCLE; + case SLVS_E_ARC_OF_CIRCLE: + return ENTITY_ARC; case SLVS_E_NORMAL_IN_3D: - case SLVS_E_NORMAL_IN_2D: return ENTITY_NORMAL; - case SLVS_E_DISTANCE: return ENTITY_SCALAR; - case SLVS_E_WORKPLANE: return ENTITY_SKETCH; - default: break; + case SLVS_E_NORMAL_IN_2D: + return ENTITY_NORMAL; + case SLVS_E_DISTANCE: + return ENTITY_SCALAR; + case SLVS_E_WORKPLANE: + return ENTITY_SKETCH; + default: + break; } return ENTITY_UNKNOWN; } -bool SolveSpaceSolver_EntityWrapper::isUsed(FeaturePtr theFeature) const -{ +bool SolveSpaceSolver_EntityWrapper::isUsed(FeaturePtr theFeature) const { if (isBase(theFeature)) return true; @@ -89,8 +89,7 @@ bool SolveSpaceSolver_EntityWrapper::isUsed(FeaturePtr theFeature) const return false; } -bool SolveSpaceSolver_EntityWrapper::isUsed(AttributePtr theAttribute) const -{ +bool SolveSpaceSolver_EntityWrapper::isUsed(AttributePtr theAttribute) const { if (isBase(theAttribute)) return true; @@ -101,51 +100,53 @@ bool SolveSpaceSolver_EntityWrapper::isUsed(AttributePtr theAttribute) const return false; } -bool SolveSpaceSolver_EntityWrapper::isEqual(const EntityWrapperPtr& theOther) -{ +bool SolveSpaceSolver_EntityWrapper::isEqual(const EntityWrapperPtr &theOther) { if (type() != theOther->type()) return false; // Verify Equality of sub-entities - const std::list& anOtherSubs = theOther->subEntities(); + const std::list &anOtherSubs = theOther->subEntities(); if (mySubEntities.size() != anOtherSubs.size()) return false; std::list::const_iterator aMySubsIt = mySubEntities.begin(); - std::list::const_iterator anOtherSubsIt = anOtherSubs.begin(); + std::list::const_iterator anOtherSubsIt = + anOtherSubs.begin(); for (; aMySubsIt != mySubEntities.end(); ++aMySubsIt, ++anOtherSubsIt) if (!(*aMySubsIt)->isEqual(*anOtherSubsIt)) return false; // Verify equality of parameters - const std::list& anOtherParams = theOther->parameters(); + const std::list &anOtherParams = theOther->parameters(); if (myParameters.size() != anOtherParams.size()) return false; std::list::const_iterator aMyIt = myParameters.begin(); - std::list::const_iterator anOtherIt = anOtherParams.begin(); + std::list::const_iterator anOtherIt = + anOtherParams.begin(); for (; aMyIt != myParameters.end(); ++aMyIt, ++anOtherIt) if (!(*aMyIt)->isEqual(*anOtherIt)) return false; return true; } -bool SolveSpaceSolver_EntityWrapper::update(const EntityWrapperPtr& theOther) -{ +bool SolveSpaceSolver_EntityWrapper::update(const EntityWrapperPtr &theOther) { bool isUpdated = false; std::list aMySubs = subEntities(); std::list anOtherSubs = theOther->subEntities(); std::list::const_iterator aMySubsIt = aMySubs.begin(); - std::list::const_iterator anOtherSubsIt = anOtherSubs.begin(); + std::list::const_iterator anOtherSubsIt = + anOtherSubs.begin(); for (; aMySubsIt != aMySubs.end() && anOtherSubsIt != anOtherSubs.end(); ++aMySubsIt, ++anOtherSubsIt) - isUpdated = (*aMySubsIt)->update(*anOtherSubsIt) || isUpdated; + isUpdated = (*aMySubsIt)->update(*anOtherSubsIt) || isUpdated; std::list aMyParams = parameters(); std::list anOtherParams = theOther->parameters(); std::list::const_iterator aMyParIt = aMyParams.begin(); - std::list::const_iterator anOtherParIt = anOtherParams.begin(); + std::list::const_iterator anOtherParIt = + anOtherParams.begin(); for (; aMyParIt != aMyParams.end() && anOtherParIt != anOtherParams.end(); - ++aMyParIt, ++anOtherParIt) + ++aMyParIt, ++anOtherParIt) isUpdated = (*aMyParIt)->update(*anOtherParIt); return isUpdated; } diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.h index 54efb2f34..4221817a4 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_EntityWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_EntityWrapper_H_ @@ -26,32 +27,30 @@ /** * Wrapper providing operations with SolveSpace entities. */ -class SolveSpaceSolver_EntityWrapper : public SketchSolver_IEntityWrapper -{ +class SolveSpaceSolver_EntityWrapper : public SketchSolver_IEntityWrapper { public: - SolveSpaceSolver_EntityWrapper(const FeaturePtr theFeature, const Slvs_Entity& theEntity); - SolveSpaceSolver_EntityWrapper(const AttributePtr theAttribute, const Slvs_Entity& theEntity); + SolveSpaceSolver_EntityWrapper(const FeaturePtr theFeature, + const Slvs_Entity &theEntity); + SolveSpaceSolver_EntityWrapper(const AttributePtr theAttribute, + const Slvs_Entity &theEntity); /// \brief Constructor useful for SketchPlugin_Point only SolveSpaceSolver_EntityWrapper(const FeaturePtr thePointFeature, const AttributePtr thePointAttribute, - const Slvs_Entity& theEntity); + const Slvs_Entity &theEntity); /// \brief Return SolveSpace entity - const Slvs_Entity& entity() const - { return myEntity; } + const Slvs_Entity &entity() const { return myEntity; } /// \brief Return SolveSpace entity to change - Slvs_Entity& changeEntity() - { return myEntity; } + Slvs_Entity &changeEntity() { return myEntity; } /// \brief Return ID of current entity virtual EntityID id() const; /// \brief Change group for the entity - virtual void setGroup(const GroupID& theGroup); + virtual void setGroup(const GroupID &theGroup); /// \brief Return identifier of the group the entity belongs to - virtual GroupID group() const - { return (GroupID)myEntity.group; } + virtual GroupID group() const { return (GroupID)myEntity.group; } /// \brief Return type of current entity virtual SketchSolver_EntityType type() const; @@ -62,14 +61,15 @@ public: virtual bool isUsed(AttributePtr theAttribute) const; /// \brief Compare current entity with other - virtual bool isEqual(const EntityWrapperPtr& theOther); + virtual bool isEqual(const EntityWrapperPtr &theOther); - /// \brief Update values of parameters of this entity by the parameters of given one - /// \return \c true if some parameters change their values - virtual bool update(const std::shared_ptr& theOther); + /// \brief Update values of parameters of this entity by the parameters of + /// given one \return \c true if some parameters change their values + virtual bool + update(const std::shared_ptr &theOther); private: - Slvs_Entity myEntity; + Slvs_Entity myEntity; }; #endif diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.cpp index c51e83b1d..f911bb76f 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.cpp @@ -14,42 +14,39 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -SolveSpaceSolver_ParameterWrapper::SolveSpaceSolver_ParameterWrapper(const Slvs_Param& theParam) - : myParameter(theParam) -{ -} +SolveSpaceSolver_ParameterWrapper::SolveSpaceSolver_ParameterWrapper( + const Slvs_Param &theParam) + : myParameter(theParam) {} -ParameterID SolveSpaceSolver_ParameterWrapper::id() const -{ +ParameterID SolveSpaceSolver_ParameterWrapper::id() const { return (ParameterID)myParameter.h; } -void SolveSpaceSolver_ParameterWrapper::setValue(double theValue) -{ +void SolveSpaceSolver_ParameterWrapper::setValue(double theValue) { myParameter.val = theValue; } -double SolveSpaceSolver_ParameterWrapper::value() const -{ +double SolveSpaceSolver_ParameterWrapper::value() const { return myParameter.val; } -bool SolveSpaceSolver_ParameterWrapper::isEqual(const ParameterWrapperPtr& theOther) -{ +bool SolveSpaceSolver_ParameterWrapper::isEqual( + const ParameterWrapperPtr &theOther) { std::shared_ptr anOtherParam = std::dynamic_pointer_cast(theOther); return anOtherParam && fabs(value() - anOtherParam->value()) < tolerance; } -bool SolveSpaceSolver_ParameterWrapper::update(const ParameterWrapperPtr& theOther) -{ +bool SolveSpaceSolver_ParameterWrapper::update( + const ParameterWrapperPtr &theOther) { std::shared_ptr anOther = std::dynamic_pointer_cast(theOther); if (fabs(value() - anOther->value()) < tolerance) diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.h index 4a436ce57..038390529 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_ParameterWrapper.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_ParameterWrapper_H_ @@ -26,28 +27,26 @@ /** * Wrapper providing operations with parameters in SolveSpace. */ -class SolveSpaceSolver_ParameterWrapper : public SketchSolver_IParameterWrapper -{ +class SolveSpaceSolver_ParameterWrapper + : public SketchSolver_IParameterWrapper { public: - SolveSpaceSolver_ParameterWrapper(const Slvs_Param& theParam); + SolveSpaceSolver_ParameterWrapper(const Slvs_Param &theParam); /// \brief Return SolveSpace parameter - const Slvs_Param& parameter() const - { return myParameter; } + const Slvs_Param ¶meter() const { return myParameter; } /// \brief Return SolveSpace parameter to change - Slvs_Param& changeParameter() - { return myParameter; } + Slvs_Param &changeParameter() { return myParameter; } /// \brief Return ID of current parameter virtual ParameterID id() const; /// \brief Change group for the parameter - virtual void setGroup(const GroupID& theGroup) - { myParameter.group = (Slvs_hGroup)theGroup; } + virtual void setGroup(const GroupID &theGroup) { + myParameter.group = (Slvs_hGroup)theGroup; + } /// \brief Return identifier of the group the parameter belongs to - virtual GroupID group() const - { return (GroupID)myParameter.group; } + virtual GroupID group() const { return (GroupID)myParameter.group; } /// \brief Change value of parameter virtual void setValue(double theValue); @@ -55,11 +54,12 @@ public: virtual double value() const; /// \brief Compare current parameter with other - virtual bool isEqual(const ParameterWrapperPtr& theOther); + virtual bool isEqual(const ParameterWrapperPtr &theOther); /// \brief Update value of parameter by the given one /// \return \c true if the value of parameter is changed - virtual bool update(const std::shared_ptr& theOther); + virtual bool + update(const std::shared_ptr &theOther); private: Slvs_Param myParameter; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp index 57d3cf6f4..7521d5955 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp @@ -14,14 +14,14 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SolveSpaceSolver_Solver.h" #include -SolveSpaceSolver_Solver::SolveSpaceSolver_Solver() -{ +SolveSpaceSolver_Solver::SolveSpaceSolver_Solver() { // Nullify all elements of the set of equations myEquationsSystem.param = 0; myEquationsSystem.params = 0; @@ -44,8 +44,7 @@ SolveSpaceSolver_Solver::SolveSpaceSolver_Solver() myParamsCopy = 0; } -SolveSpaceSolver_Solver::~SolveSpaceSolver_Solver() -{ +SolveSpaceSolver_Solver::~SolveSpaceSolver_Solver() { if (myEquationsSystem.constraint) delete[] myEquationsSystem.constraint; myEquationsSystem.constraint = 0; @@ -53,37 +52,35 @@ SolveSpaceSolver_Solver::~SolveSpaceSolver_Solver() delete[] myEquationsSystem.failed; myEquationsSystem.failed = 0; if (myParamsCopy) - delete [] myParamsCopy; + delete[] myParamsCopy; myParamsCopy = 0; } -void SolveSpaceSolver_Solver::setParameters(Slvs_Param* theParameters, int theSize) -{ +void SolveSpaceSolver_Solver::setParameters(Slvs_Param *theParameters, + int theSize) { myEquationsSystem.param = theParameters; myEquationsSystem.params = theSize; } - -void SolveSpaceSolver_Solver::setDraggedParameters(const Slvs_hParam* theDragged) -{ +void SolveSpaceSolver_Solver::setDraggedParameters( + const Slvs_hParam *theDragged) { for (unsigned int i = 0; i < 4; i++) myEquationsSystem.dragged[i] = theDragged[i]; } -void SolveSpaceSolver_Solver::setEntities(Slvs_Entity* theEntities, int theSize) -{ +void SolveSpaceSolver_Solver::setEntities(Slvs_Entity *theEntities, + int theSize) { myEquationsSystem.entity = theEntities; myEquationsSystem.entities = theSize; } -void SolveSpaceSolver_Solver::setConstraints(Slvs_Constraint* theConstraints, int theSize) -{ +void SolveSpaceSolver_Solver::setConstraints(Slvs_Constraint *theConstraints, + int theSize) { if (!myEquationsSystem.constraint) { myEquationsSystem.constraint = new Slvs_Constraint[theSize]; myEquationsSystem.constraints = theSize; myEquationsSystem.failed = new Slvs_hConstraint[theSize]; - } - else if (myEquationsSystem.constraints != theSize) { + } else if (myEquationsSystem.constraints != theSize) { if (theSize > myEquationsSystem.constraints) { delete[] myEquationsSystem.constraint; myEquationsSystem.constraint = new Slvs_Constraint[theSize]; @@ -93,15 +90,15 @@ void SolveSpaceSolver_Solver::setConstraints(Slvs_Constraint* theConstraints, in } myEquationsSystem.constraints = theSize; } - memcpy(myEquationsSystem.constraint, theConstraints, theSize * sizeof(Slvs_Constraint)); - memset(myEquationsSystem.failed, SLVS_C_UNKNOWN, theSize * sizeof(Slvs_hConstraint)); + memcpy(myEquationsSystem.constraint, theConstraints, + theSize * sizeof(Slvs_Constraint)); + memset(myEquationsSystem.failed, SLVS_C_UNKNOWN, + theSize * sizeof(Slvs_hConstraint)); } - -SketchSolver_SolveStatus SolveSpaceSolver_Solver::solve() -{ - //if (myEquationsSystem.constraints <= 0) - // return STATUS_EMPTYSET; +SketchSolver_SolveStatus SolveSpaceSolver_Solver::solve() { + // if (myEquationsSystem.constraints <= 0) + // return STATUS_EMPTYSET; myEquationsSystem.calculateFaileds = 0; if (myFindFaileds) { @@ -138,32 +135,30 @@ SketchSolver_SolveStatus SolveSpaceSolver_Solver::solve() return aStatus; } -void SolveSpaceSolver_Solver::prepare() -{ +void SolveSpaceSolver_Solver::prepare() { // make a copy of parameters to be able to make undo if (myParamsCopy) - delete [] myParamsCopy; + delete[] myParamsCopy; myParamsCopy = new Slvs_Param[myEquationsSystem.params]; - memcpy(myParamsCopy, myEquationsSystem.param, myEquationsSystem.params * sizeof(Slvs_Param)); + memcpy(myParamsCopy, myEquationsSystem.param, + myEquationsSystem.params * sizeof(Slvs_Param)); } -void SolveSpaceSolver_Solver::undo() -{ +void SolveSpaceSolver_Solver::undo() { if (myParamsCopy) { - memcpy(myEquationsSystem.param, myParamsCopy, myEquationsSystem.params * sizeof(Slvs_Param)); - delete [] myParamsCopy; + memcpy(myEquationsSystem.param, myParamsCopy, + myEquationsSystem.params * sizeof(Slvs_Param)); + delete[] myParamsCopy; } myParamsCopy = 0; } - -bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const -{ +bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const { const double aTol2 = tolerance * tolerance; double anArcPoints[3][2]; for (int anEnt = 0; anEnt < myEquationsSystem.entities; ++anEnt) { - const Slvs_Entity& anEntity = myEquationsSystem.entity[anEnt]; + const Slvs_Entity &anEntity = myEquationsSystem.entity[anEnt]; if (anEntity.type != SLVS_E_ARC_OF_CIRCLE) continue; @@ -178,7 +173,8 @@ bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const aPntInd = myEquationsSystem.entities - 1; if (myEquationsSystem.entity[aPntInd].h > anEntity.point[aPnt]) aStep = -1; - for (; aPntInd >=0 && aPntInd < myEquationsSystem.entities; aPntInd += aStep) + for (; aPntInd >= 0 && aPntInd < myEquationsSystem.entities; + aPntInd += aStep) if (myEquationsSystem.entity[aPntInd].h == anEntity.point[aPnt]) break; @@ -187,16 +183,18 @@ bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const if (aParamInd >= myEquationsSystem.params) { aParamInd = myEquationsSystem.params - 1; aStep = -1; - } - else if ((int)myEquationsSystem.param[aParamInd].h > aParamInd) + } else if ((int)myEquationsSystem.param[aParamInd].h > aParamInd) aStep = -1; - else aStep = 1; + else + aStep = 1; - for (; aParamInd >=0 && aParamInd < myEquationsSystem.params; aParamInd += aStep) - if (myEquationsSystem.param[aParamInd].h == myEquationsSystem.entity[aPntInd].param[0]) + for (; aParamInd >= 0 && aParamInd < myEquationsSystem.params; + aParamInd += aStep) + if (myEquationsSystem.param[aParamInd].h == + myEquationsSystem.entity[aPntInd].param[0]) break; anArcPoints[aPnt][0] = myEquationsSystem.param[aParamInd].val; - anArcPoints[aPnt][1] = myEquationsSystem.param[aParamInd+1].val; + anArcPoints[aPnt][1] = myEquationsSystem.param[aParamInd + 1].val; } // check radius of arc @@ -204,22 +202,23 @@ bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const anArcPoints[1][1] -= anArcPoints[0][1]; anArcPoints[2][0] -= anArcPoints[0][0]; anArcPoints[2][1] -= anArcPoints[0][1]; - if (anArcPoints[1][0] * anArcPoints[1][0] + anArcPoints[1][1] * anArcPoints[1][1] < aTol2 || - anArcPoints[2][0] * anArcPoints[2][0] + anArcPoints[2][1] * anArcPoints[2][1] < aTol2) + if (anArcPoints[1][0] * anArcPoints[1][0] + + anArcPoints[1][1] * anArcPoints[1][1] < + aTol2 || + anArcPoints[2][0] * anArcPoints[2][0] + + anArcPoints[2][1] * anArcPoints[2][1] < + aTol2) return true; } return false; } -bool SolveSpaceSolver_Solver::isConflicting(const ConstraintID& theConstraint) const -{ +bool SolveSpaceSolver_Solver::isConflicting( + const ConstraintID &theConstraint) const { for (int i = 0; i < myEquationsSystem.faileds; ++i) if (myEquationsSystem.failed[i] == (Slvs_hConstraint)theConstraint) return true; return false; } -int SolveSpaceSolver_Solver::dof() const -{ - return myEquationsSystem.dof; -} +int SolveSpaceSolver_Solver::dof() const { return myEquationsSystem.dof; } diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.h index a3b674dbd..19c5f1c12 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_Solver_H_ @@ -29,17 +30,17 @@ typedef unsigned int UINT32; #else #include #endif -#include #include +#include #include // Unknown constraint (for error reporting) #define SLVS_C_UNKNOWN 0 // Fillet constraint identifier -#define SLVS_C_FILLET 100100 +#define SLVS_C_FILLET 100100 // Multi-rotation constraint identifier -#define SLVS_C_MULTI_ROTATION 100101 +#define SLVS_C_MULTI_ROTATION 100101 // Multi-translation constraint identifier #define SLVS_C_MULTI_TRANSLATION 100102 // Unknown entity @@ -53,8 +54,7 @@ typedef unsigned int UINT32; * \ingroup Plugins * \brief Performs high-level operations to solve sketch in SolveSpace. */ -class SolveSpaceSolver_Solver : public SketchSolver_ISolver -{ +class SolveSpaceSolver_Solver : public SketchSolver_ISolver { public: SolveSpaceSolver_Solver(); virtual ~SolveSpaceSolver_Solver(); @@ -63,25 +63,26 @@ public: * \param[in] theParameters pointer to the array of parameters * \param[in] theSize size of this array */ - void setParameters(Slvs_Param* theParameters, int theSize); + void setParameters(Slvs_Param *theParameters, int theSize); /** \brief Change array of entities * \param[in] theEntities pointer to the array of entities * \param[in] theSize size of this array */ - void setEntities(Slvs_Entity* theEntities, int theSize); + void setEntities(Slvs_Entity *theEntities, int theSize); /** \brief Change array of constraints * \param[in] theConstraints pointer to the array of constraints * \param[in] theSize size of this array */ - void setConstraints(Slvs_Constraint* theConstraints, int theSize); + void setConstraints(Slvs_Constraint *theConstraints, int theSize); /** \brief Store the parameters of the point which was moved by user. * The solver will watch this items to be constant - * \param[in] theDragged list of parameters (not more than 4) which should not be changed during solving + * \param[in] theDragged list of parameters (not more than 4) which should + * not be changed during solving */ - void setDraggedParameters(const Slvs_hParam* theDragged); + void setDraggedParameters(const Slvs_hParam *theDragged); /** \brief Solve the set of equations * \return identifier whether solution succeeded @@ -95,7 +96,7 @@ public: virtual void undo(); /// \brief Check the constraint is conflicted with others - virtual bool isConflicting(const ConstraintID& theConstraint) const; + virtual bool isConflicting(const ConstraintID &theConstraint) const; /// \brief Degrees of freedom virtual int dof() const; @@ -106,7 +107,7 @@ private: private: Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace - Slvs_Param* myParamsCopy; ///< copy of parameters + Slvs_Param *myParamsCopy; ///< copy of parameters }; #endif diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp index 2ead28840..d1073f837 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include +#include #include #include #include -#include +#include #include #include #include -#include #include +#include #include #include @@ -41,34 +42,32 @@ * \param[in] theEntities list of elements * \return position of the found element or -1 if the element is not found */ -template -static int Search(const uint32_t& theEntityID, const std::vector& theEntities); +template +static int Search(const uint32_t &theEntityID, + const std::vector &theEntities); /// \brief Compare two parameters to be different -static bool IsNotEqual(const Slvs_Param& theParam1, const Slvs_Param& theParam2); +static bool IsNotEqual(const Slvs_Param &theParam1, + const Slvs_Param &theParam2); /// \brief Compare two entities to be different -static bool IsNotEqual(const Slvs_Entity& theEntity1, const Slvs_Entity& theEntity2); +static bool IsNotEqual(const Slvs_Entity &theEntity1, + const Slvs_Entity &theEntity2); /// \brief Compare two constraints to be different -static bool IsNotEqual(const Slvs_Constraint& theConstraint1, - const Slvs_Constraint& theConstraint2); - - -SolveSpaceSolver_Storage::SolveSpaceSolver_Storage(const GroupID& theGroup) - : SketchSolver_Storage(theGroup), - myWorkplaneID(SLVS_E_UNKNOWN), - myParamMaxID(SLVS_E_UNKNOWN), - myEntityMaxID(SLVS_E_UNKNOWN), - myConstrMaxID(SLVS_C_UNKNOWN), - myDuplicatedConstraint(false) -{ -} +static bool IsNotEqual(const Slvs_Constraint &theConstraint1, + const Slvs_Constraint &theConstraint2); + +SolveSpaceSolver_Storage::SolveSpaceSolver_Storage(const GroupID &theGroup) + : SketchSolver_Storage(theGroup), myWorkplaneID(SLVS_E_UNKNOWN), + myParamMaxID(SLVS_E_UNKNOWN), myEntityMaxID(SLVS_E_UNKNOWN), + myConstrMaxID(SLVS_C_UNKNOWN), myDuplicatedConstraint(false) {} -bool SolveSpaceSolver_Storage::update(ConstraintWrapperPtr theConstraint) -{ +bool SolveSpaceSolver_Storage::update(ConstraintWrapperPtr theConstraint) { bool isUpdated = false; std::shared_ptr aConstraint = - std::dynamic_pointer_cast(theConstraint); - Slvs_Constraint aSlvsConstr = getConstraint((Slvs_hConstraint)aConstraint->id()); + std::dynamic_pointer_cast( + theConstraint); + Slvs_Constraint aSlvsConstr = + getConstraint((Slvs_hConstraint)aConstraint->id()); if (aSlvsConstr.h == SLVS_C_UNKNOWN) aSlvsConstr = aConstraint->constraint(); @@ -80,8 +79,8 @@ bool SolveSpaceSolver_Storage::update(ConstraintWrapperPtr theConstraint) } // update constrained entities - Slvs_hEntity* aPnts[2] = {&aSlvsConstr.ptA, &aSlvsConstr.ptB}; - Slvs_hEntity* anEnts[4] = {&aSlvsConstr.entityA, &aSlvsConstr.entityB, + Slvs_hEntity *aPnts[2] = {&aSlvsConstr.ptA, &aSlvsConstr.ptB}; + Slvs_hEntity *anEnts[4] = {&aSlvsConstr.entityA, &aSlvsConstr.entityB, &aSlvsConstr.entityC, &aSlvsConstr.entityD}; int aPtInd = 0; int aEntInd = 0; @@ -93,9 +92,11 @@ bool SolveSpaceSolver_Storage::update(ConstraintWrapperPtr theConstraint) // do not update constrained entities for Multi constraints, // and for middle point constraint translated to equal lines ConstraintPtr aBaseConstraint = theConstraint->baseConstraint(); - if (aSlvsConstr.type == SLVS_C_MULTI_ROTATION || aSlvsConstr.type == SLVS_C_MULTI_TRANSLATION || - (aBaseConstraint && aBaseConstraint->getKind() == SketchPlugin_ConstraintMiddle::ID() && - aSlvsConstr.type != SLVS_C_AT_MIDPOINT)) + if (aSlvsConstr.type == SLVS_C_MULTI_ROTATION || + aSlvsConstr.type == SLVS_C_MULTI_TRANSLATION || + (aBaseConstraint && + aBaseConstraint->getKind() == SketchPlugin_ConstraintMiddle::ID() && + aSlvsConstr.type != SLVS_C_AT_MIDPOINT)) continue; Slvs_hEntity anID = (Slvs_hEntity)(*anIt)->id(); @@ -115,7 +116,8 @@ bool SolveSpaceSolver_Storage::update(ConstraintWrapperPtr theConstraint) } // update constraint itself (do not update constraints Multi) - if (aSlvsConstr.type != SLVS_C_MULTI_ROTATION && aSlvsConstr.type != SLVS_C_MULTI_TRANSLATION) { + if (aSlvsConstr.type != SLVS_C_MULTI_ROTATION && + aSlvsConstr.type != SLVS_C_MULTI_TRANSLATION) { if (aSlvsConstr.wrkpl == SLVS_E_UNKNOWN && myWorkplaneID != SLVS_E_UNKNOWN) aSlvsConstr.wrkpl = myWorkplaneID; if (aSlvsConstr.group == SLVS_G_UNKNOWN) @@ -126,15 +128,15 @@ bool SolveSpaceSolver_Storage::update(ConstraintWrapperPtr theConstraint) aConstraint->changeConstraint() = getConstraint(aConstrID); isUpdated = true; // check duplicated constraints based on different attributes - if (myDuplicatedConstraint && findSameConstraint(aConstraint) && !hasDupConstraints) + if (myDuplicatedConstraint && findSameConstraint(aConstraint) && + !hasDupConstraints) myDuplicatedConstraint = false; } } return isUpdated; } -bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity) -{ +bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity) { bool isUpdated = false; std::shared_ptr anEntity = std::dynamic_pointer_cast(theEntity); @@ -147,12 +149,14 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity) // if the entity is an attribute, need to update its coordinates if (anEntity->baseAttribute()) { BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance(); - EntityWrapperPtr anUpdAttr = aBuilder->createAttribute(anEntity->baseAttribute(), GID_UNKNOWN); + EntityWrapperPtr anUpdAttr = + aBuilder->createAttribute(anEntity->baseAttribute(), GID_UNKNOWN); if (anUpdAttr) { std::list anUpdParams = anUpdAttr->parameters(); std::list::iterator anUpdIt = anUpdParams.begin(); - for (aPIt = aParams.begin(); aPIt != aParams.end() && anUpdIt != anUpdParams.end(); - ++aPIt, ++anUpdIt) { + for (aPIt = aParams.begin(); + aPIt != aParams.end() && anUpdIt != anUpdParams.end(); + ++aPIt, ++anUpdIt) { (*aPIt)->update(*anUpdIt); } } @@ -189,7 +193,8 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity) } } if (theEntity->type() == ENTITY_POINT && aSubEntities.size() == 1) { - // theEntity is based on SketchPlugin_Point => need to substitute its attribute instead + // theEntity is based on SketchPlugin_Point => need to substitute its + // attribute instead bool isNew = (aSlvsEnt.h == SLVS_E_UNKNOWN); aSlvsEnt = getEntity(aSlvsEnt.point[0]); if (isNew) { @@ -215,25 +220,25 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity) return isUpdated; } -bool SolveSpaceSolver_Storage::update(ParameterWrapperPtr theParameter) -{ +bool SolveSpaceSolver_Storage::update(ParameterWrapperPtr theParameter) { std::shared_ptr aParameter = - std::dynamic_pointer_cast(theParameter); - const Slvs_Param& aParam = getParameter((Slvs_hParam)aParameter->id()); - if (aParam.h != SLVS_E_UNKNOWN && fabs(aParam.val - aParameter->value()) < tolerance) + std::dynamic_pointer_cast( + theParameter); + const Slvs_Param &aParam = getParameter((Slvs_hParam)aParameter->id()); + if (aParam.h != SLVS_E_UNKNOWN && + fabs(aParam.val - aParameter->value()) < tolerance) return false; Slvs_Param aParamToUpd = aParameter->parameter(); if (aParamToUpd.group == SLVS_G_UNKNOWN) - aParamToUpd.group = aParameter->isParametric() ? (Slvs_hGroup)GID_OUTOFGROUP : - (Slvs_hGroup)myGroupID; + aParamToUpd.group = aParameter->isParametric() ? (Slvs_hGroup)GID_OUTOFGROUP + : (Slvs_hGroup)myGroupID; Slvs_hParam anID = updateParameter(aParamToUpd); if (aParam.h == SLVS_E_UNKNOWN) // new parameter aParameter->changeParameter() = getParameter(anID); return true; } -void SolveSpaceSolver_Storage::storeWorkplane(EntityWrapperPtr theSketch) -{ +void SolveSpaceSolver_Storage::storeWorkplane(EntityWrapperPtr theSketch) { mySketchID = theSketch->id(); myWorkplaneID = (Slvs_hEntity)mySketchID; @@ -252,8 +257,8 @@ void SolveSpaceSolver_Storage::storeWorkplane(EntityWrapperPtr theSketch) anIt->wrkpl = myWorkplaneID; } -void SolveSpaceSolver_Storage::changeGroup(EntityWrapperPtr theEntity, const GroupID& theGroup) -{ +void SolveSpaceSolver_Storage::changeGroup(EntityWrapperPtr theEntity, + const GroupID &theGroup) { std::list aParams = theEntity->parameters(); std::list::iterator aPIt = aParams.begin(); for (; aPIt != aParams.end(); ++aPIt) @@ -273,8 +278,8 @@ void SolveSpaceSolver_Storage::changeGroup(EntityWrapperPtr theEntity, const Gro } } -void SolveSpaceSolver_Storage::changeGroup(ParameterWrapperPtr theParam, const GroupID& theGroup) -{ +void SolveSpaceSolver_Storage::changeGroup(ParameterWrapperPtr theParam, + const GroupID &theGroup) { GroupID aGroup = theGroup; if (theParam->isParametric()) aGroup = GID_OUTOFGROUP; @@ -289,24 +294,28 @@ void SolveSpaceSolver_Storage::changeGroup(ParameterWrapperPtr theParam, const G } } -void SolveSpaceSolver_Storage::addCoincidentPoints( - EntityWrapperPtr theMaster, EntityWrapperPtr theSlave) -{ +void SolveSpaceSolver_Storage::addCoincidentPoints(EntityWrapperPtr theMaster, + EntityWrapperPtr theSlave) { if (theMaster->type() != ENTITY_POINT || theSlave->type() != ENTITY_POINT) return; if (!theMaster->subEntities().empty() || !theSlave->subEntities().empty()) { - EntityWrapperPtr aSubMaster = theMaster->subEntities().empty() ? - theMaster : theMaster->subEntities().front(); - EntityWrapperPtr aSubSlave = theSlave->subEntities().empty() ? - theSlave : theSlave->subEntities().front(); + EntityWrapperPtr aSubMaster = theMaster->subEntities().empty() + ? theMaster + : theMaster->subEntities().front(); + EntityWrapperPtr aSubSlave = theSlave->subEntities().empty() + ? theSlave + : theSlave->subEntities().front(); return addCoincidentPoints(aSubMaster, aSubSlave); } // Search available coincidence - CoincidentPointsMap::iterator aMasterFound = myCoincidentPoints.find(theMaster); + CoincidentPointsMap::iterator aMasterFound = + myCoincidentPoints.find(theMaster); CoincidentPointsMap::iterator aSlaveFound = myCoincidentPoints.find(theSlave); - if (aMasterFound == myCoincidentPoints.end() || aSlaveFound == myCoincidentPoints.end()) { - // try to find master and slave points in the lists of slaves of already existent coincidences + if (aMasterFound == myCoincidentPoints.end() || + aSlaveFound == myCoincidentPoints.end()) { + // try to find master and slave points in the lists of slaves of already + // existent coincidences CoincidentPointsMap::iterator anIt = myCoincidentPoints.begin(); for (; anIt != myCoincidentPoints.end(); ++anIt) { if (anIt->second.find(theMaster) != anIt->second.end()) @@ -314,7 +323,8 @@ void SolveSpaceSolver_Storage::addCoincidentPoints( else if (anIt->second.find(theSlave) != anIt->second.end()) aSlaveFound = anIt; - if (aMasterFound != myCoincidentPoints.end() && aSlaveFound != myCoincidentPoints.end()) + if (aMasterFound != myCoincidentPoints.end() && + aSlaveFound != myCoincidentPoints.end()) break; } } @@ -327,7 +337,8 @@ void SolveSpaceSolver_Storage::addCoincidentPoints( return; // already coincident if (aSlaveFound != myCoincidentPoints.end()) { - // A slave has been found, we need to attach all points coincident with it to the new master + // A slave has been found, we need to attach all points coincident with it + // to the new master std::set aNewSlaves = aSlaveFound->second; aNewSlaves.insert(aSlaveFound->first); myCoincidentPoints.erase(aSlaveFound); @@ -340,7 +351,8 @@ void SolveSpaceSolver_Storage::addCoincidentPoints( replaceInFeatures(theSlave, theMaster); replaceInConstraints(theSlave, theMaster); - // Remove slave entity (if the IDs are equal no need to remove slave entity, just update it) + // Remove slave entity (if the IDs are equal no need to remove slave entity, + // just update it) if (theMaster->id() != theSlave->id()) removeEntity((Slvs_hEntity)theSlave->id()); @@ -355,10 +367,10 @@ void SolveSpaceSolver_Storage::addCoincidentPoints( } } -void SolveSpaceSolver_Storage::replaceInFeatures( - EntityWrapperPtr theSource, EntityWrapperPtr theDest) -{ - std::map::const_iterator anIt = myFeatureMap.begin(); +void SolveSpaceSolver_Storage::replaceInFeatures(EntityWrapperPtr theSource, + EntityWrapperPtr theDest) { + std::map::const_iterator anIt = + myFeatureMap.begin(); for (; anIt != myFeatureMap.end(); ++anIt) { if (!anIt->second) continue; @@ -389,10 +401,9 @@ void SolveSpaceSolver_Storage::replaceInFeatures( } } -void SolveSpaceSolver_Storage::replaceInConstraints( - EntityWrapperPtr theSource, EntityWrapperPtr theDest) -{ - std::map >::const_iterator +void SolveSpaceSolver_Storage::replaceInConstraints(EntityWrapperPtr theSource, + EntityWrapperPtr theDest) { + std::map>::const_iterator anIt = myConstraintMap.begin(); std::list::const_iterator aCIt; for (; anIt != myConstraintMap.end(); ++anIt) @@ -420,7 +431,8 @@ void SolveSpaceSolver_Storage::replaceInConstraints( std::dynamic_pointer_cast(*aCIt); if (theSource->id() == theDest->id()) { // No need to update SolveSpace constraint if the entities are the same - aWrapper->changeConstraint() = getConstraint((Slvs_hConstraint)aWrapper->id()); + aWrapper->changeConstraint() = + getConstraint((Slvs_hConstraint)aWrapper->id()); aWrapper->setEntities(aSubs); continue; } @@ -433,13 +445,15 @@ void SolveSpaceSolver_Storage::replaceInConstraints( aConstr.ptB = (Slvs_hEntity)theDest->id(); // check the constraint is duplicated - std::vector::const_iterator aSlvsCIt = myConstraints.begin(); + std::vector::const_iterator aSlvsCIt = + myConstraints.begin(); for (; aSlvsCIt != myConstraints.end(); ++aSlvsCIt) - if (aConstr.h != aSlvsCIt->h && - aConstr.type == aSlvsCIt->type && + if (aConstr.h != aSlvsCIt->h && aConstr.type == aSlvsCIt->type && aConstr.ptA == aSlvsCIt->ptA && aConstr.ptB == aSlvsCIt->ptB && - aConstr.entityA == aSlvsCIt->entityA && aConstr.entityB == aSlvsCIt->entityB && - aConstr.entityC == aSlvsCIt->entityC && aConstr.entityD == aSlvsCIt->entityD) { + aConstr.entityA == aSlvsCIt->entityA && + aConstr.entityB == aSlvsCIt->entityB && + aConstr.entityC == aSlvsCIt->entityC && + aConstr.entityD == aSlvsCIt->entityD) { Slvs_hConstraint anIDToRemove = aConstr.h; aConstr = *aSlvsCIt; int aShift = (int)(aSlvsCIt - myConstraints.begin()); @@ -453,11 +467,12 @@ void SolveSpaceSolver_Storage::replaceInConstraints( if (aSlvsCIt != myConstraints.end()) { // constraint is duplicated, search its wrapper to add the mapping - std::map >::const_iterator + std::map>::const_iterator anIt2 = myConstraintMap.begin(); std::list::const_iterator aCIt2; for (; anIt2 != myConstraintMap.end(); ++anIt2) - for (aCIt2 = anIt2->second.begin(); aCIt2 != anIt2->second.end(); ++aCIt2) + for (aCIt2 = anIt2->second.begin(); aCIt2 != anIt2->second.end(); + ++aCIt2) if ((Slvs_hConstraint)(*aCIt2)->id() == aConstr.h) { addSameConstraints(*aCIt2, aWrapper); break; @@ -471,16 +486,14 @@ void SolveSpaceSolver_Storage::replaceInConstraints( } } -void SolveSpaceSolver_Storage::addSameConstraints(ConstraintWrapperPtr theConstraint1, - ConstraintWrapperPtr theConstraint2) -{ +void SolveSpaceSolver_Storage::addSameConstraints( + ConstraintWrapperPtr theConstraint1, ConstraintWrapperPtr theConstraint2) { SameConstraintMap::iterator anIt = myEqualConstraints.begin(); for (; anIt != myEqualConstraints.end(); ++anIt) { if (anIt->find(theConstraint1) != anIt->end()) { anIt->insert(theConstraint2); return; - } - else if (anIt->find(theConstraint2) != anIt->end()) { + } else if (anIt->find(theConstraint2) != anIt->end()) { anIt->insert(theConstraint1); return; } @@ -492,17 +505,19 @@ void SolveSpaceSolver_Storage::addSameConstraints(ConstraintWrapperPtr theConstr myEqualConstraints.push_back(aNewGroup); } -bool SolveSpaceSolver_Storage::findSameConstraint(ConstraintWrapperPtr theConstraint) -{ +bool SolveSpaceSolver_Storage::findSameConstraint( + ConstraintWrapperPtr theConstraint) { if (theConstraint->type() == CONSTRAINT_PT_PT_COINCIDENT || theConstraint->type() == CONSTRAINT_MULTI_ROTATION || theConstraint->type() == CONSTRAINT_MULTI_TRANSLATION) return false; - const Slvs_Constraint& aCBase = - std::dynamic_pointer_cast(theConstraint)->constraint(); + const Slvs_Constraint &aCBase = + std::dynamic_pointer_cast( + theConstraint) + ->constraint(); - std::map >::const_iterator + std::map>::const_iterator aCIt = myConstraintMap.begin(); std::list::const_iterator aCWIt; for (; aCIt != myConstraintMap.end(); ++aCIt) @@ -512,12 +527,15 @@ bool SolveSpaceSolver_Storage::findSameConstraint(ConstraintWrapperPtr theConstr (*aCWIt)->type() == CONSTRAINT_MULTI_TRANSLATION) continue; if ((*aCWIt)->type() == theConstraint->type()) { - const Slvs_Constraint& aCComp = getConstraint((Slvs_hConstraint)(*aCWIt)->id()); + const Slvs_Constraint &aCComp = + getConstraint((Slvs_hConstraint)(*aCWIt)->id()); if (aCBase.ptA == aCComp.ptA && aCBase.ptB == aCComp.ptB && - aCBase.entityA == aCComp.entityA && aCBase.entityB == aCComp.entityB && - aCBase.entityC == aCComp.entityC && aCBase.entityD == aCComp.entityD && - fabs(aCBase.valA -aCComp.valA) < tolerance) { + aCBase.entityA == aCComp.entityA && + aCBase.entityB == aCComp.entityB && + aCBase.entityC == aCComp.entityC && + aCBase.entityD == aCComp.entityD && + fabs(aCBase.valA - aCComp.valA) < tolerance) { addSameConstraints(*aCWIt, theConstraint); return true; } @@ -526,26 +544,26 @@ bool SolveSpaceSolver_Storage::findSameConstraint(ConstraintWrapperPtr theConstr return false; } - -EntityWrapperPtr SolveSpaceSolver_Storage::calculateMiddlePoint( - EntityWrapperPtr theBase, double theCoeff) -{ +EntityWrapperPtr +SolveSpaceSolver_Storage::calculateMiddlePoint(EntityWrapperPtr theBase, + double theCoeff) { BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance(); std::shared_ptr aMidPoint; if (theBase->type() == ENTITY_LINE) { std::shared_ptr aPoints[2]; - const std::list& aSubs = theBase->subEntities(); + const std::list &aSubs = theBase->subEntities(); std::list::const_iterator anIt = aSubs.begin(); for (int i = 0; i < 2; ++i, ++anIt) aPoints[i] = aBuilder->point(*anIt); - aMidPoint = aPoints[0]->xy()->multiplied(1.0 - theCoeff)->added( - aPoints[1]->xy()->multiplied(theCoeff)); - } - else if (theBase->type() == ENTITY_ARC) { + aMidPoint = aPoints[0] + ->xy() + ->multiplied(1.0 - theCoeff) + ->added(aPoints[1]->xy()->multiplied(theCoeff)); + } else if (theBase->type() == ENTITY_ARC) { double theX, theY; double anArcPoint[3][2]; - const std::list& aSubs = theBase->subEntities(); + const std::list &aSubs = theBase->subEntities(); std::list::const_iterator anIt = aSubs.begin(); for (int i = 0; i < 3; ++i, ++anIt) { std::shared_ptr aPoint = aBuilder->point(*anIt); @@ -555,10 +573,10 @@ EntityWrapperPtr SolveSpaceSolver_Storage::calculateMiddlePoint( // project last point of arc on the arc double x = anArcPoint[1][0] - anArcPoint[0][0]; double y = anArcPoint[1][1] - anArcPoint[0][1]; - double aRad = sqrt(x*x + y*y); + double aRad = sqrt(x * x + y * y); x = anArcPoint[2][0] - anArcPoint[0][0]; y = anArcPoint[2][1] - anArcPoint[0][1]; - double aNorm = sqrt(x*x + y*y); + double aNorm = sqrt(x * x + y * y); if (aNorm >= tolerance) { anArcPoint[2][0] = x * aRad / aNorm; anArcPoint[2][1] = y * aRad / aNorm; @@ -572,18 +590,20 @@ EntityWrapperPtr SolveSpaceSolver_Storage::calculateMiddlePoint( theX = anArcPoint[0][0] + anArcPoint[2][0]; theY = anArcPoint[0][1] + anArcPoint[2][1]; } else { - std::shared_ptr - aStartDir(new GeomAPI_Dir2d(anArcPoint[1][0], anArcPoint[1][1])); - std::shared_ptr - aEndDir(new GeomAPI_Dir2d(anArcPoint[2][0], anArcPoint[2][1])); + std::shared_ptr aStartDir( + new GeomAPI_Dir2d(anArcPoint[1][0], anArcPoint[1][1])); + std::shared_ptr aEndDir( + new GeomAPI_Dir2d(anArcPoint[2][0], anArcPoint[2][1])); double anAngle = aStartDir->angle(aEndDir); if (anAngle < 0) anAngle += 2.0 * PI; anAngle *= theCoeff; double aCos = cos(anAngle); double aSin = sin(anAngle); - theX = anArcPoint[0][0] + anArcPoint[1][0] * aCos - anArcPoint[1][1] * aSin; - theY = anArcPoint[0][1] + anArcPoint[1][0] * aSin + anArcPoint[1][1] * aCos; + theX = + anArcPoint[0][0] + anArcPoint[1][0] * aCos - anArcPoint[1][1] * aSin; + theY = + anArcPoint[0][1] + anArcPoint[1][0] * aSin + anArcPoint[1][1] * aCos; } aMidPoint = std::shared_ptr(new GeomAPI_XY(theX, theY)); } @@ -592,29 +612,29 @@ EntityWrapperPtr SolveSpaceSolver_Storage::calculateMiddlePoint( return EntityWrapperPtr(); std::list aParameters; - Slvs_Param aParam1 = Slvs_MakeParam(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, aMidPoint->x()); + Slvs_Param aParam1 = + Slvs_MakeParam(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, aMidPoint->x()); aParam1.h = addParameter(aParam1); - aParameters.push_back(ParameterWrapperPtr(new SolveSpaceSolver_ParameterWrapper(aParam1))); - Slvs_Param aParam2 = Slvs_MakeParam(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, aMidPoint->y()); + aParameters.push_back( + ParameterWrapperPtr(new SolveSpaceSolver_ParameterWrapper(aParam1))); + Slvs_Param aParam2 = + Slvs_MakeParam(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, aMidPoint->y()); aParam2.h = addParameter(aParam2); - aParameters.push_back(ParameterWrapperPtr(new SolveSpaceSolver_ParameterWrapper(aParam2))); + aParameters.push_back( + ParameterWrapperPtr(new SolveSpaceSolver_ParameterWrapper(aParam2))); // Create entity (parameters are not filled) - Slvs_Entity anEntity = Slvs_MakePoint2d(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, - (Slvs_hEntity)myWorkplaneID, aParam1.h, aParam2.h); + Slvs_Entity anEntity = + Slvs_MakePoint2d(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, + (Slvs_hEntity)myWorkplaneID, aParam1.h, aParam2.h); anEntity.h = addEntity(anEntity); - EntityWrapperPtr aResult(new SolveSpaceSolver_EntityWrapper(AttributePtr(), anEntity)); + EntityWrapperPtr aResult( + new SolveSpaceSolver_EntityWrapper(AttributePtr(), anEntity)); aResult->setParameters(aParameters); return aResult; } - - - - - -Slvs_hParam SolveSpaceSolver_Storage::addParameter(const Slvs_Param& theParam) -{ +Slvs_hParam SolveSpaceSolver_Storage::addParameter(const Slvs_Param &theParam) { if (theParam.h > 0 && theParam.h <= myParamMaxID) { // parameter is already used, rewrite it return updateParameter(theParam); @@ -630,8 +650,8 @@ Slvs_hParam SolveSpaceSolver_Storage::addParameter(const Slvs_Param& theParam) return aParam.h; } -Slvs_hParam SolveSpaceSolver_Storage::updateParameter(const Slvs_Param& theParam) -{ +Slvs_hParam +SolveSpaceSolver_Storage::updateParameter(const Slvs_Param &theParam) { if (theParam.h > 0 && theParam.h <= myParamMaxID) { // parameter already used, rewrite it int aPos = Search(theParam.h, myParameters); @@ -649,8 +669,7 @@ Slvs_hParam SolveSpaceSolver_Storage::updateParameter(const Slvs_Param& theParam return addParameter(aParam); } -bool SolveSpaceSolver_Storage::removeParameter(const Slvs_hParam& theParamID) -{ +bool SolveSpaceSolver_Storage::removeParameter(const Slvs_hParam &theParamID) { int aPos = Search(theParamID, myParameters); if (aPos >= 0 && aPos < (int)myParameters.size()) { // Firstly, search the parameter is not used elsewhere @@ -662,14 +681,15 @@ bool SolveSpaceSolver_Storage::removeParameter(const Slvs_hParam& theParamID) } // Remove parameter myParameters.erase(myParameters.begin() + aPos); - myParamMaxID = myParameters.empty() ? SLVS_E_UNKNOWN : myParameters.back().h; + myParamMaxID = + myParameters.empty() ? SLVS_E_UNKNOWN : myParameters.back().h; myNeedToResolve = true; } return true; } -const Slvs_Param& SolveSpaceSolver_Storage::getParameter(const Slvs_hParam& theParamID) const -{ +const Slvs_Param & +SolveSpaceSolver_Storage::getParameter(const Slvs_hParam &theParamID) const { int aPos = Search(theParamID, myParameters); if (aPos >= 0 && aPos < (int)myParameters.size()) return myParameters[aPos]; @@ -680,9 +700,7 @@ const Slvs_Param& SolveSpaceSolver_Storage::getParameter(const Slvs_hParam& theP return aDummy; } - -Slvs_hEntity SolveSpaceSolver_Storage::addEntity(const Slvs_Entity& theEntity) -{ +Slvs_hEntity SolveSpaceSolver_Storage::addEntity(const Slvs_Entity &theEntity) { if (theEntity.h > 0 && theEntity.h <= myEntityMaxID) { // Entity is already used, rewrite it return updateEntity(theEntity); @@ -698,13 +716,14 @@ Slvs_hEntity SolveSpaceSolver_Storage::addEntity(const Slvs_Entity& theEntity) return aEntity.h; } -Slvs_hEntity SolveSpaceSolver_Storage::updateEntity(const Slvs_Entity& theEntity) -{ +Slvs_hEntity +SolveSpaceSolver_Storage::updateEntity(const Slvs_Entity &theEntity) { if (theEntity.h > 0 && theEntity.h <= myEntityMaxID) { // Entity already used, rewrite it int aPos = Search(theEntity.h, myEntities); if (aPos >= 0 && aPos < (int)myEntities.size()) { - myNeedToResolve = myNeedToResolve || IsNotEqual(myEntities[aPos], theEntity); + myNeedToResolve = + myNeedToResolve || IsNotEqual(myEntities[aPos], theEntity); myEntities[aPos] = theEntity; return theEntity.h; } @@ -716,8 +735,7 @@ Slvs_hEntity SolveSpaceSolver_Storage::updateEntity(const Slvs_Entity& theEntity return addEntity(aEntity); } -bool SolveSpaceSolver_Storage::removeEntity(const Slvs_hEntity& theEntityID) -{ +bool SolveSpaceSolver_Storage::removeEntity(const Slvs_hEntity &theEntityID) { bool aResult = true; int aPos = Search(theEntityID, myEntities); if (aPos >= 0 && aPos < (int)myEntities.size()) { @@ -738,11 +756,12 @@ bool SolveSpaceSolver_Storage::removeEntity(const Slvs_hEntity& theEntityID) if (anEntAndSubs.find(anEntIter->distance) != anEntAndSubs.end()) return false; } - std::vector::const_iterator aConstrIter = myConstraints.begin(); + std::vector::const_iterator aConstrIter = + myConstraints.begin(); for (; aConstrIter != myConstraints.end(); aConstrIter++) { - Slvs_hEntity anEntIDs[6] = {aConstrIter->ptA, aConstrIter->ptB, - aConstrIter->entityA, aConstrIter->entityB, - aConstrIter->entityC, aConstrIter->entityD}; + Slvs_hEntity anEntIDs[6] = {aConstrIter->ptA, aConstrIter->ptB, + aConstrIter->entityA, aConstrIter->entityB, + aConstrIter->entityC, aConstrIter->entityD}; for (int i = 0; i < 6; i++) if (anEntAndSubs.find(anEntIDs[i]) != anEntAndSubs.end()) return false; @@ -761,8 +780,8 @@ bool SolveSpaceSolver_Storage::removeEntity(const Slvs_hEntity& theEntityID) return aResult; } -const Slvs_Entity& SolveSpaceSolver_Storage::getEntity(const Slvs_hEntity& theEntityID) const -{ +const Slvs_Entity & +SolveSpaceSolver_Storage::getEntity(const Slvs_hEntity &theEntityID) const { int aPos = Search(theEntityID, myEntities); if (aPos >= 0 && aPos < (int)myEntities.size()) return myEntities[aPos]; @@ -773,9 +792,8 @@ const Slvs_Entity& SolveSpaceSolver_Storage::getEntity(const Slvs_hEntity& theEn return aDummy; } - -Slvs_hConstraint SolveSpaceSolver_Storage::addConstraint(const Slvs_Constraint& theConstraint) -{ +Slvs_hConstraint +SolveSpaceSolver_Storage::addConstraint(const Slvs_Constraint &theConstraint) { if (theConstraint.h > 0 && theConstraint.h <= myConstrMaxID) { // Constraint is already used, rewrite it return updateConstraint(theConstraint); @@ -783,14 +801,17 @@ Slvs_hConstraint SolveSpaceSolver_Storage::addConstraint(const Slvs_Constraint& Slvs_Constraint aConstraint = theConstraint; - // Find a constraint with same type uses same arguments to show user overconstraint situation + // Find a constraint with same type uses same arguments to show user + // overconstraint situation std::vector::iterator aCIt = myConstraints.begin(); for (; aCIt != myConstraints.end(); aCIt++) { if (aConstraint.type != aCIt->type) continue; if (aConstraint.ptA == aCIt->ptA && aConstraint.ptB == aCIt->ptB && - aConstraint.entityA == aCIt->entityA && aConstraint.entityB == aCIt->entityB && - aConstraint.entityC == aCIt->entityC && aConstraint.entityD == aCIt->entityD) { + aConstraint.entityA == aCIt->entityA && + aConstraint.entityB == aCIt->entityB && + aConstraint.entityC == aCIt->entityC && + aConstraint.entityD == aCIt->entityD) { myDuplicatedConstraint = true; break; } @@ -805,13 +826,14 @@ Slvs_hConstraint SolveSpaceSolver_Storage::addConstraint(const Slvs_Constraint& return aConstraint.h; } -Slvs_hConstraint SolveSpaceSolver_Storage::updateConstraint(const Slvs_Constraint& theConstraint) -{ +Slvs_hConstraint SolveSpaceSolver_Storage::updateConstraint( + const Slvs_Constraint &theConstraint) { if (theConstraint.h > 0 && theConstraint.h <= myConstrMaxID) { // Constraint already used, rewrite it int aPos = Search(theConstraint.h, myConstraints); if (aPos >= 0 && aPos < (int)myConstraints.size()) { - myNeedToResolve = myNeedToResolve || IsNotEqual(myConstraints[aPos], theConstraint); + myNeedToResolve = + myNeedToResolve || IsNotEqual(myConstraints[aPos], theConstraint); myConstraints[aPos] = theConstraint; return theConstraint.h; } @@ -825,35 +847,38 @@ Slvs_hConstraint SolveSpaceSolver_Storage::updateConstraint(const Slvs_Constrain if (aConstraint.type == SLVS_C_AT_MIDPOINT) { std::vector::const_iterator anIt = myConstraints.begin(); for (; anIt != myConstraints.end(); ++anIt) - if (anIt->type == SLVS_C_PT_ON_LINE && - anIt->ptA == aConstraint.ptA && + if (anIt->type == SLVS_C_PT_ON_LINE && anIt->ptA == aConstraint.ptA && anIt->entityA == aConstraint.entityA) break; if (anIt != myConstraints.end()) { // change the constraint to the lengths equality to avoid conflicts Slvs_Entity aLine = getEntity(aConstraint.entityA); - Slvs_Entity aNewLine1 = Slvs_MakeLineSegment(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, - myWorkplaneID, aLine.point[0], aConstraint.ptA); + Slvs_Entity aNewLine1 = + Slvs_MakeLineSegment(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, + myWorkplaneID, aLine.point[0], aConstraint.ptA); aNewLine1.h = addEntity(aNewLine1); - Slvs_Entity aNewLine2 = Slvs_MakeLineSegment(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, - myWorkplaneID, aLine.point[1], aConstraint.ptA); + Slvs_Entity aNewLine2 = + Slvs_MakeLineSegment(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, + myWorkplaneID, aLine.point[1], aConstraint.ptA); aNewLine2.h = addEntity(aNewLine2); - aConstraint = Slvs_MakeConstraint(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, - SLVS_C_EQUAL_LENGTH_LINES, - myWorkplaneID, 0.0, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aNewLine1.h, aNewLine2.h); + aConstraint = Slvs_MakeConstraint( + SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID, SLVS_C_EQUAL_LENGTH_LINES, + myWorkplaneID, 0.0, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aNewLine1.h, + aNewLine2.h); } } return addConstraint(aConstraint); } -bool SolveSpaceSolver_Storage::removeConstraint(const Slvs_hConstraint& theConstraintID) -{ +bool SolveSpaceSolver_Storage::removeConstraint( + const Slvs_hConstraint &theConstraintID) { int aPos = Search(theConstraintID, myConstraints); if (aPos >= 0 && aPos < (int)myConstraints.size()) { Slvs_Constraint aConstraint = myConstraints[aPos]; myConstraints.erase(myConstraints.begin() + aPos); - myConstrMaxID = myConstraints.empty() ? SLVS_E_UNKNOWN : myConstraints.back().h; + myConstrMaxID = + myConstraints.empty() ? SLVS_E_UNKNOWN : myConstraints.back().h; myNeedToResolve = true; if (myDuplicatedConstraint) { @@ -863,8 +888,10 @@ bool SolveSpaceSolver_Storage::removeConstraint(const Slvs_hConstraint& theConst if (aConstraint.type != aCIt->type) continue; if (aConstraint.ptA == aCIt->ptA && aConstraint.ptB == aCIt->ptB && - aConstraint.entityA == aCIt->entityA && aConstraint.entityB == aCIt->entityB && - aConstraint.entityC == aCIt->entityC && aConstraint.entityD == aCIt->entityD) { + aConstraint.entityA == aCIt->entityA && + aConstraint.entityB == aCIt->entityB && + aConstraint.entityC == aCIt->entityC && + aConstraint.entityD == aCIt->entityD) { myDuplicatedConstraint = false; break; } @@ -874,9 +901,8 @@ bool SolveSpaceSolver_Storage::removeConstraint(const Slvs_hConstraint& theConst return true; } -const Slvs_Constraint& SolveSpaceSolver_Storage:: - getConstraint(const Slvs_hConstraint& theConstraintID) const -{ +const Slvs_Constraint &SolveSpaceSolver_Storage::getConstraint( + const Slvs_hConstraint &theConstraintID) const { int aPos = Search(theConstraintID, myConstraints); if (aPos >= 0 && aPos < (int)myConstraints.size()) return myConstraints[aPos]; @@ -887,9 +913,7 @@ const Slvs_Constraint& SolveSpaceSolver_Storage:: return aDummy; } - -void SolveSpaceSolver_Storage::initializeSolver(SolverPtr theSolver) -{ +void SolveSpaceSolver_Storage::initializeSolver(SolverPtr theSolver) { std::shared_ptr aSolver = std::dynamic_pointer_cast(theSolver); if (!aSolver) @@ -911,17 +935,17 @@ void SolveSpaceSolver_Storage::initializeSolver(SolverPtr theSolver) aSolver->setConstraints(myConstraints.data(), (int)myConstraints.size()); } - -bool SolveSpaceSolver_Storage::remove(ConstraintWrapperPtr theConstraint) -{ +bool SolveSpaceSolver_Storage::remove(ConstraintWrapperPtr theConstraint) { std::shared_ptr aConstraint = - std::dynamic_pointer_cast(theConstraint); + std::dynamic_pointer_cast( + theConstraint); // verify whether the constraint has duplicated bool hasSameID = false; SameConstraintMap::iterator anEqIt = myEqualConstraints.begin(); for (; anEqIt != myEqualConstraints.end(); ++anEqIt) { - std::set::const_iterator aFound = anEqIt->find(aConstraint); + std::set::const_iterator aFound = + anEqIt->find(aConstraint); if (aFound != anEqIt->end()) { // verify there is a constraint with same ID std::set::const_iterator anIt = anEqIt->begin(); @@ -944,8 +968,7 @@ bool SolveSpaceSolver_Storage::remove(ConstraintWrapperPtr theConstraint) return SketchSolver_Storage::remove(theConstraint) && isFullyRemoved; } -bool SolveSpaceSolver_Storage::remove(EntityWrapperPtr theEntity) -{ +bool SolveSpaceSolver_Storage::remove(EntityWrapperPtr theEntity) { if (!theEntity) return false; @@ -966,29 +989,30 @@ bool SolveSpaceSolver_Storage::remove(EntityWrapperPtr theEntity) if (anIt != myCoincidentPoints.end()) { if (anIt->first != theEntity && isUsed(anIt->first->baseAttribute())) isCoincide = true; - for (aCIt = anIt->second.begin(); !isCoincide && aCIt != anIt->second.end(); ++aCIt) + for (aCIt = anIt->second.begin(); + !isCoincide && aCIt != anIt->second.end(); ++aCIt) if (*aCIt != theEntity && isUsed((*aCIt)->baseAttribute())) isCoincide = true; } } std::shared_ptr anEntity = - std::dynamic_pointer_cast(theEntity); - bool isFullyRemoved = isCoincide ? true : removeEntity((Slvs_hEntity)anEntity->id()); - return (SketchSolver_Storage::remove(theEntity) || isCoincide) && isFullyRemoved; + std::dynamic_pointer_cast(theEntity); + bool isFullyRemoved = + isCoincide ? true : removeEntity((Slvs_hEntity)anEntity->id()); + return (SketchSolver_Storage::remove(theEntity) || isCoincide) && + isFullyRemoved; } -bool SolveSpaceSolver_Storage::remove(ParameterWrapperPtr theParameter) -{ +bool SolveSpaceSolver_Storage::remove(ParameterWrapperPtr theParameter) { return removeParameter((Slvs_hParam)theParameter->id()); } +void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const { + // blockEvents(true); -void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const -{ - //blockEvents(true); - - std::map::const_iterator anIt = myAttributeMap.begin(); + std::map::const_iterator anIt = + myAttributeMap.begin(); std::list aParams; std::list::const_iterator aParIt; for (; anIt != myAttributeMap.end(); ++anIt) { @@ -998,12 +1022,13 @@ void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const // refresh from the solver is never needed if (anIt->first.get()) { std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(anIt->first->owner()); + std::dynamic_pointer_cast(anIt->first->owner()); if (aSketchFeature.get() && aSketchFeature->isExternal()) continue; // not need to refresh here sketch's origin and normal vector CompositeFeaturePtr aSketch = - std::dynamic_pointer_cast(anIt->first->owner()); + std::dynamic_pointer_cast( + anIt->first->owner()); if (aSketch) continue; } @@ -1013,11 +1038,14 @@ void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const double aCoords[3]; bool isUpd[3] = {false}; int i = 0; - for (aParIt = aParams.begin(); i < 3 && aParIt != aParams.end(); ++aParIt, ++i) { + for (aParIt = aParams.begin(); i < 3 && aParIt != aParams.end(); + ++aParIt, ++i) { std::shared_ptr aWrapper = std::dynamic_pointer_cast(*aParIt); - if (!theFixedOnly || aWrapper->group() == GID_OUTOFGROUP || aWrapper->isParametric()) { - aWrapper->changeParameter().val = getParameter((Slvs_hParam)aWrapper->id()).val; + if (!theFixedOnly || aWrapper->group() == GID_OUTOFGROUP || + aWrapper->isParametric()) { + aWrapper->changeParameter().val = + getParameter((Slvs_hParam)aWrapper->id()).val; aCoords[i] = aWrapper->value(); isUpd[i] = true; } @@ -1030,8 +1058,10 @@ void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const if (aPoint2D) { if ((isUpd[0] && fabs(aPoint2D->x() - aCoords[0]) > tolerance) || (isUpd[1] && fabs(aPoint2D->y() - aCoords[1]) > tolerance)) { - if (!isUpd[0]) aCoords[0] = aPoint2D->x(); - if (!isUpd[1]) aCoords[1] = aPoint2D->y(); + if (!isUpd[0]) + aCoords[0] = aPoint2D->x(); + if (!isUpd[1]) + aCoords[1] = aPoint2D->y(); aPoint2D->setValue(aCoords[0], aCoords[1]); // Find points coincident with this one (probably not in GID_OUTOFGROUP) std::map::const_iterator aLocIt; @@ -1045,18 +1075,21 @@ void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const if (!aLocIt->second) continue; std::shared_ptr aSketchFeature = - std::dynamic_pointer_cast(aLocIt->first->owner()); + std::dynamic_pointer_cast( + aLocIt->first->owner()); if (aSketchFeature && aSketchFeature->isExternal()) continue; if (anIt->second->id() == aLocIt->second->id()) { - aPoint2D = std::dynamic_pointer_cast(aLocIt->first); + aPoint2D = + std::dynamic_pointer_cast(aLocIt->first); aPoint2D->setValue(aCoords[0], aCoords[1]); } } } continue; } - AttributeDoublePtr aScalar = std::dynamic_pointer_cast(anIt->first); + AttributeDoublePtr aScalar = + std::dynamic_pointer_cast(anIt->first); if (aScalar) { if (isUpd[0] && fabs(aScalar->value() - aCoords[0]) > tolerance) aScalar->setValue(aCoords[0]); @@ -1068,20 +1101,23 @@ void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const if ((isUpd[0] && fabs(aPoint->x() - aCoords[0]) > tolerance) || (isUpd[1] && fabs(aPoint->y() - aCoords[1]) > tolerance) || (isUpd[2] && fabs(aPoint->z() - aCoords[2]) > tolerance)) - if (!isUpd[0]) aCoords[0] = aPoint->x(); - if (!isUpd[1]) aCoords[1] = aPoint->y(); - if (!isUpd[2]) aCoords[2] = aPoint->z(); - aPoint->setValue(aCoords[0], aCoords[1], aCoords[2]); + if (!isUpd[0]) + aCoords[0] = aPoint->x(); + if (!isUpd[1]) + aCoords[1] = aPoint->y(); + if (!isUpd[2]) + aCoords[2] = aPoint->z(); + aPoint->setValue(aCoords[0], aCoords[1], aCoords[2]); continue; } } - //blockEvents(false); + // blockEvents(false); } -void SolveSpaceSolver_Storage::verifyFixed() -{ - std::map::iterator anAttrIt = myAttributeMap.begin(); +void SolveSpaceSolver_Storage::verifyFixed() { + std::map::iterator anAttrIt = + myAttributeMap.begin(); for (; anAttrIt != myAttributeMap.end(); ++anAttrIt) { if (!anAttrIt->second) continue; @@ -1092,10 +1128,12 @@ void SolveSpaceSolver_Storage::verifyFixed() updateEntity(anEnt); } - const std::list& aParameters = anAttrIt->second->parameters(); + const std::list &aParameters = + anAttrIt->second->parameters(); std::list::const_iterator aParIt = aParameters.begin(); for (; aParIt != aParameters.end(); ++aParIt) - if (anAttrIt->second->group() == GID_OUTOFGROUP || (*aParIt)->group() == GID_OUTOFGROUP) { + if (anAttrIt->second->group() == GID_OUTOFGROUP || + (*aParIt)->group() == GID_OUTOFGROUP) { Slvs_Param aParam = getParameter((Slvs_hParam)(*aParIt)->id()); if (aParam.group != (Slvs_hParam)GID_OUTOFGROUP) { aParam.group = (Slvs_hParam)GID_OUTOFGROUP; @@ -1105,9 +1143,7 @@ void SolveSpaceSolver_Storage::verifyFixed() } } - -void SolveSpaceSolver_Storage::adjustArc(const Slvs_Entity& theArc) -{ +void SolveSpaceSolver_Storage::adjustArc(const Slvs_Entity &theArc) { double anArcPoints[3][2]; double aDist[3] = {0.0}; bool isFixed[3] = {false}; @@ -1139,44 +1175,37 @@ void SolveSpaceSolver_Storage::adjustArc(const Slvs_Entity& theArc) Slvs_Entity aPoint = getEntity(theArc.point[anInd]); for (int i = 0; i < 2; ++i) { Slvs_Param aParam = getParameter(aPoint.param[i]); - aParam.val = anArcPoints[0][i] + aDist[3-anInd] * anArcPoints[anInd][i]; + aParam.val = anArcPoints[0][i] + aDist[3 - anInd] * anArcPoints[anInd][i]; updateParameter(aParam); } } - - - - - - // ======================================================== // ========= Auxiliary functions =============== // ======================================================== -template -int Search(const uint32_t& theEntityID, const std::vector& theEntities) -{ +template +int Search(const uint32_t &theEntityID, const std::vector &theEntities) { int aResIndex = theEntityID <= theEntities.size() ? theEntityID - 1 : 0; int aVecSize = (int)theEntities.size(); if (theEntities.empty()) return 1; while (aResIndex >= 0 && theEntities[aResIndex].h > theEntityID) aResIndex--; - while (aResIndex < aVecSize && aResIndex >= 0 && theEntities[aResIndex].h < theEntityID) + while (aResIndex < aVecSize && aResIndex >= 0 && + theEntities[aResIndex].h < theEntityID) aResIndex++; - if (aResIndex == -1 || (aResIndex < aVecSize && theEntities[aResIndex].h != theEntityID)) + if (aResIndex == -1 || + (aResIndex < aVecSize && theEntities[aResIndex].h != theEntityID)) aResIndex = aVecSize; return aResIndex; } -bool IsNotEqual(const Slvs_Param& theParam1, const Slvs_Param& theParam2) -{ +bool IsNotEqual(const Slvs_Param &theParam1, const Slvs_Param &theParam2) { return fabs(theParam1.val - theParam2.val) > tolerance; } -bool IsNotEqual(const Slvs_Entity& theEntity1, const Slvs_Entity& theEntity2) -{ +bool IsNotEqual(const Slvs_Entity &theEntity1, const Slvs_Entity &theEntity2) { int i = 0; for (; theEntity1.param[i] != 0 && i < 4; i++) if (theEntity1.param[i] != theEntity2.param[i]) @@ -1188,8 +1217,8 @@ bool IsNotEqual(const Slvs_Entity& theEntity1, const Slvs_Entity& theEntity2) return false; } -bool IsNotEqual(const Slvs_Constraint& theConstraint1, const Slvs_Constraint& theConstraint2) -{ +bool IsNotEqual(const Slvs_Constraint &theConstraint1, + const Slvs_Constraint &theConstraint2) { return theConstraint1.ptA != theConstraint2.ptA || theConstraint1.ptB != theConstraint2.ptB || theConstraint1.entityA != theConstraint2.entityA || diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.h index a056e645e..4b69daf51 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SolveSpaceSolver_Storage_H_ @@ -28,19 +29,18 @@ #include #include -typedef std::list< std::set > SameConstraintMap; +typedef std::list> SameConstraintMap; /** \class SolveSpaceSolver_Storage * \ingroup Plugins - * \brief Contains all necessary data in SolveSpace format to solve a single + * \brief Contains all necessary data in SolveSpace format to solve a single * group of constraints */ -class SolveSpaceSolver_Storage : public SketchSolver_Storage -{ +class SolveSpaceSolver_Storage : public SketchSolver_Storage { public: - SolveSpaceSolver_Storage(const GroupID& theGroup); + SolveSpaceSolver_Storage(const GroupID &theGroup); -// ============= Inherited from SketchSolver_Storage ============= + // ============= Inherited from SketchSolver_Storage ============= /// \brief Update constraint's data /// \return \c true if any value is updated @@ -61,30 +61,36 @@ public: virtual void verifyFixed(); /// \brief Mark two points as coincident - virtual void addCoincidentPoints(EntityWrapperPtr theMaster, EntityWrapperPtr theSlave); + virtual void addCoincidentPoints(EntityWrapperPtr theMaster, + EntityWrapperPtr theSlave); - /// \brief Calculate point on theBase entity. Value theCoeff is in [0.0 .. 1.0] and + /// \brief Calculate point on theBase entity. Value theCoeff is in [0.0 + /// .. 1.0] and /// shows the distance from the start point. - virtual EntityWrapperPtr calculateMiddlePoint(EntityWrapperPtr theBase, double theCoeff); + virtual EntityWrapperPtr calculateMiddlePoint(EntityWrapperPtr theBase, + double theCoeff); protected: /// \brief Remove constraint - /// \return \c true if the constraint and all its parameters are removed successfully + /// \return \c true if the constraint and all its parameters are removed + /// successfully virtual bool remove(ConstraintWrapperPtr theConstraint); /// \brief Remove entity - /// \return \c true if the entity and all its parameters are removed successfully + /// \return \c true if the entity and all its parameters are removed + /// successfully virtual bool remove(EntityWrapperPtr theEntity); /// \brief Remove parameter /// \return \c true if the parameter has been removed virtual bool remove(ParameterWrapperPtr theParameter); - /// \brief Update the group for the given entity, its sub-entities and parameters - virtual void changeGroup(EntityWrapperPtr theEntity, const GroupID& theGroup); + /// \brief Update the group for the given entity, its sub-entities and + /// parameters + virtual void changeGroup(EntityWrapperPtr theEntity, const GroupID &theGroup); /// \brief Update the group for the given parameter - virtual void changeGroup(ParameterWrapperPtr theParam, const GroupID& theGroup); + virtual void changeGroup(ParameterWrapperPtr theParam, + const GroupID &theGroup); - -// ============= Own methods ============= + // ============= Own methods ============= public: /// \brief Obtain and store identifier of sketch void storeWorkplane(EntityWrapperPtr theSketch); @@ -93,89 +99,93 @@ public: * \param[in] theParam SolveSpace parameter * \return the ID of added parameter */ - Slvs_hParam addParameter(const Slvs_Param& theParam); - /** \brief Updates parameter in the current group. If the ID of parameter is zero, the new item will be added - * \param[in] theParam SolveSpace parameter + Slvs_hParam addParameter(const Slvs_Param &theParam); + /** \brief Updates parameter in the current group. If the ID of parameter is + * zero, the new item will be added \param[in] theParam SolveSpace parameter * \return the ID of updated/added parameter */ - Slvs_hParam updateParameter(const Slvs_Param& theParam); + Slvs_hParam updateParameter(const Slvs_Param &theParam); /** \brief Removes the parameter by its ID * \param[in] theParamID index of parameter to be removed * \return \c true if the parameter was successfully removed */ - bool removeParameter(const Slvs_hParam& theParamID); + bool removeParameter(const Slvs_hParam &theParamID); /// \brief Returns the parameter by its ID - const Slvs_Param& getParameter(const Slvs_hParam& theParamID) const; + const Slvs_Param &getParameter(const Slvs_hParam &theParamID) const; /** \brief Add new entity to the current group * \param[in] theEntity SolveSpace entity * \return the ID of added entity */ - Slvs_hEntity addEntity(const Slvs_Entity& theEntity); - /** \brief Updates entity in the current group. If the ID of entity is zero, the new item will be added - * \param[in] theEntity SolveSpace entity - * \return the ID of updated/added entity + Slvs_hEntity addEntity(const Slvs_Entity &theEntity); + /** \brief Updates entity in the current group. If the ID of entity is zero, + * the new item will be added \param[in] theEntity SolveSpace entity \return + * the ID of updated/added entity */ - Slvs_hEntity updateEntity(const Slvs_Entity& theEntity); + Slvs_hEntity updateEntity(const Slvs_Entity &theEntity); /** \brief Removes the entity by its ID. All parameters used in this entity, * and not used in other constraints, will be removed too. * \param[in] theEntityID index of entity to be removed * \return \c true if the entity was successfully removed */ - bool removeEntity(const Slvs_hEntity& theEntityID); + bool removeEntity(const Slvs_hEntity &theEntityID); /// \brief Returns the entity by its ID - const Slvs_Entity& getEntity(const Slvs_hEntity& theEntityID) const; + const Slvs_Entity &getEntity(const Slvs_hEntity &theEntityID) const; /// \brief Returns maximal ID of entities in this storage - const Slvs_hEntity& entityMaxID() const - { return myEntityMaxID; } + const Slvs_hEntity &entityMaxID() const { return myEntityMaxID; } /** \brief Add new constraint to the current group * \param[in] theConstraint SolveSpace's constraint * \return the ID of added constraint */ - Slvs_hConstraint addConstraint(const Slvs_Constraint& theConstraint); + Slvs_hConstraint addConstraint(const Slvs_Constraint &theConstraint); /** \brief Updates constraint in the current group. * If the ID of constraint is zero, the new item will be added * \param[in] theConstraint SolveSpace constraint * \return the ID of updated/added constraint */ - Slvs_hConstraint updateConstraint(const Slvs_Constraint& theConstraint); - /** \brief Removes the constraint by its ID. All entities and parameters depending on this - * constraint, which are not used in other constraints, will be removed too. - * \param[in] theConstraintID index of constraint to be removed - * \return \c true if the constraint was successfully removed + Slvs_hConstraint updateConstraint(const Slvs_Constraint &theConstraint); + /** \brief Removes the constraint by its ID. All entities and parameters + * depending on this constraint, which are not used in other constraints, will + * be removed too. \param[in] theConstraintID index of constraint to be + * removed \return \c true if the constraint was successfully removed */ - bool removeConstraint(const Slvs_hConstraint& theConstraintID); + bool removeConstraint(const Slvs_hConstraint &theConstraintID); /// \brief Returns the constraint by its ID - const Slvs_Constraint& getConstraint(const Slvs_hConstraint& theConstraintID) const; + const Slvs_Constraint & + getConstraint(const Slvs_hConstraint &theConstraintID) const; /// \brief Returns quantity of constraints in this storage - size_t nbConstraints() const - { return myConstraints.size(); } + size_t nbConstraints() const { return myConstraints.size(); } /// \brief Shows the storage has the same constraint twice - virtual bool hasDuplicatedConstraint() const - { return myDuplicatedConstraint; } + virtual bool hasDuplicatedConstraint() const { + return myDuplicatedConstraint; + } - /// \brief Initialize constraint solver by the entities collected by current storage + /// \brief Initialize constraint solver by the entities collected by current + /// storage virtual void initializeSolver(SolverPtr theSolver); private: /// \brief Update arc points to be on circle sharp. - void adjustArc(const Slvs_Entity& theArc); + void adjustArc(const Slvs_Entity &theArc); /// \brief Replace sub-entity theSource in all features by theDest void replaceInFeatures(EntityWrapperPtr theSource, EntityWrapperPtr theDest); /// \brief Replace constrained entity theSource by theDest in all constraints; - void replaceInConstraints(EntityWrapperPtr theSource, EntityWrapperPtr theDest); + void replaceInConstraints(EntityWrapperPtr theSource, + EntityWrapperPtr theDest); - /// \brief Add pair of constraints which have same representation in SolveSpace notation. + /// \brief Add pair of constraints which have same representation in + /// SolveSpace notation. /// - /// These constraints may be different and become the same after the substitution - /// of point coincidence. + /// These constraints may be different and become the same after the + /// substitution of point coincidence. void addSameConstraints(ConstraintWrapperPtr theConstraint1, ConstraintWrapperPtr theConstraint2); - /// \brief Search constraint equal to the given in terms of SolveSpace notation + /// \brief Search constraint equal to the given in terms of SolveSpace + /// notation bool findSameConstraint(ConstraintWrapperPtr theConstraint); private: @@ -184,11 +194,14 @@ private: /// current parameter index (may differs with the number of parameters) Slvs_hParam myParamMaxID; - /// list of parameters used in the current group of constraints (sorted by the identifier) + /// list of parameters used in the current group of constraints (sorted by the + /// identifier) std::vector myParameters; - Slvs_hEntity myEntityMaxID; ///< current entity index (may differs with the number of entities) + Slvs_hEntity myEntityMaxID; ///< current entity index (may differs with the + ///< number of entities) - /// list of entities used in the current group of constraints (sorted by the identifier) + /// list of entities used in the current group of constraints (sorted by the + /// identifier) std::vector myEntities; /// current constraint index (may differs with the number of constraints) diff --git a/src/SketcherPrs/SketcherPrs.h b/src/SketcherPrs/SketcherPrs.h index 882d1e0ad..8d49ca50d 100644 --- a/src/SketcherPrs/SketcherPrs.h +++ b/src/SketcherPrs/SketcherPrs.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SKETCHERPRS_H @@ -22,13 +23,13 @@ #if defined SKETCHERPRS_EXPORTS #if defined WIN32 -#define SKETCHERPRS_EXPORT __declspec( dllexport ) +#define SKETCHERPRS_EXPORT __declspec(dllexport) #else #define SKETCHERPRS_EXPORT #endif #else #if defined WIN32 -#define SKETCHERPRS_EXPORT __declspec( dllimport ) +#define SKETCHERPRS_EXPORT __declspec(dllimport) #else #define SKETCHERPRS_EXPORT #endif diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index 88d57dd1a..2a3991bbe 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -14,29 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Angle.h" #include "SketcherPrs_DimensionStyle.h" #include "SketcherPrs_Tools.h" -#include #include +#include #include +#include #include #include -#include -#include #include +#include -#include #include #include +#include -#include #include +#include #include @@ -49,7 +50,8 @@ /// \param theDimValue an arrow value /// \param theTextSize an arrow value extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, - double theDimValue, double theTextSize, SketcherPrs_Tools::LocationType theLocationType); + double theDimValue, double theTextSize, + SketcherPrs_Tools::LocationType theLocationType); #define PI 3.1415926535897932 @@ -59,17 +61,13 @@ extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, PrsDim_AngleDimension); -SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) -: PrsDim_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), - myConstraint(theConstraint), - mySketcher(theSketcher), - myFirstPoint(gp_Pnt(0,0,0)), - mySecondPoint(gp_Pnt(0,1,0)), - myCenterPoint(gp_Pnt(1, 0, 0)), - myFlyOutPoint(0, 0.5, 0), - myValue(90., false, "") -{ +SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : PrsDim_AngleDimension(gp_Pnt(0, 0, 0), gp_Pnt(1, 0, 0), gp_Pnt(0, 1, 0)), + myConstraint(theConstraint), mySketcher(theSketcher), + myFirstPoint(gp_Pnt(0, 0, 0)), mySecondPoint(gp_Pnt(0, 1, 0)), + myCenterPoint(gp_Pnt(1, 0, 0)), myFlyOutPoint(0, 0.5, 0), + myValue(90., false, "") { myAspect = new Prs3d_DimensionAspect(); myAspect->MakeArrows3d(false); myAspect->MakeText3d(false); @@ -83,23 +81,20 @@ SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, myStyleListener = new SketcherPrs_DimensionStyle(); } -SketcherPrs_Angle::~SketcherPrs_Angle() -{ - delete myStyleListener; -} +SketcherPrs_Angle::~SketcherPrs_Angle() { delete myStyleListener; } -bool SketcherPrs_Angle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Angle::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint; - return readyToDisplay(theConstraint, thePlane, aFirstPoint, aSecondPoint, aCenterPoint); + return readyToDisplay(theConstraint, thePlane, aFirstPoint, aSecondPoint, + aCenterPoint); } -bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Pnt& theFirstPoint, gp_Pnt& theSecondPoint, - gp_Pnt& theCenterPoint) -{ +bool SketcherPrs_Angle::readyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, gp_Pnt &theFirstPoint, + gp_Pnt &theSecondPoint, gp_Pnt &theCenterPoint) { bool aReadyToDisplay = false; if (!thePlane) return aReadyToDisplay; @@ -108,58 +103,78 @@ bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, // Flyout point std::shared_ptr aFlyoutAttr = - std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); if (!aFlyoutAttr->isInitialized()) return aReadyToDisplay; // can not create a good presentation - AttributeRefAttrPtr anAttr1 = aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr anAttr1 = + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); if (!anAttr1->isInitialized()) return aReadyToDisplay; - AttributeRefAttrPtr anAttr2 = aData->refattr(SketchPlugin_Constraint::ENTITY_B()); + AttributeRefAttrPtr anAttr2 = + aData->refattr(SketchPlugin_Constraint::ENTITY_B()); if (!anAttr2->isInitialized()) return aReadyToDisplay; - FeaturePtr aLineA = - SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A()); - FeaturePtr aLineB = - SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B()); + FeaturePtr aLineA = SketcherPrs_Tools::getFeatureLine( + aData, SketchPlugin_Constraint::ENTITY_A()); + FeaturePtr aLineB = SketcherPrs_Tools::getFeatureLine( + aData, SketchPlugin_Constraint::ENTITY_B()); if (!aLineA.get() || !aLineB.get()) return aReadyToDisplay; - std::shared_ptr aStartA = std::dynamic_pointer_cast( - aLineA->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aEndA = std::dynamic_pointer_cast( - aLineA->attribute(SketchPlugin_Line::END_ID())); - std::shared_ptr aStartB = std::dynamic_pointer_cast( - aLineB->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aEndB = std::dynamic_pointer_cast( - aLineB->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aStartA = + std::dynamic_pointer_cast( + aLineA->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aEndA = + std::dynamic_pointer_cast( + aLineA->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aStartB = + std::dynamic_pointer_cast( + aLineB->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aEndB = + std::dynamic_pointer_cast( + aLineB->attribute(SketchPlugin_Line::END_ID())); std::shared_ptr anAng; - bool isFirstPnt = aData->attribute( - SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->isInitialized(); - bool isSecondPnt = aData->attribute( - SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->isInitialized(); + bool isFirstPnt = + aData + ->attribute( + SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID()) + ->isInitialized(); + bool isSecondPnt = + aData + ->attribute( + SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID()) + ->isInitialized(); if (!isFirstPnt || !isSecondPnt) anAng = std::shared_ptr(new GeomAPI_Angle2d( aStartA->pnt(), aEndA->pnt(), aStartB->pnt(), aEndB->pnt())); else { - std::shared_ptr aLine1(new GeomAPI_Lin2d(aStartA->pnt(), aEndA->pnt())); + std::shared_ptr aLine1( + new GeomAPI_Lin2d(aStartA->pnt(), aEndA->pnt())); bool isReversed1 = - aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->value(); - std::shared_ptr aLine2(new GeomAPI_Lin2d(aStartB->pnt(), aEndB->pnt())); + aData + ->boolean( + SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID()) + ->value(); + std::shared_ptr aLine2( + new GeomAPI_Lin2d(aStartB->pnt(), aEndB->pnt())); bool isReversed2 = - aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->value(); + aData + ->boolean( + SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID()) + ->value(); if (aData->integer(SketchPlugin_ConstraintAngle::TYPE_ID())->value() == (int)SketcherPrs_Tools::ANGLE_COMPLEMENTARY) isReversed1 = !isReversed1; anAng = std::shared_ptr( - new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2)); + new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2)); } gp_Pnt2d aCenterPoint = anAng->center()->impl(); @@ -168,13 +183,11 @@ bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, if (anAng->angleRadian() > 0.0) { aFirstPoint = anAng->firstPoint()->impl(); aSecondPoint = anAng->secondPoint()->impl(); - } - else { + } else { aFirstPoint = anAng->secondPoint()->impl(); aSecondPoint = anAng->firstPoint()->impl(); } - } - catch (...) { + } catch (...) { // one of angle lines is degenerated, the presentation cannot be shown return false; } @@ -183,7 +196,8 @@ bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, (int)SketcherPrs_Tools::ANGLE_BACKWARD) std::swap(aFirstPoint, aSecondPoint); - std::shared_ptr aPoint = thePlane->to3D(aFirstPoint.X(), aFirstPoint.Y()); + std::shared_ptr aPoint = + thePlane->to3D(aFirstPoint.X(), aFirstPoint.Y()); theFirstPoint = aPoint->impl(); aPoint = thePlane->to3D(aCenterPoint.X(), aCenterPoint.Y()); @@ -195,33 +209,33 @@ bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, return true; } - -void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) -{ +void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d) & + thePresentationManager, + const Handle(Prs3d_Presentation) & + thePresentation, + const Standard_Integer theMode) { if (!plane().get()) return; DataPtr aData = myConstraint->data(); gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint; - bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), - aFirstPoint, aSecondPoint, aCenterPoint); + bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), aFirstPoint, + aSecondPoint, aCenterPoint); if (aReadyToDisplay) { myFirstPoint = aFirstPoint; mySecondPoint = aSecondPoint; myCenterPoint = aCenterPoint; AttributeDoublePtr anAttributeValue = - aData->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); + aData->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); myValue.init(anAttributeValue); std::shared_ptr aFlyoutAttr = - std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFlyoutPnt = - plane()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + plane()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); myFlyOutPoint = aFlyoutPnt->impl(); } @@ -237,7 +251,8 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP #ifndef COMPILATION_CORRECTION bool isReversedPlanes = isAnglePlaneReversedToSketchPlane(); #if OCC_VERSION_HEX > 0x070400 - SetType(!isReversedPlanes ? PrsDim_TypeOfAngle_Exterior : PrsDim_TypeOfAngle_Interior); + SetType(!isReversedPlanes ? PrsDim_TypeOfAngle_Exterior + : PrsDim_TypeOfAngle_Interior); #else SetType(!isReversedPlanes ? AIS_TOA_Exterior : AIS_TOA_Interior); #endif @@ -251,28 +266,35 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP double aTextSize = 0.0; GetValueString(aTextSize); - AttributeIntegerPtr aLocAttr = std::dynamic_pointer_cast - (myConstraint->data()->attribute(SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID())); - SketcherPrs_Tools::LocationType aLocationType = aLocAttr->isInitialized() ? - (SketcherPrs_Tools::LocationType)(aLocAttr->value()) : SketcherPrs_Tools::LOCATION_AUTOMATIC; - - double aRadius = myCenterPoint.Translated( - gp_Vec(myCenterPoint, myFirstPoint).Normalized()*aDist).Distance(myCenterPoint); + AttributeIntegerPtr aLocAttr = + std::dynamic_pointer_cast( + myConstraint->data()->attribute( + SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID())); + SketcherPrs_Tools::LocationType aLocationType = + aLocAttr->isInitialized() + ? (SketcherPrs_Tools::LocationType)(aLocAttr->value()) + : SketcherPrs_Tools::LOCATION_AUTOMATIC; + + double aRadius = + myCenterPoint + .Translated(gp_Vec(myCenterPoint, myFirstPoint).Normalized() * aDist) + .Distance(myCenterPoint); double anAngleValue = myValue.myDoubleValue; double anAngleCircleLength = aRadius * anAngleValue * PI / 180.; updateArrows(myAspect, anAngleCircleLength, aTextSize, aLocationType); - PrsDim_AngleDimension::Compute(thePresentationManager, thePresentation, theMode); + PrsDim_AngleDimension::Compute(thePresentationManager, thePresentation, + theMode); if (!aReadyToDisplay) - SketcherPrs_Tools::sendEmptyPresentationError(myConstraint, - "An empty AIS presentation: SketcherPrs_Angle"); + SketcherPrs_Tools::sendEmptyPresentationError( + myConstraint, "An empty AIS presentation: SketcherPrs_Angle"); } -void SketcherPrs_Angle::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) -{ +void SketcherPrs_Angle::ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer theMode) { Standard_Integer aMode; switch (theMode) { case 0: // we should use selection of all objects @@ -293,24 +315,22 @@ void SketcherPrs_Angle::ComputeSelection(const Handle(SelectMgr_Selection)& aSel return; } } - SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize()/5.); + SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize() / 5.); PrsDim_AngleDimension::ComputeSelection(aSelection, aMode); } -bool SketcherPrs_Angle::isAnglePlaneReversedToSketchPlane() -{ +bool SketcherPrs_Angle::isAnglePlaneReversedToSketchPlane() { bool aReversed = false; if (!plane().get()) return aReversed; gp_Pln aPlane = GetPlane(); gp_Dir aDir = aPlane.Axis().Direction(); - double aDot = plane()->normal()->dot( - std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()))); + double aDot = plane()->normal()->dot(std::shared_ptr( + new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()))); return aDot < 0; } -double SketcherPrs_Angle::calculateDistanceToFlyoutPoint() -{ +double SketcherPrs_Angle::calculateDistanceToFlyoutPoint() { return myFlyOutPoint.Distance(myCenterPoint); } diff --git a/src/SketcherPrs/SketcherPrs_Angle.h b/src/SketcherPrs/SketcherPrs_Angle.h index 4767f6742..a85263351 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.h +++ b/src/SketcherPrs/SketcherPrs_Angle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Angle_H @@ -32,17 +33,16 @@ DEFINE_STANDARD_HANDLE(SketcherPrs_Angle, PrsDim_AngleDimension) /** -* \ingroup GUI -* A class for representation of angle constraint -*/ -class SketcherPrs_Angle : public PrsDim_AngleDimension -{ + * \ingroup GUI + * A class for representation of angle constraint + */ +class SketcherPrs_Angle : public PrsDim_AngleDimension { public: /// Constructor /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch - Standard_EXPORT SketcherPrs_Angle(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Angle(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); /// Destructor Standard_EXPORT ~SketcherPrs_Angle(); @@ -54,61 +54,63 @@ public: /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); /// Returns sketcher plane - Standard_EXPORT std::shared_ptr plane() const - { + Standard_EXPORT std::shared_ptr plane() const { return mySketcher->coordinatePlane(); } protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode); + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer aMode); - /// Checks is the angle plane has inverted direction of normal to the plane of current sketcher - /// Returns true if crossed product is negative. - /// \return bolean value + /// Checks is the angle plane has inverted direction of normal to the plane of + /// current sketcher Returns true if crossed product is negative. \return + /// bolean value bool isAnglePlaneReversedToSketchPlane(); - /// Calculates a distance between center of the angle presentation and the value of flyout point - /// attribute. It should be used after setting measured geometry for the angle presentation as - /// it uses calculated center/first/second point coordinates - /// \return real value + /// Calculates a distance between center of the angle presentation and the + /// value of flyout point attribute. It should be used after setting measured + /// geometry for the angle presentation as it uses calculated + /// center/first/second point coordinates \return real value double calculateDistanceToFlyoutPoint(); - static bool readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Pnt& theFirstPoint, gp_Pnt& theSecondPoint, - gp_Pnt& theCenterPoint); + static bool readyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, + gp_Pnt &theFirstPoint, gp_Pnt &theSecondPoint, + gp_Pnt &theCenterPoint); private: /// Constraint feature - ModelAPI_Feature* myConstraint; + ModelAPI_Feature *myConstraint; /// A current sketcher - SketchPlugin_Sketch* mySketcher; + SketchPlugin_Sketch *mySketcher; Handle(Prs3d_DimensionAspect) myAspect; /// Listener to update dimension visualization style - SketcherPrs_DimensionStyle* myStyleListener; + SketcherPrs_DimensionStyle *myStyleListener; - /// container of values obtained from the constraint, which are necessary to fill the presentation - gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry + /// container of values obtained from the constraint, which are necessary to + /// fill the presentation + gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry gp_Pnt mySecondPoint; ///< the dimension second point for measured geometry gp_Pnt myCenterPoint; ///< the dimension center point for measured geometry - gp_Pnt myFlyOutPoint; ///< the dimension fly out point for measured geometry + gp_Pnt myFlyOutPoint; ///< the dimension fly out point for measured geometry - SketcherPrs_DimensionStyle::DimensionValue myValue; /// the structure filled by constraint + SketcherPrs_DimensionStyle::DimensionValue + myValue; /// the structure filled by constraint }; - #endif diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index 0e148e067..fe42f132e 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Coincident.h" @@ -23,58 +24,55 @@ #include #include -#include #include #include +#include -#include #include #include +#include #include #include #include -#include #include +#include #include +#include #include #include -#include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject); -SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketch) -: AIS_InteractiveObject(), myConstraint(theConstraint), mySketch(theSketch), - myPoint(gp_Pnt(0.0, 0.0, 0.0)) -{ +SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketch) + : AIS_InteractiveObject(), myConstraint(theConstraint), mySketch(theSketch), + myPoint(gp_Pnt(0.0, 0.0, 0.0)) { SetColor(Quantity_NOC_BLACK); } -bool SketcherPrs_Coincident::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Coincident::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { gp_Pnt aPoint; return readyToDisplay(theConstraint, thePlane, aPoint); } -std::shared_ptr getCoincidencePoint(ModelAPI_Feature* theConstraint) -{ - std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theConstraint, - SketchPlugin_Constraint::ENTITY_A()); +std::shared_ptr +getCoincidencePoint(ModelAPI_Feature *theConstraint) { + std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); if (aPnt.get() == NULL) - aPnt = SketcherPrs_Tools::getPoint(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + aPnt = SketcherPrs_Tools::getPoint(theConstraint, + SketchPlugin_Constraint::ENTITY_B()); return aPnt; } - -bool SketcherPrs_Coincident::readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Pnt& thePoint) -{ +bool SketcherPrs_Coincident::readyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, gp_Pnt &thePoint) { bool aReadyToDisplay = false; // Get point of the presentation std::shared_ptr aPnt = getCoincidencePoint(theConstraint); @@ -86,13 +84,11 @@ bool SketcherPrs_Coincident::readyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } - -bool hasEdge(ModelAPI_Feature* theConstraint) -{ - ObjectPtr aObjA = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObjB = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); +bool hasEdge(ModelAPI_Feature *theConstraint) { + ObjectPtr aObjA = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObjB = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); ResultPtr aResA = std::dynamic_pointer_cast(aObjA); ResultPtr aResB = std::dynamic_pointer_cast(aObjB); if (aResA.get()) { @@ -108,14 +104,13 @@ bool hasEdge(ModelAPI_Feature* theConstraint) return false; } - void SketcherPrs_Coincident::Compute( - const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer /*theMode*/) -{ + const Handle(PrsMgr_PresentationManager3d) & /*thePresentationManager*/, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer /*theMode*/) { gp_Pnt aPoint; - bool aReadyToDisplay = readyToDisplay(myConstraint, mySketch->coordinatePlane(), aPoint); + bool aReadyToDisplay = + readyToDisplay(myConstraint, mySketch->coordinatePlane(), aPoint); if (aReadyToDisplay) myPoint = aPoint; @@ -128,7 +123,7 @@ void SketcherPrs_Coincident::Compute( for (int i = 0; i < aNumberOfSubs; i++) { aSub = mySketch->subFeature(i); if (aSub->getKind() == SketchPlugin_ConstraintCoincidence::ID() && - aSub.get() != myConstraint) { + aSub.get() != myConstraint) { aP = getCoincidencePoint(aSub.get()); if (aP && aP->isEqual(aPnt)) { aIsEdge = hasEdge(aSub.get()); @@ -155,8 +150,8 @@ void SketcherPrs_Coincident::Compute( Handle(Graphic3d_Group) aGroup = thePresentation->CurrentGroup(); aGroup->SetPrimitivesAspect(aPtA); Handle(Graphic3d_ArrayOfPoints) aPntArray = new Graphic3d_ArrayOfPoints(1); - aPntArray->AddVertex (myPoint.X(), myPoint.Y(), myPoint.Z()); - aGroup->AddPrimitiveArray (aPntArray); + aPntArray->AddVertex(myPoint.X(), myPoint.Y(), myPoint.Z()); + aGroup->AddPrimitiveArray(aPntArray); // Make a black mid ring aPtA = new Graphic3d_AspectMarker3d(); @@ -164,7 +159,7 @@ void SketcherPrs_Coincident::Compute( aPtA->SetScale(1. * aRatio); aPtA->SetColor(aInternalColor); aGroup->SetPrimitivesAspect(aPtA); - aGroup->AddPrimitiveArray (aPntArray); + aGroup->AddPrimitiveArray(aPntArray); // Make an internal ring aPtA = new Graphic3d_AspectMarker3d(); @@ -172,16 +167,16 @@ void SketcherPrs_Coincident::Compute( aPtA->SetScale(5. * aRatio); aPtA->SetColor(aInternalColor); aGroup->SetPrimitivesAspect(aPtA); - aGroup->AddPrimitiveArray (aPntArray); + aGroup->AddPrimitiveArray(aPntArray); if (!aReadyToDisplay) - SketcherPrs_Tools::sendEmptyPresentationError(myConstraint, - "An empty AIS presentation: SketcherPrs_Coincident"); + SketcherPrs_Tools::sendEmptyPresentationError( + myConstraint, "An empty AIS presentation: SketcherPrs_Coincident"); } - -void SketcherPrs_Coincident::ComputeSelection(const Handle(SelectMgr_Selection)& /*theSelection*/, - const Standard_Integer /*theMode*/) -{ - // There is no selection of coincident - a point is selected instead of coincidence +void SketcherPrs_Coincident::ComputeSelection( + const Handle(SelectMgr_Selection) & /*theSelection*/, + const Standard_Integer /*theMode*/) { + // There is no selection of coincident - a point is selected instead of + // coincidence } diff --git a/src/SketcherPrs/SketcherPrs_Coincident.h b/src/SketcherPrs/SketcherPrs_Coincident.h index 4831217b8..46b03badd 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.h +++ b/src/SketcherPrs/SketcherPrs_Coincident.h @@ -14,64 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Coincident_H #define SketcherPrs_Coincident_H #include -#include #include +#include #include #include - DEFINE_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of coincident constraint -*/ -class SketcherPrs_Coincident: public AIS_InteractiveObject -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of coincident constraint + */ +class SketcherPrs_Coincident : public AIS_InteractiveObject { public: /// Constructor /// \param theConstraint a constraint object /// \param thePlane plane of a sketch - Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketch); + Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketch); - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) ; + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer aMode); private: - static bool readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Pnt& thePoint); + static bool readyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, + gp_Pnt &thePoint); private: - ModelAPI_Feature* myConstraint; - SketchPlugin_Sketch* mySketch; + ModelAPI_Feature *myConstraint; + SketchPlugin_Sketch *mySketch; gp_Pnt myPoint; }; - -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index 7980e4c38..e2c716d07 100644 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -14,37 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Collinear.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Collinear::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (thePlane) { - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && SketcherPrs_Tools::getShape(aObj2).get() != NULL; @@ -52,18 +50,18 @@ bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); // Set points of the presentation - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); @@ -72,17 +70,15 @@ bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, bool withColo return true; } -void SketcherPrs_Collinear::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Collinear::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); Handle(Graphic3d_AspectLine3d) aLineAspect = - new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw constrained lines addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); addLine(aGroup, SketchPlugin_Constraint::ENTITY_B()); } - diff --git a/src/SketcherPrs/SketcherPrs_Collinear.h b/src/SketcherPrs/SketcherPrs_Collinear.h index 8cd9a8f34..a9d38da12 100644 --- a/src/SketcherPrs/SketcherPrs_Collinear.h +++ b/src/SketcherPrs/SketcherPrs_Collinear.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Collinear_H @@ -22,40 +23,38 @@ #include "SketcherPrs_SymbolPrs.h" - DEFINE_STANDARD_HANDLE(SketcherPrs_Collinear, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of Equal constraint -*/ -class SketcherPrs_Collinear: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of Equal constraint + */ +class SketcherPrs_Collinear : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); -protected: + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); - virtual const char* iconName() const { return "collinear.png"; } +protected: + virtual const char *iconName() const { return "collinear.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp index 6679e7885..d0f74d31e 100644 --- a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp +++ b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp @@ -14,69 +14,62 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_DimensionStyle.h" -#include #include "SketcherPrs_Tools.h" +#include #include #include #include -#include #include +#include //#ifndef WNT // #define COMPILATION_CORRECTION //#endif -// it is not possible to use 0x2211 as summ symbol because it is not supported by -// debian Linux platform +// it is not possible to use 0x2211 as summ symbol because it is not supported +// by debian Linux platform static const Standard_ExtCharacter MyEmptySymbol(' '); -static const Standard_ExtCharacter MySigmaSymbol('=');//0x03A3); // using equal instead of sigma - +static const Standard_ExtCharacter + MySigmaSymbol('='); // 0x03A3); // using equal instead of sigma -SketcherPrs_DimensionStyle::DimensionValue::DimensionValue(double theDoubleValue, - bool theHasParameters, const std::string& theTextValue) -: myDoubleValue(theDoubleValue), - myHasParameters(theHasParameters), - myTextValue(theTextValue) -{ -} +SketcherPrs_DimensionStyle::DimensionValue::DimensionValue( + double theDoubleValue, bool theHasParameters, + const std::string &theTextValue) + : myDoubleValue(theDoubleValue), myHasParameters(theHasParameters), + myTextValue(theTextValue) {} void SketcherPrs_DimensionStyle::DimensionValue::init( - const AttributeDoublePtr& theAttributeValue) -{ + const AttributeDoublePtr &theAttributeValue) { myDoubleValue = theAttributeValue->value(); myHasParameters = theAttributeValue->usedParameters().size() > 0; myTextValue = Locale::Convert::toString(theAttributeValue->text()); } -SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle() -{ -} +SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle() {} -SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle() -{ -} +SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle() {} -void SketcherPrs_DimensionStyle::updateDimensions(PrsDim_Dimension* theDimension, - const SketcherPrs_DimensionStyle::DimensionValue& theDimensionValue) -{ +void SketcherPrs_DimensionStyle::updateDimensions( + PrsDim_Dimension *theDimension, + const SketcherPrs_DimensionStyle::DimensionValue &theDimensionValue) { if (!theDimension) return; updateDimensions(theDimension, theDimensionValue.myHasParameters, - theDimensionValue.myTextValue, theDimensionValue.myDoubleValue); + theDimensionValue.myTextValue, + theDimensionValue.myDoubleValue); } -void SketcherPrs_DimensionStyle::updateDimensions(PrsDim_Dimension* theDimension, - const bool theHasParameters, - const std::string& theTextValue, - const double theDoubleValue) -{ +void SketcherPrs_DimensionStyle::updateDimensions( + PrsDim_Dimension *theDimension, const bool theHasParameters, + const std::string &theTextValue, const double theDoubleValue) { if (!theDimension) return; @@ -91,30 +84,30 @@ void SketcherPrs_DimensionStyle::updateDimensions(PrsDim_Dimension* theDimension TCollection_ExtendedString aCustomValue; if (theHasParameters) { - //bool isParameterTextStyle = myStyle == SketcherPrs_ParameterStyleMessage::ParameterText; + // bool isParameterTextStyle = myStyle == + // SketcherPrs_ParameterStyleMessage::ParameterText; bool isParameterTextStyle = - SketcherPrs_Tools::parameterStyle() == SketcherPrs_Tools::ParameterText; + SketcherPrs_Tools::parameterStyle() == SketcherPrs_Tools::ParameterText; if (isParameterTextStyle) aCustomValue = theTextValue.c_str(); else { // format value string using "sprintf" TCollection_AsciiString aFormatStr = - theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); + theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); char aFmtBuffer[256]; - sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue); - aCustomValue = TCollection_ExtendedString (aFmtBuffer); + sprintf(aFmtBuffer, aFormatStr.ToCString(), theDoubleValue); + aCustomValue = TCollection_ExtendedString(aFmtBuffer); - aCustomValue.Insert (1, MySigmaSymbol); + aCustomValue.Insert(1, MySigmaSymbol); } - } - else { + } else { // format value string using "sprintf" TCollection_AsciiString aFormatStr = - theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); + theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); char aFmtBuffer[256]; - sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue); - aCustomValue = TCollection_ExtendedString (aFmtBuffer); + sprintf(aFmtBuffer, aFormatStr.ToCString(), theDoubleValue); + aCustomValue = TCollection_ExtendedString(aFmtBuffer); } #ifdef COMPILATION_CORRECTION theDimension->SetCustomValue(theDoubleValue); diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.h b/src/SketcherPrs/SketcherPrs_DimensionStyle.h index 32e459021..87c742b7b 100644 --- a/src/SketcherPrs/SketcherPrs_DimensionStyle.h +++ b/src/SketcherPrs/SketcherPrs_DimensionStyle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_DimensionStyleListener_H @@ -32,23 +33,25 @@ #include /** -* \class SketcherPrs_DimensionStyleListener -* \ingroup GUI -* A class for representation of linear dimension constraint. -* It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features. -*/ -class SketcherPrs_DimensionStyle -{ + * \class SketcherPrs_DimensionStyleListener + * \ingroup GUI + * A class for representation of linear dimension constraint. + * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance + * features. + */ +class SketcherPrs_DimensionStyle { public: class DimensionValue { public: - DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue); + DimensionValue(double theDoubleValue, bool theHasParameters, + const std::string &theTextValue); /// Fills internal fields by the given attribute /// \param theAttributeValue a model attribute - void init(const AttributeDoublePtr& theAttributeValue); + void init(const AttributeDoublePtr &theAttributeValue); public: - double myDoubleValue; ///< the angle value to be shown as custom value of presentation + double myDoubleValue; ///< the angle value to be shown as custom value of + ///< presentation bool myHasParameters; ///< true if the atrribute value has used parameters std::string myTextValue; ///< the angle value depending on angle type }; @@ -60,22 +63,23 @@ public: /// Destructor Standard_EXPORT ~SketcherPrs_DimensionStyle(); - /// Visualizes the dimension text or dimension value depending on the has parameters state - /// \param theDimension a modified dimension - /// \param theDimensionValue container filled by the model double attribute - Standard_EXPORT void updateDimensions(PrsDim_Dimension* theDimension, - const DimensionValue& theDimensionValue); + /// Visualizes the dimension text or dimension value depending on the has + /// parameters state \param theDimension a modified dimension \param + /// theDimensionValue container filled by the model double attribute + Standard_EXPORT void + updateDimensions(PrsDim_Dimension *theDimension, + const DimensionValue &theDimensionValue); private: - /// Visualizes the dimension text or dimension value depending on the has parameters state - /// \param theDimension a modified dimension - /// \param theHasParameters if true, the text is shown, else digit - /// \param theTextValue a dimension text value - /// \param theDoubleValue a dimension digit value - void updateDimensions(PrsDim_Dimension* theDimension, + /// Visualizes the dimension text or dimension value depending on the has + /// parameters state \param theDimension a modified dimension \param + /// theHasParameters if true, the text is shown, else digit \param + /// theTextValue a dimension text value \param theDoubleValue a dimension + /// digit value + void updateDimensions(PrsDim_Dimension *theDimension, const bool theHasParameters, - const std::string& theTextValue, + const std::string &theTextValue, const double theDoubleValue); }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Equal.cpp b/src/SketcherPrs/SketcherPrs_Equal.cpp index 43a7017e4..fd7684328 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.cpp +++ b/src/SketcherPrs/SketcherPrs_Equal.cpp @@ -14,38 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Equal.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr&/* thePlane*/) -{ +bool SketcherPrs_Equal::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr & /* thePlane*/) { bool aReadyToDisplay = false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && SketcherPrs_Tools::getShape(aObj2).get() != NULL; @@ -53,20 +51,20 @@ bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; if (!plane()) return false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); // Set points of the presentation - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); @@ -76,21 +74,21 @@ bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep, bool withColor) c return true; } -void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { // Draw first line - ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); std::shared_ptr aLine = SketcherPrs_Tools::getShape(aObj); if (aLine.get() == NULL) return; drawShape(aLine, thePrs, theColor); // Draw second line - aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + aObj = SketcherPrs_Tools::getResult(myConstraint, + SketchPlugin_Constraint::ENTITY_B()); aLine = SketcherPrs_Tools::getShape(aObj); if (aLine.get() == NULL) return; drawShape(aLine, thePrs, theColor); } - diff --git a/src/SketcherPrs/SketcherPrs_Equal.h b/src/SketcherPrs/SketcherPrs_Equal.h index bb1983b9a..a7379ba44 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.h +++ b/src/SketcherPrs/SketcherPrs_Equal.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Equal_H @@ -22,39 +23,37 @@ #include "SketcherPrs_SymbolPrs.h" - DEFINE_STANDARD_HANDLE(SketcherPrs_Equal, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of Equal constraint -*/ -class SketcherPrs_Equal: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of Equal constraint + */ +class SketcherPrs_Equal : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); -protected: + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); - virtual const char* iconName() const { return "equal.png"; } +protected: + virtual const char *iconName() const { return "equal.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Factory.cpp b/src/SketcherPrs/SketcherPrs_Factory.cpp index 5a74009a9..fa689d720 100644 --- a/src/SketcherPrs/SketcherPrs_Factory.cpp +++ b/src/SketcherPrs/SketcherPrs_Factory.cpp @@ -14,46 +14,46 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Factory.h" +#include "SketcherPrs_Angle.h" #include "SketcherPrs_Coincident.h" #include "SketcherPrs_Collinear.h" -#include "SketcherPrs_Parallel.h" -#include "SketcherPrs_Perpendicular.h" -#include "SketcherPrs_Rigid.h" -#include "SketcherPrs_HVDirection.h" #include "SketcherPrs_Equal.h" -#include "SketcherPrs_Tangent.h" -#include "SketcherPrs_Radius.h" +#include "SketcherPrs_HVDirection.h" #include "SketcherPrs_LengthDimension.h" #include "SketcherPrs_Middle.h" #include "SketcherPrs_Mirror.h" -#include "SketcherPrs_Transformation.h" -#include "SketcherPrs_Angle.h" #include "SketcherPrs_Offset.h" +#include "SketcherPrs_Parallel.h" +#include "SketcherPrs_Perpendicular.h" +#include "SketcherPrs_Radius.h" +#include "SketcherPrs_Rigid.h" +#include "SketcherPrs_Tangent.h" +#include "SketcherPrs_Transformation.h" // Macros for constraint presentation definition -#define CONSTRAINT_PRS_IMPL(NAME, CLASS) \ -AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \ - SketchPlugin_Sketch* theSketcher, \ - AISObjectPtr thePrevious) \ -{ \ - std::shared_ptr anAISObj; \ - if (CLASS::IsReadyToDisplay(theConstraint, theSketcher->coordinatePlane())) { \ - if (thePrevious.get()) \ - anAISObj = thePrevious; \ - else { \ - anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \ - Handle(CLASS) aPrs = new CLASS(theConstraint, theSketcher); \ - anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \ - } \ - } \ - return anAISObj; \ -} - +#define CONSTRAINT_PRS_IMPL(NAME, CLASS) \ + AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature *theConstraint, \ + SketchPlugin_Sketch *theSketcher, \ + AISObjectPtr thePrevious) { \ + std::shared_ptr anAISObj; \ + if (CLASS::IsReadyToDisplay(theConstraint, \ + theSketcher->coordinatePlane())) { \ + if (thePrevious.get()) \ + anAISObj = thePrevious; \ + else { \ + anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \ + Handle(CLASS) aPrs = new CLASS(theConstraint, theSketcher); \ + anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \ + } \ + } \ + return anAISObj; \ + } CONSTRAINT_PRS_IMPL(collinearConstraint, SketcherPrs_Collinear); CONSTRAINT_PRS_IMPL(parallelConstraint, SketcherPrs_Parallel); @@ -70,70 +70,76 @@ CONSTRAINT_PRS_IMPL(radiusConstraint, SketcherPrs_Radius); CONSTRAINT_PRS_IMPL(offsetObject, SketcherPrs_Offset); // Non-standard constraints definition -AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) -{ +AISObjectPtr +SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher, + AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, theSketcher->coordinatePlane())) { + if (SketcherPrs_HVDirection::IsReadyToDisplay( + theConstraint, theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_HVDirection) aPrs = - new SketcherPrs_HVDirection(theConstraint, theSketcher, true); + new SketcherPrs_HVDirection(theConstraint, theSketcher, true); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } return anAISObj; } -AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) -{ +AISObjectPtr +SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher, + AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, theSketcher->coordinatePlane())) { + if (SketcherPrs_HVDirection::IsReadyToDisplay( + theConstraint, theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_HVDirection) aPrs = - new SketcherPrs_HVDirection(theConstraint, theSketcher, false); + new SketcherPrs_HVDirection(theConstraint, theSketcher, false); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } return anAISObj; } -AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) -{ +AISObjectPtr +SketcherPrs_Factory::translateConstraint(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher, + AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, - theSketcher->coordinatePlane())) { + if (SketcherPrs_Transformation::IsReadyToDisplay( + theConstraint, theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_Transformation) aPrs = - new SketcherPrs_Transformation(theConstraint, theSketcher, true); + new SketcherPrs_Transformation(theConstraint, theSketcher, true); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } return anAISObj; } -AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) -{ +AISObjectPtr +SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher, + AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, - theSketcher->coordinatePlane())) { + if (SketcherPrs_Transformation::IsReadyToDisplay( + theConstraint, theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_Transformation) aPrs = - new SketcherPrs_Transformation(theConstraint, theSketcher, false); + new SketcherPrs_Transformation(theConstraint, theSketcher, false); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } diff --git a/src/SketcherPrs/SketcherPrs_Factory.h b/src/SketcherPrs/SketcherPrs_Factory.h index 26430129b..4955e8ec5 100644 --- a/src/SketcherPrs/SketcherPrs_Factory.h +++ b/src/SketcherPrs/SketcherPrs_Factory.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Factory_H_ @@ -23,22 +24,21 @@ #include "SketcherPrs.h" #include -#include #include +#include -#include #include +#include -#define GET_CONSTRAINT_PRS(NAME) \ - static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \ - SketchPlugin_Sketch* theSketcher, \ +#define GET_CONSTRAINT_PRS(NAME) \ + static AISObjectPtr NAME(ModelAPI_Feature *theConstraint, \ + SketchPlugin_Sketch *theSketcher, \ AISObjectPtr thePrevious); /** -* Class which creates constraints presentations -*/ -class SKETCHERPRS_EXPORT SketcherPrs_Factory -{ + * Class which creates constraints presentations + */ +class SKETCHERPRS_EXPORT SketcherPrs_Factory { public: /// Creates collinear constraint presentation /// \param theConstraint the constraint diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index 1ea713c37..35c86d336 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -14,65 +14,64 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_HVDirection.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, bool isHorisontal) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher), - myIsHorisontal(isHorisontal) -{ -} +SketcherPrs_HVDirection::SketcherPrs_HVDirection( + ModelAPI_Feature *theConstraint, SketchPlugin_Sketch *theSketcher, + bool isHorisontal) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher), + myIsHorisontal(isHorisontal) {} -bool SketcherPrs_HVDirection::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_HVDirection::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (thePlane.get()) { - ObjectPtr aObj = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL; } return aReadyToDisplay; } -bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; // Set point of the symbol - ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + ObjectPtr aObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); myPntArray->AddVertex(aP1); return true; } -void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation) & + thePrs, + Quantity_Color theColor) const { Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); // Draw constrained object Handle(Graphic3d_AspectLine3d) aLineAspect = - new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); } - diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.h b/src/SketcherPrs/SketcherPrs_HVDirection.h index 5ce5ceb23..963c0e99a 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.h +++ b/src/SketcherPrs/SketcherPrs_HVDirection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_HVDirection_H @@ -23,40 +24,41 @@ #include "SketcherPrs_SymbolPrs.h" #include - DEFINE_STANDARD_HANDLE(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of parallel constraint -*/ -class SketcherPrs_HVDirection: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of parallel constraint + */ +class SketcherPrs_HVDirection : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object /// \param isHorisontal a flag horizontal or vertical presentation - Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, bool isHorisontal); + Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher, + bool isHorisontal); DEFINE_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); protected: - virtual const char* iconName() const { return myIsHorisontal? "horisontal.png" : "vertical.png"; } + virtual const char *iconName() const { + return myIsHorisontal ? "horisontal.png" : "vertical.png"; + } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success @@ -66,4 +68,4 @@ private: bool myIsHorisontal; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index f81fe13c2..f9e9e5d5c 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -14,39 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_LengthDimension.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_DimensionStyle.h" +#include "SketcherPrs_Tools.h" +#include #include -#include #include #include #include +#include #include #include -#include -#include +#include #include -#include #include -#include +#include +#include -#include #include #include - +#include #define OCCT_28850_FIXED /// Creates an aspect to be shown in length/radius dimension presentations /// \return an instance of aspect -Handle(Prs3d_DimensionAspect) createDimensionAspect() -{ +Handle(Prs3d_DimensionAspect) createDimensionAspect() { Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); anAspect->MakeArrows3d(false); anAspect->MakeText3d(false); @@ -63,86 +62,84 @@ Handle(Prs3d_DimensionAspect) createDimensionAspect() /// \param theDimValue an arrow value /// \param theTextSize an arrow value void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, - double theDimValue, double theTextSize, SketcherPrs_Tools::LocationType theLocationType) -{ + double theDimValue, double theTextSize, + SketcherPrs_Tools::LocationType theLocationType) { if (theLocationType == SketcherPrs_Tools::LOCATION_AUTOMATIC) { double anArrowLength = theDimAspect->ArrowAspect()->Length(); - // This is not realy correct way to get viewer scale. - double aViewerScale = (double) SketcherPrs_Tools::getConfigArrowSize() / anArrowLength; + // This is not realy correct way to get viewer scale. + double aViewerScale = + (double)SketcherPrs_Tools::getConfigArrowSize() / anArrowLength; - if(theTextSize > ((theDimValue - 3 * SketcherPrs_Tools::getArrowSize()) * aViewerScale)) { + if (theTextSize > ((theDimValue - 3 * SketcherPrs_Tools::getArrowSize()) * + aViewerScale)) { theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Left); theDimAspect->SetArrowOrientation(Prs3d_DAO_External); theDimAspect->SetExtensionSize( - (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / 2.0); + (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / + 2.0); } else { theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Center); theDimAspect->SetArrowOrientation(Prs3d_DAO_Internal); } - } - else if (theLocationType == SketcherPrs_Tools::LOCATION_RIGHT || - theLocationType == SketcherPrs_Tools::LOCATION_LEFT) { + } else if (theLocationType == SketcherPrs_Tools::LOCATION_RIGHT || + theLocationType == SketcherPrs_Tools::LOCATION_LEFT) { theDimAspect->SetTextHorizontalPosition( - theLocationType == SketcherPrs_Tools::LOCATION_LEFT ? Prs3d_DTHP_Left : Prs3d_DTHP_Right); + theLocationType == SketcherPrs_Tools::LOCATION_LEFT ? Prs3d_DTHP_Left + : Prs3d_DTHP_Right); theDimAspect->SetArrowOrientation(Prs3d_DAO_External); double anArrowLength = theDimAspect->ArrowAspect()->Length(); // This is not realy correct way to get viewer scale. - double aViewerScale = (double) SketcherPrs_Tools::getConfigArrowSize() / anArrowLength; + double aViewerScale = + (double)SketcherPrs_Tools::getConfigArrowSize() / anArrowLength; theDimAspect->SetExtensionSize( (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / 2.0); } - theDimAspect->TextAspect()->SetFont(Config_PropManager::string("Visualization", - "dimension_font").c_str()); + theDimAspect->TextAspect()->SetFont( + Config_PropManager::string("Visualization", "dimension_font").c_str()); theDimAspect->SetArrowTailSize(theDimAspect->ArrowAspect()->Length()); // The value of vertical aligment is sometimes changed theDimAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER); } - -static const gp_Pnt MyDefStart(0,0,0); -static const gp_Pnt MyDefEnd(1,0,0); -static const gp_Pln MyDefPln(gp_Pnt(0,0,0), gp_Dir(0,0,1)); +static const gp_Pnt MyDefStart(0, 0, 0); +static const gp_Pnt MyDefEnd(1, 0, 0); +static const gp_Pln MyDefPln(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, PrsDim_LengthDimension); -SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) -: PrsDim_LengthDimension(MyDefStart, MyDefEnd, MyDefPln), - myConstraint(theConstraint), - mySketcher(theSketcher), - myFirstPoint(MyDefStart), - mySecondPoint(MyDefEnd), - myPlane(MyDefPln), - myDistance(1), - myValue(0., false, "") -{ +SketcherPrs_LengthDimension::SketcherPrs_LengthDimension( + ModelAPI_Feature *theConstraint, SketchPlugin_Sketch *theSketcher) + : PrsDim_LengthDimension(MyDefStart, MyDefEnd, MyDefPln), + myConstraint(theConstraint), mySketcher(theSketcher), + myFirstPoint(MyDefStart), mySecondPoint(MyDefEnd), myPlane(MyDefPln), + myDistance(1), myValue(0., false, "") { SetDimensionAspect(createDimensionAspect()); myStyleListener = new SketcherPrs_DimensionStyle(); setDirection(theConstraint, plane()); } -SketcherPrs_LengthDimension::~SketcherPrs_LengthDimension() -{ +SketcherPrs_LengthDimension::~SketcherPrs_LengthDimension() { delete myStyleListener; } -bool SketcherPrs_LengthDimension::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_LengthDimension::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { gp_Pnt2d aPnt1, aPnt2; return readyToDisplay(theConstraint, thePlane, aPnt1, aPnt2); } -static bool isEqualPoints(ModelAPI_Feature* theConstraint, - const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) -{ +static bool isEqualPoints(ModelAPI_Feature *theConstraint, + const gp_Pnt2d &theP1, const gp_Pnt2d &theP2) { bool isEqual = false; - if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID()) + if (theConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID()) isEqual = Abs(theP1.X() - theP2.X()) < Precision::Confusion(); - else if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) + else if (theConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) isEqual = Abs(theP1.Y() - theP2.Y()) < Precision::Confusion(); else { isEqual = theP1.SquareDistance(theP2) < Precision::SquareConfusion(); @@ -151,10 +148,9 @@ static bool isEqualPoints(ModelAPI_Feature* theConstraint, } void SketcherPrs_LengthDimension::Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) -{ + const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode) { if (!plane().get()) return; gp_Pnt2d aP1, aP2; @@ -162,16 +158,17 @@ void SketcherPrs_LengthDimension::Compute( if (aReadyToDisplay) { if (isEqualPoints(myConstraint, aP1, aP2)) { // adjust points to draw the dimension presentation - std::shared_ptr aDirAttr = std::dynamic_pointer_cast( - myConstraint->attribute(SketchPlugin_ConstraintDistance::DIRECTION_ID())); + std::shared_ptr aDirAttr = + std::dynamic_pointer_cast(myConstraint->attribute( + SketchPlugin_ConstraintDistance::DIRECTION_ID())); double x = 0.0, y = 0.0; if (aDirAttr && aDirAttr->isInitialized()) { x = aDirAttr->x(); y = aDirAttr->y(); if (x == 0.0 && y == 0.0) x = 1.0; - } - else if (myConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) + } else if (myConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) y = 1.0; else x = 1.0; @@ -189,9 +186,12 @@ void SketcherPrs_LengthDimension::Compute( DataPtr aData = myConstraint->data(); AttributeDoublePtr anAttributeValue; - if (myConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID() || - myConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) - anAttributeValue = aData->real(SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()); + if (myConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID() || + myConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) + anAttributeValue = aData->real( + SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()); else anAttributeValue = aData->real(SketchPlugin_Constraint::VALUE()); myValue.init(anAttributeValue); @@ -214,30 +214,36 @@ void SketcherPrs_LengthDimension::Compute( else if (aConstraintKind == SketchPlugin_ConstraintDistance::ID()) aLocationAttribute = SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID(); else if (aConstraintKind == SketchPlugin_ConstraintDistanceHorizontal::ID()) - aLocationAttribute = SketchPlugin_ConstraintDistanceHorizontal::LOCATION_TYPE_ID(); + aLocationAttribute = + SketchPlugin_ConstraintDistanceHorizontal::LOCATION_TYPE_ID(); else if (aConstraintKind == SketchPlugin_ConstraintDistanceVertical::ID()) - aLocationAttribute = SketchPlugin_ConstraintDistanceVertical::LOCATION_TYPE_ID(); - - AttributeIntegerPtr aLocAttr = std::dynamic_pointer_cast - (myConstraint->data()->attribute(aLocationAttribute)); - SketcherPrs_Tools::LocationType aLocationType = aLocAttr->isInitialized() ? - (SketcherPrs_Tools::LocationType)(aLocAttr->value()) : SketcherPrs_Tools::LOCATION_AUTOMATIC; + aLocationAttribute = + SketchPlugin_ConstraintDistanceVertical::LOCATION_TYPE_ID(); + + AttributeIntegerPtr aLocAttr = + std::dynamic_pointer_cast( + myConstraint->data()->attribute(aLocationAttribute)); + SketcherPrs_Tools::LocationType aLocationType = + aLocAttr->isInitialized() + ? (SketcherPrs_Tools::LocationType)(aLocAttr->value()) + : SketcherPrs_Tools::LOCATION_AUTOMATIC; updateArrows(DimensionAspect(), GetValue(), aTextSize, aLocationType); // Update text visualization: parameter value or parameter text myStyleListener->updateDimensions(this, myValue); - PrsDim_LengthDimension::Compute(thePresentationManager, thePresentation, theMode); + PrsDim_LengthDimension::Compute(thePresentationManager, thePresentation, + theMode); if (!aReadyToDisplay) - SketcherPrs_Tools::sendEmptyPresentationError(myConstraint, - "An empty AIS presentation: SketcherPrs_LengthDimension"); + SketcherPrs_Tools::sendEmptyPresentationError( + myConstraint, "An empty AIS presentation: SketcherPrs_LengthDimension"); } -bool SketcherPrs_LengthDimension::readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Pnt2d& thePnt1, gp_Pnt2d& thePnt2) -{ +bool SketcherPrs_LengthDimension::readyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, gp_Pnt2d &thePnt1, + gp_Pnt2d &thePnt2) { if (!thePlane) return false; @@ -245,8 +251,8 @@ bool SketcherPrs_LengthDimension::readyToDisplay(ModelAPI_Feature* theConstraint if (theConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) { // The constraint is length std::shared_ptr anAttr = - std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); if (!anAttr) return false; @@ -257,23 +263,28 @@ bool SketcherPrs_LengthDimension::readyToDisplay(ModelAPI_Feature* theConstraint // Get geometry of the object DataPtr aLineData = aFeature->data(); std::shared_ptr aStartPoint = - std::dynamic_pointer_cast - (aLineData->attribute(SketchPlugin_Line::START_ID())); + std::dynamic_pointer_cast( + aLineData->attribute(SketchPlugin_Line::START_ID())); std::shared_ptr aEndPoint = - std::dynamic_pointer_cast - (aLineData->attribute(SketchPlugin_Line::END_ID())); + std::dynamic_pointer_cast( + aLineData->attribute(SketchPlugin_Line::END_ID())); thePnt1 = gp_Pnt2d(aStartPoint->x(), aStartPoint->y()); thePnt2 = gp_Pnt2d(aEndPoint->x(), aEndPoint->y()); return true; - } else if (theConstraint->getKind() == SketchPlugin_ConstraintDistance::ID() || - theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID() || - theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) { + } else if (theConstraint->getKind() == + SketchPlugin_ConstraintDistance::ID() || + theConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID() || + theConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) { // The constraint is distance - std::shared_ptr aPoint_A = SketcherPrs_Tools::getFeaturePoint( - aData, SketchPlugin_Constraint::ENTITY_A(), thePlane); - std::shared_ptr aPoint_B = SketcherPrs_Tools::getFeaturePoint( - aData, SketchPlugin_Constraint::ENTITY_B(), thePlane); + std::shared_ptr aPoint_A = + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_A(), thePlane); + std::shared_ptr aPoint_B = + SketcherPrs_Tools::getFeaturePoint( + aData, SketchPlugin_Constraint::ENTITY_B(), thePlane); std::shared_ptr aPnt_A; std::shared_ptr aPnt_B; @@ -309,11 +320,9 @@ bool SketcherPrs_LengthDimension::readyToDisplay(ModelAPI_Feature* theConstraint return false; } - - -void SketcherPrs_LengthDimension::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) -{ +void SketcherPrs_LengthDimension::ComputeSelection( + const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer theMode) { // Map the application selection modes to standard ones Standard_Integer aMode; switch (theMode) { @@ -335,17 +344,19 @@ void SketcherPrs_LengthDimension::ComputeSelection(const Handle(SelectMgr_Select return; } } - SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize()/5.); + SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize() / 5.); PrsDim_LengthDimension::ComputeSelection(aSelection, aMode); } -void SketcherPrs_LengthDimension::setDirection(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +void SketcherPrs_LengthDimension::setDirection( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { #ifdef OCCT_28850_FIXED - if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID()) + if (theConstraint->getKind() == + SketchPlugin_ConstraintDistanceHorizontal::ID()) SetDirection(thePlane->dirX()->impl(), true); - else if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) + else if (theConstraint->getKind() == + SketchPlugin_ConstraintDistanceVertical::ID()) SetDirection(thePlane->dirY()->impl(), true); #endif } diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.h b/src/SketcherPrs/SketcherPrs_LengthDimension.h index 953c0195b..a76055d59 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.h +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_LinearDimension_H @@ -23,11 +24,11 @@ #include #include #include -#include #include +#include -#include #include +#include #include #include @@ -35,18 +36,18 @@ DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, PrsDim_LengthDimension) /** -* \ingroup GUI -* A class for representation of linear dimension constraint. -* It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features. -*/ -class SketcherPrs_LengthDimension : public PrsDim_LengthDimension -{ + * \ingroup GUI + * A class for representation of linear dimension constraint. + * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance + * features. + */ +class SketcherPrs_LengthDimension : public PrsDim_LengthDimension { public: /// Constructor /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch - Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); /// Destructor Standard_EXPORT ~SketcherPrs_LengthDimension(); @@ -58,55 +59,55 @@ public: /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); /// Returns sketcher plane - Standard_EXPORT std::shared_ptr plane() const - { + Standard_EXPORT std::shared_ptr plane() const { return mySketcher->coordinatePlane(); } protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode); + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer aMode); private: - static bool readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Pnt2d& thePnt1, gp_Pnt2d& thePnt2); + static bool readyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, + gp_Pnt2d &thePnt1, gp_Pnt2d &thePnt2); /// Set the direction for horizontal/vertical constraint - void setDirection(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + void setDirection(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); /// Constraint feature - ModelAPI_Feature* myConstraint; + ModelAPI_Feature *myConstraint; /// A current sketcher - SketchPlugin_Sketch* mySketcher; + SketchPlugin_Sketch *mySketcher; - //Handle(Prs3d_DimensionAspect) myAspect; + // Handle(Prs3d_DimensionAspect) myAspect; /// Listener to update dimension visualization style - SketcherPrs_DimensionStyle* myStyleListener; + SketcherPrs_DimensionStyle *myStyleListener; /// container of values obtained from the constraint, which are necessary /// to fill the presentation - gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry + gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry gp_Pnt mySecondPoint; ///< the dimension first point for measured geometry - gp_Pln myPlane; ///< the plane(plane of the sketch) for measured geometry + gp_Pln myPlane; ///< the plane(plane of the sketch) for measured geometry double myDistance; ///< the flyout distance /// the structure filled by constraint SketcherPrs_DimensionStyle::DimensionValue myValue; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index 8c25c6792..f8fde54ec 100644 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -14,39 +14,38 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Middle.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Middle::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (thePlane) { - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); - // one object is a feature Line, other object is a point result. We check shape of point result + // one object is a feature Line, other object is a point result. We check + // shape of point result aReadyToDisplay = aObj1.get() && aObj2.get() && (SketcherPrs_Tools::getShape(aObj1).get() != NULL || SketcherPrs_Tools::getShape(aObj2).get() != NULL); @@ -54,26 +53,26 @@ bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aPointObject; // find a line result to set middle symbol near it myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); - AttributePtr anAttribute = - SketcherPrs_Tools::getAttribute(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + AttributePtr anAttribute = SketcherPrs_Tools::getAttribute( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); if (!anAttribute.get()) { - ObjectPtr aObj = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); std::shared_ptr aShape = SketcherPrs_Tools::getShape(aObj); if (aShape.get() && aShape->isEdge()) aPointObject = aObj; } if (!aPointObject.get()) { - ObjectPtr aObj = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); std::shared_ptr aShape = SketcherPrs_Tools::getShape(aObj); if (aShape.get() && aShape->isEdge()) aPointObject = aObj; @@ -83,47 +82,48 @@ bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, bool withColor) return false; // Set points of the presentation - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aPointObject, this, theStep); myPntArray->SetVertice(1, aP1); return true; } -void SketcherPrs_Middle::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Middle::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); Handle(Graphic3d_AspectLine3d) aLineAspect = - new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw objects - ObjectPtr aObject = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObject = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); drawLine(thePrs, theColor, aObject); - aObject = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + aObject = SketcherPrs_Tools::getResult(myConstraint, + SketchPlugin_Constraint::ENTITY_A()); drawLine(thePrs, theColor, aObject); } -void SketcherPrs_Middle::drawLine(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor, const ObjectPtr& theObject) const -{ - FeaturePtr aLineFeature = std::dynamic_pointer_cast(theObject); +void SketcherPrs_Middle::drawLine(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor, + const ObjectPtr &theObject) const { + FeaturePtr aLineFeature = + std::dynamic_pointer_cast(theObject); if (aLineFeature.get()) { std::list aResults = aLineFeature->results(); if (aResults.size() == 1) { ResultPtr aResult = aResults.front(); - std::shared_ptr aLine = SketcherPrs_Tools::getShape(aResult); + std::shared_ptr aLine = + SketcherPrs_Tools::getShape(aResult); if (aLine.get() != NULL) drawShape(aLine, thePrs, theColor); } - } - else { - std::shared_ptr aLine = SketcherPrs_Tools::getShape(theObject); + } else { + std::shared_ptr aLine = + SketcherPrs_Tools::getShape(theObject); if (aLine.get() != NULL) drawShape(aLine, thePrs, theColor); } } - diff --git a/src/SketcherPrs/SketcherPrs_Middle.h b/src/SketcherPrs/SketcherPrs_Middle.h index 92820adff..8561603f5 100644 --- a/src/SketcherPrs/SketcherPrs_Middle.h +++ b/src/SketcherPrs/SketcherPrs_Middle.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Middle_H @@ -22,43 +23,41 @@ #include "SketcherPrs_SymbolPrs.h" - DEFINE_STANDARD_HANDLE(SketcherPrs_Middle, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of Equal constraint -*/ -class SketcherPrs_Middle: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of Equal constraint + */ +class SketcherPrs_Middle : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); -protected: + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); - virtual const char* iconName() const { return "middlepoint.png"; } +protected: + virtual const char *iconName() const { return "middlepoint.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; /// Draw shape of the object. Find shape result if the object is feature - void drawLine(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor, - const ObjectPtr& theObject) const; + void drawLine(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor, const ObjectPtr &theObject) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 100b00d81..7570952da 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -14,56 +14,55 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Mirror.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Mirror::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (!thePlane) return aReadyToDisplay; // Get axis of mirror - ObjectPtr aAxisObj = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aAxisObj = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); if (SketcherPrs_Tools::getShape(aAxisObj).get() == NULL) return aReadyToDisplay; std::shared_ptr aData = theConstraint->data(); // Get source objects std::shared_ptr anAttrB = - aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return aReadyToDisplay; // Get mirrored objects std::shared_ptr anAttrC = - aData->reflist(SketchPlugin_Constraint::ENTITY_C()); + aData->reflist(SketchPlugin_Constraint::ENTITY_C()); if (anAttrC.get() == NULL) return aReadyToDisplay; int aNb = anAttrB->size(); - // If size of source objects and mirrored ones is not equal then the constraint is not computed + // If size of source objects and mirrored ones is not equal then the + // constraint is not computed if (aNb != anAttrC->size()) return aReadyToDisplay; @@ -71,24 +70,24 @@ bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; // Get axis of mirror - ObjectPtr aAxisObj = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aAxisObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); std::shared_ptr aData = myConstraint->data(); // Get source objects std::shared_ptr anAttrB = - aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); // Get mirrored objects std::shared_ptr anAttrC = - aData->reflist(SketchPlugin_Constraint::ENTITY_C()); + aData->reflist(SketchPlugin_Constraint::ENTITY_C()); - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); int aNb = anAttrB->size(); myPntArray = new Graphic3d_ArrayOfPoints(2 * aNb, withColor); @@ -114,17 +113,15 @@ bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, bool withColor) return true; } - -void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { std::shared_ptr aData = myConstraint->data(); std::shared_ptr anAttrB = - aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return; std::shared_ptr anAttrC = - aData->reflist(SketchPlugin_Constraint::ENTITY_C()); + aData->reflist(SketchPlugin_Constraint::ENTITY_C()); if (anAttrC.get() == NULL) return; @@ -135,7 +132,8 @@ void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation)& thePrs, Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); // drawListOfShapes uses myDrawer for attributes definition - Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1); + Handle(Prs3d_LineAspect) aLnAspect = + new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1); myDrawer->SetLineAspect(aLnAspect); // Draw axis line @@ -147,4 +145,3 @@ void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation)& thePrs, // draw mirrored objects drawListOfShapes(anAttrC, thePrs, theColor); } - diff --git a/src/SketcherPrs/SketcherPrs_Mirror.h b/src/SketcherPrs/SketcherPrs_Mirror.h index e4b021713..fd49138e0 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.h +++ b/src/SketcherPrs/SketcherPrs_Mirror.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Mirror_H @@ -22,38 +23,37 @@ #include "SketcherPrs_SymbolPrs.h" - DEFINE_STANDARD_HANDLE(SketcherPrs_Mirror, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of mirror constraint -*/ -class SketcherPrs_Mirror: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of mirror constraint + */ +class SketcherPrs_Mirror : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); + protected: - virtual const char* iconName() const { return "mirror.png"; } + virtual const char *iconName() const { return "mirror.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Offset.cpp b/src/SketcherPrs/SketcherPrs_Offset.cpp index e7608897f..12d2af2ab 100644 --- a/src/SketcherPrs/SketcherPrs_Offset.cpp +++ b/src/SketcherPrs/SketcherPrs_Offset.cpp @@ -14,63 +14,66 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Offset.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include -#include #include +#include #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Offset, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Offset::SketcherPrs_Offset(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Offset::SketcherPrs_Offset(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Offset::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr&/* thePlane*/) -{ +bool SketcherPrs_Offset::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr & /* thePlane*/) { bool aReadyToDisplay = false; - AttributeDoublePtr aValueAttr = theConstraint->real(SketchPlugin_Offset::VALUE_ID()); + AttributeDoublePtr aValueAttr = + theConstraint->real(SketchPlugin_Offset::VALUE_ID()); if (aValueAttr->isInitialized()) { - AttributeRefListPtr aSelectedEdges = theConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); + AttributeRefListPtr aSelectedEdges = + theConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); aReadyToDisplay = (aSelectedEdges->list().size() > 0); if (aReadyToDisplay) { - AttributeRefListPtr aOffcetEdges = theConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); + AttributeRefListPtr aOffcetEdges = + theConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); aReadyToDisplay = (aOffcetEdges->list().size() > 0); } } return aReadyToDisplay; } -bool SketcherPrs_Offset::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Offset::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; if (!plane()) return false; // Set points of the presentation - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); - AttributeRefListPtr aSelectedEdges = myConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); + AttributeRefListPtr aSelectedEdges = + myConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); int aNb = aSelectedEdges->size(); - AttributeRefListPtr aOffcetEdges = myConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); + AttributeRefListPtr aOffcetEdges = + myConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); int aOffNb = aOffcetEdges->size(); myPntArray = new Graphic3d_ArrayOfPoints(aNb + aOffNb, withColor); @@ -95,13 +98,14 @@ bool SketcherPrs_Offset::updateIfReadyToDisplay(double theStep, bool withColor) return true; } -void SketcherPrs_Offset::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ - AttributeRefListPtr aSelectedEdges = myConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); +void SketcherPrs_Offset::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { + AttributeRefListPtr aSelectedEdges = + myConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); if (aSelectedEdges.get() == NULL) return; - AttributeRefListPtr aOffcetEdges = myConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); + AttributeRefListPtr aOffcetEdges = + myConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); if (aOffcetEdges.get() == NULL) return; diff --git a/src/SketcherPrs/SketcherPrs_Offset.h b/src/SketcherPrs/SketcherPrs_Offset.h index 8a479c6fa..bfdd0899d 100644 --- a/src/SketcherPrs/SketcherPrs_Offset.h +++ b/src/SketcherPrs/SketcherPrs_Offset.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Offset_H @@ -22,40 +23,39 @@ #include "SketcherPrs_SymbolPrs.h" - DEFINE_STANDARD_HANDLE(SketcherPrs_Offset, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of Equal constraint -*/ -class SketcherPrs_Offset : public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of Equal constraint + */ +class SketcherPrs_Offset : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Offset(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Offset(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Offset, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly - /// filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); -protected: + /// Returns true if the constraint feature arguments are correcly + /// filled to build AIS presentation + /// \param theConstraint a constraint feature + /// \param thePlane a coordinate plane of current sketch + /// \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); - virtual const char* iconName() const { return "offset.png"; } +protected: + virtual const char *iconName() const { return "offset.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index 448ba29e2..d0338dda9 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -14,37 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Parallel.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Parallel::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (thePlane) { - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && SketcherPrs_Tools::getShape(aObj2).get() != NULL; @@ -52,18 +50,18 @@ bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); // Compute position of symbols - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); @@ -72,18 +70,15 @@ bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, bool withColor return true; } - -void SketcherPrs_Parallel::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Parallel::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); Handle(Graphic3d_AspectLine3d) aLineAspect = - new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw constrained lines addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); addLine(aGroup, SketchPlugin_Constraint::ENTITY_B()); } - diff --git a/src/SketcherPrs/SketcherPrs_Parallel.h b/src/SketcherPrs/SketcherPrs_Parallel.h index c85cbfa99..09830236f 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.h +++ b/src/SketcherPrs/SketcherPrs_Parallel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Parallel_H @@ -22,39 +23,37 @@ #include "SketcherPrs_SymbolPrs.h" - DEFINE_STANDARD_HANDLE(SketcherPrs_Parallel, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of parallel constraint -*/ -class SketcherPrs_Parallel: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of parallel constraint + */ +class SketcherPrs_Parallel : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); protected: - virtual const char* iconName() const { return "parallel.png"; } + virtual const char *iconName() const { return "parallel.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp index f8a3ec18a..18490fa74 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp @@ -14,12 +14,13 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Perpendicular.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" #include @@ -31,26 +32,23 @@ #include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Perpendicular::SketcherPrs_Perpendicular( + ModelAPI_Feature *theConstraint, SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Perpendicular::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (thePlane) { - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && SketcherPrs_Tools::getShape(aObj2).get() != NULL; @@ -58,15 +56,15 @@ bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint return aReadyToDisplay; } -bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); GeomShapePtr aShp1 = SketcherPrs_Tools::getShape(aObj1); GeomShapePtr aShp2 = SketcherPrs_Tools::getShape(aObj2); @@ -80,9 +78,9 @@ bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool with aPnt = anInter->vertex()->point(); // Compute position of symbols - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep, aPnt); - myPntArray = new Graphic3d_ArrayOfPoints(aPnt.get()? 1 : 2, withColor); + myPntArray = new Graphic3d_ArrayOfPoints(aPnt.get() ? 1 : 2, withColor); myPntArray->AddVertex(aP1); if (!aPnt.get()) { gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); @@ -91,14 +89,13 @@ bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool with return true; } - -void SketcherPrs_Perpendicular::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Perpendicular::drawLines(const Handle(Prs3d_Presentation) & + thePrs, + Quantity_Color theColor) const { // Draw constrained lines for (int i = 0; i < 2; ++i) { - ObjectPtr anObj = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ATTRIBUTE(i)); + ObjectPtr anObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ATTRIBUTE(i)); GeomShapePtr aShape = SketcherPrs_Tools::getShape(anObj); if (!aShape) return; diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.h b/src/SketcherPrs/SketcherPrs_Perpendicular.h index f214c98fe..5042cafa7 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.h +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Perpendicular_H @@ -24,42 +25,41 @@ class SketchPlugin_Sketch; - DEFINE_STANDARD_HANDLE(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of perpendicular constraint -*/ -class SketcherPrs_Perpendicular: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of perpendicular constraint + */ +class SketcherPrs_Perpendicular : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); + protected: - virtual const char* iconName() const { return "perpendicular.png"; } + virtual const char *iconName() const { return "perpendicular.png"; } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index 282c68d2f..a4e0dcfc4 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_PositionMgr.h" @@ -23,9 +24,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -33,41 +34,37 @@ #include #include -#include -#include #include #include +#include +#include -#include -#include #include +#include #include +#include #include #include -static SketcherPrs_PositionMgr* MyPosMgr = NULL; +static SketcherPrs_PositionMgr *MyPosMgr = NULL; #define PI 3.1415926535897932 // The class is implemented as a singlton -SketcherPrs_PositionMgr* SketcherPrs_PositionMgr::get() -{ +SketcherPrs_PositionMgr *SketcherPrs_PositionMgr::get() { if (MyPosMgr == NULL) MyPosMgr = new SketcherPrs_PositionMgr(); return MyPosMgr; } -SketcherPrs_PositionMgr::SketcherPrs_PositionMgr() -{ -} +SketcherPrs_PositionMgr::SketcherPrs_PositionMgr() {} -int SketcherPrs_PositionMgr::getPositionIndex(ObjectPtr theLine, - const SketcherPrs_SymbolPrs* thePrs) -{ +int SketcherPrs_PositionMgr::getPositionIndex( + ObjectPtr theLine, const SketcherPrs_SymbolPrs *thePrs) { if (myShapes.count(theLine) == 1) { // Find the map and add new [Presentation - Index] pair - PositionsMap& aPosMap = myShapes[theLine]; + PositionsMap &aPosMap = myShapes[theLine]; if (aPosMap.count(thePrs) == 1) { // return existing index return aPosMap[thePrs]; @@ -86,20 +83,18 @@ int SketcherPrs_PositionMgr::getPositionIndex(ObjectPtr theLine, } } - -bool SketcherPrs_PositionMgr::isPntConstraint(const std::string& theName) -{ +bool SketcherPrs_PositionMgr::isPntConstraint(const std::string &theName) { return ((theName == SketchPlugin_ConstraintTangent::ID()) || - (theName == SketchPlugin_ConstraintPerpendicular::ID())); + (theName == SketchPlugin_ConstraintPerpendicular::ID())); } -bool containsPoint(const FeaturePtr& theFeature, GeomPnt2dPtr thePnt2d, GeomPointPtr thePos) -{ +bool containsPoint(const FeaturePtr &theFeature, GeomPnt2dPtr thePnt2d, + GeomPointPtr thePos) { if (theFeature->getKind() == SketchPlugin_Line::ID()) { AttributePoint2DPtr aSPnt1 = std::dynamic_pointer_cast( - theFeature->data()->attribute(SketchPlugin_Line::START_ID())); + theFeature->data()->attribute(SketchPlugin_Line::START_ID())); AttributePoint2DPtr aSPnt2 = std::dynamic_pointer_cast( - theFeature->data()->attribute(SketchPlugin_Line::END_ID())); + theFeature->data()->attribute(SketchPlugin_Line::END_ID())); GeomPnt2dPtr aPnt1 = aSPnt1->pnt(); GeomPnt2dPtr aPnt2 = aSPnt2->pnt(); @@ -123,35 +118,39 @@ bool containsPoint(const FeaturePtr& theFeature, GeomPnt2dPtr thePnt2d, GeomPoin if (aCurve.get()) { double aStart = aCurve->startParam(); double aEnd = aCurve->endParam(); - GeomCirclePtr aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve)); + GeomCirclePtr aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve)); double aParam; - if (aCircle->parameter(thePos, 1.e-4, aParam) && (aParam >= aStart) && (aParam <= aEnd)) + if (aCircle->parameter(thePos, 1.e-4, aParam) && (aParam >= aStart) && + (aParam <= aEnd)) return true; } } return false; } -const std::array& SketcherPrs_PositionMgr::getPositionIndex(GeomPointPtr thePos, - const SketcherPrs_SymbolPrs* thePrs) -{ +const std::array & +SketcherPrs_PositionMgr::getPositionIndex(GeomPointPtr thePos, + const SketcherPrs_SymbolPrs *thePrs) { if (myPntShapes.count(thePrs->feature()) == 0) { - // Renumerate positions around the specified constraint point for all constraints + // Renumerate positions around the specified constraint point for all + // constraints GeomAx3Ptr aAx3 = thePrs->plane(); - ModelAPI_CompositeFeature* aOwner = thePrs->sketcher(); - GeomPnt2dPtr aPnt2d = thePos->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY()); + ModelAPI_CompositeFeature *aOwner = thePrs->sketcher(); + GeomPnt2dPtr aPnt2d = + thePos->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY()); int aNbSubs = aOwner->numberOfSubs(); int aId = 0; - std::list aFeaList; + std::list aFeaList; for (int i = 0; i < aNbSubs; i++) { FeaturePtr aFeature = aOwner->subFeature(i); bool aUseFeature = ((myPntShapes.count(aFeature.get()) == 1) || - (isPntConstraint(aFeature->getKind()))); + (isPntConstraint(aFeature->getKind()))); if (aUseFeature) { DataPtr aData = aFeature->data(); - AttributeRefAttrPtr aObjRef = aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + AttributeRefAttrPtr aObjRef = + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); FeaturePtr aObj; if (aObjRef) aObj = ModelAPI_Feature::feature(aObjRef->object()); @@ -173,8 +172,8 @@ const std::array& SketcherPrs_PositionMgr::getPositionIndex(GeomPointPtr } } } - int aSize = (int) aFeaList.size(); - std::list::const_iterator aIt; + int aSize = (int)aFeaList.size(); + std::list::const_iterator aIt; for (aIt = aFeaList.cbegin(); aIt != aFeaList.cend(); aIt++) { myPntShapes[*aIt][1] = aSize; } @@ -183,14 +182,13 @@ const std::array& SketcherPrs_PositionMgr::getPositionIndex(GeomPointPtr } //***************************************************************** -gp_Vec getVector(ObjectPtr theShape, GeomDirPtr theDir, gp_Pnt theP) -{ +gp_Vec getVector(ObjectPtr theShape, GeomDirPtr theDir, gp_Pnt theP) { gp_Vec aVec; std::shared_ptr aShape = SketcherPrs_Tools::getShape(theShape); if (aShape->isEdge()) { std::shared_ptr anEdge = aShape->edge(); std::shared_ptr aCurve = - std::shared_ptr(new GeomAPI_Curve(aShape)); + std::shared_ptr(new GeomAPI_Curve(aShape)); if (anEdge->isClosed()) { double aPeriod = aCurve->endParam() - aCurve->startParam(); @@ -204,7 +202,8 @@ gp_Vec getVector(ObjectPtr theShape, GeomDirPtr theDir, gp_Pnt theP) std::shared_ptr aCircEdge(new GeomAPI_Edge(aShape)); double aFirstParam, aLastParam; aCircEdge->getRange(aFirstParam, aLastParam); - // if parameter is near the LastParam, make the vector go inside (reverse) + // if parameter is near the LastParam, make the vector go inside + // (reverse) double aDelta = aLastParam - aParam; while (aDelta < -Precision::Confusion()) aDelta += aPeriod; @@ -231,9 +230,9 @@ gp_Vec getVector(ObjectPtr theShape, GeomDirPtr theDir, gp_Pnt theP) //***************************************************************** gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape, - const SketcherPrs_SymbolPrs* thePrs, - double theStep, GeomPointPtr thePnt) -{ + const SketcherPrs_SymbolPrs *thePrs, + double theStep, + GeomPointPtr thePnt) { std::shared_ptr aShape = SketcherPrs_Tools::getShape(theShape); gp_Pnt aP; // Central point @@ -242,7 +241,7 @@ gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape, } else { if (aShape->isEdge()) { std::shared_ptr aCurve = - std::shared_ptr(new GeomAPI_Curve(aShape)); + std::shared_ptr(new GeomAPI_Curve(aShape)); // this is a circle or arc double aMidParam = (aCurve->startParam() + aCurve->endParam()) / 2.; std::shared_ptr aPnt = aCurve->getPoint(aMidParam); @@ -250,7 +249,7 @@ gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape, } else { // This is a point std::shared_ptr aVertex = - std::shared_ptr(new GeomAPI_Vertex(aShape)); + std::shared_ptr(new GeomAPI_Vertex(aShape)); std::shared_ptr aPnt = aVertex->point(); aP = aPnt->impl(); } @@ -295,27 +294,29 @@ gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape, return aP; } - //***************************************************************** //! Returns curves connected to the given point -std::list getCurves(const GeomPointPtr& thePnt, const SketcherPrs_SymbolPrs* thePrs) -{ +std::list getCurves(const GeomPointPtr &thePnt, + const SketcherPrs_SymbolPrs *thePrs) { std::list aList; GeomAx3Ptr aAx3 = thePrs->plane(); - ModelAPI_CompositeFeature* aOwner = thePrs->sketcher(); - GeomPnt2dPtr aPnt2d = thePnt->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY()); + ModelAPI_CompositeFeature *aOwner = thePrs->sketcher(); + GeomPnt2dPtr aPnt2d = + thePnt->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY()); int aNbSubs = aOwner->numberOfSubs(); for (int i = 0; i < aNbSubs; i++) { FeaturePtr aFeature = aOwner->subFeature(i); if (!aFeature->firstResult().get() || aFeature->firstResult()->isDisabled()) - continue; // There is no result + continue; // There is no result if (aFeature->getKind() == SketchPlugin_Line::ID()) { - AttributePoint2DPtr aSPnt1 = std::dynamic_pointer_cast( - aFeature->data()->attribute(SketchPlugin_Line::START_ID())); - AttributePoint2DPtr aSPnt2 = std::dynamic_pointer_cast( - aFeature->data()->attribute(SketchPlugin_Line::END_ID())); + AttributePoint2DPtr aSPnt1 = + std::dynamic_pointer_cast( + aFeature->data()->attribute(SketchPlugin_Line::START_ID())); + AttributePoint2DPtr aSPnt2 = + std::dynamic_pointer_cast( + aFeature->data()->attribute(SketchPlugin_Line::END_ID())); GeomPnt2dPtr aPnt1 = aSPnt1->pnt(); GeomPnt2dPtr aPnt2 = aSPnt2->pnt(); @@ -323,8 +324,10 @@ std::list getCurves(const GeomPointPtr& thePnt, const SketcherPrs_Sym if (aPnt1->distance(aPnt2d) <= Precision::Confusion() || aPnt2->distance(aPnt2d) <= Precision::Confusion()) { // a point corresponds to one of the line end - GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult()); - GeomCurvePtr aCurv = std::shared_ptr(new GeomAPI_Curve(aShp)); + GeomShapePtr aShp = + SketcherPrs_Tools::getShape(aFeature->firstResult()); + GeomCurvePtr aCurv = + std::shared_ptr(new GeomAPI_Curve(aShp)); aList.push_back(aFeature->firstResult()); } else { // Check that a point belongs to the curve @@ -349,15 +352,14 @@ std::list getCurves(const GeomPointPtr& thePnt, const SketcherPrs_Sym if (aCurve.get()) { GeomPointPtr aProjPnt; if (aFeature->getKind() == SketchPlugin_Circle::ID() || - aFeature->getKind() == SketchPlugin_Arc::ID()) { + aFeature->getKind() == SketchPlugin_Arc::ID()) { GeomCirclePtr aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve)); aProjPnt = aCircle->project(thePnt); - } - else if (aFeature->getKind() == SketchPlugin_Ellipse::ID()) { - GeomEllipsePtr anEllipse = GeomEllipsePtr(new GeomAPI_Ellipse(aCurve)); + } else if (aFeature->getKind() == SketchPlugin_Ellipse::ID()) { + GeomEllipsePtr anEllipse = + GeomEllipsePtr(new GeomAPI_Ellipse(aCurve)); aProjPnt = anEllipse->project(thePnt); - } - else + } else aProjPnt = aCurve->project(thePnt); if (aProjPnt && thePnt->distance(aProjPnt) <= Precision::Confusion()) aList.push_back(aResObj); @@ -368,10 +370,10 @@ std::list getCurves(const GeomPointPtr& thePnt, const SketcherPrs_Sym } //***************************************************************** -gp_Pnt SketcherPrs_PositionMgr::getPointPosition( - ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs, - double theStep, GeomPointPtr thePnt) -{ +gp_Pnt +SketcherPrs_PositionMgr::getPointPosition(ObjectPtr theLine, + const SketcherPrs_SymbolPrs *thePrs, + double theStep, GeomPointPtr thePnt) { gp_Pnt aP = thePnt->impl(); if (!thePrs->plane().get()) return aP; @@ -387,17 +389,19 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( } // Position of the symbol - const std::array& aPos = getPositionIndex(thePnt, thePrs); + const std::array &aPos = getPositionIndex(thePnt, thePrs); // Angle size of a symbol - //double aAngleStep = PI * 50./180.; - double aAngleStep = PI/4.; + // double aAngleStep = PI * 50./180.; + double aAngleStep = PI / 4.; std::list::const_iterator aItVec; std::list aAngles; std::list aVectors; - // Select closest vectors and calculate angles between base vector and closest vector - for (aItVec = aVectorsList.cbegin(); aItVec != aVectorsList.cend(); aItVec++) { + // Select closest vectors and calculate angles between base vector and closest + // vector + for (aItVec = aVectorsList.cbegin(); aItVec != aVectorsList.cend(); + aItVec++) { std::list::const_iterator aIt; double aMinAng = 0; gp_Vec aVec = *aItVec; @@ -422,8 +426,8 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( gp_Ax1 aRotAx(aP, aNormDir); gp_Vec aVecPos; - // If number of angle less then number of symbols then each symbol can be placed - // directly inside of the angle + // If number of angle less then number of symbols then each symbol can be + // placed directly inside of the angle if ((int)aAngles.size() >= aPos[1] && !aVectors.empty()) { int aId = aPos[0]; aVecPos = *(std::next(aVectors.begin(), aId)); @@ -472,13 +476,13 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( } //***************************************************************** -void SketcherPrs_PositionMgr::deleteConstraint(const SketcherPrs_SymbolPrs* thePrs) -{ +void SketcherPrs_PositionMgr::deleteConstraint( + const SketcherPrs_SymbolPrs *thePrs) { std::map::iterator aIt; std::list aToDel; // Clear map for deleted presentation for (aIt = myShapes.begin(); aIt != myShapes.end(); ++aIt) { - PositionsMap& aPosMap = aIt->second; + PositionsMap &aPosMap = aIt->second; if (aPosMap.count(thePrs) > 0) { // Erase index aPosMap.erase(aPosMap.find(thePrs)); diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.h b/src/SketcherPrs/SketcherPrs_PositionMgr.h index 992a7cc97..d6f3490be 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.h +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_PositionMgr_H @@ -23,38 +24,42 @@ #include "SketcherPrs.h" #include "SketcherPrs_SymbolPrs.h" -#include #include -#include +#include #include +#include -#include #include +#include /** -* \ingroup GUI -* A class Position Manager which manages position of constraints symbols along a source object line. -* it expects that symbol icons have size 16x16 px -*/ -class SketcherPrs_PositionMgr -{ + * \ingroup GUI + * A class Position Manager which manages position of constraints symbols along + * a source object line. it expects that symbol icons have size 16x16 px + */ +class SketcherPrs_PositionMgr { public: /// Returns current instance of position manager - SKETCHERPRS_EXPORT static SketcherPrs_PositionMgr* get(); + SKETCHERPRS_EXPORT static SketcherPrs_PositionMgr *get(); /// Returns position of symbol for the given presentation /// \param theLine constrained object /// \param thePrs a presentation of constraint /// \param theStep step between symbols - SKETCHERPRS_EXPORT gp_Pnt getPosition(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs, - double theStep = 20, GeomPointPtr thePnt = GeomPointPtr()); + SKETCHERPRS_EXPORT gp_Pnt getPosition(ObjectPtr theLine, + const SketcherPrs_SymbolPrs *thePrs, + double theStep = 20, + GeomPointPtr thePnt = GeomPointPtr()); - /// Deletes constraint object from internal structures. Has to be called on constraint delete. - /// \param thePrs a constraint presentation - SKETCHERPRS_EXPORT void deleteConstraint(const SketcherPrs_SymbolPrs* thePrs); + /// Deletes constraint object from internal structures. Has to be called on + /// constraint delete. \param thePrs a constraint presentation + SKETCHERPRS_EXPORT void deleteConstraint(const SketcherPrs_SymbolPrs *thePrs); /// Cleares all stored positions for all constraints - void clearAll() { myShapes.clear(); myPntShapes.clear(); } + void clearAll() { + myShapes.clear(); + myPntShapes.clear(); + } private: /// Constructor @@ -63,27 +68,28 @@ private: /// Returns position index of the given constraint /// \param theLine constrained object /// \param thePrs a presentation of constraint - int getPositionIndex(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs); + int getPositionIndex(ObjectPtr theLine, const SketcherPrs_SymbolPrs *thePrs); /// Returns position index of the given constraint around a point /// \param theLine constrained object /// \param thePrs a presentation of constraint - const std::array& getPositionIndex(GeomPointPtr thePos, - const SketcherPrs_SymbolPrs* thePrs); + const std::array & + getPositionIndex(GeomPointPtr thePos, const SketcherPrs_SymbolPrs *thePrs); /// Returns position of a constraint around a point /// \param theLine a base object of the constraint /// \param thePrs a presentation of the constraint symbol /// \param theStep step from base point /// \param thePnt a base point - gp_Pnt getPointPosition(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs, - double theStep, GeomPointPtr thePnt); + gp_Pnt getPointPosition(ObjectPtr theLine, + const SketcherPrs_SymbolPrs *thePrs, double theStep, + GeomPointPtr thePnt); - static bool isPntConstraint(const std::string& theName); + static bool isPntConstraint(const std::string &theName); private: - typedef std::map PositionsMap; - typedef std::map> FeaturesMap; + typedef std::map PositionsMap; + typedef std::map> FeaturesMap; /// The map contains position index std::map myShapes; @@ -92,4 +98,4 @@ private: FeaturesMap myPntShapes; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index e656da498..503c22b16 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Radius.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_DimensionStyle.h" +#include "SketcherPrs_Tools.h" -#include -#include -#include #include +#include +#include +#include -#include -#include #include +#include #include +#include #include #include @@ -44,93 +45,91 @@ extern Handle(Prs3d_DimensionAspect) createDimensionAspect(); /// \param theDimValue an arrow value /// \param theTextSize an arrow value extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, - double theDimValue, double theTextSize, SketcherPrs_Tools::LocationType theLocationType); - + double theDimValue, double theTextSize, + SketcherPrs_Tools::LocationType theLocationType); -static const gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1); +static const gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 1); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, PrsDim_RadiusDimension); -SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) -: PrsDim_RadiusDimension(MyDefCirc), myConstraint(theConstraint), mySketcher(theSketcher), - myCircle(MyDefCirc), - myAnchorPoint(gp_Pnt(0, 0, 2)), - myValue(1, false, "") -{ +SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : PrsDim_RadiusDimension(MyDefCirc), myConstraint(theConstraint), + mySketcher(theSketcher), myCircle(MyDefCirc), + myAnchorPoint(gp_Pnt(0, 0, 2)), myValue(1, false, "") { SetDimensionAspect(createDimensionAspect()); myStyleListener = new SketcherPrs_DimensionStyle(); } -SketcherPrs_Radius::~SketcherPrs_Radius() -{ - delete myStyleListener; -} +SketcherPrs_Radius::~SketcherPrs_Radius() { delete myStyleListener; } -bool SketcherPrs_Radius::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Radius::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { gp_Circ aCircle; gp_Pnt anAnchorPoint; return readyToDisplay(theConstraint, thePlane, aCircle, anAnchorPoint); } -bool SketcherPrs_Radius::readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Circ& theCircle, gp_Pnt& theAnchorPoint) -{ +bool SketcherPrs_Radius::readyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, gp_Circ &theCircle, + gp_Pnt &theAnchorPoint) { bool aReadyToDisplay = false; DataPtr aData = theConstraint->data(); // Flyout point std::shared_ptr aFlyoutAttr = - std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); if (!aFlyoutAttr->isInitialized()) { return aReadyToDisplay; // can not create a good presentation } // Get circle std::shared_ptr anAttr = - std::dynamic_pointer_cast - (aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Constraint::ENTITY_A())); if (!anAttr) return aReadyToDisplay; - std::shared_ptr aCyrcFeature = ModelAPI_Feature::feature(anAttr->object()); - //theRadius = 1; + std::shared_ptr aCyrcFeature = + ModelAPI_Feature::feature(anAttr->object()); + // theRadius = 1; double aRadius = 1; std::shared_ptr aCenterAttr; - // it is possible that circle result becomes zero, in this case the presentation should disappear - // for example, it happens when circle radius is set to zero + // it is possible that circle result becomes zero, in this case the + // presentation should disappear for example, it happens when circle radius is + // set to zero if (!aCyrcFeature) return aReadyToDisplay; if (aCyrcFeature->getKind() == SketchPlugin_Circle::ID()) { // circle aCenterAttr = std::dynamic_pointer_cast( aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID())); AttributeDoublePtr aCircRadius = - std::dynamic_pointer_cast( - aCyrcFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID())); + std::dynamic_pointer_cast( + aCyrcFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID())); aRadius = aCircRadius->value(); } else { // arc aCenterAttr = std::dynamic_pointer_cast( aCyrcFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID())); - //std::shared_ptr aStartAttr = - // std::dynamic_pointer_cast - // (aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID())); - //theRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); + // std::shared_ptr aStartAttr = + // std::dynamic_pointer_cast + // (aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID())); + // theRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); AttributeDoublePtr aCircRadius = - std::dynamic_pointer_cast( - aCyrcFeature->data()->attribute(SketchPlugin_Arc::RADIUS_ID())); + std::dynamic_pointer_cast( + aCyrcFeature->data()->attribute(SketchPlugin_Arc::RADIUS_ID())); aRadius = aCircRadius->value(); } - std::shared_ptr aCenter = thePlane->to3D(aCenterAttr->x(), aCenterAttr->y()); + std::shared_ptr aCenter = + thePlane->to3D(aCenterAttr->x(), aCenterAttr->y()); std::shared_ptr aNormal = thePlane->normal(); GeomAPI_Circ aCircle(aCenter, aNormal, aRadius); std::shared_ptr anAnchor = - SketcherPrs_Tools::getAnchorPoint(theConstraint, thePlane); + SketcherPrs_Tools::getAnchorPoint(theConstraint, thePlane); theCircle = aCircle.impl(); theAnchorPoint = anAnchor->impl(); @@ -140,22 +139,24 @@ bool SketcherPrs_Radius::readyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -void SketcherPrs_Radius::Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) -{ +void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d) & + thePresentationManager, + const Handle(Prs3d_Presentation) & + thePresentation, + const Standard_Integer theMode) { if (!plane().get()) return; gp_Circ aCircle; gp_Pnt anAnchorPoint; - bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), aCircle, anAnchorPoint); + bool aReadyToDisplay = + readyToDisplay(myConstraint, plane(), aCircle, anAnchorPoint); if (aReadyToDisplay) { myCircle = aCircle; myAnchorPoint = anAnchorPoint; DataPtr aData = myConstraint->data(); - AttributeDoublePtr anAttributeValue = aData->real(SketchPlugin_Constraint::VALUE()); + AttributeDoublePtr anAttributeValue = + aData->real(SketchPlugin_Constraint::VALUE()); myValue.init(anAttributeValue); } @@ -166,22 +167,27 @@ void SketcherPrs_Radius::Compute( double aTextSize = 0.0; GetValueString(aTextSize); - AttributeIntegerPtr aLocAttr = std::dynamic_pointer_cast - (myConstraint->data()->attribute(SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID())); - SketcherPrs_Tools::LocationType aLocationType = aLocAttr->isInitialized() ? - (SketcherPrs_Tools::LocationType)(aLocAttr->value()) : SketcherPrs_Tools::LOCATION_AUTOMATIC; + AttributeIntegerPtr aLocAttr = + std::dynamic_pointer_cast( + myConstraint->data()->attribute( + SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID())); + SketcherPrs_Tools::LocationType aLocationType = + aLocAttr->isInitialized() + ? (SketcherPrs_Tools::LocationType)(aLocAttr->value()) + : SketcherPrs_Tools::LOCATION_AUTOMATIC; updateArrows(DimensionAspect(), GetValue(), aTextSize, aLocationType); - PrsDim_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode); + PrsDim_RadiusDimension::Compute(thePresentationManager, thePresentation, + theMode); if (!aReadyToDisplay) - SketcherPrs_Tools::sendEmptyPresentationError(myConstraint, - "An empty AIS presentation: SketcherPrs_Radius"); + SketcherPrs_Tools::sendEmptyPresentationError( + myConstraint, "An empty AIS presentation: SketcherPrs_Radius"); } -void SketcherPrs_Radius::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) -{ +void SketcherPrs_Radius::ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer theMode) { // Map the application selection modes to standard ones Standard_Integer aMode; switch (theMode) { @@ -203,6 +209,6 @@ void SketcherPrs_Radius::ComputeSelection(const Handle(SelectMgr_Selection)& aSe return; } } - SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize()/5.); + SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize() / 5.); PrsDim_RadiusDimension::ComputeSelection(aSelection, aMode); } diff --git a/src/SketcherPrs/SketcherPrs_Radius.h b/src/SketcherPrs/SketcherPrs_Radius.h index 02cf11d83..ca3561497 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.h +++ b/src/SketcherPrs/SketcherPrs_Radius.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Radius_H @@ -32,17 +33,16 @@ DEFINE_STANDARD_HANDLE(SketcherPrs_Radius, PrsDim_RadiusDimension) /** -* \ingroup GUI -* A class for representation of radius constraint -*/ -class SketcherPrs_Radius : public PrsDim_RadiusDimension -{ + * \ingroup GUI + * A class for representation of radius constraint + */ +class SketcherPrs_Radius : public PrsDim_RadiusDimension { public: /// Constructor /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch - Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); /// Destructor Standard_EXPORT ~SketcherPrs_Radius(); @@ -54,12 +54,11 @@ public: /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); /// Returns sketcher plane - Standard_EXPORT std::shared_ptr plane() const - { + Standard_EXPORT std::shared_ptr plane() const { return mySketcher->coordinatePlane(); } @@ -70,34 +69,39 @@ private: /// \param theCircle a circle build on the constraint values /// \param thePoint an anchor point to show text value /// \return boolean result value - static bool readyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane, - gp_Circ& theCircle, gp_Pnt& theAnchorPoint); + static bool readyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane, + gp_Circ &theCircle, gp_Pnt &theAnchorPoint); + protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode); + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer aMode); private: /// Constraint feature - ModelAPI_Feature* myConstraint; + ModelAPI_Feature *myConstraint; /// A current sketcher - SketchPlugin_Sketch* mySketcher; + SketchPlugin_Sketch *mySketcher; /// Listener to update dimension visualization style - SketcherPrs_DimensionStyle* myStyleListener; + SketcherPrs_DimensionStyle *myStyleListener; - /// container of values obtained from the constraint, which are necessary to fill the presentation - gp_Circ myCircle; ///< the radius circle + /// container of values obtained from the constraint, which are necessary to + /// fill the presentation + gp_Circ myCircle; ///< the radius circle gp_Pnt myAnchorPoint; ///< an ancor for the radius value visualization - SketcherPrs_DimensionStyle::DimensionValue myValue; /// the structure filled by constraint + SketcherPrs_DimensionStyle::DimensionValue + myValue; /// the structure filled by constraint }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index fafd0830e..2c89b5755 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Rigid.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" -#include -#include #include +#include +#include #include #include @@ -35,88 +36,82 @@ #include #include -#include #include +#include +#include #include #include -#include - - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Rigid, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; +SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} - -SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} - -bool SketcherPrs_Rigid::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Rigid::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (!thePlane) return aReadyToDisplay; std::shared_ptr aData = theConstraint->data(); std::shared_ptr anAttr = - aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); AttributePtr aRefAttr = anAttr->attr(); if (anAttr->isObject()) { // The constraint attached to an object ObjectPtr aObj = anAttr->object(); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL; } else { // The constraint attached to a point - std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theConstraint, - SketchPlugin_Constraint::ENTITY_A()); + std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); aReadyToDisplay = aPnt.get() != NULL; } return aReadyToDisplay; } -bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); std::shared_ptr aData = myConstraint->data(); std::shared_ptr anAttr = - aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); AttributePtr aRefAttr = anAttr->attr(); if (anAttr->isObject()) { // The constraint attached to an object ObjectPtr aObj = anAttr->object(); - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->AddVertex(aP1); } else { // The constraint attached to a point - std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(myConstraint, - SketchPlugin_Constraint::ENTITY_A()); - std::shared_ptr aPoint = plane()->to3D(aPnt->x(), aPnt->y() + theStep); + std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + std::shared_ptr aPoint = + plane()->to3D(aPnt->x(), aPnt->y() + theStep); myPntArray->AddVertex(aPoint->impl()); } return true; } - -void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ - ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); +void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { + ObjectPtr aObj = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); FeaturePtr aFeature = std::dynamic_pointer_cast(aObj); std::shared_ptr aShape; if (aFeature.get()) { // If constraint attached to a feature - const std::list& aResults = aFeature->results(); + const std::list &aResults = aFeature->results(); std::list::const_iterator aIt; // Find a shape for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { @@ -131,8 +126,8 @@ void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs, if (aShape.get() == NULL) return; - Handle(Prs3d_PointAspect) aPntAspect = new Prs3d_PointAspect(Aspect_TOM_PLUS, theColor, 1); + Handle(Prs3d_PointAspect) aPntAspect = + new Prs3d_PointAspect(Aspect_TOM_PLUS, theColor, 1); myDrawer->SetPointAspect(aPntAspect); drawShape(aShape, thePrs, theColor); } - diff --git a/src/SketcherPrs/SketcherPrs_Rigid.h b/src/SketcherPrs/SketcherPrs_Rigid.h index 81b933060..39197111a 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.h +++ b/src/SketcherPrs/SketcherPrs_Rigid.h @@ -14,54 +14,52 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Rigid_H #define SketcherPrs_Rigid_H #include "SketcherPrs_SymbolPrs.h" -#include #include - +#include DEFINE_STANDARD_HANDLE(SketcherPrs_Rigid, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of parallel constraint -*/ -class SketcherPrs_Rigid: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of parallel constraint + */ +class SketcherPrs_Rigid : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); - + Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Rigid, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); + protected: - virtual const char* iconName() const { return "anchor.png"; } + virtual const char *iconName() const { return "anchor.png"; } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; - }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index a2f70b45d..a144ef7a6 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_SensitivePoint.h" @@ -25,77 +26,73 @@ #define DEBUG_SENSITIVE_TO_BE_CORRECTED -IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); +IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, + Select3D_SensitiveEntity); SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint( - const Handle(SelectBasics_EntityOwner)& anOwner, int theId) -:Select3D_SensitiveEntity(anOwner), myId(theId) -{ + const Handle(SelectBasics_EntityOwner) & anOwner, int theId) + : Select3D_SensitiveEntity(anOwner), myId(theId) { SetSensitivityFactor(12); } -Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr, - SelectBasics_PickResult& thePickResult) -{ +Standard_Boolean +SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager &theMgr, + SelectBasics_PickResult &thePickResult) { #if OCC_VERSION_HEX < 0x070400 - Standard_Real aDepth = RealLast(); - Standard_Real aDistToCOG = RealLast(); - gp_Pnt aPnt = Point(); - if (!theMgr.Overlaps(aPnt, aDepth)) - { - thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG); - return Standard_False; - } + Standard_Real aDepth = RealLast(); + Standard_Real aDistToCOG = RealLast(); + gp_Pnt aPnt = Point(); + if (!theMgr.Overlaps(aPnt, aDepth)) { + thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG); + return Standard_False; + } - aDistToCOG = aDepth; - thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG); - return Standard_True; + aDistToCOG = aDepth; + thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG); + return Standard_True; #else gp_Pnt aPnt = Point(); - if (theMgr.Overlaps (aPnt, thePickResult)) - return Standard_True; + if (theMgr.Overlaps(aPnt, thePickResult)) + return Standard_True; return Standard_False; #endif } -gp_Pnt SketcherPrs_SensitivePoint::Point() const -{ - const Handle(SelectMgr_EntityOwner)& anOwner = OwnerId(); - const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = - Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); +gp_Pnt SketcherPrs_SensitivePoint::Point() const { + const Handle(SelectMgr_EntityOwner) &anOwner = OwnerId(); + const Handle(SketcherPrs_SymbolPrs) &aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); return aSymbPrs->pointsArray()->Vertice(myId); } -Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected() -{ - Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myId); +Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected() { + Handle(SketcherPrs_SensitivePoint) aNewEntity = + new SketcherPrs_SensitivePoint(myOwnerId, myId); return aNewEntity; } -gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const -{ +gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const { #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED - const Handle(SelectMgr_EntityOwner)& anOwner = OwnerId(); - const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = - Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + const Handle(SelectMgr_EntityOwner) &anOwner = OwnerId(); + const Handle(SketcherPrs_SymbolPrs) &aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); if (aSymbPrs->pointsArray()->VertexNumber() < myId) return gp_Pnt(); #endif return Point(); } -Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox() -{ +Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox() { #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED - const Handle(SelectMgr_EntityOwner)& anOwner = OwnerId(); - const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = - Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + const Handle(SelectMgr_EntityOwner) &anOwner = OwnerId(); + const Handle(SketcherPrs_SymbolPrs) &aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); if (aSymbPrs->pointsArray()->VertexNumber() < myId) return Select3D_BndBox3d(); #endif gp_Pnt aPnt = Point(); - return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()), - SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z())); + return Select3D_BndBox3d(SelectMgr_Vec3(aPnt.X(), aPnt.Y(), aPnt.Z()), + SelectMgr_Vec3(aPnt.X(), aPnt.Y(), aPnt.Z())); } #if OCC_VERSION_HEX > 0x070400 @@ -107,7 +104,4 @@ Standard_Integer SketcherPrs_SensitivePoint::NbSubElements() return 1; } -void SketcherPrs_SensitivePoint::Clear() -{ - return; -} +void SketcherPrs_SensitivePoint::Clear() { return; } diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.h b/src/SketcherPrs/SketcherPrs_SensitivePoint.h index 88608073e..3b67a88ef 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.h +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.h @@ -14,48 +14,52 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_SensitivePoint_H #define SketcherPrs_SensitivePoint_H -#include #include +#include #include #include - DEFINE_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity) /** -* \ingroup GUI -* This sensitive point is done in order to optimize process of the sinzitive area update -* It referes on point array directly and this lets to avoid procedure of the point synchronisation -*/ -class SketcherPrs_SensitivePoint : public Select3D_SensitiveEntity -{ + * \ingroup GUI + * This sensitive point is done in order to optimize process of the sinzitive + * area update It referes on point array directly and this lets to avoid + * procedure of the point synchronisation + */ +class SketcherPrs_SensitivePoint : public Select3D_SensitiveEntity { public: //! Constructs a sensitive point object defined by the //! \param OwnerId an Id of the Owner. //! \param theId and Id of its point - Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId, - int theId); + Standard_EXPORT + SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner) & OwnerId, + int theId); /// Returns number of sub-elements #if OCC_VERSION_HEX > 0x070400 - Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE; + Standard_EXPORT virtual Standard_Integer + NbSubElements() const Standard_OVERRIDE; #else Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; #endif //! Update location of the point - Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE; + Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) + GetConnected() Standard_OVERRIDE; //! Checks whether the point overlaps current selecting volume //! \param theMgr selection manager //! \param thePickResult returns pick result - Standard_EXPORT virtual Standard_Boolean Matches(SelectBasics_SelectingVolumeManager& theMgr, - SelectBasics_PickResult& thePickResult) Standard_OVERRIDE; + Standard_EXPORT virtual Standard_Boolean + Matches(SelectBasics_SelectingVolumeManager &theMgr, + SelectBasics_PickResult &thePickResult) Standard_OVERRIDE; //! Returns the point used at the time of construction. Standard_EXPORT gp_Pnt Point() const; @@ -77,5 +81,4 @@ private: int myId; }; - -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 0d156d22b..07d957522 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_SymbolPrs.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" +#include #include #include -#include #include @@ -32,49 +33,49 @@ #include #include -#include -#include -#include #include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include #include #include -#include -#include +#include +#include +#include #include #include -#include -#include #include +#include #ifdef WIN32 -# define FSEP "\\" +#define FSEP "\\" #else -# define FSEP "/" +#define FSEP "/" #endif /// Step between icons static const double MyDist = 0.015; - //************************************************************** //! Redefinition of OpenGl_Element -class SketcherPrs_SymbolArray: public OpenGl_PrimitiveArray -{ +class SketcherPrs_SymbolArray : public OpenGl_PrimitiveArray { public: - SketcherPrs_SymbolArray(const OpenGl_GraphicDriver* theDriver, - const Handle(SketcherPrs_SymbolPrs)& theObj, const Handle(AIS_InteractiveContext)& theCtx) - :OpenGl_PrimitiveArray(theDriver, theObj->myPntArray->Type(), theObj->myPntArray->Indices(), - theObj->myPntArray->Attributes(), theObj->myPntArray->Bounds()), myObj(theObj), - myContext(theCtx) {} - - virtual void Render(const Handle(OpenGl_Workspace)& theWorkspace) const - { - ModelAPI_Feature* aConstraint = myObj->feature(); + SketcherPrs_SymbolArray(const OpenGl_GraphicDriver *theDriver, + const Handle(SketcherPrs_SymbolPrs) & theObj, + const Handle(AIS_InteractiveContext) & theCtx) + : OpenGl_PrimitiveArray(theDriver, theObj->myPntArray->Type(), + theObj->myPntArray->Indices(), + theObj->myPntArray->Attributes(), + theObj->myPntArray->Bounds()), + myObj(theObj), myContext(theCtx) {} + + virtual void Render(const Handle(OpenGl_Workspace) & theWorkspace) const { + ModelAPI_Feature *aConstraint = myObj->feature(); if (aConstraint->data().get() && aConstraint->data()->isValid()) { Handle(OpenGl_View) aView = theWorkspace->View(); double aScale = aView->Camera()->Scale(); @@ -82,10 +83,10 @@ public: myObj->updateIfReadyToDisplay(MyDist * aScale, myObj->myIsCustomColor); if (myIsVboInit) { if (myVboAttribs) { - const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); + const Handle(OpenGl_Context) &aCtx = theWorkspace->GetGlContext(); Handle(Graphic3d_Buffer) aAttr = myObj->myPntArray->Attributes(); - myVboAttribs->init(aCtx, 0, aAttr->NbElements, - aAttr->Data(), GL_NONE, aAttr->Stride); + myVboAttribs->init(aCtx, 0, aAttr->NbElements, aAttr->Data(), GL_NONE, + aAttr->Stride); } else myIsVboInit = false; } else { @@ -98,9 +99,9 @@ public: // Update selection position only if there is no selected object // because it can corrupt selection of other objects - if (myContext->NbSelected() == 0) { + if (myContext->NbSelected() == 0) { myContext->MainSelector()->RebuildSensitivesTree(myObj); - myContext->MainSelector()->RebuildObjectsTree (false); + myContext->MainSelector()->RebuildObjectsTree(false); } } @@ -109,41 +110,35 @@ private: Handle(AIS_InteractiveContext) myContext; }; - //***************************************************************************** IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject); +std::map + SketcherPrs_SymbolPrs::myIconsMap; -std::map SketcherPrs_SymbolPrs::myIconsMap; - - -SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : AIS_InteractiveObject(), - myConstraint(theConstraint), - mySketcher(theSketcher), - myIsCustomColor(false) -{ +SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : AIS_InteractiveObject(), myConstraint(theConstraint), + mySketcher(theSketcher), myIsCustomColor(false) { SetAutoHilight(Standard_False); } //********************************************************************************* -SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs() -{ - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); +SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs() { + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); // Empty memory in position manager aMgr->deleteConstraint(this); Handle(Prs3d_Presentation) aSelPrs = - GetSelectPresentation(Handle(PrsMgr_PresentationManager3d)()); + GetSelectPresentation(Handle(PrsMgr_PresentationManager3d)()); if (!aSelPrs.IsNull()) { - if (!aSelPrs->Groups().IsEmpty()) { - aSelPrs->Clear(); - } - aSelPrs->Erase(); + if (!aSelPrs->Groups().IsEmpty()) { + aSelPrs->Clear(); + } + aSelPrs->Erase(); } Handle(Prs3d_Presentation) aHilightPrs = - GetHilightPresentation(Handle(PrsMgr_PresentationManager3d)()); + GetHilightPresentation(Handle(PrsMgr_PresentationManager3d)()); if (!aHilightPrs.IsNull()) { if (!aHilightPrs->Groups().IsEmpty()) { aHilightPrs->Clear(); @@ -153,21 +148,20 @@ SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs() } #ifdef _WINDOWS -#pragma warning( disable : 4996 ) +#pragma warning(disable : 4996) #endif //********************************************************************************* -Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() -{ +Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() { if (myIconsMap.count(iconName()) == 1) { return myIconsMap[iconName()]; } // Load icon for the presentation std::string aFile; - char* anEnv = getenv("SHAPER_ROOT_DIR"); + char *anEnv = getenv("SHAPER_ROOT_DIR"); if (anEnv) { - aFile = std::string(anEnv) + - FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; + aFile = std::string(anEnv) + FSEP + "share" + FSEP + "salome" + FSEP + + "resources" + FSEP + "shaper"; } else { anEnv = getenv("CADBUILDER_ROOT_DIR"); if (anEnv) @@ -186,7 +180,8 @@ Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() aSizedMap->InitTrash(aPixMap->Format(), aWidth, aHeigh); for (Standard_Size i = 0; i < aWidth; i++) { for (Standard_Size j = 0; j < aHeigh; j++) { - aSizedMap->SetPixelColor(int(i), int(j), + aSizedMap->SetPixelColor( + int(i), int(j), aPixMap->PixelColor(int(i / aRatio), int(j / aRatio))); } } @@ -197,15 +192,14 @@ Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() } // The icon for constraint is not found static const char aMsg[] = "Error! constraint images are not found"; - std::cout< aLine = SketcherPrs_Tools::getShape(aObj); if (aLine.get() == NULL) return; - std::shared_ptr aEdge = std::shared_ptr(new GeomAPI_Edge(aLine)); + std::shared_ptr aEdge = + std::shared_ptr(new GeomAPI_Edge(aLine)); std::shared_ptr aPnt1 = aEdge->firstPoint(); std::shared_ptr aPnt2 = aEdge->lastPoint(); // Draw line by two points - Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments(2, 1); + Handle(Graphic3d_ArrayOfSegments) aLines = + new Graphic3d_ArrayOfSegments(2, 1); aLines->AddVertex(aPnt1->impl()); aLines->AddVertex(aPnt2->impl()); theGroup->AddPrimitiveArray(aLines); } //********************************************************************************* -void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, - const SelectMgr_SequenceOfOwner& /*theOwners*/) -{ - Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM ); +void SketcherPrs_SymbolPrs::HilightSelected( + const Handle(PrsMgr_PresentationManager3d) & thePM, + const SelectMgr_SequenceOfOwner & /*theOwners*/) { + Handle(Prs3d_Presentation) aSelectionPrs = GetSelectPresentation(thePM); aSelectionPrs->Clear(); drawLines(aSelectionPrs, GetContext()->SelectionStyle()->Color()); @@ -253,13 +248,12 @@ void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationMana //********************************************************************************* void SketcherPrs_SymbolPrs::HilightOwnerWithColor( - const Handle(PrsMgr_PresentationManager3d)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& /*theOwner*/) -{ + const Handle(PrsMgr_PresentationManager3d) & thePM, + const Handle(Prs3d_Drawer) & theStyle, const Handle(SelectMgr_EntityOwner) & + /*theOwner*/) { thePM->Color(this, theStyle); - Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM ); + Handle(Prs3d_Presentation) aHilightPrs = GetHilightPresentation(thePM); aHilightPrs->Clear(); drawLines(aHilightPrs, theStyle->Color()); aHilightPrs->SetZLayer(Graphic3d_ZLayerId_Topmost); @@ -270,10 +264,9 @@ void SketcherPrs_SymbolPrs::HilightOwnerWithColor( //********************************************************************************* void SketcherPrs_SymbolPrs::Compute( - const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer /*theMode*/) -{ + const Handle(PrsMgr_PresentationManager3d) & /*thePresentationManager*/, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer /*theMode*/) { if (!plane().get()) return; // Create an icon @@ -281,13 +274,13 @@ void SketcherPrs_SymbolPrs::Compute( Handle(AIS_InteractiveContext) aCtx = GetContext(); Handle(OpenGl_GraphicDriver) aDriver = - Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver()); + Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver()); if (aDriver.IsNull()) return; // Update points with default shift value - // it updates array of points if the presentation is ready to display, or the array of points - // contains the previous values + // it updates array of points if the presentation is ready to display, or the + // array of points contains the previous values bool aReadyToDisplay = updateIfReadyToDisplay(20, myIsCustomColor); @@ -299,43 +292,44 @@ void SketcherPrs_SymbolPrs::Compute( // Create sensitive point for each symbol mySPoints.Clear(); for (int i = 1; i <= aNbVertex; i++) { - Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, i); + Handle(SketcherPrs_SensitivePoint) aSP = + new SketcherPrs_SensitivePoint(myOwner, i); mySPoints.Append(aSP); if (myIsCustomColor) myPntArray->SetVertexColor(i, myCustomColor); } Handle(OpenGl_Group) aGroup = - Handle(OpenGl_Group)::DownCast(Prs3d_Root::CurrentGroup (thePresentation)); + Handle(OpenGl_Group)::DownCast(Prs3d_Root::CurrentGroup(thePresentation)); aGroup->SetPrimitivesAspect(myAspect); // Recompute boundary box of the group - Graphic3d_BndBox4f& aBnd = aGroup->ChangeBoundingBox(); + Graphic3d_BndBox4f &aBnd = aGroup->ChangeBoundingBox(); gp_Pnt aVert; aBnd.Clear(); for (int i = 1; i <= myPntArray->ItemNumber(); i++) { aVert = myPntArray->Vertice(i); - aBnd.Add(Graphic3d_Vec4((float)aVert.X(), (float)aVert.Y(), (float)aVert.Z(), 1.0f)); + aBnd.Add(Graphic3d_Vec4((float)aVert.X(), (float)aVert.Y(), + (float)aVert.Z(), 1.0f)); } // Pint the group with custom procedure (see Render) - SketcherPrs_SymbolArray* aElem = - new SketcherPrs_SymbolArray((OpenGl_GraphicDriver*)aDriver->This(), this, GetContext()); + SketcherPrs_SymbolArray *aElem = new SketcherPrs_SymbolArray( + (OpenGl_GraphicDriver *)aDriver->This(), this, GetContext()); aGroup->AddElement(aElem); // Disable frustum culling for this object by marking it as mutable aGroup->Structure()->SetMutable(true); if (!aReadyToDisplay) - SketcherPrs_Tools::sendEmptyPresentationError(myConstraint, - "An empty AIS presentation: SketcherPrs_LengthDimension"); + SketcherPrs_Tools::sendEmptyPresentationError( + myConstraint, "An empty AIS presentation: SketcherPrs_LengthDimension"); } - //********************************************************************************* -void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) -{ +void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer aMode) { ClearSelected(); if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) { for (int i = 1; i <= mySPoints.Length(); i++) @@ -344,38 +338,36 @@ void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& } //********************************************************************************* -void SketcherPrs_SymbolPrs::SetCustomColor(const std::vector& theColor) -{ +void SketcherPrs_SymbolPrs::SetCustomColor(const std::vector &theColor) { myIsCustomColor = !theColor.empty(); if (myIsCustomColor) myCustomColor = Quantity_Color(theColor[0] / 255., theColor[1] / 255., theColor[2] / 255., Quantity_TOC_RGB); else - myCustomColor = Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB); + myCustomColor = Quantity_Color(1.0, 1.0, 0.0, Quantity_TOC_RGB); if (!myAspect.IsNull()) - myAspect->SetColor (myCustomColor); + myAspect->SetColor(myCustomColor); Handle(Prs3d_Presentation) aPrs = Presentation(); if (!aPrs.IsNull()) { if (myIsCustomColor) { - Handle(Graphic3d_PresentationAttributes) aAttr = new Graphic3d_PresentationAttributes(); + Handle(Graphic3d_PresentationAttributes) aAttr = + new Graphic3d_PresentationAttributes(); aAttr->SetColor(myCustomColor); aPrs->Highlight(aAttr); - } - else { + } else { aPrs->UnHighlight(); } } } //********************************************************************************* -void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr& theShape, - const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_SymbolPrs::drawShape( + const std::shared_ptr &theShape, + const Handle(Prs3d_Presentation) & thePrs, Quantity_Color theColor) const { Handle(Graphic3d_AspectLine3d) aLineAspect = - new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); Handle(Prs3d_LineAspect) aLinesStyle = myDrawer->LineAspect(); Handle(Graphic3d_AspectLine3d) aOldStyle = aLinesStyle->Aspect(); @@ -385,24 +377,25 @@ void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr& theS if (theShape->isEdge()) { // The shape is edge std::shared_ptr aCurve = - std::shared_ptr(new GeomAPI_Curve(theShape)); + std::shared_ptr(new GeomAPI_Curve(theShape)); if (aCurve->isLine()) { // The shape is line - GeomAdaptor_Curve - aCurv(aCurve->impl(), aCurve->startParam(), aCurve->endParam()); + GeomAdaptor_Curve aCurv(aCurve->impl(), + aCurve->startParam(), aCurve->endParam()); StdPrs_Curve::Add(thePrs, aCurv, myDrawer); } else { // The shape is circle or arc - GeomAdaptor_Curve - aAdaptor(aCurve->impl(), aCurve->startParam(), aCurve->endParam()); - StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer); + GeomAdaptor_Curve aAdaptor(aCurve->impl(), + aCurve->startParam(), aCurve->endParam()); + StdPrs_DeflectionCurve::Add(thePrs, aAdaptor, myDrawer); } } else if (theShape->isVertex()) { // draw vertex std::shared_ptr aVertex = - std::shared_ptr(new GeomAPI_Vertex(theShape)); + std::shared_ptr(new GeomAPI_Vertex(theShape)); std::shared_ptr aPnt = aVertex->point(); - Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); + Handle(Geom_CartesianPoint) aPoint = + new Geom_CartesianPoint(aPnt->impl()); StdPrs_Point::Add(thePrs, aPoint, myDrawer); } @@ -412,9 +405,8 @@ void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr& theS //********************************************************************************* void SketcherPrs_SymbolPrs::drawListOfShapes( - const std::shared_ptr& theListAttr, - const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const -{ + const std::shared_ptr &theListAttr, + const Handle(Prs3d_Presentation) & thePrs, Quantity_Color theColor) const { int aNb = theListAttr->size(); if (aNb == 0) return; @@ -429,14 +421,15 @@ void SketcherPrs_SymbolPrs::drawListOfShapes( } //********************************************************************************* -void SketcherPrs_SymbolPrs::BoundingBox(Bnd_Box& theBndBox) -{ +void SketcherPrs_SymbolPrs::BoundingBox(Bnd_Box &theBndBox) { Select3D_BndBox3d aTmpBox; - for (Select3D_EntitySequenceIter aPntIter (mySPoints); aPntIter.More(); aPntIter.Next()) { - const Handle(Select3D_SensitiveEntity)& anEnt = aPntIter.Value(); - aTmpBox.Combine (anEnt->BoundingBox()); + for (Select3D_EntitySequenceIter aPntIter(mySPoints); aPntIter.More(); + aPntIter.Next()) { + const Handle(Select3D_SensitiveEntity) &anEnt = aPntIter.Value(); + aTmpBox.Combine(anEnt->BoundingBox()); } - theBndBox.Update (aTmpBox.CornerMin().x(), aTmpBox.CornerMin().y(), aTmpBox.CornerMin().z(), - aTmpBox.CornerMax().x(), aTmpBox.CornerMax().y(), aTmpBox.CornerMax().z()); + theBndBox.Update(aTmpBox.CornerMin().x(), aTmpBox.CornerMin().y(), + aTmpBox.CornerMin().z(), aTmpBox.CornerMax().x(), + aTmpBox.CornerMax().y(), aTmpBox.CornerMax().z()); } diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index d83d931a8..3321e81e1 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_SymbolPrs_H #define SketcherPrs_SymbolPrs_H #include "SketcherPrs_SensitivePoint.h" -#include -#include #include +#include +#include #include #include #include #include #include -#include #include +#include #include #include @@ -40,76 +41,81 @@ class OpenGl_Context; - DEFINE_STANDARD_HANDLE(SketcherPrs_SymbolPrs, AIS_InteractiveObject) class SketcherPrs_SymbolArray; /** -* \ingroup GUI -* A base class of constraint presentation which is represented by an icon -*/ -class SketcherPrs_SymbolPrs: public AIS_InteractiveObject -{ + * \ingroup GUI + * A base class of constraint presentation which is represented by an icon + */ +class SketcherPrs_SymbolPrs : public AIS_InteractiveObject { public: /// Constructor /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch - Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); virtual ~SketcherPrs_SymbolPrs(); //! Method which draws selected owners ( for fast presentation draw ) - Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, - const SelectMgr_SequenceOfOwner& theOwners); + Standard_EXPORT virtual void + HilightSelected(const Handle(PrsMgr_PresentationManager3d) & thePM, + const SelectMgr_SequenceOfOwner &theOwners); //! Method which hilight an owner belonging to - Standard_EXPORT virtual void HilightOwnerWithColor( - const Handle(PrsMgr_PresentationManager3d)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& theOwner); + Standard_EXPORT virtual void + HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) & thePM, + const Handle(Prs3d_Drawer) & theStyle, + const Handle(SelectMgr_EntityOwner) & theOwner); /// Returns sketcher plane - Standard_EXPORT std::shared_ptr plane() const - { + Standard_EXPORT std::shared_ptr plane() const { return mySketcher->coordinatePlane(); } /// Returns feature object - Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; } + Standard_EXPORT ModelAPI_Feature *feature() const { return myConstraint; } /// Returns Sketcher object (owner of the constraint) - Standard_EXPORT ModelAPI_CompositeFeature* sketcher() const { return mySketcher; } + Standard_EXPORT ModelAPI_CompositeFeature *sketcher() const { + return mySketcher; + } /// Return array of points where symbols will be placed - const Handle(Graphic3d_ArrayOfPoints)& pointsArray() const { return myPntArray; } + const Handle(Graphic3d_ArrayOfPoints) & pointsArray() const { + return myPntArray; + } - /// Set state of the presentation, in case of conflicting state, the icon of the presentation is - /// visualized in error color. The state is stored in an internal field, so should be changed - /// when constraint become not conflicting - /// \param theColor a color for conflicting object - Standard_EXPORT void SetCustomColor(const std::vector& theColor); + /// Set state of the presentation, in case of conflicting state, the icon of + /// the presentation is visualized in error color. The state is stored in an + /// internal field, so should be changed when constraint become not + /// conflicting \param theColor a color for conflicting object + Standard_EXPORT void SetCustomColor(const std::vector &theColor); /// Add a bounding box of the presentation to common bounding box /// \param theBndBox the common bounding box to update - Standard_EXPORT virtual void BoundingBox (Bnd_Box& theBndBox) Standard_OVERRIDE; + Standard_EXPORT virtual void + BoundingBox(Bnd_Box &theBndBox) Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute( - const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + Standard_EXPORT virtual void + Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, + const Handle(Prs3d_Presentation) & thePresentation, + const Standard_Integer theMode = 0); /// Redefinition of virtual function /// \param aSelection selection /// \param aMode compute mode - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode); + Standard_EXPORT virtual void + ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, + const Standard_Integer aMode); /// Returns an icon file name. Has to be redefined in successors - virtual const char* iconName() const = 0; + virtual const char *iconName() const = 0; /// Check and creates if it is necessary myAspect member. /// It has to be called before the object computation @@ -121,36 +127,42 @@ protected: /// Add a line into the given group /// \param theGroup a group for drawing /// \param theAttrName an attribute name which corresponds to referenced line - void addLine(const Handle(Graphic3d_Group)& theGroup, std::string theAttrName) const; + void addLine(const Handle(Graphic3d_Group) & theGroup, + std::string theAttrName) const; /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation)& /*thePrs*/, + virtual void drawLines(const Handle(Prs3d_Presentation) & /*thePrs*/, Quantity_Color /*theColor*/) const {} /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double /*theStep*/, bool /*withColor*/) const { return true; } + virtual bool updateIfReadyToDisplay(double /*theStep*/, + bool /*withColor*/) const { + return true; + } /// Draw a shape into the given presentation scene /// \param theShape the shape to draw /// \param thePrs the presentation scene - void drawShape(const std::shared_ptr& theShape, - const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + void drawShape(const std::shared_ptr &theShape, + const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Draw a list of shapes stored in a RefListAttribute /// \param theListAttr the attribute of reference3s list /// \param thePrs the presentation scene - void drawListOfShapes(const std::shared_ptr& theListAttr, - const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + void drawListOfShapes( + const std::shared_ptr &theListAttr, + const Handle(Prs3d_Presentation) & thePrs, Quantity_Color theColor) const; protected: /// Constraint feature - ModelAPI_Feature* myConstraint; + ModelAPI_Feature *myConstraint; /// Sketcher feature - SketchPlugin_Sketch* mySketcher; + SketchPlugin_Sketch *mySketcher; /// Aspect for entities drawing Handle(Graphic3d_AspectMarker3d) myAspect; @@ -163,18 +175,20 @@ protected: private: /// Static map to collect constraints icons {IconName : IconPixMap} - static std::map myIconsMap; + static std::map myIconsMap; Select3D_EntitySequence mySPoints; - bool myIsCustomColor; /// state if the presentation is visualized in custom color + bool myIsCustomColor; /// state if the presentation is visualized in custom + /// color Quantity_Color myCustomColor; /// the color of mid ring if there is a conflict - //bool myIsConflicting; /// state if the presentation is visualized in error state + // bool myIsConflicting; /// state if the presentation is visualized in error + // state Handle(Image_AlienPixMap) myErrorIcon; Handle(Graphic3d_MarkerImage) myErrorImage; friend class SketcherPrs_SymbolArray; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index bc20aae05..dfdd13594 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -14,45 +14,43 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Tangent.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" -#include #include +#include #include #include #include #include -#include #include +#include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher) -{ -} +SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) {} -bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr&/* thePlane*/) -{ +bool SketcherPrs_Tangent::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr & /* thePlane*/) { bool aReadyToDisplay = false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + theConstraint, SketchPlugin_Constraint::ENTITY_B()); aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && SketcherPrs_Tools::getShape(aObj2).get() != NULL; @@ -60,21 +58,23 @@ bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; - ObjectPtr aObj1 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = - SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); GeomShapePtr aShp1 = SketcherPrs_Tools::getShape(aObj1); GeomShapePtr aShp2 = SketcherPrs_Tools::getShape(aObj2); - GeomCurvePtr aCurv1 = std::shared_ptr(new GeomAPI_Curve(aShp1)); - GeomCurvePtr aCurv2 = std::shared_ptr(new GeomAPI_Curve(aShp2)); + GeomCurvePtr aCurv1 = + std::shared_ptr(new GeomAPI_Curve(aShp1)); + GeomCurvePtr aCurv2 = + std::shared_ptr(new GeomAPI_Curve(aShp2)); GeomPointPtr aPnt; GeomShapePtr aIntPnt = aShp1->intersect(aShp2); @@ -85,12 +85,12 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) // Compute points coordinates if (aPnt.get()) { - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep, aPnt); myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); myPntArray->AddVertex(aP1); } else { - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); @@ -100,11 +100,12 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) return true; } -void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ - ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - ObjectPtr aObj2 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); +void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const { + ObjectPtr aObj1 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult( + myConstraint, SketchPlugin_Constraint::ENTITY_B()); std::shared_ptr aShape1 = SketcherPrs_Tools::getShape(aObj1); std::shared_ptr aShape2 = SketcherPrs_Tools::getShape(aObj2); @@ -114,4 +115,3 @@ void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs, drawShape(aShape1, thePrs, theColor); drawShape(aShape2, thePrs, theColor); } - diff --git a/src/SketcherPrs/SketcherPrs_Tangent.h b/src/SketcherPrs/SketcherPrs_Tangent.h index 1f61dbecb..10e867cb0 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.h +++ b/src/SketcherPrs/SketcherPrs_Tangent.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Tangent_H @@ -23,40 +24,38 @@ #include "SketcherPrs_SymbolPrs.h" #include - DEFINE_STANDARD_HANDLE(SketcherPrs_Tangent, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of tangent constraint -*/ -class SketcherPrs_Tangent: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of tangent constraint + */ +class SketcherPrs_Tangent : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher); + Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); -protected: + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); - virtual const char* iconName() const { return "tangent.png"; } +protected: + virtual const char *iconName() const { return "tangent.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index b36444791..6594f634c 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -14,29 +14,30 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Tools.h" -#include -#include +#include #include +#include #include -#include +#include -#include +#include #include #include -#include #include +#include #include #include -#include #include +#include #include #include @@ -53,23 +54,19 @@ namespace SketcherPrs_Tools { static ParameterStyle MyStyle = ParameterValue; -void setParameterStyle(ParameterStyle theStyle) -{ - MyStyle = theStyle; -} +void setParameterStyle(ParameterStyle theStyle) { MyStyle = theStyle; } -ParameterStyle parameterStyle() -{ - return MyStyle; -} +ParameterStyle parameterStyle() { return MyStyle; } -AttributePtr getAttribute(ModelAPI_Feature* theFeature, const std::string& theAttrName) -{ +AttributePtr getAttribute(ModelAPI_Feature *theFeature, + const std::string &theAttrName) { AttributePtr anAttribute; if (theFeature) { std::shared_ptr aData = theFeature->data(); - if (aData.get() && aData->isValid()) { /// essential check as it is called in openGl thread - std::shared_ptr anAttr = aData->refattr(theAttrName); + if (aData.get() && + aData->isValid()) { /// essential check as it is called in openGl thread + std::shared_ptr anAttr = + aData->refattr(theAttrName); if (!anAttr->isObject()) anAttribute = anAttr->attr(); } @@ -77,13 +74,15 @@ AttributePtr getAttribute(ModelAPI_Feature* theFeature, const std::string& theAt return anAttribute; } -ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName) -{ +ObjectPtr getResult(ModelAPI_Feature *theFeature, + const std::string &theAttrName) { ObjectPtr anObject; if (theFeature) { std::shared_ptr aData = theFeature->data(); - if (aData.get() && aData->isValid()) { /// essential check as it is called in openGl thread - std::shared_ptr anAttr = aData->refattr(theAttrName); + if (aData.get() && + aData->isValid()) { /// essential check as it is called in openGl thread + std::shared_ptr anAttr = + aData->refattr(theAttrName); if (anAttr.get()) anObject = anAttr->object(); } @@ -91,14 +90,15 @@ ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName return anObject; } - -std::shared_ptr getShape(ObjectPtr theObject) -{ - ResultConstructionPtr aRes = std::dynamic_pointer_cast(theObject); +std::shared_ptr getShape(ObjectPtr theObject) { + ResultConstructionPtr aRes = + std::dynamic_pointer_cast(theObject); if (!aRes.get()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); + FeaturePtr aFeature = + std::dynamic_pointer_cast(theObject); if (aFeature.get()) - aRes = std::dynamic_pointer_cast(aFeature->lastResult()); + aRes = std::dynamic_pointer_cast( + aFeature->lastResult()); } if (aRes.get() != NULL && aRes->data()->isValid()) { /// essential check as it is called in openGl thread @@ -107,15 +107,15 @@ std::shared_ptr getShape(ObjectPtr theObject) return std::shared_ptr(); } - -std::shared_ptr getPoint(ModelAPI_Feature* theFeature, - const std::string& theAttribute) -{ +std::shared_ptr getPoint(ModelAPI_Feature *theFeature, + const std::string &theAttribute) { std::shared_ptr aPointAttr = - std::dynamic_pointer_cast(theFeature->attribute(theAttribute)); + std::dynamic_pointer_cast( + theFeature->attribute(theAttribute)); if (!aPointAttr.get() || !aPointAttr->isInitialized()) { aPointAttr = ModelGeomAlgo_Point2D::getPointOfRefAttr( - theFeature, theAttribute, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); + theFeature, theAttribute, SketchPlugin_Point::ID(), + SketchPlugin_Point::COORD_ID()); } if (aPointAttr.get() != NULL) return aPointAttr->pnt(); @@ -128,34 +128,36 @@ std::shared_ptr getPoint(ModelAPI_Feature* theFeature, /// \param theObject an object /// \param theShape a vertex /// \param thePlane a projection plane (sketcher plane) -std::shared_ptr findGeomPoint(ObjectPtr theObject, - const TopoDS_Shape& theShape, - const std::shared_ptr& thePlane) -{ +std::shared_ptr +findGeomPoint(ObjectPtr theObject, const TopoDS_Shape &theShape, + const std::shared_ptr &thePlane) { std::shared_ptr aGeomPoint; FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject); if (anObjectFeature) { if (theShape.ShapeType() == TopAbs_VERTEX) { - const TopoDS_Vertex& aShapeVertex = TopoDS::Vertex(theShape); - if (!aShapeVertex.IsNull()) { + const TopoDS_Vertex &aShapeVertex = TopoDS::Vertex(theShape); + if (!aShapeVertex.IsNull()) { gp_Pnt aShapePoint = BRep_Tool::Pnt(aShapeVertex); - std::shared_ptr aShapeGeomPnt = std::shared_ptr( - new GeomAPI_Pnt(aShapePoint.X(), aShapePoint.Y(), aShapePoint.Z())); + std::shared_ptr aShapeGeomPnt = + std::shared_ptr(new GeomAPI_Pnt( + aShapePoint.X(), aShapePoint.Y(), aShapePoint.Z())); // find the given point in the feature attributes std::list anObjectAttiributes = - anObjectFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); - std::list::const_iterator anIt = anObjectAttiributes.begin(), - aLast = anObjectAttiributes.end(); + anObjectFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); + std::list::const_iterator anIt = + anObjectAttiributes.begin(), + aLast = + anObjectAttiributes.end(); for (; anIt != aLast && !aGeomPoint; anIt++) { std::shared_ptr anAttributePoint = - std::dynamic_pointer_cast(*anIt); + std::dynamic_pointer_cast(*anIt); - std::shared_ptr anAttributePnt = thePlane->to3D(anAttributePoint->x(), - anAttributePoint->y()); - if (anAttributePnt.get() && - anAttributePnt->distance(aShapeGeomPnt) < Precision::Confusion()) { + std::shared_ptr anAttributePnt = + thePlane->to3D(anAttributePoint->x(), anAttributePoint->y()); + if (anAttributePnt.get() && anAttributePnt->distance(aShapeGeomPnt) < + Precision::Confusion()) { aGeomPoint = anAttributePoint; break; } @@ -167,18 +169,19 @@ std::shared_ptr findGeomPoint(ObjectPtr theObject, } //************************************************************************************* -std::shared_ptr getFeaturePoint(DataPtr theData, - const std::string& theAttribute, - const std::shared_ptr& thePlane) -{ +std::shared_ptr +getFeaturePoint(DataPtr theData, const std::string &theAttribute, + const std::shared_ptr &thePlane) { std::shared_ptr aPointAttr; - if (!theData.get() || !theData->isValid()) /// essential check as it is called in openGl thread + if (!theData.get() || + !theData->isValid()) /// essential check as it is called in openGl thread return aPointAttr; FeaturePtr aFeature; - std::shared_ptr anAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute)); + std::shared_ptr anAttr = + std::dynamic_pointer_cast( + theData->attribute(theAttribute)); if (anAttr) { if (anAttr->isObject()) { ObjectPtr anObject = anAttr->object(); @@ -186,9 +189,8 @@ std::shared_ptr getFeaturePoint(DataPtr theData, if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) { // Attribute refers to a point aPointAttr = std::dynamic_pointer_cast( - aFeature->data()->attribute(SketchPlugin_Point::COORD_ID())); - } - else { + aFeature->data()->attribute(SketchPlugin_Point::COORD_ID())); + } else { // if the attribute refers on another object ResultPtr aRes = std::dynamic_pointer_cast(anObject); if (aRes.get()) { @@ -199,23 +201,23 @@ std::shared_ptr getFeaturePoint(DataPtr theData, } } } - } - else if (anAttr->attr()) { + } else if (anAttr->attr()) { // If attribute is a point - aPointAttr = std::dynamic_pointer_cast(anAttr->attr()); + aPointAttr = + std::dynamic_pointer_cast(anAttr->attr()); } } return aPointAttr; } //************************************************************************************* -std::list getFreePoints(const CompositeFeaturePtr& theSketch) -{ +std::list getFreePoints(const CompositeFeaturePtr &theSketch) { std::list aFreePoints; if (!theSketch) return aFreePoints; - AttributeRefListPtr aFeatures = theSketch->reflist(SketchPlugin_Sketch::FEATURES_ID()); + AttributeRefListPtr aFeatures = + theSketch->reflist(SketchPlugin_Sketch::FEATURES_ID()); if (!aFeatures) return aFreePoints; std::list anObjects = aFeatures->list(); @@ -223,9 +225,11 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) anObjIt != anObjects.end(); ++anObjIt) { FeaturePtr aCurrent = ModelAPI_Feature::feature(*anObjIt); if (aCurrent && aCurrent->getKind() == SketchPlugin_Point::ID()) { - // check point is not referred by any constraints: the feature and result of point + // check point is not referred by any constraints: the feature and result + // of point bool aIsFree = true; - for(int aKind = 0; aIsFree && aKind < 2; aKind++) { // 0 for feature, 1 for result + for (int aKind = 0; aIsFree && aKind < 2; + aKind++) { // 0 for feature, 1 for result ObjectPtr aReferenced = aCurrent; if (aKind == 1) { if (!aCurrent->results().empty()) @@ -233,7 +237,7 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) else break; } - const std::set& aRefs = aReferenced->data()->refsToMe(); + const std::set &aRefs = aReferenced->data()->refsToMe(); std::set::iterator aRIt = aRefs.begin(); for (; aRIt != aRefs.end(); ++aRIt) { FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner()); @@ -253,15 +257,15 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) } //************************************************************************************* -FeaturePtr getFeatureLine(DataPtr theData, - const std::string& theAttribute) -{ +FeaturePtr getFeatureLine(DataPtr theData, const std::string &theAttribute) { FeaturePtr aLine; - if (!theData.get() || !theData->isValid()) /// essential check as it is called in openGl thread) + if (!theData.get() || + !theData->isValid()) /// essential check as it is called in openGl thread) return aLine; std::shared_ptr anAttr = - std::dynamic_pointer_cast(theData->attribute(theAttribute)); + std::dynamic_pointer_cast( + theData->attribute(theAttribute)); if (anAttr) { FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object()); if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) { @@ -272,17 +276,19 @@ FeaturePtr getFeatureLine(DataPtr theData, } //************************************************************************************* -std::shared_ptr getProjectionPoint(const FeaturePtr theLine, - const std::shared_ptr& thePoint) -{ +std::shared_ptr +getProjectionPoint(const FeaturePtr theLine, + const std::shared_ptr &thePoint) { DataPtr aData = theLine->data(); if (!aData.get() || !aData->isValid()) return std::shared_ptr(); - std::shared_ptr aPoint1 = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Line::START_ID())); - std::shared_ptr aPoint2 = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Line::END_ID())); + std::shared_ptr aPoint1 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aPoint2 = + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::END_ID())); GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y()); return aLin2d.project(thePoint); @@ -290,77 +296,52 @@ std::shared_ptr getProjectionPoint(const FeaturePtr theLine, static int MyPixelRatio = 1; -void setPixelRatio(int theRatio) -{ - MyPixelRatio = theRatio; -} +void setPixelRatio(int theRatio) { MyPixelRatio = theRatio; } -int pixelRatio() -{ - return MyPixelRatio; -} +int pixelRatio() { return MyPixelRatio; } static double MyArrowSize = 20; -double getArrowSize() -{ - return MyArrowSize; -} +double getArrowSize() { return MyArrowSize; } -void setArrowSize(double theSize) -{ - MyArrowSize = theSize; -} +void setArrowSize(double theSize) { MyArrowSize = theSize; } -int getDefaultArrowSize() -{ - return 20; -} +int getDefaultArrowSize() { return 20; } -int getConfigArrowSize() -{ +int getConfigArrowSize() { return Config_PropManager::integer("Visualization", "dimension_arrow_size"); } static double MyTextHeight = 16; -double getTextHeight() -{ - return MyTextHeight * MyPixelRatio; -} +double getTextHeight() { return MyTextHeight * MyPixelRatio; } -void setTextHeight(double theHeight) -{ - MyTextHeight = theHeight; -} +void setTextHeight(double theHeight) { MyTextHeight = theHeight; } -double getDefaultTextHeight() -{ - return 16 * MyPixelRatio; -} +double getDefaultTextHeight() { return 16 * MyPixelRatio; } -double getConfigTextHeight() -{ - return Config_PropManager::integer("Visualization", "dimension_value_size") * MyPixelRatio; +double getConfigTextHeight() { + return Config_PropManager::integer("Visualization", "dimension_value_size") * + MyPixelRatio; } -double getFlyoutDistance(const ModelAPI_Feature* theConstraint) -{ +double getFlyoutDistance(const ModelAPI_Feature *theConstraint) { std::shared_ptr aFlyoutPoint = std::dynamic_pointer_cast( - const_cast( - theConstraint)->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + const_cast(theConstraint) + ->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); // for not initialized values return zero distance to avoid Presentation crash if (!aFlyoutPoint->isInitialized()) return 0; return aFlyoutPoint->y(); } -std::shared_ptr getAnchorPoint(const ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ - ModelAPI_Feature* aConstraint = const_cast(theConstraint); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); +std::shared_ptr +getAnchorPoint(const ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { + ModelAPI_Feature *aConstraint = const_cast(theConstraint); + AttributeRefAttrPtr aRefAttr = + std::dynamic_pointer_cast( + aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); if (!aRefAttr || !aRefAttr->isObject() || !aRefAttr->object()) return std::shared_ptr(); @@ -368,31 +349,39 @@ std::shared_ptr getAnchorPoint(const ModelAPI_Feature* theConstrain std::shared_ptr aCenter; if (aFeature->getKind() == SketchPlugin_Arc::ID()) { // arc aCenter = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_Arc::CENTER_ID()))->pnt(); + aFeature->attribute(SketchPlugin_Arc::CENTER_ID())) + ->pnt(); } else if (aFeature->getKind() == SketchPlugin_Circle::ID()) { // circle aCenter = std::dynamic_pointer_cast( - aFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->pnt(); + aFeature->attribute(SketchPlugin_Circle::CENTER_ID())) + ->pnt(); } else return std::shared_ptr(); std::shared_ptr anOrigin(new GeomAPI_Pnt2d(0.0, 0.0)); - std::shared_ptr aFlyoutPnt = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()))->pnt(); + std::shared_ptr aFlyoutPnt = + std::dynamic_pointer_cast( + aConstraint->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())) + ->pnt(); double aRadius = std::dynamic_pointer_cast( - aConstraint->attribute(SketchPlugin_Constraint::VALUE()))->value(); + aConstraint->attribute(SketchPlugin_Constraint::VALUE())) + ->value(); double aLen = aFlyoutPnt->distance(anOrigin); - aRadius *= 1.001; // a gap to make point much closer to the circle, but not lying on it + aRadius *= 1.001; // a gap to make point much closer to the circle, but not + // lying on it aFlyoutPnt->setX(aCenter->x() + aFlyoutPnt->x() * aRadius / aLen); aFlyoutPnt->setY(aCenter->y() + aFlyoutPnt->y() * aRadius / aLen); return thePlane->to3D(aFlyoutPnt->x(), aFlyoutPnt->y()); } -void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError) -{ +void sendEmptyPresentationError(ModelAPI_Feature *theFeature, + const std::string theError) { Events_InfoMessage("SketcherPrs_Tools", - "An empty AIS presentation: SketcherPrs_LengthDimension").send(); - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); + "An empty AIS presentation: SketcherPrs_LengthDimension") + .send(); + static const Events_ID anEvent = + Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); std::shared_ptr aConstraintPtr(theFeature); ModelAPI_EventCreator::get()->sendUpdated(aConstraintPtr, anEvent); } -}; +}; // namespace SketcherPrs_Tools diff --git a/src/SketcherPrs/SketcherPrs_Tools.h b/src/SketcherPrs/SketcherPrs_Tools.h index e2e45132b..19d18b778 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.h +++ b/src/SketcherPrs/SketcherPrs_Tools.h @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Tools_H #define SketcherPrs_Tools_H #include "SketcherPrs.h" -#include -#include #include -#include +#include +#include #include -#include #include +#include +#include #include #include @@ -38,151 +39,153 @@ class GeomDataAPI_Point2D; namespace SketcherPrs_Tools { - /// \enum ParameterStyle lists styles of parameter - enum ParameterStyle { - ParameterValue, ///< using symbol with the parameter value - ParameterText ///< using parameter text - }; - - /// Set dimensions parameters style - /// \param theStyle new style - SKETCHERPRS_EXPORT void setParameterStyle(ParameterStyle theStyle); - - /// Return dimensions parameters style - SKETCHERPRS_EXPORT ParameterStyle parameterStyle(); - - /// Enumeration with modes for activation of selection custom presentations - enum SelectionModes { - /// Start of enumeration - Sel_Mode_First = 100, - - /// Selection mode for all constraints exclude dimensions - Sel_Constraint, - - /// Selection mode for whole dimension - Sel_Dimension_All, - - /// Selection mode for line of dimension - Sel_Dimension_Line, - - /// Selection mode for text of dimension - Sel_Dimension_Text, - - /// Selectiom mode for faces selection on sketch - Sel_Sketch_Face, - - /// Selectiom mode for wires selection on sketch - Sel_Sketch_Wire - }; - - /// Type of angle - enum AngleType{ - ANGLE_DIRECT, ///< Angle from the first line to the second line - ANGLE_COMPLEMENTARY, ///< Additional angle to the angle from first to second line - ANGLE_BACKWARD ///< Angle from the second line to the first line - }; - - /// Type of dimension location - enum LocationType{ - LOCATION_RIGHT, ///< Position is marked by right arrow placed on the left - LOCATION_AUTOMATIC, ///< Position is marked by two arrow placed on the both sides - LOCATION_LEFT ///< Position is marked by left arrow placed on the left - }; - - /// Event ID about expression visual state has been changed, the symbol with a digit - /// or parameter text is shown - - /// Returns attribute object referenced by feature - /// \param theFeature a feature - /// \param theAttrName an attribute name - SKETCHERPRS_EXPORT AttributePtr getAttribute(ModelAPI_Feature* theFeature, - const std::string& theAttrName); - - /// Returns result object referenced by feature - /// \param theFeature a feature - /// \param theAttrName an attribute name - SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature* theFeature, - const std::string& theAttrName); - - /// Returns shape from result object (or NULL) - /// \param theObject a result object - SKETCHERPRS_EXPORT std::shared_ptr getShape(ObjectPtr theObject); - - - /// Returns point from a line feature - /// \param theFeature a line feature - /// \param theAttrName an attribute of the point - SKETCHERPRS_EXPORT std::shared_ptr getPoint(ModelAPI_Feature* theFeature, - const std::string& theAttrName); - - - /// Returns point projected on a line - /// \param theLine a line - /// \param thePoint a projecting point - SKETCHERPRS_EXPORT std::shared_ptr getProjectionPoint( - const FeaturePtr theLine, - const std::shared_ptr& thePoint); +/// \enum ParameterStyle lists styles of parameter +enum ParameterStyle { + ParameterValue, ///< using symbol with the parameter value + ParameterText ///< using parameter text +}; - SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData, - const std::string& theAttribute); +/// Set dimensions parameters style +/// \param theStyle new style +SKETCHERPRS_EXPORT void setParameterStyle(ParameterStyle theStyle); - /// Obtain the point object from specified constraint parameter - /// \param theData a data object - /// \param theAttribute an attribute name - /// \param thePlane a projection plane (sketcher plane) - SKETCHERPRS_EXPORT std::shared_ptr getFeaturePoint(DataPtr theData, - const std::string& theAttribute, - const std::shared_ptr& thePlane); +/// Return dimensions parameters style +SKETCHERPRS_EXPORT ParameterStyle parameterStyle(); - /// Collect all sketch points which are not connected with other entities. - /// \param theSketch sketch feature - /// \return list of results of SketchPlugin_Point features - SKETCHERPRS_EXPORT std::list getFreePoints(const CompositeFeaturePtr& theSketch); - - /// Returns value of dimension arrows size - SKETCHERPRS_EXPORT double getArrowSize(); +/// Enumeration with modes for activation of selection custom presentations +enum SelectionModes { + /// Start of enumeration + Sel_Mode_First = 100, - /// Set value of dimension arrows size - /// \param theSize a size value - SKETCHERPRS_EXPORT void setArrowSize(double theSize); + /// Selection mode for all constraints exclude dimensions + Sel_Constraint, - /// Returns default value of dimension arrows size - SKETCHERPRS_EXPORT int getDefaultArrowSize(); + /// Selection mode for whole dimension + Sel_Dimension_All, - /// Returns value of dimension arrows size set in preferences - SKETCHERPRS_EXPORT int getConfigArrowSize(); - - /// Set value of dimension text height - /// \param theHeight a height value - SKETCHERPRS_EXPORT void setTextHeight(double theHeight); + /// Selection mode for line of dimension + Sel_Dimension_Line, - /// Returns value of dimension text height - SKETCHERPRS_EXPORT double getTextHeight(); + /// Selection mode for text of dimension + Sel_Dimension_Text, - /// Returns default value of dimension text height - SKETCHERPRS_EXPORT double getDefaultTextHeight(); + /// Selectiom mode for faces selection on sketch + Sel_Sketch_Face, - /// Returns value of dimension text height set in preferences - SKETCHERPRS_EXPORT double getConfigTextHeight(); + /// Selectiom mode for wires selection on sketch + Sel_Sketch_Wire +}; - /// Get flayout distance of the dimension constraint - /// \param theConstraint a dimension constraint object - SKETCHERPRS_EXPORT double getFlyoutDistance(const ModelAPI_Feature* theConstraint); - - /// Compute anchor pint for radius dimension - SKETCHERPRS_EXPORT std::shared_ptr getAnchorPoint( - const ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); - - /// Throws an exception(in debug mode) and sends a signal about necessity to hide the object - /// \param theFeature a feature where AIS presentation is empty - /// \param theError a debug error information - SKETCHERPRS_EXPORT void sendEmptyPresentationError(ModelAPI_Feature* theFeature, - const std::string theError); - - SKETCHERPRS_EXPORT void setPixelRatio(int theRatio); +/// Type of angle +enum AngleType { + ANGLE_DIRECT, ///< Angle from the first line to the second line + ANGLE_COMPLEMENTARY, ///< Additional angle to the angle from first to second + ///< line + ANGLE_BACKWARD ///< Angle from the second line to the first line +}; - SKETCHERPRS_EXPORT int pixelRatio(); +/// Type of dimension location +enum LocationType { + LOCATION_RIGHT, ///< Position is marked by right arrow placed on the left + LOCATION_AUTOMATIC, ///< Position is marked by two arrow placed on the both + ///< sides + LOCATION_LEFT ///< Position is marked by left arrow placed on the left }; +/// Event ID about expression visual state has been changed, the symbol with a +/// digit or parameter text is shown + +/// Returns attribute object referenced by feature +/// \param theFeature a feature +/// \param theAttrName an attribute name +SKETCHERPRS_EXPORT AttributePtr getAttribute(ModelAPI_Feature *theFeature, + const std::string &theAttrName); + +/// Returns result object referenced by feature +/// \param theFeature a feature +/// \param theAttrName an attribute name +SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature *theFeature, + const std::string &theAttrName); + +/// Returns shape from result object (or NULL) +/// \param theObject a result object +SKETCHERPRS_EXPORT std::shared_ptr getShape(ObjectPtr theObject); + +/// Returns point from a line feature +/// \param theFeature a line feature +/// \param theAttrName an attribute of the point +SKETCHERPRS_EXPORT std::shared_ptr +getPoint(ModelAPI_Feature *theFeature, const std::string &theAttrName); + +/// Returns point projected on a line +/// \param theLine a line +/// \param thePoint a projecting point +SKETCHERPRS_EXPORT std::shared_ptr +getProjectionPoint(const FeaturePtr theLine, + const std::shared_ptr &thePoint); + +SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData, + const std::string &theAttribute); + +/// Obtain the point object from specified constraint parameter +/// \param theData a data object +/// \param theAttribute an attribute name +/// \param thePlane a projection plane (sketcher plane) +SKETCHERPRS_EXPORT std::shared_ptr +getFeaturePoint(DataPtr theData, const std::string &theAttribute, + const std::shared_ptr &thePlane); + +/// Collect all sketch points which are not connected with other entities. +/// \param theSketch sketch feature +/// \return list of results of SketchPlugin_Point features +SKETCHERPRS_EXPORT std::list +getFreePoints(const CompositeFeaturePtr &theSketch); + +/// Returns value of dimension arrows size +SKETCHERPRS_EXPORT double getArrowSize(); + +/// Set value of dimension arrows size +/// \param theSize a size value +SKETCHERPRS_EXPORT void setArrowSize(double theSize); + +/// Returns default value of dimension arrows size +SKETCHERPRS_EXPORT int getDefaultArrowSize(); + +/// Returns value of dimension arrows size set in preferences +SKETCHERPRS_EXPORT int getConfigArrowSize(); + +/// Set value of dimension text height +/// \param theHeight a height value +SKETCHERPRS_EXPORT void setTextHeight(double theHeight); + +/// Returns value of dimension text height +SKETCHERPRS_EXPORT double getTextHeight(); + +/// Returns default value of dimension text height +SKETCHERPRS_EXPORT double getDefaultTextHeight(); + +/// Returns value of dimension text height set in preferences +SKETCHERPRS_EXPORT double getConfigTextHeight(); + +/// Get flayout distance of the dimension constraint +/// \param theConstraint a dimension constraint object +SKETCHERPRS_EXPORT double +getFlyoutDistance(const ModelAPI_Feature *theConstraint); + +/// Compute anchor pint for radius dimension +SKETCHERPRS_EXPORT std::shared_ptr +getAnchorPoint(const ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); + +/// Throws an exception(in debug mode) and sends a signal about necessity to +/// hide the object \param theFeature a feature where AIS presentation is empty +/// \param theError a debug error information +SKETCHERPRS_EXPORT void sendEmptyPresentationError(ModelAPI_Feature *theFeature, + const std::string theError); + +SKETCHERPRS_EXPORT void setPixelRatio(int theRatio); + +SKETCHERPRS_EXPORT int pixelRatio(); +}; // namespace SketcherPrs_Tools + #endif diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 1395cb1a8..4d96368fd 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -14,42 +14,40 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "SketcherPrs_Transformation.h" -#include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" +#include "SketcherPrs_Tools.h" +#include +#include #include -#include #include -#include -#include +#include +#include #include -#include #include -#include -#include +#include #include - - +#include IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Transformation, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; -SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, - bool isTranslation) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher), myIsTranslation(isTranslation) -{ -} +SketcherPrs_Transformation::SketcherPrs_Transformation( + ModelAPI_Feature *theConstraint, SketchPlugin_Sketch *theSketcher, + bool isTranslation) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher), + myIsTranslation(isTranslation) {} -bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -{ +bool SketcherPrs_Transformation::IsReadyToDisplay( + ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane) { bool aReadyToDisplay = false; if (!thePlane) return aReadyToDisplay; @@ -57,7 +55,7 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain std::shared_ptr aData = theConstraint->data(); // Get transformated objects list std::shared_ptr anAttrB = - aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return aReadyToDisplay; @@ -68,44 +66,42 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain // additional check if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) { // If it is translation - AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiTranslation::START_POINT_ID()); - AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiTranslation::END_POINT_ID()); - - aReadyToDisplay = - aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized(); - } - else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { + AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiTranslation::START_POINT_ID()); + AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiTranslation::END_POINT_ID()); + + aReadyToDisplay = aStart.get() && aEnd.get() && aStart->isInitialized() && + aEnd->isInitialized(); + } else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { // if it is rotation - AttributePoint2DPtr aCenter = - GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID()); + AttributePoint2DPtr aCenter = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiRotation::CENTER_ID()); aReadyToDisplay = aCenter.get() && aCenter->isInitialized(); } #endif return aReadyToDisplay; } -bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, bool withColor) const -{ +bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, + bool withColor) const { if (!IsReadyToDisplay(myConstraint, plane())) return false; std::shared_ptr aData = myConstraint->data(); // Get transformated objects list std::shared_ptr anAttrB = - aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); int aNbB = anAttrB->size(); - if (aNbB == 0) - { + if (aNbB == 0) { #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED - //if (!myPntArray.IsNull()) - // mySPoints.Clear(); + // if (!myPntArray.IsNull()) + // mySPoints.Clear(); #endif } - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + SketcherPrs_PositionMgr *aMgr = SketcherPrs_PositionMgr::get(); myPntArray = new Graphic3d_ArrayOfPoints(aNbB, withColor); int i; @@ -123,31 +119,34 @@ bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, bool wit return true; } -void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& thePrs, - Quantity_Color theColor) const -{ +void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation) & + thePrs, + Quantity_Color theColor) const { std::shared_ptr aData = myConstraint->data(); std::shared_ptr anAttrB = - aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return; // drawListOfShapes uses myDrawer for attributes definition - //Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1); - //myDrawer->SetLineAspect(aLnAspect); + // Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, + // Aspect_TOL_SOLID, 1); myDrawer->SetLineAspect(aLnAspect); drawListOfShapes(anAttrB, thePrs, theColor); if (myConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) { // If it is translation - AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiTranslation::START_POINT_ID()); - AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData, - SketchPlugin_MultiTranslation::END_POINT_ID()); + AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiTranslation::START_POINT_ID()); + AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiTranslation::END_POINT_ID()); - if (aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized()) { + if (aStart.get() && aEnd.get() && aStart->isInitialized() && + aEnd->isInitialized()) { // Add start point - std::shared_ptr aPnt = plane()->to3D(aStart->x(), aStart->y()); - Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); + std::shared_ptr aPnt = + plane()->to3D(aStart->x(), aStart->y()); + Handle(Geom_CartesianPoint) aPoint = + new Geom_CartesianPoint(aPnt->impl()); StdPrs_Point::Add(thePrs, aPoint, myDrawer); // Add end point @@ -157,14 +156,15 @@ void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& the } } else if (myConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { // if it is rotation - AttributePoint2DPtr aCenter = - GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID()); + AttributePoint2DPtr aCenter = GeomDataAPI_Point2D::getPoint2D( + aData, SketchPlugin_MultiRotation::CENTER_ID()); if (aCenter.get() && aCenter->isInitialized()) { // Show center of rotation - std::shared_ptr aPnt = plane()->to3D(aCenter->x(), aCenter->y()); - Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); + std::shared_ptr aPnt = + plane()->to3D(aCenter->x(), aCenter->y()); + Handle(Geom_CartesianPoint) aPoint = + new Geom_CartesianPoint(aPnt->impl()); StdPrs_Point::Add(thePrs, aPoint, myDrawer); } } } - diff --git a/src/SketcherPrs/SketcherPrs_Transformation.h b/src/SketcherPrs/SketcherPrs_Transformation.h index 387ab2bf2..fd736308e 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.h +++ b/src/SketcherPrs/SketcherPrs_Transformation.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef SketcherPrs_Transformation_H @@ -23,39 +24,41 @@ #include "SketcherPrs_SymbolPrs.h" #include - DEFINE_STANDARD_HANDLE(SketcherPrs_Transformation, SketcherPrs_SymbolPrs) /** -* \ingroup GUI -* A redefinition of standard AIS Interactive Object in order to provide -* presentation of parallel constraint -*/ -class SketcherPrs_Transformation: public SketcherPrs_SymbolPrs -{ + * \ingroup GUI + * A redefinition of standard AIS Interactive Object in order to provide + * presentation of parallel constraint + */ +class SketcherPrs_Transformation : public SketcherPrs_SymbolPrs { public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object /// \param isTranslation a flag is it translation or rotation - Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher, bool isTranslation); + Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature *theConstraint, + SketchPlugin_Sketch *theSketcher, + bool isTranslation); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Transformation, SketcherPrs_SymbolPrs) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation - /// \param theConstraint a constraint feature - /// \param thePlane a coordinate plane of current sketch - /// \return boolean result value - static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + /// Returns true if the constraint feature arguments are correcly filled to + /// build AIS presentation \param theConstraint a constraint feature \param + /// thePlane a coordinate plane of current sketch \return boolean result value + static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint, + const std::shared_ptr &thePlane); + protected: - virtual const char* iconName() const { return myIsTranslation? "translate.png" : "rotate.png"; } + virtual const char *iconName() const { + return myIsTranslation ? "translate.png" : "rotate.png"; + } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const; + virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const; /// Update myPntArray according to presentation positions /// \return true in case of success @@ -65,4 +68,4 @@ private: bool myIsTranslation; }; -#endif \ No newline at end of file +#endif diff --git a/src/XAO/XAO.hxx b/src/XAO/XAO.hxx index 18af07524..43decccdc 100644 --- a/src/XAO/XAO.hxx +++ b/src/XAO/XAO.hxx @@ -14,20 +14,21 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Roman NIKOLAEV (OpenCascade) #if defined XAO_EXPORTS || defined Xao_EXPORTS - #if defined WIN32 - #define XAO_EXPORT __declspec( dllexport ) - #else - #define XAO_EXPORT - #endif +#if defined WIN32 +#define XAO_EXPORT __declspec(dllexport) #else - #if defined WIN32 - #define XAO_EXPORT __declspec( dllimport ) - #else - #define XAO_EXPORT - #endif -#endif \ No newline at end of file +#define XAO_EXPORT +#endif +#else +#if defined WIN32 +#define XAO_EXPORT __declspec(dllimport) +#else +#define XAO_EXPORT +#endif +#endif diff --git a/src/XAO/XAO_BooleanField.cxx b/src/XAO/XAO_BooleanField.cxx index 5f46b0531..61d635397 100644 --- a/src/XAO/XAO_BooleanField.cxx +++ b/src/XAO/XAO_BooleanField.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,34 +25,26 @@ using namespace XAO; -BooleanField::BooleanField(XAO::Dimension dimension, - int nbElements, int nbComponents, const std::string& name) - : Field(dimension, nbElements, nbComponents, name) -{ -} +BooleanField::BooleanField(XAO::Dimension dimension, int nbElements, + int nbComponents, const std::string &name) + : Field(dimension, nbElements, nbComponents, name) {} -Step* BooleanField::addNewStep(int step) -{ - return addStep(step, 0); -} +Step *BooleanField::addNewStep(int step) { return addStep(step, 0); } -BooleanStep* BooleanField::addStep(int step) -{ - return addStep(step, 0); -} +BooleanStep *BooleanField::addStep(int step) { return addStep(step, 0); } -BooleanStep* BooleanField::addStep(int step, int stamp) -{ - if (hasStep(step)) - throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); +BooleanStep *BooleanField::addStep(int step, int stamp) { + if (hasStep(step)) + throw XAO_Exception(MsgBuilder() + << "Step with number " << step << " already exists."); - BooleanStep* bstep = new BooleanStep(step, stamp, m_nbElements, m_nbComponents); - m_steps.push_back(bstep); - return bstep; + BooleanStep *bstep = + new BooleanStep(step, stamp, m_nbElements, m_nbComponents); + m_steps.push_back(bstep); + return bstep; } -BooleanStep* BooleanField::getStep(int index) -{ - checkStepIndex(index); - return (BooleanStep*)m_steps[index]; +BooleanStep *BooleanField::getStep(int index) { + checkStepIndex(index); + return (BooleanStep *)m_steps[index]; } diff --git a/src/XAO/XAO_BooleanField.hxx b/src/XAO/XAO_BooleanField.hxx index 5339e10ec..778dcee8c 100644 --- a/src/XAO/XAO_BooleanField.hxx +++ b/src/XAO/XAO_BooleanField.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,59 +25,57 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" -#include "XAO_Field.hxx" #include "XAO_BooleanStep.hxx" +#include "XAO_Field.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif +namespace XAO { +/** + * @class BooleanField + * Represents a field with boolean values. + */ +class XAO_EXPORT BooleanField : public Field { +public: + /** + * Constructor. + * @param dimension the dimension of the field. + * @param nbElements the number of elements. + * @param nbComponents the number of components. + * @param name the name of the field. + */ + BooleanField(XAO::Dimension dimension, int nbElements, int nbComponents, + const std::string &name); -namespace XAO -{ - /** - * @class BooleanField - * Represents a field with boolean values. - */ - class XAO_EXPORT BooleanField : public Field - { - public: - /** - * Constructor. - * @param dimension the dimension of the field. - * @param nbElements the number of elements. - * @param nbComponents the number of components. - * @param name the name of the field. - */ - BooleanField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - - virtual XAO::Type getType() { return XAO::BOOLEAN; } + virtual XAO::Type getType() { return XAO::BOOLEAN; } - virtual Step* addNewStep(int step); + virtual Step *addNewStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @return the newly created step. - */ - BooleanStep* addStep(int step); + /** + * Adds a new step. + * @param step the number of the step. + * @return the newly created step. + */ + BooleanStep *addStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @param stamp the stamp of the step. - * @return the newly created step. - */ - BooleanStep* addStep(int step, int stamp); + /** + * Adds a new step. + * @param step the number of the step. + * @param stamp the stamp of the step. + * @return the newly created step. + */ + BooleanStep *addStep(int step, int stamp); - /** - * Gets the step of given index. - * @param index the index. - * @return the step for the given index. - */ - BooleanStep* getStep(int index); - }; -} + /** + * Gets the step of given index. + * @param index the index. + * @return the step for the given index. + */ + BooleanStep *getStep(int index); +}; +} // namespace XAO #endif /* __XAO_BOOLEANFIELD_HXX__ */ diff --git a/src/XAO/XAO_BooleanStep.cxx b/src/XAO/XAO_BooleanStep.cxx index a42131709..3305b5e22 100644 --- a/src/XAO/XAO_BooleanStep.cxx +++ b/src/XAO/XAO_BooleanStep.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -23,117 +24,104 @@ using namespace XAO; -BooleanStep::BooleanStep(int step, int stamp, int nbElements, int nbComponents) -{ - m_nbElements = nbElements; - m_nbComponents = nbComponents; - m_step = step; - m_stamp = stamp; - - m_values.reserve(m_nbElements); - for (int i = 0; i < m_nbElements; ++i) - { - std::vector row; - row.reserve(m_nbComponents); - for (int j = 0; j < m_nbComponents; ++j) - row.push_back(false); - m_values.push_back(row); - } +BooleanStep::BooleanStep(int step, int stamp, int nbElements, + int nbComponents) { + m_nbElements = nbElements; + m_nbComponents = nbComponents; + m_step = step; + m_stamp = stamp; + + m_values.reserve(m_nbElements); + for (int i = 0; i < m_nbElements; ++i) { + std::vector row; + row.reserve(m_nbComponents); + for (int j = 0; j < m_nbComponents; ++j) + row.push_back(false); + m_values.push_back(row); + } } -std::vector BooleanStep::getValues() -{ - std::vector result; - result.reserve(m_nbElements * m_nbComponents); +std::vector BooleanStep::getValues() { + std::vector result; + result.reserve(m_nbElements * m_nbComponents); - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.insert(result.end(), eltValues.begin(), eltValues.end()); - } + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.insert(result.end(), eltValues.begin(), eltValues.end()); + } - return result; + return result; } -std::vector BooleanStep::getElement(int element) -{ - checkElementIndex(element); +std::vector BooleanStep::getElement(int element) { + checkElementIndex(element); - std::vector result(m_values[element]); - return result; + std::vector result(m_values[element]); + return result; } -std::vector BooleanStep::getComponent(int component) -{ - checkComponentIndex(component); +std::vector BooleanStep::getComponent(int component) { + checkComponentIndex(component); - std::vector result; - result.reserve(m_nbElements); + std::vector result; + result.reserve(m_nbElements); - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.push_back(eltValues[component]); - } + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.push_back(eltValues[component]); + } - return result; + return result; } -bool BooleanStep::getValue(int element, int component) -{ - checkElementIndex(element); - checkComponentIndex(component); +bool BooleanStep::getValue(int element, int component) { + checkElementIndex(element); + checkComponentIndex(component); - return m_values[element][component]; + return m_values[element][component]; } -const std::string BooleanStep::getStringValue(int element, int component) -{ - return XaoUtils::booleanToString(getValue(element, component)); +const std::string BooleanStep::getStringValue(int element, int component) { + return XaoUtils::booleanToString(getValue(element, component)); } -void BooleanStep::setValues(const std::vector& values) -{ - checkNbValues((int)values.size()); +void BooleanStep::setValues(const std::vector &values) { + checkNbValues((int)values.size()); - for (int i = 0; i < m_nbElements; ++i) - { - for (int j = 0; j < m_nbComponents; ++j) - { - m_values[i][j] = values[i * m_nbComponents + j]; - } + for (int i = 0; i < m_nbElements; ++i) { + for (int j = 0; j < m_nbComponents; ++j) { + m_values[i][j] = values[i * m_nbComponents + j]; } + } } -void BooleanStep::setElement(int element, const std::vector& elements) -{ - checkElementIndex(element); - checkNbComponents(elements.size()); +void BooleanStep::setElement(int element, const std::vector &elements) { + checkElementIndex(element); + checkNbComponents(elements.size()); - for (int i = 0; i < m_nbComponents; ++i) - m_values[element][i] = elements[i]; + for (int i = 0; i < m_nbComponents; ++i) + m_values[element][i] = elements[i]; } -void BooleanStep::setComponent(int component, const std::vector& components) -{ - checkComponentIndex(component); - checkNbElements(components.size()); +void BooleanStep::setComponent(int component, + const std::vector &components) { + checkComponentIndex(component); + checkNbElements(components.size()); - for (int i = 0; i < m_nbElements; ++i) - m_values[i][component] = components[i]; + for (int i = 0; i < m_nbElements; ++i) + m_values[i][component] = components[i]; } -void BooleanStep::setValue(int element, int component, bool value) -{ - checkElementIndex(element); - checkComponentIndex(component); +void BooleanStep::setValue(int element, int component, bool value) { + checkElementIndex(element); + checkComponentIndex(component); - m_values[element][component] = value; + m_values[element][component] = value; } -void BooleanStep::setStringValue(int element, int component, const std::string& value) -{ - setValue(element, component, XaoUtils::stringToBoolean(value)); +void BooleanStep::setStringValue(int element, int component, + const std::string &value) { + setValue(element, component, XaoUtils::stringToBoolean(value)); } diff --git a/src/XAO/XAO_BooleanStep.hxx b/src/XAO/XAO_BooleanStep.hxx index 22b624fd7..aa551388c 100644 --- a/src/XAO/XAO_BooleanStep.hxx +++ b/src/XAO/XAO_BooleanStep.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,98 +25,95 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Step.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4290) // Warning Exception ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif - -namespace XAO -{ - /** - * @class BooleanStep - * Step with boolean values. - */ - class XAO_EXPORT BooleanStep : public Step - { - public: - /** - * Constructor. - * @param step the step number. - * @param stamp the stamp of the step. - * @param nbElements the number elements of the geometry. - * @param nbComponents the number of components of the field. - */ - BooleanStep(int step, int stamp, int nbElements, int nbComponents); - - virtual XAO::Type getType() { return XAO::BOOLEAN; } - - /** - * Gets all the values in a vector by elements and by components. - * @return a vector containing all the values. - */ - std::vector getValues(); - - /** - * Gets all the values for an element. - * @param element the index of the element to get. - * @return a vector containing all the values for the given element. - */ - std::vector getElement(int element); - - /** - * Gets all the values for a component. - * @param component the index of the component to get. - * @return a vector containing all the values for the given component. - */ - std::vector getComponent(int component); - - /** - * Gets a value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @return the value. - */ - bool getValue(int element, int component); - - /** - * Sets all the values from a list. - * @param values the list of values to set. - */ - void setValues(const std::vector& values); - - /** - * Sets the values for an element. - * @param element the index of the element to set. - * @param elements the values to set. - */ - void setElement(int element, const std::vector& elements); - - /** - * Sets the values for a component. - * @param component the index of the component to set. - * @param components the values to set. - */ - void setComponent(int component, const std::vector& components); - - /** - * Sets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @param value the value. - */ - void setValue(int element, int component, bool value); - - virtual const std::string getStringValue(int element, int component); - virtual void setStringValue(int element, int component, const std::string& value); - - private: - std::vector< std::vector > m_values; - }; -} - +namespace XAO { +/** + * @class BooleanStep + * Step with boolean values. + */ +class XAO_EXPORT BooleanStep : public Step { +public: + /** + * Constructor. + * @param step the step number. + * @param stamp the stamp of the step. + * @param nbElements the number elements of the geometry. + * @param nbComponents the number of components of the field. + */ + BooleanStep(int step, int stamp, int nbElements, int nbComponents); + + virtual XAO::Type getType() { return XAO::BOOLEAN; } + + /** + * Gets all the values in a vector by elements and by components. + * @return a vector containing all the values. + */ + std::vector getValues(); + + /** + * Gets all the values for an element. + * @param element the index of the element to get. + * @return a vector containing all the values for the given element. + */ + std::vector getElement(int element); + + /** + * Gets all the values for a component. + * @param component the index of the component to get. + * @return a vector containing all the values for the given component. + */ + std::vector getComponent(int component); + + /** + * Gets a value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @return the value. + */ + bool getValue(int element, int component); + + /** + * Sets all the values from a list. + * @param values the list of values to set. + */ + void setValues(const std::vector &values); + + /** + * Sets the values for an element. + * @param element the index of the element to set. + * @param elements the values to set. + */ + void setElement(int element, const std::vector &elements); + + /** + * Sets the values for a component. + * @param component the index of the component to set. + * @param components the values to set. + */ + void setComponent(int component, const std::vector &components); + + /** + * Sets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @param value the value. + */ + void setValue(int element, int component, bool value); + + virtual const std::string getStringValue(int element, int component); + virtual void setStringValue(int element, int component, + const std::string &value); + +private: + std::vector> m_values; +}; +} // namespace XAO #endif /* __XAO_BOOLEANSTEP_HXX__ */ diff --git a/src/XAO/XAO_BrepGeometry.cxx b/src/XAO/XAO_BrepGeometry.cxx index d973cd9ad..110e832cc 100644 --- a/src/XAO/XAO_BrepGeometry.cxx +++ b/src/XAO/XAO_BrepGeometry.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -22,17 +23,17 @@ #include +#include #include #include +#include #include -#include -#include -#include -#include #include #include -#include -#include +#include +#include +#include +#include #include #include @@ -41,368 +42,321 @@ using namespace XAO; -BrepGeometry::BrepGeometry() : Geometry("") -{ -} +BrepGeometry::BrepGeometry() : Geometry("") {} -BrepGeometry::BrepGeometry(const std::string& name) : Geometry(name) -{ -} +BrepGeometry::BrepGeometry(const std::string &name) : Geometry(name) {} -const std::string BrepGeometry::getShapeString() -{ - std::ostringstream streamShape; - BRepTools::Write(m_shape, streamShape); - return streamShape.str(); +const std::string BrepGeometry::getShapeString() { + std::ostringstream streamShape; + BRepTools::Write(m_shape, streamShape); + return streamShape.str(); } -void BrepGeometry::setShapeString(const std::string& shape) -{ - std::istringstream streamBrep(shape.c_str()); - BRep_Builder builder; - BRepTools::Read(m_shape, streamBrep, builder); +void BrepGeometry::setShapeString(const std::string &shape) { + std::istringstream streamBrep(shape.c_str()); + BRep_Builder builder; + BRepTools::Read(m_shape, streamBrep, builder); - initIds(); + initIds(); } -void BrepGeometry::writeShapeFile(const std::string& fileName) -{ - bool res = BRepTools::Write(m_shape, fileName.c_str()); - if (!res) - throw XAO_Exception(MsgBuilder() << "Cannot write BRep file: " << fileName); +void BrepGeometry::writeShapeFile(const std::string &fileName) { + bool res = BRepTools::Write(m_shape, fileName.c_str()); + if (!res) + throw XAO_Exception(MsgBuilder() << "Cannot write BRep file: " << fileName); } -void BrepGeometry::readShapeFile(const std::string& fileName) - { - BRep_Builder builder; - bool res = BRepTools::Read(m_shape, fileName.c_str(), builder); - if (!res) - throw XAO_Exception(MsgBuilder() << "Cannot read BRep file: " << fileName); +void BrepGeometry::readShapeFile(const std::string &fileName) { + BRep_Builder builder; + bool res = BRepTools::Read(m_shape, fileName.c_str(), builder); + if (!res) + throw XAO_Exception(MsgBuilder() << "Cannot read BRep file: " << fileName); - initIds(); + initIds(); } -TopoDS_Shape BrepGeometry::getTopoDS_Shape() -{ - return m_shape; -} +TopoDS_Shape BrepGeometry::getTopoDS_Shape() { return m_shape; } -void BrepGeometry::setTopoDS_Shape(const TopoDS_Shape& shape) -{ - m_shape = shape; - initIds(); +void BrepGeometry::setTopoDS_Shape(const TopoDS_Shape &shape) { + m_shape = shape; + initIds(); } -void BrepGeometry::initIds() -{ - // initialization of Ids - initListIds(TopAbs_VERTEX, m_vertices); - initListIds(TopAbs_EDGE, m_edges); - initListIds(TopAbs_FACE, m_faces); - initListIds(TopAbs_SOLID, m_solids); +void BrepGeometry::initIds() { + // initialization of Ids + initListIds(TopAbs_VERTEX, m_vertices); + initListIds(TopAbs_EDGE, m_edges); + initListIds(TopAbs_FACE, m_faces); + initListIds(TopAbs_SOLID, m_solids); } -void BrepGeometry::initListIds(const TopAbs_ShapeEnum& shapeType, GeometricElementList& eltList) -{ - TopTools_MapOfShape mapShape; - TopTools_ListOfShape listShape; +void BrepGeometry::initListIds(const TopAbs_ShapeEnum &shapeType, + GeometricElementList &eltList) { + TopTools_MapOfShape mapShape; + TopTools_ListOfShape listShape; - int nbElt = 0; - TopExp_Explorer exp(m_shape, shapeType); - for (; exp.More(); exp.Next()) - { - if (mapShape.Add(exp.Current())) - { - listShape.Append(exp.Current()); - nbElt++; - } + int nbElt = 0; + TopExp_Explorer exp(m_shape, shapeType); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + listShape.Append(exp.Current()); + nbElt++; } + } - if (listShape.IsEmpty()) - return; + if (listShape.IsEmpty()) + return; - TopTools_IndexedMapOfShape indices; - TopExp::MapShapes(m_shape, indices); + TopTools_IndexedMapOfShape indices; + TopExp::MapShapes(m_shape, indices); - eltList.setSize(nbElt); - TopTools_ListIteratorOfListOfShape itSub(listShape); - for (int index = 0; itSub.More(); itSub.Next(), ++index) - { - TopoDS_Shape value = itSub.Value(); - int ref = indices.FindIndex(value); - eltList.setReference(index, XaoUtils::intToString(ref)); - } + eltList.setSize(nbElt); + TopTools_ListIteratorOfListOfShape itSub(listShape); + for (int index = 0; itSub.More(); itSub.Next(), ++index) { + TopoDS_Shape value = itSub.Value(); + int ref = indices.FindIndex(value); + eltList.setReference(index, XaoUtils::intToString(ref)); + } } -TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, int shapeIndex) -{ - TopTools_MapOfShape mapShape; - TopTools_ListOfShape listShape; +TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape &mainShape, + const TopAbs_ShapeEnum &shapeType, + int shapeIndex) { + TopTools_MapOfShape mapShape; + TopTools_ListOfShape listShape; - TopExp_Explorer exp(mainShape, shapeType); - for (; exp.More(); exp.Next()) - { - if (mapShape.Add(exp.Current())) - listShape.Append(exp.Current()); - } + TopExp_Explorer exp(mainShape, shapeType); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) + listShape.Append(exp.Current()); + } - if (!listShape.IsEmpty()) - { - TopTools_ListIteratorOfListOfShape itSub(listShape); - for (int index = 0; itSub.More(); itSub.Next(), ++index) - { - if (shapeIndex == index) - { - TopoDS_Shape value = itSub.Value(); - return value; - } - } + if (!listShape.IsEmpty()) { + TopTools_ListIteratorOfListOfShape itSub(listShape); + for (int index = 0; itSub.More(); itSub.Next(), ++index) { + if (shapeIndex == index) { + TopoDS_Shape value = itSub.Value(); + return value; + } } + } - throw XAO_Exception(MsgBuilder() << "Shape with reference [" << shapeIndex << "] not found."); + throw XAO_Exception(MsgBuilder() << "Shape with reference [" << shapeIndex + << "] not found."); } // ----------------------------- -int BrepGeometry::countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType) -{ - int res = 0; - TopExp_Explorer exp(shape, shapeType); - for (; exp.More(); exp.Next()) - res++; +int BrepGeometry::countGeometricalElements(const TopoDS_Shape &shape, + const TopAbs_ShapeEnum &shapeType) { + int res = 0; + TopExp_Explorer exp(shape, shapeType); + for (; exp.More(); exp.Next()) + res++; - return res; + return res; } -std::vector BrepGeometry::getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, XAO::Dimension dim) -{ - std::vector indexList; +std::vector +BrepGeometry::getGeometricalElements(const TopoDS_Shape &shape, + const TopAbs_ShapeEnum &shapeType, + XAO::Dimension dim) { + std::vector indexList; - TopTools_MapOfShape mapShape; - TopTools_ListOfShape listShape; + TopTools_MapOfShape mapShape; + TopTools_ListOfShape listShape; - TopExp_Explorer exp(shape, shapeType); - for (; exp.More(); exp.Next()) - { - if (mapShape.Add(exp.Current())) - listShape.Append(exp.Current()); - } + TopExp_Explorer exp(shape, shapeType); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) + listShape.Append(exp.Current()); + } - if (!listShape.IsEmpty()) - { - // use the shape of the geometry for the indices - TopTools_IndexedMapOfShape indices; - TopExp::MapShapes(m_shape, indices); - - TopTools_ListIteratorOfListOfShape itSub(listShape); - for (int index = 0; itSub.More(); itSub.Next(), ++index) - { - TopoDS_Shape value = itSub.Value(); - int id = indices.FindIndex(value); - indexList.push_back(findElement(dim, id)); - } + if (!listShape.IsEmpty()) { + // use the shape of the geometry for the indices + TopTools_IndexedMapOfShape indices; + TopExp::MapShapes(m_shape, indices); + + TopTools_ListIteratorOfListOfShape itSub(listShape); + for (int index = 0; itSub.More(); itSub.Next(), ++index) { + TopoDS_Shape value = itSub.Value(); + int id = indices.FindIndex(value); + indexList.push_back(findElement(dim, id)); } + } - return indexList; + return indexList; } -void BrepGeometry::getEdgeVertices(int edgeIndex, int& vertexA, int& vertexB) -{ - TopoDS_Shape edge = getSubShape(m_shape, TopAbs_EDGE, edgeIndex); - std::vector vertices = getGeometricalElements(edge, TopAbs_VERTEX, XAO::VERTEX); - assert(vertices.size() == 2); +void BrepGeometry::getEdgeVertices(int edgeIndex, int &vertexA, int &vertexB) { + TopoDS_Shape edge = getSubShape(m_shape, TopAbs_EDGE, edgeIndex); + std::vector vertices = + getGeometricalElements(edge, TopAbs_VERTEX, XAO::VERTEX); + assert(vertices.size() == 2); - vertexA = vertices[0]; - vertexB = vertices[1]; + vertexA = vertices[0]; + vertexB = vertices[1]; } -int BrepGeometry::countFaceWires(int faceIndex) -{ - TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); - return countGeometricalElements(face, TopAbs_WIRE); +int BrepGeometry::countFaceWires(int faceIndex) { + TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); + return countGeometricalElements(face, TopAbs_WIRE); } -std::vector BrepGeometry::getFaceEdges(int faceIndex, int wireIndex) -{ - // get the face - TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); - // get the wire - TopoDS_Shape wire = getSubShape(face, TopAbs_WIRE, wireIndex); - return getGeometricalElements(wire, TopAbs_EDGE, XAO::EDGE); +std::vector BrepGeometry::getFaceEdges(int faceIndex, int wireIndex) { + // get the face + TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); + // get the wire + TopoDS_Shape wire = getSubShape(face, TopAbs_WIRE, wireIndex); + return getGeometricalElements(wire, TopAbs_EDGE, XAO::EDGE); } -int BrepGeometry::countSolidShells(int solidIndex) -{ - TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); - return countGeometricalElements(solid, TopAbs_SHELL); +int BrepGeometry::countSolidShells(int solidIndex) { + TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); + return countGeometricalElements(solid, TopAbs_SHELL); } -std::vector BrepGeometry::getSolidFaces(int solidIndex, int shellIndex) -{ - TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); - TopoDS_Shape shell = getSubShape(solid, TopAbs_SHELL, shellIndex); - return getGeometricalElements(shell, TopAbs_FACE, XAO::FACE); +std::vector BrepGeometry::getSolidFaces(int solidIndex, int shellIndex) { + TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); + TopoDS_Shape shell = getSubShape(solid, TopAbs_SHELL, shellIndex); + return getGeometricalElements(shell, TopAbs_FACE, XAO::FACE); } -void BrepGeometry::getVertexXYZ(int vertexIndex, double& xCoord, double& yCoord, double& zCoord) -{ - xCoord = 0.; - yCoord = 0.; - zCoord = 0.; +void BrepGeometry::getVertexXYZ(int vertexIndex, double &xCoord, double &yCoord, + double &zCoord) { + xCoord = 0.; + yCoord = 0.; + zCoord = 0.; - TopoDS_Shape vertex = getSubShape(m_shape, TopAbs_VERTEX, vertexIndex); - if (vertex.ShapeType() != TopAbs_VERTEX) - throw XAO_Exception(MsgBuilder() << "Shape " << vertexIndex<< " is not a point."); + TopoDS_Shape vertex = getSubShape(m_shape, TopAbs_VERTEX, vertexIndex); + if (vertex.ShapeType() != TopAbs_VERTEX) + throw XAO_Exception(MsgBuilder() + << "Shape " << vertexIndex << " is not a point."); - TopoDS_Vertex point = TopoDS::Vertex(vertex); - if (!point.IsNull()) - { - gp_Pnt aPnt = BRep_Tool::Pnt(point); - xCoord = aPnt.X(); - yCoord = aPnt.Y(); - zCoord = aPnt.Z(); - } + TopoDS_Vertex point = TopoDS::Vertex(vertex); + if (!point.IsNull()) { + gp_Pnt aPnt = BRep_Tool::Pnt(point); + xCoord = aPnt.X(); + yCoord = aPnt.Y(); + zCoord = aPnt.Z(); + } } // ----------------------------- -double BrepGeometry::getEdgeLength(int edgeIndex) -{ - TopoDS_Shape edge = getSubShape(m_shape, TopAbs_EDGE, edgeIndex); - GProp_GProps system; - BRepGProp::LinearProperties(edge, system); - return system.Mass(); +double BrepGeometry::getEdgeLength(int edgeIndex) { + TopoDS_Shape edge = getSubShape(m_shape, TopAbs_EDGE, edgeIndex); + GProp_GProps system; + BRepGProp::LinearProperties(edge, system); + return system.Mass(); } -double BrepGeometry::getFaceArea(int faceIndex) -{ - TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); - GProp_GProps system; - BRepGProp::SurfaceProperties(face, system); - return system.Mass(); +double BrepGeometry::getFaceArea(int faceIndex) { + TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); + GProp_GProps system; + BRepGProp::SurfaceProperties(face, system); + return system.Mass(); } -double BrepGeometry::getSolidVolume(int solidIndex) -{ - TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); - GProp_GProps system; - BRepGProp::VolumeProperties(solid, system); - return system.Mass(); +double BrepGeometry::getSolidVolume(int solidIndex) { + TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); + GProp_GProps system; + BRepGProp::VolumeProperties(solid, system); + return system.Mass(); } // ----------------------------- -int BrepGeometry::getVertexID(int index) -{ - return XaoUtils::stringToInt(getVertexReference(index)); +int BrepGeometry::getVertexID(int index) { + return XaoUtils::stringToInt(getVertexReference(index)); } -int BrepGeometry::getEdgeID(int index) -{ - return XaoUtils::stringToInt(getEdgeReference(index)); +int BrepGeometry::getEdgeID(int index) { + return XaoUtils::stringToInt(getEdgeReference(index)); } -int BrepGeometry::getFaceID(int index) -{ - return XaoUtils::stringToInt(getFaceReference(index)); +int BrepGeometry::getFaceID(int index) { + return XaoUtils::stringToInt(getFaceReference(index)); } -int BrepGeometry::getSolidID(int index) -{ - return XaoUtils::stringToInt(getSolidReference(index)); +int BrepGeometry::getSolidID(int index) { + return XaoUtils::stringToInt(getSolidReference(index)); } // ----------------------------- -void BrepGeometry::setVertexID(int index, int id) -{ - setVertexReference(index, XaoUtils::intToString(id)); +void BrepGeometry::setVertexID(int index, int id) { + setVertexReference(index, XaoUtils::intToString(id)); } -void BrepGeometry::setEdgeID(int index, int id) -{ - setEdgeReference(index, XaoUtils::intToString(id)); +void BrepGeometry::setEdgeID(int index, int id) { + setEdgeReference(index, XaoUtils::intToString(id)); } -void BrepGeometry::setFaceID(int index, int id) -{ - setEdgeReference(index, XaoUtils::intToString(id)); +void BrepGeometry::setFaceID(int index, int id) { + setEdgeReference(index, XaoUtils::intToString(id)); } -void BrepGeometry::setSolidID(int index, int id) -{ - setEdgeReference(index, XaoUtils::intToString(id)); +void BrepGeometry::setSolidID(int index, int id) { + setEdgeReference(index, XaoUtils::intToString(id)); } // ----------------------------- -int BrepGeometry::findElement(XAO::Dimension dim, int id) -{ - if (dim == XAO::VERTEX) - return findVertex(id); - if (dim == XAO::EDGE) - return findEdge(id); - if (dim == XAO::FACE) - return findFace(id); - if (dim == XAO::SOLID) - return findSolid(id); +int BrepGeometry::findElement(XAO::Dimension dim, int id) { + if (dim == XAO::VERTEX) + return findVertex(id); + if (dim == XAO::EDGE) + return findEdge(id); + if (dim == XAO::FACE) + return findFace(id); + if (dim == XAO::SOLID) + return findSolid(id); - throw XAO_Exception(MsgBuilder() << "Unknown Dimension: " << dim); + throw XAO_Exception(MsgBuilder() << "Unknown Dimension: " << dim); } -int BrepGeometry::findVertex(int id) -{ - return getVertexIndexByReference(XaoUtils::intToString(id)); +int BrepGeometry::findVertex(int id) { + return getVertexIndexByReference(XaoUtils::intToString(id)); } -int BrepGeometry::findEdge(int id) -{ - return getEdgeIndexByReference(XaoUtils::intToString(id)); +int BrepGeometry::findEdge(int id) { + return getEdgeIndexByReference(XaoUtils::intToString(id)); } -int BrepGeometry::findFace(int id) -{ - return getFaceIndexByReference(XaoUtils::intToString(id)); +int BrepGeometry::findFace(int id) { + return getFaceIndexByReference(XaoUtils::intToString(id)); } -int BrepGeometry::findSolid(int id) -{ - return getSolidIndexByReference(XaoUtils::intToString(id)); +int BrepGeometry::findSolid(int id) { + return getSolidIndexByReference(XaoUtils::intToString(id)); } // ----------------------------- -const std::string BrepGeometry::findVertexName(int id) -{ - return getVertexName(findVertex(id)); +const std::string BrepGeometry::findVertexName(int id) { + return getVertexName(findVertex(id)); } -const std::string BrepGeometry::findEdgeName(int id) -{ - return getEdgeName(findEdge(id)); +const std::string BrepGeometry::findEdgeName(int id) { + return getEdgeName(findEdge(id)); } -const std::string BrepGeometry::findFaceName(int id) -{ - return getFaceName(findFace(id)); +const std::string BrepGeometry::findFaceName(int id) { + return getFaceName(findFace(id)); } -const std::string BrepGeometry::findSolidName(int id) -{ - return getSolidName(findSolid(id)); +const std::string BrepGeometry::findSolidName(int id) { + return getSolidName(findSolid(id)); } // ----------------------------- -void BrepGeometry::changeVertexName(int id, const std::string& name) -{ - setVertexName(findVertex(id), name); +void BrepGeometry::changeVertexName(int id, const std::string &name) { + setVertexName(findVertex(id), name); } -void BrepGeometry::changeEdgeName(int id, const std::string& name) -{ - setEdgeName(findEdge(id), name); +void BrepGeometry::changeEdgeName(int id, const std::string &name) { + setEdgeName(findEdge(id), name); } -void BrepGeometry::changeFaceName(int id, const std::string& name) -{ - setFaceName(findFace(id), name); +void BrepGeometry::changeFaceName(int id, const std::string &name) { + setFaceName(findFace(id), name); } -void BrepGeometry::changeSolidName(int id, const std::string& name) -{ - setSolidName(findSolid(id), name); +void BrepGeometry::changeSolidName(int id, const std::string &name) { + setSolidName(findSolid(id), name); } diff --git a/src/XAO/XAO_BrepGeometry.hxx b/src/XAO/XAO_BrepGeometry.hxx index d59685c73..398e68785 100644 --- a/src/XAO/XAO_BrepGeometry.hxx +++ b/src/XAO/XAO_BrepGeometry.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -27,65 +28,62 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Geometry.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif - -namespace XAO -{ - /** - * @class BrepGeometry - * Representation of a BRep Geometry. - */ - class XAO_EXPORT BrepGeometry : public Geometry - { - public: - /** - * Default Constructor. - */ - BrepGeometry(); - - /** - * Constructor. - * @param name the name of the geometry. - */ - BrepGeometry(const std::string& name); - - virtual ~BrepGeometry() {} - - /** - * Gets the format of the geometry. - * @return the format of the geometry. - */ - virtual XAO::Format getFormat() { return XAO::BREP; } - - /** - * Gets the shape as a string. - * @return the shape as a string. - */ - virtual const std::string getShapeString(); - - /** - * Sets the shape from a string. - * @param shape the shape as a string. - */ - virtual void setShapeString(const std::string& shape); - - /** - * Writes shape to a file - * @param fileName the path to the file - */ - virtual void writeShapeFile(const std::string& fileName) ; - - /** - * Reads shape from a file - * @param fileName the path to the file - */ - virtual void readShapeFile(const std::string& fileName) ; +namespace XAO { +/** + * @class BrepGeometry + * Representation of a BRep Geometry. + */ +class XAO_EXPORT BrepGeometry : public Geometry { +public: + /** + * Default Constructor. + */ + BrepGeometry(); + + /** + * Constructor. + * @param name the name of the geometry. + */ + BrepGeometry(const std::string &name); + + virtual ~BrepGeometry() {} + + /** + * Gets the format of the geometry. + * @return the format of the geometry. + */ + virtual XAO::Format getFormat() { return XAO::BREP; } + + /** + * Gets the shape as a string. + * @return the shape as a string. + */ + virtual const std::string getShapeString(); + + /** + * Sets the shape from a string. + * @param shape the shape as a string. + */ + virtual void setShapeString(const std::string &shape); + + /** + * Writes shape to a file + * @param fileName the path to the file + */ + virtual void writeShapeFile(const std::string &fileName); + + /** + * Reads shape from a file + * @param fileName the path to the file + */ + virtual void readShapeFile(const std::string &fileName); #ifdef SWIG %pythoncode %{ @@ -97,240 +95,243 @@ namespace XAO %} #endif - /** - * Gets the shape as a TopoDS_Shape. - * @return the TopoDS_Shape. - */ - TopoDS_Shape getTopoDS_Shape(); - - /** - * Sets the shape from a TopoDS_Shape. - * @param shape the TopoDS_Shape to set. - */ - void setTopoDS_Shape(const TopoDS_Shape& shape); - - /** - * Gives the two extrimities of an edge. - * @param edgeIndex the index of the edge. - * @param vertexA - * @param vertexB - */ - void getEdgeVertices(int edgeIndex, int& vertexA, int& vertexB); - - /** - * Gets the number of wires of a face (including holes). - * @param faceIndex the index of the face. - * @return the number of wires. - */ - int countFaceWires(int faceIndex); - - /** - * Gets the indices of the wires of the face. - * @param faceIndex the index of the face. - * @param wireIndex the index of the wire. - * @return the list of wires for the given face. - */ - std::vector getFaceEdges(int faceIndex, int wireIndex); - - /** - * Gets the number of shells of a solid (including cavities). - * @param solidIndex the index of the solid. - * @return the number of shells. - */ - int countSolidShells(int solidIndex); - - /** - * Gets the indices of the shells of the solids. - * @param solidIndex the index of the solid. - * @param shellIndex the index of the shell (for the given solid). - * @return the list of shells for the given solid. - */ - std::vector getSolidFaces(int solidIndex, int shellIndex); - - /** - * Gets the coordinates of a vertex. - * @param vertexIndex the index of the vertex. - * @param xCoord the X coordinate. - * @param yCoord the Y coordinate. - * @param zCoord the Z coordinate. - */ - void getVertexXYZ(int vertexIndex, double& xCoord, double& yCoord, double& zCoord) - ; - - /** - * Gets the length of an edge. - * @param index the index of the edge. - * @return the length of the edge. - */ - double getEdgeLength(int index); - - /** - * Gets the are of a face. - * @param index the index of a face. - * @return the area of the face. - */ - double getFaceArea(int index); - - /** - * Gets the volume of a solid. - * @param index the index of the solid. - * @return the volume of the solid. - */ - double getSolidVolume(int index); - - /** - * Gets the ID of a vertex. - * @param index the index of the vertex. - * @return the ID of the vertex. - */ - int getVertexID(int index); - - /** - * Gets the ID of an edge. - * @param index the index of the edge. - * @return the ID of the edge. - */ - int getEdgeID(int index); - - /** - * Gets the ID of a face. - * @param index the index of the face. - * @return the ID of the face. - */ - int getFaceID(int index); - - /** - * Gets the ID of a solid. - * @param index the index of the solid. - * @return the ID of the solid. - */ - int getSolidID(int index); - - /** - * Sets the ID of a vertex. - * @param index the index of the vertex to set. - * @param id the id to set. - */ - void setVertexID(int index, int id); - - /** - * Sets the ID of an edge. - * @param index the index of the edge to set. - * @param id the id to set. - */ - void setEdgeID(int index, int id); - - /** - * Sets the ID of a face. - * @param index the index of the face to set. - * @param id the id to set. - */ - void setFaceID(int index, int id); - - /** - * Sets the ID of a solid. - * @param index the index of the solid to set. - * @param id the id to set. - */ - void setSolidID(int index, int id); - - /** - * Finds a vertex with its ID. - * @param id the ID of the vertex. - * @return the index of the vertex. - */ - int findVertex(int id); - - /** - * Finds an edge with its ID. - * @param id the ID of the edge. - * @return the index of the edge. - */ - int findEdge(int id); - - /** - * Finds a face with its ID. - * @param id the ID of the face. - * @return the index of the face. - */ - int findFace(int id); - - /** - * Finds a solid with its ID. - * @param id the ID of the solid. - * @return th index of the solid. - */ - int findSolid(int id); - - /** - * Finds the name of a vertex with its ID. - * @param id the ID of the vertex. - * @return the name of the vertex. - */ - const std::string findVertexName(int id); - - /** - * Finds the name of an edge with its ID. - * @param id the ID of the edge. - * @return the name of the edge. - */ - const std::string findEdgeName(int id); - - /** - * Finds the name of a face with its ID. - * @param id the ID of the face. - * @return the name of the face. - */ - const std::string findFaceName(int id); - - /** - * Finds the name of a solid with its ID. - * @param id the ID of the solid. - * @return the name of the solid. - */ - const std::string findSolidName(int id); - - /** - * Changes the name of a vertex. - * @param id the ID of the vertex. - * @param name the name to set. - */ - void changeVertexName(int id, const std::string& name) ; - - /** - * Changes the name of an edge. - * @param id the ID of the edge - * @param name the name to set. - */ - void changeEdgeName(int id, const std::string& name) ; - - /** - * Changes the name of a face. - * @param id the ID of the face. - * @param name the name to set. - */ - void changeFaceName(int id, const std::string& name) ; - - /** - * Changes the name of a solid. - * @param id the ID of the solid. - * @param name the name to set. - */ - void changeSolidName(int id, const std::string& name) ; - - private: - void initIds(); - void initListIds(const TopAbs_ShapeEnum& shapeType, GeometricElementList& eltList); - TopoDS_Shape getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, int shapeIndex) - ; - int countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType); - std::vector getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, XAO::Dimension dim); - int findElement(XAO::Dimension dim, int id) - ; - - private: - TopoDS_Shape m_shape; - }; -} + /** + * Gets the shape as a TopoDS_Shape. + * @return the TopoDS_Shape. + */ + TopoDS_Shape getTopoDS_Shape(); + + /** + * Sets the shape from a TopoDS_Shape. + * @param shape the TopoDS_Shape to set. + */ + void setTopoDS_Shape(const TopoDS_Shape &shape); + + /** + * Gives the two extrimities of an edge. + * @param edgeIndex the index of the edge. + * @param vertexA + * @param vertexB + */ + void getEdgeVertices(int edgeIndex, int &vertexA, int &vertexB); + + /** + * Gets the number of wires of a face (including holes). + * @param faceIndex the index of the face. + * @return the number of wires. + */ + int countFaceWires(int faceIndex); + + /** + * Gets the indices of the wires of the face. + * @param faceIndex the index of the face. + * @param wireIndex the index of the wire. + * @return the list of wires for the given face. + */ + std::vector getFaceEdges(int faceIndex, int wireIndex); + + /** + * Gets the number of shells of a solid (including cavities). + * @param solidIndex the index of the solid. + * @return the number of shells. + */ + int countSolidShells(int solidIndex); + + /** + * Gets the indices of the shells of the solids. + * @param solidIndex the index of the solid. + * @param shellIndex the index of the shell (for the given solid). + * @return the list of shells for the given solid. + */ + std::vector getSolidFaces(int solidIndex, int shellIndex); + + /** + * Gets the coordinates of a vertex. + * @param vertexIndex the index of the vertex. + * @param xCoord the X coordinate. + * @param yCoord the Y coordinate. + * @param zCoord the Z coordinate. + */ + void getVertexXYZ(int vertexIndex, double &xCoord, double &yCoord, + double &zCoord); + + /** + * Gets the length of an edge. + * @param index the index of the edge. + * @return the length of the edge. + */ + double getEdgeLength(int index); + + /** + * Gets the are of a face. + * @param index the index of a face. + * @return the area of the face. + */ + double getFaceArea(int index); + + /** + * Gets the volume of a solid. + * @param index the index of the solid. + * @return the volume of the solid. + */ + double getSolidVolume(int index); + + /** + * Gets the ID of a vertex. + * @param index the index of the vertex. + * @return the ID of the vertex. + */ + int getVertexID(int index); + + /** + * Gets the ID of an edge. + * @param index the index of the edge. + * @return the ID of the edge. + */ + int getEdgeID(int index); + + /** + * Gets the ID of a face. + * @param index the index of the face. + * @return the ID of the face. + */ + int getFaceID(int index); + + /** + * Gets the ID of a solid. + * @param index the index of the solid. + * @return the ID of the solid. + */ + int getSolidID(int index); + + /** + * Sets the ID of a vertex. + * @param index the index of the vertex to set. + * @param id the id to set. + */ + void setVertexID(int index, int id); + + /** + * Sets the ID of an edge. + * @param index the index of the edge to set. + * @param id the id to set. + */ + void setEdgeID(int index, int id); + + /** + * Sets the ID of a face. + * @param index the index of the face to set. + * @param id the id to set. + */ + void setFaceID(int index, int id); + + /** + * Sets the ID of a solid. + * @param index the index of the solid to set. + * @param id the id to set. + */ + void setSolidID(int index, int id); + + /** + * Finds a vertex with its ID. + * @param id the ID of the vertex. + * @return the index of the vertex. + */ + int findVertex(int id); + + /** + * Finds an edge with its ID. + * @param id the ID of the edge. + * @return the index of the edge. + */ + int findEdge(int id); + + /** + * Finds a face with its ID. + * @param id the ID of the face. + * @return the index of the face. + */ + int findFace(int id); + + /** + * Finds a solid with its ID. + * @param id the ID of the solid. + * @return th index of the solid. + */ + int findSolid(int id); + + /** + * Finds the name of a vertex with its ID. + * @param id the ID of the vertex. + * @return the name of the vertex. + */ + const std::string findVertexName(int id); + + /** + * Finds the name of an edge with its ID. + * @param id the ID of the edge. + * @return the name of the edge. + */ + const std::string findEdgeName(int id); + + /** + * Finds the name of a face with its ID. + * @param id the ID of the face. + * @return the name of the face. + */ + const std::string findFaceName(int id); + + /** + * Finds the name of a solid with its ID. + * @param id the ID of the solid. + * @return the name of the solid. + */ + const std::string findSolidName(int id); + + /** + * Changes the name of a vertex. + * @param id the ID of the vertex. + * @param name the name to set. + */ + void changeVertexName(int id, const std::string &name); + + /** + * Changes the name of an edge. + * @param id the ID of the edge + * @param name the name to set. + */ + void changeEdgeName(int id, const std::string &name); + + /** + * Changes the name of a face. + * @param id the ID of the face. + * @param name the name to set. + */ + void changeFaceName(int id, const std::string &name); + + /** + * Changes the name of a solid. + * @param id the ID of the solid. + * @param name the name to set. + */ + void changeSolidName(int id, const std::string &name); + +private: + void initIds(); + void initListIds(const TopAbs_ShapeEnum &shapeType, + GeometricElementList &eltList); + TopoDS_Shape getSubShape(const TopoDS_Shape &mainShape, + const TopAbs_ShapeEnum &shapeType, int shapeIndex); + int countGeometricalElements(const TopoDS_Shape &shape, + const TopAbs_ShapeEnum &shapeType); + std::vector getGeometricalElements(const TopoDS_Shape &shape, + const TopAbs_ShapeEnum &shapeType, + XAO::Dimension dim); + int findElement(XAO::Dimension dim, int id); + +private: + TopoDS_Shape m_shape; +}; +} // namespace XAO #endif // __XAO_BREPGEOMETRY_HXX__ diff --git a/src/XAO/XAO_DoubleField.cxx b/src/XAO/XAO_DoubleField.cxx index c2f4b84cc..a649b31f0 100644 --- a/src/XAO/XAO_DoubleField.cxx +++ b/src/XAO/XAO_DoubleField.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,37 +25,37 @@ using namespace XAO; -DoubleField::DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name) - : Field(dimension, nbElements, nbComponents, name) -{ -} +DoubleField::DoubleField(XAO::Dimension dimension, int nbElements, + int nbComponents, const std::string &name) + : Field(dimension, nbElements, nbComponents, name) {} -Step* DoubleField::addNewStep(int step) +Step *DoubleField::addNewStep(int step) { - return addStep(step, 0); + return addStep(step, 0); } -DoubleStep* DoubleField::addStep(int step) +DoubleStep *DoubleField::addStep(int step) { - return addStep(step, 0); + return addStep(step, 0); } -DoubleStep* DoubleField::addStep(int step, int stamp) +DoubleStep *DoubleField::addStep(int step, int stamp) { - if (hasStep(step)) - throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); + if (hasStep(step)) + throw XAO_Exception(MsgBuilder() + << "Step with number " << step << " already exists."); - DoubleStep* bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents); - m_steps.push_back(bstep); - return bstep; + DoubleStep *bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents); + m_steps.push_back(bstep); + return bstep; } -DoubleStep* DoubleField::getStep(int index) +DoubleStep *DoubleField::getStep(int index) { - checkStepIndex(index); - return (DoubleStep*)m_steps[index]; + checkStepIndex(index); + return (DoubleStep *)m_steps[index]; } diff --git a/src/XAO/XAO_DoubleField.hxx b/src/XAO/XAO_DoubleField.hxx index 1c0584f61..689f8cfd0 100644 --- a/src/XAO/XAO_DoubleField.hxx +++ b/src/XAO/XAO_DoubleField.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,59 +25,57 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" -#include "XAO_Field.hxx" #include "XAO_DoubleStep.hxx" +#include "XAO_Field.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif +namespace XAO { +/** + * @class DoubleField + * Represents a field with double values. + */ +class XAO_EXPORT DoubleField : public Field { +public: + /** + * Constructor. + * @param dimension the dimension of the field. + * @param nbElements the number of elements. + * @param nbComponents the number of components. + * @param name the name of the field. + */ + DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents, + const std::string &name); -namespace XAO -{ - /** - * @class DoubleField - * Represents a field with double values. - */ - class XAO_EXPORT DoubleField : public Field - { - public: - /** - * Constructor. - * @param dimension the dimension of the field. - * @param nbElements the number of elements. - * @param nbComponents the number of components. - * @param name the name of the field. - */ - DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - - virtual XAO::Type getType() { return XAO::DOUBLE; } + virtual XAO::Type getType() { return XAO::DOUBLE; } - virtual Step* addNewStep(int step) ; + virtual Step *addNewStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @return the newly created step. - */ - DoubleStep* addStep(int step) ; + /** + * Adds a new step. + * @param step the number of the step. + * @return the newly created step. + */ + DoubleStep *addStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @param stamp the stamp of the step. - * @return the newly created step. - */ - DoubleStep* addStep(int step, int stamp) ; + /** + * Adds a new step. + * @param step the number of the step. + * @param stamp the stamp of the step. + * @return the newly created step. + */ + DoubleStep *addStep(int step, int stamp); - /** - * Gets the step of given index. - * @param index the index. - * @return the step for the given index. - */ - DoubleStep* getStep(int index) ; - }; -} + /** + * Gets the step of given index. + * @param index the index. + * @return the step for the given index. + */ + DoubleStep *getStep(int index); +}; +} // namespace XAO #endif /* __XAO_DOUBLEFIELD_HXX__ */ diff --git a/src/XAO/XAO_DoubleStep.cxx b/src/XAO/XAO_DoubleStep.cxx index 85ff2b5d2..ff7ab0f0b 100644 --- a/src/XAO/XAO_DoubleStep.cxx +++ b/src/XAO/XAO_DoubleStep.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -23,126 +24,121 @@ using namespace XAO; -DoubleStep::DoubleStep(int step, int stamp, int nbElements, int nbComponents) -{ - m_nbElements = nbElements; - m_nbComponents = nbComponents; - m_step = step; - m_stamp = stamp; - - m_values.reserve(m_nbElements); - for (int i = 0; i < m_nbElements; ++i) - { - std::vector row; - row.reserve(m_nbComponents); - for (int j = 0; j < m_nbComponents; ++j) - row.push_back(0); - m_values.push_back(row); - } +DoubleStep::DoubleStep(int step, int stamp, int nbElements, int nbComponents) { + m_nbElements = nbElements; + m_nbComponents = nbComponents; + m_step = step; + m_stamp = stamp; + + m_values.reserve(m_nbElements); + for (int i = 0; i < m_nbElements; ++i) { + std::vector row; + row.reserve(m_nbComponents); + for (int j = 0; j < m_nbComponents; ++j) + row.push_back(0); + m_values.push_back(row); + } } -std::vector DoubleStep::getValues() -{ - std::vector result; - result.reserve(m_nbElements * m_nbComponents); - - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.insert(result.end(), eltValues.begin(), eltValues.end()); - } +std::vector DoubleStep::getValues() { + std::vector result; + result.reserve(m_nbElements * m_nbComponents); - return result; + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.insert(result.end(), eltValues.begin(), eltValues.end()); + } + + return result; } std::vector DoubleStep::getElement(int element) { - checkElementIndex(element); + checkElementIndex(element); - std::vector result(m_values[element]); - return result; + std::vector result(m_values[element]); + return result; } std::vector DoubleStep::getComponent(int component) { - checkComponentIndex(component); + checkComponentIndex(component); - std::vector result; - result.reserve(m_nbElements); + std::vector result; + result.reserve(m_nbElements); - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.push_back(eltValues[component]); - } + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.push_back(eltValues[component]); + } - return result; + return result; } double DoubleStep::getValue(int element, int component) { - checkElementIndex(element); - checkComponentIndex(component); + checkElementIndex(element); + checkComponentIndex(component); - return m_values[element][component]; + return m_values[element][component]; } const std::string DoubleStep::getStringValue(int element, int component) { - return XaoUtils::doubleToString(getValue(element, component)); + return XaoUtils::doubleToString(getValue(element, component)); } -void DoubleStep::setValues(const std::vector& values) +void DoubleStep::setValues(const std::vector &values) { - checkNbValues(values.size()); - - for (int i = 0; i < m_nbElements; ++i) - { - for (int j = 0; j < m_nbComponents; ++j) - { - m_values[i][j] = values[i * m_nbComponents + j]; - } + checkNbValues(values.size()); + + for (int i = 0; i < m_nbElements; ++i) { + for (int j = 0; j < m_nbComponents; ++j) { + m_values[i][j] = values[i * m_nbComponents + j]; } + } } -void DoubleStep::setElement(int element, const std::vector& elements) +void DoubleStep::setElement(int element, const std::vector &elements) { - checkElementIndex(element); - checkNbComponents(elements.size()); + checkElementIndex(element); + checkNbComponents(elements.size()); - for (int i = 0; i < m_nbComponents; ++i) - m_values[element][i] = elements[i]; + for (int i = 0; i < m_nbComponents; ++i) + m_values[element][i] = elements[i]; } -void DoubleStep::setComponent(int component, const std::vector& components) +void DoubleStep::setComponent(int component, + const std::vector &components) { - checkElementIndex(component); - checkNbElements(components.size()); + checkElementIndex(component); + checkNbElements(components.size()); - for (int i = 0; i < m_nbElements; ++i) - m_values[i][component] = components[i]; + for (int i = 0; i < m_nbElements; ++i) + m_values[i][component] = components[i]; } void DoubleStep::setValue(int element, int component, double value) { - checkElementIndex(element); - checkComponentIndex(component); + checkElementIndex(element); + checkComponentIndex(component); - m_values[element][component] = value; + m_values[element][component] = value; } -void DoubleStep::setStringValue(int element, int component, const std::string& value) +void DoubleStep::setStringValue(int element, int component, + const std::string &value) { - setValue(element, component, XaoUtils::stringToDouble(value)); + setValue(element, component, XaoUtils::stringToDouble(value)); } diff --git a/src/XAO/XAO_DoubleStep.hxx b/src/XAO/XAO_DoubleStep.hxx index dc1b18834..62153e3b6 100644 --- a/src/XAO/XAO_DoubleStep.hxx +++ b/src/XAO/XAO_DoubleStep.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,97 +25,94 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Step.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif - -namespace XAO -{ - /** - * @class DoubleStep - * Step with double values. - */ - class XAO_EXPORT DoubleStep : public Step - { - public: - /** - * Constructor. - * @param step the step number. - * @param stamp the stamp of the step. - * @param nbElements the number elements of the geometry. - * @param nbComponents the number of components of the field. - */ - DoubleStep(int step, int stamp, int nbElements, int nbComponents); - - virtual XAO::Type getType() { return XAO::DOUBLE; } - - /** - * Gets all the values of the step as a list. - * @return a vector containing all the values of the step. - */ - std::vector getValues(); - - /** - * Gets all the values for a given element. - * @param element the index of the element. - * @return a vector containing all the values for the given element. - */ - std::vector getElement(int element) ; - - /** - * Gets all the values for a given component. - * @param component the index of the component. - * @return a vector containing all the values for the given component. - */ - std::vector getComponent(int component) ; - - /** - * Gets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @return the value for the given element and component. - */ - double getValue(int element, int component) ; - - /** - * Sets all the values from a list. - * @param values the list of values to set. - */ - void setValues(const std::vector& values) ; - - /** - * Sets the values for an element. - * @param element the index of the element to set. - * @param elements the values to set. - */ - void setElement(int element, const std::vector& elements) ; - - /** - * Sets the values for a component. - * @param component the index of the component to set. - * @param components the values to set. - */ - void setComponent(int component, const std::vector& components) ; - - /** - * Sets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @param value the value. - */ - void setValue(int element, int component, double value) ; - - virtual const std::string getStringValue(int element, int component) ; - virtual void setStringValue(int element, int component, const std::string& value) ; - - private: - std::vector< std::vector > m_values; - }; -} - +namespace XAO { +/** + * @class DoubleStep + * Step with double values. + */ +class XAO_EXPORT DoubleStep : public Step { +public: + /** + * Constructor. + * @param step the step number. + * @param stamp the stamp of the step. + * @param nbElements the number elements of the geometry. + * @param nbComponents the number of components of the field. + */ + DoubleStep(int step, int stamp, int nbElements, int nbComponents); + + virtual XAO::Type getType() { return XAO::DOUBLE; } + + /** + * Gets all the values of the step as a list. + * @return a vector containing all the values of the step. + */ + std::vector getValues(); + + /** + * Gets all the values for a given element. + * @param element the index of the element. + * @return a vector containing all the values for the given element. + */ + std::vector getElement(int element); + + /** + * Gets all the values for a given component. + * @param component the index of the component. + * @return a vector containing all the values for the given component. + */ + std::vector getComponent(int component); + + /** + * Gets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @return the value for the given element and component. + */ + double getValue(int element, int component); + + /** + * Sets all the values from a list. + * @param values the list of values to set. + */ + void setValues(const std::vector &values); + + /** + * Sets the values for an element. + * @param element the index of the element to set. + * @param elements the values to set. + */ + void setElement(int element, const std::vector &elements); + + /** + * Sets the values for a component. + * @param component the index of the component to set. + * @param components the values to set. + */ + void setComponent(int component, const std::vector &components); + + /** + * Sets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @param value the value. + */ + void setValue(int element, int component, double value); + + virtual const std::string getStringValue(int element, int component); + virtual void setStringValue(int element, int component, + const std::string &value); + +private: + std::vector> m_values; +}; +} // namespace XAO #endif /* __XAO_DOUBLESTEP_HXX__ */ diff --git a/src/XAO/XAO_Exception.hxx b/src/XAO/XAO_Exception.hxx index f0f1bed7e..0e0fd6fb2 100644 --- a/src/XAO/XAO_Exception.hxx +++ b/src/XAO/XAO_Exception.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,33 +25,26 @@ #include "XAO.hxx" #include -namespace XAO -{ - /** - * \class XAO_Exception - * Exception for XAO operations. - */ - class XAO_EXPORT XAO_Exception : public std::exception - { - public: - /** - * Default constructor. - * @param message the exception message. - */ - XAO_Exception(const char* message) : m_message(message) - { - } +namespace XAO { +/** + * \class XAO_Exception + * Exception for XAO operations. + */ +class XAO_EXPORT XAO_Exception : public std::exception { +public: + /** + * Default constructor. + * @param message the exception message. + */ + XAO_Exception(const char *message) : m_message(message) {} - virtual ~XAO_Exception() noexcept {}; + virtual ~XAO_Exception() noexcept {}; - /** - * Returns the error message. - * @return the error message. - */ - virtual const char* what() const noexcept - { - return m_message; - } + /** + * Returns the error message. + * @return the error message. + */ + virtual const char *what() const noexcept { return m_message; } #ifdef SWIG %extend @@ -62,9 +56,9 @@ namespace XAO } #endif - private: - const char* m_message; - }; -} +private: + const char *m_message; +}; +} // namespace XAO #endif /* __XAO_EXCEPTION_HXX__ */ diff --git a/src/XAO/XAO_Field.cxx b/src/XAO/XAO_Field.cxx index 1af1110f2..dcb5c2bfb 100644 --- a/src/XAO/XAO_Field.cxx +++ b/src/XAO/XAO_Field.cxx @@ -14,118 +14,104 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) -#include #include +#include -#include "XAO_Xao.hxx" -#include "XAO_Field.hxx" #include "XAO_BooleanField.hxx" -#include "XAO_IntegerField.hxx" #include "XAO_DoubleField.hxx" +#include "XAO_Field.hxx" +#include "XAO_IntegerField.hxx" #include "XAO_StringField.hxx" +#include "XAO_Xao.hxx" #include "XAO_XaoUtils.hxx" using namespace XAO; // ------------------------------------------------------- -Field::Field(XAO::Dimension dimension, - int nbElements, int nbComponents, const std::string& name) - : m_name(name), m_dimension(dimension), - m_nbComponents(nbComponents), m_components(nbComponents, ""), - m_nbElements(nbElements) -{ -} +Field::Field(XAO::Dimension dimension, int nbElements, int nbComponents, + const std::string &name) + : m_name(name), m_dimension(dimension), m_nbComponents(nbComponents), + m_components(nbComponents, ""), m_nbElements(nbElements) {} -Field::~Field() -{ +Field::~Field() { for (unsigned int i = 0; i < m_steps.size(); ++i) delete m_steps[i]; } -Field* Field::createField(XAO::Type type, XAO::Dimension dimension, - int nbElements, int nbComponents, const std::string& name) -{ - if (type == XAO::BOOLEAN) - return new BooleanField(dimension, nbElements, nbComponents, name); - if (type == XAO::INTEGER) - return new IntegerField(dimension, nbElements, nbComponents, name); - if (type == XAO::DOUBLE) - return new DoubleField(dimension, nbElements, nbComponents, name); - if (type == XAO::STRING) - return new StringField(dimension, nbElements, nbComponents, name); - - throw XAO_Exception(MsgBuilder() << "Bad Type: " << type); +Field *Field::createField(XAO::Type type, XAO::Dimension dimension, + int nbElements, int nbComponents, + const std::string &name) { + if (type == XAO::BOOLEAN) + return new BooleanField(dimension, nbElements, nbComponents, name); + if (type == XAO::INTEGER) + return new IntegerField(dimension, nbElements, nbComponents, name); + if (type == XAO::DOUBLE) + return new DoubleField(dimension, nbElements, nbComponents, name); + if (type == XAO::STRING) + return new StringField(dimension, nbElements, nbComponents, name); + + throw XAO_Exception(MsgBuilder() << "Bad Type: " << type); } -const std::string Field::getComponentName(int index) -{ - checkComponent(index); - return m_components[index]; +const std::string Field::getComponentName(int index) { + checkComponent(index); + return m_components[index]; } -void Field::setComponentName(int index, const std::string& name) -{ - checkComponent(index); - m_components[index] = name; +void Field::setComponentName(int index, const std::string &name) { + checkComponent(index); + m_components[index] = name; } -void Field::setComponentsNames(const std::vector& names) -{ - for (unsigned int i = 0; i < names.size(); ++i) - { - if ((int)i < m_nbComponents) - m_components[i] = names[i]; - } +void Field::setComponentsNames(const std::vector &names) { + for (unsigned int i = 0; i < names.size(); ++i) { + if ((int)i < m_nbComponents) + m_components[i] = names[i]; + } } -bool Field::removeStep(Step* step) -{ - std::vector::iterator it = m_steps.begin(); - for (; it != m_steps.end(); ++it) - { - Step* current = *it; - if (step == current) - { - m_steps.erase(it); - return true; - } +bool Field::removeStep(Step *step) { + std::vector::iterator it = m_steps.begin(); + for (; it != m_steps.end(); ++it) { + Step *current = *it; + if (step == current) { + m_steps.erase(it); + return true; } + } - return false; + return false; } -bool Field::hasStep(int step) -{ - std::vector::iterator it = m_steps.begin(); - for (; it != m_steps.end(); ++it) - { - Step* current = *it; - if (current->getStep() == step) - return true; - } +bool Field::hasStep(int step) { + std::vector::iterator it = m_steps.begin(); + for (; it != m_steps.end(); ++it) { + Step *current = *it; + if (current->getStep() == step) + return true; + } - return false; + return false; } -void Field::checkComponent(int component) -{ - if (component < m_nbComponents && component >= 0) - return; +void Field::checkComponent(int component) { + if (component < m_nbComponents && component >= 0) + return; - throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, " - << m_nbComponents-1 << "]: " << component); + throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, " + << m_nbComponents - 1 << "]: " << component); } -void Field::checkStepIndex(int step) -{ +void Field::checkStepIndex(int step) { if (step < (int)m_steps.size() && step >= 0) - return; + return; - throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, " - << m_steps.size()-1 << "]: " << step); + throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, " + << m_steps.size() - 1 << "]: " << step); } diff --git a/src/XAO/XAO_Field.hxx b/src/XAO/XAO_Field.hxx index 1433bbc22..ba1f02cb1 100644 --- a/src/XAO/XAO_Field.hxx +++ b/src/XAO/XAO_Field.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -25,194 +26,173 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Step.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4290) // Warning Exception ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif - -namespace XAO -{ - typedef std::vector::iterator stepIterator; - - /** - * @class Field - * A geometrical Field. - */ - class XAO_EXPORT Field - { - protected: - /** - * Constructor. - * @param dimension the dimension of the field. - * @param nbElements the number of elements. - * @param nbComponents the number of components. - * @param name the name of the field. - */ - Field(XAO::Dimension dimension, - int nbElements, int nbComponents, const std::string& name); - - public: - /** - * Creates a Field of the given type. - * @param type the type of the field to create. - * @param dimension the dimension. - * @param nbElements the number of geometrical elements. - * @param nbComponents the number of components. - * @name the name of the field. - * @return the created field. - */ - static Field* createField(XAO::Type type, XAO::Dimension dimension, - int nbElements, int nbComponents, - const std::string& name = std::string("")); - - /** - * Destructor. - */ - virtual ~Field(); - - /** - * Gets the Type of the field. - * @return the Type of the field. - */ - virtual XAO::Type getType() = 0; - - /** - * Gets the name of the Field. - * @return the name of the Field. - */ - const std::string getName() const - { - return m_name; - } - - /** - * Sets the name of the Field. - * @param name the name to set. - */ - void setName(const std::string& name) - { - m_name = name; - } - - /** - * Gets the Dimension of the Field. - * @return the Dimension of the Field. - */ - XAO::Dimension getDimension() const - { - return m_dimension; - } - - /** - * Gets the number of elements of each step. - * @return the number of elements of each step. - */ - int countElements() const - { - return m_nbElements; - } - - /** - * Gets the number of components. - * @return the number of components. - */ - int countComponents() const - { - return m_nbComponents; - } - - /** - * Gets the number of values for each step. - * @return the number of values for each step. - */ - int countValues() const - { - return m_nbElements * m_nbComponents; - } - - /** - * Gets the number of the steps. - * @return the number of steps. - */ - int countSteps() const { return m_steps.size(); } - - /** - * Gets the name of a component. - * @param index the index of the component to get. - * @return the name of the component for the given index. - */ - const std::string getComponentName(int index); - - /** - * Sets the name of a component. - * @param componentIndex the index of the component to set. - * @param name the name to set. - */ - void setComponentName(int componentIndex, const std::string& name); - - /** - * Sets the name of the components. - * @param names the names to set. - */ - void setComponentsNames(const std::vector& names); - - /** - * Adds a new step of the same type than the field. - * @param number the numer of the step. - * @return the new create step. - */ - virtual Step* addNewStep(int number) = 0; - - /** - * Remove a step. - * @param step the step to remove. - * @return true if the step has been removed, false otherwise. - */ - bool removeStep(Step* step); - - /** - * Verifies if the field has a step with the given step number. - * @param step the step number. - * @return true if the field has a step for the given number. - */ - bool hasStep(int step); - - /** - * Returns the first step. - * @return an iterator on the first step. - */ - stepIterator begin() { return m_steps.begin(); } - - /** - * Returns the last step. - * @return an iterator on the last step. - */ - stepIterator end() { return m_steps.end(); } - - protected: - void checkComponent(int component) ; - void checkStepIndex(int step) ; - - protected: - /** The name of the Field. */ - std::string m_name; - /** The dimension of the Field. */ - XAO::Dimension m_dimension; - - /** The number of components. */ - int m_nbComponents; - /** The components of the field. */ - std::vector m_components; - /** The number of elements. */ - int m_nbElements; - - /** The list of steps. */ - std::vector m_steps; - }; -} +namespace XAO { +typedef std::vector::iterator stepIterator; + +/** + * @class Field + * A geometrical Field. + */ +class XAO_EXPORT Field { +protected: + /** + * Constructor. + * @param dimension the dimension of the field. + * @param nbElements the number of elements. + * @param nbComponents the number of components. + * @param name the name of the field. + */ + Field(XAO::Dimension dimension, int nbElements, int nbComponents, + const std::string &name); + +public: + /** + * Creates a Field of the given type. + * @param type the type of the field to create. + * @param dimension the dimension. + * @param nbElements the number of geometrical elements. + * @param nbComponents the number of components. + * @name the name of the field. + * @return the created field. + */ + static Field *createField(XAO::Type type, XAO::Dimension dimension, + int nbElements, int nbComponents, + const std::string &name = std::string("")); + + /** + * Destructor. + */ + virtual ~Field(); + + /** + * Gets the Type of the field. + * @return the Type of the field. + */ + virtual XAO::Type getType() = 0; + + /** + * Gets the name of the Field. + * @return the name of the Field. + */ + const std::string getName() const { return m_name; } + + /** + * Sets the name of the Field. + * @param name the name to set. + */ + void setName(const std::string &name) { m_name = name; } + + /** + * Gets the Dimension of the Field. + * @return the Dimension of the Field. + */ + XAO::Dimension getDimension() const { return m_dimension; } + + /** + * Gets the number of elements of each step. + * @return the number of elements of each step. + */ + int countElements() const { return m_nbElements; } + + /** + * Gets the number of components. + * @return the number of components. + */ + int countComponents() const { return m_nbComponents; } + + /** + * Gets the number of values for each step. + * @return the number of values for each step. + */ + int countValues() const { return m_nbElements * m_nbComponents; } + + /** + * Gets the number of the steps. + * @return the number of steps. + */ + int countSteps() const { return m_steps.size(); } + + /** + * Gets the name of a component. + * @param index the index of the component to get. + * @return the name of the component for the given index. + */ + const std::string getComponentName(int index); + + /** + * Sets the name of a component. + * @param componentIndex the index of the component to set. + * @param name the name to set. + */ + void setComponentName(int componentIndex, const std::string &name); + + /** + * Sets the name of the components. + * @param names the names to set. + */ + void setComponentsNames(const std::vector &names); + + /** + * Adds a new step of the same type than the field. + * @param number the numer of the step. + * @return the new create step. + */ + virtual Step *addNewStep(int number) = 0; + + /** + * Remove a step. + * @param step the step to remove. + * @return true if the step has been removed, false otherwise. + */ + bool removeStep(Step *step); + + /** + * Verifies if the field has a step with the given step number. + * @param step the step number. + * @return true if the field has a step for the given number. + */ + bool hasStep(int step); + + /** + * Returns the first step. + * @return an iterator on the first step. + */ + stepIterator begin() { return m_steps.begin(); } + + /** + * Returns the last step. + * @return an iterator on the last step. + */ + stepIterator end() { return m_steps.end(); } + +protected: + void checkComponent(int component); + void checkStepIndex(int step); + +protected: + /** The name of the Field. */ + std::string m_name; + /** The dimension of the Field. */ + XAO::Dimension m_dimension; + + /** The number of components. */ + int m_nbComponents; + /** The components of the field. */ + std::vector m_components; + /** The number of elements. */ + int m_nbElements; + + /** The list of steps. */ + std::vector m_steps; +}; +} // namespace XAO #endif diff --git a/src/XAO/XAO_GeometricElement.cxx b/src/XAO/XAO_GeometricElement.cxx index d119f1846..02b9a52c0 100644 --- a/src/XAO/XAO_GeometricElement.cxx +++ b/src/XAO/XAO_GeometricElement.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -23,101 +24,78 @@ using namespace XAO; - -GeometricElement::GeometricElement() -{ - m_name = ""; - m_reference = ""; +GeometricElement::GeometricElement() { + m_name = ""; + m_reference = ""; } -GeometricElement::GeometricElement(const std::string& name, const std::string& reference) -{ - m_name = name; - m_reference = reference; +GeometricElement::GeometricElement(const std::string &name, + const std::string &reference) { + m_name = name; + m_reference = reference; } -GeometricElement::~GeometricElement() -{ -} +GeometricElement::~GeometricElement() {} -bool GeometricElement::hasName() -{ - return !m_name.empty(); -} +bool GeometricElement::hasName() { return !m_name.empty(); } -GeometricElementList::GeometricElementList() -{ - setSize(0); -} +GeometricElementList::GeometricElementList() { setSize(0); } -GeometricElementList::GeometricElementList(int count) -{ - setSize(count); -} +GeometricElementList::GeometricElementList(int count) { setSize(count); } -void GeometricElementList::setSize(int nb) -{ - m_count = nb; - m_elements.clear(); - for (int i = 0; i < nb; ++i) - { - m_elements[i] = GeometricElement(); - } +void GeometricElementList::setSize(int nb) { + m_count = nb; + m_elements.clear(); + for (int i = 0; i < nb; ++i) { + m_elements[i] = GeometricElement(); + } } -void GeometricElementList::checkElementIndex(int index) const -{ - if (m_count >= 0 && index < m_count) - return; +void GeometricElementList::checkElementIndex(int index) const { + if (m_count >= 0 && index < m_count) + return; - throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, " - << m_count-1 << "]: " << index); + throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, " + << m_count - 1 << "]: " << index); } -void GeometricElementList::setElement(int index, const std::string& name, const std::string& reference) -{ - checkElementIndex(index); - m_elements[index].setName(name); - m_elements[index].setReference(reference); +void GeometricElementList::setElement(int index, const std::string &name, + const std::string &reference) { + checkElementIndex(index); + m_elements[index].setName(name); + m_elements[index].setReference(reference); } -const std::string GeometricElementList::getName(int index) -{ - checkElementIndex(index); - return m_elements[index].getName(); +const std::string GeometricElementList::getName(int index) { + checkElementIndex(index); + return m_elements[index].getName(); } -void GeometricElementList::setName(int index, const std::string& name) -{ - checkElementIndex(index); - m_elements[index].setName(name); +void GeometricElementList::setName(int index, const std::string &name) { + checkElementIndex(index); + m_elements[index].setName(name); } -bool GeometricElementList::hasName(int index) -{ - checkElementIndex(index); - return m_elements[index].hasName(); +bool GeometricElementList::hasName(int index) { + checkElementIndex(index); + return m_elements[index].hasName(); } -const std::string GeometricElementList::getReference(int index) -{ - checkElementIndex(index); - return m_elements[index].getReference(); +const std::string GeometricElementList::getReference(int index) { + checkElementIndex(index); + return m_elements[index].getReference(); } -void GeometricElementList::setReference(int index, const std::string& name) -{ - checkElementIndex(index); - m_elements[index].setReference(name); +void GeometricElementList::setReference(int index, const std::string &name) { + checkElementIndex(index); + m_elements[index].setReference(name); } -int GeometricElementList::getIndexByReference(const std::string& ref) -{ - for (int index = 0; index < m_count; ++index) - { - if (ref == m_elements[index].getReference()) - return index; - } +int GeometricElementList::getIndexByReference(const std::string &ref) { + for (int index = 0; index < m_count; ++index) { + if (ref == m_elements[index].getReference()) + return index; + } - throw XAO_Exception(MsgBuilder() << "Reference not found: " << ref); + throw XAO_Exception(MsgBuilder() << "Reference not found: " << ref); } diff --git a/src/XAO/XAO_GeometricElement.hxx b/src/XAO/XAO_GeometricElement.hxx index bba862545..b66394189 100644 --- a/src/XAO/XAO_GeometricElement.hxx +++ b/src/XAO/XAO_GeometricElement.hxx @@ -14,208 +14,195 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) #ifndef __XAO_GEOMETRICELEMENT_HXX__ #define __XAO_GEOMETRICELEMENT_HXX__ -#include #include +#include #include "XAO.hxx" #include "XAO_Exception.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4290) // Warning Exception ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif - -namespace XAO -{ - /** - * \class GeometricElement - * Generic class to manipulate a topologic element (vertex, edge, face or solid). - */ - class XAO_EXPORT GeometricElement - { - public: - /** - * Default constructor. - */ - GeometricElement(); - /** - * Constructor with name and reference. - * \param name the name of the element. - * \param reference the reference of the element. - */ - GeometricElement(const std::string& name, const std::string& reference); - /** - * Destructor. - */ - virtual ~GeometricElement(); - - /** - * Gets the name of the element. - * \return the name. - */ - const std::string getName() - { - return m_name; - } - /** - * Sets the name of the element - * \param name the name to set. - */ - void setName(const std::string& name) - { - m_name = name; - } - - /** - * Checks if the element has a name. - * @return true if the element has a name, false otherwise. - */ - bool hasName(); - - /** - * Gets the reference of the element. - * \return the reference. - */ - const std::string getReference() - { - return m_reference; - } - /** - * Sets the reference of the element. - * \param reference the reference to set. - */ - void setReference(const std::string& reference) - { - m_reference = reference; - } - - private: - /** The name of the element. */ - std::string m_name; - /** The reference of the element. */ - std::string m_reference; - }; - - /** - * \class GeometricElementList - * Generic class to manipulate a list of topologic element. - */ - class XAO_EXPORT GeometricElementList - { - public: - /** - * Default constructor. - */ - GeometricElementList(); - - /** - * Constructor with size. - * \param nb the size to set. - */ - GeometricElementList(int nb); - - /** - * Destructor. - */ - virtual ~GeometricElementList() {} - - /** - * Gets the size of the list. - * \return the size of the list. - */ - int getSize() const { return m_count; } - - /** - * Sets the size of the list. - * \param nb the size to set. - * \warning the list will be cleared. - */ - void setSize(int nb); - - /** - * Sets the name and the reference of an element. - * \param index the index of the element to set. - * \param name the name to set. - * \param reference the reference to set. - * \throw XAO_Exception if index is bigger than the size of the list. - */ - void setElement(int index, const std::string& name, const std::string& reference); - /** - * Gets the name of an element. - * \param index the index of the element to set. - * \return the name of the element with the given index. - * \throw XAO_Exception if index is bigger than the size of the list. - */ - const std::string getName(int index); - /** - * Sets the name of an element. - * \param index the index of the element. - * \param name the name to set. - * \throw XAO_Exception if index is bigger than the size of the list. - */ - void setName(int index, const std::string& name); - - /** - * Checks if an element has a name. - * @param index the index of the element. - * @return true if the element has a name, false otherwise. - */ - bool hasName(int index); - - /** - * Gets the reference of an element. - * \param index the index of the element. - * \return the reference of the element. - * \throw XAO_Exception if index is bigger than the size of the list. - */ - const std::string getReference(int index); - /** - * Sets the reference of an element. - * \param index the index of the element to set. - * \param reference the reference to set. - * \throw XAO_Exception if index is bigger than the size of the list. - */ - void setReference(int index, const std::string& reference); - - /** - * Gets the index of an element using its reference. - * \param reference the searched reference. - * \return the index of the element or -1 if no element found. - */ - int getIndexByReference(const std::string& reference); - - /** - * Iterator on the element of the list. - */ - typedef std::map::iterator iterator; - - /** - * Gets an iterator on the first element. - * @return an iterator on the first element. - */ - iterator begin() { return m_elements.begin(); } - - /** - * Gets an iterator on the last element. - * @return an iterator on the last element. - */ - iterator end() { return m_elements.end(); } - - private: - void checkElementIndex(int index) const; - - private: - int m_count; - std::map m_elements; - }; -} +namespace XAO { +/** + * \class GeometricElement + * Generic class to manipulate a topologic element (vertex, edge, face or + * solid). + */ +class XAO_EXPORT GeometricElement { +public: + /** + * Default constructor. + */ + GeometricElement(); + /** + * Constructor with name and reference. + * \param name the name of the element. + * \param reference the reference of the element. + */ + GeometricElement(const std::string &name, const std::string &reference); + /** + * Destructor. + */ + virtual ~GeometricElement(); + + /** + * Gets the name of the element. + * \return the name. + */ + const std::string getName() { return m_name; } + /** + * Sets the name of the element + * \param name the name to set. + */ + void setName(const std::string &name) { m_name = name; } + + /** + * Checks if the element has a name. + * @return true if the element has a name, false otherwise. + */ + bool hasName(); + + /** + * Gets the reference of the element. + * \return the reference. + */ + const std::string getReference() { return m_reference; } + /** + * Sets the reference of the element. + * \param reference the reference to set. + */ + void setReference(const std::string &reference) { m_reference = reference; } + +private: + /** The name of the element. */ + std::string m_name; + /** The reference of the element. */ + std::string m_reference; +}; + +/** + * \class GeometricElementList + * Generic class to manipulate a list of topologic element. + */ +class XAO_EXPORT GeometricElementList { +public: + /** + * Default constructor. + */ + GeometricElementList(); + + /** + * Constructor with size. + * \param nb the size to set. + */ + GeometricElementList(int nb); + + /** + * Destructor. + */ + virtual ~GeometricElementList() {} + + /** + * Gets the size of the list. + * \return the size of the list. + */ + int getSize() const { return m_count; } + + /** + * Sets the size of the list. + * \param nb the size to set. + * \warning the list will be cleared. + */ + void setSize(int nb); + + /** + * Sets the name and the reference of an element. + * \param index the index of the element to set. + * \param name the name to set. + * \param reference the reference to set. + * \throw XAO_Exception if index is bigger than the size of the list. + */ + void setElement(int index, const std::string &name, + const std::string &reference); + /** + * Gets the name of an element. + * \param index the index of the element to set. + * \return the name of the element with the given index. + * \throw XAO_Exception if index is bigger than the size of the list. + */ + const std::string getName(int index); + /** + * Sets the name of an element. + * \param index the index of the element. + * \param name the name to set. + * \throw XAO_Exception if index is bigger than the size of the list. + */ + void setName(int index, const std::string &name); + + /** + * Checks if an element has a name. + * @param index the index of the element. + * @return true if the element has a name, false otherwise. + */ + bool hasName(int index); + + /** + * Gets the reference of an element. + * \param index the index of the element. + * \return the reference of the element. + * \throw XAO_Exception if index is bigger than the size of the list. + */ + const std::string getReference(int index); + /** + * Sets the reference of an element. + * \param index the index of the element to set. + * \param reference the reference to set. + * \throw XAO_Exception if index is bigger than the size of the list. + */ + void setReference(int index, const std::string &reference); + + /** + * Gets the index of an element using its reference. + * \param reference the searched reference. + * \return the index of the element or -1 if no element found. + */ + int getIndexByReference(const std::string &reference); + + /** + * Iterator on the element of the list. + */ + typedef std::map::iterator iterator; + + /** + * Gets an iterator on the first element. + * @return an iterator on the first element. + */ + iterator begin() { return m_elements.begin(); } + + /** + * Gets an iterator on the last element. + * @return an iterator on the last element. + */ + iterator end() { return m_elements.end(); } + +private: + void checkElementIndex(int index) const; + +private: + int m_count; + std::map m_elements; +}; +} // namespace XAO #endif /* __XAO_GEOMETRICELEMENT_HXX__ */ diff --git a/src/XAO/XAO_Geometry.cxx b/src/XAO/XAO_Geometry.cxx index f0bb13f1e..5e048c55f 100644 --- a/src/XAO/XAO_Geometry.cxx +++ b/src/XAO/XAO_Geometry.cxx @@ -14,176 +14,160 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Nathalie Gore (OpenCascade) -#include "XAO_XaoUtils.hxx" #include "XAO_Geometry.hxx" #include "XAO_BrepGeometry.hxx" +#include "XAO_XaoUtils.hxx" using namespace XAO; -Geometry::Geometry(const std::string& name) - : m_name(name) -{ - m_readOnly = false; +Geometry::Geometry(const std::string &name) : m_name(name) { + m_readOnly = false; } -Geometry* Geometry::createGeometry(XAO::Format format) -{ - return createGeometry(format, ""); +Geometry *Geometry::createGeometry(XAO::Format format) { + return createGeometry(format, ""); } -Geometry* Geometry::createGeometry(XAO::Format format, const std::string& name) -{ - if (format == XAO::BREP) - return new BrepGeometry(name); +Geometry *Geometry::createGeometry(XAO::Format format, + const std::string &name) { + if (format == XAO::BREP) + return new BrepGeometry(name); - throw XAO_Exception(MsgBuilder() << "Geometry format not supported: " << format); + throw XAO_Exception(MsgBuilder() + << "Geometry format not supported: " << format); } -Geometry::~Geometry() -{ +Geometry::~Geometry() {} + +void Geometry::checkReadOnly() { + if (m_readOnly) + throw XAO_Exception("Geometry is read only."); } -void Geometry::checkReadOnly() -{ - if (m_readOnly) - throw XAO_Exception("Geometry is read only."); +int Geometry::countElements(XAO::Dimension dim) const { + if (dim == XAO::VERTEX) + return countVertices(); + if (dim == XAO::EDGE) + return countEdges(); + if (dim == XAO::FACE) + return countFaces(); + if (dim == XAO::SOLID) + return countSolids(); + if (dim == XAO::WHOLE) + return 1; + + throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -int Geometry::countElements(XAO::Dimension dim) const -{ - if (dim == XAO::VERTEX) - return countVertices(); - if (dim == XAO::EDGE) - return countEdges(); - if (dim == XAO::FACE) - return countFaces(); - if (dim == XAO::SOLID) - return countSolids(); - if (dim == XAO::WHOLE) - return 1; +const std::string Geometry::getElementReference(XAO::Dimension dim, int index) { + if (dim == XAO::VERTEX) + return getVertexReference(index); + if (dim == XAO::EDGE) + return getEdgeReference(index); + if (dim == XAO::FACE) + return getFaceReference(index); + if (dim == XAO::SOLID) + return getSolidReference(index); - throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); + throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -const std::string Geometry::getElementReference(XAO::Dimension dim, int index) -{ - if (dim == XAO::VERTEX) - return getVertexReference(index); - if (dim == XAO::EDGE) - return getEdgeReference(index); - if (dim == XAO::FACE) - return getFaceReference(index); - if (dim == XAO::SOLID) - return getSolidReference(index); +int Geometry::getElementIndexByReference(XAO::Dimension dim, + const std::string &reference) { + if (dim == XAO::VERTEX) + return getVertexIndexByReference(reference); + if (dim == XAO::EDGE) + return getEdgeIndexByReference(reference); + if (dim == XAO::FACE) + return getFaceIndexByReference(reference); + if (dim == XAO::SOLID) + return getSolidIndexByReference(reference); - throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); + throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -int Geometry::getElementIndexByReference(XAO::Dimension dim, const std::string& reference) -{ - if (dim == XAO::VERTEX) - return getVertexIndexByReference(reference); - if (dim == XAO::EDGE) - return getEdgeIndexByReference(reference); - if (dim == XAO::FACE) - return getFaceIndexByReference(reference); - if (dim == XAO::SOLID) - return getSolidIndexByReference(reference); +GeometricElementList::iterator Geometry::begin(XAO::Dimension dim) { + if (dim == XAO::VERTEX) + return m_vertices.begin(); + if (dim == XAO::EDGE) + return m_edges.begin(); + if (dim == XAO::FACE) + return m_faces.begin(); + if (dim == XAO::SOLID) + return m_solids.begin(); - throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); + throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -GeometricElementList::iterator Geometry::begin(XAO::Dimension dim) -{ - if (dim == XAO::VERTEX) - return m_vertices.begin(); - if (dim == XAO::EDGE) - return m_edges.begin(); - if (dim == XAO::FACE) - return m_faces.begin(); - if (dim == XAO::SOLID) - return m_solids.begin(); +GeometricElementList::iterator Geometry::end(XAO::Dimension dim) { + if (dim == XAO::VERTEX) + return m_vertices.end(); + if (dim == XAO::EDGE) + return m_edges.end(); + if (dim == XAO::FACE) + return m_faces.end(); + if (dim == XAO::SOLID) + return m_solids.end(); - throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); + throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -GeometricElementList::iterator Geometry::end(XAO::Dimension dim) -{ - if (dim == XAO::VERTEX) - return m_vertices.end(); - if (dim == XAO::EDGE) - return m_edges.end(); - if (dim == XAO::FACE) - return m_faces.end(); - if (dim == XAO::SOLID) - return m_solids.end(); +void Geometry::setCountVertices(int nb) { + checkReadOnly(); + m_vertices.setSize(nb); +} +void Geometry::setCountEdges(int nb) { + checkReadOnly(); + m_edges.setSize(nb); +} +void Geometry::setCountFaces(int nb) { + checkReadOnly(); + m_faces.setSize(nb); +} +void Geometry::setCountSolids(int nb) { + checkReadOnly(); + m_solids.setSize(nb); +} - throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); +void Geometry::setVertexReference(int index, const std::string &reference) { + checkReadOnly(); + m_vertices.setReference(index, reference); +} +void Geometry::setEdgeReference(int index, const std::string &reference) { + checkReadOnly(); + m_edges.setReference(index, reference); +} +void Geometry::setFaceReference(int index, const std::string &reference) { + checkReadOnly(); + m_faces.setReference(index, reference); +} +void Geometry::setSolidReference(int index, const std::string &reference) { + checkReadOnly(); + m_solids.setReference(index, reference); +} + +void Geometry::setVertex(int index, const std::string &name, + const std::string &reference) { + checkReadOnly(); + m_vertices.setElement(index, name, reference); +} +void Geometry::setEdge(int index, const std::string &name, + const std::string &reference) { + checkReadOnly(); + m_edges.setElement(index, name, reference); } - -void Geometry::setCountVertices(int nb) -{ - checkReadOnly(); - m_vertices.setSize(nb); -} -void Geometry::setCountEdges(int nb) -{ - checkReadOnly(); - m_edges.setSize(nb); -} -void Geometry::setCountFaces(int nb) -{ - checkReadOnly(); - m_faces.setSize(nb); -} -void Geometry::setCountSolids(int nb) -{ - checkReadOnly(); - m_solids.setSize(nb); -} - -void Geometry::setVertexReference(int index, const std::string& reference) -{ - checkReadOnly(); - m_vertices.setReference(index, reference); -} -void Geometry::setEdgeReference(int index, const std::string& reference) -{ - checkReadOnly(); - m_edges.setReference(index, reference); -} -void Geometry::setFaceReference(int index, const std::string& reference) -{ - checkReadOnly(); - m_faces.setReference(index, reference); -} -void Geometry::setSolidReference(int index, const std::string& reference) -{ - checkReadOnly(); - m_solids.setReference(index, reference); -} - -void Geometry::setVertex(int index, const std::string& name, const std::string& reference) -{ - checkReadOnly(); - m_vertices.setElement(index, name, reference); -} -void Geometry::setEdge(int index, const std::string& name, const std::string& reference) -{ - checkReadOnly(); - m_edges.setElement(index, name, reference); -} -void Geometry::setFace(int index, const std::string& name, const std::string& reference) -{ - checkReadOnly(); - m_faces.setElement(index, name, reference); -} -void Geometry::setSolid(int index, const std::string& name, const std::string& reference) -{ - checkReadOnly(); - m_solids.setElement(index, name, reference); +void Geometry::setFace(int index, const std::string &name, + const std::string &reference) { + checkReadOnly(); + m_faces.setElement(index, name, reference); +} +void Geometry::setSolid(int index, const std::string &name, + const std::string &reference) { + checkReadOnly(); + m_solids.setElement(index, name, reference); } diff --git a/src/XAO/XAO_Geometry.hxx b/src/XAO/XAO_Geometry.hxx index a408d7b89..42db68eed 100644 --- a/src/XAO/XAO_Geometry.hxx +++ b/src/XAO/XAO_Geometry.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Nathalie Gore (OpenCascade) @@ -24,152 +25,172 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Exception.hxx" #include "XAO_GeometricElement.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif - -namespace XAO -{ - /** - * @class Geometry - * Base class for geometries. - */ - class XAO_EXPORT Geometry - { - protected: - /** - * Constructor. - * @param name the name of the Geometry. - */ - Geometry(const std::string& name); - - public: - - /** - * Creates a geometry. - * @param format the format of the geometry. - * @return the created geometry. - */ - static Geometry* createGeometry(XAO::Format format) ; - - /** - * Constructor. - * Creates a geometry. - * @name name the name of the geometry. - * @return the created geometry. - */ - static Geometry* createGeometry(XAO::Format format, const std::string& name); - - /** Destructor. */ - virtual ~Geometry(); - - /** - * Gets the name of the geometry. - * @return the name of the geometry. - */ - const std::string getName() - { - return m_name; - } - /** - * Sets the name of the geometry. - * @param name the name to set. - */ - void setName(const std::string& name) - { - m_name = name; - } - - /** - * Gets the format of the geometry. - * @return the format of the geometry. - */ - virtual XAO::Format getFormat() = 0; - - virtual const std::string getShapeString() = 0; - virtual void setShapeString(const std::string& shape) = 0; - virtual void writeShapeFile(const std::string& fileName) = 0; - virtual void readShapeFile(const std::string& fileName) = 0; - - int countElements(XAO::Dimension dim) const ; - int countVertices() const { return m_vertices.getSize(); } - int countEdges() const { return m_edges.getSize(); } - int countFaces() const { return m_faces.getSize(); } - int countSolids() const { return m_solids.getSize(); } - - void setCountVertices(int nb); - void setCountEdges(int nb); - void setCountFaces(int nb); - void setCountSolids(int nb); - - const std::string getVertexName(int index) { return m_vertices.getName(index); } - const std::string getEdgeName(int index) { return m_edges.getName(index); } - const std::string getFaceName(int index) { return m_faces.getName(index); } - const std::string getSolidName(int index) { return m_solids.getName(index); } - - void setVertexName(int index, const std::string& name) { m_vertices.setName(index, name); } - void setEdgeName(int index, const std::string& name) { m_edges.setName(index, name); } - void setFaceName(int index, const std::string& name) { m_faces.setName(index, name); } - void setSolidName(int index, const std::string& name) { m_solids.setName(index, name); } - - bool hasVertexName(int index) { return m_vertices.hasName(index); } - bool hasEdgeName(int index) { return m_edges.hasName(index); } - bool hasFaceName(int index) { return m_faces.hasName(index); } - bool hasSolidName(int index) { return m_solids.hasName(index); } - - const std::string getVertexReference(int index) { return m_vertices.getReference(index); } - const std::string getEdgeReference(int index) { return m_edges.getReference(index); } - const std::string getFaceReference(int index) { return m_faces.getReference(index); } - const std::string getSolidReference(int index) { return m_solids.getReference(index); } - const std::string getElementReference(XAO::Dimension dim, int index) ; - - void setVertexReference(int index, const std::string& reference) ; - void setEdgeReference(int index, const std::string& reference) ; - void setFaceReference(int index, const std::string& reference) ; - void setSolidReference(int index, const std::string& reference) ; - - void setVertex(int index, const std::string& name, const std::string& reference) ; - void setEdge(int index, const std::string& name, const std::string& reference) ; - void setFace(int index, const std::string& name, const std::string& reference) ; - void setSolid(int index, const std::string& name, const std::string& reference) ; - - int getVertexIndexByReference(const std::string& reference) { return m_vertices.getIndexByReference(reference); } - int getEdgeIndexByReference(const std::string& reference) { return m_edges.getIndexByReference(reference); } - int getFaceIndexByReference(const std::string& reference) { return m_faces.getIndexByReference(reference); } - int getSolidIndexByReference(const std::string& reference) { return m_solids.getIndexByReference(reference); } - int getElementIndexByReference(XAO::Dimension dim, const std::string& reference) ; - - GeometricElementList::iterator begin(XAO::Dimension dim) ; - GeometricElementList::iterator end(XAO::Dimension dim) ; - - /** - * Verifies if the geometry is read only. - * @return true if the geometry is read only. - */ - bool isReadOnly() { return m_readOnly; } - - /** - * Sets the geometry read only. - */ - void setReadOnly() { m_readOnly = true; } - - protected: - void checkReadOnly() ; - - protected: - std::string m_name; - GeometricElementList m_vertices; - GeometricElementList m_edges; - GeometricElementList m_faces; - GeometricElementList m_solids; - bool m_readOnly; - - }; -} +namespace XAO { +/** + * @class Geometry + * Base class for geometries. + */ +class XAO_EXPORT Geometry { +protected: + /** + * Constructor. + * @param name the name of the Geometry. + */ + Geometry(const std::string &name); + +public: + /** + * Creates a geometry. + * @param format the format of the geometry. + * @return the created geometry. + */ + static Geometry *createGeometry(XAO::Format format); + + /** + * Constructor. + * Creates a geometry. + * @name name the name of the geometry. + * @return the created geometry. + */ + static Geometry *createGeometry(XAO::Format format, const std::string &name); + + /** Destructor. */ + virtual ~Geometry(); + + /** + * Gets the name of the geometry. + * @return the name of the geometry. + */ + const std::string getName() { return m_name; } + /** + * Sets the name of the geometry. + * @param name the name to set. + */ + void setName(const std::string &name) { m_name = name; } + + /** + * Gets the format of the geometry. + * @return the format of the geometry. + */ + virtual XAO::Format getFormat() = 0; + + virtual const std::string getShapeString() = 0; + virtual void setShapeString(const std::string &shape) = 0; + virtual void writeShapeFile(const std::string &fileName) = 0; + virtual void readShapeFile(const std::string &fileName) = 0; + + int countElements(XAO::Dimension dim) const; + int countVertices() const { return m_vertices.getSize(); } + int countEdges() const { return m_edges.getSize(); } + int countFaces() const { return m_faces.getSize(); } + int countSolids() const { return m_solids.getSize(); } + + void setCountVertices(int nb); + void setCountEdges(int nb); + void setCountFaces(int nb); + void setCountSolids(int nb); + + const std::string getVertexName(int index) { + return m_vertices.getName(index); + } + const std::string getEdgeName(int index) { return m_edges.getName(index); } + const std::string getFaceName(int index) { return m_faces.getName(index); } + const std::string getSolidName(int index) { return m_solids.getName(index); } + + void setVertexName(int index, const std::string &name) { + m_vertices.setName(index, name); + } + void setEdgeName(int index, const std::string &name) { + m_edges.setName(index, name); + } + void setFaceName(int index, const std::string &name) { + m_faces.setName(index, name); + } + void setSolidName(int index, const std::string &name) { + m_solids.setName(index, name); + } + + bool hasVertexName(int index) { return m_vertices.hasName(index); } + bool hasEdgeName(int index) { return m_edges.hasName(index); } + bool hasFaceName(int index) { return m_faces.hasName(index); } + bool hasSolidName(int index) { return m_solids.hasName(index); } + + const std::string getVertexReference(int index) { + return m_vertices.getReference(index); + } + const std::string getEdgeReference(int index) { + return m_edges.getReference(index); + } + const std::string getFaceReference(int index) { + return m_faces.getReference(index); + } + const std::string getSolidReference(int index) { + return m_solids.getReference(index); + } + const std::string getElementReference(XAO::Dimension dim, int index); + + void setVertexReference(int index, const std::string &reference); + void setEdgeReference(int index, const std::string &reference); + void setFaceReference(int index, const std::string &reference); + void setSolidReference(int index, const std::string &reference); + + void setVertex(int index, const std::string &name, + const std::string &reference); + void setEdge(int index, const std::string &name, + const std::string &reference); + void setFace(int index, const std::string &name, + const std::string &reference); + void setSolid(int index, const std::string &name, + const std::string &reference); + + int getVertexIndexByReference(const std::string &reference) { + return m_vertices.getIndexByReference(reference); + } + int getEdgeIndexByReference(const std::string &reference) { + return m_edges.getIndexByReference(reference); + } + int getFaceIndexByReference(const std::string &reference) { + return m_faces.getIndexByReference(reference); + } + int getSolidIndexByReference(const std::string &reference) { + return m_solids.getIndexByReference(reference); + } + int getElementIndexByReference(XAO::Dimension dim, + const std::string &reference); + + GeometricElementList::iterator begin(XAO::Dimension dim); + GeometricElementList::iterator end(XAO::Dimension dim); + + /** + * Verifies if the geometry is read only. + * @return true if the geometry is read only. + */ + bool isReadOnly() { return m_readOnly; } + + /** + * Sets the geometry read only. + */ + void setReadOnly() { m_readOnly = true; } + +protected: + void checkReadOnly(); + +protected: + std::string m_name; + GeometricElementList m_vertices; + GeometricElementList m_edges; + GeometricElementList m_faces; + GeometricElementList m_solids; + bool m_readOnly; +}; +} // namespace XAO #endif diff --git a/src/XAO/XAO_Group.cxx b/src/XAO/XAO_Group.cxx index d47824473..2a33eaf9a 100644 --- a/src/XAO/XAO_Group.cxx +++ b/src/XAO/XAO_Group.cxx @@ -14,46 +14,37 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade) -#include "XAO_XaoUtils.hxx" #include "XAO_Group.hxx" +#include "XAO_XaoUtils.hxx" using namespace XAO; +Group::Group(XAO::Dimension dim, int nbElements, const std::string &name) { + if (dim == XAO::WHOLE) + throw XAO_Exception("Dimension WHOLE is not valid for group."); -Group::Group(XAO::Dimension dim, int nbElements, const std::string& name) -{ - if (dim == XAO::WHOLE) - throw XAO_Exception("Dimension WHOLE is not valid for group."); - - m_name = name; - m_dimension = dim; - m_count = 0; - m_nbElements = nbElements; + m_name = name; + m_dimension = dim; + m_count = 0; + m_nbElements = nbElements; } -Group::~Group() -{ -} +Group::~Group() {} -void Group::checkIndex(int element) -{ +void Group::checkIndex(int element) { if (element < (int)m_elements.size() && element >= 0) - return; + return; - throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, " - << m_elements.size()-1 << "]: " << element); + throw XAO_Exception(MsgBuilder() + << "Index of element is out of range [0, " + << m_elements.size() - 1 << "]: " << element); } -void Group::add(int value) -{ - m_elements.insert(value); -} +void Group::add(int value) { m_elements.insert(value); } -void Group::remove(int value) -{ - m_elements.erase(value); -} +void Group::remove(int value) { m_elements.erase(value); } diff --git a/src/XAO/XAO_Group.hxx b/src/XAO/XAO_Group.hxx index 00b96a09f..4de8f3874 100644 --- a/src/XAO/XAO_Group.hxx +++ b/src/XAO/XAO_Group.hxx @@ -14,145 +14,130 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade) #ifndef __XAO_GROUP_HXX__ #define __XAO_GROUP_HXX__ -#include #include +#include #include "XAO.hxx" #include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif -namespace XAO -{ - /** - * \class Group - * Class to represent a Geometrical Group. - */ - class XAO_EXPORT Group - { - public: - /** - * Constructor. - * @param dim the dimension of the group. - * @param nbElements the number of geometrical elements for the dimension in the geometry. - * @param name the name of the group. - */ - Group(XAO::Dimension dim, int nbElements, const std::string& name = std::string("")); - - /** - * Destructor. - */ - virtual ~Group(); - - /** - * Gets the name of the group. - * \return the name of the group. - */ - const std::string getName() - { - return m_name; - } - /** - * Sets the name of the group. - * \param name the name to set. - */ - void setName(const std::string& name) - { - m_name = name; - } - - /** - * Gets the dimension of the group. - * \return the dimension of the group. - */ - XAO::Dimension getDimension() - { - return m_dimension; - } - - /** - * Gets the numbers of elements in the geometry of the same type than the group. - * \return the number of elements in the associated geometry. - */ - int getNbElements() - { - return m_nbElements; - } - - /** - * Gets the number of elements in the group. - * \return the number of elements. - */ - int count() const - { - return m_elements.size(); - } - - /** - * Gets the reference of an element. - * \param index the index of the element. - * \return the reference of the element. - * \note use begin() and end() if you need to iterate. - */ - int get(int index) - { - checkIndex(index); - std::set::iterator it = m_elements.begin(); - std::advance(it, index); - return (*it); - } - - /** - * Adds an element to the group. - * \param value the index of the element to add. - */ - void add(int value); - - /** - * Removes an element from the group. - * \param value the index of the element to remove. - */ - void remove(int value); - - /** - * Gets an iterator on the first element in the group. - * @return an iterator on the first element. - */ - std::set::iterator begin() { return m_elements.begin(); } - - /** - * Gets an iterator on the last element in the group. - * @return an iterator on the last element. - */ - std::set::iterator end() { return m_elements.end(); } - - private: - /** - * Ensures that the given element is valid. - * @param element - * @throw XAO_Exception if element is bigger than the number of elements. - */ - void checkIndex(int element); - - private: - /** The name of the group. */ - std::string m_name; - /** The number of elements in the associated geometry. */ - int m_nbElements; - /** The dimension of the group. */ - XAO::Dimension m_dimension; - /** The number of elements in the group. */ - int m_count; - /** The elements of the group. */ - std::set m_elements; - }; -} +namespace XAO { +/** + * \class Group + * Class to represent a Geometrical Group. + */ +class XAO_EXPORT Group { +public: + /** + * Constructor. + * @param dim the dimension of the group. + * @param nbElements the number of geometrical elements for the dimension in + * the geometry. + * @param name the name of the group. + */ + Group(XAO::Dimension dim, int nbElements, + const std::string &name = std::string("")); + + /** + * Destructor. + */ + virtual ~Group(); + + /** + * Gets the name of the group. + * \return the name of the group. + */ + const std::string getName() { return m_name; } + /** + * Sets the name of the group. + * \param name the name to set. + */ + void setName(const std::string &name) { m_name = name; } + + /** + * Gets the dimension of the group. + * \return the dimension of the group. + */ + XAO::Dimension getDimension() { return m_dimension; } + + /** + * Gets the numbers of elements in the geometry of the same type than the + * group. \return the number of elements in the associated geometry. + */ + int getNbElements() { return m_nbElements; } + + /** + * Gets the number of elements in the group. + * \return the number of elements. + */ + int count() const { return m_elements.size(); } + + /** + * Gets the reference of an element. + * \param index the index of the element. + * \return the reference of the element. + * \note use begin() and end() if you need to iterate. + */ + int get(int index) { + checkIndex(index); + std::set::iterator it = m_elements.begin(); + std::advance(it, index); + return (*it); + } + + /** + * Adds an element to the group. + * \param value the index of the element to add. + */ + void add(int value); + + /** + * Removes an element from the group. + * \param value the index of the element to remove. + */ + void remove(int value); + + /** + * Gets an iterator on the first element in the group. + * @return an iterator on the first element. + */ + std::set::iterator begin() { return m_elements.begin(); } + + /** + * Gets an iterator on the last element in the group. + * @return an iterator on the last element. + */ + std::set::iterator end() { return m_elements.end(); } + +private: + /** + * Ensures that the given element is valid. + * @param element + * @throw XAO_Exception if element is bigger than the number of elements. + */ + void checkIndex(int element); + +private: + /** The name of the group. */ + std::string m_name; + /** The number of elements in the associated geometry. */ + int m_nbElements; + /** The dimension of the group. */ + XAO::Dimension m_dimension; + /** The number of elements in the group. */ + int m_count; + /** The elements of the group. */ + std::set m_elements; +}; +} // namespace XAO #endif diff --git a/src/XAO/XAO_IntegerField.cxx b/src/XAO/XAO_IntegerField.cxx index 547706a61..1ccc80edb 100644 --- a/src/XAO/XAO_IntegerField.cxx +++ b/src/XAO/XAO_IntegerField.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,37 +25,38 @@ using namespace XAO; -IntegerField::IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name) - : Field(dimension, nbElements, nbComponents, name) -{ -} +IntegerField::IntegerField(XAO::Dimension dimension, int nbElements, + int nbComponents, const std::string &name) + : Field(dimension, nbElements, nbComponents, name) {} -Step* IntegerField::addNewStep(int step) +Step *IntegerField::addNewStep(int step) { - return addStep(step, 0); + return addStep(step, 0); } -IntegerStep* IntegerField::addStep(int step) +IntegerStep *IntegerField::addStep(int step) { - return addStep(step, 0); + return addStep(step, 0); } -IntegerStep* IntegerField::addStep(int step, int stamp) +IntegerStep *IntegerField::addStep(int step, int stamp) { - if (hasStep(step)) - throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); - - IntegerStep* bstep = new IntegerStep(step, stamp, m_nbElements, m_nbComponents); - m_steps.push_back(bstep); - return bstep; + if (hasStep(step)) + throw XAO_Exception(MsgBuilder() + << "Step with number " << step << " already exists."); + + IntegerStep *bstep = + new IntegerStep(step, stamp, m_nbElements, m_nbComponents); + m_steps.push_back(bstep); + return bstep; } -IntegerStep* IntegerField::getStep(int index) +IntegerStep *IntegerField::getStep(int index) { - checkStepIndex(index); - return (IntegerStep*)m_steps[index]; + checkStepIndex(index); + return (IntegerStep *)m_steps[index]; } diff --git a/src/XAO/XAO_IntegerField.hxx b/src/XAO/XAO_IntegerField.hxx index 2fde69e58..52a9b5986 100644 --- a/src/XAO/XAO_IntegerField.hxx +++ b/src/XAO/XAO_IntegerField.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,59 +25,57 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Field.hxx" #include "XAO_IntegerStep.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif +namespace XAO { +/** + * @class IntegerField + * Represents a field with integer values. + */ +class XAO_EXPORT IntegerField : public Field { +public: + /** + * Constructor. + * @param dimension the dimension of the field. + * @param nbElements the number of elements. + * @param nbComponents the number of components. + * @param name the name of the field. + */ + IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents, + const std::string &name); -namespace XAO -{ - /** - * @class IntegerField - * Represents a field with integer values. - */ - class XAO_EXPORT IntegerField : public Field - { - public: - /** - * Constructor. - * @param dimension the dimension of the field. - * @param nbElements the number of elements. - * @param nbComponents the number of components. - * @param name the name of the field. - */ - IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - - virtual XAO::Type getType() { return XAO::INTEGER; } + virtual XAO::Type getType() { return XAO::INTEGER; } - virtual Step* addNewStep(int step) ; + virtual Step *addNewStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @return the newly created step. - */ - IntegerStep* addStep(int step) ; + /** + * Adds a new step. + * @param step the number of the step. + * @return the newly created step. + */ + IntegerStep *addStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @param stamp the stamp of the step. - * @return the newly created step. - */ - IntegerStep* addStep(int step, int stamp) ; + /** + * Adds a new step. + * @param step the number of the step. + * @param stamp the stamp of the step. + * @return the newly created step. + */ + IntegerStep *addStep(int step, int stamp); - /** - * Gets the step of given index. - * @param index the index of the step. - * @return the step for the given index. - */ - IntegerStep* getStep(int index) ; - }; -} + /** + * Gets the step of given index. + * @param index the index of the step. + * @return the step for the given index. + */ + IntegerStep *getStep(int index); +}; +} // namespace XAO #endif /* __XAO_INTEGERFIELD_HXX__ */ diff --git a/src/XAO/XAO_IntegerStep.cxx b/src/XAO/XAO_IntegerStep.cxx index c200fc7fa..d4cca6562 100644 --- a/src/XAO/XAO_IntegerStep.cxx +++ b/src/XAO/XAO_IntegerStep.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -23,126 +24,122 @@ using namespace XAO; -IntegerStep::IntegerStep(int step, int stamp, int nbElements, int nbComponents) -{ - m_nbElements = nbElements; - m_nbComponents = nbComponents; - m_step = step; - m_stamp = stamp; - - m_values.reserve(m_nbElements); - for (int i = 0; i < m_nbElements; ++i) - { - std::vector row; - row.reserve(m_nbComponents); - for (int j = 0; j < m_nbComponents; ++j) - row.push_back(0); - m_values.push_back(row); - } +IntegerStep::IntegerStep(int step, int stamp, int nbElements, + int nbComponents) { + m_nbElements = nbElements; + m_nbComponents = nbComponents; + m_step = step; + m_stamp = stamp; + + m_values.reserve(m_nbElements); + for (int i = 0; i < m_nbElements; ++i) { + std::vector row; + row.reserve(m_nbComponents); + for (int j = 0; j < m_nbComponents; ++j) + row.push_back(0); + m_values.push_back(row); + } } -std::vector IntegerStep::getValues() -{ - std::vector result; - result.reserve(m_nbElements * m_nbComponents); - - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.insert(result.end(), eltValues.begin(), eltValues.end()); - } +std::vector IntegerStep::getValues() { + std::vector result; + result.reserve(m_nbElements * m_nbComponents); - return result; + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.insert(result.end(), eltValues.begin(), eltValues.end()); + } + + return result; } std::vector IntegerStep::getElement(int element) { - checkElementIndex(element); + checkElementIndex(element); - std::vector result(m_values[element]); - return result; + std::vector result(m_values[element]); + return result; } std::vector IntegerStep::getComponent(int component) { - checkComponentIndex(component); + checkComponentIndex(component); - std::vector result; - result.reserve(m_nbElements); + std::vector result; + result.reserve(m_nbElements); - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.push_back(eltValues[component]); - } + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.push_back(eltValues[component]); + } - return result; + return result; } int IntegerStep::getValue(int element, int component) { - checkElementIndex(element); - checkComponentIndex(component); + checkElementIndex(element); + checkComponentIndex(component); - return m_values[element][component]; + return m_values[element][component]; } const std::string IntegerStep::getStringValue(int element, int component) { - return XaoUtils::intToString(getValue(element, component)); + return XaoUtils::intToString(getValue(element, component)); } -void IntegerStep::setValues(const std::vector& values) +void IntegerStep::setValues(const std::vector &values) { - checkNbValues(values.size()); - - for (int i = 0; i < m_nbElements; ++i) - { - for (int j = 0; j < m_nbComponents; ++j) - { - m_values[i][j] = values[i * m_nbComponents + j]; - } + checkNbValues(values.size()); + + for (int i = 0; i < m_nbElements; ++i) { + for (int j = 0; j < m_nbComponents; ++j) { + m_values[i][j] = values[i * m_nbComponents + j]; } + } } -void IntegerStep::setElement(int element, const std::vector& elements) +void IntegerStep::setElement(int element, const std::vector &elements) { - checkElementIndex(element); - checkNbComponents(elements.size()); + checkElementIndex(element); + checkNbComponents(elements.size()); - for (int i = 0; i < m_nbComponents; ++i) - m_values[element][i] = elements[i]; + for (int i = 0; i < m_nbComponents; ++i) + m_values[element][i] = elements[i]; } -void IntegerStep::setComponent(int component, const std::vector& components) +void IntegerStep::setComponent(int component, + const std::vector &components) { - checkElementIndex(component); - checkNbElements(components.size()); + checkElementIndex(component); + checkNbElements(components.size()); - for (int i = 0; i < m_nbElements; ++i) - m_values[i][component] = components[i]; + for (int i = 0; i < m_nbElements; ++i) + m_values[i][component] = components[i]; } void IntegerStep::setValue(int element, int component, int value) { - checkElementIndex(element); - checkComponentIndex(component); + checkElementIndex(element); + checkComponentIndex(component); - m_values[element][component] = value; + m_values[element][component] = value; } -void IntegerStep::setStringValue(int element, int component, const std::string& value) +void IntegerStep::setStringValue(int element, int component, + const std::string &value) { - setValue(element, component, XaoUtils::stringToInt(value)); + setValue(element, component, XaoUtils::stringToInt(value)); } diff --git a/src/XAO/XAO_IntegerStep.hxx b/src/XAO/XAO_IntegerStep.hxx index 5db53c81c..b86d29c92 100644 --- a/src/XAO/XAO_IntegerStep.hxx +++ b/src/XAO/XAO_IntegerStep.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,98 +25,95 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Step.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4290) // Warning Exception ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif - -namespace XAO -{ - /** - * @class IntegerStep - * Step with integer values. - */ - class XAO_EXPORT IntegerStep : public Step - { - public: - /** - * Constructor. - * @param step the step number. - * @param stamp the stamp of the step. - * @param nbElements the number elements of the geometry. - * @param nbComponents the number of components of the field. - */ - IntegerStep(int step, int stamp, int nbElements, int nbComponents); - - virtual XAO::Type getType() { return XAO::INTEGER; } - - /** - * Gets all the values of the step as a list. - * @return a vector containing all the values of the step. - */ - std::vector getValues(); - - /** - * Gets all the values for a given element. - * @param element the index of the element. - * @return a vector containing all the values for the given element. - */ - std::vector getElement(int element) ; - - /** - * Gets all the values for a given component. - * @param component the index of the component. - * @return a vector containing all the values for the given component. - */ - std::vector getComponent(int component) ; - - /** - * Gets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @return the value for the given element and component. - */ - int getValue(int element, int component) ; - - /** - * Sets all the values from a list. - * @param values the list of values to set. - */ - void setValues(const std::vector& values) ; - - /** - * Sets the values for an element. - * @param element the index of the element to set. - * @param elements the values to set. - */ - void setElement(int element, const std::vector& elements) ; - - /** - * Sets the values for a component. - * @param component the index of the component to set. - * @param components the values to set. - */ - void setComponent(int component, const std::vector& components) ; - - /** - * Sets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @param value the value. - */ - void setValue(int element, int component, int value) ; - - virtual const std::string getStringValue(int element, int component) ; - virtual void setStringValue(int element, int component, const std::string& value) ; - - private: - std::vector< std::vector > m_values; - }; -} - +namespace XAO { +/** + * @class IntegerStep + * Step with integer values. + */ +class XAO_EXPORT IntegerStep : public Step { +public: + /** + * Constructor. + * @param step the step number. + * @param stamp the stamp of the step. + * @param nbElements the number elements of the geometry. + * @param nbComponents the number of components of the field. + */ + IntegerStep(int step, int stamp, int nbElements, int nbComponents); + + virtual XAO::Type getType() { return XAO::INTEGER; } + + /** + * Gets all the values of the step as a list. + * @return a vector containing all the values of the step. + */ + std::vector getValues(); + + /** + * Gets all the values for a given element. + * @param element the index of the element. + * @return a vector containing all the values for the given element. + */ + std::vector getElement(int element); + + /** + * Gets all the values for a given component. + * @param component the index of the component. + * @return a vector containing all the values for the given component. + */ + std::vector getComponent(int component); + + /** + * Gets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @return the value for the given element and component. + */ + int getValue(int element, int component); + + /** + * Sets all the values from a list. + * @param values the list of values to set. + */ + void setValues(const std::vector &values); + + /** + * Sets the values for an element. + * @param element the index of the element to set. + * @param elements the values to set. + */ + void setElement(int element, const std::vector &elements); + + /** + * Sets the values for a component. + * @param component the index of the component to set. + * @param components the values to set. + */ + void setComponent(int component, const std::vector &components); + + /** + * Sets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @param value the value. + */ + void setValue(int element, int component, int value); + + virtual const std::string getStringValue(int element, int component); + virtual void setStringValue(int element, int component, + const std::string &value); + +private: + std::vector> m_values; +}; +} // namespace XAO #endif /* __XAO_INTEGERSTEP_HXX__ */ diff --git a/src/XAO/XAO_Step.cxx b/src/XAO/XAO_Step.cxx index d8f78b7f6..470f2bc2e 100644 --- a/src/XAO/XAO_Step.cxx +++ b/src/XAO/XAO_Step.cxx @@ -14,61 +14,60 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) -#include "XAO_Xao.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Step.hxx" #include "XAO_BooleanStep.hxx" -#include "XAO_IntegerStep.hxx" #include "XAO_DoubleStep.hxx" +#include "XAO_IntegerStep.hxx" #include "XAO_StringStep.hxx" +#include "XAO_Xao.hxx" +#include "XAO_XaoUtils.hxx" using namespace XAO; -void Step::checkElementIndex(int element) -{ - if (element < m_nbElements && element >= 0) - return; +void Step::checkElementIndex(int element) { + if (element < m_nbElements && element >= 0) + return; - throw XAO_Exception(MsgBuilder() << "Element index is out of range [0, " - << m_nbElements-1 << "]: " << element); + throw XAO_Exception(MsgBuilder() << "Element index is out of range [0, " + << m_nbElements - 1 << "]: " << element); } -void Step::checkComponentIndex(int component) -{ - if (component < m_nbComponents && component >= 0) - return; +void Step::checkComponentIndex(int component) { + if (component < m_nbComponents && component >= 0) + return; - throw XAO_Exception(MsgBuilder() << "Component index is out of range [0, " - << m_nbComponents-1 << "]: " << component); + throw XAO_Exception(MsgBuilder() << "Component index is out of range [0, " + << m_nbComponents - 1 << "]: " << component); } -void Step::checkNbElements(int nbElements) -{ - if (nbElements == m_nbElements) - return; +void Step::checkNbElements(int nbElements) { + if (nbElements == m_nbElements) + return; - throw XAO_Exception(MsgBuilder() << "Invalid number of elements: " << nbElements - << ", expected " << m_nbElements); + throw XAO_Exception(MsgBuilder() + << "Invalid number of elements: " << nbElements + << ", expected " << m_nbElements); } -void Step::checkNbComponents(int nbComponents) -{ - if (nbComponents == m_nbComponents) - return; +void Step::checkNbComponents(int nbComponents) { + if (nbComponents == m_nbComponents) + return; - throw XAO_Exception(MsgBuilder() << "Invalid number of components: " << nbComponents - << ", expected " << m_nbComponents); + throw XAO_Exception(MsgBuilder() + << "Invalid number of components: " << nbComponents + << ", expected " << m_nbComponents); } -void Step::checkNbValues(int nbValues) -{ - if (nbValues == m_nbElements * m_nbComponents) - return; +void Step::checkNbValues(int nbValues) { + if (nbValues == m_nbElements * m_nbComponents) + return; - throw XAO_Exception(MsgBuilder() << "Invalid number of values:" << nbValues - << ", expected " << m_nbElements * m_nbComponents); + throw XAO_Exception(MsgBuilder() + << "Invalid number of values:" << nbValues + << ", expected " << m_nbElements * m_nbComponents); } diff --git a/src/XAO/XAO_Step.hxx b/src/XAO/XAO_Step.hxx index 228183b26..cd3772761 100644 --- a/src/XAO/XAO_Step.hxx +++ b/src/XAO/XAO_Step.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -25,134 +26,131 @@ #include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif - -namespace XAO -{ - /** - * @class Step - * Base class for steps. - */ - class XAO_EXPORT Step - { - protected: - /** Default constructor. */ - Step() {} - - public: - /** - * Destructor. - */ - virtual ~Step() {} - - /** - * Gets the type of the step. - * @return - */ - virtual XAO::Type getType() = 0; - - /** - * Gets the step index. - * @return the index of the step. - */ - int getStep() { return m_step; } - - /** - * Sets the number of the step. - * @param step the index to set. - */ - void setStep(int step) { m_step = step; } - - /** - * Gets the stamp of the index. - * @return the stamp of the index. - */ - int getStamp() { return m_stamp; } - - /** - * Sets the stamp of the index. - * @param stamp the stamp to set. - */ - void setStamp(int stamp) { m_stamp = stamp; } - - /** - * Gets the number of components of the step. - * @return the number of components. - */ - int countComponents() { return m_nbComponents; } - - /** - * Gets the number of elements for the step. - * @return the number of elements. - */ - int countElements() { return m_nbElements; } - - /** - * Gets the number of values for the step. - * @return the number of values. - */ - int countValues() { return m_nbElements * m_nbComponents; } - - /** - * Gets a value as a string. - * @param element the index of the element. - * @param component the index of the component. - * @return the value as a string. - */ - virtual const std::string getStringValue(int element, int component) = 0; - - /** - * Sets a value as a string - * @param element the index of the element. - * @param component the index of the component. - * @param value the string value. - * @throw XAO_Exception if the value is not valid. - */ - virtual void setStringValue(int element, int component, const std::string& value) = 0; - - protected: - /** - * Checks that given element index is in the range of element indexes. - * @param element the index to check. - */ - void checkElementIndex(int element); - /** - * Checks that given component index is in the range of component indexes. - * @param component the index to check. - */ - void checkComponentIndex(int component); - - /** - * Checks that the given number of elements is correct. - * @param nbElements the number of elements to check. - */ - void checkNbElements(int nbElements); - - /** - * Checks that the given number of components is correct. - * @param nbComponents the number of components to check. - */ - void checkNbComponents(int nbComponents); - - /** - * checks that the given number of values is correct. - * @param nbValues the number of values to check. - */ - void checkNbValues(int nbValues); - - protected: - /** the index of the step. */ - int m_step; - /** The stamp of the step. */ - int m_stamp; - /** The number of components. */ - int m_nbComponents; - /** The number of elements. */ - int m_nbElements; - }; -} - +namespace XAO { +/** + * @class Step + * Base class for steps. + */ +class XAO_EXPORT Step { +protected: + /** Default constructor. */ + Step() {} + +public: + /** + * Destructor. + */ + virtual ~Step() {} + + /** + * Gets the type of the step. + * @return + */ + virtual XAO::Type getType() = 0; + + /** + * Gets the step index. + * @return the index of the step. + */ + int getStep() { return m_step; } + + /** + * Sets the number of the step. + * @param step the index to set. + */ + void setStep(int step) { m_step = step; } + + /** + * Gets the stamp of the index. + * @return the stamp of the index. + */ + int getStamp() { return m_stamp; } + + /** + * Sets the stamp of the index. + * @param stamp the stamp to set. + */ + void setStamp(int stamp) { m_stamp = stamp; } + + /** + * Gets the number of components of the step. + * @return the number of components. + */ + int countComponents() { return m_nbComponents; } + + /** + * Gets the number of elements for the step. + * @return the number of elements. + */ + int countElements() { return m_nbElements; } + + /** + * Gets the number of values for the step. + * @return the number of values. + */ + int countValues() { return m_nbElements * m_nbComponents; } + + /** + * Gets a value as a string. + * @param element the index of the element. + * @param component the index of the component. + * @return the value as a string. + */ + virtual const std::string getStringValue(int element, int component) = 0; + + /** + * Sets a value as a string + * @param element the index of the element. + * @param component the index of the component. + * @param value the string value. + * @throw XAO_Exception if the value is not valid. + */ + virtual void setStringValue(int element, int component, + const std::string &value) = 0; + +protected: + /** + * Checks that given element index is in the range of element indexes. + * @param element the index to check. + */ + void checkElementIndex(int element); + /** + * Checks that given component index is in the range of component indexes. + * @param component the index to check. + */ + void checkComponentIndex(int component); + + /** + * Checks that the given number of elements is correct. + * @param nbElements the number of elements to check. + */ + void checkNbElements(int nbElements); + + /** + * Checks that the given number of components is correct. + * @param nbComponents the number of components to check. + */ + void checkNbComponents(int nbComponents); + + /** + * checks that the given number of values is correct. + * @param nbValues the number of values to check. + */ + void checkNbValues(int nbValues); + +protected: + /** the index of the step. */ + int m_step; + /** The stamp of the step. */ + int m_stamp; + /** The number of components. */ + int m_nbComponents; + /** The number of elements. */ + int m_nbElements; +}; +} // namespace XAO #endif /* __XAO_STEP_HXX__ */ diff --git a/src/XAO/XAO_StringField.cxx b/src/XAO/XAO_StringField.cxx index ee760a740..d71c897e3 100644 --- a/src/XAO/XAO_StringField.cxx +++ b/src/XAO/XAO_StringField.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,37 +25,37 @@ using namespace XAO; -StringField::StringField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name) - : Field(dimension, nbElements, nbComponents, name) -{ -} +StringField::StringField(XAO::Dimension dimension, int nbElements, + int nbComponents, const std::string &name) + : Field(dimension, nbElements, nbComponents, name) {} -Step* StringField::addNewStep(int step) +Step *StringField::addNewStep(int step) { - return addStep(step, 0); + return addStep(step, 0); } -StringStep* StringField::addStep(int step) +StringStep *StringField::addStep(int step) { - return addStep(step, 0); + return addStep(step, 0); } -StringStep* StringField::addStep(int step, int stamp) +StringStep *StringField::addStep(int step, int stamp) { - if (hasStep(step)) - throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); + if (hasStep(step)) + throw XAO_Exception(MsgBuilder() + << "Step with number " << step << " already exists."); - StringStep* bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents); - m_steps.push_back(bstep); - return bstep; + StringStep *bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents); + m_steps.push_back(bstep); + return bstep; } -StringStep* StringField::getStep(int index) +StringStep *StringField::getStep(int index) { - checkStepIndex(index); - return (StringStep*)m_steps[index]; + checkStepIndex(index); + return (StringStep *)m_steps[index]; } diff --git a/src/XAO/XAO_StringField.hxx b/src/XAO/XAO_StringField.hxx index a5e22ae6f..73b779f22 100644 --- a/src/XAO/XAO_StringField.hxx +++ b/src/XAO/XAO_StringField.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -24,58 +25,57 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Field.hxx" #include "XAO_StringStep.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif -namespace XAO -{ - /** - * @class StringField - * Represents a field with string values. - */ - class XAO_EXPORT StringField : public Field - { - public: - /** - * Constructor. - * @param dimension the dimension of the field. - * @param nbElements the number of elements. - * @param nbComponents the number of components. - * @param name the name of the field. - */ - StringField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); +namespace XAO { +/** + * @class StringField + * Represents a field with string values. + */ +class XAO_EXPORT StringField : public Field { +public: + /** + * Constructor. + * @param dimension the dimension of the field. + * @param nbElements the number of elements. + * @param nbComponents the number of components. + * @param name the name of the field. + */ + StringField(XAO::Dimension dimension, int nbElements, int nbComponents, + const std::string &name); - virtual XAO::Type getType() { return XAO::STRING; } + virtual XAO::Type getType() { return XAO::STRING; } - virtual Step* addNewStep(int step) ; + virtual Step *addNewStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @return the newly created step. - */ - StringStep* addStep(int step) ; + /** + * Adds a new step. + * @param step the number of the step. + * @return the newly created step. + */ + StringStep *addStep(int step); - /** - * Adds a new step. - * @param step the number of the step. - * @param stamp the stamp of the step. - * @return the newly created step. - */ - StringStep* addStep(int step, int stamp) ; + /** + * Adds a new step. + * @param step the number of the step. + * @param stamp the stamp of the step. + * @return the newly created step. + */ + StringStep *addStep(int step, int stamp); - /** - * Gets the step of given index. - * @param index the index of the step. - * @return the step for the given index. - */ - StringStep* getStep(int index) ; - }; -} + /** + * Gets the step of given index. + * @param index the index of the step. + * @return the step for the given index. + */ + StringStep *getStep(int index); +}; +} // namespace XAO #endif /* __XAO_STRINGFIELD_HXX__ */ diff --git a/src/XAO/XAO_StringStep.cxx b/src/XAO/XAO_StringStep.cxx index 46b9f60e7..09fa6428d 100644 --- a/src/XAO/XAO_StringStep.cxx +++ b/src/XAO/XAO_StringStep.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -22,126 +23,122 @@ using namespace XAO; -StringStep::StringStep(int step, int stamp, int nbElements, int nbComponents) -{ - m_nbElements = nbElements; - m_nbComponents = nbComponents; - m_step = step; - m_stamp = stamp; - - m_values.reserve(m_nbElements); - for (int i = 0; i < m_nbElements; ++i) - { - std::vector row; - row.reserve(m_nbComponents); - for (int j = 0; j < m_nbComponents; ++j) - row.push_back(""); - m_values.push_back(row); - } +StringStep::StringStep(int step, int stamp, int nbElements, int nbComponents) { + m_nbElements = nbElements; + m_nbComponents = nbComponents; + m_step = step; + m_stamp = stamp; + + m_values.reserve(m_nbElements); + for (int i = 0; i < m_nbElements; ++i) { + std::vector row; + row.reserve(m_nbComponents); + for (int j = 0; j < m_nbComponents; ++j) + row.push_back(""); + m_values.push_back(row); + } } -std::vector StringStep::getValues() -{ - std::vector result; - result.reserve(m_nbElements * m_nbComponents); - - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.insert(result.end(), eltValues.begin(), eltValues.end()); - } +std::vector StringStep::getValues() { + std::vector result; + result.reserve(m_nbElements * m_nbComponents); - return result; + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.insert(result.end(), eltValues.begin(), eltValues.end()); + } + + return result; } std::vector StringStep::getElement(int element) { - checkElementIndex(element); + checkElementIndex(element); - std::vector result(m_values[element]); - return result; + std::vector result(m_values[element]); + return result; } std::vector StringStep::getComponent(int component) { - checkComponentIndex(component); + checkComponentIndex(component); - std::vector result; - result.reserve(m_nbElements); + std::vector result; + result.reserve(m_nbElements); - std::vector< std::vector >::iterator it; - for (it = m_values.begin(); it != m_values.end(); ++it) - { - std::vector eltValues = *it; - result.push_back(eltValues[component]); - } + std::vector>::iterator it; + for (it = m_values.begin(); it != m_values.end(); ++it) { + std::vector eltValues = *it; + result.push_back(eltValues[component]); + } - return result; + return result; } const std::string StringStep::getValue(int element, int component) { - checkElementIndex(element); - checkComponentIndex(component); + checkElementIndex(element); + checkComponentIndex(component); - return m_values[element][component]; + return m_values[element][component]; } const std::string StringStep::getStringValue(int element, int component) { - return getValue(element, component); + return getValue(element, component); } -void StringStep::setValues(const std::vector& values) +void StringStep::setValues(const std::vector &values) { - checkNbValues(values.size()); - - for (int i = 0; i < m_nbElements; ++i) - { - for (int j = 0; j < m_nbComponents; ++j) - { - m_values[i][j] = values[i * m_nbComponents + j]; - } + checkNbValues(values.size()); + + for (int i = 0; i < m_nbElements; ++i) { + for (int j = 0; j < m_nbComponents; ++j) { + m_values[i][j] = values[i * m_nbComponents + j]; } + } } -void StringStep::setElement(int element, const std::vector& elements) +void StringStep::setElement(int element, + const std::vector &elements) { - checkElementIndex(element); - checkNbComponents(elements.size()); + checkElementIndex(element); + checkNbComponents(elements.size()); - for (int i = 0; i < m_nbComponents; ++i) - m_values[element][i] = elements[i]; + for (int i = 0; i < m_nbComponents; ++i) + m_values[element][i] = elements[i]; } -void StringStep::setComponent(int component, const std::vector& components) +void StringStep::setComponent(int component, + const std::vector &components) { - checkElementIndex(component); - checkNbElements(components.size()); + checkElementIndex(component); + checkNbElements(components.size()); - for (int i = 0; i < m_nbElements; ++i) - m_values[i][component] = components[i]; + for (int i = 0; i < m_nbElements; ++i) + m_values[i][component] = components[i]; } -void StringStep::setValue(int element, int component, const std::string& value) +void StringStep::setValue(int element, int component, const std::string &value) { - checkElementIndex(element); - checkComponentIndex(component); + checkElementIndex(element); + checkComponentIndex(component); - m_values[element][component] = value; + m_values[element][component] = value; } -void StringStep::setStringValue(int element, int component, const std::string& value) +void StringStep::setStringValue(int element, int component, + const std::string &value) { - setValue(element, component, value); + setValue(element, component, value); } diff --git a/src/XAO/XAO_StringStep.hxx b/src/XAO/XAO_StringStep.hxx index a8eff4ef9..6002235fc 100644 --- a/src/XAO/XAO_StringStep.hxx +++ b/src/XAO/XAO_StringStep.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -25,97 +26,95 @@ #include #include "XAO.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Step.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4290) // Warning Exception ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif -namespace XAO -{ - /** - * @class StringStep - * Step with strings values. - */ - class XAO_EXPORT StringStep : public Step - { - public: - /** - * Constructor. - * @param step the step number. - * @param stamp the stamp of the step. - * @param nbElements the number elements of the geometry. - * @param nbComponents the number of components of the field. - */ - StringStep(int step, int stamp, int nbElements, int nbComponents); - - virtual XAO::Type getType() { return XAO::STRING; } - - /** - * Gets all the values of the step as a list. - * @return a vector containing all the values of the step. - */ - std::vector getValues(); - - /** - * Gets all the values for a given element. - * @param element the index of the element. - * @return a vector containing all the values for the given element. - */ - std::vector getElement(int element) ; - - /** - * Gets all the values for a given component. - * @param component the index of the component. - * @return a vector containing all the values for the given component. - */ - std::vector getComponent(int component) ; - - /** - * Gets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @return the value for the given element and component. - */ - const std::string getValue(int element, int component) ; - - /** - * Sets all the values from a list. - * @param values the list of values to set. - */ - void setValues(const std::vector& values) ; - - /** - * Sets the values for an element. - * @param element the index of the element to set. - * @param elements the values to set. - */ - void setElement(int element, const std::vector& elements) ; - - /** - * Sets the values for a component. - * @param component the index of the component to set. - * @param components the values to set. - */ - void setComponent(int component, const std::vector& components) ; - - /** - * Sets the value for an element and a component. - * @param element the index of the element. - * @param component the index of the component. - * @param value the value. - */ - void setValue(int element, int component, const std::string& value) ; - - virtual const std::string getStringValue(int element, int component) ; - virtual void setStringValue(int element, int component, const std::string& value) ; - - private: - std::vector< std::vector > m_values; - }; -} - +namespace XAO { +/** + * @class StringStep + * Step with strings values. + */ +class XAO_EXPORT StringStep : public Step { +public: + /** + * Constructor. + * @param step the step number. + * @param stamp the stamp of the step. + * @param nbElements the number elements of the geometry. + * @param nbComponents the number of components of the field. + */ + StringStep(int step, int stamp, int nbElements, int nbComponents); + + virtual XAO::Type getType() { return XAO::STRING; } + + /** + * Gets all the values of the step as a list. + * @return a vector containing all the values of the step. + */ + std::vector getValues(); + + /** + * Gets all the values for a given element. + * @param element the index of the element. + * @return a vector containing all the values for the given element. + */ + std::vector getElement(int element); + + /** + * Gets all the values for a given component. + * @param component the index of the component. + * @return a vector containing all the values for the given component. + */ + std::vector getComponent(int component); + + /** + * Gets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @return the value for the given element and component. + */ + const std::string getValue(int element, int component); + + /** + * Sets all the values from a list. + * @param values the list of values to set. + */ + void setValues(const std::vector &values); + + /** + * Sets the values for an element. + * @param element the index of the element to set. + * @param elements the values to set. + */ + void setElement(int element, const std::vector &elements); + + /** + * Sets the values for a component. + * @param component the index of the component to set. + * @param components the values to set. + */ + void setComponent(int component, const std::vector &components); + + /** + * Sets the value for an element and a component. + * @param element the index of the element. + * @param component the index of the component. + * @param value the value. + */ + void setValue(int element, int component, const std::string &value); + + virtual const std::string getStringValue(int element, int component); + virtual void setStringValue(int element, int component, + const std::string &value); + +private: + std::vector> m_values; +}; +} // namespace XAO #endif /* __XAO_STRINGSTEP_HXX__ */ diff --git a/src/XAO/XAO_Xao.cxx b/src/XAO/XAO_Xao.cxx index 2525cf8a3..ac50c8a87 100644 --- a/src/XAO/XAO_Xao.cxx +++ b/src/XAO/XAO_Xao.cxx @@ -14,279 +14,264 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade) -#include -#include "XAO_XaoUtils.hxx" #include "XAO_Xao.hxx" +#include "XAO_BooleanField.hxx" +#include "XAO_DoubleField.hxx" +#include "XAO_Field.hxx" #include "XAO_Geometry.hxx" #include "XAO_Group.hxx" -#include "XAO_Field.hxx" #include "XAO_IntegerField.hxx" -#include "XAO_BooleanField.hxx" -#include "XAO_DoubleField.hxx" #include "XAO_StringField.hxx" #include "XAO_XaoExporter.hxx" +#include "XAO_XaoUtils.hxx" +#include #include using namespace XAO; -const xmlChar* C_XAO_VERSION = (xmlChar*)"1.0"; +const xmlChar *C_XAO_VERSION = (xmlChar *)"1.0"; -Xao::Xao() -{ - m_author = ""; - m_version = (char*)C_XAO_VERSION; - m_geometry = NULL; +Xao::Xao() { + m_author = ""; + m_version = (char *)C_XAO_VERSION; + m_geometry = NULL; } -Xao::Xao(const std::string& author, const std::string& version) -{ - m_author = author; - m_version = version; - m_geometry = NULL; +Xao::Xao(const std::string &author, const std::string &version) { + m_author = author; + m_version = version; + m_geometry = NULL; } -Xao::~Xao() -{ - if (m_geometry != NULL) - { - delete m_geometry; - m_geometry = NULL; - } - - for (std::list::iterator it = m_groups.begin(); it != m_groups.end(); ++it) - { - delete (*it); - } - - for (std::list::iterator it = m_fields.begin(); it != m_fields.end(); ++it) - { - delete (*it); - } -} +Xao::~Xao() { + if (m_geometry != NULL) { + delete m_geometry; + m_geometry = NULL; + } -int Xao::countGroups() const -{ - return m_groups.size(); + for (std::list::iterator it = m_groups.begin(); it != m_groups.end(); + ++it) { + delete (*it); + } + + for (std::list::iterator it = m_fields.begin(); it != m_fields.end(); + ++it) { + delete (*it); + } } -Group* Xao::getGroup(int index) +int Xao::countGroups() const { return m_groups.size(); } + +Group *Xao::getGroup(int index) { - checkGroupIndex(index); + checkGroupIndex(index); - int i = 0; - for (std::list::iterator it = m_groups.begin(); it != m_groups.end(); ++it, ++i) - { - if (i == index) - return (*it); - } + int i = 0; + for (std::list::iterator it = m_groups.begin(); it != m_groups.end(); + ++it, ++i) { + if (i == index) + return (*it); + } - return NULL; + return NULL; } -Group* Xao::addGroup(XAO::Dimension dim, const std::string& name) +Group *Xao::addGroup(XAO::Dimension dim, const std::string &name) { - checkGeometry(); - checkGroupDimension(dim); + checkGeometry(); + checkGroupDimension(dim); - Group* group = new Group(dim, m_geometry->countElements(dim), name); - m_groups.push_back(group); - return group; + Group *group = new Group(dim, m_geometry->countElements(dim), name); + m_groups.push_back(group); + return group; } -bool Xao::removeGroup(Group* group) -{ - int nb = countGroups(); - m_groups.remove(group); +bool Xao::removeGroup(Group *group) { + int nb = countGroups(); + m_groups.remove(group); - bool res = (nb-1 == countGroups()); - if (res) - { - delete group; - group = NULL; - } + bool res = (nb - 1 == countGroups()); + if (res) { + delete group; + group = NULL; + } - return res; + return res; } -int Xao::countFields() const -{ - return m_fields.size(); -} +int Xao::countFields() const { return m_fields.size(); } XAO::Type Xao::getFieldType(int index) { - return getField(index)->getType(); + return getField(index)->getType(); } -Field* Xao::getField(int index) +Field *Xao::getField(int index) { - checkFieldIndex(index); + checkFieldIndex(index); - int i = 0; - for (std::list::iterator it = m_fields.begin(); it != m_fields.end(); ++it, ++i) - { - if (i == index) - return (*it); - } + int i = 0; + for (std::list::iterator it = m_fields.begin(); it != m_fields.end(); + ++it, ++i) { + if (i == index) + return (*it); + } - throw XAO_Exception("Field not found."); + throw XAO_Exception("Field not found."); } -BooleanField* Xao::getBooleanField(int index) +BooleanField *Xao::getBooleanField(int index) { - Field* field = getField(index); - if (field->getType() != XAO::BOOLEAN) - throw XAO_Exception(MsgBuilder() << "Field " << index << " is not a boolean field."); - return (BooleanField*)field; + Field *field = getField(index); + if (field->getType() != XAO::BOOLEAN) + throw XAO_Exception(MsgBuilder() + << "Field " << index << " is not a boolean field."); + return (BooleanField *)field; } -DoubleField* Xao::getDoubleField(int index) +DoubleField *Xao::getDoubleField(int index) { - Field* field = getField(index); - if (field->getType() != XAO::DOUBLE) - throw XAO_Exception(MsgBuilder() << "Field " << index << " is not a double field."); - return (DoubleField*)field; + Field *field = getField(index); + if (field->getType() != XAO::DOUBLE) + throw XAO_Exception(MsgBuilder() + << "Field " << index << " is not a double field."); + return (DoubleField *)field; } -IntegerField* Xao::getIntegerField(int index) +IntegerField *Xao::getIntegerField(int index) { - Field* field = getField(index); - if (field->getType() != XAO::INTEGER) - throw XAO_Exception(MsgBuilder() << "Field " << index << " is not an integer field."); - return (IntegerField*)field; + Field *field = getField(index); + if (field->getType() != XAO::INTEGER) + throw XAO_Exception(MsgBuilder() + << "Field " << index << " is not an integer field."); + return (IntegerField *)field; } -StringField* Xao::getStringField(int index) +StringField *Xao::getStringField(int index) { - Field* field = getField(index); - if (field->getType() != XAO::STRING) - throw XAO_Exception(MsgBuilder() << "Field " << index << " is not a string field."); - return (StringField*)field; + Field *field = getField(index); + if (field->getType() != XAO::STRING) + throw XAO_Exception(MsgBuilder() + << "Field " << index << " is not a string field."); + return (StringField *)field; } -Field* Xao::addField(XAO::Type type, XAO::Dimension dim, int nbComponents, const std::string& name) +Field *Xao::addField(XAO::Type type, XAO::Dimension dim, int nbComponents, + const std::string &name) { - checkGeometry(); - int nbElts = m_geometry->countElements(dim); - Field* field = Field::createField(type, dim, nbElts, nbComponents, name); - m_fields.push_back(field); - return field; + checkGeometry(); + int nbElts = m_geometry->countElements(dim); + Field *field = Field::createField(type, dim, nbElts, nbComponents, name); + m_fields.push_back(field); + return field; } -IntegerField* Xao::addIntegerField(XAO::Dimension dim, int nbComponents, const std::string& name) +IntegerField *Xao::addIntegerField(XAO::Dimension dim, int nbComponents, + const std::string &name) { - checkGeometry(); - int nbElts = m_geometry->countElements(dim); - IntegerField* field = new IntegerField(dim, nbElts, nbComponents, name); - m_fields.push_back(field); - return field; + checkGeometry(); + int nbElts = m_geometry->countElements(dim); + IntegerField *field = new IntegerField(dim, nbElts, nbComponents, name); + m_fields.push_back(field); + return field; } -BooleanField* Xao::addBooleanField(XAO::Dimension dim, int nbComponents, const std::string& name) +BooleanField *Xao::addBooleanField(XAO::Dimension dim, int nbComponents, + const std::string &name) { - checkGeometry(); - int nbElts = m_geometry->countElements(dim); - BooleanField* field = new BooleanField(dim, nbElts, nbComponents, name); - m_fields.push_back(field); - return field; + checkGeometry(); + int nbElts = m_geometry->countElements(dim); + BooleanField *field = new BooleanField(dim, nbElts, nbComponents, name); + m_fields.push_back(field); + return field; } -DoubleField* Xao::addDoubleField(XAO::Dimension dim, int nbComponents, const std::string& name) +DoubleField *Xao::addDoubleField(XAO::Dimension dim, int nbComponents, + const std::string &name) { - checkGeometry(); - int nbElts = m_geometry->countElements(dim); - DoubleField* field = new DoubleField(dim, nbElts, nbComponents, name); - m_fields.push_back(field); - return field; + checkGeometry(); + int nbElts = m_geometry->countElements(dim); + DoubleField *field = new DoubleField(dim, nbElts, nbComponents, name); + m_fields.push_back(field); + return field; } -StringField* Xao::addStringField(XAO::Dimension dim, int nbComponents, const std::string& name) +StringField *Xao::addStringField(XAO::Dimension dim, int nbComponents, + const std::string &name) { - checkGeometry(); - int nbElts = m_geometry->countElements(dim); - StringField* field = new StringField(dim, nbElts, nbComponents, name); - m_fields.push_back(field); - return field; + checkGeometry(); + int nbElts = m_geometry->countElements(dim); + StringField *field = new StringField(dim, nbElts, nbComponents, name); + m_fields.push_back(field); + return field; } +bool Xao::removeField(Field *field) { + int nb = countFields(); + m_fields.remove(field); + bool res = (nb - 1 == countFields()); + if (res) { + delete field; + field = NULL; + } -bool Xao::removeField(Field* field) -{ - int nb = countFields(); - m_fields.remove(field); - - bool res = (nb-1 == countFields()); - if (res) - { - delete field; - field = NULL; - } - - return res; + return res; } -bool Xao::exportXAO(const std::string& fileName, const std::string& shapeFileName) -{ - return XaoExporter::saveToFile(this, fileName, shapeFileName); +bool Xao::exportXAO(const std::string &fileName, + const std::string &shapeFileName) { + return XaoExporter::saveToFile(this, fileName, shapeFileName); } -const std::string Xao::getXML() -{ - return XaoExporter::saveToXml(this); -} +const std::string Xao::getXML() { return XaoExporter::saveToXml(this); } -bool Xao::importXAO(const std::string& fileName) -{ - return XaoExporter::readFromFile(fileName, this); +bool Xao::importXAO(const std::string &fileName) { + return XaoExporter::readFromFile(fileName, this); } -bool Xao::setXML(const std::string& xml) -{ - return XaoExporter::setXML(xml, this); +bool Xao::setXML(const std::string &xml) { + return XaoExporter::setXML(xml, this); } -void Xao::checkGeometry() const -{ - if (m_geometry == NULL) - throw XAO_Exception("Geometry is null"); +void Xao::checkGeometry() const { + if (m_geometry == NULL) + throw XAO_Exception("Geometry is null"); } -void Xao::checkGroupIndex(int index) const -{ - if (index >= 0 && index < countGroups()) - return; +void Xao::checkGroupIndex(int index) const { + if (index >= 0 && index < countGroups()) + return; - throw XAO_Exception(MsgBuilder() << "Group index is out of range [0, " - << countGroups()-1 << "]: " << index); + throw XAO_Exception(MsgBuilder() << "Group index is out of range [0, " + << countGroups() - 1 << "]: " << index); } -void Xao::checkFieldIndex(int index) const -{ - if (index >= 0 && index < countFields()) - return; +void Xao::checkFieldIndex(int index) const { + if (index >= 0 && index < countFields()) + return; - throw XAO_Exception(MsgBuilder() << "Field index is out of range [0, " - << countFields()-1 << "]: " << index); + throw XAO_Exception(MsgBuilder() << "Field index is out of range [0, " + << countFields() - 1 << "]: " << index); } -void Xao::checkGroupDimension(XAO::Dimension dim) const -{ - if (dim == XAO::WHOLE) - throw XAO_Exception(MsgBuilder() << "Invalid dimension for group: " << dim); +void Xao::checkGroupDimension(XAO::Dimension dim) const { + if (dim == XAO::WHOLE) + throw XAO_Exception(MsgBuilder() << "Invalid dimension for group: " << dim); } diff --git a/src/XAO/XAO_Xao.hxx b/src/XAO/XAO_Xao.hxx index deace5b4c..f08a02854 100644 --- a/src/XAO/XAO_Xao.hxx +++ b/src/XAO/XAO_Xao.hxx @@ -14,249 +14,232 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade) #ifndef __XAO_XAO_HXX__ #define __XAO_XAO_HXX__ -#include #include +#include #include "XAO.hxx" #include "XAO_Exception.hxx" -#include "XAO_XaoUtils.hxx" #include "XAO_Geometry.hxx" +#include "XAO_XaoUtils.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... -#pragma warning(disable:4251) // Warning dll-interface ... +#pragma warning(disable : 4290) // Warning Exception ... +#pragma warning(disable : 4251) // Warning dll-interface ... #endif -namespace XAO -{ - class Group; - class Field; - class IntegerField; - class DoubleField; - class BooleanField; - class StringField; - - /** - * @class Xao - * The Xao class describes the XAO format. - */ - class XAO_EXPORT Xao - { - public: - /** - * Default constructor. - */ - Xao(); - /** - * Constructor with author and version. - * \param author the author of the file. - * \param version the version of the XAO format. - */ - Xao(const std::string& author, const std::string& version); - /** - * Destructor. - */ - virtual ~Xao(); - - /** - * Gets the author of the file. - * \return the author of the file. - */ - const std::string getAuthor() const - { - return m_author; - } - /** - * Sets the author of the file. - * \param author the author to set. - */ - void setAuthor(const std::string& author) - { - m_author = author; - } - - /** - * Gets the version of the file. - * \return the version of the file. - */ - const std::string getVersion() const - { - return m_version; - } - /** - * Sets the version of the file. - * \param version the version to set. - */ - void setVersion(const std::string& version) - { - m_version = version; - } - - // - // Geometry - // - - /** - * Gets the geometry. - * \return the geometry. - */ - Geometry* getGeometry() const - { - return m_geometry; - } - /** - * Sets the geometry. - * \param geometry the geometry to set. - */ - void setGeometry(Geometry* geometry) - { - if (m_geometry != NULL) - throw XAO_Exception("Geometry already set."); - m_geometry = geometry; - m_geometry->setReadOnly(); - } - - // - // Groups - // - - /** - * Gets the number of groups. - * \return the number of groups. - */ - int countGroups() const; - /** - * Gets a group. - * \param index the index of the wanted group. - * \return the group. - */ - Group* getGroup(int index) ; - /** - * Adds a group. - * \param dim the dimension of the group. - * \param name the name of the group. - * \return the created group. - */ - Group* addGroup(XAO::Dimension dim, const std::string& name = std::string("")) ; - /** - * Removes a group. - * \param group the group to remove. - * \return true if the group has been removed, false otherwise. - */ - bool removeGroup(Group* group); - - // - // Fields - // - - /** - * Gets the number of fields. - * \return the number of fields. - */ - int countFields() const; - - /** - * Gets the type of a field. - * \param index the index of the wanted field. - * \return the type of the field. - */ - XAO::Type getFieldType(int index) ; - - /** - * Gets a field. - * \param index the index of the wanted field. - * \return the field. - */ - Field* getField(int index) ; - - BooleanField* getBooleanField(int index) ; - DoubleField* getDoubleField(int index) ; - IntegerField* getIntegerField(int index) ; - StringField* getStringField(int index) ; - - /** - * Adds a field. - * \param type the type of the field. - * \param dim the dimension of the field. - * \param nbComponents the number of components in the field. - * \param name the name of the field. - * \return the created field. - */ - Field* addField(XAO::Type type, XAO::Dimension dim, int nbComponents, - const std::string& name = std::string("")) - ; - - BooleanField* addBooleanField(XAO::Dimension dim, int nbComponents, - const std::string& name = std::string("")) ; - IntegerField* addIntegerField(XAO::Dimension dim, int nbComponents, - const std::string& name = std::string("")) ; - DoubleField* addDoubleField(XAO::Dimension dim, int nbComponents, - const std::string& name = std::string("")) ; - StringField* addStringField(XAO::Dimension dim, int nbComponents, - const std::string& name = std::string("")) ; - - /** - * Removes a field. - * \param field the field to remove. - * \return true if the field has been removed, false otherwise. - */ - bool removeField(Field* field); - - // - // Import / Export - // - /** - * Exports this XAO object to a file. - * \param fileName the name of the file to create. - * \param shapeFileName if not empty, export the shape to this external file. - * \return true is the export is successful. - */ - bool exportXAO(const std::string& fileName, const std::string& shapeFileName); - /** - * Gets the XML corresponding to this XAO. - * \return the XML as a string. - */ - const std::string getXML(); - - /** - * Imports an XAO file into this object. - * \param fileName the name of the file to import. - * \return true if the import is successful. - */ - bool importXAO(const std::string& fileName); - /** - * Sets an XML describing an XAO format to this object. - * \param xml the XML to set. - * \return true if the import is successful. - */ - bool setXML(const std::string& xml); - - private: - void checkGeometry() const ; - void checkGroupIndex(int index) const ; - void checkFieldIndex(int index) const ; - void checkGroupDimension(XAO::Dimension dim) const ; - - private: - /** The author of the file. */ - std::string m_author; - /** The version of the file. */ - std::string m_version; - /** The geometry. */ - Geometry* m_geometry; - /** The list of groups. */ - std::list m_groups; - /** The list of fields. */ - std::list m_fields; - }; - -} +namespace XAO { +class Group; +class Field; +class IntegerField; +class DoubleField; +class BooleanField; +class StringField; + +/** + * @class Xao + * The Xao class describes the XAO format. + */ +class XAO_EXPORT Xao { +public: + /** + * Default constructor. + */ + Xao(); + /** + * Constructor with author and version. + * \param author the author of the file. + * \param version the version of the XAO format. + */ + Xao(const std::string &author, const std::string &version); + /** + * Destructor. + */ + virtual ~Xao(); + + /** + * Gets the author of the file. + * \return the author of the file. + */ + const std::string getAuthor() const { return m_author; } + /** + * Sets the author of the file. + * \param author the author to set. + */ + void setAuthor(const std::string &author) { m_author = author; } + + /** + * Gets the version of the file. + * \return the version of the file. + */ + const std::string getVersion() const { return m_version; } + /** + * Sets the version of the file. + * \param version the version to set. + */ + void setVersion(const std::string &version) { m_version = version; } + + // + // Geometry + // + + /** + * Gets the geometry. + * \return the geometry. + */ + Geometry *getGeometry() const { return m_geometry; } + /** + * Sets the geometry. + * \param geometry the geometry to set. + */ + void setGeometry(Geometry *geometry) { + if (m_geometry != NULL) + throw XAO_Exception("Geometry already set."); + m_geometry = geometry; + m_geometry->setReadOnly(); + } + + // + // Groups + // + + /** + * Gets the number of groups. + * \return the number of groups. + */ + int countGroups() const; + /** + * Gets a group. + * \param index the index of the wanted group. + * \return the group. + */ + Group *getGroup(int index); + /** + * Adds a group. + * \param dim the dimension of the group. + * \param name the name of the group. + * \return the created group. + */ + Group *addGroup(XAO::Dimension dim, + const std::string &name = std::string("")); + /** + * Removes a group. + * \param group the group to remove. + * \return true if the group has been removed, false otherwise. + */ + bool removeGroup(Group *group); + + // + // Fields + // + + /** + * Gets the number of fields. + * \return the number of fields. + */ + int countFields() const; + + /** + * Gets the type of a field. + * \param index the index of the wanted field. + * \return the type of the field. + */ + XAO::Type getFieldType(int index); + + /** + * Gets a field. + * \param index the index of the wanted field. + * \return the field. + */ + Field *getField(int index); + + BooleanField *getBooleanField(int index); + DoubleField *getDoubleField(int index); + IntegerField *getIntegerField(int index); + StringField *getStringField(int index); + + /** + * Adds a field. + * \param type the type of the field. + * \param dim the dimension of the field. + * \param nbComponents the number of components in the field. + * \param name the name of the field. + * \return the created field. + */ + Field *addField(XAO::Type type, XAO::Dimension dim, int nbComponents, + const std::string &name = std::string("")); + + BooleanField *addBooleanField(XAO::Dimension dim, int nbComponents, + const std::string &name = std::string("")); + IntegerField *addIntegerField(XAO::Dimension dim, int nbComponents, + const std::string &name = std::string("")); + DoubleField *addDoubleField(XAO::Dimension dim, int nbComponents, + const std::string &name = std::string("")); + StringField *addStringField(XAO::Dimension dim, int nbComponents, + const std::string &name = std::string("")); + + /** + * Removes a field. + * \param field the field to remove. + * \return true if the field has been removed, false otherwise. + */ + bool removeField(Field *field); + + // + // Import / Export + // + /** + * Exports this XAO object to a file. + * \param fileName the name of the file to create. + * \param shapeFileName if not empty, export the shape to this external file. + * \return true is the export is successful. + */ + bool exportXAO(const std::string &fileName, const std::string &shapeFileName); + /** + * Gets the XML corresponding to this XAO. + * \return the XML as a string. + */ + const std::string getXML(); + + /** + * Imports an XAO file into this object. + * \param fileName the name of the file to import. + * \return true if the import is successful. + */ + bool importXAO(const std::string &fileName); + /** + * Sets an XML describing an XAO format to this object. + * \param xml the XML to set. + * \return true if the import is successful. + */ + bool setXML(const std::string &xml); + +private: + void checkGeometry() const; + void checkGroupIndex(int index) const; + void checkFieldIndex(int index) const; + void checkGroupDimension(XAO::Dimension dim) const; + +private: + /** The author of the file. */ + std::string m_author; + /** The version of the file. */ + std::string m_version; + /** The geometry. */ + Geometry *m_geometry; + /** The list of groups. */ + std::list m_groups; + /** The list of fields. */ + std::list m_fields; +}; + +} // namespace XAO #endif diff --git a/src/XAO/XAO_XaoExporter.cxx b/src/XAO/XAO_XaoExporter.cxx index 9816b43ae..04ac3cdee 100644 --- a/src/XAO/XAO_XaoExporter.cxx +++ b/src/XAO/XAO_XaoExporter.cxx @@ -14,681 +14,664 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) #include -#include "XAO_XaoExporter.hxx" -#include "XAO_Xao.hxx" +#include "XAO_Field.hxx" #include "XAO_Geometry.hxx" #include "XAO_Group.hxx" -#include "XAO_Field.hxx" #include "XAO_Step.hxx" +#include "XAO_Xao.hxx" +#include "XAO_XaoExporter.hxx" #include "XAO_XaoUtils.hxx" #ifdef WIN32 -# define _separator_ '\\' +#define _separator_ '\\' #else -# define _separator_ '/' +#define _separator_ '/' #endif -namespace XAO -{ - const xmlChar* C_TAG_XAO = (xmlChar*)"XAO"; - const xmlChar* C_ATTR_XAO_AUTHOR = (xmlChar*)"author"; - const xmlChar* C_ATTR_XAO_VERSION = (xmlChar*)"version"; - - const xmlChar* C_TAG_GEOMETRY = (xmlChar*)"geometry"; - const xmlChar* C_ATTR_GEOMETRY_NAME = (xmlChar*)"name"; - - const xmlChar* C_TAG_SHAPE = (xmlChar*)"shape"; - const xmlChar* C_ATTR_SHAPE_FORMAT = (xmlChar*)"format"; - const xmlChar* C_ATTR_SHAPE_FILE = (xmlChar*)"file"; - - const xmlChar* C_TAG_TOPOLOGY = (xmlChar*)"topology"; - const xmlChar* C_TAG_VERTICES = (xmlChar*)"vertices"; - const xmlChar* C_TAG_VERTEX = (xmlChar*)"vertex"; - const xmlChar* C_TAG_EDGES = (xmlChar*)"edges"; - const xmlChar* C_TAG_EDGE = (xmlChar*)"edge"; - const xmlChar* C_TAG_FACES = (xmlChar*)"faces"; - const xmlChar* C_TAG_FACE = (xmlChar*)"face"; - const xmlChar* C_TAG_SOLIDS = (xmlChar*)"solids"; - const xmlChar* C_TAG_SOLID = (xmlChar*)"solid"; - const xmlChar* C_ATTR_COUNT = (xmlChar*)"count"; - const xmlChar* C_ATTR_ELT_INDEX = (xmlChar*)"index"; - const xmlChar* C_ATTR_ELT_NAME = (xmlChar*)"name"; - const xmlChar* C_ATTR_ELT_REFERENCE = (xmlChar*)"reference"; - - const xmlChar* C_TAG_GROUPS = (xmlChar*)"groups"; - const xmlChar* C_TAG_GROUP = (xmlChar*)"group"; - const xmlChar* C_ATTR_GROUP_NAME = (xmlChar*)"name"; - const xmlChar* C_ATTR_GROUP_DIM = (xmlChar*)"dimension"; - - const xmlChar* C_TAG_ELEMENT = (xmlChar*)"element"; - const xmlChar* C_ATTR_ELEMENT_INDEX = (xmlChar*)"index"; - const xmlChar* C_TAG_VALUE = (xmlChar*)"value"; - const xmlChar* C_ATTR_VALUE_COMPONENT = (xmlChar*)"component"; - - const xmlChar* C_TAG_FIELDS = (xmlChar*)"fields"; - const xmlChar* C_TAG_FIELD = (xmlChar*)"field"; - const xmlChar* C_ATTR_FIELD_NAME = (xmlChar*)"name"; - const xmlChar* C_ATTR_FIELD_TYPE = (xmlChar*)"type"; - const xmlChar* C_ATTR_FIELD_DIMENSION = (xmlChar*)"dimension"; - const xmlChar* C_TAG_COMPONENTS = (xmlChar*)"components"; - const xmlChar* C_TAG_COMPONENT = (xmlChar*)"component"; - const xmlChar* C_ATTR_COMPONENT_COLUMN = (xmlChar*)"column"; - const xmlChar* C_ATTR_COMPONENT_NAME = (xmlChar*)"name"; - - const xmlChar* C_TAG_STEPS = (xmlChar*)"steps"; - const xmlChar* C_TAG_STEP = (xmlChar*)"step"; - const xmlChar* C_ATTR_STEP_NUMBER = (xmlChar*)"number"; - const xmlChar* C_ATTR_STEP_STAMP = (xmlChar*)"stamp"; -} +namespace XAO { +const xmlChar *C_TAG_XAO = (xmlChar *)"XAO"; +const xmlChar *C_ATTR_XAO_AUTHOR = (xmlChar *)"author"; +const xmlChar *C_ATTR_XAO_VERSION = (xmlChar *)"version"; + +const xmlChar *C_TAG_GEOMETRY = (xmlChar *)"geometry"; +const xmlChar *C_ATTR_GEOMETRY_NAME = (xmlChar *)"name"; + +const xmlChar *C_TAG_SHAPE = (xmlChar *)"shape"; +const xmlChar *C_ATTR_SHAPE_FORMAT = (xmlChar *)"format"; +const xmlChar *C_ATTR_SHAPE_FILE = (xmlChar *)"file"; + +const xmlChar *C_TAG_TOPOLOGY = (xmlChar *)"topology"; +const xmlChar *C_TAG_VERTICES = (xmlChar *)"vertices"; +const xmlChar *C_TAG_VERTEX = (xmlChar *)"vertex"; +const xmlChar *C_TAG_EDGES = (xmlChar *)"edges"; +const xmlChar *C_TAG_EDGE = (xmlChar *)"edge"; +const xmlChar *C_TAG_FACES = (xmlChar *)"faces"; +const xmlChar *C_TAG_FACE = (xmlChar *)"face"; +const xmlChar *C_TAG_SOLIDS = (xmlChar *)"solids"; +const xmlChar *C_TAG_SOLID = (xmlChar *)"solid"; +const xmlChar *C_ATTR_COUNT = (xmlChar *)"count"; +const xmlChar *C_ATTR_ELT_INDEX = (xmlChar *)"index"; +const xmlChar *C_ATTR_ELT_NAME = (xmlChar *)"name"; +const xmlChar *C_ATTR_ELT_REFERENCE = (xmlChar *)"reference"; + +const xmlChar *C_TAG_GROUPS = (xmlChar *)"groups"; +const xmlChar *C_TAG_GROUP = (xmlChar *)"group"; +const xmlChar *C_ATTR_GROUP_NAME = (xmlChar *)"name"; +const xmlChar *C_ATTR_GROUP_DIM = (xmlChar *)"dimension"; + +const xmlChar *C_TAG_ELEMENT = (xmlChar *)"element"; +const xmlChar *C_ATTR_ELEMENT_INDEX = (xmlChar *)"index"; +const xmlChar *C_TAG_VALUE = (xmlChar *)"value"; +const xmlChar *C_ATTR_VALUE_COMPONENT = (xmlChar *)"component"; + +const xmlChar *C_TAG_FIELDS = (xmlChar *)"fields"; +const xmlChar *C_TAG_FIELD = (xmlChar *)"field"; +const xmlChar *C_ATTR_FIELD_NAME = (xmlChar *)"name"; +const xmlChar *C_ATTR_FIELD_TYPE = (xmlChar *)"type"; +const xmlChar *C_ATTR_FIELD_DIMENSION = (xmlChar *)"dimension"; +const xmlChar *C_TAG_COMPONENTS = (xmlChar *)"components"; +const xmlChar *C_TAG_COMPONENT = (xmlChar *)"component"; +const xmlChar *C_ATTR_COMPONENT_COLUMN = (xmlChar *)"column"; +const xmlChar *C_ATTR_COMPONENT_NAME = (xmlChar *)"name"; + +const xmlChar *C_TAG_STEPS = (xmlChar *)"steps"; +const xmlChar *C_TAG_STEP = (xmlChar *)"step"; +const xmlChar *C_ATTR_STEP_NUMBER = (xmlChar *)"number"; +const xmlChar *C_ATTR_STEP_STAMP = (xmlChar *)"stamp"; +} // namespace XAO using namespace XAO; namespace { - xmlDocPtr exportXMLDoc(Xao* xaoObject, const std::string& shapeFileName); - void exportGeometry(Geometry* xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, const std::string& shapeFileName); - void exportGeometricElements(Geometry* xaoGeometry, xmlNodePtr topology, - XAO::Dimension dim, const xmlChar* colTag, const xmlChar* eltTag); - void exportGroups(Xao* xaoObject, xmlNodePtr xao); - void exportFields(Xao* xaoObject, xmlNodePtr xao); - void exportStep(Step* step, Field* field, xmlNodePtr nodeSteps); - - void parseXMLDoc(xmlDocPtr doc, Xao* xaoObject); - void parseXaoNode(xmlDocPtr doc, xmlNodePtr xaoNode, Xao* xaoObject); - void parseGeometryNode(xmlDocPtr doc, xmlNodePtr geometryNode, Xao* xaoObject); - void parseShapeNode(xmlDocPtr doc, xmlNodePtr shapeNode, Geometry* geometry); - void parseTopologyNode(xmlNodePtr topologyNode, Geometry* geometry); - void parseVerticesNode(xmlNodePtr verticesNode, Geometry* geometry); - void parseEdgesNode(xmlNodePtr edgesNode, Geometry* geometry); - void parseFacesNode(xmlNodePtr facesNode, Geometry* geometry); - void parseSolidsNode(xmlNodePtr solidsNode, Geometry* geometry); - void parseGroupsNode(xmlNodePtr groupsNode, Xao* xaoObject); - void parseGroupNode(xmlNodePtr groupNode, Xao* xaoObject); - - void parseFieldsNode(xmlNodePtr fieldsNode, Xao* xaoObject); - void parseFieldNode(xmlNodePtr fieldNode, Xao* xaoObject); - void parseStepNode(xmlNodePtr stepNode, Field* field); - void parseStepElementNode(xmlNodePtr eltNode, Step* step); - - std::string readStringProp(xmlNodePtr node, const xmlChar* attribute, - bool required, const std::string& defaultValue, - const std::string& exception = std::string("")); - int readIntegerProp(xmlNodePtr node, const xmlChar* attribute, - bool required, int defaultValue, - const std::string& exception = std::string("")); - - std::string readStringProp(xmlNodePtr node, const xmlChar* attribute, - bool required, const std::string& defaultValue, - const std::string& exception /*= std::string() */) - { - xmlChar* strAttr = xmlGetProp(node, attribute); - if (strAttr == NULL) - { - if (required) - { - if (exception.size() > 0) - throw XAO_Exception(exception.c_str()); - - throw XAO_Exception(MsgBuilder() << "Line " << node->line << ": " - << "Property " << (char*)attribute << " is required."); - } - - return defaultValue; +xmlDocPtr exportXMLDoc(Xao *xaoObject, const std::string &shapeFileName); +void exportGeometry(Geometry *xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, + const std::string &shapeFileName); +void exportGeometricElements(Geometry *xaoGeometry, xmlNodePtr topology, + XAO::Dimension dim, const xmlChar *colTag, + const xmlChar *eltTag); +void exportGroups(Xao *xaoObject, xmlNodePtr xao); +void exportFields(Xao *xaoObject, xmlNodePtr xao); +void exportStep(Step *step, Field *field, xmlNodePtr nodeSteps); + +void parseXMLDoc(xmlDocPtr doc, Xao *xaoObject); +void parseXaoNode(xmlDocPtr doc, xmlNodePtr xaoNode, Xao *xaoObject); +void parseGeometryNode(xmlDocPtr doc, xmlNodePtr geometryNode, Xao *xaoObject); +void parseShapeNode(xmlDocPtr doc, xmlNodePtr shapeNode, Geometry *geometry); +void parseTopologyNode(xmlNodePtr topologyNode, Geometry *geometry); +void parseVerticesNode(xmlNodePtr verticesNode, Geometry *geometry); +void parseEdgesNode(xmlNodePtr edgesNode, Geometry *geometry); +void parseFacesNode(xmlNodePtr facesNode, Geometry *geometry); +void parseSolidsNode(xmlNodePtr solidsNode, Geometry *geometry); +void parseGroupsNode(xmlNodePtr groupsNode, Xao *xaoObject); +void parseGroupNode(xmlNodePtr groupNode, Xao *xaoObject); + +void parseFieldsNode(xmlNodePtr fieldsNode, Xao *xaoObject); +void parseFieldNode(xmlNodePtr fieldNode, Xao *xaoObject); +void parseStepNode(xmlNodePtr stepNode, Field *field); +void parseStepElementNode(xmlNodePtr eltNode, Step *step); + +std::string readStringProp(xmlNodePtr node, const xmlChar *attribute, + bool required, const std::string &defaultValue, + const std::string &exception = std::string("")); +int readIntegerProp(xmlNodePtr node, const xmlChar *attribute, bool required, + int defaultValue, + const std::string &exception = std::string("")); + +std::string readStringProp(xmlNodePtr node, const xmlChar *attribute, + bool required, const std::string &defaultValue, + const std::string &exception /*= std::string() */) { + xmlChar *strAttr = xmlGetProp(node, attribute); + if (strAttr == NULL) { + if (required) { + if (exception.size() > 0) + throw XAO_Exception(exception.c_str()); + + throw XAO_Exception(MsgBuilder() << "Line " << node->line << ": " + << "Property " << (char *)attribute + << " is required."); } - std::string res = (char*)strAttr; - xmlFree(strAttr); - return res; + return defaultValue; } - int readIntegerProp(xmlNodePtr node, const xmlChar* attribute, - bool required, int defaultValue, - const std::string& exception /*= std::string() */) - { - xmlChar* strAttr = xmlGetProp(node, attribute); - if (strAttr == NULL) - { - if (required) - { - if (exception.size() > 0) - throw XAO_Exception(exception.c_str()); - - throw XAO_Exception(MsgBuilder() << "Line " << node->line << ": " - << "Property " << (char*)attribute << " is required."); - } - - return defaultValue; + std::string res = (char *)strAttr; + xmlFree(strAttr); + return res; +} + +int readIntegerProp(xmlNodePtr node, const xmlChar *attribute, bool required, + int defaultValue, + const std::string &exception /*= std::string() */) { + xmlChar *strAttr = xmlGetProp(node, attribute); + if (strAttr == NULL) { + if (required) { + if (exception.size() > 0) + throw XAO_Exception(exception.c_str()); + + throw XAO_Exception(MsgBuilder() << "Line " << node->line << ": " + << "Property " << (char *)attribute + << " is required."); } - int res = XaoUtils::stringToInt((char*)strAttr); - xmlFree(strAttr); - return res; + return defaultValue; } - xmlDocPtr exportXMLDoc(Xao* xaoObject, const std::string& shapeFileName) - { - // Creating the Xml document - xmlDocPtr masterDocument = xmlNewDoc(BAD_CAST "1.0"); - xmlNodePtr xao = xmlNewNode(0, C_TAG_XAO); - xmlDocSetRootElement(masterDocument, xao); + int res = XaoUtils::stringToInt((char *)strAttr); + xmlFree(strAttr); + return res; +} - xmlNewProp(xao, C_ATTR_XAO_VERSION, BAD_CAST xaoObject->getVersion().c_str()); - xmlNewProp(xao, C_ATTR_XAO_AUTHOR, BAD_CAST xaoObject->getAuthor().c_str()); +xmlDocPtr exportXMLDoc(Xao *xaoObject, const std::string &shapeFileName) { + // Creating the Xml document + xmlDocPtr masterDocument = xmlNewDoc(BAD_CAST "1.0"); + xmlNodePtr xao = xmlNewNode(0, C_TAG_XAO); + xmlDocSetRootElement(masterDocument, xao); - if (xaoObject->getGeometry() != NULL) - { - exportGeometry(xaoObject->getGeometry(), masterDocument, xao, shapeFileName); - } + xmlNewProp(xao, C_ATTR_XAO_VERSION, BAD_CAST xaoObject->getVersion().c_str()); + xmlNewProp(xao, C_ATTR_XAO_AUTHOR, BAD_CAST xaoObject->getAuthor().c_str()); + + if (xaoObject->getGeometry() != NULL) { + exportGeometry(xaoObject->getGeometry(), masterDocument, xao, + shapeFileName); + } - exportGroups(xaoObject, xao); - exportFields(xaoObject, xao); + exportGroups(xaoObject, xao); + exportFields(xaoObject, xao); - return masterDocument; + return masterDocument; +} + +void exportGeometricElements(Geometry *xaoGeometry, xmlNodePtr topology, + XAO::Dimension dim, const xmlChar *colTag, + const xmlChar *eltTag) { + xmlNodePtr vertices = xmlNewChild(topology, 0, colTag, 0); + xmlNewProp( + vertices, C_ATTR_COUNT, + BAD_CAST XaoUtils::intToString(xaoGeometry->countElements(dim)).c_str()); + GeometricElementList::iterator it = xaoGeometry->begin(dim); + for (; it != xaoGeometry->end(dim); it++) { + int index = it->first; + GeometricElement elt = it->second; + xmlNodePtr vertex = xmlNewChild(vertices, 0, eltTag, 0); + xmlNewProp(vertex, C_ATTR_ELT_INDEX, + BAD_CAST XaoUtils::intToString(index).c_str()); + xmlNewProp(vertex, C_ATTR_ELT_NAME, BAD_CAST elt.getName().c_str()); + xmlNewProp(vertex, C_ATTR_ELT_REFERENCE, + BAD_CAST elt.getReference().c_str()); } +} - void exportGeometricElements(Geometry* xaoGeometry, - xmlNodePtr topology, XAO::Dimension dim, const xmlChar* colTag, const xmlChar* eltTag) - { - xmlNodePtr vertices = xmlNewChild(topology, 0, colTag, 0); - xmlNewProp(vertices, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(xaoGeometry->countElements(dim)).c_str()); - GeometricElementList::iterator it = xaoGeometry->begin(dim); - for (; it != xaoGeometry->end(dim); it++) - { - int index = it->first; - GeometricElement elt = it->second; - xmlNodePtr vertex = xmlNewChild(vertices, 0, eltTag, 0); - xmlNewProp(vertex, C_ATTR_ELT_INDEX, BAD_CAST XaoUtils::intToString(index).c_str()); - xmlNewProp(vertex, C_ATTR_ELT_NAME, BAD_CAST elt.getName().c_str()); - xmlNewProp(vertex, C_ATTR_ELT_REFERENCE, BAD_CAST elt.getReference().c_str()); - } +void exportGeometry(Geometry *xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, + const std::string &shapeFileName) { + // Geometric part + xmlNodePtr geometry = xmlNewChild(xao, 0, C_TAG_GEOMETRY, 0); + xmlNewProp(geometry, C_ATTR_GEOMETRY_NAME, + BAD_CAST xaoGeometry->getName().c_str()); + + xmlNodePtr shape = xmlNewChild(geometry, 0, C_TAG_SHAPE, 0); + xmlNewProp( + shape, C_ATTR_SHAPE_FORMAT, + BAD_CAST XaoUtils::shapeFormatToString(xaoGeometry->getFormat()).c_str()); + + if (shapeFileName == "") { + // export the shape in the XAO file + std::string txtShape = xaoGeometry->getShapeString(); + xmlNodePtr cdata = + xmlNewCDataBlock(doc, BAD_CAST txtShape.c_str(), txtShape.size()); + xmlAddChild(shape, cdata); + } else { + // export the shape in an external file + xmlNewProp(shape, C_ATTR_SHAPE_FILE, BAD_CAST shapeFileName.c_str()); + xaoGeometry->writeShapeFile(shapeFileName); } - void exportGeometry(Geometry* xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, - const std::string& shapeFileName) - { - // Geometric part - xmlNodePtr geometry = xmlNewChild(xao, 0, C_TAG_GEOMETRY, 0); - xmlNewProp(geometry, C_ATTR_GEOMETRY_NAME, BAD_CAST xaoGeometry->getName().c_str()); - - xmlNodePtr shape = xmlNewChild(geometry, 0, C_TAG_SHAPE, 0); - xmlNewProp(shape, C_ATTR_SHAPE_FORMAT, BAD_CAST XaoUtils::shapeFormatToString(xaoGeometry->getFormat()).c_str()); - - if (shapeFileName == "") - { - // export the shape in the XAO file - std::string txtShape = xaoGeometry->getShapeString(); - xmlNodePtr cdata = xmlNewCDataBlock(doc, BAD_CAST txtShape.c_str(), txtShape.size()); - xmlAddChild(shape, cdata); - } - else - { - // export the shape in an external file - xmlNewProp(shape, C_ATTR_SHAPE_FILE, BAD_CAST shapeFileName.c_str()); - xaoGeometry->writeShapeFile(shapeFileName); - } + xmlNodePtr topology = xmlNewChild(geometry, 0, C_TAG_TOPOLOGY, 0); - xmlNodePtr topology = xmlNewChild(geometry, 0, C_TAG_TOPOLOGY, 0); + exportGeometricElements(xaoGeometry, topology, XAO::VERTEX, C_TAG_VERTICES, + C_TAG_VERTEX); + exportGeometricElements(xaoGeometry, topology, XAO::EDGE, C_TAG_EDGES, + C_TAG_EDGE); + exportGeometricElements(xaoGeometry, topology, XAO::FACE, C_TAG_FACES, + C_TAG_FACE); + exportGeometricElements(xaoGeometry, topology, XAO::SOLID, C_TAG_SOLIDS, + C_TAG_SOLID); +} - exportGeometricElements(xaoGeometry, topology, XAO::VERTEX, C_TAG_VERTICES, C_TAG_VERTEX); - exportGeometricElements(xaoGeometry, topology, XAO::EDGE, C_TAG_EDGES, C_TAG_EDGE); - exportGeometricElements(xaoGeometry, topology, XAO::FACE, C_TAG_FACES, C_TAG_FACE); - exportGeometricElements(xaoGeometry, topology, XAO::SOLID, C_TAG_SOLIDS, C_TAG_SOLID); +void exportGroups(Xao *xaoObject, xmlNodePtr xao) { + xmlNodePtr groups = xmlNewChild(xao, 0, C_TAG_GROUPS, 0); + xmlNewProp(groups, C_ATTR_COUNT, + BAD_CAST XaoUtils::intToString(xaoObject->countGroups()).c_str()); + + for (int i = 0; i < xaoObject->countGroups(); i++) { + // Group* grp = (*it); + Group *grp = xaoObject->getGroup(i); + xmlNodePtr group = xmlNewChild(groups, 0, C_TAG_GROUP, 0); + xmlNewProp(group, C_ATTR_GROUP_NAME, BAD_CAST grp->getName().c_str()); + xmlNewProp( + group, C_ATTR_GROUP_DIM, + BAD_CAST XaoUtils::dimensionToString(grp->getDimension()).c_str()); + xmlNewProp(group, C_ATTR_COUNT, + BAD_CAST XaoUtils::intToString(grp->count()).c_str()); + + for (std::set::iterator it = grp->begin(); it != grp->end(); ++it) { + int grpElt = (*it); + xmlNodePtr elt = xmlNewChild(group, 0, C_TAG_ELEMENT, 0); + xmlNewProp(elt, C_ATTR_ELEMENT_INDEX, + BAD_CAST XaoUtils::intToString(grpElt).c_str()); + } } +} - void exportGroups(Xao* xaoObject, xmlNodePtr xao) - { - xmlNodePtr groups = xmlNewChild(xao, 0, C_TAG_GROUPS, 0); - xmlNewProp(groups, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(xaoObject->countGroups()).c_str()); - - for (int i = 0; i < xaoObject->countGroups(); i++) - { - //Group* grp = (*it); - Group* grp = xaoObject->getGroup(i); - xmlNodePtr group = xmlNewChild(groups, 0, C_TAG_GROUP, 0); - xmlNewProp(group, C_ATTR_GROUP_NAME, BAD_CAST grp->getName().c_str()); - xmlNewProp(group, C_ATTR_GROUP_DIM, BAD_CAST XaoUtils::dimensionToString(grp->getDimension()).c_str()); - xmlNewProp(group, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(grp->count()).c_str()); - - for (std::set::iterator it = grp->begin(); it != grp->end(); ++it) - { - int grpElt = (*it); - xmlNodePtr elt = xmlNewChild(group, 0, C_TAG_ELEMENT, 0); - xmlNewProp(elt, C_ATTR_ELEMENT_INDEX, BAD_CAST XaoUtils::intToString(grpElt).c_str()); - } +void exportFields(Xao *xaoObject, xmlNodePtr xao) { + xmlNodePtr fields = xmlNewChild(xao, 0, C_TAG_FIELDS, 0); + xmlNewProp(fields, C_ATTR_COUNT, + BAD_CAST XaoUtils::intToString(xaoObject->countFields()).c_str()); + + for (int i = 0; i < xaoObject->countFields(); i++) { + Field *field = xaoObject->getField(i); + xmlNodePtr nodeField = xmlNewChild(fields, 0, C_TAG_FIELD, 0); + xmlNewProp(nodeField, C_ATTR_FIELD_NAME, BAD_CAST field->getName().c_str()); + xmlNewProp(nodeField, C_ATTR_FIELD_TYPE, + BAD_CAST XaoUtils::fieldTypeToString(field->getType()).c_str()); + xmlNewProp( + nodeField, C_ATTR_FIELD_DIMENSION, + BAD_CAST XaoUtils::dimensionToString(field->getDimension()).c_str()); + + int nbComponents = field->countComponents(); + xmlNodePtr components = xmlNewChild(nodeField, 0, C_TAG_COMPONENTS, 0); + xmlNewProp(components, C_ATTR_COUNT, + BAD_CAST XaoUtils::intToString(nbComponents).c_str()); + + for (int j = 0; j < nbComponents; j++) { + xmlNodePtr nodeComponent = xmlNewChild(components, 0, C_TAG_COMPONENT, 0); + xmlNewProp(nodeComponent, C_ATTR_COMPONENT_COLUMN, + BAD_CAST XaoUtils::intToString(j).c_str()); + xmlNewProp(nodeComponent, C_ATTR_COMPONENT_NAME, + BAD_CAST field->getComponentName(j).c_str()); } - } - void exportFields(Xao* xaoObject, xmlNodePtr xao) - { - xmlNodePtr fields = xmlNewChild(xao, 0, C_TAG_FIELDS, 0); - xmlNewProp(fields, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(xaoObject->countFields()).c_str()); - - for (int i = 0; i < xaoObject->countFields(); i++) - { - Field* field = xaoObject->getField(i); - xmlNodePtr nodeField = xmlNewChild(fields, 0, C_TAG_FIELD, 0); - xmlNewProp(nodeField, C_ATTR_FIELD_NAME, BAD_CAST field->getName().c_str()); - xmlNewProp(nodeField, C_ATTR_FIELD_TYPE, BAD_CAST XaoUtils::fieldTypeToString(field->getType()).c_str()); - xmlNewProp(nodeField, C_ATTR_FIELD_DIMENSION, BAD_CAST XaoUtils::dimensionToString(field->getDimension()).c_str()); - - int nbComponents = field->countComponents(); - xmlNodePtr components = xmlNewChild(nodeField, 0, C_TAG_COMPONENTS, 0); - xmlNewProp(components, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(nbComponents).c_str()); - - for (int j = 0; j < nbComponents; j++) - { - xmlNodePtr nodeComponent = xmlNewChild(components, 0, C_TAG_COMPONENT, 0); - xmlNewProp(nodeComponent, C_ATTR_COMPONENT_COLUMN, BAD_CAST XaoUtils::intToString(j).c_str()); - xmlNewProp(nodeComponent, C_ATTR_COMPONENT_NAME, BAD_CAST field->getComponentName(j).c_str()); - } - - int nbSteps = field->countSteps(); - xmlNodePtr nodeSteps = xmlNewChild(nodeField, 0, C_TAG_STEPS, 0); - xmlNewProp(nodeSteps, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(nbSteps).c_str()); - for (stepIterator itStep = field->begin(); itStep != field->end(); itStep++) - { - Step* step = *itStep; - exportStep(step, field, nodeSteps); - } + int nbSteps = field->countSteps(); + xmlNodePtr nodeSteps = xmlNewChild(nodeField, 0, C_TAG_STEPS, 0); + xmlNewProp(nodeSteps, C_ATTR_COUNT, + BAD_CAST XaoUtils::intToString(nbSteps).c_str()); + for (stepIterator itStep = field->begin(); itStep != field->end(); + itStep++) { + Step *step = *itStep; + exportStep(step, field, nodeSteps); } } +} - void exportStep(Step* step, Field* /*field*/, xmlNodePtr nodeSteps) - { - xmlNodePtr nodeStep = xmlNewChild(nodeSteps, 0, C_TAG_STEP, 0); - xmlNewProp(nodeStep, C_ATTR_STEP_NUMBER, BAD_CAST XaoUtils::intToString(step->getStep()).c_str()); - if (step->getStamp() >= 0) - { - xmlNewProp(nodeStep, C_ATTR_STEP_STAMP, BAD_CAST XaoUtils::intToString(step->getStamp()).c_str()); - } +void exportStep(Step *step, Field * /*field*/, xmlNodePtr nodeSteps) { + xmlNodePtr nodeStep = xmlNewChild(nodeSteps, 0, C_TAG_STEP, 0); + xmlNewProp(nodeStep, C_ATTR_STEP_NUMBER, + BAD_CAST XaoUtils::intToString(step->getStep()).c_str()); + if (step->getStamp() >= 0) { + xmlNewProp(nodeStep, C_ATTR_STEP_STAMP, + BAD_CAST XaoUtils::intToString(step->getStamp()).c_str()); + } - for(int i = 0; i < step->countElements(); ++i) - { - xmlNodePtr nodeElt = xmlNewChild(nodeStep, 0, C_TAG_ELEMENT, 0); - xmlNewProp(nodeElt, C_ATTR_ELEMENT_INDEX, BAD_CAST XaoUtils::intToString(i).c_str()); - - for (int j = 0; j < step->countComponents(); ++j) - { - std::string content = step->getStringValue(i, j); - xmlNodePtr nodeValue = xmlNewChild(nodeElt, NULL, C_TAG_VALUE, BAD_CAST content.c_str()); - xmlNewProp(nodeValue, C_ATTR_VALUE_COMPONENT, BAD_CAST XaoUtils::intToString(j).c_str()); - } + for (int i = 0; i < step->countElements(); ++i) { + xmlNodePtr nodeElt = xmlNewChild(nodeStep, 0, C_TAG_ELEMENT, 0); + xmlNewProp(nodeElt, C_ATTR_ELEMENT_INDEX, + BAD_CAST XaoUtils::intToString(i).c_str()); + + for (int j = 0; j < step->countComponents(); ++j) { + std::string content = step->getStringValue(i, j); + xmlNodePtr nodeValue = + xmlNewChild(nodeElt, NULL, C_TAG_VALUE, BAD_CAST content.c_str()); + xmlNewProp(nodeValue, C_ATTR_VALUE_COMPONENT, + BAD_CAST XaoUtils::intToString(j).c_str()); } } +} - void parseXMLDoc(xmlDocPtr doc, Xao* xaoObject) - { - // Get the root element node - xmlNodePtr root = xmlDocGetRootElement(doc); - if (xmlStrcmp(root->name , C_TAG_XAO) != 0) - throw XAO_Exception("Cannot read XAO file: invalid format XAO node not found"); +void parseXMLDoc(xmlDocPtr doc, Xao *xaoObject) { + // Get the root element node + xmlNodePtr root = xmlDocGetRootElement(doc); + if (xmlStrcmp(root->name, C_TAG_XAO) != 0) + throw XAO_Exception( + "Cannot read XAO file: invalid format XAO node not found"); - parseXaoNode(doc, root, xaoObject); + parseXaoNode(doc, root, xaoObject); - xmlFreeDoc(doc); // free document - //xmlCleanupParser(); // free globals //vsr: xmlCleanupParser should not be called from the application - } + xmlFreeDoc(doc); // free document + // xmlCleanupParser(); // free globals //vsr: xmlCleanupParser should not + // be called from the application +} - void parseXaoNode(xmlDocPtr doc, xmlNodePtr xaoNode, Xao* xaoObject) - { - std::string version = readStringProp(xaoNode, C_ATTR_XAO_VERSION, false, ""); - if (version != "") - xaoObject->setVersion(version); - - std::string author = readStringProp(xaoNode, C_ATTR_XAO_AUTHOR, false, ""); - xaoObject->setAuthor(author); - - for (xmlNodePtr node = xaoNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_GEOMETRY) == 0) - parseGeometryNode(doc, node, xaoObject); - else if (xmlStrcmp(node->name, C_TAG_GROUPS) == 0) - parseGroupsNode(node, xaoObject); - else if (xmlStrcmp(node->name, C_TAG_FIELDS) == 0) - parseFieldsNode(node, xaoObject); - } +void parseXaoNode(xmlDocPtr doc, xmlNodePtr xaoNode, Xao *xaoObject) { + std::string version = readStringProp(xaoNode, C_ATTR_XAO_VERSION, false, ""); + if (version != "") + xaoObject->setVersion(version); + + std::string author = readStringProp(xaoNode, C_ATTR_XAO_AUTHOR, false, ""); + xaoObject->setAuthor(author); + + for (xmlNodePtr node = xaoNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_GEOMETRY) == 0) + parseGeometryNode(doc, node, xaoObject); + else if (xmlStrcmp(node->name, C_TAG_GROUPS) == 0) + parseGroupsNode(node, xaoObject); + else if (xmlStrcmp(node->name, C_TAG_FIELDS) == 0) + parseFieldsNode(node, xaoObject); } +} - void parseGeometryNode(xmlDocPtr doc, xmlNodePtr geometryNode, Xao* xaoObject) - { - // get the shape and topo nodes - xmlNodePtr shapeNode = NULL; - xmlNodePtr topoNode = NULL; - for (xmlNodePtr node = geometryNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_SHAPE) == 0) - shapeNode = node; - else if (xmlStrcmp(node->name, C_TAG_TOPOLOGY) == 0) - topoNode = node; - } +void parseGeometryNode(xmlDocPtr doc, xmlNodePtr geometryNode, Xao *xaoObject) { + // get the shape and topo nodes + xmlNodePtr shapeNode = NULL; + xmlNodePtr topoNode = NULL; + for (xmlNodePtr node = geometryNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_SHAPE) == 0) + shapeNode = node; + else if (xmlStrcmp(node->name, C_TAG_TOPOLOGY) == 0) + topoNode = node; + } - std::string name = readStringProp(geometryNode, C_ATTR_GEOMETRY_NAME, false, ""); - std::string strFormat = readStringProp(shapeNode, C_ATTR_SHAPE_FORMAT, true, ""); - XAO::Format shapeFormat = XaoUtils::stringToShapeFormat(strFormat); - Geometry* geometry = Geometry::createGeometry(shapeFormat, name); + std::string name = + readStringProp(geometryNode, C_ATTR_GEOMETRY_NAME, false, ""); + std::string strFormat = + readStringProp(shapeNode, C_ATTR_SHAPE_FORMAT, true, ""); + XAO::Format shapeFormat = XaoUtils::stringToShapeFormat(strFormat); + Geometry *geometry = Geometry::createGeometry(shapeFormat, name); - parseShapeNode(doc, shapeNode, geometry); - parseTopologyNode(topoNode, geometry); + parseShapeNode(doc, shapeNode, geometry); + parseTopologyNode(topoNode, geometry); - xaoObject->setGeometry(geometry); - } + xaoObject->setGeometry(geometry); +} - void parseShapeNode(xmlDocPtr /*doc*/, xmlNodePtr shapeNode, Geometry* geometry) - { - if (geometry->getFormat() == XAO::BREP) - { - std::string strFile = readStringProp(shapeNode, C_ATTR_SHAPE_FILE, false, ""); - if (strFile != "") - { - geometry->readShapeFile(strFile); - } - else - { - // read brep from node content - xmlChar* data = xmlNodeGetContent(shapeNode->children); - if (data == NULL) - throw XAO_Exception("Missing BREP"); - geometry->setShapeString((char*)data); - xmlFree(data); - } - } - else - { - throw XAO_Exception(MsgBuilder() << "Shape format not supported: " - << XaoUtils::shapeFormatToString(geometry->getFormat())); +void parseShapeNode(xmlDocPtr /*doc*/, xmlNodePtr shapeNode, + Geometry *geometry) { + if (geometry->getFormat() == XAO::BREP) { + std::string strFile = + readStringProp(shapeNode, C_ATTR_SHAPE_FILE, false, ""); + if (strFile != "") { + geometry->readShapeFile(strFile); + } else { + // read brep from node content + xmlChar *data = xmlNodeGetContent(shapeNode->children); + if (data == NULL) + throw XAO_Exception("Missing BREP"); + geometry->setShapeString((char *)data); + xmlFree(data); } + } else { + throw XAO_Exception( + MsgBuilder() << "Shape format not supported: " + << XaoUtils::shapeFormatToString(geometry->getFormat())); } +} - void parseTopologyNode(xmlNodePtr topologyNode, Geometry* geometry) - { - for (xmlNodePtr node = topologyNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_VERTICES) == 0) - parseVerticesNode(node, geometry); - else if (xmlStrcmp(node->name, C_TAG_EDGES) == 0) - parseEdgesNode(node, geometry); - else if (xmlStrcmp(node->name, C_TAG_FACES) == 0) - parseFacesNode(node, geometry); - else if (xmlStrcmp(node->name, C_TAG_SOLIDS) == 0) - parseSolidsNode(node, geometry); - } +void parseTopologyNode(xmlNodePtr topologyNode, Geometry *geometry) { + for (xmlNodePtr node = topologyNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_VERTICES) == 0) + parseVerticesNode(node, geometry); + else if (xmlStrcmp(node->name, C_TAG_EDGES) == 0) + parseEdgesNode(node, geometry); + else if (xmlStrcmp(node->name, C_TAG_FACES) == 0) + parseFacesNode(node, geometry); + else if (xmlStrcmp(node->name, C_TAG_SOLIDS) == 0) + parseSolidsNode(node, geometry); } +} + +void parseVerticesNode(xmlNodePtr verticesNode, Geometry *geometry) { + int count = readIntegerProp(verticesNode, C_ATTR_COUNT, true, -1); + geometry->setCountVertices(count); - void parseVerticesNode(xmlNodePtr verticesNode, Geometry* geometry) - { - int count = readIntegerProp(verticesNode, C_ATTR_COUNT, true, -1); - geometry->setCountVertices(count); - - for (xmlNodePtr node = verticesNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_VERTEX) == 0) - { - int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); - std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); - std::string reference = readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); - - geometry->setVertex(index, name, reference); - } + for (xmlNodePtr node = verticesNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_VERTEX) == 0) { + int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); + std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); + std::string reference = + readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); + + geometry->setVertex(index, name, reference); } } +} + +void parseEdgesNode(xmlNodePtr edgesNode, Geometry *geometry) { + int count = readIntegerProp(edgesNode, C_ATTR_COUNT, true, -1); + geometry->setCountEdges(count); + + for (xmlNodePtr node = edgesNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_EDGE) == 0) { + int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); + std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); + std::string reference = + readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); - void parseEdgesNode(xmlNodePtr edgesNode, Geometry* geometry) - { - int count = readIntegerProp(edgesNode, C_ATTR_COUNT, true, -1); - geometry->setCountEdges(count); - - for (xmlNodePtr node = edgesNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_EDGE) == 0) - { - int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); - std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); - std::string reference = readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); - - geometry->setEdge(index, name, reference); - } + geometry->setEdge(index, name, reference); } } +} + +void parseFacesNode(xmlNodePtr facesNode, Geometry *geometry) { + int count = readIntegerProp(facesNode, C_ATTR_COUNT, true, -1); + geometry->setCountFaces(count); + + for (xmlNodePtr node = facesNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_FACE) == 0) { + int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); + std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); + std::string reference = + readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); - void parseFacesNode(xmlNodePtr facesNode, Geometry* geometry) - { - int count = readIntegerProp(facesNode, C_ATTR_COUNT, true, -1); - geometry->setCountFaces(count); - - for (xmlNodePtr node = facesNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_FACE) == 0) - { - int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); - std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); - std::string reference = readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); - - geometry->setFace(index, name, reference); - } + geometry->setFace(index, name, reference); } } +} + +void parseSolidsNode(xmlNodePtr solidsNode, Geometry *geometry) { + int count = readIntegerProp(solidsNode, C_ATTR_COUNT, true, -1); + geometry->setCountSolids(count); - void parseSolidsNode(xmlNodePtr solidsNode, Geometry* geometry) - { - int count = readIntegerProp(solidsNode, C_ATTR_COUNT, true, -1); - geometry->setCountSolids(count); - - for (xmlNodePtr node = solidsNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_SOLID) == 0) - { - int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); - std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); - std::string reference = readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); - - geometry->setSolid(index, name, reference); - } + for (xmlNodePtr node = solidsNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_SOLID) == 0) { + int index = readIntegerProp(node, C_ATTR_ELT_INDEX, true, -1); + std::string name = readStringProp(node, C_ATTR_ELT_NAME, false, ""); + std::string reference = + readStringProp(node, C_ATTR_ELT_REFERENCE, true, ""); + + geometry->setSolid(index, name, reference); } } +} - void parseGroupsNode(xmlNodePtr groupsNode, Xao* xaoObject) - { - for (xmlNodePtr node = groupsNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_GROUP) == 0) - { - parseGroupNode(node, xaoObject); - } +void parseGroupsNode(xmlNodePtr groupsNode, Xao *xaoObject) { + for (xmlNodePtr node = groupsNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_GROUP) == 0) { + parseGroupNode(node, xaoObject); } } +} + +void parseGroupNode(xmlNodePtr groupNode, Xao *xaoObject) { + std::string strDimension = + readStringProp(groupNode, C_ATTR_GROUP_DIM, true, ""); + XAO::Dimension dim = XaoUtils::stringToDimension(strDimension); + Group *group = xaoObject->addGroup(dim); - void parseGroupNode(xmlNodePtr groupNode, Xao* xaoObject) - { - std::string strDimension = readStringProp(groupNode, C_ATTR_GROUP_DIM, true, ""); - XAO::Dimension dim = XaoUtils::stringToDimension(strDimension); - Group* group = xaoObject->addGroup(dim); - - std::string name = readStringProp(groupNode, C_ATTR_GROUP_NAME, false, ""); - group->setName(name); - - for (xmlNodePtr node = groupNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_ELEMENT) == 0) - { - int index = readIntegerProp(node, C_ATTR_ELEMENT_INDEX, true, -1); - group->add(index); - } + std::string name = readStringProp(groupNode, C_ATTR_GROUP_NAME, false, ""); + group->setName(name); + + for (xmlNodePtr node = groupNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_ELEMENT) == 0) { + int index = readIntegerProp(node, C_ATTR_ELEMENT_INDEX, true, -1); + group->add(index); } } +} - void parseFieldsNode(xmlNodePtr fieldsNode, Xao* xaoObject) - { - for (xmlNodePtr node = fieldsNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_FIELD) == 0) - { - parseFieldNode(node, xaoObject); - } +void parseFieldsNode(xmlNodePtr fieldsNode, Xao *xaoObject) { + for (xmlNodePtr node = fieldsNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_FIELD) == 0) { + parseFieldNode(node, xaoObject); } } +} - void parseFieldNode(xmlNodePtr fieldNode, Xao* xaoObject) - { - std::string strDimension = readStringProp(fieldNode, C_ATTR_FIELD_DIMENSION, true, ""); - XAO::Dimension dim = XaoUtils::stringToDimension(strDimension); +void parseFieldNode(xmlNodePtr fieldNode, Xao *xaoObject) { + std::string strDimension = + readStringProp(fieldNode, C_ATTR_FIELD_DIMENSION, true, ""); + XAO::Dimension dim = XaoUtils::stringToDimension(strDimension); - std::string strType = readStringProp(fieldNode, C_ATTR_FIELD_TYPE, true, ""); - XAO::Type type = XaoUtils::stringToFieldType(strType); + std::string strType = readStringProp(fieldNode, C_ATTR_FIELD_TYPE, true, ""); + XAO::Type type = XaoUtils::stringToFieldType(strType); - // we need to get the number of components first to create the field - xmlNodePtr componentsNode = NULL; - xmlNodePtr stepsNode = NULL; + // we need to get the number of components first to create the field + xmlNodePtr componentsNode = NULL; + xmlNodePtr stepsNode = NULL; - for (xmlNodePtr node = fieldNode->children; node; node = node->next) - { - if (xmlStrcmp(node->name, C_TAG_COMPONENTS) == 0) - componentsNode = node; - else if (xmlStrcmp(node->name, C_TAG_STEPS) == 0) - stepsNode = node; - } + for (xmlNodePtr node = fieldNode->children; node; node = node->next) { + if (xmlStrcmp(node->name, C_TAG_COMPONENTS) == 0) + componentsNode = node; + else if (xmlStrcmp(node->name, C_TAG_STEPS) == 0) + stepsNode = node; + } - // ensure that the components node is defined - if (componentsNode == NULL) - { - throw XAO_Exception(MsgBuilder() << "Line " << fieldNode->line << ": " - << "No components defined for field."); - } + // ensure that the components node is defined + if (componentsNode == NULL) { + throw XAO_Exception(MsgBuilder() << "Line " << fieldNode->line << ": " + << "No components defined for field."); + } - // create the field - int nbComponents = readIntegerProp(componentsNode, C_ATTR_COUNT, true, -1); - Field* field = xaoObject->addField(type, dim, nbComponents); - - // parse the components - for (xmlNodePtr compNode = componentsNode->children; compNode; compNode = compNode->next) - { - std::string compName= readStringProp(compNode, C_ATTR_COMPONENT_NAME, false, ""); - if (compName.size() > 0) - { - int col = readIntegerProp(compNode, C_ATTR_COMPONENT_COLUMN, true, -1); - field->setComponentName(col, compName); - } + // create the field + int nbComponents = readIntegerProp(componentsNode, C_ATTR_COUNT, true, -1); + Field *field = xaoObject->addField(type, dim, nbComponents); + + // parse the components + for (xmlNodePtr compNode = componentsNode->children; compNode; + compNode = compNode->next) { + std::string compName = + readStringProp(compNode, C_ATTR_COMPONENT_NAME, false, ""); + if (compName.size() > 0) { + int col = readIntegerProp(compNode, C_ATTR_COMPONENT_COLUMN, true, -1); + field->setComponentName(col, compName); } + } - // set the name - std::string name = readStringProp(fieldNode, C_ATTR_FIELD_NAME, false, ""); - if (name.size() > 0) field->setName(name); - - // read the steps - if (stepsNode != 0) - { - for (xmlNodePtr stepNode = stepsNode->children; stepNode; stepNode = stepNode->next) - { - if (xmlStrcmp(stepNode->name, C_TAG_STEP) == 0) - { - parseStepNode(stepNode, field); - } - } + // set the name + std::string name = readStringProp(fieldNode, C_ATTR_FIELD_NAME, false, ""); + if (name.size() > 0) + field->setName(name); + + // read the steps + if (stepsNode != 0) { + for (xmlNodePtr stepNode = stepsNode->children; stepNode; + stepNode = stepNode->next) { + if (xmlStrcmp(stepNode->name, C_TAG_STEP) == 0) { + parseStepNode(stepNode, field); + } } } +} - void parseStepNode(xmlNodePtr stepNode, Field* field) - { - int stepNumber = readIntegerProp(stepNode, C_ATTR_STEP_NUMBER, true, -1); - Step* step = field->addNewStep(stepNumber); +void parseStepNode(xmlNodePtr stepNode, Field *field) { + int stepNumber = readIntegerProp(stepNode, C_ATTR_STEP_NUMBER, true, -1); + Step *step = field->addNewStep(stepNumber); - int stepStamp = readIntegerProp(stepNode, C_ATTR_STEP_STAMP, false, -1); - if (stepStamp != -1) - { - step->setStamp(stepStamp); - } + int stepStamp = readIntegerProp(stepNode, C_ATTR_STEP_STAMP, false, -1); + if (stepStamp != -1) { + step->setStamp(stepStamp); + } - for (xmlNodePtr eltNode = stepNode->children; eltNode; eltNode = eltNode->next) - { - if (xmlStrcmp(eltNode->name, C_TAG_ELEMENT) == 0) - { - parseStepElementNode(eltNode, step); - } + for (xmlNodePtr eltNode = stepNode->children; eltNode; + eltNode = eltNode->next) { + if (xmlStrcmp(eltNode->name, C_TAG_ELEMENT) == 0) { + parseStepElementNode(eltNode, step); } } +} - void parseStepElementNode(xmlNodePtr eltNode, Step* step) - { - int index = readIntegerProp(eltNode, C_ATTR_ELT_INDEX, true, -1); - - for (xmlNodePtr valNode = eltNode->children; valNode; valNode = valNode->next) - { - if (xmlStrcmp(valNode->name, C_TAG_VALUE) == 0) - { - int component = readIntegerProp(valNode, C_ATTR_VALUE_COMPONENT, true, -1); - xmlChar* data = xmlNodeGetContent(valNode->children); - - std::string value; - if (data != NULL) - { - value = (char*)data; - } - else if (step->getType() != XAO::STRING) - { - throw XAO_Exception(MsgBuilder() << "Line " << valNode->line << ": no content for value."); - } - - step->setStringValue(index, component, value); - } +void parseStepElementNode(xmlNodePtr eltNode, Step *step) { + int index = readIntegerProp(eltNode, C_ATTR_ELT_INDEX, true, -1); + + for (xmlNodePtr valNode = eltNode->children; valNode; + valNode = valNode->next) { + if (xmlStrcmp(valNode->name, C_TAG_VALUE) == 0) { + int component = + readIntegerProp(valNode, C_ATTR_VALUE_COMPONENT, true, -1); + xmlChar *data = xmlNodeGetContent(valNode->children); + + std::string value; + if (data != NULL) { + value = (char *)data; + } else if (step->getType() != XAO::STRING) { + throw XAO_Exception(MsgBuilder() << "Line " << valNode->line + << ": no content for value."); + } + + step->setStringValue(index, component, value); } } } +} // namespace -bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName) +bool XaoExporter::saveToFile(Xao *xaoObject, const std::string &fileName, + const std::string &shapeFileName) { - xmlDocPtr doc = exportXMLDoc(xaoObject, shapeFileName); - xmlSaveFormatFileEnc(fileName.c_str(), doc, "UTF-8", 1); // format = 1 for node indentation - xmlFreeDoc(doc); + xmlDocPtr doc = exportXMLDoc(xaoObject, shapeFileName); + xmlSaveFormatFileEnc(fileName.c_str(), doc, "UTF-8", + 1); // format = 1 for node indentation + xmlFreeDoc(doc); - return true; + return true; } -const std::string XaoExporter::saveToXml(Xao* xaoObject) +const std::string XaoExporter::saveToXml(Xao *xaoObject) { - xmlDocPtr doc = exportXMLDoc(xaoObject, ""); - - xmlChar *xmlbuff; - int buffersize; - //xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1); // format = 1 for node indentation - // save with encoding to correspond to "saveToFile" and provide the same file size - xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "UTF-8", 1); // format = 1 for node indentation - xmlFreeDoc(doc); - xmlCleanupGlobals(); - - return (char*)xmlbuff; + xmlDocPtr doc = exportXMLDoc(xaoObject, ""); + + xmlChar *xmlbuff; + int buffersize; + // xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1); // format = 1 for + // node indentation + // save with encoding to correspond to "saveToFile" and provide the same file + // size + xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "UTF-8", + 1); // format = 1 for node indentation + xmlFreeDoc(doc); + xmlCleanupGlobals(); + + return (char *)xmlbuff; } -bool XaoExporter::readFromFile(const std::string& fileName, Xao* xaoObject) +bool XaoExporter::readFromFile(const std::string &fileName, Xao *xaoObject) { - // parse the file and get the DOM - int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; - xmlDocPtr doc = xmlReadFile(fileName.c_str(), NULL, options); - if (doc == NULL) - { - throw XAO_Exception("Cannot read XAO file"); - } + // parse the file and get the DOM + int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; + xmlDocPtr doc = xmlReadFile(fileName.c_str(), NULL, options); + if (doc == NULL) { + throw XAO_Exception("Cannot read XAO file"); + } - parseXMLDoc(doc, xaoObject); - return true; + parseXMLDoc(doc, xaoObject); + return true; } -bool XaoExporter::setXML(const std::string& xml, Xao* xaoObject) +bool XaoExporter::setXML(const std::string &xml, Xao *xaoObject) { - int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; - xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options); - if (doc == NULL) - { - throw XAO_Exception("Cannot read XAO stream"); - } + int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; + xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options); + if (doc == NULL) { + throw XAO_Exception("Cannot read XAO stream"); + } - parseXMLDoc(doc, xaoObject); - return true; + parseXMLDoc(doc, xaoObject); + return true; } diff --git a/src/XAO/XAO_XaoExporter.hxx b/src/XAO/XAO_XaoExporter.hxx index 09999c8b0..a5aa34738 100644 --- a/src/XAO/XAO_XaoExporter.hxx +++ b/src/XAO/XAO_XaoExporter.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -22,61 +23,55 @@ #define __XAO_XAOEXPORTER_HXX__ #include "XAO.hxx" -#include "XAO_Xao.hxx" +#include "XAO_Field.hxx" #include "XAO_Geometry.hxx" #include "XAO_Group.hxx" -#include "XAO_Field.hxx" +#include "XAO_Xao.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif -namespace XAO -{ - /** - * @class XaoExporter - * Util class for import/export XAO. - */ - class XAO_EXPORT XaoExporter - { - public: - /** - * Saves the XAO object to a file. - * @param xaoObject the object to export. - * @param fileName the path of the file to create. - * @param shapeFileName if not empty save the shape in an this external file. - * @return true if the export was successful, false otherwise. - */ - static bool saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName) - ; - - /** - * Saves the XAO object to a XML string. - * @param xaoObject the object to export. - * @return the XML string. - */ - static const std::string saveToXml(Xao* xaoObject) - ; +namespace XAO { +/** + * @class XaoExporter + * Util class for import/export XAO. + */ +class XAO_EXPORT XaoExporter { +public: + /** + * Saves the XAO object to a file. + * @param xaoObject the object to export. + * @param fileName the path of the file to create. + * @param shapeFileName if not empty save the shape in an this external file. + * @return true if the export was successful, false otherwise. + */ + static bool saveToFile(Xao *xaoObject, const std::string &fileName, + const std::string &shapeFileName); - /** - * Reads a XAO object from a file. - * @param fileName the path of the file to read. - * @param xaoObject the XAO object. - * @return true if the XAO object was read successful, false otherwise. - */ - static bool readFromFile(const std::string& fileName, Xao* xaoObject) - ; + /** + * Saves the XAO object to a XML string. + * @param xaoObject the object to export. + * @return the XML string. + */ + static const std::string saveToXml(Xao *xaoObject); - /** - * Reads a XAO object from an XML string. - * @param xml the XML string. - * @param xaoObject the XAO object. - * @return true if the XAO object was read successful, false otherwise. - */ - static bool setXML(const std::string& xml, Xao* xaoObject) - ; - }; -} + /** + * Reads a XAO object from a file. + * @param fileName the path of the file to read. + * @param xaoObject the XAO object. + * @return true if the XAO object was read successful, false otherwise. + */ + static bool readFromFile(const std::string &fileName, Xao *xaoObject); + /** + * Reads a XAO object from an XML string. + * @param xml the XML string. + * @param xaoObject the XAO object. + * @return true if the XAO object was read successful, false otherwise. + */ + static bool setXML(const std::string &xml, Xao *xaoObject); +}; +} // namespace XAO #endif /* __XAO_XAOEXPORTER_HXX__ */ diff --git a/src/XAO/XAO_XaoUtils.cxx b/src/XAO/XAO_XaoUtils.cxx index 394443501..732d9157b 100644 --- a/src/XAO/XAO_XaoUtils.cxx +++ b/src/XAO/XAO_XaoUtils.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) @@ -26,130 +27,119 @@ using namespace XAO; - -std::string XaoUtils::intToString(int value) -{ - std::ostringstream str; - str << value; - return str.str(); +std::string XaoUtils::intToString(int value) { + std::ostringstream str; + str << value; + return str.str(); } -int XaoUtils::stringToInt(const std::string& value) -{ - int res; - std::istringstream convert(value); - if ( !(convert >> res) ) - throw XAO_Exception(MsgBuilder() << "Cannot convert '" << value << "' to integer."); - return res; +int XaoUtils::stringToInt(const std::string &value) { + int res; + std::istringstream convert(value); + if (!(convert >> res)) + throw XAO_Exception(MsgBuilder() + << "Cannot convert '" << value << "' to integer."); + return res; } -std::string XaoUtils::doubleToString(double value) -{ - std::ostringstream str; - str << value; - return str.str(); +std::string XaoUtils::doubleToString(double value) { + std::ostringstream str; + str << value; + return str.str(); } -double XaoUtils::stringToDouble(const std::string& value) -{ - double res; - std::istringstream convert(value); - if ( !(convert >> res) ) - throw XAO_Exception(MsgBuilder() << "Cannot convert '" << value << "' to double."); - return res; +double XaoUtils::stringToDouble(const std::string &value) { + double res; + std::istringstream convert(value); + if (!(convert >> res)) + throw XAO_Exception(MsgBuilder() + << "Cannot convert '" << value << "' to double."); + return res; } -std::string XaoUtils::booleanToString(bool value) -{ - return value ? "true" : "false"; +std::string XaoUtils::booleanToString(bool value) { + return value ? "true" : "false"; } -bool XaoUtils::stringToBoolean(const std::string& value) -{ - if (value == "true" || value == "1") - return true; - if (value == "false" || value == "0") - return false; +bool XaoUtils::stringToBoolean(const std::string &value) { + if (value == "true" || value == "1") + return true; + if (value == "false" || value == "0") + return false; - throw XAO_Exception(MsgBuilder() << "Invalid boolean value: " << value); + throw XAO_Exception(MsgBuilder() << "Invalid boolean value: " << value); } -std::string XaoUtils::dimensionToString(XAO::Dimension dimension) -{ - if (dimension == XAO::VERTEX) - return "vertex"; - if (dimension == XAO::EDGE) - return "edge"; - if (dimension == XAO::FACE) - return "face"; - if (dimension == XAO::SOLID) - return "solid"; - if (dimension == XAO::WHOLE) - return "whole"; - - throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension); +std::string XaoUtils::dimensionToString(XAO::Dimension dimension) { + if (dimension == XAO::VERTEX) + return "vertex"; + if (dimension == XAO::EDGE) + return "edge"; + if (dimension == XAO::FACE) + return "face"; + if (dimension == XAO::SOLID) + return "solid"; + if (dimension == XAO::WHOLE) + return "whole"; + + throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension); } -XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension) -{ - if (dimension == "vertex") - return XAO::VERTEX; - if (dimension == "edge") - return XAO::EDGE; - if (dimension == "face") - return XAO::FACE; - if (dimension == "solid") - return XAO::SOLID; - if (dimension == "whole") - return XAO::WHOLE; - - throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension); +XAO::Dimension XaoUtils::stringToDimension(const std::string &dimension) { + if (dimension == "vertex") + return XAO::VERTEX; + if (dimension == "edge") + return XAO::EDGE; + if (dimension == "face") + return XAO::FACE; + if (dimension == "solid") + return XAO::SOLID; + if (dimension == "whole") + return XAO::WHOLE; + + throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension); } -std::string XaoUtils::fieldTypeToString(XAO::Type type) -{ - if (type ==XAO:: BOOLEAN) - return "boolean"; - if (type == XAO::INTEGER) - return "integer"; - if (type == XAO::DOUBLE) - return "double"; - if (type == XAO::STRING) - return "string"; - - throw XAO_Exception(MsgBuilder() << "Bad type: " << type); +std::string XaoUtils::fieldTypeToString(XAO::Type type) { + if (type == XAO::BOOLEAN) + return "boolean"; + if (type == XAO::INTEGER) + return "integer"; + if (type == XAO::DOUBLE) + return "double"; + if (type == XAO::STRING) + return "string"; + + throw XAO_Exception(MsgBuilder() << "Bad type: " << type); } -XAO::Type XaoUtils::stringToFieldType(const std::string& type) -{ - if (type == "boolean") - return XAO::BOOLEAN; - if (type == "integer") - return XAO::INTEGER; - if (type == "double") - return XAO::DOUBLE; - if (type == "string") - return XAO::STRING; - - throw XAO_Exception(MsgBuilder() << "Bad type: " << type); +XAO::Type XaoUtils::stringToFieldType(const std::string &type) { + if (type == "boolean") + return XAO::BOOLEAN; + if (type == "integer") + return XAO::INTEGER; + if (type == "double") + return XAO::DOUBLE; + if (type == "string") + return XAO::STRING; + + throw XAO_Exception(MsgBuilder() << "Bad type: " << type); } -std::string XaoUtils::shapeFormatToString(XAO::Format format) -{ - if (format == XAO::BREP) - return "BREP"; - if (format == XAO::STEP) - return "STEP"; +std::string XaoUtils::shapeFormatToString(XAO::Format format) { + if (format == XAO::BREP) + return "BREP"; + if (format == XAO::STEP) + return "STEP"; - throw XAO_Exception(MsgBuilder() << "Bad format: " << format); + throw XAO_Exception(MsgBuilder() << "Bad format: " << format); } -XAO::Format XaoUtils::stringToShapeFormat(const std::string& format) -{ - if (format == "BREP") - return XAO::BREP; - if (format == "STEP") - return XAO::STEP; +XAO::Format XaoUtils::stringToShapeFormat(const std::string &format) { + if (format == "BREP") + return XAO::BREP; + if (format == "STEP") + return XAO::STEP; - throw XAO_Exception(MsgBuilder() << "Bad format: " << format); + throw XAO_Exception(MsgBuilder() << "Bad format: " << format); } diff --git a/src/XAO/XAO_XaoUtils.hxx b/src/XAO/XAO_XaoUtils.hxx index fbcd9d394..8a3800308 100644 --- a/src/XAO/XAO_XaoUtils.hxx +++ b/src/XAO/XAO_XaoUtils.hxx @@ -14,191 +14,179 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) #ifndef __XAO_UTILS_HXX__ #define __XAO_UTILS_HXX__ +#include #include #include -#include #include "XAO.hxx" #include "XAO_Exception.hxx" #ifdef WIN32 -#pragma warning(disable:4290) // Warning Exception ... +#pragma warning(disable : 4290) // Warning Exception ... #endif -namespace XAO -{ - /** - * @enum Format - */ - enum Format - { - BREP, - STEP - }; - - /** - * @enum Dimension - */ - enum Dimension - { - VERTEX = 0,//!< VERTEX - EDGE = 1, //!< EDGE - FACE = 2, //!< FACE - SOLID = 3, //!< SOLID - WHOLE = -1 //!< WHOLE - }; - - /** - * @enum Type - */ - enum Type - { - BOOLEAN = 0,//!< BOOLEAN - INTEGER = 1,//!< INTEGER - DOUBLE = 2, //!< DOUBLE - STRING = 3 //!< STRING - }; - - /** - * \class XaoUtils - * Utilities class to convert types. - */ - class XAO_EXPORT XaoUtils - { - public: - /** - * Converts an integer into a string. - * \param value the integer to convert. - * \return the string. - */ - static std::string intToString(int value); - - /** - * Converts a string into an integer. - * \param value the string to convert. - * \return the integer value. - * \throw XAO_Exception if value cannot be converted to string. - */ - static int stringToInt(const std::string& value); - - /** - * Converts a double into a string. - * \param value the double to convert. - * \return the string. - */ - static std::string doubleToString(double value); - /** - * Converts a string into a double. - * \param value the string to convert. - * \return the double value. - * \throw XAO_Exception if value cannot be converted to string. - */ - static double stringToDouble(const std::string& value); - - /** - * Converts a boolean into a string. - * \param value the boolean to convert. - * \return the string. - */ - static std::string booleanToString(bool value); - /** - * Converts a string into a boolean. - * \param value the string to convert. - * \return the boolean value. - * \throw XAO_Exception if value cannot be converted to boolean. - * \note accepted values are "true", "1", "false", "0". - */ - static bool stringToBoolean(const std::string& value); - - /** - * Converts a Dimension to string. - * \param dimension the Dimension to convert. - * \return the dimension as a string. - * \throw XAO_Exception - */ - static std::string dimensionToString(XAO::Dimension dimension); - - /** - * Converts a string into a Dimension. - * \param dimension the dimension as a string. - * \return the converted Dimension. - * \throw XAO_Exception if dimension cannot be converted. - */ - static XAO::Dimension stringToDimension(const std::string& dimension); - - /** - * Converts a Type to string. - * \param type the Type to convert. - * \return the Type as a string. - * \throw XAO_Exception - */ - static std::string fieldTypeToString(XAO::Type type); - - /** - * Converts a string into a Type. - * \param type the Type as a string. - * \return the converted Type. - * \throw XAO_Exception if type cannot be converted. - */ - static XAO::Type stringToFieldType(const std::string& type); - - /** - * Converts a Format to string. - * \param format the Format to convert. - * \return the Format as a string. - * \throw XAO_Exception - */ - static std::string shapeFormatToString(XAO::Format format); - - /** - * Converts a string into a Format. - * \param format the Format as a string. - * \return the converted Format. - * \throw XAO_Exception if format cannot be converted. - */ - static XAO::Format stringToShapeFormat(const std::string& format); - }; - - /** - * @class MsgBuilder - * MsgBuilder can be use to easily create messages. - */ - class MsgBuilder - { - public: - /** Constructor. */ - MsgBuilder() {}; - /** Destructor. */ - ~MsgBuilder() {}; +namespace XAO { +/** + * @enum Format + */ +enum Format { BREP, STEP }; + +/** + * @enum Dimension + */ +enum Dimension { + VERTEX = 0, //!< VERTEX + EDGE = 1, //!< EDGE + FACE = 2, //!< FACE + SOLID = 3, //!< SOLID + WHOLE = -1 //!< WHOLE +}; + +/** + * @enum Type + */ +enum Type { + BOOLEAN = 0, //!< BOOLEAN + INTEGER = 1, //!< INTEGER + DOUBLE = 2, //!< DOUBLE + STRING = 3 //!< STRING +}; + +/** + * \class XaoUtils + * Utilities class to convert types. + */ +class XAO_EXPORT XaoUtils { +public: + /** + * Converts an integer into a string. + * \param value the integer to convert. + * \return the string. + */ + static std::string intToString(int value); + + /** + * Converts a string into an integer. + * \param value the string to convert. + * \return the integer value. + * \throw XAO_Exception if value cannot be converted to string. + */ + static int stringToInt(const std::string &value); + + /** + * Converts a double into a string. + * \param value the double to convert. + * \return the string. + */ + static std::string doubleToString(double value); + /** + * Converts a string into a double. + * \param value the string to convert. + * \return the double value. + * \throw XAO_Exception if value cannot be converted to string. + */ + static double stringToDouble(const std::string &value); + + /** + * Converts a boolean into a string. + * \param value the boolean to convert. + * \return the string. + */ + static std::string booleanToString(bool value); + /** + * Converts a string into a boolean. + * \param value the string to convert. + * \return the boolean value. + * \throw XAO_Exception if value cannot be converted to boolean. + * \note accepted values are "true", "1", "false", "0". + */ + static bool stringToBoolean(const std::string &value); + + /** + * Converts a Dimension to string. + * \param dimension the Dimension to convert. + * \return the dimension as a string. + * \throw XAO_Exception + */ + static std::string dimensionToString(XAO::Dimension dimension); + + /** + * Converts a string into a Dimension. + * \param dimension the dimension as a string. + * \return the converted Dimension. + * \throw XAO_Exception if dimension cannot be converted. + */ + static XAO::Dimension stringToDimension(const std::string &dimension); + + /** + * Converts a Type to string. + * \param type the Type to convert. + * \return the Type as a string. + * \throw XAO_Exception + */ + static std::string fieldTypeToString(XAO::Type type); + + /** + * Converts a string into a Type. + * \param type the Type as a string. + * \return the converted Type. + * \throw XAO_Exception if type cannot be converted. + */ + static XAO::Type stringToFieldType(const std::string &type); + + /** + * Converts a Format to string. + * \param format the Format to convert. + * \return the Format as a string. + * \throw XAO_Exception + */ + static std::string shapeFormatToString(XAO::Format format); + + /** + * Converts a string into a Format. + * \param format the Format as a string. + * \return the converted Format. + * \throw XAO_Exception if format cannot be converted. + */ + static XAO::Format stringToShapeFormat(const std::string &format); +}; + +/** + * @class MsgBuilder + * MsgBuilder can be use to easily create messages. + */ +class MsgBuilder { +public: + /** Constructor. */ + MsgBuilder(){}; + /** Destructor. */ + ~MsgBuilder(){}; #ifndef SWIG - /** Stream operator. */ - template - MsgBuilder& operator <<(const T& t) - { - m_stream << t; - return *this; - } - - /** - * Conversion operator to char*. - */ - operator const char*() const { return m_stream.str().c_str(); } + /** Stream operator. */ + template MsgBuilder &operator<<(const T &t) { + m_stream << t; + return *this; + } + + /** + * Conversion operator to char*. + */ + operator const char *() const { return m_stream.str().c_str(); } #endif - private : - std::stringstream m_stream; - }; - -} - +private: + std::stringstream m_stream; +}; +} // namespace XAO #endif /* __XAO_UTILS_HXX__ */ diff --git a/src/XAO/tests/BrepGeometryTest.cxx b/src/XAO/tests/BrepGeometryTest.cxx index 6ccfe3b7c..7fe4a453d 100644 --- a/src/XAO/tests/BrepGeometryTest.cxx +++ b/src/XAO/tests/BrepGeometryTest.cxx @@ -14,312 +14,294 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include "TestUtils.hxx" -#include "BrepGeometryTest.hxx" -#include "../XAO_XaoUtils.hxx" -#include "../XAO_Xao.hxx" #include "../XAO_BrepGeometry.hxx" +#include "../XAO_Xao.hxx" +#include "../XAO_XaoUtils.hxx" +#include "BrepGeometryTest.hxx" +#include "TestUtils.hxx" using namespace XAO; -void BrepGeometryTest::setUp() -{ -} +void BrepGeometryTest::setUp() {} -void BrepGeometryTest::tearDown() -{ -} +void BrepGeometryTest::tearDown() {} -void BrepGeometryTest::cleanUp() -{ -} +void BrepGeometryTest::cleanUp() {} -void readBrep(Geometry* geom, const std::string& fileName) -{ - std::string filePath = "Shapes/Brep/" + fileName; - char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath(filePath)); - geom->setShapeString(txt); +void readBrep(Geometry *geom, const std::string &fileName) { + std::string filePath = "Shapes/Brep/" + fileName; + char *txt = TestUtils::readTextFile(TestUtils::getTestFilePath(filePath)); + geom->setShapeString(txt); } -void BrepGeometryTest::testGetIDs() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box1.brep"); - - CPPUNIT_ASSERT_EQUAL(8, geom->countElements(XAO::VERTEX)); - CPPUNIT_ASSERT_EQUAL(8, geom->countVertices()); - int vertices[8] = { 6,7,9,11,16,17,19,21 }; - for (int i = 0; i < 8; ++i) - CPPUNIT_ASSERT_EQUAL(vertices[i], geom->getVertexID(i)); - - CPPUNIT_ASSERT_EQUAL(12, geom->countElements(XAO::EDGE)); - CPPUNIT_ASSERT_EQUAL(12, geom->countEdges()); - int edges[12] = { 5,8,10,12,15,18,20,22,25,26,29,30 }; - for (int i = 0; i < 12; ++i) - CPPUNIT_ASSERT_EQUAL(edges[i], geom->getEdgeID(i)); - - CPPUNIT_ASSERT_EQUAL(6, geom->countElements(XAO::FACE)); - CPPUNIT_ASSERT_EQUAL(6, geom->countFaces()); - int faces[6] = { 3,13,23,27,31,33 }; - for (int i = 0; i < 6; ++i) - CPPUNIT_ASSERT_EQUAL(faces[i], geom->getFaceID(i)); - - CPPUNIT_ASSERT_EQUAL(1, geom->countElements(XAO::SOLID)); - CPPUNIT_ASSERT_EQUAL(1, geom->countSolids()); - CPPUNIT_ASSERT_EQUAL(1, geom->getSolidID(0)); - - delete geom; +void BrepGeometryTest::testGetIDs() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box1.brep"); + + CPPUNIT_ASSERT_EQUAL(8, geom->countElements(XAO::VERTEX)); + CPPUNIT_ASSERT_EQUAL(8, geom->countVertices()); + int vertices[8] = {6, 7, 9, 11, 16, 17, 19, 21}; + for (int i = 0; i < 8; ++i) + CPPUNIT_ASSERT_EQUAL(vertices[i], geom->getVertexID(i)); + + CPPUNIT_ASSERT_EQUAL(12, geom->countElements(XAO::EDGE)); + CPPUNIT_ASSERT_EQUAL(12, geom->countEdges()); + int edges[12] = {5, 8, 10, 12, 15, 18, 20, 22, 25, 26, 29, 30}; + for (int i = 0; i < 12; ++i) + CPPUNIT_ASSERT_EQUAL(edges[i], geom->getEdgeID(i)); + + CPPUNIT_ASSERT_EQUAL(6, geom->countElements(XAO::FACE)); + CPPUNIT_ASSERT_EQUAL(6, geom->countFaces()); + int faces[6] = {3, 13, 23, 27, 31, 33}; + for (int i = 0; i < 6; ++i) + CPPUNIT_ASSERT_EQUAL(faces[i], geom->getFaceID(i)); + + CPPUNIT_ASSERT_EQUAL(1, geom->countElements(XAO::SOLID)); + CPPUNIT_ASSERT_EQUAL(1, geom->countSolids()); + CPPUNIT_ASSERT_EQUAL(1, geom->getSolidID(0)); + + delete geom; } -void BrepGeometryTest::testGetReferences() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box1.brep"); - - // vertex of index 1 has id = 7 - CPPUNIT_ASSERT_EQUAL(std::string("7"), geom->getElementReference(XAO::VERTEX, 1)); - CPPUNIT_ASSERT_EQUAL(std::string("7"), geom->getVertexReference(1)); - CPPUNIT_ASSERT_EQUAL(7, geom->getVertexID(1)); - CPPUNIT_ASSERT_EQUAL(1, geom->getElementIndexByReference(XAO::VERTEX, "7")); - CPPUNIT_ASSERT_EQUAL(1, geom->findVertex(7)); - - // edge of index 1 has id = 8 - CPPUNIT_ASSERT_EQUAL(std::string("8"), geom->getElementReference(XAO::EDGE, 1)); - CPPUNIT_ASSERT_EQUAL(std::string("8"), geom->getEdgeReference(1)); - CPPUNIT_ASSERT_EQUAL(8, geom->getEdgeID(1)); - CPPUNIT_ASSERT_EQUAL(1, geom->getElementIndexByReference(XAO::EDGE, "8")); - CPPUNIT_ASSERT_EQUAL(1, geom->findEdge(8)); - - // face of index 1 has id = 13 - CPPUNIT_ASSERT_EQUAL(std::string("13"), geom->getElementReference(XAO::FACE, 1)); - CPPUNIT_ASSERT_EQUAL(std::string("13"), geom->getFaceReference(1)); - CPPUNIT_ASSERT_EQUAL(13, geom->getFaceID(1)); - CPPUNIT_ASSERT_EQUAL(1, geom->getElementIndexByReference(XAO::FACE, "13")); - CPPUNIT_ASSERT_EQUAL(1, geom->findFace(13)); - - // solid of index 0 has id = 1 - CPPUNIT_ASSERT_EQUAL(std::string("1"), geom->getElementReference(XAO::SOLID, 0)); - CPPUNIT_ASSERT_EQUAL(std::string("1"), geom->getSolidReference(0)); - CPPUNIT_ASSERT_EQUAL(1, geom->getSolidID(0)); - CPPUNIT_ASSERT_EQUAL(0, geom->getElementIndexByReference(XAO::SOLID, "1")); - CPPUNIT_ASSERT_EQUAL(0, geom->findSolid(1)); - - delete geom; +void BrepGeometryTest::testGetReferences() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box1.brep"); + + // vertex of index 1 has id = 7 + CPPUNIT_ASSERT_EQUAL(std::string("7"), + geom->getElementReference(XAO::VERTEX, 1)); + CPPUNIT_ASSERT_EQUAL(std::string("7"), geom->getVertexReference(1)); + CPPUNIT_ASSERT_EQUAL(7, geom->getVertexID(1)); + CPPUNIT_ASSERT_EQUAL(1, geom->getElementIndexByReference(XAO::VERTEX, "7")); + CPPUNIT_ASSERT_EQUAL(1, geom->findVertex(7)); + + // edge of index 1 has id = 8 + CPPUNIT_ASSERT_EQUAL(std::string("8"), + geom->getElementReference(XAO::EDGE, 1)); + CPPUNIT_ASSERT_EQUAL(std::string("8"), geom->getEdgeReference(1)); + CPPUNIT_ASSERT_EQUAL(8, geom->getEdgeID(1)); + CPPUNIT_ASSERT_EQUAL(1, geom->getElementIndexByReference(XAO::EDGE, "8")); + CPPUNIT_ASSERT_EQUAL(1, geom->findEdge(8)); + + // face of index 1 has id = 13 + CPPUNIT_ASSERT_EQUAL(std::string("13"), + geom->getElementReference(XAO::FACE, 1)); + CPPUNIT_ASSERT_EQUAL(std::string("13"), geom->getFaceReference(1)); + CPPUNIT_ASSERT_EQUAL(13, geom->getFaceID(1)); + CPPUNIT_ASSERT_EQUAL(1, geom->getElementIndexByReference(XAO::FACE, "13")); + CPPUNIT_ASSERT_EQUAL(1, geom->findFace(13)); + + // solid of index 0 has id = 1 + CPPUNIT_ASSERT_EQUAL(std::string("1"), + geom->getElementReference(XAO::SOLID, 0)); + CPPUNIT_ASSERT_EQUAL(std::string("1"), geom->getSolidReference(0)); + CPPUNIT_ASSERT_EQUAL(1, geom->getSolidID(0)); + CPPUNIT_ASSERT_EQUAL(0, geom->getElementIndexByReference(XAO::SOLID, "1")); + CPPUNIT_ASSERT_EQUAL(0, geom->findSolid(1)); + + delete geom; } -void BrepGeometryTest::testGetNames() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box1.brep"); - - int id; - - // vertex of index 1 has id = 7 - id = 7; - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findVertexName(id)); - geom->changeVertexName(id, std::string("va")); - CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->findVertexName(id)); - CPPUNIT_ASSERT_THROW(geom->changeVertexName(100, "a"), XAO_Exception); - CPPUNIT_ASSERT_THROW(geom->findVertexName(100), XAO_Exception); - - // edge of index 1 has id = 8 - id = 8; - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findEdgeName(id)); - geom->changeEdgeName(id, std::string("ea")); - CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->findEdgeName(id)); - CPPUNIT_ASSERT_THROW(geom->changeEdgeName(100, "a"), XAO_Exception); - CPPUNIT_ASSERT_THROW(geom->findEdgeName(100), XAO_Exception); - - // face of index 1 has id = 13 - id = 13; - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findFaceName(id)); - geom->changeFaceName(id, std::string("fa")); - CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->findFaceName(id)); - CPPUNIT_ASSERT_THROW(geom->changeFaceName(100, "a"), XAO_Exception); - CPPUNIT_ASSERT_THROW(geom->findFaceName(100), XAO_Exception); - - // solid of index 0 has id = 1 - id = 1; - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findSolidName(id)); - geom->changeSolidName(id, std::string("sa")); - CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->findSolidName(id)); - CPPUNIT_ASSERT_THROW(geom->changeSolidName(100, "a"), XAO_Exception); - CPPUNIT_ASSERT_THROW(geom->findSolidName(100), XAO_Exception); - - delete geom; +void BrepGeometryTest::testGetNames() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box1.brep"); + + int id; + + // vertex of index 1 has id = 7 + id = 7; + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findVertexName(id)); + geom->changeVertexName(id, std::string("va")); + CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->findVertexName(id)); + CPPUNIT_ASSERT_THROW(geom->changeVertexName(100, "a"), XAO_Exception); + CPPUNIT_ASSERT_THROW(geom->findVertexName(100), XAO_Exception); + + // edge of index 1 has id = 8 + id = 8; + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findEdgeName(id)); + geom->changeEdgeName(id, std::string("ea")); + CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->findEdgeName(id)); + CPPUNIT_ASSERT_THROW(geom->changeEdgeName(100, "a"), XAO_Exception); + CPPUNIT_ASSERT_THROW(geom->findEdgeName(100), XAO_Exception); + + // face of index 1 has id = 13 + id = 13; + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findFaceName(id)); + geom->changeFaceName(id, std::string("fa")); + CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->findFaceName(id)); + CPPUNIT_ASSERT_THROW(geom->changeFaceName(100, "a"), XAO_Exception); + CPPUNIT_ASSERT_THROW(geom->findFaceName(100), XAO_Exception); + + // solid of index 0 has id = 1 + id = 1; + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findSolidName(id)); + geom->changeSolidName(id, std::string("sa")); + CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->findSolidName(id)); + CPPUNIT_ASSERT_THROW(geom->changeSolidName(100, "a"), XAO_Exception); + CPPUNIT_ASSERT_THROW(geom->findSolidName(100), XAO_Exception); + + delete geom; } -void BrepGeometryTest::testGetEdgeVertices() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); +void BrepGeometryTest::testGetEdgeVertices() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); - // edge of index 23, id = #63 - // vertex are 47 (#12), 59 (#15) - int v1, v2; - geom->getEdgeVertices(23, v1, v2); - CPPUNIT_ASSERT_EQUAL(12, v1); - CPPUNIT_ASSERT_EQUAL(15, v2); + // edge of index 23, id = #63 + // vertex are 47 (#12), 59 (#15) + int v1, v2; + geom->getEdgeVertices(23, v1, v2); + CPPUNIT_ASSERT_EQUAL(12, v1); + CPPUNIT_ASSERT_EQUAL(15, v2); - delete geom; + delete geom; } -void printVector(std::vector& v) -{ - std::cout << "# "; - for (unsigned int i = 0; i < v.size(); i++) - std::cout << v[i] << ", "; - std::cout << std::endl; +void printVector(std::vector &v) { + std::cout << "# "; + for (unsigned int i = 0; i < v.size(); i++) + std::cout << v[i] << ", "; + std::cout << std::endl; } -void BrepGeometryTest::testGetFaceEdges() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); - - CPPUNIT_ASSERT_EQUAL(2, geom->countFaceWires(1)); // face 13 - CPPUNIT_ASSERT_EQUAL(1, geom->countFaceWires(2)); // face 29 - - // wire 0 of face 1 (#13) => edge 4 (#15), 5 (#17), 0 (#5), 6 (#19) - std::vector edges = geom->getFaceEdges(1, 0); - CPPUNIT_ASSERT_EQUAL(4, (int)edges.size()); - int ids1[4] = { 4,5,0,6 }; - for (int i = 0; i < 4; ++i) - CPPUNIT_ASSERT_EQUAL(ids1[i], edges[i]); - - // wire 1 of face 13 => edge 7 (#21) ,8 (#24), 9 (#26), 10 (#28) - edges = geom->getFaceEdges(1, 1); - CPPUNIT_ASSERT_EQUAL(4, (int)edges.size()); - int ids2[4] = { 7,8,9,10 }; - for (int i = 0; i < 4; ++i) - CPPUNIT_ASSERT_EQUAL(ids2[i], edges[i]); - - delete geom; +void BrepGeometryTest::testGetFaceEdges() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); + + CPPUNIT_ASSERT_EQUAL(2, geom->countFaceWires(1)); // face 13 + CPPUNIT_ASSERT_EQUAL(1, geom->countFaceWires(2)); // face 29 + + // wire 0 of face 1 (#13) => edge 4 (#15), 5 (#17), 0 (#5), 6 (#19) + std::vector edges = geom->getFaceEdges(1, 0); + CPPUNIT_ASSERT_EQUAL(4, (int)edges.size()); + int ids1[4] = {4, 5, 0, 6}; + for (int i = 0; i < 4; ++i) + CPPUNIT_ASSERT_EQUAL(ids1[i], edges[i]); + + // wire 1 of face 13 => edge 7 (#21) ,8 (#24), 9 (#26), 10 (#28) + edges = geom->getFaceEdges(1, 1); + CPPUNIT_ASSERT_EQUAL(4, (int)edges.size()); + int ids2[4] = {7, 8, 9, 10}; + for (int i = 0; i < 4; ++i) + CPPUNIT_ASSERT_EQUAL(ids2[i], edges[i]); + + delete geom; } -void BrepGeometryTest::testSolidFaces() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "cut.brep"); +void BrepGeometryTest::testSolidFaces() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "cut.brep"); - CPPUNIT_ASSERT_EQUAL(5, geom->countSolidShells(0)); + CPPUNIT_ASSERT_EQUAL(5, geom->countSolidShells(0)); - std::vector faces = geom->getSolidFaces(0, 0); - CPPUNIT_ASSERT_EQUAL(6, (int)faces.size()); - int ids[6] = { 0, 1, 2, 3, 4, 5 }; - for (int i = 0; i < 6; ++i) - CPPUNIT_ASSERT_EQUAL(ids[i], faces[i]); + std::vector faces = geom->getSolidFaces(0, 0); + CPPUNIT_ASSERT_EQUAL(6, (int)faces.size()); + int ids[6] = {0, 1, 2, 3, 4, 5}; + for (int i = 0; i < 6; ++i) + CPPUNIT_ASSERT_EQUAL(ids[i], faces[i]); - faces = geom->getSolidFaces(0, 1); - CPPUNIT_ASSERT_EQUAL(6, (int)faces.size()); - int ids2[6] = { 6, 7, 8, 9, 10, 11 }; - for (int i = 0; i < 6; ++i) - CPPUNIT_ASSERT_EQUAL(ids2[i], faces[i]); + faces = geom->getSolidFaces(0, 1); + CPPUNIT_ASSERT_EQUAL(6, (int)faces.size()); + int ids2[6] = {6, 7, 8, 9, 10, 11}; + for (int i = 0; i < 6; ++i) + CPPUNIT_ASSERT_EQUAL(ids2[i], faces[i]); - delete geom; + delete geom; } -void BrepGeometryTest::testGetVertex() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); +void BrepGeometryTest::testGetVertex() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); - double x, y, z; - geom->getVertexXYZ(15, x, y, z); - CPPUNIT_ASSERT_DOUBLES_EQUAL(60., x, 1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(80., y, 1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(60., z, 1e-6); + double x, y, z; + geom->getVertexXYZ(15, x, y, z); + CPPUNIT_ASSERT_DOUBLES_EQUAL(60., x, 1e-6); + CPPUNIT_ASSERT_DOUBLES_EQUAL(80., y, 1e-6); + CPPUNIT_ASSERT_DOUBLES_EQUAL(60., z, 1e-6); - delete geom; + delete geom; } -void BrepGeometryTest::testGetEdgeLength() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); +void BrepGeometryTest::testGetEdgeLength() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); - // edges 0 (#5), 7 (#21) - CPPUNIT_ASSERT_DOUBLES_EQUAL(200., geom->getEdgeLength(0), 0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(80., geom->getEdgeLength(7), 0); + // edges 0 (#5), 7 (#21) + CPPUNIT_ASSERT_DOUBLES_EQUAL(200., geom->getEdgeLength(0), 0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(80., geom->getEdgeLength(7), 0); - delete geom; + delete geom; } -void BrepGeometryTest::testGetFaceArea() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); +void BrepGeometryTest::testGetFaceArea() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); - // faces 0 (#3), 1 (#13) - CPPUNIT_ASSERT_DOUBLES_EQUAL(40000., geom->getFaceArea(0), 1e-9); - CPPUNIT_ASSERT_DOUBLES_EQUAL(33600., geom->getFaceArea(1), 1e-9); + // faces 0 (#3), 1 (#13) + CPPUNIT_ASSERT_DOUBLES_EQUAL(40000., geom->getFaceArea(0), 1e-9); + CPPUNIT_ASSERT_DOUBLES_EQUAL(33600., geom->getFaceArea(1), 1e-9); - delete geom; + delete geom; } -void BrepGeometryTest::testGetSolidVolume() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); +void BrepGeometryTest::testGetSolidVolume() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); - CPPUNIT_ASSERT_DOUBLES_EQUAL(7488000., geom->getSolidVolume(0), 1e-9); + CPPUNIT_ASSERT_DOUBLES_EQUAL(7488000., geom->getSolidVolume(0), 1e-9); - delete geom; + delete geom; } -void BrepGeometryTest::testParse() -{ - BrepGeometry* geom = new BrepGeometry("box"); - readBrep(geom, "box2.brep"); - std::cout << std::endl; - - for (int solidIndex = 0; solidIndex < geom->countSolids(); ++solidIndex) - { - std::cout << "Solid #" << solidIndex << " : " << geom->getSolidReference(solidIndex) << std::endl; - int nbShells = geom->countSolidShells(solidIndex); - for (int shellIndex = 0; shellIndex < nbShells; ++shellIndex) - { - std::cout << " Shell #" << shellIndex << std::endl; - std::vector faces = geom->getSolidFaces(solidIndex, shellIndex); - for (unsigned int indf = 0; indf < faces.size(); ++indf) - { - int faceIndex = faces[indf]; - std::cout << " Face #" << geom->getFaceReference(faceIndex) << std::endl; - - int nbWires = geom->countFaceWires(faceIndex); - for (int wireIndex = 0; wireIndex < nbWires; ++wireIndex) - { - std::cout << " Wire #" << wireIndex << std::endl; - std::vector edges = geom->getFaceEdges(faceIndex, wireIndex); - for (unsigned int inde = 0; inde < edges.size(); ++inde) - { - int edgeIndex = edges[inde]; - std::cout << " Edge #" << geom->getEdgeReference(edgeIndex) << " : "; - - int va = 0, vb = 0; - geom->getEdgeVertices(edgeIndex, va, vb); - int vaRef = geom->getVertexID(va); - int vbRef = geom->getVertexID(vb); - double ax, ay, az, bx, by, bz; - geom->getVertexXYZ(va, ax, ay, az); - geom->getVertexXYZ(vb, bx, by, bz); - - std::cout << vaRef << " (" << ax << ", " << ay << ", " << az << ")"; - std::cout << " - "; - std::cout << vbRef << " (" << bx << ", " << by << ", " << bz << ")"; - std::cout << std::endl; - } - } - - - } +void BrepGeometryTest::testParse() { + BrepGeometry *geom = new BrepGeometry("box"); + readBrep(geom, "box2.brep"); + std::cout << std::endl; + + for (int solidIndex = 0; solidIndex < geom->countSolids(); ++solidIndex) { + std::cout << "Solid #" << solidIndex << " : " + << geom->getSolidReference(solidIndex) << std::endl; + int nbShells = geom->countSolidShells(solidIndex); + for (int shellIndex = 0; shellIndex < nbShells; ++shellIndex) { + std::cout << " Shell #" << shellIndex << std::endl; + std::vector faces = geom->getSolidFaces(solidIndex, shellIndex); + for (unsigned int indf = 0; indf < faces.size(); ++indf) { + int faceIndex = faces[indf]; + std::cout << " Face #" << geom->getFaceReference(faceIndex) + << std::endl; + + int nbWires = geom->countFaceWires(faceIndex); + for (int wireIndex = 0; wireIndex < nbWires; ++wireIndex) { + std::cout << " Wire #" << wireIndex << std::endl; + std::vector edges = geom->getFaceEdges(faceIndex, wireIndex); + for (unsigned int inde = 0; inde < edges.size(); ++inde) { + int edgeIndex = edges[inde]; + std::cout << " Edge #" << geom->getEdgeReference(edgeIndex) + << " : "; + + int va = 0, vb = 0; + geom->getEdgeVertices(edgeIndex, va, vb); + int vaRef = geom->getVertexID(va); + int vbRef = geom->getVertexID(vb); + double ax, ay, az, bx, by, bz; + geom->getVertexXYZ(va, ax, ay, az); + geom->getVertexXYZ(vb, bx, by, bz); + + std::cout << vaRef << " (" << ax << ", " << ay << ", " << az << ")"; + std::cout << " - "; + std::cout << vbRef << " (" << bx << ", " << by << ", " << bz << ")"; + std::cout << std::endl; + } } + } } + } - delete geom; + delete geom; } diff --git a/src/XAO/tests/BrepGeometryTest.hxx b/src/XAO/tests/BrepGeometryTest.hxx index 967c2e31d..d3b15d9a0 100644 --- a/src/XAO/tests/BrepGeometryTest.hxx +++ b/src/XAO/tests/BrepGeometryTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_BREPGEOMETRY_TEST_HXX__ @@ -22,43 +23,41 @@ #include -namespace XAO -{ - class BrepGeometryTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(BrepGeometryTest); - CPPUNIT_TEST(testGetIDs); - CPPUNIT_TEST(testGetReferences); - CPPUNIT_TEST(testGetNames); - CPPUNIT_TEST(testGetEdgeVertices); - CPPUNIT_TEST(testGetFaceEdges); - CPPUNIT_TEST(testSolidFaces); - CPPUNIT_TEST(testGetVertex); - CPPUNIT_TEST(testGetEdgeLength); - CPPUNIT_TEST(testGetFaceArea); - CPPUNIT_TEST(testGetSolidVolume); - CPPUNIT_TEST(testParse); - CPPUNIT_TEST_SUITE_END(); - - public: - void setUp(); - void tearDown(); - void cleanUp(); - - void testGetIDs(); - void testGetReferences(); - void testGetNames(); - void testGetEdgeVertices(); - void testGetFaceEdges(); - void testSolidFaces(); - - void testGetVertex(); - void testGetEdgeLength(); - void testGetFaceArea(); - void testGetSolidVolume(); - - void testParse(); - }; -} +namespace XAO { +class BrepGeometryTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(BrepGeometryTest); + CPPUNIT_TEST(testGetIDs); + CPPUNIT_TEST(testGetReferences); + CPPUNIT_TEST(testGetNames); + CPPUNIT_TEST(testGetEdgeVertices); + CPPUNIT_TEST(testGetFaceEdges); + CPPUNIT_TEST(testSolidFaces); + CPPUNIT_TEST(testGetVertex); + CPPUNIT_TEST(testGetEdgeLength); + CPPUNIT_TEST(testGetFaceArea); + CPPUNIT_TEST(testGetSolidVolume); + CPPUNIT_TEST(testParse); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp(); + void tearDown(); + void cleanUp(); + + void testGetIDs(); + void testGetReferences(); + void testGetNames(); + void testGetEdgeVertices(); + void testGetFaceEdges(); + void testSolidFaces(); + + void testGetVertex(); + void testGetEdgeLength(); + void testGetFaceArea(); + void testGetSolidVolume(); + + void testParse(); +}; +} // namespace XAO #endif // __XAO_BREPGEOMETRY_TEST_HXX__ diff --git a/src/XAO/tests/FieldTest.cxx b/src/XAO/tests/FieldTest.cxx index 2757c520d..d0fd533f0 100644 --- a/src/XAO/tests/FieldTest.cxx +++ b/src/XAO/tests/FieldTest.cxx @@ -14,486 +14,458 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include "FieldTest.hxx" -#include "../XAO_Xao.hxx" -#include "../XAO_XaoUtils.hxx" -#include "../XAO_Field.hxx" -#include "../XAO_Step.hxx" #include "../XAO_BooleanField.hxx" -#include "../XAO_IntegerField.hxx" #include "../XAO_DoubleField.hxx" +#include "../XAO_Field.hxx" +#include "../XAO_IntegerField.hxx" +#include "../XAO_Step.hxx" #include "../XAO_StringField.hxx" +#include "../XAO_Xao.hxx" +#include "../XAO_XaoUtils.hxx" +#include "FieldTest.hxx" using namespace XAO; - -void FieldTest::setUp() -{ -} - -void FieldTest::tearDown() -{ -} - -void FieldTest::cleanUp() -{ -} - -Field* FieldTest::testField(XAO::Type type) -{ - Field* f = Field::createField(type, XAO::FACE, 10, 3); - - CPPUNIT_ASSERT_EQUAL(0, (int)f->getName().size()); - CPPUNIT_ASSERT_EQUAL(type, f->getType()); - CPPUNIT_ASSERT_EQUAL(XAO::FACE, f->getDimension()); - CPPUNIT_ASSERT_EQUAL(3, f->countComponents()); - CPPUNIT_ASSERT_EQUAL(10, f->countElements()); - CPPUNIT_ASSERT_EQUAL(30, f->countValues()); - - f->setName("field1"); - CPPUNIT_ASSERT_EQUAL(std::string("field1"), f->getName()); - - CPPUNIT_ASSERT_EQUAL(0, (int)f->getComponentName(0).size()); - f->setComponentName(0, "x"); - f->setComponentName(1, "y"); - f->setComponentName(2, "z"); - CPPUNIT_ASSERT_EQUAL(3, f->countComponents()); - CPPUNIT_ASSERT_EQUAL(std::string("x"), f->getComponentName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("y"), f->getComponentName(1)); - CPPUNIT_ASSERT_EQUAL(std::string("z"), f->getComponentName(2)); - CPPUNIT_ASSERT_THROW(f->setComponentName(3, "a"), XAO_Exception); - CPPUNIT_ASSERT_THROW(f->getComponentName(3), XAO_Exception); - - CPPUNIT_ASSERT_EQUAL(0, f->countSteps()); - Step* step = f->addNewStep(0); - CPPUNIT_ASSERT_EQUAL(type, step->getType()); - CPPUNIT_ASSERT_EQUAL(1, f->countSteps()); - step = f->addNewStep(1); - step = f->addNewStep(2); - CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); - CPPUNIT_ASSERT_THROW(f->addNewStep(2), XAO_Exception); // step already exists - - CPPUNIT_ASSERT_EQUAL(true, f->removeStep(step)); - CPPUNIT_ASSERT_EQUAL(2, f->countSteps()); - CPPUNIT_ASSERT_EQUAL(false, f->removeStep(step)); // remove same - CPPUNIT_ASSERT_EQUAL(2, f->countSteps()); - - return f; +void FieldTest::setUp() {} + +void FieldTest::tearDown() {} + +void FieldTest::cleanUp() {} + +Field *FieldTest::testField(XAO::Type type) { + Field *f = Field::createField(type, XAO::FACE, 10, 3); + + CPPUNIT_ASSERT_EQUAL(0, (int)f->getName().size()); + CPPUNIT_ASSERT_EQUAL(type, f->getType()); + CPPUNIT_ASSERT_EQUAL(XAO::FACE, f->getDimension()); + CPPUNIT_ASSERT_EQUAL(3, f->countComponents()); + CPPUNIT_ASSERT_EQUAL(10, f->countElements()); + CPPUNIT_ASSERT_EQUAL(30, f->countValues()); + + f->setName("field1"); + CPPUNIT_ASSERT_EQUAL(std::string("field1"), f->getName()); + + CPPUNIT_ASSERT_EQUAL(0, (int)f->getComponentName(0).size()); + f->setComponentName(0, "x"); + f->setComponentName(1, "y"); + f->setComponentName(2, "z"); + CPPUNIT_ASSERT_EQUAL(3, f->countComponents()); + CPPUNIT_ASSERT_EQUAL(std::string("x"), f->getComponentName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("y"), f->getComponentName(1)); + CPPUNIT_ASSERT_EQUAL(std::string("z"), f->getComponentName(2)); + CPPUNIT_ASSERT_THROW(f->setComponentName(3, "a"), XAO_Exception); + CPPUNIT_ASSERT_THROW(f->getComponentName(3), XAO_Exception); + + CPPUNIT_ASSERT_EQUAL(0, f->countSteps()); + Step *step = f->addNewStep(0); + CPPUNIT_ASSERT_EQUAL(type, step->getType()); + CPPUNIT_ASSERT_EQUAL(1, f->countSteps()); + step = f->addNewStep(1); + step = f->addNewStep(2); + CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); + CPPUNIT_ASSERT_THROW(f->addNewStep(2), XAO_Exception); // step already exists + + CPPUNIT_ASSERT_EQUAL(true, f->removeStep(step)); + CPPUNIT_ASSERT_EQUAL(2, f->countSteps()); + CPPUNIT_ASSERT_EQUAL(false, f->removeStep(step)); // remove same + CPPUNIT_ASSERT_EQUAL(2, f->countSteps()); + + return f; } -void FieldTest::testBooleanField() -{ - BooleanField* f = (BooleanField*)testField(XAO::BOOLEAN); +void FieldTest::testBooleanField() { + BooleanField *f = (BooleanField *)testField(XAO::BOOLEAN); - BooleanStep* step = f->getStep(0); - CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType()); - CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); - CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); + BooleanStep *step = f->getStep(0); + CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType()); + CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); + CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); - step = f->addStep(10); - CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType()); - CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); - CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists + step = f->addStep(10); + CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType()); + CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); + CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists } -void FieldTest::testIntegerField() -{ - IntegerField* f = (IntegerField*)testField(XAO::INTEGER); +void FieldTest::testIntegerField() { + IntegerField *f = (IntegerField *)testField(XAO::INTEGER); - IntegerStep* step = f->getStep(0); - CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType()); - CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); - CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); + IntegerStep *step = f->getStep(0); + CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType()); + CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); + CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); - step = f->addStep(10); - CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType()); - CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); - CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists + step = f->addStep(10); + CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType()); + CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); + CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists } -void FieldTest::testDoubleField() -{ - DoubleField* f = (DoubleField*)testField(XAO::DOUBLE); - - DoubleStep* step = f->getStep(0); - CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType()); - CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); - CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); - - step = f->addStep(10); - CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType()); - CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); - CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists +void FieldTest::testDoubleField() { + DoubleField *f = (DoubleField *)testField(XAO::DOUBLE); + + DoubleStep *step = f->getStep(0); + CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType()); + CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); + CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); + + step = f->addStep(10); + CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType()); + CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); + CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists } -void FieldTest::testStringField() -{ - StringField* f = (StringField*)testField(XAO::STRING); - - StringStep* step = f->getStep(0); - CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType()); - CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); - CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); - - step = f->addStep(10); - CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType()); - CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); - CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists +void FieldTest::testStringField() { + StringField *f = (StringField *)testField(XAO::STRING); + + StringStep *step = f->getStep(0); + CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType()); + CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL); + CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception); + + step = f->addStep(10); + CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType()); + CPPUNIT_ASSERT_EQUAL(3, f->countSteps()); + CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists } -void FieldTest::testStep(XAO::Type type, Step* step) -{ - CPPUNIT_ASSERT_EQUAL(type, step->getType()); +void FieldTest::testStep(XAO::Type type, Step *step) { + CPPUNIT_ASSERT_EQUAL(type, step->getType()); - CPPUNIT_ASSERT_EQUAL(0, step->getStep()); - step->setStep(10); - CPPUNIT_ASSERT_EQUAL(10, step->getStep()); + CPPUNIT_ASSERT_EQUAL(0, step->getStep()); + step->setStep(10); + CPPUNIT_ASSERT_EQUAL(10, step->getStep()); - CPPUNIT_ASSERT_EQUAL(0, step->getStamp()); - step->setStamp(100); - CPPUNIT_ASSERT_EQUAL(100, step->getStamp()); + CPPUNIT_ASSERT_EQUAL(0, step->getStamp()); + step->setStamp(100); + CPPUNIT_ASSERT_EQUAL(100, step->getStamp()); - CPPUNIT_ASSERT_EQUAL(5, step->countElements()); - CPPUNIT_ASSERT_EQUAL(3, step->countComponents()); - CPPUNIT_ASSERT_EQUAL(15, step->countValues()); + CPPUNIT_ASSERT_EQUAL(5, step->countElements()); + CPPUNIT_ASSERT_EQUAL(3, step->countComponents()); + CPPUNIT_ASSERT_EQUAL(15, step->countValues()); } -void FieldTest::testBooleanStep() -{ - Step* step = new BooleanStep(0, 0, 5, 3); - testStep(XAO::BOOLEAN, step); +void FieldTest::testBooleanStep() { + Step *step = new BooleanStep(0, 0, 5, 3); + testStep(XAO::BOOLEAN, step); } -void FieldTest::testIntegerStep() -{ - Step* step = new IntegerStep(0, 0, 5, 3); - testStep(XAO::INTEGER, step); +void FieldTest::testIntegerStep() { + Step *step = new IntegerStep(0, 0, 5, 3); + testStep(XAO::INTEGER, step); } -void FieldTest::testDoubleStep() -{ - Step* step = new DoubleStep(0, 0, 5, 3); - testStep(XAO::DOUBLE, step); +void FieldTest::testDoubleStep() { + Step *step = new DoubleStep(0, 0, 5, 3); + testStep(XAO::DOUBLE, step); } -void FieldTest::testStringStep() -{ - Step* step = new StringStep(0, 0, 5, 3); - testStep(XAO::STRING, step); +void FieldTest::testStringStep() { + Step *step = new StringStep(0, 0, 5, 3); + testStep(XAO::STRING, step); } -void FieldTest::testBooleanStepValues() -{ - int nbComponents = 3; // > 1 - int nbElements = 5; // > 1 - - BooleanStep* step = new BooleanStep(0, 0, nbElements, nbComponents); - for (int i = 0; i < step->countElements(); ++i) - { - for (int j = 0; j < step->countComponents(); ++j) - { - step->setValue(i, j, j % 2 == 0); - } - } +void FieldTest::testBooleanStepValues() { + int nbComponents = 3; // > 1 + int nbElements = 5; // > 1 - CPPUNIT_ASSERT_EQUAL(true, step->getValue(1, 2)); - CPPUNIT_ASSERT_EQUAL(std::string("true"), step->getStringValue(1, 2)); - CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); - CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); - - // get all values - std::vector values; - values = step->getValues(); - CPPUNIT_ASSERT_EQUAL(nbElements*nbComponents, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - { - for (int j = 0; j < nbComponents; ++j) - CPPUNIT_ASSERT((j % 2 == 0) == values[i*nbComponents+j]); + BooleanStep *step = new BooleanStep(0, 0, nbElements, nbComponents); + for (int i = 0; i < step->countElements(); ++i) { + for (int j = 0; j < step->countComponents(); ++j) { + step->setValue(i, j, j % 2 == 0); } - - // get one element - values = step->getElement(2); - CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); - for (int i = 0; i < nbComponents; ++i) - CPPUNIT_ASSERT((i % 2 == 0) == values[i]); - - // get one component - values = step->getComponent(1); - CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - CPPUNIT_ASSERT(false == values[i]); - - // set one element - std::vector newEltValues; - // only one value + } + + CPPUNIT_ASSERT_EQUAL(true, step->getValue(1, 2)); + CPPUNIT_ASSERT_EQUAL(std::string("true"), step->getStringValue(1, 2)); + CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); + CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); + + // get all values + std::vector values; + values = step->getValues(); + CPPUNIT_ASSERT_EQUAL(nbElements * nbComponents, (int)values.size()); + for (int i = 0; i < nbElements; ++i) { + for (int j = 0; j < nbComponents; ++j) + CPPUNIT_ASSERT((j % 2 == 0) == values[i * nbComponents + j]); + } + + // get one element + values = step->getElement(2); + CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); + for (int i = 0; i < nbComponents; ++i) + CPPUNIT_ASSERT((i % 2 == 0) == values[i]); + + // get one component + values = step->getComponent(1); + CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); + for (int i = 0; i < nbElements; ++i) + CPPUNIT_ASSERT(false == values[i]); + + // set one element + std::vector newEltValues; + // only one value + newEltValues.push_back(true); + CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); + // all values + for (int i = 1; i < nbComponents; ++i) newEltValues.push_back(true); - CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); - // all values - for (int i = 1; i < nbComponents; ++i) - newEltValues.push_back(true); - step->setElement(2, newEltValues); - - // set one component - std::vector newCompValues; - // only one value + step->setElement(2, newEltValues); + + // set one component + std::vector newCompValues; + // only one value + newCompValues.push_back(true); + CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); + // all values + for (int i = 1; i < nbElements; ++i) newCompValues.push_back(true); - CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); - // all values - for (int i = 1; i < nbElements; ++i) - newCompValues.push_back(true); - step->setComponent(1, newCompValues); - - // set string value - step->setStringValue(0, 0, "true"); - CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception); - - // set all values - std::vector allValues; - // only one value + step->setComponent(1, newCompValues); + + // set string value + step->setStringValue(0, 0, "true"); + CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception); + + // set all values + std::vector allValues; + // only one value + allValues.push_back(true); + CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); + // all values + for (int i = 1; i < nbElements * nbComponents; ++i) allValues.push_back(true); - CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); - // all values - for (int i = 1; i < nbElements*nbComponents; ++i) - allValues.push_back(true); - step->setValues(allValues); + step->setValues(allValues); } -void FieldTest::testIntegerStepValues() -{ - int nbComponents = 3; - int nbElements = 5; - - IntegerStep* step = new IntegerStep(0, 0, nbElements, nbComponents); - for (int i = 0; i < step->countElements(); ++i) - { - for (int j = 0; j < step->countComponents(); ++j) - step->setValue(i, j, i*10 + j); - } - - CPPUNIT_ASSERT_EQUAL(12, step->getValue(1, 2)); - CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); - CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); - - // get all values - std::vector values; - values = step->getValues(); - CPPUNIT_ASSERT_EQUAL(nbElements*nbComponents, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - { - for (int j = 0; j < nbComponents; ++j) - CPPUNIT_ASSERT_EQUAL(10*i+j, values[i*nbComponents+j]); - } - - // get one element - values = step->getElement(2); - CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); - for (int i = 0; i < nbComponents; ++i) - CPPUNIT_ASSERT_EQUAL(20+i, values[i]); - - // get one component - values = step->getComponent(1); - CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - CPPUNIT_ASSERT_EQUAL(10*i+1, values[i]); - - // set one element - std::vector newEltValues; +void FieldTest::testIntegerStepValues() { + int nbComponents = 3; + int nbElements = 5; + + IntegerStep *step = new IntegerStep(0, 0, nbElements, nbComponents); + for (int i = 0; i < step->countElements(); ++i) { + for (int j = 0; j < step->countComponents(); ++j) + step->setValue(i, j, i * 10 + j); + } + + CPPUNIT_ASSERT_EQUAL(12, step->getValue(1, 2)); + CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); + CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); + + // get all values + std::vector values; + values = step->getValues(); + CPPUNIT_ASSERT_EQUAL(nbElements * nbComponents, (int)values.size()); + for (int i = 0; i < nbElements; ++i) { + for (int j = 0; j < nbComponents; ++j) + CPPUNIT_ASSERT_EQUAL(10 * i + j, values[i * nbComponents + j]); + } + + // get one element + values = step->getElement(2); + CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); + for (int i = 0; i < nbComponents; ++i) + CPPUNIT_ASSERT_EQUAL(20 + i, values[i]); + + // get one component + values = step->getComponent(1); + CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); + for (int i = 0; i < nbElements; ++i) + CPPUNIT_ASSERT_EQUAL(10 * i + 1, values[i]); + + // set one element + std::vector newEltValues; + newEltValues.push_back(1); + CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); + for (int i = 1; i < nbComponents; ++i) newEltValues.push_back(1); - CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); - for (int i = 1; i < nbComponents; ++i) - newEltValues.push_back(1); - step->setElement(2, newEltValues); + step->setElement(2, newEltValues); - // set one component - std::vector newCompValues; + // set one component + std::vector newCompValues; + newCompValues.push_back(100); + CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); + for (int i = 1; i < nbElements; ++i) newCompValues.push_back(100); - CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); - for (int i = 1; i < nbElements; ++i) - newCompValues.push_back(100); - step->setComponent(1, newCompValues); - - // set string value - step->setStringValue(0, 0, "0"); - CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception); - - // set all values - std::vector allValues; - // only one value + step->setComponent(1, newCompValues); + + // set string value + step->setStringValue(0, 0, "0"); + CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception); + + // set all values + std::vector allValues; + // only one value + allValues.push_back(11); + CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); + // all values + for (int i = 1; i < nbElements * nbComponents; ++i) allValues.push_back(11); - CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); - // all values - for (int i = 1; i < nbElements*nbComponents; ++i) - allValues.push_back(11); - step->setValues(allValues); + step->setValues(allValues); } -void FieldTest::testDoubleStepValues() -{ - int nbComponents = 3; - int nbElements = 5; - - DoubleStep* step = new DoubleStep(0, 0, nbElements, nbComponents); - for (int i = 0; i < step->countElements(); ++i) - { - for (int j = 0; j < step->countComponents(); ++j) - step->setValue(i, j, i*10 + j*0.1); - } - - CPPUNIT_ASSERT_EQUAL(10.2, step->getValue(1, 2)); - CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); - CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); - - // get all values - std::vector values; - values = step->getValues(); - CPPUNIT_ASSERT_EQUAL(nbElements*nbComponents, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - { - for (int j = 0; j < nbComponents; ++j) - CPPUNIT_ASSERT_EQUAL(10*i+j*0.1, values[i*nbComponents+j]); - } - - // get one element - values = step->getElement(2); - CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); - for (int i = 0; i < nbComponents; ++i) - CPPUNIT_ASSERT_EQUAL(20+i*0.1, values[i]); - - // get one component - values = step->getComponent(1); - CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - CPPUNIT_ASSERT_EQUAL(10*i+0.1, values[i]); - - // set one element - std::vector newEltValues; +void FieldTest::testDoubleStepValues() { + int nbComponents = 3; + int nbElements = 5; + + DoubleStep *step = new DoubleStep(0, 0, nbElements, nbComponents); + for (int i = 0; i < step->countElements(); ++i) { + for (int j = 0; j < step->countComponents(); ++j) + step->setValue(i, j, i * 10 + j * 0.1); + } + + CPPUNIT_ASSERT_EQUAL(10.2, step->getValue(1, 2)); + CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); + CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); + + // get all values + std::vector values; + values = step->getValues(); + CPPUNIT_ASSERT_EQUAL(nbElements * nbComponents, (int)values.size()); + for (int i = 0; i < nbElements; ++i) { + for (int j = 0; j < nbComponents; ++j) + CPPUNIT_ASSERT_EQUAL(10 * i + j * 0.1, values[i * nbComponents + j]); + } + + // get one element + values = step->getElement(2); + CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); + for (int i = 0; i < nbComponents; ++i) + CPPUNIT_ASSERT_EQUAL(20 + i * 0.1, values[i]); + + // get one component + values = step->getComponent(1); + CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); + for (int i = 0; i < nbElements; ++i) + CPPUNIT_ASSERT_EQUAL(10 * i + 0.1, values[i]); + + // set one element + std::vector newEltValues; + newEltValues.push_back(1.); + CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); + for (int i = 1; i < nbComponents; ++i) newEltValues.push_back(1.); - CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); - for (int i = 1; i < nbComponents; ++i) - newEltValues.push_back(1.); - step->setElement(2, newEltValues); + step->setElement(2, newEltValues); - // set one component - std::vector newCompValues; + // set one component + std::vector newCompValues; + newCompValues.push_back(100.0); + CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); + for (int i = 1; i < nbElements; ++i) newCompValues.push_back(100.0); - CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); - for (int i = 1; i < nbElements; ++i) - newCompValues.push_back(100.0); - step->setComponent(1, newCompValues); - - // set string value - step->setStringValue(0, 0, "0.2"); - CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception); - - std::vector allValues; - // only one value + step->setComponent(1, newCompValues); + + // set string value + step->setStringValue(0, 0, "0.2"); + CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception); + + std::vector allValues; + // only one value + allValues.push_back(1.1); + CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); + // all values + for (int i = 1; i < nbElements * nbComponents; ++i) allValues.push_back(1.1); - CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); - // all values - for (int i = 1; i < nbElements*nbComponents; ++i) - allValues.push_back(1.1); - step->setValues(allValues);} - -void FieldTest::testStringStepValues() -{ - int nbComponents = 3; - int nbElements = 5; - - StringStep* step = new StringStep(0, 0, nbElements, nbComponents); - for (int i = 0; i < step->countElements(); ++i) - { - for (int j = 0; j < step->countComponents(); ++j) - step->setValue(i, j, XaoUtils::intToString(i*10 + j)); - } - - CPPUNIT_ASSERT_EQUAL(std::string("12"), step->getValue(1, 2)); - CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); - CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); - - // get all values - std::vector values; - values = step->getValues(); - CPPUNIT_ASSERT_EQUAL(nbElements*nbComponents, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - { - for (int j = 0; j < nbComponents; ++j) - CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(10*i+j), values[i*nbComponents+j]); - } + step->setValues(allValues); +} - // get one element - values = step->getElement(2); - CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); - for (int i = 0; i < nbComponents; ++i) - CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(20+i), values[i]); - - // get one component - values = step->getComponent(1); - CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); - for (int i = 0; i < nbElements; ++i) - CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(10*i+1), values[i]); - - // set one element - std::vector newEltValues; +void FieldTest::testStringStepValues() { + int nbComponents = 3; + int nbElements = 5; + + StringStep *step = new StringStep(0, 0, nbElements, nbComponents); + for (int i = 0; i < step->countElements(); ++i) { + for (int j = 0; j < step->countComponents(); ++j) + step->setValue(i, j, XaoUtils::intToString(i * 10 + j)); + } + + CPPUNIT_ASSERT_EQUAL(std::string("12"), step->getValue(1, 2)); + CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception); + CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception); + + // get all values + std::vector values; + values = step->getValues(); + CPPUNIT_ASSERT_EQUAL(nbElements * nbComponents, (int)values.size()); + for (int i = 0; i < nbElements; ++i) { + for (int j = 0; j < nbComponents; ++j) + CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(10 * i + j), + values[i * nbComponents + j]); + } + + // get one element + values = step->getElement(2); + CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size()); + for (int i = 0; i < nbComponents; ++i) + CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(20 + i), values[i]); + + // get one component + values = step->getComponent(1); + CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size()); + for (int i = 0; i < nbElements; ++i) + CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(10 * i + 1), values[i]); + + // set one element + std::vector newEltValues; + newEltValues.push_back("1"); + CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); + for (int i = 1; i < nbComponents; ++i) newEltValues.push_back("1"); - CPPUNIT_ASSERT_THROW(step->setElement(2, newEltValues), XAO_Exception); - for (int i = 1; i < nbComponents; ++i) - newEltValues.push_back("1"); - step->setElement(2, newEltValues); + step->setElement(2, newEltValues); - // set one component - std::vector newCompValues; + // set one component + std::vector newCompValues; + newCompValues.push_back("100"); + CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); + for (int i = 1; i < nbElements; ++i) newCompValues.push_back("100"); - CPPUNIT_ASSERT_THROW(step->setComponent(1, newCompValues), XAO_Exception); - for (int i = 1; i < nbElements; ++i) - newCompValues.push_back("100"); - step->setComponent(1, newCompValues); + step->setComponent(1, newCompValues); - // set string value - step->setStringValue(0, 0, "0"); + // set string value + step->setStringValue(0, 0, "0"); - std::vector allValues; - // only one value + std::vector allValues; + // only one value + allValues.push_back("abc"); + CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); + // all values + for (int i = 1; i < nbElements * nbComponents; ++i) allValues.push_back("abc"); - CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception); - // all values - for (int i = 1; i < nbElements*nbComponents; ++i) - allValues.push_back("abc"); - step->setValues(allValues); + step->setValues(allValues); } -void FieldTest::testSetComponents() -{ - // field with 3 components - Field* f = Field::createField(XAO::INTEGER, XAO::FACE, 6, 3); - CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(1)); - CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(2)); - - std::vector names; - names.push_back("vx"); - f->setComponentsNames(names); - CPPUNIT_ASSERT_EQUAL(std::string("vx"), f->getComponentName(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(1)); - CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(2)); - - names.push_back("vy"); - f->setComponentsNames(names); - CPPUNIT_ASSERT_EQUAL(std::string("vx"), f->getComponentName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("vy"), f->getComponentName(1)); - CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(2)); - - names.push_back("vz"); - names.push_back("t"); - f->setComponentsNames(names); - CPPUNIT_ASSERT_EQUAL(std::string("vx"), f->getComponentName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("vy"), f->getComponentName(1)); - CPPUNIT_ASSERT_EQUAL(std::string("vz"), f->getComponentName(2)); +void FieldTest::testSetComponents() { + // field with 3 components + Field *f = Field::createField(XAO::INTEGER, XAO::FACE, 6, 3); + CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(1)); + CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(2)); + + std::vector names; + names.push_back("vx"); + f->setComponentsNames(names); + CPPUNIT_ASSERT_EQUAL(std::string("vx"), f->getComponentName(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(1)); + CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(2)); + + names.push_back("vy"); + f->setComponentsNames(names); + CPPUNIT_ASSERT_EQUAL(std::string("vx"), f->getComponentName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("vy"), f->getComponentName(1)); + CPPUNIT_ASSERT_EQUAL(std::string(""), f->getComponentName(2)); + + names.push_back("vz"); + names.push_back("t"); + f->setComponentsNames(names); + CPPUNIT_ASSERT_EQUAL(std::string("vx"), f->getComponentName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("vy"), f->getComponentName(1)); + CPPUNIT_ASSERT_EQUAL(std::string("vz"), f->getComponentName(2)); } diff --git a/src/XAO/tests/FieldTest.hxx b/src/XAO/tests/FieldTest.hxx index 0d491e66c..73af96cfd 100644 --- a/src/XAO/tests/FieldTest.hxx +++ b/src/XAO/tests/FieldTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_FIELD_TEST_HXX__ @@ -22,53 +23,51 @@ #include -#include "../XAO_Xao.hxx" #include "../XAO_Field.hxx" #include "../XAO_Step.hxx" +#include "../XAO_Xao.hxx" -namespace XAO -{ - class FieldTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(FieldTest); - CPPUNIT_TEST(testBooleanField); - CPPUNIT_TEST(testDoubleField); - CPPUNIT_TEST(testIntegerField); - CPPUNIT_TEST(testStringField); - CPPUNIT_TEST(testBooleanStep); - CPPUNIT_TEST(testIntegerStep); - CPPUNIT_TEST(testDoubleStep); - CPPUNIT_TEST(testStringStep); - CPPUNIT_TEST(testBooleanStepValues); - CPPUNIT_TEST(testIntegerStepValues); - CPPUNIT_TEST(testDoubleStepValues); - CPPUNIT_TEST(testStringStepValues); - CPPUNIT_TEST(testSetComponents); - CPPUNIT_TEST_SUITE_END(); +namespace XAO { +class FieldTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(FieldTest); + CPPUNIT_TEST(testBooleanField); + CPPUNIT_TEST(testDoubleField); + CPPUNIT_TEST(testIntegerField); + CPPUNIT_TEST(testStringField); + CPPUNIT_TEST(testBooleanStep); + CPPUNIT_TEST(testIntegerStep); + CPPUNIT_TEST(testDoubleStep); + CPPUNIT_TEST(testStringStep); + CPPUNIT_TEST(testBooleanStepValues); + CPPUNIT_TEST(testIntegerStepValues); + CPPUNIT_TEST(testDoubleStepValues); + CPPUNIT_TEST(testStringStepValues); + CPPUNIT_TEST(testSetComponents); + CPPUNIT_TEST_SUITE_END(); - public: - void setUp(); - void tearDown(); - void cleanUp(); +public: + void setUp(); + void tearDown(); + void cleanUp(); - Field* testField(XAO::Type type); - void testBooleanField(); - void testIntegerField(); - void testDoubleField(); - void testStringField(); + Field *testField(XAO::Type type); + void testBooleanField(); + void testIntegerField(); + void testDoubleField(); + void testStringField(); - void testStep(XAO::Type type, Step* step); - void testBooleanStep(); - void testIntegerStep(); - void testDoubleStep(); - void testStringStep(); + void testStep(XAO::Type type, Step *step); + void testBooleanStep(); + void testIntegerStep(); + void testDoubleStep(); + void testStringStep(); - void testBooleanStepValues(); - void testIntegerStepValues(); - void testDoubleStepValues(); - void testStringStepValues(); - void testSetComponents(); - }; -} + void testBooleanStepValues(); + void testIntegerStepValues(); + void testDoubleStepValues(); + void testStringStepValues(); + void testSetComponents(); +}; +} // namespace XAO #endif // __XAO_FIELD_TEST_HXX__ diff --git a/src/XAO/tests/GeometryTest.cxx b/src/XAO/tests/GeometryTest.cxx index 727572ab4..b56252c1b 100644 --- a/src/XAO/tests/GeometryTest.cxx +++ b/src/XAO/tests/GeometryTest.cxx @@ -14,148 +14,138 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include "TestUtils.hxx" -#include "GeometryTest.hxx" -#include "../XAO_XaoUtils.hxx" -#include "../XAO_Geometry.hxx" #include "../XAO_GeometricElement.hxx" +#include "../XAO_Geometry.hxx" +#include "../XAO_XaoUtils.hxx" +#include "GeometryTest.hxx" +#include "TestUtils.hxx" using namespace XAO; -void GeometryTest::setUp() -{ -} +void GeometryTest::setUp() {} -void GeometryTest::tearDown() -{ -} +void GeometryTest::tearDown() {} -void GeometryTest::cleanUp() -{ -} +void GeometryTest::cleanUp() {} -void GeometryTest::testGeometryElement() -{ - GeometricElement elt; - CPPUNIT_ASSERT_EQUAL(false, elt.hasName()); - CPPUNIT_ASSERT_EQUAL(std::string(""), elt.getName()); - CPPUNIT_ASSERT_EQUAL(std::string(""), elt.getReference()); +void GeometryTest::testGeometryElement() { + GeometricElement elt; + CPPUNIT_ASSERT_EQUAL(false, elt.hasName()); + CPPUNIT_ASSERT_EQUAL(std::string(""), elt.getName()); + CPPUNIT_ASSERT_EQUAL(std::string(""), elt.getReference()); - elt.setName("test"); - CPPUNIT_ASSERT_EQUAL(true, elt.hasName()); - CPPUNIT_ASSERT_EQUAL(std::string("test"), elt.getName()); + elt.setName("test"); + CPPUNIT_ASSERT_EQUAL(true, elt.hasName()); + CPPUNIT_ASSERT_EQUAL(std::string("test"), elt.getName()); - elt.setReference("abc"); - CPPUNIT_ASSERT_EQUAL(std::string("abc"), elt.getReference()); + elt.setReference("abc"); + CPPUNIT_ASSERT_EQUAL(std::string("abc"), elt.getReference()); - GeometricElement elt2("aa", "bb"); - CPPUNIT_ASSERT_EQUAL(std::string("aa"), elt2.getName()); - CPPUNIT_ASSERT_EQUAL(std::string("bb"), elt2.getReference()); + GeometricElement elt2("aa", "bb"); + CPPUNIT_ASSERT_EQUAL(std::string("aa"), elt2.getName()); + CPPUNIT_ASSERT_EQUAL(std::string("bb"), elt2.getReference()); } -void GeometryTest::testGeometryElementList() -{ - GeometricElementList lst; - CPPUNIT_ASSERT_EQUAL(0, lst.getSize()); - lst.setSize(10); - CPPUNIT_ASSERT_EQUAL(10, lst.getSize()); - - GeometricElementList otherLst(15); - CPPUNIT_ASSERT_EQUAL(15, otherLst.getSize()); - CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getReference(0)); - - CPPUNIT_ASSERT_THROW(otherLst.getName(20), XAO_Exception); - CPPUNIT_ASSERT_THROW(otherLst.getReference(20), XAO_Exception); - CPPUNIT_ASSERT_THROW(otherLst.hasName(20), XAO_Exception); - - otherLst.setName(0, "aa"); - CPPUNIT_ASSERT_EQUAL(std::string("aa"), otherLst.getName(0)); - CPPUNIT_ASSERT_THROW(otherLst.setName(20, "aa"), XAO_Exception); - otherLst.setReference(0, "bb"); - CPPUNIT_ASSERT_EQUAL(std::string("bb"), otherLst.getReference(0)); - CPPUNIT_ASSERT_THROW(otherLst.setReference(20, "aa"), XAO_Exception); - - otherLst.setSize(10); - CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getReference(0)); - CPPUNIT_ASSERT_EQUAL(false, otherLst.hasName(0)); - - otherLst.setElement(3, "name", "ref"); - CPPUNIT_ASSERT_EQUAL(std::string("name"), otherLst.getName(3)); - CPPUNIT_ASSERT_EQUAL(std::string("ref"), otherLst.getReference(3)); - CPPUNIT_ASSERT_EQUAL(true, otherLst.hasName(3)); - CPPUNIT_ASSERT_THROW(otherLst.setElement(30, "name", "ref"), XAO_Exception); - - // ---- create elements "name i", "Ri" - for (int i = 0; i < otherLst.getSize(); ++i) - { - std::ostringstream name; - name << "name " << i; - std::ostringstream ref; - ref << "R" << i; - - otherLst.setElement(i, name.str(), ref.str()); - } - - CPPUNIT_ASSERT_EQUAL(8, otherLst.getIndexByReference("R8")); - CPPUNIT_ASSERT_THROW(otherLst.getIndexByReference("ZZ"), XAO_Exception); - - GeometricElementList::iterator first = otherLst.begin(); - GeometricElement firstElt = first->second; - CPPUNIT_ASSERT_EQUAL(std::string("R0"), firstElt.getReference()); +void GeometryTest::testGeometryElementList() { + GeometricElementList lst; + CPPUNIT_ASSERT_EQUAL(0, lst.getSize()); + lst.setSize(10); + CPPUNIT_ASSERT_EQUAL(10, lst.getSize()); + + GeometricElementList otherLst(15); + CPPUNIT_ASSERT_EQUAL(15, otherLst.getSize()); + CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getReference(0)); + + CPPUNIT_ASSERT_THROW(otherLst.getName(20), XAO_Exception); + CPPUNIT_ASSERT_THROW(otherLst.getReference(20), XAO_Exception); + CPPUNIT_ASSERT_THROW(otherLst.hasName(20), XAO_Exception); + + otherLst.setName(0, "aa"); + CPPUNIT_ASSERT_EQUAL(std::string("aa"), otherLst.getName(0)); + CPPUNIT_ASSERT_THROW(otherLst.setName(20, "aa"), XAO_Exception); + otherLst.setReference(0, "bb"); + CPPUNIT_ASSERT_EQUAL(std::string("bb"), otherLst.getReference(0)); + CPPUNIT_ASSERT_THROW(otherLst.setReference(20, "aa"), XAO_Exception); + + otherLst.setSize(10); + CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getReference(0)); + CPPUNIT_ASSERT_EQUAL(false, otherLst.hasName(0)); + + otherLst.setElement(3, "name", "ref"); + CPPUNIT_ASSERT_EQUAL(std::string("name"), otherLst.getName(3)); + CPPUNIT_ASSERT_EQUAL(std::string("ref"), otherLst.getReference(3)); + CPPUNIT_ASSERT_EQUAL(true, otherLst.hasName(3)); + CPPUNIT_ASSERT_THROW(otherLst.setElement(30, "name", "ref"), XAO_Exception); + + // ---- create elements "name i", "Ri" + for (int i = 0; i < otherLst.getSize(); ++i) { + std::ostringstream name; + name << "name " << i; + std::ostringstream ref; + ref << "R" << i; + + otherLst.setElement(i, name.str(), ref.str()); + } + + CPPUNIT_ASSERT_EQUAL(8, otherLst.getIndexByReference("R8")); + CPPUNIT_ASSERT_THROW(otherLst.getIndexByReference("ZZ"), XAO_Exception); + + GeometricElementList::iterator first = otherLst.begin(); + GeometricElement firstElt = first->second; + CPPUNIT_ASSERT_EQUAL(std::string("R0"), firstElt.getReference()); } -void GeometryTest::testGeometry() -{ - Geometry* geom = Geometry::createGeometry(XAO::BREP, "cube"); +void GeometryTest::testGeometry() { + Geometry *geom = Geometry::createGeometry(XAO::BREP, "cube"); - CPPUNIT_ASSERT_EQUAL(std::string("cube"), geom->getName()); - CPPUNIT_ASSERT_EQUAL(XAO::BREP, geom->getFormat()); + CPPUNIT_ASSERT_EQUAL(std::string("cube"), geom->getName()); + CPPUNIT_ASSERT_EQUAL(XAO::BREP, geom->getFormat()); - geom->setName("sphere"); - CPPUNIT_ASSERT_EQUAL(std::string("sphere"), geom->getName()); + geom->setName("sphere"); + CPPUNIT_ASSERT_EQUAL(std::string("sphere"), geom->getName()); - delete geom; + delete geom; } -void GeometryTest::testGeometryErrors() -{ - CPPUNIT_ASSERT_THROW(Geometry::createGeometry(XAO::STEP), XAO_Exception); +void GeometryTest::testGeometryErrors() { + CPPUNIT_ASSERT_THROW(Geometry::createGeometry(XAO::STEP), XAO_Exception); } -void GeometryTest::testSetElement() -{ - Geometry* geom = Geometry::createGeometry(XAO::BREP, "cube"); +void GeometryTest::testSetElement() { + Geometry *geom = Geometry::createGeometry(XAO::BREP, "cube"); - CPPUNIT_ASSERT_THROW(geom->setVertexName(0, "aa"), XAO_Exception); + CPPUNIT_ASSERT_THROW(geom->setVertexName(0, "aa"), XAO_Exception); - char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Shapes/Brep/box1.brep")); - geom->setShapeString(txt); + char *txt = TestUtils::readTextFile( + TestUtils::getTestFilePath("Shapes/Brep/box1.brep")); + geom->setShapeString(txt); - CPPUNIT_ASSERT_EQUAL(false, geom->hasVertexName(0)); - geom->setVertexName(0, "va"); - CPPUNIT_ASSERT_EQUAL(true, geom->hasVertexName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->getVertexName(0)); - CPPUNIT_ASSERT_THROW(geom->getVertexName(100), XAO_Exception); - CPPUNIT_ASSERT_THROW(geom->hasVertexName(100), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(false, geom->hasVertexName(0)); + geom->setVertexName(0, "va"); + CPPUNIT_ASSERT_EQUAL(true, geom->hasVertexName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->getVertexName(0)); + CPPUNIT_ASSERT_THROW(geom->getVertexName(100), XAO_Exception); + CPPUNIT_ASSERT_THROW(geom->hasVertexName(100), XAO_Exception); - geom->setEdgeName(0, "ea"); - CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->getEdgeName(0)); - CPPUNIT_ASSERT_THROW(geom->getEdgeName(100), XAO_Exception); + geom->setEdgeName(0, "ea"); + CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->getEdgeName(0)); + CPPUNIT_ASSERT_THROW(geom->getEdgeName(100), XAO_Exception); - geom->setFaceName(0, "fa"); - CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->getFaceName(0)); - CPPUNIT_ASSERT_THROW(geom->getFaceName(100), XAO_Exception); + geom->setFaceName(0, "fa"); + CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->getFaceName(0)); + CPPUNIT_ASSERT_THROW(geom->getFaceName(100), XAO_Exception); - geom->setSolidName(0, "sa"); - CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->getSolidName(0)); - CPPUNIT_ASSERT_THROW(geom->getSolidName(100), XAO_Exception); + geom->setSolidName(0, "sa"); + CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->getSolidName(0)); + CPPUNIT_ASSERT_THROW(geom->getSolidName(100), XAO_Exception); - delete geom; + delete geom; } diff --git a/src/XAO/tests/GeometryTest.hxx b/src/XAO/tests/GeometryTest.hxx index ba8f74424..909080510 100644 --- a/src/XAO/tests/GeometryTest.hxx +++ b/src/XAO/tests/GeometryTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_GEOMETRY_TEST_HXX__ @@ -22,28 +23,26 @@ #include -namespace XAO -{ - class GeometryTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(GeometryTest); - CPPUNIT_TEST(testGeometryElement); - CPPUNIT_TEST(testGeometryElementList); - CPPUNIT_TEST(testGeometry); - CPPUNIT_TEST(testGeometryErrors); - CPPUNIT_TEST_SUITE_END(); +namespace XAO { +class GeometryTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(GeometryTest); + CPPUNIT_TEST(testGeometryElement); + CPPUNIT_TEST(testGeometryElementList); + CPPUNIT_TEST(testGeometry); + CPPUNIT_TEST(testGeometryErrors); + CPPUNIT_TEST_SUITE_END(); - public: - void setUp(); - void tearDown(); - void cleanUp(); +public: + void setUp(); + void tearDown(); + void cleanUp(); - void testGeometryElement(); - void testGeometryElementList(); - void testGeometry(); - void testGeometryErrors(); - void testSetElement(); - }; -} + void testGeometryElement(); + void testGeometryElementList(); + void testGeometry(); + void testGeometryErrors(); + void testSetElement(); +}; +} // namespace XAO #endif // __XAO_GEOMETRY_TEST_HXX__ diff --git a/src/XAO/tests/GroupTest.cxx b/src/XAO/tests/GroupTest.cxx index 8954bfbcb..87de9006d 100644 --- a/src/XAO/tests/GroupTest.cxx +++ b/src/XAO/tests/GroupTest.cxx @@ -14,64 +14,57 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include "TestUtils.hxx" -#include "GroupTest.hxx" -#include "../XAO_XaoUtils.hxx" -#include "../XAO_Xao.hxx" #include "../XAO_Group.hxx" +#include "../XAO_Xao.hxx" +#include "../XAO_XaoUtils.hxx" +#include "GroupTest.hxx" +#include "TestUtils.hxx" using namespace XAO; -void GroupTest::setUp() -{ -} +void GroupTest::setUp() {} -void GroupTest::tearDown() -{ -} +void GroupTest::tearDown() {} -void GroupTest::cleanUp() -{ -} +void GroupTest::cleanUp() {} -void GroupTest::testGroup() -{ - Group* group = new Group(XAO::FACE, 20); +void GroupTest::testGroup() { + Group *group = new Group(XAO::FACE, 20); - CPPUNIT_ASSERT_EQUAL(XAO::FACE, group->getDimension()); - CPPUNIT_ASSERT_EQUAL(20, group->getNbElements()); + CPPUNIT_ASSERT_EQUAL(XAO::FACE, group->getDimension()); + CPPUNIT_ASSERT_EQUAL(20, group->getNbElements()); - CPPUNIT_ASSERT_EQUAL(std::string(""), group->getName()); - group->setName("the Group"); - CPPUNIT_ASSERT_EQUAL(std::string("the Group"), group->getName()); + CPPUNIT_ASSERT_EQUAL(std::string(""), group->getName()); + group->setName("the Group"); + CPPUNIT_ASSERT_EQUAL(std::string("the Group"), group->getName()); - CPPUNIT_ASSERT_EQUAL(0, group->count()); - group->add(10); - CPPUNIT_ASSERT_EQUAL(1, group->count()); - group->add(12); - CPPUNIT_ASSERT_EQUAL(2, group->count()); - group->add(12); - CPPUNIT_ASSERT_EQUAL(2, group->count()); + CPPUNIT_ASSERT_EQUAL(0, group->count()); + group->add(10); + CPPUNIT_ASSERT_EQUAL(1, group->count()); + group->add(12); + CPPUNIT_ASSERT_EQUAL(2, group->count()); + group->add(12); + CPPUNIT_ASSERT_EQUAL(2, group->count()); - CPPUNIT_ASSERT_EQUAL(10, group->get(0)); - CPPUNIT_ASSERT_EQUAL(12, group->get(1)); - CPPUNIT_ASSERT_THROW(group->get(2), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(10, group->get(0)); + CPPUNIT_ASSERT_EQUAL(12, group->get(1)); + CPPUNIT_ASSERT_THROW(group->get(2), XAO_Exception); - group->remove(15); - CPPUNIT_ASSERT_EQUAL(2, group->count()); - group->remove(10); - CPPUNIT_ASSERT_EQUAL(1, group->count()); - CPPUNIT_ASSERT_EQUAL(12, group->get(0)); + group->remove(15); + CPPUNIT_ASSERT_EQUAL(2, group->count()); + group->remove(10); + CPPUNIT_ASSERT_EQUAL(1, group->count()); + CPPUNIT_ASSERT_EQUAL(12, group->get(0)); - delete group; + delete group; } -void GroupTest::testGroupErrors() -{ - CPPUNIT_ASSERT_THROW(new Group(XAO::WHOLE, 20), XAO_Exception); +void GroupTest::testGroupErrors() { + CPPUNIT_ASSERT_THROW(new Group(XAO::WHOLE, 20), XAO_Exception); } diff --git a/src/XAO/tests/GroupTest.hxx b/src/XAO/tests/GroupTest.hxx index 823881057..a98210222 100644 --- a/src/XAO/tests/GroupTest.hxx +++ b/src/XAO/tests/GroupTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_GROUP_TEST_HXX__ @@ -22,23 +23,21 @@ #include -namespace XAO -{ - class GroupTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(GroupTest); - CPPUNIT_TEST(testGroup); - CPPUNIT_TEST(testGroupErrors); - CPPUNIT_TEST_SUITE_END(); +namespace XAO { +class GroupTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(GroupTest); + CPPUNIT_TEST(testGroup); + CPPUNIT_TEST(testGroupErrors); + CPPUNIT_TEST_SUITE_END(); - public: - void setUp(); - void tearDown(); - void cleanUp(); +public: + void setUp(); + void tearDown(); + void cleanUp(); - void testGroup(); - void testGroupErrors(); - }; -} + void testGroup(); + void testGroupErrors(); +}; +} // namespace XAO #endif // __XAO_GROUP_TEST_HXX__ diff --git a/src/XAO/tests/ImportExportTest.cxx b/src/XAO/tests/ImportExportTest.cxx index a2e423ba9..8f5be783b 100644 --- a/src/XAO/tests/ImportExportTest.cxx +++ b/src/XAO/tests/ImportExportTest.cxx @@ -14,215 +14,203 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) -#include "TestUtils.hxx" #include "ImportExportTest.hxx" -#include "../XAO_XaoUtils.hxx" +#include "../XAO_Field.hxx" #include "../XAO_Geometry.hxx" #include "../XAO_Group.hxx" -#include "../XAO_Field.hxx" #include "../XAO_IntegerField.hxx" #include "../XAO_IntegerStep.hxx" +#include "../XAO_XaoUtils.hxx" +#include "TestUtils.hxx" using namespace XAO; +void ImportExportTest::setUp() {} -void ImportExportTest::setUp() -{ -} +void ImportExportTest::tearDown() {} -void ImportExportTest::tearDown() -{ -} +void ImportExportTest::cleanUp() {} -void ImportExportTest::cleanUp() -{ -} +void ImportExportTest::testExportNoGeometry() { + Xao xao("me", "1.0"); -void ImportExportTest::testExportNoGeometry() -{ - Xao xao("me", "1.0"); - - bool res = xao.exportXAO("empty.xao"); - CPPUNIT_ASSERT(res); + bool res = xao.exportXAO("empty.xao"); + CPPUNIT_ASSERT(res); } -void ImportExportTest::testExportGeometry() -{ - Xao xao("me", "1.0"); - Geometry* geom = Geometry::createGeometry(XAO::BREP); - geom->setName("mygeom"); - CPPUNIT_ASSERT_EQUAL(false, geom->isReadOnly()); - - // add elements - geom->setCountVertices(4); - geom->setVertex(0, "v1", "1"); - geom->setVertex(1, "", "2"); - geom->setVertex(2, "v3", "3"); - geom->setVertex(3, "", "4"); - - geom->setCountEdges(3); - geom->setEdge(0, "e1", "5"); - geom->setEdge(1, "", "6"); - geom->setEdge(2, "e3", "7"); - - geom->setCountFaces(2); - geom->setFace(0, "f1", "8"); - geom->setFace(1, "", "9"); - - geom->setCountSolids(1); - geom->setSolid(0, "s1", "10"); - - xao.setGeometry(geom); - CPPUNIT_ASSERT_EQUAL(true, geom->isReadOnly()); - - // groups - Group* group = xao.addGroup(XAO::SOLID); - group->setName("boite1"); - group->add(0); - - group = xao.addGroup(XAO::FACE); - group->setName("faces"); - group->add(0); - group->add(1); - - // fields - IntegerField* field = (IntegerField*)xao.addField(XAO::INTEGER, XAO::FACE, 2, "color"); - for (int stepIndex = 0; stepIndex < 10; ++stepIndex) - { - IntegerStep* istep = field->addStep(stepIndex, 100*stepIndex); - for (int eltIndex = 0; eltIndex < istep->countElements(); ++eltIndex) - { - for (int compIndex = 0; compIndex < istep->countComponents(); ++compIndex) - { - istep->setValue(eltIndex, compIndex, istep->getStamp() + eltIndex*10 + compIndex); - } - } +void ImportExportTest::testExportGeometry() { + Xao xao("me", "1.0"); + Geometry *geom = Geometry::createGeometry(XAO::BREP); + geom->setName("mygeom"); + CPPUNIT_ASSERT_EQUAL(false, geom->isReadOnly()); + + // add elements + geom->setCountVertices(4); + geom->setVertex(0, "v1", "1"); + geom->setVertex(1, "", "2"); + geom->setVertex(2, "v3", "3"); + geom->setVertex(3, "", "4"); + + geom->setCountEdges(3); + geom->setEdge(0, "e1", "5"); + geom->setEdge(1, "", "6"); + geom->setEdge(2, "e3", "7"); + + geom->setCountFaces(2); + geom->setFace(0, "f1", "8"); + geom->setFace(1, "", "9"); + + geom->setCountSolids(1); + geom->setSolid(0, "s1", "10"); + + xao.setGeometry(geom); + CPPUNIT_ASSERT_EQUAL(true, geom->isReadOnly()); + + // groups + Group *group = xao.addGroup(XAO::SOLID); + group->setName("boite1"); + group->add(0); + + group = xao.addGroup(XAO::FACE); + group->setName("faces"); + group->add(0); + group->add(1); + + // fields + IntegerField *field = + (IntegerField *)xao.addField(XAO::INTEGER, XAO::FACE, 2, "color"); + for (int stepIndex = 0; stepIndex < 10; ++stepIndex) { + IntegerStep *istep = field->addStep(stepIndex, 100 * stepIndex); + for (int eltIndex = 0; eltIndex < istep->countElements(); ++eltIndex) { + for (int compIndex = 0; compIndex < istep->countComponents(); + ++compIndex) { + istep->setValue(eltIndex, compIndex, + istep->getStamp() + eltIndex * 10 + compIndex); + } } + } - bool res = xao.exportXAO("mygeom.xao"); - CPPUNIT_ASSERT(res); + bool res = xao.exportXAO("mygeom.xao"); + CPPUNIT_ASSERT(res); - std::string xml = xao.getXML(); - //CPPUNIT_ASSERT_EQUAL(strlen(xml) == 1007); + std::string xml = xao.getXML(); + // CPPUNIT_ASSERT_EQUAL(strlen(xml) == 1007); } -void ImportExportTest::testGeometryError() -{ - Geometry* geom = Geometry::createGeometry(XAO::BREP); - geom->setName("mygeom"); - geom->setCountVertices(2); - CPPUNIT_ASSERT_THROW(geom->setVertex(3, "v4", "4"), XAO_Exception); - delete geom; +void ImportExportTest::testGeometryError() { + Geometry *geom = Geometry::createGeometry(XAO::BREP); + geom->setName("mygeom"); + geom->setCountVertices(2); + CPPUNIT_ASSERT_THROW(geom->setVertex(3, "v4", "4"), XAO_Exception); + delete geom; } -void ImportExportTest::testImportXao() -{ - Xao xao; - xao.importXAO(TestUtils::getTestFilePath("Shapes/Xao/box1.xao")); - checkImport(xao); +void ImportExportTest::testImportXao() { + Xao xao; + xao.importXAO(TestUtils::getTestFilePath("Shapes/Xao/box1.xao")); + checkImport(xao); } -void ImportExportTest::testImportXaoFromText() -{ - char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Shapes/Xao/box1.xao")); +void ImportExportTest::testImportXaoFromText() { + char *txt = TestUtils::readTextFile( + TestUtils::getTestFilePath("Shapes/Xao/box1.xao")); - Xao xao; - xao.setXML(txt); - checkImport(xao); + Xao xao; + xao.setXML(txt); + checkImport(xao); } -void ImportExportTest::checkImport(Xao& xao) -{ - CPPUNIT_ASSERT_EQUAL(std::string("me"), xao.getAuthor()); - CPPUNIT_ASSERT_EQUAL(std::string("1.0"), xao.getVersion()); - - Geometry* geom = xao.getGeometry(); - CPPUNIT_ASSERT(geom != NULL); - CPPUNIT_ASSERT_EQUAL(std::string("mygeom"), geom->getName()); - - CPPUNIT_ASSERT_EQUAL(8, geom->countVertices()); - CPPUNIT_ASSERT_EQUAL(std::string("v1"), geom->getVertexName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("6"), geom->getVertexReference(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(1)); - CPPUNIT_ASSERT_EQUAL(std::string("7"), geom->getVertexReference(1)); - CPPUNIT_ASSERT_EQUAL(std::string("v3"), geom->getVertexName(2)); - CPPUNIT_ASSERT_EQUAL(std::string("9"), geom->getVertexReference(2)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(3)); - CPPUNIT_ASSERT_EQUAL(std::string("11"), geom->getVertexReference(3)); - CPPUNIT_ASSERT_EQUAL(std::string("v5"), geom->getVertexName(4)); - CPPUNIT_ASSERT_EQUAL(std::string("16"), geom->getVertexReference(4)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(5)); - CPPUNIT_ASSERT_EQUAL(std::string("17"), geom->getVertexReference(5)); - CPPUNIT_ASSERT_EQUAL(std::string("v7"), geom->getVertexName(6)); - CPPUNIT_ASSERT_EQUAL(std::string("19"), geom->getVertexReference(6)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(7)); - CPPUNIT_ASSERT_EQUAL(std::string("21"), geom->getVertexReference(7)); - - CPPUNIT_ASSERT_EQUAL(12, geom->countEdges()); - CPPUNIT_ASSERT_EQUAL(std::string("e1"), geom->getEdgeName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("5"), geom->getEdgeReference(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(1)); - CPPUNIT_ASSERT_EQUAL(std::string("8"), geom->getEdgeReference(1)); - CPPUNIT_ASSERT_EQUAL(std::string("e3"), geom->getEdgeName(2)); - CPPUNIT_ASSERT_EQUAL(std::string("10"), geom->getEdgeReference(2)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(3)); - CPPUNIT_ASSERT_EQUAL(std::string("12"), geom->getEdgeReference(3)); - CPPUNIT_ASSERT_EQUAL(std::string("e5"), geom->getEdgeName(4)); - CPPUNIT_ASSERT_EQUAL(std::string("15"), geom->getEdgeReference(4)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(5)); - CPPUNIT_ASSERT_EQUAL(std::string("18"), geom->getEdgeReference(5)); - CPPUNIT_ASSERT_EQUAL(std::string("e7"), geom->getEdgeName(6)); - CPPUNIT_ASSERT_EQUAL(std::string("20"), geom->getEdgeReference(6)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(7)); - CPPUNIT_ASSERT_EQUAL(std::string("22"), geom->getEdgeReference(7)); - CPPUNIT_ASSERT_EQUAL(std::string("e9"), geom->getEdgeName(8)); - CPPUNIT_ASSERT_EQUAL(std::string("25"), geom->getEdgeReference(8)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(9)); - CPPUNIT_ASSERT_EQUAL(std::string("26"), geom->getEdgeReference(9)); - CPPUNIT_ASSERT_EQUAL(std::string("e11"), geom->getEdgeName(10)); - CPPUNIT_ASSERT_EQUAL(std::string("29"), geom->getEdgeReference(10)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(11)); - CPPUNIT_ASSERT_EQUAL(std::string("30"), geom->getEdgeReference(11)); - - CPPUNIT_ASSERT_EQUAL(6, geom->countFaces()); - CPPUNIT_ASSERT_EQUAL(std::string("f1"), geom->getFaceName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("3"), geom->getFaceReference(0)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getFaceName(1)); - CPPUNIT_ASSERT_EQUAL(std::string("13"), geom->getFaceReference(1)); - CPPUNIT_ASSERT_EQUAL(std::string("f3"), geom->getFaceName(2)); - CPPUNIT_ASSERT_EQUAL(std::string("23"), geom->getFaceReference(2)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getFaceName(3)); - CPPUNIT_ASSERT_EQUAL(std::string("27"), geom->getFaceReference(3)); - CPPUNIT_ASSERT_EQUAL(std::string("f5"), geom->getFaceName(4)); - CPPUNIT_ASSERT_EQUAL(std::string("31"), geom->getFaceReference(4)); - CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getFaceName(5)); - CPPUNIT_ASSERT_EQUAL(std::string("33"), geom->getFaceReference(5)); - - CPPUNIT_ASSERT_EQUAL(1, geom->countSolids()); - CPPUNIT_ASSERT_EQUAL(std::string("s1"), geom->getSolidName(0)); - CPPUNIT_ASSERT_EQUAL(std::string("1"), geom->getSolidReference(0)); - - CPPUNIT_ASSERT_EQUAL(2, xao.countGroups()); - Group* group = xao.getGroup(0); - CPPUNIT_ASSERT_EQUAL(1, group->count()); - CPPUNIT_ASSERT_EQUAL(std::string("boite_1"), group->getName()); - CPPUNIT_ASSERT_EQUAL(XAO::SOLID, group->getDimension()); - CPPUNIT_ASSERT_EQUAL(0, group->get(0)); - group = xao.getGroup(1); - CPPUNIT_ASSERT_EQUAL(2, group->count()); - CPPUNIT_ASSERT_EQUAL(std::string(""), group->getName()); - CPPUNIT_ASSERT_EQUAL(XAO::FACE, group->getDimension()); - CPPUNIT_ASSERT_EQUAL(0, group->get(0)); - CPPUNIT_ASSERT_EQUAL(1, group->get(1)); - - CPPUNIT_ASSERT_EQUAL(1, xao.countFields()); - Field* field= xao.getField(0); - CPPUNIT_ASSERT_EQUAL(std::string("color"), field->getName()); - CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, field->getType()); - CPPUNIT_ASSERT_EQUAL(XAO::SOLID, field->getDimension()); - +void ImportExportTest::checkImport(Xao &xao) { + CPPUNIT_ASSERT_EQUAL(std::string("me"), xao.getAuthor()); + CPPUNIT_ASSERT_EQUAL(std::string("1.0"), xao.getVersion()); + + Geometry *geom = xao.getGeometry(); + CPPUNIT_ASSERT(geom != NULL); + CPPUNIT_ASSERT_EQUAL(std::string("mygeom"), geom->getName()); + + CPPUNIT_ASSERT_EQUAL(8, geom->countVertices()); + CPPUNIT_ASSERT_EQUAL(std::string("v1"), geom->getVertexName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("6"), geom->getVertexReference(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(1)); + CPPUNIT_ASSERT_EQUAL(std::string("7"), geom->getVertexReference(1)); + CPPUNIT_ASSERT_EQUAL(std::string("v3"), geom->getVertexName(2)); + CPPUNIT_ASSERT_EQUAL(std::string("9"), geom->getVertexReference(2)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(3)); + CPPUNIT_ASSERT_EQUAL(std::string("11"), geom->getVertexReference(3)); + CPPUNIT_ASSERT_EQUAL(std::string("v5"), geom->getVertexName(4)); + CPPUNIT_ASSERT_EQUAL(std::string("16"), geom->getVertexReference(4)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(5)); + CPPUNIT_ASSERT_EQUAL(std::string("17"), geom->getVertexReference(5)); + CPPUNIT_ASSERT_EQUAL(std::string("v7"), geom->getVertexName(6)); + CPPUNIT_ASSERT_EQUAL(std::string("19"), geom->getVertexReference(6)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getVertexName(7)); + CPPUNIT_ASSERT_EQUAL(std::string("21"), geom->getVertexReference(7)); + + CPPUNIT_ASSERT_EQUAL(12, geom->countEdges()); + CPPUNIT_ASSERT_EQUAL(std::string("e1"), geom->getEdgeName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("5"), geom->getEdgeReference(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(1)); + CPPUNIT_ASSERT_EQUAL(std::string("8"), geom->getEdgeReference(1)); + CPPUNIT_ASSERT_EQUAL(std::string("e3"), geom->getEdgeName(2)); + CPPUNIT_ASSERT_EQUAL(std::string("10"), geom->getEdgeReference(2)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(3)); + CPPUNIT_ASSERT_EQUAL(std::string("12"), geom->getEdgeReference(3)); + CPPUNIT_ASSERT_EQUAL(std::string("e5"), geom->getEdgeName(4)); + CPPUNIT_ASSERT_EQUAL(std::string("15"), geom->getEdgeReference(4)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(5)); + CPPUNIT_ASSERT_EQUAL(std::string("18"), geom->getEdgeReference(5)); + CPPUNIT_ASSERT_EQUAL(std::string("e7"), geom->getEdgeName(6)); + CPPUNIT_ASSERT_EQUAL(std::string("20"), geom->getEdgeReference(6)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(7)); + CPPUNIT_ASSERT_EQUAL(std::string("22"), geom->getEdgeReference(7)); + CPPUNIT_ASSERT_EQUAL(std::string("e9"), geom->getEdgeName(8)); + CPPUNIT_ASSERT_EQUAL(std::string("25"), geom->getEdgeReference(8)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(9)); + CPPUNIT_ASSERT_EQUAL(std::string("26"), geom->getEdgeReference(9)); + CPPUNIT_ASSERT_EQUAL(std::string("e11"), geom->getEdgeName(10)); + CPPUNIT_ASSERT_EQUAL(std::string("29"), geom->getEdgeReference(10)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getEdgeName(11)); + CPPUNIT_ASSERT_EQUAL(std::string("30"), geom->getEdgeReference(11)); + + CPPUNIT_ASSERT_EQUAL(6, geom->countFaces()); + CPPUNIT_ASSERT_EQUAL(std::string("f1"), geom->getFaceName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("3"), geom->getFaceReference(0)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getFaceName(1)); + CPPUNIT_ASSERT_EQUAL(std::string("13"), geom->getFaceReference(1)); + CPPUNIT_ASSERT_EQUAL(std::string("f3"), geom->getFaceName(2)); + CPPUNIT_ASSERT_EQUAL(std::string("23"), geom->getFaceReference(2)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getFaceName(3)); + CPPUNIT_ASSERT_EQUAL(std::string("27"), geom->getFaceReference(3)); + CPPUNIT_ASSERT_EQUAL(std::string("f5"), geom->getFaceName(4)); + CPPUNIT_ASSERT_EQUAL(std::string("31"), geom->getFaceReference(4)); + CPPUNIT_ASSERT_EQUAL(std::string(""), geom->getFaceName(5)); + CPPUNIT_ASSERT_EQUAL(std::string("33"), geom->getFaceReference(5)); + + CPPUNIT_ASSERT_EQUAL(1, geom->countSolids()); + CPPUNIT_ASSERT_EQUAL(std::string("s1"), geom->getSolidName(0)); + CPPUNIT_ASSERT_EQUAL(std::string("1"), geom->getSolidReference(0)); + + CPPUNIT_ASSERT_EQUAL(2, xao.countGroups()); + Group *group = xao.getGroup(0); + CPPUNIT_ASSERT_EQUAL(1, group->count()); + CPPUNIT_ASSERT_EQUAL(std::string("boite_1"), group->getName()); + CPPUNIT_ASSERT_EQUAL(XAO::SOLID, group->getDimension()); + CPPUNIT_ASSERT_EQUAL(0, group->get(0)); + group = xao.getGroup(1); + CPPUNIT_ASSERT_EQUAL(2, group->count()); + CPPUNIT_ASSERT_EQUAL(std::string(""), group->getName()); + CPPUNIT_ASSERT_EQUAL(XAO::FACE, group->getDimension()); + CPPUNIT_ASSERT_EQUAL(0, group->get(0)); + CPPUNIT_ASSERT_EQUAL(1, group->get(1)); + + CPPUNIT_ASSERT_EQUAL(1, xao.countFields()); + Field *field = xao.getField(0); + CPPUNIT_ASSERT_EQUAL(std::string("color"), field->getName()); + CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, field->getType()); + CPPUNIT_ASSERT_EQUAL(XAO::SOLID, field->getDimension()); } diff --git a/src/XAO/tests/ImportExportTest.hxx b/src/XAO/tests/ImportExportTest.hxx index f70917a53..46da53123 100644 --- a/src/XAO/tests/ImportExportTest.hxx +++ b/src/XAO/tests/ImportExportTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_IMPORT_TEST_HXX__ @@ -24,31 +25,29 @@ #include "../XAO_Xao.hxx" -namespace XAO -{ - class ImportExportTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(ImportExportTest); - CPPUNIT_TEST(testExportNoGeometry); - CPPUNIT_TEST(testExportGeometry); - CPPUNIT_TEST(testGeometryError); - CPPUNIT_TEST(testImportXao); - CPPUNIT_TEST(testImportXaoFromText); - CPPUNIT_TEST_SUITE_END(); - - public: - void setUp(); - void tearDown(); - void cleanUp(); - - void testExportNoGeometry(); - void testExportGeometry(); - void testGeometryError(); - void testImportXao(); - void testImportXaoFromText(); - - void checkImport(Xao& xao); - }; -} +namespace XAO { +class ImportExportTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(ImportExportTest); + CPPUNIT_TEST(testExportNoGeometry); + CPPUNIT_TEST(testExportGeometry); + CPPUNIT_TEST(testGeometryError); + CPPUNIT_TEST(testImportXao); + CPPUNIT_TEST(testImportXaoFromText); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp(); + void tearDown(); + void cleanUp(); + + void testExportNoGeometry(); + void testExportGeometry(); + void testGeometryError(); + void testImportXao(); + void testImportXaoFromText(); + + void checkImport(Xao &xao); +}; +} // namespace XAO #endif // __XAO_IMPORT_TEST_HXX__ diff --git a/src/XAO/tests/MainTest.hxx b/src/XAO/tests/MainTest.hxx index 11f986fe7..6cc11dd68 100644 --- a/src/XAO/tests/MainTest.hxx +++ b/src/XAO/tests/MainTest.hxx @@ -14,73 +14,65 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // // Author : Frederic Pons (OpenCascade) #ifndef __XAOMAINTEST_HXX__ #define __XAOMAINTEST_HXX__ +#include #include #include #include +#include #include -#include #include -#include #include #include -#include #include +#include -struct Arguments -{ +struct Arguments { public: - bool List; - bool Err; - std::string Test; + bool List; + bool Err; + std::string Test; }; -Arguments parseArguments(int argc, char* argv[]) -{ - Arguments res; - res.List = false; - res.Err = false; - res.Test = ""; +Arguments parseArguments(int argc, char *argv[]) { + Arguments res; + res.List = false; + res.Err = false; + res.Test = ""; - if (argc > 1) + if (argc > 1) { + int i = 0; + while (++i < argc) // skip 0 { - int i = 0; - while (++i < argc) // skip 0 - { - if (strcmp(argv[i], "-l") == 0 || strcmp(argv[i], "--list") == 0) - { - res.List = true; - } - else if (strcmp(argv[i], "-e") == 0 || strcmp(argv[i], "--err") == 0) - { - res.Err = true; - } - else if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0) - { - if (i+1 < argc) - res.Test = argv[++i]; - } - } + if (strcmp(argv[i], "-l") == 0 || strcmp(argv[i], "--list") == 0) { + res.List = true; + } else if (strcmp(argv[i], "-e") == 0 || strcmp(argv[i], "--err") == 0) { + res.Err = true; + } else if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0) { + if (i + 1 < argc) + res.Test = argv[++i]; + } } + } - return res; + return res; } -void listTests(CPPUNIT_NS::Test* test) -{ - if (!test) return; - std::cout << test->getName() << std::endl; - for (int i = 0; i < test->getChildTestCount(); ++i) - { - listTests(test->getChildTestAt(i)); - } +void listTests(CPPUNIT_NS::Test *test) { + if (!test) + return; + std::cout << test->getName() << std::endl; + for (int i = 0; i < test->getChildTestCount(); ++i) { + listTests(test->getChildTestAt(i)); + } } // ============================================================================ @@ -89,73 +81,67 @@ void listTests(CPPUNIT_NS::Test* test) * on actual tests, so we use the same for all partial unit tests. */ // ============================================================================ -int main(int argc, char* argv[]) -{ - Arguments args = parseArguments(argc, argv); +int main(int argc, char *argv[]) { + Arguments args = parseArguments(argc, argv); - // --- Create the event manager and test controller - CPPUNIT_NS::TestResult controller; + // --- Create the event manager and test controller + CPPUNIT_NS::TestResult controller; - // --- Add a listener that colllects test result - CPPUNIT_NS::TestResultCollector result; - controller.addListener(&result); + // --- Add a listener that colllects test result + CPPUNIT_NS::TestResultCollector result; + controller.addListener(&result); - // --- Add a listener that print dots as test run. + // --- Add a listener that print dots as test run. #ifdef WIN32 - CPPUNIT_NS::TextTestProgressListener progress; + CPPUNIT_NS::TextTestProgressListener progress; #else - CPPUNIT_NS::BriefTestProgressListener progress; + CPPUNIT_NS::BriefTestProgressListener progress; #endif - controller.addListener(&progress); + controller.addListener(&progress); - // --- Get the top level suite from the registry + // --- Get the top level suite from the registry - CPPUNIT_NS::Test *suite = - CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); + CPPUNIT_NS::Test *suite = + CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); - // --- Adds the test to the list of test to run + // --- Adds the test to the list of test to run - // list tests and exit - if (args.List) - { - listTests(suite); - return 0; - } + // list tests and exit + if (args.List) { + listTests(suite); + return 0; + } - if (!args.Test.empty()) - { - // find test by name - // an exception is raised if not found - suite = suite->findTest(args.Test); - } + if (!args.Test.empty()) { + // find test by name + // an exception is raised if not found + suite = suite->findTest(args.Test); + } - CPPUNIT_NS::TestRunner runner; - runner.addTest(suite); - runner.run(controller); + CPPUNIT_NS::TestRunner runner; + runner.addTest(suite); + runner.run(controller); - // --- Print test in a compiler compatible format. + // --- Print test in a compiler compatible format. - if (args.Err) - { - CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr); - outputter.write(); - } - else - { - std::ofstream testFile; - testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc); - CPPUNIT_NS::CompilerOutputter outputter(&result, testFile); - outputter.write(); - testFile.close(); - } + if (args.Err) { + CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr); + outputter.write(); + } else { + std::ofstream testFile; + testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc); + CPPUNIT_NS::CompilerOutputter outputter(&result, testFile); + outputter.write(); + testFile.close(); + } - // --- Run the tests. + // --- Run the tests. - bool wasSucessful = result.wasSuccessful(); + bool wasSucessful = result.wasSuccessful(); - // --- Return error code 1 if the one of test failed. + // --- Return error code 1 if the one of test failed. - return wasSucessful ? 0 : 1; + return wasSucessful ? 0 : 1; } #endif diff --git a/src/XAO/tests/TestUtils.hxx b/src/XAO/tests/TestUtils.hxx index b07913e14..b051471c6 100644 --- a/src/XAO/tests/TestUtils.hxx +++ b/src/XAO/tests/TestUtils.hxx @@ -14,43 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_TESTUTILS_HXX__ #define __XAO_TESTUTILS_HXX__ -#include #include +#include -namespace XAO -{ - class TestUtils - { - public: - static std::string getTestFilePath(const std::string& filePath) - { - std::string dataDir = getenv("DATA_DIR"); - dataDir += filePath; - return dataDir; - } +namespace XAO { +class TestUtils { +public: + static std::string getTestFilePath(const std::string &filePath) { + std::string dataDir = getenv("DATA_DIR"); + dataDir += filePath; + return dataDir; + } - static char* readTextFile(const std::string& filePath) - { - std::ifstream rstr; - int length; - rstr.open(filePath.c_str(), std::ios_base::binary); - rstr.seekg(0, rstr.end); // go to the end - length = rstr.tellg(); // report location (this is the length) - rstr.seekg(0, rstr.beg); // go back to the beginning - char* txt = new char[length+1]; // allocate memory for a buffer of appropriate dimension - rstr.read(txt, length); // read the whole file into the buffer - txt[length] = '\0'; - rstr.close(); + static char *readTextFile(const std::string &filePath) { + std::ifstream rstr; + int length; + rstr.open(filePath.c_str(), std::ios_base::binary); + rstr.seekg(0, rstr.end); // go to the end + length = rstr.tellg(); // report location (this is the length) + rstr.seekg(0, rstr.beg); // go back to the beginning + char *txt = + new char[length + + 1]; // allocate memory for a buffer of appropriate dimension + rstr.read(txt, length); // read the whole file into the buffer + txt[length] = '\0'; + rstr.close(); - return txt; - } - }; -} + return txt; + } +}; +} // namespace XAO #endif /* __XAO_TESTUTILS_HXX__ */ diff --git a/src/XAO/tests/XAOTests.cxx b/src/XAO/tests/XAOTests.cxx index 6168c2dac..00da65c9f 100644 --- a/src/XAO/tests/XAOTests.cxx +++ b/src/XAO/tests/XAOTests.cxx @@ -14,16 +14,17 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include "XaoUtilsTest.hxx" -#include "GroupTest.hxx" +#include "BrepGeometryTest.hxx" #include "FieldTest.hxx" #include "GeometryTest.hxx" +#include "GroupTest.hxx" #include "ImportExportTest.hxx" -#include "BrepGeometryTest.hxx" #include "XaoTest.hxx" +#include "XaoUtilsTest.hxx" CPPUNIT_TEST_SUITE_REGISTRATION(XAO::XaoUtilsTest); CPPUNIT_TEST_SUITE_REGISTRATION(XAO::GroupTest); diff --git a/src/XAO/tests/XaoTest.cxx b/src/XAO/tests/XaoTest.cxx index 657bed2c3..60e2f1127 100644 --- a/src/XAO/tests/XaoTest.cxx +++ b/src/XAO/tests/XaoTest.cxx @@ -14,109 +14,100 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include "TestUtils.hxx" -#include "XaoTest.hxx" -#include "../XAO_XaoUtils.hxx" -#include "../XAO_Xao.hxx" #include "../XAO_BrepGeometry.hxx" -#include "../XAO_Group.hxx" #include "../XAO_Field.hxx" +#include "../XAO_Group.hxx" +#include "../XAO_Xao.hxx" +#include "../XAO_XaoUtils.hxx" +#include "TestUtils.hxx" +#include "XaoTest.hxx" using namespace XAO; -void XaoTest::setUp() -{ -} - -void XaoTest::tearDown() -{ -} +void XaoTest::setUp() {} -void XaoTest::cleanUp() -{ -} +void XaoTest::tearDown() {} -void XaoTest::testGroups() -{ - Xao obj; - CPPUNIT_ASSERT_THROW(obj.addGroup(XAO::FACE), XAO_Exception); - - BrepGeometry* geom = new BrepGeometry("test"); - obj.setGeometry(geom); - Group* gr = obj.addGroup(XAO::FACE); - CPPUNIT_ASSERT_EQUAL(XAO::FACE, gr->getDimension()); - CPPUNIT_ASSERT_EQUAL(1, obj.countGroups()); - Group* gr2 = obj.addGroup(XAO::FACE); - gr2->setName("AA"); - - Group* agr = obj.getGroup(0); - CPPUNIT_ASSERT(gr == agr); - CPPUNIT_ASSERT_THROW(obj.getGroup(10), XAO_Exception); - - CPPUNIT_ASSERT_EQUAL(true, obj.removeGroup(gr2)); - CPPUNIT_ASSERT_EQUAL(1, obj.countGroups()); - - // remove other group - Group* gr3 = new Group(XAO::FACE, 3); - CPPUNIT_ASSERT_EQUAL(false, obj.removeGroup(gr3)); - delete gr3; -} +void XaoTest::cleanUp() {} -void XaoTest::testFields() -{ - Xao obj; - CPPUNIT_ASSERT_THROW(obj.addField(XAO::INTEGER, XAO::FACE, 3), XAO_Exception); +void XaoTest::testGroups() { + Xao obj; + CPPUNIT_ASSERT_THROW(obj.addGroup(XAO::FACE), XAO_Exception); - BrepGeometry* geom = new BrepGeometry("test"); - obj.setGeometry(geom); - Field* fi = obj.addField(XAO::INTEGER, XAO::FACE, 3); - CPPUNIT_ASSERT_EQUAL(1, obj.countFields()); - CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, fi->getType()); - CPPUNIT_ASSERT_EQUAL(XAO::FACE, fi->getDimension()); - CPPUNIT_ASSERT_EQUAL(3, fi->countComponents()); + BrepGeometry *geom = new BrepGeometry("test"); + obj.setGeometry(geom); + Group *gr = obj.addGroup(XAO::FACE); + CPPUNIT_ASSERT_EQUAL(XAO::FACE, gr->getDimension()); + CPPUNIT_ASSERT_EQUAL(1, obj.countGroups()); + Group *gr2 = obj.addGroup(XAO::FACE); + gr2->setName("AA"); - Field* fb = obj.addField(XAO::BOOLEAN, XAO::FACE, 3); - Field* fd = obj.addField(XAO::DOUBLE, XAO::FACE, 3); - Field* fs = obj.addField(XAO::STRING, XAO::FACE, 3); - CPPUNIT_ASSERT_EQUAL(4, obj.countFields()); - CPPUNIT_ASSERT_THROW(obj.getField(10), XAO_Exception); + Group *agr = obj.getGroup(0); + CPPUNIT_ASSERT(gr == agr); + CPPUNIT_ASSERT_THROW(obj.getGroup(10), XAO_Exception); - CPPUNIT_ASSERT_EQUAL(true, obj.removeField(fb)); - CPPUNIT_ASSERT_EQUAL(3, obj.countFields()); + CPPUNIT_ASSERT_EQUAL(true, obj.removeGroup(gr2)); + CPPUNIT_ASSERT_EQUAL(1, obj.countGroups()); + // remove other group + Group *gr3 = new Group(XAO::FACE, 3); + CPPUNIT_ASSERT_EQUAL(false, obj.removeGroup(gr3)); + delete gr3; +} - Field* ff = Field::createField(XAO::INTEGER, XAO::FACE, 3, 3); - CPPUNIT_ASSERT_EQUAL(false, obj.removeField(ff)); - delete ff; +void XaoTest::testFields() { + Xao obj; + CPPUNIT_ASSERT_THROW(obj.addField(XAO::INTEGER, XAO::FACE, 3), XAO_Exception); + + BrepGeometry *geom = new BrepGeometry("test"); + obj.setGeometry(geom); + Field *fi = obj.addField(XAO::INTEGER, XAO::FACE, 3); + CPPUNIT_ASSERT_EQUAL(1, obj.countFields()); + CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, fi->getType()); + CPPUNIT_ASSERT_EQUAL(XAO::FACE, fi->getDimension()); + CPPUNIT_ASSERT_EQUAL(3, fi->countComponents()); + + Field *fb = obj.addField(XAO::BOOLEAN, XAO::FACE, 3); + Field *fd = obj.addField(XAO::DOUBLE, XAO::FACE, 3); + Field *fs = obj.addField(XAO::STRING, XAO::FACE, 3); + CPPUNIT_ASSERT_EQUAL(4, obj.countFields()); + CPPUNIT_ASSERT_THROW(obj.getField(10), XAO_Exception); + + CPPUNIT_ASSERT_EQUAL(true, obj.removeField(fb)); + CPPUNIT_ASSERT_EQUAL(3, obj.countFields()); + + Field *ff = Field::createField(XAO::INTEGER, XAO::FACE, 3, 3); + CPPUNIT_ASSERT_EQUAL(false, obj.removeField(ff)); + delete ff; } -void XaoTest::testFieldsTypes() -{ - Xao obj; - BrepGeometry* geom = new BrepGeometry("test"); - obj.setGeometry(geom); - - IntegerField* fi = obj.addIntegerField(XAO::FACE, 3); - BooleanField* fb = obj.addBooleanField(XAO::FACE, 3); - DoubleField* fd = obj.addDoubleField(XAO::FACE, 3); - StringField* fs = obj.addStringField(XAO::FACE, 3); - - IntegerField* gfi = obj.getIntegerField(0); - CPPUNIT_ASSERT(gfi == fi); - BooleanField* gfb = obj.getBooleanField(1); - CPPUNIT_ASSERT(gfb == fb); - DoubleField* gfd = obj.getDoubleField(2); - CPPUNIT_ASSERT(gfd == fd); - StringField* gfs = obj.getStringField(3); - CPPUNIT_ASSERT(gfs == fs); - - CPPUNIT_ASSERT_THROW(obj.getIntegerField(1), XAO_Exception); - CPPUNIT_ASSERT_THROW(obj.getBooleanField(0), XAO_Exception); - CPPUNIT_ASSERT_THROW(obj.getDoubleField(0), XAO_Exception); - CPPUNIT_ASSERT_THROW(obj.getStringField(0), XAO_Exception); +void XaoTest::testFieldsTypes() { + Xao obj; + BrepGeometry *geom = new BrepGeometry("test"); + obj.setGeometry(geom); + + IntegerField *fi = obj.addIntegerField(XAO::FACE, 3); + BooleanField *fb = obj.addBooleanField(XAO::FACE, 3); + DoubleField *fd = obj.addDoubleField(XAO::FACE, 3); + StringField *fs = obj.addStringField(XAO::FACE, 3); + + IntegerField *gfi = obj.getIntegerField(0); + CPPUNIT_ASSERT(gfi == fi); + BooleanField *gfb = obj.getBooleanField(1); + CPPUNIT_ASSERT(gfb == fb); + DoubleField *gfd = obj.getDoubleField(2); + CPPUNIT_ASSERT(gfd == fd); + StringField *gfs = obj.getStringField(3); + CPPUNIT_ASSERT(gfs == fs); + + CPPUNIT_ASSERT_THROW(obj.getIntegerField(1), XAO_Exception); + CPPUNIT_ASSERT_THROW(obj.getBooleanField(0), XAO_Exception); + CPPUNIT_ASSERT_THROW(obj.getDoubleField(0), XAO_Exception); + CPPUNIT_ASSERT_THROW(obj.getStringField(0), XAO_Exception); } diff --git a/src/XAO/tests/XaoTest.hxx b/src/XAO/tests/XaoTest.hxx index 3f376052e..3013f5d94 100644 --- a/src/XAO/tests/XaoTest.hxx +++ b/src/XAO/tests/XaoTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_XAO_TEST_HXX__ @@ -22,25 +23,23 @@ #include -namespace XAO -{ - class XaoTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(XaoTest); - CPPUNIT_TEST(testGroups); - CPPUNIT_TEST(testFields); - CPPUNIT_TEST(testFieldsTypes); - CPPUNIT_TEST_SUITE_END(); +namespace XAO { +class XaoTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(XaoTest); + CPPUNIT_TEST(testGroups); + CPPUNIT_TEST(testFields); + CPPUNIT_TEST(testFieldsTypes); + CPPUNIT_TEST_SUITE_END(); - public: - void setUp(); - void tearDown(); - void cleanUp(); +public: + void setUp(); + void tearDown(); + void cleanUp(); - void testGroups(); - void testFields(); - void testFieldsTypes(); - }; -} + void testGroups(); + void testFields(); + void testFieldsTypes(); +}; +} // namespace XAO #endif // __XAO_GROUP_TEST_HXX__ diff --git a/src/XAO/tests/XaoUtilsTest.cxx b/src/XAO/tests/XaoUtilsTest.cxx index 92265e6de..7278f4cdf 100644 --- a/src/XAO/tests/XaoUtilsTest.cxx +++ b/src/XAO/tests/XaoUtilsTest.cxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XaoUtilsTest.hxx" @@ -23,85 +24,83 @@ using namespace XAO; +void XaoUtilsTest::setUp() {} -void XaoUtilsTest::setUp() -{ -} - -void XaoUtilsTest::tearDown() -{ -} +void XaoUtilsTest::tearDown() {} -void XaoUtilsTest::cleanUp() -{ -} +void XaoUtilsTest::cleanUp() {} -void XaoUtilsTest::testBoolean() -{ - CPPUNIT_ASSERT_EQUAL(std::string("true"), XaoUtils::booleanToString(true)); - CPPUNIT_ASSERT_EQUAL(std::string("false"), XaoUtils::booleanToString(false)); +void XaoUtilsTest::testBoolean() { + CPPUNIT_ASSERT_EQUAL(std::string("true"), XaoUtils::booleanToString(true)); + CPPUNIT_ASSERT_EQUAL(std::string("false"), XaoUtils::booleanToString(false)); - CPPUNIT_ASSERT_EQUAL(true, XaoUtils::stringToBoolean("true")); - CPPUNIT_ASSERT_EQUAL(true, XaoUtils::stringToBoolean("1")); - CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("false")); - CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("0")); - CPPUNIT_ASSERT_THROW(XaoUtils::stringToBoolean("abc"), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(true, XaoUtils::stringToBoolean("true")); + CPPUNIT_ASSERT_EQUAL(true, XaoUtils::stringToBoolean("1")); + CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("false")); + CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("0")); + CPPUNIT_ASSERT_THROW(XaoUtils::stringToBoolean("abc"), XAO_Exception); } -void XaoUtilsTest::testInteger() -{ - CPPUNIT_ASSERT_EQUAL(std::string("0"), XaoUtils::intToString(0)); - CPPUNIT_ASSERT_EQUAL(std::string("123"), XaoUtils::intToString(123)); +void XaoUtilsTest::testInteger() { + CPPUNIT_ASSERT_EQUAL(std::string("0"), XaoUtils::intToString(0)); + CPPUNIT_ASSERT_EQUAL(std::string("123"), XaoUtils::intToString(123)); - CPPUNIT_ASSERT_EQUAL(123, XaoUtils::stringToInt("123")); - CPPUNIT_ASSERT_THROW(XaoUtils::stringToInt("abc"), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(123, XaoUtils::stringToInt("123")); + CPPUNIT_ASSERT_THROW(XaoUtils::stringToInt("abc"), XAO_Exception); } -void XaoUtilsTest::testDouble() -{ - CPPUNIT_ASSERT_EQUAL(std::string("0"), XaoUtils::doubleToString(0)); - CPPUNIT_ASSERT_EQUAL(std::string("12.3"), XaoUtils::doubleToString(12.3)); +void XaoUtilsTest::testDouble() { + CPPUNIT_ASSERT_EQUAL(std::string("0"), XaoUtils::doubleToString(0)); + CPPUNIT_ASSERT_EQUAL(std::string("12.3"), XaoUtils::doubleToString(12.3)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.123, XaoUtils::stringToDouble("0.123"), 1e-3); - CPPUNIT_ASSERT_THROW(XaoUtils::stringToDouble("abc"), XAO_Exception); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.123, XaoUtils::stringToDouble("0.123"), 1e-3); + CPPUNIT_ASSERT_THROW(XaoUtils::stringToDouble("abc"), XAO_Exception); } -void XaoUtilsTest::testDimension() -{ - CPPUNIT_ASSERT_EQUAL(std::string("vertex"), XaoUtils::dimensionToString(XAO::VERTEX)); - CPPUNIT_ASSERT_EQUAL(std::string("edge"), XaoUtils::dimensionToString(XAO::EDGE)); - CPPUNIT_ASSERT_EQUAL(std::string("face"), XaoUtils::dimensionToString(XAO::FACE)); - CPPUNIT_ASSERT_EQUAL(std::string("solid"), XaoUtils::dimensionToString(XAO::SOLID)); - CPPUNIT_ASSERT_EQUAL(std::string("whole"), XaoUtils::dimensionToString(XAO::WHOLE)); - - CPPUNIT_ASSERT_EQUAL(XAO::VERTEX, XaoUtils::stringToDimension("vertex")); - CPPUNIT_ASSERT_EQUAL(XAO::EDGE, XaoUtils::stringToDimension("edge")); - CPPUNIT_ASSERT_EQUAL(XAO::FACE, XaoUtils::stringToDimension("face")); - CPPUNIT_ASSERT_EQUAL(XAO::SOLID, XaoUtils::stringToDimension("solid")); - CPPUNIT_ASSERT_EQUAL(XAO::WHOLE, XaoUtils::stringToDimension("whole")); - CPPUNIT_ASSERT_THROW(XaoUtils::stringToDimension("zz"), XAO_Exception); +void XaoUtilsTest::testDimension() { + CPPUNIT_ASSERT_EQUAL(std::string("vertex"), + XaoUtils::dimensionToString(XAO::VERTEX)); + CPPUNIT_ASSERT_EQUAL(std::string("edge"), + XaoUtils::dimensionToString(XAO::EDGE)); + CPPUNIT_ASSERT_EQUAL(std::string("face"), + XaoUtils::dimensionToString(XAO::FACE)); + CPPUNIT_ASSERT_EQUAL(std::string("solid"), + XaoUtils::dimensionToString(XAO::SOLID)); + CPPUNIT_ASSERT_EQUAL(std::string("whole"), + XaoUtils::dimensionToString(XAO::WHOLE)); + + CPPUNIT_ASSERT_EQUAL(XAO::VERTEX, XaoUtils::stringToDimension("vertex")); + CPPUNIT_ASSERT_EQUAL(XAO::EDGE, XaoUtils::stringToDimension("edge")); + CPPUNIT_ASSERT_EQUAL(XAO::FACE, XaoUtils::stringToDimension("face")); + CPPUNIT_ASSERT_EQUAL(XAO::SOLID, XaoUtils::stringToDimension("solid")); + CPPUNIT_ASSERT_EQUAL(XAO::WHOLE, XaoUtils::stringToDimension("whole")); + CPPUNIT_ASSERT_THROW(XaoUtils::stringToDimension("zz"), XAO_Exception); } -void XaoUtilsTest::testType() -{ - CPPUNIT_ASSERT_EQUAL(std::string("boolean"), XaoUtils::fieldTypeToString(XAO::BOOLEAN)); - CPPUNIT_ASSERT_EQUAL(std::string("integer"), XaoUtils::fieldTypeToString(XAO::INTEGER)); - CPPUNIT_ASSERT_EQUAL(std::string("double"), XaoUtils::fieldTypeToString(XAO::DOUBLE)); - CPPUNIT_ASSERT_EQUAL(std::string("string"), XaoUtils::fieldTypeToString(XAO::STRING)); - - CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, XaoUtils::stringToFieldType("boolean")); - CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, XaoUtils::stringToFieldType("integer")); - CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, XaoUtils::stringToFieldType("double")); - CPPUNIT_ASSERT_EQUAL(XAO::STRING, XaoUtils::stringToFieldType("string")); - CPPUNIT_ASSERT_THROW(XaoUtils::stringToFieldType("zz"), XAO_Exception); +void XaoUtilsTest::testType() { + CPPUNIT_ASSERT_EQUAL(std::string("boolean"), + XaoUtils::fieldTypeToString(XAO::BOOLEAN)); + CPPUNIT_ASSERT_EQUAL(std::string("integer"), + XaoUtils::fieldTypeToString(XAO::INTEGER)); + CPPUNIT_ASSERT_EQUAL(std::string("double"), + XaoUtils::fieldTypeToString(XAO::DOUBLE)); + CPPUNIT_ASSERT_EQUAL(std::string("string"), + XaoUtils::fieldTypeToString(XAO::STRING)); + + CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, XaoUtils::stringToFieldType("boolean")); + CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, XaoUtils::stringToFieldType("integer")); + CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, XaoUtils::stringToFieldType("double")); + CPPUNIT_ASSERT_EQUAL(XAO::STRING, XaoUtils::stringToFieldType("string")); + CPPUNIT_ASSERT_THROW(XaoUtils::stringToFieldType("zz"), XAO_Exception); } -void XaoUtilsTest::testFormat() -{ - CPPUNIT_ASSERT_EQUAL(std::string("BREP"), XaoUtils::shapeFormatToString(XAO::BREP)); - CPPUNIT_ASSERT_EQUAL(std::string("STEP"), XaoUtils::shapeFormatToString(XAO::STEP)); +void XaoUtilsTest::testFormat() { + CPPUNIT_ASSERT_EQUAL(std::string("BREP"), + XaoUtils::shapeFormatToString(XAO::BREP)); + CPPUNIT_ASSERT_EQUAL(std::string("STEP"), + XaoUtils::shapeFormatToString(XAO::STEP)); - CPPUNIT_ASSERT_EQUAL(XAO::BREP, XaoUtils::stringToShapeFormat("BREP")); - CPPUNIT_ASSERT_EQUAL(XAO::STEP, XaoUtils::stringToShapeFormat("STEP")); - CPPUNIT_ASSERT_THROW(XaoUtils::stringToShapeFormat("zz"), XAO_Exception); + CPPUNIT_ASSERT_EQUAL(XAO::BREP, XaoUtils::stringToShapeFormat("BREP")); + CPPUNIT_ASSERT_EQUAL(XAO::STEP, XaoUtils::stringToShapeFormat("STEP")); + CPPUNIT_ASSERT_THROW(XaoUtils::stringToShapeFormat("zz"), XAO_Exception); } diff --git a/src/XAO/tests/XaoUtilsTest.hxx b/src/XAO/tests/XaoUtilsTest.hxx index 9352f024e..494897999 100644 --- a/src/XAO/tests/XaoUtilsTest.hxx +++ b/src/XAO/tests/XaoUtilsTest.hxx @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef __XAO_UTILS_TEST_HXX__ @@ -22,31 +23,29 @@ #include -namespace XAO -{ - class XaoUtilsTest: public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE(XaoUtilsTest); - CPPUNIT_TEST(testBoolean); - CPPUNIT_TEST(testInteger); - CPPUNIT_TEST(testDouble); - CPPUNIT_TEST(testDimension); - CPPUNIT_TEST(testType); - CPPUNIT_TEST(testFormat); - CPPUNIT_TEST_SUITE_END(); +namespace XAO { +class XaoUtilsTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(XaoUtilsTest); + CPPUNIT_TEST(testBoolean); + CPPUNIT_TEST(testInteger); + CPPUNIT_TEST(testDouble); + CPPUNIT_TEST(testDimension); + CPPUNIT_TEST(testType); + CPPUNIT_TEST(testFormat); + CPPUNIT_TEST_SUITE_END(); - public: - void setUp(); - void tearDown(); - void cleanUp(); +public: + void setUp(); + void tearDown(); + void cleanUp(); - void testBoolean(); - void testInteger(); - void testDouble(); - void testDimension(); - void testType(); - void testFormat(); - }; -} + void testBoolean(); + void testInteger(); + void testDouble(); + void testDimension(); + void testType(); + void testFormat(); +}; +} // namespace XAO #endif // __XAO_FIELD_TEST_HXX__ diff --git a/src/XAO/tests/coverage_report.sh b/src/XAO/tests/coverage_report.sh index 52887a4b2..5eac9fc62 100755 --- a/src/XAO/tests/coverage_report.sh +++ b/src/XAO/tests/coverage_report.sh @@ -81,4 +81,4 @@ genhtml --output-directory $REPORT_PATH --title $TITLE --num-spaces 4 $INFO_FILE if [ ! -z $BROWSER ] then $BROWSER $REPORT_PATH/index.html & -fi \ No newline at end of file +fi diff --git a/src/XGUI/XGUI.h b/src/XGUI/XGUI.h index f40c1fd33..e7de74f92 100644 --- a/src/XGUI/XGUI.h +++ b/src/XGUI/XGUI.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_H @@ -24,13 +25,13 @@ #if defined XGUI_EXPORTS #if defined WIN32 -#define XGUI_EXPORT __declspec( dllexport ) +#define XGUI_EXPORT __declspec(dllexport) #else #define XGUI_EXPORT #endif #else #if defined WIN32 -#define XGUI_EXPORT __declspec( dllimport ) +#define XGUI_EXPORT __declspec(dllimport) #else #define XGUI_EXPORT #endif diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index e803522b4..3fad0ecae 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef HAVE_SALOME @@ -22,17 +23,17 @@ #endif #include -#include #include #include #include #include +#include -#include #include +#include -#include #include +#include #include #include #include @@ -47,15 +48,13 @@ #endif #ifdef _DEBUG -#include #include +#include #endif -XGUI_ActionsMgr::XGUI_ActionsMgr(XGUI_Workshop* theParent) - : QObject(theParent), - myWorkshop(theParent), - myOperationMgr(theParent->operationMgr()) -{ +XGUI_ActionsMgr::XGUI_ActionsMgr(XGUI_Workshop *theParent) + : QObject(theParent), myWorkshop(theParent), + myOperationMgr(theParent->operationMgr()) { // Default shortcuts myShortcuts << QKeySequence::Save; myShortcuts << QKeySequence::Undo; @@ -63,53 +62,47 @@ XGUI_ActionsMgr::XGUI_ActionsMgr(XGUI_Workshop* theParent) myShortcuts << QKeySequence::Open; myShortcuts << QKeySequence::Close; - //Initialize event listening - Events_Loop* aLoop = Events_Loop::loop(); + // Initialize event listening + Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aStateResponseEventId = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); aLoop->registerListener(this, aStateResponseEventId, NULL, true); } -XGUI_ActionsMgr::~XGUI_ActionsMgr() -{ -} +XGUI_ActionsMgr::~XGUI_ActionsMgr() {} -void XGUI_ActionsMgr::addCommand(QAction* theCmd) -{ +void XGUI_ActionsMgr::addCommand(QAction *theCmd) { QString aId = theCmd->data().toString(); if (aId.isEmpty()) { return; } myActions.insert(aId, theCmd); #ifdef HAVE_SALOME - XGUI_Workshop* aWorkshop = static_cast(parent()); - const std::shared_ptr& anInfo = - aWorkshop->salomeConnector()->featureInfo(aId); - if (anInfo.get()) - myNestedActions[aId] = QString::fromStdString(anInfo->nestedFeatures()) - .split(" ", QString::SkipEmptyParts); + XGUI_Workshop *aWorkshop = static_cast(parent()); + const std::shared_ptr &anInfo = + aWorkshop->salomeConnector()->featureInfo(aId); + if (anInfo.get()) + myNestedActions[aId] = QString::fromStdString(anInfo->nestedFeatures()) + .split(" ", QString::SkipEmptyParts); #else - AppElements_Command* aXCmd = dynamic_cast(theCmd); + AppElements_Command *aXCmd = dynamic_cast(theCmd); myNestedActions[aId] = aXCmd->nestedCommands(); #endif } -void XGUI_ActionsMgr::addNestedCommands(const QString& theId, const QStringList& theCommands) -{ +void XGUI_ActionsMgr::addNestedCommands(const QString &theId, + const QStringList &theCommands) { myNestedActions[theId] = theCommands; } -QStringList XGUI_ActionsMgr::nestedCommands(const QString& theId) const -{ +QStringList XGUI_ActionsMgr::nestedCommands(const QString &theId) const { if (myNestedActions.contains(theId)) return myNestedActions[theId]; return QStringList(); } -bool XGUI_ActionsMgr::isNested(const QString& theId) const -{ - foreach(QString aId, myNestedActions.keys()) - { +bool XGUI_ActionsMgr::isNested(const QString &theId) const { + foreach (QString aId, myNestedActions.keys()) { QStringList aList = myNestedActions[aId]; if (aList.contains(theId)) return true; @@ -117,20 +110,20 @@ bool XGUI_ActionsMgr::isNested(const QString& theId) const return false; } -void XGUI_ActionsMgr::updateCommandsStatus() -{ +void XGUI_ActionsMgr::updateCommandsStatus() { setAllEnabled(); - XGUI_Selection* aSelection = myWorkshop->selector()->selection(); + XGUI_Selection *aSelection = myWorkshop->selector()->selection(); if (aSelection->getSelected(ModuleBase_ISelection::AllControls).size() > 0) updateOnViewSelection(); FeaturePtr anActiveFeature = FeaturePtr(); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myOperationMgr->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + myOperationMgr->currentOperation()); if (aFOperation) { anActiveFeature = aFOperation->feature(); QStringList aNested = allNestedCommands(aFOperation); - foreach(QString aAction, myActions.keys()) { + foreach (QString aAction, myActions.keys()) { if (!aNested.contains(aAction)) setActionEnabled(aAction, false); } @@ -142,54 +135,54 @@ void XGUI_ActionsMgr::updateCommandsStatus() updateCheckState(); } -void XGUI_ActionsMgr::updateCheckState() -{ +void XGUI_ActionsMgr::updateCheckState() { QString eachCommand = QString(); - foreach(eachCommand, myActions.keys()) { + foreach (eachCommand, myActions.keys()) { setActionChecked(eachCommand, false); } QStringList ltActiveCommands = myOperationMgr->operationList(); - foreach(eachCommand, ltActiveCommands) { + foreach (eachCommand, ltActiveCommands) { setActionChecked(eachCommand, true); } } -void XGUI_ActionsMgr::updateOnViewSelection() -{ +void XGUI_ActionsMgr::updateOnViewSelection() { if (!myOperationMgr->hasOperation()) return; QStringList aIdList = myOperationMgr->operationList(); - //ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); - //FeaturePtr anActiveFeature = anOperation->feature(); - //if(!anActiveFeature.get()) + // ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); + // FeaturePtr anActiveFeature = anOperation->feature(); + // if(!anActiveFeature.get()) if (aIdList.isEmpty()) return; - ModuleBase_Operation* theOperation = myOperationMgr->currentOperation(); - //QString aFeatureId = QString::fromStdString(anActiveFeature->getKind()); - XGUI_Selection* aSelection = myWorkshop->selector()->selection(); + ModuleBase_Operation *theOperation = myOperationMgr->currentOperation(); + // QString aFeatureId = QString::fromStdString(anActiveFeature->getKind()); + XGUI_Selection *aSelection = myWorkshop->selector()->selection(); // only viewer selection is processed SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - foreach(QString aFeatureId, aIdList) { - foreach(QString aId, nestedCommands(aFeatureId)) { + ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); + foreach (QString aFeatureId, aIdList) { + foreach (QString aId, nestedCommands(aFeatureId)) { ModelAPI_ValidatorsFactory::Validators aValidators; aFactory->validators(aId.toStdString(), aValidators); - ModelAPI_ValidatorsFactory::Validators::iterator aValidatorIt = aValidators.begin(); + ModelAPI_ValidatorsFactory::Validators::iterator aValidatorIt = + aValidators.begin(); for (; aValidatorIt != aValidators.end(); ++aValidatorIt) { - const ModuleBase_SelectionValidator* aSelValidator = - dynamic_cast - (aFactory->validator(aValidatorIt->first)); + const ModuleBase_SelectionValidator *aSelValidator = + dynamic_cast( + aFactory->validator(aValidatorIt->first)); if (aSelValidator) - setActionEnabled(aId, aSelValidator->isValid(aSelection, theOperation)); + setActionEnabled(aId, + aSelValidator->isValid(aSelection, theOperation)); } } } } -QKeySequence XGUI_ActionsMgr::registerShortcut(const QKeySequence& theKeySequence) -{ +QKeySequence +XGUI_ActionsMgr::registerShortcut(const QKeySequence &theKeySequence) { if (theKeySequence.isEmpty()) { return QKeySequence(); } @@ -203,8 +196,7 @@ QKeySequence XGUI_ActionsMgr::registerShortcut(const QKeySequence& theKeySequenc return theKeySequence; } -QKeySequence XGUI_ActionsMgr::registerShortcut(const QString& theKeySequence) -{ +QKeySequence XGUI_ActionsMgr::registerShortcut(const QString &theKeySequence) { if (theKeySequence.isEmpty()) { return QKeySequence(); } @@ -213,8 +205,8 @@ QKeySequence XGUI_ActionsMgr::registerShortcut(const QString& theKeySequence) return aResult; } -void XGUI_ActionsMgr::processEvent(const std::shared_ptr& theMessage) -{ +void XGUI_ActionsMgr::processEvent( + const std::shared_ptr &theMessage) { const Events_ID kResponseEvent = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); if (theMessage->eventID() == kResponseEvent) { @@ -224,7 +216,7 @@ void XGUI_ActionsMgr::processEvent(const std::shared_ptr& theMes return; std::list aFeaturesList = aStateMessage->features(); std::list::iterator it = aFeaturesList.begin(); - for( ; it != aFeaturesList.end(); ++it) { + for (; it != aFeaturesList.end(); ++it) { QString anActionId = QString::fromStdString(*it); bool theDefaultState = false; if (myActions.contains(anActionId)) { @@ -233,151 +225,144 @@ void XGUI_ActionsMgr::processEvent(const std::shared_ptr& theMes setActionEnabled(anActionId, aStateMessage->state(*it, theDefaultState)); } } else if (theMessage.get()) { - #ifdef _DEBUG - std::cout << "XGUI_ActionsMgr::processEvent: unhandled message caught: " << std::endl +#ifdef _DEBUG + std::cout << "XGUI_ActionsMgr::processEvent: unhandled message caught: " + << std::endl << theMessage->eventID().eventText() << std::endl; - #endif +#endif } } -QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) -{ - QAction* aResult = NULL; +QAction *XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) { + QAction *aResult = NULL; if (myOperationActions.contains(theId)) { aResult = myOperationActions.value(theId); - //if (theParent && aResult->parent() != theParent) { - // aResult->setParent(theParent); - //} + // if (theParent && aResult->parent() != theParent) { + // aResult->setParent(theParent); + // } } else { - QWidget* aParent = myWorkshop->desktop(); + QWidget *aParent = myWorkshop->desktop(); switch (theId) { - case Accept: - case AcceptAll: { - aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok.png"), - tr("Apply"), aParent); - } + case Accept: + case AcceptAll: { + aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok.png"), + tr("Apply"), aParent); + } break; + case AcceptPlus: { + aResult = + ModuleBase_Tools::createAction(QIcon(":pictures/button_ok-plus.png"), + tr("Apply and continue"), aParent); + } break; + case Abort: + case AbortAll: { + aResult = ModuleBase_Tools::createAction( + QIcon(":pictures/button_cancel.png"), tr("Cancel"), aParent); + } break; + case Help: { + aResult = ModuleBase_Tools::createAction( + QIcon(":pictures/button_help.png"), tr("Help"), aParent); + } break; + case Preview: { + aResult = ModuleBase_Tools::createAction( + QIcon(), tr("See preview"), aParent, 0, 0, tr("Compute preview")); + aResult->setStatusTip(aResult->toolTip()); + } break; + default: break; - case AcceptPlus: { - aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok-plus.png"), - tr("Apply and continue"), aParent); - } - break; - case Abort: - case AbortAll: { - aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_cancel.png"), tr("Cancel"), - aParent); - } - break; - case Help: { - aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_help.png"), tr("Help"), - aParent); - } - break; - case Preview: { - aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), - aParent, 0, 0, tr("Compute preview")); - aResult->setStatusTip(aResult->toolTip()); - } - break; - default: - break; } myOperationActions.insert(theId, aResult); } return aResult; } -QAction* XGUI_ActionsMgr::action(const QString& theId) -{ - QAction* anAction = 0; - if(myActions.contains(theId)) { +QAction *XGUI_ActionsMgr::action(const QString &theId) { + QAction *anAction = 0; + if (myActions.contains(theId)) { anAction = myActions.value(theId); } return anAction; } -ActionInfo XGUI_ActionsMgr::actionInfoById(const QString& theId) -{ +ActionInfo XGUI_ActionsMgr::actionInfoById(const QString &theId) { ActionInfo aResult; - if(myActions.contains(theId)) { + if (myActions.contains(theId)) { aResult.initFrom(myActions.value(theId)); } else { - aResult.id = theId; - aResult.text = theId; + aResult.id = theId; + aResult.text = theId; } return aResult; } -void XGUI_ActionsMgr::setAllEnabled() -{ - foreach(QString eachAction, myActions.keys()) { +void XGUI_ActionsMgr::setAllEnabled() { + foreach (QString eachAction, myActions.keys()) { if (myActions.contains(eachAction)) { - QAction* aAction = myActions[eachAction]; + QAction *aAction = myActions[eachAction]; aAction->setEnabled(true); } } } - //! -void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, const QString& theParent) -{ +void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, + const QString &theParent) { QStringList ltNestedActions; - if (theParent.isEmpty()) { //Disable ALL nested - foreach(QString eachParent, myNestedActions.keys()) { + if (theParent.isEmpty()) { // Disable ALL nested + foreach (QString eachParent, myNestedActions.keys()) { ltNestedActions << myNestedActions[eachParent]; } } else { ltNestedActions << myNestedActions[theParent]; } - foreach(QString eachNested, ltNestedActions) { + foreach (QString eachNested, ltNestedActions) { setActionEnabled(eachNested, theEnabled); } } -void XGUI_ActionsMgr::setNestedStackEnabled(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* anOperation = - dynamic_cast(theOperation); - if(!anOperation || !anOperation->feature()) +void XGUI_ActionsMgr::setNestedStackEnabled( + ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *anOperation = + dynamic_cast(theOperation); + if (!anOperation || !anOperation->feature()) return; FeaturePtr aFeature = anOperation->feature(); QString aFeatureId = QString::fromStdString(aFeature->getKind()); - //setActionEnabled(aFeatureId, true); + // setActionEnabled(aFeatureId, true); setNestedCommandsEnabled(true, aFeatureId); setNestedStackEnabled(myOperationMgr->previousOperation(theOperation)); } -QStringList XGUI_ActionsMgr::allNestedCommands(ModuleBase_Operation* theOperation) -{ +QStringList +XGUI_ActionsMgr::allNestedCommands(ModuleBase_Operation *theOperation) { QStringList aFeatures; - ModuleBase_OperationFeature* anOperation = - dynamic_cast(theOperation); - if(!anOperation || !anOperation->feature()) + ModuleBase_OperationFeature *anOperation = + dynamic_cast(theOperation); + if (!anOperation || !anOperation->feature()) return aFeatures; FeaturePtr aFeature = anOperation->feature(); QString aFeatureId = QString::fromStdString(aFeature->getKind()); aFeatures << myNestedActions[aFeatureId]; - aFeatures << allNestedCommands(myOperationMgr->previousOperation(theOperation)); + aFeatures << allNestedCommands( + myOperationMgr->previousOperation(theOperation)); return aFeatures; } -void XGUI_ActionsMgr::setActionChecked(const QString& theId, const bool theChecked) -{ +void XGUI_ActionsMgr::setActionChecked(const QString &theId, + const bool theChecked) { if (myActions.contains(theId)) { - QAction* anAction = myActions[theId]; + QAction *anAction = myActions[theId]; if (anAction->isCheckable()) { anAction->setChecked(theChecked); } } } -void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabled) -{ +void XGUI_ActionsMgr::setActionEnabled(const QString &theId, + const bool theEnabled) { if (myActions.contains(theId)) { - QAction* aAction = myActions[theId]; + QAction *aAction = myActions[theId]; // Initially all actions are enabled // If it was disabled for any reason then we can not enable it if (aAction->isEnabled()) @@ -389,35 +374,34 @@ void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabl * Disables all actions which have the Document Kind different to * the current document's kind */ -void XGUI_ActionsMgr::updateByDocumentKind() -{ +void XGUI_ActionsMgr::updateByDocumentKind() { std::string aStdDocKind = ModelAPI_Session::get()->activeDocument()->kind(); QString aDocKind = QString::fromStdString(aStdDocKind); #ifdef HAVE_SALOME - XGUI_Workshop* aWorkshop = static_cast(parent()); + XGUI_Workshop *aWorkshop = static_cast(parent()); #endif - foreach(QAction* eachAction, myActions.values()) { + foreach (QAction *eachAction, myActions.values()) { QString aCmdDocKind; #ifdef HAVE_SALOME QString aId = eachAction->data().toString(); if (!aId.isEmpty()) { aCmdDocKind = QString::fromStdString( - aWorkshop->salomeConnector()->featureInfo(aId)->documentKind()); + aWorkshop->salomeConnector()->featureInfo(aId)->documentKind()); } #else - AppElements_Command* aCmd = dynamic_cast(eachAction); - aCmdDocKind = QString::fromStdString(aCmd->featureMessage()->documentKind()); + AppElements_Command *aCmd = dynamic_cast(eachAction); + aCmdDocKind = + QString::fromStdString(aCmd->featureMessage()->documentKind()); #endif - if(!aCmdDocKind.isEmpty() && aCmdDocKind != aDocKind) { + if (!aCmdDocKind.isEmpty() && aCmdDocKind != aDocKind) { eachAction->setEnabled(false); } } } -void XGUI_ActionsMgr::updateByPlugins(FeaturePtr anActiveFeature) -{ - static Events_ID aStateRequestEventId = Events_Loop::loop()->eventByName( - EVENT_FEATURE_STATE_REQUEST); +void XGUI_ActionsMgr::updateByPlugins(FeaturePtr anActiveFeature) { + static Events_ID aStateRequestEventId = + Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_REQUEST); std::shared_ptr aMsg( new ModelAPI_FeatureStateMessage(aStateRequestEventId, this)); aMsg->setFeature(anActiveFeature); diff --git a/src/XGUI/XGUI_ActionsMgr.h b/src/XGUI/XGUI_ActionsMgr.h index 27549c19d..e0e3350ae 100644 --- a/src/XGUI/XGUI_ActionsMgr.h +++ b/src/XGUI/XGUI_ActionsMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ActionsMgr_H @@ -27,11 +28,11 @@ #include -#include -#include +#include #include +#include +#include #include -#include class XGUI_Workshop; class XGUI_OperationMgr; @@ -41,14 +42,13 @@ class QAction; /// class XGUI_ActionsMgr /// \ingroup GUI /// A class for management of actions (features) activation/deactivation -class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener -{ +class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener { Q_OBJECT - public: +public: /// Constructor /// \param theWorkshop an instance of workshop - XGUI_ActionsMgr(XGUI_Workshop* theWorkshop); + XGUI_ActionsMgr(XGUI_Workshop *theWorkshop); virtual ~XGUI_ActionsMgr(); /// Actions on operations @@ -63,45 +63,46 @@ class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener }; /// Add a command in the manager. - /// Please note that nested commands in the Salome mode (No AppElements_Command, pure QActions) - /// won't be extracted and should be added manually using the addNestedCommands method. - void addCommand(QAction* theCmd); + /// Please note that nested commands in the Salome mode (No + /// AppElements_Command, pure QActions) won't be extracted and should be added + /// manually using the addNestedCommands method. + void addCommand(QAction *theCmd); /// Sets relation between the command (with given Id) and it's nested actions. - void addNestedCommands(const QString& theId, const QStringList& theCommands); + void addNestedCommands(const QString &theId, const QStringList &theCommands); /// Returns list of nested commands by parent command Id /// \param theId a parent command Id - QStringList nestedCommands(const QString& theId) const; + QStringList nestedCommands(const QString &theId) const; /// Returns True if the given Id is an Id of nested command /// \param theId an Id to check - bool isNested(const QString& theId) const; + bool isNested(const QString &theId) const; /// Registers shortcut (key sequence) for the command triggering /// \param theKeySequence a key sequence to register - QKeySequence registerShortcut(const QKeySequence& theKeySequence); + QKeySequence registerShortcut(const QKeySequence &theKeySequence); /// This is an overloaded function. /// Registers shortcut (key sequence) for the command triggering /// \param theKeySequence - string that contain a key sequence to register - QKeySequence registerShortcut(const QString& theKeySequence); + QKeySequence registerShortcut(const QString &theKeySequence); /// Redefinition of Events_Listener method - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); /// Return property panel's action like ok, cancel, help. /// If there is no such action, it will be created. - QAction* operationStateAction(OperationStateActionId theId); + QAction *operationStateAction(OperationStateActionId theId); /// Return an action by the given id, if it was registered in the manager - QAction* action(const QString& theId); + QAction *action(const QString &theId); /// Return info (icon, text, etc) about the action by the given id, /// if it was registered in the manager - ActionInfo actionInfoById(const QString& theId); + ActionInfo actionInfoById(const QString &theId); - private: +private: /// Update workbench actions according to OperationMgr state: /// No active operations: all actions but nested are available /// There is active operation: current operation + it's nested @@ -119,16 +120,18 @@ class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener /// Sets all nested actions to isEnabled state for the command with given ID. /// If ID is empty - all nested actions will be affected. - void setNestedCommandsEnabled(bool isEnabled, const QString& theParent = QString()); + void setNestedCommandsEnabled(bool isEnabled, + const QString &theParent = QString()); - /// Sets to enabled state all siblings of the given operation and it's parents recursively - void setNestedStackEnabled(ModuleBase_Operation* theOperation); + /// Sets to enabled state all siblings of the given operation and it's parents + /// recursively + void setNestedStackEnabled(ModuleBase_Operation *theOperation); /// Sets the action with theId to theChecked state. - void setActionChecked(const QString& theId, const bool theChecked); + void setActionChecked(const QString &theId, const bool theChecked); /// Sets the action with theId to theEnabled state. - void setActionEnabled(const QString& theId, const bool theEnabled); + void setActionEnabled(const QString &theId, const bool theEnabled); /// Updates actions according to their "document" tag void updateByDocumentKind(); @@ -138,20 +141,18 @@ class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener /// Returns names of nested action for the feature of given operation /// \param theOperation an operation - QStringList allNestedCommands(ModuleBase_Operation* theOperation); + QStringList allNestedCommands(ModuleBase_Operation *theOperation); - private: - - QMap myActions; +private: + QMap myActions; QMap myNestedActions; - QMap myOperationActions; + QMap myOperationActions; QList myShortcuts; - XGUI_Workshop* myWorkshop; - XGUI_OperationMgr* myOperationMgr; + XGUI_Workshop *myWorkshop; + XGUI_OperationMgr *myOperationMgr; friend class XGUI_Workshop; }; #endif /* XGUI_ActionsMgr_H */ - diff --git a/src/XGUI/XGUI_ActiveControlMgr.cpp b/src/XGUI/XGUI_ActiveControlMgr.cpp index b4cd52af8..c07776151 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.cpp +++ b/src/XGUI/XGUI_ActiveControlMgr.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_ActiveControlMgr.h" @@ -30,34 +31,36 @@ //#define DEBUG_ACTIVE_SELECTOR #ifdef DEBUG_ACTIVE_SELECTOR -void debugInfo(const QString& theMessage, XGUI_ActiveControlSelector* theSelector) -{ +void debugInfo(const QString &theMessage, + XGUI_ActiveControlSelector *theSelector) { std::cout << theMessage.toStdString().c_str() << ", active: " - << (theSelector ? theSelector->getType().toStdString().c_str() : "NULL") << std::endl; + << (theSelector ? theSelector->getType().toStdString().c_str() + : "NULL") + << std::endl; } #endif //******************************************************************** -XGUI_ActiveControlMgr::XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop) -: myWorkshop(theWorkshop), myActiveSelector(0), myIsBlocked(false) -{ - connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); +XGUI_ActiveControlMgr::XGUI_ActiveControlMgr(ModuleBase_IWorkshop *theWorkshop) + : myWorkshop(theWorkshop), myActiveSelector(0), myIsBlocked(false) { + connect(myWorkshop, SIGNAL(selectionChanged()), this, + SLOT(onSelectionChanged())); } //******************************************************************** -void XGUI_ActiveControlMgr::addSelector(XGUI_ActiveControlSelector* theSelector) -{ +void XGUI_ActiveControlMgr::addSelector( + XGUI_ActiveControlSelector *theSelector) { mySelectors.append(theSelector); connect(theSelector, SIGNAL(activated()), this, SLOT(onSelectorActivated())); - connect(theSelector, SIGNAL(deactivated()), this, SLOT(onSelectorDeactivated())); + connect(theSelector, SIGNAL(deactivated()), this, + SLOT(onSelectorDeactivated())); } //******************************************************************** -XGUI_ActiveControlSelector* XGUI_ActiveControlMgr::getSelector(const QString& theType) -{ - XGUI_ActiveControlSelector* aSelector = 0; - for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) - { +XGUI_ActiveControlSelector * +XGUI_ActiveControlMgr::getSelector(const QString &theType) { + XGUI_ActiveControlSelector *aSelector = 0; + for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) { if (mySelectors[i]->getType() != theType) continue; aSelector = mySelectors[i]; @@ -67,9 +70,9 @@ XGUI_ActiveControlSelector* XGUI_ActiveControlMgr::getSelector(const QString& th } //******************************************************************** -void XGUI_ActiveControlMgr::onSelectorActivated() -{ - XGUI_ActiveControlSelector* aSelector = qobject_cast(sender()); +void XGUI_ActiveControlMgr::onSelectorActivated() { + XGUI_ActiveControlSelector *aSelector = + qobject_cast(sender()); if (!aSelector || aSelector == myActiveSelector) return; @@ -81,7 +84,9 @@ void XGUI_ActiveControlMgr::onSelectorActivated() } activateSelector(aSelector); XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionModes(); - XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionFilters(); + XGUI_Tools::workshop(myWorkshop) + ->selectionActivate() + ->updateSelectionFilters(); #ifdef DEBUG_ACTIVE_SELECTOR debugInfo("onSelectorActivated", myActiveSelector); @@ -90,15 +95,15 @@ void XGUI_ActiveControlMgr::onSelectorActivated() } //******************************************************************** -void XGUI_ActiveControlMgr::onSelectorDeactivated() -{ - XGUI_ActiveControlSelector* aSelector = qobject_cast(sender()); +void XGUI_ActiveControlMgr::onSelectorDeactivated() { + XGUI_ActiveControlSelector *aSelector = + qobject_cast(sender()); deactivateSelector(aSelector); } //******************************************************************** -void XGUI_ActiveControlMgr::deactivateSelector(XGUI_ActiveControlSelector* theSelector) -{ +void XGUI_ActiveControlMgr::deactivateSelector( + XGUI_ActiveControlSelector *theSelector) { if (!theSelector || theSelector != myActiveSelector || !myActiveSelector) return; @@ -109,7 +114,7 @@ void XGUI_ActiveControlMgr::deactivateSelector(XGUI_ActiveControlSelector* theSe myActiveSelector->setActive(false); activateSelector(NULL); - XGUI_ActiveControlSelector* aSelectorToBeActivated = 0; + XGUI_ActiveControlSelector *aSelectorToBeActivated = 0; for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) { if (!mySelectors[i]->needToBeActivated()) continue; @@ -120,7 +125,9 @@ void XGUI_ActiveControlMgr::deactivateSelector(XGUI_ActiveControlSelector* theSe activateSelector(aSelectorToBeActivated); XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionModes(); - XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionFilters(); + XGUI_Tools::workshop(myWorkshop) + ->selectionActivate() + ->updateSelectionFilters(); #ifdef DEBUG_ACTIVE_SELECTOR debugInfo("onSelectorDeactivated", myActiveSelector); #endif @@ -128,8 +135,7 @@ void XGUI_ActiveControlMgr::deactivateSelector(XGUI_ActiveControlSelector* theSe } //******************************************************************** -void XGUI_ActiveControlMgr::onSelectionChanged() -{ +void XGUI_ActiveControlMgr::onSelectionChanged() { if (!myActiveSelector) return; @@ -140,8 +146,8 @@ void XGUI_ActiveControlMgr::onSelectionChanged() } //******************************************************************** -void XGUI_ActiveControlMgr::activateSelector(XGUI_ActiveControlSelector* theSelector) -{ +void XGUI_ActiveControlMgr::activateSelector( + XGUI_ActiveControlSelector *theSelector) { myActiveSelector = theSelector; if (myActiveSelector) myActiveSelector->setActive(true); diff --git a/src/XGUI/XGUI_ActiveControlMgr.h b/src/XGUI/XGUI_ActiveControlMgr.h index 656e7413d..511bdfb23 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.h +++ b/src/XGUI/XGUI_ActiveControlMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ActiveControlMgr_H @@ -25,38 +26,38 @@ #include #include - class XGUI_ActiveControlSelector; class ModuleBase_IWorkshop; /** -* Interface of providing only one active control for workshop. -* It has container of selectors, where only one might be active at the moment. -* Selection in 3D view is processed by the active selector. -*/ -class XGUI_ActiveControlMgr : public QObject -{ + * Interface of providing only one active control for workshop. + * It has container of selectors, where only one might be active at the moment. + * Selection in 3D view is processed by the active selector. + */ +class XGUI_ActiveControlMgr : public QObject { Q_OBJECT public: /// Constructor /// \param theWorkshop the current workshop instance - XGUI_EXPORT XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop); + XGUI_EXPORT XGUI_ActiveControlMgr(ModuleBase_IWorkshop *theWorkshop); - XGUI_EXPORT virtual ~XGUI_ActiveControlMgr() {}; + XGUI_EXPORT virtual ~XGUI_ActiveControlMgr(){}; /// Register selector to process activation of control - void addSelector(XGUI_ActiveControlSelector* theSelector); + void addSelector(XGUI_ActiveControlSelector *theSelector); /// Returns selector by type name /// \param theType a selector type /// \return selector instance - XGUI_EXPORT XGUI_ActiveControlSelector* getSelector(const QString& theType); + XGUI_EXPORT XGUI_ActiveControlSelector *getSelector(const QString &theType); /// Returns the active selector /// \return selector instance - XGUI_ActiveControlSelector* activeSelector() const { return myActiveSelector; } + XGUI_ActiveControlSelector *activeSelector() const { + return myActiveSelector; + } - void deactivateSelector(XGUI_ActiveControlSelector* theSelector); + void deactivateSelector(XGUI_ActiveControlSelector *theSelector); protected slots: /// Deactivates active selector and set the sender selector as active @@ -67,13 +68,13 @@ protected slots: void onSelectionChanged(); protected: - void activateSelector(XGUI_ActiveControlSelector* theSelector); + void activateSelector(XGUI_ActiveControlSelector *theSelector); protected: - ModuleBase_IWorkshop* myWorkshop; ///< the current workshop + ModuleBase_IWorkshop *myWorkshop; ///< the current workshop - QList mySelectors; ///< workshop selectors - XGUI_ActiveControlSelector* myActiveSelector; ///< active selector + QList mySelectors; ///< workshop selectors + XGUI_ActiveControlSelector *myActiveSelector; ///< active selector bool myIsBlocked; ///< blocking flag to avoid cycling signals processing }; diff --git a/src/XGUI/XGUI_ActiveControlSelector.h b/src/XGUI/XGUI_ActiveControlSelector.h index 41ba4b783..043040f0e 100644 --- a/src/XGUI/XGUI_ActiveControlSelector.h +++ b/src/XGUI/XGUI_ActiveControlSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ActiveControlSelector_H @@ -25,19 +26,19 @@ #include /** -* Interface to have an active control and process selection by the control. -* Activation of control may set selection modes and selection filters of the control. -*/ -class XGUI_ActiveControlSelector : public QObject -{ + * Interface to have an active control and process selection by the control. + * Activation of control may set selection modes and selection filters of the + * control. + */ +class XGUI_ActiveControlSelector : public QObject { Q_OBJECT public: /// Constructor /// \param theWorkshop the current workshop instance - XGUI_EXPORT XGUI_ActiveControlSelector() {}; + XGUI_EXPORT XGUI_ActiveControlSelector(){}; /// Destructor - XGUI_EXPORT virtual ~XGUI_ActiveControlSelector() {}; + XGUI_EXPORT virtual ~XGUI_ActiveControlSelector(){}; /// Returns name of the selector XGUI_EXPORT virtual QString getType() = 0; @@ -45,23 +46,26 @@ public: /// Clear need to be activated widget if it exists XGUI_EXPORT virtual void reset() {} - /// Sets enable/disable state of the selector. If disable, it will not react to selection - /// \param theEnabled if true, selector is enabled - XGUI_EXPORT void setEnable(const bool& theEnabled) { myIsEnabled = theEnabled; } + /// Sets enable/disable state of the selector. If disable, it will not react + /// to selection \param theEnabled if true, selector is enabled + XGUI_EXPORT void setEnable(const bool &theEnabled) { + myIsEnabled = theEnabled; + } /// Returns whether the selector is enabled or not /// \return boolean result XGUI_EXPORT bool isEnabled() const { return myIsEnabled; } - /// Sets control active. It should activates/deactivates selection and selection filters. - /// \param isActive if true, the control becomes active - XGUI_EXPORT virtual void setActive(const bool& isActive) = 0; + /// Sets control active. It should activates/deactivates selection and + /// selection filters. \param isActive if true, the control becomes active + XGUI_EXPORT virtual void setActive(const bool &isActive) = 0; - /// Returns whether the selector should be activated as soon as possible (by deactivatate other) - /// \return boolean result + /// Returns whether the selector should be activated as soon as possible (by + /// deactivatate other) \return boolean result XGUI_EXPORT virtual bool needToBeActivated() const { return false; } - /// Processes current selection of workshop. Reaction to selection change in workshop. + /// Processes current selection of workshop. Reaction to selection change in + /// workshop. XGUI_EXPORT virtual void processSelection() = 0; signals: diff --git a/src/XGUI/XGUI_ColorDialog.cpp b/src/XGUI/XGUI_ColorDialog.cpp index 39cd67e75..6bae2c4cc 100644 --- a/src/XGUI/XGUI_ColorDialog.cpp +++ b/src/XGUI/XGUI_ColorDialog.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,61 +24,58 @@ #include -#include +#include #include -#include -#include #include +#include +#include #include -#include +#include -namespace -{ - class RadioButton: public QRadioButton - { - QWidget* myBuddy; - public: - RadioButton(const QString& text, QWidget* buddy = nullptr, QWidget* parent = nullptr): - QRadioButton(text, parent), myBuddy(buddy) - { - if (buddy != nullptr) - { - buddy->setEnabled(isEnabled()); - buddy->installEventFilter(this); - } - } - RadioButton(QWidget* buddy = nullptr, QWidget* parent = nullptr): - RadioButton(QString(), buddy, parent) {} - - bool eventFilter(QObject* sender, QEvent* event) - { - if (myBuddy != nullptr && sender == myBuddy && event->type() == QEvent::MouseButtonPress) - setChecked(true); - return QRadioButton::eventFilter(sender, event); +namespace { +class RadioButton : public QRadioButton { + QWidget *myBuddy; + +public: + RadioButton(const QString &text, QWidget *buddy = nullptr, + QWidget *parent = nullptr) + : QRadioButton(text, parent), myBuddy(buddy) { + if (buddy != nullptr) { + buddy->setEnabled(isEnabled()); + buddy->installEventFilter(this); } + } + RadioButton(QWidget *buddy = nullptr, QWidget *parent = nullptr) + : RadioButton(QString(), buddy, parent) {} + + bool eventFilter(QObject *sender, QEvent *event) { + if (myBuddy != nullptr && sender == myBuddy && + event->type() == QEvent::MouseButtonPress) + setChecked(true); + return QRadioButton::eventFilter(sender, event); + } - void changeEvent(QEvent* event) - { - if (myBuddy != nullptr && event->type() == QEvent::EnabledChange) - myBuddy->setEnabled(isEnabled()); - QRadioButton::changeEvent(event); - } - }; -} + void changeEvent(QEvent *event) { + if (myBuddy != nullptr && event->type() == QEvent::EnabledChange) + myBuddy->setEnabled(isEnabled()); + QRadioButton::changeEvent(event); + } +}; +} // namespace -XGUI_ColorDialog::XGUI_ColorDialog(QWidget* theParent) - : QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) -{ +XGUI_ColorDialog::XGUI_ColorDialog(QWidget *theParent) + : QDialog(theParent, + Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) { setWindowTitle(tr("Color")); - QGridLayout* aLay = new QGridLayout(this); + QGridLayout *aLay = new QGridLayout(this); myColorButton = new QtxColorButton(this); myColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QLabel* aRandomLabel = new QLabel(tr("Random"), this); + QLabel *aRandomLabel = new QLabel(tr("Random"), this); - QRadioButton* aColorChoiceBtn = new RadioButton(myColorButton, this); - QRadioButton* aRandomChoiceBtn = new RadioButton(aRandomLabel, this); + QRadioButton *aColorChoiceBtn = new RadioButton(myColorButton, this); + QRadioButton *aRandomChoiceBtn = new RadioButton(aRandomLabel, this); aColorChoiceBtn->setChecked(true); myButtonGroup = new QButtonGroup(this); myButtonGroup->setExclusive(true); @@ -89,28 +87,25 @@ XGUI_ColorDialog::XGUI_ColorDialog(QWidget* theParent) aLay->addWidget(aRandomChoiceBtn, 1, 0); aLay->addWidget(aRandomLabel, 1, 1); - QDialogButtonBox* aButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, - Qt::Horizontal, this); + QDialogButtonBox *aButtons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(aButtons, SIGNAL(accepted()), this, SLOT(accept())); connect(aButtons, SIGNAL(rejected()), this, SLOT(reject())); aLay->addWidget(aButtons, 2, 0, 1, 2); } -bool XGUI_ColorDialog::isRandomColor() const -{ +bool XGUI_ColorDialog::isRandomColor() const { return myButtonGroup->checkedId() == 1; } -void XGUI_ColorDialog::setColor(const std::vector& theValue) -{ +void XGUI_ColorDialog::setColor(const std::vector &theValue) { if (theValue.size() != 3) return; myColorButton->setColor(QColor(theValue[0], theValue[1], theValue[2])); } -std::vector XGUI_ColorDialog::getColor() const -{ +std::vector XGUI_ColorDialog::getColor() const { QColor aColorResult = myColorButton->color(); std::vector aValues; @@ -121,12 +116,10 @@ std::vector XGUI_ColorDialog::getColor() const return aValues; } -std::vector XGUI_ColorDialog::getRandomColor() const -{ +std::vector XGUI_ColorDialog::getRandomColor() const { std::vector aValues; if (isRandomColor()) { ModelAPI_Tools::findRandomColor(aValues); } return aValues; } - diff --git a/src/XGUI/XGUI_ColorDialog.h b/src/XGUI/XGUI_ColorDialog.h index 9103cc6e1..f0ecf4d70 100644 --- a/src/XGUI/XGUI_ColorDialog.h +++ b/src/XGUI/XGUI_ColorDialog.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ColorDialog_H @@ -28,28 +29,27 @@ class QButtonGroup; class QtxColorButton; /** -* \ingroup GUI -* A class of dialog to chose a color. The color can be set in two ways: use a random value or -* a certain color. There is a radio button to provide this choice. The color button is -* visualized to select a certain color. -*/ -class XGUI_ColorDialog : public QDialog -{ + * \ingroup GUI + * A class of dialog to chose a color. The color can be set in two ways: use a + * random value or a certain color. There is a radio button to provide this + * choice. The color button is visualized to select a certain color. + */ +class XGUI_ColorDialog : public QDialog { Q_OBJECT public: /// Constructor /// \param theParent a parent widget for the dialog - XGUI_EXPORT XGUI_ColorDialog(QWidget* theParent); + XGUI_EXPORT XGUI_ColorDialog(QWidget *theParent); - XGUI_EXPORT virtual ~XGUI_ColorDialog() {}; + XGUI_EXPORT virtual ~XGUI_ColorDialog(){}; /// Returns whether the random state of color is chosen /// \return a boolean value bool isRandomColor() const; - /// Initializes the dialog with the given value. Set choice on certain value and fill it by. - /// \param theValue an RGB components value - void setColor(const std::vector& theValue); + /// Initializes the dialog with the given value. Set choice on certain value + /// and fill it by. \param theValue an RGB components value + void setColor(const std::vector &theValue); /// Returns a container with the current color value. /// These are tree int values for RGB definition. @@ -65,8 +65,9 @@ public: std::vector getRandomColor() const; private: - QButtonGroup* myButtonGroup; /// a group, contained random and certain color radio button choice - QtxColorButton* myColorButton; /// a control to select a color + QButtonGroup *myButtonGroup; /// a group, contained random and certain color + /// radio button choice + QtxColorButton *myColorButton; /// a control to select a color }; #endif diff --git a/src/XGUI/XGUI_CompressFiles.cpp b/src/XGUI/XGUI_CompressFiles.cpp index 717e20291..cd5bbd99f 100644 --- a/src/XGUI/XGUI_CompressFiles.cpp +++ b/src/XGUI/XGUI_CompressFiles.cpp @@ -14,21 +14,19 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_CompressFiles.h" +#include +#include #include #include -#include -#include - - - -bool XGUI_CompressFiles::compress(const QString& theFile, std::list theFiles) -{ +bool XGUI_CompressFiles::compress(const QString &theFile, + std::list theFiles) { QFile aOutFile(theFile); if (aOutFile.open(QIODevice::WriteOnly)) { QDataStream aOutStream(&aOutFile); @@ -40,28 +38,25 @@ bool XGUI_CompressFiles::compress(const QString& theFile, std::list QFileInfo aInfo(aSrcFile); quint64 aSize = aInfo.size(); if (aSrcFile.open(QIODevice::ReadOnly)) { - QString aName = - aPathName.right(aPathName.length() - aPathName.lastIndexOf(QDir::separator()) - 1); + QString aName = aPathName.right( + aPathName.length() - aPathName.lastIndexOf(QDir::separator()) - 1); aOutStream << aName << aSize << qCompress(aSrcFile.readAll()); aSrcFile.close(); - } - else { + } else { aOutFile.close(); return false; } } aOutFile.close(); - } - else + } else return false; return true; } - -bool XGUI_CompressFiles::uncompress(const QString& theFile, const QString& theDir) -{ +bool XGUI_CompressFiles::uncompress(const QString &theFile, + const QString &theDir) { QFile aInFile(theFile); QDir aDir(theDir); if (!aDir.exists()) @@ -92,4 +87,4 @@ bool XGUI_CompressFiles::uncompress(const QString& theFile, const QString& theDi aInFile.close(); } return true; -} \ No newline at end of file +} diff --git a/src/XGUI/XGUI_CompressFiles.h b/src/XGUI/XGUI_CompressFiles.h index 724a7e060..5dfc55867 100644 --- a/src/XGUI/XGUI_CompressFiles.h +++ b/src/XGUI/XGUI_CompressFiles.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_CompressFiles_H @@ -27,23 +28,20 @@ #include /** -* \ingroup GUI -* The class implements static methods for compressing/uncompressing files -*/ -class XGUI_CompressFiles -{ + * \ingroup GUI + * The class implements static methods for compressing/uncompressing files + */ +class XGUI_CompressFiles { public: - /// Compress list of file to an archive /// \param theFile a name of compressed output file /// \param theFiles a list of input files to compress - static bool compress(const QString& theFile, std::list theFiles); + static bool compress(const QString &theFile, std::list theFiles); /// Uncompress files /// \param theFile a compressed file /// \param theDir an output directory for uncompressed files - static bool uncompress(const QString& theFile, const QString& theDir); - + static bool uncompress(const QString &theFile, const QString &theDir); }; -#endif \ No newline at end of file +#endif diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 9550326bd..185a54e23 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -14,22 +14,23 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_ContextMenuMgr.h" -#include "XGUI_Workshop.h" -#include "XGUI_ObjectsBrowser.h" -#include "XGUI_SelectionMgr.h" +#include "XGUI_ActionsMgr.h" +#include "XGUI_DataModel.h" #include "XGUI_Displayer.h" -#include "XGUI_ViewerProxy.h" +#include "XGUI_ObjectsBrowser.h" +#include "XGUI_OperationMgr.h" #include "XGUI_SalomeConnector.h" #include "XGUI_Selection.h" #include "XGUI_SelectionActivate.h" -#include "XGUI_DataModel.h" -#include "XGUI_OperationMgr.h" +#include "XGUI_SelectionMgr.h" #include "XGUI_Tools.h" -#include "XGUI_ActionsMgr.h" +#include "XGUI_ViewerProxy.h" +#include "XGUI_Workshop.h" #ifndef HAVE_SALOME #include @@ -37,140 +38,139 @@ //#include "PartSetPlugin_Part.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 #ifdef WIN32 #pragma warning(disable : 4456) // for nested foreach #endif -XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent) - : QObject(theParent), - myWorkshop(theParent), - mySeparator1(0), mySeparator2(0), mySeparator3(0) -{ -} +XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop *theParent) + : QObject(theParent), myWorkshop(theParent), mySeparator1(0), + mySeparator2(0), mySeparator3(0) {} -XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr() -{ -} +XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr() {} -void XGUI_ContextMenuMgr::createActions() -{ +void XGUI_ContextMenuMgr::createActions() { #ifdef HAVE_SALOME - QMainWindow* aDesktop = myWorkshop->salomeConnector()->desktop(); + QMainWindow *aDesktop = myWorkshop->salomeConnector()->desktop(); #else - QMainWindow* aDesktop = myWorkshop->mainWindow(); + QMainWindow *aDesktop = myWorkshop->mainWindow(); #endif - QAction* anAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"), - aDesktop); + QAction *anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/delete.png"), tr("Delete"), aDesktop); aDesktop->addAction(anAction); addAction("DELETE_CMD", anAction); anAction->setShortcutContext(Qt::ApplicationShortcut); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), - aDesktop, this, SLOT(onRename())); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/rename_edit.png"), + tr("Rename"), aDesktop, this, + SLOT(onRename())); anAction->setShortcut(Qt::Key_F2); addAction("RENAME_CMD", anAction); #ifdef HAVE_SALOME - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/move_to_end.png"), - XGUI_Workshop::MOVE_TO_END_COMMAND, this); + anAction = + ModuleBase_Tools::createAction(QIcon(":pictures/move_to_end.png"), + XGUI_Workshop::MOVE_TO_END_COMMAND, this); addAction("MOVE_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/move_to_end_split.png"), - XGUI_Workshop::MOVE_TO_END_SPLIT_COMMAND, this); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/move_to_end_split.png"), + XGUI_Workshop::MOVE_TO_END_SPLIT_COMMAND, this); addAction("MOVE_SPLIT_CMD", anAction); #endif anAction = ModuleBase_Tools::createAction(QIcon(":pictures/recover.png"), - tr("Recover"), this); + tr("Recover"), this); addAction("RECOVER_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/clean_history.png"), - tr("Clean history"), aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/clean_history.png"), tr("Clean history"), aDesktop); addAction("CLEAN_HISTORY_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/color.png"), tr("Color..."), aDesktop); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/color.png"), + tr("Color..."), aDesktop); addAction("COLOR_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/autocolor.png"), - tr("Auto color"), aDesktop); + tr("Auto color"), aDesktop); addAction("AUTOCOLOR_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(""), tr("Deflection..."), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(""), tr("Deflection..."), aDesktop); addAction("DEFLECTION_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/transparency.png"), - tr("Transparency..."), aDesktop); + tr("Transparency..."), aDesktop); addAction("TRANSPARENCY_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil.png"), - tr("Show"), aDesktop); + tr("Show"), aDesktop); addAction("SHOW_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil.png"), tr("Show only"), aDesktop); addAction("SHOW_ONLY_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), - aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), aDesktop); addAction("HIDE_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil_closed.png"), - tr("Hide all"), aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/eye_pencil_closed.png"), tr("Hide all"), aDesktop); addAction("HIDEALL_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/shading.png"), tr("Shading"), aDesktop); addAction("SHADING_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/wireframe.png"), tr("Wireframe"), - aDesktop); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/wireframe.png"), + tr("Wireframe"), aDesktop); addAction("WIREFRAME_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/edges_dir.png"), tr("Show edges direction"), - aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/edges_dir.png"), tr("Show edges direction"), aDesktop); anAction->setCheckable(true); addAction("SHOW_EDGES_DIRECTION_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/iso_lines.png"), tr("Define Isos..."), - aDesktop); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/iso_lines.png"), + tr("Define Isos..."), aDesktop); addAction("ISOLINES_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(), tr("Show Isos"), aDesktop); anAction->setCheckable(true); addAction("SHOW_ISOLINES_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(), tr("Bring To Front"), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(), tr("Bring To Front"), aDesktop); anAction->setCheckable(true); addAction("BRING_TO_FRONT_CMD", anAction); @@ -186,76 +186,88 @@ void XGUI_ContextMenuMgr::createActions() mySeparator4 = ModuleBase_Tools::createAction(QIcon(), "", aDesktop); mySeparator4->setSeparator(true); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/vertex.png"), tr("Vertices"), aDesktop, - this, SLOT(onShapeSelection(bool))); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/vertex.png"), + tr("Vertices"), aDesktop, this, + SLOT(onShapeSelection(bool))); anAction->setCheckable(true); addAction("SELECT_VERTEX_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/edge.png"), tr("Edges"), aDesktop, - this, SLOT(onShapeSelection(bool))); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/edge.png"), + tr("Edges"), aDesktop, this, + SLOT(onShapeSelection(bool))); anAction->setCheckable(true); addAction("SELECT_EDGE_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/face.png"), tr("Faces"), aDesktop, - this, SLOT(onShapeSelection(bool))); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/face.png"), + tr("Faces"), aDesktop, this, + SLOT(onShapeSelection(bool))); anAction->setCheckable(true); addAction("SELECT_FACE_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/result.png"), tr("Results"), aDesktop, - this, SLOT(onResultSelection(bool))); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/result.png"), + tr("Results"), aDesktop, this, + SLOT(onResultSelection(bool))); anAction->setCheckable(true); addAction("SELECT_RESULT_CMD", anAction); anAction->setChecked(true); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/find_result.png"), - tr("Select results"), aDesktop); + tr("Select results"), aDesktop); addAction("SHOW_RESULTS_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/find_result.png"), - tr("Select parent feature"), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(":pictures/find_result.png"), + tr("Select parent feature"), aDesktop); addAction("SHOW_FEATURE_CMD", anAction); #ifdef TINSPECTOR - anAction = ModuleBase_Tools::createAction(QIcon(), tr("TInspector"), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(), tr("TInspector"), aDesktop); addAction("TINSPECTOR_VIEW", anAction); #endif // Features folders actions - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/create_folder.png"), - tr("Insert a folder before"), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(":pictures/create_folder.png"), + tr("Insert a folder before"), aDesktop); addAction("INSERT_FOLDER_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/insert_folder_before.png"), - tr("Move into the previous folder"), aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/insert_folder_before.png"), + tr("Move into the previous folder"), aDesktop); addAction("ADD_TO_FOLDER_BEFORE_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/insert_folder_after.png"), - tr("Move into the next folder"), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(":pictures/insert_folder_after.png"), + tr("Move into the next folder"), aDesktop); addAction("ADD_TO_FOLDER_AFTER_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/move_out_before.png"), - tr("Move out before the folder"), aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/move_out_before.png"), tr("Move out before the folder"), + aDesktop); addAction("ADD_OUT_FOLDER_BEFORE_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/move_out_after.png"), - tr("Move out after the folder"), aDesktop); + anAction = + ModuleBase_Tools::createAction(QIcon(":pictures/move_out_after.png"), + tr("Move out after the folder"), aDesktop); addAction("ADD_OUT_FOLDER_AFTER_CMD", anAction); - anAction = ModuleBase_Tools::createAction(QIcon(":pictures/normal-view-inversed.png"), - tr("Set view by inverted normal to face"), aDesktop); + anAction = ModuleBase_Tools::createAction( + QIcon(":pictures/normal-view-inversed.png"), + tr("Set view by inverted normal to face"), aDesktop); addAction("SET_VIEW_INVERTEDNORMAL_CMD", anAction); anAction = ModuleBase_Tools::createAction(QIcon(":pictures/normal-view.png"), - tr("Set view by normal to face"), aDesktop); + tr("Set view by normal to face"), + aDesktop); addAction("SET_VIEW_NORMAL_CMD", anAction); buildObjBrowserMenu(); buildViewerMenu(); } -void XGUI_ContextMenuMgr::addAction(const QString& theId, QAction* theAction) -{ +void XGUI_ContextMenuMgr::addAction(const QString &theId, QAction *theAction) { if (myActions.contains(theId)) qCritical("A command with Id = '%s' already defined!", qPrintable(theId)); theAction->setData(theId); @@ -263,16 +275,14 @@ void XGUI_ContextMenuMgr::addAction(const QString& theId, QAction* theAction) myActions[theId] = theAction; } -QAction* XGUI_ContextMenuMgr::action(const QString& theId) const -{ +QAction *XGUI_ContextMenuMgr::action(const QString &theId) const { if (myActions.contains(theId)) return myActions[theId]; return 0; } -QAction* XGUI_ContextMenuMgr::actionByName(const QString& theName) const -{ - foreach(QAction* eachAction, myActions) { +QAction *XGUI_ContextMenuMgr::actionByName(const QString &theName) const { + foreach (QAction *eachAction, myActions) { if (eachAction->text() == theName) { return eachAction; } @@ -280,24 +290,17 @@ QAction* XGUI_ContextMenuMgr::actionByName(const QString& theName) const return NULL; } -QStringList XGUI_ContextMenuMgr::actionIds() const -{ - return myActions.keys(); -} +QStringList XGUI_ContextMenuMgr::actionIds() const { return myActions.keys(); } -void XGUI_ContextMenuMgr::onAction(bool isChecked) -{ - QAction* anAction = static_cast(sender()); +void XGUI_ContextMenuMgr::onAction(bool isChecked) { + QAction *anAction = static_cast(sender()); emit actionTriggered(anAction->data().toString(), isChecked); } -void XGUI_ContextMenuMgr::updateCommandsStatus() -{ -} +void XGUI_ContextMenuMgr::updateCommandsStatus() {} -void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent* theEvent) -{ - QMenu* aMenu = new QMenu(); +void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent *theEvent) { + QMenu *aMenu = new QMenu(); if (sender() == myWorkshop->objectBrowser()) { updateObjectBrowserMenu(); addObjBrowserMenu(aMenu); @@ -307,9 +310,9 @@ void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent* theEvent) } if (aMenu && (aMenu->actions().size() > 0)) { - // it is possible that some objects should do something before and after the popup menu exec - // e.g. a sketch manager changes an internal flag on this signals in order to do not hide - // a created entity + // it is possible that some objects should do something before and after the + // popup menu exec e.g. a sketch manager changes an internal flag on this + // signals in order to do not hide a created entity emit beforeContextMenu(); aMenu->exec(theEvent->globalPos()); emit afterContextMenu(); @@ -317,17 +320,16 @@ void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent* theEvent) } } -void XGUI_ContextMenuMgr::updateObjectBrowserMenu() -{ - foreach(QAction* anAction, myActions) +void XGUI_ContextMenuMgr::updateObjectBrowserMenu() { + foreach (QAction *anAction, myActions) anAction->setEnabled(false); - XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); + XGUI_SelectionMgr *aSelMgr = myWorkshop->selector(); QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects(); int aSelected = aObjects.size(); if (aSelected > 0) { SessionPtr aMgr = ModelAPI_Session::get(); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); bool hasResult = false; bool hasFeature = false; bool hasParameter = false; @@ -335,9 +337,10 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() bool hasResultInHistory = false; bool hasFolder = false; bool hasGroupsOnly = false; - ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, - hasCompositeOwner, hasResultInHistory, hasFolder, hasGroupsOnly); - //Process Feature + ModuleBase_Tools::checkObjects( + aObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner, + hasResultInHistory, hasFolder, hasGroupsOnly); + // Process Feature if (aSelected == 1) { // single selection ObjectPtr aObject = aObjects.first(); ResultPtr aResult; @@ -347,20 +350,25 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() if (hasResult && myWorkshop->canBeShaded(aObject)) { XGUI_Displayer::DisplayMode aMode = aDisplayer->displayMode(aObject); if (aMode != XGUI_Displayer::NoMode) { - action("WIREFRAME_CMD")->setEnabled(aMode == XGUI_Displayer::Shading); - action("SHADING_CMD")->setEnabled(aMode == XGUI_Displayer::Wireframe); + action("WIREFRAME_CMD") + ->setEnabled(aMode == XGUI_Displayer::Shading); + action("SHADING_CMD") + ->setEnabled(aMode == XGUI_Displayer::Wireframe); } else { action("WIREFRAME_CMD")->setEnabled(true); action("SHADING_CMD")->setEnabled(true); } action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true); - action("SHOW_EDGES_DIRECTION_CMD")->setChecked(ModelAPI_Tools::isShowEdgesDirection(aResult)); + action("SHOW_EDGES_DIRECTION_CMD") + ->setChecked(ModelAPI_Tools::isShowEdgesDirection(aResult)); action("BRING_TO_FRONT_CMD")->setEnabled(hasGroupsOnly); - action("BRING_TO_FRONT_CMD")->setChecked(ModelAPI_Tools::isBringToFront(aResult)); + action("BRING_TO_FRONT_CMD") + ->setChecked(ModelAPI_Tools::isBringToFront(aResult)); action("SHOW_ISOLINES_CMD")->setEnabled(true); - action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult)); + action("SHOW_ISOLINES_CMD") + ->setChecked(ModelAPI_Tools::isShownIsoLines(aResult)); action("ISOLINES_CMD")->setEnabled(true); } if (!hasFeature) { @@ -368,8 +376,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() if (aHasSubResults) { action("HIDE_CMD")->setEnabled(true); action("SHOW_CMD")->setEnabled(true); - } - else { + } else { if (aObject->isDisplayed()) { action("HIDE_CMD")->setEnabled(true); } else if (hasResult && (!hasParameter)) { @@ -386,29 +393,30 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() } #endif if (hasFeature && aObject->document() != aMgr->moduleDocument() && - aObject->document() == aMgr->activeDocument()) - { - XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); + aObject->document() == aMgr->activeDocument()) { + XGUI_OperationMgr *anOperationMgr = myWorkshop->operationMgr(); if (!anOperationMgr->hasOperation()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(aObject); - std::list > aResults; + FeaturePtr aFeature = + std::dynamic_pointer_cast(aObject); + std::list> aResults; ModelAPI_Tools::getConcealedResults(aFeature, aResults); - if (!aResults.empty()) // check the feature conceals at least one result + if (!aResults + .empty()) // check the feature conceals at least one result action("RECOVER_CMD")->setEnabled(true); } } - if( aMgr->activeDocument() == aObject->document() ) - { + if (aMgr->activeDocument() == aObject->document()) { action("RENAME_CMD")->setEnabled(true); action("DELETE_CMD")->setEnabled(!hasCompositeOwner); - action("CLEAN_HISTORY_CMD")->setEnabled(!hasCompositeOwner && - (hasFeature || hasParameter)); + action("CLEAN_HISTORY_CMD") + ->setEnabled(!hasCompositeOwner && (hasFeature || hasParameter)); } } // end single selection } else { // multi-selection - // parameter is commented because the actions are not in the list of result parameter actions + // parameter is commented because the actions are not in the list of + // result parameter actions if (hasResult /*&& (!hasParameter)*/) { action("SHOW_CMD")->setEnabled(true); action("HIDE_CMD")->setEnabled(true); @@ -428,7 +436,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() // Check folder management commands state if only features are selected if ((!hasResult) && hasFeature && (!hasParameter) && (!hasCompositeOwner) && - (!hasResultInHistory) && (!hasFolder)) { + (!hasResultInHistory) && (!hasFolder)) { std::list aFeatures = aSelMgr->getSelectedFeatures(); if (aFeatures.size() > 0) { // Check that features do not include Parts QModelIndexList aIndexes = aSelMgr->selection()->selectedIndexes(); @@ -438,7 +446,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() // if all selected are from the same level bool isSameParent = true; - foreach(QModelIndex aIdx, aIndexes) { + foreach (QModelIndex aIdx, aIndexes) { if (aIdx.parent() != aParentIdx) { isSameParent = false; break; @@ -446,13 +454,13 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() } if (isSameParent) { // Check is selection continuous - XGUI_DataModel* aModel = myWorkshop->objectBrowser()->dataModel(); + XGUI_DataModel *aModel = myWorkshop->objectBrowser()->dataModel(); DocumentPtr aDoc = aMgr->activeDocument(); bool isContinuos = true; if (aSelected > 1) { int aId = -1; - foreach(FeaturePtr aF, aFeatures) { + foreach (FeaturePtr aF, aFeatures) { if (aId == -1) aId = aDoc->index(aF); else { @@ -479,53 +487,61 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() aNextObj = aModel->object(aNextIdx); } - bool isPrevFolder = (aPrevObj.get() && - (aPrevObj->groupName() == ModelAPI_Folder::group())); - bool isNextFolder = (aNextObj.get() && - (aNextObj->groupName() == ModelAPI_Folder::group())); - bool isInFolder = (aDataObj.get() && - (aDataObj->groupName() == ModelAPI_Folder::group())); + bool isPrevFolder = (aPrevObj.get() && (aPrevObj->groupName() == + ModelAPI_Folder::group())); + bool isNextFolder = (aNextObj.get() && (aNextObj->groupName() == + ModelAPI_Folder::group())); + bool isInFolder = (aDataObj.get() && (aDataObj->groupName() == + ModelAPI_Folder::group())); bool isOutsideFolder = !isInFolder; bool hasFirst = false; bool hasLast = false; if (isInFolder) { - FolderPtr aFolder = std::dynamic_pointer_cast(aDataObj); + FolderPtr aFolder = + std::dynamic_pointer_cast(aDataObj); FeaturePtr aFirstFeatureInFolder; - AttributeReferencePtr aFirstFeatAttr = - aFolder->data()->reference(ModelAPI_Folder::FIRST_FEATURE_ID()); + AttributeReferencePtr aFirstFeatAttr = aFolder->data()->reference( + ModelAPI_Folder::FIRST_FEATURE_ID()); if (aFirstFeatAttr) - aFirstFeatureInFolder = ModelAPI_Feature::feature(aFirstFeatAttr->value()); + aFirstFeatureInFolder = + ModelAPI_Feature::feature(aFirstFeatAttr->value()); hasFirst = (aFirstFeatureInFolder == aFeatures.front()); FeaturePtr aLastFeatureInFolder; - AttributeReferencePtr aLastFeatAttr = - aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID()); + AttributeReferencePtr aLastFeatAttr = aFolder->data()->reference( + ModelAPI_Folder::LAST_FEATURE_ID()); if (aLastFeatAttr) - aLastFeatureInFolder = ModelAPI_Feature::feature(aLastFeatAttr->value()); + aLastFeatureInFolder = + ModelAPI_Feature::feature(aLastFeatAttr->value()); hasLast = (aLastFeatureInFolder == aFeatures.back()); } action("INSERT_FOLDER_CMD")->setEnabled(isOutsideFolder); - action("ADD_TO_FOLDER_BEFORE_CMD")->setEnabled(isOutsideFolder && isPrevFolder); - action("ADD_TO_FOLDER_AFTER_CMD")->setEnabled(isOutsideFolder && isNextFolder); - action("ADD_OUT_FOLDER_BEFORE_CMD")->setEnabled(isInFolder && hasFirst); - action("ADD_OUT_FOLDER_AFTER_CMD")->setEnabled(isInFolder && hasLast); + action("ADD_TO_FOLDER_BEFORE_CMD") + ->setEnabled(isOutsideFolder && isPrevFolder); + action("ADD_TO_FOLDER_AFTER_CMD") + ->setEnabled(isOutsideFolder && isNextFolder); + action("ADD_OUT_FOLDER_BEFORE_CMD") + ->setEnabled(isInFolder && hasFirst); + action("ADD_OUT_FOLDER_AFTER_CMD") + ->setEnabled(isInFolder && hasLast); } } } } // end folder management commands bool allActive = true; - foreach( ObjectPtr aObject, aObjects ) - if( aMgr->activeDocument() != aObject->document() ) { + foreach (ObjectPtr aObject, aObjects) + if (aMgr->activeDocument() != aObject->document()) { allActive = false; break; } - if (!hasCompositeOwner && allActive ) { - if (hasResult || hasFeature || hasParameter) // #2924 results can be erased + if (!hasCompositeOwner && allActive) { + if (hasResult || hasFeature || + hasParameter) // #2924 results can be erased action("DELETE_CMD")->setEnabled(true); } - if (!hasCompositeOwner && allActive && (hasFeature|| hasParameter)) + if (!hasCompositeOwner && allActive && (hasFeature || hasParameter)) action("CLEAN_HISTORY_CMD")->setEnabled(true); action("SHOW_RESULTS_CMD")->setEnabled(hasFeature); @@ -537,51 +553,53 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() foreach (ObjectPtr aObj, aObjects) { if (!aObj->document()->isActive()) { if ((aObj->document() != ModelAPI_Session::get()->moduleDocument()) || - aObj->groupName() == ModelAPI_ResultPart::group()) { + aObj->groupName() == ModelAPI_ResultPart::group()) { aDeactivate = true; break; } } } if (aDeactivate) { - // If at leas a one object can not be edited then Show/Hide has to be disabled + // If at leas a one object can not be edited then Show/Hide has to be + // disabled action("SHOW_CMD")->setEnabled(false); action("HIDE_CMD")->setEnabled(false); action("SHOW_ONLY_CMD")->setEnabled(false); } action("COLOR_CMD")->setEnabled(myWorkshop->canChangeProperty("COLOR_CMD")); - action("DEFLECTION_CMD")->setEnabled(myWorkshop->canChangeProperty("DEFLECTION_CMD")); - action("TRANSPARENCY_CMD")->setEnabled(myWorkshop->canChangeProperty("TRANSPARENCY_CMD")); - action("AUTOCOLOR_CMD")->setEnabled(myWorkshop->canChangeProperty("AUTOCOLOR_CMD")); - - #ifdef _DEBUG - #ifdef TINSPECTOR - action("TINSPECTOR_VIEW")->setEnabled(true); - #endif - #endif + action("DEFLECTION_CMD") + ->setEnabled(myWorkshop->canChangeProperty("DEFLECTION_CMD")); + action("TRANSPARENCY_CMD") + ->setEnabled(myWorkshop->canChangeProperty("TRANSPARENCY_CMD")); + action("AUTOCOLOR_CMD") + ->setEnabled(myWorkshop->canChangeProperty("AUTOCOLOR_CMD")); +#ifdef _DEBUG +#ifdef TINSPECTOR + action("TINSPECTOR_VIEW")->setEnabled(true); +#endif +#endif - ModuleBase_IModule* aModule = myWorkshop->module(); + ModuleBase_IModule *aModule = myWorkshop->module(); if (aModule) aModule->updateObjectBrowserMenu(myActions); } -void XGUI_ContextMenuMgr::updateViewerMenu() -{ - foreach(QAction* anAction, myActions) +void XGUI_ContextMenuMgr::updateViewerMenu() { + foreach (QAction *anAction, myActions) anAction->setEnabled(false); - XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_SelectionMgr *aSelMgr = myWorkshop->selector(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); QList aPrsList = - aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer); + aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer); if (aPrsList.size() > 0) { bool isVisible = false; bool canBeShaded = false; bool hasPlanar = false; ObjectPtr aObject; - foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) { + foreach (ModuleBase_ViewerPrsPtr aPrs, aPrsList) { aObject = aPrs->object(); if (!aObject.get()) continue; @@ -607,19 +625,23 @@ void XGUI_ContextMenuMgr::updateViewerMenu() action("ISOLINES_CMD")->setEnabled(true); if (aPrsList.size() == 1) { - ResultPtr aResult = std::dynamic_pointer_cast(aObject); + ResultPtr aResult = + std::dynamic_pointer_cast(aObject); if (aResult.get()) { action("SHOW_ISOLINES_CMD")->setEnabled(true); - action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult)); + action("SHOW_ISOLINES_CMD") + ->setChecked(ModelAPI_Tools::isShownIsoLines(aResult)); action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true); - action("SHOW_EDGES_DIRECTION_CMD")->setChecked( - ModelAPI_Tools::isShowEdgesDirection(aResult)); + action("SHOW_EDGES_DIRECTION_CMD") + ->setChecked(ModelAPI_Tools::isShowEdgesDirection(aResult)); // Only enable the "Bring To Front" command for Groups - ResultGroupPtr aGroup = std::dynamic_pointer_cast(aResult); + ResultGroupPtr aGroup = + std::dynamic_pointer_cast(aResult); action("BRING_TO_FRONT_CMD")->setEnabled(aGroup.get() != NULL); - action("BRING_TO_FRONT_CMD")->setChecked(ModelAPI_Tools::isBringToFront(aResult)); + action("BRING_TO_FRONT_CMD") + ->setChecked(ModelAPI_Tools::isBringToFront(aResult)); } } } @@ -631,9 +653,9 @@ void XGUI_ContextMenuMgr::updateViewerMenu() action("SET_VIEW_NORMAL_CMD")->setEnabled(hasPlanar); action("SET_VIEW_INVERTEDNORMAL_CMD")->setEnabled(hasPlanar); } - //issue #2159 Hide all incomplete behavior + // issue #2159 Hide all incomplete behavior #ifdef HAVE_SALOME - action("HIDEALL_CMD")->setEnabled(true); + action("HIDEALL_CMD")->setEnabled(true); #else if (myWorkshop->displayer()->objectsCount() > 0) action("HIDEALL_CMD")->setEnabled(true); @@ -654,7 +676,7 @@ void XGUI_ContextMenuMgr::updateViewerMenu() if (aModes.count() == 0) { action("SELECT_RESULT_CMD")->setChecked(true); } else { - foreach(int aMode, aModes) { + foreach (int aMode, aModes) { switch (aMode) { case TopAbs_VERTEX: action("SELECT_VERTEX_CMD")->setChecked(true); @@ -671,7 +693,7 @@ void XGUI_ContextMenuMgr::updateViewerMenu() } } - ModuleBase_IModule* aModule = myWorkshop->module(); + ModuleBase_IModule *aModule = myWorkshop->module(); if (aModule) aModule->updateViewerMenu(myActions); @@ -687,22 +709,21 @@ void XGUI_ContextMenuMgr::updateViewerMenu() action("DELETE_CMD")->setEnabled(true); } -void XGUI_ContextMenuMgr::connectObjectBrowser() -{ - connect(myWorkshop->objectBrowser(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, - SLOT(onContextMenuRequest(QContextMenuEvent*))); +void XGUI_ContextMenuMgr::connectObjectBrowser() { + connect(myWorkshop->objectBrowser(), + SIGNAL(contextMenuRequested(QContextMenuEvent *)), this, + SLOT(onContextMenuRequest(QContextMenuEvent *))); } -void XGUI_ContextMenuMgr::connectViewer() -{ - connect(myWorkshop->viewer(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, - SLOT(onContextMenuRequest(QContextMenuEvent*))); +void XGUI_ContextMenuMgr::connectViewer() { + connect(myWorkshop->viewer(), + SIGNAL(contextMenuRequested(QContextMenuEvent *)), this, + SLOT(onContextMenuRequest(QContextMenuEvent *))); } - -void XGUI_ContextMenuMgr::buildObjBrowserMenu() -{ - QAction* aSeparator = ModuleBase_Tools::createAction(QIcon(), "", myWorkshop->desktop()); +void XGUI_ContextMenuMgr::buildObjBrowserMenu() { + QAction *aSeparator = + ModuleBase_Tools::createAction(QIcon(), "", myWorkshop->desktop()); aSeparator->setSeparator(true); QActionsList aList; @@ -728,7 +749,8 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu() aList.append(action("WIREFRAME_CMD")); aList.append(action("SHADING_CMD")); aList.append(action("SHOW_EDGES_DIRECTION_CMD")); - aList.append(mySeparator1); // this separator is not shown as this action is added after show only + aList.append(mySeparator1); // this separator is not shown as this action is + // added after show only // qt list container contains only one instance of the same action aList.append(action("SHOW_CMD")); aList.append(action("HIDE_CMD")); @@ -820,8 +842,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu() myObjBrowserMenus[ModelAPI_ResultField::ModelAPI_FieldStep::group()] = aList; } -void XGUI_ContextMenuMgr::buildViewerMenu() -{ +void XGUI_ContextMenuMgr::buildViewerMenu() { QActionsList aList; // Result construction/part menu aList.append(action("COLOR_CMD")); @@ -886,16 +907,14 @@ void XGUI_ContextMenuMgr::buildViewerMenu() myViewerMenu[ModelAPI_ResultField::ModelAPI_FieldStep::group()] = aList; } - -void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const -{ - ModuleBase_IModule* aModule = myWorkshop->module(); +void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu *theMenu) const { + ModuleBase_IModule *aModule = myWorkshop->module(); if (aModule) { theMenu->addSeparator(); aModule->addObjectBrowserMenu(theMenu); } - XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); + XGUI_SelectionMgr *aSelMgr = myWorkshop->selector(); QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects(); int aSelected = aObjects.size(); QActionsList anActions; @@ -905,64 +924,64 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const if (myObjBrowserMenus.contains(aName)) anActions = myObjBrowserMenus[aName]; } else if (aSelected > 1) { - anActions.append(action("WIREFRAME_CMD")); - anActions.append(action("SHADING_CMD")); - anActions.append(action("SHOW_EDGES_DIRECTION_CMD")); - anActions.append(mySeparator1); - anActions.append(action("BRING_TO_FRONT_CMD")); - anActions.append(mySeparator2); - anActions.append(action("SHOW_CMD")); - anActions.append(action("HIDE_CMD")); - anActions.append(action("SHOW_ONLY_CMD")); - anActions.append(mySeparator3); - anActions.append(action("ADD_TO_FOLDER_BEFORE_CMD")); - anActions.append(action("ADD_TO_FOLDER_AFTER_CMD")); - anActions.append(action("ADD_OUT_FOLDER_BEFORE_CMD")); - anActions.append(action("ADD_OUT_FOLDER_AFTER_CMD")); - anActions.append(mySeparator4); - anActions.append(action("MOVE_CMD")); - anActions.append(action("MOVE_SPLIT_CMD")); - anActions.append(action("COLOR_CMD")); - anActions.append(action("DEFLECTION_CMD")); - anActions.append(action("TRANSPARENCY_CMD")); - anActions.append(action("SHOW_ISOLINES_CMD")); - anActions.append(action("ISOLINES_CMD")); - anActions.append(action("CLEAN_HISTORY_CMD")); - anActions.append(action("DELETE_CMD")); + anActions.append(action("WIREFRAME_CMD")); + anActions.append(action("SHADING_CMD")); + anActions.append(action("SHOW_EDGES_DIRECTION_CMD")); + anActions.append(mySeparator1); + anActions.append(action("BRING_TO_FRONT_CMD")); + anActions.append(mySeparator2); + anActions.append(action("SHOW_CMD")); + anActions.append(action("HIDE_CMD")); + anActions.append(action("SHOW_ONLY_CMD")); + anActions.append(mySeparator3); + anActions.append(action("ADD_TO_FOLDER_BEFORE_CMD")); + anActions.append(action("ADD_TO_FOLDER_AFTER_CMD")); + anActions.append(action("ADD_OUT_FOLDER_BEFORE_CMD")); + anActions.append(action("ADD_OUT_FOLDER_AFTER_CMD")); + anActions.append(mySeparator4); + anActions.append(action("MOVE_CMD")); + anActions.append(action("MOVE_SPLIT_CMD")); + anActions.append(action("COLOR_CMD")); + anActions.append(action("DEFLECTION_CMD")); + anActions.append(action("TRANSPARENCY_CMD")); + anActions.append(action("SHOW_ISOLINES_CMD")); + anActions.append(action("ISOLINES_CMD")); + anActions.append(action("CLEAN_HISTORY_CMD")); + anActions.append(action("DELETE_CMD")); } #ifdef _DEBUG if (aSelected == 0) { - #ifdef TINSPECTOR +#ifdef TINSPECTOR anActions.append(action("TINSPECTOR_VIEW")); - #endif +#endif } #endif theMenu->addActions(anActions); addFeatures(theMenu); // It is commented out because Object Browser does not have actions - //theMenu->addSeparator(); - //theMenu->addActions(myWorkshop->objectBrowser()->actions()); + // theMenu->addSeparator(); + // theMenu->addActions(myWorkshop->objectBrowser()->actions()); } -void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const -{ - XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); +void XGUI_ContextMenuMgr::addViewerMenu(QMenu *theMenu) const { + XGUI_SelectionMgr *aSelMgr = myWorkshop->selector(); QList aPrsList = - aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer); + aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer); int aSelected = aPrsList.size(); QActionsList anActions; // Create selection menu - XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr(); + XGUI_OperationMgr *aOpMgr = myWorkshop->operationMgr(); if (!aOpMgr->hasOperation() && - myWorkshop->selectionActivate()->activeSelectionPlace() == XGUI_SelectionActivate::Workshop) { - QMenu* aSelMenu = new QMenu(tr("Selection mode"), theMenu); + myWorkshop->selectionActivate()->activeSelectionPlace() == + XGUI_SelectionActivate::Workshop) { + QMenu *aSelMenu = new QMenu(tr("Selection mode"), theMenu); aSelMenu->addAction(action("SELECT_VERTEX_CMD")); aSelMenu->addAction(action("SELECT_EDGE_CMD")); aSelMenu->addAction(action("SELECT_FACE_CMD")); - //IMP: an attempt to use result selection with other selection modes - //aSelMenu->addSeparator(); + // IMP: an attempt to use result selection with other selection modes + // aSelMenu->addSeparator(); aSelMenu->addAction(action("SELECT_RESULT_CMD")); theMenu->addMenu(aSelMenu); theMenu->addSeparator(); @@ -986,19 +1005,21 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const anActions.append(action("HIDEALL_CMD")); theMenu->addActions(anActions); - QMap aMenuActions; - ModuleBase_IModule* aModule = myWorkshop->module(); + QMap aMenuActions; + ModuleBase_IModule *aModule = myWorkshop->module(); if (aModule) { if (aModule->addViewerMenu(myActions, theMenu, aMenuActions)) theMenu->addSeparator(); } - // insert the module menu items on specific positions in the popup menu: some actions should be - // in the begin of the list, Delete action should be the last by #1343 issue - QList anActionsList = theMenu->actions(); + // insert the module menu items on specific positions in the popup menu: some + // actions should be in the begin of the list, Delete action should be the + // last by #1343 issue + QList anActionsList = theMenu->actions(); int anActionsListSize = anActionsList.size(); - QAction* aFirstAction = anActionsList[0]; - QMap::const_iterator anIt = aMenuActions.begin(), aLast = aMenuActions.end(); + QAction *aFirstAction = anActionsList[0]; + QMap::const_iterator anIt = aMenuActions.begin(), + aLast = aMenuActions.end(); for (; anIt != aLast; anIt++) { if (anIt.key() > anActionsListSize) theMenu->addAction(anIt.value()); @@ -1008,26 +1029,28 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const #ifndef HAVE_SALOME theMenu->addSeparator(); - QMdiArea* aMDI = myWorkshop->mainWindow()->mdiArea(); + QMdiArea *aMDI = myWorkshop->mainWindow()->mdiArea(); if (aMDI->actions().size() > 0) { - QMenu* aSubMenu = theMenu->addMenu(tr("Windows")); + QMenu *aSubMenu = theMenu->addMenu(tr("Windows")); aSubMenu->addActions(aMDI->actions()); } #endif } -QStringList XGUI_ContextMenuMgr::actionObjectGroups(const QString& theName) -{ +QStringList XGUI_ContextMenuMgr::actionObjectGroups(const QString &theName) { QStringList aGroups; - QMap::const_iterator anIt = myObjBrowserMenus.begin(), - aLast = myObjBrowserMenus.end(); + QMap::const_iterator anIt = + myObjBrowserMenus.begin(), + aLast = + myObjBrowserMenus.end(); for (; anIt != aLast; anIt++) { QString aGroupName(anIt.key().c_str()); if (aGroups.contains(aGroupName)) continue; QActionsList anActions = anIt.value(); - QActionsList::const_iterator anAIt = anActions.begin(), anALast = anActions.end(); + QActionsList::const_iterator anAIt = anActions.begin(), + anALast = anActions.end(); bool aFound = false; for (; anAIt != anALast && !aFound; anAIt++) aFound = (*anAIt)->data().toString() == theName; @@ -1037,9 +1060,9 @@ QStringList XGUI_ContextMenuMgr::actionObjectGroups(const QString& theName) return aGroups; } -void XGUI_ContextMenuMgr::onRename() -{ - QObjectPtrList anObjects = myWorkshop->selector()->selection()->selectedObjects(); +void XGUI_ContextMenuMgr::onRename() { + QObjectPtrList anObjects = + myWorkshop->selector()->selection()->selectedObjects(); if (!myWorkshop->abortAllOperations()) return; // restore selection in case if dialog box was shown @@ -1047,20 +1070,20 @@ void XGUI_ContextMenuMgr::onRename() myWorkshop->objectBrowser()->onEditItem(); } -void XGUI_ContextMenuMgr::addFeatures(QMenu* theMenu) const -{ +void XGUI_ContextMenuMgr::addFeatures(QMenu *theMenu) const { SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr anActiveDoc = aMgr->activeDocument(); - XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); - XGUI_ActionsMgr* anActionMgr = myWorkshop->actionsMgr(); - const Config_DataModelReader* aDataModelXML = myWorkshop->dataModelXMLReader(); + XGUI_SelectionMgr *aSelMgr = myWorkshop->selector(); + XGUI_ActionsMgr *anActionMgr = myWorkshop->actionsMgr(); + const Config_DataModelReader *aDataModelXML = + myWorkshop->dataModelXMLReader(); QModelIndexList aSelectedIndexes = aSelMgr->selection()->selectedIndexes(); QString aName; int aLen = 0; bool aIsRoot = false; - foreach(QModelIndex aIdx, aSelectedIndexes) { + foreach (QModelIndex aIdx, aSelectedIndexes) { // Process only first column if (aIdx.column() == 1) { aIsRoot = !aIdx.parent().isValid(); @@ -1074,38 +1097,37 @@ void XGUI_ContextMenuMgr::addFeatures(QMenu* theMenu) const if (aLen != -1) { aName = aName.left(--aLen); } - std::string aFeaturesStr = aIsRoot? - aDataModelXML->rootFolderFeatures(aName.toStdString()) : - aDataModelXML->subFolderFeatures(aName.toStdString()); - if (aFeaturesStr.length() > 0) { - QStringList aFeturesList = + std::string aFeaturesStr = + aIsRoot ? aDataModelXML->rootFolderFeatures(aName.toStdString()) + : aDataModelXML->subFolderFeatures(aName.toStdString()); + if (aFeaturesStr.length() > 0) { + QStringList aFeturesList = QString(aFeaturesStr.c_str()).split(",", QString::SkipEmptyParts); - foreach(QString aFea, aFeturesList) { - QAction* anAction = anActionMgr->action(aFea); - if (anAction) - theMenu->addAction(anAction); - } + foreach (QString aFea, aFeturesList) { + QAction *anAction = anActionMgr->action(aFea); + if (anAction) + theMenu->addAction(anAction); } + } } } } -#define UNCHECK_ACTION(NAME) \ -{ QAction* anAction = action(NAME); \ -bool isBlock = anAction->signalsBlocked(); \ -anAction->blockSignals(true); \ -anAction->setChecked(false); \ - anAction->blockSignals(isBlock); } - +#define UNCHECK_ACTION(NAME) \ + { \ + QAction *anAction = action(NAME); \ + bool isBlock = anAction->signalsBlocked(); \ + anAction->blockSignals(true); \ + anAction->setChecked(false); \ + anAction->blockSignals(isBlock); \ + } -void XGUI_ContextMenuMgr::onResultSelection(bool theChecked) -{ +void XGUI_ContextMenuMgr::onResultSelection(bool theChecked) { UNCHECK_ACTION("SELECT_VERTEX_CMD"); UNCHECK_ACTION("SELECT_EDGE_CMD"); UNCHECK_ACTION("SELECT_FACE_CMD"); } -void XGUI_ContextMenuMgr::onShapeSelection(bool theChecked) -{ +void XGUI_ContextMenuMgr::onShapeSelection(bool theChecked) { UNCHECK_ACTION("SHOW_RESULTS_CMD"); } diff --git a/src/XGUI/XGUI_ContextMenuMgr.h b/src/XGUI/XGUI_ContextMenuMgr.h index 3f1112a32..9e8b456b3 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.h +++ b/src/XGUI/XGUI_ContextMenuMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ContextMenuMgr_H @@ -22,8 +23,8 @@ #include "XGUI.h" -#include #include +#include class XGUI_Workshop; class QAction; @@ -35,25 +36,25 @@ class QActionGroup; * \ingroup GUI * A class wihich provides managent of context menu */ -class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent object - XGUI_ContextMenuMgr(XGUI_Workshop* theParent); +class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent object + XGUI_ContextMenuMgr(XGUI_Workshop *theParent); virtual ~XGUI_ContextMenuMgr(); - /// Create all actions for context menus. It is called on creation of application + /// Create all actions for context menus. It is called on creation of + /// application void createActions(); /// Returns action according to the given ID /// \param theId an id of an action - QAction* action(const QString& theId) const; + QAction *action(const QString &theId) const; /// Returns action object by its Id (name) /// \param theName is an Id of the action - QAction* actionByName(const QString& theName) const; + QAction *actionByName(const QString &theName) const; /// Returns list of registered actions Ids QStringList actionIds() const; @@ -61,22 +62,23 @@ Q_OBJECT /// update state of internal commands void updateCommandsStatus(); - /// Connect to object browser from workshop. Has to called at creation of viewer. + /// Connect to object browser from workshop. Has to called at creation of + /// viewer. void connectObjectBrowser(); /// Connect to viewer from workshop. Has to called at creation of viewer. void connectViewer(); /// Add menu items for Object browser pop-up - void addObjBrowserMenu(QMenu*) const; + void addObjBrowserMenu(QMenu *) const; /// Add menu items for Viewer pop-up - void addViewerMenu(QMenu*) const; + void addViewerMenu(QMenu *) const; /// Returns a list of object group names of the action /// \param theName a name of the action /// \return a list of group names - QStringList actionObjectGroups(const QString& theName); + QStringList actionObjectGroups(const QString &theName); /// Updates menu for object browser void updateObjectBrowserMenu(); @@ -88,7 +90,7 @@ signals: /// Signal aabout triggered action /// \param theId an id of triggered action /// \param isChecked is checked flag - void actionTriggered(const QString& theId, bool isChecked); + void actionTriggered(const QString &theId, bool isChecked); /// A signal which is sent before context menu show void beforeContextMenu(); @@ -96,14 +98,14 @@ signals: /// A signal which is sent after context menu show void afterContextMenu(); - private slots: - /// Process action event - /// \param isChecked a checked action flag +private slots: + /// Process action event + /// \param isChecked a checked action flag void onAction(bool isChecked); /// Process context menu event /// \param theEvent a context menu event - void onContextMenuRequest(QContextMenuEvent* theEvent); + void onContextMenuRequest(QContextMenuEvent *theEvent); void onRename(); @@ -113,15 +115,15 @@ signals: /// Slot called on any shape selection menu press void onShapeSelection(bool theChecked); - private: - /** +private: + /** * Add action * \param theId - string ID of the item * \param theAction - action to add */ - void addAction(const QString& theId, QAction* theAction); + void addAction(const QString &theId, QAction *theAction); - void addFeatures(QMenu* theMenu) const; + void addFeatures(QMenu *theMenu) const; /// Creates menu for object browser void buildObjBrowserMenu(); @@ -130,21 +132,21 @@ signals: void buildViewerMenu(); /// Map of created actions [id : Action] - QMap myActions; + QMap myActions; /// Reference to workshop - XGUI_Workshop* myWorkshop; + XGUI_Workshop *myWorkshop; - typedef QList QActionsList; + typedef QList QActionsList; QMap myObjBrowserMenus; QMap myViewerMenu; - //QActionGroup* mySelectActions; + // QActionGroup* mySelectActions; - QAction* mySeparator1; - QAction* mySeparator2; - QAction* mySeparator3; - QAction* mySeparator4; + QAction *mySeparator1; + QAction *mySeparator2; + QAction *mySeparator3; + QAction *mySeparator4; }; #endif diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 9c7fde64f..e712b4806 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -14,41 +14,40 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_DataModel.h" #include "XGUI_ObjectsBrowser.h" #include "XGUI_Workshop.h" -#include #include +#include -#include +#include #include +#include #include -#include #include #include -#include #include +#include #include #ifdef _MSC_VER -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #endif -static bool isValidNode(const ModuleBase_ITreeNode* theNode) -{ - ModuleBase_ITreeNode* aParent = 0; +static bool isValidNode(const ModuleBase_ITreeNode *theNode) { + ModuleBase_ITreeNode *aParent = 0; try { aParent = theNode->parent(); - } - catch (...) { + } catch (...) { return false; } if (aParent) @@ -57,32 +56,33 @@ static bool isValidNode(const ModuleBase_ITreeNode* theNode) } // Constructor ************************************************* -XGUI_DataModel::XGUI_DataModel(QObject* theParent) : QAbstractItemModel(theParent)//, - //myIsEventsProcessingBlocked(false) +XGUI_DataModel::XGUI_DataModel(QObject *theParent) + : QAbstractItemModel(theParent) //, + // myIsEventsProcessingBlocked(false) { - XGUI_ObjectsBrowser* aOB = qobject_cast(theParent); + XGUI_ObjectsBrowser *aOB = qobject_cast(theParent); myWorkshop = aOB->workshop(); - Events_Loop* aLoop = Events_Loop::loop(); + Events_Loop *aLoop = Events_Loop::loop(); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_ORDER_UPDATED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } -XGUI_DataModel::~XGUI_DataModel() -{ - clear(); -} +XGUI_DataModel::~XGUI_DataModel() { clear(); } //****************************************************** -void XGUI_DataModel::processEvent(const std::shared_ptr& theMessage) -{ - if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { +void XGUI_DataModel::processEvent( + const std::shared_ptr &theMessage) { + if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::set aObjects = aUpdMsg->objects(); QObjectPtrList aCreated; std::set::const_iterator aIt; @@ -102,20 +102,19 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess emit beforeTreeRebuild(); QTreeNodesList aNodes = myRoot->objectCreated(aCreated); - ModuleBase_ITreeNode* aParent; + ModuleBase_ITreeNode *aParent; int aRow = 0; QModelIndex aParentIndex1, aParentIndex2; ObjectPtr aObj; bool aRebuildAll = false; - foreach(ModuleBase_ITreeNode* aNode, aNodes) { + foreach (ModuleBase_ITreeNode *aNode, aNodes) { aObj = aNode->object(); aParent = aNode->parent(); if (aObj.get() && (aObj->groupName() == ModelAPI_Folder::group())) { aParent->update(); aRebuildAll = true; - } - else { + } else { aRow = aParent->nodeRow(aNode); aParentIndex1 = getParentIndex(aNode, 0); aParentIndex2 = getParentIndex(aNode, 2); @@ -127,35 +126,36 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess rebuildDataTree(); emit treeRebuilt(); - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); - const std::list, std::string>>& aMsgGroups = - aUpdMsg->groups(); + std::dynamic_pointer_cast(theMessage); + const std::list, std::string>> + &aMsgGroups = aUpdMsg->groups(); QTreeNodesList aList; - std::list, std::string>>::const_iterator aIt; + std::list, + std::string>>::const_iterator aIt; emit beforeTreeRebuild(); for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) { aList.append(myRoot->objectsDeleted(aIt->first, aIt->second.c_str())); } // Remove obsolete nodes QTreeNodesList aRemaining; - foreach(ModuleBase_ITreeNode* aNode, aList) { + foreach (ModuleBase_ITreeNode *aNode, aList) { if (myRoot->hasSubNode(aNode)) aRemaining.append(aNode); } // Update remaining nodes - foreach(ModuleBase_ITreeNode* aNode, aRemaining) { + foreach (ModuleBase_ITreeNode *aNode, aRemaining) { if (aNode->parent()) aNode->parent()->update(); } rebuildDataTree(); emit treeRebuilt(); - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::set aObjects = aUpdMsg->objects(); QObjectPtrList aCreated; @@ -177,39 +177,37 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess } if (aRebuildAll) { myRoot->update(); - } - else { - QSet aParents; - foreach(ObjectPtr aObj, aCreated) { - ModuleBase_ITreeNode* aNode = myRoot->subNode(aObj); + } else { + QSet aParents; + foreach (ObjectPtr aObj, aCreated) { + ModuleBase_ITreeNode *aNode = myRoot->subNode(aObj); if (aNode) { if (aNode->parent()) { if (aNode->parent() == myRoot) { aParents.clear(); aParents.insert(myRoot); break; - } - else { + } else { aNode = aNode->parent(); } } aParents.insert(aNode); } } - foreach(ModuleBase_ITreeNode* aNode, aParents) { + foreach (ModuleBase_ITreeNode *aNode, aParents) { aNode->update(); } } rebuildDataTree(); emit treeRebuilt(); - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (aUpdMsg->reordered().get()) { DocumentPtr aDoc = aUpdMsg->reordered()->document(); std::string aGroup = aUpdMsg->reordered()->group(); - ModuleBase_ITreeNode* aNode = myRoot->findParent(aDoc, aGroup.c_str()); + ModuleBase_ITreeNode *aNode = myRoot->findParent(aDoc, aGroup.c_str()); if (aNode) { emit beforeTreeRebuild(); aNode->update(); @@ -217,19 +215,19 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess emit treeRebuilt(); } } - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) { if (ModelAPI_Session::get()->hasModuleDocument()) { DocumentPtr aDoc = ModelAPI_Session::get()->activeDocument(); - ModuleBase_ITreeNode* aRoot = myRoot->findRoot(aDoc); + ModuleBase_ITreeNode *aRoot = myRoot->findRoot(aDoc); if (aRoot) { updateSubTree(aRoot); } } - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::set aObjects = aUpdMsg->objects(); QObjectPtrList aCreated; @@ -243,8 +241,8 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess if (aCreated.length() == 0) return; emit beforeTreeRebuild(); - foreach(ObjectPtr aObj, aCreated) { - ModuleBase_ITreeNode* aNode = myRoot->subNode(aObj); + foreach (ObjectPtr aObj, aCreated) { + ModuleBase_ITreeNode *aNode = myRoot->subNode(aObj); if (aNode) { int aOldNb = aNode->childrenCount(); aNode->update(); @@ -255,8 +253,7 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess if (aNewNb > aOldNb) { insertRows(aOldNb - 1, aNewNb - aOldNb, aFirstIdx); - } - else if (aNewNb < aOldNb) { + } else if (aNewNb < aOldNb) { if (aNewNb) removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx); else if (aOldNb) @@ -270,33 +267,31 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess } //****************************************************** -void XGUI_DataModel::clear() -{ +void XGUI_DataModel::clear() { beginResetModel(); endResetModel(); } //****************************************************** -void XGUI_DataModel::rebuildDataTree() -{ +void XGUI_DataModel::rebuildDataTree() { beginResetModel(); endResetModel(); } //****************************************************** -ObjectPtr XGUI_DataModel::object(const QModelIndex& theIndex) const -{ +ObjectPtr XGUI_DataModel::object(const QModelIndex &theIndex) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer(); + ModuleBase_ITreeNode *aNode = + (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->object(); } return ObjectPtr(); } //****************************************************** -QModelIndex XGUI_DataModel::objectIndex(const ObjectPtr theObject, int theColumn) const -{ - ModuleBase_ITreeNode* aNode = myRoot->subNode(theObject); +QModelIndex XGUI_DataModel::objectIndex(const ObjectPtr theObject, + int theColumn) const { + ModuleBase_ITreeNode *aNode = myRoot->subNode(theObject); if (aNode) { return getIndex(aNode, theColumn); } @@ -304,84 +299,87 @@ QModelIndex XGUI_DataModel::objectIndex(const ObjectPtr theObject, int theColumn } //****************************************************** -QVariant XGUI_DataModel::data(const QModelIndex& theIndex, int theRole) const -{ +QVariant XGUI_DataModel::data(const QModelIndex &theIndex, int theRole) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer(); + ModuleBase_ITreeNode *aNode = + (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->data(theIndex.column(), theRole); } return QVariant(); } //****************************************************** -QVariant XGUI_DataModel::headerData(int theSection, Qt::Orientation theOrient, int theRole) const -{ +QVariant XGUI_DataModel::headerData(int theSection, Qt::Orientation theOrient, + int theRole) const { return QVariant(); } //****************************************************** -int XGUI_DataModel::rowCount(const QModelIndex& theParent) const -{ - ModuleBase_ITreeNode* aParentNode = (theParent.isValid()) ? - (ModuleBase_ITreeNode*)theParent.internalPointer() : myRoot; +int XGUI_DataModel::rowCount(const QModelIndex &theParent) const { + ModuleBase_ITreeNode *aParentNode = + (theParent.isValid()) + ? (ModuleBase_ITreeNode *)theParent.internalPointer() + : myRoot; return aParentNode->childrenCount(); } //****************************************************** -int XGUI_DataModel::columnCount(const QModelIndex& theParent) const -{ +int XGUI_DataModel::columnCount(const QModelIndex &theParent) const { return 3; } //****************************************************** -QModelIndex XGUI_DataModel::index(int theRow, int theColumn, const QModelIndex &theParent) const -{ - ModuleBase_ITreeNode* aParentNode = (theParent.isValid()) ? - (ModuleBase_ITreeNode*)theParent.internalPointer() : myRoot; - ModuleBase_ITreeNode* aSubNode = aParentNode->subNode(theRow); +QModelIndex XGUI_DataModel::index(int theRow, int theColumn, + const QModelIndex &theParent) const { + ModuleBase_ITreeNode *aParentNode = + (theParent.isValid()) + ? (ModuleBase_ITreeNode *)theParent.internalPointer() + : myRoot; + ModuleBase_ITreeNode *aSubNode = aParentNode->subNode(theRow); assert(aSubNode); return createIndex(theRow, theColumn, aSubNode); } //****************************************************** -QModelIndex XGUI_DataModel::parent(const QModelIndex& theIndex) const -{ +QModelIndex XGUI_DataModel::parent(const QModelIndex &theIndex) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer(); + ModuleBase_ITreeNode *aNode = + (ModuleBase_ITreeNode *)theIndex.internalPointer(); return getParentIndex(aNode, 1); } return QModelIndex(); } //****************************************************** -bool XGUI_DataModel::hasChildren(const QModelIndex& theParent) const -{ - ModuleBase_ITreeNode* aParentNode = (theParent.isValid()) ? - (ModuleBase_ITreeNode*)theParent.internalPointer() : myRoot; +bool XGUI_DataModel::hasChildren(const QModelIndex &theParent) const { + ModuleBase_ITreeNode *aParentNode = + (theParent.isValid()) + ? (ModuleBase_ITreeNode *)theParent.internalPointer() + : myRoot; return aParentNode->childrenCount() > 0; } //****************************************************** -bool XGUI_DataModel::insertRows(int theRow, int theCount, const QModelIndex& theParent) -{ +bool XGUI_DataModel::insertRows(int theRow, int theCount, + const QModelIndex &theParent) { beginInsertRows(theParent, theRow, theRow + theCount - 1); endInsertRows(); return true; } //****************************************************** -bool XGUI_DataModel::removeRows(int theRow, int theCount, const QModelIndex& theParent) -{ +bool XGUI_DataModel::removeRows(int theRow, int theCount, + const QModelIndex &theParent) { beginRemoveRows(theParent, theRow, theRow + theCount - 1); endRemoveRows(); return true; } //****************************************************** -Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex& theIndex) const -{ +Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex &theIndex) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode* aNode = static_cast(theIndex.internalPointer()); + ModuleBase_ITreeNode *aNode = + static_cast(theIndex.internalPointer()); // Check that the pointer is Valid if (!isValidNode(aNode)) return Qt::NoItemFlags; @@ -389,15 +387,19 @@ Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex& theIndex) const // Drag and drop of Part features only if: // - PartSet is active // - active Part feature of PartSet is dragged - // - finally if it does not break dependencies between features (but here only drag possibility is checked) + // - finally if it does not break dependencies between features (but here + // only drag possibility is checked) SessionPtr aSession = ModelAPI_Session::get(); - if (aSession->hasModuleDocument() && aSession->moduleDocument() == aSession->activeDocument()) { + if (aSession->hasModuleDocument() && + aSession->moduleDocument() == aSession->activeDocument()) { ObjectPtr aNodeObj = aNode->object(); - if (aNodeObj.get() && aNodeObj->groupName() == ModelAPI_Feature::group()) - { - FeaturePtr aNodeFeature = std::dynamic_pointer_cast(aNodeObj); - if (aNodeFeature.get() && aNodeFeature->getKind() == "Part" && !aNodeFeature->isDisabled()) + if (aNodeObj.get() && + aNodeObj->groupName() == ModelAPI_Feature::group()) { + FeaturePtr aNodeFeature = + std::dynamic_pointer_cast(aNodeObj); + if (aNodeFeature.get() && aNodeFeature->getKind() == "Part" && + !aNodeFeature->isDisabled()) aResultFlags |= Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; } } @@ -406,14 +408,16 @@ Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex& theIndex) const return Qt::ItemIsDropEnabled | Qt::ItemFlags(); } -bool XGUI_DataModel::canDropMimeData(const QMimeData *theData, Qt::DropAction theAction, - int theRow, int theColumn, const QModelIndex &theParent) const -{ +bool XGUI_DataModel::canDropMimeData(const QMimeData *theData, + Qt::DropAction theAction, int theRow, + int theColumn, + const QModelIndex &theParent) const { if (theParent.isValid()) return false; - ModuleBase_ITreeNode* aSubNode = myRoot->subNode(theRow); - if ((aSubNode && aSubNode->object() && aSubNode->object()->groupName() == ModelAPI_Feature::group()) - || theRow == myRoot->childrenCount()) // into the end of a list of features + ModuleBase_ITreeNode *aSubNode = myRoot->subNode(theRow); + if ((aSubNode && aSubNode->object() && + aSubNode->object()->groupName() == ModelAPI_Feature::group()) || + theRow == myRoot->childrenCount()) // into the end of a list of features { return true; } @@ -421,53 +425,57 @@ bool XGUI_DataModel::canDropMimeData(const QMimeData *theData, Qt::DropAction th return false; // in other cases drop is forbidden } -QMimeData* XGUI_DataModel::mimeData(const QModelIndexList& theIndexes) const -{ - std::set aRows; // to avoid duplication of rows and for sorting the indices +QMimeData *XGUI_DataModel::mimeData(const QModelIndexList &theIndexes) const { + std::set + aRows; // to avoid duplication of rows and for sorting the indices foreach (QModelIndex anIndex, theIndexes) { if (anIndex.isValid() && anIndex.internalPointer()) aRows.insert(anIndex.row()); } QByteArray anEncodedData; QDataStream aStream(&anEncodedData, QIODevice::WriteOnly); - for(std::set::iterator aRIter = aRows.begin(); aRIter != aRows.end(); aRIter++) + for (std::set::iterator aRIter = aRows.begin(); aRIter != aRows.end(); + aRIter++) aStream << *aRIter; - QMimeData* aMimeData = new QMimeData(); + QMimeData *aMimeData = new QMimeData(); aMimeData->setData("xgui/moved.rows", anEncodedData); return aMimeData; } -bool XGUI_DataModel::dropMimeData(const QMimeData *theData, Qt::DropAction theAction, - int theRow, int theColumn, const QModelIndex &theParent) -{ - FeaturePtr aDropAfter; // after this feature it is dropped, NULL if drop the the first place - if (theRow > 0) - { - ModuleBase_ITreeNode* aNode = myRoot->subNode(theRow - 1); - if (aNode && aNode->object() && aNode->object()->groupName() == ModelAPI_Feature::group()) +bool XGUI_DataModel::dropMimeData(const QMimeData *theData, + Qt::DropAction theAction, int theRow, + int theColumn, const QModelIndex &theParent) { + FeaturePtr aDropAfter; // after this feature it is dropped, NULL if drop the + // the first place + if (theRow > 0) { + ModuleBase_ITreeNode *aNode = myRoot->subNode(theRow - 1); + if (aNode && aNode->object() && + aNode->object()->groupName() == ModelAPI_Feature::group()) aDropAfter = std::dynamic_pointer_cast(aNode->object()); } SessionPtr aSession = ModelAPI_Session::get(); if (aDropAfter.get()) // move to the upper enabled feature { - while (aDropAfter.get() && (aDropAfter->isDisabled() || !aDropAfter->isInHistory())) + while (aDropAfter.get() && + (aDropAfter->isDisabled() || !aDropAfter->isInHistory())) aDropAfter = aDropAfter->document()->nextFeature(aDropAfter, true); - } - else { // move after invisible items, not the first (which is coordinate system by default) - std::list allFeatures = aSession->get()->moduleDocument()->allFeatures(); + } else { // move after invisible items, not the first (which is coordinate + // system by default) + std::list allFeatures = + aSession->get()->moduleDocument()->allFeatures(); std::list::iterator aFeature = allFeatures.begin(); - for(; aFeature != allFeatures.end(); aFeature++) - { + for (; aFeature != allFeatures.end(); aFeature++) { if ((*aFeature)->isInHistory()) break; aDropAfter = *aFeature; } } - // move after the composite feature memebers, if they are invisible (sub elements of sketch) - CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(aDropAfter); - if (aComposite.get()) - { + // move after the composite feature memebers, if they are invisible (sub + // elements of sketch) + CompositeFeaturePtr aComposite = + std::dynamic_pointer_cast(aDropAfter); + if (aComposite.get()) { FeaturePtr aNext = aDropAfter->document()->nextFeature(aDropAfter); while (aNext.get() && !aNext->isInHistory() && aComposite->isSub(aNext)) { aDropAfter = aNext; @@ -484,12 +492,14 @@ bool XGUI_DataModel::dropMimeData(const QMimeData *theData, Qt::DropAction theAc while (!stream.atEnd()) { int aRow; stream >> aRow; - ModuleBase_ITreeNode* aNode = myRoot->subNode(aRow); - if (aNode) - { - FeaturePtr aFeature = std::dynamic_pointer_cast(aNode->object()); - // feature moved after itself is not moved, add only Part feature, other skip - if (aFeature.get() && aFeature != aDropAfter && aFeature->getKind() == "Part") + ModuleBase_ITreeNode *aNode = myRoot->subNode(aRow); + if (aNode) { + FeaturePtr aFeature = + std::dynamic_pointer_cast(aNode->object()); + // feature moved after itself is not moved, add only Part feature, other + // skip + if (aFeature.get() && aFeature != aDropAfter && + aFeature->getKind() == "Part") aDropped.push_back(aFeature); } } @@ -497,29 +507,30 @@ bool XGUI_DataModel::dropMimeData(const QMimeData *theData, Qt::DropAction theAc return false; // check for the movement is valid due to existing dependencies - std::wstring anErrorStr = ModelAPI_Tools::validateMovement(aDropAfter, aDropped); - if (!anErrorStr.empty()) - { + std::wstring anErrorStr = + ModelAPI_Tools::validateMovement(aDropAfter, aDropped); + if (!anErrorStr.empty()) { QMessageBox aMessageBox; aMessageBox.setWindowTitle(QObject::tr("Move part")); aMessageBox.setIcon(QMessageBox::Warning); aMessageBox.setStandardButtons(QMessageBox::Ok); aMessageBox.setDefaultButton(QMessageBox::Ok); - QString aMessageText(QObject::tr("Part(s) cannot be moved because of breaking dependencies.")); + QString aMessageText(QObject::tr( + "Part(s) cannot be moved because of breaking dependencies.")); aMessageBox.setText(aMessageText); aMessageBox.setDetailedText(QString::fromStdWString(anErrorStr)); aMessageBox.exec(); return false; } - if (aSession->isOperation()) - { + if (aSession->isOperation()) { QMessageBox aMessageBox; aMessageBox.setWindowTitle(QObject::tr("Move part")); aMessageBox.setIcon(QMessageBox::Warning); aMessageBox.setStandardButtons(QMessageBox::Ok); aMessageBox.setDefaultButton(QMessageBox::Ok); - QString aMessageText(QObject::tr("Cannot move part(s) during another operation.")); + QString aMessageText( + QObject::tr("Cannot move part(s) during another operation.")); aMessageBox.setText(aMessageText); aMessageBox.exec(); return false; @@ -527,8 +538,8 @@ bool XGUI_DataModel::dropMimeData(const QMimeData *theData, Qt::DropAction theAc aSession->startOperation("Move Part"); DocumentPtr aPartSet = aSession->moduleDocument(); - for (std::list::iterator aDrop = aDropped.begin(); aDrop != aDropped.end(); aDrop++) - { + for (std::list::iterator aDrop = aDropped.begin(); + aDrop != aDropped.end(); aDrop++) { aPartSet->moveFeature(*aDrop, aDropAfter); aDropAfter = *aDrop; } @@ -542,15 +553,15 @@ bool XGUI_DataModel::dropMimeData(const QMimeData *theData, Qt::DropAction theAc } //****************************************************** -QModelIndex XGUI_DataModel::documentRootIndex(DocumentPtr theDoc, int theColumn) const -{ +QModelIndex XGUI_DataModel::documentRootIndex(DocumentPtr theDoc, + int theColumn) const { SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aRootDoc = aSession->moduleDocument(); if (theDoc == aRootDoc) return QModelIndex(); else { - ModuleBase_ITreeNode* aDocNode = 0; - foreach(ModuleBase_ITreeNode* aNode, myRoot->children()) { + ModuleBase_ITreeNode *aDocNode = 0; + foreach (ModuleBase_ITreeNode *aNode, myRoot->children()) { if (aNode->document() == theDoc) { aDocNode = aNode; break; @@ -563,26 +574,26 @@ QModelIndex XGUI_DataModel::documentRootIndex(DocumentPtr theDoc, int theColumn) } //****************************************************** -bool XGUI_DataModel::hasHiddenState(const QModelIndex& theIndex) -{ +bool XGUI_DataModel::hasHiddenState(const QModelIndex &theIndex) { if (theIndex.isValid()) { - ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer(); + ModuleBase_ITreeNode *aNode = + (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->visibilityState() == ModuleBase_ITreeNode::Hidden; } return false; } //****************************************************** -bool XGUI_DataModel::hasIndex(const QModelIndex& theIndex) const -{ - ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer(); +bool XGUI_DataModel::hasIndex(const QModelIndex &theIndex) const { + ModuleBase_ITreeNode *aNode = + (ModuleBase_ITreeNode *)theIndex.internalPointer(); return myRoot->hasSubNode(aNode); } //****************************************************** -QModelIndex XGUI_DataModel::getParentIndex(ModuleBase_ITreeNode* theNode, int thCol) const -{ - ModuleBase_ITreeNode* aParent = theNode->parent(); +QModelIndex XGUI_DataModel::getParentIndex(ModuleBase_ITreeNode *theNode, + int thCol) const { + ModuleBase_ITreeNode *aParent = theNode->parent(); if (aParent == myRoot) { return QModelIndex(); } else { @@ -591,18 +602,16 @@ QModelIndex XGUI_DataModel::getParentIndex(ModuleBase_ITreeNode* theNode, int th } //****************************************************** -QModelIndex XGUI_DataModel::getIndex(ModuleBase_ITreeNode* theNode, int thCol) const -{ +QModelIndex XGUI_DataModel::getIndex(ModuleBase_ITreeNode *theNode, + int thCol) const { if (theNode == myRoot) return QModelIndex(); int aRow = theNode->parent()->nodeRow(theNode); return createIndex(aRow, thCol, theNode); } - //****************************************************** -void XGUI_DataModel::updateSubTree(ModuleBase_ITreeNode* theParent) -{ +void XGUI_DataModel::updateSubTree(ModuleBase_ITreeNode *theParent) { int aRows = theParent->childrenCount(); if (aRows) { QModelIndex aParent = getIndex(theParent, 0); @@ -612,17 +621,14 @@ void XGUI_DataModel::updateSubTree(ModuleBase_ITreeNode* theParent) } } - //****************************************************** -DocumentPtr XGUI_DataModel::document(const QModelIndex& theIndex) const -{ - ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer(); +DocumentPtr XGUI_DataModel::document(const QModelIndex &theIndex) const { + ModuleBase_ITreeNode *aNode = + (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->document(); } - //****************************************************** -bool XGUI_DataModel::hasNode(ModuleBase_ITreeNode* theNode) const -{ +bool XGUI_DataModel::hasNode(ModuleBase_ITreeNode *theNode) const { return myRoot->hasSubNode(theNode); } diff --git a/src/XGUI/XGUI_DataModel.h b/src/XGUI/XGUI_DataModel.h index 0c56b2f1c..5bdcf3fe5 100644 --- a/src/XGUI/XGUI_DataModel.h +++ b/src/XGUI/XGUI_DataModel.h @@ -14,17 +14,18 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_DataModel_H #define XGUI_DataModel_H #include "XGUI.h" -#include -#include -#include #include +#include +#include +#include #include @@ -39,36 +40,36 @@ class ModuleBase_ITreeNode; * - Non Valid Index - root index * - An index with internal Id == -1 is a folder of root document * - An index which contains internal pointer as ModelAPI_Object its the object - * - An index which contains internal pointer as ModelAPI_Document is + * - An index which contains internal pointer as ModelAPI_Document is * a folder which belongs to this document */ -class XGUI_EXPORT XGUI_DataModel : public QAbstractItemModel, public Events_Listener -{ -Q_OBJECT +class XGUI_EXPORT XGUI_DataModel : public QAbstractItemModel, + public Events_Listener { + Q_OBJECT public: /// Constructor /// \param theParent a parent object - XGUI_DataModel(QObject* theParent); + XGUI_DataModel(QObject *theParent); /// Destructor virtual ~XGUI_DataModel(); + void setRoot(ModuleBase_ITreeNode *theRoot) { myRoot = theRoot; } - void setRoot(ModuleBase_ITreeNode* theRoot) { myRoot = theRoot; } - - ModuleBase_ITreeNode* root() const { return myRoot; } + ModuleBase_ITreeNode *root() const { return myRoot; } /// Event Listener method /// \param theMessage an event message - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); //! Returns an object by the given Model index. //! Returns 0 if the given index is not index of an object - virtual ObjectPtr object(const QModelIndex& theIndex) const; + virtual ObjectPtr object(const QModelIndex &theIndex) const; //! Returns index of the object //! \param theObject object to find - virtual QModelIndex objectIndex(const ObjectPtr theObject, int theColumn = 1) const; + virtual QModelIndex objectIndex(const ObjectPtr theObject, + int theColumn = 1) const; //! Clear internal data virtual void clear(); @@ -76,72 +77,76 @@ public: //! Rebuild data tree virtual void rebuildDataTree(); - /// Returns the data stored under the given role for the item referred to by the index. - /// \param theIndex a model index - /// \param theRole a data role (see Qt::ItemDataRole) - virtual QVariant data(const QModelIndex& theIndex, int theRole) const; - - /// Returns the data for the given role and section in the header with the specified orientation. - /// \param theSection a section - /// \param theOrient an orientation - /// \param theRole a data role (see Qt::ItemDataRole) - virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole = - Qt::DisplayRole) const; - - /// Returns the number of rows under the given parent. When the parent is valid it means that - /// rowCount is returning the number of children of parent. - /// \param theParent a parent model index - virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const; + /// Returns the data stored under the given role for the item referred to by + /// the index. \param theIndex a model index \param theRole a data role (see + /// Qt::ItemDataRole) + virtual QVariant data(const QModelIndex &theIndex, int theRole) const; + + /// Returns the data for the given role and section in the header with the + /// specified orientation. \param theSection a section \param theOrient an + /// orientation \param theRole a data role (see Qt::ItemDataRole) + virtual QVariant headerData(int theSection, Qt::Orientation theOrient, + int theRole = Qt::DisplayRole) const; + + /// Returns the number of rows under the given parent. When the parent is + /// valid it means that rowCount is returning the number of children of + /// parent. \param theParent a parent model index + virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const; /// Returns the number of columns for the children of the given parent. /// It has a one column /// \param theParent a parent model index - virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const; /// Returns the index of the item in the model specified by the given row, /// column and parent index. /// \param theRow a row /// \param theColumn a column /// \param theParent a parent model index - virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &theParent = - QModelIndex()) const; + virtual QModelIndex index(int theRow, int theColumn, + const QModelIndex &theParent = QModelIndex()) const; /// Returns the parent of the model item with the given index. /// If the item has no parent, an invalid QModelIndex is returned. /// \param theIndex a model index - virtual QModelIndex parent(const QModelIndex& theIndex) const; + virtual QModelIndex parent(const QModelIndex &theIndex) const; /// Returns true if parent has any children; otherwise returns false. /// \param theParent a parent model index - virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const; + virtual bool hasChildren(const QModelIndex &theParent = QModelIndex()) const; /// Inserts count rows into the model before the given row. - /// Items in the new row will be children of the item represented by the parent model index. - /// \param theRow a start row - /// \param theCount a nember of rows to insert - /// \param theParent a parent model index - virtual bool insertRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex()); - - /// Removes count rows starting with the given row under parent parent from the model. - /// \param theRow a start row - /// \param theCount a nember of rows to remove - /// \param theParent a parent model index - virtual bool removeRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex()); + /// Items in the new row will be children of the item represented by the + /// parent model index. \param theRow a start row \param theCount a nember of + /// rows to insert \param theParent a parent model index + virtual bool insertRows(int theRow, int theCount, + const QModelIndex &theParent = QModelIndex()); + + /// Removes count rows starting with the given row under parent parent from + /// the model. \param theRow a start row \param theCount a nember of rows to + /// remove \param theParent a parent model index + virtual bool removeRows(int theRow, int theCount, + const QModelIndex &theParent = QModelIndex()); /// Returns the item flags for the given index. /// \param theIndex a model index - virtual Qt::ItemFlags flags(const QModelIndex& theIndex) const; + virtual Qt::ItemFlags flags(const QModelIndex &theIndex) const; - /// Returns true if a model can accept a drop of the data (used for drag and drop functionality). - virtual bool canDropMimeData(const QMimeData *theData, Qt::DropAction theAction, - int theRow, int theColumn, const QModelIndex &theParent) const override; + /// Returns true if a model can accept a drop of the data (used for drag and + /// drop functionality). + virtual bool canDropMimeData(const QMimeData *theData, + Qt::DropAction theAction, int theRow, + int theColumn, + const QModelIndex &theParent) const override; - /// Converts the dragged items information into mime data format (to be encoded in dropMimeData) - virtual QMimeData* mimeData(const QModelIndexList &indexes) const override; + /// Converts the dragged items information into mime data format (to be + /// encoded in dropMimeData) + virtual QMimeData *mimeData(const QModelIndexList &indexes) const override; /// Performs a drag and drop of Part feature operation when it is droped. virtual bool dropMimeData(const QMimeData *theData, Qt::DropAction theAction, - int theRow, int theColumn, const QModelIndex &theParent) override; + int theRow, int theColumn, + const QModelIndex &theParent) override; /// Returns an index which is root of the given document /// \param theDoc a document @@ -150,28 +155,27 @@ public: /// Returns true if the data model item has Hidden visual state /// \param theIndex a tree model item /// \return boolean value - bool hasHiddenState(const QModelIndex& theIndex); + bool hasHiddenState(const QModelIndex &theIndex); /// Returns true if the given index exists in data tree /// \param theIndex an index to check - bool hasIndex(const QModelIndex& theIndex) const; + bool hasIndex(const QModelIndex &theIndex) const; /// Returns true if the given node is a parto of the data tree /// \param theNode a node to check - bool hasNode(ModuleBase_ITreeNode* theNode) const; + bool hasNode(ModuleBase_ITreeNode *theNode) const; /// Returns document of the given index /// \param theIndex an index to check - DocumentPtr document(const QModelIndex& theIndex) const; + DocumentPtr document(const QModelIndex &theIndex) const; /// Returns index for the node and column /// \param theNode a node /// \param thCol a column - QModelIndex getIndex(ModuleBase_ITreeNode* theNode, int thCol) const; + QModelIndex getIndex(ModuleBase_ITreeNode *theNode, int thCol) const; /// Allows to support drag and drop of some model items - virtual Qt::DropActions supportedDropActions() const override - { + virtual Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; } @@ -183,21 +187,16 @@ signals: void treeRebuilt(); private: - enum VisibilityState { - NoneState, - Visible, - SemiVisible, - Hidden }; - + enum VisibilityState { NoneState, Visible, SemiVisible, Hidden }; - QModelIndex getParentIndex(ModuleBase_ITreeNode* theNode, int thCol) const; + QModelIndex getParentIndex(ModuleBase_ITreeNode *theNode, int thCol) const; - void updateSubTree(ModuleBase_ITreeNode* theParent); + void updateSubTree(ModuleBase_ITreeNode *theParent); - XGUI_Workshop* myWorkshop; + XGUI_Workshop *myWorkshop; QMap myShownFolders; - ModuleBase_ITreeNode* myRoot; + ModuleBase_ITreeNode *myRoot; }; -#endif \ No newline at end of file +#endif diff --git a/src/XGUI/XGUI_DeflectionDialog.cpp b/src/XGUI/XGUI_DeflectionDialog.cpp index 6367108a1..297cd8585 100644 --- a/src/XGUI/XGUI_DeflectionDialog.cpp +++ b/src/XGUI/XGUI_DeflectionDialog.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -23,17 +24,17 @@ #include -#include #include +#include #include +#include #include -#include -XGUI_DeflectionDialog::XGUI_DeflectionDialog(QWidget* theParent) - : QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) -{ +XGUI_DeflectionDialog::XGUI_DeflectionDialog(QWidget *theParent) + : QDialog(theParent, + Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) { setWindowTitle(tr("Deflection")); - QGridLayout* aLay = new QGridLayout(this); + QGridLayout *aLay = new QGridLayout(this); myDeflection = new ModuleBase_DoubleSpinBox(this); myDeflection->setDecimals(12); @@ -41,19 +42,17 @@ XGUI_DeflectionDialog::XGUI_DeflectionDialog(QWidget* theParent) myDeflection->setSingleStep(0.001); aLay->addWidget(myDeflection, 0, 0); - QDialogButtonBox* aButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, - Qt::Horizontal, this); + QDialogButtonBox *aButtons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(aButtons, SIGNAL(accepted()), this, SLOT(accept())); connect(aButtons, SIGNAL(rejected()), this, SLOT(reject())); aLay->addWidget(aButtons, 1, 0); } -void XGUI_DeflectionDialog::setDeflection(const double& theValue) -{ +void XGUI_DeflectionDialog::setDeflection(const double &theValue) { myDeflection->setValue(theValue); } -double XGUI_DeflectionDialog::getDeflection() const -{ +double XGUI_DeflectionDialog::getDeflection() const { return myDeflection->value(); } diff --git a/src/XGUI/XGUI_DeflectionDialog.h b/src/XGUI/XGUI_DeflectionDialog.h index 80d5e97e0..2b1baf01e 100644 --- a/src/XGUI/XGUI_DeflectionDialog.h +++ b/src/XGUI/XGUI_DeflectionDialog.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_DeflectionDialog_H @@ -28,30 +29,31 @@ class QButtonGroup; class QDoubleSpinBox; /** -* \ingroup GUI -* A class of dialog to chose a deflection value. The deflection value is in range [0, 1] -*/ -class XGUI_DeflectionDialog : public QDialog -{ + * \ingroup GUI + * A class of dialog to chose a deflection value. The deflection value is in + * range [0, 1] + */ +class XGUI_DeflectionDialog : public QDialog { Q_OBJECT public: /// Constructor /// \param theParent a parent widget for the dialog - XGUI_EXPORT XGUI_DeflectionDialog(QWidget* theParent); + XGUI_EXPORT XGUI_DeflectionDialog(QWidget *theParent); - XGUI_EXPORT virtual ~XGUI_DeflectionDialog() {}; + XGUI_EXPORT virtual ~XGUI_DeflectionDialog(){}; /// Initializes the dialog with the given value. /// \param theValue the deflection value - void setDeflection(const double& theDeflection); + void setDeflection(const double &theDeflection); /// Returns the current deflection value. /// \return a double value double getDeflection() const; private: - QButtonGroup* myButtonGroup; /// a group, contained random and certain color radio button choice - QDoubleSpinBox* myDeflection; /// a deflection value + QButtonGroup *myButtonGroup; /// a group, contained random and certain color + /// radio button choice + QDoubleSpinBox *myDeflection; /// a deflection value }; #endif diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 6ee3b9348..991c8e1dc 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_Displayer.h" @@ -30,32 +31,32 @@ #include #endif -#include +#include #include +#include #include -#include -#include #include #include +#include #include #include +#include #include #include #include -#include -#include -#include #include -#include +#include #include +#include +#include #include #include -#include #include +#include #include #include #ifdef BEFORE_TRIHEDRON_PATCH @@ -64,43 +65,45 @@ #include #endif #include +#include #include #include #include -#include #include +#include #include #include -#include #include -#include -#include #include +#include +#include #ifdef TINSPECTOR #include #endif +#include #include #include -#include #include #ifdef _MSC_VER -#pragma warning(disable: 4702) +#pragma warning(disable : 4702) #endif /// defines the local context mouse selection sensitivity const int MOUSE_SENSITIVITY_IN_PIXEL = 10; /// defines the display priority for results brought to front -constexpr int FRONT_DISPLAY_PRIORITY = 8; /* = Graphic3d_DisplayPriority_Highlight-1 */ +constexpr int FRONT_DISPLAY_PRIORITY = + 8; /* = Graphic3d_DisplayPriority_Highlight-1 */ /// defines the default (normal) display priority for all results -constexpr int DEFAULT_DISPLAY_PRIORITY = 5; /* = Graphic3d_DisplayPriority_Normal */ +constexpr int DEFAULT_DISPLAY_PRIORITY = + 5; /* = Graphic3d_DisplayPriority_Normal */ //#define DEBUG_DISPLAY //#define DEBUG_FEATURE_REDISPLAY @@ -113,18 +116,18 @@ constexpr int DEFAULT_DISPLAY_PRIORITY = 5; /* = Graphic3d_DisplayPriority_Norma //#define DEBUG_VIEWER_BLOCKED_COUNT //************************************************************** -void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList) -{ +void displayedObjects(const Handle(AIS_InteractiveContext) & theAIS, + AIS_ListOfInteractive &theList) { // Get from null point #if OCC_VERSION_HEX < 0x070400 - theAIS->DisplayedObjects(theList, true); + theAIS->DisplayedObjects(theList, true); #else - theAIS->DisplayedObjects(theList); + theAIS->DisplayedObjects(theList); #endif } -QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QString(", ")) -{ +QString qIntListInfo(const QIntList &theValues, + const QString &theSeparator = QString(", ")) { QStringList anInfo; QIntList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); for (; anIt != aLast; anIt++) { @@ -134,38 +137,33 @@ QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QS } //************************************************************** -XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop) -: myWorkshop(theWorkshop), - myViewerBlockedRecursiveCount(0), - myContextId(0), - myNeedUpdate(false) -{ +XGUI_Displayer::XGUI_Displayer(XGUI_Workshop *theWorkshop) + : myWorkshop(theWorkshop), myViewerBlockedRecursiveCount(0), myContextId(0), + myNeedUpdate(false) { BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True); } //************************************************************** -XGUI_Displayer::~XGUI_Displayer() -{ -} +XGUI_Displayer::~XGUI_Displayer() {} //************************************************************** -bool XGUI_Displayer::isVisible(ObjectPtr theObject) const -{ +bool XGUI_Displayer::isVisible(ObjectPtr theObject) const { return myResult2AISObjectMap.contains(theObject); } //************************************************************** -bool XGUI_Displayer::display(ObjectPtr theObject, bool theUpdateViewer) -{ +bool XGUI_Displayer::display(ObjectPtr theObject, bool theUpdateViewer) { bool aDisplayed = false; if (isVisible(theObject)) { aDisplayed = redisplay(theObject, theUpdateViewer); } else { AISObjectPtr anAIS; - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); + GeomPresentablePtr aPrs = + std::dynamic_pointer_cast(theObject); bool isShading = false; if (aPrs.get() != NULL) { - GeomScreenParamsPtr aScreen = std::dynamic_pointer_cast(theObject); + GeomScreenParamsPtr aScreen = + std::dynamic_pointer_cast(theObject); if (aScreen.get()) { aScreen->setScreenPlane(getScreenPlane()); aScreen->setViewScale(getViewScale()); @@ -183,17 +181,17 @@ bool XGUI_Displayer::display(ObjectPtr theObject, bool theUpdateViewer) return aDisplayed; } - //************************************************************** -bool canBeShaded(Handle(AIS_InteractiveObject) theAIS, ModuleBase_IModule* theModule) -{ +bool canBeShaded(Handle(AIS_InteractiveObject) theAIS, + ModuleBase_IModule *theModule) { Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(theAIS); if (!aShapePrs.IsNull()) { TopoDS_Shape aShape = aShapePrs->Shape(); if (aShape.IsNull()) return false; TopAbs_ShapeEnum aType = aShape.ShapeType(); - if ((aType == TopAbs_VERTEX) || (aType == TopAbs_EDGE) || (aType == TopAbs_WIRE)) + if ((aType == TopAbs_VERTEX) || (aType == TopAbs_EDGE) || + (aType == TopAbs_WIRE)) return false; else { // Check that the presentation is not a sketch @@ -205,33 +203,34 @@ bool canBeShaded(Handle(AIS_InteractiveObject) theAIS, ModuleBase_IModule* theMo //************************************************************** bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, - bool isShading, bool theUpdateViewer) -{ + bool isShading, bool theUpdateViewer) { bool aDisplayed = false; Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return aDisplayed; - Handle(AIS_InteractiveObject) anAISIO = theAIS->impl(); + Handle(AIS_InteractiveObject) anAISIO = + theAIS->impl(); if (!anAISIO.IsNull()) { appendResultObject(theObject, theAIS); - //bool isCustomized = customizeObject(theObject); + // bool isCustomized = customizeObject(theObject); - int aDispMode = isShading? Shading : Wireframe; + int aDispMode = isShading ? Shading : Wireframe; anAISIO->SetDisplayMode(aDispMode); aContext->Display(anAISIO, aDispMode, 0, false, AIS_DS_Displayed); ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (ModelAPI_Tools::isBringToFront(aResult)) { // NOTE: do not use a priority higher than 8 as highlight uses priority 9! - // Any higher level prevents the highlight from being visible as it would - // appear "behind" the Groups. + // Any higher level prevents the highlight from being visible as it + // would appear "behind" the Groups. aContext->SetDisplayPriority(anAISIO, FRONT_DISPLAY_PRIORITY); } - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Display(anAISIO); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Display(anAISIO); +#endif aDisplayed = true; emit objectDisplayed(theObject, theAIS); @@ -245,8 +244,7 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, } //************************************************************** -bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer) -{ +bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer) { bool aErased = false; if (!isVisible(theObject)) return aErased; @@ -257,13 +255,15 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer) AISObjectPtr anObject = myResult2AISObjectMap.value(theObject); if (anObject) { - Handle(AIS_InteractiveObject) anAIS = anObject->impl(); + Handle(AIS_InteractiveObject) anAIS = + anObject->impl(); if (!anAIS.IsNull()) { emit beforeObjectErase(theObject, anObject); - aContext->Remove(anAIS, false/*update viewer*/); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Remove(anAIS); - #endif + aContext->Remove(anAIS, false /*update viewer*/); +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Remove(anAIS); +#endif aErased = true; } } @@ -272,7 +272,10 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer) #ifdef DEBUG_DISPLAY std::ostringstream aPtrStr; aPtrStr << theObject.get(); - qDebug(QString("erase object: %1").arg(aPtrStr.str().c_str()).toStdString().c_str()); + qDebug(QString("erase object: %1") + .arg(aPtrStr.str().c_str()) + .toStdString() + .c_str()); qDebug(getResult2AISObjectMapInfo().c_str()); #endif myWorkshop->updateGroupsText(); @@ -283,8 +286,7 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer) } //************************************************************** -bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) -{ +bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) { bool aRedisplayed = false; Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) @@ -296,9 +298,11 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) AISObjectPtr aAISObj = getAISObject(theObject); Handle(AIS_InteractiveObject) aAISIO; - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); + GeomPresentablePtr aPrs = + std::dynamic_pointer_cast(theObject); if (aPrs) { - GeomScreenParamsPtr aScreen = std::dynamic_pointer_cast(theObject); + GeomScreenParamsPtr aScreen = + std::dynamic_pointer_cast(theObject); if (aScreen.get()) { aScreen->setScreenPlane(getScreenPlane()); aScreen->setViewScale(getViewScale()); @@ -313,8 +317,7 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) appendResultObject(theObject, aAIS_Obj); } aAISIO = aAIS_Obj->impl(); - } - else { + } else { aAISIO = aAISObj->impl(); } @@ -325,8 +328,8 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) std::vector aColor; ModelAPI_Tools::getColor(aResult, aColor); if (aColor.size() > 0) { - Quantity_Color - aCol(aColor[0] / 255., aColor[1] / 255., aColor[2] / 255., Quantity_TOC_RGB); + Quantity_Color aCol(aColor[0] / 255., aColor[1] / 255., + aColor[2] / 255., Quantity_TOC_RGB); aAISIO->SetColor(aCol); } // Set deflection @@ -340,39 +343,44 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) aAISObj->setTransparency(aTransparency); // Set Iso-Lines - Handle(ModuleBase_ResultPrs) aResPrs = Handle(ModuleBase_ResultPrs)::DownCast(aAISIO); + Handle(ModuleBase_ResultPrs) aResPrs = + Handle(ModuleBase_ResultPrs)::DownCast(aAISIO); if (!aResPrs.IsNull()) aResPrs->updateIsoLines(); // Only support the "Bring To Front" command for Groups (for now) - ResultGroupPtr aGroup = std::dynamic_pointer_cast(aResult); + ResultGroupPtr aGroup = + std::dynamic_pointer_cast(aResult); if (aGroup.get()) { bool isInFront = ModelAPI_Tools::isBringToFront(aResult); - aContext->SetDisplayPriority(aAISIO, (isInFront ? FRONT_DISPLAY_PRIORITY : DEFAULT_DISPLAY_PRIORITY)); + aContext->SetDisplayPriority( + aAISIO, + (isInFront ? FRONT_DISPLAY_PRIORITY : DEFAULT_DISPLAY_PRIORITY)); } } - //myWorkshop->module()->storeSelection(); + // myWorkshop->module()->storeSelection(); -//#ifdef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY - //myWorkshop->selector()->deselectPresentation(aAISIO); -//#endif + //#ifdef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY + // myWorkshop->selector()->deselectPresentation(aAISIO); + //#endif if (aContext->IsDisplayed(aAISIO)) aContext->Redisplay(aAISIO, false); else { aContext->Display(aAISIO, false); } - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Redisplay(aAISIO); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Redisplay(aAISIO); +#endif - //if (aNeedToRestoreSelection) - //myWorkshop->module()->restoreSelection(); + // if (aNeedToRestoreSelection) + // myWorkshop->module()->restoreSelection(); aRedisplayed = true; - #ifdef DEBUG_FEATURE_REDISPLAY - qDebug(" Redisplay happens"); - #endif +#ifdef DEBUG_FEATURE_REDISPLAY + qDebug(" Redisplay happens"); +#endif myWorkshop->updateGroupsText(); if (theUpdateViewer) updateViewer(); @@ -381,17 +389,18 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) } //************************************************************** -void XGUI_Displayer::redisplayObjects() -{ +void XGUI_Displayer::redisplayObjects() { // redisplay objects visualized in the viewer - static Events_ID EVENT_DISP = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); - static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + static Events_ID EVENT_DISP = + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); QObjectPtrList aDisplayed = displayedObjects(); - QObjectPtrList::const_iterator anIt = aDisplayed.begin(), aLast = aDisplayed.end(); + QObjectPtrList::const_iterator anIt = aDisplayed.begin(), + aLast = aDisplayed.end(); for (; anIt != aLast; anIt++) { aECreator->sendUpdated(*anIt, EVENT_DISP); } - XGUI_ViewerProxy* aViewer = myWorkshop->viewer(); + XGUI_ViewerProxy *aViewer = myWorkshop->viewer(); if (aViewer->isColorScaleVisible()) { aViewer->setupColorScale(); aViewer->setColorScaleShown(true); @@ -400,47 +409,53 @@ void XGUI_Displayer::redisplayObjects() } //************************************************************** -void XGUI_Displayer::deactivateObjects(const QObjectPtrList& theObjList, - const bool theUpdateViewer) -{ - //Handle(AIS_InteractiveObject) aTrihedron = getTrihedron(); - //if (!aTrihedron.IsNull()) - // deactivateAIS(aTrihedron); - - QObjectPtrList::const_iterator anIt = theObjList.begin(), aLast = theObjList.end(); +void XGUI_Displayer::deactivateObjects(const QObjectPtrList &theObjList, + const bool theUpdateViewer) { + // Handle(AIS_InteractiveObject) aTrihedron = getTrihedron(); + // if (!aTrihedron.IsNull()) + // deactivateAIS(aTrihedron); + + QObjectPtrList::const_iterator anIt = theObjList.begin(), + aLast = theObjList.end(); for (; anIt != aLast; anIt++) { selectionActivate()->deactivate(*anIt, false); } - //VSV It seems that there is no necessity to update viewer on deactivation - //if (theUpdateViewer) - // updateViewer(); + // VSV It seems that there is no necessity to update viewer on deactivation + // if (theUpdateViewer) + // updateViewer(); } //************************************************************** -bool XGUI_Displayer::isVisible(XGUI_Displayer* theDisplayer, const ObjectPtr& theObject) -{ +bool XGUI_Displayer::isVisible(XGUI_Displayer *theDisplayer, + const ObjectPtr &theObject) { bool aVisible = false; - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); + GeomPresentablePtr aPrs = + std::dynamic_pointer_cast(theObject); ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aPrs.get() || aResult.get()) { aVisible = theDisplayer->isVisible(theObject); // compsolid is not visualized in the viewer, // but should have presentation when all sub solids are - // visible. It is useful for highlight presentation where compsolid shape is selectable - if (!aVisible && aResult.get() && aResult->groupName() == ModelAPI_ResultBody::group()) { - ResultBodyPtr aCompsolidResult = std::dynamic_pointer_cast(aResult); + // visible. It is useful for highlight presentation where compsolid shape is + // selectable + if (!aVisible && aResult.get() && + aResult->groupName() == ModelAPI_ResultBody::group()) { + ResultBodyPtr aCompsolidResult = + std::dynamic_pointer_cast(aResult); if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids int aNumberOfSubs = aCompsolidResult->numberOfSubs(); bool anAllSubsVisible = aNumberOfSubs > 0; - for(int i = 0; i < aNumberOfSubs && anAllSubsVisible; i++) { - anAllSubsVisible = theDisplayer->isVisible(aCompsolidResult->subResult(i)); + for (int i = 0; i < aNumberOfSubs && anAllSubsVisible; i++) { + anAllSubsVisible = + theDisplayer->isVisible(aCompsolidResult->subResult(i)); } aVisible = anAllSubsVisible; } } } - // it is possible that feature is presentable and has results, so we should check visibility - // of results if presentation is not shown (e.g. Sketch Circle/Arc features) + // it is possible that feature is presentable and has results, so we should + // check visibility of results if presentation is not shown (e.g. Sketch + // Circle/Arc features) if (!aVisible) { // check if all results of the feature are visible FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); @@ -456,32 +471,34 @@ bool XGUI_Displayer::isVisible(XGUI_Displayer* theDisplayer, const ObjectPtr& th } //************************************************************** -void XGUI_Displayer::setSelected(const QList& theValues, - bool theUpdateViewer) -{ +void XGUI_Displayer::setSelected( + const QList &theValues, bool theUpdateViewer) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; aContext->UnhilightSelected(false); aContext->ClearSelected(false); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->ClearSelected(); - #endif - NCollection_DataMap> - aShapesToBeSelected; +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->ClearSelected(); +#endif + NCollection_DataMap> + aShapesToBeSelected; foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) { - const GeomShapePtr& aGeomShape = aPrs->shape(); + const GeomShapePtr &aGeomShape = aPrs->shape(); if (aGeomShape.get() && !aGeomShape->isNull()) { - const TopoDS_Shape& aShape = aGeomShape->impl(); + const TopoDS_Shape &aShape = aGeomShape->impl(); #ifdef DEBUG_OCCT_SHAPE_SELECTION // problem 1: performance - // problem 2: IO is not specified, so the first found owner is selected, as a result - // it might belong to another result + // problem 2: IO is not specified, so the first found owner is selected, + // as a result it might belong to another result aContext->AddOrRemoveSelected(aShape, false); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->AddOrRemoveSelected(aShape); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->AddOrRemoveSelected(aShape); +#endif #else NCollection_Map aPresentations; if (aShapesToBeSelected.IsBound(aShape)) @@ -496,17 +513,21 @@ void XGUI_Displayer::setSelected(const QList& theValue ResultPtr aResult = std::dynamic_pointer_cast(anObject); if (aResult.get() && isVisible(aResult)) { AISObjectPtr anObj = myResult2AISObjectMap.value(aResult); - Handle(AIS_InteractiveObject) anAIS = anObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + anObj->impl(); if (!anAIS.IsNull()) { - // The methods are replaced in order to provide multi-selection, e.g. restore selection - // by activating multi selector widget. It also gives an advantage that the multi - // selection in OB gives multi-selection in the viewer - //aContext->SetSelected(anAIS, false); - // The selection in the context was cleared, so the method sets the objects are selected + // The methods are replaced in order to provide multi-selection, e.g. + // restore selection by activating multi selector widget. It also + // gives an advantage that the multi selection in OB gives + // multi-selection in the viewer + // aContext->SetSelected(anAIS, false); + // The selection in the context was cleared, so the method sets the + // objects are selected aContext->AddOrRemoveSelected(anAIS, false); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->AddOrRemoveSelected(anAIS); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->AddOrRemoveSelected(anAIS); +#endif } } } @@ -519,39 +540,40 @@ void XGUI_Displayer::setSelected(const QList& theValue } //************************************************************** -void XGUI_Displayer::clearSelected(const bool theUpdateViewer) -{ +void XGUI_Displayer::clearSelected(const bool theUpdateViewer) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { - aContext->UnhilightSelected(false);//UnhilightCurrents(false); + aContext->UnhilightSelected(false); // UnhilightCurrents(false); aContext->ClearSelected(theUpdateViewer); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->ClearSelected(); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->ClearSelected(); +#endif } } //************************************************************** -bool XGUI_Displayer::eraseAll(const bool theUpdateViewer) -{ +bool XGUI_Displayer::eraseAll(const bool theUpdateViewer) { bool aErased = false; Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { #ifdef OPTIMIZE_PRS - foreach(ObjectPtr aObj, myResult2AISObjectMap.objects()) { + foreach (ObjectPtr aObj, myResult2AISObjectMap.objects()) { AISObjectPtr aAISObj = myResult2AISObjectMap.value(aObj); #else - foreach(ObjectPtr aObj, myResult2AISObjectMap.keys()) { + foreach (ObjectPtr aObj, myResult2AISObjectMap.keys()) { AISObjectPtr aAISObj = myResult2AISObjectMap[aObj]; #endif // erase an object - Handle(AIS_InteractiveObject) anIO = aAISObj->impl(); + Handle(AIS_InteractiveObject) anIO = + aAISObj->impl(); if (!anIO.IsNull()) { emit beforeObjectErase(aObj, aAISObj); - aContext->Remove(anIO, false/*update viewer*/); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Remove(anIO); - #endif + aContext->Remove(anIO, false /*update viewer*/); +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Remove(anIO); +#endif aErased = true; } } @@ -567,10 +589,8 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer) return aErased; } - //************************************************************** -AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const -{ +AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const { #ifdef OPTIMIZE_PRS return myResult2AISObjectMap.value(theObject); #else @@ -582,23 +602,24 @@ AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const } //************************************************************** -ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const -{ - Handle(AIS_InteractiveObject) aRefAIS = theIO->impl(); +ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr &theIO) const { + Handle(AIS_InteractiveObject) aRefAIS = + theIO->impl(); return getObject(aRefAIS); } //************************************************************** -ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const -{ +ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject) & + theIO) const { #ifdef OPTIMIZE_PRS ObjectPtr anObject = myResult2AISObjectMap.value(theIO); #else ObjectPtr anObject; ResultToAISMap::const_iterator aMapIter = myResult2AISObjectMap.cbegin(); for (; aMapIter != myResult2AISObjectMap.cend(); aMapIter++) { - const AISObjectPtr& aAIS = aMapIter.value(); - Handle(AIS_InteractiveObject) anAIS = aAIS->impl(); + const AISObjectPtr &aAIS = aMapIter.value(); + Handle(AIS_InteractiveObject) anAIS = + aAIS->impl(); if (anAIS == theIO) anObject = aMapIter.key(); if (anObject.get()) @@ -606,7 +627,8 @@ ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) } #endif if (!anObject.get()) { - std::shared_ptr anAISObj = AISObjectPtr(new GeomAPI_AISObject()); + std::shared_ptr anAISObj = + AISObjectPtr(new GeomAPI_AISObject()); if (!theIO.IsNull()) { anAISObj->setImpl(new Handle(AIS_InteractiveObject)(theIO)); } @@ -617,8 +639,7 @@ ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) } //************************************************************** -bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled) -{ +bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled) { bool aWasEnabled = isUpdateEnabled(); if (isEnabled) myViewerBlockedRecursiveCount--; @@ -626,7 +647,8 @@ bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled) myViewerBlockedRecursiveCount++; #ifdef DEBUG_VIEWER_BLOCKED_COUNT - std::cout << "myViewerBlockedRecursiveCount = " << myViewerBlockedRecursiveCount << std::endl; + std::cout << "myViewerBlockedRecursiveCount = " + << myViewerBlockedRecursiveCount << std::endl; #endif if (myNeedUpdate && isUpdateEnabled()) { @@ -637,17 +659,17 @@ bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled) } //************************************************************** -void XGUI_Displayer::updateViewer() const -{ +void XGUI_Displayer::updateViewer() const { Handle(AIS_InteractiveContext) aContext = AISContext(); #ifdef DEBUG_VIEWER_BLOCKED_COUNT - std::cout << "updateViewer: " << (myViewerBlockedRecursiveCount == 0 ? " done" : " later") + std::cout << "updateViewer: " + << (myViewerBlockedRecursiveCount == 0 ? " done" : " later") << std::endl; #endif if (!aContext.IsNull() && isUpdateEnabled()) { - //myWorkshop->viewer()->Zfitall(); + // myWorkshop->viewer()->Zfitall(); aContext->UpdateCurrentViewer(); } else { myNeedUpdate = true; @@ -655,8 +677,7 @@ void XGUI_Displayer::updateViewer() const } //************************************************************** -Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const -{ +Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const { Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull() && (myContextId != aContext.get())) { myContextId = aContext.get(); @@ -674,24 +695,21 @@ Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const } //************************************************************** -void XGUI_Displayer::setSelectionColor(const std::vector& theColor) -{ +void XGUI_Displayer::setSelectionColor(const std::vector &theColor) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { - Quantity_Color aQColor(theColor[0] / 255., - theColor[1] / 255., + Quantity_Color aQColor(theColor[0] / 255., theColor[1] / 255., theColor[2] / 255., Quantity_TOC_RGB); aContext->SelectionStyle()->SetColor(aQColor); aContext->SelectionStyle()->PointAspect()->SetColor(aQColor); aContext->SelectionStyle()->LineAspect()->SetColor(aQColor); - aContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor(aQColor); + aContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected) + ->SetColor(aQColor); } } - //************************************************************** -std::vector XGUI_Displayer::selectionColor() const -{ +std::vector XGUI_Displayer::selectionColor() const { std::vector aColor; Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { @@ -703,10 +721,8 @@ std::vector XGUI_Displayer::selectionColor() const return aColor; } - //************************************************************** -Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter() -{ +Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull() && myAndFilter.IsNull()) { myAndFilter = new SelectMgr_AndFilter(); @@ -716,28 +732,35 @@ Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter() } //************************************************************** -bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSelectionModes, - const Standard_Integer theDisplayMode, bool theUpdateViewer) -{ +bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, + const bool toActivateInSelectionModes, + const Standard_Integer theDisplayMode, + bool theUpdateViewer) { bool aDisplayed = false; Handle(AIS_InteractiveContext) aContext = AISContext(); - Handle(AIS_InteractiveObject) anAISIO = theAIS->impl(); + Handle(AIS_InteractiveObject) anAISIO = + theAIS->impl(); if (!aContext.IsNull() && !anAISIO.IsNull()) { - aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, AIS_DS_Displayed); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Display(anAISIO); - #endif + aContext->Display(anAISIO, theDisplayMode, 0, false /*update viewer*/, + AIS_DS_Displayed); +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Display(anAISIO); +#endif aDisplayed = true; aContext->Deactivate(anAISIO); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Deactivate(anAISIO); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Deactivate(anAISIO); +#endif aContext->Load(anAISIO); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Load(anAISIO); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Load(anAISIO); +#endif if (toActivateInSelectionModes) - myWorkshop->selectionActivate()->activateOnDisplay(anAISIO, theUpdateViewer); + myWorkshop->selectionActivate()->activateOnDisplay(anAISIO, + theUpdateViewer); if (theUpdateViewer) updateViewer(); @@ -746,17 +769,18 @@ bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSele } //************************************************************** -bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer) -{ +bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer) { bool aErased = false; Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { - Handle(AIS_InteractiveObject) anAISIO = theAIS->impl(); + Handle(AIS_InteractiveObject) anAISIO = + theAIS->impl(); if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) { - aContext->Remove(anAISIO, false/*update viewer*/); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Remove(anAISIO); - #endif + aContext->Remove(anAISIO, false /*update viewer*/); +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Remove(anAISIO); +#endif aErased = true; } } @@ -766,8 +790,8 @@ bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer) } //************************************************************** -void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool theUpdateViewer) -{ +void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, + bool theUpdateViewer) { if (theMode == NoMode) return; @@ -779,16 +803,18 @@ void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bo if (!aAISObj) return; - Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl(); + Handle(AIS_InteractiveObject) aAISIO = + aAISObj->impl(); aContext->SetDisplayMode(aAISIO, theMode, false); - // Redisplay in order to update new mode because it could be not computed before + // Redisplay in order to update new mode because it could be not computed + // before if (theUpdateViewer) updateViewer(); } //************************************************************** -XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const -{ +XGUI_Displayer::DisplayMode +XGUI_Displayer::displayMode(ObjectPtr theObject) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return NoMode; @@ -797,18 +823,18 @@ XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) con if (!aAISObj) return NoMode; - Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl(); - return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode(); + Handle(AIS_InteractiveObject) aAISIO = + aAISObj->impl(); + return (XGUI_Displayer::DisplayMode)aAISIO->DisplayMode(); } //************************************************************** -void XGUI_Displayer::deactivateSelectionFilters(const bool theAddFilterOnly) -{ +void XGUI_Displayer::deactivateSelectionFilters(const bool theAddFilterOnly) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!myAndFilter.IsNull()) { bool aFound = false; if (!aContext.IsNull()) { - const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + const SelectMgr_ListOfFilter &aFilters = aContext->Filters(); SelectMgr_ListIteratorOfListOfFilter anIt(aFilters); for (; anIt.More() && !aFound; anIt.Next()) { Handle(SelectMgr_Filter) aFilter = anIt.Value(); @@ -822,8 +848,8 @@ void XGUI_Displayer::deactivateSelectionFilters(const bool theAddFilterOnly) } //************************************************************** -void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull() || hasSelectionFilter(theFilter)) return; @@ -833,14 +859,17 @@ void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilte aCompositeFilter->Add(theFilter); #ifdef DEBUG_SELECTION_FILTERS int aCount = aCompositeFilter->StoredFilters().Extent(); - qDebug(QString("addSelectionFilter: filters.count() = %1").arg(aCount).toStdString().c_str()); + qDebug(QString("addSelectionFilter: filters.count() = %1") + .arg(aCount) + .toStdString() + .c_str()); #endif } } //************************************************************** -void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; @@ -851,20 +880,22 @@ void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFi #ifdef DEBUG_SELECTION_FILTERS int aCount = aCompositeFilter->StoredFilters().Extent(); qDebug(QString("removeSelectionFilter: filters.count() = %1") - .arg(aCount).toStdString().c_str()); + .arg(aCount) + .toStdString() + .c_str()); #endif } } //************************************************************** -bool XGUI_Displayer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +bool XGUI_Displayer::hasSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { bool aFilterFound = false; Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return aFilterFound; - const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + const SelectMgr_ListOfFilter &aFilters = aContext->Filters(); SelectMgr_ListIteratorOfListOfFilter aIt(aFilters); for (; aIt.More() && !aFilterFound; aIt.Next()) { if (theFilter.get() == aIt.Value().get()) @@ -872,8 +903,10 @@ bool XGUI_Displayer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilte } Handle(SelectMgr_CompositionFilter) aCompositeFilter = GetFilter(); if (!aCompositeFilter.IsNull()) { - const SelectMgr_ListOfFilter& aStoredFilters = aCompositeFilter->StoredFilters(); - for (aIt.Initialize(aStoredFilters); aIt.More() && !aFilterFound; aIt.Next()) { + const SelectMgr_ListOfFilter &aStoredFilters = + aCompositeFilter->StoredFilters(); + for (aIt.Initialize(aStoredFilters); aIt.More() && !aFilterFound; + aIt.Next()) { if (theFilter.get() == aIt.Value().get()) aFilterFound = true; } @@ -882,8 +915,7 @@ bool XGUI_Displayer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilte } //************************************************************** -void XGUI_Displayer::removeFilters() -{ +void XGUI_Displayer::removeFilters() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; @@ -894,18 +926,17 @@ void XGUI_Displayer::removeFilters() } //************************************************************** -void XGUI_Displayer::showOnly(const QObjectPtrList& theList) -{ +void XGUI_Displayer::showOnly(const QObjectPtrList &theList) { #ifdef OPTIMIZE_PRS QObjectPtrList aDispList = myResult2AISObjectMap.objects(); #else QObjectPtrList aDispList = myResult2AISObjectMap.keys(); #endif - foreach(ObjectPtr aObj, aDispList) { + foreach (ObjectPtr aObj, aDispList) { if (!theList.contains(aObj)) erase(aObj, false); } - foreach(ObjectPtr aObj, theList) { + foreach (ObjectPtr aObj, theList) { if (!isVisible(aObj)) display(aObj, false); } @@ -913,8 +944,7 @@ void XGUI_Displayer::showOnly(const QObjectPtrList& theList) } //************************************************************** -bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const -{ +bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const { if (!isVisible(theObject)) return false; @@ -922,15 +952,15 @@ bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const if (aAISObj.get() == NULL) return false; - Handle(AIS_InteractiveObject) anAIS = aAISObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + aAISObj->impl(); return ::canBeShaded(anAIS, myWorkshop->module()); } //************************************************************** QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject, - const QColor& theColor, - bool theUpdateViewer) -{ + const QColor &theColor, + bool theUpdateViewer) { if (!isVisible(theObject)) return Qt::black; @@ -945,8 +975,8 @@ QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject, } //************************************************************** -void XGUI_Displayer::appendResultObject(ObjectPtr theObject, AISObjectPtr theAIS) -{ +void XGUI_Displayer::appendResultObject(ObjectPtr theObject, + AISObjectPtr theAIS) { #ifdef OPTIMIZE_PRS myResult2AISObjectMap.add(theObject, theAIS); #else @@ -956,73 +986,85 @@ void XGUI_Displayer::appendResultObject(ObjectPtr theObject, AISObjectPtr theAIS #ifdef DEBUG_DISPLAY std::ostringstream aPtrStr; aPtrStr << theObject.get(); - qDebug(QString("display object: %1").arg(aPtrStr.str().c_str()).toStdString().c_str()); + qDebug(QString("display object: %1") + .arg(aPtrStr.str().c_str()) + .toStdString() + .c_str()); qDebug(getResult2AISObjectMapInfo().c_str()); #endif } #ifdef _DEBUG //************************************************************** -std::string XGUI_Displayer::getResult2AISObjectMapInfo() const -{ +std::string XGUI_Displayer::getResult2AISObjectMapInfo() const { QStringList aContent; #ifdef OPTIMIZE_PRS - foreach(ObjectPtr aObj, myResult2AISObjectMap.objects()) { + foreach (ObjectPtr aObj, myResult2AISObjectMap.objects()) { AISObjectPtr aAISObj = myResult2AISObjectMap.value(aObj); #else - foreach(ObjectPtr aObj, myResult2AISObjectMap.keys()) { + foreach (ObjectPtr aObj, myResult2AISObjectMap.keys()) { AISObjectPtr aAISObj = myResult2AISObjectMap[aObj]; #endif std::ostringstream aPtrStr; aPtrStr << "aObj = " << aObj.get() << ":"; aPtrStr << "anAIS = " << aAISObj.get() << ":"; - aPtrStr << "[" << ModuleBase_Tools::objectInfo(aObj).toStdString().c_str() << "]"; + aPtrStr << "[" << ModuleBase_Tools::objectInfo(aObj).toStdString().c_str() + << "]"; aContent.append(aPtrStr.str().c_str()); } - return QString("myResult2AISObjectMap: size = %1\n%2\n").arg(myResult2AISObjectMap.size()). - arg(aContent.join("\n")).toStdString().c_str(); + return QString("myResult2AISObjectMap: size = %1\n%2\n") + .arg(myResult2AISObjectMap.size()) + .arg(aContent.join("\n")) + .toStdString() + .c_str(); } #endif //************************************************************** -void XGUI_Displayer::getPresentations(const ObjectPtr& theObject, - NCollection_Map& thePresentations) -{ +void XGUI_Displayer::getPresentations( + const ObjectPtr &theObject, + NCollection_Map &thePresentations) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { AISObjectPtr aAISObj = getAISObject(aResult); if (aAISObj.get() == NULL) { - // if result is a result of a composite feature, it is visualized by visualization of - // composite children, so we should get one of this presentations - ResultBodyPtr aCompSolid = std::dynamic_pointer_cast(aResult); + // if result is a result of a composite feature, it is visualized by + // visualization of composite children, so we should get one of this + // presentations + ResultBodyPtr aCompSolid = + std::dynamic_pointer_cast(aResult); if (aCompSolid.get() && aCompSolid->numberOfSubs() > 0) { aAISObj = getAISObject(aCompSolid->subResult(0)); } } if (aAISObj.get() != NULL) { - Handle(AIS_InteractiveObject) anAIS = aAISObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + aAISObj->impl(); if (!anAIS.IsNull() && !thePresentations.Contains(anAIS)) thePresentations.Add(anAIS); } - } - else { - FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); + } else { + FeaturePtr aFeature = + std::dynamic_pointer_cast(theObject); // find presentation of the feature AISObjectPtr aAISObj = getAISObject(aFeature); if (aAISObj.get() != NULL) { - Handle(AIS_InteractiveObject) anAIS = aAISObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + aAISObj->impl(); if (!anAIS.IsNull() && !thePresentations.Contains(anAIS)) thePresentations.Add(anAIS); } // find presentations of the feature results std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); - std::list::const_iterator anIt = aResults.begin(), aLast = aResults.end(); + std::list::const_iterator anIt = aResults.begin(), + aLast = aResults.end(); for (; anIt != aLast; ++anIt) { AISObjectPtr aCurAISObj = getAISObject(*anIt); if (aCurAISObj.get() != NULL) { - Handle(AIS_InteractiveObject) anAIS = aCurAISObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + aCurAISObj->impl(); if (!anAIS.IsNull() && !thePresentations.Contains(anAIS)) thePresentations.Add(anAIS); } @@ -1031,25 +1073,23 @@ void XGUI_Displayer::getPresentations(const ObjectPtr& theObject, } //************************************************************** -void XGUI_Displayer::displayTrihedron(bool theToDisplay) const -{ +void XGUI_Displayer::displayTrihedron(bool theToDisplay) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; Handle(AIS_Trihedron) aTrihedron = myWorkshop->viewer()->trihedron(); - XGUI_SelectionActivate* aSelectionActive = selectionActivate(); + XGUI_SelectionActivate *aSelectionActive = selectionActivate(); if (theToDisplay) { if (!aContext->IsDisplayed(aTrihedron)) - aContext->Display(aTrihedron, - 0 /*wireframe*/, - -1 /* selection mode */, + aContext->Display(aTrihedron, 0 /*wireframe*/, -1 /* selection mode */, Standard_True /* update viewer*/, AIS_DS_Displayed /* xdisplay status */); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Display(aTrihedron); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Display(aTrihedron); +#endif if (!aSelectionActive->isTrihedronActive()) aSelectionActive->deactivateTrihedron(false); @@ -1059,40 +1099,46 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const aSelectionActive->deactivateTrihedron(false); aContext->Erase(aTrihedron, Standard_True); - #ifdef TINSPECTOR - if (getCallBack()) getCallBack()->Remove(aTrihedron); - #endif +#ifdef TINSPECTOR + if (getCallBack()) + getCallBack()->Remove(aTrihedron); +#endif } } //************************************************************** -void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext, - const NCollection_DataMap>& theShapesToBeSelected) -{ +void XGUI_Displayer::AddOrRemoveSelectedShapes( + Handle(AIS_InteractiveContext) theContext, + const NCollection_DataMap> + &theShapesToBeSelected) { NCollection_Map aCompsolidPresentations; NCollection_Map aSelectedPresentations; NCollection_List anActiveOwners; theContext->MainSelector()->ActiveOwners(anActiveOwners); - NCollection_List::Iterator anOwnersIt (anActiveOwners); + NCollection_List::Iterator anOwnersIt( + anActiveOwners); Handle(SelectMgr_EntityOwner) anOwner; - /// It is very important to check that the owner is processed only once and has a map of - /// processed owners because SetSelected works as a switch. - /// If count of calls setSelectec is even, the object stays in the previous state + /// It is very important to check that the owner is processed only once and + /// has a map of processed owners because SetSelected works as a switch. If + /// count of calls setSelectec is even, the object stays in the previous state /// (selected, deselected) - /// OCCT: to write about the problem that active owners method returns one owner several times - QList aSelectedIds; // Remember of selected address in order to avoid duplicates + /// OCCT: to write about the problem that active owners method returns one + /// owner several times + QList + aSelectedIds; // Remember of selected address in order to avoid duplicates for (; anOwnersIt.More(); anOwnersIt.Next()) { anOwner = anOwnersIt.Value(); if (aSelectedIds.contains((size_t)anOwner.get())) continue; aSelectedIds.append((size_t)anOwner.get()); - Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner); + Handle(StdSelect_BRepOwner) BROwnr = + Handle(StdSelect_BRepOwner)::DownCast(anOwner); if (!BROwnr.IsNull() && BROwnr->HasShape()) { - const TopoDS_Shape& aShape = BROwnr->Shape(); + const TopoDS_Shape &aShape = BROwnr->Shape(); Handle(ModuleBase_ResultPrs) aResPrs = Handle(ModuleBase_ResultPrs)::DownCast(BROwnr->Selectable()); @@ -1104,46 +1150,51 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th if (aShape.IsNull()) continue; - Handle(ModuleBase_BRepOwner) aCustomOwner = Handle(ModuleBase_BRepOwner)::DownCast(anOwner); + Handle(ModuleBase_BRepOwner) aCustomOwner = + Handle(ModuleBase_BRepOwner)::DownCast(anOwner); - NCollection_DataMap > - ::Iterator aShapeIt(theShapesToBeSelected); + NCollection_DataMap>::Iterator + aShapeIt(theShapesToBeSelected); for (; aShapeIt.More(); aShapeIt.Next()) { - const TopoDS_Shape& aParameterShape = aShapeIt.Key(); + const TopoDS_Shape &aParameterShape = aShapeIt.Key(); // In case of compound we cannot rely on simple comparison method. - // If the compound is generated by Group feature then this compound is alwais new. - // So, we have to compare content of these compounds + // If the compound is generated by Group feature then this compound is + // alwais new. So, we have to compare content of these compounds - // isSame should be used here as it does not check orientation of shapes - // despite on isEqual of shapes or IsBound for shape in QMap. Orientation is - // different for Edges shapes in model shape and owner even if this is the same shape + // isSame should be used here as it does not check orientation of shapes + // despite on isEqual of shapes or IsBound for shape in QMap. + // Orientation is different for Edges shapes in model shape and owner + // even if this is the same shape bool isSame = ModuleBase_Tools::isSameShape(aParameterShape, aShape); if (!isSame) { - // In case of using HideFaces panel we can have instead of an original shape - // a compaund of faces which represent original shape with hidden faces. - // So, we have to compare the parameter with original shape + // In case of using HideFaces panel we can have instead of an original + // shape a compaund of faces which represent original shape with + // hidden faces. So, we have to compare the parameter with original + // shape if (!aRealShape.IsNull()) isSame = ModuleBase_Tools::isSameShape(aParameterShape, aRealShape); } if (isSame) { Handle(AIS_InteractiveObject) anOwnerPresentation = - Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); + Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); NCollection_Map aPresentations = - theShapesToBeSelected.Find(aParameterShape); + theShapesToBeSelected.Find(aParameterShape); if (aPresentations.Contains(anOwnerPresentation)) { theContext->AddOrRemoveSelected(anOwner, Standard_False); anOwner->SetSelected(Standard_True); - // collect selected presentations to do not select them if compsolid is selected + // collect selected presentations to do not select them if compsolid + // is selected if (!aSelectedPresentations.Contains(anOwnerPresentation)) aSelectedPresentations.Add(anOwnerPresentation); } - } - else if (!aCustomOwner.IsNull()) { // CompSolid processing #2219 - // shape of owner is compound, but shape to be selected is compsolid, so - // we need to compare shape to AIS presentation of owner(rule of the owner creation) + } else if (!aCustomOwner.IsNull()) { // CompSolid processing #2219 + // shape of owner is compound, but shape to be selected is compsolid, + // so we need to compare shape to AIS presentation of owner(rule of + // the owner creation) Handle(AIS_Shape) anOwnerPresentation = - Handle(AIS_Shape)::DownCast(anOwner->Selectable()); - const TopoDS_Shape& aPresentationShape = anOwnerPresentation->Shape(); + Handle(AIS_Shape)::DownCast(anOwner->Selectable()); + const TopoDS_Shape &aPresentationShape = anOwnerPresentation->Shape(); if (aParameterShape.IsSame(aPresentationShape) && !aCompsolidPresentations.Contains(anOwnerPresentation)) aCompsolidPresentations.Add(anOwnerPresentation); @@ -1152,7 +1203,8 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th } } // select CompSolid presentations if their owners was not selected yet - NCollection_Map::Iterator anIt (aCompsolidPresentations); + NCollection_Map::Iterator anIt( + aCompsolidPresentations); for (; anIt.More(); anIt.Next()) { if (aSelectedPresentations.Contains(anIt.Value())) continue; @@ -1161,14 +1213,12 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th } //************************************************************** -XGUI_SelectionActivate* XGUI_Displayer::selectionActivate() const -{ +XGUI_SelectionActivate *XGUI_Displayer::selectionActivate() const { return myWorkshop->selectionActivate(); } //************************************************************** -GeomPlanePtr XGUI_Displayer::getScreenPlane() const -{ +GeomPlanePtr XGUI_Displayer::getScreenPlane() const { GeomPlanePtr aResult; Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { @@ -1190,8 +1240,7 @@ GeomPlanePtr XGUI_Displayer::getScreenPlane() const return aResult; } -double XGUI_Displayer::getViewScale() const -{ +double XGUI_Displayer::getViewScale() const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { Handle(V3d_Viewer) aViewer = aContext->CurrentViewer(); diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 00232fef5..f4b5e3a9c 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_Displayer_H @@ -29,10 +30,10 @@ #include -#include #include -#include +#include #include +#include #include #include @@ -52,21 +53,19 @@ class XGUI_Workshop; class VInspectorAPI_CallBack; #endif - #ifdef OPTIMIZE_PRS -class XGUI_TwoSidePresentationMap -{ +class XGUI_TwoSidePresentationMap { public: ~XGUI_TwoSidePresentationMap() { clear(); } /// Add new values pair to the map /// \param theObj an object /// \param theAIS a corresponded presentation - bool add(const ObjectPtr& theObj, const AISObjectPtr& theAIS) - { + bool add(const ObjectPtr &theObj, const AISObjectPtr &theAIS) { if (myResultToAISMap.contains(theObj)) return false; - Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); + Handle(AIS_InteractiveObject) anAIS = + theAIS->impl(); myResultToAISMap[theObj] = anAIS; myAIStoResultMap[anAIS] = theObj; return true; @@ -74,8 +73,7 @@ public: /// Removes values by object /// \param theObj an object - bool remove(const ObjectPtr& theObj) - { + bool remove(const ObjectPtr &theObj) { if (!myResultToAISMap.contains(theObj)) return false; Handle(AIS_InteractiveObject) aAIS = myResultToAISMap[theObj]; @@ -86,9 +84,9 @@ public: /// Removes values by presentation /// \param theAIS a presentation - bool remove(const AISObjectPtr& theAIS) - { - Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); + bool remove(const AISObjectPtr &theAIS) { + Handle(AIS_InteractiveObject) anAIS = + theAIS->impl(); if (!myAIStoResultMap.contains(anAIS)) return false; ObjectPtr aObj = myAIStoResultMap[anAIS]; @@ -98,16 +96,14 @@ public: } /// Removes all values - void clear() - { + void clear() { myResultToAISMap.clear(); myAIStoResultMap.clear(); } /// Returns presentation by object /// \param theObj an object - AISObjectPtr value(const ObjectPtr& theObj) const - { + AISObjectPtr value(const ObjectPtr &theObj) const { if (myResultToAISMap.contains(theObj)) { Handle(AIS_InteractiveObject) anAIS = myResultToAISMap[theObj]; AISObjectPtr anAISObj = AISObjectPtr(new GeomAPI_AISObject()); @@ -119,9 +115,9 @@ public: /// Returns object by presentation /// \param theAIS a presentation - ObjectPtr value(const AISObjectPtr& theAIS) const - { - Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); + ObjectPtr value(const AISObjectPtr &theAIS) const { + Handle(AIS_InteractiveObject) anAIS = + theAIS->impl(); if (myAIStoResultMap.contains(anAIS)) return myAIStoResultMap[anAIS]; return ObjectPtr(); @@ -129,8 +125,7 @@ public: /// Returns object by presentation /// \param theAIS a presentation - ObjectPtr value(const Handle(AIS_InteractiveObject)& theAIS) const - { + ObjectPtr value(const Handle(AIS_InteractiveObject) & theAIS) const { if (myAIStoResultMap.contains(theAIS)) return myAIStoResultMap[theAIS]; return ObjectPtr(); @@ -143,17 +138,21 @@ public: QObjectPtrList objects() const { return myResultToAISMap.keys(); } /// returns list of presentations - QList presentations() const { return myAIStoResultMap.keys(); } + QList presentations() const { + return myAIStoResultMap.keys(); + } /// Returns true if the Map contains the object /// \param theObj an object - bool contains(const ObjectPtr& theObj) const { return myResultToAISMap.contains(theObj); } + bool contains(const ObjectPtr &theObj) const { + return myResultToAISMap.contains(theObj); + } /// Returns true if the Map contains the presentation /// \param theAIS a presentation - bool contains(const AISObjectPtr& theAIS) const - { - Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); + bool contains(const AISObjectPtr &theAIS) const { + Handle(AIS_InteractiveObject) anAIS = + theAIS->impl(); return myAIStoResultMap.contains(anAIS); } @@ -163,25 +162,24 @@ private: }; #endif - /**\class XGUI_Displayer * \ingroup GUI - * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer + * \brief Displayer. Provides mechanizm of display/erase of objects in the + * viewer */ -class XGUI_EXPORT XGUI_Displayer : public QObject -{ +class XGUI_EXPORT XGUI_Displayer : public QObject { Q_OBJECT public: /// \enum DisplayMode display mode enum DisplayMode { NoMode = -1, ///< Mode is not defined - Wireframe, ///< Wireframe display mode - Shading ///< Shading display mode + Wireframe, ///< Wireframe display mode + Shading ///< Shading display mode }; /// Constructor /// \param theWorkshop a workshop instance - XGUI_Displayer(XGUI_Workshop* theWorkshop); + XGUI_Displayer(XGUI_Workshop *theWorkshop); /// Destructor virtual ~XGUI_Displayer(); @@ -192,94 +190,95 @@ public: /// Display the feature. Obtain the visualized object from the feature. /// \param theObject an object to display - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return true if the object visibility state is changed bool display(ObjectPtr theObject, bool theUpdateViewer = true); /// Display the given AIS object. /// This object is not added to the displayer internal map of objects - /// So, it can not be obtained from displayer. This is just a wrap method of OCC display in - /// order to perform the display with correct flags. - /// \param theAIS AIOS object to display - /// \param toActivateInSelectionModes boolean value whether the presentation should be - /// activated in the current selection modes - /// \param theDisplayMode mode how the presentation should be displayed - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// So, it can not be obtained from displayer. This is just a wrap method of + /// OCC display in order to perform the display with correct flags. \param + /// theAIS AIOS object to display \param toActivateInSelectionModes boolean + /// value whether the presentation should be activated in the current + /// selection modes \param theDisplayMode mode how the presentation should be + /// displayed \param theUpdateViewer the parameter whether the viewer should + /// be update immediatelly \return true if the object visibility state is + /// changed bool displayAIS(AISObjectPtr theAIS, const bool toActivateInSelectionModes, - const Standard_Integer theDisplayMode = 0, bool theUpdateViewer = true); + const Standard_Integer theDisplayMode = 0, + bool theUpdateViewer = true); /// Redisplay the shape if it was displayed /// \param theObject an object instance - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return true if the object visibility state is changed bool redisplay(ObjectPtr theObject, bool theUpdateViewer = true); /// Sends and flushes a signal to redisplay all visualized objects. void redisplayObjects(); - /// Add presentations to current selection. It unhighlight and deselect the current selection. - /// The shape and result components are processed in the values. If the presentation shape is not - /// empty, select it, otherwise select the result. - /// \param theValues a list of presentation to be selected - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - void setSelected(const QList>& theValues, - bool theUpdateViewer = true); + /// Add presentations to current selection. It unhighlight and deselect the + /// current selection. The shape and result components are processed in the + /// values. If the presentation shape is not empty, select it, otherwise + /// select the result. \param theValues a list of presentation to be selected + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly + void + setSelected(const QList> &theValues, + bool theUpdateViewer = true); /// Unselect all objects - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \param theUpdateViewer the parameter to update viewer + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \param theUpdateViewer the parameter to update viewer void clearSelected(const bool theUpdateViewer = true); /// Erase the feature and a shape. /// \param theObject an object instance - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return true if the object visibility state is changed bool erase(ObjectPtr theObject, const bool theUpdateViewer = true); /// Erase the given AIS object displayed by corresponded display method /// \param theAIS instance of AIS object - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return true if the object visibility state is changed bool eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer = true); /// Erase all presentations - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return true if the object visibility state is changed bool eraseAll(const bool theUpdateViewer = true); /// Remove default selection filters of the module from the current viewer - /// \param theAddFilterOnly if is not 'true' it will deactivate all fiters in viewer + /// \param theAddFilterOnly if is not 'true' it will deactivate all fiters in + /// viewer void deactivateSelectionFilters(const bool theAddFilterOnly = true); /// \brief Add selection filter /// \param theFilter a filter instance - void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// \brief Remove selection filter /// \param theFilter a filter instance - void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + void removeSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// Returns true if the selection filter is set to the viewer /// \param theFilter a selection filter - virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// Remove all selection filters void removeFilters(); /// Sets a flag to the displayer whether the internal viewer can be updated by - /// the updateViewer method call. If it is not enabled, this method do nothing. - /// This state maintain recurse, if the update is blocked twice or three times, the - /// viewer will not be updated until it is unblocked necessary times - /// (twice or three in the example). - /// \param isEnabled a boolean value + /// the updateViewer method call. If it is not enabled, this method do + /// nothing. This state maintain recurse, if the update is blocked twice or + /// three times, the viewer will not be updated until it is unblocked + /// necessary times (twice or three in the example). \param isEnabled a + /// boolean value bool enableUpdateViewer(const bool isEnabled); /// Returns true if the viewer update is not blocked - bool isUpdateEnabled() const - { - return myViewerBlockedRecursiveCount == 0; - } + bool isUpdateEnabled() const { return myViewerBlockedRecursiveCount == 0; } /// Updates the viewer void updateViewer() const; @@ -292,21 +291,22 @@ public: /// Searches the feature by interactive object /// \param theIO an interactive object /// \return feature the feature or NULL if it not visualized - ObjectPtr getObject(const AISObjectPtr& theIO) const; + ObjectPtr getObject(const AISObjectPtr &theIO) const; /// Searches the feature by interactive object /// \param theIO an interactive object /// \return corresponded object or NULL if it not found - ObjectPtr getObject(const Handle(AIS_InteractiveObject)& theIO) const; + ObjectPtr getObject(const Handle(AIS_InteractiveObject) & theIO) const; /// Deactivates the given objects (not allow selection) /// \param theObjList - list of objects which has to be deactivated. /// \param theUpdateViewer update viewer flag - void deactivateObjects(const QObjectPtrList& theObjList, - const bool theUpdateViewer = true); + void deactivateObjects(const QObjectPtrList &theObjList, + const bool theUpdateViewer = true); /// Sets display mode for the given object if this object is displayed - void setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool theUpdateViewer = true); + void setDisplayMode(ObjectPtr theObject, DisplayMode theMode, + bool theUpdateViewer = true); /// Returns current display mode for the given object. /// If object is not dis played then returns NoMode. @@ -315,7 +315,7 @@ public: /// Displays only objects listed in the list /// \param theList list of objects - void showOnly(const QObjectPtrList& theList); + void showOnly(const QObjectPtrList &theList); /// Returns number of displayed objects int objectsCount() const { return myResult2AISObjectMap.size(); } @@ -331,13 +331,11 @@ public: /// Returns list of displayed objects #ifdef OPTIMIZE_PRS - QList displayedPresentations() const - { + QList displayedPresentations() const { return myResult2AISObjectMap.presentations(); } #else - QList displayedPresentations() const - { + QList displayedPresentations() const { return myResult2AISObjectMap.values(); } #endif @@ -351,25 +349,26 @@ public: /// \param theColor a color which has to be set /// \param theUpdateViewer update viewer flag /// \return previously defined color on the object - QColor setObjectColor(ObjectPtr theObject, const QColor& theColor, bool theUpdateViewer = true); + QColor setObjectColor(ObjectPtr theObject, const QColor &theColor, + bool theUpdateViewer = true); - /// Displays/erases thrihedron in current modes. It will be activated or deactivated - /// depending on the trihedron visible state and displayer active trihedron state + /// Displays/erases thrihedron in current modes. It will be activated or + /// deactivated depending on the trihedron visible state and displayer active + /// trihedron state void displayTrihedron(bool theToDisplay) const; #ifdef TINSPECTOR - void setCallBack(const Handle(VInspectorAPI_CallBack)& theCallBack) - { myVCallBack = theCallBack; } + void setCallBack(const Handle(VInspectorAPI_CallBack) & theCallBack) { + myVCallBack = theCallBack; + } Handle(VInspectorAPI_CallBack) getCallBack() const { return myVCallBack; } #endif - /// Return true if the object is visible. If the object is feature, it returns true - /// if all results of the feature are shown - /// \param theDisplayer a displayer - /// \param theObject an object - /// \return a boolean value - static bool isVisible(XGUI_Displayer* theDisplayer, const ObjectPtr& theObject); - + /// Return true if the object is visible. If the object is feature, it returns + /// true if all results of the feature are shown \param theDisplayer a + /// displayer \param theObject an object \return a boolean value + static bool isVisible(XGUI_Displayer *theDisplayer, + const ObjectPtr &theObject); /// Returns screen plane of active view GeomPlanePtr getScreenPlane() const; @@ -379,7 +378,7 @@ public: /// Set color of selection /// \param theColor R,G,B values of color - void setSelectionColor(const std::vector& theColor); + void setSelectionColor(const std::vector &theColor); /// Returns current selection color std::vector selectionColor() const; @@ -395,34 +394,34 @@ signals: /// \param theAIS a presentation object void beforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS); - protected: +protected: /// Returns currently installed AIS_InteractiveContext Handle(AIS_InteractiveContext) AISContext() const; - /// Returns the viewer context top filter. If there is no a filter, it is created and set into - /// The context should have only this filter inside. Other filters should be add to the filter + /// Returns the viewer context top filter. If there is no a filter, it is + /// created and set into The context should have only this filter inside. + /// Other filters should be add to the filter Handle(SelectMgr_AndFilter) GetFilter(); - /// Display the feature and a shape. This shape would be associated to the given feature - /// \param theObject an object instance - /// \param theAIS AIS presentation - /// \param isShading flag to show in shading mode - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return true if the object visibility state is changed + /// Display the feature and a shape. This shape would be associated to the + /// given feature \param theObject an object instance \param theAIS AIS + /// presentation \param isShading flag to show in shading mode \param + /// theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return true if the object visibility state is changed bool display(ObjectPtr theObject, AISObjectPtr theAIS, bool isShading, bool theUpdateViewer = true); private: - /// Update the object presentable properties such as color, lines width and other - /// If the object is result with the color attribute value set, it is used, - /// otherwise the customize is applyed to the object's feature if it is a custom prs - /// \param theObject an object instance - /// \return the true state if there is changes and the presentation is customized + /// Update the object presentable properties such as color, lines width and + /// other If the object is result with the color attribute value set, it is + /// used, otherwise the customize is applyed to the object's feature if it is + /// a custom prs \param theObject an object instance \return the true state if + /// there is changes and the presentation is customized bool customizeObject(ObjectPtr theObject); - /// Append the objects in the internal map. Checks whether the map already contains the object - /// \param theObject an object to display - /// \param theAIS AIOS object to display + /// Append the objects in the internal map. Checks whether the map already + /// contains the object \param theObject an object to display \param theAIS + /// AIOS object to display void appendResultObject(ObjectPtr theObject, AISObjectPtr theAIS); #ifdef _DEBUG @@ -431,46 +430,53 @@ private: std::string getResult2AISObjectMapInfo() const; #endif - /// Returns container of visible presentations for the object. For a feature object, - /// the feature results are processed also. The presentations map is not cleared inside. - /// \param theObject a feature or result - /// \param thePresentations result map of presentations - void getPresentations(const ObjectPtr& theObject, - NCollection_Map& thePresentations); - - /// Sets the shapes selected in the context. It contains logic of the similar method - /// in OCCT but improved for performance. The modification is to iterates by a list - /// of owners in the context only once. - /// \param theContext a viewer context. It has opened local context - /// \param theShapesToBeSelected a map of shapes. Owner's shape is searched in the map and the - /// owner is selected if it is found there. - /// Only first owner is processed(according to OCCT logic) - static void AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext, - const NCollection_DataMap>& theShapesToBeSelected); + /// Returns container of visible presentations for the object. For a feature + /// object, the feature results are processed also. The presentations map is + /// not cleared inside. \param theObject a feature or result \param + /// thePresentations result map of presentations + void getPresentations( + const ObjectPtr &theObject, + NCollection_Map &thePresentations); + + /// Sets the shapes selected in the context. It contains logic of the similar + /// method in OCCT but improved for performance. The modification is to + /// iterates by a list of owners in the context only once. \param theContext a + /// viewer context. It has opened local context \param theShapesToBeSelected a + /// map of shapes. Owner's shape is searched in the map and the owner is + /// selected if it is found there. Only first owner is processed(according to + /// OCCT logic) + static void AddOrRemoveSelectedShapes( + Handle(AIS_InteractiveContext) theContext, + const NCollection_DataMap> + &theShapesToBeSelected); private: - XGUI_SelectionActivate* selectionActivate() const; + XGUI_SelectionActivate *selectionActivate() const; private: - XGUI_Workshop* myWorkshop; ///< Reference to workshop + XGUI_Workshop *myWorkshop; ///< Reference to workshop #ifdef TINSPECTOR Handle(VInspectorAPI_CallBack) myVCallBack; #endif - Handle(SelectMgr_AndFilter) myAndFilter; ///< A container for selection filters + Handle(SelectMgr_AndFilter) + myAndFilter; ///< A container for selection filters - /// Definition of a type of map which defines correspondance between objects and presentations + /// Definition of a type of map which defines correspondance between objects + /// and presentations #ifdef OPTIMIZE_PRS - XGUI_TwoSidePresentationMap myResult2AISObjectMap; ///< A map of displayed objects + XGUI_TwoSidePresentationMap + myResult2AISObjectMap; ///< A map of displayed objects #else typedef QMap ResultToAISMap; ResultToAISMap myResult2AISObjectMap; ///< A map of displayed objects #endif - /// Number of blocking of the viewer update. The viewer is updated only if it is zero + /// Number of blocking of the viewer update. The viewer is updated only if it + /// is zero int myViewerBlockedRecursiveCount; - mutable void* myContextId; + mutable void *myContextId; mutable bool myNeedUpdate; ///< A flag that update was requested but not done }; diff --git a/src/XGUI/XGUI_ErrorDialog.cpp b/src/XGUI/XGUI_ErrorDialog.cpp index dbf2cab05..4533e5653 100644 --- a/src/XGUI/XGUI_ErrorDialog.cpp +++ b/src/XGUI/XGUI_ErrorDialog.cpp @@ -14,32 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -#include #include +#include #include #include #include -#include -#include #include +#include +#include -XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent) +XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget *parent) : QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | - Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) -{ - QVBoxLayout* aDlgLay = new QVBoxLayout(this); + Qt::WindowSystemMenuHint | + Qt::WindowCloseButtonHint) { + QVBoxLayout *aDlgLay = new QVBoxLayout(this); setWindowTitle(tr("Application errors")); myErrorLog = new QTextEdit(this); myErrorLog->setReadOnly(true); aDlgLay->addWidget(myErrorLog); - QDialogButtonBox* aButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, - this); + QDialogButtonBox *aButtonBox = + new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this); aDlgLay->addWidget(aButtonBox); aDlgLay->setContentsMargins(2, 2, 2, 2); aDlgLay->setSpacing(2); @@ -50,31 +51,26 @@ XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent) connect(aButtonBox, SIGNAL(rejected()), this, SLOT(clear())); } -XGUI_ErrorDialog::~XGUI_ErrorDialog() -{ -} +XGUI_ErrorDialog::~XGUI_ErrorDialog() {} -void XGUI_ErrorDialog::refresh() -{ +void XGUI_ErrorDialog::refresh() { myErrorLog->clear(); - foreach(QString eachError, myErrors) - { + foreach (QString eachError, myErrors) { myErrorLog->append(eachError); } } -void XGUI_ErrorDialog::clear() -{ +void XGUI_ErrorDialog::clear() { myErrorLog->clear(); myErrors.clear(); QDialog::reject(); } -void XGUI_ErrorDialog::addError(std::shared_ptr theMsg) -{ +void XGUI_ErrorDialog::addError(std::shared_ptr theMsg) { std::string aError = Config_Translator::translate(*theMsg); std::string aCodec = Config_Translator::codec(*theMsg); - QString aMsg = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aError.c_str()); + QString aMsg = + QTextCodec::codecForName(aCodec.c_str())->toUnicode(aError.c_str()); myErrors.append(aMsg); refresh(); if (!isVisible()) { @@ -83,8 +79,7 @@ void XGUI_ErrorDialog::addError(std::shared_ptr theMsg) } } -void XGUI_ErrorDialog::removeError(const QString& theError) -{ +void XGUI_ErrorDialog::removeError(const QString &theError) { myErrors.removeAll(theError); refresh(); } diff --git a/src/XGUI/XGUI_ErrorDialog.h b/src/XGUI/XGUI_ErrorDialog.h index de53debb3..1f73bf1e5 100644 --- a/src/XGUI/XGUI_ErrorDialog.h +++ b/src/XGUI/XGUI_ErrorDialog.h @@ -14,33 +14,33 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ERRORDIALOG_H_ #define XGUI_ERRORDIALOG_H_ -#include -#include #include +#include +#include class QTextEdit; /** -* \ingroup GUI -* A class of dialog to show error message -*/ -class XGUI_ErrorDialog : public QDialog -{ -Q_OBJECT - public: - /// Constructor - /// \param parent a parent widget - XGUI_EXPORT XGUI_ErrorDialog(QWidget* parent); + * \ingroup GUI + * A class of dialog to show error message + */ +class XGUI_ErrorDialog : public QDialog { + Q_OBJECT +public: + /// Constructor + /// \param parent a parent widget + XGUI_EXPORT XGUI_ErrorDialog(QWidget *parent); XGUI_EXPORT virtual ~XGUI_ErrorDialog(); - public slots: - /// Update dialog box +public slots: + /// Update dialog box XGUI_EXPORT void refresh(); /// Clear messages @@ -50,11 +50,11 @@ Q_OBJECT XGUI_EXPORT void addError(std::shared_ptr theMsg); /// Remove error message - XGUI_EXPORT void removeError(const QString&); + XGUI_EXPORT void removeError(const QString &); - private: - /// Widget for error log - QTextEdit* myErrorLog; +private: + /// Widget for error log + QTextEdit *myErrorLog; /// List of errors QStringList myErrors; diff --git a/src/XGUI/XGUI_ErrorMgr.cpp b/src/XGUI/XGUI_ErrorMgr.cpp index d445fed2d..b142b3003 100644 --- a/src/XGUI/XGUI_ErrorMgr.cpp +++ b/src/XGUI/XGUI_ErrorMgr.cpp @@ -14,19 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_ErrorMgr.h" -#include "XGUI_OperationMgr.h" +#include "XGUI_ActionsMgr.h" #include "XGUI_ModuleConnector.h" +#include "XGUI_OperationMgr.h" #include "XGUI_Workshop.h" -#include "XGUI_ActionsMgr.h" +#include #include #include -#include #include #include @@ -37,12 +38,11 @@ #include #include -#include #include #include +#include #include #include -#include #include #include @@ -50,29 +50,22 @@ const QString INVALID_VALUE = "invalid_action"; //#define DEBUG_ERROR_STATE -XGUI_ErrorMgr::XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop) - : ModuleBase_IErrorMgr(theParent), - myWorkshop(theWorkshop), - myErrorDialog(0), - myErrorLabel(0), - myAcceptToolTip(""), - myAcceptAllToolTip(""), - myAcceptStatusTip(""), - myAcceptAllStatusTip("") -{ -} +XGUI_ErrorMgr::XGUI_ErrorMgr(QObject *theParent, + ModuleBase_IWorkshop *theWorkshop) + : ModuleBase_IErrorMgr(theParent), myWorkshop(theWorkshop), + myErrorDialog(0), myErrorLabel(0), myAcceptToolTip(""), + myAcceptAllToolTip(""), myAcceptStatusTip(""), myAcceptAllStatusTip("") {} -XGUI_ErrorMgr::~XGUI_ErrorMgr() -{ -} +XGUI_ErrorMgr::~XGUI_ErrorMgr() {} -void XGUI_ErrorMgr::updateActions(const FeaturePtr& theFeature) -{ - //update Ok Action and header of property panel if the current operation started for the feature - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (workshop()->operationMgr()->currentOperation()); +void XGUI_ErrorMgr::updateActions(const FeaturePtr &theFeature) { + // update Ok Action and header of property panel if the current operation + // started for the feature + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + workshop()->operationMgr()->currentOperation()); if (aFOperation && aFOperation->feature() == theFeature) { - ModuleBase_ModelWidget* anActiveWidget = activeWidget(); + ModuleBase_ModelWidget *anActiveWidget = activeWidget(); bool isApplyEnabledByActiveWidget = false; if (anActiveWidget) isApplyEnabledByActiveWidget = anActiveWidget->getValueState() == @@ -94,71 +87,79 @@ void XGUI_ErrorMgr::updateActions(const FeaturePtr& theFeature) QString anInfo = ModuleBase_Tools::objectInfo(theFeature); QString aResultInfo = QString("valid = %1, anError = %2, aWidgetError = %3") - .arg(anError.isEmpty()).arg(anError).arg(aWidgetError); - qDebug(QString("XGUI_ErrorMgr::updateActions for %1, result: %2").arg(anInfo) - .arg(aResultInfo).toStdString().c_str()); + .arg(anError.isEmpty()) + .arg(anError) + .arg(aWidgetError); + qDebug(QString("XGUI_ErrorMgr::updateActions for %1, result: %2") + .arg(anInfo) + .arg(aResultInfo) + .toStdString() + .c_str()); #endif } } -void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr& theFeature) -{ +void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr &theFeature) { if (myAcceptAllToolTip.isEmpty() && myAcceptToolTip.isEmpty()) storeInitialActionValues(); QString anError = ""; /// to allow the module have the button always enabled - bool isActionStateEnabled = - myWorkshop->module()->isActionEnableStateFixed(XGUI_ActionsMgr::AcceptAll); + bool isActionStateEnabled = myWorkshop->module()->isActionEnableStateFixed( + XGUI_ActionsMgr::AcceptAll); if (!isActionStateEnabled) { anError = myWorkshop->module()->getFeatureError(theFeature); if (anError.isEmpty()) { - ModuleBase_ModelWidget* anActiveWidget = activeWidget(); + ModuleBase_ModelWidget *anActiveWidget = activeWidget(); if (anActiveWidget) anError = anActiveWidget->getError(); } } - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); + XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); if (workshop()->isFeatureOfNested(theFeature)) { - QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); + QAction *anAcceptAllAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); bool anEnabled = anError.isEmpty(); anAcceptAllAction->setEnabled(anEnabled); anAcceptAllAction->setToolTip(!anEnabled ? anError : myAcceptAllToolTip); - anAcceptAllAction->setStatusTip(!anEnabled ? anError : myAcceptAllStatusTip); + anAcceptAllAction->setStatusTip(!anEnabled ? anError + : myAcceptAllStatusTip); } } -bool XGUI_ErrorMgr::isApplyEnabled() const -{ +bool XGUI_ErrorMgr::isApplyEnabled() const { bool isEnabled = false; - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (workshop()->operationMgr()->currentOperation()); + XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + workshop()->operationMgr()->currentOperation()); if (aFOperation) { - QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); + QAction *anOkAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); isEnabled = anOkAction && anOkAction->isEnabled(); } return isEnabled; } -void XGUI_ErrorMgr::storeInitialActionValues() -{ - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); +void XGUI_ErrorMgr::storeInitialActionValues() { + XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); + QAction *anAcceptAllAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); myAcceptAllToolTip = anAcceptAllAction->toolTip(); myAcceptAllStatusTip = anAcceptAllAction->statusTip(); - QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); + QAction *anOkAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); myAcceptToolTip = anOkAction->toolTip(); myAcceptStatusTip = anOkAction->toolTip(); } -void XGUI_ErrorMgr::updateAcceptActionState(const QString& theError) -{ - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - QAction* anAcceptAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); - QAction* anAcceptPlusAction = - anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptPlus); +void XGUI_ErrorMgr::updateAcceptActionState(const QString &theError) { + XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); + QAction *anAcceptAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); + QAction *anAcceptPlusAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptPlus); if (myAcceptAllToolTip.isEmpty() && myAcceptToolTip.isEmpty()) storeInitialActionValues(); @@ -168,17 +169,18 @@ void XGUI_ErrorMgr::updateAcceptActionState(const QString& theError) anAcceptPlusAction->setEnabled(anEnabled); anAcceptAction->setToolTip(anEnabled ? myAcceptToolTip : theError); anAcceptAction->setStatusTip(anEnabled ? myAcceptStatusTip : theError); - // some operations have no property panel, so it is important to check that it is not null + // some operations have no property panel, so it is important to check that it + // is not null if (myPropertyPanel) { // update controls error information - QWidget* aWidget = myPropertyPanel->headerWidget(); + QWidget *aWidget = myPropertyPanel->headerWidget(); if (aWidget) aWidget->setToolTip(theError); } } -void XGUI_ErrorMgr::onWidgetChanged() -{ - ModuleBase_ModelWidget* aModelWidget = dynamic_cast(sender()); +void XGUI_ErrorMgr::onWidgetChanged() { + ModuleBase_ModelWidget *aModelWidget = + dynamic_cast(sender()); if (!aModelWidget || !aModelWidget->feature().get()) return; @@ -186,20 +188,21 @@ void XGUI_ErrorMgr::onWidgetChanged() updateToolTip(aModelWidget, aWidgetError); } -void XGUI_ErrorMgr::updateToolTip(ModuleBase_ModelWidget* theWidget, - const QString& theError) -{ +void XGUI_ErrorMgr::updateToolTip(ModuleBase_ModelWidget *theWidget, + const QString &theError) { if (!theWidget) return; - QList aWidgetList = theWidget->getControls(); - foreach(QWidget* aWidget, aWidgetList) { - QLabel* aLabel = qobject_cast(aWidget); + QList aWidgetList = theWidget->getControls(); + foreach (QWidget *aWidget, aWidgetList) { + QLabel *aLabel = qobject_cast(aWidget); // We won't set the effect to QLabels - it looks ugly - if (aLabel) continue; + if (aLabel) + continue; // Get the original tool tip of the widget - QString aTTip = aWidget->toolTip().section(tr("Errors:") + "\n", 0, 0).trimmed(); + QString aTTip = + aWidget->toolTip().section(tr("Errors:") + "\n", 0, 0).trimmed(); // Add the error message into the tool tip if (!theError.isEmpty()) { if (!aTTip.isEmpty()) @@ -207,28 +210,28 @@ void XGUI_ErrorMgr::updateToolTip(ModuleBase_ModelWidget* theWidget, aTTip += tr("Errors:") + "\n" + theError; } aWidget->setToolTip(aTTip); - //aWidget->setStyleSheet(anError.isEmpty() ? "" : "background-color:pink;"); + // aWidget->setStyleSheet(anError.isEmpty() ? "" : + // "background-color:pink;"); } } -XGUI_Workshop* XGUI_ErrorMgr::workshop() const -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); +XGUI_Workshop *XGUI_ErrorMgr::workshop() const { + XGUI_ModuleConnector *aConnector = + dynamic_cast(myWorkshop); return aConnector->workshop(); } -ModuleBase_ModelWidget* XGUI_ErrorMgr::activeWidget() const -{ - ModuleBase_ModelWidget* anActiveWidget = 0; +ModuleBase_ModelWidget *XGUI_ErrorMgr::activeWidget() const { + ModuleBase_ModelWidget *anActiveWidget = 0; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (workshop()->operationMgr()->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + workshop()->operationMgr()->currentOperation()); if (aFOperation) { - ModuleBase_IPropertyPanel* aPropertyPanel = aFOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPropertyPanel = aFOperation->propertyPanel(); if (aPropertyPanel) { anActiveWidget = aPropertyPanel->activeWidget(); } } return anActiveWidget; } - diff --git a/src/XGUI/XGUI_ErrorMgr.h b/src/XGUI/XGUI_ErrorMgr.h index 9b71b63ac..128f44767 100644 --- a/src/XGUI/XGUI_ErrorMgr.h +++ b/src/XGUI/XGUI_ErrorMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ErrorMgr_H @@ -22,8 +23,8 @@ #include "XGUI.h" -#include #include +#include class XGUI_Workshop; class ModuleBase_IWorkshop; @@ -38,24 +39,23 @@ class QLabel; * \ingroup GUI * \brief Class of Errors manager object */ -class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr -{ +class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr { Q_OBJECT public: /// Constructor /// \param theParent a parent object /// \param theWorkshop a workshop object - XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop); + XGUI_ErrorMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop); /// Virtual destructor virtual ~XGUI_ErrorMgr(); /// Update actions for the given feature /// \param theFeature a feature - virtual void updateActions(const FeaturePtr& theFeature); + virtual void updateActions(const FeaturePtr &theFeature); /// Update enable state of AcceptAll action if the feature uses it /// \param theFeature a feature - void updateAcceptAllAction(const FeaturePtr& theFeature); + void updateAcceptAllAction(const FeaturePtr &theFeature); /// Returns true if the apply is enabled for the current feature bool isApplyEnabled() const; @@ -65,35 +65,38 @@ protected slots: virtual void onWidgetChanged(); private: - /// Stores initial values of accept/accept all tool/status tip to internal containers + /// Stores initial values of accept/accept all tool/status tip to internal + /// containers void storeInitialActionValues(); - /// It disables the propety panel Accept action if the error message is not empty - /// The message is set to the header tool tip. - /// \param theAction an action to be changed - /// \param theError an error state - void updateAcceptActionState(const QString& theError); + /// It disables the propety panel Accept action if the error message is not + /// empty The message is set to the header tool tip. \param theAction an + /// action to be changed \param theError an error state + void updateAcceptActionState(const QString &theError); - /// It updates the tool tip of the widget controls according to the widget error - /// \param theWidget a widget - /// \param theError an error state - void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError); + /// It updates the tool tip of the widget controls according to the widget + /// error \param theWidget a widget \param theError an error state + void updateToolTip(ModuleBase_ModelWidget *theWidget, + const QString &theError); /// Returns casted workshop - XGUI_Workshop* workshop() const; + XGUI_Workshop *workshop() const; /// Returns an active widget of the current operation /// \return the widget or zero - ModuleBase_ModelWidget* activeWidget() const; + ModuleBase_ModelWidget *activeWidget() const; private: - ModuleBase_IWorkshop* myWorkshop; /// workshop - QDialog* myErrorDialog; /// contains the error message - QLabel* myErrorLabel; /// contains an error information + ModuleBase_IWorkshop *myWorkshop; /// workshop + QDialog *myErrorDialog; /// contains the error message + QLabel *myErrorLabel; /// contains an error information QString myAcceptToolTip; /// cached tool tip value for enabled Accept action - QString myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action - QString myAcceptStatusTip; /// cached status tip value for enabled Accept action - QString myAcceptAllStatusTip; /// cached status tip value for enabled AcceptAll action + QString + myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action + QString + myAcceptStatusTip; /// cached status tip value for enabled Accept action + QString myAcceptAllStatusTip; /// cached status tip value for enabled + /// AcceptAll action }; -#endif // XGUI_ErrorMgr_H \ No newline at end of file +#endif // XGUI_ErrorMgr_H diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index 73cdb7481..c8761d146 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -14,35 +14,36 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_FacesPanel.h" +#include "XGUI_Displayer.h" #include "XGUI_ObjectsBrowser.h" -#include "XGUI_SelectionMgr.h" #include "XGUI_Selection.h" +#include "XGUI_SelectionMgr.h" #include "XGUI_Tools.h" -#include "XGUI_Workshop.h" -#include "XGUI_Displayer.h" #include "XGUI_ViewerProxy.h" +#include "XGUI_Workshop.h" #include #include -#include #include +#include #include #include +#include #include #include -#include #include #include -#include #include +#include -#include #include +#include #include #include @@ -63,9 +64,8 @@ static const int LayoutMargin = 3; //******************************************************************** -bool getGroup(ModuleBase_ViewerPrsPtr thePrs, ResultGroupPtr& theResGroup, - FeaturePtr& theGroupFeature) -{ +bool getGroup(ModuleBase_ViewerPrsPtr thePrs, ResultGroupPtr &theResGroup, + FeaturePtr &theGroupFeature) { ObjectPtr anObject = thePrs->object(); if (!anObject.get()) return false; @@ -73,18 +73,18 @@ bool getGroup(ModuleBase_ViewerPrsPtr thePrs, ResultGroupPtr& theResGroup, theResGroup = std::dynamic_pointer_cast(anObject); if (theResGroup.get()) { theGroupFeature = ModelAPI_Feature::feature(theResGroup); - } - else { + } else { theGroupFeature = std::dynamic_pointer_cast(anObject); if (theGroupFeature.get()) - theResGroup = std::dynamic_pointer_cast(theGroupFeature->firstResult()); + theResGroup = std::dynamic_pointer_cast( + theGroupFeature->firstResult()); } return theGroupFeature.get() && theResGroup.get(); } //******************************************************************** -void updateHiddenShapes(Handle(ModuleBase_ResultPrs) thePrs, const TopoDS_ListOfShape& theShapes) -{ +void updateHiddenShapes(Handle(ModuleBase_ResultPrs) thePrs, + const TopoDS_ListOfShape &theShapes) { TopoDS_ListOfShape aAlreadyHidden = thePrs->hiddenSubShapes(); TopoDS_ListOfShape::Iterator aShPIt(theShapes); for (; aShPIt.More(); aShPIt.Next()) { @@ -95,24 +95,28 @@ void updateHiddenShapes(Handle(ModuleBase_ResultPrs) thePrs, const TopoDS_ListOf } //******************************************************************** -XGUI_FacesPanel::XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop) - : QDockWidget(theParent), myWorkshop(theWorkshop), myIsActive(false), myLastItemIndex(0) -{ +XGUI_FacesPanel::XGUI_FacesPanel(QWidget *theParent, XGUI_Workshop *theWorkshop) + : QDockWidget(theParent), myWorkshop(theWorkshop), myIsActive(false), + myLastItemIndex(0) { setWindowTitle(tr("Hide Faces")); setObjectName("Hide Faces"); - MAYBE_UNUSED QAction* aViewAct = toggleViewAction(); - setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); + MAYBE_UNUSED QAction *aViewAct = toggleViewAction(); + setStyleSheet("::title { position: relative; padding-left: 5px; text-align: " + "left center }"); - QWidget* aContent = new QWidget(this); - QGridLayout* aMainLayout = new QGridLayout(aContent); - aMainLayout->setContentsMargins(LayoutMargin, LayoutMargin, LayoutMargin, LayoutMargin); + QWidget *aContent = new QWidget(this); + QGridLayout *aMainLayout = new QGridLayout(aContent); + aMainLayout->setContentsMargins(LayoutMargin, LayoutMargin, LayoutMargin, + LayoutMargin); setWidget(aContent); myHiddenOrTransparent = new QCheckBox(tr("Transparent"), aContent); - connect(myHiddenOrTransparent, SIGNAL(toggled(bool)), SLOT(onTransparencyChanged())); + connect(myHiddenOrTransparent, SIGNAL(toggled(bool)), + SLOT(onTransparencyChanged())); - myListView = new ModuleBase_ListView(aContent, "", "Hidden/transparent faces in 3D view"); + myListView = new ModuleBase_ListView(aContent, "", + "Hidden/transparent faces in 3D view"); connect(myListView, SIGNAL(deleteActionClicked()), SLOT(onDeleteItem())); aMainLayout->addWidget(myHiddenOrTransparent, 0, 0); @@ -121,20 +125,20 @@ XGUI_FacesPanel::XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop) myListView->getControl()->setFocusPolicy(Qt::StrongFocus); myListView->getControl()->viewport()->installEventFilter(this); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); connect(aDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)), - SLOT(onObjectDisplay(ObjectPtr, AISObjectPtr))); + SLOT(onObjectDisplay(ObjectPtr, AISObjectPtr))); } //******************************************************************** -void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) -{ - if (myLastItemIndex == 0) // do nothing because there was no activity in the pane after reset +void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) { + if (myLastItemIndex == + 0) // do nothing because there was no activity in the pane after reset return; std::map anObjectToShapes; - std::map anObjectToPrs; - QMap::const_iterator aIt; + std::map anObjectToPrs; + QMap::const_iterator aIt; for (aIt = myItems.cbegin(); aIt != myItems.cend(); aIt++) { getObjectsMapFromPrs(aIt.value(), anObjectToShapes, anObjectToPrs); } @@ -142,12 +146,14 @@ void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) std::set aObjects; TopoDS_ListOfShape anEmpty; std::map::const_iterator aPrsIt; - for (aPrsIt = anObjectToPrs.cbegin(); aPrsIt != anObjectToPrs.cend(); aPrsIt++) { + for (aPrsIt = anObjectToPrs.cbegin(); aPrsIt != anObjectToPrs.cend(); + aPrsIt++) { aObjects.insert(aPrsIt->first); aPrsIt->second->setSubShapeHidden(anEmpty); } - std::set::const_iterator aGrpIt; - for (aGrpIt = myHiddenGroups.cbegin(); aGrpIt != myHiddenGroups.cend(); aGrpIt++) + std::set::const_iterator aGrpIt; + for (aGrpIt = myHiddenGroups.cbegin(); aGrpIt != myHiddenGroups.cend(); + aGrpIt++) (*aGrpIt)->setDisplayed(true); myHiddenGroups.clear(); @@ -163,35 +169,31 @@ void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) } //******************************************************************** -bool XGUI_FacesPanel::isEmpty() const -{ - return myItems.size() == 0; -} +bool XGUI_FacesPanel::isEmpty() const { return myItems.size() == 0; } //******************************************************************** -void XGUI_FacesPanel::selectionModes(QIntList& theModes) -{ +void XGUI_FacesPanel::selectionModes(QIntList &theModes) { theModes.append(TopAbs_FACE); } //******************************************************************** -void XGUI_FacesPanel::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) -{ - ModuleBase_IModule* aModule = myWorkshop->module(); +void XGUI_FacesPanel::selectionFilters( + SelectMgr_ListOfFilter &theSelectionFilters) { + ModuleBase_IModule *aModule = myWorkshop->module(); QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); - // The global filter makes problem for groups selection when any operation is launched + // The global filter makes problem for groups selection when any operation is + // launched // theSelectionFilters.Append(aModule->selectionFilter(SF_GlobalFilter)); theSelectionFilters.Append(aModule->selectionFilter(SF_FilterInfinite)); - theSelectionFilters.Append(aModule->selectionFilter(SF_ResultGroupNameFilter)); + theSelectionFilters.Append( + aModule->selectionFilter(SF_ResultGroupNameFilter)); } //******************************************************************** -bool XGUI_FacesPanel::eventFilter(QObject* theObject, QEvent *theEvent) -{ - QWidget* aWidget = qobject_cast(theObject); - if (theEvent->type() == QEvent::MouseButtonRelease) - { +bool XGUI_FacesPanel::eventFilter(QObject *theObject, QEvent *theEvent) { + QWidget *aWidget = qobject_cast(theObject); + if (theEvent->type() == QEvent::MouseButtonRelease) { if (myListView->getControl()->viewport() == aWidget) setActivePanel(true); } @@ -200,8 +202,7 @@ bool XGUI_FacesPanel::eventFilter(QObject* theObject, QEvent *theEvent) } //******************************************************************** -void XGUI_FacesPanel::setActivePanel(const bool theIsActive) -{ +void XGUI_FacesPanel::setActivePanel(const bool theIsActive) { if (myIsActive == theIsActive) return; @@ -210,38 +211,35 @@ void XGUI_FacesPanel::setActivePanel(const bool theIsActive) if (myIsActive) { emit activated(); - // selection should be cleared after emit of signal to do not process selection change - // event by the previous selector - // the selection is cleared by activating selection control + // selection should be cleared after emit of signal to do not process + // selection change event by the previous selector the selection is cleared + // by activating selection control myWorkshop->selector()->clearSelection(); - } - else{ + } else { emit deactivated(); myUndoList.clear(); } } //******************************************************************** -bool XGUI_FacesPanel::useTransparency() const -{ +bool XGUI_FacesPanel::useTransparency() const { return myHiddenOrTransparent->isChecked(); } //******************************************************************** -double XGUI_FacesPanel::transparency() const -{ - return useTransparency() ? - Config_PropManager::real("Visualization", "hidden_face_transparency") : 1; +double XGUI_FacesPanel::transparency() const { + return useTransparency() ? Config_PropManager::real( + "Visualization", "hidden_face_transparency") + : 1; } - //******************************************************************** -void XGUI_FacesPanel::restoreObjects(const std::set& theHiddenObjects) -{ +void XGUI_FacesPanel::restoreObjects( + const std::set &theHiddenObjects) { std::set anIndicesToBeRemoved; - for (QMap::const_iterator anItemsIt = myItems.begin(); - anItemsIt != myItems.end(); anItemsIt++) - { + for (QMap::const_iterator anItemsIt = + myItems.begin(); + anItemsIt != myItems.end(); anItemsIt++) { ModuleBase_ViewerPrsPtr aPrs = anItemsIt.value(); ObjectPtr anObject = aPrs->object(); if (theHiddenObjects.find(anObject) == theHiddenObjects.end()) // not found @@ -256,48 +254,48 @@ void XGUI_FacesPanel::restoreObjects(const std::set& theHiddenObjects // remove from container of hidden objects for (std::set::const_iterator aHiddenIt = theHiddenObjects.begin(); - aHiddenIt != theHiddenObjects.end(); aHiddenIt++) - { - if (myHiddenObjects.find(*aHiddenIt) != myHiddenObjects.end()) /// found objects + aHiddenIt != theHiddenObjects.end(); aHiddenIt++) { + if (myHiddenObjects.find(*aHiddenIt) != + myHiddenObjects.end()) /// found objects myHiddenObjects.erase(*aHiddenIt); } } //******************************************************************** -bool XGUI_FacesPanel::processAction(ModuleBase_ActionType theActionType) -{ +bool XGUI_FacesPanel::processAction(ModuleBase_ActionType theActionType) { switch (theActionType) { - //case ActionEnter: - // return processEnter(); - case ActionEscape: - setActivePanel(false); - return true; - case ActionDelete: - return processDelete(); - //case ActionUndo: - //case ActionRedo: - default: - return false; + // case ActionEnter: + // return processEnter(); + case ActionEscape: + setActivePanel(false); + return true; + case ActionDelete: + return processDelete(); + // case ActionUndo: + // case ActionRedo: + default: + return false; } } //******************************************************************** -void XGUI_FacesPanel::getObjectsMapFromResult(ResultGroupPtr theResGroup, - FeaturePtr theGroupFeature, - std::map& theObjectToShapes, - std::map& theObjectToPrs) -{ - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); +void XGUI_FacesPanel::getObjectsMapFromResult( + ResultGroupPtr theResGroup, FeaturePtr theGroupFeature, + std::map &theObjectToShapes, + std::map &theObjectToPrs) { + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); // Process a grouip result - AttributeSelectionListPtr aSelectionList = theGroupFeature->selectionList("group_list"); + AttributeSelectionListPtr aSelectionList = + theGroupFeature->selectionList("group_list"); AISObjectPtr aPrs; for (int i = 0; i < aSelectionList->size(); i++) { AttributeSelectionPtr aSelection = aSelectionList->value(i); ResultPtr aRes = aSelection->context(); aPrs = aDisplayer->getAISObject(aRes); if (aPrs.get()) { - Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast( - aPrs->impl()); + Handle(ModuleBase_ResultPrs) aResultPrs = + Handle(ModuleBase_ResultPrs)::DownCast( + aPrs->impl()); if (!aResultPrs.IsNull()) { GeomShapePtr aShape = aSelection->value(); if (theObjectToShapes.find(aRes) != theObjectToShapes.end()) @@ -314,22 +312,23 @@ void XGUI_FacesPanel::getObjectsMapFromResult(ResultGroupPtr theResGroup, } //******************************************************************** -void objectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs, - std::map& theObjectToShapes, - std::map& theObjectToPrs) -{ +void objectsMapFromPrs( + ModuleBase_ViewerPrsPtr thePrs, + std::map &theObjectToShapes, + std::map &theObjectToPrs) { ObjectPtr anObject = thePrs->object(); if (!anObject.get()) return; // Process bodies - Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast( - thePrs->interactive()); + Handle(ModuleBase_ResultPrs) aResultPrs = + Handle(ModuleBase_ResultPrs)::DownCast(thePrs->interactive()); if (aResultPrs.IsNull()) return; if (theObjectToShapes.find(anObject) != theObjectToShapes.end()) - theObjectToShapes.at(anObject).Append(ModuleBase_Tools::getSelectedShape(thePrs)); + theObjectToShapes.at(anObject).Append( + ModuleBase_Tools::getSelectedShape(thePrs)); else { TopoDS_ListOfShape aListOfShapes; aListOfShapes.Append(ModuleBase_Tools::getSelectedShape(thePrs)); @@ -339,32 +338,34 @@ void objectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs, } //******************************************************************** -void XGUI_FacesPanel::getObjectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs, - std::map& theObjectToShapes, - std::map& theObjectToPrs) -{ +void XGUI_FacesPanel::getObjectsMapFromPrs( + ModuleBase_ViewerPrsPtr thePrs, + std::map &theObjectToShapes, + std::map &theObjectToPrs) { ResultGroupPtr aResGroup; FeaturePtr aGroupFeature; if (getGroup(thePrs, aResGroup, aGroupFeature)) - getObjectsMapFromResult(aResGroup, aGroupFeature, theObjectToShapes, theObjectToPrs); + getObjectsMapFromResult(aResGroup, aGroupFeature, theObjectToShapes, + theObjectToPrs); else objectsMapFromPrs(thePrs, theObjectToShapes, theObjectToPrs); } //******************************************************************** -void XGUI_FacesPanel::processSelection() -{ +void XGUI_FacesPanel::processSelection() { QList aSelected = - myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Viewer); + myWorkshop->selector()->selection()->getSelected( + ModuleBase_ISelection::Viewer); if (aSelected.size() == 0) return; bool isModified = false; - static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID aDispEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); std::map anObjectToShapes; - std::map anObjectToPrs; + std::map anObjectToPrs; std::set aToRemove; for (int i = 0; i < aSelected.size(); i++) { @@ -377,19 +378,19 @@ void XGUI_FacesPanel::processSelection() FeaturePtr aGroupFeature; if (getGroup(aPrs, aResGroup, aGroupFeature)) { AttributeSelectionListPtr aSelectionListAttr = - aGroupFeature->data()->selectionList("group_list"); + aGroupFeature->data()->selectionList("group_list"); std::string aType = aSelectionListAttr->selectionType(); if (aType != "Faces") continue; - } - else { + } else { GeomShapePtr aShapePtr = aPrs->shape(); if (!aShapePtr.get() || !aShapePtr->isFace()) continue; } - QString aItemName = aResGroup.get()? - QString::fromStdWString(aResGroup->data()->name()) : XGUI_Tools::generateName(aPrs); + QString aItemName = aResGroup.get() + ? QString::fromStdWString(aResGroup->data()->name()) + : XGUI_Tools::generateName(aPrs); if (myListView->hasItem(aItemName)) continue; @@ -398,18 +399,19 @@ void XGUI_FacesPanel::processSelection() aResGroup->setDisplayed(false); myHiddenGroups.insert(aResGroup); } - getObjectsMapFromResult(aResGroup, aGroupFeature, anObjectToShapes, anObjectToPrs); - } - else + getObjectsMapFromResult(aResGroup, aGroupFeature, anObjectToShapes, + anObjectToPrs); + } else objectsMapFromPrs(aPrs, anObjectToShapes, anObjectToPrs); - // The code is dedicated to remove already selected items if they are selected twice - // It can happen in case of groups selection + // The code is dedicated to remove already selected items if they are + // selected twice It can happen in case of groups selection QMap::const_iterator aIt; for (aIt = myItems.cbegin(); aIt != myItems.cend(); aIt++) { ModuleBase_ViewerPrsPtr aCurPrs = aIt.value(); ObjectPtr aObject = aCurPrs->object(); - ResultGroupPtr aCurResGroup = std::dynamic_pointer_cast(aObject); + ResultGroupPtr aCurResGroup = + std::dynamic_pointer_cast(aObject); if (aCurResGroup.get()) continue; if (anObjectToShapes.find(aObject) != anObjectToShapes.end()) { @@ -431,7 +433,8 @@ void XGUI_FacesPanel::processSelection() // Hide fully hidden shapes std::map::const_iterator anIt; - for (anIt = anObjectToShapes.begin(); anIt != anObjectToShapes.end(); anIt++) { + for (anIt = anObjectToShapes.begin(); anIt != anObjectToShapes.end(); + anIt++) { ObjectPtr anObject = anIt->first; if (!anObject.get() || anObjectToPrs.find(anObject) == anObjectToPrs.end()) continue; @@ -448,7 +451,8 @@ void XGUI_FacesPanel::processSelection() // Process selected presentations double aTransp = transparency(); std::map::iterator aPrsIt; - for (aPrsIt = anObjectToPrs.begin(); aPrsIt != anObjectToPrs.end(); aPrsIt++) { + for (aPrsIt = anObjectToPrs.begin(); aPrsIt != anObjectToPrs.end(); + aPrsIt++) { ObjectPtr anObject = aPrsIt->first; Handle(ModuleBase_ResultPrs) aPrs = aPrsIt->second; TopoDS_ListOfShape aAlreadyHidden = aPrs->hiddenSubShapes(); @@ -471,10 +475,10 @@ void XGUI_FacesPanel::processSelection() } //******************************************************************** -bool XGUI_FacesPanel::processDelete() -{ - //appendFirstSelectionInHistory(); - //QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes(); +bool XGUI_FacesPanel::processDelete() { + // appendFirstSelectionInHistory(); + // QModelIndexList anIndices = + // myListView->getControl()->selectionModel()->selectedIndexes(); std::set aSelectedIds; myListView->getSelectedIndices(aSelectedIds); @@ -491,7 +495,7 @@ bool XGUI_FacesPanel::processDelete() } } std::map anObjectToShapes; - std::map anObjectToPrs; + std::map anObjectToPrs; std::set::const_iterator aIt; for (aIt = aRestored.cbegin(); aIt != aRestored.cend(); aIt++) { @@ -499,7 +503,7 @@ bool XGUI_FacesPanel::processDelete() ResultGroupPtr aResGroup; FeaturePtr aGroupFeature; if (getGroup((*aIt), aResGroup, aGroupFeature)) { - std::set::iterator aGrpIt = myHiddenGroups.find(aResGroup); + std::set::iterator aGrpIt = myHiddenGroups.find(aResGroup); if (aGrpIt != myHiddenGroups.end()) { aResGroup->setDisplayed(true); myHiddenGroups.erase(aGrpIt); @@ -509,7 +513,8 @@ bool XGUI_FacesPanel::processDelete() std::set aRestoredObjects; std::map::const_iterator aShapesIt; - for (aShapesIt = anObjectToShapes.begin(); aShapesIt != anObjectToShapes.end(); aShapesIt++) { + for (aShapesIt = anObjectToShapes.begin(); + aShapesIt != anObjectToShapes.end(); aShapesIt++) { TopoDS_ListOfShape aShapes = aShapesIt->second; aRestoredObjects.insert(aShapesIt->first); Handle(ModuleBase_ResultPrs) aPrs = anObjectToPrs[aShapesIt->first]; @@ -529,17 +534,15 @@ bool XGUI_FacesPanel::processDelete() } //******************************************************************** -bool XGUI_FacesPanel::redisplayObjects( - const std::set& theObjects) -{ +bool XGUI_FacesPanel::redisplayObjects(const std::set &theObjects) { if (theObjects.empty()) return false; bool isModified = false; - static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - for (std::set::const_iterator anIt = theObjects.begin(); anIt != theObjects.end(); - anIt++) - { + static Events_ID aDispEvent = + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + for (std::set::const_iterator anIt = theObjects.begin(); + anIt != theObjects.end(); anIt++) { ObjectPtr anObject = *anIt; if (!anObject->isDisplayed()) continue; @@ -550,25 +553,26 @@ bool XGUI_FacesPanel::redisplayObjects( } //******************************************************************** -void XGUI_FacesPanel::updateProcessedObjects(QMap theItems, - std::set& theObjects) -{ +void XGUI_FacesPanel::updateProcessedObjects( + QMap theItems, + std::set &theObjects) { theObjects.clear(); - for (QMap::const_iterator anIt = theItems.begin(); + for (QMap::const_iterator anIt = + theItems.begin(); anIt != theItems.end(); anIt++) { ModuleBase_ViewerPrsPtr aPrs = anIt.value(); ResultGroupPtr aResGroup; FeaturePtr aGroupFeature; if (getGroup(aPrs, aResGroup, aGroupFeature)) { - AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list"); + AttributeSelectionListPtr aSelectionList = + aGroupFeature->selectionList("group_list"); for (int i = 0; i < aSelectionList->size(); i++) { AttributeSelectionPtr aSelection = aSelectionList->value(i); ResultPtr aRes = aSelection->context(); if (theObjects.find(aRes) == theObjects.end()) theObjects.insert(aRes); } - } - else { + } else { if (theObjects.find(aPrs->object()) == theObjects.end()) theObjects.insert(aPrs->object()); } @@ -576,73 +580,68 @@ void XGUI_FacesPanel::updateProcessedObjects(QMap } //******************************************************************** -void XGUI_FacesPanel::closeEvent(QCloseEvent* theEvent) -{ +void XGUI_FacesPanel::closeEvent(QCloseEvent *theEvent) { QDockWidget::closeEvent(theEvent); emit closed(); } //******************************************************************** -void XGUI_FacesPanel::onDeleteItem() -{ - processDelete(); -} +void XGUI_FacesPanel::onDeleteItem() { processDelete(); } //******************************************************************** -void XGUI_FacesPanel::onTransparencyChanged() -{ +void XGUI_FacesPanel::onTransparencyChanged() { std::map anObjectToShapes; - std::map anObjectToPrs; - QMap::const_iterator aIt; + std::map anObjectToPrs; + QMap::const_iterator aIt; for (aIt = myItems.cbegin(); aIt != myItems.cend(); aIt++) { getObjectsMapFromPrs(aIt.value(), anObjectToShapes, anObjectToPrs); } - double aTransp = Config_PropManager::real("Visualization", "hidden_face_transparency"); + double aTransp = + Config_PropManager::real("Visualization", "hidden_face_transparency"); std::set aObjects; std::map::const_iterator aPrsIt; - for (aPrsIt = anObjectToPrs.cbegin(); aPrsIt != anObjectToPrs.cend(); aPrsIt++) { + for (aPrsIt = anObjectToPrs.cbegin(); aPrsIt != anObjectToPrs.cend(); + aPrsIt++) { aObjects.insert(aPrsIt->first); - aPrsIt->second->setHiddenSubShapeTransparency(useTransparency()? aTransp : 1); + aPrsIt->second->setHiddenSubShapeTransparency(useTransparency() ? aTransp + : 1); } if (redisplayObjects(aObjects)) flushRedisplay(); } //******************************************************************** -void XGUI_FacesPanel::onClosed() -{ +void XGUI_FacesPanel::onClosed() { setActivePanel(false); reset(true); } //******************************************************************** -void XGUI_FacesPanel::processUndo() -{ - if(!myUndoList.size()) - return; +void XGUI_FacesPanel::processUndo() { + if (!myUndoList.size()) + return; - myListView->selectIndices({myUndoList.back()}); - processDelete(); - myUndoList.pop_back(); + myListView->selectIndices({myUndoList.back()}); + processDelete(); + myUndoList.pop_back(); } //******************************************************************** -void XGUI_FacesPanel::flushRedisplay() const -{ - Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); +void XGUI_FacesPanel::flushRedisplay() const { + Events_Loop::loop()->flush( + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); // Necessary for update visibility icons in ObjectBrowser - XGUI_ObjectsBrowser* anObjectBrowser = myWorkshop->objectBrowser(); + XGUI_ObjectsBrowser *anObjectBrowser = myWorkshop->objectBrowser(); if (anObjectBrowser) anObjectBrowser->updateAllIndexes(); myWorkshop->viewer()->update(); } - //******************************************************************** -void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS) -{ +void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, + AISObjectPtr theAIS) { bool aContains = false; QMap::iterator aIt; for (aIt = myItems.begin(); aIt != myItems.end(); aIt++) { @@ -665,11 +664,13 @@ void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS) for (aIt = myItems.begin(); aIt != myItems.end(); aIt++) { ModuleBase_ViewerPrsPtr aPrs = aIt.value(); if (getGroup(aPrs, aResGroup, aGroupFeature)) { - getObjectsMapFromResult(aResGroup, aGroupFeature, aObjectToShapes, aObjectToPrs); + getObjectsMapFromResult(aResGroup, aGroupFeature, aObjectToShapes, + aObjectToPrs); if (aResGroup == theObject) { - // If group is displayed it means that it has to be deleted from the Faces list and all - // corresponded faces have been restored - for (aSIt = aObjectToShapes.begin(); aSIt != aObjectToShapes.end(); aSIt++) { + // If group is displayed it means that it has to be deleted from the + // Faces list and all corresponded faces have been restored + for (aSIt = aObjectToShapes.begin(); aSIt != aObjectToShapes.end(); + aSIt++) { TopoDS_ListOfShape aShapes = aSIt->second; Handle(ModuleBase_ResultPrs) aResPrs = aObjectToPrs[aSIt->first]; TopoDS_ListOfShape aAlreadyHidden = aResPrs->hiddenSubShapes(); @@ -682,10 +683,9 @@ void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS) aObjects.insert(aSIt->first); } aIdsToRem.insert(aIt.key()); - } - else { + } else { std::map::iterator aPIt = - aObjectToPrs.find(theObject); + aObjectToPrs.find(theObject); if (aPIt != aObjectToPrs.end()) { ObjectPtr aObj = aPIt->first; if (aObj == theObject) { @@ -695,8 +695,7 @@ void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS) } } } - } - else { + } else { if (aPrs->object() == theObject) { TopoDS_Shape aShape = aPrs->shape()->impl(); if (!aShape.IsNull()) @@ -707,8 +706,9 @@ void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS) } double aTransp = transparency(); if (aHideShapes.Size() > 0) { - Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast( - theAIS->impl()); + Handle(ModuleBase_ResultPrs) aResultPrs = + Handle(ModuleBase_ResultPrs)::DownCast( + theAIS->impl()); if (!aResultPrs.IsNull()) { aResultPrs->setSubShapeHidden(aHideShapes); aResultPrs->setHiddenSubShapeTransparency(aTransp); @@ -722,8 +722,7 @@ void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS) } } -void XGUI_FacesPanel::removeItems(std::set theIds) -{ +void XGUI_FacesPanel::removeItems(std::set theIds) { if (theIds.empty()) return; myListView->removeItems(theIds); diff --git a/src/XGUI/XGUI_FacesPanel.h b/src/XGUI/XGUI_FacesPanel.h index a76dfa550..ab1a57caf 100644 --- a/src/XGUI/XGUI_FacesPanel.h +++ b/src/XGUI/XGUI_FacesPanel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_FacesPanel_H_ @@ -24,12 +25,12 @@ #include #include -#include #include +#include +#include #include #include -#include #include @@ -37,8 +38,8 @@ #include #include -#include #include +#include #include @@ -54,28 +55,28 @@ class QCheckBox; class QEvent; /** -* \ingroup GUI -* A Hide Faces panel for making it possible to hide faces in the 3D view. -* The panel has multi-selector filled by faces elements. When the control is active -* it is possible to select faces in the viewer. The selected faces are hidden/transparent -* after selection and the corresponding item is appeared in the multi selector. -* -* In order to redisplay a face, it is enough to click delete on the name of this face -* in the multiselector. -* When the panel is opened, the multiselector is empty. -* When the panel is closed, the multiselector is emptied and the faces are displayed again. -* The default position by of this dockable window is to the right of the view (in SALOME mode). -* If no feature is processed (in neutral point), this panel can be activated too. -* On feature edition start or finish, movement of the history line, undo/redo and other -* modification of the model, the multiselector is emptied. -*/ -class XGUI_EXPORT XGUI_FacesPanel : public QDockWidget -{ + * \ingroup GUI + * A Hide Faces panel for making it possible to hide faces in the 3D view. + * The panel has multi-selector filled by faces elements. When the control is + * active it is possible to select faces in the viewer. The selected faces are + * hidden/transparent after selection and the corresponding item is appeared in + * the multi selector. + * + * In order to redisplay a face, it is enough to click delete on the name of + * this face in the multiselector. When the panel is opened, the multiselector + * is empty. When the panel is closed, the multiselector is emptied and the + * faces are displayed again. The default position by of this dockable window is + * to the right of the view (in SALOME mode). If no feature is processed (in + * neutral point), this panel can be activated too. On feature edition start or + * finish, movement of the history line, undo/redo and other modification of the + * model, the multiselector is emptied. + */ +class XGUI_EXPORT XGUI_FacesPanel : public QDockWidget { Q_OBJECT public: /// Constructor /// \param theParent is a parent of the property panel - XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop); + XGUI_FacesPanel(QWidget *theParent, XGUI_Workshop *theWorkshop); ~XGUI_FacesPanel() {} /// Clear content of list widget @@ -88,30 +89,32 @@ public: /// Fills container with the panel selection mode: FACE // \param theModes [out] a container of modes - void selectionModes(QIntList& theModes); + void selectionModes(QIntList &theModes); /// Appends into container of workshop selection filters /// \param [out] selection filters - void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters); + void selectionFilters(SelectMgr_ListOfFilter &theSelectionFilters); /// Returns whether the panel is active or not bool isActivePanel() const { return myIsActive; } - /// Stores the state if panel is active and highlight the panel in an active color - /// \param theIsActive state whether the panel should be activated or deactivated + /// Stores the state if panel is active and highlight the panel in an active + /// color \param theIsActive state whether the panel should be activated or + /// deactivated void setActivePanel(const bool theIsActive); - /// Returns true if the object is in internal container of hidden objects by this panel - /// \param theObject a checked object - /// \return boolean value - bool isObjectHiddenByPanel(const ObjectPtr& theObject) const - { return myHiddenObjects.find(theObject) != myHiddenObjects.end(); } + /// Returns true if the object is in internal container of hidden objects by + /// this panel \param theObject a checked object \return boolean value + bool isObjectHiddenByPanel(const ObjectPtr &theObject) const { + return myHiddenObjects.find(theObject) != myHiddenObjects.end(); + } /// Removed faces of the objects from the panel /// \param container of objects - void restoreObjects(const std::set& theHiddenObjects); + void restoreObjects(const std::set &theHiddenObjects); - /// Returns true if the event is processed. The default implementation is empty, returns false. + /// Returns true if the event is processed. The default implementation is + /// empty, returns false. virtual bool processAction(ModuleBase_ActionType theActionType); /// Append selected item in the list and customize presentations to hide faces @@ -121,15 +124,16 @@ public: /// \return whether the delete action is processed bool processDelete(); - /// Delete last(s) item(s) added since the recent activation of the faces panel + /// Delete last(s) item(s) added since the recent activation of the faces + /// panel void processUndo(); /// Processing focus in/out for the faces control /// \param theObject source object of event /// \param theEvent an event - virtual bool eventFilter(QObject* theObject, QEvent *theEvent); + virtual bool eventFilter(QObject *theObject, QEvent *theEvent); - XGUI_Workshop* workshop() const { return myWorkshop; } + XGUI_Workshop *workshop() const { return myWorkshop; } public slots: /// Slot called on an object erase @@ -137,7 +141,7 @@ public slots: protected: /// Reimplementation to emit a signal about the panel close - virtual void closeEvent(QCloseEvent* theEvent); + virtual void closeEvent(QCloseEvent *theEvent); signals: /// Signal about activating pane @@ -151,27 +155,30 @@ private: /// Redisplay objects. /// \param theObjects container of objects /// \return true if some of objects was redisplayed - static bool redisplayObjects(const std::set& theObjects); - - /// Container of objects participating in the panel, it is filled by internal container - /// \param theItems container of selected values - /// \param theObjects [out] container of objects - static void updateProcessedObjects(QMap theItems, - std::set& theObjects); - - /// Returns maps of shapes and presentations. If object is a body result then it returns - /// its ruslts. If it is a group then it returns result of shapes included into the gropup - /// The function doesn't clear content of input maps. + static bool redisplayObjects(const std::set &theObjects); + + /// Container of objects participating in the panel, it is filled by internal + /// container \param theItems container of selected values \param theObjects + /// [out] container of objects + static void + updateProcessedObjects(QMap theItems, + std::set &theObjects); + + /// Returns maps of shapes and presentations. If object is a body result then + /// it returns its ruslts. If it is a group then it returns result of shapes + /// included into the gropup The function doesn't clear content of input maps. /// \param thePrs a selected presintation /// \param theObjectsToShapes map of objects to shapes list /// \param theObjectToPrs map of objects to presentations - void getObjectsMapFromResult(ResultGroupPtr theResGroup, FeaturePtr theGroupFeature, - std::map& theObjectsToShapes, - std::map& theObjectToPrs); + void getObjectsMapFromResult( + ResultGroupPtr theResGroup, FeaturePtr theGroupFeature, + std::map &theObjectsToShapes, + std::map &theObjectToPrs); - void getObjectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs, - std::map& theObjectToShapes, - std::map& theObjectToPrs); + void getObjectsMapFromPrs( + ModuleBase_ViewerPrsPtr thePrs, + std::map &theObjectToShapes, + std::map &theObjectToPrs); /// Returns true if transparency choice is checked /// \return boolean value @@ -196,19 +203,19 @@ protected slots: void flushRedisplay() const; private: + QCheckBox *myHiddenOrTransparent; ///< if checked - transparent, else hidden + ModuleBase_ListView *myListView; ///< list control of processed faces + XGUI_Workshop *myWorkshop; ///< workshop - QCheckBox* myHiddenOrTransparent; ///< if checked - transparent, else hidden - ModuleBase_ListView* myListView; ///< list control of processed faces - XGUI_Workshop* myWorkshop; ///< workshop - - bool myIsActive; ///< current state about the panel is active - int myLastItemIndex; ///< last index to be used in the map of items for the next added item + bool myIsActive; ///< current state about the panel is active + int myLastItemIndex; ///< last index to be used in the map of items for the + ///< next added item std::vector myUndoList; ///< indexes of items for undo QMap myItems; ///< selected face items - std::set myItemObjects; ///< cached objects of myItems - std::set myHiddenObjects; ///< hidden objects - std::set myHiddenGroups; ///< hidden objects + std::set myItemObjects; ///< cached objects of myItems + std::set myHiddenObjects; ///< hidden objects + std::set myHiddenGroups; ///< hidden objects }; #endif diff --git a/src/XGUI/XGUI_FacesPanelSelector.cpp b/src/XGUI/XGUI_FacesPanelSelector.cpp index 98dcef443..b3c52e8ef 100644 --- a/src/XGUI/XGUI_FacesPanelSelector.cpp +++ b/src/XGUI/XGUI_FacesPanelSelector.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include @@ -22,27 +23,21 @@ #include //******************************************************************** -XGUI_FacesPanelSelector::XGUI_FacesPanelSelector(XGUI_FacesPanel* thePanel) -: myPanel(thePanel) -{ +XGUI_FacesPanelSelector::XGUI_FacesPanelSelector(XGUI_FacesPanel *thePanel) + : myPanel(thePanel) { connect(myPanel, SIGNAL(activated()), this, SIGNAL(activated())); connect(myPanel, SIGNAL(deactivated()), this, SIGNAL(deactivated())); } //******************************************************************** -void XGUI_FacesPanelSelector::reset() -{ - myPanel->reset(true); -} +void XGUI_FacesPanelSelector::reset() { myPanel->reset(true); } //******************************************************************** -void XGUI_FacesPanelSelector::setActive(const bool& isActive) -{ +void XGUI_FacesPanelSelector::setActive(const bool &isActive) { myPanel->setActivePanel(isActive); } //******************************************************************** -void XGUI_FacesPanelSelector::processSelection() -{ +void XGUI_FacesPanelSelector::processSelection() { myPanel->processSelection(); } diff --git a/src/XGUI/XGUI_FacesPanelSelector.h b/src/XGUI/XGUI_FacesPanelSelector.h index edc282303..332d0c17b 100644 --- a/src/XGUI/XGUI_FacesPanelSelector.h +++ b/src/XGUI/XGUI_FacesPanelSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_FacesPanelSelector_H @@ -27,18 +28,17 @@ class XGUI_FacesPanel; /** -* Processing selection by the faces panel. -*/ -class XGUI_FacesPanelSelector : public XGUI_ActiveControlSelector -{ + * Processing selection by the faces panel. + */ +class XGUI_FacesPanelSelector : public XGUI_ActiveControlSelector { Q_OBJECT public: /// Constructor /// \param thePanel the workshop faces panel - XGUI_EXPORT XGUI_FacesPanelSelector(XGUI_FacesPanel* thePanel); + XGUI_EXPORT XGUI_FacesPanelSelector(XGUI_FacesPanel *thePanel); /// Destructor - XGUI_EXPORT virtual ~XGUI_FacesPanelSelector() {}; + XGUI_EXPORT virtual ~XGUI_FacesPanelSelector(){}; /// Returns name of the selector XGUI_EXPORT static QString Type() { return "XGUI_FacesPanelSelector"; } @@ -49,15 +49,16 @@ public: /// Set empty widget that need to be activated widget if it is not empty XGUI_EXPORT virtual void reset(); - /// Sets control active. It should activates/deactivates selection and selection filters. - /// \param isActive if true, the control becomes active - XGUI_EXPORT virtual void setActive(const bool& isActive); + /// Sets control active. It should activates/deactivates selection and + /// selection filters. \param isActive if true, the control becomes active + XGUI_EXPORT virtual void setActive(const bool &isActive); - /// Processes current selection of workshop. Reaction to selection change in workshop. + /// Processes current selection of workshop. Reaction to selection change in + /// workshop. XGUI_EXPORT virtual void processSelection(); protected: - XGUI_FacesPanel* myPanel; ///< processed panel + XGUI_FacesPanel *myPanel; ///< processed panel }; #endif diff --git a/src/XGUI/XGUI_HistoryMenu.cpp b/src/XGUI/XGUI_HistoryMenu.cpp index ddf7673fb..67f13777e 100644 --- a/src/XGUI/XGUI_HistoryMenu.cpp +++ b/src/XGUI/XGUI_HistoryMenu.cpp @@ -14,45 +14,41 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include +#include #include -#include #include -#include +#include -XGUI_HistoryMenu::XGUI_HistoryMenu(QAction* theParent) - : QMenu(NULL), - myHistoryList(NULL) -{ +XGUI_HistoryMenu::XGUI_HistoryMenu(QAction *theParent) + : QMenu(NULL), myHistoryList(NULL) { theParent->setMenu(this); initMenu(); connect(theParent, SIGNAL(destroyed()), this, SLOT(deleteLater())); } -XGUI_HistoryMenu::XGUI_HistoryMenu(QToolButton* theParent) - : QMenu(theParent), - myHistoryList(NULL) -{ +XGUI_HistoryMenu::XGUI_HistoryMenu(QToolButton *theParent) + : QMenu(theParent), myHistoryList(NULL) { theParent->setMenu(this); theParent->setPopupMode(QToolButton::MenuButtonPopup); initMenu(); } -void XGUI_HistoryMenu::initMenu() -{ +void XGUI_HistoryMenu::initMenu() { myHistoryList = new QListWidget(this); - QWidgetAction* aListAction = new QWidgetAction(this); + QWidgetAction *aListAction = new QWidgetAction(this); aListAction->setDefaultWidget(myHistoryList); this->addAction(aListAction); - myHistoryList->setMouseTracking(true); // track mouse hover + myHistoryList->setMouseTracking(true); // track mouse hover myHistoryList->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(myHistoryList, SIGNAL(itemEntered(QListWidgetItem *)), this, SLOT(setStackSelectedTo(QListWidgetItem *))); @@ -60,32 +56,27 @@ void XGUI_HistoryMenu::initMenu() SLOT(onItemPressed(QListWidgetItem *))); } -XGUI_HistoryMenu::~XGUI_HistoryMenu() -{ -} +XGUI_HistoryMenu::~XGUI_HistoryMenu() {} -void XGUI_HistoryMenu::setHistory(const QList& theActions) -{ +void XGUI_HistoryMenu::setHistory(const QList &theActions) { myHistoryList->clear(); - foreach(ActionInfo anAct, theActions) { + foreach (ActionInfo anAct, theActions) { #ifdef _DEBUG - QListWidgetItem* anItem = + QListWidgetItem *anItem = #endif - new QListWidgetItem(anAct.icon, anAct.text, myHistoryList); + new QListWidgetItem(anAct.icon, anAct.text, myHistoryList); } } -void XGUI_HistoryMenu::leaveEvent(QEvent* theEvent) -{ +void XGUI_HistoryMenu::leaveEvent(QEvent *theEvent) { setStackSelectedTo(NULL); QMenu::leaveEvent(theEvent); } -void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem * theItem) -{ - QListWidgetItem* eachItem = NULL; +void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem *theItem) { + QListWidgetItem *eachItem = NULL; bool isSelect = theItem != NULL; - for(int aRow = 0; aRow < myHistoryList->count(); ++aRow) { + for (int aRow = 0; aRow < myHistoryList->count(); ++aRow) { eachItem = myHistoryList->item(aRow); myHistoryList->setItemSelected(eachItem, isSelect); // Deselect items below hovered @@ -97,23 +88,19 @@ void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem * theItem) myHistoryList->repaint(); } -void hideUpToMenuBar( QMenu* theMenu ) -{ +void hideUpToMenuBar(QMenu *theMenu) { theMenu->hide(); - foreach( QWidget* aWidget, theMenu->menuAction()->associatedWidgets() ) - { - QMenu* aMenu = qobject_cast( aWidget ); - if( aMenu ) - { + foreach (QWidget *aWidget, theMenu->menuAction()->associatedWidgets()) { + QMenu *aMenu = qobject_cast(aWidget); + if (aMenu) { aMenu->hide(); - hideUpToMenuBar( aMenu ); + hideUpToMenuBar(aMenu); } } } -void XGUI_HistoryMenu::onItemPressed(QListWidgetItem * theItem) -{ +void XGUI_HistoryMenu::onItemPressed(QListWidgetItem *theItem) { int selectedSize = myHistoryList->row(theItem) + 1; emit actionSelected(selectedSize); - hideUpToMenuBar( this ); + hideUpToMenuBar(this); } diff --git a/src/XGUI/XGUI_HistoryMenu.h b/src/XGUI/XGUI_HistoryMenu.h index f85070f15..fb0e865c1 100644 --- a/src/XGUI/XGUI_HistoryMenu.h +++ b/src/XGUI/XGUI_HistoryMenu.h @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_HISTORYMENU_H_ #define XGUI_HISTORYMENU_H_ -#include #include +#include #include @@ -32,31 +33,31 @@ class QListWidgetItem; /** * \class XGUI_HistoryMenu * \ingroup GUI - * \brief Extends regular QToolButton of QAction with HistoryMenu (stack of actions) + * \brief Extends regular QToolButton of QAction with HistoryMenu (stack of + * actions) */ -class XGUI_EXPORT XGUI_HistoryMenu : public QMenu -{ +class XGUI_EXPORT XGUI_HistoryMenu : public QMenu { Q_OBJECT - public: +public: /// Creates history menu for button - explicit XGUI_HistoryMenu(QToolButton* theParent); + explicit XGUI_HistoryMenu(QToolButton *theParent); /// Creates history menu for action - explicit XGUI_HistoryMenu(QAction* theParent); + explicit XGUI_HistoryMenu(QAction *theParent); virtual ~XGUI_HistoryMenu(); - signals: +signals: /// Signal. Emited then n-th action is selected in stack void actionSelected(int); - public slots: +public slots: /// Set list of actions - void setHistory(const QList&); + void setHistory(const QList &); - protected: +protected: /// Unselects all items when cursor leaves the list virtual void leaveEvent(QEvent *); - protected slots: +protected slots: /// Selects all items in stack to the given item including it void setStackSelectedTo(QListWidgetItem *); /// Emits actionSelected() signal. @@ -64,8 +65,8 @@ class XGUI_EXPORT XGUI_HistoryMenu : public QMenu /// Initializes internal controls of the Menu void initMenu(); - private: - QListWidget* myHistoryList; ///< List to contain actions +private: + QListWidget *myHistoryList; ///< List to contain actions }; #endif /* XGUI_OPERATIONSSTACKPOPUP_H_ */ diff --git a/src/XGUI/XGUI_InspectionPanel.cpp b/src/XGUI/XGUI_InspectionPanel.cpp index b6f418979..e7ccba0dc 100644 --- a/src/XGUI/XGUI_InspectionPanel.cpp +++ b/src/XGUI/XGUI_InspectionPanel.cpp @@ -14,61 +14,61 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_InspectionPanel.h" -#include "XGUI_Workshop.h" -#include "XGUI_SelectionMgr.h" +#include "XGUI_ModuleConnector.h" #include "XGUI_Selection.h" +#include "XGUI_SelectionMgr.h" #include "XGUI_Tools.h" -#include "XGUI_ModuleConnector.h" +#include "XGUI_Workshop.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 // CAREFUL ! position of this file is critic #include +#include #include -#include // CAREFUL ! position of this file is critic - // ================ XGUI_InspectionPanel ================ -XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop) - : QDockWidget(theParent), - myWorkshop(theWorkshop) -{ +XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget *theParent, + XGUI_Workshop *theWorkshop) + : QDockWidget(theParent), myWorkshop(theWorkshop) { setWindowTitle(tr("Inspection Panel")); setObjectName(INSPECTION_PANEL); - setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); + setStyleSheet("::title { position: relative; padding-left: 5px; text-align: " + "left center }"); myStackWgt = new QStackedWidget(this); // Create shape selection page - QSplitter* aSplitter = new QSplitter(Qt::Vertical, myStackWgt); + QSplitter *aSplitter = new QSplitter(Qt::Vertical, myStackWgt); // Create an internal widget - QWidget* aNameWgt = new QWidget(aSplitter); - QHBoxLayout* aNameLayout = new QHBoxLayout(aNameWgt); + QWidget *aNameWgt = new QWidget(aSplitter); + QHBoxLayout *aNameLayout = new QHBoxLayout(aNameWgt); aNameLayout->setContentsMargins(3, 0, 3, 0); aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt)); myNameEdt = new QLineEdit(aNameWgt); @@ -86,16 +86,17 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* th mySubShapesTab->setHorizontalHeaderLabels(aTitles); QStringList aSubShapes; - aSubShapes << tr("SHAPE") << tr("COMPOUND") << tr("COMPSOLID") << - tr("SOLID") << tr("SHELL") << tr("FACE") << tr("WIRE") << tr("EDGE") << tr("VERTEX"); + aSubShapes << tr("SHAPE") << tr("COMPOUND") << tr("COMPSOLID") << tr("SOLID") + << tr("SHELL") << tr("FACE") << tr("WIRE") << tr("EDGE") + << tr("VERTEX"); int i = 0; - foreach(QString aType, aSubShapes) { - QTableWidgetItem* aItem = new QTableWidgetItem(aType); + foreach (QString aType, aSubShapes) { + QTableWidgetItem *aItem = new QTableWidgetItem(aType); aItem->setFlags(Qt::ItemIsEnabled); mySubShapesTab->setItem(i++, 0, aItem); } for (i = 0; i < 9; i++) { - QTableWidgetItem* aItem = new QTableWidgetItem(""); + QTableWidgetItem *aItem = new QTableWidgetItem(""); aItem->setFlags(Qt::ItemIsEnabled); aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); mySubShapesTab->setItem(i, 1, aItem); @@ -106,8 +107,8 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* th aSplitter->addWidget(mySubShapesTab); // Type of object - QWidget* aTypeWgt = new QWidget(aSplitter); - QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt); + QWidget *aTypeWgt = new QWidget(aSplitter); + QHBoxLayout *aTypeLayout = new QHBoxLayout(aTypeWgt); aTypeLayout->setContentsMargins(3, 0, 3, 0); aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt)); @@ -135,7 +136,7 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* th myShapePanelId = myStackWgt->addWidget(aSplitter); // Create feature selection page - QScrollArea* aScroll = new QScrollArea(myStackWgt); + QScrollArea *aScroll = new QScrollArea(myStackWgt); aScroll->setWidgetResizable(true); aScroll->setFrameStyle(QFrame::NoFrame); @@ -143,28 +144,25 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* th myFeatureLayout = new QGridLayout(myFeaturePane); myFeatureLayout->setContentsMargins(3, 3, 3, 3); aScroll->setWidget(myFeaturePane); - //myFeaturePane->setEnabled(false); + // myFeaturePane->setEnabled(false); myFeaturePanelId = myStackWgt->addWidget(aScroll); setWidget(myStackWgt); - connect(myWorkshop->selector(), SIGNAL(selectionChanged()), SLOT(onSelectionChanged())); + connect(myWorkshop->selector(), SIGNAL(selectionChanged()), + SLOT(onSelectionChanged())); } //******************************************************************** -XGUI_InspectionPanel::~XGUI_InspectionPanel() -{ -} +XGUI_InspectionPanel::~XGUI_InspectionPanel() {} //******************************************************************** -void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal) -{ +void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal) { mySubShapesTab->item(theId, 1)->setText(QString::number(theVal)); } //******************************************************************** -void XGUI_InspectionPanel::clearContent() -{ +void XGUI_InspectionPanel::clearContent() { myStackWgt->setCurrentIndex(myFeaturePanelId); setName(""); for (int i = 0; i <= VertexId; i++) { @@ -177,32 +175,33 @@ void XGUI_InspectionPanel::clearContent() } //******************************************************************** -void XGUI_InspectionPanel::onSelectionChanged() -{ +void XGUI_InspectionPanel::onSelectionChanged() { if (!isVisible()) return; clearContent(); - XGUI_Selection* aSelection = myWorkshop->selector()->selection(); + XGUI_Selection *aSelection = myWorkshop->selector()->selection(); QList aSelectedList = - aSelection->getSelected(myWorkshop->selector()->placeOfSelection()); + aSelection->getSelected(myWorkshop->selector()->placeOfSelection()); if (aSelectedList.count() > 0) { ModuleBase_ViewerPrsPtr aPrs = aSelectedList.first(); FieldStepPtr aStep = - std::dynamic_pointer_cast(aPrs->object()); + std::dynamic_pointer_cast( + aPrs->object()); if (aStep) return; - FeaturePtr aFeature = std::dynamic_pointer_cast(aPrs->object()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aPrs->object()); if (aFeature.get()) { myStackWgt->setCurrentIndex(myFeaturePanelId); buildFeaturePane(aFeature); - } - else { + } else { TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs); if (aShape.IsNull()) { - ResultPtr aRes = std::dynamic_pointer_cast(aPrs->object()); + ResultPtr aRes = + std::dynamic_pointer_cast(aPrs->object()); if (aRes.get()) { GeomShapePtr aShpPtr = aRes->shape(); if (aShpPtr.get()) { @@ -218,7 +217,8 @@ void XGUI_InspectionPanel::onSelectionChanged() GeomShapePtr aShapePtr(new GeomAPI_Shape()); aShapePtr->setImpl(new TopoDS_Shape(aShape)); - ModuleBase_ViewerPrsPtr aPrsCopy(new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr)); + ModuleBase_ViewerPrsPtr aPrsCopy( + new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr)); setName(XGUI_Tools::generateName(aPrsCopy)); setShapeContent(aShape); @@ -233,14 +233,12 @@ void XGUI_InspectionPanel::onSelectionChanged() } //******************************************************************** -void XGUI_InspectionPanel::setName(const QString& theName) -{ +void XGUI_InspectionPanel::setName(const QString &theName) { myNameEdt->setText(theName); } //******************************************************************** -void XGUI_InspectionPanel::setShapeContent(const TopoDS_Shape& theShape) -{ +void XGUI_InspectionPanel::setShapeContent(const TopoDS_Shape &theShape) { try { OCC_CATCH_SIGNALS; int iType, nbTypes[TopAbs_SHAPE]; @@ -275,43 +273,40 @@ void XGUI_InspectionPanel::setShapeContent(const TopoDS_Shape& theShape) setSubShapeValue(CompsolidId, nbTypes[TopAbs_COMPSOLID]); setSubShapeValue(CompoundId, nbTypes[TopAbs_COMPOUND]); setSubShapeValue(ShapeId, aMapOfShape.Extent()); - } - catch (Standard_Failure) { + } catch (Standard_Failure) { } } -std::string XGUI_InspectionPanel::translate(const char* theSource) -{ +std::string XGUI_InspectionPanel::translate(const char *theSource) { return std::string(tr(theSource).toStdString()); } //******************************************************************** -void XGUI_InspectionPanel::setParamsText(const QString& theText) -{ +void XGUI_InspectionPanel::setParamsText(const QString &theText) { myTypeParams->setText(theText); } //******************************************************************** -void XGUI_InspectionPanel::buildFeaturePane(const FeaturePtr& theFeature) -{ +void XGUI_InspectionPanel::buildFeaturePane(const FeaturePtr &theFeature) { std::string aXmlCfg, aDescription; - myWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, aDescription); + myWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, + aDescription); if (!aXmlCfg.empty()) { - QList aWidgets; - if (!myWorkshop->module()->createWidgets(theFeature, aXmlCfg.c_str(), aWidgets)) { + QList aWidgets; + if (!myWorkshop->module()->createWidgets(theFeature, aXmlCfg.c_str(), + aWidgets)) { ModuleBase_WidgetFactory aFactory(aXmlCfg, myWorkshop->moduleConnector()); aFactory.createWidget(myFeaturePane); aWidgets = aFactory.getModelWidgets(); } - foreach(ModuleBase_ModelWidget* aWgt, aWidgets) { + foreach (ModuleBase_ModelWidget *aWgt, aWidgets) { if (aWgt->isInformative()) { aWgt->setFeature(theFeature, false, false); aWgt->setReadOnly(true); aWgt->setEditingMode(true); aWgt->restoreValue(); aWgt->showInformativePage(); - } - else { + } else { aWgt->setFeature(theFeature, false, false); aWgt->setEditingMode(true); aWgt->hide(); @@ -320,8 +315,7 @@ void XGUI_InspectionPanel::buildFeaturePane(const FeaturePtr& theFeature) } } -void XGUI_InspectionPanel::showEvent(QShowEvent* theEvent) -{ +void XGUI_InspectionPanel::showEvent(QShowEvent *theEvent) { QDockWidget::showEvent(theEvent); onSelectionChanged(); } diff --git a/src/XGUI/XGUI_InspectionPanel.h b/src/XGUI/XGUI_InspectionPanel.h index 63242bcf9..d3e294380 100644 --- a/src/XGUI/XGUI_InspectionPanel.h +++ b/src/XGUI/XGUI_InspectionPanel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_INSPECTIONPANEL_H_ @@ -22,8 +23,8 @@ #include "XGUI.h" -#include #include +#include #include @@ -44,15 +45,16 @@ class TopoDS_Shape; class ModuleBase_PageWidget; /// Internal name of property panel widget -MAYBE_UNUSED const static char* INSPECTION_PANEL = "inspection_panel_dock"; +MAYBE_UNUSED const static char *INSPECTION_PANEL = "inspection_panel_dock"; /** -* \ingroup GUI -* A class which represents an inspection panel: to show content of currently selected objects -*/ -class XGUI_EXPORT XGUI_InspectionPanel : - public QDockWidget, public GeomAlgoAPI_ShapeInfo::Translator -{ + * \ingroup GUI + * A class which represents an inspection panel: to show content of currently + * selected objects + */ +class XGUI_EXPORT XGUI_InspectionPanel + : public QDockWidget, + public GeomAlgoAPI_ShapeInfo::Translator { Q_OBJECT public: /// Type of selected objects @@ -71,17 +73,16 @@ public: /// Constructor /// \param theParent is a parent of the property panel /// \param theMgr operation manager - XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop); + XGUI_InspectionPanel(QWidget *theParent, XGUI_Workshop *theWorkshop); // Destructor virtual ~XGUI_InspectionPanel(); // A translator of resource strings, needed for ShapeInfo. - virtual std::string translate(const char* theSource) override; - + virtual std::string translate(const char *theSource) override; protected: - virtual void showEvent(QShowEvent* theEvent); + virtual void showEvent(QShowEvent *theEvent); private slots: /// A slot to react on selection changed @@ -95,36 +96,36 @@ private: /// Set name of current selection /// \param theName the name - void setName(const QString& theName); + void setName(const QString &theName); /// Set content of selected shape into table /// \param theShape the shape - void setShapeContent(const TopoDS_Shape& theShape); + void setShapeContent(const TopoDS_Shape &theShape); /// Clear content of the window void clearContent(); /// Set text into parameters area /// \param theText the text - void setParamsText(const QString& theText); + void setParamsText(const QString &theText); /// Fills Feature panel with controls specific to the given feature /// \param theFeature the selected feature - void buildFeaturePane(const FeaturePtr& theFeature); + void buildFeaturePane(const FeaturePtr &theFeature); private: - XGUI_Workshop* myWorkshop; //> selection manager - - QLineEdit* myNameEdt; ///> Name field - QTableWidget* mySubShapesTab; ///> table of sub-shapes - QLabel* myTypeLbl; ///> label of a type - QTextBrowser* myTypeParams; ///> parameters area - QVBoxLayout* myMainLayout; ///> main layout - ModuleBase_PageWidget* myFeaturePane; ///> Content of feature property panel - QGridLayout* myFeatureLayout; ///> Layout of feature panel - QStackedWidget* myStackWgt; ///> base widget of the panel + XGUI_Workshop *myWorkshop; //> selection manager + + QLineEdit *myNameEdt; ///> Name field + QTableWidget *mySubShapesTab; ///> table of sub-shapes + QLabel *myTypeLbl; ///> label of a type + QTextBrowser *myTypeParams; ///> parameters area + QVBoxLayout *myMainLayout; ///> main layout + ModuleBase_PageWidget *myFeaturePane; ///> Content of feature property panel + QGridLayout *myFeatureLayout; ///> Layout of feature panel + QStackedWidget *myStackWgt; ///> base widget of the panel int myShapePanelId; int myFeaturePanelId; }; -#endif \ No newline at end of file +#endif diff --git a/src/XGUI/XGUI_MenuGroup.cpp b/src/XGUI/XGUI_MenuGroup.cpp index 0c17171b6..8427156dd 100644 --- a/src/XGUI/XGUI_MenuGroup.cpp +++ b/src/XGUI/XGUI_MenuGroup.cpp @@ -14,22 +14,20 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include -XGUI_MenuGroup::XGUI_MenuGroup(const std::string& theName) -: myName(theName) -{ -} +XGUI_MenuGroup::XGUI_MenuGroup(const std::string &theName) : myName(theName) {} -void XGUI_MenuGroup::setFeatureInfo(const std::shared_ptr& theMessage) -{ +void XGUI_MenuGroup::setFeatureInfo( + const std::shared_ptr &theMessage) { myFeatureInfo.push_back(theMessage); } -const std::list >& XGUI_MenuGroup::featuresInfo() const -{ +const std::list> & +XGUI_MenuGroup::featuresInfo() const { return myFeatureInfo; } diff --git a/src/XGUI/XGUI_MenuGroup.h b/src/XGUI/XGUI_MenuGroup.h index 6815d4e0f..9af74c491 100644 --- a/src/XGUI/XGUI_MenuGroup.h +++ b/src/XGUI/XGUI_MenuGroup.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_MENUGROUP_H_ @@ -22,9 +23,9 @@ #include "XGUI.h" -#include #include #include +#include #ifdef WIN32 #pragma warning(disable : 4251) // std::string needs dll-interface @@ -33,16 +34,16 @@ class Config_FeatureMessage; /** -* \ingroup GUI -* A class for management of menu actions (features). The actions should be arranged like they are -* in XML file. It listens the read feature of XML and fills internal structure of menu workbenches -* and groups of feature. After, it creates menues and tools in the module. -*/ -class XGUI_EXPORT XGUI_MenuGroup -{ - public: + * \ingroup GUI + * A class for management of menu actions (features). The actions should be + * arranged like they are in XML file. It listens the read feature of XML and + * fills internal structure of menu workbenches and groups of feature. After, it + * creates menues and tools in the module. + */ +class XGUI_EXPORT XGUI_MenuGroup { +public: /// Constructor - XGUI_MenuGroup(const std::string& theName); + XGUI_MenuGroup(const std::string &theName); virtual ~XGUI_MenuGroup() {} /// Returns a name of the workbench @@ -51,17 +52,18 @@ class XGUI_EXPORT XGUI_MenuGroup /// Stores XML information for the feature kind /// \param theMessage a container of the feature XML properties - virtual void setFeatureInfo(const std::shared_ptr& theMessage); + virtual void + setFeatureInfo(const std::shared_ptr &theMessage); /// Returns container of existing features /// \returns list - const std::list >& featuresInfo() const; + const std::list> &featuresInfo() const; private: std::string myName; /// a name of the workbench /// container of existing features - std::list > myFeatureInfo; + std::list> myFeatureInfo; }; #endif /* XGUI_MENUGROUP_H_ */ diff --git a/src/XGUI/XGUI_MenuMgr.cpp b/src/XGUI/XGUI_MenuMgr.cpp index 0c6a81e56..2f852c6b3 100644 --- a/src/XGUI/XGUI_MenuMgr.cpp +++ b/src/XGUI/XGUI_MenuMgr.cpp @@ -14,27 +14,28 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include -#include #include -#include -#include #include +#include +#include +#include +#include -#include #include #include +#include #ifndef HAVE_SALOME -#include +#include #include #include #include #include -#include +#include #else #include #endif @@ -42,92 +43,102 @@ #include #include -#include #include #include +#include -XGUI_MenuMgr::XGUI_MenuMgr(XGUI_Workshop* theWorkshop) -: myWorkshop(theWorkshop) -{ - Events_Loop* aLoop = Events_Loop::loop(); +XGUI_MenuMgr::XGUI_MenuMgr(XGUI_Workshop *theWorkshop) + : myWorkshop(theWorkshop) { + Events_Loop *aLoop = Events_Loop::loop(); - aLoop->registerListener(this, Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT())); + aLoop->registerListener( + this, Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT())); } -void XGUI_MenuMgr::processEvent(const std::shared_ptr& theMessage) -{ - //A message to start feature creation received. +void XGUI_MenuMgr::processEvent( + const std::shared_ptr &theMessage) { + // A message to start feature creation received. if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) { std::shared_ptr aFeatureMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (!aFeatureMsg->isInternal()) { addFeature(aFeatureMsg); } } } -void XGUI_MenuMgr::addFeature(const std::shared_ptr& theMessage) -{ +void XGUI_MenuMgr::addFeature( + const std::shared_ptr &theMessage) { if (!theMessage) { #ifdef _DEBUG qDebug() << "XGUI_WorkshopListener::addFeature: NULL message."; #endif return; } - QString aWchName = ModuleBase_Tools::translate("workshop", theMessage->workbenchId()); - theMessage->setToolBarId(ModuleBase_Tools::translate("workshop", - theMessage->workbenchId()).toStdString()); + QString aWchName = + ModuleBase_Tools::translate("workshop", theMessage->workbenchId()); + theMessage->setToolBarId( + ModuleBase_Tools::translate("workshop", theMessage->workbenchId()) + .toStdString()); #ifdef HAVE_SALOME std::string aWchNameString = aWchName.toStdString(); - std::shared_ptr aWorkbench = findWorkbench(aWchNameString); - std::shared_ptr aGroup = aWorkbench->findGroup(theMessage->groupId()); + std::shared_ptr aWorkbench = + findWorkbench(aWchNameString); + std::shared_ptr aGroup = + aWorkbench->findGroup(theMessage->groupId()); aGroup->setFeatureInfo(theMessage); #else ActionInfo aFeatureInfo; aFeatureInfo.initFrom(theMessage); QStringList aNestedFeatures = - QString::fromStdString(theMessage->nestedFeatures()).split(" ", QString::SkipEmptyParts); - QList aNestedActList; + QString::fromStdString(theMessage->nestedFeatures()) + .split(" ", QString::SkipEmptyParts); + QList aNestedActList; bool isColumnButton = !aNestedFeatures.isEmpty(); if (isColumnButton) { - QString aNestedActions = QString::fromStdString(theMessage->actionsWhenNested()); - XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); - XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr(); + QString aNestedActions = + QString::fromStdString(theMessage->actionsWhenNested()); + XGUI_OperationMgr *anOperationMgr = myWorkshop->operationMgr(); + XGUI_ActionsMgr *anActionsMgr = myWorkshop->actionsMgr(); if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) { - QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); - QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations())); + QAction *anAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); + QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, + SLOT(commitAllOperations())); aNestedActList << anAction; } if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) { - QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); - QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(onAbortAllOperation())); + QAction *anAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); + QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, + SLOT(onAbortAllOperation())); aNestedActList << anAction; } } - //Find or create Workbench - AppElements_MainMenu* aMenuBar = myWorkshop->mainWindow()->menuObject(); - AppElements_Workbench* aPage = aMenuBar->findWorkbench(aWchName); + // Find or create Workbench + AppElements_MainMenu *aMenuBar = myWorkshop->mainWindow()->menuObject(); + AppElements_Workbench *aPage = aMenuBar->findWorkbench(aWchName); if (!aPage) { aPage = myWorkshop->addWorkbench(aWchName); } - //Find or create Group + // Find or create Group QString aGroupName = QString::fromStdString(theMessage->groupId()); - AppElements_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName); + AppElements_MenuGroupPanel *aGroup = aPage->findGroup(aGroupName); if (!aGroup) { aGroup = aPage->addGroup(aGroupName); } // Check if hotkey sequence is already defined: - XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr(); + XGUI_ActionsMgr *anActionsMgr = myWorkshop->actionsMgr(); QKeySequence aHotKey = anActionsMgr->registerShortcut(aFeatureInfo.shortcut); - if(aHotKey != aFeatureInfo.shortcut) { + if (aHotKey != aFeatureInfo.shortcut) { aFeatureInfo.shortcut = aHotKey; } - AppElements_Command* aCommand = aGroup->addFeature(theMessage); + AppElements_Command *aCommand = aGroup->addFeature(theMessage); // Enrich created button with accept/abort buttons if necessary - AppElements_Button* aButton = aCommand->button(); + AppElements_Button *aButton = aCommand->button(); if (aButton->isColumnButton()) { aButton->setAdditionalButtons(aNestedActList); } @@ -136,10 +147,11 @@ void XGUI_MenuMgr::addFeature(const std::shared_ptr& theM #endif } -std::shared_ptr XGUI_MenuMgr::findWorkbench(const std::string& theWorkbenchName) -{ - std::list< std::shared_ptr >::const_iterator anIt = myWorkbenches.begin(), - aLast = myWorkbenches.end(); +std::shared_ptr +XGUI_MenuMgr::findWorkbench(const std::string &theWorkbenchName) { + std::list>::const_iterator + anIt = myWorkbenches.begin(), + aLast = myWorkbenches.end(); std::shared_ptr aResultWorkbench; for (; anIt != aLast && !aResultWorkbench; anIt++) { std::shared_ptr aWorkbench = *anIt; @@ -147,39 +159,43 @@ std::shared_ptr XGUI_MenuMgr::findWorkbench(const std::strin aResultWorkbench = aWorkbench; } if (!aResultWorkbench) { - aResultWorkbench = - std::shared_ptr(new XGUI_MenuWorkbench(theWorkbenchName)); + aResultWorkbench = std::shared_ptr( + new XGUI_MenuWorkbench(theWorkbenchName)); myWorkbenches.push_back(aResultWorkbench); } return aResultWorkbench; } -void XGUI_MenuMgr::createFeatureActions() -{ +void XGUI_MenuMgr::createFeatureActions() { #ifdef HAVE_SALOME - std::list< std::shared_ptr >::const_iterator anIt = myWorkbenches.begin(), - aLast = myWorkbenches.end(); - XGUI_SalomeConnector* aSalomeConnector = myWorkshop->salomeConnector(); + std::list>::const_iterator + anIt = myWorkbenches.begin(), + aLast = myWorkbenches.end(); + XGUI_SalomeConnector *aSalomeConnector = myWorkshop->salomeConnector(); for (; anIt != aLast; anIt++) { std::shared_ptr aWorkbench = *anIt; std::string aWchName = aWorkbench->getName(); - const std::list >& aGroups = aWorkbench->groups(); - std::list >::const_iterator aGIt = aGroups.begin(), - aGLast = aGroups.end(); + const std::list> &aGroups = + aWorkbench->groups(); + std::list>::const_iterator + aGIt = aGroups.begin(), + aGLast = aGroups.end(); for (; aGIt != aGLast; aGIt++) { const std::shared_ptr aGroup = *aGIt; std::string aGName = aGroup->getName(); - const std::list >& aFeaturesInfo = - aGroup->featuresInfo(); - std::list >::const_iterator aFIt = - aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end(); + const std::list> &aFeaturesInfo = + aGroup->featuresInfo(); + std::list>::const_iterator + aFIt = aFeaturesInfo.begin(), + aFLast = aFeaturesInfo.end(); size_t aFSize = aFeaturesInfo.size(); - for(size_t i = 0; aFIt != aFLast; aFIt++, i++) { + for (size_t i = 0; aFIt != aFLast; aFIt++, i++) { std::shared_ptr aMessage = *aFIt; - bool aUseSeparator = i == aFSize-1; - QAction* aAction = buildAction(aMessage, aWchName, aUseSeparator); + bool aUseSeparator = i == aFSize - 1; + QAction *aAction = buildAction(aMessage, aWchName, aUseSeparator); - aSalomeConnector->setFeatureInfo(QString::fromStdString(aMessage->id()), aMessage); + aSalomeConnector->setFeatureInfo(QString::fromStdString(aMessage->id()), + aMessage); myWorkshop->actionsMgr()->addCommand(aAction); myWorkshop->module()->actionCreated(aAction); } @@ -188,38 +204,42 @@ void XGUI_MenuMgr::createFeatureActions() #endif } -QAction* XGUI_MenuMgr::buildAction(const std::shared_ptr& theMessage, - const std::string& theWchName, const bool aUseSeparator) const -{ - QAction* anAction = 0; +QAction *XGUI_MenuMgr::buildAction( + const std::shared_ptr &theMessage, + const std::string &theWchName, const bool aUseSeparator) const { + QAction *anAction = 0; #ifdef HAVE_SALOME - XGUI_SalomeConnector* aSalomeConnector = myWorkshop->salomeConnector(); + XGUI_SalomeConnector *aSalomeConnector = myWorkshop->salomeConnector(); ActionInfo aFeatureInfo; aFeatureInfo.initFrom(theMessage); QStringList aNestedFeatures = - QString::fromStdString(theMessage->nestedFeatures()).split(" ", QString::SkipEmptyParts); - QList aNestedActList; + QString::fromStdString(theMessage->nestedFeatures()) + .split(" ", QString::SkipEmptyParts); + QList aNestedActList; if (!aNestedFeatures.isEmpty()) { - QString aNestedActions = QString::fromStdString(theMessage->actionsWhenNested()); - XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); - XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr(); + QString aNestedActions = + QString::fromStdString(theMessage->actionsWhenNested()); + XGUI_OperationMgr *anOperationMgr = myWorkshop->operationMgr(); + XGUI_ActionsMgr *anActionsMgr = myWorkshop->actionsMgr(); if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) { anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); - QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations())); + QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, + SLOT(commitAllOperations())); aNestedActList << anAction; } if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) { anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); - QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(onAbortAllOperation())); + QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, + SLOT(onAbortAllOperation())); aNestedActList << anAction; } - anAction = aSalomeConnector->addFeatureOfNested(theWchName.c_str(), aFeatureInfo, - aNestedActList); - } - else { - anAction = aSalomeConnector->addFeature(theWchName.c_str(), aFeatureInfo, aUseSeparator); + anAction = aSalomeConnector->addFeatureOfNested( + theWchName.c_str(), aFeatureInfo, aNestedActList); + } else { + anAction = aSalomeConnector->addFeature(theWchName.c_str(), aFeatureInfo, + aUseSeparator); } #endif return anAction; diff --git a/src/XGUI/XGUI_MenuMgr.h b/src/XGUI/XGUI_MenuMgr.h index 57092fb3a..fcd6618eb 100644 --- a/src/XGUI/XGUI_MenuMgr.h +++ b/src/XGUI/XGUI_MenuMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_MENUMGR_H_ @@ -24,9 +25,9 @@ #include -#include #include #include +#include class XGUI_MenuWorkbench; class XGUI_Workshop; @@ -35,17 +36,17 @@ class Config_FeatureMessage; class QAction; /** -* \ingroup GUI -* A class for management of menu actions (features). The actions should be arranged like they are -* in XML file. It listens the read feature of XML and fills internal structure of menu workbenches -* and groups of feature. After, it creates menues and tools in the module. -*/ -class XGUI_MenuMgr : public Events_Listener -{ - public: + * \ingroup GUI + * A class for management of menu actions (features). The actions should be + * arranged like they are in XML file. It listens the read feature of XML and + * fills internal structure of menu workbenches and groups of feature. After, it + * creates menues and tools in the module. + */ +class XGUI_MenuMgr : public Events_Listener { +public: /// Constructor /// \param theWorkshop the current workshop - XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop* theWorkshop); + XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop *theWorkshop); XGUI_EXPORT virtual ~XGUI_MenuMgr() {} /// Creates feature actions @@ -53,30 +54,33 @@ class XGUI_MenuMgr : public Events_Listener /// Redefinition of Events_Listener method /// \param theMessage a message - XGUI_EXPORT virtual void processEvent(const std::shared_ptr& theMessage); + XGUI_EXPORT virtual void + processEvent(const std::shared_ptr &theMessage); protected: /// Process event "Add a feature" - void addFeature(const std::shared_ptr& theMessage); + void addFeature(const std::shared_ptr &theMessage); /// Finds or creates a workbench for the given name /// \param theWorkbenchName a name defined in XML /// \return an instance of workbench - std::shared_ptr findWorkbench(const std::string& theWorkbenchName); + std::shared_ptr + findWorkbench(const std::string &theWorkbenchName); /// Creates a new action by the message /// \param theMessage an XML information of the feature /// \param theWchName a workbench name, will be used as menu/tool bar name - /// \param aUseSeparator boolean value if a separator should be added after the action - /// \return an action - QAction* buildAction(const std::shared_ptr& theMessage, - const std::string& theWchName, const bool aUseSeparator) const; + /// \param aUseSeparator boolean value if a separator should be added after + /// the action \return an action + QAction *buildAction(const std::shared_ptr &theMessage, + const std::string &theWchName, + const bool aUseSeparator) const; private: - XGUI_Workshop* myWorkshop; ///< the current workshop + XGUI_Workshop *myWorkshop; ///< the current workshop /// container of existing workbenchs - std::list< std::shared_ptr > myWorkbenches; + std::list> myWorkbenches; }; #endif /* XGUI_MENUMGR_H_ */ diff --git a/src/XGUI/XGUI_MenuWorkbench.cpp b/src/XGUI/XGUI_MenuWorkbench.cpp index 036287ff3..085a99e4f 100644 --- a/src/XGUI/XGUI_MenuWorkbench.cpp +++ b/src/XGUI/XGUI_MenuWorkbench.cpp @@ -14,22 +14,22 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -XGUI_MenuWorkbench::XGUI_MenuWorkbench(const std::string& theName) -: myName(theName) -{ -} +XGUI_MenuWorkbench::XGUI_MenuWorkbench(const std::string &theName) + : myName(theName) {} -std::shared_ptr XGUI_MenuWorkbench::findGroup(const std::string& theGroupName) -{ - std::list< std::shared_ptr >::const_iterator anIt = myGroups.begin(), - aLast = myGroups.end(); +std::shared_ptr +XGUI_MenuWorkbench::findGroup(const std::string &theGroupName) { + std::list>::const_iterator + anIt = myGroups.begin(), + aLast = myGroups.end(); std::shared_ptr aResultGroup; for (; anIt != aLast && !aResultGroup; anIt++) { std::shared_ptr aGroup = *anIt; @@ -37,13 +37,14 @@ std::shared_ptr XGUI_MenuWorkbench::findGroup(const std::string& aResultGroup = aGroup; } if (!aResultGroup) { - aResultGroup = std::shared_ptr(new XGUI_MenuGroup(theGroupName)); + aResultGroup = + std::shared_ptr(new XGUI_MenuGroup(theGroupName)); myGroups.push_back(aResultGroup); } return aResultGroup; } -const std::list >& XGUI_MenuWorkbench::groups() const -{ +const std::list> & +XGUI_MenuWorkbench::groups() const { return myGroups; } diff --git a/src/XGUI/XGUI_MenuWorkbench.h b/src/XGUI/XGUI_MenuWorkbench.h index 14e80ed43..71ecf11fe 100644 --- a/src/XGUI/XGUI_MenuWorkbench.h +++ b/src/XGUI/XGUI_MenuWorkbench.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_MENUWORKBENCH_H_ @@ -22,9 +23,9 @@ #include "XGUI.h" -#include #include #include +#include #ifdef WIN32 #pragma warning(disable : 4251) // std::string needs dll-interface @@ -33,16 +34,16 @@ class XGUI_MenuGroup; /** -* \ingroup GUI -* A class for management of menu actions (features). The actions should be arranged like they are -* in XML file. It listens the read feature of XML and fills internal structure of menu workbenches -* and groups of feature. After, it creates menues and tools in the module. -*/ -class XGUI_EXPORT XGUI_MenuWorkbench -{ - public: + * \ingroup GUI + * A class for management of menu actions (features). The actions should be + * arranged like they are in XML file. It listens the read feature of XML and + * fills internal structure of menu workbenches and groups of feature. After, it + * creates menues and tools in the module. + */ +class XGUI_EXPORT XGUI_MenuWorkbench { +public: /// Constructor - XGUI_MenuWorkbench(const std::string& theName); + XGUI_MenuWorkbench(const std::string &theName); /// Destructor virtual ~XGUI_MenuWorkbench() {} @@ -53,16 +54,16 @@ class XGUI_EXPORT XGUI_MenuWorkbench /// Finds or creates a group for the given name /// \param theGroupName a name defined in XML /// \return an instance of group - std::shared_ptr findGroup(const std::string& theGroupName); + std::shared_ptr findGroup(const std::string &theGroupName); /// Returns container of existing groups /// \returns list - const std::list >& groups() const; + const std::list> &groups() const; private: std::string myName; /// a name of the workbench - std::list > myGroups; /// container of existing groups + std::list> + myGroups; /// container of existing groups }; #endif /* XGUI_MENUWORKBENCH_H_ */ - diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 203d860af..29e4e18c6 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -14,25 +14,26 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_ModuleConnector.h" -#include "XGUI_Workshop.h" -#include "XGUI_ViewerProxy.h" -#include "XGUI_Selection.h" -#include "XGUI_SelectionActivate.h" -#include "XGUI_SelectionMgr.h" -#include "XGUI_OperationMgr.h" -#include "XGUI_Displayer.h" -#include "XGUI_PropertyPanel.h" #include "XGUI_ActionsMgr.h" +#include "XGUI_Displayer.h" #include "XGUI_ErrorMgr.h" #include "XGUI_ObjectsBrowser.h" +#include "XGUI_OperationMgr.h" +#include "XGUI_PropertyPanel.h" +#include "XGUI_Selection.h" +#include "XGUI_SelectionActivate.h" +#include "XGUI_SelectionMgr.h" +#include "XGUI_ViewerProxy.h" +#include "XGUI_Workshop.h" #include -#include #include +#include #include @@ -42,58 +43,47 @@ #include "XGUI_SalomeConnector.h" #endif -XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop) - : ModuleBase_IWorkshop(theWorkshop), - myWorkshop(theWorkshop) -{ - XGUI_SelectionMgr* aSelector = myWorkshop->selector(); - connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); +XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop *theWorkshop) + : ModuleBase_IWorkshop(theWorkshop), myWorkshop(theWorkshop) { + XGUI_SelectionMgr *aSelector = myWorkshop->selector(); + connect(aSelector, SIGNAL(selectionChanged()), this, + SIGNAL(selectionChanged())); } -XGUI_ModuleConnector::~XGUI_ModuleConnector() -{ -} +XGUI_ModuleConnector::~XGUI_ModuleConnector() {} -ModuleBase_ISelection* XGUI_ModuleConnector::selection() const -{ +ModuleBase_ISelection *XGUI_ModuleConnector::selection() const { return myWorkshop->selector()->selection(); } -ModuleBase_IModule* XGUI_ModuleConnector::module() const -{ +ModuleBase_IModule *XGUI_ModuleConnector::module() const { return myWorkshop->module(); } -ModuleBase_IViewer* XGUI_ModuleConnector::viewer() const -{ +ModuleBase_IViewer *XGUI_ModuleConnector::viewer() const { return myWorkshop->viewer(); } -ModuleBase_IPropertyPanel* XGUI_ModuleConnector::propertyPanel() const -{ +ModuleBase_IPropertyPanel *XGUI_ModuleConnector::propertyPanel() const { return myWorkshop->propertyPanel(); } -ModuleBase_IErrorMgr* XGUI_ModuleConnector::errorMgr() const -{ +ModuleBase_IErrorMgr *XGUI_ModuleConnector::errorMgr() const { return myWorkshop->errorMgr(); } -ModuleBase_ISelectionActivate* XGUI_ModuleConnector::selectionActivate() const -{ +ModuleBase_ISelectionActivate *XGUI_ModuleConnector::selectionActivate() const { return myWorkshop->selectionActivate(); } -ModuleBase_Operation* XGUI_ModuleConnector::currentOperation() const -{ +ModuleBase_Operation *XGUI_ModuleConnector::currentOperation() const { return myWorkshop->operationMgr()->currentOperation(); } - -QObjectPtrList XGUI_ModuleConnector::activeObjects(const QObjectPtrList& theObjList) const -{ +QObjectPtrList +XGUI_ModuleConnector::activeObjects(const QObjectPtrList &theObjList) const { QObjectPtrList aActiveOPbjects; - ModuleBase_IModule* aModule = myWorkshop->module(); + ModuleBase_IModule *aModule = myWorkshop->module(); // Activate objects only which can be activated foreach (ObjectPtr aObj, theObjList) { if (aModule->canActivateSelection(aObj)) @@ -102,29 +92,27 @@ QObjectPtrList XGUI_ModuleConnector::activeObjects(const QObjectPtrList& theObjL return aActiveOPbjects; } -AISObjectPtr XGUI_ModuleConnector::findPresentation(const ObjectPtr& theObject) const -{ - XGUI_Displayer* aDisp = myWorkshop->displayer(); +AISObjectPtr +XGUI_ModuleConnector::findPresentation(const ObjectPtr &theObject) const { + XGUI_Displayer *aDisp = myWorkshop->displayer(); return aDisp->getAISObject(theObject); } -bool XGUI_ModuleConnector::isVisible(const ObjectPtr& theObject) const -{ - XGUI_Displayer* aDisp = myWorkshop->displayer(); +bool XGUI_ModuleConnector::isVisible(const ObjectPtr &theObject) const { + XGUI_Displayer *aDisp = myWorkshop->displayer(); return aDisp->isVisible(theObject); } - -ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS) const -{ - XGUI_Displayer* aDisp = myWorkshop->displayer(); +ObjectPtr +XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr &theAIS) const { + XGUI_Displayer *aDisp = myWorkshop->displayer(); ObjectPtr anObject = aDisp->getObject(theAIS); return anObject; } -void XGUI_ModuleConnector::setSelected(const QList& theValues) -{ - XGUI_ObjectsBrowser* aBrowser = myWorkshop->objectBrowser(); +void XGUI_ModuleConnector::setSelected( + const QList &theValues) { + XGUI_ObjectsBrowser *aBrowser = myWorkshop->objectBrowser(); if (theValues.isEmpty()) { myWorkshop->selector()->clearSelection(); aBrowser->treeView()->clearSelection(); @@ -133,23 +121,21 @@ void XGUI_ModuleConnector::setSelected(const QList& the } } -void XGUI_ModuleConnector::setStatusBarMessage(const QString& theMessage) -{ +void XGUI_ModuleConnector::setStatusBarMessage(const QString &theMessage) { myWorkshop->setStatusBarMessage(theMessage); } -bool XGUI_ModuleConnector::canStartOperation(QString theId, bool& isCommitted) -{ +bool XGUI_ModuleConnector::canStartOperation(QString theId, bool &isCommitted) { return myWorkshop->operationMgr()->canStartOperation(theId, isCommitted); } -void XGUI_ModuleConnector::processLaunchOperation(ModuleBase_Operation* theOperation) -{ - XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); +void XGUI_ModuleConnector::processLaunchOperation( + ModuleBase_Operation *theOperation) { + XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr(); if (anOperationMgr->startOperation(theOperation)) { - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) { workshop()->propertyPanel()->updateContentWidget(aFOperation->feature()); workshop()->propertyPanel()->createContentPanel(aFOperation->feature()); @@ -161,83 +147,73 @@ void XGUI_ModuleConnector::processLaunchOperation(ModuleBase_Operation* theOpera } } -ModuleBase_Operation* XGUI_ModuleConnector::findStartedOperation(const QString& theId) -{ +ModuleBase_Operation * +XGUI_ModuleConnector::findStartedOperation(const QString &theId) { return myWorkshop->operationMgr()->findOperation(theId); } -bool XGUI_ModuleConnector::canStopOperation(ModuleBase_Operation* theOperation) -{ +bool XGUI_ModuleConnector::canStopOperation( + ModuleBase_Operation *theOperation) { return myWorkshop->operationMgr()->canStopOperation(theOperation); } -void XGUI_ModuleConnector::stopOperation(ModuleBase_Operation* theOperation, - bool& isCommitted) -{ +void XGUI_ModuleConnector::stopOperation(ModuleBase_Operation *theOperation, + bool &isCommitted) { myWorkshop->operationMgr()->stopOperation(theOperation, isCommitted); } -void XGUI_ModuleConnector::updateCommandStatus() -{ +void XGUI_ModuleConnector::updateCommandStatus() { myWorkshop->updateCommandStatus(); } -QMainWindow* XGUI_ModuleConnector::desktop() const -{ +QMainWindow *XGUI_ModuleConnector::desktop() const { return myWorkshop->desktop(); } -bool XGUI_ModuleConnector::hasSHIFTPressed() const -{ +bool XGUI_ModuleConnector::hasSHIFTPressed() const { return myWorkshop->operationMgr()->hasSHIFTPressed(); } -std::shared_ptr XGUI_ModuleConnector::featureInfo(const QString& theId) const -{ +std::shared_ptr +XGUI_ModuleConnector::featureInfo(const QString &theId) const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->featureInfo(theId); #else - AppElements_Command* aAction = - dynamic_cast(myWorkshop->actionsMgr()->action(theId)); + AppElements_Command *aAction = dynamic_cast( + myWorkshop->actionsMgr()->action(theId)); if (aAction) return aAction->featureMessage(); return std::shared_ptr(); #endif } -void XGUI_ModuleConnector::deactivateCurrentSelector() -{ +void XGUI_ModuleConnector::deactivateCurrentSelector() { myWorkshop->deactivateCurrentSelector(); } -QObjectPtrList XGUI_ModuleConnector::displayedObjects() const -{ +QObjectPtrList XGUI_ModuleConnector::displayedObjects() const { return myWorkshop->displayer()->displayedObjects(); } -bool XGUI_ModuleConnector::enableUpdateViewer(bool isEnabled) -{ +bool XGUI_ModuleConnector::enableUpdateViewer(bool isEnabled) { return myWorkshop->displayer()->enableUpdateViewer(isEnabled); } - -void XGUI_ModuleConnector::applyCurrentSelectionModes(const AISObjectPtr& theAIS) -{ - Handle(AIS_InteractiveObject) anIO = theAIS->impl(); +void XGUI_ModuleConnector::applyCurrentSelectionModes( + const AISObjectPtr &theAIS) { + Handle(AIS_InteractiveObject) anIO = + theAIS->impl(); myWorkshop->selectionActivate()->activate(anIO, false); } +void XGUI_ModuleConnector::undo() { myWorkshop->onUndo(); } -void XGUI_ModuleConnector::undo() -{ - myWorkshop->onUndo(); -} - -void XGUI_ModuleConnector::setCancelEnabled(bool toEnable) -{ - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - QAction* aAbortAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); - QAction* aAbortAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort); +void XGUI_ModuleConnector::setCancelEnabled(bool toEnable) { + XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); + QAction *aAbortAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); + QAction *aAbortAllAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort); if (aAbortAction) { aAbortAction->setEnabled(toEnable); } @@ -246,11 +222,12 @@ void XGUI_ModuleConnector::setCancelEnabled(bool toEnable) } } -bool XGUI_ModuleConnector::isCancelEnabled() const -{ - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - QAction* aAbortAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); - QAction* aAbortAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort); +bool XGUI_ModuleConnector::isCancelEnabled() const { + XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); + QAction *aAbortAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); + QAction *aAbortAllAction = + anActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort); bool isEnabled = false; if (aAbortAction) { isEnabled = true; @@ -261,7 +238,6 @@ bool XGUI_ModuleConnector::isCancelEnabled() const return isEnabled; } -void XGUI_ModuleConnector::showHelpPage(const QString& thePage) const -{ +void XGUI_ModuleConnector::showHelpPage(const QString &thePage) const { workshop()->showHelpPage(thePage); } diff --git a/src/XGUI/XGUI_ModuleConnector.h b/src/XGUI/XGUI_ModuleConnector.h index 2787389ee..202d36cdb 100644 --- a/src/XGUI/XGUI_ModuleConnector.h +++ b/src/XGUI/XGUI_ModuleConnector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ModuleConnector_H @@ -29,94 +30,98 @@ class XGUI_Displayer; /** * \ingroup GUI - * Implementation of IWorkshop interface which provides access to Workshop services at module level + * Implementation of IWorkshop interface which provides access to Workshop + * services at module level */ -class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop -{ -Q_OBJECT - public: - /// Constructor - /// \param theWorkshop a workshop - XGUI_ModuleConnector(XGUI_Workshop* theWorkshop); +class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop { + Q_OBJECT +public: + /// Constructor + /// \param theWorkshop a workshop + XGUI_ModuleConnector(XGUI_Workshop *theWorkshop); virtual ~XGUI_ModuleConnector(); //! Returns list of currently selected data objects - virtual ModuleBase_ISelection* selection() const; + virtual ModuleBase_ISelection *selection() const; //! Returns instance of loaded module - virtual ModuleBase_IModule* module() const; + virtual ModuleBase_IModule *module() const; //! Returns current viewer - virtual ModuleBase_IViewer* viewer() const; + virtual ModuleBase_IViewer *viewer() const; //! Returns property panel - virtual ModuleBase_IPropertyPanel* propertyPanel() const; + virtual ModuleBase_IPropertyPanel *propertyPanel() const; //! Returns error manager - virtual ModuleBase_IErrorMgr* errorMgr() const; + virtual ModuleBase_IErrorMgr *errorMgr() const; /// A selection activate in 3D View handler - virtual ModuleBase_ISelectionActivate* selectionActivate() const; + virtual ModuleBase_ISelectionActivate *selectionActivate() const; //! Returns currently active operation - virtual ModuleBase_Operation* currentOperation() const; + virtual ModuleBase_Operation *currentOperation() const; //! Returns true if the operation with id theId can be started /// \param theId id of the operation which is going to start - /// \param isCommitted boolean value if the operation was committed otherwise it was aborted - virtual bool canStartOperation(QString theId, bool& isCommitted); + /// \param isCommitted boolean value if the operation was committed otherwise + /// it was aborted + virtual bool canStartOperation(QString theId, bool &isCommitted); //! Performs the operation launch //! \param theOperation an operation to be launched - virtual void processLaunchOperation(ModuleBase_Operation* theOperation); + virtual void processLaunchOperation(ModuleBase_Operation *theOperation); - //! Returns started operation by the operation identifier. The operation manager is called. - //! \param theId an operation id - //! \return an operation instance or NULL - virtual ModuleBase_Operation* findStartedOperation(const QString& theId); + //! Returns started operation by the operation identifier. The operation + //! manager is called. \param theId an operation id \return an operation + //! instance or NULL + virtual ModuleBase_Operation *findStartedOperation(const QString &theId); - //! Returns true if the operation with id theId can be stopped. The operation manager is called. - //! \param theOperation a stopped operation - //! \return boolean result - virtual bool canStopOperation(ModuleBase_Operation* theOperation); + //! Returns true if the operation with id theId can be stopped. The operation + //! manager is called. \param theOperation a stopped operation \return boolean + //! result + virtual bool canStopOperation(ModuleBase_Operation *theOperation); //! Commits if possible or aborts the given operation. //! \param theOperation an aborted operation - /// \param isCommitted boolean value if the operation was committed otherwise it was aborted - virtual void stopOperation(ModuleBase_Operation* theOperation, - bool& isCommitted); + /// \param isCommitted boolean value if the operation was committed otherwise + /// it was aborted + virtual void stopOperation(ModuleBase_Operation *theOperation, + bool &isCommitted); //! Returns AIS object by data object - virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const; + virtual AISObjectPtr findPresentation(const ObjectPtr &theObject) const; //! Returns data object by AIS - virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const; + virtual ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const; //! Returns true if the object is displayed //! \param theObject a data object - virtual bool isVisible(const ObjectPtr& theObject) const; + virtual bool isVisible(const ObjectPtr &theObject) const; //! Returns list of currently displayed objects virtual QObjectPtrList displayedObjects() const; //! Select features clearing previous selection. //! If the list is empty then selection will be cleared - virtual void setSelected(const QList>& theValues); + virtual void + setSelected(const QList> &theValues); //! Shows the message in the status bar //! \param theMessage a message - virtual void setStatusBarMessage(const QString& theMessage); + virtual void setStatusBarMessage(const QString &theMessage); - /// Update of commands status + /// Update of commands status virtual void updateCommandStatus(); /// Returns Information about feature defined in corresponded XML /// \param theId - id of the feature - virtual std::shared_ptr featureInfo(const QString& theId) const; + virtual std::shared_ptr + featureInfo(const QString &theId) const; /// Return application main window - virtual QMainWindow* desktop() const; + virtual QMainWindow *desktop() const; /// Returns true if SHIFT is pressed /// \return boolean value @@ -124,17 +129,18 @@ Q_OBJECT virtual void deactivateCurrentSelector(); - //! Temporary enable or disable viewer update. Returns previous state of updating - //! \param isEnabled new state of the viewer update + //! Temporary enable or disable viewer update. Returns previous state of + //! updating \param isEnabled new state of the viewer update virtual bool enableUpdateViewer(bool isEnabled); //! Returns workshop - XGUI_Workshop* workshop() const { return myWorkshop; } + XGUI_Workshop *workshop() const { return myWorkshop; } - //! The methods applys current defined selection modes to given AIS presentation. - //! The AIS presentation has to be already displayed. After activation viewer has to be updated - //! \param theAIS the object which has to be activated - virtual void applyCurrentSelectionModes(const AISObjectPtr& theAIS); + //! The methods applys current defined selection modes to given AIS + //! presentation. The AIS presentation has to be already displayed. After + //! activation viewer has to be updated \param theAIS the object which has to + //! be activated + virtual void applyCurrentSelectionModes(const AISObjectPtr &theAIS); //! Undo last command virtual void undo(); @@ -146,13 +152,13 @@ Q_OBJECT virtual bool isCancelEnabled() const; //! Show help of a current operation - virtual void showHelpPage(const QString& thePage) const; + virtual void showHelpPage(const QString &thePage) const; private: - QObjectPtrList activeObjects(const QObjectPtrList& theObjList) const; + QObjectPtrList activeObjects(const QObjectPtrList &theObjList) const; /// Reference to workshop - XGUI_Workshop* myWorkshop; + XGUI_Workshop *myWorkshop; }; #endif diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 544a941a4..b03f36891 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -14,34 +14,35 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_ObjectsBrowser.h" -#include "XGUI_Tools.h" #include "XGUI_DataModel.h" +#include "XGUI_Tools.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 #ifdef DEBUG_INDXES #include @@ -52,25 +53,23 @@ #define SECOND_COL_WIDTH 30 /** -* \ingroup GUI -* Tree item delegate for definition of data in column items editor -*/ -class XGUI_TreeViewItemDelegate: public QStyledItemDelegate -{ + * \ingroup GUI + * Tree item delegate for definition of data in column items editor + */ +class XGUI_TreeViewItemDelegate : public QStyledItemDelegate { public: /// Constructor /// \param theParent a parent of the delegate - XGUI_TreeViewItemDelegate(XGUI_DataTree* theParent):QStyledItemDelegate(theParent), - myTreedView(theParent) {} + XGUI_TreeViewItemDelegate(XGUI_DataTree *theParent) + : QStyledItemDelegate(theParent), myTreedView(theParent) {} /// Set data for item editor (name of the item) /// \param editor a widget of editor /// \param index the tree item index - virtual void setEditorData ( QWidget* editor, const QModelIndex& index ) const - { - QLineEdit* aEditor = dynamic_cast(editor); + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const { + QLineEdit *aEditor = dynamic_cast(editor); if (aEditor) { - XGUI_DataModel* aModel = myTreedView->dataModel(); + XGUI_DataModel *aModel = myTreedView->dataModel(); ObjectPtr aObj = aModel->object(index); if (aObj.get() != NULL) { aEditor->setText(QString::fromStdWString(aObj->data()->name())); @@ -81,13 +80,10 @@ public: } private: - XGUI_DataTree* myTreedView; + XGUI_DataTree *myTreedView; }; - -XGUI_DataTree::XGUI_DataTree(QWidget* theParent) - : QTreeView(theParent) -{ +XGUI_DataTree::XGUI_DataTree(QWidget *theParent) : QTreeView(theParent) { setHeaderHidden(true); setTreePosition(1); setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -103,36 +99,31 @@ XGUI_DataTree::XGUI_DataTree(QWidget* theParent) setItemDelegateForColumn(1, new XGUI_TreeViewItemDelegate(this)); - connect(this, SIGNAL(doubleClicked(const QModelIndex&)), - SLOT(onDoubleClick(const QModelIndex&))); + connect(this, SIGNAL(doubleClicked(const QModelIndex &)), + SLOT(onDoubleClick(const QModelIndex &))); } -XGUI_DataTree::~XGUI_DataTree() -{ -} +XGUI_DataTree::~XGUI_DataTree() {} -XGUI_DataModel* XGUI_DataTree::dataModel() const -{ - return static_cast(model()); +XGUI_DataModel *XGUI_DataTree::dataModel() const { + return static_cast(model()); } -void XGUI_DataTree::contextMenuEvent(QContextMenuEvent* theEvent) -{ +void XGUI_DataTree::contextMenuEvent(QContextMenuEvent *theEvent) { emit contextMenuRequested(theEvent); } -void XGUI_DataTree::commitData(QWidget* theEditor) -{ +void XGUI_DataTree::commitData(QWidget *theEditor) { static int aEntrance = 0; if (aEntrance == 0) { - // We have to check number of enter and exit of this function because it can be called - // recursively by Qt in order to avoid double modifying of a data + // We have to check number of enter and exit of this function because it can + // be called recursively by Qt in order to avoid double modifying of a data aEntrance = 1; - QLineEdit* aEditor = dynamic_cast(theEditor); + QLineEdit *aEditor = dynamic_cast(theEditor); if (aEditor) { QString aName = aEditor->text(); QModelIndexList aIndexList = selectionModel()->selectedIndexes(); - XGUI_DataModel* aModel = dataModel(); + XGUI_DataModel *aModel = dataModel(); ObjectPtr aObj = aModel->object(aIndexList.first()); if (XGUI_Tools::canRename(aObj, aName)) { @@ -146,14 +137,12 @@ void XGUI_DataTree::commitData(QWidget* theEditor) aEntrance = 0; } -void XGUI_DataTree::clear() -{ +void XGUI_DataTree::clear() { dataModel()->clear(); reset(); } -void XGUI_DataTree::resizeEvent(QResizeEvent* theEvent) -{ +void XGUI_DataTree::resizeEvent(QResizeEvent *theEvent) { QTreeView::resizeEvent(theEvent); QSize aSize = theEvent->size(); if (aSize.isValid()) { @@ -164,24 +153,26 @@ void XGUI_DataTree::resizeEvent(QResizeEvent* theEvent) } #ifdef DEBUG_INDXES -void XGUI_DataTree::mousePressEvent(QMouseEvent* theEvent) -{ +void XGUI_DataTree::mousePressEvent(QMouseEvent *theEvent) { QTreeView::mousePressEvent(theEvent); if (theEvent->button() != Qt::MidButton) return; QModelIndex aInd = indexAt(theEvent->pos()); - QString aTxt = - QString("r=%1 c=%2 p=%3").arg(aInd.row()).arg(aInd.column()).arg((long)aInd.internalPointer()); + QString aTxt = QString("r=%1 c=%2 p=%3") + .arg(aInd.row()) + .arg(aInd.column()) + .arg((long)aInd.internalPointer()); QModelIndex aPar = aInd.parent(); - QString aTxt1 = - QString("r=%1 c=%2 p=%3").arg(aPar.row()).arg(aPar.column()).arg((long)aPar.internalPointer()); + QString aTxt1 = QString("r=%1 c=%2 p=%3") + .arg(aPar.row()) + .arg(aPar.column()) + .arg((long)aPar.internalPointer()); QToolTip::showText(theEvent->globalPos(), aTxt + '\n' + aTxt1); } #endif -void XGUI_DataTree::mouseReleaseEvent(QMouseEvent* theEvent) -{ +void XGUI_DataTree::mouseReleaseEvent(QMouseEvent *theEvent) { QTreeView::mouseReleaseEvent(theEvent); #ifdef DEBUG_INDXES if (theEvent->button() != Qt::MidButton) @@ -195,13 +186,12 @@ void XGUI_DataTree::mouseReleaseEvent(QMouseEvent* theEvent) } } -void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex) -{ +void XGUI_DataTree::processHistoryChange(const QModelIndex &theIndex) { SessionPtr aMgr = ModelAPI_Session::get(); // When operation is opened then we can not change history if (aMgr->isOperation()) return; - XGUI_DataModel* aModel = dataModel(); + XGUI_DataModel *aModel = dataModel(); if (aModel->flags(theIndex) == 0) return; ObjectPtr aObj = aModel->object(theIndex); @@ -213,7 +203,8 @@ void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex) if (aObj->document() != aDoc) return; aMgr->startOperation(aOpName); - aDoc->setCurrentFeature(std::dynamic_pointer_cast(aObj), true); + aDoc->setCurrentFeature(std::dynamic_pointer_cast(aObj), + true); aMgr->finishOperation(); } else { // Ignore clicks on folders outside current document @@ -235,33 +226,35 @@ void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex) update(aModel->index(i, 1, aParent)); update(aModel->index(i, 2, aParent)); } - XGUI_ObjectsBrowser* aObjBrowser = qobject_cast(parent()); + XGUI_ObjectsBrowser *aObjBrowser = + qobject_cast(parent()); aObjBrowser->workshop()->displayer()->updateViewer(); } -void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex) -{ - XGUI_ObjectsBrowser* aObjBrowser = qobject_cast(parent()); - XGUI_DataModel* aModel = dataModel(); +void XGUI_DataTree::processEyeClick(const QModelIndex &theIndex) { + XGUI_ObjectsBrowser *aObjBrowser = + qobject_cast(parent()); + XGUI_DataModel *aModel = dataModel(); ObjectPtr aObj = aModel->object(theIndex); if (aObj.get()) { std::set anObjects; anObjects.insert(aObj); bool hasHiddenState = aModel->hasHiddenState(theIndex); - if (aObjBrowser && hasHiddenState && !aObjBrowser->workshop()->prepareForDisplay(anObjects)) + if (aObjBrowser && hasHiddenState && + !aObjBrowser->workshop()->prepareForDisplay(anObjects)) return; if (hasHiddenState) { // #issue 2335(hide all faces then show solid problem) if (aObj->isDisplayed()) aObj->setDisplayed(false); aObj->setDisplayed(true); - } - else + } else aObj->setDisplayed(!aObj->isDisplayed()); // Update list of selected objects because this event happens after // selection event in object browser - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); update(theIndex); if (aObjBrowser) { aObjBrowser->onSelectionChanged(); @@ -269,8 +262,7 @@ void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex) } } -void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex) -{ +void XGUI_DataTree::onDoubleClick(const QModelIndex &theIndex) { switch (theIndex.column()) { case 2: processHistoryChange(theIndex); @@ -278,21 +270,14 @@ void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex) } } - //******************************************************************** //******************************************************************** //******************************************************************** -XGUI_ActiveDocLbl::XGUI_ActiveDocLbl(const QString& theText, QWidget* theParent ) - : QLabel(theText, theParent), - myPreSelectionStyle(""), - myNeutralStyle(""), - mySelectionStyle(""), - myIsSelected(false) -{ -} +XGUI_ActiveDocLbl::XGUI_ActiveDocLbl(const QString &theText, QWidget *theParent) + : QLabel(theText, theParent), myPreSelectionStyle(""), myNeutralStyle(""), + mySelectionStyle(""), myIsSelected(false) {} -void XGUI_ActiveDocLbl::setTreeView(QTreeView* theView) -{ +void XGUI_ActiveDocLbl::setTreeView(QTreeView *theView) { myTreeView = theView; setFont(myTreeView->font()); @@ -302,20 +287,21 @@ void XGUI_ActiveDocLbl::setTreeView(QTreeView* theView) myPreSelectionStyle = "QLabel {background-color: "; myPreSelectionStyle += aHighlight.lighter(170).name() + "}"; - //myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " + - // aHighlight.lighter(170).name() + ");"; - //myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }"; + // myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 + // white, stop:1 " + + // aHighlight.lighter(170).name() + ");"; + // myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }"; QString aName = aPalet.color(QPalette::Base).name(); myNeutralStyle = "QLabel { border: 1px solid " + aName + " }"; - #if (!defined HAVE_SALOME) && (defined WIN32) mySelectionStyle = "QLabel {background-color: "; mySelectionStyle += "rgb(205, 232, 255); "; - //mySelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(236, 245, 255)"; - //mySelectionStyle += ", stop:1 rgb(208, 229, 255));"; - //mySelectionStyle += "border: 1px solid rgb(132, 172, 221); border-radius: 2px }"; + // mySelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 + // rgb(236, 245, 255)"; mySelectionStyle += ", stop:1 rgb(208, 229, 255));"; + // mySelectionStyle += "border: 1px solid rgb(132, 172, 221); border-radius: + // 2px }"; mySelectionStyle += "border: 1px solid rgb(153, 209, 255) }"; #else mySelectionStyle = "QLabel {background-color: " + aHighlight.name(); @@ -325,26 +311,23 @@ void XGUI_ActiveDocLbl::setTreeView(QTreeView* theView) myTreeView->viewport()->installEventFilter(this); } - #if (!defined HAVE_SALOME) && (defined WIN32) -bool XGUI_ActiveDocLbl::event(QEvent* theEvent) -{ +bool XGUI_ActiveDocLbl::event(QEvent *theEvent) { switch (theEvent->type()) { - case QEvent::Enter: - if (!myIsSelected) - setStyleSheet(myPreSelectionStyle); - break; - case QEvent::Leave: - if (!myIsSelected) - setStyleSheet(myNeutralStyle); - break; + case QEvent::Enter: + if (!myIsSelected) + setStyleSheet(myPreSelectionStyle); + break; + case QEvent::Leave: + if (!myIsSelected) + setStyleSheet(myNeutralStyle); + break; } return QLabel::event(theEvent); } #endif -bool XGUI_ActiveDocLbl::eventFilter(QObject* theObj, QEvent* theEvent) -{ +bool XGUI_ActiveDocLbl::eventFilter(QObject *theObj, QEvent *theEvent) { if (theObj == myTreeView->viewport()) { if (theEvent->type() == QEvent::MouseButtonRelease) unselect(); @@ -353,8 +336,7 @@ bool XGUI_ActiveDocLbl::eventFilter(QObject* theObj, QEvent* theEvent) } static bool MYClearing = false; -void XGUI_ActiveDocLbl::mouseReleaseEvent( QMouseEvent* e) -{ +void XGUI_ActiveDocLbl::mouseReleaseEvent(QMouseEvent *e) { MYClearing = true; myIsSelected = true; setStyleSheet(mySelectionStyle); @@ -365,34 +347,32 @@ void XGUI_ActiveDocLbl::mouseReleaseEvent( QMouseEvent* e) MYClearing = false; } -void XGUI_ActiveDocLbl::unselect() -{ +void XGUI_ActiveDocLbl::unselect() { if (!MYClearing) { myIsSelected = false; setStyleSheet(myNeutralStyle); } } - //******************************************************************** //******************************************************************** //******************************************************************** -XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent, XGUI_Workshop* theWorkshop) - : QWidget(theParent), myDocModel(0), myWorkshop(theWorkshop) -{ - QVBoxLayout* aLayout = new QVBoxLayout(this); +XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget *theParent, + XGUI_Workshop *theWorkshop) + : QWidget(theParent), myDocModel(0), myWorkshop(theWorkshop) { + QVBoxLayout *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->setSpacing(0); - QWidget* aLabelWgt = new QWidget(this); + QWidget *aLabelWgt = new QWidget(this); aLabelWgt->setAutoFillBackground(true); aLayout->addWidget(aLabelWgt); - QHBoxLayout* aLabelLay = new QHBoxLayout(aLabelWgt); + QHBoxLayout *aLabelLay = new QHBoxLayout(aLabelWgt); ModuleBase_Tools::zeroMargins(aLabelLay); aLabelLay->setSpacing(0); - QLabel* aLbl = new QLabel(aLabelWgt); + QLabel *aLbl = new QLabel(aLabelWgt); aLbl->setPixmap(QPixmap(":pictures/assembly.png")); aLbl->setMargin(2); // Do not paint background of the label (in order to show icon) @@ -404,8 +384,8 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent, XGUI_Workshop* theW DocumentPtr aDoc = aMgr->moduleDocument(); myActiveDocLbl = new XGUI_ActiveDocLbl(tr("Part set"), aLabelWgt); -// myActiveDocLbl->setReadOnly(true); -// myActiveDocLbl->setFrame(false); + // myActiveDocLbl->setReadOnly(true); + // myActiveDocLbl->setFrame(false); myActiveDocLbl->setContextMenuPolicy(Qt::CustomContextMenu); aLabelLay->addWidget(myActiveDocLbl); @@ -427,32 +407,31 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent, XGUI_Workshop* theW connect(myDocModel, SIGNAL(beforeTreeRebuild()), SLOT(onBeforeReset())); connect(myDocModel, SIGNAL(treeRebuilt()), SLOT(onAfterModelReset())); - connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, - SLOT(onContextMenuRequested(QContextMenuEvent*))); + connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent *)), this, + SLOT(onContextMenuRequested(QContextMenuEvent *))); } //*************************************************** -XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() -{ -} +XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() {} -void XGUI_ObjectsBrowser::initialize(ModuleBase_ITreeNode* theRoot) -{ - //myDocModel->setXMLReader(theReader); +void XGUI_ObjectsBrowser::initialize(ModuleBase_ITreeNode *theRoot) { + // myDocModel->setXMLReader(theReader); myDocModel->setRoot(theRoot); myTreeView->setModel(myDocModel); // It has to be done after setting of model myActiveDocLbl->setTreeView(myTreeView); - QItemSelectionModel* aSelMod = myTreeView->selectionModel(); - connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), - this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&))); + QItemSelectionModel *aSelMod = myTreeView->selectionModel(); + connect( + aSelMod, + SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), + this, + SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &))); } //*************************************************** -void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent) -{ +void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent *theEvent) { QModelIndexList aIndexes; QObjectPtrList aSelectedData = selectedObjects(&aIndexes); bool toEnable = false; @@ -465,40 +444,40 @@ void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent) Qt::ItemFlags aFlags = dataModel()->flags(aIndexes.first()); toEnable = ((aFlags & Qt::ItemIsEditable) != 0); } - foreach(QAction* aCmd, actions()) { + foreach (QAction *aCmd, actions()) { aCmd->setEnabled(toEnable); } emit contextMenuRequested(theEvent); } //*************************************************** -void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint& thePnt) -{ +void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint &thePnt) { myTreeView->selectionModel()->clearSelection(); - //Empty feature pointer means that selected root document - foreach(QAction* aCmd, actions()) { + // Empty feature pointer means that selected root document + foreach (QAction *aCmd, actions()) { aCmd->setEnabled(true); } - QContextMenuEvent aEvent(QContextMenuEvent::Mouse, thePnt, myActiveDocLbl->mapToGlobal(thePnt)); + QContextMenuEvent aEvent(QContextMenuEvent::Mouse, thePnt, + myActiveDocLbl->mapToGlobal(thePnt)); emit contextMenuRequested(&aEvent); } //*************************************************** -void XGUI_ObjectsBrowser::onEditItem() -{ +void XGUI_ObjectsBrowser::onEditItem() { QObjectPtrList aSelectedData = selectedObjects(); if (aSelectedData.size() > 0) { ObjectPtr anObject = aSelectedData.first(); - if (anObject.get()) { // Selection happens in TreeView - // check whether the object can be renamed. There should not be parts which are not loaded + if (anObject.get()) { // Selection happens in TreeView + // check whether the object can be renamed. There should not be parts + // which are not loaded std::set aFeatures; aFeatures.insert(ModelAPI_Feature::feature(anObject)); - if (!XGUI_Tools::canRemoveOrRename((QWidget*)parent(), aFeatures)) + if (!XGUI_Tools::canRemoveOrRename((QWidget *)parent(), aFeatures)) return; // Find index which corresponds the feature QModelIndex aIndex; - foreach(QModelIndex aIdx, selectedIndexes()) { + foreach (QModelIndex aIdx, selectedIndexes()) { if (aIdx.column() == 1) { ObjectPtr aFea = dataModel()->object(aIdx); if (dataModel()->object(aIdx)->isSame(anObject)) { @@ -517,17 +496,17 @@ void XGUI_ObjectsBrowser::onEditItem() } //*************************************************** -QList XGUI_ObjectsBrowser::expandedItems(const QModelIndex& theParent) const -{ - QList aIndexes; +QList +XGUI_ObjectsBrowser::expandedItems(const QModelIndex &theParent) const { + QList aIndexes; QModelIndex aIndex; int aCount = myDocModel->rowCount(theParent); for (int i = 0; i < aCount; i++) { aIndex = myDocModel->index(i, 0, theParent); if (myDocModel->hasChildren(aIndex)) { if (myTreeView->isExpanded(aIndex)) { - aIndexes.append((ModuleBase_ITreeNode*)aIndex.internalPointer()); - QList aSubIndexes = expandedItems(aIndex); + aIndexes.append((ModuleBase_ITreeNode *)aIndex.internalPointer()); + QList aSubIndexes = expandedItems(aIndex); if (!aSubIndexes.isEmpty()) aIndexes.append(aSubIndexes); } @@ -537,23 +516,21 @@ QList XGUI_ObjectsBrowser::expandedItems(const QModelInde } //*************************************************** -void XGUI_ObjectsBrowser::rebuildDataTree() -{ +void XGUI_ObjectsBrowser::rebuildDataTree() { myDocModel->root()->update(); myDocModel->rebuildDataTree(); update(); } //*************************************************** -void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects) -{ - QItemSelectionModel* aSelectModel = myTreeView->selectionModel(); +void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList &theObjects) { + QItemSelectionModel *aSelectModel = myTreeView->selectionModel(); QModelIndexList aIndexes = aSelectModel->selectedIndexes(); if (theObjects.size() == 0) { bool aIsBlock = aSelectModel->blockSignals(true); aSelectModel->clear(); aSelectModel->blockSignals(aIsBlock); - foreach(QModelIndex aIdx, aIndexes) { + foreach (QModelIndex aIdx, aIndexes) { myTreeView->update(aIdx); } return; @@ -563,7 +540,7 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects) QModelIndexList aUnselect; QObjectPtrList aToSelect = theObjects; QHash aNotChanged; - foreach(QModelIndex aIdx, aIndexes) { + foreach (QModelIndex aIdx, aIndexes) { aObject = myDocModel->object(aIdx); if (aObject.get()) { if (aToSelect.contains(aObject)) { @@ -571,30 +548,30 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects) } else { aUnselect.append(aIdx); } - } - else { + } else { aUnselect.append(aIdx); } } - foreach(ObjectPtr aObj, aNotChanged) + foreach (ObjectPtr aObj, aNotChanged) aToSelect.removeAll(aObj); bool aIsBlock = aSelectModel->blockSignals(true); - foreach(QModelIndex aIdx, aUnselect) { + foreach (QModelIndex aIdx, aUnselect) { aSelectModel->select(aIdx, QItemSelectionModel::Deselect); myTreeView->update(aIdx); } QModelIndex aIndex0, aIndex1, aIndex2, aCurrent; - foreach(ObjectPtr aFeature, aToSelect) { + foreach (ObjectPtr aFeature, aToSelect) { aIndex1 = myDocModel->objectIndex(aFeature, 1); if (aIndex1.isValid()) { if (!aCurrent.isValid()) aCurrent = aIndex1; aIndex0 = myDocModel->objectIndex(aFeature, 0); aIndex2 = myDocModel->objectIndex(aFeature, 2); - aSelectModel->select(aIndex1, QItemSelectionModel::Select | QItemSelectionModel::Rows); + aSelectModel->select(aIndex1, QItemSelectionModel::Select | + QItemSelectionModel::Rows); myTreeView->update(aIndex0); myTreeView->update(aIndex1); myTreeView->update(aIndex2); @@ -605,10 +582,9 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects) } //*************************************************** -void XGUI_ObjectsBrowser::ensureVisible(const ObjectPtr theObject) -{ +void XGUI_ObjectsBrowser::ensureVisible(const ObjectPtr theObject) { QModelIndex aIndex = myDocModel->objectIndex(theObject); - if (aIndex.isValid()) { + if (aIndex.isValid()) { QModelIndex aParent = aIndex.parent(); while (aParent.isValid()) { myTreeView->expand(aParent); @@ -619,32 +595,26 @@ void XGUI_ObjectsBrowser::ensureVisible(const ObjectPtr theObject) } //*************************************************** -void XGUI_ObjectsBrowser::clearContent() -{ - myTreeView->clear(); -} +void XGUI_ObjectsBrowser::clearContent() { myTreeView->clear(); } //*************************************************** -void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& /*theSelected*/, - const QItemSelection& /*theDeselected*/) -{ +void XGUI_ObjectsBrowser::onSelectionChanged( + const QItemSelection & /*theSelected*/, + const QItemSelection & /*theDeselected*/) { onSelectionChanged(); } //*************************************************** -void XGUI_ObjectsBrowser::onSelectionChanged() -{ - emit selectionChanged(); -} +void XGUI_ObjectsBrowser::onSelectionChanged() { emit selectionChanged(); } //*************************************************** -QObjectPtrList XGUI_ObjectsBrowser::selectedObjects(QModelIndexList* theIndexes) const -{ +QObjectPtrList +XGUI_ObjectsBrowser::selectedObjects(QModelIndexList *theIndexes) const { QObjectPtrList aList; QModelIndexList aIndexes = selectedIndexes(); - XGUI_DataModel* aModel = dataModel(); + XGUI_DataModel *aModel = dataModel(); - foreach(QModelIndex aIdx, aIndexes) { + foreach (QModelIndex aIdx, aIndexes) { if (aIdx.column() == 1) { ObjectPtr aObject = aModel->object(aIdx); if (aObject) { @@ -657,16 +627,12 @@ QObjectPtrList XGUI_ObjectsBrowser::selectedObjects(QModelIndexList* theIndexes) return aList; } -void XGUI_ObjectsBrowser::onBeforeReset() -{ - myExpandedItems = expandedItems(); -} +void XGUI_ObjectsBrowser::onBeforeReset() { myExpandedItems = expandedItems(); } -void XGUI_ObjectsBrowser::onAfterModelReset() -{ - XGUI_DataModel* aModel = myTreeView->dataModel(); +void XGUI_ObjectsBrowser::onAfterModelReset() { + XGUI_DataModel *aModel = myTreeView->dataModel(); QModelIndex aIndex; - foreach(ModuleBase_ITreeNode* aNode, myExpandedItems) { + foreach (ModuleBase_ITreeNode *aNode, myExpandedItems) { if (aModel->hasNode(aNode)) { aIndex = aModel->getIndex(aNode, 0); if (aIndex.isValid() && (myTreeView->dataModel()->hasIndex(aIndex))) @@ -676,10 +642,9 @@ void XGUI_ObjectsBrowser::onAfterModelReset() myExpandedItems.clear(); } -std::list XGUI_ObjectsBrowser::getStateForDoc(DocumentPtr theDoc) const -{ +std::list XGUI_ObjectsBrowser::getStateForDoc(DocumentPtr theDoc) const { std::list aStates; - XGUI_DataModel* aModel = dataModel(); + XGUI_DataModel *aModel = dataModel(); QModelIndex aRootIdx = aModel->documentRootIndex(theDoc); int aNbChild = aModel->rowCount(aRootIdx); for (int i = 0; i < aNbChild; i++) { @@ -689,26 +654,26 @@ std::list XGUI_ObjectsBrowser::getStateForDoc(DocumentPtr theDoc) const return aStates; } -void XGUI_ObjectsBrowser::setStateForDoc(DocumentPtr theDoc, const std::list& theStates) -{ +void XGUI_ObjectsBrowser::setStateForDoc(DocumentPtr theDoc, + const std::list &theStates) { if (theStates.size() == 0) return; - XGUI_DataModel* aModel = dataModel(); + XGUI_DataModel *aModel = dataModel(); QModelIndex aRootIdx = aModel->documentRootIndex(theDoc); int aNbChild = aModel->rowCount(aRootIdx); std::list::const_iterator aIt; int i = 0; for (aIt = theStates.cbegin(); aIt != theStates.cend(); aIt++, i++) { - if (i >= aNbChild ) + if (i >= aNbChild) break; QModelIndex aIdx = aModel->index(i, 0, aRootIdx); myTreeView->setExpanded(aIdx, (*aIt)); } } -void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, const QModelIndex& theParent) -{ +void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, + const QModelIndex &theParent) { int aNb = myDocModel->rowCount(theParent); for (int i = 0; i < aNb; i++) { QModelIndex aIdx = myDocModel->index(i, theColumn, theParent); @@ -720,8 +685,8 @@ void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, const QModelIndex& the } } -QMap XGUI_ObjectsBrowser::getFoldersState(DocumentPtr theDoc) const -{ +QMap +XGUI_ObjectsBrowser::getFoldersState(DocumentPtr theDoc) const { QMap aMap; int aNb = theDoc->size(ModelAPI_Folder::group()); @@ -734,8 +699,8 @@ QMap XGUI_ObjectsBrowser::getFoldersState(DocumentPtr theDoc) c return aMap; } -void XGUI_ObjectsBrowser::setFoldersState(const QMap& theStates) -{ +void XGUI_ObjectsBrowser::setFoldersState( + const QMap &theStates) { QMap::const_iterator aIt; for (aIt = theStates.constBegin(); aIt != theStates.constEnd(); aIt++) { QModelIndex aIdx = myDocModel->objectIndex(aIt.key(), 0); @@ -743,9 +708,7 @@ void XGUI_ObjectsBrowser::setFoldersState(const QMap& theStates } } - -void XGUI_ObjectsBrowser::resizeEvent(QResizeEvent* theEvent) -{ +void XGUI_ObjectsBrowser::resizeEvent(QResizeEvent *theEvent) { QWidget::resizeEvent(theEvent); emit sizeChanged(); } diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index f6e01b19b..60c568075 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -14,23 +14,24 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ObjectsBrowser_H #define XGUI_ObjectsBrowser_H #include "XGUI.h" -#include -#include -#include #include #include +#include +#include +#include -#include -#include #include #include +#include +#include class ModuleBase_IDocumentDataModel; class XGUI_DataModel; @@ -41,27 +42,26 @@ class ModuleBase_ITreeNode; //#define DEBUG_INDXES /** -* \ingroup GUI -* Implementation of root label in Object Browser -*/ -class XGUI_ActiveDocLbl: public QLabel -{ -Q_OBJECT - public: - /// Constructor - /// \param theText a text - /// \param theParent a parent widget - XGUI_ActiveDocLbl(const QString& theText, QWidget* theParent ); - - /// Sets tree view - /// \param theView a view - void setTreeView(QTreeView* theView); - - /// Returns tree view - QTreeView* treePalette() const { return myTreeView;} + * \ingroup GUI + * Implementation of root label in Object Browser + */ +class XGUI_ActiveDocLbl : public QLabel { + Q_OBJECT +public: + /// Constructor + /// \param theText a text + /// \param theParent a parent widget + XGUI_ActiveDocLbl(const QString &theText, QWidget *theParent); + + /// Sets tree view + /// \param theView a view + void setTreeView(QTreeView *theView); + + /// Returns tree view + QTreeView *treePalette() const { return myTreeView; } #if (!defined HAVE_SALOME) && (defined WIN32) - virtual bool event(QEvent* theEvent); + virtual bool event(QEvent *theEvent); #endif public slots: @@ -70,111 +70,105 @@ public slots: protected: /// On mouse release - virtual void mouseReleaseEvent( QMouseEvent* e); + virtual void mouseReleaseEvent(QMouseEvent *e); /// Filter event - bool eventFilter(QObject* theObj, QEvent* theEvent); + bool eventFilter(QObject *theObj, QEvent *theEvent); private: QString myPreSelectionStyle; QString myNeutralStyle; QString mySelectionStyle; - QTreeView* myTreeView; + QTreeView *myTreeView; bool myIsSelected; }; - /** -* \ingroup GUI -* Implementation of Data Tree object for Object Browser -*/ -class XGUI_EXPORT XGUI_DataTree : public QTreeView -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent widget - XGUI_DataTree(QWidget* theParent); + * \ingroup GUI + * Implementation of Data Tree object for Object Browser + */ +class XGUI_EXPORT XGUI_DataTree : public QTreeView { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent widget + XGUI_DataTree(QWidget *theParent); virtual ~XGUI_DataTree(); /// Returns current data model - XGUI_DataModel* dataModel() const; + XGUI_DataModel *dataModel() const; signals: //! Emited on context menu request - void contextMenuRequested(QContextMenuEvent* theEvent); + void contextMenuRequested(QContextMenuEvent *theEvent); public slots: /// Clear content of data tree virtual void clear(); - protected slots: +protected slots: /// Commit modified data (used for renaming of objects) - virtual void commitData(QWidget* theEditor); + virtual void commitData(QWidget *theEditor); /// A slot which is called on mouse double click - void onDoubleClick(const QModelIndex&); + void onDoubleClick(const QModelIndex &); - protected: - /// Redefinition of virtual method - virtual void contextMenuEvent(QContextMenuEvent* theEvent); +protected: + /// Redefinition of virtual method + virtual void contextMenuEvent(QContextMenuEvent *theEvent); - /// Redefinition of virtual method - virtual void resizeEvent(QResizeEvent* theEvent); + /// Redefinition of virtual method + virtual void resizeEvent(QResizeEvent *theEvent); - /// Redefinition of virtual method - virtual void mouseReleaseEvent(QMouseEvent* theEvent); + /// Redefinition of virtual method + virtual void mouseReleaseEvent(QMouseEvent *theEvent); #ifdef DEBUG_INDXES - virtual void mousePressEvent(QMouseEvent* theEvent); + virtual void mousePressEvent(QMouseEvent *theEvent); #endif private: /// Process a history change request /// \param theIndex a clicked data index - void processHistoryChange(const QModelIndex& theIndex); + void processHistoryChange(const QModelIndex &theIndex); /// Process a visibility change request /// \param theIndex a clicked data index - void processEyeClick(const QModelIndex& theIndex); + void processEyeClick(const QModelIndex &theIndex); }; /**\class XGUI_ObjectsBrowser * \ingroup GUI - * \brief Object browser window object. Represents data tree of current data structure + * \brief Object browser window object. Represents data tree of current data + * structure */ -class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent widget - XGUI_ObjectsBrowser(QWidget* theParent, XGUI_Workshop* theWorkshop); +class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent widget + XGUI_ObjectsBrowser(QWidget *theParent, XGUI_Workshop *theWorkshop); virtual ~XGUI_ObjectsBrowser(); //! Returns Model which provides access to data objects - XGUI_DataModel* dataModel() const - { - return myDocModel; - } + XGUI_DataModel *dataModel() const { return myDocModel; } //! Returns list of currently selected objects //! \param theIndexes - output list of corresponded indexes (can be NULL) - QObjectPtrList selectedObjects(QModelIndexList* theIndexes = 0) const; + QObjectPtrList selectedObjects(QModelIndexList *theIndexes = 0) const; /// Set selected list of objects /// \param theObjects list of objects to select - void setObjectsSelected(const QObjectPtrList& theObjects); + void setObjectsSelected(const QObjectPtrList &theObjects); //! Scroll TreeView to make given object visible //! \param theObject object to make it visible void ensureVisible(const ObjectPtr theObject); //! Returns currently selected indexes - QModelIndexList selectedIndexes() const - { + QModelIndexList selectedIndexes() const { if (myTreeView->selectionModel()) return myTreeView->selectionModel()->selectedIndexes(); else @@ -182,13 +176,10 @@ Q_OBJECT } //! Returns TreeView widget - XGUI_DataTree* treeView() const - { - return myTreeView; - } + XGUI_DataTree *treeView() const { return myTreeView; } /// Returns active doc label object - QLabel* activeDocLabel() const { return myActiveDocLbl; } + QLabel *activeDocLabel() const { return myActiveDocLbl; } /// Rebuild data tree void rebuildDataTree(); @@ -197,7 +188,7 @@ Q_OBJECT void clearContent(); /// Initialize the Object browser - void initialize(ModuleBase_ITreeNode* theRoot); + void initialize(ModuleBase_ITreeNode *theRoot); /// Returns list of folders opened state for the given document /// \param theDoc the document @@ -207,21 +198,22 @@ Q_OBJECT /// Set folders opened state for the given document /// \param theDoc the document /// \param theStates list of booleans with state expanded or not - void setStateForDoc(DocumentPtr theDoc, const std::list& theStates); + void setStateForDoc(DocumentPtr theDoc, const std::list &theStates); /// Returns current workshop - XGUI_Workshop* workshop() const { return myWorkshop; } + XGUI_Workshop *workshop() const { return myWorkshop; } void onSelectionChanged(); /// Updates all items of object browser /// \param theColumn - column of items /// \param theParent - a parent item (by default from root) - void updateAllIndexes(int theColumn = 0, const QModelIndex& theParent = QModelIndex()); + void updateAllIndexes(int theColumn = 0, + const QModelIndex &theParent = QModelIndex()); QMap getFoldersState(DocumentPtr theDoc) const; - void setFoldersState(const QMap& theStates); + void setFoldersState(const QMap &theStates); public slots: //! Called on Edit command request @@ -232,48 +224,49 @@ signals: void selectionChanged(); //! Emited on context menu request - void contextMenuRequested(QContextMenuEvent* theEvent); + void contextMenuRequested(QContextMenuEvent *theEvent); - //! Segnal is emitted when user cliks by mouse in header label of object browser - void headerMouseDblClicked(const QModelIndex&); + //! Segnal is emitted when user cliks by mouse in header label of object + //! browser + void headerMouseDblClicked(const QModelIndex &); //! An signal emitted on resize of the Object Browser void sizeChanged(); - protected: //! redefinition of a virtual method - void resizeEvent(QResizeEvent* theEvent); + void resizeEvent(QResizeEvent *theEvent); - - private slots: +private slots: /// Show context menu /// \param theEvent a context menu event - void onContextMenuRequested(QContextMenuEvent* theEvent); + void onContextMenuRequested(QContextMenuEvent *theEvent); /// Show context menu on upper label /// \param thePnt a position of context menu - void onLabelContextMenuRequested(const QPoint& thePnt); + void onLabelContextMenuRequested(const QPoint &thePnt); //! Called when selection in Data Tree is changed - void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected); + void onSelectionChanged(const QItemSelection &theSelected, + const QItemSelection &theDeselected); void onBeforeReset(); void onAfterModelReset(); - private: - QList expandedItems(const QModelIndex& theParent = QModelIndex()) const; +private: + QList + expandedItems(const QModelIndex &theParent = QModelIndex()) const; //! Internal model - XGUI_DataModel* myDocModel; - XGUI_ActiveDocLbl* myActiveDocLbl; - XGUI_DataTree* myTreeView; - XGUI_Workshop* myWorkshop; + XGUI_DataModel *myDocModel; + XGUI_ActiveDocLbl *myActiveDocLbl; + XGUI_DataTree *myTreeView; + XGUI_Workshop *myWorkshop; /// A field to store expanded items before model reset - //QModelIndexList myExpandedItems; - QList myExpandedItems; + // QModelIndexList myExpandedItems; + QList myExpandedItems; }; #endif diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 5db1d07a7..45ad37c48 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -14,62 +14,63 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_OperationMgr.h" #include "XGUI_ActiveControlMgr.h" #include "XGUI_ActiveControlSelector.h" -#include "XGUI_FacesPanelSelector.h" -#include "XGUI_ModuleConnector.h" -#include "XGUI_Workshop.h" +#include "XGUI_ContextMenuMgr.h" #include "XGUI_ErrorMgr.h" #include "XGUI_FacesPanel.h" -#include "XGUI_Tools.h" +#include "XGUI_FacesPanelSelector.h" +#include "XGUI_ModuleConnector.h" #include "XGUI_ObjectsBrowser.h" -#include "XGUI_ContextMenuMgr.h" #include "XGUI_Selection.h" #include "XGUI_SelectionMgr.h" +#include "XGUI_Tools.h" +#include "XGUI_Workshop.h" -#include -#include -#include "ModuleBase_Operation.h" -#include "ModuleBase_IWorkshop.h" #include "ModuleBase_IModule.h" -#include +#include "ModuleBase_IWorkshop.h" +#include "ModuleBase_Operation.h" #include "ModuleBase_OperationDescription.h" #include "ModuleBase_OperationFeature.h" #include "ModuleBase_Tools.h" +#include +#include +#include #include #include #include -#include -#include #include +#include +#include -#include #include #include +#include #include //#define DEBUG_CURRENT_FEATURE -/// Processes "Delete" key event of application. This key is used by several application actions. -/// There is a logical order of the actions processing. So the key can not be set for actions -/// as a shortcut. The class listens the key event and call operation manager processor. -class XGUI_ShortCutListener : public QObject -{ +/// Processes "Delete" key event of application. This key is used by several +/// application actions. There is a logical order of the actions processing. So +/// the key can not be set for actions as a shortcut. The class listens the key +/// event and call operation manager processor. +class XGUI_ShortCutListener : public QObject { public: /// Constructor /// \param theParent the parent to be deleted when the parent is deleted /// \param theOperationMgr the class to perform deletion - XGUI_ShortCutListener(XGUI_OperationMgr* theOperationMgr) - : QObject(theOperationMgr), myOperationMgr(theOperationMgr), myIsActive(false) - { + XGUI_ShortCutListener(XGUI_OperationMgr *theOperationMgr) + : QObject(theOperationMgr), myOperationMgr(theOperationMgr), + myIsActive(false) { qApp->installEventFilter(this); } ~XGUI_ShortCutListener() {} @@ -81,18 +82,18 @@ public: virtual bool eventFilter(QObject *theObject, QEvent *theEvent); private: - XGUI_OperationMgr* myOperationMgr; /// processor for key event - bool myIsActive; /// boolean state whether the event filter perform own signal processing + XGUI_OperationMgr *myOperationMgr; /// processor for key event + bool myIsActive; /// boolean state whether the event filter perform own signal + /// processing }; -bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) -{ +bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) { bool isAccepted = false; if (myIsActive) { - // Do not process keys for modal dialogues: all keys has to be processed within the dialog - // There is only one exception: ModuleBase_EditorDialog - QWindow* aWnd = qApp->modalWindow(); + // Do not process keys for modal dialogues: all keys has to be processed + // within the dialog There is only one exception: ModuleBase_EditorDialog + QWindow *aWnd = qApp->modalWindow(); QString aName = "NoModal"; if (aWnd) { if (!aWnd->objectName().startsWith("ModuleBase_EditorDialog")) @@ -100,19 +101,22 @@ bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) } if (aName == "NoModal") { if (theEvent->type() == QEvent::KeyRelease) { - QKeyEvent* aKeyEvent = dynamic_cast(theEvent); + QKeyEvent *aKeyEvent = dynamic_cast(theEvent); if (aKeyEvent) { - myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier); + myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & + Qt::ShiftModifier); switch (aKeyEvent->key()) { case Qt::Key_Delete: isAccepted = myOperationMgr->onProcessDelete(theObject); break; - case Qt::Key_F2: - { - QObjectPtrList anObjects = myOperationMgr->xworkshop()->selector()->selection()->selectedObjects(); - if (myOperationMgr->xworkshop()->abortAllOperations()) - { - myOperationMgr->xworkshop()->objectBrowser()->setObjectsSelected(anObjects); + case Qt::Key_F2: { + QObjectPtrList anObjects = myOperationMgr->xworkshop() + ->selector() + ->selection() + ->selectedObjects(); + if (myOperationMgr->xworkshop()->abortAllOperations()) { + myOperationMgr->xworkshop()->objectBrowser()->setObjectsSelected( + anObjects); myOperationMgr->xworkshop()->objectBrowser()->onEditItem(); } isAccepted = true; @@ -123,11 +127,11 @@ bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) break; } } - } - else if (theEvent->type() == QEvent::KeyPress) { + } else if (theEvent->type() == QEvent::KeyPress) { if (myOperationMgr->hasOperation()) { - QKeyEvent* aKeyEvent = dynamic_cast(theEvent); - myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier); + QKeyEvent *aKeyEvent = dynamic_cast(theEvent); + myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & + Qt::ShiftModifier); isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent); } } @@ -138,85 +142,66 @@ bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) return isAccepted; } - - -XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent, - ModuleBase_IWorkshop* theWorkshop) -: QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(0), mySHIFTPressed(false) -{ - /// we need to install filter to the application in order to react to 'Delete' key button - /// this key can not be a short cut for a corresponded action because we need to set - /// the actions priority +XGUI_OperationMgr::XGUI_OperationMgr(QObject *theParent, + ModuleBase_IWorkshop *theWorkshop) + : QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(0), + mySHIFTPressed(false) { + /// we need to install filter to the application in order to react to 'Delete' + /// key button this key can not be a short cut for a corresponded action + /// because we need to set the actions priority myShortCutListener = new XGUI_ShortCutListener(this); } -XGUI_OperationMgr::~XGUI_OperationMgr() -{ -} +XGUI_OperationMgr::~XGUI_OperationMgr() {} -void XGUI_OperationMgr::activate() -{ - myShortCutListener->setActive(true); -} +void XGUI_OperationMgr::activate() { myShortCutListener->setActive(true); } -void XGUI_OperationMgr::deactivate() -{ - myShortCutListener->setActive(false); -} +void XGUI_OperationMgr::deactivate() { myShortCutListener->setActive(false); } -ModuleBase_Operation* XGUI_OperationMgr::currentOperation() const -{ +ModuleBase_Operation *XGUI_OperationMgr::currentOperation() const { return myOperations.count() > 0 ? myOperations.last() : 0; } -bool XGUI_OperationMgr::isCurrentOperation(ModuleBase_Operation* theOperation) -{ - if(!hasOperation()) +bool XGUI_OperationMgr::isCurrentOperation(ModuleBase_Operation *theOperation) { + if (!hasOperation()) return false; return currentOperation() == theOperation; } -bool XGUI_OperationMgr::hasOperation() const -{ +bool XGUI_OperationMgr::hasOperation() const { return !myOperations.isEmpty() && (myOperations.last() != NULL); } -bool XGUI_OperationMgr::hasOperation(const QString& theId) const -{ - foreach(ModuleBase_Operation* aOp, myOperations) { +bool XGUI_OperationMgr::hasOperation(const QString &theId) const { + foreach (ModuleBase_Operation *aOp, myOperations) { if (aOp->id() == theId) return true; } return false; } -ModuleBase_Operation* XGUI_OperationMgr::findOperation(const QString& theId) const -{ - QList::const_iterator anIt = myOperations.end(); +ModuleBase_Operation * +XGUI_OperationMgr::findOperation(const QString &theId) const { + QList::const_iterator anIt = myOperations.end(); while (anIt != myOperations.begin()) { --anIt; - ModuleBase_Operation* anOperation = *anIt; + ModuleBase_Operation *anOperation = *anIt; if (anOperation->id() == theId) return anOperation; } return 0; } +int XGUI_OperationMgr::operationsCount() const { return myOperations.count(); } -int XGUI_OperationMgr::operationsCount() const -{ - return myOperations.count(); -} - -QStringList XGUI_OperationMgr::operationList() const -{ +QStringList XGUI_OperationMgr::operationList() const { QStringList result; - foreach(ModuleBase_Operation* eachOperation, myOperations) { - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(eachOperation); + foreach (ModuleBase_Operation *eachOperation, myOperations) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(eachOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); - if(aFeature) { + if (aFeature) { result << QString::fromStdString(aFeature->getKind()); } } @@ -224,36 +209,37 @@ QStringList XGUI_OperationMgr::operationList() const return result; } -ModuleBase_Operation* XGUI_OperationMgr::previousOperation(ModuleBase_Operation* theOperation) const -{ +ModuleBase_Operation * +XGUI_OperationMgr::previousOperation(ModuleBase_Operation *theOperation) const { int idx = myOperations.lastIndexOf(theOperation); - if(idx == -1 || idx == 0) { + if (idx == -1 || idx == 0) { return NULL; } return myOperations.at(idx - 1); } -ModuleBase_ModelWidget* XGUI_OperationMgr::activeWidget() const -{ - ModuleBase_ModelWidget* anActiveWidget = 0; - ModuleBase_Operation* anOperation = currentOperation(); +ModuleBase_ModelWidget *XGUI_OperationMgr::activeWidget() const { + ModuleBase_ModelWidget *anActiveWidget = 0; + ModuleBase_Operation *anOperation = currentOperation(); if (anOperation) { - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); if (aPanel) anActiveWidget = aPanel->activeWidget(); } return anActiveWidget; } -bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation) -{ +bool XGUI_OperationMgr::startOperation(ModuleBase_Operation *theOperation) { if (hasOperation()) currentOperation()->postpone(); myOperations.append(theOperation); - connect(theOperation, SIGNAL(beforeStarted()), SLOT(onBeforeOperationStarted())); - connect(theOperation, SIGNAL(beforeAborted()), SLOT(onBeforeOperationAborted())); - connect(theOperation, SIGNAL(beforeCommitted()), SLOT(onBeforeOperationCommitted())); + connect(theOperation, SIGNAL(beforeStarted()), + SLOT(onBeforeOperationStarted())); + connect(theOperation, SIGNAL(beforeAborted()), + SLOT(onBeforeOperationAborted())); + connect(theOperation, SIGNAL(beforeCommitted()), + SLOT(onBeforeOperationCommitted())); connect(theOperation, SIGNAL(started()), SLOT(onOperationStarted())); connect(theOperation, SIGNAL(aborted()), SLOT(onOperationAborted())); @@ -268,53 +254,51 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation) return isStarted; } -bool XGUI_OperationMgr::abortAllOperations(const XGUI_MessageKind& theMessageKind) -{ +bool XGUI_OperationMgr::abortAllOperations( + const XGUI_MessageKind &theMessageKind) { bool aResult = true; - if(!hasOperation()) + if (!hasOperation()) return aResult; if (operationsCount() == 1) { - ModuleBase_Operation* aCurrentOperation = currentOperation(); + ModuleBase_Operation *aCurrentOperation = currentOperation(); if (canStopOperation(aCurrentOperation, theMessageKind)) { abortOperation(aCurrentOperation); - } - else + } else aResult = false; - } - else { + } else { if (theMessageKind == XGUI_AbortOperationMessage) { - myActiveMessageBox = createMessageBox(tr("All active operations will be aborted.")); + myActiveMessageBox = + createMessageBox(tr("All active operations will be aborted.")); aResult = myActiveMessageBox->exec() == QMessageBox::Ok; myActiveMessageBox = 0; - } - else if (theMessageKind == XGUI_InformationMessage) { - QString aMessage = tr("Please validate all your active operations before saving."); + } else if (theMessageKind == XGUI_InformationMessage) { + QString aMessage = + tr("Please validate all your active operations before saving."); myActiveMessageBox = createInformationBox(aMessage); myActiveMessageBox->exec(); myActiveMessageBox = 0; aResult = false; // do not perform abort } - while(aResult && hasOperation()) { + while (aResult && hasOperation()) { abortOperation(currentOperation()); } } return aResult; } -bool XGUI_OperationMgr::commitAllOperations() -{ +bool XGUI_OperationMgr::commitAllOperations() { bool isCompositeCommitted = false, anOperationProcessed = false; while (hasOperation()) { - ModuleBase_Operation* anOperation = currentOperation(); + ModuleBase_Operation *anOperation = currentOperation(); if (XGUI_Tools::workshop(myWorkshop)->errorMgr()->isApplyEnabled()) { anOperationProcessed = commitOperation(); } else { abortOperation(anOperation); anOperationProcessed = true; } - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(anOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); CompositeFeaturePtr aComposite = @@ -325,35 +309,35 @@ bool XGUI_OperationMgr::commitAllOperations() } // not processed[committed] operation might be used in composite feature, // so the while will be stopped by the previous check. - // this code is not necessary, but logically should be done when the processing will not - // be done for not composite feature by some reasons + // this code is not necessary, but logically should be done when the + // processing will not be done for not composite feature by some reasons if (!anOperationProcessed) break; } return true; } -void XGUI_OperationMgr::onValidateOperation() -{ +void XGUI_OperationMgr::onValidateOperation() { if (!hasOperation()) return; - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (currentOperation()); - if(aFOperation && aFOperation->feature().get()) - XGUI_Tools::workshop(myWorkshop)->errorMgr()->updateActions(aFOperation->feature()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(currentOperation()); + if (aFOperation && aFOperation->feature().get()) + XGUI_Tools::workshop(myWorkshop) + ->errorMgr() + ->updateActions(aFOperation->feature()); } -void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperation) -{ - XGUI_ErrorMgr* anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr(); +void XGUI_OperationMgr::updateApplyOfOperations( + ModuleBase_Operation *theOperation) { + XGUI_ErrorMgr *anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr(); if (theOperation) { - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) anErrorMgr->updateAcceptAllAction(aFOperation->feature()); - } - else { - foreach(ModuleBase_Operation* anOperation, myOperations) { + } else { + foreach (ModuleBase_Operation *anOperation, myOperations) { if (anOperation) updateApplyOfOperations(anOperation); } @@ -362,19 +346,23 @@ void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperati onValidateOperation(); } -bool XGUI_OperationMgr::canStopOperation(ModuleBase_Operation* theOperation, - const XGUI_OperationMgr::XGUI_MessageKind& theMessageKind) -{ - //in case of nested (sketch) operation no confirmation needed +bool XGUI_OperationMgr::canStopOperation( + ModuleBase_Operation *theOperation, + const XGUI_OperationMgr::XGUI_MessageKind &theMessageKind) { + // in case of nested (sketch) operation no confirmation needed if (isGrantedOperation(theOperation->id())) return true; if (theOperation && theOperation->isModified()) { - ModuleBase_OperationFeature* aOp = dynamic_cast(theOperation); + ModuleBase_OperationFeature *aOp = + dynamic_cast(theOperation); std::string aContext; if (aOp && aOp->feature()) aContext = aOp->feature()->getKind(); - QString aTitle = Config_Translator::translate(aContext, - theOperation->getDescription()->description().toStdString()).c_str(); + QString aTitle = + Config_Translator::translate( + aContext, + theOperation->getDescription()->description().toStdString()) + .c_str(); if (theMessageKind == XGUI_AbortOperationMessage) { QString aMessage = tr("%1 operation will be aborted.").arg(aTitle); @@ -382,9 +370,9 @@ bool XGUI_OperationMgr::canStopOperation(ModuleBase_Operation* theOperation, bool aResult = myActiveMessageBox->exec() == QMessageBox::Ok; myActiveMessageBox = 0; return aResult; - } - else if (theMessageKind == XGUI_InformationMessage) { - QString aMessage = tr("Please validate your %1 before saving.").arg(aTitle); + } else if (theMessageKind == XGUI_InformationMessage) { + QString aMessage = + tr("Please validate your %1 before saving.").arg(aTitle); myActiveMessageBox = createInformationBox(aMessage); myActiveMessageBox->exec(); myActiveMessageBox = 0; @@ -394,63 +382,62 @@ bool XGUI_OperationMgr::canStopOperation(ModuleBase_Operation* theOperation, return true; } -void XGUI_OperationMgr::resumeOperation(ModuleBase_Operation* theOperation) -{ +void XGUI_OperationMgr::resumeOperation(ModuleBase_Operation *theOperation) { theOperation->resume(); } -bool XGUI_OperationMgr::isGrantedOperation(const QString& theId) -{ +bool XGUI_OperationMgr::isGrantedOperation(const QString &theId) { bool isGranted = false; - QListIterator anIt(myOperations); + QListIterator anIt(myOperations); anIt.toBack(); while (anIt.hasPrevious() && !isGranted) { - ModuleBase_Operation* anOp = anIt.previous(); + ModuleBase_Operation *anOp = anIt.previous(); if (anOp) isGranted = anOp->isGranted(theId); } return isGranted; } -void XGUI_OperationMgr::setCurrentFeature(const FeaturePtr& theFeature) -{ +void XGUI_OperationMgr::setCurrentFeature(const FeaturePtr &theFeature) { SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); bool aIsOp = aMgr->isOperation(); if (!aIsOp) aMgr->startOperation(QString("Set current feature: %1") - .arg(theFeature->getKind().c_str()).toStdString()); + .arg(theFeature->getKind().c_str()) + .toStdString()); aDoc->setCurrentFeature(theFeature, false); #ifdef DEBUG_CURRENT_FEATURE - qDebug(QString(" document->setCurrentFeature(false) = %1 SET").arg( - ModuleBase_Tools::objectName( - ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str()); + qDebug( + QString(" document->setCurrentFeature(false) = %1 SET") + .arg(ModuleBase_Tools::objectName( + ModelAPI_Session::get()->activeDocument()->currentFeature(false))) + .toStdString() + .c_str()); #endif if (!aIsOp) aMgr->finishOperation(); } -bool XGUI_OperationMgr::canStartOperation(const QString& theId, bool& isCommitted) -{ +bool XGUI_OperationMgr::canStartOperation(const QString &theId, + bool &isCommitted) { bool aCanStart = true; isCommitted = false; - ModuleBase_Operation* aCurrentOp = currentOperation(); + ModuleBase_Operation *aCurrentOp = currentOperation(); if (aCurrentOp) { bool aGranted = aCurrentOp->isGranted(theId); // the started operation is granted for the current one, // e.g. current - Sketch, started - Line if (aGranted) { aCanStart = true; - } - else { + } else { if (!isGrantedOperation(theId)) { // the operation is not granted in the current list of operations // e.g. Edit Parameter when Sketch, Line in Sketch is active. aCanStart = abortAllOperations(); - } - else if (canStopOperation(aCurrentOp)) { + } else if (canStopOperation(aCurrentOp)) { // the started operation is granted in the parrent operation, // e.g. current - Line in Sketch, started Circle stopOperation(aCurrentOp, isCommitted); @@ -462,8 +449,8 @@ bool XGUI_OperationMgr::canStartOperation(const QString& theId, bool& isCommitte return aCanStart; } -void XGUI_OperationMgr::stopOperation(ModuleBase_Operation* theOperation, bool& isCommitted) -{ +void XGUI_OperationMgr::stopOperation(ModuleBase_Operation *theOperation, + bool &isCommitted) { if (XGUI_Tools::workshop(myWorkshop)->errorMgr()->isApplyEnabled() && theOperation->isModified()) { isCommitted = theOperation->commit(); @@ -473,91 +460,97 @@ void XGUI_OperationMgr::stopOperation(ModuleBase_Operation* theOperation, bool& } } -void XGUI_OperationMgr::abortOperation(ModuleBase_Operation* theOperation) -{ - ModuleBase_Operation* aCurrentOperation = currentOperation(); +void XGUI_OperationMgr::abortOperation(ModuleBase_Operation *theOperation) { + ModuleBase_Operation *aCurrentOperation = currentOperation(); if (theOperation && (theOperation == aCurrentOperation)) theOperation->abort(); else { - // it is possible to trigger upper operation(e.g. sketch, current is sketch line) - // all operation from the current to triggered should also be aborted - // operations over the parameter one are not aborted(e.g. extrusion cut, sketch abort) - while(hasOperation()) { - ModuleBase_Operation* aCurOperation = currentOperation(); + // it is possible to trigger upper operation(e.g. sketch, current is sketch + // line) all operation from the current to triggered should also be aborted + // operations over the parameter one are not aborted(e.g. extrusion cut, + // sketch abort) + while (hasOperation()) { + ModuleBase_Operation *aCurOperation = currentOperation(); aCurOperation->abort(); - if(theOperation == aCurOperation) + if (theOperation == aCurOperation) break; } } } -bool XGUI_OperationMgr::commitOperation() -{ +bool XGUI_OperationMgr::commitOperation() { bool isCommitted = false; - ModuleBase_Operation* anOperation = currentOperation(); + ModuleBase_Operation *anOperation = currentOperation(); if (anOperation && myWorkshop->module()->canCommitOperation()) isCommitted = anOperation->commit(); return isCommitted; } -void XGUI_OperationMgr::onAbortOperation() -{ - ModuleBase_Operation* aCurrentOperation = currentOperation(); +void XGUI_OperationMgr::onAbortOperation() { + ModuleBase_Operation *aCurrentOperation = currentOperation(); if (aCurrentOperation && canStopOperation(aCurrentOperation)) { abortOperation(aCurrentOperation); } } -void XGUI_OperationMgr::onAbortAllOperation() -{ - abortAllOperations(); -} +void XGUI_OperationMgr::onAbortAllOperation() { abortAllOperations(); } -void XGUI_OperationMgr::onBeforeOperationStarted() -{ - ModuleBase_Operation* aCurrentOperation = dynamic_cast(sender()); +void XGUI_OperationMgr::onBeforeOperationStarted() { + ModuleBase_Operation *aCurrentOperation = + dynamic_cast(sender()); if (!aCurrentOperation) return; /// Set current feature and remeber old current feature - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(aCurrentOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(aCurrentOperation); if (aFOperation) { SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); - // the parameter of current feature should be false, we should use all feature, not only - // visible in order to correctly save the previous feature of the nested operation, where the - // features can be not visible in the tree. The problem case is Edit sketch entitity(line) - // in the Sketch, created in ExtrusionCut operation. The entity disappears by commit. - // When sketch entity operation started, the sketch should be cashed here as the current. - // Otherwise(the flag is true), the ExtrusionCut is cashed, when commit happens, the sketch - // is disabled, sketch entity is disabled as extrusion cut is created earliest then sketch. - // As a result the sketch disappears from the viewer. - // However after commit it is displayed back. + // the parameter of current feature should be false, we should use all + // feature, not only visible in order to correctly save the previous feature + // of the nested operation, where the features can be not visible in the + // tree. The problem case is Edit sketch entitity(line) in the Sketch, + // created in ExtrusionCut operation. The entity disappears by commit. When + // sketch entity operation started, the sketch should be cashed here as the + // current. Otherwise(the flag is true), the ExtrusionCut is cashed, when + // commit happens, the sketch is disabled, sketch entity is disabled as + // extrusion cut is created earliest then sketch. As a result the sketch + // disappears from the viewer. However after commit it is displayed back. aFOperation->setPreviousCurrentFeature(aDoc->currentFeature(false)); #ifdef DEBUG_CURRENT_FEATURE FeaturePtr aFeature = aFOperation->feature(); QString aKind = aFeature ? aFeature->getKind().c_str() : ""; qDebug(""); - qDebug(QString("onBeforeOperationStarted() isEditOperation = %1, feature = %2") + qDebug( + QString("onBeforeOperationStarted() isEditOperation = %1, feature = %2") .arg(aFOperation->isEditOperation()) - .arg(ModuleBase_Tools::objectName(aFeature)).toStdString().c_str()); - qDebug(QString(" document->currentFeature(false) = %1 : DO: setPreviousCurrentFeature").arg( - ModuleBase_Tools::objectName(aDoc->currentFeature(false))).toStdString().c_str()); + .arg(ModuleBase_Tools::objectName(aFeature)) + .toStdString() + .c_str()); + qDebug(QString(" document->currentFeature(false) = %1 : DO: " + "setPreviousCurrentFeature") + .arg(ModuleBase_Tools::objectName(aDoc->currentFeature(false))) + .toStdString() + .c_str()); #endif - if (aFOperation->isEditOperation()) {// it should be performed by the feature edit only + if (aFOperation->isEditOperation()) { // it should be performed by the + // feature edit only // in create operation, the current feature is changed by addFeature() aDoc->setCurrentFeature(aFOperation->feature(), false); #ifdef DEBUG_CURRENT_FEATURE - qDebug(QString(" document->setCurrentFeature(false) = %1").arg( - ModuleBase_Tools::objectName(aDoc->currentFeature(false))).toStdString().c_str()); + qDebug(QString(" document->setCurrentFeature(false) = %1") + .arg(ModuleBase_Tools::objectName(aDoc->currentFeature(false))) + .toStdString() + .c_str()); #endif - // this is the only place where flushes must be called after setCurrentFeature for the - // current moment: after this the opertion is not finished, so, the ObjectBrowser - // state may be corrupted (issue #1457) - static Events_Loop* aLoop = Events_Loop::loop(); + // this is the only place where flushes must be called after + // setCurrentFeature for the current moment: after this the opertion is + // not finished, so, the ObjectBrowser state may be corrupted (issue + // #1457) + static Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aCreateEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); aLoop->flush(aCreateEvent); static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED); @@ -566,87 +559,92 @@ void XGUI_OperationMgr::onBeforeOperationStarted() } } -void XGUI_OperationMgr::onOperationStarted() -{ - ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); +void XGUI_OperationMgr::onOperationStarted() { + ModuleBase_Operation *aSenderOperation = + dynamic_cast(sender()); updateApplyOfOperations(aSenderOperation); - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); aWorkshop->operationStarted(aSenderOperation); } -void XGUI_OperationMgr::onBeforeOperationAborted() -{ +void XGUI_OperationMgr::onBeforeOperationAborted() { onBeforeOperationCommitted(); } -void XGUI_OperationMgr::onOperationAborted() -{ - ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); +void XGUI_OperationMgr::onOperationAborted() { + ModuleBase_Operation *aSenderOperation = + dynamic_cast(sender()); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); aWorkshop->setStatusBarMessage(""); emit operationAborted(aSenderOperation); } -void XGUI_OperationMgr::onBeforeOperationCommitted() -{ - ModuleBase_Operation* aCurrentOperation = dynamic_cast(sender()); +void XGUI_OperationMgr::onBeforeOperationCommitted() { + ModuleBase_Operation *aCurrentOperation = + dynamic_cast(sender()); if (!aCurrentOperation) return; /// Restore the previous current feature - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(aCurrentOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(aCurrentOperation); if (aFOperation) { #ifdef DEBUG_CURRENT_FEATURE QString aKind = aFOperation->feature()->getKind().c_str(); - qDebug(QString("onBeforeOperationCommitted() isEditOperation = %1, feature = %2") + qDebug( + QString( + "onBeforeOperationCommitted() isEditOperation = %1, feature = %2") .arg(aFOperation->isEditOperation()) - .arg(ModuleBase_Tools::objectName(aFOperation->feature())).toStdString().c_str()); - qDebug(QString(" document->currentFeature(false) = %1").arg( - ModuleBase_Tools::objectName( - ModelAPI_Session::get()->activeDocument()->currentFeature(false))) - .toStdString().c_str()); + .arg(ModuleBase_Tools::objectName(aFOperation->feature())) + .toStdString() + .c_str()); + qDebug(QString(" document->currentFeature(false) = %1") + .arg(ModuleBase_Tools::objectName( + ModelAPI_Session::get()->activeDocument()->currentFeature( + false))) + .toStdString() + .c_str()); #endif if (aFOperation->isEditOperation()) { /// Restore the previous current feature setCurrentFeature(aFOperation->previousCurrentFeature()); - } - else { // create operation + } else { // create operation // the Top created feature should stays the current. In nested operations, // like Line in the Sketch or - // Sketch in ExtrusionCut, a previous feature should be restored on commit. - // It is performed here - // in order to perform it in the current transaction without opening a new one. + // Sketch in ExtrusionCut, a previous feature should be restored on + // commit. It is performed here in order to perform it in the current + // transaction without opening a new one. if (myOperations.front() != aFOperation) setCurrentFeature(aFOperation->previousCurrentFeature()); } - ModuleBase_IModule* aModule = myWorkshop->module(); + ModuleBase_IModule *aModule = myWorkshop->module(); if (aModule) aModule->beforeOperationStopped(aFOperation); } } -void XGUI_OperationMgr::onOperationCommitted() -{ +void XGUI_OperationMgr::onOperationCommitted() { // apply state for all features from the stack of operations should be updated updateApplyOfOperations(); - ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); + ModuleBase_Operation *aSenderOperation = + dynamic_cast(sender()); emit operationCommitted(aSenderOperation); } -void XGUI_OperationMgr::onOperationResumed() -{ - ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); +void XGUI_OperationMgr::onOperationResumed() { + ModuleBase_Operation *aSenderOperation = + dynamic_cast(sender()); emit operationResumed(aSenderOperation); } -void XGUI_OperationMgr::onOperationStopped() -{ - ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - ModuleBase_Operation* aCurrentOperation = currentOperation(); - if (!aSenderOperation || !aCurrentOperation || aSenderOperation != aCurrentOperation) +void XGUI_OperationMgr::onOperationStopped() { + ModuleBase_Operation *aSenderOperation = + dynamic_cast(sender()); + ModuleBase_Operation *aCurrentOperation = currentOperation(); + if (!aSenderOperation || !aCurrentOperation || + aSenderOperation != aCurrentOperation) return; myOperations.removeAll(aCurrentOperation); @@ -655,161 +653,159 @@ void XGUI_OperationMgr::onOperationStopped() emit operationStopped(aCurrentOperation); // get last operation which can be resumed - ModuleBase_Operation* aResultOp = 0; - QListIterator anIt(myOperations); + ModuleBase_Operation *aResultOp = 0; + QListIterator anIt(myOperations); anIt.toBack(); while (anIt.hasPrevious()) { - ModuleBase_Operation* anOp = anIt.previous(); + ModuleBase_Operation *anOp = anIt.previous(); if (anOp) { aResultOp = anOp; break; } } if (aResultOp) { - //bool isModified = aCurrentOperation->isModified(); - //aResultOp->setIsModified(aResultOp->isModified() || isModified); + // bool isModified = aCurrentOperation->isModified(); + // aResultOp->setIsModified(aResultOp->isModified() || isModified); resumeOperation(aResultOp); onValidateOperation(); } } -bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent* theEvent) -{ +bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent *theEvent) { bool isAccepted = false; // Let the manager decide what to do with the given key combination. - ModuleBase_Operation* anOperation = currentOperation(); + ModuleBase_Operation *anOperation = currentOperation(); switch (theEvent->key()) { - case Qt::Key_Tab: - case Qt::Key_Backtab: - { - ModuleBase_Operation* aOperation = currentOperation(); - if (aOperation) { - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); - if (aPanel) { - QWidget* aFocusedWidget = qApp->focusWidget(); - bool isPPChildObject = aFocusedWidget && isChildObject(aFocusedWidget, aPanel); - if (!isPPChildObject) { - // check for case when the operation is started but property panel is not filled - XGUI_PropertyPanel* aPP = dynamic_cast(aPanel); - aPP->setFocusNextPrevChild(theEvent->key() == Qt::Key_Tab); - isAccepted = true; - } - } - } - } - break; - case Qt::Key_Return: - case Qt::Key_Enter: { - isAccepted = onProcessEnter(theObject); - } - break; - case Qt::Key_N: - case Qt::Key_P: { - bool noModifiers = (theEvent->modifiers() == Qt::NoModifier); - if (noModifiers) { - ModuleBase_IViewer* aViewer = myWorkshop->viewer(); - Handle(AIS_InteractiveContext) aContext = aViewer->AISContext(); - if (!aContext.IsNull()) { - Handle(V3d_View) aView = aViewer->activeView(); - if ((theEvent->key() == Qt::Key_N)) - aContext->HilightNextDetected(aView); - else if ((theEvent->key() == Qt::Key_P)) - aContext->HilightPreviousDetected(aView); - aViewer->updateHighlight(); + case Qt::Key_Tab: + case Qt::Key_Backtab: { + ModuleBase_Operation *aOperation = currentOperation(); + if (aOperation) { + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); + if (aPanel) { + QWidget *aFocusedWidget = qApp->focusWidget(); + bool isPPChildObject = + aFocusedWidget && isChildObject(aFocusedWidget, aPanel); + if (!isPPChildObject) { + // check for case when the operation is started but property panel is + // not filled + XGUI_PropertyPanel *aPP = dynamic_cast(aPanel); + aPP->setFocusNextPrevChild(theEvent->key() == Qt::Key_Tab); isAccepted = true; } } + } + } break; + case Qt::Key_Return: + case Qt::Key_Enter: { + isAccepted = onProcessEnter(theObject); + } break; + case Qt::Key_N: + case Qt::Key_P: { + bool noModifiers = (theEvent->modifiers() == Qt::NoModifier); + if (noModifiers) { + ModuleBase_IViewer *aViewer = myWorkshop->viewer(); + Handle(AIS_InteractiveContext) aContext = aViewer->AISContext(); + if (!aContext.IsNull()) { + Handle(V3d_View) aView = aViewer->activeView(); + if ((theEvent->key() == Qt::Key_N)) + aContext->HilightNextDetected(aView); + else if ((theEvent->key() == Qt::Key_P)) + aContext->HilightPreviousDetected(aView); + aViewer->updateHighlight(); + isAccepted = true; } - break; - case Qt::Key_H: - if ((theEvent->modifiers() == Qt::NoModifier)) + } + } break; + case Qt::Key_H: + if ((theEvent->modifiers() == Qt::NoModifier)) myWorkshop->viewer()->hideSelectionHighlight(); - break; - default: - isAccepted = false; - break; + break; + default: + isAccepted = false; + break; } - //if(anOperation) { - // anOperation->keyReleased(theEvent->key()); - //} + // if(anOperation) { + // anOperation->keyReleased(theEvent->key()); + // } return isAccepted; } -bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent* theEvent) -{ +bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent *theEvent) { // Let the manager decide what to do with the given key combination. bool isAccepted = false; switch (theEvent->key()) { - case Qt::Key_Escape: { - // processing in message box - if (myActiveMessageBox) - { - myActiveMessageBox->reject(); - isAccepted = true; - } - // processing in the active widget - ModuleBase_Operation* aOperation = currentOperation(); - if (!isAccepted && aOperation) { - ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); - if (aPanel) { - ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget(); - if (anActiveWgt) - { - isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape); - if (isAccepted) { - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(currentOperation()); - if (aFOperation) - aFOperation->setNeedToBeAborted(true); - } + case Qt::Key_Escape: { + // processing in message box + if (myActiveMessageBox) { + myActiveMessageBox->reject(); + isAccepted = true; + } + // processing in the active widget + ModuleBase_Operation *aOperation = currentOperation(); + if (!isAccepted && aOperation) { + ModuleBase_IPropertyPanel *aPanel = aOperation->propertyPanel(); + if (aPanel) { + ModuleBase_ModelWidget *anActiveWgt = aPanel->activeWidget(); + if (anActiveWgt) { + isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape); + if (isAccepted) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(currentOperation()); + if (aFOperation) + aFOperation->setNeedToBeAborted(true); } } } - if (!isAccepted) - { - XGUI_ActiveControlSelector* anActiveSelector = - XGUI_Tools::workshop(myWorkshop)->activeControlMgr()->activeSelector(); - if (anActiveSelector && anActiveSelector->getType() == XGUI_FacesPanelSelector::Type()) - isAccepted = XGUI_Tools::workshop(myWorkshop)->facesPanel()->processAction(ActionEscape); - } - // default Escape button functionality - if (!isAccepted && aOperation) { - onAbortOperation(); - isAccepted = true; - } } + if (!isAccepted) { + XGUI_ActiveControlSelector *anActiveSelector = + XGUI_Tools::workshop(myWorkshop) + ->activeControlMgr() + ->activeSelector(); + if (anActiveSelector && + anActiveSelector->getType() == XGUI_FacesPanelSelector::Type()) + isAccepted = XGUI_Tools::workshop(myWorkshop) + ->facesPanel() + ->processAction(ActionEscape); + } + // default Escape button functionality + if (!isAccepted && aOperation) { + onAbortOperation(); + isAccepted = true; + } + } break; + case Qt::Key_H: + if ((theEvent->modifiers() == Qt::NoModifier)) + myWorkshop->viewer()->showSelectionHighlight(); break; - case Qt::Key_H: - if ((theEvent->modifiers() == Qt::NoModifier)) - myWorkshop->viewer()->showSelectionHighlight(); - break; } return isAccepted; } -bool XGUI_OperationMgr::onProcessEnter(QObject* theObject) -{ +bool XGUI_OperationMgr::onProcessEnter(QObject *theObject) { bool isAccepted = false; - ModuleBase_Operation* aOperation = currentOperation(); + ModuleBase_Operation *aOperation = currentOperation(); // to avoid enter processing when operation has not been started yet if (!aOperation) return isAccepted; - ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = aOperation->propertyPanel(); if (!aPanel) return isAccepted; - // the next code is obsolete as we want to process Enter in property panel always - // only property panel enter is processed in order to do not process enter in application dialogs - //bool isPPChild = isChildObject(theObject, aPanel); - //if (!isPPChild) + // the next code is obsolete as we want to process Enter in property panel + // always only property panel enter is processed in order to do not process + // enter in application dialogs + // bool isPPChild = isChildObject(theObject, aPanel); + // if (!isPPChild) // return isAccepted; - ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget(); + ModuleBase_ModelWidget *anActiveWgt = aPanel->activeWidget(); bool isAborted = false; if (!anActiveWgt) { - QWidget* aFocusWidget = aPanel->focusWidget(); - QToolButton* aCancelBtn = - dynamic_cast(aPanel)->findButton(PROP_PANEL_CANCEL); + QWidget *aFocusWidget = aPanel->focusWidget(); + QToolButton *aCancelBtn = + dynamic_cast(aPanel)->findButton( + PROP_PANEL_CANCEL); if (aFocusWidget && aCancelBtn && aFocusWidget == aCancelBtn) { abortOperation(aOperation); isAccepted = true; @@ -819,21 +815,21 @@ bool XGUI_OperationMgr::onProcessEnter(QObject* theObject) if (!isAborted) { isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEnter); if (!isAccepted) { - isAccepted = - myWorkshop->module()->processEnter(anActiveWgt ? anActiveWgt->attributeID() : ""); + isAccepted = myWorkshop->module()->processEnter( + anActiveWgt ? anActiveWgt->attributeID() : ""); if (!isAccepted) { /// functionality is similar to Apply click - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(currentOperation()); - if (!aFOperation || - myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(currentOperation()); + if (!aFOperation || myWorkshop->module() + ->getFeatureError(aFOperation->feature()) + .isEmpty()) { // key released is emitted to apply the current value to the model // if it was modified in PP emit keyEnterReleased(); commitOperation(); isAccepted = true; - } - else + } else isAccepted = false; } } @@ -841,26 +837,25 @@ bool XGUI_OperationMgr::onProcessEnter(QObject* theObject) return isAccepted; } -bool editorControl(QObject* theObject) -{ - QLineEdit* aLineEdit = dynamic_cast(theObject); +bool editorControl(QObject *theObject) { + QLineEdit *aLineEdit = dynamic_cast(theObject); return aLineEdit; } -bool XGUI_OperationMgr::onProcessDelete(QObject* theObject) -{ +bool XGUI_OperationMgr::onProcessDelete(QObject *theObject) { bool isAccepted = false; - ModuleBase_Operation* aOperation = currentOperation(); - ModuleBase_ModelWidget* anActiveWgt = 0; + ModuleBase_Operation *aOperation = currentOperation(); + ModuleBase_ModelWidget *anActiveWgt = 0; // firstly the widget should process Delete action - ModuleBase_IPropertyPanel* aPanel; + ModuleBase_IPropertyPanel *aPanel; bool isPPChildObject = false; if (aOperation) { aPanel = aOperation->propertyPanel(); if (aPanel) { isPPChildObject = isChildObject(theObject, aPanel); - // process delete in active widget only if delete sender is child of property panel - // it is necessary for the case when OB is shown, user perform selection and click Delete + // process delete in active widget only if delete sender is child of + // property panel it is necessary for the case when OB is shown, user + // perform selection and click Delete if (isPPChildObject) { anActiveWgt = aPanel->activeWidget(); if (anActiveWgt) { @@ -869,36 +864,38 @@ bool XGUI_OperationMgr::onProcessDelete(QObject* theObject) } } } - if (!isAccepted) - { - XGUI_ActiveControlSelector* anActiveSelector = - XGUI_Tools::workshop(myWorkshop)->activeControlMgr()->activeSelector(); - if (anActiveSelector && anActiveSelector->getType() == XGUI_FacesPanelSelector::Type()) - isAccepted = XGUI_Tools::workshop(myWorkshop)->facesPanel()->processAction(ActionDelete); + if (!isAccepted) { + XGUI_ActiveControlSelector *anActiveSelector = + XGUI_Tools::workshop(myWorkshop)->activeControlMgr()->activeSelector(); + if (anActiveSelector && + anActiveSelector->getType() == XGUI_FacesPanelSelector::Type()) + isAccepted = XGUI_Tools::workshop(myWorkshop) + ->facesPanel() + ->processAction(ActionDelete); } if (!isAccepted) { // after widget, object browser and viewer should process delete /// other widgets such as line edit controls should not lead to /// processing delete by workshop - XGUI_ObjectsBrowser* aBrowser = XGUI_Tools::workshop(myWorkshop)->objectBrowser(); - QWidget* aViewPort = myWorkshop->viewer()->activeViewPort(); + XGUI_ObjectsBrowser *aBrowser = + XGUI_Tools::workshop(myWorkshop)->objectBrowser(); + QWidget *aViewPort = myWorkshop->viewer()->activeViewPort(); bool isToDeleteObject = false; - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_ContextMenuMgr* aContextMenuMgr = aWorkshop->contextMenuMgr(); + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_ContextMenuMgr *aContextMenuMgr = aWorkshop->contextMenuMgr(); if (theObject == aBrowser->treeView()) { aContextMenuMgr->updateObjectBrowserMenu(); isToDeleteObject = aContextMenuMgr->action("DELETE_CMD")->isEnabled(); - } - else if (isChildObject(theObject, aViewPort)) { + } else if (isChildObject(theObject, aViewPort)) { aContextMenuMgr->updateViewerMenu(); isToDeleteObject = aContextMenuMgr->action("DELETE_CMD")->isEnabled(); - } - else if (isPPChildObject) { - // property panel child object is processed to process delete performed on Apply button of PP + } else if (isPPChildObject) { + // property panel child object is processed to process delete performed on + // Apply button of PP isToDeleteObject = true; - } - else if (editorControl(theObject)) { - isToDeleteObject = false; /// Line Edit of Rename operation in ObjectBrowser + } else if (editorControl(theObject)) { + isToDeleteObject = + false; /// Line Edit of Rename operation in ObjectBrowser isAccepted = true; } @@ -911,12 +908,12 @@ bool XGUI_OperationMgr::onProcessDelete(QObject* theObject) return isAccepted; } -bool XGUI_OperationMgr::isChildObject(const QObject* theObject, const QObject* theParent) -{ +bool XGUI_OperationMgr::isChildObject(const QObject *theObject, + const QObject *theParent) { bool isPPChild = false; if (theParent && theObject) { - QObject* aParent = (QObject*)theObject; - while (aParent ) { + QObject *aParent = (QObject *)theObject; + while (aParent) { isPPChild = aParent == theParent; if (isPPChild) break; @@ -926,30 +923,30 @@ bool XGUI_OperationMgr::isChildObject(const QObject* theObject, const QObject* t return isPPChild; } -QMessageBox* XGUI_OperationMgr::createMessageBox(const QString& theMessage) -{ - QMessageBox * aMessageBox = new QMessageBox(QMessageBox::Question, - QObject::tr("Abort operation"), theMessage, QMessageBox::Ok | QMessageBox::Cancel, - qApp->activeWindow()); +QMessageBox *XGUI_OperationMgr::createMessageBox(const QString &theMessage) { + QMessageBox *aMessageBox = new QMessageBox( + QMessageBox::Question, QObject::tr("Abort operation"), theMessage, + QMessageBox::Ok | QMessageBox::Cancel, qApp->activeWindow()); aMessageBox->setDefaultButton(QMessageBox::Cancel); - aMessageBox->setEscapeButton(QMessageBox::No); // operation manager should process Esc key + aMessageBox->setEscapeButton( + QMessageBox::No); // operation manager should process Esc key return aMessageBox; } -QMessageBox* XGUI_OperationMgr::createInformationBox(const QString& theMessage) -{ - QMessageBox * aMessageBox = new QMessageBox(QMessageBox::Question, - QObject::tr("Validate operation"), theMessage, QMessageBox::Ok, - qApp->activeWindow()); +QMessageBox * +XGUI_OperationMgr::createInformationBox(const QString &theMessage) { + QMessageBox *aMessageBox = + new QMessageBox(QMessageBox::Question, QObject::tr("Validate operation"), + theMessage, QMessageBox::Ok, qApp->activeWindow()); aMessageBox->setDefaultButton(QMessageBox::Ok); - aMessageBox->setEscapeButton(QMessageBox::No); // operation manager should process Esc key + aMessageBox->setEscapeButton( + QMessageBox::No); // operation manager should process Esc key return aMessageBox; } -XGUI_Workshop* XGUI_OperationMgr::xworkshop() const -{ - XGUI_ModuleConnector* aConnector = (XGUI_ModuleConnector*) myWorkshop; +XGUI_Workshop *XGUI_OperationMgr::xworkshop() const { + XGUI_ModuleConnector *aConnector = (XGUI_ModuleConnector *)myWorkshop; return aConnector->workshop(); } diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index a478c3cca..5e89325c5 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_OperationMgr_H @@ -22,8 +23,8 @@ #include "XGUI.h" -#include #include "ModelAPI_Feature.h" +#include #include #include @@ -38,29 +39,31 @@ class XGUI_ShortCutListener; /**\class XGUI_OperationMgr * \ingroup GUI - * \brief Operation manager. Servers to manipulate to the workshop operations. Contains a stack - * of started operations. In simple case, if only one operation is started, the stack contains - * one operation. It is possible for some kind of operations to start them above already - * started one. In that case, the previous active operation becomes suspended, a new one - active. - * The new operation is added to the top of the stack. Then it is finished, it is removed from - * the stack and the previous operation is activated. + * \brief Operation manager. Servers to manipulate to the workshop operations. + * Contains a stack of started operations. In simple case, if only one operation + * is started, the stack contains one operation. It is possible for some kind of + * operations to start them above already started one. In that case, the + * previous active operation becomes suspended, a new one - active. The new + * operation is added to the top of the stack. Then it is finished, it is + * removed from the stack and the previous operation is activated. */ -class XGUI_EXPORT XGUI_OperationMgr : public QObject -{ -Q_OBJECT +class XGUI_EXPORT XGUI_OperationMgr : public QObject { + Q_OBJECT public: - /// Enumeration of kind of message that is used when trying to stop the active operation - enum XGUI_MessageKind - { - XGUI_AbortOperationMessage, ///< warns and give possibility to abort current operation - XGUI_InformationMessage ///< ask to apply the current operation before performing something + /// Enumeration of kind of message that is used when trying to stop the active + /// operation + enum XGUI_MessageKind { + XGUI_AbortOperationMessage, ///< warns and give possibility to abort current + ///< operation + XGUI_InformationMessage ///< ask to apply the current operation before + ///< performing something }; public: /// Constructor /// \param theParent the parent /// \param theWorkshop a reference to workshop - XGUI_OperationMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop); + XGUI_OperationMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop); /// Destructor virtual ~XGUI_OperationMgr(); @@ -72,38 +75,40 @@ public: /// Set reference to workshop /// \param theWorkshop reference to workshop - void setWorkshop(ModuleBase_IWorkshop* theWorkshop) - { myWorkshop = theWorkshop; }; + void setWorkshop(ModuleBase_IWorkshop *theWorkshop) { + myWorkshop = theWorkshop; + }; /// Current workshop - ModuleBase_IWorkshop* workshop() const { return myWorkshop; } + ModuleBase_IWorkshop *workshop() const { return myWorkshop; } /// Current workshop - XGUI_Workshop* xworkshop() const; + XGUI_Workshop *xworkshop() const; /// Returns the current operation or NULL /// \return the current operation - ModuleBase_Operation* currentOperation() const; + ModuleBase_Operation *currentOperation() const; /// Check if the given operation is active operation. /// Also, returns false is ther is no active operation. - bool isCurrentOperation(ModuleBase_Operation* theOperation); + bool isCurrentOperation(ModuleBase_Operation *theOperation); /// Returns true is operation manager has at least one non-null operation. bool hasOperation() const; /// Returns true is operation manager has an operation with given Id. - bool hasOperation(const QString& theId) const; + bool hasOperation(const QString &theId) const; - /// Returns true if the operation can be aborted. If the operation is modified, - /// the warning message box is shown. - /// \param theOperation an operation which is checked on stop - /// \param theMessageKind a kind of message in warning message box - bool canStopOperation(ModuleBase_Operation* theOperation, - const XGUI_MessageKind& theMessageKind = XGUI_AbortOperationMessage); + /// Returns true if the operation can be aborted. If the operation is + /// modified, the warning message box is shown. \param theOperation an + /// operation which is checked on stop \param theMessageKind a kind of message + /// in warning message box + bool canStopOperation( + ModuleBase_Operation *theOperation, + const XGUI_MessageKind &theMessageKind = XGUI_AbortOperationMessage); /// Find and return operation by its Id. - ModuleBase_Operation* findOperation(const QString& theId) const; + ModuleBase_Operation *findOperation(const QString &theId) const; /// Returns number of operations in the stack int operationsCount() const; @@ -113,37 +118,41 @@ public: /// Returns previous (parent) operation if given operation started. /// else, or if there is no parent - returns NULL - ModuleBase_Operation* previousOperation(ModuleBase_Operation* theOperation) const; + ModuleBase_Operation * + previousOperation(ModuleBase_Operation *theOperation) const; /// Returns an active widget of the current operation. /// \return widget or NULL - ModuleBase_ModelWidget* activeWidget() const; + ModuleBase_ModelWidget *activeWidget() const; /// Start the operation and append it to the stack of operations /// \param theOperation the started operation /// \return the state whether the current operation is started - bool startOperation(ModuleBase_Operation* theOperation); + bool startOperation(ModuleBase_Operation *theOperation); - /// Returns whether the operation can be started. Check if there is already started operation and - /// the granted parameter of the launched operation + /// Returns whether the operation can be started. Check if there is already + /// started operation and the granted parameter of the launched operation /// \param theId id of the operation which is going to start - /// \param isCommitted boolean value if the operation was committed otherwise it was aborted - bool canStartOperation(const QString& theId, bool& isCommitted); - - /// If Apply is enabled and operation has modification, it is applyed, otherwise aborted - /// \param theOperation the started operation - /// \param isCommitted boolean value if the operation was committed otherwise it was aborted - void stopOperation(ModuleBase_Operation* theOperation, bool& isCommitted); - - /// Aborts the parameter operation if it is current, else abort operations from the stack - /// of operations until the operation is found. All operations upper the parameter one are - /// not aborted. - /// \param theOperation an aborted operation - void abortOperation(ModuleBase_Operation* theOperation); + /// \param isCommitted boolean value if the operation was committed otherwise + /// it was aborted + bool canStartOperation(const QString &theId, bool &isCommitted); + + /// If Apply is enabled and operation has modification, it is applyed, + /// otherwise aborted \param theOperation the started operation \param + /// isCommitted boolean value if the operation was committed otherwise it was + /// aborted + void stopOperation(ModuleBase_Operation *theOperation, bool &isCommitted); + + /// Aborts the parameter operation if it is current, else abort operations + /// from the stack of operations until the operation is found. All operations + /// upper the parameter one are not aborted. \param theOperation an aborted + /// operation + void abortOperation(ModuleBase_Operation *theOperation); /// Abort all operations /// \param theMessageKind kind of shown warning message - bool abortAllOperations(const XGUI_MessageKind& theMessageKind = XGUI_AbortOperationMessage); + bool abortAllOperations( + const XGUI_MessageKind &theMessageKind = XGUI_AbortOperationMessage); /// Commits the current operation. bool commitOperation(); @@ -161,92 +170,97 @@ public slots: void onAbortOperation(); /// Slot that aborts all operations. It shows aborting message void onAbortAllOperation(); - /// Slot that validates the current operation using the validateOperation method. + /// Slot that validates the current operation using the validateOperation + /// method. void onValidateOperation(); /// Commit all operations bool commitAllOperations(); signals: - /// Signal about an operation is stopped. It is emitted after the stop() of operation is done. - /// \param theOperation a stopped operation - void operationStopped(ModuleBase_Operation* theOperation); + /// Signal about an operation is stopped. It is emitted after the stop() of + /// operation is done. \param theOperation a stopped operation + void operationStopped(ModuleBase_Operation *theOperation); - /// Signal about an operation is resumed. It is emitted after the resume() of operation is done. - void operationResumed(ModuleBase_Operation* theOperation); + /// Signal about an operation is resumed. It is emitted after the resume() of + /// operation is done. + void operationResumed(ModuleBase_Operation *theOperation); /// Emitted when current operation is Committed - void operationCommitted(ModuleBase_Operation* theOperation); + void operationCommitted(ModuleBase_Operation *theOperation); /// Emitted when current operation is aborted - void operationAborted(ModuleBase_Operation* theOperation); + void operationAborted(ModuleBase_Operation *theOperation); /// Signal is emitted after the key released click. void keyEnterReleased(); public: // TEMPORARY, it should be protected and be performed automatically - /// Emits nestedStateChange for operations with an information about validity of the operation - /// \param theOperation the sent operation. If it is NULL, all operations in the stack are sent. - void updateApplyOfOperations(ModuleBase_Operation* theOperation = 0); + /// Emits nestedStateChange for operations with an information about validity + /// of the operation \param theOperation the sent operation. If it is NULL, + /// all operations in the stack are sent. + void updateApplyOfOperations(ModuleBase_Operation *theOperation = 0); protected: // TEMPORARY /// Sets the current operation or NULL /// \param theOperation the started operation - void resumeOperation(ModuleBase_Operation* theOperation); + void resumeOperation(ModuleBase_Operation *theOperation); - /// Returns whether the parameter operation is granted in relation to the previous operation - /// in a stack of started operations. It is used in canStopOperation to avoid warning message - /// when granted operation is aborted, e.g. SketchLine in Sketch - /// \param theId id of the operation which is checked - /// \return boolean result - bool isGrantedOperation(const QString& theId); + /// Returns whether the parameter operation is granted in relation to the + /// previous operation in a stack of started operations. It is used in + /// canStopOperation to avoid warning message when granted operation is + /// aborted, e.g. SketchLine in Sketch \param theId id of the operation which + /// is checked \return boolean result + bool isGrantedOperation(const QString &theId); /// Sets the feature as a current in the document /// \param theFeature a feature - void setCurrentFeature(const FeaturePtr& theFeature); + void setCurrentFeature(const FeaturePtr &theFeature); - public slots: +public slots: /// SLOT, that is called by the key in the property panel is clicked. /// \param theObject a sender of the event /// \param theEvent the mouse event - bool onKeyReleased(QObject *theObject, QKeyEvent* theEvent); + bool onKeyReleased(QObject *theObject, QKeyEvent *theEvent); /// SLOT, that is called by the key in the property panel is clicked. /// \param theObject a sender of the event /// \param theEvent the mouse event - bool onKeyPressed(QObject *theObject, QKeyEvent* theEvent); + bool onKeyPressed(QObject *theObject, QKeyEvent *theEvent); /// The functionaly, that should be done by delete click /// Fistly the active widget processes it, then workshop. If no one does not /// process it, do nothing /// \param theObject a sender of the event - bool onProcessDelete(QObject* theObject); + bool onProcessDelete(QObject *theObject); - protected slots: +protected slots: /// The functionaly, that should be done by enter click /// Fistly the active widget processes it, then module. If no one does not /// process it, the current operation is committed /// \param theObject a sender of the event bool onProcessEnter(QObject *theObject); - /// Slot that is called by an operation stop. Removes the stopped operation form the stack. - /// If there is a suspended operation, restart it. + /// Slot that is called by an operation stop. Removes the stopped operation + /// form the stack. If there is a suspended operation, restart it. void onOperationStopped(); - /// Slot called before operation started. Stores the previous current feature, set the feature - /// of the operation as a current in the document. The previous current feature should be restored - /// by the operation abort/commit + /// Slot called before operation started. Stores the previous current feature, + /// set the feature of the operation as a current in the document. The + /// previous current feature should be restored by the operation abort/commit void onBeforeOperationStarted(); /// Slot called after operation started void onOperationStarted(); - /// Slot called before operation aborted. Restore the previous current operation + /// Slot called before operation aborted. Restore the previous current + /// operation void onBeforeOperationAborted(); /// Slot called after operation aborted void onOperationAborted(); - /// Slot called before operation committed. Restore the previous current operation + /// Slot called before operation committed. Restore the previous current + /// operation void onBeforeOperationCommitted(); /// Slot called after operation committed @@ -259,29 +273,31 @@ private: /// Checks if the object is a parent or a child under /// \param theObject an investivated object /// \param theParent a candidate to be a parent - static bool isChildObject(const QObject* theObject, const QObject* theParent); + static bool isChildObject(const QObject *theObject, const QObject *theParent); - /// Creates question message box with OK/Cancel buttons, where Cancel is default button, - /// Escape is Null button - /// \param theMessage text of the message - /// \return message box - static QMessageBox* createMessageBox(const QString& theMessage); + /// Creates question message box with OK/Cancel buttons, where Cancel is + /// default button, Escape is Null button \param theMessage text of the + /// message \return message box + static QMessageBox *createMessageBox(const QString &theMessage); /// Creates information message box with OK button, /// Escape is Null button /// \param theMessage text of the message /// \return message box - static QMessageBox* createInformationBox(const QString& theMessage); + static QMessageBox *createInformationBox(const QString &theMessage); - private: - typedef QList Operations; ///< definition for a list of operations - Operations myOperations; ///< a stack of started operations. The active operation is on top, - // others are suspended and started by the active is finished +private: + typedef QList + Operations; ///< definition for a list of operations + Operations myOperations; ///< a stack of started operations. The active + ///< operation is on top, + // others are suspended and started by the active is + // finished /// Current workshop - ModuleBase_IWorkshop* myWorkshop; - QMessageBox* myActiveMessageBox; - XGUI_ShortCutListener* myShortCutListener; + ModuleBase_IWorkshop *myWorkshop; + QMessageBox *myActiveMessageBox; + XGUI_ShortCutListener *myShortCutListener; bool mySHIFTPressed; }; diff --git a/src/XGUI/XGUI_PropertyDialog.cpp b/src/XGUI/XGUI_PropertyDialog.cpp index 0e0dc0bd8..3aa0ea33a 100644 --- a/src/XGUI/XGUI_PropertyDialog.cpp +++ b/src/XGUI/XGUI_PropertyDialog.cpp @@ -14,31 +14,31 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_PropertyDialog.h" #include #include -#include #include +#include -XGUI_PropertyDialog::XGUI_PropertyDialog(QWidget* theParent) -: QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint), - myContentWidget(0) -{ +XGUI_PropertyDialog::XGUI_PropertyDialog(QWidget *theParent) + : QDialog(theParent, + Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint), + myContentWidget(0) { myLayout = new QGridLayout(this); - QDialogButtonBox* aButtons = new QDialogButtonBox( - QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + QDialogButtonBox *aButtons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(aButtons, SIGNAL(accepted()), this, SLOT(accept())); connect(aButtons, SIGNAL(rejected()), this, SLOT(reject())); myLayout->addWidget(aButtons, 1, 0); } -void XGUI_PropertyDialog::setContent(QWidget* theWidget) -{ +void XGUI_PropertyDialog::setContent(QWidget *theWidget) { myLayout->addWidget(theWidget, 0, 0); } diff --git a/src/XGUI/XGUI_PropertyDialog.h b/src/XGUI/XGUI_PropertyDialog.h index d5345009c..40cec6d2e 100644 --- a/src/XGUI/XGUI_PropertyDialog.h +++ b/src/XGUI/XGUI_PropertyDialog.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_PropertyDialog_H @@ -26,27 +27,27 @@ class QGridLayout; /** -* \ingroup GUI -* A dialog that contains property widget and accept/reject buttons. -*/ -class XGUI_PropertyDialog : public QDialog -{ + * \ingroup GUI + * A dialog that contains property widget and accept/reject buttons. + */ +class XGUI_PropertyDialog : public QDialog { Q_OBJECT public: /// Constructor /// \param theParent a parent widget for the dialog - XGUI_EXPORT XGUI_PropertyDialog(QWidget* theParent); + XGUI_EXPORT XGUI_PropertyDialog(QWidget *theParent); - XGUI_EXPORT virtual ~XGUI_PropertyDialog() {}; + XGUI_EXPORT virtual ~XGUI_PropertyDialog(){}; /// Set content of the dialog /// \param theWidget a content widget - void setContent(QWidget* theWidget); + void setContent(QWidget *theWidget); private: - QGridLayout* myLayout; /// grid layout where the first row is reserved for content widget, + QGridLayout *myLayout; /// grid layout where the first row is reserved for + /// content widget, /// the second row contains dialog buttons - QWidget* myContentWidget; /// content widget of the dialog + QWidget *myContentWidget; /// content widget of the dialog }; #endif diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index fca031397..3817b6a13 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -14,46 +14,47 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include #include -#include #include +#include #include #include -#include +#include #include #include //#include -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include +#include #include #include +#include #include #include #include +#include #include #include -#include #include -#include -#include #ifdef _DEBUG #include @@ -63,42 +64,38 @@ //#define DEBUG_ACTIVE_WIDGET -XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr) - : ModuleBase_IPropertyPanel(theParent), - myPanelPage(NULL), - myActiveWidget(NULL), - myPreselectionWidget(NULL), - myInternalActiveWidget(NULL), - myOperationMgr(theMgr) -{ +XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget *theParent, + XGUI_OperationMgr *theMgr) + : ModuleBase_IPropertyPanel(theParent), myPanelPage(NULL), + myActiveWidget(NULL), myPreselectionWidget(NULL), + myInternalActiveWidget(NULL), myOperationMgr(theMgr) { setWindowTitle(tr("Property Panel")); - //MAYBE_UNUSED QAction* aViewAct = toggleViewAction(); + // MAYBE_UNUSED QAction* aViewAct = toggleViewAction(); setObjectName(PROP_PANEL); - setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); + setStyleSheet("::title { position: relative; padding-left: 5px; text-align: " + "left center }"); - QWidget* aContent = new QWidget(this); - QGridLayout* aMainLayout = new QGridLayout(aContent); + QWidget *aContent = new QWidget(this); + QGridLayout *aMainLayout = new QGridLayout(aContent); const int kPanelColumn = 0; int aPanelRow = 0; aMainLayout->setContentsMargins(3, 3, 3, 3); setWidget(aContent); - QFrame* aFrm = new QFrame(aContent); + QFrame *aFrm = new QFrame(aContent); aFrm->setFrameStyle(QFrame::Raised); aFrm->setFrameShape(QFrame::Panel); - QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm); + QHBoxLayout *aBtnLay = new QHBoxLayout(aFrm); ModuleBase_Tools::zeroMargins(aBtnLay); aMainLayout->addWidget(aFrm, aPanelRow++, kPanelColumn); myHeaderWidget = aFrm; QStringList aBtnNames; - aBtnNames << QString(PROP_PANEL_HELP) - << QString(PROP_PANEL_OK) - << QString(PROP_PANEL_OK_PLUS) - << QString(PROP_PANEL_CANCEL); - foreach(QString eachBtnName, aBtnNames) { - QToolButton* aBtn = new QToolButton(aFrm); + aBtnNames << QString(PROP_PANEL_HELP) << QString(PROP_PANEL_OK) + << QString(PROP_PANEL_OK_PLUS) << QString(PROP_PANEL_CANCEL); + foreach (QString eachBtnName, aBtnNames) { + QToolButton *aBtn = new QToolButton(aFrm); aBtn->setObjectName(eachBtnName); aBtn->setAutoRaise(true); aBtnLay->addWidget(aBtn); @@ -106,7 +103,8 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* th aBtnLay->insertStretch(1, 1); myPanelPage = new ModuleBase_PageWidget(aContent); - myPanelPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); + myPanelPage->setSizePolicy(QSizePolicy::Preferred, + QSizePolicy::MinimumExpanding); aMainLayout->addWidget(myPanelPage, aPanelRow, kPanelColumn); // spit to make the preview button on the bottom of the panel @@ -119,34 +117,33 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* th ModuleBase_Tools::zeroMargins(aBtnLay); aMainLayout->addWidget(aFrm, aPanelRow++, kPanelColumn); - QToolButton* aBtn = new QToolButton(aFrm); + QToolButton *aBtn = new QToolButton(aFrm); aBtn->setObjectName(PROP_PANEL_PREVIEW); aBtnLay->addWidget(aBtn); } -XGUI_PropertyPanel::~XGUI_PropertyPanel() -{ -} +XGUI_PropertyPanel::~XGUI_PropertyPanel() {} -void XGUI_PropertyPanel::cleanContent() -{ +void XGUI_PropertyPanel::cleanContent() { if (myActiveWidget) myActiveWidget->deactivate(); - XGUI_ActiveControlSelector* aPPSelector = XGUI_Tools::workshop(myOperationMgr->workshop())-> - activeControlMgr()->getSelector(XGUI_PropertyPanelSelector::Type()); + XGUI_ActiveControlSelector *aPPSelector = + XGUI_Tools::workshop(myOperationMgr->workshop()) + ->activeControlMgr() + ->getSelector(XGUI_PropertyPanelSelector::Type()); aPPSelector->reset(); // it removes need to be updated widget link /// as the widgets are deleted later, it is important that the signals /// of these widgets are not processed. An example of the error is issue 986. /// In the given case, the property panel is firstly filled by new widgets /// of restarted operation and after that the mouse release signal come from - /// the widget of the previous operation (Point2d widget about mouse is released - /// and focus is out of this widget) - QList::const_iterator anIt = myWidgets.begin(), - aLast = myWidgets.end(); + /// the widget of the previous operation (Point2d widget about mouse is + /// released and focus is out of this widget) + QList::const_iterator anIt = myWidgets.begin(), + aLast = myWidgets.end(); for (; anIt != aLast; anIt++) { - QWidget* aWidget = *anIt; + QWidget *aWidget = *anIt; if (aWidget) { aWidget->blockSignals(true); } @@ -158,8 +155,8 @@ void XGUI_PropertyPanel::cleanContent() emit propertyPanelDeactivated(); // VSV: It seems that this code is not necessary: // it is called on propertyPanelDeactivated() event - //myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); - //myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); + // myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); + // myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); #ifdef DEBUG_ACTIVE_WIDGET std::cout << "myActiveWidget = NULL" << std::endl; #endif @@ -168,42 +165,39 @@ void XGUI_PropertyPanel::cleanContent() setWindowTitle(tr("Property Panel")); } -void XGUI_PropertyPanel::setModelWidgets(const QList& theWidgets) -{ +void XGUI_PropertyPanel::setModelWidgets( + const QList &theWidgets) { myWidgets = theWidgets; if (theWidgets.empty()) return; - foreach (ModuleBase_ModelWidget* aWidget, theWidgets) { - connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)), - this, SLOT(onFocusInWidget(ModuleBase_ModelWidget*))); - connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), - this, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*))); - connect(aWidget, SIGNAL(keyReleased(QObject*, QKeyEvent*)), - this, SIGNAL(keyReleased(QObject*, QKeyEvent*))); - connect(aWidget, SIGNAL(enterClicked(QObject*)), - this, SIGNAL(enterClicked(QObject*))); + foreach (ModuleBase_ModelWidget *aWidget, theWidgets) { + connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget *)), this, + SLOT(onFocusInWidget(ModuleBase_ModelWidget *))); + connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget *)), this, + SLOT(onActivateNextWidget(ModuleBase_ModelWidget *))); + connect(aWidget, SIGNAL(keyReleased(QObject *, QKeyEvent *)), this, + SIGNAL(keyReleased(QObject *, QKeyEvent *))); + connect(aWidget, SIGNAL(enterClicked(QObject *)), this, + SIGNAL(enterClicked(QObject *))); } } - -const QList& XGUI_PropertyPanel::modelWidgets() const -{ +const QList & +XGUI_PropertyPanel::modelWidgets() const { return myWidgets; } -ModuleBase_PageBase* XGUI_PropertyPanel::contentWidget() -{ - return static_cast(myPanelPage); +ModuleBase_PageBase *XGUI_PropertyPanel::contentWidget() { + return static_cast(myPanelPage); } -void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) -{ +void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) { // Invalid feature case on abort of the operation if (theFeature.get() == NULL) return; if (theFeature->isAction() || !theFeature->data()) return; - foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) { + foreach (ModuleBase_ModelWidget *eachWidget, myWidgets) { if (!eachWidget->feature().get()) eachWidget->setFeature(theFeature); eachWidget->restoreValue(); @@ -212,64 +206,63 @@ void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) update(); } -void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature) -{ +void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature) { // Invalid feature case on abort of the operation if (theFeature.get() == NULL) return; if (theFeature->isAction() || !theFeature->data()) return; - ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); + ModuleBase_Operation *anOperation = myOperationMgr->currentOperation(); if (myWidgets.empty()) { QString aXmlRepr = anOperation->getDescription()->xmlRepresentation(); - ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myOperationMgr->workshop()); - ModuleBase_PageBase* aPage = contentWidget(); + ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), + myOperationMgr->workshop()); + ModuleBase_PageBase *aPage = contentWidget(); aFactory.createPanel(aPage, theFeature); // update model widgets if exist setModelWidgets(aPage->modelWidgets()); // Apply button should be update if the feature was modified by the panel myOperationMgr->onValidateOperation(); } - ModuleBase_OperationFeature* aFeatureOp = - dynamic_cast(anOperation); + ModuleBase_OperationFeature *aFeatureOp = + dynamic_cast(anOperation); if (aFeatureOp && (!aFeatureOp->isEditOperation())) updateApplyPlusButton(theFeature); else findButton(PROP_PANEL_OK_PLUS)->setVisible(false); } -void XGUI_PropertyPanel::updateApplyPlusButton(FeaturePtr theFeature) -{ +void XGUI_PropertyPanel::updateApplyPlusButton(FeaturePtr theFeature) { if (theFeature.get()) { std::shared_ptr aFeatureInfo = - myOperationMgr->workshop()->featureInfo(theFeature->getKind().c_str()); + myOperationMgr->workshop()->featureInfo(theFeature->getKind().c_str()); if (aFeatureInfo.get()) { - findButton(PROP_PANEL_OK_PLUS)->setVisible(aFeatureInfo->isApplyContinue()); + findButton(PROP_PANEL_OK_PLUS) + ->setVisible(aFeatureInfo->isApplyContinue()); return; } } findButton(PROP_PANEL_OK_PLUS)->setVisible(false); } -ModuleBase_ModelWidget* XGUI_PropertyPanel::activeWidget(const bool isUseCustomWidget) const -{ +ModuleBase_ModelWidget * +XGUI_PropertyPanel::activeWidget(const bool isUseCustomWidget) const { if (isUseCustomWidget && myInternalActiveWidget) return myInternalActiveWidget; return myActiveWidget; } -void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) -{ +void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget *theWidget) { // it is possible that the property panel widgets have not been visualized - // (e.g. on start operation), so it is strictly important to do not check visualized state + // (e.g. on start operation), so it is strictly important to do not check + // visualized state activateNextWidget(theWidget, false); } -void XGUI_PropertyPanel::onFocusInWidget(ModuleBase_ModelWidget* theWidget) -{ +void XGUI_PropertyPanel::onFocusInWidget(ModuleBase_ModelWidget *theWidget) { #ifdef DEBUG_ACTIVE_WIDGET std::cout << "onFocusInWidget" << std::endl; #endif @@ -277,40 +270,42 @@ void XGUI_PropertyPanel::onFocusInWidget(ModuleBase_ModelWidget* theWidget) activateWidget(theWidget); } -void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget) -{ - // this slot happens when some widget lost focus, the next widget which accepts the focus - // should be shown, so the second parameter is true - // it is important for features where in cases the same attributes are used, isCase for this - // attribute returns true, however it can be placed in hidden stack widget(extrusion: elements, - // sketch multi rotation -> single/full point) - // it is important to check the widget visibility to do not check of the next widget visible - // state if the current is not shown. (example: sketch circle re-entrant operation after mouse - // release in the viewer, next, radius, +void XGUI_PropertyPanel::onActivateNextWidget( + ModuleBase_ModelWidget *theWidget) { + // this slot happens when some widget lost focus, the next widget which + // accepts the focus should be shown, so the second parameter is true it is + // important for features where in cases the same attributes are used, isCase + // for this attribute returns true, however it can be placed in hidden stack + // widget(extrusion: elements, sketch multi rotation -> single/full point) it + // is important to check the widget visibility to do not check of the next + // widget visible state if the current is not shown. (example: sketch circle + // re-entrant operation after mouse release in the viewer, next, radius, // widget should be activated but the first is not visualized) bool isVisible = theWidget->isVisible(); activateNextWidget(theWidget, isVisible); } - -void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget, - const bool isCheckVisibility) -{ +void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget *theWidget, + const bool isCheckVisibility) { // TO CHECK: Editing operation does not have automatical activation of widgets if (isEditingMode()) { activateWidget(NULL); return; } - ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + ModelAPI_ValidatorsFactory *aValidators = + ModelAPI_Session::get()->validators(); - QList::const_iterator anIt = myWidgets.begin(), aLast = myWidgets.end(); + QList::const_iterator anIt = myWidgets.begin(), + aLast = myWidgets.end(); bool isFoundWidget = false; - ModuleBase_Tools::activateWindow(this, "XGUI_PropertyPanel::activateNextWidget()"); + ModuleBase_Tools::activateWindow(this, + "XGUI_PropertyPanel::activateNextWidget()"); for (; anIt != aLast; anIt++) { - ModuleBase_ModelWidget* aCurrentWidget = *anIt; + ModuleBase_ModelWidget *aCurrentWidget = *anIt; if (isFoundWidget || !theWidget) { - if (!aValidators->isCase(aCurrentWidget->feature(), aCurrentWidget->attributeID())) + if (!aValidators->isCase(aCurrentWidget->feature(), + aCurrentWidget->attributeID())) continue; // this attribute does not participate in the current case if (isCheckVisibility && !aCurrentWidget->isInternal()) { if (!aCurrentWidget->isVisible()) @@ -320,7 +315,8 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget, continue; // not obligatory widgets are not activated automatically if (!aCurrentWidget->canAcceptFocus()) - continue; // do not set focus if it can not be accepted, case: optional choice + continue; // do not set focus if it can not be accepted, case: optional + // choice if (aCurrentWidget->focusTo()) { aCurrentWidget->emitFocusInWidget(); @@ -329,58 +325,59 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget, } isFoundWidget = isFoundWidget || (*anIt) == theWidget; } - // set focus to Ok/Cancel button in Property panel if there are no more active widgets - // it should be performed before activateWidget(NULL) because it emits some signals which - // can be processed by moudule for example as to activate another widget with setting focus - QWidget* aNewFocusWidget = 0; - QToolButton* anOkBtn = findButton(PROP_PANEL_OK); + // set focus to Ok/Cancel button in Property panel if there are no more active + // widgets it should be performed before activateWidget(NULL) because it emits + // some signals which can be processed by moudule for example as to activate + // another widget with setting focus + QWidget *aNewFocusWidget = 0; + QToolButton *anOkBtn = findButton(PROP_PANEL_OK); if (anOkBtn->isEnabled()) aNewFocusWidget = anOkBtn; else { - QToolButton* aCancelBtn = findButton(PROP_PANEL_CANCEL); + QToolButton *aCancelBtn = findButton(PROP_PANEL_CANCEL); if (aCancelBtn->isEnabled()) aNewFocusWidget = aCancelBtn; } if (aNewFocusWidget) - ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::activateNextWidget"); + ModuleBase_Tools::setFocus(aNewFocusWidget, + "XGUI_PropertyPanel::activateNextWidget"); activateWidget(NULL); } -void findDirectChildren(QWidget* theParent, QList& theWidgets, const bool theDebug) -{ - QList aWidgets; +void findDirectChildren(QWidget *theParent, QList &theWidgets, + const bool theDebug) { + QList aWidgets; if (theParent) { - QLayout* aLayout = theParent->layout(); + QLayout *aLayout = theParent->layout(); if (aLayout) { for (int i = 0, aCount = aLayout->count(); i < aCount; i++) { - QLayoutItem* anItem = aLayout->itemAt(i); - QWidget* aWidget = anItem ? anItem->widget() : 0; + QLayoutItem *anItem = aLayout->itemAt(i); + QWidget *aWidget = anItem ? anItem->widget() : 0; if (aWidget) { if (aWidget->isVisible()) { if (aWidget->focusPolicy() != Qt::NoFocus) theWidgets.append(aWidget); findDirectChildren(aWidget, theWidgets, false); } - } - else if (anItem->layout()) { - QLayout* anItemLayout = anItem->layout(); + } else if (anItem->layout()) { + QLayout *anItemLayout = anItem->layout(); for (int it = 0, cnt = anItemLayout->count(); it < cnt; it++) { - QLayoutItem* aCurItem = anItemLayout->itemAt(it); - QWidget* aCurWidget = aCurItem ? aCurItem->widget() : 0; + QLayoutItem *aCurItem = anItemLayout->itemAt(it); + QWidget *aCurWidget = aCurItem ? aCurItem->widget() : 0; if (aCurWidget) { if (aCurWidget->isVisible()) { if (aCurWidget->focusPolicy() != Qt::NoFocus) theWidgets.append(aCurWidget); findDirectChildren(aCurWidget, theWidgets, false); } - } - else { - // TODO: improve recursive search for the case when here QLayout is used - // currently, the switch widget uses only 1 level of qlayout in qlayout using for - // example for construction plane feature. If there are more levels, - // it should be implemented here + } else { + // TODO: improve recursive search for the case when here QLayout + // is used currently, the switch widget uses only 1 level of + // qlayout in qlayout using for example for construction plane + // feature. If there are more levels, it should be implemented + // here } } } @@ -390,77 +387,75 @@ void findDirectChildren(QWidget* theParent, QList& theWidgets, const b #ifdef DEBUG_TAB_WIDGETS if (theDebug) { QStringList aWidgetTypes; - QList::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end(); + QList::const_iterator anIt = theWidgets.begin(), + aLast = theWidgets.end(); for (; anIt != aLast; anIt++) { - QWidget* aWidget = *anIt; + QWidget *aWidget = *anIt; if (aWidget) aWidgetTypes.append(aWidget->objectName()); } QString anInfo = QString("theWidgets[%1]: %2") - .arg(theWidgets.count()).arg(aWidgetTypes.join(",")); + .arg(theWidgets.count()) + .arg(aWidgetTypes.join(",")); qDebug(anInfo.toStdString().c_str()); } #endif } -bool XGUI_PropertyPanel::setFocusNextPrevChild(bool theIsNext) -{ +bool XGUI_PropertyPanel::setFocusNextPrevChild(bool theIsNext) { return focusNextPrevChild(theIsNext); } -bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) -{ +bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) { // it wraps the Tabs clicking to follow in the chain: // controls, last control, Apply, Cancel, first control, controls bool isChangedFocus = false; - QWidget* aFocusWidget = focusWidget(); + QWidget *aFocusWidget = focusWidget(); #ifdef DEBUG_TAB_WIDGETS if (aFocusWidget) { - QString anInfo = QString("focus Widget: %1").arg(aFocusWidget->objectName()); + QString anInfo = + QString("focus Widget: %1").arg(aFocusWidget->objectName()); qDebug(anInfo.toStdString().c_str()); } #endif - ModuleBase_ModelWidget* aFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this, - aFocusWidget); - //if (aFocusMWidget) - // aFocusMWidget->setHighlighted(false); + ModuleBase_ModelWidget *aFocusMWidget = + ModuleBase_ModelWidget::findModelWidget(this, aFocusWidget); + // if (aFocusMWidget) + // aFocusMWidget->setHighlighted(false); - QWidget* aNewFocusWidget = 0; + QWidget *aNewFocusWidget = 0; if (aFocusWidget) { - QList aChildren; + QList aChildren; findDirectChildren(this, aChildren, true); int aChildrenCount = aChildren.count(); int aFocusWidgetIndex = aChildren.indexOf(aFocusWidget); - QToolButton* anOkBtn = findButton(PROP_PANEL_OK); + QToolButton *anOkBtn = findButton(PROP_PANEL_OK); if (aFocusWidgetIndex >= 0) { if (theIsNext) { - if (aFocusWidgetIndex == aChildrenCount-1) { + if (aFocusWidgetIndex == aChildrenCount - 1) { // after the last widget focus should be set to "Apply" if (anOkBtn->isEnabled()) aNewFocusWidget = anOkBtn; else { - QToolButton* aCancelBtn = findButton(PROP_PANEL_CANCEL); + QToolButton *aCancelBtn = findButton(PROP_PANEL_CANCEL); if (aCancelBtn->isEnabled()) aNewFocusWidget = aCancelBtn; } + } else { + aNewFocusWidget = aChildren[aFocusWidgetIndex + 1]; } - else { - aNewFocusWidget = aChildren[aFocusWidgetIndex+1]; - } - } - else { + } else { if (aFocusWidgetIndex == 0) { // before the first widget, the last should accept focus aNewFocusWidget = aChildren[aChildrenCount - 1]; - } - else { - // before the "Apply" button, the last should accept focus for consistency with "Next" + } else { + // before the "Apply" button, the last should accept focus for + // consistency with "Next" if (aFocusWidget == anOkBtn) { aNewFocusWidget = aChildren[aChildrenCount - 1]; - } - else { - aNewFocusWidget = aChildren[aFocusWidgetIndex-1]; + } else { + aNewFocusWidget = aChildren[aFocusWidgetIndex - 1]; } } } @@ -469,17 +464,20 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) if (aNewFocusWidget) { if (myActiveWidget) { bool isFirstControl = !theIsNext; - QWidget* aLastFocusControl = myActiveWidget->getControlAcceptingFocus(isFirstControl); + QWidget *aLastFocusControl = + myActiveWidget->getControlAcceptingFocus(isFirstControl); if (aFocusWidget == aLastFocusControl) { setActiveWidget(NULL, false); } } - // we want to have property panel as an active window to enter values in double control - ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::focusNextPrevChild()"); + // we want to have property panel as an active window to enter values in + // double control + ModuleBase_Tools::setFocus(aNewFocusWidget, + "XGUI_PropertyPanel::focusNextPrevChild()"); - ModuleBase_ModelWidget* aNewFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this, - aNewFocusWidget); + ModuleBase_ModelWidget *aNewFocusMWidget = + ModuleBase_ModelWidget::findModelWidget(this, aNewFocusWidget); if (aNewFocusMWidget) { if (aFocusMWidget && (aFocusMWidget != aNewFocusMWidget)) { aFocusMWidget->setHighlighted(false); @@ -491,37 +489,38 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) return isChangedFocus; } -void XGUI_PropertyPanel::activateNextWidget() -{ +void XGUI_PropertyPanel::activateNextWidget() { activateNextWidget(myActiveWidget); } -void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget* theWidget, const bool theEmitSignal) -{ +void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget *theWidget, + const bool theEmitSignal) { std::string aPreviosAttributeID; - if(myActiveWidget) + if (myActiveWidget) aPreviosAttributeID = myActiveWidget->attributeID(); - // Avoid activation of already actve widget. It could happen on focusIn event many times + // Avoid activation of already actve widget. It could happen on focusIn event + // many times setActiveWidget(theWidget, theEmitSignal); } -bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal) -{ - // Avoid activation of already actve widget. It could happen on focusIn event many times +bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget *theWidget, + const bool isEmitSignal) { + // Avoid activation of already actve widget. It could happen on focusIn event + // many times if (theWidget == myActiveWidget) { return false; } std::string aPreviosAttributeID; - ModuleBase_ModelWidget* aDeactivatedWidget = NULL, *anActivatedWidget = NULL; - if(myActiveWidget) { + ModuleBase_ModelWidget *aDeactivatedWidget = NULL, *anActivatedWidget = NULL; + if (myActiveWidget) { aPreviosAttributeID = myActiveWidget->attributeID(); myActiveWidget->processValueState(); myActiveWidget->deactivate(); myActiveWidget->setHighlighted(false); aDeactivatedWidget = myActiveWidget; } - if(theWidget) { + if (theWidget) { emit beforeWidgetActivated(theWidget); theWidget->setHighlighted(true); theWidget->activate(); @@ -530,11 +529,12 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, cons myActiveWidget = theWidget; #ifdef DEBUG_ACTIVE_WIDGET - std::cout << "myActiveWidget = " << (theWidget ? theWidget->context().c_str() : "") << std::endl; + std::cout << "myActiveWidget = " + << (theWidget ? theWidget->context().c_str() : "") << std::endl; #endif bool aHasMoreWidgets = true; if (isEmitSignal) { - //emit widgetActivated(myActiveWidget); + // emit widgetActivated(myActiveWidget); if (!myActiveWidget && !isEditingMode()) { aHasMoreWidgets = false; emit noMoreWidgets(aPreviosAttributeID); @@ -546,7 +546,7 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, cons // because it makes problem for continuing of projection operation // because of redefinition of module selection filters while projection // operation is not finished. - //else + // else // emit propertyPanelDeactivated(); myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); @@ -556,74 +556,67 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, cons if (aHasMoreWidgets && anActivatedWidget) anActivatedWidget->updateAfterActivation(); - if (aHasMoreWidgets && myActiveWidget) - { - // restore widget selection should be done after selection modes of widget activating - static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); + if (aHasMoreWidgets && myActiveWidget) { + // restore widget selection should be done after selection modes of widget + // activating + static Events_ID anEvent = + Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); Events_Loop::loop()->flush(anEvent); } return true; } -void XGUI_PropertyPanel::setFocusOnOkButton() -{ - QToolButton* anOkBtn = findButton(PROP_PANEL_OK); - ModuleBase_Tools::setFocus(anOkBtn, "XGUI_PropertyPanel::setFocusOnOkButton()"); +void XGUI_PropertyPanel::setFocusOnOkButton() { + QToolButton *anOkBtn = findButton(PROP_PANEL_OK); + ModuleBase_Tools::setFocus(anOkBtn, + "XGUI_PropertyPanel::setFocusOnOkButton()"); } -void XGUI_PropertyPanel::setCancelEnabled(bool theEnabled) -{ - QToolButton* anCancelBtn = findButton(PROP_PANEL_CANCEL); +void XGUI_PropertyPanel::setCancelEnabled(bool theEnabled) { + QToolButton *anCancelBtn = findButton(PROP_PANEL_CANCEL); anCancelBtn->setEnabled(theEnabled); } -bool XGUI_PropertyPanel::isCancelEnabled() const -{ - QToolButton* anCancelBtn = findButton(PROP_PANEL_CANCEL); +bool XGUI_PropertyPanel::isCancelEnabled() const { + QToolButton *anCancelBtn = findButton(PROP_PANEL_CANCEL); return anCancelBtn->isEnabled(); } -void XGUI_PropertyPanel::setEditingMode(bool isEditing) -{ +void XGUI_PropertyPanel::setEditingMode(bool isEditing) { ModuleBase_IPropertyPanel::setEditingMode(isEditing); - foreach(ModuleBase_ModelWidget* aWgt, myWidgets) { + foreach (ModuleBase_ModelWidget *aWgt, myWidgets) { aWgt->setEditingMode(isEditing); } } -void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr* theMgr) -{ +void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr *theMgr) { QStringList aButtonNames; - aButtonNames << PROP_PANEL_OK<< PROP_PANEL_OK_PLUS << PROP_PANEL_CANCEL + aButtonNames << PROP_PANEL_OK << PROP_PANEL_OK_PLUS << PROP_PANEL_CANCEL << PROP_PANEL_HELP << PROP_PANEL_PREVIEW; QList aActionIds; - aActionIds << XGUI_ActionsMgr::Accept << XGUI_ActionsMgr::AcceptPlus << XGUI_ActionsMgr::Abort - << XGUI_ActionsMgr::Help << XGUI_ActionsMgr::Preview; + aActionIds << XGUI_ActionsMgr::Accept << XGUI_ActionsMgr::AcceptPlus + << XGUI_ActionsMgr::Abort << XGUI_ActionsMgr::Help + << XGUI_ActionsMgr::Preview; for (int i = 0; i < aButtonNames.size(); ++i) { - QToolButton* aBtn = findButton(aButtonNames.at(i).toStdString().c_str()); - QAction* anAct = theMgr->operationStateAction(aActionIds.at(i)); + QToolButton *aBtn = findButton(aButtonNames.at(i).toStdString().c_str()); + QAction *anAct = theMgr->operationStateAction(aActionIds.at(i)); aBtn->setDefaultAction(anAct); } } -void XGUI_PropertyPanel::onAcceptData() -{ - foreach (ModuleBase_ModelWidget* aWidget, myWidgets) { +void XGUI_PropertyPanel::onAcceptData() { + foreach (ModuleBase_ModelWidget *aWidget, myWidgets) { aWidget->onFeatureAccepted(); } } -void XGUI_PropertyPanel::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget) -{ - if (theWidget) - { +void XGUI_PropertyPanel::setInternalActiveWidget( + ModuleBase_ModelWidget *theWidget) { + if (theWidget) { myInternalActiveWidget = theWidget; emit propertyPanelActivated(); - } - else - { - if (myInternalActiveWidget) - { + } else { + if (myInternalActiveWidget) { delete myInternalActiveWidget; myInternalActiveWidget = 0; } @@ -633,20 +626,17 @@ void XGUI_PropertyPanel::setInternalActiveWidget(ModuleBase_ModelWidget* theWidg myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); } -ModuleBase_ModelWidget* XGUI_PropertyPanel::preselectionWidget() const -{ +ModuleBase_ModelWidget *XGUI_PropertyPanel::preselectionWidget() const { return myPreselectionWidget; } -void XGUI_PropertyPanel::setPreselectionWidget(ModuleBase_ModelWidget* theWidget) -{ +void XGUI_PropertyPanel::setPreselectionWidget( + ModuleBase_ModelWidget *theWidget) { myPreselectionWidget = theWidget; } - -void XGUI_PropertyPanel::closeEvent(QCloseEvent* theEvent) -{ - ModuleBase_Operation* aOp = myOperationMgr->currentOperation(); +void XGUI_PropertyPanel::closeEvent(QCloseEvent *theEvent) { + ModuleBase_Operation *aOp = myOperationMgr->currentOperation(); if (aOp) { if (myOperationMgr->canStopOperation(aOp)) { myOperationMgr->abortOperation(aOp); @@ -660,7 +650,6 @@ void XGUI_PropertyPanel::closeEvent(QCloseEvent* theEvent) ModuleBase_IPropertyPanel::closeEvent(theEvent); } -QToolButton* XGUI_PropertyPanel::findButton(const char* theInternalName) const -{ - return findChild(theInternalName); +QToolButton *XGUI_PropertyPanel::findButton(const char *theInternalName) const { + return findChild(theInternalName); } diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 86d3743ce..c959ebdc8 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_PROPERTYPANEL_H_ @@ -22,8 +23,8 @@ #include "XGUI.h" -#include #include +#include #include @@ -36,65 +37,65 @@ class ModuleBase_PageWidget; class XGUI_OperationMgr; /// Internal name of property panel widget -MAYBE_UNUSED const static char* PROP_PANEL = "property_panel_dock"; +MAYBE_UNUSED const static char *PROP_PANEL = "property_panel_dock"; /// Internal name of Ok button -MAYBE_UNUSED const static char* PROP_PANEL_OK = "property_panel_ok"; +MAYBE_UNUSED const static char *PROP_PANEL_OK = "property_panel_ok"; /// Internal name of Ok button -MAYBE_UNUSED const static char* PROP_PANEL_OK_PLUS = "property_panel_ok_plus"; +MAYBE_UNUSED const static char *PROP_PANEL_OK_PLUS = "property_panel_ok_plus"; /// Internal name of Cancel button -MAYBE_UNUSED const static char* PROP_PANEL_CANCEL = "property_panel_cancel"; +MAYBE_UNUSED const static char *PROP_PANEL_CANCEL = "property_panel_cancel"; /// Internal name of Help button -MAYBE_UNUSED const static char* PROP_PANEL_HELP = "property_panel_help"; +MAYBE_UNUSED const static char *PROP_PANEL_HELP = "property_panel_help"; /// Internal name of Preview button -MAYBE_UNUSED const static char* PROP_PANEL_PREVIEW = "property_panel_preview"; +MAYBE_UNUSED const static char *PROP_PANEL_PREVIEW = "property_panel_preview"; /** -* \ingroup GUI -* Realization of Property panel object. -*/ -class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel -{ -Q_OBJECT - public: - + * \ingroup GUI + * Realization of Property panel object. + */ +class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel { + Q_OBJECT +public: /// Constructor /// \param theParent is a parent of the property panel /// \param theMgr operation manager - XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr); + XGUI_PropertyPanel(QWidget *theParent, XGUI_OperationMgr *theMgr); virtual ~XGUI_PropertyPanel(); /// Returns header widget - virtual QWidget* headerWidget() const { return myHeaderWidget; } + virtual QWidget *headerWidget() const { return myHeaderWidget; } /// Returns main widget of the property panel, which children will be created /// by WidgetFactory using the XML definition - ModuleBase_PageBase* contentWidget(); + ModuleBase_PageBase *contentWidget(); /// Brings back all widget created by widget factory for signal/slot /// connections and further processing - void setModelWidgets(const QList& theWidgets); + void setModelWidgets(const QList &theWidgets); /// Returns all property panel's widget created by WidgetFactory - virtual const QList& modelWidgets() const; + virtual const QList &modelWidgets() const; /// Removes all widgets in the widget area of the property panel virtual void cleanContent(); - /// Returns currently active widget. This is a widget from internal container of widgets - /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true, - /// the method finds firstly the custom widget, after the direct active widget. - /// \param isUseCustomWidget boolean state if the custom widget might be a result - virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const; + /// Returns currently active widget. This is a widget from internal container + /// of widgets (myWidgets) activated/deactivated by focus in property panel. + /// If parameter is true, the method finds firstly the custom widget, after + /// the direct active widget. \param isUseCustomWidget boolean state if the + /// custom widget might be a result + virtual ModuleBase_ModelWidget * + activeWidget(const bool isUseCustomWidget = false) const; /// Activate the next widget in the property panel /// \param theWidget a widget. The next widget should be activated - virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget); + virtual void activateNextWidget(ModuleBase_ModelWidget *theWidget); /// Activate the next from current widget in the property panel virtual void activateNextWidget(); @@ -109,74 +110,77 @@ Q_OBJECT /// \return Enable/Disable state of Cancel button virtual bool isCancelEnabled() const; - /// Editing mode depends on mode of current operation. This value is defined by it. - /// \param isEditing state of editing mode flag + /// Editing mode depends on mode of current operation. This value is defined + /// by it. \param isEditing state of editing mode flag virtual void setEditingMode(bool isEditing); - //! Allows to set predefined actions for the property panel fetched from the ActionsMgr - void setupActions(XGUI_ActionsMgr* theMgr); + //! Allows to set predefined actions for the property panel fetched from the + //! ActionsMgr + void setupActions(XGUI_ActionsMgr *theMgr); /// Returns widget processed by preselection - virtual ModuleBase_ModelWidget* preselectionWidget() const; + virtual ModuleBase_ModelWidget *preselectionWidget() const; /// Sets widget processed by preselection - virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget); + virtual void setPreselectionWidget(ModuleBase_ModelWidget *theWidget); /// Returns operation manager - XGUI_OperationMgr* operationMgr() const { return myOperationMgr; } + XGUI_OperationMgr *operationMgr() const { return myOperationMgr; } /// Find under the panel a child button with the parameter name /// \param theInternalName a button object name /// \return button instance or NULL - QToolButton* findButton(const char* theInternalName) const; + QToolButton *findButton(const char *theInternalName) const; - /// Possibility to process focus by method, for example when Tab or SHIF+Tab is pressed - /// but property panel is not active widget - /// \param theIsNext true, if Tab(to the next widget) or false(moving to the previous) + /// Possibility to process focus by method, for example when Tab or SHIF+Tab + /// is pressed but property panel is not active widget \param theIsNext true, + /// if Tab(to the next widget) or false(moving to the previous) bool setFocusNextPrevChild(bool theIsNext); /// The method is called on accepting of operation virtual void onAcceptData(); - /// Set internal active widget, that can be returned as active widget and participate in active - /// selection filters/modes in application. It emits signal about property panel activation or - /// deactivation and updates selection filters/modes accordingly. - /// \param theWidget a widget control to store as internal active widget - void setInternalActiveWidget(ModuleBase_ModelWidget* theWidget); + /// Set internal active widget, that can be returned as active widget and + /// participate in active selection filters/modes in application. It emits + /// signal about property panel activation or deactivation and updates + /// selection filters/modes accordingly. \param theWidget a widget control to + /// store as internal active widget + void setInternalActiveWidget(ModuleBase_ModelWidget *theWidget); void updateApplyPlusButton(FeaturePtr theFeature); public slots: - /// \brief Update all widgets in property panel with values from the given feature - /// \param theFeature a Feature to update values in widgets + /// \brief Update all widgets in property panel with values from the given + /// feature \param theFeature a Feature to update values in widgets void updateContentWidget(FeaturePtr theFeature); - /// \brief If the XML definition of the feature contains information about specific - /// content of the property panel, it creates the panel and allow filling it by the given feature - /// \param theFeature a Feature to fill property panel + /// \brief If the XML definition of the feature contains information about + /// specific content of the property panel, it creates the panel and allow + /// filling it by the given feature \param theFeature a Feature to fill + /// property panel void createContentPanel(FeaturePtr theFeature); /** - * Makes the given widget active, highlights it and removes - * highlighting from the previous active widget - * \param theWidget which has to be activated - * \param theEmitSignal a flag to prohibit signal emit - */ - virtual void activateWidget(ModuleBase_ModelWidget* theWidget, const bool theEmitSignal = true); - - /// Activates the parameter widget if it can accept focus - /// \param theWidget a widget where focus in event happened - void onFocusInWidget(ModuleBase_ModelWidget* theWidget); - + * Makes the given widget active, highlights it and removes + * highlighting from the previous active widget + * \param theWidget which has to be activated + * \param theEmitSignal a flag to prohibit signal emit + */ + virtual void activateWidget(ModuleBase_ModelWidget *theWidget, + const bool theEmitSignal = true); + + /// Activates the parameter widget if it can accept focus + /// \param theWidget a widget where focus in event happened + void onFocusInWidget(ModuleBase_ModelWidget *theWidget); /// Activate next widget /// \param theWidget the current widget - void onActivateNextWidget(ModuleBase_ModelWidget* theWidget); + void onActivateNextWidget(ModuleBase_ModelWidget *theWidget); signals: /// The signal is emitted if the enter is clicked in the control of the widget /// \param theObject a sender of the event - void enterClicked(QObject* theObject); + void enterClicked(QObject *theObject); /// Emits on deactivating property panel (e.g. by clearContent) void propertyPanelDeactivated(); @@ -184,39 +188,42 @@ signals: void propertyPanelActivated(); protected: - /// Makes the widget active, deactivate the previous, activate and hightlight the given one - /// \param theWidget a widget - /// \param isEmitSignal flag whether panel signals should be emitted - bool setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal); + /// Makes the widget active, deactivate the previous, activate and hightlight + /// the given one \param theWidget a widget \param isEmitSignal flag whether + /// panel signals should be emitted + bool setActiveWidget(ModuleBase_ModelWidget *theWidget, + const bool isEmitSignal); /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events /// Emits a signal about focus change - /// If theIsNext is true, this function searches forward, if next is false, it searches backward. + /// If theIsNext is true, this function searches forward, if next is false, it + /// searches backward. virtual bool focusNextPrevChild(bool theIsNext); /// Activate the next widget in the property panel /// \param theWidget a widget. The next widget should be activated - /// \param isCheckVisibility flag whether the next widget visibility is checked - void activateNextWidget(ModuleBase_ModelWidget* theWidget, + /// \param isCheckVisibility flag whether the next widget visibility is + /// checked + void activateNextWidget(ModuleBase_ModelWidget *theWidget, const bool isCheckVisibility); - protected: - /// A method called on the property panel closed - /// \param theEvent a close event - void closeEvent(QCloseEvent* theEvent); +protected: + /// A method called on the property panel closed + /// \param theEvent a close event + void closeEvent(QCloseEvent *theEvent); private: - QWidget* myHeaderWidget; ///< A header widget + QWidget *myHeaderWidget; ///< A header widget - ModuleBase_PageWidget* myPanelPage; - QList myWidgets; + ModuleBase_PageWidget *myPanelPage; + QList myWidgets; /// Currently active widget - ModuleBase_ModelWidget* myActiveWidget; + ModuleBase_ModelWidget *myActiveWidget; /// Currently widget processed by preselection - ModuleBase_ModelWidget* myPreselectionWidget; + ModuleBase_ModelWidget *myPreselectionWidget; /// Some custom widget set from outside - ModuleBase_ModelWidget* myInternalActiveWidget; + ModuleBase_ModelWidget *myInternalActiveWidget; - XGUI_OperationMgr* myOperationMgr; + XGUI_OperationMgr *myOperationMgr; }; #endif /* XGUI_PROPERTYPANEL_H_ */ diff --git a/src/XGUI/XGUI_PropertyPanelSelector.cpp b/src/XGUI/XGUI_PropertyPanelSelector.cpp index 9d19cf4ba..a35cb094c 100644 --- a/src/XGUI/XGUI_PropertyPanelSelector.cpp +++ b/src/XGUI/XGUI_PropertyPanelSelector.cpp @@ -14,29 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // -#include #include +#include //******************************************************************** -XGUI_PropertyPanelSelector::XGUI_PropertyPanelSelector(XGUI_PropertyPanel* thePanel) -: myPanel(thePanel), myWidgetToBeActivated (NULL) -{ +XGUI_PropertyPanelSelector::XGUI_PropertyPanelSelector( + XGUI_PropertyPanel *thePanel) + : myPanel(thePanel), myWidgetToBeActivated(NULL) { connect(myPanel, SIGNAL(propertyPanelActivated()), this, SIGNAL(activated())); - connect(myPanel, SIGNAL(propertyPanelDeactivated()), this, SIGNAL(deactivated())); + connect(myPanel, SIGNAL(propertyPanelDeactivated()), this, + SIGNAL(deactivated())); } //******************************************************************** -void XGUI_PropertyPanelSelector::reset() -{ - myWidgetToBeActivated = NULL; -} +void XGUI_PropertyPanelSelector::reset() { myWidgetToBeActivated = NULL; } //******************************************************************** -void XGUI_PropertyPanelSelector::setActive(const bool& isActive) -{ +void XGUI_PropertyPanelSelector::setActive(const bool &isActive) { if (isActive && myWidgetToBeActivated) { // e.g. widget sketch label myPanel->activateWidget(myWidgetToBeActivated, true); @@ -45,9 +43,8 @@ void XGUI_PropertyPanelSelector::setActive(const bool& isActive) } if (!isActive) { // on deactivating, store previous active widget - ModuleBase_ModelWidget* aWidget = myPanel->activeWidget(); - if (aWidget && aWidget->needToBeActivated()) - { + ModuleBase_ModelWidget *aWidget = myPanel->activeWidget(); + if (aWidget && aWidget->needToBeActivated()) { myWidgetToBeActivated = aWidget; } myPanel->activateWidget(NULL, false); @@ -55,15 +52,13 @@ void XGUI_PropertyPanelSelector::setActive(const bool& isActive) } //******************************************************************** -bool XGUI_PropertyPanelSelector::needToBeActivated() const -{ +bool XGUI_PropertyPanelSelector::needToBeActivated() const { return myWidgetToBeActivated != NULL; } //******************************************************************** -void XGUI_PropertyPanelSelector::processSelection() -{ - ModuleBase_ModelWidget* aWidget = myPanel->activeWidget(); +void XGUI_PropertyPanelSelector::processSelection() { + ModuleBase_ModelWidget *aWidget = myPanel->activeWidget(); if (!aWidget) return; diff --git a/src/XGUI/XGUI_PropertyPanelSelector.h b/src/XGUI/XGUI_PropertyPanelSelector.h index 485cde184..db430ebc4 100644 --- a/src/XGUI/XGUI_PropertyPanelSelector.h +++ b/src/XGUI/XGUI_PropertyPanelSelector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_PropertyPanelSelector_H @@ -28,18 +29,17 @@ class ModuleBase_ModelWidget; class XGUI_PropertyPanel; /** -* Processing selection by the property panel. -*/ -class XGUI_PropertyPanelSelector : public XGUI_ActiveControlSelector -{ + * Processing selection by the property panel. + */ +class XGUI_PropertyPanelSelector : public XGUI_ActiveControlSelector { Q_OBJECT public: /// Constructor /// \param thePanel the workshop property panel - XGUI_EXPORT XGUI_PropertyPanelSelector(XGUI_PropertyPanel* thePanel); + XGUI_EXPORT XGUI_PropertyPanelSelector(XGUI_PropertyPanel *thePanel); /// Destructor - XGUI_EXPORT virtual ~XGUI_PropertyPanelSelector() {}; + XGUI_EXPORT virtual ~XGUI_PropertyPanelSelector(){}; /// Returns name of the selector XGUI_EXPORT static QString Type() { return "XGUI_PropertyPanelSelector"; } @@ -50,21 +50,22 @@ public: /// Clear need to be activated widget if it exists XGUI_EXPORT virtual void reset(); - /// Sets control active. It should activates/deactivates selection and selection filters. - /// \param isActive if true, the control becomes active - XGUI_EXPORT virtual void setActive(const bool& isActive); + /// Sets control active. It should activates/deactivates selection and + /// selection filters. \param isActive if true, the control becomes active + XGUI_EXPORT virtual void setActive(const bool &isActive); - /// Returns whether the selector should be activated as soon as possible (by deactivatate other) - /// \return boolean result + /// Returns whether the selector should be activated as soon as possible (by + /// deactivatate other) \return boolean result XGUI_EXPORT virtual bool needToBeActivated() const; - /// Processes current selection of workshop. Reaction to selection change in workshop. + /// Processes current selection of workshop. Reaction to selection change in + /// workshop. XGUI_EXPORT virtual void processSelection(); protected: - XGUI_PropertyPanel* myPanel; ///< processed panel - ModuleBase_ModelWidget* myWidgetToBeActivated; ///< used as need to be activated back - + XGUI_PropertyPanel *myPanel; ///< processed panel + ModuleBase_ModelWidget + *myWidgetToBeActivated; ///< used as need to be activated back }; #endif diff --git a/src/XGUI/XGUI_QtEvents.cpp b/src/XGUI/XGUI_QtEvents.cpp index 8731580ff..395612efe 100644 --- a/src/XGUI/XGUI_QtEvents.cpp +++ b/src/XGUI/XGUI_QtEvents.cpp @@ -14,17 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_QtEvents.h" QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType = - QEvent::Type(QEvent::registerEventType()); + QEvent::Type(QEvent::registerEventType()); - -std::shared_ptr PostponeMessageQtEvent::postponedMessage() -{ +std::shared_ptr PostponeMessageQtEvent::postponedMessage() { return myMessage; } - diff --git a/src/XGUI/XGUI_QtEvents.h b/src/XGUI/XGUI_QtEvents.h index 3191c1b59..e529fbe59 100644 --- a/src/XGUI/XGUI_QtEvents.h +++ b/src/XGUI/XGUI_QtEvents.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_QTEVENTS_H_ @@ -22,41 +23,34 @@ #include -#include #include +#include #include #include /** -* \ingroup GUI -* Class of event to send application events in multi thread environment -*/ -class XGUI_EXPORT PostponeMessageQtEvent : public QEvent -{ - public: - /// An event type + * \ingroup GUI + * Class of event to send application events in multi thread environment + */ +class XGUI_EXPORT PostponeMessageQtEvent : public QEvent { +public: + /// An event type static QEvent::Type PostponeMessageQtEventType; /// Constructor /// \param theMessage an event message to send - PostponeMessageQtEvent(const std::shared_ptr& theMessage) - : QEvent(PostponeMessageQtEventType), - myMessage(theMessage) - { - } + PostponeMessageQtEvent(const std::shared_ptr &theMessage) + : QEvent(PostponeMessageQtEventType), myMessage(theMessage) {} /// Returns type of the event - static QEvent::Type type() - { - return PostponeMessageQtEventType; - } + static QEvent::Type type() { return PostponeMessageQtEventType; } /// Returns current messasge std::shared_ptr postponedMessage(); - private: - /// Message +private: + /// Message std::shared_ptr myMessage; }; diff --git a/src/XGUI/XGUI_SalomeConnector.cpp b/src/XGUI/XGUI_SalomeConnector.cpp index aa32e39f7..86b3a970b 100644 --- a/src/XGUI/XGUI_SalomeConnector.cpp +++ b/src/XGUI/XGUI_SalomeConnector.cpp @@ -14,17 +14,12 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_SalomeConnector.h" -XGUI_SalomeConnector::XGUI_SalomeConnector() -{ +XGUI_SalomeConnector::XGUI_SalomeConnector() {} -} - -XGUI_SalomeConnector::~XGUI_SalomeConnector() -{ - -} +XGUI_SalomeConnector::~XGUI_SalomeConnector() {} diff --git a/src/XGUI/XGUI_SalomeConnector.h b/src/XGUI/XGUI_SalomeConnector.h index 28e09e8e8..6d53883f3 100644 --- a/src/XGUI/XGUI_SalomeConnector.h +++ b/src/XGUI/XGUI_SalomeConnector.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_SALOMECONNECTOR_H @@ -36,9 +37,8 @@ class ModuleBase_IViewer; * An interface which provides a connection of XGUI functionality * with functionality of SALOME module interface. */ -class XGUI_EXPORT XGUI_SalomeConnector -{ - public: +class XGUI_EXPORT XGUI_SalomeConnector { +public: /// Default constructor XGUI_SalomeConnector(); /// Virtual destructor @@ -55,34 +55,34 @@ class XGUI_EXPORT XGUI_SalomeConnector //! \param theKeys - hot keys //! \param isAddSeparator boolean flag about adding separator after the action //! returns created action - virtual QAction* addFeature(const QString& theWBName, const QString& theTBName, - const QString& theId, - const QString& theTitle, const QString& theTip, - const QIcon& theIcon, - const QKeySequence& theKeys, bool isCheckable, - const bool isAddSeparator, - const QString& theStatusTip) = 0; + virtual QAction *addFeature(const QString &theWBName, + const QString &theTBName, const QString &theId, + const QString &theTitle, const QString &theTip, + const QIcon &theIcon, const QKeySequence &theKeys, + bool isCheckable, const bool isAddSeparator, + const QString &theStatusTip) = 0; //! Creates a feature (command) in SALOME desktop //! \param theWBName - name of toolbar (workbench) //! \param theInfo - information about action (icon, text, etc) //! \param isAddSeparator boolean flag about adding separator after the action - virtual QAction* addFeature(const QString& theWBName, - const ActionInfo& theInfo, const bool isAddSeparator) = 0; + virtual QAction *addFeature(const QString &theWBName, + const ActionInfo &theInfo, + const bool isAddSeparator) = 0; //! Creates a feature (command) in SALOME desktop //! \param theWBName - name of toolbar (workbench) //! \param theInfo - information about action (icon, text, etc) //! \param theNestedActions a list of nested actions - virtual QAction* addFeatureOfNested(const QString& theWBName, - const ActionInfo& theInfo, - const QList& theNestedActions) = 0; + virtual QAction * + addFeatureOfNested(const QString &theWBName, const ActionInfo &theInfo, + const QList &theNestedActions) = 0; //! Returns true if the feature action is a nested action, in other words, //! it is created by addFeatureOfNested(). //! \param theAction - an action of a feature //! returns boolean result - virtual bool isFeatureOfNested(const QAction* theAction) = 0; + virtual bool isFeatureOfNested(const QAction *theAction) = 0; //! Creates a command in Edit menu of SALOME desktop //! \param theId - an id of the feature @@ -94,56 +94,59 @@ class XGUI_EXPORT XGUI_SalomeConnector //! \param theMenuSourceText - a source text of the desktop menu //! \param theSubMenu - a sub-menu name //! \param theMenuPosition - a position of the command in the desktop menu - //! \param theSuibMenuPosition - a position of the sub-menu in the desktop menu - //! returns created action - virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle, - const QString& theTip, const QIcon& theIcon, - const QKeySequence& theKeys, bool isCheckable, - const char* theMenuSourceText, - const QString& theSubMenu = QString(), - const int theMenuPosition = 10, - const int theSuibMenuPosition = -1) = 0; + //! \param theSuibMenuPosition - a position of the sub-menu in the desktop + //! menu returns created action + virtual QAction *addDesktopCommand( + const QString &theId, const QString &theTitle, const QString &theTip, + const QIcon &theIcon, const QKeySequence &theKeys, bool isCheckable, + const char *theMenuSourceText, const QString &theSubMenu = QString(), + const int theMenuPosition = 10, const int theSuibMenuPosition = -1) = 0; //! Insert separator into Edit menu of SALOME desktop - virtual void addDesktopMenuSeparator(const char* theMenuSourceText, + virtual void addDesktopMenuSeparator(const char *theMenuSourceText, const int theMenuPosition = 10) = 0; /// Add an action into tool bar /// \param theAction the Action object /// \param theToolBarTitle the toolbar name - virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0; + virtual bool addActionInToolbar(QAction *theAction, + const QString &theToolBarTitle) = 0; - /// Creates menu/tool bar actions for loaded features stored in the menu manager + /// Creates menu/tool bar actions for loaded features stored in the menu + /// manager virtual void createFeatureActions() = 0; //! Returns desktop window of SALOME - virtual QMainWindow* desktop() const = 0; + virtual QMainWindow *desktop() const = 0; //! Returns list of defined actions (just by SHAPER module) - virtual QList commandList() const = 0; + virtual QList commandList() const = 0; //! Stores XML information for the feature kind //! \param theFeatureId a feature kind //! \param theMessage a container of the feature XML properties - virtual void setFeatureInfo(const QString& theFeatureId, - const std::shared_ptr& theMessage) = 0; + virtual void + setFeatureInfo(const QString &theFeatureId, + const std::shared_ptr &theMessage) = 0; //! Returns XML information for the feature kind //! \param theFeatureId a feature kind //! \return theMessage a container of the feature XML properties - virtual std::shared_ptr featureInfo(const QString& theFeatureId) = 0; + virtual std::shared_ptr + featureInfo(const QString &theFeatureId) = 0; //! Returns interface to Salome viewer - virtual ModuleBase_IViewer* viewer() const = 0; + virtual ModuleBase_IViewer *viewer() const = 0; //! Create preferences virtual void createPreferences() = 0; //! Shows the given text in status bar as a permanent text //! \theInfo a string value - //! \theMsecs interval of msec milliseconds when the message will be hidden, if -1, it stays. + //! \theMsecs interval of msec milliseconds when the message will be hidden, + //! if -1, it stays. // If 0, default value is used, it is 3000 - virtual void putInfo(const QString& theInfo, const int theMSecs = 0) = 0; + virtual void putInfo(const QString &theInfo, const int theMSecs = 0) = 0; }; #endif diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index fab475e49..18a86b766 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -14,14 +14,15 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_Selection.h" -#include "XGUI_Workshop.h" #include "XGUI_Displayer.h" -#include "XGUI_ViewerProxy.h" #include "XGUI_ObjectsBrowser.h" +#include "XGUI_ViewerProxy.h" +#include "XGUI_Workshop.h" #ifndef HAVE_SALOME #include @@ -32,10 +33,10 @@ #include "ModuleBase_ViewerPrs.h" #include -#include -#include #include #include +#include +#include #include #ifdef BEFORE_TRIHEDRON_PATCH @@ -44,15 +45,15 @@ #else #include #endif -#include #include -#include +#include #include #include #include +#include -#include #include +#include #include @@ -62,40 +63,40 @@ #define DEBUG_DELIVERY -XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop) - : myWorkshop(theWorkshop) -{ -} +XGUI_Selection::XGUI_Selection(XGUI_Workshop *theWorkshop) + : myWorkshop(theWorkshop) {} -QList XGUI_Selection::getSelected(const SelectionPlace& thePlace) const -{ +QList +XGUI_Selection::getSelected(const SelectionPlace &thePlace) const { QList aPresentations; QList aToRemove; switch (thePlace) { - case Browser: - getSelectedInBrowser(aPresentations); + case Browser: + getSelectedInBrowser(aPresentations); break; - case Viewer: - getSelectedInViewer(aPresentations); + case Viewer: + getSelectedInViewer(aPresentations); break; case AllControls: // Get selection from object browser getSelectedInBrowser(aPresentations); - // Filter out all objects except feature if there is no selected results in object browser - // Filter out all features if in object browser there are selected features and their results + // Filter out all objects except feature if there is no selected results in + // object browser Filter out all features if in object browser there are + // selected features and their results bool aHasFeature = false; bool aHasResult = false; - foreach(ModuleBase_ViewerPrsPtr aVal, aPresentations) { + foreach (ModuleBase_ViewerPrsPtr aVal, aPresentations) { if (aVal->object().get()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(aVal->object()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aVal->object()); if (aFeature.get()) { aHasFeature = true; std::list aResList = aFeature->results(); std::list::const_iterator aIt; for (aIt = aResList.cbegin(); aIt != aResList.cend(); aIt++) { - foreach(ModuleBase_ViewerPrsPtr aSel, aPresentations) { + foreach (ModuleBase_ViewerPrsPtr aSel, aPresentations) { if (aSel->object() == (*aIt)) { aHasResult = true; break; @@ -109,31 +110,32 @@ QList XGUI_Selection::getSelected(const SelectionPlace& if (aHasFeature && aHasResult) break; } - //Get selection from a viewer + // Get selection from a viewer getSelectedInViewer(aPresentations); // Filter out extra objects if (aHasFeature && aHasResult) { - foreach(ModuleBase_ViewerPrsPtr aVal, aPresentations) { + foreach (ModuleBase_ViewerPrsPtr aVal, aPresentations) { if (aVal->object().get()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(aVal->object()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aVal->object()); if (aFeature.get()) { aToRemove.append(aVal); } } } - } - else if (aHasFeature && (!aHasResult)) { - foreach(ModuleBase_ViewerPrsPtr aVal, aPresentations) { + } else if (aHasFeature && (!aHasResult)) { + foreach (ModuleBase_ViewerPrsPtr aVal, aPresentations) { if (aVal->object().get()) { - FeaturePtr aFeature = std::dynamic_pointer_cast(aVal->object()); + FeaturePtr aFeature = + std::dynamic_pointer_cast(aVal->object()); if (!aFeature.get()) { aToRemove.append(aVal); } } } } - foreach(ModuleBase_ViewerPrsPtr aVal, aToRemove) { + foreach (ModuleBase_ViewerPrsPtr aVal, aToRemove) { aPresentations.removeAll(aVal); } break; @@ -141,8 +143,8 @@ QList XGUI_Selection::getSelected(const SelectionPlace& return aPresentations; } -Handle(AIS_InteractiveObject) XGUI_Selection::getIO(const ModuleBase_ViewerPrsPtr& thePrs) -{ +Handle(AIS_InteractiveObject) + XGUI_Selection::getIO(const ModuleBase_ViewerPrsPtr &thePrs) { Handle(AIS_InteractiveObject) anIO = thePrs->interactive(); if (anIO.IsNull()) { Handle(SelectMgr_EntityOwner) anOwner = thePrs->owner(); @@ -150,7 +152,7 @@ Handle(AIS_InteractiveObject) XGUI_Selection::getIO(const ModuleBase_ViewerPrsPt anIO = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); if (anIO.IsNull() && thePrs->object()) { - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); AISObjectPtr anAISObject = aDisplayer->getAISObject(thePrs->object()); if (anAISObject.get()) anIO = anAISObject->impl(); @@ -159,12 +161,14 @@ Handle(AIS_InteractiveObject) XGUI_Selection::getIO(const ModuleBase_ViewerPrsPt return anIO; } -void XGUI_Selection::getSelectedInViewer(QList& thePresentations) const -{ +void XGUI_Selection::getSelectedInViewer( + QList &thePresentations) const { Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { - QList aSelectedIds; // Remember of selected address in order to avoid duplicates - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + QList aSelectedIds; // Remember of selected address in order to + // avoid duplicates + for (aContext->InitSelected(); aContext->MoreSelected(); + aContext->NextSelected()) { ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs()); Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner(); @@ -174,38 +178,43 @@ void XGUI_Selection::getSelectedInViewer(QList& thePres fillPresentation(aPrs, anOwner); - if (!thePresentations.contains(aPrs)) // TODO: check whether the presentation in a list + if (!thePresentations.contains( + aPrs)) // TODO: check whether the presentation in a list thePresentations.append(aPrs); } } } -void XGUI_Selection::getSelectedInBrowser(QList& thePresentations) const -{ - // collect the objects of the parameter presentation to avoid a repeted objects in the result +void XGUI_Selection::getSelectedInBrowser( + QList &thePresentations) const { + // collect the objects of the parameter presentation to avoid a repeted + // objects in the result QObjectPtrList aPresentationObjects; - QList::const_iterator aPrsIt = thePresentations.begin(), - aPrsLast = thePresentations.end(); + QList::const_iterator aPrsIt = + thePresentations.begin(), + aPrsLast = + thePresentations.end(); for (; aPrsIt != aPrsLast; aPrsIt++) { aPresentationObjects.push_back((*aPrsIt)->object()); } QObjectPtrList anObjects = selectedObjects(); - QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); + QObjectPtrList::const_iterator anIt = anObjects.begin(), + aLast = anObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (anObject.get() != NULL && !aPresentationObjects.contains(anObject)) { thePresentations.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); } } } -void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, - const Handle(SelectMgr_EntityOwner)& theOwner) const -{ +void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr &thePrs, + const Handle(SelectMgr_EntityOwner) & + theOwner) const { Handle(AIS_InteractiveObject) anIO = - Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); + Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); #ifndef HAVE_SALOME Handle(AIS_ViewCube) aCube = Handle(AIS_ViewCube)::DownCast(anIO); if (!aCube.IsNull()) @@ -215,21 +224,22 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, thePrs->setOwner(theOwner); thePrs->setInteractive(anIO); - // we should not check the appearance of this feature because there can be some selected shapes - // for one feature - Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(theOwner); - if( !aBRO.IsNull() && aBRO->HasShape() ) { + // we should not check the appearance of this feature because there can be + // some selected shapes for one feature + Handle(StdSelect_BRepOwner) aBRO = + Handle(StdSelect_BRepOwner)::DownCast(theOwner); + if (!aBRO.IsNull() && aBRO->HasShape()) { TopoDS_Shape aShape = aBRO->Shape(); Handle(ModuleBase_ResultPrs) aPrsObj = - Handle(ModuleBase_ResultPrs)::DownCast(aBRO->Selectable()); + Handle(ModuleBase_ResultPrs)::DownCast(aBRO->Selectable()); if (!aPrsObj.IsNull()) { if (aPrsObj->isSubstituted()) { if (aPrsObj->Shape().IsSame(aShape)) aShape = aPrsObj->originalShape(); } } - // the located method is called in the context to obtain the shape by the SelectedShape() - // method, so the shape is located by the same rules + // the located method is called in the context to obtain the shape by the + // SelectedShape() method, so the shape is located by the same rules aShape = aShape.Located(aBRO->Location() * aShape.Location()); #ifdef BEFORE_TRIHEDRON_PATCH #ifndef DEBUG_DELIVERY @@ -239,7 +249,7 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, #endif if (!aShape.IsNull()) { std::shared_ptr aGeomShape = - std::shared_ptr(new GeomAPI_Shape()); + std::shared_ptr(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(aShape)); thePrs->setShape(aGeomShape); } @@ -285,7 +295,8 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, for (int i = 0; i < aSize; i++) { aObj = aDoc->object(ModelAPI_ResultConstruction::group(), i); if (aObj->data()->name() == "Origin") { - aOrigin = std::dynamic_pointer_cast(aObj); + aOrigin = + std::dynamic_pointer_cast(aObj); break; } } @@ -298,16 +309,26 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, } #else /// find axis direction - Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner); + Handle(AIS_TrihedronOwner) aTrihedronOwner = + Handle(AIS_TrihedronOwner)::DownCast(theOwner); if (!aTrihedronOwner.IsNull()) { - const Prs3d_DatumParts& aPart = aTrihedronOwner->DatumPart(); + const Prs3d_DatumParts &aPart = aTrihedronOwner->DatumPart(); std::wstring aName; switch (aPart) { - case Prs3d_DP_Origin: aName = L"Origin"; break; - case Prs3d_DP_XAxis: aName = L"OX"; break; - case Prs3d_DP_YAxis: aName = L"OY"; break; - case Prs3d_DP_ZAxis: aName = L"OZ"; break; - default: break; + case Prs3d_DP_Origin: + aName = L"Origin"; + break; + case Prs3d_DP_XAxis: + aName = L"OX"; + break; + case Prs3d_DP_YAxis: + aName = L"OY"; + break; + case Prs3d_DP_ZAxis: + aName = L"OZ"; + break; + default: + break; } if (aName.length() > 0) { DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument(); @@ -317,7 +338,8 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, for (int i = 0; i < aSize; i++) { aObj = aDoc->object(ModelAPI_ResultConstruction::group(), i); if (aObj->data()->name() == aName) { - aResult = std::dynamic_pointer_cast(aObj); + aResult = + std::dynamic_pointer_cast(aObj); break; } } @@ -332,13 +354,15 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, #endif } - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); ObjectPtr aFeature = aDisplayer->getObject(anIO); - Handle(ModuleBase_BRepOwner) aCompSolidBRO = Handle(ModuleBase_BRepOwner)::DownCast(theOwner); + Handle(ModuleBase_BRepOwner) aCompSolidBRO = + Handle(ModuleBase_BRepOwner)::DownCast(theOwner); if (!aCompSolidBRO.IsNull()) { - // If ModuleBase_BRepOwner object is created then it means that TopAbs_COMPSOLID selection mode - // is On and we have to use parent result which corresponds to the CompSolid shape + // If ModuleBase_BRepOwner object is created then it means that + // TopAbs_COMPSOLID selection mode is On and we have to use parent result + // which corresponds to the CompSolid shape ResultPtr aResult = std::dynamic_pointer_cast(aFeature); if (aResult.get()) { ResultBodyPtr aCompSolid = ModelAPI_Tools::bodyOwner(aResult); @@ -354,15 +378,16 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs, thePrs->setObject(aFeature); } -QList XGUI_Selection::getHighlighted() const -{ +QList XGUI_Selection::getHighlighted() const { QList aPresentations; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (aContext.IsNull()) return aPresentations; - QList aSelectedIds; // Remember of selected address in order to avoid duplicates - for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) { + QList + aSelectedIds; // Remember of selected address in order to avoid duplicates + for (aContext->InitDetected(); aContext->MoreDetected(); + aContext->NextDetected()) { Handle(SelectMgr_EntityOwner) anOwner = aContext->DetectedOwner(); if (!anOwner.IsNull()) { if (aSelectedIds.contains((size_t)anOwner.get())) @@ -377,20 +402,19 @@ QList XGUI_Selection::getHighlighted() const return aPresentations; } -QObjectPtrList XGUI_Selection::selectedObjects() const -{ +QObjectPtrList XGUI_Selection::selectedObjects() const { if (myWorkshop->objectBrowser()) return myWorkshop->objectBrowser()->selectedObjects(); return QObjectPtrList(); } -QObjectPtrList XGUI_Selection::selectedPresentations() const -{ +QObjectPtrList XGUI_Selection::selectedPresentations() const { QObjectPtrList aSelectedList; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + for (aContext->InitSelected(); aContext->MoreSelected(); + aContext->NextSelected()) { Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive(); ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO); if (aResult) @@ -401,40 +425,40 @@ QObjectPtrList XGUI_Selection::selectedPresentations() const } //************************************************************** -QModelIndexList XGUI_Selection::selectedIndexes() const -{ +QModelIndexList XGUI_Selection::selectedIndexes() const { return myWorkshop->objectBrowser()->selectedIndexes(); } //************************************************************** -ObjectPtr XGUI_Selection::getSelectableObject(const Handle(SelectMgr_EntityOwner)& theOwner) const -{ +ObjectPtr XGUI_Selection::getSelectableObject( + const Handle(SelectMgr_EntityOwner) & theOwner) const { ObjectPtr anObject; Handle(SelectMgr_EntityOwner) aEO = theOwner; if (!aEO.IsNull()) { Handle(AIS_InteractiveObject) anObj = - Handle(AIS_InteractiveObject)::DownCast(aEO->Selectable()); + Handle(AIS_InteractiveObject)::DownCast(aEO->Selectable()); anObject = myWorkshop->displayer()->getObject(anObj); } return anObject; } //************************************************************** -void XGUI_Selection::selectedOwners(SelectMgr_IndexedMapOfOwner& theSelectedOwners) const -{ +void XGUI_Selection::selectedOwners( + SelectMgr_IndexedMapOfOwner &theSelectedOwners) const { Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + for (aContext->InitSelected(); aContext->MoreSelected(); + aContext->NextSelected()) { theSelectedOwners.Add(aContext->SelectedOwner()); } } } //************************************************************** -void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject, - SelectMgr_IndexedMapOfOwner& theOwners) const -{ +void XGUI_Selection::entityOwners( + const Handle(AIS_InteractiveObject) & theObject, + SelectMgr_IndexedMapOfOwner &theOwners) const { Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (aContext.IsNull() || theObject.IsNull()) return; @@ -449,13 +473,16 @@ void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject continue; Handle(SelectMgr_Selection) aSelection = theObject->Selection(aMode); - NCollection_Vector anEntities = aSelection->Entities(); - for (NCollection_Vector::Iterator anEntIt(anEntities); + NCollection_Vector anEntities = + aSelection->Entities(); + for (NCollection_Vector::Iterator + anEntIt(anEntities); anEntIt.More(); anEntIt.Next()) { Handle(SelectMgr_SensitiveEntity) anEntity = anEntIt.Value(); if (anEntity.IsNull()) continue; - Handle(SelectMgr_EntityOwner) anOwner = anEntity->BaseSensitive()->OwnerId(); + Handle(SelectMgr_EntityOwner) anOwner = + anEntity->BaseSensitive()->OwnerId(); if (!anOwner.IsNull()) theOwners.Add(anOwner); } @@ -464,8 +491,8 @@ void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject //************************************************************** #ifdef BEFORE_TRIHEDRON_PATCH -TopoDS_Shape XGUI_Selection::findAxisShape(Handle(AIS_InteractiveObject) theIO) const -{ +TopoDS_Shape XGUI_Selection::findAxisShape(Handle(AIS_InteractiveObject) + theIO) const { TopoDS_Shape aShape; // Fill by trihedron shapes Handle(AIS_Axis) aAxis = Handle(AIS_Axis)::DownCast(theIO); @@ -473,7 +500,8 @@ TopoDS_Shape XGUI_Selection::findAxisShape(Handle(AIS_InteractiveObject) theIO) // an Axis from Trihedron Handle(Geom_Line) aLine = aAxis->Component(); Handle(Prs3d_DatumAspect) DA = aAxis->Attributes()->DatumAspect(); - Handle(Geom_TrimmedCurve) aTLine = new Geom_TrimmedCurve(aLine, 0, DA->FirstAxisLength()); + Handle(Geom_TrimmedCurve) aTLine = + new Geom_TrimmedCurve(aLine, 0, DA->FirstAxisLength()); BRep_Builder aBuilder; TopoDS_Edge aEdge; diff --git a/src/XGUI/XGUI_Selection.h b/src/XGUI/XGUI_Selection.h index 58b257998..2e117b3fe 100644 --- a/src/XGUI/XGUI_Selection.h +++ b/src/XGUI/XGUI_Selection.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_Selection_H @@ -25,9 +26,9 @@ #include #include -#include #include #include +#include #include #include @@ -38,23 +39,23 @@ class ModuleBase_ViewerPrs; /// \ingroup GUI /// Implementation of \ref ModuleBase_ISelection interface. -class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection -{ - public: - /// Constructor - /// \param theWorkshop reference to workshop instance - XGUI_Selection(XGUI_Workshop* theWorkshop); +class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection { +public: + /// Constructor + /// \param theWorkshop reference to workshop instance + XGUI_Selection(XGUI_Workshop *theWorkshop); /// Returns a list of viewer selected presentations /// \return list of presentations virtual QList> - getSelected(const SelectionPlace& thePlace = Browser) const; + getSelected(const SelectionPlace &thePlace = Browser) const; /// Fills the viewer presentation parameters by the parameters from the owner /// \param thePrs a container for selection /// \param theOwner a selection owner - virtual void fillPresentation(std::shared_ptr& thePrs, - const Handle(SelectMgr_EntityOwner)& theOwner) const; + virtual void fillPresentation(std::shared_ptr &thePrs, + const Handle(SelectMgr_EntityOwner) & + theOwner) const; /// Returns a list of viewer highlited presentations /// \return list of presentations @@ -71,47 +72,51 @@ class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection /// Returns list of currently selected owners /// \return list of owners - void selectedOwners(SelectMgr_IndexedMapOfOwner& theSelectedOwners) const; + void selectedOwners(SelectMgr_IndexedMapOfOwner &theSelectedOwners) const; /// Returns a list of selection entity owners of the interactive object /// It depends on the modes, in which the object is activated in the context /// \param theObject an object /// \param theOwners a map of entity owners - void entityOwners(const Handle(AIS_InteractiveObject)& theObject, - SelectMgr_IndexedMapOfOwner& theOwners) const; + void entityOwners(const Handle(AIS_InteractiveObject) & theObject, + SelectMgr_IndexedMapOfOwner &theOwners) const; /// Return the IO from the viewer presentation. /// \param thePrs a selected object /// \return an interactive object - virtual Handle(AIS_InteractiveObject) getIO(const std::shared_ptr& thePrs); + virtual Handle(AIS_InteractiveObject) + getIO(const std::shared_ptr &thePrs); protected: - /// Return a selectable object by the entity owner. It founds AIS object in the viewer - /// and returns the corresponded object - /// \param theOwner an entity owner - /// \return a found object or NULL - ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner)& theOwner) const; + /// Return a selectable object by the entity owner. It founds AIS object in + /// the viewer and returns the corresponded object \param theOwner an entity + /// owner \return a found object or NULL + ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner) & + theOwner) const; /// Fills the list of presentations by objects selected in the viewer. /// \param thePresentations an output list of presentation - void getSelectedInViewer(QList>& thePresentations) const; + void getSelectedInViewer( + QList> &thePresentations) const; /// Fills the list of presentations by objects selected in the object browser. /// ViewerPrs contains only object parameter not empty. - /// If the given list of presentations already has a viewer presentation with the same object - /// as selected in the browser, a new item is not appended to the list of presentations. - /// \param thePresentations an output list of presentation - void getSelectedInBrowser(QList>& thePresentations) const; - - /// Generates a vertex or edge by the give IO if it is an AIS created on trihedron - /// \param theIO a selected object - /// \return created shape or empty shape + /// If the given list of presentations already has a viewer presentation with + /// the same object as selected in the browser, a new item is not appended to + /// the list of presentations. \param thePresentations an output list of + /// presentation + void getSelectedInBrowser( + QList> &thePresentations) const; + + /// Generates a vertex or edge by the give IO if it is an AIS created on + /// trihedron \param theIO a selected object \return created shape or empty + /// shape #ifdef BEFORE_TRIHEDRON_PATCH TopoDS_Shape findAxisShape(Handle(AIS_InteractiveObject) theIO) const; #endif private: - XGUI_Workshop* myWorkshop; ///< current workshop + XGUI_Workshop *myWorkshop; ///< current workshop }; #endif diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 123f43c2d..772e40d81 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_SelectionActivate.h" @@ -55,16 +56,16 @@ #define CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY //************************************************************** -XGUI_SelectionActivate::XGUI_SelectionActivate(ModuleBase_IWorkshop* theWorkshop) - : ModuleBase_ISelectionActivate(theWorkshop), myIsTrihedronActive(true) -{ -} +XGUI_SelectionActivate::XGUI_SelectionActivate( + ModuleBase_IWorkshop *theWorkshop) + : ModuleBase_ISelectionActivate(theWorkshop), myIsTrihedronActive(true) {} //************************************************************** -XGUI_SelectionActivate::SelectionPlace XGUI_SelectionActivate::activeSelectionPlace() const -{ - XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); - XGUI_ActiveControlSelector* anActiveSelector = aWorkshop->activeControlMgr()->activeSelector(); +XGUI_SelectionActivate::SelectionPlace +XGUI_SelectionActivate::activeSelectionPlace() const { + XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); + XGUI_ActiveControlSelector *anActiveSelector = + aWorkshop->activeControlMgr()->activeSelector(); if (!anActiveSelector) return Workshop; @@ -75,66 +76,69 @@ XGUI_SelectionActivate::SelectionPlace XGUI_SelectionActivate::activeSelectionPl } //************************************************************** -void XGUI_SelectionActivate::updateSelectionModes() -{ +void XGUI_SelectionActivate::updateSelectionModes() { QIntList aModes; switch (activeSelectionPlace()) { case Workshop: myWorkshop->module()->activeSelectionModes(aModes); break; - case PropertyPanel: { - ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget(); - if (anActiveWidget) - getSelectionModes(anActiveWidget, aModes); - else - myWorkshop->module()->activeSelectionModes(aModes); //using module modes - } - break; - case FacesPanel: { - XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionModes(aModes); - myWorkshop->module()->moduleSelectionModes(-1/*all modes*/, aModes); - } + case PropertyPanel: { + ModuleBase_ModelWidget *anActiveWidget = + myWorkshop->module()->activeWidget(); + if (anActiveWidget) + getSelectionModes(anActiveWidget, aModes); + else + myWorkshop->module()->activeSelectionModes(aModes); // using module modes + } break; + case FacesPanel: { + XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionModes(aModes); + myWorkshop->module()->moduleSelectionModes(-1 /*all modes*/, aModes); + } break; + default: break; - default: break; } activateObjects(aModes, getDisplayer()->displayedObjects(), true); } //************************************************************** -void XGUI_SelectionActivate::updateSelectionFilters() -{ +void XGUI_SelectionActivate::updateSelectionFilters() { SelectMgr_ListOfFilter aSelectionFilters; switch (activeSelectionPlace()) { - case Workshop: { - QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); - myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters); - } + case Workshop: { + QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); + myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, + aSelectionFilters); + } break; + case PropertyPanel: { + QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); + + ModuleBase_ModelWidget *anActiveWidget = + myWorkshop->module()->activeWidget(); + if (anActiveWidget) + anActiveWidget->selectionFilters(aModuleSelectionFilters, + aSelectionFilters); + myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, + aSelectionFilters); + } break; + case FacesPanel: { + XGUI_Tools::workshop(myWorkshop) + ->facesPanel() + ->selectionFilters(aSelectionFilters); + // QIntList aModuleSelectionFilters = + // myWorkshop->module()->selectionFilters(); + // myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, + // aSelectionFilters); + } break; + default: break; - case PropertyPanel: { - QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); - - ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget(); - if (anActiveWidget) - anActiveWidget->selectionFilters(aModuleSelectionFilters, aSelectionFilters); - myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters); - } - break; - case FacesPanel: { - XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionFilters(aSelectionFilters); - //QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters(); - //myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters); - } - break; - default: break; } activateSelectionFilters(aSelectionFilters); } //************************************************************** -void XGUI_SelectionActivate::activateSelectionFilters - (const SelectMgr_ListOfFilter& theSelectionFilters) -{ - XGUI_Displayer* aDisplayer = getDisplayer(); +void XGUI_SelectionActivate::activateSelectionFilters( + const SelectMgr_ListOfFilter &theSelectionFilters) { + XGUI_Displayer *aDisplayer = getDisplayer(); aDisplayer->deactivateSelectionFilters(false); SelectMgr_ListIteratorOfListOfFilter aIt(theSelectionFilters); @@ -147,9 +151,8 @@ void XGUI_SelectionActivate::activateSelectionFilters } //************************************************************** -void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget, - QIntList& theModes) -{ +void XGUI_SelectionActivate::getSelectionModes( + ModuleBase_ModelWidget *theWidget, QIntList &theModes) { if (!theWidget) return; @@ -159,25 +162,24 @@ void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget } //************************************************************** -QIntList XGUI_SelectionActivate::activeSelectionModes() const -{ +QIntList XGUI_SelectionActivate::activeSelectionModes() const { QIntList aModes; foreach (int aMode, myActiveSelectionModes) { // aMode < 9 is a Shape Enum values - aModes << ((aMode < 9)? AIS_Shape::SelectionType(aMode) : aMode); + aModes << ((aMode < 9) ? AIS_Shape::SelectionType(aMode) : aMode); } return aModes; } //************************************************************** -bool XGUI_SelectionActivate::isActive(ObjectPtr theObject) const -{ +bool XGUI_SelectionActivate::isActive(ObjectPtr theObject) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull() || !getDisplayer()->isVisible(theObject)) return false; AISObjectPtr anObj = getDisplayedAISObject(theObject); - Handle(AIS_InteractiveObject) anAIS = anObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + anObj->impl(); TColStd_ListOfInteger aModes; aContext->ActivatedModes(anAIS, aModes); @@ -186,9 +188,9 @@ bool XGUI_SelectionActivate::isActive(ObjectPtr theObject) const } //************************************************************** -void XGUI_SelectionActivate::activateObjects(const QIntList& theModes, - const QObjectPtrList& theObjList, const bool theUpdateViewer) -{ +void XGUI_SelectionActivate::activateObjects(const QIntList &theModes, + const QObjectPtrList &theObjList, + const bool theUpdateViewer) { setSelectionModes(theModes); Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -196,21 +198,22 @@ void XGUI_SelectionActivate::activateObjects(const QIntList& theModes, if (aContext.IsNull()) return; - //aContext->UseDisplayedObjects(); - //myUseExternalObjects = true; + // aContext->UseDisplayedObjects(); + // myUseExternalObjects = true; Handle(AIS_InteractiveObject) anAISIO; AIS_ListOfInteractive aPrsList; AIS_ListOfInteractive aPrsListToBeDeactivated; - //if (aObjList.isEmpty()) - // return; - //else { - foreach(ObjectPtr anObject, theObjList) { + // if (aObjList.isEmpty()) + // return; + // else { + foreach (ObjectPtr anObject, theObjList) { AISObjectPtr anAISObject = getDisplayedAISObject(anObject); if (!anAISObject.get()) continue; - Handle(AIS_InteractiveObject) aPrs = anAISObject->impl(); + Handle(AIS_InteractiveObject) aPrs = + anAISObject->impl(); if (myWorkshop->module()->canActivateSelection(anObject)) aPrsList.Append(aPrs); else @@ -232,7 +235,7 @@ void XGUI_SelectionActivate::activateObjects(const QIntList& theModes, #ifdef _DEBUG bool isActivationChanged = false; #endif - for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()) { + for (aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()) { anAISIO = aLIt.Value(); if (activate(anAISIO, false)) { #ifdef _DEBUG @@ -241,7 +244,7 @@ void XGUI_SelectionActivate::activateObjects(const QIntList& theModes, } } - for(aLIt.Initialize(aPrsListToBeDeactivated); aLIt.More(); aLIt.Next()) { + for (aLIt.Initialize(aPrsListToBeDeactivated); aLIt.More(); aLIt.Next()) { anAISIO = aLIt.Value(); deactivateAIS(anAISIO); #ifdef _DEBUG @@ -252,32 +255,59 @@ void XGUI_SelectionActivate::activateObjects(const QIntList& theModes, #ifdef DEBUG_ACTIVATE_OBJECTS //************************************************************** -QString getModeInfo(const int theMode) -{ +QString getModeInfo(const int theMode) { QString anInfo = "Undefined"; - switch(theMode) { - case 0: anInfo = "SHAPE(0)"; break; - case 1: anInfo = "VERTEX(1)"; break; - case 2: anInfo = "EDGE(2)"; break; - case 3: anInfo = "WIRE(3)"; break; - case 4: anInfo = "FACE(4)"; break; - case 5: anInfo = "SHELL(5)"; break; - case 6: anInfo = "SOLID(6)"; break; - case 7: anInfo = "COMPSOLID(7)"; break; - case 8: anInfo = "COMPOUND(8)"; break; - case 100: anInfo = "Sel_Mode_First(100)"; break; //SketcherPrs_Tools - case 101: anInfo = "Sel_Constraint(101)"; break; - case 102: anInfo = "Sel_Dimension_All(102)"; break; - case 103: anInfo = "Sel_Dimension_Line(103)"; break; - case 104: anInfo = "Sel_Dimension_Text(104)"; break; - default: break; + switch (theMode) { + case 0: + anInfo = "SHAPE(0)"; + break; + case 1: + anInfo = "VERTEX(1)"; + break; + case 2: + anInfo = "EDGE(2)"; + break; + case 3: + anInfo = "WIRE(3)"; + break; + case 4: + anInfo = "FACE(4)"; + break; + case 5: + anInfo = "SHELL(5)"; + break; + case 6: + anInfo = "SOLID(6)"; + break; + case 7: + anInfo = "COMPSOLID(7)"; + break; + case 8: + anInfo = "COMPOUND(8)"; + break; + case 100: + anInfo = "Sel_Mode_First(100)"; + break; // SketcherPrs_Tools + case 101: + anInfo = "Sel_Constraint(101)"; + break; + case 102: + anInfo = "Sel_Dimension_All(102)"; + break; + case 103: + anInfo = "Sel_Dimension_Line(103)"; + break; + case 104: + anInfo = "Sel_Dimension_Text(104)"; + break; + default: + break; } return anInfo; } //************************************************************** -QString getModesInfo(const QIntList& theModes) -{ +QString getModesInfo(const QIntList &theModes) { QStringList aModesInfo; for (int i = 0, aSize = theModes.size(); i < aSize; i++) aModesInfo.append(getModeInfo(theModes[i])); @@ -286,28 +316,30 @@ QString getModesInfo(const QIntList& theModes) #endif //************************************************************** -void XGUI_SelectionActivate::setSelectionModes(const QIntList& theModes) -{ +void XGUI_SelectionActivate::setSelectionModes(const QIntList &theModes) { // Convert shape types to selection types QIntList aModes; - foreach(int aType, theModes) { + foreach (int aType, theModes) { aModes.append(getSelectionMode(aType)); } #ifdef DEBUG_ACTIVATE_OBJECTS QStringList anInfo; - QObjectPtrList::const_iterator anIt = theObjList.begin(), aLast = theObjList.end(); + QObjectPtrList::const_iterator anIt = theObjList.begin(), + aLast = theObjList.end(); for (; anIt != aLast; ++anIt) { anInfo.append(ModuleBase_Tools::objectInfo((*anIt))); } QString anInfoStr = anInfo.join(", "); - qDebug(QString("activateObjects: new modes%1, active modes%2, objects[%3] = %4"). - arg(getModesInfo(aModes)). - arg(getModesInfo(myActiveSelectionModes)). - arg(theObjList.size()). - arg(anInfoStr). - toStdString().c_str()); + qDebug( + QString("activateObjects: new modes%1, active modes%2, objects[%3] = %4") + .arg(getModesInfo(aModes)) + .arg(getModesInfo(myActiveSelectionModes)) + .arg(theObjList.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif // In order to avoid doblications of selection modes QIntList aNewModes; @@ -319,22 +351,22 @@ void XGUI_SelectionActivate::setSelectionModes(const QIntList& theModes) } //************************************************************** -void XGUI_SelectionActivate::activateOnDisplay(const Handle(AIS_InteractiveObject)& theIO, - const bool theUpdateViewer) -{ +void XGUI_SelectionActivate::activateOnDisplay( + const Handle(AIS_InteractiveObject) & theIO, const bool theUpdateViewer) { if (myActiveSelectionModes.size() == 0) activateAIS(theIO, 0, theUpdateViewer); else { - foreach(int aMode, myActiveSelectionModes) { + foreach (int aMode, myActiveSelectionModes) { activateAIS(theIO, aMode, theUpdateViewer); } } } //************************************************************** -void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& theIO, - const int theMode, const bool theUpdateViewer) const -{ +void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject) & + theIO, + const int theMode, + const bool theUpdateViewer) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!theIO.IsNull() && theIO == getTrihedron()) { if (theMode != AIS_Shape::SelectionType(TopAbs_EDGE) && @@ -343,29 +375,32 @@ void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& th } if (!aContext.IsNull()) { if (myWorkshop->module()) { - // the code is obsolete, used in additional check before activate, it was removed - //int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode); + // the code is obsolete, used in additional check before activate, it was + // removed + // int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode); aContext->Activate(theIO, theMode, false); #ifdef TINSPECTOR - if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode); + if (getDisplayer()->getCallBack()) + getDisplayer()->getCallBack()->Activate(theIO, theMode); #endif - } - else { + } else { aContext->Activate(theIO, theMode, false); #ifdef TINSPECTOR - if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode); + if (getDisplayer()->getCallBack()) + getDisplayer()->getCallBack()->Activate(theIO, theMode); #endif } // the fix from VPA for more suitable selection of sketcher lines if (theIO->Width() > 1) { double aPrecision = theIO->Width() + 2; if (theMode == getSelectionMode(TopAbs_VERTEX)) - aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", - "point-selection-sensitivity", 12); + aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue( + "Viewer", "point-selection-sensitivity", 12); else if ((theMode == getSelectionMode(TopAbs_EDGE)) || (theMode == getSelectionMode(TopAbs_WIRE))) - aPrecision = theIO->Width() + ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", - "edge-selection-sensitivity", 2); + aPrecision = + theIO->Width() + ModuleBase_Preferences::resourceMgr()->doubleValue( + "Viewer", "edge-selection-sensitivity", 2); if (aPrecision <= 0) aPrecision = 2; aContext->SetSelectionSensitivity(theIO, theMode, aPrecision); @@ -374,8 +409,11 @@ void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& th #ifdef DEBUG_ACTIVATE_AIS ObjectPtr anObject = getObject(theIO); anInfo.append(ModuleBase_Tools::objectInfo((*anIt))); - qDebug(QString("activateAIS: theMode = %1, object = %2").arg(theMode) - .arg(anInfo).toStdString().c_str()); + qDebug(QString("activateAIS: theMode = %1, object = %2") + .arg(theMode) + .arg(anInfo) + .toStdString() + .c_str()); #endif if (theUpdateViewer) getDisplayer()->updateViewer(); @@ -383,9 +421,9 @@ void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& th } //************************************************************** -void XGUI_SelectionActivate::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO, - const int theMode) const -{ +void XGUI_SelectionActivate::deactivateAIS(const Handle(AIS_InteractiveObject) & + theIO, + const int theMode) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { if (theMode == -1) @@ -396,57 +434,60 @@ void XGUI_SelectionActivate::deactivateAIS(const Handle(AIS_InteractiveObject)& #ifdef DEBUG_DEACTIVATE_AIS ObjectPtr anObject = getObject(theIO); anInfo.append(ModuleBase_Tools::objectInfo((*anIt))); - qDebug(QString("deactivateAIS: theMode = %1, object = %2").arg(theMode) - .arg(anInfo).toStdString().c_str()); + qDebug(QString("deactivateAIS: theMode = %1, object = %2") + .arg(theMode) + .arg(anInfo) + .toStdString() + .c_str()); #endif } } //************************************************************** -bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject)& theIO, - const bool theUpdateViewer) const -{ +bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject) & + theIO, + const bool theUpdateViewer) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull() || theIO.IsNull()) return false; bool isActivationChanged = false; // deactivate object in all modes, which are not in the list of activation - // It seems that after the IO deactivation the selected state of the IO's owners - // is modified in OCC(version: 6.8.0) and the selection of the object later is lost. - // By this reason, the number of the IO deactivate is decreased and the object is deactivated - // only if there is a difference in the current modes and the parameters modes. - // If the selection problem happens again, it is possible to write a test scenario and create - // a bug. The bug steps are the following: - // Create two IO, activate them in 5 modes, select the first IO, deactivate 3 modes for both, - // with clicked SHIFT select the second object. - // The result is the selection of the first IO is lost. + // It seems that after the IO deactivation the selected state of the IO's + // owners is modified in OCC(version: 6.8.0) and the selection of the object + // later is lost. By this reason, the number of the IO deactivate is decreased + // and the object is deactivated only if there is a difference in the current + // modes and the parameters modes. If the selection problem happens again, it + // is possible to write a test scenario and create a bug. The bug steps are + // the following: Create two IO, activate them in 5 modes, select the first + // IO, deactivate 3 modes for both, with clicked SHIFT select the second + // object. The result is the selection of the first IO is lost. TColStd_ListOfInteger aTColModes; aContext->ActivatedModes(theIO, aTColModes); - TColStd_ListIteratorOfListOfInteger itr( aTColModes ); + TColStd_ListIteratorOfListOfInteger itr(aTColModes); QIntList aModesActivatedForIO; bool isDeactivated = false; bool aHasValidMode = false; - for (; itr.More(); itr.Next() ) { + for (; itr.More(); itr.Next()) { Standard_Integer aMode = itr.Value(); aHasValidMode = aHasValidMode || aMode != -1; - //int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode); + // int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode); if (!myActiveSelectionModes.contains(aMode)) { deactivateAIS(theIO, aMode); isDeactivated = true; - } - else { + } else { aModesActivatedForIO.append(aMode); } } if (isDeactivated) { - // the selection from the previous activation modes should be cleared manually (#26172) - //theIO->ClearSelected(); + // the selection from the previous activation modes should be cleared + // manually (#26172) + // theIO->ClearSelected(); #ifndef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY XGUI_Tools::workshop(myWorkshop)->selector()->deselectPresentation(theIO); #endif // For performance issues - //if (theUpdateViewer) + // if (theUpdateViewer) // getDisplayer()->updateViewer(); isActivationChanged = true; } @@ -456,9 +497,10 @@ bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject)& theIO aContext->Load(theIO); Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO); if (!aTrihedron.IsNull()) { - // Workaround for Trihedron. It should be loaded using the next Load method to - // add this object to myGlobal map of selection manager - // it is important to activate trihedron in two selection modes: edges and vertices + // Workaround for Trihedron. It should be loaded using the next Load + // method to add this object to myGlobal map of selection manager it is + // important to activate trihedron in two selection modes: edges and + // vertices aContext->SelectionManager()->Load(theIO); } } @@ -469,11 +511,11 @@ bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject)& theIO if (!isTrihedronActive()) aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO); if (aTrihedron.IsNull()) { - // In order to clear active modes list + // In order to clear active modes list if (myActiveSelectionModes.size() == 0) { activateAIS(theIO, 0, theUpdateViewer); } else { - foreach(int aMode, myActiveSelectionModes) { + foreach (int aMode, myActiveSelectionModes) { if (!aModesActivatedForIO.contains(aMode)) { activateAIS(theIO, aMode, theUpdateViewer); isActivationChanged = true; @@ -485,22 +527,26 @@ bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject)& theIO } //************************************************************** -void XGUI_SelectionActivate::deactivate(const ObjectPtr& theObject, const bool theUpdateViewer) -{ +void XGUI_SelectionActivate::deactivate(const ObjectPtr &theObject, + const bool theUpdateViewer) { #ifdef DEBUG_DEACTIVATE QString anInfoStr = ModuleBase_Tools::objectInfo(theObject); - qDebug(QString("deactivate: myActiveSelectionModes[%1]: %2, objects = "). - arg(myActiveSelectionModes.size()).arg(qIntListInfo(myActiveSelectionModes)). - arg(anInfoStr). - toStdString().c_str()); + qDebug(QString("deactivate: myActiveSelectionModes[%1]: %2, objects = ") + .arg(myActiveSelectionModes.size()) + .arg(qIntListInfo(myActiveSelectionModes)) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull() && getDisplayer()->isVisible(theObject)) { AISObjectPtr anObj = getDisplayedAISObject(theObject); - Handle(AIS_InteractiveObject) anAIS = anObj->impl(); + Handle(AIS_InteractiveObject) anAIS = + anObj->impl(); deactivateAIS(anAIS); - // the selection from the previous activation modes should be cleared manually (#26172) + // the selection from the previous activation modes should be cleared + // manually (#26172) #ifndef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY XGUI_Tools::workshop(myWorkshop)->selector()->deselectPresentation(anAIS); #endif @@ -513,24 +559,22 @@ void XGUI_SelectionActivate::deactivate(const ObjectPtr& theObject, const bool t #ifdef BEFORE_TRIHEDRON_PATCH //************************************************************** void deactivateObject(Handle(AIS_InteractiveContext) theContext, - Handle(AIS_InteractiveObject) theObject) -{ + Handle(AIS_InteractiveObject) theObject) { if (!theObject.IsNull()) theContext->Deactivate(theObject); } #endif //************************************************************** -void XGUI_SelectionActivate::activateTrihedron(bool theIsActive) -{ +void XGUI_SelectionActivate::activateTrihedron(bool theIsActive) { myIsTrihedronActive = theIsActive; if (!myIsTrihedronActive) deactivateTrihedron(true); } //************************************************************** -void XGUI_SelectionActivate::deactivateTrihedron(const bool theUpdateViewer) const -{ +void XGUI_SelectionActivate::deactivateTrihedron( + const bool theUpdateViewer) const { Handle(AIS_InteractiveObject) aTrihedron = getTrihedron(); Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) { @@ -538,7 +582,7 @@ void XGUI_SelectionActivate::deactivateTrihedron(const bool theUpdateViewer) con if (!aTrie.IsNull()) aContext->Deactivate(aTrie); - /// #1136 hidden axis are selected in sketch + /// #1136 hidden axis are selected in sketch #ifdef BEFORE_TRIHEDRON_PATCH deactivateObject(aContext, aTrie->XAxis()); deactivateObject(aContext, aTrie->YAxis()); @@ -555,11 +599,11 @@ void XGUI_SelectionActivate::deactivateTrihedron(const bool theUpdateViewer) con } //************************************************************** -void XGUI_SelectionActivate::deactivateTrihedronInSelectionModes() -{ +void XGUI_SelectionActivate::deactivateTrihedronInSelectionModes() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { - Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(getTrihedron()); + Handle(AIS_Trihedron) aTrihedron = + Handle(AIS_Trihedron)::DownCast(getTrihedron()); /// deactivate trihedron in selection modes TColStd_ListOfInteger aTColModes; aContext->ActivatedModes(aTrihedron, aTColModes); @@ -572,32 +616,29 @@ void XGUI_SelectionActivate::deactivateTrihedronInSelectionModes() } //************************************************************** -Handle(AIS_InteractiveContext) XGUI_SelectionActivate::AISContext() const -{ +Handle(AIS_InteractiveContext) XGUI_SelectionActivate::AISContext() const { return myWorkshop->viewer()->AISContext(); } //************************************************************** -XGUI_Displayer* XGUI_SelectionActivate::getDisplayer() const -{ +XGUI_Displayer *XGUI_SelectionActivate::getDisplayer() const { return XGUI_Tools::workshop(myWorkshop)->displayer(); } //************************************************************** -Handle(AIS_InteractiveObject) XGUI_SelectionActivate::getTrihedron() const -{ +Handle(AIS_InteractiveObject) XGUI_SelectionActivate::getTrihedron() const { return myWorkshop->viewer()->trihedron(); } //************************************************************** -AISObjectPtr XGUI_SelectionActivate::getDisplayedAISObject(ObjectPtr theObject) const -{ +AISObjectPtr +XGUI_SelectionActivate::getDisplayedAISObject(ObjectPtr theObject) const { return getDisplayer()->getAISObject(theObject); } //************************************************************** -int XGUI_SelectionActivate::getSelectionMode(int theShapeType) -{ - return (theShapeType > TopAbs_SHAPE) ? theShapeType : - AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType); +int XGUI_SelectionActivate::getSelectionMode(int theShapeType) { + return (theShapeType > TopAbs_SHAPE) + ? theShapeType + : AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType); } diff --git a/src/XGUI/XGUI_SelectionActivate.h b/src/XGUI/XGUI_SelectionActivate.h index b658e2c73..b9badda7c 100644 --- a/src/XGUI/XGUI_SelectionActivate.h +++ b/src/XGUI/XGUI_SelectionActivate.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_ISelectionActivate_H @@ -36,16 +37,16 @@ class ModelAPI_Object; class XGUI_Displayer; /// \ingroup GUI -/// A class which implements activation/deactivate selection modes and using selection filters. -class XGUI_SelectionActivate : public ModuleBase_ISelectionActivate -{ +/// A class which implements activation/deactivate selection modes and using +/// selection filters. +class XGUI_SelectionActivate : public ModuleBase_ISelectionActivate { public: /// Types of the activation place enum SelectionPlace { Workshop, PropertyPanel, FacesPanel }; public: /// Constructor - XGUI_EXPORT XGUI_SelectionActivate(ModuleBase_IWorkshop* theWorkshop); + XGUI_EXPORT XGUI_SelectionActivate(ModuleBase_IWorkshop *theWorkshop); /// Destructor ~XGUI_SelectionActivate() {} @@ -54,17 +55,19 @@ public: /// \return place SelectionPlace activeSelectionPlace() const; - /// Updates active selection modes in the viewer depending on the application state + /// Updates active selection modes in the viewer depending on the application + /// state XGUI_EXPORT virtual void updateSelectionModes(); - /// Updates active selection filters in the viewer depending on the application state + /// Updates active selection filters in the viewer depending on the + /// application state XGUI_EXPORT virtual void updateSelectionFilters(); - /// Activates parameter filters in the workshop, deactivate active out of the container - /// Please find a possibility to use updateSelectionFilters instead of direct call this method. - /// \param theSelectionFilters a filtes - XGUI_EXPORT virtual void activateSelectionFilters - (const SelectMgr_ListOfFilter& theSelectionFilters); + /// Activates parameter filters in the workshop, deactivate active out of the + /// container Please find a possibility to use updateSelectionFilters instead + /// of direct call this method. \param theSelectionFilters a filtes + XGUI_EXPORT virtual void + activateSelectionFilters(const SelectMgr_ListOfFilter &theSelectionFilters); /// Returns list of currently active selection modes /// Selection modes will be returned according to TopAbs_ShapeEnum @@ -78,54 +81,60 @@ public: /// \param theModes - modes on which it has to be activated (can be empty) /// \param theObjList - list of objects which has to be activated. /// \param theUpdateViewer an update viewer flag - XGUI_EXPORT void activateObjects(const QIntList& theModes, const QObjectPtrList& theObjList, + XGUI_EXPORT void activateObjects(const QIntList &theModes, + const QObjectPtrList &theObjList, const bool theUpdateViewer = true); /// Fill container of current selection modes /// \param theModes selection modes - XGUI_EXPORT void setSelectionModes(const QIntList& theModes); + XGUI_EXPORT void setSelectionModes(const QIntList &theModes); /// Activate object in the selection modes /// \param theIO an object /// \param theUpdateViewer an update viewer flag - XGUI_EXPORT void activateOnDisplay(const Handle(AIS_InteractiveObject)& theIO, + XGUI_EXPORT void activateOnDisplay(const Handle(AIS_InteractiveObject) & + theIO, const bool theUpdateViewer); /// Activate interactive object /// \param theIO an interactive object /// \param theMode activation mode /// \param theUpdateViewer update viewer flag - XGUI_EXPORT void activateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode, + XGUI_EXPORT void activateAIS(const Handle(AIS_InteractiveObject) & theIO, + const int theMode, const bool theUpdateViewer) const; - /// Activate interactive object. It is necessary to call ClearOutdatedSelection - /// after deactivation - /// \param theIO an interactive object - /// \param theMode a mode to deactivate. When theMode=-1 then all modes will be deactivated - XGUI_EXPORT void deactivateAIS(const Handle(AIS_InteractiveObject)& theIO, + /// Activate interactive object. It is necessary to call + /// ClearOutdatedSelection after deactivation \param theIO an interactive + /// object \param theMode a mode to deactivate. When theMode=-1 then all modes + /// will be deactivated + XGUI_EXPORT void deactivateAIS(const Handle(AIS_InteractiveObject) & theIO, const int theMode = -1) const; /// Activates the interactive object in the local context. /// \param theIO an interactive object - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - /// \return a flag is object activated or not - XGUI_EXPORT bool activate(const Handle(AIS_InteractiveObject)& theIO, + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly \return a flag is object activated or not + XGUI_EXPORT bool activate(const Handle(AIS_InteractiveObject) & theIO, const bool theUpdateViewer) const; /// Deactivates the given object (not allow selection) /// \param theObject object to deactivate - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - XGUI_EXPORT void deactivate(const std::shared_ptr& theObject, + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly + XGUI_EXPORT void deactivate(const std::shared_ptr &theObject, const bool theUpdateViewer); - /// Returns true if the trihedron should be activated in current selection modes + /// Returns true if the trihedron should be activated in current selection + /// modes bool isTrihedronActive() const { return myIsTrihedronActive; } /// Set trihedron active (used in selection) or non active XGUI_EXPORT void activateTrihedron(bool theIsActive); /// Find a trihedron in a list of displayed presentations and deactivate it. - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly + /// \param theUpdateViewer the parameter whether the viewer should be update + /// immediatelly XGUI_EXPORT void deactivateTrihedron(const bool theUpdateViewer) const; /// Get selection modes of trihedron and deactivate it in it. @@ -135,7 +144,7 @@ protected: /// Returns selection modes of the widget /// \param theWidget model widget /// \param theModes selection modes - void getSelectionModes(ModuleBase_ModelWidget* theWidget, QIntList& theModes); + void getSelectionModes(ModuleBase_ModelWidget *theWidget, QIntList &theModes); /// Returns Trihedron object if it is displayed Handle(AIS_InteractiveObject) getTrihedron() const; @@ -146,12 +155,13 @@ protected: /// Returns displayer /// \return displayer - XGUI_Displayer* getDisplayer() const; + XGUI_Displayer *getDisplayer() const; /// Returns AIS object displayed in 3D viewer for the given model object /// \param theObject source object /// \returns interactive object - AISObjectPtr getDisplayedAISObject(std::shared_ptr theObject) const; + AISObjectPtr + getDisplayedAISObject(std::shared_ptr theObject) const; /// Converts shape type (TopAbs_ShapeEnum) to selection mode /// \param theShapeType a shape type from TopAbs_ShapeEnum @@ -159,7 +169,7 @@ protected: protected: QIntList myActiveSelectionModes; ///< Current activated selection modes - bool myIsTrihedronActive; ///< Flag: use trihedgon for selection or not + bool myIsTrihedronActive; ///< Flag: use trihedgon for selection or not }; #endif diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 80f1d1592..ce7b1715c 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -14,43 +14,44 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_SelectionMgr.h" -#include "XGUI_Workshop.h" +#include "XGUI_Displayer.h" #include "XGUI_ObjectsBrowser.h" +#include "XGUI_OperationMgr.h" #include "XGUI_SalomeConnector.h" -#include "XGUI_ViewerProxy.h" -#include "XGUI_Displayer.h" #include "XGUI_Selection.h" -#include "XGUI_OperationMgr.h" #include "XGUI_SelectionActivate.h" +#include "XGUI_ViewerProxy.h" +#include "XGUI_Workshop.h" #ifndef HAVE_SALOME #include #endif -#include -#include #include #include -#include +#include #include +#include #include -#include #include +#include +#include #include -#include #include +#include #include #include -#include #include +#include #ifdef TINSPECTOR #include @@ -62,64 +63,57 @@ #define OPTIMIZATION_LEVEL 50 - -XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) - : QObject(theParent), - myWorkshop(theParent) -{ +XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop *theParent) + : QObject(theParent), myWorkshop(theParent) { mySelection = new XGUI_Selection(myWorkshop); } -XGUI_SelectionMgr::~XGUI_SelectionMgr() -{ - delete mySelection; -} +XGUI_SelectionMgr::~XGUI_SelectionMgr() { delete mySelection; } //************************************************************** -void XGUI_SelectionMgr::connectViewers() -{ +void XGUI_SelectionMgr::connectViewers() { connect(myWorkshop->objectBrowser(), SIGNAL(selectionChanged()), this, SLOT(onObjectBrowserSelection())); - //Connect to other viewers - connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), this, SLOT(onViewerSelection())); + // Connect to other viewers + connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), this, + SLOT(onViewerSelection())); } //************************************************************** -void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners, - bool isUpdateViewer) -{ +void XGUI_SelectionMgr::setSelectedOwners( + const SelectMgr_IndexedMapOfOwner &theSelectedOwners, bool isUpdateViewer) { Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { - /// previous selection should be cleared, else there will be decomposition of selections: - /// as AddOrRemoveSelected inverts current selection + /// previous selection should be cleared, else there will be decomposition + /// of selections: as AddOrRemoveSelected inverts current selection aContext->ClearSelected(false); - for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { + for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); aContext->AddOrRemoveSelected(anOwner, isUpdateViewer); - #ifdef TINSPECTOR +#ifdef TINSPECTOR if (myWorkshop->displayer()->getCallBack()) myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner); - #endif +#endif } } } //************************************************************** -void XGUI_SelectionMgr::onObjectBrowserSelection() -{ +void XGUI_SelectionMgr::onObjectBrowserSelection() { myLastSelectionPlace = ModuleBase_ISelection::Browser; QList aSelectedPrs = - myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + myWorkshop->selector()->selection()->getSelected( + ModuleBase_ISelection::Browser); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); if (!myWorkshop->operationMgr()->hasOperation()) { ObjectPtr aObject; FeaturePtr aFeature; // Select all results of a selected feature in viewer - foreach(ModuleBase_ViewerPrsPtr aPrs, aSelectedPrs) { + foreach (ModuleBase_ViewerPrsPtr aPrs, aSelectedPrs) { aObject = aPrs->object(); if (aObject.get()) { aFeature = std::dynamic_pointer_cast(aObject); @@ -127,9 +121,9 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() std::list allRes; ModelAPI_Tools::allResults(aFeature, allRes); std::list::iterator aRes; - for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) { + for (aRes = allRes.begin(); aRes != allRes.end(); aRes++) { aSelectedPrs.append(std::shared_ptr( - new ModuleBase_ViewerPrs(*aRes, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(*aRes, GeomShapePtr(), NULL))); } } } @@ -141,14 +135,14 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() } //************************************************************** -void XGUI_SelectionMgr::onViewerSelection() -{ +void XGUI_SelectionMgr::onViewerSelection() { myLastSelectionPlace = ModuleBase_ISelection::Viewer; QList aValues; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { aValues = selection()->getSelected(ModuleBase_ISelection::Viewer); - // Update is necessary for OCCT 7.4.0: when it is clears selection it doesn't updates viewer + // Update is necessary for OCCT 7.4.0: when it is clears selection it + // doesn't updates viewer #if OCC_VERSION_HEX == 0x070400 if (aValues.isEmpty()) aContext->UpdateCurrentViewer(); @@ -162,19 +156,21 @@ void XGUI_SelectionMgr::onViewerSelection() } //************************************************************** -void XGUI_SelectionMgr::deselectPresentation(const Handle(AIS_InteractiveObject) theObject) -{ +void XGUI_SelectionMgr::deselectPresentation(const Handle(AIS_InteractiveObject) + theObject) { NCollection_List aResultOwners; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + for (aContext->InitSelected(); aContext->MoreSelected(); + aContext->NextSelected()) { Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner(); if (anOwner.IsNull()) // TODO: check why it is possible continue; if (anOwner->Selectable() == theObject && anOwner->IsSelected()) aResultOwners.Append(anOwner); } - NCollection_List::Iterator anOwnersIt (aResultOwners); + NCollection_List::Iterator anOwnersIt( + aResultOwners); Handle(SelectMgr_EntityOwner) anOwner; for (; anOwnersIt.More(); anOwnersIt.Next()) { anOwner = anOwnersIt.Value(); @@ -184,35 +180,34 @@ void XGUI_SelectionMgr::deselectPresentation(const Handle(AIS_InteractiveObject) } //************************************************************** -void XGUI_SelectionMgr::updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace) -{ +void XGUI_SelectionMgr::updateSelectionBy( + const ModuleBase_ISelection::SelectionPlace &thePlace) { QList aSelectedPrs = - myWorkshop->selector()->selection()->getSelected(thePlace); + myWorkshop->selector()->selection()->getSelected(thePlace); if (thePlace == ModuleBase_ISelection::Browser) { - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); aDisplayer->setSelected(aSelectedPrs); } - } //************************************************************** -void XGUI_SelectionMgr::clearSelection() -{ +void XGUI_SelectionMgr::clearSelection() { QObjectPtrList aFeatures; myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); QList aSelectedPrs = - myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); + myWorkshop->selector()->selection()->getSelected( + ModuleBase_ISelection::Browser); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); aDisplayer->setSelected(aSelectedPrs); emit selectionChanged(); } //************************************************************** -void XGUI_SelectionMgr::setSelected(const QList& theValues) -{ +void XGUI_SelectionMgr::setSelected( + const QList &theValues) { // update selection in Viewer - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); aDisplayer->setSelected(theValues); // update selection in Object Browser @@ -223,9 +218,8 @@ void XGUI_SelectionMgr::setSelected(const QList& theVal //************************************************************** void XGUI_SelectionMgr::convertToObjectBrowserSelection( - const QList& theValues, - QObjectPtrList& theObjects) -{ + const QList &theValues, + QObjectPtrList &theObjects) { theObjects.clear(); ResultPtr aResult; @@ -239,7 +233,7 @@ void XGUI_SelectionMgr::convertToObjectBrowserSelection( GeomShapePtr aShape; TopoDS_Shape aTShape; - foreach(ModuleBase_ViewerPrsPtr aPrs, theValues) { + foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) { if (aPrs->object().get()) { if (!theObjects.contains(aPrs->object())) theObjects.append(aPrs->object()); @@ -253,14 +247,13 @@ void XGUI_SelectionMgr::convertToObjectBrowserSelection( aFeature = anActiveDocument->producedByFeature(aResult, aShape); if (aFeature.get()) { QList aResList = findAllShapes(aResult); - foreach(TopoDS_Shape aResShape, aResList) { + foreach (TopoDS_Shape aResShape, aResList) { if (!aShapeMap.Contains(aResShape)) aShapeMap.Add(aResShape); } } } - } - else { + } else { aFeature = anActiveDocument->producedByFeature(aResult, aShape); } if (aFeature.get() && (!theObjects.contains(aFeature))) @@ -271,19 +264,19 @@ void XGUI_SelectionMgr::convertToObjectBrowserSelection( } } -std::list XGUI_SelectionMgr::getSelectedFeatures() -{ +std::list XGUI_SelectionMgr::getSelectedFeatures() { std::list aFeatures; QObjectPtrList aObjects = selection()->selectedObjects(); if (aObjects.isEmpty()) return aFeatures; bool isPart = false; - foreach(ObjectPtr aObj, aObjects) { + foreach (ObjectPtr aObj, aObjects) { FeaturePtr aFeature = std::dynamic_pointer_cast(aObj); if (aFeature.get()) { ResultPtr aRes = aFeature->firstResult(); - isPart = (aRes.get() && (aRes->groupName() == ModelAPI_ResultPart::group())); + isPart = + (aRes.get() && (aRes->groupName() == ModelAPI_ResultPart::group())); if (!isPart) aFeatures.push_back(aFeature); } @@ -291,13 +284,13 @@ std::list XGUI_SelectionMgr::getSelectedFeatures() return aFeatures; } -QList XGUI_SelectionMgr::findAllShapes(const ResultPtr& theResult) const -{ +QList +XGUI_SelectionMgr::findAllShapes(const ResultPtr &theResult) const { QIntList aModes = myWorkshop->selectionActivate()->activeSelectionModes(); GeomShapePtr aResShape = theResult->shape(); TopoDS_Shape aShape = aResShape->impl(); QList aResult; - foreach(int aShapeType, aModes) { + foreach (int aShapeType, aModes) { if (aShapeType < TopAbs_SHAPE) { TopExp_Explorer aExp(aShape, (TopAbs_ShapeEnum)aShapeType); for (; aExp.More(); aExp.Next()) { @@ -306,4 +299,4 @@ QList XGUI_SelectionMgr::findAllShapes(const ResultPtr& theResult) } } return aResult; -} \ No newline at end of file +} diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index 6765efe05..2467875c3 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -14,24 +14,25 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_SelectionMgr_H #define XGUI_SelectionMgr_H #include "XGUI.h" +#include #include #include -#include -#include #include +#include #include #include #include -#include #include +#include class XGUI_Workshop; class XGUI_ObjectsBrowser; @@ -39,23 +40,19 @@ class XGUI_Selection; /**\class XGUI_SelectionMgr * \ingroup GUI - * \brief Selection manager. Provides selection event on selection in + * \brief Selection manager. Provides selection event on selection in * Object Browser and Viewer */ -class XGUI_EXPORT XGUI_SelectionMgr : public QObject -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent workshop - XGUI_SelectionMgr(XGUI_Workshop* theParent); +class XGUI_EXPORT XGUI_SelectionMgr : public QObject { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent workshop + XGUI_SelectionMgr(XGUI_Workshop *theParent); virtual ~XGUI_SelectionMgr(); /// Returns current selection - XGUI_Selection* selection() const - { - return mySelection; - } + XGUI_Selection *selection() const { return mySelection; } ModuleBase_ISelection::SelectionPlace placeOfSelection() const { return myLastSelectionPlace; @@ -66,8 +63,9 @@ Q_OBJECT //! Selects the owners in the context. //! \param theSelectedOwners a container of owners - /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - void setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners, + /// \param isUpdateViewer the parameter whether the viewer should be update + /// immediatelly + void setSelectedOwners(const SelectMgr_IndexedMapOfOwner &theSelectedOwners, bool isUpdateViewer); //! Clears selection in Viewer and object Browser @@ -76,45 +74,48 @@ Q_OBJECT //! Sets values selected in both, ObjectBrowser and V3d viewer //! Selection is not synchronized between these controls. //! \param theValues a container of values to be selected. - void setSelected(const QList >& theValues); + void + setSelected(const QList> &theValues); - //! Find all selected owners of the object and remove the owners from selection - //! \param theObject an interactive object + //! Find all selected owners of the object and remove the owners from + //! selection \param theObject an interactive object void deselectPresentation(const Handle(AIS_InteractiveObject) theObject); /// Updates selection, which are depend on the selection in the given place /// \param thePlace a widget where selection has happened. - void updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace); + void updateSelectionBy(const ModuleBase_ISelection::SelectionPlace &thePlace); - /// Returns list of selected features (ignores other selected objects and parts) + /// Returns list of selected features (ignores other selected objects and + /// parts) std::list getSelectedFeatures(); signals: //! Emited when selection in a one of viewers was changed void selectionChanged(); - public slots: - /// Reaction on selectio0n in Object browser +public slots: + /// Reaction on selectio0n in Object browser void onObjectBrowserSelection(); - /// Reaction on selectio0n in Viewer + /// Reaction on selectio0n in Viewer void onViewerSelection(); private: - /// Interates through the values to prepare container of objects that may be selected in OB - /// \param theValues selection information - /// \param theObjecs an output container + /// Interates through the values to prepare container of objects that may be + /// selected in OB \param theValues selection information \param theObjecs an + /// output container void convertToObjectBrowserSelection( - const QList >& theValues, QObjectPtrList& theObjects); + const QList> &theValues, + QObjectPtrList &theObjects); - QList findAllShapes(const ResultPtr& theResult) const; + QList findAllShapes(const ResultPtr &theResult) const; private: - /// Reference to workshop - XGUI_Workshop* myWorkshop; + /// Reference to workshop + XGUI_Workshop *myWorkshop; /// Current selection object - XGUI_Selection* mySelection; + XGUI_Selection *mySelection; ModuleBase_ISelection::SelectionPlace myLastSelectionPlace; }; diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index ea54214ec..186a86788 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_Tools.h" @@ -25,19 +26,19 @@ #include "ModuleBase_IWorkshop.h" #include "ModuleBase_Tools.h" -#include +#include +#include +#include +#include #include #include +#include +#include #include -#include -#include -#include #include -#include +#include #include -#include -#include -#include +#include #include #include @@ -52,22 +53,21 @@ #include #ifndef WIN32 -# include -# include -# include -# define _separator_ '/' +#include +#include +#include +#define _separator_ '/' #else #include #define F_OK 0 #define access _access -# include -# define _separator_ '\\' +#include +#define _separator_ '\\' #endif namespace XGUI_Tools { //****************************************************************** -QString dir(const QString& path, bool isAbs) -{ +QString dir(const QString &path, bool isAbs) { QDir aDir = QFileInfo(path).dir(); QString dirPath = isAbs ? aDir.absolutePath() : aDir.path(); if (dirPath == QString(".")) @@ -76,11 +76,10 @@ QString dir(const QString& path, bool isAbs) } //****************************************************************** -QString file(const QString& path, bool withExt) -{ +QString file(const QString &path, bool withExt) { QString fPath = path; while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' || - fPath[fPath.length() - 1] == '/')) + fPath[fPath.length() - 1] == '/')) fPath.remove(fPath.length() - 1, 1); if (withExt) @@ -90,18 +89,17 @@ QString file(const QString& path, bool withExt) } //****************************************************************** -QString addSlash(const QString& path) -{ +QString addSlash(const QString &path) { QString res = path; - if (!res.isEmpty() && res.at(res.length() - 1) != QChar('/') - && res.at(res.length() - 1) != QChar('\\')) + if (!res.isEmpty() && res.at(res.length() - 1) != QChar('/') && + res.at(res.length() - 1) != QChar('\\')) res += QDir::separator(); return res; } //****************************************************************** -QString unionOfObjectNames(const QObjectPtrList& theObjects, const QString& theSeparator) -{ +QString unionOfObjectNames(const QObjectPtrList &theObjects, + const QString &theSeparator) { QStringList aObjectNames; foreach (ObjectPtr aObj, theObjects) { if (aObj->data()->isValid()) @@ -115,14 +113,12 @@ QString unionOfObjectNames(const QObjectPtrList& theObjects, const QString& theS } //****************************************************************** -bool isModelObject(FeaturePtr theFeature) -{ +bool isModelObject(FeaturePtr theFeature) { return theFeature && !theFeature->data(); } //****************************************************************** -std::string featureInfo(FeaturePtr theFeature) -{ +std::string featureInfo(FeaturePtr theFeature) { std::ostringstream aStream; if (theFeature) aStream << theFeature.get() << " " << theFeature->getKind(); @@ -140,20 +136,22 @@ std::string featureInfo(FeaturePtr theFeature) } }*/ - //****************************************************************** -bool canRemoveOrRename(QWidget* theParent, const std::set& theFeatures) -{ +bool canRemoveOrRename(QWidget *theParent, + const std::set &theFeatures) { bool aResult = true; std::wstring aNotActivatedNames; if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) { - bool aFoundPartSetObject = ModuleBase_Tools::hasModuleDocumentFeature(theFeatures); + bool aFoundPartSetObject = + ModuleBase_Tools::hasModuleDocumentFeature(theFeatures); if (aFoundPartSetObject) { - const char* aKeyStr = "Selected objects can be used in Part documents which are not loaded: " + const char *aKeyStr = "Selected objects can be used in Part documents " + "which are not loaded: " "%1. Whould you like to continue?"; - QMessageBox::StandardButton aRes = QMessageBox::warning(theParent, QObject::tr("Warning"), - QObject::tr(aKeyStr).arg(QString::fromStdWString(aNotActivatedNames)), - QMessageBox::No | QMessageBox::Yes, QMessageBox::No); + QMessageBox::StandardButton aRes = QMessageBox::warning( + theParent, QObject::tr("Warning"), + QObject::tr(aKeyStr).arg(QString::fromStdWString(aNotActivatedNames)), + QMessageBox::No | QMessageBox::Yes, QMessageBox::No); aResult = aRes == QMessageBox::Yes; } } @@ -161,8 +159,7 @@ bool canRemoveOrRename(QWidget* theParent, const std::set& theFeatur } //****************************************************************** -bool isAscii(const QString& theStr) -{ +bool isAscii(const QString &theStr) { char aCh; for (int i = 0; i < theStr.size(); i++) { aCh = theStr[i].toLatin1(); @@ -183,8 +180,7 @@ bool isAscii(const QString& theStr) } //****************************************************************** -bool isValidName(const QString& theName) -{ +bool isValidName(const QString &theName) { QChar aChar; for (int i = 0; i < theName.size(); i++) { aChar = theName[i]; @@ -197,8 +193,7 @@ bool isValidName(const QString& theName) } //****************************************************************** -bool canRename(const ObjectPtr& theObject, const QString& theName) -{ +bool canRename(const ObjectPtr &theObject, const QString &theName) { std::string aType = theObject->groupName(); if (aType == ModelAPI_ResultParameter::group()) { // For parameters names only ASCII symbols have to be used @@ -207,28 +202,28 @@ bool canRename(const ObjectPtr& theObject, const QString& theName) double aValue; ResultParameterPtr aParam; - if (ModelAPI_Tools::findVariable(theObject->document(), - FeaturePtr(), theName.toStdWString(), aValue, aParam)) { - const char* aKeyStr = "Selected parameter can not be renamed to: %1. " - "There is a parameter with the same name. Its value is: %2."; + if (ModelAPI_Tools::findVariable(theObject->document(), FeaturePtr(), + theName.toStdWString(), aValue, aParam)) { + const char *aKeyStr = + "Selected parameter can not be renamed to: %1. " + "There is a parameter with the same name. Its value is: %2."; QString aErrMsg(QObject::tr(aKeyStr).arg(theName).arg(aValue)); // We can not use here a dialog box for message - // it will crash editing process in ObjectBrowser Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send(); return false; } - } - else { + } else { if (!isValidName(theName)) return false; DocumentPtr aDoc = theObject->document(); - ObjectPtr aObj = - aDoc->objectByName(aType, theName.toStdWString()); + ObjectPtr aObj = aDoc->objectByName(aType, theName.toStdWString()); if (aObj.get() && theObject != aObj) { - QString aErrMsg(QObject::tr("Name %2 already exists in %1."). - arg(aType.c_str()).arg(theName)); + QString aErrMsg(QObject::tr("Name %2 already exists in %1.") + .arg(aType.c_str()) + .arg(theName)); // We can not use here a dialog box for message - // it will crash editing process in ObjectBrowser Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send(); @@ -241,16 +236,14 @@ bool canRename(const ObjectPtr& theObject, const QString& theName) //************************************************************** -XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop) -{ - XGUI_ModuleConnector* aConnector = dynamic_cast(theWorkshop); +XGUI_Workshop *workshop(ModuleBase_IWorkshop *theWorkshop) { + XGUI_ModuleConnector *aConnector = + dynamic_cast(theWorkshop); return aConnector ? aConnector->workshop() : 0; } - //******************************************************************** -QString generateName(const ModuleBase_ViewerPrsPtr& thePrs) -{ +QString generateName(const ModuleBase_ViewerPrsPtr &thePrs) { if (!thePrs.get() || !thePrs->object().get()) return "Undefined"; @@ -308,17 +301,16 @@ QString generateName(const ModuleBase_ViewerPrsPtr& thePrs) return aName; } -std::wstring strToWStr(const std::string& theStr) { +std::wstring strToWStr(const std::string &theStr) { size_t aLen = theStr.size(); std::wstring aResult(aLen, L'#'); mbstowcs(&aResult[0], theStr.c_str(), aLen); return aResult; } -std::string getTmpDirByPath( const std::string& theTmpPath) -{ +std::string getTmpDirByPath(const std::string &theTmpPath) { std::string aTmpDir = theTmpPath; - if (aTmpDir == "" || access(aTmpDir.c_str() , F_OK) != 0) { + if (aTmpDir == "" || access(aTmpDir.c_str(), F_OK) != 0) { #ifdef WIN32 char *Tmp_dir = getenv("TEMP"); if (Tmp_dir == NULL) { @@ -327,8 +319,7 @@ std::string getTmpDirByPath( const std::string& theTmpPath) aTmpDir = "C:\\"; else aTmpDir = Tmp_dir; - } - else + } else aTmpDir = Tmp_dir; #else aTmpDir = "/tmp/"; @@ -338,22 +329,22 @@ std::string getTmpDirByPath( const std::string& theTmpPath) if (aTmpDir.back() != _separator_) aTmpDir += _separator_; - srand((unsigned int)time( NULL )); - //Get a random number to present a name of a sub directory - int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); + srand((unsigned int)time(NULL)); + // Get a random number to present a name of a sub directory + int aRND = 999 + (int)(100000.0 * rand() / (RAND_MAX + 1.0)); char buffer[127]; sprintf(buffer, "%d", aRND); std::string aSubDir(buffer); if (aSubDir.size() <= 1) aSubDir = "123049876"; - aTmpDir += aSubDir; //Get RND sub directory + aTmpDir += aSubDir; // Get RND sub directory std::string aDir = aTmpDir; - for(aRND = 0; access(aDir.c_str() , F_OK) == 0; aRND++) { - sprintf( buffer, "%d", aRND ); - aDir = aTmpDir + buffer; //Build a unique directory name + for (aRND = 0; access(aDir.c_str(), F_OK) == 0; aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir + buffer; // Build a unique directory name } if (aDir.back() != _separator_) aDir += _separator_; @@ -361,28 +352,26 @@ std::string getTmpDirByPath( const std::string& theTmpPath) #ifdef WIN32 CreateDirectory(strToWStr(aDir).c_str(), NULL); #else - mkdir( aDir.c_str(), 0x1ff ); + mkdir(aDir.c_str(), 0x1ff); #endif return aDir; } -std::string getTmpDirByEnv( const char* thePathEnv) -{ - char* aVal = thePathEnv[0] == 0 ? 0 : getenv(thePathEnv); +std::string getTmpDirByEnv(const char *thePathEnv) { + char *aVal = thePathEnv[0] == 0 ? 0 : getenv(thePathEnv); std::string dir = aVal ? aVal : ""; return getTmpDirByPath(dir).c_str(); } -void removeTemporaryFiles(const std::string& theDirectory, - const std::list& theFiles) -{ +void removeTemporaryFiles(const std::string &theDirectory, + const std::list &theFiles) { std::string aDirName = theDirectory; std::list::const_iterator aFilesIter = theFiles.cbegin(); - for(; aFilesIter != theFiles.cend(); aFilesIter++) { - const std::string& aFile = *aFilesIter; - if(access(aFile.c_str() , F_OK) != 0) + for (; aFilesIter != theFiles.cend(); aFilesIter++) { + const std::string &aFile = *aFilesIter; + if (access(aFile.c_str(), F_OK) != 0) continue; #ifdef WIN32 @@ -392,7 +381,7 @@ void removeTemporaryFiles(const std::string& theDirectory, #endif } - if(access(aDirName.c_str() , F_OK) == 0) { + if (access(aDirName.c_str(), F_OK) == 0) { #ifdef WIN32 RemoveDirectory(strToWStr(aDirName).c_str()); #else @@ -401,4 +390,4 @@ void removeTemporaryFiles(const std::string& theDirectory, } } -} +} // namespace XGUI_Tools diff --git a/src/XGUI/XGUI_Tools.h b/src/XGUI/XGUI_Tools.h index ffe004e51..f573cc929 100644 --- a/src/XGUI/XGUI_Tools.h +++ b/src/XGUI/XGUI_Tools.h @@ -14,15 +14,16 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_Tools_H #define XGUI_Tools_H #include "XGUI.h" -#include #include +#include #include #include @@ -48,10 +49,10 @@ namespace XGUI_Tools { current directory), null string is returned. \param path file path - \param isAbs if true (default) \a path parameter is treated as absolute file path - \return directory part of the file path + \param isAbs if true (default) \a path parameter is treated as absolute file + path \return directory part of the file path */ -QString XGUI_EXPORT dir(const QString& path, bool isAbs = true); +QString XGUI_EXPORT dir(const QString &path, bool isAbs = true); /*! \brief Return file name part of the file path. @@ -62,7 +63,7 @@ QString XGUI_EXPORT dir(const QString& path, bool isAbs = true); is returned \return file name part of the file path */ -QString XGUI_EXPORT file(const QString& path, bool withExt = true); +QString XGUI_EXPORT file(const QString &path, bool withExt = true); /*! \brief Add a slash (platform-specific) to the end of \a path @@ -70,7 +71,7 @@ QString XGUI_EXPORT file(const QString& path, bool withExt = true); \param path directory path \return modified path (with slash added to the end) */ -QString XGUI_EXPORT addSlash(const QString& path); +QString XGUI_EXPORT addSlash(const QString &path); // The model concerning tools @@ -78,7 +79,8 @@ QString XGUI_EXPORT addSlash(const QString& path); \param theObjects a list of objects \param theSeparator a separator */ -QString unionOfObjectNames(const QObjectPtrList& theObjects, const QString& theSeparator); +QString unionOfObjectNames(const QObjectPtrList &theObjects, + const QString &theSeparator); /*! Returns true if the feature is a model object @@ -100,41 +102,42 @@ std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature); \param theFeatures a list of checked features \return a boolean value */ -bool XGUI_EXPORT canRemoveOrRename(QWidget* theParent, const std::set& theFeatures); +bool XGUI_EXPORT canRemoveOrRename(QWidget *theParent, + const std::set &theFeatures); -/*! +/*! Check possibility to rename object \param theObject an object to rename \param theName a name */ -bool canRename(const ObjectPtr& theObject, const QString& theName); +bool canRename(const ObjectPtr &theObject, const QString &theName); /*! Checks that the given string contains only ASCII symbols \param theStr a string to check */ -bool isAscii(const QString& theStr); +bool isAscii(const QString &theStr); /*! Returns converted workshop \param theWorkshop an interface workshop \return XGUI workshop instance */ -XGUI_EXPORT XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop); - +XGUI_EXPORT XGUI_Workshop *workshop(ModuleBase_IWorkshop *theWorkshop); /// Generates a presentation name in form: /_ /// \param thePrs a presentation /// \return string value -XGUI_EXPORT QString generateName(const std::shared_ptr& thePrs); +XGUI_EXPORT QString +generateName(const std::shared_ptr &thePrs); -/// Creates and returns the temporary directory (with random name) using the environment variable -/// path to location of such directories, -std::string getTmpDirByEnv( const char* thePathEnv); +/// Creates and returns the temporary directory (with random name) using the +/// environment variable path to location of such directories, +std::string getTmpDirByEnv(const char *thePathEnv); /// Removes files and directory where they are located -void removeTemporaryFiles(const std::string& theDirectory, - const std::list& theFiles); -}; +void removeTemporaryFiles(const std::string &theDirectory, + const std::list &theFiles); +}; // namespace XGUI_Tools #endif diff --git a/src/XGUI/XGUI_TransparencyWidget.cpp b/src/XGUI/XGUI_TransparencyWidget.cpp index e9a03ea6d..7eb24295e 100644 --- a/src/XGUI/XGUI_TransparencyWidget.cpp +++ b/src/XGUI/XGUI_TransparencyWidget.cpp @@ -14,27 +14,27 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_TransparencyWidget.h" #include #include -#include #include #include #include +#include -XGUI_TransparencyWidget::XGUI_TransparencyWidget(QWidget* theParent, - const QString& /*theLabelText*/) - : QWidget(theParent) -{ - QVBoxLayout* aLay = new QVBoxLayout(this); +XGUI_TransparencyWidget::XGUI_TransparencyWidget( + QWidget *theParent, const QString & /*theLabelText*/) + : QWidget(theParent) { + QVBoxLayout *aLay = new QVBoxLayout(this); aLay->setContentsMargins(0, 0, 0, 0); - QWidget* aInfoWgt = new QWidget(this); - QHBoxLayout* aInfoLay = new QHBoxLayout(aInfoWgt); + QWidget *aInfoWgt = new QWidget(this); + QHBoxLayout *aInfoLay = new QHBoxLayout(aInfoWgt); aInfoLay->setContentsMargins(0, 0, 0, 0); aInfoLay->addWidget(new QLabel(tr("Opaque"))); @@ -50,11 +50,11 @@ XGUI_TransparencyWidget::XGUI_TransparencyWidget(QWidget* theParent, mySliderValue->setRange(0, 100); aLay->addWidget(mySliderValue); - connect(mySliderValue, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int))); + connect(mySliderValue, SIGNAL(valueChanged(int)), this, + SLOT(onSliderValueChanged(int))); } -void XGUI_TransparencyWidget::setValue(double theValue) -{ +void XGUI_TransparencyWidget::setValue(double theValue) { bool isSliderBlocked = mySliderValue->blockSignals(true); int aVal = theValue * 100; mySliderValue->setValue(aVal); @@ -62,13 +62,11 @@ void XGUI_TransparencyWidget::setValue(double theValue) mySliderValue->blockSignals(isSliderBlocked); } -double XGUI_TransparencyWidget::getValue() const -{ +double XGUI_TransparencyWidget::getValue() const { return mySliderValue->value() / 100.; } -void XGUI_TransparencyWidget::onSliderValueChanged(int theValue) -{ +void XGUI_TransparencyWidget::onSliderValueChanged(int theValue) { myValLbl->setText(QString("%1%").arg(theValue)); emit transparencyValueChanged(); } diff --git a/src/XGUI/XGUI_TransparencyWidget.h b/src/XGUI/XGUI_TransparencyWidget.h index e666353ab..f4951a8a7 100644 --- a/src/XGUI/XGUI_TransparencyWidget.h +++ b/src/XGUI/XGUI_TransparencyWidget.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_TransparencyWidget_H @@ -28,20 +29,20 @@ class QSlider; class QLabel; /** -* \ingroup GUI -* A class of a widget to chose transparency. range of values is [0, 1], -* where 0 - there is no transparency, 1 - the object is fully transparent. -*/ -class XGUI_TransparencyWidget : public QWidget -{ + * \ingroup GUI + * A class of a widget to chose transparency. range of values is [0, 1], + * where 0 - there is no transparency, 1 - the object is fully transparent. + */ +class XGUI_TransparencyWidget : public QWidget { Q_OBJECT public: /// Constructor /// \param theParent a parent widget for the dialog - /// \param theLabelText if not empty, the information label will be shown in the widget - XGUI_EXPORT XGUI_TransparencyWidget(QWidget* theParent, - const QString& theLabelText = QString()); - XGUI_EXPORT virtual ~XGUI_TransparencyWidget() {}; + /// \param theLabelText if not empty, the information label will be shown in + /// the widget + XGUI_EXPORT XGUI_TransparencyWidget(QWidget *theParent, + const QString &theLabelText = QString()); + XGUI_EXPORT virtual ~XGUI_TransparencyWidget(){}; /// Initializes the dialog with the given value. /// \param theValue transparency value @@ -60,8 +61,8 @@ private slots: void onSliderValueChanged(int theValue); private: - QSlider* mySliderValue; /// slider to select value - QLabel* myValLbl; + QSlider *mySliderValue; /// slider to select value + QLabel *myValLbl; }; #endif diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index d108ebe02..69294afb9 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -14,57 +14,54 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_ViewerProxy.h" -#include "XGUI_Workshop.h" -#include "XGUI_SalomeConnector.h" #include "XGUI_Displayer.h" +#include "XGUI_SalomeConnector.h" +#include "XGUI_Workshop.h" #ifndef HAVE_SALOME - #include - #include - #include - #include +#include +#include +#include +#include #endif -#include -#include #include #include +#include +#include #include -#include #include +#include #include #include #include - #define HIGHLIGHT_COLOR Quantity_NOC_YELLOW -XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent) - : ModuleBase_IViewer(theParent), - myWorkshop(theParent) -{ -} +XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop *theParent) + : ModuleBase_IViewer(theParent), myWorkshop(theParent) {} -void XGUI_ViewerProxy::connectViewProxy() -{ +void XGUI_ViewerProxy::connectViewProxy() { #ifdef HAVE_SALOME - connect(myWorkshop->salomeConnector()->viewer(), SIGNAL(trihedronVisibilityChanged(bool)), - SIGNAL(trihedronVisibilityChanged(bool))); + connect(myWorkshop->salomeConnector()->viewer(), + SIGNAL(trihedronVisibilityChanged(bool)), + SIGNAL(trihedronVisibilityChanged(bool))); #else - connect(myWorkshop->mainWindow()->viewer(), SIGNAL(trihedronVisibilityChanged(bool)), - SIGNAL(trihedronVisibilityChanged(bool))); + connect(myWorkshop->mainWindow()->viewer(), + SIGNAL(trihedronVisibilityChanged(bool)), + SIGNAL(trihedronVisibilityChanged(bool))); #endif } -Handle(AIS_InteractiveContext) XGUI_ViewerProxy::AISContext() const -{ +Handle(AIS_InteractiveContext) XGUI_ViewerProxy::AISContext() const { Handle(AIS_InteractiveContext) aContext; #ifdef HAVE_SALOME aContext = myWorkshop->salomeConnector()->viewer()->AISContext(); @@ -74,8 +71,7 @@ Handle(AIS_InteractiveContext) XGUI_ViewerProxy::AISContext() const return aContext; } -Handle(AIS_Trihedron) XGUI_ViewerProxy::trihedron() const -{ +Handle(AIS_Trihedron) XGUI_ViewerProxy::trihedron() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->trihedron(); #else @@ -83,8 +79,7 @@ Handle(AIS_Trihedron) XGUI_ViewerProxy::trihedron() const #endif } -Handle(V3d_Viewer) XGUI_ViewerProxy::v3dViewer() const -{ +Handle(V3d_Viewer) XGUI_ViewerProxy::v3dViewer() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->v3dViewer(); #else @@ -92,239 +87,236 @@ Handle(V3d_Viewer) XGUI_ViewerProxy::v3dViewer() const #endif } -Handle(V3d_View) XGUI_ViewerProxy::activeView() const -{ +Handle(V3d_View) XGUI_ViewerProxy::activeView() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->activeView(); #else - AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); - return (aViewer->activeViewWindow()) ? - aViewer->activeViewWindow()->viewPortApp()->getView() : - Handle(V3d_View)(); + AppElements_Viewer *aViewer = myWorkshop->mainWindow()->viewer(); + return (aViewer->activeViewWindow()) + ? aViewer->activeViewWindow()->viewPortApp()->getView() + : Handle(V3d_View)(); #endif } -QWidget* XGUI_ViewerProxy::activeViewPort() const -{ +QWidget *XGUI_ViewerProxy::activeViewPort() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->activeViewPort(); #else - AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); - return (aViewer->activeViewWindow()) ? - aViewer->activeViewWindow()->viewPortApp(): 0; + AppElements_Viewer *aViewer = myWorkshop->mainWindow()->viewer(); + return (aViewer->activeViewWindow()) + ? aViewer->activeViewWindow()->viewPortApp() + : 0; #endif } -void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ, double theTwist) -{ +void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ, + double theTwist) { Handle(V3d_View) aView3d = activeView(); if (!aView3d.IsNull()) { aView3d->SetProj(theX, theY, theZ); - aView3d->SetTwist( theTwist ); + aView3d->SetTwist(theTwist); aView3d->FitAll(0.01, false); - //aView3d->SetZSize(0.); + // aView3d->SetZSize(0.); if (aView3d->Depth() < 0.1) aView3d->DepthFitAll(); } } -void XGUI_ViewerProxy::fitAll() -{ +void XGUI_ViewerProxy::fitAll() { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->fitAll(); #else - AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); + AppElements_Viewer *aViewer = myWorkshop->mainWindow()->viewer(); if (aViewer->activeViewWindow()) aViewer->activeViewWindow()->viewPortApp()->fitAll(); #endif } -void XGUI_ViewerProxy::eraseAll() -{ +void XGUI_ViewerProxy::eraseAll() { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->eraseAll(); #else #endif } -void XGUI_ViewerProxy::connectToViewer() -{ +void XGUI_ViewerProxy::connectToViewer() { #ifdef HAVE_SALOME - ModuleBase_IViewer* aViewer = myWorkshop->salomeConnector()->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->salomeConnector()->viewer(); connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed())); - connect(aViewer, SIGNAL(tryCloseView(ModuleBase_IViewWindow*)), - this, SIGNAL(tryCloseView(ModuleBase_IViewWindow*))); + connect(aViewer, SIGNAL(tryCloseView(ModuleBase_IViewWindow *)), this, + SIGNAL(tryCloseView(ModuleBase_IViewWindow *))); - connect(aViewer, SIGNAL(deleteView(ModuleBase_IViewWindow*)), - this, SIGNAL(deleteView(ModuleBase_IViewWindow*))); + connect(aViewer, SIGNAL(deleteView(ModuleBase_IViewWindow *)), this, + SIGNAL(deleteView(ModuleBase_IViewWindow *))); - connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)), - this, SLOT(onViewCreated(ModuleBase_IViewWindow*))); + connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow *)), this, + SLOT(onViewCreated(ModuleBase_IViewWindow *))); - connect(aViewer, SIGNAL(activated(ModuleBase_IViewWindow*)), - this, SIGNAL(activated(ModuleBase_IViewWindow*))); + connect(aViewer, SIGNAL(activated(ModuleBase_IViewWindow *)), this, + SIGNAL(activated(ModuleBase_IViewWindow *))); - connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow *, QMouseEvent *)), + this, SIGNAL(mousePress(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, + SIGNAL(mouseRelease(ModuleBase_IViewWindow *, QMouseEvent *)), this, + SIGNAL(mouseRelease(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)), this, - SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, + SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *)), + this, + SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), - this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow *, QMouseEvent *)), + this, SLOT(onMouseMove(ModuleBase_IViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(keyPress(ModuleBase_IViewWindow*, QKeyEvent*)), - this, SLOT(onKeyPress(ModuleBase_IViewWindow*, QKeyEvent*))); + connect(aViewer, SIGNAL(keyPress(ModuleBase_IViewWindow *, QKeyEvent *)), + this, SLOT(onKeyPress(ModuleBase_IViewWindow *, QKeyEvent *))); - connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)), - this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*))); + connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow *, QKeyEvent *)), + this, SLOT(onKeyRelease(ModuleBase_IViewWindow *, QKeyEvent *))); - connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); + connect(aViewer, SIGNAL(selectionChanged()), this, + SIGNAL(selectionChanged())); - connect(aViewer, SIGNAL(viewTransformed(int)), this, SIGNAL(viewTransformed(int))); + connect(aViewer, SIGNAL(viewTransformed(int)), this, + SIGNAL(viewTransformed(int))); - connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, - SIGNAL(contextMenuRequested(QContextMenuEvent*))); + connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent *)), this, + SIGNAL(contextMenuRequested(QContextMenuEvent *))); #else - AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); + AppElements_Viewer *aViewer = myWorkshop->mainWindow()->viewer(); connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed())); - connect(aViewer, SIGNAL(tryCloseView(AppElements_ViewWindow*)), - this, SLOT(onTryCloseView(AppElements_ViewWindow*))); + connect(aViewer, SIGNAL(tryCloseView(AppElements_ViewWindow *)), this, + SLOT(onTryCloseView(AppElements_ViewWindow *))); - connect(aViewer, SIGNAL(deleteView(AppElements_ViewWindow*)), - this, SLOT(onDeleteView(AppElements_ViewWindow*))); + connect(aViewer, SIGNAL(deleteView(AppElements_ViewWindow *)), this, + SLOT(onDeleteView(AppElements_ViewWindow *))); - connect(aViewer, SIGNAL(viewCreated(AppElements_ViewWindow*)), - this, SLOT(onViewCreated(AppElements_ViewWindow*))); + connect(aViewer, SIGNAL(viewCreated(AppElements_ViewWindow *)), this, + SLOT(onViewCreated(AppElements_ViewWindow *))); - connect(aViewer, SIGNAL(activated(AppElements_ViewWindow*)), - this, SLOT(onActivated(AppElements_ViewWindow*))); + connect(aViewer, SIGNAL(activated(AppElements_ViewWindow *)), this, + SLOT(onActivated(AppElements_ViewWindow *))); - connect(aViewer, SIGNAL(mousePress(AppElements_ViewWindow*, QMouseEvent*)), this, - SLOT(onMousePress(AppElements_ViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mousePress(AppElements_ViewWindow *, QMouseEvent *)), + this, SLOT(onMousePress(AppElements_ViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseRelease(AppElements_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseRelease(AppElements_ViewWindow*, QMouseEvent*))); + connect(aViewer, + SIGNAL(mouseRelease(AppElements_ViewWindow *, QMouseEvent *)), this, + SLOT(onMouseRelease(AppElements_ViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*))); + connect(aViewer, + SIGNAL(mouseDoubleClick(AppElements_ViewWindow *, QMouseEvent *)), + this, + SLOT(onMouseDoubleClick(AppElements_ViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(mouseMove(AppElements_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseMove(AppElements_ViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseMove(AppElements_ViewWindow *, QMouseEvent *)), + this, SLOT(onMouseMove(AppElements_ViewWindow *, QMouseEvent *))); - connect(aViewer, SIGNAL(keyPress(AppElements_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyPress(AppElements_ViewWindow*, QKeyEvent*))); + connect(aViewer, SIGNAL(keyPress(AppElements_ViewWindow *, QKeyEvent *)), + this, SLOT(onKeyPress(AppElements_ViewWindow *, QKeyEvent *))); - connect(aViewer, SIGNAL(keyRelease(AppElements_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyRelease(AppElements_ViewWindow*, QKeyEvent*))); + connect(aViewer, SIGNAL(keyRelease(AppElements_ViewWindow *, QKeyEvent *)), + this, SLOT(onKeyRelease(AppElements_ViewWindow *, QKeyEvent *))); - connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); - connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, - SIGNAL(contextMenuRequested(QContextMenuEvent*))); + connect(aViewer, SIGNAL(selectionChanged()), this, + SIGNAL(selectionChanged())); + connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent *)), this, + SIGNAL(contextMenuRequested(QContextMenuEvent *))); #endif } -bool XGUI_ViewerProxy::eventFilter(QObject *theObject, QEvent *theEvent) -{ +bool XGUI_ViewerProxy::eventFilter(QObject *theObject, QEvent *theEvent) { if (theEvent->type() == QEvent::Enter) { emit enterViewPort(); - } - else if (theEvent->type() == QEvent::Leave) { + } else if (theEvent->type() == QEvent::Leave) { emit leaveViewPort(); } return ModuleBase_IViewer::eventFilter(theObject, theEvent); } -void XGUI_ViewerProxy::onViewCreated(ModuleBase_IViewWindow* theWnd) -{ +void XGUI_ViewerProxy::onViewCreated(ModuleBase_IViewWindow *theWnd) { theWnd->viewPort()->installEventFilter(this); - myWindowScale.insert (theWnd->v3dView(), theWnd->v3dView()->Camera()->Scale()); + myWindowScale.insert(theWnd->v3dView(), theWnd->v3dView()->Camera()->Scale()); emit viewCreated(theWnd); } #ifndef HAVE_SALOME -void XGUI_ViewerProxy::onTryCloseView(AppElements_ViewWindow* theWnd) -{ +void XGUI_ViewerProxy::onTryCloseView(AppElements_ViewWindow *theWnd) { emit tryCloseView(theWnd); } -void XGUI_ViewerProxy::onDeleteView(AppElements_ViewWindow* theWnd) -{ +void XGUI_ViewerProxy::onDeleteView(AppElements_ViewWindow *theWnd) { if (myWindowScale.contains(theWnd->v3dView())) - myWindowScale.remove (theWnd->v3dView()); + myWindowScale.remove(theWnd->v3dView()); emit deleteView(theWnd); } -void XGUI_ViewerProxy::onViewCreated(AppElements_ViewWindow* theWnd) -{ +void XGUI_ViewerProxy::onViewCreated(AppElements_ViewWindow *theWnd) { theWnd->viewPort()->installEventFilter(this); - connect(theWnd, SIGNAL(vpTransformationFinished(AppElements_ViewWindow::OperationType)), - this, SLOT(onViewTransformed(AppElements_ViewWindow::OperationType))); + connect( + theWnd, + SIGNAL(vpTransformationFinished(AppElements_ViewWindow::OperationType)), + this, SLOT(onViewTransformed(AppElements_ViewWindow::OperationType))); - myWindowScale.insert (theWnd->v3dView(), theWnd->v3dView()->Camera()->Scale()); + myWindowScale.insert(theWnd->v3dView(), theWnd->v3dView()->Camera()->Scale()); emit viewCreated(theWnd); } -void XGUI_ViewerProxy::onActivated(AppElements_ViewWindow* theWnd) -{ +void XGUI_ViewerProxy::onActivated(AppElements_ViewWindow *theWnd) { emit activated(theWnd); } -void XGUI_ViewerProxy::onMousePress(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) -{ +void XGUI_ViewerProxy::onMousePress(AppElements_ViewWindow *theWnd, + QMouseEvent *theEvent) { emit mousePress(theWnd, theEvent); } -void XGUI_ViewerProxy::onMouseRelease(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) -{ +void XGUI_ViewerProxy::onMouseRelease(AppElements_ViewWindow *theWnd, + QMouseEvent *theEvent) { emit mouseRelease(theWnd, theEvent); } -void XGUI_ViewerProxy::onMouseDoubleClick(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) -{ +void XGUI_ViewerProxy::onMouseDoubleClick(AppElements_ViewWindow *theWnd, + QMouseEvent *theEvent) { emit mouseDoubleClick(theWnd, theEvent); } -void XGUI_ViewerProxy::onMouseMove(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) -{ +void XGUI_ViewerProxy::onMouseMove(AppElements_ViewWindow *theWnd, + QMouseEvent *theEvent) { if (theEvent->buttons() != Qt::NoButton) eraseHighlight(); else { if (myIs2dMode) { - bool aHighlight2d = - ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true); + bool aHighlight2d = ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "highlighting-2d", true); if (aHighlight2d) { if (myShowHighlight) eraseHighlight(); else updateHighlight(); - } - else { + } else { if (myShowHighlight) updateHighlight(); else eraseHighlight(); } - } - else { - bool aHighlight3d = - ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false); + } else { + bool aHighlight3d = ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "highlighting-3d", false); if (aHighlight3d) { if (myShowHighlight) eraseHighlight(); else updateHighlight(); - } - else { + } else { if (myShowHighlight) updateHighlight(); else @@ -335,31 +327,29 @@ void XGUI_ViewerProxy::onMouseMove(AppElements_ViewWindow* theWnd, QMouseEvent* emit mouseMove(theWnd, theEvent); } -void XGUI_ViewerProxy::onKeyPress(AppElements_ViewWindow* theWnd, QKeyEvent* theEvent) -{ +void XGUI_ViewerProxy::onKeyPress(AppElements_ViewWindow *theWnd, + QKeyEvent *theEvent) { myShowHighlight = theEvent->key() == Qt::Key_H; emit keyPress(theWnd, theEvent); } -void XGUI_ViewerProxy::onKeyRelease(AppElements_ViewWindow* theWnd, QKeyEvent* theEvent) -{ +void XGUI_ViewerProxy::onKeyRelease(AppElements_ViewWindow *theWnd, + QKeyEvent *theEvent) { if (theEvent->key() == Qt::Key_H) { myShowHighlight = false; } emit keyRelease(theWnd, theEvent); } -void XGUI_ViewerProxy::onViewTransformed(AppElements_ViewWindow::OperationType theType) -{ - emit viewTransformed((int) theType); +void XGUI_ViewerProxy::onViewTransformed( + AppElements_ViewWindow::OperationType theType) { + emit viewTransformed((int)theType); } #endif - //*************************************** -void XGUI_ViewerProxy::enableSelection(bool isEnabled) -{ +void XGUI_ViewerProxy::enableSelection(bool isEnabled) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->enableSelection(isEnabled); #else @@ -368,8 +358,7 @@ void XGUI_ViewerProxy::enableSelection(bool isEnabled) } //*************************************** -bool XGUI_ViewerProxy::isSelectionEnabled() const -{ +bool XGUI_ViewerProxy::isSelectionEnabled() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->isSelectionEnabled(); #else @@ -378,8 +367,7 @@ bool XGUI_ViewerProxy::isSelectionEnabled() const } //*************************************** -void XGUI_ViewerProxy::enableMultiselection(bool isEnable) -{ +void XGUI_ViewerProxy::enableMultiselection(bool isEnable) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->enableMultiselection(isEnable); #else @@ -388,8 +376,7 @@ void XGUI_ViewerProxy::enableMultiselection(bool isEnable) } //*************************************** -bool XGUI_ViewerProxy::isMultiSelectionEnabled() const -{ +bool XGUI_ViewerProxy::isMultiSelectionEnabled() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->isMultiSelectionEnabled(); #else @@ -398,8 +385,7 @@ bool XGUI_ViewerProxy::isMultiSelectionEnabled() const } //*************************************** -bool XGUI_ViewerProxy::enableDrawMode(bool isEnabled) -{ +bool XGUI_ViewerProxy::enableDrawMode(bool isEnabled) { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->enableDrawMode(isEnabled); #else @@ -408,40 +394,35 @@ bool XGUI_ViewerProxy::enableDrawMode(bool isEnabled) } //*************************************** -void XGUI_ViewerProxy::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +void XGUI_ViewerProxy::addSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { myWorkshop->displayer()->addSelectionFilter(theFilter); } //*************************************** -void XGUI_ViewerProxy::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +void XGUI_ViewerProxy::removeSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { myWorkshop->displayer()->removeSelectionFilter(theFilter); } //*************************************** -bool XGUI_ViewerProxy::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) -{ +bool XGUI_ViewerProxy::hasSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) { return myWorkshop->displayer()->hasSelectionFilter(theFilter); } //*************************************** -void XGUI_ViewerProxy::clearSelectionFilters() -{ +void XGUI_ViewerProxy::clearSelectionFilters() { myWorkshop->displayer()->removeFilters(); } //*************************************** -void XGUI_ViewerProxy::update() -{ - myWorkshop->displayer()->updateViewer(); -} +void XGUI_ViewerProxy::update() { myWorkshop->displayer()->updateViewer(); } //*************************************** -bool XGUI_ViewerProxy::canDragByMouse() const -{ +bool XGUI_ViewerProxy::canDragByMouse() const { if (myWorkshop->isSalomeMode()) { - ModuleBase_IViewer* aViewer = myWorkshop->salomeConnector()->viewer(); + ModuleBase_IViewer *aViewer = myWorkshop->salomeConnector()->viewer(); return aViewer->canDragByMouse(); } else { return true; @@ -449,22 +430,21 @@ bool XGUI_ViewerProxy::canDragByMouse() const } //*************************************** -Handle(AIS_Shape) createPresentation(const TopoDS_Shape& theShape, double theDeviation) -{ +Handle(AIS_Shape) + createPresentation(const TopoDS_Shape &theShape, double theDeviation) { Handle(AIS_Shape) aAis = new AIS_Shape(theShape); aAis->SetColor(HIGHLIGHT_COLOR); - aAis->SetZLayer(Graphic3d_ZLayerId_Top); //Graphic3d_ZLayerId_Topmost + aAis->SetZLayer(Graphic3d_ZLayerId_Top); // Graphic3d_ZLayerId_Topmost aAis->Attributes()->SetDeviationCoefficient(theDeviation); aAis->Attributes()->SetIsoOnPlane(false); return aAis; } //*************************************** -void XGUI_ViewerProxy::createPresentations(const ResultPtr& theRes, - const TopoDS_Shape& theIgnoreShape) -{ +void XGUI_ViewerProxy::createPresentations(const ResultPtr &theRes, + const TopoDS_Shape &theIgnoreShape) { Handle(AIS_InteractiveContext) aContext = AISContext(); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); Handle(AIS_Shape) aAis; Handle(AIS_InteractiveObject) anAISIO; double aDeviation = 0.001; @@ -475,9 +455,9 @@ void XGUI_ViewerProxy::createPresentations(const ResultPtr& theRes, if (aAISPrs.get()) { anAISIO = aAISPrs->impl(); aDeviation = anAISIO->Attributes()->DeviationCoefficient(); - } - else { - aDeviation = Config_PropManager::real("Visualization", "construction_deflection"); + } else { + aDeviation = + Config_PropManager::real("Visualization", "construction_deflection"); } aAis = createPresentation(aTShape, aDeviation); myHighlights.Append(aAis); @@ -486,9 +466,8 @@ void XGUI_ViewerProxy::createPresentations(const ResultPtr& theRes, } } - -void XGUI_ViewerProxy::displayHighlight(FeaturePtr theFeature, const TopoDS_Shape& theIgnoreShape) -{ +void XGUI_ViewerProxy::displayHighlight(FeaturePtr theFeature, + const TopoDS_Shape &theIgnoreShape) { if (theFeature.get()) { std::list aResults = theFeature->results(); std::list::const_iterator aIt; @@ -498,8 +477,7 @@ void XGUI_ViewerProxy::displayHighlight(FeaturePtr theFeature, const TopoDS_Shap } } -bool XGUI_ViewerProxy::eraseHighlight() -{ +bool XGUI_ViewerProxy::eraseHighlight() { Handle(AIS_InteractiveContext) aContext = AISContext(); Handle(AIS_InteractiveObject) anAISIO; AIS_ListIteratorOfListOfInteractive aLIt; @@ -512,8 +490,7 @@ bool XGUI_ViewerProxy::eraseHighlight() return isErased; } -void XGUI_ViewerProxy::updateHighlight() -{ +void XGUI_ViewerProxy::updateHighlight() { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { Handle(StdSelect_BRepOwner) aOwner; @@ -521,13 +498,15 @@ void XGUI_ViewerProxy::updateHighlight() bool isDisplayed = false; TopoDS_Shape aShape, aShp; ResultPtr aRes; - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) { + XGUI_Displayer *aDisplayer = myWorkshop->displayer(); + for (aContext->InitDetected(); aContext->MoreDetected(); + aContext->NextDetected()) { aOwner = Handle(StdSelect_BRepOwner)::DownCast(aContext->DetectedOwner()); if ((!aOwner.IsNull()) && aOwner->HasShape()) { aShape = aOwner->Shape(); anIO = Handle(AIS_InteractiveObject)::DownCast(aOwner->Selectable()); - aRes = std::dynamic_pointer_cast(aDisplayer->getObject(anIO)); + aRes = std::dynamic_pointer_cast( + aDisplayer->getObject(anIO)); if (aRes.get() && (aRes != myResult)) { eraseHighlight(); FeaturePtr aFeature = ModelAPI_Feature::feature(aRes); @@ -535,8 +514,7 @@ void XGUI_ViewerProxy::updateHighlight() if ((aFeature->results().size() > 1) || (!aShp.IsSame(aShape))) { myResult = aRes; displayHighlight(aFeature, aShape); - } - else { + } else { myResult = ResultPtr(); } update(); @@ -554,37 +532,34 @@ void XGUI_ViewerProxy::updateHighlight() } #ifdef HAVE_SALOME -void XGUI_ViewerProxy::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) -{ +void XGUI_ViewerProxy::onMouseMove(ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) { if (theEvent->buttons() != Qt::NoButton) eraseHighlight(); else { if (myIs2dMode) { - bool aHighlight2d = - ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true); + bool aHighlight2d = ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "highlighting-2d", true); if (aHighlight2d) { if (myShowHighlight) eraseHighlight(); else updateHighlight(); - } - else { + } else { if (myShowHighlight) updateHighlight(); else eraseHighlight(); } - } - else { - bool aHighlight3d = - ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false); + } else { + bool aHighlight3d = ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "highlighting-3d", false); if (aHighlight3d) { if (myShowHighlight) eraseHighlight(); else updateHighlight(); - } - else { + } else { if (myShowHighlight) updateHighlight(); else @@ -595,14 +570,14 @@ void XGUI_ViewerProxy::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* emit mouseMove(theWnd, theEvent); } -void XGUI_ViewerProxy::onKeyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) -{ +void XGUI_ViewerProxy::onKeyPress(ModuleBase_IViewWindow *theWnd, + QKeyEvent *theEvent) { myShowHighlight = theEvent->key() == Qt::Key_H; emit keyPress(theWnd, theEvent); } -void XGUI_ViewerProxy::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) -{ +void XGUI_ViewerProxy::onKeyRelease(ModuleBase_IViewWindow *theWnd, + QKeyEvent *theEvent) { if (theEvent->key() == Qt::Key_H) { myShowHighlight = false; } @@ -610,9 +585,7 @@ void XGUI_ViewerProxy::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* t } #endif - -bool XGUI_ViewerProxy::isColorScaleVisible() const -{ +bool XGUI_ViewerProxy::isColorScaleVisible() const { #ifdef HAVE_SALOME return myWorkshop->salomeConnector()->viewer()->isColorScaleVisible(); #else @@ -620,8 +593,7 @@ bool XGUI_ViewerProxy::isColorScaleVisible() const #endif } -void XGUI_ViewerProxy::setColorScaleShown(bool on) -{ +void XGUI_ViewerProxy::setColorScaleShown(bool on) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on); #else @@ -629,85 +601,83 @@ void XGUI_ViewerProxy::setColorScaleShown(bool on) #endif } -void XGUI_ViewerProxy::setColorScalePosition(double theX, double theY) -{ +void XGUI_ViewerProxy::setColorScalePosition(double theX, double theY) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScalePosition(theX, theY); #else - QWidget* aWindow = activeViewPort(); - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + QWidget *aWindow = activeViewPort(); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); aColorScale->SetPosition(aWindow->width() * theX, aWindow->height() * theY); #endif } -void XGUI_ViewerProxy::setColorScaleSize(double theW, double theH) -{ +void XGUI_ViewerProxy::setColorScaleSize(double theW, double theH) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleSize(theW, theH); #else - QWidget* aWindow = activeViewPort(); - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + QWidget *aWindow = activeViewPort(); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); aColorScale->SetSize(aWindow->width() * theW, aWindow->height() * theH); #endif } -void XGUI_ViewerProxy::setColorScaleRange(double theMin, double theMax) -{ +void XGUI_ViewerProxy::setColorScaleRange(double theMin, double theMax) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleRange(theMin, theMax); #else - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); aColorScale->SetRange(theMin, theMax); #endif } -void XGUI_ViewerProxy::setColorScaleIntervals(int theNb) -{ +void XGUI_ViewerProxy::setColorScaleIntervals(int theNb) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleIntervals(theNb); #else - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); aColorScale->SetNumberOfIntervals(theNb); #endif } -void XGUI_ViewerProxy::setColorScaleTextColor(const QColor& theColor) -{ +void XGUI_ViewerProxy::setColorScaleTextColor(const QColor &theColor) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleTextColor(theColor); #else - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); - Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), Quantity_TOC_RGB); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); + Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), + Quantity_TOC_RGB); aColorScale->SetColor(aColor); #endif } - -void XGUI_ViewerProxy::setColorScaleTextHeigth(int theH) -{ +void XGUI_ViewerProxy::setColorScaleTextHeigth(int theH) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleTextHeigth(theH); #else - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); aColorScale->SetTextHeight(theH); #endif } -void XGUI_ViewerProxy::setColorScaleTitle(const QString& theText) -{ +void XGUI_ViewerProxy::setColorScaleTitle(const QString &theText) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setColorScaleTitle(theText); #else - Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + Handle(AIS_ColorScale) aColorScale = + myWorkshop->mainWindow()->viewer()->colorScale(); aColorScale->SetTitle(theText.toStdWString().c_str()); #endif } - //****************************************************** -void XGUI_ViewerProxy::setupColorScale() -{ - SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); +void XGUI_ViewerProxy::setupColorScale() { + SUIT_ResourceMgr *aResMgr = ModuleBase_Preferences::resourceMgr(); double aX = aResMgr->doubleValue("Viewer", "scalar_bar_x_position", 0.03); double aY = aResMgr->doubleValue("Viewer", "scalar_bar_y_position", 0.35); setColorScalePosition(aX, aY); @@ -716,7 +686,8 @@ void XGUI_ViewerProxy::setupColorScale() double aH = aResMgr->doubleValue("Viewer", "scalar_bar_height", 0.5); setColorScaleSize(aW, aH); - QColor aColor = aResMgr->colorValue("Viewer", "scalar_bar_text_color", Qt::black); + QColor aColor = + aResMgr->colorValue("Viewer", "scalar_bar_text_color", Qt::black); setColorScaleTextColor(aColor); int aT = aResMgr->integerValue("Viewer", "scalar_bar_text_height", 14); @@ -726,32 +697,27 @@ void XGUI_ViewerProxy::setupColorScale() setColorScaleIntervals(aN); } -void XGUI_ViewerProxy::setText( - const ModuleBase_IViewer::TextColor& theText, const int theSize) -{ +void XGUI_ViewerProxy::setText(const ModuleBase_IViewer::TextColor &theText, + const int theSize) { #ifdef HAVE_SALOME myWorkshop->salomeConnector()->viewer()->setText(theText, theSize); #endif } #ifdef HAVE_SALOME -void XGUI_ViewerProxy::setFitter(OCCViewer_Fitter* theFitter) -{ +void XGUI_ViewerProxy::setFitter(OCCViewer_Fitter *theFitter) { myWorkshop->salomeConnector()->viewer()->setFitter(theFitter); } -OCCViewer_Fitter* XGUI_ViewerProxy::fitter() const -{ +OCCViewer_Fitter *XGUI_ViewerProxy::fitter() const { return myWorkshop->salomeConnector()->viewer()->fitter(); } #else -void XGUI_ViewerProxy::setFitter(AppElements_Fitter* theFitter) -{ +void XGUI_ViewerProxy::setFitter(AppElements_Fitter *theFitter) { myWorkshop->mainWindow()->viewer()->setFitter(theFitter); } -AppElements_Fitter* XGUI_ViewerProxy::fitter() const -{ +AppElements_Fitter *XGUI_ViewerProxy::fitter() const { return myWorkshop->mainWindow()->viewer()->fitter(); } #endif diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 1b419f6f2..db12c0fef 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -14,44 +14,42 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_VIEWERPROXY_H #define XGUI_VIEWERPROXY_H #include "XGUI.h" -#include #include #include +#include -#include #include +#include #ifdef HAVE_SALOME #include #else - #include - #include +#include +#include #endif - - class XGUI_Workshop; /** * \ingroup GUI * Proxy class which repersents or AppElements_Viewer or Salome Viewer * dependently on current launching environment. - * It is reccomennded to use this class in operation for accessing to viewer + * It is reccomennded to use this class in operation for accessing to viewer * functionality instead of direct access to a viewer */ -class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer -{ -Q_OBJECT - public: - /// Constructor - /// \param theParent a parent object - XGUI_ViewerProxy(XGUI_Workshop* theParent); +class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer { + Q_OBJECT +public: + /// Constructor + /// \param theParent a parent object + XGUI_ViewerProxy(XGUI_Workshop *theParent); /// Connects some signals to the viewer from the module connector void connectViewProxy(); @@ -68,7 +66,7 @@ Q_OBJECT //! Returns Vsd_View object from currently active view window virtual Handle(V3d_View) activeView() const; - virtual QWidget* activeViewPort() const; + virtual QWidget *activeViewPort() const; //! Enable or disable selection in the viewer virtual void enableSelection(bool isEnabled); @@ -90,8 +88,8 @@ Q_OBJECT /// \param theY the Y projection value /// \param theZ the Z projection value /// \param theTwist the twist angle in radians - virtual void setViewProjection( double theX, double theY, double theZ, - double theTwist ); + virtual void setViewProjection(double theX, double theY, double theZ, + double theTwist); //! Sets the view fitted all virtual void fitAll(); @@ -103,14 +101,15 @@ Q_OBJECT void connectToViewer(); /// Add selection filter to the viewer - virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// Remove selection filter from the viewer - virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual void removeSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter); /// Returns true if the selection filter is set to the viewer /// \param theFilter a selection filter - virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); /// Remove all selection filters from the viewer virtual void clearSelectionFilters(); @@ -157,11 +156,11 @@ Q_OBJECT //! Set color of text of color scale // \param theH is number of intervals - virtual void setColorScaleTextColor(const QColor& theColor); + virtual void setColorScaleTextColor(const QColor &theColor); //! Set title of color scale // \param theText is a title - virtual void setColorScaleTitle(const QString& theText); + virtual void setColorScaleTitle(const QString &theText); //! Set color scale parameters according to user preferences and window size void setupColorScale(); @@ -170,17 +169,18 @@ Q_OBJECT //! \param theText the text to display, or empty string to erase presentation; //! the first item is the font name and text color //! \param theSize size of the text font - virtual void setText(const ModuleBase_IViewer::TextColor& theText, const int theSize); + virtual void setText(const ModuleBase_IViewer::TextColor &theText, + const int theSize); // Fit all along Z (perpendicular to display) - //virtual void Zfitall(); + // virtual void Zfitall(); #ifdef HAVE_SALOME - virtual void setFitter(OCCViewer_Fitter* theFitter); - virtual OCCViewer_Fitter* fitter() const; + virtual void setFitter(OCCViewer_Fitter *theFitter); + virtual OCCViewer_Fitter *fitter() const; #else - virtual void setFitter(AppElements_Fitter* theFitter); - virtual AppElements_Fitter* fitter() const; + virtual void setFitter(AppElements_Fitter *theFitter); + virtual AppElements_Fitter *fitter() const; #endif signals: @@ -191,45 +191,44 @@ signals: void leaveViewPort(); protected: - /// processes the application signals to catch the mouse leaving state of the main window - /// \param theObject - /// \param theEvent + /// processes the application signals to catch the mouse leaving state of the + /// main window \param theObject \param theEvent bool eventFilter(QObject *theObject, QEvent *theEvent); private slots: - void onViewCreated(ModuleBase_IViewWindow* theWnd); + void onViewCreated(ModuleBase_IViewWindow *theWnd); #ifndef HAVE_SALOME - void onTryCloseView(AppElements_ViewWindow*); - void onDeleteView(AppElements_ViewWindow*); - void onViewCreated(AppElements_ViewWindow*); - void onActivated(AppElements_ViewWindow*); + void onTryCloseView(AppElements_ViewWindow *); + void onDeleteView(AppElements_ViewWindow *); + void onViewCreated(AppElements_ViewWindow *); + void onActivated(AppElements_ViewWindow *); - void onMousePress(AppElements_ViewWindow*, QMouseEvent*); - void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*); - void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*); - void onMouseMove(AppElements_ViewWindow*, QMouseEvent*); + void onMousePress(AppElements_ViewWindow *, QMouseEvent *); + void onMouseRelease(AppElements_ViewWindow *, QMouseEvent *); + void onMouseDoubleClick(AppElements_ViewWindow *, QMouseEvent *); + void onMouseMove(AppElements_ViewWindow *, QMouseEvent *); - void onKeyPress(AppElements_ViewWindow*, QKeyEvent*); - void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*); + void onKeyPress(AppElements_ViewWindow *, QKeyEvent *); + void onKeyRelease(AppElements_ViewWindow *, QKeyEvent *); void onViewTransformed(AppElements_ViewWindow::OperationType); #else - void onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*); - void onKeyPress(ModuleBase_IViewWindow*, QKeyEvent*); - void onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*); + void onMouseMove(ModuleBase_IViewWindow *, QMouseEvent *); + void onKeyPress(ModuleBase_IViewWindow *, QKeyEvent *); + void onKeyRelease(ModuleBase_IViewWindow *, QKeyEvent *); #endif - private: - void displayHighlight(FeaturePtr theFeature, const TopoDS_Shape& theIgnoreShape); - bool eraseHighlight(); - void createPresentations(const ResultPtr& theRes, const TopoDS_Shape& theIgnoreShape); +private: + void displayHighlight(FeaturePtr theFeature, + const TopoDS_Shape &theIgnoreShape); + bool eraseHighlight(); + void createPresentations(const ResultPtr &theRes, + const TopoDS_Shape &theIgnoreShape); - - XGUI_Workshop* myWorkshop; + XGUI_Workshop *myWorkshop; ResultPtr myResult; AIS_ListOfInteractive myHighlights; - }; #endif diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 6ae78b95d..debac0ec2 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_Workshop.h" @@ -22,34 +23,34 @@ #include "XGUI_ActionsMgr.h" #include "XGUI_ActiveControlMgr.h" #include "XGUI_ActiveControlSelector.h" -#include "XGUI_MenuMgr.h" #include "XGUI_ColorDialog.h" -#include "XGUI_DeflectionDialog.h" -#include "XGUI_TransparencyWidget.h" #include "XGUI_ContextMenuMgr.h" +#include "XGUI_DeflectionDialog.h" #include "XGUI_Displayer.h" #include "XGUI_ErrorDialog.h" #include "XGUI_ErrorMgr.h" #include "XGUI_FacesPanel.h" #include "XGUI_FacesPanelSelector.h" +#include "XGUI_MenuMgr.h" #include "XGUI_ModuleConnector.h" #include "XGUI_ObjectsBrowser.h" #include "XGUI_OperationMgr.h" +#include "XGUI_PropertyDialog.h" #include "XGUI_PropertyPanel.h" #include "XGUI_PropertyPanelSelector.h" -#include "XGUI_PropertyDialog.h" #include "XGUI_SalomeConnector.h" #include "XGUI_Selection.h" #include "XGUI_SelectionActivate.h" #include "XGUI_SelectionMgr.h" #include "XGUI_Tools.h" +#include "XGUI_TransparencyWidget.h" #include "XGUI_ViewerProxy.h" #include "XGUI_WorkshopListener.h" -#include -#include +#include #include +#include #include -#include +#include #ifdef HAVE_SALOME #include @@ -67,8 +68,8 @@ #include #include -#include #include +#include #include #include #include @@ -76,94 +77,93 @@ #include #include #include +#include #include #include -#include #include -#include #include -#include +#include #include //#include -#include #include #include +#include #include +#include #include -#include #include -#include +#include #include #include +#include #include +#include #include +#include #include #include +#include #include +#include #include +#include #include #include #include -#include -#include #include -#include -#include -#include -#include #include +#include #include +#include #include #include #include -#include #include #include -#include #include #include #ifdef BEFORE_TRIHEDRON_PATCH -#include #include +#include #endif +#include #include -#include -#include -#include -#include -#include +#include +#include +#include #include +#include +#include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include #include -#include -#include +#include #include -#include +#include +#include -#include #include +#include #ifdef TINSPECTOR #include #include #include #include -static TInspector_Communicator* MyTCommunicator; +static TInspector_Communicator *MyTCommunicator; static Handle(VInspector_CallBack) MyVCallBack; #endif @@ -175,7 +175,8 @@ static Handle(VInspector_CallBack) MyVCallBack; #ifdef WIN32 #include #pragma warning(disable : 4456) // for nested foreach -#pragma warning(disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) +#pragma warning( \ + disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) #else #include #endif @@ -183,7 +184,8 @@ static Handle(VInspector_CallBack) MyVCallBack; //#define DEBUG_WITH_MESSAGE_REPORT QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end"); -QString XGUI_Workshop::MOVE_TO_END_SPLIT_COMMAND = QObject::tr("Move to the end and split"); +QString XGUI_Workshop::MOVE_TO_END_SPLIT_COMMAND = + QObject::tr("Move to the end and split"); //#define DEBUG_DELETE //#define DEBUG_FEATURE_NAME @@ -194,43 +196,39 @@ static QString MyFilter(QObject::tr("SHAPER files (*.shaper *.cadbld)")); static QString MyFilter2(QObject::tr("SHAPER files (*.shaper)")); static QString MyExtension(".shaper"); #else -static QString MyFilter(QObject::tr("CAD Builder files (*.cadbld);;All files (*.*)")); +static QString + MyFilter(QObject::tr("CAD Builder files (*.cadbld);;All files (*.*)")); static QString MyFilter2(QObject::tr("CAD Builder files (*.cadbld)")); static QString MyExtension(".cadbld"); #endif -static QString MyImportPartFilter(QObject::tr("Part files (*.shaperpart);;All files (*.*)")); - +static QString MyImportPartFilter( + QObject::tr("Part files (*.shaperpart);;All files (*.*)")); //****************************************************** -XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) - : QObject(), - myModule(NULL), - myObjectBrowser(0), - myPropertyPanel(0), - myFacesPanel(0), - myDisplayer(0), - mySalomeConnector(theConnector), - //myViewerSelMode(TopAbs_FACE), - myInspectionPanel(0) -{ +XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector *theConnector) + : QObject(), myModule(NULL), myObjectBrowser(0), myPropertyPanel(0), + myFacesPanel(0), myDisplayer(0), mySalomeConnector(theConnector), + // myViewerSelMode(TopAbs_FACE), + myInspectionPanel(0) { mySelector = new XGUI_SelectionMgr(this); myModuleConnector = new XGUI_ModuleConnector(this); myOperationMgr = new XGUI_OperationMgr(this, myModuleConnector); - ModuleBase_IWorkshop* aWorkshop = moduleConnector(); - // Has to be defined first in order to get errors and messages from other components + ModuleBase_IWorkshop *aWorkshop = moduleConnector(); + // Has to be defined first in order to get errors and messages from other + // components myEventsListener = new XGUI_WorkshopListener(this); mySelectionActivate = new XGUI_SelectionActivate(aWorkshop); - SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); + SUIT_ResourceMgr *aResMgr = ModuleBase_Preferences::resourceMgr(); #ifndef HAVE_SALOME myMainWindow = new AppElements_MainWindow(); bool aCloc = aResMgr->booleanValue("language", "locale", true); if (aCloc) - QLocale::setDefault( QLocale::c() ); + QLocale::setDefault(QLocale::c()); else - QLocale::setDefault( QLocale::system() ); + QLocale::setDefault(QLocale::system()); #endif QString aPath = Config_XMLReader::pluginConfigFile().c_str(); QDir aDir(aPath); @@ -247,74 +245,79 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) QString aCurrLang = aResMgr->stringValue("language", "language", "en"); #endif - if(aCurrLang != "en") { + if (aCurrLang != "en") { aLangs << "*_" + aCurrLang + ".ts"; // then replace with translated files } - foreach(QString aLang, aLangs) { + foreach (QString aLang, aLangs) { QStringList aFilters; aFilters << aLang; QStringList aTsFiles = aDir.entryList(aFilters, QDir::Files); - foreach(QString aFileName, aTsFiles) { + foreach (QString aFileName, aTsFiles) { Config_Translator::load(aFileName.toStdString()); } } myDataModelXMLReader = new Config_DataModelReader(); - //myDataModelXMLReader->readAll(); + // myDataModelXMLReader->readAll(); myDisplayer = new XGUI_Displayer(this); - connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(updateCommandStatus())); + connect(mySelector, SIGNAL(selectionChanged()), this, + SLOT(updateCommandStatus())); myActionsMgr = new XGUI_ActionsMgr(this); myActiveControlMgr = new XGUI_ActiveControlMgr(myModuleConnector); myMenuMgr = new XGUI_MenuMgr(this); myErrorDlg = new XGUI_ErrorDialog(QApplication::desktop()); myContextMenuMgr = new XGUI_ContextMenuMgr(this); - connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this, - SLOT(onContextMenuCommand(const QString&, bool))); + connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString &, bool)), + this, SLOT(onContextMenuCommand(const QString &, bool))); myViewerProxy = new XGUI_ViewerProxy(this); - //connect(myViewerProxy, SIGNAL(selectionChanged()), - // myActionsMgr, SLOT(updateOnViewSelection())); + // connect(myViewerProxy, SIGNAL(selectionChanged()), + // myActionsMgr, SLOT(updateOnViewSelection())); myErrorMgr = new XGUI_ErrorMgr(this, aWorkshop); - connect(myOperationMgr, SIGNAL(operationResumed(ModuleBase_Operation*)), - SLOT(onOperationResumed(ModuleBase_Operation*))); - connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), - SLOT(onOperationStopped(ModuleBase_Operation*))); - connect(myOperationMgr, SIGNAL(operationCommitted(ModuleBase_Operation*)), - SLOT(onOperationCommitted(ModuleBase_Operation*))); - connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)), - SLOT(onOperationAborted(ModuleBase_Operation*))); + connect(myOperationMgr, SIGNAL(operationResumed(ModuleBase_Operation *)), + SLOT(onOperationResumed(ModuleBase_Operation *))); + connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation *)), + SLOT(onOperationStopped(ModuleBase_Operation *))); + connect(myOperationMgr, SIGNAL(operationCommitted(ModuleBase_Operation *)), + SLOT(onOperationCommitted(ModuleBase_Operation *))); + connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation *)), + SLOT(onOperationAborted(ModuleBase_Operation *))); #ifndef HAVE_SALOME connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit())); myDisplayer->displayTrihedron(true); #endif - connect(myEventsListener, SIGNAL(errorOccurred(std::shared_ptr)), + connect(myEventsListener, + SIGNAL(errorOccurred(std::shared_ptr)), myErrorDlg, SLOT(addError(std::shared_ptr))); - Config_PropManager::registerProp("Visualization", "selection_color", "Selection color", - Config_Prop::Color, "255,255,255"); + Config_PropManager::registerProp("Visualization", "selection_color", + "Selection color", Config_Prop::Color, + "255,255,255"); - if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "face-selection", true)) + if (ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "face-selection", true)) myViewerSelMode.append(TopAbs_FACE); - if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "edge-selection", true)) + if (ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "edge-selection", true)) myViewerSelMode.append(TopAbs_EDGE); - if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "vertex-selection", true)) + if (ModuleBase_Preferences::resourceMgr()->booleanValue( + "Viewer", "vertex-selection", true)) myViewerSelMode.append(TopAbs_VERTEX); - //IMP: an attempt to use result selection with other selection modes - myViewerSelMode.append(ModuleBase_ResultPrs::Sel_Result);//TopAbs_VERTEX); + // IMP: an attempt to use result selection with other selection modes + myViewerSelMode.append(ModuleBase_ResultPrs::Sel_Result); // TopAbs_VERTEX); myViewerSelMode.append(TopAbs_COMPSOLID); } //****************************************************** -XGUI_Workshop::~XGUI_Workshop(void) -{ +XGUI_Workshop::~XGUI_Workshop(void) { #ifdef _DEBUG #ifdef MISSED_TRANSLATION // Save Missed translations @@ -330,9 +333,8 @@ XGUI_Workshop::~XGUI_Workshop(void) } //****************************************************** -void XGUI_Workshop::startApplication() -{ - //Initialize event listening +void XGUI_Workshop::startApplication() { + // Initialize event listening myEventsListener->initializeEventListening(); myDataModelXMLReader->readAll(); @@ -342,15 +344,18 @@ void XGUI_Workshop::startApplication() Config_Prop::Directory, ""); std::string aDir = Config_XMLReader::resourcesConfigFile(); - Config_PropManager::registerProp("Plugins", "import_initial_path", "Import initial directory", + Config_PropManager::registerProp("Plugins", "import_initial_path", + "Import initial directory", Config_Prop::Directory, aDir); #ifdef _DEBUG - Config_PropManager::registerProp("Plugins", "create_part_by_start", "Create Part by Start", - Config_Prop::Boolean, "false"); + Config_PropManager::registerProp("Plugins", "create_part_by_start", + "Create Part by Start", Config_Prop::Boolean, + "false"); - Config_PropManager::registerProp("Plugins", "show_hide_faces", "Show Hide Faces (on the right)", - Config_Prop::Boolean, "false"); + Config_PropManager::registerProp("Plugins", "show_hide_faces", + "Show Hide Faces (on the right)", + Config_Prop::Boolean, "false"); #endif registerValidators(); @@ -360,8 +365,7 @@ void XGUI_Workshop::startApplication() std::vector aColor; try { aColor = Config_PropManager::color("Visualization", "selection_color"); - } - catch (...) { + } catch (...) { } if (aColor.size() == 3) myDisplayer->setSelectionColor(aColor); @@ -382,22 +386,22 @@ void XGUI_Workshop::startApplication() emit applicationStarted(); #ifdef _DEBUG - bool aNewPart = Config_PropManager::boolean("Plugins", "create_part_by_start"); + bool aNewPart = + Config_PropManager::boolean("Plugins", "create_part_by_start"); if (aNewPart) { - module()->launchOperation("Part", false); // PartSetPlugin_Part::ID() + module()->launchOperation("Part", false); // PartSetPlugin_Part::ID() } #endif } //****************************************************** -void XGUI_Workshop::activateModule() -{ +void XGUI_Workshop::activateModule() { selectionActivate()->updateSelectionFilters(); connect(myDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)), - myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr))); + myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr))); connect(myDisplayer, SIGNAL(beforeObjectErase(ObjectPtr, AISObjectPtr)), - myModule, SLOT(onBeforeObjectErase(ObjectPtr, AISObjectPtr))); + myModule, SLOT(onBeforeObjectErase(ObjectPtr, AISObjectPtr))); updateCommandStatus(); @@ -409,25 +413,25 @@ void XGUI_Workshop::activateModule() } //****************************************************** -void XGUI_Workshop::deactivateModule() -{ +void XGUI_Workshop::deactivateModule() { // remove internal displayer filter displayer()->deactivateSelectionFilters(false); disconnect(myDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)), - myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr))); + myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr))); disconnect(myDisplayer, SIGNAL(beforeObjectErase(ObjectPtr, AISObjectPtr)), - myModule, SLOT(onBeforeObjectErase(ObjectPtr, AISObjectPtr))); + myModule, SLOT(onBeforeObjectErase(ObjectPtr, AISObjectPtr))); - XGUI_Displayer* aDisplayer = displayer(); + XGUI_Displayer *aDisplayer = displayer(); QObjectPtrList aDisplayed = aDisplayer->displayedObjects(); aDisplayer->deactivateObjects(aDisplayed, true); selectionActivate()->deactivateTrihedronInSelectionModes(); #ifdef BEFORE_TRIHEDRON_PATCH - //Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aDisplayer->getTrihedron()); - /// Trihedron problem: objects stayed in the viewer, should be removed manually - /// otherwise in SALOME happens crash by HideAll in the viewer + // Handle(AIS_Trihedron) aTrihedron = + // Handle(AIS_Trihedron)::DownCast(aDisplayer->getTrihedron()); + /// Trihedron problem: objects stayed in the viewer, should be removed + /// manually otherwise in SALOME happens crash by HideAll in the viewer aContext->Remove(aTrihedron->Position(), true); aContext->Remove(aTrihedron->Axis(), true); aContext->Remove(aTrihedron->XAxis(), true); @@ -438,155 +442,164 @@ void XGUI_Workshop::deactivateModule() } //****************************************************** -void XGUI_Workshop::initMenu() -{ +void XGUI_Workshop::initMenu() { myContextMenuMgr->createActions(); #ifdef HAVE_SALOME // Create only Undo, Redo commands - QAction* aAction = salomeConnector()->addDesktopCommand("UNDO_CMD", tr("Undo"), - tr("Undo last command"), - QIcon(":pictures/undo.png"), - QKeySequence::Undo, false, - "MEN_DESK_EDIT"); - QString aToolBarTitle = tr( "INF_DESK_TOOLBAR_STANDARD" ); - salomeConnector()->addActionInToolbar( aAction,aToolBarTitle ); + QAction *aAction = salomeConnector()->addDesktopCommand( + "UNDO_CMD", tr("Undo"), tr("Undo last command"), + QIcon(":pictures/undo.png"), QKeySequence::Undo, false, "MEN_DESK_EDIT"); + QString aToolBarTitle = tr("INF_DESK_TOOLBAR_STANDARD"); + salomeConnector()->addActionInToolbar(aAction, aToolBarTitle); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo())); - addHistoryMenu(aAction, SIGNAL(updateUndoHistory(const QList&)), SLOT(onUndo(int))); + addHistoryMenu(aAction, SIGNAL(updateUndoHistory(const QList &)), + SLOT(onUndo(int))); - aAction = salomeConnector()->addDesktopCommand("REDO_CMD", tr("Redo"), tr("Redo last command"), - QIcon(":pictures/redo.png"), QKeySequence::Redo, - false, "MEN_DESK_EDIT"); - salomeConnector()->addActionInToolbar( aAction, aToolBarTitle ); + aAction = salomeConnector()->addDesktopCommand( + "REDO_CMD", tr("Redo"), tr("Redo last command"), + QIcon(":pictures/redo.png"), QKeySequence::Redo, false, "MEN_DESK_EDIT"); + salomeConnector()->addActionInToolbar(aAction, aToolBarTitle); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRedo())); - addHistoryMenu(aAction, SIGNAL(updateRedoHistory(const QList&)), SLOT(onRedo(int))); + addHistoryMenu(aAction, SIGNAL(updateRedoHistory(const QList &)), + SLOT(onRedo(int))); salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT"); - //aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Auto rebuild"), - // tr("Blocks immediate apply of modifications"), - // QIcon(":pictures/autoapply.png"), QKeySequence(), - // false, "MEN_DESK_EDIT"); - //salomeConnector()->addActionInToolbar( aAction, aToolBarTitle ); + // aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Auto + // rebuild"), + // tr("Blocks immediate apply of + // modifications"), + // QIcon(":pictures/autoapply.png"), + // QKeySequence(), false, + // "MEN_DESK_EDIT"); + // salomeConnector()->addActionInToolbar( aAction, aToolBarTitle ); - //connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onAutoApply())); + // connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onAutoApply())); salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT"); - // Add commands to a file menu // Import sub-menu - aAction = salomeConnector()->addDesktopCommand("OPEN_CMD", tr("Part set..."), - tr("Import native file"), - QIcon(), QKeySequence(), - false, "MEN_DESK_FILE", tr("Import"), 10, 10); + aAction = salomeConnector()->addDesktopCommand( + "OPEN_CMD", tr("Part set..."), tr("Import native file"), QIcon(), + QKeySequence(), false, "MEN_DESK_FILE", tr("Import"), 10, 10); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onOpen())); - aAction = salomeConnector()->addDesktopCommand("IMPORT_PART_CMD", tr("Part..."), - tr("Import structure of a part"), - QIcon(), QKeySequence(), - false, "MEN_DESK_FILE", tr("Import"), 10, 10); + aAction = salomeConnector()->addDesktopCommand( + "IMPORT_PART_CMD", tr("Part..."), tr("Import structure of a part"), + QIcon(), QKeySequence(), false, "MEN_DESK_FILE", tr("Import"), 10, 10); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onImportPart())); - aAction = salomeConnector()->addDesktopCommand("IMPORT_SHAPE_CMD", tr("From CAD format..."), - tr("Import shape from a CAD format file"), - ModuleBase_IconFactory::loadIcon("icons/Exchange/import.png"), - QKeySequence(), false, "MEN_DESK_FILE", tr("Import"), 10, 10); + aAction = salomeConnector()->addDesktopCommand( + "IMPORT_SHAPE_CMD", tr("From CAD format..."), + tr("Import shape from a CAD format file"), + ModuleBase_IconFactory::loadIcon("icons/Exchange/import.png"), + QKeySequence(), false, "MEN_DESK_FILE", tr("Import"), 10, 10); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onImportShape())); - aAction = salomeConnector()->addDesktopCommand("IMPORT_IMAGE_CMD", tr("Picture..."), - tr("Import a picture from an image file"), - QIcon(), - QKeySequence(), false, "MEN_DESK_FILE", tr("Import"), 10, 10); + aAction = salomeConnector()->addDesktopCommand( + "IMPORT_IMAGE_CMD", tr("Picture..."), + tr("Import a picture from an image file"), QIcon(), QKeySequence(), false, + "MEN_DESK_FILE", tr("Import"), 10, 10); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onImportImage())); // Export sub-menu - aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Part set..."), - tr("Export the current document into a native file"), - QIcon(), QKeySequence(), - false, "MEN_DESK_FILE", tr("Export"), 10, 11); + aAction = salomeConnector()->addDesktopCommand( + "SAVEAS_CMD", tr("Part set..."), + tr("Export the current document into a native file"), QIcon(), + QKeySequence(), false, "MEN_DESK_FILE", tr("Export"), 10, 11); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSaveAs())); - aAction = salomeConnector()->addDesktopCommand("EXPORT_PART_CMD", tr("Part..."), - tr("Export a part of the current document into a file"), - QIcon(), QKeySequence(), - false, "MEN_DESK_FILE", tr("Export"), 10, 11); + aAction = salomeConnector()->addDesktopCommand( + "EXPORT_PART_CMD", tr("Part..."), + tr("Export a part of the current document into a file"), QIcon(), + QKeySequence(), false, "MEN_DESK_FILE", tr("Export"), 10, 11); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onExportPart())); - aAction = salomeConnector()->addDesktopCommand("EXPORT_SHAPE_CMD", tr("To CAD format..."), - tr("Export shape to a CAD format file"), - ModuleBase_IconFactory::loadIcon("icons/Exchange/export.png"), - QKeySequence(), false, "MEN_DESK_FILE", tr("Export"), 10, 11); + aAction = salomeConnector()->addDesktopCommand( + "EXPORT_SHAPE_CMD", tr("To CAD format..."), + tr("Export shape to a CAD format file"), + ModuleBase_IconFactory::loadIcon("icons/Exchange/export.png"), + QKeySequence(), false, "MEN_DESK_FILE", tr("Export"), 10, 11); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onExportShape())); #else // File commands group - AppElements_MenuGroupPanel* aGroup = myMainWindow->menuObject()->generalPage(); + AppElements_MenuGroupPanel *aGroup = + myMainWindow->menuObject()->generalPage(); - AppElements_Command* aCommand; + AppElements_Command *aCommand; - aCommand = aGroup->addFeature("SAVE_CMD", tr("Save"), tr("Save the document"), - QIcon(":pictures/save.png"), QKeySequence::Save); + aCommand = + aGroup->addFeature("SAVE_CMD", tr("Save"), tr("Save the document"), + QIcon(":pictures/save.png"), QKeySequence::Save); aCommand->connectTo(this, SLOT(onSave())); - //aCommand->disable(); + // aCommand->disable(); - aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"), + aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), + tr("Save the document into a file"), QIcon(":pictures/save.png"), QKeySequence()); aCommand->connectTo(this, SLOT(onSaveAs())); QString aUndoId = "UNDO_CMD"; - aCommand = aGroup->addFeature(aUndoId, tr("Undo"), tr("Undo last command"), - QIcon(":pictures/undo.png"), QKeySequence::Undo); + aCommand = + aGroup->addFeature(aUndoId, tr("Undo"), tr("Undo last command"), + QIcon(":pictures/undo.png"), QKeySequence::Undo); aCommand->connectTo(this, SLOT(onUndo())); - AppElements_Button* aUndoButton = qobject_cast(aGroup->widget(aUndoId)); + AppElements_Button *aUndoButton = + qobject_cast(aGroup->widget(aUndoId)); addHistoryMenu(aUndoButton, - SIGNAL(updateUndoHistory(const QList&)), + SIGNAL(updateUndoHistory(const QList &)), SLOT(onUndo(int))); QString aRedoId = "REDO_CMD"; - aCommand = aGroup->addFeature(aRedoId, tr("Redo"), tr("Redo last command"), - QIcon(":pictures/redo.png"), QKeySequence::Redo); + aCommand = + aGroup->addFeature(aRedoId, tr("Redo"), tr("Redo last command"), + QIcon(":pictures/redo.png"), QKeySequence::Redo); aCommand->connectTo(this, SLOT(onRedo())); - AppElements_Button* aRedoButton = qobject_cast(aGroup->widget(aRedoId)); + AppElements_Button *aRedoButton = + qobject_cast(aGroup->widget(aRedoId)); addHistoryMenu(aRedoButton, - SIGNAL(updateRedoHistory(const QList&)), + SIGNAL(updateRedoHistory(const QList &)), SLOT(onRedo(int))); - aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"), - QIcon(":pictures/open.png"), QKeySequence::Open); + aCommand = + aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"), + QIcon(":pictures/open.png"), QKeySequence::Open); aCommand->connectTo(this, SLOT(onOpen())); - aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Auto rebuild"), tr("Blocks immediate apply of modifications"), - QIcon(":pictures/autoapply_start.png"), QKeySequence()); + QIcon(":pictures/autoapply_start.png"), + QKeySequence()); aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked()); aCommand->connectTo(this, SLOT(onAutoApply())); - aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"), - QIcon(":pictures/preferences.png"), QKeySequence::Preferences); + aCommand = aGroup->addFeature( + "PREF_CMD", tr("Preferences"), tr("Edit preferences"), + QIcon(":pictures/preferences.png"), QKeySequence::Preferences); aCommand->connectTo(this, SLOT(onPreferences())); - aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"), - QIcon(":pictures/close.png"), QKeySequence::Close); + aCommand = + aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"), + QIcon(":pictures/close.png"), QKeySequence::Close); aCommand->connectTo(this, SLOT(onExit())); #endif } #ifndef HAVE_SALOME //****************************************************** -AppElements_Workbench* XGUI_Workshop::addWorkbench(const QString& theName) -{ - AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); +AppElements_Workbench *XGUI_Workshop::addWorkbench(const QString &theName) { + AppElements_MainMenu *aMenuBar = myMainWindow->menuObject(); return aMenuBar->addWorkbench(theName); } #endif //****************************************************** -QMainWindow* XGUI_Workshop::desktop() const -{ +QMainWindow *XGUI_Workshop::desktop() const { #ifdef HAVE_SALOME return salomeConnector()->desktop(); #else @@ -595,20 +608,19 @@ QMainWindow* XGUI_Workshop::desktop() const } //****************************************************** -void XGUI_Workshop::onStartWaiting() -{ +void XGUI_Workshop::onStartWaiting() { if (Events_LongOp::isPerformed()) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); } } //****************************************************** -void XGUI_Workshop::onAcceptActionClicked() -{ - XGUI_OperationMgr* anOperationMgr = operationMgr(); +void XGUI_Workshop::onAcceptActionClicked() { + XGUI_OperationMgr *anOperationMgr = operationMgr(); if (anOperationMgr) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperationMgr->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { myOperationMgr->commitOperation(); } @@ -616,12 +628,12 @@ void XGUI_Workshop::onAcceptActionClicked() } //****************************************************** -void XGUI_Workshop::onAcceptPlusActionClicked() -{ - XGUI_OperationMgr* anOperationMgr = operationMgr(); +void XGUI_Workshop::onAcceptPlusActionClicked() { + XGUI_OperationMgr *anOperationMgr = operationMgr(); if (anOperationMgr) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperationMgr->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { if (myOperationMgr->commitOperation()) module()->launchOperation(aFOperation->id(), false); @@ -630,52 +642,50 @@ void XGUI_Workshop::onAcceptPlusActionClicked() } //****************************************************** -void XGUI_Workshop::onPreviewActionClicked() -{ - ModuleBase_IPropertyPanel* aPanel = propertyPanel(); +void XGUI_Workshop::onPreviewActionClicked() { + ModuleBase_IPropertyPanel *aPanel = propertyPanel(); if (aPanel) { - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); - if (anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) { + ModuleBase_ModelWidget *anActiveWidget = aPanel->activeWidget(); + if (anActiveWidget && anActiveWidget->getValueState() == + ModuleBase_ModelWidget::ModifiedInPP) { anActiveWidget->storeValue(); } } std::shared_ptr aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_PREVIEW_REQUESTED))); + new Events_Message(Events_Loop::eventByName(EVENT_PREVIEW_REQUESTED))); Events_Loop::loop()->send(aMsg); } - //****************************************************** -void XGUI_Workshop::onHelpActionClicked() const -{ - XGUI_OperationMgr* anOperationMgr = operationMgr(); +void XGUI_Workshop::onHelpActionClicked() const { + XGUI_OperationMgr *anOperationMgr = operationMgr(); if (anOperationMgr) { - ModuleBase_Operation* aOperation = anOperationMgr->currentOperation(); + ModuleBase_Operation *aOperation = anOperationMgr->currentOperation(); if (aOperation) { showHelpPage(aOperation->helpFileName()); } } } -void XGUI_Workshop::showHelpPage(const QString& thePage) const -{ +void XGUI_Workshop::showHelpPage(const QString &thePage) const { if (!thePage.isEmpty()) { QString aDocDir; const QChar aSep = QDir::separator(); -// QString platform; -// SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); -//#ifdef WIN32 -// platform = "winapplication"; -//#else -// platform = "application"; -//#endif -// QString aBrowserName = aResMgr->stringValue("ExternalBrowser", platform); + // QString platform; + // SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); + //#ifdef WIN32 + // platform = "winapplication"; + //#else + // platform = "application"; + //#endif + // QString aBrowserName = aResMgr->stringValue("ExternalBrowser", + // platform); #ifdef HAVE_SALOME QString aDir(getenv("SHAPER_ROOT_DIR")); if (!aDir.isEmpty()) { - aDocDir = aDir + aSep + "share" + aSep + "doc" + aSep + - "salome" + aSep + "gui" + aSep + "SHAPER"; + aDocDir = aDir + aSep + "share" + aSep + "doc" + aSep + "salome" + aSep + + "gui" + aSep + "SHAPER"; } #else QString aDir(getenv("CADBUILDER_ROOT_DIR")); @@ -684,7 +694,7 @@ void XGUI_Workshop::showHelpPage(const QString& thePage) const QString aFileName = aDocDir + aSep + thePage; if (QFile::exists(aFileName)) { #ifdef HAVE_SALOME - SUIT_Application* app = SUIT_Session::session()->activeApplication(); + SUIT_Application *app = SUIT_Session::session()->activeApplication(); if (app) app->onHelpContextModule("SHAPER", aFileName); else { @@ -699,10 +709,9 @@ void XGUI_Workshop::showHelpPage(const QString& thePage) const } } - //****************************************************** -void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer) -{ +void XGUI_Workshop::deactivateActiveObject(const ObjectPtr &theObject, + const bool theUpdateViewer) { if (!myModule->canActivateSelection(theObject)) { if (selectionActivate()->isActive(theObject)) { QObjectPtrList anObjects; @@ -713,37 +722,37 @@ void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const boo } //****************************************************** -bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr& theFeature) -{ +bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr &theFeature) { bool aHasNested = false; std::string aFeatureKind = theFeature->getKind(); #ifdef HAVE_SALOME - XGUI_SalomeConnector* aSalomeConnector = salomeConnector(); - if (aSalomeConnector->isFeatureOfNested(actionsMgr()->action(aFeatureKind.c_str()))) - aHasNested = true; + XGUI_SalomeConnector *aSalomeConnector = salomeConnector(); + if (aSalomeConnector->isFeatureOfNested( + actionsMgr()->action(aFeatureKind.c_str()))) + aHasNested = true; #else - AppElements_MainMenu* aMenuBar = mainWindow()->menuObject(); - AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str()); - if (aCommand && aCommand->button()->additionalButtonWidget()) - aHasNested = true; + AppElements_MainMenu *aMenuBar = mainWindow()->menuObject(); + AppElements_Command *aCommand = aMenuBar->feature(aFeatureKind.c_str()); + if (aCommand && aCommand->button()->additionalButtonWidget()) + aHasNested = true; #endif return aHasNested; } //****************************************************** -void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); +void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (!aFOperation) return; myPropertyPanel->cleanContent(); - QList aWidgets; + QList aWidgets; QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); if (!module()->createWidgets(aFOperation->feature(), aXmlRepr, aWidgets)) { - ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myModuleConnector); + ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), + myModuleConnector); aFactory.createWidget(myPropertyPanel->contentWidget()); aWidgets = aFactory.getModelWidgets(); } @@ -751,13 +760,17 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) // check compatibility of feature and widgets FeaturePtr aFeature = aFOperation->feature(); std::string aFeatureKind = aFeature->getKind(); - foreach (ModuleBase_ModelWidget* aWidget, aWidgets) { + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { if (aWidget->usesAttribute()) { - if (!aWidget->attributeID().empty() && !aFeature->attribute(aWidget->attributeID()).get()) { - std::string anErrorMsg = "The feature '%1' has no attribute '%2' used by widget '%3'."; + if (!aWidget->attributeID().empty() && + !aFeature->attribute(aWidget->attributeID()).get()) { + std::string anErrorMsg = + "The feature '%1' has no attribute '%2' used by widget '%3'."; Events_InfoMessage("XGUI_Workshop", anErrorMsg) - .arg(aFeatureKind).arg(aWidget->attributeID()) - .arg(aWidget->metaObject()->className()).send(); + .arg(aFeatureKind) + .arg(aWidget->attributeID()) + .arg(aWidget->metaObject()->className()) + .send(); myPropertyPanel->cleanContent(); return; } @@ -765,7 +778,7 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) } // for performance purpose, flush should be done after all controls are filled bool isUpdateFlushed = false; - foreach (ModuleBase_ModelWidget* aWidget, aWidgets) { + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { bool isStoreValue = !aFOperation->isEditOperation() && !aWidget->getDefaultValue().empty() && !aWidget->isComputedDefault(); @@ -779,8 +792,8 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) #ifdef HAVE_SALOME aFeatureInfo = mySalomeConnector->featureInfo(aFeatureKind.c_str()); #else - AppElements_MainMenu* aMenuBar = mainWindow()->menuObject(); - AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str()); + AppElements_MainMenu *aMenuBar = mainWindow()->menuObject(); + AppElements_Command *aCommand = aMenuBar->feature(aFeatureKind.c_str()); if (aCommand) aFeatureInfo = aCommand->featureMessage(); #endif @@ -792,15 +805,16 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) std::string aXmlCfg, aDescription; module()->getXMLRepresentation(aFeatureKind, aXmlCfg, aDescription); ModuleBase_WidgetFactory aFactory(aXmlCfg, moduleConnector()); - anIsAutoPreview = aFactory.widgetAPI()->getBooleanAttribute(FEATURE_AUTO_PREVIEW, true); + anIsAutoPreview = + aFactory.widgetAPI()->getBooleanAttribute(FEATURE_AUTO_PREVIEW, true); } if (!anIsAutoPreview) { myPropertyPanel->findButton(PROP_PANEL_PREVIEW)->setVisible(true); - // send signal about preview should not be computed automatically, click on preview - // button should initiate it + // send signal about preview should not be computed automatically, click on + // preview button should initiate it std::shared_ptr aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_PREVIEW_BLOCKED))); + new Events_Message(Events_Loop::eventByName(EVENT_PREVIEW_BLOCKED))); Events_Loop::loop()->send(aMsg); } // if update happens after preview is blocked, it does nothing when blocked @@ -813,56 +827,63 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) myModule->propertyPanelDefined(theOperation); #ifndef DEBUG_FEATURE_NAME - myPropertyPanel->setWindowTitle(ModuleBase_Tools::translate("workshop", - theOperation->getDescription()->description().toStdString())); + myPropertyPanel->setWindowTitle(ModuleBase_Tools::translate( + "workshop", theOperation->getDescription()->description().toStdString())); #else std::string aFeatureName = aFeature->name(); - myPropertyPanel->setWindowTitle(QString("%1: %2") - .arg(translate(theOperation->getDescription()->description())) - .arg(translate(aFeatureName.c_str()))); + myPropertyPanel->setWindowTitle( + QString("%1: %2") + .arg(translate(theOperation->getDescription()->description())) + .arg(translate(aFeatureName.c_str()))); #endif myErrorMgr->setPropertyPanel(myPropertyPanel); if (Config_PropManager::boolean("Windows", "use_hide_faces_panel")) { theOperation->setHideFacesVisible(myFacesPanel->isVisible()); - if (aFeatureInfo.get() && aFeatureInfo->isHideFacesPanel() && !myFacesPanel->isVisible()) + if (aFeatureInfo.get() && aFeatureInfo->isHideFacesPanel() && + !myFacesPanel->isVisible()) myFacesPanel->show(); } showPanel(myPropertyPanel); } //****************************************************** -void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect) -{ - XGUI_PropertyPanel* aPropertyPanel = propertyPanel(); +void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect) { + XGUI_PropertyPanel *aPropertyPanel = propertyPanel(); if (aPropertyPanel) { - const QList& aWidgets = aPropertyPanel->modelWidgets(); - foreach (ModuleBase_ModelWidget* aWidget, aWidgets) { - myModule->connectToPropertyPanel(aWidget, isToConnect); - if (isToConnect) { - connect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int))); - connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged())); - connect(aWidget, SIGNAL(objectUpdated()), this, SLOT(onWidgetObjectUpdated())); - } - else { - disconnect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int))); - disconnect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged())); - disconnect(aWidget, SIGNAL(objectUpdated()), this, SLOT(onWidgetObjectUpdated())); + const QList &aWidgets = + aPropertyPanel->modelWidgets(); + foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { + myModule->connectToPropertyPanel(aWidget, isToConnect); + if (isToConnect) { + connect(aWidget, SIGNAL(valueStateChanged(int)), this, + SLOT(onWidgetStateChanged(int))); + connect(aWidget, SIGNAL(valuesChanged()), this, + SLOT(onValuesChanged())); + connect(aWidget, SIGNAL(objectUpdated()), this, + SLOT(onWidgetObjectUpdated())); + } else { + disconnect(aWidget, SIGNAL(valueStateChanged(int)), this, + SLOT(onWidgetStateChanged(int))); + disconnect(aWidget, SIGNAL(valuesChanged()), this, + SLOT(onValuesChanged())); + disconnect(aWidget, SIGNAL(objectUpdated()), this, + SLOT(onWidgetObjectUpdated())); } } } } //****************************************************** -void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation) -{ +void XGUI_Workshop::onOperationResumed(ModuleBase_Operation *theOperation) { setGrantedFeatures(theOperation); - if (theOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel + if (theOperation->getDescription() + ->hasXmlRepresentation()) { //!< No need for property panel fillPropertyPanel(theOperation); connectToPropertyPanel(true); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (aFOperation) myPropertyPanel->updateApplyPlusButton(aFOperation->feature()); else @@ -874,16 +895,15 @@ void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation) } //****************************************************** -void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) -{ +void XGUI_Workshop::onOperationStopped(ModuleBase_Operation *theOperation) { updateCommandStatus(); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (!aFOperation) return; - ModuleBase_ISelection* aSel = mySelector->selection(); + ModuleBase_ISelection *aSel = mySelector->selection(); QObjectPtrList aObj = aSel->selectedPresentations(); //!< No need for property panel hidePanel(myPropertyPanel); @@ -897,14 +917,16 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) QObjectPtrList anObjects; FeaturePtr aFeature = aFOperation->feature(); if (aFeature.get()) { // feature may be not created (plugin load fail) - if (myDisplayer->isVisible(aFeature) && !selectionActivate()->isActive(aFeature)) + if (myDisplayer->isVisible(aFeature) && + !selectionActivate()->isActive(aFeature)) anObjects.append(aFeature); std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); std::list::const_iterator aIt; for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { ResultPtr anObject = *aIt; - if (myDisplayer->isVisible(anObject) && !selectionActivate()->isActive(anObject)) { + if (myDisplayer->isVisible(anObject) && + !selectionActivate()->isActive(anObject)) { anObjects.append(anObject); } } @@ -918,37 +940,33 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) } //****************************************************** -void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation* theOperation) -{ +void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation *theOperation) { myModule->operationCommitted(theOperation); } //****************************************************** -void XGUI_Workshop::onOperationAborted(ModuleBase_Operation* theOperation) -{ +void XGUI_Workshop::onOperationAborted(ModuleBase_Operation *theOperation) { myModule->operationAborted(theOperation); } //****************************************************** -void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation) -{ - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); +void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation *theOperation) { + ModuleBase_OperationFeature *aFOperation = + dynamic_cast(theOperation); if (!aFOperation) return; QStringList aGrantedIds; if (isSalomeMode()) { - const std::shared_ptr& anInfo = - mySalomeConnector->featureInfo(theOperation->id()); + const std::shared_ptr &anInfo = + mySalomeConnector->featureInfo(theOperation->id()); if (anInfo.get()) aGrantedIds = QString::fromStdString(anInfo->nestedFeatures()) - .split(" ", QString::SkipEmptyParts); - } - else + .split(" ", QString::SkipEmptyParts); + } else aGrantedIds = myActionsMgr->nestedCommands(theOperation->id()); - ModuleBase_IModule* aModule = module(); + ModuleBase_IModule *aModule = module(); if (aModule) aModule->grantedOperationIds(theOperation, aGrantedIds); @@ -956,8 +974,8 @@ void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation) } //****************************************************** -void XGUI_Workshop::saveDocument(const QString& theName, std::list& theFileNames) -{ +void XGUI_Workshop::saveDocument(const QString &theName, + std::list &theFileNames) { QApplication::restoreOverrideCursor(); SessionPtr aMgr = ModelAPI_Session::get(); @@ -974,35 +992,33 @@ void XGUI_Workshop::saveDocument(const QString& theName, std::list& } //****************************************************** -bool XGUI_Workshop::abortAllOperations() -{ +bool XGUI_Workshop::abortAllOperations() { return myOperationMgr->abortAllOperations(); } //****************************************************** -void XGUI_Workshop::operationStarted(ModuleBase_Operation* theOperation) -{ +void XGUI_Workshop::operationStarted(ModuleBase_Operation *theOperation) { setGrantedFeatures(theOperation); - if (!theOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel + if (!theOperation->getDescription() + ->hasXmlRepresentation()) { //!< No need for property panel updateCommandStatus(); - } - else { + } else { myModule->operationStarted(theOperation); } } //****************************************************** -void XGUI_Workshop::onOpen() -{ - if(!abortAllOperations()) +void XGUI_Workshop::onOpen() { + if (!abortAllOperations()) return; - //save current file before close if modified + // save current file before close if modified SessionPtr aSession = ModelAPI_Session::get(); if (aSession->isModified()) { int anAnswer = QMessageBox::question( desktop(), tr("Save current file"), tr("The document is modified, save before opening another?"), - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, + QMessageBox::Cancel); if (anAnswer == QMessageBox::Save) { onSave(); } else if (anAnswer == QMessageBox::Cancel) { @@ -1011,26 +1027,28 @@ void XGUI_Workshop::onOpen() myCurrentFile = QString(); } - //show file dialog, check if readable and open + // show file dialog, check if readable and open qreal aRatio = ModuleBase_Tools::currentPixelRatio(); // If the ratio is > 1 (HD screen) then QT has a bug in // displaying of system open file dialog (too small) - QString aFile = QFileDialog::getOpenFileName(desktop(), tr("Open file"), QString(), MyFilter, - Q_NULLPTR, ((aRatio > 1)? QFileDialog::DontUseNativeDialog : QFileDialog::Options())); + QString aFile = QFileDialog::getOpenFileName( + desktop(), tr("Open file"), QString(), MyFilter, Q_NULLPTR, + ((aRatio > 1) ? QFileDialog::DontUseNativeDialog + : QFileDialog::Options())); if (!aFile.isNull()) openFile(aFile); } //****************************************************** -void XGUI_Workshop::openFile(const QString& theDirectory) -{ +void XGUI_Workshop::openFile(const QString &theDirectory) { myCurrentFile = theDirectory; if (myCurrentFile.isEmpty()) return; QFileInfo aFileInfo(myCurrentFile); if (!aFileInfo.exists() || !aFileInfo.isReadable()) { - QMessageBox::critical(desktop(), tr("Warning"), tr("Unable to open the file.")); + QMessageBox::critical(desktop(), tr("Warning"), + tr("Unable to open the file.")); myCurrentFile = QString(); return; } @@ -1059,34 +1077,39 @@ void XGUI_Workshop::openFile(const QString& theDirectory) #endif #ifdef _DEBUG - bool aNewPart = Config_PropManager::boolean("Plugins", "create_part_by_start"); + bool aNewPart = + Config_PropManager::boolean("Plugins", "create_part_by_start"); if (aNewPart) { int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); - if (aSize > 0 ) { + if (aSize > 0) { ObjectPtr anObject = aRootDoc->object(ModelAPI_ResultPart::group(), 0); - ResultPartPtr aPart = std::dynamic_pointer_cast(anObject); + ResultPartPtr aPart = + std::dynamic_pointer_cast(anObject); if (aPart.get()) aPart->activate(); } } #endif - int anActivationId = - ModuleBase_Preferences::resourceMgr()->integerValue("General", "part_activation_study", -1); + int anActivationId = ModuleBase_Preferences::resourceMgr()->integerValue( + "General", "part_activation_study", -1); int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); if (anActivationId == 0 && aSize > 0) { - ObjectPtr anObject = aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); - ResultPartPtr aPart = std::dynamic_pointer_cast(anObject); + ObjectPtr anObject = + aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); + ResultPartPtr aPart = + std::dynamic_pointer_cast(anObject); if (aPart.get()) { aPart->activate(); ModuleBase_Tools::setDisplaying(aPart); } - } - else if (anActivationId == 1) { + } else if (anActivationId == 1) { for (int anIndex = 0; anIndex < aSize; ++anIndex) { - ObjectPtr anObject = aRootDoc->object(ModelAPI_ResultPart::group(), anIndex); - ResultPartPtr aPart = std::dynamic_pointer_cast(anObject); + ObjectPtr anObject = + aRootDoc->object(ModelAPI_ResultPart::group(), anIndex); + ResultPartPtr aPart = + std::dynamic_pointer_cast(anObject); if (aPart.get()) { aPart->activate(); ModuleBase_Tools::setDisplaying(aPart); @@ -1106,8 +1129,7 @@ void XGUI_Workshop::openFile(const QString& theDirectory) } //****************************************************** -void XGUI_Workshop::onNew() -{ +void XGUI_Workshop::onNew() { QApplication::setOverrideCursor(Qt::WaitCursor); if (objectBrowser() == 0) { createDockWidgets(); @@ -1117,10 +1139,10 @@ void XGUI_Workshop::onNew() showObjectBrowser(); #ifndef HAVE_SALOME myMainWindow->showPythonConsole(); - QMdiSubWindow* aWnd = myMainWindow->viewer()->createView(); + QMdiSubWindow *aWnd = myMainWindow->viewer()->createView(); aWnd->showMaximized(); updateCommandStatus(); - PyConsole_Console* aConsole = myMainWindow->pythonConsole(); + PyConsole_Console *aConsole = myMainWindow->pythonConsole(); connect(aConsole, SIGNAL(scriptLoaded()), SLOT(updateCommandStatus())); #endif myContextMenuMgr->connectViewer(); @@ -1129,13 +1151,14 @@ void XGUI_Workshop::onNew() #ifndef HAVE_SALOME //****************************************************** -void XGUI_Workshop::onExit() -{ +void XGUI_Workshop::onExit() { SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->isModified()) { int anAnswer = QMessageBox::question( - myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"), - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel); + myMainWindow, tr("Save current file"), + tr("The document is modified, save before exit?"), + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, + QMessageBox::Cancel); if (anAnswer == QMessageBox::Save) { bool saved = onSave(); if (!saved) { @@ -1149,8 +1172,7 @@ void XGUI_Workshop::onExit() } //****************************************************** -void XGUI_Workshop::onPreferences() -{ +void XGUI_Workshop::onPreferences() { ModuleBase_Prefs aModif; ModuleBase_Preferences::editPreferences(aModif); if (aModif.size() > 0) { @@ -1161,19 +1183,19 @@ void XGUI_Workshop::onPreferences() myMainWindow->viewer()->updateFromResources(); } else if (aSection == ModuleBase_Preferences::MENU_SECTION) { myMainWindow->menuObject()->updateFromResources(); - } - else if (aSection == ModuleBase_Preferences::GENERAL_SECTION && aPref.second == "create_init_part") { + } else if (aSection == ModuleBase_Preferences::GENERAL_SECTION && + aPref.second == "create_init_part") { bool aCreate = ModuleBase_Preferences::resourceMgr()->booleanValue( - ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true); - Events_MessageBool aCreateMsg(Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate); + ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true); + Events_MessageBool aCreateMsg( + Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate); aCreateMsg.send(); } } std::vector aColor; try { aColor = Config_PropManager::color("Visualization", "selection_color"); - } - catch (...) { + } catch (...) { } if (aColor.size() == 3) displayer()->setSelectionColor(aColor); @@ -1184,9 +1206,8 @@ void XGUI_Workshop::onPreferences() #endif //****************************************************** -void XGUI_Workshop::onTrihedronVisibilityChanged(bool theState) -{ - XGUI_Displayer* aDisplayer = displayer(); +void XGUI_Workshop::onTrihedronVisibilityChanged(bool theState) { + XGUI_Displayer *aDisplayer = displayer(); if (aDisplayer) { aDisplayer->displayTrihedron(theState); aDisplayer->updateViewer(); @@ -1194,9 +1215,9 @@ void XGUI_Workshop::onTrihedronVisibilityChanged(bool theState) } //****************************************************** -bool XGUI_Workshop::onSave() -{ - if(!myOperationMgr->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage)) +bool XGUI_Workshop::onSave() { + if (!myOperationMgr->abortAllOperations( + XGUI_OperationMgr::XGUI_InformationMessage)) return false; if (myCurrentFile.isEmpty()) { return onSaveAs(); @@ -1226,86 +1247,81 @@ bool XGUI_Workshop::onSave() } //****************************************************** -bool XGUI_Workshop::onSaveAs() -{ - if(!myOperationMgr->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage)) +bool XGUI_Workshop::onSaveAs() { + if (!myOperationMgr->abortAllOperations( + XGUI_OperationMgr::XGUI_InformationMessage)) return false; qreal aRatio = ModuleBase_Tools::currentPixelRatio(); - myCurrentFile = QFileDialog::getSaveFileName(desktop(), tr("Select name to save file..."), - QString(), MyFilter2, - Q_NULLPTR, ((aRatio > 1) ? QFileDialog::DontUseNativeDialog : QFileDialog::Options())); + myCurrentFile = QFileDialog::getSaveFileName( + desktop(), tr("Select name to save file..."), QString(), MyFilter2, + Q_NULLPTR, + ((aRatio > 1) ? QFileDialog::DontUseNativeDialog + : QFileDialog::Options())); if (!myCurrentFile.isNull()) { if (!myCurrentFile.endsWith(MyExtension)) { myCurrentFile += MyExtension; } - } - else + } else return false; #ifndef HAVE_SALOME - myMainWindow->setCurrentDir(myCurrentFile, false); - myMainWindow->setModifiedState(false); + myMainWindow->setCurrentDir(myCurrentFile, false); + myMainWindow->setModifiedState(false); #endif return onSave(); } //****************************************************** -void XGUI_Workshop::onUndo(int theTimes) -{ +void XGUI_Workshop::onUndo(int theTimes) { processUndoRedo(ActionUndo, theTimes); myObjectBrowser->updateAllIndexes(1); } //****************************************************** -void XGUI_Workshop::onRedo(int theTimes) -{ +void XGUI_Workshop::onRedo(int theTimes) { processUndoRedo(ActionRedo, theTimes); myObjectBrowser->updateAllIndexes(1); } //****************************************************** -void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, int theTimes) -{ - ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget(); +void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, + int theTimes) { + ModuleBase_ModelWidget *anActiveWidget = myOperationMgr->activeWidget(); if (anActiveWidget) { ActionIntParamPtr aParam(new ModuleBase_ActionIntParameter(theTimes)); if (anActiveWidget->processAction(theActionType, aParam)) return; - } - else - { - XGUI_FacesPanel * anFacePannel = facesPanel(); - if(ActionUndo == theActionType && anFacePannel->isActivePanel()) - { + } else { + XGUI_FacesPanel *anFacePannel = facesPanel(); + if (ActionUndo == theActionType && anFacePannel->isActivePanel()) { anFacePannel->processUndo(); return; } } - // the viewer update should be blocked in order to avoid the features blinking. For the created - // feature a results are created, the flush of the created signal caused the viewer redisplay for - // each created result. After a redisplay signal is flushed. So, the viewer update is blocked - // until redo of all possible objects happens + // the viewer update should be blocked in order to avoid the features + // blinking. For the created feature a results are created, the flush of the + // created signal caused the viewer redisplay for each created result. After a + // redisplay signal is flushed. So, the viewer update is blocked until redo of + // all possible objects happens bool isUpdateEnabled = myDisplayer->enableUpdateViewer(false); int aTimes = theTimes; SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->isOperation()) { - XGUI_OperationMgr* aOpMgr = operationMgr(); + XGUI_OperationMgr *aOpMgr = operationMgr(); /// this is important for nested operations /// when sketch operation is active, this condition is false and /// the sketch operation is not aborted if (aOpMgr->canStopOperation(aOpMgr->currentOperation())) { aOpMgr->abortOperation(aOpMgr->currentOperation()); aTimes--; - } - else - { + } else { myDisplayer->enableUpdateViewer(isUpdateEnabled); return; } } objectBrowser()->treeView()->setCurrentIndex(QModelIndex()); - std::list anActionList = theActionType == ActionUndo ? aMgr->undoList() - : aMgr->redoList(); + std::list anActionList = + theActionType == ActionUndo ? aMgr->undoList() : aMgr->redoList(); std::list::const_iterator aIt = anActionList.cbegin(); for (int i = 0; (i < aTimes) && (aIt != anActionList.cend()); ++i, ++aIt) { if (theActionType == ActionUndo) @@ -1322,7 +1338,7 @@ void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, i updateCommandStatus(); QObjectPtrList aList = myDisplayer->displayedObjects(); - foreach(ObjectPtr aObj, aList) { + foreach (ObjectPtr aObj, aList) { module()->customizePresentation(aObj, myDisplayer->getAISObject(aObj)); } @@ -1334,15 +1350,14 @@ void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, i } //****************************************************** -void XGUI_Workshop::onWidgetStateChanged(int thePreviousState) -{ - ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget(); - //ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); - //if (anOperation) { - // ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); - // if (aPanel) - // anActiveWidget = aPanel->activeWidget(); - //} +void XGUI_Workshop::onWidgetStateChanged(int thePreviousState) { + ModuleBase_ModelWidget *anActiveWidget = myOperationMgr->activeWidget(); + // ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); + // if (anOperation) { + // ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + // if (aPanel) + // anActiveWidget = aPanel->activeWidget(); + // } if (anActiveWidget) operationMgr()->onValidateOperation(); @@ -1350,105 +1365,103 @@ void XGUI_Workshop::onWidgetStateChanged(int thePreviousState) } //****************************************************** -void XGUI_Workshop::onValuesChanged() -{ - ModuleBase_ModelWidget* aSenderWidget = (ModuleBase_ModelWidget*)(sender()); +void XGUI_Workshop::onValuesChanged() { + ModuleBase_ModelWidget *aSenderWidget = (ModuleBase_ModelWidget *)(sender()); if (!aSenderWidget || aSenderWidget->canAcceptFocus()) return; - ModuleBase_ModelWidget* anActiveWidget = 0; - ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); + ModuleBase_ModelWidget *anActiveWidget = 0; + ModuleBase_Operation *anOperation = myOperationMgr->currentOperation(); if (anOperation) { - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); if (aPanel) anActiveWidget = aPanel->activeWidget(); } if (anActiveWidget) { - ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast - (anActiveWidget); + ModuleBase_WidgetValidated *aWidgetValidated = + dynamic_cast(anActiveWidget); if (aWidgetValidated) aWidgetValidated->clearValidatedCash(); } } //****************************************************** -void XGUI_Workshop::onWidgetObjectUpdated() -{ +void XGUI_Workshop::onWidgetObjectUpdated() { operationMgr()->onValidateOperation(); myDisplayer->updateViewer(); } //****************************************************** -void XGUI_Workshop::onImportPart() -{ +void XGUI_Workshop::onImportPart() { if (abortAllOperations()) { - ModuleBase_OperationFeature* anImportPartOp = dynamic_cast( - module()->createOperation(ExchangePlugin_ImportPart::ID())); - anImportPartOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + - "importFeature.html"); + ModuleBase_OperationFeature *anImportPartOp = + dynamic_cast( + module()->createOperation(ExchangePlugin_ImportPart::ID())); + anImportPartOp->setHelpFileName(QString("ExchangePlugin") + + QDir::separator() + "importFeature.html"); myPropertyPanel->updateApplyPlusButton(anImportPartOp->feature()); operationMgr()->startOperation(anImportPartOp); } } //****************************************************** -void XGUI_Workshop::onImportShape() -{ +void XGUI_Workshop::onImportShape() { if (abortAllOperations()) { - ModuleBase_OperationFeature* anImportOp = dynamic_cast( - module()->createOperation(ExchangePlugin_Import::ID())); + ModuleBase_OperationFeature *anImportOp = + dynamic_cast( + module()->createOperation(ExchangePlugin_Import::ID())); anImportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + - "importFeature.html"); + "importFeature.html"); myPropertyPanel->updateApplyPlusButton(anImportOp->feature()); operationMgr()->startOperation(anImportOp); } } //****************************************************** -void XGUI_Workshop::onImportImage() -{ +void XGUI_Workshop::onImportImage() { if (abortAllOperations()) { - ModuleBase_OperationFeature* anImportOp = dynamic_cast( - module()->createOperation(ExchangePlugin_Import_Image::ID())); + ModuleBase_OperationFeature *anImportOp = + dynamic_cast( + module()->createOperation(ExchangePlugin_Import_Image::ID())); anImportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + - "importFeature.html"); + "importFeature.html"); myPropertyPanel->updateApplyPlusButton(anImportOp->feature()); operationMgr()->startOperation(anImportOp); } } //****************************************************** -void XGUI_Workshop::onExportShape() -{ +void XGUI_Workshop::onExportShape() { if (abortAllOperations()) { - ModuleBase_OperationFeature* anExportOp = dynamic_cast( - module()->createOperation(ExchangePlugin_ExportFeature::ID())); + ModuleBase_OperationFeature *anExportOp = + dynamic_cast( + module()->createOperation(ExchangePlugin_ExportFeature::ID())); anExportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + - "exportFeature.html"); + "exportFeature.html"); myPropertyPanel->updateApplyPlusButton(anExportOp->feature()); operationMgr()->startOperation(anExportOp); } } //****************************************************** -void XGUI_Workshop::onExportPart() -{ +void XGUI_Workshop::onExportPart() { if (abortAllOperations()) { - ModuleBase_OperationFeature* anExportPartOp = dynamic_cast( - module()->createOperation(ExchangePlugin_ExportPart::ID())); - anExportPartOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + - "exportFeature.html"); + ModuleBase_OperationFeature *anExportPartOp = + dynamic_cast( + module()->createOperation(ExchangePlugin_ExportPart::ID())); + anExportPartOp->setHelpFileName(QString("ExchangePlugin") + + QDir::separator() + "exportFeature.html"); myPropertyPanel->updateApplyPlusButton(anExportPartOp->feature()); operationMgr()->startOperation(anExportPartOp); } } //****************************************************** -ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule) -{ +ModuleBase_IModule *XGUI_Workshop::loadModule(const QString &theModule) { QString libName = QString::fromStdString(library(theModule.toStdString())); if (libName.isEmpty()) { - qWarning(qPrintable(tr("Information about module \"%1\" doesn't exist.").arg(theModule))); + qWarning(qPrintable( + tr("Information about module \"%1\" doesn't exist.").arg(theModule))); return 0; } @@ -1459,38 +1472,43 @@ ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule) HINSTANCE modLib = ::LoadLibraryA(qPrintable(libName)); if (!modLib) { LPVOID lpMsgBuf; - ::FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0); - QString aMsg((char*) &lpMsgBuf); + ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0); + QString aMsg((char *)&lpMsgBuf); err = QString("Failed to load %1. %2").arg(libName).arg(aMsg); ::LocalFree(lpMsgBuf); } else { - crtInst = (CREATE_FUNC) ::GetProcAddress(modLib, CREATE_MODULE); + crtInst = (CREATE_FUNC)::GetProcAddress(modLib, CREATE_MODULE); if (!crtInst) { LPVOID lpMsgBuf; - ::FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS, - 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0); - QString aMsg((char*) &lpMsgBuf); - err = QString("Failed to find %1 function. %2").arg( CREATE_MODULE).arg(aMsg); + ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0); + QString aMsg((char *)&lpMsgBuf); + err = QString("Failed to find %1 function. %2") + .arg(CREATE_MODULE) + .arg(aMsg); ::LocalFree(lpMsgBuf); } } #else - void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY | RTLD_GLOBAL ); - if ( !modLib ) { - err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() ); + void *modLib = dlopen(libName.toLatin1(), RTLD_LAZY | RTLD_GLOBAL); + if (!modLib) { + err = QString("Can not load library %1. %2").arg(libName).arg(dlerror()); } else { - crtInst = (CREATE_FUNC)dlsym( modLib, CREATE_MODULE ); - if ( !crtInst ) { - err = QString( "Failed to find function %1. %2" ).arg( CREATE_MODULE ).arg( dlerror() ); + crtInst = (CREATE_FUNC)dlsym(modLib, CREATE_MODULE); + if (!crtInst) { + err = QString("Failed to find function %1. %2") + .arg(CREATE_MODULE) + .arg(dlerror()); } } #endif - ModuleBase_IModule* aModule = crtInst ? crtInst(myModuleConnector) : 0; + ModuleBase_IModule *aModule = crtInst ? crtInst(myModuleConnector) : 0; if (!err.isEmpty()) { if (desktop()) { @@ -1503,72 +1521,71 @@ ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule) } //****************************************************** -bool XGUI_Workshop::createModule() -{ +bool XGUI_Workshop::createModule() { Config_ModuleReader aModuleReader; QString moduleName = QString::fromStdString(aModuleReader.getModuleName()); myModule = loadModule(moduleName); if (!myModule) return false; - //connect(myDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)), - // myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr))); - //connect(myDisplayer, SIGNAL(beforeObjectErase(ObjectPtr, AISObjectPtr)), - // myModule, SLOT(onBeforeObjectErase(ObjectPtr, AISObjectPtr))); + // connect(myDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)), + // myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr))); + // connect(myDisplayer, SIGNAL(beforeObjectErase(ObjectPtr, AISObjectPtr)), + // myModule, SLOT(onBeforeObjectErase(ObjectPtr, AISObjectPtr))); myModule->createFeatures(); #ifdef HAVE_SALOME salomeConnector()->createFeatureActions(); #endif - //myActionsMgr->update(); + // myActionsMgr->update(); return true; } //****************************************************** -void XGUI_Workshop::updateCommandStatus() -{ - QList aCommands; +void XGUI_Workshop::updateCommandStatus() { + QList aCommands; #ifdef HAVE_SALOME - aCommands = salomeConnector()->commandList(); + aCommands = salomeConnector()->commandList(); #else - AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); - foreach (AppElements_Command* aCmd, aMenuBar->features()) - aCommands.append(aCmd); + AppElements_MainMenu *aMenuBar = myMainWindow->menuObject(); + foreach (AppElements_Command *aCmd, aMenuBar->features()) + aCommands.append(aCmd); #endif SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->hasModuleDocument()) { - foreach(QAction* aCmd, aCommands) { + foreach (QAction *aCmd, aCommands) { QString aId = aCmd->data().toString(); if (aId == "UNDO_CMD") { bool isActionEnabled = false; - // if ultimate is true -> using result of operation only, or using OR combination - ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget(); - if (anActiveWidget && anActiveWidget->canProcessAction(ActionUndo, isActionEnabled)) + // if ultimate is true -> using result of operation only, or using OR + // combination + ModuleBase_ModelWidget *anActiveWidget = myOperationMgr->activeWidget(); + if (anActiveWidget && + anActiveWidget->canProcessAction(ActionUndo, isActionEnabled)) aCmd->setEnabled(isActionEnabled); else aCmd->setEnabled(myModule->canUndo()); - } - else if (aId == "REDO_CMD") { + } else if (aId == "REDO_CMD") { bool isActionEnabled = false; - // if ultimate is true -> using result of operation only, or using OR combination - ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget(); - if (anActiveWidget && anActiveWidget->canProcessAction(ActionRedo, isActionEnabled)) + // if ultimate is true -> using result of operation only, or using OR + // combination + ModuleBase_ModelWidget *anActiveWidget = myOperationMgr->activeWidget(); + if (anActiveWidget && + anActiveWidget->canProcessAction(ActionRedo, isActionEnabled)) aCmd->setEnabled(isActionEnabled); else aCmd->setEnabled(myModule->canRedo()); - } - else if (aId == "AUTOCOMPUTE_CMD") { - aCmd->setIcon(aMgr->isAutoUpdateBlocked() ? - QIcon(":pictures/autoapply_stop.png") : - QIcon(":pictures/autoapply_start.png")); - } - else + } else if (aId == "AUTOCOMPUTE_CMD") { + aCmd->setIcon(aMgr->isAutoUpdateBlocked() + ? QIcon(":pictures/autoapply_stop.png") + : QIcon(":pictures/autoapply_start.png")); + } else // Enable all commands aCmd->setEnabled(true); } updateHistory(); } else { - foreach(QAction* aCmd, aCommands) { + foreach (QAction *aCmd, aCommands) { QString aId = aCmd->data().toString(); if (aId == "NEW_CMD") aCmd->setEnabled(true); @@ -1583,13 +1600,13 @@ void XGUI_Workshop::updateCommandStatus() } //****************************************************** -void XGUI_Workshop::updateHistory() -{ +void XGUI_Workshop::updateHistory() { bool isActionEnabled = false; - ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget(); + ModuleBase_ModelWidget *anActiveWidget = myOperationMgr->activeWidget(); QList aUndoRes; QList aRedoRes; - if (anActiveWidget && anActiveWidget->canProcessAction(ActionUndo, isActionEnabled)) { + if (anActiveWidget && + anActiveWidget->canProcessAction(ActionUndo, isActionEnabled)) { aUndoRes = anActiveWidget->actionsList(ActionUndo); aRedoRes = anActiveWidget->actionsList(ActionRedo); } else { @@ -1604,14 +1621,12 @@ void XGUI_Workshop::updateHistory() } //****************************************************** -QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent) -{ - QDockWidget* aObjDock = new QDockWidget(theParent); - aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); +QDockWidget *XGUI_Workshop::createObjectBrowser(QWidget *theParent) { + QDockWidget *aObjDock = new QDockWidget(theParent); + aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); aObjDock->setWindowTitle(tr("Object browser")); - aObjDock->setStyleSheet( - "::title { position: relative; padding-left: 5px; text-align: left center }"); + aObjDock->setStyleSheet("::title { position: relative; padding-left: 5px; " + "text-align: left center }"); myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock, this); myObjectBrowser->initialize(myModule->rootNode()); myModule->customizeObjectBrowser(myObjectBrowser); @@ -1629,20 +1644,20 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent) * Creates dock widgets, places them in corresponding area * and tabifies if necessary. */ -void XGUI_Workshop::createDockWidgets() -{ - QMainWindow* aDesktop = desktop(); - QDockWidget* aObjDock = createObjectBrowser(aDesktop); +void XGUI_Workshop::createDockWidgets() { + QMainWindow *aDesktop = desktop(); + QDockWidget *aObjDock = createObjectBrowser(aDesktop); aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock); myPropertyPanel = new XGUI_PropertyPanel(aDesktop, myOperationMgr); - myActiveControlMgr->addSelector(new XGUI_PropertyPanelSelector(myPropertyPanel)); + myActiveControlMgr->addSelector( + new XGUI_PropertyPanelSelector(myPropertyPanel)); myPropertyPanel->setupActions(myActionsMgr); myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel); - hidePanel(myPropertyPanel); ///addSelector(new XGUI_FacesPanelSelector(myFacesPanel)); @@ -1653,22 +1668,23 @@ void XGUI_Workshop::createDockWidgets() myInspectionPanel = new XGUI_InspectionPanel(aDesktop, this); myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); + Qt::RightDockWidgetArea); aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel); myInspectionPanel->hide(); aDesktop->addDockWidget( #ifdef HAVE_SALOME - Qt::RightDockWidgetArea, + Qt::RightDockWidgetArea, #else - Qt::LeftDockWidgetArea, + Qt::LeftDockWidgetArea, #endif - myFacesPanel); - hidePanel(myFacesPanel); ///addDockWidget(Qt::RightDockWidgetArea, myFacesPanel); showPanel(myFacesPanel); @@ -1678,10 +1694,9 @@ void XGUI_Workshop::createDockWidgets() #ifndef HAVE_SALOME #ifdef _DEBUG - if (!aShowOnTheRight) - { + if (!aShowOnTheRight) { #endif // _DEBUG - aDesktop->tabifyDockWidget(myFacesPanel, aObjDock); + aDesktop->tabifyDockWidget(myFacesPanel, aObjDock); #ifdef _DEBUG } #endif // _DEBUG @@ -1691,32 +1706,37 @@ void XGUI_Workshop::createDockWidgets() aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel); myPropertyPanel->installEventFilter(myOperationMgr); - QAction* aOkAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); + QAction *aOkAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); connect(aOkAct, SIGNAL(triggered()), this, SLOT(onAcceptActionClicked())); - QAction* aOkContAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptPlus); - connect(aOkContAct, SIGNAL(triggered()), this, SLOT(onAcceptPlusActionClicked())); + QAction *aOkContAct = + myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptPlus); + connect(aOkContAct, SIGNAL(triggered()), this, + SLOT(onAcceptPlusActionClicked())); - QAction* aCancelAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort); - connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation())); + QAction *aCancelAct = + myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort); + connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, + SLOT(onAbortOperation())); - QAction* aPreviewAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Preview); - connect(aPreviewAct, SIGNAL(triggered()), this, SLOT(onPreviewActionClicked())); + QAction *aPreviewAct = + myActionsMgr->operationStateAction(XGUI_ActionsMgr::Preview); + connect(aPreviewAct, SIGNAL(triggered()), this, + SLOT(onPreviewActionClicked())); - QAction* aHelpAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Help); + QAction *aHelpAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Help); connect(aHelpAct, SIGNAL(triggered()), this, SLOT(onHelpActionClicked())); - connect(myPropertyPanel, SIGNAL(keyReleased(QObject*, QKeyEvent*)), - myOperationMgr, SLOT(onKeyReleased(QObject*, QKeyEvent*))); - connect(myPropertyPanel, SIGNAL(enterClicked(QObject*)), - myOperationMgr, SLOT(onProcessEnter(QObject*))); + connect(myPropertyPanel, SIGNAL(keyReleased(QObject *, QKeyEvent *)), + myOperationMgr, SLOT(onKeyReleased(QObject *, QKeyEvent *))); + connect(myPropertyPanel, SIGNAL(enterClicked(QObject *)), myOperationMgr, + SLOT(onProcessEnter(QObject *))); } //****************************************************** -void XGUI_Workshop::showPanel(QDockWidget* theDockWidget) -{ +void XGUI_Workshop::showPanel(QDockWidget *theDockWidget) { if (theDockWidget == myPropertyPanel) { - QAction* aViewAct = myPropertyPanel->toggleViewAction(); + QAction *aViewAct = myPropertyPanel->toggleViewAction(); ///setEnabled(true); } @@ -1727,16 +1747,16 @@ void XGUI_Workshop::showPanel(QDockWidget* theDockWidget) // in order to operation manager could process key events of the panel. // otherwise they are ignored. It happens only if the same(activateWindow) is // not happened by property panel activation(e.g. resume operation of Sketch) - //ModuleBase_Tools::setFocus(theDockWidget, "XGUI_Workshop::showPanel()"); + // ModuleBase_Tools::setFocus(theDockWidget, "XGUI_Workshop::showPanel()"); } //****************************************************** -void XGUI_Workshop::hidePanel(QDockWidget* theDockWidget) -{ - if (!theDockWidget) return; +void XGUI_Workshop::hidePanel(QDockWidget *theDockWidget) { + if (!theDockWidget) + return; if (theDockWidget == myPropertyPanel) { - QAction* aViewAct = theDockWidget->toggleViewAction(); + QAction *aViewAct = theDockWidget->toggleViewAction(); ///setEnabled(false); } @@ -1750,40 +1770,35 @@ void XGUI_Workshop::hidePanel(QDockWidget* theDockWidget) // set the focus on it. As a result, shortcuts of the application, like // are processed by this console. For example Undo actions. // It is possible that this code is to be moved to SHAPER package - QMainWindow* aDesktop = desktop(); + QMainWindow *aDesktop = desktop(); ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::hidePanel()"); } //****************************************************** -void XGUI_Workshop::showObjectBrowser() -{ +void XGUI_Workshop::showObjectBrowser() { if (!isSalomeMode()) { myObjectBrowser->parentWidget()->show(); } } //****************************************************** -void XGUI_Workshop::hideObjectBrowser() -{ +void XGUI_Workshop::hideObjectBrowser() { if (!isSalomeMode()) myObjectBrowser->parentWidget()->hide(); } //****************************************************** -void XGUI_Workshop::salomeViewerSelectionChanged() -{ +void XGUI_Workshop::salomeViewerSelectionChanged() { emit salomeViewerSelection(); } //************************************************************** -ModuleBase_IViewer* XGUI_Workshop::salomeViewer() const -{ +ModuleBase_IViewer *XGUI_Workshop::salomeViewer() const { return mySalomeConnector->viewer(); } //************************************************************** -void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) -{ +void XGUI_Workshop::onContextMenuCommand(const QString &theId, bool isChecked) { QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); if (theId == "DELETE_CMD") deleteObjects(); @@ -1800,15 +1815,16 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) else if (theId == "ISOLINES_CMD") changeIsoLines(anObjects); else if (theId == "SHOW_ISOLINES_CMD") { - foreach(ObjectPtr aObj, anObjects) { + foreach (ObjectPtr aObj, anObjects) { ResultPtr aResult = std::dynamic_pointer_cast(aObj); if (aResult.get()) - ModelAPI_Tools::showIsoLines(aResult, !ModelAPI_Tools::isShownIsoLines(aResult)); + ModelAPI_Tools::showIsoLines(aResult, + !ModelAPI_Tools::isShownIsoLines(aResult)); } mySelector->clearSelection(); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - } - else if (theId == "DEFLECTION_CMD") + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + } else if (theId == "DEFLECTION_CMD") changeDeflection(anObjects); else if (theId == "TRANSPARENCY_CMD") changeTransparency(anObjects); @@ -1816,17 +1832,14 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) showObjects(anObjects, true); mySelector->updateSelectionBy(ModuleBase_ISelection::Browser); updateCommandStatus(); - } - else if (theId == "HIDE_CMD") { + } else if (theId == "HIDE_CMD") { showObjects(anObjects, false); updateCommandStatus(); - } - else if (theId == "SHOW_ONLY_CMD") { + } else if (theId == "SHOW_ONLY_CMD") { showOnlyObjects(anObjects); mySelector->updateSelectionBy(ModuleBase_ISelection::Browser); updateCommandStatus(); - } - else if (theId == "SHADING_CMD") + } else if (theId == "SHADING_CMD") setDisplayMode(anObjects, XGUI_Displayer::Shading); else if (theId == "WIREFRAME_CMD") setDisplayMode(anObjects, XGUI_Displayer::Wireframe); @@ -1840,9 +1853,10 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) if (module()->canEraseObject(aObj)) aObj->setDisplayed(false); } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); #ifdef HAVE_SALOME - //issue #2159 Hide all incomplete behavior + // issue #2159 Hide all incomplete behavior viewer()->eraseAll(); #endif updateCommandStatus(); @@ -1865,8 +1879,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) } else if (theId == "ADD_OUT_FOLDER_AFTER_CMD") { moveOutFolder(false); } else if (theId == "SELECT_RESULT_CMD") { - //setViewerSelectionMode(-1); - //IMP: an attempt to use result selection with other selection modes + // setViewerSelectionMode(-1); + // IMP: an attempt to use result selection with other selection modes setViewerSelectionMode(ModuleBase_ResultPrs::Sel_Result); setViewerSelectionMode(TopAbs_COMPSOLID); } else if (theId == "SHOW_RESULTS_CMD") { @@ -1881,13 +1895,11 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) #ifdef TINSPECTOR else if (theId == "TINSPECTOR_VIEW") { std::shared_ptr aSession = - std::dynamic_pointer_cast(ModelAPI_Session::get()); + std::dynamic_pointer_cast(ModelAPI_Session::get()); Handle(TDocStd_Application) anApplication = aSession->application(); - if (!anApplication.IsNull()) - { - if (!MyTCommunicator) - { + if (!anApplication.IsNull()) { + if (!MyTCommunicator) { MyTCommunicator = new TInspector_Communicator(); NCollection_List aParameters; @@ -1898,18 +1910,18 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) #ifdef DEBUG_WITH_MESSAGE_REPORT Handle(Message_Report) aContextReport = aContext->GetReport(); - aContext->SetReportActive (Standard_True); - aContextReport->SetLimit (1000); + aContext->SetReportActive(Standard_True); + aContextReport->SetLimit(1000); if (!aContextReport.IsNull()) aParameters.Append(aContextReport); #endif MyVCallBack = new VInspector_CallBack(); myDisplayer->setCallBack(MyVCallBack); - #ifndef HAVE_SALOME - AppElements_Viewer* aViewer = mainWindow()->viewer(); +#ifndef HAVE_SALOME + AppElements_Viewer *aViewer = mainWindow()->viewer(); if (aViewer) aViewer->setCallBack(MyVCallBack); - #endif +#endif aParameters.Append(MyVCallBack); MyTCommunicator->RegisterPlugin("TKDFBrowser"); @@ -1918,19 +1930,23 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) #ifdef DEBUG_WITH_MESSAGE_REPORT MyTCommunicator->RegisterPlugin("TKMessageView"); #endif - //MyTCommunicator->RegisterPlugin("SMBrowser"); // custom plugin to view ModelAPI - //MyTCommunicator->RegisterPlugin("TKSMBrowser"); // custom plugin to view ModelAPI + // MyTCommunicator->RegisterPlugin("SMBrowser"); // custom plugin to + // view ModelAPI MyTCommunicator->RegisterPlugin("TKSMBrowser"); // + // custom plugin to view ModelAPI MyTCommunicator->Init(aParameters); - MyTCommunicator->Activate("TKSMBrowser"); // to have button in TInspector + MyTCommunicator->Activate( + "TKSMBrowser"); // to have button in TInspector #ifndef DEBUG_WITH_MESSAGE_REPORT - MyTCommunicator->Activate("TKVInspector"); // to have filled callback by model + MyTCommunicator->Activate( + "TKVInspector"); // to have filled callback by model #endif MyTCommunicator->Activate("TKDFBrowser"); #ifdef DEBUG_WITH_MESSAGE_REPORT MyTCommunicator->Activate("TKMessageView"); // temporary - MyTCommunicator->Activate("TKVInspector"); // to have filled callback by model + MyTCommunicator->Activate( + "TKVInspector"); // to have filled callback by model #endif } MyTCommunicator->SetVisible(true); @@ -1940,8 +1956,7 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) } //************************************************************** -void XGUI_Workshop::setViewerSelectionMode(int theMode) -{ +void XGUI_Workshop::setViewerSelectionMode(int theMode) { if (theMode == -1) myViewerSelMode.clear(); else { @@ -1954,8 +1969,7 @@ void XGUI_Workshop::setViewerSelectionMode(int theMode) } //************************************************************** -void XGUI_Workshop::activateObjectsSelection(const QObjectPtrList& theList) -{ +void XGUI_Workshop::activateObjectsSelection(const QObjectPtrList &theList) { QIntList aModes; module()->activeSelectionModes(aModes); if (aModes.isEmpty() && (myViewerSelMode.length() > 0)) @@ -1964,25 +1978,28 @@ void XGUI_Workshop::activateObjectsSelection(const QObjectPtrList& theList) } //************************************************************** -bool XGUI_Workshop::prepareForDisplay(const std::set& theObjects) const -{ +bool XGUI_Workshop::prepareForDisplay( + const std::set &theObjects) const { if (facesPanel()->isEmpty()) return true; // generate container of objects taking into account sub elments of compsolid std::set anAllProcessedObjects; for (std::set::const_iterator anObjectsIt = theObjects.begin(); - anObjectsIt != theObjects.end(); anObjectsIt++) { + anObjectsIt != theObjects.end(); anObjectsIt++) { ObjectPtr anObject = *anObjectsIt; - ResultBodyPtr aCompRes = std::dynamic_pointer_cast(anObject); + ResultBodyPtr aCompRes = + std::dynamic_pointer_cast(anObject); if (aCompRes.get()) { std::list allRes; ModelAPI_Tools::allSubs(aCompRes, allRes); if (allRes.empty()) { anAllProcessedObjects.insert(anObject); } else { - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - ResultBodyPtr aBody = std::dynamic_pointer_cast(*aRes); + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { + ResultBodyPtr aBody = + std::dynamic_pointer_cast(*aRes); if (aBody.get() && aBody->numberOfSubs() == 0) anAllProcessedObjects.insert(aBody); } @@ -1994,21 +2011,26 @@ bool XGUI_Workshop::prepareForDisplay(const std::set& theObjects) con // find hidden objects in faces panel std::set aHiddenObjects; QStringList aHiddenObjectNames; - for (std::set::const_iterator anObjectsIt = anAllProcessedObjects.begin(); + for (std::set::const_iterator anObjectsIt = + anAllProcessedObjects.begin(); anObjectsIt != anAllProcessedObjects.end(); anObjectsIt++) { if (!facesPanel()->isObjectHiddenByPanel(*anObjectsIt)) continue; aHiddenObjects.insert(*anObjectsIt); - aHiddenObjectNames.append(QString::fromStdWString((*anObjectsIt)->data()->name())); + aHiddenObjectNames.append( + QString::fromStdWString((*anObjectsIt)->data()->name())); } - if (aHiddenObjects.empty()) // in parameter objects there are no hidden objects in hide face + if (aHiddenObjects.empty()) // in parameter objects there are no hidden + // objects in hide face return true; int anAnswer = QMessageBox::question( - desktop(), tr("Show object"), - tr("'%1'\n are hidden by %2:\nRemove objects from the panel to be displayed?") - .arg(aHiddenObjectNames.join(", ")).arg(facesPanel()->windowTitle()), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + desktop(), tr("Show object"), + tr("'%1'\n are hidden by %2:\nRemove objects from the panel to be " + "displayed?") + .arg(aHiddenObjectNames.join(", ")) + .arg(facesPanel()->windowTitle()), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); bool aToBeDisplayed = anAnswer == QMessageBox::Yes; if (aToBeDisplayed) @@ -2018,9 +2040,8 @@ bool XGUI_Workshop::prepareForDisplay(const std::set& theObjects) con } //************************************************************** -void XGUI_Workshop::deleteObjects() -{ - ModuleBase_IModule* aModule = module(); +void XGUI_Workshop::deleteObjects() { + ModuleBase_IModule *aModule = module(); // allow the module to delete objects, do nothing if it has succeed if (aModule->deleteObjects()) { updateCommandStatus(); @@ -2042,20 +2063,24 @@ void XGUI_Workshop::deleteObjects() bool hasResultInHistory = false; bool hasFolder = false; bool hasGroupsOnly = false; - ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner, - hasResultInHistory, hasFolder, hasGroupsOnly); + ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, + hasCompositeOwner, hasResultInHistory, + hasFolder, hasGroupsOnly); if (!(hasResult || hasFeature || hasParameter || hasFolder)) return; - // Remove from the list non-deletable objects: infinite constructions which are not in history + // Remove from the list non-deletable objects: infinite constructions which + // are not in history bool notDelete = true; QObjectPtrList::iterator aIt; for (aIt = anObjects.begin(); aIt != anObjects.end(); aIt++) { ObjectPtr aObj = (*aIt); - ResultConstructionPtr aConstr = std::dynamic_pointer_cast(aObj); + ResultConstructionPtr aConstr = + std::dynamic_pointer_cast(aObj); FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature) { - notDelete = (!aFeature->isInHistory()) && (aConstr && aConstr->isInfinite()); + notDelete = + (!aFeature->isInHistory()) && (aConstr && aConstr->isInfinite()); if (notDelete) { anObjects.removeAll(aObj); aIt--; @@ -2063,7 +2088,7 @@ void XGUI_Workshop::deleteObjects() } } // delete objects - std::map > aReferences; + std::map> aReferences; std::set aFeatures; ModuleBase_Tools::convertToFeatures(anObjects, aFeatures); ModelAPI_Tools::findAllReferences(aFeatures, aReferences); @@ -2073,25 +2098,30 @@ void XGUI_Workshop::deleteObjects() bool aDone = false; QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text() + " %1"; - aDescription = aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", ")); - ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, module()); + aDescription = + aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", ")); + ModuleBase_Operation *anOpAction = + new ModuleBase_Operation(aDescription, module()); operationMgr()->startOperation(anOpAction); std::set aFeatureRefsToDelete; - if (ModuleBase_Tools::askToDelete(aFeatures, aReferences, desktop(), aFeatureRefsToDelete)) { - // WORKAROUND, should be done before each object remove, if it presents in XGUI_DataModel tree - // It is necessary to clear selection in order to avoid selection changed event during - // deletion and negative consequences connected with processing of already deleted items + if (ModuleBase_Tools::askToDelete(aFeatures, aReferences, desktop(), + aFeatureRefsToDelete)) { + // WORKAROUND, should be done before each object remove, if it presents in + // XGUI_DataModel tree It is necessary to clear selection in order to avoid + // selection changed event during deletion and negative consequences + // connected with processing of already deleted items mySelector->clearSelection(); if (!aFeatureRefsToDelete.empty()) - aFeatures.insert(aFeatureRefsToDelete.begin(), aFeatureRefsToDelete.end()); + aFeatures.insert(aFeatureRefsToDelete.begin(), + aFeatureRefsToDelete.end()); aDone = ModelAPI_Tools::removeFeatures(aFeatures, false); } if (aFolders.size() > 0) { std::set::const_iterator anIt = aFolders.begin(), - aLast = aFolders.end(); + aLast = aFolders.end(); for (; anIt != aLast; anIt++) { FolderPtr aFolder = *anIt; if (aFolder.get()) { @@ -2102,11 +2132,14 @@ void XGUI_Workshop::deleteObjects() } // remove results selected std::list aResults; - for(QObjectPtrList::const_iterator anIt = anObjects.begin(); anIt != anObjects.end(); anIt++) { + for (QObjectPtrList::const_iterator anIt = anObjects.begin(); + anIt != anObjects.end(); anIt++) { ResultPtr aRes = std::dynamic_pointer_cast(*anIt); if (aRes.get() && aRes->data()->isValid() && !aRes->data()->isDeleted() && - aRes->groupName() != ModelAPI_ResultGroup::group() && // don't remove groups and fields - aRes->groupName() != ModelAPI_ResultField::group()) // because they are badly selected + aRes->groupName() != + ModelAPI_ResultGroup::group() && // don't remove groups and fields + aRes->groupName() != + ModelAPI_ResultField::group()) // because they are badly selected aResults.push_back(aRes); } if (!aResults.empty()) { @@ -2122,14 +2155,15 @@ void XGUI_Workshop::deleteObjects() } //************************************************************** -void addRefsToFeature(const FeaturePtr& theFeature, - const std::map >& theMainList, - std::set& theReferences) -{ - //if (theReferences.find(theFeature) != theReferences.end()) - // return; +void addRefsToFeature( + const FeaturePtr &theFeature, + const std::map> &theMainList, + std::set &theReferences) { + // if (theReferences.find(theFeature) != theReferences.end()) + // return; if (theMainList.find(theFeature) == theMainList.end()) - return; // this feature is not in the selection list, so exists without references to it + return; // this feature is not in the selection list, so exists without + // references to it std::set aMainReferences = theMainList.at(theFeature); std::set::const_iterator anIt = aMainReferences.begin(), @@ -2143,8 +2177,7 @@ void addRefsToFeature(const FeaturePtr& theFeature, } //************************************************************** -void XGUI_Workshop::cleanHistory() -{ +void XGUI_Workshop::cleanHistory() { if (!abortAllOperations()) return; @@ -2160,29 +2193,31 @@ void XGUI_Workshop::cleanHistory() anInfo.append(aFeature->name().c_str()); } QString anInfoStr = anInfo.join(";\t"); - qDebug(QString("cleanHistory for: [%1] - %2"). - arg(aFeatures.size()).arg(anInfoStr).toStdString().c_str()); + qDebug(QString("cleanHistory for: [%1] - %2") + .arg(aFeatures.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif - std::map > aReferences; + std::map> aReferences; ModelAPI_Tools::findAllReferences(aFeatures, aReferences, true, false); - // find for each object whether all reference values are in the map as key, that means that there - // is no other reference in the model to this object, so it might be removed by cleaning history - // sk_1(ext_1, vertex_1) + (sk_3, bool_1) - can't be deleted, dependency to bool_1 - // ext_1(bool_1, sk_3) - can't be deleted, dependency to bool_1 - // vertex_1() - // sk_2(ext_2) + (bool_1) - can't be deleted, dependency to bool_1 - // ext_2(bool_1) - can't be deleted, dependency to bool_1 - // sk_3() - // Information: bool_1 is not selected + // find for each object whether all reference values are in the map as key, + // that means that there is no other reference in the model to this object, so + // it might be removed by cleaning history sk_1(ext_1, vertex_1) + (sk_3, + // bool_1) - can't be deleted, dependency to bool_1 ext_1(bool_1, sk_3) - + // can't be deleted, dependency to bool_1 vertex_1() sk_2(ext_2) + (bool_1) - + // can't be deleted, dependency to bool_1 ext_2(bool_1) - can't be deleted, + // dependency to bool_1 sk_3() Information: bool_1 is not selected std::set anUnusedObjects; - std::map >::const_iterator aMainIt = aReferences.begin(), - aMainLast = aReferences.end(); + std::map>::const_iterator + aMainIt = aReferences.begin(), + aMainLast = aReferences.end(); for (; aMainIt != aMainLast; aMainIt++) { FeaturePtr aMainListFeature = aMainIt->first; std::set aMainRefList = aMainIt->second; std::set::const_iterator aRefIt = aMainRefList.begin(), - aRefLast = aMainRefList.end(); + aRefLast = aMainRefList.end(); bool aFeatureOutOfTheList = false; for (; aRefIt != aRefLast && !aFeatureOutOfTheList; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; @@ -2198,22 +2233,26 @@ void XGUI_Workshop::cleanHistory() FeaturePtr aFeature = *aFIt; anInfo.append(aFeature->name().c_str()); } - qDebug(QString("unused objects: [%1] - %2"). - arg(anInfo.size()).arg(anInfo.join(";\t")).toStdString().c_str()); + qDebug(QString("unused objects: [%1] - %2") + .arg(anInfo.size()) + .arg(anInfo.join(";\t")) + .toStdString() + .c_str()); #endif - // warn about the references remove, break the delete operation if the user chose it + // warn about the references remove, break the delete operation if the user + // chose it if (!anUnusedObjects.empty()) { QStringList aNames; - foreach (const FeaturePtr& aFeature, anUnusedObjects) { + foreach (const FeaturePtr &aFeature, anUnusedObjects) { aNames.append(QString::fromStdWString(aFeature->name())); } aNames.sort(); QString anUnusedNames = aNames.join(", "); QString anActionId = "CLEAN_HISTORY_CMD"; - QString aDescription = ModuleBase_Tools::translate("workshop", - contextMenuMgr()->action(anActionId)->text().toStdString()); + QString aDescription = ModuleBase_Tools::translate( + "workshop", contextMenuMgr()->action(anActionId)->text().toStdString()); QMessageBox aMessageBox(desktop()); aMessageBox.setWindowTitle(aDescription); @@ -2221,33 +2260,35 @@ void XGUI_Workshop::cleanHistory() aMessageBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes); aMessageBox.setDefaultButton(QMessageBox::No); - const char* aKeyStr = "Unused features are the following: " - "%1.\nThese features will be deleted.\nWould you like to continue?"; + const char *aKeyStr = + "Unused features are the following: " + "%1.\nThese features will be deleted.\nWould you like to continue?"; QString aText = QString(tr(aKeyStr).arg(anUnusedNames)); aMessageBox.setText(aText); if (aMessageBox.exec() == QMessageBox::No) return; // 1. start operation - aDescription += "by deleting of " + - aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", ")); - ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, module()); + aDescription += + "by deleting of " + + aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", ")); + ModuleBase_Operation *anOpAction = + new ModuleBase_Operation(aDescription, module()); operationMgr()->startOperation(anOpAction); - // WORKAROUND, should be done before each object remove, if it presents in XGUI_DataModel tree - // It is necessary to clear selection in order to avoid selection changed event during - // deletion and negative consequences connected with processing of already deleted items + // WORKAROUND, should be done before each object remove, if it presents in + // XGUI_DataModel tree It is necessary to clear selection in order to avoid + // selection changed event during deletion and negative consequences + // connected with processing of already deleted items mySelector->clearSelection(); std::set anIgnoredFeatures; if (ModelAPI_Tools::removeFeatures(anUnusedObjects, true)) { operationMgr()->commitOperation(); - } - else { + } else { operationMgr()->abortOperation(operationMgr()->currentOperation()); } - } - else { + } else { QString anActionId = "CLEAN_HISTORY_CMD"; QString aDescription = contextMenuMgr()->action(anActionId)->text(); @@ -2261,7 +2302,8 @@ void XGUI_Workshop::cleanHistory() aMessageBox.setStandardButtons(QMessageBox::Ok); aMessageBox.setDefaultButton(QMessageBox::Ok); - aText = QString(tr("All features are relevant, there is nothing to be deleted")); + aText = QString( + tr("All features are relevant, there is nothing to be deleted")); aMessageBox.setText(aText); if (aMessageBox.exec() == QMessageBox::No) @@ -2270,22 +2312,23 @@ void XGUI_Workshop::cleanHistory() } //************************************************************** -bool compareFeature(const FeaturePtr& theF1, const FeaturePtr& theF2) { +bool compareFeature(const FeaturePtr &theF1, const FeaturePtr &theF2) { DocumentPtr aDoc = theF1->document(); return aDoc->index(theF1) < aDoc->index(theF2); } -void XGUI_Workshop::moveObjects(const bool theSplit) -{ +void XGUI_Workshop::moveObjects(const bool theSplit) { if (!abortAllOperations()) return; SessionPtr aMgr = ModelAPI_Session::get(); QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); - // It is necessary to clear selection in order to avoid selection changed event during - // moving and negative consequences connected with processing of already moved items + // It is necessary to clear selection in order to avoid selection changed + // event during moving and negative consequences connected with processing of + // already moved items mySelector->clearSelection(); - // check whether the object can be moved. There should not be parts which are not loaded + // check whether the object can be moved. There should not be parts which are + // not loaded std::set aFeatures; ModuleBase_Tools::convertToFeatures(anObjects, aFeatures); if (!XGUI_Tools::canRemoveOrRename(desktop(), aFeatures)) @@ -2301,7 +2344,8 @@ void XGUI_Workshop::moveObjects(const bool theSplit) DocumentPtr anActiveDocument = aMgr->activeDocument(); FeaturePtr aCurrentFeature = anActiveDocument->currentFeature(true); - std::list::const_iterator anIt = aFList.begin(), aLast = aFList.end(); + std::list::const_iterator anIt = aFList.begin(), + aLast = aFList.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (!aFeature.get() || !myModule->canApplyAction(aFeature, anActionId)) @@ -2315,8 +2359,7 @@ void XGUI_Workshop::moveObjects(const bool theSplit) myViewerProxy->update(); } -void XGUI_Workshop::recoverFeature() -{ +void XGUI_Workshop::recoverFeature() { if (!abortAllOperations()) return; @@ -2325,8 +2368,7 @@ void XGUI_Workshop::recoverFeature() } //************************************************************** -bool XGUI_Workshop::deleteFeatures(const QObjectPtrList& theObjects) -{ +bool XGUI_Workshop::deleteFeatures(const QObjectPtrList &theObjects) { std::set aFeatures; ModuleBase_Tools::convertToFeatures(theObjects, aFeatures); @@ -2334,11 +2376,10 @@ bool XGUI_Workshop::deleteFeatures(const QObjectPtrList& theObjects) } //****************************************************** -bool hasResults(QObjectPtrList theObjects, const std::set& theTypes) -{ +bool hasResults(QObjectPtrList theObjects, + const std::set &theTypes) { bool isFoundResultType = false; - foreach(ObjectPtr anObj, theObjects) - { + foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() == NULL) continue; @@ -2353,23 +2394,25 @@ bool hasResults(QObjectPtrList theObjects, const std::set& theTypes //************************************************************** // Returns the list of all features for theDocument and all features of // all nested parts. -std::list allFeatures(const DocumentPtr& theDocument) -{ +std::list allFeatures(const DocumentPtr &theDocument) { std::list aResultList; std::list anAllFeatures = theDocument->allFeatures(); - foreach (const FeaturePtr& aFeature, anAllFeatures) { - // The order of appending features of the part and the part itself is important + foreach (const FeaturePtr &aFeature, anAllFeatures) { + // The order of appending features of the part and the part itself is + // important // Append features from a part feature std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); - foreach (const ResultPtr& aResult, aResults) { + foreach (const ResultPtr &aResult, aResults) { ResultPartPtr aResultPart = std::dynamic_pointer_cast(aResult); if (aResultPart.get() && aResultPart->partDoc().get()) { // Recursion - std::list aPartFeatures = allFeatures(aResultPart->partDoc()); - aResultList.insert(aResultList.end(), aPartFeatures.begin(), aPartFeatures.end()); + std::list aPartFeatures = + allFeatures(aResultPart->partDoc()); + aResultList.insert(aResultList.end(), aPartFeatures.begin(), + aPartFeatures.end()); } } @@ -2381,19 +2424,19 @@ std::list allFeatures(const DocumentPtr& theDocument) //************************************************************** // Returns the list of features placed between theObject and the current feature // in the same document. Excludes theObject, includes the current feature. -std::list toCurrentFeatures(const ObjectPtr& theObject) -{ +std::list toCurrentFeatures(const ObjectPtr &theObject) { std::list aResult; DocumentPtr aDocument = theObject->document(); std::list anAllFeatures = allFeatures(aDocument); // find the object iterator std::list::iterator anObjectIt = - std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject); + std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject); if (anObjectIt == anAllFeatures.end()) return aResult; // find the current feature iterator std::list::iterator aCurrentIt = - std::find(anAllFeatures.begin(), anAllFeatures.end(), aDocument->currentFeature(true)); + std::find(anAllFeatures.begin(), anAllFeatures.end(), + aDocument->currentFeature(true)); if (aCurrentIt == anAllFeatures.end()) return aResult; // check the right order @@ -2408,8 +2451,7 @@ std::list toCurrentFeatures(const ObjectPtr& theObject) } //****************************************************** -bool XGUI_Workshop::canMoveFeature() -{ +bool XGUI_Workshop::canMoveFeature() { QString anActionId = "MOVE_CMD"; QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); @@ -2430,20 +2472,21 @@ bool XGUI_Workshop::canMoveFeature() bool aCanMove = !anObjects.empty(); - QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); + QObjectPtrList::const_iterator anIt = anObjects.begin(), + aLast = anObjects.end(); for (; anIt != aLast && aCanMove; anIt++) { ObjectPtr anObject = *anIt; - if (!anObject.get() || !anObject->data().get() || !anObject->data()->isValid()) { + if (!anObject.get() || !anObject->data().get() || + !anObject->data()->isValid()) { aCanMove = false; break; } FeaturePtr aFeat = std::dynamic_pointer_cast(anObject); - // only groups can be moved to the end for now (#2451 old_id, #23105 tuleap id) - // and groups created by other groups (#34401) + // only groups can be moved to the end for now (#2451 old_id, #23105 tuleap + // id) and groups created by other groups (#34401) if (aFeat.get()) { std::string aKindOfFeature = aFeat->getKind(); - if (aKindOfFeature != "Group" && - aKindOfFeature != "GroupSubstraction" && + if (aKindOfFeature != "Group" && aKindOfFeature != "GroupSubstraction" && aKindOfFeature != "GroupAddition" && aKindOfFeature != "GroupIntersection") { aCanMove = false; @@ -2452,18 +2495,19 @@ bool XGUI_Workshop::canMoveFeature() } // Check that the feature can be moved due to its dependencies - // i.e. Check that there are no features between the moved one and its destination - // with references to it - // Details on #21340 (old_id #660) - // NOTE: we can ignore dependend features, if they are also moved! + // i.e. Check that there are no features between the moved one and its + // destination with references to it Details on #21340 (old_id #660) NOTE: + // we can ignore dependend features, if they are also moved! // 1. Get features placed between selected and current in the document std::list aFeaturesBetween = toCurrentFeatures(anObject); - // if aFeaturesBetween is empty it means wrong order or anObject is the current feature + // if aFeaturesBetween is empty it means wrong order or anObject is the + // current feature if (aFeaturesBetween.empty()) aCanMove = false; else { - std::set aPlacedFeatures(aFeaturesBetween.begin(), aFeaturesBetween.end()); + std::set aPlacedFeatures(aFeaturesBetween.begin(), + aFeaturesBetween.end()); // 2. Get all reference features to the selected object in the document std::set aRefFeatures; ModuleBase_Tools::refsToFeatureInFeatureDocument(anObject, aRefFeatures); @@ -2472,20 +2516,26 @@ bool XGUI_Workshop::canMoveFeature() continue; else { // 3.1. Check, if any reference feature is going to be moved, too. - // If it is, we can ignore its dependency in our subsequent check (3.2) + // If it is, we can ignore its dependency in our subsequent check + // (3.2) std::set aNoMoveRefFeatures; - std::set_difference(aRefFeatures.begin(), aRefFeatures.end(), - aSelectedFeatures.begin(), aSelectedFeatures.end(), - std::inserter(aNoMoveRefFeatures, aNoMoveRefFeatures.begin())); + std::set_difference( + aRefFeatures.begin(), aRefFeatures.end(), aSelectedFeatures.begin(), + aSelectedFeatures.end(), + std::inserter(aNoMoveRefFeatures, aNoMoveRefFeatures.begin())); if (aNoMoveRefFeatures.empty()) continue; - // 3.2. Find any placed features in all remaining (non-moved) reference features + // 3.2. Find any placed features in all remaining (non-moved) reference + // features std::set aIntersectionFeatures; - std::set_intersection(aNoMoveRefFeatures.begin(), aNoMoveRefFeatures.end(), - aPlacedFeatures.begin(), aPlacedFeatures.end(), - std::inserter(aIntersectionFeatures, aIntersectionFeatures.begin())); - // 4. Return false if any (non-moved) reference feature is placed before current feature + std::set_intersection(aNoMoveRefFeatures.begin(), + aNoMoveRefFeatures.end(), aPlacedFeatures.begin(), + aPlacedFeatures.end(), + std::inserter(aIntersectionFeatures, + aIntersectionFeatures.begin())); + // 4. Return false if any (non-moved) reference feature is placed before + // current feature if (!aIntersectionFeatures.empty()) aCanMove = false; } @@ -2495,16 +2545,16 @@ bool XGUI_Workshop::canMoveFeature() } //************************************************************** -bool XGUI_Workshop::canBeShaded(const ObjectPtr& theObject) const -{ +bool XGUI_Workshop::canBeShaded(const ObjectPtr &theObject) const { bool aCanBeShaded = myDisplayer->canBeShaded(theObject); if (!aCanBeShaded) { - ResultBodyPtr aCompRes = std::dynamic_pointer_cast(theObject); + ResultBodyPtr aCompRes = + std::dynamic_pointer_cast(theObject); if (aCompRes.get() != NULL) { // change colors for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aCompRes, allRes); std::list::iterator aRes = allRes.begin(); - for(; aRes != allRes.end() && !aCanBeShaded; aRes++) { + for (; aRes != allRes.end() && !aCanBeShaded; aRes++) { aCanBeShaded = myDisplayer->canBeShaded(*aRes); } } @@ -2513,10 +2563,8 @@ bool XGUI_Workshop::canBeShaded(const ObjectPtr& theObject) const } //************************************************************** -bool XGUI_Workshop::canChangeProperty(const QString& theActionName) const -{ - if (theActionName == "COLOR_CMD" || - theActionName == "DEFLECTION_CMD" || +bool XGUI_Workshop::canChangeProperty(const QString &theActionName) const { + if (theActionName == "COLOR_CMD" || theActionName == "DEFLECTION_CMD" || theActionName == "TRANSPARENCY_CMD") { QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); @@ -2540,11 +2588,9 @@ bool XGUI_Workshop::canChangeProperty(const QString& theActionName) const return false; } - //************************************************************** void getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid, - std::vector& theColor) -{ + std::vector &theColor) { theColor.clear(); // get default color from the preferences manager for the given result if (theColor.empty()) { @@ -2557,21 +2603,23 @@ void getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid, if (!isEmptyColorValid && theColor.empty()) { // all AIS objects, where the color is not set, are in black. // The color should be defined in XML or set in the attribute - theColor = Config_PropManager::color("Visualization", "object_default_color"); + theColor = + Config_PropManager::color("Visualization", "object_default_color"); Events_InfoMessage("XGUI_CustomPrs", - "A default color is not defined in the preferences for this kind of result").send(); + "A default color is not defined in the preferences for " + "this kind of result") + .send(); } } //************************************************************** -void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::changeColor(const QObjectPtrList &theObjects) { AttributeIntArrayPtr aColorAttr; - // 1. find the current color of the object. This is a color of AIS presentation - // The objects are iterated until a first valid color is found + // 1. find the current color of the object. This is a color of AIS + // presentation The objects are iterated until a first valid color is found std::vector aColor; - foreach(ObjectPtr anObject, theObjects) { + foreach (ObjectPtr anObject, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObject); if (aResult.get()) { ModelAPI_Tools::getColor(aResult, aColor); @@ -2591,9 +2639,9 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) return; if (!abortAllOperations()) - return; + return; // 2. show the dialog to change the value - XGUI_ColorDialog* aDlg = new XGUI_ColorDialog(desktop()); + XGUI_ColorDialog *aDlg = new XGUI_ColorDialog(desktop()); aDlg->setColor(aColor); aDlg->move(QCursor::pos()); bool isDone = aDlg->exec() == QDialog::Accepted; @@ -2610,31 +2658,35 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) // 4. set the value to all results std::vector aColorResult = aDlg->getColor(); - foreach(ObjectPtr anObj, theObjects) { + foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() != NULL) { - ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aBodyResult = + std::dynamic_pointer_cast(aResult); if (aBodyResult.get() != NULL) { // change colors for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - ModelAPI_Tools::setColor(*aRes, !isRandomColor ? aColorResult : aDlg->getRandomColor()); + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { + ModelAPI_Tools::setColor( + *aRes, !isRandomColor ? aColorResult : aDlg->getRandomColor()); } } - ModelAPI_Tools::setColor(aResult, !isRandomColor ? aColorResult : aDlg->getRandomColor()); + ModelAPI_Tools::setColor( + aResult, !isRandomColor ? aColorResult : aDlg->getRandomColor()); } } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); aMgr->finishOperation(); updateCommandStatus(); myViewerProxy->update(); } //************************************************************** -void XGUI_Workshop::changeAutoColor(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::changeAutoColor(const QObjectPtrList &theObjects) { if (!abortAllOperations()) - return; + return; std::vector aColor; @@ -2643,55 +2695,58 @@ void XGUI_Workshop::changeAutoColor(const QObjectPtrList& theObjects) QString aDescription = contextMenuMgr()->action("AUTOCOLOR_CMD")->text(); aMgr->startOperation(aDescription.toStdString()); - if (Config_PropManager::getAutoColorStatus()) { - contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Auto color")); - Config_PropManager::setAutoColorStatus(false); - ModelAPI_Tools::findRandomColor(aColor, true); - } else { - // set the value to all results - foreach (ObjectPtr anObj, theObjects) { - DocumentPtr aDocument = anObj->document(); - std::list anAllFeatures = allFeatures(aDocument); - // find the object iterator - std::list::iterator anObjectIt = anAllFeatures.begin(); - for (; anObjectIt != anAllFeatures.end(); ++ anObjectIt) { - FeaturePtr aFeature = *anObjectIt; - if (aFeature.get()) { - std::list aResults; - ModelAPI_Tools::allResults(aFeature, aResults); - std::list >::const_iterator aIt; - for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { - ResultPtr aGroupResult = *aIt; - if (aGroupResult.get() && - aGroupResult->groupName() == ModelAPI_ResultGroup::group()) { - ModelAPI_Tools::findRandomColor(aColor); - ModelAPI_Tools::setColor(aGroupResult, aColor); - } + if (Config_PropManager::getAutoColorStatus()) { + contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Auto color")); + Config_PropManager::setAutoColorStatus(false); + ModelAPI_Tools::findRandomColor(aColor, true); + } else { + // set the value to all results + foreach (ObjectPtr anObj, theObjects) { + DocumentPtr aDocument = anObj->document(); + std::list anAllFeatures = allFeatures(aDocument); + // find the object iterator + std::list::iterator anObjectIt = anAllFeatures.begin(); + for (; anObjectIt != anAllFeatures.end(); ++anObjectIt) { + FeaturePtr aFeature = *anObjectIt; + if (aFeature.get()) { + std::list aResults; + ModelAPI_Tools::allResults(aFeature, aResults); + std::list>::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { + ResultPtr aGroupResult = *aIt; + if (aGroupResult.get() && + aGroupResult->groupName() == ModelAPI_ResultGroup::group()) { + ModelAPI_Tools::findRandomColor(aColor); + ModelAPI_Tools::setColor(aGroupResult, aColor); } } } } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - aMgr->finishOperation(); - updateCommandStatus(); - myViewerProxy->update(); - contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Disable auto color")); - Config_PropManager::setAutoColorStatus(true); } + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aMgr->finishOperation(); + updateCommandStatus(); + myViewerProxy->update(); + contextMenuMgr() + ->action("AUTOCOLOR_CMD") + ->setText(tr("Disable auto color")); + Config_PropManager::setAutoColorStatus(true); + } } //************************************************************** -void setTransparency(double theTransparency, const QObjectPtrList& theObjects) -{ - foreach(ObjectPtr anObj, theObjects) { +void setTransparency(double theTransparency, const QObjectPtrList &theObjects) { + foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() != NULL) { - ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aBodyResult = + std::dynamic_pointer_cast(aResult); if (aBodyResult.get() != NULL) { // change property for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); std::list::iterator aRes; - for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) { + for (aRes = allRes.begin(); aRes != allRes.end(); aRes++) { ModelAPI_Tools::setTransparency(*aRes, theTransparency); } } @@ -2701,8 +2756,7 @@ void setTransparency(double theTransparency, const QObjectPtrList& theObjects) } //************************************************************** -double getDefaultDeflection(const ObjectPtr& theObject) -{ +double getDefaultDeflection(const ObjectPtr &theObject) { double aDeflection = -1; ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { @@ -2714,39 +2768,41 @@ double getDefaultDeflection(const ObjectPtr& theObject) else if (aResultGroup == ModelAPI_ResultBody::group()) { GeomShapePtr aGeomShape = aResult->shape(); if (aGeomShape.get()) { - // if the shape could not be exploded on faces, it contains only wires, edges, and vertices - // correction of deviation for them should not influence to the application performance + // if the shape could not be exploded on faces, it contains only wires, + // edges, and vertices correction of deviation for them should not + // influence to the application performance GeomAPI_ShapeExplorer anExp(aGeomShape, GeomAPI_Shape::FACE); isConstruction = !anExp.more(); } } if (isConstruction) - aDeflection = Config_PropManager::real("Visualization", "construction_deflection"); + aDeflection = + Config_PropManager::real("Visualization", "construction_deflection"); else - aDeflection = Config_PropManager::real("Visualization", "body_deflection"); + aDeflection = + Config_PropManager::real("Visualization", "body_deflection"); } return aDeflection; } //************************************************************** -void XGUI_Workshop::changeDeflection(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::changeDeflection(const QObjectPtrList &theObjects) { AttributeDoublePtr aDoubleAttr; - // 1. find the current property of the object. This is a property of AIS presentation - // The objects are iterated until a first valid property is found + // 1. find the current property of the object. This is a property of AIS + // presentation The objects are iterated until a first valid property is found double aDeflection = -1; - foreach(ObjectPtr anObject, theObjects) { + foreach (ObjectPtr anObject, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObject); if (aResult.get()) { aDeflection = ModelAPI_Tools::getDeflection(aResult); if (aDeflection < 0) aDeflection = getDefaultDeflection(aResult); - } - else { + } else { // TODO: remove the obtaining a property from the AIS object // this does not happen never because: // 1. The property can be changed only on results - // 2. The result can be not visualized in the viewer(e.g. Origin Construction) + // 2. The result can be not visualized in the viewer(e.g. Origin + // Construction) AISObjectPtr anAISObj = myDisplayer->getAISObject(anObject); if (anAISObj.get()) { aDeflection = anAISObj->getDeflection(); @@ -2759,9 +2815,9 @@ void XGUI_Workshop::changeDeflection(const QObjectPtrList& theObjects) return; if (!abortAllOperations()) - return; + return; // 2. show the dialog to change the value - XGUI_DeflectionDialog* aDlg = new XGUI_DeflectionDialog(desktop()); + XGUI_DeflectionDialog *aDlg = new XGUI_DeflectionDialog(desktop()); aDlg->setDeflection(aDeflection); aDlg->move(QCursor::pos()); bool isDone = aDlg->exec() == QDialog::Accepted; @@ -2775,39 +2831,42 @@ void XGUI_Workshop::changeDeflection(const QObjectPtrList& theObjects) // 4. set the value to all results aDeflection = aDlg->getDeflection(); - foreach(ObjectPtr anObj, theObjects) { + foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() != NULL) { - ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aBodyResult = + std::dynamic_pointer_cast(aResult); if (aBodyResult.get() != NULL) { // change property for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { ModelAPI_Tools::setDeflection(*aRes, aDeflection); } } ModelAPI_Tools::setDeflection(aResult, aDeflection); } } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); aMgr->finishOperation(); updateCommandStatus(); } //************************************************************** -double getDefaultTransparency(const ResultPtr& theResult) -{ - return Config_PropManager::integer("Visualization", "shaper_default_transparency") / 100.; +double getDefaultTransparency(const ResultPtr &theResult) { + return Config_PropManager::integer("Visualization", + "shaper_default_transparency") / + 100.; } //************************************************************** -void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::changeTransparency(const QObjectPtrList &theObjects) { AttributeDoublePtr aDoubleAttr; - // 1. find the current property of the object. This is a property of AIS presentation - // The objects are iterated until a first valid property is found + // 1. find the current property of the object. This is a property of AIS + // presentation The objects are iterated until a first valid property is found double aCurrentValue = -1; - foreach(ObjectPtr anObject, theObjects) { + foreach (ObjectPtr anObject, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObject); if (aResult.get()) { aCurrentValue = ModelAPI_Tools::getTransparency(aResult); @@ -2824,11 +2883,12 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects) return; // 2. show the dialog to change the value - XGUI_PropertyDialog* aDlg = new XGUI_PropertyDialog(desktop()); + XGUI_PropertyDialog *aDlg = new XGUI_PropertyDialog(desktop()); aDlg->setWindowTitle(tr("Transparency")); - XGUI_TransparencyWidget* aTransparencyWidget = new XGUI_TransparencyWidget(aDlg); - connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()), - this, SLOT(onTransparencyValueChanged())); + XGUI_TransparencyWidget *aTransparencyWidget = + new XGUI_TransparencyWidget(aDlg); + connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()), this, + SLOT(onTransparencyValueChanged())); aDlg->setContent(aTransparencyWidget); aTransparencyWidget->setValue(aCurrentValue); @@ -2844,32 +2904,31 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects) aMgr->finishOperation(); } else { aMgr->abortOperation(); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } updateCommandStatus(); } //************************************************************** -void XGUI_Workshop::onTransparencyValueChanged() -{ - XGUI_TransparencyWidget* aTransparencyWidget = (XGUI_TransparencyWidget*)sender(); +void XGUI_Workshop::onTransparencyValueChanged() { + XGUI_TransparencyWidget *aTransparencyWidget = + (XGUI_TransparencyWidget *)sender(); if (!aTransparencyWidget) return; QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); setTransparency(aTransparencyWidget->getValue(), anObjects); static const Events_ID kRedisplayEvent = - Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); Events_Loop::loop()->flush(kRedisplayEvent); myViewerProxy->update(); } - //****************************************************** -void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) -{ +void XGUI_Workshop::showObjects(const QObjectPtrList &theList, bool isVisible) { if (isVisible) { std::set anObjects; foreach (ObjectPtr aObj, theList) { @@ -2882,7 +2941,8 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) foreach (ObjectPtr aObj, theList) { aObj->setDisplayed(isVisible); } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); myObjectBrowser->updateAllIndexes(); updateColorScaleVisibility(); @@ -2890,8 +2950,7 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) } //************************************************************** -void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) -{ +void XGUI_Workshop::showOnlyObjects(const QObjectPtrList &theList) { QObjectPtrList aSrcList = theList; // Hide all displayed objects QObjectPtrList aList = myDisplayer->displayedObjects(); @@ -2901,13 +2960,15 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) else aSrcList.removeAll(aObj); } - //Do not use eraseAll if you didn't send Redisplay event: - //all objects are erased from viewer, but considered as displayed in displayer - // Problem in bug 2218 - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + // Do not use eraseAll if you didn't send Redisplay event: + // all objects are erased from viewer, but considered as displayed in + // displayer + // Problem in bug 2218 + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); #ifdef HAVE_SALOME - //issue #2159 Hide all incomplete behavior - viewer()->eraseAll(); + // issue #2159 Hide all incomplete behavior + viewer()->eraseAll(); #endif std::set anObjects; @@ -2922,7 +2983,8 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) foreach (ObjectPtr aObj, aSrcList) { aObj->setDisplayed(true); } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); // Necessary for update icons in ObjectBrowser on Linux myObjectBrowser->updateAllIndexes(); @@ -2930,35 +2992,36 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) displayer()->updateViewer(); } - //************************************************************** -void XGUI_Workshop::updateColorScaleVisibility() -{ +void XGUI_Workshop::updateColorScaleVisibility() { QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); myViewerProxy->setColorScaleShown(false); if (anObjects.size() == 1) { FieldStepPtr aStep = - std::dynamic_pointer_cast(anObjects.first()); + std::dynamic_pointer_cast( + anObjects.first()); if (aStep.get() && myDisplayer->isVisible(aStep)) { AISObjectPtr aAisPtr = myDisplayer->getAISObject(aStep); - Handle(AIS_InteractiveObject) aIO = aAisPtr->impl(); - ModuleBase_IStepPrs* aPrs = dynamic_cast(aIO.get()); + Handle(AIS_InteractiveObject) aIO = + aAisPtr->impl(); + ModuleBase_IStepPrs *aPrs = + dynamic_cast(aIO.get()); if (aPrs) { ModelAPI_AttributeTables::ValueType aType = aPrs->dataType(); if ((aType == ModelAPI_AttributeTables::DOUBLE) || - (aType == ModelAPI_AttributeTables::INTEGER) || - (aType == ModelAPI_AttributeTables::BOOLEAN)) { + (aType == ModelAPI_AttributeTables::INTEGER) || + (aType == ModelAPI_AttributeTables::BOOLEAN)) { myViewerProxy->setupColorScale(); if (aType == ModelAPI_AttributeTables::BOOLEAN) { myViewerProxy->setColorScaleIntervals(2); myViewerProxy->setColorScaleRange(0., 1.); - } - else { + } else { double aMin, aMax; aPrs->dataRange(aMin, aMax); myViewerProxy->setColorScaleRange(aMin, aMax); } - myViewerProxy->setColorScaleTitle(QString::fromStdWString(aStep->name())); + myViewerProxy->setColorScaleTitle( + QString::fromStdWString(aStep->name())); myViewerProxy->setColorScaleShown(true); } } @@ -2967,12 +3030,11 @@ void XGUI_Workshop::updateColorScaleVisibility() } //************************************************************** -void XGUI_Workshop::updateGroupsText() -{ +void XGUI_Workshop::updateGroupsText() { ModuleBase_IViewer::TextColor aText; int aSize = 10; - SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); + SUIT_ResourceMgr *aResMgr = ModuleBase_Preferences::resourceMgr(); if (aResMgr->booleanValue("Viewer", "group_names_display")) { // the first item in the TextColor list is font name -> text color QColor aTextColor = aResMgr->colorValue("Viewer", "group_names_color"); @@ -2981,48 +3043,44 @@ void XGUI_Workshop::updateGroupsText() aTextCV.push_back(aTextColor.green()); aTextCV.push_back(aTextColor.blue()); QString aFontName = aResMgr->stringValue("Viewer", "group_names_font"); - aText.push_back(std::pair >(aFontName.toStdWString(), aTextCV)); + aText.push_back(std::pair>( + aFontName.toStdWString(), aTextCV)); aSize = aResMgr->integerValue("Viewer", "group_names_size"); DocumentPtr aDoc = ModelAPI_Session::get()->activeDocument(); int aNbGroups = aDoc->size(ModelAPI_ResultGroup::group()); - for (int aGIndex = 0; aGIndex < aNbGroups; aGIndex++) - { + for (int aGIndex = 0; aGIndex < aNbGroups; aGIndex++) { ResultGroupPtr aGroup = std::dynamic_pointer_cast( - aDoc->object(ModelAPI_ResultGroup::group(), aGIndex)); - if (aGroup.get() && !aGroup->isDisabled() && aGroup->isDisplayed()) - { + aDoc->object(ModelAPI_ResultGroup::group(), aGIndex)); + if (aGroup.get() && !aGroup->isDisabled() && aGroup->isDisplayed()) { std::vector aColor; ModelAPI_Tools::getColor(aGroup, aColor); - if (aColor.empty()) - { // default groups colors + if (aColor.empty()) { // default groups colors std::string aSection, aName, aDefault; aGroup->colorConfigInfo(aSection, aName, aDefault); if (!aSection.empty() && !aName.empty()) { aColor = Config_PropManager::color(aSection, aName); } } - if (aColor.empty()) - { + if (aColor.empty()) { aColor.push_back(150.); aColor.push_back(150.); aColor.push_back(150.); } - aText.push_back(std::pair >(aGroup->data()->name(), aColor)); + aText.push_back(std::pair>( + aGroup->data()->name(), aColor)); } } } myViewerProxy->setText(aText, aSize); } - //************************************************************** -void XGUI_Workshop::setNormalView(bool toInvert) -{ +void XGUI_Workshop::setNormalView(bool toInvert) { QList aPrsList = - mySelector->selection()->getSelected(ModuleBase_ISelection::Viewer); + mySelector->selection()->getSelected(ModuleBase_ISelection::Viewer); GeomShapePtr aPlanarFace; - foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) { + foreach (ModuleBase_ViewerPrsPtr aPrs, aPrsList) { GeomShapePtr aShape = aPrs->shape(); if (aShape.get() && aShape->isFace() && aShape->isPlanar()) { aPlanarFace = aShape; @@ -3050,15 +3108,13 @@ void XGUI_Workshop::setNormalView(bool toInvert) } //************************************************************** -void XGUI_Workshop::registerValidators() const -{ +void XGUI_Workshop::registerValidators() const { SessionPtr aMgr = ModelAPI_Session::get(); - MAYBE_UNUSED ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + MAYBE_UNUSED ModelAPI_ValidatorsFactory *aFactory = aMgr->validators(); } //************************************************************** -void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc) -{ +void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc) { if (!theDoc) return; displayGroupResults(theDoc, ModelAPI_ResultConstruction::group()); @@ -3066,26 +3122,30 @@ void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc) } //************************************************************** -void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup) -{ +void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, + std::string theGroup) { for (int i = 0; i < theDoc->size(theGroup); i++) theDoc->object(theGroup, i)->setDisplayed(true); - //displayObject(theDoc->object(theGroup, i)); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + // displayObject(theDoc->object(theGroup, i)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } //************************************************************** -void XGUI_Workshop::setDisplayMode(const QObjectPtrList& theList, int theMode) -{ - foreach(ObjectPtr anObj, theList) { - myDisplayer->setDisplayMode(anObj, (XGUI_Displayer::DisplayMode)theMode, false); +void XGUI_Workshop::setDisplayMode(const QObjectPtrList &theList, int theMode) { + foreach (ObjectPtr anObj, theList) { + myDisplayer->setDisplayMode(anObj, (XGUI_Displayer::DisplayMode)theMode, + false); - ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(anObj); + ResultBodyPtr aBodyResult = + std::dynamic_pointer_cast(anObj); if (aBodyResult.get() != NULL) { // change display mode for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); - for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - myDisplayer->setDisplayMode(*aRes, (XGUI_Displayer::DisplayMode)theMode, false); + for (std::list::iterator aRes = allRes.begin(); + aRes != allRes.end(); aRes++) { + myDisplayer->setDisplayMode(*aRes, (XGUI_Displayer::DisplayMode)theMode, + false); } } } @@ -3094,14 +3154,13 @@ void XGUI_Workshop::setDisplayMode(const QObjectPtrList& theList, int theMode) } //************************************************************** -void XGUI_Workshop::toggleEdgesDirection(const QObjectPtrList& theList) -{ - foreach(ObjectPtr anObj, theList) { +void XGUI_Workshop::toggleEdgesDirection(const QObjectPtrList &theList) { + foreach (ObjectPtr anObj, theList) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) - { + if (aResult.get() != NULL) { bool aToShow = !ModelAPI_Tools::isShowEdgesDirection(aResult); - ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aBodyResult = + std::dynamic_pointer_cast(aResult); if (aBodyResult.get() != NULL) { // change property for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); @@ -3120,13 +3179,11 @@ void XGUI_Workshop::toggleEdgesDirection(const QObjectPtrList& theList) } //************************************************************** -void XGUI_Workshop::toggleBringToFront(const QObjectPtrList& theList) -{ +void XGUI_Workshop::toggleBringToFront(const QObjectPtrList &theList) { // Toggle the "BringToFront" state of all objects in the list - foreach(ObjectPtr anObj, theList) { + foreach (ObjectPtr anObj, theList) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) - { + if (aResult.get() != NULL) { bool aBringToFront = !ModelAPI_Tools::isBringToFront(aResult); ModelAPI_Tools::bringToFront(aResult, aBringToFront); myDisplayer->redisplay(anObj, false); @@ -3137,52 +3194,51 @@ void XGUI_Workshop::toggleBringToFront(const QObjectPtrList& theList) } //************************************************************** -void XGUI_Workshop::closeDocument() -{ - ModuleBase_Operation* anOperation = operationMgr()->currentOperation(); +void XGUI_Workshop::closeDocument() { + ModuleBase_Operation *anOperation = operationMgr()->currentOperation(); while (anOperation) { anOperation->abort(); anOperation = operationMgr()->currentOperation(); } - //myDisplayer->closeLocalContexts(); + // myDisplayer->closeLocalContexts(); myDisplayer->eraseAll(); objectBrowser()->clearContent(); module()->closeDocument(); - // we need to clear viewer (with created filters) to do not have problems in 2nd SALOME study + // we need to clear viewer (with created filters) to do not have problems in + // 2nd SALOME study module()->clearViewer(); - - // data model need not process the document's signals about objects modifications as - // the document is closed - //bool isBlocked = objectBrowser()->dataModel()->blockEventsProcessing(true); + // data model need not process the document's signals about objects + // modifications as the document is closed + // bool isBlocked = objectBrowser()->dataModel()->blockEventsProcessing(true); SessionPtr aMgr = ModelAPI_Session::get(); aMgr->closeAll(); - //objectBrowser()->dataModel()->blockEventsProcessing(isBlocked); + // objectBrowser()->dataModel()->blockEventsProcessing(isBlocked); } //****************************************************** -void XGUI_Workshop::addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot) -{ - XGUI_HistoryMenu* aMenu = NULL; +void XGUI_Workshop::addHistoryMenu(QObject *theObject, const char *theSignal, + const char *theSlot) { + XGUI_HistoryMenu *aMenu = NULL; if (isSalomeMode()) { - QAction* anAction = qobject_cast(theObject); + QAction *anAction = qobject_cast(theObject); if (!anAction) return; aMenu = new XGUI_HistoryMenu(anAction); } else { - QToolButton* aButton = qobject_cast(theObject); + QToolButton *aButton = qobject_cast(theObject); aMenu = new XGUI_HistoryMenu(aButton); } - connect(this, theSignal, aMenu, SLOT(setHistory(const QList&))); + connect(this, theSignal, aMenu, SLOT(setHistory(const QList &))); connect(aMenu, SIGNAL(actionSelected(int)), this, theSlot); } //****************************************************** -QList XGUI_Workshop::processHistoryList(const std::list& theList) const -{ +QList +XGUI_Workshop::processHistoryList(const std::list &theList) const { QList aResult; std::list::const_iterator it = theList.cbegin(); for (; it != theList.cend(); it++) { @@ -3192,7 +3248,7 @@ QList XGUI_Workshop::processHistoryList(const std::list anId.chop(ModuleBase_OperationFeature::EditSuffix().size()); } ActionInfo anInfo; - QAction* aContextMenuAct = myContextMenuMgr->actionByName(anId); + QAction *aContextMenuAct = myContextMenuMgr->actionByName(anId); if (aContextMenuAct) { anInfo.initFrom(aContextMenuAct); } else { @@ -3207,8 +3263,7 @@ QList XGUI_Workshop::processHistoryList(const std::list } //****************************************************** -void XGUI_Workshop::setStatusBarMessage(const QString& theMessage) -{ +void XGUI_Workshop::setStatusBarMessage(const QString &theMessage) { #ifdef HAVE_SALOME salomeConnector()->putInfo(theMessage, -1); #else @@ -3218,22 +3273,20 @@ void XGUI_Workshop::setStatusBarMessage(const QString& theMessage) #ifdef HAVE_SALOME //****************************************************** -void XGUI_Workshop::synchronizeViewer() -{ +void XGUI_Workshop::synchronizeViewer() { SessionPtr aMgr = ModelAPI_Session::get(); QList aDocs; aDocs.append(aMgr->activeDocument()); aDocs.append(aMgr->moduleDocument()); - foreach(DocumentPtr aDoc, aDocs) { + foreach (DocumentPtr aDoc, aDocs) { synchronizeGroupInViewer(aDoc, false); } } //****************************************************** -void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc, - bool theUpdateViewer) -{ +void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr &theDoc, + bool theUpdateViewer) { FeaturePtr aFeature; ResultPtr aRes; int aSize = theDoc->numInternalFeatures(); @@ -3241,17 +3294,19 @@ void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc, aFeature = theDoc->internalFeature(i); if (!aFeature.get()) continue; - const std::list& aResults = aFeature->results(); + const std::list &aResults = aFeature->results(); std::list::const_iterator aIt; aFeature->setDisplayed(false); for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { aRes = (*aIt); if (aRes->isDisplayed() && !aRes->isConcealed()) { - // Hide the presentation with an empty shape. But isDisplayed state of the object should not - // be changed to the object becomes visible when the shape becomes not empty + // Hide the presentation with an empty shape. But isDisplayed state of + // the object should not be changed to the object becomes visible when + // the shape becomes not empty if (!aRes->shape().get() || aRes->shape()->isNull()) continue; - ResultBodyPtr aResBody = std::dynamic_pointer_cast(aRes); + ResultBodyPtr aResBody = + std::dynamic_pointer_cast(aRes); if (aResBody.get()) synchronizeResultTree(aResBody, false); else { @@ -3260,8 +3315,7 @@ void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc, myDisplayer->display(aRes, false); else myDisplayer->erase(aRes, false); - } - else + } else aRes->setDisplayed(false); } } @@ -3271,8 +3325,8 @@ void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc, myDisplayer->updateViewer(); } -void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer) -{ +void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr &theRes, + bool theUpdateViewer) { if (theRes->numberOfSubs() > 0) for (int i = 0; i < theRes->numberOfSubs(); i++) { ResultBodyPtr aRes = theRes->subResult(i); @@ -3289,19 +3343,18 @@ void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr& theRes, bool theU #endif //****************************************************** -void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::highlightResults(const QObjectPtrList &theObjects) { FeaturePtr aFeature; QObjectPtrList aSelList = theObjects; QObjectPtrList aNewSel; bool aHasHidden = false; - foreach(ObjectPtr aObj, theObjects) { + foreach (ObjectPtr aObj, theObjects) { aFeature = std::dynamic_pointer_cast(aObj); if (aFeature.get()) { std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); - std::list >::const_iterator aIt; - for(aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { + std::list>::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { aHasHidden |= (*aIt)->isConcealed(); aSelList.append(*aIt); aNewSel.append(*aIt); @@ -3319,13 +3372,12 @@ void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects) } //****************************************************** -void XGUI_Workshop::highlightFeature(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::highlightFeature(const QObjectPtrList &theObjects) { ResultPtr aResult; QObjectPtrList aSelList = theObjects; QObjectPtrList aNewSel; FeaturePtr aFeature; - foreach(ObjectPtr aObj, theObjects) { + foreach (ObjectPtr aObj, theObjects) { aResult = std::dynamic_pointer_cast(aObj); if (aResult.get()) { aFeature = ModelAPI_Feature::feature(aResult); @@ -3342,8 +3394,7 @@ void XGUI_Workshop::highlightFeature(const QObjectPtrList& theObjects) } } -void XGUI_Workshop::insertFeatureFolder() -{ +void XGUI_Workshop::insertFeatureFolder() { QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); if (anObjects.isEmpty()) return; @@ -3363,9 +3414,7 @@ void XGUI_Workshop::insertFeatureFolder() updateCommandStatus(); } - -void XGUI_Workshop::insertToFolder(bool isBefore) -{ +void XGUI_Workshop::insertToFolder(bool isBefore) { std::list aFeatures = mySelector->getSelectedFeatures(); if (aFeatures.empty()) return; @@ -3373,13 +3422,15 @@ void XGUI_Workshop::insertToFolder(bool isBefore) SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); - FolderPtr aFolder = isBefore? aDoc->findFolderAbove(aFeatures): - aDoc->findFolderBelow(aFeatures); + FolderPtr aFolder = isBefore ? aDoc->findFolderAbove(aFeatures) + : aDoc->findFolderBelow(aFeatures); if (!aFolder.get()) return; - QString aDescription = contextMenuMgr()->action( - isBefore ? "ADD_TO_FOLDER_BEFORE_CMD" : "ADD_TO_FOLDER_AFTER_CMD")->text(); + QString aDescription = contextMenuMgr() + ->action(isBefore ? "ADD_TO_FOLDER_BEFORE_CMD" + : "ADD_TO_FOLDER_AFTER_CMD") + ->text(); QMap aStates = myObjectBrowser->getFoldersState(aDoc); @@ -3392,8 +3443,7 @@ void XGUI_Workshop::insertToFolder(bool isBefore) updateCommandStatus(); } -void XGUI_Workshop::moveOutFolder(bool isBefore) -{ +void XGUI_Workshop::moveOutFolder(bool isBefore) { std::list aFeatures = mySelector->getSelectedFeatures(); if (aFeatures.empty()) return; @@ -3401,8 +3451,10 @@ void XGUI_Workshop::moveOutFolder(bool isBefore) SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); - QString aDescription = contextMenuMgr()->action( - isBefore ? "ADD_OUT_FOLDER_BEFORE_CMD" : "ADD_OUT_FOLDER_AFTER_CMD")->text(); + QString aDescription = contextMenuMgr() + ->action(isBefore ? "ADD_OUT_FOLDER_BEFORE_CMD" + : "ADD_OUT_FOLDER_AFTER_CMD") + ->text(); QMap aStates = myObjectBrowser->getFoldersState(aDoc); @@ -3415,16 +3467,14 @@ void XGUI_Workshop::moveOutFolder(bool isBefore) updateCommandStatus(); } -void XGUI_Workshop::onAutoApply() -{ +void XGUI_Workshop::onAutoApply() { SessionPtr aMgr = ModelAPI_Session::get(); bool isBlocked = aMgr->isAutoUpdateBlocked(); aMgr->blockAutoUpdate(!isBlocked); myDisplayer->updateViewer(); } -void XGUI_Workshop::updateAutoComputeState() -{ +void XGUI_Workshop::updateAutoComputeState() { SessionPtr aMgr = ModelAPI_Session::get(); #ifdef HAVE_SALOME // QAction* aUpdateCmd; @@ -3435,58 +3485,56 @@ void XGUI_Workshop::updateAutoComputeState() // break; // } // } -// aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") : +// aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") +// : // QIcon(":pictures/autoapply_start.png")); #else bool isComputeBlocked = aMgr->isAutoUpdateBlocked(); - AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); - AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD"); - aUpdateCmd->button()->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") : - QIcon(":pictures/autoapply_start.png")); + AppElements_MainMenu *aMenuBar = myMainWindow->menuObject(); + AppElements_Command *aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD"); + aUpdateCmd->button()->setIcon(isComputeBlocked + ? QIcon(":pictures/autoapply_stop.png") + : QIcon(":pictures/autoapply_start.png")); #endif } - -void XGUI_Workshop::clearTemporaryDir() -{ +void XGUI_Workshop::clearTemporaryDir() { QDir aDir(myTmpDir.path()); if (!aDir.isEmpty()) { QStringList aEntries; aDir.entryList(aEntries); - foreach(QString aFile, aEntries) { + foreach (QString aFile, aEntries) { aDir.remove(aFile); } } } - -void XGUI_Workshop::onDockSizeChanged() -{ - QDockWidget* aDockWgt = dynamic_cast(myObjectBrowser->parentWidget()); +void XGUI_Workshop::onDockSizeChanged() { + QDockWidget *aDockWgt = + dynamic_cast(myObjectBrowser->parentWidget()); int aObWidth = aDockWgt->size().width(); if (myPropertyPanel->width() != aObWidth) { - QList aWgtList; + QList aWgtList; aWgtList << myPropertyPanel << aDockWgt; QList aSizeList; aSizeList << aObWidth << aObWidth; desktop()->resizeDocks(aWgtList, aSizeList, Qt::Horizontal); - disconnect(myObjectBrowser, SIGNAL(sizeChanged()), this, SLOT(onDockSizeChanged())); + disconnect(myObjectBrowser, SIGNAL(sizeChanged()), this, + SLOT(onDockSizeChanged())); } } -void XGUI_Workshop::deactivateCurrentSelector() -{ +void XGUI_Workshop::deactivateCurrentSelector() { myActiveControlMgr->deactivateSelector(myActiveControlMgr->activeSelector()); } -void XGUI_Workshop::changeIsoLines(const QObjectPtrList& theObjects) -{ +void XGUI_Workshop::changeIsoLines(const QObjectPtrList &theObjects) { if (theObjects.isEmpty()) return; QList aResultList; ResultPtr aRes; - foreach(ObjectPtr aObj, theObjects) { + foreach (ObjectPtr aObj, theObjects) { aRes = std::dynamic_pointer_cast(aObj); if (aRes.get()) aResultList.append(aRes); @@ -3512,16 +3560,16 @@ void XGUI_Workshop::changeIsoLines(const QObjectPtrList& theObjects) XGUI_PropertyDialog aDlg(desktop()); aDlg.setWindowTitle(tr("Number of Iso-lines")); - QWidget* aIsosWgt = new QWidget(&aDlg); - QFormLayout* aLayout = new QFormLayout(aIsosWgt); + QWidget *aIsosWgt = new QWidget(&aDlg); + QFormLayout *aLayout = new QFormLayout(aIsosWgt); ModuleBase_Tools::adjustMargins(aLayout); aDlg.setContent(aIsosWgt); - QSpinBox* aUNb = new QSpinBox(&aDlg); + QSpinBox *aUNb = new QSpinBox(&aDlg); aUNb->setValue(aValues[0]); aLayout->addRow("U:", aUNb); - QSpinBox* aVNb = new QSpinBox(&aDlg); + QSpinBox *aVNb = new QSpinBox(&aDlg); aVNb->setValue(aValues[1]); aLayout->addRow("V:", aVNb); @@ -3532,11 +3580,12 @@ void XGUI_Workshop::changeIsoLines(const QObjectPtrList& theObjects) aValues[0] = aUNb->value(); aValues[1] = aVNb->value(); - foreach(ResultPtr aResult, aResultList) { + foreach (ResultPtr aResult, aResultList) { ModelAPI_Tools::setIsoLines(aResult, aValues); } mySelector->clearSelection(); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); aMgr->finishOperation(); updateCommandStatus(); } diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index b6e25c670..d985699a0 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_WORKSHOP_H @@ -33,9 +34,9 @@ #include #include -#include #include #include +#include #include #ifndef HAVE_SALOME @@ -77,15 +78,15 @@ class QWidget; /// \class XGUI_Workshop /// \ingroup GUI -/// \brief Class which defines a configuration of the application (Workshop) and launches it. -class XGUI_EXPORT XGUI_Workshop : public QObject -{ -Q_OBJECT - public: +/// \brief Class which defines a configuration of the application (Workshop) and +/// launches it. +class XGUI_EXPORT XGUI_Workshop : public QObject { + Q_OBJECT +public: /// Constructor /// \param theConnector a Salome connector object. /// Used only if the workshop is launched in Salome environment - XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0); + XGUI_Workshop(XGUI_SalomeConnector *theConnector = 0); virtual ~XGUI_Workshop(); /// Starting of the application @@ -99,90 +100,95 @@ Q_OBJECT #ifndef HAVE_SALOME /// Returns main window (Desktop) of the application - AppElements_MainWindow* mainWindow() const { return myMainWindow; } + AppElements_MainWindow *mainWindow() const { return myMainWindow; } - /// Creates and adds a new workbench (menu group) with the given name and returns it - AppElements_Workbench* addWorkbench(const QString& theName); + /// Creates and adds a new workbench (menu group) with the given name and + /// returns it + AppElements_Workbench *addWorkbench(const QString &theName); #endif /// Returns selection manager object - XGUI_SelectionMgr* selector() const { return mySelector; } + XGUI_SelectionMgr *selector() const { return mySelector; } /// Returns selection activating object - XGUI_SelectionActivate* selectionActivate() const { return mySelectionActivate; } + XGUI_SelectionActivate *selectionActivate() const { + return mySelectionActivate; + } /// Returns displayer - XGUI_Displayer* displayer() const { return myDisplayer; } + XGUI_Displayer *displayer() const { return myDisplayer; } /// Returns operation manager. - XGUI_OperationMgr* operationMgr() const { return myOperationMgr; } + XGUI_OperationMgr *operationMgr() const { return myOperationMgr; } /// Returns error manager. - XGUI_ErrorMgr* errorMgr() const { return myErrorMgr; } + XGUI_ErrorMgr *errorMgr() const { return myErrorMgr; } /// Returns an actions manager - XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; } + XGUI_ActionsMgr *actionsMgr() const { return myActionsMgr; } /// Returns an active control manager - XGUI_ActiveControlMgr* activeControlMgr() const { return myActiveControlMgr; } + XGUI_ActiveControlMgr *activeControlMgr() const { return myActiveControlMgr; } /// Returns an actions manager - XGUI_MenuMgr* menuMgr() const { return myMenuMgr; } + XGUI_MenuMgr *menuMgr() const { return myMenuMgr; } /// Returns property panel widget - XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; } + XGUI_PropertyPanel *propertyPanel() const { return myPropertyPanel; } /// Returns property panel widget - XGUI_InspectionPanel* inspectionPanel() const { return myInspectionPanel; } + XGUI_InspectionPanel *inspectionPanel() const { return myInspectionPanel; } /// Returns panel for hide object faces - XGUI_FacesPanel* facesPanel() const { return myFacesPanel; } + XGUI_FacesPanel *facesPanel() const { return myFacesPanel; } /// Returns context menu manager object - XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; } + XGUI_ContextMenuMgr *contextMenuMgr() const { return myContextMenuMgr; } - /// Returns an object which provides interface to Salome Module (LightApp_Module) - XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; } + /// Returns an object which provides interface to Salome Module + /// (LightApp_Module) + XGUI_SalomeConnector *salomeConnector() const { return mySalomeConnector; } /// Provides an object which provides interface to Salome Viewer - ModuleBase_IViewer* salomeViewer() const; + ModuleBase_IViewer *salomeViewer() const; /// Returns true if the application works as SALOME module bool isSalomeMode() const { return mySalomeConnector != 0; } /// Returns Object browser - XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; } + XGUI_ObjectsBrowser *objectBrowser() const { return myObjectBrowser; } /// This method is called by Salome module when selection is changed void salomeViewerSelectionChanged(); - /// Returns viewer which unifies access as to Salome viewer as to standalone viewer - XGUI_ViewerProxy* viewer() const { return myViewerProxy; } + /// Returns viewer which unifies access as to Salome viewer as to standalone + /// viewer + XGUI_ViewerProxy *viewer() const { return myViewerProxy; } /// Returns the module connector /// \returns the instance of connector - XGUI_ModuleConnector* moduleConnector() const { return myModuleConnector; } + XGUI_ModuleConnector *moduleConnector() const { return myModuleConnector; } /// Returns a desktop /// \return a desktop instance - QMainWindow* desktop() const; + QMainWindow *desktop() const; - /// If faces panel made the object hidden, show message box whether the object should be - /// restored (removed from the panel) and displayed, if answer is No, returns false - /// \param theObject a model object - /// \return boolean state if the object should not be displayed - virtual bool prepareForDisplay(const std::set& theObjects) const; + /// If faces panel made the object hidden, show message box whether the object + /// should be restored (removed from the panel) and displayed, if answer is + /// No, returns false \param theObject a model object \return boolean state if + /// the object should not be displayed + virtual bool prepareForDisplay(const std::set &theObjects) const; /// Delete features void deleteObjects(); - /// Searches for selected features unused in other (not selected) features. If one or several - /// selected features are found, a warning message proposes to delete them. It contains - /// the list of features to be deleted. + /// Searches for selected features unused in other (not selected) features. If + /// one or several selected features are found, a warning message proposes to + /// delete them. It contains the list of features to be deleted. void cleanHistory(); - /// Returns true if the selected feature can be moved to the position after the current feature - /// \return boolean value + /// Returns true if the selected feature can be moved to the position after + /// the current feature \return boolean value bool canMoveFeature(); /// Move selected features to be after the current feature @@ -191,77 +197,77 @@ Q_OBJECT /// Start a "Recover" feature on the selected one void recoverFeature(); - /// Returns true if the object can be shaded. If the object is a compsolid result, the method - /// checks subobjects of the result - /// \return boolean value - bool canBeShaded(const ObjectPtr& theObject) const; + /// Returns true if the object can be shaded. If the object is a compsolid + /// result, the method checks subobjects of the result \return boolean value + bool canBeShaded(const ObjectPtr &theObject) const; - /// Returns true if there is at least one selected body/construction/group result - /// \param theActionName text of the checked action - /// \return boolean value - bool canChangeProperty(const QString& theActionName) const; + /// Returns true if there is at least one selected body/construction/group + /// result \param theActionName text of the checked action \return boolean + /// value + bool canChangeProperty(const QString &theActionName) const; /// Change color of the results if it is possible /// The operation is available for construction, body and group results /// theObjects a list of selected objects - void changeColor(const QObjectPtrList& theObjects); + void changeColor(const QObjectPtrList &theObjects); /// Change Autocolor of the results if it is possible /// The operation is available for group results /// theObjects a list of selected objects - void changeAutoColor(const QObjectPtrList& theObjects); + void changeAutoColor(const QObjectPtrList &theObjects); /// Change deflection of the results if it is possible /// The operation is available for construction, body and group results /// theObjects a list of selected objects - void changeDeflection(const QObjectPtrList& theObjects); + void changeDeflection(const QObjectPtrList &theObjects); /// Change transparency of the results if it is possible /// The operation is available for construction, body and group results /// theObjects a list of selected objects - void changeTransparency(const QObjectPtrList& theObjects); + void changeTransparency(const QObjectPtrList &theObjects); /// Change number of iso-lines for the given objects /// theObjects a list of selected objects - void changeIsoLines(const QObjectPtrList& theObjects); + void changeIsoLines(const QObjectPtrList &theObjects); /// Show the given features in 3d Viewer - void showObjects(const QObjectPtrList& theList, bool isVisible); + void showObjects(const QObjectPtrList &theList, bool isVisible); /// Show the given features in 3d Viewer - void showOnlyObjects(const QObjectPtrList& theList); + void showOnlyObjects(const QObjectPtrList &theList); /// Set display mode for the given objects /// \param theList a list of displayed objects /// \param theMode a mode to set (see \ref XGUI_Displayer) - void setDisplayMode(const QObjectPtrList& theList, int theMode); + void setDisplayMode(const QObjectPtrList &theList, int theMode); /// Toggle visualisation of edges direction - void toggleEdgesDirection(const QObjectPtrList& theList); + void toggleEdgesDirection(const QObjectPtrList &theList); /// Toggle state of display priority (normal/in front) - void toggleBringToFront(const QObjectPtrList& theList); + void toggleBringToFront(const QObjectPtrList &theList); /// Set selection mode in viewer. If theMode=-1 then activate default mode /// \param theMode the selection mode (according to TopAbs_ShapeEnum) void setViewerSelectionMode(int theMode); /// Activates current selection mode for the given list of objects - void activateObjectsSelection(const QObjectPtrList& theList); + void activateObjectsSelection(const QObjectPtrList &theList); /// Returns current module - ModuleBase_IModule* module() const { return myModule; } + ModuleBase_IModule *module() const { return myModule; } /// Returns current file QString currentDataFile() const { return myCurrentFile; } /// Returns current file - void setCurrentDataFile(const QString& theDir) { myCurrentFile = theDir; } + void setCurrentDataFile(const QString &theDir) { myCurrentFile = theDir; } /// Save the current document into a directory /// \param theName - path to the directory /// \param theFileNames - returned file names created in this directory - void saveDocument(const QString& theName, std::list& theFileNames); + void saveDocument(const QString &theName, + std::list &theFileNames); /// If there is an active (uncommitted) operation shows a prompt to abort it /// and performs abortion if user agreed. Returns true if @@ -269,29 +275,30 @@ Q_OBJECT /// - there is no active operation bool abortAllOperations(); - /// Updates workshop state according to the started operation, e.g. visualizes the property panel - /// and connect to it. - /// \param theOpertion a started operation - void operationStarted(ModuleBase_Operation* theOperation); + /// Updates workshop state according to the started operation, e.g. visualizes + /// the property panel and connect to it. \param theOpertion a started + /// operation + void operationStarted(ModuleBase_Operation *theOperation); - /// Delete features. Delete the referenced features. There can be a question with a list of - /// referenced objects. - /// \param theFeatures a list of objects to be deleted - bool deleteFeatures(const QObjectPtrList& theFeatures); + /// Delete features. Delete the referenced features. There can be a question + /// with a list of referenced objects. \param theFeatures a list of objects to + /// be deleted + bool deleteFeatures(const QObjectPtrList &theFeatures); - /// Deactivates the object, if it is active and the module returns that the activation - /// of selection for the object is not possible currently(the current operation uses it) - /// \param theObject an object - /// \param theUpdateViewer a boolean flag to update viewer immediately - void deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer); + /// Deactivates the object, if it is active and the module returns that the + /// activation of selection for the object is not possible currently(the + /// current operation uses it) \param theObject an object \param + /// theUpdateViewer a boolean flag to update viewer immediately + void deactivateActiveObject(const ObjectPtr &theObject, + const bool theUpdateViewer); - /// Returns true if the action of the feature is created to contain Accept/Cancel button - /// \param theFeature a feature - bool isFeatureOfNested(const FeaturePtr& theFeature); + /// Returns true if the action of the feature is created to contain + /// Accept/Cancel button \param theFeature a feature + bool isFeatureOfNested(const FeaturePtr &theFeature); /// Shows the message in the status bar /// \param theMessage a message - void setStatusBarMessage(const QString& theMessage); + void setStatusBarMessage(const QString &theMessage); #ifdef HAVE_SALOME /// Has to be called in order to display objects with visibility status = true @@ -301,19 +308,18 @@ Q_OBJECT /// with visibility status = true /// \param theDoc the document for objects synchronisation /// \param theUpdateViewer update viewer flag - void synchronizeGroupInViewer(const DocumentPtr& theDoc, + void synchronizeGroupInViewer(const DocumentPtr &theDoc, bool theUpdateViewer); - void synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer); + void synchronizeResultTree(const ResultBodyPtr &theRes, bool theUpdateViewer); #endif - /// Update the property panel content by the XML description of the operation and set the panel - /// into the operation - /// \param theOperation an operation - void fillPropertyPanel(ModuleBase_Operation* theOperation); + /// Update the property panel content by the XML description of the operation + /// and set the panel into the operation \param theOperation an operation + void fillPropertyPanel(ModuleBase_Operation *theOperation); - /// Connects or disconnects to the value changed signal of the property panel widgets - /// \param isToConnect a boolean value whether connect or disconnect + /// Connects or disconnects to the value changed signal of the property panel + /// widgets \param isToConnect a boolean value whether connect or disconnect void connectToPropertyPanel(const bool isToConnect); /// Returns defailt selection mode in 3d viewer @@ -321,15 +327,17 @@ Q_OBJECT /// Highlights result objects in Object Browser according to /// features found in the given list - void highlightResults(const QObjectPtrList& theObjects); + void highlightResults(const QObjectPtrList &theObjects); /// Highlights feature objects in Object Browser according to /// features found in the given list - void highlightFeature(const QObjectPtrList& theObjects); + void highlightFeature(const QObjectPtrList &theObjects); /// Returns Data Model XML reader which contains information about /// Data structure configuration - const Config_DataModelReader* dataModelXMLReader() const { return myDataModelXMLReader; } + const Config_DataModelReader *dataModelXMLReader() const { + return myDataModelXMLReader; + } /// A constant string used for "Move to end" command definition /// It is used for specific processing of Undo/Redo for this command. @@ -340,7 +348,7 @@ Q_OBJECT /// Closes all in the current session and load the directory /// \param theDirectory a path to directory - void openFile(const QString& theDirectory); + void openFile(const QString &theDirectory); void updateAutoComputeState(); @@ -352,7 +360,7 @@ Q_OBJECT /// The method updates a Text of Group names in the viewer. void updateGroupsText(); - void showHelpPage(const QString& thePage) const; + void showHelpPage(const QString &thePage) const; signals: /// Emitted when selection happens in Salome viewer @@ -365,13 +373,13 @@ signals: void applicationStarted(); /// Signal to update Undo history list - void updateUndoHistory(const QList&); + void updateUndoHistory(const QList &); /// Signal to update Redo history list - void updateRedoHistory(const QList&); + void updateRedoHistory(const QList &); - public slots: - /// Update of commands status +public slots: + /// Update of commands status void updateCommandStatus(); /// update history list (undo/redo commands) @@ -393,18 +401,19 @@ signals: /// \param thePreviousState the previous state of the widget void onWidgetStateChanged(int thePreviousState); - /// Calls activate of the current widget again. It is possible that selection filters are - /// differs in the new state of paged container + /// Calls activate of the current widget again. It is possible that selection + /// filters are differs in the new state of paged container void onValuesChanged(); - /// Listens the corresponded signal of model widget and updates Apply button state by feature + /// Listens the corresponded signal of model widget and updates Apply button + /// state by feature void onWidgetObjectUpdated(); /// Show dock widget panel - void showPanel(QDockWidget* theDockWidget); + void showPanel(QDockWidget *theDockWidget); /// Hide dock widget panel - void hidePanel(QDockWidget* theDockWidget); + void hidePanel(QDockWidget *theDockWidget); /// Show object Browser void showObjectBrowser(); @@ -450,14 +459,15 @@ signals: /// Activates/deactivates the trihedron in the viewer AIS context void onTrihedronVisibilityChanged(bool theState); - /// Apply the current transparency value if preview in transparency dialog is switched on + /// Apply the current transparency value if preview in transparency dialog is + /// switched on void onTransparencyValueChanged(); - protected: - /// Sets the granted operations for the parameter operation. Firstly, it finds the nested features - /// and set them into the operation. Secondly, it asks the module about ids of granted operations. - /// \param theOperation an operation - void setGrantedFeatures(ModuleBase_Operation* theOperation); +protected: + /// Sets the granted operations for the parameter operation. Firstly, it finds + /// the nested features and set them into the operation. Secondly, it asks the + /// module about ids of granted operations. \param theOperation an operation + void setGrantedFeatures(ModuleBase_Operation *theOperation); private: /// Display results from document @@ -476,43 +486,44 @@ private: /// Insert an object to a folder above or below void moveOutFolder(bool isBefore); - private slots: - /// SLOT, that is called after the operation is resumed. Update workshop state according to - /// the started operation, e.g. visualizes the property panel and connect to it. - /// \param theOpertion a resumed operation - virtual void onOperationResumed(ModuleBase_Operation* theOperation); +private slots: + /// SLOT, that is called after the operation is resumed. Update workshop state + /// according to the started operation, e.g. visualizes the property panel and + /// connect to it. \param theOpertion a resumed operation + virtual void onOperationResumed(ModuleBase_Operation *theOperation); - /// SLOT, that is called after the operation is stopped. Update workshop state, e.g. - /// hides the property panel and update the command status. - /// \param theOpertion a stopped operation - virtual void onOperationStopped(ModuleBase_Operation* theOperation); + /// SLOT, that is called after the operation is stopped. Update workshop + /// state, e.g. hides the property panel and update the command status. \param + /// theOpertion a stopped operation + virtual void onOperationStopped(ModuleBase_Operation *theOperation); /// SLOT, that is called after the operation is committed. /// \param theOpertion a committed operation - virtual void onOperationCommitted(ModuleBase_Operation* theOperation); + virtual void onOperationCommitted(ModuleBase_Operation *theOperation); /// SLOT, that is called after the operation is aborted. /// \param theOpertion an aborted operation - void onOperationAborted(ModuleBase_Operation* theOperation); + void onOperationAborted(ModuleBase_Operation *theOperation); /// Slot, which reacts to the context popup menu call /// \param theId the data value of the clicked action /// \param isChecked a state of toggle if the action is checkable - void onContextMenuCommand(const QString& theId, bool isChecked); + void onContextMenuCommand(const QString &theId, bool isChecked); /// Set waiting cursor void onStartWaiting(); - /// Called by Ok button clicked in the property panel. Asks the error manager whether - /// the operation can be committed and do it if it returns true. + /// Called by Ok button clicked in the property panel. Asks the error manager + /// whether the operation can be committed and do it if it returns true. void onAcceptActionClicked(); - /// Called by OkPlus button clicked in the property panel. Asks the error manager whether - /// the operation can be committed and do it if it returns true. + /// Called by OkPlus button clicked in the property panel. Asks the error + /// manager whether the operation can be committed and do it if it returns + /// true. void onAcceptPlusActionClicked(); - /// Called by Preview button clicked in the property panel. Sends signal to model to - /// compute preview. + /// Called by Preview button clicked in the property panel. Sends signal to + /// model to compute preview. void onPreviewActionClicked(); /// Called on help button clicked in the property panel. @@ -521,7 +532,7 @@ private: //! The slot is called only once on resizing of Object Browser void onDockSizeChanged(); - private: +private: /// Init menu void initMenu(); @@ -530,14 +541,14 @@ private: /// Load module from external library /// \param theModule name of the module - ModuleBase_IModule* loadModule(const QString& theModule); + ModuleBase_IModule *loadModule(const QString &theModule); /// Create module bool createModule(); /// Create object browser widget /// \param theParent a parent of widget - QDockWidget* createObjectBrowser(QWidget* theParent); + QDockWidget *createObjectBrowser(QWidget *theParent); // Creates Dock widgets: Object browser and Property panel void createDockWidgets(); @@ -547,14 +558,15 @@ private: /// in salome mode - QAction that creates a button. /// \param theSignal - void "updateUndoHistory" or "updateRedoHistory" SIGNAL; /// \param theSlot - onUndo(int) or onRedo(int) SLOT - void addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot); + void addHistoryMenu(QObject *theObject, const char *theSignal, + const char *theSlot); /// Creates list of actions (commands) by given history list from session - QList processHistoryList(const std::list&) const; + QList processHistoryList(const std::list &) const; - /// Pefrom Undo/Redo and necessary workshop updates(viewer, browser, actions state) - /// \param theActionType a type of the action (Undo or Redo) - /// \param theTimes number of applies the given action + /// Pefrom Undo/Redo and necessary workshop updates(viewer, browser, actions + /// state) \param theActionType a type of the action (Undo or Redo) \param + /// theTimes number of applies the given action void processUndoRedo(const ModuleBase_ActionType theActionType, int theTimes); /// Clear content of temporary directory @@ -566,31 +578,40 @@ private: private: #ifndef HAVE_SALOME - AppElements_MainWindow* myMainWindow; ///< desktop window + AppElements_MainWindow *myMainWindow; ///< desktop window #endif - ModuleBase_IModule* myModule; ///< current module - XGUI_ErrorMgr* myErrorMgr; ///< updator of error message - XGUI_ObjectsBrowser* myObjectBrowser; ///< data tree widget - XGUI_PropertyPanel* myPropertyPanel; ///< container of feature attributes widgets - XGUI_FacesPanel* myFacesPanel; ///< panel for hide object faces - XGUI_SelectionMgr* mySelector; ///< handler of selection processing - XGUI_SelectionActivate* mySelectionActivate; /// manager of selection activating - XGUI_Displayer* myDisplayer; ///< handler of objects display - XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations - XGUI_ActionsMgr* myActionsMgr; ///< manager of workshop actions - XGUI_ActiveControlMgr* myActiveControlMgr; ///< manager to have none or one active control - XGUI_MenuMgr* myMenuMgr; ///< manager to build menu/tool bar using order defined in XML - XGUI_SalomeConnector* mySalomeConnector; ///< connector to SALOME module interface - XGUI_ErrorDialog* myErrorDlg; ///< dialog to show information of occured error events - XGUI_ViewerProxy* myViewerProxy; ///< connector to SALOME viewer interface - XGUI_ContextMenuMgr* myContextMenuMgr; ///< manager of context menu build - XGUI_ModuleConnector* myModuleConnector; ///< implementation of ModuleBase_IWorkshop - XGUI_WorkshopListener* myEventsListener; ///< processing of events - QString myCurrentFile; ///< cached the last open directory + ModuleBase_IModule *myModule; ///< current module + XGUI_ErrorMgr *myErrorMgr; ///< updator of error message + XGUI_ObjectsBrowser *myObjectBrowser; ///< data tree widget + XGUI_PropertyPanel + *myPropertyPanel; ///< container of feature attributes widgets + XGUI_FacesPanel *myFacesPanel; ///< panel for hide object faces + XGUI_SelectionMgr *mySelector; ///< handler of selection processing + XGUI_SelectionActivate + *mySelectionActivate; /// manager of selection activating + XGUI_Displayer *myDisplayer; ///< handler of objects display + XGUI_OperationMgr + *myOperationMgr; ///< manager to manipulate through the operations + XGUI_ActionsMgr *myActionsMgr; ///< manager of workshop actions + XGUI_ActiveControlMgr + *myActiveControlMgr; ///< manager to have none or one active control + XGUI_MenuMgr + *myMenuMgr; ///< manager to build menu/tool bar using order defined in XML + XGUI_SalomeConnector + *mySalomeConnector; ///< connector to SALOME module interface + XGUI_ErrorDialog + *myErrorDlg; ///< dialog to show information of occured error events + XGUI_ViewerProxy *myViewerProxy; ///< connector to SALOME viewer interface + XGUI_ContextMenuMgr *myContextMenuMgr; ///< manager of context menu build + XGUI_ModuleConnector + *myModuleConnector; ///< implementation of ModuleBase_IWorkshop + XGUI_WorkshopListener *myEventsListener; ///< processing of events + QString myCurrentFile; ///< cached the last open directory QIntList myViewerSelMode; ///< selection modes set in the viewer - Config_DataModelReader* myDataModelXMLReader; ///< XML reader of data model - XGUI_InspectionPanel* myInspectionPanel; ///< container of feature attributes widgets + Config_DataModelReader *myDataModelXMLReader; ///< XML reader of data model + XGUI_InspectionPanel + *myInspectionPanel; ///< container of feature attributes widgets QTemporaryDir myTmpDir; ///< a direcory for uncompressed files }; diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 62caede1b..cf9b52fa3 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #include "XGUI_WorkshopListener.h" @@ -24,21 +25,21 @@ #endif #include -#include #include +#include #include -#include #include +#include -#include +#include #include -#include -#include #include -#include -#include +#include +#include #include +#include +#include #include #include @@ -57,8 +58,8 @@ #include "XGUI_Displayer.h" #include "XGUI_ErrorMgr.h" #include "XGUI_FacesPanel.h" -#include "XGUI_OperationMgr.h" #include "XGUI_ModuleConnector.h" +#include "XGUI_OperationMgr.h" #include "XGUI_PropertyPanel.h" #include "XGUI_QtEvents.h" #include "XGUI_SalomeConnector.h" @@ -76,7 +77,8 @@ #endif #ifdef WIN32 -#pragma warning(disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) +#pragma warning( \ + disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) #endif //#define DEBUG_FEATURE_CREATED @@ -85,87 +87,94 @@ //#define DEBUG_RESULT_COMPSOLID #ifdef DEBUG_FEATURE_REDISPLAY -const std::string DebugFeatureKind = "";//"Extrusion"; +const std::string DebugFeatureKind = ""; //"Extrusion"; #endif -XGUI_WorkshopListener::XGUI_WorkshopListener(XGUI_Workshop* theWorkshop) - : myWorkshop(theWorkshop), - myUpdatePrefs(false) -{ -} +XGUI_WorkshopListener::XGUI_WorkshopListener(XGUI_Workshop *theWorkshop) + : myWorkshop(theWorkshop), myUpdatePrefs(false) {} //****************************************************** -XGUI_WorkshopListener::~XGUI_WorkshopListener(void) -{ -} +XGUI_WorkshopListener::~XGUI_WorkshopListener(void) {} //****************************************************** -void XGUI_WorkshopListener::initializeEventListening() -{ - //Initialize event listening - Events_Loop* aLoop = Events_Loop::loop(); - aLoop->registerListener(this, Events_InfoMessage::errorID()); //!< Listening application errors. +void XGUI_WorkshopListener::initializeEventListening() { + // Initialize event listening + Events_Loop *aLoop = Events_Loop::loop(); + aLoop->registerListener( + this, Events_InfoMessage::errorID()); //!< Listening application errors. aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aLoop->registerListener(this, + Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES)); aLoop->registerListener(this, Events_LongOp::eventID()); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)); aLoop->registerListener(this, Events_Loop::eventByName("FinishOperation")); aLoop->registerListener(this, Events_Loop::eventByName("AbortOperation")); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)); - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)); + aLoop->registerListener( + this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE)); aLoop->registerListener(this, ModelAPI_ObjectRenamedMessage::eventId()); } //****************************************************** -void XGUI_WorkshopListener::processEvent(const std::shared_ptr& theMessage) -{ +void XGUI_WorkshopListener::processEvent( + const std::shared_ptr &theMessage) { if (QApplication::instance() && QApplication::instance()->thread() != QThread::currentThread()) { - #ifdef _DEBUG - std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl; - #endif +#ifdef _DEBUG + std::cout << "XGUI_Workshop::processEvent: " + << "Working in another thread." << std::endl; +#endif SessionPtr aMgr = ModelAPI_Session::get(); - PostponeMessageQtEvent* aPostponeEvent = new PostponeMessageQtEvent(theMessage); + PostponeMessageQtEvent *aPostponeEvent = + new PostponeMessageQtEvent(theMessage); QApplication::postEvent(this, aPostponeEvent); return; } // Process creation of Part - if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { + if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); onFeatureCreatedMsg(aUpdMsg); if (myUpdatePrefs) { - XGUI_SalomeConnector* aSalomeConnector = workshop()->salomeConnector(); + XGUI_SalomeConnector *aSalomeConnector = workshop()->salomeConnector(); if (aSalomeConnector) aSalomeConnector->createPreferences(); myUpdatePrefs = false; } - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) { myUpdatePrefs = true; } // Redisplay feature - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { + else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); onFeatureRedisplayMsg(aUpdMsg); - } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES)) { + } else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); std::set aObjList = aUpdMsg->objects(); std::set::const_iterator aIt; std::list::const_iterator aResIt; - XGUI_Displayer* aDisplayer = workshop()->displayer(); + XGUI_Displayer *aDisplayer = workshop()->displayer(); AISObjectPtr aAIS; for (aIt = aObjList.begin(); aIt != aObjList.end(); ++aIt) { FeaturePtr aFeature = std::dynamic_pointer_cast(*aIt); @@ -182,29 +191,36 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& } } } - } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)) { + } else if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); onFeatureEmptyPresentationMsg(aUpdMsg); - } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)) { - ModuleBase_ModelWidget* aWidget = workshop()->propertyPanel()->activeWidget(); + } else if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)) { + ModuleBase_ModelWidget *aWidget = + workshop()->propertyPanel()->activeWidget(); if (aWidget) { - ModuleBase_WidgetSelector* aWidgetSelector = - dynamic_cast(aWidget); + ModuleBase_WidgetSelector *aWidgetSelector = + dynamic_cast(aWidget); if (aWidgetSelector) - workshop()->selector()->setSelected(aWidgetSelector->getAttributeSelection()); + workshop()->selector()->setSelected( + aWidgetSelector->getAttributeSelection()); } } else if (theMessage->eventID() == Events_Loop::eventByName("FinishOperation")/* || theMessage->eventID() == Events_Loop::eventByName("AbortOperation")*/) { - XGUI_FacesPanel* aFacesPanel = workshop()->facesPanel(); + XGUI_FacesPanel *aFacesPanel = workshop()->facesPanel(); if (aFacesPanel) - aFacesPanel->reset(false); // do not flush redisplay, it is flushed after event + aFacesPanel->reset( + false); // do not flush redisplay, it is flushed after event } - //Update property panel on corresponding message. If there is no current operation (no - //property panel), or received message has different feature to the current - do nothing. - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) { + // Update property panel on corresponding message. If there is no current + // operation (no property panel), or received message has different feature to + // the current - do nothing. + else if (theMessage->eventID() == + Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) { std::shared_ptr anUpdateMsg = std::dynamic_pointer_cast(theMessage); onFeatureUpdatedMsg(anUpdateMsg); @@ -214,44 +230,46 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& } else { QApplication::restoreOverrideCursor(); } - } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)) { - // the viewer's update context will not happens until viewer updated is emitted - workshop()->displayer()->enableUpdateViewer(false); - } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)) { + } else if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)) { + // the viewer's update context will not happens until viewer updated is + // emitted + workshop()->displayer()->enableUpdateViewer(false); + } else if (theMessage->eventID() == + Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)) { // the viewer's update context is unblocked, the viewer's update works - XGUI_Displayer* aDisplayer = workshop()->displayer(); + XGUI_Displayer *aDisplayer = workshop()->displayer(); aDisplayer->enableUpdateViewer(true); - } - else if ((theMessage->eventID() == - Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)) || - (theMessage->eventID() == - Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE))) { + } else if ((theMessage->eventID() == + Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)) || + (theMessage->eventID() == + Events_Loop::eventByName( + EVENT_AUTOMATIC_RECOMPUTATION_DISABLE))) { myWorkshop->updateAutoComputeState(); - } - else if (theMessage->eventID() == ModelAPI_ObjectRenamedMessage::eventId()) { + } else if (theMessage->eventID() == + ModelAPI_ObjectRenamedMessage::eventId()) { myWorkshop->updateGroupsText(); myWorkshop->displayer()->updateViewer(); } else { - //Show error dialog if error message received. + // Show error dialog if error message received. std::shared_ptr anIngfoMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); if (anIngfoMsg) { emit errorOccurred(anIngfoMsg); } return; } #ifndef HAVE_SALOME - SessionPtr aMgr = ModelAPI_Session::get(); - AppElements_MainWindow* aMainWindow = workshop()->mainWindow(); - if (aMgr->isModified() != aMainWindow->isModifiedState()) - aMainWindow->setModifiedState(aMgr->isModified()); + SessionPtr aMgr = ModelAPI_Session::get(); + AppElements_MainWindow *aMainWindow = workshop()->mainWindow(); + if (aMgr->isModified() != aMainWindow->isModifiedState()) + aMainWindow->setModifiedState(aMgr->isModified()); #endif } //****************************************************** void XGUI_WorkshopListener::onFeatureUpdatedMsg( - const std::shared_ptr& theMsg) -{ + const std::shared_ptr &theMsg) { #ifdef DEBUG_FEATURE_UPDATED std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; @@ -261,13 +279,17 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( } QString anInfoStr = anInfo.join(";\t"); qDebug(QString("onFeatureUpdatedMsg: %1, %2") - .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); + .arg(anObjects.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif std::set aFeatures = theMsg->objects(); - XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); + XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr(); if (anOperationMgr->hasOperation()) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperationMgr->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { FeaturePtr aCurrentFeature = aFOperation->feature(); std::set::const_iterator aIt; @@ -280,16 +302,15 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( } } } - //anOperationMgr->onValidateOperation(); + // anOperationMgr->onValidateOperation(); - //if (myObjectBrowser) - // myObjectBrowser->processEvent(theMsg); + // if (myObjectBrowser) + // myObjectBrowser->processEvent(theMsg); } //****************************************************** -void XGUI_WorkshopListener:: - onFeatureRedisplayMsg(const std::shared_ptr& theMsg) -{ +void XGUI_WorkshopListener::onFeatureRedisplayMsg( + const std::shared_ptr &theMsg) { std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; @@ -300,26 +321,30 @@ void XGUI_WorkshopListener:: } QString anInfoStr = anInfo.join(";\t"); qDebug(QString("onFeatureRedisplayMsg: %1, %2") - .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); + .arg(anObjects.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif - XGUI_Workshop* aWorkshop = workshop(); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = workshop(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); bool aRedisplayed = false; - //std::list aHiddenObjects; + // std::list aHiddenObjects; for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { ObjectPtr aObj = (*aIt); // Hide the object if it is invalid or concealed one bool aHide = !aObj->data() || !aObj->data()->isValid() || - aObj->isDisabled() || (!aObj->isDisplayed()); + aObj->isDisabled() || (!aObj->isDisplayed()); if (!aHide) { // check that this is not hidden result ResultPtr aRes = std::dynamic_pointer_cast(aObj); aHide = aRes && aRes->isConcealed(); - // Hide the presentation with an empty shape. But isDisplayed state of the object should not - // be changed to the object becomes visible when the shape becomes not empty + // Hide the presentation with an empty shape. But isDisplayed state of the + // object should not be changed to the object becomes visible when the + // shape becomes not empty if (!aHide && aRes.get()) aHide = !aRes->shape().get() || aRes->shape()->isNull(); } @@ -327,55 +352,62 @@ void XGUI_WorkshopListener:: #ifdef DEBUG_RESULT_COMPSOLID ResultPtr aRes = std::dynamic_pointer_cast(aObj); if (aRes.get()) { - ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast(aRes); + ResultCompSolidPtr aCompSolidRes = + std::dynamic_pointer_cast(aRes); if (aCompSolidRes.get()) { - qDebug(QString("COMPSOLID, numberOfSubs = %1") - .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str()); + qDebug(QString("COMPSOLID, numberOfSubs = %1") + .arg(aCompSolidRes->numberOfSubs()) + .toStdString() + .c_str()); } if (ModelAPI_Tools::compSolidOwner(aRes)) qDebug("COMPSOLID sub-object"); } #endif - #ifdef DEBUG_FEATURE_REDISPLAY - QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); - FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); - if (aFeature.get()) { - std::string aKind = aFeature->getKind(); - if (aKind == DebugFeatureKind || DebugFeatureKind.empty()) { - qDebug(QString("visible=%1, hide=%2 : display= %2").arg(aDisplayer->isVisible(aObj)) - .arg(aHide).arg(anObjInfo).toStdString().c_str()); - } +#ifdef DEBUG_FEATURE_REDISPLAY + QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); + FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); + if (aFeature.get()) { + std::string aKind = aFeature->getKind(); + if (aKind == DebugFeatureKind || DebugFeatureKind.empty()) { + qDebug(QString("visible=%1, hide=%2 : display= %2") + .arg(aDisplayer->isVisible(aObj)) + .arg(aHide) + .arg(anObjInfo) + .toStdString() + .c_str()); } - #endif + } +#endif if (aHide) { - //we should provide objects which are hidden in the viewer, e.g. sketch always should - // visualizes all sub-features, if some features are to be hidden, sould be proposed may - // be to removed #1223 - // aHiddenObjects.push_back(aObj); + // we should provide objects which are hidden in the viewer, e.g. sketch + // always should + // visualizes all sub-features, if some features are to be hidden, sould + // be proposed may be to removed #1223 aHiddenObjects.push_back(aObj); aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed; - #ifdef DEBUG_FEATURE_REDISPLAY - // Redisplay the visible object or the object of the current operation - bool isVisibleObject = aDisplayer->isVisible(aObj); +#ifdef DEBUG_FEATURE_REDISPLAY + // Redisplay the visible object or the object of the current operation + bool isVisibleObject = aDisplayer->isVisible(aObj); - QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); - #endif - } - else { + QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); +#endif + } else { // Redisplay the visible object or the object of the current operation bool isVisibleObject = aDisplayer->isVisible(aObj); - #ifdef DEBUG_FEATURE_REDISPLAY - QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); - #endif - - if (isVisibleObject) { // redisplay visible object - //displayObject(aObj); // In order to update presentation - // in order to avoid the check whether the object can be redisplayed, the exact method - // of redisplay is called. This modification is made in order to have the line is updated - // by creation of a horizontal constraint on the line by preselection - if (ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast(aObj))) { +#ifdef DEBUG_FEATURE_REDISPLAY + QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); +#endif + + if (isVisibleObject) { // redisplay visible object + // displayObject(aObj); // In order to update presentation + // in order to avoid the check whether the object can be redisplayed, + // the exact method of redisplay is called. This modification is made + // in order to have the line is updated by creation of a horizontal + // constraint on the line by preselection + if (ModelAPI_Tools::hasSubResults( + std::dynamic_pointer_cast(aObj))) { aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed; - } - else { + } else { aRedisplayed = aDisplayer->redisplay(aObj, false) || aRedisplayed; // Deactivate object of current operation from selection aWorkshop->deactivateActiveObject(aObj, false); @@ -390,29 +422,28 @@ void XGUI_WorkshopListener:: } } - // this processing should be moved in another place in order to do not cause problems in - // flush messages chain - //if (aHiddenObjects.size() > 0) + // this processing should be moved in another place in order to do not cause + // problems in flush messages chain + // if (aHiddenObjects.size() > 0) // myWorkshop->module()->processHiddenObject(aHiddenObjects); bool isCustomized = customizeFeature(anObjects, aRedisplayed); if (aRedisplayed || isCustomized) { - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); // Do not update viewer here because it can be called in a loop // In this case Update has to be called after redisplay event - //aDisplayer->updateViewer(); + // aDisplayer->updateViewer(); } } //****************************************************** -void XGUI_WorkshopListener:: - onFeatureCreatedMsg(const std::shared_ptr& theMsg) -{ +void XGUI_WorkshopListener::onFeatureCreatedMsg( + const std::shared_ptr &theMsg) { bool isLoadedScript = false; - SUIT_Session* aSession = SUIT_Session::session(); - if (aSession) - { + SUIT_Session *aSession = SUIT_Session::session(); + if (aSession) { QVariant aVar = aSession->activeApplication()->property("IsLoadedScript"); isLoadedScript = !aVar.isNull() && aVar.toBool(); } @@ -426,10 +457,13 @@ void XGUI_WorkshopListener:: } QString anInfoStr = anInfo.join(";\t"); qDebug(QString("onFeatureCreatedMsg: %1, %2") - .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); + .arg(anObjects.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif - //bool aHasPart = false; + // bool aHasPart = false; bool aDisplayed = false; for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { ObjectPtr anObject = *aIt; @@ -438,17 +472,20 @@ void XGUI_WorkshopListener:: ResultPtr aRes = std::dynamic_pointer_cast(anObject); if (aRes.get()) { ResultCompSolidPtr aCompSolidRes = - std::dynamic_pointer_cast(aRes); + std::dynamic_pointer_cast(aRes); if (aCompSolidRes.get()) { qDebug(QString("COMPSOLID, numberOfSubs = %1") - .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str()); + .arg(aCompSolidRes->numberOfSubs()) + .toStdString() + .c_str()); } if (ModelAPI_Tools::compSolidOwner(aRes)) qDebug("COMPSOLID sub-object"); } #endif - ResultBodyPtr aRes = std::dynamic_pointer_cast(anObject); + ResultBodyPtr aRes = + std::dynamic_pointer_cast(anObject); if (aRes.get() && aRes->numberOfSubs() > 0) for (int anIndex = 0; anIndex < aRes->numberOfSubs(); ++anIndex) setDisplayed(aRes->subResult(anIndex), isLoadedScript, aDisplayed); @@ -458,21 +495,21 @@ void XGUI_WorkshopListener:: MAYBE_UNUSED bool isCustomized = customizeFeature(anObjects, aDisplayed); - //if (myObjectBrowser) - // myObjectBrowser->processEvent(theMsg); + // if (myObjectBrowser) + // myObjectBrowser->processEvent(theMsg); if (aDisplayed) { - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); + Events_Loop::loop()->flush( + Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); workshop()->displayer()->updateViewer(); } - //if (aHasPart) { // TODO: Avoid activate last part on loading of document - // activateLastPart(); - //} + // if (aHasPart) { // TODO: Avoid activate last part on loading of document + // activateLastPart(); + // } } //****************************************************** void XGUI_WorkshopListener::onFeatureEmptyPresentationMsg( - const std::shared_ptr& theMsg) -{ + const std::shared_ptr &theMsg) { std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; #ifdef DEBUG_FEATURE_CREATED @@ -482,11 +519,14 @@ void XGUI_WorkshopListener::onFeatureEmptyPresentationMsg( } QString anInfoStr = anInfo.join(";\t"); qDebug(QString("onFeatureEmptyPresentationMsg: %1, %2") - .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); + .arg(anObjects.size()) + .arg(anInfoStr) + .toStdString() + .c_str()); #endif - XGUI_Workshop* aWorkshop = workshop(); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Workshop *aWorkshop = workshop(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); bool aRedisplayed = false; for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { @@ -498,11 +538,12 @@ void XGUI_WorkshopListener::onFeatureEmptyPresentationMsg( aDisplayer->updateViewer(); } -bool XGUI_WorkshopListener::event(QEvent * theEvent) -{ - PostponeMessageQtEvent* aPostponedEv = dynamic_cast(theEvent); +bool XGUI_WorkshopListener::event(QEvent *theEvent) { + PostponeMessageQtEvent *aPostponedEv = + dynamic_cast(theEvent); if (aPostponedEv) { - std::shared_ptr aEventPtr = aPostponedEv->postponedMessage(); + std::shared_ptr aEventPtr = + aPostponedEv->postponedMessage(); processEvent(aEventPtr); return true; } @@ -510,12 +551,13 @@ bool XGUI_WorkshopListener::event(QEvent * theEvent) } //************************************************************** -bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj) -{ +bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj) { #ifdef DEBUG_RESULT_COMPSOLID ResultPtr aRes = std::dynamic_pointer_cast(theObj); - if (aRes.get() && (ModelAPI_Tools::hasSubResults(aRes) || ModelAPI_Tools::compSolidOwner(aRes))) { - ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast(aRes); + if (aRes.get() && (ModelAPI_Tools::hasSubResults(aRes) || + ModelAPI_Tools::compSolidOwner(aRes))) { + ResultCompSolidPtr aCompSolidRes = + std::dynamic_pointer_cast(aRes); if (aCompSolidRes.get()) { qDebug("COMPSOLID: displayObject"); } @@ -523,24 +565,26 @@ bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj) #endif bool aDisplayed = false; - XGUI_Workshop* aWorkshop = workshop(); - // do not display the object if it has sub objects. They should be displayed separately. + XGUI_Workshop *aWorkshop = workshop(); + // do not display the object if it has sub objects. They should be displayed + // separately. if (!aWorkshop->module()->canDisplayObject(theObj) || - ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast(theObj))) + ModelAPI_Tools::hasSubResults( + std::dynamic_pointer_cast(theObj))) return aDisplayed; - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + XGUI_Displayer *aDisplayer = aWorkshop->displayer(); return aDisplayer->display(theObj, false); } -bool XGUI_WorkshopListener::customizeFeature(const std::set& theObjects, - bool theForceRedisplay) -{ - XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); +bool XGUI_WorkshopListener::customizeFeature( + const std::set &theObjects, bool theForceRedisplay) { + XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr(); FeaturePtr aCurrentFeature; if (anOperationMgr->hasOperation()) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (anOperationMgr->currentOperation()); + ModuleBase_OperationFeature *aFOperation = + dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { aCurrentFeature = aFOperation->feature(); } @@ -548,57 +592,60 @@ bool XGUI_WorkshopListener::customizeFeature(const std::set& theObjec bool aCustomized = false; if (aCurrentFeature.get()) { - // the customize presentation should be redisplayed if force redislayed is true or - // if a list of message objects contains the operation feature for case when - // the feature is hidden, but arguments of the feature are modified - // e.g. extrusion is hidden(h=0) but sketch is chosen - if (theForceRedisplay || theObjects.find(aCurrentFeature) != theObjects.end()) { - aCustomized = myWorkshop->module()->customizeFeature(aCurrentFeature, - ModuleBase_IModule::CustomizeArguments, false) || aCustomized; - aCustomized = myWorkshop->module()->customizeFeature(aCurrentFeature, - ModuleBase_IModule::CustomizeResults, false) || aCustomized; - aCustomized = myWorkshop->module()->customizeFeature(aCurrentFeature, - ModuleBase_IModule::CustomizeHighlightedObjects, false) || aCustomized; + // the customize presentation should be redisplayed if force redislayed is + // true or if a list of message objects contains the operation feature for + // case when the feature is hidden, but arguments of the feature are + // modified e.g. extrusion is hidden(h=0) but sketch is chosen + if (theForceRedisplay || + theObjects.find(aCurrentFeature) != theObjects.end()) { + aCustomized = + myWorkshop->module()->customizeFeature( + aCurrentFeature, ModuleBase_IModule::CustomizeArguments, false) || + aCustomized; + aCustomized = + myWorkshop->module()->customizeFeature( + aCurrentFeature, ModuleBase_IModule::CustomizeResults, false) || + aCustomized; + aCustomized = + myWorkshop->module()->customizeFeature( + aCurrentFeature, ModuleBase_IModule::CustomizeHighlightedObjects, + false) || + aCustomized; } } return aCustomized; } -XGUI_Workshop* XGUI_WorkshopListener::workshop() const -{ - return myWorkshop; -} - +XGUI_Workshop *XGUI_WorkshopListener::workshop() const { return myWorkshop; } -void XGUI_WorkshopListener::setDisplayed( - ObjectPtr theObject, const bool theIsLoadedScript, bool& theDisplayed) -{ +void XGUI_WorkshopListener::setDisplayed(ObjectPtr theObject, + const bool theIsLoadedScript, + bool &theDisplayed) { if (theIsLoadedScript) { theObject->setDisplayed(theDisplayed); return; } - // the validity of the data should be checked here in order to avoid display of the objects, - // which were created, then deleted, but flush for the creation event happens after that - // we should not display disabled objects - bool aHide = !theObject->data()->isValid() || - theObject->isDisabled() || + // the validity of the data should be checked here in order to avoid display + // of the objects, which were created, then deleted, but flush for the + // creation event happens after that we should not display disabled objects + bool aHide = !theObject->data()->isValid() || theObject->isDisabled() || !theObject->isDisplayed(); if (!aHide) { // check that this is not hidden result ResultPtr aRes = std::dynamic_pointer_cast(theObject); aHide = aRes && aRes->isConcealed(); - // Hide the presentation with an empty shape. But isDisplayed state of the object should not - // be changed to the object becomes visible when the shape becomes not empty + // Hide the presentation with an empty shape. But isDisplayed state of the + // object should not be changed to the object becomes visible when the shape + // becomes not empty if (!aHide && aRes.get()) aHide = !aRes->shape().get() || aRes->shape()->isNull(); } if (!aHide) { - // setDisplayed has to be called in order to synchronize internal state of the object - // with list of displayed objects + // setDisplayed has to be called in order to synchronize internal state of + // the object with list of displayed objects if (myWorkshop->module()->canDisplayObject(theObject)) { theObject->setDisplayed(true); theDisplayed = displayObject(theObject); - } - else + } else theObject->setDisplayed(false); } } diff --git a/src/XGUI/XGUI_WorkshopListener.h b/src/XGUI/XGUI_WorkshopListener.h index 26fbcbc2a..13b6c27ae 100644 --- a/src/XGUI/XGUI_WorkshopListener.h +++ b/src/XGUI/XGUI_WorkshopListener.h @@ -14,7 +14,8 @@ // License along with this library; if 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.com +// See http://www.salome-platform.org/ or email : +// webmaster.salome@opencascade.com // #ifndef XGUI_WORKSHOP_LISTENER_H @@ -24,8 +25,8 @@ #include #include -#include #include +#include #include @@ -43,20 +44,20 @@ class Events_InfoMessage; * \ingroup GUI * \brief Class which process the events from the event loop. */ -class XGUI_EXPORT XGUI_WorkshopListener : public QObject, public Events_Listener -{ +class XGUI_EXPORT XGUI_WorkshopListener : public QObject, + public Events_Listener { Q_OBJECT public: /// Constructor. Used only if the workshop is launched in Salome environment /// \param theWorkshop a reference to workshop. - XGUI_WorkshopListener(XGUI_Workshop* theWorkshop); + XGUI_WorkshopListener(XGUI_Workshop *theWorkshop); virtual ~XGUI_WorkshopListener(); /// Register this class in the events loop for several types of events void initializeEventListening(); //! Redefinition of Events_Listener method - virtual void processEvent(const std::shared_ptr& theMessage); + virtual void processEvent(const std::shared_ptr &theMessage); signals: /// Emitted when error in applivation happens @@ -64,49 +65,54 @@ signals: protected: /// Procedure to process postponed events - bool event(QEvent * theEvent); + bool event(QEvent *theEvent); /// Process feature update message /// \param theMsg a message with a container of objects - void onFeatureUpdatedMsg(const std::shared_ptr& theMsg); + void onFeatureUpdatedMsg( + const std::shared_ptr &theMsg); /// Process feature created message /// \param theMsg a message with a container of objects - void onFeatureCreatedMsg(const std::shared_ptr& theMsg); + void onFeatureCreatedMsg( + const std::shared_ptr &theMsg); /// Process feature redisplay message /// \param theMsg a message with a container of objects - void onFeatureRedisplayMsg(const std::shared_ptr& theMsg); + void onFeatureRedisplayMsg( + const std::shared_ptr &theMsg); /// Process clearing of presentation /// \param theMsg an event message - void onFeatureEmptyPresentationMsg(const std::shared_ptr& theMsg); + void onFeatureEmptyPresentationMsg( + const std::shared_ptr &theMsg); - /// Displaus object and fit all viewer if the object is first (update viewer will not be called) - /// Asks the module whether the object can be displayed + /// Displaus object and fit all viewer if the object is first (update viewer + /// will not be called) Asks the module whether the object can be displayed /// \param theObj an object - /// \param theFirstVisualizedBody an output state whether there are not object displayed in the - /// view and the displayed object is a body - /// \return true if the object is displayed + /// \param theFirstVisualizedBody an output state whether there are not object + /// displayed in the view and the displayed object is a body \return true if + /// the object is displayed bool displayObject(ObjectPtr theObj); - /// Calls the module method of cusomize object for the feature of the current operation - /// Perform cusomize if the force redisplay flag is true or the list of objects contains the - /// current operation feature - /// \param theObjects a list of objects to find current operation feature + /// Calls the module method of cusomize object for the feature of the current + /// operation Perform cusomize if the force redisplay flag is true or the list + /// of objects contains the current operation feature \param theObjects a list + /// of objects to find current operation feature /// if forced redisplay is false /// \param theForceRedisplay a flag to customize object even always /// \return true if the object is modified - bool customizeFeature(const std::set& theObjects, bool theForceRedisplay); + bool customizeFeature(const std::set &theObjects, + bool theForceRedisplay); /// Returns the workshop - XGUI_Workshop* workshop() const; + XGUI_Workshop *workshop() const; private: + void setDisplayed(ObjectPtr theObject, const bool theIsLoadedScript, + bool &theDisplayed); - void setDisplayed(ObjectPtr theObject, const bool theIsLoadedScript, bool& theDisplayed); - - XGUI_Workshop* myWorkshop; // the current workshop + XGUI_Workshop *myWorkshop; // the current workshop bool myUpdatePrefs; }; diff --git a/test.API/SHAPER/CMakeLists.txt b/test.API/SHAPER/CMakeLists.txt index 3d754bf23..87f44a157 100644 --- a/test.API/SHAPER/CMakeLists.txt +++ b/test.API/SHAPER/CMakeLists.txt @@ -26,7 +26,7 @@ ADD_UNIT_TESTS(${TEST_NAMES}) if(${HAVE_SALOME}) enable_testing() set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/test_API") - + install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) diff --git a/test.squish/shared/testdata/SalomeApp.xml b/test.squish/shared/testdata/SalomeApp.xml index 9a36c2fe9..85e43145a 100644 --- a/test.squish/shared/testdata/SalomeApp.xml +++ b/test.squish/shared/testdata/SalomeApp.xml @@ -157,4 +157,3 @@ Changes made in this file can be lost! - diff --git a/test.squish/shared/testdata/exchange/stl-examples/cubeCylinder_ASCII.stl b/test.squish/shared/testdata/exchange/stl-examples/cubeCylinder_ASCII.stl index b4b45cbda..778663fbd 100644 --- a/test.squish/shared/testdata/exchange/stl-examples/cubeCylinder_ASCII.stl +++ b/test.squish/shared/testdata/exchange/stl-examples/cubeCylinder_ASCII.stl @@ -1,4 +1,4 @@ -solid +solid facet normal 0.000000e+00 0.000000e+00 -1.000000e+00 outer loop vertex -1.250000e-01 6.250000e-02 0.000000e+00 diff --git a/test.squish/shared/testdata/exchange/xao-examples/Box-export.xao b/test.squish/shared/testdata/exchange/xao-examples/Box-export.xao index cb593c3b2..367a6fb2c 100644 --- a/test.squish/shared/testdata/exchange/xao-examples/Box-export.xao +++ b/test.squish/shared/testdata/exchange/xao-examples/Box-export.xao @@ -5,113 +5,113 @@ CASCADE Topology V1, (c) Matra-Datavision Locations 0 Curve2ds 24 -1 0 0 1 0 -1 0 0 1 0 -1 200 0 0 -1 -1 0 0 0 1 -1 0 -200 1 0 -1 0 0 1 0 -1 0 0 0 -1 -1 0 0 0 1 -1 0 0 1 0 -1 0 200 1 0 -1 200 0 0 -1 -1 200 0 0 1 -1 0 -200 1 0 -1 0 200 1 0 -1 0 0 0 -1 -1 200 0 0 1 -1 0 0 0 1 -1 0 0 1 0 -1 200 0 0 1 -1 0 0 1 0 -1 0 0 0 1 -1 0 200 1 0 -1 200 0 0 1 -1 0 200 1 0 +1 0 0 1 0 +1 0 0 1 0 +1 200 0 0 -1 +1 0 0 0 1 +1 0 -200 1 0 +1 0 0 1 0 +1 0 0 0 -1 +1 0 0 0 1 +1 0 0 1 0 +1 0 200 1 0 +1 200 0 0 -1 +1 200 0 0 1 +1 0 -200 1 0 +1 0 200 1 0 +1 0 0 0 -1 +1 200 0 0 1 +1 0 0 0 1 +1 0 0 1 0 +1 200 0 0 1 +1 0 0 1 0 +1 0 0 0 1 +1 0 200 1 0 +1 200 0 0 1 +1 0 200 1 0 Curves 12 -1 0 0 0 0 0 1 -1 0 0 200 -0 1 0 -1 0 200 0 0 0 1 -1 0 0 0 -0 1 0 -1 200 0 0 0 0 1 -1 200 0 200 0 1 0 -1 200 200 0 0 0 1 -1 200 0 0 -0 1 0 -1 0 0 0 1 0 -0 -1 0 0 200 1 0 -0 -1 0 200 0 1 0 -0 -1 0 200 200 1 0 -0 +1 0 0 0 0 0 1 +1 0 0 200 -0 1 0 +1 0 200 0 0 0 1 +1 0 0 0 -0 1 0 +1 200 0 0 0 0 1 +1 200 0 200 0 1 0 +1 200 200 0 0 0 1 +1 200 0 0 -0 1 0 +1 0 0 0 1 0 -0 +1 0 0 200 1 0 -0 +1 0 200 0 1 0 -0 +1 0 200 200 1 0 -0 Polygon3D 0 PolygonOnTriangulations 24 -2 1 2 -p 0.8000000008 1 0 200 -2 1 4 -p 0.8000000008 1 0 200 -2 2 3 -p 0.8000000008 1 0 200 -2 1 2 -p 0.8000000008 1 0 200 -2 4 3 -p 0.8000000008 1 0 200 -2 1 4 -p 0.8000000008 1 0 200 -2 1 4 -p 0.8000000008 1 0 200 -2 1 2 -p 0.8000000008 1 0 200 -2 1 2 -p 0.8000000008 1 0 200 -2 2 3 -p 0.8000000008 1 0 200 -2 2 3 -p 0.8000000008 1 0 200 -2 4 3 -p 0.8000000008 1 0 200 -2 4 3 -p 0.8000000008 1 0 200 -2 2 3 -p 0.8000000008 1 0 200 -2 1 4 -p 0.8000000008 1 0 200 -2 4 3 -p 0.8000000008 1 0 200 -2 1 2 -p 0.8000000008 1 0 200 -2 1 4 -p 0.8000000008 1 0 200 -2 4 3 -p 0.8000000008 1 0 200 -2 1 4 -p 0.8000000008 1 0 200 -2 1 2 -p 0.8000000008 1 0 200 -2 2 3 -p 0.8000000008 1 0 200 -2 4 3 -p 0.8000000008 1 0 200 -2 2 3 -p 0.8000000008 1 0 200 +2 1 2 +p 0.8000000008 1 0 200 +2 1 4 +p 0.8000000008 1 0 200 +2 2 3 +p 0.8000000008 1 0 200 +2 1 2 +p 0.8000000008 1 0 200 +2 4 3 +p 0.8000000008 1 0 200 +2 1 4 +p 0.8000000008 1 0 200 +2 1 4 +p 0.8000000008 1 0 200 +2 1 2 +p 0.8000000008 1 0 200 +2 1 2 +p 0.8000000008 1 0 200 +2 2 3 +p 0.8000000008 1 0 200 +2 2 3 +p 0.8000000008 1 0 200 +2 4 3 +p 0.8000000008 1 0 200 +2 4 3 +p 0.8000000008 1 0 200 +2 2 3 +p 0.8000000008 1 0 200 +2 1 4 +p 0.8000000008 1 0 200 +2 4 3 +p 0.8000000008 1 0 200 +2 1 2 +p 0.8000000008 1 0 200 +2 1 4 +p 0.8000000008 1 0 200 +2 4 3 +p 0.8000000008 1 0 200 +2 1 4 +p 0.8000000008 1 0 200 +2 1 2 +p 0.8000000008 1 0 200 +2 2 3 +p 0.8000000008 1 0 200 +2 4 3 +p 0.8000000008 1 0 200 +2 2 3 +p 0.8000000008 1 0 200 Surfaces 6 -1 0 0 0 1 0 -0 0 0 1 0 -1 0 -1 0 0 0 -0 1 0 0 0 1 1 0 -0 -1 0 0 200 0 0 1 1 0 -0 -0 1 0 -1 0 200 0 -0 1 0 0 0 1 1 0 -0 -1 0 0 0 0 0 1 1 0 -0 -0 1 0 -1 200 0 0 1 0 -0 0 0 1 0 -1 0 +1 0 0 0 1 0 -0 0 0 1 0 -1 0 +1 0 0 0 -0 1 0 0 0 1 1 0 -0 +1 0 0 200 0 0 1 1 0 -0 -0 1 0 +1 0 200 0 -0 1 0 0 0 1 1 0 -0 +1 0 0 0 0 0 1 1 0 -0 -0 1 0 +1 200 0 0 1 0 -0 0 0 1 0 -1 0 Triangulations 6 4 2 1 0 -0 0 0 0 0 200 0 200 200 0 200 0 0 0 200 0 200 -200 0 -200 2 4 3 2 1 4 +0 0 0 0 0 200 0 200 200 0 200 0 0 0 200 0 200 -200 0 -200 2 4 3 2 1 4 4 2 1 0 -0 0 0 200 0 0 200 0 200 0 0 200 0 0 0 200 200 200 200 0 3 2 1 3 1 4 +0 0 0 200 0 0 200 0 200 0 0 200 0 0 0 200 200 200 200 0 3 2 1 3 1 4 4 2 1 0 -0 0 200 0 200 200 200 200 200 200 0 200 0 0 0 200 200 200 200 0 3 2 1 3 1 4 +0 0 200 0 200 200 200 200 200 200 0 200 0 0 0 200 200 200 200 0 3 2 1 3 1 4 4 2 1 0 -0 200 0 200 200 0 200 200 200 0 200 200 0 0 0 200 200 200 200 0 3 2 1 3 1 4 +0 200 0 200 200 0 200 200 200 0 200 200 0 0 0 200 200 200 200 0 3 2 1 3 1 4 4 2 1 0 -0 0 0 0 200 0 200 200 0 200 0 0 0 0 0 200 200 200 200 0 3 2 1 3 1 4 +0 0 0 0 200 0 200 200 0 200 0 0 0 0 0 200 200 200 200 0 3 2 1 3 1 4 4 2 1 0 -200 0 0 200 0 200 200 200 200 200 200 0 0 0 200 0 200 -200 0 -200 2 4 3 2 1 4 +200 0 0 200 0 200 200 200 200 200 200 0 0 0 200 0 200 -200 0 -200 2 4 3 2 1 4 TShapes 34 Ve diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_903/verificationPoints/VP_APPLY_RED b/test.squish/suite_FEATURE_PARAMETERS/tst_903/verificationPoints/VP_APPLY_RED index 69b20dfa8..fa7fdf02a 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/tst_903/verificationPoints/VP_APPLY_RED +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_903/verificationPoints/VP_APPLY_RED @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAAA3NCSVQICAjb4U/gAAAA1VBMVEWOODiOQ0OPLy+PQECQQ0OQRESRMzORPDyTKSmTPDyUUVCVKyqYWFeZIiKaYWGbJiacJiacYmGdIyOdZWWeJSWicnKjb2+lIiGmf36nHh6neHeneHiog4OrhoWtHR2wGRmwGhqyHR2ykZC3nZy4mJi5nJu5n5++ExPCsbDEFBTGt7bIDg7Ju7rOyMfRCgrT0M/UBQXUCQnUCwvUz8/W09LX1dTY1tXa2djbAgLcBQXc29rdBQXfBATgAgLg4N/hAQHh4eDi4uHj5OPkAADk5eTm5+b/Kip+gOp4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAqElEQVQokaXQxw7CMBBFUXrvEHrvEHrvhOL7/59EBFIIwRvEbOw5lqx5YxPysv3p92zxInNlsnFJfJyDhMTdcIx8e1sFn2b4avfiSxDUhjFPupppPZvkEVzvOcNQHujnsAK58dv9QHQhhBe2iinXPKU/eE71ETiu5rz9GtzsMeh0P/fQ7MH+BgHrfvIz/SsSa6uL0AGmJfHld+cZc3bjrhXiS5lb6ld/ACWKfgceuOJjAAAAAElFTkSuQmCC \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAAA3NCSVQICAjb4U/gAAAA1VBMVEWOODiOQ0OPLy+PQECQQ0OQRESRMzORPDyTKSmTPDyUUVCVKyqYWFeZIiKaYWGbJiacJiacYmGdIyOdZWWeJSWicnKjb2+lIiGmf36nHh6neHeneHiog4OrhoWtHR2wGRmwGhqyHR2ykZC3nZy4mJi5nJu5n5++ExPCsbDEFBTGt7bIDg7Ju7rOyMfRCgrT0M/UBQXUCQnUCwvUz8/W09LX1dTY1tXa2djbAgLcBQXc29rdBQXfBATgAgLg4N/hAQHh4eDi4uHj5OPkAADk5eTm5+b/Kip+gOp4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAqElEQVQokaXQxw7CMBBFUXrvEHrvEHrvhOL7/59EBFIIwRvEbOw5lqx5YxPysv3p92zxInNlsnFJfJyDhMTdcIx8e1sFn2b4avfiSxDUhjFPupppPZvkEVzvOcNQHujnsAK58dv9QHQhhBe2iinXPKU/eE71ETiu5rz9GtzsMeh0P/fQ7MH+BgHrfvIz/SsSa6uL0AGmJfHld+cZc3bjrhXiS5lb6ld/ACWKfgceuOJjAAAAAElFTkSuQmCC diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/verificationPoints/VP1 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/verificationPoints/VP1 index 185a7b297..145291f27 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/verificationPoints/VP1 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/verificationPoints/VP1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA51AAAOdQG5Y1EyAAAc80lEQVR4nO3df5CkdX3g8W8vSx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/fiJC1UtEgDIWGdh9/L8z3LBV7Zed90FnU5n9F89+qxnrfZfPfGd7/Tf/jdv+fWLT/2Rq89/6UmH3v30tvN3nvv8hRf99rxDIAAge9VkTQihP6f5/fDWKf+Tkzds+Ntu9+3d7sMVrQEAKFllWRNCWNn1jYXdx1T1bAAAM6nyTihNAwC0qJZfngAA0DxZAwBkQtYAAJmQNQBAJmQNAJAJWQMAZELWAACZkDUAQCZkDQCQCVkDAGRC1gAAmZA1AEAmZA0AkAlZAwBkQtYAAJmQNQBAJmQNAJAJWQMAZELWAACZkDUAQCZkDQCQCVkDAGTi/wPcSvXt1gpeTQAAAABJRU5ErkJggg== diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP1 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP1 index 3ea01f718..72432142a 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP1 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3deZxkVWHo8XMHVFyiJnl5PjU+jZ3FaNImRqOCiiCCXYIosikiiGyiNiDLgAjigkyzKY3KKiggO8IIziCLMKCgRn06iSYmIerTh8+8fBITiM8YmMofNVV9q+reqlvVVV23zv1+P/mY6urbVXeWz9SPc869J5lZc3YAAJh+qyZ9AgAAoyFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIB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/d9tnP+sXjHve1ej15zGNWhZAkyabLL//D88576Etf+s9Nmx7etOnhev0/N2166JFHft58/P/r9YdCeDCEP3rggac+9ak/+9nPJviLAQCqLJlZc3bmN4497vBnhXBYzncz7fvLf7lsq18fzXkBAAwoN2sAAKaLi5cAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACAS/wUcw3knoK/frAAAAABJRU5ErkJggg==40.02 \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3deZxkVWHo8XMHVFyiJnl5PjU+jZ3FaNImRqOCiiCCXYIosikiiGyiNiDLgAjigkyzKY3KKiggO8IIziCLMKCgRn06iSYmIerTh8+8fBITiM8YmMofNVV9q+reqlvVVV23zv1+P/mY6urbVXeWz9SPc869J5lZc3YAAJh+qyZ9AgAAoyFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWs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EL9452rcAAMg0+vvW/OemRx78j1+FEO5714FXf+e7N373b0b+FgAA3cZ1O76r99njgX978P23GqoBAFbIiNfWNGzzrGc8/Um/9qLFC8fx4gAAmUY/WvOoVaue95Tf0jQAwAobyyTU+u///TheFgCghxFPQu37gudv9ahH1Z7ze7Xn/F7Ht353YXG07wUAkJbMrDl7JC/04wOOecbFp4/kpQAAhjCaSaj7f+PwVY9adf8Dh4/k1QAAhjCarNniT7dY9ahVyS7JSF4NAGAII1oy/Piw6tGrtnjaFv9w/MtH84IAAAMaTdZset5frNpy1cOXPTySVwMAGEJb1hy/3cs6vr3vC55/wIv+tO+rPPvUex786oPhv43yzAAABtKWNc948pNuPWjf9DMnvXrbH/7zzwu90iMhPC48+9R7RnhyAADFtWXNYTd84dcfu9XR227d+PKuQ/e//i+/96X7f1DolR4O4XEjPz0AgKI619acfNuGA//8BSGE97962y1XrTpu3e1FX0nWAAAT1XmX4S/89d/u9Pszdx6y39Of9MTfP+2c4i9Uf6QuawCACcq4Emp+7frffvKTvvPA/x3slR4OYavRnBMAwBAysuaTb3jt//6Xnz//af9ju5lnDfBKD4VkC7fjAwAmpjNrdn3ec7abedarLrj00m9+55TXvGqAV3poTNuBAwAU0lkiJ+7wivO/9s0QwofvuPs/Hn74zF12KvpKD4WwRTjpqU8e7fkBABTUtmT4gt13+aeHfvGxe766/XGH75Uk//a+o3b91a9+78T3Prh27WNWrXp0kjw6SRoPHpMkj1616tFJsmWShBBCkjz04wcf97jH/e1v/m1Ye+tkfikAQLUtZc0es8/d9tnP+sXjHve1ej15zGNWhZAkyabLL//D88576Etf+s9Nmx7etOnhev0/N2166JFHft58/P/r9YdCeDCEP3rggac+9ak/+9nPJviLAQCqLJlZc3bmN4497vBnhXBYzncz7fvLf7lsq18fzXkBAAwoN2sAAKaLi5cAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACASsgYAiISsAQAiIWsAgEjIGgAgErIGAIiErAEAIiFrAIBIyBoAIBKyBgCIhKwBACIhawCASMgaACAS/wUcw3knoK/frAAAAABJRU5ErkJggg==40.02 diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP2 index 400004459..2bacf2edf 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3de7gkVX3v/1U9g8lJUNAo3gEZFZRhgIHhfpsNw4wgIOIYTUMOx2s8mIzRowzGSBIvwHk4CoRERY4KWCog4SIiMwOt4B25DRdzOxMjJyYaThRDbp69d1f+qN3Vq9alalV3dV1WvV+PD3Svvaq62ef32/k83+93dQcrLrxUAAAAtF+v7jcAAABQDmINAADwBLEGAAB4glgDAAA8QawBAACeINYAAABPEGsAAIAniDUAAMATxBoAAOAJYg0AAPAEsQYAAHiCWAMAADxBrAEAAJ4g1gAAAE8QawAAgCeINQAAwBPEGgAA4AliDQAA8ASxBgAAeIJYAwAAPEGsAQAAniDWAAAATxBrAACAJ4g1AADAE8QaAADgCWINAADwBLEGAAB4glgDAAA8QawBAACeINYAAABPEGsAAIAniDUAAMATxBoAAOAJYg0AAPAEsQYAAHiCWAMAADxBrAEAAJ4g1gAAAE8QawAAgCeINQAAwBPEGgAA4AliDQAA8ASxBgAAeIJYAwAAPEGsAQAAniDWAAAATxBrAACAJ4g1AADAE8QaAADgCWINAADwBLEGAAB4glgDAAA8QawBAACeINYAAABPEGsAAIAniDUAAMATxBoAAOAJYg0AAPAEsQYAAHiCWAMAADyxvO43AKBmOzZvMq6vuPDSit8JAEyJWAN0kRxlzjrrnCAIgqAXBEGvt/QgCIJPWuKODTEIQO0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AFCeck5C/eYvnth7770XF192wAEHDC8bOmaa89YepayctXr/N6w5sJS3BAAAuqacWHP1L+36k5/85PHHH1/YZ58Hrui9cfMml6teuOsuW9+c+sbv96879m9/+kQpbwkAAHRNsOLC0uZ5z/jpj254xvM/cd47nhcEj0fRp6Po63k3/97vvPna7Y9efNe3hBBf+62zv/PY322+7Y6y3g8AAOiUMj+O74ZnPF8I8dYLLrlqOPzlIHhPr3fpee/IvuQPtt31pkNWCyHOX3fs8l6PTAMAACZWZrVG8d7Nmw7v9YQQ9w6Hf2h/lctOe8V+z9nt+bs87aX/849n9E4AAEAXzDDWxD563jteHAT/KsTNw+ErguA3LzBME//1ub/z4I/+YeNnr5/pOwEAAH6b+XdC/e4Fl5zy4Y/+SxR9YJddDt55509rbak/Pf3kx372xP7Pe87aFXvO+s0AAACPVfRVl2+64JLH/uM//nVx8einPe1KKdmctu8+a1fsefwVV1993/YPbTi+mjcDAAC8VFGsEUJc/otfXPVv//bJn//8Wb3xi/7+Ccd84rv3CSE+eOfdv1hY+F+nrK/s/QAAAM/MfLYmwxWvOWX3XXbZ8L8/m6z89bm/c86NX976VzvqeksAAKC9qqvWKDauevmxe+0pZxohxHXbH/nA+rm63hIAAGi1Oqs1AAAAJaqtWgMAAFAuYg0AAPAEsQYAAHiCWAMAADxBrAEAAJ4g1gAAAE8QawAAgCeINQAAwBPEGgAA4AliDQAA8ASxBgAAeIJYAwAAPEGsAQAAniDWAAAAT/wnRRmOe6V/yVQAAAAASUVORK5CYII=00 diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/verificationPoints/VP3 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/verificationPoints/VP3 index c0c18843e..2e7213e74 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/verificationPoints/VP3 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/verificationPoints/VP3 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxO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RAEiZnZuseApCMsg7w/sCWLz86P/+p2+8c9Y5XfeOea++594uv+dPTDtr/8I9eVMbYAICQSjxvzW8ffeQXv3l4jDuec8Xndt9lzdbv/aDwIQEAgTXxdHwffelL7v/ptgOe9IQj1u1R91gAgGQ0LmuO33fvI9btceSFmzbduvVdRx9Z93AAgGQUljVbtqy98cb73vbkXfPf5R//6vWnTE/13Xj+i9Z//Cu3Zln2zi/c8Jvf/e6C444qaoQAQGwT64o4yuDY73/7/PPPX7NmzaNPfGL+ez36q191//3M89+dZdmFLz/uKWvWHP0v/9q9/ZtvPucvP33Vtffcu/xBAgCxFXOA95VPXPuaH/4wy7L/uvTSBzZuzHmvfVes+Pb8/Pvn57fNzGZZdtL++2xYu8de7/v73v/msq1f/9ujJmUNALCkYmZrOk576MeX7Pi4orYGADCSIpcMaxoAoEaNOxIKAGA8sgYACELWAABByBoAIAhZAwAEIWsAgCBkDQAQhKwBAIKQNQBAELIGAAhC1gAAQcgaACAIWQMABCFrAIAgZA0AEISsAQCCkDUAQBCyBgAIQtYAAEHIGgAgCFkDAAQhawCAIP4PU7swHJe9PIcAAAAASUVORK5CYII=00 diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/verificationPoints/VP2 index cdc0ce530..ac6a620fb 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH9CAMAAABP+2g2AAAAA3NCSVQICAjb4U/gAAADAFBMVEUAAAAAAH8AVQAAZQAAmwAA/wACvQICvgIC0QID2gMF4QUH6AcI7wgK9QoY/RgjiJErg4srhqgshaoshasshqkthawtha0tha4ugYguha4vhbIwhbQyhLkzhLw0g8E2g8Q2g8U2g8Y3gsg3gsk3g8c4gso4gss4gsw5gs05gs46gs86g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PGj5xyyebXzfn+qy674nOPcOd//zMvCzsYEEZ18m9+gz/+snO3uS8c0/m6P74j5FBAONXJv98fntFZIO2LOo93Hww4EhBSdfLP84e/LPRp+bt0/njcUeEmAoIaePt6WueEhV56cefn4QYCwhqU/CFbNy/8WqdzeKh5gMAGJf+VzmOcu+/8lx74pc5lIWcCAhqQ/IO3ftuv75r/0sfdpzpPCzgTENCA5H/auYdfPzTvlVfc0b+12RpyKCCcyuRXPLZzjl/e96apb7zmuZPr4c/xh+M67wk9GRBEVfIrVvym899//a/T+eufen7f5e551g+/+Sjnztn86zP4B4mRo+qr/IoVd5rl1U+JORcQSPXffV0RcQogGv4dG4gheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYj5PyJk2uUSxq3gAAAAAElFTkSuQmCC \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAAvIAAAH9CAMAAABP+2g2AAAAA3NCSVQICAjb4U/gAAADAFBMVEUAAAAAAH8AVQAAZQAAmwAA/wACvQICvgIC0QID2gMF4QUH6AcI7wgK9QoY/RgjiJErg4srhqgshaoshasshqkthawtha0tha4ugYguha4vhbIwhbQyhLkzhLw0g8E2g8Q2g8U2g8Y3gsg3gsk3g8c4gso4gss4gsw5gs05gs46gs86gtE7gdM7gdQ7gtI8gdU8gdc9dns9gdg9gdk+gNw+gds+gdw/gN5Ac3hAgOBAgOFBdHlNbW9TZmhcY2Njq2djq7FlAABnrWRnrbNra21rr2Frr7VwcHBzs1xzs7l1tFt1tLp4tll4trt7uL1+uVV+ub5/ulR/ur+AulSAusCDvFKDvMGKwE2KwMSLwE2LwMWNwUuNwcaPwkqPwseQw0mQw8eTxUeTxcmVxkaVxsqYx0SYx8yamsyayEOayM2ey0Cey8+hzD6hzNClAQGlzjulztKr0jer0tWw1DSw1Nex1TOx1diy1TOy1dmz1jKz1tm0AQG2/ra32C+32Nu52S67/ru92yy929693Cu93N6+3Cu+3N/BzcHD3ijD3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YgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYgheYj5PyJk2uUSxq3gAAAAAElFTkSuQmCC diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/verificationPoints/VP2 index ae6f67e7e..9c5865660 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAPoAAAHpCAYAAACr2SG8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAFeRJREFUeJzt3X1wVPW9x/HP7oZd8CqMmjBhkwiBYMFOQwFBQ2dEKLZCyx3FmasDc4EL4wxwG0l49NYm2gGaShiGJ7XFYu+I1zudFHqnf3TsxJAgJBFKUKSQRPIgkqepTAntBAgkOfePmEOWbLJJDKB836+ZM+45Z8/5/RZ5s2c3D+upq69zBOCO5r3dEwBw8xE6YAChAwYQOmAAoQMGEDpgAKEDBhA6YAChAwZE3e4J3GrFRcW3ewrATZcyLSVk3VzokhQdEy2P1yOPxyOvp/2ixuv1yuPxuAvwTbXyhZXat39fyDaToXs9Xjdyr9frRt5x2+vlFQ3uLCZDl0fXo/Z55fP63HWfzyefz3e7ZwgMqK9V6MERQdXV1930cbwer7ye9sB9Xp8bd8cSFdX1j2X06NGqqqq66XO71WPBhrChB0cEu2yrq6/7SiH29dibGb17me7zyhflU5QvSo2NjcrOzlZhYaEuXryoiRMnasWKFZo1a5Z7XCAQ6Nd4cXFxqq2t7dMxPY3V3fn6M05fxcXFubdv9lgYON0+o4eL7FY8296KsTxejzxeT3voPp98UT6tX79e4x8ar/fz3tf999+vkpIS7dyxU3N+NMc9zh/w93vMvh4b6f7h9n9x/os+jdEfHWPERMd8pT8P3Fp9etep8zN9cERQu3fv1uRJkxU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4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IAB/w96JoaHs7qEqQAAAABJRU5ErkJggg== diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/verificationPoints/VP2 index c87b7ef63..ba87ea626 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAPoAAAHpCAYAAACr2SG8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAFeRJREFUeJzt3X1wVPW9x/HP7oZd8CqMmjBhkwiBYMFOQwFBQ2dEKLZCyx3FmasDc4EL4wxwG0l49NYm2gGaShiGJ7XFYu+I1zudFHqnf3TsxJAgJBFKUKSQRPIgkqepTAntBAgkOfePmEOWbLJJDKB836+ZM+45Z8/5/RZ5s2c3D+upq69zBOCO5r3dEwBw8xE6YAChAwYQOmAAoQMGEDpgAKEDBhA6YAChAwZE3e4J3GrFRcW3ewrATZcyLSVk3VzokhQdEy2P1yOPxyOvp/2ixuv1yuPxuAvwTbXyhZXat39fyDaToXs9Xjdyr9frRt5x2+vlFQ3uLCZDl0fXo/Z55fP63HWfzyefz3e7ZwgMqK9V6MERQdXV1930cbwer7ye9sB9Xp8bd8cSFdX1j2X06NGqqqq66XO71WPBhrChB0cEu2yrq6/7SiH29dibGb17me7zyhflU5QvSo2NjcrOzlZhYaEuXryoiRMnasWKFZo1a5Z7XCAQ6Nd4cXFxqq2t7dMxPY3V3fn6M05fxcXFubdv9lgYON0+o4eL7FY8296KsTxejzxeT3voPp98UT6tX79e4x8ar/fz3tf999+vkpIS7dyxU3N+NMc9zh/w93vMvh4b6f7h9n9x/os+jdEfHWPERMd8pT8P3Fp9etep8zN9cERQu3fv1uRJkxUXbP9X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AAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IAB/w96JoaHs7qEqQAAAABJRU5ErkJggg== diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/verificationPoints/VP2 index 545adffe6..2474833d8 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAPoAAAHpCAYAAACr2SG8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAF9VJREFUeJzt3XtwlPW9x/FPduOuWIdUyDrJJkiCsU3oGIoINnZaL1WrWM8gONWBOeLBcUZULkGFHoGAVZpTsRTCpRarnvF2phOhTv/ooJibQiJIqIqSRBJCJMlmKlOgHdDc+J0/YpYs2dzlIt/3a+YZs8/l9/wW8+bZ3bDZmMZQoxOA85rnbE8AwOlH6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YEHu2J/BtVFZadranAPQq69qsiNuEPkjxgXjFxMQoxhMjT0zHAyOPx9Ox7usFOBvmzZ2nTZs3Rawj9EHyxHRE7YnxyOPpWDqj7xo8cC4g9MGKkTzek5F7vV55vB55Pd6T4RM6zhHfqtCDiUE1hhrP9jQkdVzRPTEdYXu9Xy+x3ojbp4Y+ZswY7d+//4zM70yeC+e+qKEHE4Pd1jWGGocU2pmI9Js6R3/GiYmJ6bhyezuu5rGxsTpy5IieffZZbdu2TUePHtX48eP10EMP6aabbgof5/f7BzWnpKQkNTQ0DOiY3s7V03iDOc9AJSUlhb8+3edChx6v6NG+0c+Vq2lPzuT8YjxfvxDn9XRcyWO9WrRokTLGZuidgnc0cuRIlZeXa23eWk2+fXL4OJ/fN+hzDvTYvvaPtv2LQ18M6ByD0XmOQHxgSH8e6L8B/Ry965U+mBjUxo0b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QOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhhA6IABhA4YQOiAAYQOGEDogAGEDhjw/7nZFo9tZR95AAAAAElFTkSuQmCC diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/verificationPoints/VP2 index 99730912e..767a35287 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAT70lEQVR4nO3da4xc9X3H4f/O+lZzNZgaOQXR2CoQTHEIjlAD5eYARgJRTIntBEqNcJRWxaEkwmlKsrJULiXhkjgNCIgAywGCKWBoQY1rws04FgKcukBqbCARUFrwGtKyBmNvXwydgPFlZ+bMnHN+53lezR5pz/xfrT767tnZngmXX5sAAMqvlvcBAACyIWsAgPwtmzd32by5bd5E1gAAOWs/aOqGZXIXAIAWZBU0dbIGAMjHh5vm+Cz+hknWAADdttVIk0nTJFkDAHRTh4KmziPDAECXdLRpkrUGAOiCTgdNnawBADor80eDt0fWAACd0p2RpkHWAAAd0bWRpkHWAAAZ6/JI0yBrAIAsdX+kaZA1AEA28hppGmQNAJCBHEeaBlkDALQl95GmQdYAAK0rwkjTIGsAgFYUZ6RpkDUAQNMKNdI0yBoAoAkFHGkaZA0AMFTFHGkaZA0AsHNFHmkaZA0AsBMFH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S4JuDjSvL1r6YUhr/8su948e/s3hxVm8EALBNmWXN4J2DKaVPrrmmcWXO4vtSSsP23//1Y47J6l0AALYns6yZcMi1Wd0KAKAFWT4yvHHtxgzvBgDQlCyz5oD7r8rwbgAATcn44/gazj78sGkHTXz3/c0j3t807rHHBh54oENvBABQ1zPh8s4+E7Ns3tz6i+M7/EYAQMV1PGsAALrDf/AGAIL4PywMgAfrFrzyAAAAAElFTkSuQmCC diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/verificationPoints/VP2 index 53fb3d741..04657287e 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAfoUlEQVR4nO3dfZBdZZ3g8d/t7nSaJIR3QaQVDTOggGZQpphVF8GgwBZOVlwLcHQVVyzdHdGdmpWZqbG2rFqHWWsRVqZGV6UcLNQZYY3A7LhDFgUUWVYW4zCKi0HdCDEKhJc16aTTffePCze3O/1673PvOec5n88fcPskuX1IcU6++Z3n3NNYd+U1AQBQfUNF7wAAQBqyBgDIhKwBADIhawCATMgaACATsgYAyISsAQAyIWsAgEzIGgAgE7IGAMiErAEAMiFrAIBMyBoAIBOyBgDIhKwBADIhawCATMgaACATsgYAyISsAQAyIWsAgEzIGgAgE7IGAMiErAEAMiFrAIBMyBoAIBOyBgDIhKwBgBoZn9g4PrGx6L3ol5GidwAAGJDxiY3bxja1XkRE63VOTGsAoBY6hzTbxjZtG9uU39hG1gBA/uYcz+RXNrIGADK3QLtkVjayBgBy1q6W+VbStMomj7ixZBgA8rT0UmmvI676ImLTGgDI0KymWUqvZHBBStYAQG66rpOqX5CSNQCQlQ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IhawCATMgaACATsgYAyISsAQAykexThlv+5PX/9PTjjh0/9JChRmPr40+85Qt/09r+kQ1nnn/Sb+yanLz/ke1/cOvfp/2mAACRPGv+w/+4MyK++4HLDh5b+T//7yPt7R/dfMerj3/hGz/7hbTfDgCgrS8XoT5x13ci4tLT17e3fPC1Z3z1gR/243sBALT0JWtuuP8fHnrs8RXDw9duPL+15dzfPOFT93y3H98LAKAlWdYMv2Z49/Tun5zxodaX533uhog498QTIuLqN5179bfuSfWNAADmlCxrpn84HRHNx5vtLbdv/UlE3Pm+dx29ZvXXf/TjVN8IAGBOybKm+ZVmRLzkoavbWy678ZaIOHbtwRd/8aZU3wUAYD7JsmbdydekeisAgC6kXDI8sXUi4bsBACxLyqw5/tarEr4bAMCyDB++4bx+vO/bT3vFFWe95sjVq6emm2e+5PjnrVn9v37+aD++EQBAS2PdldbEAAA58KhLACATsgYAyMT/B30b8Kpe0axEAAAAAElFTkSuQmCC diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/verificationPoints/VP1 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/verificationPoints/VP1 index 774fef61e..d192fded6 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/verificationPoints/VP1 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/verificationPoints/VP1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3df4ykd33Y8e8cvuKobrBTIAToBrObsDUFght+hCKM105L0zqhoVauoJNQEiSuQhnRS3PbWOTWp5w9ZzhgkrQnaFWpdvMHIVKTlqaI0gGSNJBGpDUq5NrulXZFgYim54YSDhY8/eMhj5+bmd2dnX3meb7f7/N66XTaWe/OfNe79vPez/eZeXqrg2EAAEjfsbYXAABQD1kDAGTihrYXAED+Rpv9lXHY6YUNZz6wTKY1AEAmZA0AkAlZAw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Lv/Lop+t6FACAvdT2BO/H/+Dx8Oww/qNvvX7cP/kPv3/+NXf1euG2d/zDuh4CAGAftU1rxu8fhxCe+9/eXdx8x8d+5/Hx+Fc/9Zm67h8AYH+1TWtWnz/8YvjZ6nt2H//ml7/29bruP29Xzlz3asKrF7wKHwAcWp2vMnztyrUa7x82qSoAAABzSURBVK07rpzpFx1z72NfeP/N31V9DwAwvzqfCfWcD7yzxnvriL0KZmJ+AwAcyMUTYnHlTH/w4KB426gGABawxEtd3v7u9yzvznNy72NfCCEMKm+XNwGA+bmCd/uK82lWLwzLc2sAgAXYhIqRE2sAYAH/H3zBIR5nOPKRAAAAAElFTkSuQmCC diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP1 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP1 index 7404d157f..283af1c98 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP1 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3dbXBc133f8f9KhMxaDCWm5shxapIqlhFCmyHrRKU1tNsE8SS2Z+ox44SlrWwau1NntuhopWE7XIVicCiK5GJQWFrXCpImrsOgKpEH1anjppnGRWo7iRwrQ5Oh4yAlYAvquA7j2EsqgLUJSG9fHOLq8u5iuQ9373n6foYvsAvu3bMPuOd3/+fce3LDlaoAAIBuLB4pDU/QgVpng+kGALDCXLnUyX8b5UAIgMWINUCgEjlmW6OzR+VuehQpB4BViDVAWKI0k8gxL+Y6enjiUVHKId8AsAGxBgiFDjRRLknkmA5zSaJaE21N30+4AWAWsQbwXKI8E6WZ3iJI4lFRytEbp3gDwCxiDeCtluWZdANHtDUdaOLFG5INgOwRawA/zZVLqZRnOqQ3Hi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eCIBzoknENpRt5solXaQh0wD+SS3WfPvPvy0ijW80onvmFr8iIp8pvv+eTXf+7l8spPVEAFyUGJAyFW7igYZMA/gnN5zSX/Xin5Xu/I93vrZ6Kn7nwpGHRCQ/8eFUngKAB+JTdLUMskWUoqJTuAk0gJdSm1sz/IbqX8rPprU1AL4arVT1JJtta7Xdgc65iebQaFRoAL+lOWW4vlhPcWsAfBXNI9Y3o5PA47/tU7w8I9lWhgAYlGas2fHJD6W4NQB+ixJGy+JN839rLzFZJ16e6XwjAFyX2tyahMKb9rxjJL/nu14rIl/8y7/69Jdf+Pnnnh/EEwHwQ6K+EulwNYP1HkWgAYIyqFgDAL1Zr+7SXiL9kGaAMA3kcnwA0LNEIkmMSXX4KABholoDAAA88f8Bd04gNWQ2rRAAAAAASUVORK5CYII= diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP2 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP2 index 8ae68b40c..c0a513f4f 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP2 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3dbXBc133f8f+ShMyaDB9SceQ4dUAVywihzYB1otIa2pMEdVLZM/WYccLSUjaN3GkyW3QCadhOVqEYHJIiiQRFJLRWkDR1FAZVgTyoTh03zdQuUtlxaFsdmggUB6kIWUjHdRjFXoABrHVAGn1xzOvV7t3FPtx7z9P3M3gBLIDds7t3z/nd/zn33lzf6IQAAIB2LP7McN/PM4BaZ5vpBgCwwmxpuJU/G2RHCIDFiDVAoFrMMc3/i5QDwCrEGiAsnaWZTe+NfAPABsQaIBTNA02LuaTRnejbCTcAzCLWAJ5rFEQ6iyA1/1Vz5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squish/suite_FEATURE_SKETCH/tst_sketch_018/verificationPoints/VP1 b/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/verificationPoints/VP1 index cd654e5d6..93236a88c 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/verificationPoints/VP1 +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/verificationPoints/VP1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAH7CAIAAAAhHuxOAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAVsElEQVR4nO3dfZDcdX3A8e9ewohAE1CgDliD3JWnUBUqApEBExCoNuJDMVQnU0elZTqONzSOie2opyM2qR4S7cNAO51prNMJOAO2YtVqALVItQhhCPTh4gPjWB3aBrCBk5hs/1hYN3u3l9293+NnX6/hj9wmt/e9Y5Pf+z7f3+93jfHNWxMl2b1xcnyLrz8AZGOs7AUAAGRD1gAAQcgaACAIWQMABCFrAIAgZA0AEISsAQCCkDUAQBCyBgAIQtYAAEHIGgAgCFkDAAQhawCAIGQNABCErAEAgpA1AEAQsgYACELWAABByBoAIAhZAwAEIWsAgCBkDQAQhKwBAIKQNQBAELIGAAhC1gAAQcgaACAIWQMABCFrAIAgZA0AEISsAQCCkDUAQBCyBgAIQtYAAEHIGgAgCFkDAAQhawCAIGQNABCErAEAgpA1AEAQsgYACELWAABByBoAIAhZAwAEIWsAgCBkDQAQhKwBAIKQNQBAELIGAAhC1gAAQcgaACAIWQMABCFrynRtSu9bfdulpzzQ+eCGCz//vtW3lbUkAKgvWVOmR1N6+yvu/Ohv/F37kbec9c/XnP+VK1b+a4mrAoCakjVl+tuUvvPDFx99+JMbLvx865F3rfpiIzWnv/ab5S4MAOpI1pRs3Wcm9zfH3vbyu1JKv3/+l4876qc7/2vFLQ+cV/a6AKB+ZE35PvvAuc897OlPrN32u+d+NaX0pm1/UPaKAKCWZE35/uiLVz3xs+euPePeo54ze+uD55S9HACoK1lTCTfdc0kzNf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/+74MlggAhJbZtOb4o448cfmy9n+nHnfsO15x9stOfMFAT/IrRy//8tXrOx/5wKsv+v7/PpbVIgGAwBrjm7fm8bx/+vrXnH78sRfftG3Qd/z2u6/evnPXx++6O6V05zVvu+eRH276wldyWCAAEE0u59Zcfe7ZF528YoimSSlN/dNd73zF2SmlD776oqVjY5oGAOhTZufWdNpw4aqhc+T2h//jslPG7/i93zlx+bJT/uRT2S4MAAgs+2nNN9/1zu07d92269+GfoZ3f+4fX3j08p0/+nGGqwIAwss4a7a/9cofPfHTD375jsU8yZ+/4bWP7HnspSe8YPX4SRmtCwCIL8us+cAlF538/KPftG37Yp7kipWnrR4/6eKbtm27d+d1l1+c1doAgPAyy5rXnXHqW89+yTmf/MtFPs/7L7nwxn+5N6X0ka9+7Wc///n02suyWB0AEF9mWfOx11zy1N69Uyc+r/93+Ys/vPaqTZOdj9z0W2v/+/+evOHr97TeXH3j37zujFMvPWU8q0UCAIFlc9+aT5zx4rVr1877W08fd1yv9zrw1FPtX5/5/o9e+ZIzPnL5xacefPXTdZevueRXx8/91GKHQABAeJndju/v115ywgkn7Ny583uvelWf77JybOy7zebHms3H8rklIAAwUjK7b83Kb6089i3HLr/n/UmjAABl8BO8AYAgZA0AEISsAQCCkDUAQBCyBgAIQtYAAEHIGgAgCFkDAAQhawCAIDLOmjXjL37vq1459/FNqy/I9gMBAHTJOGt27P7eW172a++5aFXng3de87ZfPuqobD8QAECX7Dehrv/6N99xzlntN99z0apfes5zrv2HL2b+gQAAOmWfNdvu3fnQTx79zG+/sfXm2885a8ud38j8owAAdMksa5ZcsOSpA09977xrU0pv+vTNv/7CE16/8rRPX/XG+3/045t37srqowAA9LI0qyc68PCB9MLU/J9m682/+tZ3rrv84kYjnfHxP8vqQwAALCCzaU3zlmZK6eT/vKH15sfvuvtAs/nZBx7K6vkBABaWWdaMr9za9ci+A/t/+rOns3p+AICFZXnK8Ozu2QyfDQBgIFlmzUmfvz7DZwMAGIgfngAABJHZlVBznX3Djfk9OQB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N/dNd73zF2SmlD776oqVjY5oGAOhTZufWdNpw4aqhc+T2h//jslPG7/i93zlx+bJT/uRT2S4MAAgs+2nNN9/1zu07d92269+GfoZ3f+4fX3j08p0/+nGGqwIAwss4a7a/9cofPfHTD375jsU8yZ+/4bWP7HnspSe8YPX4SRmtCwCIL8us+cAlF538/KPftG37Yp7kipWnrR4/6eKbtm27d+d1l1+c1doAgPAyy5rXnXHqW89+yTmf/MtFPs/7L7nwxn+5N6X0ka9+7Wc///n02suyWB0AEF9mWfOx11zy1N69Uyc+r/93+Ys/vPaqTZOdj9z0W2v/+/+evOHr97TeXH3j37zujFMvPWU8q0UCAIFlc9+aT5zx4rVr1877W08fd1yv9zrw1FPtX5/5/o9e+ZIzPnL5xacefPXTdZevueRXx8/91GKHQABAeJndju/v115ywgkn7Ny583uvelWf77JybOy7zebHms3H8rklIAAwUjK7b83Kb6089i3HLr/n/UmjAABl8BO8AYAgZA0AEISsAQCCkDUAQBCyBgAIQtYAAEHIGgAgCFkDAAQhawCAIDLOmjXjL37vq1459/FNqy/I9gMBAHTJOGt27P7eW172a++5aFXng3de87ZfPuqobD8QAECX7Dehrv/6N99xzlntN99z0apfes5zrv2HL2b+gQAAOmWfNdvu3fnQTx79zG+/sfXm2885a8ud38j8owAAdMksa5ZcsOSpA09977xrU0pv+vTNv/7CE16/8rRPX/XG+3/045t37srqowAA9LI0qyc68PCB9MLU/J9m682/+tZ3rrv84kYjnfHxP8vqQwAALCCzaU3zlmZK6eT/vKH15sfvuvtAs/nZBx7K6vkBABaWWdaMr9za9ci+A/t/+rOns3p+AICFZXnK8Ozu2QyfDQBgIFlmzUmfvz7DZwMAGIgfngAABJHZlVBznX3Djfk9OQBAF9MaACAIWQMABPH/wX5S/xabthIAAAAASUVORK5CYII= diff --git a/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_EXTRUSION b/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_EXTRUSION index 81bf82ac6..682dac47c 100644 --- a/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_EXTRUSION +++ b/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_EXTRUSION @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3dd3xT9f7H8c9Jk3RvSotAy+hgyBAFF8pQEBeK4kTlukURVPSKP/e66FVUHBevW3ErcMWFWxQHKMoQCy17taWs7pXk/P5IKaF0JOlJk3zzevp4+GjT9HxP2pK++/6e7zfasnxdAAAAgp/J3ycAAABgDLNfRtVEj9BKwk1lYVJn7JF1EYdYahwx1XqCLpqxBwcAAIHM7JcpqFhTYeGOLX/9tbJ0T6GxRzaZwmITUnr3HdAju+/OsmhjDw4AAAKZWdo910SaSnftLPpz2dKcXv0SBhxuDjOyU3GIaV9Z7Yo/liQnp3RIzthVyiwbAAChQvs9r71zTaJ561dfftW9Z2ZSnMVsNptMxiePXSWOdWv/mnDppWu2+WeWDQAAtD8//NY3SV3p3sL4qF6WMLPFbDGFhRk+REqitmxPgdXCIi8AAEKIH2KNJuJw2MPCNDFpmsmk+aCtsZrE4bBzwTAAACHFb3M0uq6LLrqu6zqdCgAAMIA/Lz3R9/PjOQAAAGX4Z4F3uwmcR5eT1W1t/ibn//19Lr7lcDhm3nPR1HveCAsL0zSTLy4Jd47yypPXW63WvXv3bt68OS8v7/2F+WaL1Wy2GDji2qVvlZWVHXXSdUYdsDl79xRPODPj/x7+YOjw0309FuBfb/3n6969T3b//rm5X0+43oP7I8T5cxJq/xyUf7JH36wD196sbvEVJNy/Zwucmea/j08WedzNTxl+1q3ejeVHDofjzedueu+GGwZcPOSx57+MjI4JD480Kmd8/Oa9DW/b7faKiornx4zZ+t13v2zbdkFR0bsv3B4dHR0eHh4WFiYiZ15yfxuHW7PkzUsu2fnkk9rcV+7YtWvXtf98sY0HbEFx0fbOnaO/+uiG1SuXXjvlwJkPztZ+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DH+SSk+WTX+XcE8WkydvfGj0AAAAINga/1KWL1SIniiT56Oh/5kv/HnL3pZIUKzfzIpoAAMB3k1BTn31dpELTkn10fBF5/QtJipPNRb4bAQAABBPj961poOuVmpa4/x3jj3/FabK7RDJSpU+G/L3J+OMDAIDg4tNX8N4jEian3OOLQx+VI30z5KE58sNKuWCEL0YAAABBxqexZpNImEiGd5985hTTUTdqXW9s+oUXzjlBvv5DRGT+j2Kzy6WjvD1HAACgCt+thBKRz0VOdl417P4o5hu1HiI9RY6Jqt/2Rr892vnGT5WVnz2ji8g1Z0hppXy2pP5THnhDnposy9fLyg1Gnj0AAAguvlsJJVOe+fWZKV9pWuIjkY9uP/hDtTdqPUV6inQ0mWLDwuLCwpz/t2iaJCSIpomIw2bTRDRN21hdvddme32W3fm5x/SR3hly83MHHfDX1XL+CGINAAAhTZvyjK/6mt7m50899dQOHToUFBSU9e7dEF8iTSbRNGd2cb5Rp+uVNlul3e78f5ndvk1km66fYjavtNvf0PVsn50kAABQhg/bmvT09KSkpOjo6NTU1Mz4eIdIpc1WZrcX1dQ4E8x2kW26vk2kspnU8vyNmukZPdt3pwgAABTiw1izefPmnJwck8m0a9eu/06fvjXiVk+PYKKkAQAAbvNhrFljn2T6+r8ZGRnr1q3zItMAAAB4RJvyNI0IAABQgU8XeAMAALQfn27HBwAA0H6INQAAQBHEGgAAoAhiDQAAUASxBgAAKIKVUAAAQBFmD15cGwAAIIAxCQUAABRBrAEAAIog1gAAAEUQawAAgCKINQAAQBEs8AYAAIqgrQEAAIog1gAAAEWwHR8AAFAEbQ0AAFAEsQYAACiClVAAAEARtDUAAEARxBoAAKAIYg0AAFAEsQYAACiCfWsAAIAiaGsAAIAiWOANAAAUQVsDAAAUQawBAACK+H81E5MuUdet3AAAAABJRU5ErkJggg== \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElE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0YAAABBxqexZpNImEiGd5985hTTUTdqXW9s+oUXzjlBvv5DRGT+j2Kzy6WjvD1HAACgCt+thBKRz0VOdl417P4o5hu1HiI9RY6Jqt/2Rr892vnGT5WVnz2ji8g1Z0hppXy2pP5THnhDnposy9fLyg1Gnj0AAAguvlsJJVOe+fWZKV9pWuIjkY9uP/hDtTdqPUV6inQ0mWLDwuLCwpz/t2iaJCSIpomIw2bTRDRN21hdvddme32W3fm5x/SR3hly83MHHfDX1XL+CGINAAAhTZvyjK/6mt7m50899dQOHToUFBSU9e7dEF8iTSbRNGd2cb5Rp+uVNlul3e78f5ndvk1km66fYjavtNvf0PVsn50kAABQhg/bmvT09KSkpOjo6NTU1Mz4eIdIpc1WZrcX1dQ4E8x2kW26vk2kspnU8vyNmukZPdt3pwgAABTiw1izefPmnJwck8m0a9eu/06fvjXiVk+PYKKkAQAAbvNhrFljn2T6+r8ZGRnr1q3zItMAAAB4RJvyNI0IAABQgU8XeAMAALQfn27HBwAA0H6INQAAQBHEGgAAoAhiDQAAUASxBgAAKIKVUAAAQBFmD15cGwAAIIAxCQUAABRBrAEAAIog1gAAAEUQawAAgCKINQAAQBEs8AYAAIqgrQEAAIog1gAAAEWwHR8AAFAEbQ0AAFAEsQYAACiClVAAAEARtDUAAEARxBoAAKAIYg0AAFAEsQYAACiCfWsAAIAiaGsAAIAiWOANAAAUQVsDAAAUQawBAACK+H81E5MuUdet3AAAAABJRU5ErkJggg== diff --git a/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_PARTITION b/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_PARTITION index c6588b3cc..62019122b 100644 --- a/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_PARTITION +++ b/test.squish/suite_STANDALONE/tst_532/verificationPoints/VP_PARTITION @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElE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iZIGAAC4zYexZp19gunb/6alpW3YsMGLTAMAAOAR7dbnaUQAAIAKfLrAGwAAoPX4dDs+AACA1kOsAQAAiiDWAAAARRBrAACAIog1AABAEayEAgAAijB78OLaAAAAfoxJKAAAoAhiDQAAUASxBgAAKIJYAwAAFEGsAQAAimCBNwAAUARtDQAAUASxBgAAKILt+AAAgCJoawAAgCKINQAAQBGshAIAAIqgrQEAAIog1gAAAEUQawAAgCKINQAAQBHsWwMAABRBWwMAABTBAm8AAKAI2hoAAKAIYg0AAFDE/wOMHZb7m6rmcgAAAABJRU5ErkJggg== diff --git a/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_1 b/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_1 index 280f162b6..8c08f3cab 100644 --- a/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_1 +++ b/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3dd3hUZdrH8ftMZia9EUICQkJLQhFCFwFBQBAVQRTFtrq66urK2tB1XXtb14KKrqvr2t61rgUERZGihqL0DoEE6ZCEnl5nzvvHJEMIIZmZTH3m+9m9vMgwnOdMzplzfnM/ZbQ1uboAAAAEPoOvdwAAAMA9jD5pVRM9TCsMNRSHSLV7t6yLWMVUaY2q0ON00dy7cQAA4M+MPumCijbk5x/cu3nzxqJj+e7dssEQEh2X2L1nZuf0noeKI927cQAA4M+M4vVcE24oOnKoYN2alRndesVlnm0McWdNxSqGE8VVG9auSEhIbJ2QeqSIXjYAAIKFtjrH27km3rhvwfwFnbp0bRVjMhqNBoP7k8eRQuuO7Zuv+93vtu33TS8bAADwPh/c9Q1SXXQ8PzaimynEaDKaDCEhbm8i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8X7DQAAApMHY411+3evvXaRpjVScbG2bevQFkpKGjwy7bliERncQ6aMbDj76eqRcnZneeRdF/cWAAAEOs9Wa+r/+L3haWe30N1gqNb1LVbrQV3f5rH9BAAAavBgrJF6yeau159w4Z/3/LP2nsg5BBoAAOAA7a7XCA0AAEAFHp/gDQAA4B3e+04oAAAAjyLWAAAARRBrAACAIog1AABAEcQaAACgCGZCAQAARRiFXAMAAJRAJxQAAFAEsQYAACiCWAMAABRBrAEAAIog1gAAAEUwwRsAACiCag0AAFAEsQYAACiC5fgAAIAiqNYAAABFEGsAAIAimAkFAAAUQbUGAAAoglgDAAAUQawBAACKINYAAABFsG4NAABQBNUaAACgCCZ4AwAARVCtAQAAiiDWAAAARfw/4c3A0zuQe9MAAAAASUVORK5CYII= diff --git a/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_2 b/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_2 index 2fcba9916..5a111ba8a 100644 --- a/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_2 +++ b/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_PARALLEL_2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3dd3wUdf7H8c9sdje9ExJaAkISihQREBFBQBAFQSw/C56ennoWrOh5ngWwnOcpKvbzbHcqeBYUFKRZQlG6gEIgQTokIRBIr7vz+2OTJYSQbLZmv/t63j18JMNmvrO7s7Pv7+c73xltQ7YuAAAA/s/g6w0AAABwD6NPWtVED9EKgw3FQVLt3jXrIlYxVVojKvQYXTT3rhwAALRmRp8MQUUacnMP7fvtty1FBbnuXbPBEBQZk9CjV98z0nodLg5378oBAEBrZhSv55pQQ9GRw3m/bFib3r13TN8zjUHurKlYxXC8uGrzxjXx8Q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AEUQawAAgCKINQAAQBHc6hIAACiCag0AAFCEUSjXAAAAJVCtAQAAiiDWAAAARRBrAACAIpgJBQAAFEG1BgAAKIJYAwAAFEGsAQAAiuC6NQAAQBFUawAAgCKINQAAQBFM8AYAAIqgWgMAABRBrAEAAIog1gAAAEUQawAAgCKINQAAQBFGnalQAABACVRrAACAIog1AABAEcQaAACgCGINAABQBLEGAAAoglgDAAAUwa0uAQCAIoxCrgEAAEpgEAoAACiCWAMAABRBrAEAAIog1gAAAEUwEwoAACiCag0AAFAEsQYAACiCWAMAABTB5fgAAIAiqNYAAABFEGsAAIAimOANAAAUQbUGAAAoglgDAAAUQawBAACKINYAAABFcN0aAACgCGZCAQAARTAIBQAAFEGsAQAAiiDWAAAARRBrAACAIog1AABAEcQaAACgCCZ4AwAARXA5PgAAoAgGoQAAgCKINQAAQBHEGgAAoAhiDQAAUAQzoQAAgCKo1gAAAEUQawAAgCK4bg0AAFAE1RoAAKAIYg0AAFAEsQYAACiCCd4AAEARVGsAAIAiiDUAAEARxBoAAKAIYg0AAFAEl+MDAACKYCYUAABQBINQAABAEcQaAACgCGINAABQBLEGAAAoglgDAAAUQawBAACKYII3AABQBJfjAwAAimAQCgAAKIJYAwAAFEGsAQAAiiDWAAAARTATCgAAKIJqDQAAUASxBgAAKILr1gAAAEVQrQEAAIog1gAAAEUQawAAgCKY4A0AABRBtQYAACiCWAMAABRBrAEAAIog1gAAAEVwOT4AAKAIZkIBAABFMAgFAAAUQawBAACKINYAAABFEGsAAIAiiDUAAEARxBoAAKAIo84MbwAAoASqNQAAQBHEGgAAoAhiDQAAUASxBgAAKIJYAwAAFMGtLgEAgCKo1gAAAEUQawAAgCKMwigUAABQAtUaAACgCGINAABQBLEGAAAoggneAABAEVRrAACAIog1AABAEcQaAACgCK5bAwAAFEG1BgAAKIKZUAAAQBFUawAAgCKINQAAQBHEGgAAoAhiDQAAUASxBgAAKIJYAwAAFGHUmeENAACUQLUGAAAoglgDAAAUQawBAACKINYAAABFEGsA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arcd1PcNqzT15O28bL/FR8uzsE0teniLvLZQtu1zebgAA4J88GGusOxa+8srFmtZIxcXarp1DaygpabBk6rPFIjK4p1w9ouHsp2tGyJlnyGPvOrm1AADA33m2WlP/128NT7V0DT0Mhmpd32q1HtL17R7bTgAAoAYPxhqpl2zueXW6E3/e627tPZFzCDQAAMAB2j2vEBoAAIAKPD7BGwAAwDu8d08oAAAAjyLWAAAARRBrAACAIog1AABAEcQaAACgCGZCAQAARRiFXAMAAJTAIBQAAFAEsQYAACiCWAMAABRBrAEAAIog1gAAAEUwwRsAACiCag0AAFAEsQYAACiCy/EBAABFUK0BAACKINYAAABFMBMKAAAogmoNAABQBLEGAAAoglgDAAAUQawBAACK4Lo1AABAEVRrAACAIpjgDQAAFEG1BgAAKIJYAwAAFPH/9CUAuopxGw0AAAAASUVORK5CYII= \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3dd3wUdf7H8c9sdje9ExJaAkISihQREBFBQBAFQSw/C56ennoWrOh5ngWwnOcpKvbzbHcqeBYUFKRZQlG6gEIgQTokIRBIr7vz+2OTJYSQbLZmv/t63j18JMNmvrO7s7Pv7+c73xltQ7YuAAAA/s/g6w0AAABwD6NPWtVED9EKgw3FQVLt3jXrIlYxVVojKvQYXTT3rhwAALRmRp8MQUUacnMP7fvtty1FBbnuXbPBEBQZk9CjV98z0nodLg5378oBAEBrZhSv55pQQ9GRw3m/bFib3r13TN8zjUHurKlYxXC8uGrzxjXx8Qlt4lOOFDHKBgBAoNDWZ3k718Qa9y9dsrRL125xUSaj0WgwuD95HCm07tzx2+Q//GH7Ad+MsgEAAO/zwbe+QaqLjuVGh3U3BRlNRpMhKMjtTSTEahsKcswmJnkBABBAfBBrNBGr1RIUpIlB0wwGzQPVGrNBrFYLJwwDABBQfDZGo+u66KLruq5TUwEAAG7gy1NP9Do+3AYA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ABQBLEGAAAoglgDAAAUwa0uAQCAIoxCrgEAAEpgEAoAACiCWAMAABRBrAEAAIog1gAAAEUwEwoAACiCag0AAFAEsQYAACiCWAMAABTB5fgAAIAiqNYAAABFEGsAAIAimOANAAAUQbUGAAAoglgDAAAUQawBAACKINYAAABFcN0aAACgCGZCAQAARTAIBQAAFEGsAQAAiiDWAAAARRBrAACAIog1AABAEcQaAACgCCZ4AwAARXA5PgAAoAgGoQAAgCKINQAAQBHEGgAAoAhiDQAAUAQzoQAAgCKo1gAAAEUQawAAgCK4bg0AAFAE1RoAAKAIYg0AAFAEsQYAACiCCd4AAEARVGsAAIAiiDUAAEARxBoAAKAIYg0AAFAEl+MDAACKYCYUAABQBINQAABAEcQaAACgCGINAABQBLEGAAAoglgDAAAUQawBAACKYII3AABQBJfjAwAAimAQCgAAKIJYAwAAFEGsAQAAiiDWAAAARTATCgAAKIJqDQAAUASxBgAAKILr1gAAAEVQrQEAAIog1gAAAEUQawAAgCKY4A0AABRBtQYAACiCWAMAABRBrAEAAIog1gAAAEVwOT4AAKAIZkIBAABFMAgFAAAUQawBAACKINYAAABFEGsAAIAiiDUAAEARxBoAAKAIo84MbwAAoASqNQAAQBHEGgAAoAhiDQAAUASxBgAAKIJYAwAAFMGtLgEAgCKo1gAAAEUQawAAgCKMwigUAABQAtUaAACgCGINAABQBLEGAAAoggneAABAEVRrAACAIog1AABAEcQaAACgCK5bAwAAFEG1BgAAKIKZUAAAQBFUawAAgCKINQAAQBHEGgAAoAhiDQAAUASxBgAAKIJYAwAAFGHUmeENAACUQLUGAAAoglgDAAAUQawBAACKINYAAABFEGsAAIAiuNUlAABQBNUaAACgCKNQrgEAAErwRrWmR4qMG9zI8vHneqFxAAAQKLwRazL3yuCecsk5Jy3822SJCvdC4wAAIFB46dyaRWtlWN8Tv158joSYZfYy7zQOAAACgpdizarf5OARuX1C7a/D+siC1d5pGQAABArvTfB+Za48d5v0T5OB6bI3T1ZneqthAAAQGIzebCxjs1w1XETkr//2Zr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wDu8d08oAAAAjyLWAAAARRBrAACAIog1AABAEcQaAACgCGZCAQAARRiFXAMAAJTAIBQAAFAEsQYAACiCWAMAABRBrAEAAIog1gAAAEUwwRsAACiCag0AAFAEsQYAACiCy/EBAABFUK0BAACKINYAAABFMBMKAAAogmoNAABQBLEGAAAoglgDAAAUQawBAACK4Lo1AABAEVRrAACAIpjgDQAAFEG1BgAAKIJYAwAAFPH/9CUAuopxGw0AAAAASUVORK5CYII= diff --git a/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_SKETCH b/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_SKETCH index 3c45aff9c..ec7326dd3 100644 --- a/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_SKETCH +++ b/test.squish/suite_STANDALONE/tst_PARALLEL_2/verificationPoints/VP_SKETCH @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3deXxU1fnH8edOZib7TkhASEBIwiIEURYhsimIiiCCdddq1Wq1omJrrftWaxUVrcVat19dqwICoqzKqqxKUAwkyA5J2LOvM/f3xySXEEIySWY983m3L1/JMLnnztztO8855462MVcXAAAA/2fy9goAAAC4htkrrWqih2iFwabiIKl27ZJ1EbtYKu0RFXqMLpprFw4AAHyZ2StdUJGm/PwDe37+eXPR0XzXLtlkCoqMSejZO+PMtN4Hi8Ndu3AAAODLzOLxXBNqKjp8sODHjevSe/SJyTjLHOTKmopdTMeLq7J+WBsfn9AuPuVwEb1sAAAECm1DjqdzTax57+JFi7t26x4XZTGbzSaT65PH4UL79m0/X3fDDVv3eaeXDQAAeJ4XrvomqS46lh8d1sMSZLaYLaagIJc3kRCrbTyaZ7UwyQsAgADihVijidjttqAgTUyaZjJpbqjWWE1it9sYMAwAQEDxWh+Nruuii67ruk5NBQAAuIA3h57odby4DgAAQBneme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1hIfIuMG1vz52o6zLli27XLBkAADgpzw3tmbU2dIzWZ75wGUL/HyFjDxbRGTSMDFp8vE3LlsyAADwR567b82lg+WTpa68gc2POdL3THn0BomLlPted9liAQCAn/JQteapW2TNL7J+m4sX+38LJC5Kdhe4eLEAAMAfeSLWrLxw5fFi+WyZ65d8yyVypFBSEqVXF9cvHAAA+Be3f9XlM9oz6VHpT//H9Us+N116p8j9M+SK8+WqkfLYu65vAgAA+BH3Vmuufv/T39pvTgj5Z+v+vNsftSb+ddL5suQHEZFZK6XGJjeMbl0jAABAEdo9r7mrXvPqH58oKfnr/Pm5V131mYh8pD3V0iUMMZtL7fbjur7cbs8/eT1vHyfxUfLcRyceeeVueecr2byjzesNAAD8kxtjjX3bV6++erGmNVJxsXfo4NQSSkoaPDL1uWIRGdxLrhrZcPbT1SPlrDPlkbdbubYAAMDfubdaU//Xr01Pt3QJPU2mal3fYrcf0PWtbltPAACgBjfGGqmXbO557YlW/HnvP2rviAwi0AAAACdo97xKPPrlDwAAAMFJREFUaAAAACpw+wRvAAAAz/Dcd0IBAAC4FbEGAAAoglgDAAAUQawBAACKINYAAABFMBMKAAAowizkGgAAoAQ6oQAAgCKINQAAQBHEGgAAoAhiDQAAUASxBgAAKIIJ3gAAQBFUawAAgCKINQAAQBHcjg8AACiCag0AAFAEsQYAACiCmVAAAEARVGsAAIAiiDUAAEARxBoAAKAIYg0AAFAE960BAACKoFoDAAAUwQRvAACgCKo1AABAEcQaAACgiP8HexdqKDpOWRYAAAAASUVORK5CYII= \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO3deXxU1fnH8edOZib7TkhASEBIwiIEURYhsimIiiCCdddq1Wq1omJrrftWaxUVrcVat19dqwICoqzKqqxKUAwkyA5J2LOvM/f3xySXEEIySWY983m3L1/JMLnnztztO8855462MVcXAAAA/2fy9goAAAC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AEARVGsAAIAiiDUAAEARxBoAAKAIYg0AAFAE960BAACKoFoDAAAUwQRvAACgCKo1AABAEcQaAACgiP8HexdqKDpOWRYAAAAASUVORK5CYII= diff --git a/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP1 b/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP1 index b86f9700f..86ce33d1a 100644 --- a/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP1 +++ b/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP1 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAgAElEQVR4nOzdd3gU1cIG8HNmZnfTA4RAUJoXCE1AkWLBICBFQIpgobggWFDQVVHv3c92bXfUC2JsqFcUooIKgiAiYgWxgKAUlRJEQXoPqVtm5vvjZJdlk2wvU97fs0+MYTOZ7CY7b95zzgzdWKwQAAAAAO3jkr0DAAAAALEhJOBrfDTvoThtedqddzZq1DhOG3/k4YdGTHgyThsHAACAmBMSMwQ1derU+G388KGDcdoyxucAAAA0REjYoXtfaZOL2pCNxSRWb5tmxivNnIFcAwAAoB2Jm1sT20xzUZuE7TgAAABoQ+JiTWwzzcbihO04AAAAaEMipgwzMW9rDh9K2L6fJb9Ny53Ff7G3ydmD2JFlecYjY+5+pIjneUo5jotNzJVlec6sO8xm88mTJ/fs2bNz586FK4sFk1kQTNF8ie3r3y0tLe3eb0pMdtLXyRNHx17d4sGnFva6YkjMNw4Qinde+aJ9+ytDv/+2bV+MvyOM+wMYROJiTczbmqaZtX+hrLxzvO+fPnQgwC6Ffk9fLNO8NmMaITNC/JQ+w+8L8Z6JJMvy2y/f/f7UqV3G9pjx6qrU9AyLJTXi2LHsnUe970uSVF5e/uqgQX9//fUP+/Zdf/jwgtf/mZ6ebrFYeJ4nhAwb/1i429+27p3x44/MmkUXvWk/duzYlAf+F9l+1uro4f3nnpu+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Ag2AzGNHNRCztl5TSTYhYZIGQE7Q1gCJ4CabMAobShoA+RH1Bm8AUwj2w73dkqa11/A0B5ATMY8MA3C19gb8oQpaO629ppWeBkCeKM56QHIMBrEUVSlpgjsuAEiHApcXBZKjtccMdvk/4r4mWjutPUaEKwcDyCNVPgMCSAw32dRa2JRLGp7RAHKM2RogiWq9QJ9b0pBpAOQcO6GAxGnpMUNVL0W56aelh+1OACCqhbd3QCINVbEUpbXDUxgAKrjKMJBQU3c2lZImwiMCgKRjtgZItAknbNyShkwDAD4sQgGJ5luKoqQBgClw3Rog0Vo2m6HF5aUorZ2WzVyTBgAmxWwNkHQtm43Wyv1D3McCAImmbuRECQAAMoGRYQAAkBHEGgAAkBH/DxNUhXVhZhlQAAAAAElFTkSuQmCC diff --git a/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP2 b/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP2 index 8b904e4dc..8e733632d 100644 --- a/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP2 +++ b/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP2 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAgAElEQVR4nOzdeXzUZP4H8G8ymZnenIXqcvkDioCAIpcKIiiIoCALHotQULxhi4rHtl6rrq2oiFRdXE8ERUVEQUHEE/FABOVQEYoHCHKfPedI8vsj7ZBOpzPJTDK5Pu9XXohlmqYzbfPp53mehFlfKhIAAACA9bFGHwAAAACANrgkfIx3X7lHpz1P/ec/dx1vqdPOAQAAwFq45AxBTZkyRac9YwgNAAAAJFzScsGuspPO7EjrS0mrP1tl7iFCrgEAAIAayZtbo22mObNj0g4cAAAArCF5sUbbTLO+NGkHDgAAANaQjCnDEs3bmn17k3bsdeR2bLet9A/pT2OOQDuCIDx+3z9uuW+ey+ViGJZltYm5giC8OOtmj8dz5MiRH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W+aV/SZHzw13NzxgJz7LjEM+dr3IrsiIAbeZJMolDQAMiC6WCMiHYPO+YbhiHQpNU2p/z412SglHbkoLweIWXIKG0oaANkQaawRkV85zsu2bYi8QSTv+fiqovzDD+Tl38kXZ0V8RUDUErUURUkDIEui2Anl9UPHeYPIO2z77aaZK5fdZ//sh+VEWf7+GRGRDXPkvm9He01A5OZtks0J2BhlFQvz2O4EIEPUvIEY/oP2q151nshLI0+9ca70DVU/9bH3yoXvl1W7or8oIGqbe6q3+I7+5t5uRTRvMMrnBIDQxTPMctaA89LIn1dZ8vizJz/15HPyvnfKZbPobICwWMUCgQZAJkU9W1PnMx+WSqW6/FRz10Ny7rtjuiAgQvMGq0M2kU3YuJM0ZBoAWRXPIhSAmsiWogg0ADKPHdVAzOYNhj4+zCQNAE3EvAgFQEZWo0JainJLGjINAB1EvcEbQAPB3tzbDUlzB9m/DUAXLEIBiTB3UIYCXYqyioW5NDQANKPmMjIMJMZQj0yfMbPN2eFaSQMAuslRTwPJMXdAhtq7EaZVLMwdCOpyACBl1NyN5BogWYZ6RUSaLWyqJQ2ZBoDGmK0BkqjZ2WFKGgAQdkIBCdQ9IFt8L0W5JU33AOvJAMC5NUAidQ+IjESWBqxioXug+sUAABahgITqHpAtveN+tlbSAABqaGuARBuzsKGkAYAxqW52QgEJtuXUXVGUNADQAOfWAInWvVG29FX/bBUL3RtjvRoASDbVfTe5Bkg6N9mQaQCgMTWHWAMAADKBkWEAAJARxBoAAJAR/w9M2mmKVB7jewAAAABJRU5ErkJggg== diff --git a/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP3 b/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP3 index b5e05a2a9..2e22264c9 100644 --- a/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP3 +++ b/test.squish/suite_STANDALONE/tst_common_1/verificationPoints/VP3 @@ -1 +1 @@ -iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb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AAABJRU5ErkJggg== \ No newline at end of file +iVBORw0KGgoAAAANSUhEUgAAAvIAAAKJCAIAAABWHFoZAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAgAElEQVR4nOzdd3gU5doG8Oednd1Npwaih+ahgwZFmkpEEBABQeyiC4iKBVwP4jke166fo3hEJDbsSBQsiIKiiFgQVKQoYEEIoiJIr6lbZub7Y7KbZZNs3512/669IobNZLKbsHfu95kZtr5UJgAAAAD949TeAQAAAIDk4NPwOd5/7e4UbXnKLbfsPNYyRRsHAAAAfeHTswQ1efLkFG0ZS2gAAACg4NOWC3aWnXB6R1pfSsl62yp3NxFyDQAAANRI32xNcjPN6R3TtuMAAACgD+mLNcnNNOtL07bjAAAAoA/pGBlWJL2t2bsnbft+nE4d220t/UN5q84eJI8kSY/fe+W/7p1rsVgY4zguOTFXkqSXZ95ss9kOHz78559/bt269Z2lpbzVxvPWRD7Fr2veKCsr633ujUnZyWCHD+0fe0Hbux5+p/85I5K+cYBovP7s8q5dB0d//82bl199cwz3BzCJ9MWapLc1rXLr/0TdOrLAn38Je1ae6O8ZTMk0zz8+hejxKD9k4Ojbo7xnOkmSVPLMv96aPLnH2D6Pz16WmZ1jt2fGHTsWv35f4M+iKFZUVMweNuyvL774dufOy/funf/CHdnZ2Xa73WKxENGoqx+Idfubv3v96qv3zZzJFrxy54EDB278z4vx7We99u/d9Y9/ZC9bNPnnTWtucNbuW69ObN3W5ExvOUZ3i3ifzZs3v798W7P8gszMbGzchBs/eHBHxPvc2eE7+vlneuGFqZfPjWabAGYTOdbcdt2AwJ+feGmF8r9PvLQi1s8UMalcc801r776alLamkz/IHHIctUXn7639IN5f+/8veCENucOu4QukJUZnSpi0S9sKZnmhtufDmlrQjY+7IKxNe9fFG36CY5ZdHzSamjjcZMk6bnp170yceKBTZvWd+tmPbNA+fc3kWQTCCuVFWX3/OsCOnjQ/ccf+/fsIaK2XQb+s2P3ghNaZ2XnBgegKC1b8Middx4kck+d+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aw0d0tNa/rXWTkNHpKcBgHhTC7eRa4C4M8mGTAMAo1MLiDUAACAVWBkGAAApQawBAAAp8f+DjgBir8ZZEQAAAABJRU5ErkJggg== diff --git a/test_squish-vnc.sh b/test_squish-vnc.sh index 3885bbad7..dfeaeeccf 100755 --- a/test_squish-vnc.sh +++ b/test_squish-vnc.sh @@ -5,4 +5,3 @@ a_dir=$(dirname $0) cd ${a_dir} ${a_dir}/vnc.sh ${a_dir}/test_squish.sh - diff --git a/vnc-run b/vnc-run index 8684ec10d..28aedd677 100755 --- a/vnc-run +++ b/vnc-run @@ -168,4 +168,3 @@ fi # Return the executed command's exit status. exit $RETVAL - -- 2.39.2